From e220729057bdf9fa63ee09c1c949be3ebb2c81af Mon Sep 17 00:00:00 2001 From: Andrea Bianco Date: Tue, 20 Jul 2021 14:43:53 +0200 Subject: [PATCH] Built motion from commit (unavailable).|2.6.0 --- 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 +- .../api/cloudProvider/cloudProvider.attributes.js | 2 +- .../api/cloudProvider/cloudProvider.controller.js | 2 +- server/api/cloudProvider/cloudProvider.model.js | 2 +- server/api/cloudProvider/cloudProvider.rpc.js | 2 +- server/api/cloudProvider/index.js | 2 +- server/api/cmCompany/cmCompany.attributes.js | 2 +- server/api/cmCompany/cmCompany.controller.js | 2 +- server/api/cmCompany/cmCompany.model.js | 2 +- server/api/cmCompany/cmCompany.rpc.js | 2 +- server/api/cmCompany/index.js | 2 +- server/api/cmContact/cmContact.attributes.js | 2 +- server/api/cmContact/cmContact.controller.js | 2 +- server/api/cmContact/cmContact.events.js | 2 +- server/api/cmContact/cmContact.model.js | 2 +- server/api/cmContact/cmContact.rpc.js | 2 +- server/api/cmContact/cmContact.socket.js | 2 +- server/api/cmContact/index.js | 2 +- .../cmContactHasItem.attributes.js | 2 +- .../cmContactHasItem.controller.js | 2 +- .../api/cmContactHasItem/cmContactHasItem.model.js | 2 +- .../api/cmContactHasItem/cmContactHasItem.rpc.js | 2 +- server/api/cmContactHasItem/index.js | 2 +- .../api/cmCustomField/cmCustomField.attributes.js | 2 +- .../api/cmCustomField/cmCustomField.controller.js | 2 +- server/api/cmCustomField/cmCustomField.model.js | 2 +- server/api/cmCustomField/cmCustomField.rpc.js | 2 +- server/api/cmCustomField/index.js | 2 +- server/api/cmHopper/cmHopper.attributes.js | 2 +- server/api/cmHopper/cmHopper.controller.js | 2 +- server/api/cmHopper/cmHopper.model.js | 2 +- server/api/cmHopper/cmHopper.rpc.js | 2 +- server/api/cmHopper/index.js | 2 +- .../cmHopperAdditionalPhone.attributes.js | 2 +- .../cmHopperAdditionalPhone.controller.js | 2 +- .../cmHopperAdditionalPhone.model.js | 2 +- .../cmHopperAdditionalPhone.rpc.js | 2 +- server/api/cmHopperAdditionalPhone/index.js | 2 +- .../api/cmHopperBlack/cmHopperBlack.attributes.js | 2 +- .../api/cmHopperBlack/cmHopperBlack.controller.js | 2 +- server/api/cmHopperBlack/cmHopperBlack.model.js | 2 +- server/api/cmHopperBlack/cmHopperBlack.rpc.js | 2 +- server/api/cmHopperBlack/index.js | 2 +- .../api/cmHopperFinal/cmHopperFinal.attributes.js | 2 +- .../api/cmHopperFinal/cmHopperFinal.controller.js | 2 +- server/api/cmHopperFinal/cmHopperFinal.model.js | 2 +- server/api/cmHopperFinal/cmHopperFinal.rpc.js | 2 +- server/api/cmHopperFinal/index.js | 2 +- .../cmHopperHistory/cmHopperHistory.attributes.js | 2 +- .../cmHopperHistory/cmHopperHistory.controller.js | 2 +- .../api/cmHopperHistory/cmHopperHistory.model.js | 2 +- server/api/cmHopperHistory/cmHopperHistory.rpc.js | 2 +- server/api/cmHopperHistory/index.js | 2 +- server/api/cmList/cmList.attributes.js | 2 +- server/api/cmList/cmList.controller.js | 2 +- server/api/cmList/cmList.events.js | 2 +- server/api/cmList/cmList.model.js | 2 +- server/api/cmList/cmList.rpc.js | 2 +- server/api/cmList/cmList.socket.js | 2 +- server/api/cmList/index.js | 2 +- server/api/condition/condition.attributes.js | 2 +- server/api/condition/condition.controller.js | 2 +- server/api/condition/condition.model.js | 2 +- server/api/condition/condition.rpc.js | 2 +- server/api/condition/index.js | 2 +- .../contactItemType/contactItemType.attributes.js | 2 +- .../contactItemType/contactItemType.controller.js | 2 +- .../api/contactItemType/contactItemType.model.js | 2 +- server/api/contactItemType/contactItemType.rpc.js | 2 +- server/api/contactItemType/index.js | 2 +- server/api/dashboard/dashboard.attributes.js | 2 +- server/api/dashboard/dashboard.controller.js | 2 +- server/api/dashboard/dashboard.events.js | 2 +- server/api/dashboard/dashboard.model.js | 2 +- server/api/dashboard/dashboard.rpc.js | 2 +- server/api/dashboard/dashboard.socket.js | 2 +- server/api/dashboard/index.js | 2 +- .../api/dashboardItem/dashboardItem.attributes.js | 2 +- .../api/dashboardItem/dashboardItem.controller.js | 2 +- server/api/dashboardItem/dashboardItem.events.js | 2 +- server/api/dashboardItem/dashboardItem.model.js | 2 +- server/api/dashboardItem/dashboardItem.rpc.js | 2 +- server/api/dashboardItem/dashboardItem.socket.js | 2 +- server/api/dashboardItem/index.js | 2 +- server/api/disposition/disposition.attributes.js | 2 +- server/api/disposition/disposition.controller.js | 2 +- server/api/disposition/disposition.model.js | 2 +- server/api/disposition/disposition.rpc.js | 2 +- server/api/disposition/index.js | 2 +- server/api/faxAccount/faxAccount.attributes.js | 2 +- server/api/faxAccount/faxAccount.controller.js | 2 +- server/api/faxAccount/faxAccount.events.js | 2 +- server/api/faxAccount/faxAccount.model.js | 2 +- server/api/faxAccount/faxAccount.rpc.js | 2 +- server/api/faxAccount/faxAccount.socket.js | 2 +- server/api/faxAccount/index.js | 2 +- .../faxApplication/faxApplication.attributes.js | 2 +- .../faxApplication/faxApplication.controller.js | 2 +- server/api/faxApplication/faxApplication.model.js | 2 +- server/api/faxApplication/faxApplication.rpc.js | 2 +- server/api/faxApplication/index.js | 2 +- .../faxInteraction/faxInteraction.attributes.js | 2 +- .../faxInteraction/faxInteraction.controller.js | 2 +- server/api/faxInteraction/faxInteraction.events.js | 2 +- server/api/faxInteraction/faxInteraction.model.js | 2 +- server/api/faxInteraction/faxInteraction.rpc.js | 2 +- server/api/faxInteraction/faxInteraction.socket.js | 2 +- server/api/faxInteraction/index.js | 2 +- server/api/faxMessage/faxMessage.attributes.js | 2 +- server/api/faxMessage/faxMessage.controller.js | 2 +- server/api/faxMessage/faxMessage.events.js | 2 +- server/api/faxMessage/faxMessage.model.js | 2 +- server/api/faxMessage/faxMessage.rpc.js | 2 +- server/api/faxMessage/faxMessage.socket.js | 2 +- server/api/faxMessage/index.js | 2 +- server/api/faxQueue/faxQueue.attributes.js | 2 +- server/api/faxQueue/faxQueue.controller.js | 2 +- server/api/faxQueue/faxQueue.events.js | 2 +- server/api/faxQueue/faxQueue.model.js | 2 +- server/api/faxQueue/faxQueue.rpc.js | 2 +- server/api/faxQueue/faxQueue.socket.js | 2 +- server/api/faxQueue/index.js | 2 +- .../faxQueueReport/faxQueueReport.attributes.js | 2 +- .../faxQueueReport/faxQueueReport.controller.js | 2 +- server/api/faxQueueReport/faxQueueReport.model.js | 2 +- server/api/faxQueueReport/faxQueueReport.rpc.js | 2 +- server/api/faxQueueReport/index.js | 2 +- .../faxTransferReport.attributes.js | 2 +- .../faxTransferReport.controller.js | 2 +- .../faxTransferReport/faxTransferReport.model.js | 2 +- .../api/faxTransferReport/faxTransferReport.rpc.js | 2 +- server/api/faxTransferReport/index.js | 2 +- server/api/intDeskAccount/index.js | 2 +- .../intDeskAccount/intDeskAccount.attributes.js | 2 +- .../intDeskAccount/intDeskAccount.controller.js | 2 +- server/api/intDeskAccount/intDeskAccount.model.js | 2 +- server/api/intDeskAccount/intDeskAccount.rpc.js | 2 +- server/api/intDeskConfiguration/index.js | 2 +- .../intDeskConfiguration.attributes.js | 2 +- .../intDeskConfiguration.controller.js | 2 +- .../intDeskConfiguration.model.js | 2 +- .../intDeskConfiguration.rpc.js | 2 +- server/api/intDeskField/index.js | 2 +- server/api/intDeskField/intDeskField.attributes.js | 2 +- server/api/intDeskField/intDeskField.controller.js | 2 +- server/api/intDeskField/intDeskField.model.js | 2 +- server/api/intDeskField/intDeskField.rpc.js | 2 +- server/api/intDynamics365Account/index.js | 2 +- .../intDynamics365Account.attributes.js | 2 +- .../intDynamics365Account.controller.js | 2 +- .../intDynamics365Account.model.js | 2 +- .../intDynamics365Account.rpc.js | 2 +- server/api/intDynamics365Configuration/index.js | 2 +- .../intDynamics365Configuration.attributes.js | 2 +- .../intDynamics365Configuration.controller.js | 2 +- .../intDynamics365Configuration.model.js | 2 +- .../intDynamics365Configuration.rpc.js | 2 +- server/api/intDynamics365Field/index.js | 2 +- .../intDynamics365Field.attributes.js | 2 +- .../intDynamics365Field.controller.js | 2 +- .../intDynamics365Field.model.js | 2 +- .../intDynamics365Field/intDynamics365Field.rpc.js | 2 +- server/api/intFreshdeskAccount/index.js | 2 +- .../intFreshdeskAccount.attributes.js | 2 +- .../intFreshdeskAccount.controller.js | 2 +- .../intFreshdeskAccount.model.js | 2 +- .../intFreshdeskAccount/intFreshdeskAccount.rpc.js | 2 +- server/api/intFreshdeskConfiguration/index.js | 2 +- .../intFreshdeskConfiguration.attributes.js | 2 +- .../intFreshdeskConfiguration.controller.js | 2 +- .../intFreshdeskConfiguration.model.js | 2 +- .../intFreshdeskConfiguration.rpc.js | 2 +- server/api/intFreshdeskField/index.js | 2 +- .../intFreshdeskField.attributes.js | 2 +- .../intFreshdeskField.controller.js | 2 +- .../intFreshdeskField/intFreshdeskField.model.js | 2 +- .../api/intFreshdeskField/intFreshdeskField.rpc.js | 2 +- server/api/intFreshsalesAccount/index.js | 2 +- .../intFreshsalesAccount.attributes.js | 2 +- .../intFreshsalesAccount.controller.js | 2 +- .../intFreshsalesAccount.model.js | 2 +- .../intFreshsalesAccount.rpc.js | 2 +- server/api/intFreshsalesConfiguration/index.js | 2 +- .../intFreshsalesConfiguration.attributes.js | 2 +- .../intFreshsalesConfiguration.controller.js | 2 +- .../intFreshsalesConfiguration.model.js | 2 +- .../intFreshsalesConfiguration.rpc.js | 2 +- server/api/intFreshsalesField/index.js | 2 +- .../intFreshsalesField.attributes.js | 2 +- .../intFreshsalesField.controller.js | 2 +- .../intFreshsalesField/intFreshsalesField.model.js | 2 +- .../intFreshsalesField/intFreshsalesField.rpc.js | 2 +- server/api/intSalesforceAccount/index.js | 2 +- .../intSalesforceAccount.attributes.js | 2 +- .../intSalesforceAccount.controller.js | 2 +- .../intSalesforceAccount.model.js | 2 +- .../intSalesforceAccount.rpc.js | 2 +- server/api/intSalesforceConfiguration/index.js | 2 +- .../intSalesforceConfiguration.attributes.js | 2 +- .../intSalesforceConfiguration.controller.js | 2 +- .../intSalesforceConfiguration.model.js | 2 +- .../intSalesforceConfiguration.rpc.js | 2 +- server/api/intSalesforceField/index.js | 2 +- .../intSalesforceField.attributes.js | 2 +- .../intSalesforceField.controller.js | 2 +- .../intSalesforceField/intSalesforceField.model.js | 2 +- .../intSalesforceField/intSalesforceField.rpc.js | 2 +- server/api/intServicenowAccount/index.js | 2 +- .../intServicenowAccount.attributes.js | 2 +- .../intServicenowAccount.controller.js | 2 +- .../intServicenowAccount.model.js | 2 +- .../intServicenowAccount.rpc.js | 2 +- server/api/intServicenowConfiguration/index.js | 2 +- .../intServicenowConfiguration.attributes.js | 2 +- .../intServicenowConfiguration.controller.js | 2 +- .../intServicenowConfiguration.model.js | 2 +- .../intServicenowConfiguration.rpc.js | 2 +- server/api/intServicenowField/index.js | 2 +- .../intServicenowField.attributes.js | 2 +- .../intServicenowField.controller.js | 2 +- .../intServicenowField/intServicenowField.model.js | 2 +- .../intServicenowField/intServicenowField.rpc.js | 2 +- server/api/intSugarcrmAccount/index.js | 2 +- .../intSugarcrmAccount.attributes.js | 2 +- .../intSugarcrmAccount.controller.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.model.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.rpc.js | 2 +- server/api/intSugarcrmConfiguration/index.js | 2 +- .../intSugarcrmConfiguration.attributes.js | 2 +- .../intSugarcrmConfiguration.controller.js | 2 +- .../intSugarcrmConfiguration.model.js | 2 +- .../intSugarcrmConfiguration.rpc.js | 2 +- server/api/intSugarcrmField/index.js | 2 +- .../intSugarcrmField.attributes.js | 2 +- .../intSugarcrmField.controller.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.model.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.rpc.js | 2 +- server/api/intVtigerAccount/index.js | 2 +- .../intVtigerAccount.attributes.js | 2 +- .../intVtigerAccount.controller.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.model.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.rpc.js | 2 +- server/api/intVtigerConfiguration/index.js | 2 +- .../intVtigerConfiguration.attributes.js | 2 +- .../intVtigerConfiguration.controller.js | 2 +- .../intVtigerConfiguration.model.js | 2 +- .../intVtigerConfiguration.rpc.js | 2 +- server/api/intVtigerField/index.js | 2 +- .../intVtigerField/intVtigerField.attributes.js | 2 +- .../intVtigerField/intVtigerField.controller.js | 2 +- server/api/intVtigerField/intVtigerField.model.js | 2 +- server/api/intVtigerField/intVtigerField.rpc.js | 2 +- server/api/intZendeskAccount/index.js | 2 +- .../intZendeskAccount.attributes.js | 2 +- .../intZendeskAccount.controller.js | 2 +- .../intZendeskAccount/intZendeskAccount.model.js | 2 +- .../api/intZendeskAccount/intZendeskAccount.rpc.js | 2 +- server/api/intZendeskConfiguration/index.js | 2 +- .../intZendeskConfiguration.attributes.js | 2 +- .../intZendeskConfiguration.controller.js | 2 +- .../intZendeskConfiguration.model.js | 2 +- .../intZendeskConfiguration.rpc.js | 2 +- server/api/intZendeskField/index.js | 2 +- .../intZendeskField/intZendeskField.attributes.js | 2 +- .../intZendeskField/intZendeskField.controller.js | 2 +- .../api/intZendeskField/intZendeskField.model.js | 2 +- server/api/intZendeskField/intZendeskField.rpc.js | 2 +- server/api/intZohoAccount/index.js | 2 +- .../intZohoAccount/intZohoAccount.attributes.js | 2 +- .../intZohoAccount/intZohoAccount.controller.js | 2 +- server/api/intZohoAccount/intZohoAccount.model.js | 2 +- server/api/intZohoAccount/intZohoAccount.rpc.js | 2 +- server/api/intZohoConfiguration/index.js | 2 +- .../intZohoConfiguration.attributes.js | 2 +- .../intZohoConfiguration.controller.js | 2 +- .../intZohoConfiguration.model.js | 2 +- .../intZohoConfiguration.rpc.js | 2 +- server/api/intZohoField/index.js | 2 +- server/api/intZohoField/intZohoField.attributes.js | 2 +- server/api/intZohoField/intZohoField.controller.js | 2 +- server/api/intZohoField/intZohoField.model.js | 2 +- server/api/intZohoField/intZohoField.rpc.js | 2 +- server/api/integration/index.js | 2 +- server/api/integration/integration.attributes.js | 2 +- server/api/integration/integration.controller.js | 2 +- server/api/integration/integration.model.js | 2 +- server/api/integration/integration.rpc.js | 2 +- server/api/integrationReport/index.js | 2 +- .../integrationReport.attributes.js | 2 +- .../integrationReport.controller.js | 2 +- .../integrationReport/integrationReport.model.js | 2 +- .../api/integrationReport/integrationReport.rpc.js | 2 +- server/api/interval/index.js | 2 +- server/api/interval/interval.attributes.js | 2 +- server/api/interval/interval.controller.js | 2 +- server/api/interval/interval.model.js | 2 +- server/api/interval/interval.rpc.js | 2 +- server/api/jira/index.js | 2 +- server/api/jira/jira.controller.js | 2 +- server/api/jscriptyAnswerReport/index.js | 2 +- .../jscriptyAnswerReport.attributes.js | 2 +- .../jscriptyAnswerReport.controller.js | 2 +- .../jscriptyAnswerReport.model.js | 2 +- .../jscriptyAnswerReport.rpc.js | 2 +- server/api/jscriptyProject/index.js | 2 +- .../jscriptyProject/jscriptyProject.attributes.js | 2 +- .../jscriptyProject/jscriptyProject.controller.js | 2 +- .../api/jscriptyProject/jscriptyProject.model.js | 2 +- server/api/jscriptyProject/jscriptyProject.rpc.js | 2 +- server/api/jscriptyQuestionReport/index.js | 2 +- .../jscriptyQuestionReport.attributes.js | 2 +- .../jscriptyQuestionReport.controller.js | 2 +- .../jscriptyQuestionReport.model.js | 2 +- .../jscriptyQuestionReport.rpc.js | 2 +- server/api/jscriptySessionReport/index.js | 2 +- .../jscriptySessionReport.attributes.js | 2 +- .../jscriptySessionReport.controller.js | 2 +- .../jscriptySessionReport.model.js | 2 +- .../jscriptySessionReport.rpc.js | 2 +- server/api/license/index.js | 2 +- server/api/license/license.attributes.js | 2 +- server/api/license/license.controller.js | 2 +- server/api/license/license.model.js | 2 +- server/api/license/license.rpc.js | 2 +- server/api/mailAccount/index.js | 2 +- server/api/mailAccount/mailAccount.attributes.js | 2 +- server/api/mailAccount/mailAccount.controller.js | 2 +- server/api/mailAccount/mailAccount.events.js | 2 +- server/api/mailAccount/mailAccount.model.js | 2 +- server/api/mailAccount/mailAccount.rpc.js | 2 +- server/api/mailAccount/mailAccount.socket.js | 2 +- server/api/mailApplication/index.js | 2 +- .../mailApplication/mailApplication.attributes.js | 2 +- .../mailApplication/mailApplication.controller.js | 2 +- .../api/mailApplication/mailApplication.model.js | 2 +- server/api/mailApplication/mailApplication.rpc.js | 2 +- server/api/mailInteraction/index.js | 2 +- .../mailInteraction/mailInteraction.attributes.js | 2 +- .../mailInteraction/mailInteraction.controller.js | 2 +- .../api/mailInteraction/mailInteraction.events.js | 2 +- .../api/mailInteraction/mailInteraction.model.js | 2 +- server/api/mailInteraction/mailInteraction.rpc.js | 2 +- .../api/mailInteraction/mailInteraction.socket.js | 2 +- server/api/mailMessage/index.js | 2 +- server/api/mailMessage/mailMessage.attributes.js | 2 +- server/api/mailMessage/mailMessage.controller.js | 2 +- server/api/mailMessage/mailMessage.events.js | 2 +- server/api/mailMessage/mailMessage.model.js | 2 +- server/api/mailMessage/mailMessage.rpc.js | 2 +- server/api/mailMessage/mailMessage.socket.js | 2 +- server/api/mailQueue/index.js | 2 +- server/api/mailQueue/mailQueue.attributes.js | 2 +- server/api/mailQueue/mailQueue.controller.js | 2 +- server/api/mailQueue/mailQueue.events.js | 2 +- server/api/mailQueue/mailQueue.model.js | 2 +- server/api/mailQueue/mailQueue.rpc.js | 2 +- server/api/mailQueue/mailQueue.socket.js | 2 +- server/api/mailQueueReport/index.js | 2 +- .../mailQueueReport/mailQueueReport.attributes.js | 2 +- .../mailQueueReport/mailQueueReport.controller.js | 2 +- .../api/mailQueueReport/mailQueueReport.model.js | 2 +- server/api/mailQueueReport/mailQueueReport.rpc.js | 2 +- server/api/mailServerIn/index.js | 2 +- server/api/mailServerIn/mailServerIn.attributes.js | 2 +- server/api/mailServerIn/mailServerIn.model.js | 2 +- server/api/mailServerIn/mailServerIn.rpc.js | 2 +- server/api/mailServerOut/index.js | 2 +- .../api/mailServerOut/mailServerOut.attributes.js | 2 +- .../api/mailServerOut/mailServerOut.controller.js | 2 +- server/api/mailServerOut/mailServerOut.model.js | 2 +- server/api/mailServerOut/mailServerOut.rpc.js | 2 +- server/api/mailSubstatus/index.js | 2 +- .../api/mailSubstatus/mailSubstatus.attributes.js | 2 +- .../api/mailSubstatus/mailSubstatus.controller.js | 2 +- server/api/mailSubstatus/mailSubstatus.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/screenRecording/index.js | 2 +- .../screenRecording/screenRecording.attributes.js | 2 +- .../screenRecording/screenRecording.controller.js | 2 +- .../api/screenRecording/screenRecording.model.js | 2 +- server/api/screenRecording/screenRecording.rpc.js | 2 +- server/api/setting/index.js | 2 +- server/api/setting/setting.attributes.js | 2 +- server/api/setting/setting.controller.js | 2 +- server/api/setting/setting.model.js | 2 +- server/api/setting/setting.rpc.js | 2 +- server/api/smsAccount/index.js | 2 +- server/api/smsAccount/smsAccount.attributes.js | 2 +- server/api/smsAccount/smsAccount.controller.js | 2 +- server/api/smsAccount/smsAccount.events.js | 2 +- server/api/smsAccount/smsAccount.model.js | 2 +- server/api/smsAccount/smsAccount.rpc.js | 2 +- server/api/smsAccount/smsAccount.socket.js | 2 +- server/api/smsApplication/index.js | 2 +- .../smsApplication/smsApplication.attributes.js | 2 +- .../smsApplication/smsApplication.controller.js | 2 +- server/api/smsApplication/smsApplication.model.js | 2 +- server/api/smsApplication/smsApplication.rpc.js | 2 +- server/api/smsInteraction/index.js | 2 +- .../smsInteraction/smsInteraction.attributes.js | 2 +- .../smsInteraction/smsInteraction.controller.js | 2 +- server/api/smsInteraction/smsInteraction.events.js | 2 +- server/api/smsInteraction/smsInteraction.model.js | 2 +- server/api/smsInteraction/smsInteraction.rpc.js | 2 +- server/api/smsInteraction/smsInteraction.socket.js | 2 +- server/api/smsMessage/index.js | 2 +- server/api/smsMessage/smsMessage.attributes.js | 2 +- server/api/smsMessage/smsMessage.controller.js | 2 +- server/api/smsMessage/smsMessage.events.js | 2 +- server/api/smsMessage/smsMessage.model.js | 2 +- server/api/smsMessage/smsMessage.rpc.js | 2 +- server/api/smsMessage/smsMessage.socket.js | 2 +- server/api/smsQueue/index.js | 2 +- server/api/smsQueue/smsQueue.attributes.js | 2 +- server/api/smsQueue/smsQueue.controller.js | 2 +- server/api/smsQueue/smsQueue.events.js | 2 +- server/api/smsQueue/smsQueue.model.js | 2 +- server/api/smsQueue/smsQueue.rpc.js | 2 +- server/api/smsQueue/smsQueue.socket.js | 2 +- server/api/smsQueueReport/index.js | 2 +- .../smsQueueReport/smsQueueReport.attributes.js | 2 +- .../smsQueueReport/smsQueueReport.controller.js | 2 +- server/api/smsQueueReport/smsQueueReport.model.js | 2 +- server/api/smsQueueReport/smsQueueReport.rpc.js | 2 +- server/api/smsTransferReport/index.js | 2 +- .../smsTransferReport.attributes.js | 2 +- .../smsTransferReport.controller.js | 2 +- .../smsTransferReport/smsTransferReport.model.js | 2 +- .../api/smsTransferReport/smsTransferReport.rpc.js | 2 +- server/api/sound/index.js | 2 +- server/api/sound/sound.attributes.js | 2 +- server/api/sound/sound.controller.js | 2 +- server/api/sound/sound.model.js | 2 +- server/api/sound/sound.rpc.js | 2 +- server/api/squareMessage/index.js | 2 +- .../api/squareMessage/squareMessage.attributes.js | 2 +- .../api/squareMessage/squareMessage.controller.js | 2 +- server/api/squareMessage/squareMessage.model.js | 2 +- server/api/squareMessage/squareMessage.rpc.js | 2 +- server/api/squareOdbc/index.js | 2 +- server/api/squareOdbc/squareOdbc.attributes.js | 2 +- server/api/squareOdbc/squareOdbc.controller.js | 2 +- server/api/squareOdbc/squareOdbc.model.js | 2 +- server/api/squareOdbc/squareOdbc.rpc.js | 2 +- server/api/squareProject/index.js | 2 +- .../api/squareProject/squareProject.attributes.js | 2 +- .../api/squareProject/squareProject.controller.js | 2 +- server/api/squareProject/squareProject.events.js | 2 +- server/api/squareProject/squareProject.model.js | 2 +- server/api/squareProject/squareProject.rpc.js | 2 +- server/api/squareProject/squareProject.socket.js | 2 +- server/api/squareRecording/index.js | 2 +- .../squareRecording/squareRecording.attributes.js | 2 +- .../squareRecording/squareRecording.controller.js | 2 +- .../api/squareRecording/squareRecording.model.js | 2 +- server/api/squareRecording/squareRecording.rpc.js | 2 +- server/api/squareReport/index.js | 2 +- server/api/squareReport/squareReport.attributes.js | 2 +- server/api/squareReport/squareReport.controller.js | 2 +- server/api/squareReport/squareReport.model.js | 2 +- server/api/squareReport/squareReport.rpc.js | 2 +- server/api/squareReportDetail/index.js | 2 +- .../squareReportDetail.attributes.js | 2 +- .../squareReportDetail.controller.js | 2 +- .../squareReportDetail/squareReportDetail.model.js | 2 +- .../squareReportDetail/squareReportDetail.rpc.js | 2 +- server/api/system/index.js | 2 +- server/api/system/system.controller.js | 2 +- server/api/tag/index.js | 2 +- server/api/tag/tag.attributes.js | 2 +- server/api/tag/tag.controller.js | 2 +- server/api/tag/tag.model.js | 2 +- server/api/tag/tag.rpc.js | 2 +- server/api/team/index.js | 2 +- server/api/team/team.attributes.js | 2 +- server/api/team/team.controller.js | 2 +- server/api/team/team.events.js | 2 +- server/api/team/team.model.js | 2 +- server/api/team/team.rpc.js | 2 +- server/api/team/team.socket.js | 2 +- server/api/teamVoiceQueue/index.js | 2 +- .../teamVoiceQueue/teamVoiceQueue.attributes.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.model.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.rpc.js | 2 +- server/api/template/index.js | 2 +- server/api/template/template.attributes.js | 2 +- server/api/template/template.controller.js | 2 +- server/api/template/template.model.js | 2 +- server/api/template/template.rpc.js | 2 +- server/api/trigger/index.js | 2 +- server/api/trigger/trigger.attributes.js | 2 +- server/api/trigger/trigger.controller.js | 2 +- server/api/trigger/trigger.model.js | 2 +- server/api/trigger/trigger.rpc.js | 2 +- server/api/trunk/index.js | 2 +- server/api/trunk/trunk.attributes.js | 2 +- server/api/trunk/trunk.controller.js | 2 +- server/api/trunk/trunk.model.js | 2 +- server/api/trunk/trunk.rpc.js | 2 +- server/api/user/index.js | 2 +- server/api/user/user.attributes.js | 2 +- server/api/user/user.controller.js | 2 +- server/api/user/user.events.js | 2 +- server/api/user/user.model.js | 2 +- server/api/user/user.rpc.js | 2 +- server/api/user/user.socket.js | 2 +- server/api/userChatQueue/index.js | 2 +- .../api/userChatQueue/userChatQueue.attributes.js | 2 +- server/api/userChatQueue/userChatQueue.model.js | 2 +- server/api/userChatQueue/userChatQueue.rpc.js | 2 +- server/api/userFaxQueue/index.js | 2 +- server/api/userFaxQueue/userFaxQueue.attributes.js | 2 +- server/api/userFaxQueue/userFaxQueue.model.js | 2 +- server/api/userFaxQueue/userFaxQueue.rpc.js | 2 +- server/api/userMailQueue/index.js | 2 +- .../api/userMailQueue/userMailQueue.attributes.js | 2 +- server/api/userMailQueue/userMailQueue.model.js | 2 +- server/api/userMailQueue/userMailQueue.rpc.js | 2 +- server/api/userNotification/index.js | 2 +- .../userNotification.attributes.js | 2 +- .../userNotification.controller.js | 2 +- .../userNotification/userNotification.events.js | 2 +- .../api/userNotification/userNotification.model.js | 2 +- .../api/userNotification/userNotification.rpc.js | 2 +- .../userNotification/userNotification.socket.js | 2 +- server/api/userOpenchannelQueue/index.js | 2 +- .../userOpenchannelQueue.attributes.js | 2 +- .../userOpenchannelQueue.model.js | 2 +- .../userOpenchannelQueue.rpc.js | 2 +- server/api/userProfile/index.js | 2 +- server/api/userProfile/userProfile.attributes.js | 2 +- server/api/userProfile/userProfile.controller.js | 2 +- server/api/userProfile/userProfile.events.js | 2 +- server/api/userProfile/userProfile.model.js | 2 +- server/api/userProfile/userProfile.rpc.js | 2 +- server/api/userProfile/userProfile.socket.js | 2 +- server/api/userProfileResource/index.js | 2 +- .../userProfileResource.attributes.js | 2 +- .../userProfileResource.controller.js | 2 +- .../userProfileResource.model.js | 2 +- .../userProfileResource/userProfileResource.rpc.js | 2 +- server/api/userProfileSection/index.js | 2 +- .../userProfileSection.attributes.js | 2 +- .../userProfileSection.controller.js | 2 +- .../userProfileSection/userProfileSection.model.js | 2 +- .../userProfileSection/userProfileSection.rpc.js | 2 +- server/api/userSmsQueue/index.js | 2 +- server/api/userSmsQueue/userSmsQueue.attributes.js | 2 +- server/api/userSmsQueue/userSmsQueue.model.js | 2 +- server/api/userSmsQueue/userSmsQueue.rpc.js | 2 +- server/api/userVoiceQueue/index.js | 2 +- .../userVoiceQueue/userVoiceQueue.attributes.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.model.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.rpc.js | 2 +- server/api/userVoiceQueueRt/index.js | 2 +- .../userVoiceQueueRt.attributes.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.events.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.model.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.rpc.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.socket.js | 2 +- server/api/userWhatsappQueue/index.js | 2 +- .../userWhatsappQueue.attributes.js | 2 +- .../userWhatsappQueue/userWhatsappQueue.model.js | 2 +- .../api/userWhatsappQueue/userWhatsappQueue.rpc.js | 2 +- server/api/variable/index.js | 2 +- server/api/variable/variable.attributes.js | 2 +- server/api/variable/variable.controller.js | 2 +- server/api/variable/variable.model.js | 2 +- server/api/variable/variable.rpc.js | 2 +- server/api/version/index.js | 2 +- server/api/version/version.controller.js | 2 +- server/api/voiceAgentReport/index.js | 2 +- .../voiceAgentReport.attributes.js | 2 +- .../voiceAgentReport.controller.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.model.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.rpc.js | 2 +- server/api/voiceCallReport/index.js | 2 +- .../voiceCallReport/voiceCallReport.attributes.js | 2 +- .../voiceCallReport/voiceCallReport.controller.js | 2 +- .../api/voiceCallReport/voiceCallReport.model.js | 2 +- server/api/voiceCallReport/voiceCallReport.rpc.js | 2 +- server/api/voiceChanSpy/index.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.attributes.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.controller.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.model.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.rpc.js | 2 +- server/api/voiceContext/index.js | 2 +- server/api/voiceContext/voiceContext.attributes.js | 2 +- server/api/voiceContext/voiceContext.controller.js | 2 +- server/api/voiceContext/voiceContext.model.js | 2 +- server/api/voiceContext/voiceContext.rpc.js | 2 +- server/api/voiceDialReport/index.js | 2 +- .../voiceDialReport/voiceDialReport.attributes.js | 2 +- .../voiceDialReport/voiceDialReport.controller.js | 2 +- .../api/voiceDialReport/voiceDialReport.model.js | 2 +- server/api/voiceDialReport/voiceDialReport.rpc.js | 2 +- server/api/voiceExtension/index.js | 2 +- .../voiceExtension/voiceExtension.attributes.js | 2 +- .../voiceExtension/voiceExtension.controller.js | 2 +- server/api/voiceExtension/voiceExtension.events.js | 2 +- server/api/voiceExtension/voiceExtension.model.js | 2 +- server/api/voiceExtension/voiceExtension.rpc.js | 2 +- server/api/voiceExtension/voiceExtension.socket.js | 2 +- server/api/voiceMail/index.js | 2 +- server/api/voiceMail/voiceMail.attributes.js | 2 +- server/api/voiceMail/voiceMail.controller.js | 2 +- server/api/voiceMail/voiceMail.model.js | 2 +- server/api/voiceMail/voiceMail.rpc.js | 2 +- server/api/voiceMailMessage/index.js | 2 +- .../voiceMailMessage.attributes.js | 2 +- .../voiceMailMessage.controller.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.model.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.rpc.js | 2 +- server/api/voiceMusicOnHold/index.js | 2 +- .../voiceMusicOnHold.attributes.js | 2 +- .../voiceMusicOnHold.controller.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.model.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.rpc.js | 2 +- server/api/voicePrefix/index.js | 2 +- server/api/voicePrefix/voicePrefix.attributes.js | 2 +- server/api/voicePrefix/voicePrefix.controller.js | 2 +- server/api/voicePrefix/voicePrefix.events.js | 2 +- server/api/voicePrefix/voicePrefix.model.js | 2 +- server/api/voicePrefix/voicePrefix.rpc.js | 2 +- server/api/voicePrefix/voicePrefix.socket.js | 2 +- server/api/voiceQueue/index.js | 2 +- server/api/voiceQueue/voiceQueue.attributes.js | 2 +- server/api/voiceQueue/voiceQueue.controller.js | 2 +- server/api/voiceQueue/voiceQueue.events.js | 2 +- server/api/voiceQueue/voiceQueue.model.js | 2 +- server/api/voiceQueue/voiceQueue.rpc.js | 2 +- server/api/voiceQueue/voiceQueue.socket.js | 2 +- server/api/voiceQueueReport/index.js | 2 +- .../voiceQueueReport.attributes.js | 2 +- .../voiceQueueReport.controller.js | 2 +- .../voiceQueueReport/voiceQueueReport.events.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.model.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.rpc.js | 2 +- .../voiceQueueReport/voiceQueueReport.socket.js | 2 +- server/api/voiceQueuesLog/index.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.attributes.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.controller.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.model.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.rpc.js | 2 +- server/api/voiceRecording/index.js | 2 +- .../voiceRecording/voiceRecording.attributes.js | 2 +- .../voiceRecording/voiceRecording.controller.js | 2 +- server/api/voiceRecording/voiceRecording.model.js | 2 +- server/api/voiceRecording/voiceRecording.rpc.js | 2 +- server/api/voiceTransferReport/index.js | 2 +- .../voiceTransferReport.attributes.js | 2 +- .../voiceTransferReport.controller.js | 2 +- .../voiceTransferReport.model.js | 2 +- .../voiceTransferReport/voiceTransferReport.rpc.js | 2 +- server/api/webbar/index.js | 2 +- server/api/webbar/webbar.controller.js | 2 +- server/api/whatsappAccount/index.js | 2 +- .../whatsappAccount/whatsappAccount.attributes.js | 2 +- .../whatsappAccount/whatsappAccount.controller.js | 2 +- .../api/whatsappAccount/whatsappAccount.events.js | 2 +- .../api/whatsappAccount/whatsappAccount.model.js | 2 +- server/api/whatsappAccount/whatsappAccount.rpc.js | 2 +- .../api/whatsappAccount/whatsappAccount.socket.js | 2 +- server/api/whatsappApplication/index.js | 2 +- .../whatsappApplication.attributes.js | 2 +- .../whatsappApplication.controller.js | 2 +- .../whatsappApplication.model.js | 2 +- .../whatsappApplication/whatsappApplication.rpc.js | 2 +- server/api/whatsappInteraction/index.js | 2 +- .../whatsappInteraction.attributes.js | 2 +- .../whatsappInteraction.controller.js | 2 +- .../whatsappInteraction.events.js | 2 +- .../whatsappInteraction.model.js | 2 +- .../whatsappInteraction/whatsappInteraction.rpc.js | 2 +- .../whatsappInteraction.socket.js | 2 +- server/api/whatsappMessage/index.js | 2 +- .../whatsappMessage/whatsappMessage.attributes.js | 2 +- .../whatsappMessage/whatsappMessage.controller.js | 2 +- .../api/whatsappMessage/whatsappMessage.events.js | 2 +- .../api/whatsappMessage/whatsappMessage.model.js | 2 +- server/api/whatsappMessage/whatsappMessage.rpc.js | 2 +- .../api/whatsappMessage/whatsappMessage.socket.js | 2 +- server/api/whatsappQueue/index.js | 2 +- .../api/whatsappQueue/whatsappQueue.attributes.js | 2 +- .../api/whatsappQueue/whatsappQueue.controller.js | 2 +- server/api/whatsappQueue/whatsappQueue.events.js | 2 +- server/api/whatsappQueue/whatsappQueue.model.js | 2 +- server/api/whatsappQueue/whatsappQueue.rpc.js | 2 +- server/api/whatsappQueue/whatsappQueue.socket.js | 2 +- server/api/whatsappQueueReport/index.js | 2 +- .../whatsappQueueReport.attributes.js | 2 +- .../whatsappQueueReport.controller.js | 2 +- .../whatsappQueueReport.model.js | 2 +- .../whatsappQueueReport/whatsappQueueReport.rpc.js | 2 +- server/api/whatsappTransferReport/index.js | 2 +- .../whatsappTransferReport.attributes.js | 2 +- .../whatsappTransferReport.controller.js | 2 +- .../whatsappTransferReport.model.js | 2 +- .../whatsappTransferReport.rpc.js | 2 +- server/app.js | 2 +- server/components/auth/service.js | 2 +- server/components/encryptor/index.js | 2 +- server/components/export/csv.js | 2 +- server/components/export/pdf.js | 2 +- server/components/export/xlsx.js | 2 +- server/components/extensions/rewrite.js | 2 +- server/components/import/cm/csv.js | 2 +- server/components/import/cm/csv2.js | 2 +- server/components/import/cm/csvUpdates.js | 2 +- server/components/integrations/configuration.js | 2 +- server/components/interaction/service.js | 2 +- server/components/license/service.js | 2 +- server/components/parsers/advancedSearch.js | 2 +- server/components/parsers/qs.js | 2 +- server/config/express.js | 2 +- server/config/license/hardware.js | 2 +- server/config/license/index.js | 2 +- server/config/license/util.js | 2 +- server/config/local.env.js | 2 +- server/config/logger.js | 2 +- server/config/pm2/config.js | 2 +- server/config/pm2/index.js | 2 +- server/config/schedule/chat.js | 2 +- server/config/schedule/index.js | 2 +- server/config/schedule/transcribe.js | 2 +- server/config/schedule/whatsapp.js | 2 +- server/config/seedContact.js | 2 +- server/config/seedUsers.js | 2 +- server/config/socketio.js | 2 +- server/config/triggers/index.js | 2 +- server/config/utils.js | 2 +- server/errors/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/additionalPhone.js | 2 +- server/services/ami/dialer/agentComplete.js | 2 +- server/services/ami/dialer/final.js | 2 +- server/services/ami/dialer/hangup.js | 2 +- server/services/ami/dialer/history.js | 2 +- server/services/ami/dialer/index.js | 2 +- server/services/ami/dialer/queueCallerAbandon.js | 2 +- server/services/ami/fax/action.js | 2 +- server/services/ami/fax/index.js | 2 +- server/services/ami/fax/rpcDb.js | 2 +- server/services/ami/fax/util/gs.js | 2 +- server/services/ami/fax/util/util.js | 2 +- server/services/ami/index.js | 2 +- server/services/ami/model/agent.js | 2 +- server/services/ami/model/campaign.js | 2 +- server/services/ami/model/channel.js | 2 +- server/services/ami/model/deskAccount.js | 2 +- server/services/ami/model/dynamics365Account.js | 2 +- server/services/ami/model/faxAccount.js | 2 +- server/services/ami/model/freshdeskAccount.js | 2 +- server/services/ami/model/freshsalesAccount.js | 2 +- server/services/ami/model/queueReport.js | 2 +- server/services/ami/model/salesforceAccount.js | 2 +- server/services/ami/model/servicenowAccount.js | 2 +- server/services/ami/model/sugarcrmAccount.js | 2 +- server/services/ami/model/telephone.js | 2 +- server/services/ami/model/template.js | 2 +- server/services/ami/model/trigger.js | 2 +- server/services/ami/model/trunk.js | 2 +- server/services/ami/model/voiceExtension.js | 2 +- server/services/ami/model/voiceQueue.js | 2 +- server/services/ami/model/vtigerAccount.js | 2 +- server/services/ami/model/zendeskAccount.js | 2 +- server/services/ami/model/zohoAccount.js | 2 +- server/services/ami/preview/action.js | 2 +- server/services/ami/preview/index.js | 2 +- server/services/ami/preview/rpcDb.js | 2 +- server/services/ami/preview/util/util.js | 2 +- server/services/ami/properties.js | 2 +- server/services/ami/realtime/index.js | 2 +- server/services/ami/report/index.js | 2 +- server/services/ami/report/userReport.js | 2 +- server/services/ami/report/voiceAgentReport.js | 2 +- server/services/ami/report/voiceCallReport.js | 2 +- server/services/ami/report/voiceDialReport.js | 2 +- server/services/ami/report/voiceQueueReport.js | 2 +- server/services/ami/rpc/agentReportPreview.js | 2 +- server/services/ami/rpc/attachment.js | 2 +- server/services/ami/rpc/campaign.js | 2 +- server/services/ami/rpc/cmContact.js | 2 +- server/services/ami/rpc/cmHopper.js | 2 +- server/services/ami/rpc/cmHopperAdditionalPhone.js | 2 +- server/services/ami/rpc/cmHopperBlack.js | 2 +- server/services/ami/rpc/cmHopperFinal.js | 2 +- server/services/ami/rpc/cmHopperHistory.js | 2 +- server/services/ami/rpc/faxAccount.js | 2 +- server/services/ami/rpc/faxMessage.js | 2 +- server/services/ami/rpc/integrations/desk.js | 2 +- .../services/ami/rpc/integrations/dynamics365.js | 2 +- server/services/ami/rpc/integrations/freshdesk.js | 2 +- server/services/ami/rpc/integrations/freshsales.js | 2 +- server/services/ami/rpc/integrations/salesforce.js | 2 +- server/services/ami/rpc/integrations/servicenow.js | 2 +- server/services/ami/rpc/integrations/sugarcrm.js | 2 +- server/services/ami/rpc/integrations/vtiger.js | 2 +- server/services/ami/rpc/integrations/zendesk.js | 2 +- server/services/ami/rpc/integrations/zoho.js | 2 +- server/services/ami/rpc/memberReport.js | 2 +- server/services/ami/rpc/setting.js | 2 +- server/services/ami/rpc/template.js | 2 +- server/services/ami/rpc/trigger.js | 2 +- server/services/ami/rpc/trunk.js | 2 +- server/services/ami/rpc/user.js | 2 +- server/services/ami/rpc/voiceAgentReport.js | 2 +- server/services/ami/rpc/voiceCallReport.js | 2 +- server/services/ami/rpc/voiceDialReport.js | 2 +- server/services/ami/rpc/voiceExtension.js | 2 +- server/services/ami/rpc/voiceQueue.js | 2 +- server/services/ami/rpc/voiceQueueReport.js | 2 +- server/services/ami/rpc/voiceQueueRt.js | 2 +- server/services/ami/rpc/voiceRecording.js | 2 +- server/services/ami/rpc/voiceTransferReport.js | 2 +- server/services/ami/server/index.js | 2 +- server/services/ami/trigger/cmContact/index.js | 2 +- server/services/ami/trigger/index.js | 2 +- server/services/ami/trigger/integration/desk.js | 2 +- .../ami/trigger/integration/dynamics365.js | 2 +- .../services/ami/trigger/integration/freshdesk.js | 2 +- .../services/ami/trigger/integration/freshsales.js | 2 +- server/services/ami/trigger/integration/index.js | 2 +- .../services/ami/trigger/integration/salesforce.js | 2 +- .../services/ami/trigger/integration/servicenow.js | 2 +- .../services/ami/trigger/integration/sugarcrm.js | 2 +- server/services/ami/trigger/integration/util.js | 2 +- server/services/ami/trigger/integration/vtiger.js | 2 +- server/services/ami/trigger/integration/zendesk.js | 2 +- server/services/ami/trigger/integration/zoho.js | 2 +- server/services/ami/trigger/script/index.js | 2 +- server/services/ami/trigger/urlforward/index.js | 2 +- server/services/email/client.js | 2 +- server/services/email/index.js | 2 +- server/services/email/lib/email.js | 2 +- server/services/email/lib/imap.js | 2 +- server/services/email/lib/smtp.js | 2 +- server/services/email/lib/utils.js | 2 +- server/services/email/model/mailAccount.js | 2 +- server/services/email/realtime/index.js | 2 +- server/services/email/rpc/mailAccount.js | 2 +- server/services/email/rpc/setting.js | 2 +- server/services/email/server/index.js | 2 +- server/services/express/index.js | 2 +- server/services/routing/client.js | 2 +- server/services/routing/index.js | 2 +- server/services/routing/lib/rule-engine.js | 2 +- server/services/routing/mailRpc/index.js | 2 +- server/services/routing/model/agent.js | 2 +- server/services/routing/model/chatQueue.js | 2 +- server/services/routing/model/faxQueue.js | 2 +- server/services/routing/model/interval.js | 2 +- server/services/routing/model/mailQueue.js | 2 +- server/services/routing/model/openchannelQueue.js | 2 +- server/services/routing/model/smsQueue.js | 2 +- server/services/routing/model/whatsappQueue.js | 2 +- server/services/routing/realtime/index.js | 2 +- server/services/routing/rpc/chatInteraction.js | 2 +- server/services/routing/rpc/chatMessage.js | 2 +- server/services/routing/rpc/chatQueue.js | 2 +- server/services/routing/rpc/chatQueueReport.js | 2 +- server/services/routing/rpc/faxInteraction.js | 2 +- server/services/routing/rpc/faxMessage.js | 2 +- server/services/routing/rpc/faxQueue.js | 2 +- server/services/routing/rpc/faxQueueReport.js | 2 +- server/services/routing/rpc/interval.js | 2 +- server/services/routing/rpc/mailInteraction.js | 2 +- server/services/routing/rpc/mailMessage.js | 2 +- server/services/routing/rpc/mailQueue.js | 2 +- server/services/routing/rpc/mailQueueReport.js | 2 +- .../services/routing/rpc/openchannelInteraction.js | 2 +- server/services/routing/rpc/openchannelMessage.js | 2 +- server/services/routing/rpc/openchannelQueue.js | 2 +- .../services/routing/rpc/openchannelQueueReport.js | 2 +- server/services/routing/rpc/smsInteraction.js | 2 +- server/services/routing/rpc/smsMessage.js | 2 +- server/services/routing/rpc/smsQueue.js | 2 +- server/services/routing/rpc/smsQueueReport.js | 2 +- server/services/routing/rpc/user.js | 2 +- server/services/routing/rpc/whatsappInteraction.js | 2 +- server/services/routing/rpc/whatsappMessage.js | 2 +- server/services/routing/rpc/whatsappQueue.js | 2 +- server/services/routing/rpc/whatsappQueueReport.js | 2 +- .../services/routing/server/applications/agent.js | 2 +- .../routing/server/applications/amazonlex.js | 2 +- .../routing/server/applications/autoreply.js | 2 +- .../services/routing/server/applications/close.js | 2 +- .../routing/server/applications/dialogflow.js | 2 +- .../routing/server/applications/dialogflowV2.js | 2 +- .../services/routing/server/applications/gotoif.js | 2 +- .../services/routing/server/applications/gotop.js | 2 +- .../routing/server/applications/message.js | 2 +- .../services/routing/server/applications/noop.js | 2 +- .../services/routing/server/applications/queue.js | 2 +- .../routing/server/applications/strategy/agent.js | 2 +- .../server/applications/strategy/beepall.js | 2 +- .../routing/server/applications/strategy/index.js | 2 +- .../server/applications/strategy/rrmemory.js | 2 +- .../routing/server/applications/strategy/util.js | 2 +- .../services/routing/server/applications/system.js | 2 +- server/services/routing/server/applications/tag.js | 2 +- .../services/routing/server/applications/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 +- 1163 files changed, 1163 insertions(+), 1163 deletions(-) diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 3dcd90f..c68aa38 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-07-20T12:16:47.347Z", + "time": "2021-07-20T12:36:20.772Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index bddbe7f..c475aa0 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-07-20T12:16:47.347Z", + "time": "2021-07-20T12:36:20.772Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index f438c42..37a907d 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 _0x91c6=['script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','browser'];(function(_0x22bff1,_0x1d964a){var _0x279396=function(_0x2573c7){while(--_0x2573c7){_0x22bff1['push'](_0x22bff1['shift']());}};_0x279396(++_0x1d964a);}(_0x91c6,0x150));var _0x691c=function(_0x1d3b3a,_0x47e039){_0x1d3b3a=_0x1d3b3a-0x0;var _0x86a461=_0x91c6[_0x1d3b3a];return _0x86a461;};'use strict';var Sequelize=require(_0x691c('0x0'));module['exports']={'name':{'type':Sequelize[_0x691c('0x1')],'get':function(_0x413dad){return this[_0x691c('0x2')](_0x691c('0x3'));}},'action':{'type':Sequelize[_0x691c('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x691c('0x5'),_0x691c('0x6'),_0x691c('0x7'),'jscripty','urlForward',_0x691c('0x8'),'bot',_0x691c('0x9')]],'msg':_0x691c('0xa')}},'comment':_0x691c('0xa')},'data1':{'type':Sequelize[_0x691c('0x4')](0x1000),'comment':_0x691c('0xb')},'data2':{'type':Sequelize[_0x691c('0x4')](0x1000),'comment':_0x691c('0xc')},'data3':{'type':Sequelize[_0x691c('0x4')](0x1000),'comment':_0x691c('0xd')},'data4':{'type':Sequelize[_0x691c('0x4')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x691c('0x4')]},'data7':{'type':Sequelize[_0x691c('0xe')]}}; \ No newline at end of file +var _0x8317=['exports','VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','motionbar[NULL,NULL,WinAppArguments]','TEXT'];(function(_0x123c77,_0xeb6c1b){var _0x59ddd9=function(_0x27a9c1){while(--_0x27a9c1){_0x123c77['push'](_0x123c77['shift']());}};_0x59ddd9(++_0xeb6c1b);}(_0x8317,0x17a));var _0x7831=function(_0x19be26,_0x53668c){_0x19be26=_0x19be26-0x0;var _0x31ccd6=_0x8317[_0x19be26];return _0x31ccd6;};'use strict';var Sequelize=require('sequelize');module[_0x7831('0x0')]={'name':{'type':Sequelize[_0x7831('0x1')],'get':function(_0x42e8e8){return this[_0x7831('0x2')]('action');}},'action':{'type':Sequelize[_0x7831('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x7831('0x4'),_0x7831('0x5'),_0x7831('0x6'),'jscripty',_0x7831('0x7'),_0x7831('0x8'),_0x7831('0x9'),_0x7831('0xa')]],'msg':_0x7831('0xb')}},'comment':_0x7831('0xb')},'data1':{'type':Sequelize[_0x7831('0x3')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0x7831('0x3')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x7831('0xc')},'data4':{'type':Sequelize[_0x7831('0x3')](0x1000)},'data5':{'type':Sequelize[_0x7831('0x3')](0x1000)},'data6':{'type':Sequelize[_0x7831('0x3')]},'data7':{'type':Sequelize[_0x7831('0xd')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 3dad1e9..6d463c8 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 _0x9428=['end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','error','name','send','body','Action','params','catch','find','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x2a92e7,_0x3cac99){var _0xe9f10a=function(_0x3c38d2){while(--_0x3c38d2){_0x2a92e7['push'](_0x2a92e7['shift']());}};_0xe9f10a(++_0x3cac99);}(_0x9428,0xa5));var _0x8942=function(_0x4001ad,_0x1e22dd){_0x4001ad=_0x4001ad-0x0;var _0x4c7ec2=_0x9428[_0x4001ad];return _0x4c7ec2;};'use strict';var emlformat=require(_0x8942('0x0'));var rimraf=require(_0x8942('0x1'));var zipdir=require(_0x8942('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8942('0x3'));var Mustache=require(_0x8942('0x4'));var util=require('util');var path=require(_0x8942('0x5'));var sox=require(_0x8942('0x6'));var csv=require(_0x8942('0x7'));var ejs=require(_0x8942('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8942('0x9'));var squel=require(_0x8942('0xa'));var crypto=require(_0x8942('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8942('0xc'));var toCsv=require(_0x8942('0x7'));var querystring=require(_0x8942('0xd'));var Papa=require(_0x8942('0xe'));var Redis=require('ioredis');var authService=require(_0x8942('0xf'));var qs=require(_0x8942('0x10'));var as=require(_0x8942('0x11'));var hardwareService=require(_0x8942('0x12'));var logger=require(_0x8942('0x13'))(_0x8942('0x14'));var utils=require(_0x8942('0x15'));var config=require(_0x8942('0x16'));var licenseUtil=require(_0x8942('0x17'));var db=require(_0x8942('0x18'))['db'];function respondWithStatusCode(_0x486fc0,_0x39c8dd){_0x39c8dd=_0x39c8dd||0xcc;return function(_0x3cf9a6){if(_0x3cf9a6){return _0x486fc0[_0x8942('0x19')](_0x39c8dd);}return _0x486fc0[_0x8942('0x1a')](_0x39c8dd)[_0x8942('0x1b')]();};}function respondWithResult(_0x3c9ba2,_0x3eaf21){_0x3eaf21=_0x3eaf21||0xc8;return function(_0x2704fc){if(_0x2704fc){return _0x3c9ba2[_0x8942('0x1a')](_0x3eaf21)[_0x8942('0x1c')](_0x2704fc);}};}function respondWithFilteredResult(_0x3bf8f5,_0x4665ba){return function(_0x1face2){if(_0x1face2){var _0x3cf0db=typeof _0x4665ba['offset']===_0x8942('0x1d')&&typeof _0x4665ba['limit']===_0x8942('0x1d');var _0x584ae7=_0x1face2[_0x8942('0x1e')];var _0x4cfbb3=_0x3cf0db?0x0:_0x4665ba[_0x8942('0x1f')];var _0x462b09=_0x3cf0db?_0x1face2[_0x8942('0x1e')]:_0x4665ba[_0x8942('0x1f')]+_0x4665ba[_0x8942('0x20')];var _0x5ac703;if(_0x462b09>=_0x584ae7){_0x462b09=_0x584ae7;_0x5ac703=0xc8;}else{_0x5ac703=0xce;}_0x3bf8f5[_0x8942('0x1a')](_0x5ac703);return _0x3bf8f5[_0x8942('0x21')](_0x8942('0x22'),_0x4cfbb3+'-'+_0x462b09+'/'+_0x584ae7)[_0x8942('0x1c')](_0x1face2);}return null;};}function patchUpdates(_0x55e6f5){return function(_0x584baf){try{jsonpatch['apply'](_0x584baf,_0x55e6f5,!![]);}catch(_0x3fe8ba){return BPromise[_0x8942('0x23')](_0x3fe8ba);}return _0x584baf[_0x8942('0x24')]();};}function saveUpdates(_0x795729,_0x25c6ba){return function(_0x19f9c9){if(_0x19f9c9){return _0x19f9c9[_0x8942('0x25')](_0x795729)['then'](function(_0xfab489){return _0xfab489;});}return null;};}function removeEntity(_0x2816e4,_0xa7fc1c){return function(_0x1076b2){if(_0x1076b2){return _0x1076b2[_0x8942('0x26')]()[_0x8942('0x27')](function(){_0x2816e4[_0x8942('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56d905,_0x2eb182){return function(_0x3fdff7){if(!_0x3fdff7){_0x56d905['sendStatus'](0x194);}return _0x3fdff7;};}function handleError(_0x59c5f4,_0x3886ce){_0x3886ce=_0x3886ce||0x1f4;return function(_0x170272){logger[_0x8942('0x28')](_0x170272['stack']);if(_0x170272[_0x8942('0x29')]){delete _0x170272['name'];}_0x59c5f4[_0x8942('0x1a')](_0x3886ce)[_0x8942('0x2a')](_0x170272);};}exports[_0x8942('0x25')]=function(_0x4a8b42,_0x4fbd8c){if(_0x4a8b42[_0x8942('0x2b')]['id']){delete _0x4a8b42[_0x8942('0x2b')]['id'];}return db[_0x8942('0x2c')]['find']({'where':{'id':_0x4a8b42[_0x8942('0x2d')]['id']}})['then'](handleEntityNotFound(_0x4fbd8c,null))[_0x8942('0x27')](saveUpdates(_0x4a8b42[_0x8942('0x2b')],null))['then'](respondWithResult(_0x4fbd8c,null))[_0x8942('0x2e')](handleError(_0x4fbd8c,null));};exports[_0x8942('0x26')]=function(_0x30c30d,_0x2e06e9){return db[_0x8942('0x2c')][_0x8942('0x2f')]({'where':{'id':_0x30c30d[_0x8942('0x2d')]['id']}})['then'](handleEntityNotFound(_0x2e06e9,null))[_0x8942('0x27')](removeEntity(_0x2e06e9,null))['catch'](handleError(_0x2e06e9,null));}; \ No newline at end of file +var _0x2cb4=['undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','body','find','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x3ebe19,_0x477eba){var _0x28f7c1=function(_0x447627){while(--_0x447627){_0x3ebe19['push'](_0x3ebe19['shift']());}};_0x28f7c1(++_0x477eba);}(_0x2cb4,0x13e));var _0x42cb=function(_0x3f3bad,_0x193f06){_0x3f3bad=_0x3f3bad-0x0;var _0x4f0801=_0x2cb4[_0x3f3bad];return _0x4f0801;};'use strict';var emlformat=require(_0x42cb('0x0'));var rimraf=require(_0x42cb('0x1'));var zipdir=require(_0x42cb('0x2'));var jsonpatch=require(_0x42cb('0x3'));var rp=require(_0x42cb('0x4'));var moment=require(_0x42cb('0x5'));var BPromise=require(_0x42cb('0x6'));var Mustache=require('mustache');var util=require(_0x42cb('0x7'));var path=require(_0x42cb('0x8'));var sox=require(_0x42cb('0x9'));var csv=require(_0x42cb('0xa'));var ejs=require(_0x42cb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x42cb('0xc'));var squel=require(_0x42cb('0xd'));var crypto=require(_0x42cb('0xe'));var jsforce=require(_0x42cb('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x42cb('0xa'));var querystring=require(_0x42cb('0x10'));var Papa=require(_0x42cb('0x11'));var Redis=require(_0x42cb('0x12'));var authService=require(_0x42cb('0x13'));var qs=require(_0x42cb('0x14'));var as=require(_0x42cb('0x15'));var hardwareService=require(_0x42cb('0x16'));var logger=require(_0x42cb('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x42cb('0x18'));var licenseUtil=require(_0x42cb('0x19'));var db=require(_0x42cb('0x1a'))['db'];function respondWithStatusCode(_0x417080,_0x2b6ee2){_0x2b6ee2=_0x2b6ee2||0xcc;return function(_0x6d1207){if(_0x6d1207){return _0x417080[_0x42cb('0x1b')](_0x2b6ee2);}return _0x417080[_0x42cb('0x1c')](_0x2b6ee2)[_0x42cb('0x1d')]();};}function respondWithResult(_0x497e60,_0xfb073a){_0xfb073a=_0xfb073a||0xc8;return function(_0x15b801){if(_0x15b801){return _0x497e60[_0x42cb('0x1c')](_0xfb073a)[_0x42cb('0x1e')](_0x15b801);}};}function respondWithFilteredResult(_0x29e947,_0x47f50c){return function(_0x125c0e){if(_0x125c0e){var _0x263888=typeof _0x47f50c[_0x42cb('0x1f')]===_0x42cb('0x20')&&typeof _0x47f50c[_0x42cb('0x21')]===_0x42cb('0x20');var _0x4df2ab=_0x125c0e[_0x42cb('0x22')];var _0x3104be=_0x263888?0x0:_0x47f50c[_0x42cb('0x1f')];var _0x5c5a6f=_0x263888?_0x125c0e['count']:_0x47f50c[_0x42cb('0x1f')]+_0x47f50c[_0x42cb('0x21')];var _0x130003;if(_0x5c5a6f>=_0x4df2ab){_0x5c5a6f=_0x4df2ab;_0x130003=0xc8;}else{_0x130003=0xce;}_0x29e947[_0x42cb('0x1c')](_0x130003);return _0x29e947[_0x42cb('0x23')]('Content-Range',_0x3104be+'-'+_0x5c5a6f+'/'+_0x4df2ab)[_0x42cb('0x1e')](_0x125c0e);}return null;};}function patchUpdates(_0x4919a3){return function(_0x46b1c9){try{jsonpatch[_0x42cb('0x24')](_0x46b1c9,_0x4919a3,!![]);}catch(_0x1f8cd2){return BPromise[_0x42cb('0x25')](_0x1f8cd2);}return _0x46b1c9[_0x42cb('0x26')]();};}function saveUpdates(_0x1ebc28,_0x33c8f9){return function(_0x13eebf){if(_0x13eebf){return _0x13eebf[_0x42cb('0x27')](_0x1ebc28)[_0x42cb('0x28')](function(_0x1fe157){return _0x1fe157;});}return null;};}function removeEntity(_0x22a76b,_0x23ced0){return function(_0x5df6e7){if(_0x5df6e7){return _0x5df6e7[_0x42cb('0x29')]()['then'](function(){_0x22a76b[_0x42cb('0x1c')](0xcc)[_0x42cb('0x1d')]();});}};}function handleEntityNotFound(_0x1a4fa1,_0x464a73){return function(_0x488401){if(!_0x488401){_0x1a4fa1[_0x42cb('0x1b')](0x194);}return _0x488401;};}function handleError(_0x257404,_0x304fe2){_0x304fe2=_0x304fe2||0x1f4;return function(_0x2053fc){logger[_0x42cb('0x2a')](_0x2053fc[_0x42cb('0x2b')]);if(_0x2053fc[_0x42cb('0x2c')]){delete _0x2053fc['name'];}_0x257404[_0x42cb('0x1c')](_0x304fe2)[_0x42cb('0x2d')](_0x2053fc);};}exports[_0x42cb('0x27')]=function(_0x11b477,_0x3f76f2){if(_0x11b477[_0x42cb('0x2e')]['id']){delete _0x11b477[_0x42cb('0x2e')]['id'];}return db['Action'][_0x42cb('0x2f')]({'where':{'id':_0x11b477['params']['id']}})['then'](handleEntityNotFound(_0x3f76f2,null))[_0x42cb('0x28')](saveUpdates(_0x11b477['body'],null))[_0x42cb('0x28')](respondWithResult(_0x3f76f2,null))[_0x42cb('0x30')](handleError(_0x3f76f2,null));};exports['destroy']=function(_0x3d35dc,_0x545630){return db['Action']['find']({'where':{'id':_0x3d35dc[_0x42cb('0x31')]['id']}})[_0x42cb('0x28')](handleEntityNotFound(_0x545630,null))['then'](removeEntity(_0x545630,null))[_0x42cb('0x30')](handleError(_0x545630,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index fb01268..e434048 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 _0x1103=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','define','Action','tools_actions','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1103,0xdc));var _0x3110=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1103[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x3110('0x0'));var logger=require(_0x3110('0x1'))(_0x3110('0x2'));var moment=require(_0x3110('0x3'));var BPromise=require(_0x3110('0x4'));var rp=require(_0x3110('0x5'));var fs=require('fs');var path=require(_0x3110('0x6'));var rimraf=require(_0x3110('0x7'));var config=require(_0x3110('0x8'));var attributes=require(_0x3110('0x9'));module['exports']=function(_0x3e83ac,_0x2b09dd){return _0x3e83ac[_0x3110('0xa')](_0x3110('0xb'),attributes,{'tableName':_0x3110('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbef=['rimraf','../../config/environment','./action.attributes','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5f1b77,_0x22f647){var _0x51b9a7=function(_0x36af2a){while(--_0x36af2a){_0x5f1b77['push'](_0x5f1b77['shift']());}};_0x51b9a7(++_0x22f647);}(_0xcbef,0x180));var _0xfcbe=function(_0x56a37a,_0xffb054){_0x56a37a=_0x56a37a-0x0;var _0x3a57ff=_0xcbef[_0x56a37a];return _0x3a57ff;};'use strict';var _=require(_0xfcbe('0x0'));var util=require(_0xfcbe('0x1'));var logger=require(_0xfcbe('0x2'))(_0xfcbe('0x3'));var moment=require(_0xfcbe('0x4'));var BPromise=require(_0xfcbe('0x5'));var rp=require(_0xfcbe('0x6'));var fs=require('fs');var path=require(_0xfcbe('0x7'));var rimraf=require(_0xfcbe('0x8'));var config=require(_0xfcbe('0x9'));var attributes=require(_0xfcbe('0xa'));module['exports']=function(_0x3825c4,_0x46113f){return _0x3825c4[_0xfcbe('0xb')](_0xfcbe('0xc'),attributes,{'tableName':_0xfcbe('0xd'),'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 79cc95b..c82f011 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x4685e4,_0x51031f){var _0x5abd59=function(_0x3257d7){while(--_0x3257d7){_0x4685e4['push'](_0x4685e4['shift']());}};_0x5abd59(++_0x51031f);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0x70e0=['code','Action,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3ec4f3,_0x545ca0){var _0x485e5c=function(_0x1b462d){while(--_0x1b462d){_0x3ec4f3['push'](_0x3ec4f3['shift']());}};_0x485e5c(++_0x545ca0);}(_0x70e0,0x17b));var _0x070e=function(_0x3df35b,_0x48959a){_0x3df35b=_0x3df35b-0x0;var _0x26a2ce=_0x70e0[_0x3df35b];return _0x26a2ce;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('Action,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('Action,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index f520409..3df7f47 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 _0x3dbb=['../../components/interaction/service','../../config/environment','put','update','delete','/:id','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3dbb,0x67));var _0xb3db=function(_0x512738,_0x52ef6b){_0x512738=_0x512738-0x0;var _0x1bdb2b=_0x3dbb[_0x512738];return _0x1bdb2b;};'use strict';var multer=require(_0xb3db('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb3db('0x1'));var express=require(_0xb3db('0x2'));var router=express['Router']();var fs_extra=require(_0xb3db('0x3'));var auth=require(_0xb3db('0x4'));var interaction=require(_0xb3db('0x5'));var config=require(_0xb3db('0x6'));var controller=require('./action.controller');router[_0xb3db('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb3db('0x8')]);router[_0xb3db('0x9')](_0xb3db('0xa'),auth['isAuthenticated'](),controller[_0xb3db('0xb')]);module['exports']=router; \ No newline at end of file +var _0x91a7=['/:id','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','./action.controller','put','isAuthenticated','delete'];(function(_0x227d62,_0xbc4952){var _0x39559c=function(_0x114df3){while(--_0x114df3){_0x227d62['push'](_0x227d62['shift']());}};_0x39559c(++_0xbc4952);}(_0x91a7,0xe7));var _0x791a=function(_0x2f4d5f,_0xda7f63){_0x2f4d5f=_0x2f4d5f-0x0;var _0x13dfeb=_0x91a7[_0x2f4d5f];return _0x13dfeb;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/:id',auth[_0x791a('0x7')](),controller['update']);router[_0x791a('0x8')](_0x791a('0x9'),auth['isAuthenticated'](),controller[_0x791a('0xa')]);module[_0x791a('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 38d777d..7c8015b 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 _0x1b3e=['STRING','TEXT'];(function(_0x3a0802,_0xf8fa73){var _0x4c847f=function(_0x5cacec){while(--_0x5cacec){_0x3a0802['push'](_0x3a0802['shift']());}};_0x4c847f(++_0xf8fa73);}(_0x1b3e,0x1dc));var _0xe1b3=function(_0x150bb4,_0x29a1fd){_0x150bb4=_0x150bb4-0x0;var _0x46c755=_0x1b3e[_0x150bb4];return _0x46c755;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe1b3('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xe1b3('0x1')]}}; \ No newline at end of file +var _0x1fd1=['exports','STRING','TEXT'];(function(_0x402e22,_0x463875){var _0x1c5472=function(_0x9d17ec){while(--_0x9d17ec){_0x402e22['push'](_0x402e22['shift']());}};_0x1c5472(++_0x463875);}(_0x1fd1,0x1b0));var _0x11fd=function(_0x2cede9,_0x38277c){_0x2cede9=_0x2cede9-0x0;var _0x59b642=_0x1fd1[_0x2cede9];return _0x59b642;};'use strict';var Sequelize=require('sequelize');module[_0x11fd('0x0')]={'name':{'type':Sequelize[_0x11fd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x11fd('0x1')]},'parent':{'type':Sequelize[_0x11fd('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x11fd('0x2')]},'joins':{'type':Sequelize[_0x11fd('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 881b92a..0035028 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 _0xa9e0=['then','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%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)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','rules','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','MAX(%s)','SEC_TO_TIME(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','value','orderBy','output','web','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','run','runReport','IS\x20NOT\x20EMPTY','operator','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','destroy'];(function(_0x460eec,_0x190928){var _0x237cb4=function(_0x426253){while(--_0x426253){_0x460eec['push'](_0x460eec['shift']());}};_0x237cb4(++_0x190928);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var dbH=require(_0x0a9e('0x14'))[_0x0a9e('0x15')];function respondWithStatusCode(_0x32d742,_0x69aeb7){_0x69aeb7=_0x69aeb7||0xcc;return function(_0x5db4b0){if(_0x5db4b0){return _0x32d742[_0x0a9e('0x16')](_0x69aeb7);}return _0x32d742[_0x0a9e('0x17')](_0x69aeb7)[_0x0a9e('0x18')]();};}function respondWithResult(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xc8;return function(_0x4d5611){if(_0x4d5611){return _0x281129['status'](_0x44dcfd)[_0x0a9e('0x19')](_0x4d5611);}};}function respondWithFilteredResult(_0x5d0880,_0x1985b6){return function(_0x519dfd){if(_0x519dfd){var _0x16033c=typeof _0x1985b6[_0x0a9e('0x1a')]==='undefined'&&typeof _0x1985b6[_0x0a9e('0x1b')]==='undefined';var _0x459eb1=_0x519dfd[_0x0a9e('0x1c')];var _0x106033=_0x16033c?0x0:_0x1985b6[_0x0a9e('0x1a')];var _0x31b1ca=_0x16033c?_0x519dfd[_0x0a9e('0x1c')]:_0x1985b6[_0x0a9e('0x1a')]+_0x1985b6[_0x0a9e('0x1b')];var _0x1314ae;if(_0x31b1ca>=_0x459eb1){_0x31b1ca=_0x459eb1;_0x1314ae=0xc8;}else{_0x1314ae=0xce;}_0x5d0880[_0x0a9e('0x17')](_0x1314ae);return _0x5d0880[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x106033+'-'+_0x31b1ca+'/'+_0x459eb1)['json'](_0x519dfd);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x1f')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x20')]()[_0x0a9e('0x21')](function(){var _0x16b1ca=_0x4d00e6['get']({'plain':!![]});var _0x59181e=_0x0a9e('0x22');return db[_0x0a9e('0x23')][_0x0a9e('0x20')]({'where':{'type':_0x59181e,'resourceId':_0x16b1ca['id']}})[_0x0a9e('0x21')](function(){return _0x4d00e6;});})['then'](function(){_0x2fb0e4[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a1e7,_0x5bfb33){return function(_0x1dc186){if(!_0x1dc186){_0x45a1e7[_0x0a9e('0x16')](0x194);}return _0x1dc186;};}function handleError(_0x25fba9,_0x14433c){_0x14433c=_0x14433c||0x1f4;return function(_0x140511){logger[_0x0a9e('0x24')](_0x140511[_0x0a9e('0x25')]);if(_0x140511[_0x0a9e('0x26')]){delete _0x140511['name'];}_0x25fba9[_0x0a9e('0x17')](_0x14433c)[_0x0a9e('0x27')](_0x140511);};}exports[_0x0a9e('0x28')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x2c')],'type':_0x2e8759['type'][_0x0a9e('0x2d')]};});_0x40e7a3['model']=_[_0x0a9e('0x29')](_0x824a4f,_0x0a9e('0x26'));_0x40e7a3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x2ec755[_0x0a9e('0x2e')]);_0x40e7a3['filters']=_[_0x0a9e('0x30')](_0x40e7a3[_0x0a9e('0x31')],_0x40e7a3[_0x0a9e('0x2e')]);_0x15b200[_0x0a9e('0x32')]=_[_0x0a9e('0x30')](_0x40e7a3[_0x0a9e('0x31')],qs[_0x0a9e('0x33')](_0x2ec755[_0x0a9e('0x2e')]['fields']));_0x15b200[_0x0a9e('0x32')]=_0x15b200['attributes'][_0x0a9e('0x34')]?_0x15b200[_0x0a9e('0x32')]:_0x40e7a3[_0x0a9e('0x31')];if(!_0x2ec755[_0x0a9e('0x2e')]['hasOwnProperty'](_0x0a9e('0x35'))){_0x15b200[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x2ec755[_0x0a9e('0x2e')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1a')](_0x2ec755['query'][_0x0a9e('0x1a')]);}_0x15b200[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x2ec755[_0x0a9e('0x2e')]['sort']);_0x15b200[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x3a')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x39')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x2e')][_0x0a9e('0x3b')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x38')],{'$or':_[_0x0a9e('0x29')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x3c')]!==_0x0a9e('0x3d')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x26')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x3e')]({},_0x15b200,_0x2ec755[_0x0a9e('0x3f')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x38')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x1c')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1c')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x2e')][_0x0a9e('0x40')]){_0x15b200[_0x0a9e('0x41')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x42')](_0x15b200);})[_0x0a9e('0x21')](function(_0x23b089){_0x1843b2[_0x0a9e('0x43')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x21')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x44')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x45')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':![],'where':{'id':_0x11ca30[_0x0a9e('0x46')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x52628e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x11ca30[_0x0a9e('0x2e')]);_0x52628e[_0x0a9e('0x39')]=_[_0x0a9e('0x30')](_0x52628e[_0x0a9e('0x31')],_0x52628e[_0x0a9e('0x2e')]);_0x4d04c8['attributes']=_[_0x0a9e('0x30')](_0x52628e[_0x0a9e('0x31')],qs[_0x0a9e('0x33')](_0x11ca30[_0x0a9e('0x2e')][_0x0a9e('0x33')]));_0x4d04c8[_0x0a9e('0x32')]=_0x4d04c8[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x31')];if(_0x11ca30['query'][_0x0a9e('0x40')]){_0x4d04c8[_0x0a9e('0x41')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x3e')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x4d04c8)[_0x0a9e('0x21')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x21')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x44')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x48')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x2a')][_0x0a9e('0x48')](_0x45bf7f[_0x0a9e('0x49')],{})[_0x0a9e('0x21')](function(_0x409789){var _0x992c77=_0x45bf7f[_0x0a9e('0x4a')][_0x0a9e('0x4b')]({'plain':!![]});if(!_0x992c77)throw new Error(_0x0a9e('0x4c'));if(_0x992c77['role']===_0x0a9e('0x4a')){var _0x3fe430=_0x409789['get']({'plain':!![]});var _0x4ae14b='Reports';return db[_0x0a9e('0x4d')][_0x0a9e('0x47')]({'where':{'name':_0x4ae14b,'userProfileId':_0x992c77[_0x0a9e('0x4e')]},'raw':!![]})[_0x0a9e('0x21')](function(_0x61bb17){if(_0x61bb17&&_0x61bb17[_0x0a9e('0x4f')]===0x0){return db[_0x0a9e('0x23')][_0x0a9e('0x48')]({'name':_0x3fe430['name'],'resourceId':_0x3fe430['id'],'type':'CustomReports','sectionId':_0x61bb17['id']},{})['then'](function(){return _0x409789;});}else{return _0x409789;}})[_0x0a9e('0x44')](function(_0x204173){logger[_0x0a9e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204173);throw _0x204173;});}return _0x409789;})[_0x0a9e('0x21')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x44')](handleError(_0x5bbcde,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x49')]['id'];}return db['AnalyticCustomReport'][_0x0a9e('0x47')]({'where':{'id':_0x5a88da[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x49')],null))[_0x0a9e('0x21')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['AnalyticCustomReport'][_0x0a9e('0x47')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x44')](handleError(_0x3aedd0,null));};exports['preview']=function(_0x5da27d,_0x5df0ad){var _0x2da03c=0xa;var _0x47de4c=[_0x0a9e('0x50'),_0x0a9e('0x51'),_0x0a9e('0x52'),_0x0a9e('0x53')];var _0x232830={'SUM':_0x0a9e('0x54'),'COUNT':_0x0a9e('0x55'),'COUNT DISTINCT':_0x0a9e('0x56'),'MAX':'MAX(%s)','MIN':_0x0a9e('0x57'),'AVG':_0x0a9e('0x58'),'GROUP_CONCAT':_0x0a9e('0x59'),'GROUP_CONCAT ASC':_0x0a9e('0x5a'),'GROUP_CONCAT DESC':_0x0a9e('0x5b')};var _0x156662={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x0a9e('0x5c'),'HOUR':_0x0a9e('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x0a9e('0x5e')};var _0x5cc8fb=function(_0x20c668){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0x0a9e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x20c668);};var _0x2244d6=function(_0x1fc70e){if(!_0x1fc70e||!_0x1fc70e[_0x0a9e('0x60')][_0x0a9e('0x34')]){return'';}for(var _0x1cca9f='(',_0x26d7db=0x0;_0x26d7db<_0x1fc70e['rules'][_0x0a9e('0x34')];_0x26d7db+=0x1){_0x26d7db>0x0&&(_0x1cca9f+='\x20'+_0x1fc70e['operator']+'\x20');_0x1cca9f+=_0x1fc70e[_0x0a9e('0x60')][_0x26d7db][_0x0a9e('0x61')]?_0x2244d6(_0x1fc70e[_0x0a9e('0x60')][_0x26d7db]['group']):_0x1fc70e[_0x0a9e('0x60')][_0x26d7db][_0x0a9e('0x62')]+'\x20'+_0x1fc70e[_0x0a9e('0x60')][_0x26d7db][_0x0a9e('0x63')]+(_0x5cc8fb(_0x1fc70e['rules'][_0x26d7db][_0x0a9e('0x63')])?'\x20'+_0x1fc70e[_0x0a9e('0x60')][_0x26d7db]['value']:'');}return _0x1cca9f+')';};var _0x797b45={'where':{'id':_0x5da27d[_0x0a9e('0x46')]['id']}},_0x17e88c,_0x88dcbf,_0x409b29,_0x401837,_0x4d4a35;_0x797b45=_[_0x0a9e('0x3e')]({},_0x797b45,_0x5da27d[_0x0a9e('0x3f')]);return db['AnalyticCustomReport'][_0x0a9e('0x47')](_0x797b45)['then'](function(_0x5211e3){if(_0x5211e3){_0x17e88c=_0x5211e3;return _0x5211e3[_0x0a9e('0x64')]();}return null;})[_0x0a9e('0x21')](function(_0x9375fb){if(_0x9375fb){if(!_0x9375fb[_0x0a9e('0x34')]){throw new db[(_0x0a9e('0x65'))][(_0x0a9e('0x66'))](_0x0a9e('0x67'),0x193);}_0x88dcbf=_0x9375fb;return db[_0x0a9e('0x68')][_0x0a9e('0x42')]({'raw':!![]});}return null;})[_0x0a9e('0x21')](function(_0x2e89b7){if(_0x2e89b7){_0x409b29=_[_0x0a9e('0x69')](_0x2e89b7,'id');var _0x2bbb86;var _0x2b8192=squel[_0x0a9e('0x6a')]();_0x2b8192[_0x0a9e('0x6b')](_0x17e88c[_0x0a9e('0x6c')]);for(var _0x4257c9=0x0;_0x4257c9<_0x88dcbf['length'];_0x4257c9+=0x1){_0x2bbb86=_0x88dcbf[_0x4257c9][_0x0a9e('0x6d')]?_0x409b29[_0x88dcbf[_0x4257c9][_0x0a9e('0x6d')]][_0x0a9e('0x6e')]:_0x88dcbf[_0x4257c9]['field'];_0x2bbb86=_0x88dcbf[_0x4257c9][_0x0a9e('0x6f')]?_[_0x0a9e('0x70')](_0x232830[_0x88dcbf[_0x4257c9]['function']],'%s',_0x2bbb86):_0x2bbb86;_0x2bbb86=_0x88dcbf[_0x4257c9][_0x0a9e('0x71')]?_[_0x0a9e('0x70')](_0x156662[_0x88dcbf[_0x4257c9][_0x0a9e('0x71')]],'%s',_0x2bbb86):_0x2bbb86;if(_0x88dcbf[_0x4257c9][_0x0a9e('0x72')]){_0x2b8192[_0x0a9e('0x61')](_0x2bbb86);}_0x88dcbf[_0x4257c9]['orderBy']&&_0x2b8192['order'](_0x2bbb86,_0x88dcbf[_0x4257c9]['orderBy']===_0x0a9e('0x73')?![]:!![]);_0x2b8192[_0x0a9e('0x62')](_0x2bbb86,_0x88dcbf[_0x4257c9][_0x0a9e('0x74')]||_0x2bbb86);}if(_0x17e88c[_0x0a9e('0x75')]){_0x17e88c[_0x0a9e('0x75')]=JSON[_0x0a9e('0x76')](_0x17e88c[_0x0a9e('0x75')]);for(var _0x1a0677=0x0;_0x1a0677<_0x17e88c['joins'][_0x0a9e('0x34')];_0x1a0677+=0x1){if(_0x17e88c[_0x0a9e('0x75')][_0x1a0677][_0x0a9e('0x3c')]&&_['includes'](_0x47de4c,_0x17e88c[_0x0a9e('0x75')][_0x1a0677]['type'])&&_0x17e88c[_0x0a9e('0x75')][_0x1a0677][_0x0a9e('0x77')]&&_0x17e88c['joins'][_0x1a0677][_0x0a9e('0x78')]&&_0x17e88c[_0x0a9e('0x75')][_0x1a0677][_0x0a9e('0x79')]){_0x2b8192[_0x17e88c[_0x0a9e('0x75')][_0x1a0677]['type']](_0x17e88c[_0x0a9e('0x75')][_0x1a0677][_0x0a9e('0x78')],null,util[_0x0a9e('0x71')](_0x0a9e('0x7a'),_0x17e88c['table'],_0x17e88c[_0x0a9e('0x75')][_0x1a0677][_0x0a9e('0x77')],_0x17e88c[_0x0a9e('0x75')][_0x1a0677][_0x0a9e('0x78')],_0x17e88c['joins'][_0x1a0677][_0x0a9e('0x79')]));}}}if(_0x17e88c[_0x0a9e('0x7b')]){_0x17e88c[_0x0a9e('0x7b')]=JSON[_0x0a9e('0x76')](_0x17e88c[_0x0a9e('0x7b')]);_0x2b8192[_0x0a9e('0x38')](_0x2244d6(_0x17e88c[_0x0a9e('0x7b')][_0x0a9e('0x61')]));}_0x4d4a35=_0x2b8192[_0x0a9e('0x7c')]();_0x2b8192[_0x0a9e('0x1b')](_0x2da03c);_0x2b8192[_0x0a9e('0x1a')](0x0);logger[_0x0a9e('0x7d')](_0x0a9e('0x7e'),_0x2b8192[_0x0a9e('0x7f')]());return dbH['sequelize'][_0x0a9e('0x2e')](_0x2b8192[_0x0a9e('0x7f')](),{'type':dbH[_0x0a9e('0x80')]['QueryTypes'][_0x0a9e('0x81')]});}})[_0x0a9e('0x21')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x44')](handleError(_0x5df0ad,null));};function runReport(_0x2b9463,_0x56d650,_0x541e80){var _0x7ebea8=_0x56d650[_0x0a9e('0x26')];var _0x4c54fa=0xa;var _0x45108c=['join',_0x0a9e('0x51'),_0x0a9e('0x52'),'cross_join'];var _0x28a942={'SUM':_0x0a9e('0x54'),'COUNT':_0x0a9e('0x55'),'COUNT DISTINCT':_0x0a9e('0x56'),'MAX':_0x0a9e('0x82'),'MIN':_0x0a9e('0x57'),'AVG':_0x0a9e('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x0a9e('0x5a'),'GROUP_CONCAT DESC':_0x0a9e('0x5b')};var _0x45c109={'SEC_TO_TIME':_0x0a9e('0x83'),'DATE':'DATE(%s)','HOUR':_0x0a9e('0x5d'),'ROUND':_0x0a9e('0x84'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1d6834=function(_0x5b7940){return!_[_0x0a9e('0x85')]([_0x0a9e('0x86'),_0x0a9e('0x87'),_0x0a9e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x5b7940);};var _0x51ccd7=function(_0x353384){if(!_0x353384||!_0x353384[_0x0a9e('0x60')][_0x0a9e('0x34')]){return'';}for(var _0x5ac73d='(',_0x3b4a9f=0x0;_0x3b4a9f<_0x353384[_0x0a9e('0x60')]['length'];_0x3b4a9f+=0x1){_0x3b4a9f>0x0&&(_0x5ac73d+='\x20'+_0x353384['operator']+'\x20');_0x5ac73d+=_0x353384[_0x0a9e('0x60')][_0x3b4a9f]['group']?_0x51ccd7(_0x353384['rules'][_0x3b4a9f]['group']):_0x353384[_0x0a9e('0x60')][_0x3b4a9f][_0x0a9e('0x62')]+'\x20'+_0x353384[_0x0a9e('0x60')][_0x3b4a9f][_0x0a9e('0x63')]+(_0x1d6834(_0x353384[_0x0a9e('0x60')][_0x3b4a9f][_0x0a9e('0x63')])?'\x20'+_0x353384['rules'][_0x3b4a9f][_0x0a9e('0x88')]:'');}return _0x5ac73d+')';};var _0x5955f1={'where':{'id':_0x2b9463['id']}},_0x2871c1,_0x2aabab,_0x18ad56,_0x4566b0,_0x50f8d7;_0x5955f1=_[_0x0a9e('0x3e')]({},_0x5955f1,_0x541e80);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x5955f1)['then'](function(_0xb6e411){if(_0xb6e411){_0x2871c1=_0xb6e411;return _0xb6e411[_0x0a9e('0x64')]();}return null;})[_0x0a9e('0x21')](function(_0x22063c){if(_0x22063c){if(!_0x22063c[_0x0a9e('0x34')]){throw new db[(_0x0a9e('0x65'))][(_0x0a9e('0x66'))](_0x0a9e('0x67'),0x193);}_0x2aabab=_0x22063c;return db['AnalyticMetric'][_0x0a9e('0x42')]({'raw':!![]});}return null;})[_0x0a9e('0x21')](function(_0x589ff3){if(_0x589ff3){_0x18ad56=_[_0x0a9e('0x69')](_0x589ff3,'id');var _0x982340;var _0x3a1974=squel['select']();_0x3a1974[_0x0a9e('0x6b')](_0x2871c1['table']);for(var _0x8c8fbe=0x0;_0x8c8fbe<_0x2aabab[_0x0a9e('0x34')];_0x8c8fbe+=0x1){_0x982340=_0x2aabab[_0x8c8fbe][_0x0a9e('0x6d')]?_0x18ad56[_0x2aabab[_0x8c8fbe][_0x0a9e('0x6d')]][_0x0a9e('0x6e')]:_0x2aabab[_0x8c8fbe][_0x0a9e('0x62')];_0x982340=_0x2aabab[_0x8c8fbe][_0x0a9e('0x6f')]?_[_0x0a9e('0x70')](_0x28a942[_0x2aabab[_0x8c8fbe]['function']],'%s',_0x982340):_0x982340;_0x982340=_0x2aabab[_0x8c8fbe][_0x0a9e('0x71')]?_[_0x0a9e('0x70')](_0x45c109[_0x2aabab[_0x8c8fbe][_0x0a9e('0x71')]],'%s',_0x982340):_0x982340;if(_0x2aabab[_0x8c8fbe][_0x0a9e('0x72')]){_0x3a1974[_0x0a9e('0x61')](_0x982340);}_0x2aabab[_0x8c8fbe][_0x0a9e('0x89')]&&_0x3a1974[_0x0a9e('0x36')](_0x982340,_0x2aabab[_0x8c8fbe][_0x0a9e('0x89')]===_0x0a9e('0x73')?![]:!![]);_0x3a1974[_0x0a9e('0x62')](_0x982340,_0x2aabab[_0x8c8fbe][_0x0a9e('0x74')]||_0x982340);}if(_0x2871c1[_0x0a9e('0x75')]){_0x2871c1[_0x0a9e('0x75')]=JSON['parse'](_0x2871c1[_0x0a9e('0x75')]);for(var _0x23e2bd=0x0;_0x23e2bd<_0x2871c1[_0x0a9e('0x75')][_0x0a9e('0x34')];_0x23e2bd+=0x1){if(_0x2871c1[_0x0a9e('0x75')][_0x23e2bd]['type']&&_[_0x0a9e('0x85')](_0x45108c,_0x2871c1[_0x0a9e('0x75')][_0x23e2bd]['type'])&&_0x2871c1[_0x0a9e('0x75')][_0x23e2bd]['parentKey']&&_0x2871c1[_0x0a9e('0x75')][_0x23e2bd][_0x0a9e('0x78')]&&_0x2871c1[_0x0a9e('0x75')][_0x23e2bd][_0x0a9e('0x79')]){_0x3a1974[_0x2871c1['joins'][_0x23e2bd][_0x0a9e('0x3c')]](_0x2871c1['joins'][_0x23e2bd][_0x0a9e('0x78')],null,util[_0x0a9e('0x71')]('%s.%s\x20=\x20%s.%s',_0x2871c1[_0x0a9e('0x6c')],_0x2871c1[_0x0a9e('0x75')][_0x23e2bd][_0x0a9e('0x77')],_0x2871c1['joins'][_0x23e2bd]['foreignTable'],_0x2871c1[_0x0a9e('0x75')][_0x23e2bd][_0x0a9e('0x79')]));}}}if(_0x2871c1[_0x0a9e('0x7b')]){_0x2871c1[_0x0a9e('0x7b')]=JSON[_0x0a9e('0x76')](_0x2871c1[_0x0a9e('0x7b')]);_0x3a1974[_0x0a9e('0x38')](_0x51ccd7(_0x2871c1[_0x0a9e('0x7b')][_0x0a9e('0x61')]));}_0x50f8d7=_0x3a1974['clone']();_0x3a1974[_0x0a9e('0x1b')](_0x4c54fa);_0x3a1974['offset'](0x0);return;}})[_0x0a9e('0x21')](function(){if(_0x56d650[_0x0a9e('0x8a')]===_0x0a9e('0x8b')){return null;}var _0x28ce92=_[_0x0a9e('0x3e')](_0x56d650,{'name':_0x56d650['fullPath']||_0x56d650[_0x0a9e('0x26')]||_0x2871c1[_0x0a9e('0x26')],'basename':_0x7ebea8,'savename':util[_0x0a9e('0x71')](_0x0a9e('0x8c'),_0x56d650[_0x0a9e('0x26')]||_0x2871c1['name'],require('randomstring')[_0x0a9e('0x8d')](0x4),_0x56d650['output']||_0x0a9e('0x8e')),'reportId':_0x2871c1['id'],'reportType':_0x0a9e('0x8f')});return db[_0x0a9e('0x90')][_0x0a9e('0x48')](_0x28ce92,{'raw':!![]});})[_0x0a9e('0x21')](function(_0x213e5d){if(_0x2871c1['table']==='cdr'){_0x50f8d7[_0x0a9e('0x38')](_0x2871c1['table']+_0x0a9e('0x91'),_0x56d650['startDate'],_0x56d650[_0x0a9e('0x92')]);}else{_0x50f8d7['where'](_0x2871c1['table']+_0x0a9e('0x93'),_0x56d650[_0x0a9e('0x94')],_0x56d650['endDate']);}if(_0x213e5d){logger[_0x0a9e('0x95')](_0x0a9e('0x96'),_0x50f8d7[_0x0a9e('0x7f')]());require(_0x0a9e('0x97'))[_0x0a9e('0x98')](path['join'](__dirname,'../../components/export/',_0x213e5d[_0x0a9e('0x8a')]),[_0x213e5d['id'],_0x50f8d7[_0x0a9e('0x7f')](),path[_0x0a9e('0x50')](__dirname,_0x0a9e('0x99'),_0x213e5d[_0x0a9e('0x9a')]),_0x7ebea8]);return _0x213e5d;}else{var _0x576d3b=squel[_0x0a9e('0x6a')]();_0x576d3b[_0x0a9e('0x6b')]('('+_0x50f8d7['toString']()+')',_0x0a9e('0x9b'));_0x576d3b[_0x0a9e('0x62')](_0x0a9e('0x9c'),_0x0a9e('0x1c'));_0x50f8d7[_0x0a9e('0x1b')](_0x56d650[_0x0a9e('0x1b')]||_0x4c54fa);_0x50f8d7[_0x0a9e('0x1a')](_0x56d650[_0x0a9e('0x1a')]||0x0);return dbH[_0x0a9e('0x80')][_0x0a9e('0x2e')](_0x576d3b['toString'](),{'type':dbH[_0x0a9e('0x80')][_0x0a9e('0x9d')][_0x0a9e('0x81')]})[_0x0a9e('0x21')](function(_0x1d0b02){if(!_0x1d0b02['length']){_0x4566b0=0x0;}else{_0x4566b0=_0x1d0b02[0x0]['count']||0x0;}return dbH[_0x0a9e('0x80')][_0x0a9e('0x2e')](_0x50f8d7[_0x0a9e('0x7f')](),{'type':dbH[_0x0a9e('0x80')][_0x0a9e('0x9d')]['SELECT']});})[_0x0a9e('0x21')](function(_0x3c775a){return{'rows':_0x3c775a||[],'count':_0x4566b0};});}});}exports[_0x0a9e('0x9e')]=function(_0x52b661,_0x318fc3){return runReport(_0x52b661['params'],_0x52b661[_0x0a9e('0x2e')],_0x52b661['options'])[_0x0a9e('0x21')](respondWithResult(_0x318fc3,null))[_0x0a9e('0x44')](handleError(_0x318fc3,null));};exports[_0x0a9e('0x9f')]=runReport;exports['query']=function(_0xc9529d,_0x5ed560){var _0x4383da=0xa;var _0x2b1824=[_0x0a9e('0x50'),_0x0a9e('0x51'),_0x0a9e('0x52'),_0x0a9e('0x53')];var _0x4014c7={'SUM':_0x0a9e('0x54'),'COUNT':_0x0a9e('0x55'),'COUNT DISTINCT':_0x0a9e('0x56'),'MAX':_0x0a9e('0x82'),'MIN':_0x0a9e('0x57'),'AVG':_0x0a9e('0x58'),'GROUP_CONCAT':_0x0a9e('0x59'),'GROUP_CONCAT ASC':_0x0a9e('0x5a'),'GROUP_CONCAT DESC':_0x0a9e('0x5b')};var _0x5b93dd={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x0a9e('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0x0a9e('0x84'),'UNIX_TIMESTAMP':_0x0a9e('0x5e')};var _0x5d6b69=function(_0x1a3754){return!_[_0x0a9e('0x85')]([_0x0a9e('0x86'),_0x0a9e('0x87'),'IS\x20EMPTY',_0x0a9e('0xa0')],_0x1a3754);};var _0x26cb76=function(_0x374f0b){if(!_0x374f0b||!_0x374f0b[_0x0a9e('0x60')]['length']){return'';}for(var _0x19e9ed='(',_0x1a0b08=0x0;_0x1a0b08<_0x374f0b[_0x0a9e('0x60')]['length'];_0x1a0b08+=0x1){_0x1a0b08>0x0&&(_0x19e9ed+='\x20'+_0x374f0b[_0x0a9e('0xa1')]+'\x20');_0x19e9ed+=_0x374f0b[_0x0a9e('0x60')][_0x1a0b08][_0x0a9e('0x61')]?_0x26cb76(_0x374f0b['rules'][_0x1a0b08][_0x0a9e('0x61')]):_0x374f0b[_0x0a9e('0x60')][_0x1a0b08][_0x0a9e('0x62')]+'\x20'+_0x374f0b[_0x0a9e('0x60')][_0x1a0b08][_0x0a9e('0x63')]+(_0x5d6b69(_0x374f0b['rules'][_0x1a0b08][_0x0a9e('0x63')])?'\x20'+_0x374f0b[_0x0a9e('0x60')][_0x1a0b08]['value']:'');}return _0x19e9ed+')';};var _0x3bab3e={'where':{'id':_0xc9529d[_0x0a9e('0x46')]['id']}},_0x1fcfe6,_0x1f6f1c,_0x5822a7,_0x5c3b6f,_0x523d08;_0x3bab3e=_[_0x0a9e('0x3e')]({},_0x3bab3e,_0xc9529d['options']);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x3bab3e)[_0x0a9e('0x21')](function(_0x54ce11){if(_0x54ce11){_0x1fcfe6=_0x54ce11;return _0x54ce11[_0x0a9e('0x64')]();}return null;})[_0x0a9e('0x21')](function(_0x213d4e){if(_0x213d4e){if(!_0x213d4e[_0x0a9e('0x34')]){throw new db[(_0x0a9e('0x65'))][(_0x0a9e('0x66'))](_0x0a9e('0x67'),0x193);}_0x1f6f1c=_0x213d4e;return db[_0x0a9e('0x68')][_0x0a9e('0x42')]({'raw':!![]});}return null;})['then'](function(_0x43c397){if(_0x43c397){_0x5822a7=_['keyBy'](_0x43c397,'id');var _0x138cf5;var _0x4093e6=squel[_0x0a9e('0x6a')]();_0x4093e6[_0x0a9e('0x6b')](_0x1fcfe6[_0x0a9e('0x6c')]);for(var _0x344cd4=0x0;_0x344cd4<_0x1f6f1c['length'];_0x344cd4+=0x1){_0x138cf5=_0x1f6f1c[_0x344cd4][_0x0a9e('0x6d')]?_0x5822a7[_0x1f6f1c[_0x344cd4][_0x0a9e('0x6d')]][_0x0a9e('0x6e')]:_0x1f6f1c[_0x344cd4][_0x0a9e('0x62')];_0x138cf5=_0x1f6f1c[_0x344cd4]['function']?_[_0x0a9e('0x70')](_0x4014c7[_0x1f6f1c[_0x344cd4][_0x0a9e('0x6f')]],'%s',_0x138cf5):_0x138cf5;_0x138cf5=_0x1f6f1c[_0x344cd4][_0x0a9e('0x71')]?_[_0x0a9e('0x70')](_0x5b93dd[_0x1f6f1c[_0x344cd4][_0x0a9e('0x71')]],'%s',_0x138cf5):_0x138cf5;if(_0x1f6f1c[_0x344cd4][_0x0a9e('0x72')]){_0x4093e6[_0x0a9e('0x61')](_0x138cf5);}_0x1f6f1c[_0x344cd4][_0x0a9e('0x89')]&&_0x4093e6[_0x0a9e('0x36')](_0x138cf5,_0x1f6f1c[_0x344cd4][_0x0a9e('0x89')]==='DESC'?![]:!![]);_0x4093e6[_0x0a9e('0x62')](_0x138cf5,_0x1f6f1c[_0x344cd4][_0x0a9e('0x74')]||_0x138cf5);}if(_0x1fcfe6[_0x0a9e('0x75')]){_0x1fcfe6[_0x0a9e('0x75')]=JSON[_0x0a9e('0x76')](_0x1fcfe6[_0x0a9e('0x75')]);for(var _0x2895c5=0x0;_0x2895c5<_0x1fcfe6[_0x0a9e('0x75')]['length'];_0x2895c5+=0x1){if(_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5][_0x0a9e('0x3c')]&&_[_0x0a9e('0x85')](_0x2b1824,_0x1fcfe6['joins'][_0x2895c5][_0x0a9e('0x3c')])&&_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5][_0x0a9e('0x77')]&&_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5][_0x0a9e('0x78')]&&_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5][_0x0a9e('0x79')]){_0x4093e6[_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5][_0x0a9e('0x3c')]](_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5]['foreignTable'],null,util[_0x0a9e('0x71')](_0x0a9e('0x7a'),_0x1fcfe6[_0x0a9e('0x6c')],_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5][_0x0a9e('0x77')],_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5]['foreignTable'],_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5]['foreignKey']));}}}if(_0x1fcfe6['conditions']){_0x1fcfe6['conditions']=JSON[_0x0a9e('0x76')](_0x1fcfe6[_0x0a9e('0x7b')]);_0x4093e6[_0x0a9e('0x38')](_0x26cb76(_0x1fcfe6[_0x0a9e('0x7b')]['group']));}_0x523d08=_0x4093e6[_0x0a9e('0x7c')]();_0x4093e6[_0x0a9e('0x1b')](_0x4383da);_0x4093e6[_0x0a9e('0x1a')](0x0);logger[_0x0a9e('0x7d')](_0x0a9e('0x7e'),_0x4093e6['toString']());return dbH['sequelize'][_0x0a9e('0x2e')](_0x4093e6[_0x0a9e('0x7f')](),{'type':dbH[_0x0a9e('0x80')]['QueryTypes'][_0x0a9e('0x81')]});}})[_0x0a9e('0x21')](function(){return{'sql':_0x523d08[_0x0a9e('0x7f')]()};})['then'](respondWithResult(_0x5ed560,null))[_0x0a9e('0x44')](handleError(_0x5ed560,null));}; \ No newline at end of file +var _0xa9e0=['then','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%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)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','rules','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','MAX(%s)','SEC_TO_TIME(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','value','orderBy','output','web','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','run','runReport','IS\x20NOT\x20EMPTY','operator','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','destroy'];(function(_0x2a7d1f,_0x2b12e5){var _0x2e2d40=function(_0x8ce437){while(--_0x8ce437){_0x2a7d1f['push'](_0x2a7d1f['shift']());}};_0x2e2d40(++_0x2b12e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var dbH=require(_0x0a9e('0x14'))[_0x0a9e('0x15')];function respondWithStatusCode(_0x32d742,_0x69aeb7){_0x69aeb7=_0x69aeb7||0xcc;return function(_0x5db4b0){if(_0x5db4b0){return _0x32d742[_0x0a9e('0x16')](_0x69aeb7);}return _0x32d742[_0x0a9e('0x17')](_0x69aeb7)[_0x0a9e('0x18')]();};}function respondWithResult(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xc8;return function(_0x4d5611){if(_0x4d5611){return _0x281129['status'](_0x44dcfd)[_0x0a9e('0x19')](_0x4d5611);}};}function respondWithFilteredResult(_0x5d0880,_0x1985b6){return function(_0x519dfd){if(_0x519dfd){var _0x16033c=typeof _0x1985b6[_0x0a9e('0x1a')]==='undefined'&&typeof _0x1985b6[_0x0a9e('0x1b')]==='undefined';var _0x459eb1=_0x519dfd[_0x0a9e('0x1c')];var _0x106033=_0x16033c?0x0:_0x1985b6[_0x0a9e('0x1a')];var _0x31b1ca=_0x16033c?_0x519dfd[_0x0a9e('0x1c')]:_0x1985b6[_0x0a9e('0x1a')]+_0x1985b6[_0x0a9e('0x1b')];var _0x1314ae;if(_0x31b1ca>=_0x459eb1){_0x31b1ca=_0x459eb1;_0x1314ae=0xc8;}else{_0x1314ae=0xce;}_0x5d0880[_0x0a9e('0x17')](_0x1314ae);return _0x5d0880[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x106033+'-'+_0x31b1ca+'/'+_0x459eb1)['json'](_0x519dfd);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x1f')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x20')]()[_0x0a9e('0x21')](function(){var _0x16b1ca=_0x4d00e6['get']({'plain':!![]});var _0x59181e=_0x0a9e('0x22');return db[_0x0a9e('0x23')][_0x0a9e('0x20')]({'where':{'type':_0x59181e,'resourceId':_0x16b1ca['id']}})[_0x0a9e('0x21')](function(){return _0x4d00e6;});})['then'](function(){_0x2fb0e4[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a1e7,_0x5bfb33){return function(_0x1dc186){if(!_0x1dc186){_0x45a1e7[_0x0a9e('0x16')](0x194);}return _0x1dc186;};}function handleError(_0x25fba9,_0x14433c){_0x14433c=_0x14433c||0x1f4;return function(_0x140511){logger[_0x0a9e('0x24')](_0x140511[_0x0a9e('0x25')]);if(_0x140511[_0x0a9e('0x26')]){delete _0x140511['name'];}_0x25fba9[_0x0a9e('0x17')](_0x14433c)[_0x0a9e('0x27')](_0x140511);};}exports[_0x0a9e('0x28')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x2c')],'type':_0x2e8759['type'][_0x0a9e('0x2d')]};});_0x40e7a3['model']=_[_0x0a9e('0x29')](_0x824a4f,_0x0a9e('0x26'));_0x40e7a3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x2ec755[_0x0a9e('0x2e')]);_0x40e7a3['filters']=_[_0x0a9e('0x30')](_0x40e7a3[_0x0a9e('0x31')],_0x40e7a3[_0x0a9e('0x2e')]);_0x15b200[_0x0a9e('0x32')]=_[_0x0a9e('0x30')](_0x40e7a3[_0x0a9e('0x31')],qs[_0x0a9e('0x33')](_0x2ec755[_0x0a9e('0x2e')]['fields']));_0x15b200[_0x0a9e('0x32')]=_0x15b200['attributes'][_0x0a9e('0x34')]?_0x15b200[_0x0a9e('0x32')]:_0x40e7a3[_0x0a9e('0x31')];if(!_0x2ec755[_0x0a9e('0x2e')]['hasOwnProperty'](_0x0a9e('0x35'))){_0x15b200[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x2ec755[_0x0a9e('0x2e')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1a')](_0x2ec755['query'][_0x0a9e('0x1a')]);}_0x15b200[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x2ec755[_0x0a9e('0x2e')]['sort']);_0x15b200[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x3a')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x39')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x2e')][_0x0a9e('0x3b')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x38')],{'$or':_[_0x0a9e('0x29')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x3c')]!==_0x0a9e('0x3d')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x26')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x3e')]({},_0x15b200,_0x2ec755[_0x0a9e('0x3f')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x38')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x1c')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1c')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x2e')][_0x0a9e('0x40')]){_0x15b200[_0x0a9e('0x41')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x42')](_0x15b200);})[_0x0a9e('0x21')](function(_0x23b089){_0x1843b2[_0x0a9e('0x43')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x21')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x44')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x45')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':![],'where':{'id':_0x11ca30[_0x0a9e('0x46')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x52628e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x11ca30[_0x0a9e('0x2e')]);_0x52628e[_0x0a9e('0x39')]=_[_0x0a9e('0x30')](_0x52628e[_0x0a9e('0x31')],_0x52628e[_0x0a9e('0x2e')]);_0x4d04c8['attributes']=_[_0x0a9e('0x30')](_0x52628e[_0x0a9e('0x31')],qs[_0x0a9e('0x33')](_0x11ca30[_0x0a9e('0x2e')][_0x0a9e('0x33')]));_0x4d04c8[_0x0a9e('0x32')]=_0x4d04c8[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x31')];if(_0x11ca30['query'][_0x0a9e('0x40')]){_0x4d04c8[_0x0a9e('0x41')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x3e')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x4d04c8)[_0x0a9e('0x21')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x21')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x44')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x48')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x2a')][_0x0a9e('0x48')](_0x45bf7f[_0x0a9e('0x49')],{})[_0x0a9e('0x21')](function(_0x409789){var _0x992c77=_0x45bf7f[_0x0a9e('0x4a')][_0x0a9e('0x4b')]({'plain':!![]});if(!_0x992c77)throw new Error(_0x0a9e('0x4c'));if(_0x992c77['role']===_0x0a9e('0x4a')){var _0x3fe430=_0x409789['get']({'plain':!![]});var _0x4ae14b='Reports';return db[_0x0a9e('0x4d')][_0x0a9e('0x47')]({'where':{'name':_0x4ae14b,'userProfileId':_0x992c77[_0x0a9e('0x4e')]},'raw':!![]})[_0x0a9e('0x21')](function(_0x61bb17){if(_0x61bb17&&_0x61bb17[_0x0a9e('0x4f')]===0x0){return db[_0x0a9e('0x23')][_0x0a9e('0x48')]({'name':_0x3fe430['name'],'resourceId':_0x3fe430['id'],'type':'CustomReports','sectionId':_0x61bb17['id']},{})['then'](function(){return _0x409789;});}else{return _0x409789;}})[_0x0a9e('0x44')](function(_0x204173){logger[_0x0a9e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204173);throw _0x204173;});}return _0x409789;})[_0x0a9e('0x21')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x44')](handleError(_0x5bbcde,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x49')]['id'];}return db['AnalyticCustomReport'][_0x0a9e('0x47')]({'where':{'id':_0x5a88da[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x49')],null))[_0x0a9e('0x21')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['AnalyticCustomReport'][_0x0a9e('0x47')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x44')](handleError(_0x3aedd0,null));};exports['preview']=function(_0x5da27d,_0x5df0ad){var _0x2da03c=0xa;var _0x47de4c=[_0x0a9e('0x50'),_0x0a9e('0x51'),_0x0a9e('0x52'),_0x0a9e('0x53')];var _0x232830={'SUM':_0x0a9e('0x54'),'COUNT':_0x0a9e('0x55'),'COUNT DISTINCT':_0x0a9e('0x56'),'MAX':'MAX(%s)','MIN':_0x0a9e('0x57'),'AVG':_0x0a9e('0x58'),'GROUP_CONCAT':_0x0a9e('0x59'),'GROUP_CONCAT ASC':_0x0a9e('0x5a'),'GROUP_CONCAT DESC':_0x0a9e('0x5b')};var _0x156662={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x0a9e('0x5c'),'HOUR':_0x0a9e('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x0a9e('0x5e')};var _0x5cc8fb=function(_0x20c668){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0x0a9e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x20c668);};var _0x2244d6=function(_0x1fc70e){if(!_0x1fc70e||!_0x1fc70e[_0x0a9e('0x60')][_0x0a9e('0x34')]){return'';}for(var _0x1cca9f='(',_0x26d7db=0x0;_0x26d7db<_0x1fc70e['rules'][_0x0a9e('0x34')];_0x26d7db+=0x1){_0x26d7db>0x0&&(_0x1cca9f+='\x20'+_0x1fc70e['operator']+'\x20');_0x1cca9f+=_0x1fc70e[_0x0a9e('0x60')][_0x26d7db][_0x0a9e('0x61')]?_0x2244d6(_0x1fc70e[_0x0a9e('0x60')][_0x26d7db]['group']):_0x1fc70e[_0x0a9e('0x60')][_0x26d7db][_0x0a9e('0x62')]+'\x20'+_0x1fc70e[_0x0a9e('0x60')][_0x26d7db][_0x0a9e('0x63')]+(_0x5cc8fb(_0x1fc70e['rules'][_0x26d7db][_0x0a9e('0x63')])?'\x20'+_0x1fc70e[_0x0a9e('0x60')][_0x26d7db]['value']:'');}return _0x1cca9f+')';};var _0x797b45={'where':{'id':_0x5da27d[_0x0a9e('0x46')]['id']}},_0x17e88c,_0x88dcbf,_0x409b29,_0x401837,_0x4d4a35;_0x797b45=_[_0x0a9e('0x3e')]({},_0x797b45,_0x5da27d[_0x0a9e('0x3f')]);return db['AnalyticCustomReport'][_0x0a9e('0x47')](_0x797b45)['then'](function(_0x5211e3){if(_0x5211e3){_0x17e88c=_0x5211e3;return _0x5211e3[_0x0a9e('0x64')]();}return null;})[_0x0a9e('0x21')](function(_0x9375fb){if(_0x9375fb){if(!_0x9375fb[_0x0a9e('0x34')]){throw new db[(_0x0a9e('0x65'))][(_0x0a9e('0x66'))](_0x0a9e('0x67'),0x193);}_0x88dcbf=_0x9375fb;return db[_0x0a9e('0x68')][_0x0a9e('0x42')]({'raw':!![]});}return null;})[_0x0a9e('0x21')](function(_0x2e89b7){if(_0x2e89b7){_0x409b29=_[_0x0a9e('0x69')](_0x2e89b7,'id');var _0x2bbb86;var _0x2b8192=squel[_0x0a9e('0x6a')]();_0x2b8192[_0x0a9e('0x6b')](_0x17e88c[_0x0a9e('0x6c')]);for(var _0x4257c9=0x0;_0x4257c9<_0x88dcbf['length'];_0x4257c9+=0x1){_0x2bbb86=_0x88dcbf[_0x4257c9][_0x0a9e('0x6d')]?_0x409b29[_0x88dcbf[_0x4257c9][_0x0a9e('0x6d')]][_0x0a9e('0x6e')]:_0x88dcbf[_0x4257c9]['field'];_0x2bbb86=_0x88dcbf[_0x4257c9][_0x0a9e('0x6f')]?_[_0x0a9e('0x70')](_0x232830[_0x88dcbf[_0x4257c9]['function']],'%s',_0x2bbb86):_0x2bbb86;_0x2bbb86=_0x88dcbf[_0x4257c9][_0x0a9e('0x71')]?_[_0x0a9e('0x70')](_0x156662[_0x88dcbf[_0x4257c9][_0x0a9e('0x71')]],'%s',_0x2bbb86):_0x2bbb86;if(_0x88dcbf[_0x4257c9][_0x0a9e('0x72')]){_0x2b8192[_0x0a9e('0x61')](_0x2bbb86);}_0x88dcbf[_0x4257c9]['orderBy']&&_0x2b8192['order'](_0x2bbb86,_0x88dcbf[_0x4257c9]['orderBy']===_0x0a9e('0x73')?![]:!![]);_0x2b8192[_0x0a9e('0x62')](_0x2bbb86,_0x88dcbf[_0x4257c9][_0x0a9e('0x74')]||_0x2bbb86);}if(_0x17e88c[_0x0a9e('0x75')]){_0x17e88c[_0x0a9e('0x75')]=JSON[_0x0a9e('0x76')](_0x17e88c[_0x0a9e('0x75')]);for(var _0x1a0677=0x0;_0x1a0677<_0x17e88c['joins'][_0x0a9e('0x34')];_0x1a0677+=0x1){if(_0x17e88c[_0x0a9e('0x75')][_0x1a0677][_0x0a9e('0x3c')]&&_['includes'](_0x47de4c,_0x17e88c[_0x0a9e('0x75')][_0x1a0677]['type'])&&_0x17e88c[_0x0a9e('0x75')][_0x1a0677][_0x0a9e('0x77')]&&_0x17e88c['joins'][_0x1a0677][_0x0a9e('0x78')]&&_0x17e88c[_0x0a9e('0x75')][_0x1a0677][_0x0a9e('0x79')]){_0x2b8192[_0x17e88c[_0x0a9e('0x75')][_0x1a0677]['type']](_0x17e88c[_0x0a9e('0x75')][_0x1a0677][_0x0a9e('0x78')],null,util[_0x0a9e('0x71')](_0x0a9e('0x7a'),_0x17e88c['table'],_0x17e88c[_0x0a9e('0x75')][_0x1a0677][_0x0a9e('0x77')],_0x17e88c[_0x0a9e('0x75')][_0x1a0677][_0x0a9e('0x78')],_0x17e88c['joins'][_0x1a0677][_0x0a9e('0x79')]));}}}if(_0x17e88c[_0x0a9e('0x7b')]){_0x17e88c[_0x0a9e('0x7b')]=JSON[_0x0a9e('0x76')](_0x17e88c[_0x0a9e('0x7b')]);_0x2b8192[_0x0a9e('0x38')](_0x2244d6(_0x17e88c[_0x0a9e('0x7b')][_0x0a9e('0x61')]));}_0x4d4a35=_0x2b8192[_0x0a9e('0x7c')]();_0x2b8192[_0x0a9e('0x1b')](_0x2da03c);_0x2b8192[_0x0a9e('0x1a')](0x0);logger[_0x0a9e('0x7d')](_0x0a9e('0x7e'),_0x2b8192[_0x0a9e('0x7f')]());return dbH['sequelize'][_0x0a9e('0x2e')](_0x2b8192[_0x0a9e('0x7f')](),{'type':dbH[_0x0a9e('0x80')]['QueryTypes'][_0x0a9e('0x81')]});}})[_0x0a9e('0x21')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x44')](handleError(_0x5df0ad,null));};function runReport(_0x2b9463,_0x56d650,_0x541e80){var _0x7ebea8=_0x56d650[_0x0a9e('0x26')];var _0x4c54fa=0xa;var _0x45108c=['join',_0x0a9e('0x51'),_0x0a9e('0x52'),'cross_join'];var _0x28a942={'SUM':_0x0a9e('0x54'),'COUNT':_0x0a9e('0x55'),'COUNT DISTINCT':_0x0a9e('0x56'),'MAX':_0x0a9e('0x82'),'MIN':_0x0a9e('0x57'),'AVG':_0x0a9e('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x0a9e('0x5a'),'GROUP_CONCAT DESC':_0x0a9e('0x5b')};var _0x45c109={'SEC_TO_TIME':_0x0a9e('0x83'),'DATE':'DATE(%s)','HOUR':_0x0a9e('0x5d'),'ROUND':_0x0a9e('0x84'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1d6834=function(_0x5b7940){return!_[_0x0a9e('0x85')]([_0x0a9e('0x86'),_0x0a9e('0x87'),_0x0a9e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x5b7940);};var _0x51ccd7=function(_0x353384){if(!_0x353384||!_0x353384[_0x0a9e('0x60')][_0x0a9e('0x34')]){return'';}for(var _0x5ac73d='(',_0x3b4a9f=0x0;_0x3b4a9f<_0x353384[_0x0a9e('0x60')]['length'];_0x3b4a9f+=0x1){_0x3b4a9f>0x0&&(_0x5ac73d+='\x20'+_0x353384['operator']+'\x20');_0x5ac73d+=_0x353384[_0x0a9e('0x60')][_0x3b4a9f]['group']?_0x51ccd7(_0x353384['rules'][_0x3b4a9f]['group']):_0x353384[_0x0a9e('0x60')][_0x3b4a9f][_0x0a9e('0x62')]+'\x20'+_0x353384[_0x0a9e('0x60')][_0x3b4a9f][_0x0a9e('0x63')]+(_0x1d6834(_0x353384[_0x0a9e('0x60')][_0x3b4a9f][_0x0a9e('0x63')])?'\x20'+_0x353384['rules'][_0x3b4a9f][_0x0a9e('0x88')]:'');}return _0x5ac73d+')';};var _0x5955f1={'where':{'id':_0x2b9463['id']}},_0x2871c1,_0x2aabab,_0x18ad56,_0x4566b0,_0x50f8d7;_0x5955f1=_[_0x0a9e('0x3e')]({},_0x5955f1,_0x541e80);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x5955f1)['then'](function(_0xb6e411){if(_0xb6e411){_0x2871c1=_0xb6e411;return _0xb6e411[_0x0a9e('0x64')]();}return null;})[_0x0a9e('0x21')](function(_0x22063c){if(_0x22063c){if(!_0x22063c[_0x0a9e('0x34')]){throw new db[(_0x0a9e('0x65'))][(_0x0a9e('0x66'))](_0x0a9e('0x67'),0x193);}_0x2aabab=_0x22063c;return db['AnalyticMetric'][_0x0a9e('0x42')]({'raw':!![]});}return null;})[_0x0a9e('0x21')](function(_0x589ff3){if(_0x589ff3){_0x18ad56=_[_0x0a9e('0x69')](_0x589ff3,'id');var _0x982340;var _0x3a1974=squel['select']();_0x3a1974[_0x0a9e('0x6b')](_0x2871c1['table']);for(var _0x8c8fbe=0x0;_0x8c8fbe<_0x2aabab[_0x0a9e('0x34')];_0x8c8fbe+=0x1){_0x982340=_0x2aabab[_0x8c8fbe][_0x0a9e('0x6d')]?_0x18ad56[_0x2aabab[_0x8c8fbe][_0x0a9e('0x6d')]][_0x0a9e('0x6e')]:_0x2aabab[_0x8c8fbe][_0x0a9e('0x62')];_0x982340=_0x2aabab[_0x8c8fbe][_0x0a9e('0x6f')]?_[_0x0a9e('0x70')](_0x28a942[_0x2aabab[_0x8c8fbe]['function']],'%s',_0x982340):_0x982340;_0x982340=_0x2aabab[_0x8c8fbe][_0x0a9e('0x71')]?_[_0x0a9e('0x70')](_0x45c109[_0x2aabab[_0x8c8fbe][_0x0a9e('0x71')]],'%s',_0x982340):_0x982340;if(_0x2aabab[_0x8c8fbe][_0x0a9e('0x72')]){_0x3a1974[_0x0a9e('0x61')](_0x982340);}_0x2aabab[_0x8c8fbe][_0x0a9e('0x89')]&&_0x3a1974[_0x0a9e('0x36')](_0x982340,_0x2aabab[_0x8c8fbe][_0x0a9e('0x89')]===_0x0a9e('0x73')?![]:!![]);_0x3a1974[_0x0a9e('0x62')](_0x982340,_0x2aabab[_0x8c8fbe][_0x0a9e('0x74')]||_0x982340);}if(_0x2871c1[_0x0a9e('0x75')]){_0x2871c1[_0x0a9e('0x75')]=JSON['parse'](_0x2871c1[_0x0a9e('0x75')]);for(var _0x23e2bd=0x0;_0x23e2bd<_0x2871c1[_0x0a9e('0x75')][_0x0a9e('0x34')];_0x23e2bd+=0x1){if(_0x2871c1[_0x0a9e('0x75')][_0x23e2bd]['type']&&_[_0x0a9e('0x85')](_0x45108c,_0x2871c1[_0x0a9e('0x75')][_0x23e2bd]['type'])&&_0x2871c1[_0x0a9e('0x75')][_0x23e2bd]['parentKey']&&_0x2871c1[_0x0a9e('0x75')][_0x23e2bd][_0x0a9e('0x78')]&&_0x2871c1[_0x0a9e('0x75')][_0x23e2bd][_0x0a9e('0x79')]){_0x3a1974[_0x2871c1['joins'][_0x23e2bd][_0x0a9e('0x3c')]](_0x2871c1['joins'][_0x23e2bd][_0x0a9e('0x78')],null,util[_0x0a9e('0x71')]('%s.%s\x20=\x20%s.%s',_0x2871c1[_0x0a9e('0x6c')],_0x2871c1[_0x0a9e('0x75')][_0x23e2bd][_0x0a9e('0x77')],_0x2871c1['joins'][_0x23e2bd]['foreignTable'],_0x2871c1[_0x0a9e('0x75')][_0x23e2bd][_0x0a9e('0x79')]));}}}if(_0x2871c1[_0x0a9e('0x7b')]){_0x2871c1[_0x0a9e('0x7b')]=JSON[_0x0a9e('0x76')](_0x2871c1[_0x0a9e('0x7b')]);_0x3a1974[_0x0a9e('0x38')](_0x51ccd7(_0x2871c1[_0x0a9e('0x7b')][_0x0a9e('0x61')]));}_0x50f8d7=_0x3a1974['clone']();_0x3a1974[_0x0a9e('0x1b')](_0x4c54fa);_0x3a1974['offset'](0x0);return;}})[_0x0a9e('0x21')](function(){if(_0x56d650[_0x0a9e('0x8a')]===_0x0a9e('0x8b')){return null;}var _0x28ce92=_[_0x0a9e('0x3e')](_0x56d650,{'name':_0x56d650['fullPath']||_0x56d650[_0x0a9e('0x26')]||_0x2871c1[_0x0a9e('0x26')],'basename':_0x7ebea8,'savename':util[_0x0a9e('0x71')](_0x0a9e('0x8c'),_0x56d650[_0x0a9e('0x26')]||_0x2871c1['name'],require('randomstring')[_0x0a9e('0x8d')](0x4),_0x56d650['output']||_0x0a9e('0x8e')),'reportId':_0x2871c1['id'],'reportType':_0x0a9e('0x8f')});return db[_0x0a9e('0x90')][_0x0a9e('0x48')](_0x28ce92,{'raw':!![]});})[_0x0a9e('0x21')](function(_0x213e5d){if(_0x2871c1['table']==='cdr'){_0x50f8d7[_0x0a9e('0x38')](_0x2871c1['table']+_0x0a9e('0x91'),_0x56d650['startDate'],_0x56d650[_0x0a9e('0x92')]);}else{_0x50f8d7['where'](_0x2871c1['table']+_0x0a9e('0x93'),_0x56d650[_0x0a9e('0x94')],_0x56d650['endDate']);}if(_0x213e5d){logger[_0x0a9e('0x95')](_0x0a9e('0x96'),_0x50f8d7[_0x0a9e('0x7f')]());require(_0x0a9e('0x97'))[_0x0a9e('0x98')](path['join'](__dirname,'../../components/export/',_0x213e5d[_0x0a9e('0x8a')]),[_0x213e5d['id'],_0x50f8d7[_0x0a9e('0x7f')](),path[_0x0a9e('0x50')](__dirname,_0x0a9e('0x99'),_0x213e5d[_0x0a9e('0x9a')]),_0x7ebea8]);return _0x213e5d;}else{var _0x576d3b=squel[_0x0a9e('0x6a')]();_0x576d3b[_0x0a9e('0x6b')]('('+_0x50f8d7['toString']()+')',_0x0a9e('0x9b'));_0x576d3b[_0x0a9e('0x62')](_0x0a9e('0x9c'),_0x0a9e('0x1c'));_0x50f8d7[_0x0a9e('0x1b')](_0x56d650[_0x0a9e('0x1b')]||_0x4c54fa);_0x50f8d7[_0x0a9e('0x1a')](_0x56d650[_0x0a9e('0x1a')]||0x0);return dbH[_0x0a9e('0x80')][_0x0a9e('0x2e')](_0x576d3b['toString'](),{'type':dbH[_0x0a9e('0x80')][_0x0a9e('0x9d')][_0x0a9e('0x81')]})[_0x0a9e('0x21')](function(_0x1d0b02){if(!_0x1d0b02['length']){_0x4566b0=0x0;}else{_0x4566b0=_0x1d0b02[0x0]['count']||0x0;}return dbH[_0x0a9e('0x80')][_0x0a9e('0x2e')](_0x50f8d7[_0x0a9e('0x7f')](),{'type':dbH[_0x0a9e('0x80')][_0x0a9e('0x9d')]['SELECT']});})[_0x0a9e('0x21')](function(_0x3c775a){return{'rows':_0x3c775a||[],'count':_0x4566b0};});}});}exports[_0x0a9e('0x9e')]=function(_0x52b661,_0x318fc3){return runReport(_0x52b661['params'],_0x52b661[_0x0a9e('0x2e')],_0x52b661['options'])[_0x0a9e('0x21')](respondWithResult(_0x318fc3,null))[_0x0a9e('0x44')](handleError(_0x318fc3,null));};exports[_0x0a9e('0x9f')]=runReport;exports['query']=function(_0xc9529d,_0x5ed560){var _0x4383da=0xa;var _0x2b1824=[_0x0a9e('0x50'),_0x0a9e('0x51'),_0x0a9e('0x52'),_0x0a9e('0x53')];var _0x4014c7={'SUM':_0x0a9e('0x54'),'COUNT':_0x0a9e('0x55'),'COUNT DISTINCT':_0x0a9e('0x56'),'MAX':_0x0a9e('0x82'),'MIN':_0x0a9e('0x57'),'AVG':_0x0a9e('0x58'),'GROUP_CONCAT':_0x0a9e('0x59'),'GROUP_CONCAT ASC':_0x0a9e('0x5a'),'GROUP_CONCAT DESC':_0x0a9e('0x5b')};var _0x5b93dd={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x0a9e('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0x0a9e('0x84'),'UNIX_TIMESTAMP':_0x0a9e('0x5e')};var _0x5d6b69=function(_0x1a3754){return!_[_0x0a9e('0x85')]([_0x0a9e('0x86'),_0x0a9e('0x87'),'IS\x20EMPTY',_0x0a9e('0xa0')],_0x1a3754);};var _0x26cb76=function(_0x374f0b){if(!_0x374f0b||!_0x374f0b[_0x0a9e('0x60')]['length']){return'';}for(var _0x19e9ed='(',_0x1a0b08=0x0;_0x1a0b08<_0x374f0b[_0x0a9e('0x60')]['length'];_0x1a0b08+=0x1){_0x1a0b08>0x0&&(_0x19e9ed+='\x20'+_0x374f0b[_0x0a9e('0xa1')]+'\x20');_0x19e9ed+=_0x374f0b[_0x0a9e('0x60')][_0x1a0b08][_0x0a9e('0x61')]?_0x26cb76(_0x374f0b['rules'][_0x1a0b08][_0x0a9e('0x61')]):_0x374f0b[_0x0a9e('0x60')][_0x1a0b08][_0x0a9e('0x62')]+'\x20'+_0x374f0b[_0x0a9e('0x60')][_0x1a0b08][_0x0a9e('0x63')]+(_0x5d6b69(_0x374f0b['rules'][_0x1a0b08][_0x0a9e('0x63')])?'\x20'+_0x374f0b[_0x0a9e('0x60')][_0x1a0b08]['value']:'');}return _0x19e9ed+')';};var _0x3bab3e={'where':{'id':_0xc9529d[_0x0a9e('0x46')]['id']}},_0x1fcfe6,_0x1f6f1c,_0x5822a7,_0x5c3b6f,_0x523d08;_0x3bab3e=_[_0x0a9e('0x3e')]({},_0x3bab3e,_0xc9529d['options']);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x3bab3e)[_0x0a9e('0x21')](function(_0x54ce11){if(_0x54ce11){_0x1fcfe6=_0x54ce11;return _0x54ce11[_0x0a9e('0x64')]();}return null;})[_0x0a9e('0x21')](function(_0x213d4e){if(_0x213d4e){if(!_0x213d4e[_0x0a9e('0x34')]){throw new db[(_0x0a9e('0x65'))][(_0x0a9e('0x66'))](_0x0a9e('0x67'),0x193);}_0x1f6f1c=_0x213d4e;return db[_0x0a9e('0x68')][_0x0a9e('0x42')]({'raw':!![]});}return null;})['then'](function(_0x43c397){if(_0x43c397){_0x5822a7=_['keyBy'](_0x43c397,'id');var _0x138cf5;var _0x4093e6=squel[_0x0a9e('0x6a')]();_0x4093e6[_0x0a9e('0x6b')](_0x1fcfe6[_0x0a9e('0x6c')]);for(var _0x344cd4=0x0;_0x344cd4<_0x1f6f1c['length'];_0x344cd4+=0x1){_0x138cf5=_0x1f6f1c[_0x344cd4][_0x0a9e('0x6d')]?_0x5822a7[_0x1f6f1c[_0x344cd4][_0x0a9e('0x6d')]][_0x0a9e('0x6e')]:_0x1f6f1c[_0x344cd4][_0x0a9e('0x62')];_0x138cf5=_0x1f6f1c[_0x344cd4]['function']?_[_0x0a9e('0x70')](_0x4014c7[_0x1f6f1c[_0x344cd4][_0x0a9e('0x6f')]],'%s',_0x138cf5):_0x138cf5;_0x138cf5=_0x1f6f1c[_0x344cd4][_0x0a9e('0x71')]?_[_0x0a9e('0x70')](_0x5b93dd[_0x1f6f1c[_0x344cd4][_0x0a9e('0x71')]],'%s',_0x138cf5):_0x138cf5;if(_0x1f6f1c[_0x344cd4][_0x0a9e('0x72')]){_0x4093e6[_0x0a9e('0x61')](_0x138cf5);}_0x1f6f1c[_0x344cd4][_0x0a9e('0x89')]&&_0x4093e6[_0x0a9e('0x36')](_0x138cf5,_0x1f6f1c[_0x344cd4][_0x0a9e('0x89')]==='DESC'?![]:!![]);_0x4093e6[_0x0a9e('0x62')](_0x138cf5,_0x1f6f1c[_0x344cd4][_0x0a9e('0x74')]||_0x138cf5);}if(_0x1fcfe6[_0x0a9e('0x75')]){_0x1fcfe6[_0x0a9e('0x75')]=JSON[_0x0a9e('0x76')](_0x1fcfe6[_0x0a9e('0x75')]);for(var _0x2895c5=0x0;_0x2895c5<_0x1fcfe6[_0x0a9e('0x75')]['length'];_0x2895c5+=0x1){if(_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5][_0x0a9e('0x3c')]&&_[_0x0a9e('0x85')](_0x2b1824,_0x1fcfe6['joins'][_0x2895c5][_0x0a9e('0x3c')])&&_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5][_0x0a9e('0x77')]&&_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5][_0x0a9e('0x78')]&&_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5][_0x0a9e('0x79')]){_0x4093e6[_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5][_0x0a9e('0x3c')]](_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5]['foreignTable'],null,util[_0x0a9e('0x71')](_0x0a9e('0x7a'),_0x1fcfe6[_0x0a9e('0x6c')],_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5][_0x0a9e('0x77')],_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5]['foreignTable'],_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5]['foreignKey']));}}}if(_0x1fcfe6['conditions']){_0x1fcfe6['conditions']=JSON[_0x0a9e('0x76')](_0x1fcfe6[_0x0a9e('0x7b')]);_0x4093e6[_0x0a9e('0x38')](_0x26cb76(_0x1fcfe6[_0x0a9e('0x7b')]['group']));}_0x523d08=_0x4093e6[_0x0a9e('0x7c')]();_0x4093e6[_0x0a9e('0x1b')](_0x4383da);_0x4093e6[_0x0a9e('0x1a')](0x0);logger[_0x0a9e('0x7d')](_0x0a9e('0x7e'),_0x4093e6['toString']());return dbH['sequelize'][_0x0a9e('0x2e')](_0x4093e6[_0x0a9e('0x7f')](),{'type':dbH[_0x0a9e('0x80')]['QueryTypes'][_0x0a9e('0x81')]});}})[_0x0a9e('0x21')](function(){return{'sql':_0x523d08[_0x0a9e('0x7f')]()};})['then'](respondWithResult(_0x5ed560,null))[_0x0a9e('0x44')](handleError(_0x5ed560,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index b0f6dcb..cd6d1dc 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 _0x679e=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','lodash'];(function(_0x26870c,_0x3cac7a){var _0x405c30=function(_0x2a404f){while(--_0x2a404f){_0x26870c['push'](_0x26870c['shift']());}};_0x405c30(++_0x3cac7a);}(_0x679e,0xe9));var _0xe679=function(_0x423783,_0x2be155){_0x423783=_0x423783-0x0;var _0x1b6440=_0x679e[_0x423783];return _0x1b6440;};'use strict';var _=require(_0xe679('0x0'));var util=require(_0xe679('0x1'));var logger=require(_0xe679('0x2'))(_0xe679('0x3'));var moment=require(_0xe679('0x4'));var BPromise=require(_0xe679('0x5'));var rp=require(_0xe679('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe679('0x7'));var config=require(_0xe679('0x8'));var attributes=require(_0xe679('0x9'));module[_0xe679('0xa')]=function(_0x2c5b33,_0x1af617){return _0x2c5b33['define'](_0xe679('0xb'),attributes,{'tableName':_0xe679('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fc5=['exports','analytics_custom_reports','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0xcbe0a2,_0x3bcec3){var _0x2da492=function(_0x5ad278){while(--_0x5ad278){_0xcbe0a2['push'](_0xcbe0a2['shift']());}};_0x2da492(++_0x3bcec3);}(_0x9fc5,0x16a));var _0x59fc=function(_0x28b0a4,_0x2ea758){_0x28b0a4=_0x28b0a4-0x0;var _0x105ce6=_0x9fc5[_0x28b0a4];return _0x105ce6;};'use strict';var _=require('lodash');var util=require(_0x59fc('0x0'));var logger=require(_0x59fc('0x1'))(_0x59fc('0x2'));var moment=require(_0x59fc('0x3'));var BPromise=require(_0x59fc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x59fc('0x5'));var config=require(_0x59fc('0x6'));var attributes=require('./analyticCustomReport.attributes');module[_0x59fc('0x7')]=function(_0x351355,_0x1fbb93){return _0x351355['define']('AnalyticCustomReport',attributes,{'tableName':_0x59fc('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 2bde07f..e7debf5 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 _0xcd34=['request','then','request\x20sent','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xcd34,0x83));var _0x4cd3=function(_0x12fc29,_0x4313a2){_0x12fc29=_0x12fc29-0x0;var _0x23048f=_0xcd34[_0x12fc29];return _0x23048f;};'use strict';var _=require(_0x4cd3('0x0'));var util=require('util');var moment=require(_0x4cd3('0x1'));var BPromise=require(_0x4cd3('0x2'));var rs=require(_0x4cd3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4cd3('0x4'))(_0x4cd3('0x5'));var config=require('../../config/environment');var jayson=require(_0x4cd3('0x6'));var client=jayson[_0x4cd3('0x7')][_0x4cd3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e698d,_0xc949ab,_0x5708a5){return new BPromise(function(_0x3fd606,_0x898874){return client[_0x4cd3('0x9')](_0x2e698d,_0x5708a5)[_0x4cd3('0xa')](function(_0x1dfd10){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0xc949ab,_0x4cd3('0xb'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0xc949ab,_0x4cd3('0xb'),JSON[_0x4cd3('0xc')](_0x1dfd10));if(_0x1dfd10[_0x4cd3('0xd')]){if(_0x1dfd10['error'][_0x4cd3('0xe')]===0x1f4){logger['error'](_0x4cd3('0xf'),_0xc949ab,_0x1dfd10['error'][_0x4cd3('0x10')]);return _0x898874(_0x1dfd10[_0x4cd3('0xd')][_0x4cd3('0x10')]);}logger[_0x4cd3('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0xc949ab,_0x1dfd10[_0x4cd3('0xd')][_0x4cd3('0x10')]);return _0x3fd606(_0x1dfd10[_0x4cd3('0xd')][_0x4cd3('0x10')]);}else{logger[_0x4cd3('0x11')](_0x4cd3('0xf'),_0xc949ab,_0x4cd3('0xb'));_0x3fd606(_0x1dfd10[_0x4cd3('0x12')][_0x4cd3('0x10')]);}})[_0x4cd3('0x13')](function(_0x593389){logger[_0x4cd3('0xd')](_0x4cd3('0xf'),_0xc949ab,_0x593389);_0x898874(_0x593389);});});} \ No newline at end of file +var _0x5897=['result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x492af5,_0xd51471){var _0x59f529=function(_0x40c9aa){while(--_0x40c9aa){_0x492af5['push'](_0x492af5['shift']());}};_0x59f529(++_0xd51471);}(_0x5897,0x12e));var _0x7589=function(_0x5b26cb,_0x527ab0){_0x5b26cb=_0x5b26cb-0x0;var _0x563d12=_0x5897[_0x5b26cb];return _0x563d12;};'use strict';var _=require(_0x7589('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7589('0x1'));var rs=require(_0x7589('0x2'));var fs=require('fs');var Redis=require(_0x7589('0x3'));var db=require(_0x7589('0x4'))['db'];var utils=require(_0x7589('0x5'));var logger=require(_0x7589('0x6'))('rpc');var config=require(_0x7589('0x7'));var jayson=require(_0x7589('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x29450a,_0x1e8c94,_0x39980c){return new BPromise(function(_0x24e638,_0x588c40){return client[_0x7589('0x9')](_0x29450a,_0x39980c)[_0x7589('0xa')](function(_0x3275b9){logger[_0x7589('0xb')](_0x7589('0xc'),_0x1e8c94,_0x7589('0xd'));logger[_0x7589('0xe')](_0x7589('0xf'),_0x1e8c94,_0x7589('0xd'),JSON['stringify'](_0x3275b9));if(_0x3275b9[_0x7589('0x10')]){if(_0x3275b9[_0x7589('0x10')]['code']===0x1f4){logger[_0x7589('0x10')](_0x7589('0xc'),_0x1e8c94,_0x3275b9[_0x7589('0x10')]['message']);return _0x588c40(_0x3275b9[_0x7589('0x10')][_0x7589('0x11')]);}logger[_0x7589('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1e8c94,_0x3275b9[_0x7589('0x10')]['message']);return _0x24e638(_0x3275b9[_0x7589('0x10')]['message']);}else{logger[_0x7589('0xb')](_0x7589('0xc'),_0x1e8c94,_0x7589('0xd'));_0x24e638(_0x3275b9[_0x7589('0x12')][_0x7589('0x11')]);}})[_0x7589('0x13')](function(_0x1957ea){logger['error'](_0x7589('0xc'),_0x1e8c94,_0x1957ea);_0x588c40(_0x1957ea);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index ddb8443..bf0d8e1 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 _0x91b6=['/:id/preview','preview','/:id/run','run','/:id/query','post','/:id','update','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','show'];(function(_0x3114aa,_0x502617){var _0x35656a=function(_0x34f05b){while(--_0x34f05b){_0x3114aa['push'](_0x3114aa['shift']());}};_0x35656a(++_0x502617);}(_0x91b6,0x77));var _0x691b=function(_0x3e5147,_0x33eef9){_0x3e5147=_0x3e5147-0x0;var _0x18c779=_0x91b6[_0x3e5147];return _0x18c779;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x691b('0x0'));var timeout=require(_0x691b('0x1'));var express=require(_0x691b('0x2'));var router=express[_0x691b('0x3')]();var fs_extra=require(_0x691b('0x4'));var auth=require(_0x691b('0x5'));var interaction=require(_0x691b('0x6'));var config=require(_0x691b('0x7'));var controller=require(_0x691b('0x8'));router['get']('/',auth[_0x691b('0x9')](),controller[_0x691b('0xa')]);router[_0x691b('0xb')]('/:id',auth[_0x691b('0x9')](),controller[_0x691b('0xc')]);router[_0x691b('0xb')](_0x691b('0xd'),auth[_0x691b('0x9')](),controller[_0x691b('0xe')]);router['get'](_0x691b('0xf'),auth[_0x691b('0x9')](),controller[_0x691b('0x10')]);router[_0x691b('0xb')](_0x691b('0x11'),auth[_0x691b('0x9')](),controller['query']);router[_0x691b('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x691b('0x13'),auth[_0x691b('0x9')](),controller[_0x691b('0x14')]);router['delete'](_0x691b('0x13'),auth[_0x691b('0x9')](),controller['destroy']);module[_0x691b('0x15')]=router; \ No newline at end of file +var _0x3274=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','/:id','get','/:id/preview','preview','/:id/run','query','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0xe30506,_0x153809){var _0x21bba9=function(_0x5929bb){while(--_0x5929bb){_0xe30506['push'](_0xe30506['shift']());}};_0x21bba9(++_0x153809);}(_0x3274,0x134));var _0x4327=function(_0x20b242,_0x497d0c){_0x20b242=_0x20b242-0x0;var _0x4bb6c5=_0x3274[_0x20b242];return _0x4bb6c5;};'use strict';var multer=require(_0x4327('0x0'));var util=require('util');var path=require(_0x4327('0x1'));var timeout=require(_0x4327('0x2'));var express=require('express');var router=express[_0x4327('0x3')]();var fs_extra=require(_0x4327('0x4'));var auth=require(_0x4327('0x5'));var interaction=require(_0x4327('0x6'));var config=require(_0x4327('0x7'));var controller=require(_0x4327('0x8'));router['get']('/',auth[_0x4327('0x9')](),controller[_0x4327('0xa')]);router['get'](_0x4327('0xb'),auth[_0x4327('0x9')](),controller['show']);router[_0x4327('0xc')](_0x4327('0xd'),auth['isAuthenticated'](),controller[_0x4327('0xe')]);router['get'](_0x4327('0xf'),auth[_0x4327('0x9')](),controller['run']);router[_0x4327('0xc')]('/:id/query',auth[_0x4327('0x9')](),controller[_0x4327('0x10')]);router[_0x4327('0x11')]('/',auth['isAuthenticated'](),controller[_0x4327('0x12')]);router[_0x4327('0x13')](_0x4327('0xb'),auth['isAuthenticated'](),controller[_0x4327('0x14')]);router[_0x4327('0x15')](_0x4327('0xb'),auth['isAuthenticated'](),controller[_0x4327('0x16')]);module[_0x4327('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 6f204bf..1d82319 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 _0xba7e=['exports','STRING','TEXT','sequelize'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xba7e,0x15b));var _0xeba7=function(_0x57d4c4,_0x1eb1c7){_0x57d4c4=_0x57d4c4-0x0;var _0x551561=_0xba7e[_0x57d4c4];return _0x551561;};'use strict';var Sequelize=require(_0xeba7('0x0'));module[_0xeba7('0x1')]={'name':{'type':Sequelize[_0xeba7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeba7('0x2')]},'parent':{'type':Sequelize[_0xeba7('0x2')]},'table':{'type':Sequelize[_0xeba7('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xeba7('0x3')]}}; \ No newline at end of file +var _0xfb6f=['exports','STRING','TEXT'];(function(_0x279150,_0x1bc284){var _0x10dd1f=function(_0x52509c){while(--_0x52509c){_0x279150['push'](_0x279150['shift']());}};_0x10dd1f(++_0x1bc284);}(_0xfb6f,0x1a4));var _0xffb6=function(_0x34499c,_0x3dd55a){_0x34499c=_0x34499c-0x0;var _0x495f15=_0xfb6f[_0x34499c];return _0x495f15;};'use strict';var Sequelize=require('sequelize');module[_0xffb6('0x0')]={'name':{'type':Sequelize[_0xffb6('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xffb6('0x1')]},'parent':{'type':Sequelize[_0xffb6('0x1')]},'table':{'type':Sequelize[_0xffb6('0x1')]},'conditions':{'type':Sequelize[_0xffb6('0x2')]},'joins':{'type':Sequelize[_0xffb6('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 61b813f..840676f 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 _0x62b0=['rules','operator','group','field','condition','value','getFields','Sequelize','AnalyticMetric','keyBy','select','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','toString','sequelize','QueryTypes','MIN(%s)','GROUP_CONCAT(%s)','IS\x20NOT\x20NULL','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','from','parentKey','fullPath','%s-%s.%s','generate','output','csv','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','debug','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','get','DefaultReports','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','keys','length','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x62b0,0x17d));var _0x062b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x62b0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x062b('0x0'));var rimraf=require(_0x062b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x062b('0x2'));var moment=require('moment');var BPromise=require(_0x062b('0x3'));var Mustache=require(_0x062b('0x4'));var util=require(_0x062b('0x5'));var path=require(_0x062b('0x6'));var sox=require(_0x062b('0x7'));var csv=require('to-csv');var ejs=require(_0x062b('0x8'));var fs=require('fs');var fs_extra=require(_0x062b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x062b('0xa'));var deskjs=require(_0x062b('0xb'));var toCsv=require(_0x062b('0xc'));var querystring=require(_0x062b('0xd'));var Papa=require('papaparse');var Redis=require(_0x062b('0xe'));var authService=require(_0x062b('0xf'));var qs=require(_0x062b('0x10'));var as=require(_0x062b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x062b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x062b('0x13'));var licenseUtil=require(_0x062b('0x14'));var db=require(_0x062b('0x15'))['db'];var dbH=require(_0x062b('0x15'))[_0x062b('0x16')];function respondWithStatusCode(_0xf92854,_0x5b96fa){_0x5b96fa=_0x5b96fa||0xcc;return function(_0x158ff6){if(_0x158ff6){return _0xf92854['sendStatus'](_0x5b96fa);}return _0xf92854[_0x062b('0x17')](_0x5b96fa)[_0x062b('0x18')]();};}function respondWithResult(_0x25077b,_0xc1f395){_0xc1f395=_0xc1f395||0xc8;return function(_0x4deb69){if(_0x4deb69){return _0x25077b[_0x062b('0x17')](_0xc1f395)[_0x062b('0x19')](_0x4deb69);}};}function respondWithFilteredResult(_0x55550d,_0xdb6192){return function(_0x9522fa){if(_0x9522fa){var _0x1b0a3f=typeof _0xdb6192[_0x062b('0x1a')]===_0x062b('0x1b')&&typeof _0xdb6192[_0x062b('0x1c')]==='undefined';var _0x26915a=_0x9522fa[_0x062b('0x1d')];var _0x48f3a2=_0x1b0a3f?0x0:_0xdb6192[_0x062b('0x1a')];var _0x1c3d4e=_0x1b0a3f?_0x9522fa['count']:_0xdb6192[_0x062b('0x1a')]+_0xdb6192[_0x062b('0x1c')];var _0x371fcc;if(_0x1c3d4e>=_0x26915a){_0x1c3d4e=_0x26915a;_0x371fcc=0xc8;}else{_0x371fcc=0xce;}_0x55550d['status'](_0x371fcc);return _0x55550d[_0x062b('0x1e')](_0x062b('0x1f'),_0x48f3a2+'-'+_0x1c3d4e+'/'+_0x26915a)[_0x062b('0x19')](_0x9522fa);}return null;};}function patchUpdates(_0x5a35ca){return function(_0x45fef7){try{jsonpatch[_0x062b('0x20')](_0x45fef7,_0x5a35ca,!![]);}catch(_0x4b474d){return BPromise[_0x062b('0x21')](_0x4b474d);}return _0x45fef7['save']();};}function saveUpdates(_0x209bbe,_0x474155){return function(_0x58fdf){if(_0x58fdf){return _0x58fdf[_0x062b('0x22')](_0x209bbe)['then'](function(_0x31809a){return _0x31809a;});}return null;};}function removeEntity(_0x39b268,_0x2dc030){return function(_0x4b7998){if(_0x4b7998){return _0x4b7998[_0x062b('0x23')]()[_0x062b('0x24')](function(){var _0x31ae88=_0x4b7998[_0x062b('0x25')]({'plain':!![]});var _0x207008=_0x062b('0x26');return db['UserProfileResource'][_0x062b('0x23')]({'where':{'type':_0x207008,'resourceId':_0x31ae88['id']}})[_0x062b('0x24')](function(){return _0x4b7998;});})[_0x062b('0x24')](function(){_0x39b268['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23ab0f,_0x4093a6){return function(_0x54a66a){if(!_0x54a66a){_0x23ab0f[_0x062b('0x27')](0x194);}return _0x54a66a;};}function handleError(_0x3e750c,_0x3d2b17){_0x3d2b17=_0x3d2b17||0x1f4;return function(_0x458b3e){logger[_0x062b('0x28')](_0x458b3e[_0x062b('0x29')]);if(_0x458b3e[_0x062b('0x2a')]){delete _0x458b3e[_0x062b('0x2a')];}_0x3e750c[_0x062b('0x17')](_0x3d2b17)[_0x062b('0x2b')](_0x458b3e);};}exports[_0x062b('0x2c')]=function(_0x250ff4,_0x5804fc){var _0x363ffb={},_0xdd17ca={},_0x100a42={'count':0x0,'rows':[]};var _0x44609f=_[_0x062b('0x2d')](db[_0x062b('0x2e')][_0x062b('0x2f')],function(_0xf2148c){return{'name':_0xf2148c['fieldName'],'type':_0xf2148c[_0x062b('0x30')][_0x062b('0x31')]};});_0xdd17ca[_0x062b('0x32')]=_[_0x062b('0x2d')](_0x44609f,_0x062b('0x2a'));_0xdd17ca[_0x062b('0x33')]=_['keys'](_0x250ff4['query']);_0xdd17ca[_0x062b('0x34')]=_[_0x062b('0x35')](_0xdd17ca[_0x062b('0x32')],_0xdd17ca['query']);_0x363ffb['attributes']=_['intersection'](_0xdd17ca['model'],qs['fields'](_0x250ff4[_0x062b('0x33')][_0x062b('0x36')]));_0x363ffb['attributes']=_0x363ffb[_0x062b('0x37')]['length']?_0x363ffb[_0x062b('0x37')]:_0xdd17ca['model'];if(!_0x250ff4[_0x062b('0x33')][_0x062b('0x38')](_0x062b('0x39'))){_0x363ffb[_0x062b('0x1c')]=qs[_0x062b('0x1c')](_0x250ff4[_0x062b('0x33')][_0x062b('0x1c')]);_0x363ffb[_0x062b('0x1a')]=qs[_0x062b('0x1a')](_0x250ff4[_0x062b('0x33')][_0x062b('0x1a')]);}_0x363ffb[_0x062b('0x3a')]=qs['sort'](_0x250ff4['query'][_0x062b('0x3b')]);_0x363ffb[_0x062b('0x3c')]=qs[_0x062b('0x34')](_[_0x062b('0x3d')](_0x250ff4['query'],_0xdd17ca[_0x062b('0x34')]),_0x44609f);if(_0x250ff4[_0x062b('0x33')]['filter']){_0x363ffb['where']=_['merge'](_0x363ffb[_0x062b('0x3c')],{'$or':_[_0x062b('0x2d')](_0x44609f,function(_0x172b0e){if(_0x172b0e[_0x062b('0x30')]!==_0x062b('0x3e')){var _0x20a565={};_0x20a565[_0x172b0e[_0x062b('0x2a')]]={'$like':'%'+_0x250ff4['query'][_0x062b('0x3f')]+'%'};return _0x20a565;}})});}_0x363ffb=_[_0x062b('0x40')]({},_0x363ffb,_0x250ff4[_0x062b('0x41')]);var _0x153ad9={'where':_0x363ffb[_0x062b('0x3c')]};return db['AnalyticDefaultReport'][_0x062b('0x1d')](_0x153ad9)[_0x062b('0x24')](function(_0x1d6dad){_0x100a42[_0x062b('0x1d')]=_0x1d6dad;if(_0x250ff4[_0x062b('0x33')][_0x062b('0x42')]){_0x363ffb['include']=[{'all':!![]}];}return db[_0x062b('0x2e')][_0x062b('0x43')](_0x363ffb);})[_0x062b('0x24')](function(_0x45514e){_0x100a42[_0x062b('0x44')]=_0x45514e;return _0x100a42;})[_0x062b('0x24')](respondWithFilteredResult(_0x5804fc,_0x363ffb))['catch'](handleError(_0x5804fc,null));};exports[_0x062b('0x45')]=function(_0x2aeab3,_0x2b8dce){var _0x2276d2={'raw':!![],'where':{'id':_0x2aeab3['params']['id']}},_0x134527={};_0x134527[_0x062b('0x32')]=_[_0x062b('0x46')](db['AnalyticDefaultReport']['rawAttributes']);_0x134527['query']=_[_0x062b('0x46')](_0x2aeab3[_0x062b('0x33')]);_0x134527[_0x062b('0x34')]=_[_0x062b('0x35')](_0x134527[_0x062b('0x32')],_0x134527[_0x062b('0x33')]);_0x2276d2[_0x062b('0x37')]=_[_0x062b('0x35')](_0x134527[_0x062b('0x32')],qs[_0x062b('0x36')](_0x2aeab3[_0x062b('0x33')][_0x062b('0x36')]));_0x2276d2[_0x062b('0x37')]=_0x2276d2[_0x062b('0x37')][_0x062b('0x47')]?_0x2276d2[_0x062b('0x37')]:_0x134527[_0x062b('0x32')];if(_0x2aeab3[_0x062b('0x33')]['includeAll']){_0x2276d2[_0x062b('0x48')]=[{'all':!![]}];}_0x2276d2=_[_0x062b('0x40')]({},_0x2276d2,_0x2aeab3[_0x062b('0x41')]);return db['AnalyticDefaultReport'][_0x062b('0x49')](_0x2276d2)['then'](handleEntityNotFound(_0x2b8dce,null))['then'](respondWithResult(_0x2b8dce,null))[_0x062b('0x4a')](handleError(_0x2b8dce,null));};exports[_0x062b('0x4b')]=function(_0x489699,_0x2a6c8c){return db[_0x062b('0x2e')][_0x062b('0x4b')](_0x489699[_0x062b('0x4c')],{})['then'](function(_0xc7bcb8){var _0x3addf7=_0x489699['user'][_0x062b('0x25')]({'plain':!![]});if(!_0x3addf7)throw new Error(_0x062b('0x4d'));if(_0x3addf7[_0x062b('0x4e')]===_0x062b('0x4f')){var _0x2df24e=_0xc7bcb8[_0x062b('0x25')]({'plain':!![]});var _0xce2a05=_0x062b('0x50');return db['UserProfileSection']['find']({'where':{'name':_0xce2a05,'userProfileId':_0x3addf7[_0x062b('0x51')]},'raw':!![]})['then'](function(_0x335e14){if(_0x335e14&&_0x335e14['autoAssociation']===0x0){return db['UserProfileResource'][_0x062b('0x4b')]({'name':_0x2df24e[_0x062b('0x2a')],'resourceId':_0x2df24e['id'],'type':_0x062b('0x26'),'sectionId':_0x335e14['id']},{})[_0x062b('0x24')](function(){return _0xc7bcb8;});}else{return _0xc7bcb8;}})[_0x062b('0x4a')](function(_0x69789b){logger[_0x062b('0x28')](_0x062b('0x52'),_0x69789b);throw _0x69789b;});}return _0xc7bcb8;})[_0x062b('0x24')](respondWithResult(_0x2a6c8c,0xc9))[_0x062b('0x4a')](handleError(_0x2a6c8c,null));};exports[_0x062b('0x22')]=function(_0x5d6cb4,_0x53c708){if(_0x5d6cb4[_0x062b('0x4c')]['id']){delete _0x5d6cb4['body']['id'];}return db['AnalyticDefaultReport'][_0x062b('0x49')]({'where':{'id':_0x5d6cb4[_0x062b('0x53')]['id']}})[_0x062b('0x24')](handleEntityNotFound(_0x53c708,null))['then'](saveUpdates(_0x5d6cb4[_0x062b('0x4c')],null))['then'](respondWithResult(_0x53c708,null))[_0x062b('0x4a')](handleError(_0x53c708,null));};exports[_0x062b('0x23')]=function(_0x12ceea,_0x4a529e){return db[_0x062b('0x2e')][_0x062b('0x49')]({'where':{'id':_0x12ceea[_0x062b('0x53')]['id']}})['then'](handleEntityNotFound(_0x4a529e,null))['then'](removeEntity(_0x4a529e,null))[_0x062b('0x4a')](handleError(_0x4a529e,null));};exports[_0x062b('0x54')]=function(_0x5176cf,_0x3439fd){var _0x4a2dbc=0xa;var _0x4d7bb7=[_0x062b('0x55'),_0x062b('0x56'),_0x062b('0x57'),_0x062b('0x58')];var _0x5ea46c={'SUM':_0x062b('0x59'),'COUNT':_0x062b('0x5a'),'COUNT DISTINCT':_0x062b('0x5b'),'MAX':_0x062b('0x5c'),'MIN':'MIN(%s)','AVG':_0x062b('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x062b('0x5e'),'GROUP_CONCAT DESC':_0x062b('0x5f')};var _0x4e4673={'SEC_TO_TIME':_0x062b('0x60'),'DATE':_0x062b('0x61'),'HOUR':_0x062b('0x62'),'ROUND':_0x062b('0x63'),'UNIX_TIMESTAMP':_0x062b('0x64')};var _0x115d39=function(_0x416a5f){return!_[_0x062b('0x65')]([_0x062b('0x66'),'IS\x20NOT\x20NULL',_0x062b('0x67'),_0x062b('0x68')],_0x416a5f);};var _0x568e29=function(_0x153a0f){if(!_0x153a0f||!_0x153a0f[_0x062b('0x69')]['length']){return'';}for(var _0x2a2b4='(',_0x8b62ed=0x0;_0x8b62ed<_0x153a0f[_0x062b('0x69')][_0x062b('0x47')];_0x8b62ed+=0x1){_0x8b62ed>0x0&&(_0x2a2b4+='\x20'+_0x153a0f[_0x062b('0x6a')]+'\x20');_0x2a2b4+=_0x153a0f[_0x062b('0x69')][_0x8b62ed]['group']?_0x568e29(_0x153a0f[_0x062b('0x69')][_0x8b62ed][_0x062b('0x6b')]):_0x153a0f[_0x062b('0x69')][_0x8b62ed][_0x062b('0x6c')]+'\x20'+_0x153a0f['rules'][_0x8b62ed][_0x062b('0x6d')]+(_0x115d39(_0x153a0f[_0x062b('0x69')][_0x8b62ed][_0x062b('0x6d')])?'\x20'+_0x153a0f[_0x062b('0x69')][_0x8b62ed][_0x062b('0x6e')]:'');}return _0x2a2b4+')';};var _0x30d2aa={'where':{'id':_0x5176cf[_0x062b('0x53')]['id']}},_0x3e1ba2,_0x93699a,_0x26a3db,_0x92fcb2,_0x3f284f;_0x30d2aa=_['merge']({},_0x30d2aa,_0x5176cf[_0x062b('0x41')]);return db['AnalyticDefaultReport']['find'](_0x30d2aa)[_0x062b('0x24')](function(_0x19c04f){if(_0x19c04f){_0x3e1ba2=_0x19c04f;return _0x19c04f[_0x062b('0x6f')]();}return null;})['then'](function(_0x2e99a3){if(_0x2e99a3){if(!_0x2e99a3[_0x062b('0x47')]){throw new db[(_0x062b('0x70'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x93699a=_0x2e99a3;return db[_0x062b('0x71')][_0x062b('0x43')]({'raw':!![]});}return null;})['then'](function(_0x24c3a2){if(_0x24c3a2){_0x26a3db=_[_0x062b('0x72')](_0x24c3a2,'id');var _0x1e9b89;var _0x18f845=squel[_0x062b('0x73')]();_0x18f845['from'](_0x3e1ba2[_0x062b('0x74')]);for(var _0x293eb3=0x0;_0x293eb3<_0x93699a['length'];_0x293eb3+=0x1){_0x1e9b89=_0x93699a[_0x293eb3][_0x062b('0x75')]?_0x26a3db[_0x93699a[_0x293eb3]['MetricId']][_0x062b('0x76')]:_0x93699a[_0x293eb3]['field'];_0x1e9b89=_0x93699a[_0x293eb3][_0x062b('0x77')]?_[_0x062b('0x78')](_0x5ea46c[_0x93699a[_0x293eb3][_0x062b('0x77')]],'%s',_0x1e9b89):_0x1e9b89;_0x1e9b89=_0x93699a[_0x293eb3][_0x062b('0x79')]?_[_0x062b('0x78')](_0x4e4673[_0x93699a[_0x293eb3][_0x062b('0x79')]],'%s',_0x1e9b89):_0x1e9b89;if(_0x93699a[_0x293eb3][_0x062b('0x7a')]){_0x18f845[_0x062b('0x6b')](_0x1e9b89);}_0x93699a[_0x293eb3][_0x062b('0x7b')]&&_0x18f845['order'](_0x1e9b89,_0x93699a[_0x293eb3]['orderBy']===_0x062b('0x7c')?![]:!![]);_0x18f845[_0x062b('0x6c')](_0x1e9b89,_0x93699a[_0x293eb3][_0x062b('0x7d')]||_0x1e9b89);}if(_0x3e1ba2[_0x062b('0x7e')]){_0x3e1ba2[_0x062b('0x7e')]=JSON[_0x062b('0x7f')](_0x3e1ba2[_0x062b('0x7e')]);for(var _0x599a37=0x0;_0x599a37<_0x3e1ba2[_0x062b('0x7e')]['length'];_0x599a37+=0x1){if(_0x3e1ba2['joins'][_0x599a37][_0x062b('0x30')]&&_[_0x062b('0x65')](_0x4d7bb7,_0x3e1ba2[_0x062b('0x7e')][_0x599a37][_0x062b('0x30')])&&_0x3e1ba2[_0x062b('0x7e')][_0x599a37]['parentKey']&&_0x3e1ba2[_0x062b('0x7e')][_0x599a37]['foreignTable']&&_0x3e1ba2[_0x062b('0x7e')][_0x599a37][_0x062b('0x80')]){_0x18f845[_0x3e1ba2[_0x062b('0x7e')][_0x599a37][_0x062b('0x30')]](_0x3e1ba2[_0x062b('0x7e')][_0x599a37][_0x062b('0x81')],null,util[_0x062b('0x79')](_0x062b('0x82'),_0x3e1ba2[_0x062b('0x74')],_0x3e1ba2[_0x062b('0x7e')][_0x599a37]['parentKey'],_0x3e1ba2[_0x062b('0x7e')][_0x599a37][_0x062b('0x81')],_0x3e1ba2[_0x062b('0x7e')][_0x599a37][_0x062b('0x80')]));}}}if(_0x3e1ba2['conditions']){_0x3e1ba2[_0x062b('0x83')]=JSON[_0x062b('0x7f')](_0x3e1ba2['conditions']);_0x18f845[_0x062b('0x3c')](_0x568e29(_0x3e1ba2[_0x062b('0x83')][_0x062b('0x6b')]));}_0x3f284f=_0x18f845[_0x062b('0x84')]();_0x18f845[_0x062b('0x1c')](_0x4a2dbc);_0x18f845[_0x062b('0x1a')](0x0);logger['debug']('Limited\x20Query:',_0x18f845[_0x062b('0x85')]());return dbH[_0x062b('0x86')][_0x062b('0x33')](_0x18f845[_0x062b('0x85')](),{'type':dbH[_0x062b('0x86')][_0x062b('0x87')]['SELECT']});}})[_0x062b('0x24')](respondWithResult(_0x3439fd,null))[_0x062b('0x4a')](handleError(_0x3439fd,null));};function runReport(_0x4ec969,_0x3005a3,_0x578a88){var _0x233372=_0x3005a3['name'];var _0x205a4a=0xa;var _0x55a56e=['join',_0x062b('0x56'),_0x062b('0x57'),_0x062b('0x58')];var _0x573769={'SUM':_0x062b('0x59'),'COUNT':_0x062b('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x062b('0x5c'),'MIN':_0x062b('0x88'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x062b('0x89'),'GROUP_CONCAT ASC':_0x062b('0x5e'),'GROUP_CONCAT DESC':_0x062b('0x5f')};var _0x459fd0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x062b('0x61'),'HOUR':_0x062b('0x62'),'ROUND':_0x062b('0x63'),'UNIX_TIMESTAMP':_0x062b('0x64')};var _0x3615b2=function(_0x1e0785){return!_[_0x062b('0x65')]([_0x062b('0x66'),_0x062b('0x8a'),_0x062b('0x67'),'IS\x20NOT\x20EMPTY'],_0x1e0785);};var _0x4d14dc=function(_0xfd0954){if(!_0xfd0954||!_0xfd0954[_0x062b('0x69')][_0x062b('0x47')]){return'';}for(var _0x428fbf='(',_0x13caf8=0x0;_0x13caf8<_0xfd0954[_0x062b('0x69')]['length'];_0x13caf8+=0x1){_0x13caf8>0x0&&(_0x428fbf+='\x20'+_0xfd0954[_0x062b('0x6a')]+'\x20');_0x428fbf+=_0xfd0954[_0x062b('0x69')][_0x13caf8][_0x062b('0x6b')]?_0x4d14dc(_0xfd0954[_0x062b('0x69')][_0x13caf8][_0x062b('0x6b')]):_0xfd0954['rules'][_0x13caf8][_0x062b('0x6c')]+'\x20'+_0xfd0954[_0x062b('0x69')][_0x13caf8]['condition']+(_0x3615b2(_0xfd0954[_0x062b('0x69')][_0x13caf8][_0x062b('0x6d')])?'\x20'+_0xfd0954['rules'][_0x13caf8][_0x062b('0x6e')]:'');}return _0x428fbf+')';};var _0x349584={'where':{'id':_0x4ec969['id']}},_0x5e7ad0,_0x40a584,_0x5e2667,_0x7d3fbb,_0x229153;_0x349584=_[_0x062b('0x40')]({},_0x349584,_0x578a88);return db[_0x062b('0x2e')][_0x062b('0x49')](_0x349584)['then'](function(_0x1773e2){if(_0x1773e2){_0x5e7ad0=_0x1773e2;return _0x1773e2['getFields']();}return null;})[_0x062b('0x24')](function(_0x2afc8d){if(_0x2afc8d){if(!_0x2afc8d[_0x062b('0x47')]){throw new db[(_0x062b('0x70'))][(_0x062b('0x8b'))](_0x062b('0x8c'),0x193);}_0x40a584=_0x2afc8d;return db[_0x062b('0x71')][_0x062b('0x43')]({'raw':!![]});}return null;})['then'](function(_0x48a5e7){if(_0x48a5e7){_0x5e2667=_[_0x062b('0x72')](_0x48a5e7,'id');var _0x212d87;var _0x3fb2a2=squel['select']();_0x3fb2a2[_0x062b('0x8d')](_0x5e7ad0[_0x062b('0x74')]);for(var _0x2f0042=0x0;_0x2f0042<_0x40a584[_0x062b('0x47')];_0x2f0042+=0x1){_0x212d87=_0x40a584[_0x2f0042][_0x062b('0x75')]?_0x5e2667[_0x40a584[_0x2f0042]['MetricId']]['metric']:_0x40a584[_0x2f0042][_0x062b('0x6c')];_0x212d87=_0x40a584[_0x2f0042][_0x062b('0x77')]?_[_0x062b('0x78')](_0x573769[_0x40a584[_0x2f0042][_0x062b('0x77')]],'%s',_0x212d87):_0x212d87;_0x212d87=_0x40a584[_0x2f0042][_0x062b('0x79')]?_['replace'](_0x459fd0[_0x40a584[_0x2f0042]['format']],'%s',_0x212d87):_0x212d87;if(_0x40a584[_0x2f0042]['groupBy']){_0x3fb2a2['group'](_0x212d87);}_0x40a584[_0x2f0042]['orderBy']&&_0x3fb2a2[_0x062b('0x3a')](_0x212d87,_0x40a584[_0x2f0042]['orderBy']===_0x062b('0x7c')?![]:!![]);_0x3fb2a2[_0x062b('0x6c')](_0x212d87,_0x40a584[_0x2f0042][_0x062b('0x7d')]||_0x212d87);}if(_0x5e7ad0[_0x062b('0x7e')]){_0x5e7ad0[_0x062b('0x7e')]=JSON[_0x062b('0x7f')](_0x5e7ad0[_0x062b('0x7e')]);for(var _0x5ef386=0x0;_0x5ef386<_0x5e7ad0[_0x062b('0x7e')][_0x062b('0x47')];_0x5ef386+=0x1){if(_0x5e7ad0['joins'][_0x5ef386][_0x062b('0x30')]&&_[_0x062b('0x65')](_0x55a56e,_0x5e7ad0[_0x062b('0x7e')][_0x5ef386][_0x062b('0x30')])&&_0x5e7ad0[_0x062b('0x7e')][_0x5ef386][_0x062b('0x8e')]&&_0x5e7ad0[_0x062b('0x7e')][_0x5ef386][_0x062b('0x81')]&&_0x5e7ad0[_0x062b('0x7e')][_0x5ef386][_0x062b('0x80')]){_0x3fb2a2[_0x5e7ad0[_0x062b('0x7e')][_0x5ef386][_0x062b('0x30')]](_0x5e7ad0['joins'][_0x5ef386][_0x062b('0x81')],null,util[_0x062b('0x79')]('%s.%s\x20=\x20%s.%s',_0x5e7ad0[_0x062b('0x74')],_0x5e7ad0[_0x062b('0x7e')][_0x5ef386][_0x062b('0x8e')],_0x5e7ad0[_0x062b('0x7e')][_0x5ef386][_0x062b('0x81')],_0x5e7ad0[_0x062b('0x7e')][_0x5ef386][_0x062b('0x80')]));}}}if(_0x5e7ad0[_0x062b('0x83')]){_0x5e7ad0['conditions']=JSON[_0x062b('0x7f')](_0x5e7ad0[_0x062b('0x83')]);_0x3fb2a2[_0x062b('0x3c')](_0x4d14dc(_0x5e7ad0[_0x062b('0x83')]['group']));}_0x229153=_0x3fb2a2[_0x062b('0x84')]();_0x3fb2a2[_0x062b('0x1c')](_0x205a4a);_0x3fb2a2[_0x062b('0x1a')](0x0);return;}})[_0x062b('0x24')](function(){if(_0x3005a3['output']==='web'){return null;}var _0x3b6527=_['merge'](_0x3005a3,{'name':_0x3005a3[_0x062b('0x8f')]||_0x3005a3[_0x062b('0x2a')]||_0x5e7ad0[_0x062b('0x2a')],'basename':_0x233372,'savename':util[_0x062b('0x79')](_0x062b('0x90'),_0x3005a3[_0x062b('0x2a')]||_0x5e7ad0[_0x062b('0x2a')],require('randomstring')[_0x062b('0x91')](0x4),_0x3005a3[_0x062b('0x92')]||_0x062b('0x93')),'reportId':_0x5e7ad0['id'],'reportType':'default'});return db['AnalyticExtractedReport']['create'](_0x3b6527,{'raw':!![]});})[_0x062b('0x24')](function(_0x128af7){if(_0x5e7ad0[_0x062b('0x74')]==='cdr'){_0x229153[_0x062b('0x3c')](_0x5e7ad0[_0x062b('0x74')]+_0x062b('0x94'),_0x3005a3['startDate'],_0x3005a3[_0x062b('0x95')]);}else{_0x229153[_0x062b('0x3c')](_0x5e7ad0[_0x062b('0x74')]+_0x062b('0x96'),_0x3005a3['startDate'],_0x3005a3['endDate']);}if(_0x128af7){logger[_0x062b('0x97')](_0x062b('0x98'),_0x229153['toString']());require(_0x062b('0x99'))[_0x062b('0x9a')](path['join'](__dirname,_0x062b('0x9b'),_0x128af7[_0x062b('0x92')]),[_0x128af7['id'],_0x229153[_0x062b('0x85')](),path[_0x062b('0x55')](__dirname,_0x062b('0x9c'),_0x128af7[_0x062b('0x9d')]),_0x233372]);return _0x128af7;}else{var _0x47d094=squel[_0x062b('0x73')]();_0x47d094['from']('('+_0x229153['toString']()+')',_0x062b('0x9e'));_0x47d094[_0x062b('0x6c')](_0x062b('0x9f'),'count');_0x229153[_0x062b('0x1c')](_0x3005a3['limit']||_0x205a4a);_0x229153[_0x062b('0x1a')](_0x3005a3['offset']||0x0);return dbH[_0x062b('0x86')]['query'](_0x47d094[_0x062b('0x85')](),{'type':dbH['sequelize'][_0x062b('0x87')][_0x062b('0xa0')]})['then'](function(_0x32480e){if(!_0x32480e[_0x062b('0x47')]){_0x7d3fbb=0x0;}else{_0x7d3fbb=_0x32480e[0x0][_0x062b('0x1d')]||0x0;}return dbH[_0x062b('0x86')][_0x062b('0x33')](_0x229153[_0x062b('0x85')](),{'type':dbH[_0x062b('0x86')]['QueryTypes'][_0x062b('0xa0')]});})['then'](function(_0x4e4d3c){return{'rows':_0x4e4d3c||[],'count':_0x7d3fbb};});}});}exports['run']=function(_0x4e7a8b,_0x2d7815){return runReport(_0x4e7a8b[_0x062b('0x53')],_0x4e7a8b[_0x062b('0x33')],_0x4e7a8b[_0x062b('0x41')])['then'](respondWithResult(_0x2d7815,null))[_0x062b('0x4a')](handleError(_0x2d7815,null));};exports['runReport']=runReport;exports[_0x062b('0x33')]=function(_0x10c43b,_0x5154bf){var _0x14e6fb=0xa;var _0x53ec5b=[_0x062b('0x55'),'left_join','right_join','cross_join'];var _0x44fffb={'SUM':_0x062b('0x59'),'COUNT':_0x062b('0x5a'),'COUNT DISTINCT':_0x062b('0x5b'),'MAX':_0x062b('0x5c'),'MIN':_0x062b('0x88'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x062b('0x89'),'GROUP_CONCAT ASC':_0x062b('0x5e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5b6586={'SEC_TO_TIME':_0x062b('0x60'),'DATE':'DATE(%s)','HOUR':_0x062b('0x62'),'ROUND':_0x062b('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x31a49c=function(_0x333cec){return!_[_0x062b('0x65')]([_0x062b('0x66'),_0x062b('0x8a'),_0x062b('0x67'),'IS\x20NOT\x20EMPTY'],_0x333cec);};var _0x3aaaf6=function(_0x57629c){if(!_0x57629c||!_0x57629c[_0x062b('0x69')]['length']){return'';}for(var _0x44265e='(',_0x3f33a5=0x0;_0x3f33a5<_0x57629c[_0x062b('0x69')][_0x062b('0x47')];_0x3f33a5+=0x1){_0x3f33a5>0x0&&(_0x44265e+='\x20'+_0x57629c[_0x062b('0x6a')]+'\x20');_0x44265e+=_0x57629c[_0x062b('0x69')][_0x3f33a5][_0x062b('0x6b')]?_0x3aaaf6(_0x57629c[_0x062b('0x69')][_0x3f33a5][_0x062b('0x6b')]):_0x57629c[_0x062b('0x69')][_0x3f33a5]['field']+'\x20'+_0x57629c[_0x062b('0x69')][_0x3f33a5][_0x062b('0x6d')]+(_0x31a49c(_0x57629c[_0x062b('0x69')][_0x3f33a5][_0x062b('0x6d')])?'\x20'+_0x57629c[_0x062b('0x69')][_0x3f33a5]['value']:'');}return _0x44265e+')';};var _0x3755ab={'where':{'id':_0x10c43b[_0x062b('0x53')]['id']}},_0x113b35,_0x397c42,_0x927e18,_0x129bc5,_0x5de99c;_0x3755ab=_[_0x062b('0x40')]({},_0x3755ab,_0x10c43b['options']);return db['AnalyticDefaultReport'][_0x062b('0x49')](_0x3755ab)['then'](function(_0x2b0c94){if(_0x2b0c94){_0x113b35=_0x2b0c94;return _0x2b0c94[_0x062b('0x6f')]();}return null;})[_0x062b('0x24')](function(_0x4bceab){if(_0x4bceab){if(!_0x4bceab[_0x062b('0x47')]){throw new db[(_0x062b('0x70'))][(_0x062b('0x8b'))](_0x062b('0x8c'),0x193);}_0x397c42=_0x4bceab;return db[_0x062b('0x71')][_0x062b('0x43')]({'raw':!![]});}return null;})[_0x062b('0x24')](function(_0x209221){if(_0x209221){_0x927e18=_[_0x062b('0x72')](_0x209221,'id');var _0x446724;var _0x1d5925=squel[_0x062b('0x73')]();_0x1d5925['from'](_0x113b35['table']);for(var _0x20cdeb=0x0;_0x20cdeb<_0x397c42[_0x062b('0x47')];_0x20cdeb+=0x1){_0x446724=_0x397c42[_0x20cdeb][_0x062b('0x75')]?_0x927e18[_0x397c42[_0x20cdeb][_0x062b('0x75')]][_0x062b('0x76')]:_0x397c42[_0x20cdeb][_0x062b('0x6c')];_0x446724=_0x397c42[_0x20cdeb][_0x062b('0x77')]?_[_0x062b('0x78')](_0x44fffb[_0x397c42[_0x20cdeb][_0x062b('0x77')]],'%s',_0x446724):_0x446724;_0x446724=_0x397c42[_0x20cdeb][_0x062b('0x79')]?_['replace'](_0x5b6586[_0x397c42[_0x20cdeb][_0x062b('0x79')]],'%s',_0x446724):_0x446724;if(_0x397c42[_0x20cdeb][_0x062b('0x7a')]){_0x1d5925[_0x062b('0x6b')](_0x446724);}_0x397c42[_0x20cdeb][_0x062b('0x7b')]&&_0x1d5925[_0x062b('0x3a')](_0x446724,_0x397c42[_0x20cdeb][_0x062b('0x7b')]===_0x062b('0x7c')?![]:!![]);_0x1d5925[_0x062b('0x6c')](_0x446724,_0x397c42[_0x20cdeb]['alias']||_0x446724);}if(_0x113b35['joins']){_0x113b35[_0x062b('0x7e')]=JSON[_0x062b('0x7f')](_0x113b35[_0x062b('0x7e')]);for(var _0x133c48=0x0;_0x133c48<_0x113b35['joins'][_0x062b('0x47')];_0x133c48+=0x1){if(_0x113b35[_0x062b('0x7e')][_0x133c48][_0x062b('0x30')]&&_[_0x062b('0x65')](_0x53ec5b,_0x113b35['joins'][_0x133c48][_0x062b('0x30')])&&_0x113b35[_0x062b('0x7e')][_0x133c48]['parentKey']&&_0x113b35['joins'][_0x133c48][_0x062b('0x81')]&&_0x113b35[_0x062b('0x7e')][_0x133c48][_0x062b('0x80')]){_0x1d5925[_0x113b35['joins'][_0x133c48][_0x062b('0x30')]](_0x113b35['joins'][_0x133c48][_0x062b('0x81')],null,util[_0x062b('0x79')](_0x062b('0x82'),_0x113b35[_0x062b('0x74')],_0x113b35[_0x062b('0x7e')][_0x133c48][_0x062b('0x8e')],_0x113b35[_0x062b('0x7e')][_0x133c48][_0x062b('0x81')],_0x113b35['joins'][_0x133c48][_0x062b('0x80')]));}}}if(_0x113b35[_0x062b('0x83')]){_0x113b35[_0x062b('0x83')]=JSON['parse'](_0x113b35[_0x062b('0x83')]);_0x1d5925['where'](_0x3aaaf6(_0x113b35[_0x062b('0x83')][_0x062b('0x6b')]));}_0x5de99c=_0x1d5925[_0x062b('0x84')]();_0x1d5925[_0x062b('0x1c')](_0x14e6fb);_0x1d5925[_0x062b('0x1a')](0x0);logger[_0x062b('0xa1')]('Limited\x20Query:',_0x1d5925['toString']());return dbH['sequelize'][_0x062b('0x33')](_0x1d5925[_0x062b('0x85')](),{'type':dbH[_0x062b('0x86')]['QueryTypes']['SELECT']});}})[_0x062b('0x24')](function(){return{'sql':_0x5de99c[_0x062b('0x85')]()};})[_0x062b('0x24')](respondWithResult(_0x5154bf,null))[_0x062b('0x4a')](handleError(_0x5154bf,null));}; \ No newline at end of file +var _0x9a9c=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Reports','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','AVG(%s)','SEC_TO_TIME(%s)','IS\x20NOT\x20NULL','value','Please\x20insert\x20at\x20least\x20one\x20field','metric','alias','output','web','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','DefaultReports','UserProfileResource','then','stack','name','send','map','AnalyticDefaultReport','rawAttributes','type','key','model'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0x9a9c,0x1c1));var _0xc9a9=function(_0x81d7c0,_0x11ac68){_0x81d7c0=_0x81d7c0-0x0;var _0x3d8ff5=_0x9a9c[_0x81d7c0];return _0x3d8ff5;};'use strict';var emlformat=require(_0xc9a9('0x0'));var rimraf=require(_0xc9a9('0x1'));var zipdir=require(_0xc9a9('0x2'));var jsonpatch=require(_0xc9a9('0x3'));var rp=require(_0xc9a9('0x4'));var moment=require(_0xc9a9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc9a9('0x6'));var util=require(_0xc9a9('0x7'));var path=require(_0xc9a9('0x8'));var sox=require(_0xc9a9('0x9'));var csv=require(_0xc9a9('0xa'));var ejs=require(_0xc9a9('0xb'));var fs=require('fs');var fs_extra=require(_0xc9a9('0xc'));var _=require(_0xc9a9('0xd'));var squel=require('squel');var crypto=require(_0xc9a9('0xe'));var jsforce=require(_0xc9a9('0xf'));var deskjs=require(_0xc9a9('0x10'));var toCsv=require(_0xc9a9('0xa'));var querystring=require('querystring');var Papa=require(_0xc9a9('0x11'));var Redis=require('ioredis');var authService=require(_0xc9a9('0x12'));var qs=require(_0xc9a9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9a9('0x14'))(_0xc9a9('0x15'));var utils=require(_0xc9a9('0x16'));var config=require(_0xc9a9('0x17'));var licenseUtil=require(_0xc9a9('0x18'));var db=require(_0xc9a9('0x19'))['db'];var dbH=require(_0xc9a9('0x19'))[_0xc9a9('0x1a')];function respondWithStatusCode(_0x3df27a,_0x5abe65){_0x5abe65=_0x5abe65||0xcc;return function(_0x3dedcb){if(_0x3dedcb){return _0x3df27a[_0xc9a9('0x1b')](_0x5abe65);}return _0x3df27a[_0xc9a9('0x1c')](_0x5abe65)[_0xc9a9('0x1d')]();};}function respondWithResult(_0x674ee,_0x3580c1){_0x3580c1=_0x3580c1||0xc8;return function(_0x1cd2cb){if(_0x1cd2cb){return _0x674ee[_0xc9a9('0x1c')](_0x3580c1)[_0xc9a9('0x1e')](_0x1cd2cb);}};}function respondWithFilteredResult(_0x230536,_0x10981e){return function(_0x1e4a83){if(_0x1e4a83){var _0x1fed8e=typeof _0x10981e[_0xc9a9('0x1f')]===_0xc9a9('0x20')&&typeof _0x10981e[_0xc9a9('0x21')]===_0xc9a9('0x20');var _0x5b9e52=_0x1e4a83[_0xc9a9('0x22')];var _0x530c73=_0x1fed8e?0x0:_0x10981e['offset'];var _0x2c6c74=_0x1fed8e?_0x1e4a83[_0xc9a9('0x22')]:_0x10981e[_0xc9a9('0x1f')]+_0x10981e[_0xc9a9('0x21')];var _0x516dd8;if(_0x2c6c74>=_0x5b9e52){_0x2c6c74=_0x5b9e52;_0x516dd8=0xc8;}else{_0x516dd8=0xce;}_0x230536[_0xc9a9('0x1c')](_0x516dd8);return _0x230536[_0xc9a9('0x23')](_0xc9a9('0x24'),_0x530c73+'-'+_0x2c6c74+'/'+_0x5b9e52)[_0xc9a9('0x1e')](_0x1e4a83);}return null;};}function patchUpdates(_0x3a1d21){return function(_0x49fad5){try{jsonpatch[_0xc9a9('0x25')](_0x49fad5,_0x3a1d21,!![]);}catch(_0x1084c7){return BPromise[_0xc9a9('0x26')](_0x1084c7);}return _0x49fad5['save']();};}function saveUpdates(_0x3095c1,_0x55d0af){return function(_0x3c271f){if(_0x3c271f){return _0x3c271f['update'](_0x3095c1)['then'](function(_0x43a90b){return _0x43a90b;});}return null;};}function removeEntity(_0x5ad062,_0x341a5f){return function(_0x3529ca){if(_0x3529ca){return _0x3529ca[_0xc9a9('0x27')]()['then'](function(){var _0x2c227b=_0x3529ca['get']({'plain':!![]});var _0x5cb203=_0xc9a9('0x28');return db[_0xc9a9('0x29')][_0xc9a9('0x27')]({'where':{'type':_0x5cb203,'resourceId':_0x2c227b['id']}})[_0xc9a9('0x2a')](function(){return _0x3529ca;});})[_0xc9a9('0x2a')](function(){_0x5ad062['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x295eba,_0x33abbc){return function(_0x448055){if(!_0x448055){_0x295eba['sendStatus'](0x194);}return _0x448055;};}function handleError(_0xf52e9f,_0xd7f5dc){_0xd7f5dc=_0xd7f5dc||0x1f4;return function(_0x28c4f6){logger['error'](_0x28c4f6[_0xc9a9('0x2b')]);if(_0x28c4f6[_0xc9a9('0x2c')]){delete _0x28c4f6[_0xc9a9('0x2c')];}_0xf52e9f[_0xc9a9('0x1c')](_0xd7f5dc)[_0xc9a9('0x2d')](_0x28c4f6);};}exports['index']=function(_0x10034f,_0x4716e4){var _0x5d5538={},_0xa29277={},_0x29850f={'count':0x0,'rows':[]};var _0x46200c=_[_0xc9a9('0x2e')](db[_0xc9a9('0x2f')][_0xc9a9('0x30')],function(_0x37e50b){return{'name':_0x37e50b['fieldName'],'type':_0x37e50b[_0xc9a9('0x31')][_0xc9a9('0x32')]};});_0xa29277[_0xc9a9('0x33')]=_[_0xc9a9('0x2e')](_0x46200c,_0xc9a9('0x2c'));_0xa29277[_0xc9a9('0x34')]=_['keys'](_0x10034f[_0xc9a9('0x34')]);_0xa29277[_0xc9a9('0x35')]=_[_0xc9a9('0x36')](_0xa29277['model'],_0xa29277[_0xc9a9('0x34')]);_0x5d5538[_0xc9a9('0x37')]=_['intersection'](_0xa29277['model'],qs[_0xc9a9('0x38')](_0x10034f['query'][_0xc9a9('0x38')]));_0x5d5538[_0xc9a9('0x37')]=_0x5d5538['attributes']['length']?_0x5d5538['attributes']:_0xa29277['model'];if(!_0x10034f[_0xc9a9('0x34')][_0xc9a9('0x39')](_0xc9a9('0x3a'))){_0x5d5538[_0xc9a9('0x21')]=qs[_0xc9a9('0x21')](_0x10034f[_0xc9a9('0x34')][_0xc9a9('0x21')]);_0x5d5538[_0xc9a9('0x1f')]=qs['offset'](_0x10034f[_0xc9a9('0x34')]['offset']);}_0x5d5538[_0xc9a9('0x3b')]=qs[_0xc9a9('0x3c')](_0x10034f[_0xc9a9('0x34')][_0xc9a9('0x3c')]);_0x5d5538['where']=qs[_0xc9a9('0x35')](_[_0xc9a9('0x3d')](_0x10034f[_0xc9a9('0x34')],_0xa29277[_0xc9a9('0x35')]),_0x46200c);if(_0x10034f[_0xc9a9('0x34')]['filter']){_0x5d5538[_0xc9a9('0x3e')]=_['merge'](_0x5d5538[_0xc9a9('0x3e')],{'$or':_[_0xc9a9('0x2e')](_0x46200c,function(_0xc2c570){if(_0xc2c570['type']!=='VIRTUAL'){var _0xa028f7={};_0xa028f7[_0xc2c570[_0xc9a9('0x2c')]]={'$like':'%'+_0x10034f[_0xc9a9('0x34')][_0xc9a9('0x3f')]+'%'};return _0xa028f7;}})});}_0x5d5538=_[_0xc9a9('0x40')]({},_0x5d5538,_0x10034f[_0xc9a9('0x41')]);var _0x38e239={'where':_0x5d5538[_0xc9a9('0x3e')]};return db[_0xc9a9('0x2f')][_0xc9a9('0x22')](_0x38e239)[_0xc9a9('0x2a')](function(_0x3d775e){_0x29850f[_0xc9a9('0x22')]=_0x3d775e;if(_0x10034f['query'][_0xc9a9('0x42')]){_0x5d5538[_0xc9a9('0x43')]=[{'all':!![]}];}return db[_0xc9a9('0x2f')][_0xc9a9('0x44')](_0x5d5538);})[_0xc9a9('0x2a')](function(_0x384a68){_0x29850f['rows']=_0x384a68;return _0x29850f;})[_0xc9a9('0x2a')](respondWithFilteredResult(_0x4716e4,_0x5d5538))[_0xc9a9('0x45')](handleError(_0x4716e4,null));};exports[_0xc9a9('0x46')]=function(_0x2ae187,_0x3af8c5){var _0x1f0291={'raw':!![],'where':{'id':_0x2ae187[_0xc9a9('0x47')]['id']}},_0x54d673={};_0x54d673[_0xc9a9('0x33')]=_[_0xc9a9('0x48')](db[_0xc9a9('0x2f')][_0xc9a9('0x30')]);_0x54d673[_0xc9a9('0x34')]=_[_0xc9a9('0x48')](_0x2ae187[_0xc9a9('0x34')]);_0x54d673[_0xc9a9('0x35')]=_['intersection'](_0x54d673['model'],_0x54d673[_0xc9a9('0x34')]);_0x1f0291[_0xc9a9('0x37')]=_[_0xc9a9('0x36')](_0x54d673['model'],qs[_0xc9a9('0x38')](_0x2ae187[_0xc9a9('0x34')][_0xc9a9('0x38')]));_0x1f0291['attributes']=_0x1f0291['attributes'][_0xc9a9('0x49')]?_0x1f0291[_0xc9a9('0x37')]:_0x54d673['model'];if(_0x2ae187[_0xc9a9('0x34')][_0xc9a9('0x42')]){_0x1f0291['include']=[{'all':!![]}];}_0x1f0291=_[_0xc9a9('0x40')]({},_0x1f0291,_0x2ae187[_0xc9a9('0x41')]);return db['AnalyticDefaultReport']['find'](_0x1f0291)['then'](handleEntityNotFound(_0x3af8c5,null))['then'](respondWithResult(_0x3af8c5,null))[_0xc9a9('0x45')](handleError(_0x3af8c5,null));};exports[_0xc9a9('0x4a')]=function(_0x5729a7,_0x2a0424){return db[_0xc9a9('0x2f')][_0xc9a9('0x4a')](_0x5729a7[_0xc9a9('0x4b')],{})['then'](function(_0x53e781){var _0x490b87=_0x5729a7[_0xc9a9('0x4c')]['get']({'plain':!![]});if(!_0x490b87)throw new Error(_0xc9a9('0x4d'));if(_0x490b87['role']===_0xc9a9('0x4c')){var _0x35b7de=_0x53e781[_0xc9a9('0x4e')]({'plain':!![]});var _0x1e4f1c=_0xc9a9('0x4f');return db[_0xc9a9('0x50')][_0xc9a9('0x51')]({'where':{'name':_0x1e4f1c,'userProfileId':_0x490b87[_0xc9a9('0x52')]},'raw':!![]})[_0xc9a9('0x2a')](function(_0x32b495){if(_0x32b495&&_0x32b495['autoAssociation']===0x0){return db['UserProfileResource'][_0xc9a9('0x4a')]({'name':_0x35b7de[_0xc9a9('0x2c')],'resourceId':_0x35b7de['id'],'type':_0xc9a9('0x28'),'sectionId':_0x32b495['id']},{})[_0xc9a9('0x2a')](function(){return _0x53e781;});}else{return _0x53e781;}})[_0xc9a9('0x45')](function(_0x46f1b9){logger[_0xc9a9('0x53')](_0xc9a9('0x54'),_0x46f1b9);throw _0x46f1b9;});}return _0x53e781;})[_0xc9a9('0x2a')](respondWithResult(_0x2a0424,0xc9))[_0xc9a9('0x45')](handleError(_0x2a0424,null));};exports[_0xc9a9('0x55')]=function(_0xb48a55,_0x151d25){if(_0xb48a55[_0xc9a9('0x4b')]['id']){delete _0xb48a55[_0xc9a9('0x4b')]['id'];}return db[_0xc9a9('0x2f')][_0xc9a9('0x51')]({'where':{'id':_0xb48a55[_0xc9a9('0x47')]['id']}})['then'](handleEntityNotFound(_0x151d25,null))[_0xc9a9('0x2a')](saveUpdates(_0xb48a55[_0xc9a9('0x4b')],null))[_0xc9a9('0x2a')](respondWithResult(_0x151d25,null))[_0xc9a9('0x45')](handleError(_0x151d25,null));};exports[_0xc9a9('0x27')]=function(_0xbb40e7,_0x50b8cb){return db[_0xc9a9('0x2f')][_0xc9a9('0x51')]({'where':{'id':_0xbb40e7[_0xc9a9('0x47')]['id']}})[_0xc9a9('0x2a')](handleEntityNotFound(_0x50b8cb,null))[_0xc9a9('0x2a')](removeEntity(_0x50b8cb,null))['catch'](handleError(_0x50b8cb,null));};exports[_0xc9a9('0x56')]=function(_0x532678,_0x515d08){var _0x33fe6a=0xa;var _0x46cd57=[_0xc9a9('0x57'),_0xc9a9('0x58'),_0xc9a9('0x59'),_0xc9a9('0x5a')];var _0x2c4e1f={'SUM':_0xc9a9('0x5b'),'COUNT':_0xc9a9('0x5c'),'COUNT DISTINCT':_0xc9a9('0x5d'),'MAX':_0xc9a9('0x5e'),'MIN':_0xc9a9('0x5f'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xc9a9('0x60'),'GROUP_CONCAT ASC':_0xc9a9('0x61'),'GROUP_CONCAT DESC':_0xc9a9('0x62')};var _0x3cd862={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xc9a9('0x63'),'ROUND':_0xc9a9('0x64'),'UNIX_TIMESTAMP':_0xc9a9('0x65')};var _0x66be74=function(_0x194a21){return!_[_0xc9a9('0x66')]([_0xc9a9('0x67'),'IS\x20NOT\x20NULL',_0xc9a9('0x68'),_0xc9a9('0x69')],_0x194a21);};var _0x39684e=function(_0x453951){if(!_0x453951||!_0x453951['rules'][_0xc9a9('0x49')]){return'';}for(var _0x58238e='(',_0x2647dd=0x0;_0x2647dd<_0x453951[_0xc9a9('0x6a')][_0xc9a9('0x49')];_0x2647dd+=0x1){_0x2647dd>0x0&&(_0x58238e+='\x20'+_0x453951[_0xc9a9('0x6b')]+'\x20');_0x58238e+=_0x453951[_0xc9a9('0x6a')][_0x2647dd][_0xc9a9('0x6c')]?_0x39684e(_0x453951['rules'][_0x2647dd][_0xc9a9('0x6c')]):_0x453951[_0xc9a9('0x6a')][_0x2647dd][_0xc9a9('0x6d')]+'\x20'+_0x453951[_0xc9a9('0x6a')][_0x2647dd][_0xc9a9('0x6e')]+(_0x66be74(_0x453951[_0xc9a9('0x6a')][_0x2647dd]['condition'])?'\x20'+_0x453951[_0xc9a9('0x6a')][_0x2647dd]['value']:'');}return _0x58238e+')';};var _0x3b3af9={'where':{'id':_0x532678[_0xc9a9('0x47')]['id']}},_0x57fafa,_0x215557,_0x4d556b,_0x1bc759,_0x306ac5;_0x3b3af9=_[_0xc9a9('0x40')]({},_0x3b3af9,_0x532678['options']);return db[_0xc9a9('0x2f')][_0xc9a9('0x51')](_0x3b3af9)['then'](function(_0x2ec2e9){if(_0x2ec2e9){_0x57fafa=_0x2ec2e9;return _0x2ec2e9[_0xc9a9('0x6f')]();}return null;})['then'](function(_0x36891a){if(_0x36891a){if(!_0x36891a[_0xc9a9('0x49')]){throw new db[(_0xc9a9('0x70'))][(_0xc9a9('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x215557=_0x36891a;return db[_0xc9a9('0x72')][_0xc9a9('0x44')]({'raw':!![]});}return null;})[_0xc9a9('0x2a')](function(_0x231c89){if(_0x231c89){_0x4d556b=_[_0xc9a9('0x73')](_0x231c89,'id');var _0x4ef1c9;var _0x46c018=squel[_0xc9a9('0x74')]();_0x46c018[_0xc9a9('0x75')](_0x57fafa[_0xc9a9('0x76')]);for(var _0x359d71=0x0;_0x359d71<_0x215557[_0xc9a9('0x49')];_0x359d71+=0x1){_0x4ef1c9=_0x215557[_0x359d71][_0xc9a9('0x77')]?_0x4d556b[_0x215557[_0x359d71][_0xc9a9('0x77')]]['metric']:_0x215557[_0x359d71][_0xc9a9('0x6d')];_0x4ef1c9=_0x215557[_0x359d71][_0xc9a9('0x78')]?_[_0xc9a9('0x79')](_0x2c4e1f[_0x215557[_0x359d71][_0xc9a9('0x78')]],'%s',_0x4ef1c9):_0x4ef1c9;_0x4ef1c9=_0x215557[_0x359d71][_0xc9a9('0x7a')]?_[_0xc9a9('0x79')](_0x3cd862[_0x215557[_0x359d71]['format']],'%s',_0x4ef1c9):_0x4ef1c9;if(_0x215557[_0x359d71][_0xc9a9('0x7b')]){_0x46c018[_0xc9a9('0x6c')](_0x4ef1c9);}_0x215557[_0x359d71][_0xc9a9('0x7c')]&&_0x46c018['order'](_0x4ef1c9,_0x215557[_0x359d71]['orderBy']===_0xc9a9('0x7d')?![]:!![]);_0x46c018[_0xc9a9('0x6d')](_0x4ef1c9,_0x215557[_0x359d71]['alias']||_0x4ef1c9);}if(_0x57fafa[_0xc9a9('0x7e')]){_0x57fafa[_0xc9a9('0x7e')]=JSON[_0xc9a9('0x7f')](_0x57fafa[_0xc9a9('0x7e')]);for(var _0x6cf7b9=0x0;_0x6cf7b9<_0x57fafa[_0xc9a9('0x7e')][_0xc9a9('0x49')];_0x6cf7b9+=0x1){if(_0x57fafa[_0xc9a9('0x7e')][_0x6cf7b9]['type']&&_[_0xc9a9('0x66')](_0x46cd57,_0x57fafa[_0xc9a9('0x7e')][_0x6cf7b9][_0xc9a9('0x31')])&&_0x57fafa[_0xc9a9('0x7e')][_0x6cf7b9][_0xc9a9('0x80')]&&_0x57fafa[_0xc9a9('0x7e')][_0x6cf7b9][_0xc9a9('0x81')]&&_0x57fafa[_0xc9a9('0x7e')][_0x6cf7b9][_0xc9a9('0x82')]){_0x46c018[_0x57fafa[_0xc9a9('0x7e')][_0x6cf7b9][_0xc9a9('0x31')]](_0x57fafa['joins'][_0x6cf7b9][_0xc9a9('0x81')],null,util[_0xc9a9('0x7a')](_0xc9a9('0x83'),_0x57fafa[_0xc9a9('0x76')],_0x57fafa['joins'][_0x6cf7b9][_0xc9a9('0x80')],_0x57fafa[_0xc9a9('0x7e')][_0x6cf7b9][_0xc9a9('0x81')],_0x57fafa[_0xc9a9('0x7e')][_0x6cf7b9][_0xc9a9('0x82')]));}}}if(_0x57fafa[_0xc9a9('0x84')]){_0x57fafa[_0xc9a9('0x84')]=JSON[_0xc9a9('0x7f')](_0x57fafa[_0xc9a9('0x84')]);_0x46c018['where'](_0x39684e(_0x57fafa[_0xc9a9('0x84')]['group']));}_0x306ac5=_0x46c018[_0xc9a9('0x85')]();_0x46c018[_0xc9a9('0x21')](_0x33fe6a);_0x46c018[_0xc9a9('0x1f')](0x0);logger[_0xc9a9('0x86')](_0xc9a9('0x87'),_0x46c018[_0xc9a9('0x88')]());return dbH[_0xc9a9('0x89')][_0xc9a9('0x34')](_0x46c018['toString'](),{'type':dbH[_0xc9a9('0x89')][_0xc9a9('0x8a')]['SELECT']});}})[_0xc9a9('0x2a')](respondWithResult(_0x515d08,null))['catch'](handleError(_0x515d08,null));};function runReport(_0x2aa23a,_0x579b43,_0x122d66){var _0x42ee39=_0x579b43['name'];var _0x598607=0xa;var _0x402212=[_0xc9a9('0x57'),_0xc9a9('0x58'),_0xc9a9('0x59'),_0xc9a9('0x5a')];var _0x59b8f0={'SUM':_0xc9a9('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xc9a9('0x5f'),'AVG':_0xc9a9('0x8b'),'GROUP_CONCAT':_0xc9a9('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4c6fd8={'SEC_TO_TIME':_0xc9a9('0x8c'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xc9a9('0x64'),'UNIX_TIMESTAMP':_0xc9a9('0x65')};var _0x39ab40=function(_0x36d06e){return!_[_0xc9a9('0x66')]([_0xc9a9('0x67'),_0xc9a9('0x8d'),'IS\x20EMPTY',_0xc9a9('0x69')],_0x36d06e);};var _0x5b9a3b=function(_0x193f5d){if(!_0x193f5d||!_0x193f5d[_0xc9a9('0x6a')][_0xc9a9('0x49')]){return'';}for(var _0x322d80='(',_0x39991d=0x0;_0x39991d<_0x193f5d[_0xc9a9('0x6a')]['length'];_0x39991d+=0x1){_0x39991d>0x0&&(_0x322d80+='\x20'+_0x193f5d[_0xc9a9('0x6b')]+'\x20');_0x322d80+=_0x193f5d[_0xc9a9('0x6a')][_0x39991d]['group']?_0x5b9a3b(_0x193f5d[_0xc9a9('0x6a')][_0x39991d]['group']):_0x193f5d[_0xc9a9('0x6a')][_0x39991d][_0xc9a9('0x6d')]+'\x20'+_0x193f5d[_0xc9a9('0x6a')][_0x39991d][_0xc9a9('0x6e')]+(_0x39ab40(_0x193f5d[_0xc9a9('0x6a')][_0x39991d][_0xc9a9('0x6e')])?'\x20'+_0x193f5d[_0xc9a9('0x6a')][_0x39991d][_0xc9a9('0x8e')]:'');}return _0x322d80+')';};var _0x1fa908={'where':{'id':_0x2aa23a['id']}},_0x40f4d8,_0x1631f7,_0x180ed3,_0x4a6bea,_0xf07d78;_0x1fa908=_[_0xc9a9('0x40')]({},_0x1fa908,_0x122d66);return db[_0xc9a9('0x2f')][_0xc9a9('0x51')](_0x1fa908)[_0xc9a9('0x2a')](function(_0xe8142c){if(_0xe8142c){_0x40f4d8=_0xe8142c;return _0xe8142c[_0xc9a9('0x6f')]();}return null;})['then'](function(_0x139ffa){if(_0x139ffa){if(!_0x139ffa[_0xc9a9('0x49')]){throw new db[(_0xc9a9('0x70'))]['ValidationErrorItem'](_0xc9a9('0x8f'),0x193);}_0x1631f7=_0x139ffa;return db[_0xc9a9('0x72')][_0xc9a9('0x44')]({'raw':!![]});}return null;})[_0xc9a9('0x2a')](function(_0x3afef2){if(_0x3afef2){_0x180ed3=_[_0xc9a9('0x73')](_0x3afef2,'id');var _0xb51252;var _0x52c21f=squel['select']();_0x52c21f['from'](_0x40f4d8['table']);for(var _0x2e2bc3=0x0;_0x2e2bc3<_0x1631f7['length'];_0x2e2bc3+=0x1){_0xb51252=_0x1631f7[_0x2e2bc3][_0xc9a9('0x77')]?_0x180ed3[_0x1631f7[_0x2e2bc3][_0xc9a9('0x77')]][_0xc9a9('0x90')]:_0x1631f7[_0x2e2bc3][_0xc9a9('0x6d')];_0xb51252=_0x1631f7[_0x2e2bc3][_0xc9a9('0x78')]?_[_0xc9a9('0x79')](_0x59b8f0[_0x1631f7[_0x2e2bc3][_0xc9a9('0x78')]],'%s',_0xb51252):_0xb51252;_0xb51252=_0x1631f7[_0x2e2bc3]['format']?_[_0xc9a9('0x79')](_0x4c6fd8[_0x1631f7[_0x2e2bc3][_0xc9a9('0x7a')]],'%s',_0xb51252):_0xb51252;if(_0x1631f7[_0x2e2bc3][_0xc9a9('0x7b')]){_0x52c21f[_0xc9a9('0x6c')](_0xb51252);}_0x1631f7[_0x2e2bc3]['orderBy']&&_0x52c21f[_0xc9a9('0x3b')](_0xb51252,_0x1631f7[_0x2e2bc3][_0xc9a9('0x7c')]===_0xc9a9('0x7d')?![]:!![]);_0x52c21f[_0xc9a9('0x6d')](_0xb51252,_0x1631f7[_0x2e2bc3][_0xc9a9('0x91')]||_0xb51252);}if(_0x40f4d8[_0xc9a9('0x7e')]){_0x40f4d8[_0xc9a9('0x7e')]=JSON[_0xc9a9('0x7f')](_0x40f4d8[_0xc9a9('0x7e')]);for(var _0x33282f=0x0;_0x33282f<_0x40f4d8[_0xc9a9('0x7e')][_0xc9a9('0x49')];_0x33282f+=0x1){if(_0x40f4d8[_0xc9a9('0x7e')][_0x33282f]['type']&&_[_0xc9a9('0x66')](_0x402212,_0x40f4d8[_0xc9a9('0x7e')][_0x33282f]['type'])&&_0x40f4d8[_0xc9a9('0x7e')][_0x33282f][_0xc9a9('0x80')]&&_0x40f4d8['joins'][_0x33282f][_0xc9a9('0x81')]&&_0x40f4d8[_0xc9a9('0x7e')][_0x33282f][_0xc9a9('0x82')]){_0x52c21f[_0x40f4d8['joins'][_0x33282f][_0xc9a9('0x31')]](_0x40f4d8['joins'][_0x33282f][_0xc9a9('0x81')],null,util[_0xc9a9('0x7a')]('%s.%s\x20=\x20%s.%s',_0x40f4d8[_0xc9a9('0x76')],_0x40f4d8[_0xc9a9('0x7e')][_0x33282f]['parentKey'],_0x40f4d8[_0xc9a9('0x7e')][_0x33282f][_0xc9a9('0x81')],_0x40f4d8[_0xc9a9('0x7e')][_0x33282f][_0xc9a9('0x82')]));}}}if(_0x40f4d8[_0xc9a9('0x84')]){_0x40f4d8['conditions']=JSON['parse'](_0x40f4d8[_0xc9a9('0x84')]);_0x52c21f['where'](_0x5b9a3b(_0x40f4d8[_0xc9a9('0x84')][_0xc9a9('0x6c')]));}_0xf07d78=_0x52c21f[_0xc9a9('0x85')]();_0x52c21f['limit'](_0x598607);_0x52c21f[_0xc9a9('0x1f')](0x0);return;}})[_0xc9a9('0x2a')](function(){if(_0x579b43[_0xc9a9('0x92')]===_0xc9a9('0x93')){return null;}var _0x2cecbb=_['merge'](_0x579b43,{'name':_0x579b43['fullPath']||_0x579b43['name']||_0x40f4d8[_0xc9a9('0x2c')],'basename':_0x42ee39,'savename':util['format'](_0xc9a9('0x94'),_0x579b43[_0xc9a9('0x2c')]||_0x40f4d8['name'],require(_0xc9a9('0x95'))[_0xc9a9('0x96')](0x4),_0x579b43[_0xc9a9('0x92')]||_0xc9a9('0x97')),'reportId':_0x40f4d8['id'],'reportType':'default'});return db[_0xc9a9('0x98')][_0xc9a9('0x4a')](_0x2cecbb,{'raw':!![]});})[_0xc9a9('0x2a')](function(_0x1373cf){if(_0x40f4d8[_0xc9a9('0x76')]===_0xc9a9('0x99')){_0xf07d78[_0xc9a9('0x3e')](_0x40f4d8[_0xc9a9('0x76')]+_0xc9a9('0x9a'),_0x579b43[_0xc9a9('0x9b')],_0x579b43['endDate']);}else{_0xf07d78[_0xc9a9('0x3e')](_0x40f4d8[_0xc9a9('0x76')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x579b43[_0xc9a9('0x9b')],_0x579b43['endDate']);}if(_0x1373cf){logger['info'](_0xc9a9('0x9c'),_0xf07d78[_0xc9a9('0x88')]());require(_0xc9a9('0x9d'))[_0xc9a9('0x9e')](path[_0xc9a9('0x57')](__dirname,_0xc9a9('0x9f'),_0x1373cf[_0xc9a9('0x92')]),[_0x1373cf['id'],_0xf07d78['toString'](),path[_0xc9a9('0x57')](__dirname,_0xc9a9('0xa0'),_0x1373cf[_0xc9a9('0xa1')]),_0x42ee39]);return _0x1373cf;}else{var _0x4c6ac3=squel['select']();_0x4c6ac3['from']('('+_0xf07d78[_0xc9a9('0x88')]()+')',_0xc9a9('0xa2'));_0x4c6ac3[_0xc9a9('0x6d')](_0xc9a9('0xa3'),_0xc9a9('0x22'));_0xf07d78['limit'](_0x579b43['limit']||_0x598607);_0xf07d78[_0xc9a9('0x1f')](_0x579b43[_0xc9a9('0x1f')]||0x0);return dbH[_0xc9a9('0x89')]['query'](_0x4c6ac3['toString'](),{'type':dbH['sequelize'][_0xc9a9('0x8a')]['SELECT']})[_0xc9a9('0x2a')](function(_0x14080c){if(!_0x14080c[_0xc9a9('0x49')]){_0x4a6bea=0x0;}else{_0x4a6bea=_0x14080c[0x0]['count']||0x0;}return dbH[_0xc9a9('0x89')][_0xc9a9('0x34')](_0xf07d78[_0xc9a9('0x88')](),{'type':dbH[_0xc9a9('0x89')]['QueryTypes'][_0xc9a9('0xa4')]});})['then'](function(_0x30d04e){return{'rows':_0x30d04e||[],'count':_0x4a6bea};});}});}exports[_0xc9a9('0xa5')]=function(_0x5a2b07,_0x21085d){return runReport(_0x5a2b07[_0xc9a9('0x47')],_0x5a2b07[_0xc9a9('0x34')],_0x5a2b07[_0xc9a9('0x41')])[_0xc9a9('0x2a')](respondWithResult(_0x21085d,null))[_0xc9a9('0x45')](handleError(_0x21085d,null));};exports[_0xc9a9('0xa6')]=runReport;exports['query']=function(_0x2ea97a,_0x2d8dc0){var _0xacd05f=0xa;var _0x356df9=[_0xc9a9('0x57'),'left_join','right_join','cross_join'];var _0x2e30ea={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc9a9('0x5d'),'MAX':_0xc9a9('0x5e'),'MIN':'MIN(%s)','AVG':_0xc9a9('0x8b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc9a9('0x61'),'GROUP_CONCAT DESC':_0xc9a9('0x62')};var _0xa7ec7c={'SEC_TO_TIME':_0xc9a9('0x8c'),'DATE':'DATE(%s)','HOUR':_0xc9a9('0x63'),'ROUND':_0xc9a9('0x64'),'UNIX_TIMESTAMP':_0xc9a9('0x65')};var _0x31caa5=function(_0x80c163){return!_[_0xc9a9('0x66')]([_0xc9a9('0x67'),'IS\x20NOT\x20NULL',_0xc9a9('0x68'),_0xc9a9('0x69')],_0x80c163);};var _0x238c75=function(_0x2cd2de){if(!_0x2cd2de||!_0x2cd2de['rules'][_0xc9a9('0x49')]){return'';}for(var _0x1452b5='(',_0x4aecd8=0x0;_0x4aecd8<_0x2cd2de[_0xc9a9('0x6a')]['length'];_0x4aecd8+=0x1){_0x4aecd8>0x0&&(_0x1452b5+='\x20'+_0x2cd2de['operator']+'\x20');_0x1452b5+=_0x2cd2de['rules'][_0x4aecd8]['group']?_0x238c75(_0x2cd2de['rules'][_0x4aecd8][_0xc9a9('0x6c')]):_0x2cd2de['rules'][_0x4aecd8][_0xc9a9('0x6d')]+'\x20'+_0x2cd2de[_0xc9a9('0x6a')][_0x4aecd8]['condition']+(_0x31caa5(_0x2cd2de[_0xc9a9('0x6a')][_0x4aecd8][_0xc9a9('0x6e')])?'\x20'+_0x2cd2de[_0xc9a9('0x6a')][_0x4aecd8][_0xc9a9('0x8e')]:'');}return _0x1452b5+')';};var _0x2fe30e={'where':{'id':_0x2ea97a['params']['id']}},_0x50c143,_0x1871ab,_0x31c6e2,_0x238c33,_0x383211;_0x2fe30e=_[_0xc9a9('0x40')]({},_0x2fe30e,_0x2ea97a[_0xc9a9('0x41')]);return db['AnalyticDefaultReport'][_0xc9a9('0x51')](_0x2fe30e)[_0xc9a9('0x2a')](function(_0xbc1770){if(_0xbc1770){_0x50c143=_0xbc1770;return _0xbc1770[_0xc9a9('0x6f')]();}return null;})[_0xc9a9('0x2a')](function(_0x4ff1ba){if(_0x4ff1ba){if(!_0x4ff1ba[_0xc9a9('0x49')]){throw new db[(_0xc9a9('0x70'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1871ab=_0x4ff1ba;return db['AnalyticMetric'][_0xc9a9('0x44')]({'raw':!![]});}return null;})['then'](function(_0x53879b){if(_0x53879b){_0x31c6e2=_[_0xc9a9('0x73')](_0x53879b,'id');var _0x512c14;var _0x501f3b=squel[_0xc9a9('0x74')]();_0x501f3b[_0xc9a9('0x75')](_0x50c143[_0xc9a9('0x76')]);for(var _0x1246f2=0x0;_0x1246f2<_0x1871ab[_0xc9a9('0x49')];_0x1246f2+=0x1){_0x512c14=_0x1871ab[_0x1246f2][_0xc9a9('0x77')]?_0x31c6e2[_0x1871ab[_0x1246f2][_0xc9a9('0x77')]][_0xc9a9('0x90')]:_0x1871ab[_0x1246f2][_0xc9a9('0x6d')];_0x512c14=_0x1871ab[_0x1246f2][_0xc9a9('0x78')]?_[_0xc9a9('0x79')](_0x2e30ea[_0x1871ab[_0x1246f2][_0xc9a9('0x78')]],'%s',_0x512c14):_0x512c14;_0x512c14=_0x1871ab[_0x1246f2][_0xc9a9('0x7a')]?_['replace'](_0xa7ec7c[_0x1871ab[_0x1246f2][_0xc9a9('0x7a')]],'%s',_0x512c14):_0x512c14;if(_0x1871ab[_0x1246f2][_0xc9a9('0x7b')]){_0x501f3b[_0xc9a9('0x6c')](_0x512c14);}_0x1871ab[_0x1246f2][_0xc9a9('0x7c')]&&_0x501f3b[_0xc9a9('0x3b')](_0x512c14,_0x1871ab[_0x1246f2][_0xc9a9('0x7c')]===_0xc9a9('0x7d')?![]:!![]);_0x501f3b['field'](_0x512c14,_0x1871ab[_0x1246f2]['alias']||_0x512c14);}if(_0x50c143['joins']){_0x50c143[_0xc9a9('0x7e')]=JSON['parse'](_0x50c143[_0xc9a9('0x7e')]);for(var _0x2a6c4c=0x0;_0x2a6c4c<_0x50c143[_0xc9a9('0x7e')][_0xc9a9('0x49')];_0x2a6c4c+=0x1){if(_0x50c143['joins'][_0x2a6c4c][_0xc9a9('0x31')]&&_[_0xc9a9('0x66')](_0x356df9,_0x50c143[_0xc9a9('0x7e')][_0x2a6c4c]['type'])&&_0x50c143[_0xc9a9('0x7e')][_0x2a6c4c][_0xc9a9('0x80')]&&_0x50c143[_0xc9a9('0x7e')][_0x2a6c4c]['foreignTable']&&_0x50c143[_0xc9a9('0x7e')][_0x2a6c4c][_0xc9a9('0x82')]){_0x501f3b[_0x50c143[_0xc9a9('0x7e')][_0x2a6c4c][_0xc9a9('0x31')]](_0x50c143['joins'][_0x2a6c4c][_0xc9a9('0x81')],null,util[_0xc9a9('0x7a')]('%s.%s\x20=\x20%s.%s',_0x50c143[_0xc9a9('0x76')],_0x50c143[_0xc9a9('0x7e')][_0x2a6c4c][_0xc9a9('0x80')],_0x50c143[_0xc9a9('0x7e')][_0x2a6c4c][_0xc9a9('0x81')],_0x50c143['joins'][_0x2a6c4c][_0xc9a9('0x82')]));}}}if(_0x50c143[_0xc9a9('0x84')]){_0x50c143['conditions']=JSON[_0xc9a9('0x7f')](_0x50c143[_0xc9a9('0x84')]);_0x501f3b['where'](_0x238c75(_0x50c143[_0xc9a9('0x84')]['group']));}_0x383211=_0x501f3b[_0xc9a9('0x85')]();_0x501f3b[_0xc9a9('0x21')](_0xacd05f);_0x501f3b[_0xc9a9('0x1f')](0x0);logger[_0xc9a9('0x86')]('Limited\x20Query:',_0x501f3b[_0xc9a9('0x88')]());return dbH[_0xc9a9('0x89')]['query'](_0x501f3b[_0xc9a9('0x88')](),{'type':dbH[_0xc9a9('0x89')][_0xc9a9('0x8a')][_0xc9a9('0xa4')]});}})[_0xc9a9('0x2a')](function(){return{'sql':_0x383211['toString']()};})[_0xc9a9('0x2a')](respondWithResult(_0x2d8dc0,null))[_0xc9a9('0x45')](handleError(_0x2d8dc0,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 3524860..ce4eb70 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 _0xe79c=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','lodash','util'];(function(_0x3925ba,_0x5dc4eb){var _0x582dc5=function(_0x30d83b){while(--_0x30d83b){_0x3925ba['push'](_0x3925ba['shift']());}};_0x582dc5(++_0x5dc4eb);}(_0xe79c,0x106));var _0xce79=function(_0x5178fa,_0x3083de){_0x5178fa=_0x5178fa-0x0;var _0x2ed33d=_0xe79c[_0x5178fa];return _0x2ed33d;};'use strict';var _=require(_0xce79('0x0'));var util=require(_0xce79('0x1'));var logger=require(_0xce79('0x2'))(_0xce79('0x3'));var moment=require(_0xce79('0x4'));var BPromise=require(_0xce79('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce79('0x6'));var rimraf=require(_0xce79('0x7'));var config=require(_0xce79('0x8'));var attributes=require(_0xce79('0x9'));module['exports']=function(_0x1f9d9b,_0x3ce3af){return _0x1f9d9b[_0xce79('0xa')](_0xce79('0xb'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d88=['bluebird','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','api','moment'];(function(_0x1cd762,_0x2ede25){var _0x53c2ef=function(_0x431c7a){while(--_0x431c7a){_0x1cd762['push'](_0x1cd762['shift']());}};_0x53c2ef(++_0x2ede25);}(_0x2d88,0x127));var _0x82d8=function(_0x5bd040,_0x39e437){_0x5bd040=_0x5bd040-0x0;var _0x49c4d5=_0x2d88[_0x5bd040];return _0x49c4d5;};'use strict';var _=require(_0x82d8('0x0'));var util=require(_0x82d8('0x1'));var logger=require('../../config/logger')(_0x82d8('0x2'));var moment=require(_0x82d8('0x3'));var BPromise=require(_0x82d8('0x4'));var rp=require(_0x82d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82d8('0x6'));var config=require(_0x82d8('0x7'));var attributes=require(_0x82d8('0x8'));module[_0x82d8('0x9')]=function(_0x56e158,_0x292801){return _0x56e158[_0x82d8('0xa')](_0x82d8('0xb'),attributes,{'tableName':_0x82d8('0xc'),'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 bf2359e..78c4327 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 _0x0102=['info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/environment','jayson/promise','client','http','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0102,0x186));var _0x2010=function(_0x1d2a55,_0x32deb0){_0x1d2a55=_0x1d2a55-0x0;var _0x563fca=_0x0102[_0x1d2a55];return _0x563fca;};'use strict';var _=require('lodash');var util=require(_0x2010('0x0'));var moment=require(_0x2010('0x1'));var BPromise=require(_0x2010('0x2'));var rs=require(_0x2010('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2010('0x4'));var jayson=require(_0x2010('0x5'));var client=jayson[_0x2010('0x6')][_0x2010('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4eeb67,_0x453fc0,_0x495d98){return new BPromise(function(_0x4728c0,_0x160e41){return client['request'](_0x4eeb67,_0x495d98)[_0x2010('0x8')](function(_0x3c2d98){logger[_0x2010('0x9')](_0x2010('0xa'),_0x453fc0,_0x2010('0xb'));logger[_0x2010('0xc')](_0x2010('0xd'),_0x453fc0,_0x2010('0xb'),JSON[_0x2010('0xe')](_0x3c2d98));if(_0x3c2d98[_0x2010('0xf')]){if(_0x3c2d98[_0x2010('0xf')][_0x2010('0x10')]===0x1f4){logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);return _0x160e41(_0x3c2d98['error']['message']);}logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);return _0x4728c0(_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);}else{logger['info'](_0x2010('0xa'),_0x453fc0,_0x2010('0xb'));_0x4728c0(_0x3c2d98['result'][_0x2010('0x11')]);}})[_0x2010('0x12')](function(_0x410889){logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x410889);_0x160e41(_0x410889);});});} \ No newline at end of file +var _0xd52d=['jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x43fd38,_0x226b81){var _0x4cb7bd=function(_0x320be6){while(--_0x320be6){_0x43fd38['push'](_0x43fd38['shift']());}};_0x4cb7bd(++_0x226b81);}(_0xd52d,0x1c7));var _0xdd52=function(_0x14ee73,_0x2f0b8d){_0x14ee73=_0x14ee73-0x0;var _0x108140=_0xd52d[_0x14ee73];return _0x108140;};'use strict';var _=require('lodash');var util=require(_0xdd52('0x0'));var moment=require(_0xdd52('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd52('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdd52('0x3'));var logger=require(_0xdd52('0x4'))(_0xdd52('0x5'));var config=require(_0xdd52('0x6'));var jayson=require(_0xdd52('0x7'));var client=jayson[_0xdd52('0x8')][_0xdd52('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18d01d,_0x4ca1a2,_0x1b8b74){return new BPromise(function(_0x6ab1e3,_0x8a6170){return client[_0xdd52('0xa')](_0x18d01d,_0x1b8b74)[_0xdd52('0xb')](function(_0xb6616a){logger[_0xdd52('0xc')](_0xdd52('0xd'),_0x4ca1a2,_0xdd52('0xe'));logger[_0xdd52('0xf')](_0xdd52('0x10'),_0x4ca1a2,_0xdd52('0xe'),JSON[_0xdd52('0x11')](_0xb6616a));if(_0xb6616a['error']){if(_0xb6616a[_0xdd52('0x12')][_0xdd52('0x13')]===0x1f4){logger[_0xdd52('0x12')](_0xdd52('0xd'),_0x4ca1a2,_0xb6616a[_0xdd52('0x12')][_0xdd52('0x14')]);return _0x8a6170(_0xb6616a['error'][_0xdd52('0x14')]);}logger[_0xdd52('0x12')](_0xdd52('0xd'),_0x4ca1a2,_0xb6616a['error'][_0xdd52('0x14')]);return _0x6ab1e3(_0xb6616a[_0xdd52('0x12')][_0xdd52('0x14')]);}else{logger[_0xdd52('0xc')](_0xdd52('0xd'),_0x4ca1a2,_0xdd52('0xe'));_0x6ab1e3(_0xb6616a[_0xdd52('0x15')][_0xdd52('0x14')]);}})['catch'](function(_0x468c7a){logger['error'](_0xdd52('0xd'),_0x4ca1a2,_0x468c7a);_0x8a6170(_0x468c7a);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index ffc1259..2ee0c16 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 _0xf25d=['query','create','update','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','/:id','show','get','/:id/preview','isAuthenticated','preview','/:id/query'];(function(_0x1c8c30,_0x3b5530){var _0x70b806=function(_0x491c11){while(--_0x491c11){_0x1c8c30['push'](_0x1c8c30['shift']());}};_0x70b806(++_0x3b5530);}(_0xf25d,0xed));var _0xdf25=function(_0x207add,_0x40ef3f){_0x207add=_0x207add-0x0;var _0x1a1927=_0xf25d[_0x207add];return _0x1a1927;};'use strict';var multer=require(_0xdf25('0x0'));var util=require(_0xdf25('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdf25('0x2'));var router=express[_0xdf25('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdf25('0x4'));var interaction=require(_0xdf25('0x5'));var config=require(_0xdf25('0x6'));var controller=require(_0xdf25('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xdf25('0x8'),auth['isAuthenticated'](),controller[_0xdf25('0x9')]);router[_0xdf25('0xa')](_0xdf25('0xb'),auth[_0xdf25('0xc')](),controller[_0xdf25('0xd')]);router[_0xdf25('0xa')]('/:id/run',auth[_0xdf25('0xc')](),controller['run']);router[_0xdf25('0xa')](_0xdf25('0xe'),auth[_0xdf25('0xc')](),controller[_0xdf25('0xf')]);router['post']('/',auth[_0xdf25('0xc')](),controller[_0xdf25('0x10')]);router['put'](_0xdf25('0x8'),auth['isAuthenticated'](),controller[_0xdf25('0x11')]);router['delete'](_0xdf25('0x8'),auth[_0xdf25('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6692=['show','/:id/preview','preview','run','/:id/query','query','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','/:id'];(function(_0x265ae0,_0x3e3ac5){var _0x554876=function(_0xae2dc6){while(--_0xae2dc6){_0x265ae0['push'](_0x265ae0['shift']());}};_0x554876(++_0x3e3ac5);}(_0x6692,0x198));var _0x2669=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0x6692[_0xf48cce];return _0x2a5c38;};'use strict';var multer=require(_0x2669('0x0'));var util=require(_0x2669('0x1'));var path=require(_0x2669('0x2'));var timeout=require(_0x2669('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2669('0x4'));var interaction=require(_0x2669('0x5'));var config=require('../../config/environment');var controller=require(_0x2669('0x6'));router[_0x2669('0x7')]('/',auth[_0x2669('0x8')](),controller['index']);router['get'](_0x2669('0x9'),auth[_0x2669('0x8')](),controller[_0x2669('0xa')]);router[_0x2669('0x7')](_0x2669('0xb'),auth[_0x2669('0x8')](),controller[_0x2669('0xc')]);router['get']('/:id/run',auth['isAuthenticated'](),controller[_0x2669('0xd')]);router[_0x2669('0x7')](_0x2669('0xe'),auth[_0x2669('0x8')](),controller[_0x2669('0xf')]);router['post']('/',auth[_0x2669('0x8')](),controller[_0x2669('0x10')]);router[_0x2669('0x11')](_0x2669('0x9'),auth[_0x2669('0x8')](),controller[_0x2669('0x12')]);router[_0x2669('0x13')](_0x2669('0x9'),auth[_0x2669('0x8')](),controller[_0x2669('0x14')]);module[_0x2669('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index d4fee7e..b660d28 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 _0x6669=['pdf','xlsx','DATE','Loading','manual','scheduled','UNSIGNED','exports','STRING','ENUM','csv'];(function(_0x11a209,_0x5bffef){var _0x42f66f=function(_0x553314){while(--_0x553314){_0x11a209['push'](_0x11a209['shift']());}};_0x42f66f(++_0x5bffef);}(_0x6669,0xf9));var _0x9666=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x6669[_0x36c5b0];return _0xf19333;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x9666('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x9666('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x9666('0x2')](_0x9666('0x3'),_0x9666('0x4'),_0x9666('0x5')),'allowNull':![],'defaultValue':_0x9666('0x3')},'savename':{'type':Sequelize[_0x9666('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x9666('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0x9666('0x7')},'type':{'type':Sequelize[_0x9666('0x2')](_0x9666('0x8'),_0x9666('0x9')),'allowNull':![],'defaultValue':_0x9666('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x9666('0xa')]},'reportType':{'type':Sequelize[_0x9666('0x1')]}}; \ No newline at end of file +var _0x76c8=['INTEGER','sequelize','moment','exports','STRING','ENUM','pdf','xlsx','DATE','Loading','manual'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x76c8,0xb1));var _0x876c=function(_0x35c11a,_0x3ec30f){_0x35c11a=_0x35c11a-0x0;var _0x16cb6a=_0x76c8[_0x35c11a];return _0x16cb6a;};'use strict';var Sequelize=require(_0x876c('0x0'));var moment=require(_0x876c('0x1'));module[_0x876c('0x2')]={'name':{'type':Sequelize[_0x876c('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x876c('0x4')]('csv',_0x876c('0x5'),_0x876c('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x876c('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x876c('0x7')]},'endDate':{'type':Sequelize[_0x876c('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x876c('0x8')},'type':{'type':Sequelize['ENUM'](_0x876c('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x876c('0x9')},'reportId':{'type':Sequelize[_0x876c('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x876c('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 9516b79..249cae8 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 _0x34b7=['ValidationError','Report\x20not\x20found\x20or\x20empty','exists','root','savename','%s.%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','ExtractedReports','UserProfileResource','end','error','name','send','index','map','AnalyticExtractedReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','basename','output','existsSync','join','server/files/reports','Sequelize'];(function(_0x17a32f,_0x5a51a){var _0x15a293=function(_0x55fbd3){while(--_0x55fbd3){_0x17a32f['push'](_0x17a32f['shift']());}};_0x15a293(++_0x5a51a);}(_0x34b7,0x196));var _0x734b=function(_0x404b9a,_0xca0480){_0x404b9a=_0x404b9a-0x0;var _0x30ba61=_0x34b7[_0x404b9a];return _0x30ba61;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];function respondWithStatusCode(_0x1e0fca,_0x189a82){_0x189a82=_0x189a82||0xcc;return function(_0xff9ddf){if(_0xff9ddf){return _0x1e0fca[_0x734b('0x18')](_0x189a82);}return _0x1e0fca[_0x734b('0x19')](_0x189a82)['end']();};}function respondWithResult(_0x18fc18,_0x252510){_0x252510=_0x252510||0xc8;return function(_0x47791c){if(_0x47791c){return _0x18fc18[_0x734b('0x19')](_0x252510)[_0x734b('0x1a')](_0x47791c);}};}function respondWithFilteredResult(_0x2e00ad,_0x2372bd){return function(_0x2c03bd){if(_0x2c03bd){var _0xa6d111=typeof _0x2372bd[_0x734b('0x1b')]===_0x734b('0x1c')&&typeof _0x2372bd['limit']===_0x734b('0x1c');var _0x2ee290=_0x2c03bd[_0x734b('0x1d')];var _0x5edbe9=_0xa6d111?0x0:_0x2372bd['offset'];var _0x56a95c=_0xa6d111?_0x2c03bd[_0x734b('0x1d')]:_0x2372bd[_0x734b('0x1b')]+_0x2372bd[_0x734b('0x1e')];var _0x41ba87;if(_0x56a95c>=_0x2ee290){_0x56a95c=_0x2ee290;_0x41ba87=0xc8;}else{_0x41ba87=0xce;}_0x2e00ad[_0x734b('0x19')](_0x41ba87);return _0x2e00ad[_0x734b('0x1f')](_0x734b('0x20'),_0x5edbe9+'-'+_0x56a95c+'/'+_0x2ee290)[_0x734b('0x1a')](_0x2c03bd);}return null;};}function patchUpdates(_0x67eed){return function(_0x1d2b27){try{jsonpatch[_0x734b('0x21')](_0x1d2b27,_0x67eed,!![]);}catch(_0x3d0ffd){return BPromise[_0x734b('0x22')](_0x3d0ffd);}return _0x1d2b27[_0x734b('0x23')]();};}function saveUpdates(_0x56f807,_0x1e4dcc){return function(_0x7856d7){if(_0x7856d7){return _0x7856d7['update'](_0x56f807)[_0x734b('0x24')](function(_0x1f81de){return _0x1f81de;});}return null;};}function removeEntity(_0x1a7908,_0x11fb8e){return function(_0x46d432){if(_0x46d432){return _0x46d432[_0x734b('0x25')]()[_0x734b('0x24')](function(){var _0x104fff=_0x46d432[_0x734b('0x26')]({'plain':!![]});var _0x3abbe6=_0x734b('0x27');return db[_0x734b('0x28')][_0x734b('0x25')]({'where':{'type':_0x3abbe6,'resourceId':_0x104fff['id']}})['then'](function(){return _0x46d432;});})['then'](function(){_0x1a7908[_0x734b('0x19')](0xcc)[_0x734b('0x29')]();});}};}function handleEntityNotFound(_0x47a0a9,_0x32ea00){return function(_0x2dd51a){if(!_0x2dd51a){_0x47a0a9[_0x734b('0x18')](0x194);}return _0x2dd51a;};}function handleError(_0x41b501,_0x43edea){_0x43edea=_0x43edea||0x1f4;return function(_0x1b8295){logger[_0x734b('0x2a')](_0x1b8295['stack']);if(_0x1b8295[_0x734b('0x2b')]){delete _0x1b8295[_0x734b('0x2b')];}_0x41b501[_0x734b('0x19')](_0x43edea)[_0x734b('0x2c')](_0x1b8295);};}exports[_0x734b('0x2d')]=function(_0x427c36,_0x1fed72){var _0x21ed3c={},_0x371ead={},_0x3065b0={'count':0x0,'rows':[]};var _0x5dcabf=_[_0x734b('0x2e')](db[_0x734b('0x2f')]['rawAttributes'],function(_0xbbe037){return{'name':_0xbbe037[_0x734b('0x30')],'type':_0xbbe037[_0x734b('0x31')][_0x734b('0x32')]};});_0x371ead[_0x734b('0x33')]=_[_0x734b('0x2e')](_0x5dcabf,_0x734b('0x2b'));_0x371ead[_0x734b('0x34')]=_[_0x734b('0x35')](_0x427c36[_0x734b('0x34')]);_0x371ead[_0x734b('0x36')]=_[_0x734b('0x37')](_0x371ead[_0x734b('0x33')],_0x371ead[_0x734b('0x34')]);_0x21ed3c[_0x734b('0x38')]=_['intersection'](_0x371ead[_0x734b('0x33')],qs['fields'](_0x427c36[_0x734b('0x34')][_0x734b('0x39')]));_0x21ed3c[_0x734b('0x38')]=_0x21ed3c[_0x734b('0x38')][_0x734b('0x3a')]?_0x21ed3c[_0x734b('0x38')]:_0x371ead['model'];if(!_0x427c36['query'][_0x734b('0x3b')]('nolimit')){_0x21ed3c[_0x734b('0x1e')]=qs['limit'](_0x427c36[_0x734b('0x34')]['limit']);_0x21ed3c[_0x734b('0x1b')]=qs['offset'](_0x427c36[_0x734b('0x34')][_0x734b('0x1b')]);}_0x21ed3c[_0x734b('0x3c')]=qs[_0x734b('0x3d')](_0x427c36[_0x734b('0x34')][_0x734b('0x3d')]);_0x21ed3c[_0x734b('0x3e')]=qs['filters'](_[_0x734b('0x3f')](_0x427c36[_0x734b('0x34')],_0x371ead['filters']),_0x5dcabf);if(_0x427c36[_0x734b('0x34')][_0x734b('0x40')]){_0x21ed3c[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x21ed3c['where'],{'$or':_[_0x734b('0x2e')](_0x5dcabf,function(_0x352d28){if(_0x352d28['type']!==_0x734b('0x42')){var _0x1e1689={};_0x1e1689[_0x352d28['name']]={'$like':'%'+_0x427c36[_0x734b('0x34')][_0x734b('0x40')]+'%'};return _0x1e1689;}})});}_0x21ed3c=_[_0x734b('0x41')]({},_0x21ed3c,_0x427c36[_0x734b('0x43')]);var _0x56eb35={'where':_0x21ed3c['where']};return db[_0x734b('0x2f')]['count'](_0x56eb35)['then'](function(_0x121a00){_0x3065b0['count']=_0x121a00;if(_0x427c36[_0x734b('0x34')]['includeAll']){_0x21ed3c[_0x734b('0x44')]=[{'all':!![]}];}return db[_0x734b('0x2f')][_0x734b('0x45')](_0x21ed3c);})['then'](function(_0x5cf3a0){_0x3065b0[_0x734b('0x46')]=_0x5cf3a0;return _0x3065b0;})['then'](respondWithFilteredResult(_0x1fed72,_0x21ed3c))['catch'](handleError(_0x1fed72,null));};exports[_0x734b('0x47')]=function(_0x159db9,_0x58f78a){var _0x2e789e={'raw':!![],'where':{'id':_0x159db9[_0x734b('0x48')]['id']}},_0x513f07={};_0x513f07[_0x734b('0x33')]=_[_0x734b('0x35')](db['AnalyticExtractedReport'][_0x734b('0x49')]);_0x513f07[_0x734b('0x34')]=_[_0x734b('0x35')](_0x159db9[_0x734b('0x34')]);_0x513f07['filters']=_['intersection'](_0x513f07['model'],_0x513f07[_0x734b('0x34')]);_0x2e789e['attributes']=_['intersection'](_0x513f07[_0x734b('0x33')],qs['fields'](_0x159db9[_0x734b('0x34')][_0x734b('0x39')]));_0x2e789e[_0x734b('0x38')]=_0x2e789e[_0x734b('0x38')]['length']?_0x2e789e[_0x734b('0x38')]:_0x513f07['model'];if(_0x159db9[_0x734b('0x34')][_0x734b('0x4a')]){_0x2e789e[_0x734b('0x44')]=[{'all':!![]}];}_0x2e789e=_['merge']({},_0x2e789e,_0x159db9[_0x734b('0x43')]);return db['AnalyticExtractedReport'][_0x734b('0x4b')](_0x2e789e)[_0x734b('0x24')](handleEntityNotFound(_0x58f78a,null))['then'](respondWithResult(_0x58f78a,null))[_0x734b('0x4c')](handleError(_0x58f78a,null));};exports[_0x734b('0x4d')]=function(_0x145ced,_0x38125a){return db[_0x734b('0x2f')]['create'](_0x145ced[_0x734b('0x4e')],{})['then'](function(_0x171575){var _0x5de7b7=_0x145ced[_0x734b('0x4f')][_0x734b('0x26')]({'plain':!![]});if(!_0x5de7b7)throw new Error(_0x734b('0x50'));if(_0x5de7b7[_0x734b('0x51')]===_0x734b('0x4f')){var _0x4b70f2=_0x171575['get']({'plain':!![]});var _0x484156=_0x734b('0x27');return db[_0x734b('0x52')]['find']({'where':{'name':_0x484156,'userProfileId':_0x5de7b7[_0x734b('0x53')]},'raw':!![]})[_0x734b('0x24')](function(_0x588ceb){if(_0x588ceb&&_0x588ceb[_0x734b('0x54')]===0x0){return db[_0x734b('0x28')][_0x734b('0x4d')]({'name':_0x4b70f2['name'],'resourceId':_0x4b70f2['id'],'type':_0x588ceb[_0x734b('0x2b')],'sectionId':_0x588ceb['id']},{})[_0x734b('0x24')](function(){return _0x171575;});}else{return _0x171575;}})[_0x734b('0x4c')](function(_0xe605be){logger['error'](_0x734b('0x55'),_0xe605be);throw _0xe605be;});}return _0x171575;})[_0x734b('0x24')](respondWithResult(_0x38125a,0xc9))[_0x734b('0x4c')](handleError(_0x38125a,null));};exports[_0x734b('0x56')]=function(_0x4b65bf,_0x27f0ff){if(_0x4b65bf['body']['id']){delete _0x4b65bf[_0x734b('0x4e')]['id'];}return db[_0x734b('0x2f')][_0x734b('0x4b')]({'where':{'id':_0x4b65bf[_0x734b('0x48')]['id']}})['then'](handleEntityNotFound(_0x27f0ff,null))[_0x734b('0x24')](saveUpdates(_0x4b65bf[_0x734b('0x4e')],null))['then'](respondWithResult(_0x27f0ff,null))['catch'](handleError(_0x27f0ff,null));};exports[_0x734b('0x25')]=function(_0x577735,_0x16b461){return db[_0x734b('0x2f')][_0x734b('0x4b')]({'where':{'id':_0x577735['params']['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x16b461,null))['then'](removeEntity(_0x16b461,null))[_0x734b('0x4c')](handleError(_0x16b461,null));};exports[_0x734b('0x57')]=function(_0x3c3359,_0x10660d,_0x49a43b){return db[_0x734b('0x2f')]['find']({'where':{'id':_0x3c3359[_0x734b('0x48')]['id']},'attributes':[_0x734b('0x2b'),_0x734b('0x58'),'savename',_0x734b('0x59')],'raw':!![]})['then'](handleEntityNotFound(_0x10660d,null))[_0x734b('0x24')](function(_0x17a217){if(_0x17a217){if(!fs[_0x734b('0x5a')](path[_0x734b('0x5b')](config['root'],_0x734b('0x5c'),_0x17a217['savename']))){throw new db[(_0x734b('0x5d'))][(_0x734b('0x5e'))](_0x734b('0x5f'));}if(_0x3c3359['query'][_0x734b('0x60')]){return _0x10660d[_0x734b('0x18')](0xc8);}return _0x10660d[_0x734b('0x57')](path[_0x734b('0x5b')](config[_0x734b('0x61')],_0x734b('0x5c'),_0x17a217[_0x734b('0x62')]),util['format'](_0x734b('0x63'),_0x17a217[_0x734b('0x58')]||_0x17a217[_0x734b('0x2b')],_0x17a217['output']['toLowerCase']()));}})[_0x734b('0x4c')](handleError(_0x10660d,null));}; \ No newline at end of file +var _0x0598=['json','undefined','limit','count','offset','set','apply','update','destroy','then','get','ExtractedReports','UserProfileResource','end','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','nolimit','order','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','join','server/files/reports','Report\x20not\x20found\x20or\x20empty','exists','root','format','toLowerCase','eml-format','rimraf','fast-json-patch','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status'];(function(_0x5e462b,_0x187b06){var _0xb01a65=function(_0x2cc9a3){while(--_0x2cc9a3){_0x5e462b['push'](_0x5e462b['shift']());}};_0xb01a65(++_0x187b06);}(_0x0598,0x92));var _0x8059=function(_0x37df29,_0x3dccd3){_0x37df29=_0x37df29-0x0;var _0x2eb360=_0x0598[_0x37df29];return _0x2eb360;};'use strict';var emlformat=require(_0x8059('0x0'));var rimraf=require(_0x8059('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8059('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8059('0x3'));var Mustache=require(_0x8059('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8059('0x5'));var ejs=require(_0x8059('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');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 Redis=require(_0x8059('0xc'));var authService=require(_0x8059('0xd'));var qs=require(_0x8059('0xe'));var as=require(_0x8059('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8059('0x10'));var utils=require(_0x8059('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ead10,_0x2d26e2){_0x2d26e2=_0x2d26e2||0xcc;return function(_0x306467){if(_0x306467){return _0x1ead10[_0x8059('0x12')](_0x2d26e2);}return _0x1ead10[_0x8059('0x13')](_0x2d26e2)['end']();};}function respondWithResult(_0x11218f,_0x5480a5){_0x5480a5=_0x5480a5||0xc8;return function(_0x346b23){if(_0x346b23){return _0x11218f['status'](_0x5480a5)[_0x8059('0x14')](_0x346b23);}};}function respondWithFilteredResult(_0x13bf07,_0x4810fd){return function(_0x4d3873){if(_0x4d3873){var _0x516c1f=typeof _0x4810fd['offset']===_0x8059('0x15')&&typeof _0x4810fd[_0x8059('0x16')]===_0x8059('0x15');var _0x246c9d=_0x4d3873[_0x8059('0x17')];var _0x4b6d55=_0x516c1f?0x0:_0x4810fd[_0x8059('0x18')];var _0x2bb670=_0x516c1f?_0x4d3873[_0x8059('0x17')]:_0x4810fd[_0x8059('0x18')]+_0x4810fd['limit'];var _0x5456a9;if(_0x2bb670>=_0x246c9d){_0x2bb670=_0x246c9d;_0x5456a9=0xc8;}else{_0x5456a9=0xce;}_0x13bf07['status'](_0x5456a9);return _0x13bf07[_0x8059('0x19')]('Content-Range',_0x4b6d55+'-'+_0x2bb670+'/'+_0x246c9d)[_0x8059('0x14')](_0x4d3873);}return null;};}function patchUpdates(_0x56d794){return function(_0x466a88){try{jsonpatch[_0x8059('0x1a')](_0x466a88,_0x56d794,!![]);}catch(_0x1e9ac5){return BPromise['reject'](_0x1e9ac5);}return _0x466a88['save']();};}function saveUpdates(_0x21a80f,_0x232f1b){return function(_0x32aeda){if(_0x32aeda){return _0x32aeda[_0x8059('0x1b')](_0x21a80f)['then'](function(_0x3bc226){return _0x3bc226;});}return null;};}function removeEntity(_0x21ac82,_0x3da080){return function(_0x5449d9){if(_0x5449d9){return _0x5449d9[_0x8059('0x1c')]()[_0x8059('0x1d')](function(){var _0x3e1067=_0x5449d9[_0x8059('0x1e')]({'plain':!![]});var _0x59d3a6=_0x8059('0x1f');return db[_0x8059('0x20')][_0x8059('0x1c')]({'where':{'type':_0x59d3a6,'resourceId':_0x3e1067['id']}})[_0x8059('0x1d')](function(){return _0x5449d9;});})[_0x8059('0x1d')](function(){_0x21ac82['status'](0xcc)[_0x8059('0x21')]();});}};}function handleEntityNotFound(_0x19b95a,_0xd1fa7e){return function(_0x4a294f){if(!_0x4a294f){_0x19b95a['sendStatus'](0x194);}return _0x4a294f;};}function handleError(_0x5d5b45,_0x1f3d05){_0x1f3d05=_0x1f3d05||0x1f4;return function(_0xbebe0e){logger[_0x8059('0x22')](_0xbebe0e[_0x8059('0x23')]);if(_0xbebe0e['name']){delete _0xbebe0e[_0x8059('0x24')];}_0x5d5b45['status'](_0x1f3d05)[_0x8059('0x25')](_0xbebe0e);};}exports[_0x8059('0x26')]=function(_0x5ecf7f,_0x3814f5){var _0x1aead2={},_0x30aac2={},_0x260ba8={'count':0x0,'rows':[]};var _0x2799b7=_[_0x8059('0x27')](db[_0x8059('0x28')][_0x8059('0x29')],function(_0x505756){return{'name':_0x505756[_0x8059('0x2a')],'type':_0x505756[_0x8059('0x2b')][_0x8059('0x2c')]};});_0x30aac2[_0x8059('0x2d')]=_[_0x8059('0x27')](_0x2799b7,'name');_0x30aac2[_0x8059('0x2e')]=_[_0x8059('0x2f')](_0x5ecf7f[_0x8059('0x2e')]);_0x30aac2[_0x8059('0x30')]=_[_0x8059('0x31')](_0x30aac2[_0x8059('0x2d')],_0x30aac2[_0x8059('0x2e')]);_0x1aead2[_0x8059('0x32')]=_[_0x8059('0x31')](_0x30aac2[_0x8059('0x2d')],qs['fields'](_0x5ecf7f[_0x8059('0x2e')]['fields']));_0x1aead2[_0x8059('0x32')]=_0x1aead2['attributes']['length']?_0x1aead2[_0x8059('0x32')]:_0x30aac2['model'];if(!_0x5ecf7f[_0x8059('0x2e')]['hasOwnProperty'](_0x8059('0x33'))){_0x1aead2['limit']=qs[_0x8059('0x16')](_0x5ecf7f[_0x8059('0x2e')]['limit']);_0x1aead2[_0x8059('0x18')]=qs[_0x8059('0x18')](_0x5ecf7f[_0x8059('0x2e')]['offset']);}_0x1aead2[_0x8059('0x34')]=qs['sort'](_0x5ecf7f[_0x8059('0x2e')]['sort']);_0x1aead2[_0x8059('0x35')]=qs[_0x8059('0x30')](_[_0x8059('0x36')](_0x5ecf7f[_0x8059('0x2e')],_0x30aac2['filters']),_0x2799b7);if(_0x5ecf7f[_0x8059('0x2e')]['filter']){_0x1aead2['where']=_[_0x8059('0x37')](_0x1aead2[_0x8059('0x35')],{'$or':_[_0x8059('0x27')](_0x2799b7,function(_0x8aa012){if(_0x8aa012[_0x8059('0x2b')]!=='VIRTUAL'){var _0x47c3b9={};_0x47c3b9[_0x8aa012['name']]={'$like':'%'+_0x5ecf7f['query'][_0x8059('0x38')]+'%'};return _0x47c3b9;}})});}_0x1aead2=_[_0x8059('0x37')]({},_0x1aead2,_0x5ecf7f[_0x8059('0x39')]);var _0x4a0323={'where':_0x1aead2[_0x8059('0x35')]};return db[_0x8059('0x28')]['count'](_0x4a0323)[_0x8059('0x1d')](function(_0x2980cb){_0x260ba8[_0x8059('0x17')]=_0x2980cb;if(_0x5ecf7f['query'][_0x8059('0x3a')]){_0x1aead2[_0x8059('0x3b')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x8059('0x3c')](_0x1aead2);})[_0x8059('0x1d')](function(_0x3f00de){_0x260ba8[_0x8059('0x3d')]=_0x3f00de;return _0x260ba8;})[_0x8059('0x1d')](respondWithFilteredResult(_0x3814f5,_0x1aead2))[_0x8059('0x3e')](handleError(_0x3814f5,null));};exports[_0x8059('0x3f')]=function(_0x1bf30e,_0x3687a0){var _0x3b7a28={'raw':!![],'where':{'id':_0x1bf30e[_0x8059('0x40')]['id']}},_0x1d64db={};_0x1d64db[_0x8059('0x2d')]=_[_0x8059('0x2f')](db[_0x8059('0x28')][_0x8059('0x29')]);_0x1d64db[_0x8059('0x2e')]=_[_0x8059('0x2f')](_0x1bf30e[_0x8059('0x2e')]);_0x1d64db[_0x8059('0x30')]=_[_0x8059('0x31')](_0x1d64db[_0x8059('0x2d')],_0x1d64db[_0x8059('0x2e')]);_0x3b7a28['attributes']=_[_0x8059('0x31')](_0x1d64db['model'],qs['fields'](_0x1bf30e[_0x8059('0x2e')]['fields']));_0x3b7a28[_0x8059('0x32')]=_0x3b7a28['attributes'][_0x8059('0x41')]?_0x3b7a28[_0x8059('0x32')]:_0x1d64db[_0x8059('0x2d')];if(_0x1bf30e[_0x8059('0x2e')][_0x8059('0x3a')]){_0x3b7a28[_0x8059('0x3b')]=[{'all':!![]}];}_0x3b7a28=_['merge']({},_0x3b7a28,_0x1bf30e[_0x8059('0x39')]);return db['AnalyticExtractedReport'][_0x8059('0x42')](_0x3b7a28)[_0x8059('0x1d')](handleEntityNotFound(_0x3687a0,null))[_0x8059('0x1d')](respondWithResult(_0x3687a0,null))['catch'](handleError(_0x3687a0,null));};exports[_0x8059('0x43')]=function(_0x120665,_0x46bec8){return db[_0x8059('0x28')]['create'](_0x120665[_0x8059('0x44')],{})[_0x8059('0x1d')](function(_0x109748){var _0x48e3bb=_0x120665[_0x8059('0x45')]['get']({'plain':!![]});if(!_0x48e3bb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48e3bb[_0x8059('0x46')]==='user'){var _0x20caa3=_0x109748['get']({'plain':!![]});var _0x261967=_0x8059('0x1f');return db['UserProfileSection'][_0x8059('0x42')]({'where':{'name':_0x261967,'userProfileId':_0x48e3bb['userProfileId']},'raw':!![]})[_0x8059('0x1d')](function(_0x7a844b){if(_0x7a844b&&_0x7a844b[_0x8059('0x47')]===0x0){return db['UserProfileResource'][_0x8059('0x43')]({'name':_0x20caa3['name'],'resourceId':_0x20caa3['id'],'type':_0x7a844b[_0x8059('0x24')],'sectionId':_0x7a844b['id']},{})[_0x8059('0x1d')](function(){return _0x109748;});}else{return _0x109748;}})[_0x8059('0x3e')](function(_0xb63fee){logger['error'](_0x8059('0x48'),_0xb63fee);throw _0xb63fee;});}return _0x109748;})[_0x8059('0x1d')](respondWithResult(_0x46bec8,0xc9))['catch'](handleError(_0x46bec8,null));};exports[_0x8059('0x1b')]=function(_0x5886fd,_0xa1b2cf){if(_0x5886fd['body']['id']){delete _0x5886fd['body']['id'];}return db[_0x8059('0x28')][_0x8059('0x42')]({'where':{'id':_0x5886fd[_0x8059('0x40')]['id']}})[_0x8059('0x1d')](handleEntityNotFound(_0xa1b2cf,null))[_0x8059('0x1d')](saveUpdates(_0x5886fd[_0x8059('0x44')],null))[_0x8059('0x1d')](respondWithResult(_0xa1b2cf,null))['catch'](handleError(_0xa1b2cf,null));};exports['destroy']=function(_0x52ed37,_0x50eef3){return db[_0x8059('0x28')][_0x8059('0x42')]({'where':{'id':_0x52ed37['params']['id']}})[_0x8059('0x1d')](handleEntityNotFound(_0x50eef3,null))['then'](removeEntity(_0x50eef3,null))['catch'](handleError(_0x50eef3,null));};exports[_0x8059('0x49')]=function(_0x55cb8d,_0x11b69a,_0x27dfa5){return db[_0x8059('0x28')]['find']({'where':{'id':_0x55cb8d['params']['id']},'attributes':[_0x8059('0x24'),_0x8059('0x4a'),_0x8059('0x4b'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x11b69a,null))[_0x8059('0x1d')](function(_0x538460){if(_0x538460){if(!fs['existsSync'](path[_0x8059('0x4c')](config['root'],_0x8059('0x4d'),_0x538460[_0x8059('0x4b')]))){throw new db['Sequelize']['ValidationError'](_0x8059('0x4e'));}if(_0x55cb8d[_0x8059('0x2e')][_0x8059('0x4f')]){return _0x11b69a['sendStatus'](0xc8);}return _0x11b69a[_0x8059('0x49')](path[_0x8059('0x4c')](config[_0x8059('0x50')],_0x8059('0x4d'),_0x538460['savename']),util[_0x8059('0x51')]('%s.%s',_0x538460[_0x8059('0x4a')]||_0x538460[_0x8059('0x24')],_0x538460['output'][_0x8059('0x52')]()));}})['catch'](handleError(_0x11b69a,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index ad037e5..a1c8f98 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 _0x7164=['define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5c83b5,_0xece97d){var _0x30b5a6=function(_0x37ed9a){while(--_0x37ed9a){_0x5c83b5['push'](_0x5c83b5['shift']());}};_0x30b5a6(++_0xece97d);}(_0x7164,0xb9));var _0x4716=function(_0x4e9e0d,_0xd86384){_0x4e9e0d=_0x4e9e0d-0x0;var _0x514622=_0x7164[_0x4e9e0d];return _0x514622;};'use strict';var _=require(_0x4716('0x0'));var util=require(_0x4716('0x1'));var logger=require(_0x4716('0x2'))(_0x4716('0x3'));var moment=require(_0x4716('0x4'));var BPromise=require('bluebird');var rp=require(_0x4716('0x5'));var fs=require('fs');var path=require(_0x4716('0x6'));var rimraf=require(_0x4716('0x7'));var config=require(_0x4716('0x8'));var attributes=require('./analyticExtractedReport.attributes');module[_0x4716('0x9')]=function(_0x6f3676,_0x51b7ff){return _0x6f3676[_0x4716('0xa')](_0x4716('0xb'),attributes,{'tableName':_0x4716('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4e7=['rimraf','../../config/environment','./analyticExtractedReport.attributes','define','analytics_extracted_reports','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd4e7,0x1d3));var _0x7d4e=function(_0x5f423b,_0x1c2c3b){_0x5f423b=_0x5f423b-0x0;var _0x5a9972=_0xd4e7[_0x5f423b];return _0x5a9972;};'use strict';var _=require(_0x7d4e('0x0'));var util=require('util');var logger=require(_0x7d4e('0x1'))(_0x7d4e('0x2'));var moment=require(_0x7d4e('0x3'));var BPromise=require(_0x7d4e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d4e('0x5'));var rimraf=require(_0x7d4e('0x6'));var config=require(_0x7d4e('0x7'));var attributes=require(_0x7d4e('0x8'));module['exports']=function(_0x30a619,_0xf33641){return _0x30a619[_0x7d4e('0x9')]('AnalyticExtractedReport',attributes,{'tableName':_0x7d4e('0xa'),'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 7348d5d..7f9031e 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 _0xa01f=['AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x577fd6,_0x1dcea3){var _0x4c6101=function(_0x54b820){while(--_0x54b820){_0x577fd6['push'](_0x577fd6['shift']());}};_0x4c6101(++_0x1dcea3);}(_0xa01f,0x17a));var _0xfa01=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xa01f[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require(_0xfa01('0x0'));var moment=require('moment');var BPromise=require(_0xfa01('0x1'));var rs=require(_0xfa01('0x2'));var fs=require('fs');var Redis=require(_0xfa01('0x3'));var db=require(_0xfa01('0x4'))['db'];var utils=require(_0xfa01('0x5'));var logger=require(_0xfa01('0x6'))('rpc');var config=require(_0xfa01('0x7'));var jayson=require(_0xfa01('0x8'));var client=jayson[_0xfa01('0x9')][_0xfa01('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5025a5,_0x199a28,_0x19fcdf){return new BPromise(function(_0x5f3b6c,_0x9a00e4){return client[_0xfa01('0xb')](_0x5025a5,_0x19fcdf)[_0xfa01('0xc')](function(_0x5a8ae8){logger['info'](_0xfa01('0xd'),_0x199a28,_0xfa01('0xe'));logger[_0xfa01('0xf')](_0xfa01('0x10'),_0x199a28,_0xfa01('0xe'),JSON[_0xfa01('0x11')](_0x5a8ae8));if(_0x5a8ae8[_0xfa01('0x12')]){if(_0x5a8ae8[_0xfa01('0x12')][_0xfa01('0x13')]===0x1f4){logger[_0xfa01('0x12')](_0xfa01('0xd'),_0x199a28,_0x5a8ae8[_0xfa01('0x12')][_0xfa01('0x14')]);return _0x9a00e4(_0x5a8ae8[_0xfa01('0x12')]['message']);}logger[_0xfa01('0x12')](_0xfa01('0xd'),_0x199a28,_0x5a8ae8['error'][_0xfa01('0x14')]);return _0x5f3b6c(_0x5a8ae8[_0xfa01('0x12')]['message']);}else{logger['info'](_0xfa01('0xd'),_0x199a28,_0xfa01('0xe'));_0x5f3b6c(_0x5a8ae8[_0xfa01('0x15')]['message']);}})[_0xfa01('0x16')](function(_0x43d916){logger[_0xfa01('0x12')](_0xfa01('0xd'),_0x199a28,_0x43d916);_0x9a00e4(_0x43d916);});});} \ No newline at end of file +var _0xe4e8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x15f3c0,_0x165a64){var _0x1adfe0=function(_0x212cfc){while(--_0x212cfc){_0x15f3c0['push'](_0x15f3c0['shift']());}};_0x1adfe0(++_0x165a64);}(_0xe4e8,0x1dc));var _0x8e4e=function(_0x9bf8b1,_0x39f7fd){_0x9bf8b1=_0x9bf8b1-0x0;var _0x30c31c=_0xe4e8[_0x9bf8b1];return _0x30c31c;};'use strict';var _=require(_0x8e4e('0x0'));var util=require(_0x8e4e('0x1'));var moment=require('moment');var BPromise=require(_0x8e4e('0x2'));var rs=require(_0x8e4e('0x3'));var fs=require('fs');var Redis=require(_0x8e4e('0x4'));var db=require(_0x8e4e('0x5'))['db'];var utils=require(_0x8e4e('0x6'));var logger=require(_0x8e4e('0x7'))(_0x8e4e('0x8'));var config=require(_0x8e4e('0x9'));var jayson=require(_0x8e4e('0xa'));var client=jayson[_0x8e4e('0xb')][_0x8e4e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe85646,_0x3f4cb4,_0x3d6c4f){return new BPromise(function(_0xa2fef2,_0x4de118){return client[_0x8e4e('0xd')](_0xe85646,_0x3d6c4f)['then'](function(_0x2c0e19){logger[_0x8e4e('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3f4cb4,_0x8e4e('0xf'));logger[_0x8e4e('0x10')](_0x8e4e('0x11'),_0x3f4cb4,_0x8e4e('0xf'),JSON[_0x8e4e('0x12')](_0x2c0e19));if(_0x2c0e19[_0x8e4e('0x13')]){if(_0x2c0e19[_0x8e4e('0x13')]['code']===0x1f4){logger[_0x8e4e('0x13')](_0x8e4e('0x14'),_0x3f4cb4,_0x2c0e19['error'][_0x8e4e('0x15')]);return _0x4de118(_0x2c0e19['error'][_0x8e4e('0x15')]);}logger[_0x8e4e('0x13')](_0x8e4e('0x14'),_0x3f4cb4,_0x2c0e19[_0x8e4e('0x13')]['message']);return _0xa2fef2(_0x2c0e19['error'][_0x8e4e('0x15')]);}else{logger[_0x8e4e('0xe')](_0x8e4e('0x14'),_0x3f4cb4,'request\x20sent');_0xa2fef2(_0x2c0e19[_0x8e4e('0x16')][_0x8e4e('0x15')]);}})[_0x8e4e('0x17')](function(_0x2e60b1){logger['error'](_0x8e4e('0x14'),_0x3f4cb4,_0x2e60b1);_0x4de118(_0x2e60b1);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 0965976..1bbac58 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 _0xd814=['get','isAuthenticated','index','/:id','show','/:id/download','download','create','put','update','delete','destroy','exports','multer','path','fs-extra','../../components/auth/service','./analyticExtractedReport.controller'];(function(_0x14e63c,_0x5bdf28){var _0x29ac6c=function(_0x1ec1e4){while(--_0x1ec1e4){_0x14e63c['push'](_0x14e63c['shift']());}};_0x29ac6c(++_0x5bdf28);}(_0xd814,0x79));var _0x4d81=function(_0x31822f,_0x2fbb72){_0x31822f=_0x31822f-0x0;var _0x1892a8=_0xd814[_0x31822f];return _0x1892a8;};'use strict';var multer=require(_0x4d81('0x0'));var util=require('util');var path=require(_0x4d81('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4d81('0x2'));var auth=require(_0x4d81('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4d81('0x4'));router[_0x4d81('0x5')]('/',auth[_0x4d81('0x6')](),controller[_0x4d81('0x7')]);router[_0x4d81('0x5')](_0x4d81('0x8'),auth[_0x4d81('0x6')](),controller[_0x4d81('0x9')]);router['get'](_0x4d81('0xa'),auth[_0x4d81('0x6')](),controller[_0x4d81('0xb')]);router['post']('/',auth[_0x4d81('0x6')](),controller[_0x4d81('0xc')]);router[_0x4d81('0xd')](_0x4d81('0x8'),auth['isAuthenticated'](),controller[_0x4d81('0xe')]);router[_0x4d81('0xf')](_0x4d81('0x8'),auth['isAuthenticated'](),controller[_0x4d81('0x10')]);module[_0x4d81('0x11')]=router; \ No newline at end of file +var _0x1c84=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create'];(function(_0x22ca79,_0x2b9706){var _0x50b7b3=function(_0x4a9b21){while(--_0x4a9b21){_0x22ca79['push'](_0x22ca79['shift']());}};_0x50b7b3(++_0x2b9706);}(_0x1c84,0x138));var _0x41c8=function(_0xca6909,_0x31d421){_0xca6909=_0xca6909-0x0;var _0x44d08e=_0x1c84[_0xca6909];return _0x44d08e;};'use strict';var multer=require(_0x41c8('0x0'));var util=require(_0x41c8('0x1'));var path=require(_0x41c8('0x2'));var timeout=require(_0x41c8('0x3'));var express=require(_0x41c8('0x4'));var router=express[_0x41c8('0x5')]();var fs_extra=require(_0x41c8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x41c8('0x7'));var config=require(_0x41c8('0x8'));var controller=require(_0x41c8('0x9'));router[_0x41c8('0xa')]('/',auth[_0x41c8('0xb')](),controller['index']);router[_0x41c8('0xa')](_0x41c8('0xc'),auth[_0x41c8('0xb')](),controller[_0x41c8('0xd')]);router['get'](_0x41c8('0xe'),auth[_0x41c8('0xb')](),controller[_0x41c8('0xf')]);router[_0x41c8('0x10')]('/',auth['isAuthenticated'](),controller[_0x41c8('0x11')]);router[_0x41c8('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x41c8('0x13')]);router['delete'](_0x41c8('0xc'),auth['isAuthenticated'](),controller[_0x41c8('0x14')]);module[_0x41c8('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index cccd1fd..383ecfe 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 _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x1d1d57,_0x52cd46){var _0x73a2eb=function(_0xba9bd3){while(--_0xba9bd3){_0x1d1d57['push'](_0x1d1d57['shift']());}};_0x73a2eb(++_0x52cd46);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc4aa[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'field':{'type':Sequelize[_0xac4a('0x2')]},'alias':{'type':Sequelize[_0xac4a('0x3')]},'function':{'type':Sequelize[_0xac4a('0x3')]},'format':{'type':Sequelize[_0xac4a('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x230127,_0x4d989b){var _0x234e71=function(_0x2c694b){while(--_0x2c694b){_0x230127['push'](_0x230127['shift']());}};_0x234e71(++_0x4d989b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0x5fc3[_0x31a576];return _0x30b1d3;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x35fc('0x2')]},'function':{'type':Sequelize[_0x35fc('0x2')]},'format':{'type':Sequelize[_0x35fc('0x2')]},'groupBy':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35fc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index c201874..db2ac5a 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 _0xa9e0=['util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','options','includeAll','include','findAll','catch','show','params','find','body','bulkCreate','ids','addFields','AnalyticCustomReport','findOne','eml-format','rimraf','zip-dir','moment','mustache'];(function(_0x34ce26,_0x16daab){var _0x11a16c=function(_0x15a995){while(--_0x15a995){_0x34ce26['push'](_0x34ce26['shift']());}};_0x11a16c(++_0x16daab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x45')]=function(_0x45c845,_0x37be73){return db[_0x0a9e('0x28')]['bulkCreate'](_0x45c845[_0x0a9e('0x44')],{'raw':![],'individualHooks':!![]})[_0x0a9e('0x22')](respondWithResult(_0x37be73,0xc9))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x21')]=function(_0x409789,_0x992c77){if(_0x409789[_0x0a9e('0x44')]['id']){delete _0x409789[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x409789[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x992c77,null))['then'](saveUpdates(_0x409789['body'],null))['then'](respondWithResult(_0x992c77,null))[_0x0a9e('0x40')](handleError(_0x992c77,null));};exports[_0x0a9e('0x23')]=function(_0x37edaa,_0x11545a){return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x37edaa[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x11545a,null))['then'](removeEntity(_0x11545a,null))['catch'](handleError(_0x11545a,null));};exports['bulkDestroy']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x28')]['destroy']({'where':{'id':_0x39d77d[_0x0a9e('0x2e')][_0x0a9e('0x46')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x204173,0xcc))['catch'](handleError(_0x204173,null));};exports[_0x0a9e('0x47')]=function(_0x59c6ff,_0x443e72,_0x4c3845){return db[_0x0a9e('0x48')][_0x0a9e('0x49')]({'where':{'id':_0x59c6ff[_0x0a9e('0x42')]['id']}})['then'](handleEntityNotFound(_0x443e72,null))[_0x0a9e('0x22')](function(_0x1bf38a){if(_0x1bf38a){return db['sequelize']['transaction'](function(_0x128aa6){return db[_0x0a9e('0x28')]['destroy']({'where':{'CustomReportId':_0x59c6ff[_0x0a9e('0x42')]['id']},'transaction':_0x128aa6})['then'](function(_0x211ef9){var _0x523cd2=_[_0x0a9e('0x2d')](_0x59c6ff['body'],function(_0x5da27d){delete _0x5da27d['id'];_0x5da27d['CustomReportId']=_0x59c6ff[_0x0a9e('0x42')]['id'];return _0x5da27d;});return db['AnalyticFieldReport'][_0x0a9e('0x45')](_0x523cd2,{'transaction':_0x128aa6});});})[_0x0a9e('0x22')](function(){return db[_0x0a9e('0x28')][_0x0a9e('0x3f')]({'where':{'CustomReportId':_0x59c6ff[_0x0a9e('0x42')]['id']}});});}})[_0x0a9e('0x22')](respondWithResult(_0x443e72,null))[_0x0a9e('0x40')](handleError(_0x443e72,null));}; \ No newline at end of file +var _0xa9e0=['util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','options','includeAll','include','findAll','catch','show','params','find','body','bulkCreate','ids','addFields','AnalyticCustomReport','findOne','eml-format','rimraf','zip-dir','moment','mustache'];(function(_0xd1f854,_0x532346){var _0x548294=function(_0x4be823){while(--_0x4be823){_0xd1f854['push'](_0xd1f854['shift']());}};_0x548294(++_0x532346);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x45')]=function(_0x45c845,_0x37be73){return db[_0x0a9e('0x28')]['bulkCreate'](_0x45c845[_0x0a9e('0x44')],{'raw':![],'individualHooks':!![]})[_0x0a9e('0x22')](respondWithResult(_0x37be73,0xc9))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x21')]=function(_0x409789,_0x992c77){if(_0x409789[_0x0a9e('0x44')]['id']){delete _0x409789[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x409789[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x992c77,null))['then'](saveUpdates(_0x409789['body'],null))['then'](respondWithResult(_0x992c77,null))[_0x0a9e('0x40')](handleError(_0x992c77,null));};exports[_0x0a9e('0x23')]=function(_0x37edaa,_0x11545a){return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x37edaa[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x11545a,null))['then'](removeEntity(_0x11545a,null))['catch'](handleError(_0x11545a,null));};exports['bulkDestroy']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x28')]['destroy']({'where':{'id':_0x39d77d[_0x0a9e('0x2e')][_0x0a9e('0x46')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x204173,0xcc))['catch'](handleError(_0x204173,null));};exports[_0x0a9e('0x47')]=function(_0x59c6ff,_0x443e72,_0x4c3845){return db[_0x0a9e('0x48')][_0x0a9e('0x49')]({'where':{'id':_0x59c6ff[_0x0a9e('0x42')]['id']}})['then'](handleEntityNotFound(_0x443e72,null))[_0x0a9e('0x22')](function(_0x1bf38a){if(_0x1bf38a){return db['sequelize']['transaction'](function(_0x128aa6){return db[_0x0a9e('0x28')]['destroy']({'where':{'CustomReportId':_0x59c6ff[_0x0a9e('0x42')]['id']},'transaction':_0x128aa6})['then'](function(_0x211ef9){var _0x523cd2=_[_0x0a9e('0x2d')](_0x59c6ff['body'],function(_0x5da27d){delete _0x5da27d['id'];_0x5da27d['CustomReportId']=_0x59c6ff[_0x0a9e('0x42')]['id'];return _0x5da27d;});return db['AnalyticFieldReport'][_0x0a9e('0x45')](_0x523cd2,{'transaction':_0x128aa6});});})[_0x0a9e('0x22')](function(){return db[_0x0a9e('0x28')][_0x0a9e('0x3f')]({'where':{'CustomReportId':_0x59c6ff[_0x0a9e('0x42')]['id']}});});}})[_0x0a9e('0x22')](respondWithResult(_0x443e72,null))[_0x0a9e('0x40')](handleError(_0x443e72,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index c08ad78..cae87bf 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 _0x55d4=['../../config/environment','exports','define','AnalyticFieldReport','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x5c2566,_0x1c3ba9){var _0xe59976=function(_0x389024){while(--_0x389024){_0x5c2566['push'](_0x5c2566['shift']());}};_0xe59976(++_0x1c3ba9);}(_0x55d4,0xe8));var _0x455d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x55d4[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x455d('0x0'));var util=require(_0x455d('0x1'));var logger=require(_0x455d('0x2'))(_0x455d('0x3'));var moment=require(_0x455d('0x4'));var BPromise=require('bluebird');var rp=require(_0x455d('0x5'));var fs=require('fs');var path=require(_0x455d('0x6'));var rimraf=require(_0x455d('0x7'));var config=require(_0x455d('0x8'));var attributes=require('./analyticFieldReport.attributes');module[_0x455d('0x9')]=function(_0x1fcad9,_0x4d3c48){return _0x1fcad9[_0x455d('0xa')](_0x455d('0xb'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9956=['./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x1a0c16,_0x46b7ea){var _0x435b04=function(_0x1e70b7){while(--_0x1e70b7){_0x1a0c16['push'](_0x1a0c16['shift']());}};_0x435b04(++_0x46b7ea);}(_0x9956,0x1cc));var _0x6995=function(_0x297788,_0x3334c2){_0x297788=_0x297788-0x0;var _0x271736=_0x9956[_0x297788];return _0x271736;};'use strict';var _=require(_0x6995('0x0'));var util=require(_0x6995('0x1'));var logger=require(_0x6995('0x2'))(_0x6995('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6995('0x4'));var fs=require('fs');var path=require(_0x6995('0x5'));var rimraf=require(_0x6995('0x6'));var config=require(_0x6995('0x7'));var attributes=require(_0x6995('0x8'));module[_0x6995('0x9')]=function(_0x38602a,_0x11d0d4){return _0x38602a[_0x6995('0xa')](_0x6995('0xb'),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 d58e903..2c898ce 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 _0x5234=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x572618,_0x287468){var _0x113a44=function(_0x2d4e17){while(--_0x2d4e17){_0x572618['push'](_0x572618['shift']());}};_0x113a44(++_0x287468);}(_0x5234,0x13d));var _0x4523=function(_0x3ae73d,_0x36ac2a){_0x3ae73d=_0x3ae73d-0x0;var _0xc4b66b=_0x5234[_0x3ae73d];return _0xc4b66b;};'use strict';var _=require(_0x4523('0x0'));var util=require(_0x4523('0x1'));var moment=require('moment');var BPromise=require(_0x4523('0x2'));var rs=require(_0x4523('0x3'));var fs=require('fs');var Redis=require(_0x4523('0x4'));var db=require(_0x4523('0x5'))['db'];var utils=require(_0x4523('0x6'));var logger=require(_0x4523('0x7'))('rpc');var config=require(_0x4523('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c90a0,_0x445fe8,_0x3518b4){return new BPromise(function(_0x111cc4,_0x56ccec){return client[_0x4523('0x9')](_0x5c90a0,_0x3518b4)['then'](function(_0x11233b){logger[_0x4523('0xa')](_0x4523('0xb'),_0x445fe8,_0x4523('0xc'));logger[_0x4523('0xd')](_0x4523('0xe'),_0x445fe8,_0x4523('0xc'),JSON[_0x4523('0xf')](_0x11233b));if(_0x11233b[_0x4523('0x10')]){if(_0x11233b[_0x4523('0x10')][_0x4523('0x11')]===0x1f4){logger[_0x4523('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x445fe8,_0x11233b[_0x4523('0x10')][_0x4523('0x12')]);return _0x56ccec(_0x11233b[_0x4523('0x10')]['message']);}logger[_0x4523('0x10')](_0x4523('0xb'),_0x445fe8,_0x11233b[_0x4523('0x10')][_0x4523('0x12')]);return _0x111cc4(_0x11233b[_0x4523('0x10')]['message']);}else{logger[_0x4523('0xa')]('AnalyticFieldReport,\x20%s,\x20%s',_0x445fe8,'request\x20sent');_0x111cc4(_0x11233b[_0x4523('0x13')][_0x4523('0x12')]);}})[_0x4523('0x14')](function(_0x4bcabc){logger[_0x4523('0x10')](_0x4523('0xb'),_0x445fe8,_0x4bcabc);_0x56ccec(_0x4bcabc);});});} \ No newline at end of file +var _0x9e6e=['code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x29cc08,_0x1b58dc){var _0xd9877e=function(_0x1ce11a){while(--_0x1ce11a){_0x29cc08['push'](_0x29cc08['shift']());}};_0xd9877e(++_0x1b58dc);}(_0x9e6e,0xc1));var _0xe9e6=function(_0x4d843f,_0x4a4401){_0x4d843f=_0x4d843f-0x0;var _0x58a99e=_0x9e6e[_0x4d843f];return _0x58a99e;};'use strict';var _=require(_0xe9e6('0x0'));var util=require(_0xe9e6('0x1'));var moment=require(_0xe9e6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9e6('0x3'));var db=require(_0xe9e6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe9e6('0x5'))(_0xe9e6('0x6'));var config=require(_0xe9e6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe9e6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cc033,_0x45ad16,_0x24b1ef){return new BPromise(function(_0x2738c4,_0x588d6a){return client[_0xe9e6('0x9')](_0x3cc033,_0x24b1ef)['then'](function(_0xaa470c){logger[_0xe9e6('0xa')](_0xe9e6('0xb'),_0x45ad16,_0xe9e6('0xc'));logger[_0xe9e6('0xd')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x45ad16,_0xe9e6('0xc'),JSON[_0xe9e6('0xe')](_0xaa470c));if(_0xaa470c[_0xe9e6('0xf')]){if(_0xaa470c[_0xe9e6('0xf')][_0xe9e6('0x10')]===0x1f4){logger[_0xe9e6('0xf')](_0xe9e6('0xb'),_0x45ad16,_0xaa470c['error']['message']);return _0x588d6a(_0xaa470c['error']['message']);}logger[_0xe9e6('0xf')](_0xe9e6('0xb'),_0x45ad16,_0xaa470c[_0xe9e6('0xf')]['message']);return _0x2738c4(_0xaa470c[_0xe9e6('0xf')][_0xe9e6('0x11')]);}else{logger[_0xe9e6('0xa')](_0xe9e6('0xb'),_0x45ad16,'request\x20sent');_0x2738c4(_0xaa470c['result'][_0xe9e6('0x11')]);}})[_0xe9e6('0x12')](function(_0xc384bd){logger[_0xe9e6('0xf')](_0xe9e6('0xb'),_0x45ad16,_0xc384bd);_0x588d6a(_0xc384bd);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index bd45e1b..dd682bf 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 _0xfdc3=['bulkCreate','/:id/create_many','addFields','put','/:id','delete','/destroy_many','bulkDestroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','post','isAuthenticated','create','/create_many'];(function(_0xe6e5e6,_0x15c461){var _0x312393=function(_0x16896b){while(--_0x16896b){_0xe6e5e6['push'](_0xe6e5e6['shift']());}};_0x312393(++_0x15c461);}(_0xfdc3,0x1be));var _0x3fdc=function(_0x547928,_0x26050e){_0x547928=_0x547928-0x0;var _0x3ade56=_0xfdc3[_0x547928];return _0x3ade56;};'use strict';var multer=require(_0x3fdc('0x0'));var util=require(_0x3fdc('0x1'));var path=require(_0x3fdc('0x2'));var timeout=require(_0x3fdc('0x3'));var express=require('express');var router=express[_0x3fdc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3fdc('0x5'));var interaction=require(_0x3fdc('0x6'));var config=require(_0x3fdc('0x7'));var controller=require(_0x3fdc('0x8'));router[_0x3fdc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3fdc('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3fdc('0xa')]('/',auth[_0x3fdc('0xb')](),controller[_0x3fdc('0xc')]);router[_0x3fdc('0xa')](_0x3fdc('0xd'),auth['isAuthenticated'](),controller[_0x3fdc('0xe')]);router['post'](_0x3fdc('0xf'),auth['isAuthenticated'](),controller[_0x3fdc('0x10')]);router[_0x3fdc('0x11')](_0x3fdc('0x12'),auth[_0x3fdc('0xb')](),controller['update']);router[_0x3fdc('0x13')](_0x3fdc('0x14'),auth[_0x3fdc('0xb')](),controller[_0x3fdc('0x15')]);router[_0x3fdc('0x13')](_0x3fdc('0x12'),auth[_0x3fdc('0xb')](),controller['destroy']);module[_0x3fdc('0x16')]=router; \ No newline at end of file +var _0xb215=['update','/destroy_many','bulkDestroy','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','bulkCreate','/:id/create_many','addFields','put'];(function(_0x4a95b8,_0x347dbd){var _0x182c44=function(_0x1ad58d){while(--_0x1ad58d){_0x4a95b8['push'](_0x4a95b8['shift']());}};_0x182c44(++_0x347dbd);}(_0xb215,0xa7));var _0x5b21=function(_0x340c8d,_0x52809a){_0x340c8d=_0x340c8d-0x0;var _0x343c80=_0xb215[_0x340c8d];return _0x343c80;};'use strict';var multer=require(_0x5b21('0x0'));var util=require('util');var path=require(_0x5b21('0x1'));var timeout=require(_0x5b21('0x2'));var express=require(_0x5b21('0x3'));var router=express[_0x5b21('0x4')]();var fs_extra=require(_0x5b21('0x5'));var auth=require(_0x5b21('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticFieldReport.controller');router[_0x5b21('0x7')]('/',auth[_0x5b21('0x8')](),controller[_0x5b21('0x9')]);router[_0x5b21('0x7')](_0x5b21('0xa'),auth[_0x5b21('0x8')](),controller[_0x5b21('0xb')]);router[_0x5b21('0xc')]('/',auth[_0x5b21('0x8')](),controller['create']);router['post']('/create_many',auth['isAuthenticated'](),controller[_0x5b21('0xd')]);router[_0x5b21('0xc')](_0x5b21('0xe'),auth[_0x5b21('0x8')](),controller[_0x5b21('0xf')]);router[_0x5b21('0x10')](_0x5b21('0xa'),auth[_0x5b21('0x8')](),controller[_0x5b21('0x11')]);router['delete'](_0x5b21('0x12'),auth[_0x5b21('0x8')](),controller[_0x5b21('0x13')]);router[_0x5b21('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x5b21('0x15')]);module[_0x5b21('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index a554748..87e63ab 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 _0x9649=['sequelize','exports','name','STRING','TEXT'];(function(_0x38e471,_0x2c42f5){var _0x136cd2=function(_0x5aac05){while(--_0x5aac05){_0x38e471['push'](_0x38e471['shift']());}};_0x136cd2(++_0x2c42f5);}(_0x9649,0x118));var _0x9964=function(_0x246fe1,_0x4046c4){_0x246fe1=_0x246fe1-0x0;var _0x1f95d9=_0x9649[_0x246fe1];return _0x1f95d9;};'use strict';var Sequelize=require(_0x9964('0x0'));module[_0x9964('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9964('0x2')},'table':{'type':Sequelize[_0x9964('0x3')]},'metric':{'type':Sequelize[_0x9964('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x63a2=['STRING','sequelize','exports','name','TEXT'];(function(_0x2d736f,_0x41a79d){var _0x126801=function(_0x5ea5af){while(--_0x5ea5af){_0x2d736f['push'](_0x2d736f['shift']());}};_0x126801(++_0x41a79d);}(_0x63a2,0x1e1));var _0x263a=function(_0x58039d,_0x572459){_0x58039d=_0x58039d-0x0;var _0x580a6f=_0x63a2[_0x58039d];return _0x580a6f;};'use strict';var Sequelize=require(_0x263a('0x0'));module[_0x263a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x263a('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x263a('0x3')]},'description':{'type':Sequelize[_0x263a('0x4')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 70c7e1d..d75d3fa 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 _0xec46=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','Metrics','UserProfileResource','error','stack','name','index','map','AnalyticMetric','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','includeAll','include','findAll','rows','params','rawAttributes','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3fa754,_0x52d083){var _0x2ccc71=function(_0x5d4d2c){while(--_0x5d4d2c){_0x3fa754['push'](_0x3fa754['shift']());}};_0x2ccc71(++_0x52d083);}(_0xec46,0x96));var _0x6ec4=function(_0x981548,_0xd8b65e){_0x981548=_0x981548-0x0;var _0x142cc8=_0xec46[_0x981548];return _0x142cc8;};'use strict';var emlformat=require(_0x6ec4('0x0'));var rimraf=require(_0x6ec4('0x1'));var zipdir=require(_0x6ec4('0x2'));var jsonpatch=require(_0x6ec4('0x3'));var rp=require('request-promise');var moment=require(_0x6ec4('0x4'));var BPromise=require(_0x6ec4('0x5'));var Mustache=require(_0x6ec4('0x6'));var util=require(_0x6ec4('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6ec4('0x8'));var ejs=require(_0x6ec4('0x9'));var fs=require('fs');var fs_extra=require(_0x6ec4('0xa'));var _=require(_0x6ec4('0xb'));var squel=require(_0x6ec4('0xc'));var crypto=require('crypto');var jsforce=require(_0x6ec4('0xd'));var deskjs=require(_0x6ec4('0xe'));var toCsv=require(_0x6ec4('0x8'));var querystring=require(_0x6ec4('0xf'));var Papa=require(_0x6ec4('0x10'));var Redis=require(_0x6ec4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6ec4('0x12'));var as=require(_0x6ec4('0x13'));var hardwareService=require(_0x6ec4('0x14'));var logger=require(_0x6ec4('0x15'))('api');var utils=require(_0x6ec4('0x16'));var config=require(_0x6ec4('0x17'));var licenseUtil=require(_0x6ec4('0x18'));var db=require(_0x6ec4('0x19'))['db'];function respondWithStatusCode(_0x4bfc69,_0x22b4d0){_0x22b4d0=_0x22b4d0||0xcc;return function(_0x18ef5d){if(_0x18ef5d){return _0x4bfc69[_0x6ec4('0x1a')](_0x22b4d0);}return _0x4bfc69[_0x6ec4('0x1b')](_0x22b4d0)[_0x6ec4('0x1c')]();};}function respondWithResult(_0x38f65a,_0x366443){_0x366443=_0x366443||0xc8;return function(_0x206c4a){if(_0x206c4a){return _0x38f65a[_0x6ec4('0x1b')](_0x366443)[_0x6ec4('0x1d')](_0x206c4a);}};}function respondWithFilteredResult(_0x7f76a6,_0x30c924){return function(_0x475e55){if(_0x475e55){var _0x24f425=typeof _0x30c924[_0x6ec4('0x1e')]==='undefined'&&typeof _0x30c924['limit']===_0x6ec4('0x1f');var _0x285463=_0x475e55['count'];var _0x5306c4=_0x24f425?0x0:_0x30c924[_0x6ec4('0x1e')];var _0x38b439=_0x24f425?_0x475e55[_0x6ec4('0x20')]:_0x30c924[_0x6ec4('0x1e')]+_0x30c924[_0x6ec4('0x21')];var _0x3b887e;if(_0x38b439>=_0x285463){_0x38b439=_0x285463;_0x3b887e=0xc8;}else{_0x3b887e=0xce;}_0x7f76a6[_0x6ec4('0x1b')](_0x3b887e);return _0x7f76a6['set'](_0x6ec4('0x22'),_0x5306c4+'-'+_0x38b439+'/'+_0x285463)[_0x6ec4('0x1d')](_0x475e55);}return null;};}function patchUpdates(_0x5b88d6){return function(_0x31c3ef){try{jsonpatch['apply'](_0x31c3ef,_0x5b88d6,!![]);}catch(_0x57faa8){return BPromise[_0x6ec4('0x23')](_0x57faa8);}return _0x31c3ef[_0x6ec4('0x24')]();};}function saveUpdates(_0x86de92,_0x3c8310){return function(_0x59bd7c){if(_0x59bd7c){return _0x59bd7c[_0x6ec4('0x25')](_0x86de92)[_0x6ec4('0x26')](function(_0x41f109){return _0x41f109;});}return null;};}function removeEntity(_0x33f54d,_0x4e41e4){return function(_0x13b770){if(_0x13b770){return _0x13b770[_0x6ec4('0x27')]()[_0x6ec4('0x26')](function(){var _0x26bc08=_0x13b770['get']({'plain':!![]});var _0x497269=_0x6ec4('0x28');return db[_0x6ec4('0x29')][_0x6ec4('0x27')]({'where':{'type':_0x497269,'resourceId':_0x26bc08['id']}})[_0x6ec4('0x26')](function(){return _0x13b770;});})[_0x6ec4('0x26')](function(){_0x33f54d[_0x6ec4('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e66b5,_0xa7bfa9){return function(_0x447ac5){if(!_0x447ac5){_0x1e66b5[_0x6ec4('0x1a')](0x194);}return _0x447ac5;};}function handleError(_0x35dd99,_0x1b0255){_0x1b0255=_0x1b0255||0x1f4;return function(_0x575a37){logger[_0x6ec4('0x2a')](_0x575a37[_0x6ec4('0x2b')]);if(_0x575a37['name']){delete _0x575a37[_0x6ec4('0x2c')];}_0x35dd99[_0x6ec4('0x1b')](_0x1b0255)['send'](_0x575a37);};}exports[_0x6ec4('0x2d')]=function(_0x3d71c1,_0xb947c7){var _0x1aae9c={},_0x1013d6={},_0x4dcee1={'count':0x0,'rows':[]};var _0x231d0c=_[_0x6ec4('0x2e')](db[_0x6ec4('0x2f')]['rawAttributes'],function(_0x765874){return{'name':_0x765874[_0x6ec4('0x30')],'type':_0x765874[_0x6ec4('0x31')][_0x6ec4('0x32')]};});_0x1013d6['model']=_[_0x6ec4('0x2e')](_0x231d0c,_0x6ec4('0x2c'));_0x1013d6['query']=_[_0x6ec4('0x33')](_0x3d71c1[_0x6ec4('0x34')]);_0x1013d6[_0x6ec4('0x35')]=_[_0x6ec4('0x36')](_0x1013d6['model'],_0x1013d6[_0x6ec4('0x34')]);_0x1aae9c[_0x6ec4('0x37')]=_[_0x6ec4('0x36')](_0x1013d6[_0x6ec4('0x38')],qs[_0x6ec4('0x39')](_0x3d71c1[_0x6ec4('0x34')][_0x6ec4('0x39')]));_0x1aae9c[_0x6ec4('0x37')]=_0x1aae9c[_0x6ec4('0x37')][_0x6ec4('0x3a')]?_0x1aae9c[_0x6ec4('0x37')]:_0x1013d6[_0x6ec4('0x38')];if(!_0x3d71c1[_0x6ec4('0x34')][_0x6ec4('0x3b')](_0x6ec4('0x3c'))){_0x1aae9c[_0x6ec4('0x21')]=qs[_0x6ec4('0x21')](_0x3d71c1['query']['limit']);_0x1aae9c[_0x6ec4('0x1e')]=qs[_0x6ec4('0x1e')](_0x3d71c1[_0x6ec4('0x34')]['offset']);}_0x1aae9c[_0x6ec4('0x3d')]=qs[_0x6ec4('0x3e')](_0x3d71c1[_0x6ec4('0x34')][_0x6ec4('0x3e')]);_0x1aae9c[_0x6ec4('0x3f')]=qs[_0x6ec4('0x35')](_['pick'](_0x3d71c1[_0x6ec4('0x34')],_0x1013d6[_0x6ec4('0x35')]),_0x231d0c);if(_0x3d71c1[_0x6ec4('0x34')][_0x6ec4('0x40')]){_0x1aae9c[_0x6ec4('0x3f')]=_['merge'](_0x1aae9c[_0x6ec4('0x3f')],{'$or':_[_0x6ec4('0x2e')](_0x231d0c,function(_0xf34789){if(_0xf34789[_0x6ec4('0x31')]!==_0x6ec4('0x41')){var _0xdd65a8={};_0xdd65a8[_0xf34789['name']]={'$like':'%'+_0x3d71c1[_0x6ec4('0x34')][_0x6ec4('0x40')]+'%'};return _0xdd65a8;}})});}_0x1aae9c=_['merge']({},_0x1aae9c,_0x3d71c1['options']);var _0x4c2402={'where':_0x1aae9c['where']};return db[_0x6ec4('0x2f')][_0x6ec4('0x20')](_0x4c2402)[_0x6ec4('0x26')](function(_0x3bf064){_0x4dcee1[_0x6ec4('0x20')]=_0x3bf064;if(_0x3d71c1['query'][_0x6ec4('0x42')]){_0x1aae9c[_0x6ec4('0x43')]=[{'all':!![]}];}return db[_0x6ec4('0x2f')][_0x6ec4('0x44')](_0x1aae9c);})[_0x6ec4('0x26')](function(_0x3ae4d9){_0x4dcee1[_0x6ec4('0x45')]=_0x3ae4d9;return _0x4dcee1;})[_0x6ec4('0x26')](respondWithFilteredResult(_0xb947c7,_0x1aae9c))['catch'](handleError(_0xb947c7,null));};exports['show']=function(_0x1bdaac,_0x24a585){var _0x248575={'raw':!![],'where':{'id':_0x1bdaac[_0x6ec4('0x46')]['id']}},_0x443957={};_0x443957[_0x6ec4('0x38')]=_[_0x6ec4('0x33')](db['AnalyticMetric'][_0x6ec4('0x47')]);_0x443957[_0x6ec4('0x34')]=_[_0x6ec4('0x33')](_0x1bdaac['query']);_0x443957[_0x6ec4('0x35')]=_[_0x6ec4('0x36')](_0x443957[_0x6ec4('0x38')],_0x443957['query']);_0x248575[_0x6ec4('0x37')]=_[_0x6ec4('0x36')](_0x443957[_0x6ec4('0x38')],qs[_0x6ec4('0x39')](_0x1bdaac[_0x6ec4('0x34')][_0x6ec4('0x39')]));_0x248575['attributes']=_0x248575[_0x6ec4('0x37')][_0x6ec4('0x3a')]?_0x248575[_0x6ec4('0x37')]:_0x443957[_0x6ec4('0x38')];if(_0x1bdaac[_0x6ec4('0x34')][_0x6ec4('0x42')]){_0x248575[_0x6ec4('0x43')]=[{'all':!![]}];}_0x248575=_['merge']({},_0x248575,_0x1bdaac[_0x6ec4('0x48')]);return db[_0x6ec4('0x2f')][_0x6ec4('0x49')](_0x248575)[_0x6ec4('0x26')](handleEntityNotFound(_0x24a585,null))['then'](respondWithResult(_0x24a585,null))[_0x6ec4('0x4a')](handleError(_0x24a585,null));};exports[_0x6ec4('0x4b')]=function(_0x524dc9,_0x1dd9f5){return db[_0x6ec4('0x2f')]['create'](_0x524dc9[_0x6ec4('0x4c')],{})['then'](function(_0x8d28b5){var _0x59089c=_0x524dc9['user']['get']({'plain':!![]});if(!_0x59089c)throw new Error(_0x6ec4('0x4d'));if(_0x59089c[_0x6ec4('0x4e')]===_0x6ec4('0x4f')){var _0x34e744=_0x8d28b5[_0x6ec4('0x50')]({'plain':!![]});var _0x3c6356='Metrics';return db[_0x6ec4('0x51')]['find']({'where':{'name':_0x3c6356,'userProfileId':_0x59089c[_0x6ec4('0x52')]},'raw':!![]})[_0x6ec4('0x26')](function(_0x2d3890){if(_0x2d3890&&_0x2d3890[_0x6ec4('0x53')]===0x0){return db['UserProfileResource'][_0x6ec4('0x4b')]({'name':_0x34e744[_0x6ec4('0x2c')],'resourceId':_0x34e744['id'],'type':_0x2d3890['name'],'sectionId':_0x2d3890['id']},{})['then'](function(){return _0x8d28b5;});}else{return _0x8d28b5;}})['catch'](function(_0x1facbf){logger[_0x6ec4('0x2a')](_0x6ec4('0x54'),_0x1facbf);throw _0x1facbf;});}return _0x8d28b5;})[_0x6ec4('0x26')](respondWithResult(_0x1dd9f5,0xc9))[_0x6ec4('0x4a')](handleError(_0x1dd9f5,null));};exports['update']=function(_0x6053d5,_0x24f025){if(_0x6053d5['body']['id']){delete _0x6053d5['body']['id'];}return db[_0x6ec4('0x2f')][_0x6ec4('0x49')]({'where':{'id':_0x6053d5[_0x6ec4('0x46')]['id']}})[_0x6ec4('0x26')](handleEntityNotFound(_0x24f025,null))['then'](saveUpdates(_0x6053d5[_0x6ec4('0x4c')],null))[_0x6ec4('0x26')](respondWithResult(_0x24f025,null))[_0x6ec4('0x4a')](handleError(_0x24f025,null));};exports[_0x6ec4('0x27')]=function(_0x5d5c12,_0x432663){return db[_0x6ec4('0x2f')][_0x6ec4('0x49')]({'where':{'id':_0x5d5c12['params']['id']}})[_0x6ec4('0x26')](handleEntityNotFound(_0x432663,null))[_0x6ec4('0x26')](removeEntity(_0x432663,null))[_0x6ec4('0x4a')](handleError(_0x432663,null));}; \ No newline at end of file +var _0x417f=['attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','params','include','options','find','catch','create','body','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','get','Metrics','UserProfileResource','error','name','index','map','AnalyticMetric','rawAttributes','type','model','query','keys','filters','intersection'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0x417f,0xac));var _0xf417=function(_0x216d27,_0x1e825e){_0x216d27=_0x216d27-0x0;var _0x583aa6=_0x417f[_0x216d27];return _0x583aa6;};'use strict';var emlformat=require(_0xf417('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf417('0x1'));var jsonpatch=require(_0xf417('0x2'));var rp=require(_0xf417('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf417('0x4'));var path=require(_0xf417('0x5'));var sox=require('sox');var csv=require(_0xf417('0x6'));var ejs=require(_0xf417('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf417('0x8'));var squel=require('squel');var crypto=require(_0xf417('0x9'));var jsforce=require(_0xf417('0xa'));var deskjs=require(_0xf417('0xb'));var toCsv=require(_0xf417('0x6'));var querystring=require(_0xf417('0xc'));var Papa=require(_0xf417('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf417('0xe'));var as=require(_0xf417('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf417('0x10'))(_0xf417('0x11'));var utils=require('../../config/utils');var config=require(_0xf417('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xf417('0x13'))['db'];function respondWithStatusCode(_0x44b4ab,_0x417e01){_0x417e01=_0x417e01||0xcc;return function(_0x6c0fe7){if(_0x6c0fe7){return _0x44b4ab[_0xf417('0x14')](_0x417e01);}return _0x44b4ab[_0xf417('0x15')](_0x417e01)[_0xf417('0x16')]();};}function respondWithResult(_0x2e0f12,_0x2ddd9e){_0x2ddd9e=_0x2ddd9e||0xc8;return function(_0x4acb5e){if(_0x4acb5e){return _0x2e0f12[_0xf417('0x15')](_0x2ddd9e)[_0xf417('0x17')](_0x4acb5e);}};}function respondWithFilteredResult(_0x296dec,_0x1bb2db){return function(_0x3fb6f3){if(_0x3fb6f3){var _0x2b531d=typeof _0x1bb2db['offset']===_0xf417('0x18')&&typeof _0x1bb2db[_0xf417('0x19')]==='undefined';var _0x551714=_0x3fb6f3['count'];var _0xc4aa24=_0x2b531d?0x0:_0x1bb2db[_0xf417('0x1a')];var _0x44d9af=_0x2b531d?_0x3fb6f3[_0xf417('0x1b')]:_0x1bb2db[_0xf417('0x1a')]+_0x1bb2db[_0xf417('0x19')];var _0x5698be;if(_0x44d9af>=_0x551714){_0x44d9af=_0x551714;_0x5698be=0xc8;}else{_0x5698be=0xce;}_0x296dec[_0xf417('0x15')](_0x5698be);return _0x296dec[_0xf417('0x1c')](_0xf417('0x1d'),_0xc4aa24+'-'+_0x44d9af+'/'+_0x551714)[_0xf417('0x17')](_0x3fb6f3);}return null;};}function patchUpdates(_0x3dbfd1){return function(_0x2eafca){try{jsonpatch[_0xf417('0x1e')](_0x2eafca,_0x3dbfd1,!![]);}catch(_0x17eb25){return BPromise['reject'](_0x17eb25);}return _0x2eafca[_0xf417('0x1f')]();};}function saveUpdates(_0xfc8f6d,_0xdb1e30){return function(_0x4a48e9){if(_0x4a48e9){return _0x4a48e9[_0xf417('0x20')](_0xfc8f6d)[_0xf417('0x21')](function(_0x2aa9ae){return _0x2aa9ae;});}return null;};}function removeEntity(_0x4add0f,_0x51a27){return function(_0x3df8ae){if(_0x3df8ae){return _0x3df8ae[_0xf417('0x22')]()['then'](function(){var _0x126678=_0x3df8ae[_0xf417('0x23')]({'plain':!![]});var _0xed30e8=_0xf417('0x24');return db[_0xf417('0x25')][_0xf417('0x22')]({'where':{'type':_0xed30e8,'resourceId':_0x126678['id']}})[_0xf417('0x21')](function(){return _0x3df8ae;});})['then'](function(){_0x4add0f['status'](0xcc)[_0xf417('0x16')]();});}};}function handleEntityNotFound(_0x37a12b,_0x44d6aa){return function(_0x56bbeb){if(!_0x56bbeb){_0x37a12b[_0xf417('0x14')](0x194);}return _0x56bbeb;};}function handleError(_0x2819ea,_0x3febef){_0x3febef=_0x3febef||0x1f4;return function(_0x58419f){logger[_0xf417('0x26')](_0x58419f['stack']);if(_0x58419f[_0xf417('0x27')]){delete _0x58419f[_0xf417('0x27')];}_0x2819ea[_0xf417('0x15')](_0x3febef)['send'](_0x58419f);};}exports[_0xf417('0x28')]=function(_0x508ac7,_0x2375cc){var _0x580b08={},_0x1dfc26={},_0x5212b8={'count':0x0,'rows':[]};var _0x3175f9=_[_0xf417('0x29')](db[_0xf417('0x2a')][_0xf417('0x2b')],function(_0x1bd41d){return{'name':_0x1bd41d['fieldName'],'type':_0x1bd41d[_0xf417('0x2c')]['key']};});_0x1dfc26[_0xf417('0x2d')]=_[_0xf417('0x29')](_0x3175f9,_0xf417('0x27'));_0x1dfc26[_0xf417('0x2e')]=_[_0xf417('0x2f')](_0x508ac7[_0xf417('0x2e')]);_0x1dfc26[_0xf417('0x30')]=_[_0xf417('0x31')](_0x1dfc26[_0xf417('0x2d')],_0x1dfc26[_0xf417('0x2e')]);_0x580b08[_0xf417('0x32')]=_[_0xf417('0x31')](_0x1dfc26[_0xf417('0x2d')],qs[_0xf417('0x33')](_0x508ac7['query'][_0xf417('0x33')]));_0x580b08[_0xf417('0x32')]=_0x580b08['attributes']['length']?_0x580b08[_0xf417('0x32')]:_0x1dfc26['model'];if(!_0x508ac7[_0xf417('0x2e')]['hasOwnProperty'](_0xf417('0x34'))){_0x580b08[_0xf417('0x19')]=qs['limit'](_0x508ac7[_0xf417('0x2e')][_0xf417('0x19')]);_0x580b08['offset']=qs[_0xf417('0x1a')](_0x508ac7[_0xf417('0x2e')][_0xf417('0x1a')]);}_0x580b08[_0xf417('0x35')]=qs[_0xf417('0x36')](_0x508ac7[_0xf417('0x2e')]['sort']);_0x580b08[_0xf417('0x37')]=qs[_0xf417('0x30')](_[_0xf417('0x38')](_0x508ac7[_0xf417('0x2e')],_0x1dfc26[_0xf417('0x30')]),_0x3175f9);if(_0x508ac7['query'][_0xf417('0x39')]){_0x580b08[_0xf417('0x37')]=_[_0xf417('0x3a')](_0x580b08['where'],{'$or':_[_0xf417('0x29')](_0x3175f9,function(_0x360e95){if(_0x360e95['type']!==_0xf417('0x3b')){var _0x5c2da5={};_0x5c2da5[_0x360e95[_0xf417('0x27')]]={'$like':'%'+_0x508ac7[_0xf417('0x2e')][_0xf417('0x39')]+'%'};return _0x5c2da5;}})});}_0x580b08=_[_0xf417('0x3a')]({},_0x580b08,_0x508ac7['options']);var _0x37ad22={'where':_0x580b08['where']};return db[_0xf417('0x2a')][_0xf417('0x1b')](_0x37ad22)[_0xf417('0x21')](function(_0x324d80){_0x5212b8[_0xf417('0x1b')]=_0x324d80;if(_0x508ac7[_0xf417('0x2e')][_0xf417('0x3c')]){_0x580b08['include']=[{'all':!![]}];}return db[_0xf417('0x2a')][_0xf417('0x3d')](_0x580b08);})[_0xf417('0x21')](function(_0x423431){_0x5212b8[_0xf417('0x3e')]=_0x423431;return _0x5212b8;})[_0xf417('0x21')](respondWithFilteredResult(_0x2375cc,_0x580b08))['catch'](handleError(_0x2375cc,null));};exports['show']=function(_0xc27b81,_0xb430b8){var _0x25b809={'raw':!![],'where':{'id':_0xc27b81[_0xf417('0x3f')]['id']}},_0x39b899={};_0x39b899[_0xf417('0x2d')]=_[_0xf417('0x2f')](db[_0xf417('0x2a')][_0xf417('0x2b')]);_0x39b899['query']=_[_0xf417('0x2f')](_0xc27b81[_0xf417('0x2e')]);_0x39b899[_0xf417('0x30')]=_[_0xf417('0x31')](_0x39b899[_0xf417('0x2d')],_0x39b899[_0xf417('0x2e')]);_0x25b809[_0xf417('0x32')]=_['intersection'](_0x39b899['model'],qs[_0xf417('0x33')](_0xc27b81[_0xf417('0x2e')][_0xf417('0x33')]));_0x25b809['attributes']=_0x25b809['attributes']['length']?_0x25b809[_0xf417('0x32')]:_0x39b899['model'];if(_0xc27b81[_0xf417('0x2e')]['includeAll']){_0x25b809[_0xf417('0x40')]=[{'all':!![]}];}_0x25b809=_[_0xf417('0x3a')]({},_0x25b809,_0xc27b81[_0xf417('0x41')]);return db[_0xf417('0x2a')][_0xf417('0x42')](_0x25b809)[_0xf417('0x21')](handleEntityNotFound(_0xb430b8,null))[_0xf417('0x21')](respondWithResult(_0xb430b8,null))[_0xf417('0x43')](handleError(_0xb430b8,null));};exports[_0xf417('0x44')]=function(_0x2bb7c2,_0x37c0a4){return db[_0xf417('0x2a')][_0xf417('0x44')](_0x2bb7c2[_0xf417('0x45')],{})[_0xf417('0x21')](function(_0x4dc855){var _0x30cf98=_0x2bb7c2[_0xf417('0x46')][_0xf417('0x23')]({'plain':!![]});if(!_0x30cf98)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30cf98['role']===_0xf417('0x46')){var _0x122565=_0x4dc855[_0xf417('0x23')]({'plain':!![]});var _0x49530c='Metrics';return db['UserProfileSection'][_0xf417('0x42')]({'where':{'name':_0x49530c,'userProfileId':_0x30cf98[_0xf417('0x47')]},'raw':!![]})[_0xf417('0x21')](function(_0x21124f){if(_0x21124f&&_0x21124f[_0xf417('0x48')]===0x0){return db[_0xf417('0x25')][_0xf417('0x44')]({'name':_0x122565[_0xf417('0x27')],'resourceId':_0x122565['id'],'type':_0x21124f[_0xf417('0x27')],'sectionId':_0x21124f['id']},{})[_0xf417('0x21')](function(){return _0x4dc855;});}else{return _0x4dc855;}})['catch'](function(_0x251cde){logger['error'](_0xf417('0x49'),_0x251cde);throw _0x251cde;});}return _0x4dc855;})[_0xf417('0x21')](respondWithResult(_0x37c0a4,0xc9))[_0xf417('0x43')](handleError(_0x37c0a4,null));};exports[_0xf417('0x20')]=function(_0x381891,_0x274840){if(_0x381891['body']['id']){delete _0x381891[_0xf417('0x45')]['id'];}return db[_0xf417('0x2a')][_0xf417('0x42')]({'where':{'id':_0x381891['params']['id']}})[_0xf417('0x21')](handleEntityNotFound(_0x274840,null))[_0xf417('0x21')](saveUpdates(_0x381891[_0xf417('0x45')],null))['then'](respondWithResult(_0x274840,null))[_0xf417('0x43')](handleError(_0x274840,null));};exports[_0xf417('0x22')]=function(_0x3946b6,_0x49d41c){return db[_0xf417('0x2a')]['find']({'where':{'id':_0x3946b6['params']['id']}})[_0xf417('0x21')](handleEntityNotFound(_0x49d41c,null))['then'](removeEntity(_0x49d41c,null))[_0xf417('0x43')](handleError(_0x49d41c,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 237a5f9..722ed8f 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 _0x3c90=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','exports','analytics_metrics','lodash'];(function(_0x2607f7,_0x5965be){var _0xf16f13=function(_0xf55f1b){while(--_0xf55f1b){_0x2607f7['push'](_0x2607f7['shift']());}};_0xf16f13(++_0x5965be);}(_0x3c90,0x18b));var _0x03c9=function(_0x3dd8c7,_0x3778d9){_0x3dd8c7=_0x3dd8c7-0x0;var _0x214fae=_0x3c90[_0x3dd8c7];return _0x214fae;};'use strict';var _=require(_0x03c9('0x0'));var util=require(_0x03c9('0x1'));var logger=require(_0x03c9('0x2'))(_0x03c9('0x3'));var moment=require(_0x03c9('0x4'));var BPromise=require(_0x03c9('0x5'));var rp=require(_0x03c9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x03c9('0x7'));var config=require(_0x03c9('0x8'));var attributes=require(_0x03c9('0x9'));module[_0x03c9('0xa')]=function(_0x442ad7,_0x19583a){return _0x442ad7['define']('AnalyticMetric',attributes,{'tableName':_0x03c9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e91=['bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment'];(function(_0x257d17,_0x54bbc7){var _0x4dd4f1=function(_0x575309){while(--_0x575309){_0x257d17['push'](_0x257d17['shift']());}};_0x4dd4f1(++_0x54bbc7);}(_0x2e91,0x1bb));var _0x12e9=function(_0x26fdfd,_0x561340){_0x26fdfd=_0x26fdfd-0x0;var _0x5460f5=_0x2e91[_0x26fdfd];return _0x5460f5;};'use strict';var _=require(_0x12e9('0x0'));var util=require(_0x12e9('0x1'));var logger=require(_0x12e9('0x2'))(_0x12e9('0x3'));var moment=require(_0x12e9('0x4'));var BPromise=require(_0x12e9('0x5'));var rp=require(_0x12e9('0x6'));var fs=require('fs');var path=require(_0x12e9('0x7'));var rimraf=require('rimraf');var config=require(_0x12e9('0x8'));var attributes=require(_0x12e9('0x9'));module[_0x12e9('0xa')]=function(_0x3f22be,_0x34619b){return _0x3f22be[_0x12e9('0xb')](_0x12e9('0xc'),attributes,{'tableName':_0x12e9('0xd'),'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 fabbfb0..fdb8339 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 _0x6430=['request','then','info','AnalyticMetric,\x20%s,\x20%s','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','catch','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x6430,0x83));var _0x0643=function(_0x360820,_0x1de9b1){_0x360820=_0x360820-0x0;var _0x52c17d=_0x6430[_0x360820];return _0x52c17d;};'use strict';var _=require(_0x0643('0x0'));var util=require('util');var moment=require(_0x0643('0x1'));var BPromise=require(_0x0643('0x2'));var rs=require(_0x0643('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0643('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0643('0x5'));var config=require(_0x0643('0x6'));var jayson=require(_0x0643('0x7'));var client=jayson[_0x0643('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3189ba,_0x45b211,_0x34ddaf){return new BPromise(function(_0x4542fa,_0x460a93){return client[_0x0643('0x9')](_0x3189ba,_0x34ddaf)[_0x0643('0xa')](function(_0x1ea7bf){logger[_0x0643('0xb')](_0x0643('0xc'),_0x45b211,'request\x20sent');logger['debug'](_0x0643('0xd'),_0x45b211,'request\x20sent',JSON[_0x0643('0xe')](_0x1ea7bf));if(_0x1ea7bf['error']){if(_0x1ea7bf['error'][_0x0643('0xf')]===0x1f4){logger[_0x0643('0x10')](_0x0643('0xc'),_0x45b211,_0x1ea7bf['error'][_0x0643('0x11')]);return _0x460a93(_0x1ea7bf['error'][_0x0643('0x11')]);}logger['error'](_0x0643('0xc'),_0x45b211,_0x1ea7bf[_0x0643('0x10')][_0x0643('0x11')]);return _0x4542fa(_0x1ea7bf[_0x0643('0x10')][_0x0643('0x11')]);}else{logger['info'](_0x0643('0xc'),_0x45b211,_0x0643('0x12'));_0x4542fa(_0x1ea7bf['result'][_0x0643('0x11')]);}})[_0x0643('0x13')](function(_0x46a1df){logger[_0x0643('0x10')](_0x0643('0xc'),_0x45b211,_0x46a1df);_0x460a93(_0x46a1df);});});} \ No newline at end of file +var _0x29c2=['../../config/environment','jayson/promise','client','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x54f87e,_0x336419){var _0x3e20ce=function(_0x486831){while(--_0x486831){_0x54f87e['push'](_0x54f87e['shift']());}};_0x3e20ce(++_0x336419);}(_0x29c2,0x10c));var _0x229c=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x29c2[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var util=require(_0x229c('0x0'));var moment=require('moment');var BPromise=require(_0x229c('0x1'));var rs=require(_0x229c('0x2'));var fs=require('fs');var Redis=require(_0x229c('0x3'));var db=require(_0x229c('0x4'))['db'];var utils=require(_0x229c('0x5'));var logger=require(_0x229c('0x6'))(_0x229c('0x7'));var config=require(_0x229c('0x8'));var jayson=require(_0x229c('0x9'));var client=jayson[_0x229c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20ed01,_0x34906d,_0x80e0b4){return new BPromise(function(_0x4ec1e0,_0x534c8f){return client['request'](_0x20ed01,_0x80e0b4)[_0x229c('0xb')](function(_0x1b018d){logger[_0x229c('0xc')](_0x229c('0xd'),_0x34906d,_0x229c('0xe'));logger[_0x229c('0xf')](_0x229c('0x10'),_0x34906d,'request\x20sent',JSON[_0x229c('0x11')](_0x1b018d));if(_0x1b018d['error']){if(_0x1b018d['error'][_0x229c('0x12')]===0x1f4){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x34906d,_0x1b018d['error'][_0x229c('0x13')]);return _0x534c8f(_0x1b018d['error'][_0x229c('0x13')]);}logger[_0x229c('0x14')](_0x229c('0xd'),_0x34906d,_0x1b018d['error']['message']);return _0x4ec1e0(_0x1b018d[_0x229c('0x14')][_0x229c('0x13')]);}else{logger[_0x229c('0xc')](_0x229c('0xd'),_0x34906d,_0x229c('0xe'));_0x4ec1e0(_0x1b018d[_0x229c('0x15')][_0x229c('0x13')]);}})[_0x229c('0x16')](function(_0x4aea52){logger[_0x229c('0x14')](_0x229c('0xd'),_0x34906d,_0x4aea52);_0x534c8f(_0x4aea52);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index c58e276..fae4d14 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 _0x7916=['/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','isAuthenticated','index'];(function(_0x3d5feb,_0x9773a2){var _0x28a3b0=function(_0x3a534e){while(--_0x3a534e){_0x3d5feb['push'](_0x3d5feb['shift']());}};_0x28a3b0(++_0x9773a2);}(_0x7916,0x128));var _0x6791=function(_0x3ff598,_0x37e3a2){_0x3ff598=_0x3ff598-0x0;var _0x2fe97b=_0x7916[_0x3ff598];return _0x2fe97b;};'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 fs_extra=require(_0x6791('0x4'));var auth=require(_0x6791('0x5'));var interaction=require(_0x6791('0x6'));var config=require('../../config/environment');var controller=require(_0x6791('0x7'));router['get']('/',auth[_0x6791('0x8')](),controller[_0x6791('0x9')]);router['get'](_0x6791('0xa'),auth['isAuthenticated'](),controller[_0x6791('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6791('0xc')]);router[_0x6791('0xd')]('/:id',auth[_0x6791('0x8')](),controller[_0x6791('0xe')]);router[_0x6791('0xf')]('/:id',auth[_0x6791('0x8')](),controller[_0x6791('0x10')]);module[_0x6791('0x11')]=router; \ No newline at end of file +var _0x878f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','/:id','isAuthenticated','update','exports','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x878f,0x173));var _0xf878=function(_0x58b857,_0x4c2aa6){_0x58b857=_0x58b857-0x0;var _0x20b9ba=_0x878f[_0x58b857];return _0x20b9ba;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var fs_extra=require(_0xf878('0x5'));var auth=require(_0xf878('0x6'));var interaction=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var controller=require(_0xf878('0x9'));router[_0xf878('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf878('0xa')](_0xf878('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xf878('0xc')](),controller['create']);router['put'](_0xf878('0xb'),auth[_0xf878('0xc')](),controller[_0xf878('0xd')]);router['delete'](_0xf878('0xb'),auth[_0xf878('0xc')](),controller['destroy']);module[_0xf878('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 96865fb..eb866dc 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 _0xf642=['TEXT','sequelize','exports'];(function(_0x2d4b59,_0x46510b){var _0x50d0d5=function(_0x18482a){while(--_0x18482a){_0x2d4b59['push'](_0x2d4b59['shift']());}};_0x50d0d5(++_0x46510b);}(_0xf642,0x8e));var _0x2f64=function(_0x5da0d9,_0x49ee54){_0x5da0d9=_0x5da0d9-0x0;var _0x4b6d2f=_0xf642[_0x5da0d9];return _0x4b6d2f;};'use strict';var Sequelize=require(_0x2f64('0x0'));module[_0x2f64('0x1')]={'tree':{'type':Sequelize[_0x2f64('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x77ca=['sequelize','exports','TEXT'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x77ca,0x15f));var _0xa77c=function(_0xe5228,_0x4255a0){_0xe5228=_0xe5228-0x0;var _0x1b14e0=_0x77ca[_0xe5228];return _0x1b14e0;};'use strict';var Sequelize=require(_0xa77c('0x0'));module[_0xa77c('0x1')]={'tree':{'type':Sequelize[_0xa77c('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 e0114ea..4bb8296 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 _0x5442=['index','map','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','AnalyticTreeReport','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','ejs','fs-extra','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send'];(function(_0xcd91e2,_0x21bc45){var _0xefcb73=function(_0x4868e1){while(--_0x4868e1){_0xcd91e2['push'](_0xcd91e2['shift']());}};_0xefcb73(++_0x21bc45);}(_0x5442,0x13c));var _0x2544=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0x5442[_0x209ec9];return _0x129b1b;};'use strict';var emlformat=require(_0x2544('0x0'));var rimraf=require(_0x2544('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2544('0x2'));var rp=require(_0x2544('0x3'));var moment=require('moment');var BPromise=require(_0x2544('0x4'));var Mustache=require('mustache');var util=require(_0x2544('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2544('0x6'));var fs=require('fs');var fs_extra=require(_0x2544('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2544('0x8'));var deskjs=require(_0x2544('0x9'));var toCsv=require(_0x2544('0xa'));var querystring=require('querystring');var Papa=require(_0x2544('0xb'));var Redis=require(_0x2544('0xc'));var authService=require(_0x2544('0xd'));var qs=require(_0x2544('0xe'));var as=require(_0x2544('0xf'));var hardwareService=require(_0x2544('0x10'));var logger=require(_0x2544('0x11'))(_0x2544('0x12'));var utils=require(_0x2544('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2544('0x14'))['db'];function respondWithStatusCode(_0x55fec4,_0x5ce723){_0x5ce723=_0x5ce723||0xcc;return function(_0x4b25a3){if(_0x4b25a3){return _0x55fec4[_0x2544('0x15')](_0x5ce723);}return _0x55fec4[_0x2544('0x16')](_0x5ce723)[_0x2544('0x17')]();};}function respondWithResult(_0x52fd09,_0xc60fd1){_0xc60fd1=_0xc60fd1||0xc8;return function(_0x52380a){if(_0x52380a){return _0x52fd09['status'](_0xc60fd1)[_0x2544('0x18')](_0x52380a);}};}function respondWithFilteredResult(_0x2019e5,_0x15ddab){return function(_0x5df0ab){if(_0x5df0ab){var _0x12186c=typeof _0x15ddab[_0x2544('0x19')]===_0x2544('0x1a')&&typeof _0x15ddab[_0x2544('0x1b')]==='undefined';var _0x240efd=_0x5df0ab[_0x2544('0x1c')];var _0x4f925e=_0x12186c?0x0:_0x15ddab[_0x2544('0x19')];var _0x593bd2=_0x12186c?_0x5df0ab['count']:_0x15ddab[_0x2544('0x19')]+_0x15ddab[_0x2544('0x1b')];var _0x70e2f3;if(_0x593bd2>=_0x240efd){_0x593bd2=_0x240efd;_0x70e2f3=0xc8;}else{_0x70e2f3=0xce;}_0x2019e5[_0x2544('0x16')](_0x70e2f3);return _0x2019e5[_0x2544('0x1d')]('Content-Range',_0x4f925e+'-'+_0x593bd2+'/'+_0x240efd)[_0x2544('0x18')](_0x5df0ab);}return null;};}function patchUpdates(_0x2cf13b){return function(_0x20a172){try{jsonpatch[_0x2544('0x1e')](_0x20a172,_0x2cf13b,!![]);}catch(_0x4b9ce4){return BPromise[_0x2544('0x1f')](_0x4b9ce4);}return _0x20a172['save']();};}function saveUpdates(_0x518483,_0xb87842){return function(_0x1ce3b0){if(_0x1ce3b0){return _0x1ce3b0[_0x2544('0x20')](_0x518483)[_0x2544('0x21')](function(_0x3068dd){return _0x3068dd;});}return null;};}function removeEntity(_0x388c23,_0x54e288){return function(_0x34fb65){if(_0x34fb65){return _0x34fb65[_0x2544('0x22')]()[_0x2544('0x21')](function(){_0x388c23[_0x2544('0x16')](0xcc)[_0x2544('0x17')]();});}};}function handleEntityNotFound(_0x1ae400,_0x3e21e5){return function(_0x3aa08a){if(!_0x3aa08a){_0x1ae400['sendStatus'](0x194);}return _0x3aa08a;};}function handleError(_0x18a8a5,_0x23fcf6){_0x23fcf6=_0x23fcf6||0x1f4;return function(_0xb53218){logger[_0x2544('0x23')](_0xb53218[_0x2544('0x24')]);if(_0xb53218[_0x2544('0x25')]){delete _0xb53218[_0x2544('0x25')];}_0x18a8a5['status'](_0x23fcf6)[_0x2544('0x26')](_0xb53218);};}exports[_0x2544('0x27')]=function(_0x5e81b2,_0x54fa6f){var _0x2922db={},_0x1b6c5c={},_0x1cd2e0={'count':0x0,'rows':[]};var _0x30b393=_[_0x2544('0x28')](db['AnalyticTreeReport']['rawAttributes'],function(_0x42c4b5){return{'name':_0x42c4b5[_0x2544('0x29')],'type':_0x42c4b5[_0x2544('0x2a')][_0x2544('0x2b')]};});_0x1b6c5c['model']=_[_0x2544('0x28')](_0x30b393,'name');_0x1b6c5c[_0x2544('0x2c')]=_['keys'](_0x5e81b2[_0x2544('0x2c')]);_0x1b6c5c[_0x2544('0x2d')]=_['intersection'](_0x1b6c5c[_0x2544('0x2e')],_0x1b6c5c[_0x2544('0x2c')]);_0x2922db[_0x2544('0x2f')]=_[_0x2544('0x30')](_0x1b6c5c['model'],qs[_0x2544('0x31')](_0x5e81b2[_0x2544('0x2c')][_0x2544('0x31')]));_0x2922db[_0x2544('0x2f')]=_0x2922db['attributes']['length']?_0x2922db[_0x2544('0x2f')]:_0x1b6c5c[_0x2544('0x2e')];if(!_0x5e81b2[_0x2544('0x2c')][_0x2544('0x32')](_0x2544('0x33'))){_0x2922db[_0x2544('0x1b')]=qs[_0x2544('0x1b')](_0x5e81b2[_0x2544('0x2c')]['limit']);_0x2922db['offset']=qs[_0x2544('0x19')](_0x5e81b2[_0x2544('0x2c')][_0x2544('0x19')]);}_0x2922db['order']=qs[_0x2544('0x34')](_0x5e81b2[_0x2544('0x2c')][_0x2544('0x34')]);_0x2922db[_0x2544('0x35')]=qs[_0x2544('0x2d')](_[_0x2544('0x36')](_0x5e81b2[_0x2544('0x2c')],_0x1b6c5c['filters']),_0x30b393);if(_0x5e81b2[_0x2544('0x2c')][_0x2544('0x37')]){_0x2922db['where']=_[_0x2544('0x38')](_0x2922db['where'],{'$or':_[_0x2544('0x28')](_0x30b393,function(_0xe2e5ec){if(_0xe2e5ec[_0x2544('0x2a')]!==_0x2544('0x39')){var _0x2c002a={};_0x2c002a[_0xe2e5ec[_0x2544('0x25')]]={'$like':'%'+_0x5e81b2[_0x2544('0x2c')][_0x2544('0x37')]+'%'};return _0x2c002a;}})});}_0x2922db=_[_0x2544('0x38')]({},_0x2922db,_0x5e81b2[_0x2544('0x3a')]);var _0x868a5e={'where':_0x2922db[_0x2544('0x35')]};return db['AnalyticTreeReport']['count'](_0x868a5e)[_0x2544('0x21')](function(_0x1617cf){_0x1cd2e0[_0x2544('0x1c')]=_0x1617cf;if(_0x5e81b2['query'][_0x2544('0x3b')]){_0x2922db[_0x2544('0x3c')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x2922db);})[_0x2544('0x21')](function(_0x5d858a){_0x1cd2e0[_0x2544('0x3d')]=_0x5d858a;return _0x1cd2e0;})[_0x2544('0x21')](respondWithFilteredResult(_0x54fa6f,_0x2922db))[_0x2544('0x3e')](handleError(_0x54fa6f,null));};exports[_0x2544('0x3f')]=function(_0x54dc1e,_0x1d2ecf){var _0x395988={'raw':!![],'where':{'id':_0x54dc1e[_0x2544('0x40')]['id']}},_0x4105ce={};_0x4105ce[_0x2544('0x2e')]=_[_0x2544('0x41')](db['AnalyticTreeReport'][_0x2544('0x42')]);_0x4105ce[_0x2544('0x2c')]=_['keys'](_0x54dc1e[_0x2544('0x2c')]);_0x4105ce[_0x2544('0x2d')]=_['intersection'](_0x4105ce['model'],_0x4105ce[_0x2544('0x2c')]);_0x395988['attributes']=_[_0x2544('0x30')](_0x4105ce[_0x2544('0x2e')],qs[_0x2544('0x31')](_0x54dc1e[_0x2544('0x2c')][_0x2544('0x31')]));_0x395988[_0x2544('0x2f')]=_0x395988[_0x2544('0x2f')]['length']?_0x395988[_0x2544('0x2f')]:_0x4105ce[_0x2544('0x2e')];if(_0x54dc1e['query'][_0x2544('0x3b')]){_0x395988[_0x2544('0x3c')]=[{'all':!![]}];}_0x395988=_[_0x2544('0x38')]({},_0x395988,_0x54dc1e[_0x2544('0x3a')]);return db[_0x2544('0x43')][_0x2544('0x44')](_0x395988)[_0x2544('0x21')](handleEntityNotFound(_0x1d2ecf,null))[_0x2544('0x21')](respondWithResult(_0x1d2ecf,null))[_0x2544('0x3e')](handleError(_0x1d2ecf,null));};exports[_0x2544('0x45')]=function(_0xf5bbf6,_0x5d6f8a){return db[_0x2544('0x43')][_0x2544('0x45')](_0xf5bbf6[_0x2544('0x46')],{})[_0x2544('0x21')](respondWithResult(_0x5d6f8a,0xc9))[_0x2544('0x3e')](handleError(_0x5d6f8a,null));};exports[_0x2544('0x20')]=function(_0x5dde3e,_0xe36d72){if(_0x5dde3e[_0x2544('0x46')]['id']){delete _0x5dde3e[_0x2544('0x46')]['id'];}return db[_0x2544('0x43')][_0x2544('0x44')]({'where':{'id':_0x5dde3e[_0x2544('0x40')]['id']}})[_0x2544('0x21')](handleEntityNotFound(_0xe36d72,null))['then'](saveUpdates(_0x5dde3e[_0x2544('0x46')],null))['then'](respondWithResult(_0xe36d72,null))[_0x2544('0x3e')](handleError(_0xe36d72,null));};exports[_0x2544('0x22')]=function(_0x28ee7c,_0x54a52a){return db[_0x2544('0x43')][_0x2544('0x44')]({'where':{'id':_0x28ee7c[_0x2544('0x40')]['id']}})[_0x2544('0x21')](handleEntityNotFound(_0x54a52a,null))[_0x2544('0x21')](removeEntity(_0x54a52a,null))[_0x2544('0x3e')](handleError(_0x54a52a,null));}; \ No newline at end of file +var _0x795c=['stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','then','rows','catch','params','keys','length','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','sendStatus','error'];(function(_0x42580e,_0x2b650c){var _0xe52227=function(_0x25ec8a){while(--_0x25ec8a){_0x42580e['push'](_0x42580e['shift']());}};_0xe52227(++_0x2b650c);}(_0x795c,0x1e1));var _0xc795=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x795c[_0x481bf7];return _0x461787;};'use strict';var emlformat=require(_0xc795('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc795('0x1'));var jsonpatch=require(_0xc795('0x2'));var rp=require(_0xc795('0x3'));var moment=require(_0xc795('0x4'));var BPromise=require(_0xc795('0x5'));var Mustache=require(_0xc795('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc795('0x7'));var csv=require('to-csv');var ejs=require(_0xc795('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc795('0x9'));var squel=require('squel');var crypto=require(_0xc795('0xa'));var jsforce=require(_0xc795('0xb'));var deskjs=require(_0xc795('0xc'));var toCsv=require(_0xc795('0xd'));var querystring=require(_0xc795('0xe'));var Papa=require('papaparse');var Redis=require(_0xc795('0xf'));var authService=require(_0xc795('0x10'));var qs=require(_0xc795('0x11'));var as=require(_0xc795('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc795('0x13'))(_0xc795('0x14'));var utils=require(_0xc795('0x15'));var config=require(_0xc795('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc795('0x17'))['db'];function respondWithStatusCode(_0x20343e,_0x43e803){_0x43e803=_0x43e803||0xcc;return function(_0x5452be){if(_0x5452be){return _0x20343e['sendStatus'](_0x43e803);}return _0x20343e[_0xc795('0x18')](_0x43e803)[_0xc795('0x19')]();};}function respondWithResult(_0x449c14,_0x31cd42){_0x31cd42=_0x31cd42||0xc8;return function(_0x5e3275){if(_0x5e3275){return _0x449c14['status'](_0x31cd42)[_0xc795('0x1a')](_0x5e3275);}};}function respondWithFilteredResult(_0x28d0cb,_0x2feb40){return function(_0x5976d1){if(_0x5976d1){var _0x54c4e1=typeof _0x2feb40['offset']===_0xc795('0x1b')&&typeof _0x2feb40[_0xc795('0x1c')]===_0xc795('0x1b');var _0x39c0e3=_0x5976d1[_0xc795('0x1d')];var _0x233e06=_0x54c4e1?0x0:_0x2feb40[_0xc795('0x1e')];var _0x82fae3=_0x54c4e1?_0x5976d1[_0xc795('0x1d')]:_0x2feb40[_0xc795('0x1e')]+_0x2feb40[_0xc795('0x1c')];var _0x3b8f0f;if(_0x82fae3>=_0x39c0e3){_0x82fae3=_0x39c0e3;_0x3b8f0f=0xc8;}else{_0x3b8f0f=0xce;}_0x28d0cb['status'](_0x3b8f0f);return _0x28d0cb[_0xc795('0x1f')](_0xc795('0x20'),_0x233e06+'-'+_0x82fae3+'/'+_0x39c0e3)['json'](_0x5976d1);}return null;};}function patchUpdates(_0x4e8551){return function(_0x42902d){try{jsonpatch['apply'](_0x42902d,_0x4e8551,!![]);}catch(_0x50c1f2){return BPromise[_0xc795('0x21')](_0x50c1f2);}return _0x42902d['save']();};}function saveUpdates(_0x887988,_0x1b42d6){return function(_0x59c293){if(_0x59c293){return _0x59c293[_0xc795('0x22')](_0x887988)['then'](function(_0x2aeff1){return _0x2aeff1;});}return null;};}function removeEntity(_0x27217f,_0x8a12a9){return function(_0x2b2387){if(_0x2b2387){return _0x2b2387['destroy']()['then'](function(){_0x27217f[_0xc795('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b3611,_0x410713){return function(_0x22273a){if(!_0x22273a){_0x1b3611[_0xc795('0x23')](0x194);}return _0x22273a;};}function handleError(_0x437590,_0x2f00fe){_0x2f00fe=_0x2f00fe||0x1f4;return function(_0x559bd3){logger[_0xc795('0x24')](_0x559bd3[_0xc795('0x25')]);if(_0x559bd3[_0xc795('0x26')]){delete _0x559bd3['name'];}_0x437590['status'](_0x2f00fe)[_0xc795('0x27')](_0x559bd3);};}exports[_0xc795('0x28')]=function(_0x2f3274,_0x5a71e6){var _0x299c64={},_0x33d6ad={},_0x50d98b={'count':0x0,'rows':[]};var _0xace2ce=_[_0xc795('0x29')](db[_0xc795('0x2a')][_0xc795('0x2b')],function(_0x178c84){return{'name':_0x178c84[_0xc795('0x2c')],'type':_0x178c84[_0xc795('0x2d')][_0xc795('0x2e')]};});_0x33d6ad[_0xc795('0x2f')]=_[_0xc795('0x29')](_0xace2ce,_0xc795('0x26'));_0x33d6ad['query']=_['keys'](_0x2f3274[_0xc795('0x30')]);_0x33d6ad[_0xc795('0x31')]=_[_0xc795('0x32')](_0x33d6ad[_0xc795('0x2f')],_0x33d6ad[_0xc795('0x30')]);_0x299c64[_0xc795('0x33')]=_[_0xc795('0x32')](_0x33d6ad[_0xc795('0x2f')],qs[_0xc795('0x34')](_0x2f3274[_0xc795('0x30')][_0xc795('0x34')]));_0x299c64[_0xc795('0x33')]=_0x299c64['attributes']['length']?_0x299c64['attributes']:_0x33d6ad[_0xc795('0x2f')];if(!_0x2f3274[_0xc795('0x30')]['hasOwnProperty'](_0xc795('0x35'))){_0x299c64[_0xc795('0x1c')]=qs[_0xc795('0x1c')](_0x2f3274[_0xc795('0x30')][_0xc795('0x1c')]);_0x299c64[_0xc795('0x1e')]=qs[_0xc795('0x1e')](_0x2f3274[_0xc795('0x30')][_0xc795('0x1e')]);}_0x299c64[_0xc795('0x36')]=qs[_0xc795('0x37')](_0x2f3274[_0xc795('0x30')][_0xc795('0x37')]);_0x299c64[_0xc795('0x38')]=qs[_0xc795('0x31')](_['pick'](_0x2f3274[_0xc795('0x30')],_0x33d6ad[_0xc795('0x31')]),_0xace2ce);if(_0x2f3274['query'][_0xc795('0x39')]){_0x299c64[_0xc795('0x38')]=_[_0xc795('0x3a')](_0x299c64[_0xc795('0x38')],{'$or':_[_0xc795('0x29')](_0xace2ce,function(_0x427424){if(_0x427424[_0xc795('0x2d')]!==_0xc795('0x3b')){var _0x3403e6={};_0x3403e6[_0x427424[_0xc795('0x26')]]={'$like':'%'+_0x2f3274[_0xc795('0x30')][_0xc795('0x39')]+'%'};return _0x3403e6;}})});}_0x299c64=_['merge']({},_0x299c64,_0x2f3274[_0xc795('0x3c')]);var _0x5a48b8={'where':_0x299c64[_0xc795('0x38')]};return db[_0xc795('0x2a')][_0xc795('0x1d')](_0x5a48b8)['then'](function(_0x23b603){_0x50d98b[_0xc795('0x1d')]=_0x23b603;if(_0x2f3274[_0xc795('0x30')][_0xc795('0x3d')]){_0x299c64[_0xc795('0x3e')]=[{'all':!![]}];}return db[_0xc795('0x2a')][_0xc795('0x3f')](_0x299c64);})[_0xc795('0x40')](function(_0x1c7487){_0x50d98b[_0xc795('0x41')]=_0x1c7487;return _0x50d98b;})[_0xc795('0x40')](respondWithFilteredResult(_0x5a71e6,_0x299c64))[_0xc795('0x42')](handleError(_0x5a71e6,null));};exports['show']=function(_0x432faa,_0x1f245e){var _0x57a2b7={'raw':!![],'where':{'id':_0x432faa[_0xc795('0x43')]['id']}},_0xfbe3e9={};_0xfbe3e9[_0xc795('0x2f')]=_[_0xc795('0x44')](db['AnalyticTreeReport']['rawAttributes']);_0xfbe3e9[_0xc795('0x30')]=_['keys'](_0x432faa[_0xc795('0x30')]);_0xfbe3e9[_0xc795('0x31')]=_[_0xc795('0x32')](_0xfbe3e9['model'],_0xfbe3e9[_0xc795('0x30')]);_0x57a2b7[_0xc795('0x33')]=_[_0xc795('0x32')](_0xfbe3e9[_0xc795('0x2f')],qs[_0xc795('0x34')](_0x432faa['query'][_0xc795('0x34')]));_0x57a2b7[_0xc795('0x33')]=_0x57a2b7[_0xc795('0x33')][_0xc795('0x45')]?_0x57a2b7[_0xc795('0x33')]:_0xfbe3e9[_0xc795('0x2f')];if(_0x432faa['query'][_0xc795('0x3d')]){_0x57a2b7[_0xc795('0x3e')]=[{'all':!![]}];}_0x57a2b7=_['merge']({},_0x57a2b7,_0x432faa[_0xc795('0x3c')]);return db[_0xc795('0x2a')][_0xc795('0x46')](_0x57a2b7)[_0xc795('0x40')](handleEntityNotFound(_0x1f245e,null))[_0xc795('0x40')](respondWithResult(_0x1f245e,null))[_0xc795('0x42')](handleError(_0x1f245e,null));};exports[_0xc795('0x47')]=function(_0x85c11b,_0x54ad92){return db[_0xc795('0x2a')][_0xc795('0x47')](_0x85c11b[_0xc795('0x48')],{})[_0xc795('0x40')](respondWithResult(_0x54ad92,0xc9))['catch'](handleError(_0x54ad92,null));};exports[_0xc795('0x22')]=function(_0x992cf8,_0x19f112){if(_0x992cf8['body']['id']){delete _0x992cf8[_0xc795('0x48')]['id'];}return db[_0xc795('0x2a')]['find']({'where':{'id':_0x992cf8[_0xc795('0x43')]['id']}})[_0xc795('0x40')](handleEntityNotFound(_0x19f112,null))[_0xc795('0x40')](saveUpdates(_0x992cf8[_0xc795('0x48')],null))[_0xc795('0x40')](respondWithResult(_0x19f112,null))['catch'](handleError(_0x19f112,null));};exports[_0xc795('0x49')]=function(_0x5431fb,_0x1a9c29){return db[_0xc795('0x2a')]['find']({'where':{'id':_0x5431fb[_0xc795('0x43')]['id']}})[_0xc795('0x40')](handleEntityNotFound(_0x1a9c29,null))[_0xc795('0x40')](removeEntity(_0x1a9c29,null))['catch'](handleError(_0x1a9c29,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index f1776e9..3068baf 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 _0x32f4=['./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x32f4,0x154));var _0x432f=function(_0x5d7aea,_0xf498b9){_0x5d7aea=_0x5d7aea-0x0;var _0x3f61c8=_0x32f4[_0x5d7aea];return _0x3f61c8;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var logger=require(_0x432f('0x2'))(_0x432f('0x3'));var moment=require('moment');var BPromise=require(_0x432f('0x4'));var rp=require(_0x432f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var attributes=require(_0x432f('0x8'));module[_0x432f('0x9')]=function(_0x2f5f03,_0x5d8cc0){return _0x2f5f03['define'](_0x432f('0xa'),attributes,{'tableName':_0x432f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f35=['AnalyticTreeReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./analyticTreeReport.attributes','define'];(function(_0x3fff0d,_0x2f7f1c){var _0x58d7e3=function(_0x5790cb){while(--_0x5790cb){_0x3fff0d['push'](_0x3fff0d['shift']());}};_0x58d7e3(++_0x2f7f1c);}(_0x3f35,0x1ae));var _0x53f3=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x3f35[_0x3305de];return _0x3b5a84;};'use strict';var _=require(_0x53f3('0x0'));var util=require(_0x53f3('0x1'));var logger=require(_0x53f3('0x2'))(_0x53f3('0x3'));var moment=require(_0x53f3('0x4'));var BPromise=require(_0x53f3('0x5'));var rp=require(_0x53f3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53f3('0x7'));var config=require('../../config/environment');var attributes=require(_0x53f3('0x8'));module['exports']=function(_0x1b84bf,_0x325130){return _0x1b84bf[_0x53f3('0x9')](_0x53f3('0xa'),attributes,{'tableName':'analytics_report_trees','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 ab16b0d..319b423 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 _0x973c=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','AnalyticTreeReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x57e3da,_0x1720b3){var _0x38b8d3=function(_0x57f076){while(--_0x57f076){_0x57e3da['push'](_0x57e3da['shift']());}};_0x38b8d3(++_0x1720b3);}(_0x973c,0x163));var _0xc973=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x973c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc973('0x0'));var util=require(_0xc973('0x1'));var moment=require(_0xc973('0x2'));var BPromise=require(_0xc973('0x3'));var rs=require(_0xc973('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc973('0x5'))['db'];var utils=require(_0xc973('0x6'));var logger=require('../../config/logger')(_0xc973('0x7'));var config=require('../../config/environment');var jayson=require(_0xc973('0x8'));var client=jayson[_0xc973('0x9')][_0xc973('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x112555,_0x2d2912,_0x4b5f0a){return new BPromise(function(_0x3aa1e3,_0x202dad){return client[_0xc973('0xb')](_0x112555,_0x4b5f0a)[_0xc973('0xc')](function(_0x1121e3){logger[_0xc973('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x2d2912,'request\x20sent');logger[_0xc973('0xe')](_0xc973('0xf'),_0x2d2912,_0xc973('0x10'),JSON[_0xc973('0x11')](_0x1121e3));if(_0x1121e3[_0xc973('0x12')]){if(_0x1121e3['error'][_0xc973('0x13')]===0x1f4){logger[_0xc973('0x12')]('AnalyticTreeReport,\x20%s,\x20%s',_0x2d2912,_0x1121e3[_0xc973('0x12')][_0xc973('0x14')]);return _0x202dad(_0x1121e3[_0xc973('0x12')][_0xc973('0x14')]);}logger[_0xc973('0x12')](_0xc973('0x15'),_0x2d2912,_0x1121e3['error'][_0xc973('0x14')]);return _0x3aa1e3(_0x1121e3[_0xc973('0x12')][_0xc973('0x14')]);}else{logger[_0xc973('0xd')](_0xc973('0x15'),_0x2d2912,'request\x20sent');_0x3aa1e3(_0x1121e3[_0xc973('0x16')][_0xc973('0x14')]);}})[_0xc973('0x17')](function(_0x209f1d){logger['error'](_0xc973('0x15'),_0x2d2912,_0x209f1d);_0x202dad(_0x209f1d);});});} \ No newline at end of file +var _0xd896=['debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticTreeReport,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xd896,0xb8));var _0x6d89=function(_0x2641e9,_0x298654){_0x2641e9=_0x2641e9-0x0;var _0x5a5b0f=_0xd896[_0x2641e9];return _0x5a5b0f;};'use strict';var _=require(_0x6d89('0x0'));var util=require(_0x6d89('0x1'));var moment=require(_0x6d89('0x2'));var BPromise=require(_0x6d89('0x3'));var rs=require(_0x6d89('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d89('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6d89('0x6'));var config=require(_0x6d89('0x7'));var jayson=require(_0x6d89('0x8'));var client=jayson[_0x6d89('0x9')][_0x6d89('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x201a51,_0xd4330f,_0x214359){return new BPromise(function(_0x546d20,_0x1d92e6){return client['request'](_0x201a51,_0x214359)[_0x6d89('0xb')](function(_0x43cd52){logger[_0x6d89('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0xd4330f,_0x6d89('0xd'));logger[_0x6d89('0xe')](_0x6d89('0xf'),_0xd4330f,_0x6d89('0xd'),JSON[_0x6d89('0x10')](_0x43cd52));if(_0x43cd52[_0x6d89('0x11')]){if(_0x43cd52[_0x6d89('0x11')][_0x6d89('0x12')]===0x1f4){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0xd4330f,_0x43cd52[_0x6d89('0x11')][_0x6d89('0x13')]);return _0x1d92e6(_0x43cd52['error'][_0x6d89('0x13')]);}logger[_0x6d89('0x11')](_0x6d89('0x14'),_0xd4330f,_0x43cd52[_0x6d89('0x11')][_0x6d89('0x13')]);return _0x546d20(_0x43cd52['error']['message']);}else{logger[_0x6d89('0xc')](_0x6d89('0x14'),_0xd4330f,'request\x20sent');_0x546d20(_0x43cd52[_0x6d89('0x15')][_0x6d89('0x13')]);}})['catch'](function(_0xc6b220){logger[_0x6d89('0x11')](_0x6d89('0x14'),_0xd4330f,_0xc6b220);_0x1d92e6(_0xc6b220);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 32179df..e81cd99 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 _0x42d7=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x3df61b,_0x11176a){var _0x197217=function(_0x5e9d49){while(--_0x5e9d49){_0x3df61b['push'](_0x3df61b['shift']());}};_0x197217(++_0x11176a);}(_0x42d7,0xa8));var _0x742d=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0x42d7[_0xd2d54];return _0x78b113;};'use strict';var multer=require(_0x742d('0x0'));var util=require('util');var path=require(_0x742d('0x1'));var timeout=require(_0x742d('0x2'));var express=require(_0x742d('0x3'));var router=express[_0x742d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x742d('0x5'));var interaction=require(_0x742d('0x6'));var config=require(_0x742d('0x7'));var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0x742d('0x8')](),controller[_0x742d('0x9')]);router[_0x742d('0xa')](_0x742d('0xb'),auth[_0x742d('0x8')](),controller['show']);router[_0x742d('0xc')]('/',auth['isAuthenticated'](),controller[_0x742d('0xd')]);router[_0x742d('0xe')](_0x742d('0xb'),auth[_0x742d('0x8')](),controller[_0x742d('0xf')]);router[_0x742d('0x10')](_0x742d('0xb'),auth['isAuthenticated'](),controller[_0x742d('0x11')]);module[_0x742d('0x12')]=router; \ No newline at end of file +var _0xc06e=['/:id','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x2643d1,_0x533989){var _0x34b74e=function(_0x2b73c8){while(--_0x2b73c8){_0x2643d1['push'](_0x2643d1['shift']());}};_0x34b74e(++_0x533989);}(_0xc06e,0xd5));var _0xec06=function(_0xca1f0e,_0x2713d5){_0xca1f0e=_0xca1f0e-0x0;var _0x35e4ef=_0xc06e[_0xca1f0e];return _0x35e4ef;};'use strict';var multer=require(_0xec06('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xec06('0x1'));var express=require(_0xec06('0x2'));var router=express[_0xec06('0x3')]();var fs_extra=require(_0xec06('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xec06('0x5'));var config=require(_0xec06('0x6'));var controller=require(_0xec06('0x7'));router[_0xec06('0x8')]('/',auth[_0xec06('0x9')](),controller[_0xec06('0xa')]);router['get']('/:id',auth[_0xec06('0x9')](),controller[_0xec06('0xb')]);router[_0xec06('0xc')]('/',auth['isAuthenticated'](),controller[_0xec06('0xd')]);router[_0xec06('0xe')](_0xec06('0xf'),auth[_0xec06('0x9')](),controller[_0xec06('0x10')]);router[_0xec06('0x11')](_0xec06('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xec06('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 8f2e5a8..daf2fa3 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 _0x0248=['sequelize','exports','STRING'];(function(_0x2e9c1f,_0x19c688){var _0xcecc3e=function(_0x1eac3a){while(--_0x1eac3a){_0x2e9c1f['push'](_0x2e9c1f['shift']());}};_0xcecc3e(++_0x19c688);}(_0x0248,0x96));var _0x8024=function(_0x3ee091,_0x521906){_0x3ee091=_0x3ee091-0x0;var _0xf1c7d1=_0x0248[_0x3ee091];return _0xf1c7d1;};'use strict';var Sequelize=require(_0x8024('0x0'));module[_0x8024('0x1')]={'name':{'type':Sequelize[_0x8024('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1fce=['STRING','sequelize','exports'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x1fce,0x1db));var _0xe1fc=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0x1fce[_0x2a56ad];return _0x425175;};'use strict';var Sequelize=require(_0xe1fc('0x0'));module[_0xe1fc('0x1')]={'name':{'type':Sequelize[_0xe1fc('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index bf74f35..dcd74e6 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 _0x9294=['join','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','offset','set','apply','reject','save','update','then','destroy','name','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','order','sort','where','pick','filter','merge','options','count','findAll','catch','show','params','length','includeAll','include','find','clone','keys','omit','createdAt','body','updatedAt','create','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','server/files/attachments/'];(function(_0x108588,_0x218d2b){var _0x514f33=function(_0x44dd93){while(--_0x44dd93){_0x108588['push'](_0x108588['shift']());}};_0x514f33(++_0x218d2b);}(_0x9294,0x14d));var _0x4929=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0x9294[_0x3b1b23];return _0x1efc85;};'use strict';var emlformat=require(_0x4929('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4929('0x1'));var rp=require(_0x4929('0x2'));var moment=require('moment');var BPromise=require(_0x4929('0x3'));var Mustache=require(_0x4929('0x4'));var util=require(_0x4929('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x4929('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4929('0x7'));var _=require(_0x4929('0x8'));var squel=require(_0x4929('0x9'));var crypto=require(_0x4929('0xa'));var jsforce=require(_0x4929('0xb'));var deskjs=require(_0x4929('0xc'));var toCsv=require(_0x4929('0x6'));var querystring=require(_0x4929('0xd'));var Papa=require('papaparse');var Redis=require(_0x4929('0xe'));var authService=require(_0x4929('0xf'));var qs=require(_0x4929('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4929('0x11'));var logger=require(_0x4929('0x12'))(_0x4929('0x13'));var utils=require('../../config/utils');var config=require(_0x4929('0x14'));var licenseUtil=require(_0x4929('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c1b4c,_0x22f08b){_0x22f08b=_0x22f08b||0xcc;return function(_0x3a3677){if(_0x3a3677){return _0x5c1b4c[_0x4929('0x16')](_0x22f08b);}return _0x5c1b4c['status'](_0x22f08b)[_0x4929('0x17')]();};}function respondWithResult(_0x3babd0,_0x236f3a){_0x236f3a=_0x236f3a||0xc8;return function(_0x4210d2){if(_0x4210d2){return _0x3babd0[_0x4929('0x18')](_0x236f3a)[_0x4929('0x19')](_0x4210d2);}};}function respondWithFilteredResult(_0x44446c,_0x338a67){return function(_0x3eb207){if(_0x3eb207){var _0x5a079a=typeof _0x338a67['offset']===_0x4929('0x1a')&&typeof _0x338a67[_0x4929('0x1b')]===_0x4929('0x1a');var _0xd3449d=_0x3eb207['count'];var _0x17145c=_0x5a079a?0x0:_0x338a67[_0x4929('0x1c')];var _0x5ce6b0=_0x5a079a?_0x3eb207['count']:_0x338a67[_0x4929('0x1c')]+_0x338a67[_0x4929('0x1b')];var _0x2f9159;if(_0x5ce6b0>=_0xd3449d){_0x5ce6b0=_0xd3449d;_0x2f9159=0xc8;}else{_0x2f9159=0xce;}_0x44446c[_0x4929('0x18')](_0x2f9159);return _0x44446c[_0x4929('0x1d')]('Content-Range',_0x17145c+'-'+_0x5ce6b0+'/'+_0xd3449d)[_0x4929('0x19')](_0x3eb207);}return null;};}function patchUpdates(_0xc614ea){return function(_0x3674ac){try{jsonpatch[_0x4929('0x1e')](_0x3674ac,_0xc614ea,!![]);}catch(_0xa11608){return BPromise[_0x4929('0x1f')](_0xa11608);}return _0x3674ac[_0x4929('0x20')]();};}function saveUpdates(_0x2f4b20,_0x5b9978){return function(_0x1d75b8){if(_0x1d75b8){return _0x1d75b8[_0x4929('0x21')](_0x2f4b20)[_0x4929('0x22')](function(_0x357de7){return _0x357de7;});}return null;};}function removeEntity(_0x252bbf,_0x4f5fb9){return function(_0x365990){if(_0x365990){return _0x365990[_0x4929('0x23')]()[_0x4929('0x22')](function(){_0x252bbf[_0x4929('0x18')](0xcc)[_0x4929('0x17')]();});}};}function handleEntityNotFound(_0x3faf38,_0x467db3){return function(_0x1b6f90){if(!_0x1b6f90){_0x3faf38['sendStatus'](0x194);}return _0x1b6f90;};}function handleError(_0x5607be,_0x48beb0){_0x48beb0=_0x48beb0||0x1f4;return function(_0x374168){logger['error'](_0x374168['stack']);if(_0x374168[_0x4929('0x24')]){delete _0x374168[_0x4929('0x24')];}_0x5607be[_0x4929('0x18')](_0x48beb0)['send'](_0x374168);};}exports[_0x4929('0x25')]=function(_0x18a7b2,_0x106180){var _0x3a483b={},_0x8f4ca8={},_0x2a5da8={'count':0x0,'rows':[]};var _0x2aab69=_[_0x4929('0x26')](db[_0x4929('0x27')][_0x4929('0x28')],function(_0x14c377){return{'name':_0x14c377[_0x4929('0x29')],'type':_0x14c377[_0x4929('0x2a')][_0x4929('0x2b')]};});_0x8f4ca8[_0x4929('0x2c')]=_['map'](_0x2aab69,_0x4929('0x24'));_0x8f4ca8[_0x4929('0x2d')]=_['keys'](_0x18a7b2[_0x4929('0x2d')]);_0x8f4ca8[_0x4929('0x2e')]=_['intersection'](_0x8f4ca8[_0x4929('0x2c')],_0x8f4ca8[_0x4929('0x2d')]);_0x3a483b[_0x4929('0x2f')]=_[_0x4929('0x30')](_0x8f4ca8[_0x4929('0x2c')],qs['fields'](_0x18a7b2[_0x4929('0x2d')][_0x4929('0x31')]));_0x3a483b[_0x4929('0x2f')]=_0x3a483b['attributes']['length']?_0x3a483b[_0x4929('0x2f')]:_0x8f4ca8[_0x4929('0x2c')];if(!_0x18a7b2['query']['hasOwnProperty']('nolimit')){_0x3a483b['limit']=qs[_0x4929('0x1b')](_0x18a7b2[_0x4929('0x2d')][_0x4929('0x1b')]);_0x3a483b[_0x4929('0x1c')]=qs['offset'](_0x18a7b2[_0x4929('0x2d')][_0x4929('0x1c')]);}_0x3a483b[_0x4929('0x32')]=qs[_0x4929('0x33')](_0x18a7b2['query'][_0x4929('0x33')]);_0x3a483b[_0x4929('0x34')]=qs[_0x4929('0x2e')](_[_0x4929('0x35')](_0x18a7b2[_0x4929('0x2d')],_0x8f4ca8[_0x4929('0x2e')]),_0x2aab69);if(_0x18a7b2['query'][_0x4929('0x36')]){_0x3a483b[_0x4929('0x34')]=_[_0x4929('0x37')](_0x3a483b['where'],{'$or':_[_0x4929('0x26')](_0x2aab69,function(_0x2399c3){if(_0x2399c3[_0x4929('0x2a')]!=='VIRTUAL'){var _0x4642d9={};_0x4642d9[_0x2399c3[_0x4929('0x24')]]={'$like':'%'+_0x18a7b2['query']['filter']+'%'};return _0x4642d9;}})});}_0x3a483b=_[_0x4929('0x37')]({},_0x3a483b,_0x18a7b2[_0x4929('0x38')]);var _0x2aa1b2={'where':_0x3a483b[_0x4929('0x34')]};return db['Attachment'][_0x4929('0x39')](_0x2aa1b2)[_0x4929('0x22')](function(_0x2e2883){_0x2a5da8[_0x4929('0x39')]=_0x2e2883;if(_0x18a7b2[_0x4929('0x2d')]['includeAll']){_0x3a483b['include']=[{'all':!![]}];}return db[_0x4929('0x27')][_0x4929('0x3a')](_0x3a483b);})[_0x4929('0x22')](function(_0x2eec3d){_0x2a5da8['rows']=_0x2eec3d;return _0x2a5da8;})[_0x4929('0x22')](respondWithFilteredResult(_0x106180,_0x3a483b))[_0x4929('0x3b')](handleError(_0x106180,null));};exports[_0x4929('0x3c')]=function(_0x5a969e,_0x3f57d4){var _0x5b50fa={'raw':!![],'where':{'id':_0x5a969e[_0x4929('0x3d')]['id']}},_0x159bfa={};_0x159bfa['model']=_['keys'](db[_0x4929('0x27')][_0x4929('0x28')]);_0x159bfa[_0x4929('0x2d')]=_['keys'](_0x5a969e[_0x4929('0x2d')]);_0x159bfa[_0x4929('0x2e')]=_[_0x4929('0x30')](_0x159bfa['model'],_0x159bfa[_0x4929('0x2d')]);_0x5b50fa[_0x4929('0x2f')]=_[_0x4929('0x30')](_0x159bfa[_0x4929('0x2c')],qs[_0x4929('0x31')](_0x5a969e['query'][_0x4929('0x31')]));_0x5b50fa[_0x4929('0x2f')]=_0x5b50fa[_0x4929('0x2f')][_0x4929('0x3e')]?_0x5b50fa[_0x4929('0x2f')]:_0x159bfa[_0x4929('0x2c')];if(_0x5a969e[_0x4929('0x2d')][_0x4929('0x3f')]){_0x5b50fa[_0x4929('0x40')]=[{'all':!![]}];}_0x5b50fa=_[_0x4929('0x37')]({},_0x5b50fa,_0x5a969e['options']);return db[_0x4929('0x27')][_0x4929('0x41')](_0x5b50fa)['then'](handleEntityNotFound(_0x3f57d4,null))['then'](respondWithResult(_0x3f57d4,null))[_0x4929('0x3b')](handleError(_0x3f57d4,null));};exports[_0x4929('0x42')]=function(_0x266c94,_0x1d2481){var _0x43ff6a={'where':{'id':_0x266c94[_0x4929('0x3d')]['id']}},_0x546a73={};_0x546a73[_0x4929('0x2c')]=_[_0x4929('0x43')](db['Attachment'][_0x4929('0x28')]);_0x43ff6a[_0x4929('0x2f')]=_['intersection'](_0x546a73[_0x4929('0x2c')],qs[_0x4929('0x31')](_0x266c94['query'][_0x4929('0x31')]));_0x43ff6a['attributes']=_0x43ff6a[_0x4929('0x2f')][_0x4929('0x3e')]?_0x43ff6a[_0x4929('0x2f')]:_0x546a73[_0x4929('0x2c')];if(_0x266c94[_0x4929('0x2d')][_0x4929('0x3f')]){_0x43ff6a[_0x4929('0x40')]=[{'all':!![]}];}_0x43ff6a=_[_0x4929('0x37')]({},_0x43ff6a,_0x266c94[_0x4929('0x38')]);return db['Attachment'][_0x4929('0x41')](_0x43ff6a)[_0x4929('0x22')](handleEntityNotFound(_0x1d2481,null))['then'](function(_0x5623e5){if(_0x5623e5){var _0x4f7fe8=_0x5623e5['get']({'plain':!![]});_0x4f7fe8=qs[_0x4929('0x44')](_0x4f7fe8,['id',_0x4929('0x45'),'updatedAt']);_0x266c94[_0x4929('0x46')]=_[_0x4929('0x44')](_0x266c94['body'],['id','createdAt',_0x4929('0x47')]);return db[_0x4929('0x27')][_0x4929('0x48')](_['merge'](_0x4f7fe8,_0x266c94[_0x4929('0x46')]),{'include':_0x266c94[_0x4929('0x2d')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x4929('0x22')](respondWithResult(_0x1d2481,0xc9))[_0x4929('0x3b')](handleError(_0x1d2481,null));};exports['update']=function(_0xd644aa,_0x22d036){if(_0xd644aa[_0x4929('0x46')]['id']){delete _0xd644aa[_0x4929('0x46')]['id'];}return db[_0x4929('0x27')][_0x4929('0x41')]({'where':{'id':_0xd644aa[_0x4929('0x3d')]['id']}})[_0x4929('0x22')](handleEntityNotFound(_0x22d036,null))[_0x4929('0x22')](saveUpdates(_0xd644aa[_0x4929('0x46')],null))[_0x4929('0x22')](respondWithResult(_0x22d036,null))[_0x4929('0x3b')](handleError(_0x22d036,null));};exports['destroy']=function(_0x247396,_0x3222be){return db[_0x4929('0x27')]['find']({'where':{'id':_0x247396[_0x4929('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3222be,null))['then'](removeEntity(_0x3222be,null))['catch'](handleError(_0x3222be,null));};exports[_0x4929('0x48')]=function(_0x1cee86,_0x274146,_0x21cbb9){_0x1cee86[_0x4929('0x46')][_0x4929('0x24')]=_0x1cee86[_0x4929('0x49')][_0x4929('0x4a')];_0x1cee86[_0x4929('0x46')][_0x4929('0x4b')]=_0x1cee86['file'][_0x4929('0x4c')];_0x1cee86[_0x4929('0x46')][_0x4929('0x2a')]=_0x1cee86['file'][_0x4929('0x4d')];return db[_0x4929('0x27')][_0x4929('0x48')](_0x1cee86[_0x4929('0x46')])[_0x4929('0x22')](respondWithResult(_0x274146,0xc9))['catch'](handleError(_0x274146,null));};exports[_0x4929('0x4e')]=function(_0x330c1a,_0x27434e,_0x5cda22){return db[_0x4929('0x27')][_0x4929('0x4f')]({'where':{'id':_0x330c1a['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x27434e,null))[_0x4929('0x22')](function(_0x1d272a){if(_0x1d272a){var _0xb938fe=_0x1d272a[_0x4929('0x50')]!==null;var _0x406b44=path['join'](config['root'],_0x4929('0x51'));if(_0xb938fe){_0x406b44=path['join'](_0x406b44,'offline-chat/');}var _0x94c0fe=path[_0x4929('0x52')](_0x406b44,_0x1d272a[_0x4929('0x4b')]);return _0x27434e[_0x4929('0x4e')](_0x94c0fe);}})[_0x4929('0x3b')](handleError(_0x27434e,null));}; \ No newline at end of file +var _0xe16e=['name','send','index','map','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','then','includeAll','findAll','catch','show','params','Attachment','include','clone','find','get','omit','createdAt','body','updatedAt','create','update','file','originalname','basename','filename','download','findOne','ChatOfflineMessageId','join','offline-chat/','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','sendStatus','error','stack'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0xe16e,0x1df));var _0xee16=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0xe16e[_0x54a761];return _0x37d1da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xee16('0x0'));var zipdir=require(_0xee16('0x1'));var jsonpatch=require(_0xee16('0x2'));var rp=require(_0xee16('0x3'));var moment=require('moment');var BPromise=require(_0xee16('0x4'));var Mustache=require(_0xee16('0x5'));var util=require(_0xee16('0x6'));var path=require('path');var sox=require(_0xee16('0x7'));var csv=require(_0xee16('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee16('0x9'));var squel=require(_0xee16('0xa'));var crypto=require(_0xee16('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xee16('0x8'));var querystring=require('querystring');var Papa=require(_0xee16('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xee16('0xd'));var as=require(_0xee16('0xe'));var hardwareService=require(_0xee16('0xf'));var logger=require(_0xee16('0x10'))(_0xee16('0x11'));var utils=require(_0xee16('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xee16('0x13'));var db=require(_0xee16('0x14'))['db'];function respondWithStatusCode(_0x1f3024,_0x533640){_0x533640=_0x533640||0xcc;return function(_0xc921d9){if(_0xc921d9){return _0x1f3024['sendStatus'](_0x533640);}return _0x1f3024[_0xee16('0x15')](_0x533640)[_0xee16('0x16')]();};}function respondWithResult(_0x209f93,_0xf73dba){_0xf73dba=_0xf73dba||0xc8;return function(_0x46dfdd){if(_0x46dfdd){return _0x209f93[_0xee16('0x15')](_0xf73dba)['json'](_0x46dfdd);}};}function respondWithFilteredResult(_0x5d9125,_0x184aef){return function(_0xb487c6){if(_0xb487c6){var _0x5c41d3=typeof _0x184aef[_0xee16('0x17')]===_0xee16('0x18')&&typeof _0x184aef[_0xee16('0x19')]===_0xee16('0x18');var _0x368458=_0xb487c6[_0xee16('0x1a')];var _0x57834d=_0x5c41d3?0x0:_0x184aef[_0xee16('0x17')];var _0x529baa=_0x5c41d3?_0xb487c6[_0xee16('0x1a')]:_0x184aef[_0xee16('0x17')]+_0x184aef[_0xee16('0x19')];var _0x22caeb;if(_0x529baa>=_0x368458){_0x529baa=_0x368458;_0x22caeb=0xc8;}else{_0x22caeb=0xce;}_0x5d9125[_0xee16('0x15')](_0x22caeb);return _0x5d9125[_0xee16('0x1b')](_0xee16('0x1c'),_0x57834d+'-'+_0x529baa+'/'+_0x368458)[_0xee16('0x1d')](_0xb487c6);}return null;};}function patchUpdates(_0x5eb3e0){return function(_0xdff893){try{jsonpatch[_0xee16('0x1e')](_0xdff893,_0x5eb3e0,!![]);}catch(_0x415644){return BPromise[_0xee16('0x1f')](_0x415644);}return _0xdff893[_0xee16('0x20')]();};}function saveUpdates(_0x15e9ad,_0x3a70e2){return function(_0x43e75a){if(_0x43e75a){return _0x43e75a['update'](_0x15e9ad)['then'](function(_0x583a8e){return _0x583a8e;});}return null;};}function removeEntity(_0x564623,_0x261f5f){return function(_0x4f617c){if(_0x4f617c){return _0x4f617c[_0xee16('0x21')]()['then'](function(){_0x564623[_0xee16('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5476f2,_0x4f3c8a){return function(_0x4e4550){if(!_0x4e4550){_0x5476f2[_0xee16('0x22')](0x194);}return _0x4e4550;};}function handleError(_0x5821f8,_0x171d34){_0x171d34=_0x171d34||0x1f4;return function(_0xb1a3be){logger[_0xee16('0x23')](_0xb1a3be[_0xee16('0x24')]);if(_0xb1a3be[_0xee16('0x25')]){delete _0xb1a3be[_0xee16('0x25')];}_0x5821f8[_0xee16('0x15')](_0x171d34)[_0xee16('0x26')](_0xb1a3be);};}exports[_0xee16('0x27')]=function(_0x25caaa,_0xfc370f){var _0x21e320={},_0x36d1fd={},_0x3e8afe={'count':0x0,'rows':[]};var _0x1e7bd2=_[_0xee16('0x28')](db['Attachment']['rawAttributes'],function(_0x4a775c){return{'name':_0x4a775c[_0xee16('0x29')],'type':_0x4a775c['type']['key']};});_0x36d1fd[_0xee16('0x2a')]=_[_0xee16('0x28')](_0x1e7bd2,'name');_0x36d1fd[_0xee16('0x2b')]=_[_0xee16('0x2c')](_0x25caaa[_0xee16('0x2b')]);_0x36d1fd['filters']=_[_0xee16('0x2d')](_0x36d1fd[_0xee16('0x2a')],_0x36d1fd[_0xee16('0x2b')]);_0x21e320[_0xee16('0x2e')]=_['intersection'](_0x36d1fd[_0xee16('0x2a')],qs['fields'](_0x25caaa[_0xee16('0x2b')][_0xee16('0x2f')]));_0x21e320[_0xee16('0x2e')]=_0x21e320[_0xee16('0x2e')][_0xee16('0x30')]?_0x21e320[_0xee16('0x2e')]:_0x36d1fd[_0xee16('0x2a')];if(!_0x25caaa[_0xee16('0x2b')][_0xee16('0x31')](_0xee16('0x32'))){_0x21e320[_0xee16('0x19')]=qs[_0xee16('0x19')](_0x25caaa['query']['limit']);_0x21e320['offset']=qs[_0xee16('0x17')](_0x25caaa['query'][_0xee16('0x17')]);}_0x21e320['order']=qs['sort'](_0x25caaa[_0xee16('0x2b')][_0xee16('0x33')]);_0x21e320[_0xee16('0x34')]=qs[_0xee16('0x35')](_[_0xee16('0x36')](_0x25caaa[_0xee16('0x2b')],_0x36d1fd[_0xee16('0x35')]),_0x1e7bd2);if(_0x25caaa[_0xee16('0x2b')][_0xee16('0x37')]){_0x21e320[_0xee16('0x34')]=_[_0xee16('0x38')](_0x21e320['where'],{'$or':_[_0xee16('0x28')](_0x1e7bd2,function(_0x269f7f){if(_0x269f7f[_0xee16('0x39')]!==_0xee16('0x3a')){var _0x304dd6={};_0x304dd6[_0x269f7f[_0xee16('0x25')]]={'$like':'%'+_0x25caaa[_0xee16('0x2b')][_0xee16('0x37')]+'%'};return _0x304dd6;}})});}_0x21e320=_[_0xee16('0x38')]({},_0x21e320,_0x25caaa[_0xee16('0x3b')]);var _0x2deeba={'where':_0x21e320[_0xee16('0x34')]};return db['Attachment'][_0xee16('0x1a')](_0x2deeba)[_0xee16('0x3c')](function(_0x4abf93){_0x3e8afe['count']=_0x4abf93;if(_0x25caaa[_0xee16('0x2b')][_0xee16('0x3d')]){_0x21e320['include']=[{'all':!![]}];}return db['Attachment'][_0xee16('0x3e')](_0x21e320);})['then'](function(_0x44702b){_0x3e8afe['rows']=_0x44702b;return _0x3e8afe;})[_0xee16('0x3c')](respondWithFilteredResult(_0xfc370f,_0x21e320))[_0xee16('0x3f')](handleError(_0xfc370f,null));};exports[_0xee16('0x40')]=function(_0x5ab0eb,_0x3c103f){var _0x288e68={'raw':!![],'where':{'id':_0x5ab0eb[_0xee16('0x41')]['id']}},_0x549871={};_0x549871[_0xee16('0x2a')]=_['keys'](db[_0xee16('0x42')]['rawAttributes']);_0x549871[_0xee16('0x2b')]=_[_0xee16('0x2c')](_0x5ab0eb[_0xee16('0x2b')]);_0x549871[_0xee16('0x35')]=_[_0xee16('0x2d')](_0x549871[_0xee16('0x2a')],_0x549871[_0xee16('0x2b')]);_0x288e68['attributes']=_[_0xee16('0x2d')](_0x549871[_0xee16('0x2a')],qs[_0xee16('0x2f')](_0x5ab0eb[_0xee16('0x2b')][_0xee16('0x2f')]));_0x288e68[_0xee16('0x2e')]=_0x288e68['attributes'][_0xee16('0x30')]?_0x288e68[_0xee16('0x2e')]:_0x549871['model'];if(_0x5ab0eb[_0xee16('0x2b')]['includeAll']){_0x288e68[_0xee16('0x43')]=[{'all':!![]}];}_0x288e68=_[_0xee16('0x38')]({},_0x288e68,_0x5ab0eb[_0xee16('0x3b')]);return db['Attachment']['find'](_0x288e68)['then'](handleEntityNotFound(_0x3c103f,null))[_0xee16('0x3c')](respondWithResult(_0x3c103f,null))[_0xee16('0x3f')](handleError(_0x3c103f,null));};exports[_0xee16('0x44')]=function(_0xd3e76d,_0x50011b){var _0x3102e3={'where':{'id':_0xd3e76d['params']['id']}},_0x131fcd={};_0x131fcd[_0xee16('0x2a')]=_['keys'](db['Attachment']['rawAttributes']);_0x3102e3[_0xee16('0x2e')]=_['intersection'](_0x131fcd[_0xee16('0x2a')],qs[_0xee16('0x2f')](_0xd3e76d[_0xee16('0x2b')][_0xee16('0x2f')]));_0x3102e3[_0xee16('0x2e')]=_0x3102e3[_0xee16('0x2e')][_0xee16('0x30')]?_0x3102e3[_0xee16('0x2e')]:_0x131fcd[_0xee16('0x2a')];if(_0xd3e76d[_0xee16('0x2b')]['includeAll']){_0x3102e3['include']=[{'all':!![]}];}_0x3102e3=_[_0xee16('0x38')]({},_0x3102e3,_0xd3e76d['options']);return db[_0xee16('0x42')][_0xee16('0x45')](_0x3102e3)['then'](handleEntityNotFound(_0x50011b,null))['then'](function(_0x201bd3){if(_0x201bd3){var _0x2c63f6=_0x201bd3[_0xee16('0x46')]({'plain':!![]});_0x2c63f6=qs[_0xee16('0x47')](_0x2c63f6,['id',_0xee16('0x48'),'updatedAt']);_0xd3e76d[_0xee16('0x49')]=_['omit'](_0xd3e76d[_0xee16('0x49')],['id',_0xee16('0x48'),_0xee16('0x4a')]);return db[_0xee16('0x42')][_0xee16('0x4b')](_[_0xee16('0x38')](_0x2c63f6,_0xd3e76d['body']),{'include':_0xd3e76d[_0xee16('0x2b')][_0xee16('0x3d')]?[{'all':!![]}]:undefined});}})[_0xee16('0x3c')](respondWithResult(_0x50011b,0xc9))['catch'](handleError(_0x50011b,null));};exports[_0xee16('0x4c')]=function(_0x42d541,_0x23f06f){if(_0x42d541[_0xee16('0x49')]['id']){delete _0x42d541['body']['id'];}return db[_0xee16('0x42')][_0xee16('0x45')]({'where':{'id':_0x42d541[_0xee16('0x41')]['id']}})[_0xee16('0x3c')](handleEntityNotFound(_0x23f06f,null))[_0xee16('0x3c')](saveUpdates(_0x42d541[_0xee16('0x49')],null))[_0xee16('0x3c')](respondWithResult(_0x23f06f,null))[_0xee16('0x3f')](handleError(_0x23f06f,null));};exports[_0xee16('0x21')]=function(_0x198009,_0x4850d4){return db[_0xee16('0x42')]['find']({'where':{'id':_0x198009['params']['id']}})[_0xee16('0x3c')](handleEntityNotFound(_0x4850d4,null))[_0xee16('0x3c')](removeEntity(_0x4850d4,null))['catch'](handleError(_0x4850d4,null));};exports[_0xee16('0x4b')]=function(_0x111424,_0x341aa1,_0x40275b){_0x111424[_0xee16('0x49')]['name']=_0x111424[_0xee16('0x4d')][_0xee16('0x4e')];_0x111424['body'][_0xee16('0x4f')]=_0x111424[_0xee16('0x4d')][_0xee16('0x50')];_0x111424[_0xee16('0x49')][_0xee16('0x39')]=_0x111424['file']['mimetype'];return db['Attachment'][_0xee16('0x4b')](_0x111424[_0xee16('0x49')])['then'](respondWithResult(_0x341aa1,0xc9))[_0xee16('0x3f')](handleError(_0x341aa1,null));};exports[_0xee16('0x51')]=function(_0x534dbb,_0x57423d,_0x4ed436){return db['Attachment'][_0xee16('0x52')]({'where':{'id':_0x534dbb['params']['id']},'raw':!![]})[_0xee16('0x3c')](handleEntityNotFound(_0x57423d,null))[_0xee16('0x3c')](function(_0x312212){if(_0x312212){var _0x35b20a=_0x312212[_0xee16('0x53')]!==null;var _0x320b7d=path[_0xee16('0x54')](config['root'],'server/files/attachments/');if(_0x35b20a){_0x320b7d=path[_0xee16('0x54')](_0x320b7d,_0xee16('0x55'));}var _0x2d868a=path[_0xee16('0x54')](_0x320b7d,_0x312212[_0xee16('0x4f')]);return _0x57423d[_0xee16('0x51')](_0x2d868a);}})[_0xee16('0x3f')](handleError(_0x57423d,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index e68f020..2ddd23e 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 _0xcaef=['api','moment','request-promise','rimraf','../../config/environment','exports','define','util','../../config/logger'];(function(_0x39478f,_0x6ed088){var _0x582fca=function(_0x3a918a){while(--_0x3a918a){_0x39478f['push'](_0x39478f['shift']());}};_0x582fca(++_0x6ed088);}(_0xcaef,0x1c9));var _0xfcae=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xcaef[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var util=require(_0xfcae('0x0'));var logger=require(_0xfcae('0x1'))(_0xfcae('0x2'));var moment=require(_0xfcae('0x3'));var BPromise=require('bluebird');var rp=require(_0xfcae('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfcae('0x5'));var config=require(_0xfcae('0x6'));var attributes=require('./attachment.attributes');module[_0xfcae('0x7')]=function(_0x19dd62,_0x4e8311){return _0x19dd62[_0xfcae('0x8')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d86=['attachments','lodash','util','moment','request-promise','path','../../config/environment','exports','define'];(function(_0x2b8aac,_0x58900a){var _0x3d847d=function(_0x26419e){while(--_0x26419e){_0x2b8aac['push'](_0x2b8aac['shift']());}};_0x3d847d(++_0x58900a);}(_0x5d86,0x76));var _0x65d8=function(_0x1e830c,_0x31776b){_0x1e830c=_0x1e830c-0x0;var _0x3196e9=_0x5d86[_0x1e830c];return _0x3196e9;};'use strict';var _=require(_0x65d8('0x0'));var util=require(_0x65d8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x65d8('0x2'));var BPromise=require('bluebird');var rp=require(_0x65d8('0x3'));var fs=require('fs');var path=require(_0x65d8('0x4'));var rimraf=require('rimraf');var config=require(_0x65d8('0x5'));var attributes=require('./attachment.attributes');module[_0x65d8('0x6')]=function(_0x50c922,_0x1581a6){return _0x50c922[_0x65d8('0x7')]('Attachment',attributes,{'tableName':_0x65d8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 7322f58..e041e44 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 _0xb753=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateAttachment','create','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1d0533,_0x15c1dc){var _0xddc21a=function(_0x55c496){while(--_0x55c496){_0x1d0533['push'](_0x1d0533['shift']());}};_0xddc21a(++_0x15c1dc);}(_0xb753,0x107));var _0x3b75=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0xb753[_0x4bb66f];return _0xf2772f;};'use strict';var _=require('lodash');var util=require(_0x3b75('0x0'));var moment=require(_0x3b75('0x1'));var BPromise=require(_0x3b75('0x2'));var rs=require(_0x3b75('0x3'));var fs=require('fs');var Redis=require(_0x3b75('0x4'));var db=require(_0x3b75('0x5'))['db'];var utils=require(_0x3b75('0x6'));var logger=require(_0x3b75('0x7'))(_0x3b75('0x8'));var config=require(_0x3b75('0x9'));var jayson=require(_0x3b75('0xa'));var client=jayson[_0x3b75('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42be2f,_0x3a5487,_0x3aacdc){return new BPromise(function(_0xee04b7,_0x161b9c){return client[_0x3b75('0xc')](_0x42be2f,_0x3aacdc)['then'](function(_0x1bb720){logger['info'](_0x3b75('0xd'),_0x3a5487,_0x3b75('0xe'));logger[_0x3b75('0xf')]('Attachment,\x20%s,\x20%s,\x20%s',_0x3a5487,_0x3b75('0xe'),JSON[_0x3b75('0x10')](_0x1bb720));if(_0x1bb720['error']){if(_0x1bb720[_0x3b75('0x11')][_0x3b75('0x12')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x3a5487,_0x1bb720['error'][_0x3b75('0x13')]);return _0x161b9c(_0x1bb720[_0x3b75('0x11')][_0x3b75('0x13')]);}logger[_0x3b75('0x11')](_0x3b75('0xd'),_0x3a5487,_0x1bb720[_0x3b75('0x11')][_0x3b75('0x13')]);return _0xee04b7(_0x1bb720[_0x3b75('0x11')][_0x3b75('0x13')]);}else{logger[_0x3b75('0x14')](_0x3b75('0xd'),_0x3a5487,_0x3b75('0xe'));_0xee04b7(_0x1bb720[_0x3b75('0x15')][_0x3b75('0x13')]);}})[_0x3b75('0x16')](function(_0xf78ea7){logger[_0x3b75('0x11')](_0x3b75('0xd'),_0x3a5487,_0xf78ea7);_0x161b9c(_0xf78ea7);});});}exports[_0x3b75('0x17')]=function(_0x31875c){var _0x39e4a8=this;return new Promise(function(_0x427756,_0x401305){return db['Attachment'][_0x3b75('0x18')](_0x31875c['body'],{'raw':_0x31875c['options']?_0x31875c[_0x3b75('0x19')][_0x3b75('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5cafd3){logger[_0x3b75('0x14')](_0x3b75('0x17'),_0x31875c);logger[_0x3b75('0xf')](_0x3b75('0x17'),_0x31875c,JSON[_0x3b75('0x10')](_0x5cafd3));_0x427756(_0x5cafd3);})['catch'](function(_0x1dd8bf){logger[_0x3b75('0x11')](_0x3b75('0x17'),_0x1dd8bf[_0x3b75('0x13')],_0x31875c);_0x401305(_0x39e4a8[_0x3b75('0x11')](0x1f4,_0x1dd8bf[_0x3b75('0x13')]));});});}; \ No newline at end of file +var _0xa1e2=['info','result','catch','create','body','options','CreateAttachment','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','Attachment,\x20%s,\x20%s','message'];(function(_0x1834be,_0x22a86a){var _0x6b78de=function(_0x266984){while(--_0x266984){_0x1834be['push'](_0x1834be['shift']());}};_0x6b78de(++_0x22a86a);}(_0xa1e2,0x116));var _0x2a1e=function(_0x1baec2,_0x18bdb4){_0x1baec2=_0x1baec2-0x0;var _0x5c2861=_0xa1e2[_0x1baec2];return _0x5c2861;};'use strict';var _=require(_0x2a1e('0x0'));var util=require(_0x2a1e('0x1'));var moment=require(_0x2a1e('0x2'));var BPromise=require(_0x2a1e('0x3'));var rs=require(_0x2a1e('0x4'));var fs=require('fs');var Redis=require(_0x2a1e('0x5'));var db=require(_0x2a1e('0x6'))['db'];var utils=require(_0x2a1e('0x7'));var logger=require(_0x2a1e('0x8'))(_0x2a1e('0x9'));var config=require(_0x2a1e('0xa'));var jayson=require(_0x2a1e('0xb'));var client=jayson[_0x2a1e('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53a9c6,_0x100d81,_0x5d0682){return new BPromise(function(_0x46ea04,_0x235190){return client[_0x2a1e('0xd')](_0x53a9c6,_0x5d0682)[_0x2a1e('0xe')](function(_0x17282d){logger['info']('Attachment,\x20%s,\x20%s',_0x100d81,_0x2a1e('0xf'));logger[_0x2a1e('0x10')](_0x2a1e('0x11'),_0x100d81,_0x2a1e('0xf'),JSON['stringify'](_0x17282d));if(_0x17282d[_0x2a1e('0x12')]){if(_0x17282d[_0x2a1e('0x12')][_0x2a1e('0x13')]===0x1f4){logger[_0x2a1e('0x12')](_0x2a1e('0x14'),_0x100d81,_0x17282d[_0x2a1e('0x12')][_0x2a1e('0x15')]);return _0x235190(_0x17282d[_0x2a1e('0x12')][_0x2a1e('0x15')]);}logger[_0x2a1e('0x12')]('Attachment,\x20%s,\x20%s',_0x100d81,_0x17282d[_0x2a1e('0x12')][_0x2a1e('0x15')]);return _0x46ea04(_0x17282d['error'][_0x2a1e('0x15')]);}else{logger[_0x2a1e('0x16')]('Attachment,\x20%s,\x20%s',_0x100d81,_0x2a1e('0xf'));_0x46ea04(_0x17282d[_0x2a1e('0x17')][_0x2a1e('0x15')]);}})[_0x2a1e('0x18')](function(_0x30fdda){logger[_0x2a1e('0x12')](_0x2a1e('0x14'),_0x100d81,_0x30fdda);_0x235190(_0x30fdda);});});}exports['CreateAttachment']=function(_0x49a5cc){var _0x48917b=this;return new Promise(function(_0x8f189b,_0x1f0e0e){return db['Attachment'][_0x2a1e('0x19')](_0x49a5cc[_0x2a1e('0x1a')],{'raw':_0x49a5cc['options']?_0x49a5cc[_0x2a1e('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x2a1e('0xe')](function(_0x3bdfa0){logger[_0x2a1e('0x16')](_0x2a1e('0x1c'),_0x49a5cc);logger['debug'](_0x2a1e('0x1c'),_0x49a5cc,JSON[_0x2a1e('0x1d')](_0x3bdfa0));_0x8f189b(_0x3bdfa0);})[_0x2a1e('0x18')](function(_0x4d0360){logger[_0x2a1e('0x12')]('CreateAttachment',_0x4d0360[_0x2a1e('0x15')],_0x49a5cc);_0x1f0e0e(_0x48917b[_0x2a1e('0x12')](0x1f4,_0x4d0360[_0x2a1e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index ce19afb..93e03e6 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 _0x6b24=['format','%s-%s','now','originalname','replace','single','file','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','./attachment.controller','isAuthenticated','/:id','show','get','/:id/download','download','post','/:id/clone','diskStorage','join','root','server/files/attachments/'];(function(_0x48932e,_0x5d2931){var _0x1d9b3d=function(_0x1c968d){while(--_0x1c968d){_0x48932e['push'](_0x48932e['shift']());}};_0x1d9b3d(++_0x5d2931);}(_0x6b24,0x1ce));var _0x46b2=function(_0x2704be,_0x2555d4){_0x2704be=_0x2704be-0x0;var _0x21d7b5=_0x6b24[_0x2704be];return _0x21d7b5;};'use strict';var multer=require('multer');var util=require(_0x46b2('0x0'));var path=require(_0x46b2('0x1'));var timeout=require(_0x46b2('0x2'));var express=require(_0x46b2('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x46b2('0x4'));var config=require('../../config/environment');var controller=require(_0x46b2('0x5'));router['get']('/',auth[_0x46b2('0x6')](),controller['index']);router['get'](_0x46b2('0x7'),auth[_0x46b2('0x6')](),controller[_0x46b2('0x8')]);router[_0x46b2('0x9')](_0x46b2('0xa'),auth[_0x46b2('0x6')](),controller[_0x46b2('0xb')]);router[_0x46b2('0xc')](_0x46b2('0xd'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0x46b2('0xe')]({'destination':function(_0x38e08d,_0xb546cf,_0x5bb2c3){_0x5bb2c3(null,path[_0x46b2('0xf')](config[_0x46b2('0x10')],_0x46b2('0x11')));},'filename':function(_0x5343fc,_0x468ae9,_0x886e41){_0x886e41(null,util[_0x46b2('0x12')](_0x46b2('0x13'),Date[_0x46b2('0x14')](),_0x468ae9[_0x46b2('0x15')][_0x46b2('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x46b2('0xc')]('/',upload[_0x46b2('0x17')](_0x46b2('0x18')),controller['create']);router[_0x46b2('0x19')](_0x46b2('0x7'),auth['isAuthenticated'](),controller[_0x46b2('0x1a')]);router[_0x46b2('0x1b')](_0x46b2('0x7'),auth[_0x46b2('0x6')](),controller[_0x46b2('0x1c')]);module[_0x46b2('0x1d')]=router; \ No newline at end of file +var _0xa149=['get','index','/:id','isAuthenticated','show','post','/:id/clone','clone','diskStorage','server/files/attachments/','%s-%s','replace','single','file','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./attachment.controller'];(function(_0x5505b8,_0x5876ea){var _0x5c57ca=function(_0x251c3c){while(--_0x251c3c){_0x5505b8['push'](_0x5505b8['shift']());}};_0x5c57ca(++_0x5876ea);}(_0xa149,0x18c));var _0x9a14=function(_0x255c1f,_0x572d75){_0x255c1f=_0x255c1f-0x0;var _0x44b30b=_0xa149[_0x255c1f];return _0x44b30b;};'use strict';var multer=require(_0x9a14('0x0'));var util=require(_0x9a14('0x1'));var path=require(_0x9a14('0x2'));var timeout=require(_0x9a14('0x3'));var express=require(_0x9a14('0x4'));var router=express[_0x9a14('0x5')]();var fs_extra=require(_0x9a14('0x6'));var auth=require(_0x9a14('0x7'));var interaction=require(_0x9a14('0x8'));var config=require('../../config/environment');var controller=require(_0x9a14('0x9'));router[_0x9a14('0xa')]('/',auth['isAuthenticated'](),controller[_0x9a14('0xb')]);router[_0x9a14('0xa')](_0x9a14('0xc'),auth[_0x9a14('0xd')](),controller[_0x9a14('0xe')]);router[_0x9a14('0xa')]('/:id/download',auth[_0x9a14('0xd')](),controller['download']);router[_0x9a14('0xf')](_0x9a14('0x10'),auth[_0x9a14('0xd')](),controller[_0x9a14('0x11')]);var upload=multer({'storage':multer[_0x9a14('0x12')]({'destination':function(_0x1444a5,_0x50c6d4,_0x5d4ed8){_0x5d4ed8(null,path['join'](config['root'],_0x9a14('0x13')));},'filename':function(_0x34c392,_0x4f358b,_0x231f1a){_0x231f1a(null,util['format'](_0x9a14('0x14'),Date['now'](),_0x4f358b['originalname'][_0x9a14('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9a14('0xf')]('/',upload[_0x9a14('0x16')](_0x9a14('0x17')),controller['create']);router[_0x9a14('0x18')](_0x9a14('0xc'),auth[_0x9a14('0xd')](),controller[_0x9a14('0x19')]);router[_0x9a14('0x1a')](_0x9a14('0xc'),auth[_0x9a14('0xd')](),controller[_0x9a14('0x1b')]);module[_0x9a14('0x1c')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index c59b4d8..3340eb4 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 _0xb563=['clientSecret','secret','callbackURL','Setting','findOne','blockDuration','then','find','emails','value','admin','agent','disabled','blocked','minutes','clearBlockUser','getLicense','catch','passport','passport-google-oauth20','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','google','/login','profile','callback','authenticate','use','clientID'];(function(_0x1e5725,_0x3f4e13){var _0x4b5cf8=function(_0x2e9a53){while(--_0x2e9a53){_0x1e5725['push'](_0x1e5725['shift']());}};_0x4b5cf8(++_0x3f4e13);}(_0xb563,0x1cc));var _0x3b56=function(_0x39e309,_0x1b260b){_0x39e309=_0x39e309-0x0;var _0x180c8a=_0xb563[_0x39e309];return _0x180c8a;};'use strict';var _=require('lodash');var passport=require(_0x3b56('0x0'));var GoogleStrategy=require(_0x3b56('0x1'))['Strategy'];var moment=require(_0x3b56('0x2'));var db=require(_0x3b56('0x3'))['db'];var config=require(_0x3b56('0x4'));var signToken=require(_0x3b56('0x5'))[_0x3b56('0x6')];var utils=require(_0x3b56('0x7'));exports[_0x3b56('0x8')]=passport['authenticate'](_0x3b56('0x9'),{'failureRedirect':_0x3b56('0xa'),'scope':[_0x3b56('0xb'),'email'],'session':![]});exports[_0x3b56('0xc')]=passport[_0x3b56('0xd')](_0x3b56('0x9'),{'failureRedirect':_0x3b56('0xa'),'session':![]});passport[_0x3b56('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x3b56('0x9')][_0x3b56('0xf')]:'id','clientSecret':config['google']?config[_0x3b56('0x9')][_0x3b56('0x10')]:_0x3b56('0x11'),'callbackURL':config['google']?config[_0x3b56('0x9')][_0x3b56('0x12')]:''},function(_0x39b602,_0x2c22fe,_0x2b579c,_0x241390){var _0x20e8e8,_0x2c398a;return db[_0x3b56('0x13')][_0x3b56('0x14')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x3b56('0x15')],'raw':!![]})[_0x3b56('0x16')](function(_0x21e530){_0x20e8e8=_0x21e530;return db['User'][_0x3b56('0x17')]({'where':{'email':_['map'](_0x2b579c[_0x3b56('0x18')],_0x3b56('0x19')),'role':{'$or':[_0x3b56('0x1a'),'user',_0x3b56('0x1b')]}}});})[_0x3b56('0x16')](function(_0x15d5aa){_0x2c398a=_0x15d5aa;if(_0x2c398a){if(_0x2c398a[_0x3b56('0x1c')]){return _0x241390('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x20e8e8[_0x3b56('0x15')]>0x0){if(_0x2c398a[_0x3b56('0x1d')]){if(moment(_0x2c398a['blockedAt'])['add'](_0x20e8e8[_0x3b56('0x15')],_0x3b56('0x1e'))>moment()){return _0x241390('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0x3b56('0x1f')](_0x2c398a,0x0,![],null)['then'](function(){return utils[_0x3b56('0x20')](_0x2c398a);})[_0x3b56('0x16')](function(){return _0x241390(null,_0x2c398a);});}}else{return utils[_0x3b56('0x20')](_0x2c398a)['then'](function(){return _0x241390(null,_0x2c398a);});}}else{return utils[_0x3b56('0x20')](_0x2c398a)[_0x3b56('0x16')](function(){return _0x241390(null,_0x2c398a);});}}return _0x241390('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x3b56('0x21')](function(_0x31f8fa){_0x241390(_0x31f8fa);});})); \ No newline at end of file +var _0x8afb=['agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','Strategy','moment','../../mysqldb','../../config/environment','signToken','../../config/utils','authenticate','/login','profile','email','callback','google','clientID','secret','Setting','findOne','allowedLoginAttempts','blockDuration','User','find','value','admin','user'];(function(_0x5238ca,_0x462d41){var _0x5be68a=function(_0x827775){while(--_0x827775){_0x5238ca['push'](_0x5238ca['shift']());}};_0x5be68a(++_0x462d41);}(_0x8afb,0x1d1));var _0xb8af=function(_0x4e9640,_0x51dd90){_0x4e9640=_0x4e9640-0x0;var _0x346066=_0x8afb[_0x4e9640];return _0x346066;};'use strict';var _=require(_0xb8af('0x0'));var passport=require(_0xb8af('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0xb8af('0x2')];var moment=require(_0xb8af('0x3'));var db=require(_0xb8af('0x4'))['db'];var config=require(_0xb8af('0x5'));var signToken=require('../../components/auth/service')[_0xb8af('0x6')];var utils=require(_0xb8af('0x7'));exports['login']=passport[_0xb8af('0x8')]('google',{'failureRedirect':_0xb8af('0x9'),'scope':[_0xb8af('0xa'),_0xb8af('0xb')],'session':![]});exports[_0xb8af('0xc')]=passport[_0xb8af('0x8')](_0xb8af('0xd'),{'failureRedirect':'/login','session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0xb8af('0xd')]?config[_0xb8af('0xd')][_0xb8af('0xe')]:'id','clientSecret':config[_0xb8af('0xd')]?config[_0xb8af('0xd')]['clientSecret']:_0xb8af('0xf'),'callbackURL':config['google']?config[_0xb8af('0xd')]['callbackURL']:''},function(_0x41137f,_0x2e3f0f,_0x2fb7b5,_0x36d97b){var _0x52bd28,_0x4750b1;return db[_0xb8af('0x10')][_0xb8af('0x11')]({'where':{'id':0x1},'attributes':[_0xb8af('0x12'),_0xb8af('0x13')],'raw':!![]})['then'](function(_0x5a0527){_0x52bd28=_0x5a0527;return db[_0xb8af('0x14')][_0xb8af('0x15')]({'where':{'email':_['map'](_0x2fb7b5['emails'],_0xb8af('0x16')),'role':{'$or':[_0xb8af('0x17'),_0xb8af('0x18'),_0xb8af('0x19')]}}});})[_0xb8af('0x1a')](function(_0x1fe80a){_0x4750b1=_0x1fe80a;if(_0x4750b1){if(_0x4750b1['disabled']){return _0x36d97b(_0xb8af('0x1b'));}else if(_0x52bd28['blockDuration']>0x0){if(_0x4750b1[_0xb8af('0x1c')]){if(moment(_0x4750b1[_0xb8af('0x1d')])[_0xb8af('0x1e')](_0x52bd28[_0xb8af('0x13')],_0xb8af('0x1f'))>moment()){return _0x36d97b(_0xb8af('0x1b'));}else{return utils[_0xb8af('0x20')](_0x4750b1,0x0,![],null)[_0xb8af('0x1a')](function(){return utils['getLicense'](_0x4750b1);})['then'](function(){return _0x36d97b(null,_0x4750b1);});}}else{return utils[_0xb8af('0x21')](_0x4750b1)['then'](function(){return _0x36d97b(null,_0x4750b1);});}}else{return utils['getLicense'](_0x4750b1)[_0xb8af('0x1a')](function(){return _0x36d97b(null,_0x4750b1);});}}return _0x36d97b('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0xb8af('0x22')](function(_0x49d766){_0x36d97b(_0x49d766);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 4992faa..8549fd9 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 _0x16e4=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','/callback','callback','setTokenCookie','exports','express','passport','Router'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x16e4,0x97));var _0x416e=function(_0x4473dd,_0x3e9684){_0x4473dd=_0x4473dd-0x0;var _0x59a0d7=_0x16e4[_0x4473dd];return _0x59a0d7;};'use strict';var express=require(_0x416e('0x0'));var passport=require(_0x416e('0x1'));var router=express[_0x416e('0x2')]();var controller=require(_0x416e('0x3'));var userController=require(_0x416e('0x4'));var authService=require(_0x416e('0x5'));router['get']('/',controller[_0x416e('0x6')]);router['get'](_0x416e('0x7'),controller[_0x416e('0x8')],authService['isMiddleware'],userController[_0x416e('0x6')],authService[_0x416e('0x9')]);module[_0x416e('0xa')]=router; \ No newline at end of file +var _0x3fb7=['login','setTokenCookie','exports','passport','./authGoogle.controller','../user/user.controller.js','get','/callback','callback','isMiddleware'];(function(_0x36a469,_0x59d84c){var _0x3347fc=function(_0x3860e7){while(--_0x3860e7){_0x36a469['push'](_0x36a469['shift']());}};_0x3347fc(++_0x59d84c);}(_0x3fb7,0x189));var _0x73fb=function(_0x4b15c4,_0x4dfd3a){_0x4b15c4=_0x4b15c4-0x0;var _0x160aad=_0x3fb7[_0x4b15c4];return _0x160aad;};'use strict';var express=require('express');var passport=require(_0x73fb('0x0'));var router=express['Router']();var controller=require(_0x73fb('0x1'));var userController=require(_0x73fb('0x2'));var authService=require('../../components/auth/service');router[_0x73fb('0x3')]('/',controller['login']);router[_0x73fb('0x3')](_0x73fb('0x4'),controller[_0x73fb('0x5')],authService[_0x73fb('0x6')],userController[_0x73fb('0x7')],authService[_0x73fb('0x8')]);module[_0x73fb('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index eb8e975..e1bf12a 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 _0x7278=['../../mysqldb','../../components/auth/service','../../config/utils','client','http','blockDuration','then','findOne','name','password','salt','role','blocked','blockedAt','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','allowedLoginAttempts','add','clearBlockUser','getLicense','catch','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','validatePasswordHistory','passwordHistoryLimit','resetPasswordToken','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','moment'];(function(_0x25fe7e,_0x489e15){var _0x3414e2=function(_0x2ea6f4){while(--_0x2ea6f4){_0x25fe7e['push'](_0x25fe7e['shift']());}};_0x3414e2(++_0x489e15);}(_0x7278,0x161));var _0x8727=function(_0x2540ef,_0x1c6bd8){_0x2540ef=_0x2540ef-0x0;var _0x30a542=_0x7278[_0x2540ef];return _0x30a542;};'use strict';var util=require(_0x8727('0x0'));var passport=require(_0x8727('0x1'));var LocalStrategy=require(_0x8727('0x2'))[_0x8727('0x3')];var jayson=require(_0x8727('0x4'));var _=require('lodash');var rs=require(_0x8727('0x5'));var moment=require(_0x8727('0x6'));var db=require(_0x8727('0x7'))['db'];var authService=require(_0x8727('0x8'));var utils=require(_0x8727('0x9'));var client=jayson[_0x8727('0xa')][_0x8727('0xb')]({'port':0x232b});function localAuthenticate(_0x5549d5,_0xfd1902,_0x2f491c,_0xffd783){var _0x435911,_0x4160c3;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x8727('0xc')],'raw':!![]})[_0x8727('0xd')](function(_0x3a6c9b){_0x435911=_0x3a6c9b;return _0x5549d5[_0x8727('0xe')]({'attributes':['id',_0x8727('0xf'),_0x8727('0x10'),_0x8727('0x11'),_0x8727('0x12'),'disabled',_0x8727('0x13'),_0x8727('0x14'),_0x8727('0x15')],'where':{'name':_0xfd1902,'role':{'$or':['admin',_0x8727('0x16'),_0x8727('0x17')]}}});})['then'](function(_0xbcde13){if(!_0xbcde13||_0xbcde13&&_0xbcde13[_0x8727('0xf')]!==_0xfd1902){throw new Error(_0x8727('0x18'));}else{_0x4160c3=_0xbcde13;return _0x4160c3;}})[_0x8727('0xd')](function(){_0x4160c3[_0x8727('0x19')](_0x2f491c,function(_0x3d84db,_0x3865e9){var _0x1916f7=_0x4160c3[_0x8727('0x15')]+0x1;if(_0x3d84db){return _0xffd783(_0x3d84db);}else if(!_0x3865e9){if(_0x4160c3[_0x8727('0x1a')]){return _0xffd783(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x435911[_0x8727('0x1b')]>0x0){if(_0x4160c3[_0x8727('0x13')]){if(_0x435911[_0x8727('0xc')]>0x0){if(moment(_0x4160c3[_0x8727('0x14')])[_0x8727('0x1c')](_0x435911[_0x8727('0xc')],'minutes')>moment()){return _0xffd783(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x8727('0x1d')](_0x4160c3,_0x1916f7,![],null)['then'](function(){return _0xffd783(null,![],{'message':_0x8727('0x18')});});}}else{return _0xffd783(null,![],{'message':_0x8727('0x18')});}}else{if(_0x1916f7>=_0x435911[_0x8727('0x1b')]){return utils[_0x8727('0x1d')](_0x4160c3,0x0,!![],moment())[_0x8727('0xd')](function(){return _0xffd783(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x8727('0x1d')](_0x4160c3,_0x1916f7,![],null)[_0x8727('0xd')](function(){return _0xffd783(null,![],{'message':_0x8727('0x18')});});}}}else{return _0xffd783(null,![],{'message':_0x8727('0x18')});}}else{if(_0x4160c3[_0x8727('0x1a')]){return _0xffd783(null,![],{'message':_0x8727('0x18')});}else if(_0x435911[_0x8727('0x1b')]>0x0){if(_0x4160c3[_0x8727('0x13')]){if(_0x435911[_0x8727('0xc')]>0x0){if(moment(_0x4160c3[_0x8727('0x14')])[_0x8727('0x1c')](_0x435911[_0x8727('0xc')],'minutes')>moment()){return _0xffd783(null,![],{'message':_0x8727('0x18')});}else{return utils[_0x8727('0x1d')](_0x4160c3,0x0,![],null)['then'](function(){return utils['getLicense'](_0x4160c3);})[_0x8727('0xd')](function(){return _0xffd783(null,_0x4160c3);});}}else{return _0xffd783(null,![],{'message':_0x8727('0x18')});}}else{return utils[_0x8727('0x1d')](_0x4160c3,0x0,![],null)['then'](function(){return utils[_0x8727('0x1e')](_0x4160c3);})[_0x8727('0xd')](function(){return _0xffd783(null,_0x4160c3);})[_0x8727('0x1f')](function(_0x440ff5){return _0xffd783(null,![],_0x440ff5);});}}else{if(_0x4160c3[_0x8727('0x13')]){return _0xffd783(null,![],{'message':_0x8727('0x18')});}else{return utils[_0x8727('0x1e')](_0x4160c3)[_0x8727('0xd')](function(){return _0xffd783(null,_0x4160c3);});}}}});})['catch'](function(_0x243f15){return _0xffd783(null,![],_0x243f15);});}function sendServiceMail(_0x307055){return db['MailAccount'][_0x8727('0x20')]({'where':{'service':!![]},'attributes':['id',_0x8727('0xf'),_0x8727('0x21')],'include':[{'model':db[_0x8727('0x22')],'as':_0x8727('0x23')}]})[_0x8727('0xd')](function(_0x57733d){if(!_0x57733d){throw new Error(_0x8727('0x24'));}var _0x563201={'tls':{'rejectUnauthorized':![]}};if(_0x57733d[_0x8727('0x23')]['service']){_0x563201[_0x8727('0x25')]=_0x57733d[_0x8727('0x23')][_0x8727('0x25')];}else{_0x563201[_0x8727('0x26')]=_0x57733d[_0x8727('0x23')][_0x8727('0x26')];_0x563201[_0x8727('0x27')]=_0x57733d['Smtp'][_0x8727('0x27')];_0x563201[_0x8727('0x28')]=_0x57733d[_0x8727('0x23')][_0x8727('0x28')];}if(_0x57733d[_0x8727('0x23')][_0x8727('0x29')]){_0x563201[_0x8727('0x2a')]={'user':_0x57733d[_0x8727('0x23')][_0x8727('0x16')],'pass':_0x57733d[_0x8727('0x23')][_0x8727('0x2b')]};}var _0x184905={'account':_0x563201,'message':_['merge']({'from':util['format'](_0x8727('0x2c'),_0x57733d[_0x8727('0xf')],_0x57733d[_0x8727('0x21')]||_0x57733d[_0x8727('0x23')]['user'])},_0x307055)};return client[_0x8727('0x2d')](_0x8727('0x2e'),_0x184905);})[_0x8727('0xd')](function(_0x26c545){if(_0x26c545[_0x8727('0x2f')]){throw new Error(util['format'](_0x8727('0x30'),_0x26c545[_0x8727('0x2f')][_0x8727('0x31')]||JSON[_0x8727('0x32')](_0x26c545[_0x8727('0x2f')])));}return!![];});}function handleError(_0x3b1022,_0x27b950,_0x30c0d0){return _0x3b1022[_0x8727('0x33')](_0x27b950||0x1f4)[_0x8727('0x34')]({'message':_0x30c0d0?_0x30c0d0[_0x8727('0x31')]||_0x30c0d0:''});}exports[_0x8727('0x35')]=function(_0x5e1ea1,_0x51c66d,_0x792419){passport[_0x8727('0x19')](_0x8727('0x36'),function(_0x703078,_0x2c60b0,_0x308035){var _0x41b08e=_0x703078||_0x308035;if(_0x41b08e){return handleError(_0x51c66d,0x191,_0x41b08e);}if(!_0x2c60b0){return handleError(_0x51c66d,0x194,{'message':_0x8727('0x37')});}else{var _0x2a1bd8={'payload':{'id':_0x2c60b0['id'],'role':_0x2c60b0[_0x8727('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0x8727('0x38')](_0x2a1bd8)[_0x8727('0xd')](function(_0x7e3454){_0x51c66d['json']({'id':_0x2c60b0['id'],'token':_0x7e3454,'statusCall':'','isAlreadyLogged':_0x2c60b0[_0x8727('0x39')]});});}})(_0x5e1ea1,_0x51c66d,_0x792419);};exports[_0x8727('0x3a')]=function(_0x19d08a,_0x4ac9d2,_0x2a506f){if(!_0x19d08a[_0x8727('0x3b')][_0x8727('0x21')]){return handleError(_0x4ac9d2,0x1f4,{'message':_0x8727('0x3c')});}var _0x57817f=rs[_0x8727('0x3d')]();_0x19d08a[_0x8727('0x3b')][_0x8727('0x21')]=_0x19d08a[_0x8727('0x3b')][_0x8727('0x21')][_0x8727('0x3e')]()[_0x8727('0x3f')]();var _0x15b764;return db[_0x8727('0x40')][_0x8727('0xe')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x8727('0xc')],'raw':!![]})[_0x8727('0xd')](function(_0x21bfe8){_0x15b764=_0x21bfe8;return db[_0x8727('0x41')][_0x8727('0x20')]({'where':{'email':_0x19d08a['body'][_0x8727('0x21')]}});})[_0x8727('0xd')](function(_0x116e05){if(!_0x116e05){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x116e05[_0x8727('0x1a')]){throw new Error(_0x8727('0x42'));}if(_0x116e05[_0x8727('0x13')]){if(moment(_0x116e05[_0x8727('0x14')])[_0x8727('0x1c')](_0x15b764[_0x8727('0xc')],'minutes')>moment()){throw new Error(_0x8727('0x43'));}else{_0x116e05[_0x8727('0x13')]=![];_0x116e05[_0x8727('0x14')]=null;}}_0x116e05['resetPasswordToken']=_0x57817f;_0x116e05[_0x8727('0x44')]=Date[_0x8727('0x45')]()+0x36ee80;return _0x116e05[_0x8727('0x46')]();})[_0x8727('0xd')](function(){return sendServiceMail({'to':_0x19d08a[_0x8727('0x3b')][_0x8727('0x21')],'subject':_0x8727('0x47'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x8727('0x48')+_0x8727('0x49')+_0x19d08a[_0x8727('0x4a')][_0x8727('0x26')]+_0x8727('0x4b')+_0x57817f+'\x0a\x0a'+_0x8727('0x4c')});})[_0x8727('0xd')](function(){_0x4ac9d2['status'](0xc8)[_0x8727('0x34')]({'message':_0x8727('0x4d')});})[_0x8727('0x1f')](function(_0x5d6c81){return handleError(_0x4ac9d2,0x1f4,_0x5d6c81);});};exports[_0x8727('0x4e')]=function(_0x22cd31,_0x24fd60,_0x4367e8){return db[_0x8727('0x41')][_0x8727('0x20')]({'where':{'resetPasswordToken':_0x22cd31[_0x8727('0x4f')]['token'],'resetPasswordExpires':{'$gt':Date[_0x8727('0x45')]()}}})['then'](function(_0x207893){if(!_0x207893){throw new Error(_0x8727('0x50'));}return db['Setting'][_0x8727('0xe')]({'attributes':['id',_0x8727('0x51'),_0x8727('0x52'),'passwordHistoryLimit']})['then'](function(_0x13f70f){if(_0x13f70f[_0x8727('0x51')])authService[_0x8727('0x53')](_0x22cd31['body'][_0x8727('0x10')]);if(!_0x13f70f[_0x8727('0x52')]||!_0x207893[_0x8727('0x54')])return _0x207893;authService[_0x8727('0x55')](_0x22cd31[_0x8727('0x3b')][_0x8727('0x10')],_0x207893[_0x8727('0x54')],_0x13f70f[_0x8727('0x56')]);return _0x207893;})['then'](function(){_0x207893[_0x8727('0x10')]=_0x22cd31[_0x8727('0x3b')][_0x8727('0x10')];_0x207893[_0x8727('0x57')]=null;_0x207893['resetPasswordExpires']=null;return _0x207893[_0x8727('0x46')]();});})[_0x8727('0xd')](function(){_0x24fd60[_0x8727('0x33')](0xc8)[_0x8727('0x34')]({'message':_0x8727('0x58')});})[_0x8727('0x1f')](function(_0x28b9c0){return handleError(_0x24fd60,0x1f4,_0x28b9c0);});};passport[_0x8727('0x59')](new LocalStrategy({'usernameField':'name','passwordField':_0x8727('0x10')},function(_0x291b3e,_0x168953,_0x47a9f0){return localAuthenticate(db[_0x8727('0x41')],_0x291b3e,_0x168953,_0x47a9f0);})); \ No newline at end of file +var _0x7ee1=['authenticate','allowedLoginAttempts','blockDuration','blockedAt','add','clearBlockUser','disabled','getLicense','catch','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','SendMail','error','message','status','send','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use','User','util','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','findOne','name','password','salt','role','blocked','loginAttempts','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x7ee1,0x8d));var _0x17ee=function(_0x68558,_0x8a85ea){_0x68558=_0x68558-0x0;var _0x2aa004=_0x7ee1[_0x68558];return _0x2aa004;};'use strict';var util=require(_0x17ee('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0x17ee('0x1'));var _=require(_0x17ee('0x2'));var rs=require(_0x17ee('0x3'));var moment=require('moment');var db=require(_0x17ee('0x4'))['db'];var authService=require(_0x17ee('0x5'));var utils=require(_0x17ee('0x6'));var client=jayson[_0x17ee('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x52b1db,_0x29b9eb,_0x54b4f6,_0x3f61af){var _0x57e1d1,_0x3d767b;return db[_0x17ee('0x8')][_0x17ee('0x9')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0x17f935){_0x57e1d1=_0x17f935;return _0x52b1db['findOne']({'attributes':['id',_0x17ee('0xa'),_0x17ee('0xb'),_0x17ee('0xc'),_0x17ee('0xd'),'disabled',_0x17ee('0xe'),'blockedAt',_0x17ee('0xf')],'where':{'name':_0x29b9eb,'role':{'$or':[_0x17ee('0x10'),_0x17ee('0x11'),_0x17ee('0x12')]}}});})[_0x17ee('0x13')](function(_0xca5e20){if(!_0xca5e20||_0xca5e20&&_0xca5e20[_0x17ee('0xa')]!==_0x29b9eb){throw new Error(_0x17ee('0x14'));}else{_0x3d767b=_0xca5e20;return _0x3d767b;}})[_0x17ee('0x13')](function(){_0x3d767b[_0x17ee('0x15')](_0x54b4f6,function(_0x329af2,_0x52d679){var _0x4b66be=_0x3d767b['loginAttempts']+0x1;if(_0x329af2){return _0x3f61af(_0x329af2);}else if(!_0x52d679){if(_0x3d767b['disabled']){return _0x3f61af(null,![],{'message':_0x17ee('0x14')});}else if(_0x57e1d1[_0x17ee('0x16')]>0x0){if(_0x3d767b[_0x17ee('0xe')]){if(_0x57e1d1[_0x17ee('0x17')]>0x0){if(moment(_0x3d767b[_0x17ee('0x18')])[_0x17ee('0x19')](_0x57e1d1[_0x17ee('0x17')],'minutes')>moment()){return _0x3f61af(null,![],{'message':_0x17ee('0x14')});}else{return utils[_0x17ee('0x1a')](_0x3d767b,_0x4b66be,![],null)[_0x17ee('0x13')](function(){return _0x3f61af(null,![],{'message':_0x17ee('0x14')});});}}else{return _0x3f61af(null,![],{'message':_0x17ee('0x14')});}}else{if(_0x4b66be>=_0x57e1d1['allowedLoginAttempts']){return utils[_0x17ee('0x1a')](_0x3d767b,0x0,!![],moment())['then'](function(){return _0x3f61af(null,![],{'message':_0x17ee('0x14')});});}else{return utils['clearBlockUser'](_0x3d767b,_0x4b66be,![],null)[_0x17ee('0x13')](function(){return _0x3f61af(null,![],{'message':_0x17ee('0x14')});});}}}else{return _0x3f61af(null,![],{'message':_0x17ee('0x14')});}}else{if(_0x3d767b[_0x17ee('0x1b')]){return _0x3f61af(null,![],{'message':_0x17ee('0x14')});}else if(_0x57e1d1[_0x17ee('0x16')]>0x0){if(_0x3d767b[_0x17ee('0xe')]){if(_0x57e1d1[_0x17ee('0x17')]>0x0){if(moment(_0x3d767b[_0x17ee('0x18')])[_0x17ee('0x19')](_0x57e1d1[_0x17ee('0x17')],'minutes')>moment()){return _0x3f61af(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x17ee('0x1a')](_0x3d767b,0x0,![],null)[_0x17ee('0x13')](function(){return utils[_0x17ee('0x1c')](_0x3d767b);})[_0x17ee('0x13')](function(){return _0x3f61af(null,_0x3d767b);});}}else{return _0x3f61af(null,![],{'message':_0x17ee('0x14')});}}else{return utils[_0x17ee('0x1a')](_0x3d767b,0x0,![],null)[_0x17ee('0x13')](function(){return utils[_0x17ee('0x1c')](_0x3d767b);})[_0x17ee('0x13')](function(){return _0x3f61af(null,_0x3d767b);})[_0x17ee('0x1d')](function(_0xfcfade){return _0x3f61af(null,![],_0xfcfade);});}}else{if(_0x3d767b[_0x17ee('0xe')]){return _0x3f61af(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x17ee('0x1c')](_0x3d767b)[_0x17ee('0x13')](function(){return _0x3f61af(null,_0x3d767b);});}}}});})[_0x17ee('0x1d')](function(_0x258018){return _0x3f61af(null,![],_0x258018);});}function sendServiceMail(_0x125513){return db['MailAccount'][_0x17ee('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x17ee('0xa'),_0x17ee('0x1f')],'include':[{'model':db['MailServerOut'],'as':_0x17ee('0x20')}]})[_0x17ee('0x13')](function(_0x56c6ba){if(!_0x56c6ba){throw new Error(_0x17ee('0x21'));}var _0x549e3b={'tls':{'rejectUnauthorized':![]}};if(_0x56c6ba[_0x17ee('0x20')]['service']){_0x549e3b[_0x17ee('0x22')]=_0x56c6ba[_0x17ee('0x20')][_0x17ee('0x22')];}else{_0x549e3b['host']=_0x56c6ba[_0x17ee('0x20')][_0x17ee('0x23')];_0x549e3b['port']=_0x56c6ba[_0x17ee('0x20')][_0x17ee('0x24')];_0x549e3b[_0x17ee('0x25')]=_0x56c6ba['Smtp']['secure'];}if(_0x56c6ba[_0x17ee('0x20')][_0x17ee('0x26')]){_0x549e3b[_0x17ee('0x27')]={'user':_0x56c6ba[_0x17ee('0x20')]['user'],'pass':_0x56c6ba['Smtp'][_0x17ee('0x28')]};}var _0x2408af={'account':_0x549e3b,'message':_[_0x17ee('0x29')]({'from':util[_0x17ee('0x2a')](_0x17ee('0x2b'),_0x56c6ba[_0x17ee('0xa')],_0x56c6ba[_0x17ee('0x1f')]||_0x56c6ba['Smtp']['user'])},_0x125513)};return client['request'](_0x17ee('0x2c'),_0x2408af);})['then'](function(_0x1aa9a7){if(_0x1aa9a7[_0x17ee('0x2d')]){throw new Error(util[_0x17ee('0x2a')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x1aa9a7[_0x17ee('0x2d')][_0x17ee('0x2e')]||JSON['stringify'](_0x1aa9a7['error'])));}return!![];});}function handleError(_0xe93fc2,_0xa6657e,_0x12cedc){return _0xe93fc2[_0x17ee('0x2f')](_0xa6657e||0x1f4)[_0x17ee('0x30')]({'message':_0x12cedc?_0x12cedc['message']||_0x12cedc:''});}exports['login']=function(_0x36c2f0,_0x6d383e,_0x1cc0fa){passport[_0x17ee('0x15')](_0x17ee('0x31'),function(_0xe60d2f,_0x4bb35b,_0x50b909){var _0xe24eec=_0xe60d2f||_0x50b909;if(_0xe24eec){return handleError(_0x6d383e,0x191,_0xe24eec);}if(!_0x4bb35b){return handleError(_0x6d383e,0x194,{'message':_0x17ee('0x32')});}else{var _0x2580b4={'payload':{'id':_0x4bb35b['id'],'role':_0x4bb35b[_0x17ee('0xd')]},'options':{'expiresIn':0x15180}};return authService[_0x17ee('0x33')](_0x2580b4)[_0x17ee('0x13')](function(_0x463f98){_0x6d383e[_0x17ee('0x34')]({'id':_0x4bb35b['id'],'token':_0x463f98,'statusCall':'','isAlreadyLogged':_0x4bb35b[_0x17ee('0x35')]});});}})(_0x36c2f0,_0x6d383e,_0x1cc0fa);};exports[_0x17ee('0x36')]=function(_0x53cb88,_0x4f37f0,_0x4c3954){if(!_0x53cb88[_0x17ee('0x37')][_0x17ee('0x1f')]){return handleError(_0x4f37f0,0x1f4,{'message':_0x17ee('0x38')});}var _0x3a1ace=rs['generate']();_0x53cb88[_0x17ee('0x37')][_0x17ee('0x1f')]=_0x53cb88[_0x17ee('0x37')][_0x17ee('0x1f')]['trim']()[_0x17ee('0x39')]();var _0x55b4e2;return db[_0x17ee('0x8')][_0x17ee('0x9')]({'where':{'id':0x1},'attributes':[_0x17ee('0x16'),_0x17ee('0x17')],'raw':!![]})[_0x17ee('0x13')](function(_0x1f105a){_0x55b4e2=_0x1f105a;return db['User'][_0x17ee('0x1e')]({'where':{'email':_0x53cb88[_0x17ee('0x37')][_0x17ee('0x1f')]}});})[_0x17ee('0x13')](function(_0x7d3eb6){if(!_0x7d3eb6){throw new Error(_0x17ee('0x3a'));}if(_0x7d3eb6[_0x17ee('0x1b')]){throw new Error(_0x17ee('0x3b'));}if(_0x7d3eb6[_0x17ee('0xe')]){if(moment(_0x7d3eb6[_0x17ee('0x18')])[_0x17ee('0x19')](_0x55b4e2[_0x17ee('0x17')],'minutes')>moment()){throw new Error(_0x17ee('0x3c'));}else{_0x7d3eb6[_0x17ee('0xe')]=![];_0x7d3eb6['blockedAt']=null;}}_0x7d3eb6['resetPasswordToken']=_0x3a1ace;_0x7d3eb6['resetPasswordExpires']=Date[_0x17ee('0x3d')]()+0x36ee80;return _0x7d3eb6[_0x17ee('0x3e')]();})[_0x17ee('0x13')](function(){return sendServiceMail({'to':_0x53cb88[_0x17ee('0x37')][_0x17ee('0x1f')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x17ee('0x3f')+_0x17ee('0x40')+_0x17ee('0x41')+_0x53cb88[_0x17ee('0x42')][_0x17ee('0x23')]+_0x17ee('0x43')+_0x3a1ace+'\x0a\x0a'+_0x17ee('0x44')});})[_0x17ee('0x13')](function(){_0x4f37f0[_0x17ee('0x2f')](0xc8)[_0x17ee('0x30')]({'message':_0x17ee('0x45')});})[_0x17ee('0x1d')](function(_0x4a99bf){return handleError(_0x4f37f0,0x1f4,_0x4a99bf);});};exports['reset']=function(_0x348e6b,_0x3cecb2,_0x5a4b78){return db['User'][_0x17ee('0x1e')]({'where':{'resetPasswordToken':_0x348e6b['params'][_0x17ee('0x46')],'resetPasswordExpires':{'$gt':Date[_0x17ee('0x3d')]()}}})[_0x17ee('0x13')](function(_0x177552){if(!_0x177552){throw new Error(_0x17ee('0x47'));}return db[_0x17ee('0x8')][_0x17ee('0x9')]({'attributes':['id',_0x17ee('0x48'),_0x17ee('0x49'),_0x17ee('0x4a')]})[_0x17ee('0x13')](function(_0x34e572){if(_0x34e572[_0x17ee('0x48')])authService['validatePasswordPattern'](_0x348e6b[_0x17ee('0x37')][_0x17ee('0xb')]);if(!_0x34e572['enforcePasswordHistory']||!_0x177552[_0x17ee('0x4b')])return _0x177552;authService[_0x17ee('0x4c')](_0x348e6b['body'][_0x17ee('0xb')],_0x177552[_0x17ee('0x4b')],_0x34e572[_0x17ee('0x4a')]);return _0x177552;})[_0x17ee('0x13')](function(){_0x177552[_0x17ee('0xb')]=_0x348e6b[_0x17ee('0x37')][_0x17ee('0xb')];_0x177552['resetPasswordToken']=null;_0x177552[_0x17ee('0x4d')]=null;return _0x177552['save']();});})['then'](function(){_0x3cecb2[_0x17ee('0x2f')](0xc8)[_0x17ee('0x30')]({'message':_0x17ee('0x4e')});})['catch'](function(_0x575ff0){return handleError(_0x3cecb2,0x1f4,_0x575ff0);});};passport[_0x17ee('0x4f')](new LocalStrategy({'usernameField':_0x17ee('0xa'),'passwordField':_0x17ee('0xb')},function(_0x2dbe4a,_0x2dbabe,_0x2b98f1){return localAuthenticate(db[_0x17ee('0x50')],_0x2dbe4a,_0x2dbabe,_0x2b98f1);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 52b3c7c..86b91b4 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 _0xaa70=['forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller','post','login','/forgot'];(function(_0x535bf0,_0x5a9594){var _0x4679df=function(_0x42b887){while(--_0x42b887){_0x535bf0['push'](_0x535bf0['shift']());}};_0x4679df(++_0x5a9594);}(_0xaa70,0x1a8));var _0x0aa7=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xaa70[_0x9cd4c3];return _0x4c9025;};'use strict';var express=require(_0x0aa7('0x0'));var router=express[_0x0aa7('0x1')]();var controller=require(_0x0aa7('0x2'));router[_0x0aa7('0x3')]('/',controller[_0x0aa7('0x4')]);router[_0x0aa7('0x3')](_0x0aa7('0x5'),controller[_0x0aa7('0x6')]);router[_0x0aa7('0x3')](_0x0aa7('0x7'),controller[_0x0aa7('0x8')]);module[_0x0aa7('0x9')]=router; \ No newline at end of file +var _0xcabc=['post','login','forgot','reset','exports','Router','./authLocal.controller'];(function(_0x414655,_0x79d916){var _0x237884=function(_0x2737d9){while(--_0x2737d9){_0x414655['push'](_0x414655['shift']());}};_0x237884(++_0x79d916);}(_0xcabc,0x16a));var _0xccab=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xcabc[_0x57b54c];return _0x59cc19;};'use strict';var express=require('express');var router=express[_0xccab('0x0')]();var controller=require(_0xccab('0x1'));router[_0xccab('0x2')]('/',controller[_0xccab('0x3')]);router[_0xccab('0x2')]('/forgot',controller[_0xccab('0x4')]);router[_0xccab('0x2')]('/reset/:token',controller[_0xccab('0x5')]);module[_0xccab('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 013759e..aeb0c66 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 _0xa118=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x4c18f6,_0x5ed344){var _0x2fd724=function(_0x25fcd1){while(--_0x25fcd1){_0x4c18f6['push'](_0x4c18f6['shift']());}};_0x2fd724(++_0x5ed344);}(_0xa118,0x19a));var _0x8a11=function(_0x2a82bb,_0x1aa9aa){_0x2a82bb=_0x2a82bb-0x0;var _0x29f4b0=_0xa118[_0x2a82bb];return _0x29f4b0;};'use strict';var Sequelize=require(_0x8a11('0x0'));module[_0x8a11('0x1')]={'name':{'type':Sequelize[_0x8a11('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8a11('0x2')]},'status':{'type':Sequelize[_0x8a11('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8a11('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x56a9=['sequelize','exports','STRING','BOOLEAN'];(function(_0x19d179,_0x4d4c53){var _0x5ae2e4=function(_0xa058c8){while(--_0xa058c8){_0x19d179['push'](_0x19d179['shift']());}};_0x5ae2e4(++_0x4d4c53);}(_0x56a9,0x16c));var _0x956a=function(_0x4206f5,_0x21f338){_0x4206f5=_0x4206f5-0x0;var _0xa29cf3=_0x56a9[_0x4206f5];return _0xa29cf3;};'use strict';var Sequelize=require(_0x956a('0x0'));module[_0x956a('0x1')]={'name':{'type':Sequelize[_0x956a('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x956a('0x2')]},'status':{'type':Sequelize[_0x956a('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 7955b56..3e11818 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 _0xa39e=['getActions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','end','status','json','undefined','offset','count','set','Content-Range','apply','reject','then','destroy','sendStatus','stack','name','send','index','Automation','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','Condition','ids','omit','getConditions','Action','addActions'];(function(_0x4ba63d,_0x45125c){var _0x531bfc=function(_0x30b24d){while(--_0x30b24d){_0x4ba63d['push'](_0x4ba63d['shift']());}};_0x531bfc(++_0x45125c);}(_0xa39e,0xa6));var _0xea39=function(_0x283b97,_0x2dd687){_0x283b97=_0x283b97-0x0;var _0xe5cbb9=_0xa39e[_0x283b97];return _0xe5cbb9;};'use strict';var emlformat=require(_0xea39('0x0'));var rimraf=require(_0xea39('0x1'));var zipdir=require(_0xea39('0x2'));var jsonpatch=require(_0xea39('0x3'));var rp=require('request-promise');var moment=require(_0xea39('0x4'));var BPromise=require(_0xea39('0x5'));var Mustache=require(_0xea39('0x6'));var util=require(_0xea39('0x7'));var path=require(_0xea39('0x8'));var sox=require(_0xea39('0x9'));var csv=require('to-csv');var ejs=require(_0xea39('0xa'));var fs=require('fs');var fs_extra=require(_0xea39('0xb'));var _=require(_0xea39('0xc'));var squel=require(_0xea39('0xd'));var crypto=require('crypto');var jsforce=require(_0xea39('0xe'));var deskjs=require(_0xea39('0xf'));var toCsv=require(_0xea39('0x10'));var querystring=require(_0xea39('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xea39('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xea39('0x13'));var logger=require(_0xea39('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xea39('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x630653,_0x4df8a8){_0x4df8a8=_0x4df8a8||0xcc;return function(_0x5023d6){if(_0x5023d6){return _0x630653['sendStatus'](_0x4df8a8);}return _0x630653['status'](_0x4df8a8)[_0xea39('0x16')]();};}function respondWithResult(_0xc3465a,_0x3c56cf){_0x3c56cf=_0x3c56cf||0xc8;return function(_0x3541c7){if(_0x3541c7){return _0xc3465a[_0xea39('0x17')](_0x3c56cf)[_0xea39('0x18')](_0x3541c7);}};}function respondWithFilteredResult(_0x5de9c6,_0x50bf46){return function(_0x20414f){if(_0x20414f){var _0x39f7d5=typeof _0x50bf46['offset']===_0xea39('0x19')&&typeof _0x50bf46['limit']===_0xea39('0x19');var _0x2d840f=_0x20414f['count'];var _0x1495e0=_0x39f7d5?0x0:_0x50bf46[_0xea39('0x1a')];var _0x4ebe40=_0x39f7d5?_0x20414f[_0xea39('0x1b')]:_0x50bf46['offset']+_0x50bf46['limit'];var _0x3bb786;if(_0x4ebe40>=_0x2d840f){_0x4ebe40=_0x2d840f;_0x3bb786=0xc8;}else{_0x3bb786=0xce;}_0x5de9c6[_0xea39('0x17')](_0x3bb786);return _0x5de9c6[_0xea39('0x1c')](_0xea39('0x1d'),_0x1495e0+'-'+_0x4ebe40+'/'+_0x2d840f)[_0xea39('0x18')](_0x20414f);}return null;};}function patchUpdates(_0x1e6f9a){return function(_0x1c57c8){try{jsonpatch[_0xea39('0x1e')](_0x1c57c8,_0x1e6f9a,!![]);}catch(_0x28be54){return BPromise[_0xea39('0x1f')](_0x28be54);}return _0x1c57c8['save']();};}function saveUpdates(_0x47b605,_0x4a7c14){return function(_0x37712b){if(_0x37712b){return _0x37712b['update'](_0x47b605)[_0xea39('0x20')](function(_0x19714d){return _0x19714d;});}return null;};}function removeEntity(_0x879217,_0x588610){return function(_0x2728c6){if(_0x2728c6){return _0x2728c6[_0xea39('0x21')]()[_0xea39('0x20')](function(){_0x879217['status'](0xcc)[_0xea39('0x16')]();});}};}function handleEntityNotFound(_0xc31c52,_0xf2c5fa){return function(_0x1b5da0){if(!_0x1b5da0){_0xc31c52[_0xea39('0x22')](0x194);}return _0x1b5da0;};}function handleError(_0xcff1e1,_0xcb5846){_0xcb5846=_0xcb5846||0x1f4;return function(_0x57aa60){logger['error'](_0x57aa60[_0xea39('0x23')]);if(_0x57aa60[_0xea39('0x24')]){delete _0x57aa60['name'];}_0xcff1e1[_0xea39('0x17')](_0xcb5846)[_0xea39('0x25')](_0x57aa60);};}exports[_0xea39('0x26')]=function(_0x16c5cf,_0x2706b8){var _0x3848e8={},_0x100425={},_0x4f8295={'count':0x0,'rows':[]};var _0x22e83b=_['map'](db[_0xea39('0x27')][_0xea39('0x28')],function(_0x3860d3){return{'name':_0x3860d3[_0xea39('0x29')],'type':_0x3860d3[_0xea39('0x2a')][_0xea39('0x2b')]};});_0x100425[_0xea39('0x2c')]=_['map'](_0x22e83b,_0xea39('0x24'));_0x100425['query']=_[_0xea39('0x2d')](_0x16c5cf[_0xea39('0x2e')]);_0x100425[_0xea39('0x2f')]=_[_0xea39('0x30')](_0x100425[_0xea39('0x2c')],_0x100425[_0xea39('0x2e')]);_0x3848e8[_0xea39('0x31')]=_[_0xea39('0x30')](_0x100425[_0xea39('0x2c')],qs[_0xea39('0x32')](_0x16c5cf[_0xea39('0x2e')]['fields']));_0x3848e8[_0xea39('0x31')]=_0x3848e8['attributes']['length']?_0x3848e8[_0xea39('0x31')]:_0x100425['model'];if(!_0x16c5cf[_0xea39('0x2e')][_0xea39('0x33')]('nolimit')){_0x3848e8[_0xea39('0x34')]=qs[_0xea39('0x34')](_0x16c5cf['query'][_0xea39('0x34')]);_0x3848e8[_0xea39('0x1a')]=qs['offset'](_0x16c5cf[_0xea39('0x2e')]['offset']);}_0x3848e8[_0xea39('0x35')]=qs[_0xea39('0x36')](_0x16c5cf['query'][_0xea39('0x36')]);_0x3848e8[_0xea39('0x37')]=qs[_0xea39('0x2f')](_[_0xea39('0x38')](_0x16c5cf[_0xea39('0x2e')],_0x100425['filters']),_0x22e83b);if(_0x16c5cf[_0xea39('0x2e')][_0xea39('0x39')]){_0x3848e8[_0xea39('0x37')]=_[_0xea39('0x3a')](_0x3848e8[_0xea39('0x37')],{'$or':_[_0xea39('0x3b')](_0x22e83b,function(_0x31c88f){if(_0x31c88f[_0xea39('0x2a')]!==_0xea39('0x3c')){var _0x4ecbcb={};_0x4ecbcb[_0x31c88f[_0xea39('0x24')]]={'$like':'%'+_0x16c5cf[_0xea39('0x2e')][_0xea39('0x39')]+'%'};return _0x4ecbcb;}})});}_0x3848e8=_[_0xea39('0x3a')]({},_0x3848e8,_0x16c5cf[_0xea39('0x3d')]);var _0x2cfba1={'where':_0x3848e8[_0xea39('0x37')]};return db[_0xea39('0x27')][_0xea39('0x1b')](_0x2cfba1)[_0xea39('0x20')](function(_0x203bff){_0x4f8295['count']=_0x203bff;if(_0x16c5cf[_0xea39('0x2e')][_0xea39('0x3e')]){_0x3848e8[_0xea39('0x3f')]=[{'all':!![]}];}return db[_0xea39('0x27')][_0xea39('0x40')](_0x3848e8);})[_0xea39('0x20')](function(_0x33951a){_0x4f8295[_0xea39('0x41')]=_0x33951a;return _0x4f8295;})['then'](respondWithFilteredResult(_0x2706b8,_0x3848e8))[_0xea39('0x42')](handleError(_0x2706b8,null));};exports[_0xea39('0x43')]=function(_0x2bf39e,_0x341248){var _0x36e65c={'raw':![],'where':{'id':_0x2bf39e[_0xea39('0x44')]['id']}},_0x1e614c={};_0x1e614c[_0xea39('0x2c')]=_['keys'](db['Automation'][_0xea39('0x28')]);_0x1e614c[_0xea39('0x2e')]=_[_0xea39('0x2d')](_0x2bf39e[_0xea39('0x2e')]);_0x1e614c[_0xea39('0x2f')]=_[_0xea39('0x30')](_0x1e614c['model'],_0x1e614c[_0xea39('0x2e')]);_0x36e65c[_0xea39('0x31')]=_[_0xea39('0x30')](_0x1e614c[_0xea39('0x2c')],qs[_0xea39('0x32')](_0x2bf39e[_0xea39('0x2e')][_0xea39('0x32')]));_0x36e65c[_0xea39('0x31')]=_0x36e65c[_0xea39('0x31')][_0xea39('0x45')]?_0x36e65c['attributes']:_0x1e614c[_0xea39('0x2c')];if(_0x2bf39e[_0xea39('0x2e')][_0xea39('0x3e')]){_0x36e65c[_0xea39('0x3f')]=[{'all':!![]}];}_0x36e65c=_[_0xea39('0x3a')]({},_0x36e65c,_0x2bf39e[_0xea39('0x3d')]);return db['Automation'][_0xea39('0x46')](_0x36e65c)[_0xea39('0x20')](handleEntityNotFound(_0x341248,null))[_0xea39('0x20')](respondWithResult(_0x341248,null))[_0xea39('0x42')](handleError(_0x341248,null));};exports[_0xea39('0x47')]=function(_0x2df19c,_0x5d0c9e){return db[_0xea39('0x27')][_0xea39('0x47')](_0x2df19c[_0xea39('0x48')],{})[_0xea39('0x20')](respondWithResult(_0x5d0c9e,0xc9))[_0xea39('0x42')](handleError(_0x5d0c9e,null));};exports[_0xea39('0x49')]=function(_0x4865bb,_0x185431){if(_0x4865bb[_0xea39('0x48')]['id']){delete _0x4865bb['body']['id'];}return db[_0xea39('0x27')][_0xea39('0x46')]({'where':{'id':_0x4865bb[_0xea39('0x44')]['id']}})[_0xea39('0x20')](handleEntityNotFound(_0x185431,null))[_0xea39('0x20')](saveUpdates(_0x4865bb['body'],null))['then'](respondWithResult(_0x185431,null))[_0xea39('0x42')](handleError(_0x185431,null));};exports[_0xea39('0x21')]=function(_0x232c6e,_0x40e7db){return db[_0xea39('0x27')]['find']({'where':{'id':_0x232c6e[_0xea39('0x44')]['id']}})[_0xea39('0x20')](handleEntityNotFound(_0x40e7db,null))[_0xea39('0x20')](removeEntity(_0x40e7db,null))[_0xea39('0x42')](handleError(_0x40e7db,null));};exports['addConditions']=function(_0x13e814,_0x4edb,_0x53d388){return db[_0xea39('0x4a')][_0xea39('0x46')]({'where':{'id':_0x13e814[_0xea39('0x44')]['id']}})[_0xea39('0x20')](handleEntityNotFound(_0x4edb,null))[_0xea39('0x20')](function(_0xb9b5aa){if(_0xb9b5aa){return _0xb9b5aa['addConditions'](_0x13e814['body'][_0xea39('0x4b')],_[_0xea39('0x4c')](_0x13e814['body'],[_0xea39('0x4b'),'id'])||{});}})[_0xea39('0x20')](respondWithResult(_0x4edb,null))['catch'](handleError(_0x4edb,null));};exports[_0xea39('0x4d')]=function(_0x17329b,_0x349cc7,_0x5a119c){var _0x1b87ba={};var _0x434d4b={};var _0x494077;var _0x4503e3;return db[_0xea39('0x27')]['findOne']({'where':{'id':_0x17329b['params']['id']}})[_0xea39('0x20')](handleEntityNotFound(_0x349cc7,null))[_0xea39('0x20')](function(_0x5b93eb){if(_0x5b93eb){_0x494077=_0x5b93eb;_0x434d4b[_0xea39('0x2c')]=_[_0xea39('0x2d')](db[_0xea39('0x4a')][_0xea39('0x28')]);_0x434d4b[_0xea39('0x2e')]=_[_0xea39('0x2d')](_0x17329b[_0xea39('0x2e')]);_0x434d4b['filters']=_[_0xea39('0x30')](_0x434d4b['model'],_0x434d4b[_0xea39('0x2e')]);_0x1b87ba[_0xea39('0x31')]=_['intersection'](_0x434d4b[_0xea39('0x2c')],qs[_0xea39('0x32')](_0x17329b['query'][_0xea39('0x32')]));_0x1b87ba[_0xea39('0x31')]=_0x1b87ba[_0xea39('0x31')][_0xea39('0x45')]?_0x1b87ba[_0xea39('0x31')]:_0x434d4b['model'];_0x1b87ba['order']=qs[_0xea39('0x36')](_0x17329b['query']['sort']);_0x1b87ba[_0xea39('0x37')]=qs['filters'](_[_0xea39('0x38')](_0x17329b['query'],_0x434d4b[_0xea39('0x2f')]));if(_0x17329b[_0xea39('0x2e')][_0xea39('0x39')]){_0x1b87ba[_0xea39('0x37')]=_[_0xea39('0x3a')](_0x1b87ba['where'],{'$or':_['map'](_0x1b87ba[_0xea39('0x31')],function(_0x3b7eeb){var _0x4b1130={};_0x4b1130[_0x3b7eeb]={'$like':'%'+_0x17329b[_0xea39('0x2e')][_0xea39('0x39')]+'%'};return _0x4b1130;})});}_0x1b87ba=_['merge']({},_0x1b87ba,_0x17329b[_0xea39('0x3d')]);return _0x494077[_0xea39('0x4d')](_0x1b87ba);}})[_0xea39('0x20')](function(_0x49bbdf){if(_0x49bbdf){_0x4503e3=_0x49bbdf[_0xea39('0x45')];if(!_0x17329b[_0xea39('0x2e')]['hasOwnProperty']('nolimit')){_0x1b87ba['limit']=qs[_0xea39('0x34')](_0x17329b[_0xea39('0x2e')][_0xea39('0x34')]);_0x1b87ba[_0xea39('0x1a')]=qs[_0xea39('0x1a')](_0x17329b[_0xea39('0x2e')][_0xea39('0x1a')]);}return _0x494077[_0xea39('0x4d')](_0x1b87ba);}})[_0xea39('0x20')](function(_0x381d0e){if(_0x381d0e){return _0x381d0e?{'count':_0x4503e3,'rows':_0x381d0e}:null;}})['then'](respondWithResult(_0x349cc7,null))['catch'](handleError(_0x349cc7,null));};exports['addActions']=function(_0x5e4b6a,_0x10bdd1,_0x2c8948){return db[_0xea39('0x4e')][_0xea39('0x46')]({'where':{'id':_0x5e4b6a[_0xea39('0x44')]['id']}})[_0xea39('0x20')](handleEntityNotFound(_0x10bdd1,null))[_0xea39('0x20')](function(_0x24a1d6){if(_0x24a1d6){return _0x24a1d6[_0xea39('0x4f')](_0x5e4b6a['body'][_0xea39('0x4b')],_['omit'](_0x5e4b6a[_0xea39('0x48')],['ids','id'])||{});}})[_0xea39('0x20')](respondWithResult(_0x10bdd1,null))['catch'](handleError(_0x10bdd1,null));};exports[_0xea39('0x50')]=function(_0x55cdaf,_0x4386b8,_0x1f6402){var _0x3c52b9={};var _0x44f7e2={};var _0x406c7e;var _0x86e3d1;return db[_0xea39('0x27')][_0xea39('0x51')]({'where':{'id':_0x55cdaf[_0xea39('0x44')]['id']}})[_0xea39('0x20')](handleEntityNotFound(_0x4386b8,null))[_0xea39('0x20')](function(_0x1c0483){if(_0x1c0483){_0x406c7e=_0x1c0483;_0x44f7e2[_0xea39('0x2c')]=_[_0xea39('0x2d')](db[_0xea39('0x4e')][_0xea39('0x28')]);_0x44f7e2['query']=_[_0xea39('0x2d')](_0x55cdaf[_0xea39('0x2e')]);_0x44f7e2[_0xea39('0x2f')]=_[_0xea39('0x30')](_0x44f7e2['model'],_0x44f7e2[_0xea39('0x2e')]);_0x3c52b9[_0xea39('0x31')]=_[_0xea39('0x30')](_0x44f7e2['model'],qs[_0xea39('0x32')](_0x55cdaf[_0xea39('0x2e')][_0xea39('0x32')]));_0x3c52b9[_0xea39('0x31')]=_0x3c52b9['attributes']['length']?_0x3c52b9[_0xea39('0x31')]:_0x44f7e2[_0xea39('0x2c')];_0x3c52b9[_0xea39('0x35')]=qs[_0xea39('0x36')](_0x55cdaf[_0xea39('0x2e')][_0xea39('0x36')]);_0x3c52b9['where']=qs[_0xea39('0x2f')](_[_0xea39('0x38')](_0x55cdaf[_0xea39('0x2e')],_0x44f7e2['filters']));if(_0x55cdaf[_0xea39('0x2e')]['filter']){_0x3c52b9['where']=_[_0xea39('0x3a')](_0x3c52b9[_0xea39('0x37')],{'$or':_[_0xea39('0x3b')](_0x3c52b9['attributes'],function(_0x2aca03){var _0x4099fa={};_0x4099fa[_0x2aca03]={'$like':'%'+_0x55cdaf[_0xea39('0x2e')]['filter']+'%'};return _0x4099fa;})});}_0x3c52b9=_[_0xea39('0x3a')]({},_0x3c52b9,_0x55cdaf[_0xea39('0x3d')]);return _0x406c7e['getActions'](_0x3c52b9);}})[_0xea39('0x20')](function(_0x3405cd){if(_0x3405cd){_0x86e3d1=_0x3405cd['length'];if(!_0x55cdaf[_0xea39('0x2e')][_0xea39('0x33')]('nolimit')){_0x3c52b9[_0xea39('0x34')]=qs[_0xea39('0x34')](_0x55cdaf['query'][_0xea39('0x34')]);_0x3c52b9['offset']=qs[_0xea39('0x1a')](_0x55cdaf[_0xea39('0x2e')][_0xea39('0x1a')]);}return _0x406c7e[_0xea39('0x50')](_0x3c52b9);}})[_0xea39('0x20')](function(_0x374dcd){if(_0x374dcd){return _0x374dcd?{'count':_0x86e3d1,'rows':_0x374dcd}:null;}})[_0xea39('0x20')](respondWithResult(_0x4386b8,null))[_0xea39('0x42')](handleError(_0x4386b8,null));}; \ No newline at end of file +var _0x81c1=['query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','then','includeAll','Automation','findAll','rows','include','catch','create','body','find','params','addConditions','ids','getConditions','nolimit','addActions','Action','omit','getActions','pick','length','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x52a7a9,_0x4df6fc){var _0x5253e4=function(_0xc13118){while(--_0xc13118){_0x52a7a9['push'](_0x52a7a9['shift']());}};_0x5253e4(++_0x4df6fc);}(_0x81c1,0xcb));var _0x181c=function(_0x45dfa3,_0x43b8f9){_0x45dfa3=_0x45dfa3-0x0;var _0x22e742=_0x81c1[_0x45dfa3];return _0x22e742;};'use strict';var emlformat=require(_0x181c('0x0'));var rimraf=require(_0x181c('0x1'));var zipdir=require(_0x181c('0x2'));var jsonpatch=require(_0x181c('0x3'));var rp=require(_0x181c('0x4'));var moment=require(_0x181c('0x5'));var BPromise=require(_0x181c('0x6'));var Mustache=require(_0x181c('0x7'));var util=require(_0x181c('0x8'));var path=require(_0x181c('0x9'));var sox=require(_0x181c('0xa'));var csv=require(_0x181c('0xb'));var ejs=require(_0x181c('0xc'));var fs=require('fs');var fs_extra=require(_0x181c('0xd'));var _=require(_0x181c('0xe'));var squel=require('squel');var crypto=require(_0x181c('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x181c('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x181c('0x11'));var Redis=require(_0x181c('0x12'));var authService=require(_0x181c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x181c('0x14'));var hardwareService=require(_0x181c('0x15'));var logger=require(_0x181c('0x16'))(_0x181c('0x17'));var utils=require(_0x181c('0x18'));var config=require(_0x181c('0x19'));var licenseUtil=require(_0x181c('0x1a'));var db=require(_0x181c('0x1b'))['db'];function respondWithStatusCode(_0x3d8a66,_0x443e94){_0x443e94=_0x443e94||0xcc;return function(_0x1a358a){if(_0x1a358a){return _0x3d8a66[_0x181c('0x1c')](_0x443e94);}return _0x3d8a66[_0x181c('0x1d')](_0x443e94)[_0x181c('0x1e')]();};}function respondWithResult(_0x2395c4,_0x3ddbb5){_0x3ddbb5=_0x3ddbb5||0xc8;return function(_0x487cda){if(_0x487cda){return _0x2395c4[_0x181c('0x1d')](_0x3ddbb5)[_0x181c('0x1f')](_0x487cda);}};}function respondWithFilteredResult(_0x1d75f7,_0x918e40){return function(_0x3d4d4f){if(_0x3d4d4f){var _0x1346cd=typeof _0x918e40[_0x181c('0x20')]===_0x181c('0x21')&&typeof _0x918e40[_0x181c('0x22')]===_0x181c('0x21');var _0x3a8f1e=_0x3d4d4f[_0x181c('0x23')];var _0x545347=_0x1346cd?0x0:_0x918e40[_0x181c('0x20')];var _0x33a10f=_0x1346cd?_0x3d4d4f['count']:_0x918e40[_0x181c('0x20')]+_0x918e40[_0x181c('0x22')];var _0x4495b9;if(_0x33a10f>=_0x3a8f1e){_0x33a10f=_0x3a8f1e;_0x4495b9=0xc8;}else{_0x4495b9=0xce;}_0x1d75f7[_0x181c('0x1d')](_0x4495b9);return _0x1d75f7['set']('Content-Range',_0x545347+'-'+_0x33a10f+'/'+_0x3a8f1e)['json'](_0x3d4d4f);}return null;};}function patchUpdates(_0x46081d){return function(_0x35a98d){try{jsonpatch[_0x181c('0x24')](_0x35a98d,_0x46081d,!![]);}catch(_0x49e526){return BPromise[_0x181c('0x25')](_0x49e526);}return _0x35a98d['save']();};}function saveUpdates(_0x580d58,_0x28e9b7){return function(_0x86cc07){if(_0x86cc07){return _0x86cc07['update'](_0x580d58)['then'](function(_0x3add55){return _0x3add55;});}return null;};}function removeEntity(_0xfe6fb0,_0x2171d7){return function(_0x37e4e1){if(_0x37e4e1){return _0x37e4e1[_0x181c('0x26')]()['then'](function(){_0xfe6fb0[_0x181c('0x1d')](0xcc)[_0x181c('0x1e')]();});}};}function handleEntityNotFound(_0x14c99b,_0x44eed6){return function(_0x269c92){if(!_0x269c92){_0x14c99b[_0x181c('0x1c')](0x194);}return _0x269c92;};}function handleError(_0x3b4920,_0x5a491f){_0x5a491f=_0x5a491f||0x1f4;return function(_0x25368f){logger[_0x181c('0x27')](_0x25368f['stack']);if(_0x25368f[_0x181c('0x28')]){delete _0x25368f['name'];}_0x3b4920['status'](_0x5a491f)[_0x181c('0x29')](_0x25368f);};}exports[_0x181c('0x2a')]=function(_0x26a02d,_0x4bec98){var _0x19e41f={},_0x55710c={},_0xfb1073={'count':0x0,'rows':[]};var _0x42640e=_[_0x181c('0x2b')](db['Automation'][_0x181c('0x2c')],function(_0x58e0d3){return{'name':_0x58e0d3[_0x181c('0x2d')],'type':_0x58e0d3[_0x181c('0x2e')][_0x181c('0x2f')]};});_0x55710c[_0x181c('0x30')]=_[_0x181c('0x2b')](_0x42640e,_0x181c('0x28'));_0x55710c[_0x181c('0x31')]=_[_0x181c('0x32')](_0x26a02d[_0x181c('0x31')]);_0x55710c[_0x181c('0x33')]=_['intersection'](_0x55710c['model'],_0x55710c[_0x181c('0x31')]);_0x19e41f[_0x181c('0x34')]=_[_0x181c('0x35')](_0x55710c[_0x181c('0x30')],qs[_0x181c('0x36')](_0x26a02d[_0x181c('0x31')][_0x181c('0x36')]));_0x19e41f['attributes']=_0x19e41f['attributes']['length']?_0x19e41f[_0x181c('0x34')]:_0x55710c[_0x181c('0x30')];if(!_0x26a02d[_0x181c('0x31')][_0x181c('0x37')]('nolimit')){_0x19e41f[_0x181c('0x22')]=qs['limit'](_0x26a02d['query'][_0x181c('0x22')]);_0x19e41f[_0x181c('0x20')]=qs['offset'](_0x26a02d[_0x181c('0x31')][_0x181c('0x20')]);}_0x19e41f[_0x181c('0x38')]=qs[_0x181c('0x39')](_0x26a02d[_0x181c('0x31')][_0x181c('0x39')]);_0x19e41f[_0x181c('0x3a')]=qs[_0x181c('0x33')](_['pick'](_0x26a02d[_0x181c('0x31')],_0x55710c[_0x181c('0x33')]),_0x42640e);if(_0x26a02d[_0x181c('0x31')]['filter']){_0x19e41f[_0x181c('0x3a')]=_[_0x181c('0x3b')](_0x19e41f[_0x181c('0x3a')],{'$or':_[_0x181c('0x2b')](_0x42640e,function(_0x122bb0){if(_0x122bb0['type']!==_0x181c('0x3c')){var _0x408116={};_0x408116[_0x122bb0[_0x181c('0x28')]]={'$like':'%'+_0x26a02d[_0x181c('0x31')][_0x181c('0x3d')]+'%'};return _0x408116;}})});}_0x19e41f=_[_0x181c('0x3b')]({},_0x19e41f,_0x26a02d[_0x181c('0x3e')]);var _0x11eba3={'where':_0x19e41f[_0x181c('0x3a')]};return db['Automation'][_0x181c('0x23')](_0x11eba3)[_0x181c('0x3f')](function(_0x36660b){_0xfb1073[_0x181c('0x23')]=_0x36660b;if(_0x26a02d[_0x181c('0x31')][_0x181c('0x40')]){_0x19e41f['include']=[{'all':!![]}];}return db[_0x181c('0x41')][_0x181c('0x42')](_0x19e41f);})[_0x181c('0x3f')](function(_0x54a708){_0xfb1073[_0x181c('0x43')]=_0x54a708;return _0xfb1073;})[_0x181c('0x3f')](respondWithFilteredResult(_0x4bec98,_0x19e41f))['catch'](handleError(_0x4bec98,null));};exports['show']=function(_0x31350b,_0x4aced7){var _0x528072={'raw':![],'where':{'id':_0x31350b['params']['id']}},_0x3d987f={};_0x3d987f[_0x181c('0x30')]=_[_0x181c('0x32')](db[_0x181c('0x41')]['rawAttributes']);_0x3d987f['query']=_['keys'](_0x31350b[_0x181c('0x31')]);_0x3d987f[_0x181c('0x33')]=_[_0x181c('0x35')](_0x3d987f[_0x181c('0x30')],_0x3d987f[_0x181c('0x31')]);_0x528072[_0x181c('0x34')]=_['intersection'](_0x3d987f[_0x181c('0x30')],qs[_0x181c('0x36')](_0x31350b[_0x181c('0x31')][_0x181c('0x36')]));_0x528072[_0x181c('0x34')]=_0x528072[_0x181c('0x34')]['length']?_0x528072[_0x181c('0x34')]:_0x3d987f[_0x181c('0x30')];if(_0x31350b[_0x181c('0x31')][_0x181c('0x40')]){_0x528072[_0x181c('0x44')]=[{'all':!![]}];}_0x528072=_['merge']({},_0x528072,_0x31350b[_0x181c('0x3e')]);return db[_0x181c('0x41')]['find'](_0x528072)[_0x181c('0x3f')](handleEntityNotFound(_0x4aced7,null))['then'](respondWithResult(_0x4aced7,null))[_0x181c('0x45')](handleError(_0x4aced7,null));};exports['create']=function(_0x352020,_0x3a018e){return db[_0x181c('0x41')][_0x181c('0x46')](_0x352020[_0x181c('0x47')],{})['then'](respondWithResult(_0x3a018e,0xc9))['catch'](handleError(_0x3a018e,null));};exports['update']=function(_0x4102e1,_0x2840ac){if(_0x4102e1[_0x181c('0x47')]['id']){delete _0x4102e1[_0x181c('0x47')]['id'];}return db[_0x181c('0x41')][_0x181c('0x48')]({'where':{'id':_0x4102e1[_0x181c('0x49')]['id']}})[_0x181c('0x3f')](handleEntityNotFound(_0x2840ac,null))[_0x181c('0x3f')](saveUpdates(_0x4102e1['body'],null))['then'](respondWithResult(_0x2840ac,null))['catch'](handleError(_0x2840ac,null));};exports[_0x181c('0x26')]=function(_0x47ee9f,_0x56bb18){return db['Automation'][_0x181c('0x48')]({'where':{'id':_0x47ee9f['params']['id']}})['then'](handleEntityNotFound(_0x56bb18,null))['then'](removeEntity(_0x56bb18,null))[_0x181c('0x45')](handleError(_0x56bb18,null));};exports['addConditions']=function(_0x2d9083,_0x1a1bfe,_0x5f4341){return db['Condition'][_0x181c('0x48')]({'where':{'id':_0x2d9083['params']['id']}})['then'](handleEntityNotFound(_0x1a1bfe,null))[_0x181c('0x3f')](function(_0x5b9232){if(_0x5b9232){return _0x5b9232[_0x181c('0x4a')](_0x2d9083[_0x181c('0x47')]['ids'],_['omit'](_0x2d9083[_0x181c('0x47')],[_0x181c('0x4b'),'id'])||{});}})[_0x181c('0x3f')](respondWithResult(_0x1a1bfe,null))[_0x181c('0x45')](handleError(_0x1a1bfe,null));};exports[_0x181c('0x4c')]=function(_0x3cdd03,_0x1088fd,_0x35e96b){var _0x52b7c4={};var _0x188010={};var _0x1f772e;var _0x49b316;return db[_0x181c('0x41')]['findOne']({'where':{'id':_0x3cdd03['params']['id']}})[_0x181c('0x3f')](handleEntityNotFound(_0x1088fd,null))['then'](function(_0x27442c){if(_0x27442c){_0x1f772e=_0x27442c;_0x188010['model']=_['keys'](db['Condition']['rawAttributes']);_0x188010[_0x181c('0x31')]=_['keys'](_0x3cdd03[_0x181c('0x31')]);_0x188010[_0x181c('0x33')]=_[_0x181c('0x35')](_0x188010[_0x181c('0x30')],_0x188010[_0x181c('0x31')]);_0x52b7c4[_0x181c('0x34')]=_[_0x181c('0x35')](_0x188010[_0x181c('0x30')],qs['fields'](_0x3cdd03[_0x181c('0x31')][_0x181c('0x36')]));_0x52b7c4[_0x181c('0x34')]=_0x52b7c4[_0x181c('0x34')]['length']?_0x52b7c4[_0x181c('0x34')]:_0x188010[_0x181c('0x30')];_0x52b7c4[_0x181c('0x38')]=qs['sort'](_0x3cdd03[_0x181c('0x31')][_0x181c('0x39')]);_0x52b7c4['where']=qs[_0x181c('0x33')](_['pick'](_0x3cdd03[_0x181c('0x31')],_0x188010[_0x181c('0x33')]));if(_0x3cdd03[_0x181c('0x31')][_0x181c('0x3d')]){_0x52b7c4[_0x181c('0x3a')]=_[_0x181c('0x3b')](_0x52b7c4['where'],{'$or':_[_0x181c('0x2b')](_0x52b7c4[_0x181c('0x34')],function(_0x2909c2){var _0x1937ea={};_0x1937ea[_0x2909c2]={'$like':'%'+_0x3cdd03[_0x181c('0x31')][_0x181c('0x3d')]+'%'};return _0x1937ea;})});}_0x52b7c4=_['merge']({},_0x52b7c4,_0x3cdd03[_0x181c('0x3e')]);return _0x1f772e[_0x181c('0x4c')](_0x52b7c4);}})['then'](function(_0x1d4c50){if(_0x1d4c50){_0x49b316=_0x1d4c50['length'];if(!_0x3cdd03['query']['hasOwnProperty'](_0x181c('0x4d'))){_0x52b7c4['limit']=qs['limit'](_0x3cdd03[_0x181c('0x31')]['limit']);_0x52b7c4['offset']=qs[_0x181c('0x20')](_0x3cdd03['query']['offset']);}return _0x1f772e[_0x181c('0x4c')](_0x52b7c4);}})[_0x181c('0x3f')](function(_0x4fcc37){if(_0x4fcc37){return _0x4fcc37?{'count':_0x49b316,'rows':_0x4fcc37}:null;}})[_0x181c('0x3f')](respondWithResult(_0x1088fd,null))['catch'](handleError(_0x1088fd,null));};exports[_0x181c('0x4e')]=function(_0x2f133f,_0x1cf30e,_0x5c8ebc){return db[_0x181c('0x4f')]['find']({'where':{'id':_0x2f133f[_0x181c('0x49')]['id']}})[_0x181c('0x3f')](handleEntityNotFound(_0x1cf30e,null))['then'](function(_0x7e30ae){if(_0x7e30ae){return _0x7e30ae['addActions'](_0x2f133f[_0x181c('0x47')]['ids'],_[_0x181c('0x50')](_0x2f133f[_0x181c('0x47')],[_0x181c('0x4b'),'id'])||{});}})[_0x181c('0x3f')](respondWithResult(_0x1cf30e,null))[_0x181c('0x45')](handleError(_0x1cf30e,null));};exports[_0x181c('0x51')]=function(_0x120998,_0x4bb0d0,_0x3743cd){var _0x5ad225={};var _0x32e69e={};var _0x25e949;var _0x14c2fc;return db[_0x181c('0x41')]['findOne']({'where':{'id':_0x120998['params']['id']}})['then'](handleEntityNotFound(_0x4bb0d0,null))[_0x181c('0x3f')](function(_0x1983f6){if(_0x1983f6){_0x25e949=_0x1983f6;_0x32e69e[_0x181c('0x30')]=_['keys'](db[_0x181c('0x4f')][_0x181c('0x2c')]);_0x32e69e['query']=_['keys'](_0x120998[_0x181c('0x31')]);_0x32e69e['filters']=_[_0x181c('0x35')](_0x32e69e[_0x181c('0x30')],_0x32e69e[_0x181c('0x31')]);_0x5ad225[_0x181c('0x34')]=_[_0x181c('0x35')](_0x32e69e[_0x181c('0x30')],qs[_0x181c('0x36')](_0x120998[_0x181c('0x31')][_0x181c('0x36')]));_0x5ad225[_0x181c('0x34')]=_0x5ad225[_0x181c('0x34')]['length']?_0x5ad225['attributes']:_0x32e69e[_0x181c('0x30')];_0x5ad225[_0x181c('0x38')]=qs[_0x181c('0x39')](_0x120998[_0x181c('0x31')][_0x181c('0x39')]);_0x5ad225[_0x181c('0x3a')]=qs['filters'](_[_0x181c('0x52')](_0x120998[_0x181c('0x31')],_0x32e69e['filters']));if(_0x120998[_0x181c('0x31')][_0x181c('0x3d')]){_0x5ad225[_0x181c('0x3a')]=_['merge'](_0x5ad225['where'],{'$or':_[_0x181c('0x2b')](_0x5ad225[_0x181c('0x34')],function(_0x18d8a7){var _0x8ee720={};_0x8ee720[_0x18d8a7]={'$like':'%'+_0x120998['query'][_0x181c('0x3d')]+'%'};return _0x8ee720;})});}_0x5ad225=_[_0x181c('0x3b')]({},_0x5ad225,_0x120998[_0x181c('0x3e')]);return _0x25e949[_0x181c('0x51')](_0x5ad225);}})[_0x181c('0x3f')](function(_0x177f2d){if(_0x177f2d){_0x14c2fc=_0x177f2d[_0x181c('0x53')];if(!_0x120998[_0x181c('0x31')][_0x181c('0x37')](_0x181c('0x4d'))){_0x5ad225[_0x181c('0x22')]=qs['limit'](_0x120998[_0x181c('0x31')][_0x181c('0x22')]);_0x5ad225['offset']=qs['offset'](_0x120998[_0x181c('0x31')][_0x181c('0x20')]);}return _0x25e949[_0x181c('0x51')](_0x5ad225);}})['then'](function(_0x449af8){if(_0x449af8){return _0x449af8?{'count':_0x14c2fc,'rows':_0x449af8}:null;}})[_0x181c('0x3f')](respondWithResult(_0x4bb0d0,null))[_0x181c('0x45')](handleError(_0x4bb0d0,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 698a759..8c57b84 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 _0x6eb8=['path','rimraf','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','api','moment','request-promise'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x6eb8,0xeb));var _0x86eb=function(_0x14734a,_0x1c14d4){_0x14734a=_0x14734a-0x0;var _0xb02e33=_0x6eb8[_0x14734a];return _0xb02e33;};'use strict';var _=require(_0x86eb('0x0'));var util=require(_0x86eb('0x1'));var logger=require('../../config/logger')(_0x86eb('0x2'));var moment=require(_0x86eb('0x3'));var BPromise=require('bluebird');var rp=require(_0x86eb('0x4'));var fs=require('fs');var path=require(_0x86eb('0x5'));var rimraf=require(_0x86eb('0x6'));var config=require('../../config/environment');var attributes=require(_0x86eb('0x7'));module[_0x86eb('0x8')]=function(_0x14c782,_0x16fc61){return _0x14c782[_0x86eb('0x9')](_0x86eb('0xa'),attributes,{'tableName':_0x86eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d74=['exports','Automation','lodash','util','moment','bluebird','rimraf','../../config/environment','./automation.attributes'];(function(_0x3c20c7,_0x339e21){var _0x5cb0dd=function(_0xa9e4d9){while(--_0xa9e4d9){_0x3c20c7['push'](_0x3c20c7['shift']());}};_0x5cb0dd(++_0x339e21);}(_0x0d74,0x146));var _0x40d7=function(_0x38bbbe,_0x4cd210){_0x38bbbe=_0x38bbbe-0x0;var _0x2b097f=_0x0d74[_0x38bbbe];return _0x2b097f;};'use strict';var _=require(_0x40d7('0x0'));var util=require(_0x40d7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x40d7('0x2'));var BPromise=require(_0x40d7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x40d7('0x4'));var config=require(_0x40d7('0x5'));var attributes=require(_0x40d7('0x6'));module[_0x40d7('0x7')]=function(_0x5edb57,_0x5280f0){return _0x5edb57['define'](_0x40d7('0x8'),attributes,{'tableName':'tools_automations','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 395313f..2b6ab7f 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 _0x7a79=['message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x154cb5,_0x1a8d5a){var _0x3f574f=function(_0x597a52){while(--_0x597a52){_0x154cb5['push'](_0x154cb5['shift']());}};_0x3f574f(++_0x1a8d5a);}(_0x7a79,0x15c));var _0x97a7=function(_0x37a0ab,_0x34b900){_0x37a0ab=_0x37a0ab-0x0;var _0x13ca1d=_0x7a79[_0x37a0ab];return _0x13ca1d;};'use strict';var _=require(_0x97a7('0x0'));var util=require(_0x97a7('0x1'));var moment=require(_0x97a7('0x2'));var BPromise=require('bluebird');var rs=require(_0x97a7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x97a7('0x4'))['db'];var utils=require(_0x97a7('0x5'));var logger=require(_0x97a7('0x6'))(_0x97a7('0x7'));var config=require(_0x97a7('0x8'));var jayson=require(_0x97a7('0x9'));var client=jayson[_0x97a7('0xa')][_0x97a7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fadc7,_0xce749a,_0x777f6){return new BPromise(function(_0x1065a7,_0xf52589){return client['request'](_0x4fadc7,_0x777f6)[_0x97a7('0xc')](function(_0x1dcde7){logger[_0x97a7('0xd')](_0x97a7('0xe'),_0xce749a,_0x97a7('0xf'));logger[_0x97a7('0x10')]('Automation,\x20%s,\x20%s,\x20%s',_0xce749a,'request\x20sent',JSON[_0x97a7('0x11')](_0x1dcde7));if(_0x1dcde7[_0x97a7('0x12')]){if(_0x1dcde7['error'][_0x97a7('0x13')]===0x1f4){logger[_0x97a7('0x12')](_0x97a7('0xe'),_0xce749a,_0x1dcde7['error'][_0x97a7('0x14')]);return _0xf52589(_0x1dcde7[_0x97a7('0x12')][_0x97a7('0x14')]);}logger['error'](_0x97a7('0xe'),_0xce749a,_0x1dcde7[_0x97a7('0x12')]['message']);return _0x1065a7(_0x1dcde7[_0x97a7('0x12')][_0x97a7('0x14')]);}else{logger[_0x97a7('0xd')](_0x97a7('0xe'),_0xce749a,_0x97a7('0xf'));_0x1065a7(_0x1dcde7[_0x97a7('0x15')][_0x97a7('0x14')]);}})[_0x97a7('0x16')](function(_0x5a77d4){logger[_0x97a7('0x12')]('Automation,\x20%s,\x20%s',_0xce749a,_0x5a77d4);_0xf52589(_0x5a77d4);});});} \ No newline at end of file +var _0xdc97=['Automation,\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','Automation,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5cb831,_0x5ecfca){var _0x5e0cfd=function(_0x1d6190){while(--_0x1d6190){_0x5cb831['push'](_0x5cb831['shift']());}};_0x5e0cfd(++_0x5ecfca);}(_0xdc97,0x13b));var _0x7dc9=function(_0x3ca0b9,_0x1403fe){_0x3ca0b9=_0x3ca0b9-0x0;var _0x5db207=_0xdc97[_0x3ca0b9];return _0x5db207;};'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']('Automation,\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 diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 3525181..ade7fa6 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 _0x8149=['../../components/interaction/service','./automation.controller','isAuthenticated','index','get','/:id','show','getConditions','/:id/actions','post','create','/:id/conditions','addConditions','addActions','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8149,0x148));var _0x9814=function(_0x4929fd,_0x2c9d98){_0x4929fd=_0x4929fd-0x0;var _0x1a700d=_0x8149[_0x4929fd];return _0x1a700d;};'use strict';var multer=require(_0x9814('0x0'));var util=require(_0x9814('0x1'));var path=require(_0x9814('0x2'));var timeout=require(_0x9814('0x3'));var express=require(_0x9814('0x4'));var router=express[_0x9814('0x5')]();var fs_extra=require(_0x9814('0x6'));var auth=require(_0x9814('0x7'));var interaction=require(_0x9814('0x8'));var config=require('../../config/environment');var controller=require(_0x9814('0x9'));router['get']('/',auth[_0x9814('0xa')](),controller[_0x9814('0xb')]);router[_0x9814('0xc')](_0x9814('0xd'),auth[_0x9814('0xa')](),controller[_0x9814('0xe')]);router[_0x9814('0xc')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x9814('0xf')]);router[_0x9814('0xc')](_0x9814('0x10'),auth[_0x9814('0xa')](),controller['getActions']);router[_0x9814('0x11')]('/',auth[_0x9814('0xa')](),controller[_0x9814('0x12')]);router[_0x9814('0x11')](_0x9814('0x13'),auth[_0x9814('0xa')](),controller[_0x9814('0x14')]);router[_0x9814('0x11')](_0x9814('0x10'),auth['isAuthenticated'](),controller[_0x9814('0x15')]);router['put'](_0x9814('0xd'),auth[_0x9814('0xa')](),controller[_0x9814('0x16')]);router['delete'](_0x9814('0xd'),auth[_0x9814('0xa')](),controller[_0x9814('0x17')]);module['exports']=router; \ No newline at end of file +var _0x7767=['../../components/interaction/service','./automation.controller','isAuthenticated','index','get','show','/:id/conditions','getConditions','/:id/actions','post','addConditions','put','/:id','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x42fa48,_0x4467ac){var _0xc99c55=function(_0x5d09e4){while(--_0x5d09e4){_0x42fa48['push'](_0x42fa48['shift']());}};_0xc99c55(++_0x4467ac);}(_0x7767,0x16f));var _0x7776=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x7767[_0x38537f];return _0x141e23;};'use strict';var multer=require(_0x7776('0x0'));var util=require('util');var path=require(_0x7776('0x1'));var timeout=require(_0x7776('0x2'));var express=require(_0x7776('0x3'));var router=express[_0x7776('0x4')]();var fs_extra=require(_0x7776('0x5'));var auth=require(_0x7776('0x6'));var interaction=require(_0x7776('0x7'));var config=require('../../config/environment');var controller=require(_0x7776('0x8'));router['get']('/',auth[_0x7776('0x9')](),controller[_0x7776('0xa')]);router[_0x7776('0xb')]('/:id',auth[_0x7776('0x9')](),controller[_0x7776('0xc')]);router[_0x7776('0xb')](_0x7776('0xd'),auth['isAuthenticated'](),controller[_0x7776('0xe')]);router[_0x7776('0xb')](_0x7776('0xf'),auth[_0x7776('0x9')](),controller['getActions']);router[_0x7776('0x10')]('/',auth[_0x7776('0x9')](),controller['create']);router[_0x7776('0x10')](_0x7776('0xd'),auth[_0x7776('0x9')](),controller[_0x7776('0x11')]);router['post'](_0x7776('0xf'),auth[_0x7776('0x9')](),controller['addActions']);router[_0x7776('0x12')](_0x7776('0x13'),auth[_0x7776('0x9')](),controller[_0x7776('0x14')]);router['delete'](_0x7776('0x13'),auth[_0x7776('0x9')](),controller[_0x7776('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 1e3aa60..37f1444 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 _0xf44f=['Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','exports','STRING','ENUM','ivr','BOOLEAN','INTEGER','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','#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)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)'];(function(_0x5b64a1,_0x2ec810){var _0x4b6f55=function(_0x44dd84){while(--_0x44dd84){_0x5b64a1['push'](_0x5b64a1['shift']());}};_0x4b6f55(++_0x2ec810);}(_0xf44f,0x1d6));var _0xff44=function(_0x24a782,_0x14981f){_0x24a782=_0x24a782-0x0;var _0x4fa887=_0xf44f[_0x24a782];return _0x4fa887;};'use strict';var Sequelize=require('sequelize');module[_0xff44('0x0')]={'name':{'type':Sequelize[_0xff44('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xff44('0x2')]('ivr'),'allowNull':![],'defaultValue':_0xff44('0x3')},'description':{'type':Sequelize[_0xff44('0x1')]},'active':{'type':Sequelize[_0xff44('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xff44('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xff44('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0xff44('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xff44('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff44('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0xff44('0x5')](0x3)[_0xff44('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff44('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xff44('0x5')](0x5)[_0xff44('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xff44('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xff44('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff44('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xff44('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xff44('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xff44('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xff44('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xff44('0xe')},'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[_0xff44('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xff44('0x1')],'defaultValue':_0xff44('0xf')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xff44('0x10'),_0xff44('0x11'),_0xff44('0x12')),'defaultValue':_0xff44('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xff44('0x5')](0x9)[_0xff44('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xff44('0x5')](0x9)[_0xff44('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xff44('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xff44('0x5')](0x9)[_0xff44('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xff44('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xff44('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xff44('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xff44('0x5')](0x9)[_0xff44('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xff44('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xff44('0x5')](0x9)[_0xff44('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xff44('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xff44('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xff44('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xff44('0x5')](0x9)[_0xff44('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xff44('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0xff44('0x2')](_0xff44('0x1a'),'ASC'),'defaultValue':_0xff44('0x1a')},'dialPrefix':{'type':Sequelize[_0xff44('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xff44('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xff44('0x5')](0x3)[_0xff44('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xff44('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xff44('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff44('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xff44('0x5')](0x5)[_0xff44('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xff44('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0xff44('0x5')](0x3)[_0xff44('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff44('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0xff44('0x5')](0x5)[_0xff44('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff44('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xff44('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xff44('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0xff44('0x5')](0x3)[_0xff44('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff44('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0xff44('0x5')](0x5)[_0xff44('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xff44('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xff44('0x5')](0x3)[_0xff44('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff44('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xff44('0x5')](0x5)[_0xff44('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x81fe=['Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','INTEGER','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0x81fe,0xcd));var _0xe81f=function(_0x2dc878,_0x187970){_0x2dc878=_0x2dc878-0x0;var _0x1ccb2c=_0x81fe[_0x2dc878];return _0x1ccb2c;};'use strict';var Sequelize=require(_0xe81f('0x0'));module['exports']={'name':{'type':Sequelize[_0xe81f('0x1')],'unique':_0xe81f('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xe81f('0x3')]('ivr'),'allowNull':![],'defaultValue':_0xe81f('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xe81f('0x5')],'defaultValue':0x0,'comment':_0xe81f('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xe81f('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xe81f('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xe81f('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe81f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe81f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe81f('0x9')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe81f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe81f('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0xe81f('0xb')](0x5)[_0xe81f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe81f('0xb')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xe81f('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe81f('0xb')](0x5)[_0xe81f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xe81f('0xb')](0x3)[_0xe81f('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe81f('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe81f('0x1')],'defaultValue':_0xe81f('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xe81f('0x3')]('always',_0xe81f('0xf'),_0xe81f('0x10')),'defaultValue':_0xe81f('0x11')},'dialAMDActive':{'type':Sequelize[_0xe81f('0x5')],'defaultValue':0x0,'comment':_0xe81f('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xe81f('0xb')](0x9)[_0xe81f('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xe81f('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xe81f('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xe81f('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xe81f('0xb')](0x9)[_0xe81f('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe81f('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xe81f('0xb')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe81f('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xe81f('0xb')](0x9)[_0xe81f('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xe81f('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xe81f('0xb')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xe81f('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe81f('0xb')](0x9)[_0xe81f('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xe81f('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xe81f('0xb')](0x5)[_0xe81f('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xe81f('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe81f('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0xe81f('0x3')](_0xe81f('0x1c'),_0xe81f('0x1d')),'defaultValue':_0xe81f('0x1c')},'dialPrefix':{'type':Sequelize[_0xe81f('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe81f('0xb')](0x3)[_0xe81f('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe81f('0x1e')},'dialCutDigit':{'type':Sequelize[_0xe81f('0xb')](0x3)[_0xe81f('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe81f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe81f('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xe81f('0xb')](0x5)[_0xe81f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe81f('0x20')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe81f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe81f('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xe81f('0xb')](0x3)[_0xe81f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe81f('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe81f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe81f('0x23')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe81f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe81f('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0xe81f('0xb')](0x5)[_0xe81f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe81f('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe81f('0xb')](0x3)[_0xe81f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe81f('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xe81f('0xb')](0x5)[_0xe81f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe81f('0x27')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 333fd72..3f59a47 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 _0x9c2c=['phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','cm_hopper','onlyIfOpen','cm_contacts','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','cmHopperId','h.id','ci.item','ci.OrderBY','OrderBy','cm_contact_has_items','join','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','map','Campaign','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','findOne','hasOwnProperty','order','CmHopper','findAll','getHopperHistories','CmHopperHistory','CampaignId','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL'];(function(_0x417ea9,_0x4ba54a){var _0x298bd0=function(_0x30a9d9){while(--_0x30a9d9){_0x417ea9['push'](_0x417ea9['shift']());}};_0x298bd0(++_0x4ba54a);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc9c2('0x0'));var rimraf=require(_0xc9c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc9c2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc9c2('0x3'));var util=require(_0xc9c2('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xc9c2('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc9c2('0x6'));var _=require(_0xc9c2('0x7'));var squel=require(_0xc9c2('0x8'));var crypto=require(_0xc9c2('0x9'));var jsforce=require(_0xc9c2('0xa'));var deskjs=require(_0xc9c2('0xb'));var toCsv=require(_0xc9c2('0x5'));var querystring=require(_0xc9c2('0xc'));var Papa=require(_0xc9c2('0xd'));var Redis=require('ioredis');var authService=require(_0xc9c2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc9c2('0xf'));var hardwareService=require(_0xc9c2('0x10'));var logger=require(_0xc9c2('0x11'))(_0xc9c2('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc9c2('0x13'));var db=require(_0xc9c2('0x14'))['db'];function respondWithStatusCode(_0x568f69,_0x7ec780){_0x7ec780=_0x7ec780||0xcc;return function(_0x1f08a7){if(_0x1f08a7){return _0x568f69[_0xc9c2('0x15')](_0x7ec780);}return _0x568f69[_0xc9c2('0x16')](_0x7ec780)[_0xc9c2('0x17')]();};}function respondWithResult(_0x3b0058,_0x33b288){_0x33b288=_0x33b288||0xc8;return function(_0x132702){if(_0x132702){return _0x3b0058[_0xc9c2('0x16')](_0x33b288)[_0xc9c2('0x18')](_0x132702);}};}function respondWithFilteredResult(_0xf94209,_0x383667){return function(_0x480d7c){if(_0x480d7c){var _0x27840d=typeof _0x383667[_0xc9c2('0x19')]===_0xc9c2('0x1a')&&typeof _0x383667[_0xc9c2('0x1b')]===_0xc9c2('0x1a');var _0x49413b=_0x480d7c[_0xc9c2('0x1c')];var _0x37c027=_0x27840d?0x0:_0x383667[_0xc9c2('0x19')];var _0x4e4ded=_0x27840d?_0x480d7c[_0xc9c2('0x1c')]:_0x383667[_0xc9c2('0x19')]+_0x383667[_0xc9c2('0x1b')];var _0x484ca3;if(_0x4e4ded>=_0x49413b){_0x4e4ded=_0x49413b;_0x484ca3=0xc8;}else{_0x484ca3=0xce;}_0xf94209[_0xc9c2('0x16')](_0x484ca3);return _0xf94209[_0xc9c2('0x1d')]('Content-Range',_0x37c027+'-'+_0x4e4ded+'/'+_0x49413b)['json'](_0x480d7c);}return null;};}function patchUpdates(_0x37e3){return function(_0x50f280){try{jsonpatch[_0xc9c2('0x1e')](_0x50f280,_0x37e3,!![]);}catch(_0x140c8a){return BPromise[_0xc9c2('0x1f')](_0x140c8a);}return _0x50f280[_0xc9c2('0x20')]();};}function saveUpdates(_0x3e1774,_0x53c460){return function(_0x1fbac4){if(_0x1fbac4){return _0x1fbac4[_0xc9c2('0x21')](_0x3e1774)[_0xc9c2('0x22')](function(_0x11cc07){return _0x11cc07;});}return null;};}function removeEntity(_0x32c372,_0x385030){return function(_0x56e515){if(_0x56e515){return _0x56e515[_0xc9c2('0x23')]()[_0xc9c2('0x22')](function(){var _0x5e47c2=_0x56e515[_0xc9c2('0x24')]({'plain':!![]});var _0x4b3b97=_0xc9c2('0x25');return db[_0xc9c2('0x26')][_0xc9c2('0x23')]({'where':{'type':_0x4b3b97,'resourceId':_0x5e47c2['id']}})[_0xc9c2('0x22')](function(){return _0x56e515;});})['then'](function(){_0x32c372[_0xc9c2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fcaa3,_0x3bd8e8){return function(_0x41f3e8){if(!_0x41f3e8){_0x2fcaa3[_0xc9c2('0x15')](0x194);}return _0x41f3e8;};}function handleError(_0x2119c6,_0x4cf642){_0x4cf642=_0x4cf642||0x1f4;return function(_0x3cedb5){logger[_0xc9c2('0x27')](_0x3cedb5[_0xc9c2('0x28')]);if(_0x3cedb5[_0xc9c2('0x29')]){delete _0x3cedb5[_0xc9c2('0x29')];}_0x2119c6[_0xc9c2('0x16')](_0x4cf642)[_0xc9c2('0x2a')](_0x3cedb5);};}exports['index']=function(_0x55b9c6,_0x4a9fca){var _0x228971={},_0x17d174={},_0x49fcd3={'count':0x0,'rows':[]};var _0xefbf7a=_[_0xc9c2('0x2b')](db[_0xc9c2('0x2c')][_0xc9c2('0x2d')],function(_0x5ccb7a){return{'name':_0x5ccb7a[_0xc9c2('0x2e')],'type':_0x5ccb7a[_0xc9c2('0x2f')]['key']};});_0x17d174['model']=_[_0xc9c2('0x2b')](_0xefbf7a,_0xc9c2('0x29'));_0x17d174[_0xc9c2('0x30')]=_['keys'](_0x55b9c6['query']);_0x17d174[_0xc9c2('0x31')]=_[_0xc9c2('0x32')](_0x17d174['model'],_0x17d174[_0xc9c2('0x30')]);_0x228971['attributes']=_[_0xc9c2('0x32')](_0x17d174[_0xc9c2('0x33')],qs[_0xc9c2('0x34')](_0x55b9c6[_0xc9c2('0x30')][_0xc9c2('0x34')]));_0x228971[_0xc9c2('0x35')]=_0x228971[_0xc9c2('0x35')][_0xc9c2('0x36')]?_0x228971[_0xc9c2('0x35')]:_0x17d174['model'];if(!_0x55b9c6[_0xc9c2('0x30')]['hasOwnProperty'](_0xc9c2('0x37'))){_0x228971[_0xc9c2('0x1b')]=qs['limit'](_0x55b9c6[_0xc9c2('0x30')][_0xc9c2('0x1b')]);_0x228971['offset']=qs[_0xc9c2('0x19')](_0x55b9c6[_0xc9c2('0x30')][_0xc9c2('0x19')]);}_0x228971['order']=qs[_0xc9c2('0x38')](_0x55b9c6['query'][_0xc9c2('0x38')]);_0x228971[_0xc9c2('0x39')]=qs['filters'](_[_0xc9c2('0x3a')](_0x55b9c6[_0xc9c2('0x30')],_0x17d174[_0xc9c2('0x31')]),_0xefbf7a);if(_0x55b9c6[_0xc9c2('0x30')][_0xc9c2('0x3b')]){_0x228971[_0xc9c2('0x39')]=_[_0xc9c2('0x3c')](_0x228971[_0xc9c2('0x39')],{'$or':_[_0xc9c2('0x2b')](_0xefbf7a,function(_0x42b8ec){if(_0x42b8ec[_0xc9c2('0x2f')]!=='VIRTUAL'){var _0x4c3bc0={};_0x4c3bc0[_0x42b8ec[_0xc9c2('0x29')]]={'$like':'%'+_0x55b9c6[_0xc9c2('0x30')][_0xc9c2('0x3b')]+'%'};return _0x4c3bc0;}})});}_0x228971=_[_0xc9c2('0x3c')]({},_0x228971,_0x55b9c6[_0xc9c2('0x3d')]);var _0x394050={'where':_0x228971['where']};return db[_0xc9c2('0x2c')][_0xc9c2('0x1c')](_0x394050)[_0xc9c2('0x22')](function(_0x46c740){_0x49fcd3[_0xc9c2('0x1c')]=_0x46c740;if(_0x55b9c6['query'][_0xc9c2('0x3e')]){_0x228971[_0xc9c2('0x3f')]=[{'all':!![]}];}return db[_0xc9c2('0x2c')]['findAll'](_0x228971);})[_0xc9c2('0x22')](function(_0xd3d946){_0x49fcd3[_0xc9c2('0x40')]=_0xd3d946;return _0x49fcd3;})[_0xc9c2('0x22')](respondWithFilteredResult(_0x4a9fca,_0x228971))[_0xc9c2('0x41')](handleError(_0x4a9fca,null));};exports['show']=function(_0x54857b,_0x136dfb){var _0x75de3={'raw':![],'where':{'id':_0x54857b[_0xc9c2('0x42')]['id']}},_0x4df180={};_0x4df180[_0xc9c2('0x33')]=_[_0xc9c2('0x43')](db[_0xc9c2('0x2c')][_0xc9c2('0x2d')]);_0x4df180[_0xc9c2('0x30')]=_[_0xc9c2('0x43')](_0x54857b['query']);_0x4df180[_0xc9c2('0x31')]=_['intersection'](_0x4df180[_0xc9c2('0x33')],_0x4df180['query']);_0x75de3[_0xc9c2('0x35')]=_['intersection'](_0x4df180[_0xc9c2('0x33')],qs['fields'](_0x54857b[_0xc9c2('0x30')][_0xc9c2('0x34')]));_0x75de3[_0xc9c2('0x35')]=_0x75de3[_0xc9c2('0x35')][_0xc9c2('0x36')]?_0x75de3[_0xc9c2('0x35')]:_0x4df180[_0xc9c2('0x33')];if(_0x54857b['query'][_0xc9c2('0x3e')]){_0x75de3[_0xc9c2('0x3f')]=[{'all':!![]}];}_0x75de3=_[_0xc9c2('0x3c')]({},_0x75de3,_0x54857b[_0xc9c2('0x3d')]);return db[_0xc9c2('0x2c')][_0xc9c2('0x44')](_0x75de3)['then'](handleEntityNotFound(_0x136dfb,null))[_0xc9c2('0x22')](respondWithResult(_0x136dfb,null))[_0xc9c2('0x41')](handleError(_0x136dfb,null));};exports[_0xc9c2('0x45')]=function(_0x88fa84,_0x2e9925){return db[_0xc9c2('0x2c')][_0xc9c2('0x45')](_0x88fa84[_0xc9c2('0x46')],{})['then'](function(_0x44d1bb){var _0x7aff01=_0x88fa84[_0xc9c2('0x47')][_0xc9c2('0x24')]({'plain':!![]});if(!_0x7aff01)throw new Error(_0xc9c2('0x48'));if(_0x7aff01['role']===_0xc9c2('0x47')){var _0x4e2589=_0x44d1bb[_0xc9c2('0x24')]({'plain':!![]});var _0x5c8933=_0xc9c2('0x25');return db['UserProfileSection'][_0xc9c2('0x44')]({'where':{'name':_0x5c8933,'userProfileId':_0x7aff01['userProfileId']},'raw':!![]})['then'](function(_0x13bcbd){if(_0x13bcbd&&_0x13bcbd[_0xc9c2('0x49')]===0x0){return db[_0xc9c2('0x26')][_0xc9c2('0x45')]({'name':_0x4e2589[_0xc9c2('0x29')],'resourceId':_0x4e2589['id'],'type':_0x13bcbd[_0xc9c2('0x29')],'sectionId':_0x13bcbd['id']},{})[_0xc9c2('0x22')](function(){return _0x44d1bb;});}else{return _0x44d1bb;}})[_0xc9c2('0x41')](function(_0x3f8fce){logger[_0xc9c2('0x27')](_0xc9c2('0x4a'),_0x3f8fce);throw _0x3f8fce;});}return _0x44d1bb;})['then'](respondWithResult(_0x2e9925,0xc9))[_0xc9c2('0x41')](handleError(_0x2e9925,null));};exports[_0xc9c2('0x4b')]=function(_0x568de4,_0x8a840){var _0x2a9885={'where':{'id':_0x568de4['params']['id']}},_0x2db053={};_0x2db053['model']=_[_0xc9c2('0x43')](db[_0xc9c2('0x2c')][_0xc9c2('0x2d')]);_0x2a9885[_0xc9c2('0x35')]=_[_0xc9c2('0x32')](_0x2db053[_0xc9c2('0x33')],qs[_0xc9c2('0x34')](_0x568de4[_0xc9c2('0x30')][_0xc9c2('0x34')]));_0x2a9885[_0xc9c2('0x35')]=_0x2a9885[_0xc9c2('0x35')][_0xc9c2('0x36')]?_0x2a9885[_0xc9c2('0x35')]:_0x2db053[_0xc9c2('0x33')];if(_0x568de4[_0xc9c2('0x30')]['includeAll']){_0x2a9885[_0xc9c2('0x3f')]=[{'all':!![]}];}_0x2a9885=_[_0xc9c2('0x3c')]({},_0x2a9885,_0x568de4[_0xc9c2('0x3d')]);return db['Campaign'][_0xc9c2('0x44')](_0x2a9885)[_0xc9c2('0x22')](handleEntityNotFound(_0x8a840,null))[_0xc9c2('0x22')](function(_0x4e4de1){if(_0x4e4de1){var _0x5335e1=_0x4e4de1[_0xc9c2('0x24')]({'plain':!![]});_0x5335e1=qs[_0xc9c2('0x4c')](_0x5335e1,['id',_0xc9c2('0x4d'),_0xc9c2('0x4e')]);_0x568de4[_0xc9c2('0x46')]=_[_0xc9c2('0x4c')](_0x568de4[_0xc9c2('0x46')],['id',_0xc9c2('0x4d'),'updatedAt']);return db[_0xc9c2('0x2c')][_0xc9c2('0x45')](_[_0xc9c2('0x3c')](_0x5335e1,_0x568de4[_0xc9c2('0x46')]),{'include':_0x568de4[_0xc9c2('0x30')][_0xc9c2('0x3e')]?[{'all':!![]}]:undefined})[_0xc9c2('0x22')](function(_0x490781){var _0x38ae22=_0x568de4[_0xc9c2('0x47')][_0xc9c2('0x24')]({'plain':!![]});if(!_0x38ae22)throw new Error(_0xc9c2('0x48'));if(_0x38ae22['role']===_0xc9c2('0x47')){var _0x585144=_0x490781[_0xc9c2('0x24')]({'plain':!![]});var _0x22c741=_0xc9c2('0x25');return db['UserProfileSection'][_0xc9c2('0x44')]({'where':{'name':_0x22c741,'userProfileId':_0x38ae22[_0xc9c2('0x4f')]},'raw':!![]})[_0xc9c2('0x22')](function(_0x5435e7){if(_0x5435e7&&_0x5435e7[_0xc9c2('0x49')]===0x0){return db[_0xc9c2('0x26')]['create']({'name':_0x585144[_0xc9c2('0x29')],'resourceId':_0x585144['id'],'type':_0x5435e7['name'],'sectionId':_0x5435e7['id']},{})[_0xc9c2('0x22')](function(){return _0x490781;});}else{return _0x490781;}})[_0xc9c2('0x41')](function(_0x3b2cd1){logger['error'](_0xc9c2('0x4a'),_0x3b2cd1);throw _0x3b2cd1;});}return _0x490781;});}})['then'](respondWithResult(_0x8a840,0xc9))[_0xc9c2('0x41')](handleError(_0x8a840,null));};exports[_0xc9c2('0x21')]=function(_0x3bf03e,_0x513d3f){if(_0x3bf03e[_0xc9c2('0x46')]['id']){delete _0x3bf03e[_0xc9c2('0x46')]['id'];}return db[_0xc9c2('0x2c')][_0xc9c2('0x44')]({'where':{'id':_0x3bf03e[_0xc9c2('0x42')]['id']}})[_0xc9c2('0x22')](handleEntityNotFound(_0x513d3f,null))[_0xc9c2('0x22')](saveUpdates(_0x3bf03e[_0xc9c2('0x46')],null))[_0xc9c2('0x22')](respondWithResult(_0x513d3f,null))[_0xc9c2('0x41')](handleError(_0x513d3f,null));};exports[_0xc9c2('0x23')]=function(_0x52c25c,_0x59ccee){return db['Campaign']['find']({'where':{'id':_0x52c25c[_0xc9c2('0x42')]['id']}})[_0xc9c2('0x22')](handleEntityNotFound(_0x59ccee,null))[_0xc9c2('0x22')](removeEntity(_0x59ccee,null))[_0xc9c2('0x41')](handleError(_0x59ccee,null));};exports['getHoppers']=function(_0x26ed38,_0xa9f56,_0x518618){var _0x192756={'raw':!![],'where':{}};var _0x54cb12={};var _0x230cbf={'count':0x0,'rows':[]};return db[_0xc9c2('0x2c')][_0xc9c2('0x50')]({'where':{'id':_0x26ed38['params']['id']}})[_0xc9c2('0x22')](handleEntityNotFound(_0xa9f56,null))[_0xc9c2('0x22')](function(_0x9e8a65){if(_0x9e8a65){_0x54cb12['model']=_['keys'](db['CmHopper'][_0xc9c2('0x2d')]);_0x54cb12[_0xc9c2('0x30')]=_[_0xc9c2('0x43')](_0x26ed38['query']);_0x54cb12[_0xc9c2('0x31')]=_[_0xc9c2('0x32')](_0x54cb12[_0xc9c2('0x33')],_0x54cb12[_0xc9c2('0x30')]);_0x192756[_0xc9c2('0x35')]=_[_0xc9c2('0x32')](_0x54cb12['model'],qs[_0xc9c2('0x34')](_0x26ed38['query']['fields']));_0x192756[_0xc9c2('0x35')]=_0x192756[_0xc9c2('0x35')][_0xc9c2('0x36')]?_0x192756[_0xc9c2('0x35')]:_0x54cb12[_0xc9c2('0x33')];if(!_0x26ed38['query'][_0xc9c2('0x51')](_0xc9c2('0x37'))){_0x192756[_0xc9c2('0x1b')]=qs[_0xc9c2('0x1b')](_0x26ed38[_0xc9c2('0x30')][_0xc9c2('0x1b')]);_0x192756[_0xc9c2('0x19')]=qs[_0xc9c2('0x19')](_0x26ed38[_0xc9c2('0x30')][_0xc9c2('0x19')]);}_0x192756[_0xc9c2('0x52')]=qs[_0xc9c2('0x38')](_0x26ed38[_0xc9c2('0x30')]['sort']);_0x192756['where']=qs[_0xc9c2('0x31')](_[_0xc9c2('0x3a')](_0x26ed38['query'],_0x54cb12['filters']));_0x192756[_0xc9c2('0x39')]['CampaignId']=_0x9e8a65['id'];if(_0x26ed38['query'][_0xc9c2('0x3b')]){_0x192756[_0xc9c2('0x39')]=_['merge'](_0x192756[_0xc9c2('0x39')],{'$or':_['map'](_0x192756[_0xc9c2('0x35')],function(_0x43b183){var _0x39b816={};_0x39b816[_0x43b183]={'$like':'%'+_0x26ed38['query'][_0xc9c2('0x3b')]+'%'};return _0x39b816;})});}_0x192756=_[_0xc9c2('0x3c')]({},_0x192756,_0x26ed38[_0xc9c2('0x3d')]);return db[_0xc9c2('0x53')][_0xc9c2('0x1c')]({'where':_0x192756[_0xc9c2('0x39')]})[_0xc9c2('0x22')](function(_0x2d09b5){_0x230cbf[_0xc9c2('0x1c')]=_0x2d09b5;if(_0x26ed38[_0xc9c2('0x30')][_0xc9c2('0x3e')]){_0x192756[_0xc9c2('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0xc9c2('0x54')](_0x192756);})[_0xc9c2('0x22')](function(_0x231b75){_0x230cbf[_0xc9c2('0x40')]=_0x231b75;return _0x230cbf;});}})['then'](respondWithFilteredResult(_0xa9f56,_0x192756))[_0xc9c2('0x41')](handleError(_0xa9f56,null));};exports[_0xc9c2('0x55')]=function(_0x5d99a4,_0x308c93,_0x1100c5){var _0x1f2651={'raw':!![],'where':{}};var _0x1380f8={};var _0x37378e={'count':0x0,'rows':[]};return db['Campaign'][_0xc9c2('0x50')]({'where':{'id':_0x5d99a4['params']['id']}})['then'](handleEntityNotFound(_0x308c93,null))[_0xc9c2('0x22')](function(_0x44e243){if(_0x44e243){_0x1380f8[_0xc9c2('0x33')]=_[_0xc9c2('0x43')](db[_0xc9c2('0x56')][_0xc9c2('0x2d')]);_0x1380f8[_0xc9c2('0x30')]=_[_0xc9c2('0x43')](_0x5d99a4[_0xc9c2('0x30')]);_0x1380f8['filters']=_['intersection'](_0x1380f8[_0xc9c2('0x33')],_0x1380f8['query']);_0x1f2651[_0xc9c2('0x35')]=_[_0xc9c2('0x32')](_0x1380f8[_0xc9c2('0x33')],qs[_0xc9c2('0x34')](_0x5d99a4['query'][_0xc9c2('0x34')]));_0x1f2651[_0xc9c2('0x35')]=_0x1f2651[_0xc9c2('0x35')][_0xc9c2('0x36')]?_0x1f2651[_0xc9c2('0x35')]:_0x1380f8[_0xc9c2('0x33')];if(!_0x5d99a4[_0xc9c2('0x30')][_0xc9c2('0x51')](_0xc9c2('0x37'))){_0x1f2651['limit']=qs['limit'](_0x5d99a4[_0xc9c2('0x30')]['limit']);_0x1f2651[_0xc9c2('0x19')]=qs[_0xc9c2('0x19')](_0x5d99a4['query']['offset']);}_0x1f2651[_0xc9c2('0x52')]=qs[_0xc9c2('0x38')](_0x5d99a4[_0xc9c2('0x30')]['sort']);_0x1f2651[_0xc9c2('0x39')]=qs[_0xc9c2('0x31')](_[_0xc9c2('0x3a')](_0x5d99a4[_0xc9c2('0x30')],_0x1380f8['filters']));_0x1f2651[_0xc9c2('0x39')][_0xc9c2('0x57')]=_0x44e243['id'];if(_0x5d99a4[_0xc9c2('0x30')][_0xc9c2('0x3b')]){_0x1f2651['where']=_[_0xc9c2('0x3c')](_0x1f2651[_0xc9c2('0x39')],{'$or':_['map'](_0x1f2651[_0xc9c2('0x35')],function(_0x4cd726){var _0x41ec79={};_0x41ec79[_0x4cd726]={'$like':'%'+_0x5d99a4[_0xc9c2('0x30')][_0xc9c2('0x3b')]+'%'};return _0x41ec79;})});}_0x1f2651=_[_0xc9c2('0x3c')]({},_0x1f2651,_0x5d99a4['options']);return db[_0xc9c2('0x56')][_0xc9c2('0x1c')]({'where':_0x1f2651['where']})['then'](function(_0x34df65){_0x37378e['count']=_0x34df65;if(_0x5d99a4[_0xc9c2('0x30')][_0xc9c2('0x3e')]){_0x1f2651[_0xc9c2('0x3f')]=[{'all':!![]}];}return db[_0xc9c2('0x56')][_0xc9c2('0x54')](_0x1f2651);})[_0xc9c2('0x22')](function(_0x5b6681){_0x37378e[_0xc9c2('0x40')]=_0x5b6681;return _0x37378e;});}})[_0xc9c2('0x22')](respondWithFilteredResult(_0x308c93,_0x1f2651))[_0xc9c2('0x41')](handleError(_0x308c93,null));};exports['getHopperFinals']=function(_0x298d3e,_0x446c75,_0x225a11){var _0x18fb40={'raw':!![],'where':{}};var _0x28e1ca={};var _0x3da14c={'count':0x0,'rows':[]};return db[_0xc9c2('0x2c')][_0xc9c2('0x50')]({'where':{'id':_0x298d3e[_0xc9c2('0x42')]['id']}})[_0xc9c2('0x22')](handleEntityNotFound(_0x446c75,null))[_0xc9c2('0x22')](function(_0x490898){if(_0x490898){_0x28e1ca[_0xc9c2('0x33')]=_[_0xc9c2('0x43')](db[_0xc9c2('0x58')][_0xc9c2('0x2d')]);_0x28e1ca['query']=_['keys'](_0x298d3e[_0xc9c2('0x30')]);_0x28e1ca[_0xc9c2('0x31')]=_['intersection'](_0x28e1ca['model'],_0x28e1ca[_0xc9c2('0x30')]);_0x18fb40[_0xc9c2('0x35')]=_[_0xc9c2('0x32')](_0x28e1ca[_0xc9c2('0x33')],qs[_0xc9c2('0x34')](_0x298d3e[_0xc9c2('0x30')][_0xc9c2('0x34')]));_0x18fb40[_0xc9c2('0x35')]=_0x18fb40[_0xc9c2('0x35')]['length']?_0x18fb40['attributes']:_0x28e1ca['model'];if(!_0x298d3e[_0xc9c2('0x30')][_0xc9c2('0x51')](_0xc9c2('0x37'))){_0x18fb40['limit']=qs['limit'](_0x298d3e[_0xc9c2('0x30')][_0xc9c2('0x1b')]);_0x18fb40['offset']=qs[_0xc9c2('0x19')](_0x298d3e['query']['offset']);}_0x18fb40[_0xc9c2('0x52')]=qs[_0xc9c2('0x38')](_0x298d3e['query'][_0xc9c2('0x38')]);_0x18fb40['where']=qs[_0xc9c2('0x31')](_[_0xc9c2('0x3a')](_0x298d3e['query'],_0x28e1ca[_0xc9c2('0x31')]));_0x18fb40['where'][_0xc9c2('0x57')]=_0x490898['id'];if(_0x298d3e['query'][_0xc9c2('0x3b')]){_0x18fb40[_0xc9c2('0x39')]=_[_0xc9c2('0x3c')](_0x18fb40[_0xc9c2('0x39')],{'$or':_[_0xc9c2('0x2b')](_0x18fb40['attributes'],function(_0x2fa14f){var _0x1053ef={};_0x1053ef[_0x2fa14f]={'$like':'%'+_0x298d3e['query']['filter']+'%'};return _0x1053ef;})});}_0x18fb40=_[_0xc9c2('0x3c')]({},_0x18fb40,_0x298d3e['options']);return db[_0xc9c2('0x58')][_0xc9c2('0x1c')]({'where':_0x18fb40[_0xc9c2('0x39')]})[_0xc9c2('0x22')](function(_0xc032f6){_0x3da14c['count']=_0xc032f6;if(_0x298d3e[_0xc9c2('0x30')][_0xc9c2('0x3e')]){_0x18fb40[_0xc9c2('0x3f')]=[{'all':!![]}];}return db[_0xc9c2('0x58')]['findAll'](_0x18fb40);})[_0xc9c2('0x22')](function(_0x2e5274){_0x3da14c[_0xc9c2('0x40')]=_0x2e5274;return _0x3da14c;});}})[_0xc9c2('0x22')](respondWithFilteredResult(_0x446c75,_0x18fb40))[_0xc9c2('0x41')](handleError(_0x446c75,null));};exports[_0xc9c2('0x59')]=function(_0x251286,_0x3f6a2d,_0x1f3f2a){var _0xf82fe7={'raw':!![],'where':{}};var _0x1b9001={};var _0x1ec9da={'count':0x0,'rows':[]};return db['Campaign'][_0xc9c2('0x50')]({'where':{'id':_0x251286[_0xc9c2('0x42')]['id']}})[_0xc9c2('0x22')](handleEntityNotFound(_0x3f6a2d,null))['then'](function(_0x13a58b){if(_0x13a58b){_0x1b9001[_0xc9c2('0x33')]=_[_0xc9c2('0x43')](db['CmHopperBlack'][_0xc9c2('0x2d')]);_0x1b9001[_0xc9c2('0x30')]=_[_0xc9c2('0x43')](_0x251286[_0xc9c2('0x30')]);_0x1b9001[_0xc9c2('0x31')]=_[_0xc9c2('0x32')](_0x1b9001[_0xc9c2('0x33')],_0x1b9001[_0xc9c2('0x30')]);_0xf82fe7[_0xc9c2('0x35')]=_[_0xc9c2('0x32')](_0x1b9001[_0xc9c2('0x33')],qs['fields'](_0x251286[_0xc9c2('0x30')][_0xc9c2('0x34')]));_0xf82fe7['attributes']=_0xf82fe7[_0xc9c2('0x35')]['length']?_0xf82fe7[_0xc9c2('0x35')]:_0x1b9001[_0xc9c2('0x33')];if(!_0x251286[_0xc9c2('0x30')][_0xc9c2('0x51')](_0xc9c2('0x37'))){_0xf82fe7[_0xc9c2('0x1b')]=qs[_0xc9c2('0x1b')](_0x251286[_0xc9c2('0x30')][_0xc9c2('0x1b')]);_0xf82fe7['offset']=qs[_0xc9c2('0x19')](_0x251286[_0xc9c2('0x30')][_0xc9c2('0x19')]);}_0xf82fe7[_0xc9c2('0x52')]=qs[_0xc9c2('0x38')](_0x251286[_0xc9c2('0x30')][_0xc9c2('0x38')]);_0xf82fe7[_0xc9c2('0x39')]=qs[_0xc9c2('0x31')](_[_0xc9c2('0x3a')](_0x251286[_0xc9c2('0x30')],_0x1b9001[_0xc9c2('0x31')]));_0xf82fe7[_0xc9c2('0x39')][_0xc9c2('0x57')]=_0x13a58b['id'];if(_0x251286['query'][_0xc9c2('0x3b')]){_0xf82fe7[_0xc9c2('0x39')]=_[_0xc9c2('0x3c')](_0xf82fe7[_0xc9c2('0x39')],{'$or':_[_0xc9c2('0x2b')](_0xf82fe7[_0xc9c2('0x35')],function(_0x5e5f0e){var _0x446dc4={};_0x446dc4[_0x5e5f0e]={'$like':'%'+_0x251286[_0xc9c2('0x30')][_0xc9c2('0x3b')]+'%'};return _0x446dc4;})});}_0xf82fe7=_['merge']({},_0xf82fe7,_0x251286[_0xc9c2('0x3d')]);return db['CmHopperBlack']['count']({'where':_0xf82fe7['where']})[_0xc9c2('0x22')](function(_0x45be38){_0x1ec9da['count']=_0x45be38;if(_0x251286[_0xc9c2('0x30')][_0xc9c2('0x3e')]){_0xf82fe7[_0xc9c2('0x3f')]=[{'all':!![]}];}return db[_0xc9c2('0x5a')][_0xc9c2('0x54')](_0xf82fe7);})[_0xc9c2('0x22')](function(_0x4d882f){_0x1ec9da['rows']=_0x4d882f;return _0x1ec9da;});}})['then'](respondWithFilteredResult(_0x3f6a2d,_0xf82fe7))['catch'](handleError(_0x3f6a2d,null));};exports[_0xc9c2('0x5b')]=function(_0x174b28,_0x4377b1,_0x388375){var _0x3befe7={};var _0x190bdf={};var _0x5d357b;var _0x20d486;return db[_0xc9c2('0x2c')][_0xc9c2('0x50')]({'where':{'id':_0x174b28[_0xc9c2('0x42')]['id']}})[_0xc9c2('0x22')](handleEntityNotFound(_0x4377b1,null))['then'](function(_0x3708b7){if(_0x3708b7){_0x5d357b=_0x3708b7;_0x190bdf[_0xc9c2('0x33')]=_[_0xc9c2('0x43')](db[_0xc9c2('0x5c')]['rawAttributes']);_0x190bdf[_0xc9c2('0x30')]=_[_0xc9c2('0x43')](_0x174b28[_0xc9c2('0x30')]);_0x190bdf[_0xc9c2('0x31')]=_['intersection'](_0x190bdf[_0xc9c2('0x33')],_0x190bdf[_0xc9c2('0x30')]);_0x3befe7[_0xc9c2('0x35')]=_[_0xc9c2('0x32')](_0x190bdf['model'],qs[_0xc9c2('0x34')](_0x174b28[_0xc9c2('0x30')][_0xc9c2('0x34')]));_0x3befe7[_0xc9c2('0x35')]=_0x3befe7['attributes']['length']?_0x3befe7[_0xc9c2('0x35')]:_0x190bdf[_0xc9c2('0x33')];_0x3befe7[_0xc9c2('0x52')]=qs[_0xc9c2('0x38')](_0x174b28['query'][_0xc9c2('0x38')]);_0x3befe7['where']=qs[_0xc9c2('0x31')](_[_0xc9c2('0x3a')](_0x174b28[_0xc9c2('0x30')],_0x190bdf['filters']));if(_0x174b28[_0xc9c2('0x30')][_0xc9c2('0x3b')]){_0x3befe7[_0xc9c2('0x39')]=_['merge'](_0x3befe7['where'],{'$or':_['map'](_0x3befe7[_0xc9c2('0x35')],function(_0xcb273f){var _0x28c25f={};_0x28c25f[_0xcb273f]={'$like':'%'+_0x174b28[_0xc9c2('0x30')][_0xc9c2('0x3b')]+'%'};return _0x28c25f;})});}_0x3befe7=_['merge']({},_0x3befe7,_0x174b28[_0xc9c2('0x3d')]);return _0x5d357b[_0xc9c2('0x5b')](_0x3befe7);}})[_0xc9c2('0x22')](function(_0x4f8902){if(_0x4f8902){_0x20d486=_0x4f8902[_0xc9c2('0x36')];if(!_0x174b28[_0xc9c2('0x30')][_0xc9c2('0x51')](_0xc9c2('0x37'))){_0x3befe7[_0xc9c2('0x1b')]=qs[_0xc9c2('0x1b')](_0x174b28['query'][_0xc9c2('0x1b')]);_0x3befe7['offset']=qs['offset'](_0x174b28[_0xc9c2('0x30')][_0xc9c2('0x19')]);}return _0x5d357b['getLists'](_0x3befe7);}})['then'](function(_0x244981){if(_0x244981){return _0x244981?{'count':_0x20d486,'rows':_0x244981}:null;}})[_0xc9c2('0x22')](respondWithResult(_0x4377b1,null))['catch'](handleError(_0x4377b1,null));};exports[_0xc9c2('0x5d')]=function(_0xcf546b,_0x4395ba,_0x1c1ad2){var _0xf82fce,_0x46c8dc;var _0x31817a=[];var _0x5f1f72=moment()[_0xc9c2('0x5e')](_0xc9c2('0x5f'));return db[_0xc9c2('0x2c')][_0xc9c2('0x44')]({'where':{'id':_0xcf546b[_0xc9c2('0x42')]['id']}})[_0xc9c2('0x22')](handleEntityNotFound(_0x4395ba,null))['then'](function(_0x2eae1d){if(_0x2eae1d){_0x46c8dc=_0x2eae1d;return _0x2eae1d['addLists'](_0xcf546b[_0xc9c2('0x46')]['ids'],_['omit'](_0xcf546b['body'],[_0xc9c2('0x60'),'id'])||{});}return null;})[_0xc9c2('0x61')](function(_0x18617a){var _0x141ef6;var _0x159838;_0xf82fce=_0x18617a||[];var _0x2376b3=[];if(_0x18617a){for(var _0x47cf97=0x0;_0x47cf97<_0x18617a['length'];_0x47cf97+=0x1){var _0x3f44cc=_0x18617a[_0x47cf97][_0xc9c2('0x24')]({'plain':!![]});_0x46c8dc[_0xc9c2('0x62')]=_0xcf546b[_0xc9c2('0x46')]['dialCheckDuplicateType']?_0xcf546b['body'][_0xc9c2('0x62')]:_0x46c8dc[_0xc9c2('0x62')];switch(_0x46c8dc[_0xc9c2('0x62')]){case _0xc9c2('0x63'):_0x141ef6=squel[_0xc9c2('0x64')]()[_0xc9c2('0x65')]('cm_hopper')[_0xc9c2('0x66')]([_0xc9c2('0x67'),_0xc9c2('0x68'),_0xc9c2('0x69'),_0xc9c2('0x6a'),_0xc9c2('0x57'),_0xc9c2('0x4d'),_0xc9c2('0x4e')],squel[_0xc9c2('0x6b')]()[_0xc9c2('0x6c')]('phone',_0xc9c2('0x67'))[_0xc9c2('0x6c')](_0xc9c2('0x6d'),_0xc9c2('0x68'))['field']('id','ContactId')[_0xc9c2('0x6c')](_0x3f44cc[_0xc9c2('0x6e')][_0xc9c2('0x6f')](),_0xc9c2('0x6a'))[_0xc9c2('0x6c')](_0xcf546b[_0xc9c2('0x42')]['id'][_0xc9c2('0x6f')](),'CampaignId')['field']('\x27'+_0x5f1f72+'\x27','createdAt')[_0xc9c2('0x6c')]('\x27'+_0x5f1f72+'\x27',_0xc9c2('0x4e'))[_0xc9c2('0x70')]('cm_contacts')[_0xc9c2('0x39')](_0xc9c2('0x71'))[_0xc9c2('0x39')](_0xc9c2('0x72'),_0x3f44cc[_0xc9c2('0x6e')][_0xc9c2('0x6f')]())[_0xc9c2('0x39')](_0xc9c2('0x73'))[_0xc9c2('0x39')](_0xc9c2('0x74'),squel['select']()['field'](_0xc9c2('0x75'))[_0xc9c2('0x70')](_0xc9c2('0x76'))['where'](_0xc9c2('0x77'),_0xcf546b[_0xc9c2('0x42')]['id'][_0xc9c2('0x6f')]()))['where'](_0xc9c2('0x74'),squel[_0xc9c2('0x6b')]()[_0xc9c2('0x6c')]('COALESCE(phone,\x27\x27)')[_0xc9c2('0x70')](_0xc9c2('0x78'))['where'](_0xc9c2('0x77'),_0xcf546b[_0xc9c2('0x42')]['id'][_0xc9c2('0x6f')]())))[_0xc9c2('0x6f')]();break;case _0xc9c2('0x79'):_0x141ef6=squel[_0xc9c2('0x64')]()[_0xc9c2('0x65')](_0xc9c2('0x78'))[_0xc9c2('0x66')](['phone',_0xc9c2('0x68'),_0xc9c2('0x69'),_0xc9c2('0x6a'),_0xc9c2('0x57'),'createdAt',_0xc9c2('0x4e')],squel[_0xc9c2('0x6b')]()[_0xc9c2('0x6c')](_0xc9c2('0x67'),_0xc9c2('0x67'))[_0xc9c2('0x6c')](_0xc9c2('0x6d'),_0xc9c2('0x68'))['field']('id',_0xc9c2('0x69'))[_0xc9c2('0x6c')](_0x3f44cc[_0xc9c2('0x6e')][_0xc9c2('0x6f')](),_0xc9c2('0x6a'))['field'](_0xcf546b[_0xc9c2('0x42')]['id'][_0xc9c2('0x6f')](),_0xc9c2('0x57'))[_0xc9c2('0x6c')]('\x27'+_0x5f1f72+'\x27',_0xc9c2('0x4d'))[_0xc9c2('0x6c')]('\x27'+_0x5f1f72+'\x27',_0xc9c2('0x4e'))[_0xc9c2('0x70')](_0xc9c2('0x7a'))[_0xc9c2('0x39')](_0xc9c2('0x71'))[_0xc9c2('0x39')](_0xc9c2('0x72'),_0x3f44cc[_0xc9c2('0x6e')][_0xc9c2('0x6f')]())[_0xc9c2('0x39')](_0xc9c2('0x73'))['where'](_0xc9c2('0x74'),squel[_0xc9c2('0x6b')]()[_0xc9c2('0x6c')](_0xc9c2('0x7b'))[_0xc9c2('0x70')](_0xc9c2('0x78'))[_0xc9c2('0x39')](_0xc9c2('0x77'),_0xcf546b[_0xc9c2('0x42')]['id'][_0xc9c2('0x6f')]())))[_0xc9c2('0x6f')]();break;default:_0x141ef6=squel[_0xc9c2('0x64')]()[_0xc9c2('0x65')](_0xc9c2('0x78'))[_0xc9c2('0x66')]([_0xc9c2('0x67'),_0xc9c2('0x68'),'ContactId',_0xc9c2('0x6a'),_0xc9c2('0x57'),'createdAt',_0xc9c2('0x4e')],squel[_0xc9c2('0x6b')]()[_0xc9c2('0x6c')]('phone',_0xc9c2('0x67'))[_0xc9c2('0x6c')]('NOW()',_0xc9c2('0x68'))[_0xc9c2('0x6c')]('id',_0xc9c2('0x69'))[_0xc9c2('0x6c')](_0x3f44cc[_0xc9c2('0x6e')][_0xc9c2('0x6f')](),'ListId')[_0xc9c2('0x6c')](_0xcf546b[_0xc9c2('0x42')]['id'][_0xc9c2('0x6f')](),_0xc9c2('0x57'))[_0xc9c2('0x6c')]('\x27'+_0x5f1f72+'\x27','createdAt')[_0xc9c2('0x6c')]('\x27'+_0x5f1f72+'\x27',_0xc9c2('0x4e'))['from'](_0xc9c2('0x7a'))['where'](_0xc9c2('0x71'))[_0xc9c2('0x39')](_0xc9c2('0x72'),_0x3f44cc['CmListId'][_0xc9c2('0x6f')]())[_0xc9c2('0x39')](_0xc9c2('0x73')))['toString']();}_0x159838=squel[_0xc9c2('0x64')]()[_0xc9c2('0x65')](_0xc9c2('0x7c'))[_0xc9c2('0x66')]([_0xc9c2('0x7d'),_0xc9c2('0x68'),'phone','OrderBy',_0xc9c2('0x4d'),_0xc9c2('0x4e')],squel['select']()[_0xc9c2('0x6c')](_0xc9c2('0x7e'),'id')[_0xc9c2('0x6c')](_0xc9c2('0x6d'),_0xc9c2('0x68'))[_0xc9c2('0x6c')](_0xc9c2('0x7f'),_0xc9c2('0x67'))['field'](_0xc9c2('0x80'),_0xc9c2('0x81'))[_0xc9c2('0x6c')]('\x27'+_0x5f1f72+'\x27',_0xc9c2('0x4d'))[_0xc9c2('0x6c')]('\x27'+_0x5f1f72+'\x27',_0xc9c2('0x4e'))[_0xc9c2('0x70')](_0xc9c2('0x82'),'ci')[_0xc9c2('0x83')](_0xc9c2('0x78'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0xc9c2('0x39')]('h.ListId\x20=\x20?',_0x3f44cc[_0xc9c2('0x6e')]['toString']())[_0xc9c2('0x39')]('h.CampaignId=?',_0xcf546b[_0xc9c2('0x42')]['id'][_0xc9c2('0x6f')]())['where'](_0xc9c2('0x84'),_0x5f1f72))['toString']();_0x2376b3[_0xc9c2('0x85')](db[_0xc9c2('0x86')]['query'](_0x141ef6));_0x31817a[_0xc9c2('0x85')](db[_0xc9c2('0x86')]['query'](_0x159838));}return BPromise[_0xc9c2('0x87')](_0x2376b3);}})[_0xc9c2('0x22')](function(){return BPromise[_0xc9c2('0x87')](_0x31817a);})['then'](function(){return _0xf82fce;})[_0xc9c2('0x22')](respondWithResult(_0x4395ba,null))['catch'](handleError(_0x4395ba,null));};exports[_0xc9c2('0x88')]=function(_0x3f242a,_0x341224,_0x1af79e){return db[_0xc9c2('0x2c')]['find']({'where':{'id':_0x3f242a[_0xc9c2('0x42')]['id']}})[_0xc9c2('0x22')](handleEntityNotFound(_0x341224,null))[_0xc9c2('0x22')](function(_0x1afa10){if(_0x1afa10){return _0x1afa10[_0xc9c2('0x88')](_0x3f242a['query'][_0xc9c2('0x60')]);}})[_0xc9c2('0x22')](function(_0x134a85){if(_0x134a85){return db[_0xc9c2('0x53')][_0xc9c2('0x23')]({'where':{'ListId':_0x3f242a[_0xc9c2('0x30')][_0xc9c2('0x60')],'CampaignId':_0x3f242a['params']['id']}})[_0xc9c2('0x22')](function(){return _0x134a85;});}})[_0xc9c2('0x22')](respondWithStatusCode(_0x341224,null))[_0xc9c2('0x41')](handleError(_0x341224,null));};exports[_0xc9c2('0x89')]=function(_0x518970,_0x46cc43,_0xbf9637){var _0x504ad0={};var _0x1c9be2={};var _0x3e9fff;var _0x58f75b;return db[_0xc9c2('0x2c')][_0xc9c2('0x50')]({'where':{'id':_0x518970['params']['id']}})[_0xc9c2('0x22')](handleEntityNotFound(_0x46cc43,null))[_0xc9c2('0x22')](function(_0x37c283){if(_0x37c283){_0x3e9fff=_0x37c283;_0x1c9be2[_0xc9c2('0x33')]=_[_0xc9c2('0x43')](db['CmList'][_0xc9c2('0x2d')]);_0x1c9be2['query']=_[_0xc9c2('0x43')](_0x518970['query']);_0x1c9be2[_0xc9c2('0x31')]=_['intersection'](_0x1c9be2[_0xc9c2('0x33')],_0x1c9be2['query']);_0x504ad0[_0xc9c2('0x35')]=_[_0xc9c2('0x32')](_0x1c9be2['model'],qs['fields'](_0x518970['query'][_0xc9c2('0x34')]));_0x504ad0[_0xc9c2('0x35')]=_0x504ad0[_0xc9c2('0x35')][_0xc9c2('0x36')]?_0x504ad0[_0xc9c2('0x35')]:_0x1c9be2[_0xc9c2('0x33')];_0x504ad0[_0xc9c2('0x52')]=qs[_0xc9c2('0x38')](_0x518970[_0xc9c2('0x30')][_0xc9c2('0x38')]);_0x504ad0[_0xc9c2('0x39')]=qs['filters'](_[_0xc9c2('0x3a')](_0x518970['query'],_0x1c9be2['filters']));if(_0x518970[_0xc9c2('0x30')][_0xc9c2('0x3b')]){_0x504ad0['where']=_[_0xc9c2('0x3c')](_0x504ad0[_0xc9c2('0x39')],{'$or':_[_0xc9c2('0x2b')](_0x504ad0[_0xc9c2('0x35')],function(_0x41f9b6){var _0x4c5fb2={};_0x4c5fb2[_0x41f9b6]={'$like':'%'+_0x518970[_0xc9c2('0x30')][_0xc9c2('0x3b')]+'%'};return _0x4c5fb2;})});}_0x504ad0=_[_0xc9c2('0x3c')]({},_0x504ad0,_0x518970[_0xc9c2('0x3d')]);return _0x3e9fff[_0xc9c2('0x89')](_0x504ad0);}})[_0xc9c2('0x22')](function(_0x5e341c){if(_0x5e341c){_0x58f75b=_0x5e341c[_0xc9c2('0x36')];if(!_0x518970[_0xc9c2('0x30')][_0xc9c2('0x51')](_0xc9c2('0x37'))){_0x504ad0['limit']=qs[_0xc9c2('0x1b')](_0x518970['query'][_0xc9c2('0x1b')]);_0x504ad0[_0xc9c2('0x19')]=qs[_0xc9c2('0x19')](_0x518970[_0xc9c2('0x30')]['offset']);}return _0x3e9fff[_0xc9c2('0x89')](_0x504ad0);}})[_0xc9c2('0x22')](function(_0x1a255f){if(_0x1a255f){return _0x1a255f?{'count':_0x58f75b,'rows':_0x1a255f}:null;}})['then'](respondWithResult(_0x46cc43,null))[_0xc9c2('0x41')](handleError(_0x46cc43,null));};exports[_0xc9c2('0x8a')]=function(_0x890ba0,_0x3420d1,_0xb423bc){var _0x5198e5,_0x14c794;var _0x25ab42=[];var _0x522d46=moment()[_0xc9c2('0x5e')](_0xc9c2('0x5f'));return db[_0xc9c2('0x2c')][_0xc9c2('0x44')]({'where':{'id':_0x890ba0[_0xc9c2('0x42')]['id']}})[_0xc9c2('0x22')](handleEntityNotFound(_0x3420d1,null))['then'](function(_0x34a53){if(_0x34a53){_0x14c794=_0x34a53;return _0x34a53[_0xc9c2('0x8a')](_0x890ba0['body'][_0xc9c2('0x60')],_[_0xc9c2('0x4c')](_0x890ba0[_0xc9c2('0x46')],[_0xc9c2('0x60'),'id'])||{});}return null;})[_0xc9c2('0x61')](function(_0x4bdb8c){var _0x5d942e;var _0xce49f2;_0x5198e5=_0x4bdb8c||[];var _0x296e82=[];if(_0x4bdb8c){for(var _0xe19e28=0x0;_0xe19e28<_0x4bdb8c[_0xc9c2('0x36')];_0xe19e28+=0x1){var _0x2a44a8=_0x4bdb8c[_0xe19e28][_0xc9c2('0x24')]({'plain':!![]});_0x5d942e=squel['insert']()[_0xc9c2('0x65')](_0xc9c2('0x8b'))[_0xc9c2('0x66')]([_0xc9c2('0x67'),_0xc9c2('0x69'),_0xc9c2('0x6a'),_0xc9c2('0x57'),_0xc9c2('0x4d'),_0xc9c2('0x4e')],squel[_0xc9c2('0x6b')]()['field']('phone',_0xc9c2('0x67'))[_0xc9c2('0x6c')]('id',_0xc9c2('0x69'))[_0xc9c2('0x6c')](_0x2a44a8['CmListId'][_0xc9c2('0x6f')](),'ListId')['field'](_0x890ba0[_0xc9c2('0x42')]['id']['toString'](),_0xc9c2('0x57'))[_0xc9c2('0x6c')](_0xc9c2('0x6d'),_0xc9c2('0x4d'))[_0xc9c2('0x6c')](_0xc9c2('0x6d'),_0xc9c2('0x4e'))[_0xc9c2('0x70')](_0xc9c2('0x7a'))[_0xc9c2('0x39')](_0xc9c2('0x71'))[_0xc9c2('0x39')](_0xc9c2('0x72'),_0x2a44a8[_0xc9c2('0x6e')][_0xc9c2('0x6f')]())[_0xc9c2('0x39')](_0xc9c2('0x73')))[_0xc9c2('0x6f')]();_0x296e82[_0xc9c2('0x85')](db[_0xc9c2('0x86')][_0xc9c2('0x30')](_0x5d942e));}return BPromise[_0xc9c2('0x87')](_0x296e82);}})[_0xc9c2('0x22')](function(){return _0x5198e5;})[_0xc9c2('0x22')](respondWithResult(_0x3420d1,null))[_0xc9c2('0x41')](handleError(_0x3420d1,null));};exports[_0xc9c2('0x8c')]=function(_0x27630c,_0x16aac5,_0x12848a){return db[_0xc9c2('0x2c')][_0xc9c2('0x44')]({'where':{'id':_0x27630c[_0xc9c2('0x42')]['id']}})[_0xc9c2('0x22')](handleEntityNotFound(_0x16aac5,null))[_0xc9c2('0x22')](function(_0x1d1527){if(_0x1d1527){return _0x1d1527[_0xc9c2('0x8c')](_0x27630c[_0xc9c2('0x30')][_0xc9c2('0x60')]);}})['then'](function(_0x2fb55b){if(_0x2fb55b){return db[_0xc9c2('0x5a')][_0xc9c2('0x23')]({'where':{'ListId':_0x27630c[_0xc9c2('0x30')][_0xc9c2('0x60')],'CampaignId':_0x27630c[_0xc9c2('0x42')]['id']}})[_0xc9c2('0x22')](function(){return _0x2fb55b;});}})[_0xc9c2('0x22')](respondWithStatusCode(_0x16aac5,null))[_0xc9c2('0x41')](handleError(_0x16aac5,null));}; \ No newline at end of file +var _0xda20=['findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','CmHopperFinal','rows','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','insert','cm_hopper','scheduledAt','ContactId','ListId','phone','field','NOW()','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','from','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','into','CmListId','ListId\x20=\x20?','fromQuery','OrderBy','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','save','update','destroy','then','get','UserProfileResource','end','sendStatus','error','name','send','index','fieldName','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filters','filter','merge','options','Campaign','includeAll','findAll','params','keys','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','body','omit','IvrCampaigns','getHoppers'];(function(_0x7af729,_0x43763d){var _0x10e5f8=function(_0x3fc464){while(--_0x3fc464){_0x7af729['push'](_0x7af729['shift']());}};_0x10e5f8(++_0x43763d);}(_0xda20,0x1d9));var _0x0da2=function(_0x1472cf,_0x449630){_0x1472cf=_0x1472cf-0x0;var _0x50c661=_0xda20[_0x1472cf];return _0x50c661;};'use strict';var emlformat=require(_0x0da2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0da2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0da2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0da2('0x3'));var util=require(_0x0da2('0x4'));var path=require('path');var sox=require(_0x0da2('0x5'));var csv=require(_0x0da2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0da2('0x7'));var _=require(_0x0da2('0x8'));var squel=require(_0x0da2('0x9'));var crypto=require(_0x0da2('0xa'));var jsforce=require(_0x0da2('0xb'));var deskjs=require(_0x0da2('0xc'));var toCsv=require(_0x0da2('0x6'));var querystring=require(_0x0da2('0xd'));var Papa=require(_0x0da2('0xe'));var Redis=require('ioredis');var authService=require(_0x0da2('0xf'));var qs=require(_0x0da2('0x10'));var as=require(_0x0da2('0x11'));var hardwareService=require(_0x0da2('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x0da2('0x13'));var config=require(_0x0da2('0x14'));var licenseUtil=require(_0x0da2('0x15'));var db=require(_0x0da2('0x16'))['db'];function respondWithStatusCode(_0x19226a,_0x40b4d9){_0x40b4d9=_0x40b4d9||0xcc;return function(_0x34013e){if(_0x34013e){return _0x19226a['sendStatus'](_0x40b4d9);}return _0x19226a[_0x0da2('0x17')](_0x40b4d9)['end']();};}function respondWithResult(_0x5496f5,_0x4cc28c){_0x4cc28c=_0x4cc28c||0xc8;return function(_0x2289c2){if(_0x2289c2){return _0x5496f5['status'](_0x4cc28c)[_0x0da2('0x18')](_0x2289c2);}};}function respondWithFilteredResult(_0x4cae2e,_0x5d0f4e){return function(_0xa0613c){if(_0xa0613c){var _0x65f77=typeof _0x5d0f4e['offset']===_0x0da2('0x19')&&typeof _0x5d0f4e[_0x0da2('0x1a')]===_0x0da2('0x19');var _0x5bd0a7=_0xa0613c[_0x0da2('0x1b')];var _0x395513=_0x65f77?0x0:_0x5d0f4e['offset'];var _0x54a235=_0x65f77?_0xa0613c[_0x0da2('0x1b')]:_0x5d0f4e['offset']+_0x5d0f4e[_0x0da2('0x1a')];var _0x569834;if(_0x54a235>=_0x5bd0a7){_0x54a235=_0x5bd0a7;_0x569834=0xc8;}else{_0x569834=0xce;}_0x4cae2e['status'](_0x569834);return _0x4cae2e['set']('Content-Range',_0x395513+'-'+_0x54a235+'/'+_0x5bd0a7)[_0x0da2('0x18')](_0xa0613c);}return null;};}function patchUpdates(_0x1d685c){return function(_0x2371f1){try{jsonpatch['apply'](_0x2371f1,_0x1d685c,!![]);}catch(_0x5304af){return BPromise['reject'](_0x5304af);}return _0x2371f1[_0x0da2('0x1c')]();};}function saveUpdates(_0x2ce4c4,_0x2f4e01){return function(_0x3d7e96){if(_0x3d7e96){return _0x3d7e96[_0x0da2('0x1d')](_0x2ce4c4)['then'](function(_0x7a3708){return _0x7a3708;});}return null;};}function removeEntity(_0x113c40,_0x1c3ab0){return function(_0x3c3dbc){if(_0x3c3dbc){return _0x3c3dbc[_0x0da2('0x1e')]()[_0x0da2('0x1f')](function(){var _0x3ae5a0=_0x3c3dbc[_0x0da2('0x20')]({'plain':!![]});var _0x3604d3='IvrCampaigns';return db[_0x0da2('0x21')]['destroy']({'where':{'type':_0x3604d3,'resourceId':_0x3ae5a0['id']}})[_0x0da2('0x1f')](function(){return _0x3c3dbc;});})[_0x0da2('0x1f')](function(){_0x113c40[_0x0da2('0x17')](0xcc)[_0x0da2('0x22')]();});}};}function handleEntityNotFound(_0x4b9333,_0x1e9ac4){return function(_0x2a931d){if(!_0x2a931d){_0x4b9333[_0x0da2('0x23')](0x194);}return _0x2a931d;};}function handleError(_0x1d94b3,_0x22c6bf){_0x22c6bf=_0x22c6bf||0x1f4;return function(_0x5083e0){logger[_0x0da2('0x24')](_0x5083e0['stack']);if(_0x5083e0[_0x0da2('0x25')]){delete _0x5083e0[_0x0da2('0x25')];}_0x1d94b3[_0x0da2('0x17')](_0x22c6bf)[_0x0da2('0x26')](_0x5083e0);};}exports[_0x0da2('0x27')]=function(_0x103857,_0x44c3bb){var _0x3c5460={},_0x1f2b6f={},_0x20d591={'count':0x0,'rows':[]};var _0x3981a5=_['map'](db['Campaign']['rawAttributes'],function(_0x94accb){return{'name':_0x94accb[_0x0da2('0x28')],'type':_0x94accb['type']['key']};});_0x1f2b6f[_0x0da2('0x29')]=_[_0x0da2('0x2a')](_0x3981a5,_0x0da2('0x25'));_0x1f2b6f[_0x0da2('0x2b')]=_['keys'](_0x103857[_0x0da2('0x2b')]);_0x1f2b6f['filters']=_[_0x0da2('0x2c')](_0x1f2b6f[_0x0da2('0x29')],_0x1f2b6f[_0x0da2('0x2b')]);_0x3c5460[_0x0da2('0x2d')]=_[_0x0da2('0x2c')](_0x1f2b6f[_0x0da2('0x29')],qs[_0x0da2('0x2e')](_0x103857['query'][_0x0da2('0x2e')]));_0x3c5460[_0x0da2('0x2d')]=_0x3c5460[_0x0da2('0x2d')][_0x0da2('0x2f')]?_0x3c5460[_0x0da2('0x2d')]:_0x1f2b6f[_0x0da2('0x29')];if(!_0x103857['query'][_0x0da2('0x30')](_0x0da2('0x31'))){_0x3c5460[_0x0da2('0x1a')]=qs[_0x0da2('0x1a')](_0x103857['query']['limit']);_0x3c5460[_0x0da2('0x32')]=qs[_0x0da2('0x32')](_0x103857[_0x0da2('0x2b')][_0x0da2('0x32')]);}_0x3c5460[_0x0da2('0x33')]=qs[_0x0da2('0x34')](_0x103857[_0x0da2('0x2b')][_0x0da2('0x34')]);_0x3c5460[_0x0da2('0x35')]=qs['filters'](_[_0x0da2('0x36')](_0x103857[_0x0da2('0x2b')],_0x1f2b6f[_0x0da2('0x37')]),_0x3981a5);if(_0x103857[_0x0da2('0x2b')][_0x0da2('0x38')]){_0x3c5460[_0x0da2('0x35')]=_[_0x0da2('0x39')](_0x3c5460[_0x0da2('0x35')],{'$or':_['map'](_0x3981a5,function(_0x2a5266){if(_0x2a5266['type']!=='VIRTUAL'){var _0xd15984={};_0xd15984[_0x2a5266['name']]={'$like':'%'+_0x103857[_0x0da2('0x2b')][_0x0da2('0x38')]+'%'};return _0xd15984;}})});}_0x3c5460=_[_0x0da2('0x39')]({},_0x3c5460,_0x103857[_0x0da2('0x3a')]);var _0x5eb2e9={'where':_0x3c5460[_0x0da2('0x35')]};return db[_0x0da2('0x3b')][_0x0da2('0x1b')](_0x5eb2e9)[_0x0da2('0x1f')](function(_0x40bbae){_0x20d591[_0x0da2('0x1b')]=_0x40bbae;if(_0x103857[_0x0da2('0x2b')][_0x0da2('0x3c')]){_0x3c5460['include']=[{'all':!![]}];}return db['Campaign'][_0x0da2('0x3d')](_0x3c5460);})['then'](function(_0x325732){_0x20d591['rows']=_0x325732;return _0x20d591;})[_0x0da2('0x1f')](respondWithFilteredResult(_0x44c3bb,_0x3c5460))['catch'](handleError(_0x44c3bb,null));};exports['show']=function(_0x5693ca,_0xa9ef0){var _0x428fd4={'raw':![],'where':{'id':_0x5693ca[_0x0da2('0x3e')]['id']}},_0x11ade3={};_0x11ade3['model']=_[_0x0da2('0x3f')](db['Campaign'][_0x0da2('0x40')]);_0x11ade3[_0x0da2('0x2b')]=_['keys'](_0x5693ca[_0x0da2('0x2b')]);_0x11ade3[_0x0da2('0x37')]=_[_0x0da2('0x2c')](_0x11ade3[_0x0da2('0x29')],_0x11ade3['query']);_0x428fd4[_0x0da2('0x2d')]=_[_0x0da2('0x2c')](_0x11ade3['model'],qs[_0x0da2('0x2e')](_0x5693ca[_0x0da2('0x2b')][_0x0da2('0x2e')]));_0x428fd4[_0x0da2('0x2d')]=_0x428fd4['attributes'][_0x0da2('0x2f')]?_0x428fd4['attributes']:_0x11ade3[_0x0da2('0x29')];if(_0x5693ca[_0x0da2('0x2b')][_0x0da2('0x3c')]){_0x428fd4[_0x0da2('0x41')]=[{'all':!![]}];}_0x428fd4=_[_0x0da2('0x39')]({},_0x428fd4,_0x5693ca['options']);return db[_0x0da2('0x3b')][_0x0da2('0x42')](_0x428fd4)[_0x0da2('0x1f')](handleEntityNotFound(_0xa9ef0,null))[_0x0da2('0x1f')](respondWithResult(_0xa9ef0,null))['catch'](handleError(_0xa9ef0,null));};exports[_0x0da2('0x43')]=function(_0x2b50b7,_0x2c9172){return db[_0x0da2('0x3b')][_0x0da2('0x43')](_0x2b50b7['body'],{})[_0x0da2('0x1f')](function(_0x3054bc){var _0x2937b8=_0x2b50b7[_0x0da2('0x44')][_0x0da2('0x20')]({'plain':!![]});if(!_0x2937b8)throw new Error(_0x0da2('0x45'));if(_0x2937b8[_0x0da2('0x46')]==='user'){var _0x2346fc=_0x3054bc['get']({'plain':!![]});var _0x515612='IvrCampaigns';return db[_0x0da2('0x47')][_0x0da2('0x42')]({'where':{'name':_0x515612,'userProfileId':_0x2937b8[_0x0da2('0x48')]},'raw':!![]})[_0x0da2('0x1f')](function(_0x5537e4){if(_0x5537e4&&_0x5537e4[_0x0da2('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0x2346fc['name'],'resourceId':_0x2346fc['id'],'type':_0x5537e4[_0x0da2('0x25')],'sectionId':_0x5537e4['id']},{})[_0x0da2('0x1f')](function(){return _0x3054bc;});}else{return _0x3054bc;}})[_0x0da2('0x4a')](function(_0x33e030){logger['error'](_0x0da2('0x4b'),_0x33e030);throw _0x33e030;});}return _0x3054bc;})[_0x0da2('0x1f')](respondWithResult(_0x2c9172,0xc9))[_0x0da2('0x4a')](handleError(_0x2c9172,null));};exports[_0x0da2('0x4c')]=function(_0x3693b6,_0x1cf2ff){var _0x44e99a={'where':{'id':_0x3693b6[_0x0da2('0x3e')]['id']}},_0x57a920={};_0x57a920[_0x0da2('0x29')]=_[_0x0da2('0x3f')](db[_0x0da2('0x3b')][_0x0da2('0x40')]);_0x44e99a['attributes']=_['intersection'](_0x57a920[_0x0da2('0x29')],qs[_0x0da2('0x2e')](_0x3693b6['query']['fields']));_0x44e99a[_0x0da2('0x2d')]=_0x44e99a[_0x0da2('0x2d')][_0x0da2('0x2f')]?_0x44e99a[_0x0da2('0x2d')]:_0x57a920[_0x0da2('0x29')];if(_0x3693b6[_0x0da2('0x2b')][_0x0da2('0x3c')]){_0x44e99a[_0x0da2('0x41')]=[{'all':!![]}];}_0x44e99a=_[_0x0da2('0x39')]({},_0x44e99a,_0x3693b6[_0x0da2('0x3a')]);return db[_0x0da2('0x3b')][_0x0da2('0x42')](_0x44e99a)[_0x0da2('0x1f')](handleEntityNotFound(_0x1cf2ff,null))[_0x0da2('0x1f')](function(_0x489e36){if(_0x489e36){var _0x10cda4=_0x489e36['get']({'plain':!![]});_0x10cda4=qs['omit'](_0x10cda4,['id',_0x0da2('0x4d'),_0x0da2('0x4e')]);_0x3693b6[_0x0da2('0x4f')]=_[_0x0da2('0x50')](_0x3693b6[_0x0da2('0x4f')],['id',_0x0da2('0x4d'),_0x0da2('0x4e')]);return db['Campaign']['create'](_[_0x0da2('0x39')](_0x10cda4,_0x3693b6['body']),{'include':_0x3693b6['query'][_0x0da2('0x3c')]?[{'all':!![]}]:undefined})[_0x0da2('0x1f')](function(_0x1cbf7b){var _0xed6587=_0x3693b6[_0x0da2('0x44')][_0x0da2('0x20')]({'plain':!![]});if(!_0xed6587)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xed6587[_0x0da2('0x46')]===_0x0da2('0x44')){var _0x1cfc42=_0x1cbf7b[_0x0da2('0x20')]({'plain':!![]});var _0x4d2cf9=_0x0da2('0x51');return db[_0x0da2('0x47')]['find']({'where':{'name':_0x4d2cf9,'userProfileId':_0xed6587[_0x0da2('0x48')]},'raw':!![]})['then'](function(_0x19db59){if(_0x19db59&&_0x19db59[_0x0da2('0x49')]===0x0){return db[_0x0da2('0x21')][_0x0da2('0x43')]({'name':_0x1cfc42[_0x0da2('0x25')],'resourceId':_0x1cfc42['id'],'type':_0x19db59[_0x0da2('0x25')],'sectionId':_0x19db59['id']},{})['then'](function(){return _0x1cbf7b;});}else{return _0x1cbf7b;}})['catch'](function(_0x54b440){logger[_0x0da2('0x24')](_0x0da2('0x4b'),_0x54b440);throw _0x54b440;});}return _0x1cbf7b;});}})[_0x0da2('0x1f')](respondWithResult(_0x1cf2ff,0xc9))['catch'](handleError(_0x1cf2ff,null));};exports['update']=function(_0x20529b,_0x51c1cf){if(_0x20529b[_0x0da2('0x4f')]['id']){delete _0x20529b[_0x0da2('0x4f')]['id'];}return db[_0x0da2('0x3b')][_0x0da2('0x42')]({'where':{'id':_0x20529b[_0x0da2('0x3e')]['id']}})[_0x0da2('0x1f')](handleEntityNotFound(_0x51c1cf,null))[_0x0da2('0x1f')](saveUpdates(_0x20529b[_0x0da2('0x4f')],null))[_0x0da2('0x1f')](respondWithResult(_0x51c1cf,null))['catch'](handleError(_0x51c1cf,null));};exports['destroy']=function(_0xb71616,_0x7c45b6){return db[_0x0da2('0x3b')][_0x0da2('0x42')]({'where':{'id':_0xb71616[_0x0da2('0x3e')]['id']}})[_0x0da2('0x1f')](handleEntityNotFound(_0x7c45b6,null))[_0x0da2('0x1f')](removeEntity(_0x7c45b6,null))[_0x0da2('0x4a')](handleError(_0x7c45b6,null));};exports[_0x0da2('0x52')]=function(_0x1d21d7,_0x45706f,_0x297983){var _0x1b5c11={'raw':!![],'where':{}};var _0x3c9f73={};var _0x32b0d8={'count':0x0,'rows':[]};return db['Campaign'][_0x0da2('0x53')]({'where':{'id':_0x1d21d7[_0x0da2('0x3e')]['id']}})['then'](handleEntityNotFound(_0x45706f,null))[_0x0da2('0x1f')](function(_0x254564){if(_0x254564){_0x3c9f73[_0x0da2('0x29')]=_[_0x0da2('0x3f')](db['CmHopper']['rawAttributes']);_0x3c9f73[_0x0da2('0x2b')]=_[_0x0da2('0x3f')](_0x1d21d7[_0x0da2('0x2b')]);_0x3c9f73[_0x0da2('0x37')]=_[_0x0da2('0x2c')](_0x3c9f73[_0x0da2('0x29')],_0x3c9f73[_0x0da2('0x2b')]);_0x1b5c11['attributes']=_[_0x0da2('0x2c')](_0x3c9f73[_0x0da2('0x29')],qs[_0x0da2('0x2e')](_0x1d21d7[_0x0da2('0x2b')][_0x0da2('0x2e')]));_0x1b5c11['attributes']=_0x1b5c11[_0x0da2('0x2d')][_0x0da2('0x2f')]?_0x1b5c11['attributes']:_0x3c9f73[_0x0da2('0x29')];if(!_0x1d21d7[_0x0da2('0x2b')][_0x0da2('0x30')](_0x0da2('0x31'))){_0x1b5c11[_0x0da2('0x1a')]=qs[_0x0da2('0x1a')](_0x1d21d7[_0x0da2('0x2b')][_0x0da2('0x1a')]);_0x1b5c11[_0x0da2('0x32')]=qs[_0x0da2('0x32')](_0x1d21d7[_0x0da2('0x2b')][_0x0da2('0x32')]);}_0x1b5c11['order']=qs['sort'](_0x1d21d7[_0x0da2('0x2b')][_0x0da2('0x34')]);_0x1b5c11['where']=qs[_0x0da2('0x37')](_[_0x0da2('0x36')](_0x1d21d7[_0x0da2('0x2b')],_0x3c9f73[_0x0da2('0x37')]));_0x1b5c11[_0x0da2('0x35')][_0x0da2('0x54')]=_0x254564['id'];if(_0x1d21d7[_0x0da2('0x2b')][_0x0da2('0x38')]){_0x1b5c11['where']=_[_0x0da2('0x39')](_0x1b5c11[_0x0da2('0x35')],{'$or':_[_0x0da2('0x2a')](_0x1b5c11[_0x0da2('0x2d')],function(_0x4c1de0){var _0x3d52ba={};_0x3d52ba[_0x4c1de0]={'$like':'%'+_0x1d21d7[_0x0da2('0x2b')][_0x0da2('0x38')]+'%'};return _0x3d52ba;})});}_0x1b5c11=_[_0x0da2('0x39')]({},_0x1b5c11,_0x1d21d7['options']);return db['CmHopper'][_0x0da2('0x1b')]({'where':_0x1b5c11['where']})['then'](function(_0xced00a){_0x32b0d8[_0x0da2('0x1b')]=_0xced00a;if(_0x1d21d7[_0x0da2('0x2b')][_0x0da2('0x3c')]){_0x1b5c11[_0x0da2('0x41')]=[{'all':!![]}];}return db[_0x0da2('0x55')][_0x0da2('0x3d')](_0x1b5c11);})[_0x0da2('0x1f')](function(_0x4448fc){_0x32b0d8['rows']=_0x4448fc;return _0x32b0d8;});}})[_0x0da2('0x1f')](respondWithFilteredResult(_0x45706f,_0x1b5c11))[_0x0da2('0x4a')](handleError(_0x45706f,null));};exports[_0x0da2('0x56')]=function(_0x47fedb,_0x3ffd97,_0x3fca49){var _0x270d7d={'raw':!![],'where':{}};var _0x4396aa={};var _0x3fa6a0={'count':0x0,'rows':[]};return db[_0x0da2('0x3b')][_0x0da2('0x53')]({'where':{'id':_0x47fedb[_0x0da2('0x3e')]['id']}})[_0x0da2('0x1f')](handleEntityNotFound(_0x3ffd97,null))[_0x0da2('0x1f')](function(_0x15ac52){if(_0x15ac52){_0x4396aa['model']=_[_0x0da2('0x3f')](db[_0x0da2('0x57')]['rawAttributes']);_0x4396aa[_0x0da2('0x2b')]=_['keys'](_0x47fedb[_0x0da2('0x2b')]);_0x4396aa[_0x0da2('0x37')]=_[_0x0da2('0x2c')](_0x4396aa[_0x0da2('0x29')],_0x4396aa[_0x0da2('0x2b')]);_0x270d7d[_0x0da2('0x2d')]=_[_0x0da2('0x2c')](_0x4396aa['model'],qs[_0x0da2('0x2e')](_0x47fedb[_0x0da2('0x2b')]['fields']));_0x270d7d[_0x0da2('0x2d')]=_0x270d7d[_0x0da2('0x2d')][_0x0da2('0x2f')]?_0x270d7d['attributes']:_0x4396aa[_0x0da2('0x29')];if(!_0x47fedb[_0x0da2('0x2b')][_0x0da2('0x30')]('nolimit')){_0x270d7d[_0x0da2('0x1a')]=qs[_0x0da2('0x1a')](_0x47fedb[_0x0da2('0x2b')][_0x0da2('0x1a')]);_0x270d7d[_0x0da2('0x32')]=qs[_0x0da2('0x32')](_0x47fedb[_0x0da2('0x2b')][_0x0da2('0x32')]);}_0x270d7d[_0x0da2('0x33')]=qs[_0x0da2('0x34')](_0x47fedb[_0x0da2('0x2b')][_0x0da2('0x34')]);_0x270d7d[_0x0da2('0x35')]=qs[_0x0da2('0x37')](_[_0x0da2('0x36')](_0x47fedb[_0x0da2('0x2b')],_0x4396aa['filters']));_0x270d7d[_0x0da2('0x35')][_0x0da2('0x54')]=_0x15ac52['id'];if(_0x47fedb[_0x0da2('0x2b')][_0x0da2('0x38')]){_0x270d7d[_0x0da2('0x35')]=_[_0x0da2('0x39')](_0x270d7d[_0x0da2('0x35')],{'$or':_[_0x0da2('0x2a')](_0x270d7d[_0x0da2('0x2d')],function(_0x5b4095){var _0x2f695d={};_0x2f695d[_0x5b4095]={'$like':'%'+_0x47fedb[_0x0da2('0x2b')][_0x0da2('0x38')]+'%'};return _0x2f695d;})});}_0x270d7d=_[_0x0da2('0x39')]({},_0x270d7d,_0x47fedb['options']);return db['CmHopperHistory'][_0x0da2('0x1b')]({'where':_0x270d7d[_0x0da2('0x35')]})[_0x0da2('0x1f')](function(_0x728223){_0x3fa6a0['count']=_0x728223;if(_0x47fedb[_0x0da2('0x2b')][_0x0da2('0x3c')]){_0x270d7d[_0x0da2('0x41')]=[{'all':!![]}];}return db[_0x0da2('0x57')][_0x0da2('0x3d')](_0x270d7d);})['then'](function(_0x3b368b){_0x3fa6a0['rows']=_0x3b368b;return _0x3fa6a0;});}})[_0x0da2('0x1f')](respondWithFilteredResult(_0x3ffd97,_0x270d7d))[_0x0da2('0x4a')](handleError(_0x3ffd97,null));};exports['getHopperFinals']=function(_0x2c625f,_0x5ab27b,_0x51553e){var _0x303653={'raw':!![],'where':{}};var _0x2100cd={};var _0x9000eb={'count':0x0,'rows':[]};return db['Campaign'][_0x0da2('0x53')]({'where':{'id':_0x2c625f[_0x0da2('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5ab27b,null))[_0x0da2('0x1f')](function(_0x2ab70d){if(_0x2ab70d){_0x2100cd[_0x0da2('0x29')]=_[_0x0da2('0x3f')](db[_0x0da2('0x58')][_0x0da2('0x40')]);_0x2100cd['query']=_[_0x0da2('0x3f')](_0x2c625f[_0x0da2('0x2b')]);_0x2100cd[_0x0da2('0x37')]=_[_0x0da2('0x2c')](_0x2100cd['model'],_0x2100cd[_0x0da2('0x2b')]);_0x303653['attributes']=_['intersection'](_0x2100cd['model'],qs[_0x0da2('0x2e')](_0x2c625f[_0x0da2('0x2b')][_0x0da2('0x2e')]));_0x303653[_0x0da2('0x2d')]=_0x303653[_0x0da2('0x2d')]['length']?_0x303653[_0x0da2('0x2d')]:_0x2100cd[_0x0da2('0x29')];if(!_0x2c625f['query'][_0x0da2('0x30')](_0x0da2('0x31'))){_0x303653[_0x0da2('0x1a')]=qs[_0x0da2('0x1a')](_0x2c625f[_0x0da2('0x2b')]['limit']);_0x303653[_0x0da2('0x32')]=qs['offset'](_0x2c625f[_0x0da2('0x2b')][_0x0da2('0x32')]);}_0x303653[_0x0da2('0x33')]=qs['sort'](_0x2c625f['query'][_0x0da2('0x34')]);_0x303653['where']=qs[_0x0da2('0x37')](_[_0x0da2('0x36')](_0x2c625f['query'],_0x2100cd['filters']));_0x303653[_0x0da2('0x35')][_0x0da2('0x54')]=_0x2ab70d['id'];if(_0x2c625f[_0x0da2('0x2b')][_0x0da2('0x38')]){_0x303653[_0x0da2('0x35')]=_[_0x0da2('0x39')](_0x303653['where'],{'$or':_[_0x0da2('0x2a')](_0x303653[_0x0da2('0x2d')],function(_0x328114){var _0x447da1={};_0x447da1[_0x328114]={'$like':'%'+_0x2c625f[_0x0da2('0x2b')][_0x0da2('0x38')]+'%'};return _0x447da1;})});}_0x303653=_[_0x0da2('0x39')]({},_0x303653,_0x2c625f[_0x0da2('0x3a')]);return db[_0x0da2('0x58')]['count']({'where':_0x303653[_0x0da2('0x35')]})[_0x0da2('0x1f')](function(_0xd19581){_0x9000eb[_0x0da2('0x1b')]=_0xd19581;if(_0x2c625f['query'][_0x0da2('0x3c')]){_0x303653['include']=[{'all':!![]}];}return db[_0x0da2('0x58')]['findAll'](_0x303653);})[_0x0da2('0x1f')](function(_0x2ec20c){_0x9000eb[_0x0da2('0x59')]=_0x2ec20c;return _0x9000eb;});}})[_0x0da2('0x1f')](respondWithFilteredResult(_0x5ab27b,_0x303653))[_0x0da2('0x4a')](handleError(_0x5ab27b,null));};exports[_0x0da2('0x5a')]=function(_0xb6b6dc,_0x2923c9,_0x2131e1){var _0x301c01={'raw':!![],'where':{}};var _0x24a39f={};var _0x160327={'count':0x0,'rows':[]};return db[_0x0da2('0x3b')][_0x0da2('0x53')]({'where':{'id':_0xb6b6dc['params']['id']}})['then'](handleEntityNotFound(_0x2923c9,null))[_0x0da2('0x1f')](function(_0x2f38f0){if(_0x2f38f0){_0x24a39f[_0x0da2('0x29')]=_[_0x0da2('0x3f')](db[_0x0da2('0x5b')][_0x0da2('0x40')]);_0x24a39f['query']=_[_0x0da2('0x3f')](_0xb6b6dc[_0x0da2('0x2b')]);_0x24a39f[_0x0da2('0x37')]=_[_0x0da2('0x2c')](_0x24a39f[_0x0da2('0x29')],_0x24a39f['query']);_0x301c01['attributes']=_[_0x0da2('0x2c')](_0x24a39f[_0x0da2('0x29')],qs['fields'](_0xb6b6dc[_0x0da2('0x2b')][_0x0da2('0x2e')]));_0x301c01[_0x0da2('0x2d')]=_0x301c01[_0x0da2('0x2d')][_0x0da2('0x2f')]?_0x301c01[_0x0da2('0x2d')]:_0x24a39f[_0x0da2('0x29')];if(!_0xb6b6dc[_0x0da2('0x2b')][_0x0da2('0x30')](_0x0da2('0x31'))){_0x301c01[_0x0da2('0x1a')]=qs['limit'](_0xb6b6dc[_0x0da2('0x2b')][_0x0da2('0x1a')]);_0x301c01[_0x0da2('0x32')]=qs[_0x0da2('0x32')](_0xb6b6dc[_0x0da2('0x2b')][_0x0da2('0x32')]);}_0x301c01[_0x0da2('0x33')]=qs[_0x0da2('0x34')](_0xb6b6dc[_0x0da2('0x2b')][_0x0da2('0x34')]);_0x301c01[_0x0da2('0x35')]=qs['filters'](_[_0x0da2('0x36')](_0xb6b6dc['query'],_0x24a39f[_0x0da2('0x37')]));_0x301c01[_0x0da2('0x35')][_0x0da2('0x54')]=_0x2f38f0['id'];if(_0xb6b6dc['query'][_0x0da2('0x38')]){_0x301c01[_0x0da2('0x35')]=_['merge'](_0x301c01['where'],{'$or':_[_0x0da2('0x2a')](_0x301c01[_0x0da2('0x2d')],function(_0x308738){var _0x26d7b3={};_0x26d7b3[_0x308738]={'$like':'%'+_0xb6b6dc[_0x0da2('0x2b')][_0x0da2('0x38')]+'%'};return _0x26d7b3;})});}_0x301c01=_[_0x0da2('0x39')]({},_0x301c01,_0xb6b6dc['options']);return db['CmHopperBlack'][_0x0da2('0x1b')]({'where':_0x301c01['where']})[_0x0da2('0x1f')](function(_0x278149){_0x160327[_0x0da2('0x1b')]=_0x278149;if(_0xb6b6dc['query']['includeAll']){_0x301c01[_0x0da2('0x41')]=[{'all':!![]}];}return db[_0x0da2('0x5b')][_0x0da2('0x3d')](_0x301c01);})['then'](function(_0x36fce7){_0x160327[_0x0da2('0x59')]=_0x36fce7;return _0x160327;});}})[_0x0da2('0x1f')](respondWithFilteredResult(_0x2923c9,_0x301c01))['catch'](handleError(_0x2923c9,null));};exports[_0x0da2('0x5c')]=function(_0x2bbcf0,_0x15246d,_0x4b0371){var _0x191fa6={};var _0x23d946={};var _0x109e81;var _0x4c1616;return db[_0x0da2('0x3b')][_0x0da2('0x53')]({'where':{'id':_0x2bbcf0['params']['id']}})[_0x0da2('0x1f')](handleEntityNotFound(_0x15246d,null))[_0x0da2('0x1f')](function(_0x303b79){if(_0x303b79){_0x109e81=_0x303b79;_0x23d946[_0x0da2('0x29')]=_[_0x0da2('0x3f')](db[_0x0da2('0x5d')]['rawAttributes']);_0x23d946[_0x0da2('0x2b')]=_[_0x0da2('0x3f')](_0x2bbcf0['query']);_0x23d946['filters']=_[_0x0da2('0x2c')](_0x23d946[_0x0da2('0x29')],_0x23d946['query']);_0x191fa6[_0x0da2('0x2d')]=_['intersection'](_0x23d946[_0x0da2('0x29')],qs[_0x0da2('0x2e')](_0x2bbcf0['query']['fields']));_0x191fa6[_0x0da2('0x2d')]=_0x191fa6[_0x0da2('0x2d')][_0x0da2('0x2f')]?_0x191fa6[_0x0da2('0x2d')]:_0x23d946[_0x0da2('0x29')];_0x191fa6[_0x0da2('0x33')]=qs[_0x0da2('0x34')](_0x2bbcf0[_0x0da2('0x2b')]['sort']);_0x191fa6[_0x0da2('0x35')]=qs['filters'](_[_0x0da2('0x36')](_0x2bbcf0[_0x0da2('0x2b')],_0x23d946[_0x0da2('0x37')]));if(_0x2bbcf0['query'][_0x0da2('0x38')]){_0x191fa6[_0x0da2('0x35')]=_[_0x0da2('0x39')](_0x191fa6['where'],{'$or':_[_0x0da2('0x2a')](_0x191fa6[_0x0da2('0x2d')],function(_0x4b82ec){var _0x1b0749={};_0x1b0749[_0x4b82ec]={'$like':'%'+_0x2bbcf0['query'][_0x0da2('0x38')]+'%'};return _0x1b0749;})});}_0x191fa6=_[_0x0da2('0x39')]({},_0x191fa6,_0x2bbcf0['options']);return _0x109e81['getLists'](_0x191fa6);}})['then'](function(_0xa64830){if(_0xa64830){_0x4c1616=_0xa64830[_0x0da2('0x2f')];if(!_0x2bbcf0[_0x0da2('0x2b')][_0x0da2('0x30')](_0x0da2('0x31'))){_0x191fa6[_0x0da2('0x1a')]=qs[_0x0da2('0x1a')](_0x2bbcf0[_0x0da2('0x2b')]['limit']);_0x191fa6[_0x0da2('0x32')]=qs['offset'](_0x2bbcf0[_0x0da2('0x2b')][_0x0da2('0x32')]);}return _0x109e81[_0x0da2('0x5c')](_0x191fa6);}})[_0x0da2('0x1f')](function(_0x3a459b){if(_0x3a459b){return _0x3a459b?{'count':_0x4c1616,'rows':_0x3a459b}:null;}})[_0x0da2('0x1f')](respondWithResult(_0x15246d,null))['catch'](handleError(_0x15246d,null));};exports[_0x0da2('0x5e')]=function(_0x312b77,_0x3fde97,_0x4cd567){var _0x451041,_0x3b9e19;var _0x540169=[];var _0x32e2a6=moment()[_0x0da2('0x5f')](_0x0da2('0x60'));return db['Campaign']['find']({'where':{'id':_0x312b77[_0x0da2('0x3e')]['id']}})[_0x0da2('0x1f')](handleEntityNotFound(_0x3fde97,null))[_0x0da2('0x1f')](function(_0xb49063){if(_0xb49063){_0x3b9e19=_0xb49063;return _0xb49063[_0x0da2('0x5e')](_0x312b77[_0x0da2('0x4f')][_0x0da2('0x61')],_['omit'](_0x312b77[_0x0da2('0x4f')],[_0x0da2('0x61'),'id'])||{});}return null;})[_0x0da2('0x62')](function(_0x492182){var _0x636c1b;var _0x5abddd;_0x451041=_0x492182||[];var _0x4733ac=[];if(_0x492182){for(var _0x5cb0ef=0x0;_0x5cb0ef<_0x492182[_0x0da2('0x2f')];_0x5cb0ef+=0x1){var _0x5b4dbf=_0x492182[_0x5cb0ef]['get']({'plain':!![]});_0x3b9e19[_0x0da2('0x63')]=_0x312b77[_0x0da2('0x4f')][_0x0da2('0x63')]?_0x312b77[_0x0da2('0x4f')][_0x0da2('0x63')]:_0x3b9e19[_0x0da2('0x63')];switch(_0x3b9e19['dialCheckDuplicateType']){case'always':_0x636c1b=squel[_0x0da2('0x64')]()['into'](_0x0da2('0x65'))['fromQuery'](['phone',_0x0da2('0x66'),_0x0da2('0x67'),_0x0da2('0x68'),_0x0da2('0x54'),_0x0da2('0x4d'),_0x0da2('0x4e')],squel['select']()['field'](_0x0da2('0x69'),_0x0da2('0x69'))[_0x0da2('0x6a')](_0x0da2('0x6b'),_0x0da2('0x66'))['field']('id','ContactId')[_0x0da2('0x6a')](_0x5b4dbf['CmListId'][_0x0da2('0x6c')](),_0x0da2('0x68'))[_0x0da2('0x6a')](_0x312b77[_0x0da2('0x3e')]['id'][_0x0da2('0x6c')](),_0x0da2('0x54'))['field']('\x27'+_0x32e2a6+'\x27','createdAt')[_0x0da2('0x6a')]('\x27'+_0x32e2a6+'\x27',_0x0da2('0x4e'))['from'](_0x0da2('0x6d'))['where'](_0x0da2('0x6e'))[_0x0da2('0x35')]('ListId\x20=\x20?',_0x5b4dbf['CmListId'][_0x0da2('0x6c')]())[_0x0da2('0x35')](_0x0da2('0x6f'))['where'](_0x0da2('0x70'),squel[_0x0da2('0x71')]()['field'](_0x0da2('0x72'))[_0x0da2('0x73')]('cm_hopper_final')[_0x0da2('0x35')]('CampaignId\x20=\x20?',_0x312b77['params']['id'][_0x0da2('0x6c')]()))['where'](_0x0da2('0x70'),squel[_0x0da2('0x71')]()['field'](_0x0da2('0x74'))[_0x0da2('0x73')]('cm_hopper')[_0x0da2('0x35')](_0x0da2('0x75'),_0x312b77[_0x0da2('0x3e')]['id'][_0x0da2('0x6c')]())))[_0x0da2('0x6c')]();break;case _0x0da2('0x76'):_0x636c1b=squel['insert']()[_0x0da2('0x77')]('cm_hopper')['fromQuery']([_0x0da2('0x69'),_0x0da2('0x66'),_0x0da2('0x67'),_0x0da2('0x68'),'CampaignId',_0x0da2('0x4d'),'updatedAt'],squel['select']()[_0x0da2('0x6a')]('phone','phone')[_0x0da2('0x6a')](_0x0da2('0x6b'),_0x0da2('0x66'))[_0x0da2('0x6a')]('id',_0x0da2('0x67'))[_0x0da2('0x6a')](_0x5b4dbf[_0x0da2('0x78')][_0x0da2('0x6c')](),_0x0da2('0x68'))[_0x0da2('0x6a')](_0x312b77[_0x0da2('0x3e')]['id'][_0x0da2('0x6c')](),'CampaignId')[_0x0da2('0x6a')]('\x27'+_0x32e2a6+'\x27',_0x0da2('0x4d'))[_0x0da2('0x6a')]('\x27'+_0x32e2a6+'\x27',_0x0da2('0x4e'))[_0x0da2('0x73')](_0x0da2('0x6d'))[_0x0da2('0x35')](_0x0da2('0x6e'))[_0x0da2('0x35')](_0x0da2('0x79'),_0x5b4dbf['CmListId'][_0x0da2('0x6c')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x0da2('0x35')](_0x0da2('0x70'),squel[_0x0da2('0x71')]()[_0x0da2('0x6a')](_0x0da2('0x74'))[_0x0da2('0x73')](_0x0da2('0x65'))[_0x0da2('0x35')]('CampaignId\x20=\x20?',_0x312b77[_0x0da2('0x3e')]['id'][_0x0da2('0x6c')]())))['toString']();break;default:_0x636c1b=squel[_0x0da2('0x64')]()['into'](_0x0da2('0x65'))[_0x0da2('0x7a')](['phone',_0x0da2('0x66'),_0x0da2('0x67'),_0x0da2('0x68'),_0x0da2('0x54'),_0x0da2('0x4d'),_0x0da2('0x4e')],squel['select']()[_0x0da2('0x6a')](_0x0da2('0x69'),_0x0da2('0x69'))[_0x0da2('0x6a')]('NOW()',_0x0da2('0x66'))['field']('id',_0x0da2('0x67'))[_0x0da2('0x6a')](_0x5b4dbf[_0x0da2('0x78')]['toString'](),_0x0da2('0x68'))[_0x0da2('0x6a')](_0x312b77['params']['id'][_0x0da2('0x6c')](),_0x0da2('0x54'))[_0x0da2('0x6a')]('\x27'+_0x32e2a6+'\x27',_0x0da2('0x4d'))[_0x0da2('0x6a')]('\x27'+_0x32e2a6+'\x27',_0x0da2('0x4e'))[_0x0da2('0x73')]('cm_contacts')[_0x0da2('0x35')](_0x0da2('0x6e'))[_0x0da2('0x35')](_0x0da2('0x79'),_0x5b4dbf[_0x0da2('0x78')]['toString']())[_0x0da2('0x35')](_0x0da2('0x6f')))[_0x0da2('0x6c')]();}_0x5abddd=squel[_0x0da2('0x64')]()[_0x0da2('0x77')]('cm_hopper_additional_phones')[_0x0da2('0x7a')](['cmHopperId',_0x0da2('0x66'),_0x0da2('0x69'),_0x0da2('0x7b'),_0x0da2('0x4d'),_0x0da2('0x4e')],squel[_0x0da2('0x71')]()[_0x0da2('0x6a')]('h.id','id')[_0x0da2('0x6a')](_0x0da2('0x6b'),_0x0da2('0x66'))[_0x0da2('0x6a')](_0x0da2('0x7c'),_0x0da2('0x69'))[_0x0da2('0x6a')](_0x0da2('0x7d'),_0x0da2('0x7b'))[_0x0da2('0x6a')]('\x27'+_0x32e2a6+'\x27',_0x0da2('0x4d'))[_0x0da2('0x6a')]('\x27'+_0x32e2a6+'\x27','updatedAt')[_0x0da2('0x73')](_0x0da2('0x7e'),'ci')[_0x0da2('0x7f')]('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')[_0x0da2('0x35')](_0x0da2('0x80'),_0x5b4dbf[_0x0da2('0x78')]['toString']())['where'](_0x0da2('0x81'),_0x312b77[_0x0da2('0x3e')]['id'][_0x0da2('0x6c')]())['where'](_0x0da2('0x82'),_0x32e2a6))[_0x0da2('0x6c')]();_0x4733ac['push'](db[_0x0da2('0x83')]['query'](_0x636c1b));_0x540169[_0x0da2('0x84')](db[_0x0da2('0x83')][_0x0da2('0x2b')](_0x5abddd));}return BPromise['all'](_0x4733ac);}})[_0x0da2('0x1f')](function(){return BPromise[_0x0da2('0x85')](_0x540169);})[_0x0da2('0x1f')](function(){return _0x451041;})[_0x0da2('0x1f')](respondWithResult(_0x3fde97,null))['catch'](handleError(_0x3fde97,null));};exports[_0x0da2('0x86')]=function(_0x3f0494,_0x41a1be,_0xf992c){return db['Campaign'][_0x0da2('0x42')]({'where':{'id':_0x3f0494[_0x0da2('0x3e')]['id']}})[_0x0da2('0x1f')](handleEntityNotFound(_0x41a1be,null))[_0x0da2('0x1f')](function(_0x3d4e71){if(_0x3d4e71){return _0x3d4e71['removeLists'](_0x3f0494[_0x0da2('0x2b')]['ids']);}})[_0x0da2('0x1f')](function(_0x2012cf){if(_0x2012cf){return db['CmHopper'][_0x0da2('0x1e')]({'where':{'ListId':_0x3f0494['query'][_0x0da2('0x61')],'CampaignId':_0x3f0494[_0x0da2('0x3e')]['id']}})['then'](function(){return _0x2012cf;});}})['then'](respondWithStatusCode(_0x41a1be,null))[_0x0da2('0x4a')](handleError(_0x41a1be,null));};exports[_0x0da2('0x87')]=function(_0xf263e3,_0x6eb228,_0x3c5f97){var _0x4fcc11={};var _0x1075e3={};var _0x2992a0;var _0x407091;return db[_0x0da2('0x3b')][_0x0da2('0x53')]({'where':{'id':_0xf263e3[_0x0da2('0x3e')]['id']}})[_0x0da2('0x1f')](handleEntityNotFound(_0x6eb228,null))['then'](function(_0x2cd974){if(_0x2cd974){_0x2992a0=_0x2cd974;_0x1075e3['model']=_[_0x0da2('0x3f')](db[_0x0da2('0x5d')]['rawAttributes']);_0x1075e3[_0x0da2('0x2b')]=_[_0x0da2('0x3f')](_0xf263e3[_0x0da2('0x2b')]);_0x1075e3[_0x0da2('0x37')]=_[_0x0da2('0x2c')](_0x1075e3[_0x0da2('0x29')],_0x1075e3[_0x0da2('0x2b')]);_0x4fcc11[_0x0da2('0x2d')]=_[_0x0da2('0x2c')](_0x1075e3[_0x0da2('0x29')],qs[_0x0da2('0x2e')](_0xf263e3[_0x0da2('0x2b')][_0x0da2('0x2e')]));_0x4fcc11[_0x0da2('0x2d')]=_0x4fcc11[_0x0da2('0x2d')]['length']?_0x4fcc11[_0x0da2('0x2d')]:_0x1075e3[_0x0da2('0x29')];_0x4fcc11['order']=qs[_0x0da2('0x34')](_0xf263e3[_0x0da2('0x2b')][_0x0da2('0x34')]);_0x4fcc11['where']=qs[_0x0da2('0x37')](_[_0x0da2('0x36')](_0xf263e3[_0x0da2('0x2b')],_0x1075e3[_0x0da2('0x37')]));if(_0xf263e3['query'][_0x0da2('0x38')]){_0x4fcc11['where']=_[_0x0da2('0x39')](_0x4fcc11[_0x0da2('0x35')],{'$or':_[_0x0da2('0x2a')](_0x4fcc11[_0x0da2('0x2d')],function(_0xb6b73b){var _0x33ebb7={};_0x33ebb7[_0xb6b73b]={'$like':'%'+_0xf263e3[_0x0da2('0x2b')][_0x0da2('0x38')]+'%'};return _0x33ebb7;})});}_0x4fcc11=_[_0x0da2('0x39')]({},_0x4fcc11,_0xf263e3[_0x0da2('0x3a')]);return _0x2992a0['getBlackLists'](_0x4fcc11);}})[_0x0da2('0x1f')](function(_0xb7e803){if(_0xb7e803){_0x407091=_0xb7e803[_0x0da2('0x2f')];if(!_0xf263e3[_0x0da2('0x2b')][_0x0da2('0x30')](_0x0da2('0x31'))){_0x4fcc11[_0x0da2('0x1a')]=qs[_0x0da2('0x1a')](_0xf263e3[_0x0da2('0x2b')][_0x0da2('0x1a')]);_0x4fcc11[_0x0da2('0x32')]=qs[_0x0da2('0x32')](_0xf263e3[_0x0da2('0x2b')]['offset']);}return _0x2992a0[_0x0da2('0x87')](_0x4fcc11);}})[_0x0da2('0x1f')](function(_0x116f95){if(_0x116f95){return _0x116f95?{'count':_0x407091,'rows':_0x116f95}:null;}})[_0x0da2('0x1f')](respondWithResult(_0x6eb228,null))['catch'](handleError(_0x6eb228,null));};exports[_0x0da2('0x88')]=function(_0x38ce20,_0xfbfe3,_0x4a1a39){var _0x30993f,_0x45a090;var _0x4a36c3=[];var _0x2b1841=moment()[_0x0da2('0x5f')](_0x0da2('0x60'));return db[_0x0da2('0x3b')][_0x0da2('0x42')]({'where':{'id':_0x38ce20['params']['id']}})['then'](handleEntityNotFound(_0xfbfe3,null))[_0x0da2('0x1f')](function(_0x576100){if(_0x576100){_0x45a090=_0x576100;return _0x576100[_0x0da2('0x88')](_0x38ce20['body']['ids'],_[_0x0da2('0x50')](_0x38ce20[_0x0da2('0x4f')],[_0x0da2('0x61'),'id'])||{});}return null;})[_0x0da2('0x62')](function(_0x3e49ca){var _0x4b5d34;var _0x82c84e;_0x30993f=_0x3e49ca||[];var _0x477045=[];if(_0x3e49ca){for(var _0x4670e3=0x0;_0x4670e3<_0x3e49ca[_0x0da2('0x2f')];_0x4670e3+=0x1){var _0x316f63=_0x3e49ca[_0x4670e3]['get']({'plain':!![]});_0x4b5d34=squel['insert']()['into'](_0x0da2('0x89'))['fromQuery']([_0x0da2('0x69'),'ContactId',_0x0da2('0x68'),'CampaignId','createdAt',_0x0da2('0x4e')],squel['select']()['field'](_0x0da2('0x69'),_0x0da2('0x69'))['field']('id','ContactId')[_0x0da2('0x6a')](_0x316f63['CmListId'][_0x0da2('0x6c')](),_0x0da2('0x68'))[_0x0da2('0x6a')](_0x38ce20['params']['id']['toString'](),_0x0da2('0x54'))[_0x0da2('0x6a')](_0x0da2('0x6b'),_0x0da2('0x4d'))[_0x0da2('0x6a')](_0x0da2('0x6b'),_0x0da2('0x4e'))[_0x0da2('0x73')](_0x0da2('0x6d'))[_0x0da2('0x35')]('deletedAt\x20IS\x20NULL')['where'](_0x0da2('0x79'),_0x316f63['CmListId'][_0x0da2('0x6c')]())[_0x0da2('0x35')](_0x0da2('0x6f')))[_0x0da2('0x6c')]();_0x477045[_0x0da2('0x84')](db[_0x0da2('0x83')][_0x0da2('0x2b')](_0x4b5d34));}return BPromise[_0x0da2('0x85')](_0x477045);}})[_0x0da2('0x1f')](function(){return _0x30993f;})[_0x0da2('0x1f')](respondWithResult(_0xfbfe3,null))['catch'](handleError(_0xfbfe3,null));};exports[_0x0da2('0x8a')]=function(_0x239b66,_0x5b0667,_0x378574){return db[_0x0da2('0x3b')][_0x0da2('0x42')]({'where':{'id':_0x239b66[_0x0da2('0x3e')]['id']}})[_0x0da2('0x1f')](handleEntityNotFound(_0x5b0667,null))[_0x0da2('0x1f')](function(_0x4a1ef1){if(_0x4a1ef1){return _0x4a1ef1[_0x0da2('0x8a')](_0x239b66[_0x0da2('0x2b')][_0x0da2('0x61')]);}})['then'](function(_0x162ed9){if(_0x162ed9){return db[_0x0da2('0x5b')]['destroy']({'where':{'ListId':_0x239b66[_0x0da2('0x2b')]['ids'],'CampaignId':_0x239b66[_0x0da2('0x3e')]['id']}})[_0x0da2('0x1f')](function(){return _0x162ed9;});}})[_0x0da2('0x1f')](respondWithStatusCode(_0x5b0667,null))[_0x0da2('0x4a')](handleError(_0x5b0667,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index ed288ac..1f9f1c0 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 _0x6814=['define','Campaign','campaigns','lodash','util','api','moment','request-promise','rimraf','exports'];(function(_0xc99e4f,_0x22b192){var _0x4cd923=function(_0x21943b){while(--_0x21943b){_0xc99e4f['push'](_0xc99e4f['shift']());}};_0x4cd923(++_0x22b192);}(_0x6814,0xc1));var _0x4681=function(_0x5d786e,_0x164852){_0x5d786e=_0x5d786e-0x0;var _0x418493=_0x6814[_0x5d786e];return _0x418493;};'use strict';var _=require(_0x4681('0x0'));var util=require(_0x4681('0x1'));var logger=require('../../config/logger')(_0x4681('0x2'));var moment=require(_0x4681('0x3'));var BPromise=require('bluebird');var rp=require(_0x4681('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4681('0x5'));var config=require('../../config/environment');var attributes=require('./campaign.attributes');module[_0x4681('0x6')]=function(_0x82870b,_0x1584f6){return _0x82870b[_0x4681('0x7')](_0x4681('0x8'),attributes,{'tableName':_0x4681('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ecb=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./campaign.attributes','exports','define','Campaign'];(function(_0x1d4104,_0x398367){var _0x35a5ea=function(_0x345b04){while(--_0x345b04){_0x1d4104['push'](_0x1d4104['shift']());}};_0x35a5ea(++_0x398367);}(_0x4ecb,0x1c7));var _0xb4ec=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x4ecb[_0x122096];return _0x3d1966;};'use strict';var _=require(_0xb4ec('0x0'));var util=require(_0xb4ec('0x1'));var logger=require(_0xb4ec('0x2'))(_0xb4ec('0x3'));var moment=require(_0xb4ec('0x4'));var BPromise=require(_0xb4ec('0x5'));var rp=require(_0xb4ec('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb4ec('0x7'));var config=require(_0xb4ec('0x8'));var attributes=require(_0xb4ec('0x9'));module[_0xb4ec('0xa')]=function(_0xe71ab8,_0x3eb469){return _0xe71ab8[_0xb4ec('0xb')](_0xb4ec('0xc'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index ef281b4..f597a81 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 _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x25dea5,_0x440b95){var _0x5cc4af=function(_0x22ad08){while(--_0x22ad08){_0x25dea5['push'](_0x25dea5['shift']());}};_0x5cc4af(++_0x440b95);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var 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']('Campaign,\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['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3ea196,_0x19f049){var _0xc8e6d3=function(_0x328cc5){while(--_0x328cc5){_0x3ea196['push'](_0x3ea196['shift']());}};_0xc8e6d3(++_0x19f049);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var 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']('Campaign,\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['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 898096b..328becf 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 _0x1beb=['post','/:id/clone','clone','/:id/lists','addLists','addBlackLists','put','/:id','update','delete','destroy','removeBlackLists','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','show','getHoppers','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists'];(function(_0x137bb8,_0x506eb7){var _0x24e6ec=function(_0x332c60){while(--_0x332c60){_0x137bb8['push'](_0x137bb8['shift']());}};_0x24e6ec(++_0x506eb7);}(_0x1beb,0x136));var _0xb1be=function(_0xea25be,_0x54130f){_0xea25be=_0xea25be-0x0;var _0x2676b1=_0x1beb[_0xea25be];return _0x2676b1;};'use strict';var multer=require(_0xb1be('0x0'));var util=require('util');var path=require(_0xb1be('0x1'));var timeout=require(_0xb1be('0x2'));var express=require(_0xb1be('0x3'));var router=express[_0xb1be('0x4')]();var fs_extra=require(_0xb1be('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb1be('0x6'));var config=require(_0xb1be('0x7'));var controller=require(_0xb1be('0x8'));router[_0xb1be('0x9')]('/',auth[_0xb1be('0xa')](),controller[_0xb1be('0xb')]);router[_0xb1be('0x9')]('/:id',auth[_0xb1be('0xa')](),controller[_0xb1be('0xc')]);router[_0xb1be('0x9')]('/:id/hoppers',auth[_0xb1be('0xa')](),controller[_0xb1be('0xd')]);router['get']('/:id/hopper_histories',auth[_0xb1be('0xa')](),controller['getHopperHistories']);router[_0xb1be('0x9')]('/:id/hopper_finals',auth[_0xb1be('0xa')](),controller[_0xb1be('0xe')]);router[_0xb1be('0x9')](_0xb1be('0xf'),auth[_0xb1be('0xa')](),controller[_0xb1be('0x10')]);router['get']('/:id/lists',auth[_0xb1be('0xa')](),controller[_0xb1be('0x11')]);router['get'](_0xb1be('0x12'),auth[_0xb1be('0xa')](),controller[_0xb1be('0x13')]);router[_0xb1be('0x14')]('/',auth[_0xb1be('0xa')](),controller['create']);router[_0xb1be('0x14')](_0xb1be('0x15'),auth[_0xb1be('0xa')](),controller[_0xb1be('0x16')]);router[_0xb1be('0x14')](_0xb1be('0x17'),auth['isAuthenticated'](),controller[_0xb1be('0x18')]);router[_0xb1be('0x14')]('/:id/blacklists',auth[_0xb1be('0xa')](),controller[_0xb1be('0x19')]);router[_0xb1be('0x1a')](_0xb1be('0x1b'),auth[_0xb1be('0xa')](),controller[_0xb1be('0x1c')]);router[_0xb1be('0x1d')](_0xb1be('0x1b'),auth['isAuthenticated'](),controller[_0xb1be('0x1e')]);router[_0xb1be('0x1d')](_0xb1be('0x17'),auth[_0xb1be('0xa')](),controller['removeLists']);router['delete']('/:id/blacklists',auth[_0xb1be('0xa')](),controller[_0xb1be('0x1f')]);module[_0xb1be('0x20')]=router; \ No newline at end of file +var _0x2568=['update','delete','destroy','removeLists','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addLists','addBlackLists','put'];(function(_0x5dcf1b,_0x7e6b4d){var _0x7c83=function(_0x2b011a){while(--_0x2b011a){_0x5dcf1b['push'](_0x5dcf1b['shift']());}};_0x7c83(++_0x7e6b4d);}(_0x2568,0x1a8));var _0x8256=function(_0x40d3fc,_0x56b986){_0x40d3fc=_0x40d3fc-0x0;var _0x5ccd67=_0x2568[_0x40d3fc];return _0x5ccd67;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8256('0x0'));var timeout=require(_0x8256('0x1'));var express=require(_0x8256('0x2'));var router=express[_0x8256('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8256('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0x8256('0x5')]('/',auth[_0x8256('0x6')](),controller[_0x8256('0x7')]);router[_0x8256('0x5')](_0x8256('0x8'),auth[_0x8256('0x6')](),controller[_0x8256('0x9')]);router[_0x8256('0x5')]('/:id/hoppers',auth[_0x8256('0x6')](),controller[_0x8256('0xa')]);router[_0x8256('0x5')](_0x8256('0xb'),auth[_0x8256('0x6')](),controller[_0x8256('0xc')]);router[_0x8256('0x5')](_0x8256('0xd'),auth[_0x8256('0x6')](),controller[_0x8256('0xe')]);router['get'](_0x8256('0xf'),auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0x8256('0x5')](_0x8256('0x10'),auth[_0x8256('0x6')](),controller[_0x8256('0x11')]);router[_0x8256('0x5')](_0x8256('0x12'),auth[_0x8256('0x6')](),controller[_0x8256('0x13')]);router[_0x8256('0x14')]('/',auth['isAuthenticated'](),controller[_0x8256('0x15')]);router[_0x8256('0x14')](_0x8256('0x16'),auth['isAuthenticated'](),controller['clone']);router[_0x8256('0x14')](_0x8256('0x10'),auth[_0x8256('0x6')](),controller[_0x8256('0x17')]);router[_0x8256('0x14')](_0x8256('0x12'),auth[_0x8256('0x6')](),controller[_0x8256('0x18')]);router[_0x8256('0x19')](_0x8256('0x8'),auth[_0x8256('0x6')](),controller[_0x8256('0x1a')]);router[_0x8256('0x1b')](_0x8256('0x8'),auth['isAuthenticated'](),controller[_0x8256('0x1c')]);router[_0x8256('0x1b')](_0x8256('0x10'),auth['isAuthenticated'](),controller[_0x8256('0x1d')]);router[_0x8256('0x1b')](_0x8256('0x12'),auth[_0x8256('0x6')](),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 7c77f3b..6a96bf8 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 _0xca5b=['sequelize','exports','STRING','VIRTUAL','key'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca5b,0x14a));var _0xbca5=function(_0x15dafa,_0x3bd9b2){_0x15dafa=_0x15dafa-0x0;var _0x390812=_0xca5b[_0x15dafa];return _0x390812;};'use strict';var Sequelize=require(_0xbca5('0x0'));module[_0xbca5('0x1')]={'key':{'type':Sequelize[_0xbca5('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xbca5('0x2')]},'name':{'type':Sequelize[_0xbca5('0x3')],'get':function(){return this['getDataValue'](_0xbca5('0x4'));}}}; \ No newline at end of file +var _0x397f=['key','sequelize','exports','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x6411e5,_0x47ddb4){var _0x3343f1=function(_0x3a357f){while(--_0x3a357f){_0x6411e5['push'](_0x6411e5['shift']());}};_0x3343f1(++_0x47ddb4);}(_0x397f,0xf6));var _0xf397=function(_0x386cc2,_0x30a175){_0x386cc2=_0x386cc2-0x0;var _0x1ae9ce=_0x397f[_0x386cc2];return _0x1ae9ce;};'use strict';var Sequelize=require(_0xf397('0x0'));module[_0xf397('0x1')]={'key':{'type':Sequelize[_0xf397('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xf397('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xf397('0x4')],'get':function(){return this[_0xf397('0x5')](_0xf397('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 3b3fd33..e64cf38 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 _0x3bfb=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','stack','name','send','CannedAnswer','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','catch','body','find','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x3bfb,0x117));var _0xb3bf=function(_0x1af0e5,_0x152990){_0x1af0e5=_0x1af0e5-0x0;var _0x3c444a=_0x3bfb[_0x1af0e5];return _0x3c444a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb3bf('0x0'));var zipdir=require(_0xb3bf('0x1'));var jsonpatch=require(_0xb3bf('0x2'));var rp=require(_0xb3bf('0x3'));var moment=require(_0xb3bf('0x4'));var BPromise=require(_0xb3bf('0x5'));var Mustache=require(_0xb3bf('0x6'));var util=require(_0xb3bf('0x7'));var path=require(_0xb3bf('0x8'));var sox=require(_0xb3bf('0x9'));var csv=require(_0xb3bf('0xa'));var ejs=require(_0xb3bf('0xb'));var fs=require('fs');var fs_extra=require(_0xb3bf('0xc'));var _=require(_0xb3bf('0xd'));var squel=require(_0xb3bf('0xe'));var crypto=require(_0xb3bf('0xf'));var jsforce=require(_0xb3bf('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xb3bf('0xa'));var querystring=require(_0xb3bf('0x11'));var Papa=require('papaparse');var Redis=require(_0xb3bf('0x12'));var authService=require(_0xb3bf('0x13'));var qs=require(_0xb3bf('0x14'));var as=require(_0xb3bf('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb3bf('0x16'));var utils=require(_0xb3bf('0x17'));var config=require(_0xb3bf('0x18'));var licenseUtil=require(_0xb3bf('0x19'));var db=require(_0xb3bf('0x1a'))['db'];function respondWithStatusCode(_0x4e63d9,_0x9e098a){_0x9e098a=_0x9e098a||0xcc;return function(_0x3f6025){if(_0x3f6025){return _0x4e63d9[_0xb3bf('0x1b')](_0x9e098a);}return _0x4e63d9[_0xb3bf('0x1c')](_0x9e098a)[_0xb3bf('0x1d')]();};}function respondWithResult(_0x1a2729,_0x2bad13){_0x2bad13=_0x2bad13||0xc8;return function(_0x525399){if(_0x525399){return _0x1a2729['status'](_0x2bad13)[_0xb3bf('0x1e')](_0x525399);}};}function respondWithFilteredResult(_0x1f03c9,_0x41db85){return function(_0x3fc33e){if(_0x3fc33e){var _0x435616=typeof _0x41db85[_0xb3bf('0x1f')]===_0xb3bf('0x20')&&typeof _0x41db85[_0xb3bf('0x21')]===_0xb3bf('0x20');var _0x573cca=_0x3fc33e[_0xb3bf('0x22')];var _0x2197c4=_0x435616?0x0:_0x41db85[_0xb3bf('0x1f')];var _0xd152b3=_0x435616?_0x3fc33e[_0xb3bf('0x22')]:_0x41db85[_0xb3bf('0x1f')]+_0x41db85[_0xb3bf('0x21')];var _0x35a440;if(_0xd152b3>=_0x573cca){_0xd152b3=_0x573cca;_0x35a440=0xc8;}else{_0x35a440=0xce;}_0x1f03c9[_0xb3bf('0x1c')](_0x35a440);return _0x1f03c9[_0xb3bf('0x23')](_0xb3bf('0x24'),_0x2197c4+'-'+_0xd152b3+'/'+_0x573cca)[_0xb3bf('0x1e')](_0x3fc33e);}return null;};}function patchUpdates(_0x1255f2){return function(_0x1fc0d5){try{jsonpatch['apply'](_0x1fc0d5,_0x1255f2,!![]);}catch(_0x12b0d8){return BPromise[_0xb3bf('0x25')](_0x12b0d8);}return _0x1fc0d5[_0xb3bf('0x26')]();};}function saveUpdates(_0xebadb6,_0xa7a19c){return function(_0x540ed9){if(_0x540ed9){return _0x540ed9[_0xb3bf('0x27')](_0xebadb6)[_0xb3bf('0x28')](function(_0x3e01bb){return _0x3e01bb;});}return null;};}function removeEntity(_0xd84e47,_0x2110fe){return function(_0x9f8e5c){if(_0x9f8e5c){return _0x9f8e5c[_0xb3bf('0x29')]()[_0xb3bf('0x28')](function(){var _0x1aba22=_0x9f8e5c[_0xb3bf('0x2a')]({'plain':!![]});var _0x5a318f=_0xb3bf('0x2b');return db[_0xb3bf('0x2c')][_0xb3bf('0x29')]({'where':{'type':_0x5a318f,'resourceId':_0x1aba22['id']}})['then'](function(){return _0x9f8e5c;});})[_0xb3bf('0x28')](function(){_0xd84e47[_0xb3bf('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38aa51,_0x12b162){return function(_0x5dfe32){if(!_0x5dfe32){_0x38aa51[_0xb3bf('0x1b')](0x194);}return _0x5dfe32;};}function handleError(_0x4e208b,_0x174291){_0x174291=_0x174291||0x1f4;return function(_0x45524a){logger['error'](_0x45524a[_0xb3bf('0x2d')]);if(_0x45524a['name']){delete _0x45524a[_0xb3bf('0x2e')];}_0x4e208b[_0xb3bf('0x1c')](_0x174291)[_0xb3bf('0x2f')](_0x45524a);};}exports['index']=function(_0x48f982,_0x12a9d1){var _0x3aec7c={},_0x27adfb={},_0x4bd698={'count':0x0,'rows':[]};var _0x517319=_['map'](db[_0xb3bf('0x30')][_0xb3bf('0x31')],function(_0x40ac9b){return{'name':_0x40ac9b[_0xb3bf('0x32')],'type':_0x40ac9b[_0xb3bf('0x33')][_0xb3bf('0x34')]};});_0x27adfb[_0xb3bf('0x35')]=_[_0xb3bf('0x36')](_0x517319,'name');_0x27adfb[_0xb3bf('0x37')]=_[_0xb3bf('0x38')](_0x48f982['query']);_0x27adfb[_0xb3bf('0x39')]=_[_0xb3bf('0x3a')](_0x27adfb['model'],_0x27adfb[_0xb3bf('0x37')]);_0x3aec7c[_0xb3bf('0x3b')]=_[_0xb3bf('0x3a')](_0x27adfb[_0xb3bf('0x35')],qs[_0xb3bf('0x3c')](_0x48f982[_0xb3bf('0x37')]['fields']));_0x3aec7c['attributes']=_0x3aec7c[_0xb3bf('0x3b')][_0xb3bf('0x3d')]?_0x3aec7c[_0xb3bf('0x3b')]:_0x27adfb[_0xb3bf('0x35')];if(!_0x48f982[_0xb3bf('0x37')][_0xb3bf('0x3e')](_0xb3bf('0x3f'))){_0x3aec7c['limit']=qs[_0xb3bf('0x21')](_0x48f982[_0xb3bf('0x37')][_0xb3bf('0x21')]);_0x3aec7c[_0xb3bf('0x1f')]=qs[_0xb3bf('0x1f')](_0x48f982['query']['offset']);}_0x3aec7c[_0xb3bf('0x40')]=qs[_0xb3bf('0x41')](_0x48f982['query']['sort']);_0x3aec7c[_0xb3bf('0x42')]=qs[_0xb3bf('0x39')](_['pick'](_0x48f982[_0xb3bf('0x37')],_0x27adfb['filters']),_0x517319);if(_0x48f982['query'][_0xb3bf('0x43')]){_0x3aec7c['where']=_['merge'](_0x3aec7c[_0xb3bf('0x42')],{'$or':[{'key':{'$like':'%'+_0x48f982['query'][_0xb3bf('0x43')]+'%'}},{'value':{'$like':'%'+_0x48f982['query'][_0xb3bf('0x43')]+'%'}}]});}_0x3aec7c=_[_0xb3bf('0x44')]({},_0x3aec7c,_0x48f982[_0xb3bf('0x45')]);var _0x27f0dc={'where':_0x3aec7c[_0xb3bf('0x42')]};return db['CannedAnswer'][_0xb3bf('0x22')](_0x27f0dc)[_0xb3bf('0x28')](function(_0x1aa5ff){_0x4bd698[_0xb3bf('0x22')]=_0x1aa5ff;if(_0x48f982[_0xb3bf('0x37')][_0xb3bf('0x46')]){_0x3aec7c[_0xb3bf('0x47')]=[{'all':!![]}];}return db[_0xb3bf('0x30')][_0xb3bf('0x48')](_0x3aec7c);})[_0xb3bf('0x28')](function(_0x368df6){_0x4bd698[_0xb3bf('0x49')]=_0x368df6;return _0x4bd698;})[_0xb3bf('0x28')](respondWithFilteredResult(_0x12a9d1,_0x3aec7c))['catch'](handleError(_0x12a9d1,null));};exports[_0xb3bf('0x4a')]=function(_0x1faa4d,_0x2125f1){var _0x2a484b={'raw':!![],'where':{'id':_0x1faa4d['params']['id']}},_0x1ef3aa={};_0x1ef3aa[_0xb3bf('0x35')]=_['keys'](db[_0xb3bf('0x30')][_0xb3bf('0x31')]);_0x1ef3aa[_0xb3bf('0x37')]=_[_0xb3bf('0x38')](_0x1faa4d[_0xb3bf('0x37')]);_0x1ef3aa[_0xb3bf('0x39')]=_[_0xb3bf('0x3a')](_0x1ef3aa[_0xb3bf('0x35')],_0x1ef3aa['query']);_0x2a484b[_0xb3bf('0x3b')]=_[_0xb3bf('0x3a')](_0x1ef3aa[_0xb3bf('0x35')],qs[_0xb3bf('0x3c')](_0x1faa4d[_0xb3bf('0x37')]['fields']));_0x2a484b['attributes']=_0x2a484b[_0xb3bf('0x3b')][_0xb3bf('0x3d')]?_0x2a484b[_0xb3bf('0x3b')]:_0x1ef3aa[_0xb3bf('0x35')];if(_0x1faa4d[_0xb3bf('0x37')]['includeAll']){_0x2a484b[_0xb3bf('0x47')]=[{'all':!![]}];}_0x2a484b=_[_0xb3bf('0x44')]({},_0x2a484b,_0x1faa4d[_0xb3bf('0x45')]);return db[_0xb3bf('0x30')]['find'](_0x2a484b)[_0xb3bf('0x28')](handleEntityNotFound(_0x2125f1,null))['then'](respondWithResult(_0x2125f1,null))[_0xb3bf('0x4b')](handleError(_0x2125f1,null));};exports[_0xb3bf('0x27')]=function(_0x396d6c,_0x3c486d){if(_0x396d6c['body']['id']){delete _0x396d6c[_0xb3bf('0x4c')]['id'];}return db[_0xb3bf('0x30')][_0xb3bf('0x4d')]({'where':{'id':_0x396d6c[_0xb3bf('0x4e')]['id']}})[_0xb3bf('0x28')](handleEntityNotFound(_0x3c486d,null))[_0xb3bf('0x28')](saveUpdates(_0x396d6c['body'],null))[_0xb3bf('0x28')](respondWithResult(_0x3c486d,null))[_0xb3bf('0x4b')](handleError(_0x3c486d,null));};exports['destroy']=function(_0x47ca90,_0x34504e){return db[_0xb3bf('0x30')][_0xb3bf('0x4d')]({'where':{'id':_0x47ca90[_0xb3bf('0x4e')]['id']}})[_0xb3bf('0x28')](handleEntityNotFound(_0x34504e,null))[_0xb3bf('0x28')](removeEntity(_0x34504e,null))[_0xb3bf('0x4b')](handleError(_0x34504e,null));};exports[_0xb3bf('0x4f')]=function(_0x286ee5,_0x47ee1f){var _0x45d2fb={'key':_0x286ee5[_0xb3bf('0x4c')]['key']};if(_0x286ee5[_0xb3bf('0x4c')]['MailAccountId']){_0x45d2fb[_0xb3bf('0x50')]=_0x286ee5[_0xb3bf('0x4c')][_0xb3bf('0x50')];}else if(_0x286ee5['body']['SmsAccountId']){_0x45d2fb[_0xb3bf('0x51')]=_0x286ee5[_0xb3bf('0x4c')][_0xb3bf('0x51')];}else if(_0x286ee5[_0xb3bf('0x4c')]['OpenchannelAccountId']){_0x45d2fb['OpenchannelAccountId']=_0x286ee5[_0xb3bf('0x4c')][_0xb3bf('0x52')];}else if(_0x286ee5['body']['ChatWebsiteId']){_0x45d2fb[_0xb3bf('0x53')]=_0x286ee5[_0xb3bf('0x4c')]['ChatWebsiteId'];}return db['CannedAnswer'][_0xb3bf('0x4d')]({'where':_0x45d2fb})[_0xb3bf('0x28')](function(_0xf3d2d1){if(_0xf3d2d1){throw new db[(_0xb3bf('0x54'))][(_0xb3bf('0x55'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xb3bf('0x30')][_0xb3bf('0x4f')](_0x286ee5[_0xb3bf('0x4c')]);})['then'](function(_0x5ae017){var _0x6fdf07=_0x286ee5['user']['get']({'plain':!![]});if(!_0x6fdf07)throw new Error(_0xb3bf('0x56'));if(_0x6fdf07[_0xb3bf('0x57')]==='user'){var _0x46700c=_0x5ae017[_0xb3bf('0x2a')]({'plain':!![]});return db[_0xb3bf('0x58')][_0xb3bf('0x4d')]({'where':{'name':_0xb3bf('0x2b'),'userProfileId':_0x6fdf07[_0xb3bf('0x59')]},'raw':!![]})['then'](function(_0x12c33b){if(_0x12c33b&&_0x12c33b[_0xb3bf('0x5a')]===0x0){return db['UserProfileResource'][_0xb3bf('0x4f')]({'name':_0x46700c['name'],'resourceId':_0x46700c['id'],'type':_0x12c33b[_0xb3bf('0x2e')],'sectionId':_0x12c33b['id']},{})[_0xb3bf('0x28')](function(){return _0x5ae017;});}else{return _0x5ae017;}})[_0xb3bf('0x4b')](function(_0x29edf3){logger[_0xb3bf('0x5b')](_0xb3bf('0x5c'),_0x29edf3);throw _0x29edf3;});}return _0x5ae017;})[_0xb3bf('0x28')](respondWithResult(_0x47ee1f,0xc9))[_0xb3bf('0x4b')](handleError(_0x47ee1f,null));}; \ No newline at end of file +var _0xff24=['role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','error','stack','name','send','index','map','CannedAnswer','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','catch','keys','rawAttributes','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x5b0909,_0x71dc3d){var _0x59b22c=function(_0x71b0b6){while(--_0x71b0b6){_0x5b0909['push'](_0x5b0909['shift']());}};_0x59b22c(++_0x71dc3d);}(_0xff24,0xb6));var _0x4ff2=function(_0x1963c8,_0x2e3ced){_0x1963c8=_0x1963c8-0x0;var _0x51ea58=_0xff24[_0x1963c8];return _0x51ea58;};'use strict';var emlformat=require(_0x4ff2('0x0'));var rimraf=require(_0x4ff2('0x1'));var zipdir=require(_0x4ff2('0x2'));var jsonpatch=require(_0x4ff2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4ff2('0x4'));var Mustache=require('mustache');var util=require(_0x4ff2('0x5'));var path=require(_0x4ff2('0x6'));var sox=require(_0x4ff2('0x7'));var csv=require('to-csv');var ejs=require(_0x4ff2('0x8'));var fs=require('fs');var fs_extra=require(_0x4ff2('0x9'));var _=require(_0x4ff2('0xa'));var squel=require('squel');var crypto=require(_0x4ff2('0xb'));var jsforce=require(_0x4ff2('0xc'));var deskjs=require(_0x4ff2('0xd'));var toCsv=require(_0x4ff2('0xe'));var querystring=require(_0x4ff2('0xf'));var Papa=require(_0x4ff2('0x10'));var Redis=require(_0x4ff2('0x11'));var authService=require(_0x4ff2('0x12'));var qs=require(_0x4ff2('0x13'));var as=require(_0x4ff2('0x14'));var hardwareService=require(_0x4ff2('0x15'));var logger=require(_0x4ff2('0x16'))('api');var utils=require(_0x4ff2('0x17'));var config=require(_0x4ff2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4ff2('0x19'))['db'];function respondWithStatusCode(_0x1ff4e4,_0x4d08cf){_0x4d08cf=_0x4d08cf||0xcc;return function(_0x354b95){if(_0x354b95){return _0x1ff4e4[_0x4ff2('0x1a')](_0x4d08cf);}return _0x1ff4e4['status'](_0x4d08cf)[_0x4ff2('0x1b')]();};}function respondWithResult(_0x45b21a,_0xbd80a7){_0xbd80a7=_0xbd80a7||0xc8;return function(_0x3d34ad){if(_0x3d34ad){return _0x45b21a[_0x4ff2('0x1c')](_0xbd80a7)[_0x4ff2('0x1d')](_0x3d34ad);}};}function respondWithFilteredResult(_0x82ec2e,_0x384e46){return function(_0x192c8b){if(_0x192c8b){var _0x374be6=typeof _0x384e46[_0x4ff2('0x1e')]===_0x4ff2('0x1f')&&typeof _0x384e46['limit']===_0x4ff2('0x1f');var _0x600fb5=_0x192c8b[_0x4ff2('0x20')];var _0x4de624=_0x374be6?0x0:_0x384e46[_0x4ff2('0x1e')];var _0x277bf1=_0x374be6?_0x192c8b[_0x4ff2('0x20')]:_0x384e46[_0x4ff2('0x1e')]+_0x384e46[_0x4ff2('0x21')];var _0xf23e9d;if(_0x277bf1>=_0x600fb5){_0x277bf1=_0x600fb5;_0xf23e9d=0xc8;}else{_0xf23e9d=0xce;}_0x82ec2e[_0x4ff2('0x1c')](_0xf23e9d);return _0x82ec2e['set'](_0x4ff2('0x22'),_0x4de624+'-'+_0x277bf1+'/'+_0x600fb5)[_0x4ff2('0x1d')](_0x192c8b);}return null;};}function patchUpdates(_0x506014){return function(_0x5ed8f0){try{jsonpatch[_0x4ff2('0x23')](_0x5ed8f0,_0x506014,!![]);}catch(_0x356e2a){return BPromise[_0x4ff2('0x24')](_0x356e2a);}return _0x5ed8f0[_0x4ff2('0x25')]();};}function saveUpdates(_0x15f2be,_0x1b0a5e){return function(_0x9d1d3d){if(_0x9d1d3d){return _0x9d1d3d[_0x4ff2('0x26')](_0x15f2be)[_0x4ff2('0x27')](function(_0x55d0c3){return _0x55d0c3;});}return null;};}function removeEntity(_0x398293,_0x1f83cf){return function(_0x270e28){if(_0x270e28){return _0x270e28[_0x4ff2('0x28')]()['then'](function(){var _0x185200=_0x270e28[_0x4ff2('0x29')]({'plain':!![]});var _0x5a6cd0=_0x4ff2('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x5a6cd0,'resourceId':_0x185200['id']}})['then'](function(){return _0x270e28;});})[_0x4ff2('0x27')](function(){_0x398293[_0x4ff2('0x1c')](0xcc)[_0x4ff2('0x1b')]();});}};}function handleEntityNotFound(_0x25486e,_0x5e3c42){return function(_0xa99bf2){if(!_0xa99bf2){_0x25486e[_0x4ff2('0x1a')](0x194);}return _0xa99bf2;};}function handleError(_0x5bbe63,_0x53ef43){_0x53ef43=_0x53ef43||0x1f4;return function(_0x2ed831){logger[_0x4ff2('0x2b')](_0x2ed831[_0x4ff2('0x2c')]);if(_0x2ed831['name']){delete _0x2ed831[_0x4ff2('0x2d')];}_0x5bbe63[_0x4ff2('0x1c')](_0x53ef43)[_0x4ff2('0x2e')](_0x2ed831);};}exports[_0x4ff2('0x2f')]=function(_0x1abfe7,_0xdfd7f1){var _0x15dc54={},_0x1c112e={},_0x317c9a={'count':0x0,'rows':[]};var _0x2081a0=_[_0x4ff2('0x30')](db[_0x4ff2('0x31')]['rawAttributes'],function(_0x4f84f4){return{'name':_0x4f84f4[_0x4ff2('0x32')],'type':_0x4f84f4[_0x4ff2('0x33')][_0x4ff2('0x34')]};});_0x1c112e[_0x4ff2('0x35')]=_['map'](_0x2081a0,_0x4ff2('0x2d'));_0x1c112e[_0x4ff2('0x36')]=_['keys'](_0x1abfe7['query']);_0x1c112e[_0x4ff2('0x37')]=_['intersection'](_0x1c112e[_0x4ff2('0x35')],_0x1c112e[_0x4ff2('0x36')]);_0x15dc54[_0x4ff2('0x38')]=_[_0x4ff2('0x39')](_0x1c112e[_0x4ff2('0x35')],qs[_0x4ff2('0x3a')](_0x1abfe7[_0x4ff2('0x36')][_0x4ff2('0x3a')]));_0x15dc54[_0x4ff2('0x38')]=_0x15dc54[_0x4ff2('0x38')][_0x4ff2('0x3b')]?_0x15dc54[_0x4ff2('0x38')]:_0x1c112e[_0x4ff2('0x35')];if(!_0x1abfe7[_0x4ff2('0x36')][_0x4ff2('0x3c')](_0x4ff2('0x3d'))){_0x15dc54[_0x4ff2('0x21')]=qs[_0x4ff2('0x21')](_0x1abfe7[_0x4ff2('0x36')][_0x4ff2('0x21')]);_0x15dc54[_0x4ff2('0x1e')]=qs[_0x4ff2('0x1e')](_0x1abfe7['query'][_0x4ff2('0x1e')]);}_0x15dc54[_0x4ff2('0x3e')]=qs[_0x4ff2('0x3f')](_0x1abfe7[_0x4ff2('0x36')][_0x4ff2('0x3f')]);_0x15dc54[_0x4ff2('0x40')]=qs[_0x4ff2('0x37')](_[_0x4ff2('0x41')](_0x1abfe7[_0x4ff2('0x36')],_0x1c112e[_0x4ff2('0x37')]),_0x2081a0);if(_0x1abfe7[_0x4ff2('0x36')][_0x4ff2('0x42')]){_0x15dc54['where']=_['merge'](_0x15dc54[_0x4ff2('0x40')],{'$or':[{'key':{'$like':'%'+_0x1abfe7[_0x4ff2('0x36')]['filter']+'%'}},{'value':{'$like':'%'+_0x1abfe7[_0x4ff2('0x36')]['filter']+'%'}}]});}_0x15dc54=_[_0x4ff2('0x43')]({},_0x15dc54,_0x1abfe7[_0x4ff2('0x44')]);var _0x228490={'where':_0x15dc54[_0x4ff2('0x40')]};return db['CannedAnswer'][_0x4ff2('0x20')](_0x228490)[_0x4ff2('0x27')](function(_0xd4b261){_0x317c9a['count']=_0xd4b261;if(_0x1abfe7['query']['includeAll']){_0x15dc54[_0x4ff2('0x45')]=[{'all':!![]}];}return db[_0x4ff2('0x31')]['findAll'](_0x15dc54);})[_0x4ff2('0x27')](function(_0x378206){_0x317c9a[_0x4ff2('0x46')]=_0x378206;return _0x317c9a;})[_0x4ff2('0x27')](respondWithFilteredResult(_0xdfd7f1,_0x15dc54))[_0x4ff2('0x47')](handleError(_0xdfd7f1,null));};exports['show']=function(_0x357d28,_0x10ace0){var _0x23a9e4={'raw':!![],'where':{'id':_0x357d28['params']['id']}},_0x2a12ea={};_0x2a12ea[_0x4ff2('0x35')]=_[_0x4ff2('0x48')](db['CannedAnswer'][_0x4ff2('0x49')]);_0x2a12ea[_0x4ff2('0x36')]=_[_0x4ff2('0x48')](_0x357d28[_0x4ff2('0x36')]);_0x2a12ea['filters']=_[_0x4ff2('0x39')](_0x2a12ea['model'],_0x2a12ea[_0x4ff2('0x36')]);_0x23a9e4['attributes']=_[_0x4ff2('0x39')](_0x2a12ea[_0x4ff2('0x35')],qs[_0x4ff2('0x3a')](_0x357d28[_0x4ff2('0x36')][_0x4ff2('0x3a')]));_0x23a9e4[_0x4ff2('0x38')]=_0x23a9e4[_0x4ff2('0x38')][_0x4ff2('0x3b')]?_0x23a9e4[_0x4ff2('0x38')]:_0x2a12ea[_0x4ff2('0x35')];if(_0x357d28[_0x4ff2('0x36')]['includeAll']){_0x23a9e4[_0x4ff2('0x45')]=[{'all':!![]}];}_0x23a9e4=_[_0x4ff2('0x43')]({},_0x23a9e4,_0x357d28[_0x4ff2('0x44')]);return db['CannedAnswer'][_0x4ff2('0x4a')](_0x23a9e4)[_0x4ff2('0x27')](handleEntityNotFound(_0x10ace0,null))[_0x4ff2('0x27')](respondWithResult(_0x10ace0,null))['catch'](handleError(_0x10ace0,null));};exports['update']=function(_0x4610da,_0x165d3c){if(_0x4610da[_0x4ff2('0x4b')]['id']){delete _0x4610da[_0x4ff2('0x4b')]['id'];}return db[_0x4ff2('0x31')][_0x4ff2('0x4a')]({'where':{'id':_0x4610da['params']['id']}})[_0x4ff2('0x27')](handleEntityNotFound(_0x165d3c,null))[_0x4ff2('0x27')](saveUpdates(_0x4610da['body'],null))[_0x4ff2('0x27')](respondWithResult(_0x165d3c,null))[_0x4ff2('0x47')](handleError(_0x165d3c,null));};exports[_0x4ff2('0x28')]=function(_0x41eb0e,_0x3eb2cb){return db['CannedAnswer'][_0x4ff2('0x4a')]({'where':{'id':_0x41eb0e['params']['id']}})['then'](handleEntityNotFound(_0x3eb2cb,null))[_0x4ff2('0x27')](removeEntity(_0x3eb2cb,null))[_0x4ff2('0x47')](handleError(_0x3eb2cb,null));};exports[_0x4ff2('0x4c')]=function(_0x8a4a4,_0x523ad4){var _0x2819c0={'key':_0x8a4a4[_0x4ff2('0x4b')][_0x4ff2('0x34')]};if(_0x8a4a4[_0x4ff2('0x4b')][_0x4ff2('0x4d')]){_0x2819c0['MailAccountId']=_0x8a4a4[_0x4ff2('0x4b')]['MailAccountId'];}else if(_0x8a4a4[_0x4ff2('0x4b')][_0x4ff2('0x4e')]){_0x2819c0[_0x4ff2('0x4e')]=_0x8a4a4[_0x4ff2('0x4b')]['SmsAccountId'];}else if(_0x8a4a4[_0x4ff2('0x4b')]['OpenchannelAccountId']){_0x2819c0[_0x4ff2('0x4f')]=_0x8a4a4[_0x4ff2('0x4b')][_0x4ff2('0x4f')];}else if(_0x8a4a4[_0x4ff2('0x4b')]['ChatWebsiteId']){_0x2819c0[_0x4ff2('0x50')]=_0x8a4a4[_0x4ff2('0x4b')]['ChatWebsiteId'];}return db[_0x4ff2('0x31')][_0x4ff2('0x4a')]({'where':_0x2819c0})['then'](function(_0x1534bf){if(_0x1534bf){throw new db[(_0x4ff2('0x51'))]['ValidationError'](_0x4ff2('0x52'));}return db[_0x4ff2('0x31')][_0x4ff2('0x4c')](_0x8a4a4['body']);})[_0x4ff2('0x27')](function(_0x50014f){var _0x1922ec=_0x8a4a4[_0x4ff2('0x53')]['get']({'plain':!![]});if(!_0x1922ec)throw new Error(_0x4ff2('0x54'));if(_0x1922ec[_0x4ff2('0x55')]===_0x4ff2('0x53')){var _0x121fe8=_0x50014f[_0x4ff2('0x29')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x4ff2('0x2a'),'userProfileId':_0x1922ec[_0x4ff2('0x56')]},'raw':!![]})['then'](function(_0x5165de){if(_0x5165de&&_0x5165de['autoAssociation']===0x0){return db[_0x4ff2('0x57')][_0x4ff2('0x4c')]({'name':_0x121fe8[_0x4ff2('0x2d')],'resourceId':_0x121fe8['id'],'type':_0x5165de[_0x4ff2('0x2d')],'sectionId':_0x5165de['id']},{})[_0x4ff2('0x27')](function(){return _0x50014f;});}else{return _0x50014f;}})[_0x4ff2('0x47')](function(_0x3f2670){logger[_0x4ff2('0x2b')](_0x4ff2('0x58'),_0x3f2670);throw _0x3f2670;});}return _0x50014f;})[_0x4ff2('0x27')](respondWithResult(_0x523ad4,0xc9))['catch'](handleError(_0x523ad4,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 3e793e9..03e66ee 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 _0x2843=['../../config/logger','api','moment','bluebird','path','../../config/environment','./cannedAnswer.attributes','exports','define','utf8mb4','lodash','util'];(function(_0x2dce9f,_0x1d1880){var _0x1cd454=function(_0x2a909c){while(--_0x2a909c){_0x2dce9f['push'](_0x2dce9f['shift']());}};_0x1cd454(++_0x1d1880);}(_0x2843,0x6a));var _0x3284=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0x2843[_0x3a9661];return _0x5bb119;};'use strict';var _=require(_0x3284('0x0'));var util=require(_0x3284('0x1'));var logger=require(_0x3284('0x2'))(_0x3284('0x3'));var moment=require(_0x3284('0x4'));var BPromise=require(_0x3284('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3284('0x6'));var rimraf=require('rimraf');var config=require(_0x3284('0x7'));var attributes=require(_0x3284('0x8'));module[_0x3284('0x9')]=function(_0x1cd1dc,_0x442bff){return _0x1cd1dc[_0x3284('0xa')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3284('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4ce6=['moment','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x5c91b1,_0x1eeb65){var _0xbce0ff=function(_0x181dd6){while(--_0x181dd6){_0x5c91b1['push'](_0x5c91b1['shift']());}};_0xbce0ff(++_0x1eeb65);}(_0x4ce6,0x15a));var _0x64ce=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0x4ce6[_0x725a4c];return _0x37b2cc;};'use strict';var _=require(_0x64ce('0x0'));var util=require(_0x64ce('0x1'));var logger=require(_0x64ce('0x2'))(_0x64ce('0x3'));var moment=require(_0x64ce('0x4'));var BPromise=require('bluebird');var rp=require(_0x64ce('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x64ce('0x6'));var config=require(_0x64ce('0x7'));var attributes=require(_0x64ce('0x8'));module[_0x64ce('0x9')]=function(_0x8c1982,_0x50898d){return _0x8c1982[_0x64ce('0xa')]('CannedAnswer',attributes,{'tableName':_0x64ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x64ce('0xc'),'collate':_0x64ce('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index df75178..2ddad78 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 _0xa76c=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa76c,0x171));var _0xca76=function(_0x530db1,_0x2b9531){_0x530db1=_0x530db1-0x0;var _0x31c1f2=_0xa76c[_0x530db1];return _0x31c1f2;};'use strict';var _=require(_0xca76('0x0'));var util=require(_0xca76('0x1'));var moment=require(_0xca76('0x2'));var BPromise=require(_0xca76('0x3'));var rs=require(_0xca76('0x4'));var fs=require('fs');var Redis=require(_0xca76('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xca76('0x6'));var logger=require('../../config/logger')(_0xca76('0x7'));var config=require(_0xca76('0x8'));var jayson=require(_0xca76('0x9'));var client=jayson[_0xca76('0xa')][_0xca76('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f29a6,_0x11d288,_0x183ca9){return new BPromise(function(_0x50c45a,_0xae4c09){return client[_0xca76('0xc')](_0x5f29a6,_0x183ca9)[_0xca76('0xd')](function(_0x2bac51){logger[_0xca76('0xe')](_0xca76('0xf'),_0x11d288,_0xca76('0x10'));logger[_0xca76('0x11')](_0xca76('0x12'),_0x11d288,_0xca76('0x10'),JSON[_0xca76('0x13')](_0x2bac51));if(_0x2bac51[_0xca76('0x14')]){if(_0x2bac51[_0xca76('0x14')]['code']===0x1f4){logger[_0xca76('0x14')](_0xca76('0xf'),_0x11d288,_0x2bac51[_0xca76('0x14')][_0xca76('0x15')]);return _0xae4c09(_0x2bac51[_0xca76('0x14')][_0xca76('0x15')]);}logger['error']('CannedAnswer,\x20%s,\x20%s',_0x11d288,_0x2bac51[_0xca76('0x14')][_0xca76('0x15')]);return _0x50c45a(_0x2bac51[_0xca76('0x14')]['message']);}else{logger[_0xca76('0xe')]('CannedAnswer,\x20%s,\x20%s',_0x11d288,_0xca76('0x10'));_0x50c45a(_0x2bac51['result'][_0xca76('0x15')]);}})[_0xca76('0x16')](function(_0x4a2b65){logger[_0xca76('0x14')](_0xca76('0xf'),_0x11d288,_0x4a2b65);_0xae4c09(_0x4a2b65);});});} \ No newline at end of file +var _0xc25d=['then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request'];(function(_0x304655,_0x15b109){var _0x2fa58a=function(_0x7d144){while(--_0x7d144){_0x304655['push'](_0x304655['shift']());}};_0x2fa58a(++_0x15b109);}(_0xc25d,0x9e));var _0xdc25=function(_0xd02bb,_0x26e2d0){_0xd02bb=_0xd02bb-0x0;var _0x1cdf23=_0xc25d[_0xd02bb];return _0x1cdf23;};'use strict';var _=require(_0xdc25('0x0'));var util=require(_0xdc25('0x1'));var moment=require(_0xdc25('0x2'));var BPromise=require('bluebird');var rs=require(_0xdc25('0x3'));var fs=require('fs');var Redis=require(_0xdc25('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc25('0x5'));var logger=require('../../config/logger')(_0xdc25('0x6'));var config=require(_0xdc25('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdc25('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c1178,_0x3dc5b3,_0x3523fc){return new BPromise(function(_0x32d65d,_0x50d9c0){return client[_0xdc25('0x9')](_0x4c1178,_0x3523fc)[_0xdc25('0xa')](function(_0x362bb5){logger[_0xdc25('0xb')](_0xdc25('0xc'),_0x3dc5b3,_0xdc25('0xd'));logger[_0xdc25('0xe')](_0xdc25('0xf'),_0x3dc5b3,_0xdc25('0xd'),JSON['stringify'](_0x362bb5));if(_0x362bb5[_0xdc25('0x10')]){if(_0x362bb5[_0xdc25('0x10')][_0xdc25('0x11')]===0x1f4){logger[_0xdc25('0x10')](_0xdc25('0xc'),_0x3dc5b3,_0x362bb5[_0xdc25('0x10')][_0xdc25('0x12')]);return _0x50d9c0(_0x362bb5[_0xdc25('0x10')]['message']);}logger[_0xdc25('0x10')](_0xdc25('0xc'),_0x3dc5b3,_0x362bb5[_0xdc25('0x10')][_0xdc25('0x12')]);return _0x32d65d(_0x362bb5[_0xdc25('0x10')][_0xdc25('0x12')]);}else{logger[_0xdc25('0xb')](_0xdc25('0xc'),_0x3dc5b3,'request\x20sent');_0x32d65d(_0x362bb5[_0xdc25('0x13')][_0xdc25('0x12')]);}})[_0xdc25('0x14')](function(_0x43fe69){logger[_0xdc25('0x10')](_0xdc25('0xc'),_0x3dc5b3,_0x43fe69);_0x50d9c0(_0x43fe69);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 32189fe..e678f4c 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 _0x4013=['/:id','show','create','put','update','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','isAuthenticated'];(function(_0x4f5346,_0x3ab289){var _0x4dbc28=function(_0x4d9abf){while(--_0x4d9abf){_0x4f5346['push'](_0x4f5346['shift']());}};_0x4dbc28(++_0x3ab289);}(_0x4013,0x108));var _0x3401=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x4013[_0x580576];return _0x3f55a0;};'use strict';var multer=require('multer');var util=require(_0x3401('0x0'));var path=require(_0x3401('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3401('0x2')]();var fs_extra=require(_0x3401('0x3'));var auth=require(_0x3401('0x4'));var interaction=require(_0x3401('0x5'));var config=require('../../config/environment');var controller=require(_0x3401('0x6'));router['get']('/',auth[_0x3401('0x7')](),controller['index']);router['get'](_0x3401('0x8'),auth[_0x3401('0x7')](),controller[_0x3401('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3401('0xa')]);router[_0x3401('0xb')](_0x3401('0x8'),auth[_0x3401('0x7')](),controller[_0x3401('0xc')]);router[_0x3401('0xd')](_0x3401('0x8'),auth[_0x3401('0x7')](),controller[_0x3401('0xe')]);module[_0x3401('0xf')]=router; \ No newline at end of file +var _0xbe19=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x608732,_0x167853){var _0x312df5=function(_0x381f07){while(--_0x381f07){_0x608732['push'](_0x608732['shift']());}};_0x312df5(++_0x167853);}(_0xbe19,0xd1));var _0x9be1=function(_0x2e0214,_0x20d86b){_0x2e0214=_0x2e0214-0x0;var _0x35932c=_0xbe19[_0x2e0214];return _0x35932c;};'use strict';var multer=require(_0x9be1('0x0'));var util=require(_0x9be1('0x1'));var path=require(_0x9be1('0x2'));var timeout=require(_0x9be1('0x3'));var express=require(_0x9be1('0x4'));var router=express[_0x9be1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9be1('0x6'));var interaction=require(_0x9be1('0x7'));var config=require(_0x9be1('0x8'));var controller=require(_0x9be1('0x9'));router[_0x9be1('0xa')]('/',auth[_0x9be1('0xb')](),controller[_0x9be1('0xc')]);router[_0x9be1('0xa')](_0x9be1('0xd'),auth[_0x9be1('0xb')](),controller[_0x9be1('0xe')]);router[_0x9be1('0xf')]('/',auth[_0x9be1('0xb')](),controller[_0x9be1('0x10')]);router['put'](_0x9be1('0xd'),auth[_0x9be1('0xb')](),controller[_0x9be1('0x11')]);router[_0x9be1('0x12')](_0x9be1('0xd'),auth['isAuthenticated'](),controller[_0x9be1('0x13')]);module[_0x9be1('0x14')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 7ad5c3c..330113b 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 _0x54e1=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x1dae49,_0x29b350){var _0x5e3f5a=function(_0x4f1682){while(--_0x4f1682){_0x1dae49['push'](_0x1dae49['shift']());}};_0x5e3f5a(++_0x29b350);}(_0x54e1,0x15d));var _0x154e=function(_0x1120e3,_0x2c6eac){_0x1120e3=_0x1120e3-0x0;var _0xe2d695=_0x54e1[_0x1120e3];return _0xe2d695;};'use strict';var Sequelize=require('sequelize');module[_0x154e('0x0')]={'calldate':{'type':Sequelize[_0x154e('0x1')],'allowNull':![],'defaultValue':_0x154e('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x154e('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x154e('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x154e('0x3')]},'lastdata':{'type':Sequelize[_0x154e('0x3')]},'duration':{'type':Sequelize[_0x154e('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x154e('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x154e('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x154e('0x3')]},'uniqueid':{'type':Sequelize[_0x154e('0x3')]},'linkedid':{'type':Sequelize[_0x154e('0x3')]},'sequence':{'type':Sequelize[_0x154e('0x3')]},'peeraccount':{'type':Sequelize[_0x154e('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x154e('0x3')]}}; \ No newline at end of file +var _0xf493=['sequelize','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x1e162f,_0x11f330){var _0x4a5a4a=function(_0x4d1876){while(--_0x4d1876){_0x1e162f['push'](_0x1e162f['shift']());}};_0x4a5a4a(++_0x11f330);}(_0xf493,0x108));var _0x3f49=function(_0x115934,_0x374c8f){_0x115934=_0x115934-0x0;var _0x14b99b=_0xf493[_0x115934];return _0x14b99b;};'use strict';var Sequelize=require(_0x3f49('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x3f49('0x1')},'clid':{'type':Sequelize[_0x3f49('0x2')]},'src':{'type':Sequelize[_0x3f49('0x2')]},'dst':{'type':Sequelize[_0x3f49('0x2')]},'dcontext':{'type':Sequelize[_0x3f49('0x2')]},'channel':{'type':Sequelize[_0x3f49('0x2')]},'dstchannel':{'type':Sequelize[_0x3f49('0x2')]},'lastapp':{'type':Sequelize[_0x3f49('0x2')]},'lastdata':{'type':Sequelize[_0x3f49('0x2')]},'duration':{'type':Sequelize[_0x3f49('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x3f49('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3f49('0x2')]},'amaflags':{'type':Sequelize[_0x3f49('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x3f49('0x2')]},'sequence':{'type':Sequelize[_0x3f49('0x2')]},'peeraccount':{'type':Sequelize[_0x3f49('0x2')]},'type':{'type':Sequelize[_0x3f49('0x2')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index f4e3f3b..b3fe61a 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 _0xb10b=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','Cdr','includeAll','include','rows','show','params','find','catch','create','body','describe','eml-format','zip-dir'];(function(_0x38051a,_0x3ca7eb){var _0x4649d7=function(_0x589822){while(--_0x589822){_0x38051a['push'](_0x38051a['shift']());}};_0x4649d7(++_0x3ca7eb);}(_0xb10b,0x12a));var _0xbb10=function(_0x4dd4a1,_0x5ca922){_0x4dd4a1=_0x4dd4a1-0x0;var _0x168d0f=_0xb10b[_0x4dd4a1];return _0x168d0f;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));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('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['Cdr'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'all':!![]}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x1c7fae){_0x2e0249[_0xbb10('0x43')]=_0x1c7fae;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x44')]=function(_0x331751,_0x23dc18){var _0x403beb={'raw':!![],'where':{'id':_0x331751[_0xbb10('0x45')]['id']}},_0x5e2cfa={};_0x5e2cfa[_0xbb10('0x2f')]=_['keys'](db['Cdr'][_0xbb10('0x2c')]);_0x5e2cfa['query']=_[_0xbb10('0x30')](_0x331751[_0xbb10('0x31')]);_0x5e2cfa['filters']=_[_0xbb10('0x32')](_0x5e2cfa[_0xbb10('0x2f')],_0x5e2cfa[_0xbb10('0x31')]);_0x403beb['attributes']=_[_0xbb10('0x32')](_0x5e2cfa[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x331751[_0xbb10('0x31')][_0xbb10('0x34')]));_0x403beb[_0xbb10('0x33')]=_0x403beb[_0xbb10('0x33')][_0xbb10('0x35')]?_0x403beb[_0xbb10('0x33')]:_0x5e2cfa[_0xbb10('0x2f')];if(_0x331751[_0xbb10('0x31')][_0xbb10('0x41')]){_0x403beb['include']=[{'all':!![]}];}_0x403beb=_[_0xbb10('0x3e')]({},_0x403beb,_0x331751[_0xbb10('0x3f')]);return db['Cdr'][_0xbb10('0x46')](_0x403beb)[_0xbb10('0x23')](handleEntityNotFound(_0x23dc18,null))[_0xbb10('0x23')](respondWithResult(_0x23dc18,null))[_0xbb10('0x47')](handleError(_0x23dc18,null));};exports[_0xbb10('0x48')]=function(_0x39f0de,_0x3e06b0){return db['Cdr']['create'](_0x39f0de[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x3e06b0,0xc9))[_0xbb10('0x47')](handleError(_0x3e06b0,null));};exports['update']=function(_0x5f0c12,_0x3cd6f3){if(_0x5f0c12[_0xbb10('0x49')]['id']){delete _0x5f0c12[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x40')][_0xbb10('0x46')]({'where':{'id':_0x5f0c12[_0xbb10('0x45')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x3cd6f3,null))[_0xbb10('0x23')](saveUpdates(_0x5f0c12[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x3cd6f3,null))['catch'](handleError(_0x3cd6f3,null));};exports['destroy']=function(_0x412e13,_0x467dba){return db[_0xbb10('0x40')][_0xbb10('0x46')]({'where':{'id':_0x412e13[_0xbb10('0x45')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x467dba,null))[_0xbb10('0x23')](removeEntity(_0x467dba,null))[_0xbb10('0x47')](handleError(_0x467dba,null));};exports[_0xbb10('0x4a')]=function(_0x1214f7,_0x19ca3e){return db[_0xbb10('0x40')][_0xbb10('0x4a')]()[_0xbb10('0x23')](respondWithResult(_0x19ca3e,null))[_0xbb10('0x47')](handleError(_0x19ca3e,null));}; \ No newline at end of file +var _0xb10b=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','Cdr','includeAll','include','rows','show','params','find','catch','create','body','describe','eml-format','zip-dir'];(function(_0x4fa4dd,_0x4fa75){var _0x25d2ea=function(_0x537950){while(--_0x537950){_0x4fa4dd['push'](_0x4fa4dd['shift']());}};_0x25d2ea(++_0x4fa75);}(_0xb10b,0x12a));var _0xbb10=function(_0x8014d8,_0x134a36){_0x8014d8=_0x8014d8-0x0;var _0x581b7b=_0xb10b[_0x8014d8];return _0x581b7b;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));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('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['Cdr'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'all':!![]}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x1c7fae){_0x2e0249[_0xbb10('0x43')]=_0x1c7fae;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x44')]=function(_0x331751,_0x23dc18){var _0x403beb={'raw':!![],'where':{'id':_0x331751[_0xbb10('0x45')]['id']}},_0x5e2cfa={};_0x5e2cfa[_0xbb10('0x2f')]=_['keys'](db['Cdr'][_0xbb10('0x2c')]);_0x5e2cfa['query']=_[_0xbb10('0x30')](_0x331751[_0xbb10('0x31')]);_0x5e2cfa['filters']=_[_0xbb10('0x32')](_0x5e2cfa[_0xbb10('0x2f')],_0x5e2cfa[_0xbb10('0x31')]);_0x403beb['attributes']=_[_0xbb10('0x32')](_0x5e2cfa[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x331751[_0xbb10('0x31')][_0xbb10('0x34')]));_0x403beb[_0xbb10('0x33')]=_0x403beb[_0xbb10('0x33')][_0xbb10('0x35')]?_0x403beb[_0xbb10('0x33')]:_0x5e2cfa[_0xbb10('0x2f')];if(_0x331751[_0xbb10('0x31')][_0xbb10('0x41')]){_0x403beb['include']=[{'all':!![]}];}_0x403beb=_[_0xbb10('0x3e')]({},_0x403beb,_0x331751[_0xbb10('0x3f')]);return db['Cdr'][_0xbb10('0x46')](_0x403beb)[_0xbb10('0x23')](handleEntityNotFound(_0x23dc18,null))[_0xbb10('0x23')](respondWithResult(_0x23dc18,null))[_0xbb10('0x47')](handleError(_0x23dc18,null));};exports[_0xbb10('0x48')]=function(_0x39f0de,_0x3e06b0){return db['Cdr']['create'](_0x39f0de[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x3e06b0,0xc9))[_0xbb10('0x47')](handleError(_0x3e06b0,null));};exports['update']=function(_0x5f0c12,_0x3cd6f3){if(_0x5f0c12[_0xbb10('0x49')]['id']){delete _0x5f0c12[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x40')][_0xbb10('0x46')]({'where':{'id':_0x5f0c12[_0xbb10('0x45')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x3cd6f3,null))[_0xbb10('0x23')](saveUpdates(_0x5f0c12[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x3cd6f3,null))['catch'](handleError(_0x3cd6f3,null));};exports['destroy']=function(_0x412e13,_0x467dba){return db[_0xbb10('0x40')][_0xbb10('0x46')]({'where':{'id':_0x412e13[_0xbb10('0x45')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x467dba,null))[_0xbb10('0x23')](removeEntity(_0x467dba,null))[_0xbb10('0x47')](handleError(_0x467dba,null));};exports[_0xbb10('0x4a')]=function(_0x1214f7,_0x19ca3e){return db[_0xbb10('0x40')][_0xbb10('0x4a')]()[_0xbb10('0x23')](respondWithResult(_0x19ca3e,null))[_0xbb10('0x47')](handleError(_0x19ca3e,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index fab78d8..e6483f5 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 _0x4991=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid'];(function(_0x30b023,_0x35eba7){var _0x38eae3=function(_0x5677fa){while(--_0x5677fa){_0x30b023['push'](_0x30b023['shift']());}};_0x38eae3(++_0x35eba7);}(_0x4991,0xf7));var _0x1499=function(_0x5da07b,_0x59b340){_0x5da07b=_0x5da07b-0x0;var _0x2c6a47=_0x4991[_0x5da07b];return _0x2c6a47;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var logger=require(_0x1499('0x1'))('api');var moment=require(_0x1499('0x2'));var BPromise=require(_0x1499('0x3'));var rp=require(_0x1499('0x4'));var fs=require('fs');var path=require(_0x1499('0x5'));var rimraf=require(_0x1499('0x6'));var config=require(_0x1499('0x7'));var attributes=require(_0x1499('0x8'));module[_0x1499('0x9')]=function(_0x4b6154,_0x2a8e96){return _0x4b6154[_0x1499('0xa')](_0x1499('0xb'),attributes,{'tableName':_0x1499('0xc'),'paranoid':![],'indexes':[{'name':_0x1499('0xd'),'fields':[_0x1499('0xd')]},{'name':_0x1499('0xe'),'fields':[_0x1499('0xe')]},{'name':'disposition','fields':[_0x1499('0xf')]},{'name':_0x1499('0x10'),'fields':['dst']},{'name':_0x1499('0x11'),'fields':[_0x1499('0x11')]},{'name':'uniqueid','fields':[_0x1499('0x12')]}],'timestamps':![]});}; \ No newline at end of file +var _0xda19=['accountcode','disposition','dst','src','uniqueid','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr'];(function(_0x18ea50,_0x403b06){var _0x1aae7d=function(_0xc87f9f){while(--_0xc87f9f){_0x18ea50['push'](_0x18ea50['shift']());}};_0x1aae7d(++_0x403b06);}(_0xda19,0xd5));var _0x9da1=function(_0x5f3e0d,_0x5f259e){_0x5f3e0d=_0x5f3e0d-0x0;var _0x1b9915=_0xda19[_0x5f3e0d];return _0x1b9915;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var logger=require(_0x9da1('0x1'))('api');var moment=require(_0x9da1('0x2'));var BPromise=require('bluebird');var rp=require(_0x9da1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var attributes=require(_0x9da1('0x6'));module[_0x9da1('0x7')]=function(_0x156faf,_0x2dcbc6){return _0x156faf[_0x9da1('0x8')](_0x9da1('0x9'),attributes,{'tableName':_0x9da1('0xa'),'paranoid':![],'indexes':[{'name':_0x9da1('0xb'),'fields':['accountcode']},{'name':'calldate','fields':['calldate']},{'name':_0x9da1('0xc'),'fields':['disposition']},{'name':_0x9da1('0xd'),'fields':[_0x9da1('0xd')]},{'name':_0x9da1('0xe'),'fields':[_0x9da1('0xe')]},{'name':_0x9da1('0xf'),'fields':[_0x9da1('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index c35097b..f625daf 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 _0x0ebd=['debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','Cdr,\x20%s,\x20%s','request\x20sent'];(function(_0x44806a,_0x20cf5e){var _0x5440b8=function(_0x25e269){while(--_0x25e269){_0x44806a['push'](_0x44806a['shift']());}};_0x5440b8(++_0x20cf5e);}(_0x0ebd,0x69));var _0xd0eb=function(_0x50a701,_0x574e60){_0x50a701=_0x50a701-0x0;var _0x1c803f=_0x0ebd[_0x50a701];return _0x1c803f;};'use strict';var _=require(_0xd0eb('0x0'));var util=require(_0xd0eb('0x1'));var moment=require(_0xd0eb('0x2'));var BPromise=require(_0xd0eb('0x3'));var rs=require(_0xd0eb('0x4'));var fs=require('fs');var Redis=require(_0xd0eb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd0eb('0x6'));var logger=require(_0xd0eb('0x7'))('rpc');var config=require(_0xd0eb('0x8'));var jayson=require(_0xd0eb('0x9'));var client=jayson[_0xd0eb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5df82f,_0x806a2e,_0x2d1636){return new BPromise(function(_0x361127,_0xea2e3a){return client[_0xd0eb('0xb')](_0x5df82f,_0x2d1636)[_0xd0eb('0xc')](function(_0x17f04f){logger['info'](_0xd0eb('0xd'),_0x806a2e,_0xd0eb('0xe'));logger[_0xd0eb('0xf')](_0xd0eb('0x10'),_0x806a2e,_0xd0eb('0xe'),JSON[_0xd0eb('0x11')](_0x17f04f));if(_0x17f04f[_0xd0eb('0x12')]){if(_0x17f04f[_0xd0eb('0x12')][_0xd0eb('0x13')]===0x1f4){logger[_0xd0eb('0x12')]('Cdr,\x20%s,\x20%s',_0x806a2e,_0x17f04f[_0xd0eb('0x12')][_0xd0eb('0x14')]);return _0xea2e3a(_0x17f04f[_0xd0eb('0x12')][_0xd0eb('0x14')]);}logger[_0xd0eb('0x12')]('Cdr,\x20%s,\x20%s',_0x806a2e,_0x17f04f[_0xd0eb('0x12')][_0xd0eb('0x14')]);return _0x361127(_0x17f04f[_0xd0eb('0x12')]['message']);}else{logger[_0xd0eb('0x15')](_0xd0eb('0xd'),_0x806a2e,_0xd0eb('0xe'));_0x361127(_0x17f04f[_0xd0eb('0x16')][_0xd0eb('0x14')]);}})[_0xd0eb('0x17')](function(_0x2d69b3){logger['error'](_0xd0eb('0xd'),_0x806a2e,_0x2d69b3);_0xea2e3a(_0x2d69b3);});});} \ No newline at end of file +var _0x2029=['Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','debug'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x2029,0xf7));var _0x9202=function(_0x5dcb76,_0x21ff02){_0x5dcb76=_0x5dcb76-0x0;var _0x4fc065=_0x2029[_0x5dcb76];return _0x4fc065;};'use strict';var _=require(_0x9202('0x0'));var util=require(_0x9202('0x1'));var moment=require(_0x9202('0x2'));var BPromise=require(_0x9202('0x3'));var rs=require(_0x9202('0x4'));var fs=require('fs');var Redis=require(_0x9202('0x5'));var db=require(_0x9202('0x6'))['db'];var utils=require(_0x9202('0x7'));var logger=require(_0x9202('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9202('0x9'));var client=jayson[_0x9202('0xa')][_0x9202('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x365d4b,_0x4c40ae,_0x99554d){return new BPromise(function(_0x54b330,_0x17526c){return client[_0x9202('0xc')](_0x365d4b,_0x99554d)[_0x9202('0xd')](function(_0x37639d){logger[_0x9202('0xe')](_0x9202('0xf'),_0x4c40ae,'request\x20sent');logger[_0x9202('0x10')](_0x9202('0x11'),_0x4c40ae,_0x9202('0x12'),JSON[_0x9202('0x13')](_0x37639d));if(_0x37639d[_0x9202('0x14')]){if(_0x37639d[_0x9202('0x14')]['code']===0x1f4){logger[_0x9202('0x14')]('Cdr,\x20%s,\x20%s',_0x4c40ae,_0x37639d[_0x9202('0x14')][_0x9202('0x15')]);return _0x17526c(_0x37639d[_0x9202('0x14')][_0x9202('0x15')]);}logger[_0x9202('0x14')]('Cdr,\x20%s,\x20%s',_0x4c40ae,_0x37639d['error']['message']);return _0x54b330(_0x37639d[_0x9202('0x14')][_0x9202('0x15')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x4c40ae,_0x9202('0x12'));_0x54b330(_0x37639d[_0x9202('0x16')][_0x9202('0x15')]);}})[_0x9202('0x17')](function(_0x3b9647){logger[_0x9202('0x14')](_0x9202('0xf'),_0x4c40ae,_0x3b9647);_0x17526c(_0x3b9647);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 8b5af33..40ae8f5 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 _0xf70b=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cdr.controller','isAuthenticated','index','describe','get','/:id','show','post','multer','util'];(function(_0x273e0d,_0x57ced8){var _0x251355=function(_0x201566){while(--_0x201566){_0x273e0d['push'](_0x273e0d['shift']());}};_0x251355(++_0x57ced8);}(_0xf70b,0x19e));var _0xbf70=function(_0x38be7d,_0x689797){_0x38be7d=_0x38be7d-0x0;var _0x1456a3=_0xf70b[_0x38be7d];return _0x1456a3;};'use strict';var multer=require(_0xbf70('0x0'));var util=require(_0xbf70('0x1'));var path=require(_0xbf70('0x2'));var timeout=require(_0xbf70('0x3'));var express=require(_0xbf70('0x4'));var router=express[_0xbf70('0x5')]();var fs_extra=require(_0xbf70('0x6'));var auth=require(_0xbf70('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbf70('0x8'));router['get']('/',auth[_0xbf70('0x9')](),controller[_0xbf70('0xa')]);router['get']('/describe',auth[_0xbf70('0x9')](),controller[_0xbf70('0xb')]);router[_0xbf70('0xc')](_0xbf70('0xd'),auth[_0xbf70('0x9')](),controller[_0xbf70('0xe')]);router[_0xbf70('0xf')]('/',auth[_0xbf70('0x9')](),controller['create']);router['put'](_0xbf70('0xd'),auth[_0xbf70('0x9')](),controller['update']);router['delete'](_0xbf70('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfb12=['./cdr.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xfb12,0x1ce));var _0x2fb1=function(_0x1f0d02,_0x544507){_0x1f0d02=_0x1f0d02-0x0;var _0x7cb25=_0xfb12[_0x1f0d02];return _0x7cb25;};'use strict';var multer=require('multer');var util=require(_0x2fb1('0x0'));var path=require('path');var timeout=require(_0x2fb1('0x1'));var express=require('express');var router=express[_0x2fb1('0x2')]();var fs_extra=require(_0x2fb1('0x3'));var auth=require(_0x2fb1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2fb1('0x5'));var controller=require(_0x2fb1('0x6'));router[_0x2fb1('0x7')]('/',auth[_0x2fb1('0x8')](),controller[_0x2fb1('0x9')]);router['get'](_0x2fb1('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x2fb1('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x2fb1('0xc')]('/',auth[_0x2fb1('0x8')](),controller[_0x2fb1('0xd')]);router[_0x2fb1('0xe')](_0x2fb1('0xb'),auth[_0x2fb1('0x8')](),controller['update']);router[_0x2fb1('0xf')](_0x2fb1('0xb'),auth[_0x2fb1('0x8')](),controller[_0x2fb1('0x10')]);module[_0x2fb1('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 76f1cfd..a75477d 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 _0xc1b4=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xc1b4,0x182));var _0x4c1b=function(_0x4426ef,_0xe459f6){_0x4426ef=_0x4426ef-0x0;var _0x3c762a=_0xc1b4[_0x4426ef];return _0x3c762a;};'use strict';var Sequelize=require(_0x4c1b('0x0'));module[_0x4c1b('0x1')]={'priority':{'type':Sequelize[_0x4c1b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4c1b('0x3')],'allowNull':![],'defaultValue':_0x4c1b('0x4')},'appdata':{'type':Sequelize[_0x4c1b('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4c1b('0x3')],'defaultValue':_0x4c1b('0x6')}}; \ No newline at end of file +var _0xae3f=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x4b9be2,_0x7f791e){var _0x43093c=function(_0x31ca54){while(--_0x31ca54){_0x4b9be2['push'](_0x4b9be2['shift']());}};_0x43093c(++_0x7f791e);}(_0xae3f,0x136));var _0xfae3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xae3f[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require('sequelize');module[_0xfae3('0x0')]={'priority':{'type':Sequelize[_0xfae3('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xfae3('0x2')],'allowNull':![],'defaultValue':_0xfae3('0x3')},'appdata':{'type':Sequelize[_0xfae3('0x4')]()},'description':{'type':Sequelize[_0xfae3('0x2')]},'interval':{'type':Sequelize[_0xfae3('0x2')],'defaultValue':_0xfae3('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 4330b18..2d1076a 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 _0x5ff0=['ChatApplication','query','intersection','attributes','fields','length','includeAll','include','merge','then','catch','body','find','rimraf','zip-dir','request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','error','name','send','show','params','model','keys'];(function(_0x3dc68d,_0x1c1951){var _0xdf7f94=function(_0x339428){while(--_0x339428){_0x3dc68d['push'](_0x3dc68d['shift']());}};_0xdf7f94(++_0x1c1951);}(_0x5ff0,0x75));var _0x05ff=function(_0x46fd46,_0x2851c0){_0x46fd46=_0x46fd46-0x0;var _0x5205fa=_0x5ff0[_0x46fd46];return _0x5205fa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x05ff('0x0'));var zipdir=require(_0x05ff('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05ff('0x2'));var moment=require(_0x05ff('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x05ff('0x4'));var util=require(_0x05ff('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x05ff('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x05ff('0x7'));var squel=require(_0x05ff('0x8'));var crypto=require(_0x05ff('0x9'));var jsforce=require(_0x05ff('0xa'));var deskjs=require(_0x05ff('0xb'));var toCsv=require(_0x05ff('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x05ff('0xc'));var authService=require(_0x05ff('0xd'));var qs=require(_0x05ff('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x05ff('0xf'));var utils=require(_0x05ff('0x10'));var config=require(_0x05ff('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x05ff('0x12'))['db'];function respondWithStatusCode(_0x5865d2,_0x2b2988){_0x2b2988=_0x2b2988||0xcc;return function(_0x3dc333){if(_0x3dc333){return _0x5865d2[_0x05ff('0x13')](_0x2b2988);}return _0x5865d2[_0x05ff('0x14')](_0x2b2988)['end']();};}function respondWithResult(_0x4cab35,_0x227d8e){_0x227d8e=_0x227d8e||0xc8;return function(_0x178cf2){if(_0x178cf2){return _0x4cab35[_0x05ff('0x14')](_0x227d8e)[_0x05ff('0x15')](_0x178cf2);}};}function respondWithFilteredResult(_0x2aa207,_0x25ec29){return function(_0x3bc892){if(_0x3bc892){var _0x3ab7e0=typeof _0x25ec29[_0x05ff('0x16')]===_0x05ff('0x17')&&typeof _0x25ec29[_0x05ff('0x18')]===_0x05ff('0x17');var _0x41fd8a=_0x3bc892[_0x05ff('0x19')];var _0x594284=_0x3ab7e0?0x0:_0x25ec29[_0x05ff('0x16')];var _0x37b1cd=_0x3ab7e0?_0x3bc892[_0x05ff('0x19')]:_0x25ec29[_0x05ff('0x16')]+_0x25ec29[_0x05ff('0x18')];var _0x1f6f0f;if(_0x37b1cd>=_0x41fd8a){_0x37b1cd=_0x41fd8a;_0x1f6f0f=0xc8;}else{_0x1f6f0f=0xce;}_0x2aa207[_0x05ff('0x14')](_0x1f6f0f);return _0x2aa207[_0x05ff('0x1a')](_0x05ff('0x1b'),_0x594284+'-'+_0x37b1cd+'/'+_0x41fd8a)[_0x05ff('0x15')](_0x3bc892);}return null;};}function patchUpdates(_0x17fc78){return function(_0x30abca){try{jsonpatch[_0x05ff('0x1c')](_0x30abca,_0x17fc78,!![]);}catch(_0x467f1d){return BPromise['reject'](_0x467f1d);}return _0x30abca[_0x05ff('0x1d')]();};}function saveUpdates(_0x37a373,_0x34bdd8){return function(_0x1340c2){if(_0x1340c2){return _0x1340c2[_0x05ff('0x1e')](_0x37a373)['then'](function(_0x341297){return _0x341297;});}return null;};}function removeEntity(_0x58c584,_0x122f44){return function(_0x38f3bc){if(_0x38f3bc){return _0x38f3bc[_0x05ff('0x1f')]()['then'](function(){_0x58c584[_0x05ff('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28b9c1,_0x1b8ef0){return function(_0x5709b6){if(!_0x5709b6){_0x28b9c1['sendStatus'](0x194);}return _0x5709b6;};}function handleError(_0x58e3ef,_0x2aa8a0){_0x2aa8a0=_0x2aa8a0||0x1f4;return function(_0x2ad99b){logger[_0x05ff('0x20')](_0x2ad99b['stack']);if(_0x2ad99b[_0x05ff('0x21')]){delete _0x2ad99b[_0x05ff('0x21')];}_0x58e3ef[_0x05ff('0x14')](_0x2aa8a0)[_0x05ff('0x22')](_0x2ad99b);};}exports[_0x05ff('0x23')]=function(_0x5e1d90,_0x285e7a){var _0x11e608={'raw':!![],'where':{'id':_0x5e1d90[_0x05ff('0x24')]['id']}},_0x1c3ec0={};_0x1c3ec0[_0x05ff('0x25')]=_[_0x05ff('0x26')](db[_0x05ff('0x27')]['rawAttributes']);_0x1c3ec0['query']=_[_0x05ff('0x26')](_0x5e1d90[_0x05ff('0x28')]);_0x1c3ec0['filters']=_[_0x05ff('0x29')](_0x1c3ec0[_0x05ff('0x25')],_0x1c3ec0[_0x05ff('0x28')]);_0x11e608[_0x05ff('0x2a')]=_[_0x05ff('0x29')](_0x1c3ec0['model'],qs[_0x05ff('0x2b')](_0x5e1d90[_0x05ff('0x28')][_0x05ff('0x2b')]));_0x11e608[_0x05ff('0x2a')]=_0x11e608[_0x05ff('0x2a')][_0x05ff('0x2c')]?_0x11e608[_0x05ff('0x2a')]:_0x1c3ec0[_0x05ff('0x25')];if(_0x5e1d90[_0x05ff('0x28')][_0x05ff('0x2d')]){_0x11e608[_0x05ff('0x2e')]=[{'all':!![]}];}_0x11e608=_[_0x05ff('0x2f')]({},_0x11e608,_0x5e1d90['options']);return db[_0x05ff('0x27')]['find'](_0x11e608)[_0x05ff('0x30')](handleEntityNotFound(_0x285e7a,null))[_0x05ff('0x30')](respondWithResult(_0x285e7a,null))[_0x05ff('0x31')](handleError(_0x285e7a,null));};exports[_0x05ff('0x1e')]=function(_0x45c4a7,_0x4eb985){if(_0x45c4a7[_0x05ff('0x32')]['id']){delete _0x45c4a7[_0x05ff('0x32')]['id'];}return db[_0x05ff('0x27')][_0x05ff('0x33')]({'where':{'id':_0x45c4a7[_0x05ff('0x24')]['id']}})[_0x05ff('0x30')](handleEntityNotFound(_0x4eb985,null))['then'](saveUpdates(_0x45c4a7[_0x05ff('0x32')],null))[_0x05ff('0x30')](respondWithResult(_0x4eb985,null))['catch'](handleError(_0x4eb985,null));};exports[_0x05ff('0x1f')]=function(_0x4cc301,_0x13998e){return db['ChatApplication']['find']({'where':{'id':_0x4cc301[_0x05ff('0x24')]['id']}})['then'](handleEntityNotFound(_0x13998e,null))[_0x05ff('0x30')](removeEntity(_0x13998e,null))[_0x05ff('0x31')](handleError(_0x13998e,null));}; \ No newline at end of file +var _0xdfb3=['../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','error','stack','name','send','params','model','ChatApplication','query','intersection','fields','attributes','includeAll','include','merge','options','update','body','find','catch','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util'];(function(_0x1efe63,_0x4eaa61){var _0x442c2a=function(_0x5122aa){while(--_0x5122aa){_0x1efe63['push'](_0x1efe63['shift']());}};_0x442c2a(++_0x4eaa61);}(_0xdfb3,0x144));var _0x3dfb=function(_0x2ff9a,_0x4d2e32){_0x2ff9a=_0x2ff9a-0x0;var _0xb3382f=_0xdfb3[_0x2ff9a];return _0xb3382f;};'use strict';var emlformat=require(_0x3dfb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3dfb('0x1'));var jsonpatch=require(_0x3dfb('0x2'));var rp=require(_0x3dfb('0x3'));var moment=require(_0x3dfb('0x4'));var BPromise=require(_0x3dfb('0x5'));var Mustache=require('mustache');var util=require(_0x3dfb('0x6'));var path=require(_0x3dfb('0x7'));var sox=require(_0x3dfb('0x8'));var csv=require(_0x3dfb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3dfb('0xa'));var _=require(_0x3dfb('0xb'));var squel=require(_0x3dfb('0xc'));var crypto=require(_0x3dfb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3dfb('0xe'));var toCsv=require(_0x3dfb('0x9'));var querystring=require(_0x3dfb('0xf'));var Papa=require('papaparse');var Redis=require(_0x3dfb('0x10'));var authService=require(_0x3dfb('0x11'));var qs=require(_0x3dfb('0x12'));var as=require(_0x3dfb('0x13'));var hardwareService=require(_0x3dfb('0x14'));var logger=require(_0x3dfb('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x3dfb('0x16'));var licenseUtil=require(_0x3dfb('0x17'));var db=require(_0x3dfb('0x18'))['db'];function respondWithStatusCode(_0x523c43,_0x2e1ee5){_0x2e1ee5=_0x2e1ee5||0xcc;return function(_0x2d453a){if(_0x2d453a){return _0x523c43[_0x3dfb('0x19')](_0x2e1ee5);}return _0x523c43['status'](_0x2e1ee5)[_0x3dfb('0x1a')]();};}function respondWithResult(_0x1f55bd,_0x2b7cfc){_0x2b7cfc=_0x2b7cfc||0xc8;return function(_0x4c1d78){if(_0x4c1d78){return _0x1f55bd[_0x3dfb('0x1b')](_0x2b7cfc)[_0x3dfb('0x1c')](_0x4c1d78);}};}function respondWithFilteredResult(_0xcd7760,_0x19beb1){return function(_0x54efa1){if(_0x54efa1){var _0x4d71cf=typeof _0x19beb1[_0x3dfb('0x1d')]===_0x3dfb('0x1e')&&typeof _0x19beb1[_0x3dfb('0x1f')]===_0x3dfb('0x1e');var _0x5c190f=_0x54efa1[_0x3dfb('0x20')];var _0x3e0064=_0x4d71cf?0x0:_0x19beb1['offset'];var _0x1c18f9=_0x4d71cf?_0x54efa1[_0x3dfb('0x20')]:_0x19beb1[_0x3dfb('0x1d')]+_0x19beb1[_0x3dfb('0x1f')];var _0x5c7336;if(_0x1c18f9>=_0x5c190f){_0x1c18f9=_0x5c190f;_0x5c7336=0xc8;}else{_0x5c7336=0xce;}_0xcd7760['status'](_0x5c7336);return _0xcd7760[_0x3dfb('0x21')]('Content-Range',_0x3e0064+'-'+_0x1c18f9+'/'+_0x5c190f)['json'](_0x54efa1);}return null;};}function patchUpdates(_0xc0b1c6){return function(_0x5a5e62){try{jsonpatch[_0x3dfb('0x22')](_0x5a5e62,_0xc0b1c6,!![]);}catch(_0xc2c30a){return BPromise[_0x3dfb('0x23')](_0xc2c30a);}return _0x5a5e62[_0x3dfb('0x24')]();};}function saveUpdates(_0x36c7ba,_0x37a6fa){return function(_0x14f287){if(_0x14f287){return _0x14f287['update'](_0x36c7ba)[_0x3dfb('0x25')](function(_0xdd12a2){return _0xdd12a2;});}return null;};}function removeEntity(_0x3659a1,_0x311dea){return function(_0x1998c7){if(_0x1998c7){return _0x1998c7['destroy']()[_0x3dfb('0x25')](function(){_0x3659a1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x414e5d,_0x2fcac4){return function(_0x146811){if(!_0x146811){_0x414e5d[_0x3dfb('0x19')](0x194);}return _0x146811;};}function handleError(_0xe23a35,_0x7f2a64){_0x7f2a64=_0x7f2a64||0x1f4;return function(_0x5e10ad){logger[_0x3dfb('0x26')](_0x5e10ad[_0x3dfb('0x27')]);if(_0x5e10ad[_0x3dfb('0x28')]){delete _0x5e10ad[_0x3dfb('0x28')];}_0xe23a35[_0x3dfb('0x1b')](_0x7f2a64)[_0x3dfb('0x29')](_0x5e10ad);};}exports['show']=function(_0xcfecc7,_0x43c188){var _0x78a6bd={'raw':!![],'where':{'id':_0xcfecc7[_0x3dfb('0x2a')]['id']}},_0x23482c={};_0x23482c[_0x3dfb('0x2b')]=_['keys'](db[_0x3dfb('0x2c')]['rawAttributes']);_0x23482c[_0x3dfb('0x2d')]=_['keys'](_0xcfecc7['query']);_0x23482c['filters']=_[_0x3dfb('0x2e')](_0x23482c[_0x3dfb('0x2b')],_0x23482c[_0x3dfb('0x2d')]);_0x78a6bd['attributes']=_[_0x3dfb('0x2e')](_0x23482c['model'],qs[_0x3dfb('0x2f')](_0xcfecc7[_0x3dfb('0x2d')][_0x3dfb('0x2f')]));_0x78a6bd[_0x3dfb('0x30')]=_0x78a6bd[_0x3dfb('0x30')]['length']?_0x78a6bd[_0x3dfb('0x30')]:_0x23482c[_0x3dfb('0x2b')];if(_0xcfecc7['query'][_0x3dfb('0x31')]){_0x78a6bd[_0x3dfb('0x32')]=[{'all':!![]}];}_0x78a6bd=_[_0x3dfb('0x33')]({},_0x78a6bd,_0xcfecc7[_0x3dfb('0x34')]);return db[_0x3dfb('0x2c')]['find'](_0x78a6bd)[_0x3dfb('0x25')](handleEntityNotFound(_0x43c188,null))[_0x3dfb('0x25')](respondWithResult(_0x43c188,null))['catch'](handleError(_0x43c188,null));};exports[_0x3dfb('0x35')]=function(_0x6b8ba1,_0x176e42){if(_0x6b8ba1['body']['id']){delete _0x6b8ba1[_0x3dfb('0x36')]['id'];}return db['ChatApplication'][_0x3dfb('0x37')]({'where':{'id':_0x6b8ba1[_0x3dfb('0x2a')]['id']}})[_0x3dfb('0x25')](handleEntityNotFound(_0x176e42,null))['then'](saveUpdates(_0x6b8ba1['body'],null))[_0x3dfb('0x25')](respondWithResult(_0x176e42,null))[_0x3dfb('0x38')](handleError(_0x176e42,null));};exports[_0x3dfb('0x39')]=function(_0x493a26,_0x226f62){return db['ChatApplication']['find']({'where':{'id':_0x493a26[_0x3dfb('0x2a')]['id']}})['then'](handleEntityNotFound(_0x226f62,null))[_0x3dfb('0x25')](removeEntity(_0x226f62,null))[_0x3dfb('0x38')](handleError(_0x226f62,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index c0c9d3d..29f964e 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 _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 7086110..d9fb1fc 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 _0x46d9=['ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug'];(function(_0x1d5688,_0x2a2ed3){var _0xaec6b0=function(_0x5afc8e){while(--_0x5afc8e){_0x1d5688['push'](_0x1d5688['shift']());}};_0xaec6b0(++_0x2a2ed3);}(_0x46d9,0x18e));var _0x946d=function(_0x4c1b24,_0x7e4323){_0x4c1b24=_0x4c1b24-0x0;var _0x4a0f69=_0x46d9[_0x4c1b24];return _0x4a0f69;};'use strict';var _=require(_0x946d('0x0'));var util=require(_0x946d('0x1'));var moment=require(_0x946d('0x2'));var BPromise=require(_0x946d('0x3'));var rs=require(_0x946d('0x4'));var fs=require('fs');var Redis=require(_0x946d('0x5'));var db=require(_0x946d('0x6'))['db'];var utils=require(_0x946d('0x7'));var logger=require(_0x946d('0x8'))('rpc');var config=require(_0x946d('0x9'));var jayson=require(_0x946d('0xa'));var client=jayson['client'][_0x946d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5df1cf,_0x4b734a,_0x36b1e3){return new BPromise(function(_0x5273e1,_0x31adeb){return client['request'](_0x5df1cf,_0x36b1e3)[_0x946d('0xc')](function(_0x4d9704){logger[_0x946d('0xd')]('ChatApplication,\x20%s,\x20%s',_0x4b734a,_0x946d('0xe'));logger[_0x946d('0xf')](_0x946d('0x10'),_0x4b734a,_0x946d('0xe'),JSON[_0x946d('0x11')](_0x4d9704));if(_0x4d9704[_0x946d('0x12')]){if(_0x4d9704[_0x946d('0x12')][_0x946d('0x13')]===0x1f4){logger[_0x946d('0x12')](_0x946d('0x14'),_0x4b734a,_0x4d9704[_0x946d('0x12')][_0x946d('0x15')]);return _0x31adeb(_0x4d9704[_0x946d('0x12')][_0x946d('0x15')]);}logger[_0x946d('0x12')](_0x946d('0x14'),_0x4b734a,_0x4d9704[_0x946d('0x12')][_0x946d('0x15')]);return _0x5273e1(_0x4d9704[_0x946d('0x12')][_0x946d('0x15')]);}else{logger[_0x946d('0xd')]('ChatApplication,\x20%s,\x20%s',_0x4b734a,_0x946d('0xe'));_0x5273e1(_0x4d9704[_0x946d('0x16')][_0x946d('0x15')]);}})['catch'](function(_0x56108a){logger[_0x946d('0x12')]('ChatApplication,\x20%s,\x20%s',_0x4b734a,_0x56108a);_0x31adeb(_0x56108a);});});} \ No newline at end of file +var _0xaca9=['code','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xaca9,0x10c));var _0x9aca=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xaca9[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0x9aca('0x0'));var util=require(_0x9aca('0x1'));var moment=require(_0x9aca('0x2'));var BPromise=require(_0x9aca('0x3'));var rs=require(_0x9aca('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9aca('0x5'))['db'];var utils=require(_0x9aca('0x6'));var logger=require(_0x9aca('0x7'))(_0x9aca('0x8'));var config=require('../../config/environment');var jayson=require(_0x9aca('0x9'));var client=jayson[_0x9aca('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29478f,_0x1549e2,_0x176ea4){return new BPromise(function(_0xfe27f6,_0x476331){return client[_0x9aca('0xb')](_0x29478f,_0x176ea4)[_0x9aca('0xc')](function(_0x82a06d){logger['info'](_0x9aca('0xd'),_0x1549e2,_0x9aca('0xe'));logger['debug'](_0x9aca('0xf'),_0x1549e2,'request\x20sent',JSON[_0x9aca('0x10')](_0x82a06d));if(_0x82a06d[_0x9aca('0x11')]){if(_0x82a06d[_0x9aca('0x11')][_0x9aca('0x12')]===0x1f4){logger[_0x9aca('0x11')](_0x9aca('0xd'),_0x1549e2,_0x82a06d[_0x9aca('0x11')][_0x9aca('0x13')]);return _0x476331(_0x82a06d['error'][_0x9aca('0x13')]);}logger[_0x9aca('0x11')](_0x9aca('0xd'),_0x1549e2,_0x82a06d['error'][_0x9aca('0x13')]);return _0xfe27f6(_0x82a06d[_0x9aca('0x11')][_0x9aca('0x13')]);}else{logger[_0x9aca('0x14')]('ChatApplication,\x20%s,\x20%s',_0x1549e2,_0x9aca('0xe'));_0xfe27f6(_0x82a06d[_0x9aca('0x15')][_0x9aca('0x13')]);}})['catch'](function(_0x4edd4a){logger[_0x9aca('0x11')](_0x9aca('0xd'),_0x1549e2,_0x4edd4a);_0x476331(_0x4edd4a);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 48bcc97..41eba7c 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 _0xd04b=['express','Router','fs-extra','../../config/environment','./chatApplication.controller','get','isAuthenticated','put','update','/:id','destroy','util','path','connect-timeout'];(function(_0x50a91c,_0x13148f){var _0x251cb0=function(_0x2585c4){while(--_0x2585c4){_0x50a91c['push'](_0x50a91c['shift']());}};_0x251cb0(++_0x13148f);}(_0xd04b,0xa5));var _0xbd04=function(_0x413eb2,_0x6d4001){_0x413eb2=_0x413eb2-0x0;var _0x2cd538=_0xd04b[_0x413eb2];return _0x2cd538;};'use strict';var multer=require('multer');var util=require(_0xbd04('0x0'));var path=require(_0xbd04('0x1'));var timeout=require(_0xbd04('0x2'));var express=require(_0xbd04('0x3'));var router=express[_0xbd04('0x4')]();var fs_extra=require(_0xbd04('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbd04('0x6'));var controller=require(_0xbd04('0x7'));router[_0xbd04('0x8')]('/:id',auth[_0xbd04('0x9')](),controller['show']);router[_0xbd04('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xbd04('0xb')]);router['delete'](_0xbd04('0xc'),auth[_0xbd04('0x9')](),controller[_0xbd04('0xd')]);module['exports']=router; \ No newline at end of file +var _0x8f05=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','update','delete','exports'];(function(_0x50d84b,_0x1d7ea7){var _0x6d4270=function(_0x883f21){while(--_0x883f21){_0x50d84b['push'](_0x50d84b['shift']());}};_0x6d4270(++_0x1d7ea7);}(_0x8f05,0x159));var _0x58f0=function(_0x437e08,_0x1cab6c){_0x437e08=_0x437e08-0x0;var _0xcf57f2=_0x8f05[_0x437e08];return _0xcf57f2;};'use strict';var multer=require('multer');var util=require(_0x58f0('0x0'));var path=require(_0x58f0('0x1'));var timeout=require(_0x58f0('0x2'));var express=require(_0x58f0('0x3'));var router=express['Router']();var fs_extra=require(_0x58f0('0x4'));var auth=require(_0x58f0('0x5'));var interaction=require(_0x58f0('0x6'));var config=require(_0x58f0('0x7'));var controller=require(_0x58f0('0x8'));router['get'](_0x58f0('0x9'),auth[_0x58f0('0xa')](),controller[_0x58f0('0xb')]);router['put']('/:id',auth[_0x58f0('0xa')](),controller[_0x58f0('0xc')]);router[_0x58f0('0xd')](_0x58f0('0x9'),auth[_0x58f0('0xa')](),controller['destroy']);module[_0x58f0('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 44fc3a7..7a5d441 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 _0xe184=['exports','STRING','BOOLEAN'];(function(_0x505512,_0x3a6743){var _0x1f5ec9=function(_0x2cbfbb){while(--_0x2cbfbb){_0x505512['push'](_0x505512['shift']());}};_0x1f5ec9(++_0x3a6743);}(_0xe184,0x69));var _0x4e18=function(_0x310852,_0x4bdd57){_0x310852=_0x310852-0x0;var _0x17907b=_0xe184[_0x310852];return _0x17907b;};'use strict';var Sequelize=require('sequelize');module[_0x4e18('0x0')]={'name':{'type':Sequelize[_0x4e18('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4e18('0x1')]},'write':{'type':Sequelize[_0x4e18('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8293=['STRING','BOOLEAN','exports'];(function(_0x41ed37,_0xbcd1d4){var _0x13f7ea=function(_0x270235){while(--_0x270235){_0x41ed37['push'](_0x41ed37['shift']());}};_0x13f7ea(++_0xbcd1d4);}(_0x8293,0xc5));var _0x3829=function(_0x566906,_0x20b94c){_0x566906=_0x566906-0x0;var _0x197756=_0x8293[_0x566906];return _0x197756;};'use strict';var Sequelize=require('sequelize');module[_0x3829('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x3829('0x1')]},'write':{'type':Sequelize[_0x3829('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 671f30b..3fd106c 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 _0x7ff2=['findOne','User','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','request\x20sent','debug','error','ChatGroup,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','ChatGroup','rawAttributes','fieldName','type','key','query','keys','intersection','fields','attributes','length','model','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','show','params','find','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers'];(function(_0x1d29e9,_0x1547d6){var _0x507aad=function(_0x18e4a6){while(--_0x18e4a6){_0x1d29e9['push'](_0x1d29e9['shift']());}};_0x507aad(++_0x1547d6);}(_0x7ff2,0x1ae));var _0x27ff=function(_0x5c4962,_0x26e7ee){_0x5c4962=_0x5c4962-0x0;var _0xd20e67=_0x7ff2[_0x5c4962];return _0xd20e67;};'use strict';var emlformat=require(_0x27ff('0x0'));var rimraf=require(_0x27ff('0x1'));var zipdir=require(_0x27ff('0x2'));var jsonpatch=require(_0x27ff('0x3'));var rp=require(_0x27ff('0x4'));var moment=require(_0x27ff('0x5'));var BPromise=require(_0x27ff('0x6'));var Mustache=require(_0x27ff('0x7'));var util=require(_0x27ff('0x8'));var path=require('path');var sox=require(_0x27ff('0x9'));var csv=require(_0x27ff('0xa'));var ejs=require(_0x27ff('0xb'));var fs=require('fs');var fs_extra=require(_0x27ff('0xc'));var _=require(_0x27ff('0xd'));var squel=require('squel');var crypto=require(_0x27ff('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x27ff('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x27ff('0x10'));var Redis=require(_0x27ff('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x27ff('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x27ff('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x27ff('0x14'));var config=require(_0x27ff('0x15'));var licenseUtil=require(_0x27ff('0x16'));var db=require('../../mysqldb')['db'];config[_0x27ff('0x17')]=_[_0x27ff('0x18')](config[_0x27ff('0x17')],{'host':_0x27ff('0x19'),'port':0x18eb});var socket=require(_0x27ff('0x1a'))(new Redis(config[_0x27ff('0x17')]));require('./chatGroup.socket')[_0x27ff('0x1b')](socket);var jayson=require(_0x27ff('0x1c'));var client=jayson[_0x27ff('0x1d')][_0x27ff('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xa04250,_0x17c77f,_0x31d13d,_0x8b2d04){return new BPromise(function(_0x4e8d5d,_0x5e6a2d){var _0x4128c2=_0x8b2d04||client;return _0x4128c2['request'](_0xa04250,_0x31d13d)[_0x27ff('0x1f')](function(_0xd94da6){logger[_0x27ff('0x20')]('ChatGroup,\x20%s,\x20%s',_0x17c77f,_0x27ff('0x21'));logger[_0x27ff('0x22')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x17c77f,_0x27ff('0x21'),JSON['stringify'](_0xd94da6));if(_0xd94da6['error']){if(_0xd94da6['error']['code']===0x1f4){logger[_0x27ff('0x23')](_0x27ff('0x24'),_0x17c77f,_0xd94da6['error'][_0x27ff('0x25')]);return _0x5e6a2d(_0xd94da6[_0x27ff('0x23')]['message']);}logger[_0x27ff('0x23')]('ChatGroup,\x20%s,\x20%s',_0x17c77f,_0xd94da6[_0x27ff('0x23')]['message']);return _0x4e8d5d(_0xd94da6[_0x27ff('0x23')][_0x27ff('0x25')]);}else{logger[_0x27ff('0x20')](_0x27ff('0x24'),_0x17c77f,'request\x20sent');_0x4e8d5d(_0xd94da6[_0x27ff('0x26')][_0x27ff('0x25')]);}})[_0x27ff('0x27')](function(_0x4856d6){logger['error'](_0x27ff('0x24'),_0x17c77f,_0x4856d6);_0x5e6a2d(_0x4856d6);});});}function respondWithStatusCode(_0x4056e7,_0x37c7c2){_0x37c7c2=_0x37c7c2||0xcc;return function(_0xb1f1fe){if(_0xb1f1fe){return _0x4056e7[_0x27ff('0x28')](_0x37c7c2);}return _0x4056e7[_0x27ff('0x29')](_0x37c7c2)[_0x27ff('0x2a')]();};}function respondWithResult(_0x4a372f,_0x458ddb){_0x458ddb=_0x458ddb||0xc8;return function(_0x3f6647){if(_0x3f6647){return _0x4a372f[_0x27ff('0x29')](_0x458ddb)[_0x27ff('0x2b')](_0x3f6647);}};}function respondWithFilteredResult(_0x312d76,_0x18412d){return function(_0xdebeb7){if(_0xdebeb7){var _0x3057aa=typeof _0x18412d[_0x27ff('0x2c')]===_0x27ff('0x2d')&&typeof _0x18412d['limit']===_0x27ff('0x2d');var _0x4413dc=_0xdebeb7[_0x27ff('0x2e')];var _0x403140=_0x3057aa?0x0:_0x18412d['offset'];var _0x7f64b0=_0x3057aa?_0xdebeb7[_0x27ff('0x2e')]:_0x18412d['offset']+_0x18412d[_0x27ff('0x2f')];var _0x4f6640;if(_0x7f64b0>=_0x4413dc){_0x7f64b0=_0x4413dc;_0x4f6640=0xc8;}else{_0x4f6640=0xce;}_0x312d76[_0x27ff('0x29')](_0x4f6640);return _0x312d76['set'](_0x27ff('0x30'),_0x403140+'-'+_0x7f64b0+'/'+_0x4413dc)['json'](_0xdebeb7);}return null;};}function patchUpdates(_0x2aeff8){return function(_0x316824){try{jsonpatch[_0x27ff('0x31')](_0x316824,_0x2aeff8,!![]);}catch(_0x2e2e86){return BPromise[_0x27ff('0x32')](_0x2e2e86);}return _0x316824[_0x27ff('0x33')]();};}function saveUpdates(_0x3f6b4c,_0x16a234){return function(_0x2d84fa){if(_0x2d84fa){return _0x2d84fa[_0x27ff('0x34')](_0x3f6b4c)[_0x27ff('0x1f')](function(_0x2d0e70){return _0x2d0e70;});}return null;};}function removeEntity(_0x3307b3,_0x151604){return function(_0x4c34d5){if(_0x4c34d5){return _0x4c34d5[_0x27ff('0x35')]()[_0x27ff('0x1f')](function(){_0x3307b3[_0x27ff('0x29')](0xcc)[_0x27ff('0x2a')]();});}};}function handleEntityNotFound(_0x40abd4,_0x56c783){return function(_0x27a3d9){if(!_0x27a3d9){_0x40abd4[_0x27ff('0x28')](0x194);}return _0x27a3d9;};}function handleError(_0x1f4595,_0x463823){_0x463823=_0x463823||0x1f4;return function(_0x364d03){logger[_0x27ff('0x23')](_0x364d03[_0x27ff('0x36')]);if(_0x364d03[_0x27ff('0x37')]){delete _0x364d03[_0x27ff('0x37')];}_0x1f4595['status'](_0x463823)[_0x27ff('0x38')](_0x364d03);};}exports['index']=function(_0x51333b,_0x535caf){var _0x578f98={},_0x5cbf34={},_0x595698={'count':0x0,'rows':[]};var _0x269f1d=_[_0x27ff('0x39')](db[_0x27ff('0x3a')][_0x27ff('0x3b')],function(_0xe3ebf6){return{'name':_0xe3ebf6[_0x27ff('0x3c')],'type':_0xe3ebf6[_0x27ff('0x3d')][_0x27ff('0x3e')]};});_0x5cbf34['model']=_[_0x27ff('0x39')](_0x269f1d,_0x27ff('0x37'));_0x5cbf34[_0x27ff('0x3f')]=_[_0x27ff('0x40')](_0x51333b[_0x27ff('0x3f')]);_0x5cbf34['filters']=_['intersection'](_0x5cbf34['model'],_0x5cbf34[_0x27ff('0x3f')]);_0x578f98['attributes']=_[_0x27ff('0x41')](_0x5cbf34['model'],qs[_0x27ff('0x42')](_0x51333b['query']['fields']));_0x578f98[_0x27ff('0x43')]=_0x578f98[_0x27ff('0x43')][_0x27ff('0x44')]?_0x578f98['attributes']:_0x5cbf34[_0x27ff('0x45')];if(!_0x51333b['query'][_0x27ff('0x46')]('nolimit')){_0x578f98[_0x27ff('0x2f')]=qs[_0x27ff('0x2f')](_0x51333b[_0x27ff('0x3f')][_0x27ff('0x2f')]);_0x578f98[_0x27ff('0x2c')]=qs[_0x27ff('0x2c')](_0x51333b['query']['offset']);}_0x578f98[_0x27ff('0x47')]=qs[_0x27ff('0x48')](_0x51333b[_0x27ff('0x3f')]['sort']);_0x578f98[_0x27ff('0x49')]=qs[_0x27ff('0x4a')](_[_0x27ff('0x4b')](_0x51333b[_0x27ff('0x3f')],_0x5cbf34[_0x27ff('0x4a')]),_0x269f1d);if(_0x51333b['query'][_0x27ff('0x4c')]){_0x578f98[_0x27ff('0x49')]=_[_0x27ff('0x4d')](_0x578f98[_0x27ff('0x49')],{'$or':_['map'](_0x269f1d,function(_0x10a050){if(_0x10a050[_0x27ff('0x3d')]!=='VIRTUAL'){var _0x190e32={};_0x190e32[_0x10a050[_0x27ff('0x37')]]={'$like':'%'+_0x51333b['query'][_0x27ff('0x4c')]+'%'};return _0x190e32;}})});}_0x578f98=_[_0x27ff('0x4d')]({},_0x578f98,_0x51333b[_0x27ff('0x4e')]);var _0x33034d={'where':_0x578f98[_0x27ff('0x49')]};return db['ChatGroup']['count'](_0x33034d)['then'](function(_0x2eb9a1){_0x595698[_0x27ff('0x2e')]=_0x2eb9a1;if(_0x51333b[_0x27ff('0x3f')][_0x27ff('0x4f')]){_0x578f98[_0x27ff('0x50')]=[{'all':!![]}];}return db['ChatGroup'][_0x27ff('0x51')](_0x578f98);})[_0x27ff('0x1f')](function(_0x145423){_0x595698['rows']=_0x145423;return _0x595698;})['then'](respondWithFilteredResult(_0x535caf,_0x578f98))[_0x27ff('0x27')](handleError(_0x535caf,null));};exports[_0x27ff('0x52')]=function(_0x45cbc9,_0x4837e0){var _0x3ff234={'raw':!![],'where':{'id':_0x45cbc9[_0x27ff('0x53')]['id']}},_0x5c746b={};_0x5c746b[_0x27ff('0x45')]=_[_0x27ff('0x40')](db[_0x27ff('0x3a')][_0x27ff('0x3b')]);_0x5c746b[_0x27ff('0x3f')]=_['keys'](_0x45cbc9[_0x27ff('0x3f')]);_0x5c746b['filters']=_[_0x27ff('0x41')](_0x5c746b[_0x27ff('0x45')],_0x5c746b[_0x27ff('0x3f')]);_0x3ff234['attributes']=_[_0x27ff('0x41')](_0x5c746b[_0x27ff('0x45')],qs[_0x27ff('0x42')](_0x45cbc9[_0x27ff('0x3f')][_0x27ff('0x42')]));_0x3ff234[_0x27ff('0x43')]=_0x3ff234[_0x27ff('0x43')][_0x27ff('0x44')]?_0x3ff234[_0x27ff('0x43')]:_0x5c746b[_0x27ff('0x45')];if(_0x45cbc9[_0x27ff('0x3f')][_0x27ff('0x4f')]){_0x3ff234['include']=[{'all':!![]}];}_0x3ff234=_[_0x27ff('0x4d')]({},_0x3ff234,_0x45cbc9[_0x27ff('0x4e')]);return db['ChatGroup'][_0x27ff('0x54')](_0x3ff234)[_0x27ff('0x1f')](handleEntityNotFound(_0x4837e0,null))['then'](respondWithResult(_0x4837e0,null))[_0x27ff('0x27')](handleError(_0x4837e0,null));};exports[_0x27ff('0x55')]=function(_0x483895,_0x47afe2){return db[_0x27ff('0x3a')]['create'](_0x483895[_0x27ff('0x56')],{})['then'](respondWithResult(_0x47afe2,0xc9))[_0x27ff('0x27')](handleError(_0x47afe2,null));};exports['update']=function(_0x28c0b3,_0x164347){if(_0x28c0b3[_0x27ff('0x56')]['id']){delete _0x28c0b3[_0x27ff('0x56')]['id'];}return db[_0x27ff('0x3a')][_0x27ff('0x54')]({'where':{'id':_0x28c0b3[_0x27ff('0x53')]['id']}})[_0x27ff('0x1f')](handleEntityNotFound(_0x164347,null))['then'](saveUpdates(_0x28c0b3[_0x27ff('0x56')],null))['then'](respondWithResult(_0x164347,null))[_0x27ff('0x27')](handleError(_0x164347,null));};exports[_0x27ff('0x35')]=function(_0x5ef31d,_0x100b42){return db[_0x27ff('0x3a')][_0x27ff('0x54')]({'where':{'id':_0x5ef31d[_0x27ff('0x53')]['id']}})[_0x27ff('0x1f')](handleEntityNotFound(_0x100b42,null))[_0x27ff('0x1f')](removeEntity(_0x100b42,null))['catch'](handleError(_0x100b42,null));};exports[_0x27ff('0x57')]=function(_0x140446,_0xfdb2b6){return db['ChatGroup']['describe']()['then'](respondWithResult(_0xfdb2b6,null))[_0x27ff('0x27')](handleError(_0xfdb2b6,null));};exports[_0x27ff('0x58')]=function(_0x1944ce,_0x536274,_0x16d266){return db[_0x27ff('0x59')][_0x27ff('0x2e')]({'where':{'ChatGroupId':_0x1944ce[_0x27ff('0x53')]['id'],'ToId':_0x1944ce['user']['id'],'read':![]}})[_0x27ff('0x1f')](function(_0x2dcf98){return{'id':_[_0x27ff('0x5a')](_0x1944ce[_0x27ff('0x53')]['id']),'count':_0x2dcf98};})['then'](respondWithResult(_0x536274,null))['catch'](handleError(_0x536274,null));};exports[_0x27ff('0x5b')]=function(_0x2a7101,_0xd7c37c,_0x20ba28){return db[_0x27ff('0x3a')]['find']({'where':{'id':_0x2a7101[_0x27ff('0x53')]['id']}})['then'](handleEntityNotFound(_0xd7c37c,null))[_0x27ff('0x1f')](function(_0x5787f2){if(_0x5787f2){return _0x5787f2['addMembers'](_0x2a7101[_0x27ff('0x56')][_0x27ff('0x5c')],_[_0x27ff('0x5d')](_0x2a7101[_0x27ff('0x56')],['ids','id'])||{});}})[_0x27ff('0x1f')](respondWithResult(_0xd7c37c,null))[_0x27ff('0x27')](handleError(_0xd7c37c,null));};exports[_0x27ff('0x5e')]=function(_0x1238d6,_0x12d831,_0x2b6a95){var _0x4a9628={};var _0x5d0dda={};var _0x2b2b51;var _0x4d7a58;return db[_0x27ff('0x3a')][_0x27ff('0x5f')]({'where':{'id':_0x1238d6[_0x27ff('0x53')]['id']}})['then'](handleEntityNotFound(_0x12d831,null))[_0x27ff('0x1f')](function(_0x1cb6ea){if(_0x1cb6ea){_0x2b2b51=_0x1cb6ea;_0x5d0dda[_0x27ff('0x45')]=_[_0x27ff('0x40')](db[_0x27ff('0x60')][_0x27ff('0x3b')]);_0x5d0dda['query']=_[_0x27ff('0x40')](_0x1238d6[_0x27ff('0x3f')]);_0x5d0dda[_0x27ff('0x4a')]=_[_0x27ff('0x41')](_0x5d0dda[_0x27ff('0x45')],_0x5d0dda[_0x27ff('0x3f')]);_0x4a9628['attributes']=_[_0x27ff('0x41')](_0x5d0dda[_0x27ff('0x45')],qs[_0x27ff('0x42')](_0x1238d6[_0x27ff('0x3f')][_0x27ff('0x42')]));_0x4a9628[_0x27ff('0x43')]=_0x4a9628[_0x27ff('0x43')][_0x27ff('0x44')]?_0x4a9628['attributes']:_0x5d0dda[_0x27ff('0x45')];_0x4a9628['order']=qs['sort'](_0x1238d6['query']['sort']);_0x4a9628[_0x27ff('0x49')]=qs[_0x27ff('0x4a')](_['pick'](_0x1238d6[_0x27ff('0x3f')],_0x5d0dda[_0x27ff('0x4a')]));if(_0x1238d6[_0x27ff('0x3f')]['filter']){_0x4a9628['where']=_[_0x27ff('0x4d')](_0x4a9628[_0x27ff('0x49')],{'$or':_[_0x27ff('0x39')](_0x4a9628['attributes'],function(_0x288a8b){var _0x1d9de6={};_0x1d9de6[_0x288a8b]={'$like':'%'+_0x1238d6[_0x27ff('0x3f')][_0x27ff('0x4c')]+'%'};return _0x1d9de6;})});}_0x4a9628=_[_0x27ff('0x4d')]({},_0x4a9628,_0x1238d6[_0x27ff('0x4e')]);return _0x2b2b51['getMembers'](_0x4a9628);}})[_0x27ff('0x1f')](function(_0x2e0263){if(_0x2e0263){_0x4d7a58=_0x2e0263['length'];if(!_0x1238d6[_0x27ff('0x3f')][_0x27ff('0x46')](_0x27ff('0x61'))){_0x4a9628[_0x27ff('0x2f')]=qs[_0x27ff('0x2f')](_0x1238d6[_0x27ff('0x3f')][_0x27ff('0x2f')]);_0x4a9628[_0x27ff('0x2c')]=qs['offset'](_0x1238d6[_0x27ff('0x3f')][_0x27ff('0x2c')]);}return _0x2b2b51[_0x27ff('0x5e')](_0x4a9628);}})[_0x27ff('0x1f')](function(_0x132493){if(_0x132493){return _0x132493?{'count':_0x4d7a58,'rows':_0x132493}:null;}})[_0x27ff('0x1f')](respondWithResult(_0x12d831,null))[_0x27ff('0x27')](handleError(_0x12d831,null));};exports[_0x27ff('0x62')]=function(_0x108948,_0x22b404,_0x4f6c6d){return db[_0x27ff('0x3a')][_0x27ff('0x54')]({'where':{'id':_0x108948[_0x27ff('0x53')]['id']}})[_0x27ff('0x1f')](handleEntityNotFound(_0x22b404,null))[_0x27ff('0x1f')](function(_0x4e2549){if(_0x4e2549){return _0x4e2549[_0x27ff('0x62')](_0x108948[_0x27ff('0x3f')]['ids']);}})['then'](respondWithStatusCode(_0x22b404,null))[_0x27ff('0x27')](handleError(_0x22b404,null));};exports[_0x27ff('0x63')]=function(_0x75f5df,_0x311c11,_0x163982){if(_0x75f5df['body']['id']){delete _0x75f5df[_0x27ff('0x56')]['id'];}return db[_0x27ff('0x3a')][_0x27ff('0x54')]({'where':{'id':_0x75f5df[_0x27ff('0x53')]['id']}})[_0x27ff('0x1f')](handleEntityNotFound(_0x311c11,null))[_0x27ff('0x1f')](function(_0x53aedc){if(_0x53aedc){_0x75f5df[_0x27ff('0x56')][_0x27ff('0x64')]=_0x53aedc['id'];return db['ChatInternalMessage'][_0x27ff('0x55')](_0x75f5df[_0x27ff('0x56')]);}})[_0x27ff('0x1f')](respondWithResult(_0x311c11,null))['catch'](handleError(_0x311c11,null));};exports[_0x27ff('0x65')]=function(_0x5d9249,_0x2e736e,_0x39989b){var _0x1160c5={};var _0x563dd9={};var _0x44a355;var _0x4f0ca3;return db[_0x27ff('0x3a')][_0x27ff('0x5f')]({'where':{'id':_0x5d9249[_0x27ff('0x53')]['id']}})[_0x27ff('0x1f')](handleEntityNotFound(_0x2e736e,null))[_0x27ff('0x1f')](function(_0x298a65){if(_0x298a65){_0x44a355=_0x298a65;_0x563dd9[_0x27ff('0x45')]=_[_0x27ff('0x40')](db[_0x27ff('0x59')][_0x27ff('0x3b')]);_0x563dd9[_0x27ff('0x3f')]=_[_0x27ff('0x40')](_0x5d9249[_0x27ff('0x3f')]);_0x563dd9[_0x27ff('0x4a')]=_['intersection'](_0x563dd9[_0x27ff('0x45')],_0x563dd9[_0x27ff('0x3f')]);_0x1160c5[_0x27ff('0x43')]=_[_0x27ff('0x41')](_0x563dd9['model'],qs['fields'](_0x5d9249[_0x27ff('0x3f')][_0x27ff('0x42')]));_0x1160c5[_0x27ff('0x43')]=_0x1160c5['attributes'][_0x27ff('0x44')]?_0x1160c5['attributes']:_0x563dd9[_0x27ff('0x45')];_0x1160c5[_0x27ff('0x47')]=qs[_0x27ff('0x48')](_0x5d9249[_0x27ff('0x3f')][_0x27ff('0x48')]);_0x1160c5[_0x27ff('0x49')]=qs[_0x27ff('0x4a')](_[_0x27ff('0x4b')](_0x5d9249[_0x27ff('0x3f')],_0x563dd9[_0x27ff('0x4a')]));if(_0x5d9249['query'][_0x27ff('0x4c')]){_0x1160c5['where']=_[_0x27ff('0x4d')](_0x1160c5[_0x27ff('0x49')],{'$or':_['map'](_0x1160c5[_0x27ff('0x43')],function(_0x221962){var _0x1de881={};_0x1de881[_0x221962]={'$like':'%'+_0x5d9249[_0x27ff('0x3f')]['filter']+'%'};return _0x1de881;})});}if(_0x5d9249[_0x27ff('0x3f')][_0x27ff('0x66')]){var _0x360094=_0x5d9249[_0x27ff('0x3f')]['$gte'][_0x27ff('0x67')](',');var _0x25186d={};_0x25186d[_0x360094[0x0]]={'$gte':moment(_0x360094[0x1])[_0x27ff('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1160c5[_0x27ff('0x49')]=_['merge'](_0x1160c5[_0x27ff('0x49')],_0x25186d);}_0x1160c5=_['merge']({},_0x1160c5,_0x5d9249['options']);return _0x44a355[_0x27ff('0x65')](_0x1160c5);}})[_0x27ff('0x1f')](function(_0x4b365f){if(_0x4b365f){_0x4f0ca3=_0x4b365f[_0x27ff('0x44')];if(!_0x5d9249[_0x27ff('0x3f')][_0x27ff('0x46')](_0x27ff('0x61'))){_0x1160c5['limit']=qs[_0x27ff('0x2f')](_0x5d9249['query'][_0x27ff('0x2f')]);_0x1160c5[_0x27ff('0x2c')]=qs[_0x27ff('0x2c')](_0x5d9249['query'][_0x27ff('0x2c')]);}return _0x44a355[_0x27ff('0x65')](_0x1160c5);}})[_0x27ff('0x1f')](function(_0x1c88f1){if(_0x1c88f1){return _0x1c88f1?{'count':_0x4f0ca3,'rows':_0x1c88f1}:null;}})['then'](respondWithResult(_0x2e736e,null))[_0x27ff('0x27')](handleError(_0x2e736e,null));}; \ No newline at end of file +var _0x6cd3=['rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','ChatGroup','includeAll','include','rows','show','params','fields','find','create','body','destroy','describe','getUnread','user','toInteger','addMembers','omit','ids','getMembers','findOne','removeMembers','addMessage','ChatInternalMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatGroup.socket','register','jayson/promise','http','then','info','request\x20sent','debug','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','stack','name','send','index','map'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0x6cd3,0x107));var _0x36cd=function(_0x4d7f3f,_0x4d2803){_0x4d7f3f=_0x4d7f3f-0x0;var _0x5d67cc=_0x6cd3[_0x4d7f3f];return _0x5d67cc;};'use strict';var emlformat=require(_0x36cd('0x0'));var rimraf=require(_0x36cd('0x1'));var zipdir=require(_0x36cd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x36cd('0x3'));var moment=require(_0x36cd('0x4'));var BPromise=require(_0x36cd('0x5'));var Mustache=require('mustache');var util=require(_0x36cd('0x6'));var path=require(_0x36cd('0x7'));var sox=require(_0x36cd('0x8'));var csv=require(_0x36cd('0x9'));var ejs=require(_0x36cd('0xa'));var fs=require('fs');var fs_extra=require(_0x36cd('0xb'));var _=require(_0x36cd('0xc'));var squel=require(_0x36cd('0xd'));var crypto=require(_0x36cd('0xe'));var jsforce=require(_0x36cd('0xf'));var deskjs=require(_0x36cd('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x36cd('0x11'));var Redis=require(_0x36cd('0x12'));var authService=require(_0x36cd('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x36cd('0x14'));var hardwareService=require(_0x36cd('0x15'));var logger=require('../../config/logger')(_0x36cd('0x16'));var utils=require('../../config/utils');var config=require(_0x36cd('0x17'));var licenseUtil=require(_0x36cd('0x18'));var db=require('../../mysqldb')['db'];config[_0x36cd('0x19')]=_[_0x36cd('0x1a')](config[_0x36cd('0x19')],{'host':_0x36cd('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x36cd('0x19')]));require(_0x36cd('0x1c'))[_0x36cd('0x1d')](socket);var jayson=require(_0x36cd('0x1e'));var client=jayson['client'][_0x36cd('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x19969a,_0x5828f7,_0x5b3188,_0x479641){return new BPromise(function(_0x3d83ec,_0x209a68){var _0x2755d4=_0x479641||client;return _0x2755d4['request'](_0x19969a,_0x5b3188)[_0x36cd('0x20')](function(_0x361be0){logger[_0x36cd('0x21')]('ChatGroup,\x20%s,\x20%s',_0x5828f7,_0x36cd('0x22'));logger[_0x36cd('0x23')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5828f7,'request\x20sent',JSON[_0x36cd('0x24')](_0x361be0));if(_0x361be0[_0x36cd('0x25')]){if(_0x361be0[_0x36cd('0x25')][_0x36cd('0x26')]===0x1f4){logger[_0x36cd('0x25')](_0x36cd('0x27'),_0x5828f7,_0x361be0[_0x36cd('0x25')]['message']);return _0x209a68(_0x361be0[_0x36cd('0x25')]['message']);}logger[_0x36cd('0x25')](_0x36cd('0x27'),_0x5828f7,_0x361be0[_0x36cd('0x25')][_0x36cd('0x28')]);return _0x3d83ec(_0x361be0[_0x36cd('0x25')]['message']);}else{logger[_0x36cd('0x21')]('ChatGroup,\x20%s,\x20%s',_0x5828f7,_0x36cd('0x22'));_0x3d83ec(_0x361be0[_0x36cd('0x29')]['message']);}})[_0x36cd('0x2a')](function(_0x5af218){logger[_0x36cd('0x25')]('ChatGroup,\x20%s,\x20%s',_0x5828f7,_0x5af218);_0x209a68(_0x5af218);});});}function respondWithStatusCode(_0x3f789e,_0x453742){_0x453742=_0x453742||0xcc;return function(_0x158c5d){if(_0x158c5d){return _0x3f789e[_0x36cd('0x2b')](_0x453742);}return _0x3f789e[_0x36cd('0x2c')](_0x453742)[_0x36cd('0x2d')]();};}function respondWithResult(_0x5b466a,_0x2c7e80){_0x2c7e80=_0x2c7e80||0xc8;return function(_0x329dd0){if(_0x329dd0){return _0x5b466a[_0x36cd('0x2c')](_0x2c7e80)[_0x36cd('0x2e')](_0x329dd0);}};}function respondWithFilteredResult(_0x30765d,_0xfec836){return function(_0x5b4bc2){if(_0x5b4bc2){var _0x52b979=typeof _0xfec836['offset']===_0x36cd('0x2f')&&typeof _0xfec836[_0x36cd('0x30')]===_0x36cd('0x2f');var _0x5e5c18=_0x5b4bc2[_0x36cd('0x31')];var _0x43450a=_0x52b979?0x0:_0xfec836[_0x36cd('0x32')];var _0x132c6=_0x52b979?_0x5b4bc2[_0x36cd('0x31')]:_0xfec836[_0x36cd('0x32')]+_0xfec836[_0x36cd('0x30')];var _0x89e113;if(_0x132c6>=_0x5e5c18){_0x132c6=_0x5e5c18;_0x89e113=0xc8;}else{_0x89e113=0xce;}_0x30765d['status'](_0x89e113);return _0x30765d[_0x36cd('0x33')](_0x36cd('0x34'),_0x43450a+'-'+_0x132c6+'/'+_0x5e5c18)[_0x36cd('0x2e')](_0x5b4bc2);}return null;};}function patchUpdates(_0x180fc2){return function(_0x5c9c17){try{jsonpatch[_0x36cd('0x35')](_0x5c9c17,_0x180fc2,!![]);}catch(_0x3d8a76){return BPromise[_0x36cd('0x36')](_0x3d8a76);}return _0x5c9c17['save']();};}function saveUpdates(_0x447a0d,_0x25db1c){return function(_0x2421af){if(_0x2421af){return _0x2421af[_0x36cd('0x37')](_0x447a0d)[_0x36cd('0x20')](function(_0x15f9f0){return _0x15f9f0;});}return null;};}function removeEntity(_0x37e920,_0xaa0c3e){return function(_0x40123e){if(_0x40123e){return _0x40123e['destroy']()[_0x36cd('0x20')](function(){_0x37e920[_0x36cd('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d0e2f,_0x50f707){return function(_0x44b3b6){if(!_0x44b3b6){_0x3d0e2f[_0x36cd('0x2b')](0x194);}return _0x44b3b6;};}function handleError(_0x4dd779,_0x24b23e){_0x24b23e=_0x24b23e||0x1f4;return function(_0x10f214){logger[_0x36cd('0x25')](_0x10f214[_0x36cd('0x38')]);if(_0x10f214[_0x36cd('0x39')]){delete _0x10f214['name'];}_0x4dd779[_0x36cd('0x2c')](_0x24b23e)[_0x36cd('0x3a')](_0x10f214);};}exports[_0x36cd('0x3b')]=function(_0x3ecfdc,_0x3df002){var _0xabafcc={},_0x2ec8f1={},_0x584415={'count':0x0,'rows':[]};var _0x628db=_[_0x36cd('0x3c')](db['ChatGroup'][_0x36cd('0x3d')],function(_0x150f14){return{'name':_0x150f14[_0x36cd('0x3e')],'type':_0x150f14[_0x36cd('0x3f')]['key']};});_0x2ec8f1['model']=_[_0x36cd('0x3c')](_0x628db,_0x36cd('0x39'));_0x2ec8f1['query']=_[_0x36cd('0x40')](_0x3ecfdc[_0x36cd('0x41')]);_0x2ec8f1[_0x36cd('0x42')]=_[_0x36cd('0x43')](_0x2ec8f1[_0x36cd('0x44')],_0x2ec8f1[_0x36cd('0x41')]);_0xabafcc[_0x36cd('0x45')]=_[_0x36cd('0x43')](_0x2ec8f1[_0x36cd('0x44')],qs['fields'](_0x3ecfdc[_0x36cd('0x41')]['fields']));_0xabafcc[_0x36cd('0x45')]=_0xabafcc[_0x36cd('0x45')][_0x36cd('0x46')]?_0xabafcc[_0x36cd('0x45')]:_0x2ec8f1['model'];if(!_0x3ecfdc[_0x36cd('0x41')][_0x36cd('0x47')](_0x36cd('0x48'))){_0xabafcc[_0x36cd('0x30')]=qs[_0x36cd('0x30')](_0x3ecfdc['query'][_0x36cd('0x30')]);_0xabafcc['offset']=qs[_0x36cd('0x32')](_0x3ecfdc['query']['offset']);}_0xabafcc[_0x36cd('0x49')]=qs[_0x36cd('0x4a')](_0x3ecfdc[_0x36cd('0x41')][_0x36cd('0x4a')]);_0xabafcc['where']=qs['filters'](_[_0x36cd('0x4b')](_0x3ecfdc[_0x36cd('0x41')],_0x2ec8f1[_0x36cd('0x42')]),_0x628db);if(_0x3ecfdc['query'][_0x36cd('0x4c')]){_0xabafcc['where']=_[_0x36cd('0x4d')](_0xabafcc[_0x36cd('0x4e')],{'$or':_[_0x36cd('0x3c')](_0x628db,function(_0x40f86e){if(_0x40f86e[_0x36cd('0x3f')]!=='VIRTUAL'){var _0x12edf4={};_0x12edf4[_0x40f86e[_0x36cd('0x39')]]={'$like':'%'+_0x3ecfdc[_0x36cd('0x41')][_0x36cd('0x4c')]+'%'};return _0x12edf4;}})});}_0xabafcc=_[_0x36cd('0x4d')]({},_0xabafcc,_0x3ecfdc[_0x36cd('0x4f')]);var _0x336741={'where':_0xabafcc[_0x36cd('0x4e')]};return db[_0x36cd('0x50')]['count'](_0x336741)[_0x36cd('0x20')](function(_0x308a37){_0x584415['count']=_0x308a37;if(_0x3ecfdc[_0x36cd('0x41')][_0x36cd('0x51')]){_0xabafcc[_0x36cd('0x52')]=[{'all':!![]}];}return db[_0x36cd('0x50')]['findAll'](_0xabafcc);})[_0x36cd('0x20')](function(_0x1a0f1d){_0x584415[_0x36cd('0x53')]=_0x1a0f1d;return _0x584415;})['then'](respondWithFilteredResult(_0x3df002,_0xabafcc))[_0x36cd('0x2a')](handleError(_0x3df002,null));};exports[_0x36cd('0x54')]=function(_0x18acdd,_0x496274){var _0x252f72={'raw':!![],'where':{'id':_0x18acdd[_0x36cd('0x55')]['id']}},_0xfab180={};_0xfab180[_0x36cd('0x44')]=_[_0x36cd('0x40')](db[_0x36cd('0x50')][_0x36cd('0x3d')]);_0xfab180[_0x36cd('0x41')]=_[_0x36cd('0x40')](_0x18acdd['query']);_0xfab180['filters']=_['intersection'](_0xfab180['model'],_0xfab180[_0x36cd('0x41')]);_0x252f72[_0x36cd('0x45')]=_[_0x36cd('0x43')](_0xfab180[_0x36cd('0x44')],qs[_0x36cd('0x56')](_0x18acdd[_0x36cd('0x41')]['fields']));_0x252f72[_0x36cd('0x45')]=_0x252f72[_0x36cd('0x45')][_0x36cd('0x46')]?_0x252f72[_0x36cd('0x45')]:_0xfab180[_0x36cd('0x44')];if(_0x18acdd[_0x36cd('0x41')][_0x36cd('0x51')]){_0x252f72['include']=[{'all':!![]}];}_0x252f72=_[_0x36cd('0x4d')]({},_0x252f72,_0x18acdd[_0x36cd('0x4f')]);return db[_0x36cd('0x50')][_0x36cd('0x57')](_0x252f72)[_0x36cd('0x20')](handleEntityNotFound(_0x496274,null))[_0x36cd('0x20')](respondWithResult(_0x496274,null))[_0x36cd('0x2a')](handleError(_0x496274,null));};exports[_0x36cd('0x58')]=function(_0x3ba235,_0x47e190){return db[_0x36cd('0x50')][_0x36cd('0x58')](_0x3ba235[_0x36cd('0x59')],{})[_0x36cd('0x20')](respondWithResult(_0x47e190,0xc9))[_0x36cd('0x2a')](handleError(_0x47e190,null));};exports[_0x36cd('0x37')]=function(_0x56c369,_0x563c45){if(_0x56c369[_0x36cd('0x59')]['id']){delete _0x56c369[_0x36cd('0x59')]['id'];}return db[_0x36cd('0x50')][_0x36cd('0x57')]({'where':{'id':_0x56c369[_0x36cd('0x55')]['id']}})[_0x36cd('0x20')](handleEntityNotFound(_0x563c45,null))[_0x36cd('0x20')](saveUpdates(_0x56c369[_0x36cd('0x59')],null))[_0x36cd('0x20')](respondWithResult(_0x563c45,null))[_0x36cd('0x2a')](handleError(_0x563c45,null));};exports[_0x36cd('0x5a')]=function(_0x49dac9,_0x39c022){return db[_0x36cd('0x50')][_0x36cd('0x57')]({'where':{'id':_0x49dac9[_0x36cd('0x55')]['id']}})['then'](handleEntityNotFound(_0x39c022,null))['then'](removeEntity(_0x39c022,null))['catch'](handleError(_0x39c022,null));};exports[_0x36cd('0x5b')]=function(_0x350ba5,_0x198c81){return db[_0x36cd('0x50')]['describe']()[_0x36cd('0x20')](respondWithResult(_0x198c81,null))['catch'](handleError(_0x198c81,null));};exports[_0x36cd('0x5c')]=function(_0xba53e9,_0x61fa75,_0x43af30){return db['ChatInternalMessage'][_0x36cd('0x31')]({'where':{'ChatGroupId':_0xba53e9[_0x36cd('0x55')]['id'],'ToId':_0xba53e9[_0x36cd('0x5d')]['id'],'read':![]}})[_0x36cd('0x20')](function(_0xd7904f){return{'id':_[_0x36cd('0x5e')](_0xba53e9[_0x36cd('0x55')]['id']),'count':_0xd7904f};})[_0x36cd('0x20')](respondWithResult(_0x61fa75,null))[_0x36cd('0x2a')](handleError(_0x61fa75,null));};exports[_0x36cd('0x5f')]=function(_0x5c9c4d,_0x5c78d5,_0x27da35){return db[_0x36cd('0x50')]['find']({'where':{'id':_0x5c9c4d[_0x36cd('0x55')]['id']}})['then'](handleEntityNotFound(_0x5c78d5,null))[_0x36cd('0x20')](function(_0x474512){if(_0x474512){return _0x474512[_0x36cd('0x5f')](_0x5c9c4d[_0x36cd('0x59')]['ids'],_[_0x36cd('0x60')](_0x5c9c4d[_0x36cd('0x59')],[_0x36cd('0x61'),'id'])||{});}})['then'](respondWithResult(_0x5c78d5,null))[_0x36cd('0x2a')](handleError(_0x5c78d5,null));};exports[_0x36cd('0x62')]=function(_0xc52dfa,_0x30f924,_0x440d95){var _0x285b1d={};var _0xc3308d={};var _0x5e502a;var _0x1511f2;return db[_0x36cd('0x50')][_0x36cd('0x63')]({'where':{'id':_0xc52dfa[_0x36cd('0x55')]['id']}})[_0x36cd('0x20')](handleEntityNotFound(_0x30f924,null))[_0x36cd('0x20')](function(_0x2acf90){if(_0x2acf90){_0x5e502a=_0x2acf90;_0xc3308d[_0x36cd('0x44')]=_['keys'](db['User'][_0x36cd('0x3d')]);_0xc3308d[_0x36cd('0x41')]=_[_0x36cd('0x40')](_0xc52dfa[_0x36cd('0x41')]);_0xc3308d['filters']=_['intersection'](_0xc3308d[_0x36cd('0x44')],_0xc3308d[_0x36cd('0x41')]);_0x285b1d[_0x36cd('0x45')]=_[_0x36cd('0x43')](_0xc3308d[_0x36cd('0x44')],qs[_0x36cd('0x56')](_0xc52dfa[_0x36cd('0x41')][_0x36cd('0x56')]));_0x285b1d[_0x36cd('0x45')]=_0x285b1d[_0x36cd('0x45')]['length']?_0x285b1d[_0x36cd('0x45')]:_0xc3308d[_0x36cd('0x44')];_0x285b1d[_0x36cd('0x49')]=qs[_0x36cd('0x4a')](_0xc52dfa[_0x36cd('0x41')][_0x36cd('0x4a')]);_0x285b1d[_0x36cd('0x4e')]=qs['filters'](_[_0x36cd('0x4b')](_0xc52dfa[_0x36cd('0x41')],_0xc3308d[_0x36cd('0x42')]));if(_0xc52dfa[_0x36cd('0x41')]['filter']){_0x285b1d[_0x36cd('0x4e')]=_[_0x36cd('0x4d')](_0x285b1d['where'],{'$or':_['map'](_0x285b1d['attributes'],function(_0x4a06a0){var _0x3822ad={};_0x3822ad[_0x4a06a0]={'$like':'%'+_0xc52dfa[_0x36cd('0x41')][_0x36cd('0x4c')]+'%'};return _0x3822ad;})});}_0x285b1d=_[_0x36cd('0x4d')]({},_0x285b1d,_0xc52dfa[_0x36cd('0x4f')]);return _0x5e502a[_0x36cd('0x62')](_0x285b1d);}})[_0x36cd('0x20')](function(_0x307b58){if(_0x307b58){_0x1511f2=_0x307b58['length'];if(!_0xc52dfa[_0x36cd('0x41')][_0x36cd('0x47')](_0x36cd('0x48'))){_0x285b1d['limit']=qs[_0x36cd('0x30')](_0xc52dfa[_0x36cd('0x41')][_0x36cd('0x30')]);_0x285b1d[_0x36cd('0x32')]=qs[_0x36cd('0x32')](_0xc52dfa[_0x36cd('0x41')][_0x36cd('0x32')]);}return _0x5e502a[_0x36cd('0x62')](_0x285b1d);}})['then'](function(_0x50c23c){if(_0x50c23c){return _0x50c23c?{'count':_0x1511f2,'rows':_0x50c23c}:null;}})[_0x36cd('0x20')](respondWithResult(_0x30f924,null))[_0x36cd('0x2a')](handleError(_0x30f924,null));};exports[_0x36cd('0x64')]=function(_0xd9714,_0x102d2a,_0x308318){return db[_0x36cd('0x50')]['find']({'where':{'id':_0xd9714[_0x36cd('0x55')]['id']}})[_0x36cd('0x20')](handleEntityNotFound(_0x102d2a,null))[_0x36cd('0x20')](function(_0x1cea0c){if(_0x1cea0c){return _0x1cea0c[_0x36cd('0x64')](_0xd9714[_0x36cd('0x41')][_0x36cd('0x61')]);}})[_0x36cd('0x20')](respondWithStatusCode(_0x102d2a,null))[_0x36cd('0x2a')](handleError(_0x102d2a,null));};exports[_0x36cd('0x65')]=function(_0x28df2d,_0x2dd5de,_0x5998fc){if(_0x28df2d[_0x36cd('0x59')]['id']){delete _0x28df2d[_0x36cd('0x59')]['id'];}return db['ChatGroup'][_0x36cd('0x57')]({'where':{'id':_0x28df2d['params']['id']}})[_0x36cd('0x20')](handleEntityNotFound(_0x2dd5de,null))[_0x36cd('0x20')](function(_0x15a0dc){if(_0x15a0dc){_0x28df2d['body']['ChatGroupId']=_0x15a0dc['id'];return db[_0x36cd('0x66')][_0x36cd('0x58')](_0x28df2d[_0x36cd('0x59')]);}})['then'](respondWithResult(_0x2dd5de,null))[_0x36cd('0x2a')](handleError(_0x2dd5de,null));};exports['getMessages']=function(_0x1d40d3,_0x10172d,_0x3498b4){var _0x39f199={};var _0x5d8e71={};var _0x584c73;var _0x37d9db;return db[_0x36cd('0x50')][_0x36cd('0x63')]({'where':{'id':_0x1d40d3[_0x36cd('0x55')]['id']}})[_0x36cd('0x20')](handleEntityNotFound(_0x10172d,null))[_0x36cd('0x20')](function(_0x1cb1da){if(_0x1cb1da){_0x584c73=_0x1cb1da;_0x5d8e71[_0x36cd('0x44')]=_[_0x36cd('0x40')](db[_0x36cd('0x66')][_0x36cd('0x3d')]);_0x5d8e71[_0x36cd('0x41')]=_[_0x36cd('0x40')](_0x1d40d3['query']);_0x5d8e71[_0x36cd('0x42')]=_[_0x36cd('0x43')](_0x5d8e71[_0x36cd('0x44')],_0x5d8e71['query']);_0x39f199['attributes']=_[_0x36cd('0x43')](_0x5d8e71[_0x36cd('0x44')],qs['fields'](_0x1d40d3['query'][_0x36cd('0x56')]));_0x39f199[_0x36cd('0x45')]=_0x39f199[_0x36cd('0x45')]['length']?_0x39f199[_0x36cd('0x45')]:_0x5d8e71[_0x36cd('0x44')];_0x39f199[_0x36cd('0x49')]=qs[_0x36cd('0x4a')](_0x1d40d3[_0x36cd('0x41')][_0x36cd('0x4a')]);_0x39f199['where']=qs['filters'](_[_0x36cd('0x4b')](_0x1d40d3[_0x36cd('0x41')],_0x5d8e71[_0x36cd('0x42')]));if(_0x1d40d3[_0x36cd('0x41')]['filter']){_0x39f199[_0x36cd('0x4e')]=_[_0x36cd('0x4d')](_0x39f199['where'],{'$or':_[_0x36cd('0x3c')](_0x39f199[_0x36cd('0x45')],function(_0x143656){var _0x33c44c={};_0x33c44c[_0x143656]={'$like':'%'+_0x1d40d3[_0x36cd('0x41')][_0x36cd('0x4c')]+'%'};return _0x33c44c;})});}if(_0x1d40d3[_0x36cd('0x41')][_0x36cd('0x67')]){var _0x59aea4=_0x1d40d3[_0x36cd('0x41')]['$gte'][_0x36cd('0x68')](',');var _0x3b7eaf={};_0x3b7eaf[_0x59aea4[0x0]]={'$gte':moment(_0x59aea4[0x1])[_0x36cd('0x69')](_0x36cd('0x6a'))};_0x39f199[_0x36cd('0x4e')]=_[_0x36cd('0x4d')](_0x39f199[_0x36cd('0x4e')],_0x3b7eaf);}_0x39f199=_['merge']({},_0x39f199,_0x1d40d3['options']);return _0x584c73['getMessages'](_0x39f199);}})['then'](function(_0x46a0b9){if(_0x46a0b9){_0x37d9db=_0x46a0b9[_0x36cd('0x46')];if(!_0x1d40d3[_0x36cd('0x41')]['hasOwnProperty'](_0x36cd('0x48'))){_0x39f199[_0x36cd('0x30')]=qs[_0x36cd('0x30')](_0x1d40d3[_0x36cd('0x41')][_0x36cd('0x30')]);_0x39f199[_0x36cd('0x32')]=qs[_0x36cd('0x32')](_0x1d40d3[_0x36cd('0x41')][_0x36cd('0x32')]);}return _0x584c73[_0x36cd('0x6b')](_0x39f199);}})[_0x36cd('0x20')](function(_0xedf264){if(_0xedf264){return _0xedf264?{'count':_0x37d9db,'rows':_0xedf264}:null;}})[_0x36cd('0x20')](respondWithResult(_0x10172d,null))['catch'](handleError(_0x10172d,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 618da03..bb7619b 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 _0x2ef3=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0x2872b0,_0x4b0855){var _0x58b379=function(_0x18954b){while(--_0x18954b){_0x2872b0['push'](_0x2872b0['shift']());}};_0x58b379(++_0x4b0855);}(_0x2ef3,0xba));var _0x32ef=function(_0x110f0c,_0x39b8b3){_0x110f0c=_0x110f0c-0x0;var _0x34aefc=_0x2ef3[_0x110f0c];return _0x34aefc;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var ChatGroup=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x32ef('0x3')](0x0);var events={'afterCreate':_0x32ef('0x4'),'afterUpdate':_0x32ef('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38f865){return function(_0x38b7f3,_0x524ab6,_0x402857){ChatGroupEvents[_0x32ef('0x6')](_0x38f865+':'+_0x38b7f3['id'],_0x38b7f3);ChatGroupEvents['emit'](_0x38f865,_0x38b7f3);_0x402857(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x32ef('0x7')](e,emitEvent(event));}}module[_0x32ef('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0xadb5,0xad));var _0x5adb=function(_0x3cd509,_0x12e4a4){_0x3cd509=_0x3cd509-0x0;var _0x1093ed=_0xadb5[_0x3cd509];return _0x1093ed;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x5adb('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatGroupEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatGroupEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatGroup[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index ffd3e1a..024ffa9 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 _0x79d3=['ChatGroup','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatGroup.attributes','exports'];(function(_0x363fbe,_0x13bfe2){var _0x2d74c4=function(_0x458c09){while(--_0x458c09){_0x363fbe['push'](_0x363fbe['shift']());}};_0x2d74c4(++_0x13bfe2);}(_0x79d3,0x15f));var _0x379d=function(_0x46a50c,_0x3a7f4a){_0x46a50c=_0x46a50c-0x0;var _0x4274db=_0x79d3[_0x46a50c];return _0x4274db;};'use strict';var _=require(_0x379d('0x0'));var util=require('util');var logger=require(_0x379d('0x1'))('api');var moment=require(_0x379d('0x2'));var BPromise=require(_0x379d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x379d('0x4'));var rimraf=require(_0x379d('0x5'));var config=require(_0x379d('0x6'));var attributes=require(_0x379d('0x7'));module[_0x379d('0x8')]=function(_0x2078a6,_0x2a1b43){return _0x2078a6['define'](_0x379d('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27c9=['ChatGroup','chat_groups','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatGroup.attributes','exports','define'];(function(_0x42c08f,_0x12ebd1){var _0x7f1b3b=function(_0x5a7165){while(--_0x5a7165){_0x42c08f['push'](_0x42c08f['shift']());}};_0x7f1b3b(++_0x12ebd1);}(_0x27c9,0x1af));var _0x927c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x27c9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x927c('0x0'));var util=require(_0x927c('0x1'));var logger=require(_0x927c('0x2'))(_0x927c('0x3'));var moment=require('moment');var BPromise=require(_0x927c('0x4'));var rp=require(_0x927c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x927c('0x6'));var config=require(_0x927c('0x7'));var attributes=require(_0x927c('0x8'));module[_0x927c('0x9')]=function(_0x338730,_0x5b09de){return _0x338730[_0x927c('0xa')](_0x927c('0xb'),attributes,{'tableName':_0x927c('0xc'),'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 81c97c3..c3a482c 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 _0x38ce=['register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x1ea6c6,_0xeaa372){var _0x3c04e3=function(_0x3da708){while(--_0x3da708){_0x1ea6c6['push'](_0x1ea6c6['shift']());}};_0x3c04e3(++_0xeaa372);}(_0x38ce,0x110));var _0xe38c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x38ce[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xe38c('0x0'));var util=require(_0xe38c('0x1'));var moment=require('moment');var BPromise=require(_0xe38c('0x2'));var rs=require(_0xe38c('0x3'));var fs=require('fs');var Redis=require(_0xe38c('0x4'));var db=require(_0xe38c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe38c('0x6'));var config=require(_0xe38c('0x7'));var jayson=require(_0xe38c('0x8'));var client=jayson[_0xe38c('0x9')][_0xe38c('0xa')]({'port':0x232a});config[_0xe38c('0xb')]=_[_0xe38c('0xc')](config[_0xe38c('0xb')],{'host':_0xe38c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatGroup.socket')[_0xe38c('0xe')](socket);function respondWithRpcPromise(_0xf453a9,_0x5ebbc6,_0x611c3a){return new BPromise(function(_0x1e2060,_0x1d671c){return client[_0xe38c('0xf')](_0xf453a9,_0x611c3a)[_0xe38c('0x10')](function(_0x58e0bd){logger[_0xe38c('0x11')](_0xe38c('0x12'),_0x5ebbc6,_0xe38c('0x13'));logger[_0xe38c('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5ebbc6,_0xe38c('0x13'),JSON[_0xe38c('0x15')](_0x58e0bd));if(_0x58e0bd[_0xe38c('0x16')]){if(_0x58e0bd[_0xe38c('0x16')][_0xe38c('0x17')]===0x1f4){logger['error'](_0xe38c('0x12'),_0x5ebbc6,_0x58e0bd['error'][_0xe38c('0x18')]);return _0x1d671c(_0x58e0bd['error'][_0xe38c('0x18')]);}logger['error'](_0xe38c('0x12'),_0x5ebbc6,_0x58e0bd[_0xe38c('0x16')]['message']);return _0x1e2060(_0x58e0bd[_0xe38c('0x16')][_0xe38c('0x18')]);}else{logger[_0xe38c('0x11')](_0xe38c('0x12'),_0x5ebbc6,_0xe38c('0x13'));_0x1e2060(_0x58e0bd[_0xe38c('0x19')][_0xe38c('0x18')]);}})['catch'](function(_0x45fb1f){logger[_0xe38c('0x16')](_0xe38c('0x12'),_0x5ebbc6,_0x45fb1f);_0x1d671c(_0x45fb1f);});});} \ No newline at end of file +var _0x32e6=['debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','ChatGroup,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','request\x20sent'];(function(_0x3f618a,_0x14ece5){var _0x429a4a=function(_0x3af0ab){while(--_0x3af0ab){_0x3f618a['push'](_0x3f618a['shift']());}};_0x429a4a(++_0x14ece5);}(_0x32e6,0x165));var _0x632e=function(_0x30202f,_0x500a61){_0x30202f=_0x30202f-0x0;var _0x50f7db=_0x32e6[_0x30202f];return _0x50f7db;};'use strict';var _=require(_0x632e('0x0'));var util=require('util');var moment=require(_0x632e('0x1'));var BPromise=require(_0x632e('0x2'));var rs=require(_0x632e('0x3'));var fs=require('fs');var Redis=require(_0x632e('0x4'));var db=require(_0x632e('0x5'))['db'];var utils=require(_0x632e('0x6'));var logger=require(_0x632e('0x7'))(_0x632e('0x8'));var config=require('../../config/environment');var jayson=require(_0x632e('0x9'));var client=jayson[_0x632e('0xa')][_0x632e('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x632e('0xc')],{'host':_0x632e('0xd'),'port':0x18eb});var socket=require(_0x632e('0xe'))(new Redis(config[_0x632e('0xc')]));require(_0x632e('0xf'))[_0x632e('0x10')](socket);function respondWithRpcPromise(_0x54ca9a,_0x1a5f27,_0x262bb7){return new BPromise(function(_0x1a4804,_0x6aed2){return client[_0x632e('0x11')](_0x54ca9a,_0x262bb7)[_0x632e('0x12')](function(_0x278e9b){logger['info']('ChatGroup,\x20%s,\x20%s',_0x1a5f27,_0x632e('0x13'));logger[_0x632e('0x14')](_0x632e('0x15'),_0x1a5f27,_0x632e('0x13'),JSON['stringify'](_0x278e9b));if(_0x278e9b['error']){if(_0x278e9b[_0x632e('0x16')][_0x632e('0x17')]===0x1f4){logger[_0x632e('0x16')](_0x632e('0x18'),_0x1a5f27,_0x278e9b[_0x632e('0x16')][_0x632e('0x19')]);return _0x6aed2(_0x278e9b['error'][_0x632e('0x19')]);}logger[_0x632e('0x16')](_0x632e('0x18'),_0x1a5f27,_0x278e9b['error'][_0x632e('0x19')]);return _0x1a4804(_0x278e9b['error'][_0x632e('0x19')]);}else{logger[_0x632e('0x1a')](_0x632e('0x18'),_0x1a5f27,'request\x20sent');_0x1a4804(_0x278e9b[_0x632e('0x1b')][_0x632e('0x19')]);}})[_0x632e('0x1c')](function(_0x58f9da){logger[_0x632e('0x16')]('ChatGroup,\x20%s,\x20%s',_0x1a5f27,_0x58f9da);_0x6aed2(_0x58f9da);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 73e7325..6452ff7 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 _0xb015=['./chatGroup.events','save','update','emit','removeListener','register','chatGroup:'];(function(_0x37eca7,_0x3e016e){var _0x222bce=function(_0xebd0b7){while(--_0xebd0b7){_0x37eca7['push'](_0x37eca7['shift']());}};_0x222bce(++_0x3e016e);}(_0xb015,0x1f1));var _0x5b01=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xb015[_0xac151d];return _0x111dba;};'use strict';var ChatGroupEvents=require(_0x5b01('0x0'));var events=[_0x5b01('0x1'),'remove',_0x5b01('0x2')];function createListener(_0x3d93d9,_0x563940){return function(_0x4b23ce){_0x563940[_0x5b01('0x3')](_0x3d93d9,_0x4b23ce);};}function removeListener(_0x11c7cf,_0x5b6fc6){return function(){ChatGroupEvents[_0x5b01('0x4')](_0x11c7cf,_0x5b6fc6);};}exports[_0x5b01('0x5')]=function(_0x49b71e){for(var _0x36d26e=0x0,_0x3340f8=events['length'];_0x36d26e<_0x3340f8;_0x36d26e++){var _0x40d132=events[_0x36d26e];var _0x891f64=createListener(_0x5b01('0x6')+_0x40d132,_0x49b71e);ChatGroupEvents['on'](_0x40d132,_0x891f64);}}; \ No newline at end of file +var _0xaaba=['length','chatGroup:','save','remove','update','emit','register'];(function(_0x277a2e,_0x30dd0e){var _0x4d9be4=function(_0x1b1db5){while(--_0x1b1db5){_0x277a2e['push'](_0x277a2e['shift']());}};_0x4d9be4(++_0x30dd0e);}(_0xaaba,0x113));var _0xaaab=function(_0x38bccc,_0xd4090e){_0x38bccc=_0x38bccc-0x0;var _0x5a5109=_0xaaba[_0x38bccc];return _0x5a5109;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xaaab('0x0'),_0xaaab('0x1'),_0xaaab('0x2')];function createListener(_0x5a4f8d,_0x965ece){return function(_0x2e6b13){_0x965ece[_0xaaab('0x3')](_0x5a4f8d,_0x2e6b13);};}function removeListener(_0x562641,_0x512d73){return function(){ChatGroupEvents['removeListener'](_0x562641,_0x512d73);};}exports[_0xaaab('0x4')]=function(_0x179c99){for(var _0x53dd86=0x0,_0x7e8a3c=events[_0xaaab('0x5')];_0x53dd86<_0x7e8a3c;_0x53dd86++){var _0x573c3c=events[_0x53dd86];var _0x5bfe8c=createListener(_0xaaab('0x6')+_0x573c3c,_0x179c99);ChatGroupEvents['on'](_0x573c3c,_0x5bfe8c);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 6177fa0..993b6de 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 _0xa88f=['getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','update','delete','destroy','removeMembers','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','describe','/:id','/:id/unread','/:id/members'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa88f,0x182));var _0xfa88=function(_0x442271,_0x1bffd0){_0x442271=_0x442271-0x0;var _0x528d35=_0xa88f[_0x442271];return _0x528d35;};'use strict';var multer=require(_0xfa88('0x0'));var util=require(_0xfa88('0x1'));var path=require(_0xfa88('0x2'));var timeout=require(_0xfa88('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfa88('0x4'));var auth=require(_0xfa88('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfa88('0x6'));var controller=require(_0xfa88('0x7'));router[_0xfa88('0x8')]('/',auth[_0xfa88('0x9')](),controller['index']);router['get']('/describe',auth[_0xfa88('0x9')](),controller[_0xfa88('0xa')]);router[_0xfa88('0x8')](_0xfa88('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xfa88('0x8')](_0xfa88('0xc'),auth[_0xfa88('0x9')](),controller['getUnread']);router[_0xfa88('0x8')](_0xfa88('0xd'),auth['isAuthenticated'](),controller[_0xfa88('0xe')]);router[_0xfa88('0x8')](_0xfa88('0xf'),auth[_0xfa88('0x9')](),controller[_0xfa88('0x10')]);router[_0xfa88('0x11')]('/',auth['isAuthenticated'](),controller[_0xfa88('0x12')]);router['post'](_0xfa88('0xd'),auth['isAuthenticated'](),controller[_0xfa88('0x13')]);router[_0xfa88('0x11')]('/:id/messages',auth[_0xfa88('0x9')](),controller[_0xfa88('0x14')]);router['put'](_0xfa88('0xb'),auth[_0xfa88('0x9')](),controller[_0xfa88('0x15')]);router[_0xfa88('0x16')]('/:id',auth[_0xfa88('0x9')](),controller[_0xfa88('0x17')]);router[_0xfa88('0x16')](_0xfa88('0xd'),auth[_0xfa88('0x9')](),controller[_0xfa88('0x18')]);module['exports']=router; \ No newline at end of file +var _0xfcbb=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','/:id','update','delete','destroy','removeMembers','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x541396,_0x453b59){_0x541396=_0x541396-0x0;var _0x132bfe=_0xfcbb[_0x541396];return _0x132bfe;};'use strict';var multer=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var path=require(_0xbfcb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbfcb('0x3')]();var fs_extra=require(_0xbfcb('0x4'));var auth=require(_0xbfcb('0x5'));var interaction=require(_0xbfcb('0x6'));var config=require(_0xbfcb('0x7'));var controller=require('./chatGroup.controller');router['get']('/',auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x9')]);router[_0xbfcb('0xa')](_0xbfcb('0xb'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0xc')]);router[_0xbfcb('0xa')]('/:id',auth[_0xbfcb('0x8')](),controller[_0xbfcb('0xd')]);router[_0xbfcb('0xa')]('/:id/unread',auth[_0xbfcb('0x8')](),controller[_0xbfcb('0xe')]);router[_0xbfcb('0xa')](_0xbfcb('0xf'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x10')]);router['get'](_0xbfcb('0x11'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x12')]);router[_0xbfcb('0x13')]('/',auth['isAuthenticated'](),controller[_0xbfcb('0x14')]);router['post'](_0xbfcb('0xf'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x15')]);router[_0xbfcb('0x13')](_0xbfcb('0x11'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x16')]);router[_0xbfcb('0x17')](_0xbfcb('0x18'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x19')]);router[_0xbfcb('0x1a')](_0xbfcb('0x18'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x1b')]);router[_0xbfcb('0x1a')](_0xbfcb('0xf'),auth[_0xbfcb('0x8')](),controller[_0xbfcb('0x1c')]);module[_0xbfcb('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 287faee..ec72d78 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 _0x4d5c=['out','sequelize','exports','INTEGER','star','thumb','TEXT','STRING','DATE'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x4d5c,0x10f));var _0xc4d5=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x4d5c[_0x2f3848];return _0x102668;};'use strict';var Sequelize=require(_0xc4d5('0x0'));module[_0xc4d5('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xc4d5('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0xc4d5('0x3'),_0xc4d5('0x4')),'defaultValue':_0xc4d5('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xc4d5('0x5')]},'mailTranscript':{'type':Sequelize[_0xc4d5('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc4d5('0x6')]},'secondDisposition':{'type':Sequelize[_0xc4d5('0x6')]},'thirdDisposition':{'type':Sequelize[_0xc4d5('0x6')]},'note':{'type':Sequelize[_0xc4d5('0x6')]},'browserName':{'type':Sequelize[_0xc4d5('0x6')]},'browserVersion':{'type':Sequelize[_0xc4d5('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xc4d5('0x6')]},'deviceModel':{'type':Sequelize[_0xc4d5('0x6')]},'deviceVendor':{'type':Sequelize[_0xc4d5('0x6')]},'deviceType':{'type':Sequelize[_0xc4d5('0x6')]},'referer':{'type':Sequelize[_0xc4d5('0x5')]},'customerIp':{'type':Sequelize[_0xc4d5('0x6')]},'formData':{'type':Sequelize[_0xc4d5('0x5')]('long')},'read1stAt':{'type':Sequelize[_0xc4d5('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc4d5('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xc4d5('0x6')]},'customerPort':{'type':Sequelize[_0xc4d5('0x6')]},'vidaooSessionId':{'type':Sequelize[_0xc4d5('0x5')]}}; \ No newline at end of file +var _0x06bd=['STRING','DATE','long','ENUM','sequelize','exports','BOOLEAN','star','TEXT'];(function(_0x5b1394,_0x17f08d){var _0x483150=function(_0x1d9539){while(--_0x1d9539){_0x5b1394['push'](_0x5b1394['shift']());}};_0x483150(++_0x17f08d);}(_0x06bd,0x15a));var _0xd06b=function(_0x44784c,_0x4498c1){_0x44784c=_0x44784c-0x0;var _0x4bbfb1=_0x06bd[_0x44784c];return _0x4bbfb1;};'use strict';var Sequelize=require(_0xd06b('0x0'));module[_0xd06b('0x1')]={'closed':{'type':Sequelize[_0xd06b('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0xd06b('0x3'),'thumb'),'defaultValue':_0xd06b('0x3')},'ratingMessage':{'type':Sequelize[_0xd06b('0x4')]},'pathTranscript':{'type':Sequelize[_0xd06b('0x4')]},'mailTranscript':{'type':Sequelize[_0xd06b('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xd06b('0x6')]},'disposition':{'type':Sequelize[_0xd06b('0x5')]},'secondDisposition':{'type':Sequelize[_0xd06b('0x5')]},'thirdDisposition':{'type':Sequelize[_0xd06b('0x5')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xd06b('0x5')]},'browserVersion':{'type':Sequelize[_0xd06b('0x5')]},'osName':{'type':Sequelize[_0xd06b('0x5')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xd06b('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xd06b('0x4')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xd06b('0x4')](_0xd06b('0x7'))},'read1stAt':{'type':Sequelize[_0xd06b('0x6')]},'lastMsgAt':{'type':Sequelize[_0xd06b('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xd06b('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xd06b('0x5')]},'customerPort':{'type':Sequelize[_0xd06b('0x5')]},'vidaooSessionId':{'type':Sequelize[_0xd06b('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 283625f..a1bb704 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 _0x04cb=['type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','search','conditions','find','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','split','length','getFullTextValue','ContactId','buildExpression','text','start','forEach','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','end','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','contactName','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','all','rows','params','rawAttributes','includeAll','include','options','create','describe','createVidaooSession','ChatWebsite','findOne','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','AbandonInteraction','attachmentUpload','originalname','basename','file','mimetype','attachmentDownload','closed','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','format','transcript-%s.txt','now','pathTranscript','Messages','%s%d','agentAlias','System','customer','Visitor','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','nolimit','filter','YYYY-MM-DD\x20HH:mm:ss','includeAgent','findAll','addTags','setTags','omit','Tag','chatInteractionTags:save','removeTags','unix','files','tmp','server','attachments','transcript-%d-%s.zip','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','firstName','renderFile','views','downloadInteraction.html','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','destroy','sendStatus','name','send','render','body','contact','interaction','account','Users','map','fullname','TagIds','Tags','index','ChatInteraction','fieldName'];(function(_0x338b15,_0x3202d8){var _0x466e43=function(_0x3c79ae){while(--_0x3c79ae){_0x338b15['push'](_0x338b15['shift']());}};_0x466e43(++_0x3202d8);}(_0x04cb,0xf5));var _0xb04c=function(_0x2fd889,_0x3ac8ed){_0x2fd889=_0x2fd889-0x0;var _0xd8daab=_0x04cb[_0x2fd889];return _0xd8daab;};'use strict';var emlformat=require(_0xb04c('0x0'));var rimraf=require(_0xb04c('0x1'));var zipdir=require(_0xb04c('0x2'));var jsonpatch=require(_0xb04c('0x3'));var rp=require(_0xb04c('0x4'));var moment=require(_0xb04c('0x5'));var BPromise=require(_0xb04c('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb04c('0x7'));var sox=require(_0xb04c('0x8'));var csv=require(_0xb04c('0x9'));var ejs=require(_0xb04c('0xa'));var fs=require('fs');var fs_extra=require(_0xb04c('0xb'));var _=require('lodash');var squel=require(_0xb04c('0xc'));var crypto=require(_0xb04c('0xd'));var jsforce=require(_0xb04c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb04c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb04c('0x10'));var as=require(_0xb04c('0x11'));var pdf=require(_0xb04c('0x12'));var hardwareService=require(_0xb04c('0x13'));var logger=require(_0xb04c('0x14'))(_0xb04c('0x15'));var utils=require(_0xb04c('0x16'));var config=require(_0xb04c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb04c('0x18'))['db'];config[_0xb04c('0x19')]=_[_0xb04c('0x1a')](config[_0xb04c('0x19')],{'host':_0xb04c('0x1b'),'port':0x18eb});var socket=require(_0xb04c('0x1c'))(new Redis(config[_0xb04c('0x19')]));require(_0xb04c('0x1d'))['register'](socket);var jayson=require(_0xb04c('0x1e'));var client=jayson[_0xb04c('0x1f')][_0xb04c('0x20')]({'port':0x232b});var client9004=jayson[_0xb04c('0x1f')][_0xb04c('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x128d00,_0x31b6ab,_0x2dff9c,_0x1f551c){return new BPromise(function(_0x2490f8,_0x1cad3b){var _0x882484=_0x1f551c||client;return _0x882484[_0xb04c('0x21')](_0x128d00,_0x2dff9c)[_0xb04c('0x22')](function(_0x29ede0){logger[_0xb04c('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x31b6ab,_0xb04c('0x24'));logger['debug'](_0xb04c('0x25'),_0x31b6ab,_0xb04c('0x24'),JSON[_0xb04c('0x26')](_0x29ede0));if(_0x29ede0[_0xb04c('0x27')]){if(_0x29ede0['error'][_0xb04c('0x28')]===0x1f4){logger[_0xb04c('0x27')]('ChatInteraction,\x20%s,\x20%s',_0x31b6ab,_0x29ede0['error'][_0xb04c('0x29')]);return _0x1cad3b(_0x29ede0['error']['message']);}logger[_0xb04c('0x27')](_0xb04c('0x2a'),_0x31b6ab,_0x29ede0[_0xb04c('0x27')]['message']);return _0x2490f8(_0x29ede0[_0xb04c('0x27')][_0xb04c('0x29')]);}else{logger[_0xb04c('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x31b6ab,_0xb04c('0x24'));_0x2490f8(_0x29ede0[_0xb04c('0x2b')]['message']);}})[_0xb04c('0x2c')](function(_0x2390e8){logger[_0xb04c('0x27')](_0xb04c('0x2a'),_0x31b6ab,_0x2390e8);_0x1cad3b(_0x2390e8);});});}function respondWithStatusCode(_0x3b9167,_0x2ac9b9){_0x2ac9b9=_0x2ac9b9||0xcc;return function(_0x23b12){if(_0x23b12){return _0x3b9167['sendStatus'](_0x2ac9b9);}return _0x3b9167[_0xb04c('0x2d')](_0x2ac9b9)['end']();};}function respondWithResult(_0x38b68e,_0x597c4d){_0x597c4d=_0x597c4d||0xc8;return function(_0x14a281){if(_0x14a281){return _0x38b68e[_0xb04c('0x2d')](_0x597c4d)[_0xb04c('0x2e')](_0x14a281);}};}function respondWithFilteredResult(_0x5e58b8,_0x40eec8){return function(_0x2f5d07){if(_0x2f5d07){var _0x428d1c=typeof _0x40eec8[_0xb04c('0x2f')]===_0xb04c('0x30')&&typeof _0x40eec8['limit']==='undefined';var _0x326468=_0x2f5d07['count'];var _0x4d6c1d=_0x428d1c?0x0:_0x40eec8[_0xb04c('0x2f')];var _0x1d65c0=_0x428d1c?_0x2f5d07[_0xb04c('0x31')]:_0x40eec8[_0xb04c('0x2f')]+_0x40eec8[_0xb04c('0x32')];var _0x2ef6a7;if(_0x1d65c0>=_0x326468){_0x1d65c0=_0x326468;_0x2ef6a7=0xc8;}else{_0x2ef6a7=0xce;}_0x5e58b8[_0xb04c('0x2d')](_0x2ef6a7);return _0x5e58b8[_0xb04c('0x33')](_0xb04c('0x34'),_0x4d6c1d+'-'+_0x1d65c0+'/'+_0x326468)[_0xb04c('0x2e')](_0x2f5d07);}return null;};}function patchUpdates(_0x5adf7a){return function(_0x1e3940){try{jsonpatch['apply'](_0x1e3940,_0x5adf7a,!![]);}catch(_0x38f3dc){return BPromise[_0xb04c('0x35')](_0x38f3dc);}return _0x1e3940['save']();};}function saveUpdates(_0x5cf35e,_0x4bbce7){return function(_0x33b124){if(_0x33b124){return _0x33b124[_0xb04c('0x36')](_0x5cf35e)[_0xb04c('0x22')](function(_0x50365d){return _0x50365d;});}return null;};}function removeEntity(_0x5bd1ad,_0x14e795){return function(_0x598379){if(_0x598379){return _0x598379[_0xb04c('0x37')]()[_0xb04c('0x22')](function(){_0x5bd1ad[_0xb04c('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57797c,_0x2ce5b2){return function(_0x205b77){if(!_0x205b77){_0x57797c[_0xb04c('0x38')](0x194);}return _0x205b77;};}function handleError(_0x4bef3c,_0x355b9b){_0x355b9b=_0x355b9b||0x1f4;return function(_0x2b1781){logger[_0xb04c('0x27')](_0x2b1781['stack']);if(_0x2b1781[_0xb04c('0x39')]){delete _0x2b1781[_0xb04c('0x39')];}_0x4bef3c[_0xb04c('0x2d')](_0x355b9b)[_0xb04c('0x3a')](_0x2b1781);};}function getMustacheRender(_0x271b06,_0x515b35){return Mustache[_0xb04c('0x3b')](_0x271b06,_['merge'](_0x515b35[_0xb04c('0x3c')],{'contact':_0x515b35[_0xb04c('0x3d')],'message':_0x515b35[_0xb04c('0x29')],'agent':_0x515b35['agent'],'interaction':_0x515b35[_0xb04c('0x3e')],'account':_0x515b35[_0xb04c('0x3f')]}))||'';}function getInteractionUsers(_0xde9e96,_0x3a24cc){return new BPromise(function(_0x4f108b,_0x139a4d){try{if(_0x3a24cc[_0xde9e96['id']]){_0xde9e96[_0xb04c('0x40')]=_[_0xb04c('0x41')](_0x3a24cc[_0xde9e96['id']],function(_0x3a8171){return{'id':_0x3a8171['id'],'fullname':_0x3a8171[_0xb04c('0x42')]};});}}catch(_0x47dbf8){_0x139a4d(_0x47dbf8);}_0x4f108b(_0xde9e96);});}function getInteractionTags(_0x422558,_0x3a4e9b){return new BPromise(function(_0x3f9be8,_0x3289a5){try{if(_0x422558[_0xb04c('0x43')]){_0x422558[_0xb04c('0x44')]=[];_0x422558[_0xb04c('0x43')]['split'](',')['forEach'](function(_0x3b872d){_0x422558[_0xb04c('0x44')]['push'](_0x3a4e9b[_0x3b872d]);});}delete _0x422558[_0xb04c('0x43')];}catch(_0x1f373a){_0x3289a5(_0x1f373a);}_0x3f9be8(_0x422558);});}function updateChatInteraction(_0x4d3860,_0x2805b9,_0x2e6dec){return new BPromise(function(_0x471207,_0x25f300){return getInteractionUsers(_0x4d3860,_0x2e6dec)[_0xb04c('0x22')](function(_0xb36ab){return getInteractionTags(_0xb36ab,_0x2805b9);})[_0xb04c('0x22')](function(_0x543aed){_0x471207(_0x543aed);})[_0xb04c('0x2c')](function(_0x29c738){_0x25f300(_0x29c738);});});}exports[_0xb04c('0x45')]=function(_0x106270,_0xe157df){var _0x3deef5={},_0x218f75={},_0x437127={'count':0x0,'rows':[]};var _0x47087c=_['map'](db[_0xb04c('0x46')]['rawAttributes'],function(_0x5a0131){return{'name':_0x5a0131[_0xb04c('0x47')],'type':_0x5a0131[_0xb04c('0x48')][_0xb04c('0x49')]};});_0x218f75[_0xb04c('0x4a')]=_['map'](_0x47087c,'name');_0x218f75[_0xb04c('0x4b')]=_[_0xb04c('0x4c')](_0x106270[_0xb04c('0x4b')]);_0x218f75[_0xb04c('0x4d')]=_[_0xb04c('0x4e')](_0x218f75['model'],_0x218f75['query']);_0x3deef5[_0xb04c('0x4f')]=_['intersection'](_0x218f75[_0xb04c('0x4a')],qs[_0xb04c('0x50')](_0x106270[_0xb04c('0x4b')]['fields']));_0x3deef5['attributes']=_0x3deef5['attributes']['length']?_0x3deef5[_0xb04c('0x4f')]:_0x218f75[_0xb04c('0x4a')];if(!_0x106270['query'][_0xb04c('0x51')]('nolimit')){_0x3deef5['limit']=qs['limit'](_0x106270['query'][_0xb04c('0x32')]);_0x3deef5[_0xb04c('0x2f')]=qs[_0xb04c('0x2f')](_0x106270[_0xb04c('0x4b')][_0xb04c('0x2f')]);}_0x3deef5['order']=qs[_0xb04c('0x52')](_0x106270['query']['sort']);_0x3deef5[_0xb04c('0x53')]=qs['filters'](_[_0xb04c('0x54')](_0x106270[_0xb04c('0x4b')],_0x218f75['filters']),_0x47087c);var _0x590725=[];var _0x26e1bd=squel[_0xb04c('0x55')]()[_0xb04c('0x56')]('id')[_0xb04c('0x56')](_0xb04c('0x39'))[_0xb04c('0x56')](_0xb04c('0x57'))[_0xb04c('0x58')](_0xb04c('0x59'));var _0x56e497=squel[_0xb04c('0x55')]()['field'](_0xb04c('0x5a'))[_0xb04c('0x56')](_0xb04c('0x5b'))[_0xb04c('0x56')](_0xb04c('0x5c'))['from'](_0xb04c('0x5d'),'ui')[_0xb04c('0x5e')](_0xb04c('0x5f'),'u',_0xb04c('0x60'));var _0x51559f=squel[_0xb04c('0x55')]()[_0xb04c('0x58')]('chat_interactions','i')[_0xb04c('0x5e')](_0xb04c('0x61'),'c',_0xb04c('0x62'))[_0xb04c('0x5e')]('users','o',_0xb04c('0x63'))[_0xb04c('0x5e')](_0xb04c('0x64'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0xb04c('0x5e')](_0xb04c('0x65'),'me','me.ChatInteractionId\x20=\x20i.id')[_0xb04c('0x5e')](_0xb04c('0x66'),'it',_0xb04c('0x67'))['left_join'](_0xb04c('0x59'),'t','t.id\x20=\x20it.TagId');var _0x55cc91=squel['expr']();var _0x4ad8fc=[];var _0x3eddc6=squel[_0xb04c('0x68')]();var _0x207e1a;if(_0x106270[_0xb04c('0x4b')][_0xb04c('0x69')]){_0x207e1a=as['parseSearch'](_0x106270['query'][_0xb04c('0x69')]);var _0x463686=_0x207e1a['sqlOperator'];for(var _0x391d8b=0x0;_0x391d8b<_0x207e1a[_0xb04c('0x6a')]['length'];_0x391d8b++){var _0xc7756e=_0x207e1a['conditions'][_0x391d8b];var _0x2da208='i';var _0x2fe155=_[_0xb04c('0x6b')](_0x47087c,[_0xb04c('0x39'),_0xc7756e[_0xb04c('0x56')]]);if(!_0x2fe155){switch(_0xc7756e[_0xb04c('0x56')]){case'unreadMessages':if(_0xc7756e['value']==0x1){_0x51559f[_0xb04c('0x6c')]('`'+_0xc7756e[_0xb04c('0x56')]+_0xb04c('0x6d'));}else{_0x51559f[_0xb04c('0x6c')]('`'+_0xc7756e[_0xb04c('0x56')]+_0xb04c('0x6e'));}break;case _0xb04c('0x6f'):if(_0xc7756e[_0xb04c('0x70')]===_0xb04c('0x71')){if(_0xc7756e[_0xb04c('0x72')][_0xb04c('0x73')]('\x20')[_0xb04c('0x74')]>0x1){_0x55cc91[_0x463686]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb04c('0x75')](_0xc7756e[_0xb04c('0x72')]),null);}else{var _0x2d2e98='%'+_0xc7756e[_0xb04c('0x72')]+'%';_0x55cc91[_0x463686]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2d2e98,_0x2d2e98,_0x2d2e98);}}else{_0x2fe155=_[_0xb04c('0x6b')](_0x47087c,[_0xb04c('0x39'),'ContactId']);_0xc7756e[_0xb04c('0x56')]=_0xb04c('0x76');_0xc77295=as[_0xb04c('0x77')](_0x2da208,_0x2fe155[_0xb04c('0x48')],_0xc7756e);_0x55cc91[_0x463686](_0xc77295[_0xb04c('0x78')],_0xc77295[_0xb04c('0x72')][_0xb04c('0x79')],_0xc77295[_0xb04c('0x72')]['end']);}break;case'Tag':var _0x659f48=_0xc7756e[_0xb04c('0x72')][_0xb04c('0x73')](',')[_0xb04c('0x41')](function(_0x20fb59){return Number(_0x20fb59);});_0x659f48[_0xb04c('0x7a')](function(_0x2c732e){_0x3eddc6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2c732e+',%');});_0x4ad8fc=_[_0xb04c('0x7b')](_0x4ad8fc,_0x659f48);break;case _0xb04c('0x7c'):if(_0xc7756e['operator']===_0xb04c('0x71')){_0x55cc91[_0x463686](_0xb04c('0x7d'),'%'+_0xc7756e[_0xb04c('0x72')]+'%',null);}else{_0x2fe155=_[_0xb04c('0x6b')](_0x47087c,['name',_0xb04c('0x7e')]);_0xc7756e[_0xb04c('0x56')]=_0xb04c('0x7e');_0xc77295=as[_0xb04c('0x77')](_0x2da208,_0x2fe155[_0xb04c('0x48')],_0xc7756e);_0x55cc91[_0x463686](_0xc77295['text'],_0xc77295[_0xb04c('0x72')][_0xb04c('0x79')],_0xc77295[_0xb04c('0x72')][_0xb04c('0x7f')]);}break;case _0xb04c('0x3c'):_0xc77295=as['buildExpression']('me',null,_0xc7756e);_0x55cc91[_0x463686](_0xc77295[_0xb04c('0x78')],_0xc77295[_0xb04c('0x72')][_0xb04c('0x79')],_0xc77295[_0xb04c('0x72')][_0xb04c('0x7f')]);break;}}else{var _0xc77295=as[_0xb04c('0x77')](_0x2da208,_0x2fe155[_0xb04c('0x48')],_0xc7756e);_0x55cc91[_0x463686](_0xc77295[_0xb04c('0x78')],_0xc77295[_0xb04c('0x72')][_0xb04c('0x79')],_0xc77295['value'][_0xb04c('0x7f')]);}}}else{var _0x34c72a=_(_0x106270[_0xb04c('0x4b')])['keys']()[_0xb04c('0x41')](function(_0x36bbd2){return _[_0xb04c('0x80')](_0x47087c,[_0xb04c('0x39'),_0x36bbd2])?_0x36bbd2:undefined;})[_0xb04c('0x81')]()[_0xb04c('0x72')]();if(!_[_0xb04c('0x82')](_0x34c72a)){_0x34c72a[_0xb04c('0x7a')](function(_0x2920e9){if(_0x2920e9===_0xb04c('0x83')){_0x51559f['where'](_0xb04c('0x84'),[][_0xb04c('0x85')](_0x106270[_0xb04c('0x4b')][_0x2920e9]));}else if(_0x2920e9===_0xb04c('0x86')){var _0x306842=JSON[_0xb04c('0x87')](_0x106270[_0xb04c('0x4b')][_0x2920e9])[_0xb04c('0x88')];var _0x1d3b33=JSON[_0xb04c('0x87')](_0x106270[_0xb04c('0x4b')][_0x2920e9])[_0xb04c('0x89')];_0x51559f['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x306842,_0x1d3b33);}else{if(_0x106270[_0xb04c('0x4b')][_0x2920e9]==='null'){_0x51559f[_0xb04c('0x53')]('i.'+_0x2920e9+'\x20IS\x20NULL');}else{_0x51559f[_0xb04c('0x53')]('i.'+_0x2920e9+'\x20=\x20?',_0x106270[_0xb04c('0x4b')][_0x2920e9]);}}});}if(_0x106270[_0xb04c('0x4b')]['read']){if(_0x106270['query'][_0xb04c('0x8a')]==0x1){_0x51559f[_0xb04c('0x6c')](_0xb04c('0x8b'));}else{_0x51559f[_0xb04c('0x6c')]('`unreadMessages`\x20>\x200');}}if(_0x106270[_0xb04c('0x4b')][_0xb04c('0x8c')]){_0x4ad8fc=_[_0xb04c('0x8d')](_0x106270[_0xb04c('0x4b')][_0xb04c('0x8c')])?_0x106270[_0xb04c('0x4b')][_0xb04c('0x8c')]:new Array(_0x106270[_0xb04c('0x4b')][_0xb04c('0x8c')]);_0x4ad8fc['forEach'](function(_0x1dd810){_0x3eddc6['or'](_0xb04c('0x8e'),'%,'+_0x1dd810+',%');});}if(_0x106270[_0xb04c('0x4b')]['filter']){var _0xef199e=_0x106270[_0xb04c('0x4b')]['filter'][_0xb04c('0x8f')]('\x5c','\x5c\x5c')[_0xb04c('0x8f')](/'/g,'\x27\x27');if(qs[_0xb04c('0x90')](_0xef199e)){_0x55cc91['or'](_0xb04c('0x91'),_0xef199e+'%');}else{_0x55cc91['or'](_0xb04c('0x92'),qs[_0xb04c('0x75')](_0xef199e))['or'](_0xb04c('0x93'),_0xef199e+'%');}}}_0x51559f[_0xb04c('0x53')](_0x55cc91);_0x51559f['group'](_0xb04c('0x94'));var _0x43d0cb={'type':db[_0xb04c('0x95')]['QueryTypes'][_0xb04c('0x96')],'raw':!![]};var _0x52b23f=_0x51559f[_0xb04c('0x97')]();_0x52b23f[_0xb04c('0x56')](_0xb04c('0x94'));_0x52b23f['field'](_0xb04c('0x98'),_0xb04c('0x99'));if(_0x3deef5[_0xb04c('0x9a')]){_0x3deef5[_0xb04c('0x9a')]['forEach'](function(_0x424131){var _0x53e3e6=_0x424131[0x0]===_0xb04c('0x9b')?_0x424131[0x0]:'i.'+_0x424131[0x0];_0x51559f[_0xb04c('0x9a')](_0x53e3e6,_0x424131[0x1]===_0xb04c('0x9c')?![]:!![]);});}if(!_['isEmpty'](_0x4ad8fc)){_0x51559f['having'](_0x3eddc6);_0x52b23f[_0xb04c('0x53')](_0xb04c('0x9d'),_0x4ad8fc);}BPromise['resolve']()[_0xb04c('0x22')](function(){if(!_0x207e1a){if(_0x106270[_0xb04c('0x4b')][_0xb04c('0x83')])return;_0x52b23f[_0xb04c('0x53')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x51559f[_0xb04c('0x53')](_0xb04c('0x9e'));return;}if(_0x106270[_0xb04c('0x9f')][_0xb04c('0xa0')]!==_0xb04c('0xa1'))return;return _0x106270[_0xb04c('0x9f')][_0xb04c('0xa2')]({'attributes':['id'],'raw':!![]})[_0xb04c('0x22')](function(_0x51af50){if(_[_0xb04c('0x82')](_0x51af50)){_0x52b23f['where'](_0xb04c('0xa3'));_0x51559f[_0xb04c('0x53')](_0xb04c('0xa3'));}else{_0x52b23f[_0xb04c('0x53')](_0xb04c('0x84'),_[_0xb04c('0x41')](_0x51af50,'id'));_0x51559f['where'](_0xb04c('0x84'),_[_0xb04c('0x41')](_0x51af50,'id'));}});})[_0xb04c('0x22')](function(){if(_0x106270['user'][_0xb04c('0xa0')]===_0xb04c('0xa1')&&!_0x207e1a&&!_0x106270['query']['ChatWebsiteId'])return[];return db[_0xb04c('0xa4')][_0xb04c('0x4b')](_0x52b23f[_0xb04c('0xa5')](),_0x43d0cb);})['then'](function(_0x17d88d){_0x437127[_0xb04c('0x31')]=_0x17d88d[_0xb04c('0x74')];if(_0x437127[_0xb04c('0x31')]===0x0)return[];return db['sequelize']['query'](_0x26e1bd[_0xb04c('0xa5')](),_0x43d0cb)['then'](function(_0x5b51ac){_0x590725=_[_0xb04c('0xa6')](_0x5b51ac,'id');_0x43d0cb=_[_0xb04c('0xa7')](_0x43d0cb,{'model':db[_0xb04c('0x46')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x106270['query'][_0xb04c('0x50')]){_0x3deef5[_0xb04c('0x4f')][_0xb04c('0x7a')](function(_0x1211ab){_0x51559f[_0xb04c('0x56')]('i.'+_0x1211ab);});}else{_0x51559f[_0xb04c('0x56')](_0xb04c('0x98'),_0xb04c('0x99'));_0x51559f[_0xb04c('0x56')](_0xb04c('0xa8'),_0xb04c('0xa9'));_0x51559f[_0xb04c('0x56')](_0xb04c('0xaa'),_0xb04c('0xab'));_0x51559f[_0xb04c('0x56')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xb04c('0x9b'));_0x51559f[_0xb04c('0x56')]('i.*');_0x51559f[_0xb04c('0x56')](_0xb04c('0xac'),_0xb04c('0xad'));_0x51559f[_0xb04c('0x56')](_0xb04c('0xae'),_0xb04c('0xaf'));_0x51559f[_0xb04c('0x56')]('c.email',_0xb04c('0xb0'));_0x51559f[_0xb04c('0x56')](_0xb04c('0xb1'),_0xb04c('0xb2'));_0x51559f[_0xb04c('0x56')]('c.mobile',_0xb04c('0xb3'));_0x51559f[_0xb04c('0x56')](_0xb04c('0xb4'),'Contact.fax');_0x51559f[_0xb04c('0x56')]('o.fullname','Owner.fullname');_0x51559f[_0xb04c('0x56')](_0xb04c('0xb5'),_0xb04c('0xb6'));_0x51559f[_0xb04c('0x56')](_0xb04c('0xb7'),'TagIds');}if(_0x3deef5[_0xb04c('0x32')])_0x51559f[_0xb04c('0x32')](_0x3deef5[_0xb04c('0x32')]);if(_0x3deef5[_0xb04c('0x2f')])_0x51559f[_0xb04c('0x2f')](_0x3deef5['offset']);return db[_0xb04c('0xa4')][_0xb04c('0x4b')](_0x51559f[_0xb04c('0xa5')](),_0x43d0cb);})['then'](function(_0x215cb0){if(_0x215cb0[_0xb04c('0x74')]>0x0)_0x56e497[_0xb04c('0x53')](_0xb04c('0xb8'),_[_0xb04c('0x41')](_0x215cb0,'id'));return db[_0xb04c('0xa4')]['query'](_0x56e497['toString'](),_0x43d0cb)[_0xb04c('0x22')](function(_0x28ee6f){var _0x593fa7=_[_0xb04c('0xb9')](_0x28ee6f,_0xb04c('0xba'));var _0x55c5d=[];_0x215cb0['forEach'](function(_0x1ee4e3){_0x55c5d[_0xb04c('0xbb')](updateChatInteraction(_0x1ee4e3,_0x590725,_0x593fa7));});return BPromise[_0xb04c('0xbc')](_0x55c5d);});});})[_0xb04c('0x22')](function(_0x1533db){_0x437127[_0xb04c('0xbd')]=_0x1533db;return _0x437127;})[_0xb04c('0x22')](respondWithFilteredResult(_0xe157df,_0x3deef5))[_0xb04c('0x2c')](handleError(_0xe157df,null));};exports['show']=function(_0x25ad28,_0x41161b){var _0x1bda66={'raw':![],'where':{'id':_0x25ad28[_0xb04c('0xbe')]['id']}},_0xdbe8cb={};_0xdbe8cb[_0xb04c('0x4a')]=_[_0xb04c('0x4c')](db[_0xb04c('0x46')][_0xb04c('0xbf')]);_0xdbe8cb[_0xb04c('0x4b')]=_[_0xb04c('0x4c')](_0x25ad28[_0xb04c('0x4b')]);_0xdbe8cb[_0xb04c('0x4d')]=_[_0xb04c('0x4e')](_0xdbe8cb[_0xb04c('0x4a')],_0xdbe8cb[_0xb04c('0x4b')]);_0x1bda66['attributes']=_[_0xb04c('0x4e')](_0xdbe8cb[_0xb04c('0x4a')],qs[_0xb04c('0x50')](_0x25ad28[_0xb04c('0x4b')][_0xb04c('0x50')]));_0x1bda66['attributes']=_0x1bda66[_0xb04c('0x4f')][_0xb04c('0x74')]?_0x1bda66[_0xb04c('0x4f')]:_0xdbe8cb[_0xb04c('0x4a')];if(_0x25ad28[_0xb04c('0x4b')][_0xb04c('0xc0')]){_0x1bda66[_0xb04c('0xc1')]=[{'all':!![]}];}_0x1bda66=_[_0xb04c('0xa7')]({},_0x1bda66,_0x25ad28[_0xb04c('0xc2')]);return db[_0xb04c('0x46')][_0xb04c('0x6b')](_0x1bda66)[_0xb04c('0x22')](handleEntityNotFound(_0x41161b,null))[_0xb04c('0x22')](respondWithResult(_0x41161b,null))[_0xb04c('0x2c')](handleError(_0x41161b,null));};exports[_0xb04c('0xc3')]=function(_0x22750b,_0x1be1db){return db[_0xb04c('0x46')][_0xb04c('0xc3')](_0x22750b['body'],{})['then'](respondWithResult(_0x1be1db,0xc9))[_0xb04c('0x2c')](handleError(_0x1be1db,null));};exports[_0xb04c('0x36')]=function(_0x58b0a2,_0x1f1692){if(_0x58b0a2[_0xb04c('0x3c')]['id']){delete _0x58b0a2['body']['id'];}return db[_0xb04c('0x46')]['find']({'where':{'id':_0x58b0a2[_0xb04c('0xbe')]['id']}})[_0xb04c('0x22')](handleEntityNotFound(_0x1f1692,null))[_0xb04c('0x22')](saveUpdates(_0x58b0a2[_0xb04c('0x3c')],null))['then'](respondWithResult(_0x1f1692,null))['catch'](handleError(_0x1f1692,null));};exports['destroy']=function(_0x565906,_0x1c91f0){return db[_0xb04c('0x46')]['find']({'where':{'id':_0x565906[_0xb04c('0xbe')]['id']}})[_0xb04c('0x22')](handleEntityNotFound(_0x1c91f0,null))[_0xb04c('0x22')](removeEntity(_0x1c91f0,null))[_0xb04c('0x2c')](handleError(_0x1c91f0,null));};exports[_0xb04c('0xc4')]=function(_0x1f3fe2,_0x42e258){return db['ChatInteraction']['describe']()[_0xb04c('0x22')](respondWithResult(_0x42e258,null))['catch'](handleError(_0x42e258,null));};exports[_0xb04c('0xc5')]=function(_0x56457a,_0x1a8f61){var _0x92d727=_0x56457a['params']['id'];var _0x10f65d;var _0x3a21d7;var _0xd172d9;return db[_0xb04c('0x46')]['findOne']({'where':{'id':_0x92d727}})['then'](function(_0x4fac47){_0x10f65d=_0x4fac47;return db[_0xb04c('0xc6')][_0xb04c('0xc7')]({'where':{'id':_0x4fac47['ChatWebsiteId']},'attributes':['id','vidaooApiKey','vidaooEscalation',_0xb04c('0xc8'),_0xb04c('0xc9'),_0xb04c('0xca')],'raw':!![]});})[_0xb04c('0x22')](function(_0xaf34af){if(_0xaf34af&&_0xaf34af['vidaooApiKey']&&_0xaf34af[_0xb04c('0xcb')]){_0x3a21d7=_0xaf34af;var _0x406126={'interaction':{'id':_0x92d727},'agent':{'id':_0x56457a[_0xb04c('0x9f')]['id'],'name':_0x56457a[_0xb04c('0x9f')][_0xb04c('0x39')],'fullname':_0x56457a[_0xb04c('0x9f')][_0xb04c('0x42')],'email':_0x56457a[_0xb04c('0x9f')][_0xb04c('0xcc')]},'contact':_0x56457a[_0xb04c('0x3c')][_0xb04c('0x3d')],'account':_0x56457a[_0xb04c('0x3c')]['account']};var _0x43664d={'rejectUnauthorized':![],'method':_0xb04c('0xcd'),'url':_0xb04c('0xce'),'headers':{'X-APIKEY':_0xaf34af['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x56457a['user'][_0xb04c('0xcc')]],'buttons':null,'topic':_0x3a21d7[_0xb04c('0xc8')],'note':_[_0xb04c('0xcf')](_0x3a21d7[_0xb04c('0xc9')])?null:getMustacheRender(_0x3a21d7['vidaooNote'],_0x406126),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xb04c('0xcf')](_0x3a21d7[_0xb04c('0xca')])){var _0x2e5a26=getMustacheRender(_0x3a21d7[_0xb04c('0xca')],_0x406126);var _0x16ba29=JSON[_0xb04c('0x87')](_0x2e5a26);_0x43664d[_0xb04c('0x3c')][_0xb04c('0xd0')]=_0x16ba29;}}catch(_0xd43cfc){throw new db[(_0xb04c('0x95'))][(_0xb04c('0xd1'))](_0xb04c('0xd2'));}return rp(_0x43664d);}else{throw new db[(_0xb04c('0x95'))][(_0xb04c('0xd1'))](_0xb04c('0xd3'));}})[_0xb04c('0x22')](function(_0x29fa32){_0xd172d9=_0x29fa32;if(_0xd172d9['id']){var _0x3a286a={'body':_0xd172d9[_0xb04c('0xd4')],'ChatWebsiteId':_0x3a21d7['id'],'ChatInteractionId':_0x10f65d['id'],'direction':_0xb04c('0xd5'),'UserId':_0x56457a[_0xb04c('0x9f')]['id']};return db[_0xb04c('0xd6')][_0xb04c('0xc3')](_0x3a286a,{});}else{throw new db['Sequelize'][(_0xb04c('0xd1'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xb04c('0x22')](function(){return _0x10f65d[_0xb04c('0xd7')]({'vidaooSessionId':_0xd172d9['id']});})[_0xb04c('0x22')](respondWithResult(_0x1a8f61,null))[_0xb04c('0x2c')](handleError(_0x1a8f61,null));};exports[_0xb04c('0xd8')]=function(_0x5e1147,_0x4be663){if(_0x5e1147['body']['id']){delete _0x5e1147['body']['id'];}return db[_0xb04c('0x46')][_0xb04c('0x6b')]({'where':{'id':_0x5e1147['params']['id']},'include':[{'model':db[_0xb04c('0xd9')],'as':_0xb04c('0x6f')}]})[_0xb04c('0x22')](handleEntityNotFound(_0x4be663,null))[_0xb04c('0x22')](saveUpdates(_0x5e1147[_0xb04c('0x3c')],null))[_0xb04c('0x22')](respondWithResult(_0x4be663,null))['catch'](handleError(_0x4be663,null));};exports[_0xb04c('0xda')]=function(_0x2fe80e,_0x2631ce,_0x753fb1){if(_0x2fe80e[_0xb04c('0x3c')]['id']){delete _0x2fe80e['body']['id'];}return db[_0xb04c('0x46')][_0xb04c('0x6b')]({'where':{'id':_0x2fe80e[_0xb04c('0xbe')]['id']}})['then'](function(_0x5420ee){if(!_0x5420ee){logger[_0xb04c('0x27')](_0xb04c('0xdb'),_0xb04c('0xda'),0x194,_0xb04c('0xdc'));_0x2631ce[_0xb04c('0x38')](0x194);}else{if(_0x5420ee[_0xb04c('0x7e')]){throw new db[(_0xb04c('0x95'))][(_0xb04c('0xd1'))]('Interaction\x20already\x20assigned');}}return _0x5420ee;})[_0xb04c('0x22')](function(_0x1db3eb){if(_0x1db3eb){return _0x1db3eb[_0xb04c('0x36')]({'closed':_0x2fe80e['body']['closed'],'disposition':_0x2fe80e[_0xb04c('0x3c')]['disposition']})['then'](function(_0xe9e6ee){return _0xe9e6ee;});}})[_0xb04c('0x22')](function(_0x352fdd){return respondWithRpcPromise(_0xb04c('0xdd'),_0xb04c('0xda'),_0x2fe80e['body'],client9004);})[_0xb04c('0x22')](respondWithResult(_0x2631ce,null))[_0xb04c('0x2c')](handleError(_0x2631ce,null));};exports[_0xb04c('0xde')]=function(_0x380e84,_0x1bf291,_0x20cb0e){_0x380e84[_0xb04c('0x3c')][_0xb04c('0x39')]=_0x380e84['file'][_0xb04c('0xdf')];_0x380e84[_0xb04c('0x3c')][_0xb04c('0xe0')]=_0x380e84[_0xb04c('0xe1')]['filename'];_0x380e84[_0xb04c('0x3c')][_0xb04c('0x48')]=_0x380e84[_0xb04c('0xe1')][_0xb04c('0xe2')];return db['Attachment'][_0xb04c('0xc3')](_0x380e84[_0xb04c('0x3c')])[_0xb04c('0x22')](respondWithResult(_0x1bf291,0xc9))[_0xb04c('0x2c')](handleError(_0x1bf291,null));};exports[_0xb04c('0xe3')]=function(_0x3158b8,_0x5e1f5f,_0x46adfb){return db[_0xb04c('0x46')][_0xb04c('0xc7')]({'where':{'id':_0x3158b8[_0xb04c('0xbe')]['id']},'raw':!![]})[_0xb04c('0x22')](handleEntityNotFound(_0x5e1f5f,null))[_0xb04c('0x22')](function(_0x58c216){if(_0x58c216){if(_0x58c216[_0xb04c('0xe4')]){return _0x5e1f5f[_0xb04c('0x2d')](0x193)[_0xb04c('0x2e')]({'status':0x193,'message':_0xb04c('0xe5')});}return db[_0xb04c('0xe6')]['findOne']({'where':{'id':_0x3158b8[_0xb04c('0x4b')][_0xb04c('0xe7')]},'raw':!![]})['then'](handleEntityNotFound(_0x5e1f5f,null));}})[_0xb04c('0x22')](function(_0x13b708){if(_0x13b708){var _0x715a5f=_0x13b708[_0xb04c('0xe8')]!==null;var _0x12ff32=path[_0xb04c('0xe9')](config[_0xb04c('0xea')],_0xb04c('0xeb'));if(_0x715a5f){_0x12ff32=path['join'](_0x12ff32,_0xb04c('0xec'));}var _0x5e66b7=path['join'](_0x12ff32,_0x13b708[_0xb04c('0xe0')]);return _0x5e1f5f[_0xb04c('0xed')](_0x5e66b7);}})['catch'](handleError(_0x5e1f5f,null));};exports[_0xb04c('0xee')]=function(_0x101526,_0x348df7){var _0x3cce83=null;var _0x52af74=null;var _0x75535d=null;var _0x16cc16=null;if(_0x101526[_0xb04c('0x3c')]['id']){delete _0x101526[_0xb04c('0x3c')]['id'];}if(_0x101526[_0xb04c('0x3c')]['mailTranscript']){_0x16cc16=path[_0xb04c('0xe9')](config['root'],'server/files/chat/upload/',util[_0xb04c('0xef')](_0xb04c('0xf0'),Date[_0xb04c('0xf1')]()));_0x101526[_0xb04c('0x3c')][_0xb04c('0xf2')]=_0x16cc16;}return db[_0xb04c('0x46')][_0xb04c('0x6b')]({'where':{'id':_0x101526['params']['id']},'include':[{'model':db['ChatMessage'],'as':_0xb04c('0xf3'),'include':[{'model':db[_0xb04c('0x7c')],'as':_0xb04c('0x7c')}]}]})[_0xb04c('0x22')](handleEntityNotFound(_0x348df7,null))[_0xb04c('0x22')](saveUpdates(_0x101526[_0xb04c('0x3c')],null))[_0xb04c('0x22')](function(_0x30cc92){if(_0x30cc92){_0x3cce83=_0x30cc92;return db[_0xb04c('0xc6')][_0xb04c('0x6b')]({'where':{'id':_0x3cce83['ChatWebsiteId']}});}})[_0xb04c('0x22')](function(_0x56a8e6){if(_0x56a8e6){_0x75535d=_0x56a8e6;return db[_0xb04c('0xd9')][_0xb04c('0x6b')]({'where':{'id':_0x3cce83['ContactId']}});}})[_0xb04c('0x22')](function(_0x4a2d9e){if(_0x4a2d9e){_0x52af74=_0x4a2d9e;if(_0x16cc16){var _0x517d73=null;for(var _0x1840a9=0x1;_0x1840a9<_0x3cce83[_0xb04c('0xf3')][_0xb04c('0x74')];++_0x1840a9){_0x517d73=_0x3cce83[_0xb04c('0xf3')][_0x1840a9];var _0xcd547d=_0x517d73['UserId']?util['format'](_0xb04c('0xf4'),_0x75535d[_0xb04c('0xf5')],_0x517d73['UserId']):_0xb04c('0xf6');var _0x35f0ac=_0x101526[_0xb04c('0x3c')][_0xb04c('0xf7')]||util[_0xb04c('0xef')](_0xb04c('0xf4'),_0xb04c('0xf8'),_0x517d73[_0xb04c('0x76')]);switch(_0x75535d['agentIdentifier']){case _0xb04c('0xf9'):_0xcd547d=_0x517d73[_0xb04c('0x7e')]?util['format'](_0xb04c('0xf4'),_0x75535d[_0xb04c('0xf5')],_0x517d73['UserId']):'System';break;case _0xb04c('0xfa'):_0xcd547d=_0x517d73[_0xb04c('0x7e')]?_0x517d73[_0xb04c('0x7c')][_0xb04c('0xfb')]||_0x517d73[_0xb04c('0x7c')][_0xb04c('0x42')]:_0xb04c('0xf6');break;case _0xb04c('0xfc'):_0xcd547d=_0x517d73[_0xb04c('0x7e')]?_0x517d73[_0xb04c('0x7c')][_0xb04c('0x42')]:_0xb04c('0xf6');break;default:_0xcd547d=_0x517d73['UserId']?util[_0xb04c('0xef')](_0xb04c('0xf4'),_0x75535d[_0xb04c('0xf5')],_0x517d73['UserId']):_0xb04c('0xf6');}var _0x14c468=util[_0xb04c('0xef')](_0xb04c('0xfd'),moment(_0x517d73[_0xb04c('0x86')])[_0xb04c('0xef')](_0xb04c('0xfe')),_0x517d73[_0xb04c('0xff')]==='in'?_0x35f0ac:_0xcd547d,_0x517d73[_0xb04c('0x3c')]);if(!_0x517d73[_0xb04c('0x100')]){fs[_0xb04c('0x101')](_0x16cc16,_0x14c468);}}return db[_0xb04c('0x102')][_0xb04c('0xc7')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}}})['then'](function(_0x382ac5){if(_0x382ac5&&_0x382ac5[_0xb04c('0x103')]&&_0x101526[_0xb04c('0x3c')]){var _0x40ee65={'tls':{'rejectUnauthorized':![]}};if(_0x382ac5[_0xb04c('0x103')]['service']){_0x40ee65[_0xb04c('0x104')]=_0x382ac5[_0xb04c('0x103')][_0xb04c('0x104')];}else{_0x40ee65['host']=_0x382ac5[_0xb04c('0x103')]['host'];_0x40ee65[_0xb04c('0x105')]=_0x382ac5[_0xb04c('0x103')]['port'];_0x40ee65[_0xb04c('0x106')]=_0x382ac5[_0xb04c('0x103')][_0xb04c('0x106')];}if(_0x382ac5['Smtp'][_0xb04c('0x107')]){_0x40ee65[_0xb04c('0x108')]={'user':_0x382ac5['Smtp'][_0xb04c('0x9f')],'pass':_0x382ac5['Smtp'][_0xb04c('0x109')]};}return respondWithRpcPromise(_0xb04c('0x10a'),_0xb04c('0x10b'),{'account':_0x40ee65,'message':{'from':util[_0xb04c('0xef')](_0xb04c('0x10c'),_0x382ac5[_0xb04c('0x39')],_0x382ac5[_0xb04c('0xcc')]||_0x382ac5[_0xb04c('0x103')][_0xb04c('0x9f')]),'to':_0x101526[_0xb04c('0x3c')][_0xb04c('0x10d')],'subject':'Mail\x20Transcript','text':util['format'](_0xb04c('0x10e'),_0x101526[_0xb04c('0x3c')][_0xb04c('0x10d')]),'attachments':[{'path':_0x16cc16}]}})[_0xb04c('0x22')](function(){return _0x3cce83;})[_0xb04c('0x2c')](function(_0x410a54){console['error'](_0x410a54);});}else{return _0x3cce83;}})[_0xb04c('0x22')](respondWithStatusCode(_0x348df7,0xc8))[_0xb04c('0x2c')](handleError(_0x348df7,null));};exports[_0xb04c('0x10f')]=function(_0x2352f8,_0x103cd6,_0x20e545){return db[_0xb04c('0xd6')][_0xb04c('0x6b')]({'where':{'id':_0x2352f8['params']['id']}})[_0xb04c('0x22')](handleEntityNotFound(_0x103cd6,null))[_0xb04c('0x22')](function(_0x5a85df){if(_0x5a85df){return _0x5a85df['addMessage'](_0x2352f8['body'][_0xb04c('0x110')],_['omit'](_0x2352f8['body'],[_0xb04c('0x110'),'id'])||{});}})['then'](respondWithResult(_0x103cd6,null))[_0xb04c('0x2c')](handleError(_0x103cd6,null));};exports['getMessages']=function(_0x2c44d7,_0x4286ca,_0x31e356){var _0x32a784={'raw':![],'where':{}};var _0x31a752={};var _0x1b6c4e={'count':0x0,'rows':[]};return db[_0xb04c('0x46')][_0xb04c('0xc7')]({'where':{'id':_0x2c44d7['params']['id']}})[_0xb04c('0x22')](handleEntityNotFound(_0x4286ca,null))[_0xb04c('0x22')](function(_0x1f4e88){if(_0x1f4e88){_0x31a752[_0xb04c('0x4a')]=_[_0xb04c('0x4c')](db[_0xb04c('0xd6')][_0xb04c('0xbf')]);_0x31a752[_0xb04c('0x4b')]=_[_0xb04c('0x4c')](_0x2c44d7[_0xb04c('0x4b')]);_0x31a752[_0xb04c('0x4d')]=_[_0xb04c('0x4e')](_0x31a752[_0xb04c('0x4a')],_0x31a752['query']);_0x32a784[_0xb04c('0x4f')]=_[_0xb04c('0x4e')](_0x31a752[_0xb04c('0x4a')],qs[_0xb04c('0x50')](_0x2c44d7['query'][_0xb04c('0x50')]));_0x32a784[_0xb04c('0x4f')]=_0x32a784[_0xb04c('0x4f')][_0xb04c('0x74')]?_0x32a784[_0xb04c('0x4f')]:_0x31a752[_0xb04c('0x4a')];if(!_0x2c44d7[_0xb04c('0x4b')]['hasOwnProperty'](_0xb04c('0x111'))){_0x32a784['limit']=qs[_0xb04c('0x32')](_0x2c44d7['query']['limit']);_0x32a784['offset']=qs[_0xb04c('0x2f')](_0x2c44d7[_0xb04c('0x4b')][_0xb04c('0x2f')]);}_0x32a784['order']=qs[_0xb04c('0x52')](_0x2c44d7[_0xb04c('0x4b')]['sort']);_0x32a784[_0xb04c('0x53')]=qs[_0xb04c('0x4d')](_[_0xb04c('0x54')](_0x2c44d7[_0xb04c('0x4b')],_0x31a752[_0xb04c('0x4d')]));_0x32a784['where'][_0xb04c('0xba')]=_0x1f4e88['id'];if(_0x2c44d7[_0xb04c('0x4b')][_0xb04c('0x112')]){_0x32a784[_0xb04c('0x53')]=_[_0xb04c('0xa7')](_0x32a784['where'],{'$or':_[_0xb04c('0x41')](_0x32a784[_0xb04c('0x4f')],function(_0x5a626e){var _0x59e339={};_0x59e339[_0x5a626e]={'$like':'%'+_0x2c44d7[_0xb04c('0x4b')][_0xb04c('0x112')]+'%'};return _0x59e339;})});}if(_0x2c44d7['query'][_0xb04c('0x88')]){var _0x35f6b0=_0x2c44d7[_0xb04c('0x4b')][_0xb04c('0x88')][_0xb04c('0x73')](',');var _0x303bf5={};_0x303bf5[_0x35f6b0[0x0]]={'$gte':moment(_0x35f6b0[0x1])['format'](_0xb04c('0x113'))};_0x32a784[_0xb04c('0x53')]=_[_0xb04c('0xa7')](_0x32a784[_0xb04c('0x53')],_0x303bf5);}_0x32a784=_[_0xb04c('0xa7')]({},_0x32a784,_0x2c44d7[_0xb04c('0xc2')]);return db[_0xb04c('0xd6')]['count']({'where':_0x32a784[_0xb04c('0x53')]})[_0xb04c('0x22')](function(_0xe80b8c){_0x1b6c4e[_0xb04c('0x31')]=_0xe80b8c;if(_0x2c44d7[_0xb04c('0x4b')]['includeAll']){_0x32a784['include']=[{'all':!![]}];}return db[_0xb04c('0xd6')]['findAll'](_0x32a784);})['then'](function(_0x4ccd29){_0x1b6c4e[_0xb04c('0xbd')]=_0x4ccd29;return _0x1b6c4e;});}})[_0xb04c('0x22')](respondWithFilteredResult(_0x4286ca,_0x32a784))[_0xb04c('0x2c')](handleError(_0x4286ca,null));};exports['getMyMessages']=function(_0x168ad4,_0x46de8f,_0x7752f4){var _0xfdbb6e={'where':{}},_0x1ecea3={},_0x53cfa0={'count':0x0,'rows':[]};return db[_0xb04c('0x46')]['findOne']({'where':{'id':_0x168ad4[_0xb04c('0xbe')]['id']}})[_0xb04c('0x22')](handleEntityNotFound(_0x46de8f,null))[_0xb04c('0x22')](function(_0x317b86){if(_0x317b86){_0x1ecea3[_0xb04c('0x4a')]=_[_0xb04c('0x4c')](db[_0xb04c('0xd6')]['rawAttributes']);_0x1ecea3[_0xb04c('0x4b')]=_[_0xb04c('0x4c')](_0x168ad4[_0xb04c('0x4b')]);_0x1ecea3[_0xb04c('0x4d')]=_[_0xb04c('0x4e')](_0x1ecea3[_0xb04c('0x4a')],_0x1ecea3[_0xb04c('0x4b')]);_0xfdbb6e[_0xb04c('0x4f')]=_['intersection'](_0x1ecea3[_0xb04c('0x4a')],qs['fields'](_0x168ad4[_0xb04c('0x4b')]['fields']));_0xfdbb6e[_0xb04c('0x4f')]=_0xfdbb6e['attributes']['length']?_0xfdbb6e[_0xb04c('0x4f')]:_0x1ecea3[_0xb04c('0x4a')];if(!_0x168ad4['query'][_0xb04c('0x51')](_0xb04c('0x111'))){_0xfdbb6e[_0xb04c('0x32')]=qs[_0xb04c('0x32')](_0x168ad4[_0xb04c('0x4b')][_0xb04c('0x32')]);_0xfdbb6e[_0xb04c('0x2f')]=qs[_0xb04c('0x2f')](_0x168ad4[_0xb04c('0x4b')][_0xb04c('0x2f')]);}_0xfdbb6e[_0xb04c('0x9a')]=qs[_0xb04c('0x52')](_0x168ad4[_0xb04c('0x4b')]['sort']);_0xfdbb6e['where']=qs[_0xb04c('0x4d')](_['pick'](_0x168ad4[_0xb04c('0x4b')],_0x1ecea3[_0xb04c('0x4d')]));_0xfdbb6e['where'][_0xb04c('0xba')]=_0x317b86['id'];if(_0x168ad4[_0xb04c('0x4b')]['filter']){_0xfdbb6e[_0xb04c('0x53')]=_[_0xb04c('0xa7')](_0xfdbb6e['where'],{'$or':_[_0xb04c('0x41')](_0xfdbb6e[_0xb04c('0x4f')],function(_0x364ab8){var _0x2de313={};_0x2de313[_0x364ab8]={'$like':'%'+_0x168ad4[_0xb04c('0x4b')][_0xb04c('0x112')]+'%'};return _0x2de313;})});}_0xfdbb6e['where']['secret']=![];if(_0x168ad4[_0xb04c('0x4b')]['id']){_0xfdbb6e['where']['id']={'$gt':_0x168ad4[_0xb04c('0x4b')]['id']};}_0xfdbb6e=_[_0xb04c('0xa7')]({},_0xfdbb6e,_0x168ad4[_0xb04c('0xc2')]);return db[_0xb04c('0xd6')][_0xb04c('0x31')]({'where':_0xfdbb6e[_0xb04c('0x53')]})[_0xb04c('0x22')](function(_0x278cad){_0x53cfa0[_0xb04c('0x31')]=_0x278cad;_0xfdbb6e[_0xb04c('0xc1')]=[];if(_0x168ad4['query'][_0xb04c('0x114')]){_0xfdbb6e[_0xb04c('0xc1')][_0xb04c('0xbb')]({'model':db[_0xb04c('0x7c')],'as':_0xb04c('0x7c'),'attributes':['id',_0xb04c('0x42'),_0xb04c('0xfb')]});}if(_0x168ad4[_0xb04c('0x4b')][_0xb04c('0xc0')]){_0xfdbb6e[_0xb04c('0xc1')]=[{'all':!![]}];}return db[_0xb04c('0xd6')][_0xb04c('0x115')](_0xfdbb6e);})[_0xb04c('0x22')](function(_0x5d6109){_0x53cfa0[_0xb04c('0xbd')]=_0x5d6109;return _0x53cfa0;});}})[_0xb04c('0x22')](respondWithFilteredResult(_0x46de8f,_0xfdbb6e))[_0xb04c('0x2c')](handleError(_0x46de8f,null));};exports[_0xb04c('0x116')]=function(_0x584e49,_0x65f825,_0x35c637){return db[_0xb04c('0x46')][_0xb04c('0x6b')]({'where':{'id':_0x584e49['params']['id']}})[_0xb04c('0x22')](handleEntityNotFound(_0x65f825,null))[_0xb04c('0x22')](function(_0x3bc6dd){if(_0x3bc6dd){return _0x3bc6dd[_0xb04c('0x117')](_0x584e49[_0xb04c('0x3c')][_0xb04c('0x110')],_[_0xb04c('0x118')](_0x584e49[_0xb04c('0x3c')],[_0xb04c('0x110'),'id'])||{})['spread'](function(){return db[_0xb04c('0x119')][_0xb04c('0x115')]({'attributes':['id',_0xb04c('0x39'),_0xb04c('0x57')],'where':{'id':_0x584e49[_0xb04c('0x3c')][_0xb04c('0x110')]}});})['then'](function(_0x2aad3c){socket['emit'](_0xb04c('0x11a'),{'id':Number(_0x584e49[_0xb04c('0xbe')]['id']),'tags':_0x2aad3c||[]});return{'id':Number(_0x584e49[_0xb04c('0xbe')]['id']),'tags':_0x2aad3c||[]};});}})[_0xb04c('0x22')](respondWithResult(_0x65f825,null))['catch'](handleError(_0x65f825,null));};exports['removeTags']=function(_0x67975d,_0x5ce77a,_0x2e73f5){return db[_0xb04c('0x46')][_0xb04c('0x6b')]({'where':{'id':_0x67975d[_0xb04c('0xbe')]['id']}})[_0xb04c('0x22')](handleEntityNotFound(_0x5ce77a,null))[_0xb04c('0x22')](function(_0x401290){if(_0x401290){return _0x401290[_0xb04c('0x11b')](_0x67975d[_0xb04c('0x4b')]['ids']);}})[_0xb04c('0x22')](respondWithStatusCode(_0x5ce77a,null))[_0xb04c('0x2c')](handleError(_0x5ce77a,null));};exports[_0xb04c('0xed')]=function(_0x5246af,_0x240e56){var _0x11bcf8=moment()[_0xb04c('0x11c')]()['toString']();var _0x51c168=path[_0xb04c('0xe9')](config[_0xb04c('0xea')],'server',_0xb04c('0x11d'),_0xb04c('0x11e'));var _0x4a687a=path[_0xb04c('0xe9')](config[_0xb04c('0xea')],_0xb04c('0x11f'),_0xb04c('0x11d'),_0xb04c('0x120'));var _0x5d84aa=path['join'](_0x51c168,_0x11bcf8);var _0x5387ed=util[_0xb04c('0xef')](_0xb04c('0x121'),_0x5246af['params']['id'],_0x11bcf8);var _0x56b70c=path[_0xb04c('0xe9')](_0x51c168,_0x5387ed);var _0x74209e=[];_0x74209e[_0xb04c('0xbb')]({'model':db[_0xb04c('0x7c')],'as':_0xb04c('0x7c'),'attributes':['id','fullname'],'raw':!![]});_0x74209e[_0xb04c('0xbb')]({'model':db[_0xb04c('0xd9')],'as':'Contact','attributes':['id','firstName',_0xb04c('0x122')],'raw':!![]});if(_0x5246af[_0xb04c('0x4b')]['attachments']){_0x74209e[_0xb04c('0xbb')]({'model':db[_0xb04c('0xe6')],'as':_0xb04c('0xe6'),'raw':!![]});}var _0xfc8c28=[{'model':db[_0xb04c('0xd6')],'as':'Messages','attributes':['id',_0xb04c('0x3c'),_0xb04c('0x86'),'direction',_0xb04c('0x100'),_0xb04c('0x8a')],'include':_0x74209e}];_0xfc8c28['push']({'model':db[_0xb04c('0xc6')],'as':_0xb04c('0x123'),'attributes':['id',_0xb04c('0x39')]});_0xfc8c28['push']({'model':db[_0xb04c('0x7c')],'as':_0xb04c('0x124'),'attributes':['id',_0xb04c('0x42')]});return db[_0xb04c('0x46')][_0xb04c('0x6b')]({'where':{'id':_0x5246af[_0xb04c('0xbe')]['id']},'include':_0xfc8c28})[_0xb04c('0x22')](handleEntityNotFound(_0x240e56,null))['then'](function(_0x27497b){if(_0x27497b){var _0x408c2b=_0x27497b[_0xb04c('0x125')]({'plain':!![]});fs[_0xb04c('0x126')](_0x5d84aa);var _0x5ce740={'channel':_0xb04c('0x127'),'account':_0x408c2b[_0xb04c('0x123')]['name'],'agent':_0x408c2b['Owner']?_0x408c2b[_0xb04c('0x124')][_0xb04c('0x42')]:_0xb04c('0x128'),'createdAt':moment(_0x408c2b['createdAt'])[_0xb04c('0xef')](_0xb04c('0x113'))[_0xb04c('0xa5')](),'closedAt':_0x408c2b['closed']?moment(_0x408c2b[_0xb04c('0x129')])[_0xb04c('0xef')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x408c2b['disposition'],'chatInfo':{'browser':_0x408c2b[_0xb04c('0x12a')],'os':_0x408c2b[_0xb04c('0x12b')],'referer':_0x408c2b[_0xb04c('0x12c')],'customerIp':_0x408c2b[_0xb04c('0x12d')],'customerPort':_0x408c2b[_0xb04c('0x12e')]?_0x408c2b[_0xb04c('0x12e')]:_0xb04c('0x128')},'messages':_(_0x408c2b['Messages'])[_0xb04c('0x12f')]()['filter']({'secret':![]})[_0xb04c('0x41')](function(_0x1fb689){if(_0x1fb689[_0xb04c('0xe6')]){var _0x147c3c=path[_0xb04c('0xe9')](_0x4a687a,_0x1fb689[_0xb04c('0xe6')][_0xb04c('0xe0')]);if(fs[_0xb04c('0x130')](_0x147c3c)){fs[_0xb04c('0x131')](_0x147c3c)['pipe'](fs[_0xb04c('0x132')](path[_0xb04c('0xe9')](_0x5d84aa,_0x1fb689[_0xb04c('0xe6')][_0xb04c('0xe0')])));}}return{'date':moment(_0x1fb689[_0xb04c('0x86')])[_0xb04c('0xef')](_0xb04c('0x113'))['toString'](),'sender':_0x1fb689['direction']===_0xb04c('0xd5')?_0x1fb689[_0xb04c('0x7c')]?_0x1fb689['User'][_0xb04c('0x42')]:_0xb04c('0xf6'):_0x1fb689[_0xb04c('0x6f')][_0xb04c('0x133')]+(_0x1fb689['Contact'][_0xb04c('0x122')]?'\x20'+_0x1fb689[_0xb04c('0x6f')]['lastName']:''),'body':_0x1fb689[_0xb04c('0xe6')]?_0x1fb689['Attachment'][_0xb04c('0xe0')]:_0x1fb689['body'],'direction':_0x1fb689[_0xb04c('0xff')]===_0xb04c('0xd5')?'A':'C','secret':_0x1fb689[_0xb04c('0x100')],'read':_0x1fb689[_0xb04c('0x8a')],'attachment':_0x1fb689[_0xb04c('0xe6')]};})[_0xb04c('0x72')]()};return ejs[_0xb04c('0x134')](path[_0xb04c('0xe9')](config[_0xb04c('0xea')],_0xb04c('0x11f'),_0xb04c('0x135'),_0xb04c('0x136')),{'interaction':_0x5ce740})[_0xb04c('0x22')](function(_0x10ff79){var _0x11fec4=path[_0xb04c('0xe9')](_0x5d84aa,_0xb04c('0x137')+_0x408c2b['id']+'-'+_0x11bcf8+_0xb04c('0x138'));var _0x3fe177={'path':_0x11fec4,'channel':_0xb04c('0x127'),'interactionId':_0x408c2b['id']};return pdf[_0xb04c('0x139')](_0x10ff79,_0x3fe177);})['then'](function(){return new BPromise(function(_0x8231e2,_0x52236e){zipdir(_0x5d84aa,{'saveTo':_0x56b70c},function(_0x1a4d96,_0x618a7d){if(_0x1a4d96)return _0x52236e(_0x1a4d96);return _0x8231e2(_0x618a7d);});})[_0xb04c('0x22')](function(){return new BPromise(function(_0x3fbf1e,_0x88db6b){rimraf(_0x5d84aa,function(_0x384021){if(_0x384021)_0x88db6b(_0x384021);return _0x3fbf1e();});});})[_0xb04c('0x22')](function(){return _0x240e56['download'](_0x56b70c,_0x5387ed,function(_0x1d908a){if(_0x1d908a){console[_0xb04c('0x13a')](_0xb04c('0x13b'),_0x1d908a);}else{fs[_0xb04c('0x13c')](_0x56b70c);}});});});}else{return _0x240e56[_0xb04c('0x38')](0xc8);}})[_0xb04c('0x2c')](handleError(_0x240e56,null));}; \ No newline at end of file +var _0x952e=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','keys','includeAll','create','params','destroy','describe','createVidaooSession','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','isNull','follow','metadata','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','closed','disposition','AbandonInteraction','attachmentUpload','originalname','file','filename','mimetype','attachmentDownload','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','%s%d','agentAlias','customer','Visitor','agentIdentifier','System','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','nolimit','$gte','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','getMyMessages','addTags','omit','emit','chatInteractionTags:save','removeTags','unix','server','tmp','files','attachments','lastName','Owner','get','mkdirSync','Account','createdAt','closedAt','browserName','osName','customerPort','N.A.','existsSync','createReadStream','pipe','createWriteStream','firstName','renderFile','downloadInteraction.html','.pdf','Chat','createPdfFromHTML','log','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./chatInteraction.socket','jayson/promise','client','http','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','sendStatus','status','offset','undefined','count','set','json','reject','save','update','then','stack','name','merge','body','contact','interaction','account','Users','fullname','Tags','TagIds','split','forEach','push','map','rawAttributes','fieldName','key','model','query','attributes','intersection','length','hasOwnProperty','limit','order','sort','filters','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','end','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','some','compact','where','parse','$lte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','isEmpty','t.id\x20IN\x20?','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','role','agent','sequelize','toString','keyBy','ChatInteraction','fields','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname'];(function(_0x346922,_0x580409){var _0x5f1c78=function(_0x201135){while(--_0x201135){_0x346922['push'](_0x346922['shift']());}};_0x5f1c78(++_0x580409);}(_0x952e,0x1b4));var _0xe952=function(_0xc6151,_0x285138){_0xc6151=_0xc6151-0x0;var _0xf7864f=_0x952e[_0xc6151];return _0xf7864f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe952('0x0'));var zipdir=require(_0xe952('0x1'));var jsonpatch=require(_0xe952('0x2'));var rp=require('request-promise');var moment=require(_0xe952('0x3'));var BPromise=require(_0xe952('0x4'));var Mustache=require('mustache');var util=require(_0xe952('0x5'));var path=require(_0xe952('0x6'));var sox=require(_0xe952('0x7'));var csv=require(_0xe952('0x8'));var ejs=require(_0xe952('0x9'));var fs=require('fs');var fs_extra=require(_0xe952('0xa'));var _=require('lodash');var squel=require(_0xe952('0xb'));var crypto=require(_0xe952('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe952('0xd'));var toCsv=require(_0xe952('0x8'));var querystring=require('querystring');var Papa=require(_0xe952('0xe'));var Redis=require('ioredis');var authService=require(_0xe952('0xf'));var qs=require(_0xe952('0x10'));var as=require(_0xe952('0x11'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xe952('0x12'));var logger=require(_0xe952('0x13'))('api');var utils=require(_0xe952('0x14'));var config=require(_0xe952('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe952('0x16'))['db'];config['redis']=_[_0xe952('0x17')](config[_0xe952('0x18')],{'host':_0xe952('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe952('0x18')]));require(_0xe952('0x1a'))['register'](socket);var jayson=require(_0xe952('0x1b'));var client=jayson[_0xe952('0x1c')][_0xe952('0x1d')]({'port':0x232b});var client9004=jayson[_0xe952('0x1c')][_0xe952('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x5c86a3,_0x55950b,_0x2a7ecd,_0x2c250a){return new BPromise(function(_0x12e718,_0x1a69f){var _0x164180=_0x2c250a||client;return _0x164180['request'](_0x5c86a3,_0x2a7ecd)['then'](function(_0x16c713){logger[_0xe952('0x1e')](_0xe952('0x1f'),_0x55950b,'request\x20sent');logger['debug'](_0xe952('0x20'),_0x55950b,_0xe952('0x21'),JSON['stringify'](_0x16c713));if(_0x16c713['error']){if(_0x16c713['error'][_0xe952('0x22')]===0x1f4){logger[_0xe952('0x23')](_0xe952('0x1f'),_0x55950b,_0x16c713[_0xe952('0x23')][_0xe952('0x24')]);return _0x1a69f(_0x16c713[_0xe952('0x23')]['message']);}logger[_0xe952('0x23')](_0xe952('0x1f'),_0x55950b,_0x16c713[_0xe952('0x23')]['message']);return _0x12e718(_0x16c713['error'][_0xe952('0x24')]);}else{logger[_0xe952('0x1e')](_0xe952('0x1f'),_0x55950b,_0xe952('0x21'));_0x12e718(_0x16c713[_0xe952('0x25')][_0xe952('0x24')]);}})[_0xe952('0x26')](function(_0x5bad58){logger[_0xe952('0x23')](_0xe952('0x1f'),_0x55950b,_0x5bad58);_0x1a69f(_0x5bad58);});});}function respondWithStatusCode(_0x4cac89,_0x151526){_0x151526=_0x151526||0xcc;return function(_0x1a1dd4){if(_0x1a1dd4){return _0x4cac89[_0xe952('0x27')](_0x151526);}return _0x4cac89[_0xe952('0x28')](_0x151526)['end']();};}function respondWithResult(_0x2f2ba4,_0x1efa85){_0x1efa85=_0x1efa85||0xc8;return function(_0x1c0e81){if(_0x1c0e81){return _0x2f2ba4[_0xe952('0x28')](_0x1efa85)['json'](_0x1c0e81);}};}function respondWithFilteredResult(_0x5b538a,_0x2d495e){return function(_0x2ae471){if(_0x2ae471){var _0x275a41=typeof _0x2d495e[_0xe952('0x29')]==='undefined'&&typeof _0x2d495e['limit']===_0xe952('0x2a');var _0x54dbb2=_0x2ae471['count'];var _0x40a9c7=_0x275a41?0x0:_0x2d495e[_0xe952('0x29')];var _0x29a4bf=_0x275a41?_0x2ae471[_0xe952('0x2b')]:_0x2d495e[_0xe952('0x29')]+_0x2d495e['limit'];var _0x62954d;if(_0x29a4bf>=_0x54dbb2){_0x29a4bf=_0x54dbb2;_0x62954d=0xc8;}else{_0x62954d=0xce;}_0x5b538a['status'](_0x62954d);return _0x5b538a[_0xe952('0x2c')]('Content-Range',_0x40a9c7+'-'+_0x29a4bf+'/'+_0x54dbb2)[_0xe952('0x2d')](_0x2ae471);}return null;};}function patchUpdates(_0x185478){return function(_0x59e75e){try{jsonpatch['apply'](_0x59e75e,_0x185478,!![]);}catch(_0x238d67){return BPromise[_0xe952('0x2e')](_0x238d67);}return _0x59e75e[_0xe952('0x2f')]();};}function saveUpdates(_0xbd7fb4,_0x53278){return function(_0x2489de){if(_0x2489de){return _0x2489de[_0xe952('0x30')](_0xbd7fb4)[_0xe952('0x31')](function(_0x5524d8){return _0x5524d8;});}return null;};}function removeEntity(_0x3848df,_0x4c37f3){return function(_0x2eb207){if(_0x2eb207){return _0x2eb207['destroy']()[_0xe952('0x31')](function(){_0x3848df[_0xe952('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb24758,_0x14196f){return function(_0x46d22e){if(!_0x46d22e){_0xb24758['sendStatus'](0x194);}return _0x46d22e;};}function handleError(_0x5b40d3,_0x513106){_0x513106=_0x513106||0x1f4;return function(_0x194be6){logger[_0xe952('0x23')](_0x194be6[_0xe952('0x32')]);if(_0x194be6[_0xe952('0x33')]){delete _0x194be6[_0xe952('0x33')];}_0x5b40d3[_0xe952('0x28')](_0x513106)['send'](_0x194be6);};}function getMustacheRender(_0x1d4068,_0x4ee12a){return Mustache['render'](_0x1d4068,_[_0xe952('0x34')](_0x4ee12a[_0xe952('0x35')],{'contact':_0x4ee12a[_0xe952('0x36')],'message':_0x4ee12a[_0xe952('0x24')],'agent':_0x4ee12a['agent'],'interaction':_0x4ee12a[_0xe952('0x37')],'account':_0x4ee12a[_0xe952('0x38')]}))||'';}function getInteractionUsers(_0x3e49f2,_0x559a54){return new BPromise(function(_0x3cc089,_0x538058){try{if(_0x559a54[_0x3e49f2['id']]){_0x3e49f2[_0xe952('0x39')]=_['map'](_0x559a54[_0x3e49f2['id']],function(_0x26f6dc){return{'id':_0x26f6dc['id'],'fullname':_0x26f6dc[_0xe952('0x3a')]};});}}catch(_0x52e016){_0x538058(_0x52e016);}_0x3cc089(_0x3e49f2);});}function getInteractionTags(_0x18c43b,_0x595cff){return new BPromise(function(_0x3c64d4,_0x58caf9){try{if(_0x18c43b['TagIds']){_0x18c43b[_0xe952('0x3b')]=[];_0x18c43b[_0xe952('0x3c')][_0xe952('0x3d')](',')[_0xe952('0x3e')](function(_0x58806a){_0x18c43b[_0xe952('0x3b')][_0xe952('0x3f')](_0x595cff[_0x58806a]);});}delete _0x18c43b['TagIds'];}catch(_0x535b8f){_0x58caf9(_0x535b8f);}_0x3c64d4(_0x18c43b);});}function updateChatInteraction(_0x2206b2,_0x330cf1,_0x170b0b){return new BPromise(function(_0x46c22a,_0x528250){return getInteractionUsers(_0x2206b2,_0x170b0b)[_0xe952('0x31')](function(_0x69e37e){return getInteractionTags(_0x69e37e,_0x330cf1);})[_0xe952('0x31')](function(_0x2d4931){_0x46c22a(_0x2d4931);})[_0xe952('0x26')](function(_0x2ae974){_0x528250(_0x2ae974);});});}exports['index']=function(_0x436709,_0x1731ee){var _0x3e221e={},_0x2f2929={},_0x1261ce={'count':0x0,'rows':[]};var _0x53e344=_[_0xe952('0x40')](db['ChatInteraction'][_0xe952('0x41')],function(_0x1926c2){return{'name':_0x1926c2[_0xe952('0x42')],'type':_0x1926c2['type'][_0xe952('0x43')]};});_0x2f2929[_0xe952('0x44')]=_[_0xe952('0x40')](_0x53e344,_0xe952('0x33'));_0x2f2929[_0xe952('0x45')]=_['keys'](_0x436709['query']);_0x2f2929['filters']=_['intersection'](_0x2f2929[_0xe952('0x44')],_0x2f2929['query']);_0x3e221e[_0xe952('0x46')]=_[_0xe952('0x47')](_0x2f2929[_0xe952('0x44')],qs['fields'](_0x436709[_0xe952('0x45')]['fields']));_0x3e221e[_0xe952('0x46')]=_0x3e221e[_0xe952('0x46')][_0xe952('0x48')]?_0x3e221e[_0xe952('0x46')]:_0x2f2929[_0xe952('0x44')];if(!_0x436709[_0xe952('0x45')][_0xe952('0x49')]('nolimit')){_0x3e221e[_0xe952('0x4a')]=qs[_0xe952('0x4a')](_0x436709[_0xe952('0x45')][_0xe952('0x4a')]);_0x3e221e[_0xe952('0x29')]=qs[_0xe952('0x29')](_0x436709[_0xe952('0x45')][_0xe952('0x29')]);}_0x3e221e[_0xe952('0x4b')]=qs['sort'](_0x436709['query'][_0xe952('0x4c')]);_0x3e221e['where']=qs[_0xe952('0x4d')](_[_0xe952('0x4e')](_0x436709[_0xe952('0x45')],_0x2f2929['filters']),_0x53e344);var _0x2e4b97=[];var _0x4995b1=squel['select']()[_0xe952('0x4f')]('id')[_0xe952('0x4f')]('name')['field'](_0xe952('0x50'))[_0xe952('0x51')](_0xe952('0x52'));var _0x5e373c=squel[_0xe952('0x53')]()[_0xe952('0x4f')](_0xe952('0x54'))[_0xe952('0x4f')](_0xe952('0x55'))[_0xe952('0x4f')](_0xe952('0x56'))[_0xe952('0x51')](_0xe952('0x57'),'ui')[_0xe952('0x58')]('users','u',_0xe952('0x59'));var _0x24bf61=squel[_0xe952('0x53')]()[_0xe952('0x51')](_0xe952('0x5a'),'i')['left_join']('cm_contacts','c',_0xe952('0x5b'))[_0xe952('0x58')]('users','o',_0xe952('0x5c'))['left_join']('chat_websites','a',_0xe952('0x5d'))['left_join'](_0xe952('0x5e'),'me',_0xe952('0x5f'))[_0xe952('0x58')](_0xe952('0x60'),'it','it.ChatInteractionId\x20=\x20i.id')[_0xe952('0x58')](_0xe952('0x52'),'t','t.id\x20=\x20it.TagId');var _0x15f72a=squel[_0xe952('0x61')]();var _0x5686e3=[];var _0x1337f4=squel['expr']();var _0x3f11d6;if(_0x436709[_0xe952('0x45')][_0xe952('0x62')]){_0x3f11d6=as[_0xe952('0x63')](_0x436709[_0xe952('0x45')][_0xe952('0x62')]);var _0x20315f=_0x3f11d6[_0xe952('0x64')];for(var _0x276c2e=0x0;_0x276c2e<_0x3f11d6[_0xe952('0x65')][_0xe952('0x48')];_0x276c2e++){var _0x44bf29=_0x3f11d6[_0xe952('0x65')][_0x276c2e];var _0x37da0c='i';var _0x799601=_[_0xe952('0x66')](_0x53e344,[_0xe952('0x33'),_0x44bf29['field']]);if(!_0x799601){switch(_0x44bf29['field']){case _0xe952('0x67'):if(_0x44bf29['value']==0x1){_0x24bf61[_0xe952('0x68')]('`'+_0x44bf29[_0xe952('0x4f')]+_0xe952('0x69'));}else{_0x24bf61['having']('`'+_0x44bf29[_0xe952('0x4f')]+_0xe952('0x6a'));}break;case _0xe952('0x6b'):if(_0x44bf29[_0xe952('0x6c')]===_0xe952('0x6d')){if(_0x44bf29[_0xe952('0x6e')][_0xe952('0x3d')]('\x20')[_0xe952('0x48')]>0x1){_0x15f72a[_0x20315f]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x44bf29[_0xe952('0x6e')]),null);}else{var _0x1c8a0e='%'+_0x44bf29[_0xe952('0x6e')]+'%';_0x15f72a[_0x20315f](_0xe952('0x6f'),_0x1c8a0e,_0x1c8a0e,_0x1c8a0e);}}else{_0x799601=_[_0xe952('0x66')](_0x53e344,[_0xe952('0x33'),_0xe952('0x70')]);_0x44bf29[_0xe952('0x4f')]=_0xe952('0x70');_0x50dc8e=as['buildExpression'](_0x37da0c,_0x799601[_0xe952('0x71')],_0x44bf29);_0x15f72a[_0x20315f](_0x50dc8e[_0xe952('0x72')],_0x50dc8e[_0xe952('0x6e')][_0xe952('0x73')],_0x50dc8e[_0xe952('0x6e')][_0xe952('0x74')]);}break;case _0xe952('0x75'):var _0x4d7667=_0x44bf29[_0xe952('0x6e')][_0xe952('0x3d')](',')[_0xe952('0x40')](function(_0x1b4cb9){return Number(_0x1b4cb9);});_0x4d7667[_0xe952('0x3e')](function(_0x422699){_0x1337f4['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x422699+',%');});_0x5686e3=_[_0xe952('0x76')](_0x5686e3,_0x4d7667);break;case _0xe952('0x77'):if(_0x44bf29['operator']==='$substring'){_0x15f72a[_0x20315f](_0xe952('0x78'),'%'+_0x44bf29[_0xe952('0x6e')]+'%',null);}else{_0x799601=_['find'](_0x53e344,[_0xe952('0x33'),'UserId']);_0x44bf29[_0xe952('0x4f')]=_0xe952('0x79');_0x50dc8e=as[_0xe952('0x7a')](_0x37da0c,_0x799601['type'],_0x44bf29);_0x15f72a[_0x20315f](_0x50dc8e[_0xe952('0x72')],_0x50dc8e[_0xe952('0x6e')][_0xe952('0x73')],_0x50dc8e[_0xe952('0x6e')][_0xe952('0x74')]);}break;case _0xe952('0x35'):_0x50dc8e=as[_0xe952('0x7a')]('me',null,_0x44bf29);_0x15f72a[_0x20315f](_0x50dc8e[_0xe952('0x72')],_0x50dc8e[_0xe952('0x6e')]['start'],_0x50dc8e[_0xe952('0x6e')]['end']);break;}}else{var _0x50dc8e=as['buildExpression'](_0x37da0c,_0x799601[_0xe952('0x71')],_0x44bf29);_0x15f72a[_0x20315f](_0x50dc8e[_0xe952('0x72')],_0x50dc8e[_0xe952('0x6e')][_0xe952('0x73')],_0x50dc8e[_0xe952('0x6e')][_0xe952('0x74')]);}}}else{var _0x2a3d21=_(_0x436709[_0xe952('0x45')])['keys']()['map'](function(_0x38856c){return _[_0xe952('0x7b')](_0x53e344,[_0xe952('0x33'),_0x38856c])?_0x38856c:undefined;})[_0xe952('0x7c')]()[_0xe952('0x6e')]();if(!_['isEmpty'](_0x2a3d21)){_0x2a3d21[_0xe952('0x3e')](function(_0x158d59){if(_0x158d59==='ChatWebsiteId'){_0x24bf61[_0xe952('0x7d')]('i.ChatWebsiteId\x20IN\x20?',[]['concat'](_0x436709[_0xe952('0x45')][_0x158d59]));}else if(_0x158d59==='createdAt'){var _0x3f3f70=JSON[_0xe952('0x7e')](_0x436709[_0xe952('0x45')][_0x158d59])['$gte'];var _0x1038b5=JSON[_0xe952('0x7e')](_0x436709[_0xe952('0x45')][_0x158d59])[_0xe952('0x7f')];_0x24bf61[_0xe952('0x7d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3f3f70,_0x1038b5);}else{if(_0x436709[_0xe952('0x45')][_0x158d59]==='null'){_0x24bf61[_0xe952('0x7d')]('i.'+_0x158d59+_0xe952('0x80'));}else{_0x24bf61[_0xe952('0x7d')]('i.'+_0x158d59+_0xe952('0x81'),_0x436709['query'][_0x158d59]);}}});}if(_0x436709[_0xe952('0x45')]['read']){if(_0x436709[_0xe952('0x45')][_0xe952('0x82')]==0x1){_0x24bf61[_0xe952('0x68')](_0xe952('0x83'));}else{_0x24bf61[_0xe952('0x68')](_0xe952('0x84'));}}if(_0x436709[_0xe952('0x45')]['tag']){_0x5686e3=_[_0xe952('0x85')](_0x436709[_0xe952('0x45')][_0xe952('0x86')])?_0x436709[_0xe952('0x45')][_0xe952('0x86')]:new Array(_0x436709[_0xe952('0x45')][_0xe952('0x86')]);_0x5686e3[_0xe952('0x3e')](function(_0x5af734){_0x1337f4['or'](_0xe952('0x87'),'%,'+_0x5af734+',%');});}if(_0x436709[_0xe952('0x45')]['filter']){var _0x1d49c9=_0x436709[_0xe952('0x45')][_0xe952('0x88')][_0xe952('0x89')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1d49c9)){_0x15f72a['or'](_0xe952('0x8a'),_0x1d49c9+'%');}else{_0x15f72a['or'](_0xe952('0x8b'),qs['getFullTextValue'](_0x1d49c9))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1d49c9+'%');}}}_0x24bf61[_0xe952('0x7d')](_0x15f72a);_0x24bf61[_0xe952('0x8c')](_0xe952('0x8d'));var _0x527108={'type':db[_0xe952('0x8e')][_0xe952('0x8f')][_0xe952('0x90')],'raw':!![]};var _0x4ff2c8=_0x24bf61[_0xe952('0x91')]();_0x4ff2c8[_0xe952('0x4f')](_0xe952('0x8d'));_0x4ff2c8[_0xe952('0x4f')](_0xe952('0x92'),_0xe952('0x67'));if(_0x3e221e[_0xe952('0x4b')]){_0x3e221e[_0xe952('0x4b')][_0xe952('0x3e')](function(_0x107aae){var _0x4f1bc0=_0x107aae[0x0]===_0xe952('0x93')?_0x107aae[0x0]:'i.'+_0x107aae[0x0];_0x24bf61[_0xe952('0x4b')](_0x4f1bc0,_0x107aae[0x1]==='DESC'?![]:!![]);});}if(!_[_0xe952('0x94')](_0x5686e3)){_0x24bf61[_0xe952('0x68')](_0x1337f4);_0x4ff2c8[_0xe952('0x7d')](_0xe952('0x95'),_0x5686e3);}BPromise[_0xe952('0x96')]()[_0xe952('0x31')](function(){if(!_0x3f11d6){if(_0x436709[_0xe952('0x45')][_0xe952('0x97')])return;_0x4ff2c8['where'](_0xe952('0x98'));_0x24bf61[_0xe952('0x7d')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x436709[_0xe952('0x99')]['role']!=='agent')return;return _0x436709[_0xe952('0x99')]['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0xe952('0x31')](function(_0x50d6b9){if(_[_0xe952('0x94')](_0x50d6b9)){_0x4ff2c8[_0xe952('0x7d')](_0xe952('0x9a'));_0x24bf61[_0xe952('0x7d')](_0xe952('0x9a'));}else{_0x4ff2c8[_0xe952('0x7d')](_0xe952('0x9b'),_[_0xe952('0x40')](_0x50d6b9,'id'));_0x24bf61[_0xe952('0x7d')]('i.ChatWebsiteId\x20IN\x20?',_[_0xe952('0x40')](_0x50d6b9,'id'));}});})[_0xe952('0x31')](function(){if(_0x436709['user'][_0xe952('0x9c')]===_0xe952('0x9d')&&!_0x3f11d6&&!_0x436709['query'][_0xe952('0x97')])return[];return db[_0xe952('0x9e')][_0xe952('0x45')](_0x4ff2c8[_0xe952('0x9f')](),_0x527108);})[_0xe952('0x31')](function(_0x21f3e0){_0x1261ce['count']=_0x21f3e0['length'];if(_0x1261ce[_0xe952('0x2b')]===0x0)return[];return db[_0xe952('0x9e')]['query'](_0x4995b1['toString'](),_0x527108)[_0xe952('0x31')](function(_0x49aa9c){_0x2e4b97=_[_0xe952('0xa0')](_0x49aa9c,'id');_0x527108=_[_0xe952('0x34')](_0x527108,{'model':db[_0xe952('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x436709['query'][_0xe952('0xa2')]){_0x3e221e[_0xe952('0x46')][_0xe952('0x3e')](function(_0xa81565){_0x24bf61[_0xe952('0x4f')]('i.'+_0xa81565);});}else{_0x24bf61[_0xe952('0x4f')](_0xe952('0x92'),_0xe952('0x67'));_0x24bf61['field']('a.key','Account.key');_0x24bf61[_0xe952('0x4f')](_0xe952('0xa3'),'Account.mandatoryDisposition');_0x24bf61[_0xe952('0x4f')](_0xe952('0xa4'),_0xe952('0x93'));_0x24bf61[_0xe952('0x4f')](_0xe952('0xa5'));_0x24bf61[_0xe952('0x4f')](_0xe952('0xa6'),_0xe952('0xa7'));_0x24bf61[_0xe952('0x4f')]('c.lastName',_0xe952('0xa8'));_0x24bf61[_0xe952('0x4f')](_0xe952('0xa9'),'Contact.email');_0x24bf61[_0xe952('0x4f')](_0xe952('0xaa'),_0xe952('0xab'));_0x24bf61['field']('c.mobile',_0xe952('0xac'));_0x24bf61['field'](_0xe952('0xad'),_0xe952('0xae'));_0x24bf61[_0xe952('0x4f')]('o.fullname',_0xe952('0xaf'));_0x24bf61['field'](_0xe952('0xb0'),_0xe952('0xb1'));_0x24bf61[_0xe952('0x4f')](_0xe952('0xb2'),_0xe952('0x3c'));}if(_0x3e221e[_0xe952('0x4a')])_0x24bf61[_0xe952('0x4a')](_0x3e221e[_0xe952('0x4a')]);if(_0x3e221e[_0xe952('0x29')])_0x24bf61[_0xe952('0x29')](_0x3e221e[_0xe952('0x29')]);return db[_0xe952('0x9e')]['query'](_0x24bf61['toString'](),_0x527108);})[_0xe952('0x31')](function(_0x1d7b73){if(_0x1d7b73[_0xe952('0x48')]>0x0)_0x5e373c[_0xe952('0x7d')](_0xe952('0xb3'),_['map'](_0x1d7b73,'id'));return db[_0xe952('0x9e')]['query'](_0x5e373c[_0xe952('0x9f')](),_0x527108)['then'](function(_0x47e67f){var _0x2b0562=_[_0xe952('0xb4')](_0x47e67f,_0xe952('0xb5'));var _0x5d42ab=[];_0x1d7b73[_0xe952('0x3e')](function(_0x8f5af){_0x5d42ab[_0xe952('0x3f')](updateChatInteraction(_0x8f5af,_0x2e4b97,_0x2b0562));});return BPromise[_0xe952('0xb6')](_0x5d42ab);});});})[_0xe952('0x31')](function(_0x4c6319){_0x1261ce[_0xe952('0xb7')]=_0x4c6319;return _0x1261ce;})['then'](respondWithFilteredResult(_0x1731ee,_0x3e221e))[_0xe952('0x26')](handleError(_0x1731ee,null));};exports[_0xe952('0xb8')]=function(_0x1cb7fe,_0xd67062){var _0x589f7e={'raw':![],'where':{'id':_0x1cb7fe['params']['id']}},_0x3073b3={};_0x3073b3[_0xe952('0x44')]=_[_0xe952('0xb9')](db[_0xe952('0xa1')][_0xe952('0x41')]);_0x3073b3[_0xe952('0x45')]=_[_0xe952('0xb9')](_0x1cb7fe[_0xe952('0x45')]);_0x3073b3[_0xe952('0x4d')]=_[_0xe952('0x47')](_0x3073b3[_0xe952('0x44')],_0x3073b3['query']);_0x589f7e[_0xe952('0x46')]=_['intersection'](_0x3073b3[_0xe952('0x44')],qs[_0xe952('0xa2')](_0x1cb7fe['query']['fields']));_0x589f7e[_0xe952('0x46')]=_0x589f7e[_0xe952('0x46')][_0xe952('0x48')]?_0x589f7e[_0xe952('0x46')]:_0x3073b3[_0xe952('0x44')];if(_0x1cb7fe[_0xe952('0x45')][_0xe952('0xba')]){_0x589f7e['include']=[{'all':!![]}];}_0x589f7e=_[_0xe952('0x34')]({},_0x589f7e,_0x1cb7fe['options']);return db[_0xe952('0xa1')]['find'](_0x589f7e)['then'](handleEntityNotFound(_0xd67062,null))['then'](respondWithResult(_0xd67062,null))[_0xe952('0x26')](handleError(_0xd67062,null));};exports[_0xe952('0xbb')]=function(_0x577f58,_0x5e0bb1){return db[_0xe952('0xa1')][_0xe952('0xbb')](_0x577f58['body'],{})['then'](respondWithResult(_0x5e0bb1,0xc9))[_0xe952('0x26')](handleError(_0x5e0bb1,null));};exports['update']=function(_0x4c049c,_0x58991d){if(_0x4c049c['body']['id']){delete _0x4c049c[_0xe952('0x35')]['id'];}return db[_0xe952('0xa1')]['find']({'where':{'id':_0x4c049c[_0xe952('0xbc')]['id']}})[_0xe952('0x31')](handleEntityNotFound(_0x58991d,null))['then'](saveUpdates(_0x4c049c[_0xe952('0x35')],null))['then'](respondWithResult(_0x58991d,null))[_0xe952('0x26')](handleError(_0x58991d,null));};exports[_0xe952('0xbd')]=function(_0x19b939,_0x91f4dc){return db[_0xe952('0xa1')][_0xe952('0x66')]({'where':{'id':_0x19b939[_0xe952('0xbc')]['id']}})[_0xe952('0x31')](handleEntityNotFound(_0x91f4dc,null))[_0xe952('0x31')](removeEntity(_0x91f4dc,null))[_0xe952('0x26')](handleError(_0x91f4dc,null));};exports[_0xe952('0xbe')]=function(_0x3c2598,_0x351607){return db['ChatInteraction']['describe']()[_0xe952('0x31')](respondWithResult(_0x351607,null))['catch'](handleError(_0x351607,null));};exports[_0xe952('0xbf')]=function(_0x242add,_0x33fc9a){var _0x527ace=_0x242add['params']['id'];var _0x356a8b;var _0x4731a9;var _0xf0a6d;return db['ChatInteraction']['findOne']({'where':{'id':_0x527ace}})[_0xe952('0x31')](function(_0x54071d){_0x356a8b=_0x54071d;return db[_0xe952('0xc0')][_0xe952('0xc1')]({'where':{'id':_0x54071d[_0xe952('0x97')]},'attributes':['id',_0xe952('0xc2'),_0xe952('0xc3'),_0xe952('0xc4'),_0xe952('0xc5'),_0xe952('0xc6')],'raw':!![]});})[_0xe952('0x31')](function(_0x388ae6){if(_0x388ae6&&_0x388ae6['vidaooApiKey']&&_0x388ae6[_0xe952('0xc3')]){_0x4731a9=_0x388ae6;var _0x39eb73={'interaction':{'id':_0x527ace},'agent':{'id':_0x242add[_0xe952('0x99')]['id'],'name':_0x242add[_0xe952('0x99')]['name'],'fullname':_0x242add[_0xe952('0x99')]['fullname'],'email':_0x242add[_0xe952('0x99')][_0xe952('0xc7')]},'contact':_0x242add[_0xe952('0x35')]['contact'],'account':_0x242add[_0xe952('0x35')][_0xe952('0x38')]};var _0x550509={'rejectUnauthorized':![],'method':_0xe952('0xc8'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x388ae6[_0xe952('0xc2')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x242add[_0xe952('0x99')][_0xe952('0xc7')]],'buttons':null,'topic':_0x4731a9[_0xe952('0xc4')],'note':_[_0xe952('0xc9')](_0x4731a9[_0xe952('0xc5')])?null:getMustacheRender(_0x4731a9[_0xe952('0xc5')],_0x39eb73),'metadata':null},'redirect':_0xe952('0xca'),'json':!![]};try{if(!_['isNull'](_0x4731a9[_0xe952('0xc6')])){var _0x151b4e=getMustacheRender(_0x4731a9[_0xe952('0xc6')],_0x39eb73);var _0xdf5f5=JSON[_0xe952('0x7e')](_0x151b4e);_0x550509['body'][_0xe952('0xcb')]=_0xdf5f5;}}catch(_0x214685){throw new db[(_0xe952('0x8e'))]['ValidationError'](_0xe952('0xcc'));}return rp(_0x550509);}else{throw new db[(_0xe952('0x8e'))][(_0xe952('0xcd'))](_0xe952('0xce'));}})['then'](function(_0x34cfae){_0xf0a6d=_0x34cfae;if(_0xf0a6d['id']){var _0x5b5d={'body':_0xf0a6d['join_url'],'ChatWebsiteId':_0x4731a9['id'],'ChatInteractionId':_0x356a8b['id'],'direction':'out','UserId':_0x242add[_0xe952('0x99')]['id']};return db[_0xe952('0xcf')][_0xe952('0xbb')](_0x5b5d,{});}else{throw new db[(_0xe952('0x8e'))]['ValidationError'](_0xe952('0xd0'));}})[_0xe952('0x31')](function(){return _0x356a8b[_0xe952('0xd1')]({'vidaooSessionId':_0xf0a6d['id']});})[_0xe952('0x31')](respondWithResult(_0x33fc9a,null))[_0xe952('0x26')](handleError(_0x33fc9a,null));};exports['customUpdate']=function(_0x4db4f2,_0x31376){if(_0x4db4f2[_0xe952('0x35')]['id']){delete _0x4db4f2[_0xe952('0x35')]['id'];}return db[_0xe952('0xa1')][_0xe952('0x66')]({'where':{'id':_0x4db4f2[_0xe952('0xbc')]['id']},'include':[{'model':db[_0xe952('0xd2')],'as':_0xe952('0x6b')}]})['then'](handleEntityNotFound(_0x31376,null))['then'](saveUpdates(_0x4db4f2[_0xe952('0x35')],null))[_0xe952('0x31')](respondWithResult(_0x31376,null))[_0xe952('0x26')](handleError(_0x31376,null));};exports[_0xe952('0xd3')]=function(_0x33ee81,_0x292cf2,_0x5ecdfb){if(_0x33ee81[_0xe952('0x35')]['id']){delete _0x33ee81[_0xe952('0x35')]['id'];}return db['ChatInteraction'][_0xe952('0x66')]({'where':{'id':_0x33ee81[_0xe952('0xbc')]['id']}})['then'](function(_0xe238ea){if(!_0xe238ea){logger[_0xe952('0x23')](_0xe952('0xd4'),_0xe952('0xd3'),0x194,'entity\x20not\x20found');_0x292cf2[_0xe952('0x27')](0x194);}else{if(_0xe238ea['UserId']){throw new db[(_0xe952('0x8e'))][(_0xe952('0xcd'))]('Interaction\x20already\x20assigned');}}return _0xe238ea;})[_0xe952('0x31')](function(_0x7d1c1f){if(_0x7d1c1f){return _0x7d1c1f[_0xe952('0x30')]({'closed':_0x33ee81[_0xe952('0x35')][_0xe952('0xd5')],'disposition':_0x33ee81['body'][_0xe952('0xd6')]})['then'](function(_0x2f5fcc){return _0x2f5fcc;});}})[_0xe952('0x31')](function(_0x477eb4){return respondWithRpcPromise(_0xe952('0xd7'),_0xe952('0xd3'),_0x33ee81[_0xe952('0x35')],client9004);})[_0xe952('0x31')](respondWithResult(_0x292cf2,null))[_0xe952('0x26')](handleError(_0x292cf2,null));};exports[_0xe952('0xd8')]=function(_0x453ac6,_0x4e41b6,_0x3577af){_0x453ac6[_0xe952('0x35')][_0xe952('0x33')]=_0x453ac6['file'][_0xe952('0xd9')];_0x453ac6['body']['basename']=_0x453ac6[_0xe952('0xda')][_0xe952('0xdb')];_0x453ac6[_0xe952('0x35')][_0xe952('0x71')]=_0x453ac6[_0xe952('0xda')][_0xe952('0xdc')];return db['Attachment']['create'](_0x453ac6[_0xe952('0x35')])[_0xe952('0x31')](respondWithResult(_0x4e41b6,0xc9))[_0xe952('0x26')](handleError(_0x4e41b6,null));};exports[_0xe952('0xdd')]=function(_0x538bbb,_0x55ebe0,_0x59f0a8){return db[_0xe952('0xa1')][_0xe952('0xc1')]({'where':{'id':_0x538bbb[_0xe952('0xbc')]['id']},'raw':!![]})[_0xe952('0x31')](handleEntityNotFound(_0x55ebe0,null))[_0xe952('0x31')](function(_0x413401){if(_0x413401){if(_0x413401['closed']){return _0x55ebe0[_0xe952('0x28')](0x193)[_0xe952('0x2d')]({'status':0x193,'message':'Unauthorized'});}return db[_0xe952('0xde')][_0xe952('0xc1')]({'where':{'id':_0x538bbb[_0xe952('0x45')][_0xe952('0xdf')]},'raw':!![]})[_0xe952('0x31')](handleEntityNotFound(_0x55ebe0,null));}})['then'](function(_0x38f97b){if(_0x38f97b){var _0x4e0420=_0x38f97b[_0xe952('0xe0')]!==null;var _0x4e8834=path[_0xe952('0xe1')](config[_0xe952('0xe2')],_0xe952('0xe3'));if(_0x4e0420){_0x4e8834=path['join'](_0x4e8834,_0xe952('0xe4'));}var _0x1ba274=path[_0xe952('0xe1')](_0x4e8834,_0x38f97b[_0xe952('0xe5')]);return _0x55ebe0['download'](_0x1ba274);}})[_0xe952('0x26')](handleError(_0x55ebe0,null));};exports[_0xe952('0xe6')]=function(_0xc69754,_0x4f9e0c){var _0x5679e8=null;var _0x54c537=null;var _0x597728=null;var _0xc65d5b=null;if(_0xc69754[_0xe952('0x35')]['id']){delete _0xc69754[_0xe952('0x35')]['id'];}if(_0xc69754[_0xe952('0x35')][_0xe952('0xe7')]){_0xc65d5b=path[_0xe952('0xe1')](config[_0xe952('0xe2')],_0xe952('0xe8'),util[_0xe952('0xe9')](_0xe952('0xea'),Date['now']()));_0xc69754['body'][_0xe952('0xeb')]=_0xc65d5b;}return db[_0xe952('0xa1')][_0xe952('0x66')]({'where':{'id':_0xc69754[_0xe952('0xbc')]['id']},'include':[{'model':db[_0xe952('0xcf')],'as':_0xe952('0xec'),'include':[{'model':db[_0xe952('0x77')],'as':'User'}]}]})[_0xe952('0x31')](handleEntityNotFound(_0x4f9e0c,null))[_0xe952('0x31')](saveUpdates(_0xc69754[_0xe952('0x35')],null))[_0xe952('0x31')](function(_0x3c0104){if(_0x3c0104){_0x5679e8=_0x3c0104;return db['ChatWebsite'][_0xe952('0x66')]({'where':{'id':_0x5679e8[_0xe952('0x97')]}});}})[_0xe952('0x31')](function(_0x57cfca){if(_0x57cfca){_0x597728=_0x57cfca;return db[_0xe952('0xd2')]['find']({'where':{'id':_0x5679e8['ContactId']}});}})['then'](function(_0x563356){if(_0x563356){_0x54c537=_0x563356;if(_0xc65d5b){var _0x5ad595=null;for(var _0x209c00=0x1;_0x209c00<_0x5679e8[_0xe952('0xec')]['length'];++_0x209c00){_0x5ad595=_0x5679e8[_0xe952('0xec')][_0x209c00];var _0xd5cac0=_0x5ad595['UserId']?util[_0xe952('0xe9')](_0xe952('0xed'),_0x597728[_0xe952('0xee')],_0x5ad595[_0xe952('0x79')]):'System';var _0x2482eb=_0xc69754[_0xe952('0x35')][_0xe952('0xef')]||util[_0xe952('0xe9')](_0xe952('0xed'),_0xe952('0xf0'),_0x5ad595[_0xe952('0x70')]);switch(_0x597728[_0xe952('0xf1')]){case'website_alias':_0xd5cac0=_0x5ad595[_0xe952('0x79')]?util[_0xe952('0xe9')](_0xe952('0xed'),_0x597728[_0xe952('0xee')],_0x5ad595[_0xe952('0x79')]):_0xe952('0xf2');break;case'agent_alias':_0xd5cac0=_0x5ad595[_0xe952('0x79')]?_0x5ad595[_0xe952('0x77')][_0xe952('0xf3')]||_0x5ad595[_0xe952('0x77')]['fullname']:_0xe952('0xf2');break;case _0xe952('0xf4'):_0xd5cac0=_0x5ad595[_0xe952('0x79')]?_0x5ad595[_0xe952('0x77')][_0xe952('0x3a')]:'System';break;default:_0xd5cac0=_0x5ad595['UserId']?util[_0xe952('0xe9')](_0xe952('0xed'),_0x597728[_0xe952('0xee')],_0x5ad595[_0xe952('0x79')]):'System';}var _0x52f695=util[_0xe952('0xe9')](_0xe952('0xf5'),moment(_0x5ad595['createdAt'])[_0xe952('0xe9')](_0xe952('0xf6')),_0x5ad595[_0xe952('0xf7')]==='in'?_0x2482eb:_0xd5cac0,_0x5ad595[_0xe952('0x35')]);if(!_0x5ad595[_0xe952('0xf8')]){fs[_0xe952('0xf9')](_0xc65d5b,_0x52f695);}}return db[_0xe952('0xfa')][_0xe952('0xc1')]({'where':{'service':!![]},'include':[{'model':db[_0xe952('0xfb')],'as':_0xe952('0xfc'),'raw':!![]}]});}}})[_0xe952('0x31')](function(_0x46c3c2){if(_0x46c3c2&&_0x46c3c2[_0xe952('0xfc')]&&_0xc69754[_0xe952('0x35')]){var _0x83d7ed={'tls':{'rejectUnauthorized':![]}};if(_0x46c3c2[_0xe952('0xfc')][_0xe952('0xfd')]){_0x83d7ed['service']=_0x46c3c2[_0xe952('0xfc')][_0xe952('0xfd')];}else{_0x83d7ed[_0xe952('0xfe')]=_0x46c3c2[_0xe952('0xfc')][_0xe952('0xfe')];_0x83d7ed[_0xe952('0xff')]=_0x46c3c2[_0xe952('0xfc')][_0xe952('0xff')];_0x83d7ed['secure']=_0x46c3c2['Smtp'][_0xe952('0x100')];}if(_0x46c3c2[_0xe952('0xfc')][_0xe952('0x101')]){_0x83d7ed[_0xe952('0x102')]={'user':_0x46c3c2[_0xe952('0xfc')][_0xe952('0x99')],'pass':_0x46c3c2[_0xe952('0xfc')][_0xe952('0x103')]};}return respondWithRpcPromise(_0xe952('0x104'),_0xe952('0x105'),{'account':_0x83d7ed,'message':{'from':util[_0xe952('0xe9')]('\x22%s\x22\x20<%s>',_0x46c3c2[_0xe952('0x33')],_0x46c3c2['email']||_0x46c3c2['Smtp']['user']),'to':_0xc69754[_0xe952('0x35')][_0xe952('0xe7')],'subject':_0xe952('0x106'),'text':util[_0xe952('0xe9')](_0xe952('0x107'),_0xc69754['body'][_0xe952('0xe7')]),'attachments':[{'path':_0xc65d5b}]}})[_0xe952('0x31')](function(){return _0x5679e8;})['catch'](function(_0x5498c5){console[_0xe952('0x23')](_0x5498c5);});}else{return _0x5679e8;}})['then'](respondWithStatusCode(_0x4f9e0c,0xc8))[_0xe952('0x26')](handleError(_0x4f9e0c,null));};exports[_0xe952('0x108')]=function(_0x314726,_0x4b34ee,_0x36d8d7){return db['ChatMessage'][_0xe952('0x66')]({'where':{'id':_0x314726['params']['id']}})[_0xe952('0x31')](handleEntityNotFound(_0x4b34ee,null))[_0xe952('0x31')](function(_0xc38d9b){if(_0xc38d9b){return _0xc38d9b[_0xe952('0x108')](_0x314726[_0xe952('0x35')][_0xe952('0x109')],_['omit'](_0x314726[_0xe952('0x35')],[_0xe952('0x109'),'id'])||{});}})[_0xe952('0x31')](respondWithResult(_0x4b34ee,null))[_0xe952('0x26')](handleError(_0x4b34ee,null));};exports[_0xe952('0x10a')]=function(_0x3a1697,_0x58eee4,_0x3bfc09){var _0x176b1e={'raw':![],'where':{}};var _0x3da12d={};var _0x397d3b={'count':0x0,'rows':[]};return db[_0xe952('0xa1')]['findOne']({'where':{'id':_0x3a1697['params']['id']}})[_0xe952('0x31')](handleEntityNotFound(_0x58eee4,null))[_0xe952('0x31')](function(_0x5681eb){if(_0x5681eb){_0x3da12d[_0xe952('0x44')]=_[_0xe952('0xb9')](db[_0xe952('0xcf')]['rawAttributes']);_0x3da12d[_0xe952('0x45')]=_[_0xe952('0xb9')](_0x3a1697[_0xe952('0x45')]);_0x3da12d[_0xe952('0x4d')]=_[_0xe952('0x47')](_0x3da12d[_0xe952('0x44')],_0x3da12d[_0xe952('0x45')]);_0x176b1e['attributes']=_['intersection'](_0x3da12d['model'],qs[_0xe952('0xa2')](_0x3a1697[_0xe952('0x45')]['fields']));_0x176b1e[_0xe952('0x46')]=_0x176b1e['attributes'][_0xe952('0x48')]?_0x176b1e[_0xe952('0x46')]:_0x3da12d[_0xe952('0x44')];if(!_0x3a1697['query'][_0xe952('0x49')](_0xe952('0x10b'))){_0x176b1e[_0xe952('0x4a')]=qs[_0xe952('0x4a')](_0x3a1697[_0xe952('0x45')][_0xe952('0x4a')]);_0x176b1e['offset']=qs[_0xe952('0x29')](_0x3a1697[_0xe952('0x45')][_0xe952('0x29')]);}_0x176b1e[_0xe952('0x4b')]=qs[_0xe952('0x4c')](_0x3a1697[_0xe952('0x45')][_0xe952('0x4c')]);_0x176b1e['where']=qs[_0xe952('0x4d')](_[_0xe952('0x4e')](_0x3a1697[_0xe952('0x45')],_0x3da12d[_0xe952('0x4d')]));_0x176b1e[_0xe952('0x7d')][_0xe952('0xb5')]=_0x5681eb['id'];if(_0x3a1697[_0xe952('0x45')][_0xe952('0x88')]){_0x176b1e[_0xe952('0x7d')]=_[_0xe952('0x34')](_0x176b1e[_0xe952('0x7d')],{'$or':_['map'](_0x176b1e[_0xe952('0x46')],function(_0x42082c){var _0x4e67ee={};_0x4e67ee[_0x42082c]={'$like':'%'+_0x3a1697['query']['filter']+'%'};return _0x4e67ee;})});}if(_0x3a1697['query'][_0xe952('0x10c')]){var _0x47cd6e=_0x3a1697[_0xe952('0x45')][_0xe952('0x10c')][_0xe952('0x3d')](',');var _0x4753d8={};_0x4753d8[_0x47cd6e[0x0]]={'$gte':moment(_0x47cd6e[0x1])['format'](_0xe952('0x10d'))};_0x176b1e[_0xe952('0x7d')]=_[_0xe952('0x34')](_0x176b1e[_0xe952('0x7d')],_0x4753d8);}_0x176b1e=_[_0xe952('0x34')]({},_0x176b1e,_0x3a1697[_0xe952('0x10e')]);return db['ChatMessage'][_0xe952('0x2b')]({'where':_0x176b1e[_0xe952('0x7d')]})['then'](function(_0x11fdc9){_0x397d3b[_0xe952('0x2b')]=_0x11fdc9;if(_0x3a1697[_0xe952('0x45')][_0xe952('0xba')]){_0x176b1e[_0xe952('0x10f')]=[{'all':!![]}];}return db['ChatMessage'][_0xe952('0x110')](_0x176b1e);})[_0xe952('0x31')](function(_0x8da6bf){_0x397d3b[_0xe952('0xb7')]=_0x8da6bf;return _0x397d3b;});}})[_0xe952('0x31')](respondWithFilteredResult(_0x58eee4,_0x176b1e))[_0xe952('0x26')](handleError(_0x58eee4,null));};exports[_0xe952('0x111')]=function(_0x4baf3d,_0x51b52,_0x462bab){var _0x1ca6bc={'where':{}},_0x1f9582={},_0x5888cf={'count':0x0,'rows':[]};return db[_0xe952('0xa1')][_0xe952('0xc1')]({'where':{'id':_0x4baf3d[_0xe952('0xbc')]['id']}})[_0xe952('0x31')](handleEntityNotFound(_0x51b52,null))[_0xe952('0x31')](function(_0x1894c7){if(_0x1894c7){_0x1f9582['model']=_[_0xe952('0xb9')](db[_0xe952('0xcf')][_0xe952('0x41')]);_0x1f9582[_0xe952('0x45')]=_[_0xe952('0xb9')](_0x4baf3d['query']);_0x1f9582[_0xe952('0x4d')]=_[_0xe952('0x47')](_0x1f9582[_0xe952('0x44')],_0x1f9582[_0xe952('0x45')]);_0x1ca6bc['attributes']=_['intersection'](_0x1f9582[_0xe952('0x44')],qs[_0xe952('0xa2')](_0x4baf3d[_0xe952('0x45')][_0xe952('0xa2')]));_0x1ca6bc[_0xe952('0x46')]=_0x1ca6bc['attributes']['length']?_0x1ca6bc['attributes']:_0x1f9582[_0xe952('0x44')];if(!_0x4baf3d['query'][_0xe952('0x49')](_0xe952('0x10b'))){_0x1ca6bc[_0xe952('0x4a')]=qs['limit'](_0x4baf3d['query'][_0xe952('0x4a')]);_0x1ca6bc[_0xe952('0x29')]=qs[_0xe952('0x29')](_0x4baf3d[_0xe952('0x45')][_0xe952('0x29')]);}_0x1ca6bc['order']=qs[_0xe952('0x4c')](_0x4baf3d[_0xe952('0x45')][_0xe952('0x4c')]);_0x1ca6bc[_0xe952('0x7d')]=qs['filters'](_[_0xe952('0x4e')](_0x4baf3d['query'],_0x1f9582[_0xe952('0x4d')]));_0x1ca6bc[_0xe952('0x7d')][_0xe952('0xb5')]=_0x1894c7['id'];if(_0x4baf3d[_0xe952('0x45')][_0xe952('0x88')]){_0x1ca6bc[_0xe952('0x7d')]=_['merge'](_0x1ca6bc[_0xe952('0x7d')],{'$or':_[_0xe952('0x40')](_0x1ca6bc[_0xe952('0x46')],function(_0x968aa5){var _0x34748b={};_0x34748b[_0x968aa5]={'$like':'%'+_0x4baf3d[_0xe952('0x45')]['filter']+'%'};return _0x34748b;})});}_0x1ca6bc[_0xe952('0x7d')][_0xe952('0xf8')]=![];if(_0x4baf3d[_0xe952('0x45')]['id']){_0x1ca6bc[_0xe952('0x7d')]['id']={'$gt':_0x4baf3d[_0xe952('0x45')]['id']};}_0x1ca6bc=_[_0xe952('0x34')]({},_0x1ca6bc,_0x4baf3d['options']);return db[_0xe952('0xcf')][_0xe952('0x2b')]({'where':_0x1ca6bc['where']})[_0xe952('0x31')](function(_0x625fa2){_0x5888cf[_0xe952('0x2b')]=_0x625fa2;_0x1ca6bc[_0xe952('0x10f')]=[];if(_0x4baf3d[_0xe952('0x45')]['includeAgent']){_0x1ca6bc[_0xe952('0x10f')]['push']({'model':db['User'],'as':_0xe952('0x77'),'attributes':['id',_0xe952('0x3a'),_0xe952('0xf3')]});}if(_0x4baf3d[_0xe952('0x45')][_0xe952('0xba')]){_0x1ca6bc[_0xe952('0x10f')]=[{'all':!![]}];}return db[_0xe952('0xcf')][_0xe952('0x110')](_0x1ca6bc);})['then'](function(_0x4abb56){_0x5888cf['rows']=_0x4abb56;return _0x5888cf;});}})[_0xe952('0x31')](respondWithFilteredResult(_0x51b52,_0x1ca6bc))[_0xe952('0x26')](handleError(_0x51b52,null));};exports[_0xe952('0x112')]=function(_0x26674f,_0x13cd7e,_0x468b18){return db[_0xe952('0xa1')][_0xe952('0x66')]({'where':{'id':_0x26674f[_0xe952('0xbc')]['id']}})['then'](handleEntityNotFound(_0x13cd7e,null))[_0xe952('0x31')](function(_0x18dae8){if(_0x18dae8){return _0x18dae8['setTags'](_0x26674f[_0xe952('0x35')][_0xe952('0x109')],_[_0xe952('0x113')](_0x26674f[_0xe952('0x35')],[_0xe952('0x109'),'id'])||{})['spread'](function(){return db[_0xe952('0x75')][_0xe952('0x110')]({'attributes':['id','name',_0xe952('0x50')],'where':{'id':_0x26674f[_0xe952('0x35')][_0xe952('0x109')]}});})[_0xe952('0x31')](function(_0x4a8866){socket[_0xe952('0x114')](_0xe952('0x115'),{'id':Number(_0x26674f[_0xe952('0xbc')]['id']),'tags':_0x4a8866||[]});return{'id':Number(_0x26674f[_0xe952('0xbc')]['id']),'tags':_0x4a8866||[]};});}})['then'](respondWithResult(_0x13cd7e,null))[_0xe952('0x26')](handleError(_0x13cd7e,null));};exports['removeTags']=function(_0x564e99,_0x29e3fd,_0x4132bf){return db[_0xe952('0xa1')][_0xe952('0x66')]({'where':{'id':_0x564e99[_0xe952('0xbc')]['id']}})[_0xe952('0x31')](handleEntityNotFound(_0x29e3fd,null))[_0xe952('0x31')](function(_0x52474b){if(_0x52474b){return _0x52474b[_0xe952('0x116')](_0x564e99[_0xe952('0x45')][_0xe952('0x109')]);}})['then'](respondWithStatusCode(_0x29e3fd,null))[_0xe952('0x26')](handleError(_0x29e3fd,null));};exports['download']=function(_0x198063,_0x5b183a){var _0x3f5f19=moment()[_0xe952('0x117')]()['toString']();var _0x38a8a8=path[_0xe952('0xe1')](config[_0xe952('0xe2')],_0xe952('0x118'),'files',_0xe952('0x119'));var _0x4bbe60=path['join'](config[_0xe952('0xe2')],_0xe952('0x118'),_0xe952('0x11a'),_0xe952('0x11b'));var _0x41cde3=path[_0xe952('0xe1')](_0x38a8a8,_0x3f5f19);var _0x1f3a6f=util[_0xe952('0xe9')]('transcript-%d-%s.zip',_0x198063['params']['id'],_0x3f5f19);var _0x116a25=path[_0xe952('0xe1')](_0x38a8a8,_0x1f3a6f);var _0x4aa7c5=[];_0x4aa7c5[_0xe952('0x3f')]({'model':db[_0xe952('0x77')],'as':_0xe952('0x77'),'attributes':['id',_0xe952('0x3a')],'raw':!![]});_0x4aa7c5[_0xe952('0x3f')]({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0xe952('0x11c')],'raw':!![]});if(_0x198063[_0xe952('0x45')][_0xe952('0x11b')]){_0x4aa7c5[_0xe952('0x3f')]({'model':db['Attachment'],'as':_0xe952('0xde'),'raw':!![]});}var _0x4b4e41=[{'model':db[_0xe952('0xcf')],'as':_0xe952('0xec'),'attributes':['id',_0xe952('0x35'),'createdAt',_0xe952('0xf7'),_0xe952('0xf8'),_0xe952('0x82')],'include':_0x4aa7c5}];_0x4b4e41[_0xe952('0x3f')]({'model':db['ChatWebsite'],'as':'Account','attributes':['id',_0xe952('0x33')]});_0x4b4e41[_0xe952('0x3f')]({'model':db[_0xe952('0x77')],'as':_0xe952('0x11d'),'attributes':['id',_0xe952('0x3a')]});return db[_0xe952('0xa1')]['find']({'where':{'id':_0x198063['params']['id']},'include':_0x4b4e41})[_0xe952('0x31')](handleEntityNotFound(_0x5b183a,null))['then'](function(_0x5ceb6a){if(_0x5ceb6a){var _0x30200f=_0x5ceb6a[_0xe952('0x11e')]({'plain':!![]});fs[_0xe952('0x11f')](_0x41cde3);var _0x521ef0={'channel':'Chat','account':_0x30200f[_0xe952('0x120')][_0xe952('0x33')],'agent':_0x30200f[_0xe952('0x11d')]?_0x30200f['Owner'][_0xe952('0x3a')]:'N.A.','createdAt':moment(_0x30200f[_0xe952('0x121')])[_0xe952('0xe9')](_0xe952('0x10d'))[_0xe952('0x9f')](),'closedAt':_0x30200f[_0xe952('0xd5')]?moment(_0x30200f[_0xe952('0x122')])[_0xe952('0xe9')](_0xe952('0x10d'))[_0xe952('0x9f')]():'','disposition':_0x30200f[_0xe952('0xd6')],'chatInfo':{'browser':_0x30200f[_0xe952('0x123')],'os':_0x30200f[_0xe952('0x124')],'referer':_0x30200f['referer'],'customerIp':_0x30200f['customerIp'],'customerPort':_0x30200f['customerPort']?_0x30200f[_0xe952('0x125')]:_0xe952('0x126')},'messages':_(_0x30200f[_0xe952('0xec')])['tail']()['filter']({'secret':![]})[_0xe952('0x40')](function(_0xe9071){if(_0xe9071[_0xe952('0xde')]){var _0x5e73b1=path['join'](_0x4bbe60,_0xe9071[_0xe952('0xde')]['basename']);if(fs[_0xe952('0x127')](_0x5e73b1)){fs[_0xe952('0x128')](_0x5e73b1)[_0xe952('0x129')](fs[_0xe952('0x12a')](path[_0xe952('0xe1')](_0x41cde3,_0xe9071[_0xe952('0xde')][_0xe952('0xe5')])));}}return{'date':moment(_0xe9071[_0xe952('0x121')])[_0xe952('0xe9')](_0xe952('0x10d'))[_0xe952('0x9f')](),'sender':_0xe9071[_0xe952('0xf7')]==='out'?_0xe9071[_0xe952('0x77')]?_0xe9071[_0xe952('0x77')][_0xe952('0x3a')]:_0xe952('0xf2'):_0xe9071[_0xe952('0x6b')][_0xe952('0x12b')]+(_0xe9071['Contact']['lastName']?'\x20'+_0xe9071[_0xe952('0x6b')][_0xe952('0x11c')]:''),'body':_0xe9071[_0xe952('0xde')]?_0xe9071[_0xe952('0xde')][_0xe952('0xe5')]:_0xe9071[_0xe952('0x35')],'direction':_0xe9071['direction']==='out'?'A':'C','secret':_0xe9071[_0xe952('0xf8')],'read':_0xe9071[_0xe952('0x82')],'attachment':_0xe9071[_0xe952('0xde')]};})['value']()};return ejs[_0xe952('0x12c')](path['join'](config[_0xe952('0xe2')],_0xe952('0x118'),'views',_0xe952('0x12d')),{'interaction':_0x521ef0})[_0xe952('0x31')](function(_0x25d6a1){var _0x177ce8=path[_0xe952('0xe1')](_0x41cde3,'transcript-'+_0x30200f['id']+'-'+_0x3f5f19+_0xe952('0x12e'));var _0x58fa9f={'path':_0x177ce8,'channel':_0xe952('0x12f'),'interactionId':_0x30200f['id']};return pdf[_0xe952('0x130')](_0x25d6a1,_0x58fa9f);})[_0xe952('0x31')](function(){return new BPromise(function(_0xdb833,_0x9ecbd8){zipdir(_0x41cde3,{'saveTo':_0x116a25},function(_0x308e98,_0xa47f0c){if(_0x308e98)return _0x9ecbd8(_0x308e98);return _0xdb833(_0xa47f0c);});})[_0xe952('0x31')](function(){return new BPromise(function(_0x47e43b,_0x3cec20){rimraf(_0x41cde3,function(_0x46d916){if(_0x46d916)_0x3cec20(_0x46d916);return _0x47e43b();});});})[_0xe952('0x31')](function(){return _0x5b183a['download'](_0x116a25,_0x1f3a6f,function(_0x8feb46){if(_0x8feb46){console[_0xe952('0x131')]('err',_0x8feb46);}else{fs['unlinkSync'](_0x116a25);}});});});}else{return _0x5b183a['sendStatus'](0xc8);}})['catch'](handleError(_0x5b183a,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index af0f4c7..6b610cc 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 _0xef4d=['../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','emit','catch','hook','exports','events'];(function(_0x317027,_0x13bcaa){var _0x33fb7f=function(_0x4563ae){while(--_0x4563ae){_0x317027['push'](_0x317027['shift']());}};_0x33fb7f(++_0x13bcaa);}(_0xef4d,0xaf));var _0xdef4=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xef4d[_0x186376];return _0x2dbdd9;};'use strict';var EventEmitter=require(_0xdef4('0x0'));var ChatInteraction=require(_0xdef4('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0xdef4('0x1'))['db'][_0xdef4('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xdef4('0x3')](0x0);var events={'afterCreate':_0xdef4('0x4'),'afterUpdate':_0xdef4('0x5'),'afterDestroy':_0xdef4('0x6')};function emitEvent(_0x24699f){return function(_0x414791,_0x3e5552,_0x1ce054){_0x414791[_0xdef4('0x7')]({'attributes':['id'],'raw':!![]})[_0xdef4('0x8')](function(_0x2d7427){_0x414791[_0xdef4('0x9')](_0xdef4('0xa'),_0x2d7427['map'](function(_0x237066){return{'id':_0x237066['id']};}));return ChatMessage[_0xdef4('0xb')]({'where':{'ChatInteractionId':_0x414791['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdef4('0x8')](function(_0x5c8dbc){_0x414791[_0xdef4('0x9')]('unreadMessages',_0x5c8dbc['length']);ChatInteractionEvents[_0xdef4('0xc')](_0x24699f+':'+_0x414791['id'],_0x414791);ChatInteractionEvents['emit'](_0x24699f,_0x414791);_0x1ce054(null);})[_0xdef4('0xd')](_0x1ce054(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xdef4('0xe')](e,emitEvent(event));}}module[_0xdef4('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0xc283=['then','Users','findAll','setDataValue','unreadMessages','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xc283,0x189));var _0x3c28=function(_0x29c5a8,_0x214f5a){_0x29c5a8=_0x29c5a8-0x0;var _0x1bad94=_0xc283[_0x29c5a8];return _0x1bad94;};'use strict';var EventEmitter=require(_0x3c28('0x0'));var ChatInteraction=require(_0x3c28('0x1'))['db'][_0x3c28('0x2')];var ChatMessage=require(_0x3c28('0x1'))['db'][_0x3c28('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x3c28('0x4')](0x0);var events={'afterCreate':_0x3c28('0x5'),'afterUpdate':_0x3c28('0x6'),'afterDestroy':'remove'};function emitEvent(_0x5365ba){return function(_0x925a95,_0x57a842,_0x58015a){_0x925a95['getUsers']({'attributes':['id'],'raw':!![]})[_0x3c28('0x7')](function(_0x5577bc){_0x925a95['setDataValue'](_0x3c28('0x8'),_0x5577bc['map'](function(_0xe4e6c2){return{'id':_0xe4e6c2['id']};}));return ChatMessage[_0x3c28('0x9')]({'where':{'ChatInteractionId':_0x925a95['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3c28('0x7')](function(_0x5de861){_0x925a95[_0x3c28('0xa')](_0x3c28('0xb'),_0x5de861['length']);ChatInteractionEvents['emit'](_0x5365ba+':'+_0x925a95['id'],_0x925a95);ChatInteractionEvents['emit'](_0x5365ba,_0x925a95);_0x58015a(null);})[_0x3c28('0xc')](_0x58015a(null));};}for(var e in events){if(events[_0x3c28('0xd')](e)){var event=events[e];ChatInteraction[_0x3c28('0xe')](e,emitEvent(event));}}module[_0x3c28('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index e47017a..d1330bb 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 _0xab59=['moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','define','chat_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0xad69,_0x46780a){var _0x414367=function(_0x52c094){while(--_0x52c094){_0xad69['push'](_0xad69['shift']());}};_0x414367(++_0x46780a);}(_0xab59,0xfd));var _0x9ab5=function(_0x562ec5,_0x36b5a4){_0x562ec5=_0x562ec5-0x0;var _0x279c8c=_0xab59[_0x562ec5];return _0x279c8c;};'use strict';var _=require(_0x9ab5('0x0'));var util=require(_0x9ab5('0x1'));var logger=require(_0x9ab5('0x2'))('api');var moment=require(_0x9ab5('0x3'));var BPromise=require('bluebird');var rp=require(_0x9ab5('0x4'));var fs=require('fs');var path=require(_0x9ab5('0x5'));var rimraf=require(_0x9ab5('0x6'));var config=require(_0x9ab5('0x7'));var attributes=require(_0x9ab5('0x8'));module['exports']=function(_0x3accca,_0x3d5f81){return _0x3accca[_0x9ab5('0x9')]('ChatInteraction',attributes,{'tableName':_0x9ab5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3053f8,_0x163131,_0x9e7cb5){if(_0x3053f8['changed'](_0x9ab5('0xb'))){_0x3053f8[_0x9ab5('0xc')]=moment()['format'](_0x9ab5('0xd'));}_0x9e7cb5(null,_0x3053f8);}},'charset':_0x9ab5('0xe'),'collate':_0x9ab5('0xf')});}; \ No newline at end of file +var _0xed0b=['closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','../../config/environment','exports','define','ChatInteraction','chat_interactions','changed','closed'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed0b,0xb4));var _0xbed0=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0xed0b[_0x4d8a8f];return _0xfc4adc;};'use strict';var _=require(_0xbed0('0x0'));var util=require(_0xbed0('0x1'));var logger=require(_0xbed0('0x2'))(_0xbed0('0x3'));var moment=require(_0xbed0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbed0('0x5'));var attributes=require('./chatInteraction.attributes');module[_0xbed0('0x6')]=function(_0x4de271,_0x53b132){return _0x4de271[_0xbed0('0x7')](_0xbed0('0x8'),attributes,{'tableName':_0xbed0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e28a2,_0x5bdb6d,_0x1441e8){if(_0x2e28a2[_0xbed0('0xa')](_0xbed0('0xb'))){_0x2e28a2[_0xbed0('0xc')]=moment()['format'](_0xbed0('0xd'));}_0x1441e8(null,_0x2e28a2);}},'charset':_0xbed0('0xe'),'collate':_0xbed0('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index be7931e..46f7aad 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 _0xe994=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','AddTagsToChatInteraction','find','ids','omit','spread','AddTags','util','bluebird'];(function(_0xc3411c,_0x229663){var _0x54e424=function(_0x187705){while(--_0x187705){_0xc3411c['push'](_0xc3411c['shift']());}};_0x54e424(++_0x229663);}(_0xe994,0xcb));var _0x4e99=function(_0x45c48f,_0x4aa891){_0x45c48f=_0x45c48f-0x0;var _0xaf5037=_0xe994[_0x45c48f];return _0xaf5037;};'use strict';var _=require('lodash');var util=require(_0x4e99('0x0'));var moment=require('moment');var BPromise=require(_0x4e99('0x1'));var rs=require(_0x4e99('0x2'));var fs=require('fs');var Redis=require(_0x4e99('0x3'));var db=require(_0x4e99('0x4'))['db'];var utils=require(_0x4e99('0x5'));var logger=require('../../config/logger')(_0x4e99('0x6'));var config=require(_0x4e99('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4e99('0x8')][_0x4e99('0x9')]({'port':0x232a});config[_0x4e99('0xa')]=_['defaults'](config[_0x4e99('0xa')],{'host':_0x4e99('0xb'),'port':0x18eb});var socket=require(_0x4e99('0xc'))(new Redis(config[_0x4e99('0xa')]));require(_0x4e99('0xd'))[_0x4e99('0xe')](socket);function respondWithRpcPromise(_0x22c5a1,_0x443f05,_0x4367e2){return new BPromise(function(_0x3fa1c5,_0x306bcf){return client[_0x4e99('0xf')](_0x22c5a1,_0x4367e2)[_0x4e99('0x10')](function(_0x52515c){logger[_0x4e99('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x443f05,_0x4e99('0x12'));logger[_0x4e99('0x13')](_0x4e99('0x14'),_0x443f05,'request\x20sent',JSON[_0x4e99('0x15')](_0x52515c));if(_0x52515c[_0x4e99('0x16')]){if(_0x52515c['error'][_0x4e99('0x17')]===0x1f4){logger[_0x4e99('0x16')](_0x4e99('0x18'),_0x443f05,_0x52515c[_0x4e99('0x16')]['message']);return _0x306bcf(_0x52515c[_0x4e99('0x16')][_0x4e99('0x19')]);}logger[_0x4e99('0x16')](_0x4e99('0x18'),_0x443f05,_0x52515c['error'][_0x4e99('0x19')]);return _0x3fa1c5(_0x52515c[_0x4e99('0x16')][_0x4e99('0x19')]);}else{logger[_0x4e99('0x11')](_0x4e99('0x18'),_0x443f05,_0x4e99('0x12'));_0x3fa1c5(_0x52515c[_0x4e99('0x1a')][_0x4e99('0x19')]);}})[_0x4e99('0x1b')](function(_0x4d0148){logger[_0x4e99('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x443f05,_0x4d0148);_0x306bcf(_0x4d0148);});});}exports[_0x4e99('0x1c')]=function(_0x25586c){var _0x55c14e=this;return new Promise(function(_0x22d40c,_0x1b467c){return db[_0x4e99('0x1d')][_0x4e99('0x1e')](_0x25586c[_0x4e99('0x1f')],{'raw':_0x25586c['options']?_0x25586c[_0x4e99('0x20')][_0x4e99('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25586c[_0x4e99('0x20')]?_0x25586c[_0x4e99('0x20')][_0x4e99('0x22')]||null:null,'attributes':_0x25586c[_0x4e99('0x20')]?_0x25586c['options']['attributes']||null:null,'limit':_0x25586c[_0x4e99('0x20')]?_0x25586c['options']['limit']||null:null})['then'](function(_0x15a66c){logger[_0x4e99('0x11')](_0x4e99('0x1c'),_0x25586c);logger['debug']('UpdateChatInteraction',_0x25586c,JSON['stringify'](_0x15a66c));_0x22d40c(_0x15a66c);})[_0x4e99('0x1b')](function(_0x3174d6){logger[_0x4e99('0x16')](_0x4e99('0x1c'),_0x3174d6[_0x4e99('0x19')],_0x25586c);_0x1b467c(_0x55c14e[_0x4e99('0x16')](0x1f4,_0x3174d6['message']));});});};exports[_0x4e99('0x23')]=function(_0x1de619){return new Promise(function(_0x5cbbb0,_0x3c3da9){return db[_0x4e99('0x1d')][_0x4e99('0x24')]({'where':_0x1de619[_0x4e99('0x20')]?_0x1de619[_0x4e99('0x20')][_0x4e99('0x22')]||null:null})['then'](function(_0x2302b7){if(_0x2302b7){return _0x2302b7['addTags'](_0x1de619[_0x4e99('0x1f')][_0x4e99('0x25')],_[_0x4e99('0x26')](_0x1de619[_0x4e99('0x1f')],[_0x4e99('0x25'),'id'])||{});}})[_0x4e99('0x27')](function(_0x7a8d5){logger[_0x4e99('0x11')](_0x4e99('0x28'),_0x1de619);logger['debug'](_0x4e99('0x28'),_0x1de619,JSON[_0x4e99('0x15')](_0x7a8d5));_0x5cbbb0(_0x7a8d5);})[_0x4e99('0x1b')](function(_0x1ded9b){logger[_0x4e99('0x16')](_0x4e99('0x28'),_0x1ded9b[_0x4e99('0x19')],_0x1de619);_0x3c3da9(_this[_0x4e99('0x16')](0x1f4,_0x1ded9b[_0x4e99('0x19')]));});});}; \ No newline at end of file +var _0x7c71=['../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','register','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','code','message','error','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','attributes','limit','where','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis'];(function(_0x4d17bc,_0xb04503){var _0x5b6350=function(_0x5b2627){while(--_0x5b2627){_0x4d17bc['push'](_0x4d17bc['shift']());}};_0x5b6350(++_0xb04503);}(_0x7c71,0x19d));var _0x17c7=function(_0xdbe2de,_0x3bdc5a){_0xdbe2de=_0xdbe2de-0x0;var _0x2facd7=_0x7c71[_0xdbe2de];return _0x2facd7;};'use strict';var _=require('lodash');var util=require(_0x17c7('0x0'));var moment=require(_0x17c7('0x1'));var BPromise=require(_0x17c7('0x2'));var rs=require(_0x17c7('0x3'));var fs=require('fs');var Redis=require(_0x17c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x17c7('0x5'));var logger=require(_0x17c7('0x6'))(_0x17c7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x17c7('0x8')]({'port':0x232a});config[_0x17c7('0x9')]=_[_0x17c7('0xa')](config[_0x17c7('0x9')],{'host':_0x17c7('0xb'),'port':0x18eb});var socket=require(_0x17c7('0xc'))(new Redis(config[_0x17c7('0x9')]));require('./chatInteraction.socket')[_0x17c7('0xd')](socket);function respondWithRpcPromise(_0x3c0475,_0x242938,_0x4a52bf){return new BPromise(function(_0x532c91,_0x5ff49d){return client['request'](_0x3c0475,_0x4a52bf)[_0x17c7('0xe')](function(_0x4c7711){logger[_0x17c7('0xf')](_0x17c7('0x10'),_0x242938,'request\x20sent');logger[_0x17c7('0x11')](_0x17c7('0x12'),_0x242938,_0x17c7('0x13'),JSON['stringify'](_0x4c7711));if(_0x4c7711['error']){if(_0x4c7711['error'][_0x17c7('0x14')]===0x1f4){logger['error'](_0x17c7('0x10'),_0x242938,_0x4c7711['error'][_0x17c7('0x15')]);return _0x5ff49d(_0x4c7711['error'][_0x17c7('0x15')]);}logger[_0x17c7('0x16')](_0x17c7('0x10'),_0x242938,_0x4c7711['error'][_0x17c7('0x15')]);return _0x532c91(_0x4c7711[_0x17c7('0x16')][_0x17c7('0x15')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x242938,_0x17c7('0x13'));_0x532c91(_0x4c7711[_0x17c7('0x17')]['message']);}})[_0x17c7('0x18')](function(_0x3ff43d){logger[_0x17c7('0x16')](_0x17c7('0x10'),_0x242938,_0x3ff43d);_0x5ff49d(_0x3ff43d);});});}exports[_0x17c7('0x19')]=function(_0x69b32f){var _0x3bfbf4=this;return new Promise(function(_0x4e9d5f,_0x2b3c39){return db[_0x17c7('0x1a')][_0x17c7('0x1b')](_0x69b32f[_0x17c7('0x1c')],{'raw':_0x69b32f['options']?_0x69b32f[_0x17c7('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x69b32f[_0x17c7('0x1d')]?_0x69b32f[_0x17c7('0x1d')]['where']||null:null,'attributes':_0x69b32f[_0x17c7('0x1d')]?_0x69b32f['options'][_0x17c7('0x1e')]||null:null,'limit':_0x69b32f[_0x17c7('0x1d')]?_0x69b32f[_0x17c7('0x1d')][_0x17c7('0x1f')]||null:null})[_0x17c7('0xe')](function(_0x59e181){logger[_0x17c7('0xf')](_0x17c7('0x19'),_0x69b32f);logger[_0x17c7('0x11')](_0x17c7('0x19'),_0x69b32f,JSON['stringify'](_0x59e181));_0x4e9d5f(_0x59e181);})[_0x17c7('0x18')](function(_0x5964f9){logger[_0x17c7('0x16')](_0x17c7('0x19'),_0x5964f9[_0x17c7('0x15')],_0x69b32f);_0x2b3c39(_0x3bfbf4[_0x17c7('0x16')](0x1f4,_0x5964f9[_0x17c7('0x15')]));});});};exports['AddTagsToChatInteraction']=function(_0x390ea6){return new Promise(function(_0x49a2b9,_0x24c946){return db[_0x17c7('0x1a')]['find']({'where':_0x390ea6[_0x17c7('0x1d')]?_0x390ea6[_0x17c7('0x1d')][_0x17c7('0x20')]||null:null})[_0x17c7('0xe')](function(_0x37a857){if(_0x37a857){return _0x37a857[_0x17c7('0x21')](_0x390ea6[_0x17c7('0x1c')][_0x17c7('0x22')],_[_0x17c7('0x23')](_0x390ea6['body'],[_0x17c7('0x22'),'id'])||{});}})[_0x17c7('0x24')](function(_0x5c7e97){logger['info'](_0x17c7('0x25'),_0x390ea6);logger['debug'](_0x17c7('0x25'),_0x390ea6,JSON['stringify'](_0x5c7e97));_0x49a2b9(_0x5c7e97);})['catch'](function(_0x388adc){logger['error']('AddTags',_0x388adc[_0x17c7('0x15')],_0x390ea6);_0x24c946(_this[_0x17c7('0x16')](0x1f4,_0x388adc['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index bc221c7..d87d8af 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 _0xdcab=['register','length','chatInteraction:','./chatInteraction.events','remove','removeListener'];(function(_0x29a8d5,_0x288544){var _0x57842c=function(_0x244148){while(--_0x244148){_0x29a8d5['push'](_0x29a8d5['shift']());}};_0x57842c(++_0x288544);}(_0xdcab,0x1e3));var _0xbdca=function(_0x5582d9,_0x458905){_0x5582d9=_0x5582d9-0x0;var _0x371e11=_0xdcab[_0x5582d9];return _0x371e11;};'use strict';var ChatInteractionEvents=require(_0xbdca('0x0'));var events=['save',_0xbdca('0x1'),'update'];function createListener(_0x5b0ed5,_0x362b2d){return function(_0x31fdf9){_0x362b2d['emit'](_0x5b0ed5,_0x31fdf9);};}function removeListener(_0x52b59f,_0x47508b){return function(){ChatInteractionEvents[_0xbdca('0x2')](_0x52b59f,_0x47508b);};}exports[_0xbdca('0x3')]=function(_0x145cd7){for(var _0x215a65=0x0,_0x1a1c03=events[_0xbdca('0x4')];_0x215a65<_0x1a1c03;_0x215a65++){var _0x29fca4=events[_0x215a65];var _0x21a6aa=createListener(_0xbdca('0x5')+_0x29fca4,_0x145cd7);ChatInteractionEvents['on'](_0x29fca4,_0x21a6aa);}}; \ No newline at end of file +var _0xbfbe=['register','length','chatInteraction:','./chatInteraction.events','save','emit','removeListener'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xbfbe,0x1ae));var _0xebfb=function(_0x2b9847,_0x5b5294){_0x2b9847=_0x2b9847-0x0;var _0x4e393f=_0xbfbe[_0x2b9847];return _0x4e393f;};'use strict';var ChatInteractionEvents=require(_0xebfb('0x0'));var events=[_0xebfb('0x1'),'remove','update'];function createListener(_0x3296e1,_0x5107bf){return function(_0x25963e){_0x5107bf[_0xebfb('0x2')](_0x3296e1,_0x25963e);};}function removeListener(_0x5ba29b,_0x408d8f){return function(){ChatInteractionEvents[_0xebfb('0x3')](_0x5ba29b,_0x408d8f);};}exports[_0xebfb('0x4')]=function(_0x1c20d7){for(var _0x2f0d44=0x0,_0x14ad39=events[_0xebfb('0x5')];_0x2f0d44<_0x14ad39;_0x2f0d44++){var _0x648519=events[_0x2f0d44];var _0x5bab06=createListener(_0xebfb('0x6')+_0x648519,_0x1c20d7);ChatInteractionEvents['on'](_0x648519,_0x5bab06);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index a47f0cf..5f91ae9 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 _0x2156=['express','Router','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','index','/describe','isAuthenticated','describe','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','getMessages','getMyMessages','download','post','create','diskStorage','join','format','%s-%s','now','replace','/:id/attachment_upload','single','file','/:id/messages','/:id/tags','tracked','chat','addTags','put','/:id','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','delete','destroy','removeTags','multer','path','connect-timeout'];(function(_0xd865a8,_0xa9922d){var _0x31e77b=function(_0x622a86){while(--_0x622a86){_0xd865a8['push'](_0xd865a8['shift']());}};_0x31e77b(++_0xa9922d);}(_0x2156,0x117));var _0x6215=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x2156[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0x6215('0x0'));var util=require('util');var path=require(_0x6215('0x1'));var timeout=require(_0x6215('0x2'));var express=require(_0x6215('0x3'));var router=express[_0x6215('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6215('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6215('0x6'));var controller=require(_0x6215('0x7'));router[_0x6215('0x8')]('/',auth['isAuthenticated'](),controller[_0x6215('0x9')]);router[_0x6215('0x8')](_0x6215('0xa'),auth[_0x6215('0xb')](),controller[_0x6215('0xc')]);router[_0x6215('0x8')]('/:id',auth['isChatInteractionAuthorized'](),controller[_0x6215('0xd')]);router['get'](_0x6215('0xe'),auth[_0x6215('0xf')](),controller[_0x6215('0x10')]);router[_0x6215('0x8')]('/:id/messages',auth[_0x6215('0xb')](),controller[_0x6215('0x11')]);router['get']('/:id/my_messages',auth[_0x6215('0xf')](),controller[_0x6215('0x12')]);router[_0x6215('0x8')]('/:id/download',auth[_0x6215('0xb')](),controller[_0x6215('0x13')]);router[_0x6215('0x14')]('/',auth[_0x6215('0xb')](),controller[_0x6215('0x15')]);router[_0x6215('0x14')]('/:id/vidaoo',auth[_0x6215('0xb')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x6215('0x16')]({'destination':function(_0x413764,_0x2fa420,_0x4deb57){_0x4deb57(null,path[_0x6215('0x17')](config['root'],'server/files/attachments/'));},'filename':function(_0x2b6bb4,_0x299d9e,_0x19bda5){_0x19bda5(null,util[_0x6215('0x18')](_0x6215('0x19'),Date[_0x6215('0x1a')](),_0x299d9e['originalname'][_0x6215('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x6215('0x14')](_0x6215('0x1c'),upload[_0x6215('0x1d')](_0x6215('0x1e')),controller['attachmentUpload']);router[_0x6215('0x14')](_0x6215('0x1f'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0x6215('0x14')](_0x6215('0x20'),auth[_0x6215('0xb')](),interaction[_0x6215('0x21')](_0x6215('0x22'),'chatinteraction:addtags'),controller[_0x6215('0x23')]);router[_0x6215('0x24')](_0x6215('0x25'),auth[_0x6215('0xb')](),interaction[_0x6215('0x21')](_0x6215('0x22'),_0x6215('0x26')),controller['update']);router['put'](_0x6215('0x27'),controller[_0x6215('0x28')]);router[_0x6215('0x24')](_0x6215('0x29'),auth[_0x6215('0xf')](),controller['abandon']);router[_0x6215('0x24')](_0x6215('0x2a'),controller[_0x6215('0x2b')]);router[_0x6215('0x2c')](_0x6215('0x25'),auth['isAuthenticated'](),interaction['tracked']('chat','chatinteraction:destroy'),controller[_0x6215('0x2d')]);router[_0x6215('0x2c')](_0x6215('0x20'),auth['isAuthenticated'](),controller[_0x6215('0x2e')]);module['exports']=router; \ No newline at end of file +var _0x5cb0=['isAuthenticated','describe','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','originalname','replace','post','single','file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','/:id','chatinteraction:update','abandon','/:id/close','close','chatinteraction:destroy','delete','/:id/tags','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x13867f,_0x29d839){var _0x56b8b2=function(_0x17b46b){while(--_0x17b46b){_0x13867f['push'](_0x13867f['shift']());}};_0x56b8b2(++_0x29d839);}(_0x5cb0,0xbc));var _0x05cb=function(_0x175d2d,_0x254160){_0x175d2d=_0x175d2d-0x0;var _0x30dc2a=_0x5cb0[_0x175d2d];return _0x30dc2a;};'use strict';var multer=require(_0x05cb('0x0'));var util=require(_0x05cb('0x1'));var path=require('path');var timeout=require(_0x05cb('0x2'));var express=require('express');var router=express[_0x05cb('0x3')]();var fs_extra=require(_0x05cb('0x4'));var auth=require(_0x05cb('0x5'));var interaction=require(_0x05cb('0x6'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0x05cb('0x7')]('/',auth[_0x05cb('0x8')](),controller['index']);router['get']('/describe',auth[_0x05cb('0x8')](),controller[_0x05cb('0x9')]);router['get']('/:id',auth['isChatInteractionAuthorized'](),controller[_0x05cb('0xa')]);router[_0x05cb('0x7')](_0x05cb('0xb'),auth[_0x05cb('0xc')](),controller[_0x05cb('0xd')]);router[_0x05cb('0x7')]('/:id/messages',auth[_0x05cb('0x8')](),controller[_0x05cb('0xe')]);router[_0x05cb('0x7')](_0x05cb('0xf'),auth['isChatInteractionAuthorized'](),controller[_0x05cb('0x10')]);router[_0x05cb('0x7')](_0x05cb('0x11'),auth[_0x05cb('0x8')](),controller[_0x05cb('0x12')]);router['post']('/',auth[_0x05cb('0x8')](),controller[_0x05cb('0x13')]);router['post'](_0x05cb('0x14'),auth[_0x05cb('0x8')](),controller[_0x05cb('0x15')]);var upload=multer({'storage':multer[_0x05cb('0x16')]({'destination':function(_0x2d2c17,_0x4aeb0a,_0x59df9){_0x59df9(null,path[_0x05cb('0x17')](config[_0x05cb('0x18')],_0x05cb('0x19')));},'filename':function(_0x1d440d,_0x3e4cb8,_0x5ad0c9){_0x5ad0c9(null,util[_0x05cb('0x1a')](_0x05cb('0x1b'),Date['now'](),_0x3e4cb8[_0x05cb('0x1c')][_0x05cb('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x05cb('0x1e')]('/:id/attachment_upload',upload[_0x05cb('0x1f')](_0x05cb('0x20')),controller[_0x05cb('0x21')]);router[_0x05cb('0x1e')]('/:id/messages',auth[_0x05cb('0xc')](),controller[_0x05cb('0x22')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x05cb('0x23')](_0x05cb('0x24'),_0x05cb('0x25')),controller[_0x05cb('0x26')]);router[_0x05cb('0x27')](_0x05cb('0x28'),auth[_0x05cb('0x8')](),interaction[_0x05cb('0x23')](_0x05cb('0x24'),_0x05cb('0x29')),controller['update']);router[_0x05cb('0x27')]('/:id/custom_update',controller['customUpdate']);router['put']('/:id/abandon',auth[_0x05cb('0xc')](),controller[_0x05cb('0x2a')]);router['put'](_0x05cb('0x2b'),controller[_0x05cb('0x2c')]);router['delete'](_0x05cb('0x28'),auth[_0x05cb('0x8')](),interaction[_0x05cb('0x23')](_0x05cb('0x24'),_0x05cb('0x2d')),controller['destroy']);router[_0x05cb('0x2e')](_0x05cb('0x2f'),auth[_0x05cb('0x8')](),controller['removeTags']);module[_0x05cb('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 2e61587..f6db62a 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 _0x1a85=['BOOLEAN','TEXT','medium'];(function(_0x1034bb,_0x4e20b3){var _0x453fdb=function(_0x455356){while(--_0x455356){_0x1034bb['push'](_0x1034bb['shift']());}};_0x453fdb(++_0x4e20b3);}(_0x1a85,0x178));var _0x51a8=function(_0x29a753,_0x5ce67d){_0x29a753=_0x29a753-0x0;var _0x5d78c7=_0x1a85[_0x29a753];return _0x5d78c7;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x51a8('0x0')](_0x51a8('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x51a8('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x57ca=['exports','TEXT','BOOLEAN','INTEGER'];(function(_0x3089cf,_0x4a1fd1){var _0x39dbec=function(_0x5ed01f){while(--_0x5ed01f){_0x3089cf['push'](_0x3089cf['shift']());}};_0x39dbec(++_0x4a1fd1);}(_0x57ca,0x108));var _0xa57c=function(_0x55f22c,_0x186d97){_0x55f22c=_0x55f22c-0x0;var _0x261087=_0x57ca[_0x55f22c];return _0x261087;};'use strict';var Sequelize=require('sequelize');module[_0xa57c('0x0')]={'body':{'type':Sequelize[_0xa57c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa57c('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa57c('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 3d4dd20..32f6690 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 _0x78ab=['fullname','role','internal','online','lastLoginAt','allowmessenger','sort','-online','VoiceQueue','VoiceQueues','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatInternalMessage.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','keys','attributes','fields','query','hasOwnProperty','nolimit','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','intersection','length','create','body','find','params','describe','get','messages','lastMessageAt','createdAt','lastMessage','getUsers','agent','admin','user'];(function(_0x5e9876,_0x16052d){var _0x576c48=function(_0x338c97){while(--_0x338c97){_0x5e9876['push'](_0x5e9876['shift']());}};_0x576c48(++_0x16052d);}(_0x78ab,0x81));var _0xb78a=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x78ab[_0x2c7618];return _0x5ce3f0;};'use strict';var emlformat=require(_0xb78a('0x0'));var rimraf=require(_0xb78a('0x1'));var zipdir=require(_0xb78a('0x2'));var jsonpatch=require(_0xb78a('0x3'));var rp=require(_0xb78a('0x4'));var moment=require(_0xb78a('0x5'));var BPromise=require(_0xb78a('0x6'));var Mustache=require(_0xb78a('0x7'));var util=require('util');var path=require('path');var sox=require(_0xb78a('0x8'));var csv=require(_0xb78a('0x9'));var ejs=require(_0xb78a('0xa'));var fs=require('fs');var fs_extra=require(_0xb78a('0xb'));var _=require(_0xb78a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb78a('0xd'));var deskjs=require(_0xb78a('0xe'));var toCsv=require(_0xb78a('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb78a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb78a('0x10'));var as=require(_0xb78a('0x11'));var hardwareService=require(_0xb78a('0x12'));var logger=require(_0xb78a('0x13'))('api');var utils=require(_0xb78a('0x14'));var config=require(_0xb78a('0x15'));var licenseUtil=require(_0xb78a('0x16'));var db=require(_0xb78a('0x17'))['db'];config['redis']=_[_0xb78a('0x18')](config[_0xb78a('0x19')],{'host':_0xb78a('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb78a('0x1b'))[_0xb78a('0x1c')](socket);function respondWithStatusCode(_0x5194fb,_0x52295f){_0x52295f=_0x52295f||0xcc;return function(_0x2d9c55){if(_0x2d9c55){return _0x5194fb['sendStatus'](_0x52295f);}return _0x5194fb[_0xb78a('0x1d')](_0x52295f)[_0xb78a('0x1e')]();};}function respondWithResult(_0xe9ff81,_0x4baa9b){_0x4baa9b=_0x4baa9b||0xc8;return function(_0x2ab853){if(_0x2ab853){return _0xe9ff81[_0xb78a('0x1d')](_0x4baa9b)[_0xb78a('0x1f')](_0x2ab853);}};}function respondWithFilteredResult(_0x1e0dc4,_0x327f41){return function(_0x2fc7d8){if(_0x2fc7d8){var _0x1e0181=typeof _0x327f41['offset']===_0xb78a('0x20')&&typeof _0x327f41[_0xb78a('0x21')]===_0xb78a('0x20');var _0x593045=_0x2fc7d8[_0xb78a('0x22')];var _0x2d05bf=_0x1e0181?0x0:_0x327f41[_0xb78a('0x23')];var _0x2e0005=_0x1e0181?_0x2fc7d8[_0xb78a('0x22')]:_0x327f41['offset']+_0x327f41[_0xb78a('0x21')];var _0x579b94;if(_0x2e0005>=_0x593045){_0x2e0005=_0x593045;_0x579b94=0xc8;}else{_0x579b94=0xce;}_0x1e0dc4[_0xb78a('0x1d')](_0x579b94);return _0x1e0dc4[_0xb78a('0x24')](_0xb78a('0x25'),_0x2d05bf+'-'+_0x2e0005+'/'+_0x593045)[_0xb78a('0x1f')](_0x2fc7d8);}return null;};}function patchUpdates(_0x5a7f07){return function(_0x5d7b8b){try{jsonpatch[_0xb78a('0x26')](_0x5d7b8b,_0x5a7f07,!![]);}catch(_0x112ded){return BPromise[_0xb78a('0x27')](_0x112ded);}return _0x5d7b8b['save']();};}function saveUpdates(_0x4ac259,_0x1fb15c){return function(_0x23aa46){if(_0x23aa46){return _0x23aa46[_0xb78a('0x28')](_0x4ac259)[_0xb78a('0x29')](function(_0x15778c){return _0x15778c;});}return null;};}function removeEntity(_0x9dc517,_0x53ad54){return function(_0x39586e){if(_0x39586e){return _0x39586e[_0xb78a('0x2a')]()[_0xb78a('0x29')](function(){_0x9dc517['status'](0xcc)[_0xb78a('0x1e')]();});}};}function handleEntityNotFound(_0x2d7766,_0x5b57ec){return function(_0x5f238c){if(!_0x5f238c){_0x2d7766[_0xb78a('0x2b')](0x194);}return _0x5f238c;};}function handleError(_0xf2f350,_0x4133ae){_0x4133ae=_0x4133ae||0x1f4;return function(_0x16c1bc){logger['error'](_0x16c1bc[_0xb78a('0x2c')]);if(_0x16c1bc[_0xb78a('0x2d')]){delete _0x16c1bc[_0xb78a('0x2d')];}_0xf2f350[_0xb78a('0x1d')](_0x4133ae)[_0xb78a('0x2e')](_0x16c1bc);};}exports[_0xb78a('0x2f')]=function(_0x33e47e,_0x263c5f){var _0x7b08f8={},_0x545638={},_0x469d87={'count':0x0,'rows':[]};var _0x4b72a8=_[_0xb78a('0x30')](db[_0xb78a('0x31')][_0xb78a('0x32')],function(_0x496c5d){return{'name':_0x496c5d[_0xb78a('0x33')],'type':_0x496c5d[_0xb78a('0x34')][_0xb78a('0x35')]};});_0x545638[_0xb78a('0x36')]=_[_0xb78a('0x30')](_0x4b72a8,_0xb78a('0x2d'));_0x545638['query']=_[_0xb78a('0x37')](_0x33e47e['query']);_0x545638['filters']=_['intersection'](_0x545638['model'],_0x545638['query']);_0x7b08f8[_0xb78a('0x38')]=_['intersection'](_0x545638[_0xb78a('0x36')],qs[_0xb78a('0x39')](_0x33e47e['query'][_0xb78a('0x39')]));_0x7b08f8[_0xb78a('0x38')]=_0x7b08f8['attributes']['length']?_0x7b08f8['attributes']:_0x545638[_0xb78a('0x36')];if(!_0x33e47e[_0xb78a('0x3a')][_0xb78a('0x3b')](_0xb78a('0x3c'))){_0x7b08f8[_0xb78a('0x21')]=qs[_0xb78a('0x21')](_0x33e47e[_0xb78a('0x3a')]['limit']);_0x7b08f8[_0xb78a('0x23')]=qs[_0xb78a('0x23')](_0x33e47e[_0xb78a('0x3a')]['offset']);}_0x7b08f8['order']=qs['sort'](_0x33e47e[_0xb78a('0x3a')]['sort']);_0x7b08f8['where']=qs[_0xb78a('0x3d')](_[_0xb78a('0x3e')](_0x33e47e[_0xb78a('0x3a')],_0x545638[_0xb78a('0x3d')]),_0x4b72a8);if(_0x33e47e[_0xb78a('0x3a')][_0xb78a('0x3f')]){_0x7b08f8[_0xb78a('0x40')]=_[_0xb78a('0x41')](_0x7b08f8[_0xb78a('0x40')],{'$or':_['map'](_0x4b72a8,function(_0x56523a){if(_0x56523a['type']!=='VIRTUAL'){var _0x3257a9={};_0x3257a9[_0x56523a[_0xb78a('0x2d')]]={'$like':'%'+_0x33e47e[_0xb78a('0x3a')][_0xb78a('0x3f')]+'%'};return _0x3257a9;}})});}_0x7b08f8=_['merge']({},_0x7b08f8,_0x33e47e[_0xb78a('0x42')]);var _0x46e248={'where':_0x7b08f8[_0xb78a('0x40')]};return db[_0xb78a('0x31')]['count'](_0x46e248)[_0xb78a('0x29')](function(_0x5ab709){_0x469d87[_0xb78a('0x22')]=_0x5ab709;if(_0x33e47e[_0xb78a('0x3a')][_0xb78a('0x43')]){_0x7b08f8[_0xb78a('0x44')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xb78a('0x45')](_0x7b08f8);})[_0xb78a('0x29')](function(_0x5bfd28){_0x469d87[_0xb78a('0x46')]=_0x5bfd28;return _0x469d87;})[_0xb78a('0x29')](respondWithFilteredResult(_0x263c5f,_0x7b08f8))[_0xb78a('0x47')](handleError(_0x263c5f,null));};exports[_0xb78a('0x48')]=function(_0x5eefae,_0x45b71d){var _0x414367={'raw':!![],'where':{'id':_0x5eefae['params']['id']}},_0x276567={};_0x276567[_0xb78a('0x36')]=_['keys'](db[_0xb78a('0x31')][_0xb78a('0x32')]);_0x276567[_0xb78a('0x3a')]=_[_0xb78a('0x37')](_0x5eefae[_0xb78a('0x3a')]);_0x276567[_0xb78a('0x3d')]=_[_0xb78a('0x49')](_0x276567['model'],_0x276567['query']);_0x414367['attributes']=_[_0xb78a('0x49')](_0x276567['model'],qs[_0xb78a('0x39')](_0x5eefae[_0xb78a('0x3a')][_0xb78a('0x39')]));_0x414367[_0xb78a('0x38')]=_0x414367[_0xb78a('0x38')][_0xb78a('0x4a')]?_0x414367['attributes']:_0x276567[_0xb78a('0x36')];if(_0x5eefae[_0xb78a('0x3a')]['includeAll']){_0x414367['include']=[{'all':!![]}];}_0x414367=_[_0xb78a('0x41')]({},_0x414367,_0x5eefae[_0xb78a('0x42')]);return db[_0xb78a('0x31')]['find'](_0x414367)['then'](handleEntityNotFound(_0x45b71d,null))[_0xb78a('0x29')](respondWithResult(_0x45b71d,null))[_0xb78a('0x47')](handleError(_0x45b71d,null));};exports[_0xb78a('0x4b')]=function(_0x4d3543,_0x535b63){return db['ChatInternalMessage'][_0xb78a('0x4b')](_0x4d3543[_0xb78a('0x4c')],{})[_0xb78a('0x29')](respondWithResult(_0x535b63,0xc9))['catch'](handleError(_0x535b63,null));};exports['update']=function(_0x3f6a08,_0x5ce18f){if(_0x3f6a08[_0xb78a('0x4c')]['id']){delete _0x3f6a08[_0xb78a('0x4c')]['id'];}return db[_0xb78a('0x31')][_0xb78a('0x4d')]({'where':{'id':_0x3f6a08['params']['id']}})[_0xb78a('0x29')](handleEntityNotFound(_0x5ce18f,null))[_0xb78a('0x29')](saveUpdates(_0x3f6a08[_0xb78a('0x4c')],null))['then'](respondWithResult(_0x5ce18f,null))[_0xb78a('0x47')](handleError(_0x5ce18f,null));};exports[_0xb78a('0x2a')]=function(_0x24b8b9,_0x568976){return db[_0xb78a('0x31')]['find']({'where':{'id':_0x24b8b9[_0xb78a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x568976,null))[_0xb78a('0x29')](removeEntity(_0x568976,null))[_0xb78a('0x47')](handleError(_0x568976,null));};exports['describe']=function(_0x293c60,_0x8a316f){return db[_0xb78a('0x31')][_0xb78a('0x4f')]()['then'](respondWithResult(_0x8a316f,null))[_0xb78a('0x47')](handleError(_0x8a316f,null));};function wrapUser(_0x6cdfe3){return function(_0x2d889f){var _0x1c1d5b=_0x6cdfe3[_0xb78a('0x50')]({'plain':!![]});_0x1c1d5b[_0xb78a('0x51')]=[];if(_0x2d889f){_0x1c1d5b[_0xb78a('0x52')]=_0x2d889f[_0xb78a('0x53')];_0x1c1d5b[_0xb78a('0x54')]=_0x2d889f;}else{_0x1c1d5b[_0xb78a('0x52')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1c1d5b[_0xb78a('0x54')]={};}return _0x1c1d5b;};}exports[_0xb78a('0x55')]=function(_0x148e13,_0x3fc5ae,_0x49bb1b){var _0x4f89a9=[];return db['User'][_0xb78a('0x45')]({'where':{'role':[_0xb78a('0x56'),_0xb78a('0x57'),_0xb78a('0x58')]},'attributes':['id',_0xb78a('0x59'),'name',_0xb78a('0x5a'),'userpic',_0xb78a('0x5b'),_0xb78a('0x5c'),_0xb78a('0x5d'),_0xb78a('0x5e'),'showWebBar'],'order':qs[_0xb78a('0x5f')](_0xb78a('0x60')),'include':[{'model':db[_0xb78a('0x61')],'as':_0xb78a('0x62'),'attributes':['id',_0xb78a('0x2d'),_0xb78a('0x34')],'through':{'attributes':[]}}]})['then'](function(_0x1fa2d9){if(_0x1fa2d9){var _0x22d6af=_0x148e13[_0xb78a('0x58')][_0xb78a('0x50')]({'plain':!![]});if(!_0x22d6af)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22d6af[_0xb78a('0x5a')]===_0xb78a('0x58')){return db['UserProfileSection'][_0xb78a('0x4d')]({'where':{'name':_0xb78a('0x63'),'userProfileId':_0x22d6af[_0xb78a('0x64')]},'raw':!![]})[_0xb78a('0x29')](function(_0x250b08){if(_0x250b08){if(_0x250b08[_0xb78a('0x65')]===0x0){return db[_0xb78a('0x66')][_0xb78a('0x45')]({'where':{'sectionId':_0x250b08['id']},'raw':!![]})[_0xb78a('0x29')](function(_0x1ae5f2){var _0x8ad18b=[];if(_[_0xb78a('0x67')](_0x1ae5f2)){_0x8ad18b=_[_0xb78a('0x3f')](_0x1fa2d9,function(_0x13e42d){if(_0x13e42d['role']!==_0xb78a('0x56')){return _0x13e42d;}});return _0x8ad18b;}else{for(var _0x1b6d73=0x0;_0x1b6d73<_0x1fa2d9['length'];_0x1b6d73++){var _0x5da4e0=_0x1fa2d9[_0x1b6d73];if(_0x5da4e0[_0xb78a('0x5a')]==='agent'){var _0x30e545=_['find'](_0x1ae5f2,function(_0x4f086d){return _0x4f086d[_0xb78a('0x68')]===_0x5da4e0['id'];});if(_0x30e545)_0x8ad18b[_0xb78a('0x69')](_0x5da4e0);}else{_0x8ad18b[_0xb78a('0x69')](_0x5da4e0);}}return _0x8ad18b;}});}else{return _0x1fa2d9;}}else{var _0x24beeb=_[_0xb78a('0x3f')](_0x1fa2d9,function(_0xa8b6){if(_0xa8b6[_0xb78a('0x5a')]!==_0xb78a('0x56')){return _0xa8b6;}});return _0x24beeb;}});}else{return _0x1fa2d9;}}})[_0xb78a('0x29')](function(_0x510a83){var _0x1bcc37=[];if(_0x510a83){_0x4f89a9=_0x510a83;for(var _0x2ed8d2=0x0;_0x2ed8d2<_0x510a83[_0xb78a('0x4a')];_0x2ed8d2+=0x1){_0x4f89a9[_0x2ed8d2][_0xb78a('0x51')]=[];_0x1bcc37[_0xb78a('0x69')](db[_0xb78a('0x31')]['find']({'where':{'FromId':[_0x148e13['user']['id'],_0x510a83[_0x2ed8d2]['id']],'ToId':[_0x148e13[_0xb78a('0x58')]['id'],_0x510a83[_0x2ed8d2]['id']],'ChatGroupId':null},'attributes':['id',_0xb78a('0x53'),_0xb78a('0x6a'),'ToId',_0xb78a('0x6b'),_0xb78a('0x4c')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xb78a('0x29')](wrapUser(_0x510a83[_0x2ed8d2])));}return BPromise[_0xb78a('0x6c')](_0x1bcc37);}return[];})['then'](function(_0x58e6b7){return{'rows':_0x58e6b7,'count':_0x58e6b7[_0xb78a('0x4a')]};})[_0xb78a('0x29')](respondWithResult(_0x3fc5ae,null))[_0xb78a('0x47')](handleError(_0x3fc5ae,null));}; \ No newline at end of file +var _0x5111=['VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','push','FromId','ToId','read','all','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatInternalMessage.socket','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','ChatInternalMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','include','options','find','create','body','describe','get','messages','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','VoiceQueue'];(function(_0x499e40,_0x15b99e){var _0x1b747a=function(_0x193e40){while(--_0x193e40){_0x499e40['push'](_0x499e40['shift']());}};_0x1b747a(++_0x15b99e);}(_0x5111,0x1c9));var _0x1511=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5111[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1511('0x0'));var zipdir=require(_0x1511('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1511('0x2'));var moment=require(_0x1511('0x3'));var BPromise=require(_0x1511('0x4'));var Mustache=require(_0x1511('0x5'));var util=require(_0x1511('0x6'));var path=require(_0x1511('0x7'));var sox=require(_0x1511('0x8'));var csv=require('to-csv');var ejs=require(_0x1511('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1511('0xa'));var squel=require(_0x1511('0xb'));var crypto=require('crypto');var jsforce=require(_0x1511('0xc'));var deskjs=require(_0x1511('0xd'));var toCsv=require(_0x1511('0xe'));var querystring=require(_0x1511('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1511('0x10'));var qs=require(_0x1511('0x11'));var as=require(_0x1511('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1511('0x13'))('api');var utils=require(_0x1511('0x14'));var config=require(_0x1511('0x15'));var licenseUtil=require(_0x1511('0x16'));var db=require(_0x1511('0x17'))['db'];config['redis']=_[_0x1511('0x18')](config[_0x1511('0x19')],{'host':_0x1511('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1511('0x19')]));require(_0x1511('0x1b'))['register'](socket);function respondWithStatusCode(_0x3d8d44,_0x28862f){_0x28862f=_0x28862f||0xcc;return function(_0x4bac73){if(_0x4bac73){return _0x3d8d44[_0x1511('0x1c')](_0x28862f);}return _0x3d8d44[_0x1511('0x1d')](_0x28862f)['end']();};}function respondWithResult(_0x3d7f06,_0xf81817){_0xf81817=_0xf81817||0xc8;return function(_0x1586b7){if(_0x1586b7){return _0x3d7f06[_0x1511('0x1d')](_0xf81817)['json'](_0x1586b7);}};}function respondWithFilteredResult(_0x56f80c,_0x5d787d){return function(_0x10b9ca){if(_0x10b9ca){var _0x454b7f=typeof _0x5d787d[_0x1511('0x1e')]===_0x1511('0x1f')&&typeof _0x5d787d[_0x1511('0x20')]===_0x1511('0x1f');var _0x593f95=_0x10b9ca[_0x1511('0x21')];var _0x208546=_0x454b7f?0x0:_0x5d787d[_0x1511('0x1e')];var _0x2849b0=_0x454b7f?_0x10b9ca[_0x1511('0x21')]:_0x5d787d[_0x1511('0x1e')]+_0x5d787d['limit'];var _0x30dc1e;if(_0x2849b0>=_0x593f95){_0x2849b0=_0x593f95;_0x30dc1e=0xc8;}else{_0x30dc1e=0xce;}_0x56f80c[_0x1511('0x1d')](_0x30dc1e);return _0x56f80c[_0x1511('0x22')]('Content-Range',_0x208546+'-'+_0x2849b0+'/'+_0x593f95)[_0x1511('0x23')](_0x10b9ca);}return null;};}function patchUpdates(_0x5d2bca){return function(_0x1b3c1f){try{jsonpatch[_0x1511('0x24')](_0x1b3c1f,_0x5d2bca,!![]);}catch(_0x3d8316){return BPromise[_0x1511('0x25')](_0x3d8316);}return _0x1b3c1f[_0x1511('0x26')]();};}function saveUpdates(_0x411cbc,_0x549f72){return function(_0x16c36a){if(_0x16c36a){return _0x16c36a[_0x1511('0x27')](_0x411cbc)[_0x1511('0x28')](function(_0x13a4c0){return _0x13a4c0;});}return null;};}function removeEntity(_0x548634,_0x2512c8){return function(_0x3ef478){if(_0x3ef478){return _0x3ef478[_0x1511('0x29')]()['then'](function(){_0x548634[_0x1511('0x1d')](0xcc)[_0x1511('0x2a')]();});}};}function handleEntityNotFound(_0xd8de1f,_0x2a2142){return function(_0x519802){if(!_0x519802){_0xd8de1f['sendStatus'](0x194);}return _0x519802;};}function handleError(_0x3dae66,_0x13e396){_0x13e396=_0x13e396||0x1f4;return function(_0x277708){logger[_0x1511('0x2b')](_0x277708[_0x1511('0x2c')]);if(_0x277708['name']){delete _0x277708[_0x1511('0x2d')];}_0x3dae66['status'](_0x13e396)[_0x1511('0x2e')](_0x277708);};}exports['index']=function(_0x377d77,_0x1732b4){var _0x50b4a7={},_0x5cea25={},_0x30d139={'count':0x0,'rows':[]};var _0x5be64c=_['map'](db[_0x1511('0x2f')][_0x1511('0x30')],function(_0x203737){return{'name':_0x203737[_0x1511('0x31')],'type':_0x203737[_0x1511('0x32')][_0x1511('0x33')]};});_0x5cea25[_0x1511('0x34')]=_[_0x1511('0x35')](_0x5be64c,_0x1511('0x2d'));_0x5cea25[_0x1511('0x36')]=_[_0x1511('0x37')](_0x377d77[_0x1511('0x36')]);_0x5cea25[_0x1511('0x38')]=_[_0x1511('0x39')](_0x5cea25[_0x1511('0x34')],_0x5cea25['query']);_0x50b4a7[_0x1511('0x3a')]=_[_0x1511('0x39')](_0x5cea25[_0x1511('0x34')],qs[_0x1511('0x3b')](_0x377d77[_0x1511('0x36')]['fields']));_0x50b4a7[_0x1511('0x3a')]=_0x50b4a7[_0x1511('0x3a')][_0x1511('0x3c')]?_0x50b4a7[_0x1511('0x3a')]:_0x5cea25['model'];if(!_0x377d77[_0x1511('0x36')][_0x1511('0x3d')]('nolimit')){_0x50b4a7[_0x1511('0x20')]=qs[_0x1511('0x20')](_0x377d77[_0x1511('0x36')]['limit']);_0x50b4a7[_0x1511('0x1e')]=qs[_0x1511('0x1e')](_0x377d77[_0x1511('0x36')]['offset']);}_0x50b4a7[_0x1511('0x3e')]=qs[_0x1511('0x3f')](_0x377d77[_0x1511('0x36')][_0x1511('0x3f')]);_0x50b4a7[_0x1511('0x40')]=qs[_0x1511('0x38')](_[_0x1511('0x41')](_0x377d77['query'],_0x5cea25[_0x1511('0x38')]),_0x5be64c);if(_0x377d77[_0x1511('0x36')][_0x1511('0x42')]){_0x50b4a7[_0x1511('0x40')]=_[_0x1511('0x43')](_0x50b4a7['where'],{'$or':_[_0x1511('0x35')](_0x5be64c,function(_0x2820c6){if(_0x2820c6[_0x1511('0x32')]!==_0x1511('0x44')){var _0x4e49bc={};_0x4e49bc[_0x2820c6[_0x1511('0x2d')]]={'$like':'%'+_0x377d77[_0x1511('0x36')][_0x1511('0x42')]+'%'};return _0x4e49bc;}})});}_0x50b4a7=_[_0x1511('0x43')]({},_0x50b4a7,_0x377d77['options']);var _0x2fbec3={'where':_0x50b4a7[_0x1511('0x40')]};return db['ChatInternalMessage'][_0x1511('0x21')](_0x2fbec3)[_0x1511('0x28')](function(_0x3c4b0b){_0x30d139[_0x1511('0x21')]=_0x3c4b0b;if(_0x377d77[_0x1511('0x36')][_0x1511('0x45')]){_0x50b4a7['include']=[{'all':!![]}];}return db[_0x1511('0x2f')][_0x1511('0x46')](_0x50b4a7);})[_0x1511('0x28')](function(_0x5db879){_0x30d139['rows']=_0x5db879;return _0x30d139;})[_0x1511('0x28')](respondWithFilteredResult(_0x1732b4,_0x50b4a7))[_0x1511('0x47')](handleError(_0x1732b4,null));};exports[_0x1511('0x48')]=function(_0x59cfdf,_0x4a201a){var _0x30317a={'raw':!![],'where':{'id':_0x59cfdf[_0x1511('0x49')]['id']}},_0x1c978b={};_0x1c978b['model']=_[_0x1511('0x37')](db[_0x1511('0x2f')][_0x1511('0x30')]);_0x1c978b['query']=_['keys'](_0x59cfdf[_0x1511('0x36')]);_0x1c978b[_0x1511('0x38')]=_['intersection'](_0x1c978b[_0x1511('0x34')],_0x1c978b[_0x1511('0x36')]);_0x30317a['attributes']=_['intersection'](_0x1c978b[_0x1511('0x34')],qs[_0x1511('0x3b')](_0x59cfdf[_0x1511('0x36')][_0x1511('0x3b')]));_0x30317a['attributes']=_0x30317a[_0x1511('0x3a')][_0x1511('0x3c')]?_0x30317a[_0x1511('0x3a')]:_0x1c978b[_0x1511('0x34')];if(_0x59cfdf['query'][_0x1511('0x45')]){_0x30317a[_0x1511('0x4a')]=[{'all':!![]}];}_0x30317a=_[_0x1511('0x43')]({},_0x30317a,_0x59cfdf[_0x1511('0x4b')]);return db['ChatInternalMessage'][_0x1511('0x4c')](_0x30317a)[_0x1511('0x28')](handleEntityNotFound(_0x4a201a,null))['then'](respondWithResult(_0x4a201a,null))[_0x1511('0x47')](handleError(_0x4a201a,null));};exports[_0x1511('0x4d')]=function(_0x1eeb28,_0xbd841e){return db[_0x1511('0x2f')]['create'](_0x1eeb28['body'],{})[_0x1511('0x28')](respondWithResult(_0xbd841e,0xc9))[_0x1511('0x47')](handleError(_0xbd841e,null));};exports[_0x1511('0x27')]=function(_0x520ed9,_0x38227b){if(_0x520ed9['body']['id']){delete _0x520ed9[_0x1511('0x4e')]['id'];}return db[_0x1511('0x2f')]['find']({'where':{'id':_0x520ed9['params']['id']}})[_0x1511('0x28')](handleEntityNotFound(_0x38227b,null))[_0x1511('0x28')](saveUpdates(_0x520ed9[_0x1511('0x4e')],null))[_0x1511('0x28')](respondWithResult(_0x38227b,null))[_0x1511('0x47')](handleError(_0x38227b,null));};exports['destroy']=function(_0x383012,_0x35533a){return db[_0x1511('0x2f')][_0x1511('0x4c')]({'where':{'id':_0x383012[_0x1511('0x49')]['id']}})['then'](handleEntityNotFound(_0x35533a,null))['then'](removeEntity(_0x35533a,null))[_0x1511('0x47')](handleError(_0x35533a,null));};exports[_0x1511('0x4f')]=function(_0x530a89,_0x4cb30d){return db['ChatInternalMessage']['describe']()[_0x1511('0x28')](respondWithResult(_0x4cb30d,null))[_0x1511('0x47')](handleError(_0x4cb30d,null));};function wrapUser(_0xc8042b){return function(_0x5692f9){var _0x2396f6=_0xc8042b[_0x1511('0x50')]({'plain':!![]});_0x2396f6[_0x1511('0x51')]=[];if(_0x5692f9){_0x2396f6['lastMessageAt']=_0x5692f9[_0x1511('0x52')];_0x2396f6[_0x1511('0x53')]=_0x5692f9;}else{_0x2396f6['lastMessageAt']=moment(0x0)[_0x1511('0x54')](_0x1511('0x55'));_0x2396f6[_0x1511('0x53')]={};}return _0x2396f6;};}exports[_0x1511('0x56')]=function(_0x374c62,_0x5eddca,_0x1ed841){var _0x2ffa8f=[];return db[_0x1511('0x57')]['findAll']({'where':{'role':[_0x1511('0x58'),_0x1511('0x59'),'user']},'attributes':['id',_0x1511('0x5a'),_0x1511('0x2d'),_0x1511('0x5b'),_0x1511('0x5c'),_0x1511('0x5d'),_0x1511('0x5e'),_0x1511('0x5f'),_0x1511('0x60'),'showWebBar'],'order':qs[_0x1511('0x3f')]('-online'),'include':[{'model':db[_0x1511('0x61')],'as':_0x1511('0x62'),'attributes':['id',_0x1511('0x2d'),_0x1511('0x32')],'through':{'attributes':[]}}]})[_0x1511('0x28')](function(_0x3be2ab){if(_0x3be2ab){var _0x12dd67=_0x374c62[_0x1511('0x63')][_0x1511('0x50')]({'plain':!![]});if(!_0x12dd67)throw new Error(_0x1511('0x64'));if(_0x12dd67[_0x1511('0x5b')]===_0x1511('0x63')){return db[_0x1511('0x65')]['find']({'where':{'name':_0x1511('0x66'),'userProfileId':_0x12dd67['userProfileId']},'raw':!![]})['then'](function(_0x2d90c1){if(_0x2d90c1){if(_0x2d90c1[_0x1511('0x67')]===0x0){return db[_0x1511('0x68')][_0x1511('0x46')]({'where':{'sectionId':_0x2d90c1['id']},'raw':!![]})['then'](function(_0x48ed7a){var _0x296c04=[];if(_[_0x1511('0x69')](_0x48ed7a)){_0x296c04=_['filter'](_0x3be2ab,function(_0x3ded4a){if(_0x3ded4a[_0x1511('0x5b')]!=='agent'){return _0x3ded4a;}});return _0x296c04;}else{for(var _0x22179a=0x0;_0x22179a<_0x3be2ab[_0x1511('0x3c')];_0x22179a++){var _0x49c045=_0x3be2ab[_0x22179a];if(_0x49c045[_0x1511('0x5b')]===_0x1511('0x58')){var _0x3d25dc=_['find'](_0x48ed7a,function(_0x4a4448){return _0x4a4448['resourceId']===_0x49c045['id'];});if(_0x3d25dc)_0x296c04['push'](_0x49c045);}else{_0x296c04[_0x1511('0x6a')](_0x49c045);}}return _0x296c04;}});}else{return _0x3be2ab;}}else{var _0x783a38=_[_0x1511('0x42')](_0x3be2ab,function(_0x306147){if(_0x306147[_0x1511('0x5b')]!==_0x1511('0x58')){return _0x306147;}});return _0x783a38;}});}else{return _0x3be2ab;}}})[_0x1511('0x28')](function(_0x54f98f){var _0x5be1f7=[];if(_0x54f98f){_0x2ffa8f=_0x54f98f;for(var _0x113374=0x0;_0x113374<_0x54f98f[_0x1511('0x3c')];_0x113374+=0x1){_0x2ffa8f[_0x113374][_0x1511('0x51')]=[];_0x5be1f7[_0x1511('0x6a')](db[_0x1511('0x2f')][_0x1511('0x4c')]({'where':{'FromId':[_0x374c62[_0x1511('0x63')]['id'],_0x54f98f[_0x113374]['id']],'ToId':[_0x374c62['user']['id'],_0x54f98f[_0x113374]['id']],'ChatGroupId':null},'attributes':['id',_0x1511('0x52'),_0x1511('0x6b'),_0x1511('0x6c'),_0x1511('0x6d'),'body'],'order':qs[_0x1511('0x3f')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x1511('0x28')](wrapUser(_0x54f98f[_0x113374])));}return BPromise[_0x1511('0x6e')](_0x5be1f7);}return[];})[_0x1511('0x28')](function(_0x13b93f){return{'rows':_0x13b93f,'count':_0x13b93f[_0x1511('0x3c')]};})[_0x1511('0x28')](respondWithResult(_0x5eddca,null))[_0x1511('0x47')](handleError(_0x5eddca,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 7447c0e..c452c76 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 _0x1353=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x34c982,_0x130535){var _0x52ab44=function(_0x980c3){while(--_0x980c3){_0x34c982['push'](_0x34c982['shift']());}};_0x52ab44(++_0x130535);}(_0x1353,0xb3));var _0x3135=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x1353[_0x263a74];return _0x2aa86c;};'use strict';var EventEmitter=require(_0x3135('0x0'));var ChatInternalMessage=require(_0x3135('0x1'))['db'][_0x3135('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3135('0x3')](0x0);var events={'afterCreate':_0x3135('0x4'),'afterUpdate':_0x3135('0x5'),'afterDestroy':'remove'};function emitEvent(_0x30ffd0){return function(_0x3abfa0,_0x3f2e77,_0x357c78){ChatInternalMessageEvents[_0x3135('0x6')](_0x30ffd0+':'+_0x3abfa0['id'],_0x3abfa0);ChatInternalMessageEvents['emit'](_0x30ffd0,_0x3abfa0);_0x357c78(null);};}for(var e in events){if(events[_0x3135('0x7')](e)){var event=events[e];ChatInternalMessage[_0x3135('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xb51e=['emit','hook','events','../../mysqldb','save','update','remove'];(function(_0xf69022,_0x20fd31){var _0x2c91b9=function(_0x44ad0e){while(--_0x44ad0e){_0xf69022['push'](_0xf69022['shift']());}};_0x2c91b9(++_0x20fd31);}(_0xb51e,0x12f));var _0xeb51=function(_0x51119d,_0x5ac5b2){_0x51119d=_0x51119d-0x0;var _0x25779e=_0xb51e[_0x51119d];return _0x25779e;};'use strict';var EventEmitter=require(_0xeb51('0x0'));var ChatInternalMessage=require(_0xeb51('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeb51('0x2'),'afterUpdate':_0xeb51('0x3'),'afterDestroy':_0xeb51('0x4')};function emitEvent(_0x3a5503){return function(_0x29c8be,_0x299960,_0x10ce2a){ChatInternalMessageEvents[_0xeb51('0x5')](_0x3a5503+':'+_0x29c8be['id'],_0x29c8be);ChatInternalMessageEvents[_0xeb51('0x5')](_0x3a5503,_0x29c8be);_0x10ce2a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xeb51('0x6')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 2088faf..2a04c63 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 _0xf4eb=['./chatInternalMessage.attributes','exports','define','chat_internal_messages','lodash','bluebird','rimraf','../../config/environment'];(function(_0x1012ab,_0xfb2018){var _0x4ebbe3=function(_0x32cb49){while(--_0x32cb49){_0x1012ab['push'](_0x1012ab['shift']());}};_0x4ebbe3(++_0xfb2018);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2e2a82,_0x29f380){_0x2e2a82=_0x2e2a82-0x0;var _0x52d342=_0xf4eb[_0x2e2a82];return _0x52d342;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var attributes=require(_0xbf4e('0x4'));module[_0xbf4e('0x5')]=function(_0xa4dcf5,_0x2fcfed){return _0xa4dcf5[_0xbf4e('0x6')]('ChatInternalMessage',attributes,{'tableName':_0xbf4e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xaa88=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage'];(function(_0x44d72e,_0x132777){var _0x3ddc1a=function(_0x234170){while(--_0x234170){_0x44d72e['push'](_0x44d72e['shift']());}};_0x3ddc1a(++_0x132777);}(_0xaa88,0x137));var _0x8aa8=function(_0x5a6de2,_0x5c8b10){_0x5a6de2=_0x5a6de2-0x0;var _0x2c0525=_0xaa88[_0x5a6de2];return _0x2c0525;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8aa8('0xc'),'collate':_0x8aa8('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 8f1a161..c43fb12 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 _0x6a82=['error','code','message','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','localhost','register','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x6a82,0xac));var _0x26a8=function(_0x611d14,_0x271d67){_0x611d14=_0x611d14-0x0;var _0x4f9d86=_0x6a82[_0x611d14];return _0x4f9d86;};'use strict';var _=require(_0x26a8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x26a8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x26a8('0x2'));var db=require(_0x26a8('0x3'))['db'];var utils=require(_0x26a8('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x26a8('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x26a8('0x6')][_0x26a8('0x7')]({'port':0x232a});config[_0x26a8('0x8')]=_['defaults'](config['redis'],{'host':_0x26a8('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x26a8('0x8')]));require('./chatInternalMessage.socket')[_0x26a8('0xa')](socket);function respondWithRpcPromise(_0x462c51,_0x1f020f,_0x179fd2){return new BPromise(function(_0x1deeca,_0x4b6f32){return client['request'](_0x462c51,_0x179fd2)['then'](function(_0x430450){logger[_0x26a8('0xb')](_0x26a8('0xc'),_0x1f020f,'request\x20sent');logger[_0x26a8('0xd')](_0x26a8('0xe'),_0x1f020f,_0x26a8('0xf'),JSON[_0x26a8('0x10')](_0x430450));if(_0x430450[_0x26a8('0x11')]){if(_0x430450[_0x26a8('0x11')][_0x26a8('0x12')]===0x1f4){logger[_0x26a8('0x11')](_0x26a8('0xc'),_0x1f020f,_0x430450[_0x26a8('0x11')][_0x26a8('0x13')]);return _0x4b6f32(_0x430450['error'][_0x26a8('0x13')]);}logger['error'](_0x26a8('0xc'),_0x1f020f,_0x430450[_0x26a8('0x11')]['message']);return _0x1deeca(_0x430450['error'][_0x26a8('0x13')]);}else{logger[_0x26a8('0xb')](_0x26a8('0xc'),_0x1f020f,_0x26a8('0xf'));_0x1deeca(_0x430450['result']['message']);}})[_0x26a8('0x14')](function(_0x15079c){logger[_0x26a8('0x11')](_0x26a8('0xc'),_0x1f020f,_0x15079c);_0x4b6f32(_0x15079c);});});} \ No newline at end of file +var _0x6890=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x5ba956,_0x15358d){var _0x5a397b=function(_0x41a9f1){while(--_0x41a9f1){_0x5ba956['push'](_0x5ba956['shift']());}};_0x5a397b(++_0x15358d);}(_0x6890,0xe3));var _0x0689=function(_0x3f7dd8,_0x5be711){_0x3f7dd8=_0x3f7dd8-0x0;var _0xf1745c=_0x6890[_0x3f7dd8];return _0xf1745c;};'use strict';var _=require(_0x0689('0x0'));var util=require(_0x0689('0x1'));var moment=require(_0x0689('0x2'));var BPromise=require(_0x0689('0x3'));var rs=require(_0x0689('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0689('0x5'));var logger=require(_0x0689('0x6'))(_0x0689('0x7'));var config=require(_0x0689('0x8'));var jayson=require(_0x0689('0x9'));var client=jayson[_0x0689('0xa')]['http']({'port':0x232a});config[_0x0689('0xb')]=_[_0x0689('0xc')](config[_0x0689('0xb')],{'host':_0x0689('0xd'),'port':0x18eb});var socket=require(_0x0689('0xe'))(new Redis(config[_0x0689('0xb')]));require(_0x0689('0xf'))[_0x0689('0x10')](socket);function respondWithRpcPromise(_0x28789e,_0x5903e4,_0x5803f4){return new BPromise(function(_0x29f15a,_0x217718){return client[_0x0689('0x11')](_0x28789e,_0x5803f4)[_0x0689('0x12')](function(_0x43bd4a){logger[_0x0689('0x13')](_0x0689('0x14'),_0x5903e4,_0x0689('0x15'));logger[_0x0689('0x16')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x5903e4,'request\x20sent',JSON['stringify'](_0x43bd4a));if(_0x43bd4a[_0x0689('0x17')]){if(_0x43bd4a[_0x0689('0x17')][_0x0689('0x18')]===0x1f4){logger[_0x0689('0x17')](_0x0689('0x14'),_0x5903e4,_0x43bd4a[_0x0689('0x17')]['message']);return _0x217718(_0x43bd4a['error'][_0x0689('0x19')]);}logger[_0x0689('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x5903e4,_0x43bd4a[_0x0689('0x17')]['message']);return _0x29f15a(_0x43bd4a[_0x0689('0x17')][_0x0689('0x19')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x5903e4,_0x0689('0x15'));_0x29f15a(_0x43bd4a[_0x0689('0x1a')][_0x0689('0x19')]);}})[_0x0689('0x1b')](function(_0x47f5d7){logger[_0x0689('0x17')](_0x0689('0x14'),_0x5903e4,_0x47f5d7);_0x217718(_0x47f5d7);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index b6a33dd..3f72677 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 _0xefbf=['chatInternalMessage:','./chatInternalMessage.events','save','emit','removeListener','length'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xefbf,0xa3));var _0xfefb=function(_0x2d74cc,_0x196573){_0x2d74cc=_0x2d74cc-0x0;var _0x46fbe2=_0xefbf[_0x2d74cc];return _0x46fbe2;};'use strict';var ChatInternalMessageEvents=require(_0xfefb('0x0'));var events=[_0xfefb('0x1'),'remove','update'];function createListener(_0x5f199d,_0x24d740){return function(_0x4589ac){_0x24d740[_0xfefb('0x2')](_0x5f199d,_0x4589ac);};}function removeListener(_0x36eb23,_0x79ca1d){return function(){ChatInternalMessageEvents[_0xfefb('0x3')](_0x36eb23,_0x79ca1d);};}exports['register']=function(_0xaac208){for(var _0x58c767=0x0,_0x7851d4=events[_0xfefb('0x4')];_0x58c767<_0x7851d4;_0x58c767++){var _0x5706f5=events[_0x58c767];var _0x18ffe2=createListener(_0xfefb('0x5')+_0x5706f5,_0xaac208);ChatInternalMessageEvents['on'](_0x5706f5,_0x18ffe2);}}; \ No newline at end of file +var _0x24cd=['update','emit','removeListener','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x3ac31c,_0x189d40){var _0x536ae6=function(_0x581c4e){while(--_0x581c4e){_0x3ac31c['push'](_0x3ac31c['shift']());}};_0x536ae6(++_0x189d40);}(_0x24cd,0x83));var _0xd24c=function(_0x2ecaa7,_0x3aaffe){_0x2ecaa7=_0x2ecaa7-0x0;var _0x32c0a8=_0x24cd[_0x2ecaa7];return _0x32c0a8;};'use strict';var ChatInternalMessageEvents=require(_0xd24c('0x0'));var events=[_0xd24c('0x1'),'remove',_0xd24c('0x2')];function createListener(_0x4fcd89,_0x282e8f){return function(_0x30398b){_0x282e8f[_0xd24c('0x3')](_0x4fcd89,_0x30398b);};}function removeListener(_0x4d515c,_0x21a58c){return function(){ChatInternalMessageEvents[_0xd24c('0x4')](_0x4d515c,_0x21a58c);};}exports['register']=function(_0x1c30fc){for(var _0x2721be=0x0,_0x2a432a=events[_0xd24c('0x5')];_0x2721be<_0x2a432a;_0x2721be++){var _0x3d4d20=events[_0x2721be];var _0x411706=createListener(_0xd24c('0x6')+_0x3d4d20,_0x1c30fc);ChatInternalMessageEvents['on'](_0x3d4d20,_0x411706);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index c450490..ddc7636 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 _0x6990=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','show','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express'];(function(_0x342e87,_0x3f5e51){var _0x14d04b=function(_0xae250d){while(--_0xae250d){_0x342e87['push'](_0x342e87['shift']());}};_0x14d04b(++_0x3f5e51);}(_0x6990,0x199));var _0x0699=function(_0x2687b7,_0x663dae){_0x2687b7=_0x2687b7-0x0;var _0x5b9c17=_0x6990[_0x2687b7];return _0x5b9c17;};'use strict';var multer=require(_0x0699('0x0'));var util=require(_0x0699('0x1'));var path=require(_0x0699('0x2'));var timeout=require(_0x0699('0x3'));var express=require(_0x0699('0x4'));var router=express['Router']();var fs_extra=require(_0x0699('0x5'));var auth=require(_0x0699('0x6'));var interaction=require(_0x0699('0x7'));var config=require(_0x0699('0x8'));var controller=require(_0x0699('0x9'));router[_0x0699('0xa')]('/',auth[_0x0699('0xb')](),controller[_0x0699('0xc')]);router[_0x0699('0xa')](_0x0699('0xd'),auth[_0x0699('0xb')](),controller[_0x0699('0xe')]);router[_0x0699('0xa')](_0x0699('0xf'),auth['isAuthenticated'](),controller[_0x0699('0x10')]);router[_0x0699('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0699('0x11')]);router['post']('/',auth[_0x0699('0xb')](),controller['create']);router[_0x0699('0x12')]('/:id',controller[_0x0699('0x13')]);router[_0x0699('0x14')](_0x0699('0x15'),auth[_0x0699('0xb')](),controller[_0x0699('0x16')]);module['exports']=router; \ No newline at end of file +var _0x48f5=['put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','describe','isAuthenticated','getUsers','/:id','show','post'];(function(_0x4465ce,_0x2d1bd4){var _0x446769=function(_0x2daae6){while(--_0x2daae6){_0x4465ce['push'](_0x4465ce['shift']());}};_0x446769(++_0x2d1bd4);}(_0x48f5,0x68));var _0x548f=function(_0x499be6,_0x484f8d){_0x499be6=_0x499be6-0x0;var _0x3e20ee=_0x48f5[_0x499be6];return _0x3e20ee;};'use strict';var multer=require(_0x548f('0x0'));var util=require(_0x548f('0x1'));var path=require(_0x548f('0x2'));var timeout=require(_0x548f('0x3'));var express=require(_0x548f('0x4'));var router=express['Router']();var fs_extra=require(_0x548f('0x5'));var auth=require(_0x548f('0x6'));var interaction=require(_0x548f('0x7'));var config=require('../../config/environment');var controller=require(_0x548f('0x8'));router[_0x548f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x548f('0xa')]);router['get']('/users',auth[_0x548f('0xb')](),controller[_0x548f('0xc')]);router[_0x548f('0x9')](_0x548f('0xd'),auth[_0x548f('0xb')](),controller[_0x548f('0xe')]);router[_0x548f('0xf')]('/',auth[_0x548f('0xb')](),controller['create']);router[_0x548f('0x10')](_0x548f('0xd'),controller[_0x548f('0x11')]);router[_0x548f('0x12')]('/:id',auth[_0x548f('0xb')](),controller[_0x548f('0x13')]);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 93e30df..5f4ad4b 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 _0xd31f=['sequelize','TEXT','medium','ENUM','out','DATE','STRING'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xd31f,0xee));var _0xfd31=function(_0x4fa35c,_0x5e91a5){_0x4fa35c=_0x4fa35c-0x0;var _0x328840=_0xd31f[_0x4fa35c];return _0x328840;};'use strict';var Sequelize=require(_0xfd31('0x0'));module['exports']={'body':{'type':Sequelize[_0xfd31('0x1')](_0xfd31('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xfd31('0x3')]('in','out'),'defaultValue':_0xfd31('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xfd31('0x5')]},'providerName':{'type':Sequelize[_0xfd31('0x6')]},'providerResponse':{'type':Sequelize[_0xfd31('0x1')]}}; \ No newline at end of file +var _0xd450=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x21b3bd,_0x833127){var _0x3460fb=function(_0x3c9dac){while(--_0x3c9dac){_0x21b3bd['push'](_0x21b3bd['shift']());}};_0x3460fb(++_0x833127);}(_0xd450,0x119));var _0x0d45=function(_0x19cf58,_0x30b51b){_0x19cf58=_0x19cf58-0x0;var _0x36b62f=_0xd450[_0x19cf58];return _0x36b62f;};'use strict';var Sequelize=require(_0x0d45('0x0'));module[_0x0d45('0x1')]={'body':{'type':Sequelize[_0x0d45('0x2')](_0x0d45('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x0d45('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0d45('0x5')),'defaultValue':_0x0d45('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x0d45('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index ef5edcb..9082103 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 _0xe0d7=['papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','catch','create','body','find','describe','chat-interactions','accept','chat','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','ChatInteractionId','read1stAt','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','startsWith','cf_','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','interface','channel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','push','sequelize','Sequelize','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x3f1a73,_0x1c89e7){var _0x47f0da=function(_0x52b87a){while(--_0x52b87a){_0x3f1a73['push'](_0x3f1a73['shift']());}};_0x47f0da(++_0x1c89e7);}(_0xe0d7,0x78));var _0x7e0d=function(_0x239742,_0xd1c021){_0x239742=_0x239742-0x0;var _0x5e4792=_0xe0d7[_0x239742];return _0x5e4792;};'use strict';var emlformat=require(_0x7e0d('0x0'));var rimraf=require(_0x7e0d('0x1'));var zipdir=require(_0x7e0d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7e0d('0x3'));var moment=require(_0x7e0d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7e0d('0x5'));var util=require('util');var path=require(_0x7e0d('0x6'));var sox=require(_0x7e0d('0x7'));var csv=require(_0x7e0d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e0d('0x9'));var _=require(_0x7e0d('0xa'));var squel=require(_0x7e0d('0xb'));var crypto=require(_0x7e0d('0xc'));var jsforce=require(_0x7e0d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7e0d('0x8'));var querystring=require(_0x7e0d('0xe'));var Papa=require(_0x7e0d('0xf'));var Redis=require('ioredis');var authService=require(_0x7e0d('0x10'));var qs=require(_0x7e0d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e0d('0x12'));var logger=require(_0x7e0d('0x13'))(_0x7e0d('0x14'));var utils=require('../../config/utils');var config=require(_0x7e0d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7e0d('0x16'))['db'];config[_0x7e0d('0x17')]=_[_0x7e0d('0x18')](config[_0x7e0d('0x17')],{'host':_0x7e0d('0x19'),'port':0x18eb});var socket=require(_0x7e0d('0x1a'))(new Redis(config[_0x7e0d('0x17')]));require(_0x7e0d('0x1b'))[_0x7e0d('0x1c')](socket);var jayson=require(_0x7e0d('0x1d'));var client=jayson[_0x7e0d('0x1e')][_0x7e0d('0x1f')]({'port':0x232c});var client9002=jayson[_0x7e0d('0x1e')][_0x7e0d('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1a5114,_0x526028,_0x1f37cd,_0x128e91){return new BPromise(function(_0x2c0ebb,_0x2a4b38){var _0x40e724=_0x128e91||client;return _0x40e724[_0x7e0d('0x20')](_0x1a5114,_0x1f37cd)['then'](function(_0x385c53){logger['info'](_0x7e0d('0x21'),_0x526028,_0x7e0d('0x22'));logger[_0x7e0d('0x23')](_0x7e0d('0x24'),_0x526028,_0x7e0d('0x22'),JSON[_0x7e0d('0x25')](_0x385c53));if(_0x385c53[_0x7e0d('0x26')]){if(_0x385c53[_0x7e0d('0x26')][_0x7e0d('0x27')]===0x1f4){logger[_0x7e0d('0x26')](_0x7e0d('0x21'),_0x526028,_0x385c53['error'][_0x7e0d('0x28')]);return _0x2a4b38(_0x385c53['error'][_0x7e0d('0x28')]);}logger[_0x7e0d('0x26')]('ChatMessage,\x20%s,\x20%s',_0x526028,_0x385c53['error'][_0x7e0d('0x28')]);return _0x2c0ebb(_0x385c53[_0x7e0d('0x26')]['message']);}else{logger[_0x7e0d('0x29')](_0x7e0d('0x21'),_0x526028,_0x7e0d('0x22'));_0x2c0ebb(_0x385c53[_0x7e0d('0x2a')]['message']);}})['catch'](function(_0x266495){logger[_0x7e0d('0x26')](_0x7e0d('0x21'),_0x526028,_0x266495);_0x2a4b38(_0x266495);});});}function respondWithStatusCode(_0x5b15a8,_0x518519){_0x518519=_0x518519||0xcc;return function(_0x25131d){if(_0x25131d){return _0x5b15a8[_0x7e0d('0x2b')](_0x518519);}return _0x5b15a8[_0x7e0d('0x2c')](_0x518519)[_0x7e0d('0x2d')]();};}function respondWithResult(_0x484d57,_0x7423c0){_0x7423c0=_0x7423c0||0xc8;return function(_0xff00b7){if(_0xff00b7){return _0x484d57['status'](_0x7423c0)['json'](_0xff00b7);}};}function respondWithFilteredResult(_0x5a5f82,_0x215a4b){return function(_0x2e5391){if(_0x2e5391){var _0x3c6af4=typeof _0x215a4b[_0x7e0d('0x2e')]===_0x7e0d('0x2f')&&typeof _0x215a4b['limit']===_0x7e0d('0x2f');var _0x583d89=_0x2e5391['count'];var _0x11f099=_0x3c6af4?0x0:_0x215a4b[_0x7e0d('0x2e')];var _0x3dc432=_0x3c6af4?_0x2e5391[_0x7e0d('0x30')]:_0x215a4b[_0x7e0d('0x2e')]+_0x215a4b[_0x7e0d('0x31')];var _0x43330d;if(_0x3dc432>=_0x583d89){_0x3dc432=_0x583d89;_0x43330d=0xc8;}else{_0x43330d=0xce;}_0x5a5f82[_0x7e0d('0x2c')](_0x43330d);return _0x5a5f82[_0x7e0d('0x32')](_0x7e0d('0x33'),_0x11f099+'-'+_0x3dc432+'/'+_0x583d89)[_0x7e0d('0x34')](_0x2e5391);}return null;};}function patchUpdates(_0x27d85c){return function(_0x4a1db8){try{jsonpatch[_0x7e0d('0x35')](_0x4a1db8,_0x27d85c,!![]);}catch(_0x47ebc1){return BPromise[_0x7e0d('0x36')](_0x47ebc1);}return _0x4a1db8[_0x7e0d('0x37')]();};}function saveUpdates(_0x2bdddc,_0x42751e){return function(_0x29e6a9){if(_0x29e6a9){return _0x29e6a9[_0x7e0d('0x38')](_0x2bdddc)['then'](function(_0x10fb07){return _0x10fb07;});}return null;};}function removeEntity(_0x13be17,_0x13bc92){return function(_0x496f21){if(_0x496f21){return _0x496f21[_0x7e0d('0x39')]()[_0x7e0d('0x3a')](function(){_0x13be17['status'](0xcc)[_0x7e0d('0x2d')]();});}};}function handleEntityNotFound(_0x5f00ac,_0x536937){return function(_0x1ea627){if(!_0x1ea627){_0x5f00ac['sendStatus'](0x194);}return _0x1ea627;};}function handleError(_0x385f16,_0x2a7147){_0x2a7147=_0x2a7147||0x1f4;return function(_0x37e239){logger[_0x7e0d('0x26')](_0x37e239[_0x7e0d('0x3b')]);if(_0x37e239[_0x7e0d('0x3c')]){delete _0x37e239[_0x7e0d('0x3c')];}_0x385f16['status'](_0x2a7147)[_0x7e0d('0x3d')](_0x37e239);};}exports[_0x7e0d('0x3e')]=function(_0x4c5f6e,_0x2b8ca3){var _0x22f45c={},_0xa55f4c={},_0x32bf7d={'count':0x0,'rows':[]};var _0x5df949=_[_0x7e0d('0x3f')](db[_0x7e0d('0x40')][_0x7e0d('0x41')],function(_0x98eb){return{'name':_0x98eb[_0x7e0d('0x42')],'type':_0x98eb[_0x7e0d('0x43')]['key']};});_0xa55f4c['model']=_['map'](_0x5df949,_0x7e0d('0x3c'));_0xa55f4c['query']=_[_0x7e0d('0x44')](_0x4c5f6e[_0x7e0d('0x45')]);_0xa55f4c[_0x7e0d('0x46')]=_[_0x7e0d('0x47')](_0xa55f4c[_0x7e0d('0x48')],_0xa55f4c[_0x7e0d('0x45')]);_0x22f45c[_0x7e0d('0x49')]=_['intersection'](_0xa55f4c[_0x7e0d('0x48')],qs['fields'](_0x4c5f6e[_0x7e0d('0x45')][_0x7e0d('0x4a')]));_0x22f45c['attributes']=_0x22f45c[_0x7e0d('0x49')]['length']?_0x22f45c['attributes']:_0xa55f4c['model'];if(!_0x4c5f6e['query'][_0x7e0d('0x4b')]('nolimit')){_0x22f45c[_0x7e0d('0x31')]=qs[_0x7e0d('0x31')](_0x4c5f6e[_0x7e0d('0x45')]['limit']);_0x22f45c[_0x7e0d('0x2e')]=qs[_0x7e0d('0x2e')](_0x4c5f6e['query']['offset']);}_0x22f45c['order']=qs[_0x7e0d('0x4c')](_0x4c5f6e[_0x7e0d('0x45')]['sort']);_0x22f45c[_0x7e0d('0x4d')]=qs[_0x7e0d('0x46')](_[_0x7e0d('0x4e')](_0x4c5f6e['query'],_0xa55f4c[_0x7e0d('0x46')]),_0x5df949);if(_0x4c5f6e[_0x7e0d('0x45')][_0x7e0d('0x4f')]){_0x22f45c['where']=_[_0x7e0d('0x50')](_0x22f45c[_0x7e0d('0x4d')],{'$or':_['map'](_0x5df949,function(_0x792f3a){if(_0x792f3a[_0x7e0d('0x43')]!==_0x7e0d('0x51')){var _0x11c474={};_0x11c474[_0x792f3a['name']]={'$like':'%'+_0x4c5f6e['query'][_0x7e0d('0x4f')]+'%'};return _0x11c474;}})});}_0x22f45c=_[_0x7e0d('0x50')]({},_0x22f45c,_0x4c5f6e[_0x7e0d('0x52')]);var _0x2f1250={'where':_0x22f45c[_0x7e0d('0x4d')]};return db[_0x7e0d('0x40')]['count'](_0x2f1250)['then'](function(_0x32fd6e){_0x32bf7d[_0x7e0d('0x30')]=_0x32fd6e;if(_0x4c5f6e[_0x7e0d('0x45')][_0x7e0d('0x53')]){_0x22f45c[_0x7e0d('0x54')]=[{'all':!![]}];}return db[_0x7e0d('0x40')][_0x7e0d('0x55')](_0x22f45c);})[_0x7e0d('0x3a')](function(_0x5c2b06){_0x32bf7d[_0x7e0d('0x56')]=_0x5c2b06;return _0x32bf7d;})[_0x7e0d('0x3a')](respondWithFilteredResult(_0x2b8ca3,_0x22f45c))['catch'](handleError(_0x2b8ca3,null));};exports[_0x7e0d('0x57')]=function(_0xab0773,_0x1fde0b){var _0x55e86d={'raw':!![],'where':{'id':_0xab0773[_0x7e0d('0x58')]['id']}},_0x344911={};_0x344911['model']=_[_0x7e0d('0x44')](db[_0x7e0d('0x40')][_0x7e0d('0x41')]);_0x344911['query']=_[_0x7e0d('0x44')](_0xab0773[_0x7e0d('0x45')]);_0x344911[_0x7e0d('0x46')]=_['intersection'](_0x344911[_0x7e0d('0x48')],_0x344911[_0x7e0d('0x45')]);_0x55e86d['attributes']=_[_0x7e0d('0x47')](_0x344911['model'],qs['fields'](_0xab0773[_0x7e0d('0x45')][_0x7e0d('0x4a')]));_0x55e86d[_0x7e0d('0x49')]=_0x55e86d['attributes'][_0x7e0d('0x59')]?_0x55e86d['attributes']:_0x344911[_0x7e0d('0x48')];if(_0xab0773[_0x7e0d('0x45')][_0x7e0d('0x53')]){_0x55e86d[_0x7e0d('0x54')]=[{'all':!![]}];}_0x55e86d=_[_0x7e0d('0x50')]({},_0x55e86d,_0xab0773['options']);return db['ChatMessage']['find'](_0x55e86d)['then'](handleEntityNotFound(_0x1fde0b,null))[_0x7e0d('0x3a')](respondWithResult(_0x1fde0b,null))[_0x7e0d('0x5a')](handleError(_0x1fde0b,null));};exports['create']=function(_0x2e3212,_0x3d5ab9){return db[_0x7e0d('0x40')][_0x7e0d('0x5b')](_0x2e3212[_0x7e0d('0x5c')],{})['then'](respondWithResult(_0x3d5ab9,0xc9))[_0x7e0d('0x5a')](handleError(_0x3d5ab9,null));};exports['update']=function(_0x5caba8,_0x3de28d){if(_0x5caba8['body']['id']){delete _0x5caba8['body']['id'];}return db[_0x7e0d('0x40')][_0x7e0d('0x5d')]({'where':{'id':_0x5caba8[_0x7e0d('0x58')]['id']}})['then'](handleEntityNotFound(_0x3de28d,null))['then'](saveUpdates(_0x5caba8['body'],null))['then'](respondWithResult(_0x3de28d,null))['catch'](handleError(_0x3de28d,null));};exports[_0x7e0d('0x39')]=function(_0x330edb,_0x264ad0){return db[_0x7e0d('0x40')][_0x7e0d('0x5d')]({'where':{'id':_0x330edb[_0x7e0d('0x58')]['id']}})['then'](handleEntityNotFound(_0x264ad0,null))['then'](removeEntity(_0x264ad0,null))[_0x7e0d('0x5a')](handleError(_0x264ad0,null));};exports[_0x7e0d('0x5e')]=function(_0x3729bb,_0x43a0f7){return db[_0x7e0d('0x40')]['describe']()[_0x7e0d('0x3a')](respondWithResult(_0x43a0f7,null))[_0x7e0d('0x5a')](handleError(_0x43a0f7,null));};var interaction_log=require('../../config/logger')(_0x7e0d('0x5f'));exports[_0x7e0d('0x60')]=function(_0x543d40,_0x3fe3f2,_0x174fd9){var _0x2c5214={'agent':{},'channel':_0x7e0d('0x61')};if(_0x543d40[_0x7e0d('0x5c')]['id']){delete _0x543d40[_0x7e0d('0x5c')]['id'];}_0x543d40[_0x7e0d('0x5c')]['read']=!![];_0x543d40['body'][_0x7e0d('0x62')]=moment()['format'](_0x7e0d('0x63'));_0x543d40[_0x7e0d('0x5c')][_0x7e0d('0x64')]=_0x543d40['body']['UserId']||_0x543d40[_0x7e0d('0x65')]['id'];_0x2c5214[_0x7e0d('0x66')]['id']=_0x543d40[_0x7e0d('0x5c')]['UserId'];return db[_0x7e0d('0x40')][_0x7e0d('0x5d')]({'where':{'id':_0x543d40[_0x7e0d('0x58')]['id'],'UserId':null},'include':[{'model':db[_0x7e0d('0x67')],'as':_0x7e0d('0x68')}]})['then'](handleEntityNotFound(_0x3fe3f2,null))[_0x7e0d('0x3a')](saveUpdates(_0x543d40[_0x7e0d('0x5c')],null))[_0x7e0d('0x3a')](function(_0x40ac20){if(_0x40ac20){_0x2c5214[_0x7e0d('0x28')]=_0x40ac20[_0x7e0d('0x69')]({'plain':!![]});return db['ChatInteraction'][_0x7e0d('0x5d')]({'where':{'id':_0x40ac20[_0x7e0d('0x6a')]}});}return null;})[_0x7e0d('0x3a')](handleEntityNotFound(_0x3fe3f2,null))[_0x7e0d('0x3a')](function(_0x589e44){if(_0x589e44){return _0x589e44[_0x7e0d('0x38')]({'UserId':_0x543d40[_0x7e0d('0x5c')][_0x7e0d('0x64')],'read1stAt':_['isNil'](_0x589e44[_0x7e0d('0x6b')])?moment()[_0x7e0d('0x6c')](_0x7e0d('0x63')):undefined});}return null;})[_0x7e0d('0x3a')](function(_0x11bb7d){if(_0x11bb7d){_0x2c5214[_0x7e0d('0x6d')]=_0x11bb7d[_0x7e0d('0x69')]({'plain':!![]});interaction_log[_0x7e0d('0x29')](_0x7e0d('0x6e'),_0x543d40[_0x7e0d('0x65')]['id'],_0x543d40[_0x7e0d('0x65')][_0x7e0d('0x3c')],_0x543d40[_0x7e0d('0x65')][_0x7e0d('0x6f')],_0x2c5214[_0x7e0d('0x6d')]['id'],_0x543d40['body']?JSON[_0x7e0d('0x25')](_0x543d40[_0x7e0d('0x5c')]):'null');return respondWithRpcPromise(_0x7e0d('0x70'),_0x7e0d('0x71'),_0x2c5214);}return null;})[_0x7e0d('0x3a')](function(_0x167379){return db[_0x7e0d('0x67')][_0x7e0d('0x5e')]()[_0x7e0d('0x3a')](function(_0x2595a2){var _0x3335f4=[];for(var _0x5b9ec0=0x0;_0x5b9ec0=_0x4543ed){_0x1e0fc9=_0x4543ed;_0x19153f=0xc8;}else{_0x19153f=0xce;}_0x43050b[_0xf2dd('0x25')](_0x19153f);return _0x43050b[_0xf2dd('0x2c')]('Content-Range',_0x36a34a+'-'+_0x1e0fc9+'/'+_0x4543ed)[_0xf2dd('0x27')](_0x5a651a);}return null;};}function patchUpdates(_0x216766){return function(_0x1ce63f){try{jsonpatch['apply'](_0x1ce63f,_0x216766,!![]);}catch(_0x4cc100){return BPromise[_0xf2dd('0x2d')](_0x4cc100);}return _0x1ce63f[_0xf2dd('0x2e')]();};}function saveUpdates(_0x50b4f4,_0x2704dc){return function(_0x230d55){if(_0x230d55){return _0x230d55[_0xf2dd('0x2f')](_0x50b4f4)['then'](function(_0xd021e0){return _0xd021e0;});}return null;};}function removeEntity(_0x396abc,_0x51348e){return function(_0x4fd49c){if(_0x4fd49c){return _0x4fd49c[_0xf2dd('0x30')]()['then'](function(){_0x396abc[_0xf2dd('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a8fe3,_0x268b9a){return function(_0x52bea4){if(!_0x52bea4){_0x1a8fe3[_0xf2dd('0x24')](0x194);}return _0x52bea4;};}function handleError(_0x5ac351,_0x4eb3ef){_0x4eb3ef=_0x4eb3ef||0x1f4;return function(_0x520587){logger[_0xf2dd('0x1f')](_0x520587[_0xf2dd('0x31')]);if(_0x520587[_0xf2dd('0x32')]){delete _0x520587[_0xf2dd('0x32')];}_0x5ac351['status'](_0x4eb3ef)['send'](_0x520587);};}exports[_0xf2dd('0x33')]=function(_0x15d404,_0x5dacc7){var _0x393686={},_0x3f24ce={},_0xb4c626={'count':0x0,'rows':[]};var _0x3a1100=_[_0xf2dd('0x34')](db[_0xf2dd('0x35')][_0xf2dd('0x36')],function(_0x524ab8){return{'name':_0x524ab8[_0xf2dd('0x37')],'type':_0x524ab8[_0xf2dd('0x38')][_0xf2dd('0x39')]};});_0x3f24ce[_0xf2dd('0x3a')]=_[_0xf2dd('0x34')](_0x3a1100,_0xf2dd('0x32'));_0x3f24ce[_0xf2dd('0x3b')]=_[_0xf2dd('0x3c')](_0x15d404['query']);_0x3f24ce[_0xf2dd('0x3d')]=_[_0xf2dd('0x3e')](_0x3f24ce['model'],_0x3f24ce[_0xf2dd('0x3b')]);_0x393686[_0xf2dd('0x3f')]=_[_0xf2dd('0x3e')](_0x3f24ce[_0xf2dd('0x3a')],qs[_0xf2dd('0x40')](_0x15d404['query']['fields']));_0x393686[_0xf2dd('0x3f')]=_0x393686[_0xf2dd('0x3f')]['length']?_0x393686[_0xf2dd('0x3f')]:_0x3f24ce[_0xf2dd('0x3a')];if(!_0x15d404[_0xf2dd('0x3b')][_0xf2dd('0x41')](_0xf2dd('0x42'))){_0x393686[_0xf2dd('0x2a')]=qs[_0xf2dd('0x2a')](_0x15d404[_0xf2dd('0x3b')][_0xf2dd('0x2a')]);_0x393686[_0xf2dd('0x28')]=qs[_0xf2dd('0x28')](_0x15d404[_0xf2dd('0x3b')][_0xf2dd('0x28')]);}_0x393686[_0xf2dd('0x43')]=qs[_0xf2dd('0x44')](_0x15d404[_0xf2dd('0x3b')]['sort']);_0x393686['where']=qs['filters'](_[_0xf2dd('0x45')](_0x15d404['query'],_0x3f24ce[_0xf2dd('0x3d')]),_0x3a1100);if(_0x15d404[_0xf2dd('0x3b')][_0xf2dd('0x46')]){_0x393686[_0xf2dd('0x47')]=_[_0xf2dd('0x48')](_0x393686[_0xf2dd('0x47')],{'$or':_[_0xf2dd('0x34')](_0x3a1100,function(_0x12370a){if(_0x12370a[_0xf2dd('0x38')]!==_0xf2dd('0x49')){var _0x330aa0={};_0x330aa0[_0x12370a[_0xf2dd('0x32')]]={'$like':'%'+_0x15d404[_0xf2dd('0x3b')]['filter']+'%'};return _0x330aa0;}})});}_0x393686=_[_0xf2dd('0x48')]({},_0x393686,_0x15d404[_0xf2dd('0x4a')]);var _0x5f5ac4={'where':_0x393686[_0xf2dd('0x47')]};return db['ChatMessage'][_0xf2dd('0x2b')](_0x5f5ac4)['then'](function(_0x5e0d99){_0xb4c626[_0xf2dd('0x2b')]=_0x5e0d99;if(_0x15d404[_0xf2dd('0x3b')]['includeAll']){_0x393686[_0xf2dd('0x4b')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x393686);})['then'](function(_0x8ab571){_0xb4c626[_0xf2dd('0x4c')]=_0x8ab571;return _0xb4c626;})[_0xf2dd('0x4d')](respondWithFilteredResult(_0x5dacc7,_0x393686))[_0xf2dd('0x23')](handleError(_0x5dacc7,null));};exports[_0xf2dd('0x4e')]=function(_0x3e4e26,_0x27dbd0){var _0x1ade53={'raw':!![],'where':{'id':_0x3e4e26[_0xf2dd('0x4f')]['id']}},_0x204fc5={};_0x204fc5[_0xf2dd('0x3a')]=_[_0xf2dd('0x3c')](db[_0xf2dd('0x35')][_0xf2dd('0x36')]);_0x204fc5[_0xf2dd('0x3b')]=_[_0xf2dd('0x3c')](_0x3e4e26[_0xf2dd('0x3b')]);_0x204fc5[_0xf2dd('0x3d')]=_['intersection'](_0x204fc5[_0xf2dd('0x3a')],_0x204fc5['query']);_0x1ade53[_0xf2dd('0x3f')]=_[_0xf2dd('0x3e')](_0x204fc5['model'],qs['fields'](_0x3e4e26[_0xf2dd('0x3b')]['fields']));_0x1ade53[_0xf2dd('0x3f')]=_0x1ade53['attributes'][_0xf2dd('0x50')]?_0x1ade53[_0xf2dd('0x3f')]:_0x204fc5[_0xf2dd('0x3a')];if(_0x3e4e26[_0xf2dd('0x3b')][_0xf2dd('0x51')]){_0x1ade53[_0xf2dd('0x4b')]=[{'all':!![]}];}_0x1ade53=_[_0xf2dd('0x48')]({},_0x1ade53,_0x3e4e26[_0xf2dd('0x4a')]);return db[_0xf2dd('0x35')][_0xf2dd('0x52')](_0x1ade53)[_0xf2dd('0x4d')](handleEntityNotFound(_0x27dbd0,null))['then'](respondWithResult(_0x27dbd0,null))[_0xf2dd('0x23')](handleError(_0x27dbd0,null));};exports['create']=function(_0x27f1a9,_0x196abc){return db[_0xf2dd('0x35')][_0xf2dd('0x53')](_0x27f1a9[_0xf2dd('0x54')],{})[_0xf2dd('0x4d')](respondWithResult(_0x196abc,0xc9))[_0xf2dd('0x23')](handleError(_0x196abc,null));};exports['update']=function(_0x786848,_0x391d93){if(_0x786848['body']['id']){delete _0x786848['body']['id'];}return db[_0xf2dd('0x35')][_0xf2dd('0x52')]({'where':{'id':_0x786848[_0xf2dd('0x4f')]['id']}})['then'](handleEntityNotFound(_0x391d93,null))[_0xf2dd('0x4d')](saveUpdates(_0x786848[_0xf2dd('0x54')],null))['then'](respondWithResult(_0x391d93,null))[_0xf2dd('0x23')](handleError(_0x391d93,null));};exports[_0xf2dd('0x30')]=function(_0x52d2ab,_0x101357){return db[_0xf2dd('0x35')][_0xf2dd('0x52')]({'where':{'id':_0x52d2ab[_0xf2dd('0x4f')]['id']}})[_0xf2dd('0x4d')](handleEntityNotFound(_0x101357,null))[_0xf2dd('0x4d')](removeEntity(_0x101357,null))[_0xf2dd('0x23')](handleError(_0x101357,null));};exports[_0xf2dd('0x55')]=function(_0x289691,_0x17e2f1){return db['ChatMessage'][_0xf2dd('0x55')]()[_0xf2dd('0x4d')](respondWithResult(_0x17e2f1,null))[_0xf2dd('0x23')](handleError(_0x17e2f1,null));};var interaction_log=require(_0xf2dd('0xe'))(_0xf2dd('0x56'));exports[_0xf2dd('0x57')]=function(_0x548cc5,_0x52a224,_0x233791){var _0x7f1064={'agent':{},'channel':'chat'};if(_0x548cc5[_0xf2dd('0x54')]['id']){delete _0x548cc5[_0xf2dd('0x54')]['id'];}_0x548cc5[_0xf2dd('0x54')][_0xf2dd('0x58')]=!![];_0x548cc5[_0xf2dd('0x54')][_0xf2dd('0x59')]=moment()[_0xf2dd('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x548cc5[_0xf2dd('0x54')][_0xf2dd('0x5b')]=_0x548cc5['body'][_0xf2dd('0x5b')]||_0x548cc5['user']['id'];_0x7f1064[_0xf2dd('0x5c')]['id']=_0x548cc5[_0xf2dd('0x54')][_0xf2dd('0x5b')];return db[_0xf2dd('0x35')][_0xf2dd('0x52')]({'where':{'id':_0x548cc5[_0xf2dd('0x4f')]['id'],'UserId':null},'include':[{'model':db[_0xf2dd('0x5d')],'as':_0xf2dd('0x5e')}]})[_0xf2dd('0x4d')](handleEntityNotFound(_0x52a224,null))['then'](saveUpdates(_0x548cc5[_0xf2dd('0x54')],null))[_0xf2dd('0x4d')](function(_0x316b8c){if(_0x316b8c){_0x7f1064['message']=_0x316b8c[_0xf2dd('0x5f')]({'plain':!![]});return db[_0xf2dd('0x60')]['find']({'where':{'id':_0x316b8c[_0xf2dd('0x61')]}});}return null;})[_0xf2dd('0x4d')](handleEntityNotFound(_0x52a224,null))[_0xf2dd('0x4d')](function(_0x377218){if(_0x377218){return _0x377218[_0xf2dd('0x2f')]({'UserId':_0x548cc5[_0xf2dd('0x54')][_0xf2dd('0x5b')],'read1stAt':_[_0xf2dd('0x62')](_0x377218[_0xf2dd('0x63')])?moment()['format'](_0xf2dd('0x64')):undefined});}return null;})[_0xf2dd('0x4d')](function(_0x2d72a1){if(_0x2d72a1){_0x7f1064[_0xf2dd('0x65')]=_0x2d72a1[_0xf2dd('0x5f')]({'plain':!![]});interaction_log[_0xf2dd('0x21')](_0xf2dd('0x66'),_0x548cc5['user']['id'],_0x548cc5[_0xf2dd('0x67')][_0xf2dd('0x32')],_0x548cc5['user'][_0xf2dd('0x68')],_0x7f1064[_0xf2dd('0x65')]['id'],_0x548cc5[_0xf2dd('0x54')]?JSON['stringify'](_0x548cc5[_0xf2dd('0x54')]):_0xf2dd('0x69'));return respondWithRpcPromise(_0xf2dd('0x6a'),_0xf2dd('0x6b'),_0x7f1064);}return null;})[_0xf2dd('0x4d')](function(_0xeb93d0){return db[_0xf2dd('0x5d')][_0xf2dd('0x55')]()['then'](function(_0x5ea7cf){var _0x3d5a41=[];for(var _0x4875e7=0x0;_0x4875e7=_0x5b5dfe){_0x3dc293=_0x5b5dfe;_0x1b82bf=0xc8;}else{_0x1b82bf=0xce;}_0xbb52a0['status'](_0x1b82bf);return _0xbb52a0[_0xc788('0x24')](_0xc788('0x25'),_0xe294dc+'-'+_0x3dc293+'/'+_0x5b5dfe)['json'](_0x33c082);}return null;};}function patchUpdates(_0x5566a9){return function(_0xc687b1){try{jsonpatch[_0xc788('0x26')](_0xc687b1,_0x5566a9,!![]);}catch(_0x2dc5dc){return BPromise[_0xc788('0x27')](_0x2dc5dc);}return _0xc687b1[_0xc788('0x28')]();};}function saveUpdates(_0x2c9dca,_0x14b81b){return function(_0x1683f4){if(_0x1683f4){return _0x1683f4[_0xc788('0x29')](_0x2c9dca)[_0xc788('0x2a')](function(_0x57e587){return _0x57e587;});}return null;};}function removeEntity(_0x8e9f01,_0xb05f7){return function(_0x488f24){if(_0x488f24){return _0x488f24[_0xc788('0x2b')]()[_0xc788('0x2a')](function(){_0x8e9f01[_0xc788('0x2c')](0xcc)[_0xc788('0x1e')]();});}};}function handleEntityNotFound(_0x4ebae9,_0x5ab36d){return function(_0x5aa9fa){if(!_0x5aa9fa){_0x4ebae9['sendStatus'](0x194);}return _0x5aa9fa;};}function handleError(_0x4025ee,_0x14de99){_0x14de99=_0x14de99||0x1f4;return function(_0x139b59){logger['error'](_0x139b59['stack']);if(_0x139b59[_0xc788('0x2d')]){delete _0x139b59[_0xc788('0x2d')];}_0x4025ee[_0xc788('0x2c')](_0x14de99)[_0xc788('0x2e')](_0x139b59);};}exports[_0xc788('0x2f')]=function(_0x519ebb,_0x571397){var _0x541064={},_0x3cb732={},_0x33b9d0={'count':0x0,'rows':[]};var _0x2616b9=_[_0xc788('0x30')](db['ChatOfflineMessage'][_0xc788('0x31')],function(_0x121d81){return{'name':_0x121d81['fieldName'],'type':_0x121d81[_0xc788('0x32')][_0xc788('0x33')]};});_0x3cb732[_0xc788('0x34')]=_[_0xc788('0x30')](_0x2616b9,_0xc788('0x2d'));_0x3cb732[_0xc788('0x35')]=_[_0xc788('0x36')](_0x519ebb[_0xc788('0x35')]);_0x3cb732['filters']=_[_0xc788('0x37')](_0x3cb732[_0xc788('0x34')],_0x3cb732[_0xc788('0x35')]);_0x541064[_0xc788('0x38')]=_[_0xc788('0x37')](_0x3cb732[_0xc788('0x34')],qs[_0xc788('0x39')](_0x519ebb[_0xc788('0x35')][_0xc788('0x39')]));_0x541064[_0xc788('0x38')]=_0x541064[_0xc788('0x38')]['length']?_0x541064[_0xc788('0x38')]:_0x3cb732[_0xc788('0x34')];if(!_0x519ebb[_0xc788('0x35')][_0xc788('0x3a')](_0xc788('0x3b'))){_0x541064[_0xc788('0x22')]=qs[_0xc788('0x22')](_0x519ebb[_0xc788('0x35')]['limit']);_0x541064[_0xc788('0x20')]=qs['offset'](_0x519ebb[_0xc788('0x35')][_0xc788('0x20')]);}_0x541064[_0xc788('0x3c')]=qs['sort'](_0x519ebb[_0xc788('0x35')][_0xc788('0x3d')]);_0x541064[_0xc788('0x3e')]=qs['filters'](_[_0xc788('0x3f')](_0x519ebb[_0xc788('0x35')],_0x3cb732[_0xc788('0x40')]),_0x2616b9);if(_0x519ebb[_0xc788('0x35')]['filter']){_0x541064[_0xc788('0x3e')]=_[_0xc788('0x41')](_0x541064[_0xc788('0x3e')],{'$or':_[_0xc788('0x30')](_0x2616b9,function(_0x13c005){if(_0x13c005[_0xc788('0x32')]!==_0xc788('0x42')){var _0x346e23={};_0x346e23[_0x13c005[_0xc788('0x2d')]]={'$like':'%'+_0x519ebb[_0xc788('0x35')][_0xc788('0x43')]+'%'};return _0x346e23;}})});}_0x541064=_[_0xc788('0x41')]({},_0x541064,_0x519ebb['options']);var _0x19f9bf={'where':_0x541064[_0xc788('0x3e')]};return db[_0xc788('0x44')][_0xc788('0x23')](_0x19f9bf)[_0xc788('0x2a')](function(_0x2a62de){_0x33b9d0[_0xc788('0x23')]=_0x2a62de;if(_0x519ebb[_0xc788('0x35')]['includeAll']){_0x541064['include']=[{'all':!![]}];}return db[_0xc788('0x44')][_0xc788('0x45')](_0x541064);})[_0xc788('0x2a')](function(_0x3fbb9c){_0x33b9d0[_0xc788('0x46')]=_0x3fbb9c;return _0x33b9d0;})['then'](respondWithFilteredResult(_0x571397,_0x541064))['catch'](handleError(_0x571397,null));};exports[_0xc788('0x47')]=function(_0x3d1e5b,_0x12e650){var _0x210141={'raw':!![],'where':{'id':_0x3d1e5b['params']['id']}},_0xe4f799={};_0xe4f799[_0xc788('0x34')]=_[_0xc788('0x36')](db['ChatOfflineMessage'][_0xc788('0x31')]);_0xe4f799[_0xc788('0x35')]=_[_0xc788('0x36')](_0x3d1e5b['query']);_0xe4f799[_0xc788('0x40')]=_[_0xc788('0x37')](_0xe4f799['model'],_0xe4f799['query']);_0x210141[_0xc788('0x38')]=_[_0xc788('0x37')](_0xe4f799['model'],qs[_0xc788('0x39')](_0x3d1e5b[_0xc788('0x35')][_0xc788('0x39')]));_0x210141[_0xc788('0x38')]=_0x210141[_0xc788('0x38')]['length']?_0x210141[_0xc788('0x38')]:_0xe4f799[_0xc788('0x34')];if(_0x3d1e5b[_0xc788('0x35')]['includeAll']){_0x210141['include']=[{'all':!![]}];}_0x210141=_['merge']({},_0x210141,_0x3d1e5b[_0xc788('0x48')]);return db[_0xc788('0x44')][_0xc788('0x49')](_0x210141)[_0xc788('0x2a')](handleEntityNotFound(_0x12e650,null))[_0xc788('0x2a')](respondWithResult(_0x12e650,null))[_0xc788('0x4a')](handleError(_0x12e650,null));};exports[_0xc788('0x4b')]=function(_0x245eac,_0x17a627){return db[_0xc788('0x44')][_0xc788('0x4b')](_0x245eac['body'],{})['then'](respondWithResult(_0x17a627,0xc9))[_0xc788('0x4a')](handleError(_0x17a627,null));};exports[_0xc788('0x29')]=function(_0x2492ba,_0x524cb3){if(_0x2492ba['body']['id']){delete _0x2492ba['body']['id'];}return db[_0xc788('0x44')][_0xc788('0x49')]({'where':{'id':_0x2492ba[_0xc788('0x4c')]['id']}})[_0xc788('0x2a')](handleEntityNotFound(_0x524cb3,null))[_0xc788('0x2a')](saveUpdates(_0x2492ba[_0xc788('0x4d')],null))[_0xc788('0x2a')](respondWithResult(_0x524cb3,null))['catch'](handleError(_0x524cb3,null));};exports[_0xc788('0x2b')]=function(_0x5ba94d,_0x303240){return db['Attachment'][_0xc788('0x45')]({'where':{'ChatOfflineMessageId':_0x5ba94d[_0xc788('0x4c')]['id']},'raw':!![]})['then'](function(_0x407720){_0x407720['forEach'](function(_0x13ec01){var _0x31c98b=path['join'](config[_0xc788('0x4e')],_0xc788('0x4f'),_0xc788('0x50'),'attachments','offline-chat',_0x13ec01[_0xc788('0x51')]);var _0xa2d67d=fs[_0xc788('0x52')](_0x31c98b);if(_0xa2d67d)fs_extra[_0xc788('0x53')](_0x31c98b);});})['then'](function(){return db[_0xc788('0x44')][_0xc788('0x49')]({'where':{'id':_0x5ba94d[_0xc788('0x4c')]['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x303240,null))[_0xc788('0x2a')](removeEntity(_0x303240,null))[_0xc788('0x4a')](handleError(_0x303240,null));};exports['describe']=function(_0x145725,_0x3320c){return db[_0xc788('0x44')][_0xc788('0x54')]()[_0xc788('0x2a')](respondWithResult(_0x3320c,null))[_0xc788('0x4a')](handleError(_0x3320c,null));}; \ No newline at end of file +var _0x7224=['merge','VIRTUAL','options','ChatOfflineMessage','includeAll','include','catch','params','find','create','body','Attachment','findAll','forEach','join','root','server','files','attachments','offline-chat','basename','existsSync','remove','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','save','update','destroy','then','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter'];(function(_0x5c3891,_0x284f4c){var _0x34ecda=function(_0x5d0e10){while(--_0x5d0e10){_0x5c3891['push'](_0x5c3891['shift']());}};_0x34ecda(++_0x284f4c);}(_0x7224,0xc6));var _0x4722=function(_0x27b059,_0x275671){_0x27b059=_0x27b059-0x0;var _0x982b2a=_0x7224[_0x27b059];return _0x982b2a;};'use strict';var emlformat=require(_0x4722('0x0'));var rimraf=require(_0x4722('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4722('0x2'));var rp=require(_0x4722('0x3'));var moment=require('moment');var BPromise=require(_0x4722('0x4'));var Mustache=require(_0x4722('0x5'));var util=require(_0x4722('0x6'));var path=require(_0x4722('0x7'));var sox=require('sox');var csv=require(_0x4722('0x8'));var ejs=require(_0x4722('0x9'));var fs=require('fs');var fs_extra=require(_0x4722('0xa'));var _=require(_0x4722('0xb'));var squel=require(_0x4722('0xc'));var crypto=require(_0x4722('0xd'));var jsforce=require(_0x4722('0xe'));var deskjs=require(_0x4722('0xf'));var toCsv=require(_0x4722('0x8'));var querystring=require(_0x4722('0x10'));var Papa=require(_0x4722('0x11'));var Redis=require(_0x4722('0x12'));var authService=require(_0x4722('0x13'));var qs=require(_0x4722('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4722('0x15'));var logger=require('../../config/logger')(_0x4722('0x16'));var utils=require(_0x4722('0x17'));var config=require(_0x4722('0x18'));var licenseUtil=require(_0x4722('0x19'));var db=require(_0x4722('0x1a'))['db'];function respondWithStatusCode(_0x4cbe4c,_0x25816b){_0x25816b=_0x25816b||0xcc;return function(_0x52b221){if(_0x52b221){return _0x4cbe4c[_0x4722('0x1b')](_0x25816b);}return _0x4cbe4c[_0x4722('0x1c')](_0x25816b)['end']();};}function respondWithResult(_0x4dae96,_0x3eb948){_0x3eb948=_0x3eb948||0xc8;return function(_0x37804c){if(_0x37804c){return _0x4dae96[_0x4722('0x1c')](_0x3eb948)[_0x4722('0x1d')](_0x37804c);}};}function respondWithFilteredResult(_0xdee385,_0x19f60c){return function(_0x32e858){if(_0x32e858){var _0x3ea680=typeof _0x19f60c[_0x4722('0x1e')]===_0x4722('0x1f')&&typeof _0x19f60c[_0x4722('0x20')]==='undefined';var _0x28e37b=_0x32e858[_0x4722('0x21')];var _0x334798=_0x3ea680?0x0:_0x19f60c[_0x4722('0x1e')];var _0x1a50bd=_0x3ea680?_0x32e858[_0x4722('0x21')]:_0x19f60c['offset']+_0x19f60c[_0x4722('0x20')];var _0x1576c2;if(_0x1a50bd>=_0x28e37b){_0x1a50bd=_0x28e37b;_0x1576c2=0xc8;}else{_0x1576c2=0xce;}_0xdee385[_0x4722('0x1c')](_0x1576c2);return _0xdee385['set']('Content-Range',_0x334798+'-'+_0x1a50bd+'/'+_0x28e37b)[_0x4722('0x1d')](_0x32e858);}return null;};}function patchUpdates(_0x407ceb){return function(_0x3e3686){try{jsonpatch[_0x4722('0x22')](_0x3e3686,_0x407ceb,!![]);}catch(_0xd1f4e9){return BPromise['reject'](_0xd1f4e9);}return _0x3e3686[_0x4722('0x23')]();};}function saveUpdates(_0x3a29ee,_0x3efe8b){return function(_0x3df7b5){if(_0x3df7b5){return _0x3df7b5[_0x4722('0x24')](_0x3a29ee)['then'](function(_0x24cc58){return _0x24cc58;});}return null;};}function removeEntity(_0x23f774,_0x4502b0){return function(_0x3b0da3){if(_0x3b0da3){return _0x3b0da3[_0x4722('0x25')]()[_0x4722('0x26')](function(){_0x23f774[_0x4722('0x1c')](0xcc)[_0x4722('0x27')]();});}};}function handleEntityNotFound(_0xb7eb05,_0x245712){return function(_0x38debe){if(!_0x38debe){_0xb7eb05[_0x4722('0x1b')](0x194);}return _0x38debe;};}function handleError(_0x5cfd13,_0x117da6){_0x117da6=_0x117da6||0x1f4;return function(_0x38f709){logger[_0x4722('0x28')](_0x38f709[_0x4722('0x29')]);if(_0x38f709['name']){delete _0x38f709[_0x4722('0x2a')];}_0x5cfd13[_0x4722('0x1c')](_0x117da6)[_0x4722('0x2b')](_0x38f709);};}exports['index']=function(_0x36a655,_0x2f6702){var _0x5933dc={},_0x20b418={},_0x284df5={'count':0x0,'rows':[]};var _0x5a91aa=_[_0x4722('0x2c')](db['ChatOfflineMessage'][_0x4722('0x2d')],function(_0x1eb019){return{'name':_0x1eb019[_0x4722('0x2e')],'type':_0x1eb019[_0x4722('0x2f')][_0x4722('0x30')]};});_0x20b418['model']=_[_0x4722('0x2c')](_0x5a91aa,'name');_0x20b418[_0x4722('0x31')]=_[_0x4722('0x32')](_0x36a655[_0x4722('0x31')]);_0x20b418['filters']=_[_0x4722('0x33')](_0x20b418[_0x4722('0x34')],_0x20b418[_0x4722('0x31')]);_0x5933dc['attributes']=_[_0x4722('0x33')](_0x20b418['model'],qs[_0x4722('0x35')](_0x36a655['query'][_0x4722('0x35')]));_0x5933dc[_0x4722('0x36')]=_0x5933dc[_0x4722('0x36')]['length']?_0x5933dc[_0x4722('0x36')]:_0x20b418['model'];if(!_0x36a655[_0x4722('0x31')][_0x4722('0x37')](_0x4722('0x38'))){_0x5933dc[_0x4722('0x20')]=qs[_0x4722('0x20')](_0x36a655[_0x4722('0x31')][_0x4722('0x20')]);_0x5933dc[_0x4722('0x1e')]=qs['offset'](_0x36a655[_0x4722('0x31')][_0x4722('0x1e')]);}_0x5933dc[_0x4722('0x39')]=qs[_0x4722('0x3a')](_0x36a655[_0x4722('0x31')][_0x4722('0x3a')]);_0x5933dc[_0x4722('0x3b')]=qs[_0x4722('0x3c')](_[_0x4722('0x3d')](_0x36a655[_0x4722('0x31')],_0x20b418['filters']),_0x5a91aa);if(_0x36a655[_0x4722('0x31')][_0x4722('0x3e')]){_0x5933dc[_0x4722('0x3b')]=_[_0x4722('0x3f')](_0x5933dc['where'],{'$or':_[_0x4722('0x2c')](_0x5a91aa,function(_0x12c1f4){if(_0x12c1f4[_0x4722('0x2f')]!==_0x4722('0x40')){var _0x15da1a={};_0x15da1a[_0x12c1f4[_0x4722('0x2a')]]={'$like':'%'+_0x36a655[_0x4722('0x31')][_0x4722('0x3e')]+'%'};return _0x15da1a;}})});}_0x5933dc=_[_0x4722('0x3f')]({},_0x5933dc,_0x36a655[_0x4722('0x41')]);var _0x348d69={'where':_0x5933dc[_0x4722('0x3b')]};return db[_0x4722('0x42')][_0x4722('0x21')](_0x348d69)[_0x4722('0x26')](function(_0x37179d){_0x284df5[_0x4722('0x21')]=_0x37179d;if(_0x36a655['query'][_0x4722('0x43')]){_0x5933dc[_0x4722('0x44')]=[{'all':!![]}];}return db['ChatOfflineMessage']['findAll'](_0x5933dc);})['then'](function(_0x2d0343){_0x284df5['rows']=_0x2d0343;return _0x284df5;})[_0x4722('0x26')](respondWithFilteredResult(_0x2f6702,_0x5933dc))[_0x4722('0x45')](handleError(_0x2f6702,null));};exports['show']=function(_0x112324,_0x29d824){var _0x2eace8={'raw':!![],'where':{'id':_0x112324[_0x4722('0x46')]['id']}},_0x21a32c={};_0x21a32c['model']=_[_0x4722('0x32')](db[_0x4722('0x42')][_0x4722('0x2d')]);_0x21a32c[_0x4722('0x31')]=_[_0x4722('0x32')](_0x112324['query']);_0x21a32c['filters']=_[_0x4722('0x33')](_0x21a32c['model'],_0x21a32c[_0x4722('0x31')]);_0x2eace8[_0x4722('0x36')]=_[_0x4722('0x33')](_0x21a32c['model'],qs[_0x4722('0x35')](_0x112324[_0x4722('0x31')][_0x4722('0x35')]));_0x2eace8[_0x4722('0x36')]=_0x2eace8[_0x4722('0x36')]['length']?_0x2eace8[_0x4722('0x36')]:_0x21a32c[_0x4722('0x34')];if(_0x112324[_0x4722('0x31')][_0x4722('0x43')]){_0x2eace8[_0x4722('0x44')]=[{'all':!![]}];}_0x2eace8=_[_0x4722('0x3f')]({},_0x2eace8,_0x112324['options']);return db['ChatOfflineMessage'][_0x4722('0x47')](_0x2eace8)[_0x4722('0x26')](handleEntityNotFound(_0x29d824,null))['then'](respondWithResult(_0x29d824,null))[_0x4722('0x45')](handleError(_0x29d824,null));};exports[_0x4722('0x48')]=function(_0x3495ac,_0x55db1b){return db['ChatOfflineMessage']['create'](_0x3495ac[_0x4722('0x49')],{})[_0x4722('0x26')](respondWithResult(_0x55db1b,0xc9))[_0x4722('0x45')](handleError(_0x55db1b,null));};exports[_0x4722('0x24')]=function(_0x1a0216,_0x1e5f3b){if(_0x1a0216[_0x4722('0x49')]['id']){delete _0x1a0216[_0x4722('0x49')]['id'];}return db[_0x4722('0x42')][_0x4722('0x47')]({'where':{'id':_0x1a0216[_0x4722('0x46')]['id']}})['then'](handleEntityNotFound(_0x1e5f3b,null))[_0x4722('0x26')](saveUpdates(_0x1a0216[_0x4722('0x49')],null))[_0x4722('0x26')](respondWithResult(_0x1e5f3b,null))[_0x4722('0x45')](handleError(_0x1e5f3b,null));};exports[_0x4722('0x25')]=function(_0xadd448,_0x15fbd6){return db[_0x4722('0x4a')][_0x4722('0x4b')]({'where':{'ChatOfflineMessageId':_0xadd448['params']['id']},'raw':!![]})[_0x4722('0x26')](function(_0x1d3ebe){_0x1d3ebe[_0x4722('0x4c')](function(_0xb1c0ec){var _0x1865cd=path[_0x4722('0x4d')](config[_0x4722('0x4e')],_0x4722('0x4f'),_0x4722('0x50'),_0x4722('0x51'),_0x4722('0x52'),_0xb1c0ec[_0x4722('0x53')]);var _0x49ed0a=fs[_0x4722('0x54')](_0x1865cd);if(_0x49ed0a)fs_extra[_0x4722('0x55')](_0x1865cd);});})[_0x4722('0x26')](function(){return db[_0x4722('0x42')][_0x4722('0x47')]({'where':{'id':_0xadd448['params']['id']},'individualHooks':!![]});})[_0x4722('0x26')](handleEntityNotFound(_0x15fbd6,null))[_0x4722('0x26')](removeEntity(_0x15fbd6,null))[_0x4722('0x45')](handleError(_0x15fbd6,null));};exports[_0x4722('0x56')]=function(_0x5b66e2,_0xb783c6){return db[_0x4722('0x42')][_0x4722('0x56')]()['then'](respondWithResult(_0xb783c6,null))[_0x4722('0x45')](handleError(_0xb783c6,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 1e6f8a4..0da83e9 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 _0xf021=['moment','request-promise','rimraf','../../config/environment','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x22d7e6,_0xa620e7){var _0x72bc58=function(_0x2c75f6){while(--_0x2c75f6){_0x22d7e6['push'](_0x22d7e6['shift']());}};_0x72bc58(++_0xa620e7);}(_0xf021,0x18f));var _0x1f02=function(_0x214d8c,_0x242dc3){_0x214d8c=_0x214d8c-0x0;var _0x5a5060=_0xf021[_0x214d8c];return _0x5a5060;};'use strict';var _=require(_0x1f02('0x0'));var util=require(_0x1f02('0x1'));var logger=require(_0x1f02('0x2'))(_0x1f02('0x3'));var moment=require(_0x1f02('0x4'));var BPromise=require('bluebird');var rp=require(_0x1f02('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f02('0x6'));var config=require(_0x1f02('0x7'));var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x84a8f0,_0x56b275){return _0x84a8f0[_0x1f02('0x8')](_0x1f02('0x9'),attributes,{'tableName':_0x1f02('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1f02('0xb'),'collate':_0x1f02('0xc')});}; \ No newline at end of file +var _0xd2ea=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x267dd0,_0x45fe4c){var _0x3faa22=function(_0x16d5f0){while(--_0x16d5f0){_0x267dd0['push'](_0x267dd0['shift']());}};_0x3faa22(++_0x45fe4c);}(_0xd2ea,0x15f));var _0xad2e=function(_0x38fb0d,_0x52b5db){_0x38fb0d=_0x38fb0d-0x0;var _0x30a5d6=_0xd2ea[_0x38fb0d];return _0x30a5d6;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var moment=require(_0xad2e('0x4'));var BPromise=require('bluebird');var rp=require(_0xad2e('0x5'));var fs=require('fs');var path=require(_0xad2e('0x6'));var rimraf=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var attributes=require(_0xad2e('0x9'));module[_0xad2e('0xa')]=function(_0x29e97f,_0x592e8b){return _0x29e97f[_0xad2e('0xb')](_0xad2e('0xc'),attributes,{'tableName':_0xad2e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xad2e('0xe')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index e722e0a..e83272d 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 _0xc618=['../../config/utils','rpc','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x110612,_0x19b5f1){var _0x32056d=function(_0x399150){while(--_0x399150){_0x110612['push'](_0x110612['shift']());}};_0x32056d(++_0x19b5f1);}(_0xc618,0xa2));var _0x8c61=function(_0x453dfb,_0x490420){_0x453dfb=_0x453dfb-0x0;var _0x5d2c93=_0xc618[_0x453dfb];return _0x5d2c93;};'use strict';var _=require(_0x8c61('0x0'));var util=require(_0x8c61('0x1'));var moment=require(_0x8c61('0x2'));var BPromise=require(_0x8c61('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c61('0x4'));var db=require(_0x8c61('0x5'))['db'];var utils=require(_0x8c61('0x6'));var logger=require('../../config/logger')(_0x8c61('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8c61('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x234b12,_0x1b5afc,_0x3766e7){return new BPromise(function(_0x15b2d6,_0xd42f24){return client[_0x8c61('0x9')](_0x234b12,_0x3766e7)[_0x8c61('0xa')](function(_0x5f17c4){logger[_0x8c61('0xb')](_0x8c61('0xc'),_0x1b5afc,_0x8c61('0xd'));logger[_0x8c61('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x1b5afc,_0x8c61('0xd'),JSON[_0x8c61('0xf')](_0x5f17c4));if(_0x5f17c4[_0x8c61('0x10')]){if(_0x5f17c4[_0x8c61('0x10')][_0x8c61('0x11')]===0x1f4){logger[_0x8c61('0x10')](_0x8c61('0xc'),_0x1b5afc,_0x5f17c4[_0x8c61('0x10')][_0x8c61('0x12')]);return _0xd42f24(_0x5f17c4['error'][_0x8c61('0x12')]);}logger[_0x8c61('0x10')](_0x8c61('0xc'),_0x1b5afc,_0x5f17c4[_0x8c61('0x10')][_0x8c61('0x12')]);return _0x15b2d6(_0x5f17c4[_0x8c61('0x10')]['message']);}else{logger[_0x8c61('0xb')](_0x8c61('0xc'),_0x1b5afc,_0x8c61('0xd'));_0x15b2d6(_0x5f17c4[_0x8c61('0x13')][_0x8c61('0x12')]);}})[_0x8c61('0x14')](function(_0x36fd23){logger[_0x8c61('0x10')](_0x8c61('0xc'),_0x1b5afc,_0x36fd23);_0xd42f24(_0x36fd23);});});} \ No newline at end of file +var _0xcadb=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatOfflineMessage,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4fed34,_0x137772){var _0x542a1f=function(_0xba3036){while(--_0xba3036){_0x4fed34['push'](_0x4fed34['shift']());}};_0x542a1f(++_0x137772);}(_0xcadb,0x1dd));var _0xbcad=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xcadb[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0xbcad('0x0'));var util=require(_0xbcad('0x1'));var moment=require('moment');var BPromise=require(_0xbcad('0x2'));var rs=require(_0xbcad('0x3'));var fs=require('fs');var Redis=require(_0xbcad('0x4'));var db=require(_0xbcad('0x5'))['db'];var utils=require(_0xbcad('0x6'));var logger=require(_0xbcad('0x7'))(_0xbcad('0x8'));var config=require(_0xbcad('0x9'));var jayson=require(_0xbcad('0xa'));var client=jayson['client'][_0xbcad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1408e6,_0x3d5f1c,_0x252269){return new BPromise(function(_0x372c08,_0x1eb27b){return client['request'](_0x1408e6,_0x252269)['then'](function(_0x3a735f){logger[_0xbcad('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3d5f1c,_0xbcad('0xd'));logger[_0xbcad('0xe')](_0xbcad('0xf'),_0x3d5f1c,_0xbcad('0xd'),JSON[_0xbcad('0x10')](_0x3a735f));if(_0x3a735f['error']){if(_0x3a735f[_0xbcad('0x11')][_0xbcad('0x12')]===0x1f4){logger[_0xbcad('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3d5f1c,_0x3a735f[_0xbcad('0x11')]['message']);return _0x1eb27b(_0x3a735f[_0xbcad('0x11')][_0xbcad('0x13')]);}logger[_0xbcad('0x11')](_0xbcad('0x14'),_0x3d5f1c,_0x3a735f['error'][_0xbcad('0x13')]);return _0x372c08(_0x3a735f['error']['message']);}else{logger['info'](_0xbcad('0x14'),_0x3d5f1c,'request\x20sent');_0x372c08(_0x3a735f[_0xbcad('0x15')][_0xbcad('0x13')]);}})[_0xbcad('0x16')](function(_0x3fd220){logger[_0xbcad('0x11')](_0xbcad('0x14'),_0x3d5f1c,_0x3fd220);_0x1eb27b(_0x3fd220);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 68e7ffc..de34cfa 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 _0xb7fc=['index','describe','/:id','create','put','delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated'];(function(_0x401a04,_0x27cd04){var _0x469676=function(_0x39aea1){while(--_0x39aea1){_0x401a04['push'](_0x401a04['shift']());}};_0x469676(++_0x27cd04);}(_0xb7fc,0xb1));var _0xcb7f=function(_0x261c53,_0x497f83){_0x261c53=_0x261c53-0x0;var _0xa39042=_0xb7fc[_0x261c53];return _0xa39042;};'use strict';var multer=require(_0xcb7f('0x0'));var util=require(_0xcb7f('0x1'));var path=require(_0xcb7f('0x2'));var timeout=require(_0xcb7f('0x3'));var express=require(_0xcb7f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcb7f('0x5'));var config=require(_0xcb7f('0x6'));var controller=require(_0xcb7f('0x7'));router[_0xcb7f('0x8')]('/',auth[_0xcb7f('0x9')](),controller[_0xcb7f('0xa')]);router[_0xcb7f('0x8')]('/describe',auth[_0xcb7f('0x9')](),controller[_0xcb7f('0xb')]);router[_0xcb7f('0x8')](_0xcb7f('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xcb7f('0x9')](),controller[_0xcb7f('0xd')]);router[_0xcb7f('0xe')](_0xcb7f('0xc'),auth[_0xcb7f('0x9')](),controller['update']);router[_0xcb7f('0xf')](_0xcb7f('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xcb7f('0x10')]=router; \ No newline at end of file +var _0x9ebd=['/:id','post','create','update','delete','destroy','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ebd,0x1c9));var _0xd9eb=function(_0x4ab4d7,_0x1b7319){_0x4ab4d7=_0x4ab4d7-0x0;var _0x368c01=_0x9ebd[_0x4ab4d7];return _0x368c01;};'use strict';var multer=require(_0xd9eb('0x0'));var util=require(_0xd9eb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd9eb('0x2'));var auth=require(_0xd9eb('0x3'));var interaction=require(_0xd9eb('0x4'));var config=require('../../config/environment');var controller=require(_0xd9eb('0x5'));router[_0xd9eb('0x6')]('/',auth[_0xd9eb('0x7')](),controller[_0xd9eb('0x8')]);router['get'](_0xd9eb('0x9'),auth['isAuthenticated'](),controller[_0xd9eb('0xa')]);router[_0xd9eb('0x6')](_0xd9eb('0xb'),auth[_0xd9eb('0x7')](),controller['show']);router[_0xd9eb('0xc')]('/',auth[_0xd9eb('0x7')](),controller[_0xd9eb('0xd')]);router['put'](_0xd9eb('0xb'),auth[_0xd9eb('0x7')](),controller[_0xd9eb('0xe')]);router[_0xd9eb('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xd9eb('0x10')]);module[_0xd9eb('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 9771de7..11ba01f 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 _0x1aa1=['mouseOver','timeout','INTEGER','sequelize','STRING','ENUM'];(function(_0x49d743,_0x265b8d){var _0x4a0bf0=function(_0x2cd357){while(--_0x2cd357){_0x49d743['push'](_0x49d743['shift']());}};_0x4a0bf0(++_0x265b8d);}(_0x1aa1,0xb1));var _0x11aa=function(_0x58decf,_0x1048e9){_0x58decf=_0x58decf-0x0;var _0x3cb305=_0x1aa1[_0x58decf];return _0x3cb305;};'use strict';var Sequelize=require(_0x11aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x11aa('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x11aa('0x2')](_0x11aa('0x3'),_0x11aa('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x11aa('0x1')]},'timeout':{'type':Sequelize[_0x11aa('0x5')]}}; \ No newline at end of file +var _0x1498=['timeout','INTEGER','sequelize','exports','STRING','mouseOver'];(function(_0x318895,_0x1711e5){var _0x42676b=function(_0x5d83e4){while(--_0x5d83e4){_0x318895['push'](_0x318895['shift']());}};_0x42676b(++_0x1711e5);}(_0x1498,0x1d0));var _0x8149=function(_0x4e2969,_0x5bedba){_0x4e2969=_0x4e2969-0x0;var _0x4717fc=_0x1498[_0x4e2969];return _0x4717fc;};'use strict';var Sequelize=require(_0x8149('0x0'));module[_0x8149('0x1')]={'name':{'type':Sequelize[_0x8149('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8149('0x3'),_0x8149('0x4')),'defaultValue':_0x8149('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x8149('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 23b3faf..ba40c36 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 _0x5f2f=['fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','show','params','ChatProactiveAction','rawAttributes','query','keys','model','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','destroy','eml-format','rimraf','zip-dir'];(function(_0x7d8213,_0x468218){var _0x254f82=function(_0x12d8d1){while(--_0x12d8d1){_0x7d8213['push'](_0x7d8213['shift']());}};_0x254f82(++_0x468218);}(_0x5f2f,0x73));var _0xf5f2=function(_0x132a92,_0x5bbaab){_0x132a92=_0x132a92-0x0;var _0x41f81e=_0x5f2f[_0x132a92];return _0x41f81e;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={'raw':!![],'where':{'id':_0x5b6672[_0xf5f2('0x29')]['id']}},_0x14c829={};_0x14c829['model']=_['keys'](db[_0xf5f2('0x2a')][_0xf5f2('0x2b')]);_0x14c829[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](_0x5b6672[_0xf5f2('0x2c')]);_0x14c829['filters']=_['intersection'](_0x14c829[_0xf5f2('0x2e')],_0x14c829['query']);_0x22c826[_0xf5f2('0x2f')]=_['intersection'](_0x14c829[_0xf5f2('0x2e')],qs[_0xf5f2('0x30')](_0x5b6672[_0xf5f2('0x2c')][_0xf5f2('0x30')]));_0x22c826[_0xf5f2('0x2f')]=_0x22c826[_0xf5f2('0x2f')][_0xf5f2('0x31')]?_0x22c826[_0xf5f2('0x2f')]:_0x14c829['model'];if(_0x5b6672[_0xf5f2('0x2c')][_0xf5f2('0x32')]){_0x22c826[_0xf5f2('0x33')]=[{'all':!![]}];}_0x22c826=_[_0xf5f2('0x34')]({},_0x22c826,_0x5b6672[_0xf5f2('0x35')]);return db[_0xf5f2('0x2a')][_0xf5f2('0x36')](_0x22c826)['then'](handleEntityNotFound(_0x53cb96,null))[_0xf5f2('0x24')](respondWithResult(_0x53cb96,null))[_0xf5f2('0x37')](handleError(_0x53cb96,null));};exports['create']=function(_0x3fc168,_0x4b8c42){return db[_0xf5f2('0x2a')][_0xf5f2('0x38')](_0x3fc168[_0xf5f2('0x39')],{})[_0xf5f2('0x24')](respondWithResult(_0x4b8c42,0xc9))['catch'](handleError(_0x4b8c42,null));};exports['update']=function(_0x41088b,_0x46ad4a){if(_0x41088b[_0xf5f2('0x39')]['id']){delete _0x41088b['body']['id'];}return db[_0xf5f2('0x2a')]['find']({'where':{'id':_0x41088b[_0xf5f2('0x29')]['id']}})['then'](handleEntityNotFound(_0x46ad4a,null))[_0xf5f2('0x24')](saveUpdates(_0x41088b[_0xf5f2('0x39')],null))['then'](respondWithResult(_0x46ad4a,null))[_0xf5f2('0x37')](handleError(_0x46ad4a,null));};exports[_0xf5f2('0x3a')]=function(_0x5a4441,_0x35f738){return db['ChatProactiveAction']['find']({'where':{'id':_0x5a4441[_0xf5f2('0x29')]['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x35f738,null))[_0xf5f2('0x24')](removeEntity(_0x35f738,null))[_0xf5f2('0x37')](handleError(_0x35f738,null));}; \ No newline at end of file +var _0xb10b=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','show','params','model','keys','rawAttributes','filters','intersection','query','fields','attributes','length','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x9f18b5,_0x291e21){var _0x4ceeb7=function(_0x31d807){while(--_0x31d807){_0x9f18b5['push'](_0x9f18b5['shift']());}};_0x4ceeb7(++_0x291e21);}(_0xb10b,0x12a));var _0xbb10=function(_0x3072e2,_0x648a09){_0x3072e2=_0x3072e2-0x0;var _0x42c45b=_0xb10b[_0x3072e2];return _0x42c45b;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));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('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={'raw':!![],'where':{'id':_0x4aabb9[_0xbb10('0x2b')]['id']}},_0xfc3595={};_0xfc3595[_0xbb10('0x2c')]=_[_0xbb10('0x2d')](db['ChatProactiveAction'][_0xbb10('0x2e')]);_0xfc3595['query']=_[_0xbb10('0x2d')](_0x4aabb9['query']);_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x30')](_0xfc3595[_0xbb10('0x2c')],_0xfc3595['query']);_0x21ac54['attributes']=_[_0xbb10('0x30')](_0xfc3595[_0xbb10('0x2c')],qs['fields'](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x32')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x34')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2c')];if(_0x4aabb9['query'][_0xbb10('0x35')]){_0x21ac54[_0xbb10('0x36')]=[{'all':!![]}];}_0x21ac54=_[_0xbb10('0x37')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x38')]);return db[_0xbb10('0x39')][_0xbb10('0x3a')](_0x21ac54)[_0xbb10('0x23')](handleEntityNotFound(_0x3796c7,null))[_0xbb10('0x23')](respondWithResult(_0x3796c7,null))[_0xbb10('0x3b')](handleError(_0x3796c7,null));};exports['create']=function(_0x2b5352,_0x150107){return db[_0xbb10('0x39')][_0xbb10('0x3c')](_0x2b5352['body'],{})[_0xbb10('0x23')](respondWithResult(_0x150107,0xc9))['catch'](handleError(_0x150107,null));};exports['update']=function(_0x3eb3cc,_0x40c164){if(_0x3eb3cc[_0xbb10('0x3d')]['id']){delete _0x3eb3cc[_0xbb10('0x3d')]['id'];}return db[_0xbb10('0x39')][_0xbb10('0x3a')]({'where':{'id':_0x3eb3cc['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x40c164,null))[_0xbb10('0x23')](saveUpdates(_0x3eb3cc['body'],null))['then'](respondWithResult(_0x40c164,null))['catch'](handleError(_0x40c164,null));};exports[_0xbb10('0x24')]=function(_0x2b0b45,_0x2b658a){return db['ChatProactiveAction'][_0xbb10('0x3a')]({'where':{'id':_0x2b0b45[_0xbb10('0x2b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x2b658a,null))['then'](removeEntity(_0x2b658a,null))[_0xbb10('0x3b')](handleError(_0x2b658a,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 533f82c..7f2f985 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 _0x116c=['request-promise','path','rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment'];(function(_0x52dde7,_0x580f05){var _0x296593=function(_0x2b32bf){while(--_0x2b32bf){_0x52dde7['push'](_0x52dde7['shift']());}};_0x296593(++_0x580f05);}(_0x116c,0xec));var _0xc116=function(_0x621fb5,_0x5ae9b3){_0x621fb5=_0x621fb5-0x0;var _0x1a38a4=_0x116c[_0x621fb5];return _0x1a38a4;};'use strict';var _=require('lodash');var util=require(_0xc116('0x0'));var logger=require(_0xc116('0x1'))(_0xc116('0x2'));var moment=require(_0xc116('0x3'));var BPromise=require('bluebird');var rp=require(_0xc116('0x4'));var fs=require('fs');var path=require(_0xc116('0x5'));var rimraf=require(_0xc116('0x6'));var config=require(_0xc116('0x7'));var attributes=require('./chatProactiveAction.attributes');module[_0xc116('0x8')]=function(_0x4505d7,_0x94b0f3){return _0x4505d7[_0xc116('0x9')](_0xc116('0xa'),attributes,{'tableName':_0xc116('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd119=['rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','util','api','bluebird','request-promise','path'];(function(_0x2383c0,_0x28b6fb){var _0x40a109=function(_0x83ad9c){while(--_0x83ad9c){_0x2383c0['push'](_0x2383c0['shift']());}};_0x40a109(++_0x28b6fb);}(_0xd119,0x192));var _0x9d11=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xd119[_0x1762b4];return _0x29beda;};'use strict';var _=require('lodash');var util=require(_0x9d11('0x0'));var logger=require('../../config/logger')(_0x9d11('0x1'));var moment=require('moment');var BPromise=require(_0x9d11('0x2'));var rp=require(_0x9d11('0x3'));var fs=require('fs');var path=require(_0x9d11('0x4'));var rimraf=require(_0x9d11('0x5'));var config=require(_0x9d11('0x6'));var attributes=require(_0x9d11('0x7'));module[_0x9d11('0x8')]=function(_0x55408c,_0x5a4cad){return _0x55408c[_0x9d11('0x9')](_0x9d11('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 2ab6188..5f65dcb 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 _0xd9f5=['stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s'];(function(_0x46ce3f,_0x5994ed){var _0x31cbfc=function(_0x3be684){while(--_0x3be684){_0x46ce3f['push'](_0x46ce3f['shift']());}};_0x31cbfc(++_0x5994ed);}(_0xd9f5,0x91));var _0x5d9f=function(_0x4c1eec,_0x515aa1){_0x4c1eec=_0x4c1eec-0x0;var _0x5d8475=_0xd9f5[_0x4c1eec];return _0x5d8475;};'use strict';var _=require(_0x5d9f('0x0'));var util=require(_0x5d9f('0x1'));var moment=require(_0x5d9f('0x2'));var BPromise=require(_0x5d9f('0x3'));var rs=require(_0x5d9f('0x4'));var fs=require('fs');var Redis=require(_0x5d9f('0x5'));var db=require(_0x5d9f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5d9f('0x7'));var jayson=require(_0x5d9f('0x8'));var client=jayson[_0x5d9f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22e825,_0x2d21f5,_0x35cb61){return new BPromise(function(_0x3adc9f,_0x4ed9f5){return client[_0x5d9f('0xa')](_0x22e825,_0x35cb61)[_0x5d9f('0xb')](function(_0x3c1e46){logger[_0x5d9f('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x2d21f5,_0x5d9f('0xd'));logger[_0x5d9f('0xe')](_0x5d9f('0xf'),_0x2d21f5,_0x5d9f('0xd'),JSON[_0x5d9f('0x10')](_0x3c1e46));if(_0x3c1e46[_0x5d9f('0x11')]){if(_0x3c1e46[_0x5d9f('0x11')][_0x5d9f('0x12')]===0x1f4){logger['error'](_0x5d9f('0x13'),_0x2d21f5,_0x3c1e46[_0x5d9f('0x11')][_0x5d9f('0x14')]);return _0x4ed9f5(_0x3c1e46[_0x5d9f('0x11')][_0x5d9f('0x14')]);}logger[_0x5d9f('0x11')](_0x5d9f('0x13'),_0x2d21f5,_0x3c1e46['error'][_0x5d9f('0x14')]);return _0x3adc9f(_0x3c1e46['error'][_0x5d9f('0x14')]);}else{logger[_0x5d9f('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x2d21f5,'request\x20sent');_0x3adc9f(_0x3c1e46[_0x5d9f('0x15')]['message']);}})[_0x5d9f('0x16')](function(_0x58d212){logger[_0x5d9f('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x2d21f5,_0x58d212);_0x4ed9f5(_0x58d212);});});} \ No newline at end of file +var _0x8ffc=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','ChatProactiveAction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info'];(function(_0x5a3313,_0x434d58){var _0x8b4747=function(_0x1ee998){while(--_0x1ee998){_0x5a3313['push'](_0x5a3313['shift']());}};_0x8b4747(++_0x434d58);}(_0x8ffc,0x19f));var _0xc8ff=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x8ffc[_0x164eca];return _0x2ce562;};'use strict';var _=require('lodash');var util=require(_0xc8ff('0x0'));var moment=require(_0xc8ff('0x1'));var BPromise=require(_0xc8ff('0x2'));var rs=require(_0xc8ff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8ff('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc8ff('0x5'))(_0xc8ff('0x6'));var config=require(_0xc8ff('0x7'));var jayson=require(_0xc8ff('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51d073,_0x13bf05,_0x72fc2f){return new BPromise(function(_0xa506bb,_0x156562){return client[_0xc8ff('0x9')](_0x51d073,_0x72fc2f)['then'](function(_0x5eaa11){logger['info'](_0xc8ff('0xa'),_0x13bf05,'request\x20sent');logger[_0xc8ff('0xb')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x13bf05,_0xc8ff('0xc'),JSON[_0xc8ff('0xd')](_0x5eaa11));if(_0x5eaa11[_0xc8ff('0xe')]){if(_0x5eaa11['error']['code']===0x1f4){logger[_0xc8ff('0xe')](_0xc8ff('0xa'),_0x13bf05,_0x5eaa11[_0xc8ff('0xe')][_0xc8ff('0xf')]);return _0x156562(_0x5eaa11[_0xc8ff('0xe')][_0xc8ff('0xf')]);}logger[_0xc8ff('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x13bf05,_0x5eaa11['error'][_0xc8ff('0xf')]);return _0xa506bb(_0x5eaa11['error']['message']);}else{logger[_0xc8ff('0x10')](_0xc8ff('0xa'),_0x13bf05,_0xc8ff('0xc'));_0xa506bb(_0x5eaa11['result'][_0xc8ff('0xf')]);}})[_0xc8ff('0x11')](function(_0x35622c){logger[_0xc8ff('0xe')](_0xc8ff('0xa'),_0x13bf05,_0x35622c);_0x156562(_0x35622c);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 8eb9bfd..041b37a 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 _0x05f1=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x05f1,0x1ac));var _0x105f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x05f1[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x105f('0x0'));var util=require(_0x105f('0x1'));var path=require(_0x105f('0x2'));var timeout=require(_0x105f('0x3'));var express=require('express');var router=express[_0x105f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x105f('0x5'));var interaction=require(_0x105f('0x6'));var config=require(_0x105f('0x7'));var controller=require(_0x105f('0x8'));router[_0x105f('0x9')](_0x105f('0xa'),auth[_0x105f('0xb')](),controller['show']);router[_0x105f('0xc')]('/',auth['isAuthenticated'](),controller[_0x105f('0xd')]);router[_0x105f('0xe')](_0x105f('0xa'),auth[_0x105f('0xb')](),controller['update']);router[_0x105f('0xf')](_0x105f('0xa'),auth['isAuthenticated'](),controller[_0x105f('0x10')]);module[_0x105f('0x11')]=router; \ No newline at end of file +var _0x2c20=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy'];(function(_0x3b35be,_0x539aa3){var _0x4721e1=function(_0x1a55ca){while(--_0x1a55ca){_0x3b35be['push'](_0x3b35be['shift']());}};_0x4721e1(++_0x539aa3);}(_0x2c20,0x70));var _0x02c2=function(_0x383d00,_0x4b4a54){_0x383d00=_0x383d00-0x0;var _0x290afc=_0x2c20[_0x383d00];return _0x290afc;};'use strict';var multer=require('multer');var util=require(_0x02c2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x02c2('0x1'));var router=express[_0x02c2('0x2')]();var fs_extra=require(_0x02c2('0x3'));var auth=require(_0x02c2('0x4'));var interaction=require(_0x02c2('0x5'));var config=require(_0x02c2('0x6'));var controller=require(_0x02c2('0x7'));router[_0x02c2('0x8')](_0x02c2('0x9'),auth[_0x02c2('0xa')](),controller[_0x02c2('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x02c2('0xc')](_0x02c2('0x9'),auth[_0x02c2('0xa')](),controller[_0x02c2('0xd')]);router[_0x02c2('0xe')](_0x02c2('0x9'),auth[_0x02c2('0xa')](),controller[_0x02c2('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 7158daf..5b15af2 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 _0x8cd6=['roundrobin','exports','STRING','name','ENUM','rrmemory','beepall'];(function(_0x2cc4cd,_0x4c8378){var _0x493e7e=function(_0x1c00c2){while(--_0x1c00c2){_0x2cc4cd['push'](_0x2cc4cd['shift']());}};_0x493e7e(++_0x4c8378);}(_0x8cd6,0xe1));var _0x68cd=function(_0x3c45b4,_0x1941cf){_0x3c45b4=_0x3c45b4-0x0;var _0x73361f=_0x8cd6[_0x3c45b4];return _0x73361f;};'use strict';var Sequelize=require('sequelize');module[_0x68cd('0x0')]={'name':{'type':Sequelize[_0x68cd('0x1')],'unique':_0x68cd('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x68cd('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x68cd('0x3')](_0x68cd('0x4'),_0x68cd('0x5'),_0x68cd('0x6'))}}; \ No newline at end of file +var _0x3a2b=['name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x5575cd,_0x73ab7a){var _0x4979a0=function(_0x1ac744){while(--_0x1ac744){_0x5575cd['push'](_0x5575cd['shift']());}};_0x4979a0(++_0x73ab7a);}(_0x3a2b,0xbd));var _0xb3a2=function(_0x211f59,_0x207567){_0x211f59=_0x211f59-0x0;var _0x2e56a1=_0x3a2b[_0x211f59];return _0x2e56a1;};'use strict';var Sequelize=require(_0xb3a2('0x0'));module[_0xb3a2('0x1')]={'name':{'type':Sequelize[_0xb3a2('0x2')],'unique':_0xb3a2('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb3a2('0x2')]},'timeout':{'type':Sequelize[_0xb3a2('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb3a2('0x5')](_0xb3a2('0x6'),_0xb3a2('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 392776f..8da7306 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 _0xf132=['ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','compact','value','isEmpty','addAgents','omit','removeAgents','isArray','userChatQueue:remove','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatQueue.socket','register','jayson/promise','client','http','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','count','limit','apply','reject','update','destroy','get','ChatQueues','UserProfileResource','stack','send','index','ChatQueue','rawAttributes','fieldName','key','model','map','query','keys','filters','fields','attributes','length','order','sort','where','pick','merge','type','VIRTUAL','name','filter','options','includeAll','include','rows','intersection','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','nolimit','ChatQueueId','findAll','User','findAndCountAll','UserId','agent','updatedAt','format','%s/%s','SIP','chatPause','createdAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userChatQueue:save','removeTeams','select','tq.TeamId','from','team_has_chat_queues','join','user_has_teams'];(function(_0x22f164,_0xaa4f80){var _0x51ab95=function(_0x190b68){while(--_0x190b68){_0x22f164['push'](_0x22f164['shift']());}};_0x51ab95(++_0xaa4f80);}(_0xf132,0xaa));var _0x2f13=function(_0x1adee8,_0x43cdb0){_0x1adee8=_0x1adee8-0x0;var _0x3867ce=_0xf132[_0x1adee8];return _0x3867ce;};'use strict';var emlformat=require(_0x2f13('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2f13('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2f13('0x2'));var moment=require(_0x2f13('0x3'));var BPromise=require(_0x2f13('0x4'));var Mustache=require(_0x2f13('0x5'));var util=require(_0x2f13('0x6'));var path=require('path');var sox=require(_0x2f13('0x7'));var csv=require(_0x2f13('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f13('0x9'));var squel=require(_0x2f13('0xa'));var crypto=require(_0x2f13('0xb'));var jsforce=require(_0x2f13('0xc'));var deskjs=require(_0x2f13('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2f13('0xe'));var Papa=require(_0x2f13('0xf'));var Redis=require(_0x2f13('0x10'));var authService=require(_0x2f13('0x11'));var qs=require(_0x2f13('0x12'));var as=require(_0x2f13('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f13('0x14'))(_0x2f13('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2f13('0x16'));var db=require(_0x2f13('0x17'))['db'];config['redis']=_[_0x2f13('0x18')](config[_0x2f13('0x19')],{'host':_0x2f13('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2f13('0x19')]));require(_0x2f13('0x1b'))[_0x2f13('0x1c')](socket);var jayson=require(_0x2f13('0x1d'));var client=jayson[_0x2f13('0x1e')][_0x2f13('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4e8cc9,_0x5856d9,_0x5c79fe,_0x4ce025){return new BPromise(function(_0x372e46,_0x17f753){var _0x34f5ce=_0x4ce025||client;return _0x34f5ce[_0x2f13('0x20')](_0x4e8cc9,_0x5c79fe)[_0x2f13('0x21')](function(_0x347513){logger['info'](_0x2f13('0x22'),_0x5856d9,_0x2f13('0x23'));logger['debug'](_0x2f13('0x24'),_0x5856d9,_0x2f13('0x23'),JSON['stringify'](_0x347513));if(_0x347513[_0x2f13('0x25')]){if(_0x347513[_0x2f13('0x25')][_0x2f13('0x26')]===0x1f4){logger[_0x2f13('0x25')]('ChatQueue,\x20%s,\x20%s',_0x5856d9,_0x347513[_0x2f13('0x25')][_0x2f13('0x27')]);return _0x17f753(_0x347513[_0x2f13('0x25')]['message']);}logger[_0x2f13('0x25')](_0x2f13('0x22'),_0x5856d9,_0x347513[_0x2f13('0x25')][_0x2f13('0x27')]);return _0x372e46(_0x347513[_0x2f13('0x25')][_0x2f13('0x27')]);}else{logger[_0x2f13('0x28')]('ChatQueue,\x20%s,\x20%s',_0x5856d9,_0x2f13('0x23'));_0x372e46(_0x347513[_0x2f13('0x29')][_0x2f13('0x27')]);}})[_0x2f13('0x2a')](function(_0x72e793){logger[_0x2f13('0x25')](_0x2f13('0x22'),_0x5856d9,_0x72e793);_0x17f753(_0x72e793);});});}function respondWithStatusCode(_0x16b212,_0x3a712b){_0x3a712b=_0x3a712b||0xcc;return function(_0x3e696c){if(_0x3e696c){return _0x16b212[_0x2f13('0x2b')](_0x3a712b);}return _0x16b212['status'](_0x3a712b)['end']();};}function respondWithResult(_0x582bf8,_0x107314){_0x107314=_0x107314||0xc8;return function(_0x27bdc3){if(_0x27bdc3){return _0x582bf8[_0x2f13('0x2c')](_0x107314)[_0x2f13('0x2d')](_0x27bdc3);}};}function respondWithFilteredResult(_0x32ca5e,_0x5d5c6d){return function(_0x5e37d2){if(_0x5e37d2){var _0x1c75b8=typeof _0x5d5c6d[_0x2f13('0x2e')]==='undefined'&&typeof _0x5d5c6d['limit']===_0x2f13('0x2f');var _0x575ff4=_0x5e37d2[_0x2f13('0x30')];var _0x1a518b=_0x1c75b8?0x0:_0x5d5c6d[_0x2f13('0x2e')];var _0x399e3d=_0x1c75b8?_0x5e37d2[_0x2f13('0x30')]:_0x5d5c6d[_0x2f13('0x2e')]+_0x5d5c6d[_0x2f13('0x31')];var _0x4d1d1d;if(_0x399e3d>=_0x575ff4){_0x399e3d=_0x575ff4;_0x4d1d1d=0xc8;}else{_0x4d1d1d=0xce;}_0x32ca5e[_0x2f13('0x2c')](_0x4d1d1d);return _0x32ca5e['set']('Content-Range',_0x1a518b+'-'+_0x399e3d+'/'+_0x575ff4)[_0x2f13('0x2d')](_0x5e37d2);}return null;};}function patchUpdates(_0x2911b3){return function(_0x4cfcb6){try{jsonpatch[_0x2f13('0x32')](_0x4cfcb6,_0x2911b3,!![]);}catch(_0x1ab5e6){return BPromise[_0x2f13('0x33')](_0x1ab5e6);}return _0x4cfcb6['save']();};}function saveUpdates(_0xcf71ce,_0x3a1644){return function(_0x5f5346){if(_0x5f5346){return _0x5f5346[_0x2f13('0x34')](_0xcf71ce)['then'](function(_0x556d47){return _0x556d47;});}return null;};}function removeEntity(_0x1de9fd,_0xa68bd9){return function(_0x452dfc){if(_0x452dfc){return _0x452dfc[_0x2f13('0x35')]()['then'](function(){var _0xd11004=_0x452dfc[_0x2f13('0x36')]({'plain':!![]});var _0x1bfb29=_0x2f13('0x37');return db[_0x2f13('0x38')][_0x2f13('0x35')]({'where':{'type':_0x1bfb29,'resourceId':_0xd11004['id']}})[_0x2f13('0x21')](function(){return _0x452dfc;});})['then'](function(){_0x1de9fd[_0x2f13('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25a7cf,_0x200bee){return function(_0x324ef0){if(!_0x324ef0){_0x25a7cf[_0x2f13('0x2b')](0x194);}return _0x324ef0;};}function handleError(_0x8cf282,_0x5a9afd){_0x5a9afd=_0x5a9afd||0x1f4;return function(_0x8a62a0){logger[_0x2f13('0x25')](_0x8a62a0[_0x2f13('0x39')]);if(_0x8a62a0['name']){delete _0x8a62a0['name'];}_0x8cf282[_0x2f13('0x2c')](_0x5a9afd)[_0x2f13('0x3a')](_0x8a62a0);};}exports[_0x2f13('0x3b')]=function(_0x4ae9e4,_0x360256){var _0x55fcf6={},_0x307f80={},_0x12e0ab={'count':0x0,'rows':[]};var _0x2e15ef=_['map'](db[_0x2f13('0x3c')][_0x2f13('0x3d')],function(_0x5c5689){return{'name':_0x5c5689[_0x2f13('0x3e')],'type':_0x5c5689['type'][_0x2f13('0x3f')]};});_0x307f80[_0x2f13('0x40')]=_[_0x2f13('0x41')](_0x2e15ef,'name');_0x307f80[_0x2f13('0x42')]=_[_0x2f13('0x43')](_0x4ae9e4[_0x2f13('0x42')]);_0x307f80[_0x2f13('0x44')]=_['intersection'](_0x307f80[_0x2f13('0x40')],_0x307f80[_0x2f13('0x42')]);_0x55fcf6['attributes']=_['intersection'](_0x307f80['model'],qs['fields'](_0x4ae9e4[_0x2f13('0x42')][_0x2f13('0x45')]));_0x55fcf6['attributes']=_0x55fcf6[_0x2f13('0x46')][_0x2f13('0x47')]?_0x55fcf6['attributes']:_0x307f80['model'];if(!_0x4ae9e4[_0x2f13('0x42')]['hasOwnProperty']('nolimit')){_0x55fcf6[_0x2f13('0x31')]=qs[_0x2f13('0x31')](_0x4ae9e4[_0x2f13('0x42')][_0x2f13('0x31')]);_0x55fcf6[_0x2f13('0x2e')]=qs[_0x2f13('0x2e')](_0x4ae9e4[_0x2f13('0x42')][_0x2f13('0x2e')]);}_0x55fcf6[_0x2f13('0x48')]=qs[_0x2f13('0x49')](_0x4ae9e4[_0x2f13('0x42')][_0x2f13('0x49')]);_0x55fcf6[_0x2f13('0x4a')]=qs[_0x2f13('0x44')](_[_0x2f13('0x4b')](_0x4ae9e4[_0x2f13('0x42')],_0x307f80[_0x2f13('0x44')]),_0x2e15ef);if(_0x4ae9e4[_0x2f13('0x42')]['filter']){_0x55fcf6[_0x2f13('0x4a')]=_[_0x2f13('0x4c')](_0x55fcf6[_0x2f13('0x4a')],{'$or':_[_0x2f13('0x41')](_0x2e15ef,function(_0x426298){if(_0x426298[_0x2f13('0x4d')]!==_0x2f13('0x4e')){var _0x1f21a8={};_0x1f21a8[_0x426298[_0x2f13('0x4f')]]={'$like':'%'+_0x4ae9e4['query'][_0x2f13('0x50')]+'%'};return _0x1f21a8;}})});}_0x55fcf6=_['merge']({},_0x55fcf6,_0x4ae9e4[_0x2f13('0x51')]);var _0x21db6b={'where':_0x55fcf6[_0x2f13('0x4a')]};return db[_0x2f13('0x3c')]['count'](_0x21db6b)[_0x2f13('0x21')](function(_0x4d798e){_0x12e0ab['count']=_0x4d798e;if(_0x4ae9e4[_0x2f13('0x42')][_0x2f13('0x52')]){_0x55fcf6[_0x2f13('0x53')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x55fcf6);})[_0x2f13('0x21')](function(_0x183eb6){_0x12e0ab[_0x2f13('0x54')]=_0x183eb6;return _0x12e0ab;})[_0x2f13('0x21')](respondWithFilteredResult(_0x360256,_0x55fcf6))[_0x2f13('0x2a')](handleError(_0x360256,null));};exports['show']=function(_0x33c7cb,_0x5d04bc){var _0x5ce02e={'raw':!![],'where':{'id':_0x33c7cb['params']['id']}},_0x5183ed={};_0x5183ed[_0x2f13('0x40')]=_[_0x2f13('0x43')](db[_0x2f13('0x3c')][_0x2f13('0x3d')]);_0x5183ed[_0x2f13('0x42')]=_[_0x2f13('0x43')](_0x33c7cb['query']);_0x5183ed[_0x2f13('0x44')]=_[_0x2f13('0x55')](_0x5183ed[_0x2f13('0x40')],_0x5183ed['query']);_0x5ce02e['attributes']=_[_0x2f13('0x55')](_0x5183ed[_0x2f13('0x40')],qs[_0x2f13('0x45')](_0x33c7cb['query'][_0x2f13('0x45')]));_0x5ce02e[_0x2f13('0x46')]=_0x5ce02e['attributes']['length']?_0x5ce02e['attributes']:_0x5183ed[_0x2f13('0x40')];if(_0x33c7cb['query'][_0x2f13('0x52')]){_0x5ce02e[_0x2f13('0x53')]=[{'all':!![]}];}_0x5ce02e=_[_0x2f13('0x4c')]({},_0x5ce02e,_0x33c7cb[_0x2f13('0x51')]);return db[_0x2f13('0x3c')]['find'](_0x5ce02e)[_0x2f13('0x21')](handleEntityNotFound(_0x5d04bc,null))['then'](respondWithResult(_0x5d04bc,null))[_0x2f13('0x2a')](handleError(_0x5d04bc,null));};exports['create']=function(_0x2e7f12,_0xa1799d){return db[_0x2f13('0x3c')]['create'](_0x2e7f12['body'],{})['then'](function(_0x345c47){var _0x3cd0be=_0x2e7f12[_0x2f13('0x56')][_0x2f13('0x36')]({'plain':!![]});if(!_0x3cd0be)throw new Error(_0x2f13('0x57'));if(_0x3cd0be[_0x2f13('0x58')]===_0x2f13('0x56')){var _0x3bf09c=_0x345c47['get']({'plain':!![]});var _0x3b9d26=_0x2f13('0x37');return db[_0x2f13('0x59')][_0x2f13('0x5a')]({'where':{'name':_0x3b9d26,'userProfileId':_0x3cd0be[_0x2f13('0x5b')]},'raw':!![]})['then'](function(_0x276c09){if(_0x276c09&&_0x276c09['autoAssociation']===0x0){return db[_0x2f13('0x38')][_0x2f13('0x5c')]({'name':_0x3bf09c['name'],'resourceId':_0x3bf09c['id'],'type':_0x276c09['name'],'sectionId':_0x276c09['id']},{})[_0x2f13('0x21')](function(){return _0x345c47;});}else{return _0x345c47;}})[_0x2f13('0x2a')](function(_0x4a948d){logger[_0x2f13('0x25')](_0x2f13('0x5d'),_0x4a948d);throw _0x4a948d;});}return _0x345c47;})[_0x2f13('0x21')](respondWithResult(_0xa1799d,0xc9))[_0x2f13('0x2a')](handleError(_0xa1799d,null));};exports['update']=function(_0x537b60,_0x3e996d){if(_0x537b60[_0x2f13('0x5e')]['id']){delete _0x537b60['body']['id'];}return db['ChatQueue']['find']({'where':{'id':_0x537b60[_0x2f13('0x5f')]['id']}})[_0x2f13('0x21')](handleEntityNotFound(_0x3e996d,null))[_0x2f13('0x21')](saveUpdates(_0x537b60[_0x2f13('0x5e')],null))[_0x2f13('0x21')](respondWithResult(_0x3e996d,null))[_0x2f13('0x2a')](handleError(_0x3e996d,null));};exports[_0x2f13('0x35')]=function(_0x43e203,_0x406d32){return db[_0x2f13('0x3c')][_0x2f13('0x5a')]({'where':{'id':_0x43e203[_0x2f13('0x5f')]['id']}})[_0x2f13('0x21')](handleEntityNotFound(_0x406d32,null))['then'](removeEntity(_0x406d32,null))['catch'](handleError(_0x406d32,null));};exports[_0x2f13('0x60')]=function(_0x2d18b6,_0x3417a1){return db['ChatQueue'][_0x2f13('0x60')]()[_0x2f13('0x21')](respondWithResult(_0x3417a1,null))[_0x2f13('0x2a')](handleError(_0x3417a1,null));};exports[_0x2f13('0x61')]=function(_0x3cad6b,_0x1fb263,_0x5358cb){var _0x5b9ada={'raw':!![],'where':{}},_0x3631c6={},_0x43ed46;return db['ChatQueue'][_0x2f13('0x62')]({'where':{'id':_0x3cad6b[_0x2f13('0x5f')]['id']}})[_0x2f13('0x21')](handleEntityNotFound(_0x1fb263,null))[_0x2f13('0x21')](function(_0x277184){if(_0x277184){_0x43ed46=_0x277184[_0x2f13('0x36')]({'plain':!![]});_0x3631c6[_0x2f13('0x40')]=_[_0x2f13('0x43')](db[_0x2f13('0x63')][_0x2f13('0x3d')]);_0x3631c6[_0x2f13('0x42')]=_[_0x2f13('0x43')](_0x3cad6b[_0x2f13('0x42')]);_0x3631c6[_0x2f13('0x44')]=_[_0x2f13('0x55')](_0x3631c6[_0x2f13('0x40')],_0x3631c6[_0x2f13('0x42')]);_0x5b9ada[_0x2f13('0x46')]=_[_0x2f13('0x55')](_0x3631c6[_0x2f13('0x40')],qs[_0x2f13('0x45')](_0x3cad6b['query'][_0x2f13('0x45')]));_0x5b9ada['attributes']=_0x5b9ada[_0x2f13('0x46')][_0x2f13('0x47')]?_0x5b9ada[_0x2f13('0x46')]:_0x3631c6[_0x2f13('0x40')];if(!_0x3cad6b[_0x2f13('0x42')][_0x2f13('0x64')](_0x2f13('0x65'))){_0x5b9ada[_0x2f13('0x31')]=qs[_0x2f13('0x31')](_0x3cad6b['query'][_0x2f13('0x31')]);_0x5b9ada['offset']=qs[_0x2f13('0x2e')](_0x3cad6b[_0x2f13('0x42')]['offset']);}_0x5b9ada['order']=qs[_0x2f13('0x49')](_0x3cad6b[_0x2f13('0x42')][_0x2f13('0x49')]);_0x5b9ada[_0x2f13('0x4a')]=qs['filters'](_['pick'](_0x3cad6b[_0x2f13('0x42')],_0x3631c6['filters']));_0x5b9ada['where'][_0x2f13('0x66')]=_0x277184['id'];if(_0x3cad6b[_0x2f13('0x42')][_0x2f13('0x50')]){_0x5b9ada[_0x2f13('0x4a')]=_[_0x2f13('0x4c')](_0x5b9ada[_0x2f13('0x4a')],{'$or':_[_0x2f13('0x41')](_0x5b9ada['attributes'],function(_0x10f847){var _0x2b04b4={};_0x2b04b4[_0x10f847]={'$like':'%'+_0x3cad6b['query'][_0x2f13('0x50')]+'%'};return _0x2b04b4;})});}_0x5b9ada=_['merge']({},_0x5b9ada,_0x3cad6b[_0x2f13('0x51')]);return db[_0x2f13('0x63')][_0x2f13('0x67')](_0x5b9ada);}})['then'](function(_0x1cabf1){if(_0x1cabf1){return db[_0x2f13('0x68')][_0x2f13('0x69')]({'where':{'id':_[_0x2f13('0x41')](_0x1cabf1,_0x2f13('0x6a')),'role':_0x2f13('0x6b')},'attributes':['id',_0x2f13('0x4f'),'chatPause',_0x2f13('0x6c'),'createdAt']});}})[_0x2f13('0x21')](function(_0x45b7c6){if(_0x45b7c6){return{'count':_0x45b7c6[_0x2f13('0x30')],'rows':_[_0x2f13('0x41')](_0x45b7c6[_0x2f13('0x54')],function(_0x2c2298){return{'membername':_0x2c2298[_0x2f13('0x4f')],'UserId':_0x2c2298['id'],'queue_name':_0x43ed46[_0x2f13('0x4f')],'ChatQueueId':_0x43ed46['id'],'interface':util[_0x2f13('0x6d')](_0x2f13('0x6e'),_0x2f13('0x6f'),_0x2c2298[_0x2f13('0x4f')]),'penalty':0x0,'paused':_0x2c2298[_0x2f13('0x70')],'createdAt':_0x2c2298[_0x2f13('0x71')],'updatedAt':_0x2c2298[_0x2f13('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1fb263,_0x5b9ada))['catch'](handleError(_0x1fb263,null));};exports[_0x2f13('0x72')]=function(_0x1081d1,_0x1ebc27,_0x4f5924){var _0x2a2874={};var _0x12e64b={};var _0x2b824d;var _0x4d7819;return db[_0x2f13('0x3c')][_0x2f13('0x62')]({'where':{'id':_0x1081d1['params']['id']}})[_0x2f13('0x21')](handleEntityNotFound(_0x1ebc27,null))[_0x2f13('0x21')](function(_0x506c03){if(_0x506c03){_0x2b824d=_0x506c03;_0x12e64b['model']=_[_0x2f13('0x43')](db[_0x2f13('0x73')]['rawAttributes']);_0x12e64b[_0x2f13('0x42')]=_[_0x2f13('0x43')](_0x1081d1[_0x2f13('0x42')]);_0x12e64b[_0x2f13('0x44')]=_[_0x2f13('0x55')](_0x12e64b[_0x2f13('0x40')],_0x12e64b[_0x2f13('0x42')]);_0x2a2874['attributes']=_[_0x2f13('0x55')](_0x12e64b[_0x2f13('0x40')],qs[_0x2f13('0x45')](_0x1081d1[_0x2f13('0x42')][_0x2f13('0x45')]));_0x2a2874[_0x2f13('0x46')]=_0x2a2874['attributes'][_0x2f13('0x47')]?_0x2a2874[_0x2f13('0x46')]:_0x12e64b[_0x2f13('0x40')];_0x2a2874[_0x2f13('0x48')]=qs[_0x2f13('0x49')](_0x1081d1['query'][_0x2f13('0x49')]);_0x2a2874[_0x2f13('0x4a')]=qs[_0x2f13('0x44')](_['pick'](_0x1081d1[_0x2f13('0x42')],_0x12e64b['filters']));if(_0x1081d1[_0x2f13('0x42')][_0x2f13('0x50')]){_0x2a2874[_0x2f13('0x4a')]=_[_0x2f13('0x4c')](_0x2a2874[_0x2f13('0x4a')],{'$or':_['map'](_0x2a2874[_0x2f13('0x46')],function(_0x314754){var _0x5edfbd={};_0x5edfbd[_0x314754]={'$like':'%'+_0x1081d1[_0x2f13('0x42')][_0x2f13('0x50')]+'%'};return _0x5edfbd;})});}_0x2a2874=_[_0x2f13('0x4c')]({},_0x2a2874,_0x1081d1[_0x2f13('0x51')]);return _0x2b824d[_0x2f13('0x72')](_0x2a2874);}})[_0x2f13('0x21')](function(_0x5b164d){if(_0x5b164d){_0x4d7819=_0x5b164d[_0x2f13('0x47')];if(!_0x1081d1[_0x2f13('0x42')][_0x2f13('0x64')](_0x2f13('0x65'))){_0x2a2874[_0x2f13('0x31')]=qs[_0x2f13('0x31')](_0x1081d1[_0x2f13('0x42')]['limit']);_0x2a2874[_0x2f13('0x2e')]=qs[_0x2f13('0x2e')](_0x1081d1[_0x2f13('0x42')]['offset']);}return _0x2b824d['getTeams'](_0x2a2874);}})[_0x2f13('0x21')](function(_0x3e4ef1){if(_0x3e4ef1){return _0x3e4ef1?{'count':_0x4d7819,'rows':_0x3e4ef1}:null;}})[_0x2f13('0x21')](respondWithResult(_0x1ebc27,null))[_0x2f13('0x2a')](handleError(_0x1ebc27,null));};exports[_0x2f13('0x74')]=function(_0x316afc,_0x1cd1c8,_0x18aa4d){var _0x6a00a9=_0x316afc['body'][_0x2f13('0x75')];return db[_0x2f13('0x73')][_0x2f13('0x67')]({'where':{'id':_0x6a00a9},'attributes':['id'],'include':[{'model':db[_0x2f13('0x68')],'as':_0x2f13('0x76'),'attributes':['id',_0x2f13('0x4f'),_0x2f13('0x77'),_0x2f13('0x78'),_0x2f13('0x79')],'raw':!![]}]})[_0x2f13('0x21')](function(_0x5c55b){if(_0x5c55b){var _0x135104=_[_0x2f13('0x7a')](_0x5c55b,function(_0x108044){var _0x5407a8=_0x108044[_0x2f13('0x36')]({'plain':!![]});return _0x5407a8[_0x2f13('0x76')];});return db[_0x2f13('0x3c')]['find']({'where':{'id':_0x316afc['params']['id']}})[_0x2f13('0x21')](function(_0x316d2a){return db[_0x2f13('0x7b')][_0x2f13('0x7c')](function(_0x41213e){return _0x316d2a[_0x2f13('0x74')](_0x6a00a9,{'transaction':_0x41213e})[_0x2f13('0x21')](function(){return BPromise[_0x2f13('0x7d')](_0x135104,function(_0x4a6ccb){return db[_0x2f13('0x63')]['findOrCreate']({'where':{'UserId':_0x4a6ccb['id'],'ChatQueueId':_0x316afc[_0x2f13('0x5f')]['id']},'transaction':_0x41213e});});})['then'](function(){_0x135104[_0x2f13('0x7e')](function(_0x470755){socket[_0x2f13('0x7f')](_0x2f13('0x80'),{'UserId':_0x470755['id'],'ChatQueueId':_0x316d2a['id']});});});});});}})[_0x2f13('0x21')](respondWithStatusCode(_0x1cd1c8,null))[_0x2f13('0x2a')](handleError(_0x1cd1c8,null));};exports[_0x2f13('0x81')]=function(_0x5cecce,_0x6c8768,_0x5419b4){return db['Team'][_0x2f13('0x67')]({'where':{'id':_0x5cecce['query'][_0x2f13('0x75')]},'attributes':['id'],'include':[{'model':db[_0x2f13('0x68')],'as':_0x2f13('0x76'),'attributes':['id'],'raw':!![]}]})[_0x2f13('0x21')](handleEntityNotFound(_0x6c8768,null))['then'](function(_0x5348fd){var _0x3a2609=_[_0x2f13('0x41')](_0x5348fd,'id');var _0x1c14bf=[];var _0x5eff82=[];var _0x63e531=squel[_0x2f13('0x82')]();_0x63e531['field'](_0x2f13('0x83'))[_0x2f13('0x84')](_0x2f13('0x85'),'tq')[_0x2f13('0x86')](_0x2f13('0x87'),'ut',_0x2f13('0x88'))[_0x2f13('0x4a')]('ChatQueueId\x20=\x20?',_0x5cecce[_0x2f13('0x5f')]['id']);for(var _0x1d1a45=0x0;_0x1d1a45<_0x5348fd[_0x2f13('0x47')];_0x1d1a45+=0x1){let _0x2b5512=_0x5348fd[_0x1d1a45];for(var _0x4a2628=0x0;_0x4a2628<_0x2b5512['Agents'][_0x2f13('0x47')];_0x4a2628+=0x1){let _0x38a7ca=_0x2b5512[_0x2f13('0x76')][_0x4a2628];var _0x328b7d=_0x63e531[_0x2f13('0x89')]();_0x328b7d[_0x2f13('0x4a')](_0x2f13('0x8a'),_0x38a7ca['id']);_0x5eff82[_0x2f13('0x8b')](db['sequelize'][_0x2f13('0x42')](_0x328b7d[_0x2f13('0x8c')](),{'type':db[_0x2f13('0x7b')]['QueryTypes'][_0x2f13('0x8d')]})[_0x2f13('0x21')](function(_0x9b89e9){if(_0x9b89e9[_0x2f13('0x47')]===0x1){return _0x38a7ca['id'];}else{var _0x2004fb=_[_0x2f13('0x8e')](_[_0x2f13('0x41')](_0x9b89e9,'TeamId'),function(_0x123fac){return _[_0x2f13('0x8f')](_0x3a2609,_0x123fac);});if(_0x2004fb){return _0x38a7ca['id'];}}}));}}return BPromise['all'](_0x5eff82)[_0x2f13('0x21')](function(_0x5e48e3){_0x1c14bf=_(_0x1c14bf)['union'](_0x5e48e3)[_0x2f13('0x90')]()[_0x2f13('0x91')]();return db['ChatQueue'][_0x2f13('0x5a')]({'where':{'id':_0x5cecce[_0x2f13('0x5f')]['id']}})[_0x2f13('0x21')](function(_0x15c0b7){return db[_0x2f13('0x7b')]['transaction'](function(_0x3c42a4){return _0x15c0b7[_0x2f13('0x81')](_0x5cecce[_0x2f13('0x42')]['ids'],{'transaction':_0x3c42a4})['then'](function(){if(!_[_0x2f13('0x92')](_0x1c14bf)){return _0x15c0b7['removeAgents'](_0x1c14bf,{'transaction':_0x3c42a4});}})[_0x2f13('0x21')](function(){_0x1c14bf[_0x2f13('0x7e')](function(_0x57a678){socket['emit']('userChatQueue:remove',{'UserId':_0x57a678,'ChatQueueId':_0x15c0b7['id']});});});});});});})[_0x2f13('0x21')](respondWithStatusCode(_0x6c8768,null))['catch'](handleError(_0x6c8768,null));};exports[_0x2f13('0x93')]=function(_0x35cf3e,_0x312dfb,_0x376cce){return db[_0x2f13('0x3c')][_0x2f13('0x5a')]({'where':{'id':_0x35cf3e[_0x2f13('0x5f')]['id']}})[_0x2f13('0x21')](handleEntityNotFound(_0x312dfb,null))[_0x2f13('0x21')](function(_0x3a826d){if(_0x3a826d){return _0x3a826d[_0x2f13('0x93')](_0x35cf3e[_0x2f13('0x5e')]['ids'],_[_0x2f13('0x94')](_0x35cf3e['body'],[_0x2f13('0x75'),'id'])||{})['spread'](function(_0x123a57){for(var _0x34e5fa=0x0;_0x34e5fa<_0x35cf3e['body'][_0x2f13('0x75')][_0x2f13('0x47')];_0x34e5fa+=0x1){socket[_0x2f13('0x7f')](_0x2f13('0x80'),{'UserId':_0x35cf3e['body'][_0x2f13('0x75')][_0x34e5fa],'ChatQueueId':_0x35cf3e[_0x2f13('0x5f')]['id']});}return _0x123a57;});}})[_0x2f13('0x21')](respondWithResult(_0x312dfb,null))[_0x2f13('0x2a')](handleError(_0x312dfb,null));};exports['removeAgents']=function(_0x4f5544,_0x4a4b49,_0x3f6b68){return db['ChatQueue']['find']({'where':{'id':_0x4f5544['params']['id']}})[_0x2f13('0x21')](handleEntityNotFound(_0x4a4b49,null))[_0x2f13('0x21')](function(_0x55f751){if(_0x55f751){return _0x55f751[_0x2f13('0x95')](_0x4f5544[_0x2f13('0x42')]['ids'])['then'](function(){if(_[_0x2f13('0x96')](_0x4f5544[_0x2f13('0x42')][_0x2f13('0x75')])){for(var _0x1531cf=0x0;_0x1531cf<_0x4f5544[_0x2f13('0x42')][_0x2f13('0x75')][_0x2f13('0x47')];_0x1531cf+=0x1){socket[_0x2f13('0x7f')](_0x2f13('0x97'),{'UserId':Number(_0x4f5544[_0x2f13('0x42')]['ids'][_0x1531cf]),'ChatQueueId':Number(_0x4f5544[_0x2f13('0x5f')]['id'])});}}else{socket['emit'](_0x2f13('0x97'),{'UserId':Number(_0x4f5544['query'][_0x2f13('0x75')]),'ChatQueueId':Number(_0x4f5544[_0x2f13('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x4a4b49,null))[_0x2f13('0x2a')](handleError(_0x4a4b49,null));};exports[_0x2f13('0x98')]=function(_0x3c6897,_0x44e1d6,_0x213c17){var _0x380013={};var _0x2f0b0b={};var _0x5da4e5;var _0xea4c42;return db['ChatQueue'][_0x2f13('0x62')]({'where':{'id':_0x3c6897[_0x2f13('0x5f')]['id']}})[_0x2f13('0x21')](handleEntityNotFound(_0x44e1d6,null))[_0x2f13('0x21')](function(_0x1e9a53){if(_0x1e9a53){_0x5da4e5=_0x1e9a53;_0x2f0b0b['model']=_['keys'](db['User'][_0x2f13('0x3d')]);_0x2f0b0b[_0x2f13('0x42')]=_[_0x2f13('0x43')](_0x3c6897['query']);_0x2f0b0b[_0x2f13('0x44')]=_['intersection'](_0x2f0b0b[_0x2f13('0x40')],_0x2f0b0b['query']);_0x380013[_0x2f13('0x46')]=_[_0x2f13('0x55')](_0x2f0b0b['model'],qs[_0x2f13('0x45')](_0x3c6897['query'][_0x2f13('0x45')]));_0x380013[_0x2f13('0x46')]=_0x380013[_0x2f13('0x46')][_0x2f13('0x47')]?_0x380013['attributes']:_0x2f0b0b[_0x2f13('0x40')];_0x380013[_0x2f13('0x48')]=qs[_0x2f13('0x49')](_0x3c6897['query']['sort']);_0x380013[_0x2f13('0x4a')]=qs[_0x2f13('0x44')](_['pick'](_0x3c6897[_0x2f13('0x42')],_0x2f0b0b[_0x2f13('0x44')]));if(_0x3c6897[_0x2f13('0x42')][_0x2f13('0x50')]){_0x380013[_0x2f13('0x4a')]=_['merge'](_0x380013[_0x2f13('0x4a')],{'$or':_[_0x2f13('0x41')](_0x380013[_0x2f13('0x46')],function(_0x4116c5){var _0x25bf33={};_0x25bf33[_0x4116c5]={'$like':'%'+_0x3c6897['query'][_0x2f13('0x50')]+'%'};return _0x25bf33;})});}_0x380013=_[_0x2f13('0x4c')]({},_0x380013,_0x3c6897[_0x2f13('0x51')]);return _0x5da4e5[_0x2f13('0x98')](_0x380013);}})[_0x2f13('0x21')](function(_0x53c7e2){if(_0x53c7e2){_0xea4c42=_0x53c7e2[_0x2f13('0x47')];if(!_0x3c6897[_0x2f13('0x42')][_0x2f13('0x64')](_0x2f13('0x65'))){_0x380013[_0x2f13('0x31')]=qs['limit'](_0x3c6897[_0x2f13('0x42')][_0x2f13('0x31')]);_0x380013['offset']=qs[_0x2f13('0x2e')](_0x3c6897[_0x2f13('0x42')][_0x2f13('0x2e')]);}return _0x5da4e5[_0x2f13('0x98')](_0x380013);}})[_0x2f13('0x21')](function(_0x17d033){if(_0x17d033){return _0x17d033?{'count':_0xea4c42,'rows':_0x17d033}:null;}})[_0x2f13('0x21')](respondWithResult(_0x44e1d6,null))['catch'](handleError(_0x44e1d6,null));}; \ No newline at end of file +var _0x4912=['addAgents','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','jayson/promise','client','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','get','ChatQueues','UserProfileResource','destroy','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','describe','getMembers','findOne','hasOwnProperty','order','ChatQueueId','merge','UserChatQueue','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','format','getTeams','Team','addTeams','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','Agents','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','union','value','sequelize','isEmpty','removeAgents','userChatQueue:remove'];(function(_0x51bc88,_0x5a924e){var _0x177d42=function(_0x40218d){while(--_0x40218d){_0x51bc88['push'](_0x51bc88['shift']());}};_0x177d42(++_0x5a924e);}(_0x4912,0x1c0));var _0x2491=function(_0x49a3fc,_0x1515fa){_0x49a3fc=_0x49a3fc-0x0;var _0xed87e6=_0x4912[_0x49a3fc];return _0xed87e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2491('0x0'));var zipdir=require(_0x2491('0x1'));var jsonpatch=require(_0x2491('0x2'));var rp=require(_0x2491('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2491('0x4'));var util=require(_0x2491('0x5'));var path=require(_0x2491('0x6'));var sox=require(_0x2491('0x7'));var csv=require(_0x2491('0x8'));var ejs=require(_0x2491('0x9'));var fs=require('fs');var fs_extra=require(_0x2491('0xa'));var _=require(_0x2491('0xb'));var squel=require('squel');var crypto=require(_0x2491('0xc'));var jsforce=require(_0x2491('0xd'));var deskjs=require(_0x2491('0xe'));var toCsv=require(_0x2491('0x8'));var querystring=require(_0x2491('0xf'));var Papa=require('papaparse');var Redis=require(_0x2491('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2491('0x11'));var as=require(_0x2491('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2491('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2491('0x14'))['db'];config[_0x2491('0x15')]=_[_0x2491('0x16')](config[_0x2491('0x15')],{'host':_0x2491('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2491('0x18'))['register'](socket);var jayson=require(_0x2491('0x19'));var client=jayson[_0x2491('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6585e1,_0x181c11,_0x2ecdde,_0x4702e9){return new BPromise(function(_0x43ac21,_0xf679cb){var _0x1a9025=_0x4702e9||client;return _0x1a9025['request'](_0x6585e1,_0x2ecdde)[_0x2491('0x1b')](function(_0x269f18){logger[_0x2491('0x1c')](_0x2491('0x1d'),_0x181c11,_0x2491('0x1e'));logger[_0x2491('0x1f')](_0x2491('0x20'),_0x181c11,_0x2491('0x1e'),JSON[_0x2491('0x21')](_0x269f18));if(_0x269f18[_0x2491('0x22')]){if(_0x269f18[_0x2491('0x22')][_0x2491('0x23')]===0x1f4){logger[_0x2491('0x22')]('ChatQueue,\x20%s,\x20%s',_0x181c11,_0x269f18[_0x2491('0x22')][_0x2491('0x24')]);return _0xf679cb(_0x269f18[_0x2491('0x22')][_0x2491('0x24')]);}logger['error'](_0x2491('0x1d'),_0x181c11,_0x269f18[_0x2491('0x22')][_0x2491('0x24')]);return _0x43ac21(_0x269f18[_0x2491('0x22')][_0x2491('0x24')]);}else{logger['info'](_0x2491('0x1d'),_0x181c11,'request\x20sent');_0x43ac21(_0x269f18[_0x2491('0x25')][_0x2491('0x24')]);}})[_0x2491('0x26')](function(_0xad67f0){logger[_0x2491('0x22')](_0x2491('0x1d'),_0x181c11,_0xad67f0);_0xf679cb(_0xad67f0);});});}function respondWithStatusCode(_0x2c5b2d,_0x371545){_0x371545=_0x371545||0xcc;return function(_0x3458c8){if(_0x3458c8){return _0x2c5b2d[_0x2491('0x27')](_0x371545);}return _0x2c5b2d[_0x2491('0x28')](_0x371545)[_0x2491('0x29')]();};}function respondWithResult(_0xbf3d5f,_0x56a58d){_0x56a58d=_0x56a58d||0xc8;return function(_0x367994){if(_0x367994){return _0xbf3d5f[_0x2491('0x28')](_0x56a58d)[_0x2491('0x2a')](_0x367994);}};}function respondWithFilteredResult(_0x3de546,_0x23ce59){return function(_0x5a0bf0){if(_0x5a0bf0){var _0x1192ae=typeof _0x23ce59[_0x2491('0x2b')]==='undefined'&&typeof _0x23ce59[_0x2491('0x2c')]===_0x2491('0x2d');var _0x461cd8=_0x5a0bf0[_0x2491('0x2e')];var _0x4b95e7=_0x1192ae?0x0:_0x23ce59[_0x2491('0x2b')];var _0x18d35e=_0x1192ae?_0x5a0bf0['count']:_0x23ce59[_0x2491('0x2b')]+_0x23ce59[_0x2491('0x2c')];var _0x3af277;if(_0x18d35e>=_0x461cd8){_0x18d35e=_0x461cd8;_0x3af277=0xc8;}else{_0x3af277=0xce;}_0x3de546[_0x2491('0x28')](_0x3af277);return _0x3de546[_0x2491('0x2f')](_0x2491('0x30'),_0x4b95e7+'-'+_0x18d35e+'/'+_0x461cd8)[_0x2491('0x2a')](_0x5a0bf0);}return null;};}function patchUpdates(_0x5b5239){return function(_0xf90e85){try{jsonpatch[_0x2491('0x31')](_0xf90e85,_0x5b5239,!![]);}catch(_0x468cca){return BPromise[_0x2491('0x32')](_0x468cca);}return _0xf90e85['save']();};}function saveUpdates(_0x5b428d,_0x2e5435){return function(_0x4f5ea6){if(_0x4f5ea6){return _0x4f5ea6[_0x2491('0x33')](_0x5b428d)[_0x2491('0x1b')](function(_0x832235){return _0x832235;});}return null;};}function removeEntity(_0x25e44a,_0x4de644){return function(_0xfa6a99){if(_0xfa6a99){return _0xfa6a99['destroy']()['then'](function(){var _0x37944e=_0xfa6a99[_0x2491('0x34')]({'plain':!![]});var _0x21b552=_0x2491('0x35');return db[_0x2491('0x36')][_0x2491('0x37')]({'where':{'type':_0x21b552,'resourceId':_0x37944e['id']}})[_0x2491('0x1b')](function(){return _0xfa6a99;});})[_0x2491('0x1b')](function(){_0x25e44a['status'](0xcc)[_0x2491('0x29')]();});}};}function handleEntityNotFound(_0x167e2a,_0xcdf08e){return function(_0x5c2dca){if(!_0x5c2dca){_0x167e2a['sendStatus'](0x194);}return _0x5c2dca;};}function handleError(_0x1f5ee2,_0x3d214f){_0x3d214f=_0x3d214f||0x1f4;return function(_0x230dd0){logger[_0x2491('0x22')](_0x230dd0[_0x2491('0x38')]);if(_0x230dd0['name']){delete _0x230dd0[_0x2491('0x39')];}_0x1f5ee2[_0x2491('0x28')](_0x3d214f)[_0x2491('0x3a')](_0x230dd0);};}exports[_0x2491('0x3b')]=function(_0x24d77a,_0x12ba82){var _0x547fa7={},_0x3c2fc6={},_0x10138f={'count':0x0,'rows':[]};var _0xe3cbb7=_[_0x2491('0x3c')](db[_0x2491('0x3d')][_0x2491('0x3e')],function(_0x54dbaf){return{'name':_0x54dbaf[_0x2491('0x3f')],'type':_0x54dbaf[_0x2491('0x40')][_0x2491('0x41')]};});_0x3c2fc6[_0x2491('0x42')]=_[_0x2491('0x3c')](_0xe3cbb7,_0x2491('0x39'));_0x3c2fc6[_0x2491('0x43')]=_[_0x2491('0x44')](_0x24d77a[_0x2491('0x43')]);_0x3c2fc6[_0x2491('0x45')]=_['intersection'](_0x3c2fc6['model'],_0x3c2fc6[_0x2491('0x43')]);_0x547fa7[_0x2491('0x46')]=_[_0x2491('0x47')](_0x3c2fc6[_0x2491('0x42')],qs[_0x2491('0x48')](_0x24d77a[_0x2491('0x43')][_0x2491('0x48')]));_0x547fa7[_0x2491('0x46')]=_0x547fa7[_0x2491('0x46')][_0x2491('0x49')]?_0x547fa7['attributes']:_0x3c2fc6['model'];if(!_0x24d77a[_0x2491('0x43')]['hasOwnProperty'](_0x2491('0x4a'))){_0x547fa7[_0x2491('0x2c')]=qs[_0x2491('0x2c')](_0x24d77a[_0x2491('0x43')][_0x2491('0x2c')]);_0x547fa7[_0x2491('0x2b')]=qs['offset'](_0x24d77a[_0x2491('0x43')][_0x2491('0x2b')]);}_0x547fa7['order']=qs[_0x2491('0x4b')](_0x24d77a[_0x2491('0x43')][_0x2491('0x4b')]);_0x547fa7[_0x2491('0x4c')]=qs[_0x2491('0x45')](_[_0x2491('0x4d')](_0x24d77a[_0x2491('0x43')],_0x3c2fc6[_0x2491('0x45')]),_0xe3cbb7);if(_0x24d77a[_0x2491('0x43')][_0x2491('0x4e')]){_0x547fa7[_0x2491('0x4c')]=_['merge'](_0x547fa7['where'],{'$or':_['map'](_0xe3cbb7,function(_0x18ad52){if(_0x18ad52['type']!==_0x2491('0x4f')){var _0x25c396={};_0x25c396[_0x18ad52[_0x2491('0x39')]]={'$like':'%'+_0x24d77a['query']['filter']+'%'};return _0x25c396;}})});}_0x547fa7=_['merge']({},_0x547fa7,_0x24d77a[_0x2491('0x50')]);var _0x3b5c94={'where':_0x547fa7['where']};return db[_0x2491('0x3d')][_0x2491('0x2e')](_0x3b5c94)['then'](function(_0x12cd88){_0x10138f[_0x2491('0x2e')]=_0x12cd88;if(_0x24d77a['query'][_0x2491('0x51')]){_0x547fa7[_0x2491('0x52')]=[{'all':!![]}];}return db[_0x2491('0x3d')][_0x2491('0x53')](_0x547fa7);})[_0x2491('0x1b')](function(_0x270070){_0x10138f[_0x2491('0x54')]=_0x270070;return _0x10138f;})[_0x2491('0x1b')](respondWithFilteredResult(_0x12ba82,_0x547fa7))['catch'](handleError(_0x12ba82,null));};exports['show']=function(_0xceb26a,_0x26390c){var _0x20703d={'raw':!![],'where':{'id':_0xceb26a[_0x2491('0x55')]['id']}},_0x403f55={};_0x403f55[_0x2491('0x42')]=_[_0x2491('0x44')](db[_0x2491('0x3d')][_0x2491('0x3e')]);_0x403f55['query']=_[_0x2491('0x44')](_0xceb26a[_0x2491('0x43')]);_0x403f55['filters']=_[_0x2491('0x47')](_0x403f55[_0x2491('0x42')],_0x403f55[_0x2491('0x43')]);_0x20703d[_0x2491('0x46')]=_[_0x2491('0x47')](_0x403f55[_0x2491('0x42')],qs['fields'](_0xceb26a[_0x2491('0x43')][_0x2491('0x48')]));_0x20703d[_0x2491('0x46')]=_0x20703d['attributes']['length']?_0x20703d[_0x2491('0x46')]:_0x403f55[_0x2491('0x42')];if(_0xceb26a[_0x2491('0x43')][_0x2491('0x51')]){_0x20703d[_0x2491('0x52')]=[{'all':!![]}];}_0x20703d=_['merge']({},_0x20703d,_0xceb26a[_0x2491('0x50')]);return db[_0x2491('0x3d')]['find'](_0x20703d)[_0x2491('0x1b')](handleEntityNotFound(_0x26390c,null))['then'](respondWithResult(_0x26390c,null))[_0x2491('0x26')](handleError(_0x26390c,null));};exports[_0x2491('0x56')]=function(_0x12fbb6,_0x5a73bb){return db[_0x2491('0x3d')][_0x2491('0x56')](_0x12fbb6[_0x2491('0x57')],{})['then'](function(_0x416bc8){var _0x207605=_0x12fbb6[_0x2491('0x58')][_0x2491('0x34')]({'plain':!![]});if(!_0x207605)throw new Error(_0x2491('0x59'));if(_0x207605[_0x2491('0x5a')]===_0x2491('0x58')){var _0x4dc2ca=_0x416bc8[_0x2491('0x34')]({'plain':!![]});var _0x413fed=_0x2491('0x35');return db['UserProfileSection'][_0x2491('0x5b')]({'where':{'name':_0x413fed,'userProfileId':_0x207605['userProfileId']},'raw':!![]})[_0x2491('0x1b')](function(_0x390467){if(_0x390467&&_0x390467[_0x2491('0x5c')]===0x0){return db[_0x2491('0x36')][_0x2491('0x56')]({'name':_0x4dc2ca['name'],'resourceId':_0x4dc2ca['id'],'type':_0x390467[_0x2491('0x39')],'sectionId':_0x390467['id']},{})[_0x2491('0x1b')](function(){return _0x416bc8;});}else{return _0x416bc8;}})['catch'](function(_0xadf37f){logger[_0x2491('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xadf37f);throw _0xadf37f;});}return _0x416bc8;})[_0x2491('0x1b')](respondWithResult(_0x5a73bb,0xc9))[_0x2491('0x26')](handleError(_0x5a73bb,null));};exports[_0x2491('0x33')]=function(_0x2c3ca6,_0x2f3365){if(_0x2c3ca6['body']['id']){delete _0x2c3ca6[_0x2491('0x57')]['id'];}return db['ChatQueue'][_0x2491('0x5b')]({'where':{'id':_0x2c3ca6['params']['id']}})['then'](handleEntityNotFound(_0x2f3365,null))[_0x2491('0x1b')](saveUpdates(_0x2c3ca6[_0x2491('0x57')],null))[_0x2491('0x1b')](respondWithResult(_0x2f3365,null))[_0x2491('0x26')](handleError(_0x2f3365,null));};exports[_0x2491('0x37')]=function(_0x5bb799,_0x56dd1b){return db[_0x2491('0x3d')]['find']({'where':{'id':_0x5bb799[_0x2491('0x55')]['id']}})[_0x2491('0x1b')](handleEntityNotFound(_0x56dd1b,null))[_0x2491('0x1b')](removeEntity(_0x56dd1b,null))[_0x2491('0x26')](handleError(_0x56dd1b,null));};exports['describe']=function(_0x33f927,_0x396f4d){return db[_0x2491('0x3d')][_0x2491('0x5d')]()[_0x2491('0x1b')](respondWithResult(_0x396f4d,null))[_0x2491('0x26')](handleError(_0x396f4d,null));};exports[_0x2491('0x5e')]=function(_0x170672,_0x281ec9,_0x293209){var _0x33eabe={'raw':!![],'where':{}},_0x417df1={},_0x5a1e33;return db[_0x2491('0x3d')][_0x2491('0x5f')]({'where':{'id':_0x170672[_0x2491('0x55')]['id']}})[_0x2491('0x1b')](handleEntityNotFound(_0x281ec9,null))['then'](function(_0x3221f8){if(_0x3221f8){_0x5a1e33=_0x3221f8[_0x2491('0x34')]({'plain':!![]});_0x417df1[_0x2491('0x42')]=_[_0x2491('0x44')](db['UserChatQueue'][_0x2491('0x3e')]);_0x417df1['query']=_[_0x2491('0x44')](_0x170672[_0x2491('0x43')]);_0x417df1[_0x2491('0x45')]=_[_0x2491('0x47')](_0x417df1['model'],_0x417df1[_0x2491('0x43')]);_0x33eabe[_0x2491('0x46')]=_[_0x2491('0x47')](_0x417df1[_0x2491('0x42')],qs[_0x2491('0x48')](_0x170672[_0x2491('0x43')][_0x2491('0x48')]));_0x33eabe[_0x2491('0x46')]=_0x33eabe['attributes']['length']?_0x33eabe['attributes']:_0x417df1[_0x2491('0x42')];if(!_0x170672['query'][_0x2491('0x60')](_0x2491('0x4a'))){_0x33eabe[_0x2491('0x2c')]=qs[_0x2491('0x2c')](_0x170672[_0x2491('0x43')][_0x2491('0x2c')]);_0x33eabe[_0x2491('0x2b')]=qs[_0x2491('0x2b')](_0x170672['query'][_0x2491('0x2b')]);}_0x33eabe[_0x2491('0x61')]=qs[_0x2491('0x4b')](_0x170672[_0x2491('0x43')][_0x2491('0x4b')]);_0x33eabe['where']=qs['filters'](_[_0x2491('0x4d')](_0x170672['query'],_0x417df1[_0x2491('0x45')]));_0x33eabe[_0x2491('0x4c')][_0x2491('0x62')]=_0x3221f8['id'];if(_0x170672[_0x2491('0x43')][_0x2491('0x4e')]){_0x33eabe[_0x2491('0x4c')]=_[_0x2491('0x63')](_0x33eabe[_0x2491('0x4c')],{'$or':_[_0x2491('0x3c')](_0x33eabe[_0x2491('0x46')],function(_0x418339){var _0x193ebc={};_0x193ebc[_0x418339]={'$like':'%'+_0x170672[_0x2491('0x43')][_0x2491('0x4e')]+'%'};return _0x193ebc;})});}_0x33eabe=_[_0x2491('0x63')]({},_0x33eabe,_0x170672[_0x2491('0x50')]);return db[_0x2491('0x64')][_0x2491('0x53')](_0x33eabe);}})['then'](function(_0x50d1e0){if(_0x50d1e0){return db[_0x2491('0x65')][_0x2491('0x66')]({'where':{'id':_[_0x2491('0x3c')](_0x50d1e0,'UserId'),'role':_0x2491('0x67')},'attributes':['id',_0x2491('0x39'),_0x2491('0x68'),_0x2491('0x69'),_0x2491('0x6a')]});}})['then'](function(_0xea8451){if(_0xea8451){return{'count':_0xea8451[_0x2491('0x2e')],'rows':_[_0x2491('0x3c')](_0xea8451[_0x2491('0x54')],function(_0xd39739){return{'membername':_0xd39739[_0x2491('0x39')],'UserId':_0xd39739['id'],'queue_name':_0x5a1e33[_0x2491('0x39')],'ChatQueueId':_0x5a1e33['id'],'interface':util[_0x2491('0x6b')]('%s/%s','SIP',_0xd39739['name']),'penalty':0x0,'paused':_0xd39739[_0x2491('0x68')],'createdAt':_0xd39739[_0x2491('0x6a')],'updatedAt':_0xd39739[_0x2491('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2491('0x1b')](respondWithFilteredResult(_0x281ec9,_0x33eabe))['catch'](handleError(_0x281ec9,null));};exports[_0x2491('0x6c')]=function(_0x2084f3,_0x8b2613,_0x350d93){var _0x2aea31={};var _0x5e3e66={};var _0x5df6f1;var _0x74e3ec;return db[_0x2491('0x3d')][_0x2491('0x5f')]({'where':{'id':_0x2084f3[_0x2491('0x55')]['id']}})[_0x2491('0x1b')](handleEntityNotFound(_0x8b2613,null))[_0x2491('0x1b')](function(_0x26e4f7){if(_0x26e4f7){_0x5df6f1=_0x26e4f7;_0x5e3e66['model']=_[_0x2491('0x44')](db[_0x2491('0x6d')][_0x2491('0x3e')]);_0x5e3e66[_0x2491('0x43')]=_[_0x2491('0x44')](_0x2084f3[_0x2491('0x43')]);_0x5e3e66[_0x2491('0x45')]=_[_0x2491('0x47')](_0x5e3e66[_0x2491('0x42')],_0x5e3e66[_0x2491('0x43')]);_0x2aea31['attributes']=_[_0x2491('0x47')](_0x5e3e66[_0x2491('0x42')],qs[_0x2491('0x48')](_0x2084f3['query']['fields']));_0x2aea31[_0x2491('0x46')]=_0x2aea31['attributes'][_0x2491('0x49')]?_0x2aea31[_0x2491('0x46')]:_0x5e3e66[_0x2491('0x42')];_0x2aea31[_0x2491('0x61')]=qs[_0x2491('0x4b')](_0x2084f3[_0x2491('0x43')][_0x2491('0x4b')]);_0x2aea31[_0x2491('0x4c')]=qs['filters'](_[_0x2491('0x4d')](_0x2084f3['query'],_0x5e3e66['filters']));if(_0x2084f3[_0x2491('0x43')][_0x2491('0x4e')]){_0x2aea31[_0x2491('0x4c')]=_[_0x2491('0x63')](_0x2aea31[_0x2491('0x4c')],{'$or':_[_0x2491('0x3c')](_0x2aea31[_0x2491('0x46')],function(_0xd961c6){var _0x5c8011={};_0x5c8011[_0xd961c6]={'$like':'%'+_0x2084f3[_0x2491('0x43')][_0x2491('0x4e')]+'%'};return _0x5c8011;})});}_0x2aea31=_['merge']({},_0x2aea31,_0x2084f3[_0x2491('0x50')]);return _0x5df6f1[_0x2491('0x6c')](_0x2aea31);}})['then'](function(_0x2b4770){if(_0x2b4770){_0x74e3ec=_0x2b4770['length'];if(!_0x2084f3[_0x2491('0x43')]['hasOwnProperty']('nolimit')){_0x2aea31['limit']=qs['limit'](_0x2084f3[_0x2491('0x43')][_0x2491('0x2c')]);_0x2aea31[_0x2491('0x2b')]=qs[_0x2491('0x2b')](_0x2084f3[_0x2491('0x43')][_0x2491('0x2b')]);}return _0x5df6f1[_0x2491('0x6c')](_0x2aea31);}})[_0x2491('0x1b')](function(_0x3c90b4){if(_0x3c90b4){return _0x3c90b4?{'count':_0x74e3ec,'rows':_0x3c90b4}:null;}})[_0x2491('0x1b')](respondWithResult(_0x8b2613,null))[_0x2491('0x26')](handleError(_0x8b2613,null));};exports[_0x2491('0x6e')]=function(_0x38d409,_0x35c136,_0x303bab){var _0x187e33=_0x38d409[_0x2491('0x57')]['ids'];return db[_0x2491('0x6d')][_0x2491('0x53')]({'where':{'id':_0x187e33},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x2491('0x39'),_0x2491('0x6f'),_0x2491('0x70'),_0x2491('0x71')],'raw':!![]}]})[_0x2491('0x1b')](function(_0x27bb4b){if(_0x27bb4b){var _0x341330=_[_0x2491('0x72')](_0x27bb4b,function(_0x5a3d00){var _0x55f9c3=_0x5a3d00[_0x2491('0x34')]({'plain':!![]});return _0x55f9c3['Agents'];});return db[_0x2491('0x3d')]['find']({'where':{'id':_0x38d409['params']['id']}})['then'](function(_0x5781e2){return db['sequelize'][_0x2491('0x73')](function(_0x54a9cc){return _0x5781e2[_0x2491('0x6e')](_0x187e33,{'transaction':_0x54a9cc})[_0x2491('0x1b')](function(){return BPromise[_0x2491('0x74')](_0x341330,function(_0x12b233){return db['UserChatQueue'][_0x2491('0x75')]({'where':{'UserId':_0x12b233['id'],'ChatQueueId':_0x38d409[_0x2491('0x55')]['id']},'transaction':_0x54a9cc});});})['then'](function(){_0x341330[_0x2491('0x76')](function(_0x3c83b0){socket[_0x2491('0x77')](_0x2491('0x78'),{'UserId':_0x3c83b0['id'],'ChatQueueId':_0x5781e2['id']});});});});});}})[_0x2491('0x1b')](respondWithStatusCode(_0x35c136,null))[_0x2491('0x26')](handleError(_0x35c136,null));};exports[_0x2491('0x79')]=function(_0x24b970,_0x243685,_0xd3a40){return db[_0x2491('0x6d')][_0x2491('0x53')]({'where':{'id':_0x24b970[_0x2491('0x43')][_0x2491('0x7a')]},'attributes':['id'],'include':[{'model':db[_0x2491('0x65')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2491('0x1b')](handleEntityNotFound(_0x243685,null))[_0x2491('0x1b')](function(_0x1e5324){var _0x1d9fcf=_['map'](_0x1e5324,'id');var _0x4bb11a=[];var _0x323b07=[];var _0x3e239c=squel[_0x2491('0x7b')]();_0x3e239c[_0x2491('0x7c')](_0x2491('0x7d'))[_0x2491('0x7e')](_0x2491('0x7f'),'tq')['join'](_0x2491('0x80'),'ut',_0x2491('0x81'))[_0x2491('0x4c')](_0x2491('0x82'),_0x24b970['params']['id']);for(var _0x23662e=0x0;_0x23662e<_0x1e5324['length'];_0x23662e+=0x1){let _0x39713a=_0x1e5324[_0x23662e];for(var _0x474249=0x0;_0x474249<_0x39713a[_0x2491('0x83')][_0x2491('0x49')];_0x474249+=0x1){let _0x43ad64=_0x39713a[_0x2491('0x83')][_0x474249];var _0x86289b=_0x3e239c['clone']();_0x86289b[_0x2491('0x4c')](_0x2491('0x84'),_0x43ad64['id']);_0x323b07[_0x2491('0x85')](db['sequelize'][_0x2491('0x43')](_0x86289b['toString'](),{'type':db['sequelize'][_0x2491('0x86')][_0x2491('0x87')]})[_0x2491('0x1b')](function(_0x44b1a2){if(_0x44b1a2[_0x2491('0x49')]===0x1){return _0x43ad64['id'];}else{var _0x445b25=_[_0x2491('0x88')](_['map'](_0x44b1a2,_0x2491('0x89')),function(_0x439f1d){return _['includes'](_0x1d9fcf,_0x439f1d);});if(_0x445b25){return _0x43ad64['id'];}}}));}}return BPromise['all'](_0x323b07)[_0x2491('0x1b')](function(_0x2295d2){_0x4bb11a=_(_0x4bb11a)[_0x2491('0x8a')](_0x2295d2)['compact']()[_0x2491('0x8b')]();return db['ChatQueue'][_0x2491('0x5b')]({'where':{'id':_0x24b970['params']['id']}})['then'](function(_0x2cef45){return db[_0x2491('0x8c')][_0x2491('0x73')](function(_0x47c734){return _0x2cef45[_0x2491('0x79')](_0x24b970[_0x2491('0x43')][_0x2491('0x7a')],{'transaction':_0x47c734})[_0x2491('0x1b')](function(){if(!_[_0x2491('0x8d')](_0x4bb11a)){return _0x2cef45[_0x2491('0x8e')](_0x4bb11a,{'transaction':_0x47c734});}})[_0x2491('0x1b')](function(){_0x4bb11a['forEach'](function(_0x19fddc){socket[_0x2491('0x77')](_0x2491('0x8f'),{'UserId':_0x19fddc,'ChatQueueId':_0x2cef45['id']});});});});});});})[_0x2491('0x1b')](respondWithStatusCode(_0x243685,null))[_0x2491('0x26')](handleError(_0x243685,null));};exports[_0x2491('0x90')]=function(_0xd8c106,_0x51e62c,_0xc9ce90){return db[_0x2491('0x3d')][_0x2491('0x5b')]({'where':{'id':_0xd8c106[_0x2491('0x55')]['id']}})['then'](handleEntityNotFound(_0x51e62c,null))[_0x2491('0x1b')](function(_0x1581ca){if(_0x1581ca){return _0x1581ca['addAgents'](_0xd8c106['body']['ids'],_['omit'](_0xd8c106[_0x2491('0x57')],[_0x2491('0x7a'),'id'])||{})[_0x2491('0x91')](function(_0x2c6967){for(var _0x28a77c=0x0;_0x28a77c<_0xd8c106['body'][_0x2491('0x7a')][_0x2491('0x49')];_0x28a77c+=0x1){socket['emit'](_0x2491('0x78'),{'UserId':_0xd8c106['body'][_0x2491('0x7a')][_0x28a77c],'ChatQueueId':_0xd8c106[_0x2491('0x55')]['id']});}return _0x2c6967;});}})[_0x2491('0x1b')](respondWithResult(_0x51e62c,null))[_0x2491('0x26')](handleError(_0x51e62c,null));};exports[_0x2491('0x8e')]=function(_0x56afc1,_0x19a585,_0x1b770d){return db['ChatQueue'][_0x2491('0x5b')]({'where':{'id':_0x56afc1[_0x2491('0x55')]['id']}})[_0x2491('0x1b')](handleEntityNotFound(_0x19a585,null))[_0x2491('0x1b')](function(_0x2a67b4){if(_0x2a67b4){return _0x2a67b4['removeAgents'](_0x56afc1[_0x2491('0x43')][_0x2491('0x7a')])[_0x2491('0x1b')](function(){if(_[_0x2491('0x92')](_0x56afc1[_0x2491('0x43')][_0x2491('0x7a')])){for(var _0x113172=0x0;_0x113172<_0x56afc1['query']['ids'][_0x2491('0x49')];_0x113172+=0x1){socket[_0x2491('0x77')](_0x2491('0x8f'),{'UserId':Number(_0x56afc1[_0x2491('0x43')][_0x2491('0x7a')][_0x113172]),'ChatQueueId':Number(_0x56afc1[_0x2491('0x55')]['id'])});}}else{socket[_0x2491('0x77')](_0x2491('0x8f'),{'UserId':Number(_0x56afc1[_0x2491('0x43')][_0x2491('0x7a')]),'ChatQueueId':Number(_0x56afc1[_0x2491('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x19a585,null))[_0x2491('0x26')](handleError(_0x19a585,null));};exports['getAgents']=function(_0x2f3b8e,_0x2b7bb0,_0x14a1fc){var _0x23a714={};var _0x2aadf8={};var _0x32aada;var _0x22b809;return db[_0x2491('0x3d')][_0x2491('0x5f')]({'where':{'id':_0x2f3b8e[_0x2491('0x55')]['id']}})[_0x2491('0x1b')](handleEntityNotFound(_0x2b7bb0,null))[_0x2491('0x1b')](function(_0x397922){if(_0x397922){_0x32aada=_0x397922;_0x2aadf8[_0x2491('0x42')]=_[_0x2491('0x44')](db[_0x2491('0x65')][_0x2491('0x3e')]);_0x2aadf8[_0x2491('0x43')]=_[_0x2491('0x44')](_0x2f3b8e['query']);_0x2aadf8['filters']=_[_0x2491('0x47')](_0x2aadf8[_0x2491('0x42')],_0x2aadf8[_0x2491('0x43')]);_0x23a714[_0x2491('0x46')]=_[_0x2491('0x47')](_0x2aadf8[_0x2491('0x42')],qs[_0x2491('0x48')](_0x2f3b8e[_0x2491('0x43')][_0x2491('0x48')]));_0x23a714['attributes']=_0x23a714[_0x2491('0x46')][_0x2491('0x49')]?_0x23a714[_0x2491('0x46')]:_0x2aadf8[_0x2491('0x42')];_0x23a714[_0x2491('0x61')]=qs[_0x2491('0x4b')](_0x2f3b8e['query'][_0x2491('0x4b')]);_0x23a714[_0x2491('0x4c')]=qs[_0x2491('0x45')](_[_0x2491('0x4d')](_0x2f3b8e['query'],_0x2aadf8['filters']));if(_0x2f3b8e['query'][_0x2491('0x4e')]){_0x23a714['where']=_['merge'](_0x23a714[_0x2491('0x4c')],{'$or':_[_0x2491('0x3c')](_0x23a714[_0x2491('0x46')],function(_0x564640){var _0x489b3f={};_0x489b3f[_0x564640]={'$like':'%'+_0x2f3b8e[_0x2491('0x43')][_0x2491('0x4e')]+'%'};return _0x489b3f;})});}_0x23a714=_[_0x2491('0x63')]({},_0x23a714,_0x2f3b8e[_0x2491('0x50')]);return _0x32aada['getAgents'](_0x23a714);}})['then'](function(_0x52ff4c){if(_0x52ff4c){_0x22b809=_0x52ff4c[_0x2491('0x49')];if(!_0x2f3b8e[_0x2491('0x43')][_0x2491('0x60')](_0x2491('0x4a'))){_0x23a714[_0x2491('0x2c')]=qs[_0x2491('0x2c')](_0x2f3b8e[_0x2491('0x43')][_0x2491('0x2c')]);_0x23a714[_0x2491('0x2b')]=qs[_0x2491('0x2b')](_0x2f3b8e[_0x2491('0x43')][_0x2491('0x2b')]);}return _0x32aada[_0x2491('0x93')](_0x23a714);}})[_0x2491('0x1b')](function(_0x360cce){if(_0x360cce){return _0x360cce?{'count':_0x22b809,'rows':_0x360cce}:null;}})[_0x2491('0x1b')](respondWithResult(_0x2b7bb0,null))[_0x2491('0x26')](handleError(_0x2b7bb0,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 3b49b24..3a2620c 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 _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x1385dc,_0x2c7fd7){var _0x2f6469=function(_0x47ed8a){while(--_0x47ed8a){_0x1385dc['push'](_0x1385dc['shift']());}};_0x2f6469(++_0x2c7fd7);}(_0xadb5,0xad));var _0x5adb=function(_0x3436cd,_0x49dd05){_0x3436cd=_0x3436cd-0x0;var _0x199e4c=_0xadb5[_0x3436cd];return _0x199e4c;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x5adb('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatQueueEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatQueueEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatQueue[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x34d275,_0x5d84ee){var _0x1379cc=function(_0x320fbe){while(--_0x320fbe){_0x34d275['push'](_0x34d275['shift']());}};_0x1379cc(++_0x5d84ee);}(_0xadb5,0xad));var _0x5adb=function(_0x5d8763,_0x1b8327){_0x5d8763=_0x5d8763-0x0;var _0x36a714=_0xadb5[_0x5d8763];return _0x36a714;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x5adb('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatQueueEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatQueueEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatQueue[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 2efa6b7..85755dc 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 _0x1ac9=['rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','moment','path'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x1ac9,0x1cf));var _0x91ac=function(_0x46f3f8,_0x12c74b){_0x46f3f8=_0x46f3f8-0x0;var _0xbc57cd=_0x1ac9[_0x46f3f8];return _0xbc57cd;};'use strict';var _=require(_0x91ac('0x0'));var util=require(_0x91ac('0x1'));var logger=require(_0x91ac('0x2'))('api');var moment=require(_0x91ac('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x91ac('0x4'));var rimraf=require(_0x91ac('0x5'));var config=require(_0x91ac('0x6'));var attributes=require(_0x91ac('0x7'));module[_0x91ac('0x8')]=function(_0x3a37c1,_0x1ddcff){return _0x3a37c1[_0x91ac('0x9')](_0x91ac('0xa'),attributes,{'tableName':_0x91ac('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x504c=['bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','chat_queues','lodash','../../config/logger','api'];(function(_0x486b00,_0x501df5){var _0x47ea82=function(_0x997782){while(--_0x997782){_0x486b00['push'](_0x486b00['shift']());}};_0x47ea82(++_0x501df5);}(_0x504c,0x1cb));var _0xc504=function(_0x33dcf7,_0x3d5390){_0x33dcf7=_0x33dcf7-0x0;var _0x542d4e=_0x504c[_0x33dcf7];return _0x542d4e;};'use strict';var _=require(_0xc504('0x0'));var util=require('util');var logger=require(_0xc504('0x1'))(_0xc504('0x2'));var moment=require('moment');var BPromise=require(_0xc504('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc504('0x4'));var rimraf=require(_0xc504('0x5'));var config=require(_0xc504('0x6'));var attributes=require(_0xc504('0x7'));module[_0xc504('0x8')]=function(_0x950956,_0x46ac88){return _0x950956[_0xc504('0x9')]('ChatQueue',attributes,{'tableName':_0xc504('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index cf2669f..fa05fa4 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 _0x95c3=['http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetChatQueue','find','ShowChatQueue','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x684e7f,_0x1b5c27){var _0x135aca=function(_0x23e0bd){while(--_0x23e0bd){_0x684e7f['push'](_0x684e7f['shift']());}};_0x135aca(++_0x1b5c27);}(_0x95c3,0x6d));var _0x395c=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x95c3[_0x4dbaad];return _0x226c72;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x395c('0x0'));var BPromise=require(_0x395c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x395c('0x2'))['db'];var utils=require(_0x395c('0x3'));var logger=require(_0x395c('0x4'))(_0x395c('0x5'));var config=require(_0x395c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x395c('0x7')][_0x395c('0x8')]({'port':0x232a});config[_0x395c('0x9')]=_[_0x395c('0xa')](config[_0x395c('0x9')],{'host':_0x395c('0xb'),'port':0x18eb});var socket=require(_0x395c('0xc'))(new Redis(config[_0x395c('0x9')]));require(_0x395c('0xd'))[_0x395c('0xe')](socket);function respondWithRpcPromise(_0x24ff52,_0x6320b4,_0x521e03){return new BPromise(function(_0x1da945,_0x41c9d5){return client[_0x395c('0xf')](_0x24ff52,_0x521e03)[_0x395c('0x10')](function(_0x50783c){logger[_0x395c('0x11')](_0x395c('0x12'),_0x6320b4,'request\x20sent');logger[_0x395c('0x13')](_0x395c('0x14'),_0x6320b4,_0x395c('0x15'),JSON[_0x395c('0x16')](_0x50783c));if(_0x50783c['error']){if(_0x50783c[_0x395c('0x17')]['code']===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x6320b4,_0x50783c[_0x395c('0x17')][_0x395c('0x18')]);return _0x41c9d5(_0x50783c[_0x395c('0x17')][_0x395c('0x18')]);}logger[_0x395c('0x17')](_0x395c('0x12'),_0x6320b4,_0x50783c[_0x395c('0x17')][_0x395c('0x18')]);return _0x1da945(_0x50783c[_0x395c('0x17')][_0x395c('0x18')]);}else{logger[_0x395c('0x11')](_0x395c('0x12'),_0x6320b4,_0x395c('0x15'));_0x1da945(_0x50783c['result'][_0x395c('0x18')]);}})[_0x395c('0x19')](function(_0xefe87b){logger[_0x395c('0x17')](_0x395c('0x12'),_0x6320b4,_0xefe87b);_0x41c9d5(_0xefe87b);});});}exports['GetChatQueue']=function(_0x5b117e){var _0x2f2e05=this;return new Promise(function(_0x2690b0,_0x32d669){return db[_0x395c('0x1a')][_0x395c('0x1b')]({'raw':_0x5b117e[_0x395c('0x1c')]?_0x5b117e[_0x395c('0x1c')][_0x395c('0x1d')]===undefined?!![]:![]:!![],'where':_0x5b117e[_0x395c('0x1c')]?_0x5b117e[_0x395c('0x1c')][_0x395c('0x1e')]||null:null,'attributes':_0x5b117e[_0x395c('0x1c')]?_0x5b117e[_0x395c('0x1c')][_0x395c('0x1f')]||null:null,'limit':_0x5b117e[_0x395c('0x1c')]?_0x5b117e['options'][_0x395c('0x20')]||null:null,'include':_0x5b117e[_0x395c('0x1c')]?_0x5b117e['options'][_0x395c('0x21')]?_[_0x395c('0x22')](_0x5b117e[_0x395c('0x1c')]['include'],function(_0x977443){return{'model':db[_0x977443[_0x395c('0x23')]],'as':_0x977443['as'],'attributes':_0x977443[_0x395c('0x1f')],'include':_0x977443[_0x395c('0x21')]?_[_0x395c('0x22')](_0x977443['include'],function(_0x3b4e48){return{'model':db[_0x3b4e48['model']],'as':_0x3b4e48['as'],'attributes':_0x3b4e48[_0x395c('0x1f')],'include':_0x3b4e48[_0x395c('0x21')]?_[_0x395c('0x22')](_0x3b4e48[_0x395c('0x21')],function(_0x1c33f4){return{'model':db[_0x1c33f4[_0x395c('0x23')]],'as':_0x1c33f4['as'],'attributes':_0x1c33f4[_0x395c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x395c('0x10')](function(_0x2d3323){logger['info'](_0x395c('0x24'),_0x5b117e);logger[_0x395c('0x13')]('GetChatQueue',_0x5b117e,JSON[_0x395c('0x16')](_0x2d3323));_0x2690b0(_0x2d3323);})[_0x395c('0x19')](function(_0xdb4d05){logger[_0x395c('0x17')](_0x395c('0x24'),_0xdb4d05[_0x395c('0x18')],_0x5b117e);_0x32d669(_0x2f2e05['error'](0x1f4,_0xdb4d05[_0x395c('0x18')]));});});};exports['ShowChatQueue']=function(_0x23fad2){var _0x4189b4=this;return new Promise(function(_0x121349,_0x47b201){return db['ChatQueue'][_0x395c('0x25')]({'raw':_0x23fad2[_0x395c('0x1c')]?_0x23fad2['options'][_0x395c('0x1d')]===undefined?!![]:![]:!![],'where':_0x23fad2[_0x395c('0x1c')]?_0x23fad2[_0x395c('0x1c')][_0x395c('0x1e')]||null:null,'attributes':_0x23fad2[_0x395c('0x1c')]?_0x23fad2[_0x395c('0x1c')][_0x395c('0x1f')]||null:null,'include':_0x23fad2[_0x395c('0x1c')]?_0x23fad2[_0x395c('0x1c')][_0x395c('0x21')]?_[_0x395c('0x22')](_0x23fad2[_0x395c('0x1c')][_0x395c('0x21')],function(_0x282ca8){return{'model':db[_0x282ca8['model']],'as':_0x282ca8['as'],'attributes':_0x282ca8['attributes'],'include':_0x282ca8[_0x395c('0x21')]?_[_0x395c('0x22')](_0x282ca8[_0x395c('0x21')],function(_0x3a7f61){return{'model':db[_0x3a7f61[_0x395c('0x23')]],'as':_0x3a7f61['as'],'attributes':_0x3a7f61[_0x395c('0x1f')],'include':_0x3a7f61[_0x395c('0x21')]?_['map'](_0x3a7f61[_0x395c('0x21')],function(_0x422d5c){return{'model':db[_0x422d5c[_0x395c('0x23')]],'as':_0x422d5c['as'],'attributes':_0x422d5c['attributes']};}):[]};}):[]};}):[]:[]})[_0x395c('0x10')](function(_0x7af787){logger[_0x395c('0x11')]('ShowChatQueue',_0x23fad2);logger['debug'](_0x395c('0x26'),_0x23fad2,JSON['stringify'](_0x7af787));_0x121349(_0x7af787);})[_0x395c('0x19')](function(_0x2c5cb7){logger[_0x395c('0x17')]('ShowChatQueue',_0x2c5cb7['message'],_0x23fad2);_0x47b201(_0x4189b4[_0x395c('0x17')](0x1f4,_0x2c5cb7[_0x395c('0x18')]));});});}; \ No newline at end of file +var _0x2f0c=['map','model','stringify','ShowChatQueue','find','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include'];(function(_0x56557f,_0xc4df7a){var _0x28ae74=function(_0x140cca){while(--_0x140cca){_0x56557f['push'](_0x56557f['shift']());}};_0x28ae74(++_0xc4df7a);}(_0x2f0c,0x1b2));var _0xc2f0=function(_0x40eec9,_0x817a67){_0x40eec9=_0x40eec9-0x0;var _0xfee890=_0x2f0c[_0x40eec9];return _0xfee890;};'use strict';var _=require(_0xc2f0('0x0'));var util=require(_0xc2f0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc2f0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2f0('0x3'))['db'];var utils=require(_0xc2f0('0x4'));var logger=require('../../config/logger')(_0xc2f0('0x5'));var config=require(_0xc2f0('0x6'));var jayson=require(_0xc2f0('0x7'));var client=jayson['client'][_0xc2f0('0x8')]({'port':0x232a});config['redis']=_[_0xc2f0('0x9')](config[_0xc2f0('0xa')],{'host':_0xc2f0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc2f0('0xa')]));require(_0xc2f0('0xc'))[_0xc2f0('0xd')](socket);function respondWithRpcPromise(_0xc3c26c,_0x6996be,_0x2356af){return new BPromise(function(_0x27920e,_0x14ee86){return client[_0xc2f0('0xe')](_0xc3c26c,_0x2356af)[_0xc2f0('0xf')](function(_0x49231b){logger[_0xc2f0('0x10')](_0xc2f0('0x11'),_0x6996be,_0xc2f0('0x12'));logger[_0xc2f0('0x13')](_0xc2f0('0x14'),_0x6996be,'request\x20sent',JSON['stringify'](_0x49231b));if(_0x49231b[_0xc2f0('0x15')]){if(_0x49231b[_0xc2f0('0x15')][_0xc2f0('0x16')]===0x1f4){logger['error'](_0xc2f0('0x11'),_0x6996be,_0x49231b[_0xc2f0('0x15')]['message']);return _0x14ee86(_0x49231b[_0xc2f0('0x15')][_0xc2f0('0x17')]);}logger[_0xc2f0('0x15')](_0xc2f0('0x11'),_0x6996be,_0x49231b['error'][_0xc2f0('0x17')]);return _0x27920e(_0x49231b[_0xc2f0('0x15')]['message']);}else{logger[_0xc2f0('0x10')](_0xc2f0('0x11'),_0x6996be,_0xc2f0('0x12'));_0x27920e(_0x49231b['result']['message']);}})[_0xc2f0('0x18')](function(_0x1b51e3){logger[_0xc2f0('0x15')]('ChatQueue,\x20%s,\x20%s',_0x6996be,_0x1b51e3);_0x14ee86(_0x1b51e3);});});}exports[_0xc2f0('0x19')]=function(_0x570018){var _0x1d5135=this;return new Promise(function(_0x1b32d1,_0x4b868f){return db[_0xc2f0('0x1a')][_0xc2f0('0x1b')]({'raw':_0x570018[_0xc2f0('0x1c')]?_0x570018['options'][_0xc2f0('0x1d')]===undefined?!![]:![]:!![],'where':_0x570018[_0xc2f0('0x1c')]?_0x570018[_0xc2f0('0x1c')][_0xc2f0('0x1e')]||null:null,'attributes':_0x570018['options']?_0x570018['options'][_0xc2f0('0x1f')]||null:null,'limit':_0x570018[_0xc2f0('0x1c')]?_0x570018['options'][_0xc2f0('0x20')]||null:null,'include':_0x570018[_0xc2f0('0x1c')]?_0x570018[_0xc2f0('0x1c')][_0xc2f0('0x21')]?_[_0xc2f0('0x22')](_0x570018[_0xc2f0('0x1c')]['include'],function(_0x391ef5){return{'model':db[_0x391ef5[_0xc2f0('0x23')]],'as':_0x391ef5['as'],'attributes':_0x391ef5[_0xc2f0('0x1f')],'include':_0x391ef5[_0xc2f0('0x21')]?_['map'](_0x391ef5[_0xc2f0('0x21')],function(_0x302996){return{'model':db[_0x302996[_0xc2f0('0x23')]],'as':_0x302996['as'],'attributes':_0x302996[_0xc2f0('0x1f')],'include':_0x302996['include']?_['map'](_0x302996[_0xc2f0('0x21')],function(_0x245502){return{'model':db[_0x245502['model']],'as':_0x245502['as'],'attributes':_0x245502[_0xc2f0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc2f0('0xf')](function(_0x59d0cb){logger[_0xc2f0('0x10')](_0xc2f0('0x19'),_0x570018);logger[_0xc2f0('0x13')](_0xc2f0('0x19'),_0x570018,JSON[_0xc2f0('0x24')](_0x59d0cb));_0x1b32d1(_0x59d0cb);})['catch'](function(_0xee0399){logger[_0xc2f0('0x15')]('GetChatQueue',_0xee0399['message'],_0x570018);_0x4b868f(_0x1d5135[_0xc2f0('0x15')](0x1f4,_0xee0399['message']));});});};exports[_0xc2f0('0x25')]=function(_0x2ccb37){var _0x2ae67a=this;return new Promise(function(_0x13581a,_0x2dfd25){return db['ChatQueue'][_0xc2f0('0x26')]({'raw':_0x2ccb37['options']?_0x2ccb37[_0xc2f0('0x1c')][_0xc2f0('0x1d')]===undefined?!![]:![]:!![],'where':_0x2ccb37[_0xc2f0('0x1c')]?_0x2ccb37[_0xc2f0('0x1c')][_0xc2f0('0x1e')]||null:null,'attributes':_0x2ccb37[_0xc2f0('0x1c')]?_0x2ccb37[_0xc2f0('0x1c')][_0xc2f0('0x1f')]||null:null,'include':_0x2ccb37[_0xc2f0('0x1c')]?_0x2ccb37['options'][_0xc2f0('0x21')]?_[_0xc2f0('0x22')](_0x2ccb37[_0xc2f0('0x1c')]['include'],function(_0x3e67b6){return{'model':db[_0x3e67b6['model']],'as':_0x3e67b6['as'],'attributes':_0x3e67b6[_0xc2f0('0x1f')],'include':_0x3e67b6[_0xc2f0('0x21')]?_[_0xc2f0('0x22')](_0x3e67b6['include'],function(_0x5584b5){return{'model':db[_0x5584b5[_0xc2f0('0x23')]],'as':_0x5584b5['as'],'attributes':_0x5584b5[_0xc2f0('0x1f')],'include':_0x5584b5[_0xc2f0('0x21')]?_[_0xc2f0('0x22')](_0x5584b5['include'],function(_0x46ccd6){return{'model':db[_0x46ccd6[_0xc2f0('0x23')]],'as':_0x46ccd6['as'],'attributes':_0x46ccd6[_0xc2f0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc2f0('0xf')](function(_0x3b2dd4){logger[_0xc2f0('0x10')](_0xc2f0('0x25'),_0x2ccb37);logger[_0xc2f0('0x13')](_0xc2f0('0x25'),_0x2ccb37,JSON[_0xc2f0('0x24')](_0x3b2dd4));_0x13581a(_0x3b2dd4);})[_0xc2f0('0x18')](function(_0x17f194){logger[_0xc2f0('0x15')](_0xc2f0('0x25'),_0x17f194[_0xc2f0('0x17')],_0x2ccb37);_0x2dfd25(_0x2ae67a[_0xc2f0('0x15')](0x1f4,_0x17f194['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index d38a24b..053e0d0 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 _0xbaf0=['removeListener','register','length','chatQueue:','save','remove','update'];(function(_0x5421d4,_0x226761){var _0xf303b8=function(_0x5f48da){while(--_0x5f48da){_0x5421d4['push'](_0x5421d4['shift']());}};_0xf303b8(++_0x226761);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){ChatQueueEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);ChatQueueEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file +var _0xbaf0=['removeListener','register','length','chatQueue:','save','remove','update'];(function(_0xa04c75,_0x431bcd){var _0x51c8f5=function(_0x1d1d1f){while(--_0x1d1d1f){_0xa04c75['push'](_0xa04c75['shift']());}};_0x51c8f5(++_0x431bcd);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){ChatQueueEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);ChatQueueEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index cd6ebb9..de7af28 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 _0xff47=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','isAuthenticated','describe','get','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','exports'];(function(_0x28ca8e,_0x1b3737){var _0x54278c=function(_0x149cdb){while(--_0x149cdb){_0x28ca8e['push'](_0x28ca8e['shift']());}};_0x54278c(++_0x1b3737);}(_0xff47,0x15c));var _0x7ff4=function(_0x2cac50,_0x320bb5){_0x2cac50=_0x2cac50-0x0;var _0x1b7d73=_0xff47[_0x2cac50];return _0x1b7d73;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7ff4('0x0'));var timeout=require(_0x7ff4('0x1'));var express=require(_0x7ff4('0x2'));var router=express[_0x7ff4('0x3')]();var fs_extra=require(_0x7ff4('0x4'));var auth=require(_0x7ff4('0x5'));var interaction=require(_0x7ff4('0x6'));var config=require('../../config/environment');var controller=require(_0x7ff4('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x7ff4('0x8')](),controller[_0x7ff4('0x9')]);router[_0x7ff4('0xa')](_0x7ff4('0xb'),auth[_0x7ff4('0x8')](),controller[_0x7ff4('0xc')]);router[_0x7ff4('0xa')](_0x7ff4('0xd'),auth[_0x7ff4('0x8')](),controller[_0x7ff4('0xe')]);router[_0x7ff4('0xa')](_0x7ff4('0xf'),auth[_0x7ff4('0x8')](),controller[_0x7ff4('0x10')]);router[_0x7ff4('0xa')]('/:id/users',auth[_0x7ff4('0x8')](),controller[_0x7ff4('0x11')]);router[_0x7ff4('0x12')]('/',auth[_0x7ff4('0x8')](),controller[_0x7ff4('0x13')]);router[_0x7ff4('0x12')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7ff4('0x14')]);router[_0x7ff4('0x12')](_0x7ff4('0x15'),auth[_0x7ff4('0x8')](),controller[_0x7ff4('0x16')]);router[_0x7ff4('0x17')](_0x7ff4('0xb'),auth[_0x7ff4('0x8')](),controller[_0x7ff4('0x18')]);router[_0x7ff4('0x19')](_0x7ff4('0xb'),auth['isAuthenticated'](),controller[_0x7ff4('0x1a')]);router[_0x7ff4('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7ff4('0x1b')]);router[_0x7ff4('0x19')]('/:id/users',auth[_0x7ff4('0x8')](),controller['removeAgents']);module[_0x7ff4('0x1c')]=router; \ No newline at end of file +var _0x4201=['/:id','/:id/members','getMembers','getTeams','getAgents','post','/:id/teams','addTeams','addAgents','put','delete','destroy','/:id/users','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe'];(function(_0x37e0e7,_0x3dea19){var _0x1f1ad9=function(_0x533c98){while(--_0x533c98){_0x37e0e7['push'](_0x37e0e7['shift']());}};_0x1f1ad9(++_0x3dea19);}(_0x4201,0x102));var _0x1420=function(_0x585b83,_0x25d403){_0x585b83=_0x585b83-0x0;var _0x2faa24=_0x4201[_0x585b83];return _0x2faa24;};'use strict';var multer=require(_0x1420('0x0'));var util=require(_0x1420('0x1'));var path=require(_0x1420('0x2'));var timeout=require('connect-timeout');var express=require(_0x1420('0x3'));var router=express[_0x1420('0x4')]();var fs_extra=require(_0x1420('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1420('0x6'));var controller=require(_0x1420('0x7'));router[_0x1420('0x8')]('/',auth[_0x1420('0x9')](),controller[_0x1420('0xa')]);router[_0x1420('0x8')](_0x1420('0xb'),auth[_0x1420('0x9')](),controller['describe']);router[_0x1420('0x8')](_0x1420('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x1420('0x8')](_0x1420('0xd'),auth[_0x1420('0x9')](),controller[_0x1420('0xe')]);router[_0x1420('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1420('0xf')]);router[_0x1420('0x8')]('/:id/users',auth[_0x1420('0x9')](),controller[_0x1420('0x10')]);router[_0x1420('0x11')]('/',auth[_0x1420('0x9')](),controller['create']);router[_0x1420('0x11')](_0x1420('0x12'),auth[_0x1420('0x9')](),controller[_0x1420('0x13')]);router[_0x1420('0x11')]('/:id/users',auth[_0x1420('0x9')](),controller[_0x1420('0x14')]);router[_0x1420('0x15')](_0x1420('0xc'),auth[_0x1420('0x9')](),controller['update']);router[_0x1420('0x16')](_0x1420('0xc'),auth['isAuthenticated'](),controller[_0x1420('0x17')]);router[_0x1420('0x16')](_0x1420('0x12'),auth[_0x1420('0x9')](),controller['removeTeams']);router[_0x1420('0x16')](_0x1420('0x18'),auth[_0x1420('0x9')](),controller[_0x1420('0x19')]);module[_0x1420('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 61ba5f8..ce70dea 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 _0xc153=['moment','sequelize','STRING','DATE'];(function(_0x177047,_0x3ac7f8){var _0x5889f3=function(_0x36cabd){while(--_0x36cabd){_0x177047['push'](_0x177047['shift']());}};_0x5889f3(++_0x3ac7f8);}(_0xc153,0x1c4));var _0x3c15=function(_0x401bba,_0x5bffdb){_0x401bba=_0x401bba-0x0;var _0x4b4116=_0xc153[_0x401bba];return _0x4b4116;};'use strict';var moment=require(_0x3c15('0x0'));var Sequelize=require(_0x3c15('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3c15('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3c15('0x3')]},'acceptAt':{'type':Sequelize[_0x3c15('0x3')]},'exitAt':{'type':Sequelize[_0x3c15('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x74ab=['DATE','moment','sequelize','exports','STRING'];(function(_0x3c3313,_0x1ea90d){var _0xb947aa=function(_0x2d911f){while(--_0x2d911f){_0x3c3313['push'](_0x3c3313['shift']());}};_0xb947aa(++_0x1ea90d);}(_0x74ab,0x92));var _0xb74a=function(_0x15402a,_0x4fa192){_0x15402a=_0x15402a-0x0;var _0x227919=_0x74ab[_0x15402a];return _0x227919;};'use strict';var moment=require(_0xb74a('0x0'));var Sequelize=require(_0xb74a('0x1'));module[_0xb74a('0x2')]={'uniqueid':{'type':Sequelize[_0xb74a('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb74a('0x4')]},'leaveAt':{'type':Sequelize[_0xb74a('0x4')]},'acceptAt':{'type':Sequelize[_0xb74a('0x4')]},'exitAt':{'type':Sequelize[_0xb74a('0x4')]},'reason':{'type':Sequelize[_0xb74a('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 91efde3..6563aed 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 _0xc0a5=['include','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll'];(function(_0x54c06a,_0x1e6af6){var _0x50c24a=function(_0x374a53){while(--_0x374a53){_0x54c06a['push'](_0x54c06a['shift']());}};_0x50c24a(++_0x1e6af6);}(_0xc0a5,0x1ba));var _0x5c0a=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xc0a5[_0x20ef64];return _0x3707d8;};'use strict';var emlformat=require(_0x5c0a('0x0'));var rimraf=require(_0x5c0a('0x1'));var zipdir=require(_0x5c0a('0x2'));var jsonpatch=require(_0x5c0a('0x3'));var rp=require(_0x5c0a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5c0a('0x5'));var util=require(_0x5c0a('0x6'));var path=require(_0x5c0a('0x7'));var sox=require(_0x5c0a('0x8'));var csv=require(_0x5c0a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5c0a('0xa'));var _=require('lodash');var squel=require(_0x5c0a('0xb'));var crypto=require(_0x5c0a('0xc'));var jsforce=require(_0x5c0a('0xd'));var deskjs=require(_0x5c0a('0xe'));var toCsv=require(_0x5c0a('0x9'));var querystring=require(_0x5c0a('0xf'));var Papa=require('papaparse');var Redis=require(_0x5c0a('0x10'));var authService=require(_0x5c0a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5c0a('0x12'));var hardwareService=require(_0x5c0a('0x13'));var logger=require('../../config/logger')(_0x5c0a('0x14'));var utils=require('../../config/utils');var config=require(_0x5c0a('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52ea45,_0x518d6b){_0x518d6b=_0x518d6b||0xcc;return function(_0x448e46){if(_0x448e46){return _0x52ea45[_0x5c0a('0x16')](_0x518d6b);}return _0x52ea45['status'](_0x518d6b)[_0x5c0a('0x17')]();};}function respondWithResult(_0x5bc64b,_0x5a1c72){_0x5a1c72=_0x5a1c72||0xc8;return function(_0x500838){if(_0x500838){return _0x5bc64b[_0x5c0a('0x18')](_0x5a1c72)[_0x5c0a('0x19')](_0x500838);}};}function respondWithFilteredResult(_0x2bddfa,_0x2a4d00){return function(_0x1822ba){if(_0x1822ba){var _0x54c508=typeof _0x2a4d00[_0x5c0a('0x1a')]==='undefined'&&typeof _0x2a4d00[_0x5c0a('0x1b')]===_0x5c0a('0x1c');var _0xc2aeb5=_0x1822ba['count'];var _0x2a59f0=_0x54c508?0x0:_0x2a4d00['offset'];var _0x49ef32=_0x54c508?_0x1822ba[_0x5c0a('0x1d')]:_0x2a4d00['offset']+_0x2a4d00['limit'];var _0x1b191b;if(_0x49ef32>=_0xc2aeb5){_0x49ef32=_0xc2aeb5;_0x1b191b=0xc8;}else{_0x1b191b=0xce;}_0x2bddfa[_0x5c0a('0x18')](_0x1b191b);return _0x2bddfa['set'](_0x5c0a('0x1e'),_0x2a59f0+'-'+_0x49ef32+'/'+_0xc2aeb5)[_0x5c0a('0x19')](_0x1822ba);}return null;};}function patchUpdates(_0x33c947){return function(_0x25efba){try{jsonpatch[_0x5c0a('0x1f')](_0x25efba,_0x33c947,!![]);}catch(_0x50e3e6){return BPromise['reject'](_0x50e3e6);}return _0x25efba[_0x5c0a('0x20')]();};}function saveUpdates(_0x517e41,_0x55bfd1){return function(_0x1c4307){if(_0x1c4307){return _0x1c4307[_0x5c0a('0x21')](_0x517e41)[_0x5c0a('0x22')](function(_0x2e5b52){return _0x2e5b52;});}return null;};}function removeEntity(_0x46aea2,_0x499ec9){return function(_0x1d9653){if(_0x1d9653){return _0x1d9653[_0x5c0a('0x23')]()[_0x5c0a('0x22')](function(){_0x46aea2[_0x5c0a('0x18')](0xcc)[_0x5c0a('0x17')]();});}};}function handleEntityNotFound(_0x2a5018,_0x1ef6af){return function(_0x10b457){if(!_0x10b457){_0x2a5018[_0x5c0a('0x16')](0x194);}return _0x10b457;};}function handleError(_0x837b67,_0x1d921a){_0x1d921a=_0x1d921a||0x1f4;return function(_0x5ed91b){logger[_0x5c0a('0x24')](_0x5ed91b[_0x5c0a('0x25')]);if(_0x5ed91b[_0x5c0a('0x26')]){delete _0x5ed91b[_0x5c0a('0x26')];}_0x837b67[_0x5c0a('0x18')](_0x1d921a)[_0x5c0a('0x27')](_0x5ed91b);};}exports['index']=function(_0x477673,_0x7c65a2){var _0x4fd4cd={},_0x59a108={},_0x19d1ad={'count':0x0,'rows':[]};var _0x3b7180=_[_0x5c0a('0x28')](db[_0x5c0a('0x29')][_0x5c0a('0x2a')],function(_0x57a9be){return{'name':_0x57a9be[_0x5c0a('0x2b')],'type':_0x57a9be[_0x5c0a('0x2c')][_0x5c0a('0x2d')]};});_0x59a108[_0x5c0a('0x2e')]=_[_0x5c0a('0x28')](_0x3b7180,_0x5c0a('0x26'));_0x59a108[_0x5c0a('0x2f')]=_[_0x5c0a('0x30')](_0x477673[_0x5c0a('0x2f')]);_0x59a108['filters']=_['intersection'](_0x59a108[_0x5c0a('0x2e')],_0x59a108[_0x5c0a('0x2f')]);_0x4fd4cd['attributes']=_[_0x5c0a('0x31')](_0x59a108[_0x5c0a('0x2e')],qs[_0x5c0a('0x32')](_0x477673[_0x5c0a('0x2f')]['fields']));_0x4fd4cd[_0x5c0a('0x33')]=_0x4fd4cd[_0x5c0a('0x33')]['length']?_0x4fd4cd[_0x5c0a('0x33')]:_0x59a108['model'];if(!_0x477673['query'][_0x5c0a('0x34')](_0x5c0a('0x35'))){_0x4fd4cd[_0x5c0a('0x1b')]=qs[_0x5c0a('0x1b')](_0x477673['query'][_0x5c0a('0x1b')]);_0x4fd4cd[_0x5c0a('0x1a')]=qs[_0x5c0a('0x1a')](_0x477673[_0x5c0a('0x2f')][_0x5c0a('0x1a')]);}_0x4fd4cd[_0x5c0a('0x36')]=qs[_0x5c0a('0x37')](_0x477673['query']['sort']);_0x4fd4cd[_0x5c0a('0x38')]=qs['filters'](_['pick'](_0x477673[_0x5c0a('0x2f')],_0x59a108[_0x5c0a('0x39')]),_0x3b7180);if(_0x477673[_0x5c0a('0x2f')][_0x5c0a('0x3a')]){_0x4fd4cd[_0x5c0a('0x38')]=_['merge'](_0x4fd4cd[_0x5c0a('0x38')],{'$or':_['map'](_0x3b7180,function(_0x4ed362){if(_0x4ed362[_0x5c0a('0x2c')]!=='VIRTUAL'){var _0x5ba42c={};_0x5ba42c[_0x4ed362[_0x5c0a('0x26')]]={'$like':'%'+_0x477673[_0x5c0a('0x2f')][_0x5c0a('0x3a')]+'%'};return _0x5ba42c;}})});}_0x4fd4cd=_[_0x5c0a('0x3b')]({},_0x4fd4cd,_0x477673[_0x5c0a('0x3c')]);var _0x4b19a6={'where':_0x4fd4cd['where']};return db[_0x5c0a('0x29')][_0x5c0a('0x1d')](_0x4b19a6)[_0x5c0a('0x22')](function(_0x4bcbc2){_0x19d1ad['count']=_0x4bcbc2;if(_0x477673[_0x5c0a('0x2f')][_0x5c0a('0x3d')]){_0x4fd4cd[_0x5c0a('0x3e')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x4fd4cd);})[_0x5c0a('0x22')](function(_0x322c8f){_0x19d1ad[_0x5c0a('0x3f')]=_0x322c8f;return _0x19d1ad;})[_0x5c0a('0x22')](respondWithFilteredResult(_0x7c65a2,_0x4fd4cd))[_0x5c0a('0x40')](handleError(_0x7c65a2,null));};exports[_0x5c0a('0x41')]=function(_0x5871b2,_0x3a2f24){var _0x3f4c38={'raw':!![],'where':{'id':_0x5871b2[_0x5c0a('0x42')]['id']}},_0x46a233={};_0x46a233[_0x5c0a('0x2e')]=_['keys'](db['ChatQueueReport'][_0x5c0a('0x2a')]);_0x46a233['query']=_[_0x5c0a('0x30')](_0x5871b2[_0x5c0a('0x2f')]);_0x46a233[_0x5c0a('0x39')]=_[_0x5c0a('0x31')](_0x46a233['model'],_0x46a233['query']);_0x3f4c38[_0x5c0a('0x33')]=_[_0x5c0a('0x31')](_0x46a233[_0x5c0a('0x2e')],qs[_0x5c0a('0x32')](_0x5871b2[_0x5c0a('0x2f')][_0x5c0a('0x32')]));_0x3f4c38[_0x5c0a('0x33')]=_0x3f4c38['attributes'][_0x5c0a('0x43')]?_0x3f4c38['attributes']:_0x46a233[_0x5c0a('0x2e')];if(_0x5871b2[_0x5c0a('0x2f')]['includeAll']){_0x3f4c38[_0x5c0a('0x3e')]=[{'all':!![]}];}_0x3f4c38=_[_0x5c0a('0x3b')]({},_0x3f4c38,_0x5871b2[_0x5c0a('0x3c')]);return db['ChatQueueReport'][_0x5c0a('0x44')](_0x3f4c38)[_0x5c0a('0x22')](handleEntityNotFound(_0x3a2f24,null))['then'](respondWithResult(_0x3a2f24,null))[_0x5c0a('0x40')](handleError(_0x3a2f24,null));};exports['create']=function(_0x1cc681,_0x22a24e){return db[_0x5c0a('0x29')][_0x5c0a('0x45')](_0x1cc681['body'],{})[_0x5c0a('0x22')](respondWithResult(_0x22a24e,0xc9))[_0x5c0a('0x40')](handleError(_0x22a24e,null));};exports[_0x5c0a('0x21')]=function(_0x4af6d1,_0x8e9b5d){if(_0x4af6d1[_0x5c0a('0x46')]['id']){delete _0x4af6d1['body']['id'];}return db[_0x5c0a('0x29')][_0x5c0a('0x44')]({'where':{'id':_0x4af6d1[_0x5c0a('0x42')]['id']}})[_0x5c0a('0x22')](handleEntityNotFound(_0x8e9b5d,null))[_0x5c0a('0x22')](saveUpdates(_0x4af6d1[_0x5c0a('0x46')],null))['then'](respondWithResult(_0x8e9b5d,null))[_0x5c0a('0x40')](handleError(_0x8e9b5d,null));};exports[_0x5c0a('0x23')]=function(_0x13e434,_0x4560bb){return db['ChatQueueReport'][_0x5c0a('0x44')]({'where':{'id':_0x13e434[_0x5c0a('0x42')]['id']}})[_0x5c0a('0x22')](handleEntityNotFound(_0x4560bb,null))[_0x5c0a('0x22')](removeEntity(_0x4560bb,null))[_0x5c0a('0x40')](handleError(_0x4560bb,null));};exports[_0x5c0a('0x47')]=function(_0x38ed81,_0x39ff2e){return db[_0x5c0a('0x29')][_0x5c0a('0x47')]()[_0x5c0a('0x22')](respondWithResult(_0x39ff2e,null))[_0x5c0a('0x40')](handleError(_0x39ff2e,null));}; \ No newline at end of file +var _0xcedb=['VIRTUAL','filter','options','includeAll','include','show','params','find','catch','create','body','describe','eml-format','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','pick','where','merge','type'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xcedb,0xde));var _0xbced=function(_0x587cb9,_0x29eb20){_0x587cb9=_0x587cb9-0x0;var _0x250e54=_0xcedb[_0x587cb9];return _0x250e54;};'use strict';var emlformat=require(_0xbced('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbced('0x1'));var rp=require('request-promise');var moment=require(_0xbced('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xbced('0x3'));var util=require(_0xbced('0x4'));var path=require('path');var sox=require(_0xbced('0x5'));var csv=require(_0xbced('0x6'));var ejs=require(_0xbced('0x7'));var fs=require('fs');var fs_extra=require(_0xbced('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbced('0x9'));var jsforce=require(_0xbced('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xbced('0x6'));var querystring=require(_0xbced('0xb'));var Papa=require(_0xbced('0xc'));var Redis=require(_0xbced('0xd'));var authService=require(_0xbced('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbced('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbced('0x10'))(_0xbced('0x11'));var utils=require(_0xbced('0x12'));var config=require(_0xbced('0x13'));var licenseUtil=require(_0xbced('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24e387,_0x1c87e3){_0x1c87e3=_0x1c87e3||0xcc;return function(_0x546995){if(_0x546995){return _0x24e387['sendStatus'](_0x1c87e3);}return _0x24e387[_0xbced('0x15')](_0x1c87e3)[_0xbced('0x16')]();};}function respondWithResult(_0x512016,_0x42d22c){_0x42d22c=_0x42d22c||0xc8;return function(_0x31749c){if(_0x31749c){return _0x512016[_0xbced('0x15')](_0x42d22c)['json'](_0x31749c);}};}function respondWithFilteredResult(_0x46d88e,_0x9fe12f){return function(_0x7bdba2){if(_0x7bdba2){var _0x320fd2=typeof _0x9fe12f[_0xbced('0x17')]==='undefined'&&typeof _0x9fe12f[_0xbced('0x18')]===_0xbced('0x19');var _0x26f470=_0x7bdba2[_0xbced('0x1a')];var _0x1d43f6=_0x320fd2?0x0:_0x9fe12f['offset'];var _0x178d81=_0x320fd2?_0x7bdba2['count']:_0x9fe12f['offset']+_0x9fe12f[_0xbced('0x18')];var _0x3c9c68;if(_0x178d81>=_0x26f470){_0x178d81=_0x26f470;_0x3c9c68=0xc8;}else{_0x3c9c68=0xce;}_0x46d88e[_0xbced('0x15')](_0x3c9c68);return _0x46d88e[_0xbced('0x1b')](_0xbced('0x1c'),_0x1d43f6+'-'+_0x178d81+'/'+_0x26f470)[_0xbced('0x1d')](_0x7bdba2);}return null;};}function patchUpdates(_0x4d5c09){return function(_0xc325aa){try{jsonpatch[_0xbced('0x1e')](_0xc325aa,_0x4d5c09,!![]);}catch(_0x178ca8){return BPromise[_0xbced('0x1f')](_0x178ca8);}return _0xc325aa[_0xbced('0x20')]();};}function saveUpdates(_0x20c592,_0x3fc235){return function(_0x3d5ab3){if(_0x3d5ab3){return _0x3d5ab3[_0xbced('0x21')](_0x20c592)[_0xbced('0x22')](function(_0x1a1ed4){return _0x1a1ed4;});}return null;};}function removeEntity(_0x23f371,_0x448444){return function(_0x32cc08){if(_0x32cc08){return _0x32cc08['destroy']()[_0xbced('0x22')](function(){_0x23f371[_0xbced('0x15')](0xcc)[_0xbced('0x16')]();});}};}function handleEntityNotFound(_0xe8f377,_0x1edf99){return function(_0x305fd5){if(!_0x305fd5){_0xe8f377['sendStatus'](0x194);}return _0x305fd5;};}function handleError(_0x3f2378,_0x54e638){_0x54e638=_0x54e638||0x1f4;return function(_0x3f0ca3){logger[_0xbced('0x23')](_0x3f0ca3[_0xbced('0x24')]);if(_0x3f0ca3['name']){delete _0x3f0ca3[_0xbced('0x25')];}_0x3f2378[_0xbced('0x15')](_0x54e638)[_0xbced('0x26')](_0x3f0ca3);};}exports[_0xbced('0x27')]=function(_0x451d64,_0x4ebae3){var _0x5bd388={},_0xb6cc63={},_0x4c4937={'count':0x0,'rows':[]};var _0x2b65ae=_[_0xbced('0x28')](db[_0xbced('0x29')][_0xbced('0x2a')],function(_0x4665db){return{'name':_0x4665db['fieldName'],'type':_0x4665db['type']['key']};});_0xb6cc63['model']=_[_0xbced('0x28')](_0x2b65ae,'name');_0xb6cc63[_0xbced('0x2b')]=_[_0xbced('0x2c')](_0x451d64['query']);_0xb6cc63[_0xbced('0x2d')]=_['intersection'](_0xb6cc63[_0xbced('0x2e')],_0xb6cc63[_0xbced('0x2b')]);_0x5bd388[_0xbced('0x2f')]=_[_0xbced('0x30')](_0xb6cc63[_0xbced('0x2e')],qs[_0xbced('0x31')](_0x451d64[_0xbced('0x2b')][_0xbced('0x31')]));_0x5bd388[_0xbced('0x2f')]=_0x5bd388[_0xbced('0x2f')][_0xbced('0x32')]?_0x5bd388[_0xbced('0x2f')]:_0xb6cc63['model'];if(!_0x451d64[_0xbced('0x2b')]['hasOwnProperty'](_0xbced('0x33'))){_0x5bd388[_0xbced('0x18')]=qs[_0xbced('0x18')](_0x451d64[_0xbced('0x2b')][_0xbced('0x18')]);_0x5bd388[_0xbced('0x17')]=qs[_0xbced('0x17')](_0x451d64[_0xbced('0x2b')][_0xbced('0x17')]);}_0x5bd388[_0xbced('0x34')]=qs[_0xbced('0x35')](_0x451d64['query'][_0xbced('0x35')]);_0x5bd388['where']=qs[_0xbced('0x2d')](_[_0xbced('0x36')](_0x451d64[_0xbced('0x2b')],_0xb6cc63['filters']),_0x2b65ae);if(_0x451d64[_0xbced('0x2b')]['filter']){_0x5bd388[_0xbced('0x37')]=_[_0xbced('0x38')](_0x5bd388[_0xbced('0x37')],{'$or':_['map'](_0x2b65ae,function(_0x952c11){if(_0x952c11[_0xbced('0x39')]!==_0xbced('0x3a')){var _0x4034af={};_0x4034af[_0x952c11['name']]={'$like':'%'+_0x451d64[_0xbced('0x2b')][_0xbced('0x3b')]+'%'};return _0x4034af;}})});}_0x5bd388=_['merge']({},_0x5bd388,_0x451d64[_0xbced('0x3c')]);var _0x1fa648={'where':_0x5bd388[_0xbced('0x37')]};return db[_0xbced('0x29')][_0xbced('0x1a')](_0x1fa648)[_0xbced('0x22')](function(_0xffb10f){_0x4c4937['count']=_0xffb10f;if(_0x451d64[_0xbced('0x2b')][_0xbced('0x3d')]){_0x5bd388[_0xbced('0x3e')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x5bd388);})[_0xbced('0x22')](function(_0x14ca44){_0x4c4937['rows']=_0x14ca44;return _0x4c4937;})['then'](respondWithFilteredResult(_0x4ebae3,_0x5bd388))['catch'](handleError(_0x4ebae3,null));};exports[_0xbced('0x3f')]=function(_0x113e5c,_0x29095d){var _0x166e88={'raw':!![],'where':{'id':_0x113e5c[_0xbced('0x40')]['id']}},_0x303d7e={};_0x303d7e[_0xbced('0x2e')]=_[_0xbced('0x2c')](db[_0xbced('0x29')]['rawAttributes']);_0x303d7e['query']=_['keys'](_0x113e5c[_0xbced('0x2b')]);_0x303d7e[_0xbced('0x2d')]=_[_0xbced('0x30')](_0x303d7e['model'],_0x303d7e[_0xbced('0x2b')]);_0x166e88[_0xbced('0x2f')]=_[_0xbced('0x30')](_0x303d7e[_0xbced('0x2e')],qs[_0xbced('0x31')](_0x113e5c['query'][_0xbced('0x31')]));_0x166e88[_0xbced('0x2f')]=_0x166e88[_0xbced('0x2f')]['length']?_0x166e88['attributes']:_0x303d7e[_0xbced('0x2e')];if(_0x113e5c[_0xbced('0x2b')][_0xbced('0x3d')]){_0x166e88[_0xbced('0x3e')]=[{'all':!![]}];}_0x166e88=_['merge']({},_0x166e88,_0x113e5c[_0xbced('0x3c')]);return db[_0xbced('0x29')][_0xbced('0x41')](_0x166e88)[_0xbced('0x22')](handleEntityNotFound(_0x29095d,null))[_0xbced('0x22')](respondWithResult(_0x29095d,null))[_0xbced('0x42')](handleError(_0x29095d,null));};exports[_0xbced('0x43')]=function(_0xb5d006,_0x20d168){return db['ChatQueueReport'][_0xbced('0x43')](_0xb5d006[_0xbced('0x44')],{})['then'](respondWithResult(_0x20d168,0xc9))['catch'](handleError(_0x20d168,null));};exports[_0xbced('0x21')]=function(_0x221173,_0x4d9dd1){if(_0x221173[_0xbced('0x44')]['id']){delete _0x221173[_0xbced('0x44')]['id'];}return db[_0xbced('0x29')][_0xbced('0x41')]({'where':{'id':_0x221173[_0xbced('0x40')]['id']}})['then'](handleEntityNotFound(_0x4d9dd1,null))[_0xbced('0x22')](saveUpdates(_0x221173[_0xbced('0x44')],null))[_0xbced('0x22')](respondWithResult(_0x4d9dd1,null))[_0xbced('0x42')](handleError(_0x4d9dd1,null));};exports['destroy']=function(_0x5ef751,_0x26b987){return db['ChatQueueReport']['find']({'where':{'id':_0x5ef751[_0xbced('0x40')]['id']}})['then'](handleEntityNotFound(_0x26b987,null))[_0xbced('0x22')](removeEntity(_0x26b987,null))['catch'](handleError(_0x26b987,null));};exports[_0xbced('0x45')]=function(_0x16ce5d,_0x1a20d9){return db[_0xbced('0x29')][_0xbced('0x45')]()[_0xbced('0x22')](respondWithResult(_0x1a20d9,null))[_0xbced('0x42')](handleError(_0x1a20d9,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index bad794c..79aea31 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 _0xa2b6=['rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5e56d2,_0x69a9d9){var _0x382751=function(_0x44c5ef){while(--_0x44c5ef){_0x5e56d2['push'](_0x5e56d2['shift']());}};_0x382751(++_0x69a9d9);}(_0xa2b6,0x166));var _0x6a2b=function(_0x12ceef,_0x240db4){_0x12ceef=_0x12ceef-0x0;var _0x280e35=_0xa2b6[_0x12ceef];return _0x280e35;};'use strict';var _=require(_0x6a2b('0x0'));var util=require(_0x6a2b('0x1'));var logger=require(_0x6a2b('0x2'))(_0x6a2b('0x3'));var moment=require(_0x6a2b('0x4'));var BPromise=require('bluebird');var rp=require(_0x6a2b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a2b('0x6'));var config=require(_0x6a2b('0x7'));var attributes=require(_0x6a2b('0x8'));module[_0x6a2b('0x9')]=function(_0x1d35f5,_0x2954a4){return _0x1d35f5[_0x6a2b('0xa')](_0x6a2b('0xb'),attributes,{'tableName':_0x6a2b('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6a2b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdbab=['path','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','../../config/logger','moment','request-promise'];(function(_0xd41f6c,_0x2ee0b2){var _0x4db302=function(_0x1446d9){while(--_0x1446d9){_0xd41f6c['push'](_0xd41f6c['shift']());}};_0x4db302(++_0x2ee0b2);}(_0xdbab,0x15a));var _0xbdba=function(_0x4527f1,_0x2d1dec){_0x4527f1=_0x4527f1-0x0;var _0x107e4d=_0xdbab[_0x4527f1];return _0x107e4d;};'use strict';var _=require(_0xbdba('0x0'));var util=require(_0xbdba('0x1'));var logger=require(_0xbdba('0x2'))('api');var moment=require(_0xbdba('0x3'));var BPromise=require('bluebird');var rp=require(_0xbdba('0x4'));var fs=require('fs');var path=require(_0xbdba('0x5'));var rimraf=require('rimraf');var config=require(_0xbdba('0x6'));var attributes=require(_0xbdba('0x7'));module[_0xbdba('0x8')]=function(_0x4b24fd,_0x34bcfa){return _0x4b24fd[_0xbdba('0x9')](_0xbdba('0xa'),attributes,{'tableName':_0xbdba('0xb'),'paranoid':![],'indexes':[{'name':_0xbdba('0xc'),'fields':[_0xbdba('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index c5cab42..330d3e1 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 _0xf7a8=['ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','CreateChatQueueReport','ChatQueueReport','create','options','debug','stringify','body','where','attributes','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf7a8,0x15d));var _0x8f7a=function(_0x550a64,_0x17a623){_0x550a64=_0x550a64-0x0;var _0x2ef33a=_0xf7a8[_0x550a64];return _0x2ef33a;};'use strict';var _=require(_0x8f7a('0x0'));var util=require(_0x8f7a('0x1'));var moment=require(_0x8f7a('0x2'));var BPromise=require(_0x8f7a('0x3'));var rs=require(_0x8f7a('0x4'));var fs=require('fs');var Redis=require(_0x8f7a('0x5'));var db=require(_0x8f7a('0x6'))['db'];var utils=require(_0x8f7a('0x7'));var logger=require(_0x8f7a('0x8'))(_0x8f7a('0x9'));var config=require(_0x8f7a('0xa'));var jayson=require(_0x8f7a('0xb'));var client=jayson[_0x8f7a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ffeaf,_0x1e6faf,_0x5e0616){return new BPromise(function(_0x24d224,_0x1e4837){return client['request'](_0x3ffeaf,_0x5e0616)[_0x8f7a('0xd')](function(_0x21daf6){logger['info'](_0x8f7a('0xe'),_0x1e6faf,_0x8f7a('0xf'));logger['debug'](_0x8f7a('0x10'),_0x1e6faf,'request\x20sent',JSON['stringify'](_0x21daf6));if(_0x21daf6[_0x8f7a('0x11')]){if(_0x21daf6['error'][_0x8f7a('0x12')]===0x1f4){logger[_0x8f7a('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x1e6faf,_0x21daf6[_0x8f7a('0x11')]['message']);return _0x1e4837(_0x21daf6[_0x8f7a('0x11')][_0x8f7a('0x13')]);}logger['error'](_0x8f7a('0xe'),_0x1e6faf,_0x21daf6['error'][_0x8f7a('0x13')]);return _0x24d224(_0x21daf6[_0x8f7a('0x11')][_0x8f7a('0x13')]);}else{logger[_0x8f7a('0x14')](_0x8f7a('0xe'),_0x1e6faf,_0x8f7a('0xf'));_0x24d224(_0x21daf6['result']['message']);}})[_0x8f7a('0x15')](function(_0xdb9b33){logger[_0x8f7a('0x11')](_0x8f7a('0xe'),_0x1e6faf,_0xdb9b33);_0x1e4837(_0xdb9b33);});});}exports[_0x8f7a('0x16')]=function(_0x2e4725){var _0x36a408=this;return new Promise(function(_0x34698d,_0x574887){return db[_0x8f7a('0x17')][_0x8f7a('0x18')](_0x2e4725['body'],{'raw':_0x2e4725[_0x8f7a('0x19')]?_0x2e4725[_0x8f7a('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8f7a('0xd')](function(_0x4b97fc){logger[_0x8f7a('0x14')](_0x8f7a('0x16'),_0x2e4725);logger[_0x8f7a('0x1a')](_0x8f7a('0x16'),_0x2e4725,JSON[_0x8f7a('0x1b')](_0x4b97fc));_0x34698d(_0x4b97fc);})[_0x8f7a('0x15')](function(_0x48cf57){logger[_0x8f7a('0x11')]('CreateChatQueueReport',_0x48cf57[_0x8f7a('0x13')],_0x2e4725);_0x574887(_0x36a408[_0x8f7a('0x11')](0x1f4,_0x48cf57[_0x8f7a('0x13')]));});});};exports['UpdateChatQueueReport']=function(_0x54a575){var _0x187b4d=this;return new Promise(function(_0x2fbd19,_0x3097ec){return db['ChatQueueReport']['update'](_0x54a575[_0x8f7a('0x1c')],{'raw':_0x54a575['options']?_0x54a575[_0x8f7a('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54a575['options']?_0x54a575['options'][_0x8f7a('0x1d')]||null:null,'attributes':_0x54a575[_0x8f7a('0x19')]?_0x54a575[_0x8f7a('0x19')][_0x8f7a('0x1e')]||null:null,'limit':_0x54a575[_0x8f7a('0x19')]?_0x54a575['options'][_0x8f7a('0x1f')]||null:null})[_0x8f7a('0xd')](function(_0x5b0abb){logger[_0x8f7a('0x14')](_0x8f7a('0x20'),_0x54a575);logger[_0x8f7a('0x1a')](_0x8f7a('0x20'),_0x54a575,JSON[_0x8f7a('0x1b')](_0x5b0abb));_0x2fbd19(_0x5b0abb);})[_0x8f7a('0x15')](function(_0x54fab2){logger[_0x8f7a('0x11')](_0x8f7a('0x20'),_0x54fab2[_0x8f7a('0x13')],_0x54a575);_0x3097ec(_0x187b4d['error'](0x1f4,_0x54fab2[_0x8f7a('0x13')]));});});}; \ No newline at end of file +var _0x63ee=['UpdateChatQueueReport','body','raw','where','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','ChatQueueReport,\x20%s,\x20%s','message','result','CreateChatQueueReport','ChatQueueReport','create','options','catch'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x63ee,0x105));var _0xe63e=function(_0x261c6f,_0x31215c){_0x261c6f=_0x261c6f-0x0;var _0x542ced=_0x63ee[_0x261c6f];return _0x542ced;};'use strict';var _=require(_0xe63e('0x0'));var util=require(_0xe63e('0x1'));var moment=require('moment');var BPromise=require(_0xe63e('0x2'));var rs=require(_0xe63e('0x3'));var fs=require('fs');var Redis=require(_0xe63e('0x4'));var db=require(_0xe63e('0x5'))['db'];var utils=require(_0xe63e('0x6'));var logger=require(_0xe63e('0x7'))(_0xe63e('0x8'));var config=require(_0xe63e('0x9'));var jayson=require(_0xe63e('0xa'));var client=jayson[_0xe63e('0xb')][_0xe63e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x135031,_0x900144,_0x569bb5){return new BPromise(function(_0x39df56,_0x9c3aa4){return client['request'](_0x135031,_0x569bb5)[_0xe63e('0xd')](function(_0x3153a1){logger[_0xe63e('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x900144,_0xe63e('0xf'));logger[_0xe63e('0x10')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x900144,'request\x20sent',JSON[_0xe63e('0x11')](_0x3153a1));if(_0x3153a1[_0xe63e('0x12')]){if(_0x3153a1[_0xe63e('0x12')]['code']===0x1f4){logger['error'](_0xe63e('0x13'),_0x900144,_0x3153a1[_0xe63e('0x12')]['message']);return _0x9c3aa4(_0x3153a1[_0xe63e('0x12')][_0xe63e('0x14')]);}logger[_0xe63e('0x12')](_0xe63e('0x13'),_0x900144,_0x3153a1['error'][_0xe63e('0x14')]);return _0x39df56(_0x3153a1[_0xe63e('0x12')][_0xe63e('0x14')]);}else{logger['info'](_0xe63e('0x13'),_0x900144,'request\x20sent');_0x39df56(_0x3153a1[_0xe63e('0x15')][_0xe63e('0x14')]);}})['catch'](function(_0x578452){logger[_0xe63e('0x12')](_0xe63e('0x13'),_0x900144,_0x578452);_0x9c3aa4(_0x578452);});});}exports[_0xe63e('0x16')]=function(_0x4e12a8){var _0x120873=this;return new Promise(function(_0x19c37f,_0x2129aa){return db[_0xe63e('0x17')][_0xe63e('0x18')](_0x4e12a8['body'],{'raw':_0x4e12a8[_0xe63e('0x19')]?_0x4e12a8['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x543c3d){logger['info'](_0xe63e('0x16'),_0x4e12a8);logger[_0xe63e('0x10')](_0xe63e('0x16'),_0x4e12a8,JSON[_0xe63e('0x11')](_0x543c3d));_0x19c37f(_0x543c3d);})[_0xe63e('0x1a')](function(_0x266b4d){logger[_0xe63e('0x12')](_0xe63e('0x16'),_0x266b4d[_0xe63e('0x14')],_0x4e12a8);_0x2129aa(_0x120873['error'](0x1f4,_0x266b4d[_0xe63e('0x14')]));});});};exports[_0xe63e('0x1b')]=function(_0x3a28b6){var _0x2b89ee=this;return new Promise(function(_0x5da8e7,_0x24ca41){return db[_0xe63e('0x17')]['update'](_0x3a28b6[_0xe63e('0x1c')],{'raw':_0x3a28b6[_0xe63e('0x19')]?_0x3a28b6[_0xe63e('0x19')][_0xe63e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a28b6[_0xe63e('0x19')]?_0x3a28b6[_0xe63e('0x19')][_0xe63e('0x1e')]||null:null,'attributes':_0x3a28b6[_0xe63e('0x19')]?_0x3a28b6[_0xe63e('0x19')][_0xe63e('0x1f')]||null:null,'limit':_0x3a28b6[_0xe63e('0x19')]?_0x3a28b6['options']['limit']||null:null})[_0xe63e('0xd')](function(_0x36534f){logger[_0xe63e('0xe')](_0xe63e('0x1b'),_0x3a28b6);logger[_0xe63e('0x10')](_0xe63e('0x1b'),_0x3a28b6,JSON[_0xe63e('0x11')](_0x36534f));_0x5da8e7(_0x36534f);})[_0xe63e('0x1a')](function(_0x56fd9e){logger[_0xe63e('0x12')](_0xe63e('0x1b'),_0x56fd9e['message'],_0x3a28b6);_0x24ca41(_0x2b89ee[_0xe63e('0x12')](0x1f4,_0x56fd9e['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 02b6f7a..61a32cd 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 _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1ca7ed,_0x2cccb4){_0x1ca7ed=_0x1ca7ed-0x0;var _0x5d706a=_0x5f2f[_0x1ca7ed];return _0x5d706a;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/',auth[_0xf5f2('0xa')](),controller['create']);router[_0xf5f2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file +var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','delete'];(function(_0x228608,_0x26364d){var _0xb65159=function(_0x38ddc4){while(--_0x38ddc4){_0x228608['push'](_0x228608['shift']());}};_0xb65159(++_0x26364d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 49a1c15..976bca0 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 _0xe9c2=['DATE','NOW','sequelize','exports','STRING','ENUM','account','agent','queue'];(function(_0x3aa5e1,_0x5ef9df){var _0x114112=function(_0x40169b){while(--_0x40169b){_0x3aa5e1['push'](_0x3aa5e1['shift']());}};_0x114112(++_0x5ef9df);}(_0xe9c2,0xd1));var _0x2e9c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe9c2[_0x2641f9];return _0x585741;};'use strict';var moment=require('moment');var Sequelize=require(_0x2e9c('0x0'));module[_0x2e9c('0x1')]={'uniqueid':{'type':Sequelize[_0x2e9c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2e9c('0x3')](_0x2e9c('0x4'),_0x2e9c('0x5'),_0x2e9c('0x6')),'allowNull':![],'defaultValue':_0x2e9c('0x6')},'transferredAt':{'type':Sequelize[_0x2e9c('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x2e9c('0x8')]}}; \ No newline at end of file +var _0xa6cb=['account','agent','queue','DATE','NOW','sequelize','exports','ENUM'];(function(_0x25ad1c,_0x545903){var _0x149e31=function(_0x5c284d){while(--_0x5c284d){_0x25ad1c['push'](_0x25ad1c['shift']());}};_0x149e31(++_0x545903);}(_0xa6cb,0x1cd));var _0xba6c=function(_0x58b99,_0x1f3434){_0x58b99=_0x58b99-0x0;var _0x3c12ac=_0xa6cb[_0x58b99];return _0x3c12ac;};'use strict';var moment=require('moment');var Sequelize=require(_0xba6c('0x0'));module[_0xba6c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xba6c('0x2')](_0xba6c('0x3'),_0xba6c('0x4'),'queue'),'allowNull':![],'defaultValue':_0xba6c('0x5')},'transferredAt':{'type':Sequelize[_0xba6c('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xba6c('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 69db866..c22d2fc 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 _0xeac2=['ChatTransferReport','rawAttributes','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','then','catch','show','params','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','error','stack','name','send','index'];(function(_0x594ece,_0x2a1f27){var _0x471bc4=function(_0x31941c){while(--_0x31941c){_0x594ece['push'](_0x594ece['shift']());}};_0x471bc4(++_0x2a1f27);}(_0xeac2,0x140));var _0x2eac=function(_0x5005ee,_0x377119){_0x5005ee=_0x5005ee-0x0;var _0x382193=_0xeac2[_0x5005ee];return _0x382193;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2eac('0x0'));var zipdir=require(_0x2eac('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2eac('0x2'));var moment=require(_0x2eac('0x3'));var BPromise=require(_0x2eac('0x4'));var Mustache=require(_0x2eac('0x5'));var util=require(_0x2eac('0x6'));var path=require(_0x2eac('0x7'));var sox=require(_0x2eac('0x8'));var csv=require(_0x2eac('0x9'));var ejs=require(_0x2eac('0xa'));var fs=require('fs');var fs_extra=require(_0x2eac('0xb'));var _=require('lodash');var squel=require(_0x2eac('0xc'));var crypto=require('crypto');var jsforce=require(_0x2eac('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2eac('0xe'));var Papa=require(_0x2eac('0xf'));var Redis=require(_0x2eac('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2eac('0x11'))(_0x2eac('0x12'));var utils=require(_0x2eac('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2eac('0x14'))['db'];function respondWithStatusCode(_0x5d278f,_0x21ce4f){_0x21ce4f=_0x21ce4f||0xcc;return function(_0x242ebc){if(_0x242ebc){return _0x5d278f[_0x2eac('0x15')](_0x21ce4f);}return _0x5d278f[_0x2eac('0x16')](_0x21ce4f)[_0x2eac('0x17')]();};}function respondWithResult(_0x5730a5,_0x3ad2d8){_0x3ad2d8=_0x3ad2d8||0xc8;return function(_0x2f4eeb){if(_0x2f4eeb){return _0x5730a5[_0x2eac('0x16')](_0x3ad2d8)['json'](_0x2f4eeb);}};}function respondWithFilteredResult(_0x244202,_0x3212b9){return function(_0x8192d6){if(_0x8192d6){var _0x219ac1=typeof _0x3212b9[_0x2eac('0x18')]===_0x2eac('0x19')&&typeof _0x3212b9[_0x2eac('0x1a')]===_0x2eac('0x19');var _0x3a3e22=_0x8192d6[_0x2eac('0x1b')];var _0x4a9aaa=_0x219ac1?0x0:_0x3212b9[_0x2eac('0x18')];var _0x262d49=_0x219ac1?_0x8192d6[_0x2eac('0x1b')]:_0x3212b9[_0x2eac('0x18')]+_0x3212b9['limit'];var _0x1b7229;if(_0x262d49>=_0x3a3e22){_0x262d49=_0x3a3e22;_0x1b7229=0xc8;}else{_0x1b7229=0xce;}_0x244202[_0x2eac('0x16')](_0x1b7229);return _0x244202[_0x2eac('0x1c')](_0x2eac('0x1d'),_0x4a9aaa+'-'+_0x262d49+'/'+_0x3a3e22)[_0x2eac('0x1e')](_0x8192d6);}return null;};}function patchUpdates(_0x3f4cd2){return function(_0x3660d9){try{jsonpatch[_0x2eac('0x1f')](_0x3660d9,_0x3f4cd2,!![]);}catch(_0x13af57){return BPromise['reject'](_0x13af57);}return _0x3660d9[_0x2eac('0x20')]();};}function saveUpdates(_0x51c2d4,_0xc76f00){return function(_0x45417e){if(_0x45417e){return _0x45417e[_0x2eac('0x21')](_0x51c2d4)['then'](function(_0x38800e){return _0x38800e;});}return null;};}function removeEntity(_0x487ec5,_0x42e478){return function(_0x16f9ee){if(_0x16f9ee){return _0x16f9ee[_0x2eac('0x22')]()['then'](function(){_0x487ec5[_0x2eac('0x16')](0xcc)[_0x2eac('0x17')]();});}};}function handleEntityNotFound(_0x500f34,_0x41e090){return function(_0x355916){if(!_0x355916){_0x500f34[_0x2eac('0x15')](0x194);}return _0x355916;};}function handleError(_0x18bab8,_0x3c617c){_0x3c617c=_0x3c617c||0x1f4;return function(_0x5c5d81){logger[_0x2eac('0x23')](_0x5c5d81[_0x2eac('0x24')]);if(_0x5c5d81[_0x2eac('0x25')]){delete _0x5c5d81['name'];}_0x18bab8[_0x2eac('0x16')](_0x3c617c)[_0x2eac('0x26')](_0x5c5d81);};}exports[_0x2eac('0x27')]=function(_0x4de2a4,_0x139fad){var _0x29c388={},_0x3ef390={},_0x1894d7={'count':0x0,'rows':[]};var _0x35f5e4=_['map'](db[_0x2eac('0x28')][_0x2eac('0x29')],function(_0x5dabdf){return{'name':_0x5dabdf['fieldName'],'type':_0x5dabdf[_0x2eac('0x2a')][_0x2eac('0x2b')]};});_0x3ef390['model']=_[_0x2eac('0x2c')](_0x35f5e4,_0x2eac('0x25'));_0x3ef390[_0x2eac('0x2d')]=_[_0x2eac('0x2e')](_0x4de2a4[_0x2eac('0x2d')]);_0x3ef390[_0x2eac('0x2f')]=_['intersection'](_0x3ef390[_0x2eac('0x30')],_0x3ef390[_0x2eac('0x2d')]);_0x29c388[_0x2eac('0x31')]=_[_0x2eac('0x32')](_0x3ef390[_0x2eac('0x30')],qs[_0x2eac('0x33')](_0x4de2a4[_0x2eac('0x2d')]['fields']));_0x29c388[_0x2eac('0x31')]=_0x29c388[_0x2eac('0x31')][_0x2eac('0x34')]?_0x29c388['attributes']:_0x3ef390[_0x2eac('0x30')];if(!_0x4de2a4['query'][_0x2eac('0x35')]('nolimit')){_0x29c388['limit']=qs['limit'](_0x4de2a4[_0x2eac('0x2d')]['limit']);_0x29c388[_0x2eac('0x18')]=qs[_0x2eac('0x18')](_0x4de2a4['query']['offset']);}_0x29c388[_0x2eac('0x36')]=qs[_0x2eac('0x37')](_0x4de2a4[_0x2eac('0x2d')][_0x2eac('0x37')]);_0x29c388['where']=qs[_0x2eac('0x2f')](_[_0x2eac('0x38')](_0x4de2a4[_0x2eac('0x2d')],_0x3ef390[_0x2eac('0x2f')]),_0x35f5e4);if(_0x4de2a4[_0x2eac('0x2d')][_0x2eac('0x39')]){_0x29c388[_0x2eac('0x3a')]=_['merge'](_0x29c388[_0x2eac('0x3a')],{'$or':_[_0x2eac('0x2c')](_0x35f5e4,function(_0x1d236b){if(_0x1d236b[_0x2eac('0x2a')]!==_0x2eac('0x3b')){var _0x5abe29={};_0x5abe29[_0x1d236b['name']]={'$like':'%'+_0x4de2a4[_0x2eac('0x2d')][_0x2eac('0x39')]+'%'};return _0x5abe29;}})});}_0x29c388=_[_0x2eac('0x3c')]({},_0x29c388,_0x4de2a4[_0x2eac('0x3d')]);var _0x233d4f={'where':_0x29c388[_0x2eac('0x3a')]};return db[_0x2eac('0x28')]['count'](_0x233d4f)['then'](function(_0x40d373){_0x1894d7[_0x2eac('0x1b')]=_0x40d373;if(_0x4de2a4[_0x2eac('0x2d')][_0x2eac('0x3e')]){_0x29c388[_0x2eac('0x3f')]=[{'all':!![]}];}return db[_0x2eac('0x28')]['findAll'](_0x29c388);})[_0x2eac('0x40')](function(_0x253889){_0x1894d7['rows']=_0x253889;return _0x1894d7;})[_0x2eac('0x40')](respondWithFilteredResult(_0x139fad,_0x29c388))[_0x2eac('0x41')](handleError(_0x139fad,null));};exports[_0x2eac('0x42')]=function(_0x54e007,_0x4fe545){var _0x2bb41c={'raw':!![],'where':{'id':_0x54e007[_0x2eac('0x43')]['id']}},_0x4db80a={};_0x4db80a[_0x2eac('0x30')]=_[_0x2eac('0x2e')](db[_0x2eac('0x28')][_0x2eac('0x29')]);_0x4db80a[_0x2eac('0x2d')]=_[_0x2eac('0x2e')](_0x54e007[_0x2eac('0x2d')]);_0x4db80a[_0x2eac('0x2f')]=_[_0x2eac('0x32')](_0x4db80a[_0x2eac('0x30')],_0x4db80a[_0x2eac('0x2d')]);_0x2bb41c[_0x2eac('0x31')]=_['intersection'](_0x4db80a[_0x2eac('0x30')],qs['fields'](_0x54e007[_0x2eac('0x2d')][_0x2eac('0x33')]));_0x2bb41c['attributes']=_0x2bb41c[_0x2eac('0x31')][_0x2eac('0x34')]?_0x2bb41c[_0x2eac('0x31')]:_0x4db80a[_0x2eac('0x30')];if(_0x54e007[_0x2eac('0x2d')][_0x2eac('0x3e')]){_0x2bb41c[_0x2eac('0x3f')]=[{'all':!![]}];}_0x2bb41c=_[_0x2eac('0x3c')]({},_0x2bb41c,_0x54e007[_0x2eac('0x3d')]);return db[_0x2eac('0x28')][_0x2eac('0x44')](_0x2bb41c)[_0x2eac('0x40')](handleEntityNotFound(_0x4fe545,null))['then'](respondWithResult(_0x4fe545,null))['catch'](handleError(_0x4fe545,null));};exports[_0x2eac('0x45')]=function(_0x3663f6,_0x51f9b8){return db['ChatTransferReport']['create'](_0x3663f6[_0x2eac('0x46')],{})[_0x2eac('0x40')](respondWithResult(_0x51f9b8,0xc9))[_0x2eac('0x41')](handleError(_0x51f9b8,null));};exports[_0x2eac('0x21')]=function(_0x2f85fb,_0x2db136){if(_0x2f85fb[_0x2eac('0x46')]['id']){delete _0x2f85fb[_0x2eac('0x46')]['id'];}return db[_0x2eac('0x28')]['find']({'where':{'id':_0x2f85fb['params']['id']}})['then'](handleEntityNotFound(_0x2db136,null))[_0x2eac('0x40')](saveUpdates(_0x2f85fb['body'],null))[_0x2eac('0x40')](respondWithResult(_0x2db136,null))['catch'](handleError(_0x2db136,null));};exports[_0x2eac('0x22')]=function(_0x4bb75f,_0x2745f8){return db[_0x2eac('0x28')][_0x2eac('0x44')]({'where':{'id':_0x4bb75f[_0x2eac('0x43')]['id']}})['then'](handleEntityNotFound(_0x2745f8,null))[_0x2eac('0x40')](removeEntity(_0x2745f8,null))[_0x2eac('0x41')](handleError(_0x2745f8,null));};exports[_0x2eac('0x47')]=function(_0x58c76d,_0x306490){return db[_0x2eac('0x28')][_0x2eac('0x47')]()[_0x2eac('0x40')](respondWithResult(_0x306490,null))[_0x2eac('0x41')](handleError(_0x306490,null));}; \ No newline at end of file +var _0x2559=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','options','includeAll','include','rows','show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','stack','name','send','map','ChatTransferReport','rawAttributes','fieldName','type','model','query'];(function(_0x462ca7,_0x40a1f9){var _0x503899=function(_0x3ff6e5){while(--_0x3ff6e5){_0x462ca7['push'](_0x462ca7['shift']());}};_0x503899(++_0x40a1f9);}(_0x2559,0xe5));var _0x9255=function(_0x580b03,_0x5bf4e3){_0x580b03=_0x580b03-0x0;var _0x35d78b=_0x2559[_0x580b03];return _0x35d78b;};'use strict';var emlformat=require(_0x9255('0x0'));var rimraf=require(_0x9255('0x1'));var zipdir=require(_0x9255('0x2'));var jsonpatch=require(_0x9255('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9255('0x4'));var Mustache=require('mustache');var util=require(_0x9255('0x5'));var path=require(_0x9255('0x6'));var sox=require('sox');var csv=require(_0x9255('0x7'));var ejs=require(_0x9255('0x8'));var fs=require('fs');var fs_extra=require(_0x9255('0x9'));var _=require(_0x9255('0xa'));var squel=require(_0x9255('0xb'));var crypto=require(_0x9255('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9255('0xd'));var toCsv=require(_0x9255('0x7'));var querystring=require('querystring');var Papa=require(_0x9255('0xe'));var Redis=require(_0x9255('0xf'));var authService=require(_0x9255('0x10'));var qs=require(_0x9255('0x11'));var as=require(_0x9255('0x12'));var hardwareService=require(_0x9255('0x13'));var logger=require(_0x9255('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9255('0x15'));var db=require(_0x9255('0x16'))['db'];function respondWithStatusCode(_0x62bd14,_0x31495e){_0x31495e=_0x31495e||0xcc;return function(_0x4f5d87){if(_0x4f5d87){return _0x62bd14[_0x9255('0x17')](_0x31495e);}return _0x62bd14[_0x9255('0x18')](_0x31495e)[_0x9255('0x19')]();};}function respondWithResult(_0x5e18a4,_0x160781){_0x160781=_0x160781||0xc8;return function(_0x5cdbf4){if(_0x5cdbf4){return _0x5e18a4[_0x9255('0x18')](_0x160781)['json'](_0x5cdbf4);}};}function respondWithFilteredResult(_0x551530,_0x42f0f6){return function(_0x3c4193){if(_0x3c4193){var _0x427da0=typeof _0x42f0f6[_0x9255('0x1a')]==='undefined'&&typeof _0x42f0f6['limit']===_0x9255('0x1b');var _0x4bbfce=_0x3c4193[_0x9255('0x1c')];var _0xb20921=_0x427da0?0x0:_0x42f0f6[_0x9255('0x1a')];var _0x5549e1=_0x427da0?_0x3c4193[_0x9255('0x1c')]:_0x42f0f6[_0x9255('0x1a')]+_0x42f0f6[_0x9255('0x1d')];var _0x1181aa;if(_0x5549e1>=_0x4bbfce){_0x5549e1=_0x4bbfce;_0x1181aa=0xc8;}else{_0x1181aa=0xce;}_0x551530[_0x9255('0x18')](_0x1181aa);return _0x551530[_0x9255('0x1e')](_0x9255('0x1f'),_0xb20921+'-'+_0x5549e1+'/'+_0x4bbfce)[_0x9255('0x20')](_0x3c4193);}return null;};}function patchUpdates(_0x2ca8be){return function(_0x56f29b){try{jsonpatch['apply'](_0x56f29b,_0x2ca8be,!![]);}catch(_0x121bc2){return BPromise[_0x9255('0x21')](_0x121bc2);}return _0x56f29b[_0x9255('0x22')]();};}function saveUpdates(_0x493034,_0x1808b2){return function(_0x1a7aa6){if(_0x1a7aa6){return _0x1a7aa6[_0x9255('0x23')](_0x493034)[_0x9255('0x24')](function(_0x1f7159){return _0x1f7159;});}return null;};}function removeEntity(_0x1e6ce6,_0x1b59c9){return function(_0x437db3){if(_0x437db3){return _0x437db3['destroy']()[_0x9255('0x24')](function(){_0x1e6ce6[_0x9255('0x18')](0xcc)[_0x9255('0x19')]();});}};}function handleEntityNotFound(_0x55dccf,_0x5a3179){return function(_0x2f04eb){if(!_0x2f04eb){_0x55dccf[_0x9255('0x17')](0x194);}return _0x2f04eb;};}function handleError(_0x5f4e8e,_0x1ed7d6){_0x1ed7d6=_0x1ed7d6||0x1f4;return function(_0x4aea82){logger['error'](_0x4aea82[_0x9255('0x25')]);if(_0x4aea82[_0x9255('0x26')]){delete _0x4aea82[_0x9255('0x26')];}_0x5f4e8e[_0x9255('0x18')](_0x1ed7d6)[_0x9255('0x27')](_0x4aea82);};}exports['index']=function(_0x407a4d,_0x3ef9c5){var _0x13534e={},_0x14ec89={},_0x128876={'count':0x0,'rows':[]};var _0x2e465e=_[_0x9255('0x28')](db[_0x9255('0x29')][_0x9255('0x2a')],function(_0x49fece){return{'name':_0x49fece[_0x9255('0x2b')],'type':_0x49fece[_0x9255('0x2c')]['key']};});_0x14ec89[_0x9255('0x2d')]=_[_0x9255('0x28')](_0x2e465e,_0x9255('0x26'));_0x14ec89[_0x9255('0x2e')]=_[_0x9255('0x2f')](_0x407a4d[_0x9255('0x2e')]);_0x14ec89[_0x9255('0x30')]=_[_0x9255('0x31')](_0x14ec89['model'],_0x14ec89['query']);_0x13534e[_0x9255('0x32')]=_['intersection'](_0x14ec89[_0x9255('0x2d')],qs[_0x9255('0x33')](_0x407a4d[_0x9255('0x2e')][_0x9255('0x33')]));_0x13534e['attributes']=_0x13534e['attributes'][_0x9255('0x34')]?_0x13534e[_0x9255('0x32')]:_0x14ec89['model'];if(!_0x407a4d['query'][_0x9255('0x35')](_0x9255('0x36'))){_0x13534e[_0x9255('0x1d')]=qs[_0x9255('0x1d')](_0x407a4d[_0x9255('0x2e')][_0x9255('0x1d')]);_0x13534e['offset']=qs[_0x9255('0x1a')](_0x407a4d['query'][_0x9255('0x1a')]);}_0x13534e['order']=qs[_0x9255('0x37')](_0x407a4d[_0x9255('0x2e')][_0x9255('0x37')]);_0x13534e[_0x9255('0x38')]=qs[_0x9255('0x30')](_['pick'](_0x407a4d[_0x9255('0x2e')],_0x14ec89[_0x9255('0x30')]),_0x2e465e);if(_0x407a4d[_0x9255('0x2e')]['filter']){_0x13534e['where']=_[_0x9255('0x39')](_0x13534e[_0x9255('0x38')],{'$or':_['map'](_0x2e465e,function(_0x5530b6){if(_0x5530b6[_0x9255('0x2c')]!=='VIRTUAL'){var _0x2e0709={};_0x2e0709[_0x5530b6[_0x9255('0x26')]]={'$like':'%'+_0x407a4d[_0x9255('0x2e')]['filter']+'%'};return _0x2e0709;}})});}_0x13534e=_['merge']({},_0x13534e,_0x407a4d[_0x9255('0x3a')]);var _0x8070cd={'where':_0x13534e[_0x9255('0x38')]};return db[_0x9255('0x29')][_0x9255('0x1c')](_0x8070cd)['then'](function(_0x7c7fec){_0x128876[_0x9255('0x1c')]=_0x7c7fec;if(_0x407a4d['query'][_0x9255('0x3b')]){_0x13534e[_0x9255('0x3c')]=[{'all':!![]}];}return db[_0x9255('0x29')]['findAll'](_0x13534e);})[_0x9255('0x24')](function(_0x5ad874){_0x128876[_0x9255('0x3d')]=_0x5ad874;return _0x128876;})[_0x9255('0x24')](respondWithFilteredResult(_0x3ef9c5,_0x13534e))['catch'](handleError(_0x3ef9c5,null));};exports[_0x9255('0x3e')]=function(_0x32f650,_0x156c93){var _0x3889ab={'raw':!![],'where':{'id':_0x32f650[_0x9255('0x3f')]['id']}},_0x1c409d={};_0x1c409d[_0x9255('0x2d')]=_[_0x9255('0x2f')](db[_0x9255('0x29')][_0x9255('0x2a')]);_0x1c409d[_0x9255('0x2e')]=_[_0x9255('0x2f')](_0x32f650['query']);_0x1c409d[_0x9255('0x30')]=_['intersection'](_0x1c409d['model'],_0x1c409d['query']);_0x3889ab[_0x9255('0x32')]=_[_0x9255('0x31')](_0x1c409d[_0x9255('0x2d')],qs[_0x9255('0x33')](_0x32f650['query'][_0x9255('0x33')]));_0x3889ab['attributes']=_0x3889ab['attributes']['length']?_0x3889ab[_0x9255('0x32')]:_0x1c409d[_0x9255('0x2d')];if(_0x32f650[_0x9255('0x2e')][_0x9255('0x3b')]){_0x3889ab['include']=[{'all':!![]}];}_0x3889ab=_[_0x9255('0x39')]({},_0x3889ab,_0x32f650[_0x9255('0x3a')]);return db['ChatTransferReport'][_0x9255('0x40')](_0x3889ab)[_0x9255('0x24')](handleEntityNotFound(_0x156c93,null))[_0x9255('0x24')](respondWithResult(_0x156c93,null))[_0x9255('0x41')](handleError(_0x156c93,null));};exports[_0x9255('0x42')]=function(_0x347b7b,_0x40303b){return db['ChatTransferReport'][_0x9255('0x42')](_0x347b7b['body'],{})[_0x9255('0x24')](respondWithResult(_0x40303b,0xc9))[_0x9255('0x41')](handleError(_0x40303b,null));};exports[_0x9255('0x23')]=function(_0x2f68a1,_0x54405a){if(_0x2f68a1['body']['id']){delete _0x2f68a1[_0x9255('0x43')]['id'];}return db[_0x9255('0x29')][_0x9255('0x40')]({'where':{'id':_0x2f68a1[_0x9255('0x3f')]['id']}})['then'](handleEntityNotFound(_0x54405a,null))[_0x9255('0x24')](saveUpdates(_0x2f68a1[_0x9255('0x43')],null))['then'](respondWithResult(_0x54405a,null))[_0x9255('0x41')](handleError(_0x54405a,null));};exports['destroy']=function(_0x1d3aad,_0xbe600a){return db[_0x9255('0x29')]['find']({'where':{'id':_0x1d3aad[_0x9255('0x3f')]['id']}})[_0x9255('0x24')](handleEntityNotFound(_0xbe600a,null))[_0x9255('0x24')](removeEntity(_0xbe600a,null))[_0x9255('0x41')](handleError(_0xbe600a,null));};exports[_0x9255('0x44')]=function(_0x4a2e9f,_0x12d819){return db[_0x9255('0x29')][_0x9255('0x44')]()[_0x9255('0x24')](respondWithResult(_0x12d819,null))[_0x9255('0x41')](handleError(_0x12d819,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index f1d706b..ffff963 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 _0xf555=['path','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api','bluebird','request-promise'];(function(_0x5497e,_0x380541){var _0x2316ce=function(_0x645feb){while(--_0x645feb){_0x5497e['push'](_0x5497e['shift']());}};_0x2316ce(++_0x380541);}(_0xf555,0x97));var _0x5f55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf555[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5f55('0x0'));var util=require(_0x5f55('0x1'));var logger=require('../../config/logger')(_0x5f55('0x2'));var moment=require('moment');var BPromise=require(_0x5f55('0x3'));var rp=require(_0x5f55('0x4'));var fs=require('fs');var path=require(_0x5f55('0x5'));var rimraf=require('rimraf');var config=require(_0x5f55('0x6'));var attributes=require(_0x5f55('0x7'));module['exports']=function(_0x2c6a58,_0x113537){return _0x2c6a58[_0x5f55('0x8')](_0x5f55('0x9'),attributes,{'tableName':_0x5f55('0xa'),'paranoid':![],'indexes':[{'name':_0x5f55('0xb'),'fields':[_0x5f55('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4cd5=['./chatTransferReport.attributes','exports','define','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x45a92c,_0x4d81a7){var _0x1f3097=function(_0x5c889f){while(--_0x5c889f){_0x45a92c['push'](_0x45a92c['shift']());}};_0x1f3097(++_0x4d81a7);}(_0x4cd5,0xe1));var _0x54cd=function(_0x4de2c0,_0x4822ea){_0x4de2c0=_0x4de2c0-0x0;var _0x440f3d=_0x4cd5[_0x4de2c0];return _0x440f3d;};'use strict';var _=require(_0x54cd('0x0'));var util=require('util');var logger=require(_0x54cd('0x1'))(_0x54cd('0x2'));var moment=require(_0x54cd('0x3'));var BPromise=require(_0x54cd('0x4'));var rp=require(_0x54cd('0x5'));var fs=require('fs');var path=require(_0x54cd('0x6'));var rimraf=require(_0x54cd('0x7'));var config=require(_0x54cd('0x8'));var attributes=require(_0x54cd('0x9'));module[_0x54cd('0xa')]=function(_0x1802ea,_0x23b2bb){return _0x1802ea[_0x54cd('0xb')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x54cd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index b9d7038..6df47e8 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 _0xd6c9=['ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','ChatTransferReport,\x20%s,\x20%s','error','message','info','result','catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','debug'];(function(_0x40dd56,_0x726ca5){var _0x4f850f=function(_0x5f899e){while(--_0x5f899e){_0x40dd56['push'](_0x40dd56['shift']());}};_0x4f850f(++_0x726ca5);}(_0xd6c9,0x128));var _0x9d6c=function(_0x3d0123,_0xcf2395){_0x3d0123=_0x3d0123-0x0;var _0x3ead32=_0xd6c9[_0x3d0123];return _0x3ead32;};'use strict';var _=require('lodash');var util=require(_0x9d6c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9d6c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d6c('0x2'))['db'];var utils=require(_0x9d6c('0x3'));var logger=require(_0x9d6c('0x4'))(_0x9d6c('0x5'));var config=require(_0x9d6c('0x6'));var jayson=require(_0x9d6c('0x7'));var client=jayson['client'][_0x9d6c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12f40b,_0x57298f,_0xa138e1){return new BPromise(function(_0x39a270,_0x4f16b0){return client[_0x9d6c('0x9')](_0x12f40b,_0xa138e1)[_0x9d6c('0xa')](function(_0x478b15){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x57298f,'request\x20sent');logger[_0x9d6c('0xb')](_0x9d6c('0xc'),_0x57298f,_0x9d6c('0xd'),JSON[_0x9d6c('0xe')](_0x478b15));if(_0x478b15['error']){if(_0x478b15['error'][_0x9d6c('0xf')]===0x1f4){logger['error'](_0x9d6c('0x10'),_0x57298f,_0x478b15[_0x9d6c('0x11')][_0x9d6c('0x12')]);return _0x4f16b0(_0x478b15['error'][_0x9d6c('0x12')]);}logger[_0x9d6c('0x11')](_0x9d6c('0x10'),_0x57298f,_0x478b15[_0x9d6c('0x11')]['message']);return _0x39a270(_0x478b15[_0x9d6c('0x11')][_0x9d6c('0x12')]);}else{logger[_0x9d6c('0x13')](_0x9d6c('0x10'),_0x57298f,_0x9d6c('0xd'));_0x39a270(_0x478b15[_0x9d6c('0x14')][_0x9d6c('0x12')]);}})[_0x9d6c('0x15')](function(_0x1dba5a){logger[_0x9d6c('0x11')](_0x9d6c('0x10'),_0x57298f,_0x1dba5a);_0x4f16b0(_0x1dba5a);});});} \ No newline at end of file +var _0x0766=['ChatTransferReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x9911a6,_0x3f751d){var _0x5b445d=function(_0x40a6b8){while(--_0x40a6b8){_0x9911a6['push'](_0x9911a6['shift']());}};_0x5b445d(++_0x3f751d);}(_0x0766,0x195));var _0x6076=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0766[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6076('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6076('0x1'));var rs=require(_0x6076('0x2'));var fs=require('fs');var Redis=require(_0x6076('0x3'));var db=require(_0x6076('0x4'))['db'];var utils=require(_0x6076('0x5'));var logger=require(_0x6076('0x6'))('rpc');var config=require(_0x6076('0x7'));var jayson=require(_0x6076('0x8'));var client=jayson[_0x6076('0x9')][_0x6076('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23849f,_0x24cb48,_0x2ba2e3){return new BPromise(function(_0x594496,_0x2ea0ae){return client[_0x6076('0xb')](_0x23849f,_0x2ba2e3)['then'](function(_0x2eaeb0){logger[_0x6076('0xc')](_0x6076('0xd'),_0x24cb48,_0x6076('0xe'));logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x24cb48,_0x6076('0xe'),JSON['stringify'](_0x2eaeb0));if(_0x2eaeb0['error']){if(_0x2eaeb0[_0x6076('0xf')][_0x6076('0x10')]===0x1f4){logger[_0x6076('0xf')](_0x6076('0xd'),_0x24cb48,_0x2eaeb0[_0x6076('0xf')]['message']);return _0x2ea0ae(_0x2eaeb0[_0x6076('0xf')]['message']);}logger[_0x6076('0xf')](_0x6076('0xd'),_0x24cb48,_0x2eaeb0[_0x6076('0xf')][_0x6076('0x11')]);return _0x594496(_0x2eaeb0[_0x6076('0xf')][_0x6076('0x11')]);}else{logger[_0x6076('0xc')](_0x6076('0xd'),_0x24cb48,'request\x20sent');_0x594496(_0x2eaeb0[_0x6076('0x12')][_0x6076('0x11')]);}})['catch'](function(_0x2be723){logger['error'](_0x6076('0xd'),_0x24cb48,_0x2be723);_0x2ea0ae(_0x2be723);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index d4919b6..72716b6 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 _0x8598=['../../components/interaction/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','get','/describe','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x1d0b9b,_0x1d8d85){var _0x3e57ca=function(_0x45c9cf){while(--_0x45c9cf){_0x1d0b9b['push'](_0x1d0b9b['shift']());}};_0x3e57ca(++_0x1d8d85);}(_0x8598,0xcb));var _0x8859=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0x8598[_0x37a79c];return _0x561d89;};'use strict';var multer=require(_0x8859('0x0'));var util=require(_0x8859('0x1'));var path=require(_0x8859('0x2'));var timeout=require(_0x8859('0x3'));var express=require('express');var router=express[_0x8859('0x4')]();var fs_extra=require(_0x8859('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8859('0x6'));var config=require(_0x8859('0x7'));var controller=require(_0x8859('0x8'));router['get']('/',auth[_0x8859('0x9')](),controller['index']);router[_0x8859('0xa')](_0x8859('0xb'),auth[_0x8859('0x9')](),controller['describe']);router[_0x8859('0xa')](_0x8859('0xc'),auth[_0x8859('0x9')](),controller[_0x8859('0xd')]);router[_0x8859('0xe')]('/',auth[_0x8859('0x9')](),controller[_0x8859('0xf')]);router[_0x8859('0x10')]('/:id',auth[_0x8859('0x9')](),controller['update']);router[_0x8859('0x11')](_0x8859('0xc'),auth['isAuthenticated'](),controller[_0x8859('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb544=['create','put','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post'];(function(_0x139a4f,_0x5c6d66){var _0x46ed1c=function(_0x1190e4){while(--_0x1190e4){_0x139a4f['push'](_0x139a4f['shift']());}};_0x46ed1c(++_0x5c6d66);}(_0xb544,0xd0));var _0x4b54=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xb544[_0x565ed7];return _0x183ad7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4b54('0x0'));var timeout=require(_0x4b54('0x1'));var express=require(_0x4b54('0x2'));var router=express[_0x4b54('0x3')]();var fs_extra=require(_0x4b54('0x4'));var auth=require(_0x4b54('0x5'));var interaction=require(_0x4b54('0x6'));var config=require(_0x4b54('0x7'));var controller=require('./chatTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4b54('0x8')]('/describe',auth[_0x4b54('0x9')](),controller['describe']);router[_0x4b54('0x8')](_0x4b54('0xa'),auth['isAuthenticated'](),controller[_0x4b54('0xb')]);router[_0x4b54('0xc')]('/',auth[_0x4b54('0x9')](),controller[_0x4b54('0xd')]);router[_0x4b54('0xe')](_0x4b54('0xa'),auth[_0x4b54('0x9')](),controller['update']);router[_0x4b54('0xf')](_0x4b54('0xa'),auth[_0x4b54('0x9')](),controller['destroy']);module[_0x4b54('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index e93140d..6278578 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 _0xfde6=['star','TEXT','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','address','STRING','email','Agent','#ffffff','INTEGER','ENUM','rounded','squared','Chat','Send','Contact\x20us','BOOLEAN','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Feedback','thumb'];(function(_0x2f3fd7,_0x10fcf7){var _0x526d8d=function(_0x55f413){while(--_0x55f413){_0x2f3fd7['push'](_0x2f3fd7['shift']());}};_0x526d8d(++_0x10fcf7);}(_0xfde6,0x15c));var _0x6fde=function(_0x16e385,_0x4e8db2){_0x16e385=_0x16e385-0x0;var _0x78c03e=_0xfde6[_0x16e385];return _0x78c03e;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6fde('0x0'));module[_0x6fde('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6fde('0x2')},'description':{'type':Sequelize[_0x6fde('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x6fde('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x6fde('0x4')},'key':{'type':Sequelize[_0x6fde('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6fde('0x3')],'defaultValue':_0x6fde('0x5')},'customerAlias':{'type':Sequelize[_0x6fde('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6fde('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6fde('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6fde('0x3')],'allowNull':![],'defaultValue':_0x6fde('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6fde('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x6fde('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6fde('0x8')](_0x6fde('0x9'),_0x6fde('0xa')),'defaultValue':_0x6fde('0x9')},'header_online':{'type':Sequelize[_0x6fde('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x6fde('0xb')},'offline_chat_button':{'type':Sequelize[_0x6fde('0x3')],'defaultValue':_0x6fde('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x6fde('0xd')},'download_transcript':{'type':Sequelize[_0x6fde('0xe')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x6fde('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x6fde('0xe')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x6fde('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x6fde('0x3')],'defaultValue':_0x6fde('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0x6fde('0x3')],'defaultValue':_0x6fde('0x10')},'noteTitle':{'type':Sequelize[_0x6fde('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6fde('0x11')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x6fde('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x6fde('0xe')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x6fde('0xe')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6fde('0xe')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6fde('0x3')],'defaultValue':_0x6fde('0x12')},'ratingType':{'type':Sequelize[_0x6fde('0x8')]('star',_0x6fde('0x13')),'defaultValue':_0x6fde('0x14')},'ratingStarsNumber':{'type':Sequelize[_0x6fde('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6fde('0x15')],'defaultValue':function(){return JSON[_0x6fde('0x16')]({'items':[{'type':_0x6fde('0x17'),'variable':null,'config':{'placeholder':_0x6fde('0x18'),'type':_0x6fde('0x19'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x6fde('0x17'),'props':{'title':_0x6fde('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x6fde('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x6fde('0x1a')](_0x6fde('0x1b'))?JSON[_0x6fde('0x1c')](this['getDataValue'](_0x6fde('0x1b'))):{};},'set':function(_0xd60a21){return this[_0x6fde('0x1d')](_0x6fde('0x1b'),JSON['stringify'](_0xd60a21));}},'offlineForm':{'type':Sequelize[_0x6fde('0x15')],'defaultValue':function(){return JSON[_0x6fde('0x16')]({'items':[{'type':_0x6fde('0x17'),'props':{'title':_0x6fde('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x6fde('0x4'),'type':'email'},'variable':null},{'type':_0x6fde('0x1e'),'config':{'placeholder':'Comments'},'props':{'title':_0x6fde('0x1f'),'helpText':_0x6fde('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x6fde('0x1a')](_0x6fde('0x21'))?JSON['parse'](this[_0x6fde('0x1a')]('offlineForm')):{};},'set':function(_0x2fd6c8){return this['setDataValue']('offlineForm',JSON['stringify'](_0x2fd6c8));}},'token':{'type':Sequelize[_0x6fde('0x3')],'defaultValue':function(){return rs[_0x6fde('0x22')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6fde('0xe')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x6fde('0xe')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6fde('0x3')]},'waitingTitle':{'type':Sequelize[_0x6fde('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6fde('0x23')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x6fde('0x24')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x6fde('0x25')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6fde('0x26')},'skipUnmanaged':{'type':Sequelize[_0x6fde('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x6fde('0x3')],'defaultValue':_0x6fde('0xc')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x6fde('0xe')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x6fde('0xe')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x6fde('0x3')]},'notificationTemplate':{'type':Sequelize[_0x6fde('0x15')],'defaultValue':function(){return _0x6fde('0x27');}},'notificationSound':{'type':Sequelize[_0x6fde('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6fde('0xe')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x6fde('0xe')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x6fde('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x6fde('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6fde('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x6fde('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x6fde('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x6fde('0x3')]},'customerAvatar':{'type':Sequelize[_0x6fde('0x15')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6fde('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x6fde('0x3')],'allowNull':![],'defaultValue':_0x6fde('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6fde('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6fde('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6fde('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x6fde('0x3')],'defaultValue':_0x6fde('0x29')},'systemAvatar':{'type':Sequelize[_0x6fde('0x15')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6fde('0x7')],'comment':_0x6fde('0x2a')},'mandatoryDisposition':{'type':Sequelize[_0x6fde('0xe')],'defaultValue':![],'comment':_0x6fde('0x2b'),'set':function(_0x470aa1){if(!_0x470aa1)this[_0x6fde('0x1d')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x470aa1);}},'vidaooEscalation':{'type':Sequelize[_0x6fde('0xe')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6fde('0x3')]},'vidaooTopic':{'type':Sequelize[_0x6fde('0x3')],'allowNull':![],'defaultValue':_0x6fde('0x2c')},'vidaooNote':{'type':Sequelize[_0x6fde('0x3')],'defaultValue':function(){return _0x6fde('0x2d');}},'vidaooMetadata':{'type':Sequelize[_0x6fde('0x15')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x6fde('0xe')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x6fde('0x15')]}}; \ No newline at end of file +var _0x62b4=['Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','rounded','Chat','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x62b4,0x174));var _0x462b=function(_0x2e7f1e,_0x32f286){_0x2e7f1e=_0x2e7f1e-0x0;var _0x3dffa5=_0x62b4[_0x2e7f1e];return _0x3dffa5;};'use strict';var Sequelize=require(_0x462b('0x0'));var rs=require(_0x462b('0x1'));module[_0x462b('0x2')]={'name':{'type':Sequelize[_0x462b('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x462b('0x3')],'allowNull':![],'unique':_0x462b('0x4')},'description':{'type':Sequelize[_0x462b('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x462b('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x462b('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x462b('0x3')],'defaultValue':_0x462b('0x6')},'customerAlias':{'type':Sequelize[_0x462b('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x462b('0x3')],'allowNull':![],'defaultValue':_0x462b('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x462b('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x462b('0x3')],'allowNull':![],'defaultValue':_0x462b('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x462b('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x462b('0x3')]},'animation':{'type':Sequelize[_0x462b('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x462b('0xb')]('rounded',_0x462b('0xc')),'defaultValue':_0x462b('0xd')},'header_online':{'type':Sequelize[_0x462b('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x462b('0x3')],'defaultValue':_0x462b('0xe')},'offline_chat_button':{'type':Sequelize[_0x462b('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x462b('0x3')],'defaultValue':_0x462b('0xf')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x462b('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x462b('0x3')],'defaultValue':_0x462b('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x462b('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x462b('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x462b('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x462b('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x462b('0x3')],'defaultValue':_0x462b('0x13')},'noteTitle':{'type':Sequelize[_0x462b('0x3')],'defaultValue':_0x462b('0x14')},'placeholderMessage':{'type':Sequelize[_0x462b('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x462b('0x3')],'defaultValue':_0x462b('0x15')},'closingMessageButton':{'type':Sequelize[_0x462b('0x3')],'defaultValue':_0x462b('0x16')},'skipMessageButton':{'type':Sequelize[_0x462b('0x3')],'defaultValue':_0x462b('0x17')},'conditionAgreement':{'type':Sequelize[_0x462b('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x462b('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x462b('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x462b('0x3')],'defaultValue':_0x462b('0x18')},'ratingType':{'type':Sequelize[_0x462b('0xb')](_0x462b('0x19'),_0x462b('0x1a')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x462b('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x462b('0x11')],'defaultValue':function(){return JSON[_0x462b('0x1b')]({'items':[{'type':_0x462b('0x1c'),'variable':null,'config':{'placeholder':_0x462b('0x1d'),'type':_0x462b('0x1e'),'required':!![]},'props':{'title':_0x462b('0x1d'),'helpText':''}},{'type':_0x462b('0x1c'),'props':{'title':_0x462b('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x462b('0x5'),'type':_0x462b('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x462b('0x1f')](_0x462b('0x20'))?JSON[_0x462b('0x21')](this[_0x462b('0x1f')](_0x462b('0x20'))):{};},'set':function(_0x550650){return this[_0x462b('0x22')](_0x462b('0x20'),JSON['stringify'](_0x550650));}},'offlineForm':{'type':Sequelize[_0x462b('0x11')],'defaultValue':function(){return JSON[_0x462b('0x1b')]({'items':[{'type':_0x462b('0x1c'),'props':{'title':_0x462b('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x462b('0x5'),'type':_0x462b('0x5')},'variable':null},{'type':_0x462b('0x23'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0x462b('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x462b('0x1f')](_0x462b('0x25'))?JSON[_0x462b('0x21')](this[_0x462b('0x1f')](_0x462b('0x25'))):{};},'set':function(_0x5fb207){return this['setDataValue'](_0x462b('0x25'),JSON[_0x462b('0x1b')](_0x5fb207));}},'token':{'type':Sequelize[_0x462b('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x462b('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x462b('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x462b('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x462b('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x462b('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x462b('0x26')},'waitingMessage':{'type':Sequelize[_0x462b('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x462b('0x3')],'defaultValue':_0x462b('0x27')},'offlineMessageBody':{'type':Sequelize[_0x462b('0x3')],'defaultValue':_0x462b('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x462b('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x462b('0x3')],'defaultValue':_0x462b('0x29')},'skipUnmanaged':{'type':Sequelize[_0x462b('0x3')],'defaultValue':_0x462b('0x17')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x462b('0x16')},'enableCustomerAttachment':{'type':Sequelize[_0x462b('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x462b('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x462b('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x462b('0x2a');}},'notificationSound':{'type':Sequelize[_0x462b('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x462b('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x462b('0x3')],'defaultValue':_0x462b('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x462b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x462b('0x2c')},'verticalAlignment':{'type':Sequelize[_0x462b('0x9')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x462b('0x3')],'defaultValue':_0x462b('0x2d')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x462b('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x462b('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x462b('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x462b('0x3')],'allowNull':![],'defaultValue':_0x462b('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x462b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x462b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x462b('0x3')],'defaultValue':_0x462b('0x2f')},'systemAvatar':{'type':Sequelize[_0x462b('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x462b('0x9')],'comment':_0x462b('0x30')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x462b('0x31'),'set':function(_0x3994b0){if(!_0x3994b0)this[_0x462b('0x22')](_0x462b('0x32'),null);this[_0x462b('0x22')](_0x462b('0x33'),_0x3994b0);}},'vidaooEscalation':{'type':Sequelize[_0x462b('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x462b('0x34')},'vidaooNote':{'type':Sequelize[_0x462b('0x3')],'defaultValue':function(){return _0x462b('0x35');}},'vidaooMetadata':{'type':Sequelize[_0x462b('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x462b('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x462b('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 40cf2e4..020c07a 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 _0x3e74=['MailServerOut','Smtp','service','host','port','secure','auth','pass','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','MailAccountId','subjectOffline','mapValues','NotifyMailAccount','notifyMail','remove','addInteraction','omit','getInteractions','rawAttributes','Contact','User','Owner','fullname','color','tag','Command','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','Intervals','virtual','License','chatLicenseExceeded','some','utf8','remote','x-forwarded-for','x-real-ip','connection','replace','render','alignment','verticalAlignment','color_button','addApplications','sequelize','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./chatWebsite.socket','register','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','save','update','get','ChatWebsites','UserProfileResource','destroy','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','ChatWebsite','includeAll','rows','show','params','keys','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','Disposition','getDispositions','findOne','nolimit','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','chat','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','List','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','Contacts','contact','cf-connecting-ip','split','x-real-port','browser','format','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','firstName','lastName','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','UserId','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','offline','files','no\x20available\x20attributes','CompanyId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','toPairs','offlineMessageBody','mimetype','server','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','bulkCreate'];(function(_0x1f8ec2,_0x5bc78c){var _0xfa8cb7=function(_0x3a2c0c){while(--_0x3a2c0c){_0x1f8ec2['push'](_0x1f8ec2['shift']());}};_0xfa8cb7(++_0x5bc78c);}(_0x3e74,0x175));var _0x43e7=function(_0x1da044,_0x36a7b2){_0x1da044=_0x1da044-0x0;var _0x5099e6=_0x3e74[_0x1da044];return _0x5099e6;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];config[_0x43e7('0x15')]=_[_0x43e7('0x16')](config[_0x43e7('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x43e7('0x15')]));require(_0x43e7('0x17'))[_0x43e7('0x18')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x43e7('0x19')]({'port':0x232c});var client9002=jayson[_0x43e7('0x1a')][_0x43e7('0x19')]({'port':0x232a});var client9003=jayson[_0x43e7('0x1a')]['http']({'port':0x232b});var client9001=jayson['client'][_0x43e7('0x19')]({'port':0x2329});function respondWithRpcPromise(_0x264575,_0x273a32,_0x5d346f,_0x4b5a6b){return new BPromise(function(_0x446986,_0x1ca758){var _0x9037d3=_0x4b5a6b||client;return _0x9037d3[_0x43e7('0x1b')](_0x264575,_0x5d346f)[_0x43e7('0x1c')](function(_0x1f24fb){logger[_0x43e7('0x1d')](_0x43e7('0x1e'),_0x273a32,_0x43e7('0x1f'));logger[_0x43e7('0x20')](_0x43e7('0x21'),_0x273a32,_0x43e7('0x1f'),JSON['stringify'](_0x1f24fb));if(_0x1f24fb[_0x43e7('0x22')]){if(_0x1f24fb[_0x43e7('0x22')]['code']===0x1f4){logger[_0x43e7('0x22')](_0x43e7('0x1e'),_0x273a32,_0x1f24fb[_0x43e7('0x22')][_0x43e7('0x23')]);return _0x1ca758(_0x1f24fb[_0x43e7('0x22')][_0x43e7('0x23')]);}logger['error'](_0x43e7('0x1e'),_0x273a32,_0x1f24fb['error']['message']);return _0x446986(_0x1f24fb[_0x43e7('0x22')][_0x43e7('0x23')]);}else{logger['info'](_0x43e7('0x1e'),_0x273a32,'request\x20sent');_0x446986(_0x1f24fb[_0x43e7('0x24')]['message']);}})[_0x43e7('0x25')](function(_0x1b5f50){logger[_0x43e7('0x22')](_0x43e7('0x1e'),_0x273a32,_0x1b5f50);_0x1ca758(_0x1b5f50);});});}function respondWithStatusCode(_0x51f4d7,_0x52b7b3){_0x52b7b3=_0x52b7b3||0xcc;return function(_0x805b54){if(_0x805b54){return _0x51f4d7['sendStatus'](_0x52b7b3);}return _0x51f4d7[_0x43e7('0x26')](_0x52b7b3)[_0x43e7('0x27')]();};}function respondWithResult(_0x3565cf,_0xb1fc63){_0xb1fc63=_0xb1fc63||0xc8;return function(_0x5087d7){if(_0x5087d7){return _0x3565cf[_0x43e7('0x26')](_0xb1fc63)[_0x43e7('0x28')](_0x5087d7);}};}function respondWithFilteredResult(_0x45b675,_0x50f9f5){return function(_0x442c3b){if(_0x442c3b){var _0x84dd4d=typeof _0x50f9f5[_0x43e7('0x29')]===_0x43e7('0x2a')&&typeof _0x50f9f5[_0x43e7('0x2b')]===_0x43e7('0x2a');var _0x17df44=_0x442c3b[_0x43e7('0x2c')];var _0x2bde44=_0x84dd4d?0x0:_0x50f9f5[_0x43e7('0x29')];var _0x4bdb17=_0x84dd4d?_0x442c3b[_0x43e7('0x2c')]:_0x50f9f5[_0x43e7('0x29')]+_0x50f9f5[_0x43e7('0x2b')];var _0x183c81;if(_0x4bdb17>=_0x17df44){_0x4bdb17=_0x17df44;_0x183c81=0xc8;}else{_0x183c81=0xce;}_0x45b675[_0x43e7('0x26')](_0x183c81);return _0x45b675['set'](_0x43e7('0x2d'),_0x2bde44+'-'+_0x4bdb17+'/'+_0x17df44)[_0x43e7('0x28')](_0x442c3b);}return null;};}function patchUpdates(_0x30d47e){return function(_0x3f280d){try{jsonpatch['apply'](_0x3f280d,_0x30d47e,!![]);}catch(_0x5a7342){return BPromise['reject'](_0x5a7342);}return _0x3f280d[_0x43e7('0x2e')]();};}function saveUpdates(_0xbe6e28,_0x117c07){return function(_0x234fe6){if(_0x234fe6){return _0x234fe6[_0x43e7('0x2f')](_0xbe6e28)[_0x43e7('0x1c')](function(_0x485c6c){return _0x485c6c;});}return null;};}function removeEntity(_0x47baee,_0x4ac23d){return function(_0x59e5b2){if(_0x59e5b2){return _0x59e5b2['destroy']()['then'](function(){var _0x5cb753=_0x59e5b2[_0x43e7('0x30')]({'plain':!![]});var _0x49cda6=_0x43e7('0x31');return db[_0x43e7('0x32')][_0x43e7('0x33')]({'where':{'type':_0x49cda6,'resourceId':_0x5cb753['id']}})[_0x43e7('0x1c')](function(){return _0x59e5b2;});})[_0x43e7('0x1c')](function(){_0x47baee[_0x43e7('0x26')](0xcc)[_0x43e7('0x27')]();});}};}function handleEntityNotFound(_0x4f1a5f,_0x5332d9){return function(_0x5d84f4){if(!_0x5d84f4){_0x4f1a5f[_0x43e7('0x34')](0x194);}return _0x5d84f4;};}function handleError(_0xfe70e9,_0x199ff6){_0x199ff6=_0x199ff6||0x1f4;return function(_0x16cdba){logger[_0x43e7('0x22')](_0x16cdba[_0x43e7('0x35')]);if(_0x16cdba[_0x43e7('0x36')]){delete _0x16cdba[_0x43e7('0x36')];}_0xfe70e9['status'](_0x199ff6)[_0x43e7('0x37')](_0x16cdba);};}exports[_0x43e7('0x38')]=function(_0x4a3ea2,_0x2d54c1){var _0x4c0c7a={'include':[{'model':db[_0x43e7('0x39')],'as':_0x43e7('0x3a')}]},_0x44d8e4={},_0x2ad008={'count':0x0,'rows':[]};var _0x35ac85=_[_0x43e7('0x3b')](db['ChatWebsite']['rawAttributes'],function(_0x30dfa9){return{'name':_0x30dfa9[_0x43e7('0x3c')],'type':_0x30dfa9[_0x43e7('0x3d')][_0x43e7('0x3e')]};});_0x44d8e4[_0x43e7('0x3f')]=_['map'](_0x35ac85,_0x43e7('0x36'));_0x44d8e4[_0x43e7('0x40')]=_['keys'](_0x4a3ea2[_0x43e7('0x40')]);_0x44d8e4['filters']=_[_0x43e7('0x41')](_0x44d8e4['model'],_0x44d8e4[_0x43e7('0x40')]);_0x4c0c7a[_0x43e7('0x42')]=_[_0x43e7('0x41')](_0x44d8e4[_0x43e7('0x3f')],qs['fields'](_0x4a3ea2['query'][_0x43e7('0x43')]));_0x4c0c7a[_0x43e7('0x42')]=_0x4c0c7a[_0x43e7('0x42')][_0x43e7('0x44')]?_0x4c0c7a['attributes']:_0x44d8e4['model'];if(!_0x4a3ea2['query'][_0x43e7('0x45')]('nolimit')){_0x4c0c7a[_0x43e7('0x2b')]=qs['limit'](_0x4a3ea2['query'][_0x43e7('0x2b')]);_0x4c0c7a['offset']=qs[_0x43e7('0x29')](_0x4a3ea2[_0x43e7('0x40')][_0x43e7('0x29')]);}_0x4c0c7a[_0x43e7('0x46')]=qs['sort'](_0x4a3ea2[_0x43e7('0x40')][_0x43e7('0x47')]);_0x4c0c7a[_0x43e7('0x48')]=qs[_0x43e7('0x49')](_[_0x43e7('0x4a')](_0x4a3ea2[_0x43e7('0x40')],_0x44d8e4['filters']),_0x35ac85);if(_0x4a3ea2['query'][_0x43e7('0x4b')]){_0x4c0c7a[_0x43e7('0x48')]=_[_0x43e7('0x4c')](_0x4c0c7a['where'],{'$or':_['map'](_0x35ac85,function(_0x56489b){if(_0x56489b[_0x43e7('0x3d')]!==_0x43e7('0x4d')){var _0x52b098={};_0x52b098[_0x56489b[_0x43e7('0x36')]]={'$like':'%'+_0x4a3ea2[_0x43e7('0x40')][_0x43e7('0x4b')]+'%'};return _0x52b098;}})});}_0x4c0c7a=_['merge']({},_0x4c0c7a,_0x4a3ea2['options']);var _0x4ec263={'where':_0x4c0c7a['where']};return db[_0x43e7('0x4e')][_0x43e7('0x2c')](_0x4ec263)['then'](function(_0x23e7cb){_0x2ad008[_0x43e7('0x2c')]=_0x23e7cb;if(_0x4a3ea2[_0x43e7('0x40')][_0x43e7('0x4f')]){_0x4c0c7a['include']=[{'all':!![]}];}return db[_0x43e7('0x4e')]['findAll'](_0x4c0c7a);})['then'](function(_0x3e97da){_0x2ad008[_0x43e7('0x50')]=_0x3e97da;return _0x2ad008;})[_0x43e7('0x1c')](respondWithFilteredResult(_0x2d54c1,_0x4c0c7a))[_0x43e7('0x25')](handleError(_0x2d54c1,null));};exports[_0x43e7('0x51')]=function(_0x2351cf,_0x1cd87c){var _0x256ddd={'raw':![],'where':{'id':_0x2351cf[_0x43e7('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0x43e7('0x3a')}]},_0x473fca={};_0x473fca[_0x43e7('0x3f')]=_['keys'](db[_0x43e7('0x4e')]['rawAttributes']);_0x473fca[_0x43e7('0x40')]=_[_0x43e7('0x53')](_0x2351cf[_0x43e7('0x40')]);_0x473fca[_0x43e7('0x49')]=_[_0x43e7('0x41')](_0x473fca['model'],_0x473fca['query']);_0x256ddd[_0x43e7('0x42')]=_[_0x43e7('0x41')](_0x473fca[_0x43e7('0x3f')],qs[_0x43e7('0x43')](_0x2351cf[_0x43e7('0x40')][_0x43e7('0x43')]));_0x256ddd[_0x43e7('0x42')]=_0x256ddd[_0x43e7('0x42')][_0x43e7('0x44')]?_0x256ddd[_0x43e7('0x42')]:_0x473fca[_0x43e7('0x3f')];if(_0x2351cf['query'][_0x43e7('0x4f')]){_0x256ddd[_0x43e7('0x54')]=[{'all':!![]}];}_0x256ddd=_['merge']({},_0x256ddd,_0x2351cf[_0x43e7('0x55')]);return db[_0x43e7('0x4e')][_0x43e7('0x56')](_0x256ddd)['then'](handleEntityNotFound(_0x1cd87c,null))['then'](respondWithResult(_0x1cd87c,null))[_0x43e7('0x25')](handleError(_0x1cd87c,null));};exports[_0x43e7('0x57')]=function(_0x4ebdde,_0x283dd8){return db['ChatWebsite']['create'](_0x4ebdde[_0x43e7('0x58')],{})[_0x43e7('0x1c')](function(_0x1f7c02){var _0x40155c=_0x4ebdde[_0x43e7('0x59')]['get']({'plain':!![]});if(!_0x40155c)throw new Error(_0x43e7('0x5a'));if(_0x40155c[_0x43e7('0x5b')]==='user'){var _0x20283b=_0x1f7c02[_0x43e7('0x30')]({'plain':!![]});var _0x296a0d='ChatWebsites';return db['UserProfileSection']['find']({'where':{'name':_0x296a0d,'userProfileId':_0x40155c[_0x43e7('0x5c')]},'raw':!![]})[_0x43e7('0x1c')](function(_0x323cf7){if(_0x323cf7&&_0x323cf7[_0x43e7('0x5d')]===0x0){return db['UserProfileResource']['create']({'name':_0x20283b[_0x43e7('0x36')],'resourceId':_0x20283b['id'],'type':_0x323cf7[_0x43e7('0x36')],'sectionId':_0x323cf7['id']},{})[_0x43e7('0x1c')](function(){return _0x1f7c02;});}else{return _0x1f7c02;}})[_0x43e7('0x25')](function(_0x5ea0db){logger[_0x43e7('0x22')](_0x43e7('0x5e'),_0x5ea0db);throw _0x5ea0db;});}return _0x1f7c02;})[_0x43e7('0x1c')](respondWithResult(_0x283dd8,0xc9))[_0x43e7('0x25')](handleError(_0x283dd8,null));};exports[_0x43e7('0x2f')]=function(_0xd41e79,_0x4665db){if(_0xd41e79[_0x43e7('0x58')]['id']){delete _0xd41e79[_0x43e7('0x58')]['id'];}return db[_0x43e7('0x4e')][_0x43e7('0x56')]({'where':{'id':_0xd41e79['params']['id']},'include':[{'model':db['Pause'],'as':_0x43e7('0x3a')}]})['then'](handleEntityNotFound(_0x4665db,null))['then'](saveUpdates(_0xd41e79['body'],null))[_0x43e7('0x1c')](respondWithResult(_0x4665db,null))[_0x43e7('0x25')](handleError(_0x4665db,null));};exports['destroy']=function(_0xfe5a8d,_0x135791){return db[_0x43e7('0x4e')]['find']({'where':{'id':_0xfe5a8d[_0x43e7('0x52')]['id']}})[_0x43e7('0x1c')](handleEntityNotFound(_0x135791,null))[_0x43e7('0x1c')](removeEntity(_0x135791,null))[_0x43e7('0x25')](handleError(_0x135791,null));};exports[_0x43e7('0x5f')]=function(_0x472a19,_0x1e02fa){return db['ChatWebsite'][_0x43e7('0x5f')]()[_0x43e7('0x1c')](respondWithResult(_0x1e02fa,null))[_0x43e7('0x25')](handleError(_0x1e02fa,null));};exports['addDisposition']=function(_0x56b06d,_0x30377a,_0x5c3ad8){if(_0x56b06d['body']['id']){delete _0x56b06d[_0x43e7('0x58')]['id'];}return db[_0x43e7('0x4e')]['find']({'where':{'id':_0x56b06d[_0x43e7('0x52')]['id']}})[_0x43e7('0x1c')](handleEntityNotFound(_0x30377a,null))[_0x43e7('0x1c')](function(_0x3401ec){if(_0x3401ec){_0x56b06d[_0x43e7('0x58')][_0x43e7('0x60')]=_0x3401ec['id'];return db[_0x43e7('0x61')]['create'](_0x56b06d[_0x43e7('0x58')]);}})[_0x43e7('0x1c')](respondWithResult(_0x30377a,null))['catch'](handleError(_0x30377a,null));};exports[_0x43e7('0x62')]=function(_0x5c2c5f,_0x26ee52,_0x248936){var _0x37301b={'raw':![],'where':{}};var _0x1ca24b={};var _0x506361={'count':0x0,'rows':[]};return db[_0x43e7('0x4e')][_0x43e7('0x63')]({'where':{'id':_0x5c2c5f[_0x43e7('0x52')]['id']}})['then'](handleEntityNotFound(_0x26ee52,null))[_0x43e7('0x1c')](function(_0x38fa5b){if(_0x38fa5b){_0x1ca24b[_0x43e7('0x3f')]=_[_0x43e7('0x53')](db[_0x43e7('0x61')]['rawAttributes']);_0x1ca24b[_0x43e7('0x40')]=_[_0x43e7('0x53')](_0x5c2c5f[_0x43e7('0x40')]);_0x1ca24b[_0x43e7('0x49')]=_[_0x43e7('0x41')](_0x1ca24b[_0x43e7('0x3f')],_0x1ca24b[_0x43e7('0x40')]);_0x37301b['attributes']=_['intersection'](_0x1ca24b[_0x43e7('0x3f')],qs['fields'](_0x5c2c5f['query']['fields']));_0x37301b[_0x43e7('0x42')]=_0x37301b[_0x43e7('0x42')][_0x43e7('0x44')]?_0x37301b[_0x43e7('0x42')]:_0x1ca24b[_0x43e7('0x3f')];if(!_0x5c2c5f[_0x43e7('0x40')]['hasOwnProperty'](_0x43e7('0x64'))){_0x37301b[_0x43e7('0x2b')]=qs[_0x43e7('0x2b')](_0x5c2c5f['query'][_0x43e7('0x2b')]);_0x37301b[_0x43e7('0x29')]=qs[_0x43e7('0x29')](_0x5c2c5f[_0x43e7('0x40')][_0x43e7('0x29')]);}_0x37301b[_0x43e7('0x46')]=qs[_0x43e7('0x47')](_0x5c2c5f[_0x43e7('0x40')]['sort']);_0x37301b['where']=qs['filters'](_[_0x43e7('0x4a')](_0x5c2c5f[_0x43e7('0x40')],_0x1ca24b['filters']));_0x37301b[_0x43e7('0x48')][_0x43e7('0x60')]=_0x38fa5b['id'];if(_0x5c2c5f[_0x43e7('0x40')][_0x43e7('0x4b')]){_0x37301b['where']=_['merge'](_0x37301b['where'],{'$or':_[_0x43e7('0x3b')](_0x37301b[_0x43e7('0x42')],function(_0x508566){var _0x58cbb7={};_0x58cbb7[_0x508566]={'$like':'%'+_0x5c2c5f[_0x43e7('0x40')][_0x43e7('0x4b')]+'%'};return _0x58cbb7;})});}_0x37301b=_[_0x43e7('0x4c')]({},_0x37301b,_0x5c2c5f['options']);return db[_0x43e7('0x61')][_0x43e7('0x2c')]({'where':_0x37301b[_0x43e7('0x48')]})[_0x43e7('0x1c')](function(_0x48f1dc){_0x506361[_0x43e7('0x2c')]=_0x48f1dc;if(_0x5c2c5f['query'][_0x43e7('0x4f')]){_0x37301b[_0x43e7('0x54')]=[{'all':!![]}];}return db[_0x43e7('0x61')][_0x43e7('0x65')](_0x37301b);})[_0x43e7('0x1c')](function(_0x45adef){_0x506361[_0x43e7('0x50')]=_0x45adef;return _0x506361;});}})['then'](respondWithFilteredResult(_0x26ee52,_0x37301b))[_0x43e7('0x25')](handleError(_0x26ee52,null));};exports[_0x43e7('0x66')]=function(_0x1aea4e,_0x6fb694,_0x550960){return db['ChatWebsite']['find']({'where':{'id':_0x1aea4e[_0x43e7('0x52')]['id']}})['then'](handleEntityNotFound(_0x6fb694,null))[_0x43e7('0x1c')](function(_0x36b768){if(_0x36b768){return _0x36b768[_0x43e7('0x66')](_0x1aea4e[_0x43e7('0x40')][_0x43e7('0x67')]);}})[_0x43e7('0x1c')](respondWithStatusCode(_0x6fb694,null))[_0x43e7('0x25')](handleError(_0x6fb694,null));};exports[_0x43e7('0x68')]=function(_0x363af5,_0xe82b9d,_0x3de22e){if(_0x363af5['body']['id']){delete _0x363af5[_0x43e7('0x58')]['id'];}return db[_0x43e7('0x4e')][_0x43e7('0x56')]({'where':{'id':_0x363af5[_0x43e7('0x52')]['id']}})[_0x43e7('0x1c')](handleEntityNotFound(_0xe82b9d,null))['then'](function(_0x5e04ec){if(_0x5e04ec){_0x363af5[_0x43e7('0x58')][_0x43e7('0x60')]=_0x5e04ec['id'];return db['CannedAnswer'][_0x43e7('0x57')](_0x363af5[_0x43e7('0x58')]);}})['then'](respondWithResult(_0xe82b9d,null))['catch'](handleError(_0xe82b9d,null));};exports[_0x43e7('0x69')]=function(_0x3667a4,_0x22947e,_0x1c0a84){var _0x2a4a31={'raw':![],'where':{}};var _0x5f0a0b={};var _0x4b50bf={'count':0x0,'rows':[]};return db[_0x43e7('0x4e')][_0x43e7('0x63')]({'where':{'id':_0x3667a4[_0x43e7('0x52')]['id']}})[_0x43e7('0x1c')](handleEntityNotFound(_0x22947e,null))['then'](function(_0x45dc61){if(_0x45dc61){_0x5f0a0b[_0x43e7('0x3f')]=_[_0x43e7('0x53')](db[_0x43e7('0x6a')]['rawAttributes']);_0x5f0a0b[_0x43e7('0x40')]=_[_0x43e7('0x53')](_0x3667a4[_0x43e7('0x40')]);_0x5f0a0b[_0x43e7('0x49')]=_[_0x43e7('0x41')](_0x5f0a0b['model'],_0x5f0a0b[_0x43e7('0x40')]);_0x2a4a31[_0x43e7('0x42')]=_['intersection'](_0x5f0a0b[_0x43e7('0x3f')],qs[_0x43e7('0x43')](_0x3667a4[_0x43e7('0x40')][_0x43e7('0x43')]));_0x2a4a31['attributes']=_0x2a4a31[_0x43e7('0x42')]['length']?_0x2a4a31[_0x43e7('0x42')]:_0x5f0a0b[_0x43e7('0x3f')];if(!_0x3667a4[_0x43e7('0x40')][_0x43e7('0x45')](_0x43e7('0x64'))){_0x2a4a31[_0x43e7('0x2b')]=qs[_0x43e7('0x2b')](_0x3667a4[_0x43e7('0x40')][_0x43e7('0x2b')]);_0x2a4a31['offset']=qs[_0x43e7('0x29')](_0x3667a4[_0x43e7('0x40')][_0x43e7('0x29')]);}_0x2a4a31[_0x43e7('0x46')]=qs['sort'](_0x3667a4['query'][_0x43e7('0x47')]);_0x2a4a31[_0x43e7('0x48')]=qs[_0x43e7('0x49')](_['pick'](_0x3667a4[_0x43e7('0x40')],_0x5f0a0b['filters']));_0x2a4a31['where']['ChatWebsiteId']=_0x45dc61['id'];if(_0x3667a4[_0x43e7('0x40')]['filter']){_0x2a4a31[_0x43e7('0x48')]=_[_0x43e7('0x4c')](_0x2a4a31[_0x43e7('0x48')],{'$or':_[_0x43e7('0x3b')](_0x2a4a31[_0x43e7('0x42')],function(_0x482adc){var _0x4d64c9={};_0x4d64c9[_0x482adc]={'$like':'%'+_0x3667a4[_0x43e7('0x40')][_0x43e7('0x4b')]+'%'};return _0x4d64c9;})});}_0x2a4a31=_['merge']({},_0x2a4a31,_0x3667a4[_0x43e7('0x55')]);return db[_0x43e7('0x6a')][_0x43e7('0x2c')]({'where':_0x2a4a31[_0x43e7('0x48')]})[_0x43e7('0x1c')](function(_0x1dbbb9){_0x4b50bf[_0x43e7('0x2c')]=_0x1dbbb9;if(_0x3667a4[_0x43e7('0x40')][_0x43e7('0x4f')]){_0x2a4a31[_0x43e7('0x54')]=[{'all':!![]}];}return db[_0x43e7('0x6a')][_0x43e7('0x65')](_0x2a4a31);})[_0x43e7('0x1c')](function(_0x277b80){_0x4b50bf[_0x43e7('0x50')]=_0x277b80;return _0x4b50bf;});}})[_0x43e7('0x1c')](respondWithFilteredResult(_0x22947e,_0x2a4a31))[_0x43e7('0x25')](handleError(_0x22947e,null));};exports[_0x43e7('0x6b')]=function(_0xec3d2a,_0x3bdcc9,_0x3e3b81){return db[_0x43e7('0x4e')]['find']({'where':{'id':_0xec3d2a[_0x43e7('0x52')]['id']}})[_0x43e7('0x1c')](handleEntityNotFound(_0x3bdcc9,null))[_0x43e7('0x1c')](function(_0x282401){if(_0x282401){return _0x282401['removeAnswers'](_0xec3d2a[_0x43e7('0x40')]['ids']);}})[_0x43e7('0x1c')](respondWithStatusCode(_0x3bdcc9,null))[_0x43e7('0x25')](handleError(_0x3bdcc9,null));};exports[_0x43e7('0x6c')]=function(_0x35c3cc,_0x24aa6f,_0x207d5a){_0x35c3cc['body'][_0x43e7('0x6d')]=_0x35c3cc[_0x43e7('0x6e')][_0x43e7('0x6f')];return db[_0x43e7('0x4e')][_0x43e7('0x56')]({'where':{'id':_0x35c3cc['params']['id']}})['then'](handleEntityNotFound(_0x24aa6f,null))[_0x43e7('0x1c')](saveUpdates(_0x35c3cc['body'],null))[_0x43e7('0x1c')](respondWithResult(_0x24aa6f,null))[_0x43e7('0x25')](handleError(_0x24aa6f,null));};exports[_0x43e7('0x70')]=function(_0x29ef54,_0x514249,_0x5e38c7){_0x29ef54['body'][_0x43e7('0x71')]=_0x29ef54['file']['filename'];return db['ChatWebsite'][_0x43e7('0x56')]({'where':{'id':_0x29ef54[_0x43e7('0x52')]['id']}})['then'](handleEntityNotFound(_0x514249,null))[_0x43e7('0x1c')](saveUpdates(_0x29ef54['body'],null))[_0x43e7('0x1c')](respondWithResult(_0x514249,null))[_0x43e7('0x25')](handleError(_0x514249,null));};exports[_0x43e7('0x72')]=function(_0x3b64dd,_0x17a9e0,_0x4efc11){_0x3b64dd[_0x43e7('0x58')][_0x43e7('0x73')]=_0x3b64dd[_0x43e7('0x6e')]['filename'];return db['ChatWebsite'][_0x43e7('0x56')]({'where':{'id':_0x3b64dd[_0x43e7('0x52')]['id']}})[_0x43e7('0x1c')](handleEntityNotFound(_0x17a9e0,null))[_0x43e7('0x1c')](saveUpdates(_0x3b64dd['body'],null))[_0x43e7('0x1c')](respondWithResult(_0x17a9e0,null))[_0x43e7('0x25')](handleError(_0x17a9e0,null));};exports[_0x43e7('0x74')]=function(_0x56150e,_0x41a222,_0x2c410e){_0x56150e[_0x43e7('0x58')][_0x43e7('0x75')]=_0x56150e['file'][_0x43e7('0x6f')];return db['ChatWebsite'][_0x43e7('0x56')]({'where':{'id':_0x56150e[_0x43e7('0x52')]['id']}})['then'](handleEntityNotFound(_0x41a222,null))['then'](saveUpdates(_0x56150e[_0x43e7('0x58')],null))[_0x43e7('0x1c')](respondWithResult(_0x41a222,null))[_0x43e7('0x25')](handleError(_0x41a222,null));};exports[_0x43e7('0x76')]=function(_0x309fde,_0x28986d,_0x3abb0b){var _0x28860f=path[_0x43e7('0x77')](config[_0x43e7('0x78')],_0x43e7('0x79'));var _0x4a3075={'where':{'id':_0x309fde[_0x43e7('0x52')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x42f897=![];return require(_0x43e7('0x7a'))[_0x43e7('0x7b')]()['then'](function(_0x153084){if(_0x153084){_0x42f897=_0x153084[_0x43e7('0x7c')];}})[_0x43e7('0x1c')](function(){return db[_0x43e7('0x4e')]['find'](_0x4a3075);})[_0x43e7('0x1c')](handleEntityNotFound(_0x28986d,null))[_0x43e7('0x1c')](function(_0x524dc2){if(_0x524dc2){if(!_['isNil'](_0x524dc2['sitepic'])){if(fs[_0x43e7('0x7d')](path[_0x43e7('0x77')](config[_0x43e7('0x78')],_0x43e7('0x7e'),_0x524dc2[_0x43e7('0x6d')]))&&_0x42f897){_0x28860f=path[_0x43e7('0x77')](config[_0x43e7('0x78')],_0x43e7('0x7e'),_0x524dc2['sitepic']);}}return _0x28986d[_0x43e7('0x7f')](_0x28860f);}})[_0x43e7('0x25')](handleError(_0x28986d,null));};exports[_0x43e7('0x80')]=function(_0x215426,_0x4e4f4e,_0x502840){var _0x4123b8=path[_0x43e7('0x77')](config[_0x43e7('0x78')],_0x43e7('0x81'));var _0x5cf4bf={'where':{'id':_0x215426[_0x43e7('0x52')]['id']},'attributes':['id',_0x43e7('0x71')],'raw':!![]};return db[_0x43e7('0x4e')][_0x43e7('0x56')](_0x5cf4bf)[_0x43e7('0x1c')](handleEntityNotFound(_0x4e4f4e,null))[_0x43e7('0x1c')](function(_0x4c2722){if(_0x4c2722){if(!_[_0x43e7('0x82')](_0x4c2722['agentAvatar'])){if(fs['existsSync'](path[_0x43e7('0x77')](config[_0x43e7('0x78')],'server/files/images/avatars/',_0x4c2722['agentAvatar']))){_0x4123b8=path[_0x43e7('0x77')](config[_0x43e7('0x78')],'server/files/images/avatars/',_0x4c2722[_0x43e7('0x71')]);}}return _0x4e4f4e[_0x43e7('0x7f')](_0x4123b8);}})[_0x43e7('0x25')](handleError(_0x4e4f4e,null));};exports[_0x43e7('0x83')]=function(_0x4cb1c5,_0x5dc8b7,_0x2a084b){var _0x31354e=path[_0x43e7('0x77')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x298239={'where':{'id':_0x4cb1c5[_0x43e7('0x52')]['id']},'attributes':['id',_0x43e7('0x73'),_0x43e7('0x84')],'raw':!![]};return db[_0x43e7('0x4e')][_0x43e7('0x56')](_0x298239)[_0x43e7('0x1c')](handleEntityNotFound(_0x5dc8b7,null))[_0x43e7('0x1c')](function(_0x5caba2){if(_0x5caba2){if(!_['isNil'](_0x5caba2['customerAvatar'])){if(fs[_0x43e7('0x7d')](path['join'](config[_0x43e7('0x78')],_0x43e7('0x85'),_0x5caba2[_0x43e7('0x73')]))&&_0x5caba2[_0x43e7('0x84')]){_0x31354e=path[_0x43e7('0x77')](config['root'],_0x43e7('0x85'),_0x5caba2[_0x43e7('0x73')]);}}return _0x5dc8b7[_0x43e7('0x7f')](_0x31354e);}})[_0x43e7('0x25')](handleError(_0x5dc8b7,null));};exports['getSystemAvatar']=function(_0x259077,_0x126af5,_0x191659){var _0x1ede62=path[_0x43e7('0x77')](config[_0x43e7('0x78')],_0x43e7('0x86'));var _0x573573={'where':{'id':_0x259077[_0x43e7('0x52')]['id']},'attributes':['id',_0x43e7('0x75')],'raw':!![]};return db[_0x43e7('0x4e')][_0x43e7('0x56')](_0x573573)[_0x43e7('0x1c')](handleEntityNotFound(_0x126af5,null))['then'](function(_0x1a20d0){if(_0x1a20d0){if(!_[_0x43e7('0x82')](_0x1a20d0['systemAvatar'])){if(fs[_0x43e7('0x7d')](path[_0x43e7('0x77')](config['root'],_0x43e7('0x85'),_0x1a20d0[_0x43e7('0x75')]))){_0x1ede62=path[_0x43e7('0x77')](config[_0x43e7('0x78')],_0x43e7('0x85'),_0x1a20d0['systemAvatar']);}}return _0x126af5[_0x43e7('0x7f')](_0x1ede62);}})[_0x43e7('0x25')](handleError(_0x126af5,null));};exports[_0x43e7('0x87')]=function(_0x531c5e,_0x32b788,_0x4b826a){var _0x50c161=require(_0x43e7('0x88'));var _0x17421b=new _0x50c161();var _0x3ea226=_0x17421b[_0x43e7('0x89')](_0x531c5e[_0x43e7('0x8a')][_0x43e7('0x8b')])['getResult']();var _0xcbdb35={'body':_0x531c5e[_0x43e7('0x58')],'channel':_0x43e7('0x8c')};var _0x4a4031=[];var _0x5a7f2e=[];var _0x21901c={};var _0x186192=![];return db[_0x43e7('0x8d')][_0x43e7('0x5f')]()[_0x43e7('0x1c')](function(_0x512f61){if(!_0x512f61){throw new db[(_0x43e7('0x8e'))][(_0x43e7('0x8f'))]('no\x20available\x20attributes');}_0x4a4031=_[_0x43e7('0x90')](_[_0x43e7('0x53')](_0x512f61),[_0x43e7('0x91'),_0x43e7('0x92')]);_0x5a7f2e=_[_0x43e7('0x90')](_[_0x43e7('0x53')](_0x512f61),[_0x43e7('0x91'),_0x43e7('0x92'),'CompanyId',_0x43e7('0x93')]);if(_0x531c5e[_0x43e7('0x58')]['id']){delete _0x531c5e[_0x43e7('0x58')]['id'];}if(_[_0x43e7('0x82')](_0x531c5e[_0x43e7('0x58')]['from'])){throw new db[(_0x43e7('0x8e'))][(_0x43e7('0x8f'))](_0x43e7('0x94'));}if(_[_0x43e7('0x82')](_0x531c5e[_0x43e7('0x58')]['body'])||_0x531c5e[_0x43e7('0x58')]['body']===''){throw new db[(_0x43e7('0x8e'))][(_0x43e7('0x8f'))](_0x43e7('0x95'));}if(_[_0x43e7('0x82')](_0x531c5e['body'][_0x43e7('0x96')])){throw new db[(_0x43e7('0x8e'))][(_0x43e7('0x8f'))](_0x43e7('0x97')+_0x5a7f2e);}if(!_[_0x43e7('0x98')](_0x5a7f2e,_0x531c5e[_0x43e7('0x58')][_0x43e7('0x96')])){throw new db[(_0x43e7('0x8e'))][(_0x43e7('0x8f'))](_0x43e7('0x99')+_0x5a7f2e);}_0x21901c[_0x531c5e[_0x43e7('0x58')]['mapKey']]=_0x531c5e['body'][_0x43e7('0x9a')];})['then'](function(){return db['ChatWebsite'][_0x43e7('0x56')]({'where':{'id':_0x531c5e[_0x43e7('0x52')]['id']},'include':[{'model':db['CmList'],'as':_0x43e7('0x9b'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x21901c,'limit':0x1,'order':[['updatedAt',_0x43e7('0x9c')]]}]},{'model':db[_0x43e7('0x9d')],'as':_0x43e7('0x9e')}]});})[_0x43e7('0x1c')](handleEntityNotFound(_0x32b788,null))[_0x43e7('0x1c')](function(_0x3f3787){if(_0x3f3787&&_0x3f3787[_0x43e7('0x9b')]){_0xcbdb35[_0x43e7('0x9f')]=_0x3f3787;_0xcbdb35[_0x43e7('0xa0')]=_0x3f3787[_0x43e7('0x9e')];_0xcbdb35[_0x43e7('0xa1')]=_0x3f3787[_0x43e7('0x9b')];_0xcbdb35[_0x43e7('0xa0')]=_[_0x43e7('0xa2')](_0xcbdb35[_0x43e7('0xa0')],[_0x43e7('0xa3')],[_0x43e7('0xa4')]);if(_0xcbdb35[_0x43e7('0x9f')][_0x43e7('0x9e')]){delete _0xcbdb35[_0x43e7('0x9f')]['Applications'];}if(_0xcbdb35[_0x43e7('0x9f')][_0x43e7('0x9b')]&&_0xcbdb35['account'][_0x43e7('0x9b')][_0x43e7('0xa5')][_0x43e7('0x44')]){return _0xcbdb35[_0x43e7('0x9f')]['List'][_0x43e7('0xa5')][0x0];}var _0x6a8d13=_['defaults'](_0x531c5e[_0x43e7('0x58')],{'firstName':_0x531c5e[_0x43e7('0x58')][_0x43e7('0x9a')],'ListId':_0x3f3787['ListId']});_0x6a8d13[_0x531c5e[_0x43e7('0x58')][_0x43e7('0x96')]]=_0x531c5e[_0x43e7('0x58')][_0x43e7('0x9a')];return db[_0x43e7('0x8d')]['create'](_0x6a8d13,{'fields':_0x4a4031,'raw':!![]});}})[_0x43e7('0x1c')](handleEntityNotFound(_0x32b788,null))[_0x43e7('0x1c')](function(_0x547373){_0xcbdb35[_0x43e7('0xa6')]=_0x547373;var _0x47b03b=_0x531c5e['body']['customerIp'];if(_0x531c5e['headers'][_0x43e7('0xa7')]){_0x47b03b=_0x531c5e[_0x43e7('0x8a')][_0x43e7('0xa7')];}else if(_0x531c5e[_0x43e7('0x8a')]['x-forwarded-for']){_0x47b03b=_['first'](_0x531c5e[_0x43e7('0x8a')]['x-forwarded-for'][_0x43e7('0xa8')](','));}if(_0x547373){var _0x50e4c0={'ContactId':_0x547373['id'],'ChatWebsiteId':_0x531c5e[_0x43e7('0x52')]['id'],'from':(_0x547373['firstName']||'')+'\x20'+(_0x547373['lastName']||''),'customerIp':_0x47b03b,'customerPort':_0x531c5e['headers']['x-real-port']?_0x531c5e[_0x43e7('0x8a')][_0x43e7('0xa9')]:null,'referer':_0x531c5e[_0x43e7('0x58')]['referer'],'browserName':_0x3ea226[_0x43e7('0xaa')][_0x43e7('0x36')]&&_0x3ea226[_0x43e7('0xaa')]['version']?util[_0x43e7('0xab')](_0x43e7('0xac'),_0x3ea226[_0x43e7('0xaa')][_0x43e7('0x36')],_0x3ea226['browser'][_0x43e7('0xad')]):'unknown','browserVersion':_0x3ea226[_0x43e7('0xaa')][_0x43e7('0xad')]||_0x43e7('0xae'),'osName':util[_0x43e7('0xab')](_0x43e7('0xac'),_0x3ea226['os'][_0x43e7('0x36')],_0x3ea226['os'][_0x43e7('0xad')]),'osVersion':_0x3ea226['os']['version'],'deviceModel':_0x3ea226[_0x43e7('0xaf')][_0x43e7('0x3f')]&&_0x3ea226['device'][_0x43e7('0xb0')]?util[_0x43e7('0xab')](_0x43e7('0xb1'),_0x3ea226[_0x43e7('0xaf')][_0x43e7('0x3f')],_0x3ea226['device'][_0x43e7('0xb0')],_0x3ea226['device'][_0x43e7('0x3d')]):null,'deviceVendor':_0x3ea226['device'][_0x43e7('0xb0')],'deviceType':_0x3ea226[_0x43e7('0xaf')][_0x43e7('0x3d')],'formData':JSON[_0x43e7('0xb2')](_0x531c5e[_0x43e7('0x58')])};var _0x4cbbe5={'ChatWebsiteId':_0x531c5e[_0x43e7('0x52')]['id'],'closed':![]};if(_0x531c5e['body'][_0x43e7('0xb3')]){_0x4cbbe5[_0x43e7('0xb3')]=_0x531c5e[_0x43e7('0x58')]['threadId'];return db[_0x43e7('0xb4')][_0x43e7('0x56')]({'where':_0x4cbbe5})[_0x43e7('0x1c')](function(_0x391a2e){if(_0x391a2e){return[_0x391a2e,![]];}_0x50e4c0[_0x43e7('0xb3')]=_0x531c5e['body'][_0x43e7('0xb3')];_0x50e4c0['externalUrl']=_0x531c5e[_0x43e7('0x58')][_0x43e7('0xb5')];return db[_0x43e7('0xb4')][_0x43e7('0x57')](_0x50e4c0)[_0x43e7('0x1c')](function(_0x34ed9e){return[_0x34ed9e,!![]];});});}_0x4cbbe5[_0x43e7('0xb6')]=_0x547373['id'];if(_0x531c5e['body'][_0x43e7('0xb7')]&&_0x531c5e['body'][_0x43e7('0xb7')]['id']){_0x4cbbe5['id']=_0x531c5e[_0x43e7('0x58')][_0x43e7('0xb7')]['id'];return db[_0x43e7('0xb4')][_0x43e7('0x56')]({'where':_0x4cbbe5})[_0x43e7('0x1c')](function(_0x3bb7ab){if(_0x3bb7ab){return[_0x3bb7ab,![]];}return db[_0x43e7('0xb4')][_0x43e7('0x57')](_0x50e4c0)['then'](function(_0x240478){return[_0x240478,!![]];});});}return db['ChatInteraction'][_0x43e7('0x57')](_0x50e4c0)[_0x43e7('0x1c')](function(_0x58a29b){return[_0x58a29b,!![]];});}})[_0x43e7('0xb8')](function(_0x381e47,_0x5d9be9){if(_0x381e47){_0x186192=_0x5d9be9;if(!_0x5d9be9){var _0x1e7199={'from':(_0xcbdb35[_0x43e7('0xa6')][_0x43e7('0xb9')]||'')+'\x20'+(_0xcbdb35[_0x43e7('0xa6')][_0x43e7('0xba')]||'')};if(_0x531c5e[_0x43e7('0x58')][_0x43e7('0xb3')]&&_0x531c5e[_0x43e7('0x58')]['messageId']&&_0x531c5e[_0x43e7('0x58')][_0x43e7('0xb3')]!=_0x531c5e[_0x43e7('0x58')]['messageId']){_0x1e7199[_0x43e7('0xb3')]=_0x531c5e[_0x43e7('0x58')]['messageId'];}return _0x381e47[_0x43e7('0x2f')](_0x1e7199);}else{return _0x381e47;}}})[_0x43e7('0x1c')](function(_0x49612a){_0xcbdb35[_0x43e7('0xb7')]=_0x49612a[_0x43e7('0x30')]({'plain':!![]});_0xcbdb35[_0x43e7('0xb7')]['created']=_0x186192;if(_0xcbdb35[_0x43e7('0xb7')][_0x43e7('0xbb')]){if(_0xcbdb35['account'][_0x43e7('0xbc')]){_0xcbdb35[_0x43e7('0xa0')][_0x43e7('0xbd')]({'id':0x0,'priority':_0xcbdb35[_0x43e7('0xa0')]['length']+0x1,'app':'close','appdata':_0x43e7('0xbe'),'interval':_0x43e7('0xbf')});}}return db[_0x43e7('0xc0')][_0x43e7('0x57')]({'body':_0x531c5e['body'][_0x43e7('0x58')],'ChatWebsiteId':_0x531c5e[_0x43e7('0x52')]['id'],'ChatInteractionId':_0x49612a['id'],'direction':'in','ContactId':_0xcbdb35[_0x43e7('0xa6')]['id'],'AttachmentId':_0x531c5e[_0x43e7('0x58')]['AttachmentId']});})[_0x43e7('0x1c')](function(_0x241780){_0xcbdb35[_0x43e7('0x23')]=_0x241780;if(_0xcbdb35[_0x43e7('0xb7')][_0x43e7('0xc1')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0xcbdb35[_0x43e7('0xb7')][_0x43e7('0xc1')]}})[_0x43e7('0x1c')](function(_0x4f95fb){if(_0x4f95fb){_0xcbdb35[_0x43e7('0xa0')]['unshift']({'id':0x0,'priority':0x0,'app':_0x43e7('0xc2'),'appdata':_0x4f95fb[_0x43e7('0x36')]+','+(_0xcbdb35[_0x43e7('0x9f')][_0x43e7('0xc3')]||0xa),'interval':_0x43e7('0xbf')});_0xcbdb35[_0x43e7('0xc4')]=!![];}return respondWithRpcPromise('Start',_0x43e7('0xc5'),_0xcbdb35);});}return respondWithRpcPromise(_0x43e7('0xc6'),_0x43e7('0xc5'),_0xcbdb35);})[_0x43e7('0x1c')](function(_0x2f467b){respondWithRpcPromise(_0x43e7('0xc7'),_0x43e7('0xc7'),{'event':_0x43e7('0x87'),'message':_0x2f467b},client9002);return _0x2f467b;})[_0x43e7('0x1c')](respondWithResult(_0x32b788,null))[_0x43e7('0x25')](handleError(_0x32b788,null));};exports[_0x43e7('0xc8')]=function(_0x990e20,_0x24e9a7,_0x57ef19){var _0x22f08d,_0x24d6e4,_0x4cc5dd;var _0x21a06a=[];var _0x2c5e64=[];var _0x4aaf17={};var _0x331a72=_0x990e20[_0x43e7('0xc9')]||[];var _0x2b9cf9=[];var _0x54e369;return db['CmContact'][_0x43e7('0x5f')]()[_0x43e7('0x1c')](function(_0x4c24cf){if(!_0x4c24cf){throw new db[(_0x43e7('0x8e'))][(_0x43e7('0x8f'))](_0x43e7('0xca'));}_0x2c5e64=_[_0x43e7('0x90')](_[_0x43e7('0x53')](_0x4c24cf),['createdAt',_0x43e7('0x92')]);_0x21a06a=_[_0x43e7('0x90')](_[_0x43e7('0x53')](_0x4c24cf),[_0x43e7('0x91'),_0x43e7('0x92'),_0x43e7('0xcb'),_0x43e7('0x93')]);if(_0x990e20[_0x43e7('0x58')]['id']){delete _0x990e20[_0x43e7('0x58')]['id'];}if(_[_0x43e7('0x82')](_0x990e20[_0x43e7('0x58')][_0x43e7('0x9a')])){throw _0x24e9a7['status'](0x1f4)[_0x43e7('0x37')](new db[(_0x43e7('0x8e'))][(_0x43e7('0x8f'))](_0x43e7('0x94')));}if(_[_0x43e7('0x82')](_0x990e20[_0x43e7('0x58')]['body'])||_0x990e20[_0x43e7('0x58')]['body']===''){throw _0x24e9a7[_0x43e7('0x26')](0x1f4)[_0x43e7('0x37')](new db[(_0x43e7('0x8e'))]['ValidationError'](_0x43e7('0x95')));}if(_[_0x43e7('0x82')](_0x990e20['body'][_0x43e7('0xcc')])){throw _0x24e9a7['status'](0x1f4)[_0x43e7('0x37')](new db[(_0x43e7('0x8e'))][(_0x43e7('0x8f'))](_0x43e7('0xcd')+_0x21a06a));}if(!_['includes'](_0x21a06a,_0x990e20[_0x43e7('0x58')][_0x43e7('0xcc')])){throw _0x24e9a7[_0x43e7('0x26')](0x1f4)['send'](new db[(_0x43e7('0x8e'))][(_0x43e7('0x8f'))](_0x43e7('0xce')+_0x21a06a));}_0x4aaf17[_0x990e20[_0x43e7('0x58')][_0x43e7('0xcc')]]=_0x990e20[_0x43e7('0x58')]['from'];})[_0x43e7('0x1c')](function(){return db['ChatWebsite'][_0x43e7('0x56')]({'where':{'id':_0x990e20[_0x43e7('0x52')]['id']},'include':[{'model':db['CmList'],'as':_0x43e7('0x9b')},{'model':db[_0x43e7('0xcf')],'as':'MailAccount'}]});})[_0x43e7('0x1c')](handleEntityNotFound(_0x24e9a7,null))[_0x43e7('0x1c')](function(_0x420306){if(_0x420306&&_0x420306[_0x43e7('0x9b')]){_0x24d6e4=_0x420306;var _0x58d9f7=_['defaults'](_0x990e20[_0x43e7('0x58')],{'firstName':_0x990e20[_0x43e7('0x58')][_0x43e7('0x9a')],'phone':_0x990e20[_0x43e7('0x58')][_0x43e7('0x9a')],'ListId':_0x420306[_0x43e7('0x93')]});_0x58d9f7[_0x990e20[_0x43e7('0x58')][_0x43e7('0xcc')]]=_0x990e20['body'][_0x43e7('0x9a')];return db[_0x43e7('0x8d')]['findOrCreate']({'where':_0x4aaf17,'defaults':_0x58d9f7});}})[_0x43e7('0xb8')](function(_0x2c3c19){if(_0x2c3c19){_0x4cc5dd=_0x2c3c19;var _0x198591=fs[_0x43e7('0xd0')](path[_0x43e7('0x77')](config[_0x43e7('0x78')],_0x43e7('0xd1')),'utf8');var _0xaa97b5=ejs['render'](_0x198591,{'body':_[_0x43e7('0xd2')](_0x990e20[_0x43e7('0x58')]['body']),'bodyTitle':_0x24d6e4[_0x43e7('0xd3')]});return db['ChatOfflineMessage'][_0x43e7('0x57')]({'body':_0xaa97b5,'ContactId':_0x2c3c19['id'],'ChatWebsiteId':_0x24d6e4['id']});}})[_0x43e7('0x1c')](function(_0x1a2930){_0x54e369=_0x1a2930;if(_0x331a72['length']){var _0x4ec2c7=_0x331a72[_0x43e7('0x3b')](function(_0xcfecd2){return{'name':_0xcfecd2['originalname'],'basename':_0xcfecd2[_0x43e7('0x6f')],'type':_0xcfecd2[_0x43e7('0xd4')],'ChatOfflineMessageId':_0x1a2930['id']};});_0x2b9cf9=_0x4ec2c7[_0x43e7('0x3b')](_0x4fec66=>{var _0x3127d4={'filename':_0x4fec66[_0x43e7('0x36')],'path':path[_0x43e7('0x77')](config['root'],_0x43e7('0xd5'),_0x43e7('0xc9'),_0x43e7('0xd6'),_0x43e7('0xd7'),_0x4fec66[_0x43e7('0xd8')])};return _0x3127d4;});if(!_0x24d6e4[_0x43e7('0xd9')]){return db['sequelize'][_0x43e7('0xda')](function(_0x27e3dd){return db[_0x43e7('0xdb')][_0x43e7('0xdc')](_0x4ec2c7,{'transaction':_0x27e3dd});});}}})[_0x43e7('0x1c')](function(){if(_0x54e369){_0x22f08d=_0x54e369;return db[_0x43e7('0xcf')][_0x43e7('0x63')]({'where':{'active':!![]},'include':[{'model':db[_0x43e7('0xdd')],'as':_0x43e7('0xde'),'raw':!![]}]});}})[_0x43e7('0x1c')](function(_0x13133c){if(_0x13133c&&_0x13133c[_0x43e7('0xde')]&&_0x24d6e4['forwardOffline']&&_0x24d6e4['forwardOfflineAddress']){var _0x534cc5={'tls':{'rejectUnauthorized':![]}};if(_0x13133c['Smtp'][_0x43e7('0xdf')]){_0x534cc5[_0x43e7('0xdf')]=_0x13133c[_0x43e7('0xde')][_0x43e7('0xdf')];}else{_0x534cc5[_0x43e7('0xe0')]=_0x13133c[_0x43e7('0xde')]['host'];_0x534cc5['port']=_0x13133c[_0x43e7('0xde')][_0x43e7('0xe1')];_0x534cc5['secure']=_0x13133c['Smtp'][_0x43e7('0xe2')];}if(_0x13133c[_0x43e7('0xde')]['authentication']){_0x534cc5[_0x43e7('0xe3')]={'user':_0x13133c['Smtp']['user'],'pass':_0x13133c[_0x43e7('0xde')][_0x43e7('0xe4')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x534cc5,'message':{'from':util[_0x43e7('0xab')](_0x43e7('0xe5'),_0x13133c[_0x43e7('0x36')],_0x13133c[_0x43e7('0xe6')]||_0x13133c['Smtp'][_0x43e7('0x59')]),'to':_0x24d6e4[_0x43e7('0xe7')],'subject':_0x24d6e4['offlineMessageSubject'],'html':_0x22f08d['body'],'attachments':_0x2b9cf9}},client9003)['then'](function(){return _0x22f08d;})['catch'](function(_0x250fc1){console[_0x43e7('0x22')](_0x250fc1);});}})['then'](function(){if(_0x24d6e4&&_0x24d6e4['openNewInteraction']&&_0x24d6e4[_0x43e7('0xe8')]){var _0x74afae=[];if(_0x331a72[_0x43e7('0x44')]){_0x74afae=_0x331a72[_0x43e7('0x3b')](function(_0x41d3f9){return{'name':_0x41d3f9['originalname'],'basename':_0x41d3f9[_0x43e7('0x6f')],'type':_0x41d3f9[_0x43e7('0xd4')],'ChatOfflineMessageId':_0x54e369['id']};});}var _0x1bd994;if(!_[_0x43e7('0x82')](_0x24d6e4[_0x43e7('0xe9')])){var _0x5e6306=_[_0x43e7('0x3b')](_0x990e20[_0x43e7('0x58')],function(_0x804b29){return _0x804b29;});var _0x20ecb5=_['toPairsIn'](_0x5e6306)[0x0];var _0x1f15cf=_[_0x43e7('0xea')](_0x20ecb5,function(_0x3ae8ee){return _0x3ae8ee;});_0x1bd994=_0x1f15cf[0x1][_0x24d6e4[_0x43e7('0xe9')]];}var _0x266925={'from':_0x4cc5dd[_0x43e7('0xe6')],'firstName':_0x4cc5dd['firstName'],'lastName':_0x4cc5dd[_0x43e7('0xba')],'mapKey':_0x43e7('0xe6'),'message':{'from':_0x4cc5dd[_0x43e7('0xe6')],'to':_0x24d6e4[_0x43e7('0xcf')]['email'],'cc':'','subject':_[_0x43e7('0x82')](_0x1bd994)?_0x24d6e4['offlineMessageSubject']:_0x1bd994,'messageId':'','sentAt':new Date(),'attach':_0x74afae[_0x43e7('0x44')],'attachments':_0x74afae,'originChannel':'Chat','ChatWebsiteId':_0x24d6e4['id'],'ChatOfflineMessageId':_0x22f08d['id'],'originTo':_0x24d6e4[_0x43e7('0xcf')]['email']},'body':_0x22f08d[_0x43e7('0x58')]};var _0x53c8bf={'account':{'id':_0x24d6e4[_0x43e7('0xe8')]},'body':_0x266925,'log':_0x43e7('0xeb')};return respondWithRpcPromise(_0x43e7('0xeb'),_0x43e7('0xec'),_0x53c8bf,client9001)[_0x43e7('0x1c')](function(){return _0x22f08d;})[_0x43e7('0x25')](function(_0x1c86ac){console[_0x43e7('0x22')](_0x1c86ac);});}return;})[_0x43e7('0x1c')](function(){if(_0x22f08d){return _0x22f08d;}})[_0x43e7('0x1c')](respondWithResult(_0x24e9a7,null))['catch'](function(_0x4ed715){console['error'](_0x43e7('0x25'),_0x4ed715);for(var _0x4cae9f of _0x331a72){var _0x58a4e2=path[_0x43e7('0x77')](config[_0x43e7('0x78')],_0x43e7('0xd5'),_0x43e7('0xc9'),_0x43e7('0xd6'),_0x43e7('0xd7'),_0x4cae9f[_0x43e7('0x6f')]);fs_extra[_0x43e7('0xed')](_0x58a4e2)[_0x43e7('0x25')](function(_0x34c29a){console[_0x43e7('0x22')]('Could\x20not\x20remove\x20attachment\x20file',_0x58a4e2,_0x34c29a);});}});};exports[_0x43e7('0xee')]=function(_0x2f06bb,_0x3131d6,_0x5e883b){return db[_0x43e7('0xb4')][_0x43e7('0x56')]({'where':{'id':_0x2f06bb[_0x43e7('0x52')]['id']}})['then'](handleEntityNotFound(_0x3131d6,null))[_0x43e7('0x1c')](function(_0x110c91){if(_0x110c91){return _0x110c91[_0x43e7('0xee')](_0x2f06bb[_0x43e7('0x58')][_0x43e7('0x67')],_[_0x43e7('0xef')](_0x2f06bb[_0x43e7('0x58')],['ids','id'])||{});}})['then'](respondWithResult(_0x3131d6,null))[_0x43e7('0x25')](handleError(_0x3131d6,null));};exports[_0x43e7('0xf0')]=function(_0x2771f2,_0x5dca5e,_0x57a827){var _0x41e4da={'raw':![],'where':{}};var _0x47c35c={};var _0x36d49b={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x43e7('0x63')]({'where':{'id':_0x2771f2[_0x43e7('0x52')]['id']}})['then'](handleEntityNotFound(_0x5dca5e,null))[_0x43e7('0x1c')](function(_0x2ff576){if(_0x2ff576){_0x47c35c[_0x43e7('0x3f')]=_[_0x43e7('0x53')](db['ChatInteraction'][_0x43e7('0xf1')]);_0x47c35c[_0x43e7('0x40')]=_[_0x43e7('0x53')](_0x2771f2[_0x43e7('0x40')]);_0x47c35c['filters']=_['intersection'](_0x47c35c[_0x43e7('0x3f')],_0x47c35c['query']);_0x41e4da['attributes']=_[_0x43e7('0x41')](_0x47c35c[_0x43e7('0x3f')],qs[_0x43e7('0x43')](_0x2771f2[_0x43e7('0x40')]['fields']));_0x41e4da[_0x43e7('0x42')]=_0x41e4da[_0x43e7('0x42')][_0x43e7('0x44')]?_0x41e4da[_0x43e7('0x42')]:_0x47c35c[_0x43e7('0x3f')];if(!_0x2771f2[_0x43e7('0x40')]['hasOwnProperty']('nolimit')){_0x41e4da[_0x43e7('0x2b')]=qs[_0x43e7('0x2b')](_0x2771f2[_0x43e7('0x40')][_0x43e7('0x2b')]);_0x41e4da[_0x43e7('0x29')]=qs[_0x43e7('0x29')](_0x2771f2['query'][_0x43e7('0x29')]);}_0x41e4da[_0x43e7('0x46')]=qs[_0x43e7('0x47')](_0x2771f2[_0x43e7('0x40')]['sort']);_0x41e4da[_0x43e7('0x48')]=qs['filters'](_[_0x43e7('0x4a')](_0x2771f2[_0x43e7('0x40')],_0x47c35c['filters']));_0x41e4da[_0x43e7('0x48')]['ChatWebsiteId']=_0x2ff576['id'];if(_0x2771f2[_0x43e7('0x40')][_0x43e7('0x4b')]){_0x41e4da['where']=_[_0x43e7('0x4c')](_0x41e4da[_0x43e7('0x48')],{'$or':_[_0x43e7('0x3b')](_0x41e4da[_0x43e7('0x42')],function(_0x15458e){var _0x1fcecb={};_0x1fcecb[_0x15458e]={'$like':'%'+_0x2771f2[_0x43e7('0x40')][_0x43e7('0x4b')]+'%'};return _0x1fcecb;})});}_0x41e4da=_[_0x43e7('0x4c')]({},_0x41e4da,_0x2771f2['options']);return db['ChatInteraction'][_0x43e7('0x2c')]({'where':_0x41e4da[_0x43e7('0x48')]})[_0x43e7('0x1c')](function(_0x3ac223){_0x36d49b['count']=_0x3ac223;if(_0x2771f2[_0x43e7('0x40')][_0x43e7('0x4f')]){_0x41e4da[_0x43e7('0x54')]=[{'model':db[_0x43e7('0x8d')],'as':_0x43e7('0xf2'),'required':![]},{'model':db[_0x43e7('0xf3')],'as':_0x43e7('0xf4'),'attributes':['name',_0x43e7('0xf5'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x43e7('0x36'),_0x43e7('0xf6')],'where':_0x2771f2[_0x43e7('0x40')][_0x43e7('0xf7')]?{'id':_0x2771f2[_0x43e7('0x40')]['tag']}:undefined,'required':_0x2771f2['query'][_0x43e7('0xf7')]?!![]:![]}];}return db['ChatInteraction'][_0x43e7('0x65')](_0x41e4da);})['then'](function(_0x40acb9){_0x36d49b[_0x43e7('0x50')]=_0x40acb9;return _0x36d49b;});}})[_0x43e7('0x1c')](respondWithFilteredResult(_0x5dca5e,_0x41e4da))[_0x43e7('0x25')](handleError(_0x5dca5e,null));};function iftimePromise(_0x542547,_0x494ae6){return respondWithRpcPromise(_0x43e7('0xf8'),_0x43e7('0xf9'),{'command':_0x494ae6['timezone']?util['format'](_0x43e7('0xfa'),_0x542547[_0x43e7('0xfb')],_0x494ae6[_0x43e7('0xfc')]):util[_0x43e7('0xab')](_0x43e7('0xfd'),_0x542547[_0x43e7('0xfb')])},client9002)[_0x43e7('0x1c')](function(_0x314259){var _0x4025e3=_0x314259&&_0x314259[_0x43e7('0xfe')]('true')>=0x0?!![]:![];logger[_0x43e7('0x1d')](_0x43e7('0xff'),_0x494ae6['id'],_0x542547['id'],_0x542547[_0x43e7('0xfb')],_0x4025e3?_0x43e7('0x100'):'OFFLINE',_0x494ae6[_0x43e7('0xfc')]?_0x494ae6['timezone']:_0x43e7('0x101'));return _0x4025e3;})[_0x43e7('0x25')](function(_0x31edb2){logger[_0x43e7('0x22')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x494ae6['id'],_0x542547['id'],_0x542547['interval'],util[_0x43e7('0x102')](_0x31edb2,{'showHidden':![],'depth':null}),_0x494ae6['timezone']?_0x494ae6[_0x43e7('0xfc')]:_0x43e7('0x101'));return![];});}exports[_0x43e7('0xf9')]=function(_0x3a9550,_0x5dcd3f,_0x2e7f00){var _0x2627e2=0x0;var _0x591517=0x0;var _0x5052ef=![];var _0x25edc8;var _0x17498b;return db[_0x43e7('0x4e')][_0x43e7('0x56')]({'where':{'id':_0x3a9550['params']['id']},'include':[{'model':db['Interval'],'as':_0x43e7('0x103'),'include':[{'model':db[_0x43e7('0x103')],'as':_0x43e7('0x104'),'attributes':['id',_0x43e7('0xfb')],'raw':!![]}]}]})[_0x43e7('0x1c')](handleEntityNotFound(_0x5dcd3f,null))[_0x43e7('0x1c')](function(_0x353c5b){if(_0x353c5b){_0x25edc8=_0x353c5b;return _0x353c5b['getProactiveActions']({'raw':!![]});}})[_0x43e7('0x1c')](function(_0x434ec6){if(_0x25edc8){if(_0x434ec6){_0x17498b=_0x434ec6;}}return require(_0x43e7('0x7a'))[_0x43e7('0x7b')]();})[_0x43e7('0x1c')](function(_0x134fba){if(_0x134fba){_0x591517=_0x134fba[_0x43e7('0x105')];_0x5052ef=_0x134fba[_0x43e7('0x7c')];}})[_0x43e7('0x1c')](function(){return db[_0x43e7('0xb4')][_0x43e7('0x2c')]({'where':{'closed':![]}});})[_0x43e7('0x1c')](function(_0x151274){_0x2627e2=_0x151274;if(_0x591517&&_0x151274>_0x591517){return db[_0x43e7('0x106')][_0x43e7('0x63')]({'where':{'id':0x1}})[_0x43e7('0x1c')](function(_0x1b2f8d){if(_0x1b2f8d){_0x1b2f8d['increment'](_0x43e7('0x107'));}});}})[_0x43e7('0x1c')](function(){if(_0x25edc8[_0x43e7('0x103')]&&_0x25edc8[_0x43e7('0x103')][_0x43e7('0x104')]){var _0x5f42a0=[];for(var _0x1c4bb1=0x0;_0x1c4bb1<_0x25edc8[_0x43e7('0x103')][_0x43e7('0x104')][_0x43e7('0x44')];_0x1c4bb1++){var _0x4571d1=_0x25edc8['Interval'][_0x43e7('0x104')][_0x1c4bb1]['get']({'plain':!![]});_0x5f42a0['push'](iftimePromise(_0x4571d1,_0x25edc8));}return BPromise['all'](_0x5f42a0)[_0x43e7('0x1c')](function(_0xda9a78){return _[_0x43e7('0x108')](_0xda9a78);});}else{return!![];}})['then'](function(_0x301e05){var _0x59158d=fs['readFileSync'](path[_0x43e7('0x77')](config[_0x43e7('0x78')],'server/files/chat/iframe.js'),_0x43e7('0x109'));var _0x40766e={'remote':_0x25edc8[_0x43e7('0x10a')],'query':querystring[_0x43e7('0xb2')](_[_0x43e7('0x4c')](_0x25edc8['get']({'plain':!![]}),{'customerIp':_0x3a9550[_0x43e7('0x8a')][_0x43e7('0x10b')]||_0x3a9550[_0x43e7('0x8a')][_0x43e7('0x10c')]||_0x3a9550[_0x43e7('0x10d')]['remoteAddress']||_0x3a9550['ip'],'referer':_0x3a9550['headers']['referer'],'openedInteractions':_0x2627e2,'maxInteractions':_0x591517,'virtual':_0x5052ef[_0x43e7('0x105')],'online':_0x301e05,'custom':_0x5052ef}))[_0x43e7('0x10e')](/'/g,'\x5c\x27')};_0x5dcd3f[_0x43e7('0x37')](ejs[_0x43e7('0x10f')](Mustache['render'](_0x59158d,_0x40766e),{'proactiveActions':_0x17498b,'alignment':_0x25edc8[_0x43e7('0x110')],'verticalAlignment':_0x25edc8[_0x43e7('0x111')],'div_color':_0x25edc8[_0x43e7('0xf6')],'text_color':_0x25edc8['textColor'],'button_color':_0x25edc8[_0x43e7('0x112')],'background_color':_0x25edc8['backgroundColor']}));})[_0x43e7('0x25')](handleError(_0x5dcd3f,null));};exports[_0x43e7('0x113')]=function(_0x3d6b3d,_0x40cc83,_0x148d72){return db[_0x43e7('0x4e')][_0x43e7('0x63')]({'where':{'id':_0x3d6b3d[_0x43e7('0x52')]['id']}})[_0x43e7('0x1c')](handleEntityNotFound(_0x40cc83,null))['then'](function(_0x1a0c80){if(_0x1a0c80){return db[_0x43e7('0x114')]['transaction'](function(_0x54d8d6){return db[_0x43e7('0x9d')][_0x43e7('0x33')]({'where':{'ChatWebsiteId':_0x3d6b3d[_0x43e7('0x52')]['id']},'transaction':_0x54d8d6})[_0x43e7('0x1c')](function(_0xced86b){var _0x322389=_[_0x43e7('0x3b')](_0x3d6b3d[_0x43e7('0x58')],function(_0x21b1c3){_0x21b1c3[_0x43e7('0x60')]=_0x3d6b3d[_0x43e7('0x52')]['id'];return _0x21b1c3;});return db['ChatApplication'][_0x43e7('0xdc')](_0x322389,{'transaction':_0x54d8d6});});})['then'](function(){return db[_0x43e7('0x9d')][_0x43e7('0x115')]({'where':{'ChatWebsiteId':_0x3d6b3d[_0x43e7('0x52')]['id']},'order':_0x43e7('0xa3')});});}})['then'](respondWithResult(_0x40cc83,null))[_0x43e7('0x25')](handleError(_0x40cc83,null));};exports[_0x43e7('0x116')]=function(_0x47e3b5,_0x337e53,_0x464738){var _0x44b8f3={};var _0x11d686={};var _0xbd615c;var _0x42cbe5;return db[_0x43e7('0x4e')]['findOne']({'where':{'id':_0x47e3b5[_0x43e7('0x52')]['id']}})[_0x43e7('0x1c')](handleEntityNotFound(_0x337e53,null))[_0x43e7('0x1c')](function(_0x276606){if(_0x276606){_0xbd615c=_0x276606;_0x11d686[_0x43e7('0x3f')]=_[_0x43e7('0x53')](db[_0x43e7('0x9d')][_0x43e7('0xf1')]);_0x11d686[_0x43e7('0x40')]=_['keys'](_0x47e3b5[_0x43e7('0x40')]);_0x11d686['filters']=_[_0x43e7('0x41')](_0x11d686[_0x43e7('0x3f')],_0x11d686[_0x43e7('0x40')]);_0x44b8f3[_0x43e7('0x42')]=_[_0x43e7('0x41')](_0x11d686[_0x43e7('0x3f')],qs[_0x43e7('0x43')](_0x47e3b5['query'][_0x43e7('0x43')]));_0x44b8f3['attributes']=_0x44b8f3['attributes'][_0x43e7('0x44')]?_0x44b8f3['attributes']:_0x11d686['model'];_0x44b8f3[_0x43e7('0x46')]=qs[_0x43e7('0x47')](_0x47e3b5[_0x43e7('0x40')][_0x43e7('0x47')]);_0x44b8f3['where']=qs[_0x43e7('0x49')](_['pick'](_0x47e3b5[_0x43e7('0x40')],_0x11d686[_0x43e7('0x49')]));if(_0x47e3b5[_0x43e7('0x40')][_0x43e7('0x4b')]){_0x44b8f3[_0x43e7('0x48')]=_['merge'](_0x44b8f3['where'],{'$or':_[_0x43e7('0x3b')](_0x44b8f3[_0x43e7('0x42')],function(_0x541abf){var _0x221b56={};_0x221b56[_0x541abf]={'$like':'%'+_0x47e3b5[_0x43e7('0x40')][_0x43e7('0x4b')]+'%'};return _0x221b56;})});}_0x44b8f3=_[_0x43e7('0x4c')]({},_0x44b8f3,_0x47e3b5[_0x43e7('0x55')]);return _0xbd615c['getApplications'](_0x44b8f3);}})[_0x43e7('0x1c')](function(_0x1093f1){if(_0x1093f1){_0x42cbe5=_0x1093f1[_0x43e7('0x44')];if(!_0x47e3b5[_0x43e7('0x40')][_0x43e7('0x45')](_0x43e7('0x64'))){_0x44b8f3[_0x43e7('0x2b')]=qs['limit'](_0x47e3b5[_0x43e7('0x40')][_0x43e7('0x2b')]);_0x44b8f3[_0x43e7('0x29')]=qs[_0x43e7('0x29')](_0x47e3b5[_0x43e7('0x40')][_0x43e7('0x29')]);}return _0xbd615c['getApplications'](_0x44b8f3);}})[_0x43e7('0x1c')](function(_0x2b199c){if(_0x2b199c){return _0x2b199c?{'count':_0x42cbe5,'rows':_0x2b199c}:null;}})[_0x43e7('0x1c')](respondWithResult(_0x337e53,null))[_0x43e7('0x25')](handleError(_0x337e53,null));};exports[_0x43e7('0x117')]=function(_0x7c309b,_0x56199b,_0x552312){return db[_0x43e7('0x118')][_0x43e7('0x56')]({'where':{'id':_0x7c309b['params']['id']}})['then'](handleEntityNotFound(_0x56199b,null))['then'](function(_0x42c412){if(_0x42c412){return _0x42c412['addProactiveActions'](_0x7c309b['body'][_0x43e7('0x67')],_[_0x43e7('0xef')](_0x7c309b[_0x43e7('0x58')],['ids','id'])||{});}})['then'](respondWithResult(_0x56199b,null))['catch'](handleError(_0x56199b,null));};exports[_0x43e7('0x119')]=function(_0x1c6e50,_0x10895d,_0x375707){var _0x5d99d2={};var _0x4bf361={};var _0x1fa4b5;var _0x12e267;return db[_0x43e7('0x4e')][_0x43e7('0x63')]({'where':{'id':_0x1c6e50[_0x43e7('0x52')]['id']}})['then'](handleEntityNotFound(_0x10895d,null))[_0x43e7('0x1c')](function(_0x2e37b9){if(_0x2e37b9){_0x1fa4b5=_0x2e37b9;_0x4bf361[_0x43e7('0x3f')]=_['keys'](db['ChatProactiveAction'][_0x43e7('0xf1')]);_0x4bf361[_0x43e7('0x40')]=_[_0x43e7('0x53')](_0x1c6e50['query']);_0x4bf361['filters']=_['intersection'](_0x4bf361[_0x43e7('0x3f')],_0x4bf361[_0x43e7('0x40')]);_0x5d99d2[_0x43e7('0x42')]=_[_0x43e7('0x41')](_0x4bf361[_0x43e7('0x3f')],qs['fields'](_0x1c6e50[_0x43e7('0x40')][_0x43e7('0x43')]));_0x5d99d2['attributes']=_0x5d99d2[_0x43e7('0x42')][_0x43e7('0x44')]?_0x5d99d2[_0x43e7('0x42')]:_0x4bf361[_0x43e7('0x3f')];_0x5d99d2[_0x43e7('0x46')]=qs['sort'](_0x1c6e50[_0x43e7('0x40')][_0x43e7('0x47')]);_0x5d99d2[_0x43e7('0x48')]=qs[_0x43e7('0x49')](_[_0x43e7('0x4a')](_0x1c6e50['query'],_0x4bf361[_0x43e7('0x49')]));if(_0x1c6e50[_0x43e7('0x40')][_0x43e7('0x4b')]){_0x5d99d2[_0x43e7('0x48')]=_[_0x43e7('0x4c')](_0x5d99d2[_0x43e7('0x48')],{'$or':_[_0x43e7('0x3b')](_0x5d99d2[_0x43e7('0x42')],function(_0xad68d2){var _0x1ac01a={};_0x1ac01a[_0xad68d2]={'$like':'%'+_0x1c6e50[_0x43e7('0x40')]['filter']+'%'};return _0x1ac01a;})});}_0x5d99d2=_['merge']({},_0x5d99d2,_0x1c6e50[_0x43e7('0x55')]);return _0x1fa4b5[_0x43e7('0x119')](_0x5d99d2);}})[_0x43e7('0x1c')](function(_0x54f172){if(_0x54f172){_0x12e267=_0x54f172[_0x43e7('0x44')];if(!_0x1c6e50['query'][_0x43e7('0x45')](_0x43e7('0x64'))){_0x5d99d2['limit']=qs[_0x43e7('0x2b')](_0x1c6e50[_0x43e7('0x40')][_0x43e7('0x2b')]);_0x5d99d2[_0x43e7('0x29')]=qs[_0x43e7('0x29')](_0x1c6e50[_0x43e7('0x40')]['offset']);}return _0x1fa4b5[_0x43e7('0x119')](_0x5d99d2);}})['then'](function(_0x1a8b5d){if(_0x1a8b5d){return _0x1a8b5d?{'count':_0x12e267,'rows':_0x1a8b5d}:null;}})[_0x43e7('0x1c')](respondWithResult(_0x10895d,null))[_0x43e7('0x25')](handleError(_0x10895d,null));};exports[_0x43e7('0x11a')]=function(_0x54a991,_0x1e5022,_0x558c00){var _0x5a7365=_0x54a991['query'][_0x43e7('0x11b')]===_0x43e7('0x11c')?_0x43e7('0x11d'):_0x43e7('0x11e');return db['ChatWebsite'][_0x43e7('0x56')]({'attributes':['id',_0x5a7365],'where':{'id':_0x54a991[_0x43e7('0x52')]['id']}})[_0x43e7('0x1c')](handleEntityNotFound(_0x1e5022,null))[_0x43e7('0x1c')](function(_0x1dfa9b){if(_0x1dfa9b){var _0x593329=_0x1dfa9b[_0x5a7365];var _0x377b01=_0x593329&&_0x593329['items']?_0x593329[_0x43e7('0x11f')]:[];_0x1e5022['send']({'fromKey':_[_0x43e7('0x82')](_0x593329[_0x43e7('0x120')])?undefined:_0x593329['fromKey'],'count':_0x377b01[_0x43e7('0x44')],'rows':_0x377b01});}})[_0x43e7('0x25')](handleError(_0x1e5022,null));};exports[_0x43e7('0x121')]=function(_0x4f72b5,_0x1ee6c5,_0x4e9660){var _0x5c6249={'raw':![],'where':{}};var _0x3cd0b3={};var _0x4977ec={'count':0x0,'rows':[]};return db[_0x43e7('0x4e')][_0x43e7('0x63')]({'where':{'id':_0x4f72b5[_0x43e7('0x52')]['id']}})[_0x43e7('0x1c')](handleEntityNotFound(_0x1ee6c5,null))[_0x43e7('0x1c')](function(_0x386f99){if(_0x386f99){_0x3cd0b3[_0x43e7('0x3f')]=_[_0x43e7('0x53')](db[_0x43e7('0x122')][_0x43e7('0xf1')]);_0x3cd0b3[_0x43e7('0x40')]=_[_0x43e7('0x53')](_0x4f72b5[_0x43e7('0x40')]);_0x3cd0b3[_0x43e7('0x49')]=_[_0x43e7('0x41')](_0x3cd0b3[_0x43e7('0x3f')],_0x3cd0b3[_0x43e7('0x40')]);_0x5c6249['attributes']=_['intersection'](_0x3cd0b3[_0x43e7('0x3f')],qs[_0x43e7('0x43')](_0x4f72b5['query'][_0x43e7('0x43')]));_0x5c6249[_0x43e7('0x42')]=_0x5c6249['attributes']['length']?_0x5c6249[_0x43e7('0x42')]:_0x3cd0b3['model'];if(!_0x4f72b5['query'][_0x43e7('0x45')]('nolimit')){_0x5c6249[_0x43e7('0x2b')]=qs[_0x43e7('0x2b')](_0x4f72b5[_0x43e7('0x40')][_0x43e7('0x2b')]);_0x5c6249[_0x43e7('0x29')]=qs['offset'](_0x4f72b5[_0x43e7('0x40')][_0x43e7('0x29')]);}_0x5c6249[_0x43e7('0x46')]=qs[_0x43e7('0x47')](_0x4f72b5[_0x43e7('0x40')][_0x43e7('0x47')]);_0x5c6249[_0x43e7('0x48')]=qs['filters'](_['pick'](_0x4f72b5['query'],_0x3cd0b3[_0x43e7('0x49')]));_0x5c6249[_0x43e7('0x48')]['ChatWebsiteId']=_0x386f99['id'];if(_0x4f72b5['query'][_0x43e7('0x4b')]){_0x5c6249[_0x43e7('0x48')]=_[_0x43e7('0x4c')](_0x5c6249[_0x43e7('0x48')],{'$or':_[_0x43e7('0x3b')](_0x5c6249[_0x43e7('0x42')],function(_0x4794d1){var _0x206646={};_0x206646[_0x4794d1]={'$like':'%'+_0x4f72b5[_0x43e7('0x40')][_0x43e7('0x4b')]+'%'};return _0x206646;})});}_0x5c6249=_[_0x43e7('0x4c')]({},_0x5c6249,_0x4f72b5['options']);return db[_0x43e7('0x122')][_0x43e7('0x2c')]({'where':_0x5c6249[_0x43e7('0x48')]})[_0x43e7('0x1c')](function(_0x2894fe){_0x4977ec[_0x43e7('0x2c')]=_0x2894fe;if(_0x4f72b5['query']['includeAll']){_0x5c6249[_0x43e7('0x54')]=[{'all':!![]}];}else{_0x5c6249[_0x43e7('0x54')]=[{'model':db['CmContact'],'as':_0x43e7('0xf2'),'required':![]},{'model':db[_0x43e7('0xdb')],'as':_0x43e7('0x123'),'required':![]}];}return db[_0x43e7('0x122')][_0x43e7('0x65')](_0x5c6249);})[_0x43e7('0x1c')](function(_0x37fbf8){_0x4977ec[_0x43e7('0x50')]=_0x37fbf8;return _0x4977ec;});}})[_0x43e7('0x1c')](respondWithFilteredResult(_0x1ee6c5,_0x5c6249))[_0x43e7('0x25')](handleError(_0x1ee6c5,null));};exports['addAgents']=function(_0x17c315,_0x20f913,_0x5f3d07){return db[_0x43e7('0x4e')][_0x43e7('0x56')]({'where':{'id':_0x17c315[_0x43e7('0x52')]['id']}})[_0x43e7('0x1c')](handleEntityNotFound(_0x20f913,null))[_0x43e7('0x1c')](function(_0x4f2629){if(_0x4f2629){return _0x4f2629['addAgents'](_0x17c315['body'][_0x43e7('0x67')],_[_0x43e7('0xef')](_0x17c315[_0x43e7('0x58')],[_0x43e7('0x67'),'id'])||{})[_0x43e7('0xb8')](function(_0x35fb54){for(var _0x264b00=0x0;_0x264b00<_0x17c315[_0x43e7('0x58')][_0x43e7('0x67')][_0x43e7('0x44')];_0x264b00+=0x1){socket[_0x43e7('0x124')](_0x43e7('0x125'),{'UserId':_0x17c315['body'][_0x43e7('0x67')][_0x264b00],'ChatWebsiteId':_0x17c315[_0x43e7('0x52')]['id']});}return _0x35fb54;});}})[_0x43e7('0x1c')](respondWithResult(_0x20f913,null))['catch'](handleError(_0x20f913,null));};exports[_0x43e7('0x126')]=function(_0x6b5d12,_0x28ed58,_0x5459cc){return db['ChatWebsite'][_0x43e7('0x56')]({'where':{'id':_0x6b5d12[_0x43e7('0x52')]['id']}})[_0x43e7('0x1c')](handleEntityNotFound(_0x28ed58,null))['then'](function(_0x5abc16){if(_0x5abc16){return _0x5abc16[_0x43e7('0x126')](_0x6b5d12[_0x43e7('0x40')][_0x43e7('0x67')])[_0x43e7('0x1c')](function(){if(_['isArray'](_0x6b5d12[_0x43e7('0x40')]['ids'])){for(var _0xd53299=0x0;_0xd53299<_0x6b5d12[_0x43e7('0x40')][_0x43e7('0x67')][_0x43e7('0x44')];_0xd53299+=0x1){socket[_0x43e7('0x124')](_0x43e7('0x127'),{'UserId':Number(_0x6b5d12[_0x43e7('0x40')][_0x43e7('0x67')][_0xd53299]),'ChatWebsiteId':Number(_0x6b5d12[_0x43e7('0x52')]['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x6b5d12[_0x43e7('0x40')][_0x43e7('0x67')]),'ChatWebsiteId':Number(_0x6b5d12['params']['id'])});}});}})[_0x43e7('0x1c')](respondWithStatusCode(_0x28ed58,null))['catch'](handleError(_0x28ed58,null));};exports[_0x43e7('0x128')]=function(_0x4cfc8,_0xbd8c44,_0x2fba80){var _0x14ef18={};var _0x184cea={};var _0xca11fd;var _0x1de4a1;return db[_0x43e7('0x4e')][_0x43e7('0x63')]({'where':{'id':_0x4cfc8[_0x43e7('0x52')]['id']}})['then'](handleEntityNotFound(_0xbd8c44,null))[_0x43e7('0x1c')](function(_0x1b5306){if(_0x1b5306){_0xca11fd=_0x1b5306;_0x184cea[_0x43e7('0x3f')]=_[_0x43e7('0x53')](db[_0x43e7('0xf3')][_0x43e7('0xf1')]);_0x184cea[_0x43e7('0x40')]=_[_0x43e7('0x53')](_0x4cfc8[_0x43e7('0x40')]);_0x184cea['filters']=_['intersection'](_0x184cea[_0x43e7('0x3f')],_0x184cea[_0x43e7('0x40')]);_0x14ef18[_0x43e7('0x42')]=_[_0x43e7('0x41')](_0x184cea[_0x43e7('0x3f')],qs[_0x43e7('0x43')](_0x4cfc8['query'][_0x43e7('0x43')]));_0x14ef18[_0x43e7('0x42')]=_0x14ef18[_0x43e7('0x42')]['length']?_0x14ef18['attributes']:_0x184cea[_0x43e7('0x3f')];_0x14ef18[_0x43e7('0x46')]=qs['sort'](_0x4cfc8[_0x43e7('0x40')][_0x43e7('0x47')]);_0x14ef18[_0x43e7('0x48')]=qs[_0x43e7('0x49')](_['pick'](_0x4cfc8[_0x43e7('0x40')],_0x184cea[_0x43e7('0x49')]));if(_0x4cfc8[_0x43e7('0x40')]['filter']){_0x14ef18[_0x43e7('0x48')]=_[_0x43e7('0x4c')](_0x14ef18[_0x43e7('0x48')],{'$or':_[_0x43e7('0x3b')](_0x14ef18[_0x43e7('0x42')],function(_0x125748){var _0x378d15={};_0x378d15[_0x125748]={'$like':'%'+_0x4cfc8[_0x43e7('0x40')][_0x43e7('0x4b')]+'%'};return _0x378d15;})});}_0x14ef18=_[_0x43e7('0x4c')]({},_0x14ef18,_0x4cfc8['options']);return _0xca11fd['getAgents'](_0x14ef18);}})[_0x43e7('0x1c')](function(_0x14f20e){if(_0x14f20e){_0x1de4a1=_0x14f20e[_0x43e7('0x44')];if(!_0x4cfc8[_0x43e7('0x40')][_0x43e7('0x45')]('nolimit')){_0x14ef18[_0x43e7('0x2b')]=qs[_0x43e7('0x2b')](_0x4cfc8[_0x43e7('0x40')][_0x43e7('0x2b')]);_0x14ef18['offset']=qs['offset'](_0x4cfc8[_0x43e7('0x40')][_0x43e7('0x29')]);}return _0xca11fd[_0x43e7('0x128')](_0x14ef18);}})[_0x43e7('0x1c')](function(_0x2c2727){if(_0x2c2727){return _0x2c2727?{'count':_0x1de4a1,'rows':_0x2c2727}:null;}})['then'](respondWithResult(_0xbd8c44,null))[_0x43e7('0x25')](handleError(_0xbd8c44,null));}; \ No newline at end of file +var _0x81bd=['spread','messageId','created','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','offline','files','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','port','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','originalname','subjectOffline','mapValues','Chat','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','all','readFileSync','server/files/chat/iframe.js','remote','x-real-ip','connection','referer','replace','render','alignment','verticalAlignment','textColor','color_button','backgroundColor','addApplications','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','end','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatWebsite','includeAll','include','findAll','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Pause','describe','addDisposition','ChatWebsiteId','Disposition','findOne','hasOwnProperty','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLicense','custom','isNil','existsSync','join','root','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','download','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','headers','user-agent','getResult','chat','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','Sequelize','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','ChatApplication','applications','Applications','list','orderBy','priority','asc','account','defaults','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','version','%s\x20%s','unknown','format','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction'];(function(_0x967959,_0x53c5c1){var _0x5c4489=function(_0x1ae5c6){while(--_0x1ae5c6){_0x967959['push'](_0x967959['shift']());}};_0x5c4489(++_0x53c5c1);}(_0x81bd,0x7c));var _0xd81b=function(_0x57a50d,_0x2871f8){_0x57a50d=_0x57a50d-0x0;var _0x1b25b3=_0x81bd[_0x57a50d];return _0x1b25b3;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];config[_0xd81b('0x1b')]=_['defaults'](config[_0xd81b('0x1b')],{'host':_0xd81b('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd81b('0x1b')]));require('./chatWebsite.socket')[_0xd81b('0x1d')](socket);var jayson=require(_0xd81b('0x1e'));var client=jayson[_0xd81b('0x1f')][_0xd81b('0x20')]({'port':0x232c});var client9002=jayson[_0xd81b('0x1f')]['http']({'port':0x232a});var client9003=jayson[_0xd81b('0x1f')][_0xd81b('0x20')]({'port':0x232b});var client9001=jayson['client'][_0xd81b('0x20')]({'port':0x2329});function respondWithRpcPromise(_0x26df61,_0x4657cf,_0x15e860,_0x5f7db6){return new BPromise(function(_0xc49b8d,_0x6746f0){var _0x3d4d34=_0x5f7db6||client;return _0x3d4d34[_0xd81b('0x21')](_0x26df61,_0x15e860)[_0xd81b('0x22')](function(_0x1ff3c6){logger[_0xd81b('0x23')](_0xd81b('0x24'),_0x4657cf,_0xd81b('0x25'));logger[_0xd81b('0x26')](_0xd81b('0x27'),_0x4657cf,'request\x20sent',JSON['stringify'](_0x1ff3c6));if(_0x1ff3c6[_0xd81b('0x28')]){if(_0x1ff3c6[_0xd81b('0x28')][_0xd81b('0x29')]===0x1f4){logger['error'](_0xd81b('0x24'),_0x4657cf,_0x1ff3c6[_0xd81b('0x28')]['message']);return _0x6746f0(_0x1ff3c6[_0xd81b('0x28')][_0xd81b('0x2a')]);}logger[_0xd81b('0x28')](_0xd81b('0x24'),_0x4657cf,_0x1ff3c6[_0xd81b('0x28')][_0xd81b('0x2a')]);return _0xc49b8d(_0x1ff3c6[_0xd81b('0x28')][_0xd81b('0x2a')]);}else{logger[_0xd81b('0x23')](_0xd81b('0x24'),_0x4657cf,_0xd81b('0x25'));_0xc49b8d(_0x1ff3c6[_0xd81b('0x2b')]['message']);}})[_0xd81b('0x2c')](function(_0x99dbc9){logger[_0xd81b('0x28')](_0xd81b('0x24'),_0x4657cf,_0x99dbc9);_0x6746f0(_0x99dbc9);});});}function respondWithStatusCode(_0x3266c2,_0x2d0d02){_0x2d0d02=_0x2d0d02||0xcc;return function(_0x3e28dd){if(_0x3e28dd){return _0x3266c2[_0xd81b('0x2d')](_0x2d0d02);}return _0x3266c2[_0xd81b('0x2e')](_0x2d0d02)['end']();};}function respondWithResult(_0x469cc4,_0x4e2eff){_0x4e2eff=_0x4e2eff||0xc8;return function(_0x5c8aee){if(_0x5c8aee){return _0x469cc4[_0xd81b('0x2e')](_0x4e2eff)[_0xd81b('0x2f')](_0x5c8aee);}};}function respondWithFilteredResult(_0x5141e6,_0x481454){return function(_0x4093c8){if(_0x4093c8){var _0xf10fe0=typeof _0x481454[_0xd81b('0x30')]===_0xd81b('0x31')&&typeof _0x481454[_0xd81b('0x32')]===_0xd81b('0x31');var _0x5527ed=_0x4093c8[_0xd81b('0x33')];var _0x26f629=_0xf10fe0?0x0:_0x481454['offset'];var _0x56d80b=_0xf10fe0?_0x4093c8[_0xd81b('0x33')]:_0x481454[_0xd81b('0x30')]+_0x481454['limit'];var _0x50ce25;if(_0x56d80b>=_0x5527ed){_0x56d80b=_0x5527ed;_0x50ce25=0xc8;}else{_0x50ce25=0xce;}_0x5141e6['status'](_0x50ce25);return _0x5141e6[_0xd81b('0x34')](_0xd81b('0x35'),_0x26f629+'-'+_0x56d80b+'/'+_0x5527ed)[_0xd81b('0x2f')](_0x4093c8);}return null;};}function patchUpdates(_0x1c4cf7){return function(_0xa56339){try{jsonpatch[_0xd81b('0x36')](_0xa56339,_0x1c4cf7,!![]);}catch(_0x29aabf){return BPromise['reject'](_0x29aabf);}return _0xa56339[_0xd81b('0x37')]();};}function saveUpdates(_0x51e19c,_0x34634a){return function(_0xb1a7c9){if(_0xb1a7c9){return _0xb1a7c9[_0xd81b('0x38')](_0x51e19c)[_0xd81b('0x22')](function(_0x36c69f){return _0x36c69f;});}return null;};}function removeEntity(_0x221e1f,_0x1c20d3){return function(_0x2d23b9){if(_0x2d23b9){return _0x2d23b9[_0xd81b('0x39')]()[_0xd81b('0x22')](function(){var _0x1be4e2=_0x2d23b9[_0xd81b('0x3a')]({'plain':!![]});var _0x346038='ChatWebsites';return db['UserProfileResource'][_0xd81b('0x39')]({'where':{'type':_0x346038,'resourceId':_0x1be4e2['id']}})[_0xd81b('0x22')](function(){return _0x2d23b9;});})[_0xd81b('0x22')](function(){_0x221e1f['status'](0xcc)[_0xd81b('0x3b')]();});}};}function handleEntityNotFound(_0x37ba34,_0x5a236a){return function(_0x46f058){if(!_0x46f058){_0x37ba34[_0xd81b('0x2d')](0x194);}return _0x46f058;};}function handleError(_0x512e39,_0xed5272){_0xed5272=_0xed5272||0x1f4;return function(_0x5a48e8){logger[_0xd81b('0x28')](_0x5a48e8[_0xd81b('0x3c')]);if(_0x5a48e8[_0xd81b('0x3d')]){delete _0x5a48e8[_0xd81b('0x3d')];}_0x512e39['status'](_0xed5272)[_0xd81b('0x3e')](_0x5a48e8);};}exports[_0xd81b('0x3f')]=function(_0x3e391f,_0x67fbe5){var _0x3abd60={'include':[{'model':db['Pause'],'as':_0xd81b('0x40')}]},_0x466e98={},_0x3976fc={'count':0x0,'rows':[]};var _0x35a295=_[_0xd81b('0x41')](db['ChatWebsite'][_0xd81b('0x42')],function(_0x3a05f4){return{'name':_0x3a05f4[_0xd81b('0x43')],'type':_0x3a05f4[_0xd81b('0x44')][_0xd81b('0x45')]};});_0x466e98['model']=_[_0xd81b('0x41')](_0x35a295,_0xd81b('0x3d'));_0x466e98[_0xd81b('0x46')]=_[_0xd81b('0x47')](_0x3e391f[_0xd81b('0x46')]);_0x466e98[_0xd81b('0x48')]=_[_0xd81b('0x49')](_0x466e98[_0xd81b('0x4a')],_0x466e98[_0xd81b('0x46')]);_0x3abd60[_0xd81b('0x4b')]=_[_0xd81b('0x49')](_0x466e98['model'],qs[_0xd81b('0x4c')](_0x3e391f[_0xd81b('0x46')][_0xd81b('0x4c')]));_0x3abd60[_0xd81b('0x4b')]=_0x3abd60[_0xd81b('0x4b')][_0xd81b('0x4d')]?_0x3abd60[_0xd81b('0x4b')]:_0x466e98[_0xd81b('0x4a')];if(!_0x3e391f['query']['hasOwnProperty'](_0xd81b('0x4e'))){_0x3abd60[_0xd81b('0x32')]=qs[_0xd81b('0x32')](_0x3e391f[_0xd81b('0x46')][_0xd81b('0x32')]);_0x3abd60[_0xd81b('0x30')]=qs[_0xd81b('0x30')](_0x3e391f[_0xd81b('0x46')][_0xd81b('0x30')]);}_0x3abd60[_0xd81b('0x4f')]=qs[_0xd81b('0x50')](_0x3e391f[_0xd81b('0x46')]['sort']);_0x3abd60[_0xd81b('0x51')]=qs[_0xd81b('0x48')](_[_0xd81b('0x52')](_0x3e391f[_0xd81b('0x46')],_0x466e98[_0xd81b('0x48')]),_0x35a295);if(_0x3e391f[_0xd81b('0x46')][_0xd81b('0x53')]){_0x3abd60[_0xd81b('0x51')]=_[_0xd81b('0x54')](_0x3abd60['where'],{'$or':_[_0xd81b('0x41')](_0x35a295,function(_0x2368dd){if(_0x2368dd[_0xd81b('0x44')]!==_0xd81b('0x55')){var _0x55326b={};_0x55326b[_0x2368dd[_0xd81b('0x3d')]]={'$like':'%'+_0x3e391f[_0xd81b('0x46')][_0xd81b('0x53')]+'%'};return _0x55326b;}})});}_0x3abd60=_[_0xd81b('0x54')]({},_0x3abd60,_0x3e391f[_0xd81b('0x56')]);var _0x434ae5={'where':_0x3abd60[_0xd81b('0x51')]};return db[_0xd81b('0x57')][_0xd81b('0x33')](_0x434ae5)['then'](function(_0x534d10){_0x3976fc[_0xd81b('0x33')]=_0x534d10;if(_0x3e391f[_0xd81b('0x46')][_0xd81b('0x58')]){_0x3abd60[_0xd81b('0x59')]=[{'all':!![]}];}return db[_0xd81b('0x57')][_0xd81b('0x5a')](_0x3abd60);})[_0xd81b('0x22')](function(_0x1f2e10){_0x3976fc['rows']=_0x1f2e10;return _0x3976fc;})[_0xd81b('0x22')](respondWithFilteredResult(_0x67fbe5,_0x3abd60))[_0xd81b('0x2c')](handleError(_0x67fbe5,null));};exports[_0xd81b('0x5b')]=function(_0x3d171a,_0x4651d3){var _0x59b13b={'raw':![],'where':{'id':_0x3d171a[_0xd81b('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0xd81b('0x40')}]},_0x647c56={};_0x647c56[_0xd81b('0x4a')]=_[_0xd81b('0x47')](db[_0xd81b('0x57')][_0xd81b('0x42')]);_0x647c56[_0xd81b('0x46')]=_[_0xd81b('0x47')](_0x3d171a[_0xd81b('0x46')]);_0x647c56[_0xd81b('0x48')]=_[_0xd81b('0x49')](_0x647c56[_0xd81b('0x4a')],_0x647c56['query']);_0x59b13b[_0xd81b('0x4b')]=_['intersection'](_0x647c56[_0xd81b('0x4a')],qs[_0xd81b('0x4c')](_0x3d171a[_0xd81b('0x46')][_0xd81b('0x4c')]));_0x59b13b[_0xd81b('0x4b')]=_0x59b13b[_0xd81b('0x4b')]['length']?_0x59b13b[_0xd81b('0x4b')]:_0x647c56[_0xd81b('0x4a')];if(_0x3d171a['query']['includeAll']){_0x59b13b[_0xd81b('0x59')]=[{'all':!![]}];}_0x59b13b=_['merge']({},_0x59b13b,_0x3d171a[_0xd81b('0x56')]);return db['ChatWebsite'][_0xd81b('0x5d')](_0x59b13b)[_0xd81b('0x22')](handleEntityNotFound(_0x4651d3,null))[_0xd81b('0x22')](respondWithResult(_0x4651d3,null))['catch'](handleError(_0x4651d3,null));};exports[_0xd81b('0x5e')]=function(_0x10ed99,_0x5b7b64){return db[_0xd81b('0x57')][_0xd81b('0x5e')](_0x10ed99['body'],{})[_0xd81b('0x22')](function(_0x5e1cd7){var _0x3c9264=_0x10ed99[_0xd81b('0x5f')][_0xd81b('0x3a')]({'plain':!![]});if(!_0x3c9264)throw new Error(_0xd81b('0x60'));if(_0x3c9264[_0xd81b('0x61')]===_0xd81b('0x5f')){var _0x2f2afe=_0x5e1cd7[_0xd81b('0x3a')]({'plain':!![]});var _0xc55960=_0xd81b('0x62');return db['UserProfileSection'][_0xd81b('0x5d')]({'where':{'name':_0xc55960,'userProfileId':_0x3c9264[_0xd81b('0x63')]},'raw':!![]})[_0xd81b('0x22')](function(_0x3e4c33){if(_0x3e4c33&&_0x3e4c33[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x65')][_0xd81b('0x5e')]({'name':_0x2f2afe['name'],'resourceId':_0x2f2afe['id'],'type':_0x3e4c33['name'],'sectionId':_0x3e4c33['id']},{})['then'](function(){return _0x5e1cd7;});}else{return _0x5e1cd7;}})[_0xd81b('0x2c')](function(_0x12b0bf){logger[_0xd81b('0x28')](_0xd81b('0x66'),_0x12b0bf);throw _0x12b0bf;});}return _0x5e1cd7;})[_0xd81b('0x22')](respondWithResult(_0x5b7b64,0xc9))[_0xd81b('0x2c')](handleError(_0x5b7b64,null));};exports[_0xd81b('0x38')]=function(_0x5afecf,_0x3fcd8c){if(_0x5afecf[_0xd81b('0x67')]['id']){delete _0x5afecf[_0xd81b('0x67')]['id'];}return db[_0xd81b('0x57')][_0xd81b('0x5d')]({'where':{'id':_0x5afecf[_0xd81b('0x5c')]['id']},'include':[{'model':db[_0xd81b('0x68')],'as':'mandatoryDispositionPause'}]})[_0xd81b('0x22')](handleEntityNotFound(_0x3fcd8c,null))[_0xd81b('0x22')](saveUpdates(_0x5afecf[_0xd81b('0x67')],null))[_0xd81b('0x22')](respondWithResult(_0x3fcd8c,null))[_0xd81b('0x2c')](handleError(_0x3fcd8c,null));};exports[_0xd81b('0x39')]=function(_0x1be43d,_0x19d4f0){return db[_0xd81b('0x57')][_0xd81b('0x5d')]({'where':{'id':_0x1be43d[_0xd81b('0x5c')]['id']}})[_0xd81b('0x22')](handleEntityNotFound(_0x19d4f0,null))['then'](removeEntity(_0x19d4f0,null))[_0xd81b('0x2c')](handleError(_0x19d4f0,null));};exports['describe']=function(_0x2e7141,_0x6fa974){return db[_0xd81b('0x57')][_0xd81b('0x69')]()[_0xd81b('0x22')](respondWithResult(_0x6fa974,null))[_0xd81b('0x2c')](handleError(_0x6fa974,null));};exports[_0xd81b('0x6a')]=function(_0x18f2ac,_0x10d6d2,_0x36fb7a){if(_0x18f2ac['body']['id']){delete _0x18f2ac[_0xd81b('0x67')]['id'];}return db[_0xd81b('0x57')][_0xd81b('0x5d')]({'where':{'id':_0x18f2ac[_0xd81b('0x5c')]['id']}})[_0xd81b('0x22')](handleEntityNotFound(_0x10d6d2,null))['then'](function(_0x582ca1){if(_0x582ca1){_0x18f2ac[_0xd81b('0x67')][_0xd81b('0x6b')]=_0x582ca1['id'];return db[_0xd81b('0x6c')][_0xd81b('0x5e')](_0x18f2ac[_0xd81b('0x67')]);}})[_0xd81b('0x22')](respondWithResult(_0x10d6d2,null))[_0xd81b('0x2c')](handleError(_0x10d6d2,null));};exports['getDispositions']=function(_0x2190df,_0x41ac46,_0x9fd6d){var _0x1c6ec8={'raw':![],'where':{}};var _0x1f874d={};var _0x21d039={'count':0x0,'rows':[]};return db[_0xd81b('0x57')][_0xd81b('0x6d')]({'where':{'id':_0x2190df[_0xd81b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x41ac46,null))[_0xd81b('0x22')](function(_0x34d6dc){if(_0x34d6dc){_0x1f874d[_0xd81b('0x4a')]=_[_0xd81b('0x47')](db[_0xd81b('0x6c')]['rawAttributes']);_0x1f874d[_0xd81b('0x46')]=_[_0xd81b('0x47')](_0x2190df['query']);_0x1f874d[_0xd81b('0x48')]=_[_0xd81b('0x49')](_0x1f874d['model'],_0x1f874d[_0xd81b('0x46')]);_0x1c6ec8[_0xd81b('0x4b')]=_[_0xd81b('0x49')](_0x1f874d['model'],qs[_0xd81b('0x4c')](_0x2190df[_0xd81b('0x46')][_0xd81b('0x4c')]));_0x1c6ec8['attributes']=_0x1c6ec8['attributes'][_0xd81b('0x4d')]?_0x1c6ec8[_0xd81b('0x4b')]:_0x1f874d[_0xd81b('0x4a')];if(!_0x2190df['query'][_0xd81b('0x6e')](_0xd81b('0x4e'))){_0x1c6ec8[_0xd81b('0x32')]=qs[_0xd81b('0x32')](_0x2190df['query']['limit']);_0x1c6ec8[_0xd81b('0x30')]=qs[_0xd81b('0x30')](_0x2190df[_0xd81b('0x46')][_0xd81b('0x30')]);}_0x1c6ec8['order']=qs[_0xd81b('0x50')](_0x2190df[_0xd81b('0x46')]['sort']);_0x1c6ec8[_0xd81b('0x51')]=qs['filters'](_[_0xd81b('0x52')](_0x2190df[_0xd81b('0x46')],_0x1f874d['filters']));_0x1c6ec8[_0xd81b('0x51')][_0xd81b('0x6b')]=_0x34d6dc['id'];if(_0x2190df[_0xd81b('0x46')][_0xd81b('0x53')]){_0x1c6ec8[_0xd81b('0x51')]=_['merge'](_0x1c6ec8[_0xd81b('0x51')],{'$or':_[_0xd81b('0x41')](_0x1c6ec8[_0xd81b('0x4b')],function(_0x2cc2d2){var _0x1919b2={};_0x1919b2[_0x2cc2d2]={'$like':'%'+_0x2190df[_0xd81b('0x46')]['filter']+'%'};return _0x1919b2;})});}_0x1c6ec8=_['merge']({},_0x1c6ec8,_0x2190df[_0xd81b('0x56')]);return db[_0xd81b('0x6c')][_0xd81b('0x33')]({'where':_0x1c6ec8[_0xd81b('0x51')]})['then'](function(_0x1afacb){_0x21d039[_0xd81b('0x33')]=_0x1afacb;if(_0x2190df[_0xd81b('0x46')][_0xd81b('0x58')]){_0x1c6ec8[_0xd81b('0x59')]=[{'all':!![]}];}return db['Disposition'][_0xd81b('0x5a')](_0x1c6ec8);})[_0xd81b('0x22')](function(_0x159b28){_0x21d039[_0xd81b('0x6f')]=_0x159b28;return _0x21d039;});}})[_0xd81b('0x22')](respondWithFilteredResult(_0x41ac46,_0x1c6ec8))[_0xd81b('0x2c')](handleError(_0x41ac46,null));};exports[_0xd81b('0x70')]=function(_0x57179a,_0x3dc419,_0x2ef7ae){return db[_0xd81b('0x57')][_0xd81b('0x5d')]({'where':{'id':_0x57179a[_0xd81b('0x5c')]['id']}})[_0xd81b('0x22')](handleEntityNotFound(_0x3dc419,null))['then'](function(_0x451fd3){if(_0x451fd3){return _0x451fd3['removeDispositions'](_0x57179a[_0xd81b('0x46')][_0xd81b('0x71')]);}})[_0xd81b('0x22')](respondWithStatusCode(_0x3dc419,null))['catch'](handleError(_0x3dc419,null));};exports[_0xd81b('0x72')]=function(_0x27f848,_0x3ee396,_0x5060dc){if(_0x27f848[_0xd81b('0x67')]['id']){delete _0x27f848[_0xd81b('0x67')]['id'];}return db['ChatWebsite'][_0xd81b('0x5d')]({'where':{'id':_0x27f848['params']['id']}})['then'](handleEntityNotFound(_0x3ee396,null))[_0xd81b('0x22')](function(_0x428317){if(_0x428317){_0x27f848[_0xd81b('0x67')]['ChatWebsiteId']=_0x428317['id'];return db[_0xd81b('0x73')][_0xd81b('0x5e')](_0x27f848[_0xd81b('0x67')]);}})[_0xd81b('0x22')](respondWithResult(_0x3ee396,null))[_0xd81b('0x2c')](handleError(_0x3ee396,null));};exports[_0xd81b('0x74')]=function(_0x57586b,_0x22c044,_0x4390c3){var _0x10a27a={'raw':![],'where':{}};var _0xea1be={};var _0x19792d={'count':0x0,'rows':[]};return db[_0xd81b('0x57')][_0xd81b('0x6d')]({'where':{'id':_0x57586b[_0xd81b('0x5c')]['id']}})[_0xd81b('0x22')](handleEntityNotFound(_0x22c044,null))[_0xd81b('0x22')](function(_0x2fea95){if(_0x2fea95){_0xea1be[_0xd81b('0x4a')]=_[_0xd81b('0x47')](db[_0xd81b('0x73')][_0xd81b('0x42')]);_0xea1be['query']=_[_0xd81b('0x47')](_0x57586b['query']);_0xea1be[_0xd81b('0x48')]=_[_0xd81b('0x49')](_0xea1be[_0xd81b('0x4a')],_0xea1be[_0xd81b('0x46')]);_0x10a27a[_0xd81b('0x4b')]=_[_0xd81b('0x49')](_0xea1be['model'],qs[_0xd81b('0x4c')](_0x57586b[_0xd81b('0x46')][_0xd81b('0x4c')]));_0x10a27a[_0xd81b('0x4b')]=_0x10a27a[_0xd81b('0x4b')][_0xd81b('0x4d')]?_0x10a27a[_0xd81b('0x4b')]:_0xea1be[_0xd81b('0x4a')];if(!_0x57586b[_0xd81b('0x46')][_0xd81b('0x6e')](_0xd81b('0x4e'))){_0x10a27a[_0xd81b('0x32')]=qs['limit'](_0x57586b[_0xd81b('0x46')][_0xd81b('0x32')]);_0x10a27a[_0xd81b('0x30')]=qs[_0xd81b('0x30')](_0x57586b[_0xd81b('0x46')]['offset']);}_0x10a27a[_0xd81b('0x4f')]=qs[_0xd81b('0x50')](_0x57586b[_0xd81b('0x46')][_0xd81b('0x50')]);_0x10a27a[_0xd81b('0x51')]=qs[_0xd81b('0x48')](_['pick'](_0x57586b[_0xd81b('0x46')],_0xea1be['filters']));_0x10a27a[_0xd81b('0x51')][_0xd81b('0x6b')]=_0x2fea95['id'];if(_0x57586b[_0xd81b('0x46')][_0xd81b('0x53')]){_0x10a27a['where']=_[_0xd81b('0x54')](_0x10a27a[_0xd81b('0x51')],{'$or':_['map'](_0x10a27a[_0xd81b('0x4b')],function(_0x142d78){var _0x2c1a0e={};_0x2c1a0e[_0x142d78]={'$like':'%'+_0x57586b[_0xd81b('0x46')][_0xd81b('0x53')]+'%'};return _0x2c1a0e;})});}_0x10a27a=_['merge']({},_0x10a27a,_0x57586b['options']);return db[_0xd81b('0x73')]['count']({'where':_0x10a27a[_0xd81b('0x51')]})['then'](function(_0x509001){_0x19792d[_0xd81b('0x33')]=_0x509001;if(_0x57586b[_0xd81b('0x46')]['includeAll']){_0x10a27a['include']=[{'all':!![]}];}return db[_0xd81b('0x73')][_0xd81b('0x5a')](_0x10a27a);})['then'](function(_0x3bd71a){_0x19792d[_0xd81b('0x6f')]=_0x3bd71a;return _0x19792d;});}})[_0xd81b('0x22')](respondWithFilteredResult(_0x22c044,_0x10a27a))[_0xd81b('0x2c')](handleError(_0x22c044,null));};exports['removeAnswers']=function(_0xc4ece6,_0x41ee4c,_0x105e33){return db['ChatWebsite']['find']({'where':{'id':_0xc4ece6[_0xd81b('0x5c')]['id']}})[_0xd81b('0x22')](handleEntityNotFound(_0x41ee4c,null))[_0xd81b('0x22')](function(_0x3a1ca9){if(_0x3a1ca9){return _0x3a1ca9[_0xd81b('0x75')](_0xc4ece6['query']['ids']);}})[_0xd81b('0x22')](respondWithStatusCode(_0x41ee4c,null))[_0xd81b('0x2c')](handleError(_0x41ee4c,null));};exports['addLogo']=function(_0x4846ca,_0x3a5357,_0x3619be){_0x4846ca[_0xd81b('0x67')][_0xd81b('0x76')]=_0x4846ca[_0xd81b('0x77')][_0xd81b('0x78')];return db[_0xd81b('0x57')][_0xd81b('0x5d')]({'where':{'id':_0x4846ca[_0xd81b('0x5c')]['id']}})[_0xd81b('0x22')](handleEntityNotFound(_0x3a5357,null))['then'](saveUpdates(_0x4846ca['body'],null))[_0xd81b('0x22')](respondWithResult(_0x3a5357,null))[_0xd81b('0x2c')](handleError(_0x3a5357,null));};exports[_0xd81b('0x79')]=function(_0x7319a,_0x145c8a,_0x3cc2fa){_0x7319a[_0xd81b('0x67')][_0xd81b('0x7a')]=_0x7319a[_0xd81b('0x77')][_0xd81b('0x78')];return db[_0xd81b('0x57')][_0xd81b('0x5d')]({'where':{'id':_0x7319a[_0xd81b('0x5c')]['id']}})[_0xd81b('0x22')](handleEntityNotFound(_0x145c8a,null))[_0xd81b('0x22')](saveUpdates(_0x7319a['body'],null))[_0xd81b('0x22')](respondWithResult(_0x145c8a,null))[_0xd81b('0x2c')](handleError(_0x145c8a,null));};exports[_0xd81b('0x7b')]=function(_0x5209de,_0x18cde7,_0x3bd28c){_0x5209de[_0xd81b('0x67')][_0xd81b('0x7c')]=_0x5209de[_0xd81b('0x77')]['filename'];return db[_0xd81b('0x57')][_0xd81b('0x5d')]({'where':{'id':_0x5209de[_0xd81b('0x5c')]['id']}})[_0xd81b('0x22')](handleEntityNotFound(_0x18cde7,null))[_0xd81b('0x22')](saveUpdates(_0x5209de[_0xd81b('0x67')],null))[_0xd81b('0x22')](respondWithResult(_0x18cde7,null))[_0xd81b('0x2c')](handleError(_0x18cde7,null));};exports[_0xd81b('0x7d')]=function(_0x282e83,_0x18949b,_0x3a0aee){_0x282e83['body'][_0xd81b('0x7e')]=_0x282e83[_0xd81b('0x77')][_0xd81b('0x78')];return db['ChatWebsite'][_0xd81b('0x5d')]({'where':{'id':_0x282e83[_0xd81b('0x5c')]['id']}})[_0xd81b('0x22')](handleEntityNotFound(_0x18949b,null))[_0xd81b('0x22')](saveUpdates(_0x282e83['body'],null))[_0xd81b('0x22')](respondWithResult(_0x18949b,null))['catch'](handleError(_0x18949b,null));};exports['getLogo']=function(_0x1ed83e,_0x26548a,_0x22e737){var _0x1a0ae3=path['join'](config['root'],'server/files/images/logos/default_logo.svg');var _0xf0c9a0={'where':{'id':_0x1ed83e[_0xd81b('0x5c')]['id']},'attributes':['id',_0xd81b('0x76')],'raw':!![]};var _0xf37aa6=![];return require(_0xd81b('0x1a'))[_0xd81b('0x7f')]()[_0xd81b('0x22')](function(_0xf9ee1d){if(_0xf9ee1d){_0xf37aa6=_0xf9ee1d[_0xd81b('0x80')];}})[_0xd81b('0x22')](function(){return db[_0xd81b('0x57')][_0xd81b('0x5d')](_0xf0c9a0);})[_0xd81b('0x22')](handleEntityNotFound(_0x26548a,null))[_0xd81b('0x22')](function(_0x33db02){if(_0x33db02){if(!_[_0xd81b('0x81')](_0x33db02[_0xd81b('0x76')])){if(fs[_0xd81b('0x82')](path[_0xd81b('0x83')](config[_0xd81b('0x84')],'server/files/images/logos/',_0x33db02[_0xd81b('0x76')]))&&_0xf37aa6){_0x1a0ae3=path[_0xd81b('0x83')](config[_0xd81b('0x84')],_0xd81b('0x85'),_0x33db02[_0xd81b('0x76')]);}}return _0x26548a['download'](_0x1a0ae3);}})[_0xd81b('0x2c')](handleError(_0x26548a,null));};exports[_0xd81b('0x86')]=function(_0x59a51a,_0x8f3a9f,_0x4610f4){var _0x468372=path[_0xd81b('0x83')](config[_0xd81b('0x84')],_0xd81b('0x87'));var _0x22e808={'where':{'id':_0x59a51a[_0xd81b('0x5c')]['id']},'attributes':['id',_0xd81b('0x7a')],'raw':!![]};return db[_0xd81b('0x57')][_0xd81b('0x5d')](_0x22e808)[_0xd81b('0x22')](handleEntityNotFound(_0x8f3a9f,null))[_0xd81b('0x22')](function(_0xf4ed2a){if(_0xf4ed2a){if(!_['isNil'](_0xf4ed2a[_0xd81b('0x7a')])){if(fs['existsSync'](path[_0xd81b('0x83')](config[_0xd81b('0x84')],_0xd81b('0x88'),_0xf4ed2a['agentAvatar']))){_0x468372=path[_0xd81b('0x83')](config[_0xd81b('0x84')],_0xd81b('0x88'),_0xf4ed2a[_0xd81b('0x7a')]);}}return _0x8f3a9f['download'](_0x468372);}})[_0xd81b('0x2c')](handleError(_0x8f3a9f,null));};exports[_0xd81b('0x89')]=function(_0x1fb71f,_0xf2e1b5,_0x441e6b){var _0x2977fb=path[_0xd81b('0x83')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x2e48b5={'where':{'id':_0x1fb71f[_0xd81b('0x5c')]['id']},'attributes':['id',_0xd81b('0x7c'),'showCustomerAvatar'],'raw':!![]};return db[_0xd81b('0x57')]['find'](_0x2e48b5)[_0xd81b('0x22')](handleEntityNotFound(_0xf2e1b5,null))[_0xd81b('0x22')](function(_0xc12aa2){if(_0xc12aa2){if(!_[_0xd81b('0x81')](_0xc12aa2[_0xd81b('0x7c')])){if(fs[_0xd81b('0x82')](path[_0xd81b('0x83')](config[_0xd81b('0x84')],_0xd81b('0x88'),_0xc12aa2['customerAvatar']))&&_0xc12aa2[_0xd81b('0x8a')]){_0x2977fb=path[_0xd81b('0x83')](config[_0xd81b('0x84')],'server/files/images/avatars/',_0xc12aa2['customerAvatar']);}}return _0xf2e1b5[_0xd81b('0x8b')](_0x2977fb);}})[_0xd81b('0x2c')](handleError(_0xf2e1b5,null));};exports[_0xd81b('0x8c')]=function(_0x3e6a85,_0x3a6ac2,_0x175d02){var _0x151693=path[_0xd81b('0x83')](config['root'],_0xd81b('0x8d'));var _0x1f9cf3={'where':{'id':_0x3e6a85[_0xd81b('0x5c')]['id']},'attributes':['id',_0xd81b('0x7e')],'raw':!![]};return db['ChatWebsite'][_0xd81b('0x5d')](_0x1f9cf3)['then'](handleEntityNotFound(_0x3a6ac2,null))[_0xd81b('0x22')](function(_0xecf9c6){if(_0xecf9c6){if(!_[_0xd81b('0x81')](_0xecf9c6['systemAvatar'])){if(fs[_0xd81b('0x82')](path[_0xd81b('0x83')](config['root'],_0xd81b('0x88'),_0xecf9c6['systemAvatar']))){_0x151693=path[_0xd81b('0x83')](config[_0xd81b('0x84')],_0xd81b('0x88'),_0xecf9c6['systemAvatar']);}}return _0x3a6ac2[_0xd81b('0x8b')](_0x151693);}})[_0xd81b('0x2c')](handleError(_0x3a6ac2,null));};exports[_0xd81b('0x8e')]=function(_0x1dc3d7,_0x1e2612,_0x5dc7b1){var _0x51b399=require(_0xd81b('0x8f'));var _0x188c72=new _0x51b399();var _0xe523e6=_0x188c72['setUA'](_0x1dc3d7[_0xd81b('0x90')][_0xd81b('0x91')])[_0xd81b('0x92')]();var _0x211d28={'body':_0x1dc3d7[_0xd81b('0x67')],'channel':_0xd81b('0x93')};var _0x23ffb1=[];var _0x52643b=[];var _0x4bb34f={};var _0x56b536=![];return db[_0xd81b('0x94')][_0xd81b('0x69')]()['then'](function(_0x1d2e40){if(!_0x1d2e40){throw new db['Sequelize']['ValidationError'](_0xd81b('0x95'));}_0x23ffb1=_[_0xd81b('0x96')](_[_0xd81b('0x47')](_0x1d2e40),[_0xd81b('0x97'),_0xd81b('0x98')]);_0x52643b=_[_0xd81b('0x96')](_[_0xd81b('0x47')](_0x1d2e40),[_0xd81b('0x97'),_0xd81b('0x98'),_0xd81b('0x99'),_0xd81b('0x9a')]);if(_0x1dc3d7[_0xd81b('0x67')]['id']){delete _0x1dc3d7[_0xd81b('0x67')]['id'];}if(_[_0xd81b('0x81')](_0x1dc3d7[_0xd81b('0x67')]['from'])){throw new db[(_0xd81b('0x9b'))][(_0xd81b('0x9c'))]('from\x20is\x20mandatory');}if(_[_0xd81b('0x81')](_0x1dc3d7['body'][_0xd81b('0x67')])||_0x1dc3d7['body'][_0xd81b('0x67')]===''){throw new db[(_0xd81b('0x9b'))][(_0xd81b('0x9c'))](_0xd81b('0x9d'));}if(_[_0xd81b('0x81')](_0x1dc3d7[_0xd81b('0x67')][_0xd81b('0x9e')])){throw new db[(_0xd81b('0x9b'))][(_0xd81b('0x9c'))](_0xd81b('0x9f')+_0x52643b);}if(!_[_0xd81b('0xa0')](_0x52643b,_0x1dc3d7[_0xd81b('0x67')]['mapKey'])){throw new db[(_0xd81b('0x9b'))][(_0xd81b('0x9c'))](_0xd81b('0xa1')+_0x52643b);}_0x4bb34f[_0x1dc3d7[_0xd81b('0x67')][_0xd81b('0x9e')]]=_0x1dc3d7[_0xd81b('0x67')][_0xd81b('0xa2')];})[_0xd81b('0x22')](function(){return db[_0xd81b('0x57')][_0xd81b('0x5d')]({'where':{'id':_0x1dc3d7['params']['id']},'include':[{'model':db[_0xd81b('0xa3')],'as':_0xd81b('0xa4'),'include':[{'model':db['CmContact'],'as':_0xd81b('0xa5'),'where':_0x4bb34f,'limit':0x1,'order':[['updatedAt',_0xd81b('0xa6')]]}]},{'model':db[_0xd81b('0xa7')],'as':'Applications'}]});})[_0xd81b('0x22')](handleEntityNotFound(_0x1e2612,null))[_0xd81b('0x22')](function(_0x3255bd){if(_0x3255bd&&_0x3255bd[_0xd81b('0xa4')]){_0x211d28['account']=_0x3255bd;_0x211d28[_0xd81b('0xa8')]=_0x3255bd[_0xd81b('0xa9')];_0x211d28[_0xd81b('0xaa')]=_0x3255bd[_0xd81b('0xa4')];_0x211d28[_0xd81b('0xa8')]=_[_0xd81b('0xab')](_0x211d28['applications'],[_0xd81b('0xac')],[_0xd81b('0xad')]);if(_0x211d28[_0xd81b('0xae')]['Applications']){delete _0x211d28['account'][_0xd81b('0xa9')];}if(_0x211d28[_0xd81b('0xae')][_0xd81b('0xa4')]&&_0x211d28['account'][_0xd81b('0xa4')][_0xd81b('0xa5')][_0xd81b('0x4d')]){return _0x211d28[_0xd81b('0xae')][_0xd81b('0xa4')][_0xd81b('0xa5')][0x0];}var _0x4fa362=_[_0xd81b('0xaf')](_0x1dc3d7[_0xd81b('0x67')],{'firstName':_0x1dc3d7['body'][_0xd81b('0xa2')],'ListId':_0x3255bd[_0xd81b('0x9a')]});_0x4fa362[_0x1dc3d7['body'][_0xd81b('0x9e')]]=_0x1dc3d7[_0xd81b('0x67')][_0xd81b('0xa2')];return db[_0xd81b('0x94')][_0xd81b('0x5e')](_0x4fa362,{'fields':_0x23ffb1,'raw':!![]});}})[_0xd81b('0x22')](handleEntityNotFound(_0x1e2612,null))[_0xd81b('0x22')](function(_0x51c3e3){_0x211d28[_0xd81b('0xb0')]=_0x51c3e3;var _0x203311=_0x1dc3d7['body'][_0xd81b('0xb1')];if(_0x1dc3d7[_0xd81b('0x90')]['cf-connecting-ip']){_0x203311=_0x1dc3d7[_0xd81b('0x90')][_0xd81b('0xb2')];}else if(_0x1dc3d7[_0xd81b('0x90')][_0xd81b('0xb3')]){_0x203311=_[_0xd81b('0xb4')](_0x1dc3d7['headers'][_0xd81b('0xb3')][_0xd81b('0xb5')](','));}if(_0x51c3e3){var _0x13a568={'ContactId':_0x51c3e3['id'],'ChatWebsiteId':_0x1dc3d7[_0xd81b('0x5c')]['id'],'from':(_0x51c3e3[_0xd81b('0xb6')]||'')+'\x20'+(_0x51c3e3[_0xd81b('0xb7')]||''),'customerIp':_0x203311,'customerPort':_0x1dc3d7[_0xd81b('0x90')][_0xd81b('0xb8')]?_0x1dc3d7[_0xd81b('0x90')][_0xd81b('0xb8')]:null,'referer':_0x1dc3d7[_0xd81b('0x67')]['referer'],'browserName':_0xe523e6['browser'][_0xd81b('0x3d')]&&_0xe523e6[_0xd81b('0xb9')][_0xd81b('0xba')]?util['format'](_0xd81b('0xbb'),_0xe523e6[_0xd81b('0xb9')][_0xd81b('0x3d')],_0xe523e6['browser'][_0xd81b('0xba')]):_0xd81b('0xbc'),'browserVersion':_0xe523e6['browser'][_0xd81b('0xba')]||_0xd81b('0xbc'),'osName':util[_0xd81b('0xbd')](_0xd81b('0xbb'),_0xe523e6['os'][_0xd81b('0x3d')],_0xe523e6['os'][_0xd81b('0xba')]),'osVersion':_0xe523e6['os'][_0xd81b('0xba')],'deviceModel':_0xe523e6['device'][_0xd81b('0x4a')]&&_0xe523e6[_0xd81b('0xbe')]['vendor']?util[_0xd81b('0xbd')]('%s\x20%s\x20%s',_0xe523e6[_0xd81b('0xbe')][_0xd81b('0x4a')],_0xe523e6[_0xd81b('0xbe')][_0xd81b('0xbf')],_0xe523e6[_0xd81b('0xbe')][_0xd81b('0x44')]):null,'deviceVendor':_0xe523e6[_0xd81b('0xbe')]['vendor'],'deviceType':_0xe523e6[_0xd81b('0xbe')]['type'],'formData':JSON['stringify'](_0x1dc3d7[_0xd81b('0x67')])};var _0x4ab039={'ChatWebsiteId':_0x1dc3d7[_0xd81b('0x5c')]['id'],'closed':![]};if(_0x1dc3d7[_0xd81b('0x67')][_0xd81b('0xc0')]){_0x4ab039[_0xd81b('0xc0')]=_0x1dc3d7['body']['threadId'];return db[_0xd81b('0xc1')][_0xd81b('0x5d')]({'where':_0x4ab039})['then'](function(_0x2ec729){if(_0x2ec729){return[_0x2ec729,![]];}_0x13a568[_0xd81b('0xc0')]=_0x1dc3d7[_0xd81b('0x67')]['threadId'];_0x13a568[_0xd81b('0xc2')]=_0x1dc3d7[_0xd81b('0x67')]['externalUrl'];return db[_0xd81b('0xc1')][_0xd81b('0x5e')](_0x13a568)[_0xd81b('0x22')](function(_0x167944){return[_0x167944,!![]];});});}_0x4ab039[_0xd81b('0xc3')]=_0x51c3e3['id'];if(_0x1dc3d7['body']['interaction']&&_0x1dc3d7[_0xd81b('0x67')][_0xd81b('0xc4')]['id']){_0x4ab039['id']=_0x1dc3d7[_0xd81b('0x67')][_0xd81b('0xc4')]['id'];return db['ChatInteraction'][_0xd81b('0x5d')]({'where':_0x4ab039})['then'](function(_0x206b13){if(_0x206b13){return[_0x206b13,![]];}return db[_0xd81b('0xc1')]['create'](_0x13a568)[_0xd81b('0x22')](function(_0x264d72){return[_0x264d72,!![]];});});}return db[_0xd81b('0xc1')]['create'](_0x13a568)[_0xd81b('0x22')](function(_0x239f69){return[_0x239f69,!![]];});}})[_0xd81b('0xc5')](function(_0x56e80f,_0x3cc12d){if(_0x56e80f){_0x56b536=_0x3cc12d;if(!_0x3cc12d){var _0x11e278={'from':(_0x211d28[_0xd81b('0xb0')][_0xd81b('0xb6')]||'')+'\x20'+(_0x211d28[_0xd81b('0xb0')]['lastName']||'')};if(_0x1dc3d7['body'][_0xd81b('0xc0')]&&_0x1dc3d7[_0xd81b('0x67')][_0xd81b('0xc6')]&&_0x1dc3d7[_0xd81b('0x67')]['threadId']!=_0x1dc3d7[_0xd81b('0x67')][_0xd81b('0xc6')]){_0x11e278[_0xd81b('0xc0')]=_0x1dc3d7['body'][_0xd81b('0xc6')];}return _0x56e80f[_0xd81b('0x38')](_0x11e278);}else{return _0x56e80f;}}})[_0xd81b('0x22')](function(_0x515bee){_0x211d28['interaction']=_0x515bee['get']({'plain':!![]});_0x211d28[_0xd81b('0xc4')]['created']=_0x56b536;if(_0x211d28[_0xd81b('0xc4')][_0xd81b('0xc7')]){if(_0x211d28[_0xd81b('0xae')]['autoclose']){_0x211d28['applications'][_0xd81b('0xc8')]({'id':0x0,'priority':_0x211d28['applications'][_0xd81b('0x4d')]+0x1,'app':_0xd81b('0xc9'),'appdata':_0xd81b('0xca'),'interval':_0xd81b('0xcb')});}}return db['ChatMessage'][_0xd81b('0x5e')]({'body':_0x1dc3d7[_0xd81b('0x67')][_0xd81b('0x67')],'ChatWebsiteId':_0x1dc3d7['params']['id'],'ChatInteractionId':_0x515bee['id'],'direction':'in','ContactId':_0x211d28[_0xd81b('0xb0')]['id'],'AttachmentId':_0x1dc3d7['body'][_0xd81b('0xcc')]});})[_0xd81b('0x22')](function(_0x5ceeb0){_0x211d28[_0xd81b('0x2a')]=_0x5ceeb0;if(_0x211d28[_0xd81b('0xc4')][_0xd81b('0xcd')]){return db['User']['find']({'attributes':['id',_0xd81b('0x3d')],'where':{'id':_0x211d28[_0xd81b('0xc4')][_0xd81b('0xcd')]}})[_0xd81b('0x22')](function(_0x2e611d){if(_0x2e611d){_0x211d28[_0xd81b('0xa8')][_0xd81b('0xce')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2e611d['name']+','+(_0x211d28[_0xd81b('0xae')][_0xd81b('0xcf')]||0xa),'interval':_0xd81b('0xcb')});_0x211d28[_0xd81b('0xd0')]=!![];}return respondWithRpcPromise('Start',_0xd81b('0xd1'),_0x211d28);});}return respondWithRpcPromise(_0xd81b('0xd2'),_0xd81b('0xd1'),_0x211d28);})[_0xd81b('0x22')](function(_0x1224ee){respondWithRpcPromise('EventManager','EventManager',{'event':_0xd81b('0x8e'),'message':_0x1224ee},client9002);return _0x1224ee;})[_0xd81b('0x22')](respondWithResult(_0x1e2612,null))[_0xd81b('0x2c')](handleError(_0x1e2612,null));};exports[_0xd81b('0xd3')]=function(_0x14833d,_0x5ce2b1,_0x49e5dd){var _0x30ddbd,_0x5890b2,_0x32cf81;var _0x282bb0=[];var _0x2e008a=[];var _0x3ddf0b={};var _0x2f2e19=_0x14833d[_0xd81b('0xd4')]||[];var _0x30440c=[];var _0xad0a5b;return db[_0xd81b('0x94')][_0xd81b('0x69')]()[_0xd81b('0x22')](function(_0x43a84b){if(!_0x43a84b){throw new db[(_0xd81b('0x9b'))][(_0xd81b('0x9c'))](_0xd81b('0x95'));}_0x2e008a=_[_0xd81b('0x96')](_['keys'](_0x43a84b),[_0xd81b('0x97'),'updatedAt']);_0x282bb0=_[_0xd81b('0x96')](_[_0xd81b('0x47')](_0x43a84b),[_0xd81b('0x97'),_0xd81b('0x98'),'CompanyId',_0xd81b('0x9a')]);if(_0x14833d['body']['id']){delete _0x14833d[_0xd81b('0x67')]['id'];}if(_[_0xd81b('0x81')](_0x14833d['body'][_0xd81b('0xa2')])){throw _0x5ce2b1['status'](0x1f4)[_0xd81b('0x3e')](new db[(_0xd81b('0x9b'))][(_0xd81b('0x9c'))](_0xd81b('0xd5')));}if(_[_0xd81b('0x81')](_0x14833d[_0xd81b('0x67')][_0xd81b('0x67')])||_0x14833d[_0xd81b('0x67')][_0xd81b('0x67')]===''){throw _0x5ce2b1[_0xd81b('0x2e')](0x1f4)[_0xd81b('0x3e')](new db[(_0xd81b('0x9b'))]['ValidationError'](_0xd81b('0x9d')));}if(_['isNil'](_0x14833d[_0xd81b('0x67')][_0xd81b('0xd6')])){throw _0x5ce2b1[_0xd81b('0x2e')](0x1f4)[_0xd81b('0x3e')](new db[(_0xd81b('0x9b'))][(_0xd81b('0x9c'))](_0xd81b('0xd7')+_0x282bb0));}if(!_['includes'](_0x282bb0,_0x14833d[_0xd81b('0x67')]['mapKeyOffline'])){throw _0x5ce2b1[_0xd81b('0x2e')](0x1f4)['send'](new db[(_0xd81b('0x9b'))]['ValidationError'](_0xd81b('0xd8')+_0x282bb0));}_0x3ddf0b[_0x14833d[_0xd81b('0x67')][_0xd81b('0xd6')]]=_0x14833d[_0xd81b('0x67')]['from'];})[_0xd81b('0x22')](function(){return db[_0xd81b('0x57')]['find']({'where':{'id':_0x14833d['params']['id']},'include':[{'model':db['CmList'],'as':_0xd81b('0xa4')},{'model':db[_0xd81b('0xd9')],'as':_0xd81b('0xd9')}]});})[_0xd81b('0x22')](handleEntityNotFound(_0x5ce2b1,null))[_0xd81b('0x22')](function(_0x6f49fd){if(_0x6f49fd&&_0x6f49fd['List']){_0x5890b2=_0x6f49fd;var _0x5e4621=_[_0xd81b('0xaf')](_0x14833d['body'],{'firstName':_0x14833d[_0xd81b('0x67')][_0xd81b('0xa2')],'phone':_0x14833d[_0xd81b('0x67')][_0xd81b('0xa2')],'ListId':_0x6f49fd[_0xd81b('0x9a')]});_0x5e4621[_0x14833d[_0xd81b('0x67')][_0xd81b('0xd6')]]=_0x14833d[_0xd81b('0x67')][_0xd81b('0xa2')];return db[_0xd81b('0x94')][_0xd81b('0xda')]({'where':_0x3ddf0b,'defaults':_0x5e4621});}})[_0xd81b('0xc5')](function(_0x12012b){if(_0x12012b){_0x32cf81=_0x12012b;var _0x1efe61=fs['readFileSync'](path[_0xd81b('0x83')](config[_0xd81b('0x84')],_0xd81b('0xdb')),_0xd81b('0xdc'));var _0x47382b=ejs['render'](_0x1efe61,{'body':_[_0xd81b('0xdd')](_0x14833d['body']['body']),'bodyTitle':_0x5890b2[_0xd81b('0xde')]});return db['ChatOfflineMessage'][_0xd81b('0x5e')]({'body':_0x47382b,'ContactId':_0x12012b['id'],'ChatWebsiteId':_0x5890b2['id']});}})[_0xd81b('0x22')](function(_0x312120){_0xad0a5b=_0x312120;if(_0x2f2e19['length']){var _0x317c20=_0x2f2e19[_0xd81b('0x41')](function(_0x2ddc4d){return{'name':_0x2ddc4d['originalname'],'basename':_0x2ddc4d[_0xd81b('0x78')],'type':_0x2ddc4d[_0xd81b('0xdf')],'ChatOfflineMessageId':_0x312120['id']};});_0x30440c=_0x317c20[_0xd81b('0x41')](_0xad9c8f=>{var _0x202d6a={'filename':_0xad9c8f[_0xd81b('0x3d')],'path':path['join'](config[_0xd81b('0x84')],_0xd81b('0xe0'),_0xd81b('0xd4'),_0xd81b('0xe1'),_0xd81b('0xe2'),_0xad9c8f[_0xd81b('0xe3')])};return _0x202d6a;});if(!_0x5890b2[_0xd81b('0xe4')]){return db[_0xd81b('0xe5')][_0xd81b('0xe6')](function(_0x5059a6){return db[_0xd81b('0xe7')][_0xd81b('0xe8')](_0x317c20,{'transaction':_0x5059a6});});}}})[_0xd81b('0x22')](function(){if(_0xad0a5b){_0x30ddbd=_0xad0a5b;return db[_0xd81b('0xd9')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0xd81b('0xe9')],'as':_0xd81b('0xea'),'raw':!![]}]});}})[_0xd81b('0x22')](function(_0x5338a2){if(_0x5338a2&&_0x5338a2[_0xd81b('0xea')]&&_0x5890b2[_0xd81b('0xeb')]&&_0x5890b2[_0xd81b('0xec')]){var _0x37e45c={'tls':{'rejectUnauthorized':![]}};if(_0x5338a2[_0xd81b('0xea')]['service']){_0x37e45c[_0xd81b('0xed')]=_0x5338a2[_0xd81b('0xea')][_0xd81b('0xed')];}else{_0x37e45c['host']=_0x5338a2[_0xd81b('0xea')]['host'];_0x37e45c['port']=_0x5338a2[_0xd81b('0xea')][_0xd81b('0xee')];_0x37e45c['secure']=_0x5338a2[_0xd81b('0xea')]['secure'];}if(_0x5338a2[_0xd81b('0xea')][_0xd81b('0xef')]){_0x37e45c[_0xd81b('0xf0')]={'user':_0x5338a2[_0xd81b('0xea')]['user'],'pass':_0x5338a2[_0xd81b('0xea')][_0xd81b('0xf1')]};}return respondWithRpcPromise(_0xd81b('0xf2'),_0xd81b('0xf3'),{'account':_0x37e45c,'message':{'from':util[_0xd81b('0xbd')](_0xd81b('0xf4'),_0x5338a2['name'],_0x5338a2[_0xd81b('0xf5')]||_0x5338a2['Smtp']['user']),'to':_0x5890b2[_0xd81b('0xec')],'subject':_0x5890b2[_0xd81b('0xf6')],'html':_0x30ddbd[_0xd81b('0x67')],'attachments':_0x30440c}},client9003)['then'](function(){return _0x30ddbd;})[_0xd81b('0x2c')](function(_0x1c8cd9){console['error'](_0x1c8cd9);});}})['then'](function(){if(_0x5890b2&&_0x5890b2[_0xd81b('0xe4')]&&_0x5890b2[_0xd81b('0xf7')]){var _0x44e2a8=[];if(_0x2f2e19[_0xd81b('0x4d')]){_0x44e2a8=_0x2f2e19[_0xd81b('0x41')](function(_0xe64036){return{'name':_0xe64036[_0xd81b('0xf8')],'basename':_0xe64036[_0xd81b('0x78')],'type':_0xe64036[_0xd81b('0xdf')],'ChatOfflineMessageId':_0xad0a5b['id']};});}var _0x41d12a;if(!_[_0xd81b('0x81')](_0x5890b2[_0xd81b('0xf9')])){var _0x2f3170=_[_0xd81b('0x41')](_0x14833d['body'],function(_0x25939f){return _0x25939f;});var _0x2afc53=_['toPairsIn'](_0x2f3170)[0x0];var _0x3d12ee=_[_0xd81b('0xfa')](_0x2afc53,function(_0x3a6139){return _0x3a6139;});_0x41d12a=_0x3d12ee[0x1][_0x5890b2[_0xd81b('0xf9')]];}var _0x541758={'from':_0x32cf81[_0xd81b('0xf5')],'firstName':_0x32cf81[_0xd81b('0xb6')],'lastName':_0x32cf81[_0xd81b('0xb7')],'mapKey':_0xd81b('0xf5'),'message':{'from':_0x32cf81[_0xd81b('0xf5')],'to':_0x5890b2[_0xd81b('0xd9')]['email'],'cc':'','subject':_[_0xd81b('0x81')](_0x41d12a)?_0x5890b2[_0xd81b('0xf6')]:_0x41d12a,'messageId':'','sentAt':new Date(),'attach':_0x44e2a8[_0xd81b('0x4d')],'attachments':_0x44e2a8,'originChannel':_0xd81b('0xfb'),'ChatWebsiteId':_0x5890b2['id'],'ChatOfflineMessageId':_0x30ddbd['id'],'originTo':_0x5890b2[_0xd81b('0xd9')][_0xd81b('0xf5')]},'body':_0x30ddbd['body']};var _0x5db623={'account':{'id':_0x5890b2[_0xd81b('0xf7')]},'body':_0x541758,'log':_0xd81b('0xfc')};return respondWithRpcPromise(_0xd81b('0xfc'),_0xd81b('0xfd'),_0x5db623,client9001)['then'](function(){return _0x30ddbd;})[_0xd81b('0x2c')](function(_0x4f326f){console[_0xd81b('0x28')](_0x4f326f);});}return;})[_0xd81b('0x22')](function(){if(_0x30ddbd){return _0x30ddbd;}})[_0xd81b('0x22')](respondWithResult(_0x5ce2b1,null))['catch'](function(_0x62f9ac){console['error'](_0xd81b('0x2c'),_0x62f9ac);for(var _0x29e584 of _0x2f2e19){var _0x5d1811=path['join'](config[_0xd81b('0x84')],'server','files',_0xd81b('0xe1'),_0xd81b('0xe2'),_0x29e584[_0xd81b('0x78')]);fs_extra['remove'](_0x5d1811)['catch'](function(_0x32fb6a){console[_0xd81b('0x28')](_0xd81b('0xfe'),_0x5d1811,_0x32fb6a);});}});};exports['addInteraction']=function(_0xfad675,_0xae9cb8,_0x4b0e9b){return db['ChatInteraction'][_0xd81b('0x5d')]({'where':{'id':_0xfad675[_0xd81b('0x5c')]['id']}})[_0xd81b('0x22')](handleEntityNotFound(_0xae9cb8,null))['then'](function(_0x21b703){if(_0x21b703){return _0x21b703[_0xd81b('0xff')](_0xfad675['body'][_0xd81b('0x71')],_[_0xd81b('0x100')](_0xfad675[_0xd81b('0x67')],['ids','id'])||{});}})['then'](respondWithResult(_0xae9cb8,null))[_0xd81b('0x2c')](handleError(_0xae9cb8,null));};exports[_0xd81b('0x101')]=function(_0xeaefb8,_0x4378f1,_0x35e483){var _0x525220={'raw':![],'where':{}};var _0xb4376e={};var _0x52c868={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd81b('0x6d')]({'where':{'id':_0xeaefb8[_0xd81b('0x5c')]['id']}})[_0xd81b('0x22')](handleEntityNotFound(_0x4378f1,null))['then'](function(_0x69ac88){if(_0x69ac88){_0xb4376e['model']=_[_0xd81b('0x47')](db['ChatInteraction'][_0xd81b('0x42')]);_0xb4376e[_0xd81b('0x46')]=_[_0xd81b('0x47')](_0xeaefb8[_0xd81b('0x46')]);_0xb4376e[_0xd81b('0x48')]=_[_0xd81b('0x49')](_0xb4376e['model'],_0xb4376e['query']);_0x525220[_0xd81b('0x4b')]=_[_0xd81b('0x49')](_0xb4376e[_0xd81b('0x4a')],qs[_0xd81b('0x4c')](_0xeaefb8[_0xd81b('0x46')][_0xd81b('0x4c')]));_0x525220[_0xd81b('0x4b')]=_0x525220[_0xd81b('0x4b')]['length']?_0x525220[_0xd81b('0x4b')]:_0xb4376e[_0xd81b('0x4a')];if(!_0xeaefb8[_0xd81b('0x46')][_0xd81b('0x6e')]('nolimit')){_0x525220[_0xd81b('0x32')]=qs[_0xd81b('0x32')](_0xeaefb8[_0xd81b('0x46')][_0xd81b('0x32')]);_0x525220['offset']=qs[_0xd81b('0x30')](_0xeaefb8['query']['offset']);}_0x525220[_0xd81b('0x4f')]=qs[_0xd81b('0x50')](_0xeaefb8[_0xd81b('0x46')][_0xd81b('0x50')]);_0x525220[_0xd81b('0x51')]=qs[_0xd81b('0x48')](_[_0xd81b('0x52')](_0xeaefb8['query'],_0xb4376e[_0xd81b('0x48')]));_0x525220[_0xd81b('0x51')][_0xd81b('0x6b')]=_0x69ac88['id'];if(_0xeaefb8[_0xd81b('0x46')]['filter']){_0x525220[_0xd81b('0x51')]=_[_0xd81b('0x54')](_0x525220['where'],{'$or':_[_0xd81b('0x41')](_0x525220['attributes'],function(_0x35426a){var _0x56ee69={};_0x56ee69[_0x35426a]={'$like':'%'+_0xeaefb8['query'][_0xd81b('0x53')]+'%'};return _0x56ee69;})});}_0x525220=_[_0xd81b('0x54')]({},_0x525220,_0xeaefb8[_0xd81b('0x56')]);return db[_0xd81b('0xc1')]['count']({'where':_0x525220[_0xd81b('0x51')]})['then'](function(_0x37c1f0){_0x52c868[_0xd81b('0x33')]=_0x37c1f0;if(_0xeaefb8[_0xd81b('0x46')][_0xd81b('0x58')]){_0x525220[_0xd81b('0x59')]=[{'model':db[_0xd81b('0x94')],'as':_0xd81b('0x102'),'required':![]},{'model':db[_0xd81b('0x103')],'as':_0xd81b('0x104'),'attributes':['name',_0xd81b('0x105'),_0xd81b('0x106')],'required':![]},{'model':db[_0xd81b('0x107')],'as':_0xd81b('0x108'),'attributes':['id',_0xd81b('0x3d'),_0xd81b('0x109')],'where':_0xeaefb8[_0xd81b('0x46')][_0xd81b('0x10a')]?{'id':_0xeaefb8[_0xd81b('0x46')][_0xd81b('0x10a')]}:undefined,'required':_0xeaefb8['query'][_0xd81b('0x10a')]?!![]:![]}];}return db[_0xd81b('0xc1')][_0xd81b('0x5a')](_0x525220);})[_0xd81b('0x22')](function(_0x25f776){_0x52c868[_0xd81b('0x6f')]=_0x25f776;return _0x52c868;});}})[_0xd81b('0x22')](respondWithFilteredResult(_0x4378f1,_0x525220))[_0xd81b('0x2c')](handleError(_0x4378f1,null));};function iftimePromise(_0x1467e0,_0x3ecba8){return respondWithRpcPromise(_0xd81b('0x10b'),_0xd81b('0x10c'),{'command':_0x3ecba8[_0xd81b('0x10d')]?util[_0xd81b('0xbd')](_0xd81b('0x10e'),_0x1467e0[_0xd81b('0x10f')],_0x3ecba8[_0xd81b('0x10d')]):util['format'](_0xd81b('0x110'),_0x1467e0['interval'])},client9002)[_0xd81b('0x22')](function(_0x1c3879){var _0xf114d8=_0x1c3879&&_0x1c3879[_0xd81b('0x111')](_0xd81b('0x112'))>=0x0?!![]:![];logger['info'](_0xd81b('0x113'),_0x3ecba8['id'],_0x1467e0['id'],_0x1467e0[_0xd81b('0x10f')],_0xf114d8?_0xd81b('0x114'):'OFFLINE',_0x3ecba8['timezone']?_0x3ecba8[_0xd81b('0x10d')]:_0xd81b('0x115'));return _0xf114d8;})['catch'](function(_0x64e5c){logger[_0xd81b('0x28')](_0xd81b('0x113'),_0x3ecba8['id'],_0x1467e0['id'],_0x1467e0[_0xd81b('0x10f')],util[_0xd81b('0x116')](_0x64e5c,{'showHidden':![],'depth':null}),_0x3ecba8[_0xd81b('0x10d')]?_0x3ecba8[_0xd81b('0x10d')]:_0xd81b('0x115'));return![];});}exports[_0xd81b('0x10c')]=function(_0x108b7d,_0x88ee25,_0x10b022){var _0xe0b626=0x0;var _0x5a187a=0x0;var _0x73ddd1=![];var _0x4a47d8;var _0x4427f3;return db[_0xd81b('0x57')][_0xd81b('0x5d')]({'where':{'id':_0x108b7d['params']['id']},'include':[{'model':db[_0xd81b('0x117')],'as':'Interval','include':[{'model':db['Interval'],'as':_0xd81b('0x118'),'attributes':['id',_0xd81b('0x10f')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x88ee25,null))['then'](function(_0x3f2ac0){if(_0x3f2ac0){_0x4a47d8=_0x3f2ac0;return _0x3f2ac0[_0xd81b('0x119')]({'raw':!![]});}})[_0xd81b('0x22')](function(_0x155f6c){if(_0x4a47d8){if(_0x155f6c){_0x4427f3=_0x155f6c;}}return require(_0xd81b('0x1a'))['getLicense']();})[_0xd81b('0x22')](function(_0x3cbf88){if(_0x3cbf88){_0x5a187a=_0x3cbf88[_0xd81b('0x11a')];_0x73ddd1=_0x3cbf88[_0xd81b('0x80')];}})['then'](function(){return db['ChatInteraction'][_0xd81b('0x33')]({'where':{'closed':![]}});})[_0xd81b('0x22')](function(_0x39eb20){_0xe0b626=_0x39eb20;if(_0x5a187a&&_0x39eb20>_0x5a187a){return db[_0xd81b('0x11b')][_0xd81b('0x6d')]({'where':{'id':0x1}})[_0xd81b('0x22')](function(_0x49a071){if(_0x49a071){_0x49a071[_0xd81b('0x11c')](_0xd81b('0x11d'));}});}})['then'](function(){if(_0x4a47d8[_0xd81b('0x117')]&&_0x4a47d8[_0xd81b('0x117')][_0xd81b('0x118')]){var _0x1049cf=[];for(var _0x54e8db=0x0;_0x54e8db<_0x4a47d8[_0xd81b('0x117')][_0xd81b('0x118')][_0xd81b('0x4d')];_0x54e8db++){var _0x34beee=_0x4a47d8[_0xd81b('0x117')][_0xd81b('0x118')][_0x54e8db][_0xd81b('0x3a')]({'plain':!![]});_0x1049cf[_0xd81b('0xc8')](iftimePromise(_0x34beee,_0x4a47d8));}return BPromise[_0xd81b('0x11e')](_0x1049cf)[_0xd81b('0x22')](function(_0x43dfeb){return _['some'](_0x43dfeb);});}else{return!![];}})[_0xd81b('0x22')](function(_0x41ae2f){var _0x3061f8=fs[_0xd81b('0x11f')](path[_0xd81b('0x83')](config[_0xd81b('0x84')],_0xd81b('0x120')),_0xd81b('0xdc'));var _0x34cf85={'remote':_0x4a47d8[_0xd81b('0x121')],'query':querystring['stringify'](_[_0xd81b('0x54')](_0x4a47d8[_0xd81b('0x3a')]({'plain':!![]}),{'customerIp':_0x108b7d['headers'][_0xd81b('0xb3')]||_0x108b7d[_0xd81b('0x90')][_0xd81b('0x122')]||_0x108b7d[_0xd81b('0x123')]['remoteAddress']||_0x108b7d['ip'],'referer':_0x108b7d[_0xd81b('0x90')][_0xd81b('0x124')],'openedInteractions':_0xe0b626,'maxInteractions':_0x5a187a,'virtual':_0x73ddd1[_0xd81b('0x11a')],'online':_0x41ae2f,'custom':_0x73ddd1}))[_0xd81b('0x125')](/'/g,'\x5c\x27')};_0x88ee25[_0xd81b('0x3e')](ejs[_0xd81b('0x126')](Mustache[_0xd81b('0x126')](_0x3061f8,_0x34cf85),{'proactiveActions':_0x4427f3,'alignment':_0x4a47d8[_0xd81b('0x127')],'verticalAlignment':_0x4a47d8[_0xd81b('0x128')],'div_color':_0x4a47d8[_0xd81b('0x109')],'text_color':_0x4a47d8[_0xd81b('0x129')],'button_color':_0x4a47d8[_0xd81b('0x12a')],'background_color':_0x4a47d8[_0xd81b('0x12b')]}));})[_0xd81b('0x2c')](handleError(_0x88ee25,null));};exports[_0xd81b('0x12c')]=function(_0x52516b,_0x428f8a,_0x12ad20){return db[_0xd81b('0x57')]['findOne']({'where':{'id':_0x52516b['params']['id']}})[_0xd81b('0x22')](handleEntityNotFound(_0x428f8a,null))['then'](function(_0x7a2b07){if(_0x7a2b07){return db['sequelize'][_0xd81b('0xe6')](function(_0x7a990e){return db[_0xd81b('0xa7')][_0xd81b('0x39')]({'where':{'ChatWebsiteId':_0x52516b['params']['id']},'transaction':_0x7a990e})['then'](function(_0x17f804){var _0x47592f=_[_0xd81b('0x41')](_0x52516b[_0xd81b('0x67')],function(_0x6121cf){_0x6121cf[_0xd81b('0x6b')]=_0x52516b[_0xd81b('0x5c')]['id'];return _0x6121cf;});return db[_0xd81b('0xa7')][_0xd81b('0xe8')](_0x47592f,{'transaction':_0x7a990e});});})['then'](function(){return db['ChatApplication'][_0xd81b('0x12d')]({'where':{'ChatWebsiteId':_0x52516b[_0xd81b('0x5c')]['id']},'order':'priority'});});}})[_0xd81b('0x22')](respondWithResult(_0x428f8a,null))[_0xd81b('0x2c')](handleError(_0x428f8a,null));};exports[_0xd81b('0x12e')]=function(_0x72d484,_0x319b3d,_0x27f456){var _0x54b2ed={};var _0x59a3cb={};var _0x3bf879;var _0x2b2473;return db['ChatWebsite']['findOne']({'where':{'id':_0x72d484[_0xd81b('0x5c')]['id']}})[_0xd81b('0x22')](handleEntityNotFound(_0x319b3d,null))['then'](function(_0x46d5f3){if(_0x46d5f3){_0x3bf879=_0x46d5f3;_0x59a3cb[_0xd81b('0x4a')]=_['keys'](db[_0xd81b('0xa7')][_0xd81b('0x42')]);_0x59a3cb[_0xd81b('0x46')]=_['keys'](_0x72d484[_0xd81b('0x46')]);_0x59a3cb[_0xd81b('0x48')]=_[_0xd81b('0x49')](_0x59a3cb[_0xd81b('0x4a')],_0x59a3cb[_0xd81b('0x46')]);_0x54b2ed['attributes']=_[_0xd81b('0x49')](_0x59a3cb[_0xd81b('0x4a')],qs[_0xd81b('0x4c')](_0x72d484[_0xd81b('0x46')][_0xd81b('0x4c')]));_0x54b2ed[_0xd81b('0x4b')]=_0x54b2ed[_0xd81b('0x4b')][_0xd81b('0x4d')]?_0x54b2ed[_0xd81b('0x4b')]:_0x59a3cb[_0xd81b('0x4a')];_0x54b2ed['order']=qs[_0xd81b('0x50')](_0x72d484[_0xd81b('0x46')][_0xd81b('0x50')]);_0x54b2ed[_0xd81b('0x51')]=qs[_0xd81b('0x48')](_[_0xd81b('0x52')](_0x72d484[_0xd81b('0x46')],_0x59a3cb['filters']));if(_0x72d484['query'][_0xd81b('0x53')]){_0x54b2ed[_0xd81b('0x51')]=_[_0xd81b('0x54')](_0x54b2ed['where'],{'$or':_[_0xd81b('0x41')](_0x54b2ed[_0xd81b('0x4b')],function(_0x30a103){var _0x463110={};_0x463110[_0x30a103]={'$like':'%'+_0x72d484[_0xd81b('0x46')]['filter']+'%'};return _0x463110;})});}_0x54b2ed=_[_0xd81b('0x54')]({},_0x54b2ed,_0x72d484[_0xd81b('0x56')]);return _0x3bf879[_0xd81b('0x12e')](_0x54b2ed);}})[_0xd81b('0x22')](function(_0x89764a){if(_0x89764a){_0x2b2473=_0x89764a[_0xd81b('0x4d')];if(!_0x72d484[_0xd81b('0x46')]['hasOwnProperty']('nolimit')){_0x54b2ed['limit']=qs['limit'](_0x72d484['query'][_0xd81b('0x32')]);_0x54b2ed[_0xd81b('0x30')]=qs[_0xd81b('0x30')](_0x72d484['query'][_0xd81b('0x30')]);}return _0x3bf879['getApplications'](_0x54b2ed);}})[_0xd81b('0x22')](function(_0x406b40){if(_0x406b40){return _0x406b40?{'count':_0x2b2473,'rows':_0x406b40}:null;}})[_0xd81b('0x22')](respondWithResult(_0x319b3d,null))['catch'](handleError(_0x319b3d,null));};exports[_0xd81b('0x12f')]=function(_0x444551,_0x1be7ad,_0xd09d12){return db[_0xd81b('0x130')][_0xd81b('0x5d')]({'where':{'id':_0x444551['params']['id']}})['then'](handleEntityNotFound(_0x1be7ad,null))[_0xd81b('0x22')](function(_0x19c9d3){if(_0x19c9d3){return _0x19c9d3[_0xd81b('0x12f')](_0x444551[_0xd81b('0x67')]['ids'],_[_0xd81b('0x100')](_0x444551['body'],[_0xd81b('0x71'),'id'])||{});}})[_0xd81b('0x22')](respondWithResult(_0x1be7ad,null))[_0xd81b('0x2c')](handleError(_0x1be7ad,null));};exports[_0xd81b('0x119')]=function(_0x5c69b8,_0x4a1f5d,_0x16af59){var _0x29a1ad={};var _0xac896e={};var _0xe6b5f1;var _0x1f375f;return db[_0xd81b('0x57')][_0xd81b('0x6d')]({'where':{'id':_0x5c69b8['params']['id']}})[_0xd81b('0x22')](handleEntityNotFound(_0x4a1f5d,null))['then'](function(_0x557b6a){if(_0x557b6a){_0xe6b5f1=_0x557b6a;_0xac896e['model']=_[_0xd81b('0x47')](db[_0xd81b('0x131')][_0xd81b('0x42')]);_0xac896e[_0xd81b('0x46')]=_[_0xd81b('0x47')](_0x5c69b8['query']);_0xac896e[_0xd81b('0x48')]=_[_0xd81b('0x49')](_0xac896e[_0xd81b('0x4a')],_0xac896e[_0xd81b('0x46')]);_0x29a1ad['attributes']=_['intersection'](_0xac896e[_0xd81b('0x4a')],qs[_0xd81b('0x4c')](_0x5c69b8['query'][_0xd81b('0x4c')]));_0x29a1ad[_0xd81b('0x4b')]=_0x29a1ad[_0xd81b('0x4b')][_0xd81b('0x4d')]?_0x29a1ad[_0xd81b('0x4b')]:_0xac896e[_0xd81b('0x4a')];_0x29a1ad[_0xd81b('0x4f')]=qs['sort'](_0x5c69b8['query'][_0xd81b('0x50')]);_0x29a1ad['where']=qs[_0xd81b('0x48')](_['pick'](_0x5c69b8[_0xd81b('0x46')],_0xac896e[_0xd81b('0x48')]));if(_0x5c69b8[_0xd81b('0x46')][_0xd81b('0x53')]){_0x29a1ad[_0xd81b('0x51')]=_[_0xd81b('0x54')](_0x29a1ad[_0xd81b('0x51')],{'$or':_[_0xd81b('0x41')](_0x29a1ad['attributes'],function(_0x22de27){var _0x3ab22b={};_0x3ab22b[_0x22de27]={'$like':'%'+_0x5c69b8[_0xd81b('0x46')][_0xd81b('0x53')]+'%'};return _0x3ab22b;})});}_0x29a1ad=_[_0xd81b('0x54')]({},_0x29a1ad,_0x5c69b8['options']);return _0xe6b5f1[_0xd81b('0x119')](_0x29a1ad);}})['then'](function(_0x29e4f7){if(_0x29e4f7){_0x1f375f=_0x29e4f7[_0xd81b('0x4d')];if(!_0x5c69b8[_0xd81b('0x46')][_0xd81b('0x6e')]('nolimit')){_0x29a1ad[_0xd81b('0x32')]=qs[_0xd81b('0x32')](_0x5c69b8[_0xd81b('0x46')][_0xd81b('0x32')]);_0x29a1ad[_0xd81b('0x30')]=qs[_0xd81b('0x30')](_0x5c69b8['query'][_0xd81b('0x30')]);}return _0xe6b5f1['getProactiveActions'](_0x29a1ad);}})[_0xd81b('0x22')](function(_0x597c54){if(_0x597c54){return _0x597c54?{'count':_0x1f375f,'rows':_0x597c54}:null;}})['then'](respondWithResult(_0x4a1f5d,null))['catch'](handleError(_0x4a1f5d,null));};exports[_0xd81b('0x132')]=function(_0x4f46a1,_0x1c70e1,_0x410776){var _0x498ce1=_0x4f46a1[_0xd81b('0x46')][_0xd81b('0x133')]===_0xd81b('0x134')?'offlineForm':'onlineForm';return db[_0xd81b('0x57')][_0xd81b('0x5d')]({'attributes':['id',_0x498ce1],'where':{'id':_0x4f46a1[_0xd81b('0x5c')]['id']}})[_0xd81b('0x22')](handleEntityNotFound(_0x1c70e1,null))[_0xd81b('0x22')](function(_0x5db932){if(_0x5db932){var _0x5365fd=_0x5db932[_0x498ce1];var _0x1639ab=_0x5365fd&&_0x5365fd[_0xd81b('0x135')]?_0x5365fd[_0xd81b('0x135')]:[];_0x1c70e1[_0xd81b('0x3e')]({'fromKey':_[_0xd81b('0x81')](_0x5365fd[_0xd81b('0x136')])?undefined:_0x5365fd['fromKey'],'count':_0x1639ab['length'],'rows':_0x1639ab});}})[_0xd81b('0x2c')](handleError(_0x1c70e1,null));};exports[_0xd81b('0x137')]=function(_0x30d5a6,_0xe8ea93,_0x478d3a){var _0x2ec889={'raw':![],'where':{}};var _0x4cfcaf={};var _0x3d7acf={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd81b('0x6d')]({'where':{'id':_0x30d5a6[_0xd81b('0x5c')]['id']}})[_0xd81b('0x22')](handleEntityNotFound(_0xe8ea93,null))['then'](function(_0x2782b6){if(_0x2782b6){_0x4cfcaf[_0xd81b('0x4a')]=_[_0xd81b('0x47')](db[_0xd81b('0x138')][_0xd81b('0x42')]);_0x4cfcaf[_0xd81b('0x46')]=_[_0xd81b('0x47')](_0x30d5a6[_0xd81b('0x46')]);_0x4cfcaf[_0xd81b('0x48')]=_['intersection'](_0x4cfcaf[_0xd81b('0x4a')],_0x4cfcaf[_0xd81b('0x46')]);_0x2ec889[_0xd81b('0x4b')]=_[_0xd81b('0x49')](_0x4cfcaf[_0xd81b('0x4a')],qs[_0xd81b('0x4c')](_0x30d5a6[_0xd81b('0x46')][_0xd81b('0x4c')]));_0x2ec889[_0xd81b('0x4b')]=_0x2ec889[_0xd81b('0x4b')]['length']?_0x2ec889[_0xd81b('0x4b')]:_0x4cfcaf[_0xd81b('0x4a')];if(!_0x30d5a6[_0xd81b('0x46')][_0xd81b('0x6e')](_0xd81b('0x4e'))){_0x2ec889[_0xd81b('0x32')]=qs[_0xd81b('0x32')](_0x30d5a6[_0xd81b('0x46')][_0xd81b('0x32')]);_0x2ec889['offset']=qs['offset'](_0x30d5a6[_0xd81b('0x46')]['offset']);}_0x2ec889[_0xd81b('0x4f')]=qs[_0xd81b('0x50')](_0x30d5a6[_0xd81b('0x46')][_0xd81b('0x50')]);_0x2ec889[_0xd81b('0x51')]=qs[_0xd81b('0x48')](_[_0xd81b('0x52')](_0x30d5a6[_0xd81b('0x46')],_0x4cfcaf['filters']));_0x2ec889[_0xd81b('0x51')][_0xd81b('0x6b')]=_0x2782b6['id'];if(_0x30d5a6['query'][_0xd81b('0x53')]){_0x2ec889[_0xd81b('0x51')]=_['merge'](_0x2ec889['where'],{'$or':_[_0xd81b('0x41')](_0x2ec889[_0xd81b('0x4b')],function(_0x619df4){var _0x22551={};_0x22551[_0x619df4]={'$like':'%'+_0x30d5a6[_0xd81b('0x46')][_0xd81b('0x53')]+'%'};return _0x22551;})});}_0x2ec889=_['merge']({},_0x2ec889,_0x30d5a6[_0xd81b('0x56')]);return db[_0xd81b('0x138')]['count']({'where':_0x2ec889[_0xd81b('0x51')]})[_0xd81b('0x22')](function(_0x212f03){_0x3d7acf[_0xd81b('0x33')]=_0x212f03;if(_0x30d5a6[_0xd81b('0x46')][_0xd81b('0x58')]){_0x2ec889[_0xd81b('0x59')]=[{'all':!![]}];}else{_0x2ec889[_0xd81b('0x59')]=[{'model':db[_0xd81b('0x94')],'as':_0xd81b('0x102'),'required':![]},{'model':db['Attachment'],'as':_0xd81b('0x139'),'required':![]}];}return db[_0xd81b('0x138')][_0xd81b('0x5a')](_0x2ec889);})[_0xd81b('0x22')](function(_0x46e79d){_0x3d7acf[_0xd81b('0x6f')]=_0x46e79d;return _0x3d7acf;});}})[_0xd81b('0x22')](respondWithFilteredResult(_0xe8ea93,_0x2ec889))['catch'](handleError(_0xe8ea93,null));};exports[_0xd81b('0x13a')]=function(_0x18c41f,_0x155a07,_0x368ae6){return db['ChatWebsite'][_0xd81b('0x5d')]({'where':{'id':_0x18c41f[_0xd81b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x155a07,null))['then'](function(_0x42b93a){if(_0x42b93a){return _0x42b93a[_0xd81b('0x13a')](_0x18c41f[_0xd81b('0x67')]['ids'],_[_0xd81b('0x100')](_0x18c41f['body'],[_0xd81b('0x71'),'id'])||{})[_0xd81b('0xc5')](function(_0x4c684a){for(var _0x45ac59=0x0;_0x45ac59<_0x18c41f['body'][_0xd81b('0x71')]['length'];_0x45ac59+=0x1){socket[_0xd81b('0x13b')](_0xd81b('0x13c'),{'UserId':_0x18c41f[_0xd81b('0x67')]['ids'][_0x45ac59],'ChatWebsiteId':_0x18c41f[_0xd81b('0x5c')]['id']});}return _0x4c684a;});}})[_0xd81b('0x22')](respondWithResult(_0x155a07,null))[_0xd81b('0x2c')](handleError(_0x155a07,null));};exports[_0xd81b('0x13d')]=function(_0xb5bcd5,_0x135537,_0x2f9752){return db['ChatWebsite'][_0xd81b('0x5d')]({'where':{'id':_0xb5bcd5[_0xd81b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x135537,null))['then'](function(_0x52f86b){if(_0x52f86b){return _0x52f86b[_0xd81b('0x13d')](_0xb5bcd5[_0xd81b('0x46')][_0xd81b('0x71')])[_0xd81b('0x22')](function(){if(_[_0xd81b('0x13e')](_0xb5bcd5[_0xd81b('0x46')]['ids'])){for(var _0x1f76aa=0x0;_0x1f76aa<_0xb5bcd5[_0xd81b('0x46')][_0xd81b('0x71')][_0xd81b('0x4d')];_0x1f76aa+=0x1){socket[_0xd81b('0x13b')]('userChatWebsite:remove',{'UserId':Number(_0xb5bcd5[_0xd81b('0x46')]['ids'][_0x1f76aa]),'ChatWebsiteId':Number(_0xb5bcd5[_0xd81b('0x5c')]['id'])});}}else{socket['emit'](_0xd81b('0x13f'),{'UserId':Number(_0xb5bcd5['query'][_0xd81b('0x71')]),'ChatWebsiteId':Number(_0xb5bcd5[_0xd81b('0x5c')]['id'])});}});}})[_0xd81b('0x22')](respondWithStatusCode(_0x135537,null))['catch'](handleError(_0x135537,null));};exports[_0xd81b('0x140')]=function(_0x22bf91,_0x155ad6,_0x5e8fc4){var _0xcbffcf={};var _0x494165={};var _0x550752;var _0x5eb467;return db[_0xd81b('0x57')][_0xd81b('0x6d')]({'where':{'id':_0x22bf91[_0xd81b('0x5c')]['id']}})[_0xd81b('0x22')](handleEntityNotFound(_0x155ad6,null))[_0xd81b('0x22')](function(_0x35ae89){if(_0x35ae89){_0x550752=_0x35ae89;_0x494165['model']=_[_0xd81b('0x47')](db[_0xd81b('0x103')][_0xd81b('0x42')]);_0x494165[_0xd81b('0x46')]=_[_0xd81b('0x47')](_0x22bf91[_0xd81b('0x46')]);_0x494165[_0xd81b('0x48')]=_[_0xd81b('0x49')](_0x494165[_0xd81b('0x4a')],_0x494165[_0xd81b('0x46')]);_0xcbffcf['attributes']=_[_0xd81b('0x49')](_0x494165['model'],qs[_0xd81b('0x4c')](_0x22bf91['query'][_0xd81b('0x4c')]));_0xcbffcf[_0xd81b('0x4b')]=_0xcbffcf[_0xd81b('0x4b')][_0xd81b('0x4d')]?_0xcbffcf[_0xd81b('0x4b')]:_0x494165[_0xd81b('0x4a')];_0xcbffcf[_0xd81b('0x4f')]=qs['sort'](_0x22bf91[_0xd81b('0x46')][_0xd81b('0x50')]);_0xcbffcf[_0xd81b('0x51')]=qs[_0xd81b('0x48')](_['pick'](_0x22bf91[_0xd81b('0x46')],_0x494165[_0xd81b('0x48')]));if(_0x22bf91[_0xd81b('0x46')][_0xd81b('0x53')]){_0xcbffcf['where']=_['merge'](_0xcbffcf[_0xd81b('0x51')],{'$or':_[_0xd81b('0x41')](_0xcbffcf[_0xd81b('0x4b')],function(_0x1360fb){var _0x450634={};_0x450634[_0x1360fb]={'$like':'%'+_0x22bf91[_0xd81b('0x46')][_0xd81b('0x53')]+'%'};return _0x450634;})});}_0xcbffcf=_['merge']({},_0xcbffcf,_0x22bf91[_0xd81b('0x56')]);return _0x550752['getAgents'](_0xcbffcf);}})[_0xd81b('0x22')](function(_0x189e1e){if(_0x189e1e){_0x5eb467=_0x189e1e[_0xd81b('0x4d')];if(!_0x22bf91[_0xd81b('0x46')][_0xd81b('0x6e')](_0xd81b('0x4e'))){_0xcbffcf[_0xd81b('0x32')]=qs[_0xd81b('0x32')](_0x22bf91[_0xd81b('0x46')]['limit']);_0xcbffcf[_0xd81b('0x30')]=qs['offset'](_0x22bf91[_0xd81b('0x46')][_0xd81b('0x30')]);}return _0x550752[_0xd81b('0x140')](_0xcbffcf);}})[_0xd81b('0x22')](function(_0x33d47c){if(_0x33d47c){return _0x33d47c?{'count':_0x5eb467,'rows':_0x33d47c}:null;}})[_0xd81b('0x22')](respondWithResult(_0x155ad6,null))['catch'](handleError(_0x155ad6,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 43698a5..e735137 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 _0xb3ea=['remove','emit','hook','events','../../mysqldb','ChatWebsite','save'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb3ea,0x10d));var _0xab3e=function(_0x108f72,_0x1637c4){_0x108f72=_0x108f72-0x0;var _0x262cd7=_0xb3ea[_0x108f72];return _0x262cd7;};'use strict';var EventEmitter=require(_0xab3e('0x0'));var ChatWebsite=require(_0xab3e('0x1'))['db'][_0xab3e('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xab3e('0x3'),'afterUpdate':'update','afterDestroy':_0xab3e('0x4')};function emitEvent(_0x5d862a){return function(_0x30e8e6,_0x196c45,_0x1f0c0f){ChatWebsiteEvents[_0xab3e('0x5')](_0x5d862a+':'+_0x30e8e6['id'],_0x30e8e6);ChatWebsiteEvents[_0xab3e('0x5')](_0x5d862a,_0x30e8e6);_0x1f0c0f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xab3e('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xb1dc=['emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x2922e5,_0x1dd576){var _0x10a186=function(_0x185e63){while(--_0x185e63){_0x2922e5['push'](_0x2922e5['shift']());}};_0x10a186(++_0x1dd576);}(_0xb1dc,0x133));var _0xcb1d=function(_0x15106b,_0x4d96f6){_0x15106b=_0x15106b-0x0;var _0x521203=_0xb1dc[_0x15106b];return _0x521203;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xcb1d('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xcb1d('0x1')](0x0);var events={'afterCreate':_0xcb1d('0x2'),'afterUpdate':_0xcb1d('0x3'),'afterDestroy':_0xcb1d('0x4')};function emitEvent(_0x11d8dc){return function(_0xc3e297,_0x1028de,_0x477930){ChatWebsiteEvents[_0xcb1d('0x5')](_0x11d8dc+':'+_0xc3e297['id'],_0xc3e297);ChatWebsiteEvents[_0xcb1d('0x5')](_0x11d8dc,_0xc3e297);_0x477930(null);};}for(var e in events){if(events[_0xcb1d('0x6')](e)){var event=events[e];ChatWebsite[_0xcb1d('0x7')](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 0e95cfa..1ee30c9 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 _0x3495=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatWebsite.attributes','exports','ChatWebsite','lodash','util'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3495,0x1de));var _0x5349=function(_0x82d952,_0x325342){_0x82d952=_0x82d952-0x0;var _0x218dc5=_0x3495[_0x82d952];return _0x218dc5;};'use strict';var _=require(_0x5349('0x0'));var util=require(_0x5349('0x1'));var logger=require(_0x5349('0x2'))(_0x5349('0x3'));var moment=require(_0x5349('0x4'));var BPromise=require(_0x5349('0x5'));var rp=require(_0x5349('0x6'));var fs=require('fs');var path=require(_0x5349('0x7'));var rimraf=require(_0x5349('0x8'));var config=require('../../config/environment');var attributes=require(_0x5349('0x9'));module[_0x5349('0xa')]=function(_0x5ce2cd,_0xcb5a1){return _0x5ce2cd['define'](_0x5349('0xb'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3495=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatWebsite.attributes','exports','ChatWebsite','lodash','util'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x3495,0x1de));var _0x5349=function(_0x320706,_0x4e0bfc){_0x320706=_0x320706-0x0;var _0x58c92f=_0x3495[_0x320706];return _0x58c92f;};'use strict';var _=require(_0x5349('0x0'));var util=require(_0x5349('0x1'));var logger=require(_0x5349('0x2'))(_0x5349('0x3'));var moment=require(_0x5349('0x4'));var BPromise=require(_0x5349('0x5'));var rp=require(_0x5349('0x6'));var fs=require('fs');var path=require(_0x5349('0x7'));var rimraf=require(_0x5349('0x8'));var config=require('../../config/environment');var attributes=require(_0x5349('0x9'));module[_0x5349('0xa')]=function(_0x5ce2cd,_0xcb5a1){return _0x5ce2cd['define'](_0x5349('0xb'),attributes,{'tableName':'chat_websites','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 3faba0b..96ce709 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 _0x1967=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3d500e,_0x5a1f35){var _0x11cf72=function(_0x1f5793){while(--_0x1f5793){_0x3d500e['push'](_0x3d500e['shift']());}};_0x11cf72(++_0x5a1f35);}(_0x1967,0x173));var _0x7196=function(_0x2ab2ad,_0x12f2e4){_0x2ab2ad=_0x2ab2ad-0x0;var _0x450db3=_0x1967[_0x2ab2ad];return _0x450db3;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});config[_0x7196('0xc')]=_[_0x7196('0xd')](config[_0x7196('0xc')],{'host':_0x7196('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7196('0xc')]));require(_0x7196('0xf'))[_0x7196('0x10')](socket);function respondWithRpcPromise(_0x259b18,_0x1e862d,_0x503070){return new BPromise(function(_0x49e5fb,_0x2028dd){return client[_0x7196('0x11')](_0x259b18,_0x503070)[_0x7196('0x12')](function(_0x107759){logger[_0x7196('0x13')](_0x7196('0x14'),_0x1e862d,_0x7196('0x15'));logger[_0x7196('0x16')](_0x7196('0x17'),_0x1e862d,_0x7196('0x15'),JSON[_0x7196('0x18')](_0x107759));if(_0x107759['error']){if(_0x107759[_0x7196('0x19')][_0x7196('0x1a')]===0x1f4){logger[_0x7196('0x19')](_0x7196('0x14'),_0x1e862d,_0x107759['error'][_0x7196('0x1b')]);return _0x2028dd(_0x107759['error'][_0x7196('0x1b')]);}logger[_0x7196('0x19')](_0x7196('0x14'),_0x1e862d,_0x107759[_0x7196('0x19')][_0x7196('0x1b')]);return _0x49e5fb(_0x107759[_0x7196('0x19')][_0x7196('0x1b')]);}else{logger[_0x7196('0x13')](_0x7196('0x14'),_0x1e862d,_0x7196('0x15'));_0x49e5fb(_0x107759[_0x7196('0x1c')]['message']);}})['catch'](function(_0x448f13){logger[_0x7196('0x19')](_0x7196('0x14'),_0x1e862d,_0x448f13);_0x2028dd(_0x448f13);});});} \ No newline at end of file +var _0x1a37=['rpc','jayson/promise','http','redis','defaults','register','request','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x214871,_0x289576){var _0xe096f2=function(_0x40e713){while(--_0x40e713){_0x214871['push'](_0x214871['shift']());}};_0xe096f2(++_0x289576);}(_0x1a37,0xb4));var _0x71a3=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x1a37[_0x381589];return _0x2a075d;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var moment=require(_0x71a3('0x2'));var BPromise=require(_0x71a3('0x3'));var rs=require(_0x71a3('0x4'));var fs=require('fs');var Redis=require(_0x71a3('0x5'));var db=require(_0x71a3('0x6'))['db'];var utils=require(_0x71a3('0x7'));var logger=require(_0x71a3('0x8'))(_0x71a3('0x9'));var config=require('../../config/environment');var jayson=require(_0x71a3('0xa'));var client=jayson['client'][_0x71a3('0xb')]({'port':0x232a});config[_0x71a3('0xc')]=_[_0x71a3('0xd')](config[_0x71a3('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')[_0x71a3('0xe')](socket);function respondWithRpcPromise(_0x18320a,_0x3709bc,_0x3aeb48){return new BPromise(function(_0x3a7fc1,_0x2215f2){return client[_0x71a3('0xf')](_0x18320a,_0x3aeb48)[_0x71a3('0x10')](function(_0x5c464c){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x3709bc,_0x71a3('0x11'));logger[_0x71a3('0x12')](_0x71a3('0x13'),_0x3709bc,_0x71a3('0x11'),JSON[_0x71a3('0x14')](_0x5c464c));if(_0x5c464c[_0x71a3('0x15')]){if(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x16')]===0x1f4){logger[_0x71a3('0x15')](_0x71a3('0x17'),_0x3709bc,_0x5c464c[_0x71a3('0x15')]['message']);return _0x2215f2(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x3709bc,_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);return _0x3a7fc1(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);}else{logger[_0x71a3('0x19')](_0x71a3('0x17'),_0x3709bc,'request\x20sent');_0x3a7fc1(_0x5c464c[_0x71a3('0x1a')][_0x71a3('0x18')]);}})['catch'](function(_0x5f4562){logger[_0x71a3('0x15')](_0x71a3('0x17'),_0x3709bc,_0x5f4562);_0x2215f2(_0x5f4562);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 13e4645..d8562d0 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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x2cc437,_0x1b4c3f){var _0x2e163a=function(_0x2db7dc){while(--_0x2db7dc){_0x2cc437['push'](_0x2cc437['shift']());}};_0x2e163a(++_0x1b4c3f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5b8f75,_0x30ee13){_0x5b8f75=_0x5b8f75-0x0;var _0x3643b7=_0x5f2f[_0x5b8f75];return _0x3643b7;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x3d131a,_0x2ee691){var _0x44c22d=function(_0xa7a9fe){while(--_0xa7a9fe){_0x3d131a['push'](_0x3d131a['shift']());}};_0x44c22d(++_0x2ee691);}(_0xb10b,0x12a));var _0xbb10=function(_0x269a6f,_0x4c43c5){_0x269a6f=_0x269a6f-0x0;var _0x29e1e6=_0xb10b[_0x269a6f];return _0x29e1e6;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index afa8acb..48bd4ed 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 _0x2c20=['getAvatar','getCustomerAvatar','getSystemAvatar','getInteractions','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','diskStorage','root','server/files/images/logos/','%s-%s','originalname','single','file','addLogo','join','server/files/images/avatars/','format','now','addAvatar','/:id/customer_avatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','offline-chat','ensureDir','replace','/:id/offline','any','offline','/:id/interactions','addInteraction','/:id/applications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2c20,0x1ac));var _0x02c2=function(_0x42c6f1,_0x338d7b){_0x42c6f1=_0x42c6f1-0x0;var _0x3c7398=_0x2c20[_0x42c6f1];return _0x3c7398;};'use strict';var multer=require('multer');var util=require(_0x02c2('0x0'));var path=require(_0x02c2('0x1'));var timeout=require(_0x02c2('0x2'));var express=require(_0x02c2('0x3'));var router=express[_0x02c2('0x4')]();var fs_extra=require(_0x02c2('0x5'));var auth=require(_0x02c2('0x6'));var interaction=require(_0x02c2('0x7'));var config=require(_0x02c2('0x8'));var controller=require(_0x02c2('0x9'));router['get']('/',auth[_0x02c2('0xa')](),controller['index']);router[_0x02c2('0xb')](_0x02c2('0xc'),auth[_0x02c2('0xa')](),controller[_0x02c2('0xd')]);router[_0x02c2('0xb')](_0x02c2('0xe'),auth[_0x02c2('0xa')](),controller[_0x02c2('0xf')]);router['get'](_0x02c2('0x10'),auth[_0x02c2('0xa')](),controller[_0x02c2('0x11')]);router[_0x02c2('0xb')](_0x02c2('0x12'),auth['isAuthenticated'](),controller[_0x02c2('0x13')]);router[_0x02c2('0xb')](_0x02c2('0x14'),controller['getLogo']);router[_0x02c2('0xb')](_0x02c2('0x15'),controller[_0x02c2('0x16')]);router[_0x02c2('0xb')]('/:id/customer_avatar',controller[_0x02c2('0x17')]);router['get']('/:id/system_avatar',controller[_0x02c2('0x18')]);router[_0x02c2('0xb')]('/:id/interactions',auth[_0x02c2('0xa')](),controller[_0x02c2('0x19')]);router['get']('/:id/snippet',controller[_0x02c2('0x1a')]);router[_0x02c2('0xb')]('/:id/applications',auth[_0x02c2('0xa')](),controller[_0x02c2('0x1b')]);router['get'](_0x02c2('0x1c'),auth[_0x02c2('0xa')](),controller[_0x02c2('0x1d')]);router[_0x02c2('0xb')]('/:id/fields',controller[_0x02c2('0x1e')]);router['get'](_0x02c2('0x1f'),auth['isAuthenticated'](),controller[_0x02c2('0x20')]);router['get'](_0x02c2('0x21'),auth[_0x02c2('0xa')](),controller[_0x02c2('0x22')]);router[_0x02c2('0x23')]('/',auth[_0x02c2('0xa')](),controller[_0x02c2('0x24')]);router['post'](_0x02c2('0x10'),auth[_0x02c2('0xa')](),controller[_0x02c2('0x25')]);router['post']('/:id/canned_answers',auth[_0x02c2('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x02c2('0x26')]({'destination':function(_0x1219c5,_0xdb5dcd,_0x10c78f){_0x10c78f(null,path['join'](config[_0x02c2('0x27')],_0x02c2('0x28')));},'filename':function(_0x4b6a6f,_0x2050b9,_0x5b3c0b){_0x5b3c0b(null,util['format'](_0x02c2('0x29'),Date['now'](),_0x2050b9[_0x02c2('0x2a')]));}})});router[_0x02c2('0x23')](_0x02c2('0x14'),upload[_0x02c2('0x2b')](_0x02c2('0x2c')),controller[_0x02c2('0x2d')]);var upload=multer({'storage':multer[_0x02c2('0x26')]({'destination':function(_0x4a647b,_0x5badfc,_0x348947){_0x348947(null,path[_0x02c2('0x2e')](config['root'],_0x02c2('0x2f')));},'filename':function(_0x2b62af,_0x4ba3f3,_0x1eebe6){_0x1eebe6(null,util[_0x02c2('0x30')](_0x02c2('0x29'),Date[_0x02c2('0x31')](),_0x4ba3f3['originalname']));}})});router[_0x02c2('0x23')](_0x02c2('0x15'),upload[_0x02c2('0x2b')](_0x02c2('0x2c')),controller[_0x02c2('0x32')]);var upload=multer({'storage':multer[_0x02c2('0x26')]({'destination':function(_0x55cf69,_0x267a04,_0x86a214){_0x86a214(null,path[_0x02c2('0x2e')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x1e781f,_0x14d619,_0x2ec0d1){_0x2ec0d1(null,util[_0x02c2('0x30')](_0x02c2('0x29'),Date[_0x02c2('0x31')](),_0x14d619['originalname']));}})});router['post'](_0x02c2('0x33'),upload['single'](_0x02c2('0x2c')),controller[_0x02c2('0x34')]);var upload=multer({'storage':multer[_0x02c2('0x26')]({'destination':function(_0x277378,_0x19f66c,_0x3ce980){_0x3ce980(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0xdc3224,_0x21b23a,_0x4a73ce){_0x4a73ce(null,util[_0x02c2('0x30')](_0x02c2('0x29'),Date[_0x02c2('0x31')](),_0x21b23a['originalname']));}})});router[_0x02c2('0x23')](_0x02c2('0x35'),upload['single'](_0x02c2('0x2c')),controller[_0x02c2('0x36')]);router[_0x02c2('0x23')](_0x02c2('0x37'),controller[_0x02c2('0x38')]);const offlineUploadMulter=multer({'storage':multer[_0x02c2('0x26')]({'destination':function(_0x2b2332,_0x37273d,_0x4b36f7){const _0x4934f9=path[_0x02c2('0x2e')](config['root'],'server/files','attachments',_0x02c2('0x39'));fs_extra[_0x02c2('0x3a')](_0x4934f9,function(){_0x4b36f7(null,_0x4934f9);});},'filename':function(_0x2bc0f5,_0x34d803,_0x41408d){const _0x171b8b=_0x34d803[_0x02c2('0x2a')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x529219=path['extname'](_0x171b8b);const _0x35fcf0=Date[_0x02c2('0x31')]()+'-'+_0x171b8b[_0x02c2('0x3b')](_0x529219,'')+_0x529219;_0x41408d(null,_0x35fcf0);}})});router[_0x02c2('0x23')](_0x02c2('0x3c'),offlineUploadMulter[_0x02c2('0x3d')](),controller[_0x02c2('0x3e')]);router['post'](_0x02c2('0x3f'),auth[_0x02c2('0xa')](),controller[_0x02c2('0x40')]);router[_0x02c2('0x23')](_0x02c2('0x41'),auth['isAuthenticated'](),controller['addApplications']);router[_0x02c2('0x23')](_0x02c2('0x1c'),auth['isAuthenticated'](),controller[_0x02c2('0x42')]);router[_0x02c2('0x23')]('/:id/users',auth[_0x02c2('0xa')](),controller[_0x02c2('0x43')]);router[_0x02c2('0x44')](_0x02c2('0xe'),auth[_0x02c2('0xa')](),controller[_0x02c2('0x45')]);router[_0x02c2('0x46')](_0x02c2('0xe'),auth[_0x02c2('0xa')](),controller[_0x02c2('0x47')]);router[_0x02c2('0x46')](_0x02c2('0x10'),auth['isAuthenticated'](),controller[_0x02c2('0x48')]);router[_0x02c2('0x46')](_0x02c2('0x12'),auth[_0x02c2('0xa')](),controller[_0x02c2('0x49')]);router[_0x02c2('0x46')]('/:id/users',auth[_0x02c2('0xa')](),controller['removeAgents']);module[_0x02c2('0x4a')]=router; \ No newline at end of file +var _0x8882=['getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','%s-%s','now','originalname','single','addLogo','server/files/images/avatars/','file','addAvatar','addCustomerAvatar','format','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','/:id','show','getDispositions'];(function(_0x428ecc,_0x3b3f07){var _0x8781ba=function(_0x2e1ac9){while(--_0x2e1ac9){_0x428ecc['push'](_0x428ecc['shift']());}};_0x8781ba(++_0x3b3f07);}(_0x8882,0x1b7));var _0x2888=function(_0x4ca527,_0x5c1d9a){_0x4ca527=_0x4ca527-0x0;var _0x2c46ae=_0x8882[_0x4ca527];return _0x2c46ae;};'use strict';var multer=require(_0x2888('0x0'));var util=require(_0x2888('0x1'));var path=require(_0x2888('0x2'));var timeout=require(_0x2888('0x3'));var express=require('express');var router=express[_0x2888('0x4')]();var fs_extra=require(_0x2888('0x5'));var auth=require(_0x2888('0x6'));var interaction=require(_0x2888('0x7'));var config=require(_0x2888('0x8'));var controller=require(_0x2888('0x9'));router[_0x2888('0xa')]('/',auth[_0x2888('0xb')](),controller[_0x2888('0xc')]);router[_0x2888('0xa')](_0x2888('0xd'),auth[_0x2888('0xb')](),controller['describe']);router['get'](_0x2888('0xe'),auth['isAuthenticated'](),controller[_0x2888('0xf')]);router['get']('/:id/dispositions',auth[_0x2888('0xb')](),controller[_0x2888('0x10')]);router[_0x2888('0xa')]('/:id/canned_answers',auth[_0x2888('0xb')](),controller[_0x2888('0x11')]);router[_0x2888('0xa')](_0x2888('0x12'),controller[_0x2888('0x13')]);router[_0x2888('0xa')](_0x2888('0x14'),controller[_0x2888('0x15')]);router['get'](_0x2888('0x16'),controller[_0x2888('0x17')]);router[_0x2888('0xa')](_0x2888('0x18'),controller[_0x2888('0x19')]);router[_0x2888('0xa')](_0x2888('0x1a'),auth['isAuthenticated'](),controller[_0x2888('0x1b')]);router[_0x2888('0xa')](_0x2888('0x1c'),controller[_0x2888('0x1d')]);router[_0x2888('0xa')](_0x2888('0x1e'),auth[_0x2888('0xb')](),controller[_0x2888('0x1f')]);router[_0x2888('0xa')]('/:id/proactive_actions',auth[_0x2888('0xb')](),controller['getProactiveActions']);router[_0x2888('0xa')]('/:id/fields',controller[_0x2888('0x20')]);router[_0x2888('0xa')](_0x2888('0x21'),auth['isAuthenticated'](),controller[_0x2888('0x22')]);router['get'](_0x2888('0x23'),auth[_0x2888('0xb')](),controller['getAgents']);router['post']('/',auth[_0x2888('0xb')](),controller['create']);router[_0x2888('0x24')](_0x2888('0x25'),auth[_0x2888('0xb')](),controller[_0x2888('0x26')]);router[_0x2888('0x24')](_0x2888('0x27'),auth[_0x2888('0xb')](),controller[_0x2888('0x28')]);var upload=multer({'storage':multer[_0x2888('0x29')]({'destination':function(_0x27e287,_0x3fc8d7,_0x28821d){_0x28821d(null,path[_0x2888('0x2a')](config[_0x2888('0x2b')],'server/files/images/logos/'));},'filename':function(_0x104105,_0x357aed,_0x3886c4){_0x3886c4(null,util['format'](_0x2888('0x2c'),Date[_0x2888('0x2d')](),_0x357aed[_0x2888('0x2e')]));}})});router[_0x2888('0x24')]('/:id/logo',upload[_0x2888('0x2f')]('file'),controller[_0x2888('0x30')]);var upload=multer({'storage':multer[_0x2888('0x29')]({'destination':function(_0x42f987,_0x5bc6a6,_0x382743){_0x382743(null,path['join'](config[_0x2888('0x2b')],_0x2888('0x31')));},'filename':function(_0x58bc51,_0x2405f4,_0xfaa9f8){_0xfaa9f8(null,util['format'](_0x2888('0x2c'),Date[_0x2888('0x2d')](),_0x2405f4[_0x2888('0x2e')]));}})});router[_0x2888('0x24')](_0x2888('0x14'),upload[_0x2888('0x2f')](_0x2888('0x32')),controller[_0x2888('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x336d77,_0x3b6dab,_0x43be83){_0x43be83(null,path[_0x2888('0x2a')](config[_0x2888('0x2b')],'server/files/images/avatars/'));},'filename':function(_0x1a7685,_0x396768,_0x56d425){_0x56d425(null,util['format'](_0x2888('0x2c'),Date[_0x2888('0x2d')](),_0x396768[_0x2888('0x2e')]));}})});router[_0x2888('0x24')](_0x2888('0x16'),upload['single'](_0x2888('0x32')),controller[_0x2888('0x34')]);var upload=multer({'storage':multer[_0x2888('0x29')]({'destination':function(_0x4ce757,_0x3ecd8d,_0x53a2b1){_0x53a2b1(null,path['join'](config[_0x2888('0x2b')],_0x2888('0x31')));},'filename':function(_0x52d0e5,_0x1f3d34,_0x25d33c){_0x25d33c(null,util[_0x2888('0x35')]('%s-%s',Date['now'](),_0x1f3d34['originalname']));}})});router[_0x2888('0x24')]('/:id/system_avatar',upload[_0x2888('0x2f')](_0x2888('0x32')),controller['addSystemAvatar']);router[_0x2888('0x24')](_0x2888('0x36'),controller[_0x2888('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0x2888('0x29')]({'destination':function(_0x423347,_0x419eee,_0xb2dd4a){const _0xcd1d1d=path[_0x2888('0x2a')](config['root'],_0x2888('0x38'),_0x2888('0x39'),_0x2888('0x3a'));fs_extra[_0x2888('0x3b')](_0xcd1d1d,function(){_0xb2dd4a(null,_0xcd1d1d);});},'filename':function(_0x36d29c,_0x23be0f,_0x1842fb){const _0xdd0917=_0x23be0f[_0x2888('0x2e')][_0x2888('0x3c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x429c8c=path[_0x2888('0x3d')](_0xdd0917);const _0x33adf8=Date['now']()+'-'+_0xdd0917[_0x2888('0x3c')](_0x429c8c,'')+_0x429c8c;_0x1842fb(null,_0x33adf8);}})});router[_0x2888('0x24')](_0x2888('0x3e'),offlineUploadMulter[_0x2888('0x3f')](),controller[_0x2888('0x40')]);router['post'](_0x2888('0x1a'),auth[_0x2888('0xb')](),controller[_0x2888('0x41')]);router['post']('/:id/applications',auth[_0x2888('0xb')](),controller[_0x2888('0x42')]);router[_0x2888('0x24')]('/:id/proactive_actions',auth[_0x2888('0xb')](),controller[_0x2888('0x43')]);router[_0x2888('0x24')](_0x2888('0x23'),auth[_0x2888('0xb')](),controller[_0x2888('0x44')]);router[_0x2888('0x45')]('/:id',auth[_0x2888('0xb')](),controller[_0x2888('0x46')]);router[_0x2888('0x47')](_0x2888('0xe'),auth[_0x2888('0xb')](),controller[_0x2888('0x48')]);router[_0x2888('0x47')](_0x2888('0x25'),auth[_0x2888('0xb')](),controller[_0x2888('0x49')]);router['delete']('/:id/canned_answers',auth[_0x2888('0xb')](),controller[_0x2888('0x4a')]);router[_0x2888('0x47')](_0x2888('0x23'),auth[_0x2888('0xb')](),controller[_0x2888('0x4b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 93503e0..3770f88 100644 --- a/server/api/cloudProvider/cloudProvider.attributes.js +++ b/server/api/cloudProvider/cloudProvider.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ce6=['STRING','ENUM','AmazonAWS','Google','sequelize'];(function(_0x2ef5ca,_0x247956){var _0x36583d=function(_0x1cdc2){while(--_0x1cdc2){_0x2ef5ca['push'](_0x2ef5ca['shift']());}};_0x36583d(++_0x247956);}(_0x4ce6,0x108));var _0x64ce=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x4ce6[_0x3e112d];return _0x531c31;};'use strict';var Sequelize=require(_0x64ce('0x0'));module['exports']={'name':{'type':Sequelize[_0x64ce('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x64ce('0x2')](_0x64ce('0x3'),_0x64ce('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x64ce('0x1')]},'data2':{'type':Sequelize[_0x64ce('0x1')]}}; \ No newline at end of file +var _0xe6e9=['Google','sequelize','exports','STRING','AmazonAWS'];(function(_0x3c7ed4,_0x271b34){var _0x4e7d67=function(_0x2e95ec){while(--_0x2e95ec){_0x3c7ed4['push'](_0x3c7ed4['shift']());}};_0x4e7d67(++_0x271b34);}(_0xe6e9,0x182));var _0x9e6e=function(_0x2d5a73,_0x8ab2fe){_0x2d5a73=_0x2d5a73-0x0;var _0x2ff862=_0xe6e9[_0x2d5a73];return _0x2ff862;};'use strict';var Sequelize=require(_0x9e6e('0x0'));module[_0x9e6e('0x1')]={'name':{'type':Sequelize[_0x9e6e('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x9e6e('0x3'),_0x9e6e('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x9e6e('0x2')]},'data2':{'type':Sequelize[_0x9e6e('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 1f48117..8d16f45 100644 --- a/server/api/cloudProvider/cloudProvider.controller.js +++ b/server/api/cloudProvider/cloudProvider.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2ac=['type','VIRTUAL','options','includeAll','include','CloudProvider','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','count','offset','limit','status','set','apply','save','update','then','destroy','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xb2ac,0xfa));var _0xcb2a=function(_0x56339b,_0x50574f){_0x56339b=_0x56339b-0x0;var _0x104bdc=_0xb2ac[_0x56339b];return _0x104bdc;};'use strict';var emlformat=require(_0xcb2a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcb2a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb2a('0x2'));var moment=require(_0xcb2a('0x3'));var BPromise=require(_0xcb2a('0x4'));var Mustache=require(_0xcb2a('0x5'));var util=require(_0xcb2a('0x6'));var path=require('path');var sox=require(_0xcb2a('0x7'));var csv=require(_0xcb2a('0x8'));var ejs=require(_0xcb2a('0x9'));var fs=require('fs');var fs_extra=require(_0xcb2a('0xa'));var _=require('lodash');var squel=require(_0xcb2a('0xb'));var crypto=require(_0xcb2a('0xc'));var jsforce=require(_0xcb2a('0xd'));var deskjs=require(_0xcb2a('0xe'));var toCsv=require(_0xcb2a('0x8'));var querystring=require('querystring');var Papa=require(_0xcb2a('0xf'));var Redis=require(_0xcb2a('0x10'));var authService=require(_0xcb2a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xcb2a('0x12'));var hardwareService=require(_0xcb2a('0x13'));var logger=require(_0xcb2a('0x14'))(_0xcb2a('0x15'));var utils=require(_0xcb2a('0x16'));var config=require(_0xcb2a('0x17'));var licenseUtil=require(_0xcb2a('0x18'));var db=require(_0xcb2a('0x19'))['db'];function respondWithStatusCode(_0x31b6ac,_0x1feddd){_0x1feddd=_0x1feddd||0xcc;return function(_0x5111c0){if(_0x5111c0){return _0x31b6ac[_0xcb2a('0x1a')](_0x1feddd);}return _0x31b6ac['status'](_0x1feddd)[_0xcb2a('0x1b')]();};}function respondWithResult(_0x41e027,_0x23eb09){_0x23eb09=_0x23eb09||0xc8;return function(_0x1082ff){if(_0x1082ff){return _0x41e027['status'](_0x23eb09)[_0xcb2a('0x1c')](_0x1082ff);}};}function respondWithFilteredResult(_0x2b33be,_0x3dca7c){return function(_0x356e2d){if(_0x356e2d){var _0x11578d=typeof _0x3dca7c['offset']===_0xcb2a('0x1d')&&typeof _0x3dca7c['limit']===_0xcb2a('0x1d');var _0x601cfe=_0x356e2d[_0xcb2a('0x1e')];var _0x3ebadf=_0x11578d?0x0:_0x3dca7c['offset'];var _0x517413=_0x11578d?_0x356e2d[_0xcb2a('0x1e')]:_0x3dca7c[_0xcb2a('0x1f')]+_0x3dca7c[_0xcb2a('0x20')];var _0x4d8d61;if(_0x517413>=_0x601cfe){_0x517413=_0x601cfe;_0x4d8d61=0xc8;}else{_0x4d8d61=0xce;}_0x2b33be[_0xcb2a('0x21')](_0x4d8d61);return _0x2b33be[_0xcb2a('0x22')]('Content-Range',_0x3ebadf+'-'+_0x517413+'/'+_0x601cfe)[_0xcb2a('0x1c')](_0x356e2d);}return null;};}function patchUpdates(_0x1135ea){return function(_0x11f05a){try{jsonpatch[_0xcb2a('0x23')](_0x11f05a,_0x1135ea,!![]);}catch(_0x5b96d7){return BPromise['reject'](_0x5b96d7);}return _0x11f05a[_0xcb2a('0x24')]();};}function saveUpdates(_0x5f456e,_0x311a0e){return function(_0x45dd4b){if(_0x45dd4b){return _0x45dd4b[_0xcb2a('0x25')](_0x5f456e)[_0xcb2a('0x26')](function(_0x240a18){return _0x240a18;});}return null;};}function removeEntity(_0x242d0f,_0x4b9ad0){return function(_0x344795){if(_0x344795){return _0x344795[_0xcb2a('0x27')]()[_0xcb2a('0x26')](function(){_0x242d0f[_0xcb2a('0x21')](0xcc)[_0xcb2a('0x1b')]();});}};}function handleEntityNotFound(_0x50dfe3,_0x4928bf){return function(_0x7ae69f){if(!_0x7ae69f){_0x50dfe3[_0xcb2a('0x1a')](0x194);}return _0x7ae69f;};}function handleError(_0x30edb5,_0x47774d){_0x47774d=_0x47774d||0x1f4;return function(_0x37bd63){logger[_0xcb2a('0x28')](_0x37bd63[_0xcb2a('0x29')]);if(_0x37bd63[_0xcb2a('0x2a')]){delete _0x37bd63[_0xcb2a('0x2a')];}_0x30edb5[_0xcb2a('0x21')](_0x47774d)[_0xcb2a('0x2b')](_0x37bd63);};}exports[_0xcb2a('0x2c')]=function(_0x1a4bf7,_0x3976b0){var _0x3d5105={},_0x5cc65b={},_0xaf1403={'count':0x0,'rows':[]};var _0x5cf3fb=_[_0xcb2a('0x2d')](db['CloudProvider']['rawAttributes'],function(_0x3ad34f){return{'name':_0x3ad34f[_0xcb2a('0x2e')],'type':_0x3ad34f['type'][_0xcb2a('0x2f')]};});_0x5cc65b[_0xcb2a('0x30')]=_[_0xcb2a('0x2d')](_0x5cf3fb,_0xcb2a('0x2a'));_0x5cc65b[_0xcb2a('0x31')]=_[_0xcb2a('0x32')](_0x1a4bf7[_0xcb2a('0x31')]);_0x5cc65b[_0xcb2a('0x33')]=_[_0xcb2a('0x34')](_0x5cc65b['model'],_0x5cc65b[_0xcb2a('0x31')]);_0x3d5105[_0xcb2a('0x35')]=_[_0xcb2a('0x34')](_0x5cc65b['model'],qs['fields'](_0x1a4bf7[_0xcb2a('0x31')][_0xcb2a('0x36')]));_0x3d5105['attributes']=_0x3d5105[_0xcb2a('0x35')][_0xcb2a('0x37')]?_0x3d5105[_0xcb2a('0x35')]:_0x5cc65b[_0xcb2a('0x30')];if(!_0x1a4bf7['query'][_0xcb2a('0x38')](_0xcb2a('0x39'))){_0x3d5105[_0xcb2a('0x20')]=qs[_0xcb2a('0x20')](_0x1a4bf7[_0xcb2a('0x31')][_0xcb2a('0x20')]);_0x3d5105[_0xcb2a('0x1f')]=qs[_0xcb2a('0x1f')](_0x1a4bf7['query'][_0xcb2a('0x1f')]);}_0x3d5105['order']=qs[_0xcb2a('0x3a')](_0x1a4bf7['query']['sort']);_0x3d5105[_0xcb2a('0x3b')]=qs[_0xcb2a('0x33')](_[_0xcb2a('0x3c')](_0x1a4bf7[_0xcb2a('0x31')],_0x5cc65b[_0xcb2a('0x33')]),_0x5cf3fb);if(_0x1a4bf7['query'][_0xcb2a('0x3d')]){_0x3d5105[_0xcb2a('0x3b')]=_['merge'](_0x3d5105['where'],{'$or':_[_0xcb2a('0x2d')](_0x5cf3fb,function(_0x2c040a){if(_0x2c040a[_0xcb2a('0x3e')]!==_0xcb2a('0x3f')){var _0x9c8cfc={};_0x9c8cfc[_0x2c040a['name']]={'$like':'%'+_0x1a4bf7[_0xcb2a('0x31')][_0xcb2a('0x3d')]+'%'};return _0x9c8cfc;}})});}_0x3d5105=_['merge']({},_0x3d5105,_0x1a4bf7[_0xcb2a('0x40')]);var _0x3892b7={'where':_0x3d5105['where']};return db['CloudProvider'][_0xcb2a('0x1e')](_0x3892b7)[_0xcb2a('0x26')](function(_0x3589fa){_0xaf1403[_0xcb2a('0x1e')]=_0x3589fa;if(_0x1a4bf7[_0xcb2a('0x31')][_0xcb2a('0x41')]){_0x3d5105[_0xcb2a('0x42')]=[{'all':!![]}];}return db[_0xcb2a('0x43')][_0xcb2a('0x44')](_0x3d5105);})['then'](function(_0xe07c13){_0xaf1403[_0xcb2a('0x45')]=_0xe07c13;return _0xaf1403;})[_0xcb2a('0x26')](respondWithFilteredResult(_0x3976b0,_0x3d5105))[_0xcb2a('0x46')](handleError(_0x3976b0,null));};exports[_0xcb2a('0x47')]=function(_0x577154,_0x33c471){var _0x46b2fe={'raw':!![],'where':{'id':_0x577154[_0xcb2a('0x48')]['id']}},_0x36c645={};_0x36c645['model']=_[_0xcb2a('0x32')](db['CloudProvider'][_0xcb2a('0x49')]);_0x36c645[_0xcb2a('0x31')]=_[_0xcb2a('0x32')](_0x577154[_0xcb2a('0x31')]);_0x36c645[_0xcb2a('0x33')]=_[_0xcb2a('0x34')](_0x36c645[_0xcb2a('0x30')],_0x36c645[_0xcb2a('0x31')]);_0x46b2fe['attributes']=_[_0xcb2a('0x34')](_0x36c645[_0xcb2a('0x30')],qs[_0xcb2a('0x36')](_0x577154[_0xcb2a('0x31')][_0xcb2a('0x36')]));_0x46b2fe[_0xcb2a('0x35')]=_0x46b2fe['attributes']['length']?_0x46b2fe[_0xcb2a('0x35')]:_0x36c645['model'];if(_0x577154[_0xcb2a('0x31')][_0xcb2a('0x41')]){_0x46b2fe[_0xcb2a('0x42')]=[{'all':!![]}];}_0x46b2fe=_[_0xcb2a('0x4a')]({},_0x46b2fe,_0x577154['options']);return db[_0xcb2a('0x43')][_0xcb2a('0x4b')](_0x46b2fe)[_0xcb2a('0x26')](handleEntityNotFound(_0x33c471,null))[_0xcb2a('0x26')](respondWithResult(_0x33c471,null))[_0xcb2a('0x46')](handleError(_0x33c471,null));};exports[_0xcb2a('0x4c')]=function(_0x15227c,_0x1af6a5){return db[_0xcb2a('0x43')][_0xcb2a('0x4c')](_0x15227c['body'],{})['then'](respondWithResult(_0x1af6a5,0xc9))['catch'](handleError(_0x1af6a5,null));};exports[_0xcb2a('0x25')]=function(_0x2abb60,_0x23e834){if(_0x2abb60[_0xcb2a('0x4d')]['id']){delete _0x2abb60['body']['id'];}return db['CloudProvider'][_0xcb2a('0x4b')]({'where':{'id':_0x2abb60[_0xcb2a('0x48')]['id']}})[_0xcb2a('0x26')](handleEntityNotFound(_0x23e834,null))['then'](saveUpdates(_0x2abb60['body'],null))[_0xcb2a('0x26')](respondWithResult(_0x23e834,null))[_0xcb2a('0x46')](handleError(_0x23e834,null));};exports[_0xcb2a('0x27')]=function(_0x1958cd,_0x284038){return db[_0xcb2a('0x43')][_0xcb2a('0x4b')]({'where':{'id':_0x1958cd['params']['id']}})['then'](handleEntityNotFound(_0x284038,null))['then'](removeEntity(_0x284038,null))[_0xcb2a('0x46')](handleError(_0x284038,null));}; \ No newline at end of file +var _0x08ac=['ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','CloudProvider','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','keys','options','catch','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv'];(function(_0x2c931f,_0x12d1c9){var _0x5f1470=function(_0x3b5d03){while(--_0x3b5d03){_0x2c931f['push'](_0x2c931f['shift']());}};_0x5f1470(++_0x12d1c9);}(_0x08ac,0x126));var _0xc08a=function(_0x398f63,_0x3a7d21){_0x398f63=_0x398f63-0x0;var _0x3fb582=_0x08ac[_0x398f63];return _0x3fb582;};'use strict';var emlformat=require(_0xc08a('0x0'));var rimraf=require(_0xc08a('0x1'));var zipdir=require(_0xc08a('0x2'));var jsonpatch=require(_0xc08a('0x3'));var rp=require(_0xc08a('0x4'));var moment=require(_0xc08a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc08a('0x6'));var path=require(_0xc08a('0x7'));var sox=require(_0xc08a('0x8'));var csv=require(_0xc08a('0x9'));var ejs=require(_0xc08a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc08a('0xb'));var squel=require('squel');var crypto=require(_0xc08a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc08a('0xd'));var toCsv=require(_0xc08a('0x9'));var querystring=require('querystring');var Papa=require(_0xc08a('0xe'));var Redis=require(_0xc08a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc08a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc08a('0x11'));var logger=require(_0xc08a('0x12'))(_0xc08a('0x13'));var utils=require(_0xc08a('0x14'));var config=require(_0xc08a('0x15'));var licenseUtil=require(_0xc08a('0x16'));var db=require(_0xc08a('0x17'))['db'];function respondWithStatusCode(_0x41a941,_0x538b3e){_0x538b3e=_0x538b3e||0xcc;return function(_0x428beb){if(_0x428beb){return _0x41a941[_0xc08a('0x18')](_0x538b3e);}return _0x41a941['status'](_0x538b3e)['end']();};}function respondWithResult(_0x18fdcb,_0x88faa9){_0x88faa9=_0x88faa9||0xc8;return function(_0x567082){if(_0x567082){return _0x18fdcb['status'](_0x88faa9)[_0xc08a('0x19')](_0x567082);}};}function respondWithFilteredResult(_0x23aa82,_0x2b6c24){return function(_0x43e053){if(_0x43e053){var _0x1be836=typeof _0x2b6c24['offset']===_0xc08a('0x1a')&&typeof _0x2b6c24[_0xc08a('0x1b')]==='undefined';var _0x451a65=_0x43e053[_0xc08a('0x1c')];var _0x40ebcc=_0x1be836?0x0:_0x2b6c24[_0xc08a('0x1d')];var _0x4b4636=_0x1be836?_0x43e053[_0xc08a('0x1c')]:_0x2b6c24[_0xc08a('0x1d')]+_0x2b6c24[_0xc08a('0x1b')];var _0x1a749a;if(_0x4b4636>=_0x451a65){_0x4b4636=_0x451a65;_0x1a749a=0xc8;}else{_0x1a749a=0xce;}_0x23aa82[_0xc08a('0x1e')](_0x1a749a);return _0x23aa82[_0xc08a('0x1f')](_0xc08a('0x20'),_0x40ebcc+'-'+_0x4b4636+'/'+_0x451a65)[_0xc08a('0x19')](_0x43e053);}return null;};}function patchUpdates(_0x168bc5){return function(_0x484a24){try{jsonpatch[_0xc08a('0x21')](_0x484a24,_0x168bc5,!![]);}catch(_0x267d92){return BPromise[_0xc08a('0x22')](_0x267d92);}return _0x484a24[_0xc08a('0x23')]();};}function saveUpdates(_0x2e8aed,_0xd367ee){return function(_0x39858e){if(_0x39858e){return _0x39858e[_0xc08a('0x24')](_0x2e8aed)[_0xc08a('0x25')](function(_0x327020){return _0x327020;});}return null;};}function removeEntity(_0x203592,_0x361263){return function(_0x5ea6d1){if(_0x5ea6d1){return _0x5ea6d1['destroy']()[_0xc08a('0x25')](function(){_0x203592[_0xc08a('0x1e')](0xcc)[_0xc08a('0x26')]();});}};}function handleEntityNotFound(_0xab657d,_0x44bf87){return function(_0x190e1d){if(!_0x190e1d){_0xab657d[_0xc08a('0x18')](0x194);}return _0x190e1d;};}function handleError(_0x1964e6,_0x181260){_0x181260=_0x181260||0x1f4;return function(_0x31c64d){logger[_0xc08a('0x27')](_0x31c64d[_0xc08a('0x28')]);if(_0x31c64d[_0xc08a('0x29')]){delete _0x31c64d[_0xc08a('0x29')];}_0x1964e6['status'](_0x181260)[_0xc08a('0x2a')](_0x31c64d);};}exports[_0xc08a('0x2b')]=function(_0x4d3278,_0x2e54fe){var _0x18ae4b={},_0x9bbca1={},_0x1068ea={'count':0x0,'rows':[]};var _0x2c4788=_[_0xc08a('0x2c')](db[_0xc08a('0x2d')][_0xc08a('0x2e')],function(_0x152e87){return{'name':_0x152e87['fieldName'],'type':_0x152e87[_0xc08a('0x2f')][_0xc08a('0x30')]};});_0x9bbca1['model']=_[_0xc08a('0x2c')](_0x2c4788,'name');_0x9bbca1['query']=_['keys'](_0x4d3278[_0xc08a('0x31')]);_0x9bbca1[_0xc08a('0x32')]=_[_0xc08a('0x33')](_0x9bbca1[_0xc08a('0x34')],_0x9bbca1[_0xc08a('0x31')]);_0x18ae4b[_0xc08a('0x35')]=_[_0xc08a('0x33')](_0x9bbca1[_0xc08a('0x34')],qs[_0xc08a('0x36')](_0x4d3278[_0xc08a('0x31')][_0xc08a('0x36')]));_0x18ae4b[_0xc08a('0x35')]=_0x18ae4b[_0xc08a('0x35')][_0xc08a('0x37')]?_0x18ae4b[_0xc08a('0x35')]:_0x9bbca1['model'];if(!_0x4d3278[_0xc08a('0x31')][_0xc08a('0x38')]('nolimit')){_0x18ae4b['limit']=qs['limit'](_0x4d3278[_0xc08a('0x31')][_0xc08a('0x1b')]);_0x18ae4b['offset']=qs[_0xc08a('0x1d')](_0x4d3278[_0xc08a('0x31')]['offset']);}_0x18ae4b[_0xc08a('0x39')]=qs[_0xc08a('0x3a')](_0x4d3278[_0xc08a('0x31')][_0xc08a('0x3a')]);_0x18ae4b[_0xc08a('0x3b')]=qs['filters'](_[_0xc08a('0x3c')](_0x4d3278[_0xc08a('0x31')],_0x9bbca1[_0xc08a('0x32')]),_0x2c4788);if(_0x4d3278[_0xc08a('0x31')][_0xc08a('0x3d')]){_0x18ae4b[_0xc08a('0x3b')]=_[_0xc08a('0x3e')](_0x18ae4b[_0xc08a('0x3b')],{'$or':_[_0xc08a('0x2c')](_0x2c4788,function(_0x3ec84a){if(_0x3ec84a[_0xc08a('0x2f')]!==_0xc08a('0x3f')){var _0x40e8cb={};_0x40e8cb[_0x3ec84a[_0xc08a('0x29')]]={'$like':'%'+_0x4d3278['query'][_0xc08a('0x3d')]+'%'};return _0x40e8cb;}})});}_0x18ae4b=_[_0xc08a('0x3e')]({},_0x18ae4b,_0x4d3278['options']);var _0x371de0={'where':_0x18ae4b[_0xc08a('0x3b')]};return db[_0xc08a('0x2d')][_0xc08a('0x1c')](_0x371de0)[_0xc08a('0x25')](function(_0x2a2a59){_0x1068ea[_0xc08a('0x1c')]=_0x2a2a59;if(_0x4d3278[_0xc08a('0x31')][_0xc08a('0x40')]){_0x18ae4b[_0xc08a('0x41')]=[{'all':!![]}];}return db[_0xc08a('0x2d')][_0xc08a('0x42')](_0x18ae4b);})[_0xc08a('0x25')](function(_0x3fa1b1){_0x1068ea['rows']=_0x3fa1b1;return _0x1068ea;})['then'](respondWithFilteredResult(_0x2e54fe,_0x18ae4b))['catch'](handleError(_0x2e54fe,null));};exports[_0xc08a('0x43')]=function(_0x131bf4,_0x425152){var _0x58496c={'raw':!![],'where':{'id':_0x131bf4[_0xc08a('0x44')]['id']}},_0x56455b={};_0x56455b[_0xc08a('0x34')]=_[_0xc08a('0x45')](db[_0xc08a('0x2d')][_0xc08a('0x2e')]);_0x56455b[_0xc08a('0x31')]=_['keys'](_0x131bf4[_0xc08a('0x31')]);_0x56455b[_0xc08a('0x32')]=_['intersection'](_0x56455b[_0xc08a('0x34')],_0x56455b[_0xc08a('0x31')]);_0x58496c[_0xc08a('0x35')]=_['intersection'](_0x56455b['model'],qs[_0xc08a('0x36')](_0x131bf4[_0xc08a('0x31')]['fields']));_0x58496c[_0xc08a('0x35')]=_0x58496c[_0xc08a('0x35')][_0xc08a('0x37')]?_0x58496c[_0xc08a('0x35')]:_0x56455b[_0xc08a('0x34')];if(_0x131bf4[_0xc08a('0x31')][_0xc08a('0x40')]){_0x58496c[_0xc08a('0x41')]=[{'all':!![]}];}_0x58496c=_[_0xc08a('0x3e')]({},_0x58496c,_0x131bf4[_0xc08a('0x46')]);return db[_0xc08a('0x2d')]['find'](_0x58496c)[_0xc08a('0x25')](handleEntityNotFound(_0x425152,null))[_0xc08a('0x25')](respondWithResult(_0x425152,null))[_0xc08a('0x47')](handleError(_0x425152,null));};exports[_0xc08a('0x48')]=function(_0x181e73,_0x3e4ca5){return db[_0xc08a('0x2d')]['create'](_0x181e73[_0xc08a('0x49')],{})[_0xc08a('0x25')](respondWithResult(_0x3e4ca5,0xc9))[_0xc08a('0x47')](handleError(_0x3e4ca5,null));};exports[_0xc08a('0x24')]=function(_0x1d2ac3,_0x9d627){if(_0x1d2ac3[_0xc08a('0x49')]['id']){delete _0x1d2ac3['body']['id'];}return db[_0xc08a('0x2d')][_0xc08a('0x4a')]({'where':{'id':_0x1d2ac3[_0xc08a('0x44')]['id']}})[_0xc08a('0x25')](handleEntityNotFound(_0x9d627,null))['then'](saveUpdates(_0x1d2ac3[_0xc08a('0x49')],null))[_0xc08a('0x25')](respondWithResult(_0x9d627,null))[_0xc08a('0x47')](handleError(_0x9d627,null));};exports[_0xc08a('0x4b')]=function(_0x5852e2,_0x58f121){return db[_0xc08a('0x2d')][_0xc08a('0x4a')]({'where':{'id':_0x5852e2[_0xc08a('0x44')]['id']}})[_0xc08a('0x25')](handleEntityNotFound(_0x58f121,null))['then'](removeEntity(_0x58f121,null))[_0xc08a('0x47')](handleError(_0x58f121,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 3642a82..8e65c3c 100644 --- a/server/api/cloudProvider/cloudProvider.model.js +++ b/server/api/cloudProvider/cloudProvider.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1708=['rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','util','moment','bluebird','path'];(function(_0x2dfd0e,_0x13739e){var _0x343af6=function(_0x206e2f){while(--_0x206e2f){_0x2dfd0e['push'](_0x2dfd0e['shift']());}};_0x343af6(++_0x13739e);}(_0x1708,0x125));var _0x8170=function(_0x799277,_0x574d5f){_0x799277=_0x799277-0x0;var _0x56d41f=_0x1708[_0x799277];return _0x56d41f;};'use strict';var _=require('lodash');var util=require(_0x8170('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8170('0x1'));var BPromise=require(_0x8170('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8170('0x3'));var rimraf=require(_0x8170('0x4'));var config=require(_0x8170('0x5'));var attributes=require(_0x8170('0x6'));module[_0x8170('0x7')]=function(_0x52387f,_0x2cf19b){return _0x52387f[_0x8170('0x8')](_0x8170('0x9'),attributes,{'tableName':_0x8170('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0411=['./cloudProvider.attributes','CloudProvider','cloud_providers','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x91120b,_0x12ea29){var _0x40e280=function(_0x1f8d28){while(--_0x1f8d28){_0x91120b['push'](_0x91120b['shift']());}};_0x40e280(++_0x12ea29);}(_0x0411,0x1b3));var _0x1041=function(_0x296588,_0x49f98d){_0x296588=_0x296588-0x0;var _0x2f6d92=_0x0411[_0x296588];return _0x2f6d92;};'use strict';var _=require(_0x1041('0x0'));var util=require(_0x1041('0x1'));var logger=require('../../config/logger')(_0x1041('0x2'));var moment=require(_0x1041('0x3'));var BPromise=require(_0x1041('0x4'));var rp=require(_0x1041('0x5'));var fs=require('fs');var path=require(_0x1041('0x6'));var rimraf=require(_0x1041('0x7'));var config=require(_0x1041('0x8'));var attributes=require(_0x1041('0x9'));module['exports']=function(_0x1d848c,_0x26f44b){return _0x1d848c['define'](_0x1041('0xa'),attributes,{'tableName':_0x1041('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 9a057ca..46ea807 100644 --- a/server/api/cloudProvider/cloudProvider.rpc.js +++ b/server/api/cloudProvider/cloudProvider.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0717=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0717,0x9b));var _0x7071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0717[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7071('0x0'));var util=require(_0x7071('0x1'));var moment=require(_0x7071('0x2'));var BPromise=require(_0x7071('0x3'));var rs=require(_0x7071('0x4'));var fs=require('fs');var Redis=require(_0x7071('0x5'));var db=require(_0x7071('0x6'))['db'];var utils=require(_0x7071('0x7'));var logger=require(_0x7071('0x8'))(_0x7071('0x9'));var config=require('../../config/environment');var jayson=require(_0x7071('0xa'));var client=jayson[_0x7071('0xb')][_0x7071('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55b02e,_0x25677b,_0x36c1b7){return new BPromise(function(_0x5acdb5,_0x197137){return client[_0x7071('0xd')](_0x55b02e,_0x36c1b7)[_0x7071('0xe')](function(_0x5ece94){logger[_0x7071('0xf')](_0x7071('0x10'),_0x25677b,_0x7071('0x11'));logger[_0x7071('0x12')](_0x7071('0x13'),_0x25677b,_0x7071('0x11'),JSON['stringify'](_0x5ece94));if(_0x5ece94['error']){if(_0x5ece94['error']['code']===0x1f4){logger['error'](_0x7071('0x10'),_0x25677b,_0x5ece94[_0x7071('0x14')][_0x7071('0x15')]);return _0x197137(_0x5ece94[_0x7071('0x14')]['message']);}logger['error'](_0x7071('0x10'),_0x25677b,_0x5ece94[_0x7071('0x14')]['message']);return _0x5acdb5(_0x5ece94[_0x7071('0x14')][_0x7071('0x15')]);}else{logger[_0x7071('0xf')]('CloudProvider,\x20%s,\x20%s',_0x25677b,'request\x20sent');_0x5acdb5(_0x5ece94['result'][_0x7071('0x15')]);}})[_0x7071('0x16')](function(_0x1eeadb){logger[_0x7071('0x14')]('CloudProvider,\x20%s,\x20%s',_0x25677b,_0x1eeadb);_0x197137(_0x1eeadb);});});} \ No newline at end of file +var _0x664f=['jayson/promise','client','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5c9f56,_0x42c9ad){var _0x2a726b=function(_0x4a13cd){while(--_0x4a13cd){_0x5c9f56['push'](_0x5c9f56['shift']());}};_0x2a726b(++_0x42c9ad);}(_0x664f,0x186));var _0xf664=function(_0x452450,_0x40b419){_0x452450=_0x452450-0x0;var _0x448b19=_0x664f[_0x452450];return _0x448b19;};'use strict';var _=require(_0xf664('0x0'));var util=require(_0xf664('0x1'));var moment=require(_0xf664('0x2'));var BPromise=require('bluebird');var rs=require(_0xf664('0x3'));var fs=require('fs');var Redis=require(_0xf664('0x4'));var db=require(_0xf664('0x5'))['db'];var utils=require(_0xf664('0x6'));var logger=require(_0xf664('0x7'))(_0xf664('0x8'));var config=require(_0xf664('0x9'));var jayson=require(_0xf664('0xa'));var client=jayson[_0xf664('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2efec0,_0x2e3fe0,_0x1fd747){return new BPromise(function(_0x200697,_0x4b6073){return client[_0xf664('0xc')](_0x2efec0,_0x1fd747)[_0xf664('0xd')](function(_0x615664){logger[_0xf664('0xe')]('CloudProvider,\x20%s,\x20%s',_0x2e3fe0,_0xf664('0xf'));logger[_0xf664('0x10')](_0xf664('0x11'),_0x2e3fe0,_0xf664('0xf'),JSON[_0xf664('0x12')](_0x615664));if(_0x615664[_0xf664('0x13')]){if(_0x615664[_0xf664('0x13')][_0xf664('0x14')]===0x1f4){logger[_0xf664('0x13')](_0xf664('0x15'),_0x2e3fe0,_0x615664[_0xf664('0x13')][_0xf664('0x16')]);return _0x4b6073(_0x615664[_0xf664('0x13')][_0xf664('0x16')]);}logger['error'](_0xf664('0x15'),_0x2e3fe0,_0x615664['error'][_0xf664('0x16')]);return _0x200697(_0x615664[_0xf664('0x13')][_0xf664('0x16')]);}else{logger['info'](_0xf664('0x15'),_0x2e3fe0,_0xf664('0xf'));_0x200697(_0x615664[_0xf664('0x17')]['message']);}})[_0xf664('0x18')](function(_0x20e582){logger[_0xf664('0x13')](_0xf664('0x15'),_0x2e3fe0,_0x20e582);_0x4b6073(_0x20e582);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index ef3dcbd..7a6ce94 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x269e=['get','isAuthenticated','index','/:id','show','put','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cloudProvider.controller'];(function(_0x2cfcbe,_0x245ab1){var _0xadef9b=function(_0x4e9064){while(--_0x4e9064){_0x2cfcbe['push'](_0x2cfcbe['shift']());}};_0xadef9b(++_0x245ab1);}(_0x269e,0xc8));var _0xe269=function(_0x5ece25,_0x13a94a){_0x5ece25=_0x5ece25-0x0;var _0x37746b=_0x269e[_0x5ece25];return _0x37746b;};'use strict';var multer=require(_0xe269('0x0'));var util=require(_0xe269('0x1'));var path=require('path');var timeout=require(_0xe269('0x2'));var express=require(_0xe269('0x3'));var router=express[_0xe269('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe269('0x5'));var config=require(_0xe269('0x6'));var controller=require(_0xe269('0x7'));router[_0xe269('0x8')]('/',auth[_0xe269('0x9')](),controller[_0xe269('0xa')]);router[_0xe269('0x8')](_0xe269('0xb'),auth['isAuthenticated'](),controller[_0xe269('0xc')]);router['post']('/',auth[_0xe269('0x9')](),controller['create']);router[_0xe269('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xe269('0xb'),auth['isAuthenticated'](),controller[_0xe269('0xe')]);module[_0xe269('0xf')]=router; \ No newline at end of file +var _0x18ca=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','show','create','put','/:id','update'];(function(_0x46c6e4,_0x211abf){var _0x1ad288=function(_0x17826d){while(--_0x17826d){_0x46c6e4['push'](_0x46c6e4['shift']());}};_0x1ad288(++_0x211abf);}(_0x18ca,0x146));var _0xa18c=function(_0x1ec375,_0x314f89){_0x1ec375=_0x1ec375-0x0;var _0x5cb903=_0x18ca[_0x1ec375];return _0x5cb903;};'use strict';var multer=require(_0xa18c('0x0'));var util=require('util');var path=require(_0xa18c('0x1'));var timeout=require(_0xa18c('0x2'));var express=require(_0xa18c('0x3'));var router=express[_0xa18c('0x4')]();var fs_extra=require(_0xa18c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa18c('0x6'));var config=require(_0xa18c('0x7'));var controller=require(_0xa18c('0x8'));router[_0xa18c('0x9')]('/',auth[_0xa18c('0xa')](),controller['index']);router[_0xa18c('0x9')]('/:id',auth[_0xa18c('0xa')](),controller[_0xa18c('0xb')]);router['post']('/',auth[_0xa18c('0xa')](),controller[_0xa18c('0xc')]);router[_0xa18c('0xd')](_0xa18c('0xe'),auth[_0xa18c('0xa')](),controller[_0xa18c('0xf')]);router[_0xa18c('0x10')](_0xa18c('0xe'),auth['isAuthenticated'](),controller[_0xa18c('0x11')]);module[_0xa18c('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 7efa478..e159ca4 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 _0xf49e=['exports','STRING','sequelize'];(function(_0x571547,_0x260d15){var _0x3b8ff6=function(_0xac9172){while(--_0xac9172){_0x571547['push'](_0x571547['shift']());}};_0x3b8ff6(++_0x260d15);}(_0xf49e,0x98));var _0xef49=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xf49e[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0xef49('0x0'));module[_0xef49('0x1')]={'name':{'type':Sequelize[_0xef49('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xef49('0x2')]},'companyId':{'type':Sequelize[_0xef49('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xef49('0x2')]},'fax':{'type':Sequelize[_0xef49('0x2')]},'type':{'type':Sequelize[_0xef49('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xef49('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xef49('0x2')]},'email':{'type':Sequelize[_0xef49('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xef49('0x2')]},'sCity':{'type':Sequelize[_0xef49('0x2')]},'sCountry':{'type':Sequelize[_0xef49('0x2')]},'description':{'type':Sequelize[_0xef49('0x2')]}}; \ No newline at end of file +var _0xe4c1=['name','STRING','sequelize','exports'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xe4c1,0x8e));var _0x1e4c=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xe4c1[_0x82129b];return _0x2ae5dc;};'use strict';var Sequelize=require(_0x1e4c('0x0'));module[_0x1e4c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1e4c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x1e4c('0x3')]},'phone':{'type':Sequelize[_0x1e4c('0x3')]},'fax':{'type':Sequelize[_0x1e4c('0x3')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x1e4c('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1e4c('0x3')]},'country':{'type':Sequelize[_0x1e4c('0x3')]},'email':{'type':Sequelize[_0x1e4c('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1e4c('0x3')]},'sStreet':{'type':Sequelize[_0x1e4c('0x3')]},'sPostalCode':{'type':Sequelize[_0x1e4c('0x3')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x1e4c('0x3')]},'description':{'type':Sequelize[_0x1e4c('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 34086f3..76a1f91 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 _0xbaf0=['rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','CmContact','addContacts','ids','omit','getContacts','findOne','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','get','Companies','UserProfileResource','then','error','name','send','index','describe','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','map','options','includeAll','include','CmCompany','findAll'];(function(_0x4d04f8,_0x63e251){var _0x1b9b97=function(_0x594ae0){while(--_0x594ae0){_0x4d04f8['push'](_0x4d04f8['shift']());}};_0x1b9b97(++_0x63e251);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0baf('0x0'));var zipdir=require(_0x0baf('0x1'));var jsonpatch=require(_0x0baf('0x2'));var rp=require(_0x0baf('0x3'));var moment=require(_0x0baf('0x4'));var BPromise=require(_0x0baf('0x5'));var Mustache=require('mustache');var util=require(_0x0baf('0x6'));var path=require(_0x0baf('0x7'));var sox=require(_0x0baf('0x8'));var csv=require(_0x0baf('0x9'));var ejs=require(_0x0baf('0xa'));var fs=require('fs');var fs_extra=require(_0x0baf('0xb'));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 Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xcc;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0x1b')](_0xe4378c);}return _0x465dd7['status'](_0xe4378c)[_0x0baf('0x1c')]();};}function respondWithResult(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0xc8;return function(_0x1f50c3){if(_0x1f50c3){return _0x49e44b[_0x0baf('0x1d')](_0x1c76a8)[_0x0baf('0x1e')](_0x1f50c3);}};}function respondWithFilteredResult(_0xb8339e,_0x469599){return function(_0x4f80a8){if(_0x4f80a8){var _0x4cd79d=typeof _0x469599[_0x0baf('0x1f')]===_0x0baf('0x20')&&typeof _0x469599[_0x0baf('0x21')]===_0x0baf('0x20');var _0x2cf7da=_0x4f80a8[_0x0baf('0x22')];var _0x53c338=_0x4cd79d?0x0:_0x469599[_0x0baf('0x1f')];var _0xfbecec=_0x4cd79d?_0x4f80a8[_0x0baf('0x22')]:_0x469599[_0x0baf('0x1f')]+_0x469599[_0x0baf('0x21')];var _0x42b7f2;if(_0xfbecec>=_0x2cf7da){_0xfbecec=_0x2cf7da;_0x42b7f2=0xc8;}else{_0x42b7f2=0xce;}_0xb8339e['status'](_0x42b7f2);return _0xb8339e['set'](_0x0baf('0x23'),_0x53c338+'-'+_0xfbecec+'/'+_0x2cf7da)[_0x0baf('0x1e')](_0x4f80a8);}return null;};}function patchUpdates(_0x32e839){return function(_0x1848e8){try{jsonpatch[_0x0baf('0x24')](_0x1848e8,_0x32e839,!![]);}catch(_0x3e3e20){return BPromise[_0x0baf('0x25')](_0x3e3e20);}return _0x1848e8[_0x0baf('0x26')]();};}function saveUpdates(_0x2c42e2,_0x15a2c3){return function(_0x54f2fa){if(_0x54f2fa){return _0x54f2fa[_0x0baf('0x27')](_0x2c42e2)['then'](function(_0xf6c158){return _0xf6c158;});}return null;};}function removeEntity(_0x5dbf00,_0x4de74c){return function(_0x2ef0aa){if(_0x2ef0aa){return _0x2ef0aa['destroy']()['then'](function(){var _0x47c4b=_0x2ef0aa[_0x0baf('0x28')]({'plain':!![]});var _0x34e264=_0x0baf('0x29');return db[_0x0baf('0x2a')]['destroy']({'where':{'type':_0x34e264,'resourceId':_0x47c4b['id']}})[_0x0baf('0x2b')](function(){return _0x2ef0aa;});})[_0x0baf('0x2b')](function(){_0x5dbf00[_0x0baf('0x1d')](0xcc)[_0x0baf('0x1c')]();});}};}function handleEntityNotFound(_0x3843b8,_0x3b9b31){return function(_0x453525){if(!_0x453525){_0x3843b8['sendStatus'](0x194);}return _0x453525;};}function handleError(_0x1590b4,_0x393a5a){_0x393a5a=_0x393a5a||0x1f4;return function(_0xcaf13d){logger[_0x0baf('0x2c')](_0xcaf13d['stack']);if(_0xcaf13d[_0x0baf('0x2d')]){delete _0xcaf13d[_0x0baf('0x2d')];}_0x1590b4['status'](_0x393a5a)[_0x0baf('0x2e')](_0xcaf13d);};}exports[_0x0baf('0x2f')]=function(_0x478ce8,_0xb4dbb1){var _0xd14f0f={},_0x366924={},_0x213a6a={'count':0x0,'rows':[]};return db['CmCompany'][_0x0baf('0x30')]()[_0x0baf('0x2b')](function(_0x37be4e){_0x366924[_0x0baf('0x31')]=_[_0x0baf('0x32')](_0x37be4e);_0x366924[_0x0baf('0x33')]=_[_0x0baf('0x32')](_0x478ce8[_0x0baf('0x33')]);_0x366924[_0x0baf('0x34')]=_[_0x0baf('0x35')](_0x366924[_0x0baf('0x31')],_0x366924[_0x0baf('0x33')]);_0xd14f0f[_0x0baf('0x36')]=_[_0x0baf('0x35')](_0x366924['model'],qs[_0x0baf('0x37')](_0x478ce8['query'][_0x0baf('0x37')]));_0xd14f0f[_0x0baf('0x36')]=_0xd14f0f[_0x0baf('0x36')][_0x0baf('0x38')]?_0xd14f0f['attributes']:_0x366924[_0x0baf('0x31')];if(!_0x478ce8[_0x0baf('0x33')]['hasOwnProperty'](_0x0baf('0x39'))){_0xd14f0f[_0x0baf('0x21')]=qs[_0x0baf('0x21')](_0x478ce8[_0x0baf('0x33')][_0x0baf('0x21')]);_0xd14f0f[_0x0baf('0x1f')]=qs[_0x0baf('0x1f')](_0x478ce8[_0x0baf('0x33')]['offset']);}_0xd14f0f[_0x0baf('0x3a')]=qs[_0x0baf('0x3b')](_0x478ce8['query'][_0x0baf('0x3b')]);_0xd14f0f['where']=qs['filters'](_[_0x0baf('0x3c')](_0x478ce8[_0x0baf('0x33')],_0x366924['filters']),_0x37be4e);if(_0x478ce8['query'][_0x0baf('0x3d')]){_0xd14f0f[_0x0baf('0x3e')]=_[_0x0baf('0x3f')](_0xd14f0f[_0x0baf('0x3e')],{'$or':_[_0x0baf('0x40')](_0xd14f0f[_0x0baf('0x36')],function(_0x290464){var _0x37c038={};_0x37c038[_0x290464]={'$like':'%'+_0x478ce8[_0x0baf('0x33')][_0x0baf('0x3d')]+'%'};return _0x37c038;})});}_0xd14f0f=_[_0x0baf('0x3f')]({},_0xd14f0f,_0x478ce8[_0x0baf('0x41')]);var _0x354cb1={'where':_0xd14f0f[_0x0baf('0x3e')]};return db['CmCompany'][_0x0baf('0x22')](_0x354cb1)[_0x0baf('0x2b')](function(_0x4f1de9){_0x213a6a[_0x0baf('0x22')]=_0x4f1de9;if(_0x478ce8[_0x0baf('0x33')][_0x0baf('0x42')]){_0xd14f0f[_0x0baf('0x43')]=[{'all':!![]}];}return db[_0x0baf('0x44')][_0x0baf('0x45')](_0xd14f0f);})['then'](function(_0x23ad34){_0x213a6a[_0x0baf('0x46')]=_0x23ad34;return _0x213a6a;})['then'](respondWithFilteredResult(_0xb4dbb1,_0xd14f0f))[_0x0baf('0x47')](handleError(_0xb4dbb1,null));})[_0x0baf('0x47')](handleError(_0xb4dbb1,null));};exports[_0x0baf('0x48')]=function(_0x57903e,_0x504031){var _0x193fd3={'raw':![],'where':{'id':_0x57903e[_0x0baf('0x49')]['id']}},_0x43919e={};_0x43919e[_0x0baf('0x31')]=_[_0x0baf('0x32')](db[_0x0baf('0x44')][_0x0baf('0x4a')]);_0x43919e[_0x0baf('0x33')]=_[_0x0baf('0x32')](_0x57903e[_0x0baf('0x33')]);_0x43919e['filters']=_[_0x0baf('0x35')](_0x43919e[_0x0baf('0x31')],_0x43919e[_0x0baf('0x33')]);_0x193fd3[_0x0baf('0x36')]=_[_0x0baf('0x35')](_0x43919e['model'],qs[_0x0baf('0x37')](_0x57903e[_0x0baf('0x33')][_0x0baf('0x37')]));_0x193fd3[_0x0baf('0x36')]=_0x193fd3[_0x0baf('0x36')]['length']?_0x193fd3[_0x0baf('0x36')]:_0x43919e[_0x0baf('0x31')];if(_0x57903e[_0x0baf('0x33')][_0x0baf('0x42')]){_0x193fd3[_0x0baf('0x43')]=[{'all':!![]}];}_0x193fd3=_[_0x0baf('0x3f')]({},_0x193fd3,_0x57903e[_0x0baf('0x41')]);return db['CmCompany'][_0x0baf('0x4b')](_0x193fd3)[_0x0baf('0x2b')](handleEntityNotFound(_0x504031,null))[_0x0baf('0x2b')](respondWithResult(_0x504031,null))['catch'](handleError(_0x504031,null));};exports[_0x0baf('0x4c')]=function(_0x2222b6,_0x10fa62){return db[_0x0baf('0x44')][_0x0baf('0x4c')](_0x2222b6[_0x0baf('0x4d')],{})[_0x0baf('0x2b')](function(_0x5a54bb){var _0x22c451=_0x2222b6[_0x0baf('0x4e')][_0x0baf('0x28')]({'plain':!![]});if(!_0x22c451)throw new Error(_0x0baf('0x4f'));if(_0x22c451[_0x0baf('0x50')]===_0x0baf('0x4e')){var _0x40d4a6=_0x5a54bb[_0x0baf('0x28')]({'plain':!![]});var _0x2be7fe=_0x0baf('0x29');return db[_0x0baf('0x51')]['find']({'where':{'name':_0x2be7fe,'userProfileId':_0x22c451['userProfileId']},'raw':!![]})[_0x0baf('0x2b')](function(_0x3d6b19){if(_0x3d6b19&&_0x3d6b19[_0x0baf('0x52')]===0x0){return db[_0x0baf('0x2a')][_0x0baf('0x4c')]({'name':_0x40d4a6[_0x0baf('0x2d')],'resourceId':_0x40d4a6['id'],'type':_0x3d6b19[_0x0baf('0x2d')],'sectionId':_0x3d6b19['id']},{})['then'](function(){return _0x5a54bb;});}else{return _0x5a54bb;}})[_0x0baf('0x47')](function(_0x2ef4c1){logger[_0x0baf('0x2c')](_0x0baf('0x53'),_0x2ef4c1);throw _0x2ef4c1;});}return _0x5a54bb;})[_0x0baf('0x2b')](respondWithResult(_0x10fa62,0xc9))[_0x0baf('0x47')](handleError(_0x10fa62,null));};exports['update']=function(_0x3eebe5,_0x5f123c){if(_0x3eebe5[_0x0baf('0x4d')]['id']){delete _0x3eebe5['body']['id'];}return db[_0x0baf('0x44')]['find']({'where':{'id':_0x3eebe5[_0x0baf('0x49')]['id']}})['then'](handleEntityNotFound(_0x5f123c,null))[_0x0baf('0x2b')](saveUpdates(_0x3eebe5[_0x0baf('0x4d')],null))[_0x0baf('0x2b')](respondWithResult(_0x5f123c,null))[_0x0baf('0x47')](handleError(_0x5f123c,null));};exports[_0x0baf('0x54')]=function(_0x576475,_0x21f179){return db[_0x0baf('0x44')][_0x0baf('0x4b')]({'where':{'id':_0x576475[_0x0baf('0x49')]['id']}})[_0x0baf('0x2b')](handleEntityNotFound(_0x21f179,null))[_0x0baf('0x2b')](removeEntity(_0x21f179,null))['catch'](handleError(_0x21f179,null));};exports[_0x0baf('0x30')]=function(_0x2771a2,_0x315cbf){return db[_0x0baf('0x44')][_0x0baf('0x30')]()[_0x0baf('0x2b')](respondWithResult(_0x315cbf,null))[_0x0baf('0x47')](handleError(_0x315cbf,null));};exports['addContacts']=function(_0x48e855,_0x23f6ea,_0x11e18a){return db[_0x0baf('0x55')][_0x0baf('0x4b')]({'where':{'id':_0x48e855[_0x0baf('0x49')]['id']}})[_0x0baf('0x2b')](handleEntityNotFound(_0x23f6ea,null))[_0x0baf('0x2b')](function(_0x14a667){if(_0x14a667){return _0x14a667[_0x0baf('0x56')](_0x48e855['body'][_0x0baf('0x57')],_[_0x0baf('0x58')](_0x48e855[_0x0baf('0x4d')],[_0x0baf('0x57'),'id'])||{});}})[_0x0baf('0x2b')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x47')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x59')]=function(_0x51d75f,_0x17189d,_0x27f580){var _0x437980={};var _0x37f313={};var _0x1c7d88;var _0x1a6d22;return db[_0x0baf('0x44')][_0x0baf('0x5a')]({'where':{'id':_0x51d75f['params']['id']}})[_0x0baf('0x2b')](handleEntityNotFound(_0x17189d,null))['then'](function(_0x3c00e7){if(_0x3c00e7){_0x1c7d88=_0x3c00e7;_0x37f313['model']=_['keys'](db[_0x0baf('0x55')]['rawAttributes']);_0x37f313[_0x0baf('0x33')]=_[_0x0baf('0x32')](_0x51d75f['query']);_0x37f313[_0x0baf('0x34')]=_[_0x0baf('0x35')](_0x37f313[_0x0baf('0x31')],_0x37f313['query']);_0x437980['attributes']=_[_0x0baf('0x35')](_0x37f313[_0x0baf('0x31')],qs[_0x0baf('0x37')](_0x51d75f[_0x0baf('0x33')][_0x0baf('0x37')]));_0x437980['attributes']=_0x437980[_0x0baf('0x36')]['length']?_0x437980['attributes']:_0x37f313['model'];_0x437980[_0x0baf('0x3a')]=qs['sort'](_0x51d75f['query'][_0x0baf('0x3b')]);_0x437980[_0x0baf('0x3e')]=qs[_0x0baf('0x34')](_[_0x0baf('0x3c')](_0x51d75f[_0x0baf('0x33')],_0x37f313[_0x0baf('0x34')]));if(_0x51d75f['query'][_0x0baf('0x3d')]){_0x437980[_0x0baf('0x3e')]=_[_0x0baf('0x3f')](_0x437980[_0x0baf('0x3e')],{'$or':_[_0x0baf('0x40')](_0x437980[_0x0baf('0x36')],function(_0x5cf3d3){var _0x42e8ad={};_0x42e8ad[_0x5cf3d3]={'$like':'%'+_0x51d75f[_0x0baf('0x33')][_0x0baf('0x3d')]+'%'};return _0x42e8ad;})});}_0x437980=_['merge']({},_0x437980,_0x51d75f[_0x0baf('0x41')]);return _0x1c7d88[_0x0baf('0x59')](_0x437980);}})[_0x0baf('0x2b')](function(_0x2c20fe){if(_0x2c20fe){_0x1a6d22=_0x2c20fe[_0x0baf('0x38')];if(!_0x51d75f[_0x0baf('0x33')][_0x0baf('0x5b')]('nolimit')){_0x437980['limit']=qs['limit'](_0x51d75f[_0x0baf('0x33')][_0x0baf('0x21')]);_0x437980[_0x0baf('0x1f')]=qs[_0x0baf('0x1f')](_0x51d75f[_0x0baf('0x33')][_0x0baf('0x1f')]);}return _0x1c7d88['getContacts'](_0x437980);}})['then'](function(_0x34c1f4){if(_0x34c1f4){return _0x34c1f4?{'count':_0x1a6d22,'rows':_0x34c1f4}:null;}})['then'](respondWithResult(_0x17189d,null))[_0x0baf('0x47')](handleError(_0x17189d,null));}; \ No newline at end of file +var _0xb7e7=['catch','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addContacts','CmContact','omit','ids','findOne','options','getContacts','eml-format','zip-dir','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','destroy','error','name','send','index','CmCompany','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','merge','includeAll','include','findAll','rows'];(function(_0x52b7b9,_0x43ed4b){var _0x5b5d30=function(_0x4a5b9c){while(--_0x4a5b9c){_0x52b7b9['push'](_0x52b7b9['shift']());}};_0x5b5d30(++_0x43ed4b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0xb7e7[_0x42bc91];return _0x3f5507;};'use strict';var emlformat=require(_0x7b7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b7e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b7e('0x2'));var moment=require('moment');var BPromise=require(_0x7b7e('0x3'));var Mustache=require('mustache');var util=require(_0x7b7e('0x4'));var path=require(_0x7b7e('0x5'));var sox=require(_0x7b7e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b7e('0x7'));var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var licenseUtil=require(_0x7b7e('0x17'));var db=require(_0x7b7e('0x18'))['db'];function respondWithStatusCode(_0xaadda,_0x54d8ce){_0x54d8ce=_0x54d8ce||0xcc;return function(_0x267446){if(_0x267446){return _0xaadda[_0x7b7e('0x19')](_0x54d8ce);}return _0xaadda['status'](_0x54d8ce)[_0x7b7e('0x1a')]();};}function respondWithResult(_0x5976ac,_0x4c6011){_0x4c6011=_0x4c6011||0xc8;return function(_0x2889ed){if(_0x2889ed){return _0x5976ac[_0x7b7e('0x1b')](_0x4c6011)[_0x7b7e('0x1c')](_0x2889ed);}};}function respondWithFilteredResult(_0x457ec5,_0x3d2fb2){return function(_0x5703fd){if(_0x5703fd){var _0x51baf6=typeof _0x3d2fb2[_0x7b7e('0x1d')]===_0x7b7e('0x1e')&&typeof _0x3d2fb2[_0x7b7e('0x1f')]===_0x7b7e('0x1e');var _0x2cc400=_0x5703fd[_0x7b7e('0x20')];var _0x242368=_0x51baf6?0x0:_0x3d2fb2[_0x7b7e('0x1d')];var _0x2acb8c=_0x51baf6?_0x5703fd[_0x7b7e('0x20')]:_0x3d2fb2[_0x7b7e('0x1d')]+_0x3d2fb2[_0x7b7e('0x1f')];var _0x448980;if(_0x2acb8c>=_0x2cc400){_0x2acb8c=_0x2cc400;_0x448980=0xc8;}else{_0x448980=0xce;}_0x457ec5[_0x7b7e('0x1b')](_0x448980);return _0x457ec5[_0x7b7e('0x21')](_0x7b7e('0x22'),_0x242368+'-'+_0x2acb8c+'/'+_0x2cc400)[_0x7b7e('0x1c')](_0x5703fd);}return null;};}function patchUpdates(_0x49eddb){return function(_0x69262b){try{jsonpatch[_0x7b7e('0x23')](_0x69262b,_0x49eddb,!![]);}catch(_0x24718c){return BPromise['reject'](_0x24718c);}return _0x69262b[_0x7b7e('0x24')]();};}function saveUpdates(_0xbf0cb3,_0x14243b){return function(_0x200156){if(_0x200156){return _0x200156[_0x7b7e('0x25')](_0xbf0cb3)[_0x7b7e('0x26')](function(_0x28bf43){return _0x28bf43;});}return null;};}function removeEntity(_0x10a66a,_0x53bbb3){return function(_0x5d6215){if(_0x5d6215){return _0x5d6215['destroy']()[_0x7b7e('0x26')](function(){var _0x22598e=_0x5d6215[_0x7b7e('0x27')]({'plain':!![]});var _0x483c6f='Companies';return db['UserProfileResource'][_0x7b7e('0x28')]({'where':{'type':_0x483c6f,'resourceId':_0x22598e['id']}})[_0x7b7e('0x26')](function(){return _0x5d6215;});})[_0x7b7e('0x26')](function(){_0x10a66a[_0x7b7e('0x1b')](0xcc)[_0x7b7e('0x1a')]();});}};}function handleEntityNotFound(_0x48fad1,_0x6a1e71){return function(_0x21a15){if(!_0x21a15){_0x48fad1['sendStatus'](0x194);}return _0x21a15;};}function handleError(_0x57b9da,_0x4e5de7){_0x4e5de7=_0x4e5de7||0x1f4;return function(_0x12ef0b){logger[_0x7b7e('0x29')](_0x12ef0b['stack']);if(_0x12ef0b[_0x7b7e('0x2a')]){delete _0x12ef0b['name'];}_0x57b9da[_0x7b7e('0x1b')](_0x4e5de7)[_0x7b7e('0x2b')](_0x12ef0b);};}exports[_0x7b7e('0x2c')]=function(_0x5515ca,_0x3960b8){var _0xe31336={},_0x35602a={},_0x326dd2={'count':0x0,'rows':[]};return db[_0x7b7e('0x2d')]['describe']()[_0x7b7e('0x26')](function(_0x51c010){_0x35602a[_0x7b7e('0x2e')]=_[_0x7b7e('0x2f')](_0x51c010);_0x35602a[_0x7b7e('0x30')]=_[_0x7b7e('0x2f')](_0x5515ca[_0x7b7e('0x30')]);_0x35602a[_0x7b7e('0x31')]=_[_0x7b7e('0x32')](_0x35602a['model'],_0x35602a['query']);_0xe31336[_0x7b7e('0x33')]=_[_0x7b7e('0x32')](_0x35602a['model'],qs[_0x7b7e('0x34')](_0x5515ca[_0x7b7e('0x30')][_0x7b7e('0x34')]));_0xe31336['attributes']=_0xe31336[_0x7b7e('0x33')][_0x7b7e('0x35')]?_0xe31336[_0x7b7e('0x33')]:_0x35602a[_0x7b7e('0x2e')];if(!_0x5515ca[_0x7b7e('0x30')][_0x7b7e('0x36')](_0x7b7e('0x37'))){_0xe31336[_0x7b7e('0x1f')]=qs[_0x7b7e('0x1f')](_0x5515ca[_0x7b7e('0x30')][_0x7b7e('0x1f')]);_0xe31336[_0x7b7e('0x1d')]=qs[_0x7b7e('0x1d')](_0x5515ca[_0x7b7e('0x30')][_0x7b7e('0x1d')]);}_0xe31336[_0x7b7e('0x38')]=qs['sort'](_0x5515ca[_0x7b7e('0x30')][_0x7b7e('0x39')]);_0xe31336[_0x7b7e('0x3a')]=qs[_0x7b7e('0x31')](_[_0x7b7e('0x3b')](_0x5515ca[_0x7b7e('0x30')],_0x35602a[_0x7b7e('0x31')]),_0x51c010);if(_0x5515ca[_0x7b7e('0x30')][_0x7b7e('0x3c')]){_0xe31336[_0x7b7e('0x3a')]=_['merge'](_0xe31336[_0x7b7e('0x3a')],{'$or':_[_0x7b7e('0x3d')](_0xe31336[_0x7b7e('0x33')],function(_0x1d43da){var _0x5a5720={};_0x5a5720[_0x1d43da]={'$like':'%'+_0x5515ca[_0x7b7e('0x30')][_0x7b7e('0x3c')]+'%'};return _0x5a5720;})});}_0xe31336=_[_0x7b7e('0x3e')]({},_0xe31336,_0x5515ca['options']);var _0x4a2888={'where':_0xe31336[_0x7b7e('0x3a')]};return db['CmCompany'][_0x7b7e('0x20')](_0x4a2888)[_0x7b7e('0x26')](function(_0x4de331){_0x326dd2[_0x7b7e('0x20')]=_0x4de331;if(_0x5515ca[_0x7b7e('0x30')][_0x7b7e('0x3f')]){_0xe31336[_0x7b7e('0x40')]=[{'all':!![]}];}return db[_0x7b7e('0x2d')][_0x7b7e('0x41')](_0xe31336);})[_0x7b7e('0x26')](function(_0x1d9bb9){_0x326dd2[_0x7b7e('0x42')]=_0x1d9bb9;return _0x326dd2;})['then'](respondWithFilteredResult(_0x3960b8,_0xe31336))['catch'](handleError(_0x3960b8,null));})[_0x7b7e('0x43')](handleError(_0x3960b8,null));};exports['show']=function(_0x41c8a6,_0x5e8b5d){var _0x48dd74={'raw':![],'where':{'id':_0x41c8a6['params']['id']}},_0x356db0={};_0x356db0[_0x7b7e('0x2e')]=_['keys'](db[_0x7b7e('0x2d')][_0x7b7e('0x44')]);_0x356db0[_0x7b7e('0x30')]=_[_0x7b7e('0x2f')](_0x41c8a6['query']);_0x356db0[_0x7b7e('0x31')]=_[_0x7b7e('0x32')](_0x356db0[_0x7b7e('0x2e')],_0x356db0[_0x7b7e('0x30')]);_0x48dd74[_0x7b7e('0x33')]=_[_0x7b7e('0x32')](_0x356db0['model'],qs['fields'](_0x41c8a6['query'][_0x7b7e('0x34')]));_0x48dd74[_0x7b7e('0x33')]=_0x48dd74[_0x7b7e('0x33')][_0x7b7e('0x35')]?_0x48dd74[_0x7b7e('0x33')]:_0x356db0[_0x7b7e('0x2e')];if(_0x41c8a6['query'][_0x7b7e('0x3f')]){_0x48dd74[_0x7b7e('0x40')]=[{'all':!![]}];}_0x48dd74=_['merge']({},_0x48dd74,_0x41c8a6['options']);return db[_0x7b7e('0x2d')][_0x7b7e('0x45')](_0x48dd74)[_0x7b7e('0x26')](handleEntityNotFound(_0x5e8b5d,null))[_0x7b7e('0x26')](respondWithResult(_0x5e8b5d,null))[_0x7b7e('0x43')](handleError(_0x5e8b5d,null));};exports[_0x7b7e('0x46')]=function(_0x590154,_0x2673eb){return db['CmCompany'][_0x7b7e('0x46')](_0x590154[_0x7b7e('0x47')],{})[_0x7b7e('0x26')](function(_0x5874e2){var _0x58e4e6=_0x590154[_0x7b7e('0x48')][_0x7b7e('0x27')]({'plain':!![]});if(!_0x58e4e6)throw new Error(_0x7b7e('0x49'));if(_0x58e4e6[_0x7b7e('0x4a')]===_0x7b7e('0x48')){var _0x5cce7c=_0x5874e2[_0x7b7e('0x27')]({'plain':!![]});var _0x270c4a=_0x7b7e('0x4b');return db[_0x7b7e('0x4c')][_0x7b7e('0x45')]({'where':{'name':_0x270c4a,'userProfileId':_0x58e4e6['userProfileId']},'raw':!![]})[_0x7b7e('0x26')](function(_0x29024e){if(_0x29024e&&_0x29024e[_0x7b7e('0x4d')]===0x0){return db[_0x7b7e('0x4e')][_0x7b7e('0x46')]({'name':_0x5cce7c[_0x7b7e('0x2a')],'resourceId':_0x5cce7c['id'],'type':_0x29024e[_0x7b7e('0x2a')],'sectionId':_0x29024e['id']},{})['then'](function(){return _0x5874e2;});}else{return _0x5874e2;}})[_0x7b7e('0x43')](function(_0x5d7c89){logger[_0x7b7e('0x29')](_0x7b7e('0x4f'),_0x5d7c89);throw _0x5d7c89;});}return _0x5874e2;})['then'](respondWithResult(_0x2673eb,0xc9))[_0x7b7e('0x43')](handleError(_0x2673eb,null));};exports[_0x7b7e('0x25')]=function(_0x16c81d,_0x3afe88){if(_0x16c81d[_0x7b7e('0x47')]['id']){delete _0x16c81d[_0x7b7e('0x47')]['id'];}return db[_0x7b7e('0x2d')]['find']({'where':{'id':_0x16c81d[_0x7b7e('0x50')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x3afe88,null))[_0x7b7e('0x26')](saveUpdates(_0x16c81d[_0x7b7e('0x47')],null))['then'](respondWithResult(_0x3afe88,null))['catch'](handleError(_0x3afe88,null));};exports['destroy']=function(_0x2471ad,_0x41530f){return db[_0x7b7e('0x2d')]['find']({'where':{'id':_0x2471ad['params']['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x41530f,null))[_0x7b7e('0x26')](removeEntity(_0x41530f,null))['catch'](handleError(_0x41530f,null));};exports[_0x7b7e('0x51')]=function(_0xbe02ed,_0x44c30a){return db['CmCompany'][_0x7b7e('0x51')]()[_0x7b7e('0x26')](respondWithResult(_0x44c30a,null))['catch'](handleError(_0x44c30a,null));};exports[_0x7b7e('0x52')]=function(_0x441c3c,_0x1d7db1,_0x267aef){return db[_0x7b7e('0x53')][_0x7b7e('0x45')]({'where':{'id':_0x441c3c[_0x7b7e('0x50')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x1d7db1,null))[_0x7b7e('0x26')](function(_0x5509ad){if(_0x5509ad){return _0x5509ad[_0x7b7e('0x52')](_0x441c3c[_0x7b7e('0x47')]['ids'],_[_0x7b7e('0x54')](_0x441c3c[_0x7b7e('0x47')],[_0x7b7e('0x55'),'id'])||{});}})['then'](respondWithResult(_0x1d7db1,null))[_0x7b7e('0x43')](handleError(_0x1d7db1,null));};exports['getContacts']=function(_0x50c544,_0x206ee7,_0x51aa97){var _0x2a17c7={};var _0x3b3168={};var _0x561158;var _0x2dcb35;return db[_0x7b7e('0x2d')][_0x7b7e('0x56')]({'where':{'id':_0x50c544[_0x7b7e('0x50')]['id']}})['then'](handleEntityNotFound(_0x206ee7,null))[_0x7b7e('0x26')](function(_0x73904d){if(_0x73904d){_0x561158=_0x73904d;_0x3b3168[_0x7b7e('0x2e')]=_[_0x7b7e('0x2f')](db[_0x7b7e('0x53')][_0x7b7e('0x44')]);_0x3b3168[_0x7b7e('0x30')]=_[_0x7b7e('0x2f')](_0x50c544[_0x7b7e('0x30')]);_0x3b3168[_0x7b7e('0x31')]=_['intersection'](_0x3b3168[_0x7b7e('0x2e')],_0x3b3168['query']);_0x2a17c7['attributes']=_[_0x7b7e('0x32')](_0x3b3168[_0x7b7e('0x2e')],qs[_0x7b7e('0x34')](_0x50c544[_0x7b7e('0x30')]['fields']));_0x2a17c7[_0x7b7e('0x33')]=_0x2a17c7[_0x7b7e('0x33')][_0x7b7e('0x35')]?_0x2a17c7[_0x7b7e('0x33')]:_0x3b3168[_0x7b7e('0x2e')];_0x2a17c7[_0x7b7e('0x38')]=qs['sort'](_0x50c544[_0x7b7e('0x30')]['sort']);_0x2a17c7['where']=qs[_0x7b7e('0x31')](_['pick'](_0x50c544[_0x7b7e('0x30')],_0x3b3168['filters']));if(_0x50c544[_0x7b7e('0x30')][_0x7b7e('0x3c')]){_0x2a17c7['where']=_[_0x7b7e('0x3e')](_0x2a17c7[_0x7b7e('0x3a')],{'$or':_['map'](_0x2a17c7[_0x7b7e('0x33')],function(_0x27a552){var _0x50184c={};_0x50184c[_0x27a552]={'$like':'%'+_0x50c544[_0x7b7e('0x30')][_0x7b7e('0x3c')]+'%'};return _0x50184c;})});}_0x2a17c7=_[_0x7b7e('0x3e')]({},_0x2a17c7,_0x50c544[_0x7b7e('0x57')]);return _0x561158[_0x7b7e('0x58')](_0x2a17c7);}})[_0x7b7e('0x26')](function(_0x17e5ba){if(_0x17e5ba){_0x2dcb35=_0x17e5ba['length'];if(!_0x50c544['query'][_0x7b7e('0x36')](_0x7b7e('0x37'))){_0x2a17c7[_0x7b7e('0x1f')]=qs[_0x7b7e('0x1f')](_0x50c544[_0x7b7e('0x30')][_0x7b7e('0x1f')]);_0x2a17c7[_0x7b7e('0x1d')]=qs['offset'](_0x50c544[_0x7b7e('0x30')][_0x7b7e('0x1d')]);}return _0x561158['getContacts'](_0x2a17c7);}})[_0x7b7e('0x26')](function(_0x3f8162){if(_0x3f8162){return _0x3f8162?{'count':_0x2dcb35,'rows':_0x3f8162}:null;}})[_0x7b7e('0x26')](respondWithResult(_0x206ee7,null))[_0x7b7e('0x43')](handleError(_0x206ee7,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index d54546f..060d51c 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 _0xd8b1=['cm_companies','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','CmCompany'];(function(_0xc80b2b,_0x5a12e9){var _0x22af6f=function(_0x418bf5){while(--_0x418bf5){_0xc80b2b['push'](_0xc80b2b['shift']());}};_0x22af6f(++_0x5a12e9);}(_0xd8b1,0x105));var _0x1d8b=function(_0x4b6fd6,_0x4f4d8c){_0x4b6fd6=_0x4b6fd6-0x0;var _0x2227d0=_0xd8b1[_0x4b6fd6];return _0x2227d0;};'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 fs=require('fs');var path=require(_0x1d8b('0x6'));var rimraf=require('rimraf');var config=require(_0x1d8b('0x7'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x4d5ba0,_0x27534c){return _0x4d5ba0['define'](_0x1d8b('0x8'),attributes,{'tableName':_0x1d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fda=['bluebird','request-promise','path','rimraf','exports','define','CmCompany','cm_companies','lodash','../../config/logger','api','moment'];(function(_0x1abc25,_0x55567d){var _0x480310=function(_0x406eac){while(--_0x406eac){_0x1abc25['push'](_0x1abc25['shift']());}};_0x480310(++_0x55567d);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x2b2d36,_0x35eb07){_0x2b2d36=_0x2b2d36-0x0;var _0x2158a7=_0x0fda[_0x2b2d36];return _0x2158a7;};'use strict';var _=require(_0xa0fd('0x0'));var util=require('util');var logger=require(_0xa0fd('0x1'))(_0xa0fd('0x2'));var moment=require(_0xa0fd('0x3'));var BPromise=require(_0xa0fd('0x4'));var rp=require(_0xa0fd('0x5'));var fs=require('fs');var path=require(_0xa0fd('0x6'));var rimraf=require(_0xa0fd('0x7'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0xa0fd('0x8')]=function(_0x4aec58,_0x49b3c1){return _0x4aec58[_0xa0fd('0x9')](_0xa0fd('0xa'),attributes,{'tableName':_0xa0fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 2808a70..87c386a 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 _0xd7bc=['../../config/environment','jayson/promise','http','then','info','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x543429,_0x140390){var _0x112a46=function(_0x46528b){while(--_0x46528b){_0x543429['push'](_0x543429['shift']());}};_0x112a46(++_0x140390);}(_0xd7bc,0xc2));var _0xcd7b=function(_0x367361,_0x311488){_0x367361=_0x367361-0x0;var _0x195d2d=_0xd7bc[_0x367361];return _0x195d2d;};'use strict';var _=require(_0xcd7b('0x0'));var util=require('util');var moment=require(_0xcd7b('0x1'));var BPromise=require('bluebird');var rs=require(_0xcd7b('0x2'));var fs=require('fs');var Redis=require(_0xcd7b('0x3'));var db=require(_0xcd7b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd7b('0x5'))('rpc');var config=require(_0xcd7b('0x6'));var jayson=require(_0xcd7b('0x7'));var client=jayson['client'][_0xcd7b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d2b47,_0x1cd276,_0xd05371){return new BPromise(function(_0x3e5d92,_0x18e495){return client['request'](_0x1d2b47,_0xd05371)[_0xcd7b('0x9')](function(_0x422407){logger[_0xcd7b('0xa')](_0xcd7b('0xb'),_0x1cd276,'request\x20sent');logger['debug'](_0xcd7b('0xc'),_0x1cd276,_0xcd7b('0xd'),JSON[_0xcd7b('0xe')](_0x422407));if(_0x422407[_0xcd7b('0xf')]){if(_0x422407[_0xcd7b('0xf')][_0xcd7b('0x10')]===0x1f4){logger[_0xcd7b('0xf')](_0xcd7b('0xb'),_0x1cd276,_0x422407[_0xcd7b('0xf')]['message']);return _0x18e495(_0x422407[_0xcd7b('0xf')]['message']);}logger[_0xcd7b('0xf')](_0xcd7b('0xb'),_0x1cd276,_0x422407[_0xcd7b('0xf')][_0xcd7b('0x11')]);return _0x3e5d92(_0x422407[_0xcd7b('0xf')][_0xcd7b('0x11')]);}else{logger[_0xcd7b('0xa')]('CmCompany,\x20%s,\x20%s',_0x1cd276,_0xcd7b('0xd'));_0x3e5d92(_0x422407[_0xcd7b('0x12')][_0xcd7b('0x11')]);}})[_0xcd7b('0x13')](function(_0x2429ec){logger['error'](_0xcd7b('0xb'),_0x1cd276,_0x2429ec);_0x18e495(_0x2429ec);});});} \ No newline at end of file +var _0x65f1=['debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x65f1,0x181));var _0x165f=function(_0x568cf0,_0x1a44cb){_0x568cf0=_0x568cf0-0x0;var _0x360f81=_0x65f1[_0x568cf0];return _0x360f81;};'use strict';var _=require(_0x165f('0x0'));var util=require('util');var moment=require(_0x165f('0x1'));var BPromise=require('bluebird');var rs=require(_0x165f('0x2'));var fs=require('fs');var Redis=require(_0x165f('0x3'));var db=require(_0x165f('0x4'))['db'];var utils=require(_0x165f('0x5'));var logger=require(_0x165f('0x6'))('rpc');var config=require(_0x165f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x165f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1883d8,_0x10fe5e,_0x57776c){return new BPromise(function(_0x290699,_0x9672e3){return client[_0x165f('0x9')](_0x1883d8,_0x57776c)[_0x165f('0xa')](function(_0x2544a9){logger[_0x165f('0xb')](_0x165f('0xc'),_0x10fe5e,_0x165f('0xd'));logger[_0x165f('0xe')](_0x165f('0xf'),_0x10fe5e,'request\x20sent',JSON[_0x165f('0x10')](_0x2544a9));if(_0x2544a9[_0x165f('0x11')]){if(_0x2544a9['error'][_0x165f('0x12')]===0x1f4){logger[_0x165f('0x11')](_0x165f('0xc'),_0x10fe5e,_0x2544a9['error'][_0x165f('0x13')]);return _0x9672e3(_0x2544a9[_0x165f('0x11')][_0x165f('0x13')]);}logger[_0x165f('0x11')](_0x165f('0xc'),_0x10fe5e,_0x2544a9[_0x165f('0x11')][_0x165f('0x13')]);return _0x290699(_0x2544a9[_0x165f('0x11')][_0x165f('0x13')]);}else{logger[_0x165f('0xb')](_0x165f('0xc'),_0x10fe5e,_0x165f('0xd'));_0x290699(_0x2544a9[_0x165f('0x14')][_0x165f('0x13')]);}})['catch'](function(_0x390e3c){logger[_0x165f('0x11')]('CmCompany,\x20%s,\x20%s',_0x10fe5e,_0x390e3c);_0x9672e3(_0x390e3c);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 986e402..c7e5961 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 _0x4ac3=['isAuthenticated','index','describe','/:id/contacts','post','addContacts','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3b35a6,_0x592052){var _0x1d26f4=function(_0x472d12){while(--_0x472d12){_0x3b35a6['push'](_0x3b35a6['shift']());}};_0x1d26f4(++_0x592052);}(_0x4ac3,0x1af));var _0x34ac=function(_0x269f10,_0x37325f){_0x269f10=_0x269f10-0x0;var _0x4301af=_0x4ac3[_0x269f10];return _0x4301af;};'use strict';var multer=require(_0x34ac('0x0'));var util=require(_0x34ac('0x1'));var path=require(_0x34ac('0x2'));var timeout=require(_0x34ac('0x3'));var express=require(_0x34ac('0x4'));var router=express[_0x34ac('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x34ac('0x6'));var interaction=require(_0x34ac('0x7'));var config=require(_0x34ac('0x8'));var controller=require('./cmCompany.controller');router[_0x34ac('0x9')]('/',auth[_0x34ac('0xa')](),controller[_0x34ac('0xb')]);router['get']('/describe',auth[_0x34ac('0xa')](),controller[_0x34ac('0xc')]);router[_0x34ac('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x34ac('0x9')](_0x34ac('0xd'),auth[_0x34ac('0xa')](),controller['getContacts']);router[_0x34ac('0xe')]('/',auth[_0x34ac('0xa')](),controller['create']);router[_0x34ac('0xe')](_0x34ac('0xd'),auth[_0x34ac('0xa')](),controller[_0x34ac('0xf')]);router['put']('/:id',auth[_0x34ac('0xa')](),controller[_0x34ac('0x10')]);router[_0x34ac('0x11')](_0x34ac('0x12'),auth[_0x34ac('0xa')](),controller[_0x34ac('0x13')]);module[_0x34ac('0x14')]=router; \ No newline at end of file +var _0x3110=['show','/:id/contacts','getContacts','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x5f0651,_0x38cde2){var _0x3f5ce1=function(_0xff317a){while(--_0xff317a){_0x5f0651['push'](_0x5f0651['shift']());}};_0x3f5ce1(++_0x38cde2);}(_0x3110,0x1d7));var _0x0311=function(_0x36ae75,_0x2b8a84){_0x36ae75=_0x36ae75-0x0;var _0xf2b9f3=_0x3110[_0x36ae75];return _0xf2b9f3;};'use strict';var multer=require(_0x0311('0x0'));var util=require(_0x0311('0x1'));var path=require('path');var timeout=require(_0x0311('0x2'));var express=require(_0x0311('0x3'));var router=express[_0x0311('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0311('0x5'));var controller=require(_0x0311('0x6'));router[_0x0311('0x7')]('/',auth[_0x0311('0x8')](),controller[_0x0311('0x9')]);router[_0x0311('0x7')](_0x0311('0xa'),auth[_0x0311('0x8')](),controller['describe']);router[_0x0311('0x7')](_0x0311('0xb'),auth[_0x0311('0x8')](),controller[_0x0311('0xc')]);router[_0x0311('0x7')](_0x0311('0xd'),auth['isAuthenticated'](),controller[_0x0311('0xe')]);router[_0x0311('0xf')]('/',auth[_0x0311('0x8')](),controller[_0x0311('0x10')]);router['post'](_0x0311('0xd'),auth['isAuthenticated'](),controller['addContacts']);router['put']('/:id',auth[_0x0311('0x8')](),controller[_0x0311('0x11')]);router[_0x0311('0x12')](_0x0311('0xb'),auth[_0x0311('0x8')](),controller[_0x0311('0x13')]);module[_0x0311('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 8ecb35e..7ecaaf8 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 _0xd147=['UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xd147,0x123));var _0x7d14=function(_0x26129c,_0x29bbca){_0x26129c=_0x26129c-0x0;var _0x19149a=_0xd147[_0x26129c];return _0x19149a;};'use strict';var _=require(_0x7d14('0x0'));var Sequelize=require(_0x7d14('0x1'));module[_0x7d14('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x7d14('0x3')]},'street':{'type':Sequelize[_0x7d14('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x7d14('0x3')]},'dateOfBirth':{'type':Sequelize[_0x7d14('0x3')]},'description':{'type':Sequelize[_0x7d14('0x4')]},'phone':{'type':Sequelize[_0x7d14('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x7d14('0x3')]},'email':{'type':Sequelize[_0x7d14('0x3')]},'url':{'type':Sequelize[_0x7d14('0x3')]},'facebook':{'type':Sequelize[_0x7d14('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x7d14('0x3')]},'teams':{'type':Sequelize[_0x7d14('0x3')]},'viber':{'type':Sequelize[_0x7d14('0x3')]},'line':{'type':Sequelize[_0x7d14('0x3')]},'wechat':{'type':Sequelize[_0x7d14('0x3')]},'telegram':{'type':Sequelize[_0x7d14('0x3')]},'UserId':{'type':Sequelize[_0x7d14('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x7d14('0x3')]},'priority':{'type':Sequelize[_0x7d14('0x5')](0x2)[_0x7d14('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x7d14('0x7')],'defaultValue':Sequelize[_0x7d14('0x8')]}}; \ No newline at end of file +var _0xc2bf=['exports','STRING','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xc2bf,0x166));var _0xfc2b=function(_0x399021,_0x14a825){_0x399021=_0x399021-0x0;var _0x2e5e93=_0xc2bf[_0x399021];return _0x2e5e93;};'use strict';var _=require(_0xfc2b('0x0'));var Sequelize=require(_0xfc2b('0x1'));module[_0xfc2b('0x2')]={'firstName':{'type':Sequelize[_0xfc2b('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xfc2b('0x3')]},'street':{'type':Sequelize[_0xfc2b('0x3')]},'postalCode':{'type':Sequelize[_0xfc2b('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xfc2b('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xfc2b('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xfc2b('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xfc2b('0x3')]},'facebook':{'type':Sequelize[_0xfc2b('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xfc2b('0x3')]},'skype':{'type':Sequelize[_0xfc2b('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xfc2b('0x3')]},'telegram':{'type':Sequelize[_0xfc2b('0x3')]},'UserId':{'type':Sequelize[_0xfc2b('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xfc2b('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xfc2b('0x6')],'defaultValue':Sequelize[_0xfc2b('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 4e9a9c4..7417134 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 _0xa9e0=['status','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','index','CmContact','describe','keys','length','cf_','push','CmCustomField','findOne','trimStart','all','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','Tag','value','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','castTo','DATE','buildExpression','text','start','filter','Contact','isEmpty','ListId','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','isArray','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.phone\x20LIKE\x20?','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','QueryTypes','clone','DESC','t.id\x20IN\x20?','resolve','user','agent','some','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','role','sequelize','toString','c.firstName','c.mobile','c.fax','c.email','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','split','rows','find','startsWith','displayName','columnName','custom','catch','body','findAll','get','mergeWith','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','additionalPhones','bulkCreate','each','duplicates','$or','findOrCreate','spread','contact','show','Phones','params','ContactItemType','ItemType','literal','`Phones.ItemType`.OrderBy','log','$and','omit','format','cf_%d','pickBy','setFields','id\x20=\x20?','values','phone','getTags','rawAttributes','pick','merge','options','setTags','ids','setAdditionalPhones','items','item_types','isNil','ItemTypeId','description','CmHopperAdditionalPhone','item','OrderBy','`ItemType`.OrderBy','ItemType.OrderBy','getAdditionalPhones','PHONE','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','ContactId','includeAll','include','getHopperHistories','getHopperFinals','uploadCsv','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','pid','send','upload','file','parse','json','meta','No\x20ListId\x20specified','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','../../components/import/cm/csvUpdates','message','mail','chat','sms','fax','voice','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','alias','Website','closed','closedAt','disposition','secondDisposition','Account','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','startCase','flatten','sortBy','slice','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmContact.socket','register'];(function(_0x4620bd,_0x63c80){var _0x59bd01=function(_0x2fee22){while(--_0x2fee22){_0x4620bd['push'](_0x4620bd['shift']());}};_0x59bd01(++_0x63c80);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=typeof _0x5a0a06[_0x0a9e('0x1b')]===_0x0a9e('0x1c')&&typeof _0x5a0a06[_0x0a9e('0x1d')]===_0x0a9e('0x1c');var _0x530eb7=_0x459eb1[_0x0a9e('0x1e')];var _0x1314ae=_0x478723?0x0:_0x5a0a06[_0x0a9e('0x1b')];var _0x1c696a=_0x478723?_0x459eb1[_0x0a9e('0x1e')]:_0x5a0a06['offset']+_0x5a0a06[_0x0a9e('0x1d')];var _0x155cce;if(_0x1c696a>=_0x530eb7){_0x1c696a=_0x530eb7;_0x155cce=0xc8;}else{_0x155cce=0xce;}_0x225616['status'](_0x155cce);return _0x225616[_0x0a9e('0x1f')]('Content-Range',_0x1314ae+'-'+_0x1c696a+'/'+_0x530eb7)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x3a02e1){return function(_0x432e56){try{jsonpatch[_0x0a9e('0x20')](_0x432e56,_0x3a02e1,!![]);}catch(_0x30bae6){return BPromise['reject'](_0x30bae6);}return _0x432e56[_0x0a9e('0x21')]();};}function saveUpdates(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x22')](_0x2fb0e4)[_0x0a9e('0x23')](function(_0x16b1ca){return _0x16b1ca;});}return null;};}function removeEntity(_0x5ea472,_0x59181e){return function(_0x197ec0){if(_0x197ec0){return _0x197ec0[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){_0x5ea472[_0x0a9e('0x1a')](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('0x25')](_0x25fba9[_0x0a9e('0x26')]);if(_0x25fba9[_0x0a9e('0x27')]){delete _0x25fba9[_0x0a9e('0x27')];}_0x1dc186[_0x0a9e('0x1a')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x28')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x23')](function(_0x58b06f){var _0x563b45=[];for(var _0x296f41=0x0;_0x296f410x1){_0x10b040['or'](_0x0a9e('0x66'),qs['getFullTextValue'](_0x121cef),null);}else{if(qs[_0x0a9e('0x67')](_0x121cef)){_0x10b040['or']('c.id\x20LIKE\x20?',_0x121cef+'%');_0x10b040['or'](_0x0a9e('0x68'),_0x121cef+'%');_0x10b040['or']('c.mobile\x20LIKE\x20?',_0x121cef+'%');_0x10b040['or']('c.fax\x20LIKE\x20?',_0x121cef+'%');}else if(qs['isEmail'](_0x121cef)){_0x10b040['or'](_0x0a9e('0x69'),_0x121cef+'%');}else{_0x10b040['or']('c.firstName\x20LIKE\x20?','%'+_0x121cef+'%');_0x10b040['or'](_0x0a9e('0x6a'),'%'+_0x121cef+'%');_0x10b040['or'](_0x0a9e('0x69'),'%'+_0x121cef+'%');}}}}_0x23b089[_0x0a9e('0x3e')](_0x10b040);_0x23b089[_0x0a9e('0x6b')](_0x0a9e('0x6c'));var _0x26d7db={'type':db['Sequelize'][_0x0a9e('0x6d')]['SELECT'],'raw':!![]};var _0xca4ade=_0x23b089[_0x0a9e('0x6e')]()[_0x0a9e('0x40')]('c.id');if(_0x2ec755[_0x0a9e('0x3c')]){_0x2ec755[_0x0a9e('0x3c')][_0x0a9e('0x53')](function(_0x32e134){_0x23b089['order']('c.'+_0x32e134[0x0],_0x32e134[0x1]===_0x0a9e('0x6f')?![]:!![]);});}if(!_[_0x0a9e('0x5f')](_0x432fcc)){_0x23b089['having'](_0x25c6e6);_0xca4ade[_0x0a9e('0x3e')](_0x0a9e('0x70'),_0x432fcc);}BPromise[_0x0a9e('0x71')]()[_0x0a9e('0x23')](function(){if(!_0x35ed4a)return;if(_0x468813[_0x0a9e('0x72')]['role']!==_0x0a9e('0x73'))return;if(!_[_0x0a9e('0x74')](_0x35ed4a[_0x0a9e('0x4f')],['field',_0x0a9e('0x56')])){return _0x468813['user']['getLists']({'attributes':['id'],'raw':!![]})[_0x0a9e('0x23')](function(_0x4556c5){if(_[_0x0a9e('0x5f')](_0x4556c5)){_0xca4ade[_0x0a9e('0x3e')](_0x0a9e('0x75'));_0x23b089[_0x0a9e('0x3e')](_0x0a9e('0x75'));}else{_0xca4ade[_0x0a9e('0x3e')](_0x0a9e('0x76'),_[_0x0a9e('0x52')](_0x4556c5,'id'));_0x23b089[_0x0a9e('0x3e')](_0x0a9e('0x76'),_[_0x0a9e('0x52')](_0x4556c5,'id'));}});}})[_0x0a9e('0x23')](function(){if(_0x468813[_0x0a9e('0x72')][_0x0a9e('0x77')]===_0x0a9e('0x73')&&!_0x35ed4a&&!_0x468813[_0x0a9e('0x35')]['ListId'])return[];return db[_0x0a9e('0x78')][_0x0a9e('0x35')](_0xca4ade[_0x0a9e('0x79')](),_0x26d7db);})['then'](function(_0x1148a1){_0x15b200[_0x0a9e('0x1e')]=_0x1148a1['length'];if(_0x15b200[_0x0a9e('0x1e')]===0x0)return[];return db[_0x0a9e('0x78')][_0x0a9e('0x35')](_0x5b4f5e[_0x0a9e('0x79')](),_0x26d7db)[_0x0a9e('0x23')](function(_0x4a43a8){_0x1459bb=_['keyBy'](_0x4a43a8,'id');_0x26d7db=_['merge'](_0x26d7db,{'model':db[_0x0a9e('0x29')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x468813[_0x0a9e('0x35')][_0x0a9e('0x38')]){_0x2ec755[_0x0a9e('0x39')][_0x0a9e('0x53')](function(_0x380ab3){_0x23b089[_0x0a9e('0x40')]('c.'+_0x380ab3);});}else{_0x23b089[_0x0a9e('0x40')]('c.id');_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7a'));_0x23b089[_0x0a9e('0x40')]('c.lastName');_0x23b089[_0x0a9e('0x40')]('c.phone');_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7b'));_0x23b089['field'](_0x0a9e('0x7c'));_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7d'));_0x23b089[_0x0a9e('0x40')]('c.ListId');_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7e'));_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7f'));_0x23b089['field'](_0x0a9e('0x80'));_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x81'),_0x0a9e('0x82'));}if(_0x2ec755['limit'])_0x23b089[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x1d')]);if(_0x2ec755[_0x0a9e('0x1b')])_0x23b089[_0x0a9e('0x1b')](_0x2ec755[_0x0a9e('0x1b')]);return db[_0x0a9e('0x78')][_0x0a9e('0x35')](_0x23b089[_0x0a9e('0x79')](),_0x26d7db);});})[_0x0a9e('0x23')](function(_0x336dc3){_0x336dc3[_0x0a9e('0x53')](function(_0x1f10ef){if(_0x1f10ef[_0x0a9e('0x82')]){_0x1f10ef[_0x0a9e('0x83')]=[];_0x1f10ef['TagIds'][_0x0a9e('0x84')](',')[_0x0a9e('0x53')](function(_0xc599b3){_0x1f10ef['Tags'][_0x0a9e('0x2e')](_0x1459bb[_0xc599b3]);});}delete _0x1f10ef[_0x0a9e('0x82')];});_0x15b200[_0x0a9e('0x85')]=_0x336dc3;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755));})['catch'](handleError(_0x2b1f27,null));};exports['destroy']=function(_0x7ebea8,_0x2bbdb5){return db['CmContact'][_0x0a9e('0x86')]({'where':{'id':_0x7ebea8['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x23')](removeEntity(_0x2bbdb5,null))['catch'](handleError(_0x2bbdb5,null));};exports[_0x0a9e('0x2a')]=function(_0x41cf12,_0x2d2286){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x23')](function(_0x444f1f){delete _0x444f1f['tags'];for(var _0x2973d3=0x0;_0x2973d30x0){return new Promise(function(_0x4a70ce,_0x55f91a){var _0x183244=[];for(var _0x1f78b4=0x0;_0x1f78b4<_0x5c4be0[_0x0a9e('0x2c')];_0x1f78b4++){_0x183244['push'](insertAdditionalPhones(_0x5c4be0[_0x1f78b4][_0x0a9e('0xb6')],_0x5c4be0[_0x1f78b4][_0x0a9e('0xaf')]));}Promise[_0x0a9e('0x32')](_0x183244)[_0x0a9e('0x23')](function(){_0x4a70ce(0x1);});})[_0x0a9e('0x23')](function(){return{'success':_0x5b93dd,'failure':_0x556443,'duplicates':_0x6eaaf0};});}else{return{'success':_0x5b93dd,'failure':_0x556443,'duplicates':_0x6eaaf0};}}})[_0x0a9e('0x23')](respondWithResult(_0x98c62c,0xc9))[_0x0a9e('0x8b')](handleError(_0x98c62c,null));};exports[_0x0a9e('0xb7')]=function(_0x3b5bda,_0x5a1848,_0x43c397){var _0x5526a7;return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x23')](function(_0x3cf222){return db[_0x0a9e('0x29')][_0x0a9e('0x86')]({'where':{'id':_0x3b5bda['params']['id']},'include':[{'model':db[_0x0a9e('0x50')],'as':_0x0a9e('0x83'),'attributes':['id',_0x0a9e('0x27'),_0x0a9e('0x41')],'required':_0x3b5bda['query'][_0x0a9e('0x64')]?!![]:![]},{'model':db[_0x0a9e('0xa3')],'as':_0x0a9e('0xb8'),'where':{'CmContactId':_0x3b5bda[_0x0a9e('0xb9')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0xba')],'as':_0x0a9e('0xbb')}]}],'order':[db[_0x0a9e('0x78')][_0x0a9e('0xbc')](_0x0a9e('0xbd'))],'logging':console[_0x0a9e('0xbe')],'attributes':_['keys'](_0x3cf222)});})[_0x0a9e('0x23')](function(_0x88b25f){_0x5526a7=_0x88b25f[_0x0a9e('0x8e')]({'plain':!![]});var _0x26b826={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x88b25f&&_0x88b25f[_0x0a9e('0x60')]){if(_0x88b25f[_0x0a9e('0x60')]){_0x26b826[_0x0a9e('0x3e')][_0x0a9e('0xbf')]['push']({'ListId':{'$ne':_0x88b25f[_0x0a9e('0x60')]}});}}return db[_0x0a9e('0x2f')][_0x0a9e('0x8d')](_0x26b826);})['then'](function(_0x1402c7){return _[_0x0a9e('0xc0')](_0x5526a7,_[_0x0a9e('0x52')](_0x1402c7,function(_0x97d5b5){return util[_0x0a9e('0xc1')](_0x0a9e('0xc2'),_0x97d5b5['id']);}));})[_0x0a9e('0x23')](handleEntityNotFound(_0x5a1848,null))[_0x0a9e('0x23')](respondWithResult(_0x5a1848,null))[_0x0a9e('0x8b')](handleError(_0x5a1848,null));};exports[_0x0a9e('0x22')]=function(_0x5a7dad,_0x251753){var _0x446e6;if(_0x5a7dad[_0x0a9e('0x8c')]['id']){delete _0x5a7dad[_0x0a9e('0x8c')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x86')]({'where':{'id':_0x5a7dad['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x251753,null))['then'](saveUpdates(_0x5a7dad['body'],null))['then'](function(_0x19e4e6){_0x446e6=_0x19e4e6;var _0x3fa3f2={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x19e4e6&&_0x19e4e6[_0x0a9e('0x60')]){if(_0x19e4e6[_0x0a9e('0x60')]){_0x3fa3f2['where'][_0x0a9e('0xbf')][_0x0a9e('0x2e')]({'ListId':{'$ne':_0x19e4e6[_0x0a9e('0x60')]}});}}return db[_0x0a9e('0x2f')][_0x0a9e('0x8d')](_0x3fa3f2);})['then'](function(_0x57b1b1){if(_0x57b1b1){return _[_0x0a9e('0xc0')](_[_0x0a9e('0xc3')](_0x5a7dad[_0x0a9e('0x8c')],function(_0x5e85d0,_0x319752){return _[_0x0a9e('0x87')](_0x319752,_0x0a9e('0x2d'));}),_['map'](_0x57b1b1,function(_0x8ad1c0){return util[_0x0a9e('0xc1')](_0x0a9e('0xc2'),_0x8ad1c0['id']);}));}})['then'](function(_0x272291){if(_0x272291&&!_[_0x0a9e('0x5f')](_0x272291)){var _0x3b7213=squel['update']()['table']('cm_contacts')[_0x0a9e('0xc4')](_0x272291)[_0x0a9e('0x3e')](_0x0a9e('0xc5'),_0x5a7dad[_0x0a9e('0xb9')]['id'])['toParam']();return db[_0x0a9e('0x78')]['query'](_0x3b7213[_0x0a9e('0x5b')],{'replacements':_0x3b7213[_0x0a9e('0xc6')]});}})[_0x0a9e('0x23')](function(){if(_0x5a7dad['body'][_0x0a9e('0xc7')]&&_0x446e6){return db[_0x0a9e('0x94')][_0x0a9e('0x22')]({'phone':_0x5a7dad['body'][_0x0a9e('0xc7')]},{'where':{'ContactId':_0x446e6['id']}});}})['then'](function(){return _0x446e6;})[_0x0a9e('0x23')](respondWithResult(_0x251753,null))['catch'](handleError(_0x251753,null));};exports[_0x0a9e('0xc8')]=function(_0x57b7d4,_0xb14971,_0x37215d){var _0xa288e4={};var _0x10ace8={};var _0x1e306c;var _0x251dd9;return db[_0x0a9e('0x29')]['findOne']({'where':{'id':_0x57b7d4[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0xb14971,null))['then'](function(_0xf4fb77){if(_0xf4fb77){_0x1e306c=_0xf4fb77;_0x10ace8[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x50')][_0x0a9e('0xc9')]);_0x10ace8[_0x0a9e('0x35')]=_['keys'](_0x57b7d4[_0x0a9e('0x35')]);_0x10ace8[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x10ace8[_0x0a9e('0x34')],_0x10ace8[_0x0a9e('0x35')]);_0xa288e4[_0x0a9e('0x39')]=_[_0x0a9e('0x37')](_0x10ace8[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0x57b7d4[_0x0a9e('0x35')]['fields']));_0xa288e4[_0x0a9e('0x39')]=_0xa288e4['attributes'][_0x0a9e('0x2c')]?_0xa288e4[_0x0a9e('0x39')]:_0x10ace8[_0x0a9e('0x34')];_0xa288e4[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x57b7d4[_0x0a9e('0x35')]['sort']);_0xa288e4[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x57b7d4['query'],_0x10ace8[_0x0a9e('0x36')]));if(_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x5d')]){_0xa288e4[_0x0a9e('0x3e')]=_[_0x0a9e('0xcb')](_0xa288e4[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0xa288e4['attributes'],function(_0x4e1b3){var _0x228c10={};_0x228c10[_0x4e1b3]={'$like':'%'+_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0x228c10;})});}_0xa288e4=_[_0x0a9e('0xcb')]({},_0xa288e4,_0x57b7d4[_0x0a9e('0xcc')]);return _0x1e306c[_0x0a9e('0xc8')](_0xa288e4);}})['then'](function(_0x5c8720){if(_0x5c8720){_0x251dd9=_0x5c8720[_0x0a9e('0x2c')];if(!_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0xa288e4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x57b7d4[_0x0a9e('0x35')]['limit']);_0xa288e4[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}return _0x1e306c[_0x0a9e('0xc8')](_0xa288e4);}})[_0x0a9e('0x23')](function(_0x16be7e){if(_0x16be7e){return _0x16be7e?{'count':_0x251dd9,'rows':_0x16be7e}:null;}})['then'](respondWithResult(_0xb14971,null))[_0x0a9e('0x8b')](handleError(_0xb14971,null));};exports[_0x0a9e('0xcd')]=function(_0x231826,_0x5885c3,_0x2b8ad4){if(_0x231826[_0x0a9e('0x8c')]['id']){delete _0x231826[_0x0a9e('0x8c')]['id'];}return db[_0x0a9e('0x29')]['findOne']({'where':{'id':_0x231826[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5885c3,null))[_0x0a9e('0x23')](function(_0x93d953){if(_0x93d953){return _0x93d953[_0x0a9e('0xcd')](_0x231826[_0x0a9e('0x8c')][_0x0a9e('0xce')]||[]);}return null;})[_0x0a9e('0x23')](respondWithResult(_0x5885c3,null))['catch'](handleError(_0x5885c3,null));};exports[_0x0a9e('0xcf')]=function(_0x266aa1,_0x25e41f){var _0x397771=[];_0x397771['push'](addAdditionalPhones(_0x266aa1['body']));Promise[_0x0a9e('0x32')](_0x397771)[_0x0a9e('0x23')](function(){_0x397771=[];_0x397771[_0x0a9e('0x2e')](deleteCmHopperPhones(_0x266aa1['body']['id']));_0x397771[_0x0a9e('0x2e')](addCmHopperPhones(_0x266aa1[_0x0a9e('0x8c')]['id']));Promise['all'](_0x397771)[_0x0a9e('0x23')](function(){return[0x1];})['then'](respondWithResult(_0x25e41f,null));});};function addAdditionalPhones(_0x35cc2a){return new Promise(function(_0x54dbbf,_0x5b42b9){return db['CmContactHasItem'][_0x0a9e('0x24')]({'where':{'CmContactId':_0x35cc2a['id']}})[_0x0a9e('0x23')](function(){var _0x19f800=[];for(var _0x20007e=0x0;_0x20007e<_0x35cc2a[_0x0a9e('0xd0')][_0x0a9e('0x2c')];_0x20007e++){_0x19f800['push'](addAdditionalPhone(_0x35cc2a['id'],_0x35cc2a[_0x0a9e('0xd0')][_0x20007e][_0x0a9e('0xc7')],_0x35cc2a[_0x0a9e('0xd1')]?_[_0x0a9e('0xd2')](_0x35cc2a[_0x0a9e('0xd1')][_0x20007e])?null:_0x35cc2a[_0x0a9e('0xd1')][_0x20007e]:_0x35cc2a[_0x0a9e('0xd0')][_0x20007e]['ItemTypeId']?_0x35cc2a['items'][_0x20007e][_0x0a9e('0xd3')]:null,_0x20007e,_0x35cc2a['items'][_0x20007e][_0x0a9e('0xd4')]));}Promise[_0x0a9e('0x32')](_0x19f800)[_0x0a9e('0x23')](function(){_0x54dbbf(0x1);});});});}function addAdditionalPhone(_0xa3695f,_0x37a448,_0x383dd8,_0x594f25,_0x4716d1){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0xa3695f,'item':_0x37a448}})[_0x0a9e('0x23')](function(_0x593f9e){if(_0x593f9e)logger[_0x0a9e('0x92')]('contact\x20phone\x20exists',_0x593f9e);else{db['CmContactHasItem'][_0x0a9e('0x98')]({'CmContactId':_0xa3695f,'item':_0x37a448,'ItemTypeId':_0x383dd8,'OrderBy':_0x594f25,'ItemClass':'PHONE','description':_0x4716d1});}});}function deletePhones(_0x24470a){return db[_0x0a9e('0xa3')][_0x0a9e('0x24')]({'where':{'CmContactId':_0x24470a}});}function deleteCmHopperPhones(_0x48f532){return new Promise(function(_0x4152cd,_0x1209c4){return db[_0x0a9e('0x94')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x48f532}})['then'](function(_0xdc77d){db[_0x0a9e('0xd5')][_0x0a9e('0x24')]({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x52')](_0xdc77d,'id')}}});})[_0x0a9e('0x23')](function(){_0x4152cd(0x1);});});}function addCmHopperPhones(_0x376b97){return new Promise(function(_0x247a6c,_0x170b3d){return db[_0x0a9e('0x94')][_0x0a9e('0x8d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x376b97}})['then'](function(_0x51fa33){var _0x558171=[];_[_0x0a9e('0x52')](_0x51fa33,function(_0x19dcc2){_0x558171[_0x0a9e('0x2e')](createCmHopperPhone(_0x376b97,_0x19dcc2['id']));});Promise[_0x0a9e('0x32')](_0x558171)[_0x0a9e('0x23')](function(){_0x247a6c(0x1);});});});}function createCmHopperPhone(_0x2dc202,_0x2b97fc){return new Promise(function(_0x307d13,_0x5d74e9){db['CmContactHasItem'][_0x0a9e('0x8d')]({'raw':!![],'attributes':[_0x0a9e('0xd6')],'where':{'CmContactId':_0x2dc202,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0xba')],'attributes':[_0x0a9e('0xd7')],'as':_0x0a9e('0xbb')}],'order':[db[_0x0a9e('0x78')][_0x0a9e('0xbc')](_0x0a9e('0xd8'))]})[_0x0a9e('0x23')](function(_0x262281){var _0x59f8f7=0x1;var _0x400800=_[_0x0a9e('0x52')](_0x262281,function(_0x20e191){_0x20e191['CmHopperId']=_0x2b97fc;_0x20e191[_0x0a9e('0xc7')]=_0x20e191[_0x0a9e('0xd6')];_0x20e191[_0x0a9e('0xd7')]=_0x20e191[_0x0a9e('0xd9')]||_0x59f8f7;delete _0x20e191[_0x0a9e('0xd9')];_0x59f8f7=_0x59f8f7+0x1;return _0x20e191;});return db[_0x0a9e('0xd5')][_0x0a9e('0xb0')](_0x400800,{});})[_0x0a9e('0x23')](function(){_0x307d13(0x1);});});}function insertAdditionalPhones(_0x3a9c0f,_0x3f1959){return new Promise(function(_0x6b048e,_0x3ba472){var _0x4e6eb9=[];for(var _0x572a72=0x0;_0x572a72<_0x3f1959[_0x0a9e('0x2c')];_0x572a72++){var _0x401207=_0x3f1959[_0x572a72];_0x4e6eb9[_0x0a9e('0x2e')](parseContactItemType(_0x401207));}Promise[_0x0a9e('0x32')](_0x4e6eb9)[_0x0a9e('0x23')](function(){var _0x1e29e2={'id':_0x3a9c0f['id'],'items':_0x3f1959};return addAdditionalPhones(_0x1e29e2)[_0x0a9e('0x23')](function(_0x4f7907){return addCmHopperPhones(_0x3a9c0f['id']);});})[_0x0a9e('0x23')](function(){_0x6b048e(_0x3a9c0f);});});}function parseContactItemType(_0x49fd0e){return new Promise(function(_0x26aa44,_0x1ad1d7){if(_0x49fd0e[_0x0a9e('0x3a')](_0x0a9e('0xd3'))){_0x26aa44(_0x49fd0e);}else{return db[_0x0a9e('0xba')][_0x0a9e('0x86')]({'where':{'name':_0x49fd0e[_0x0a9e('0xbb')]}})[_0x0a9e('0x23')](function(_0xa7a754){if(_[_0x0a9e('0xd2')](_0xa7a754))_0x49fd0e[_0x0a9e('0xd3')]=null;else _0x49fd0e[_0x0a9e('0xd3')]=_0xa7a754['id'];_0x26aa44(_0x49fd0e);});}});}exports[_0x0a9e('0xda')]=function(_0x3f7cb6,_0x3c8a9a){return db[_0x0a9e('0xa3')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3f7cb6['params']['id'],'ItemClass':_0x0a9e('0xdb')},'include':[{'model':db[_0x0a9e('0xba')],'as':'ItemType'}],'order':[[db['sequelize'][_0x0a9e('0xbc')](_0x0a9e('0xd8'))],[_0x0a9e('0xd7')]]})['then'](function(_0x268eae){return _0x268eae;})['then'](respondWithResult(_0x3c8a9a,null))[_0x0a9e('0x8b')](handleError(_0x3c8a9a,null));};exports['duplicateAdditionalPhones']=function(_0x22d31f,_0x5e9c92){return db[_0x0a9e('0xa3')][_0x0a9e('0x8d')]({'raw':!![],'where':{'CmContactId':_0x22d31f[_0x0a9e('0x8c')]['fromContactId']}})[_0x0a9e('0x23')](function(_0x497fda){var _0x505ffd=_[_0x0a9e('0x52')](_0x497fda,function(_0x23993f){_0x23993f[_0x0a9e('0xdc')]=_0x22d31f[_0x0a9e('0x8c')][_0x0a9e('0xdd')];return _0x23993f;});return db[_0x0a9e('0xa3')][_0x0a9e('0xb0')](_0x505ffd,{});})[_0x0a9e('0x23')](function(_0x1a3143){return addCmHopperPhones(_0x22d31f[_0x0a9e('0x8c')][_0x0a9e('0xdd')]);})[_0x0a9e('0x23')](function(_0x26361f){return['ok'];})[_0x0a9e('0x23')](respondWithResult(_0x5e9c92,null))[_0x0a9e('0x8b')](handleError(_0x5e9c92,null));};exports[_0x0a9e('0xde')]=function(_0x310026,_0x643f66){var _0x153de1=[];_0x153de1['push'](createCmHopperPhone(_0x310026[_0x0a9e('0x8c')]['id'],_0x310026[_0x0a9e('0x8c')][_0x0a9e('0xdf')]));Promise[_0x0a9e('0x32')](_0x153de1)['then'](function(){return[0x1];})['then'](respondWithResult(_0x643f66,null));};exports['getHoppers']=function(_0x2b8823,_0x55926d,_0xea26ca){var _0x1fafc2={'raw':![],'where':{}};var _0x130ae8={};var _0x43fe24={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x30')]({'where':{'id':_0x2b8823[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x55926d,null))[_0x0a9e('0x23')](function(_0x6b948a){if(_0x6b948a){_0x130ae8['model']=_[_0x0a9e('0x2b')](db['CmHopper'][_0x0a9e('0xc9')]);_0x130ae8['query']=_[_0x0a9e('0x2b')](_0x2b8823[_0x0a9e('0x35')]);_0x130ae8[_0x0a9e('0x36')]=_['intersection'](_0x130ae8[_0x0a9e('0x34')],_0x130ae8[_0x0a9e('0x35')]);_0x1fafc2['attributes']=_['intersection'](_0x130ae8[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0x2b8823[_0x0a9e('0x35')]['fields']));_0x1fafc2['attributes']=_0x1fafc2['attributes'][_0x0a9e('0x2c')]?_0x1fafc2[_0x0a9e('0x39')]:_0x130ae8[_0x0a9e('0x34')];if(!_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x1fafc2[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0x1fafc2[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}_0x1fafc2[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x1fafc2['where']=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x2b8823[_0x0a9e('0x35')],_0x130ae8[_0x0a9e('0x36')]));_0x1fafc2[_0x0a9e('0x3e')][_0x0a9e('0xe0')]=_0x6b948a['id'];if(_0x2b8823['query'][_0x0a9e('0x5d')]){_0x1fafc2[_0x0a9e('0x3e')]=_[_0x0a9e('0xcb')](_0x1fafc2[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0x1fafc2[_0x0a9e('0x39')],function(_0x103ad9){var _0x7c4ce2={};_0x7c4ce2[_0x103ad9]={'$like':'%'+_0x2b8823[_0x0a9e('0x35')]['filter']+'%'};return _0x7c4ce2;})});}_0x1fafc2=_['merge']({},_0x1fafc2,_0x2b8823[_0x0a9e('0xcc')]);return db[_0x0a9e('0x94')]['count']({'where':_0x1fafc2[_0x0a9e('0x3e')]})[_0x0a9e('0x23')](function(_0x4c8d75){_0x43fe24[_0x0a9e('0x1e')]=_0x4c8d75;if(_0x2b8823['query'][_0x0a9e('0xe1')]){_0x1fafc2[_0x0a9e('0xe2')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x8d')](_0x1fafc2);})[_0x0a9e('0x23')](function(_0x5952c8){_0x43fe24[_0x0a9e('0x85')]=_0x5952c8;return _0x43fe24;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x55926d,_0x1fafc2))['catch'](handleError(_0x55926d,null));};exports[_0x0a9e('0xe3')]=function(_0x237994,_0x28a078,_0x24361){var _0x8f68ec={'raw':!![],'where':{}};var _0x17a0d5={};var _0x5d525f={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x30')]({'where':{'id':_0x237994['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x28a078,null))[_0x0a9e('0x23')](function(_0x22c390){if(_0x22c390){_0x17a0d5[_0x0a9e('0x34')]=_[_0x0a9e('0x2b')](db[_0x0a9e('0xa5')][_0x0a9e('0xc9')]);_0x17a0d5['query']=_['keys'](_0x237994['query']);_0x17a0d5['filters']=_['intersection'](_0x17a0d5[_0x0a9e('0x34')],_0x17a0d5[_0x0a9e('0x35')]);_0x8f68ec['attributes']=_['intersection'](_0x17a0d5[_0x0a9e('0x34')],qs['fields'](_0x237994[_0x0a9e('0x35')][_0x0a9e('0x38')]));_0x8f68ec[_0x0a9e('0x39')]=_0x8f68ec[_0x0a9e('0x39')][_0x0a9e('0x2c')]?_0x8f68ec[_0x0a9e('0x39')]:_0x17a0d5['model'];if(!_0x237994[_0x0a9e('0x35')][_0x0a9e('0x3a')]('nolimit')){_0x8f68ec[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x237994[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0x8f68ec[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x237994[_0x0a9e('0x35')]['offset']);}_0x8f68ec[_0x0a9e('0x3c')]=qs['sort'](_0x237994[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x8f68ec['where']=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x237994['query'],_0x17a0d5[_0x0a9e('0x36')]));_0x8f68ec['where'][_0x0a9e('0xe0')]=_0x22c390['id'];if(_0x237994[_0x0a9e('0x35')]['filter']){_0x8f68ec[_0x0a9e('0x3e')]=_['merge'](_0x8f68ec[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0x8f68ec[_0x0a9e('0x39')],function(_0x37ef45){var _0x288127={};_0x288127[_0x37ef45]={'$like':'%'+_0x237994[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0x288127;})});}_0x8f68ec=_['merge']({},_0x8f68ec,_0x237994[_0x0a9e('0xcc')]);return db[_0x0a9e('0xa5')][_0x0a9e('0x1e')]({'where':_0x8f68ec[_0x0a9e('0x3e')]})[_0x0a9e('0x23')](function(_0x5932ad){_0x5d525f[_0x0a9e('0x1e')]=_0x5932ad;if(_0x237994['query']['includeAll']){_0x8f68ec[_0x0a9e('0xe2')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x8d')](_0x8f68ec);})[_0x0a9e('0x23')](function(_0x58d5fd){_0x5d525f[_0x0a9e('0x85')]=_0x58d5fd;return _0x5d525f;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x28a078,_0x8f68ec))[_0x0a9e('0x8b')](handleError(_0x28a078,null));};exports[_0x0a9e('0xe4')]=function(_0x2e1adc,_0x25eb44,_0x3d2bb0){var _0xb8c15={'raw':!![],'where':{}};var _0x3d02ae={};var _0x5871d7={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x30')]({'where':{'id':_0x2e1adc[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x25eb44,null))['then'](function(_0x38d95a){if(_0x38d95a){_0x3d02ae[_0x0a9e('0x34')]=_[_0x0a9e('0x2b')](db['CmHopperFinal'][_0x0a9e('0xc9')]);_0x3d02ae[_0x0a9e('0x35')]=_[_0x0a9e('0x2b')](_0x2e1adc['query']);_0x3d02ae[_0x0a9e('0x36')]=_['intersection'](_0x3d02ae[_0x0a9e('0x34')],_0x3d02ae[_0x0a9e('0x35')]);_0xb8c15[_0x0a9e('0x39')]=_[_0x0a9e('0x37')](_0x3d02ae[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0x2e1adc[_0x0a9e('0x35')]['fields']));_0xb8c15[_0x0a9e('0x39')]=_0xb8c15[_0x0a9e('0x39')][_0x0a9e('0x2c')]?_0xb8c15[_0x0a9e('0x39')]:_0x3d02ae[_0x0a9e('0x34')];if(!_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0xb8c15[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0xb8c15[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}_0xb8c15[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0xb8c15[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x2e1adc['query'],_0x3d02ae[_0x0a9e('0x36')]));_0xb8c15[_0x0a9e('0x3e')][_0x0a9e('0xe0')]=_0x38d95a['id'];if(_0x2e1adc['query'][_0x0a9e('0x5d')]){_0xb8c15['where']=_[_0x0a9e('0xcb')](_0xb8c15[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0xb8c15[_0x0a9e('0x39')],function(_0x455bca){var _0xb09ef6={};_0xb09ef6[_0x455bca]={'$like':'%'+_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0xb09ef6;})});}_0xb8c15=_['merge']({},_0xb8c15,_0x2e1adc[_0x0a9e('0xcc')]);return db[_0x0a9e('0xa4')]['count']({'where':_0xb8c15[_0x0a9e('0x3e')]})[_0x0a9e('0x23')](function(_0x579bb0){_0x5871d7['count']=_0x579bb0;if(_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0xe1')]){_0xb8c15[_0x0a9e('0xe2')]=[{'all':!![]}];}return db[_0x0a9e('0xa4')]['findAll'](_0xb8c15);})[_0x0a9e('0x23')](function(_0x31648e){_0x5871d7[_0x0a9e('0x85')]=_0x31648e;return _0x5871d7;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x25eb44,_0xb8c15))[_0x0a9e('0x8b')](handleError(_0x25eb44,null));};exports['getJscriptySessions']=function(_0xa3ba12,_0x3fc431,_0x4df303){var _0x34112c={'raw':!![],'where':{}};var _0x2d20a0={};var _0x38284a={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0xa3ba12[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x3fc431,null))[_0x0a9e('0x23')](function(_0x283bbb){if(_0x283bbb){_0x2d20a0[_0x0a9e('0x34')]=_[_0x0a9e('0x2b')](db[_0x0a9e('0xab')][_0x0a9e('0xc9')]);_0x2d20a0['query']=_['keys'](_0xa3ba12[_0x0a9e('0x35')]);_0x2d20a0['filters']=_[_0x0a9e('0x37')](_0x2d20a0[_0x0a9e('0x34')],_0x2d20a0[_0x0a9e('0x35')]);_0x34112c[_0x0a9e('0x39')]=_['intersection'](_0x2d20a0[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0xa3ba12['query'][_0x0a9e('0x38')]));_0x34112c['attributes']=_0x34112c[_0x0a9e('0x39')][_0x0a9e('0x2c')]?_0x34112c[_0x0a9e('0x39')]:_0x2d20a0[_0x0a9e('0x34')];if(!_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x3a')]('nolimit')){_0x34112c[_0x0a9e('0x1d')]=qs['limit'](_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0x34112c[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}_0x34112c[_0x0a9e('0x3c')]=qs['sort'](_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x34112c[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0xa3ba12['query'],_0x2d20a0[_0x0a9e('0x36')]));_0x34112c[_0x0a9e('0x3e')]['ContactId']=_0x283bbb['id'];if(_0xa3ba12['query'][_0x0a9e('0x5d')]){_0x34112c[_0x0a9e('0x3e')]=_[_0x0a9e('0xcb')](_0x34112c[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0x34112c[_0x0a9e('0x39')],function(_0x4d35ed){var _0x1e31c2={};_0x1e31c2[_0x4d35ed]={'$like':'%'+_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0x1e31c2;})});}_0x34112c=_['merge']({},_0x34112c,_0xa3ba12[_0x0a9e('0xcc')]);return db[_0x0a9e('0xab')][_0x0a9e('0x1e')]({'where':_0x34112c[_0x0a9e('0x3e')]})['then'](function(_0x5d4935){_0x38284a[_0x0a9e('0x1e')]=_0x5d4935;if(_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0xe1')]){_0x34112c[_0x0a9e('0xe2')]=[{'all':!![]}];}return db[_0x0a9e('0xab')][_0x0a9e('0x8d')](_0x34112c);})[_0x0a9e('0x23')](function(_0x23dd12){_0x38284a['rows']=_0x23dd12;return _0x38284a;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x3fc431,_0x34112c))['catch'](handleError(_0x3fc431,null));};exports[_0x0a9e('0xe5')]=function(_0x20dcfd,_0x3fd399,_0x4984b1){try{if(!_0x20dcfd['body'][_0x0a9e('0x60')]){throw new Error('No\x20ListId\x20specified');}if(!_0x20dcfd[_0x0a9e('0x8c')]['binding_keys']){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe6')]){throw new Error(_0x0a9e('0xe7'));}if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe8')]){throw new Error(_0x0a9e('0xe9'));}var _0x2f64ef=_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xea')][_0x0a9e('0x84')](',');var _0x81f495=_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe6')]['split'](',');if(!_0x2f64ef['length']||!_0x81f495[_0x0a9e('0x2c')]||_0x2f64ef['length']!==_0x81f495[_0x0a9e('0x2c')]){throw new Error(_0x0a9e('0xeb'));}_0x20dcfd[_0x0a9e('0x8c')]['fields']=_['zipObject'](_0x2f64ef,_0x81f495);if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0x38')][_0x0a9e('0xc7')]){throw new Error(_0x0a9e('0xec'));}if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0x38')][_0x0a9e('0xed')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x12984a=path['join'](config[_0x0a9e('0xee')],_0x0a9e('0xef'),_0x20dcfd['file'][_0x0a9e('0xf0')]);fs[_0x0a9e('0xf1')](_0x12984a,parseInt(_0x0a9e('0xf2'),0x8));var _0x4524b8=require(_0x0a9e('0xf3'))[_0x0a9e('0xf4')](path['join'](__dirname,_0x0a9e('0xf5')),[_0x12984a,_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xea')],_0x20dcfd['body'][_0x0a9e('0xe6')],_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0x60')],_0x20dcfd['body'][_0x0a9e('0xf6')],_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xb2')],_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe8')]]);return _0x3fd399[_0x0a9e('0x1a')](0xc8)['json']({'message':'File\x20uploaded\x20correctly!','pid':_0x4524b8[_0x0a9e('0xf7')]});}catch(_0x1e01af){return _0x3fd399['status'](0x1f4)[_0x0a9e('0xf8')](_0x1e01af);}};exports[_0x0a9e('0xf9')]=function(_0x315735,_0x35dadd,_0x2e413d){var _0x4e3983=fs['createReadStream'](_0x315735[_0x0a9e('0xfa')][_0x0a9e('0x6')]);Papa[_0x0a9e('0xfb')](_0x4e3983,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x4edb79){return _0x35dadd[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0xfc')]({'file':_0x315735[_0x0a9e('0xfa')],'fields':_0x4edb79[_0x0a9e('0xfd')]['fields']});}});};exports['import']=function(_0x46b143,_0x14b098,_0x16b4ae){return db['User'][_0x0a9e('0x8d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0x73')}})[_0x0a9e('0x23')](function(_0x1fc545){var _0x45616c=![];if(!_0x46b143[_0x0a9e('0x8c')][_0x0a9e('0x60')]){throw new Error(_0x0a9e('0xfe'));}if(!_0x46b143['body']['binding'][_0x0a9e('0xc7')]){throw new Error(_0x0a9e('0xec'));}if(!_0x46b143['body'][_0x0a9e('0xff')]['firstName']){throw new Error(_0x0a9e('0x100'));}if(!_0x46b143[_0x0a9e('0x8c')]['socket_timestamp']){throw new Error(_0x0a9e('0xe9'));}var _0xd6570f=require('child_process')[_0x0a9e('0xf4')](path[_0x0a9e('0x91')](__dirname,_0x0a9e('0x101')),[_0x46b143[_0x0a9e('0xb9')]['id'],JSON[_0x0a9e('0x102')](_0x46b143[_0x0a9e('0x8c')]),JSON[_0x0a9e('0x102')](_0x1fc545)]);_0xd6570f['on']('message',function(_0x1da68c){_0x45616c=!![];return _0x14b098[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0xfc')]({'message':_0x0a9e('0x103'),'pid':_0xd6570f[_0x0a9e('0xf7')]});});_0xd6570f['on'](_0x0a9e('0x104'),function(_0x456884){if(_0x456884&&!_0x45616c){return _0x14b098['status'](0x1f4)['json']({'message':_0x0a9e('0x105'),'pid':_0xd6570f[_0x0a9e('0xf7')]});}});})[_0x0a9e('0x8b')](handleError(_0x14b098,null));};exports['importUpdates']=function(_0x5cf1ba,_0xf7ddca,_0x55075d){return db[_0x0a9e('0x56')][_0x0a9e('0x8d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0x73')}})[_0x0a9e('0x23')](function(_0x20f4cb){var _0x13c6df=![];if(!_0x5cf1ba[_0x0a9e('0x8c')][_0x0a9e('0x60')]){throw new Error(_0x0a9e('0xfe'));}if(!_0x5cf1ba['body']['binding'][_0x0a9e('0xc7')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x5cf1ba[_0x0a9e('0x8c')][_0x0a9e('0xff')][_0x0a9e('0xed')]){throw new Error(_0x0a9e('0x100'));}if(!_0x5cf1ba['body'][_0x0a9e('0xe8')]){throw new Error(_0x0a9e('0xe9'));}var _0x2bc6a3=require('child_process')[_0x0a9e('0xf4')](path[_0x0a9e('0x91')](__dirname,_0x0a9e('0x106')),[_0x5cf1ba['params']['id'],JSON[_0x0a9e('0x102')](_0x5cf1ba[_0x0a9e('0x8c')]),JSON[_0x0a9e('0x102')](_0x20f4cb)]);_0x2bc6a3['on'](_0x0a9e('0x107'),function(_0x69b4d6){_0x13c6df=!![];return _0xf7ddca[_0x0a9e('0x1a')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x2bc6a3[_0x0a9e('0xf7')]});});_0x2bc6a3['on'](_0x0a9e('0x104'),function(_0x10d713){if(_0x10d713&&!_0x13c6df){return _0xf7ddca['status'](0x1f4)['json']({'message':_0x0a9e('0x105'),'pid':_0x2bc6a3[_0x0a9e('0xf7')]});}});})[_0x0a9e('0x8b')](handleError(_0xf7ddca,null));};exports['getJourney']=function(_0x4b51ff,_0x12d1dd){var _0x2c8d95=[_0x0a9e('0x108'),_0x0a9e('0x109'),_0x0a9e('0x10a'),'openchannel',_0x0a9e('0x10b'),'whatsapp',_0x0a9e('0x10c')];var _0x311e40={'offset':0x0,'order':qs[_0x0a9e('0x3d')]('-createdAt')},_0x57e719={'count':0x0,'rows':[]};Promise[_0x0a9e('0x71')]()[_0x0a9e('0x23')](function(){if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x10d')]){if(!_[_0x0a9e('0x10e')](_0x2c8d95,_0x4b51ff['query'][_0x0a9e('0x10d')][_0x0a9e('0x10f')]())){throw new Error(_0x0a9e('0x110'));}_0x2c8d95=[_0x4b51ff['query'][_0x0a9e('0x10d')]['toLowerCase']()];}if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]){try{var _0x2777fe=JSON['parse'](_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]);if(!moment(_0x2777fe[_0x0a9e('0x42')])[_0x0a9e('0x112')]()){throw new Error(_0x0a9e('0x113'));}if(!moment(_0x2777fe['to'])[_0x0a9e('0x112')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x3057c9){throw new Error(_0x0a9e('0x114'));}}if(!_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x311e40[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x4b51ff[_0x0a9e('0x35')]['limit']||0xa);_0x311e40[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}var _0x55a300=_0x2c8d95[_0x0a9e('0x52')](function(_0x57c3c4){if(_0x57c3c4===_0x0a9e('0x10c')){var _0x22ef0f={'attributes':['id',_0x0a9e('0x115'),'type',_0x0a9e('0x116'),_0x0a9e('0x117'),_0x0a9e('0x118'),_0x0a9e('0x119'),'endtime',_0x0a9e('0x11a'),_0x0a9e('0x11b'),_0x0a9e('0x11c'),_0x0a9e('0x11d'),_0x0a9e('0x11e'),_0x0a9e('0x11f'),_0x0a9e('0x120')],'where':{'ContactId':_0x4b51ff['params']['id']},'include':[{'model':db[_0x0a9e('0x56')],'as':_0x0a9e('0x56'),'attributes':['id',_0x0a9e('0x27'),_0x0a9e('0x121'),'alias']}],'order':[[_0x0a9e('0x11c'),'DESC']]};if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]){_0x22ef0f[_0x0a9e('0x3e')][_0x0a9e('0x11c')]={'$gte':_0x2777fe[_0x0a9e('0x42')],'$lte':_0x2777fe['to']};}return db[_0x0a9e('0xa6')][_0x0a9e('0x122')](_0x22ef0f)['then'](function(_0x173f03){_0x57e719['count']+=_0x173f03[_0x0a9e('0x1e')];return _[_0x0a9e('0x52')](_0x173f03['rows'],function(_0x2ebed3){var _0x167f89=_0x2ebed3[_0x0a9e('0x8e')]({'plain':!![]});_0x167f89[_0x0a9e('0x10d')]=_0x57c3c4;if(_0x167f89['User']){_0x167f89[_0x0a9e('0x56')]={'id':_0x167f89[_0x0a9e('0x56')]['id'],'name':_0x167f89['User'][_0x0a9e('0x27')],'fullname':_0x167f89['User']['fullname'],'alias':_0x167f89['User'][_0x0a9e('0x123')]};}return _0x167f89;});});}else{var _0x2ec662=_['startCase'](_0x57c3c4)+(_0x57c3c4===_0x0a9e('0x109')?_0x0a9e('0x124'):'Account');var _0xc48226={'attributes':['id',_0x0a9e('0x125'),_0x0a9e('0x126'),_0x0a9e('0x11c'),_0x0a9e('0x11b'),_0x0a9e('0x127'),_0x0a9e('0x128'),'thirdDisposition',_0x0a9e('0x120'),_0x2ec662+'Id'],'where':{'ContactId':_0x4b51ff['params']['id']},'include':[{'model':db[_0x2ec662],'as':_0x0a9e('0x129'),'attributes':['id',_0x0a9e('0x27'),_0x0a9e('0x12a')]},{'model':db[_0x0a9e('0x56')],'as':_0x0a9e('0x12b'),'attributes':['id',_0x0a9e('0x27'),'fullname']},{'model':db[_0x0a9e('0x50')],'as':_0x0a9e('0x83'),'attributes':['id',_0x0a9e('0x27'),'color'],'through':{'attributes':[]}}],'order':[[_0x0a9e('0x11c'),_0x0a9e('0x6f')]]};if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]){_0xc48226[_0x0a9e('0x3e')][_0x0a9e('0x11c')]={'$gte':_0x2777fe[_0x0a9e('0x42')],'$lte':_0x2777fe['to']};}switch(_0x57c3c4){case _0x0a9e('0x109'):_0xc48226[_0x0a9e('0x39')][_0x0a9e('0x2e')](_0x0a9e('0x12c'),_0x0a9e('0x12d'),_0x0a9e('0x12e'),_0x0a9e('0x12f'),_0x0a9e('0x130'),_0x0a9e('0x131'),'ratingType',_0x0a9e('0x132'),_0x0a9e('0x133'));break;case _0x0a9e('0x108'):_0xc48226['attributes'][_0x0a9e('0x2e')](_0x0a9e('0x134'),_0x0a9e('0x135'));break;case _0x0a9e('0x136'):_0xc48226['attributes'][_0x0a9e('0x2e')](_0x0a9e('0x137'),_0x0a9e('0x138'));break;}return db[_[_0x0a9e('0x139')](_0x57c3c4)+'Interaction'][_0x0a9e('0x122')](_0xc48226)[_0x0a9e('0x23')](function(_0x132455){_0x57e719[_0x0a9e('0x1e')]+=_0x132455['count'];return _['map'](_0x132455[_0x0a9e('0x85')],function(_0x44343f){var _0x2de997=_0x44343f[_0x0a9e('0x8e')]({'plain':!![]});_0x2de997[_0x0a9e('0x10d')]=_0x57c3c4;if(_0x2de997[_0x0a9e('0x12b')]){_0x2de997[_0x0a9e('0x12b')]={'id':_0x2de997[_0x0a9e('0x12b')]['id'],'name':_0x2de997[_0x0a9e('0x12b')][_0x0a9e('0x27')],'fullname':_0x2de997[_0x0a9e('0x12b')][_0x0a9e('0x121')]};}return _0x2de997;});});}});return Promise[_0x0a9e('0x32')](_0x55a300);})[_0x0a9e('0x23')](function(_0x4f5ebd){return _(_0x4f5ebd)[_0x0a9e('0x13a')]()[_0x0a9e('0x13b')](_0x0a9e('0x11c'))['reverse']()['value']();})[_0x0a9e('0x23')](function(_0x51ec16){_0x57e719[_0x0a9e('0x85')]=_0x311e40[_0x0a9e('0x1d')]?_0x51ec16[_0x0a9e('0x13c')](_0x311e40[_0x0a9e('0x1b')],_0x311e40['offset']+_0x311e40['limit']):_0x51ec16;return _0x57e719;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x12d1dd,_0x311e40))[_0x0a9e('0x8b')](handleError(_0x12d1dd,null));}; \ No newline at end of file +var _0xa9e0=['status','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','index','CmContact','describe','keys','length','cf_','push','CmCustomField','findOne','trimStart','all','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','Tag','value','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','castTo','DATE','buildExpression','text','start','filter','Contact','isEmpty','ListId','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','isArray','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.phone\x20LIKE\x20?','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','QueryTypes','clone','DESC','t.id\x20IN\x20?','resolve','user','agent','some','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','role','sequelize','toString','c.firstName','c.mobile','c.fax','c.email','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','split','rows','find','startsWith','displayName','columnName','custom','catch','body','findAll','get','mergeWith','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','additionalPhones','bulkCreate','each','duplicates','$or','findOrCreate','spread','contact','show','Phones','params','ContactItemType','ItemType','literal','`Phones.ItemType`.OrderBy','log','$and','omit','format','cf_%d','pickBy','setFields','id\x20=\x20?','values','phone','getTags','rawAttributes','pick','merge','options','setTags','ids','setAdditionalPhones','items','item_types','isNil','ItemTypeId','description','CmHopperAdditionalPhone','item','OrderBy','`ItemType`.OrderBy','ItemType.OrderBy','getAdditionalPhones','PHONE','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','ContactId','includeAll','include','getHopperHistories','getHopperFinals','uploadCsv','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','pid','send','upload','file','parse','json','meta','No\x20ListId\x20specified','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','../../components/import/cm/csvUpdates','message','mail','chat','sms','fax','voice','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','alias','Website','closed','closedAt','disposition','secondDisposition','Account','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','startCase','flatten','sortBy','slice','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmContact.socket','register'];(function(_0xf99887,_0x2969f7){var _0x1df2a7=function(_0x254c46){while(--_0x254c46){_0xf99887['push'](_0xf99887['shift']());}};_0x1df2a7(++_0x2969f7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=typeof _0x5a0a06[_0x0a9e('0x1b')]===_0x0a9e('0x1c')&&typeof _0x5a0a06[_0x0a9e('0x1d')]===_0x0a9e('0x1c');var _0x530eb7=_0x459eb1[_0x0a9e('0x1e')];var _0x1314ae=_0x478723?0x0:_0x5a0a06[_0x0a9e('0x1b')];var _0x1c696a=_0x478723?_0x459eb1[_0x0a9e('0x1e')]:_0x5a0a06['offset']+_0x5a0a06[_0x0a9e('0x1d')];var _0x155cce;if(_0x1c696a>=_0x530eb7){_0x1c696a=_0x530eb7;_0x155cce=0xc8;}else{_0x155cce=0xce;}_0x225616['status'](_0x155cce);return _0x225616[_0x0a9e('0x1f')]('Content-Range',_0x1314ae+'-'+_0x1c696a+'/'+_0x530eb7)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x3a02e1){return function(_0x432e56){try{jsonpatch[_0x0a9e('0x20')](_0x432e56,_0x3a02e1,!![]);}catch(_0x30bae6){return BPromise['reject'](_0x30bae6);}return _0x432e56[_0x0a9e('0x21')]();};}function saveUpdates(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x22')](_0x2fb0e4)[_0x0a9e('0x23')](function(_0x16b1ca){return _0x16b1ca;});}return null;};}function removeEntity(_0x5ea472,_0x59181e){return function(_0x197ec0){if(_0x197ec0){return _0x197ec0[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){_0x5ea472[_0x0a9e('0x1a')](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('0x25')](_0x25fba9[_0x0a9e('0x26')]);if(_0x25fba9[_0x0a9e('0x27')]){delete _0x25fba9[_0x0a9e('0x27')];}_0x1dc186[_0x0a9e('0x1a')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x28')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x23')](function(_0x58b06f){var _0x563b45=[];for(var _0x296f41=0x0;_0x296f410x1){_0x10b040['or'](_0x0a9e('0x66'),qs['getFullTextValue'](_0x121cef),null);}else{if(qs[_0x0a9e('0x67')](_0x121cef)){_0x10b040['or']('c.id\x20LIKE\x20?',_0x121cef+'%');_0x10b040['or'](_0x0a9e('0x68'),_0x121cef+'%');_0x10b040['or']('c.mobile\x20LIKE\x20?',_0x121cef+'%');_0x10b040['or']('c.fax\x20LIKE\x20?',_0x121cef+'%');}else if(qs['isEmail'](_0x121cef)){_0x10b040['or'](_0x0a9e('0x69'),_0x121cef+'%');}else{_0x10b040['or']('c.firstName\x20LIKE\x20?','%'+_0x121cef+'%');_0x10b040['or'](_0x0a9e('0x6a'),'%'+_0x121cef+'%');_0x10b040['or'](_0x0a9e('0x69'),'%'+_0x121cef+'%');}}}}_0x23b089[_0x0a9e('0x3e')](_0x10b040);_0x23b089[_0x0a9e('0x6b')](_0x0a9e('0x6c'));var _0x26d7db={'type':db['Sequelize'][_0x0a9e('0x6d')]['SELECT'],'raw':!![]};var _0xca4ade=_0x23b089[_0x0a9e('0x6e')]()[_0x0a9e('0x40')]('c.id');if(_0x2ec755[_0x0a9e('0x3c')]){_0x2ec755[_0x0a9e('0x3c')][_0x0a9e('0x53')](function(_0x32e134){_0x23b089['order']('c.'+_0x32e134[0x0],_0x32e134[0x1]===_0x0a9e('0x6f')?![]:!![]);});}if(!_[_0x0a9e('0x5f')](_0x432fcc)){_0x23b089['having'](_0x25c6e6);_0xca4ade[_0x0a9e('0x3e')](_0x0a9e('0x70'),_0x432fcc);}BPromise[_0x0a9e('0x71')]()[_0x0a9e('0x23')](function(){if(!_0x35ed4a)return;if(_0x468813[_0x0a9e('0x72')]['role']!==_0x0a9e('0x73'))return;if(!_[_0x0a9e('0x74')](_0x35ed4a[_0x0a9e('0x4f')],['field',_0x0a9e('0x56')])){return _0x468813['user']['getLists']({'attributes':['id'],'raw':!![]})[_0x0a9e('0x23')](function(_0x4556c5){if(_[_0x0a9e('0x5f')](_0x4556c5)){_0xca4ade[_0x0a9e('0x3e')](_0x0a9e('0x75'));_0x23b089[_0x0a9e('0x3e')](_0x0a9e('0x75'));}else{_0xca4ade[_0x0a9e('0x3e')](_0x0a9e('0x76'),_[_0x0a9e('0x52')](_0x4556c5,'id'));_0x23b089[_0x0a9e('0x3e')](_0x0a9e('0x76'),_[_0x0a9e('0x52')](_0x4556c5,'id'));}});}})[_0x0a9e('0x23')](function(){if(_0x468813[_0x0a9e('0x72')][_0x0a9e('0x77')]===_0x0a9e('0x73')&&!_0x35ed4a&&!_0x468813[_0x0a9e('0x35')]['ListId'])return[];return db[_0x0a9e('0x78')][_0x0a9e('0x35')](_0xca4ade[_0x0a9e('0x79')](),_0x26d7db);})['then'](function(_0x1148a1){_0x15b200[_0x0a9e('0x1e')]=_0x1148a1['length'];if(_0x15b200[_0x0a9e('0x1e')]===0x0)return[];return db[_0x0a9e('0x78')][_0x0a9e('0x35')](_0x5b4f5e[_0x0a9e('0x79')](),_0x26d7db)[_0x0a9e('0x23')](function(_0x4a43a8){_0x1459bb=_['keyBy'](_0x4a43a8,'id');_0x26d7db=_['merge'](_0x26d7db,{'model':db[_0x0a9e('0x29')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x468813[_0x0a9e('0x35')][_0x0a9e('0x38')]){_0x2ec755[_0x0a9e('0x39')][_0x0a9e('0x53')](function(_0x380ab3){_0x23b089[_0x0a9e('0x40')]('c.'+_0x380ab3);});}else{_0x23b089[_0x0a9e('0x40')]('c.id');_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7a'));_0x23b089[_0x0a9e('0x40')]('c.lastName');_0x23b089[_0x0a9e('0x40')]('c.phone');_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7b'));_0x23b089['field'](_0x0a9e('0x7c'));_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7d'));_0x23b089[_0x0a9e('0x40')]('c.ListId');_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7e'));_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7f'));_0x23b089['field'](_0x0a9e('0x80'));_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x81'),_0x0a9e('0x82'));}if(_0x2ec755['limit'])_0x23b089[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x1d')]);if(_0x2ec755[_0x0a9e('0x1b')])_0x23b089[_0x0a9e('0x1b')](_0x2ec755[_0x0a9e('0x1b')]);return db[_0x0a9e('0x78')][_0x0a9e('0x35')](_0x23b089[_0x0a9e('0x79')](),_0x26d7db);});})[_0x0a9e('0x23')](function(_0x336dc3){_0x336dc3[_0x0a9e('0x53')](function(_0x1f10ef){if(_0x1f10ef[_0x0a9e('0x82')]){_0x1f10ef[_0x0a9e('0x83')]=[];_0x1f10ef['TagIds'][_0x0a9e('0x84')](',')[_0x0a9e('0x53')](function(_0xc599b3){_0x1f10ef['Tags'][_0x0a9e('0x2e')](_0x1459bb[_0xc599b3]);});}delete _0x1f10ef[_0x0a9e('0x82')];});_0x15b200[_0x0a9e('0x85')]=_0x336dc3;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755));})['catch'](handleError(_0x2b1f27,null));};exports['destroy']=function(_0x7ebea8,_0x2bbdb5){return db['CmContact'][_0x0a9e('0x86')]({'where':{'id':_0x7ebea8['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x23')](removeEntity(_0x2bbdb5,null))['catch'](handleError(_0x2bbdb5,null));};exports[_0x0a9e('0x2a')]=function(_0x41cf12,_0x2d2286){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x23')](function(_0x444f1f){delete _0x444f1f['tags'];for(var _0x2973d3=0x0;_0x2973d30x0){return new Promise(function(_0x4a70ce,_0x55f91a){var _0x183244=[];for(var _0x1f78b4=0x0;_0x1f78b4<_0x5c4be0[_0x0a9e('0x2c')];_0x1f78b4++){_0x183244['push'](insertAdditionalPhones(_0x5c4be0[_0x1f78b4][_0x0a9e('0xb6')],_0x5c4be0[_0x1f78b4][_0x0a9e('0xaf')]));}Promise[_0x0a9e('0x32')](_0x183244)[_0x0a9e('0x23')](function(){_0x4a70ce(0x1);});})[_0x0a9e('0x23')](function(){return{'success':_0x5b93dd,'failure':_0x556443,'duplicates':_0x6eaaf0};});}else{return{'success':_0x5b93dd,'failure':_0x556443,'duplicates':_0x6eaaf0};}}})[_0x0a9e('0x23')](respondWithResult(_0x98c62c,0xc9))[_0x0a9e('0x8b')](handleError(_0x98c62c,null));};exports[_0x0a9e('0xb7')]=function(_0x3b5bda,_0x5a1848,_0x43c397){var _0x5526a7;return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x23')](function(_0x3cf222){return db[_0x0a9e('0x29')][_0x0a9e('0x86')]({'where':{'id':_0x3b5bda['params']['id']},'include':[{'model':db[_0x0a9e('0x50')],'as':_0x0a9e('0x83'),'attributes':['id',_0x0a9e('0x27'),_0x0a9e('0x41')],'required':_0x3b5bda['query'][_0x0a9e('0x64')]?!![]:![]},{'model':db[_0x0a9e('0xa3')],'as':_0x0a9e('0xb8'),'where':{'CmContactId':_0x3b5bda[_0x0a9e('0xb9')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0xba')],'as':_0x0a9e('0xbb')}]}],'order':[db[_0x0a9e('0x78')][_0x0a9e('0xbc')](_0x0a9e('0xbd'))],'logging':console[_0x0a9e('0xbe')],'attributes':_['keys'](_0x3cf222)});})[_0x0a9e('0x23')](function(_0x88b25f){_0x5526a7=_0x88b25f[_0x0a9e('0x8e')]({'plain':!![]});var _0x26b826={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x88b25f&&_0x88b25f[_0x0a9e('0x60')]){if(_0x88b25f[_0x0a9e('0x60')]){_0x26b826[_0x0a9e('0x3e')][_0x0a9e('0xbf')]['push']({'ListId':{'$ne':_0x88b25f[_0x0a9e('0x60')]}});}}return db[_0x0a9e('0x2f')][_0x0a9e('0x8d')](_0x26b826);})['then'](function(_0x1402c7){return _[_0x0a9e('0xc0')](_0x5526a7,_[_0x0a9e('0x52')](_0x1402c7,function(_0x97d5b5){return util[_0x0a9e('0xc1')](_0x0a9e('0xc2'),_0x97d5b5['id']);}));})[_0x0a9e('0x23')](handleEntityNotFound(_0x5a1848,null))[_0x0a9e('0x23')](respondWithResult(_0x5a1848,null))[_0x0a9e('0x8b')](handleError(_0x5a1848,null));};exports[_0x0a9e('0x22')]=function(_0x5a7dad,_0x251753){var _0x446e6;if(_0x5a7dad[_0x0a9e('0x8c')]['id']){delete _0x5a7dad[_0x0a9e('0x8c')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x86')]({'where':{'id':_0x5a7dad['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x251753,null))['then'](saveUpdates(_0x5a7dad['body'],null))['then'](function(_0x19e4e6){_0x446e6=_0x19e4e6;var _0x3fa3f2={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x19e4e6&&_0x19e4e6[_0x0a9e('0x60')]){if(_0x19e4e6[_0x0a9e('0x60')]){_0x3fa3f2['where'][_0x0a9e('0xbf')][_0x0a9e('0x2e')]({'ListId':{'$ne':_0x19e4e6[_0x0a9e('0x60')]}});}}return db[_0x0a9e('0x2f')][_0x0a9e('0x8d')](_0x3fa3f2);})['then'](function(_0x57b1b1){if(_0x57b1b1){return _[_0x0a9e('0xc0')](_[_0x0a9e('0xc3')](_0x5a7dad[_0x0a9e('0x8c')],function(_0x5e85d0,_0x319752){return _[_0x0a9e('0x87')](_0x319752,_0x0a9e('0x2d'));}),_['map'](_0x57b1b1,function(_0x8ad1c0){return util[_0x0a9e('0xc1')](_0x0a9e('0xc2'),_0x8ad1c0['id']);}));}})['then'](function(_0x272291){if(_0x272291&&!_[_0x0a9e('0x5f')](_0x272291)){var _0x3b7213=squel['update']()['table']('cm_contacts')[_0x0a9e('0xc4')](_0x272291)[_0x0a9e('0x3e')](_0x0a9e('0xc5'),_0x5a7dad[_0x0a9e('0xb9')]['id'])['toParam']();return db[_0x0a9e('0x78')]['query'](_0x3b7213[_0x0a9e('0x5b')],{'replacements':_0x3b7213[_0x0a9e('0xc6')]});}})[_0x0a9e('0x23')](function(){if(_0x5a7dad['body'][_0x0a9e('0xc7')]&&_0x446e6){return db[_0x0a9e('0x94')][_0x0a9e('0x22')]({'phone':_0x5a7dad['body'][_0x0a9e('0xc7')]},{'where':{'ContactId':_0x446e6['id']}});}})['then'](function(){return _0x446e6;})[_0x0a9e('0x23')](respondWithResult(_0x251753,null))['catch'](handleError(_0x251753,null));};exports[_0x0a9e('0xc8')]=function(_0x57b7d4,_0xb14971,_0x37215d){var _0xa288e4={};var _0x10ace8={};var _0x1e306c;var _0x251dd9;return db[_0x0a9e('0x29')]['findOne']({'where':{'id':_0x57b7d4[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0xb14971,null))['then'](function(_0xf4fb77){if(_0xf4fb77){_0x1e306c=_0xf4fb77;_0x10ace8[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x50')][_0x0a9e('0xc9')]);_0x10ace8[_0x0a9e('0x35')]=_['keys'](_0x57b7d4[_0x0a9e('0x35')]);_0x10ace8[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x10ace8[_0x0a9e('0x34')],_0x10ace8[_0x0a9e('0x35')]);_0xa288e4[_0x0a9e('0x39')]=_[_0x0a9e('0x37')](_0x10ace8[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0x57b7d4[_0x0a9e('0x35')]['fields']));_0xa288e4[_0x0a9e('0x39')]=_0xa288e4['attributes'][_0x0a9e('0x2c')]?_0xa288e4[_0x0a9e('0x39')]:_0x10ace8[_0x0a9e('0x34')];_0xa288e4[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x57b7d4[_0x0a9e('0x35')]['sort']);_0xa288e4[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x57b7d4['query'],_0x10ace8[_0x0a9e('0x36')]));if(_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x5d')]){_0xa288e4[_0x0a9e('0x3e')]=_[_0x0a9e('0xcb')](_0xa288e4[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0xa288e4['attributes'],function(_0x4e1b3){var _0x228c10={};_0x228c10[_0x4e1b3]={'$like':'%'+_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0x228c10;})});}_0xa288e4=_[_0x0a9e('0xcb')]({},_0xa288e4,_0x57b7d4[_0x0a9e('0xcc')]);return _0x1e306c[_0x0a9e('0xc8')](_0xa288e4);}})['then'](function(_0x5c8720){if(_0x5c8720){_0x251dd9=_0x5c8720[_0x0a9e('0x2c')];if(!_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0xa288e4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x57b7d4[_0x0a9e('0x35')]['limit']);_0xa288e4[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}return _0x1e306c[_0x0a9e('0xc8')](_0xa288e4);}})[_0x0a9e('0x23')](function(_0x16be7e){if(_0x16be7e){return _0x16be7e?{'count':_0x251dd9,'rows':_0x16be7e}:null;}})['then'](respondWithResult(_0xb14971,null))[_0x0a9e('0x8b')](handleError(_0xb14971,null));};exports[_0x0a9e('0xcd')]=function(_0x231826,_0x5885c3,_0x2b8ad4){if(_0x231826[_0x0a9e('0x8c')]['id']){delete _0x231826[_0x0a9e('0x8c')]['id'];}return db[_0x0a9e('0x29')]['findOne']({'where':{'id':_0x231826[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5885c3,null))[_0x0a9e('0x23')](function(_0x93d953){if(_0x93d953){return _0x93d953[_0x0a9e('0xcd')](_0x231826[_0x0a9e('0x8c')][_0x0a9e('0xce')]||[]);}return null;})[_0x0a9e('0x23')](respondWithResult(_0x5885c3,null))['catch'](handleError(_0x5885c3,null));};exports[_0x0a9e('0xcf')]=function(_0x266aa1,_0x25e41f){var _0x397771=[];_0x397771['push'](addAdditionalPhones(_0x266aa1['body']));Promise[_0x0a9e('0x32')](_0x397771)[_0x0a9e('0x23')](function(){_0x397771=[];_0x397771[_0x0a9e('0x2e')](deleteCmHopperPhones(_0x266aa1['body']['id']));_0x397771[_0x0a9e('0x2e')](addCmHopperPhones(_0x266aa1[_0x0a9e('0x8c')]['id']));Promise['all'](_0x397771)[_0x0a9e('0x23')](function(){return[0x1];})['then'](respondWithResult(_0x25e41f,null));});};function addAdditionalPhones(_0x35cc2a){return new Promise(function(_0x54dbbf,_0x5b42b9){return db['CmContactHasItem'][_0x0a9e('0x24')]({'where':{'CmContactId':_0x35cc2a['id']}})[_0x0a9e('0x23')](function(){var _0x19f800=[];for(var _0x20007e=0x0;_0x20007e<_0x35cc2a[_0x0a9e('0xd0')][_0x0a9e('0x2c')];_0x20007e++){_0x19f800['push'](addAdditionalPhone(_0x35cc2a['id'],_0x35cc2a[_0x0a9e('0xd0')][_0x20007e][_0x0a9e('0xc7')],_0x35cc2a[_0x0a9e('0xd1')]?_[_0x0a9e('0xd2')](_0x35cc2a[_0x0a9e('0xd1')][_0x20007e])?null:_0x35cc2a[_0x0a9e('0xd1')][_0x20007e]:_0x35cc2a[_0x0a9e('0xd0')][_0x20007e]['ItemTypeId']?_0x35cc2a['items'][_0x20007e][_0x0a9e('0xd3')]:null,_0x20007e,_0x35cc2a['items'][_0x20007e][_0x0a9e('0xd4')]));}Promise[_0x0a9e('0x32')](_0x19f800)[_0x0a9e('0x23')](function(){_0x54dbbf(0x1);});});});}function addAdditionalPhone(_0xa3695f,_0x37a448,_0x383dd8,_0x594f25,_0x4716d1){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0xa3695f,'item':_0x37a448}})[_0x0a9e('0x23')](function(_0x593f9e){if(_0x593f9e)logger[_0x0a9e('0x92')]('contact\x20phone\x20exists',_0x593f9e);else{db['CmContactHasItem'][_0x0a9e('0x98')]({'CmContactId':_0xa3695f,'item':_0x37a448,'ItemTypeId':_0x383dd8,'OrderBy':_0x594f25,'ItemClass':'PHONE','description':_0x4716d1});}});}function deletePhones(_0x24470a){return db[_0x0a9e('0xa3')][_0x0a9e('0x24')]({'where':{'CmContactId':_0x24470a}});}function deleteCmHopperPhones(_0x48f532){return new Promise(function(_0x4152cd,_0x1209c4){return db[_0x0a9e('0x94')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x48f532}})['then'](function(_0xdc77d){db[_0x0a9e('0xd5')][_0x0a9e('0x24')]({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x52')](_0xdc77d,'id')}}});})[_0x0a9e('0x23')](function(){_0x4152cd(0x1);});});}function addCmHopperPhones(_0x376b97){return new Promise(function(_0x247a6c,_0x170b3d){return db[_0x0a9e('0x94')][_0x0a9e('0x8d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x376b97}})['then'](function(_0x51fa33){var _0x558171=[];_[_0x0a9e('0x52')](_0x51fa33,function(_0x19dcc2){_0x558171[_0x0a9e('0x2e')](createCmHopperPhone(_0x376b97,_0x19dcc2['id']));});Promise[_0x0a9e('0x32')](_0x558171)[_0x0a9e('0x23')](function(){_0x247a6c(0x1);});});});}function createCmHopperPhone(_0x2dc202,_0x2b97fc){return new Promise(function(_0x307d13,_0x5d74e9){db['CmContactHasItem'][_0x0a9e('0x8d')]({'raw':!![],'attributes':[_0x0a9e('0xd6')],'where':{'CmContactId':_0x2dc202,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0xba')],'attributes':[_0x0a9e('0xd7')],'as':_0x0a9e('0xbb')}],'order':[db[_0x0a9e('0x78')][_0x0a9e('0xbc')](_0x0a9e('0xd8'))]})[_0x0a9e('0x23')](function(_0x262281){var _0x59f8f7=0x1;var _0x400800=_[_0x0a9e('0x52')](_0x262281,function(_0x20e191){_0x20e191['CmHopperId']=_0x2b97fc;_0x20e191[_0x0a9e('0xc7')]=_0x20e191[_0x0a9e('0xd6')];_0x20e191[_0x0a9e('0xd7')]=_0x20e191[_0x0a9e('0xd9')]||_0x59f8f7;delete _0x20e191[_0x0a9e('0xd9')];_0x59f8f7=_0x59f8f7+0x1;return _0x20e191;});return db[_0x0a9e('0xd5')][_0x0a9e('0xb0')](_0x400800,{});})[_0x0a9e('0x23')](function(){_0x307d13(0x1);});});}function insertAdditionalPhones(_0x3a9c0f,_0x3f1959){return new Promise(function(_0x6b048e,_0x3ba472){var _0x4e6eb9=[];for(var _0x572a72=0x0;_0x572a72<_0x3f1959[_0x0a9e('0x2c')];_0x572a72++){var _0x401207=_0x3f1959[_0x572a72];_0x4e6eb9[_0x0a9e('0x2e')](parseContactItemType(_0x401207));}Promise[_0x0a9e('0x32')](_0x4e6eb9)[_0x0a9e('0x23')](function(){var _0x1e29e2={'id':_0x3a9c0f['id'],'items':_0x3f1959};return addAdditionalPhones(_0x1e29e2)[_0x0a9e('0x23')](function(_0x4f7907){return addCmHopperPhones(_0x3a9c0f['id']);});})[_0x0a9e('0x23')](function(){_0x6b048e(_0x3a9c0f);});});}function parseContactItemType(_0x49fd0e){return new Promise(function(_0x26aa44,_0x1ad1d7){if(_0x49fd0e[_0x0a9e('0x3a')](_0x0a9e('0xd3'))){_0x26aa44(_0x49fd0e);}else{return db[_0x0a9e('0xba')][_0x0a9e('0x86')]({'where':{'name':_0x49fd0e[_0x0a9e('0xbb')]}})[_0x0a9e('0x23')](function(_0xa7a754){if(_[_0x0a9e('0xd2')](_0xa7a754))_0x49fd0e[_0x0a9e('0xd3')]=null;else _0x49fd0e[_0x0a9e('0xd3')]=_0xa7a754['id'];_0x26aa44(_0x49fd0e);});}});}exports[_0x0a9e('0xda')]=function(_0x3f7cb6,_0x3c8a9a){return db[_0x0a9e('0xa3')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3f7cb6['params']['id'],'ItemClass':_0x0a9e('0xdb')},'include':[{'model':db[_0x0a9e('0xba')],'as':'ItemType'}],'order':[[db['sequelize'][_0x0a9e('0xbc')](_0x0a9e('0xd8'))],[_0x0a9e('0xd7')]]})['then'](function(_0x268eae){return _0x268eae;})['then'](respondWithResult(_0x3c8a9a,null))[_0x0a9e('0x8b')](handleError(_0x3c8a9a,null));};exports['duplicateAdditionalPhones']=function(_0x22d31f,_0x5e9c92){return db[_0x0a9e('0xa3')][_0x0a9e('0x8d')]({'raw':!![],'where':{'CmContactId':_0x22d31f[_0x0a9e('0x8c')]['fromContactId']}})[_0x0a9e('0x23')](function(_0x497fda){var _0x505ffd=_[_0x0a9e('0x52')](_0x497fda,function(_0x23993f){_0x23993f[_0x0a9e('0xdc')]=_0x22d31f[_0x0a9e('0x8c')][_0x0a9e('0xdd')];return _0x23993f;});return db[_0x0a9e('0xa3')][_0x0a9e('0xb0')](_0x505ffd,{});})[_0x0a9e('0x23')](function(_0x1a3143){return addCmHopperPhones(_0x22d31f[_0x0a9e('0x8c')][_0x0a9e('0xdd')]);})[_0x0a9e('0x23')](function(_0x26361f){return['ok'];})[_0x0a9e('0x23')](respondWithResult(_0x5e9c92,null))[_0x0a9e('0x8b')](handleError(_0x5e9c92,null));};exports[_0x0a9e('0xde')]=function(_0x310026,_0x643f66){var _0x153de1=[];_0x153de1['push'](createCmHopperPhone(_0x310026[_0x0a9e('0x8c')]['id'],_0x310026[_0x0a9e('0x8c')][_0x0a9e('0xdf')]));Promise[_0x0a9e('0x32')](_0x153de1)['then'](function(){return[0x1];})['then'](respondWithResult(_0x643f66,null));};exports['getHoppers']=function(_0x2b8823,_0x55926d,_0xea26ca){var _0x1fafc2={'raw':![],'where':{}};var _0x130ae8={};var _0x43fe24={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x30')]({'where':{'id':_0x2b8823[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x55926d,null))[_0x0a9e('0x23')](function(_0x6b948a){if(_0x6b948a){_0x130ae8['model']=_[_0x0a9e('0x2b')](db['CmHopper'][_0x0a9e('0xc9')]);_0x130ae8['query']=_[_0x0a9e('0x2b')](_0x2b8823[_0x0a9e('0x35')]);_0x130ae8[_0x0a9e('0x36')]=_['intersection'](_0x130ae8[_0x0a9e('0x34')],_0x130ae8[_0x0a9e('0x35')]);_0x1fafc2['attributes']=_['intersection'](_0x130ae8[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0x2b8823[_0x0a9e('0x35')]['fields']));_0x1fafc2['attributes']=_0x1fafc2['attributes'][_0x0a9e('0x2c')]?_0x1fafc2[_0x0a9e('0x39')]:_0x130ae8[_0x0a9e('0x34')];if(!_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x1fafc2[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0x1fafc2[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}_0x1fafc2[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x1fafc2['where']=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x2b8823[_0x0a9e('0x35')],_0x130ae8[_0x0a9e('0x36')]));_0x1fafc2[_0x0a9e('0x3e')][_0x0a9e('0xe0')]=_0x6b948a['id'];if(_0x2b8823['query'][_0x0a9e('0x5d')]){_0x1fafc2[_0x0a9e('0x3e')]=_[_0x0a9e('0xcb')](_0x1fafc2[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0x1fafc2[_0x0a9e('0x39')],function(_0x103ad9){var _0x7c4ce2={};_0x7c4ce2[_0x103ad9]={'$like':'%'+_0x2b8823[_0x0a9e('0x35')]['filter']+'%'};return _0x7c4ce2;})});}_0x1fafc2=_['merge']({},_0x1fafc2,_0x2b8823[_0x0a9e('0xcc')]);return db[_0x0a9e('0x94')]['count']({'where':_0x1fafc2[_0x0a9e('0x3e')]})[_0x0a9e('0x23')](function(_0x4c8d75){_0x43fe24[_0x0a9e('0x1e')]=_0x4c8d75;if(_0x2b8823['query'][_0x0a9e('0xe1')]){_0x1fafc2[_0x0a9e('0xe2')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x8d')](_0x1fafc2);})[_0x0a9e('0x23')](function(_0x5952c8){_0x43fe24[_0x0a9e('0x85')]=_0x5952c8;return _0x43fe24;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x55926d,_0x1fafc2))['catch'](handleError(_0x55926d,null));};exports[_0x0a9e('0xe3')]=function(_0x237994,_0x28a078,_0x24361){var _0x8f68ec={'raw':!![],'where':{}};var _0x17a0d5={};var _0x5d525f={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x30')]({'where':{'id':_0x237994['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x28a078,null))[_0x0a9e('0x23')](function(_0x22c390){if(_0x22c390){_0x17a0d5[_0x0a9e('0x34')]=_[_0x0a9e('0x2b')](db[_0x0a9e('0xa5')][_0x0a9e('0xc9')]);_0x17a0d5['query']=_['keys'](_0x237994['query']);_0x17a0d5['filters']=_['intersection'](_0x17a0d5[_0x0a9e('0x34')],_0x17a0d5[_0x0a9e('0x35')]);_0x8f68ec['attributes']=_['intersection'](_0x17a0d5[_0x0a9e('0x34')],qs['fields'](_0x237994[_0x0a9e('0x35')][_0x0a9e('0x38')]));_0x8f68ec[_0x0a9e('0x39')]=_0x8f68ec[_0x0a9e('0x39')][_0x0a9e('0x2c')]?_0x8f68ec[_0x0a9e('0x39')]:_0x17a0d5['model'];if(!_0x237994[_0x0a9e('0x35')][_0x0a9e('0x3a')]('nolimit')){_0x8f68ec[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x237994[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0x8f68ec[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x237994[_0x0a9e('0x35')]['offset']);}_0x8f68ec[_0x0a9e('0x3c')]=qs['sort'](_0x237994[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x8f68ec['where']=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x237994['query'],_0x17a0d5[_0x0a9e('0x36')]));_0x8f68ec['where'][_0x0a9e('0xe0')]=_0x22c390['id'];if(_0x237994[_0x0a9e('0x35')]['filter']){_0x8f68ec[_0x0a9e('0x3e')]=_['merge'](_0x8f68ec[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0x8f68ec[_0x0a9e('0x39')],function(_0x37ef45){var _0x288127={};_0x288127[_0x37ef45]={'$like':'%'+_0x237994[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0x288127;})});}_0x8f68ec=_['merge']({},_0x8f68ec,_0x237994[_0x0a9e('0xcc')]);return db[_0x0a9e('0xa5')][_0x0a9e('0x1e')]({'where':_0x8f68ec[_0x0a9e('0x3e')]})[_0x0a9e('0x23')](function(_0x5932ad){_0x5d525f[_0x0a9e('0x1e')]=_0x5932ad;if(_0x237994['query']['includeAll']){_0x8f68ec[_0x0a9e('0xe2')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x8d')](_0x8f68ec);})[_0x0a9e('0x23')](function(_0x58d5fd){_0x5d525f[_0x0a9e('0x85')]=_0x58d5fd;return _0x5d525f;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x28a078,_0x8f68ec))[_0x0a9e('0x8b')](handleError(_0x28a078,null));};exports[_0x0a9e('0xe4')]=function(_0x2e1adc,_0x25eb44,_0x3d2bb0){var _0xb8c15={'raw':!![],'where':{}};var _0x3d02ae={};var _0x5871d7={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x30')]({'where':{'id':_0x2e1adc[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x25eb44,null))['then'](function(_0x38d95a){if(_0x38d95a){_0x3d02ae[_0x0a9e('0x34')]=_[_0x0a9e('0x2b')](db['CmHopperFinal'][_0x0a9e('0xc9')]);_0x3d02ae[_0x0a9e('0x35')]=_[_0x0a9e('0x2b')](_0x2e1adc['query']);_0x3d02ae[_0x0a9e('0x36')]=_['intersection'](_0x3d02ae[_0x0a9e('0x34')],_0x3d02ae[_0x0a9e('0x35')]);_0xb8c15[_0x0a9e('0x39')]=_[_0x0a9e('0x37')](_0x3d02ae[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0x2e1adc[_0x0a9e('0x35')]['fields']));_0xb8c15[_0x0a9e('0x39')]=_0xb8c15[_0x0a9e('0x39')][_0x0a9e('0x2c')]?_0xb8c15[_0x0a9e('0x39')]:_0x3d02ae[_0x0a9e('0x34')];if(!_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0xb8c15[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0xb8c15[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}_0xb8c15[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0xb8c15[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x2e1adc['query'],_0x3d02ae[_0x0a9e('0x36')]));_0xb8c15[_0x0a9e('0x3e')][_0x0a9e('0xe0')]=_0x38d95a['id'];if(_0x2e1adc['query'][_0x0a9e('0x5d')]){_0xb8c15['where']=_[_0x0a9e('0xcb')](_0xb8c15[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0xb8c15[_0x0a9e('0x39')],function(_0x455bca){var _0xb09ef6={};_0xb09ef6[_0x455bca]={'$like':'%'+_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0xb09ef6;})});}_0xb8c15=_['merge']({},_0xb8c15,_0x2e1adc[_0x0a9e('0xcc')]);return db[_0x0a9e('0xa4')]['count']({'where':_0xb8c15[_0x0a9e('0x3e')]})[_0x0a9e('0x23')](function(_0x579bb0){_0x5871d7['count']=_0x579bb0;if(_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0xe1')]){_0xb8c15[_0x0a9e('0xe2')]=[{'all':!![]}];}return db[_0x0a9e('0xa4')]['findAll'](_0xb8c15);})[_0x0a9e('0x23')](function(_0x31648e){_0x5871d7[_0x0a9e('0x85')]=_0x31648e;return _0x5871d7;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x25eb44,_0xb8c15))[_0x0a9e('0x8b')](handleError(_0x25eb44,null));};exports['getJscriptySessions']=function(_0xa3ba12,_0x3fc431,_0x4df303){var _0x34112c={'raw':!![],'where':{}};var _0x2d20a0={};var _0x38284a={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0xa3ba12[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x3fc431,null))[_0x0a9e('0x23')](function(_0x283bbb){if(_0x283bbb){_0x2d20a0[_0x0a9e('0x34')]=_[_0x0a9e('0x2b')](db[_0x0a9e('0xab')][_0x0a9e('0xc9')]);_0x2d20a0['query']=_['keys'](_0xa3ba12[_0x0a9e('0x35')]);_0x2d20a0['filters']=_[_0x0a9e('0x37')](_0x2d20a0[_0x0a9e('0x34')],_0x2d20a0[_0x0a9e('0x35')]);_0x34112c[_0x0a9e('0x39')]=_['intersection'](_0x2d20a0[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0xa3ba12['query'][_0x0a9e('0x38')]));_0x34112c['attributes']=_0x34112c[_0x0a9e('0x39')][_0x0a9e('0x2c')]?_0x34112c[_0x0a9e('0x39')]:_0x2d20a0[_0x0a9e('0x34')];if(!_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x3a')]('nolimit')){_0x34112c[_0x0a9e('0x1d')]=qs['limit'](_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0x34112c[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}_0x34112c[_0x0a9e('0x3c')]=qs['sort'](_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x34112c[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0xa3ba12['query'],_0x2d20a0[_0x0a9e('0x36')]));_0x34112c[_0x0a9e('0x3e')]['ContactId']=_0x283bbb['id'];if(_0xa3ba12['query'][_0x0a9e('0x5d')]){_0x34112c[_0x0a9e('0x3e')]=_[_0x0a9e('0xcb')](_0x34112c[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0x34112c[_0x0a9e('0x39')],function(_0x4d35ed){var _0x1e31c2={};_0x1e31c2[_0x4d35ed]={'$like':'%'+_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0x1e31c2;})});}_0x34112c=_['merge']({},_0x34112c,_0xa3ba12[_0x0a9e('0xcc')]);return db[_0x0a9e('0xab')][_0x0a9e('0x1e')]({'where':_0x34112c[_0x0a9e('0x3e')]})['then'](function(_0x5d4935){_0x38284a[_0x0a9e('0x1e')]=_0x5d4935;if(_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0xe1')]){_0x34112c[_0x0a9e('0xe2')]=[{'all':!![]}];}return db[_0x0a9e('0xab')][_0x0a9e('0x8d')](_0x34112c);})[_0x0a9e('0x23')](function(_0x23dd12){_0x38284a['rows']=_0x23dd12;return _0x38284a;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x3fc431,_0x34112c))['catch'](handleError(_0x3fc431,null));};exports[_0x0a9e('0xe5')]=function(_0x20dcfd,_0x3fd399,_0x4984b1){try{if(!_0x20dcfd['body'][_0x0a9e('0x60')]){throw new Error('No\x20ListId\x20specified');}if(!_0x20dcfd[_0x0a9e('0x8c')]['binding_keys']){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe6')]){throw new Error(_0x0a9e('0xe7'));}if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe8')]){throw new Error(_0x0a9e('0xe9'));}var _0x2f64ef=_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xea')][_0x0a9e('0x84')](',');var _0x81f495=_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe6')]['split'](',');if(!_0x2f64ef['length']||!_0x81f495[_0x0a9e('0x2c')]||_0x2f64ef['length']!==_0x81f495[_0x0a9e('0x2c')]){throw new Error(_0x0a9e('0xeb'));}_0x20dcfd[_0x0a9e('0x8c')]['fields']=_['zipObject'](_0x2f64ef,_0x81f495);if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0x38')][_0x0a9e('0xc7')]){throw new Error(_0x0a9e('0xec'));}if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0x38')][_0x0a9e('0xed')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x12984a=path['join'](config[_0x0a9e('0xee')],_0x0a9e('0xef'),_0x20dcfd['file'][_0x0a9e('0xf0')]);fs[_0x0a9e('0xf1')](_0x12984a,parseInt(_0x0a9e('0xf2'),0x8));var _0x4524b8=require(_0x0a9e('0xf3'))[_0x0a9e('0xf4')](path['join'](__dirname,_0x0a9e('0xf5')),[_0x12984a,_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xea')],_0x20dcfd['body'][_0x0a9e('0xe6')],_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0x60')],_0x20dcfd['body'][_0x0a9e('0xf6')],_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xb2')],_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe8')]]);return _0x3fd399[_0x0a9e('0x1a')](0xc8)['json']({'message':'File\x20uploaded\x20correctly!','pid':_0x4524b8[_0x0a9e('0xf7')]});}catch(_0x1e01af){return _0x3fd399['status'](0x1f4)[_0x0a9e('0xf8')](_0x1e01af);}};exports[_0x0a9e('0xf9')]=function(_0x315735,_0x35dadd,_0x2e413d){var _0x4e3983=fs['createReadStream'](_0x315735[_0x0a9e('0xfa')][_0x0a9e('0x6')]);Papa[_0x0a9e('0xfb')](_0x4e3983,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x4edb79){return _0x35dadd[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0xfc')]({'file':_0x315735[_0x0a9e('0xfa')],'fields':_0x4edb79[_0x0a9e('0xfd')]['fields']});}});};exports['import']=function(_0x46b143,_0x14b098,_0x16b4ae){return db['User'][_0x0a9e('0x8d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0x73')}})[_0x0a9e('0x23')](function(_0x1fc545){var _0x45616c=![];if(!_0x46b143[_0x0a9e('0x8c')][_0x0a9e('0x60')]){throw new Error(_0x0a9e('0xfe'));}if(!_0x46b143['body']['binding'][_0x0a9e('0xc7')]){throw new Error(_0x0a9e('0xec'));}if(!_0x46b143['body'][_0x0a9e('0xff')]['firstName']){throw new Error(_0x0a9e('0x100'));}if(!_0x46b143[_0x0a9e('0x8c')]['socket_timestamp']){throw new Error(_0x0a9e('0xe9'));}var _0xd6570f=require('child_process')[_0x0a9e('0xf4')](path[_0x0a9e('0x91')](__dirname,_0x0a9e('0x101')),[_0x46b143[_0x0a9e('0xb9')]['id'],JSON[_0x0a9e('0x102')](_0x46b143[_0x0a9e('0x8c')]),JSON[_0x0a9e('0x102')](_0x1fc545)]);_0xd6570f['on']('message',function(_0x1da68c){_0x45616c=!![];return _0x14b098[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0xfc')]({'message':_0x0a9e('0x103'),'pid':_0xd6570f[_0x0a9e('0xf7')]});});_0xd6570f['on'](_0x0a9e('0x104'),function(_0x456884){if(_0x456884&&!_0x45616c){return _0x14b098['status'](0x1f4)['json']({'message':_0x0a9e('0x105'),'pid':_0xd6570f[_0x0a9e('0xf7')]});}});})[_0x0a9e('0x8b')](handleError(_0x14b098,null));};exports['importUpdates']=function(_0x5cf1ba,_0xf7ddca,_0x55075d){return db[_0x0a9e('0x56')][_0x0a9e('0x8d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0x73')}})[_0x0a9e('0x23')](function(_0x20f4cb){var _0x13c6df=![];if(!_0x5cf1ba[_0x0a9e('0x8c')][_0x0a9e('0x60')]){throw new Error(_0x0a9e('0xfe'));}if(!_0x5cf1ba['body']['binding'][_0x0a9e('0xc7')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x5cf1ba[_0x0a9e('0x8c')][_0x0a9e('0xff')][_0x0a9e('0xed')]){throw new Error(_0x0a9e('0x100'));}if(!_0x5cf1ba['body'][_0x0a9e('0xe8')]){throw new Error(_0x0a9e('0xe9'));}var _0x2bc6a3=require('child_process')[_0x0a9e('0xf4')](path[_0x0a9e('0x91')](__dirname,_0x0a9e('0x106')),[_0x5cf1ba['params']['id'],JSON[_0x0a9e('0x102')](_0x5cf1ba[_0x0a9e('0x8c')]),JSON[_0x0a9e('0x102')](_0x20f4cb)]);_0x2bc6a3['on'](_0x0a9e('0x107'),function(_0x69b4d6){_0x13c6df=!![];return _0xf7ddca[_0x0a9e('0x1a')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x2bc6a3[_0x0a9e('0xf7')]});});_0x2bc6a3['on'](_0x0a9e('0x104'),function(_0x10d713){if(_0x10d713&&!_0x13c6df){return _0xf7ddca['status'](0x1f4)['json']({'message':_0x0a9e('0x105'),'pid':_0x2bc6a3[_0x0a9e('0xf7')]});}});})[_0x0a9e('0x8b')](handleError(_0xf7ddca,null));};exports['getJourney']=function(_0x4b51ff,_0x12d1dd){var _0x2c8d95=[_0x0a9e('0x108'),_0x0a9e('0x109'),_0x0a9e('0x10a'),'openchannel',_0x0a9e('0x10b'),'whatsapp',_0x0a9e('0x10c')];var _0x311e40={'offset':0x0,'order':qs[_0x0a9e('0x3d')]('-createdAt')},_0x57e719={'count':0x0,'rows':[]};Promise[_0x0a9e('0x71')]()[_0x0a9e('0x23')](function(){if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x10d')]){if(!_[_0x0a9e('0x10e')](_0x2c8d95,_0x4b51ff['query'][_0x0a9e('0x10d')][_0x0a9e('0x10f')]())){throw new Error(_0x0a9e('0x110'));}_0x2c8d95=[_0x4b51ff['query'][_0x0a9e('0x10d')]['toLowerCase']()];}if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]){try{var _0x2777fe=JSON['parse'](_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]);if(!moment(_0x2777fe[_0x0a9e('0x42')])[_0x0a9e('0x112')]()){throw new Error(_0x0a9e('0x113'));}if(!moment(_0x2777fe['to'])[_0x0a9e('0x112')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x3057c9){throw new Error(_0x0a9e('0x114'));}}if(!_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x311e40[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x4b51ff[_0x0a9e('0x35')]['limit']||0xa);_0x311e40[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}var _0x55a300=_0x2c8d95[_0x0a9e('0x52')](function(_0x57c3c4){if(_0x57c3c4===_0x0a9e('0x10c')){var _0x22ef0f={'attributes':['id',_0x0a9e('0x115'),'type',_0x0a9e('0x116'),_0x0a9e('0x117'),_0x0a9e('0x118'),_0x0a9e('0x119'),'endtime',_0x0a9e('0x11a'),_0x0a9e('0x11b'),_0x0a9e('0x11c'),_0x0a9e('0x11d'),_0x0a9e('0x11e'),_0x0a9e('0x11f'),_0x0a9e('0x120')],'where':{'ContactId':_0x4b51ff['params']['id']},'include':[{'model':db[_0x0a9e('0x56')],'as':_0x0a9e('0x56'),'attributes':['id',_0x0a9e('0x27'),_0x0a9e('0x121'),'alias']}],'order':[[_0x0a9e('0x11c'),'DESC']]};if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]){_0x22ef0f[_0x0a9e('0x3e')][_0x0a9e('0x11c')]={'$gte':_0x2777fe[_0x0a9e('0x42')],'$lte':_0x2777fe['to']};}return db[_0x0a9e('0xa6')][_0x0a9e('0x122')](_0x22ef0f)['then'](function(_0x173f03){_0x57e719['count']+=_0x173f03[_0x0a9e('0x1e')];return _[_0x0a9e('0x52')](_0x173f03['rows'],function(_0x2ebed3){var _0x167f89=_0x2ebed3[_0x0a9e('0x8e')]({'plain':!![]});_0x167f89[_0x0a9e('0x10d')]=_0x57c3c4;if(_0x167f89['User']){_0x167f89[_0x0a9e('0x56')]={'id':_0x167f89[_0x0a9e('0x56')]['id'],'name':_0x167f89['User'][_0x0a9e('0x27')],'fullname':_0x167f89['User']['fullname'],'alias':_0x167f89['User'][_0x0a9e('0x123')]};}return _0x167f89;});});}else{var _0x2ec662=_['startCase'](_0x57c3c4)+(_0x57c3c4===_0x0a9e('0x109')?_0x0a9e('0x124'):'Account');var _0xc48226={'attributes':['id',_0x0a9e('0x125'),_0x0a9e('0x126'),_0x0a9e('0x11c'),_0x0a9e('0x11b'),_0x0a9e('0x127'),_0x0a9e('0x128'),'thirdDisposition',_0x0a9e('0x120'),_0x2ec662+'Id'],'where':{'ContactId':_0x4b51ff['params']['id']},'include':[{'model':db[_0x2ec662],'as':_0x0a9e('0x129'),'attributes':['id',_0x0a9e('0x27'),_0x0a9e('0x12a')]},{'model':db[_0x0a9e('0x56')],'as':_0x0a9e('0x12b'),'attributes':['id',_0x0a9e('0x27'),'fullname']},{'model':db[_0x0a9e('0x50')],'as':_0x0a9e('0x83'),'attributes':['id',_0x0a9e('0x27'),'color'],'through':{'attributes':[]}}],'order':[[_0x0a9e('0x11c'),_0x0a9e('0x6f')]]};if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]){_0xc48226[_0x0a9e('0x3e')][_0x0a9e('0x11c')]={'$gte':_0x2777fe[_0x0a9e('0x42')],'$lte':_0x2777fe['to']};}switch(_0x57c3c4){case _0x0a9e('0x109'):_0xc48226[_0x0a9e('0x39')][_0x0a9e('0x2e')](_0x0a9e('0x12c'),_0x0a9e('0x12d'),_0x0a9e('0x12e'),_0x0a9e('0x12f'),_0x0a9e('0x130'),_0x0a9e('0x131'),'ratingType',_0x0a9e('0x132'),_0x0a9e('0x133'));break;case _0x0a9e('0x108'):_0xc48226['attributes'][_0x0a9e('0x2e')](_0x0a9e('0x134'),_0x0a9e('0x135'));break;case _0x0a9e('0x136'):_0xc48226['attributes'][_0x0a9e('0x2e')](_0x0a9e('0x137'),_0x0a9e('0x138'));break;}return db[_[_0x0a9e('0x139')](_0x57c3c4)+'Interaction'][_0x0a9e('0x122')](_0xc48226)[_0x0a9e('0x23')](function(_0x132455){_0x57e719[_0x0a9e('0x1e')]+=_0x132455['count'];return _['map'](_0x132455[_0x0a9e('0x85')],function(_0x44343f){var _0x2de997=_0x44343f[_0x0a9e('0x8e')]({'plain':!![]});_0x2de997[_0x0a9e('0x10d')]=_0x57c3c4;if(_0x2de997[_0x0a9e('0x12b')]){_0x2de997[_0x0a9e('0x12b')]={'id':_0x2de997[_0x0a9e('0x12b')]['id'],'name':_0x2de997[_0x0a9e('0x12b')][_0x0a9e('0x27')],'fullname':_0x2de997[_0x0a9e('0x12b')][_0x0a9e('0x121')]};}return _0x2de997;});});}});return Promise[_0x0a9e('0x32')](_0x55a300);})[_0x0a9e('0x23')](function(_0x4f5ebd){return _(_0x4f5ebd)[_0x0a9e('0x13a')]()[_0x0a9e('0x13b')](_0x0a9e('0x11c'))['reverse']()['value']();})[_0x0a9e('0x23')](function(_0x51ec16){_0x57e719[_0x0a9e('0x85')]=_0x311e40[_0x0a9e('0x1d')]?_0x51ec16[_0x0a9e('0x13c')](_0x311e40[_0x0a9e('0x1b')],_0x311e40['offset']+_0x311e40['limit']):_0x51ec16;return _0x57e719;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x12d1dd,_0x311e40))[_0x0a9e('0x8b')](handleError(_0x12d1dd,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index fe34fa9..5b08eda 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfd6=['exports','events','CmContact','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3bacff,_0xee5e7){var _0x6745b8=function(_0x3094cf){while(--_0x3094cf){_0x3bacff['push'](_0x3bacff['shift']());}};_0x6745b8(++_0xee5e7);}(_0xdfd6,0x10f));var _0x6dfd=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xdfd6[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require(_0x6dfd('0x0'));var CmContact=require('../../mysqldb')['db'][_0x6dfd('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x6dfd('0x2')](0x0);var events={'afterCreate':_0x6dfd('0x3'),'afterUpdate':_0x6dfd('0x4'),'afterDestroy':_0x6dfd('0x5')};function emitEvent(_0x5a1f11){return function(_0x4ae750,_0x3b3400,_0x840eb){CmContactEvents[_0x6dfd('0x6')](_0x5a1f11+':'+_0x4ae750['id'],_0x4ae750);CmContactEvents[_0x6dfd('0x6')](_0x5a1f11,_0x4ae750);_0x840eb(null);};}for(var e in events){if(events[_0x6dfd('0x7')](e)){var event=events[e];CmContact[_0x6dfd('0x8')](e,emitEvent(event));}}module[_0x6dfd('0x9')]=CmContactEvents; \ No newline at end of file +var _0x2e6f=['emit','hasOwnProperty','hook','../../mysqldb','CmContact','setMaxListeners','save','update'];(function(_0x7b5d26,_0x2d6622){var _0x66c4f1=function(_0x1a4056){while(--_0x1a4056){_0x7b5d26['push'](_0x7b5d26['shift']());}};_0x66c4f1(++_0x2d6622);}(_0x2e6f,0x13b));var _0xf2e6=function(_0x3c74bb,_0x50da75){_0x3c74bb=_0x3c74bb-0x0;var _0x45f571=_0x2e6f[_0x3c74bb];return _0x45f571;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xf2e6('0x0'))['db'][_0xf2e6('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xf2e6('0x2')](0x0);var events={'afterCreate':_0xf2e6('0x3'),'afterUpdate':_0xf2e6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2aa032){return function(_0x15f525,_0x13c704,_0xf6b3){CmContactEvents[_0xf2e6('0x5')](_0x2aa032+':'+_0x15f525['id'],_0x15f525);CmContactEvents[_0xf2e6('0x5')](_0x2aa032,_0x15f525);_0xf6b3(null);};}for(var e in events){if(events[_0xf2e6('0x6')](e)){var event=events[e];CmContact[_0xf2e6('0x7')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 54e6574..8fe487a 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcaaf=['findOne','then','isNil','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','priority','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','catch','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','length','onlyIfOpen','findAll','BlackLists','error','cmContact,\x20%s,\x20%s','message','Campaign','always','CmHopperBlack','List\x20not\x20found','isEmpty','ContactId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','../../config/logger','bluebird','request-promise','rimraf','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','lastName','mobile','FULLTEXT','models','get','cmContact','afterCreate','inspect','CmHopper'];(function(_0x293ed5,_0x2ee987){var _0x364c48=function(_0x45b2d1){while(--_0x45b2d1){_0x293ed5['push'](_0x293ed5['shift']());}};_0x364c48(++_0x2ee987);}(_0xcaaf,0x66));var _0xfcaa=function(_0x35dabf,_0x1f90a9){_0x35dabf=_0x35dabf-0x0;var _0x229a79=_0xcaaf[_0x35dabf];return _0x229a79;};'use strict';var _=require(_0xfcaa('0x0'));var util=require('util');var logger=require(_0xfcaa('0x1'))('api');var moment=require('moment');var BPromise=require(_0xfcaa('0x2'));var rp=require(_0xfcaa('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfcaa('0x4'));var config=require('../../config/environment');var attributes=require('./cmContact.attributes');module[_0xfcaa('0x5')]=function(_0x83f91d,_0x146224){return _0x83f91d[_0xfcaa('0x6')](_0xfcaa('0x7'),attributes,{'tableName':_0xfcaa('0x8'),'paranoid':!![],'indexes':[{'name':_0xfcaa('0x9'),'fields':['phone']},{'name':_0xfcaa('0xa'),'fields':['firstName',_0xfcaa('0xb'),'phone',_0xfcaa('0xc'),'fax','email'],'type':_0xfcaa('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4bf6dd,_0x286174,_0x2e83f8){var _0xb7b580=_0x83f91d[_0xfcaa('0xe')];var _0x278a68=_0x4bf6dd[_0xfcaa('0xf')]({'plain':!![]});function _0x1f26e3(){return function(_0xc03e64){logger['error'](_0xfcaa('0x10'),_0xfcaa('0x11'),util[_0xfcaa('0x12')](_0xc03e64,{'showHidden':![],'depth':null}));};}var _0x46181e=function(_0x521fff){return new BPromise(function(_0x2810d5,_0x26328d){_0xb7b580[_0xfcaa('0x13')][_0xfcaa('0x14')]({'where':{'phone':_0x278a68['phone'],'VoiceQueueId':_0x521fff['id']}})[_0xfcaa('0x15')](function(_0x2dbc14){if(!_[_0xfcaa('0x16')](_0x2dbc14)){throw new Error('cmContact,\x20afterCreate\x20'+_0x278a68[_0xfcaa('0x9')]+_0xfcaa('0x17')+_0x521fff['id']);}return _0xb7b580['CmHopper'][_0xfcaa('0x18')]({'phone':_0x278a68['phone'],'ContactId':_0x278a68['id'],'ListId':_0x278a68['ListId'],'priority':_0x278a68[_0xfcaa('0x19')]?_0x278a68[_0xfcaa('0x19')]:0x2,'scheduledat':_0x278a68[_0xfcaa('0x1a')]?_0x278a68[_0xfcaa('0x1a')]:moment()[_0xfcaa('0x1b')](_0xfcaa('0x1c')),'callback':_0x278a68[_0xfcaa('0x1d')]?!![]:![],'callbackuniqueid':_0x278a68[_0xfcaa('0x1d')]?_0x278a68[_0xfcaa('0x1d')]:undefined,'callbackat':_0x278a68[_0xfcaa('0x1d')]?moment()['format'](_0xfcaa('0x1c')):undefined,'VoiceQueueId':_0x521fff['id']});})[_0xfcaa('0x1e')](function(_0x233a73){_0x26328d(_0x233a73);});});};var _0xc7622=function(_0xcc1c83){return new BPromise(function(_0x4416ed,_0xf59b30){_0xb7b580[_0xfcaa('0x13')][_0xfcaa('0x14')]({'where':{'phone':_0x278a68['phone'],'VoiceQueueId':_0xcc1c83['id']}})[_0xfcaa('0x15')](function(_0x1526d9){if(!_[_0xfcaa('0x16')](_0x1526d9)){throw new Error('cmContact,\x20afterCreate\x20'+_0x278a68[_0xfcaa('0x9')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0xcc1c83['id']);}return _0xb7b580[_0xfcaa('0x1f')][_0xfcaa('0x14')]({'where':{'calleridnum':_0x278a68[_0xfcaa('0x9')],'VoiceQueueId':_0xcc1c83['id']}});})[_0xfcaa('0x15')](function(_0x43deb3){if(!_[_0xfcaa('0x16')](_0x43deb3)){throw new Error(_0xfcaa('0x20')+_0x278a68[_0xfcaa('0x9')]+_0xfcaa('0x21')+_0xcc1c83['id']);}return _0xb7b580['CmHopper']['create']({'phone':_0x278a68['phone'],'ContactId':_0x278a68['id'],'ListId':_0x278a68['ListId'],'priority':_0x278a68[_0xfcaa('0x19')]?_0x278a68[_0xfcaa('0x19')]:0x2,'scheduledat':_0x278a68['scheduledat']?_0x278a68[_0xfcaa('0x1a')]:moment()[_0xfcaa('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x278a68[_0xfcaa('0x1d')]?!![]:![],'callbackuniqueid':_0x278a68['callbackUniqueid']?_0x278a68['callbackUniqueid']:undefined,'callbackat':_0x278a68[_0xfcaa('0x1d')]?moment()[_0xfcaa('0x1b')](_0xfcaa('0x1c')):undefined,'VoiceQueueId':_0xcc1c83['id']});})[_0xfcaa('0x1e')](function(_0x4c8029){_0xf59b30(_0x4c8029);});});};function _0x17bf82(){return function(_0x3cd13d){logger['error'](_0xfcaa('0x10'),_0xfcaa('0x11'),util[_0xfcaa('0x12')](_0x3cd13d,{'showHidden':![],'depth':null}));};}var _0x1c6938=function(_0x1f7ef4){return new BPromise(function(_0x2b2a2d,_0x531e4b){_0xb7b580[_0xfcaa('0x13')][_0xfcaa('0x14')]({'where':{'phone':_0x278a68[_0xfcaa('0x9')],'CampaignId':_0x1f7ef4['id']}})[_0xfcaa('0x15')](function(_0x5a10b4){if(!_[_0xfcaa('0x16')](_0x5a10b4)){throw new Error('cmContact,\x20afterCreate\x20'+_0x278a68[_0xfcaa('0x9')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x1f7ef4['id']);}return _0xb7b580[_0xfcaa('0x13')][_0xfcaa('0x18')]({'phone':_0x278a68[_0xfcaa('0x9')],'ContactId':_0x278a68['id'],'ListId':_0x278a68[_0xfcaa('0x22')],'priority':_0x278a68[_0xfcaa('0x19')]?_0x278a68[_0xfcaa('0x19')]:0x2,'scheduledat':_0x278a68['scheduledat']?_0x278a68[_0xfcaa('0x1a')]:moment()[_0xfcaa('0x1b')](_0xfcaa('0x1c')),'callback':_0x278a68[_0xfcaa('0x1d')]?!![]:![],'callbackuniqueid':_0x278a68[_0xfcaa('0x1d')]?_0x278a68[_0xfcaa('0x1d')]:undefined,'callbackat':_0x278a68[_0xfcaa('0x1d')]?moment()[_0xfcaa('0x1b')](_0xfcaa('0x1c')):undefined,'CampaignId':_0x1f7ef4['id']});})[_0xfcaa('0x1e')](function(_0x37b7b4){_0x531e4b(_0x37b7b4);});});};var _0x10a761=function(_0x3e9f80){return new BPromise(function(_0x3599c6,_0x4e0a5b){_0xb7b580['CmHopper'][_0xfcaa('0x14')]({'where':{'phone':_0x278a68['phone'],'CampaignId':_0x3e9f80['id']}})[_0xfcaa('0x15')](function(_0x494d2e){if(!_[_0xfcaa('0x16')](_0x494d2e)){throw new Error('cmContact,\x20afterCreate\x20'+_0x278a68[_0xfcaa('0x9')]+_0xfcaa('0x23')+_0x3e9f80['id']);}return _0xb7b580[_0xfcaa('0x1f')][_0xfcaa('0x14')]({'where':{'calleridnum':_0x278a68[_0xfcaa('0x9')],'CampaignId':_0x3e9f80['id']}});})[_0xfcaa('0x15')](function(_0x1f2483){if(!_[_0xfcaa('0x16')](_0x1f2483)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x278a68[_0xfcaa('0x9')]+_0xfcaa('0x24')+_0x3e9f80['id']);}return _0xb7b580[_0xfcaa('0x13')]['create']({'phone':_0x278a68[_0xfcaa('0x9')],'ContactId':_0x278a68['id'],'ListId':_0x278a68[_0xfcaa('0x22')],'priority':_0x278a68[_0xfcaa('0x19')]?_0x278a68[_0xfcaa('0x19')]:0x2,'scheduledat':_0x278a68[_0xfcaa('0x1a')]?_0x278a68['scheduledat']:moment()[_0xfcaa('0x1b')](_0xfcaa('0x1c')),'callback':_0x278a68[_0xfcaa('0x1d')]?!![]:![],'callbackuniqueid':_0x278a68[_0xfcaa('0x1d')]?_0x278a68[_0xfcaa('0x1d')]:undefined,'callbackat':_0x278a68['callbackUniqueid']?moment()['format'](_0xfcaa('0x1c')):undefined,'CampaignId':_0x3e9f80['id']});})[_0xfcaa('0x1e')](function(_0x4f9d36){_0x4e0a5b(_0x4f9d36);});});};if(_0x278a68[_0xfcaa('0x22')]){_0xb7b580[_0xfcaa('0x25')]['findAll']({'where':{'type':_0xfcaa('0x26')},'attributes':['id',_0xfcaa('0x27')],'include':[{'model':_0xb7b580[_0xfcaa('0x28')],'as':_0xfcaa('0x29'),'where':{'id':_0x278a68['ListId']}}]})[_0xfcaa('0x15')](function(_0x957e4b){if(_0x957e4b){var _0x481115=[];for(var _0x4e4efb=0x0,_0xc999e7;_0x4e4efb<_0x957e4b[_0xfcaa('0x2a')];_0x4e4efb+=0x1){_0xc999e7=_0x957e4b[_0x4e4efb][_0xfcaa('0xf')]({'plain':!![]});switch(_0xc999e7[_0xfcaa('0x27')]){case'always':_0xc7622(_0xc999e7)[_0xfcaa('0x1e')](_0x1f26e3());break;case _0xfcaa('0x2b'):_0x46181e(_0xc999e7)[_0xfcaa('0x1e')](_0x1f26e3());break;default:_0xb7b580[_0xfcaa('0x13')][_0xfcaa('0x18')]({'phone':_0x278a68[_0xfcaa('0x9')],'ContactId':_0x278a68['id'],'ListId':_0x278a68[_0xfcaa('0x22')],'scheduledat':_0x278a68['scheduledat']?_0x278a68[_0xfcaa('0x1a')]:moment()['format'](_0xfcaa('0x1c')),'priority':_0x278a68['priority']?_0x278a68[_0xfcaa('0x19')]:0x2,'callback':_0x278a68['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x278a68[_0xfcaa('0x1d')]?_0x278a68['callbackUniqueid']:undefined,'callbackat':_0x278a68[_0xfcaa('0x1d')]?moment()[_0xfcaa('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0xc999e7['id']})[_0xfcaa('0x1e')](_0x1f26e3());}}}})[_0xfcaa('0x15')](function(){return _0xb7b580[_0xfcaa('0x25')][_0xfcaa('0x2c')]({'where':{'type':_0xfcaa('0x26')},'attributes':['id'],'include':[{'model':_0xb7b580['CmList'],'as':_0xfcaa('0x2d'),'where':{'id':_0x278a68[_0xfcaa('0x22')]}}]})[_0xfcaa('0x15')](function(_0x2ef507){if(_0x2ef507){var _0x409961=[];for(var _0x2ecff0=0x0,_0x3784e0;_0x2ecff0<_0x2ef507[_0xfcaa('0x2a')];_0x2ecff0+=0x1){_0x3784e0=_0x2ef507[_0x2ecff0]['get']({'plain':!![]});_0xb7b580['CmHopperBlack']['create']({'phone':_0x278a68[_0xfcaa('0x9')],'ContactId':_0x278a68['id'],'ListId':_0x278a68['ListId'],'VoiceQueueId':_0x3784e0['id']})[_0xfcaa('0x1e')](function(_0x1f1ac7){logger[_0xfcaa('0x2e')](_0xfcaa('0x2f'),_0xfcaa('0x11'),_0x1f1ac7[_0xfcaa('0x30')]);});}}});})[_0xfcaa('0x15')](function(){return _0xb7b580[_0xfcaa('0x31')]['findAll']({'attributes':['id',_0xfcaa('0x27')],'include':[{'model':_0xb7b580['CmList'],'as':_0xfcaa('0x29'),'where':{'id':_0x278a68[_0xfcaa('0x22')]}}]})[_0xfcaa('0x15')](function(_0x4e0cf7){if(_0x4e0cf7){var _0x3c13aa=[];for(var _0x1aa90f=0x0,_0xef52b7;_0x1aa90f<_0x4e0cf7['length'];_0x1aa90f+=0x1){_0xef52b7=_0x4e0cf7[_0x1aa90f][_0xfcaa('0xf')]({'plain':!![]});switch(_0xef52b7['dialCheckDuplicateType']){case _0xfcaa('0x32'):_0x10a761(_0xef52b7)['catch'](_0x17bf82());break;case _0xfcaa('0x2b'):_0x1c6938(_0xef52b7)[_0xfcaa('0x1e')](_0x17bf82());break;default:_0xb7b580[_0xfcaa('0x13')][_0xfcaa('0x18')]({'phone':_0x278a68['phone'],'ContactId':_0x278a68['id'],'ListId':_0x278a68[_0xfcaa('0x22')],'scheduledat':_0x278a68[_0xfcaa('0x1a')]?_0x278a68['scheduledat']:moment()[_0xfcaa('0x1b')](_0xfcaa('0x1c')),'priority':_0x278a68[_0xfcaa('0x19')]?_0x278a68[_0xfcaa('0x19')]:0x2,'callback':_0x278a68['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x278a68[_0xfcaa('0x1d')]?_0x278a68[_0xfcaa('0x1d')]:undefined,'callbackat':_0x278a68[_0xfcaa('0x1d')]?moment()[_0xfcaa('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0xef52b7['id']})[_0xfcaa('0x1e')](_0x17bf82());}}}});})['then'](function(){return _0xb7b580[_0xfcaa('0x31')][_0xfcaa('0x2c')]({'attributes':['id'],'include':[{'model':_0xb7b580['CmList'],'as':_0xfcaa('0x2d'),'where':{'id':_0x278a68['ListId']}}]})['then'](function(_0xe29873){if(_0xe29873){var _0x18c16e=[];for(var _0x98ad61=0x0,_0x57a38a;_0x98ad61<_0xe29873['length'];_0x98ad61+=0x1){_0x57a38a=_0xe29873[_0x98ad61][_0xfcaa('0xf')]({'plain':!![]});_0xb7b580[_0xfcaa('0x33')][_0xfcaa('0x18')]({'phone':_0x278a68['phone'],'ContactId':_0x278a68['id'],'ListId':_0x278a68['ListId'],'CampaignId':_0x57a38a['id']})[_0xfcaa('0x1e')](function(_0xad6422){logger[_0xfcaa('0x2e')](_0xfcaa('0x2f'),_0xfcaa('0x11'),_0xad6422[_0xfcaa('0x30')]);});}}});})['then'](function(){_0x2e83f8();})['catch'](function(_0x2b2fc6){logger[_0xfcaa('0x2e')](_0xfcaa('0x2f'),_0xfcaa('0x11'),_0x2b2fc6[_0xfcaa('0x30')]);_0x2e83f8(_0x2b2fc6);});}else{_0x2e83f8(new Error(_0xfcaa('0x34')));}},'afterDestroy':function(_0x8b1f43,_0x5881bb,_0x4f324b){var _0x2c577d=_0x83f91d[_0xfcaa('0xe')];var _0x5bbc0c=_0x8b1f43[_0xfcaa('0xf')]({'plain':!![]});return _0x2c577d['CmHopper'][_0xfcaa('0x2c')]({'raw':!![],'where':{'ListId':_0x5bbc0c[_0xfcaa('0x22')],'ContactId':_0x5bbc0c['id']}})['then'](function(_0x3aac86){if(!_[_0xfcaa('0x35')](_0x3aac86)){var _0x5bf868=[];for(var _0xd6c93=0x0;_0xd6c93<_0x3aac86['length'];_0xd6c93+=0x1){var _0xa4a109=_0x2c577d[_0xfcaa('0x13')]['destroy']({'where':{'ListId':_0x3aac86[_0xd6c93][_0xfcaa('0x22')],'ContactId':_0x3aac86[_0xd6c93][_0xfcaa('0x36')],'VoiceQueueId':_0x3aac86[_0xd6c93]['VoiceQueueId'],'CampaignId':_0x3aac86[_0xd6c93][_0xfcaa('0x37')]}});_0x5bf868[_0xfcaa('0x38')](_0xa4a109);}return BPromise[_0xfcaa('0x39')](_0x5bf868);}})[_0xfcaa('0x15')](function(_0x2da4b9){logger[_0xfcaa('0x3a')](_0xfcaa('0x3b'),util[_0xfcaa('0x12')](_0x2da4b9,{'showHidden':![],'depth':null}));_0x4f324b();})[_0xfcaa('0x1e')](function(_0x3372e0){logger['error'](_0xfcaa('0x3c'),util[_0xfcaa('0x12')](_0x3372e0,{'showHidden':![],'depth':null}));_0x4f324b(_0x3372e0);});}}});}; \ No newline at end of file +var _0xe0c1=['priority','format','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','findOne','CmHopperFinal','cmContact,\x20afterCreate,\x20','scheduledat','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','always','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','onlyIfOpen','Campaign','message','List\x20not\x20found','isEmpty','destroy','VoiceQueueId','CampaignId','push','all','lodash','util','../../config/logger','api','moment','bluebird','request-promise','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','mobile','fax','email','models','get','error','cmContact','afterCreate','inspect','CmHopper','then','isNil','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId'];(function(_0x3d728e,_0x4325cf){var _0x627520=function(_0x2d713b){while(--_0x2d713b){_0x3d728e['push'](_0x3d728e['shift']());}};_0x627520(++_0x4325cf);}(_0xe0c1,0x10f));var _0x1e0c=function(_0x276de3,_0x264aeb){_0x276de3=_0x276de3-0x0;var _0x2eb959=_0xe0c1[_0x276de3];return _0x2eb959;};'use strict';var _=require(_0x1e0c('0x0'));var util=require(_0x1e0c('0x1'));var logger=require(_0x1e0c('0x2'))(_0x1e0c('0x3'));var moment=require(_0x1e0c('0x4'));var BPromise=require(_0x1e0c('0x5'));var rp=require(_0x1e0c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmContact.attributes');module['exports']=function(_0x57c88f,_0x935e3b){return _0x57c88f[_0x1e0c('0x7')](_0x1e0c('0x8'),attributes,{'tableName':_0x1e0c('0x9'),'paranoid':!![],'indexes':[{'name':_0x1e0c('0xa'),'fields':[_0x1e0c('0xa')]},{'name':_0x1e0c('0xb'),'fields':[_0x1e0c('0xc'),'lastName',_0x1e0c('0xa'),_0x1e0c('0xd'),_0x1e0c('0xe'),_0x1e0c('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x452aee,_0x42b407,_0x2bd205){var _0x506e0a=_0x57c88f[_0x1e0c('0x10')];var _0x504f4d=_0x452aee[_0x1e0c('0x11')]({'plain':!![]});function _0x39305e(){return function(_0x432542){logger[_0x1e0c('0x12')](_0x1e0c('0x13'),_0x1e0c('0x14'),util[_0x1e0c('0x15')](_0x432542,{'showHidden':![],'depth':null}));};}var _0x1c2616=function(_0x1fbc44){return new BPromise(function(_0x452248,_0x599d0b){_0x506e0a[_0x1e0c('0x16')]['findOne']({'where':{'phone':_0x504f4d[_0x1e0c('0xa')],'VoiceQueueId':_0x1fbc44['id']}})[_0x1e0c('0x17')](function(_0x13840b){if(!_[_0x1e0c('0x18')](_0x13840b)){throw new Error(_0x1e0c('0x19')+_0x504f4d[_0x1e0c('0xa')]+_0x1e0c('0x1a')+_0x1fbc44['id']);}return _0x506e0a['CmHopper'][_0x1e0c('0x1b')]({'phone':_0x504f4d[_0x1e0c('0xa')],'ContactId':_0x504f4d['id'],'ListId':_0x504f4d[_0x1e0c('0x1c')],'priority':_0x504f4d[_0x1e0c('0x1d')]?_0x504f4d['priority']:0x2,'scheduledat':_0x504f4d['scheduledat']?_0x504f4d['scheduledat']:moment()[_0x1e0c('0x1e')](_0x1e0c('0x1f')),'callback':_0x504f4d[_0x1e0c('0x20')]?!![]:![],'callbackuniqueid':_0x504f4d[_0x1e0c('0x20')]?_0x504f4d[_0x1e0c('0x20')]:undefined,'callbackat':_0x504f4d[_0x1e0c('0x20')]?moment()[_0x1e0c('0x1e')](_0x1e0c('0x1f')):undefined,'VoiceQueueId':_0x1fbc44['id']});})['catch'](function(_0x5d6943){_0x599d0b(_0x5d6943);});});};var _0x3885d2=function(_0x38d8bd){return new BPromise(function(_0x3b1200,_0xb29b17){_0x506e0a['CmHopper'][_0x1e0c('0x21')]({'where':{'phone':_0x504f4d[_0x1e0c('0xa')],'VoiceQueueId':_0x38d8bd['id']}})[_0x1e0c('0x17')](function(_0x1cf772){if(!_[_0x1e0c('0x18')](_0x1cf772)){throw new Error(_0x1e0c('0x19')+_0x504f4d['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x38d8bd['id']);}return _0x506e0a[_0x1e0c('0x22')][_0x1e0c('0x21')]({'where':{'calleridnum':_0x504f4d[_0x1e0c('0xa')],'VoiceQueueId':_0x38d8bd['id']}});})[_0x1e0c('0x17')](function(_0x5cec62){if(!_[_0x1e0c('0x18')](_0x5cec62)){throw new Error(_0x1e0c('0x23')+_0x504f4d[_0x1e0c('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x38d8bd['id']);}return _0x506e0a[_0x1e0c('0x16')][_0x1e0c('0x1b')]({'phone':_0x504f4d[_0x1e0c('0xa')],'ContactId':_0x504f4d['id'],'ListId':_0x504f4d[_0x1e0c('0x1c')],'priority':_0x504f4d[_0x1e0c('0x1d')]?_0x504f4d['priority']:0x2,'scheduledat':_0x504f4d[_0x1e0c('0x24')]?_0x504f4d['scheduledat']:moment()[_0x1e0c('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x504f4d[_0x1e0c('0x20')]?!![]:![],'callbackuniqueid':_0x504f4d[_0x1e0c('0x20')]?_0x504f4d[_0x1e0c('0x20')]:undefined,'callbackat':_0x504f4d[_0x1e0c('0x20')]?moment()[_0x1e0c('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x38d8bd['id']});})[_0x1e0c('0x25')](function(_0x2cae9e){_0xb29b17(_0x2cae9e);});});};function _0x57dfb6(){return function(_0x5b3259){logger[_0x1e0c('0x12')]('cmContact',_0x1e0c('0x14'),util[_0x1e0c('0x15')](_0x5b3259,{'showHidden':![],'depth':null}));};}var _0xca3b86=function(_0x47424e){return new BPromise(function(_0xa7bb00,_0x452e76){_0x506e0a[_0x1e0c('0x16')][_0x1e0c('0x21')]({'where':{'phone':_0x504f4d[_0x1e0c('0xa')],'CampaignId':_0x47424e['id']}})[_0x1e0c('0x17')](function(_0x533b9c){if(!_[_0x1e0c('0x18')](_0x533b9c)){throw new Error('cmContact,\x20afterCreate\x20'+_0x504f4d[_0x1e0c('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x47424e['id']);}return _0x506e0a[_0x1e0c('0x16')]['create']({'phone':_0x504f4d[_0x1e0c('0xa')],'ContactId':_0x504f4d['id'],'ListId':_0x504f4d[_0x1e0c('0x1c')],'priority':_0x504f4d['priority']?_0x504f4d['priority']:0x2,'scheduledat':_0x504f4d['scheduledat']?_0x504f4d[_0x1e0c('0x24')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x504f4d[_0x1e0c('0x20')]?!![]:![],'callbackuniqueid':_0x504f4d[_0x1e0c('0x20')]?_0x504f4d[_0x1e0c('0x20')]:undefined,'callbackat':_0x504f4d[_0x1e0c('0x20')]?moment()[_0x1e0c('0x1e')](_0x1e0c('0x1f')):undefined,'CampaignId':_0x47424e['id']});})['catch'](function(_0x458a45){_0x452e76(_0x458a45);});});};var _0x3c112b=function(_0x416bfb){return new BPromise(function(_0x3bd6fd,_0x3f3500){_0x506e0a[_0x1e0c('0x16')]['findOne']({'where':{'phone':_0x504f4d[_0x1e0c('0xa')],'CampaignId':_0x416bfb['id']}})[_0x1e0c('0x17')](function(_0x1b729b){if(!_[_0x1e0c('0x18')](_0x1b729b)){throw new Error(_0x1e0c('0x19')+_0x504f4d[_0x1e0c('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x416bfb['id']);}return _0x506e0a[_0x1e0c('0x22')][_0x1e0c('0x21')]({'where':{'calleridnum':_0x504f4d['phone'],'CampaignId':_0x416bfb['id']}});})[_0x1e0c('0x17')](function(_0x2ffc0c){if(!_['isNil'](_0x2ffc0c)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x504f4d[_0x1e0c('0xa')]+_0x1e0c('0x26')+_0x416bfb['id']);}return _0x506e0a[_0x1e0c('0x16')][_0x1e0c('0x1b')]({'phone':_0x504f4d['phone'],'ContactId':_0x504f4d['id'],'ListId':_0x504f4d['ListId'],'priority':_0x504f4d[_0x1e0c('0x1d')]?_0x504f4d['priority']:0x2,'scheduledat':_0x504f4d[_0x1e0c('0x24')]?_0x504f4d[_0x1e0c('0x24')]:moment()[_0x1e0c('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x504f4d['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x504f4d[_0x1e0c('0x20')]?_0x504f4d['callbackUniqueid']:undefined,'callbackat':_0x504f4d[_0x1e0c('0x20')]?moment()['format'](_0x1e0c('0x1f')):undefined,'CampaignId':_0x416bfb['id']});})['catch'](function(_0x3ab785){_0x3f3500(_0x3ab785);});});};if(_0x504f4d['ListId']){_0x506e0a[_0x1e0c('0x27')][_0x1e0c('0x28')]({'where':{'type':_0x1e0c('0x29')},'attributes':['id',_0x1e0c('0x2a')],'include':[{'model':_0x506e0a[_0x1e0c('0x2b')],'as':_0x1e0c('0x2c'),'where':{'id':_0x504f4d['ListId']}}]})['then'](function(_0x477583){if(_0x477583){var _0x24d0c5=[];for(var _0x39bc5b=0x0,_0x41ded5;_0x39bc5b<_0x477583[_0x1e0c('0x2d')];_0x39bc5b+=0x1){_0x41ded5=_0x477583[_0x39bc5b][_0x1e0c('0x11')]({'plain':!![]});switch(_0x41ded5['dialCheckDuplicateType']){case _0x1e0c('0x2e'):_0x3885d2(_0x41ded5)[_0x1e0c('0x25')](_0x39305e());break;case'onlyIfOpen':_0x1c2616(_0x41ded5)['catch'](_0x39305e());break;default:_0x506e0a[_0x1e0c('0x16')][_0x1e0c('0x1b')]({'phone':_0x504f4d[_0x1e0c('0xa')],'ContactId':_0x504f4d['id'],'ListId':_0x504f4d[_0x1e0c('0x1c')],'scheduledat':_0x504f4d[_0x1e0c('0x24')]?_0x504f4d[_0x1e0c('0x24')]:moment()[_0x1e0c('0x1e')](_0x1e0c('0x1f')),'priority':_0x504f4d[_0x1e0c('0x1d')]?_0x504f4d[_0x1e0c('0x1d')]:0x2,'callback':_0x504f4d[_0x1e0c('0x20')]?!![]:![],'callbackuniqueid':_0x504f4d[_0x1e0c('0x20')]?_0x504f4d['callbackUniqueid']:undefined,'callbackat':_0x504f4d[_0x1e0c('0x20')]?moment()['format'](_0x1e0c('0x1f')):undefined,'VoiceQueueId':_0x41ded5['id']})[_0x1e0c('0x25')](_0x39305e());}}}})[_0x1e0c('0x17')](function(){return _0x506e0a[_0x1e0c('0x27')][_0x1e0c('0x28')]({'where':{'type':_0x1e0c('0x29')},'attributes':['id'],'include':[{'model':_0x506e0a[_0x1e0c('0x2b')],'as':_0x1e0c('0x2f'),'where':{'id':_0x504f4d['ListId']}}]})['then'](function(_0x2f3f40){if(_0x2f3f40){var _0x30153b=[];for(var _0x157490=0x0,_0x4ed5cf;_0x157490<_0x2f3f40[_0x1e0c('0x2d')];_0x157490+=0x1){_0x4ed5cf=_0x2f3f40[_0x157490][_0x1e0c('0x11')]({'plain':!![]});_0x506e0a[_0x1e0c('0x30')]['create']({'phone':_0x504f4d['phone'],'ContactId':_0x504f4d['id'],'ListId':_0x504f4d[_0x1e0c('0x1c')],'VoiceQueueId':_0x4ed5cf['id']})[_0x1e0c('0x25')](function(_0x5be24a){logger[_0x1e0c('0x12')](_0x1e0c('0x31'),_0x1e0c('0x14'),_0x5be24a['message']);});}}});})[_0x1e0c('0x17')](function(){return _0x506e0a['Campaign'][_0x1e0c('0x28')]({'attributes':['id',_0x1e0c('0x2a')],'include':[{'model':_0x506e0a[_0x1e0c('0x2b')],'as':_0x1e0c('0x2c'),'where':{'id':_0x504f4d[_0x1e0c('0x1c')]}}]})[_0x1e0c('0x17')](function(_0x918127){if(_0x918127){var _0x1c1532=[];for(var _0x364bf0=0x0,_0x5eb3ec;_0x364bf0<_0x918127['length'];_0x364bf0+=0x1){_0x5eb3ec=_0x918127[_0x364bf0][_0x1e0c('0x11')]({'plain':!![]});switch(_0x5eb3ec[_0x1e0c('0x2a')]){case _0x1e0c('0x2e'):_0x3c112b(_0x5eb3ec)[_0x1e0c('0x25')](_0x57dfb6());break;case _0x1e0c('0x32'):_0xca3b86(_0x5eb3ec)[_0x1e0c('0x25')](_0x57dfb6());break;default:_0x506e0a['CmHopper'][_0x1e0c('0x1b')]({'phone':_0x504f4d['phone'],'ContactId':_0x504f4d['id'],'ListId':_0x504f4d['ListId'],'scheduledat':_0x504f4d[_0x1e0c('0x24')]?_0x504f4d['scheduledat']:moment()[_0x1e0c('0x1e')](_0x1e0c('0x1f')),'priority':_0x504f4d['priority']?_0x504f4d['priority']:0x2,'callback':_0x504f4d[_0x1e0c('0x20')]?!![]:![],'callbackuniqueid':_0x504f4d['callbackUniqueid']?_0x504f4d[_0x1e0c('0x20')]:undefined,'callbackat':_0x504f4d[_0x1e0c('0x20')]?moment()['format'](_0x1e0c('0x1f')):undefined,'CampaignId':_0x5eb3ec['id']})[_0x1e0c('0x25')](_0x57dfb6());}}}});})[_0x1e0c('0x17')](function(){return _0x506e0a[_0x1e0c('0x33')][_0x1e0c('0x28')]({'attributes':['id'],'include':[{'model':_0x506e0a[_0x1e0c('0x2b')],'as':'BlackLists','where':{'id':_0x504f4d['ListId']}}]})[_0x1e0c('0x17')](function(_0x6f0a04){if(_0x6f0a04){var _0x3f4b2e=[];for(var _0x2de85c=0x0,_0x177fbb;_0x2de85c<_0x6f0a04[_0x1e0c('0x2d')];_0x2de85c+=0x1){_0x177fbb=_0x6f0a04[_0x2de85c][_0x1e0c('0x11')]({'plain':!![]});_0x506e0a['CmHopperBlack'][_0x1e0c('0x1b')]({'phone':_0x504f4d[_0x1e0c('0xa')],'ContactId':_0x504f4d['id'],'ListId':_0x504f4d[_0x1e0c('0x1c')],'CampaignId':_0x177fbb['id']})[_0x1e0c('0x25')](function(_0x3df41e){logger[_0x1e0c('0x12')](_0x1e0c('0x31'),'afterCreate',_0x3df41e['message']);});}}});})[_0x1e0c('0x17')](function(){_0x2bd205();})['catch'](function(_0x282b93){logger[_0x1e0c('0x12')](_0x1e0c('0x31'),_0x1e0c('0x14'),_0x282b93[_0x1e0c('0x34')]);_0x2bd205(_0x282b93);});}else{_0x2bd205(new Error(_0x1e0c('0x35')));}},'afterDestroy':function(_0x48cc46,_0x117914,_0x326c10){var _0x47699e=_0x57c88f[_0x1e0c('0x10')];var _0x421578=_0x48cc46['get']({'plain':!![]});return _0x47699e[_0x1e0c('0x16')]['findAll']({'raw':!![],'where':{'ListId':_0x421578[_0x1e0c('0x1c')],'ContactId':_0x421578['id']}})[_0x1e0c('0x17')](function(_0x184a89){if(!_[_0x1e0c('0x36')](_0x184a89)){var _0x37ad53=[];for(var _0x440059=0x0;_0x440059<_0x184a89['length'];_0x440059+=0x1){var _0x24334f=_0x47699e[_0x1e0c('0x16')][_0x1e0c('0x37')]({'where':{'ListId':_0x184a89[_0x440059][_0x1e0c('0x1c')],'ContactId':_0x184a89[_0x440059]['ContactId'],'VoiceQueueId':_0x184a89[_0x440059][_0x1e0c('0x38')],'CampaignId':_0x184a89[_0x440059][_0x1e0c('0x39')]}});_0x37ad53[_0x1e0c('0x3a')](_0x24334f);}return BPromise[_0x1e0c('0x3b')](_0x37ad53);}})[_0x1e0c('0x17')](function(_0x2584da){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0x1e0c('0x15')](_0x2584da,{'showHidden':![],'depth':null}));_0x326c10();})[_0x1e0c('0x25')](function(_0x126969){logger[_0x1e0c('0x12')]('[CmContact][afterDestroy][Error]',util[_0x1e0c('0x15')](_0x126969,{'showHidden':![],'depth':null}));_0x326c10(_0x126969);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 4e7a0d4..b0bcbbd 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0f1=['cf_','update','table','cm_contacts','set','id\x20=\x20?','sequelize','query','stringify','moment','randomstring','ioredis','squel','../../mysqldb','../../config/environment','jayson/promise','http','redis','socket.io-emitter','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','where','attributes','include','map','model','GetCmContact','CreateCmContact','CmContact','create','body','keys','length','startsWith'];(function(_0x2a1c2d,_0x44903b){var _0x3318fa=function(_0xbe4197){while(--_0xbe4197){_0x2a1c2d['push'](_0x2a1c2d['shift']());}};_0x3318fa(++_0x44903b);}(_0xa0f1,0x99));var _0x1a0f=function(_0x4cd226,_0x489a22){_0x4cd226=_0x4cd226-0x0;var _0x19c008=_0xa0f1[_0x4cd226];return _0x19c008;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1a0f('0x0'));var BPromise=require('bluebird');var rs=require(_0x1a0f('0x1'));var fs=require('fs');var Redis=require(_0x1a0f('0x2'));var squel=require(_0x1a0f('0x3'));var db=require(_0x1a0f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1a0f('0x5'));var jayson=require(_0x1a0f('0x6'));var client=jayson['client'][_0x1a0f('0x7')]({'port':0x232a});config[_0x1a0f('0x8')]=_['defaults'](config[_0x1a0f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x1a0f('0x9'))(new Redis(config[_0x1a0f('0x8')]));require('./cmContact.socket')[_0x1a0f('0xa')](socket);function respondWithRpcPromise(_0x36a3bc,_0x44492a,_0x1dc500){return new BPromise(function(_0x324a40,_0x3a9e7d){return client[_0x1a0f('0xb')](_0x36a3bc,_0x1dc500)[_0x1a0f('0xc')](function(_0x367342){logger[_0x1a0f('0xd')](_0x1a0f('0xe'),_0x44492a,_0x1a0f('0xf'));logger[_0x1a0f('0x10')](_0x1a0f('0x11'),_0x44492a,_0x1a0f('0xf'),JSON['stringify'](_0x367342));if(_0x367342[_0x1a0f('0x12')]){if(_0x367342['error'][_0x1a0f('0x13')]===0x1f4){logger[_0x1a0f('0x12')]('CmContact,\x20%s,\x20%s',_0x44492a,_0x367342[_0x1a0f('0x12')][_0x1a0f('0x14')]);return _0x3a9e7d(_0x367342[_0x1a0f('0x12')][_0x1a0f('0x14')]);}logger[_0x1a0f('0x12')](_0x1a0f('0xe'),_0x44492a,_0x367342['error'][_0x1a0f('0x14')]);return _0x324a40(_0x367342['error'][_0x1a0f('0x14')]);}else{logger[_0x1a0f('0xd')](_0x1a0f('0xe'),_0x44492a,_0x1a0f('0xf'));_0x324a40(_0x367342[_0x1a0f('0x15')][_0x1a0f('0x14')]);}})[_0x1a0f('0x16')](function(_0x3ce365){logger['error'](_0x1a0f('0xe'),_0x44492a,_0x3ce365);_0x3a9e7d(_0x3ce365);});});}exports['GetCmContact']=function(_0x457515){var _0x1c330f=this;return new Promise(function(_0x12c150,_0x388196){return db['CmContact'][_0x1a0f('0x17')]({'raw':_0x457515[_0x1a0f('0x18')]?_0x457515[_0x1a0f('0x18')][_0x1a0f('0x19')]===undefined?!![]:![]:!![],'where':_0x457515[_0x1a0f('0x18')]?_0x457515[_0x1a0f('0x18')][_0x1a0f('0x1a')]||null:null,'attributes':_0x457515[_0x1a0f('0x18')]?_0x457515[_0x1a0f('0x18')][_0x1a0f('0x1b')]||null:null,'limit':_0x457515[_0x1a0f('0x18')]?_0x457515[_0x1a0f('0x18')]['limit']||null:null,'include':_0x457515[_0x1a0f('0x18')]?_0x457515[_0x1a0f('0x18')][_0x1a0f('0x1c')]?_[_0x1a0f('0x1d')](_0x457515[_0x1a0f('0x18')][_0x1a0f('0x1c')],function(_0x3a5edf){return{'model':db[_0x3a5edf[_0x1a0f('0x1e')]],'as':_0x3a5edf['as'],'attributes':_0x3a5edf[_0x1a0f('0x1b')],'include':_0x3a5edf['include']?_[_0x1a0f('0x1d')](_0x3a5edf[_0x1a0f('0x1c')],function(_0x2b43aa){return{'model':db[_0x2b43aa[_0x1a0f('0x1e')]],'as':_0x2b43aa['as'],'attributes':_0x2b43aa[_0x1a0f('0x1b')],'include':_0x2b43aa[_0x1a0f('0x1c')]?_[_0x1a0f('0x1d')](_0x2b43aa['include'],function(_0x530e8f){return{'model':db[_0x530e8f[_0x1a0f('0x1e')]],'as':_0x530e8f['as'],'attributes':_0x530e8f[_0x1a0f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1a0f('0xc')](function(_0x5bd34c){logger[_0x1a0f('0xd')](_0x1a0f('0x1f'),_0x457515);logger[_0x1a0f('0x10')](_0x1a0f('0x1f'),_0x457515,JSON['stringify'](_0x5bd34c));_0x12c150(_0x5bd34c);})[_0x1a0f('0x16')](function(_0x4e2f62){logger[_0x1a0f('0x12')]('GetCmContact',_0x4e2f62[_0x1a0f('0x14')],_0x457515);_0x388196(_0x1c330f[_0x1a0f('0x12')](0x1f4,_0x4e2f62[_0x1a0f('0x14')]));});});};exports[_0x1a0f('0x20')]=function(_0xe95772){var _0x28d138=this;return new Promise(function(_0x1369ba,_0x1661a8){return db[_0x1a0f('0x21')][_0x1a0f('0x22')](_0xe95772[_0x1a0f('0x23')],{'raw':_0xe95772[_0x1a0f('0x18')]?_0xe95772[_0x1a0f('0x18')][_0x1a0f('0x19')]===undefined?!![]:![]:!![]})[_0x1a0f('0xc')](function(_0x4075b8){var _0x277816;for(var _0x1f3afd=0x0;_0x1f3afd{}\s\\|]/g,'-');_0x57542d(null,util[_0x9c30('0x27')](_0x9c30('0x28'),path['basename'](_0x4a7be9[_0x9c30('0x25')],path[_0x9c30('0x29')](_0x4a7be9[_0x9c30('0x25')])),Date[_0x9c30('0x2a')](),path[_0x9c30('0x29')](_0x4a7be9[_0x9c30('0x25')])));}})});router['post'](_0x9c30('0x2b'),upload[_0x9c30('0x2c')](_0x9c30('0x2d')),controller[_0x9c30('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4d03be,_0x5d2897,_0x54ca){_0x54ca(null,path[_0x9c30('0x23')](config[_0x9c30('0x2f')],_0x9c30('0x24')));},'filename':function(_0xccfc61,_0x2a4cb5,_0x1d952e){_0x2a4cb5['originalname']=_0x2a4cb5[_0x9c30('0x25')][_0x9c30('0x26')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1d952e(null,util['format'](_0x9c30('0x28'),path[_0x9c30('0x30')](_0x2a4cb5['originalname'],path[_0x9c30('0x29')](_0x2a4cb5[_0x9c30('0x25')])),Date['now'](),path[_0x9c30('0x29')](_0x2a4cb5[_0x9c30('0x25')])));}})});router[_0x9c30('0x18')](_0x9c30('0x31'),upload[_0x9c30('0x2c')](_0x9c30('0x2d')),controller[_0x9c30('0x32')]);router[_0x9c30('0x18')](_0x9c30('0x33'),auth['isAuthenticated'](),controller[_0x9c30('0x34')]);router['post']('/uploadUpdates/:id',auth[_0x9c30('0x7')](),controller['importUpdates']);router[_0x9c30('0x35')](_0x9c30('0xa'),auth[_0x9c30('0x7')](),controller[_0x9c30('0x36')]);router[_0x9c30('0x37')]('/:id',auth[_0x9c30('0x7')](),controller[_0x9c30('0x38')]);module[_0x9c30('0x39')]=router; \ No newline at end of file +var _0x2ec4=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','/describe','describe','/:id','getTags','/:id/phones','getAdditionalPhones','/:id/hoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','getJscriptySessions','getJourney','/merge','merge','post','/create_many','bulkCreate','/:id/tags','setAdditionalPhones','duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','diskStorage','join','server/files/tmp','originalname','format','%s-%s%s','basename','extname','now','/csv','single','root','replace','/upload','upload','/upload/:id','import','/uploadUpdates/:id','importUpdates','put','update','delete'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0x2ec4,0x1ca));var _0x42ec=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x2ec4[_0x934425];return _0x31d596;};'use strict';var multer=require(_0x42ec('0x0'));var util=require(_0x42ec('0x1'));var path=require(_0x42ec('0x2'));var timeout=require(_0x42ec('0x3'));var express=require('express');var router=express[_0x42ec('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x42ec('0x5'));var interaction=require(_0x42ec('0x6'));var config=require(_0x42ec('0x7'));var controller=require(_0x42ec('0x8'));router[_0x42ec('0x9')]('/',auth[_0x42ec('0xa')](),controller['index']);router[_0x42ec('0x9')](_0x42ec('0xb'),auth[_0x42ec('0xa')](),controller[_0x42ec('0xc')]);router['get'](_0x42ec('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x42ec('0x9')]('/:id/tags',auth[_0x42ec('0xa')](),controller[_0x42ec('0xe')]);router[_0x42ec('0x9')](_0x42ec('0xf'),auth[_0x42ec('0xa')](),controller[_0x42ec('0x10')]);router['get'](_0x42ec('0x11'),auth['isAuthenticated'](),controller['getHoppers']);router[_0x42ec('0x9')](_0x42ec('0x12'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x42ec('0x9')](_0x42ec('0x13'),auth[_0x42ec('0xa')](),controller[_0x42ec('0x14')]);router['get']('/:id/jscripty_sessions',auth[_0x42ec('0xa')](),controller[_0x42ec('0x15')]);router[_0x42ec('0x9')]('/:id/journey',auth['isAuthenticated'](),controller[_0x42ec('0x16')]);router['post'](_0x42ec('0x17'),auth[_0x42ec('0xa')](),controller[_0x42ec('0x18')]);router['post']('/',auth[_0x42ec('0xa')](),controller['create']);router[_0x42ec('0x19')](_0x42ec('0x1a'),auth[_0x42ec('0xa')](),controller[_0x42ec('0x1b')]);router[_0x42ec('0x19')](_0x42ec('0x1c'),auth[_0x42ec('0xa')](),controller['setTags']);router[_0x42ec('0x19')](_0x42ec('0xf'),auth[_0x42ec('0xa')](),controller[_0x42ec('0x1d')]);router['post']('/:id/duplicateAdditionalPhones',auth[_0x42ec('0xa')](),controller[_0x42ec('0x1e')]);router[_0x42ec('0x19')](_0x42ec('0x1f'),auth[_0x42ec('0xa')](),controller[_0x42ec('0x20')]);var upload=multer({'storage':multer[_0x42ec('0x21')]({'destination':function(_0x3f3d7c,_0x516324,_0x464406){_0x464406(null,path[_0x42ec('0x22')](config['root'],_0x42ec('0x23')));},'filename':function(_0x2c1bf0,_0x1e08a2,_0x33783d){_0x1e08a2[_0x42ec('0x24')]=_0x1e08a2[_0x42ec('0x24')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x33783d(null,util[_0x42ec('0x25')](_0x42ec('0x26'),path[_0x42ec('0x27')](_0x1e08a2['originalname'],path[_0x42ec('0x28')](_0x1e08a2[_0x42ec('0x24')])),Date[_0x42ec('0x29')](),path['extname'](_0x1e08a2[_0x42ec('0x24')])));}})});router[_0x42ec('0x19')](_0x42ec('0x2a'),upload[_0x42ec('0x2b')]('file'),controller['uploadCsv']);var upload=multer({'storage':multer[_0x42ec('0x21')]({'destination':function(_0x482c62,_0x24b351,_0x5e1a7){_0x5e1a7(null,path[_0x42ec('0x22')](config[_0x42ec('0x2c')],_0x42ec('0x23')));},'filename':function(_0x5483d6,_0xa0a750,_0xd419bc){_0xa0a750[_0x42ec('0x24')]=_0xa0a750[_0x42ec('0x24')][_0x42ec('0x2d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xd419bc(null,util[_0x42ec('0x25')](_0x42ec('0x26'),path[_0x42ec('0x27')](_0xa0a750[_0x42ec('0x24')],path['extname'](_0xa0a750['originalname'])),Date[_0x42ec('0x29')](),path[_0x42ec('0x28')](_0xa0a750[_0x42ec('0x24')])));}})});router[_0x42ec('0x19')](_0x42ec('0x2e'),upload['single']('file'),controller[_0x42ec('0x2f')]);router[_0x42ec('0x19')](_0x42ec('0x30'),auth['isAuthenticated'](),controller[_0x42ec('0x31')]);router['post'](_0x42ec('0x32'),auth[_0x42ec('0xa')](),controller[_0x42ec('0x33')]);router[_0x42ec('0x34')](_0x42ec('0xd'),auth[_0x42ec('0xa')](),controller[_0x42ec('0x35')]);router[_0x42ec('0x36')](_0x42ec('0xd'),auth[_0x42ec('0xa')](),controller[_0x42ec('0x37')]);module[_0x42ec('0x38')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index f0bedb9..6f44542 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf455=['STRING','PHONE','sequelize','exports','INTEGER'];(function(_0x3b07df,_0x3cd7bf){var _0x533650=function(_0x2d5eca){while(--_0x2d5eca){_0x3b07df['push'](_0x3b07df['shift']());}};_0x533650(++_0x3cd7bf);}(_0xf455,0xf2));var _0x5f45=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf455[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5f45('0x0'));module[_0x5f45('0x1')]={'CmContactId':{'type':Sequelize[_0x5f45('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x5f45('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x5f45('0x3')],'defaultValue':_0x5f45('0x4')},'OrderBy':{'type':Sequelize[_0x5f45('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x5f45('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x2b93=['PHONE','INTEGER','STRING'];(function(_0x459b74,_0x5773bd){var _0x46cb16=function(_0x97867f){while(--_0x97867f){_0x459b74['push'](_0x459b74['shift']());}};_0x46cb16(++_0x5773bd);}(_0x2b93,0x82));var _0x32b9=function(_0x1505e5,_0x5cc291){_0x1505e5=_0x1505e5-0x0;var _0x5b1dcd=_0x2b93[_0x1505e5];return _0x5b1dcd;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0x32b9('0x0')],'primaryKey':!![]},'item':{'type':Sequelize[_0x32b9('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x32b9('0x0')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x32b9('0x1')],'defaultValue':_0x32b9('0x2')},'OrderBy':{'type':Sequelize[_0x32b9('0x0')],'defaultValue':null},'description':{'type':Sequelize[_0x32b9('0x1')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 4030c3a..196a2f6 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc2a=['findAll','rows','catch','show','length','includeAll','options','create','body','role','user','CmContactHasItems','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','send','index','CmContactHasItem','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','count','include'];(function(_0x148e4f,_0xe4d9f6){var _0x21fbc7=function(_0x253352){while(--_0x253352){_0x148e4f['push'](_0x148e4f['shift']());}};_0x21fbc7(++_0xe4d9f6);}(_0xbc2a,0x19b));var _0xabc2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc2a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xabc2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabc2('0x1'));var jsonpatch=require(_0xabc2('0x2'));var rp=require(_0xabc2('0x3'));var moment=require(_0xabc2('0x4'));var BPromise=require(_0xabc2('0x5'));var Mustache=require(_0xabc2('0x6'));var util=require(_0xabc2('0x7'));var path=require(_0xabc2('0x8'));var sox=require(_0xabc2('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xabc2('0xa'));var squel=require(_0xabc2('0xb'));var crypto=require(_0xabc2('0xc'));var jsforce=require(_0xabc2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xabc2('0xe'));var querystring=require(_0xabc2('0xf'));var Papa=require(_0xabc2('0x10'));var Redis=require(_0xabc2('0x11'));var authService=require(_0xabc2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xabc2('0x13'));var hardwareService=require(_0xabc2('0x14'));var logger=require(_0xabc2('0x15'))(_0xabc2('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ebd56,_0x5f4f05){_0x5f4f05=_0x5f4f05||0xcc;return function(_0xab62c9){if(_0xab62c9){return _0x5ebd56['sendStatus'](_0x5f4f05);}return _0x5ebd56[_0xabc2('0x17')](_0x5f4f05)[_0xabc2('0x18')]();};}function respondWithResult(_0x453a61,_0x33de5e){_0x33de5e=_0x33de5e||0xc8;return function(_0x166e3f){if(_0x166e3f){return _0x453a61[_0xabc2('0x17')](_0x33de5e)[_0xabc2('0x19')](_0x166e3f);}};}function respondWithFilteredResult(_0x4199c0,_0x4ddbab){return function(_0x305e99){if(_0x305e99){var _0x251834=typeof _0x4ddbab[_0xabc2('0x1a')]===_0xabc2('0x1b')&&typeof _0x4ddbab['limit']==='undefined';var _0x10431e=_0x305e99['count'];var _0x381df4=_0x251834?0x0:_0x4ddbab['offset'];var _0x22d787=_0x251834?_0x305e99['count']:_0x4ddbab[_0xabc2('0x1a')]+_0x4ddbab[_0xabc2('0x1c')];var _0x1567b2;if(_0x22d787>=_0x10431e){_0x22d787=_0x10431e;_0x1567b2=0xc8;}else{_0x1567b2=0xce;}_0x4199c0[_0xabc2('0x17')](_0x1567b2);return _0x4199c0['set'](_0xabc2('0x1d'),_0x381df4+'-'+_0x22d787+'/'+_0x10431e)[_0xabc2('0x19')](_0x305e99);}return null;};}function patchUpdates(_0x161e1d){return function(_0x33da67){try{jsonpatch[_0xabc2('0x1e')](_0x33da67,_0x161e1d,!![]);}catch(_0x3023c3){return BPromise[_0xabc2('0x1f')](_0x3023c3);}return _0x33da67[_0xabc2('0x20')]();};}function saveUpdates(_0x4898ed,_0x175bbf){return function(_0x1da86c){if(_0x1da86c){return _0x1da86c[_0xabc2('0x21')](_0x4898ed)[_0xabc2('0x22')](function(_0x3e4e7f){return _0x3e4e7f;});}return null;};}function removeEntity(_0x4ff659,_0x57447b){return function(_0x48b579){if(_0x48b579){return _0x48b579[_0xabc2('0x23')]()['then'](function(){var _0x4ad87d=_0x48b579[_0xabc2('0x24')]({'plain':!![]});var _0x3012fa='CmContactHasItems';return db['UserProfileResource'][_0xabc2('0x23')]({'where':{'type':_0x3012fa,'resourceId':_0x4ad87d['id']}})['then'](function(){return _0x48b579;});})[_0xabc2('0x22')](function(){_0x4ff659[_0xabc2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd13c7c,_0x118789){return function(_0x3ba820){if(!_0x3ba820){_0xd13c7c['sendStatus'](0x194);}return _0x3ba820;};}function handleError(_0x459e5e,_0x5b0798){_0x5b0798=_0x5b0798||0x1f4;return function(_0x2ed44f){logger[_0xabc2('0x25')](_0x2ed44f[_0xabc2('0x26')]);if(_0x2ed44f[_0xabc2('0x27')]){delete _0x2ed44f[_0xabc2('0x27')];}_0x459e5e[_0xabc2('0x17')](_0x5b0798)[_0xabc2('0x28')](_0x2ed44f);};}exports[_0xabc2('0x29')]=function(_0x5614b4,_0x3c153a){var _0x3d0d3b={},_0x5dc7ab={},_0x5f539f={'count':0x0,'rows':[]};var _0x286ecf=_['map'](db[_0xabc2('0x2a')]['rawAttributes'],function(_0x3e0e48){return{'name':_0x3e0e48[_0xabc2('0x2b')],'type':_0x3e0e48[_0xabc2('0x2c')][_0xabc2('0x2d')]};});_0x5dc7ab['model']=_[_0xabc2('0x2e')](_0x286ecf,'name');_0x5dc7ab[_0xabc2('0x2f')]=_[_0xabc2('0x30')](_0x5614b4[_0xabc2('0x2f')]);_0x5dc7ab['filters']=_[_0xabc2('0x31')](_0x5dc7ab[_0xabc2('0x32')],_0x5dc7ab[_0xabc2('0x2f')]);_0x3d0d3b[_0xabc2('0x33')]=_[_0xabc2('0x31')](_0x5dc7ab[_0xabc2('0x32')],qs[_0xabc2('0x34')](_0x5614b4[_0xabc2('0x2f')][_0xabc2('0x34')]));_0x3d0d3b['attributes']=_0x3d0d3b['attributes']['length']?_0x3d0d3b[_0xabc2('0x33')]:_0x5dc7ab[_0xabc2('0x32')];if(!_0x5614b4[_0xabc2('0x2f')][_0xabc2('0x35')]('nolimit')){_0x3d0d3b[_0xabc2('0x1c')]=qs['limit'](_0x5614b4['query'][_0xabc2('0x1c')]);_0x3d0d3b[_0xabc2('0x1a')]=qs[_0xabc2('0x1a')](_0x5614b4[_0xabc2('0x2f')]['offset']);}_0x3d0d3b[_0xabc2('0x36')]=qs['sort'](_0x5614b4[_0xabc2('0x2f')][_0xabc2('0x37')]);_0x3d0d3b['where']=qs[_0xabc2('0x38')](_['pick'](_0x5614b4[_0xabc2('0x2f')],_0x5dc7ab['filters']),_0x286ecf);if(_0x5614b4[_0xabc2('0x2f')][_0xabc2('0x39')]){_0x3d0d3b[_0xabc2('0x3a')]=_[_0xabc2('0x3b')](_0x3d0d3b[_0xabc2('0x3a')],{'$or':_[_0xabc2('0x2e')](_0x286ecf,function(_0x52f179){if(_0x52f179[_0xabc2('0x2c')]!==_0xabc2('0x3c')){var _0x3f4112={};_0x3f4112[_0x52f179[_0xabc2('0x27')]]={'$like':'%'+_0x5614b4[_0xabc2('0x2f')][_0xabc2('0x39')]+'%'};return _0x3f4112;}})});}_0x3d0d3b=_[_0xabc2('0x3b')]({},_0x3d0d3b,_0x5614b4['options']);var _0x2d798e={'where':_0x3d0d3b[_0xabc2('0x3a')]};return db[_0xabc2('0x2a')][_0xabc2('0x3d')](_0x2d798e)[_0xabc2('0x22')](function(_0x36475d){_0x5f539f[_0xabc2('0x3d')]=_0x36475d;if(_0x5614b4[_0xabc2('0x2f')]['includeAll']){_0x3d0d3b[_0xabc2('0x3e')]=[{'all':!![]}];}return db['CmContactHasItem'][_0xabc2('0x3f')](_0x3d0d3b);})[_0xabc2('0x22')](function(_0x4d8cfa){_0x5f539f[_0xabc2('0x40')]=_0x4d8cfa;return _0x5f539f;})[_0xabc2('0x22')](respondWithFilteredResult(_0x3c153a,_0x3d0d3b))[_0xabc2('0x41')](handleError(_0x3c153a,null));};exports[_0xabc2('0x42')]=function(_0x31667a,_0x4df779){var _0x3d8c31={'raw':!![],'where':{'id':_0x31667a['params']['id']}},_0x2125a4={};_0x2125a4[_0xabc2('0x32')]=_[_0xabc2('0x30')](db[_0xabc2('0x2a')]['rawAttributes']);_0x2125a4[_0xabc2('0x2f')]=_[_0xabc2('0x30')](_0x31667a['query']);_0x2125a4['filters']=_[_0xabc2('0x31')](_0x2125a4[_0xabc2('0x32')],_0x2125a4[_0xabc2('0x2f')]);_0x3d8c31[_0xabc2('0x33')]=_[_0xabc2('0x31')](_0x2125a4[_0xabc2('0x32')],qs[_0xabc2('0x34')](_0x31667a[_0xabc2('0x2f')][_0xabc2('0x34')]));_0x3d8c31[_0xabc2('0x33')]=_0x3d8c31['attributes'][_0xabc2('0x43')]?_0x3d8c31[_0xabc2('0x33')]:_0x2125a4[_0xabc2('0x32')];if(_0x31667a[_0xabc2('0x2f')][_0xabc2('0x44')]){_0x3d8c31['include']=[{'all':!![]}];}_0x3d8c31=_[_0xabc2('0x3b')]({},_0x3d8c31,_0x31667a[_0xabc2('0x45')]);return db[_0xabc2('0x2a')]['find'](_0x3d8c31)[_0xabc2('0x22')](handleEntityNotFound(_0x4df779,null))[_0xabc2('0x22')](respondWithResult(_0x4df779,null))['catch'](handleError(_0x4df779,null));};exports[_0xabc2('0x46')]=function(_0x586d58,_0x4ebdf3){return db[_0xabc2('0x2a')][_0xabc2('0x46')](_0x586d58[_0xabc2('0x47')],{})[_0xabc2('0x22')](function(_0x1a4c16){var _0x4095a9=_0x586d58['user'][_0xabc2('0x24')]({'plain':!![]});if(!_0x4095a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4095a9[_0xabc2('0x48')]===_0xabc2('0x49')){var _0x22aa9b=_0x1a4c16[_0xabc2('0x24')]({'plain':!![]});var _0x4fb75b=_0xabc2('0x4a');return db[_0xabc2('0x4b')]['find']({'where':{'name':_0x4fb75b,'userProfileId':_0x4095a9['userProfileId']},'raw':!![]})[_0xabc2('0x22')](function(_0x1fac35){if(_0x1fac35&&_0x1fac35['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x22aa9b[_0xabc2('0x27')],'resourceId':_0x22aa9b['id'],'type':_0x1fac35[_0xabc2('0x27')],'sectionId':_0x1fac35['id']},{})[_0xabc2('0x22')](function(){return _0x1a4c16;});}else{return _0x1a4c16;}})[_0xabc2('0x41')](function(_0x4a23d4){logger[_0xabc2('0x25')](_0xabc2('0x4c'),_0x4a23d4);throw _0x4a23d4;});}return _0x1a4c16;})[_0xabc2('0x22')](respondWithResult(_0x4ebdf3,0xc9))[_0xabc2('0x41')](handleError(_0x4ebdf3,null));};exports['update']=function(_0x545ee5,_0x1c867d){if(_0x545ee5[_0xabc2('0x47')]['id']){delete _0x545ee5[_0xabc2('0x47')]['id'];}return db[_0xabc2('0x2a')][_0xabc2('0x4d')]({'where':{'id':_0x545ee5[_0xabc2('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1c867d,null))[_0xabc2('0x22')](saveUpdates(_0x545ee5[_0xabc2('0x47')],null))[_0xabc2('0x22')](respondWithResult(_0x1c867d,null))[_0xabc2('0x41')](handleError(_0x1c867d,null));};exports[_0xabc2('0x23')]=function(_0x20bfea,_0x3be95e){return db[_0xabc2('0x2a')]['find']({'where':{'id':_0x20bfea[_0xabc2('0x4e')]['id']}})[_0xabc2('0x22')](handleEntityNotFound(_0x3be95e,null))['then'](removeEntity(_0x3be95e,null))[_0xabc2('0x41')](handleError(_0x3be95e,null));}; \ No newline at end of file +var _0x0197=['fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','get','CmContactHasItems','UserProfileResource','destroy','then','error','name','send','index','CmContactHasItem','fieldName','type','key','map','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir'];(function(_0xa9e0e5,_0x2b12d5){var _0x1c42ea=function(_0x28318d){while(--_0x28318d){_0xa9e0e5['push'](_0xa9e0e5['shift']());}};_0x1c42ea(++_0x2b12d5);}(_0x0197,0x1ab));var _0x7019=function(_0x5d1a7f,_0x32f096){_0x5d1a7f=_0x5d1a7f-0x0;var _0x2ccabd=_0x0197[_0x5d1a7f];return _0x2ccabd;};'use strict';var emlformat=require(_0x7019('0x0'));var rimraf=require(_0x7019('0x1'));var zipdir=require(_0x7019('0x2'));var jsonpatch=require(_0x7019('0x3'));var rp=require(_0x7019('0x4'));var moment=require(_0x7019('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7019('0x6'));var util=require(_0x7019('0x7'));var path=require(_0x7019('0x8'));var sox=require('sox');var csv=require(_0x7019('0x9'));var ejs=require(_0x7019('0xa'));var fs=require('fs');var fs_extra=require(_0x7019('0xb'));var _=require(_0x7019('0xc'));var squel=require(_0x7019('0xd'));var crypto=require(_0x7019('0xe'));var jsforce=require(_0x7019('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7019('0x9'));var querystring=require(_0x7019('0x10'));var Papa=require(_0x7019('0x11'));var Redis=require('ioredis');var authService=require(_0x7019('0x12'));var qs=require(_0x7019('0x13'));var as=require(_0x7019('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7019('0x15'))('api');var utils=require(_0x7019('0x16'));var config=require(_0x7019('0x17'));var licenseUtil=require(_0x7019('0x18'));var db=require(_0x7019('0x19'))['db'];function respondWithStatusCode(_0x363230,_0x35828f){_0x35828f=_0x35828f||0xcc;return function(_0x2d8bf4){if(_0x2d8bf4){return _0x363230[_0x7019('0x1a')](_0x35828f);}return _0x363230[_0x7019('0x1b')](_0x35828f)[_0x7019('0x1c')]();};}function respondWithResult(_0x198ee5,_0x57cede){_0x57cede=_0x57cede||0xc8;return function(_0x158218){if(_0x158218){return _0x198ee5[_0x7019('0x1b')](_0x57cede)[_0x7019('0x1d')](_0x158218);}};}function respondWithFilteredResult(_0x2bfe5b,_0xab4c3b){return function(_0x1275af){if(_0x1275af){var _0x105b04=typeof _0xab4c3b[_0x7019('0x1e')]===_0x7019('0x1f')&&typeof _0xab4c3b['limit']==='undefined';var _0x5bd6e3=_0x1275af['count'];var _0x22c0a6=_0x105b04?0x0:_0xab4c3b['offset'];var _0x40d98e=_0x105b04?_0x1275af[_0x7019('0x20')]:_0xab4c3b[_0x7019('0x1e')]+_0xab4c3b[_0x7019('0x21')];var _0x27eaf1;if(_0x40d98e>=_0x5bd6e3){_0x40d98e=_0x5bd6e3;_0x27eaf1=0xc8;}else{_0x27eaf1=0xce;}_0x2bfe5b[_0x7019('0x1b')](_0x27eaf1);return _0x2bfe5b['set'](_0x7019('0x22'),_0x22c0a6+'-'+_0x40d98e+'/'+_0x5bd6e3)[_0x7019('0x1d')](_0x1275af);}return null;};}function patchUpdates(_0x120f32){return function(_0x39559a){try{jsonpatch[_0x7019('0x23')](_0x39559a,_0x120f32,!![]);}catch(_0x1b1b59){return BPromise['reject'](_0x1b1b59);}return _0x39559a[_0x7019('0x24')]();};}function saveUpdates(_0x12220b,_0x1c93b3){return function(_0x226721){if(_0x226721){return _0x226721[_0x7019('0x25')](_0x12220b)['then'](function(_0x5b925e){return _0x5b925e;});}return null;};}function removeEntity(_0x4aaa9f,_0x5e1c0e){return function(_0x194887){if(_0x194887){return _0x194887['destroy']()['then'](function(){var _0x4d8a1f=_0x194887[_0x7019('0x26')]({'plain':!![]});var _0x1cec1f=_0x7019('0x27');return db[_0x7019('0x28')][_0x7019('0x29')]({'where':{'type':_0x1cec1f,'resourceId':_0x4d8a1f['id']}})[_0x7019('0x2a')](function(){return _0x194887;});})[_0x7019('0x2a')](function(){_0x4aaa9f[_0x7019('0x1b')](0xcc)[_0x7019('0x1c')]();});}};}function handleEntityNotFound(_0x1e0ffb,_0x4c4340){return function(_0x7441c5){if(!_0x7441c5){_0x1e0ffb[_0x7019('0x1a')](0x194);}return _0x7441c5;};}function handleError(_0x517ba3,_0x9be7bc){_0x9be7bc=_0x9be7bc||0x1f4;return function(_0x27d859){logger[_0x7019('0x2b')](_0x27d859['stack']);if(_0x27d859['name']){delete _0x27d859[_0x7019('0x2c')];}_0x517ba3[_0x7019('0x1b')](_0x9be7bc)[_0x7019('0x2d')](_0x27d859);};}exports[_0x7019('0x2e')]=function(_0x50b199,_0x278dad){var _0x4b9fc5={},_0x382ca4={},_0x304cdf={'count':0x0,'rows':[]};var _0x68f122=_['map'](db[_0x7019('0x2f')]['rawAttributes'],function(_0x324f6d){return{'name':_0x324f6d[_0x7019('0x30')],'type':_0x324f6d[_0x7019('0x31')][_0x7019('0x32')]};});_0x382ca4['model']=_[_0x7019('0x33')](_0x68f122,_0x7019('0x2c'));_0x382ca4[_0x7019('0x34')]=_[_0x7019('0x35')](_0x50b199[_0x7019('0x34')]);_0x382ca4[_0x7019('0x36')]=_['intersection'](_0x382ca4['model'],_0x382ca4[_0x7019('0x34')]);_0x4b9fc5[_0x7019('0x37')]=_[_0x7019('0x38')](_0x382ca4[_0x7019('0x39')],qs[_0x7019('0x3a')](_0x50b199[_0x7019('0x34')][_0x7019('0x3a')]));_0x4b9fc5['attributes']=_0x4b9fc5[_0x7019('0x37')][_0x7019('0x3b')]?_0x4b9fc5[_0x7019('0x37')]:_0x382ca4[_0x7019('0x39')];if(!_0x50b199[_0x7019('0x34')][_0x7019('0x3c')]('nolimit')){_0x4b9fc5['limit']=qs['limit'](_0x50b199[_0x7019('0x34')][_0x7019('0x21')]);_0x4b9fc5['offset']=qs[_0x7019('0x1e')](_0x50b199[_0x7019('0x34')][_0x7019('0x1e')]);}_0x4b9fc5[_0x7019('0x3d')]=qs[_0x7019('0x3e')](_0x50b199[_0x7019('0x34')]['sort']);_0x4b9fc5[_0x7019('0x3f')]=qs[_0x7019('0x36')](_[_0x7019('0x40')](_0x50b199[_0x7019('0x34')],_0x382ca4[_0x7019('0x36')]),_0x68f122);if(_0x50b199[_0x7019('0x34')][_0x7019('0x41')]){_0x4b9fc5[_0x7019('0x3f')]=_[_0x7019('0x42')](_0x4b9fc5['where'],{'$or':_['map'](_0x68f122,function(_0x9796ac){if(_0x9796ac[_0x7019('0x31')]!=='VIRTUAL'){var _0x3defcd={};_0x3defcd[_0x9796ac[_0x7019('0x2c')]]={'$like':'%'+_0x50b199[_0x7019('0x34')][_0x7019('0x41')]+'%'};return _0x3defcd;}})});}_0x4b9fc5=_[_0x7019('0x42')]({},_0x4b9fc5,_0x50b199[_0x7019('0x43')]);var _0x4c3ad7={'where':_0x4b9fc5[_0x7019('0x3f')]};return db[_0x7019('0x2f')]['count'](_0x4c3ad7)['then'](function(_0x56a36f){_0x304cdf[_0x7019('0x20')]=_0x56a36f;if(_0x50b199[_0x7019('0x34')][_0x7019('0x44')]){_0x4b9fc5[_0x7019('0x45')]=[{'all':!![]}];}return db[_0x7019('0x2f')][_0x7019('0x46')](_0x4b9fc5);})[_0x7019('0x2a')](function(_0xec1827){_0x304cdf[_0x7019('0x47')]=_0xec1827;return _0x304cdf;})[_0x7019('0x2a')](respondWithFilteredResult(_0x278dad,_0x4b9fc5))[_0x7019('0x48')](handleError(_0x278dad,null));};exports[_0x7019('0x49')]=function(_0x106072,_0xfb69ca){var _0x42486e={'raw':!![],'where':{'id':_0x106072[_0x7019('0x4a')]['id']}},_0x5a85b6={};_0x5a85b6[_0x7019('0x39')]=_[_0x7019('0x35')](db[_0x7019('0x2f')][_0x7019('0x4b')]);_0x5a85b6[_0x7019('0x34')]=_[_0x7019('0x35')](_0x106072[_0x7019('0x34')]);_0x5a85b6['filters']=_[_0x7019('0x38')](_0x5a85b6[_0x7019('0x39')],_0x5a85b6[_0x7019('0x34')]);_0x42486e[_0x7019('0x37')]=_[_0x7019('0x38')](_0x5a85b6['model'],qs[_0x7019('0x3a')](_0x106072[_0x7019('0x34')][_0x7019('0x3a')]));_0x42486e[_0x7019('0x37')]=_0x42486e['attributes'][_0x7019('0x3b')]?_0x42486e['attributes']:_0x5a85b6['model'];if(_0x106072['query'][_0x7019('0x44')]){_0x42486e[_0x7019('0x45')]=[{'all':!![]}];}_0x42486e=_['merge']({},_0x42486e,_0x106072[_0x7019('0x43')]);return db['CmContactHasItem'][_0x7019('0x4c')](_0x42486e)[_0x7019('0x2a')](handleEntityNotFound(_0xfb69ca,null))[_0x7019('0x2a')](respondWithResult(_0xfb69ca,null))[_0x7019('0x48')](handleError(_0xfb69ca,null));};exports[_0x7019('0x4d')]=function(_0x382eaa,_0x4a312e){return db[_0x7019('0x2f')][_0x7019('0x4d')](_0x382eaa[_0x7019('0x4e')],{})[_0x7019('0x2a')](function(_0x537397){var _0x29f187=_0x382eaa[_0x7019('0x4f')][_0x7019('0x26')]({'plain':!![]});if(!_0x29f187)throw new Error(_0x7019('0x50'));if(_0x29f187[_0x7019('0x51')]===_0x7019('0x4f')){var _0x53d244=_0x537397[_0x7019('0x26')]({'plain':!![]});var _0x4565bc='CmContactHasItems';return db[_0x7019('0x52')][_0x7019('0x4c')]({'where':{'name':_0x4565bc,'userProfileId':_0x29f187[_0x7019('0x53')]},'raw':!![]})[_0x7019('0x2a')](function(_0xb1f042){if(_0xb1f042&&_0xb1f042[_0x7019('0x54')]===0x0){return db['UserProfileResource'][_0x7019('0x4d')]({'name':_0x53d244['name'],'resourceId':_0x53d244['id'],'type':_0xb1f042[_0x7019('0x2c')],'sectionId':_0xb1f042['id']},{})[_0x7019('0x2a')](function(){return _0x537397;});}else{return _0x537397;}})[_0x7019('0x48')](function(_0x2c9bba){logger['error'](_0x7019('0x55'),_0x2c9bba);throw _0x2c9bba;});}return _0x537397;})[_0x7019('0x2a')](respondWithResult(_0x4a312e,0xc9))[_0x7019('0x48')](handleError(_0x4a312e,null));};exports[_0x7019('0x25')]=function(_0x4833ed,_0x1256ad){if(_0x4833ed['body']['id']){delete _0x4833ed['body']['id'];}return db[_0x7019('0x2f')][_0x7019('0x4c')]({'where':{'id':_0x4833ed[_0x7019('0x4a')]['id']}})[_0x7019('0x2a')](handleEntityNotFound(_0x1256ad,null))[_0x7019('0x2a')](saveUpdates(_0x4833ed[_0x7019('0x4e')],null))[_0x7019('0x2a')](respondWithResult(_0x1256ad,null))[_0x7019('0x48')](handleError(_0x1256ad,null));};exports[_0x7019('0x29')]=function(_0x3ea92e,_0x3a6033){return db[_0x7019('0x2f')][_0x7019('0x4c')]({'where':{'id':_0x3ea92e[_0x7019('0x4a')]['id']}})[_0x7019('0x2a')](handleEntityNotFound(_0x3a6033,null))[_0x7019('0x2a')](removeEntity(_0x3a6033,null))[_0x7019('0x48')](handleError(_0x3a6033,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 546f1b8..71a2899 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f8a=['rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x122e7d,_0x505a64){var _0x48f37b=function(_0x1e6f67){while(--_0x1e6f67){_0x122e7d['push'](_0x122e7d['shift']());}};_0x48f37b(++_0x505a64);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x529e36,_0x235e90){_0x529e36=_0x529e36-0x0;var _0x1626da=_0x3f8a[_0x529e36];return _0x1626da;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));module[_0xa3f8('0xa')]=function(_0x471464,_0x1f160a){return _0x471464[_0xa3f8('0xb')](_0xa3f8('0xc'),attributes,{'tableName':_0xa3f8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0x46ed,0x168));var _0xd46e=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x46ed[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 4af38c5..c1b934a 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe3c=['then','info','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','CmContactHasItem,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','../../mysqldb','rpc','jayson/promise','http','request'];(function(_0x1de242,_0x2577dc){var _0x128086=function(_0x5d39ef){while(--_0x5d39ef){_0x1de242['push'](_0x1de242['shift']());}};_0x128086(++_0x2577dc);}(_0xbe3c,0x1bf));var _0xcbe3=function(_0x813c2f,_0x5c5c12){_0x813c2f=_0x813c2f-0x0;var _0x4561ea=_0xbe3c[_0x813c2f];return _0x4561ea;};'use strict';var _=require(_0xcbe3('0x0'));var util=require(_0xcbe3('0x1'));var moment=require(_0xcbe3('0x2'));var BPromise=require(_0xcbe3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcbe3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcbe3('0x5'));var config=require('../../config/environment');var jayson=require(_0xcbe3('0x6'));var client=jayson['client'][_0xcbe3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x242780,_0x42276e,_0x560ad3){return new BPromise(function(_0x1d25e0,_0x2a46a3){return client[_0xcbe3('0x8')](_0x242780,_0x560ad3)[_0xcbe3('0x9')](function(_0x9db5ae){logger[_0xcbe3('0xa')]('CmContactHasItem,\x20%s,\x20%s',_0x42276e,_0xcbe3('0xb'));logger[_0xcbe3('0xc')](_0xcbe3('0xd'),_0x42276e,_0xcbe3('0xb'),JSON['stringify'](_0x9db5ae));if(_0x9db5ae[_0xcbe3('0xe')]){if(_0x9db5ae[_0xcbe3('0xe')][_0xcbe3('0xf')]===0x1f4){logger[_0xcbe3('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x42276e,_0x9db5ae[_0xcbe3('0xe')][_0xcbe3('0x10')]);return _0x2a46a3(_0x9db5ae[_0xcbe3('0xe')][_0xcbe3('0x10')]);}logger[_0xcbe3('0xe')](_0xcbe3('0x11'),_0x42276e,_0x9db5ae['error'][_0xcbe3('0x10')]);return _0x1d25e0(_0x9db5ae[_0xcbe3('0xe')][_0xcbe3('0x10')]);}else{logger[_0xcbe3('0xa')](_0xcbe3('0x11'),_0x42276e,_0xcbe3('0xb'));_0x1d25e0(_0x9db5ae['result'][_0xcbe3('0x10')]);}})[_0xcbe3('0x12')](function(_0x96ff32){logger[_0xcbe3('0xe')](_0xcbe3('0x11'),_0x42276e,_0x96ff32);_0x2a46a3(_0x96ff32);});});} \ No newline at end of file +var _0x4509=['request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x36df0b,_0x461795){var _0x326ed7=function(_0x12e8b2){while(--_0x12e8b2){_0x36df0b['push'](_0x36df0b['shift']());}};_0x326ed7(++_0x461795);}(_0x4509,0xd7));var _0x9450=function(_0x24fc52,_0x12cf9f){_0x24fc52=_0x24fc52-0x0;var _0x344dfc=_0x4509[_0x24fc52];return _0x344dfc;};'use strict';var _=require(_0x9450('0x0'));var util=require(_0x9450('0x1'));var moment=require(_0x9450('0x2'));var BPromise=require('bluebird');var rs=require(_0x9450('0x3'));var fs=require('fs');var Redis=require(_0x9450('0x4'));var db=require(_0x9450('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9450('0x6'))(_0x9450('0x7'));var config=require(_0x9450('0x8'));var jayson=require(_0x9450('0x9'));var client=jayson[_0x9450('0xa')][_0x9450('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e4a97,_0x2ef1e9,_0x2efc8a){return new BPromise(function(_0x2d1deb,_0x2de5e4){return client[_0x9450('0xc')](_0x4e4a97,_0x2efc8a)[_0x9450('0xd')](function(_0x4ed083){logger[_0x9450('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x2ef1e9,_0x9450('0xf'));logger['debug'](_0x9450('0x10'),_0x2ef1e9,_0x9450('0xf'),JSON[_0x9450('0x11')](_0x4ed083));if(_0x4ed083[_0x9450('0x12')]){if(_0x4ed083['error'][_0x9450('0x13')]===0x1f4){logger['error'](_0x9450('0x14'),_0x2ef1e9,_0x4ed083[_0x9450('0x12')]['message']);return _0x2de5e4(_0x4ed083['error']['message']);}logger['error'](_0x9450('0x14'),_0x2ef1e9,_0x4ed083[_0x9450('0x12')][_0x9450('0x15')]);return _0x2d1deb(_0x4ed083[_0x9450('0x12')]['message']);}else{logger[_0x9450('0xe')](_0x9450('0x14'),_0x2ef1e9,_0x9450('0xf'));_0x2d1deb(_0x4ed083['result'][_0x9450('0x15')]);}})[_0x9450('0x16')](function(_0x22d721){logger[_0x9450('0x12')](_0x9450('0x14'),_0x2ef1e9,_0x22d721);_0x2de5e4(_0x22d721);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 01e67e0..67f7456 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd37e=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create'];(function(_0x16cb0a,_0x232a84){var _0x9fe966=function(_0x3e1a1c){while(--_0x3e1a1c){_0x16cb0a['push'](_0x16cb0a['shift']());}};_0x9fe966(++_0x232a84);}(_0xd37e,0x6a));var _0xed37=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xd37e[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0xed37('0x0'));var util=require('util');var path=require(_0xed37('0x1'));var timeout=require(_0xed37('0x2'));var express=require(_0xed37('0x3'));var router=express[_0xed37('0x4')]();var fs_extra=require(_0xed37('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xed37('0x6'));var config=require(_0xed37('0x7'));var controller=require('./cmContactHasItem.controller');router[_0xed37('0x8')]('/',auth[_0xed37('0x9')](),controller['index']);router[_0xed37('0x8')](_0xed37('0xa'),auth[_0xed37('0x9')](),controller['show']);router[_0xed37('0xb')]('/',auth[_0xed37('0x9')](),controller[_0xed37('0xc')]);router[_0xed37('0xd')](_0xed37('0xa'),auth[_0xed37('0x9')](),controller[_0xed37('0xe')]);router[_0xed37('0xf')]('/:id',auth[_0xed37('0x9')](),controller[_0xed37('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe137=['./cmContactHasItem.controller','get','isAuthenticated','index','show','post','create','update','delete','/:id','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4bea9b,_0x20f36f){var _0x401452=function(_0x5e5c12){while(--_0x5e5c12){_0x4bea9b['push'](_0x4bea9b['shift']());}};_0x401452(++_0x20f36f);}(_0xe137,0xdd));var _0x7e13=function(_0x56a871,_0x18b7fe){_0x56a871=_0x56a871-0x0;var _0x124954=_0xe137[_0x56a871];return _0x124954;};'use strict';var multer=require('multer');var util=require(_0x7e13('0x0'));var path=require('path');var timeout=require(_0x7e13('0x1'));var express=require(_0x7e13('0x2'));var router=express[_0x7e13('0x3')]();var fs_extra=require(_0x7e13('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7e13('0x5'));var config=require(_0x7e13('0x6'));var controller=require(_0x7e13('0x7'));router[_0x7e13('0x8')]('/',auth[_0x7e13('0x9')](),controller[_0x7e13('0xa')]);router[_0x7e13('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x7e13('0xb')]);router[_0x7e13('0xc')]('/',auth['isAuthenticated'](),controller[_0x7e13('0xd')]);router['put']('/:id',auth[_0x7e13('0x9')](),controller[_0x7e13('0xe')]);router[_0x7e13('0xf')](_0x7e13('0x10'),auth[_0x7e13('0x9')](),controller[_0x7e13('0x11')]);module[_0x7e13('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 25ff1d8..be4142f 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 _0x6108=['parse','values','isArray','setDataValue','BOOLEAN','ENUM','sequelize','exports','VIRTUAL','STRING','getDataValue','name','TEXT','select'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x6108,0xbc));var _0x8610=function(_0x1c935a,_0x5df5b6){_0x1c935a=_0x1c935a-0x0;var _0x47bc3e=_0x6108[_0x1c935a];return _0x47bc3e;};'use strict';var Sequelize=require(_0x8610('0x0'));var _=require('lodash');module[_0x8610('0x1')]={'name':{'type':Sequelize[_0x8610('0x2')],'get':function(_0x19a0a6){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0x8610('0x3')],'allowNull':![],'set':function(_0x42741d){this['setDataValue']('alias',_0x42741d?_0x42741d:this[_0x8610('0x4')](_0x8610('0x5')));}},'type':{'type':Sequelize[_0x8610('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x8610('0x6')]('long'),'get':function(){if(this[_0x8610('0x4')]('type')===_0x8610('0x7')){return JSON[_0x8610('0x8')](this[_0x8610('0x4')]('values'));}else{return this[_0x8610('0x4')](_0x8610('0x9'));}},'set':function(_0x46854f){if(Array[_0x8610('0xa')](_0x46854f)){this[_0x8610('0xb')](_0x8610('0x9'),JSON['stringify'](_0x46854f));}else{this[_0x8610('0xb')](_0x8610('0x9'),_0x46854f);}}},'required':{'type':Sequelize[_0x8610('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x8610('0xd')]('voice')}}; \ No newline at end of file +var _0xcb66=['select','parse','values','isArray','BOOLEAN','ENUM','voice','lodash','exports','VIRTUAL','getDataValue','STRING','setDataValue','alias','TEXT','long','type'];(function(_0x111c69,_0x5445d8){var _0x5635bc=function(_0x1cfc18){while(--_0x1cfc18){_0x111c69['push'](_0x111c69['shift']());}};_0x5635bc(++_0x5445d8);}(_0xcb66,0x19f));var _0x6cb6=function(_0x5d860f,_0x467498){_0x5d860f=_0x5d860f-0x0;var _0x236490=_0xcb66[_0x5d860f];return _0x236490;};'use strict';var Sequelize=require('sequelize');var _=require(_0x6cb6('0x0'));module[_0x6cb6('0x1')]={'name':{'type':Sequelize[_0x6cb6('0x2')],'get':function(_0x3f607b){return this[_0x6cb6('0x3')]('alias');}},'alias':{'type':Sequelize[_0x6cb6('0x4')],'allowNull':![],'set':function(_0x2d7dbb){this[_0x6cb6('0x5')](_0x6cb6('0x6'),_0x2d7dbb?_0x2d7dbb:this[_0x6cb6('0x3')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x6cb6('0x7')](_0x6cb6('0x8')),'get':function(){if(this[_0x6cb6('0x3')](_0x6cb6('0x9'))===_0x6cb6('0xa')){return JSON[_0x6cb6('0xb')](this[_0x6cb6('0x3')](_0x6cb6('0xc')));}else{return this[_0x6cb6('0x3')](_0x6cb6('0xc'));}},'set':function(_0x3aa2b5){if(Array[_0x6cb6('0xd')](_0x3aa2b5)){this[_0x6cb6('0x5')]('values',JSON['stringify'](_0x3aa2b5));}else{this['setDataValue']('values',_0x3aa2b5);}}},'required':{'type':Sequelize[_0x6cb6('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x6cb6('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x6cb6('0xf')](_0x6cb6('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index b0e77d9..d25f4f0 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 _0x5c86=['map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','CmCustomField','includeAll','include','rows','params','length','find','catch','body','sequelize','transaction','create','TEXT','Sequelize','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','type','key','model'];(function(_0x5f40b0,_0x474694){var _0x319418=function(_0x433b7a){while(--_0x433b7a){_0x5f40b0['push'](_0x5f40b0['shift']());}};_0x319418(++_0x474694);}(_0x5c86,0x1dd));var _0x65c8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5c86[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x65c8('0x0'));var rimraf=require(_0x65c8('0x1'));var zipdir=require(_0x65c8('0x2'));var jsonpatch=require(_0x65c8('0x3'));var rp=require(_0x65c8('0x4'));var moment=require(_0x65c8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x65c8('0x6'));var path=require(_0x65c8('0x7'));var sox=require(_0x65c8('0x8'));var csv=require('to-csv');var ejs=require(_0x65c8('0x9'));var fs=require('fs');var fs_extra=require(_0x65c8('0xa'));var _=require(_0x65c8('0xb'));var squel=require(_0x65c8('0xc'));var crypto=require(_0x65c8('0xd'));var jsforce=require(_0x65c8('0xe'));var deskjs=require(_0x65c8('0xf'));var toCsv=require(_0x65c8('0x10'));var querystring=require(_0x65c8('0x11'));var Papa=require(_0x65c8('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x65c8('0x13'));var as=require(_0x65c8('0x14'));var hardwareService=require(_0x65c8('0x15'));var logger=require(_0x65c8('0x16'))(_0x65c8('0x17'));var utils=require(_0x65c8('0x18'));var config=require(_0x65c8('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ca267,_0x56fb8d){_0x56fb8d=_0x56fb8d||0xcc;return function(_0x2c6f79){if(_0x2c6f79){return _0x3ca267[_0x65c8('0x1a')](_0x56fb8d);}return _0x3ca267[_0x65c8('0x1b')](_0x56fb8d)[_0x65c8('0x1c')]();};}function respondWithResult(_0x22c617,_0xc44bbf){_0xc44bbf=_0xc44bbf||0xc8;return function(_0x1119d6){if(_0x1119d6){return _0x22c617['status'](_0xc44bbf)[_0x65c8('0x1d')](_0x1119d6);}};}function respondWithFilteredResult(_0x443ead,_0xde2a){return function(_0x259889){if(_0x259889){var _0x3cb3c6=typeof _0xde2a[_0x65c8('0x1e')]===_0x65c8('0x1f')&&typeof _0xde2a['limit']==='undefined';var _0x3ca69a=_0x259889[_0x65c8('0x20')];var _0x2769b8=_0x3cb3c6?0x0:_0xde2a[_0x65c8('0x1e')];var _0x47dfdf=_0x3cb3c6?_0x259889[_0x65c8('0x20')]:_0xde2a[_0x65c8('0x1e')]+_0xde2a[_0x65c8('0x21')];var _0x4bddd6;if(_0x47dfdf>=_0x3ca69a){_0x47dfdf=_0x3ca69a;_0x4bddd6=0xc8;}else{_0x4bddd6=0xce;}_0x443ead[_0x65c8('0x1b')](_0x4bddd6);return _0x443ead[_0x65c8('0x22')](_0x65c8('0x23'),_0x2769b8+'-'+_0x47dfdf+'/'+_0x3ca69a)[_0x65c8('0x1d')](_0x259889);}return null;};}function patchUpdates(_0x5a1719){return function(_0x5db31a){try{jsonpatch[_0x65c8('0x24')](_0x5db31a,_0x5a1719,!![]);}catch(_0x29148c){return BPromise[_0x65c8('0x25')](_0x29148c);}return _0x5db31a[_0x65c8('0x26')]();};}function saveUpdates(_0x5bd7a5,_0x1ef5db){return function(_0x52b6db){if(_0x52b6db){return _0x52b6db[_0x65c8('0x27')](_0x5bd7a5)[_0x65c8('0x28')](function(_0x4a6633){return _0x4a6633;});}return null;};}function removeEntity(_0x15ddbd,_0x490011){return function(_0x968308){if(_0x968308){return _0x968308[_0x65c8('0x29')]()['then'](function(){_0x15ddbd[_0x65c8('0x1b')](0xcc)[_0x65c8('0x1c')]();});}};}function handleEntityNotFound(_0x222a87,_0x149b7c){return function(_0x1322ae){if(!_0x1322ae){_0x222a87['sendStatus'](0x194);}return _0x1322ae;};}function handleError(_0x5dfb27,_0x466004){_0x466004=_0x466004||0x1f4;return function(_0x579021){logger[_0x65c8('0x2a')](_0x579021[_0x65c8('0x2b')]);if(_0x579021['name']){delete _0x579021[_0x65c8('0x2c')];}_0x5dfb27[_0x65c8('0x1b')](_0x466004)[_0x65c8('0x2d')](_0x579021);};}exports[_0x65c8('0x2e')]=function(_0x332564,_0x1e4340){var _0x4f0ed8={},_0x31509a={},_0x4e0295={'count':0x0,'rows':[]};var _0x3d60f2=_['map'](db['CmCustomField'][_0x65c8('0x2f')],function(_0x10861d){return{'name':_0x10861d['fieldName'],'type':_0x10861d[_0x65c8('0x30')][_0x65c8('0x31')]};});_0x31509a[_0x65c8('0x32')]=_['differenceBy'](_[_0x65c8('0x33')](_0x3d60f2,_0x65c8('0x2c')),[_0x65c8('0x2c')]);_0x31509a[_0x65c8('0x34')]=_[_0x65c8('0x35')](_0x332564[_0x65c8('0x34')]);_0x31509a[_0x65c8('0x36')]=_[_0x65c8('0x37')](_0x31509a[_0x65c8('0x32')],_0x31509a['query']);_0x4f0ed8[_0x65c8('0x38')]=_[_0x65c8('0x37')](_0x31509a[_0x65c8('0x32')],qs[_0x65c8('0x39')](_0x332564[_0x65c8('0x34')][_0x65c8('0x39')]));_0x4f0ed8[_0x65c8('0x38')]=_0x4f0ed8[_0x65c8('0x38')]['length']?_0x4f0ed8[_0x65c8('0x38')]:_0x31509a[_0x65c8('0x32')];if(!_0x332564[_0x65c8('0x34')][_0x65c8('0x3a')](_0x65c8('0x3b'))){_0x4f0ed8[_0x65c8('0x21')]=qs[_0x65c8('0x21')](_0x332564[_0x65c8('0x34')][_0x65c8('0x21')]);_0x4f0ed8['offset']=qs['offset'](_0x332564[_0x65c8('0x34')][_0x65c8('0x1e')]);}_0x4f0ed8[_0x65c8('0x3c')]=qs['sort'](_0x332564[_0x65c8('0x34')][_0x65c8('0x3d')]);_0x4f0ed8[_0x65c8('0x3e')]=qs[_0x65c8('0x36')](_[_0x65c8('0x3f')](_0x332564[_0x65c8('0x34')],_0x31509a['filters']),_0x3d60f2);if(_0x332564[_0x65c8('0x34')][_0x65c8('0x40')]){_0x4f0ed8[_0x65c8('0x3e')]=_[_0x65c8('0x41')](_0x4f0ed8[_0x65c8('0x3e')],{'$or':_[_0x65c8('0x33')](_0x3d60f2,function(_0x48787c){if(_0x48787c[_0x65c8('0x30')]!==_0x65c8('0x42')){var _0x552ca5={};_0x552ca5[_0x48787c['name']]={'$like':'%'+_0x332564[_0x65c8('0x34')]['filter']+'%'};return _0x552ca5;}})});}_0x4f0ed8=_['merge']({},_0x4f0ed8,_0x332564['options']);var _0x5d73a2={'where':_0x4f0ed8[_0x65c8('0x3e')]};return db[_0x65c8('0x43')][_0x65c8('0x20')](_0x5d73a2)['then'](function(_0x3e22d8){_0x4e0295[_0x65c8('0x20')]=_0x3e22d8;if(_0x332564['query'][_0x65c8('0x44')]){_0x4f0ed8[_0x65c8('0x45')]=[{'all':!![]}];}return db[_0x65c8('0x43')]['findAll'](_0x4f0ed8);})['then'](function(_0x315f9d){_0x4e0295[_0x65c8('0x46')]=_0x315f9d;return _0x4e0295;})[_0x65c8('0x28')](respondWithFilteredResult(_0x1e4340,_0x4f0ed8))['catch'](handleError(_0x1e4340,null));};exports['show']=function(_0x56bcf1,_0x19ca8c){var _0x5233a7={'raw':!![],'where':{'id':_0x56bcf1[_0x65c8('0x47')]['id']}},_0x3d9dde={};_0x3d9dde[_0x65c8('0x32')]=_[_0x65c8('0x35')](db['CmCustomField'][_0x65c8('0x2f')]);_0x3d9dde[_0x65c8('0x34')]=_[_0x65c8('0x35')](_0x56bcf1[_0x65c8('0x34')]);_0x3d9dde[_0x65c8('0x36')]=_[_0x65c8('0x37')](_0x3d9dde[_0x65c8('0x32')],_0x3d9dde['query']);_0x5233a7['attributes']=_[_0x65c8('0x37')](_0x3d9dde['model'],qs['fields'](_0x56bcf1[_0x65c8('0x34')]['fields']));_0x5233a7['attributes']=_0x5233a7['attributes'][_0x65c8('0x48')]?_0x5233a7[_0x65c8('0x38')]:_0x3d9dde[_0x65c8('0x32')];if(_0x56bcf1[_0x65c8('0x34')][_0x65c8('0x44')]){_0x5233a7[_0x65c8('0x45')]=[{'all':!![]}];}_0x5233a7=_['merge']({},_0x5233a7,_0x56bcf1['options']);return db[_0x65c8('0x43')][_0x65c8('0x49')](_0x5233a7)[_0x65c8('0x28')](handleEntityNotFound(_0x19ca8c,null))[_0x65c8('0x28')](respondWithResult(_0x19ca8c,null))[_0x65c8('0x4a')](handleError(_0x19ca8c,null));};exports[_0x65c8('0x27')]=function(_0x457933,_0x537c0a){if(_0x457933[_0x65c8('0x4b')]['id']){delete _0x457933['body']['id'];}return db[_0x65c8('0x43')][_0x65c8('0x49')]({'where':{'id':_0x457933[_0x65c8('0x47')]['id']}})[_0x65c8('0x28')](handleEntityNotFound(_0x537c0a,null))[_0x65c8('0x28')](saveUpdates(_0x457933[_0x65c8('0x4b')],null))['then'](respondWithResult(_0x537c0a,null))[_0x65c8('0x4a')](handleError(_0x537c0a,null));};exports[_0x65c8('0x29')]=function(_0x40323a,_0x298594){return db['CmCustomField']['find']({'where':{'id':_0x40323a[_0x65c8('0x47')]['id']}})[_0x65c8('0x28')](handleEntityNotFound(_0x298594,null))[_0x65c8('0x28')](removeEntity(_0x298594,null))[_0x65c8('0x4a')](handleError(_0x298594,null));};exports['create']=function(_0x4638da,_0x18f636){var _0x163247;return db[_0x65c8('0x4c')][_0x65c8('0x4d')](function(_0x32c0e8){return db[_0x65c8('0x43')][_0x65c8('0x4e')](_0x4638da[_0x65c8('0x4b')],{'transaction':_0x32c0e8})['then'](function(_0x24fba7){_0x163247=_0x24fba7;var _0x36e58b={'type':db['Sequelize'][_0x65c8('0x4f')],'transaction':_0x32c0e8};switch(_0x4638da[_0x65c8('0x4b')][_0x65c8('0x30')]){case'text':_0x36e58b[_0x65c8('0x30')]=db[_0x65c8('0x50')]['TEXT'];break;case _0x65c8('0x51'):_0x36e58b[_0x65c8('0x30')]=db['Sequelize'][_0x65c8('0x52')];break;case'switch':_0x36e58b[_0x65c8('0x30')]=db['Sequelize'][_0x65c8('0x53')];_0x36e58b[_0x65c8('0x54')]=![];break;default:}return db[_0x65c8('0x4c')][_0x65c8('0x55')][_0x65c8('0x56')](_0x65c8('0x57'),util['format']('cf_%d',_0x163247['id']),_0x36e58b);})[_0x65c8('0x28')](function(){return _0x163247;});})[_0x65c8('0x28')](respondWithResult(_0x18f636,0xc9))['catch'](handleError(_0x18f636,null));}; \ No newline at end of file +var _0x305e=['switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','save','update','destroy','then','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','differenceBy','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','create','Sequelize','TEXT','number','INTEGER'];(function(_0x4d462e,_0x1339a3){var _0x37c688=function(_0x179948){while(--_0x179948){_0x4d462e['push'](_0x4d462e['shift']());}};_0x37c688(++_0x1339a3);}(_0x305e,0x16d));var _0xe305=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x305e[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0xe305('0x0'));var rimraf=require(_0xe305('0x1'));var zipdir=require(_0xe305('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe305('0x3'));var moment=require(_0xe305('0x4'));var BPromise=require(_0xe305('0x5'));var Mustache=require(_0xe305('0x6'));var util=require(_0xe305('0x7'));var path=require('path');var sox=require(_0xe305('0x8'));var csv=require('to-csv');var ejs=require(_0xe305('0x9'));var fs=require('fs');var fs_extra=require(_0xe305('0xa'));var _=require(_0xe305('0xb'));var squel=require(_0xe305('0xc'));var crypto=require(_0xe305('0xd'));var jsforce=require(_0xe305('0xe'));var deskjs=require(_0xe305('0xf'));var toCsv=require(_0xe305('0x10'));var querystring=require(_0xe305('0x11'));var Papa=require('papaparse');var Redis=require(_0xe305('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe305('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe305('0x14'));var logger=require('../../config/logger')(_0xe305('0x15'));var utils=require(_0xe305('0x16'));var config=require(_0xe305('0x17'));var licenseUtil=require(_0xe305('0x18'));var db=require(_0xe305('0x19'))['db'];function respondWithStatusCode(_0x1436f9,_0x513ead){_0x513ead=_0x513ead||0xcc;return function(_0x5ceb5d){if(_0x5ceb5d){return _0x1436f9[_0xe305('0x1a')](_0x513ead);}return _0x1436f9[_0xe305('0x1b')](_0x513ead)[_0xe305('0x1c')]();};}function respondWithResult(_0x2a6f3d,_0x4dc34b){_0x4dc34b=_0x4dc34b||0xc8;return function(_0x16cf58){if(_0x16cf58){return _0x2a6f3d[_0xe305('0x1b')](_0x4dc34b)[_0xe305('0x1d')](_0x16cf58);}};}function respondWithFilteredResult(_0x6cb00c,_0x2fa058){return function(_0x21c651){if(_0x21c651){var _0x36d558=typeof _0x2fa058['offset']==='undefined'&&typeof _0x2fa058[_0xe305('0x1e')]===_0xe305('0x1f');var _0x18b62b=_0x21c651[_0xe305('0x20')];var _0x1469bc=_0x36d558?0x0:_0x2fa058[_0xe305('0x21')];var _0x3efd0a=_0x36d558?_0x21c651['count']:_0x2fa058[_0xe305('0x21')]+_0x2fa058[_0xe305('0x1e')];var _0x42b8a5;if(_0x3efd0a>=_0x18b62b){_0x3efd0a=_0x18b62b;_0x42b8a5=0xc8;}else{_0x42b8a5=0xce;}_0x6cb00c[_0xe305('0x1b')](_0x42b8a5);return _0x6cb00c['set'](_0xe305('0x22'),_0x1469bc+'-'+_0x3efd0a+'/'+_0x18b62b)[_0xe305('0x1d')](_0x21c651);}return null;};}function patchUpdates(_0x430c8f){return function(_0x2be6b2){try{jsonpatch['apply'](_0x2be6b2,_0x430c8f,!![]);}catch(_0x1a61d9){return BPromise[_0xe305('0x23')](_0x1a61d9);}return _0x2be6b2[_0xe305('0x24')]();};}function saveUpdates(_0x2835d6,_0xe1b874){return function(_0x2f57c3){if(_0x2f57c3){return _0x2f57c3[_0xe305('0x25')](_0x2835d6)['then'](function(_0x31e795){return _0x31e795;});}return null;};}function removeEntity(_0x23541f,_0x41d288){return function(_0x43121c){if(_0x43121c){return _0x43121c[_0xe305('0x26')]()[_0xe305('0x27')](function(){_0x23541f[_0xe305('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f2732,_0x5583b0){return function(_0x5d37fb){if(!_0x5d37fb){_0x3f2732[_0xe305('0x1a')](0x194);}return _0x5d37fb;};}function handleError(_0x4dc524,_0x1c905f){_0x1c905f=_0x1c905f||0x1f4;return function(_0x16c0c5){logger['error'](_0x16c0c5['stack']);if(_0x16c0c5['name']){delete _0x16c0c5[_0xe305('0x28')];}_0x4dc524[_0xe305('0x1b')](_0x1c905f)[_0xe305('0x29')](_0x16c0c5);};}exports[_0xe305('0x2a')]=function(_0x2ad6a1,_0x31b1ac){var _0x2a0c05={},_0x1b8ebe={},_0x37c824={'count':0x0,'rows':[]};var _0x393197=_[_0xe305('0x2b')](db[_0xe305('0x2c')][_0xe305('0x2d')],function(_0x34ae58){return{'name':_0x34ae58[_0xe305('0x2e')],'type':_0x34ae58[_0xe305('0x2f')]['key']};});_0x1b8ebe['model']=_[_0xe305('0x30')](_[_0xe305('0x2b')](_0x393197,_0xe305('0x28')),['name']);_0x1b8ebe[_0xe305('0x31')]=_['keys'](_0x2ad6a1[_0xe305('0x31')]);_0x1b8ebe[_0xe305('0x32')]=_['intersection'](_0x1b8ebe[_0xe305('0x33')],_0x1b8ebe[_0xe305('0x31')]);_0x2a0c05[_0xe305('0x34')]=_[_0xe305('0x35')](_0x1b8ebe[_0xe305('0x33')],qs[_0xe305('0x36')](_0x2ad6a1[_0xe305('0x31')][_0xe305('0x36')]));_0x2a0c05[_0xe305('0x34')]=_0x2a0c05[_0xe305('0x34')][_0xe305('0x37')]?_0x2a0c05[_0xe305('0x34')]:_0x1b8ebe[_0xe305('0x33')];if(!_0x2ad6a1['query']['hasOwnProperty'](_0xe305('0x38'))){_0x2a0c05[_0xe305('0x1e')]=qs['limit'](_0x2ad6a1[_0xe305('0x31')][_0xe305('0x1e')]);_0x2a0c05[_0xe305('0x21')]=qs[_0xe305('0x21')](_0x2ad6a1['query'][_0xe305('0x21')]);}_0x2a0c05[_0xe305('0x39')]=qs[_0xe305('0x3a')](_0x2ad6a1['query'][_0xe305('0x3a')]);_0x2a0c05['where']=qs[_0xe305('0x32')](_[_0xe305('0x3b')](_0x2ad6a1[_0xe305('0x31')],_0x1b8ebe[_0xe305('0x32')]),_0x393197);if(_0x2ad6a1[_0xe305('0x31')]['filter']){_0x2a0c05[_0xe305('0x3c')]=_[_0xe305('0x3d')](_0x2a0c05[_0xe305('0x3c')],{'$or':_['map'](_0x393197,function(_0x13ea7d){if(_0x13ea7d['type']!==_0xe305('0x3e')){var _0x46f236={};_0x46f236[_0x13ea7d[_0xe305('0x28')]]={'$like':'%'+_0x2ad6a1[_0xe305('0x31')][_0xe305('0x3f')]+'%'};return _0x46f236;}})});}_0x2a0c05=_[_0xe305('0x3d')]({},_0x2a0c05,_0x2ad6a1[_0xe305('0x40')]);var _0x45c2de={'where':_0x2a0c05[_0xe305('0x3c')]};return db[_0xe305('0x2c')][_0xe305('0x20')](_0x45c2de)[_0xe305('0x27')](function(_0x1a6798){_0x37c824[_0xe305('0x20')]=_0x1a6798;if(_0x2ad6a1['query'][_0xe305('0x41')]){_0x2a0c05[_0xe305('0x42')]=[{'all':!![]}];}return db[_0xe305('0x2c')][_0xe305('0x43')](_0x2a0c05);})['then'](function(_0x36e2d0){_0x37c824[_0xe305('0x44')]=_0x36e2d0;return _0x37c824;})[_0xe305('0x27')](respondWithFilteredResult(_0x31b1ac,_0x2a0c05))[_0xe305('0x45')](handleError(_0x31b1ac,null));};exports[_0xe305('0x46')]=function(_0x3e90f6,_0x1e960a){var _0x40ad3f={'raw':!![],'where':{'id':_0x3e90f6[_0xe305('0x47')]['id']}},_0x2a90ca={};_0x2a90ca[_0xe305('0x33')]=_['keys'](db[_0xe305('0x2c')][_0xe305('0x2d')]);_0x2a90ca[_0xe305('0x31')]=_[_0xe305('0x48')](_0x3e90f6[_0xe305('0x31')]);_0x2a90ca['filters']=_[_0xe305('0x35')](_0x2a90ca['model'],_0x2a90ca['query']);_0x40ad3f[_0xe305('0x34')]=_[_0xe305('0x35')](_0x2a90ca['model'],qs[_0xe305('0x36')](_0x3e90f6[_0xe305('0x31')][_0xe305('0x36')]));_0x40ad3f[_0xe305('0x34')]=_0x40ad3f[_0xe305('0x34')][_0xe305('0x37')]?_0x40ad3f['attributes']:_0x2a90ca[_0xe305('0x33')];if(_0x3e90f6[_0xe305('0x31')][_0xe305('0x41')]){_0x40ad3f[_0xe305('0x42')]=[{'all':!![]}];}_0x40ad3f=_['merge']({},_0x40ad3f,_0x3e90f6[_0xe305('0x40')]);return db['CmCustomField'][_0xe305('0x49')](_0x40ad3f)[_0xe305('0x27')](handleEntityNotFound(_0x1e960a,null))[_0xe305('0x27')](respondWithResult(_0x1e960a,null))['catch'](handleError(_0x1e960a,null));};exports['update']=function(_0x3037aa,_0x1ee78a){if(_0x3037aa['body']['id']){delete _0x3037aa[_0xe305('0x4a')]['id'];}return db[_0xe305('0x2c')][_0xe305('0x49')]({'where':{'id':_0x3037aa[_0xe305('0x47')]['id']}})[_0xe305('0x27')](handleEntityNotFound(_0x1ee78a,null))['then'](saveUpdates(_0x3037aa['body'],null))['then'](respondWithResult(_0x1ee78a,null))[_0xe305('0x45')](handleError(_0x1ee78a,null));};exports[_0xe305('0x26')]=function(_0xcec947,_0x12da34){return db[_0xe305('0x2c')][_0xe305('0x49')]({'where':{'id':_0xcec947[_0xe305('0x47')]['id']}})[_0xe305('0x27')](handleEntityNotFound(_0x12da34,null))[_0xe305('0x27')](removeEntity(_0x12da34,null))[_0xe305('0x45')](handleError(_0x12da34,null));};exports[_0xe305('0x4b')]=function(_0x236507,_0x3ebf10){var _0x5d4213;return db['sequelize']['transaction'](function(_0x950b5e){return db['CmCustomField']['create'](_0x236507[_0xe305('0x4a')],{'transaction':_0x950b5e})[_0xe305('0x27')](function(_0x143293){_0x5d4213=_0x143293;var _0x2bea0d={'type':db[_0xe305('0x4c')][_0xe305('0x4d')],'transaction':_0x950b5e};switch(_0x236507['body'][_0xe305('0x2f')]){case'text':_0x2bea0d[_0xe305('0x2f')]=db['Sequelize']['TEXT'];break;case _0xe305('0x4e'):_0x2bea0d[_0xe305('0x2f')]=db['Sequelize'][_0xe305('0x4f')];break;case _0xe305('0x50'):_0x2bea0d[_0xe305('0x2f')]=db['Sequelize'][_0xe305('0x51')];_0x2bea0d[_0xe305('0x52')]=![];break;default:}return db[_0xe305('0x53')][_0xe305('0x54')][_0xe305('0x55')](_0xe305('0x56'),util[_0xe305('0x57')](_0xe305('0x58'),_0x5d4213['id']),_0x2bea0d);})[_0xe305('0x27')](function(){return _0x5d4213;});})['then'](respondWithResult(_0x3ebf10,0xc9))[_0xe305('0x45')](handleError(_0x3ebf10,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 5af7fa7..6c211b0 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 _0xfdd6=['CmCustomField','cm_custom_fields','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes','define'];(function(_0x244c8b,_0xd32ad0){var _0x28ea67=function(_0x4b0e78){while(--_0x4b0e78){_0x244c8b['push'](_0x244c8b['shift']());}};_0x28ea67(++_0xd32ad0);}(_0xfdd6,0x1af));var _0x6fdd=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0xfdd6[_0x5a7d5f];return _0x5dcded;};'use strict';var _=require('lodash');var util=require(_0x6fdd('0x0'));var logger=require(_0x6fdd('0x1'))('api');var moment=require(_0x6fdd('0x2'));var BPromise=require(_0x6fdd('0x3'));var rp=require(_0x6fdd('0x4'));var fs=require('fs');var path=require(_0x6fdd('0x5'));var rimraf=require('rimraf');var config=require(_0x6fdd('0x6'));var attributes=require(_0x6fdd('0x7'));module['exports']=function(_0x51e323,_0x2f0956){return _0x51e323[_0x6fdd('0x8')](_0x6fdd('0x9'),attributes,{'tableName':_0x6fdd('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa92a=['api','moment','bluebird','path','define','CmCustomField','cm_custom_fields','lodash'];(function(_0x5e850b,_0x562dc6){var _0x20291a=function(_0x4df258){while(--_0x4df258){_0x5e850b['push'](_0x5e850b['shift']());}};_0x20291a(++_0x562dc6);}(_0xa92a,0x1c7));var _0xaa92=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0xa92a[_0x1b3564];return _0x504069;};'use strict';var _=require(_0xaa92('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaa92('0x1'));var moment=require(_0xaa92('0x2'));var BPromise=require(_0xaa92('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa92('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x18bbf3,_0x321a7e){return _0x18bbf3[_0xaa92('0x5')](_0xaa92('0x6'),attributes,{'tableName':_0xaa92('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 53556bb..4eee63a 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 _0xb821=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','ioredis'];(function(_0x540a59,_0x14981d){var _0x1d9ef5=function(_0x3040bd){while(--_0x3040bd){_0x540a59['push'](_0x540a59['shift']());}};_0x1d9ef5(++_0x14981d);}(_0xb821,0xa7));var _0x1b82=function(_0x3be334,_0x542897){_0x3be334=_0x3be334-0x0;var _0x12dc93=_0xb821[_0x3be334];return _0x12dc93;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x192434,_0x202a5f,_0x3632dd){return new BPromise(function(_0x18f45f,_0x7b87e8){return client[_0x1b82('0x8')](_0x192434,_0x3632dd)[_0x1b82('0x9')](function(_0x141673){logger['info'](_0x1b82('0xa'),_0x202a5f,_0x1b82('0xb'));logger[_0x1b82('0xc')](_0x1b82('0xd'),_0x202a5f,_0x1b82('0xb'),JSON[_0x1b82('0xe')](_0x141673));if(_0x141673[_0x1b82('0xf')]){if(_0x141673[_0x1b82('0xf')]['code']===0x1f4){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);return _0x7b87e8(_0x141673['error'][_0x1b82('0x10')]);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x202a5f,_0x141673[_0x1b82('0xf')]['message']);return _0x18f45f(_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);}else{logger['info'](_0x1b82('0xa'),_0x202a5f,'request\x20sent');_0x18f45f(_0x141673['result'][_0x1b82('0x10')]);}})['catch'](function(_0x111247){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x111247);_0x7b87e8(_0x111247);});});} \ No newline at end of file +var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x11848b,_0x20c997){var _0x30b95b=function(_0x639f91){while(--_0x639f91){_0x11848b['push'](_0x11848b['shift']());}};_0x30b95b(++_0x20c997);}(_0x55ca,0x126));var _0xa55c=function(_0x4f6f04,_0x59c6ba){_0x4f6f04=_0x4f6f04-0x0;var _0x606b2c=_0x55ca[_0x4f6f04];return _0x606b2c;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('CmCustomField,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('CmCustomField,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 6eded42..dbd181c 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 _0x0b80=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','util'];(function(_0x226cc,_0x38188e){var _0x338f4c=function(_0xcf84d3){while(--_0xcf84d3){_0x226cc['push'](_0x226cc['shift']());}};_0x338f4c(++_0x38188e);}(_0x0b80,0x152));var _0x00b8=function(_0x5a4f92,_0x484a7c){_0x5a4f92=_0x5a4f92-0x0;var _0x427813=_0x0b80[_0x5a4f92];return _0x427813;};'use strict';var multer=require(_0x00b8('0x0'));var util=require(_0x00b8('0x1'));var path=require('path');var timeout=require(_0x00b8('0x2'));var express=require('express');var router=express[_0x00b8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x00b8('0x4'));var interaction=require(_0x00b8('0x5'));var config=require(_0x00b8('0x6'));var controller=require(_0x00b8('0x7'));router['get']('/',auth[_0x00b8('0x8')](),controller[_0x00b8('0x9')]);router['get'](_0x00b8('0xa'),auth[_0x00b8('0x8')](),controller[_0x00b8('0xb')]);router['post']('/',auth[_0x00b8('0x8')](),controller[_0x00b8('0xc')]);router[_0x00b8('0xd')]('/:id',auth[_0x00b8('0x8')](),controller[_0x00b8('0xe')]);router[_0x00b8('0xf')](_0x00b8('0xa'),auth[_0x00b8('0x8')](),controller[_0x00b8('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8808=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0x43eb95,_0x55c45e){var _0x8b3994=function(_0x1cd807){while(--_0x1cd807){_0x43eb95['push'](_0x43eb95['shift']());}};_0x8b3994(++_0x55c45e);}(_0x8808,0x1c7));var _0x8880=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8808[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x8880('0x0'));var path=require(_0x8880('0x1'));var timeout=require(_0x8880('0x2'));var express=require(_0x8880('0x3'));var router=express[_0x8880('0x4')]();var fs_extra=require(_0x8880('0x5'));var auth=require(_0x8880('0x6'));var interaction=require(_0x8880('0x7'));var config=require(_0x8880('0x8'));var controller=require(_0x8880('0x9'));router[_0x8880('0xa')]('/',auth[_0x8880('0xb')](),controller[_0x8880('0xc')]);router[_0x8880('0xa')](_0x8880('0xd'),auth[_0x8880('0xb')](),controller[_0x8880('0xe')]);router[_0x8880('0xf')]('/',auth[_0x8880('0xb')](),controller[_0x8880('0x10')]);router['put']('/:id',auth[_0x8880('0xb')](),controller[_0x8880('0x11')]);router[_0x8880('0x12')](_0x8880('0xd'),auth[_0x8880('0xb')](),controller[_0x8880('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 33be25e..fc6ff43 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 _0xbaf0=['contactListQueue','sequelize','exports','STRING','BOOLEAN','DATE','format','INTEGER','UNSIGNED'];(function(_0x2ec802,_0x2b546a){var _0x366f64=function(_0x1649c7){while(--_0x1649c7){_0x2ec802['push'](_0x2ec802['shift']());}};_0x366f64(++_0x2b546a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var moment=require('moment');var Sequelize=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'phone':{'type':Sequelize[_0x0baf('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x0baf('0x4')],'defaultValue':moment()[_0x0baf('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x0baf('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0baf('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0baf('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0baf('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0baf('0x4')]},'priority':{'type':Sequelize[_0x0baf('0x6')](0x2)[_0x0baf('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x0baf('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x0baf('0x8')},'UserId':{'type':Sequelize[_0x0baf('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x0baf('0x6')],'unique':_0x0baf('0x8')},'CampaignId':{'type':Sequelize[_0x0baf('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x0baf('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0baf('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0baf('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0baf('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0baf('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x0baf('0x6')],'allowNull':!![],'defaultValue':0x0}}; \ No newline at end of file +var _0xa571=['BOOLEAN','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','DATE','format','INTEGER'];(function(_0x40c0dd,_0x171ea5){var _0x2d4984=function(_0x28088a){while(--_0x28088a){_0x40c0dd['push'](_0x40c0dd['shift']());}};_0x2d4984(++_0x171ea5);}(_0xa571,0x107));var _0x1a57=function(_0x3be367,_0x4f89a9){_0x3be367=_0x3be367-0x0;var _0x490567=_0xa571[_0x3be367];return _0x490567;};'use strict';var moment=require(_0x1a57('0x0'));var Sequelize=require(_0x1a57('0x1'));module[_0x1a57('0x2')]={'phone':{'type':Sequelize[_0x1a57('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x1a57('0x4')],'defaultValue':moment()[_0x1a57('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1a57('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x1a57('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1a57('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1a57('0x4')]},'priority':{'type':Sequelize[_0x1a57('0x6')](0x2)[_0x1a57('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x1a57('0x7')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x1a57('0x9')},'ListId':{'type':Sequelize[_0x1a57('0x6')],'unique':_0x1a57('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x1a57('0x6')],'unique':_0x1a57('0x9')},'CampaignId':{'type':Sequelize[_0x1a57('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x1a57('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1a57('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1a57('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1a57('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1a57('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 7eedd60..4a5d38c 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 _0xa9b4=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','set','json','apply','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','key','map','query','keys','intersection','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$notLike','$notILike','$contains','$any','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopper','includeAll','include','findAll','rows','show','params','find','create','body','catch','describe','VoiceQueueId','VoiceQueue','CampaignId','createdAt','updatedAt','state','deleted','campaign','membername','user','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','outbound','preview','dialOrderByScheduledAt','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','format','isNumber','entity\x20not\x20found'];(function(_0x325221,_0x200d4b){var _0x2fb310=function(_0x43fb0d){while(--_0x43fb0d){_0x325221['push'](_0x325221['shift']());}};_0x2fb310(++_0x200d4b);}(_0xa9b4,0x130));var _0x4a9b=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0xa9b4[_0x308213];return _0x2e1619;};'use strict';var emlformat=require(_0x4a9b('0x0'));var rimraf=require(_0x4a9b('0x1'));var zipdir=require(_0x4a9b('0x2'));var jsonpatch=require(_0x4a9b('0x3'));var rp=require(_0x4a9b('0x4'));var moment=require(_0x4a9b('0x5'));var BPromise=require(_0x4a9b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4a9b('0x7'));var sox=require(_0x4a9b('0x8'));var csv=require(_0x4a9b('0x9'));var ejs=require(_0x4a9b('0xa'));var fs=require('fs');var fs_extra=require(_0x4a9b('0xb'));var _=require(_0x4a9b('0xc'));var squel=require(_0x4a9b('0xd'));var crypto=require(_0x4a9b('0xe'));var jsforce=require(_0x4a9b('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4a9b('0x10'));var Papa=require(_0x4a9b('0x11'));var Redis=require(_0x4a9b('0x12'));var authService=require(_0x4a9b('0x13'));var qs=require(_0x4a9b('0x14'));var as=require(_0x4a9b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a9b('0x16'))(_0x4a9b('0x17'));var utils=require('../../config/utils');var config=require(_0x4a9b('0x18'));var licenseUtil=require(_0x4a9b('0x19'));var db=require(_0x4a9b('0x1a'))['db'];function respondWithStatusCode(_0x657930,_0x365d47){_0x365d47=_0x365d47||0xcc;return function(_0x3bc332){if(_0x3bc332){return _0x657930[_0x4a9b('0x1b')](_0x365d47);}return _0x657930[_0x4a9b('0x1c')](_0x365d47)[_0x4a9b('0x1d')]();};}function respondWithResult(_0x4f9f95,_0x3045a8){_0x3045a8=_0x3045a8||0xc8;return function(_0x55fee4){if(_0x55fee4){return _0x4f9f95['status'](_0x3045a8)['json'](_0x55fee4);}};}function respondWithFilteredResult(_0x415e24,_0x10ad23){return function(_0x92c083){if(_0x92c083){var _0x29915f=typeof _0x10ad23['offset']===_0x4a9b('0x1e')&&typeof _0x10ad23['limit']===_0x4a9b('0x1e');var _0x39ba65=_0x92c083[_0x4a9b('0x1f')];var _0x2839ce=_0x29915f?0x0:_0x10ad23[_0x4a9b('0x20')];var _0x521985=_0x29915f?_0x92c083[_0x4a9b('0x1f')]:_0x10ad23[_0x4a9b('0x20')]+_0x10ad23['limit'];var _0x2be502;if(_0x521985>=_0x39ba65){_0x521985=_0x39ba65;_0x2be502=0xc8;}else{_0x2be502=0xce;}_0x415e24[_0x4a9b('0x1c')](_0x2be502);return _0x415e24[_0x4a9b('0x21')]('Content-Range',_0x2839ce+'-'+_0x521985+'/'+_0x39ba65)[_0x4a9b('0x22')](_0x92c083);}return null;};}function patchUpdates(_0x155f1e){return function(_0x43db7f){try{jsonpatch[_0x4a9b('0x23')](_0x43db7f,_0x155f1e,!![]);}catch(_0x241cda){return BPromise['reject'](_0x241cda);}return _0x43db7f[_0x4a9b('0x24')]();};}function saveUpdates(_0x47ce3a,_0x33f114){return function(_0x1a8f9e){if(_0x1a8f9e){return _0x1a8f9e[_0x4a9b('0x25')](_0x47ce3a)[_0x4a9b('0x26')](function(_0x5b1d28){return _0x5b1d28;});}return null;};}function removeEntity(_0x4d15fe,_0x4ca835){return function(_0x2b8859){if(_0x2b8859){return _0x2b8859[_0x4a9b('0x27')]()[_0x4a9b('0x26')](function(){_0x4d15fe[_0x4a9b('0x1c')](0xcc)[_0x4a9b('0x1d')]();});}};}function handleEntityNotFound(_0x55b74d,_0x3a0968){return function(_0x3e196b){if(!_0x3e196b){_0x55b74d['sendStatus'](0x194);}return _0x3e196b;};}function handleError(_0x261989,_0x16d561){_0x16d561=_0x16d561||0x1f4;return function(_0x10ae3a){logger[_0x4a9b('0x28')](_0x10ae3a[_0x4a9b('0x29')]);if(_0x10ae3a[_0x4a9b('0x2a')]){delete _0x10ae3a[_0x4a9b('0x2a')];}_0x261989[_0x4a9b('0x1c')](_0x16d561)['send'](_0x10ae3a);};}exports[_0x4a9b('0x2b')]=function(_0x45816e,_0x3586fd){var _0x2c6b21={},_0x4d12a5={},_0x2cc96f={'count':0x0,'rows':[]};var _0x28fa8c=_['map'](db['CmHopper'][_0x4a9b('0x2c')],function(_0x13a503){return{'name':_0x13a503[_0x4a9b('0x2d')],'type':_0x13a503[_0x4a9b('0x2e')][_0x4a9b('0x2f')]};});_0x4d12a5['model']=_[_0x4a9b('0x30')](_0x28fa8c,'name');_0x4d12a5[_0x4a9b('0x31')]=_[_0x4a9b('0x32')](_0x45816e[_0x4a9b('0x31')]);_0x4d12a5['filters']=_[_0x4a9b('0x33')](_0x4d12a5['model'],_0x4d12a5[_0x4a9b('0x31')]);_0x4d12a5[_0x4a9b('0x34')]=_[_0x4a9b('0x35')](_0x4d12a5[_0x4a9b('0x34')],[_0x4a9b('0x36'),_0x4a9b('0x37'),_0x4a9b('0x38'),_0x4a9b('0x39'),_0x4a9b('0x3a'),_0x4a9b('0x3b'),_0x4a9b('0x3c'),_0x4a9b('0x3d'),_0x4a9b('0x3e'),'$between',_0x4a9b('0x3f'),_0x4a9b('0x40'),_0x4a9b('0x41'),_0x4a9b('0x42'),_0x4a9b('0x43'),'$iLike',_0x4a9b('0x44'),'$like','$overlap',_0x4a9b('0x45'),'$contained',_0x4a9b('0x46')]);_0x2c6b21[_0x4a9b('0x47')]=_['intersection'](_0x4d12a5[_0x4a9b('0x48')],qs[_0x4a9b('0x49')](_0x45816e[_0x4a9b('0x31')][_0x4a9b('0x49')]));_0x2c6b21['attributes']=_0x2c6b21['attributes'][_0x4a9b('0x4a')]?_0x2c6b21['attributes']:_0x4d12a5['model'];if(!_0x45816e[_0x4a9b('0x31')][_0x4a9b('0x4b')](_0x4a9b('0x4c'))){_0x2c6b21[_0x4a9b('0x4d')]=qs[_0x4a9b('0x4d')](_0x45816e[_0x4a9b('0x31')][_0x4a9b('0x4d')]);_0x2c6b21[_0x4a9b('0x20')]=qs[_0x4a9b('0x20')](_0x45816e['query'][_0x4a9b('0x20')]);}_0x2c6b21[_0x4a9b('0x4e')]=qs[_0x4a9b('0x4f')](_0x45816e['query'][_0x4a9b('0x4f')]);_0x2c6b21[_0x4a9b('0x50')]=qs[_0x4a9b('0x34')](_[_0x4a9b('0x51')](_0x45816e[_0x4a9b('0x31')],_0x4d12a5['filters']),_0x28fa8c);if(_0x45816e[_0x4a9b('0x31')][_0x4a9b('0x52')]){_0x2c6b21[_0x4a9b('0x50')]=_[_0x4a9b('0x53')](_0x2c6b21['where'],{'$or':_[_0x4a9b('0x30')](_0x28fa8c,function(_0x46d88e){if(_0x46d88e[_0x4a9b('0x2e')]!==_0x4a9b('0x54')){var _0x41a485={};_0x41a485[_0x46d88e['name']]={'$like':'%'+_0x45816e['query'][_0x4a9b('0x52')]+'%'};return _0x41a485;}})});}_0x2c6b21=_[_0x4a9b('0x53')]({},_0x2c6b21,_0x45816e[_0x4a9b('0x55')]);var _0x2fe69d={'where':_0x2c6b21[_0x4a9b('0x50')]};return db[_0x4a9b('0x56')]['count'](_0x2fe69d)[_0x4a9b('0x26')](function(_0x3f8cda){_0x2cc96f[_0x4a9b('0x1f')]=_0x3f8cda;if(_0x45816e[_0x4a9b('0x31')][_0x4a9b('0x57')]){_0x2c6b21[_0x4a9b('0x58')]=[{'all':!![]}];}return db['CmHopper'][_0x4a9b('0x59')](_0x2c6b21);})[_0x4a9b('0x26')](function(_0x59e0a9){_0x2cc96f[_0x4a9b('0x5a')]=_0x59e0a9;return _0x2cc96f;})['then'](respondWithFilteredResult(_0x3586fd,_0x2c6b21))['catch'](handleError(_0x3586fd,null));};exports[_0x4a9b('0x5b')]=function(_0x4f2852,_0x1d094e){var _0x4af4be={'raw':!![],'where':{'id':_0x4f2852[_0x4a9b('0x5c')]['id']}},_0x995a3f={};_0x995a3f[_0x4a9b('0x48')]=_['keys'](db[_0x4a9b('0x56')]['rawAttributes']);_0x995a3f['query']=_['keys'](_0x4f2852[_0x4a9b('0x31')]);_0x995a3f[_0x4a9b('0x34')]=_[_0x4a9b('0x33')](_0x995a3f[_0x4a9b('0x48')],_0x995a3f[_0x4a9b('0x31')]);_0x4af4be[_0x4a9b('0x47')]=_[_0x4a9b('0x33')](_0x995a3f[_0x4a9b('0x48')],qs['fields'](_0x4f2852[_0x4a9b('0x31')][_0x4a9b('0x49')]));_0x4af4be[_0x4a9b('0x47')]=_0x4af4be[_0x4a9b('0x47')][_0x4a9b('0x4a')]?_0x4af4be[_0x4a9b('0x47')]:_0x995a3f[_0x4a9b('0x48')];if(_0x4f2852[_0x4a9b('0x31')]['includeAll']){_0x4af4be[_0x4a9b('0x58')]=[{'all':!![]}];}_0x4af4be=_[_0x4a9b('0x53')]({},_0x4af4be,_0x4f2852[_0x4a9b('0x55')]);return db[_0x4a9b('0x56')][_0x4a9b('0x5d')](_0x4af4be)[_0x4a9b('0x26')](handleEntityNotFound(_0x1d094e,null))['then'](respondWithResult(_0x1d094e,null))['catch'](handleError(_0x1d094e,null));};exports[_0x4a9b('0x5e')]=function(_0x455352,_0x3bcf57){return db[_0x4a9b('0x56')][_0x4a9b('0x5e')](_0x455352[_0x4a9b('0x5f')],{})[_0x4a9b('0x26')](respondWithResult(_0x3bcf57,0xc9))[_0x4a9b('0x60')](handleError(_0x3bcf57,null));};exports[_0x4a9b('0x25')]=function(_0x2841d8,_0x34a364){if(_0x2841d8[_0x4a9b('0x5f')]['id']){delete _0x2841d8['body']['id'];}return db[_0x4a9b('0x56')][_0x4a9b('0x5d')]({'where':{'id':_0x2841d8[_0x4a9b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x34a364,null))['then'](saveUpdates(_0x2841d8[_0x4a9b('0x5f')],null))[_0x4a9b('0x26')](respondWithResult(_0x34a364,null))[_0x4a9b('0x60')](handleError(_0x34a364,null));};exports[_0x4a9b('0x61')]=function(_0xf50829,_0x4f4395){return db[_0x4a9b('0x56')][_0x4a9b('0x61')]()['then'](respondWithResult(_0x4f4395,null))[_0x4a9b('0x60')](handleError(_0x4f4395,null));};exports[_0x4a9b('0x27')]=function(_0x2cacf1,_0x413bdb){var _0x295b44;var _0x5802c5=_0x2cacf1[_0x4a9b('0x5c')]['id'];return db[_0x4a9b('0x56')][_0x4a9b('0x5d')]({'where':{'id':_0x2cacf1[_0x4a9b('0x5c')]['id']}})[_0x4a9b('0x26')](handleEntityNotFound(_0x413bdb,null))['then'](function(_0x4ec8cf){if(_0x4ec8cf){return _0x4ec8cf['destroy']()['then'](function(_0xb1b615){return _0xb1b615;});}})['then'](function(_0x381b82){_0x295b44=_0x381b82;if(_0x381b82){if(_0x381b82[_0x4a9b('0x62')]||_0x381b82['CampaignId']){return db[_0x381b82[_0x4a9b('0x62')]?_0x4a9b('0x63'):'Campaign'][_0x4a9b('0x5d')]({'where':{'id':_0x381b82['VoiceQueueId']?_0x381b82['VoiceQueueId']:_0x381b82[_0x4a9b('0x64')]},'attributes':['id',_0x4a9b('0x2a')],'raw':!![]});}}})['then'](function(_0x2be94d){var _0x55c1a0={};if(_0x2be94d){_['merge'](_0x55c1a0,_['omit'](_0x295b44['dataValues'],[_0x4a9b('0x65'),_0x4a9b('0x66'),'id']));_0x55c1a0[_0x4a9b('0x67')]=0x15;_0x55c1a0['statedesc']=_0x4a9b('0x68');_0x55c1a0[_0x4a9b('0x69')]=_0x2be94d[_0x4a9b('0x2a')];_0x55c1a0[_0x4a9b('0x6a')]=_0x2cacf1['user'][_0x4a9b('0x2a')];_0x55c1a0['UserId']=_0x2cacf1[_0x4a9b('0x6b')]['id'];_0x55c1a0['deleted']=!![];_0x55c1a0['deletedat']=moment()['format'](_0x4a9b('0x6c'));_0x55c1a0[_0x4a9b('0x6d')]=_0x295b44[_0x4a9b('0x6e')];_0x55c1a0[_0x4a9b('0x6f')]=_0x295b44['VoiceQueueId']?_0x4a9b('0x70'):'ivr';return db[_0x4a9b('0x71')][_0x4a9b('0x5d')]({'where':{'id':_0x55c1a0[_0x4a9b('0x72')]},'attributes':[_0x4a9b('0x73'),_0x4a9b('0x74')]})[_0x4a9b('0x26')](function(_0x403f43){if(!_['isNil'](_0x413bdb)&&!_[_0x4a9b('0x75')](_0x403f43[_0x4a9b('0x73')])){_0x55c1a0[_0x4a9b('0x76')]=_0x403f43[_0x4a9b('0x73')];if(!_['isNil'](_0x403f43[_0x4a9b('0x74')])){_0x55c1a0[_0x4a9b('0x76')]+='\x20'+_0x403f43[_0x4a9b('0x74')];}}})[_0x4a9b('0x77')](function(){return db[_0x4a9b('0x78')][_0x4a9b('0x5e')](_0x55c1a0);});}})[_0x4a9b('0x26')](function(_0x2802c4){return db[_0x4a9b('0x79')]['destroy']({'where':{'CmHopperId':_0x5802c5}});})[_0x4a9b('0x26')](function(){return _0x413bdb[_0x4a9b('0x1c')](0xcc)['end']();})[_0x4a9b('0x60')](handleError(_0x413bdb,null));};exports[_0x4a9b('0x7a')]=function(_0x5dc30a,_0xaac33f,_0x4c5614){var _0x2b4633=[];return db['CmContact'][_0x4a9b('0x61')]()[_0x4a9b('0x26')](function(_0x539472){_0x2b4633=_[_0x4a9b('0x32')](_0x539472);return _0x5dc30a[_0x4a9b('0x6b')]['getVoiceQueues']({'where':{'type':_0x4a9b('0x7b'),'dialActive':!![],'dialMethod':_0x4a9b('0x7c')},'attributes':['id',_0x4a9b('0x7d')],'raw':!![]});})['then'](function(_0x2b1668){if(_0x2b1668&&_0x2b1668[_0x4a9b('0x4a')]){return db['sequelize']['transaction'](function(_0x7432f5){var _0xb29d5d={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x4a9b('0x30')](_0x2b1668,'id')},'$or':[{'UserId':null},{'UserId':_0x5dc30a[_0x4a9b('0x6b')]['id']}]};var _0x35cdb1=[];if(_0x5dc30a[_0x4a9b('0x5f')]['direction']&&_0x5dc30a[_0x4a9b('0x5f')][_0x4a9b('0x7e')]===_0x4a9b('0x7f')){if(!_[_0x4a9b('0x80')](_0x5dc30a[_0x4a9b('0x5f')]['hopperIds'])){_0xb29d5d['id']={'$in':_0x5dc30a[_0x4a9b('0x5f')][_0x4a9b('0x81')]};}_0x35cdb1=[[_0x4a9b('0x82'),_0x4a9b('0x83')],[_0x4a9b('0x84'),_0x2b1668[0x0][_0x4a9b('0x7d')]===_0x4a9b('0x83')?_0x4a9b('0x85'):_0x4a9b('0x83')],db[_0x4a9b('0x86')][_0x4a9b('0x87')](_0x4a9b('0x88')),['id',_0x4a9b('0x85')]];}else{if(!_[_0x4a9b('0x80')](_0x5dc30a[_0x4a9b('0x5f')][_0x4a9b('0x81')])){_0xb29d5d['id']={'$notIn':_0x5dc30a['body'][_0x4a9b('0x81')]};}_0x35cdb1=[[_0x4a9b('0x82'),_0x4a9b('0x85')],['scheduledAt',_0x2b1668[0x0][_0x4a9b('0x7d')]],db['sequelize'][_0x4a9b('0x87')](_0x4a9b('0x89')),['id',_0x4a9b('0x83')]];}return db[_0x4a9b('0x56')][_0x4a9b('0x8a')]({'attributes':['id',_0x4a9b('0x8b'),_0x4a9b('0x6e')],'where':_0xb29d5d,'order':_0x35cdb1,'transaction':_0x7432f5,'lock':_0x7432f5[_0x4a9b('0x8c')][_0x4a9b('0x8d')],'include':[{'model':db[_0x4a9b('0x71')],'as':_0x4a9b('0x8e'),'attributes':_0x2b4633,'include':[{'model':db[_0x4a9b('0x8f')],'as':_0x4a9b('0x90'),'attributes':['id',_0x4a9b('0x2a')]}]},{'model':db[_0x4a9b('0x91')],'as':_0x4a9b('0x92'),'attributes':['id',_0x4a9b('0x2a')]},{'model':db[_0x4a9b('0x63')],'as':_0x4a9b('0x93'),'attributes':['id','name',_0x4a9b('0x94')]}]})[_0x4a9b('0x26')](function(_0x4f3c41){if(_0x4f3c41){return _0x4f3c41[_0x4a9b('0x25')]({'UserId':_0x5dc30a[_0x4a9b('0x6b')]['id']},{'transaction':_0x7432f5});}});});}})[_0x4a9b('0x26')](handleEntityNotFound(_0xaac33f,null))[_0x4a9b('0x26')](respondWithResult(_0xaac33f,null))['catch'](handleError(_0xaac33f,null));};exports['getOpenContacts']=function(_0x2ae32e,_0x399697,_0x44059d){return _0x2ae32e[_0x4a9b('0x6b')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x4a9b('0x7c')},'attributes':['id'],'raw':!![]})[_0x4a9b('0x26')](function(_0x1d8908){if(_0x1d8908&&_0x1d8908['length']){return db[_0x4a9b('0x56')][_0x4a9b('0x1f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4a9b('0x95')](_0x4a9b('0x6c'))},'VoiceQueueId':{'$in':_[_0x4a9b('0x30')](_0x1d8908,'id')},'$or':[{'UserId':null},{'UserId':_0x2ae32e[_0x4a9b('0x6b')]['id']}]}});}return 0x0;})[_0x4a9b('0x26')](function(_0x28a7be){if(!_['isNil'](_0x28a7be)&&_[_0x4a9b('0x96')](_0x28a7be)){return _0x399697[_0x4a9b('0x1c')](0xc8)[_0x4a9b('0x22')]({'contacts':_0x28a7be});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts',0x194,_0x4a9b('0x97'));_0x399697[_0x4a9b('0x1b')](0x194);}})[_0x4a9b('0x60')](handleError(_0x399697,null));}; \ No newline at end of file +var _0xb39c=['$contains','$contained','$any','attributes','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','describe','getVoiceQueues','preview','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','CmContact','Contact','Company','CmList','List','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','CmHopper','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','concat','$gt','$lt','$lte','$between','$notBetween','$notIn','$like','$iLike','$notILike'];(function(_0x45a60c,_0x38caed){var _0x3e17dc=function(_0xdacd4f){while(--_0xdacd4f){_0x45a60c['push'](_0x45a60c['shift']());}};_0x3e17dc(++_0x38caed);}(_0xb39c,0x1f1));var _0xcb39=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb39c[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xcb39('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcb39('0x1'));var jsonpatch=require(_0xcb39('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcb39('0x3'));var Mustache=require(_0xcb39('0x4'));var util=require(_0xcb39('0x5'));var path=require(_0xcb39('0x6'));var sox=require(_0xcb39('0x7'));var csv=require(_0xcb39('0x8'));var ejs=require(_0xcb39('0x9'));var fs=require('fs');var fs_extra=require(_0xcb39('0xa'));var _=require(_0xcb39('0xb'));var squel=require(_0xcb39('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcb39('0x8'));var querystring=require('querystring');var Papa=require(_0xcb39('0xd'));var Redis=require(_0xcb39('0xe'));var authService=require(_0xcb39('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xcb39('0x10'));var hardwareService=require(_0xcb39('0x11'));var logger=require(_0xcb39('0x12'))(_0xcb39('0x13'));var utils=require(_0xcb39('0x14'));var config=require(_0xcb39('0x15'));var licenseUtil=require(_0xcb39('0x16'));var db=require(_0xcb39('0x17'))['db'];function respondWithStatusCode(_0x3aeaa1,_0x4a5899){_0x4a5899=_0x4a5899||0xcc;return function(_0xb2435a){if(_0xb2435a){return _0x3aeaa1[_0xcb39('0x18')](_0x4a5899);}return _0x3aeaa1[_0xcb39('0x19')](_0x4a5899)[_0xcb39('0x1a')]();};}function respondWithResult(_0x4a1cbc,_0x2a68ff){_0x2a68ff=_0x2a68ff||0xc8;return function(_0x84a8f0){if(_0x84a8f0){return _0x4a1cbc[_0xcb39('0x19')](_0x2a68ff)[_0xcb39('0x1b')](_0x84a8f0);}};}function respondWithFilteredResult(_0x44b0df,_0x23f55f){return function(_0x2b9de7){if(_0x2b9de7){var _0x323bbc=typeof _0x23f55f['offset']==='undefined'&&typeof _0x23f55f[_0xcb39('0x1c')]===_0xcb39('0x1d');var _0x5286ad=_0x2b9de7[_0xcb39('0x1e')];var _0x484528=_0x323bbc?0x0:_0x23f55f['offset'];var _0x310273=_0x323bbc?_0x2b9de7[_0xcb39('0x1e')]:_0x23f55f[_0xcb39('0x1f')]+_0x23f55f['limit'];var _0x5b97f9;if(_0x310273>=_0x5286ad){_0x310273=_0x5286ad;_0x5b97f9=0xc8;}else{_0x5b97f9=0xce;}_0x44b0df[_0xcb39('0x19')](_0x5b97f9);return _0x44b0df['set'](_0xcb39('0x20'),_0x484528+'-'+_0x310273+'/'+_0x5286ad)['json'](_0x2b9de7);}return null;};}function patchUpdates(_0x1a0d72){return function(_0x46a559){try{jsonpatch[_0xcb39('0x21')](_0x46a559,_0x1a0d72,!![]);}catch(_0x58e10e){return BPromise['reject'](_0x58e10e);}return _0x46a559[_0xcb39('0x22')]();};}function saveUpdates(_0x10e5a0,_0x2e3e74){return function(_0xe9e9d3){if(_0xe9e9d3){return _0xe9e9d3[_0xcb39('0x23')](_0x10e5a0)['then'](function(_0x36b967){return _0x36b967;});}return null;};}function removeEntity(_0x190c90,_0x27d508){return function(_0x14d500){if(_0x14d500){return _0x14d500[_0xcb39('0x24')]()[_0xcb39('0x25')](function(){_0x190c90[_0xcb39('0x19')](0xcc)[_0xcb39('0x1a')]();});}};}function handleEntityNotFound(_0x4bd6aa,_0x2c94f2){return function(_0x4834df){if(!_0x4834df){_0x4bd6aa[_0xcb39('0x18')](0x194);}return _0x4834df;};}function handleError(_0x4949c5,_0xd3e724){_0xd3e724=_0xd3e724||0x1f4;return function(_0x15d413){logger[_0xcb39('0x26')](_0x15d413[_0xcb39('0x27')]);if(_0x15d413[_0xcb39('0x28')]){delete _0x15d413[_0xcb39('0x28')];}_0x4949c5[_0xcb39('0x19')](_0xd3e724)[_0xcb39('0x29')](_0x15d413);};}exports[_0xcb39('0x2a')]=function(_0x2b13a9,_0x1ba591){var _0x429e80={},_0x20c729={},_0x150de4={'count':0x0,'rows':[]};var _0x2c9411=_['map'](db[_0xcb39('0x2b')][_0xcb39('0x2c')],function(_0x2b78c7){return{'name':_0x2b78c7[_0xcb39('0x2d')],'type':_0x2b78c7[_0xcb39('0x2e')][_0xcb39('0x2f')]};});_0x20c729[_0xcb39('0x30')]=_[_0xcb39('0x31')](_0x2c9411,_0xcb39('0x28'));_0x20c729[_0xcb39('0x32')]=_['keys'](_0x2b13a9[_0xcb39('0x32')]);_0x20c729[_0xcb39('0x33')]=_[_0xcb39('0x34')](_0x20c729[_0xcb39('0x30')],_0x20c729[_0xcb39('0x32')]);_0x20c729[_0xcb39('0x33')]=_[_0xcb39('0x35')](_0x20c729[_0xcb39('0x33')],['$and','$or',_0xcb39('0x36'),'$gte',_0xcb39('0x37'),_0xcb39('0x38'),'$ne','$eq','$not',_0xcb39('0x39'),_0xcb39('0x3a'),'$in',_0xcb39('0x3b'),_0xcb39('0x3c'),'$notLike',_0xcb39('0x3d'),_0xcb39('0x3e'),_0xcb39('0x3c'),'$overlap',_0xcb39('0x3f'),_0xcb39('0x40'),_0xcb39('0x41')]);_0x429e80[_0xcb39('0x42')]=_[_0xcb39('0x34')](_0x20c729[_0xcb39('0x30')],qs['fields'](_0x2b13a9[_0xcb39('0x32')]['fields']));_0x429e80[_0xcb39('0x42')]=_0x429e80[_0xcb39('0x42')][_0xcb39('0x43')]?_0x429e80[_0xcb39('0x42')]:_0x20c729[_0xcb39('0x30')];if(!_0x2b13a9['query']['hasOwnProperty'](_0xcb39('0x44'))){_0x429e80[_0xcb39('0x1c')]=qs[_0xcb39('0x1c')](_0x2b13a9[_0xcb39('0x32')][_0xcb39('0x1c')]);_0x429e80[_0xcb39('0x1f')]=qs[_0xcb39('0x1f')](_0x2b13a9[_0xcb39('0x32')]['offset']);}_0x429e80['order']=qs[_0xcb39('0x45')](_0x2b13a9[_0xcb39('0x32')][_0xcb39('0x45')]);_0x429e80[_0xcb39('0x46')]=qs[_0xcb39('0x33')](_[_0xcb39('0x47')](_0x2b13a9[_0xcb39('0x32')],_0x20c729[_0xcb39('0x33')]),_0x2c9411);if(_0x2b13a9['query'][_0xcb39('0x48')]){_0x429e80[_0xcb39('0x46')]=_[_0xcb39('0x49')](_0x429e80[_0xcb39('0x46')],{'$or':_[_0xcb39('0x31')](_0x2c9411,function(_0x516518){if(_0x516518[_0xcb39('0x2e')]!=='VIRTUAL'){var _0x3410cd={};_0x3410cd[_0x516518[_0xcb39('0x28')]]={'$like':'%'+_0x2b13a9[_0xcb39('0x32')][_0xcb39('0x48')]+'%'};return _0x3410cd;}})});}_0x429e80=_['merge']({},_0x429e80,_0x2b13a9[_0xcb39('0x4a')]);var _0x356d57={'where':_0x429e80[_0xcb39('0x46')]};return db['CmHopper'][_0xcb39('0x1e')](_0x356d57)[_0xcb39('0x25')](function(_0x265cbd){_0x150de4[_0xcb39('0x1e')]=_0x265cbd;if(_0x2b13a9[_0xcb39('0x32')][_0xcb39('0x4b')]){_0x429e80[_0xcb39('0x4c')]=[{'all':!![]}];}return db[_0xcb39('0x2b')][_0xcb39('0x4d')](_0x429e80);})[_0xcb39('0x25')](function(_0x44d311){_0x150de4[_0xcb39('0x4e')]=_0x44d311;return _0x150de4;})[_0xcb39('0x25')](respondWithFilteredResult(_0x1ba591,_0x429e80))[_0xcb39('0x4f')](handleError(_0x1ba591,null));};exports[_0xcb39('0x50')]=function(_0x3f8c4c,_0x33ddd9){var _0x118c2a={'raw':!![],'where':{'id':_0x3f8c4c[_0xcb39('0x51')]['id']}},_0x50bab0={};_0x50bab0[_0xcb39('0x30')]=_[_0xcb39('0x52')](db[_0xcb39('0x2b')]['rawAttributes']);_0x50bab0['query']=_[_0xcb39('0x52')](_0x3f8c4c[_0xcb39('0x32')]);_0x50bab0[_0xcb39('0x33')]=_[_0xcb39('0x34')](_0x50bab0[_0xcb39('0x30')],_0x50bab0[_0xcb39('0x32')]);_0x118c2a[_0xcb39('0x42')]=_['intersection'](_0x50bab0[_0xcb39('0x30')],qs[_0xcb39('0x53')](_0x3f8c4c[_0xcb39('0x32')][_0xcb39('0x53')]));_0x118c2a[_0xcb39('0x42')]=_0x118c2a['attributes'][_0xcb39('0x43')]?_0x118c2a[_0xcb39('0x42')]:_0x50bab0[_0xcb39('0x30')];if(_0x3f8c4c[_0xcb39('0x32')][_0xcb39('0x4b')]){_0x118c2a[_0xcb39('0x4c')]=[{'all':!![]}];}_0x118c2a=_['merge']({},_0x118c2a,_0x3f8c4c['options']);return db[_0xcb39('0x2b')][_0xcb39('0x54')](_0x118c2a)[_0xcb39('0x25')](handleEntityNotFound(_0x33ddd9,null))[_0xcb39('0x25')](respondWithResult(_0x33ddd9,null))[_0xcb39('0x4f')](handleError(_0x33ddd9,null));};exports[_0xcb39('0x55')]=function(_0x45ede7,_0x46ecc1){return db['CmHopper']['create'](_0x45ede7[_0xcb39('0x56')],{})[_0xcb39('0x25')](respondWithResult(_0x46ecc1,0xc9))['catch'](handleError(_0x46ecc1,null));};exports[_0xcb39('0x23')]=function(_0x4b75d9,_0x599129){if(_0x4b75d9[_0xcb39('0x56')]['id']){delete _0x4b75d9[_0xcb39('0x56')]['id'];}return db[_0xcb39('0x2b')][_0xcb39('0x54')]({'where':{'id':_0x4b75d9[_0xcb39('0x51')]['id']}})[_0xcb39('0x25')](handleEntityNotFound(_0x599129,null))['then'](saveUpdates(_0x4b75d9[_0xcb39('0x56')],null))['then'](respondWithResult(_0x599129,null))[_0xcb39('0x4f')](handleError(_0x599129,null));};exports['describe']=function(_0x43495b,_0xb6fdf7){return db[_0xcb39('0x2b')]['describe']()[_0xcb39('0x25')](respondWithResult(_0xb6fdf7,null))[_0xcb39('0x4f')](handleError(_0xb6fdf7,null));};exports[_0xcb39('0x24')]=function(_0x2b9ea9,_0x5277a1){var _0x5e549b;var _0x44807c=_0x2b9ea9[_0xcb39('0x51')]['id'];return db[_0xcb39('0x2b')][_0xcb39('0x54')]({'where':{'id':_0x2b9ea9['params']['id']}})['then'](handleEntityNotFound(_0x5277a1,null))[_0xcb39('0x25')](function(_0x4c42fe){if(_0x4c42fe){return _0x4c42fe[_0xcb39('0x24')]()['then'](function(_0x526e95){return _0x526e95;});}})[_0xcb39('0x25')](function(_0x4bbd40){_0x5e549b=_0x4bbd40;if(_0x4bbd40){if(_0x4bbd40['VoiceQueueId']||_0x4bbd40['CampaignId']){return db[_0x4bbd40[_0xcb39('0x57')]?_0xcb39('0x58'):_0xcb39('0x59')][_0xcb39('0x54')]({'where':{'id':_0x4bbd40['VoiceQueueId']?_0x4bbd40[_0xcb39('0x57')]:_0x4bbd40['CampaignId']},'attributes':['id',_0xcb39('0x28')],'raw':!![]});}}})['then'](function(_0x1aa3e8){var _0x66dfd1={};if(_0x1aa3e8){_[_0xcb39('0x49')](_0x66dfd1,_[_0xcb39('0x5a')](_0x5e549b[_0xcb39('0x5b')],[_0xcb39('0x5c'),_0xcb39('0x5d'),'id']));_0x66dfd1[_0xcb39('0x5e')]=0x15;_0x66dfd1[_0xcb39('0x5f')]=_0xcb39('0x60');_0x66dfd1[_0xcb39('0x61')]=_0x1aa3e8['name'];_0x66dfd1['membername']=_0x2b9ea9[_0xcb39('0x62')][_0xcb39('0x28')];_0x66dfd1['UserId']=_0x2b9ea9['user']['id'];_0x66dfd1[_0xcb39('0x60')]=!![];_0x66dfd1[_0xcb39('0x63')]=moment()[_0xcb39('0x64')](_0xcb39('0x65'));_0x66dfd1['calleridnum']=_0x5e549b[_0xcb39('0x66')];_0x66dfd1[_0xcb39('0x67')]=_0x5e549b[_0xcb39('0x57')]?_0xcb39('0x68'):_0xcb39('0x69');return db['CmContact'][_0xcb39('0x54')]({'where':{'id':_0x66dfd1[_0xcb39('0x6a')]},'attributes':[_0xcb39('0x6b'),_0xcb39('0x6c')]})['then'](function(_0x491dbe){if(!_[_0xcb39('0x6d')](_0x5277a1)&&!_[_0xcb39('0x6d')](_0x491dbe[_0xcb39('0x6b')])){_0x66dfd1[_0xcb39('0x6e')]=_0x491dbe[_0xcb39('0x6b')];if(!_[_0xcb39('0x6d')](_0x491dbe[_0xcb39('0x6c')])){_0x66dfd1[_0xcb39('0x6e')]+='\x20'+_0x491dbe[_0xcb39('0x6c')];}}})[_0xcb39('0x6f')](function(){return db[_0xcb39('0x70')]['create'](_0x66dfd1);});}})['then'](function(_0x711992){return db['CmHopperAdditionalPhone'][_0xcb39('0x24')]({'where':{'CmHopperId':_0x44807c}});})[_0xcb39('0x25')](function(){return _0x5277a1[_0xcb39('0x19')](0xcc)['end']();})[_0xcb39('0x4f')](handleError(_0x5277a1,null));};exports['getPreview']=function(_0xb55477,_0x404e8e,_0x1f0160){var _0x4c9786=[];return db['CmContact'][_0xcb39('0x71')]()[_0xcb39('0x25')](function(_0x2da789){_0x4c9786=_[_0xcb39('0x52')](_0x2da789);return _0xb55477[_0xcb39('0x62')][_0xcb39('0x72')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xcb39('0x73')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0xcb39('0x25')](function(_0x4edc23){if(_0x4edc23&&_0x4edc23['length']){return db[_0xcb39('0x74')][_0xcb39('0x75')](function(_0x4b31e6){var _0x2dc5a1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xcb39('0x64')](_0xcb39('0x65'))},'VoiceQueueId':{'$in':_['map'](_0x4edc23,'id')},'$or':[{'UserId':null},{'UserId':_0xb55477[_0xcb39('0x62')]['id']}]};var _0x2e8a42=[];if(_0xb55477[_0xcb39('0x56')][_0xcb39('0x76')]&&_0xb55477[_0xcb39('0x56')][_0xcb39('0x76')]===_0xcb39('0x77')){if(!_[_0xcb39('0x78')](_0xb55477[_0xcb39('0x56')]['hopperIds'])){_0x2dc5a1['id']={'$in':_0xb55477[_0xcb39('0x56')][_0xcb39('0x79')]};}_0x2e8a42=[[_0xcb39('0x7a'),_0xcb39('0x7b')],['scheduledAt',_0x4edc23[0x0]['dialOrderByScheduledAt']===_0xcb39('0x7b')?_0xcb39('0x7c'):_0xcb39('0x7b')],db['sequelize'][_0xcb39('0x7d')](_0xcb39('0x7e')),['id','DESC']];}else{if(!_[_0xcb39('0x78')](_0xb55477[_0xcb39('0x56')][_0xcb39('0x79')])){_0x2dc5a1['id']={'$notIn':_0xb55477[_0xcb39('0x56')]['hopperIds']};}_0x2e8a42=[['priority',_0xcb39('0x7c')],[_0xcb39('0x7f'),_0x4edc23[0x0][_0xcb39('0x80')]],db[_0xcb39('0x74')]['literal'](_0xcb39('0x81')),['id',_0xcb39('0x7b')]];}return db['CmHopper']['findOne']({'attributes':['id',_0xcb39('0x82'),_0xcb39('0x66')],'where':_0x2dc5a1,'order':_0x2e8a42,'transaction':_0x4b31e6,'lock':_0x4b31e6[_0xcb39('0x83')]['UPDATE'],'include':[{'model':db[_0xcb39('0x84')],'as':_0xcb39('0x85'),'attributes':_0x4c9786,'include':[{'model':db['CmCompany'],'as':_0xcb39('0x86'),'attributes':['id','name']}]},{'model':db[_0xcb39('0x87')],'as':_0xcb39('0x88'),'attributes':['id','name']},{'model':db[_0xcb39('0x58')],'as':'Queue','attributes':['id',_0xcb39('0x28'),'dialActive']}]})[_0xcb39('0x25')](function(_0x56aeb7){if(_0x56aeb7){return _0x56aeb7['update']({'UserId':_0xb55477[_0xcb39('0x62')]['id']},{'transaction':_0x4b31e6});}});});}})[_0xcb39('0x25')](handleEntityNotFound(_0x404e8e,null))[_0xcb39('0x25')](respondWithResult(_0x404e8e,null))['catch'](handleError(_0x404e8e,null));};exports['getOpenContacts']=function(_0x17c8af,_0x826339,_0x583f6c){return _0x17c8af['user'][_0xcb39('0x72')]({'where':{'type':_0xcb39('0x89'),'dialActive':!![],'dialMethod':_0xcb39('0x73')},'attributes':['id'],'raw':!![]})[_0xcb39('0x25')](function(_0x2d1450){if(_0x2d1450&&_0x2d1450[_0xcb39('0x43')]){return db[_0xcb39('0x2b')][_0xcb39('0x1e')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xcb39('0x64')](_0xcb39('0x65'))},'VoiceQueueId':{'$in':_[_0xcb39('0x31')](_0x2d1450,'id')},'$or':[{'UserId':null},{'UserId':_0x17c8af['user']['id']}]}});}return 0x0;})['then'](function(_0x49cc0b){if(!_[_0xcb39('0x6d')](_0x49cc0b)&&_[_0xcb39('0x8a')](_0x49cc0b)){return _0x826339['status'](0xc8)[_0xcb39('0x1b')]({'contacts':_0x49cc0b});}else{logger[_0xcb39('0x26')](_0xcb39('0x8b'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x826339[_0xcb39('0x18')](0x194);}})[_0xcb39('0x4f')](handleError(_0x826339,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index d91c8ad..443dab5 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 _0x9437=['moment','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api'];(function(_0x3f2302,_0x3c3363){var _0x55fed4=function(_0x14d32e){while(--_0x14d32e){_0x3f2302['push'](_0x3f2302['shift']());}};_0x55fed4(++_0x3c3363);}(_0x9437,0x13f));var _0x7943=function(_0x5e55e0,_0x5e4b37){_0x5e55e0=_0x5e55e0-0x0;var _0x161e2e=_0x9437[_0x5e55e0];return _0x161e2e;};'use strict';var _=require(_0x7943('0x0'));var util=require(_0x7943('0x1'));var logger=require(_0x7943('0x2'))(_0x7943('0x3'));var moment=require(_0x7943('0x4'));var BPromise=require(_0x7943('0x5'));var rp=require(_0x7943('0x6'));var fs=require('fs');var path=require(_0x7943('0x7'));var rimraf=require(_0x7943('0x8'));var config=require('../../config/environment');var attributes=require(_0x7943('0x9'));module[_0x7943('0xa')]=function(_0x4b3ad4,_0x39391e){return _0x4b3ad4[_0x7943('0xb')](_0x7943('0xc'),attributes,{'tableName':_0x7943('0xd'),'paranoid':![],'indexes':[{'name':_0x7943('0xe'),'fields':[_0x7943('0xe')]},{'name':_0x7943('0xf'),'fields':[_0x7943('0xf')]},{'name':'priority','fields':[_0x7943('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d34=['cm_hopper','scheduledat','phone','priority','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper'];(function(_0x3e23dd,_0x5735e8){var _0x5b57c1=function(_0x3f01be){while(--_0x3f01be){_0x3e23dd['push'](_0x3e23dd['shift']());}};_0x5b57c1(++_0x5735e8);}(_0x4d34,0x114));var _0x44d3=function(_0xd0cdac,_0x13c979){_0xd0cdac=_0xd0cdac-0x0;var _0x135708=_0x4d34[_0xd0cdac];return _0x135708;};'use strict';var _=require(_0x44d3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x44d3('0x1'));var moment=require(_0x44d3('0x2'));var BPromise=require(_0x44d3('0x3'));var rp=require(_0x44d3('0x4'));var fs=require('fs');var path=require(_0x44d3('0x5'));var rimraf=require(_0x44d3('0x6'));var config=require(_0x44d3('0x7'));var attributes=require(_0x44d3('0x8'));module[_0x44d3('0x9')]=function(_0x2832f2,_0x5ec0a9){return _0x2832f2[_0x44d3('0xa')](_0x44d3('0xb'),attributes,{'tableName':_0x44d3('0xc'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x44d3('0xd')]},{'name':'phone','fields':[_0x44d3('0xe')]},{'name':_0x44d3('0xf'),'fields':[_0x44d3('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index ae3d307..c56a962 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 _0x5926=['Contact','keys','User','Agent','name','length','UserId','push','includes','all','sequelize','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','CmContact','UPDATE','GetCmHopperPreview','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetCmHopper','CmHopper','findAll','options','where','attributes','map','include','model','stringify','find','raw','ShowCmHopper','catch','CreateCmHopper','body','UpdateCmHopper','update','limit','DestroyCmHopper','destroy','GetContactDialer','describe','transaction','order','LOCK'];(function(_0xa5e821,_0x4dd2f6){var _0x62d0cd=function(_0x119f86){while(--_0x119f86){_0xa5e821['push'](_0xa5e821['shift']());}};_0x62d0cd(++_0x4dd2f6);}(_0x5926,0x1f2));var _0x6592=function(_0x4ae9a4,_0x2c66f0){_0x4ae9a4=_0x4ae9a4-0x0;var _0x5daa7d=_0x5926[_0x4ae9a4];return _0x5daa7d;};'use strict';var _=require(_0x6592('0x0'));var util=require('util');var moment=require(_0x6592('0x1'));var BPromise=require('bluebird');var rs=require(_0x6592('0x2'));var fs=require('fs');var Redis=require(_0x6592('0x3'));var db=require(_0x6592('0x4'))['db'];var utils=require(_0x6592('0x5'));var logger=require(_0x6592('0x6'))(_0x6592('0x7'));var config=require('../../config/environment');var jayson=require(_0x6592('0x8'));var client=jayson[_0x6592('0x9')][_0x6592('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1544aa,_0x2bf4ea,_0x3f98e5){return new BPromise(function(_0x28823d,_0x5c21c4){return client['request'](_0x1544aa,_0x3f98e5)[_0x6592('0xb')](function(_0x147002){logger[_0x6592('0xc')](_0x6592('0xd'),_0x2bf4ea,'request\x20sent');logger[_0x6592('0xe')](_0x6592('0xf'),_0x2bf4ea,_0x6592('0x10'),JSON['stringify'](_0x147002));if(_0x147002[_0x6592('0x11')]){if(_0x147002['error'][_0x6592('0x12')]===0x1f4){logger[_0x6592('0x11')](_0x6592('0xd'),_0x2bf4ea,_0x147002[_0x6592('0x11')][_0x6592('0x13')]);return _0x5c21c4(_0x147002[_0x6592('0x11')][_0x6592('0x13')]);}logger[_0x6592('0x11')]('CmHopper,\x20%s,\x20%s',_0x2bf4ea,_0x147002['error']['message']);return _0x28823d(_0x147002[_0x6592('0x11')][_0x6592('0x13')]);}else{logger[_0x6592('0xc')](_0x6592('0xd'),_0x2bf4ea,_0x6592('0x10'));_0x28823d(_0x147002['result'][_0x6592('0x13')]);}})['catch'](function(_0x3129db){logger['error'](_0x6592('0xd'),_0x2bf4ea,_0x3129db);_0x5c21c4(_0x3129db);});});}exports[_0x6592('0x14')]=function(_0x38dc08){var _0x590697=this;return new Promise(function(_0x25419c,_0x457e0c){return db[_0x6592('0x15')][_0x6592('0x16')]({'raw':_0x38dc08[_0x6592('0x17')]?_0x38dc08[_0x6592('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x38dc08['options']?_0x38dc08[_0x6592('0x17')][_0x6592('0x18')]||null:null,'attributes':_0x38dc08[_0x6592('0x17')]?_0x38dc08[_0x6592('0x17')][_0x6592('0x19')]||null:null,'limit':_0x38dc08[_0x6592('0x17')]?_0x38dc08['options']['limit']||null:null,'include':_0x38dc08[_0x6592('0x17')]?_0x38dc08[_0x6592('0x17')]['include']?_[_0x6592('0x1a')](_0x38dc08['options'][_0x6592('0x1b')],function(_0x5da4e6){return{'model':db[_0x5da4e6[_0x6592('0x1c')]],'as':_0x5da4e6['as'],'attributes':_0x5da4e6[_0x6592('0x19')],'include':_0x5da4e6[_0x6592('0x1b')]?_[_0x6592('0x1a')](_0x5da4e6['include'],function(_0x1e0738){return{'model':db[_0x1e0738[_0x6592('0x1c')]],'as':_0x1e0738['as'],'attributes':_0x1e0738[_0x6592('0x19')],'include':_0x1e0738['include']?_['map'](_0x1e0738[_0x6592('0x1b')],function(_0x43226c){return{'model':db[_0x43226c['model']],'as':_0x43226c['as'],'attributes':_0x43226c['attributes']};}):[]};}):[]};}):[]:[]})[_0x6592('0xb')](function(_0x3afe60){logger[_0x6592('0xc')](_0x6592('0x14'),_0x38dc08);logger[_0x6592('0xe')](_0x6592('0x14'),_0x38dc08,JSON[_0x6592('0x1d')](_0x3afe60));_0x25419c(_0x3afe60);})['catch'](function(_0x4f2996){logger[_0x6592('0x11')]('GetCmHopper',_0x4f2996[_0x6592('0x13')],_0x38dc08);_0x457e0c(_0x590697[_0x6592('0x11')](0x1f4,_0x4f2996['message']));});});};exports['ShowCmHopper']=function(_0x52bfb4){var _0x577664=this;return new Promise(function(_0x58fb6b,_0x1b1162){return db[_0x6592('0x15')][_0x6592('0x1e')]({'raw':_0x52bfb4[_0x6592('0x17')]?_0x52bfb4[_0x6592('0x17')][_0x6592('0x1f')]===undefined?!![]:![]:!![],'where':_0x52bfb4[_0x6592('0x17')]?_0x52bfb4['options'][_0x6592('0x18')]||null:null,'attributes':_0x52bfb4['options']?_0x52bfb4[_0x6592('0x17')][_0x6592('0x19')]||null:null,'include':_0x52bfb4['options']?_0x52bfb4[_0x6592('0x17')][_0x6592('0x1b')]?_[_0x6592('0x1a')](_0x52bfb4[_0x6592('0x17')][_0x6592('0x1b')],function(_0x4cf57a){return{'model':db[_0x4cf57a['model']],'as':_0x4cf57a['as'],'attributes':_0x4cf57a['attributes'],'include':_0x4cf57a['include']?_[_0x6592('0x1a')](_0x4cf57a['include'],function(_0x483ebb){return{'model':db[_0x483ebb['model']],'as':_0x483ebb['as'],'attributes':_0x483ebb[_0x6592('0x19')],'include':_0x483ebb[_0x6592('0x1b')]?_['map'](_0x483ebb[_0x6592('0x1b')],function(_0xa66cd4){return{'model':db[_0xa66cd4[_0x6592('0x1c')]],'as':_0xa66cd4['as'],'attributes':_0xa66cd4[_0x6592('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2343a7){logger[_0x6592('0xc')](_0x6592('0x20'),_0x52bfb4);logger[_0x6592('0xe')](_0x6592('0x20'),_0x52bfb4,JSON[_0x6592('0x1d')](_0x2343a7));_0x58fb6b(_0x2343a7);})[_0x6592('0x21')](function(_0x2e71bf){logger[_0x6592('0x11')](_0x6592('0x20'),_0x2e71bf['message'],_0x52bfb4);_0x1b1162(_0x577664[_0x6592('0x11')](0x1f4,_0x2e71bf[_0x6592('0x13')]));});});};exports[_0x6592('0x22')]=function(_0x29631a){var _0x3514e0=this;return new Promise(function(_0x272d8d,_0x5b43d5){return db[_0x6592('0x15')]['create'](_0x29631a[_0x6592('0x23')],{'raw':_0x29631a[_0x6592('0x17')]?_0x29631a[_0x6592('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x55ebd9){logger[_0x6592('0xc')](_0x6592('0x22'),_0x29631a);logger['debug']('CreateCmHopper',_0x29631a,JSON[_0x6592('0x1d')](_0x55ebd9));_0x272d8d(_0x55ebd9);})[_0x6592('0x21')](function(_0x20321a){logger[_0x6592('0x11')](_0x6592('0x22'),_0x20321a[_0x6592('0x13')],_0x29631a);_0x5b43d5(_0x3514e0[_0x6592('0x11')](0x1f4,_0x20321a[_0x6592('0x13')]));});});};exports[_0x6592('0x24')]=function(_0x6ed036){var _0x3de560=this;return new Promise(function(_0x130284,_0x5d6245){return db['CmHopper'][_0x6592('0x25')](_0x6ed036[_0x6592('0x23')],{'raw':_0x6ed036[_0x6592('0x17')]?_0x6ed036['options'][_0x6592('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6ed036['options']?_0x6ed036['options'][_0x6592('0x18')]||null:null,'attributes':_0x6ed036[_0x6592('0x17')]?_0x6ed036['options']['attributes']||null:null,'limit':_0x6ed036[_0x6592('0x17')]?_0x6ed036['options'][_0x6592('0x26')]||null:null})['then'](function(_0x27daca){logger[_0x6592('0xc')](_0x6592('0x24'),_0x6ed036);logger[_0x6592('0xe')](_0x6592('0x24'),_0x6ed036,JSON[_0x6592('0x1d')](_0x27daca));_0x130284(_0x27daca);})['catch'](function(_0x3ced0a){logger[_0x6592('0x11')]('UpdateCmHopper',_0x3ced0a[_0x6592('0x13')],_0x6ed036);_0x5d6245(_0x3de560[_0x6592('0x11')](0x1f4,_0x3ced0a[_0x6592('0x13')]));});});};exports[_0x6592('0x27')]=function(_0x5dd3b1){var _0x139dd4=this;return new Promise(function(_0x21ea8e,_0x190c8d){return db[_0x6592('0x15')][_0x6592('0x28')]({'where':_0x5dd3b1[_0x6592('0x17')]?_0x5dd3b1['options'][_0x6592('0x18')]||null:null})[_0x6592('0xb')](function(_0x3d243e){logger[_0x6592('0xc')]('DestroyCmHopper',_0x5dd3b1);logger[_0x6592('0xe')](_0x6592('0x27'),_0x5dd3b1,JSON[_0x6592('0x1d')](_0x3d243e));_0x21ea8e(_0x3d243e);})[_0x6592('0x21')](function(_0x15bd44){logger['error']('DestroyCmHopper',_0x15bd44[_0x6592('0x13')],_0x5dd3b1);_0x190c8d(_0x139dd4[_0x6592('0x11')](0x1f4,_0x15bd44[_0x6592('0x13')]));});});};exports[_0x6592('0x29')]=function(_0x5cbe4a){var _0x5b8934=this;return new Promise(function(_0x2ab679,_0x50a28a){return db['CmContact'][_0x6592('0x2a')]()[_0x6592('0xb')](function(_0x4e8a50){return db['sequelize'][_0x6592('0x2b')](function(_0x3ca6be){return db[_0x6592('0x15')][_0x6592('0x16')]({'where':_0x5cbe4a['options']?_0x5cbe4a['options']['where']||null:null,'attributes':_0x5cbe4a[_0x6592('0x17')]?_0x5cbe4a[_0x6592('0x17')][_0x6592('0x19')]||null:null,'limit':_0x5cbe4a[_0x6592('0x17')]?_0x5cbe4a[_0x6592('0x17')][_0x6592('0x26')]||null:null,'order':_0x5cbe4a[_0x6592('0x17')]?_0x5cbe4a['options'][_0x6592('0x2c')]||null:null,'transaction':_0x3ca6be,'lock':_0x3ca6be[_0x6592('0x2d')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x6592('0x2e'),'attributes':_[_0x6592('0x2f')](_0x4e8a50)},{'model':db[_0x6592('0x30')],'as':_0x6592('0x31'),'attributes':['id',_0x6592('0x32'),'voicePause']}]})[_0x6592('0xb')](function(_0x73e169){var _0x52348a=[];var _0x2b426e=[];for(var _0x20bbf4=0x0;_0x20bbf4<_0x73e169[_0x6592('0x33')];_0x20bbf4+=0x1){var _0x5298c7=_0x73e169[_0x20bbf4][_0x6592('0x34')];if(_0x5298c7===null){_0x52348a[_0x6592('0x35')](_0x73e169[_0x20bbf4]['update'](_0x5cbe4a[_0x6592('0x23')],{'transaction':_0x3ca6be}));}else if(!_0x2b426e[_0x6592('0x36')](_0x5298c7)){_0x2b426e['push'](_0x5298c7);_0x52348a['push'](_0x73e169[_0x20bbf4][_0x6592('0x25')](_0x5cbe4a[_0x6592('0x23')],{'transaction':_0x3ca6be}));}}return BPromise[_0x6592('0x37')](_0x52348a);});})[_0x6592('0xb')](function(_0x543c5e){logger['info']('GetContactDialer',_0x5cbe4a);logger['debug'](_0x6592('0x29'),_0x5cbe4a,JSON['stringify'](_0x543c5e));_0x2ab679(_0x543c5e);})[_0x6592('0x21')](function(_0x3ad673){logger[_0x6592('0x11')](_0x6592('0x29'),_0x3ad673[_0x6592('0x13')],_0x5cbe4a);_0x50a28a(_0x5b8934[_0x6592('0x11')](0x1f4,_0x3ad673[_0x6592('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x3526fe){var _0x3b4aba=this;return new Promise(function(_0x2cfac3,_0x54d6b5){return db[_0x6592('0x38')]['transaction'](function(_0x24a556){return db[_0x6592('0x39')]['create'](_0x3526fe[_0x6592('0x23')],{'raw':_0x3526fe[_0x6592('0x17')]?_0x3526fe[_0x6592('0x17')][_0x6592('0x1f')]===undefined?!![]:![]:!![],'transaction':_0x24a556})[_0x6592('0xb')](function(){return db[_0x6592('0x15')][_0x6592('0x28')]({'where':_0x3526fe[_0x6592('0x17')]?_0x3526fe['options'][_0x6592('0x18')]||null:null,'transaction':_0x24a556});});})['then'](function(_0xcf6024){logger[_0x6592('0xc')](_0x6592('0x3a'),_0x3526fe);logger[_0x6592('0xe')](_0x6592('0x3a'),_0x3526fe,JSON[_0x6592('0x1d')](_0xcf6024));_0x2cfac3(_0xcf6024);})[_0x6592('0x21')](function(_0x1d1323){logger[_0x6592('0x11')](_0x6592('0x3a'),_0x1d1323[_0x6592('0x13')],_0x3526fe);_0x54d6b5(_0x3b4aba[_0x6592('0x11')](0x1f4,_0x1d1323[_0x6592('0x13')]));});});};exports[_0x6592('0x3b')]=function(_0x53358e){var _0x4ac58a=this;return new Promise(function(_0x2a1c25,_0x5c7120){return db[_0x6592('0x15')]['findAll']({'raw':_0x53358e[_0x6592('0x17')]?_0x53358e[_0x6592('0x17')][_0x6592('0x1f')]===undefined?!![]:![]:!![],'where':_0x53358e[_0x6592('0x17')]?_0x53358e[_0x6592('0x17')][_0x6592('0x18')]||null:null,'attributes':[[db[_0x6592('0x38')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x6592('0x3c')+util[_0x6592('0x3d')](_0x6592('0x3e'),moment()['format'](_0x6592('0x3f')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x6592('0xb')](function(_0x5a8187){logger[_0x6592('0xc')](_0x6592('0x3b'),_0x53358e);logger[_0x6592('0xe')]('CountReScheduled',_0x53358e,JSON[_0x6592('0x1d')](_0x5a8187));_0x2a1c25(_0x5a8187);})['catch'](function(_0x27bc1e){logger['error'](_0x6592('0x3b'),_0x27bc1e['message'],_0x53358e);_0x5c7120(_0x4ac58a[_0x6592('0x11')](0x1f4,_0x27bc1e['message']));});});};exports[_0x6592('0x40')]=function(_0x20a623){var _0x3b8d7c=this;return new Promise(function(_0xe63530,_0x404c1c){return db[_0x6592('0x41')][_0x6592('0x2a')]()[_0x6592('0xb')](function(_0x1f352f){return db[_0x6592('0x38')]['transaction'](function(_0x4b2489){return db['CmHopper'][_0x6592('0x16')]({'where':_0x20a623['options']?_0x20a623[_0x6592('0x17')][_0x6592('0x18')]||null:null,'attributes':_0x20a623[_0x6592('0x17')]?_0x20a623[_0x6592('0x17')][_0x6592('0x19')]||null:null,'limit':0x1,'order':_0x20a623[_0x6592('0x17')]?_0x20a623[_0x6592('0x17')]['order']||null:null,'group':db[_0x6592('0x15')][_0x6592('0x34')],'transaction':_0x4b2489,'lock':_0x4b2489[_0x6592('0x2d')][_0x6592('0x42')],'include':_0x20a623[_0x6592('0x17')]?_0x20a623[_0x6592('0x17')][_0x6592('0x1b')]?_['map'](_0x20a623['options']['include'],function(_0x1ecc3e){return{'model':db[_0x1ecc3e['model']],'as':_0x1ecc3e['as'],'attributes':_0x1ecc3e[_0x6592('0x19')],'include':_0x1ecc3e[_0x6592('0x1b')]?_[_0x6592('0x1a')](_0x1ecc3e[_0x6592('0x1b')],function(_0xaff3f3){return{'model':db[_0xaff3f3['model']],'as':_0xaff3f3['as'],'attributes':_0xaff3f3[_0x6592('0x19')],'include':_0xaff3f3[_0x6592('0x1b')]?_[_0x6592('0x1a')](_0xaff3f3[_0x6592('0x1b')],function(_0x1a1256){return{'model':db[_0x1a1256[_0x6592('0x1c')]],'as':_0x1a1256['as'],'attributes':_0x1a1256[_0x6592('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6592('0xb')](function(_0x1319d2){var _0x155681=[];for(var _0x348adc=0x0;_0x348adc<_0x1319d2[_0x6592('0x33')];_0x348adc+=0x1){_0x155681[_0x6592('0x35')](_0x1319d2[_0x348adc][_0x6592('0x25')](_0x20a623['body'],{'transaction':_0x4b2489}));}return BPromise[_0x6592('0x37')](_0x155681);});})[_0x6592('0xb')](function(_0x4197b3){logger[_0x6592('0xc')](_0x6592('0x40'),_0x20a623);logger[_0x6592('0xe')](_0x6592('0x40'),_0x20a623,JSON[_0x6592('0x1d')](_0x4197b3));_0xe63530(_0x4197b3);})[_0x6592('0x21')](function(_0x326b8e){logger['error'](_0x6592('0x40'),_0x326b8e[_0x6592('0x13')],_0x20a623);_0x404c1c(_0x3b8d7c['error'](0x1f4,_0x326b8e['message']));});});});};exports[_0x6592('0x43')]=function(_0x55eab8){var _0x1fa57e=this;return new Promise(function(_0x1795d1,_0xd9ee8f){db[_0x6592('0x41')][_0x6592('0x2a')]()[_0x6592('0xb')](function(_0x54c1e9){return db[_0x6592('0x15')][_0x6592('0x16')]({'raw':_0x55eab8[_0x6592('0x17')]?_0x55eab8[_0x6592('0x17')][_0x6592('0x1f')]===undefined?!![]:![]:!![],'where':_0x55eab8[_0x6592('0x17')]?_0x55eab8[_0x6592('0x17')][_0x6592('0x18')]||null:null,'attributes':_0x55eab8[_0x6592('0x17')]?_0x55eab8[_0x6592('0x17')][_0x6592('0x19')]||null:null,'limit':_0x55eab8['options']?_0x55eab8[_0x6592('0x17')][_0x6592('0x26')]||null:null,'include':_0x55eab8[_0x6592('0x17')]?_0x55eab8['options'][_0x6592('0x1b')]?_[_0x6592('0x1a')](_0x55eab8['options'][_0x6592('0x1b')],function(_0x23c38c){return{'model':db[_0x23c38c[_0x6592('0x1c')]],'as':_0x23c38c['as'],'attributes':_0x23c38c['as']===_0x6592('0x2e')?_['keys'](_0x54c1e9):_0x23c38c['attributes'],'include':_0x23c38c[_0x6592('0x1b')]?_[_0x6592('0x1a')](_0x23c38c[_0x6592('0x1b')],function(_0xefaaf5){return{'model':db[_0xefaaf5['model']],'as':_0xefaaf5['as'],'attributes':_0xefaaf5[_0x6592('0x19')],'include':_0xefaaf5[_0x6592('0x1b')]?_[_0x6592('0x1a')](_0xefaaf5['include'],function(_0x1aec9a){return{'model':db[_0x1aec9a[_0x6592('0x1c')]],'as':_0x1aec9a['as'],'attributes':_0x1aec9a[_0x6592('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6592('0xb')](function(_0x1c9ba2){logger[_0x6592('0xc')](_0x6592('0x14'),_0x55eab8);logger[_0x6592('0xe')](_0x6592('0x14'),_0x55eab8,JSON['stringify'](_0x1c9ba2));_0x1795d1(_0x1c9ba2);})[_0x6592('0x21')](function(_0x38fb27){logger[_0x6592('0x11')](_0x6592('0x14'),_0x38fb27[_0x6592('0x13')],_0x55eab8);_0xd9ee8f(_0x1fa57e[_0x6592('0x11')](0x1f4,_0x38fb27[_0x6592('0x13')]));});});});}; \ No newline at end of file +var _0x5fce=['literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','GetContactRecallMe','GetCmHopperPreview','describe','Contact','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopper,\x20%s,\x20%s','message','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','ShowCmHopper','find','create','body','CreateCmHopper','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','order','LOCK','UPDATE','keys','User','Agent','name','length','UserId','push','includes','all','MoveContactManagedDialer','transaction','CountReScheduled','COUNT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fce,0x1eb));var _0xe5fc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5fce[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xe5fc('0x0'));var util=require(_0xe5fc('0x1'));var moment=require(_0xe5fc('0x2'));var BPromise=require(_0xe5fc('0x3'));var rs=require(_0xe5fc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe5fc('0x5'))['db'];var utils=require(_0xe5fc('0x6'));var logger=require(_0xe5fc('0x7'))('rpc');var config=require(_0xe5fc('0x8'));var jayson=require(_0xe5fc('0x9'));var client=jayson[_0xe5fc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14d49e,_0x1497bf,_0x3bb993){return new BPromise(function(_0xafefab,_0x563a79){return client['request'](_0x14d49e,_0x3bb993)[_0xe5fc('0xb')](function(_0x2ec8d0){logger[_0xe5fc('0xc')]('CmHopper,\x20%s,\x20%s',_0x1497bf,_0xe5fc('0xd'));logger[_0xe5fc('0xe')](_0xe5fc('0xf'),_0x1497bf,_0xe5fc('0xd'),JSON[_0xe5fc('0x10')](_0x2ec8d0));if(_0x2ec8d0[_0xe5fc('0x11')]){if(_0x2ec8d0[_0xe5fc('0x11')][_0xe5fc('0x12')]===0x1f4){logger[_0xe5fc('0x11')](_0xe5fc('0x13'),_0x1497bf,_0x2ec8d0[_0xe5fc('0x11')][_0xe5fc('0x14')]);return _0x563a79(_0x2ec8d0[_0xe5fc('0x11')][_0xe5fc('0x14')]);}logger[_0xe5fc('0x11')](_0xe5fc('0x13'),_0x1497bf,_0x2ec8d0[_0xe5fc('0x11')]['message']);return _0xafefab(_0x2ec8d0['error'][_0xe5fc('0x14')]);}else{logger[_0xe5fc('0xc')](_0xe5fc('0x13'),_0x1497bf,_0xe5fc('0xd'));_0xafefab(_0x2ec8d0['result'][_0xe5fc('0x14')]);}})[_0xe5fc('0x15')](function(_0x5bd8d0){logger[_0xe5fc('0x11')](_0xe5fc('0x13'),_0x1497bf,_0x5bd8d0);_0x563a79(_0x5bd8d0);});});}exports[_0xe5fc('0x16')]=function(_0x168002){var _0x43f8fe=this;return new Promise(function(_0x264ba9,_0x4bb7c0){return db[_0xe5fc('0x17')][_0xe5fc('0x18')]({'raw':_0x168002[_0xe5fc('0x19')]?_0x168002[_0xe5fc('0x19')][_0xe5fc('0x1a')]===undefined?!![]:![]:!![],'where':_0x168002[_0xe5fc('0x19')]?_0x168002['options'][_0xe5fc('0x1b')]||null:null,'attributes':_0x168002[_0xe5fc('0x19')]?_0x168002['options'][_0xe5fc('0x1c')]||null:null,'limit':_0x168002[_0xe5fc('0x19')]?_0x168002['options'][_0xe5fc('0x1d')]||null:null,'include':_0x168002[_0xe5fc('0x19')]?_0x168002[_0xe5fc('0x19')][_0xe5fc('0x1e')]?_[_0xe5fc('0x1f')](_0x168002[_0xe5fc('0x19')][_0xe5fc('0x1e')],function(_0x1b9f98){return{'model':db[_0x1b9f98[_0xe5fc('0x20')]],'as':_0x1b9f98['as'],'attributes':_0x1b9f98[_0xe5fc('0x1c')],'include':_0x1b9f98['include']?_[_0xe5fc('0x1f')](_0x1b9f98[_0xe5fc('0x1e')],function(_0x374804){return{'model':db[_0x374804[_0xe5fc('0x20')]],'as':_0x374804['as'],'attributes':_0x374804[_0xe5fc('0x1c')],'include':_0x374804[_0xe5fc('0x1e')]?_[_0xe5fc('0x1f')](_0x374804[_0xe5fc('0x1e')],function(_0x39923f){return{'model':db[_0x39923f[_0xe5fc('0x20')]],'as':_0x39923f['as'],'attributes':_0x39923f['attributes']};}):[]};}):[]};}):[]:[]})[_0xe5fc('0xb')](function(_0x3985c6){logger[_0xe5fc('0xc')](_0xe5fc('0x16'),_0x168002);logger['debug'](_0xe5fc('0x16'),_0x168002,JSON[_0xe5fc('0x10')](_0x3985c6));_0x264ba9(_0x3985c6);})[_0xe5fc('0x15')](function(_0x26814c){logger[_0xe5fc('0x11')](_0xe5fc('0x16'),_0x26814c['message'],_0x168002);_0x4bb7c0(_0x43f8fe['error'](0x1f4,_0x26814c[_0xe5fc('0x14')]));});});};exports[_0xe5fc('0x21')]=function(_0x12664f){var _0x347a71=this;return new Promise(function(_0xa528ee,_0x58439b){return db['CmHopper'][_0xe5fc('0x22')]({'raw':_0x12664f[_0xe5fc('0x19')]?_0x12664f[_0xe5fc('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x12664f[_0xe5fc('0x19')]?_0x12664f['options'][_0xe5fc('0x1b')]||null:null,'attributes':_0x12664f['options']?_0x12664f[_0xe5fc('0x19')]['attributes']||null:null,'include':_0x12664f[_0xe5fc('0x19')]?_0x12664f[_0xe5fc('0x19')]['include']?_['map'](_0x12664f[_0xe5fc('0x19')][_0xe5fc('0x1e')],function(_0x4fec3e){return{'model':db[_0x4fec3e['model']],'as':_0x4fec3e['as'],'attributes':_0x4fec3e['attributes'],'include':_0x4fec3e['include']?_[_0xe5fc('0x1f')](_0x4fec3e[_0xe5fc('0x1e')],function(_0xcd4e0f){return{'model':db[_0xcd4e0f['model']],'as':_0xcd4e0f['as'],'attributes':_0xcd4e0f[_0xe5fc('0x1c')],'include':_0xcd4e0f[_0xe5fc('0x1e')]?_['map'](_0xcd4e0f['include'],function(_0x12939b){return{'model':db[_0x12939b[_0xe5fc('0x20')]],'as':_0x12939b['as'],'attributes':_0x12939b[_0xe5fc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe5fc('0xb')](function(_0x26e1fd){logger['info'](_0xe5fc('0x21'),_0x12664f);logger[_0xe5fc('0xe')](_0xe5fc('0x21'),_0x12664f,JSON[_0xe5fc('0x10')](_0x26e1fd));_0xa528ee(_0x26e1fd);})[_0xe5fc('0x15')](function(_0x5de841){logger[_0xe5fc('0x11')](_0xe5fc('0x21'),_0x5de841[_0xe5fc('0x14')],_0x12664f);_0x58439b(_0x347a71[_0xe5fc('0x11')](0x1f4,_0x5de841['message']));});});};exports['CreateCmHopper']=function(_0xe6fdb7){var _0x1432a5=this;return new Promise(function(_0x5b7711,_0x546ac3){return db[_0xe5fc('0x17')][_0xe5fc('0x23')](_0xe6fdb7[_0xe5fc('0x24')],{'raw':_0xe6fdb7[_0xe5fc('0x19')]?_0xe6fdb7[_0xe5fc('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xe5fc('0xb')](function(_0x103268){logger[_0xe5fc('0xc')](_0xe5fc('0x25'),_0xe6fdb7);logger[_0xe5fc('0xe')](_0xe5fc('0x25'),_0xe6fdb7,JSON['stringify'](_0x103268));_0x5b7711(_0x103268);})[_0xe5fc('0x15')](function(_0x5c05b3){logger[_0xe5fc('0x11')](_0xe5fc('0x25'),_0x5c05b3[_0xe5fc('0x14')],_0xe6fdb7);_0x546ac3(_0x1432a5[_0xe5fc('0x11')](0x1f4,_0x5c05b3[_0xe5fc('0x14')]));});});};exports[_0xe5fc('0x26')]=function(_0x36be8a){var _0x13b8a5=this;return new Promise(function(_0x3654c1,_0x2b07e8){return db['CmHopper'][_0xe5fc('0x27')](_0x36be8a[_0xe5fc('0x24')],{'raw':_0x36be8a[_0xe5fc('0x19')]?_0x36be8a['options'][_0xe5fc('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36be8a['options']?_0x36be8a[_0xe5fc('0x19')][_0xe5fc('0x1b')]||null:null,'attributes':_0x36be8a[_0xe5fc('0x19')]?_0x36be8a[_0xe5fc('0x19')]['attributes']||null:null,'limit':_0x36be8a[_0xe5fc('0x19')]?_0x36be8a[_0xe5fc('0x19')]['limit']||null:null})[_0xe5fc('0xb')](function(_0x491405){logger[_0xe5fc('0xc')]('UpdateCmHopper',_0x36be8a);logger[_0xe5fc('0xe')]('UpdateCmHopper',_0x36be8a,JSON['stringify'](_0x491405));_0x3654c1(_0x491405);})[_0xe5fc('0x15')](function(_0x1bebc3){logger[_0xe5fc('0x11')](_0xe5fc('0x26'),_0x1bebc3[_0xe5fc('0x14')],_0x36be8a);_0x2b07e8(_0x13b8a5['error'](0x1f4,_0x1bebc3[_0xe5fc('0x14')]));});});};exports[_0xe5fc('0x28')]=function(_0x1750f4){var _0x2ae8c3=this;return new Promise(function(_0x1bd012,_0x25f7da){return db['CmHopper'][_0xe5fc('0x29')]({'where':_0x1750f4[_0xe5fc('0x19')]?_0x1750f4[_0xe5fc('0x19')][_0xe5fc('0x1b')]||null:null})[_0xe5fc('0xb')](function(_0x14b2a4){logger[_0xe5fc('0xc')](_0xe5fc('0x28'),_0x1750f4);logger[_0xe5fc('0xe')](_0xe5fc('0x28'),_0x1750f4,JSON[_0xe5fc('0x10')](_0x14b2a4));_0x1bd012(_0x14b2a4);})['catch'](function(_0x414037){logger['error'](_0xe5fc('0x28'),_0x414037[_0xe5fc('0x14')],_0x1750f4);_0x25f7da(_0x2ae8c3[_0xe5fc('0x11')](0x1f4,_0x414037[_0xe5fc('0x14')]));});});};exports[_0xe5fc('0x2a')]=function(_0x535518){var _0xc0ce1=this;return new Promise(function(_0x5b95ec,_0x184a68){return db[_0xe5fc('0x2b')]['describe']()[_0xe5fc('0xb')](function(_0x366259){return db[_0xe5fc('0x2c')]['transaction'](function(_0x3898a1){return db[_0xe5fc('0x17')][_0xe5fc('0x18')]({'where':_0x535518['options']?_0x535518[_0xe5fc('0x19')][_0xe5fc('0x1b')]||null:null,'attributes':_0x535518[_0xe5fc('0x19')]?_0x535518['options'][_0xe5fc('0x1c')]||null:null,'limit':_0x535518['options']?_0x535518[_0xe5fc('0x19')][_0xe5fc('0x1d')]||null:null,'order':_0x535518['options']?_0x535518[_0xe5fc('0x19')][_0xe5fc('0x2d')]||null:null,'transaction':_0x3898a1,'lock':_0x3898a1[_0xe5fc('0x2e')][_0xe5fc('0x2f')],'include':[{'model':db[_0xe5fc('0x2b')],'as':'Contact','attributes':_[_0xe5fc('0x30')](_0x366259)},{'model':db[_0xe5fc('0x31')],'as':_0xe5fc('0x32'),'attributes':['id',_0xe5fc('0x33'),'voicePause']}]})[_0xe5fc('0xb')](function(_0x16e9d8){var _0x330d74=[];var _0x3f5ead=[];for(var _0x17180b=0x0;_0x17180b<_0x16e9d8[_0xe5fc('0x34')];_0x17180b+=0x1){var _0x5eb30f=_0x16e9d8[_0x17180b][_0xe5fc('0x35')];if(_0x5eb30f===null){_0x330d74[_0xe5fc('0x36')](_0x16e9d8[_0x17180b]['update'](_0x535518[_0xe5fc('0x24')],{'transaction':_0x3898a1}));}else if(!_0x3f5ead[_0xe5fc('0x37')](_0x5eb30f)){_0x3f5ead[_0xe5fc('0x36')](_0x5eb30f);_0x330d74['push'](_0x16e9d8[_0x17180b][_0xe5fc('0x27')](_0x535518[_0xe5fc('0x24')],{'transaction':_0x3898a1}));}}return BPromise[_0xe5fc('0x38')](_0x330d74);});})['then'](function(_0x1c85ac){logger[_0xe5fc('0xc')](_0xe5fc('0x2a'),_0x535518);logger[_0xe5fc('0xe')]('GetContactDialer',_0x535518,JSON[_0xe5fc('0x10')](_0x1c85ac));_0x5b95ec(_0x1c85ac);})[_0xe5fc('0x15')](function(_0x4b4a1d){logger[_0xe5fc('0x11')](_0xe5fc('0x2a'),_0x4b4a1d[_0xe5fc('0x14')],_0x535518);_0x184a68(_0xc0ce1[_0xe5fc('0x11')](0x1f4,_0x4b4a1d[_0xe5fc('0x14')]));});});});};exports[_0xe5fc('0x39')]=function(_0x1e3f20){var _0x1f0d02=this;return new Promise(function(_0x2b3478,_0x4eb889){return db[_0xe5fc('0x2c')][_0xe5fc('0x3a')](function(_0x483210){return db['CmHopperFinal'][_0xe5fc('0x23')](_0x1e3f20[_0xe5fc('0x24')],{'raw':_0x1e3f20[_0xe5fc('0x19')]?_0x1e3f20['options'][_0xe5fc('0x1a')]===undefined?!![]:![]:!![],'transaction':_0x483210})[_0xe5fc('0xb')](function(){return db[_0xe5fc('0x17')][_0xe5fc('0x29')]({'where':_0x1e3f20[_0xe5fc('0x19')]?_0x1e3f20['options'][_0xe5fc('0x1b')]||null:null,'transaction':_0x483210});});})[_0xe5fc('0xb')](function(_0x1f3939){logger[_0xe5fc('0xc')](_0xe5fc('0x39'),_0x1e3f20);logger[_0xe5fc('0xe')](_0xe5fc('0x39'),_0x1e3f20,JSON[_0xe5fc('0x10')](_0x1f3939));_0x2b3478(_0x1f3939);})[_0xe5fc('0x15')](function(_0xc41548){logger[_0xe5fc('0x11')](_0xe5fc('0x39'),_0xc41548['message'],_0x1e3f20);_0x4eb889(_0x1f0d02[_0xe5fc('0x11')](0x1f4,_0xc41548[_0xe5fc('0x14')]));});});};exports[_0xe5fc('0x3b')]=function(_0x268ba0){var _0x580c2c=this;return new Promise(function(_0x1f0b22,_0x19a535){return db['CmHopper'][_0xe5fc('0x18')]({'raw':_0x268ba0[_0xe5fc('0x19')]?_0x268ba0[_0xe5fc('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x268ba0[_0xe5fc('0x19')]?_0x268ba0[_0xe5fc('0x19')][_0xe5fc('0x1b')]||null:null,'attributes':[[db[_0xe5fc('0x2c')]['fn'](_0xe5fc('0x3c'),db['sequelize']['fn']('IF',db[_0xe5fc('0x2c')][_0xe5fc('0x3d')](_0xe5fc('0x3e')+util[_0xe5fc('0x3f')](_0xe5fc('0x40'),moment()[_0xe5fc('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})['then'](function(_0x3c7201){logger['info'](_0xe5fc('0x3b'),_0x268ba0);logger[_0xe5fc('0xe')]('CountReScheduled',_0x268ba0,JSON[_0xe5fc('0x10')](_0x3c7201));_0x1f0b22(_0x3c7201);})[_0xe5fc('0x15')](function(_0x5dda09){logger['error'](_0xe5fc('0x3b'),_0x5dda09[_0xe5fc('0x14')],_0x268ba0);_0x19a535(_0x580c2c[_0xe5fc('0x11')](0x1f4,_0x5dda09[_0xe5fc('0x14')]));});});};exports[_0xe5fc('0x41')]=function(_0x4f0ca0){var _0x44b8c5=this;return new Promise(function(_0x5228e6,_0x1190fd){return db[_0xe5fc('0x2b')]['describe']()[_0xe5fc('0xb')](function(_0xac8bbc){return db[_0xe5fc('0x2c')]['transaction'](function(_0x308074){return db[_0xe5fc('0x17')][_0xe5fc('0x18')]({'where':_0x4f0ca0[_0xe5fc('0x19')]?_0x4f0ca0['options']['where']||null:null,'attributes':_0x4f0ca0[_0xe5fc('0x19')]?_0x4f0ca0[_0xe5fc('0x19')]['attributes']||null:null,'limit':0x1,'order':_0x4f0ca0[_0xe5fc('0x19')]?_0x4f0ca0[_0xe5fc('0x19')]['order']||null:null,'group':db[_0xe5fc('0x17')]['UserId'],'transaction':_0x308074,'lock':_0x308074[_0xe5fc('0x2e')][_0xe5fc('0x2f')],'include':_0x4f0ca0[_0xe5fc('0x19')]?_0x4f0ca0['options'][_0xe5fc('0x1e')]?_[_0xe5fc('0x1f')](_0x4f0ca0[_0xe5fc('0x19')]['include'],function(_0x196306){return{'model':db[_0x196306['model']],'as':_0x196306['as'],'attributes':_0x196306[_0xe5fc('0x1c')],'include':_0x196306[_0xe5fc('0x1e')]?_['map'](_0x196306['include'],function(_0x3dff97){return{'model':db[_0x3dff97[_0xe5fc('0x20')]],'as':_0x3dff97['as'],'attributes':_0x3dff97[_0xe5fc('0x1c')],'include':_0x3dff97['include']?_[_0xe5fc('0x1f')](_0x3dff97[_0xe5fc('0x1e')],function(_0x26a406){return{'model':db[_0x26a406[_0xe5fc('0x20')]],'as':_0x26a406['as'],'attributes':_0x26a406[_0xe5fc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe5fc('0xb')](function(_0x58e61a){var _0x2b2ed4=[];for(var _0x24ddb3=0x0;_0x24ddb3<_0x58e61a['length'];_0x24ddb3+=0x1){_0x2b2ed4[_0xe5fc('0x36')](_0x58e61a[_0x24ddb3][_0xe5fc('0x27')](_0x4f0ca0[_0xe5fc('0x24')],{'transaction':_0x308074}));}return BPromise[_0xe5fc('0x38')](_0x2b2ed4);});})[_0xe5fc('0xb')](function(_0x32c30a){logger[_0xe5fc('0xc')]('GetContactRecallMe',_0x4f0ca0);logger[_0xe5fc('0xe')](_0xe5fc('0x41'),_0x4f0ca0,JSON[_0xe5fc('0x10')](_0x32c30a));_0x5228e6(_0x32c30a);})['catch'](function(_0x4d4d5d){logger[_0xe5fc('0x11')](_0xe5fc('0x41'),_0x4d4d5d['message'],_0x4f0ca0);_0x1190fd(_0x44b8c5['error'](0x1f4,_0x4d4d5d['message']));});});});};exports[_0xe5fc('0x42')]=function(_0x148e8d){var _0x1fc014=this;return new Promise(function(_0x586e61,_0x1a0ce8){db[_0xe5fc('0x2b')][_0xe5fc('0x43')]()['then'](function(_0x48e912){return db[_0xe5fc('0x17')][_0xe5fc('0x18')]({'raw':_0x148e8d[_0xe5fc('0x19')]?_0x148e8d[_0xe5fc('0x19')][_0xe5fc('0x1a')]===undefined?!![]:![]:!![],'where':_0x148e8d[_0xe5fc('0x19')]?_0x148e8d[_0xe5fc('0x19')][_0xe5fc('0x1b')]||null:null,'attributes':_0x148e8d['options']?_0x148e8d[_0xe5fc('0x19')][_0xe5fc('0x1c')]||null:null,'limit':_0x148e8d[_0xe5fc('0x19')]?_0x148e8d[_0xe5fc('0x19')][_0xe5fc('0x1d')]||null:null,'include':_0x148e8d[_0xe5fc('0x19')]?_0x148e8d[_0xe5fc('0x19')][_0xe5fc('0x1e')]?_['map'](_0x148e8d['options'][_0xe5fc('0x1e')],function(_0xdac35b){return{'model':db[_0xdac35b['model']],'as':_0xdac35b['as'],'attributes':_0xdac35b['as']===_0xe5fc('0x44')?_[_0xe5fc('0x30')](_0x48e912):_0xdac35b[_0xe5fc('0x1c')],'include':_0xdac35b[_0xe5fc('0x1e')]?_['map'](_0xdac35b[_0xe5fc('0x1e')],function(_0x383f88){return{'model':db[_0x383f88[_0xe5fc('0x20')]],'as':_0x383f88['as'],'attributes':_0x383f88[_0xe5fc('0x1c')],'include':_0x383f88[_0xe5fc('0x1e')]?_[_0xe5fc('0x1f')](_0x383f88[_0xe5fc('0x1e')],function(_0xb747f9){return{'model':db[_0xb747f9['model']],'as':_0xb747f9['as'],'attributes':_0xb747f9[_0xe5fc('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a0670){logger[_0xe5fc('0xc')](_0xe5fc('0x16'),_0x148e8d);logger[_0xe5fc('0xe')]('GetCmHopper',_0x148e8d,JSON[_0xe5fc('0x10')](_0x4a0670));_0x586e61(_0x4a0670);})[_0xe5fc('0x15')](function(_0xc22200){logger['error'](_0xe5fc('0x16'),_0xc22200['message'],_0x148e8d);_0x1a0ce8(_0x1fc014[_0xe5fc('0x11')](0x1f4,_0xc22200[_0xe5fc('0x14')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index a4d4b3a..6dae06d 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 _0xa35f=['post','create','/preview','getPreview','delete','/:id','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','get','/describe','describe','getOpenContacts'];(function(_0x5412bb,_0x549bbe){var _0xe625b6=function(_0x2e1d03){while(--_0x2e1d03){_0x5412bb['push'](_0x5412bb['shift']());}};_0xe625b6(++_0x549bbe);}(_0xa35f,0x141));var _0xfa35=function(_0x550e29,_0x4047f){_0x550e29=_0x550e29-0x0;var _0x3515b6=_0xa35f[_0x550e29];return _0x3515b6;};'use strict';var multer=require(_0xfa35('0x0'));var util=require(_0xfa35('0x1'));var path=require(_0xfa35('0x2'));var timeout=require(_0xfa35('0x3'));var express=require('express');var router=express[_0xfa35('0x4')]();var fs_extra=require(_0xfa35('0x5'));var auth=require(_0xfa35('0x6'));var interaction=require(_0xfa35('0x7'));var config=require(_0xfa35('0x8'));var controller=require(_0xfa35('0x9'));router['get']('/',auth[_0xfa35('0xa')](),controller['index']);router[_0xfa35('0xb')](_0xfa35('0xc'),auth[_0xfa35('0xa')](),controller[_0xfa35('0xd')]);router['get']('/opencontacts',auth[_0xfa35('0xa')](),controller[_0xfa35('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xfa35('0xf')]('/',auth[_0xfa35('0xa')](),controller[_0xfa35('0x10')]);router[_0xfa35('0xf')](_0xfa35('0x11'),auth['isAuthenticated'](),controller[_0xfa35('0x12')]);router['put']('/:id',auth[_0xfa35('0xa')](),controller['update']);router[_0xfa35('0x13')](_0xfa35('0x14'),auth[_0xfa35('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe33f=['util','path','express','../../config/environment','./cmHopper.controller','get','isAuthenticated','/describe','describe','getOpenContacts','show','post','create','/preview','getPreview','put','/:id','update','delete','destroy','exports','multer'];(function(_0xf8f75a,_0x543004){var _0x7cccdc=function(_0xb5df66){while(--_0xb5df66){_0xf8f75a['push'](_0xf8f75a['shift']());}};_0x7cccdc(++_0x543004);}(_0xe33f,0x1e3));var _0xfe33=function(_0x5a71fc,_0x2e6190){_0x5a71fc=_0x5a71fc-0x0;var _0x295d6e=_0xe33f[_0x5a71fc];return _0x295d6e;};'use strict';var multer=require(_0xfe33('0x0'));var util=require(_0xfe33('0x1'));var path=require(_0xfe33('0x2'));var timeout=require('connect-timeout');var express=require(_0xfe33('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfe33('0x4'));var controller=require(_0xfe33('0x5'));router[_0xfe33('0x6')]('/',auth[_0xfe33('0x7')](),controller['index']);router[_0xfe33('0x6')](_0xfe33('0x8'),auth['isAuthenticated'](),controller[_0xfe33('0x9')]);router['get']('/opencontacts',auth[_0xfe33('0x7')](),controller[_0xfe33('0xa')]);router[_0xfe33('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xfe33('0xb')]);router[_0xfe33('0xc')]('/',auth['isAuthenticated'](),controller[_0xfe33('0xd')]);router[_0xfe33('0xc')](_0xfe33('0xe'),auth[_0xfe33('0x7')](),controller[_0xfe33('0xf')]);router[_0xfe33('0x10')](_0xfe33('0x11'),auth['isAuthenticated'](),controller[_0xfe33('0x12')]);router[_0xfe33('0x13')](_0xfe33('0x11'),auth['isAuthenticated'](),controller[_0xfe33('0x14')]);module[_0xfe33('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index a333150..275cfcf 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55d7=['STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','INTEGER'];(function(_0x268ab3,_0x78a697){var _0x47ead0=function(_0x31ea6d){while(--_0x31ea6d){_0x268ab3['push'](_0x268ab3['shift']());}};_0x47ead0(++_0x78a697);}(_0x55d7,0x9f));var _0x755d=function(_0x368eb4,_0x1512b3){_0x368eb4=_0x368eb4-0x0;var _0x398603=_0x55d7[_0x368eb4];return _0x398603;};'use strict';var moment=require('moment');var Sequelize=require(_0x755d('0x0'));module[_0x755d('0x1')]={'CmHopperId':{'type':Sequelize[_0x755d('0x2')]},'phone':{'type':Sequelize[_0x755d('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x755d('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x755d('0x4')],'defaultValue':moment()['format'](_0x755d('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x755d('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x755d('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x755d('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x755d('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x755d('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x755d('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2892=['STRING','INTEGER','DATE','YYYY-MM-DD\x20HH:mm:ss','exports'];(function(_0x3de7e0,_0x28cbff){var _0x11d0b3=function(_0xd95412){while(--_0xd95412){_0x3de7e0['push'](_0x3de7e0['shift']());}};_0x11d0b3(++_0x28cbff);}(_0x2892,0x11c));var _0x2289=function(_0x729acc,_0x4af909){_0x729acc=_0x729acc-0x0;var _0x282b47=_0x2892[_0x729acc];return _0x282b47;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x2289('0x0')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x2289('0x1')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x2289('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x2289('0x3')],'defaultValue':moment()['format'](_0x2289('0x4'))},'countbusyretry':{'type':Sequelize[_0x2289('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2289('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2289('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x2289('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2289('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2289('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2289('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 6c9fc51..67cadae 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f9d=['to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','Content-Range','apply','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','name','send','index','CmHopperAdditionalPhone','fieldName','type','key','model','map','keys','query','attributes','intersection','fields','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','params','rawAttributes','length','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x8f9d,0x93));var _0xd8f9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8f9d[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xd8f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd8f9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd8f9('0x2'));var moment=require(_0xd8f9('0x3'));var BPromise=require(_0xd8f9('0x4'));var Mustache=require(_0xd8f9('0x5'));var util=require(_0xd8f9('0x6'));var path=require(_0xd8f9('0x7'));var sox=require(_0xd8f9('0x8'));var csv=require('to-csv');var ejs=require(_0xd8f9('0x9'));var fs=require('fs');var fs_extra=require(_0xd8f9('0xa'));var _=require(_0xd8f9('0xb'));var squel=require(_0xd8f9('0xc'));var crypto=require(_0xd8f9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd8f9('0xe'));var toCsv=require(_0xd8f9('0xf'));var querystring=require('querystring');var Papa=require(_0xd8f9('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd8f9('0x11'));var as=require(_0xd8f9('0x12'));var hardwareService=require(_0xd8f9('0x13'));var logger=require(_0xd8f9('0x14'))(_0xd8f9('0x15'));var utils=require(_0xd8f9('0x16'));var config=require(_0xd8f9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8f9('0x18'))['db'];function respondWithStatusCode(_0x56e0d6,_0x39aca0){_0x39aca0=_0x39aca0||0xcc;return function(_0x45aba0){if(_0x45aba0){return _0x56e0d6[_0xd8f9('0x19')](_0x39aca0);}return _0x56e0d6['status'](_0x39aca0)[_0xd8f9('0x1a')]();};}function respondWithResult(_0x3df6d2,_0x4cfebf){_0x4cfebf=_0x4cfebf||0xc8;return function(_0x223f10){if(_0x223f10){return _0x3df6d2['status'](_0x4cfebf)[_0xd8f9('0x1b')](_0x223f10);}};}function respondWithFilteredResult(_0x1525d6,_0x234901){return function(_0x10369c){if(_0x10369c){var _0x3a3a41=typeof _0x234901[_0xd8f9('0x1c')]===_0xd8f9('0x1d')&&typeof _0x234901['limit']==='undefined';var _0x284a1a=_0x10369c[_0xd8f9('0x1e')];var _0x4d5b8d=_0x3a3a41?0x0:_0x234901[_0xd8f9('0x1c')];var _0x47bdea=_0x3a3a41?_0x10369c[_0xd8f9('0x1e')]:_0x234901['offset']+_0x234901['limit'];var _0x58956e;if(_0x47bdea>=_0x284a1a){_0x47bdea=_0x284a1a;_0x58956e=0xc8;}else{_0x58956e=0xce;}_0x1525d6[_0xd8f9('0x1f')](_0x58956e);return _0x1525d6['set'](_0xd8f9('0x20'),_0x4d5b8d+'-'+_0x47bdea+'/'+_0x284a1a)[_0xd8f9('0x1b')](_0x10369c);}return null;};}function patchUpdates(_0x58ea35){return function(_0x3204b3){try{jsonpatch[_0xd8f9('0x21')](_0x3204b3,_0x58ea35,!![]);}catch(_0x45b2e3){return BPromise['reject'](_0x45b2e3);}return _0x3204b3[_0xd8f9('0x22')]();};}function saveUpdates(_0x260807,_0x164bf6){return function(_0x36d740){if(_0x36d740){return _0x36d740[_0xd8f9('0x23')](_0x260807)[_0xd8f9('0x24')](function(_0x4c5808){return _0x4c5808;});}return null;};}function removeEntity(_0x39fedc,_0xbd09da){return function(_0x1fcd45){if(_0x1fcd45){return _0x1fcd45[_0xd8f9('0x25')]()[_0xd8f9('0x24')](function(){var _0x4c0002=_0x1fcd45[_0xd8f9('0x26')]({'plain':!![]});var _0x1d6796=_0xd8f9('0x27');return db[_0xd8f9('0x28')][_0xd8f9('0x25')]({'where':{'type':_0x1d6796,'resourceId':_0x4c0002['id']}})[_0xd8f9('0x24')](function(){return _0x1fcd45;});})[_0xd8f9('0x24')](function(){_0x39fedc[_0xd8f9('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x464a6a,_0x4764d9){return function(_0x3967fb){if(!_0x3967fb){_0x464a6a['sendStatus'](0x194);}return _0x3967fb;};}function handleError(_0x5bd32e,_0x4c08b0){_0x4c08b0=_0x4c08b0||0x1f4;return function(_0x3f85a2){logger[_0xd8f9('0x29')](_0x3f85a2['stack']);if(_0x3f85a2[_0xd8f9('0x2a')]){delete _0x3f85a2[_0xd8f9('0x2a')];}_0x5bd32e['status'](_0x4c08b0)[_0xd8f9('0x2b')](_0x3f85a2);};}exports[_0xd8f9('0x2c')]=function(_0x2786db,_0x4caa27){var _0xda1b6d={},_0x48f7c0={},_0x1a280a={'count':0x0,'rows':[]};var _0x2f3cb9=_['map'](db[_0xd8f9('0x2d')]['rawAttributes'],function(_0x340f0a){return{'name':_0x340f0a[_0xd8f9('0x2e')],'type':_0x340f0a[_0xd8f9('0x2f')][_0xd8f9('0x30')]};});_0x48f7c0[_0xd8f9('0x31')]=_[_0xd8f9('0x32')](_0x2f3cb9,_0xd8f9('0x2a'));_0x48f7c0['query']=_[_0xd8f9('0x33')](_0x2786db['query']);_0x48f7c0['filters']=_['intersection'](_0x48f7c0['model'],_0x48f7c0[_0xd8f9('0x34')]);_0xda1b6d[_0xd8f9('0x35')]=_[_0xd8f9('0x36')](_0x48f7c0[_0xd8f9('0x31')],qs[_0xd8f9('0x37')](_0x2786db['query']['fields']));_0xda1b6d[_0xd8f9('0x35')]=_0xda1b6d[_0xd8f9('0x35')]['length']?_0xda1b6d[_0xd8f9('0x35')]:_0x48f7c0[_0xd8f9('0x31')];if(!_0x2786db[_0xd8f9('0x34')]['hasOwnProperty']('nolimit')){_0xda1b6d['limit']=qs['limit'](_0x2786db[_0xd8f9('0x34')][_0xd8f9('0x38')]);_0xda1b6d[_0xd8f9('0x1c')]=qs[_0xd8f9('0x1c')](_0x2786db[_0xd8f9('0x34')]['offset']);}_0xda1b6d[_0xd8f9('0x39')]=qs[_0xd8f9('0x3a')](_0x2786db[_0xd8f9('0x34')][_0xd8f9('0x3a')]);_0xda1b6d[_0xd8f9('0x3b')]=qs[_0xd8f9('0x3c')](_[_0xd8f9('0x3d')](_0x2786db[_0xd8f9('0x34')],_0x48f7c0[_0xd8f9('0x3c')]),_0x2f3cb9);if(_0x2786db[_0xd8f9('0x34')][_0xd8f9('0x3e')]){_0xda1b6d['where']=_[_0xd8f9('0x3f')](_0xda1b6d[_0xd8f9('0x3b')],{'$or':_[_0xd8f9('0x32')](_0x2f3cb9,function(_0x45f13d){if(_0x45f13d['type']!==_0xd8f9('0x40')){var _0x28c726={};_0x28c726[_0x45f13d[_0xd8f9('0x2a')]]={'$like':'%'+_0x2786db[_0xd8f9('0x34')][_0xd8f9('0x3e')]+'%'};return _0x28c726;}})});}_0xda1b6d=_[_0xd8f9('0x3f')]({},_0xda1b6d,_0x2786db['options']);var _0x4cbf11={'where':_0xda1b6d['where']};return db[_0xd8f9('0x2d')][_0xd8f9('0x1e')](_0x4cbf11)[_0xd8f9('0x24')](function(_0x1d8e5d){_0x1a280a[_0xd8f9('0x1e')]=_0x1d8e5d;if(_0x2786db[_0xd8f9('0x34')][_0xd8f9('0x41')]){_0xda1b6d[_0xd8f9('0x42')]=[{'all':!![]}];}return db[_0xd8f9('0x2d')]['findAll'](_0xda1b6d);})['then'](function(_0x433d06){_0x1a280a[_0xd8f9('0x43')]=_0x433d06;return _0x1a280a;})[_0xd8f9('0x24')](respondWithFilteredResult(_0x4caa27,_0xda1b6d))['catch'](handleError(_0x4caa27,null));};exports['show']=function(_0x32c300,_0x29cfc7){var _0x243ff={'raw':!![],'where':{'id':_0x32c300[_0xd8f9('0x44')]['id']}},_0x496326={};_0x496326[_0xd8f9('0x31')]=_[_0xd8f9('0x33')](db[_0xd8f9('0x2d')][_0xd8f9('0x45')]);_0x496326[_0xd8f9('0x34')]=_[_0xd8f9('0x33')](_0x32c300[_0xd8f9('0x34')]);_0x496326[_0xd8f9('0x3c')]=_['intersection'](_0x496326['model'],_0x496326['query']);_0x243ff[_0xd8f9('0x35')]=_[_0xd8f9('0x36')](_0x496326[_0xd8f9('0x31')],qs[_0xd8f9('0x37')](_0x32c300[_0xd8f9('0x34')][_0xd8f9('0x37')]));_0x243ff[_0xd8f9('0x35')]=_0x243ff[_0xd8f9('0x35')][_0xd8f9('0x46')]?_0x243ff[_0xd8f9('0x35')]:_0x496326[_0xd8f9('0x31')];if(_0x32c300[_0xd8f9('0x34')][_0xd8f9('0x41')]){_0x243ff['include']=[{'all':!![]}];}_0x243ff=_[_0xd8f9('0x3f')]({},_0x243ff,_0x32c300[_0xd8f9('0x47')]);return db[_0xd8f9('0x2d')][_0xd8f9('0x48')](_0x243ff)['then'](handleEntityNotFound(_0x29cfc7,null))[_0xd8f9('0x24')](respondWithResult(_0x29cfc7,null))['catch'](handleError(_0x29cfc7,null));};exports['create']=function(_0x39fe25,_0x14e622){return db[_0xd8f9('0x2d')][_0xd8f9('0x49')](_0x39fe25[_0xd8f9('0x4a')],{})[_0xd8f9('0x24')](function(_0x2fd4d3){var _0xaad657=_0x39fe25[_0xd8f9('0x4b')][_0xd8f9('0x26')]({'plain':!![]});if(!_0xaad657)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xaad657['role']==='user'){var _0x1bb936=_0x2fd4d3[_0xd8f9('0x26')]({'plain':!![]});var _0x4965d0=_0xd8f9('0x27');return db[_0xd8f9('0x4c')][_0xd8f9('0x48')]({'where':{'name':_0x4965d0,'userProfileId':_0xaad657[_0xd8f9('0x4d')]},'raw':!![]})[_0xd8f9('0x24')](function(_0xac9c08){if(_0xac9c08&&_0xac9c08[_0xd8f9('0x4e')]===0x0){return db[_0xd8f9('0x28')]['create']({'name':_0x1bb936[_0xd8f9('0x2a')],'resourceId':_0x1bb936['id'],'type':_0xac9c08[_0xd8f9('0x2a')],'sectionId':_0xac9c08['id']},{})[_0xd8f9('0x24')](function(){return _0x2fd4d3;});}else{return _0x2fd4d3;}})[_0xd8f9('0x4f')](function(_0xaf7e91){logger[_0xd8f9('0x29')](_0xd8f9('0x50'),_0xaf7e91);throw _0xaf7e91;});}return _0x2fd4d3;})[_0xd8f9('0x24')](respondWithResult(_0x14e622,0xc9))[_0xd8f9('0x4f')](handleError(_0x14e622,null));};exports[_0xd8f9('0x23')]=function(_0x2bbff4,_0x5ad787){if(_0x2bbff4[_0xd8f9('0x4a')]['id']){delete _0x2bbff4[_0xd8f9('0x4a')]['id'];}return db[_0xd8f9('0x2d')][_0xd8f9('0x48')]({'where':{'id':_0x2bbff4['params']['id']}})[_0xd8f9('0x24')](handleEntityNotFound(_0x5ad787,null))[_0xd8f9('0x24')](saveUpdates(_0x2bbff4[_0xd8f9('0x4a')],null))['then'](respondWithResult(_0x5ad787,null))[_0xd8f9('0x4f')](handleError(_0x5ad787,null));};exports[_0xd8f9('0x25')]=function(_0x2218da,_0x2499e4){return db['CmHopperAdditionalPhone'][_0xd8f9('0x48')]({'where':{'id':_0x2218da[_0xd8f9('0x44')]['id']}})['then'](handleEntityNotFound(_0x2499e4,null))['then'](removeEntity(_0x2499e4,null))[_0xd8f9('0x4f')](handleError(_0x2499e4,null));}; \ No newline at end of file +var _0x1c3d=['where','includeAll','include','findAll','show','params','length','options','find','catch','create','body','user','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','sendStatus','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','pick','merge','VIRTUAL'];(function(_0x2b883c,_0x266b94){var _0x522203=function(_0x57e1b8){while(--_0x57e1b8){_0x2b883c['push'](_0x2b883c['shift']());}};_0x522203(++_0x266b94);}(_0x1c3d,0x68));var _0xd1c3=function(_0x2c87b3,_0x25d3df){_0x2c87b3=_0x2c87b3-0x0;var _0x32f2e6=_0x1c3d[_0x2c87b3];return _0x32f2e6;};'use strict';var emlformat=require(_0xd1c3('0x0'));var rimraf=require(_0xd1c3('0x1'));var zipdir=require(_0xd1c3('0x2'));var jsonpatch=require(_0xd1c3('0x3'));var rp=require(_0xd1c3('0x4'));var moment=require('moment');var BPromise=require(_0xd1c3('0x5'));var Mustache=require(_0xd1c3('0x6'));var util=require(_0xd1c3('0x7'));var path=require(_0xd1c3('0x8'));var sox=require(_0xd1c3('0x9'));var csv=require(_0xd1c3('0xa'));var ejs=require(_0xd1c3('0xb'));var fs=require('fs');var fs_extra=require(_0xd1c3('0xc'));var _=require(_0xd1c3('0xd'));var squel=require(_0xd1c3('0xe'));var crypto=require(_0xd1c3('0xf'));var jsforce=require(_0xd1c3('0x10'));var deskjs=require(_0xd1c3('0x11'));var toCsv=require('to-csv');var querystring=require(_0xd1c3('0x12'));var Papa=require(_0xd1c3('0x13'));var Redis=require(_0xd1c3('0x14'));var authService=require(_0xd1c3('0x15'));var qs=require(_0xd1c3('0x16'));var as=require(_0xd1c3('0x17'));var hardwareService=require(_0xd1c3('0x18'));var logger=require(_0xd1c3('0x19'))(_0xd1c3('0x1a'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3889f4,_0x38cd87){_0x38cd87=_0x38cd87||0xcc;return function(_0x5c2e99){if(_0x5c2e99){return _0x3889f4['sendStatus'](_0x38cd87);}return _0x3889f4['status'](_0x38cd87)[_0xd1c3('0x1b')]();};}function respondWithResult(_0x3e9ff0,_0x47cf3d){_0x47cf3d=_0x47cf3d||0xc8;return function(_0x413257){if(_0x413257){return _0x3e9ff0[_0xd1c3('0x1c')](_0x47cf3d)[_0xd1c3('0x1d')](_0x413257);}};}function respondWithFilteredResult(_0x1716f7,_0x5aaeea){return function(_0x51ab1a){if(_0x51ab1a){var _0xd839c3=typeof _0x5aaeea[_0xd1c3('0x1e')]==='undefined'&&typeof _0x5aaeea['limit']===_0xd1c3('0x1f');var _0x3b07ca=_0x51ab1a[_0xd1c3('0x20')];var _0x4cfdee=_0xd839c3?0x0:_0x5aaeea['offset'];var _0x474791=_0xd839c3?_0x51ab1a[_0xd1c3('0x20')]:_0x5aaeea[_0xd1c3('0x1e')]+_0x5aaeea[_0xd1c3('0x21')];var _0x4054a0;if(_0x474791>=_0x3b07ca){_0x474791=_0x3b07ca;_0x4054a0=0xc8;}else{_0x4054a0=0xce;}_0x1716f7[_0xd1c3('0x1c')](_0x4054a0);return _0x1716f7[_0xd1c3('0x22')](_0xd1c3('0x23'),_0x4cfdee+'-'+_0x474791+'/'+_0x3b07ca)[_0xd1c3('0x1d')](_0x51ab1a);}return null;};}function patchUpdates(_0x301b0e){return function(_0x42a12e){try{jsonpatch[_0xd1c3('0x24')](_0x42a12e,_0x301b0e,!![]);}catch(_0x2fef09){return BPromise[_0xd1c3('0x25')](_0x2fef09);}return _0x42a12e[_0xd1c3('0x26')]();};}function saveUpdates(_0x3f1f2b,_0x3f19f0){return function(_0x3ee91b){if(_0x3ee91b){return _0x3ee91b[_0xd1c3('0x27')](_0x3f1f2b)[_0xd1c3('0x28')](function(_0x2c1ae4){return _0x2c1ae4;});}return null;};}function removeEntity(_0x1fe705,_0xdf6074){return function(_0x56bbd1){if(_0x56bbd1){return _0x56bbd1['destroy']()[_0xd1c3('0x28')](function(){var _0x953158=_0x56bbd1[_0xd1c3('0x29')]({'plain':!![]});var _0x3fea9c='CmHopperAdditionalPhones';return db['UserProfileResource']['destroy']({'where':{'type':_0x3fea9c,'resourceId':_0x953158['id']}})[_0xd1c3('0x28')](function(){return _0x56bbd1;});})[_0xd1c3('0x28')](function(){_0x1fe705['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cf210,_0x16d755){return function(_0x1dca36){if(!_0x1dca36){_0x4cf210[_0xd1c3('0x2a')](0x194);}return _0x1dca36;};}function handleError(_0xe35b76,_0x5b54b8){_0x5b54b8=_0x5b54b8||0x1f4;return function(_0x40d896){logger[_0xd1c3('0x2b')](_0x40d896[_0xd1c3('0x2c')]);if(_0x40d896[_0xd1c3('0x2d')]){delete _0x40d896[_0xd1c3('0x2d')];}_0xe35b76[_0xd1c3('0x1c')](_0x5b54b8)[_0xd1c3('0x2e')](_0x40d896);};}exports[_0xd1c3('0x2f')]=function(_0x2d0ca1,_0x26b98e){var _0x5a9635={},_0x1e6f2c={},_0x10530a={'count':0x0,'rows':[]};var _0x5b74c9=_[_0xd1c3('0x30')](db[_0xd1c3('0x31')][_0xd1c3('0x32')],function(_0x37a393){return{'name':_0x37a393[_0xd1c3('0x33')],'type':_0x37a393[_0xd1c3('0x34')][_0xd1c3('0x35')]};});_0x1e6f2c[_0xd1c3('0x36')]=_[_0xd1c3('0x30')](_0x5b74c9,'name');_0x1e6f2c[_0xd1c3('0x37')]=_[_0xd1c3('0x38')](_0x2d0ca1[_0xd1c3('0x37')]);_0x1e6f2c[_0xd1c3('0x39')]=_[_0xd1c3('0x3a')](_0x1e6f2c[_0xd1c3('0x36')],_0x1e6f2c['query']);_0x5a9635['attributes']=_[_0xd1c3('0x3a')](_0x1e6f2c[_0xd1c3('0x36')],qs[_0xd1c3('0x3b')](_0x2d0ca1['query']['fields']));_0x5a9635[_0xd1c3('0x3c')]=_0x5a9635[_0xd1c3('0x3c')]['length']?_0x5a9635[_0xd1c3('0x3c')]:_0x1e6f2c[_0xd1c3('0x36')];if(!_0x2d0ca1[_0xd1c3('0x37')][_0xd1c3('0x3d')]('nolimit')){_0x5a9635[_0xd1c3('0x21')]=qs[_0xd1c3('0x21')](_0x2d0ca1['query'][_0xd1c3('0x21')]);_0x5a9635[_0xd1c3('0x1e')]=qs[_0xd1c3('0x1e')](_0x2d0ca1['query']['offset']);}_0x5a9635['order']=qs[_0xd1c3('0x3e')](_0x2d0ca1['query'][_0xd1c3('0x3e')]);_0x5a9635['where']=qs[_0xd1c3('0x39')](_[_0xd1c3('0x3f')](_0x2d0ca1[_0xd1c3('0x37')],_0x1e6f2c[_0xd1c3('0x39')]),_0x5b74c9);if(_0x2d0ca1[_0xd1c3('0x37')]['filter']){_0x5a9635['where']=_[_0xd1c3('0x40')](_0x5a9635['where'],{'$or':_[_0xd1c3('0x30')](_0x5b74c9,function(_0x11b46e){if(_0x11b46e[_0xd1c3('0x34')]!==_0xd1c3('0x41')){var _0x46f0ff={};_0x46f0ff[_0x11b46e['name']]={'$like':'%'+_0x2d0ca1[_0xd1c3('0x37')]['filter']+'%'};return _0x46f0ff;}})});}_0x5a9635=_[_0xd1c3('0x40')]({},_0x5a9635,_0x2d0ca1['options']);var _0x5d29aa={'where':_0x5a9635[_0xd1c3('0x42')]};return db['CmHopperAdditionalPhone'][_0xd1c3('0x20')](_0x5d29aa)[_0xd1c3('0x28')](function(_0x40588c){_0x10530a[_0xd1c3('0x20')]=_0x40588c;if(_0x2d0ca1[_0xd1c3('0x37')][_0xd1c3('0x43')]){_0x5a9635[_0xd1c3('0x44')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0xd1c3('0x45')](_0x5a9635);})[_0xd1c3('0x28')](function(_0x183075){_0x10530a['rows']=_0x183075;return _0x10530a;})[_0xd1c3('0x28')](respondWithFilteredResult(_0x26b98e,_0x5a9635))['catch'](handleError(_0x26b98e,null));};exports[_0xd1c3('0x46')]=function(_0x430e4c,_0x54a288){var _0x273f46={'raw':!![],'where':{'id':_0x430e4c[_0xd1c3('0x47')]['id']}},_0x349807={};_0x349807[_0xd1c3('0x36')]=_[_0xd1c3('0x38')](db[_0xd1c3('0x31')][_0xd1c3('0x32')]);_0x349807[_0xd1c3('0x37')]=_[_0xd1c3('0x38')](_0x430e4c[_0xd1c3('0x37')]);_0x349807[_0xd1c3('0x39')]=_[_0xd1c3('0x3a')](_0x349807[_0xd1c3('0x36')],_0x349807['query']);_0x273f46['attributes']=_[_0xd1c3('0x3a')](_0x349807[_0xd1c3('0x36')],qs[_0xd1c3('0x3b')](_0x430e4c[_0xd1c3('0x37')]['fields']));_0x273f46[_0xd1c3('0x3c')]=_0x273f46[_0xd1c3('0x3c')][_0xd1c3('0x48')]?_0x273f46[_0xd1c3('0x3c')]:_0x349807[_0xd1c3('0x36')];if(_0x430e4c[_0xd1c3('0x37')]['includeAll']){_0x273f46['include']=[{'all':!![]}];}_0x273f46=_[_0xd1c3('0x40')]({},_0x273f46,_0x430e4c[_0xd1c3('0x49')]);return db['CmHopperAdditionalPhone'][_0xd1c3('0x4a')](_0x273f46)[_0xd1c3('0x28')](handleEntityNotFound(_0x54a288,null))[_0xd1c3('0x28')](respondWithResult(_0x54a288,null))[_0xd1c3('0x4b')](handleError(_0x54a288,null));};exports[_0xd1c3('0x4c')]=function(_0x1f939e,_0x590dd6){return db[_0xd1c3('0x31')][_0xd1c3('0x4c')](_0x1f939e[_0xd1c3('0x4d')],{})['then'](function(_0x44af87){var _0x21599b=_0x1f939e[_0xd1c3('0x4e')]['get']({'plain':!![]});if(!_0x21599b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21599b['role']===_0xd1c3('0x4e')){var _0x9a72e1=_0x44af87[_0xd1c3('0x29')]({'plain':!![]});var _0x295b7e=_0xd1c3('0x4f');return db[_0xd1c3('0x50')][_0xd1c3('0x4a')]({'where':{'name':_0x295b7e,'userProfileId':_0x21599b[_0xd1c3('0x51')]},'raw':!![]})['then'](function(_0x3c0e3a){if(_0x3c0e3a&&_0x3c0e3a[_0xd1c3('0x52')]===0x0){return db[_0xd1c3('0x53')][_0xd1c3('0x4c')]({'name':_0x9a72e1[_0xd1c3('0x2d')],'resourceId':_0x9a72e1['id'],'type':_0x3c0e3a['name'],'sectionId':_0x3c0e3a['id']},{})['then'](function(){return _0x44af87;});}else{return _0x44af87;}})[_0xd1c3('0x4b')](function(_0x2ff49b){logger[_0xd1c3('0x2b')](_0xd1c3('0x54'),_0x2ff49b);throw _0x2ff49b;});}return _0x44af87;})['then'](respondWithResult(_0x590dd6,0xc9))[_0xd1c3('0x4b')](handleError(_0x590dd6,null));};exports[_0xd1c3('0x27')]=function(_0x1687d0,_0x15451a){if(_0x1687d0[_0xd1c3('0x4d')]['id']){delete _0x1687d0[_0xd1c3('0x4d')]['id'];}return db[_0xd1c3('0x31')][_0xd1c3('0x4a')]({'where':{'id':_0x1687d0['params']['id']}})[_0xd1c3('0x28')](handleEntityNotFound(_0x15451a,null))[_0xd1c3('0x28')](saveUpdates(_0x1687d0[_0xd1c3('0x4d')],null))['then'](respondWithResult(_0x15451a,null))['catch'](handleError(_0x15451a,null));};exports['destroy']=function(_0xa46040,_0x55eaf0){return db[_0xd1c3('0x31')][_0xd1c3('0x4a')]({'where':{'id':_0xa46040['params']['id']}})[_0xd1c3('0x28')](handleEntityNotFound(_0x55eaf0,null))[_0xd1c3('0x28')](removeEntity(_0x55eaf0,null))['catch'](handleError(_0x55eaf0,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index a086c77..705266c 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a7e=['path','cm_hopper_additional_phones','lodash','util','../../config/logger','moment','bluebird'];(function(_0xce5cff,_0x495979){var _0x29d165=function(_0x1100dc){while(--_0x1100dc){_0xce5cff['push'](_0xce5cff['shift']());}};_0x29d165(++_0x495979);}(_0x3a7e,0x19f));var _0xe3a7=function(_0x4629ee,_0x5802d8){_0x4629ee=_0x4629ee-0x0;var _0x47fb5b=_0x3a7e[_0x4629ee];return _0x47fb5b;};'use strict';var _=require(_0xe3a7('0x0'));var util=require(_0xe3a7('0x1'));var logger=require(_0xe3a7('0x2'))('api');var moment=require(_0xe3a7('0x3'));var BPromise=require(_0xe3a7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3a7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperAdditionalPhone.attributes');module['exports']=function(_0x2670dd,_0x4f02ce){return _0x2670dd['define']('CmHopperAdditionalPhone',attributes,{'tableName':_0xe3a7('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e8e=['./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x521f06,_0x1f8e7c){var _0x410a40=function(_0x471e9d){while(--_0x471e9d){_0x521f06['push'](_0x521f06['shift']());}};_0x410a40(++_0x1f8e7c);}(_0x9e8e,0xb7));var _0xe9e8=function(_0x490797,_0x33302b){_0x490797=_0x490797-0x0;var _0x30bb98=_0x9e8e[_0x490797];return _0x30bb98;};'use strict';var _=require('lodash');var util=require(_0xe9e8('0x0'));var logger=require(_0xe9e8('0x1'))(_0xe9e8('0x2'));var moment=require(_0xe9e8('0x3'));var BPromise=require(_0xe9e8('0x4'));var rp=require(_0xe9e8('0x5'));var fs=require('fs');var path=require(_0xe9e8('0x6'));var rimraf=require(_0xe9e8('0x7'));var config=require(_0xe9e8('0x8'));var attributes=require(_0xe9e8('0x9'));module['exports']=function(_0x3a0dd2,_0x134afa){return _0x3a0dd2[_0xe9e8('0xa')](_0xe9e8('0xb'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 1b5f638..c11ae49 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fd1=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','ASC','countbusyretry','countnoanswerretry','countmachineretry','catch','VerifyAdditionalPhones','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','phone','isNil','createdAt','updatedAt','hopperToAdd','additionalToHop','transaction','update','IncrementPreviewCounters','lodash'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5fd1,0x155));var _0x15fd=function(_0x5e8236,_0x34d6e0){_0x5e8236=_0x5e8236-0x0;var _0x177ee9=_0x5fd1[_0x5e8236];return _0x177ee9;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var moment=require(_0x15fd('0x1'));var BPromise=require(_0x15fd('0x2'));var rs=require(_0x15fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x15fd('0x7'));var client=jayson[_0x15fd('0x8')][_0x15fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e88bf,_0x225728,_0x534e63){return new BPromise(function(_0x210e90,_0x1ee117){return client[_0x15fd('0xa')](_0x2e88bf,_0x534e63)['then'](function(_0x2d2fbb){logger['info'](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));logger['debug']('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x225728,'request\x20sent',JSON[_0x15fd('0xd')](_0x2d2fbb));if(_0x2d2fbb[_0x15fd('0xe')]){if(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0xf')]===0x1f4){logger[_0x15fd('0xe')](_0x15fd('0xb'),_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x1ee117(_0x2d2fbb[_0x15fd('0xe')]['message']);}logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x210e90(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);}else{logger[_0x15fd('0x11')](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));_0x210e90(_0x2d2fbb[_0x15fd('0x12')]['message']);}})['catch'](function(_0x25f139){logger['error'](_0x15fd('0xb'),_0x225728,_0x25f139);_0x1ee117(_0x25f139);});});}exports['VerifyAdditionalPhones']=function(_0x917fe4){var _0x318f47=this;return new Promise(function(_0x855bae,_0x49ceac){return db[_0x15fd('0x13')][_0x15fd('0x14')]({'raw':!![],'where':{'ContactId':_0x917fe4[_0x15fd('0x15')][_0x15fd('0x16')],'ListId':_0x917fe4[_0x15fd('0x15')][_0x15fd('0x17')],'VoiceQueueId':_0x917fe4[_0x15fd('0x15')][_0x15fd('0x18')]===undefined?null:_0x917fe4[_0x15fd('0x15')][_0x15fd('0x18')],'CampaignId':_0x917fe4[_0x15fd('0x15')]['CampaignId']===undefined?null:_0x917fe4['body'][_0x15fd('0x19')]}})[_0x15fd('0x1a')](function(_0x252a1c){if(_0x252a1c!=null){return db[_0x15fd('0x1b')][_0x15fd('0x14')]({'raw':!![],'where':{'CmHopperId':_0x252a1c['id'],'OrderBy':{'$gt':_0x252a1c[_0x15fd('0x1c')]}},'order':[[_0x15fd('0x1c'),'ASC']]})[_0x15fd('0x1a')](function(_0x2d19ac){var _0xc0883c=0x0;if(_0x2d19ac){if(_0x2d19ac['countbusyretry']+_0x2d19ac[_0x15fd('0x1d')]+_0x2d19ac['countnoanswerretry']+_0x2d19ac[_0x15fd('0x1e')]+_0x2d19ac[_0x15fd('0x1f')]+_0x2d19ac[_0x15fd('0x20')]+_0x2d19ac['countmachineretry']+_0x2d19ac[_0x15fd('0x21')]<_0x917fe4[_0x15fd('0x22')][_0x15fd('0x23')])_0xc0883c=0x1;_0x855bae({'additional':_0xc0883c});}else{return db['CmHopperAdditionalPhone'][_0x15fd('0x14')]({'raw':!![],'where':{'CmHopperId':_0x252a1c['id']},'order':[['OrderBy',_0x15fd('0x24')]]})[_0x15fd('0x1a')](function(_0x2e9886){var _0x27d2c4=0x0;if(_0x2e9886){if(_0x2e9886[_0x15fd('0x25')]+_0x2e9886[_0x15fd('0x1d')]+_0x2e9886[_0x15fd('0x26')]+_0x2e9886[_0x15fd('0x1e')]+_0x2e9886[_0x15fd('0x1f')]+_0x2e9886[_0x15fd('0x20')]+_0x2e9886[_0x15fd('0x27')]+_0x2e9886['countagentrejectretry']<_0x917fe4[_0x15fd('0x22')][_0x15fd('0x23')])_0x27d2c4=0x1;_0x855bae({'additional':_0x27d2c4});}else{_0x855bae({'additional':0x0});}})['catch'](function(_0x39e744){logger[_0x15fd('0xe')]('VerifyAdditionalPhones',_0x39e744[_0x15fd('0x10')],_0x917fe4);_0x49ceac(_0x318f47[_0x15fd('0xe')](0x1f4,_0x39e744['message']));});}})[_0x15fd('0x28')](function(_0x199647){logger[_0x15fd('0xe')](_0x15fd('0x29'),_0x199647[_0x15fd('0x10')],_0x917fe4);_0x49ceac(_0x318f47[_0x15fd('0xe')](0x1f4,_0x199647['message']));});}else _0x855bae({'additional':0x0});});});};exports[_0x15fd('0x2a')]=function(_0x7ac52b){var _0x4228ea=this;return new Promise(function(_0x1c3d5e,_0x594b8c){return db[_0x15fd('0x13')][_0x15fd('0x14')]({'raw':!![],'where':{'ContactId':_0x7ac52b[_0x15fd('0x15')][_0x15fd('0x16')],'ListId':_0x7ac52b[_0x15fd('0x15')][_0x15fd('0x17')],'VoiceQueueId':_0x7ac52b['body'][_0x15fd('0x18')]===undefined?null:_0x7ac52b[_0x15fd('0x15')]['VoiceQueueId'],'CampaignId':_0x7ac52b[_0x15fd('0x15')][_0x15fd('0x19')]===undefined?null:_0x7ac52b[_0x15fd('0x15')]['CampaignId']}})[_0x15fd('0x1a')](function(_0x309851){if(_0x309851!=null){return db[_0x15fd('0x1b')][_0x15fd('0x14')]({'raw':!![],'where':{'CmHopperId':_0x309851['id'],'OrderBy':{'$gte':_0x309851[_0x15fd('0x1c')]}},'order':[[_0x15fd('0x1c'),'ASC']]})['then'](function(_0x502021){if(_0x502021)return activateAdditionalPhone(_0x309851,_0x7ac52b[_0x15fd('0x15')],_0x502021,_0x7ac52b[_0x15fd('0x2b')],_0x7ac52b[_0x15fd('0x2c')])['then'](function(_0x533585){_0x1c3d5e(_0x533585);});else{return db[_0x15fd('0x1b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x309851['id']},'order':[['OrderBy','ASC']]})[_0x15fd('0x1a')](function(_0x10702c){if(_0x10702c)return activateAdditionalPhone(_0x309851,_0x7ac52b[_0x15fd('0x15')],_0x10702c,_0x7ac52b['duration'],_0x7ac52b[_0x15fd('0x2c')])[_0x15fd('0x1a')](function(_0xd85d3e){_0x1c3d5e(_0xd85d3e);});else{_0x1c3d5e({'id':_0x309851['id'],'phone':''});}})['catch'](function(_0x1d693e){logger[_0x15fd('0xe')](_0x15fd('0x29'),_0x1d693e[_0x15fd('0x10')],_0x7ac52b);_0x594b8c(_0x4228ea[_0x15fd('0xe')](0x1f4,_0x1d693e[_0x15fd('0x10')]));});}})[_0x15fd('0x28')](function(_0x12a894){logger[_0x15fd('0xe')]('VerifyAdditionalPhones',_0x12a894[_0x15fd('0x10')],_0x7ac52b);_0x594b8c(_0x4228ea[_0x15fd('0xe')](0x1f4,_0x12a894[_0x15fd('0x10')]));});}else _0x1c3d5e(0x1);});});};function activateAdditionalPhone(_0x304736,_0x2d2b6f,_0x5f9429,_0x320104,_0xda4ca2){return new Promise(function(_0x343ce6,_0x104eef){logger[_0x15fd('0x11')](_0x15fd('0x29'),_0x5f9429);var _0x269aae;if(moment()>moment(_0x5f9429[_0x15fd('0x2d')])){_0x269aae=moment()[_0x15fd('0x2e')](_0xda4ca2||0x3,'minutes');}else{if(_0x5f9429[_0x15fd('0x1c')]==0x0){_0x269aae=moment(_0x5f9429[_0x15fd('0x2d')]);}else{_0x269aae=moment()[_0x15fd('0x2e')](_0xda4ca2||0x3,_0x15fd('0x2f'));}}var _0x1a2604={'phone':_0x304736[_0x15fd('0x30')],'active':0x0,'OrderBy':_[_0x15fd('0x31')](_0x304736[_0x15fd('0x1c')])?0x0:_0x304736['OrderBy'],'scheduledat':moment()['add'](_0x320104||0x1,_0x15fd('0x2f')),'countbusyretry':_0x2d2b6f['countbusyretry'],'countcongestionretry':_0x2d2b6f[_0x15fd('0x1d')],'countnoanswerretry':_0x2d2b6f[_0x15fd('0x26')],'countnosuchnumberretry':_0x2d2b6f['countnosuchnumberretry'],'countdropretry':_0x2d2b6f[_0x15fd('0x1f')],'countabandonedretry':_0x2d2b6f[_0x15fd('0x20')],'countmachineretry':_0x2d2b6f[_0x15fd('0x27')],'countagentrejectretry':_0x2d2b6f[_0x15fd('0x21')],'createdAt':_0x2d2b6f[_0x15fd('0x32')],'updatedAt':_0x2d2b6f[_0x15fd('0x33')]};var _0x494f83={'CmHopperId':_0x304736['id'],'phone':_0x5f9429[_0x15fd('0x30')],'active':0x0,'OrderBy':_[_0x15fd('0x31')](_0x5f9429[_0x15fd('0x1c')])?0x0:_0x5f9429[_0x15fd('0x1c')],'scheduledat':_0x269aae,'countbusyretry':_0x5f9429[_0x15fd('0x25')],'countcongestionretry':_0x5f9429[_0x15fd('0x1d')],'countnoanswerretry':_0x5f9429[_0x15fd('0x26')],'countnosuchnumberretry':_0x5f9429[_0x15fd('0x1e')],'countdropretry':_0x5f9429[_0x15fd('0x1f')],'countabandonedretry':_0x5f9429[_0x15fd('0x20')],'countmachineretry':_0x5f9429[_0x15fd('0x27')],'countagentrejectretry':_0x5f9429[_0x15fd('0x21')],'createdAt':_0x5f9429['createdAt'],'updatedAt':_0x5f9429[_0x15fd('0x33')]};logger['info'](_0x15fd('0x34'),_0x1a2604);logger[_0x15fd('0x11')](_0x15fd('0x35'),_0x494f83);return db['sequelize'][_0x15fd('0x36')](function(_0xa31899){return db[_0x15fd('0x1b')][_0x15fd('0x37')](_0x1a2604,{'where':{'id':_0x5f9429['id']}},{'transaction':_0xa31899})['then'](function(){return db[_0x15fd('0x13')][_0x15fd('0x37')](_0x494f83,{'where':{'id':_0x304736['id']}},{'transaction':_0xa31899});});})[_0x15fd('0x1a')](function(_0x2d9018){_0x343ce6({'id':_0x304736['id'],'phone':_0x5f9429['phone']});})[_0x15fd('0x28')](function(_0x322623){logger['error']('VerifyAdditionalPhones',_0x322623['message'],req);_0x104eef(_this[_0x15fd('0xe')](0x1f4,_0x322623[_0x15fd('0x10')]));});});}exports[_0x15fd('0x38')]=function(_0x10cf04){var _0x292174=this;return new Promise(function(_0x33a128,_0x595501){return db[_0x15fd('0x13')][_0x15fd('0x37')](_0x10cf04[_0x15fd('0x15')]['field'],{'where':{'id':_0x10cf04[_0x15fd('0x15')]['id']}})['then'](function(_0x3a48e7){_0x33a128(_0x3a48e7);})[_0x15fd('0x28')](function(_0x453949){logger[_0x15fd('0xe')](_0x15fd('0x38'),_0x453949[_0x15fd('0x10')],_0x10cf04);_0x595501(_0x292174[_0x15fd('0xe')](0x1f4,_0x453949[_0x15fd('0x10')]));});});}; \ No newline at end of file +var _0xaa3f=['entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countcongestionretry','VerifyAdditionalPhones','SwapAdditionalPhones','CmHopper','duration','waitTime','add','minutes','isNil','createdAt','updatedAt','hopperToAdd','additionalToHop','sequelize','update','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','CmHopperAdditionalPhone,\x20%s,\x20%s','catch','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x101a17,_0x5d047a){var _0x3b76ee=function(_0x89be1b){while(--_0x89be1b){_0x101a17['push'](_0x101a17['shift']());}};_0x3b76ee(++_0x5d047a);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x5712b0,_0x457fb1){_0x5712b0=_0x5712b0-0x0;var _0x20297e=_0xaa3f[_0x5712b0];return _0x20297e;};'use strict';var _=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var moment=require(_0xfaa3('0x2'));var BPromise=require(_0xfaa3('0x3'));var rs=require(_0xfaa3('0x4'));var fs=require('fs');var Redis=require(_0xfaa3('0x5'));var db=require(_0xfaa3('0x6'))['db'];var utils=require(_0xfaa3('0x7'));var logger=require(_0xfaa3('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfaa3('0x9'));var client=jayson['client'][_0xfaa3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeecce5,_0x352958,_0xbf270c){return new BPromise(function(_0x328d5f,_0x2e422d){return client[_0xfaa3('0xb')](_0xeecce5,_0xbf270c)['then'](function(_0x37bcd5){logger[_0xfaa3('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x352958,'request\x20sent');logger[_0xfaa3('0xd')](_0xfaa3('0xe'),_0x352958,_0xfaa3('0xf'),JSON[_0xfaa3('0x10')](_0x37bcd5));if(_0x37bcd5[_0xfaa3('0x11')]){if(_0x37bcd5[_0xfaa3('0x11')]['code']===0x1f4){logger[_0xfaa3('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x352958,_0x37bcd5[_0xfaa3('0x11')][_0xfaa3('0x12')]);return _0x2e422d(_0x37bcd5[_0xfaa3('0x11')]['message']);}logger[_0xfaa3('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x352958,_0x37bcd5[_0xfaa3('0x11')][_0xfaa3('0x12')]);return _0x328d5f(_0x37bcd5[_0xfaa3('0x11')][_0xfaa3('0x12')]);}else{logger[_0xfaa3('0xc')](_0xfaa3('0x13'),_0x352958,'request\x20sent');_0x328d5f(_0x37bcd5['result'][_0xfaa3('0x12')]);}})[_0xfaa3('0x14')](function(_0x407384){logger[_0xfaa3('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x352958,_0x407384);_0x2e422d(_0x407384);});});}exports['VerifyAdditionalPhones']=function(_0x50f121){var _0x598473=this;return new Promise(function(_0x499148,_0x275a07){return db['CmHopper'][_0xfaa3('0x15')]({'raw':!![],'where':{'ContactId':_0x50f121[_0xfaa3('0x16')][_0xfaa3('0x17')],'ListId':_0x50f121[_0xfaa3('0x16')][_0xfaa3('0x18')],'VoiceQueueId':_0x50f121[_0xfaa3('0x16')][_0xfaa3('0x19')]===undefined?null:_0x50f121[_0xfaa3('0x16')][_0xfaa3('0x19')],'CampaignId':_0x50f121[_0xfaa3('0x16')]['CampaignId']===undefined?null:_0x50f121[_0xfaa3('0x16')][_0xfaa3('0x1a')]}})[_0xfaa3('0x1b')](function(_0x42b214){if(_0x42b214!=null){return db['CmHopperAdditionalPhone'][_0xfaa3('0x15')]({'raw':!![],'where':{'CmHopperId':_0x42b214['id'],'OrderBy':{'$gt':_0x42b214[_0xfaa3('0x1c')]}},'order':[[_0xfaa3('0x1c'),_0xfaa3('0x1d')]]})[_0xfaa3('0x1b')](function(_0x1fc244){var _0x2f2989=0x0;if(_0x1fc244){if(_0x1fc244[_0xfaa3('0x1e')]+_0x1fc244['countcongestionretry']+_0x1fc244[_0xfaa3('0x1f')]+_0x1fc244[_0xfaa3('0x20')]+_0x1fc244[_0xfaa3('0x21')]+_0x1fc244[_0xfaa3('0x22')]+_0x1fc244[_0xfaa3('0x23')]+_0x1fc244[_0xfaa3('0x24')]<_0x50f121[_0xfaa3('0x25')][_0xfaa3('0x26')])_0x2f2989=0x1;_0x499148({'additional':_0x2f2989});}else{return db[_0xfaa3('0x27')][_0xfaa3('0x15')]({'raw':!![],'where':{'CmHopperId':_0x42b214['id']},'order':[[_0xfaa3('0x1c'),_0xfaa3('0x1d')]]})[_0xfaa3('0x1b')](function(_0x1bc202){var _0x2d7c43=0x0;if(_0x1bc202){if(_0x1bc202['countbusyretry']+_0x1bc202[_0xfaa3('0x28')]+_0x1bc202[_0xfaa3('0x1f')]+_0x1bc202[_0xfaa3('0x20')]+_0x1bc202['countdropretry']+_0x1bc202[_0xfaa3('0x22')]+_0x1bc202['countmachineretry']+_0x1bc202[_0xfaa3('0x24')]<_0x50f121['entity'][_0xfaa3('0x26')])_0x2d7c43=0x1;_0x499148({'additional':_0x2d7c43});}else{_0x499148({'additional':0x0});}})[_0xfaa3('0x14')](function(_0x3a39c3){logger[_0xfaa3('0x11')](_0xfaa3('0x29'),_0x3a39c3[_0xfaa3('0x12')],_0x50f121);_0x275a07(_0x598473[_0xfaa3('0x11')](0x1f4,_0x3a39c3[_0xfaa3('0x12')]));});}})['catch'](function(_0x3992c5){logger[_0xfaa3('0x11')](_0xfaa3('0x29'),_0x3992c5[_0xfaa3('0x12')],_0x50f121);_0x275a07(_0x598473[_0xfaa3('0x11')](0x1f4,_0x3992c5[_0xfaa3('0x12')]));});}else _0x499148({'additional':0x0});});});};exports[_0xfaa3('0x2a')]=function(_0x102c4e){var _0x3fb3ab=this;return new Promise(function(_0x12cadf,_0x2d88fb){return db[_0xfaa3('0x2b')][_0xfaa3('0x15')]({'raw':!![],'where':{'ContactId':_0x102c4e[_0xfaa3('0x16')][_0xfaa3('0x17')],'ListId':_0x102c4e[_0xfaa3('0x16')]['ListId'],'VoiceQueueId':_0x102c4e[_0xfaa3('0x16')][_0xfaa3('0x19')]===undefined?null:_0x102c4e[_0xfaa3('0x16')][_0xfaa3('0x19')],'CampaignId':_0x102c4e[_0xfaa3('0x16')][_0xfaa3('0x1a')]===undefined?null:_0x102c4e[_0xfaa3('0x16')][_0xfaa3('0x1a')]}})['then'](function(_0x304fab){if(_0x304fab!=null){return db[_0xfaa3('0x27')][_0xfaa3('0x15')]({'raw':!![],'where':{'CmHopperId':_0x304fab['id'],'OrderBy':{'$gte':_0x304fab['OrderBy']}},'order':[[_0xfaa3('0x1c'),_0xfaa3('0x1d')]]})['then'](function(_0x458fa6){if(_0x458fa6)return activateAdditionalPhone(_0x304fab,_0x102c4e[_0xfaa3('0x16')],_0x458fa6,_0x102c4e[_0xfaa3('0x2c')],_0x102c4e[_0xfaa3('0x2d')])[_0xfaa3('0x1b')](function(_0x2ea061){_0x12cadf(_0x2ea061);});else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x304fab['id']},'order':[[_0xfaa3('0x1c'),_0xfaa3('0x1d')]]})['then'](function(_0x4ae1c3){if(_0x4ae1c3)return activateAdditionalPhone(_0x304fab,_0x102c4e[_0xfaa3('0x16')],_0x4ae1c3,_0x102c4e['duration'],_0x102c4e[_0xfaa3('0x2d')])[_0xfaa3('0x1b')](function(_0x37e89a){_0x12cadf(_0x37e89a);});else{_0x12cadf({'id':_0x304fab['id'],'phone':''});}})[_0xfaa3('0x14')](function(_0x3100c3){logger[_0xfaa3('0x11')](_0xfaa3('0x29'),_0x3100c3[_0xfaa3('0x12')],_0x102c4e);_0x2d88fb(_0x3fb3ab['error'](0x1f4,_0x3100c3['message']));});}})['catch'](function(_0x5b4ab2){logger[_0xfaa3('0x11')](_0xfaa3('0x29'),_0x5b4ab2['message'],_0x102c4e);_0x2d88fb(_0x3fb3ab[_0xfaa3('0x11')](0x1f4,_0x5b4ab2[_0xfaa3('0x12')]));});}else _0x12cadf(0x1);});});};function activateAdditionalPhone(_0x46683d,_0x4abf3a,_0x47e2be,_0x1e5d33,_0x4c19fc){return new Promise(function(_0x1701bc,_0x57b77c){logger['info'](_0xfaa3('0x29'),_0x47e2be);var _0x2ee593;if(moment()>moment(_0x47e2be['scheduledat'])){_0x2ee593=moment()[_0xfaa3('0x2e')](_0x4c19fc||0x3,'minutes');}else{if(_0x47e2be[_0xfaa3('0x1c')]==0x0){_0x2ee593=moment(_0x47e2be['scheduledat']);}else{_0x2ee593=moment()[_0xfaa3('0x2e')](_0x4c19fc||0x3,_0xfaa3('0x2f'));}}var _0x149d7e={'phone':_0x46683d['phone'],'active':0x0,'OrderBy':_[_0xfaa3('0x30')](_0x46683d[_0xfaa3('0x1c')])?0x0:_0x46683d['OrderBy'],'scheduledat':moment()[_0xfaa3('0x2e')](_0x1e5d33||0x1,_0xfaa3('0x2f')),'countbusyretry':_0x4abf3a[_0xfaa3('0x1e')],'countcongestionretry':_0x4abf3a[_0xfaa3('0x28')],'countnoanswerretry':_0x4abf3a['countnoanswerretry'],'countnosuchnumberretry':_0x4abf3a[_0xfaa3('0x20')],'countdropretry':_0x4abf3a[_0xfaa3('0x21')],'countabandonedretry':_0x4abf3a['countabandonedretry'],'countmachineretry':_0x4abf3a[_0xfaa3('0x23')],'countagentrejectretry':_0x4abf3a['countagentrejectretry'],'createdAt':_0x4abf3a[_0xfaa3('0x31')],'updatedAt':_0x4abf3a[_0xfaa3('0x32')]};var _0xb4df09={'CmHopperId':_0x46683d['id'],'phone':_0x47e2be['phone'],'active':0x0,'OrderBy':_[_0xfaa3('0x30')](_0x47e2be['OrderBy'])?0x0:_0x47e2be['OrderBy'],'scheduledat':_0x2ee593,'countbusyretry':_0x47e2be[_0xfaa3('0x1e')],'countcongestionretry':_0x47e2be[_0xfaa3('0x28')],'countnoanswerretry':_0x47e2be[_0xfaa3('0x1f')],'countnosuchnumberretry':_0x47e2be[_0xfaa3('0x20')],'countdropretry':_0x47e2be[_0xfaa3('0x21')],'countabandonedretry':_0x47e2be[_0xfaa3('0x22')],'countmachineretry':_0x47e2be[_0xfaa3('0x23')],'countagentrejectretry':_0x47e2be['countagentrejectretry'],'createdAt':_0x47e2be[_0xfaa3('0x31')],'updatedAt':_0x47e2be[_0xfaa3('0x32')]};logger[_0xfaa3('0xc')](_0xfaa3('0x33'),_0x149d7e);logger[_0xfaa3('0xc')](_0xfaa3('0x34'),_0xb4df09);return db[_0xfaa3('0x35')]['transaction'](function(_0x49c075){return db['CmHopperAdditionalPhone'][_0xfaa3('0x36')](_0x149d7e,{'where':{'id':_0x47e2be['id']}},{'transaction':_0x49c075})[_0xfaa3('0x1b')](function(){return db[_0xfaa3('0x2b')][_0xfaa3('0x36')](_0xb4df09,{'where':{'id':_0x46683d['id']}},{'transaction':_0x49c075});});})['then'](function(_0x43a636){_0x1701bc({'id':_0x46683d['id'],'phone':_0x47e2be['phone']});})['catch'](function(_0x4d81b9){logger['error']('VerifyAdditionalPhones',_0x4d81b9[_0xfaa3('0x12')],req);_0x57b77c(_this[_0xfaa3('0x11')](0x1f4,_0x4d81b9[_0xfaa3('0x12')]));});});}exports[_0xfaa3('0x37')]=function(_0x32ab8d){var _0x1c856b=this;return new Promise(function(_0x3c422d,_0x45984c){return db['CmHopper'][_0xfaa3('0x36')](_0x32ab8d['body']['field'],{'where':{'id':_0x32ab8d[_0xfaa3('0x16')]['id']}})[_0xfaa3('0x1b')](function(_0x461e87){_0x3c422d(_0x461e87);})[_0xfaa3('0x14')](function(_0x29158f){logger[_0xfaa3('0x11')](_0xfaa3('0x37'),_0x29158f[_0xfaa3('0x12')],_0x32ab8d);_0x45984c(_0x1c856b[_0xfaa3('0x11')](0x1f4,_0x29158f[_0xfaa3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 2d1044b..361187f 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b4d=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x1d1662,_0xec10d2){var _0x26dfb4=function(_0x1492dd){while(--_0x1492dd){_0x1d1662['push'](_0x1d1662['shift']());}};_0x26dfb4(++_0xec10d2);}(_0x2b4d,0xfa));var _0xd2b4=function(_0x5e4b85,_0x6cf965){_0x5e4b85=_0x5e4b85-0x0;var _0x5cd3cb=_0x2b4d[_0x5e4b85];return _0x5cd3cb;};'use strict';var multer=require(_0xd2b4('0x0'));var util=require(_0xd2b4('0x1'));var path=require(_0xd2b4('0x2'));var timeout=require(_0xd2b4('0x3'));var express=require('express');var router=express[_0xd2b4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd2b4('0x5'));var config=require(_0xd2b4('0x6'));var controller=require(_0xd2b4('0x7'));router[_0xd2b4('0x8')]('/',auth[_0xd2b4('0x9')](),controller['index']);router[_0xd2b4('0x8')](_0xd2b4('0xa'),auth[_0xd2b4('0x9')](),controller[_0xd2b4('0xb')]);router[_0xd2b4('0xc')]('/',auth[_0xd2b4('0x9')](),controller[_0xd2b4('0xd')]);router[_0xd2b4('0xe')](_0xd2b4('0xa'),auth[_0xd2b4('0x9')](),controller[_0xd2b4('0xf')]);router[_0xd2b4('0x10')](_0xd2b4('0xa'),auth[_0xd2b4('0x9')](),controller[_0xd2b4('0x11')]);module[_0xd2b4('0x12')]=router; \ No newline at end of file +var _0xf64f=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','/:id','show','create','put','update','destroy','exports'];(function(_0x2202d2,_0x529a53){var _0x55094b=function(_0x46d701){while(--_0x46d701){_0x2202d2['push'](_0x2202d2['shift']());}};_0x55094b(++_0x529a53);}(_0xf64f,0xb4));var _0xff64=function(_0x3ca6f2,_0x7c849e){_0x3ca6f2=_0x3ca6f2-0x0;var _0x4fdf23=_0xf64f[_0x3ca6f2];return _0x4fdf23;};'use strict';var multer=require(_0xff64('0x0'));var util=require('util');var path=require(_0xff64('0x1'));var timeout=require(_0xff64('0x2'));var express=require(_0xff64('0x3'));var router=express[_0xff64('0x4')]();var fs_extra=require(_0xff64('0x5'));var auth=require(_0xff64('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xff64('0x7'));var controller=require(_0xff64('0x8'));router[_0xff64('0x9')]('/',auth[_0xff64('0xa')](),controller['index']);router[_0xff64('0x9')](_0xff64('0xb'),auth['isAuthenticated'](),controller[_0xff64('0xc')]);router['post']('/',auth[_0xff64('0xa')](),controller[_0xff64('0xd')]);router[_0xff64('0xe')]('/:id',auth[_0xff64('0xa')](),controller[_0xff64('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xff64('0x10')]);module[_0xff64('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index b93058e..c02100f 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 _0x0331=['sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x1d3945,_0xbd42d5){var _0x4e42ce=function(_0x3314d7){while(--_0x3314d7){_0x1d3945['push'](_0x1d3945['shift']());}};_0x4e42ce(++_0xbd42d5);}(_0x0331,0xeb));var _0x1033=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0x0331[_0x374ada];return _0x449ed8;};'use strict';var moment=require('moment');var Sequelize=require(_0x1033('0x0'));module[_0x1033('0x1')]={'phone':{'type':Sequelize[_0x1033('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x1033('0x3')],'unique':_0x1033('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x1033('0x3')],'unique':_0x1033('0x4')}}; \ No newline at end of file +var _0x322a=['INTEGER','contactListQueue','moment','exports','STRING'];(function(_0x3d3be1,_0x448174){var _0x232e83=function(_0x2ff17c){while(--_0x2ff17c){_0x3d3be1['push'](_0x3d3be1['shift']());}};_0x232e83(++_0x448174);}(_0x322a,0x129));var _0xa322=function(_0x28394f,_0x5ebdd2){_0x28394f=_0x28394f-0x0;var _0x2618d2=_0x322a[_0x28394f];return _0x2618d2;};'use strict';var moment=require(_0xa322('0x0'));var Sequelize=require('sequelize');module[_0xa322('0x1')]={'phone':{'type':Sequelize[_0xa322('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa322('0x3')],'unique':_0xa322('0x4')},'ListId':{'type':Sequelize[_0xa322('0x3')],'unique':_0xa322('0x4')},'VoiceQueueId':{'type':Sequelize[_0xa322('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index b913e58..8ab6618 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 _0x50ed=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','name','send','map','CmHopperBlack','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','update','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra'];(function(_0x4f4d72,_0x3717bf){var _0x55fc6c=function(_0x44a0e4){while(--_0x44a0e4){_0x4f4d72['push'](_0x4f4d72['shift']());}};_0x55fc6c(++_0x3717bf);}(_0x50ed,0x8e));var _0xd50e=function(_0x3e1fee,_0x5a0b8e){_0x3e1fee=_0x3e1fee-0x0;var _0x234574=_0x50ed[_0x3e1fee];return _0x234574;};'use strict';var emlformat=require(_0xd50e('0x0'));var rimraf=require(_0xd50e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd50e('0x2'));var rp=require(_0xd50e('0x3'));var moment=require(_0xd50e('0x4'));var BPromise=require(_0xd50e('0x5'));var Mustache=require('mustache');var util=require(_0xd50e('0x6'));var path=require(_0xd50e('0x7'));var sox=require('sox');var csv=require(_0xd50e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd50e('0x9'));var _=require(_0xd50e('0xa'));var squel=require(_0xd50e('0xb'));var crypto=require('crypto');var jsforce=require(_0xd50e('0xc'));var deskjs=require(_0xd50e('0xd'));var toCsv=require(_0xd50e('0x8'));var querystring=require(_0xd50e('0xe'));var Papa=require(_0xd50e('0xf'));var Redis=require(_0xd50e('0x10'));var authService=require(_0xd50e('0x11'));var qs=require(_0xd50e('0x12'));var as=require(_0xd50e('0x13'));var hardwareService=require(_0xd50e('0x14'));var logger=require(_0xd50e('0x15'))(_0xd50e('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd50e('0x17'));var db=require(_0xd50e('0x18'))['db'];function respondWithStatusCode(_0x1bf4be,_0x5a4a4c){_0x5a4a4c=_0x5a4a4c||0xcc;return function(_0x3f69b7){if(_0x3f69b7){return _0x1bf4be[_0xd50e('0x19')](_0x5a4a4c);}return _0x1bf4be[_0xd50e('0x1a')](_0x5a4a4c)[_0xd50e('0x1b')]();};}function respondWithResult(_0x2a0165,_0x119e81){_0x119e81=_0x119e81||0xc8;return function(_0x28c06d){if(_0x28c06d){return _0x2a0165[_0xd50e('0x1a')](_0x119e81)[_0xd50e('0x1c')](_0x28c06d);}};}function respondWithFilteredResult(_0x33449b,_0x62c4b5){return function(_0x3deb7f){if(_0x3deb7f){var _0x417f41=typeof _0x62c4b5['offset']===_0xd50e('0x1d')&&typeof _0x62c4b5[_0xd50e('0x1e')]===_0xd50e('0x1d');var _0x582299=_0x3deb7f[_0xd50e('0x1f')];var _0x5b481a=_0x417f41?0x0:_0x62c4b5['offset'];var _0x4dbdfb=_0x417f41?_0x3deb7f[_0xd50e('0x1f')]:_0x62c4b5[_0xd50e('0x20')]+_0x62c4b5[_0xd50e('0x1e')];var _0x688a93;if(_0x4dbdfb>=_0x582299){_0x4dbdfb=_0x582299;_0x688a93=0xc8;}else{_0x688a93=0xce;}_0x33449b[_0xd50e('0x1a')](_0x688a93);return _0x33449b[_0xd50e('0x21')](_0xd50e('0x22'),_0x5b481a+'-'+_0x4dbdfb+'/'+_0x582299)[_0xd50e('0x1c')](_0x3deb7f);}return null;};}function patchUpdates(_0xb1427b){return function(_0x489c17){try{jsonpatch[_0xd50e('0x23')](_0x489c17,_0xb1427b,!![]);}catch(_0x181ba1){return BPromise[_0xd50e('0x24')](_0x181ba1);}return _0x489c17[_0xd50e('0x25')]();};}function saveUpdates(_0x17ef69,_0x33a3f7){return function(_0xa19f99){if(_0xa19f99){return _0xa19f99['update'](_0x17ef69)['then'](function(_0x3c5b19){return _0x3c5b19;});}return null;};}function removeEntity(_0xfa26f1,_0x4f85e9){return function(_0x175618){if(_0x175618){return _0x175618[_0xd50e('0x26')]()[_0xd50e('0x27')](function(){_0xfa26f1[_0xd50e('0x1a')](0xcc)[_0xd50e('0x1b')]();});}};}function handleEntityNotFound(_0x4401aa,_0x463fe2){return function(_0x2f6c95){if(!_0x2f6c95){_0x4401aa[_0xd50e('0x19')](0x194);}return _0x2f6c95;};}function handleError(_0x521500,_0x17934d){_0x17934d=_0x17934d||0x1f4;return function(_0x12bd44){logger[_0xd50e('0x28')](_0x12bd44['stack']);if(_0x12bd44['name']){delete _0x12bd44[_0xd50e('0x29')];}_0x521500[_0xd50e('0x1a')](_0x17934d)[_0xd50e('0x2a')](_0x12bd44);};}exports['index']=function(_0x4b7cf6,_0x165733){var _0x5e05f1={},_0x19264b={},_0x513c53={'count':0x0,'rows':[]};var _0x447c0c=_[_0xd50e('0x2b')](db[_0xd50e('0x2c')][_0xd50e('0x2d')],function(_0x7deb2b){return{'name':_0x7deb2b[_0xd50e('0x2e')],'type':_0x7deb2b[_0xd50e('0x2f')]['key']};});_0x19264b[_0xd50e('0x30')]=_['map'](_0x447c0c,_0xd50e('0x29'));_0x19264b['query']=_[_0xd50e('0x31')](_0x4b7cf6[_0xd50e('0x32')]);_0x19264b[_0xd50e('0x33')]=_[_0xd50e('0x34')](_0x19264b['model'],_0x19264b[_0xd50e('0x32')]);_0x5e05f1[_0xd50e('0x35')]=_[_0xd50e('0x34')](_0x19264b[_0xd50e('0x30')],qs[_0xd50e('0x36')](_0x4b7cf6[_0xd50e('0x32')][_0xd50e('0x36')]));_0x5e05f1['attributes']=_0x5e05f1['attributes'][_0xd50e('0x37')]?_0x5e05f1[_0xd50e('0x35')]:_0x19264b[_0xd50e('0x30')];if(!_0x4b7cf6[_0xd50e('0x32')]['hasOwnProperty'](_0xd50e('0x38'))){_0x5e05f1[_0xd50e('0x1e')]=qs[_0xd50e('0x1e')](_0x4b7cf6[_0xd50e('0x32')][_0xd50e('0x1e')]);_0x5e05f1[_0xd50e('0x20')]=qs['offset'](_0x4b7cf6[_0xd50e('0x32')][_0xd50e('0x20')]);}_0x5e05f1[_0xd50e('0x39')]=qs[_0xd50e('0x3a')](_0x4b7cf6['query']['sort']);_0x5e05f1[_0xd50e('0x3b')]=qs['filters'](_[_0xd50e('0x3c')](_0x4b7cf6[_0xd50e('0x32')],_0x19264b[_0xd50e('0x33')]),_0x447c0c);if(_0x4b7cf6[_0xd50e('0x32')][_0xd50e('0x3d')]){_0x5e05f1[_0xd50e('0x3b')]=_[_0xd50e('0x3e')](_0x5e05f1[_0xd50e('0x3b')],{'$or':_['map'](_0x447c0c,function(_0x4b93f2){if(_0x4b93f2[_0xd50e('0x2f')]!==_0xd50e('0x3f')){var _0x1b4523={};_0x1b4523[_0x4b93f2[_0xd50e('0x29')]]={'$like':'%'+_0x4b7cf6[_0xd50e('0x32')][_0xd50e('0x3d')]+'%'};return _0x1b4523;}})});}_0x5e05f1=_['merge']({},_0x5e05f1,_0x4b7cf6[_0xd50e('0x40')]);var _0x379adb={'where':_0x5e05f1[_0xd50e('0x3b')]};return db[_0xd50e('0x2c')][_0xd50e('0x1f')](_0x379adb)[_0xd50e('0x27')](function(_0x367ab7){_0x513c53[_0xd50e('0x1f')]=_0x367ab7;if(_0x4b7cf6[_0xd50e('0x32')][_0xd50e('0x41')]){_0x5e05f1[_0xd50e('0x42')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xd50e('0x43')](_0x5e05f1);})['then'](function(_0x30dc01){_0x513c53[_0xd50e('0x44')]=_0x30dc01;return _0x513c53;})['then'](respondWithFilteredResult(_0x165733,_0x5e05f1))[_0xd50e('0x45')](handleError(_0x165733,null));};exports[_0xd50e('0x46')]=function(_0x1d6ed0,_0x5893ec){var _0x211753={'raw':!![],'where':{'id':_0x1d6ed0['params']['id']}},_0x45dbe2={};_0x45dbe2[_0xd50e('0x30')]=_[_0xd50e('0x31')](db[_0xd50e('0x2c')][_0xd50e('0x2d')]);_0x45dbe2[_0xd50e('0x32')]=_['keys'](_0x1d6ed0[_0xd50e('0x32')]);_0x45dbe2[_0xd50e('0x33')]=_[_0xd50e('0x34')](_0x45dbe2[_0xd50e('0x30')],_0x45dbe2[_0xd50e('0x32')]);_0x211753[_0xd50e('0x35')]=_[_0xd50e('0x34')](_0x45dbe2[_0xd50e('0x30')],qs[_0xd50e('0x36')](_0x1d6ed0[_0xd50e('0x32')][_0xd50e('0x36')]));_0x211753['attributes']=_0x211753[_0xd50e('0x35')][_0xd50e('0x37')]?_0x211753[_0xd50e('0x35')]:_0x45dbe2['model'];if(_0x1d6ed0['query'][_0xd50e('0x41')]){_0x211753[_0xd50e('0x42')]=[{'all':!![]}];}_0x211753=_['merge']({},_0x211753,_0x1d6ed0['options']);return db[_0xd50e('0x2c')][_0xd50e('0x47')](_0x211753)[_0xd50e('0x27')](handleEntityNotFound(_0x5893ec,null))['then'](respondWithResult(_0x5893ec,null))[_0xd50e('0x45')](handleError(_0x5893ec,null));};exports[_0xd50e('0x48')]=function(_0x5eb745,_0x245af0){if(_0x5eb745['body']['id']){delete _0x5eb745[_0xd50e('0x49')]['id'];}return db[_0xd50e('0x2c')][_0xd50e('0x47')]({'where':{'id':_0x5eb745['params']['id']}})[_0xd50e('0x27')](handleEntityNotFound(_0x245af0,null))['then'](saveUpdates(_0x5eb745[_0xd50e('0x49')],null))[_0xd50e('0x27')](respondWithResult(_0x245af0,null))['catch'](handleError(_0x245af0,null));};exports[_0xd50e('0x26')]=function(_0x219d1d,_0x46a5de){return db['CmHopperBlack']['find']({'where':{'id':_0x219d1d[_0xd50e('0x4a')]['id']}})[_0xd50e('0x27')](handleEntityNotFound(_0x46a5de,null))[_0xd50e('0x27')](removeEntity(_0x46a5de,null))[_0xd50e('0x45')](handleError(_0x46a5de,null));};exports['describe']=function(_0xfa2ebe,_0x270b52){return db['CmHopperBlack'][_0xd50e('0x4b')]()[_0xd50e('0x27')](respondWithResult(_0x270b52,null))[_0xd50e('0x45')](handleError(_0x270b52,null));}; \ No newline at end of file +var _0x323a=['type','key','model','keys','filters','intersection','query','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName'];(function(_0x3a63b4,_0x6e7870){var _0x36006b=function(_0x493681){while(--_0x493681){_0x3a63b4['push'](_0x3a63b4['shift']());}};_0x36006b(++_0x6e7870);}(_0x323a,0x68));var _0xa323=function(_0x36e1bf,_0x47317e){_0x36e1bf=_0x36e1bf-0x0;var _0x3a2aba=_0x323a[_0x36e1bf];return _0x3a2aba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa323('0x0'));var zipdir=require(_0xa323('0x1'));var jsonpatch=require(_0xa323('0x2'));var rp=require(_0xa323('0x3'));var moment=require(_0xa323('0x4'));var BPromise=require(_0xa323('0x5'));var Mustache=require('mustache');var util=require(_0xa323('0x6'));var path=require('path');var sox=require(_0xa323('0x7'));var csv=require('to-csv');var ejs=require(_0xa323('0x8'));var fs=require('fs');var fs_extra=require(_0xa323('0x9'));var _=require(_0xa323('0xa'));var squel=require(_0xa323('0xb'));var crypto=require(_0xa323('0xc'));var jsforce=require(_0xa323('0xd'));var deskjs=require(_0xa323('0xe'));var toCsv=require(_0xa323('0xf'));var querystring=require(_0xa323('0x10'));var Papa=require(_0xa323('0x11'));var Redis=require(_0xa323('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa323('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa323('0x14'));var logger=require(_0xa323('0x15'))(_0xa323('0x16'));var utils=require(_0xa323('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa323('0x18'));var db=require(_0xa323('0x19'))['db'];function respondWithStatusCode(_0x58e1b5,_0x1ec74f){_0x1ec74f=_0x1ec74f||0xcc;return function(_0x340dfe){if(_0x340dfe){return _0x58e1b5['sendStatus'](_0x1ec74f);}return _0x58e1b5[_0xa323('0x1a')](_0x1ec74f)[_0xa323('0x1b')]();};}function respondWithResult(_0x2e7999,_0x1d4965){_0x1d4965=_0x1d4965||0xc8;return function(_0x1f612c){if(_0x1f612c){return _0x2e7999[_0xa323('0x1a')](_0x1d4965)['json'](_0x1f612c);}};}function respondWithFilteredResult(_0x4e5685,_0x3b7395){return function(_0x304797){if(_0x304797){var _0x543d8a=typeof _0x3b7395[_0xa323('0x1c')]===_0xa323('0x1d')&&typeof _0x3b7395[_0xa323('0x1e')]==='undefined';var _0x38e158=_0x304797[_0xa323('0x1f')];var _0x32205f=_0x543d8a?0x0:_0x3b7395[_0xa323('0x1c')];var _0x344dbd=_0x543d8a?_0x304797[_0xa323('0x1f')]:_0x3b7395['offset']+_0x3b7395[_0xa323('0x1e')];var _0x401b34;if(_0x344dbd>=_0x38e158){_0x344dbd=_0x38e158;_0x401b34=0xc8;}else{_0x401b34=0xce;}_0x4e5685[_0xa323('0x1a')](_0x401b34);return _0x4e5685[_0xa323('0x20')](_0xa323('0x21'),_0x32205f+'-'+_0x344dbd+'/'+_0x38e158)[_0xa323('0x22')](_0x304797);}return null;};}function patchUpdates(_0x11f3a8){return function(_0x6c5f1f){try{jsonpatch[_0xa323('0x23')](_0x6c5f1f,_0x11f3a8,!![]);}catch(_0x45eb32){return BPromise[_0xa323('0x24')](_0x45eb32);}return _0x6c5f1f[_0xa323('0x25')]();};}function saveUpdates(_0x5c4c98,_0x5c3b51){return function(_0x2b810b){if(_0x2b810b){return _0x2b810b[_0xa323('0x26')](_0x5c4c98)[_0xa323('0x27')](function(_0x595a25){return _0x595a25;});}return null;};}function removeEntity(_0x45ef03,_0x50efce){return function(_0x4884af){if(_0x4884af){return _0x4884af[_0xa323('0x28')]()[_0xa323('0x27')](function(){_0x45ef03[_0xa323('0x1a')](0xcc)[_0xa323('0x1b')]();});}};}function handleEntityNotFound(_0x336943,_0x4ec476){return function(_0x27bb4f){if(!_0x27bb4f){_0x336943[_0xa323('0x29')](0x194);}return _0x27bb4f;};}function handleError(_0x57dd52,_0x85896b){_0x85896b=_0x85896b||0x1f4;return function(_0x18d8cd){logger[_0xa323('0x2a')](_0x18d8cd['stack']);if(_0x18d8cd[_0xa323('0x2b')]){delete _0x18d8cd[_0xa323('0x2b')];}_0x57dd52[_0xa323('0x1a')](_0x85896b)[_0xa323('0x2c')](_0x18d8cd);};}exports[_0xa323('0x2d')]=function(_0x254027,_0x4ab20b){var _0xf8c6b3={},_0x3ea25a={},_0x294911={'count':0x0,'rows':[]};var _0x1071ac=_[_0xa323('0x2e')](db[_0xa323('0x2f')][_0xa323('0x30')],function(_0x241591){return{'name':_0x241591[_0xa323('0x31')],'type':_0x241591[_0xa323('0x32')][_0xa323('0x33')]};});_0x3ea25a[_0xa323('0x34')]=_['map'](_0x1071ac,'name');_0x3ea25a['query']=_[_0xa323('0x35')](_0x254027['query']);_0x3ea25a[_0xa323('0x36')]=_[_0xa323('0x37')](_0x3ea25a[_0xa323('0x34')],_0x3ea25a[_0xa323('0x38')]);_0xf8c6b3[_0xa323('0x39')]=_['intersection'](_0x3ea25a[_0xa323('0x34')],qs['fields'](_0x254027[_0xa323('0x38')]['fields']));_0xf8c6b3['attributes']=_0xf8c6b3[_0xa323('0x39')]['length']?_0xf8c6b3['attributes']:_0x3ea25a[_0xa323('0x34')];if(!_0x254027[_0xa323('0x38')][_0xa323('0x3a')](_0xa323('0x3b'))){_0xf8c6b3['limit']=qs['limit'](_0x254027[_0xa323('0x38')][_0xa323('0x1e')]);_0xf8c6b3[_0xa323('0x1c')]=qs[_0xa323('0x1c')](_0x254027[_0xa323('0x38')]['offset']);}_0xf8c6b3[_0xa323('0x3c')]=qs['sort'](_0x254027[_0xa323('0x38')][_0xa323('0x3d')]);_0xf8c6b3[_0xa323('0x3e')]=qs[_0xa323('0x36')](_[_0xa323('0x3f')](_0x254027['query'],_0x3ea25a[_0xa323('0x36')]),_0x1071ac);if(_0x254027['query'][_0xa323('0x40')]){_0xf8c6b3['where']=_['merge'](_0xf8c6b3[_0xa323('0x3e')],{'$or':_['map'](_0x1071ac,function(_0x244a88){if(_0x244a88[_0xa323('0x32')]!=='VIRTUAL'){var _0x220f7d={};_0x220f7d[_0x244a88[_0xa323('0x2b')]]={'$like':'%'+_0x254027[_0xa323('0x38')][_0xa323('0x40')]+'%'};return _0x220f7d;}})});}_0xf8c6b3=_[_0xa323('0x41')]({},_0xf8c6b3,_0x254027[_0xa323('0x42')]);var _0x3fd832={'where':_0xf8c6b3['where']};return db[_0xa323('0x2f')][_0xa323('0x1f')](_0x3fd832)['then'](function(_0x3b5c0d){_0x294911[_0xa323('0x1f')]=_0x3b5c0d;if(_0x254027['query'][_0xa323('0x43')]){_0xf8c6b3[_0xa323('0x44')]=[{'all':!![]}];}return db[_0xa323('0x2f')][_0xa323('0x45')](_0xf8c6b3);})[_0xa323('0x27')](function(_0x28dfeb){_0x294911[_0xa323('0x46')]=_0x28dfeb;return _0x294911;})[_0xa323('0x27')](respondWithFilteredResult(_0x4ab20b,_0xf8c6b3))[_0xa323('0x47')](handleError(_0x4ab20b,null));};exports[_0xa323('0x48')]=function(_0x51743c,_0x4624ce){var _0x599759={'raw':!![],'where':{'id':_0x51743c['params']['id']}},_0x3d42ab={};_0x3d42ab['model']=_['keys'](db[_0xa323('0x2f')][_0xa323('0x30')]);_0x3d42ab[_0xa323('0x38')]=_['keys'](_0x51743c[_0xa323('0x38')]);_0x3d42ab[_0xa323('0x36')]=_['intersection'](_0x3d42ab[_0xa323('0x34')],_0x3d42ab['query']);_0x599759[_0xa323('0x39')]=_[_0xa323('0x37')](_0x3d42ab[_0xa323('0x34')],qs['fields'](_0x51743c['query']['fields']));_0x599759[_0xa323('0x39')]=_0x599759['attributes']['length']?_0x599759[_0xa323('0x39')]:_0x3d42ab[_0xa323('0x34')];if(_0x51743c[_0xa323('0x38')][_0xa323('0x43')]){_0x599759[_0xa323('0x44')]=[{'all':!![]}];}_0x599759=_[_0xa323('0x41')]({},_0x599759,_0x51743c[_0xa323('0x42')]);return db['CmHopperBlack']['find'](_0x599759)['then'](handleEntityNotFound(_0x4624ce,null))[_0xa323('0x27')](respondWithResult(_0x4624ce,null))['catch'](handleError(_0x4624ce,null));};exports[_0xa323('0x26')]=function(_0x2bd8d4,_0x227d47){if(_0x2bd8d4[_0xa323('0x49')]['id']){delete _0x2bd8d4['body']['id'];}return db[_0xa323('0x2f')]['find']({'where':{'id':_0x2bd8d4['params']['id']}})[_0xa323('0x27')](handleEntityNotFound(_0x227d47,null))[_0xa323('0x27')](saveUpdates(_0x2bd8d4[_0xa323('0x49')],null))[_0xa323('0x27')](respondWithResult(_0x227d47,null))[_0xa323('0x47')](handleError(_0x227d47,null));};exports[_0xa323('0x28')]=function(_0x38c4a3,_0x350622){return db['CmHopperBlack'][_0xa323('0x4a')]({'where':{'id':_0x38c4a3[_0xa323('0x4b')]['id']}})[_0xa323('0x27')](handleEntityNotFound(_0x350622,null))[_0xa323('0x27')](removeEntity(_0x350622,null))[_0xa323('0x47')](handleError(_0x350622,null));};exports['describe']=function(_0x5332b9,_0x4c8348){return db[_0xa323('0x2f')][_0xa323('0x4c')]()[_0xa323('0x27')](respondWithResult(_0x4c8348,null))[_0xa323('0x47')](handleError(_0x4c8348,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 949bd81..fff997c 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 _0xbd5c=['cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','CmHopperBlack'];(function(_0x59d51e,_0x5c9ea4){var _0x21b917=function(_0x2c3e39){while(--_0x2c3e39){_0x59d51e['push'](_0x59d51e['shift']());}};_0x21b917(++_0x5c9ea4);}(_0xbd5c,0xde));var _0xcbd5=function(_0xf5c47b,_0xa25ec8){_0xf5c47b=_0xf5c47b-0x0;var _0x218f56=_0xbd5c[_0xf5c47b];return _0x218f56;};'use strict';var _=require(_0xcbd5('0x0'));var util=require(_0xcbd5('0x1'));var logger=require(_0xcbd5('0x2'))(_0xcbd5('0x3'));var moment=require(_0xcbd5('0x4'));var BPromise=require(_0xcbd5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcbd5('0x6'));var rimraf=require(_0xcbd5('0x7'));var config=require(_0xcbd5('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0xcbd5('0x9')]=function(_0x2f26bd,_0x4b9d7d){return _0x2f26bd[_0xcbd5('0xa')](_0xcbd5('0xb'),attributes,{'tableName':_0xcbd5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a51=['util','../../config/logger','api','moment','bluebird','path','./cmHopperBlack.attributes','define','CmHopperBlack','lodash'];(function(_0x1f2ca3,_0x8516e7){var _0x195079=function(_0x1ba283){while(--_0x1ba283){_0x1f2ca3['push'](_0x1f2ca3['shift']());}};_0x195079(++_0x8516e7);}(_0x8a51,0xe5));var _0x18a5=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x8a51[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x18a5('0x0'));var util=require(_0x18a5('0x1'));var logger=require(_0x18a5('0x2'))(_0x18a5('0x3'));var moment=require(_0x18a5('0x4'));var BPromise=require(_0x18a5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x18a5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x18a5('0x7'));module['exports']=function(_0xab4f35,_0x4b400f){return _0xab4f35[_0x18a5('0x8')](_0x18a5('0x9'),attributes,{'tableName':'cm_hopper_black','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 231ea51..9788762 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 _0x4288=['debug','request\x20sent','error','code','message','info','result','catch','CmHopperBlack','findAll','options','raw','where','attributes','include','model','GetCmHopperBlack','UpdateCmHopperBlack','update','body','stringify','DestroyCmHopperBlack','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','CmHopperBlack,\x20%s,\x20%s'];(function(_0x10e24d,_0x53423a){var _0x34555d=function(_0x3b3855){while(--_0x3b3855){_0x10e24d['push'](_0x10e24d['shift']());}};_0x34555d(++_0x53423a);}(_0x4288,0x10b));var _0x8428=function(_0x9afd62,_0x151f9b){_0x9afd62=_0x9afd62-0x0;var _0x16b049=_0x4288[_0x9afd62];return _0x16b049;};'use strict';var _=require(_0x8428('0x0'));var util=require(_0x8428('0x1'));var moment=require(_0x8428('0x2'));var BPromise=require(_0x8428('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8428('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8428('0x5'));var logger=require(_0x8428('0x6'))(_0x8428('0x7'));var config=require('../../config/environment');var jayson=require(_0x8428('0x8'));var client=jayson['client'][_0x8428('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58d647,_0xd8198c,_0x3d6c82){return new BPromise(function(_0x2d8303,_0x54f610){return client[_0x8428('0xa')](_0x58d647,_0x3d6c82)[_0x8428('0xb')](function(_0x103e52){logger['info'](_0x8428('0xc'),_0xd8198c,'request\x20sent');logger[_0x8428('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0xd8198c,_0x8428('0xe'),JSON['stringify'](_0x103e52));if(_0x103e52[_0x8428('0xf')]){if(_0x103e52['error'][_0x8428('0x10')]===0x1f4){logger[_0x8428('0xf')](_0x8428('0xc'),_0xd8198c,_0x103e52['error']['message']);return _0x54f610(_0x103e52[_0x8428('0xf')][_0x8428('0x11')]);}logger[_0x8428('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0xd8198c,_0x103e52[_0x8428('0xf')][_0x8428('0x11')]);return _0x2d8303(_0x103e52[_0x8428('0xf')]['message']);}else{logger[_0x8428('0x12')](_0x8428('0xc'),_0xd8198c,_0x8428('0xe'));_0x2d8303(_0x103e52[_0x8428('0x13')][_0x8428('0x11')]);}})[_0x8428('0x14')](function(_0x17e77){logger[_0x8428('0xf')](_0x8428('0xc'),_0xd8198c,_0x17e77);_0x54f610(_0x17e77);});});}exports['GetCmHopperBlack']=function(_0x48c5e4){var _0x5d67ef=this;return new Promise(function(_0xc2f1cd,_0x282c8d){return db[_0x8428('0x15')][_0x8428('0x16')]({'raw':_0x48c5e4[_0x8428('0x17')]?_0x48c5e4[_0x8428('0x17')][_0x8428('0x18')]===undefined?!![]:![]:!![],'where':_0x48c5e4[_0x8428('0x17')]?_0x48c5e4[_0x8428('0x17')][_0x8428('0x19')]||null:null,'attributes':_0x48c5e4[_0x8428('0x17')]?_0x48c5e4['options'][_0x8428('0x1a')]||null:null,'limit':_0x48c5e4[_0x8428('0x17')]?_0x48c5e4[_0x8428('0x17')]['limit']||null:null,'include':_0x48c5e4['options']?_0x48c5e4[_0x8428('0x17')][_0x8428('0x1b')]?_['map'](_0x48c5e4[_0x8428('0x17')][_0x8428('0x1b')],function(_0x568db7){return{'model':db[_0x568db7[_0x8428('0x1c')]],'as':_0x568db7['as'],'attributes':_0x568db7['attributes'],'include':_0x568db7[_0x8428('0x1b')]?_['map'](_0x568db7[_0x8428('0x1b')],function(_0x5b7e67){return{'model':db[_0x5b7e67[_0x8428('0x1c')]],'as':_0x5b7e67['as'],'attributes':_0x5b7e67[_0x8428('0x1a')],'include':_0x5b7e67['include']?_['map'](_0x5b7e67[_0x8428('0x1b')],function(_0x2515bb){return{'model':db[_0x2515bb[_0x8428('0x1c')]],'as':_0x2515bb['as'],'attributes':_0x2515bb[_0x8428('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8428('0xb')](function(_0x456488){logger[_0x8428('0x12')](_0x8428('0x1d'),_0x48c5e4);logger[_0x8428('0xd')]('GetCmHopperBlack',_0x48c5e4,JSON['stringify'](_0x456488));_0xc2f1cd(_0x456488);})[_0x8428('0x14')](function(_0x53c568){logger[_0x8428('0xf')](_0x8428('0x1d'),_0x53c568['message'],_0x48c5e4);_0x282c8d(_0x5d67ef[_0x8428('0xf')](0x1f4,_0x53c568[_0x8428('0x11')]));});});};exports[_0x8428('0x1e')]=function(_0x313d9e){var _0x8c6f86=this;return new Promise(function(_0x2ec008,_0xc7c757){return db[_0x8428('0x15')][_0x8428('0x1f')](_0x313d9e[_0x8428('0x20')],{'raw':_0x313d9e[_0x8428('0x17')]?_0x313d9e[_0x8428('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x313d9e[_0x8428('0x17')]?_0x313d9e[_0x8428('0x17')]['where']||null:null,'attributes':_0x313d9e['options']?_0x313d9e[_0x8428('0x17')][_0x8428('0x1a')]||null:null,'limit':_0x313d9e[_0x8428('0x17')]?_0x313d9e['options']['limit']||null:null})[_0x8428('0xb')](function(_0x592405){logger[_0x8428('0x12')](_0x8428('0x1e'),_0x313d9e);logger['debug'](_0x8428('0x1e'),_0x313d9e,JSON[_0x8428('0x21')](_0x592405));_0x2ec008(_0x592405);})['catch'](function(_0x51846a){logger['error'](_0x8428('0x1e'),_0x51846a[_0x8428('0x11')],_0x313d9e);_0xc7c757(_0x8c6f86['error'](0x1f4,_0x51846a[_0x8428('0x11')]));});});};exports[_0x8428('0x22')]=function(_0x1cecfc){var _0x50e5e0=this;return new Promise(function(_0x3198ff,_0x23140c){return db['CmHopperBlack']['destroy']({'where':_0x1cecfc['options']?_0x1cecfc[_0x8428('0x17')]['where']||null:null})['then'](function(_0x7ee585){logger[_0x8428('0x12')](_0x8428('0x22'),_0x1cecfc);logger[_0x8428('0xd')]('DestroyCmHopperBlack',_0x1cecfc,JSON[_0x8428('0x21')](_0x7ee585));_0x3198ff(_0x7ee585);})[_0x8428('0x14')](function(_0x59d977){logger['error'](_0x8428('0x22'),_0x59d977[_0x8428('0x11')],_0x1cecfc);_0x23140c(_0x50e5e0[_0x8428('0xf')](0x1f4,_0x59d977[_0x8428('0x11')]));});});}; \ No newline at end of file +var _0x024b=['stringify','code','error','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s'];(function(_0x419116,_0x5f2d14){var _0x293051=function(_0x276683){while(--_0x276683){_0x419116['push'](_0x419116['shift']());}};_0x293051(++_0x5f2d14);}(_0x024b,0x146));var _0xb024=function(_0xe977f5,_0x2ecc12){_0xe977f5=_0xe977f5-0x0;var _0x2c5800=_0x024b[_0xe977f5];return _0x2c5800;};'use strict';var _=require(_0xb024('0x0'));var util=require('util');var moment=require(_0xb024('0x1'));var BPromise=require(_0xb024('0x2'));var rs=require(_0xb024('0x3'));var fs=require('fs');var Redis=require(_0xb024('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb024('0x5'));var config=require(_0xb024('0x6'));var jayson=require(_0xb024('0x7'));var client=jayson[_0xb024('0x8')][_0xb024('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5468e4,_0x530a08,_0x29bfb0){return new BPromise(function(_0x266261,_0xa0c777){return client[_0xb024('0xa')](_0x5468e4,_0x29bfb0)[_0xb024('0xb')](function(_0x48ea76){logger['info'](_0xb024('0xc'),_0x530a08,_0xb024('0xd'));logger[_0xb024('0xe')](_0xb024('0xf'),_0x530a08,'request\x20sent',JSON[_0xb024('0x10')](_0x48ea76));if(_0x48ea76['error']){if(_0x48ea76['error'][_0xb024('0x11')]===0x1f4){logger[_0xb024('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x530a08,_0x48ea76['error'][_0xb024('0x13')]);return _0xa0c777(_0x48ea76[_0xb024('0x12')][_0xb024('0x13')]);}logger[_0xb024('0x12')](_0xb024('0xc'),_0x530a08,_0x48ea76[_0xb024('0x12')]['message']);return _0x266261(_0x48ea76[_0xb024('0x12')][_0xb024('0x13')]);}else{logger[_0xb024('0x14')](_0xb024('0xc'),_0x530a08,_0xb024('0xd'));_0x266261(_0x48ea76[_0xb024('0x15')][_0xb024('0x13')]);}})[_0xb024('0x16')](function(_0x32e446){logger['error'](_0xb024('0xc'),_0x530a08,_0x32e446);_0xa0c777(_0x32e446);});});}exports[_0xb024('0x17')]=function(_0x29ede0){var _0x3b3c9d=this;return new Promise(function(_0x5f4e08,_0x17fdc5){return db[_0xb024('0x18')]['findAll']({'raw':_0x29ede0['options']?_0x29ede0[_0xb024('0x19')][_0xb024('0x1a')]===undefined?!![]:![]:!![],'where':_0x29ede0[_0xb024('0x19')]?_0x29ede0[_0xb024('0x19')][_0xb024('0x1b')]||null:null,'attributes':_0x29ede0[_0xb024('0x19')]?_0x29ede0[_0xb024('0x19')][_0xb024('0x1c')]||null:null,'limit':_0x29ede0['options']?_0x29ede0['options'][_0xb024('0x1d')]||null:null,'include':_0x29ede0['options']?_0x29ede0['options'][_0xb024('0x1e')]?_['map'](_0x29ede0[_0xb024('0x19')][_0xb024('0x1e')],function(_0x182b86){return{'model':db[_0x182b86['model']],'as':_0x182b86['as'],'attributes':_0x182b86[_0xb024('0x1c')],'include':_0x182b86[_0xb024('0x1e')]?_['map'](_0x182b86[_0xb024('0x1e')],function(_0x132481){return{'model':db[_0x132481['model']],'as':_0x132481['as'],'attributes':_0x132481['attributes'],'include':_0x132481[_0xb024('0x1e')]?_[_0xb024('0x1f')](_0x132481[_0xb024('0x1e')],function(_0x274fb8){return{'model':db[_0x274fb8[_0xb024('0x20')]],'as':_0x274fb8['as'],'attributes':_0x274fb8[_0xb024('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb024('0xb')](function(_0x4d993d){logger[_0xb024('0x14')](_0xb024('0x17'),_0x29ede0);logger[_0xb024('0xe')](_0xb024('0x17'),_0x29ede0,JSON[_0xb024('0x10')](_0x4d993d));_0x5f4e08(_0x4d993d);})['catch'](function(_0x4d9d53){logger['error'](_0xb024('0x17'),_0x4d9d53[_0xb024('0x13')],_0x29ede0);_0x17fdc5(_0x3b3c9d[_0xb024('0x12')](0x1f4,_0x4d9d53[_0xb024('0x13')]));});});};exports[_0xb024('0x21')]=function(_0x272d15){var _0x5aebc0=this;return new Promise(function(_0x5357dd,_0x1171c8){return db[_0xb024('0x18')][_0xb024('0x22')](_0x272d15[_0xb024('0x23')],{'raw':_0x272d15[_0xb024('0x19')]?_0x272d15[_0xb024('0x19')][_0xb024('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x272d15['options']?_0x272d15[_0xb024('0x19')][_0xb024('0x1b')]||null:null,'attributes':_0x272d15[_0xb024('0x19')]?_0x272d15[_0xb024('0x19')]['attributes']||null:null,'limit':_0x272d15['options']?_0x272d15['options']['limit']||null:null})['then'](function(_0x38f94a){logger[_0xb024('0x14')]('UpdateCmHopperBlack',_0x272d15);logger[_0xb024('0xe')](_0xb024('0x21'),_0x272d15,JSON[_0xb024('0x10')](_0x38f94a));_0x5357dd(_0x38f94a);})[_0xb024('0x16')](function(_0x2201e6){logger['error'](_0xb024('0x21'),_0x2201e6[_0xb024('0x13')],_0x272d15);_0x1171c8(_0x5aebc0[_0xb024('0x12')](0x1f4,_0x2201e6[_0xb024('0x13')]));});});};exports[_0xb024('0x24')]=function(_0x3f7190){var _0x6fbd91=this;return new Promise(function(_0x780cdd,_0x1f61d0){return db[_0xb024('0x18')][_0xb024('0x25')]({'where':_0x3f7190[_0xb024('0x19')]?_0x3f7190[_0xb024('0x19')][_0xb024('0x1b')]||null:null})[_0xb024('0xb')](function(_0x1609d3){logger[_0xb024('0x14')](_0xb024('0x24'),_0x3f7190);logger[_0xb024('0xe')](_0xb024('0x24'),_0x3f7190,JSON[_0xb024('0x10')](_0x1609d3));_0x780cdd(_0x1609d3);})[_0xb024('0x16')](function(_0xead70d){logger[_0xb024('0x12')](_0xb024('0x24'),_0xead70d[_0xb024('0x13')],_0x3f7190);_0x1f61d0(_0x6fbd91[_0xb024('0x12')](0x1f4,_0xead70d['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 6e37f20..2539851 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 _0x39e6=['../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','destroy','exports','multer','path','Router','fs-extra'];(function(_0x334b85,_0x2ab36a){var _0x7f974b=function(_0xbc4503){while(--_0xbc4503){_0x334b85['push'](_0x334b85['shift']());}};_0x7f974b(++_0x2ab36a);}(_0x39e6,0x9e));var _0x639e=function(_0x5150e4,_0x19adb4){_0x5150e4=_0x5150e4-0x0;var _0x6d619a=_0x39e6[_0x5150e4];return _0x6d619a;};'use strict';var multer=require(_0x639e('0x0'));var util=require('util');var path=require(_0x639e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x639e('0x2')]();var fs_extra=require(_0x639e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x639e('0x4'));var config=require(_0x639e('0x5'));var controller=require(_0x639e('0x6'));router[_0x639e('0x7')]('/',auth[_0x639e('0x8')](),controller[_0x639e('0x9')]);router[_0x639e('0x7')](_0x639e('0xa'),auth[_0x639e('0x8')](),controller[_0x639e('0xb')]);router[_0x639e('0x7')](_0x639e('0xc'),auth[_0x639e('0x8')](),controller[_0x639e('0xd')]);router[_0x639e('0xe')](_0x639e('0xc'),auth[_0x639e('0x8')](),controller[_0x639e('0xf')]);router['delete']('/:id',auth[_0x639e('0x8')](),controller[_0x639e('0x10')]);module[_0x639e('0x11')]=router; \ No newline at end of file +var _0x6f44=['get','index','/describe','/:id','show','update','delete','isAuthenticated','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller'];(function(_0x4a96d2,_0x689504){var _0x38af04=function(_0x3a67cd){while(--_0x3a67cd){_0x4a96d2['push'](_0x4a96d2['shift']());}};_0x38af04(++_0x689504);}(_0x6f44,0x1ea));var _0x46f4=function(_0x18705e,_0x860be2){_0x18705e=_0x18705e-0x0;var _0x4e0717=_0x6f44[_0x18705e];return _0x4e0717;};'use strict';var multer=require(_0x46f4('0x0'));var util=require(_0x46f4('0x1'));var path=require('path');var timeout=require(_0x46f4('0x2'));var express=require(_0x46f4('0x3'));var router=express[_0x46f4('0x4')]();var fs_extra=require(_0x46f4('0x5'));var auth=require(_0x46f4('0x6'));var interaction=require(_0x46f4('0x7'));var config=require(_0x46f4('0x8'));var controller=require(_0x46f4('0x9'));router[_0x46f4('0xa')]('/',auth['isAuthenticated'](),controller[_0x46f4('0xb')]);router[_0x46f4('0xa')](_0x46f4('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x46f4('0xa')](_0x46f4('0xd'),auth['isAuthenticated'](),controller[_0x46f4('0xe')]);router['put'](_0x46f4('0xd'),auth['isAuthenticated'](),controller[_0x46f4('0xf')]);router[_0x46f4('0x10')](_0x46f4('0xd'),auth[_0x46f4('0x11')](),controller[_0x46f4('0x12')]);module[_0x46f4('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 55a5397..ec8e0d5 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 _0x8d79=['moment','exports','INTEGER','STRING','DATE','followuptime','diff','seconds','BOOLEAN'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x8d79,0x120));var _0x98d7=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8d79[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x98d7('0x0'));module[_0x98d7('0x1')]={'state':{'type':Sequelize[_0x98d7('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x98d7('0x3')]},'scheduledat':{'type':Sequelize[_0x98d7('0x4')]},'countbusyretry':{'type':Sequelize[_0x98d7('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x98d7('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x98d7('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x98d7('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x98d7('0x3')]},'originatecalleridname':{'type':Sequelize[_0x98d7('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x98d7('0x3')]},'starttime':{'type':Sequelize[_0x98d7('0x4')]},'responsetime':{'type':Sequelize[_0x98d7('0x4')]},'answertime':{'type':Sequelize[_0x98d7('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x98d7('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x98d7('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x98d7('0x3')]},'campaign':{'type':Sequelize[_0x98d7('0x3')]},'campaigntype':{'type':Sequelize[_0x98d7('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x98d7('0x3')]},'disposition':{'type':Sequelize[_0x98d7('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x98d7('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x9d0fac){var _0x5561cf=this['getDataValue']('endtime');if(_0x5561cf&&_0x9d0fac){this['setDataValue'](_0x98d7('0x5'),moment(_0x9d0fac)[_0x98d7('0x6')](moment(_0x5561cf),_0x98d7('0x7')));}}},'amd':{'type':Sequelize[_0x98d7('0x8')],'defaultValue':![]},'fax':{'type':Sequelize[_0x98d7('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x98d7('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x98d7('0x4')]},'callback':{'type':Sequelize[_0x98d7('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x98d7('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x98d7('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x98d7('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x98d7('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x98d7('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x98d7('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x98d7('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7727=['diff','seconds','BOOLEAN','moment','INTEGER','DATE','STRING','getDataValue','endtime','followuptime'];(function(_0x2549a7,_0x4bb1ec){var _0x35f470=function(_0x19ecac){while(--_0x19ecac){_0x2549a7['push'](_0x2549a7['shift']());}};_0x35f470(++_0x4bb1ec);}(_0x7727,0x143));var _0x7772=function(_0x2a03fb,_0x392cf0){_0x2a03fb=_0x2a03fb-0x0;var _0xe23717=_0x7727[_0x2a03fb];return _0xe23717;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7772('0x0'));module['exports']={'state':{'type':Sequelize[_0x7772('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x7772('0x2')]},'countbusyretry':{'type':Sequelize[_0x7772('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7772('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7772('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7772('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x7772('0x3')]},'originatecalleridname':{'type':Sequelize[_0x7772('0x3')]},'calleridnum':{'type':Sequelize[_0x7772('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x7772('0x2')]},'responsetime':{'type':Sequelize[_0x7772('0x2')]},'answertime':{'type':Sequelize[_0x7772('0x2')]},'droptime':{'type':Sequelize[_0x7772('0x2')]},'endtime':{'type':Sequelize[_0x7772('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7772('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7772('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7772('0x3')]},'campaign':{'type':Sequelize[_0x7772('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x7772('0x3')]},'disposition':{'type':Sequelize[_0x7772('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x7772('0x2')],'set':function(_0x40303a){var _0x306dbc=this[_0x7772('0x4')](_0x7772('0x5'));if(_0x306dbc&&_0x40303a){this['setDataValue'](_0x7772('0x6'),moment(_0x40303a)[_0x7772('0x7')](moment(_0x306dbc),_0x7772('0x8')));}}},'amd':{'type':Sequelize[_0x7772('0x9')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x7772('0x2')]},'callback':{'type':Sequelize[_0x7772('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7772('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7772('0x2')]},'deleted':{'type':Sequelize[_0x7772('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x7772('0x2')]},'recallme':{'type':Sequelize[_0x7772('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x7772('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7772('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7772('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 3747ef3..79384fb 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 _0x6459=['filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','describe','body','countContactsQueueCampaignHopperFinal','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','noAnswerContacts','moveContactsQueueCampaignHopperFinal','insert','into','fromQuery','phone','ContactId','ListId','VoiceQueueId','updatedAt','select','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','from','cm_hopper','calleridnum','cm_hopper_final','group','Campaign','CampaignId','ANY_VALUE(calleridnum)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','state\x20=\x204','checkContactHopper','CmHopper','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x47b7c9,_0x3848b2){var _0x435aaf=function(_0x3befc4){while(--_0x3befc4){_0x47b7c9['push'](_0x47b7c9['shift']());}};_0x435aaf(++_0x3848b2);}(_0x6459,0x1d8));var _0x9645=function(_0x351bc1,_0x3fd067){_0x351bc1=_0x351bc1-0x0;var _0x5ba606=_0x6459[_0x351bc1];return _0x5ba606;};'use strict';var emlformat=require(_0x9645('0x0'));var rimraf=require(_0x9645('0x1'));var zipdir=require(_0x9645('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9645('0x3'));var moment=require(_0x9645('0x4'));var BPromise=require(_0x9645('0x5'));var Mustache=require(_0x9645('0x6'));var util=require(_0x9645('0x7'));var path=require('path');var sox=require(_0x9645('0x8'));var csv=require(_0x9645('0x9'));var ejs=require(_0x9645('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9645('0xb'));var squel=require(_0x9645('0xc'));var crypto=require(_0x9645('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9645('0x9'));var querystring=require(_0x9645('0xe'));var Papa=require('papaparse');var Redis=require(_0x9645('0xf'));var authService=require(_0x9645('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9645('0x11'));var hardwareService=require(_0x9645('0x12'));var logger=require(_0x9645('0x13'))('api');var utils=require(_0x9645('0x14'));var config=require(_0x9645('0x15'));var licenseUtil=require(_0x9645('0x16'));var db=require(_0x9645('0x17'))['db'];function respondWithStatusCode(_0x5eb47b,_0x542cd8){_0x542cd8=_0x542cd8||0xcc;return function(_0x5950e4){if(_0x5950e4){return _0x5eb47b['sendStatus'](_0x542cd8);}return _0x5eb47b['status'](_0x542cd8)[_0x9645('0x18')]();};}function respondWithResult(_0x1c89fe,_0x560f67){_0x560f67=_0x560f67||0xc8;return function(_0x520eeb){if(_0x520eeb){return _0x1c89fe[_0x9645('0x19')](_0x560f67)[_0x9645('0x1a')](_0x520eeb);}};}function respondWithFilteredResult(_0x446a6f,_0x5a90d5){return function(_0x4825eb){if(_0x4825eb){var _0x3a5679=typeof _0x5a90d5['offset']===_0x9645('0x1b')&&typeof _0x5a90d5[_0x9645('0x1c')]===_0x9645('0x1b');var _0x59348b=_0x4825eb[_0x9645('0x1d')];var _0x3cdb03=_0x3a5679?0x0:_0x5a90d5[_0x9645('0x1e')];var _0x3153d3=_0x3a5679?_0x4825eb[_0x9645('0x1d')]:_0x5a90d5[_0x9645('0x1e')]+_0x5a90d5[_0x9645('0x1c')];var _0x25b9e0;if(_0x3153d3>=_0x59348b){_0x3153d3=_0x59348b;_0x25b9e0=0xc8;}else{_0x25b9e0=0xce;}_0x446a6f[_0x9645('0x19')](_0x25b9e0);return _0x446a6f[_0x9645('0x1f')](_0x9645('0x20'),_0x3cdb03+'-'+_0x3153d3+'/'+_0x59348b)['json'](_0x4825eb);}return null;};}function patchUpdates(_0x5013a9){return function(_0x5982ea){try{jsonpatch[_0x9645('0x21')](_0x5982ea,_0x5013a9,!![]);}catch(_0x3bd988){return BPromise[_0x9645('0x22')](_0x3bd988);}return _0x5982ea[_0x9645('0x23')]();};}function saveUpdates(_0x218b7c,_0x3fc2d5){return function(_0x1943f7){if(_0x1943f7){return _0x1943f7[_0x9645('0x24')](_0x218b7c)[_0x9645('0x25')](function(_0xb0d5d9){return _0xb0d5d9;});}return null;};}function removeEntity(_0x199fc7,_0x1a3e41){return function(_0x7de008){if(_0x7de008){return _0x7de008[_0x9645('0x26')]()[_0x9645('0x25')](function(){_0x199fc7[_0x9645('0x19')](0xcc)[_0x9645('0x18')]();});}};}function handleEntityNotFound(_0x498fe2,_0x367819){return function(_0x3ab9b8){if(!_0x3ab9b8){_0x498fe2[_0x9645('0x27')](0x194);}return _0x3ab9b8;};}function handleError(_0x18bfe4,_0x454999){_0x454999=_0x454999||0x1f4;return function(_0x269d1d){logger[_0x9645('0x28')](_0x269d1d[_0x9645('0x29')]);if(_0x269d1d[_0x9645('0x2a')]){delete _0x269d1d['name'];}_0x18bfe4[_0x9645('0x19')](_0x454999)[_0x9645('0x2b')](_0x269d1d);};}exports[_0x9645('0x2c')]=function(_0xa11f60,_0x4ba11d){var _0x38db80={},_0x5a1de6={},_0x357ba5={'count':0x0,'rows':[]};var _0x4abe6f=_[_0x9645('0x2d')](db[_0x9645('0x2e')][_0x9645('0x2f')],function(_0x4a46d3){return{'name':_0x4a46d3[_0x9645('0x30')],'type':_0x4a46d3['type'][_0x9645('0x31')]};});_0x5a1de6[_0x9645('0x32')]=_[_0x9645('0x2d')](_0x4abe6f,_0x9645('0x2a'));_0x5a1de6[_0x9645('0x33')]=_[_0x9645('0x34')](_0xa11f60['query']);_0x5a1de6[_0x9645('0x35')]=_[_0x9645('0x36')](_0x5a1de6[_0x9645('0x32')],_0x5a1de6[_0x9645('0x33')]);_0x38db80[_0x9645('0x37')]=_[_0x9645('0x36')](_0x5a1de6[_0x9645('0x32')],qs[_0x9645('0x38')](_0xa11f60[_0x9645('0x33')][_0x9645('0x38')]));_0x38db80[_0x9645('0x37')]=_0x38db80[_0x9645('0x37')][_0x9645('0x39')]?_0x38db80['attributes']:_0x5a1de6[_0x9645('0x32')];if(!_0xa11f60[_0x9645('0x33')][_0x9645('0x3a')](_0x9645('0x3b'))){_0x38db80[_0x9645('0x1c')]=qs['limit'](_0xa11f60[_0x9645('0x33')][_0x9645('0x1c')]);_0x38db80[_0x9645('0x1e')]=qs[_0x9645('0x1e')](_0xa11f60['query'][_0x9645('0x1e')]);}_0x38db80[_0x9645('0x3c')]=qs[_0x9645('0x3d')](_0xa11f60[_0x9645('0x33')][_0x9645('0x3d')]);_0x38db80[_0x9645('0x3e')]=qs['filters'](_[_0x9645('0x3f')](_0xa11f60[_0x9645('0x33')],_0x5a1de6['filters']),_0x4abe6f);if(_0xa11f60['query'][_0x9645('0x40')]){_0x38db80[_0x9645('0x3e')]=_[_0x9645('0x41')](_0x38db80['where'],{'$or':_[_0x9645('0x2d')](_0x4abe6f,function(_0x26c409){if(_0x26c409[_0x9645('0x42')]!==_0x9645('0x43')){var _0x3a5e43={};_0x3a5e43[_0x26c409[_0x9645('0x2a')]]={'$like':'%'+_0xa11f60[_0x9645('0x33')][_0x9645('0x40')]+'%'};return _0x3a5e43;}})});}_0x38db80=_['merge']({},_0x38db80,_0xa11f60[_0x9645('0x44')]);var _0x429235={'where':_0x38db80['where']};return db[_0x9645('0x2e')][_0x9645('0x1d')](_0x429235)[_0x9645('0x25')](function(_0x400c0e){_0x357ba5[_0x9645('0x1d')]=_0x400c0e;if(_0xa11f60[_0x9645('0x33')][_0x9645('0x45')]){_0x38db80['include']=[{'all':!![]}];}return db[_0x9645('0x2e')]['findAll'](_0x38db80);})[_0x9645('0x25')](function(_0x16d972){_0x357ba5[_0x9645('0x46')]=_0x16d972;return _0x357ba5;})['then'](respondWithFilteredResult(_0x4ba11d,_0x38db80))[_0x9645('0x47')](handleError(_0x4ba11d,null));};exports[_0x9645('0x48')]=function(_0x128c45,_0x217c2f){var _0x170af0={'raw':!![],'where':{'id':_0x128c45[_0x9645('0x49')]['id']}},_0xb240b4={};_0xb240b4['model']=_[_0x9645('0x34')](db[_0x9645('0x2e')][_0x9645('0x2f')]);_0xb240b4['query']=_['keys'](_0x128c45[_0x9645('0x33')]);_0xb240b4['filters']=_[_0x9645('0x36')](_0xb240b4[_0x9645('0x32')],_0xb240b4[_0x9645('0x33')]);_0x170af0['attributes']=_[_0x9645('0x36')](_0xb240b4[_0x9645('0x32')],qs[_0x9645('0x38')](_0x128c45[_0x9645('0x33')][_0x9645('0x38')]));_0x170af0[_0x9645('0x37')]=_0x170af0['attributes'][_0x9645('0x39')]?_0x170af0[_0x9645('0x37')]:_0xb240b4[_0x9645('0x32')];if(_0x128c45[_0x9645('0x33')]['includeAll']){_0x170af0[_0x9645('0x4a')]=[{'all':!![]}];}_0x170af0=_[_0x9645('0x41')]({},_0x170af0,_0x128c45['options']);return db[_0x9645('0x2e')][_0x9645('0x4b')](_0x170af0)[_0x9645('0x25')](handleEntityNotFound(_0x217c2f,null))[_0x9645('0x25')](respondWithResult(_0x217c2f,null))['catch'](handleError(_0x217c2f,null));};exports[_0x9645('0x4c')]=function(_0x38bf43,_0x4d4c06){return db[_0x9645('0x2e')][_0x9645('0x4c')]()[_0x9645('0x25')](respondWithResult(_0x4d4c06,null))[_0x9645('0x47')](handleError(_0x4d4c06,null));};exports[_0x9645('0x24')]=function(_0x183fc1,_0x32dcba){if(_0x183fc1[_0x9645('0x4d')]['uniqueid']){delete _0x183fc1['body']['uniqueid'];}return db[_0x9645('0x2e')][_0x9645('0x4b')]({'where':{'uniqueid':_0x183fc1[_0x9645('0x49')]['id']}})[_0x9645('0x25')](handleEntityNotFound(_0x32dcba,null))[_0x9645('0x25')](saveUpdates(_0x183fc1[_0x9645('0x4d')],null))[_0x9645('0x25')](respondWithResult(_0x32dcba,null))[_0x9645('0x47')](handleError(_0x32dcba,null));};exports[_0x9645('0x4e')]=function(_0x45367f,_0xdd4e05,_0x24293e){return db[_0x9645('0x2e')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x45367f['params']['id']},'attributes':[[db[_0x9645('0x4f')]['fn']('COUNT',db[_0x9645('0x4f')]['fn']('IF',db['sequelize']['literal'](_0x9645('0x50')))),_0x9645('0x51')],[db[_0x9645('0x4f')]['fn'](_0x9645('0x52'),db[_0x9645('0x4f')]['fn']('IF',db[_0x9645('0x4f')][_0x9645('0x53')](_0x9645('0x54')))),'noAnswerContacts'],[db[_0x9645('0x4f')]['fn'](_0x9645('0x52'),db[_0x9645('0x4f')]['fn']('IF',db[_0x9645('0x4f')][_0x9645('0x53')](_0x9645('0x55')))),_0x9645('0x56')],[db[_0x9645('0x4f')]['fn']('COUNT',db[_0x9645('0x4f')]['fn']('IF',db['sequelize'][_0x9645('0x53')]('`state`\x20=\x208,\x201,\x20null'))),_0x9645('0x57')],[db[_0x9645('0x4f')]['fn'](_0x9645('0x52'),db[_0x9645('0x4f')]['fn']('IF',db['sequelize'][_0x9645('0x53')](_0x9645('0x58')))),_0x9645('0x59')],[db[_0x9645('0x4f')]['fn'](_0x9645('0x52'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x9645('0x5a')))),_0x9645('0x5b')],[db[_0x9645('0x4f')]['fn'](_0x9645('0x52'),db[_0x9645('0x4f')]['fn']('IF',db[_0x9645('0x4f')][_0x9645('0x53')](_0x9645('0x5c')))),_0x9645('0x5d')],[db[_0x9645('0x4f')]['fn'](_0x9645('0x52'),db[_0x9645('0x4f')]['fn']('IF',db[_0x9645('0x4f')][_0x9645('0x53')](_0x9645('0x5e')))),_0x9645('0x5f')]]})[_0x9645('0x25')](handleEntityNotFound(_0xdd4e05,null))[_0x9645('0x25')](respondWithResult(_0xdd4e05,null))['catch'](handleError(_0xdd4e05,null));};exports[_0x9645('0x60')]=function(_0x1c7542,_0x47b087,_0x2f0b00){return db[_0x9645('0x2e')][_0x9645('0x61')]({'raw':![],'where':{'CampaignId':_0x1c7542['params']['id']},'attributes':[[db[_0x9645('0x4f')]['fn'](_0x9645('0x52'),db[_0x9645('0x4f')]['fn']('IF',db[_0x9645('0x4f')][_0x9645('0x53')]('`state`\x20=\x200,\x201,\x20null'))),_0x9645('0x51')],[db[_0x9645('0x4f')]['fn']('COUNT',db[_0x9645('0x4f')]['fn']('IF',db[_0x9645('0x4f')][_0x9645('0x53')](_0x9645('0x54')))),_0x9645('0x62')],[db[_0x9645('0x4f')]['fn'](_0x9645('0x52'),db[_0x9645('0x4f')]['fn']('IF',db['sequelize'][_0x9645('0x53')](_0x9645('0x55')))),_0x9645('0x56')],[db['sequelize']['fn'](_0x9645('0x52'),db[_0x9645('0x4f')]['fn']('IF',db['sequelize'][_0x9645('0x53')]('`state`\x20=\x208,\x201,\x20null'))),_0x9645('0x57')],[db[_0x9645('0x4f')]['fn'](_0x9645('0x52'),db['sequelize']['fn']('IF',db['sequelize'][_0x9645('0x53')](_0x9645('0x58')))),_0x9645('0x59')],[db[_0x9645('0x4f')]['fn'](_0x9645('0x52'),db[_0x9645('0x4f')]['fn']('IF',db[_0x9645('0x4f')]['literal'](_0x9645('0x5a')))),'abandonedContacts'],[db[_0x9645('0x4f')]['fn'](_0x9645('0x52'),db['sequelize']['fn']('IF',db[_0x9645('0x4f')]['literal'](_0x9645('0x5c')))),_0x9645('0x5d')],[db[_0x9645('0x4f')]['fn']('COUNT',db[_0x9645('0x4f')]['fn']('IF',db[_0x9645('0x4f')][_0x9645('0x53')](_0x9645('0x5e')))),_0x9645('0x5f')]]})[_0x9645('0x25')](handleEntityNotFound(_0x47b087,null))[_0x9645('0x25')](respondWithResult(_0x47b087,null))[_0x9645('0x47')](handleError(_0x47b087,null));};exports[_0x9645('0x63')]=function(_0xbc304,_0x4ceff3,_0x1a41f1){return db['VoiceQueue'][_0x9645('0x4b')]({'where':{'id':_0xbc304[_0x9645('0x49')]['id']}})[_0x9645('0x25')](handleEntityNotFound(_0x4ceff3,null))[_0x9645('0x25')](function(_0x5eee21){var _0x27efec;if(_0x5eee21){_0x27efec=squel[_0x9645('0x64')]()[_0x9645('0x65')]('cm_hopper')[_0x9645('0x66')]([_0x9645('0x67'),'scheduledAt',_0x9645('0x68'),_0x9645('0x69'),_0x9645('0x6a'),'createdAt',_0x9645('0x6b')],squel[_0x9645('0x6c')]()[_0x9645('0x6d')]('ANY_VALUE(calleridnum)',_0x9645('0x67'))['field'](_0x9645('0x6e'),_0x9645('0x6f'))[_0x9645('0x6d')](_0x9645('0x70'),_0x9645('0x68'))[_0x9645('0x6d')](_0x9645('0x71'),_0x9645('0x69'))['field'](_0x9645('0x72'),_0x9645('0x6a'))['field'](_0x9645('0x6e'),_0x9645('0x73'))[_0x9645('0x6d')]('NOW()','updatedAt')['from']('cm_hopper_final')[_0x9645('0x3e')](_0x9645('0x74'),_0xbc304[_0x9645('0x49')]['id'][_0x9645('0x75')]())['where'](_0x9645('0x76'),_0xbc304[_0x9645('0x4d')][_0x9645('0x77')][_0x9645('0x75')]())[_0x9645('0x3e')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x9645('0x3e')](_0x9645('0x78'),squel[_0x9645('0x6c')]()[_0x9645('0x6d')](_0x9645('0x67'))[_0x9645('0x79')](_0x9645('0x7a'))[_0x9645('0x3e')](_0x9645('0x74'),_0xbc304[_0x9645('0x49')]['id'][_0x9645('0x75')]()))[_0x9645('0x3e')](_0x9645('0x78'),squel[_0x9645('0x6c')]()[_0x9645('0x6d')](_0x9645('0x7b'))[_0x9645('0x79')](_0x9645('0x7c'))['where'](_0x9645('0x74'),_0xbc304[_0x9645('0x49')]['id'][_0x9645('0x75')]())['where']('state\x20=\x204'))[_0x9645('0x7d')]('ContactId'))['toString']();return db['sequelize'][_0x9645('0x33')](_0x27efec);}return[];})['then'](respondWithResult(_0x4ceff3,null))[_0x9645('0x47')](handleError(_0x4ceff3,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1404e3,_0x528ab6,_0x37b33e){return db[_0x9645('0x7e')][_0x9645('0x4b')]({'where':{'id':_0x1404e3[_0x9645('0x49')]['id']}})[_0x9645('0x25')](handleEntityNotFound(_0x528ab6,null))['then'](function(_0x5af474){var _0x5568a2;if(_0x5af474){_0x5568a2=squel[_0x9645('0x64')]()[_0x9645('0x65')]('cm_hopper')['fromQuery'](['phone',_0x9645('0x6f'),_0x9645('0x68'),_0x9645('0x69'),_0x9645('0x7f'),'createdAt',_0x9645('0x6b')],squel[_0x9645('0x6c')]()['field'](_0x9645('0x80'),'phone')['field']('NOW()',_0x9645('0x6f'))[_0x9645('0x6d')](_0x9645('0x70'),_0x9645('0x68'))[_0x9645('0x6d')](_0x9645('0x71'),_0x9645('0x69'))[_0x9645('0x6d')]('ANY_VALUE(CampaignId)',_0x9645('0x7f'))[_0x9645('0x6d')](_0x9645('0x6e'),'createdAt')[_0x9645('0x6d')](_0x9645('0x6e'),_0x9645('0x6b'))[_0x9645('0x79')](_0x9645('0x7c'))[_0x9645('0x3e')](_0x9645('0x81'),_0x1404e3[_0x9645('0x49')]['id'][_0x9645('0x75')]())[_0x9645('0x3e')]('state\x20=\x20?',_0x1404e3['body'][_0x9645('0x77')]['toString']())[_0x9645('0x3e')](_0x9645('0x82'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9645('0x6c')]()[_0x9645('0x6d')](_0x9645('0x67'))['from'](_0x9645('0x7a'))[_0x9645('0x3e')](_0x9645('0x81'),_0x1404e3['params']['id']['toString']()))[_0x9645('0x3e')](_0x9645('0x78'),squel['select']()[_0x9645('0x6d')](_0x9645('0x7b'))['from'](_0x9645('0x7c'))[_0x9645('0x3e')](_0x9645('0x81'),_0x1404e3[_0x9645('0x49')]['id'][_0x9645('0x75')]())['where'](_0x9645('0x83')))['group']('ContactId'))['toString']();return db[_0x9645('0x4f')][_0x9645('0x33')](_0x5568a2);}return[];})[_0x9645('0x25')](respondWithResult(_0x528ab6,null))[_0x9645('0x47')](handleError(_0x528ab6,null));};exports[_0x9645('0x84')]=function(_0x5a3e8b,_0x688149,_0x5b7f75){return db[_0x9645('0x85')]['findOne']({'where':{'VoiceQueueId':_0x5a3e8b[_0x9645('0x4d')][_0x9645('0x6a')],'CampaignId':_0x5a3e8b[_0x9645('0x4d')][_0x9645('0x7f')],'ContactId':_0x5a3e8b[_0x9645('0x4d')][_0x9645('0x68')]}})[_0x9645('0x25')](handleEntityNotFound(_0x688149,null))['then'](function(_0x5e6ef2){if(_0x5e6ef2){return _0x5e6ef2;}return null;})[_0x9645('0x25')](respondWithResult(_0x688149,null))[_0x9645('0x47')](handleError(_0x688149,null));}; \ No newline at end of file +var _0x3601=['noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','reCallContacts','moveContactsQueueCampaignHopperFinal','find','insert','into','phone','scheduledAt','ContactId','ListId','VoiceQueueId','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','updatedAt','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','from','cm_hopper','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper_final','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','calleridnum','group','checkContactHopper','CmHopper','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','length','catch','describe','body','uniqueid','params','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null'];(function(_0x1cb043,_0xd453c1){var _0x168cf9=function(_0x546461){while(--_0x546461){_0x1cb043['push'](_0x1cb043['shift']());}};_0x168cf9(++_0xd453c1);}(_0x3601,0x138));var _0x1360=function(_0x35b320,_0x2d73cb){_0x35b320=_0x35b320-0x0;var _0x2fcd04=_0x3601[_0x35b320];return _0x2fcd04;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1360('0x0'));var zipdir=require(_0x1360('0x1'));var jsonpatch=require(_0x1360('0x2'));var rp=require(_0x1360('0x3'));var moment=require(_0x1360('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1360('0x5'));var util=require(_0x1360('0x6'));var path=require(_0x1360('0x7'));var sox=require(_0x1360('0x8'));var csv=require(_0x1360('0x9'));var ejs=require(_0x1360('0xa'));var fs=require('fs');var fs_extra=require(_0x1360('0xb'));var _=require(_0x1360('0xc'));var squel=require('squel');var crypto=require(_0x1360('0xd'));var jsforce=require(_0x1360('0xe'));var deskjs=require(_0x1360('0xf'));var toCsv=require(_0x1360('0x9'));var querystring=require('querystring');var Papa=require(_0x1360('0x10'));var Redis=require('ioredis');var authService=require(_0x1360('0x11'));var qs=require(_0x1360('0x12'));var as=require(_0x1360('0x13'));var hardwareService=require(_0x1360('0x14'));var logger=require(_0x1360('0x15'))('api');var utils=require(_0x1360('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1360('0x17'));var db=require(_0x1360('0x18'))['db'];function respondWithStatusCode(_0x160463,_0x4a1f5e){_0x4a1f5e=_0x4a1f5e||0xcc;return function(_0x1592e6){if(_0x1592e6){return _0x160463['sendStatus'](_0x4a1f5e);}return _0x160463[_0x1360('0x19')](_0x4a1f5e)['end']();};}function respondWithResult(_0x114b01,_0x10aab9){_0x10aab9=_0x10aab9||0xc8;return function(_0x1363f0){if(_0x1363f0){return _0x114b01[_0x1360('0x19')](_0x10aab9)['json'](_0x1363f0);}};}function respondWithFilteredResult(_0x2361bb,_0x117ced){return function(_0x193fc){if(_0x193fc){var _0x298f46=typeof _0x117ced[_0x1360('0x1a')]===_0x1360('0x1b')&&typeof _0x117ced[_0x1360('0x1c')]===_0x1360('0x1b');var _0xdc2e5f=_0x193fc[_0x1360('0x1d')];var _0x33966e=_0x298f46?0x0:_0x117ced[_0x1360('0x1a')];var _0x3099e6=_0x298f46?_0x193fc[_0x1360('0x1d')]:_0x117ced[_0x1360('0x1a')]+_0x117ced[_0x1360('0x1c')];var _0x936bc3;if(_0x3099e6>=_0xdc2e5f){_0x3099e6=_0xdc2e5f;_0x936bc3=0xc8;}else{_0x936bc3=0xce;}_0x2361bb['status'](_0x936bc3);return _0x2361bb['set'](_0x1360('0x1e'),_0x33966e+'-'+_0x3099e6+'/'+_0xdc2e5f)['json'](_0x193fc);}return null;};}function patchUpdates(_0x13cf45){return function(_0x5cd711){try{jsonpatch[_0x1360('0x1f')](_0x5cd711,_0x13cf45,!![]);}catch(_0x42fb04){return BPromise['reject'](_0x42fb04);}return _0x5cd711[_0x1360('0x20')]();};}function saveUpdates(_0x33b252,_0x5ad2d3){return function(_0x535a3a){if(_0x535a3a){return _0x535a3a[_0x1360('0x21')](_0x33b252)[_0x1360('0x22')](function(_0x404565){return _0x404565;});}return null;};}function removeEntity(_0x478742,_0x366164){return function(_0x548b4d){if(_0x548b4d){return _0x548b4d[_0x1360('0x23')]()['then'](function(){_0x478742[_0x1360('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x545808,_0x2a4cd0){return function(_0x36813c){if(!_0x36813c){_0x545808[_0x1360('0x24')](0x194);}return _0x36813c;};}function handleError(_0x531ac8,_0x2f0299){_0x2f0299=_0x2f0299||0x1f4;return function(_0x58ba64){logger[_0x1360('0x25')](_0x58ba64['stack']);if(_0x58ba64[_0x1360('0x26')]){delete _0x58ba64[_0x1360('0x26')];}_0x531ac8[_0x1360('0x19')](_0x2f0299)[_0x1360('0x27')](_0x58ba64);};}exports[_0x1360('0x28')]=function(_0x1ea32c,_0xe0031f){var _0x4515fd={},_0x276504={},_0x358169={'count':0x0,'rows':[]};var _0x9aacc5=_[_0x1360('0x29')](db[_0x1360('0x2a')][_0x1360('0x2b')],function(_0x5daaad){return{'name':_0x5daaad[_0x1360('0x2c')],'type':_0x5daaad[_0x1360('0x2d')][_0x1360('0x2e')]};});_0x276504[_0x1360('0x2f')]=_[_0x1360('0x29')](_0x9aacc5,_0x1360('0x26'));_0x276504[_0x1360('0x30')]=_[_0x1360('0x31')](_0x1ea32c[_0x1360('0x30')]);_0x276504['filters']=_[_0x1360('0x32')](_0x276504[_0x1360('0x2f')],_0x276504[_0x1360('0x30')]);_0x4515fd[_0x1360('0x33')]=_[_0x1360('0x32')](_0x276504['model'],qs[_0x1360('0x34')](_0x1ea32c[_0x1360('0x30')][_0x1360('0x34')]));_0x4515fd[_0x1360('0x33')]=_0x4515fd['attributes']['length']?_0x4515fd[_0x1360('0x33')]:_0x276504[_0x1360('0x2f')];if(!_0x1ea32c[_0x1360('0x30')]['hasOwnProperty'](_0x1360('0x35'))){_0x4515fd['limit']=qs[_0x1360('0x1c')](_0x1ea32c[_0x1360('0x30')][_0x1360('0x1c')]);_0x4515fd['offset']=qs[_0x1360('0x1a')](_0x1ea32c[_0x1360('0x30')]['offset']);}_0x4515fd[_0x1360('0x36')]=qs[_0x1360('0x37')](_0x1ea32c['query'][_0x1360('0x37')]);_0x4515fd[_0x1360('0x38')]=qs['filters'](_[_0x1360('0x39')](_0x1ea32c[_0x1360('0x30')],_0x276504['filters']),_0x9aacc5);if(_0x1ea32c['query'][_0x1360('0x3a')]){_0x4515fd[_0x1360('0x38')]=_[_0x1360('0x3b')](_0x4515fd[_0x1360('0x38')],{'$or':_[_0x1360('0x29')](_0x9aacc5,function(_0x576519){if(_0x576519[_0x1360('0x2d')]!==_0x1360('0x3c')){var _0x1bff33={};_0x1bff33[_0x576519[_0x1360('0x26')]]={'$like':'%'+_0x1ea32c[_0x1360('0x30')][_0x1360('0x3a')]+'%'};return _0x1bff33;}})});}_0x4515fd=_['merge']({},_0x4515fd,_0x1ea32c[_0x1360('0x3d')]);var _0xc39ae8={'where':_0x4515fd[_0x1360('0x38')]};return db[_0x1360('0x2a')][_0x1360('0x1d')](_0xc39ae8)['then'](function(_0x350a5f){_0x358169['count']=_0x350a5f;if(_0x1ea32c[_0x1360('0x30')][_0x1360('0x3e')]){_0x4515fd[_0x1360('0x3f')]=[{'all':!![]}];}return db[_0x1360('0x2a')][_0x1360('0x40')](_0x4515fd);})[_0x1360('0x22')](function(_0x15bee5){_0x358169[_0x1360('0x41')]=_0x15bee5;return _0x358169;})[_0x1360('0x22')](respondWithFilteredResult(_0xe0031f,_0x4515fd))['catch'](handleError(_0xe0031f,null));};exports[_0x1360('0x42')]=function(_0x3ee4fe,_0x18d1c1){var _0x2a73f2={'raw':!![],'where':{'id':_0x3ee4fe['params']['id']}},_0x22f8ad={};_0x22f8ad[_0x1360('0x2f')]=_[_0x1360('0x31')](db[_0x1360('0x2a')]['rawAttributes']);_0x22f8ad['query']=_[_0x1360('0x31')](_0x3ee4fe[_0x1360('0x30')]);_0x22f8ad['filters']=_['intersection'](_0x22f8ad[_0x1360('0x2f')],_0x22f8ad[_0x1360('0x30')]);_0x2a73f2[_0x1360('0x33')]=_[_0x1360('0x32')](_0x22f8ad[_0x1360('0x2f')],qs[_0x1360('0x34')](_0x3ee4fe[_0x1360('0x30')]['fields']));_0x2a73f2[_0x1360('0x33')]=_0x2a73f2['attributes'][_0x1360('0x43')]?_0x2a73f2[_0x1360('0x33')]:_0x22f8ad['model'];if(_0x3ee4fe[_0x1360('0x30')][_0x1360('0x3e')]){_0x2a73f2[_0x1360('0x3f')]=[{'all':!![]}];}_0x2a73f2=_[_0x1360('0x3b')]({},_0x2a73f2,_0x3ee4fe['options']);return db['CmHopperFinal']['find'](_0x2a73f2)[_0x1360('0x22')](handleEntityNotFound(_0x18d1c1,null))['then'](respondWithResult(_0x18d1c1,null))[_0x1360('0x44')](handleError(_0x18d1c1,null));};exports[_0x1360('0x45')]=function(_0x10c4f7,_0x1070f5){return db[_0x1360('0x2a')][_0x1360('0x45')]()['then'](respondWithResult(_0x1070f5,null))[_0x1360('0x44')](handleError(_0x1070f5,null));};exports[_0x1360('0x21')]=function(_0x377ede,_0x22feb2){if(_0x377ede[_0x1360('0x46')][_0x1360('0x47')]){delete _0x377ede[_0x1360('0x46')][_0x1360('0x47')];}return db[_0x1360('0x2a')]['find']({'where':{'uniqueid':_0x377ede[_0x1360('0x48')]['id']}})['then'](handleEntityNotFound(_0x22feb2,null))[_0x1360('0x22')](saveUpdates(_0x377ede['body'],null))[_0x1360('0x22')](respondWithResult(_0x22feb2,null))['catch'](handleError(_0x22feb2,null));};exports[_0x1360('0x49')]=function(_0x306d9b,_0x3ebca6,_0x19b2a8){return db[_0x1360('0x2a')][_0x1360('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x306d9b[_0x1360('0x48')]['id']},'attributes':[[db[_0x1360('0x4a')]['fn'](_0x1360('0x4b'),db[_0x1360('0x4a')]['fn']('IF',db[_0x1360('0x4a')][_0x1360('0x4c')](_0x1360('0x4d')))),_0x1360('0x4e')],[db[_0x1360('0x4a')]['fn'](_0x1360('0x4b'),db['sequelize']['fn']('IF',db[_0x1360('0x4a')][_0x1360('0x4c')](_0x1360('0x4f')))),'noAnswerContacts'],[db[_0x1360('0x4a')]['fn'](_0x1360('0x4b'),db['sequelize']['fn']('IF',db[_0x1360('0x4a')][_0x1360('0x4c')](_0x1360('0x50')))),_0x1360('0x51')],[db['sequelize']['fn']('COUNT',db[_0x1360('0x4a')]['fn']('IF',db[_0x1360('0x4a')][_0x1360('0x4c')](_0x1360('0x52')))),_0x1360('0x53')],[db[_0x1360('0x4a')]['fn']('COUNT',db[_0x1360('0x4a')]['fn']('IF',db[_0x1360('0x4a')][_0x1360('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x1360('0x54')],[db['sequelize']['fn'](_0x1360('0x4b'),db[_0x1360('0x4a')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x1360('0x55')],[db[_0x1360('0x4a')]['fn'](_0x1360('0x4b'),db['sequelize']['fn']('IF',db[_0x1360('0x4a')][_0x1360('0x4c')](_0x1360('0x56')))),'reCallContacts'],[db[_0x1360('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1360('0x4a')][_0x1360('0x4c')](_0x1360('0x57')))),_0x1360('0x58')]]})['then'](handleEntityNotFound(_0x3ebca6,null))[_0x1360('0x22')](respondWithResult(_0x3ebca6,null))['catch'](handleError(_0x3ebca6,null));};exports[_0x1360('0x59')]=function(_0x5c9cca,_0x1616bb,_0x13a5a9){return db[_0x1360('0x2a')][_0x1360('0x40')]({'raw':![],'where':{'CampaignId':_0x5c9cca[_0x1360('0x48')]['id']},'attributes':[[db[_0x1360('0x4a')]['fn'](_0x1360('0x4b'),db[_0x1360('0x4a')]['fn']('IF',db['sequelize'][_0x1360('0x4c')](_0x1360('0x4d')))),_0x1360('0x4e')],[db['sequelize']['fn']('COUNT',db[_0x1360('0x4a')]['fn']('IF',db['sequelize'][_0x1360('0x4c')](_0x1360('0x4f')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x1360('0x4b'),db[_0x1360('0x4a')]['fn']('IF',db[_0x1360('0x4a')][_0x1360('0x4c')](_0x1360('0x50')))),'busyContacts'],[db['sequelize']['fn'](_0x1360('0x4b'),db[_0x1360('0x4a')]['fn']('IF',db[_0x1360('0x4a')]['literal'](_0x1360('0x52')))),'congestionContacts'],[db[_0x1360('0x4a')]['fn'](_0x1360('0x4b'),db[_0x1360('0x4a')]['fn']('IF',db['sequelize'][_0x1360('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x1360('0x54')],[db['sequelize']['fn'](_0x1360('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0x1360('0x4c')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x1360('0x55')],[db[_0x1360('0x4a')]['fn']('COUNT',db[_0x1360('0x4a')]['fn']('IF',db[_0x1360('0x4a')]['literal'](_0x1360('0x56')))),_0x1360('0x5a')],[db[_0x1360('0x4a')]['fn'](_0x1360('0x4b'),db['sequelize']['fn']('IF',db[_0x1360('0x4a')][_0x1360('0x4c')](_0x1360('0x57')))),_0x1360('0x58')]]})[_0x1360('0x22')](handleEntityNotFound(_0x1616bb,null))['then'](respondWithResult(_0x1616bb,null))[_0x1360('0x44')](handleError(_0x1616bb,null));};exports[_0x1360('0x5b')]=function(_0x4147c1,_0x1cb452,_0x4f63b5){return db['VoiceQueue'][_0x1360('0x5c')]({'where':{'id':_0x4147c1[_0x1360('0x48')]['id']}})[_0x1360('0x22')](handleEntityNotFound(_0x1cb452,null))['then'](function(_0x35b18c){var _0x90e78d;if(_0x35b18c){_0x90e78d=squel[_0x1360('0x5d')]()[_0x1360('0x5e')]('cm_hopper')['fromQuery']([_0x1360('0x5f'),_0x1360('0x60'),_0x1360('0x61'),_0x1360('0x62'),_0x1360('0x63'),'createdAt','updatedAt'],squel[_0x1360('0x64')]()[_0x1360('0x65')](_0x1360('0x66'),'phone')[_0x1360('0x65')](_0x1360('0x67'),'scheduledAt')[_0x1360('0x65')]('ANY_VALUE(ContactId)',_0x1360('0x61'))[_0x1360('0x65')](_0x1360('0x68'),'ListId')[_0x1360('0x65')](_0x1360('0x69'),_0x1360('0x63'))[_0x1360('0x65')](_0x1360('0x67'),_0x1360('0x6a'))[_0x1360('0x65')](_0x1360('0x67'),_0x1360('0x6b'))['from']('cm_hopper_final')[_0x1360('0x38')](_0x1360('0x6c'),_0x4147c1[_0x1360('0x48')]['id']['toString']())[_0x1360('0x38')](_0x1360('0x6d'),_0x4147c1[_0x1360('0x46')]['state'][_0x1360('0x6e')]())['where'](_0x1360('0x6f'))[_0x1360('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x1360('0x5f'))[_0x1360('0x70')](_0x1360('0x71'))[_0x1360('0x38')]('VoiceQueueId\x20=\x20?',_0x4147c1[_0x1360('0x48')]['id']['toString']()))['where'](_0x1360('0x72'),squel[_0x1360('0x64')]()[_0x1360('0x65')]('calleridnum')[_0x1360('0x70')](_0x1360('0x73'))[_0x1360('0x38')]('VoiceQueueId\x20=\x20?',_0x4147c1[_0x1360('0x48')]['id'][_0x1360('0x6e')]())[_0x1360('0x38')](_0x1360('0x74')))['group']('ContactId'))[_0x1360('0x6e')]();return db['sequelize'][_0x1360('0x30')](_0x90e78d);}return[];})[_0x1360('0x22')](respondWithResult(_0x1cb452,null))[_0x1360('0x44')](handleError(_0x1cb452,null));};exports[_0x1360('0x75')]=function(_0x2dd5e1,_0x41a726,_0x28c748){return db[_0x1360('0x76')]['find']({'where':{'id':_0x2dd5e1[_0x1360('0x48')]['id']}})[_0x1360('0x22')](handleEntityNotFound(_0x41a726,null))[_0x1360('0x22')](function(_0x45dece){var _0xcab1b0;if(_0x45dece){_0xcab1b0=squel[_0x1360('0x5d')]()['into']('cm_hopper')[_0x1360('0x77')]([_0x1360('0x5f'),_0x1360('0x60'),_0x1360('0x61'),'ListId',_0x1360('0x78'),'createdAt',_0x1360('0x6b')],squel[_0x1360('0x64')]()[_0x1360('0x65')](_0x1360('0x66'),_0x1360('0x5f'))['field']('NOW()','scheduledAt')[_0x1360('0x65')](_0x1360('0x79'),'ContactId')[_0x1360('0x65')]('ANY_VALUE(ListId)',_0x1360('0x62'))[_0x1360('0x65')](_0x1360('0x7a'),_0x1360('0x78'))[_0x1360('0x65')]('NOW()',_0x1360('0x6a'))['field'](_0x1360('0x67'),_0x1360('0x6b'))['from'](_0x1360('0x73'))['where'](_0x1360('0x7b'),_0x2dd5e1[_0x1360('0x48')]['id']['toString']())[_0x1360('0x38')](_0x1360('0x6d'),_0x2dd5e1[_0x1360('0x46')][_0x1360('0x7c')][_0x1360('0x6e')]())[_0x1360('0x38')](_0x1360('0x6f'))[_0x1360('0x38')](_0x1360('0x72'),squel['select']()[_0x1360('0x65')](_0x1360('0x5f'))[_0x1360('0x70')]('cm_hopper')[_0x1360('0x38')]('CampaignId\x20=\x20?',_0x2dd5e1[_0x1360('0x48')]['id'][_0x1360('0x6e')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1360('0x64')]()[_0x1360('0x65')](_0x1360('0x7d'))[_0x1360('0x70')]('cm_hopper_final')[_0x1360('0x38')](_0x1360('0x7b'),_0x2dd5e1['params']['id'][_0x1360('0x6e')]())[_0x1360('0x38')](_0x1360('0x74')))[_0x1360('0x7e')]('ContactId'))['toString']();return db[_0x1360('0x4a')][_0x1360('0x30')](_0xcab1b0);}return[];})[_0x1360('0x22')](respondWithResult(_0x41a726,null))['catch'](handleError(_0x41a726,null));};exports[_0x1360('0x7f')]=function(_0x4ca130,_0x53b700,_0x56b62a){return db[_0x1360('0x80')][_0x1360('0x81')]({'where':{'VoiceQueueId':_0x4ca130[_0x1360('0x46')]['VoiceQueueId'],'CampaignId':_0x4ca130[_0x1360('0x46')][_0x1360('0x78')],'ContactId':_0x4ca130['body']['ContactId']}})[_0x1360('0x22')](handleEntityNotFound(_0x53b700,null))[_0x1360('0x22')](function(_0x251eb5){if(_0x251eb5){return _0x251eb5;}return null;})[_0x1360('0x22')](respondWithResult(_0x53b700,null))[_0x1360('0x44')](handleError(_0x53b700,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 726374f..eb193ef 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 _0xe38a=['api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger'];(function(_0x56a871,_0x18b7fe){var _0x124954=function(_0x39b7a1){while(--_0x39b7a1){_0x56a871['push'](_0x56a871['shift']());}};_0x124954(++_0x18b7fe);}(_0xe38a,0x7b));var _0xae38=function(_0x2c2b30,_0x48ed61){_0x2c2b30=_0x2c2b30-0x0;var _0x3b386a=_0xe38a[_0x2c2b30];return _0x3b386a;};'use strict';var _=require(_0xae38('0x0'));var util=require(_0xae38('0x1'));var logger=require(_0xae38('0x2'))(_0xae38('0x3'));var moment=require(_0xae38('0x4'));var BPromise=require('bluebird');var rp=require(_0xae38('0x5'));var fs=require('fs');var path=require(_0xae38('0x6'));var rimraf=require(_0xae38('0x7'));var config=require(_0xae38('0x8'));var attributes=require(_0xae38('0x9'));module['exports']=function(_0x4d73bb,_0x2b9135){return _0x4d73bb['define'](_0xae38('0xa'),attributes,{'tableName':_0xae38('0xb'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xae38('0xc')]},{'name':'uniqueid','fields':[_0xae38('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x595f=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./cmHopperFinal.attributes','exports'];(function(_0x46dedf,_0xa59cac){var _0x3851dc=function(_0x3bd161){while(--_0x3bd161){_0x46dedf['push'](_0x46dedf['shift']());}};_0x3851dc(++_0xa59cac);}(_0x595f,0x197));var _0xf595=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x595f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf595('0x0'));var util=require(_0xf595('0x1'));var logger=require(_0xf595('0x2'))(_0xf595('0x3'));var moment=require(_0xf595('0x4'));var BPromise=require(_0xf595('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf595('0x6'));var config=require('../../config/environment');var attributes=require(_0xf595('0x7'));module[_0xf595('0x8')]=function(_0x166f88,_0x169d11){return _0x166f88['define'](_0xf595('0x9'),attributes,{'tableName':_0xf595('0xa'),'paranoid':![],'indexes':[{'name':_0xf595('0xb'),'fields':[_0xf595('0xb')]},{'name':_0xf595('0xc'),'fields':[_0xf595('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 35d054b..4c1ff86 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 _0xa94e=['jayson/promise','client','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','create','body','options','raw','then','CreateCmHopperFinal','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4a6b8f,_0x3c8317){var _0xfb850f=function(_0x3f5872){while(--_0x3f5872){_0x4a6b8f['push'](_0x4a6b8f['shift']());}};_0xfb850f(++_0x3c8317);}(_0xa94e,0x13b));var _0xea94=function(_0x4e9499,_0x5206cc){_0x4e9499=_0x4e9499-0x0;var _0x14440d=_0xa94e[_0x4e9499];return _0x14440d;};'use strict';var _=require(_0xea94('0x0'));var util=require(_0xea94('0x1'));var moment=require(_0xea94('0x2'));var BPromise=require(_0xea94('0x3'));var rs=require(_0xea94('0x4'));var fs=require('fs');var Redis=require(_0xea94('0x5'));var db=require(_0xea94('0x6'))['db'];var utils=require(_0xea94('0x7'));var logger=require(_0xea94('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xea94('0x9'));var client=jayson[_0xea94('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ef1e2,_0x4e36d6,_0x713377){return new BPromise(function(_0x5f04e7,_0x403945){return client['request'](_0x3ef1e2,_0x713377)['then'](function(_0x2c66c9){logger['info'](_0xea94('0xb'),_0x4e36d6,_0xea94('0xc'));logger[_0xea94('0xd')](_0xea94('0xe'),_0x4e36d6,_0xea94('0xc'),JSON[_0xea94('0xf')](_0x2c66c9));if(_0x2c66c9[_0xea94('0x10')]){if(_0x2c66c9[_0xea94('0x10')][_0xea94('0x11')]===0x1f4){logger[_0xea94('0x10')](_0xea94('0xb'),_0x4e36d6,_0x2c66c9[_0xea94('0x10')]['message']);return _0x403945(_0x2c66c9[_0xea94('0x10')]['message']);}logger[_0xea94('0x10')](_0xea94('0xb'),_0x4e36d6,_0x2c66c9['error']['message']);return _0x5f04e7(_0x2c66c9[_0xea94('0x10')][_0xea94('0x12')]);}else{logger[_0xea94('0x13')]('CmHopperFinal,\x20%s,\x20%s',_0x4e36d6,_0xea94('0xc'));_0x5f04e7(_0x2c66c9['result'][_0xea94('0x12')]);}})['catch'](function(_0x1b6491){logger[_0xea94('0x10')](_0xea94('0xb'),_0x4e36d6,_0x1b6491);_0x403945(_0x1b6491);});});}exports['CreateCmHopperFinal']=function(_0x1e5317){var _0x3b7cf9=this;return new Promise(function(_0x29c014,_0x40135c){return db['CmHopperFinal'][_0xea94('0x14')](_0x1e5317[_0xea94('0x15')],{'raw':_0x1e5317[_0xea94('0x16')]?_0x1e5317['options'][_0xea94('0x17')]===undefined?!![]:![]:!![]})[_0xea94('0x18')](function(_0x1b6ffa){logger[_0xea94('0x13')](_0xea94('0x19'),_0x1e5317);logger[_0xea94('0xd')](_0xea94('0x19'),_0x1e5317,JSON[_0xea94('0xf')](_0x1b6ffa));_0x29c014(_0x1b6ffa);})[_0xea94('0x1a')](function(_0x31ecc3){logger[_0xea94('0x10')](_0xea94('0x19'),_0x31ecc3[_0xea94('0x12')],_0x1e5317);_0x40135c(_0x3b7cf9['error'](0x1f4,_0x31ecc3[_0xea94('0x12')]));});});}; \ No newline at end of file +var _0xe59f=['request\x20sent','stringify','error','message','result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','debug','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s'];(function(_0x5f5d60,_0x3a3eaf){var _0x4abc85=function(_0x2df878){while(--_0x2df878){_0x5f5d60['push'](_0x5f5d60['shift']());}};_0x4abc85(++_0x3a3eaf);}(_0xe59f,0x15e));var _0xfe59=function(_0x1d7fb5,_0x2ee2d3){_0x1d7fb5=_0x1d7fb5-0x0;var _0x5ba978=_0xe59f[_0x1d7fb5];return _0x5ba978;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfe59('0x0'));var BPromise=require('bluebird');var rs=require(_0xfe59('0x1'));var fs=require('fs');var Redis=require(_0xfe59('0x2'));var db=require(_0xfe59('0x3'))['db'];var utils=require(_0xfe59('0x4'));var logger=require(_0xfe59('0x5'))('rpc');var config=require(_0xfe59('0x6'));var jayson=require(_0xfe59('0x7'));var client=jayson[_0xfe59('0x8')][_0xfe59('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52b125,_0x2a8f25,_0x3f9335){return new BPromise(function(_0x312ff9,_0x35e1ed){return client[_0xfe59('0xa')](_0x52b125,_0x3f9335)[_0xfe59('0xb')](function(_0x2e28cf){logger[_0xfe59('0xc')](_0xfe59('0xd'),_0x2a8f25,_0xfe59('0xe'));logger['debug']('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x2a8f25,_0xfe59('0xe'),JSON[_0xfe59('0xf')](_0x2e28cf));if(_0x2e28cf['error']){if(_0x2e28cf[_0xfe59('0x10')]['code']===0x1f4){logger[_0xfe59('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x2a8f25,_0x2e28cf[_0xfe59('0x10')][_0xfe59('0x11')]);return _0x35e1ed(_0x2e28cf['error'][_0xfe59('0x11')]);}logger[_0xfe59('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x2a8f25,_0x2e28cf[_0xfe59('0x10')]['message']);return _0x312ff9(_0x2e28cf[_0xfe59('0x10')][_0xfe59('0x11')]);}else{logger[_0xfe59('0xc')]('CmHopperFinal,\x20%s,\x20%s',_0x2a8f25,_0xfe59('0xe'));_0x312ff9(_0x2e28cf[_0xfe59('0x12')][_0xfe59('0x11')]);}})[_0xfe59('0x13')](function(_0x2d5c6b){logger[_0xfe59('0x10')](_0xfe59('0xd'),_0x2a8f25,_0x2d5c6b);_0x35e1ed(_0x2d5c6b);});});}exports[_0xfe59('0x14')]=function(_0x213918){var _0x26ba40=this;return new Promise(function(_0x2d2a63,_0xa5140f){return db[_0xfe59('0x15')][_0xfe59('0x16')](_0x213918[_0xfe59('0x17')],{'raw':_0x213918[_0xfe59('0x18')]?_0x213918[_0xfe59('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xfe59('0xb')](function(_0x30c953){logger[_0xfe59('0xc')]('CreateCmHopperFinal',_0x213918);logger[_0xfe59('0x19')](_0xfe59('0x14'),_0x213918,JSON[_0xfe59('0xf')](_0x30c953));_0x2d2a63(_0x30c953);})[_0xfe59('0x13')](function(_0x412474){logger[_0xfe59('0x10')]('CreateCmHopperFinal',_0x412474[_0xfe59('0x11')],_0x213918);_0xa5140f(_0x26ba40['error'](0x1f4,_0x412474[_0xfe59('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index e3f9753..4089484 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 _0xcfe5=['/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id'];(function(_0x4c0873,_0x210c56){var _0x2cbaa4=function(_0x252cc3){while(--_0x252cc3){_0x4c0873['push'](_0x4c0873['shift']());}};_0x2cbaa4(++_0x210c56);}(_0xcfe5,0x1f2));var _0x5cfe=function(_0x5b9029,_0x2f77f5){_0x5b9029=_0x5b9029-0x0;var _0x518754=_0xcfe5[_0x5b9029];return _0x518754;};'use strict';var multer=require('multer');var util=require(_0x5cfe('0x0'));var path=require(_0x5cfe('0x1'));var timeout=require(_0x5cfe('0x2'));var express=require('express');var router=express[_0x5cfe('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5cfe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5cfe('0x5'));var controller=require(_0x5cfe('0x6'));router[_0x5cfe('0x7')]('/',auth[_0x5cfe('0x8')](),controller[_0x5cfe('0x9')]);router[_0x5cfe('0x7')](_0x5cfe('0xa'),auth[_0x5cfe('0x8')](),controller[_0x5cfe('0xb')]);router['get'](_0x5cfe('0xc'),auth[_0x5cfe('0x8')](),controller[_0x5cfe('0xd')]);router[_0x5cfe('0x7')](_0x5cfe('0xe'),auth[_0x5cfe('0x8')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x5cfe('0x7')](_0x5cfe('0xf'),auth[_0x5cfe('0x8')](),controller[_0x5cfe('0x10')]);router[_0x5cfe('0x11')](_0x5cfe('0x12'),auth['isAuthenticated'](),controller[_0x5cfe('0x13')]);router['post'](_0x5cfe('0x14'),auth[_0x5cfe('0x8')](),controller[_0x5cfe('0x15')]);router[_0x5cfe('0x11')](_0x5cfe('0x16'),auth[_0x5cfe('0x8')](),controller[_0x5cfe('0x17')]);router[_0x5cfe('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x5cfe('0x19')]);module[_0x5cfe('0x1a')]=router; \ No newline at end of file +var _0x4ea0=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util'];(function(_0x573423,_0x179191){var _0x224f01=function(_0x1ece6e){while(--_0x1ece6e){_0x573423['push'](_0x573423['shift']());}};_0x224f01(++_0x179191);}(_0x4ea0,0xf1));var _0x04ea=function(_0x594e11,_0x28f652){_0x594e11=_0x594e11-0x0;var _0x5418ad=_0x4ea0[_0x594e11];return _0x5418ad;};'use strict';var multer=require(_0x04ea('0x0'));var util=require(_0x04ea('0x1'));var path=require('path');var timeout=require(_0x04ea('0x2'));var express=require('express');var router=express[_0x04ea('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x04ea('0x4'));var interaction=require(_0x04ea('0x5'));var config=require(_0x04ea('0x6'));var controller=require(_0x04ea('0x7'));router[_0x04ea('0x8')]('/',auth[_0x04ea('0x9')](),controller[_0x04ea('0xa')]);router[_0x04ea('0x8')](_0x04ea('0xb'),auth[_0x04ea('0x9')](),controller[_0x04ea('0xc')]);router[_0x04ea('0x8')](_0x04ea('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x04ea('0xe'),auth['isAuthenticated'](),controller[_0x04ea('0xf')]);router['get'](_0x04ea('0x10'),auth[_0x04ea('0x9')](),controller[_0x04ea('0x11')]);router[_0x04ea('0x12')]('/voice/queue/moveContacts/:id',auth[_0x04ea('0x9')](),controller[_0x04ea('0x13')]);router['post'](_0x04ea('0x14'),auth[_0x04ea('0x9')](),controller[_0x04ea('0x15')]);router['post'](_0x04ea('0x16'),auth[_0x04ea('0x9')](),controller[_0x04ea('0x17')]);router[_0x04ea('0x18')]('/:id',auth[_0x04ea('0x9')](),controller[_0x04ea('0x19')]);module[_0x04ea('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index d7fbde9..8f94df4 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 _0xff44=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x21f7d4,_0x3fb9df){var _0x143fa7=function(_0x4ace03){while(--_0x4ace03){_0x21f7d4['push'](_0x21f7d4['shift']());}};_0x143fa7(++_0x3fb9df);}(_0xff44,0x1b7));var _0x4ff4=function(_0x11b3f4,_0x371c17){_0x11b3f4=_0x11b3f4-0x0;var _0x47af1d=_0xff44[_0x11b3f4];return _0x47af1d;};'use strict';var Sequelize=require(_0x4ff4('0x0'));module[_0x4ff4('0x1')]={'state':{'type':Sequelize[_0x4ff4('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x4ff4('0x3')]},'scheduledat':{'type':Sequelize[_0x4ff4('0x4')]},'countbusyretry':{'type':Sequelize[_0x4ff4('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4ff4('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4ff4('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x4ff4('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x4ff4('0x3')]},'originatecalleridname':{'type':Sequelize[_0x4ff4('0x3')]},'calleridnum':{'type':Sequelize[_0x4ff4('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x4ff4('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x4ff4('0x4')]},'endtime':{'type':Sequelize[_0x4ff4('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4ff4('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4ff4('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4ff4('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4ff4('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x4ff4('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x4ff4('0x3')]},'amd':{'type':Sequelize[_0x4ff4('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x4ff4('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4ff4('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4ff4('0x4')]},'recallme':{'type':Sequelize[_0x4ff4('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x4ff4('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x4ff4('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4ff4('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4ff4('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4ff4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9bfc=['INTEGER','STRING','DATE','BOOLEAN','exports'];(function(_0x1311d5,_0x4b4113){var _0x294c60=function(_0x311472){while(--_0x311472){_0x1311d5['push'](_0x1311d5['shift']());}};_0x294c60(++_0x4b4113);}(_0x9bfc,0x1da));var _0xc9bf=function(_0x528ffb,_0x2df4e0){_0x528ffb=_0x528ffb-0x0;var _0x41895=_0x9bfc[_0x528ffb];return _0x41895;};'use strict';var Sequelize=require('sequelize');module[_0xc9bf('0x0')]={'state':{'type':Sequelize[_0xc9bf('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xc9bf('0x2')]},'scheduledat':{'type':Sequelize[_0xc9bf('0x3')]},'countbusyretry':{'type':Sequelize[_0xc9bf('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc9bf('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc9bf('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xc9bf('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xc9bf('0x2')]},'calleridnum':{'type':Sequelize[_0xc9bf('0x2')]},'calleridname':{'type':Sequelize[_0xc9bf('0x2')]},'starttime':{'type':Sequelize[_0xc9bf('0x3')]},'responsetime':{'type':Sequelize[_0xc9bf('0x3')]},'answertime':{'type':Sequelize[_0xc9bf('0x3')]},'droptime':{'type':Sequelize[_0xc9bf('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xc9bf('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xc9bf('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xc9bf('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc9bf('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xc9bf('0x2')]},'campaign':{'type':Sequelize[_0xc9bf('0x2')]},'campaigntype':{'type':Sequelize[_0xc9bf('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xc9bf('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xc9bf('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xc9bf('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xc9bf('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xc9bf('0x3')]},'edited':{'type':Sequelize[_0xc9bf('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xc9bf('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc9bf('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc9bf('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc9bf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index cce9715..5fdd8c9 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 _0x1866=['describe','update','uniqueid','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','then','destroy','stack','name','index','CmHopperHistory','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','find','create','body','catch'];(function(_0x35387d,_0x1ba72f){var _0x3aba56=function(_0x42cd08){while(--_0x42cd08){_0x35387d['push'](_0x35387d['shift']());}};_0x3aba56(++_0x1ba72f);}(_0x1866,0x9a));var _0x6186=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x1866[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require(_0x6186('0x0'));var rimraf=require(_0x6186('0x1'));var zipdir=require(_0x6186('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6186('0x3'));var moment=require(_0x6186('0x4'));var BPromise=require(_0x6186('0x5'));var Mustache=require(_0x6186('0x6'));var util=require(_0x6186('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6186('0x8'));var ejs=require(_0x6186('0x9'));var fs=require('fs');var fs_extra=require(_0x6186('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6186('0xb'));var jsforce=require(_0x6186('0xc'));var deskjs=require(_0x6186('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6186('0xe'));var Papa=require(_0x6186('0xf'));var Redis=require(_0x6186('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6186('0x11'));var as=require(_0x6186('0x12'));var hardwareService=require(_0x6186('0x13'));var logger=require('../../config/logger')(_0x6186('0x14'));var utils=require(_0x6186('0x15'));var config=require(_0x6186('0x16'));var licenseUtil=require(_0x6186('0x17'));var db=require(_0x6186('0x18'))['db'];function respondWithStatusCode(_0x27402b,_0x3c2534){_0x3c2534=_0x3c2534||0xcc;return function(_0xa106d3){if(_0xa106d3){return _0x27402b[_0x6186('0x19')](_0x3c2534);}return _0x27402b[_0x6186('0x1a')](_0x3c2534)[_0x6186('0x1b')]();};}function respondWithResult(_0x200473,_0x33c121){_0x33c121=_0x33c121||0xc8;return function(_0x451b28){if(_0x451b28){return _0x200473[_0x6186('0x1a')](_0x33c121)[_0x6186('0x1c')](_0x451b28);}};}function respondWithFilteredResult(_0x1d39a9,_0x453076){return function(_0xc905d8){if(_0xc905d8){var _0x567e2d=typeof _0x453076[_0x6186('0x1d')]==='undefined'&&typeof _0x453076[_0x6186('0x1e')]==='undefined';var _0xdf0f69=_0xc905d8['count'];var _0x1c7da4=_0x567e2d?0x0:_0x453076[_0x6186('0x1d')];var _0x38dcee=_0x567e2d?_0xc905d8[_0x6186('0x1f')]:_0x453076[_0x6186('0x1d')]+_0x453076[_0x6186('0x1e')];var _0x4767e3;if(_0x38dcee>=_0xdf0f69){_0x38dcee=_0xdf0f69;_0x4767e3=0xc8;}else{_0x4767e3=0xce;}_0x1d39a9['status'](_0x4767e3);return _0x1d39a9[_0x6186('0x20')]('Content-Range',_0x1c7da4+'-'+_0x38dcee+'/'+_0xdf0f69)[_0x6186('0x1c')](_0xc905d8);}return null;};}function patchUpdates(_0x4d157e){return function(_0x3453ca){try{jsonpatch[_0x6186('0x21')](_0x3453ca,_0x4d157e,!![]);}catch(_0x57b6b8){return BPromise[_0x6186('0x22')](_0x57b6b8);}return _0x3453ca['save']();};}function saveUpdates(_0x308e3b,_0x37b292){return function(_0x186429){if(_0x186429){return _0x186429['update'](_0x308e3b)[_0x6186('0x23')](function(_0x2b1a11){return _0x2b1a11;});}return null;};}function removeEntity(_0x4b736f,_0x3fbf84){return function(_0xe2f7c1){if(_0xe2f7c1){return _0xe2f7c1[_0x6186('0x24')]()[_0x6186('0x23')](function(){_0x4b736f['status'](0xcc)[_0x6186('0x1b')]();});}};}function handleEntityNotFound(_0x1eec29,_0x3ead0e){return function(_0x56d870){if(!_0x56d870){_0x1eec29[_0x6186('0x19')](0x194);}return _0x56d870;};}function handleError(_0x518012,_0x5d7491){_0x5d7491=_0x5d7491||0x1f4;return function(_0x3c7b87){logger['error'](_0x3c7b87[_0x6186('0x25')]);if(_0x3c7b87[_0x6186('0x26')]){delete _0x3c7b87[_0x6186('0x26')];}_0x518012['status'](_0x5d7491)['send'](_0x3c7b87);};}exports[_0x6186('0x27')]=function(_0x54aea5,_0x55a341){var _0x22a016={},_0x108f6a={},_0x3c727a={'count':0x0,'rows':[]};var _0x2095f9=_['map'](db[_0x6186('0x28')][_0x6186('0x29')],function(_0x2c0422){return{'name':_0x2c0422['fieldName'],'type':_0x2c0422[_0x6186('0x2a')][_0x6186('0x2b')]};});_0x108f6a[_0x6186('0x2c')]=_[_0x6186('0x2d')](_0x2095f9,_0x6186('0x26'));_0x108f6a[_0x6186('0x2e')]=_[_0x6186('0x2f')](_0x54aea5['query']);_0x108f6a[_0x6186('0x30')]=_[_0x6186('0x31')](_0x108f6a[_0x6186('0x2c')],_0x108f6a[_0x6186('0x2e')]);_0x22a016[_0x6186('0x32')]=_[_0x6186('0x31')](_0x108f6a[_0x6186('0x2c')],qs[_0x6186('0x33')](_0x54aea5[_0x6186('0x2e')]['fields']));_0x22a016['attributes']=_0x22a016['attributes'][_0x6186('0x34')]?_0x22a016[_0x6186('0x32')]:_0x108f6a['model'];if(!_0x54aea5['query'][_0x6186('0x35')](_0x6186('0x36'))){_0x22a016['limit']=qs[_0x6186('0x1e')](_0x54aea5[_0x6186('0x2e')][_0x6186('0x1e')]);_0x22a016[_0x6186('0x1d')]=qs[_0x6186('0x1d')](_0x54aea5[_0x6186('0x2e')][_0x6186('0x1d')]);}_0x22a016[_0x6186('0x37')]=qs[_0x6186('0x38')](_0x54aea5['query'][_0x6186('0x38')]);_0x22a016['where']=qs[_0x6186('0x30')](_[_0x6186('0x39')](_0x54aea5['query'],_0x108f6a[_0x6186('0x30')]),_0x2095f9);if(_0x54aea5[_0x6186('0x2e')][_0x6186('0x3a')]){_0x22a016[_0x6186('0x3b')]=_[_0x6186('0x3c')](_0x22a016[_0x6186('0x3b')],{'$or':_[_0x6186('0x2d')](_0x2095f9,function(_0xa8556d){if(_0xa8556d[_0x6186('0x2a')]!=='VIRTUAL'){var _0x5ca2d7={};_0x5ca2d7[_0xa8556d[_0x6186('0x26')]]={'$like':'%'+_0x54aea5[_0x6186('0x2e')][_0x6186('0x3a')]+'%'};return _0x5ca2d7;}})});}_0x22a016=_[_0x6186('0x3c')]({},_0x22a016,_0x54aea5[_0x6186('0x3d')]);var _0x75be16={'where':_0x22a016[_0x6186('0x3b')]};return db[_0x6186('0x28')][_0x6186('0x1f')](_0x75be16)[_0x6186('0x23')](function(_0x387ae6){_0x3c727a[_0x6186('0x1f')]=_0x387ae6;if(_0x54aea5['query'][_0x6186('0x3e')]){_0x22a016[_0x6186('0x3f')]=[{'all':!![]}];}return db[_0x6186('0x28')][_0x6186('0x40')](_0x22a016);})['then'](function(_0x3e79c6){_0x3c727a[_0x6186('0x41')]=_0x3e79c6;return _0x3c727a;})[_0x6186('0x23')](respondWithFilteredResult(_0x55a341,_0x22a016))['catch'](handleError(_0x55a341,null));};exports[_0x6186('0x42')]=function(_0xd565ff,_0x260fb5){var _0x1cea06={'raw':!![],'where':{'id':_0xd565ff['params']['id']}},_0x1900a2={};_0x1900a2[_0x6186('0x2c')]=_[_0x6186('0x2f')](db['CmHopperHistory']['rawAttributes']);_0x1900a2['query']=_[_0x6186('0x2f')](_0xd565ff[_0x6186('0x2e')]);_0x1900a2['filters']=_['intersection'](_0x1900a2[_0x6186('0x2c')],_0x1900a2[_0x6186('0x2e')]);_0x1cea06['attributes']=_[_0x6186('0x31')](_0x1900a2[_0x6186('0x2c')],qs[_0x6186('0x33')](_0xd565ff['query']['fields']));_0x1cea06[_0x6186('0x32')]=_0x1cea06[_0x6186('0x32')]['length']?_0x1cea06['attributes']:_0x1900a2[_0x6186('0x2c')];if(_0xd565ff[_0x6186('0x2e')][_0x6186('0x3e')]){_0x1cea06[_0x6186('0x3f')]=[{'all':!![]}];}_0x1cea06=_[_0x6186('0x3c')]({},_0x1cea06,_0xd565ff[_0x6186('0x3d')]);return db[_0x6186('0x28')][_0x6186('0x43')](_0x1cea06)[_0x6186('0x23')](handleEntityNotFound(_0x260fb5,null))[_0x6186('0x23')](respondWithResult(_0x260fb5,null))['catch'](handleError(_0x260fb5,null));};exports[_0x6186('0x44')]=function(_0x474888,_0x6d92ad){return db['CmHopperHistory'][_0x6186('0x44')](_0x474888[_0x6186('0x45')],{})[_0x6186('0x23')](respondWithResult(_0x6d92ad,0xc9))[_0x6186('0x46')](handleError(_0x6d92ad,null));};exports[_0x6186('0x47')]=function(_0x47f2fe,_0x57625d){return db[_0x6186('0x28')][_0x6186('0x47')]()[_0x6186('0x23')](respondWithResult(_0x57625d,null))[_0x6186('0x46')](handleError(_0x57625d,null));};exports[_0x6186('0x48')]=function(_0x1c1c7d,_0x1f0eb5){if(_0x1c1c7d['body'][_0x6186('0x49')]){delete _0x1c1c7d[_0x6186('0x45')][_0x6186('0x49')];}return db[_0x6186('0x28')][_0x6186('0x43')]({'where':{'uniqueid':_0x1c1c7d[_0x6186('0x4a')]['id']}})[_0x6186('0x23')](handleEntityNotFound(_0x1f0eb5,null))[_0x6186('0x23')](saveUpdates(_0x1c1c7d['body'],null))['then'](respondWithResult(_0x1f0eb5,null))[_0x6186('0x46')](handleError(_0x1f0eb5,null));}; \ No newline at end of file +var _0xfbba=['name','send','map','CmHopperHistory','rawAttributes','fieldName','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','uniqueid','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack'];(function(_0x5e9f1d,_0x57de63){var _0xa64898=function(_0x38a442){while(--_0x38a442){_0x5e9f1d['push'](_0x5e9f1d['shift']());}};_0xa64898(++_0x57de63);}(_0xfbba,0x18f));var _0xafbb=function(_0x2972d2,_0x5594c8){_0x2972d2=_0x2972d2-0x0;var _0x322d93=_0xfbba[_0x2972d2];return _0x322d93;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xafbb('0x0'));var rp=require(_0xafbb('0x1'));var moment=require('moment');var BPromise=require(_0xafbb('0x2'));var Mustache=require(_0xafbb('0x3'));var util=require(_0xafbb('0x4'));var path=require(_0xafbb('0x5'));var sox=require(_0xafbb('0x6'));var csv=require(_0xafbb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xafbb('0x8'));var _=require(_0xafbb('0x9'));var squel=require('squel');var crypto=require(_0xafbb('0xa'));var jsforce=require(_0xafbb('0xb'));var deskjs=require(_0xafbb('0xc'));var toCsv=require(_0xafbb('0x7'));var querystring=require('querystring');var Papa=require(_0xafbb('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xafbb('0xe'));var as=require(_0xafbb('0xf'));var hardwareService=require(_0xafbb('0x10'));var logger=require(_0xafbb('0x11'))(_0xafbb('0x12'));var utils=require(_0xafbb('0x13'));var config=require(_0xafbb('0x14'));var licenseUtil=require(_0xafbb('0x15'));var db=require(_0xafbb('0x16'))['db'];function respondWithStatusCode(_0x4d60fe,_0x27a6b1){_0x27a6b1=_0x27a6b1||0xcc;return function(_0x637b36){if(_0x637b36){return _0x4d60fe[_0xafbb('0x17')](_0x27a6b1);}return _0x4d60fe['status'](_0x27a6b1)[_0xafbb('0x18')]();};}function respondWithResult(_0x43b77a,_0x42348c){_0x42348c=_0x42348c||0xc8;return function(_0x5b6778){if(_0x5b6778){return _0x43b77a[_0xafbb('0x19')](_0x42348c)['json'](_0x5b6778);}};}function respondWithFilteredResult(_0x12b334,_0x4f5b6c){return function(_0x234c89){if(_0x234c89){var _0x524c1b=typeof _0x4f5b6c[_0xafbb('0x1a')]==='undefined'&&typeof _0x4f5b6c[_0xafbb('0x1b')]==='undefined';var _0x48d385=_0x234c89[_0xafbb('0x1c')];var _0x2f9c11=_0x524c1b?0x0:_0x4f5b6c[_0xafbb('0x1a')];var _0x254387=_0x524c1b?_0x234c89[_0xafbb('0x1c')]:_0x4f5b6c['offset']+_0x4f5b6c[_0xafbb('0x1b')];var _0x5efe36;if(_0x254387>=_0x48d385){_0x254387=_0x48d385;_0x5efe36=0xc8;}else{_0x5efe36=0xce;}_0x12b334[_0xafbb('0x19')](_0x5efe36);return _0x12b334[_0xafbb('0x1d')](_0xafbb('0x1e'),_0x2f9c11+'-'+_0x254387+'/'+_0x48d385)[_0xafbb('0x1f')](_0x234c89);}return null;};}function patchUpdates(_0x172be3){return function(_0x3244e3){try{jsonpatch['apply'](_0x3244e3,_0x172be3,!![]);}catch(_0x529906){return BPromise[_0xafbb('0x20')](_0x529906);}return _0x3244e3[_0xafbb('0x21')]();};}function saveUpdates(_0x268a7d,_0x3a5a61){return function(_0x1f860d){if(_0x1f860d){return _0x1f860d[_0xafbb('0x22')](_0x268a7d)[_0xafbb('0x23')](function(_0x29d6af){return _0x29d6af;});}return null;};}function removeEntity(_0x232596,_0x1ba461){return function(_0x14f3a2){if(_0x14f3a2){return _0x14f3a2[_0xafbb('0x24')]()['then'](function(){_0x232596['status'](0xcc)[_0xafbb('0x18')]();});}};}function handleEntityNotFound(_0x3178dc,_0x311c5e){return function(_0x2c8d50){if(!_0x2c8d50){_0x3178dc[_0xafbb('0x17')](0x194);}return _0x2c8d50;};}function handleError(_0x4f0404,_0x1da945){_0x1da945=_0x1da945||0x1f4;return function(_0x2d94ba){logger[_0xafbb('0x25')](_0x2d94ba[_0xafbb('0x26')]);if(_0x2d94ba[_0xafbb('0x27')]){delete _0x2d94ba[_0xafbb('0x27')];}_0x4f0404[_0xafbb('0x19')](_0x1da945)[_0xafbb('0x28')](_0x2d94ba);};}exports['index']=function(_0x21ca61,_0x355365){var _0x1becf3={},_0x123038={},_0x59bb17={'count':0x0,'rows':[]};var _0x5100e2=_[_0xafbb('0x29')](db[_0xafbb('0x2a')][_0xafbb('0x2b')],function(_0xc34e50){return{'name':_0xc34e50[_0xafbb('0x2c')],'type':_0xc34e50[_0xafbb('0x2d')]['key']};});_0x123038['model']=_[_0xafbb('0x29')](_0x5100e2,_0xafbb('0x27'));_0x123038[_0xafbb('0x2e')]=_[_0xafbb('0x2f')](_0x21ca61[_0xafbb('0x2e')]);_0x123038['filters']=_[_0xafbb('0x30')](_0x123038['model'],_0x123038[_0xafbb('0x2e')]);_0x1becf3[_0xafbb('0x31')]=_[_0xafbb('0x30')](_0x123038[_0xafbb('0x32')],qs[_0xafbb('0x33')](_0x21ca61['query'][_0xafbb('0x33')]));_0x1becf3[_0xafbb('0x31')]=_0x1becf3[_0xafbb('0x31')][_0xafbb('0x34')]?_0x1becf3[_0xafbb('0x31')]:_0x123038['model'];if(!_0x21ca61[_0xafbb('0x2e')][_0xafbb('0x35')](_0xafbb('0x36'))){_0x1becf3[_0xafbb('0x1b')]=qs[_0xafbb('0x1b')](_0x21ca61['query'][_0xafbb('0x1b')]);_0x1becf3[_0xafbb('0x1a')]=qs['offset'](_0x21ca61[_0xafbb('0x2e')]['offset']);}_0x1becf3['order']=qs[_0xafbb('0x37')](_0x21ca61[_0xafbb('0x2e')]['sort']);_0x1becf3[_0xafbb('0x38')]=qs[_0xafbb('0x39')](_['pick'](_0x21ca61[_0xafbb('0x2e')],_0x123038[_0xafbb('0x39')]),_0x5100e2);if(_0x21ca61['query']['filter']){_0x1becf3[_0xafbb('0x38')]=_['merge'](_0x1becf3[_0xafbb('0x38')],{'$or':_[_0xafbb('0x29')](_0x5100e2,function(_0x523e85){if(_0x523e85[_0xafbb('0x2d')]!==_0xafbb('0x3a')){var _0x2dfce0={};_0x2dfce0[_0x523e85[_0xafbb('0x27')]]={'$like':'%'+_0x21ca61[_0xafbb('0x2e')]['filter']+'%'};return _0x2dfce0;}})});}_0x1becf3=_[_0xafbb('0x3b')]({},_0x1becf3,_0x21ca61[_0xafbb('0x3c')]);var _0x5f664a={'where':_0x1becf3[_0xafbb('0x38')]};return db[_0xafbb('0x2a')][_0xafbb('0x1c')](_0x5f664a)[_0xafbb('0x23')](function(_0x22d851){_0x59bb17[_0xafbb('0x1c')]=_0x22d851;if(_0x21ca61[_0xafbb('0x2e')][_0xafbb('0x3d')]){_0x1becf3['include']=[{'all':!![]}];}return db[_0xafbb('0x2a')][_0xafbb('0x3e')](_0x1becf3);})[_0xafbb('0x23')](function(_0x2f7bbb){_0x59bb17[_0xafbb('0x3f')]=_0x2f7bbb;return _0x59bb17;})[_0xafbb('0x23')](respondWithFilteredResult(_0x355365,_0x1becf3))[_0xafbb('0x40')](handleError(_0x355365,null));};exports[_0xafbb('0x41')]=function(_0x5128b5,_0x373f0b){var _0x40584c={'raw':!![],'where':{'id':_0x5128b5[_0xafbb('0x42')]['id']}},_0x4963a7={};_0x4963a7[_0xafbb('0x32')]=_[_0xafbb('0x2f')](db['CmHopperHistory'][_0xafbb('0x2b')]);_0x4963a7[_0xafbb('0x2e')]=_[_0xafbb('0x2f')](_0x5128b5[_0xafbb('0x2e')]);_0x4963a7[_0xafbb('0x39')]=_[_0xafbb('0x30')](_0x4963a7[_0xafbb('0x32')],_0x4963a7[_0xafbb('0x2e')]);_0x40584c[_0xafbb('0x31')]=_['intersection'](_0x4963a7[_0xafbb('0x32')],qs[_0xafbb('0x33')](_0x5128b5[_0xafbb('0x2e')][_0xafbb('0x33')]));_0x40584c['attributes']=_0x40584c['attributes'][_0xafbb('0x34')]?_0x40584c[_0xafbb('0x31')]:_0x4963a7['model'];if(_0x5128b5[_0xafbb('0x2e')]['includeAll']){_0x40584c[_0xafbb('0x43')]=[{'all':!![]}];}_0x40584c=_[_0xafbb('0x3b')]({},_0x40584c,_0x5128b5['options']);return db[_0xafbb('0x2a')][_0xafbb('0x44')](_0x40584c)[_0xafbb('0x23')](handleEntityNotFound(_0x373f0b,null))[_0xafbb('0x23')](respondWithResult(_0x373f0b,null))[_0xafbb('0x40')](handleError(_0x373f0b,null));};exports[_0xafbb('0x45')]=function(_0x30baa6,_0x576572){return db['CmHopperHistory'][_0xafbb('0x45')](_0x30baa6[_0xafbb('0x46')],{})['then'](respondWithResult(_0x576572,0xc9))['catch'](handleError(_0x576572,null));};exports[_0xafbb('0x47')]=function(_0x2d4c78,_0x3e2347){return db[_0xafbb('0x2a')][_0xafbb('0x47')]()[_0xafbb('0x23')](respondWithResult(_0x3e2347,null))['catch'](handleError(_0x3e2347,null));};exports[_0xafbb('0x22')]=function(_0x52f39b,_0x31623b){if(_0x52f39b[_0xafbb('0x46')][_0xafbb('0x48')]){delete _0x52f39b[_0xafbb('0x46')][_0xafbb('0x48')];}return db[_0xafbb('0x2a')][_0xafbb('0x44')]({'where':{'uniqueid':_0x52f39b[_0xafbb('0x42')]['id']}})[_0xafbb('0x23')](handleEntityNotFound(_0x31623b,null))[_0xafbb('0x23')](saveUpdates(_0x52f39b[_0xafbb('0x46')],null))[_0xafbb('0x23')](respondWithResult(_0x31623b,null))[_0xafbb('0x40')](handleError(_0x31623b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index ef08412..22c6a78 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 _0x678c=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','cm_hopper_history','endtime','uniqueid','util'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x678c,0x112));var _0xc678=function(_0x1974db,_0x352a73){_0x1974db=_0x1974db-0x0;var _0x193149=_0x678c[_0x1974db];return _0x193149;};'use strict';var _=require('lodash');var util=require(_0xc678('0x0'));var logger=require(_0xc678('0x1'))('api');var moment=require(_0xc678('0x2'));var BPromise=require('bluebird');var rp=require(_0xc678('0x3'));var fs=require('fs');var path=require(_0xc678('0x4'));var rimraf=require(_0xc678('0x5'));var config=require(_0xc678('0x6'));var attributes=require('./cmHopperHistory.attributes');module[_0xc678('0x7')]=function(_0x10003a,_0x5868e0){return _0x10003a['define']('CmHopperHistory',attributes,{'tableName':_0xc678('0x8'),'paranoid':![],'indexes':[{'name':_0xc678('0x9'),'fields':['endtime']},{'name':'uniqueid','fields':[_0xc678('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6687=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0x6687,0x17b));var _0x7668=function(_0x1d8f33,_0x192d34){_0x1d8f33=_0x1d8f33-0x0;var _0x5a4a69=_0x6687[_0x1d8f33];return _0x5a4a69;};'use strict';var _=require(_0x7668('0x0'));var util=require(_0x7668('0x1'));var logger=require(_0x7668('0x2'))(_0x7668('0x3'));var moment=require(_0x7668('0x4'));var BPromise=require(_0x7668('0x5'));var rp=require(_0x7668('0x6'));var fs=require('fs');var path=require(_0x7668('0x7'));var rimraf=require(_0x7668('0x8'));var config=require(_0x7668('0x9'));var attributes=require(_0x7668('0xa'));module[_0x7668('0xb')]=function(_0x43e091,_0x4cb476){return _0x43e091[_0x7668('0xc')](_0x7668('0xd'),attributes,{'tableName':_0x7668('0xe'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0x7668('0xf'),'fields':[_0x7668('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index ead08f5..b4979c3 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 _0x65e9=['predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgTalktime','then','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','request','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','CmHopperHistory,\x20%s,\x20%s','message','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','stringify','catch','AvgHandleTime','findAll','where','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null'];(function(_0x533f3a,_0x4019f4){var _0x64c095=function(_0x20de6e){while(--_0x20de6e){_0x533f3a['push'](_0x533f3a['shift']());}};_0x64c095(++_0x4019f4);}(_0x65e9,0xa0));var _0x965e=function(_0xa68fd2,_0x56e58b){_0xa68fd2=_0xa68fd2-0x0;var _0x290dbb=_0x65e9[_0xa68fd2];return _0x290dbb;};'use strict';var _=require(_0x965e('0x0'));var util=require(_0x965e('0x1'));var moment=require(_0x965e('0x2'));var BPromise=require(_0x965e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x965e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x965e('0x5'));var logger=require('../../config/logger')(_0x965e('0x6'));var config=require(_0x965e('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x422451,_0x5895ff,_0x353e84){return new BPromise(function(_0x2e3c13,_0x1643c8){return client[_0x965e('0x8')](_0x422451,_0x353e84)['then'](function(_0x159885){logger[_0x965e('0x9')]('CmHopperHistory,\x20%s,\x20%s',_0x5895ff,_0x965e('0xa'));logger[_0x965e('0xb')](_0x965e('0xc'),_0x5895ff,'request\x20sent',JSON['stringify'](_0x159885));if(_0x159885['error']){if(_0x159885[_0x965e('0xd')]['code']===0x1f4){logger[_0x965e('0xd')](_0x965e('0xe'),_0x5895ff,_0x159885[_0x965e('0xd')][_0x965e('0xf')]);return _0x1643c8(_0x159885['error'][_0x965e('0xf')]);}logger['error'](_0x965e('0xe'),_0x5895ff,_0x159885[_0x965e('0xd')][_0x965e('0xf')]);return _0x2e3c13(_0x159885[_0x965e('0xd')][_0x965e('0xf')]);}else{logger[_0x965e('0x9')](_0x965e('0xe'),_0x5895ff,_0x965e('0xa'));_0x2e3c13(_0x159885['result'][_0x965e('0xf')]);}})['catch'](function(_0x2a2083){logger[_0x965e('0xd')](_0x965e('0xe'),_0x5895ff,_0x2a2083);_0x1643c8(_0x2a2083);});});}exports[_0x965e('0x10')]=function(_0x3f3ce5){var _0x589930=this;return new Promise(function(_0x1d38fd,_0x517f19){return db[_0x965e('0x11')][_0x965e('0x12')](_0x3f3ce5[_0x965e('0x13')],{'raw':_0x3f3ce5[_0x965e('0x14')]?_0x3f3ce5[_0x965e('0x14')][_0x965e('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x2956df){logger[_0x965e('0x9')](_0x965e('0x10'),_0x3f3ce5);logger[_0x965e('0xb')]('CreateCmHopperHistory',_0x3f3ce5,JSON[_0x965e('0x16')](_0x2956df));_0x1d38fd(_0x2956df);})[_0x965e('0x17')](function(_0x47a43e){logger[_0x965e('0xd')](_0x965e('0x10'),_0x47a43e['message'],_0x3f3ce5);_0x517f19(_0x589930[_0x965e('0xd')](0x1f4,_0x47a43e['message']));});});};exports[_0x965e('0x18')]=function(_0x1ebfce){var _0x2c9437=this;return new Promise(function(_0x184bb9,_0x3a73ec){return db[_0x965e('0x11')][_0x965e('0x19')]({'raw':_0x1ebfce[_0x965e('0x14')]?_0x1ebfce['options'][_0x965e('0x15')]===undefined?!![]:![]:!![],'where':_0x1ebfce[_0x965e('0x14')]?_0x1ebfce[_0x965e('0x14')][_0x965e('0x1a')]||null:null,'attributes':[[db[_0x965e('0x1b')]['fn'](_0x965e('0x1c'),db[_0x965e('0x1b')][_0x965e('0x1d')]('id')),'predictiveIntervalTotalCalls'],[db[_0x965e('0x1b')]['fn'](_0x965e('0x1c'),db[_0x965e('0x1b')]['fn']('IF',db[_0x965e('0x1b')][_0x965e('0x1e')](_0x965e('0x1f')))),_0x965e('0x20')],[db[_0x965e('0x1b')]['fn'](_0x965e('0x1c'),db[_0x965e('0x1b')]['fn']('IF',db[_0x965e('0x1b')][_0x965e('0x1e')](_0x965e('0x21')))),_0x965e('0x22')],[db[_0x965e('0x1b')]['fn'](_0x965e('0x1c'),db['sequelize']['fn']('IF',db[_0x965e('0x1b')][_0x965e('0x1e')](_0x965e('0x23')))),_0x965e('0x24')],[db[_0x965e('0x1b')]['fn']('AVG',db[_0x965e('0x1b')]['fn']('IF',db[_0x965e('0x1b')][_0x965e('0x1e')](_0x965e('0x25')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn']('AVG',db[_0x965e('0x1b')]['fn']('IF',db[_0x965e('0x1b')][_0x965e('0x1e')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x965e('0x26')]]})[_0x965e('0x27')](function(_0x2cd58f){logger[_0x965e('0x9')]('AvgHandleTime',_0x1ebfce);logger['debug']('AvgHandleTime',_0x1ebfce,JSON[_0x965e('0x16')](_0x2cd58f));_0x184bb9(_0x2cd58f);})[_0x965e('0x17')](function(_0xc1808f){logger[_0x965e('0xd')](_0x965e('0x18'),_0xc1808f[_0x965e('0xf')],_0x1ebfce);_0x3a73ec(_0x2c9437[_0x965e('0xd')](0x1f4,_0xc1808f[_0x965e('0xf')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x18f2bb){var _0x585b2e=this;return new Promise(function(_0x42e082,_0x5054b9){return db['CmHopperHistory'][_0x965e('0x19')]({'raw':_0x18f2bb[_0x965e('0x14')]?_0x18f2bb[_0x965e('0x14')][_0x965e('0x15')]===undefined?!![]:![]:!![],'where':_0x18f2bb[_0x965e('0x14')]?_0x18f2bb['options']['where']||null:null,'attributes':[[_0x965e('0x28'),_0x965e('0x29')],[db['sequelize']['fn'](_0x965e('0x1c'),db['sequelize']['fn']('IF',db[_0x965e('0x1b')][_0x965e('0x1e')](_0x965e('0x2a')))),_0x965e('0x2b')],[db[_0x965e('0x1b')]['fn'](_0x965e('0x1c'),db[_0x965e('0x1b')]['fn']('IF',db[_0x965e('0x1b')][_0x965e('0x1e')](_0x965e('0x2c')))),_0x965e('0x2d')],[db[_0x965e('0x1b')]['fn']('COUNT',db[_0x965e('0x1b')]['fn']('IF',db[_0x965e('0x1b')][_0x965e('0x1e')](_0x965e('0x1f')))),'outboundAnswerCallsDay'],[db[_0x965e('0x1b')]['fn'](_0x965e('0x1c'),db['sequelize']['fn']('IF',db[_0x965e('0x1b')]['literal'](_0x965e('0x2e')))),_0x965e('0x2f')],[db[_0x965e('0x1b')]['fn'](_0x965e('0x1c'),db[_0x965e('0x1b')]['fn']('IF',db[_0x965e('0x1b')]['literal'](_0x965e('0x30')))),_0x965e('0x31')],[db[_0x965e('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x965e('0x1e')](_0x965e('0x32')))),'outboundDropCallsDayTimeout'],[db[_0x965e('0x1b')]['fn'](_0x965e('0x1c'),db[_0x965e('0x1b')]['fn']('IF',db[_0x965e('0x1b')]['literal'](_0x965e('0x33')))),_0x965e('0x34')],[db[_0x965e('0x1b')]['fn'](_0x965e('0x1c'),db[_0x965e('0x1b')]['fn']('IF',db['sequelize'][_0x965e('0x1e')]('`state`\x20=\x2012,\x201,\x20null'))),_0x965e('0x35')],[db[_0x965e('0x1b')]['fn']('COUNT',db[_0x965e('0x1b')]['fn']('IF',db[_0x965e('0x1b')][_0x965e('0x1e')]('`state`\x20=\x2013,\x201,\x20null'))),_0x965e('0x36')],[db[_0x965e('0x1b')]['fn']('COUNT',db[_0x965e('0x1b')]['fn']('IF',db[_0x965e('0x1b')][_0x965e('0x1e')](_0x965e('0x37')))),_0x965e('0x38')],[db[_0x965e('0x1b')]['fn'](_0x965e('0x1c'),db['sequelize']['fn']('IF',db[_0x965e('0x1b')][_0x965e('0x1e')](_0x965e('0x39')))),_0x965e('0x3a')],[db[_0x965e('0x1b')]['fn'](_0x965e('0x1c'),db[_0x965e('0x1b')]['fn']('IF',db['sequelize'][_0x965e('0x1e')]('`state`\x20=\x2016,\x201,\x20null'))),_0x965e('0x3b')],[db[_0x965e('0x1b')]['fn'](_0x965e('0x1c'),db[_0x965e('0x1b')]['fn']('IF',db['sequelize'][_0x965e('0x1e')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x965e('0x1b')]['fn'](_0x965e('0x1c'),db[_0x965e('0x1b')]['fn']('IF',db[_0x965e('0x1b')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x965e('0x28')]})['then'](function(_0x4df191){logger[_0x965e('0x9')](_0x965e('0x3c'),_0x18f2bb);logger['debug'](_0x965e('0x3c'),_0x18f2bb,JSON['stringify'](_0x4df191));_0x42e082(_0x4df191);})[_0x965e('0x17')](function(_0xb5a38b){logger[_0x965e('0xd')]('GetVoiceQueueHopperHistory',_0xb5a38b[_0x965e('0xf')],_0x18f2bb);_0x5054b9(_0x585b2e[_0x965e('0xd')](0x1f4,_0xb5a38b[_0x965e('0xf')]));});});};exports[_0x965e('0x3d')]=function(_0x445303){var _0x43346f=this;return new Promise(function(_0xe91cc,_0x18dbfc){return db[_0x965e('0x11')]['findAll']({'raw':_0x445303[_0x965e('0x14')]?_0x445303[_0x965e('0x14')][_0x965e('0x15')]===undefined?!![]:![]:!![],'where':_0x445303['options']?_0x445303[_0x965e('0x14')][_0x965e('0x1a')]||null:null,'attributes':[[_0x965e('0x28'),_0x965e('0x29')],[db[_0x965e('0x1b')]['fn'](_0x965e('0x1c'),db[_0x965e('0x1b')]['col']('id')),_0x965e('0x3e')],[db[_0x965e('0x1b')]['fn'](_0x965e('0x1c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x965e('0x1f')))),_0x965e('0x3f')]],'group':['campaign']})[_0x965e('0x27')](function(_0x56e452){logger[_0x965e('0x9')](_0x965e('0x3d'),_0x445303);logger[_0x965e('0xb')](_0x965e('0x3d'),_0x445303,JSON['stringify'](_0x56e452));_0xe91cc(_0x56e452);})[_0x965e('0x17')](function(_0x37ca66){logger[_0x965e('0xd')](_0x965e('0x3d'),_0x37ca66['message'],_0x445303);_0x18dbfc(_0x43346f[_0x965e('0xd')](0x1f4,_0x37ca66[_0x965e('0xf')]));});});}; \ No newline at end of file +var _0x4d02=['`state`\x20=\x2012,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','col','ivrAnswerCallsDay','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateCmHopperHistory','create','options','raw','CmHopperHistory','findAll','where','sequelize','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null'];(function(_0x25fd7f,_0x1fc310){var _0x558eac=function(_0x47c161){while(--_0x47c161){_0x25fd7f['push'](_0x25fd7f['shift']());}};_0x558eac(++_0x1fc310);}(_0x4d02,0xff));var _0x24d0=function(_0x2e316a,_0x36559f){_0x2e316a=_0x2e316a-0x0;var _0x5c9790=_0x4d02[_0x2e316a];return _0x5c9790;};'use strict';var _=require(_0x24d0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x24d0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24d0('0x2'));var db=require(_0x24d0('0x3'))['db'];var utils=require(_0x24d0('0x4'));var logger=require(_0x24d0('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x24d0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4851a0,_0x34cfd2,_0x2cf9e9){return new BPromise(function(_0x4247a5,_0x4ae8a5){return client[_0x24d0('0x7')](_0x4851a0,_0x2cf9e9)[_0x24d0('0x8')](function(_0x25cf37){logger[_0x24d0('0x9')](_0x24d0('0xa'),_0x34cfd2,'request\x20sent');logger[_0x24d0('0xb')](_0x24d0('0xc'),_0x34cfd2,_0x24d0('0xd'),JSON[_0x24d0('0xe')](_0x25cf37));if(_0x25cf37[_0x24d0('0xf')]){if(_0x25cf37[_0x24d0('0xf')][_0x24d0('0x10')]===0x1f4){logger[_0x24d0('0xf')](_0x24d0('0xa'),_0x34cfd2,_0x25cf37[_0x24d0('0xf')][_0x24d0('0x11')]);return _0x4ae8a5(_0x25cf37[_0x24d0('0xf')]['message']);}logger['error'](_0x24d0('0xa'),_0x34cfd2,_0x25cf37[_0x24d0('0xf')]['message']);return _0x4247a5(_0x25cf37['error'][_0x24d0('0x11')]);}else{logger['info'](_0x24d0('0xa'),_0x34cfd2,_0x24d0('0xd'));_0x4247a5(_0x25cf37['result'][_0x24d0('0x11')]);}})[_0x24d0('0x12')](function(_0x316e38){logger[_0x24d0('0xf')](_0x24d0('0xa'),_0x34cfd2,_0x316e38);_0x4ae8a5(_0x316e38);});});}exports[_0x24d0('0x13')]=function(_0x585154){var _0x39ae63=this;return new Promise(function(_0x27cc59,_0x2ada22){return db['CmHopperHistory'][_0x24d0('0x14')](_0x585154['body'],{'raw':_0x585154[_0x24d0('0x15')]?_0x585154[_0x24d0('0x15')][_0x24d0('0x16')]===undefined?!![]:![]:!![]})[_0x24d0('0x8')](function(_0x423ac1){logger[_0x24d0('0x9')](_0x24d0('0x13'),_0x585154);logger[_0x24d0('0xb')]('CreateCmHopperHistory',_0x585154,JSON['stringify'](_0x423ac1));_0x27cc59(_0x423ac1);})[_0x24d0('0x12')](function(_0x517774){logger[_0x24d0('0xf')](_0x24d0('0x13'),_0x517774['message'],_0x585154);_0x2ada22(_0x39ae63[_0x24d0('0xf')](0x1f4,_0x517774['message']));});});};exports['AvgHandleTime']=function(_0x14eda2){var _0x12ee7d=this;return new Promise(function(_0x261980,_0x5e0b81){return db[_0x24d0('0x17')][_0x24d0('0x18')]({'raw':_0x14eda2['options']?_0x14eda2[_0x24d0('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x14eda2[_0x24d0('0x15')]?_0x14eda2[_0x24d0('0x15')][_0x24d0('0x19')]||null:null,'attributes':[[db[_0x24d0('0x1a')]['fn']('COUNT',db[_0x24d0('0x1a')]['col']('id')),_0x24d0('0x1b')],[db['sequelize']['fn'](_0x24d0('0x1c'),db[_0x24d0('0x1a')]['fn']('IF',db['sequelize'][_0x24d0('0x1d')](_0x24d0('0x1e')))),_0x24d0('0x1f')],[db[_0x24d0('0x1a')]['fn'](_0x24d0('0x1c'),db[_0x24d0('0x1a')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x24d0('0x20')],[db[_0x24d0('0x1a')]['fn'](_0x24d0('0x1c'),db[_0x24d0('0x1a')]['fn']('IF',db[_0x24d0('0x1a')][_0x24d0('0x1d')](_0x24d0('0x21')))),_0x24d0('0x22')],[db[_0x24d0('0x1a')]['fn'](_0x24d0('0x23'),db[_0x24d0('0x1a')]['fn']('IF',db['sequelize'][_0x24d0('0x1d')](_0x24d0('0x24')))),_0x24d0('0x25')],[db[_0x24d0('0x1a')]['fn'](_0x24d0('0x23'),db[_0x24d0('0x1a')]['fn']('IF',db['sequelize'][_0x24d0('0x1d')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0x24d0('0x8')](function(_0x3061b9){logger[_0x24d0('0x9')](_0x24d0('0x26'),_0x14eda2);logger[_0x24d0('0xb')](_0x24d0('0x26'),_0x14eda2,JSON[_0x24d0('0xe')](_0x3061b9));_0x261980(_0x3061b9);})['catch'](function(_0x35ca11){logger[_0x24d0('0xf')](_0x24d0('0x26'),_0x35ca11[_0x24d0('0x11')],_0x14eda2);_0x5e0b81(_0x12ee7d['error'](0x1f4,_0x35ca11['message']));});});};exports[_0x24d0('0x27')]=function(_0x34531b){var _0x12fdfa=this;return new Promise(function(_0x325f28,_0x445d8b){return db[_0x24d0('0x17')][_0x24d0('0x18')]({'raw':_0x34531b[_0x24d0('0x15')]?_0x34531b['options'][_0x24d0('0x16')]===undefined?!![]:![]:!![],'where':_0x34531b[_0x24d0('0x15')]?_0x34531b[_0x24d0('0x15')][_0x24d0('0x19')]||null:null,'attributes':[[_0x24d0('0x28'),_0x24d0('0x29')],[db[_0x24d0('0x1a')]['fn']('COUNT',db[_0x24d0('0x1a')]['fn']('IF',db[_0x24d0('0x1a')][_0x24d0('0x1d')](_0x24d0('0x2a')))),_0x24d0('0x2b')],[db[_0x24d0('0x1a')]['fn'](_0x24d0('0x1c'),db[_0x24d0('0x1a')]['fn']('IF',db[_0x24d0('0x1a')][_0x24d0('0x1d')](_0x24d0('0x2c')))),_0x24d0('0x2d')],[db[_0x24d0('0x1a')]['fn'](_0x24d0('0x1c'),db[_0x24d0('0x1a')]['fn']('IF',db[_0x24d0('0x1a')][_0x24d0('0x1d')](_0x24d0('0x1e')))),_0x24d0('0x2e')],[db[_0x24d0('0x1a')]['fn'](_0x24d0('0x1c'),db[_0x24d0('0x1a')]['fn']('IF',db['sequelize'][_0x24d0('0x1d')](_0x24d0('0x2f')))),'outboundBusyCallsDay'],[db[_0x24d0('0x1a')]['fn'](_0x24d0('0x1c'),db[_0x24d0('0x1a')]['fn']('IF',db[_0x24d0('0x1a')][_0x24d0('0x1d')](_0x24d0('0x30')))),'outboundCongestionCallsDay'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x24d0('0x1a')][_0x24d0('0x1d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0x24d0('0x1c'),db[_0x24d0('0x1a')]['fn']('IF',db[_0x24d0('0x1a')][_0x24d0('0x1d')](_0x24d0('0x31')))),'outboundDropCallsDayCallersExit'],[db[_0x24d0('0x1a')]['fn'](_0x24d0('0x1c'),db[_0x24d0('0x1a')]['fn']('IF',db['sequelize'][_0x24d0('0x1d')](_0x24d0('0x32')))),'outboundUnknownCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x24d0('0x1a')]['fn']('IF',db[_0x24d0('0x1a')]['literal']('`state`\x20=\x2013,\x201,\x20null'))),_0x24d0('0x33')],[db[_0x24d0('0x1a')]['fn'](_0x24d0('0x1c'),db[_0x24d0('0x1a')]['fn']('IF',db[_0x24d0('0x1a')][_0x24d0('0x1d')]('`state`\x20=\x2014,\x201,\x20null'))),_0x24d0('0x34')],[db[_0x24d0('0x1a')]['fn'](_0x24d0('0x1c'),db[_0x24d0('0x1a')]['fn']('IF',db['sequelize'][_0x24d0('0x1d')](_0x24d0('0x35')))),'outboundRejectCallsDay'],[db[_0x24d0('0x1a')]['fn'](_0x24d0('0x1c'),db[_0x24d0('0x1a')]['fn']('IF',db['sequelize'][_0x24d0('0x1d')](_0x24d0('0x36')))),'outboundAnswerAgiCallsDay'],[db[_0x24d0('0x1a')]['fn'](_0x24d0('0x1c'),db['sequelize']['fn']('IF',db[_0x24d0('0x1a')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0x24d0('0x37')],[db[_0x24d0('0x1a')]['fn'](_0x24d0('0x1c'),db[_0x24d0('0x1a')]['fn']('IF',db[_0x24d0('0x1a')][_0x24d0('0x1d')](_0x24d0('0x38')))),_0x24d0('0x39')]],'group':[_0x24d0('0x28')]})[_0x24d0('0x8')](function(_0x6886cc){logger[_0x24d0('0x9')]('GetVoiceQueueHopperHistory',_0x34531b);logger[_0x24d0('0xb')]('GetVoiceQueueHopperHistory',_0x34531b,JSON[_0x24d0('0xe')](_0x6886cc));_0x325f28(_0x6886cc);})[_0x24d0('0x12')](function(_0x2491c4){logger[_0x24d0('0xf')](_0x24d0('0x27'),_0x2491c4[_0x24d0('0x11')],_0x34531b);_0x445d8b(_0x12fdfa[_0x24d0('0xf')](0x1f4,_0x2491c4[_0x24d0('0x11')]));});});};exports[_0x24d0('0x3a')]=function(_0x738a3e){var _0x1896af=this;return new Promise(function(_0x4de976,_0x102129){return db[_0x24d0('0x17')][_0x24d0('0x18')]({'raw':_0x738a3e[_0x24d0('0x15')]?_0x738a3e[_0x24d0('0x15')][_0x24d0('0x16')]===undefined?!![]:![]:!![],'where':_0x738a3e['options']?_0x738a3e[_0x24d0('0x15')]['where']||null:null,'attributes':[['campaign',_0x24d0('0x29')],[db['sequelize']['fn']('COUNT',db['sequelize'][_0x24d0('0x3b')]('id')),'ivrTotalCallsDays'],[db[_0x24d0('0x1a')]['fn'](_0x24d0('0x1c'),db[_0x24d0('0x1a')]['fn']('IF',db[_0x24d0('0x1a')][_0x24d0('0x1d')](_0x24d0('0x1e')))),_0x24d0('0x3c')]],'group':['campaign']})[_0x24d0('0x8')](function(_0x5a7934){logger[_0x24d0('0x9')](_0x24d0('0x3a'),_0x738a3e);logger[_0x24d0('0xb')]('GetCampaignHopperHistory',_0x738a3e,JSON['stringify'](_0x5a7934));_0x4de976(_0x5a7934);})[_0x24d0('0x12')](function(_0xd64df9){logger[_0x24d0('0xf')](_0x24d0('0x3a'),_0xd64df9['message'],_0x738a3e);_0x102129(_0x1896af[_0x24d0('0xf')](0x1f4,_0xd64df9[_0x24d0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 1ce1614..d35bcb4 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 _0xd7eb=['get','/describe','isAuthenticated','show','post','create','/:id','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','index'];(function(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_0xd7eb,0x1ab));var _0xbd7e=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xd7eb[_0x39d544];return _0x5a5ff2;};'use strict';var multer=require(_0xbd7e('0x0'));var util=require(_0xbd7e('0x1'));var path=require(_0xbd7e('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd7e('0x3'));var router=express[_0xbd7e('0x4')]();var fs_extra=require(_0xbd7e('0x5'));var auth=require(_0xbd7e('0x6'));var interaction=require(_0xbd7e('0x7'));var config=require('../../config/environment');var controller=require(_0xbd7e('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbd7e('0x9')]);router[_0xbd7e('0xa')](_0xbd7e('0xb'),auth[_0xbd7e('0xc')](),controller['describe']);router[_0xbd7e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xbd7e('0xd')]);router[_0xbd7e('0xe')]('/',auth[_0xbd7e('0xc')](),controller[_0xbd7e('0xf')]);router['put'](_0xbd7e('0x10'),auth[_0xbd7e('0xc')](),controller[_0xbd7e('0x11')]);module[_0xbd7e('0x12')]=router; \ No newline at end of file +var _0x7de9=['/describe','isAuthenticated','describe','/:id','show','post','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','index','get'];(function(_0x4af01e,_0x543f5c){var _0x178c11=function(_0x2c2f76){while(--_0x2c2f76){_0x4af01e['push'](_0x4af01e['shift']());}};_0x178c11(++_0x543f5c);}(_0x7de9,0x7a));var _0x97de=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x7de9[_0x5416db];return _0x243e35;};'use strict';var multer=require(_0x97de('0x0'));var util=require(_0x97de('0x1'));var path=require(_0x97de('0x2'));var timeout=require(_0x97de('0x3'));var express=require(_0x97de('0x4'));var router=express['Router']();var fs_extra=require(_0x97de('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x97de('0x6'));var config=require(_0x97de('0x7'));var controller=require(_0x97de('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x97de('0x9')]);router[_0x97de('0xa')](_0x97de('0xb'),auth[_0x97de('0xc')](),controller[_0x97de('0xd')]);router[_0x97de('0xa')](_0x97de('0xe'),auth['isAuthenticated'](),controller[_0x97de('0xf')]);router[_0x97de('0x10')]('/',auth[_0x97de('0xc')](),controller['create']);router['put'](_0x97de('0xe'),auth[_0x97de('0xc')](),controller[_0x97de('0x11')]);module[_0x97de('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index b533852..3935cc2 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 _0x71e3=['name','STRING','sequelize','exports'];(function(_0x401531,_0x582a70){var _0x51b83c=function(_0x118c21){while(--_0x118c21){_0x401531['push'](_0x401531['shift']());}};_0x51b83c(++_0x582a70);}(_0x71e3,0x9e));var _0x371e=function(_0x179c6e,_0x4fb1a7){_0x179c6e=_0x179c6e-0x0;var _0x279076=_0x71e3[_0x179c6e];return _0x279076;};'use strict';var Sequelize=require(_0x371e('0x0'));module[_0x371e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x371e('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x371e('0x3')]},'dialPrefix':{'type':Sequelize[_0x371e('0x3')]}}; \ No newline at end of file +var _0x269a=['STRING','exports'];(function(_0x491468,_0x42f169){var _0x5b8c22=function(_0x407a9b){while(--_0x407a9b){_0x491468['push'](_0x491468['shift']());}};_0x5b8c22(++_0x42f169);}(_0x269a,0x103));var _0xa269=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x269a[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0xa269('0x0')]={'name':{'type':Sequelize[_0xa269('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa269('0x1')]},'dialPrefix':{'type':Sequelize[_0xa269('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index e881c36..1f37cb4 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 _0xac91=['removeDispositions','ids','CmContact','tags','isArray','join','each','success','dataValues','errors','push','message','Malformed\x20request\x20syntax','CmCustomField','concat','CustomFields','format','raw','getContacts','getContactsCsv','isEmpty','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','Content-type','text/csv','download','addCustomField','sequelize','Sequelize','TEXT','type','number','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','getCustomFields','findAndCountAll','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./cmList.socket','sendStatus','end','undefined','limit','count','offset','set','json','apply','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','status','send','index','rawAttributes','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','CmList','include','rows','catch','params','filters','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','ListId','Disposition','findOne'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xac91,0x1c7));var _0x1ac9=function(_0xed4881,_0x45771c){_0xed4881=_0xed4881-0x0;var _0x7fcbd5=_0xac91[_0xed4881];return _0x7fcbd5;};'use strict';var emlformat=require(_0x1ac9('0x0'));var rimraf=require(_0x1ac9('0x1'));var zipdir=require(_0x1ac9('0x2'));var jsonpatch=require(_0x1ac9('0x3'));var rp=require(_0x1ac9('0x4'));var moment=require(_0x1ac9('0x5'));var BPromise=require(_0x1ac9('0x6'));var Mustache=require(_0x1ac9('0x7'));var util=require(_0x1ac9('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1ac9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1ac9('0xa'));var squel=require('squel');var crypto=require(_0x1ac9('0xb'));var jsforce=require(_0x1ac9('0xc'));var deskjs=require(_0x1ac9('0xd'));var toCsv=require(_0x1ac9('0xe'));var querystring=require(_0x1ac9('0xf'));var Papa=require(_0x1ac9('0x10'));var Redis=require('ioredis');var authService=require(_0x1ac9('0x11'));var qs=require(_0x1ac9('0x12'));var as=require(_0x1ac9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ac9('0x14'))(_0x1ac9('0x15'));var utils=require('../../config/utils');var config=require(_0x1ac9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1ac9('0x17'))['db'];config[_0x1ac9('0x18')]=_[_0x1ac9('0x19')](config[_0x1ac9('0x18')],{'host':_0x1ac9('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1ac9('0x18')]));require(_0x1ac9('0x1b'))['register'](socket);function respondWithStatusCode(_0x588fe8,_0x379ab2){_0x379ab2=_0x379ab2||0xcc;return function(_0x74e93){if(_0x74e93){return _0x588fe8[_0x1ac9('0x1c')](_0x379ab2);}return _0x588fe8['status'](_0x379ab2)[_0x1ac9('0x1d')]();};}function respondWithResult(_0x3599a5,_0x4dbd78){_0x4dbd78=_0x4dbd78||0xc8;return function(_0x5c085f){if(_0x5c085f){return _0x3599a5['status'](_0x4dbd78)['json'](_0x5c085f);}};}function respondWithFilteredResult(_0x134d11,_0x53cc10){return function(_0xa4d973){if(_0xa4d973){var _0x5582e1=typeof _0x53cc10['offset']===_0x1ac9('0x1e')&&typeof _0x53cc10[_0x1ac9('0x1f')]===_0x1ac9('0x1e');var _0x296c49=_0xa4d973[_0x1ac9('0x20')];var _0xff66a8=_0x5582e1?0x0:_0x53cc10[_0x1ac9('0x21')];var _0xa42766=_0x5582e1?_0xa4d973[_0x1ac9('0x20')]:_0x53cc10[_0x1ac9('0x21')]+_0x53cc10[_0x1ac9('0x1f')];var _0x3df4d9;if(_0xa42766>=_0x296c49){_0xa42766=_0x296c49;_0x3df4d9=0xc8;}else{_0x3df4d9=0xce;}_0x134d11['status'](_0x3df4d9);return _0x134d11[_0x1ac9('0x22')]('Content-Range',_0xff66a8+'-'+_0xa42766+'/'+_0x296c49)[_0x1ac9('0x23')](_0xa4d973);}return null;};}function patchUpdates(_0x58edd3){return function(_0x843813){try{jsonpatch[_0x1ac9('0x24')](_0x843813,_0x58edd3,!![]);}catch(_0x2ecde4){return BPromise['reject'](_0x2ecde4);}return _0x843813[_0x1ac9('0x25')]();};}function saveUpdates(_0x508418,_0x247cfd){return function(_0x45e3cb){if(_0x45e3cb){return _0x45e3cb[_0x1ac9('0x26')](_0x508418)[_0x1ac9('0x27')](function(_0x1f9821){return _0x1f9821;});}return null;};}function removeEntity(_0x3066cf,_0x4e51a6){return function(_0x25c87b){if(_0x25c87b){return _0x25c87b[_0x1ac9('0x28')]()[_0x1ac9('0x27')](function(){var _0x329138=_0x25c87b[_0x1ac9('0x29')]({'plain':!![]});var _0x4e1779=_0x1ac9('0x2a');return db[_0x1ac9('0x2b')][_0x1ac9('0x28')]({'where':{'type':_0x4e1779,'resourceId':_0x329138['id']}})['then'](function(){return _0x25c87b;});})['then'](function(){_0x3066cf['status'](0xcc)[_0x1ac9('0x1d')]();});}};}function handleEntityNotFound(_0x27f224,_0x1ce89b){return function(_0x20ff0b){if(!_0x20ff0b){_0x27f224[_0x1ac9('0x1c')](0x194);}return _0x20ff0b;};}function handleError(_0x3d92bd,_0x3cd2ca){_0x3cd2ca=_0x3cd2ca||0x1f4;return function(_0x105152){logger[_0x1ac9('0x2c')](_0x105152[_0x1ac9('0x2d')]);if(_0x105152[_0x1ac9('0x2e')]){delete _0x105152[_0x1ac9('0x2e')];}_0x3d92bd[_0x1ac9('0x2f')](_0x3cd2ca)[_0x1ac9('0x30')](_0x105152);};}exports[_0x1ac9('0x31')]=function(_0x137508,_0x30ff16){var _0x374ab4={},_0x6f060d={},_0x345c65={'count':0x0,'rows':[]};var _0x2d5270=_['map'](db['CmList'][_0x1ac9('0x32')],function(_0x43b29d){return{'name':_0x43b29d['fieldName'],'type':_0x43b29d['type'][_0x1ac9('0x33')]};});_0x6f060d[_0x1ac9('0x34')]=_[_0x1ac9('0x35')](_0x2d5270,'name');_0x6f060d[_0x1ac9('0x36')]=_[_0x1ac9('0x37')](_0x137508[_0x1ac9('0x36')]);_0x6f060d['filters']=_[_0x1ac9('0x38')](_0x6f060d[_0x1ac9('0x34')],_0x6f060d[_0x1ac9('0x36')]);_0x374ab4[_0x1ac9('0x39')]=_['intersection'](_0x6f060d[_0x1ac9('0x34')],qs['fields'](_0x137508['query'][_0x1ac9('0x3a')]));_0x374ab4[_0x1ac9('0x39')]=_0x374ab4[_0x1ac9('0x39')]['length']?_0x374ab4[_0x1ac9('0x39')]:_0x6f060d[_0x1ac9('0x34')];if(!_0x137508[_0x1ac9('0x36')][_0x1ac9('0x3b')](_0x1ac9('0x3c'))){_0x374ab4[_0x1ac9('0x1f')]=qs[_0x1ac9('0x1f')](_0x137508[_0x1ac9('0x36')][_0x1ac9('0x1f')]);_0x374ab4[_0x1ac9('0x21')]=qs[_0x1ac9('0x21')](_0x137508[_0x1ac9('0x36')][_0x1ac9('0x21')]);}_0x374ab4[_0x1ac9('0x3d')]=qs['sort'](_0x137508[_0x1ac9('0x36')][_0x1ac9('0x3e')]);_0x374ab4['where']=qs['filters'](_[_0x1ac9('0x3f')](_0x137508[_0x1ac9('0x36')],_0x6f060d['filters']),_0x2d5270);if(_0x137508['query'][_0x1ac9('0x40')]){_0x374ab4[_0x1ac9('0x41')]=_[_0x1ac9('0x42')](_0x374ab4[_0x1ac9('0x41')],{'$or':_[_0x1ac9('0x35')](_0x2d5270,function(_0x52d8b2){if(_0x52d8b2['type']!==_0x1ac9('0x43')){var _0xc6b7a0={};_0xc6b7a0[_0x52d8b2[_0x1ac9('0x2e')]]={'$like':'%'+_0x137508[_0x1ac9('0x36')][_0x1ac9('0x40')]+'%'};return _0xc6b7a0;}})});}_0x374ab4=_[_0x1ac9('0x42')]({},_0x374ab4,_0x137508['options']);var _0x35abb3={'where':_0x374ab4[_0x1ac9('0x41')]};return db[_0x1ac9('0x44')][_0x1ac9('0x20')](_0x35abb3)[_0x1ac9('0x27')](function(_0x293988){_0x345c65[_0x1ac9('0x20')]=_0x293988;if(_0x137508[_0x1ac9('0x36')]['includeAll']){_0x374ab4[_0x1ac9('0x45')]=[{'all':!![]}];}return db[_0x1ac9('0x44')]['findAll'](_0x374ab4);})[_0x1ac9('0x27')](function(_0x311262){_0x345c65[_0x1ac9('0x46')]=_0x311262;return _0x345c65;})[_0x1ac9('0x27')](respondWithFilteredResult(_0x30ff16,_0x374ab4))[_0x1ac9('0x47')](handleError(_0x30ff16,null));};exports['show']=function(_0x50788a,_0x42930b){var _0xbc45df={'raw':![],'where':{'id':_0x50788a[_0x1ac9('0x48')]['id']}},_0x3932e2={};_0x3932e2[_0x1ac9('0x34')]=_[_0x1ac9('0x37')](db[_0x1ac9('0x44')][_0x1ac9('0x32')]);_0x3932e2[_0x1ac9('0x36')]=_['keys'](_0x50788a[_0x1ac9('0x36')]);_0x3932e2[_0x1ac9('0x49')]=_[_0x1ac9('0x38')](_0x3932e2[_0x1ac9('0x34')],_0x3932e2[_0x1ac9('0x36')]);_0xbc45df['attributes']=_[_0x1ac9('0x38')](_0x3932e2[_0x1ac9('0x34')],qs[_0x1ac9('0x3a')](_0x50788a[_0x1ac9('0x36')][_0x1ac9('0x3a')]));_0xbc45df['attributes']=_0xbc45df[_0x1ac9('0x39')][_0x1ac9('0x4a')]?_0xbc45df[_0x1ac9('0x39')]:_0x3932e2['model'];if(_0x50788a[_0x1ac9('0x36')]['includeAll']){_0xbc45df[_0x1ac9('0x45')]=[{'all':!![]}];}_0xbc45df=_[_0x1ac9('0x42')]({},_0xbc45df,_0x50788a[_0x1ac9('0x4b')]);return db[_0x1ac9('0x44')][_0x1ac9('0x4c')](_0xbc45df)[_0x1ac9('0x27')](handleEntityNotFound(_0x42930b,null))[_0x1ac9('0x27')](respondWithResult(_0x42930b,null))[_0x1ac9('0x47')](handleError(_0x42930b,null));};exports[_0x1ac9('0x4d')]=function(_0x45f57b,_0x304c97){return db['CmList'][_0x1ac9('0x4d')](_0x45f57b['body'],{})[_0x1ac9('0x27')](function(_0x397a47){var _0x55f183=_0x45f57b[_0x1ac9('0x4e')][_0x1ac9('0x29')]({'plain':!![]});if(!_0x55f183)throw new Error(_0x1ac9('0x4f'));if(_0x55f183[_0x1ac9('0x50')]===_0x1ac9('0x4e')){var _0xd155c1=_0x397a47[_0x1ac9('0x29')]({'plain':!![]});var _0x4b1e70=_0x1ac9('0x2a');return db['UserProfileSection'][_0x1ac9('0x4c')]({'where':{'name':_0x4b1e70,'userProfileId':_0x55f183[_0x1ac9('0x51')]},'raw':!![]})[_0x1ac9('0x27')](function(_0x416c3b){if(_0x416c3b&&_0x416c3b[_0x1ac9('0x52')]===0x0){return db[_0x1ac9('0x2b')][_0x1ac9('0x4d')]({'name':_0xd155c1['name'],'resourceId':_0xd155c1['id'],'type':_0x416c3b['name'],'sectionId':_0x416c3b['id']},{})['then'](function(){return _0x397a47;});}else{return _0x397a47;}})[_0x1ac9('0x47')](function(_0x58a3e4){logger['error'](_0x1ac9('0x53'),_0x58a3e4);throw _0x58a3e4;});}return _0x397a47;})[_0x1ac9('0x27')](respondWithResult(_0x304c97,0xc9))[_0x1ac9('0x47')](handleError(_0x304c97,null));};exports['update']=function(_0x32d334,_0x2cc951){if(_0x32d334[_0x1ac9('0x54')]['id']){delete _0x32d334['body']['id'];}return db[_0x1ac9('0x44')][_0x1ac9('0x4c')]({'where':{'id':_0x32d334[_0x1ac9('0x48')]['id']}})[_0x1ac9('0x27')](handleEntityNotFound(_0x2cc951,null))[_0x1ac9('0x27')](saveUpdates(_0x32d334[_0x1ac9('0x54')],null))[_0x1ac9('0x27')](respondWithResult(_0x2cc951,null))[_0x1ac9('0x47')](handleError(_0x2cc951,null));};exports[_0x1ac9('0x28')]=function(_0x499afe,_0x5f5710){return db[_0x1ac9('0x44')][_0x1ac9('0x4c')]({'where':{'id':_0x499afe[_0x1ac9('0x48')]['id']}})[_0x1ac9('0x27')](handleEntityNotFound(_0x5f5710,null))[_0x1ac9('0x27')](removeEntity(_0x5f5710,null))[_0x1ac9('0x47')](handleError(_0x5f5710,null));};exports[_0x1ac9('0x55')]=function(_0x3c7e12,_0x1d2f6b){return db['CmList'][_0x1ac9('0x55')]()[_0x1ac9('0x27')](respondWithResult(_0x1d2f6b,null))[_0x1ac9('0x47')](handleError(_0x1d2f6b,null));};exports['addDisposition']=function(_0x555a74,_0x1218ea,_0x220cb6){if(_0x555a74[_0x1ac9('0x54')]['id']){delete _0x555a74['body']['id'];}return db['CmList'][_0x1ac9('0x4c')]({'where':{'id':_0x555a74[_0x1ac9('0x48')]['id']}})[_0x1ac9('0x27')](handleEntityNotFound(_0x1218ea,null))['then'](function(_0x233969){if(_0x233969){_0x555a74[_0x1ac9('0x54')][_0x1ac9('0x56')]=_0x233969['id'];return db[_0x1ac9('0x57')][_0x1ac9('0x4d')](_0x555a74[_0x1ac9('0x54')]);}})[_0x1ac9('0x27')](respondWithResult(_0x1218ea,null))['catch'](handleError(_0x1218ea,null));};exports['getDispositions']=function(_0x29cd25,_0xac4d56,_0x3363a2){var _0x1ef16f={'raw':![],'where':{}};var _0x1a02f2={};var _0x4e60ed={'count':0x0,'rows':[]};return db[_0x1ac9('0x44')][_0x1ac9('0x58')]({'where':{'id':_0x29cd25[_0x1ac9('0x48')]['id']}})[_0x1ac9('0x27')](handleEntityNotFound(_0xac4d56,null))[_0x1ac9('0x27')](function(_0xbc507e){if(_0xbc507e){_0x1a02f2[_0x1ac9('0x34')]=_['keys'](db['Disposition']['rawAttributes']);_0x1a02f2[_0x1ac9('0x36')]=_[_0x1ac9('0x37')](_0x29cd25[_0x1ac9('0x36')]);_0x1a02f2[_0x1ac9('0x49')]=_['intersection'](_0x1a02f2['model'],_0x1a02f2[_0x1ac9('0x36')]);_0x1ef16f[_0x1ac9('0x39')]=_[_0x1ac9('0x38')](_0x1a02f2['model'],qs[_0x1ac9('0x3a')](_0x29cd25[_0x1ac9('0x36')][_0x1ac9('0x3a')]));_0x1ef16f['attributes']=_0x1ef16f[_0x1ac9('0x39')][_0x1ac9('0x4a')]?_0x1ef16f[_0x1ac9('0x39')]:_0x1a02f2[_0x1ac9('0x34')];if(!_0x29cd25[_0x1ac9('0x36')]['hasOwnProperty'](_0x1ac9('0x3c'))){_0x1ef16f['limit']=qs[_0x1ac9('0x1f')](_0x29cd25['query'][_0x1ac9('0x1f')]);_0x1ef16f[_0x1ac9('0x21')]=qs[_0x1ac9('0x21')](_0x29cd25[_0x1ac9('0x36')]['offset']);}_0x1ef16f[_0x1ac9('0x3d')]=qs[_0x1ac9('0x3e')](_0x29cd25[_0x1ac9('0x36')]['sort']);_0x1ef16f[_0x1ac9('0x41')]=qs['filters'](_[_0x1ac9('0x3f')](_0x29cd25['query'],_0x1a02f2[_0x1ac9('0x49')]));_0x1ef16f[_0x1ac9('0x41')][_0x1ac9('0x56')]=_0xbc507e['id'];if(_0x29cd25['query'][_0x1ac9('0x40')]){_0x1ef16f[_0x1ac9('0x41')]=_['merge'](_0x1ef16f[_0x1ac9('0x41')],{'$or':_[_0x1ac9('0x35')](_0x1ef16f[_0x1ac9('0x39')],function(_0x952733){var _0x148628={};_0x148628[_0x952733]={'$like':'%'+_0x29cd25[_0x1ac9('0x36')][_0x1ac9('0x40')]+'%'};return _0x148628;})});}_0x1ef16f=_[_0x1ac9('0x42')]({},_0x1ef16f,_0x29cd25[_0x1ac9('0x4b')]);return db[_0x1ac9('0x57')]['count']({'where':_0x1ef16f[_0x1ac9('0x41')]})[_0x1ac9('0x27')](function(_0xf5f62a){_0x4e60ed[_0x1ac9('0x20')]=_0xf5f62a;if(_0x29cd25[_0x1ac9('0x36')]['includeAll']){_0x1ef16f[_0x1ac9('0x45')]=[{'all':!![]}];}return db[_0x1ac9('0x57')]['findAll'](_0x1ef16f);})[_0x1ac9('0x27')](function(_0x19d518){_0x4e60ed[_0x1ac9('0x46')]=_0x19d518;return _0x4e60ed;});}})[_0x1ac9('0x27')](respondWithFilteredResult(_0xac4d56,_0x1ef16f))['catch'](handleError(_0xac4d56,null));};exports['removeDispositions']=function(_0x5643d8,_0xa02740,_0x4314e3){return db[_0x1ac9('0x44')]['find']({'where':{'id':_0x5643d8[_0x1ac9('0x48')]['id']}})['then'](handleEntityNotFound(_0xa02740,null))['then'](function(_0x14eded){if(_0x14eded){return _0x14eded[_0x1ac9('0x59')](_0x5643d8[_0x1ac9('0x36')][_0x1ac9('0x5a')]);}})[_0x1ac9('0x27')](respondWithStatusCode(_0xa02740,null))['catch'](handleError(_0xa02740,null));};exports['addContacts']=function(_0x59b517,_0x40c808,_0xc4bdbf){return db['CmList'][_0x1ac9('0x4c')]({'where':{'id':_0x59b517[_0x1ac9('0x48')]['id']}})[_0x1ac9('0x27')](handleEntityNotFound(_0x40c808,null))[_0x1ac9('0x27')](function(_0x4c9d95){if(_0x4c9d95){var _0x138f4a=[];var _0x195fb7={'success':[],'errors':[]};return db[_0x1ac9('0x5b')][_0x1ac9('0x55')]()['then'](function(_0x386c27){if(_0x59b517[_0x1ac9('0x54')][_0x1ac9('0x5c')]&&_[_0x1ac9('0x5d')](_0x59b517[_0x1ac9('0x54')][_0x1ac9('0x5c')])){if(_0x59b517[_0x1ac9('0x54')][_0x1ac9('0x5c')][_0x1ac9('0x4a')]){_0x59b517[_0x1ac9('0x54')][_0x1ac9('0x5c')]=_0x59b517[_0x1ac9('0x54')][_0x1ac9('0x5c')][_0x1ac9('0x5e')](';')+';';}else{_0x59b517[_0x1ac9('0x54')][_0x1ac9('0x5c')]=null;}}else{_0x59b517[_0x1ac9('0x54')][_0x1ac9('0x5c')]=null;}if(_0x59b517['body']&&_[_0x1ac9('0x5d')](_0x59b517[_0x1ac9('0x54')])){for(var _0x5d5add=0x0;_0x5d5add<_0x59b517[_0x1ac9('0x54')]['length'];_0x5d5add+=0x1){_0x59b517['body'][_0x5d5add][_0x1ac9('0x56')]=_0x59b517[_0x1ac9('0x48')]['id'];_0x138f4a['push'](_0x59b517[_0x1ac9('0x54')][_0x5d5add]);}return BPromise[_0x1ac9('0x5f')](_0x138f4a,function(_0x4a3075){return db[_0x1ac9('0x5b')][_0x1ac9('0x4d')](_['omit'](_0x4a3075,['ids','id'])||{},{'fields':_[_0x1ac9('0x37')](_0x386c27),'raw':!![]})[_0x1ac9('0x27')](function(_0x302c72){_0x195fb7[_0x1ac9('0x60')]['push'](_0x302c72[_0x1ac9('0x61')]);})['catch'](function(_0x256dcc){_0x195fb7[_0x1ac9('0x62')][_0x1ac9('0x63')]({'data':_0x4a3075,'error':_0x256dcc[_0x1ac9('0x64')]});});})[_0x1ac9('0x27')](function(_0x41ad31){return _0x195fb7;})[_0x1ac9('0x47')](function(_0x543b28){return _0x543b28;});}else{_0x40c808[_0x1ac9('0x2f')](0x190)[_0x1ac9('0x23')]({'message':_0x1ac9('0x65')});}});}})['then'](respondWithResult(_0x40c808,null))['catch'](handleError(_0x40c808,null));};exports['getContacts']=function(_0x536833,_0x3d121d,_0x5e5be4){var _0x3e4a2e;return db[_0x1ac9('0x44')][_0x1ac9('0x4c')]({'where':{'id':_0x536833[_0x1ac9('0x48')]['id']},'include':[{'model':db[_0x1ac9('0x66')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x3d121d,null))[_0x1ac9('0x27')](function(_0x557a9d){if(_0x557a9d){_0x3e4a2e=_0x557a9d;return db[_0x1ac9('0x5b')][_0x1ac9('0x32')];}})[_0x1ac9('0x27')](function(_0x554f59){if(_0x554f59){var _0x7a8edb={};var _0x19305d={};_0x19305d['model']=_[_0x1ac9('0x67')](_[_0x1ac9('0x37')](_0x554f59),_['map'](_0x3e4a2e[_0x1ac9('0x68')],function(_0x3d9c1d){return util[_0x1ac9('0x69')]('cf_%d',_0x3d9c1d['id']);}));_0x19305d[_0x1ac9('0x36')]=_['keys'](_0x536833['query']);_0x19305d[_0x1ac9('0x49')]=_['intersection'](_0x19305d[_0x1ac9('0x34')],_0x19305d['query']);_0x7a8edb[_0x1ac9('0x39')]=_[_0x1ac9('0x38')](_0x19305d[_0x1ac9('0x34')],qs[_0x1ac9('0x3a')](_0x536833[_0x1ac9('0x36')][_0x1ac9('0x3a')]));_0x7a8edb[_0x1ac9('0x39')]=_0x7a8edb[_0x1ac9('0x39')][_0x1ac9('0x4a')]?_0x7a8edb[_0x1ac9('0x39')]:_0x19305d[_0x1ac9('0x34')];if(!_0x536833[_0x1ac9('0x36')][_0x1ac9('0x3b')](_0x1ac9('0x3c'))){_0x7a8edb[_0x1ac9('0x1f')]=qs['limit'](_0x536833[_0x1ac9('0x36')]['limit']);_0x7a8edb[_0x1ac9('0x21')]=qs[_0x1ac9('0x21')](_0x536833[_0x1ac9('0x36')][_0x1ac9('0x21')]);}_0x7a8edb[_0x1ac9('0x3d')]=qs['sort'](_0x536833[_0x1ac9('0x36')][_0x1ac9('0x3e')]);_0x7a8edb[_0x1ac9('0x41')]=qs['filters'](_[_0x1ac9('0x3f')](_0x536833[_0x1ac9('0x36')],_0x19305d[_0x1ac9('0x49')]));_0x7a8edb[_0x1ac9('0x6a')]=!![];if(_0x536833['query'][_0x1ac9('0x40')]){_0x7a8edb[_0x1ac9('0x41')]=_[_0x1ac9('0x42')](_0x7a8edb[_0x1ac9('0x41')],{'$or':_[_0x1ac9('0x35')](_0x7a8edb[_0x1ac9('0x39')],function(_0x24f8c2){var _0x5ab645={};_0x5ab645[_0x24f8c2]={'$like':'%'+_0x536833[_0x1ac9('0x36')][_0x1ac9('0x40')]+'%'};return _0x5ab645;})});}_0x7a8edb=_[_0x1ac9('0x42')]({},_0x7a8edb,_0x536833[_0x1ac9('0x4b')]);return _0x3e4a2e[_0x1ac9('0x6b')](_0x7a8edb);}})['then'](respondWithResult(_0x3d121d,null))[_0x1ac9('0x47')](handleError(_0x3d121d,null));};exports[_0x1ac9('0x6c')]=function(_0x54c844,_0x67138b,_0xaf9615){var _0xcfb05b;return db[_0x1ac9('0x44')]['find']({'where':{'id':_0x54c844['params']['id']},'include':[{'model':db[_0x1ac9('0x66')],'as':_0x1ac9('0x68')}]})[_0x1ac9('0x27')](handleEntityNotFound(_0x67138b,null))[_0x1ac9('0x27')](function(_0x59603a){if(_0x59603a){_0xcfb05b=_0x59603a;return db['CmContact'][_0x1ac9('0x32')];}})[_0x1ac9('0x27')](function(_0x4a4d3e){if(_0x4a4d3e){var _0x46ee04={};var _0x18c50b={};_0x18c50b[_0x1ac9('0x34')]=_[_0x1ac9('0x67')](_[_0x1ac9('0x37')](_0x4a4d3e),_[_0x1ac9('0x35')](_0xcfb05b[_0x1ac9('0x68')],function(_0x3366a4){return util['format']('cf_%d',_0x3366a4['id']);}));_0x18c50b[_0x1ac9('0x36')]=_[_0x1ac9('0x37')](_0x54c844[_0x1ac9('0x36')]);_0x18c50b[_0x1ac9('0x49')]=_[_0x1ac9('0x38')](_0x18c50b[_0x1ac9('0x34')],_0x18c50b[_0x1ac9('0x36')]);_0x46ee04['attributes']=_[_0x1ac9('0x38')](_0x18c50b[_0x1ac9('0x34')],qs[_0x1ac9('0x3a')](_0x54c844[_0x1ac9('0x36')]['fields']));_0x46ee04[_0x1ac9('0x39')]=_0x46ee04['attributes'][_0x1ac9('0x4a')]?_0x46ee04['attributes']:_0x18c50b[_0x1ac9('0x34')];if(!_0x54c844[_0x1ac9('0x36')][_0x1ac9('0x3b')]('nolimit')){_0x46ee04[_0x1ac9('0x1f')]=qs[_0x1ac9('0x1f')](_0x54c844[_0x1ac9('0x36')][_0x1ac9('0x1f')]);_0x46ee04[_0x1ac9('0x21')]=qs[_0x1ac9('0x21')](_0x54c844[_0x1ac9('0x36')][_0x1ac9('0x21')]);}_0x46ee04['order']=qs['sort'](_0x54c844[_0x1ac9('0x36')][_0x1ac9('0x3e')]);_0x46ee04[_0x1ac9('0x41')]=qs[_0x1ac9('0x49')](_[_0x1ac9('0x3f')](_0x54c844[_0x1ac9('0x36')],_0x18c50b[_0x1ac9('0x49')]));_0x46ee04[_0x1ac9('0x6a')]=!![];if(_0x54c844[_0x1ac9('0x36')]['filter']){_0x46ee04['where']=_[_0x1ac9('0x42')](_0x46ee04[_0x1ac9('0x41')],{'$or':_[_0x1ac9('0x35')](_0x46ee04[_0x1ac9('0x39')],function(_0x5ddfb4){var _0x49dd9f={};_0x49dd9f[_0x5ddfb4]={'$like':'%'+_0x54c844['query'][_0x1ac9('0x40')]+'%'};return _0x49dd9f;})});}_0x46ee04=_['merge']({},_0x46ee04,_0x54c844['options']);return _0xcfb05b['getContacts'](_0x46ee04);}})['then'](function(_0x6cad1c){if(!_[_0x1ac9('0x6d')](_0x6cad1c)){var _0x5a1ec4=toCsv(_0x6cad1c);var _0x4aab67=Date['now']();fs['writeFileSync'](util[_0x1ac9('0x69')](_0x1ac9('0x6e'),_0xcfb05b['id'],_0x4aab67),_0x5a1ec4);_0x67138b[_0x1ac9('0x6f')]('Content-disposition',_0x1ac9('0x70')+util[_0x1ac9('0x69')]('list_%d_%s.csv',_0xcfb05b['id'],_0x4aab67));_0x67138b['setHeader'](_0x1ac9('0x71'),_0x1ac9('0x72'));return _0x67138b[_0x1ac9('0x73')](util[_0x1ac9('0x69')](_0x1ac9('0x6e'),_0xcfb05b['id'],_0x4aab67));}else{return _0x67138b[_0x1ac9('0x1c')](0xcc);}})['catch'](handleError(_0x67138b,null));};exports[_0x1ac9('0x74')]=function(_0x32356b,_0x4e1ecd,_0x3cf4b2){var _0x2f8301;delete _0x32356b[_0x1ac9('0x54')]['id'];return db[_0x1ac9('0x44')][_0x1ac9('0x58')]({'where':{'id':_0x32356b[_0x1ac9('0x48')]['id']}})[_0x1ac9('0x27')](handleEntityNotFound(_0x4e1ecd,null))[_0x1ac9('0x27')](function(_0x5e56dd){if(_0x5e56dd){return db[_0x1ac9('0x75')]['transaction'](function(_0x34573d){return db[_0x1ac9('0x66')]['create'](_0x32356b['body'],{'transaction':_0x34573d})[_0x1ac9('0x27')](function(_0x1af703){_0x2f8301=_0x1af703;return _0x5e56dd['addCustomFields'](_0x1af703,{'transaction':_0x34573d});})[_0x1ac9('0x27')](function(){var _0x388198={'type':db[_0x1ac9('0x76')][_0x1ac9('0x77')],'transaction':_0x34573d};switch(_0x32356b['body'][_0x1ac9('0x78')]){case'text':_0x388198[_0x1ac9('0x78')]=db['Sequelize'][_0x1ac9('0x77')];break;case _0x1ac9('0x79'):_0x388198[_0x1ac9('0x78')]=db['Sequelize']['INTEGER'];break;case'switch':_0x388198[_0x1ac9('0x78')]=db['Sequelize'][_0x1ac9('0x7a')];_0x388198[_0x1ac9('0x7b')]=![];break;default:}return db[_0x1ac9('0x75')][_0x1ac9('0x7c')][_0x1ac9('0x7d')](_0x1ac9('0x7e'),util[_0x1ac9('0x69')]('cf_%s',_0x2f8301['id']),_0x388198);})[_0x1ac9('0x27')](function(){return _0x2f8301;});});}})[_0x1ac9('0x27')](respondWithResult(_0x4e1ecd,null))[_0x1ac9('0x47')](handleError(_0x4e1ecd,null));};exports[_0x1ac9('0x7f')]=function(_0x1efbe5,_0x31220e,_0x3408df){var _0x2de658={};var _0x29efbf={};var _0x559814;var _0x4163b7;return db[_0x1ac9('0x44')][_0x1ac9('0x58')]({'where':{'id':_0x1efbe5[_0x1ac9('0x48')]['id']}})[_0x1ac9('0x27')](handleEntityNotFound(_0x31220e,null))['then'](function(_0x2011da){if(_0x2011da){_0x559814=_0x2011da;_0x29efbf['model']=_['keys'](db[_0x1ac9('0x66')][_0x1ac9('0x32')]);_0x29efbf[_0x1ac9('0x36')]=_[_0x1ac9('0x37')](_0x1efbe5[_0x1ac9('0x36')]);_0x29efbf[_0x1ac9('0x49')]=_[_0x1ac9('0x38')](_0x29efbf[_0x1ac9('0x34')],_0x29efbf[_0x1ac9('0x36')]);_0x2de658[_0x1ac9('0x39')]=_['intersection'](_0x29efbf[_0x1ac9('0x34')],qs[_0x1ac9('0x3a')](_0x1efbe5[_0x1ac9('0x36')]['fields']));_0x2de658[_0x1ac9('0x39')]=_0x2de658[_0x1ac9('0x39')][_0x1ac9('0x4a')]?_0x2de658['attributes']:_0x29efbf[_0x1ac9('0x34')];_0x2de658[_0x1ac9('0x3d')]=qs[_0x1ac9('0x3e')](_0x1efbe5[_0x1ac9('0x36')][_0x1ac9('0x3e')]);_0x2de658[_0x1ac9('0x41')]=qs[_0x1ac9('0x49')](_[_0x1ac9('0x3f')](_0x1efbe5[_0x1ac9('0x36')],_0x29efbf[_0x1ac9('0x49')]));_0x2de658[_0x1ac9('0x41')]=_['merge'](_0x2de658[_0x1ac9('0x41')],{'$or':[{'ListId':_0x2011da['id']},{'ListId':null}]});if(_0x1efbe5['query'][_0x1ac9('0x40')]){_0x2de658[_0x1ac9('0x41')]=_['merge'](_0x2de658[_0x1ac9('0x41')],{'$or':_[_0x1ac9('0x35')](_0x2de658[_0x1ac9('0x39')],function(_0xcff72d){var _0x4400c4={};_0x4400c4[_0xcff72d]={'$like':'%'+_0x1efbe5['query'][_0x1ac9('0x40')]+'%'};return _0x4400c4;})});}_0x2de658=_[_0x1ac9('0x42')]({},_0x2de658,_0x1efbe5[_0x1ac9('0x4b')]);return db['CmCustomField'][_0x1ac9('0x80')](_0x2de658);}})[_0x1ac9('0x27')](respondWithResult(_0x31220e,null))[_0x1ac9('0x47')](handleError(_0x31220e,null));};exports['addAgents']=function(_0xb416a8,_0x1b163d,_0x3066ba){return db[_0x1ac9('0x44')][_0x1ac9('0x4c')]({'where':{'id':_0xb416a8['params']['id']}})['then'](handleEntityNotFound(_0x1b163d,null))[_0x1ac9('0x27')](function(_0x30bee7){if(_0x30bee7){return _0x30bee7['addAgents'](_0xb416a8[_0x1ac9('0x54')][_0x1ac9('0x5a')],_[_0x1ac9('0x81')](_0xb416a8[_0x1ac9('0x54')],[_0x1ac9('0x5a'),'id'])||{})[_0x1ac9('0x82')](function(_0x267c06){for(var _0x192a46=0x0;_0x192a46<_0xb416a8[_0x1ac9('0x54')][_0x1ac9('0x5a')][_0x1ac9('0x4a')];_0x192a46+=0x1){socket[_0x1ac9('0x83')](_0x1ac9('0x84'),{'UserId':_0xb416a8[_0x1ac9('0x54')][_0x1ac9('0x5a')][_0x192a46],'CmListId':_0xb416a8[_0x1ac9('0x48')]['id']});}return _0x267c06;});}})[_0x1ac9('0x27')](respondWithResult(_0x1b163d,null))[_0x1ac9('0x47')](handleError(_0x1b163d,null));};exports[_0x1ac9('0x85')]=function(_0x243780,_0x419730,_0x2ef1e9){return db[_0x1ac9('0x44')][_0x1ac9('0x4c')]({'where':{'id':_0x243780[_0x1ac9('0x48')]['id']}})[_0x1ac9('0x27')](handleEntityNotFound(_0x419730,null))[_0x1ac9('0x27')](function(_0x298fb2){if(_0x298fb2){return _0x298fb2[_0x1ac9('0x85')](_0x243780['query']['ids'])[_0x1ac9('0x27')](function(){if(_[_0x1ac9('0x5d')](_0x243780[_0x1ac9('0x36')][_0x1ac9('0x5a')])){for(var _0x41d15e=0x0;_0x41d15e<_0x243780[_0x1ac9('0x36')][_0x1ac9('0x5a')][_0x1ac9('0x4a')];_0x41d15e+=0x1){socket[_0x1ac9('0x83')](_0x1ac9('0x86'),{'UserId':Number(_0x243780[_0x1ac9('0x36')][_0x1ac9('0x5a')][_0x41d15e]),'CmListId':Number(_0x243780[_0x1ac9('0x48')]['id'])});}}else{socket[_0x1ac9('0x83')]('userCmList:remove',{'UserId':Number(_0x243780[_0x1ac9('0x36')][_0x1ac9('0x5a')]),'CmListId':Number(_0x243780[_0x1ac9('0x48')]['id'])});}});}})[_0x1ac9('0x27')](respondWithStatusCode(_0x419730,null))[_0x1ac9('0x47')](handleError(_0x419730,null));};exports[_0x1ac9('0x87')]=function(_0x33f245,_0x283405,_0x16278c){var _0x2869d2={};var _0xa73129={};var _0x4aa489;var _0x502e59;return db[_0x1ac9('0x44')][_0x1ac9('0x58')]({'where':{'id':_0x33f245[_0x1ac9('0x48')]['id']}})[_0x1ac9('0x27')](handleEntityNotFound(_0x283405,null))[_0x1ac9('0x27')](function(_0x3813e8){if(_0x3813e8){_0x4aa489=_0x3813e8;_0xa73129[_0x1ac9('0x34')]=_[_0x1ac9('0x37')](db['User'][_0x1ac9('0x32')]);_0xa73129['query']=_[_0x1ac9('0x37')](_0x33f245[_0x1ac9('0x36')]);_0xa73129[_0x1ac9('0x49')]=_[_0x1ac9('0x38')](_0xa73129[_0x1ac9('0x34')],_0xa73129['query']);_0x2869d2['attributes']=_['intersection'](_0xa73129[_0x1ac9('0x34')],qs[_0x1ac9('0x3a')](_0x33f245[_0x1ac9('0x36')][_0x1ac9('0x3a')]));_0x2869d2['attributes']=_0x2869d2[_0x1ac9('0x39')][_0x1ac9('0x4a')]?_0x2869d2['attributes']:_0xa73129['model'];_0x2869d2['order']=qs[_0x1ac9('0x3e')](_0x33f245[_0x1ac9('0x36')][_0x1ac9('0x3e')]);_0x2869d2[_0x1ac9('0x41')]=qs['filters'](_['pick'](_0x33f245['query'],_0xa73129[_0x1ac9('0x49')]));if(_0x33f245[_0x1ac9('0x36')][_0x1ac9('0x40')]){_0x2869d2[_0x1ac9('0x41')]=_['merge'](_0x2869d2['where'],{'$or':_[_0x1ac9('0x35')](_0x2869d2[_0x1ac9('0x39')],function(_0x6ff7e9){var _0x45c79f={};_0x45c79f[_0x6ff7e9]={'$like':'%'+_0x33f245['query']['filter']+'%'};return _0x45c79f;})});}_0x2869d2=_[_0x1ac9('0x42')]({},_0x2869d2,_0x33f245[_0x1ac9('0x4b')]);return _0x4aa489['getAgents'](_0x2869d2);}})[_0x1ac9('0x27')](function(_0x435211){if(_0x435211){_0x502e59=_0x435211[_0x1ac9('0x4a')];if(!_0x33f245[_0x1ac9('0x36')][_0x1ac9('0x3b')](_0x1ac9('0x3c'))){_0x2869d2[_0x1ac9('0x1f')]=qs[_0x1ac9('0x1f')](_0x33f245[_0x1ac9('0x36')]['limit']);_0x2869d2['offset']=qs['offset'](_0x33f245[_0x1ac9('0x36')]['offset']);}return _0x4aa489[_0x1ac9('0x87')](_0x2869d2);}})[_0x1ac9('0x27')](function(_0x1e8922){if(_0x1e8922){return _0x1e8922?{'count':_0x502e59,'rows':_0x1e8922}:null;}})[_0x1ac9('0x27')](respondWithResult(_0x283405,null))['catch'](handleError(_0x283405,null));}; \ No newline at end of file +var _0x8866=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','params','describe','addDisposition','ListId','getDispositions','Disposition','nolimit','include','removeDispositions','addContacts','CmContact','tags','push','each','ids','success','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','omit','userCmList:save','removeAgents','isArray','emit','userCmList:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','save','update','then','Lists','UserProfileResource','destroy','end','name','index','map','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','CmList','includeAll','findAll','rows','catch','show','merge'];(function(_0x1d9dfa,_0x30598d){var _0x252661=function(_0x4bcc24){while(--_0x4bcc24){_0x1d9dfa['push'](_0x1d9dfa['shift']());}};_0x252661(++_0x30598d);}(_0x8866,0xd7));var _0x6886=function(_0x41cc9a,_0x4f8fc4){_0x41cc9a=_0x41cc9a-0x0;var _0x3982e9=_0x8866[_0x41cc9a];return _0x3982e9;};'use strict';var emlformat=require(_0x6886('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6886('0x1'));var jsonpatch=require(_0x6886('0x2'));var rp=require('request-promise');var moment=require(_0x6886('0x3'));var BPromise=require(_0x6886('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6886('0x5'));var sox=require(_0x6886('0x6'));var csv=require(_0x6886('0x7'));var ejs=require(_0x6886('0x8'));var fs=require('fs');var fs_extra=require(_0x6886('0x9'));var _=require(_0x6886('0xa'));var squel=require(_0x6886('0xb'));var crypto=require(_0x6886('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6886('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6886('0xe'));var Papa=require(_0x6886('0xf'));var Redis=require('ioredis');var authService=require(_0x6886('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6886('0x11'));var hardwareService=require(_0x6886('0x12'));var logger=require(_0x6886('0x13'))(_0x6886('0x14'));var utils=require(_0x6886('0x15'));var config=require(_0x6886('0x16'));var licenseUtil=require(_0x6886('0x17'));var db=require(_0x6886('0x18'))['db'];config['redis']=_[_0x6886('0x19')](config[_0x6886('0x1a')],{'host':_0x6886('0x1b'),'port':0x18eb});var socket=require(_0x6886('0x1c'))(new Redis(config[_0x6886('0x1a')]));require(_0x6886('0x1d'))['register'](socket);function respondWithStatusCode(_0x43e8f6,_0x1bf7c7){_0x1bf7c7=_0x1bf7c7||0xcc;return function(_0x2317e6){if(_0x2317e6){return _0x43e8f6[_0x6886('0x1e')](_0x1bf7c7);}return _0x43e8f6[_0x6886('0x1f')](_0x1bf7c7)['end']();};}function respondWithResult(_0x4bb546,_0x4aac13){_0x4aac13=_0x4aac13||0xc8;return function(_0xd3e211){if(_0xd3e211){return _0x4bb546[_0x6886('0x1f')](_0x4aac13)[_0x6886('0x20')](_0xd3e211);}};}function respondWithFilteredResult(_0x567227,_0x9c2971){return function(_0x577715){if(_0x577715){var _0x4c2481=typeof _0x9c2971[_0x6886('0x21')]===_0x6886('0x22')&&typeof _0x9c2971['limit']==='undefined';var _0x1dfb31=_0x577715[_0x6886('0x23')];var _0x5d1c57=_0x4c2481?0x0:_0x9c2971[_0x6886('0x21')];var _0x1eff20=_0x4c2481?_0x577715[_0x6886('0x23')]:_0x9c2971[_0x6886('0x21')]+_0x9c2971[_0x6886('0x24')];var _0x594a6c;if(_0x1eff20>=_0x1dfb31){_0x1eff20=_0x1dfb31;_0x594a6c=0xc8;}else{_0x594a6c=0xce;}_0x567227[_0x6886('0x1f')](_0x594a6c);return _0x567227[_0x6886('0x25')](_0x6886('0x26'),_0x5d1c57+'-'+_0x1eff20+'/'+_0x1dfb31)[_0x6886('0x20')](_0x577715);}return null;};}function patchUpdates(_0x293564){return function(_0x36d67f){try{jsonpatch['apply'](_0x36d67f,_0x293564,!![]);}catch(_0x4fcfb5){return BPromise['reject'](_0x4fcfb5);}return _0x36d67f[_0x6886('0x27')]();};}function saveUpdates(_0x440b0f,_0x3c0a05){return function(_0x3cfdc6){if(_0x3cfdc6){return _0x3cfdc6[_0x6886('0x28')](_0x440b0f)[_0x6886('0x29')](function(_0x4877f5){return _0x4877f5;});}return null;};}function removeEntity(_0x29ae22,_0x3725b4){return function(_0x446ad6){if(_0x446ad6){return _0x446ad6['destroy']()[_0x6886('0x29')](function(){var _0x222a89=_0x446ad6['get']({'plain':!![]});var _0x19c54f=_0x6886('0x2a');return db[_0x6886('0x2b')][_0x6886('0x2c')]({'where':{'type':_0x19c54f,'resourceId':_0x222a89['id']}})['then'](function(){return _0x446ad6;});})[_0x6886('0x29')](function(){_0x29ae22[_0x6886('0x1f')](0xcc)[_0x6886('0x2d')]();});}};}function handleEntityNotFound(_0x4e4e1a,_0x43b840){return function(_0x50e65f){if(!_0x50e65f){_0x4e4e1a[_0x6886('0x1e')](0x194);}return _0x50e65f;};}function handleError(_0x54cf9d,_0x4260b5){_0x4260b5=_0x4260b5||0x1f4;return function(_0x4b38d2){logger['error'](_0x4b38d2['stack']);if(_0x4b38d2['name']){delete _0x4b38d2[_0x6886('0x2e')];}_0x54cf9d['status'](_0x4260b5)['send'](_0x4b38d2);};}exports[_0x6886('0x2f')]=function(_0x36c2c4,_0x3802fb){var _0x4d11f1={},_0x547136={},_0x5a3af6={'count':0x0,'rows':[]};var _0x19597f=_[_0x6886('0x30')](db['CmList'][_0x6886('0x31')],function(_0x3eddbb){return{'name':_0x3eddbb['fieldName'],'type':_0x3eddbb[_0x6886('0x32')][_0x6886('0x33')]};});_0x547136['model']=_[_0x6886('0x30')](_0x19597f,_0x6886('0x2e'));_0x547136[_0x6886('0x34')]=_[_0x6886('0x35')](_0x36c2c4[_0x6886('0x34')]);_0x547136[_0x6886('0x36')]=_[_0x6886('0x37')](_0x547136['model'],_0x547136[_0x6886('0x34')]);_0x4d11f1[_0x6886('0x38')]=_[_0x6886('0x37')](_0x547136[_0x6886('0x39')],qs[_0x6886('0x3a')](_0x36c2c4[_0x6886('0x34')][_0x6886('0x3a')]));_0x4d11f1[_0x6886('0x38')]=_0x4d11f1[_0x6886('0x38')][_0x6886('0x3b')]?_0x4d11f1[_0x6886('0x38')]:_0x547136['model'];if(!_0x36c2c4[_0x6886('0x34')][_0x6886('0x3c')]('nolimit')){_0x4d11f1[_0x6886('0x24')]=qs[_0x6886('0x24')](_0x36c2c4[_0x6886('0x34')][_0x6886('0x24')]);_0x4d11f1[_0x6886('0x21')]=qs[_0x6886('0x21')](_0x36c2c4[_0x6886('0x34')][_0x6886('0x21')]);}_0x4d11f1[_0x6886('0x3d')]=qs[_0x6886('0x3e')](_0x36c2c4['query'][_0x6886('0x3e')]);_0x4d11f1['where']=qs[_0x6886('0x36')](_[_0x6886('0x3f')](_0x36c2c4[_0x6886('0x34')],_0x547136[_0x6886('0x36')]),_0x19597f);if(_0x36c2c4[_0x6886('0x34')][_0x6886('0x40')]){_0x4d11f1[_0x6886('0x41')]=_['merge'](_0x4d11f1[_0x6886('0x41')],{'$or':_[_0x6886('0x30')](_0x19597f,function(_0x3e3e80){if(_0x3e3e80['type']!==_0x6886('0x42')){var _0x46101c={};_0x46101c[_0x3e3e80[_0x6886('0x2e')]]={'$like':'%'+_0x36c2c4[_0x6886('0x34')][_0x6886('0x40')]+'%'};return _0x46101c;}})});}_0x4d11f1=_['merge']({},_0x4d11f1,_0x36c2c4[_0x6886('0x43')]);var _0x5a67fc={'where':_0x4d11f1[_0x6886('0x41')]};return db[_0x6886('0x44')][_0x6886('0x23')](_0x5a67fc)[_0x6886('0x29')](function(_0xec38f7){_0x5a3af6[_0x6886('0x23')]=_0xec38f7;if(_0x36c2c4[_0x6886('0x34')][_0x6886('0x45')]){_0x4d11f1['include']=[{'all':!![]}];}return db[_0x6886('0x44')][_0x6886('0x46')](_0x4d11f1);})[_0x6886('0x29')](function(_0x4a96e9){_0x5a3af6[_0x6886('0x47')]=_0x4a96e9;return _0x5a3af6;})[_0x6886('0x29')](respondWithFilteredResult(_0x3802fb,_0x4d11f1))[_0x6886('0x48')](handleError(_0x3802fb,null));};exports[_0x6886('0x49')]=function(_0xd5525d,_0xf0774b){var _0x4185e5={'raw':![],'where':{'id':_0xd5525d['params']['id']}},_0x20b5db={};_0x20b5db[_0x6886('0x39')]=_[_0x6886('0x35')](db[_0x6886('0x44')][_0x6886('0x31')]);_0x20b5db[_0x6886('0x34')]=_[_0x6886('0x35')](_0xd5525d[_0x6886('0x34')]);_0x20b5db[_0x6886('0x36')]=_[_0x6886('0x37')](_0x20b5db[_0x6886('0x39')],_0x20b5db[_0x6886('0x34')]);_0x4185e5[_0x6886('0x38')]=_[_0x6886('0x37')](_0x20b5db['model'],qs['fields'](_0xd5525d['query'][_0x6886('0x3a')]));_0x4185e5[_0x6886('0x38')]=_0x4185e5[_0x6886('0x38')][_0x6886('0x3b')]?_0x4185e5[_0x6886('0x38')]:_0x20b5db['model'];if(_0xd5525d['query'][_0x6886('0x45')]){_0x4185e5['include']=[{'all':!![]}];}_0x4185e5=_[_0x6886('0x4a')]({},_0x4185e5,_0xd5525d[_0x6886('0x43')]);return db[_0x6886('0x44')][_0x6886('0x4b')](_0x4185e5)['then'](handleEntityNotFound(_0xf0774b,null))[_0x6886('0x29')](respondWithResult(_0xf0774b,null))[_0x6886('0x48')](handleError(_0xf0774b,null));};exports['create']=function(_0x482ece,_0x932dfe){return db[_0x6886('0x44')][_0x6886('0x4c')](_0x482ece[_0x6886('0x4d')],{})[_0x6886('0x29')](function(_0x59021c){var _0x1a8566=_0x482ece[_0x6886('0x4e')]['get']({'plain':!![]});if(!_0x1a8566)throw new Error(_0x6886('0x4f'));if(_0x1a8566['role']===_0x6886('0x4e')){var _0x2a4e98=_0x59021c['get']({'plain':!![]});var _0x260691=_0x6886('0x2a');return db[_0x6886('0x50')][_0x6886('0x4b')]({'where':{'name':_0x260691,'userProfileId':_0x1a8566[_0x6886('0x51')]},'raw':!![]})['then'](function(_0x2293cd){if(_0x2293cd&&_0x2293cd[_0x6886('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x2a4e98[_0x6886('0x2e')],'resourceId':_0x2a4e98['id'],'type':_0x2293cd[_0x6886('0x2e')],'sectionId':_0x2293cd['id']},{})[_0x6886('0x29')](function(){return _0x59021c;});}else{return _0x59021c;}})['catch'](function(_0x140adc){logger[_0x6886('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x140adc);throw _0x140adc;});}return _0x59021c;})['then'](respondWithResult(_0x932dfe,0xc9))[_0x6886('0x48')](handleError(_0x932dfe,null));};exports['update']=function(_0x21d964,_0x203cc6){if(_0x21d964[_0x6886('0x4d')]['id']){delete _0x21d964[_0x6886('0x4d')]['id'];}return db['CmList'][_0x6886('0x4b')]({'where':{'id':_0x21d964[_0x6886('0x54')]['id']}})[_0x6886('0x29')](handleEntityNotFound(_0x203cc6,null))[_0x6886('0x29')](saveUpdates(_0x21d964['body'],null))[_0x6886('0x29')](respondWithResult(_0x203cc6,null))[_0x6886('0x48')](handleError(_0x203cc6,null));};exports[_0x6886('0x2c')]=function(_0x35d68b,_0x5afc59){return db[_0x6886('0x44')][_0x6886('0x4b')]({'where':{'id':_0x35d68b[_0x6886('0x54')]['id']}})[_0x6886('0x29')](handleEntityNotFound(_0x5afc59,null))['then'](removeEntity(_0x5afc59,null))[_0x6886('0x48')](handleError(_0x5afc59,null));};exports[_0x6886('0x55')]=function(_0x5611aa,_0x4a9911){return db[_0x6886('0x44')][_0x6886('0x55')]()['then'](respondWithResult(_0x4a9911,null))[_0x6886('0x48')](handleError(_0x4a9911,null));};exports[_0x6886('0x56')]=function(_0x221924,_0x5220c0,_0x34bcb6){if(_0x221924[_0x6886('0x4d')]['id']){delete _0x221924[_0x6886('0x4d')]['id'];}return db[_0x6886('0x44')][_0x6886('0x4b')]({'where':{'id':_0x221924[_0x6886('0x54')]['id']}})[_0x6886('0x29')](handleEntityNotFound(_0x5220c0,null))[_0x6886('0x29')](function(_0x4edd81){if(_0x4edd81){_0x221924['body'][_0x6886('0x57')]=_0x4edd81['id'];return db['Disposition'][_0x6886('0x4c')](_0x221924[_0x6886('0x4d')]);}})[_0x6886('0x29')](respondWithResult(_0x5220c0,null))[_0x6886('0x48')](handleError(_0x5220c0,null));};exports[_0x6886('0x58')]=function(_0x1481b5,_0x3ad792,_0x260852){var _0x10b171={'raw':![],'where':{}};var _0x52a769={};var _0x43bf9c={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x1481b5['params']['id']}})['then'](handleEntityNotFound(_0x3ad792,null))[_0x6886('0x29')](function(_0x2cd822){if(_0x2cd822){_0x52a769['model']=_[_0x6886('0x35')](db[_0x6886('0x59')][_0x6886('0x31')]);_0x52a769[_0x6886('0x34')]=_[_0x6886('0x35')](_0x1481b5[_0x6886('0x34')]);_0x52a769[_0x6886('0x36')]=_[_0x6886('0x37')](_0x52a769[_0x6886('0x39')],_0x52a769[_0x6886('0x34')]);_0x10b171[_0x6886('0x38')]=_[_0x6886('0x37')](_0x52a769[_0x6886('0x39')],qs[_0x6886('0x3a')](_0x1481b5[_0x6886('0x34')]['fields']));_0x10b171['attributes']=_0x10b171[_0x6886('0x38')]['length']?_0x10b171[_0x6886('0x38')]:_0x52a769[_0x6886('0x39')];if(!_0x1481b5[_0x6886('0x34')][_0x6886('0x3c')](_0x6886('0x5a'))){_0x10b171['limit']=qs[_0x6886('0x24')](_0x1481b5['query']['limit']);_0x10b171[_0x6886('0x21')]=qs[_0x6886('0x21')](_0x1481b5['query'][_0x6886('0x21')]);}_0x10b171[_0x6886('0x3d')]=qs[_0x6886('0x3e')](_0x1481b5[_0x6886('0x34')]['sort']);_0x10b171[_0x6886('0x41')]=qs[_0x6886('0x36')](_[_0x6886('0x3f')](_0x1481b5[_0x6886('0x34')],_0x52a769[_0x6886('0x36')]));_0x10b171['where'][_0x6886('0x57')]=_0x2cd822['id'];if(_0x1481b5[_0x6886('0x34')][_0x6886('0x40')]){_0x10b171[_0x6886('0x41')]=_[_0x6886('0x4a')](_0x10b171[_0x6886('0x41')],{'$or':_[_0x6886('0x30')](_0x10b171[_0x6886('0x38')],function(_0x599d76){var _0x5267db={};_0x5267db[_0x599d76]={'$like':'%'+_0x1481b5[_0x6886('0x34')]['filter']+'%'};return _0x5267db;})});}_0x10b171=_[_0x6886('0x4a')]({},_0x10b171,_0x1481b5[_0x6886('0x43')]);return db[_0x6886('0x59')]['count']({'where':_0x10b171[_0x6886('0x41')]})['then'](function(_0x1b955b){_0x43bf9c[_0x6886('0x23')]=_0x1b955b;if(_0x1481b5[_0x6886('0x34')][_0x6886('0x45')]){_0x10b171[_0x6886('0x5b')]=[{'all':!![]}];}return db[_0x6886('0x59')][_0x6886('0x46')](_0x10b171);})['then'](function(_0xf2df74){_0x43bf9c[_0x6886('0x47')]=_0xf2df74;return _0x43bf9c;});}})[_0x6886('0x29')](respondWithFilteredResult(_0x3ad792,_0x10b171))[_0x6886('0x48')](handleError(_0x3ad792,null));};exports[_0x6886('0x5c')]=function(_0x3a01b5,_0x594441,_0xa7b565){return db[_0x6886('0x44')][_0x6886('0x4b')]({'where':{'id':_0x3a01b5[_0x6886('0x54')]['id']}})['then'](handleEntityNotFound(_0x594441,null))[_0x6886('0x29')](function(_0x3b9800){if(_0x3b9800){return _0x3b9800[_0x6886('0x5c')](_0x3a01b5[_0x6886('0x34')]['ids']);}})[_0x6886('0x29')](respondWithStatusCode(_0x594441,null))['catch'](handleError(_0x594441,null));};exports[_0x6886('0x5d')]=function(_0x1ae972,_0x25a6d2,_0x2619c8){return db[_0x6886('0x44')][_0x6886('0x4b')]({'where':{'id':_0x1ae972[_0x6886('0x54')]['id']}})[_0x6886('0x29')](handleEntityNotFound(_0x25a6d2,null))['then'](function(_0x17fcca){if(_0x17fcca){var _0x20fd04=[];var _0x437ab5={'success':[],'errors':[]};return db[_0x6886('0x5e')]['describe']()[_0x6886('0x29')](function(_0x1ac18d){if(_0x1ae972[_0x6886('0x4d')][_0x6886('0x5f')]&&_['isArray'](_0x1ae972['body']['tags'])){if(_0x1ae972[_0x6886('0x4d')]['tags'][_0x6886('0x3b')]){_0x1ae972[_0x6886('0x4d')][_0x6886('0x5f')]=_0x1ae972['body'][_0x6886('0x5f')]['join'](';')+';';}else{_0x1ae972[_0x6886('0x4d')][_0x6886('0x5f')]=null;}}else{_0x1ae972['body'][_0x6886('0x5f')]=null;}if(_0x1ae972[_0x6886('0x4d')]&&_['isArray'](_0x1ae972[_0x6886('0x4d')])){for(var _0x4f06c3=0x0;_0x4f06c3<_0x1ae972[_0x6886('0x4d')][_0x6886('0x3b')];_0x4f06c3+=0x1){_0x1ae972[_0x6886('0x4d')][_0x4f06c3][_0x6886('0x57')]=_0x1ae972[_0x6886('0x54')]['id'];_0x20fd04[_0x6886('0x60')](_0x1ae972[_0x6886('0x4d')][_0x4f06c3]);}return BPromise[_0x6886('0x61')](_0x20fd04,function(_0x1cd929){return db[_0x6886('0x5e')][_0x6886('0x4c')](_['omit'](_0x1cd929,[_0x6886('0x62'),'id'])||{},{'fields':_[_0x6886('0x35')](_0x1ac18d),'raw':!![]})[_0x6886('0x29')](function(_0x1e8939){_0x437ab5[_0x6886('0x63')][_0x6886('0x60')](_0x1e8939['dataValues']);})[_0x6886('0x48')](function(_0x4d9b24){_0x437ab5[_0x6886('0x64')][_0x6886('0x60')]({'data':_0x1cd929,'error':_0x4d9b24[_0x6886('0x65')]});});})[_0x6886('0x29')](function(_0x165046){return _0x437ab5;})[_0x6886('0x48')](function(_0xaa0d69){return _0xaa0d69;});}else{_0x25a6d2[_0x6886('0x1f')](0x190)[_0x6886('0x20')]({'message':_0x6886('0x66')});}});}})['then'](respondWithResult(_0x25a6d2,null))[_0x6886('0x48')](handleError(_0x25a6d2,null));};exports[_0x6886('0x67')]=function(_0x19770f,_0xe89cc0,_0x43761c){var _0x3159a7;return db[_0x6886('0x44')][_0x6886('0x4b')]({'where':{'id':_0x19770f[_0x6886('0x54')]['id']},'include':[{'model':db[_0x6886('0x68')],'as':_0x6886('0x69')}]})[_0x6886('0x29')](handleEntityNotFound(_0xe89cc0,null))[_0x6886('0x29')](function(_0x5680d5){if(_0x5680d5){_0x3159a7=_0x5680d5;return db['CmContact'][_0x6886('0x31')];}})[_0x6886('0x29')](function(_0x261cde){if(_0x261cde){var _0x1d8fe6={};var _0x584d01={};_0x584d01['model']=_[_0x6886('0x6a')](_['keys'](_0x261cde),_[_0x6886('0x30')](_0x3159a7[_0x6886('0x69')],function(_0x603f61){return util[_0x6886('0x6b')](_0x6886('0x6c'),_0x603f61['id']);}));_0x584d01[_0x6886('0x34')]=_[_0x6886('0x35')](_0x19770f[_0x6886('0x34')]);_0x584d01[_0x6886('0x36')]=_[_0x6886('0x37')](_0x584d01[_0x6886('0x39')],_0x584d01[_0x6886('0x34')]);_0x1d8fe6[_0x6886('0x38')]=_['intersection'](_0x584d01[_0x6886('0x39')],qs['fields'](_0x19770f[_0x6886('0x34')][_0x6886('0x3a')]));_0x1d8fe6[_0x6886('0x38')]=_0x1d8fe6[_0x6886('0x38')][_0x6886('0x3b')]?_0x1d8fe6[_0x6886('0x38')]:_0x584d01[_0x6886('0x39')];if(!_0x19770f['query'][_0x6886('0x3c')]('nolimit')){_0x1d8fe6[_0x6886('0x24')]=qs['limit'](_0x19770f[_0x6886('0x34')]['limit']);_0x1d8fe6[_0x6886('0x21')]=qs[_0x6886('0x21')](_0x19770f['query'][_0x6886('0x21')]);}_0x1d8fe6[_0x6886('0x3d')]=qs[_0x6886('0x3e')](_0x19770f[_0x6886('0x34')][_0x6886('0x3e')]);_0x1d8fe6[_0x6886('0x41')]=qs[_0x6886('0x36')](_[_0x6886('0x3f')](_0x19770f[_0x6886('0x34')],_0x584d01[_0x6886('0x36')]));_0x1d8fe6[_0x6886('0x6d')]=!![];if(_0x19770f[_0x6886('0x34')][_0x6886('0x40')]){_0x1d8fe6[_0x6886('0x41')]=_[_0x6886('0x4a')](_0x1d8fe6['where'],{'$or':_[_0x6886('0x30')](_0x1d8fe6[_0x6886('0x38')],function(_0x1c3a4a){var _0x2b3d49={};_0x2b3d49[_0x1c3a4a]={'$like':'%'+_0x19770f[_0x6886('0x34')]['filter']+'%'};return _0x2b3d49;})});}_0x1d8fe6=_[_0x6886('0x4a')]({},_0x1d8fe6,_0x19770f[_0x6886('0x43')]);return _0x3159a7[_0x6886('0x67')](_0x1d8fe6);}})[_0x6886('0x29')](respondWithResult(_0xe89cc0,null))['catch'](handleError(_0xe89cc0,null));};exports['getContactsCsv']=function(_0xe0c245,_0x1c5bae,_0x54db71){var _0x15841e;return db[_0x6886('0x44')][_0x6886('0x4b')]({'where':{'id':_0xe0c245[_0x6886('0x54')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x6886('0x69')}]})['then'](handleEntityNotFound(_0x1c5bae,null))['then'](function(_0x5bca58){if(_0x5bca58){_0x15841e=_0x5bca58;return db[_0x6886('0x5e')][_0x6886('0x31')];}})['then'](function(_0xb892f8){if(_0xb892f8){var _0x34aa8a={};var _0x2480e7={};_0x2480e7[_0x6886('0x39')]=_[_0x6886('0x6a')](_['keys'](_0xb892f8),_[_0x6886('0x30')](_0x15841e[_0x6886('0x69')],function(_0x22915b){return util[_0x6886('0x6b')](_0x6886('0x6c'),_0x22915b['id']);}));_0x2480e7[_0x6886('0x34')]=_['keys'](_0xe0c245[_0x6886('0x34')]);_0x2480e7[_0x6886('0x36')]=_[_0x6886('0x37')](_0x2480e7['model'],_0x2480e7[_0x6886('0x34')]);_0x34aa8a[_0x6886('0x38')]=_[_0x6886('0x37')](_0x2480e7['model'],qs[_0x6886('0x3a')](_0xe0c245[_0x6886('0x34')][_0x6886('0x3a')]));_0x34aa8a[_0x6886('0x38')]=_0x34aa8a[_0x6886('0x38')][_0x6886('0x3b')]?_0x34aa8a[_0x6886('0x38')]:_0x2480e7[_0x6886('0x39')];if(!_0xe0c245[_0x6886('0x34')][_0x6886('0x3c')](_0x6886('0x5a'))){_0x34aa8a[_0x6886('0x24')]=qs[_0x6886('0x24')](_0xe0c245[_0x6886('0x34')]['limit']);_0x34aa8a['offset']=qs['offset'](_0xe0c245[_0x6886('0x34')]['offset']);}_0x34aa8a[_0x6886('0x3d')]=qs[_0x6886('0x3e')](_0xe0c245['query'][_0x6886('0x3e')]);_0x34aa8a[_0x6886('0x41')]=qs['filters'](_['pick'](_0xe0c245[_0x6886('0x34')],_0x2480e7['filters']));_0x34aa8a[_0x6886('0x6d')]=!![];if(_0xe0c245[_0x6886('0x34')][_0x6886('0x40')]){_0x34aa8a[_0x6886('0x41')]=_[_0x6886('0x4a')](_0x34aa8a[_0x6886('0x41')],{'$or':_[_0x6886('0x30')](_0x34aa8a[_0x6886('0x38')],function(_0x59f621){var _0x4f51fa={};_0x4f51fa[_0x59f621]={'$like':'%'+_0xe0c245[_0x6886('0x34')][_0x6886('0x40')]+'%'};return _0x4f51fa;})});}_0x34aa8a=_[_0x6886('0x4a')]({},_0x34aa8a,_0xe0c245['options']);return _0x15841e[_0x6886('0x67')](_0x34aa8a);}})[_0x6886('0x29')](function(_0x1fb18c){if(!_[_0x6886('0x6e')](_0x1fb18c)){var _0x3d740d=toCsv(_0x1fb18c);var _0x328026=Date[_0x6886('0x6f')]();fs['writeFileSync'](util[_0x6886('0x6b')](_0x6886('0x70'),_0x15841e['id'],_0x328026),_0x3d740d);_0x1c5bae[_0x6886('0x71')](_0x6886('0x72'),_0x6886('0x73')+util['format'](_0x6886('0x74'),_0x15841e['id'],_0x328026));_0x1c5bae[_0x6886('0x71')](_0x6886('0x75'),'text/csv');return _0x1c5bae[_0x6886('0x76')](util['format'](_0x6886('0x70'),_0x15841e['id'],_0x328026));}else{return _0x1c5bae[_0x6886('0x1e')](0xcc);}})[_0x6886('0x48')](handleError(_0x1c5bae,null));};exports[_0x6886('0x77')]=function(_0x21234f,_0x165fb0,_0x4b422c){var _0x55b6d8;delete _0x21234f['body']['id'];return db[_0x6886('0x44')][_0x6886('0x78')]({'where':{'id':_0x21234f[_0x6886('0x54')]['id']}})[_0x6886('0x29')](handleEntityNotFound(_0x165fb0,null))[_0x6886('0x29')](function(_0x15ef7d){if(_0x15ef7d){return db[_0x6886('0x79')][_0x6886('0x7a')](function(_0x44d483){return db['CmCustomField'][_0x6886('0x4c')](_0x21234f[_0x6886('0x4d')],{'transaction':_0x44d483})['then'](function(_0x6b3bdf){_0x55b6d8=_0x6b3bdf;return _0x15ef7d[_0x6886('0x7b')](_0x6b3bdf,{'transaction':_0x44d483});})[_0x6886('0x29')](function(){var _0x49583f={'type':db[_0x6886('0x7c')][_0x6886('0x7d')],'transaction':_0x44d483};switch(_0x21234f[_0x6886('0x4d')][_0x6886('0x32')]){case'text':_0x49583f[_0x6886('0x32')]=db[_0x6886('0x7c')]['TEXT'];break;case _0x6886('0x7e'):_0x49583f[_0x6886('0x32')]=db['Sequelize'][_0x6886('0x7f')];break;case _0x6886('0x80'):_0x49583f['type']=db[_0x6886('0x7c')][_0x6886('0x81')];_0x49583f['defaultValue']=![];break;default:}return db[_0x6886('0x79')][_0x6886('0x82')][_0x6886('0x83')](_0x6886('0x84'),util[_0x6886('0x6b')](_0x6886('0x85'),_0x55b6d8['id']),_0x49583f);})[_0x6886('0x29')](function(){return _0x55b6d8;});});}})['then'](respondWithResult(_0x165fb0,null))[_0x6886('0x48')](handleError(_0x165fb0,null));};exports[_0x6886('0x86')]=function(_0x52c9ee,_0x5389e5,_0x577e6b){var _0xab2e4={};var _0x461be2={};var _0x24ed74;var _0x3acd9a;return db['CmList'][_0x6886('0x78')]({'where':{'id':_0x52c9ee[_0x6886('0x54')]['id']}})[_0x6886('0x29')](handleEntityNotFound(_0x5389e5,null))[_0x6886('0x29')](function(_0xbf5dda){if(_0xbf5dda){_0x24ed74=_0xbf5dda;_0x461be2[_0x6886('0x39')]=_[_0x6886('0x35')](db[_0x6886('0x68')]['rawAttributes']);_0x461be2[_0x6886('0x34')]=_[_0x6886('0x35')](_0x52c9ee[_0x6886('0x34')]);_0x461be2[_0x6886('0x36')]=_[_0x6886('0x37')](_0x461be2['model'],_0x461be2['query']);_0xab2e4[_0x6886('0x38')]=_['intersection'](_0x461be2['model'],qs['fields'](_0x52c9ee['query'][_0x6886('0x3a')]));_0xab2e4['attributes']=_0xab2e4['attributes'][_0x6886('0x3b')]?_0xab2e4['attributes']:_0x461be2[_0x6886('0x39')];_0xab2e4['order']=qs[_0x6886('0x3e')](_0x52c9ee[_0x6886('0x34')][_0x6886('0x3e')]);_0xab2e4[_0x6886('0x41')]=qs[_0x6886('0x36')](_[_0x6886('0x3f')](_0x52c9ee[_0x6886('0x34')],_0x461be2[_0x6886('0x36')]));_0xab2e4['where']=_[_0x6886('0x4a')](_0xab2e4[_0x6886('0x41')],{'$or':[{'ListId':_0xbf5dda['id']},{'ListId':null}]});if(_0x52c9ee[_0x6886('0x34')][_0x6886('0x40')]){_0xab2e4[_0x6886('0x41')]=_[_0x6886('0x4a')](_0xab2e4[_0x6886('0x41')],{'$or':_[_0x6886('0x30')](_0xab2e4[_0x6886('0x38')],function(_0x3033f5){var _0x44422b={};_0x44422b[_0x3033f5]={'$like':'%'+_0x52c9ee['query'][_0x6886('0x40')]+'%'};return _0x44422b;})});}_0xab2e4=_['merge']({},_0xab2e4,_0x52c9ee['options']);return db[_0x6886('0x68')][_0x6886('0x87')](_0xab2e4);}})['then'](respondWithResult(_0x5389e5,null))[_0x6886('0x48')](handleError(_0x5389e5,null));};exports[_0x6886('0x88')]=function(_0x406d9c,_0x58ca1a,_0x37bdbc){return db[_0x6886('0x44')][_0x6886('0x4b')]({'where':{'id':_0x406d9c[_0x6886('0x54')]['id']}})[_0x6886('0x29')](handleEntityNotFound(_0x58ca1a,null))['then'](function(_0xee3ba){if(_0xee3ba){return _0xee3ba[_0x6886('0x88')](_0x406d9c['body'][_0x6886('0x62')],_[_0x6886('0x89')](_0x406d9c[_0x6886('0x4d')],['ids','id'])||{})['spread'](function(_0xf4ec58){for(var _0x5f3ac1=0x0;_0x5f3ac1<_0x406d9c[_0x6886('0x4d')][_0x6886('0x62')]['length'];_0x5f3ac1+=0x1){socket['emit'](_0x6886('0x8a'),{'UserId':_0x406d9c[_0x6886('0x4d')]['ids'][_0x5f3ac1],'CmListId':_0x406d9c[_0x6886('0x54')]['id']});}return _0xf4ec58;});}})[_0x6886('0x29')](respondWithResult(_0x58ca1a,null))[_0x6886('0x48')](handleError(_0x58ca1a,null));};exports[_0x6886('0x8b')]=function(_0x111ed3,_0x4c2734,_0x3a5100){return db['CmList']['find']({'where':{'id':_0x111ed3['params']['id']}})[_0x6886('0x29')](handleEntityNotFound(_0x4c2734,null))[_0x6886('0x29')](function(_0x1510ff){if(_0x1510ff){return _0x1510ff[_0x6886('0x8b')](_0x111ed3[_0x6886('0x34')][_0x6886('0x62')])[_0x6886('0x29')](function(){if(_[_0x6886('0x8c')](_0x111ed3['query'][_0x6886('0x62')])){for(var _0x5334b5=0x0;_0x5334b5<_0x111ed3[_0x6886('0x34')][_0x6886('0x62')][_0x6886('0x3b')];_0x5334b5+=0x1){socket[_0x6886('0x8d')](_0x6886('0x8e'),{'UserId':Number(_0x111ed3[_0x6886('0x34')][_0x6886('0x62')][_0x5334b5]),'CmListId':Number(_0x111ed3[_0x6886('0x54')]['id'])});}}else{socket[_0x6886('0x8d')]('userCmList:remove',{'UserId':Number(_0x111ed3[_0x6886('0x34')][_0x6886('0x62')]),'CmListId':Number(_0x111ed3['params']['id'])});}});}})[_0x6886('0x29')](respondWithStatusCode(_0x4c2734,null))[_0x6886('0x48')](handleError(_0x4c2734,null));};exports[_0x6886('0x8f')]=function(_0x1a2700,_0x1e7100,_0x418c90){var _0xe6f8fd={};var _0x1705ed={};var _0x8485c9;var _0x4d9ee5;return db[_0x6886('0x44')][_0x6886('0x78')]({'where':{'id':_0x1a2700[_0x6886('0x54')]['id']}})[_0x6886('0x29')](handleEntityNotFound(_0x1e7100,null))[_0x6886('0x29')](function(_0x30aaf5){if(_0x30aaf5){_0x8485c9=_0x30aaf5;_0x1705ed['model']=_[_0x6886('0x35')](db[_0x6886('0x90')][_0x6886('0x31')]);_0x1705ed[_0x6886('0x34')]=_[_0x6886('0x35')](_0x1a2700[_0x6886('0x34')]);_0x1705ed[_0x6886('0x36')]=_['intersection'](_0x1705ed[_0x6886('0x39')],_0x1705ed[_0x6886('0x34')]);_0xe6f8fd[_0x6886('0x38')]=_[_0x6886('0x37')](_0x1705ed['model'],qs[_0x6886('0x3a')](_0x1a2700[_0x6886('0x34')][_0x6886('0x3a')]));_0xe6f8fd[_0x6886('0x38')]=_0xe6f8fd[_0x6886('0x38')][_0x6886('0x3b')]?_0xe6f8fd[_0x6886('0x38')]:_0x1705ed['model'];_0xe6f8fd[_0x6886('0x3d')]=qs[_0x6886('0x3e')](_0x1a2700[_0x6886('0x34')][_0x6886('0x3e')]);_0xe6f8fd[_0x6886('0x41')]=qs[_0x6886('0x36')](_[_0x6886('0x3f')](_0x1a2700['query'],_0x1705ed['filters']));if(_0x1a2700[_0x6886('0x34')]['filter']){_0xe6f8fd[_0x6886('0x41')]=_[_0x6886('0x4a')](_0xe6f8fd[_0x6886('0x41')],{'$or':_[_0x6886('0x30')](_0xe6f8fd[_0x6886('0x38')],function(_0x3049f7){var _0x3a395a={};_0x3a395a[_0x3049f7]={'$like':'%'+_0x1a2700[_0x6886('0x34')][_0x6886('0x40')]+'%'};return _0x3a395a;})});}_0xe6f8fd=_['merge']({},_0xe6f8fd,_0x1a2700[_0x6886('0x43')]);return _0x8485c9[_0x6886('0x8f')](_0xe6f8fd);}})[_0x6886('0x29')](function(_0x475989){if(_0x475989){_0x4d9ee5=_0x475989[_0x6886('0x3b')];if(!_0x1a2700['query'][_0x6886('0x3c')](_0x6886('0x5a'))){_0xe6f8fd[_0x6886('0x24')]=qs[_0x6886('0x24')](_0x1a2700[_0x6886('0x34')][_0x6886('0x24')]);_0xe6f8fd[_0x6886('0x21')]=qs['offset'](_0x1a2700[_0x6886('0x34')][_0x6886('0x21')]);}return _0x8485c9['getAgents'](_0xe6f8fd);}})[_0x6886('0x29')](function(_0x2bf9cc){if(_0x2bf9cc){return _0x2bf9cc?{'count':_0x4d9ee5,'rows':_0x2bf9cc}:null;}})[_0x6886('0x29')](respondWithResult(_0x1e7100,null))[_0x6886('0x48')](handleError(_0x1e7100,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index a327f4f..94d2c58 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 _0x8cf2=['emit','hasOwnProperty','exports','events','../../mysqldb','CmList','setMaxListeners','update'];(function(_0x5d40d7,_0x98db11){var _0xbc0571=function(_0x57bed5){while(--_0x57bed5){_0x5d40d7['push'](_0x5d40d7['shift']());}};_0xbc0571(++_0x98db11);}(_0x8cf2,0xa3));var _0x28cf=function(_0x1eb6b3,_0x342dad){_0x1eb6b3=_0x1eb6b3-0x0;var _0x5f20d6=_0x8cf2[_0x1eb6b3];return _0x5f20d6;};'use strict';var EventEmitter=require(_0x28cf('0x0'));var CmList=require(_0x28cf('0x1'))['db'][_0x28cf('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x28cf('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x28cf('0x4'),'afterDestroy':'remove'};function emitEvent(_0x238726){return function(_0x23e81c,_0x4b4ab0,_0x1ab752){CmListEvents['emit'](_0x238726+':'+_0x23e81c['id'],_0x23e81c);CmListEvents[_0x28cf('0x5')](_0x238726,_0x23e81c);_0x1ab752(null);};}for(var e in events){if(events[_0x28cf('0x6')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x28cf('0x7')]=CmListEvents; \ No newline at end of file +var _0x61d4=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x7290bf,_0x10acee){var _0x1027b6=function(_0x4a7324){while(--_0x4a7324){_0x7290bf['push'](_0x7290bf['shift']());}};_0x1027b6(++_0x10acee);}(_0x61d4,0x8f));var _0x461d=function(_0x4bf264,_0x3be730){_0x4bf264=_0x4bf264-0x0;var _0x3c855f=_0x61d4[_0x4bf264];return _0x3c855f;};'use strict';var EventEmitter=require(_0x461d('0x0'));var CmList=require(_0x461d('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x461d('0x2')](0x0);var events={'afterCreate':_0x461d('0x3'),'afterUpdate':_0x461d('0x4'),'afterDestroy':_0x461d('0x5')};function emitEvent(_0x497c10){return function(_0x1a3e68,_0x1fcf4b,_0x218e82){CmListEvents[_0x461d('0x6')](_0x497c10+':'+_0x1a3e68['id'],_0x1a3e68);CmListEvents[_0x461d('0x6')](_0x497c10,_0x1a3e68);_0x218e82(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x461d('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index c0d4592..1675165 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 _0xa039=['define','CmList','cm_lists','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes'];(function(_0x20f29a,_0x356b75){var _0x31ce67=function(_0x1ff689){while(--_0x1ff689){_0x20f29a['push'](_0x20f29a['shift']());}};_0x31ce67(++_0x356b75);}(_0xa039,0x177));var _0x9a03=function(_0x2aed27,_0x511606){_0x2aed27=_0x2aed27-0x0;var _0x3db47a=_0xa039[_0x2aed27];return _0x3db47a;};'use strict';var _=require(_0x9a03('0x0'));var util=require(_0x9a03('0x1'));var logger=require('../../config/logger')(_0x9a03('0x2'));var moment=require('moment');var BPromise=require(_0x9a03('0x3'));var rp=require(_0x9a03('0x4'));var fs=require('fs');var path=require(_0x9a03('0x5'));var rimraf=require(_0x9a03('0x6'));var config=require(_0x9a03('0x7'));var attributes=require(_0x9a03('0x8'));module['exports']=function(_0x4bb700,_0xfff9b8){return _0x4bb700[_0x9a03('0x9')](_0x9a03('0xa'),attributes,{'tableName':_0x9a03('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe400=['rimraf','../../config/environment','./cmList.attributes','define','CmList','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1dc8fb,_0x36a108){var _0x3a2b2a=function(_0x3647a7){while(--_0x3647a7){_0x1dc8fb['push'](_0x1dc8fb['shift']());}};_0x3a2b2a(++_0x36a108);}(_0xe400,0xa1));var _0x0e40=function(_0x497350,_0xd12725){_0x497350=_0x497350-0x0;var _0x1d36eb=_0xe400[_0x497350];return _0x1d36eb;};'use strict';var _=require(_0x0e40('0x0'));var util=require(_0x0e40('0x1'));var logger=require(_0x0e40('0x2'))(_0x0e40('0x3'));var moment=require('moment');var BPromise=require(_0x0e40('0x4'));var rp=require(_0x0e40('0x5'));var fs=require('fs');var path=require(_0x0e40('0x6'));var rimraf=require(_0x0e40('0x7'));var config=require(_0x0e40('0x8'));var attributes=require(_0x0e40('0x9'));module['exports']=function(_0x23edd7,_0xddfa97){return _0x23edd7[_0x0e40('0xa')](_0x0e40('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 2effc77..7aba062 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 _0xc102=['request','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./cmList.socket','register'];(function(_0x28cf7a,_0x1438eb){var _0x3fe871=function(_0x2b26e6){while(--_0x2b26e6){_0x28cf7a['push'](_0x28cf7a['shift']());}};_0x3fe871(++_0x1438eb);}(_0xc102,0x77));var _0x2c10=function(_0x9cf36c,_0x3d8f0c){_0x9cf36c=_0x9cf36c-0x0;var _0x2bb13d=_0xc102[_0x9cf36c];return _0x2bb13d;};'use strict';var _=require(_0x2c10('0x0'));var util=require(_0x2c10('0x1'));var moment=require(_0x2c10('0x2'));var BPromise=require(_0x2c10('0x3'));var rs=require(_0x2c10('0x4'));var fs=require('fs');var Redis=require(_0x2c10('0x5'));var db=require(_0x2c10('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c10('0x7'))('rpc');var config=require(_0x2c10('0x8'));var jayson=require(_0x2c10('0x9'));var client=jayson[_0x2c10('0xa')]['http']({'port':0x232a});config[_0x2c10('0xb')]=_[_0x2c10('0xc')](config['redis'],{'host':_0x2c10('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2c10('0xb')]));require(_0x2c10('0xe'))[_0x2c10('0xf')](socket);function respondWithRpcPromise(_0x49af80,_0x5bd92d,_0x54c0d6){return new BPromise(function(_0x5da98b,_0x428a8a){return client[_0x2c10('0x10')](_0x49af80,_0x54c0d6)['then'](function(_0x44ed30){logger[_0x2c10('0x11')]('CmList,\x20%s,\x20%s',_0x5bd92d,_0x2c10('0x12'));logger[_0x2c10('0x13')](_0x2c10('0x14'),_0x5bd92d,_0x2c10('0x12'),JSON[_0x2c10('0x15')](_0x44ed30));if(_0x44ed30[_0x2c10('0x16')]){if(_0x44ed30[_0x2c10('0x16')][_0x2c10('0x17')]===0x1f4){logger[_0x2c10('0x16')](_0x2c10('0x18'),_0x5bd92d,_0x44ed30[_0x2c10('0x16')][_0x2c10('0x19')]);return _0x428a8a(_0x44ed30['error'][_0x2c10('0x19')]);}logger[_0x2c10('0x16')]('CmList,\x20%s,\x20%s',_0x5bd92d,_0x44ed30[_0x2c10('0x16')][_0x2c10('0x19')]);return _0x5da98b(_0x44ed30['error'][_0x2c10('0x19')]);}else{logger[_0x2c10('0x11')](_0x2c10('0x18'),_0x5bd92d,'request\x20sent');_0x5da98b(_0x44ed30['result'][_0x2c10('0x19')]);}})[_0x2c10('0x1a')](function(_0x4c4c6e){logger[_0x2c10('0x16')](_0x2c10('0x18'),_0x5bd92d,_0x4c4c6e);_0x428a8a(_0x4c4c6e);});});} \ No newline at end of file +var _0x81c6=['CmList,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./cmList.socket','request','then'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x81c6,0x1d5));var _0x681c=function(_0x3fb743,_0x2b6886){_0x3fb743=_0x3fb743-0x0;var _0x135901=_0x81c6[_0x3fb743];return _0x135901;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x681c('0x1'));var db=require(_0x681c('0x2'))['db'];var utils=require(_0x681c('0x3'));var logger=require('../../config/logger')(_0x681c('0x4'));var config=require(_0x681c('0x5'));var jayson=require(_0x681c('0x6'));var client=jayson[_0x681c('0x7')]['http']({'port':0x232a});config[_0x681c('0x8')]=_[_0x681c('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x681c('0xa'))(new Redis(config[_0x681c('0x8')]));require(_0x681c('0xb'))['register'](socket);function respondWithRpcPromise(_0x4f0228,_0x3e3770,_0x4ff60b){return new BPromise(function(_0x82b6ad,_0x83927a){return client[_0x681c('0xc')](_0x4f0228,_0x4ff60b)[_0x681c('0xd')](function(_0x48dc05){logger['info'](_0x681c('0xe'),_0x3e3770,_0x681c('0xf'));logger[_0x681c('0x10')]('CmList,\x20%s,\x20%s,\x20%s',_0x3e3770,_0x681c('0xf'),JSON['stringify'](_0x48dc05));if(_0x48dc05[_0x681c('0x11')]){if(_0x48dc05['error'][_0x681c('0x12')]===0x1f4){logger[_0x681c('0x11')](_0x681c('0xe'),_0x3e3770,_0x48dc05[_0x681c('0x11')][_0x681c('0x13')]);return _0x83927a(_0x48dc05[_0x681c('0x11')]['message']);}logger[_0x681c('0x11')](_0x681c('0xe'),_0x3e3770,_0x48dc05[_0x681c('0x11')][_0x681c('0x13')]);return _0x82b6ad(_0x48dc05[_0x681c('0x11')][_0x681c('0x13')]);}else{logger['info'](_0x681c('0xe'),_0x3e3770,_0x681c('0xf'));_0x82b6ad(_0x48dc05[_0x681c('0x14')][_0x681c('0x13')]);}})['catch'](function(_0x22e608){logger[_0x681c('0x11')]('CmList,\x20%s,\x20%s',_0x3e3770,_0x22e608);_0x83927a(_0x22e608);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 298b153..6cab528 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 _0xd0c9=['cmList:','./cmList.events','save','emit','length'];(function(_0x385f4d,_0x419268){var _0x59581a=function(_0x1a0537){while(--_0x1a0537){_0x385f4d['push'](_0x385f4d['shift']());}};_0x59581a(++_0x419268);}(_0xd0c9,0xe2));var _0x9d0c=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xd0c9[_0x819464];return _0x49dcc0;};'use strict';var CmListEvents=require(_0x9d0c('0x0'));var events=[_0x9d0c('0x1'),'remove','update'];function createListener(_0x5d3eb1,_0x154c38){return function(_0x2eff0e){_0x154c38[_0x9d0c('0x2')](_0x5d3eb1,_0x2eff0e);};}function removeListener(_0x5922f1,_0x3b4b50){return function(){CmListEvents['removeListener'](_0x5922f1,_0x3b4b50);};}exports['register']=function(_0x6749){for(var _0x5bcaf9=0x0,_0x3eec5f=events[_0x9d0c('0x3')];_0x5bcaf9<_0x3eec5f;_0x5bcaf9++){var _0x308d9e=events[_0x5bcaf9];var _0x413a70=createListener(_0x9d0c('0x4')+_0x308d9e,_0x6749);CmListEvents['on'](_0x308d9e,_0x413a70);}}; \ No newline at end of file +var _0xfd87=['./cmList.events','save','remove','update','emit','removeListener','length','cmList:'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var CmListEvents=require(_0x7fd8('0x0'));var events=[_0x7fd8('0x1'),_0x7fd8('0x2'),_0x7fd8('0x3')];function createListener(_0x11b128,_0x15d25f){return function(_0x2631d9){_0x15d25f[_0x7fd8('0x4')](_0x11b128,_0x2631d9);};}function removeListener(_0x4429f2,_0x43b442){return function(){CmListEvents[_0x7fd8('0x5')](_0x4429f2,_0x43b442);};}exports['register']=function(_0x1395b6){for(var _0x10a778=0x0,_0x55681d=events[_0x7fd8('0x6')];_0x10a778<_0x55681d;_0x10a778++){var _0x6eaf96=events[_0x10a778];var _0x2e2d74=createListener(_0x7fd8('0x7')+_0x6eaf96,_0x1395b6);CmListEvents['on'](_0x6eaf96,_0x2e2d74);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 4057f09..0d348ab 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 _0xbd50=['get','/describe','/:id','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','addDisposition','addContacts','addCustomField','addAgents','put','delete','removeDispositions','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index'];(function(_0x53a3ef,_0xd4799a){var _0x2b47e9=function(_0x18d59f){while(--_0x18d59f){_0x53a3ef['push'](_0x53a3ef['shift']());}};_0x2b47e9(++_0xd4799a);}(_0xbd50,0x196));var _0x0bd5=function(_0x431666,_0x58c74c){_0x431666=_0x431666-0x0;var _0x223c2a=_0xbd50[_0x431666];return _0x223c2a;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./cmList.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller['describe']);router['get'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router['get'](_0x0bd5('0xe'),auth[_0x0bd5('0x8')](),controller['getDispositions']);router[_0x0bd5('0xa')](_0x0bd5('0xf'),auth['isAuthenticated'](),controller[_0x0bd5('0x10')]);router[_0x0bd5('0xa')](_0x0bd5('0x11'),auth['isAuthenticated'](),controller[_0x0bd5('0x12')]);router[_0x0bd5('0xa')](_0x0bd5('0x13'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x14')]);router[_0x0bd5('0xa')](_0x0bd5('0x15'),auth[_0x0bd5('0x8')](),controller['getAgents']);router[_0x0bd5('0x16')]('/',auth[_0x0bd5('0x8')](),controller['create']);router[_0x0bd5('0x16')](_0x0bd5('0xe'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x17')]);router['post'](_0x0bd5('0xf'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x18')]);router[_0x0bd5('0x16')](_0x0bd5('0x13'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x19')]);router[_0x0bd5('0x16')](_0x0bd5('0x15'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x1a')]);router[_0x0bd5('0x1b')](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x0bd5('0x1c')](_0x0bd5('0xe'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x1d')]);router[_0x0bd5('0x1c')]('/:id/users',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x1e')]);module[_0x0bd5('0x1f')]=router; \ No newline at end of file +var _0x008c=['/:id/users','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','show','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getAgents','post','create','addDisposition','addCustomField','update','/:id/dispositions','removeDispositions','delete'];(function(_0x5f4ce0,_0x45bb6d){var _0x653951=function(_0x429992){while(--_0x429992){_0x5f4ce0['push'](_0x5f4ce0['shift']());}};_0x653951(++_0x45bb6d);}(_0x008c,0x188));var _0xc008=function(_0x250bbc,_0x3297f3){_0x250bbc=_0x250bbc-0x0;var _0x489e34=_0x008c[_0x250bbc];return _0x489e34;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0xa')](_0xc008('0x12'),auth['isAuthenticated'](),controller['getCustomFields']);router[_0xc008('0xa')]('/:id/users',auth[_0xc008('0xb')](),controller[_0xc008('0x13')]);router[_0xc008('0x14')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0x15')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc008('0x16')]);router[_0xc008('0x14')](_0xc008('0xe'),auth[_0xc008('0xb')](),controller['addContacts']);router['post']('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0x17')]);router[_0xc008('0x14')]('/:id/users',auth[_0xc008('0xb')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xc008('0x19'),auth[_0xc008('0xb')](),controller[_0xc008('0x1a')]);router[_0xc008('0x1b')](_0xc008('0x1c'),auth[_0xc008('0xb')](),controller['removeAgents']);module[_0xc008('0x1d')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 34d5a00..095540f 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 _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x413825,_0x3d48fa){var _0x48c54e=function(_0x451a6f){while(--_0x451a6f){_0x413825['push'](_0x413825['shift']());}};_0x48c54e(++_0x3d48fa);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x178528,_0x21cb02){var _0x59d37a=function(_0x307118){while(--_0x307118){_0x178528['push'](_0x178528['shift']());}};_0x59d37a(++_0x21cb02);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index b678694..5c4f2d6 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','body','Condition','params','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra'];(function(_0x1f52c6,_0x4e3619){var _0x5407c2=function(_0x1ffbd8){while(--_0x1ffbd8){_0x1f52c6['push'](_0x1f52c6['shift']());}};_0x5407c2(++_0x4e3619);}(_0x34e8,0x12c));var _0x834e=function(_0x3648f3,_0x303802){_0x3648f3=_0x3648f3-0x0;var _0x48847f=_0x34e8[_0x3648f3];return _0x48847f;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));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('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['update']=function(_0x4dc64a,_0x58c1d7){if(_0x4dc64a[_0x834e('0x2f')]['id']){delete _0x4dc64a[_0x834e('0x2f')]['id'];}return db[_0x834e('0x30')]['find']({'where':{'id':_0x4dc64a[_0x834e('0x31')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x58c1d7,null))[_0x834e('0x2a')](saveUpdates(_0x4dc64a[_0x834e('0x2f')],null))[_0x834e('0x2a')](respondWithResult(_0x58c1d7,null))[_0x834e('0x32')](handleError(_0x58c1d7,null));};exports[_0x834e('0x2b')]=function(_0xfaf716,_0x278db3){return db['Condition'][_0x834e('0x33')]({'where':{'id':_0xfaf716['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x278db3,null))[_0x834e('0x2a')](removeEntity(_0x278db3,null))[_0x834e('0x32')](handleError(_0x278db3,null));}; \ No newline at end of file +var _0x4bc3=['json','apply','reject','destroy','then','sendStatus','stack','name','send','body','Condition','find','catch','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set'];(function(_0x547957,_0x26dbfd){var _0x33ab57=function(_0x2af683){while(--_0x2af683){_0x547957['push'](_0x547957['shift']());}};_0x33ab57(++_0x26dbfd);}(_0x4bc3,0x16e));var _0x34bc=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x4bc3[_0x5a9c0c];return _0x53c77d;};'use strict';var emlformat=require(_0x34bc('0x0'));var rimraf=require(_0x34bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x34bc('0x2'));var rp=require(_0x34bc('0x3'));var moment=require('moment');var BPromise=require(_0x34bc('0x4'));var Mustache=require(_0x34bc('0x5'));var util=require(_0x34bc('0x6'));var path=require(_0x34bc('0x7'));var sox=require(_0x34bc('0x8'));var csv=require(_0x34bc('0x9'));var ejs=require(_0x34bc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34bc('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x34bc('0xc'));var deskjs=require(_0x34bc('0xd'));var toCsv=require(_0x34bc('0x9'));var querystring=require(_0x34bc('0xe'));var Papa=require(_0x34bc('0xf'));var Redis=require(_0x34bc('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x34bc('0x11'));var hardwareService=require(_0x34bc('0x12'));var logger=require(_0x34bc('0x13'))('api');var utils=require(_0x34bc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x34bc('0x15'));var db=require(_0x34bc('0x16'))['db'];function respondWithStatusCode(_0x164fb2,_0x536ebd){_0x536ebd=_0x536ebd||0xcc;return function(_0x3f8852){if(_0x3f8852){return _0x164fb2['sendStatus'](_0x536ebd);}return _0x164fb2[_0x34bc('0x17')](_0x536ebd)[_0x34bc('0x18')]();};}function respondWithResult(_0xc77013,_0x5a22a3){_0x5a22a3=_0x5a22a3||0xc8;return function(_0x4c365a){if(_0x4c365a){return _0xc77013[_0x34bc('0x17')](_0x5a22a3)['json'](_0x4c365a);}};}function respondWithFilteredResult(_0x3e93bf,_0x217605){return function(_0x1da8eb){if(_0x1da8eb){var _0x25da29=typeof _0x217605[_0x34bc('0x19')]===_0x34bc('0x1a')&&typeof _0x217605['limit']==='undefined';var _0x5a5895=_0x1da8eb[_0x34bc('0x1b')];var _0x3eaedf=_0x25da29?0x0:_0x217605[_0x34bc('0x19')];var _0x239e6c=_0x25da29?_0x1da8eb['count']:_0x217605[_0x34bc('0x19')]+_0x217605[_0x34bc('0x1c')];var _0x50106a;if(_0x239e6c>=_0x5a5895){_0x239e6c=_0x5a5895;_0x50106a=0xc8;}else{_0x50106a=0xce;}_0x3e93bf[_0x34bc('0x17')](_0x50106a);return _0x3e93bf[_0x34bc('0x1d')]('Content-Range',_0x3eaedf+'-'+_0x239e6c+'/'+_0x5a5895)[_0x34bc('0x1e')](_0x1da8eb);}return null;};}function patchUpdates(_0x26cdec){return function(_0x2d18ea){try{jsonpatch[_0x34bc('0x1f')](_0x2d18ea,_0x26cdec,!![]);}catch(_0x1f993b){return BPromise[_0x34bc('0x20')](_0x1f993b);}return _0x2d18ea['save']();};}function saveUpdates(_0x40e128,_0x3c9939){return function(_0x38882c){if(_0x38882c){return _0x38882c['update'](_0x40e128)['then'](function(_0x358d51){return _0x358d51;});}return null;};}function removeEntity(_0x1b820a,_0x4263de){return function(_0x410800){if(_0x410800){return _0x410800[_0x34bc('0x21')]()[_0x34bc('0x22')](function(){_0x1b820a[_0x34bc('0x17')](0xcc)[_0x34bc('0x18')]();});}};}function handleEntityNotFound(_0x19472e,_0x25d6fe){return function(_0x2de017){if(!_0x2de017){_0x19472e[_0x34bc('0x23')](0x194);}return _0x2de017;};}function handleError(_0x4fd589,_0x43e527){_0x43e527=_0x43e527||0x1f4;return function(_0x48ec13){logger['error'](_0x48ec13[_0x34bc('0x24')]);if(_0x48ec13['name']){delete _0x48ec13[_0x34bc('0x25')];}_0x4fd589[_0x34bc('0x17')](_0x43e527)[_0x34bc('0x26')](_0x48ec13);};}exports['update']=function(_0x2e6d96,_0x351ed8){if(_0x2e6d96[_0x34bc('0x27')]['id']){delete _0x2e6d96[_0x34bc('0x27')]['id'];}return db[_0x34bc('0x28')][_0x34bc('0x29')]({'where':{'id':_0x2e6d96['params']['id']}})[_0x34bc('0x22')](handleEntityNotFound(_0x351ed8,null))[_0x34bc('0x22')](saveUpdates(_0x2e6d96[_0x34bc('0x27')],null))[_0x34bc('0x22')](respondWithResult(_0x351ed8,null))[_0x34bc('0x2a')](handleError(_0x351ed8,null));};exports[_0x34bc('0x21')]=function(_0x5b37de,_0x155e44){return db['Condition']['find']({'where':{'id':_0x5b37de[_0x34bc('0x2b')]['id']}})['then'](handleEntityNotFound(_0x155e44,null))[_0x34bc('0x22')](removeEntity(_0x155e44,null))[_0x34bc('0x2a')](handleError(_0x155e44,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 2bc667b..b0de172 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 _0x1f18=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','Condition','tools_conditions'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x1f18,0x82));var _0x81f1=function(_0x195256,_0x59c5f3){_0x195256=_0x195256-0x0;var _0x5a6770=_0x1f18[_0x195256];return _0x5a6770;};'use strict';var _=require(_0x81f1('0x0'));var util=require(_0x81f1('0x1'));var logger=require(_0x81f1('0x2'))(_0x81f1('0x3'));var moment=require(_0x81f1('0x4'));var BPromise=require(_0x81f1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x81f1('0x6'));var rimraf=require(_0x81f1('0x7'));var config=require(_0x81f1('0x8'));var attributes=require('./condition.attributes');module[_0x81f1('0x9')]=function(_0x488b38,_0x9a33d6){return _0x488b38[_0x81f1('0xa')](_0x81f1('0xb'),attributes,{'tableName':_0x81f1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc760=['util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define','Condition','lodash'];(function(_0x26297c,_0xb0a30){var _0x5383be=function(_0x514d9e){while(--_0x514d9e){_0x26297c['push'](_0x26297c['shift']());}};_0x5383be(++_0xb0a30);}(_0xc760,0x180));var _0x0c76=function(_0x32d372,_0x2c8772){_0x32d372=_0x32d372-0x0;var _0x491f10=_0xc760[_0x32d372];return _0x491f10;};'use strict';var _=require(_0x0c76('0x0'));var util=require(_0x0c76('0x1'));var logger=require(_0x0c76('0x2'))(_0x0c76('0x3'));var moment=require(_0x0c76('0x4'));var BPromise=require(_0x0c76('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c76('0x6'));var rimraf=require(_0x0c76('0x7'));var config=require('../../config/environment');var attributes=require('./condition.attributes');module[_0x0c76('0x8')]=function(_0x1879fc,_0x1740b9){return _0x1879fc[_0x0c76('0x9')](_0x0c76('0xa'),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 8a45fa3..5db01f7 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 _0x7016=['error','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x7016,0x116));var _0x6701=function(_0x593f68,_0x39dc51){_0x593f68=_0x593f68-0x0;var _0x160833=_0x7016[_0x593f68];return _0x160833;};'use strict';var _=require(_0x6701('0x0'));var util=require(_0x6701('0x1'));var moment=require(_0x6701('0x2'));var BPromise=require(_0x6701('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6701('0x4'))['db'];var utils=require(_0x6701('0x5'));var logger=require('../../config/logger')(_0x6701('0x6'));var config=require(_0x6701('0x7'));var jayson=require(_0x6701('0x8'));var client=jayson[_0x6701('0x9')][_0x6701('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d43a3,_0x15d169,_0x52b4e8){return new BPromise(function(_0x546faf,_0x1f323e){return client[_0x6701('0xb')](_0x1d43a3,_0x52b4e8)['then'](function(_0x3485f5){logger[_0x6701('0xc')]('Condition,\x20%s,\x20%s',_0x15d169,_0x6701('0xd'));logger[_0x6701('0xe')](_0x6701('0xf'),_0x15d169,_0x6701('0xd'),JSON['stringify'](_0x3485f5));if(_0x3485f5[_0x6701('0x10')]){if(_0x3485f5[_0x6701('0x10')]['code']===0x1f4){logger[_0x6701('0x10')](_0x6701('0x11'),_0x15d169,_0x3485f5[_0x6701('0x10')][_0x6701('0x12')]);return _0x1f323e(_0x3485f5['error'][_0x6701('0x12')]);}logger[_0x6701('0x10')](_0x6701('0x11'),_0x15d169,_0x3485f5[_0x6701('0x10')]['message']);return _0x546faf(_0x3485f5[_0x6701('0x10')]['message']);}else{logger[_0x6701('0xc')]('Condition,\x20%s,\x20%s',_0x15d169,_0x6701('0xd'));_0x546faf(_0x3485f5[_0x6701('0x13')][_0x6701('0x12')]);}})[_0x6701('0x14')](function(_0x13458d){logger['error'](_0x6701('0x11'),_0x15d169,_0x13458d);_0x1f323e(_0x13458d);});});} \ No newline at end of file +var _0x51d1=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','Condition,\x20%s,\x20%s','message','request\x20sent','result'];(function(_0x42152d,_0x73ce83){var _0x44f7c6=function(_0x2d31cc){while(--_0x2d31cc){_0x42152d['push'](_0x42152d['shift']());}};_0x44f7c6(++_0x73ce83);}(_0x51d1,0x7f));var _0x151d=function(_0x461886,_0x4fc171){_0x461886=_0x461886-0x0;var _0x295e0a=_0x51d1[_0x461886];return _0x295e0a;};'use strict';var _=require(_0x151d('0x0'));var util=require('util');var moment=require(_0x151d('0x1'));var BPromise=require(_0x151d('0x2'));var rs=require(_0x151d('0x3'));var fs=require('fs');var Redis=require(_0x151d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x151d('0x5'))(_0x151d('0x6'));var config=require(_0x151d('0x7'));var jayson=require(_0x151d('0x8'));var client=jayson[_0x151d('0x9')][_0x151d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2459c3,_0x16603f,_0xcd4db6){return new BPromise(function(_0x48a2c2,_0x5510b4){return client[_0x151d('0xb')](_0x2459c3,_0xcd4db6)['then'](function(_0x1f3d25){logger['info']('Condition,\x20%s,\x20%s',_0x16603f,'request\x20sent');logger[_0x151d('0xc')](_0x151d('0xd'),_0x16603f,'request\x20sent',JSON[_0x151d('0xe')](_0x1f3d25));if(_0x1f3d25[_0x151d('0xf')]){if(_0x1f3d25[_0x151d('0xf')]['code']===0x1f4){logger[_0x151d('0xf')](_0x151d('0x10'),_0x16603f,_0x1f3d25[_0x151d('0xf')]['message']);return _0x5510b4(_0x1f3d25[_0x151d('0xf')][_0x151d('0x11')]);}logger['error'](_0x151d('0x10'),_0x16603f,_0x1f3d25[_0x151d('0xf')]['message']);return _0x48a2c2(_0x1f3d25['error']['message']);}else{logger['info'](_0x151d('0x10'),_0x16603f,_0x151d('0x12'));_0x48a2c2(_0x1f3d25[_0x151d('0x13')][_0x151d('0x11')]);}})[_0x151d('0x14')](function(_0x5641a0){logger[_0x151d('0xf')](_0x151d('0x10'),_0x16603f,_0x5641a0);_0x5510b4(_0x5641a0);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 10dc353..9da0d70 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_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 fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')](_0x7995('0xa'),auth[_0x7995('0xb')](),controller[_0x7995('0xc')]);router[_0x7995('0xd')]('/:id',auth[_0x7995('0xb')](),controller[_0x7995('0xe')]);module['exports']=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')](_0x7995('0xa'),auth[_0x7995('0xb')](),controller[_0x7995('0xc')]);router[_0x7995('0xd')]('/:id',auth[_0x7995('0xb')](),controller[_0x7995('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index a59d951..b397a86 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a12=['exports','STRING'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x0a12,0xb8));var _0x20a1=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0a12[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x20a1('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x20a1('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xc999=['STRING','name','exports'];(function(_0x456860,_0xae925c){var _0x23667c=function(_0x4b73e6){while(--_0x4b73e6){_0x456860['push'](_0x456860['shift']());}};_0x23667c(++_0xae925c);}(_0xc999,0x176));var _0x9c99=function(_0x5275b8,_0x51e5dd){_0x5275b8=_0x5275b8-0x0;var _0x568a9b=_0xc999[_0x5275b8];return _0x568a9b;};'use strict';var Sequelize=require('sequelize');module[_0x9c99('0x0')]={'name':{'type':Sequelize[_0x9c99('0x1')],'allowNull':![],'unique':_0x9c99('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 78ea1b9..53fb98b 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c5d=['ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','stack','name','send','map','ContactItemType','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','user','role','UserProfileSection','find','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv'];(function(_0x4b1d10,_0x3b04e0){var _0x401061=function(_0x3c0b53){while(--_0x3c0b53){_0x4b1d10['push'](_0x4b1d10['shift']());}};_0x401061(++_0x3b04e0);}(_0x0c5d,0x1a4));var _0xd0c5=function(_0x5ed83b,_0x1449f1){_0x5ed83b=_0x5ed83b-0x0;var _0x439b05=_0x0c5d[_0x5ed83b];return _0x439b05;};'use strict';var emlformat=require(_0xd0c5('0x0'));var rimraf=require(_0xd0c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd0c5('0x2'));var rp=require(_0xd0c5('0x3'));var moment=require('moment');var BPromise=require(_0xd0c5('0x4'));var Mustache=require(_0xd0c5('0x5'));var util=require(_0xd0c5('0x6'));var path=require(_0xd0c5('0x7'));var sox=require(_0xd0c5('0x8'));var csv=require(_0xd0c5('0x9'));var ejs=require(_0xd0c5('0xa'));var fs=require('fs');var fs_extra=require(_0xd0c5('0xb'));var _=require(_0xd0c5('0xc'));var squel=require('squel');var crypto=require(_0xd0c5('0xd'));var jsforce=require(_0xd0c5('0xe'));var deskjs=require(_0xd0c5('0xf'));var toCsv=require(_0xd0c5('0x9'));var querystring=require(_0xd0c5('0x10'));var Papa=require(_0xd0c5('0x11'));var Redis=require(_0xd0c5('0x12'));var authService=require(_0xd0c5('0x13'));var qs=require(_0xd0c5('0x14'));var as=require(_0xd0c5('0x15'));var hardwareService=require(_0xd0c5('0x16'));var logger=require(_0xd0c5('0x17'))(_0xd0c5('0x18'));var utils=require('../../config/utils');var config=require(_0xd0c5('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdd5728,_0x300932){_0x300932=_0x300932||0xcc;return function(_0x1ec16d){if(_0x1ec16d){return _0xdd5728[_0xd0c5('0x1a')](_0x300932);}return _0xdd5728[_0xd0c5('0x1b')](_0x300932)[_0xd0c5('0x1c')]();};}function respondWithResult(_0x3edc54,_0x441e91){_0x441e91=_0x441e91||0xc8;return function(_0x319463){if(_0x319463){return _0x3edc54['status'](_0x441e91)[_0xd0c5('0x1d')](_0x319463);}};}function respondWithFilteredResult(_0x6e2bd8,_0x5ddc87){return function(_0x459709){if(_0x459709){var _0x5d3d06=typeof _0x5ddc87[_0xd0c5('0x1e')]===_0xd0c5('0x1f')&&typeof _0x5ddc87[_0xd0c5('0x20')]===_0xd0c5('0x1f');var _0x277579=_0x459709[_0xd0c5('0x21')];var _0x2f6032=_0x5d3d06?0x0:_0x5ddc87[_0xd0c5('0x1e')];var _0x47692c=_0x5d3d06?_0x459709['count']:_0x5ddc87[_0xd0c5('0x1e')]+_0x5ddc87[_0xd0c5('0x20')];var _0x312a24;if(_0x47692c>=_0x277579){_0x47692c=_0x277579;_0x312a24=0xc8;}else{_0x312a24=0xce;}_0x6e2bd8[_0xd0c5('0x1b')](_0x312a24);return _0x6e2bd8[_0xd0c5('0x22')](_0xd0c5('0x23'),_0x2f6032+'-'+_0x47692c+'/'+_0x277579)[_0xd0c5('0x1d')](_0x459709);}return null;};}function patchUpdates(_0x21bc01){return function(_0x1ba87d){try{jsonpatch[_0xd0c5('0x24')](_0x1ba87d,_0x21bc01,!![]);}catch(_0x34c71e){return BPromise[_0xd0c5('0x25')](_0x34c71e);}return _0x1ba87d[_0xd0c5('0x26')]();};}function saveUpdates(_0x35239f,_0x17496b){return function(_0x550e4b){if(_0x550e4b){return _0x550e4b[_0xd0c5('0x27')](_0x35239f)[_0xd0c5('0x28')](function(_0x3ebe1b){return _0x3ebe1b;});}return null;};}function removeEntity(_0x5f128c,_0x351572){return function(_0x380fd1){if(_0x380fd1){return _0x380fd1[_0xd0c5('0x29')]()['then'](function(){var _0x2c289f=_0x380fd1[_0xd0c5('0x2a')]({'plain':!![]});var _0x27da7f=_0xd0c5('0x2b');return db[_0xd0c5('0x2c')][_0xd0c5('0x29')]({'where':{'type':_0x27da7f,'resourceId':_0x2c289f['id']}})[_0xd0c5('0x28')](function(){return _0x380fd1;});})['then'](function(){_0x5f128c[_0xd0c5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x469463,_0x40144f){return function(_0x2212a1){if(!_0x2212a1){_0x469463[_0xd0c5('0x1a')](0x194);}return _0x2212a1;};}function handleError(_0x5d00f6,_0x52d953){_0x52d953=_0x52d953||0x1f4;return function(_0x1bbcb0){logger['error'](_0x1bbcb0[_0xd0c5('0x2d')]);if(_0x1bbcb0[_0xd0c5('0x2e')]){delete _0x1bbcb0[_0xd0c5('0x2e')];}_0x5d00f6[_0xd0c5('0x1b')](_0x52d953)[_0xd0c5('0x2f')](_0x1bbcb0);};}exports['index']=function(_0x112719,_0x57b3e1){var _0x173886={},_0x43b71d={},_0xd96d38={'count':0x0,'rows':[]};var _0x279b21=_[_0xd0c5('0x30')](db[_0xd0c5('0x31')][_0xd0c5('0x32')],function(_0x2095ad){return{'name':_0x2095ad[_0xd0c5('0x33')],'type':_0x2095ad['type'][_0xd0c5('0x34')]};});_0x43b71d['model']=_['map'](_0x279b21,'name');_0x43b71d[_0xd0c5('0x35')]=_[_0xd0c5('0x36')](_0x112719[_0xd0c5('0x35')]);_0x43b71d['filters']=_['intersection'](_0x43b71d[_0xd0c5('0x37')],_0x43b71d[_0xd0c5('0x35')]);_0x173886[_0xd0c5('0x38')]=_[_0xd0c5('0x39')](_0x43b71d['model'],qs[_0xd0c5('0x3a')](_0x112719['query'][_0xd0c5('0x3a')]));_0x173886[_0xd0c5('0x38')]=_0x173886['attributes'][_0xd0c5('0x3b')]?_0x173886[_0xd0c5('0x38')]:_0x43b71d['model'];if(!_0x112719[_0xd0c5('0x35')][_0xd0c5('0x3c')](_0xd0c5('0x3d'))){_0x173886[_0xd0c5('0x20')]=qs[_0xd0c5('0x20')](_0x112719['query']['limit']);_0x173886[_0xd0c5('0x1e')]=qs[_0xd0c5('0x1e')](_0x112719['query'][_0xd0c5('0x1e')]);}_0x173886[_0xd0c5('0x3e')]=qs[_0xd0c5('0x3f')](_0x112719[_0xd0c5('0x35')]['sort']);_0x173886[_0xd0c5('0x40')]=qs['filters'](_[_0xd0c5('0x41')](_0x112719[_0xd0c5('0x35')],_0x43b71d[_0xd0c5('0x42')]),_0x279b21);if(_0x112719['query'][_0xd0c5('0x43')]){_0x173886[_0xd0c5('0x40')]=_[_0xd0c5('0x44')](_0x173886[_0xd0c5('0x40')],{'$or':_[_0xd0c5('0x30')](_0x279b21,function(_0x144906){if(_0x144906['type']!==_0xd0c5('0x45')){var _0x593a84={};_0x593a84[_0x144906[_0xd0c5('0x2e')]]={'$like':'%'+_0x112719['query'][_0xd0c5('0x43')]+'%'};return _0x593a84;}})});}_0x173886=_['merge']({},_0x173886,_0x112719[_0xd0c5('0x46')]);var _0x1b591b={'where':_0x173886[_0xd0c5('0x40')]};return db[_0xd0c5('0x31')][_0xd0c5('0x21')](_0x1b591b)[_0xd0c5('0x28')](function(_0x4723eb){_0xd96d38['count']=_0x4723eb;if(_0x112719[_0xd0c5('0x35')]['includeAll']){_0x173886[_0xd0c5('0x47')]=[{'all':!![]}];}return db[_0xd0c5('0x31')]['findAll'](_0x173886);})[_0xd0c5('0x28')](function(_0xc2bbb9){_0xd96d38['rows']=_0xc2bbb9;return _0xd96d38;})[_0xd0c5('0x28')](respondWithFilteredResult(_0x57b3e1,_0x173886))[_0xd0c5('0x48')](handleError(_0x57b3e1,null));};exports[_0xd0c5('0x49')]=function(_0x1d2776,_0x5e3af7){var _0x5cc01c={'raw':!![],'where':{'id':_0x1d2776[_0xd0c5('0x4a')]['id']}},_0x5608f2={};_0x5608f2[_0xd0c5('0x37')]=_[_0xd0c5('0x36')](db[_0xd0c5('0x31')][_0xd0c5('0x32')]);_0x5608f2[_0xd0c5('0x35')]=_['keys'](_0x1d2776['query']);_0x5608f2['filters']=_[_0xd0c5('0x39')](_0x5608f2[_0xd0c5('0x37')],_0x5608f2[_0xd0c5('0x35')]);_0x5cc01c[_0xd0c5('0x38')]=_[_0xd0c5('0x39')](_0x5608f2[_0xd0c5('0x37')],qs[_0xd0c5('0x3a')](_0x1d2776[_0xd0c5('0x35')][_0xd0c5('0x3a')]));_0x5cc01c[_0xd0c5('0x38')]=_0x5cc01c[_0xd0c5('0x38')]['length']?_0x5cc01c['attributes']:_0x5608f2[_0xd0c5('0x37')];if(_0x1d2776[_0xd0c5('0x35')][_0xd0c5('0x4b')]){_0x5cc01c[_0xd0c5('0x47')]=[{'all':!![]}];}_0x5cc01c=_[_0xd0c5('0x44')]({},_0x5cc01c,_0x1d2776[_0xd0c5('0x46')]);return db[_0xd0c5('0x31')]['find'](_0x5cc01c)[_0xd0c5('0x28')](handleEntityNotFound(_0x5e3af7,null))['then'](respondWithResult(_0x5e3af7,null))[_0xd0c5('0x48')](handleError(_0x5e3af7,null));};exports['create']=function(_0x344624,_0x46073a){return db[_0xd0c5('0x31')]['create'](_0x344624['body'],{})[_0xd0c5('0x28')](function(_0x314bc8){var _0x2e822c=_0x344624[_0xd0c5('0x4c')][_0xd0c5('0x2a')]({'plain':!![]});if(!_0x2e822c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e822c[_0xd0c5('0x4d')]===_0xd0c5('0x4c')){var _0x171be9=_0x314bc8['get']({'plain':!![]});var _0x214f37='ContactItemTypes';return db[_0xd0c5('0x4e')][_0xd0c5('0x4f')]({'where':{'name':_0x214f37,'userProfileId':_0x2e822c[_0xd0c5('0x50')]},'raw':!![]})['then'](function(_0x10644f){if(_0x10644f&&_0x10644f[_0xd0c5('0x51')]===0x0){return db['UserProfileResource'][_0xd0c5('0x52')]({'name':_0x171be9['name'],'resourceId':_0x171be9['id'],'type':_0x10644f[_0xd0c5('0x2e')],'sectionId':_0x10644f['id']},{})[_0xd0c5('0x28')](function(){return _0x314bc8;});}else{return _0x314bc8;}})[_0xd0c5('0x48')](function(_0x5accdc){logger[_0xd0c5('0x53')](_0xd0c5('0x54'),_0x5accdc);throw _0x5accdc;});}return _0x314bc8;})['then'](respondWithResult(_0x46073a,0xc9))[_0xd0c5('0x48')](handleError(_0x46073a,null));};exports[_0xd0c5('0x27')]=function(_0x52a84a,_0x4f2839){if(_0x52a84a[_0xd0c5('0x55')]['id']){delete _0x52a84a[_0xd0c5('0x55')]['id'];}return db[_0xd0c5('0x31')]['find']({'where':{'id':_0x52a84a['params']['id']}})[_0xd0c5('0x28')](handleEntityNotFound(_0x4f2839,null))[_0xd0c5('0x28')](saveUpdates(_0x52a84a[_0xd0c5('0x55')],null))[_0xd0c5('0x28')](respondWithResult(_0x4f2839,null))[_0xd0c5('0x48')](handleError(_0x4f2839,null));};exports[_0xd0c5('0x29')]=function(_0x197339,_0x39a595){return db[_0xd0c5('0x31')][_0xd0c5('0x4f')]({'where':{'id':_0x197339[_0xd0c5('0x4a')]['id']}})[_0xd0c5('0x28')](handleEntityNotFound(_0x39a595,null))[_0xd0c5('0x28')](removeEntity(_0x39a595,null))[_0xd0c5('0x48')](handleError(_0x39a595,null));}; \ No newline at end of file +var _0x4d26=['squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','ContactItemTypes','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','rimraf','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','lodash'];(function(_0x3a9d77,_0xdc466){var _0x130f80=function(_0x740c4a){while(--_0x740c4a){_0x3a9d77['push'](_0x3a9d77['shift']());}};_0x130f80(++_0xdc466);}(_0x4d26,0x13f));var _0x64d2=function(_0x1829b6,_0x577318){_0x1829b6=_0x1829b6-0x0;var _0x246f6d=_0x4d26[_0x1829b6];return _0x246f6d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x64d2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x64d2('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x64d2('0x2'));var util=require(_0x64d2('0x3'));var path=require(_0x64d2('0x4'));var sox=require(_0x64d2('0x5'));var csv=require('to-csv');var ejs=require(_0x64d2('0x6'));var fs=require('fs');var fs_extra=require(_0x64d2('0x7'));var _=require(_0x64d2('0x8'));var squel=require(_0x64d2('0x9'));var crypto=require(_0x64d2('0xa'));var jsforce=require(_0x64d2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x64d2('0xc'));var querystring=require(_0x64d2('0xd'));var Papa=require(_0x64d2('0xe'));var Redis=require(_0x64d2('0xf'));var authService=require(_0x64d2('0x10'));var qs=require(_0x64d2('0x11'));var as=require(_0x64d2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x64d2('0x13'))(_0x64d2('0x14'));var utils=require(_0x64d2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x64d2('0x16'));var db=require(_0x64d2('0x17'))['db'];function respondWithStatusCode(_0x28a2b3,_0x535dfb){_0x535dfb=_0x535dfb||0xcc;return function(_0x496db9){if(_0x496db9){return _0x28a2b3['sendStatus'](_0x535dfb);}return _0x28a2b3[_0x64d2('0x18')](_0x535dfb)['end']();};}function respondWithResult(_0x43bd74,_0x39821f){_0x39821f=_0x39821f||0xc8;return function(_0x116776){if(_0x116776){return _0x43bd74[_0x64d2('0x18')](_0x39821f)[_0x64d2('0x19')](_0x116776);}};}function respondWithFilteredResult(_0x1fc219,_0x56f057){return function(_0x4fddf5){if(_0x4fddf5){var _0x360e1d=typeof _0x56f057[_0x64d2('0x1a')]===_0x64d2('0x1b')&&typeof _0x56f057[_0x64d2('0x1c')]===_0x64d2('0x1b');var _0x10188c=_0x4fddf5['count'];var _0x528afb=_0x360e1d?0x0:_0x56f057[_0x64d2('0x1a')];var _0x1795af=_0x360e1d?_0x4fddf5[_0x64d2('0x1d')]:_0x56f057[_0x64d2('0x1a')]+_0x56f057[_0x64d2('0x1c')];var _0x51eee6;if(_0x1795af>=_0x10188c){_0x1795af=_0x10188c;_0x51eee6=0xc8;}else{_0x51eee6=0xce;}_0x1fc219['status'](_0x51eee6);return _0x1fc219[_0x64d2('0x1e')](_0x64d2('0x1f'),_0x528afb+'-'+_0x1795af+'/'+_0x10188c)[_0x64d2('0x19')](_0x4fddf5);}return null;};}function patchUpdates(_0x5a7833){return function(_0x1fb672){try{jsonpatch[_0x64d2('0x20')](_0x1fb672,_0x5a7833,!![]);}catch(_0x2d2e74){return BPromise['reject'](_0x2d2e74);}return _0x1fb672[_0x64d2('0x21')]();};}function saveUpdates(_0x262874,_0x58d5eb){return function(_0x24dbe0){if(_0x24dbe0){return _0x24dbe0[_0x64d2('0x22')](_0x262874)['then'](function(_0x4cbed7){return _0x4cbed7;});}return null;};}function removeEntity(_0x4dcd82,_0x5ddd06){return function(_0x5d3225){if(_0x5d3225){return _0x5d3225['destroy']()[_0x64d2('0x23')](function(){var _0x593f8a=_0x5d3225[_0x64d2('0x24')]({'plain':!![]});var _0xe4ceea=_0x64d2('0x25');return db[_0x64d2('0x26')]['destroy']({'where':{'type':_0xe4ceea,'resourceId':_0x593f8a['id']}})[_0x64d2('0x23')](function(){return _0x5d3225;});})['then'](function(){_0x4dcd82[_0x64d2('0x18')](0xcc)[_0x64d2('0x27')]();});}};}function handleEntityNotFound(_0x5583ea,_0x189e02){return function(_0x29cd17){if(!_0x29cd17){_0x5583ea[_0x64d2('0x28')](0x194);}return _0x29cd17;};}function handleError(_0x229a26,_0x2e4c37){_0x2e4c37=_0x2e4c37||0x1f4;return function(_0x5248e3){logger[_0x64d2('0x29')](_0x5248e3[_0x64d2('0x2a')]);if(_0x5248e3[_0x64d2('0x2b')]){delete _0x5248e3[_0x64d2('0x2b')];}_0x229a26[_0x64d2('0x18')](_0x2e4c37)[_0x64d2('0x2c')](_0x5248e3);};}exports[_0x64d2('0x2d')]=function(_0x4caf5e,_0x455b9f){var _0x32424c={},_0x3f7f91={},_0x21e996={'count':0x0,'rows':[]};var _0x20ca4c=_[_0x64d2('0x2e')](db[_0x64d2('0x2f')][_0x64d2('0x30')],function(_0x7a9d84){return{'name':_0x7a9d84[_0x64d2('0x31')],'type':_0x7a9d84[_0x64d2('0x32')][_0x64d2('0x33')]};});_0x3f7f91[_0x64d2('0x34')]=_[_0x64d2('0x2e')](_0x20ca4c,_0x64d2('0x2b'));_0x3f7f91[_0x64d2('0x35')]=_[_0x64d2('0x36')](_0x4caf5e['query']);_0x3f7f91[_0x64d2('0x37')]=_[_0x64d2('0x38')](_0x3f7f91['model'],_0x3f7f91['query']);_0x32424c[_0x64d2('0x39')]=_['intersection'](_0x3f7f91[_0x64d2('0x34')],qs[_0x64d2('0x3a')](_0x4caf5e[_0x64d2('0x35')][_0x64d2('0x3a')]));_0x32424c['attributes']=_0x32424c['attributes']['length']?_0x32424c[_0x64d2('0x39')]:_0x3f7f91[_0x64d2('0x34')];if(!_0x4caf5e[_0x64d2('0x35')][_0x64d2('0x3b')](_0x64d2('0x3c'))){_0x32424c[_0x64d2('0x1c')]=qs[_0x64d2('0x1c')](_0x4caf5e['query'][_0x64d2('0x1c')]);_0x32424c[_0x64d2('0x1a')]=qs['offset'](_0x4caf5e[_0x64d2('0x35')][_0x64d2('0x1a')]);}_0x32424c['order']=qs[_0x64d2('0x3d')](_0x4caf5e[_0x64d2('0x35')][_0x64d2('0x3d')]);_0x32424c[_0x64d2('0x3e')]=qs[_0x64d2('0x37')](_['pick'](_0x4caf5e[_0x64d2('0x35')],_0x3f7f91[_0x64d2('0x37')]),_0x20ca4c);if(_0x4caf5e[_0x64d2('0x35')][_0x64d2('0x3f')]){_0x32424c[_0x64d2('0x3e')]=_[_0x64d2('0x40')](_0x32424c['where'],{'$or':_[_0x64d2('0x2e')](_0x20ca4c,function(_0x4492f4){if(_0x4492f4[_0x64d2('0x32')]!==_0x64d2('0x41')){var _0x3e23e3={};_0x3e23e3[_0x4492f4[_0x64d2('0x2b')]]={'$like':'%'+_0x4caf5e[_0x64d2('0x35')]['filter']+'%'};return _0x3e23e3;}})});}_0x32424c=_[_0x64d2('0x40')]({},_0x32424c,_0x4caf5e[_0x64d2('0x42')]);var _0x3ddcd4={'where':_0x32424c[_0x64d2('0x3e')]};return db[_0x64d2('0x2f')]['count'](_0x3ddcd4)[_0x64d2('0x23')](function(_0x515f05){_0x21e996[_0x64d2('0x1d')]=_0x515f05;if(_0x4caf5e[_0x64d2('0x35')]['includeAll']){_0x32424c['include']=[{'all':!![]}];}return db[_0x64d2('0x2f')][_0x64d2('0x43')](_0x32424c);})[_0x64d2('0x23')](function(_0x15d1cf){_0x21e996[_0x64d2('0x44')]=_0x15d1cf;return _0x21e996;})[_0x64d2('0x23')](respondWithFilteredResult(_0x455b9f,_0x32424c))[_0x64d2('0x45')](handleError(_0x455b9f,null));};exports[_0x64d2('0x46')]=function(_0x5f23e4,_0x262dfd){var _0x4f2fc6={'raw':!![],'where':{'id':_0x5f23e4[_0x64d2('0x47')]['id']}},_0x37f524={};_0x37f524['model']=_['keys'](db[_0x64d2('0x2f')][_0x64d2('0x30')]);_0x37f524[_0x64d2('0x35')]=_[_0x64d2('0x36')](_0x5f23e4[_0x64d2('0x35')]);_0x37f524[_0x64d2('0x37')]=_['intersection'](_0x37f524[_0x64d2('0x34')],_0x37f524[_0x64d2('0x35')]);_0x4f2fc6[_0x64d2('0x39')]=_[_0x64d2('0x38')](_0x37f524['model'],qs[_0x64d2('0x3a')](_0x5f23e4[_0x64d2('0x35')][_0x64d2('0x3a')]));_0x4f2fc6[_0x64d2('0x39')]=_0x4f2fc6[_0x64d2('0x39')]['length']?_0x4f2fc6[_0x64d2('0x39')]:_0x37f524[_0x64d2('0x34')];if(_0x5f23e4['query'][_0x64d2('0x48')]){_0x4f2fc6[_0x64d2('0x49')]=[{'all':!![]}];}_0x4f2fc6=_['merge']({},_0x4f2fc6,_0x5f23e4[_0x64d2('0x42')]);return db[_0x64d2('0x2f')][_0x64d2('0x4a')](_0x4f2fc6)['then'](handleEntityNotFound(_0x262dfd,null))['then'](respondWithResult(_0x262dfd,null))[_0x64d2('0x45')](handleError(_0x262dfd,null));};exports['create']=function(_0x3ac84f,_0x392d6d){return db['ContactItemType'][_0x64d2('0x4b')](_0x3ac84f[_0x64d2('0x4c')],{})[_0x64d2('0x23')](function(_0x28983e){var _0x11a2fb=_0x3ac84f[_0x64d2('0x4d')][_0x64d2('0x24')]({'plain':!![]});if(!_0x11a2fb)throw new Error(_0x64d2('0x4e'));if(_0x11a2fb['role']==='user'){var _0xc8352d=_0x28983e['get']({'plain':!![]});var _0x4ece7f='ContactItemTypes';return db[_0x64d2('0x4f')][_0x64d2('0x4a')]({'where':{'name':_0x4ece7f,'userProfileId':_0x11a2fb['userProfileId']},'raw':!![]})['then'](function(_0x38459a){if(_0x38459a&&_0x38459a['autoAssociation']===0x0){return db['UserProfileResource'][_0x64d2('0x4b')]({'name':_0xc8352d['name'],'resourceId':_0xc8352d['id'],'type':_0x38459a[_0x64d2('0x2b')],'sectionId':_0x38459a['id']},{})['then'](function(){return _0x28983e;});}else{return _0x28983e;}})[_0x64d2('0x45')](function(_0x4152f7){logger[_0x64d2('0x29')](_0x64d2('0x50'),_0x4152f7);throw _0x4152f7;});}return _0x28983e;})[_0x64d2('0x23')](respondWithResult(_0x392d6d,0xc9))[_0x64d2('0x45')](handleError(_0x392d6d,null));};exports[_0x64d2('0x22')]=function(_0x9a8e9,_0x43cfa2){if(_0x9a8e9[_0x64d2('0x4c')]['id']){delete _0x9a8e9[_0x64d2('0x4c')]['id'];}return db[_0x64d2('0x2f')]['find']({'where':{'id':_0x9a8e9[_0x64d2('0x47')]['id']}})['then'](handleEntityNotFound(_0x43cfa2,null))[_0x64d2('0x23')](saveUpdates(_0x9a8e9['body'],null))[_0x64d2('0x23')](respondWithResult(_0x43cfa2,null))['catch'](handleError(_0x43cfa2,null));};exports[_0x64d2('0x51')]=function(_0xab1d90,_0x146e33){return db['ContactItemType'][_0x64d2('0x4a')]({'where':{'id':_0xab1d90['params']['id']}})[_0x64d2('0x23')](handleEntityNotFound(_0x146e33,null))[_0x64d2('0x23')](removeEntity(_0x146e33,null))['catch'](handleError(_0x146e33,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index aae120f..ba56906 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5024=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','tools_contact_item_types'];(function(_0x165ba6,_0x140b68){var _0x18a2b6=function(_0x36c2fa){while(--_0x36c2fa){_0x165ba6['push'](_0x165ba6['shift']());}};_0x18a2b6(++_0x140b68);}(_0x5024,0xf7));var _0x4502=function(_0x1233d3,_0x3e831f){_0x1233d3=_0x1233d3-0x0;var _0x55e600=_0x5024[_0x1233d3];return _0x55e600;};'use strict';var _=require(_0x4502('0x0'));var util=require(_0x4502('0x1'));var logger=require(_0x4502('0x2'))(_0x4502('0x3'));var moment=require('moment');var BPromise=require(_0x4502('0x4'));var rp=require(_0x4502('0x5'));var fs=require('fs');var path=require(_0x4502('0x6'));var rimraf=require(_0x4502('0x7'));var config=require(_0x4502('0x8'));var attributes=require(_0x4502('0x9'));module[_0x4502('0xa')]=function(_0x5eddab,_0x548459){return _0x5eddab[_0x4502('0xb')]('ContactItemType',attributes,{'tableName':_0x4502('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa13d=['lodash','../../config/logger','api','bluebird','path','rimraf','exports','define','ContactItemType','tools_contact_item_types'];(function(_0x4dcecc,_0x3865b9){var _0x2aa658=function(_0x334d85){while(--_0x334d85){_0x4dcecc['push'](_0x4dcecc['shift']());}};_0x2aa658(++_0x3865b9);}(_0xa13d,0x154));var _0xda13=function(_0x3afbb2,_0x38b2fb){_0x3afbb2=_0x3afbb2-0x0;var _0x3c43f8=_0xa13d[_0x3afbb2];return _0x3c43f8;};'use strict';var _=require(_0xda13('0x0'));var util=require('util');var logger=require(_0xda13('0x1'))(_0xda13('0x2'));var moment=require('moment');var BPromise=require(_0xda13('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda13('0x4'));var rimraf=require(_0xda13('0x5'));var config=require('../../config/environment');var attributes=require('./contactItemType.attributes');module[_0xda13('0x6')]=function(_0x3d5a0e,_0x4df317){return _0x3d5a0e[_0xda13('0x7')](_0xda13('0x8'),attributes,{'tableName':_0xda13('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 88824fc..c30d14f 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa74f=['result','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0xcf69e4,_0x22359f){var _0x3ae183=function(_0x34d0fc){while(--_0x34d0fc){_0xcf69e4['push'](_0xcf69e4['shift']());}};_0x3ae183(++_0x22359f);}(_0xa74f,0x9a));var _0xfa74=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0xa74f[_0x1afabf];return _0x497ff1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa74('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa74('0x1'));var db=require(_0xfa74('0x2'))['db'];var utils=require(_0xfa74('0x3'));var logger=require(_0xfa74('0x4'))('rpc');var config=require(_0xfa74('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa74('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x9ddbd2,_0x3ac32e,_0x2d9fa9){return new BPromise(function(_0x287921,_0x344e04){return client['request'](_0x9ddbd2,_0x2d9fa9)[_0xfa74('0x7')](function(_0x37d4d8){logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,'request\x20sent');logger[_0xfa74('0xa')](_0xfa74('0xb'),_0x3ac32e,'request\x20sent',JSON[_0xfa74('0xc')](_0x37d4d8));if(_0x37d4d8[_0xfa74('0xd')]){if(_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xe')]===0x1f4){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x344e04(_0x37d4d8[_0xfa74('0xd')]['message']);}logger[_0xfa74('0xd')](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x287921(_0x37d4d8[_0xfa74('0xd')]['message']);}else{logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,_0xfa74('0x10'));_0x287921(_0x37d4d8[_0xfa74('0x11')][_0xfa74('0xf')]);}})[_0xfa74('0x12')](function(_0x3b9e32){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x3b9e32);_0x344e04(_0x3b9e32);});});} \ No newline at end of file +var _0xb7fc=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xb7fc,0x1e3));var _0xcb7f=function(_0x51e79c,_0x51485e){_0x51e79c=_0x51e79c-0x0;var _0x2467be=_0xb7fc[_0x51e79c];return _0x2467be;};'use strict';var _=require(_0xcb7f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcb7f('0x1'));var rs=require(_0xcb7f('0x2'));var fs=require('fs');var Redis=require(_0xcb7f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcb7f('0x4'))(_0xcb7f('0x5'));var config=require(_0xcb7f('0x6'));var jayson=require(_0xcb7f('0x7'));var client=jayson[_0xcb7f('0x8')][_0xcb7f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5059ca,_0x226ba8,_0x31de8e){return new BPromise(function(_0x1f8ba3,_0x4dde1f){return client[_0xcb7f('0xa')](_0x5059ca,_0x31de8e)[_0xcb7f('0xb')](function(_0x4d8d72){logger[_0xcb7f('0xc')](_0xcb7f('0xd'),_0x226ba8,'request\x20sent');logger[_0xcb7f('0xe')](_0xcb7f('0xf'),_0x226ba8,_0xcb7f('0x10'),JSON[_0xcb7f('0x11')](_0x4d8d72));if(_0x4d8d72[_0xcb7f('0x12')]){if(_0x4d8d72['error']['code']===0x1f4){logger[_0xcb7f('0x12')](_0xcb7f('0xd'),_0x226ba8,_0x4d8d72[_0xcb7f('0x12')][_0xcb7f('0x13')]);return _0x4dde1f(_0x4d8d72[_0xcb7f('0x12')][_0xcb7f('0x13')]);}logger[_0xcb7f('0x12')](_0xcb7f('0xd'),_0x226ba8,_0x4d8d72[_0xcb7f('0x12')][_0xcb7f('0x13')]);return _0x1f8ba3(_0x4d8d72[_0xcb7f('0x12')][_0xcb7f('0x13')]);}else{logger[_0xcb7f('0xc')](_0xcb7f('0xd'),_0x226ba8,_0xcb7f('0x10'));_0x1f8ba3(_0x4d8d72[_0xcb7f('0x14')][_0xcb7f('0x13')]);}})[_0xcb7f('0x15')](function(_0x2c2799){logger[_0xcb7f('0x12')](_0xcb7f('0xd'),_0x226ba8,_0x2c2799);_0x4dde1f(_0x2c2799);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 50539ce..6724649 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x478d=['get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller'];(function(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0x478d,0x7c));var _0xd478=function(_0x16c9f3,_0x4fe03f){_0x16c9f3=_0x16c9f3-0x0;var _0x47709f=_0x478d[_0x16c9f3];return _0x47709f;};'use strict';var multer=require(_0xd478('0x0'));var util=require(_0xd478('0x1'));var path=require(_0xd478('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd478('0x3')]();var fs_extra=require(_0xd478('0x4'));var auth=require(_0xd478('0x5'));var interaction=require(_0xd478('0x6'));var config=require(_0xd478('0x7'));var controller=require(_0xd478('0x8'));router[_0xd478('0x9')]('/',auth[_0xd478('0xa')](),controller[_0xd478('0xb')]);router[_0xd478('0x9')](_0xd478('0xc'),auth[_0xd478('0xa')](),controller['show']);router[_0xd478('0xd')]('/',auth[_0xd478('0xa')](),controller['create']);router[_0xd478('0xe')](_0xd478('0xc'),auth['isAuthenticated'](),controller[_0xd478('0xf')]);router[_0xd478('0x10')](_0xd478('0xc'),auth[_0xd478('0xa')](),controller[_0xd478('0x11')]);module[_0xd478('0x12')]=router; \ No newline at end of file +var _0x8185=['./contactItemType.controller','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8185,0xea));var _0x5818=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x8185[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x5818('0x0'));var util=require('util');var path=require(_0x5818('0x1'));var timeout=require('connect-timeout');var express=require(_0x5818('0x2'));var router=express[_0x5818('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5818('0x4'));var interaction=require(_0x5818('0x5'));var config=require('../../config/environment');var controller=require(_0x5818('0x6'));router[_0x5818('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5818('0x8'),auth[_0x5818('0x9')](),controller['show']);router[_0x5818('0xa')]('/',auth[_0x5818('0x9')](),controller[_0x5818('0xb')]);router[_0x5818('0xc')](_0x5818('0x8'),auth[_0x5818('0x9')](),controller[_0x5818('0xd')]);router[_0x5818('0xe')](_0x5818('0x8'),auth[_0x5818('0x9')](),controller[_0x5818('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index d2939c3..cfc406e 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 _0x9de8=['name','sequelize','STRING'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x9de8,0x88));var _0x89de=function(_0x328adf,_0x28815d){_0x328adf=_0x328adf-0x0;var _0x3df8c1=_0x9de8[_0x328adf];return _0x3df8c1;};'use strict';var Sequelize=require(_0x89de('0x0'));module['exports']={'name':{'type':Sequelize[_0x89de('0x1')],'allowNull':![],'unique':_0x89de('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1c3b=['sequelize','exports','STRING'];(function(_0x37c4af,_0x30622f){var _0x554849=function(_0x365001){while(--_0x365001){_0x37c4af['push'](_0x37c4af['shift']());}};_0x554849(++_0x30622f);}(_0x1c3b,0xab));var _0xb1c3=function(_0x30fe4f,_0x3249fd){_0x30fe4f=_0x30fe4f-0x0;var _0x5a8d62=_0x1c3b[_0x30fe4f];return _0x5a8d62;};'use strict';var Sequelize=require(_0xb1c3('0x0'));module[_0xb1c3('0x1')]={'name':{'type':Sequelize[_0xb1c3('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index c656d2e..384c788 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 _0x05d7=['updatedAt','user','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','where','hasOwnProperty','eml-format','moment','bluebird','mustache','path','ejs','lodash','squel','jsforce','to-csv','papaparse','../../components/auth/service','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','reject','save','update','then','destroy','CustomDashboards','UserProfileResource','end','error','stack','name','send','index','map','Dashboard','rawAttributes','type','key','model','keys','filters','intersection','fields','query','attributes','length','nolimit','order','sort','pick','merge','VIRTUAL','filter','includeAll','findAll','catch','params','include','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt'];(function(_0x46d633,_0x21f10e){var _0xb64527=function(_0x2ddc9d){while(--_0x2ddc9d){_0x46d633['push'](_0x46d633['shift']());}};_0xb64527(++_0x21f10e);}(_0x05d7,0x17a));var _0x705d=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x05d7[_0x3c8e9a];return _0x2d4c57;};'use strict';var emlformat=require(_0x705d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x705d('0x1'));var BPromise=require(_0x705d('0x2'));var Mustache=require(_0x705d('0x3'));var util=require('util');var path=require(_0x705d('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x705d('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x705d('0x6'));var squel=require(_0x705d('0x7'));var crypto=require('crypto');var jsforce=require(_0x705d('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x705d('0x9'));var querystring=require('querystring');var Papa=require(_0x705d('0xa'));var Redis=require('ioredis');var authService=require(_0x705d('0xb'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x705d('0xc'));var utils=require('../../config/utils');var config=require(_0x705d('0xd'));var licenseUtil=require(_0x705d('0xe'));var db=require(_0x705d('0xf'))['db'];config[_0x705d('0x10')]=_[_0x705d('0x11')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x705d('0x12'))(new Redis(config[_0x705d('0x10')]));require('./dashboard.socket')[_0x705d('0x13')](socket);function respondWithStatusCode(_0x561477,_0x6f6f5){_0x6f6f5=_0x6f6f5||0xcc;return function(_0xdb8ce){if(_0xdb8ce){return _0x561477[_0x705d('0x14')](_0x6f6f5);}return _0x561477['status'](_0x6f6f5)['end']();};}function respondWithResult(_0x428d4d,_0xa61b3b){_0xa61b3b=_0xa61b3b||0xc8;return function(_0x83e201){if(_0x83e201){return _0x428d4d[_0x705d('0x15')](_0xa61b3b)[_0x705d('0x16')](_0x83e201);}};}function respondWithFilteredResult(_0xf28c4c,_0xcd31c7){return function(_0x14810b){if(_0x14810b){var _0x564abd=typeof _0xcd31c7[_0x705d('0x17')]==='undefined'&&typeof _0xcd31c7['limit']===_0x705d('0x18');var _0x3258b9=_0x14810b[_0x705d('0x19')];var _0x529a70=_0x564abd?0x0:_0xcd31c7['offset'];var _0x5741a1=_0x564abd?_0x14810b['count']:_0xcd31c7[_0x705d('0x17')]+_0xcd31c7[_0x705d('0x1a')];var _0x14bc3a;if(_0x5741a1>=_0x3258b9){_0x5741a1=_0x3258b9;_0x14bc3a=0xc8;}else{_0x14bc3a=0xce;}_0xf28c4c['status'](_0x14bc3a);return _0xf28c4c['set']('Content-Range',_0x529a70+'-'+_0x5741a1+'/'+_0x3258b9)[_0x705d('0x16')](_0x14810b);}return null;};}function patchUpdates(_0x318678){return function(_0x249989){try{jsonpatch['apply'](_0x249989,_0x318678,!![]);}catch(_0x5367cb){return BPromise[_0x705d('0x1b')](_0x5367cb);}return _0x249989[_0x705d('0x1c')]();};}function saveUpdates(_0x1755ca,_0x321e94){return function(_0x5ad32b){if(_0x5ad32b){return _0x5ad32b[_0x705d('0x1d')](_0x1755ca)[_0x705d('0x1e')](function(_0x31b571){return _0x31b571;});}return null;};}function removeEntity(_0x4c96a5,_0x362d94){return function(_0x4fbfd4){if(_0x4fbfd4){return _0x4fbfd4[_0x705d('0x1f')]()[_0x705d('0x1e')](function(){var _0x4abca9=_0x4fbfd4['get']({'plain':!![]});var _0x226200=_0x705d('0x20');return db[_0x705d('0x21')][_0x705d('0x1f')]({'where':{'type':_0x226200,'resourceId':_0x4abca9['id']}})[_0x705d('0x1e')](function(){return _0x4fbfd4;});})[_0x705d('0x1e')](function(){_0x4c96a5['status'](0xcc)[_0x705d('0x22')]();});}};}function handleEntityNotFound(_0x30d1fa,_0x89fd07){return function(_0x1fd109){if(!_0x1fd109){_0x30d1fa[_0x705d('0x14')](0x194);}return _0x1fd109;};}function handleError(_0x5ed1fc,_0x186d20){_0x186d20=_0x186d20||0x1f4;return function(_0x270f91){logger[_0x705d('0x23')](_0x270f91[_0x705d('0x24')]);if(_0x270f91[_0x705d('0x25')]){delete _0x270f91[_0x705d('0x25')];}_0x5ed1fc[_0x705d('0x15')](_0x186d20)[_0x705d('0x26')](_0x270f91);};}exports[_0x705d('0x27')]=function(_0x482b0c,_0x24ce35){var _0x114424={},_0x1d5635={},_0x56818c={'count':0x0,'rows':[]};var _0x4a0d88=_[_0x705d('0x28')](db[_0x705d('0x29')][_0x705d('0x2a')],function(_0x584184){return{'name':_0x584184['fieldName'],'type':_0x584184[_0x705d('0x2b')][_0x705d('0x2c')]};});_0x1d5635[_0x705d('0x2d')]=_['map'](_0x4a0d88,'name');_0x1d5635['query']=_[_0x705d('0x2e')](_0x482b0c['query']);_0x1d5635[_0x705d('0x2f')]=_[_0x705d('0x30')](_0x1d5635['model'],_0x1d5635['query']);_0x114424['attributes']=_[_0x705d('0x30')](_0x1d5635[_0x705d('0x2d')],qs[_0x705d('0x31')](_0x482b0c[_0x705d('0x32')][_0x705d('0x31')]));_0x114424[_0x705d('0x33')]=_0x114424[_0x705d('0x33')][_0x705d('0x34')]?_0x114424[_0x705d('0x33')]:_0x1d5635[_0x705d('0x2d')];if(!_0x482b0c[_0x705d('0x32')]['hasOwnProperty'](_0x705d('0x35'))){_0x114424[_0x705d('0x1a')]=qs[_0x705d('0x1a')](_0x482b0c[_0x705d('0x32')][_0x705d('0x1a')]);_0x114424[_0x705d('0x17')]=qs['offset'](_0x482b0c[_0x705d('0x32')][_0x705d('0x17')]);}_0x114424[_0x705d('0x36')]=qs[_0x705d('0x37')](_0x482b0c[_0x705d('0x32')]['sort']);_0x114424['where']=qs['filters'](_[_0x705d('0x38')](_0x482b0c[_0x705d('0x32')],_0x1d5635[_0x705d('0x2f')]),_0x4a0d88);if(_0x482b0c[_0x705d('0x32')]['filter']){_0x114424['where']=_[_0x705d('0x39')](_0x114424['where'],{'$or':_[_0x705d('0x28')](_0x4a0d88,function(_0x2295cb){if(_0x2295cb[_0x705d('0x2b')]!==_0x705d('0x3a')){var _0x43bfce={};_0x43bfce[_0x2295cb[_0x705d('0x25')]]={'$like':'%'+_0x482b0c['query'][_0x705d('0x3b')]+'%'};return _0x43bfce;}})});}_0x114424=_['merge']({},_0x114424,_0x482b0c['options']);var _0x440ad8={'where':_0x114424['where']};return db['Dashboard'][_0x705d('0x19')](_0x440ad8)[_0x705d('0x1e')](function(_0x13cea1){_0x56818c[_0x705d('0x19')]=_0x13cea1;if(_0x482b0c[_0x705d('0x32')][_0x705d('0x3c')]){_0x114424['include']=[{'all':!![]}];}return db[_0x705d('0x29')][_0x705d('0x3d')](_0x114424);})[_0x705d('0x1e')](function(_0x3ebe3a){_0x56818c['rows']=_0x3ebe3a;return _0x56818c;})[_0x705d('0x1e')](respondWithFilteredResult(_0x24ce35,_0x114424))[_0x705d('0x3e')](handleError(_0x24ce35,null));};exports['show']=function(_0x1b808e,_0x362644){var _0x440dae={'raw':![],'where':{'id':_0x1b808e[_0x705d('0x3f')]['id']}},_0x1b3e01={};_0x1b3e01[_0x705d('0x2d')]=_[_0x705d('0x2e')](db[_0x705d('0x29')][_0x705d('0x2a')]);_0x1b3e01[_0x705d('0x32')]=_['keys'](_0x1b808e[_0x705d('0x32')]);_0x1b3e01['filters']=_[_0x705d('0x30')](_0x1b3e01[_0x705d('0x2d')],_0x1b3e01[_0x705d('0x32')]);_0x440dae['attributes']=_[_0x705d('0x30')](_0x1b3e01[_0x705d('0x2d')],qs[_0x705d('0x31')](_0x1b808e[_0x705d('0x32')][_0x705d('0x31')]));_0x440dae['attributes']=_0x440dae[_0x705d('0x33')][_0x705d('0x34')]?_0x440dae[_0x705d('0x33')]:_0x1b3e01[_0x705d('0x2d')];if(_0x1b808e[_0x705d('0x32')][_0x705d('0x3c')]){_0x440dae[_0x705d('0x40')]=[{'all':!![]}];}_0x440dae=_[_0x705d('0x39')]({},_0x440dae,_0x1b808e[_0x705d('0x41')]);return db['Dashboard']['find'](_0x440dae)[_0x705d('0x1e')](handleEntityNotFound(_0x362644,null))[_0x705d('0x1e')](respondWithResult(_0x362644,null))['catch'](handleError(_0x362644,null));};exports['create']=function(_0x1b6d04,_0x4556c9){return db[_0x705d('0x29')][_0x705d('0x42')](_0x1b6d04[_0x705d('0x43')],{})[_0x705d('0x1e')](function(_0x5d9dde){var _0x38a51d=_0x1b6d04['user'][_0x705d('0x44')]({'plain':!![]});if(!_0x38a51d)throw new Error(_0x705d('0x45'));if(_0x38a51d[_0x705d('0x46')]==='user'){var _0x29ea71=_0x5d9dde[_0x705d('0x44')]({'plain':!![]});var _0x106cc9='CustomDashboards';return db[_0x705d('0x47')][_0x705d('0x48')]({'where':{'name':_0x106cc9,'userProfileId':_0x38a51d['userProfileId']},'raw':!![]})[_0x705d('0x1e')](function(_0x4eceaa){if(_0x4eceaa&&_0x4eceaa[_0x705d('0x49')]===0x0){return db['UserProfileResource'][_0x705d('0x42')]({'name':_0x29ea71[_0x705d('0x25')],'resourceId':_0x29ea71['id'],'type':_0x4eceaa[_0x705d('0x25')],'sectionId':_0x4eceaa['id']},{})[_0x705d('0x1e')](function(){return _0x5d9dde;});}else{return _0x5d9dde;}})[_0x705d('0x3e')](function(_0x925af5){logger[_0x705d('0x23')](_0x705d('0x4a'),_0x925af5);throw _0x925af5;});}return _0x5d9dde;})[_0x705d('0x1e')](respondWithResult(_0x4556c9,0xc9))['catch'](handleError(_0x4556c9,null));};exports[_0x705d('0x4b')]=function(_0x18844f,_0xaffd6d){var _0x10d6e5={'where':{'id':_0x18844f['params']['id']}},_0x4fcc3c={};_0x4fcc3c[_0x705d('0x2d')]=_[_0x705d('0x2e')](db[_0x705d('0x29')]['rawAttributes']);_0x10d6e5[_0x705d('0x33')]=_[_0x705d('0x30')](_0x4fcc3c[_0x705d('0x2d')],qs[_0x705d('0x31')](_0x18844f[_0x705d('0x32')]['fields']));_0x10d6e5[_0x705d('0x33')]=_0x10d6e5[_0x705d('0x33')][_0x705d('0x34')]?_0x10d6e5['attributes']:_0x4fcc3c[_0x705d('0x2d')];if(_0x18844f[_0x705d('0x32')][_0x705d('0x3c')]){_0x10d6e5[_0x705d('0x40')]=[{'all':!![]}];}_0x10d6e5=_['merge']({},_0x10d6e5,_0x18844f[_0x705d('0x41')]);return db[_0x705d('0x29')][_0x705d('0x48')](_0x10d6e5)[_0x705d('0x1e')](handleEntityNotFound(_0xaffd6d,null))['then'](function(_0x1f8d0b){if(_0x1f8d0b){var _0xfcf010=_0x1f8d0b[_0x705d('0x44')]({'plain':!![]});_0xfcf010=qs[_0x705d('0x4c')](_0xfcf010,['id',_0x705d('0x4d'),_0x705d('0x4e')]);_0x18844f[_0x705d('0x43')]=_[_0x705d('0x4c')](_0x18844f[_0x705d('0x43')],['id',_0x705d('0x4d'),_0x705d('0x4e')]);return db['Dashboard'][_0x705d('0x42')](_['merge'](_0xfcf010,_0x18844f[_0x705d('0x43')]),{'include':_0x18844f[_0x705d('0x32')][_0x705d('0x3c')]?[{'all':!![]}]:undefined})['then'](function(_0x131ef3){var _0x511243=_0x18844f[_0x705d('0x4f')]['get']({'plain':!![]});if(!_0x511243)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x511243['role']==='user'){var _0x17ec3d=_0x131ef3[_0x705d('0x44')]({'plain':!![]});var _0xf3bb51=_0x705d('0x20');return db[_0x705d('0x47')]['find']({'where':{'name':_0xf3bb51,'userProfileId':_0x511243['userProfileId']},'raw':!![]})[_0x705d('0x1e')](function(_0x4251d0){if(_0x4251d0&&_0x4251d0[_0x705d('0x49')]===0x0){return db[_0x705d('0x21')][_0x705d('0x42')]({'name':_0x17ec3d[_0x705d('0x25')],'resourceId':_0x17ec3d['id'],'type':_0x4251d0[_0x705d('0x25')],'sectionId':_0x4251d0['id']},{})[_0x705d('0x1e')](function(){return _0x131ef3;});}else{return _0x131ef3;}})['catch'](function(_0x529837){logger['error'](_0x705d('0x4a'),_0x529837);throw _0x529837;});}return _0x131ef3;});}})[_0x705d('0x1e')](respondWithResult(_0xaffd6d,0xc9))[_0x705d('0x3e')](handleError(_0xaffd6d,null));};exports['update']=function(_0x2ab46e,_0x14296a){if(_0x2ab46e[_0x705d('0x43')]['id']){delete _0x2ab46e[_0x705d('0x43')]['id'];}return db[_0x705d('0x29')][_0x705d('0x48')]({'where':{'id':_0x2ab46e[_0x705d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x14296a,null))[_0x705d('0x1e')](saveUpdates(_0x2ab46e[_0x705d('0x43')],null))[_0x705d('0x1e')](respondWithResult(_0x14296a,null))[_0x705d('0x3e')](handleError(_0x14296a,null));};exports[_0x705d('0x1f')]=function(_0xbbd1a1,_0xa095fa){return db[_0x705d('0x29')]['find']({'where':{'id':_0xbbd1a1['params']['id']}})[_0x705d('0x1e')](handleEntityNotFound(_0xa095fa,null))['then'](removeEntity(_0xa095fa,null))['catch'](handleError(_0xa095fa,null));};function widgetAttributes(_0x2d3b92){try{switch(_0x2d3b92[_0x705d('0x2b')]){case _0x705d('0x50'):return[{'name':_0x705d('0x51'),'value':_0x2d3b92['attrUrl']||(_0x2d3b92[_0x705d('0x52')]&&_0x2d3b92['attrs'][0x0]?_0x2d3b92[_0x705d('0x52')][0x0]['value']:undefined)||_0x705d('0x53')}];case _0x705d('0x54'):return[{'name':_0x705d('0x55'),'value':_0x2d3b92[_0x705d('0x55')]||(_0x2d3b92[_0x705d('0x52')]&&_0x2d3b92[_0x705d('0x52')][0x0]?_0x2d3b92[_0x705d('0x52')][0x0][_0x705d('0x56')]:undefined)||''}];case _0x705d('0x57'):return[{'name':_0x705d('0x58'),'value':_0x2d3b92[_0x705d('0x58')]||(_0x2d3b92[_0x705d('0x52')]&&_0x2d3b92[_0x705d('0x52')][0x0]?_0x2d3b92[_0x705d('0x52')][0x0]['value']:undefined)||_0x705d('0x59')},{'name':_0x705d('0x5a'),'value':_0x2d3b92[_0x705d('0x5a')]||(_0x2d3b92[_0x705d('0x52')]&&_0x2d3b92[_0x705d('0x52')][0x1]?_0x2d3b92[_0x705d('0x52')][0x1][_0x705d('0x56')]:undefined)||_0x705d('0x5b')},{'name':_0x705d('0x5c'),'value':_0x2d3b92[_0x705d('0x5c')]||(_0x2d3b92[_0x705d('0x52')]&&_0x2d3b92['attrs'][0x2]?_0x2d3b92[_0x705d('0x52')][0x2][_0x705d('0x56')]:undefined)||0xc}];case _0x705d('0x5d'):return[{'name':_0x705d('0x5e'),'value':_0x2d3b92[_0x705d('0x5e')]||(_0x2d3b92['attrs']&&_0x2d3b92['attrs'][0x0]?_0x2d3b92[_0x705d('0x52')][0x0][_0x705d('0x56')]:undefined)||_0x705d('0x5f')},{'name':_0x705d('0x60'),'value':_0x2d3b92[_0x705d('0x60')]||(_0x2d3b92[_0x705d('0x52')]&&_0x2d3b92[_0x705d('0x52')][0x1]?_0x2d3b92['attrs'][0x1][_0x705d('0x56')]:undefined)||[]},{'name':_0x705d('0x5c'),'value':_0x2d3b92['attrFontSize']||(_0x2d3b92[_0x705d('0x52')]&&_0x2d3b92['attrs'][0x2]?_0x2d3b92[_0x705d('0x52')][0x2][_0x705d('0x56')]:undefined)||0x14}];case _0x705d('0x61'):case _0x705d('0x62'):return[{'name':_0x705d('0x63'),'value':_0x2d3b92[_0x705d('0x63')]||(_0x2d3b92[_0x705d('0x52')]&&_0x2d3b92[_0x705d('0x52')][0x0]?_0x2d3b92[_0x705d('0x52')][0x0][_0x705d('0x56')]:undefined)||_0x705d('0x5f')},{'name':_0x705d('0x64'),'value':_0x2d3b92[_0x705d('0x64')]||(_0x2d3b92[_0x705d('0x52')]&&_0x2d3b92[_0x705d('0x52')][0x1]?_0x2d3b92[_0x705d('0x52')][0x1]['value']:undefined)||null},{'name':_0x705d('0x65'),'value':_0x2d3b92[_0x705d('0x65')]||(_0x2d3b92[_0x705d('0x52')]&&_0x2d3b92[_0x705d('0x52')][0x2]?_0x2d3b92[_0x705d('0x52')][0x2][_0x705d('0x56')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x2d3b92[_0x705d('0x60')]||(_0x2d3b92['attrs']&&_0x2d3b92[_0x705d('0x52')][0x3]?_0x2d3b92[_0x705d('0x52')][0x3][_0x705d('0x56')]:undefined)||[]}];case _0x705d('0x66'):return[{'name':_0x705d('0x67'),'type':_0x2d3b92['reportType']||(_0x2d3b92[_0x705d('0x52')]&&_0x2d3b92[_0x705d('0x52')][0x0]?_0x2d3b92['attrs'][0x0][_0x705d('0x2b')]:undefined)||null,'value':_0x2d3b92[_0x705d('0x67')]||(_0x2d3b92['attrs']&&_0x2d3b92['attrs'][0x0]?_0x2d3b92[_0x705d('0x52')][0x0][_0x705d('0x56')]:undefined)||null},{'name':_0x705d('0x68'),'value':_0x2d3b92[_0x705d('0x68')]||(_0x2d3b92[_0x705d('0x52')]&&_0x2d3b92[_0x705d('0x52')][0x1]?_0x2d3b92['attrs'][0x1][_0x705d('0x56')]:undefined)||0x0}];default:return[];}}catch(_0xd14d26){logger[_0x705d('0x23')](_0x705d('0x69'),JSON[_0x705d('0x6a')](_0xd14d26));return[];}}exports[_0x705d('0x6b')]=function(_0x27ea11,_0x4bbe6d,_0x429d72){if(_0x27ea11[_0x705d('0x43')]['id']){delete _0x27ea11['body']['id'];}return db[_0x705d('0x29')][_0x705d('0x48')]({'where':{'id':_0x27ea11[_0x705d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4bbe6d,null))['then'](function(_0x29b1a1){if(_0x29b1a1){_0x27ea11[_0x705d('0x43')][_0x705d('0x6c')]=_0x29b1a1['id'];_0x27ea11['body'][_0x705d('0x52')]=widgetAttributes(_0x27ea11['body']);return db[_0x705d('0x6d')][_0x705d('0x42')](_0x27ea11[_0x705d('0x43')]);}})['then'](respondWithResult(_0x4bbe6d,null))['catch'](handleError(_0x4bbe6d,null));};exports[_0x705d('0x6e')]=function(_0x441c2e,_0x2b0cbb,_0x4af6d8){var _0x15c291={};var _0x2ab50f={};var _0x569a30;var _0x179d34;return db['Dashboard'][_0x705d('0x6f')]({'where':{'id':_0x441c2e['params']['id']}})[_0x705d('0x1e')](handleEntityNotFound(_0x2b0cbb,null))[_0x705d('0x1e')](function(_0x470c51){if(_0x470c51){_0x569a30=_0x470c51;_0x2ab50f[_0x705d('0x2d')]=_['keys'](db['DashboardItem'][_0x705d('0x2a')]);_0x2ab50f[_0x705d('0x32')]=_[_0x705d('0x2e')](_0x441c2e[_0x705d('0x32')]);_0x2ab50f[_0x705d('0x2f')]=_['intersection'](_0x2ab50f['model'],_0x2ab50f['query']);_0x15c291[_0x705d('0x33')]=_[_0x705d('0x30')](_0x2ab50f['model'],qs[_0x705d('0x31')](_0x441c2e[_0x705d('0x32')]['fields']));_0x15c291['attributes']=_0x15c291['attributes']['length']?_0x15c291[_0x705d('0x33')]:_0x2ab50f[_0x705d('0x2d')];_0x15c291[_0x705d('0x36')]=qs['sort'](_0x441c2e[_0x705d('0x32')]['sort']);_0x15c291[_0x705d('0x70')]=qs['filters'](_[_0x705d('0x38')](_0x441c2e[_0x705d('0x32')],_0x2ab50f[_0x705d('0x2f')]));if(_0x441c2e['query']['filter']){_0x15c291['where']=_['merge'](_0x15c291[_0x705d('0x70')],{'$or':_[_0x705d('0x28')](_0x15c291[_0x705d('0x33')],function(_0x1f9682){var _0x42e5da={};_0x42e5da[_0x1f9682]={'$like':'%'+_0x441c2e['query'][_0x705d('0x3b')]+'%'};return _0x42e5da;})});}_0x15c291=_['merge']({},_0x15c291,_0x441c2e[_0x705d('0x41')]);return _0x569a30[_0x705d('0x6e')](_0x15c291);}})['then'](function(_0x1fe6e3){if(_0x1fe6e3){_0x179d34=_0x1fe6e3[_0x705d('0x34')];if(!_0x441c2e[_0x705d('0x32')][_0x705d('0x71')](_0x705d('0x35'))){_0x15c291['limit']=qs[_0x705d('0x1a')](_0x441c2e['query'][_0x705d('0x1a')]);_0x15c291[_0x705d('0x17')]=qs[_0x705d('0x17')](_0x441c2e[_0x705d('0x32')][_0x705d('0x17')]);}return _0x569a30[_0x705d('0x6e')](_0x15c291);}})[_0x705d('0x1e')](function(_0x2045c4){if(_0x2045c4){return _0x2045c4?{'count':_0x179d34,'rows':_0x2045c4}:null;}})[_0x705d('0x1e')](respondWithResult(_0x2b0cbb,null))[_0x705d('0x3e')](handleError(_0x2b0cbb,null));}; \ No newline at end of file +var _0x3d6b=['attrVoiceQueues','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','findOne','pick','getItems','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','limit','count','offset','set','apply','update','then','destroy','get','UserProfileResource','error','name','send','index','Dashboard','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','autoAssociation','clone','omit','createdAt','body','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric'];(function(_0x3ec122,_0x55150a){var _0x4ecf41=function(_0x1709cd){while(--_0x1709cd){_0x3ec122['push'](_0x3ec122['shift']());}};_0x4ecf41(++_0x55150a);}(_0x3d6b,0x173));var _0xb3d6=function(_0x38c699,_0x56fea7){_0x38c699=_0x38c699-0x0;var _0x3b1ded=_0x3d6b[_0x38c699];return _0x3b1ded;};'use strict';var emlformat=require(_0xb3d6('0x0'));var rimraf=require(_0xb3d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb3d6('0x2'));var rp=require(_0xb3d6('0x3'));var moment=require(_0xb3d6('0x4'));var BPromise=require(_0xb3d6('0x5'));var Mustache=require(_0xb3d6('0x6'));var util=require(_0xb3d6('0x7'));var path=require(_0xb3d6('0x8'));var sox=require(_0xb3d6('0x9'));var csv=require(_0xb3d6('0xa'));var ejs=require(_0xb3d6('0xb'));var fs=require('fs');var fs_extra=require(_0xb3d6('0xc'));var _=require(_0xb3d6('0xd'));var squel=require('squel');var crypto=require(_0xb3d6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb3d6('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb3d6('0x10'));var Redis=require(_0xb3d6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb3d6('0x12'));var as=require(_0xb3d6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb3d6('0x14'));var licenseUtil=require(_0xb3d6('0x15'));var db=require('../../mysqldb')['db'];config[_0xb3d6('0x16')]=_[_0xb3d6('0x17')](config[_0xb3d6('0x16')],{'host':_0xb3d6('0x18'),'port':0x18eb});var socket=require(_0xb3d6('0x19'))(new Redis(config['redis']));require('./dashboard.socket')[_0xb3d6('0x1a')](socket);function respondWithStatusCode(_0x1586b5,_0x7c4ac5){_0x7c4ac5=_0x7c4ac5||0xcc;return function(_0x3b77bd){if(_0x3b77bd){return _0x1586b5[_0xb3d6('0x1b')](_0x7c4ac5);}return _0x1586b5[_0xb3d6('0x1c')](_0x7c4ac5)['end']();};}function respondWithResult(_0x3d58d8,_0x2b760c){_0x2b760c=_0x2b760c||0xc8;return function(_0x221bda){if(_0x221bda){return _0x3d58d8[_0xb3d6('0x1c')](_0x2b760c)[_0xb3d6('0x1d')](_0x221bda);}};}function respondWithFilteredResult(_0x17f151,_0x290a57){return function(_0x4ad45e){if(_0x4ad45e){var _0xd635be=typeof _0x290a57['offset']===_0xb3d6('0x1e')&&typeof _0x290a57[_0xb3d6('0x1f')]==='undefined';var _0x5ca053=_0x4ad45e[_0xb3d6('0x20')];var _0x52aef8=_0xd635be?0x0:_0x290a57[_0xb3d6('0x21')];var _0x45a3e6=_0xd635be?_0x4ad45e['count']:_0x290a57['offset']+_0x290a57[_0xb3d6('0x1f')];var _0x2df1c5;if(_0x45a3e6>=_0x5ca053){_0x45a3e6=_0x5ca053;_0x2df1c5=0xc8;}else{_0x2df1c5=0xce;}_0x17f151[_0xb3d6('0x1c')](_0x2df1c5);return _0x17f151[_0xb3d6('0x22')]('Content-Range',_0x52aef8+'-'+_0x45a3e6+'/'+_0x5ca053)[_0xb3d6('0x1d')](_0x4ad45e);}return null;};}function patchUpdates(_0xa4ed35){return function(_0x1f8431){try{jsonpatch[_0xb3d6('0x23')](_0x1f8431,_0xa4ed35,!![]);}catch(_0x462ef3){return BPromise['reject'](_0x462ef3);}return _0x1f8431['save']();};}function saveUpdates(_0x33f260,_0x37ccd1){return function(_0x2e7b2d){if(_0x2e7b2d){return _0x2e7b2d[_0xb3d6('0x24')](_0x33f260)[_0xb3d6('0x25')](function(_0x226eae){return _0x226eae;});}return null;};}function removeEntity(_0x56dacf,_0x3b209d){return function(_0x4a8440){if(_0x4a8440){return _0x4a8440[_0xb3d6('0x26')]()['then'](function(){var _0x537aac=_0x4a8440[_0xb3d6('0x27')]({'plain':!![]});var _0x4ac2d6='CustomDashboards';return db[_0xb3d6('0x28')]['destroy']({'where':{'type':_0x4ac2d6,'resourceId':_0x537aac['id']}})[_0xb3d6('0x25')](function(){return _0x4a8440;});})[_0xb3d6('0x25')](function(){_0x56dacf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cbf08,_0x14e214){return function(_0x468cfe){if(!_0x468cfe){_0x2cbf08[_0xb3d6('0x1b')](0x194);}return _0x468cfe;};}function handleError(_0x50e69f,_0x2a9dbd){_0x2a9dbd=_0x2a9dbd||0x1f4;return function(_0x571f5d){logger[_0xb3d6('0x29')](_0x571f5d['stack']);if(_0x571f5d[_0xb3d6('0x2a')]){delete _0x571f5d['name'];}_0x50e69f[_0xb3d6('0x1c')](_0x2a9dbd)[_0xb3d6('0x2b')](_0x571f5d);};}exports[_0xb3d6('0x2c')]=function(_0x1dbff5,_0x1271a9){var _0x411207={},_0x483515={},_0x41dd02={'count':0x0,'rows':[]};var _0x10b64e=_['map'](db[_0xb3d6('0x2d')]['rawAttributes'],function(_0x5cd7d6){return{'name':_0x5cd7d6[_0xb3d6('0x2e')],'type':_0x5cd7d6[_0xb3d6('0x2f')]['key']};});_0x483515[_0xb3d6('0x30')]=_[_0xb3d6('0x31')](_0x10b64e,_0xb3d6('0x2a'));_0x483515[_0xb3d6('0x32')]=_[_0xb3d6('0x33')](_0x1dbff5[_0xb3d6('0x32')]);_0x483515[_0xb3d6('0x34')]=_[_0xb3d6('0x35')](_0x483515[_0xb3d6('0x30')],_0x483515['query']);_0x411207[_0xb3d6('0x36')]=_[_0xb3d6('0x35')](_0x483515[_0xb3d6('0x30')],qs[_0xb3d6('0x37')](_0x1dbff5[_0xb3d6('0x32')][_0xb3d6('0x37')]));_0x411207[_0xb3d6('0x36')]=_0x411207[_0xb3d6('0x36')][_0xb3d6('0x38')]?_0x411207['attributes']:_0x483515[_0xb3d6('0x30')];if(!_0x1dbff5['query'][_0xb3d6('0x39')](_0xb3d6('0x3a'))){_0x411207[_0xb3d6('0x1f')]=qs[_0xb3d6('0x1f')](_0x1dbff5[_0xb3d6('0x32')][_0xb3d6('0x1f')]);_0x411207['offset']=qs['offset'](_0x1dbff5[_0xb3d6('0x32')][_0xb3d6('0x21')]);}_0x411207[_0xb3d6('0x3b')]=qs[_0xb3d6('0x3c')](_0x1dbff5[_0xb3d6('0x32')]['sort']);_0x411207[_0xb3d6('0x3d')]=qs[_0xb3d6('0x34')](_['pick'](_0x1dbff5[_0xb3d6('0x32')],_0x483515['filters']),_0x10b64e);if(_0x1dbff5[_0xb3d6('0x32')][_0xb3d6('0x3e')]){_0x411207[_0xb3d6('0x3d')]=_[_0xb3d6('0x3f')](_0x411207[_0xb3d6('0x3d')],{'$or':_[_0xb3d6('0x31')](_0x10b64e,function(_0x3da0c2){if(_0x3da0c2[_0xb3d6('0x2f')]!=='VIRTUAL'){var _0x439d33={};_0x439d33[_0x3da0c2[_0xb3d6('0x2a')]]={'$like':'%'+_0x1dbff5[_0xb3d6('0x32')][_0xb3d6('0x3e')]+'%'};return _0x439d33;}})});}_0x411207=_['merge']({},_0x411207,_0x1dbff5[_0xb3d6('0x40')]);var _0x909c56={'where':_0x411207[_0xb3d6('0x3d')]};return db[_0xb3d6('0x2d')][_0xb3d6('0x20')](_0x909c56)[_0xb3d6('0x25')](function(_0x5ac125){_0x41dd02[_0xb3d6('0x20')]=_0x5ac125;if(_0x1dbff5['query'][_0xb3d6('0x41')]){_0x411207['include']=[{'all':!![]}];}return db[_0xb3d6('0x2d')][_0xb3d6('0x42')](_0x411207);})[_0xb3d6('0x25')](function(_0x3b8d2f){_0x41dd02[_0xb3d6('0x43')]=_0x3b8d2f;return _0x41dd02;})[_0xb3d6('0x25')](respondWithFilteredResult(_0x1271a9,_0x411207))[_0xb3d6('0x44')](handleError(_0x1271a9,null));};exports[_0xb3d6('0x45')]=function(_0xfaec47,_0x525479){var _0x1a9f5c={'raw':![],'where':{'id':_0xfaec47[_0xb3d6('0x46')]['id']}},_0x52b4f0={};_0x52b4f0[_0xb3d6('0x30')]=_[_0xb3d6('0x33')](db['Dashboard'][_0xb3d6('0x47')]);_0x52b4f0['query']=_[_0xb3d6('0x33')](_0xfaec47[_0xb3d6('0x32')]);_0x52b4f0[_0xb3d6('0x34')]=_['intersection'](_0x52b4f0[_0xb3d6('0x30')],_0x52b4f0[_0xb3d6('0x32')]);_0x1a9f5c[_0xb3d6('0x36')]=_[_0xb3d6('0x35')](_0x52b4f0['model'],qs[_0xb3d6('0x37')](_0xfaec47[_0xb3d6('0x32')][_0xb3d6('0x37')]));_0x1a9f5c[_0xb3d6('0x36')]=_0x1a9f5c['attributes'][_0xb3d6('0x38')]?_0x1a9f5c[_0xb3d6('0x36')]:_0x52b4f0[_0xb3d6('0x30')];if(_0xfaec47[_0xb3d6('0x32')][_0xb3d6('0x41')]){_0x1a9f5c[_0xb3d6('0x48')]=[{'all':!![]}];}_0x1a9f5c=_[_0xb3d6('0x3f')]({},_0x1a9f5c,_0xfaec47[_0xb3d6('0x40')]);return db[_0xb3d6('0x2d')][_0xb3d6('0x49')](_0x1a9f5c)['then'](handleEntityNotFound(_0x525479,null))[_0xb3d6('0x25')](respondWithResult(_0x525479,null))[_0xb3d6('0x44')](handleError(_0x525479,null));};exports[_0xb3d6('0x4a')]=function(_0x42933b,_0x4271b3){return db[_0xb3d6('0x2d')][_0xb3d6('0x4a')](_0x42933b['body'],{})[_0xb3d6('0x25')](function(_0x2bc431){var _0x2739f7=_0x42933b[_0xb3d6('0x4b')][_0xb3d6('0x27')]({'plain':!![]});if(!_0x2739f7)throw new Error(_0xb3d6('0x4c'));if(_0x2739f7[_0xb3d6('0x4d')]==='user'){var _0x184093=_0x2bc431[_0xb3d6('0x27')]({'plain':!![]});var _0x31a5d4=_0xb3d6('0x4e');return db[_0xb3d6('0x4f')][_0xb3d6('0x49')]({'where':{'name':_0x31a5d4,'userProfileId':_0x2739f7['userProfileId']},'raw':!![]})[_0xb3d6('0x25')](function(_0x342d9f){if(_0x342d9f&&_0x342d9f[_0xb3d6('0x50')]===0x0){return db[_0xb3d6('0x28')][_0xb3d6('0x4a')]({'name':_0x184093['name'],'resourceId':_0x184093['id'],'type':_0x342d9f['name'],'sectionId':_0x342d9f['id']},{})[_0xb3d6('0x25')](function(){return _0x2bc431;});}else{return _0x2bc431;}})[_0xb3d6('0x44')](function(_0x394ab){logger[_0xb3d6('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x394ab);throw _0x394ab;});}return _0x2bc431;})['then'](respondWithResult(_0x4271b3,0xc9))[_0xb3d6('0x44')](handleError(_0x4271b3,null));};exports[_0xb3d6('0x51')]=function(_0x461bba,_0x161690){var _0x3d7b43={'where':{'id':_0x461bba['params']['id']}},_0x28426b={};_0x28426b[_0xb3d6('0x30')]=_[_0xb3d6('0x33')](db[_0xb3d6('0x2d')]['rawAttributes']);_0x3d7b43['attributes']=_[_0xb3d6('0x35')](_0x28426b['model'],qs['fields'](_0x461bba[_0xb3d6('0x32')][_0xb3d6('0x37')]));_0x3d7b43[_0xb3d6('0x36')]=_0x3d7b43[_0xb3d6('0x36')][_0xb3d6('0x38')]?_0x3d7b43[_0xb3d6('0x36')]:_0x28426b[_0xb3d6('0x30')];if(_0x461bba[_0xb3d6('0x32')]['includeAll']){_0x3d7b43['include']=[{'all':!![]}];}_0x3d7b43=_[_0xb3d6('0x3f')]({},_0x3d7b43,_0x461bba[_0xb3d6('0x40')]);return db[_0xb3d6('0x2d')]['find'](_0x3d7b43)[_0xb3d6('0x25')](handleEntityNotFound(_0x161690,null))['then'](function(_0x2b1085){if(_0x2b1085){var _0x4ea252=_0x2b1085['get']({'plain':!![]});_0x4ea252=qs[_0xb3d6('0x52')](_0x4ea252,['id',_0xb3d6('0x53'),'updatedAt']);_0x461bba[_0xb3d6('0x54')]=_[_0xb3d6('0x52')](_0x461bba[_0xb3d6('0x54')],['id',_0xb3d6('0x53'),_0xb3d6('0x55')]);return db['Dashboard'][_0xb3d6('0x4a')](_[_0xb3d6('0x3f')](_0x4ea252,_0x461bba[_0xb3d6('0x54')]),{'include':_0x461bba[_0xb3d6('0x32')][_0xb3d6('0x41')]?[{'all':!![]}]:undefined})['then'](function(_0x5af67c){var _0x266b8a=_0x461bba[_0xb3d6('0x4b')][_0xb3d6('0x27')]({'plain':!![]});if(!_0x266b8a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x266b8a[_0xb3d6('0x4d')]===_0xb3d6('0x4b')){var _0x5b8230=_0x5af67c[_0xb3d6('0x27')]({'plain':!![]});var _0x4ed2e0=_0xb3d6('0x4e');return db['UserProfileSection'][_0xb3d6('0x49')]({'where':{'name':_0x4ed2e0,'userProfileId':_0x266b8a['userProfileId']},'raw':!![]})[_0xb3d6('0x25')](function(_0x43ffe8){if(_0x43ffe8&&_0x43ffe8[_0xb3d6('0x50')]===0x0){return db['UserProfileResource'][_0xb3d6('0x4a')]({'name':_0x5b8230[_0xb3d6('0x2a')],'resourceId':_0x5b8230['id'],'type':_0x43ffe8[_0xb3d6('0x2a')],'sectionId':_0x43ffe8['id']},{})[_0xb3d6('0x25')](function(){return _0x5af67c;});}else{return _0x5af67c;}})[_0xb3d6('0x44')](function(_0x105888){logger[_0xb3d6('0x29')](_0xb3d6('0x56'),_0x105888);throw _0x105888;});}return _0x5af67c;});}})[_0xb3d6('0x25')](respondWithResult(_0x161690,0xc9))[_0xb3d6('0x44')](handleError(_0x161690,null));};exports['update']=function(_0x3f5471,_0x9dd80d){if(_0x3f5471[_0xb3d6('0x54')]['id']){delete _0x3f5471[_0xb3d6('0x54')]['id'];}return db['Dashboard'][_0xb3d6('0x49')]({'where':{'id':_0x3f5471[_0xb3d6('0x46')]['id']}})[_0xb3d6('0x25')](handleEntityNotFound(_0x9dd80d,null))[_0xb3d6('0x25')](saveUpdates(_0x3f5471[_0xb3d6('0x54')],null))[_0xb3d6('0x25')](respondWithResult(_0x9dd80d,null))['catch'](handleError(_0x9dd80d,null));};exports[_0xb3d6('0x26')]=function(_0x59dba7,_0x1a90a1){return db[_0xb3d6('0x2d')]['find']({'where':{'id':_0x59dba7['params']['id']}})[_0xb3d6('0x25')](handleEntityNotFound(_0x1a90a1,null))[_0xb3d6('0x25')](removeEntity(_0x1a90a1,null))[_0xb3d6('0x44')](handleError(_0x1a90a1,null));};function widgetAttributes(_0x52151d){try{switch(_0x52151d['type']){case _0xb3d6('0x57'):return[{'name':_0xb3d6('0x58'),'value':_0x52151d['attrUrl']||(_0x52151d[_0xb3d6('0x59')]&&_0x52151d['attrs'][0x0]?_0x52151d[_0xb3d6('0x59')][0x0][_0xb3d6('0x5a')]:undefined)||_0xb3d6('0x5b')}];case _0xb3d6('0x5c'):return[{'name':_0xb3d6('0x5d'),'value':_0x52151d[_0xb3d6('0x5d')]||(_0x52151d[_0xb3d6('0x59')]&&_0x52151d[_0xb3d6('0x59')][0x0]?_0x52151d['attrs'][0x0][_0xb3d6('0x5a')]:undefined)||''}];case _0xb3d6('0x5e'):return[{'name':_0xb3d6('0x5f'),'value':_0x52151d['attrHourFormat']||(_0x52151d[_0xb3d6('0x59')]&&_0x52151d['attrs'][0x0]?_0x52151d[_0xb3d6('0x59')][0x0][_0xb3d6('0x5a')]:undefined)||_0xb3d6('0x60')},{'name':'attrTimezone','value':_0x52151d[_0xb3d6('0x61')]||(_0x52151d[_0xb3d6('0x59')]&&_0x52151d[_0xb3d6('0x59')][0x1]?_0x52151d[_0xb3d6('0x59')][0x1][_0xb3d6('0x5a')]:undefined)||_0xb3d6('0x62')},{'name':_0xb3d6('0x63'),'value':_0x52151d['attrFontSize']||(_0x52151d[_0xb3d6('0x59')]&&_0x52151d['attrs'][0x2]?_0x52151d[_0xb3d6('0x59')][0x2][_0xb3d6('0x5a')]:undefined)||0xc}];case'counter':return[{'name':_0xb3d6('0x64'),'value':_0x52151d[_0xb3d6('0x64')]||(_0x52151d['attrs']&&_0x52151d[_0xb3d6('0x59')][0x0]?_0x52151d[_0xb3d6('0x59')][0x0][_0xb3d6('0x5a')]:undefined)||'total'},{'name':_0xb3d6('0x65'),'value':_0x52151d[_0xb3d6('0x65')]||(_0x52151d[_0xb3d6('0x59')]&&_0x52151d[_0xb3d6('0x59')][0x1]?_0x52151d[_0xb3d6('0x59')][0x1][_0xb3d6('0x5a')]:undefined)||[]},{'name':_0xb3d6('0x63'),'value':_0x52151d[_0xb3d6('0x63')]||(_0x52151d[_0xb3d6('0x59')]&&_0x52151d[_0xb3d6('0x59')][0x2]?_0x52151d[_0xb3d6('0x59')][0x2][_0xb3d6('0x5a')]:undefined)||0x14}];case _0xb3d6('0x66'):case'pie-chart':return[{'name':_0xb3d6('0x67'),'value':_0x52151d[_0xb3d6('0x67')]||(_0x52151d['attrs']&&_0x52151d[_0xb3d6('0x59')][0x0]?_0x52151d['attrs'][0x0][_0xb3d6('0x5a')]:undefined)||_0xb3d6('0x68')},{'name':_0xb3d6('0x69'),'value':_0x52151d[_0xb3d6('0x69')]||(_0x52151d['attrs']&&_0x52151d[_0xb3d6('0x59')][0x1]?_0x52151d[_0xb3d6('0x59')][0x1][_0xb3d6('0x5a')]:undefined)||null},{'name':_0xb3d6('0x6a'),'value':_0x52151d['attrSerie3']||(_0x52151d[_0xb3d6('0x59')]&&_0x52151d[_0xb3d6('0x59')][0x2]?_0x52151d['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x52151d['attrVoiceQueues']||(_0x52151d[_0xb3d6('0x59')]&&_0x52151d[_0xb3d6('0x59')][0x3]?_0x52151d['attrs'][0x3]['value']:undefined)||[]}];case _0xb3d6('0x6b'):return[{'name':'attrReport','type':_0x52151d[_0xb3d6('0x6c')]||(_0x52151d['attrs']&&_0x52151d['attrs'][0x0]?_0x52151d[_0xb3d6('0x59')][0x0][_0xb3d6('0x2f')]:undefined)||null,'value':_0x52151d[_0xb3d6('0x6d')]||(_0x52151d[_0xb3d6('0x59')]&&_0x52151d['attrs'][0x0]?_0x52151d[_0xb3d6('0x59')][0x0][_0xb3d6('0x5a')]:undefined)||null},{'name':_0xb3d6('0x6e'),'value':_0x52151d[_0xb3d6('0x6e')]||(_0x52151d[_0xb3d6('0x59')]&&_0x52151d['attrs'][0x1]?_0x52151d[_0xb3d6('0x59')][0x1][_0xb3d6('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0x221c7b){logger[_0xb3d6('0x29')](_0xb3d6('0x6f'),JSON[_0xb3d6('0x70')](_0x221c7b));return[];}}exports[_0xb3d6('0x71')]=function(_0x4f59b6,_0x458de7,_0x1ac7b3){if(_0x4f59b6[_0xb3d6('0x54')]['id']){delete _0x4f59b6['body']['id'];}return db['Dashboard'][_0xb3d6('0x49')]({'where':{'id':_0x4f59b6['params']['id']}})[_0xb3d6('0x25')](handleEntityNotFound(_0x458de7,null))[_0xb3d6('0x25')](function(_0xc34218){if(_0xc34218){_0x4f59b6[_0xb3d6('0x54')]['DashboardId']=_0xc34218['id'];_0x4f59b6[_0xb3d6('0x54')][_0xb3d6('0x59')]=widgetAttributes(_0x4f59b6['body']);return db[_0xb3d6('0x72')][_0xb3d6('0x4a')](_0x4f59b6[_0xb3d6('0x54')]);}})['then'](respondWithResult(_0x458de7,null))[_0xb3d6('0x44')](handleError(_0x458de7,null));};exports['getItems']=function(_0x47caac,_0x563d79,_0x1b5514){var _0x272567={};var _0x508ec1={};var _0x564caf;var _0x4da5bf;return db['Dashboard'][_0xb3d6('0x73')]({'where':{'id':_0x47caac[_0xb3d6('0x46')]['id']}})[_0xb3d6('0x25')](handleEntityNotFound(_0x563d79,null))[_0xb3d6('0x25')](function(_0x5bd03a){if(_0x5bd03a){_0x564caf=_0x5bd03a;_0x508ec1[_0xb3d6('0x30')]=_[_0xb3d6('0x33')](db[_0xb3d6('0x72')][_0xb3d6('0x47')]);_0x508ec1[_0xb3d6('0x32')]=_[_0xb3d6('0x33')](_0x47caac[_0xb3d6('0x32')]);_0x508ec1[_0xb3d6('0x34')]=_[_0xb3d6('0x35')](_0x508ec1[_0xb3d6('0x30')],_0x508ec1['query']);_0x272567[_0xb3d6('0x36')]=_[_0xb3d6('0x35')](_0x508ec1[_0xb3d6('0x30')],qs[_0xb3d6('0x37')](_0x47caac[_0xb3d6('0x32')][_0xb3d6('0x37')]));_0x272567[_0xb3d6('0x36')]=_0x272567['attributes']['length']?_0x272567['attributes']:_0x508ec1[_0xb3d6('0x30')];_0x272567[_0xb3d6('0x3b')]=qs[_0xb3d6('0x3c')](_0x47caac['query'][_0xb3d6('0x3c')]);_0x272567['where']=qs[_0xb3d6('0x34')](_[_0xb3d6('0x74')](_0x47caac[_0xb3d6('0x32')],_0x508ec1[_0xb3d6('0x34')]));if(_0x47caac[_0xb3d6('0x32')]['filter']){_0x272567[_0xb3d6('0x3d')]=_[_0xb3d6('0x3f')](_0x272567[_0xb3d6('0x3d')],{'$or':_[_0xb3d6('0x31')](_0x272567[_0xb3d6('0x36')],function(_0x4c1e72){var _0x219a4c={};_0x219a4c[_0x4c1e72]={'$like':'%'+_0x47caac[_0xb3d6('0x32')]['filter']+'%'};return _0x219a4c;})});}_0x272567=_[_0xb3d6('0x3f')]({},_0x272567,_0x47caac[_0xb3d6('0x40')]);return _0x564caf[_0xb3d6('0x75')](_0x272567);}})[_0xb3d6('0x25')](function(_0x198375){if(_0x198375){_0x4da5bf=_0x198375['length'];if(!_0x47caac['query'][_0xb3d6('0x39')](_0xb3d6('0x3a'))){_0x272567[_0xb3d6('0x1f')]=qs['limit'](_0x47caac[_0xb3d6('0x32')]['limit']);_0x272567['offset']=qs[_0xb3d6('0x21')](_0x47caac[_0xb3d6('0x32')][_0xb3d6('0x21')]);}return _0x564caf[_0xb3d6('0x75')](_0x272567);}})[_0xb3d6('0x25')](function(_0x3a689e){if(_0x3a689e){return _0x3a689e?{'count':_0x4da5bf,'rows':_0x3a689e}:null;}})[_0xb3d6('0x25')](respondWithResult(_0x563d79,null))[_0xb3d6('0x44')](handleError(_0x563d79,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 5a0ebc7..6a4580d 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 _0x689c=['update','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x689c,0xc8));var _0xc689=function(_0x2985e0,_0x225a65){_0x2985e0=_0x2985e0-0x0;var _0x173780=_0x689c[_0x2985e0];return _0x173780;};'use strict';var EventEmitter=require(_0xc689('0x0'));var Dashboard=require(_0xc689('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xc689('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc689('0x3'),'afterDestroy':'remove'};function emitEvent(_0x53684e){return function(_0x10428f,_0x181ed3,_0x77b3b4){DashboardEvents[_0xc689('0x4')](_0x53684e+':'+_0x10428f['id'],_0x10428f);DashboardEvents[_0xc689('0x4')](_0x53684e,_0x10428f);_0x77b3b4(null);};}for(var e in events){if(events[_0xc689('0x5')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xc689('0x6')]=DashboardEvents; \ No newline at end of file +var _0x9cb7=['events','Dashboard','setMaxListeners','update','hasOwnProperty','hook','exports'];(function(_0x97ed31,_0x30c75f){var _0x1d3ded=function(_0x5f0995){while(--_0x5f0995){_0x97ed31['push'](_0x97ed31['shift']());}};_0x1d3ded(++_0x30c75f);}(_0x9cb7,0x1ce));var _0x79cb=function(_0x372d74,_0x45c6ba){_0x372d74=_0x372d74-0x0;var _0x420a49=_0x9cb7[_0x372d74];return _0x420a49;};'use strict';var EventEmitter=require(_0x79cb('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x79cb('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x79cb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x79cb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x158e6d){return function(_0x4a3a8b,_0x4b4632,_0xff9f50){DashboardEvents['emit'](_0x158e6d+':'+_0x4a3a8b['id'],_0x4a3a8b);DashboardEvents['emit'](_0x158e6d,_0x4a3a8b);_0xff9f50(null);};}for(var e in events){if(events[_0x79cb('0x4')](e)){var event=events[e];Dashboard[_0x79cb('0x5')](e,emitEvent(event));}}module[_0x79cb('0x6')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 3376d3d..2c1d126 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 _0x277d=['../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1a61c1,_0x2f064d){var _0x2240bf=function(_0x52c173){while(--_0x52c173){_0x1a61c1['push'](_0x1a61c1['shift']());}};_0x2240bf(++_0x2f064d);}(_0x277d,0x13e));var _0xd277=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x277d[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0xd277('0x0'));var logger=require(_0xd277('0x1'))(_0xd277('0x2'));var moment=require(_0xd277('0x3'));var BPromise=require('bluebird');var rp=require(_0xd277('0x4'));var fs=require('fs');var path=require(_0xd277('0x5'));var rimraf=require(_0xd277('0x6'));var config=require(_0xd277('0x7'));var attributes=require(_0xd277('0x8'));module[_0xd277('0x9')]=function(_0x24e3e7,_0x242e29){return _0x24e3e7[_0xd277('0xa')](_0xd277('0xb'),attributes,{'tableName':_0xd277('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1621=['path','rimraf','../../config/environment','define','Dashboard','dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1621,0x1f4));var _0x1162=function(_0x1ccb5d,_0x341da9){_0x1ccb5d=_0x1ccb5d-0x0;var _0x1fe071=_0x1621[_0x1ccb5d];return _0x1fe071;};'use strict';var _=require(_0x1162('0x0'));var util=require(_0x1162('0x1'));var logger=require(_0x1162('0x2'))(_0x1162('0x3'));var moment=require(_0x1162('0x4'));var BPromise=require(_0x1162('0x5'));var rp=require(_0x1162('0x6'));var fs=require('fs');var path=require(_0x1162('0x7'));var rimraf=require(_0x1162('0x8'));var config=require(_0x1162('0x9'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x54cafe,_0x13a54c){return _0x54cafe[_0x1162('0xa')](_0x1162('0xb'),attributes,{'tableName':_0x1162('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index e0a0888..005356b 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 _0x1744=['ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','bluebird'];(function(_0x209478,_0x3e54a0){var _0x578581=function(_0x592ff7){while(--_0x592ff7){_0x209478['push'](_0x209478['shift']());}};_0x578581(++_0x3e54a0);}(_0x1744,0x165));var _0x4174=function(_0x454392,_0x55a213){_0x454392=_0x454392-0x0;var _0x51470d=_0x1744[_0x454392];return _0x51470d;};'use strict';var _=require(_0x4174('0x0'));var util=require(_0x4174('0x1'));var moment=require('moment');var BPromise=require(_0x4174('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4174('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4174('0x4'));var logger=require(_0x4174('0x5'))(_0x4174('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4174('0x7')][_0x4174('0x8')]({'port':0x232a});config[_0x4174('0x9')]=_['defaults'](config[_0x4174('0x9')],{'host':_0x4174('0xa'),'port':0x18eb});var socket=require(_0x4174('0xb'))(new Redis(config[_0x4174('0x9')]));require(_0x4174('0xc'))[_0x4174('0xd')](socket);function respondWithRpcPromise(_0x2cacaa,_0xeb2703,_0x54acf7){return new BPromise(function(_0x5f0beb,_0x8b9dc7){return client[_0x4174('0xe')](_0x2cacaa,_0x54acf7)[_0x4174('0xf')](function(_0x1995d7){logger[_0x4174('0x10')](_0x4174('0x11'),_0xeb2703,_0x4174('0x12'));logger[_0x4174('0x13')]('Dashboard,\x20%s,\x20%s,\x20%s',_0xeb2703,_0x4174('0x12'),JSON[_0x4174('0x14')](_0x1995d7));if(_0x1995d7[_0x4174('0x15')]){if(_0x1995d7[_0x4174('0x15')][_0x4174('0x16')]===0x1f4){logger[_0x4174('0x15')](_0x4174('0x11'),_0xeb2703,_0x1995d7[_0x4174('0x15')][_0x4174('0x17')]);return _0x8b9dc7(_0x1995d7[_0x4174('0x15')][_0x4174('0x17')]);}logger[_0x4174('0x15')](_0x4174('0x11'),_0xeb2703,_0x1995d7['error'][_0x4174('0x17')]);return _0x5f0beb(_0x1995d7[_0x4174('0x15')][_0x4174('0x17')]);}else{logger[_0x4174('0x10')](_0x4174('0x11'),_0xeb2703,_0x4174('0x12'));_0x5f0beb(_0x1995d7['result'][_0x4174('0x17')]);}})['catch'](function(_0x383739){logger[_0x4174('0x15')](_0x4174('0x11'),_0xeb2703,_0x383739);_0x8b9dc7(_0x383739);});});} \ No newline at end of file +var _0x3811=['code','message','info','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','then','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','error'];(function(_0xda616d,_0x39fad5){var _0x2c5c84=function(_0x4d1b3a){while(--_0x4d1b3a){_0xda616d['push'](_0xda616d['shift']());}};_0x2c5c84(++_0x39fad5);}(_0x3811,0x1be));var _0x1381=function(_0x6ac018,_0x36f1e1){_0x6ac018=_0x6ac018-0x0;var _0x1dbb8a=_0x3811[_0x6ac018];return _0x1dbb8a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1381('0x0'));var BPromise=require(_0x1381('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1381('0x2'));var db=require(_0x1381('0x3'))['db'];var utils=require(_0x1381('0x4'));var logger=require(_0x1381('0x5'))(_0x1381('0x6'));var config=require(_0x1381('0x7'));var jayson=require(_0x1381('0x8'));var client=jayson[_0x1381('0x9')][_0x1381('0xa')]({'port':0x232a});config[_0x1381('0xb')]=_[_0x1381('0xc')](config[_0x1381('0xb')],{'host':_0x1381('0xd'),'port':0x18eb});var socket=require(_0x1381('0xe'))(new Redis(config[_0x1381('0xb')]));require(_0x1381('0xf'))[_0x1381('0x10')](socket);function respondWithRpcPromise(_0x29d2d3,_0x57dccb,_0x34f006){return new BPromise(function(_0xc23fa4,_0x4dcac8){return client['request'](_0x29d2d3,_0x34f006)[_0x1381('0x11')](function(_0x4d922b){logger['info'](_0x1381('0x12'),_0x57dccb,_0x1381('0x13'));logger['debug'](_0x1381('0x14'),_0x57dccb,_0x1381('0x13'),JSON['stringify'](_0x4d922b));if(_0x4d922b[_0x1381('0x15')]){if(_0x4d922b[_0x1381('0x15')][_0x1381('0x16')]===0x1f4){logger[_0x1381('0x15')](_0x1381('0x12'),_0x57dccb,_0x4d922b[_0x1381('0x15')]['message']);return _0x4dcac8(_0x4d922b[_0x1381('0x15')][_0x1381('0x17')]);}logger[_0x1381('0x15')](_0x1381('0x12'),_0x57dccb,_0x4d922b['error']['message']);return _0xc23fa4(_0x4d922b[_0x1381('0x15')][_0x1381('0x17')]);}else{logger[_0x1381('0x18')](_0x1381('0x12'),_0x57dccb,'request\x20sent');_0xc23fa4(_0x4d922b[_0x1381('0x19')][_0x1381('0x17')]);}})['catch'](function(_0x3b9872){logger[_0x1381('0x15')]('Dashboard,\x20%s,\x20%s',_0x57dccb,_0x3b9872);_0x4dcac8(_0x3b9872);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 5fa80b2..162fc01 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 _0xc1b4=['./dashboard.events','save','update','emit','removeListener','register','dashboard:'];(function(_0x470f24,_0x2436a9){var _0x2c6fc8=function(_0x3ef190){while(--_0x3ef190){_0x470f24['push'](_0x470f24['shift']());}};_0x2c6fc8(++_0x2436a9);}(_0xc1b4,0x69));var _0x4c1b=function(_0x4f3c03,_0x76e026){_0x4f3c03=_0x4f3c03-0x0;var _0x3c27d5=_0xc1b4[_0x4f3c03];return _0x3c27d5;};'use strict';var DashboardEvents=require(_0x4c1b('0x0'));var events=[_0x4c1b('0x1'),'remove',_0x4c1b('0x2')];function createListener(_0x5d8b1a,_0x1014f3){return function(_0x1a002f){_0x1014f3[_0x4c1b('0x3')](_0x5d8b1a,_0x1a002f);};}function removeListener(_0x17b858,_0x455bfe){return function(){DashboardEvents[_0x4c1b('0x4')](_0x17b858,_0x455bfe);};}exports[_0x4c1b('0x5')]=function(_0x41f0f9){for(var _0x3fd1ac=0x0,_0x143611=events['length'];_0x3fd1ac<_0x143611;_0x3fd1ac++){var _0x2601a2=events[_0x3fd1ac];var _0x3c060f=createListener(_0x4c1b('0x6')+_0x2601a2,_0x41f0f9);DashboardEvents['on'](_0x2601a2,_0x3c060f);}}; \ No newline at end of file +var _0x3790=['register','length','update','emit','removeListener'];(function(_0x57ce31,_0x2fbd14){var _0x915ad2=function(_0x473f2e){while(--_0x473f2e){_0x57ce31['push'](_0x57ce31['shift']());}};_0x915ad2(++_0x2fbd14);}(_0x3790,0x197));var _0x0379=function(_0x13b00c,_0x612212){_0x13b00c=_0x13b00c-0x0;var _0x5e86a5=_0x3790[_0x13b00c];return _0x5e86a5;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save','remove',_0x0379('0x0')];function createListener(_0x2d3bc9,_0x34926a){return function(_0x46571e){_0x34926a[_0x0379('0x1')](_0x2d3bc9,_0x46571e);};}function removeListener(_0xa72826,_0x3265a3){return function(){DashboardEvents[_0x0379('0x2')](_0xa72826,_0x3265a3);};}exports[_0x0379('0x3')]=function(_0x34919a){for(var _0x5950ec=0x0,_0x524e93=events[_0x0379('0x4')];_0x5950ec<_0x524e93;_0x5950ec++){var _0x217567=events[_0x5950ec];var _0x106184=createListener('dashboard:'+_0x217567,_0x34919a);DashboardEvents['on'](_0x217567,_0x106184);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index b32e8f7..d79a183 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 _0x9f62=['express','Router','../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','/:id','isAuthenticated','show','post','/:id/clone','/:id/items','update','delete','destroy','exports','util','connect-timeout'];(function(_0x119e7a,_0x3949d3){var _0x1fb90a=function(_0x57eb3f){while(--_0x57eb3f){_0x119e7a['push'](_0x119e7a['shift']());}};_0x1fb90a(++_0x3949d3);}(_0x9f62,0x154));var _0x29f6=function(_0x5cf947,_0x51cafc){_0x5cf947=_0x5cf947-0x0;var _0x1a4f75=_0x9f62[_0x5cf947];return _0x1a4f75;};'use strict';var multer=require('multer');var util=require(_0x29f6('0x0'));var path=require('path');var timeout=require(_0x29f6('0x1'));var express=require(_0x29f6('0x2'));var router=express[_0x29f6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var controller=require(_0x29f6('0x6'));router[_0x29f6('0x7')]('/',auth['isAuthenticated'](),controller[_0x29f6('0x8')]);router[_0x29f6('0x7')](_0x29f6('0x9'),auth[_0x29f6('0xa')](),controller[_0x29f6('0xb')]);router['get']('/:id/items',auth['isAuthenticated'](),controller['getItems']);router[_0x29f6('0xc')]('/',auth[_0x29f6('0xa')](),controller['create']);router['post'](_0x29f6('0xd'),auth[_0x29f6('0xa')](),controller['clone']);router[_0x29f6('0xc')](_0x29f6('0xe'),auth['isAuthenticated'](),controller['addItem']);router['put']('/:id',auth[_0x29f6('0xa')](),controller[_0x29f6('0xf')]);router[_0x29f6('0x10')](_0x29f6('0x9'),auth[_0x29f6('0xa')](),controller[_0x29f6('0x11')]);module[_0x29f6('0x12')]=router; \ No newline at end of file +var _0x70e0=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','isAuthenticated','show','get','/:id/items','getItems','post','/:id/clone','clone','addItem','put','/:id','multer'];(function(_0x1f8eb8,_0xfc4345){var _0x37ca05=function(_0x4595e2){while(--_0x4595e2){_0x1f8eb8['push'](_0x1f8eb8['shift']());}};_0x37ca05(++_0xfc4345);}(_0x70e0,0x17b));var _0x070e=function(_0xf522ba,_0x5c6302){_0xf522ba=_0xf522ba-0x0;var _0x394ec3=_0x70e0[_0xf522ba];return _0x394ec3;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x070e('0xd')](_0x070e('0xe'),auth[_0x070e('0x8')](),controller[_0x070e('0xf')]);router[_0x070e('0xd')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0x12'),auth[_0x070e('0x8')](),controller['update']);router['delete'](_0x070e('0x12'),auth['isAuthenticated'](),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 9f4d538..bb32ed0 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 _0x34ef=['attrs','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','parse'];(function(_0x3b1666,_0xea4e07){var _0x4b6de4=function(_0x58da95){while(--_0x58da95){_0x3b1666['push'](_0x3b1666['shift']());}};_0x4b6de4(++_0xea4e07);}(_0x34ef,0x191));var _0xf34e=function(_0x2b320a,_0xf63bc6){_0x2b320a=_0x2b320a-0x0;var _0x20be8f=_0x34ef[_0x2b320a];return _0x20be8f;};'use strict';var Sequelize=require(_0xf34e('0x0'));var squel=require(_0xf34e('0x1'));var _=require(_0xf34e('0x2'));module[_0xf34e('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf34e('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xf34e('0x5')]('long'),'get':function(){try{return JSON[_0xf34e('0x6')](this['getDataValue'](_0xf34e('0x7')));}catch(_0x4d7ffc){return[];}},'set':function(_0x56c919){try{this[_0xf34e('0x8')](_0xf34e('0x7'),JSON['stringify'](_0x56c919));}catch(_0x23648e){this[_0xf34e('0x8')](_0xf34e('0x7'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xf34e('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xf34e('0x9')]},'col':{'type':Sequelize[_0xf34e('0x9')]},'background':{'type':Sequelize[_0xf34e('0x4')],'allowNull':![],'defaultValue':_0xf34e('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xf34e('0x4')],'allowNull':![],'defaultValue':_0xf34e('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xf34e('0x4')]},'titleFontSize':{'type':Sequelize[_0xf34e('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0x4597=['#2196f3','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','setDataValue','attrs','INTEGER','#ffffff'];(function(_0x42de00,_0xecc5db){var _0xcf8dc1=function(_0x5216f6){while(--_0x5216f6){_0x42de00['push'](_0x42de00['shift']());}};_0xcf8dc1(++_0xecc5db);}(_0x4597,0x194));var _0x7459=function(_0x4e5ff7,_0x1c555f){_0x4e5ff7=_0x4e5ff7-0x0;var _0xd3aec=_0x4597[_0x4e5ff7];return _0xd3aec;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x7459('0x0'));var _=require(_0x7459('0x1'));module[_0x7459('0x2')]={'title':{'type':Sequelize[_0x7459('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7459('0x4')](_0x7459('0x5')),'get':function(){try{return JSON[_0x7459('0x6')](this[_0x7459('0x7')]('attrs'));}catch(_0x4b17fd){return[];}},'set':function(_0x3eab8c){try{this['setDataValue']('attrs',JSON['stringify'](_0x3eab8c));}catch(_0x1d9232){this[_0x7459('0x8')](_0x7459('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x7459('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7459('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x7459('0x3')],'allowNull':![],'defaultValue':_0x7459('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x7459('0x3')],'allowNull':![],'defaultValue':_0x7459('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 9d9cc2b..89bc8f3 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 _0x4f1e=['options','find','destroy','params','catch','type','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','body','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','ejs','squel','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./dashboardItem.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','sendStatus','stack','name','send','show','model','DashboardItem','rawAttributes','keys','query','filters','intersection','attributes','length','includeAll'];(function(_0x4dda69,_0x2a0fe4){var _0x9014a9=function(_0x3d2b40){while(--_0x3d2b40){_0x4dda69['push'](_0x4dda69['shift']());}};_0x9014a9(++_0x2a0fe4);}(_0x4f1e,0xc3));var _0xe4f1=function(_0x1178eb,_0x2612ef){_0x1178eb=_0x1178eb-0x0;var _0x338576=_0x4f1e[_0x1178eb];return _0x338576;};'use strict';var emlformat=require(_0xe4f1('0x0'));var rimraf=require(_0xe4f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe4f1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe4f1('0x3'));var Mustache=require(_0xe4f1('0x4'));var util=require('util');var path=require(_0xe4f1('0x5'));var sox=require(_0xe4f1('0x6'));var csv=require('to-csv');var ejs=require(_0xe4f1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe4f1('0x8'));var crypto=require('crypto');var jsforce=require(_0xe4f1('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xe4f1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4f1('0xb'));var authService=require(_0xe4f1('0xc'));var qs=require(_0xe4f1('0xd'));var as=require(_0xe4f1('0xe'));var hardwareService=require(_0xe4f1('0xf'));var logger=require(_0xe4f1('0x10'))(_0xe4f1('0x11'));var utils=require(_0xe4f1('0x12'));var config=require(_0xe4f1('0x13'));var licenseUtil=require(_0xe4f1('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xe4f1('0x15')](config[_0xe4f1('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xe4f1('0x17'))(new Redis(config[_0xe4f1('0x16')]));require(_0xe4f1('0x18'))[_0xe4f1('0x19')](socket);function respondWithStatusCode(_0x1afbb8,_0x2e2f6b){_0x2e2f6b=_0x2e2f6b||0xcc;return function(_0x58b3c2){if(_0x58b3c2){return _0x1afbb8['sendStatus'](_0x2e2f6b);}return _0x1afbb8[_0xe4f1('0x1a')](_0x2e2f6b)[_0xe4f1('0x1b')]();};}function respondWithResult(_0x3556f7,_0x4126a7){_0x4126a7=_0x4126a7||0xc8;return function(_0x27a2b6){if(_0x27a2b6){return _0x3556f7[_0xe4f1('0x1a')](_0x4126a7)[_0xe4f1('0x1c')](_0x27a2b6);}};}function respondWithFilteredResult(_0x14db14,_0x3a2aff){return function(_0x4299a4){if(_0x4299a4){var _0x4d84b1=typeof _0x3a2aff[_0xe4f1('0x1d')]===_0xe4f1('0x1e')&&typeof _0x3a2aff[_0xe4f1('0x1f')]===_0xe4f1('0x1e');var _0x168621=_0x4299a4[_0xe4f1('0x20')];var _0x36c089=_0x4d84b1?0x0:_0x3a2aff[_0xe4f1('0x1d')];var _0x167fe2=_0x4d84b1?_0x4299a4[_0xe4f1('0x20')]:_0x3a2aff['offset']+_0x3a2aff[_0xe4f1('0x1f')];var _0x16fac7;if(_0x167fe2>=_0x168621){_0x167fe2=_0x168621;_0x16fac7=0xc8;}else{_0x16fac7=0xce;}_0x14db14['status'](_0x16fac7);return _0x14db14[_0xe4f1('0x21')](_0xe4f1('0x22'),_0x36c089+'-'+_0x167fe2+'/'+_0x168621)['json'](_0x4299a4);}return null;};}function patchUpdates(_0x393e0d){return function(_0x347e4b){try{jsonpatch[_0xe4f1('0x23')](_0x347e4b,_0x393e0d,!![]);}catch(_0x252a5e){return BPromise['reject'](_0x252a5e);}return _0x347e4b[_0xe4f1('0x24')]();};}function saveUpdates(_0x259ea4,_0x2286af){return function(_0x477f2d){if(_0x477f2d){return _0x477f2d[_0xe4f1('0x25')](_0x259ea4)['then'](function(_0x37787a){return _0x37787a;});}return null;};}function removeEntity(_0xa9c394,_0x5949a5){return function(_0xe4f8f4){if(_0xe4f8f4){return _0xe4f8f4['destroy']()[_0xe4f1('0x26')](function(){_0xa9c394[_0xe4f1('0x1a')](0xcc)[_0xe4f1('0x1b')]();});}};}function handleEntityNotFound(_0x43be90,_0x5ebe48){return function(_0x277bb7){if(!_0x277bb7){_0x43be90[_0xe4f1('0x27')](0x194);}return _0x277bb7;};}function handleError(_0x407bb3,_0x5ab21a){_0x5ab21a=_0x5ab21a||0x1f4;return function(_0x50ed2c){logger['error'](_0x50ed2c[_0xe4f1('0x28')]);if(_0x50ed2c[_0xe4f1('0x29')]){delete _0x50ed2c[_0xe4f1('0x29')];}_0x407bb3[_0xe4f1('0x1a')](_0x5ab21a)[_0xe4f1('0x2a')](_0x50ed2c);};}exports[_0xe4f1('0x2b')]=function(_0x1f83d8,_0x23a41d){var _0xc20471={'raw':![],'where':{'id':_0x1f83d8['params']['id']}},_0x388b92={};_0x388b92[_0xe4f1('0x2c')]=_['keys'](db[_0xe4f1('0x2d')][_0xe4f1('0x2e')]);_0x388b92['query']=_[_0xe4f1('0x2f')](_0x1f83d8[_0xe4f1('0x30')]);_0x388b92[_0xe4f1('0x31')]=_[_0xe4f1('0x32')](_0x388b92[_0xe4f1('0x2c')],_0x388b92[_0xe4f1('0x30')]);_0xc20471[_0xe4f1('0x33')]=_['intersection'](_0x388b92[_0xe4f1('0x2c')],qs['fields'](_0x1f83d8[_0xe4f1('0x30')]['fields']));_0xc20471[_0xe4f1('0x33')]=_0xc20471[_0xe4f1('0x33')][_0xe4f1('0x34')]?_0xc20471[_0xe4f1('0x33')]:_0x388b92[_0xe4f1('0x2c')];if(_0x1f83d8[_0xe4f1('0x30')][_0xe4f1('0x35')]){_0xc20471['include']=[{'all':!![]}];}_0xc20471=_['merge']({},_0xc20471,_0x1f83d8[_0xe4f1('0x36')]);return db['DashboardItem'][_0xe4f1('0x37')](_0xc20471)[_0xe4f1('0x26')](handleEntityNotFound(_0x23a41d,null))[_0xe4f1('0x26')](respondWithResult(_0x23a41d,null))['catch'](handleError(_0x23a41d,null));};exports[_0xe4f1('0x38')]=function(_0x1e0b0d,_0x4f16f4){return db[_0xe4f1('0x2d')]['find']({'where':{'id':_0x1e0b0d[_0xe4f1('0x39')]['id']}})[_0xe4f1('0x26')](handleEntityNotFound(_0x4f16f4,null))[_0xe4f1('0x26')](removeEntity(_0x4f16f4,null))[_0xe4f1('0x3a')](handleError(_0x4f16f4,null));};function widgetAttributes(_0x2d6d37){try{switch(_0x2d6d37[_0xe4f1('0x3b')]){case'iframe':return[{'name':_0xe4f1('0x3c'),'value':_0x2d6d37[_0xe4f1('0x3c')]||(_0x2d6d37[_0xe4f1('0x3d')]&&_0x2d6d37['attrs'][0x0]?_0x2d6d37[_0xe4f1('0x3d')][0x0][_0xe4f1('0x3e')]:undefined)||_0xe4f1('0x3f')}];case'custom':return[{'name':_0xe4f1('0x40'),'value':_0x2d6d37['attrPath']||(_0x2d6d37['attrs']&&_0x2d6d37[_0xe4f1('0x3d')][0x0]?_0x2d6d37[_0xe4f1('0x3d')][0x0]['value']:undefined)||''}];case _0xe4f1('0x41'):return[{'name':_0xe4f1('0x42'),'value':_0x2d6d37['attrHourFormat']||(_0x2d6d37[_0xe4f1('0x3d')]&&_0x2d6d37[_0xe4f1('0x3d')][0x0]?_0x2d6d37['attrs'][0x0][_0xe4f1('0x3e')]:undefined)||'HH:mm:ss'},{'name':_0xe4f1('0x43'),'value':_0x2d6d37[_0xe4f1('0x43')]||(_0x2d6d37[_0xe4f1('0x3d')]&&_0x2d6d37[_0xe4f1('0x3d')][0x1]?_0x2d6d37[_0xe4f1('0x3d')][0x1]['value']:undefined)||'0.00'},{'name':'attrFontSize','value':_0x2d6d37[_0xe4f1('0x44')]||(_0x2d6d37['attrs']&&_0x2d6d37[_0xe4f1('0x3d')][0x2]?_0x2d6d37[_0xe4f1('0x3d')][0x2][_0xe4f1('0x3e')]:undefined)||0xc}];case _0xe4f1('0x45'):return[{'name':_0xe4f1('0x46'),'value':_0x2d6d37[_0xe4f1('0x46')]||(_0x2d6d37[_0xe4f1('0x3d')]&&_0x2d6d37[_0xe4f1('0x3d')][0x0]?_0x2d6d37[_0xe4f1('0x3d')][0x0][_0xe4f1('0x3e')]:undefined)||_0xe4f1('0x47')},{'name':_0xe4f1('0x48'),'value':_0x2d6d37[_0xe4f1('0x48')]||(_0x2d6d37[_0xe4f1('0x3d')]&&_0x2d6d37['attrs'][0x1]?_0x2d6d37[_0xe4f1('0x3d')][0x1][_0xe4f1('0x3e')]:undefined)||[]},{'name':_0xe4f1('0x44'),'value':_0x2d6d37['attrFontSize']||(_0x2d6d37[_0xe4f1('0x3d')]&&_0x2d6d37[_0xe4f1('0x3d')][0x2]?_0x2d6d37[_0xe4f1('0x3d')][0x2][_0xe4f1('0x3e')]:undefined)||0x14}];case'multibar-chart':case _0xe4f1('0x49'):return[{'name':_0xe4f1('0x4a'),'value':_0x2d6d37[_0xe4f1('0x4a')]||(_0x2d6d37['attrs']&&_0x2d6d37[_0xe4f1('0x3d')][0x0]?_0x2d6d37['attrs'][0x0][_0xe4f1('0x3e')]:undefined)||_0xe4f1('0x47')},{'name':_0xe4f1('0x4b'),'value':_0x2d6d37['attrSerie2']||(_0x2d6d37[_0xe4f1('0x3d')]&&_0x2d6d37[_0xe4f1('0x3d')][0x1]?_0x2d6d37[_0xe4f1('0x3d')][0x1][_0xe4f1('0x3e')]:undefined)||null},{'name':_0xe4f1('0x4c'),'value':_0x2d6d37[_0xe4f1('0x4c')]||(_0x2d6d37['attrs']&&_0x2d6d37[_0xe4f1('0x3d')][0x2]?_0x2d6d37[_0xe4f1('0x3d')][0x2]['value']:undefined)||null},{'name':_0xe4f1('0x48'),'value':_0x2d6d37['attrVoiceQueues']||(_0x2d6d37[_0xe4f1('0x3d')]&&_0x2d6d37[_0xe4f1('0x3d')][0x3]?_0x2d6d37[_0xe4f1('0x3d')][0x3][_0xe4f1('0x3e')]:undefined)||[]}];case _0xe4f1('0x4d'):return[{'name':_0xe4f1('0x4e'),'type':_0x2d6d37[_0xe4f1('0x4f')]||(_0x2d6d37['attrs']&&_0x2d6d37[_0xe4f1('0x3d')][0x0]?_0x2d6d37[_0xe4f1('0x3d')][0x0][_0xe4f1('0x3b')]:undefined)||null,'value':_0x2d6d37[_0xe4f1('0x4e')]||(_0x2d6d37['attrs']&&_0x2d6d37[_0xe4f1('0x3d')][0x0]?_0x2d6d37[_0xe4f1('0x3d')][0x0][_0xe4f1('0x3e')]:undefined)||null},{'name':'attrRefresh','value':_0x2d6d37[_0xe4f1('0x50')]||(_0x2d6d37[_0xe4f1('0x3d')]&&_0x2d6d37[_0xe4f1('0x3d')][0x1]?_0x2d6d37[_0xe4f1('0x3d')][0x1][_0xe4f1('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x1b3a3b){logger['error'](_0xe4f1('0x51'),JSON['stringify'](_0x1b3a3b));return[];}}exports['create']=function(_0x1f9bde,_0x18263c){if(_0x1f9bde[_0xe4f1('0x52')]){_0x1f9bde[_0xe4f1('0x52')][_0xe4f1('0x3d')]=widgetAttributes(_0x1f9bde[_0xe4f1('0x52')]);}return db[_0xe4f1('0x2d')]['create'](_0x1f9bde[_0xe4f1('0x52')],{})['then'](respondWithResult(_0x18263c,0xc9))[_0xe4f1('0x3a')](handleError(_0x18263c,null));};exports[_0xe4f1('0x25')]=function(_0x3b445d,_0xcf5113){if(_0x3b445d[_0xe4f1('0x52')]['id']){delete _0x3b445d['body']['id'];}_0x3b445d['body'][_0xe4f1('0x3d')]=widgetAttributes(_0x3b445d[_0xe4f1('0x52')]);return db[_0xe4f1('0x2d')][_0xe4f1('0x37')]({'where':{'id':_0x3b445d[_0xe4f1('0x39')]['id']}})['then'](handleEntityNotFound(_0xcf5113,null))[_0xe4f1('0x26')](saveUpdates(_0x3b445d[_0xe4f1('0x52')],null))[_0xe4f1('0x26')](respondWithResult(_0xcf5113,null))[_0xe4f1('0x3a')](handleError(_0xcf5113,null));}; \ No newline at end of file +var _0x63f9=['attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','error','stringify','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','count','limit','status','Content-Range','apply','save','update','destroy','then','stack','name','send','params','model','keys','query','filters','intersection','fields','attributes','length','include','merge','options','DashboardItem','find','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart'];(function(_0x364539,_0x951f4a){var _0x21212b=function(_0xcfbb16){while(--_0xcfbb16){_0x364539['push'](_0x364539['shift']());}};_0x21212b(++_0x951f4a);}(_0x63f9,0x117));var _0x963f=function(_0x11ce6d,_0x47d623){_0x11ce6d=_0x11ce6d-0x0;var _0x5f18b1=_0x63f9[_0x11ce6d];return _0x5f18b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x963f('0x0'));var zipdir=require(_0x963f('0x1'));var jsonpatch=require(_0x963f('0x2'));var rp=require(_0x963f('0x3'));var moment=require(_0x963f('0x4'));var BPromise=require(_0x963f('0x5'));var Mustache=require('mustache');var util=require(_0x963f('0x6'));var path=require('path');var sox=require(_0x963f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x963f('0x8'));var squel=require(_0x963f('0x9'));var crypto=require('crypto');var jsforce=require(_0x963f('0xa'));var deskjs=require(_0x963f('0xb'));var toCsv=require(_0x963f('0xc'));var querystring=require(_0x963f('0xd'));var Papa=require(_0x963f('0xe'));var Redis=require('ioredis');var authService=require(_0x963f('0xf'));var qs=require(_0x963f('0x10'));var as=require(_0x963f('0x11'));var hardwareService=require(_0x963f('0x12'));var logger=require(_0x963f('0x13'))(_0x963f('0x14'));var utils=require('../../config/utils');var config=require(_0x963f('0x15'));var licenseUtil=require(_0x963f('0x16'));var db=require(_0x963f('0x17'))['db'];config['redis']=_[_0x963f('0x18')](config[_0x963f('0x19')],{'host':_0x963f('0x1a'),'port':0x18eb});var socket=require(_0x963f('0x1b'))(new Redis(config[_0x963f('0x19')]));require('./dashboardItem.socket')[_0x963f('0x1c')](socket);function respondWithStatusCode(_0x1ef24b,_0x322f51){_0x322f51=_0x322f51||0xcc;return function(_0xefb0ef){if(_0xefb0ef){return _0x1ef24b[_0x963f('0x1d')](_0x322f51);}return _0x1ef24b['status'](_0x322f51)[_0x963f('0x1e')]();};}function respondWithResult(_0x5b36b9,_0xd5a88d){_0xd5a88d=_0xd5a88d||0xc8;return function(_0xcde1ae){if(_0xcde1ae){return _0x5b36b9['status'](_0xd5a88d)[_0x963f('0x1f')](_0xcde1ae);}};}function respondWithFilteredResult(_0x2b568b,_0xf6d5f){return function(_0x1c1ca5){if(_0x1c1ca5){var _0x413e70=typeof _0xf6d5f[_0x963f('0x20')]===_0x963f('0x21')&&typeof _0xf6d5f['limit']===_0x963f('0x21');var _0x443cec=_0x1c1ca5['count'];var _0x129af5=_0x413e70?0x0:_0xf6d5f['offset'];var _0x22d41f=_0x413e70?_0x1c1ca5[_0x963f('0x22')]:_0xf6d5f[_0x963f('0x20')]+_0xf6d5f[_0x963f('0x23')];var _0x1d23d8;if(_0x22d41f>=_0x443cec){_0x22d41f=_0x443cec;_0x1d23d8=0xc8;}else{_0x1d23d8=0xce;}_0x2b568b[_0x963f('0x24')](_0x1d23d8);return _0x2b568b['set'](_0x963f('0x25'),_0x129af5+'-'+_0x22d41f+'/'+_0x443cec)['json'](_0x1c1ca5);}return null;};}function patchUpdates(_0x10c16f){return function(_0x164c08){try{jsonpatch[_0x963f('0x26')](_0x164c08,_0x10c16f,!![]);}catch(_0x4c9541){return BPromise['reject'](_0x4c9541);}return _0x164c08[_0x963f('0x27')]();};}function saveUpdates(_0x38e71f,_0x5de876){return function(_0x32011d){if(_0x32011d){return _0x32011d[_0x963f('0x28')](_0x38e71f)['then'](function(_0x3e698f){return _0x3e698f;});}return null;};}function removeEntity(_0x3d50e2,_0x4be47f){return function(_0x16152f){if(_0x16152f){return _0x16152f[_0x963f('0x29')]()[_0x963f('0x2a')](function(){_0x3d50e2['status'](0xcc)[_0x963f('0x1e')]();});}};}function handleEntityNotFound(_0x1ae792,_0x30f359){return function(_0x4f9f17){if(!_0x4f9f17){_0x1ae792[_0x963f('0x1d')](0x194);}return _0x4f9f17;};}function handleError(_0x1a1fdf,_0xdc0efc){_0xdc0efc=_0xdc0efc||0x1f4;return function(_0xe7dd3d){logger['error'](_0xe7dd3d[_0x963f('0x2b')]);if(_0xe7dd3d[_0x963f('0x2c')]){delete _0xe7dd3d[_0x963f('0x2c')];}_0x1a1fdf[_0x963f('0x24')](_0xdc0efc)[_0x963f('0x2d')](_0xe7dd3d);};}exports['show']=function(_0x26fc01,_0x3ff2dd){var _0x39184c={'raw':![],'where':{'id':_0x26fc01[_0x963f('0x2e')]['id']}},_0x2dc5d6={};_0x2dc5d6[_0x963f('0x2f')]=_[_0x963f('0x30')](db['DashboardItem']['rawAttributes']);_0x2dc5d6[_0x963f('0x31')]=_[_0x963f('0x30')](_0x26fc01[_0x963f('0x31')]);_0x2dc5d6[_0x963f('0x32')]=_[_0x963f('0x33')](_0x2dc5d6['model'],_0x2dc5d6[_0x963f('0x31')]);_0x39184c['attributes']=_[_0x963f('0x33')](_0x2dc5d6['model'],qs[_0x963f('0x34')](_0x26fc01['query'][_0x963f('0x34')]));_0x39184c[_0x963f('0x35')]=_0x39184c['attributes'][_0x963f('0x36')]?_0x39184c[_0x963f('0x35')]:_0x2dc5d6[_0x963f('0x2f')];if(_0x26fc01[_0x963f('0x31')]['includeAll']){_0x39184c[_0x963f('0x37')]=[{'all':!![]}];}_0x39184c=_[_0x963f('0x38')]({},_0x39184c,_0x26fc01[_0x963f('0x39')]);return db[_0x963f('0x3a')][_0x963f('0x3b')](_0x39184c)['then'](handleEntityNotFound(_0x3ff2dd,null))[_0x963f('0x2a')](respondWithResult(_0x3ff2dd,null))[_0x963f('0x3c')](handleError(_0x3ff2dd,null));};exports['destroy']=function(_0x2bea6c,_0x18be60){return db[_0x963f('0x3a')][_0x963f('0x3b')]({'where':{'id':_0x2bea6c['params']['id']}})['then'](handleEntityNotFound(_0x18be60,null))[_0x963f('0x2a')](removeEntity(_0x18be60,null))[_0x963f('0x3c')](handleError(_0x18be60,null));};function widgetAttributes(_0x568efd){try{switch(_0x568efd[_0x963f('0x3d')]){case _0x963f('0x3e'):return[{'name':_0x963f('0x3f'),'value':_0x568efd[_0x963f('0x3f')]||(_0x568efd['attrs']&&_0x568efd['attrs'][0x0]?_0x568efd[_0x963f('0x40')][0x0][_0x963f('0x41')]:undefined)||'https://'}];case _0x963f('0x42'):return[{'name':_0x963f('0x43'),'value':_0x568efd[_0x963f('0x43')]||(_0x568efd[_0x963f('0x40')]&&_0x568efd[_0x963f('0x40')][0x0]?_0x568efd[_0x963f('0x40')][0x0]['value']:undefined)||''}];case _0x963f('0x44'):return[{'name':_0x963f('0x45'),'value':_0x568efd[_0x963f('0x45')]||(_0x568efd['attrs']&&_0x568efd[_0x963f('0x40')][0x0]?_0x568efd[_0x963f('0x40')][0x0]['value']:undefined)||_0x963f('0x46')},{'name':_0x963f('0x47'),'value':_0x568efd[_0x963f('0x47')]||(_0x568efd[_0x963f('0x40')]&&_0x568efd['attrs'][0x1]?_0x568efd[_0x963f('0x40')][0x1]['value']:undefined)||'0.00'},{'name':_0x963f('0x48'),'value':_0x568efd[_0x963f('0x48')]||(_0x568efd['attrs']&&_0x568efd['attrs'][0x2]?_0x568efd['attrs'][0x2][_0x963f('0x41')]:undefined)||0xc}];case _0x963f('0x49'):return[{'name':_0x963f('0x4a'),'value':_0x568efd[_0x963f('0x4a')]||(_0x568efd['attrs']&&_0x568efd[_0x963f('0x40')][0x0]?_0x568efd[_0x963f('0x40')][0x0][_0x963f('0x41')]:undefined)||'total'},{'name':_0x963f('0x4b'),'value':_0x568efd[_0x963f('0x4b')]||(_0x568efd['attrs']&&_0x568efd[_0x963f('0x40')][0x1]?_0x568efd[_0x963f('0x40')][0x1][_0x963f('0x41')]:undefined)||[]},{'name':_0x963f('0x48'),'value':_0x568efd[_0x963f('0x48')]||(_0x568efd[_0x963f('0x40')]&&_0x568efd['attrs'][0x2]?_0x568efd['attrs'][0x2][_0x963f('0x41')]:undefined)||0x14}];case _0x963f('0x4c'):case'pie-chart':return[{'name':_0x963f('0x4d'),'value':_0x568efd['attrSerie1']||(_0x568efd[_0x963f('0x40')]&&_0x568efd['attrs'][0x0]?_0x568efd['attrs'][0x0]['value']:undefined)||_0x963f('0x4e')},{'name':_0x963f('0x4f'),'value':_0x568efd[_0x963f('0x4f')]||(_0x568efd[_0x963f('0x40')]&&_0x568efd[_0x963f('0x40')][0x1]?_0x568efd[_0x963f('0x40')][0x1][_0x963f('0x41')]:undefined)||null},{'name':_0x963f('0x50'),'value':_0x568efd[_0x963f('0x50')]||(_0x568efd[_0x963f('0x40')]&&_0x568efd[_0x963f('0x40')][0x2]?_0x568efd[_0x963f('0x40')][0x2][_0x963f('0x41')]:undefined)||null},{'name':_0x963f('0x4b'),'value':_0x568efd[_0x963f('0x4b')]||(_0x568efd[_0x963f('0x40')]&&_0x568efd['attrs'][0x3]?_0x568efd['attrs'][0x3][_0x963f('0x41')]:undefined)||[]}];case _0x963f('0x51'):return[{'name':_0x963f('0x52'),'type':_0x568efd[_0x963f('0x53')]||(_0x568efd[_0x963f('0x40')]&&_0x568efd[_0x963f('0x40')][0x0]?_0x568efd[_0x963f('0x40')][0x0][_0x963f('0x3d')]:undefined)||null,'value':_0x568efd[_0x963f('0x52')]||(_0x568efd[_0x963f('0x40')]&&_0x568efd[_0x963f('0x40')][0x0]?_0x568efd[_0x963f('0x40')][0x0][_0x963f('0x41')]:undefined)||null},{'name':_0x963f('0x54'),'value':_0x568efd[_0x963f('0x54')]||(_0x568efd[_0x963f('0x40')]&&_0x568efd[_0x963f('0x40')][0x1]?_0x568efd[_0x963f('0x40')][0x1][_0x963f('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x5466c1){logger[_0x963f('0x55')]('widgetAttributes:\x20%s',JSON[_0x963f('0x56')](_0x5466c1));return[];}}exports[_0x963f('0x57')]=function(_0x2cd46b,_0x202997){if(_0x2cd46b[_0x963f('0x58')]){_0x2cd46b['body'][_0x963f('0x40')]=widgetAttributes(_0x2cd46b['body']);}return db[_0x963f('0x3a')][_0x963f('0x57')](_0x2cd46b[_0x963f('0x58')],{})[_0x963f('0x2a')](respondWithResult(_0x202997,0xc9))[_0x963f('0x3c')](handleError(_0x202997,null));};exports[_0x963f('0x28')]=function(_0x50117e,_0x109432){if(_0x50117e[_0x963f('0x58')]['id']){delete _0x50117e[_0x963f('0x58')]['id'];}_0x50117e[_0x963f('0x58')][_0x963f('0x40')]=widgetAttributes(_0x50117e['body']);return db['DashboardItem'][_0x963f('0x3b')]({'where':{'id':_0x50117e[_0x963f('0x2e')]['id']}})[_0x963f('0x2a')](handleEntityNotFound(_0x109432,null))[_0x963f('0x2a')](saveUpdates(_0x50117e[_0x963f('0x58')],null))['then'](respondWithResult(_0x109432,null))[_0x963f('0x3c')](handleError(_0x109432,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 775a436..112a16e 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 _0xc770=['emit','hasOwnProperty','hook','events','../../mysqldb','save','update','remove'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xc770,0xd3));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x0c77('0x0'));var DashboardItem=require(_0x0c77('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0c77('0x2'),'afterUpdate':_0x0c77('0x3'),'afterDestroy':_0x0c77('0x4')};function emitEvent(_0x23ae87){return function(_0xdcfb07,_0x18e293,_0x2a7b4b){DashboardItemEvents[_0x0c77('0x5')](_0x23ae87+':'+_0xdcfb07['id'],_0xdcfb07);DashboardItemEvents['emit'](_0x23ae87,_0xdcfb07);_0x2a7b4b(null);};}for(var e in events){if(events[_0x0c77('0x6')](e)){var event=events[e];DashboardItem[_0x0c77('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x40d9=['../../mysqldb','DashboardItem','save','remove','emit','hasOwnProperty','exports'];(function(_0x58db4e,_0x439d8d){var _0x40139a=function(_0x34cae4){while(--_0x34cae4){_0x58db4e['push'](_0x58db4e['shift']());}};_0x40139a(++_0x439d8d);}(_0x40d9,0xa1));var _0x940d=function(_0x497e48,_0x3bc17a){_0x497e48=_0x497e48-0x0;var _0x30e579=_0x40d9[_0x497e48];return _0x30e579;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x940d('0x0'))['db'][_0x940d('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x940d('0x2'),'afterUpdate':'update','afterDestroy':_0x940d('0x3')};function emitEvent(_0x25fe66){return function(_0x340f2d,_0x1aed09,_0x5963ab){DashboardItemEvents[_0x940d('0x4')](_0x25fe66+':'+_0x340f2d['id'],_0x340f2d);DashboardItemEvents[_0x940d('0x4')](_0x25fe66,_0x340f2d);_0x5963ab(null);};}for(var e in events){if(events[_0x940d('0x5')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x940d('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 8e28de5..3196147 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 _0x5e7f=['../../config/logger','moment','bluebird','rimraf','./dashboardItem.attributes','exports','define','DashboardItem','lodash','util'];(function(_0x42e4e0,_0x57ab9c){var _0x5ea33c=function(_0x239369){while(--_0x239369){_0x42e4e0['push'](_0x42e4e0['shift']());}};_0x5ea33c(++_0x57ab9c);}(_0x5e7f,0x1c0));var _0xf5e7=function(_0x5397d8,_0x27675e){_0x5397d8=_0x5397d8-0x0;var _0x128e82=_0x5e7f[_0x5397d8];return _0x128e82;};'use strict';var _=require(_0xf5e7('0x0'));var util=require(_0xf5e7('0x1'));var logger=require(_0xf5e7('0x2'))('api');var moment=require(_0xf5e7('0x3'));var BPromise=require(_0xf5e7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf5e7('0x5'));var config=require('../../config/environment');var attributes=require(_0xf5e7('0x6'));module[_0xf5e7('0x7')]=function(_0x106d94,_0x1601ab){return _0x106d94[_0xf5e7('0x8')](_0xf5e7('0x9'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9626=['bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','dashboard_items','../../config/logger','moment'];(function(_0x7e55a4,_0x10ff38){var _0x1e152b=function(_0x58ec93){while(--_0x58ec93){_0x7e55a4['push'](_0x7e55a4['shift']());}};_0x1e152b(++_0x10ff38);}(_0x9626,0x170));var _0x6962=function(_0x3efde5,_0x5eacb8){_0x3efde5=_0x3efde5-0x0;var _0x5a20a6=_0x9626[_0x3efde5];return _0x5a20a6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6962('0x0'))('api');var moment=require(_0x6962('0x1'));var BPromise=require(_0x6962('0x2'));var rp=require(_0x6962('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6962('0x4'));var config=require(_0x6962('0x5'));var attributes=require(_0x6962('0x6'));module[_0x6962('0x7')]=function(_0xa09ed9,_0x3f45ec){return _0xa09ed9[_0x6962('0x8')]('DashboardItem',attributes,{'tableName':_0x6962('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index cbe4fa6..65d5db3 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 _0x2a0a=['socket.io-emitter','./dashboardItem.socket','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2a0a,0x110));var _0xa2a0=function(_0x1e16d2,_0x2eae03){_0x1e16d2=_0x1e16d2-0x0;var _0xc594fe=_0x2a0a[_0x1e16d2];return _0xc594fe;};'use strict';var _=require(_0xa2a0('0x0'));var util=require('util');var moment=require(_0xa2a0('0x1'));var BPromise=require(_0xa2a0('0x2'));var rs=require(_0xa2a0('0x3'));var fs=require('fs');var Redis=require(_0xa2a0('0x4'));var db=require(_0xa2a0('0x5'))['db'];var utils=require(_0xa2a0('0x6'));var logger=require(_0xa2a0('0x7'))(_0xa2a0('0x8'));var config=require('../../config/environment');var jayson=require(_0xa2a0('0x9'));var client=jayson['client'][_0xa2a0('0xa')]({'port':0x232a});config[_0xa2a0('0xb')]=_[_0xa2a0('0xc')](config['redis'],{'host':_0xa2a0('0xd'),'port':0x18eb});var socket=require(_0xa2a0('0xe'))(new Redis(config[_0xa2a0('0xb')]));require(_0xa2a0('0xf'))['register'](socket);function respondWithRpcPromise(_0x26ccb2,_0x56eb61,_0x136148){return new BPromise(function(_0x506fa3,_0xd14ec1){return client[_0xa2a0('0x10')](_0x26ccb2,_0x136148)['then'](function(_0x563a60){logger[_0xa2a0('0x11')](_0xa2a0('0x12'),_0x56eb61,_0xa2a0('0x13'));logger['debug'](_0xa2a0('0x14'),_0x56eb61,_0xa2a0('0x13'),JSON['stringify'](_0x563a60));if(_0x563a60[_0xa2a0('0x15')]){if(_0x563a60[_0xa2a0('0x15')][_0xa2a0('0x16')]===0x1f4){logger[_0xa2a0('0x15')](_0xa2a0('0x12'),_0x56eb61,_0x563a60[_0xa2a0('0x15')][_0xa2a0('0x17')]);return _0xd14ec1(_0x563a60['error'][_0xa2a0('0x17')]);}logger[_0xa2a0('0x15')](_0xa2a0('0x12'),_0x56eb61,_0x563a60[_0xa2a0('0x15')][_0xa2a0('0x17')]);return _0x506fa3(_0x563a60[_0xa2a0('0x15')]['message']);}else{logger[_0xa2a0('0x11')](_0xa2a0('0x12'),_0x56eb61,_0xa2a0('0x13'));_0x506fa3(_0x563a60[_0xa2a0('0x18')][_0xa2a0('0x17')]);}})[_0xa2a0('0x19')](function(_0x3be3d7){logger[_0xa2a0('0x15')](_0xa2a0('0x12'),_0x56eb61,_0x3be3d7);_0xd14ec1(_0x3be3d7);});});} \ No newline at end of file +var _0x2587=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util'];(function(_0x2ba00c,_0x182642){var _0x21712b=function(_0x1bcf8e){while(--_0x1bcf8e){_0x2ba00c['push'](_0x2ba00c['shift']());}};_0x21712b(++_0x182642);}(_0x2587,0x12a));var _0x7258=function(_0x3f6426,_0x12cbf9){_0x3f6426=_0x3f6426-0x0;var _0x25d790=_0x2587[_0x3f6426];return _0x25d790;};'use strict';var _=require(_0x7258('0x0'));var util=require(_0x7258('0x1'));var moment=require(_0x7258('0x2'));var BPromise=require(_0x7258('0x3'));var rs=require(_0x7258('0x4'));var fs=require('fs');var Redis=require(_0x7258('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7258('0x6'));var logger=require('../../config/logger')(_0x7258('0x7'));var config=require(_0x7258('0x8'));var jayson=require(_0x7258('0x9'));var client=jayson[_0x7258('0xa')]['http']({'port':0x232a});config[_0x7258('0xb')]=_[_0x7258('0xc')](config[_0x7258('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7258('0xd'))(new Redis(config[_0x7258('0xb')]));require(_0x7258('0xe'))[_0x7258('0xf')](socket);function respondWithRpcPromise(_0x51c535,_0x296f1f,_0xad064e){return new BPromise(function(_0x4c8895,_0x5c015a){return client['request'](_0x51c535,_0xad064e)['then'](function(_0x471630){logger[_0x7258('0x10')](_0x7258('0x11'),_0x296f1f,'request\x20sent');logger[_0x7258('0x12')](_0x7258('0x13'),_0x296f1f,_0x7258('0x14'),JSON[_0x7258('0x15')](_0x471630));if(_0x471630[_0x7258('0x16')]){if(_0x471630[_0x7258('0x16')]['code']===0x1f4){logger[_0x7258('0x16')](_0x7258('0x11'),_0x296f1f,_0x471630[_0x7258('0x16')][_0x7258('0x17')]);return _0x5c015a(_0x471630[_0x7258('0x16')][_0x7258('0x17')]);}logger[_0x7258('0x16')]('DashboardItem,\x20%s,\x20%s',_0x296f1f,_0x471630[_0x7258('0x16')]['message']);return _0x4c8895(_0x471630[_0x7258('0x16')][_0x7258('0x17')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x296f1f,_0x7258('0x14'));_0x4c8895(_0x471630['result'][_0x7258('0x17')]);}})[_0x7258('0x18')](function(_0x235daf){logger[_0x7258('0x16')](_0x7258('0x11'),_0x296f1f,_0x235daf);_0x5c015a(_0x235daf);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 53786af..f5fb1fe 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 _0x44e5=['register','length','./dashboardItem.events','remove','update','emit','removeListener'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x44e5,0x198));var _0x544e=function(_0x5c956b,_0xa87d11){_0x5c956b=_0x5c956b-0x0;var _0xaff46a=_0x44e5[_0x5c956b];return _0xaff46a;};'use strict';var DashboardItemEvents=require(_0x544e('0x0'));var events=['save',_0x544e('0x1'),_0x544e('0x2')];function createListener(_0x234095,_0x17c45b){return function(_0x2871c4){_0x17c45b[_0x544e('0x3')](_0x234095,_0x2871c4);};}function removeListener(_0x416662,_0x4e304b){return function(){DashboardItemEvents[_0x544e('0x4')](_0x416662,_0x4e304b);};}exports[_0x544e('0x5')]=function(_0x5abca6){for(var _0x17f685=0x0,_0x5c0191=events[_0x544e('0x6')];_0x17f685<_0x5c0191;_0x17f685++){var _0x1687b8=events[_0x17f685];var _0x17401a=createListener('dashboardItem:'+_0x1687b8,_0x5abca6);DashboardItemEvents['on'](_0x1687b8,_0x17401a);}}; \ No newline at end of file +var _0xfa72=['removeListener','register','length','./dashboardItem.events','save','update','emit'];(function(_0x52ade0,_0x4e73a3){var _0x3241f1=function(_0x4779e5){while(--_0x4779e5){_0x52ade0['push'](_0x52ade0['shift']());}};_0x3241f1(++_0x4e73a3);}(_0xfa72,0x106));var _0x2fa7=function(_0x8632fe,_0x2bf5f8){_0x8632fe=_0x8632fe-0x0;var _0x57d9f8=_0xfa72[_0x8632fe];return _0x57d9f8;};'use strict';var DashboardItemEvents=require(_0x2fa7('0x0'));var events=[_0x2fa7('0x1'),'remove',_0x2fa7('0x2')];function createListener(_0x9686cf,_0x33b558){return function(_0x572212){_0x33b558[_0x2fa7('0x3')](_0x9686cf,_0x572212);};}function removeListener(_0x1c9981,_0x15241b){return function(){DashboardItemEvents[_0x2fa7('0x4')](_0x1c9981,_0x15241b);};}exports[_0x2fa7('0x5')]=function(_0x1b71ab){for(var _0x5baf15=0x0,_0x260b3e=events[_0x2fa7('0x6')];_0x5baf15<_0x260b3e;_0x5baf15++){var _0x4d7908=events[_0x5baf15];var _0x1e6488=createListener('dashboardItem:'+_0x4d7908,_0x1b71ab);DashboardItemEvents['on'](_0x4d7908,_0x1e6488);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 0bbb576..b95a830 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 _0x8ee5=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','show','post','isAuthenticated','create'];(function(_0x416144,_0x4ad551){var _0x10eafe=function(_0x5cc750){while(--_0x5cc750){_0x416144['push'](_0x416144['shift']());}};_0x10eafe(++_0x4ad551);}(_0x8ee5,0x17e));var _0x58ee=function(_0x49920b,_0x3f6701){_0x49920b=_0x49920b-0x0;var _0x455ae5=_0x8ee5[_0x49920b];return _0x455ae5;};'use strict';var multer=require(_0x58ee('0x0'));var util=require(_0x58ee('0x1'));var path=require(_0x58ee('0x2'));var timeout=require(_0x58ee('0x3'));var express=require(_0x58ee('0x4'));var router=express[_0x58ee('0x5')]();var fs_extra=require(_0x58ee('0x6'));var auth=require(_0x58ee('0x7'));var interaction=require(_0x58ee('0x8'));var config=require(_0x58ee('0x9'));var controller=require(_0x58ee('0xa'));router[_0x58ee('0xb')](_0x58ee('0xc'),auth['isAuthenticated'](),controller[_0x58ee('0xd')]);router[_0x58ee('0xe')]('/',auth[_0x58ee('0xf')](),controller[_0x58ee('0x10')]);router[_0x58ee('0x11')](_0x58ee('0xc'),auth[_0x58ee('0xf')](),controller['update']);router[_0x58ee('0x12')](_0x58ee('0xc'),auth['isAuthenticated'](),controller[_0x58ee('0x13')]);module[_0x58ee('0x14')]=router; \ No newline at end of file +var _0x0952=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','create','put','update','exports','multer'];(function(_0x1b1c4f,_0x32eb9c){var _0x3f02c1=function(_0x180c82){while(--_0x180c82){_0x1b1c4f['push'](_0x1b1c4f['shift']());}};_0x3f02c1(++_0x32eb9c);}(_0x0952,0xe0));var _0x2095=function(_0x46c850,_0xc659fc){_0x46c850=_0x46c850-0x0;var _0x17935e=_0x0952[_0x46c850];return _0x17935e;};'use strict';var multer=require(_0x2095('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2095('0x1'));var express=require(_0x2095('0x2'));var router=express[_0x2095('0x3')]();var fs_extra=require(_0x2095('0x4'));var auth=require(_0x2095('0x5'));var interaction=require(_0x2095('0x6'));var config=require(_0x2095('0x7'));var controller=require(_0x2095('0x8'));router['get'](_0x2095('0x9'),auth[_0x2095('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x2095('0xb')]);router[_0x2095('0xc')](_0x2095('0x9'),auth[_0x2095('0xa')](),controller[_0x2095('0xd')]);router['delete']('/:id',auth[_0x2095('0xa')](),controller['destroy']);module[_0x2095('0xe')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 19a588d..7c573dc 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 _0xa370=['STRING','ENUM','first','second','third'];(function(_0x24fa1a,_0x16d9c2){var _0xc5621f=function(_0x5616ac){while(--_0x5616ac){_0x24fa1a['push'](_0x24fa1a['shift']());}};_0xc5621f(++_0x16d9c2);}(_0xa370,0x177));var _0x0a37=function(_0x2e0a25,_0x2da7a6){_0x2e0a25=_0x2e0a25-0x0;var _0x359873=_0xa370[_0x2e0a25];return _0x359873;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0a37('0x0')],'allowNull':![]},'level':{'type':Sequelize[_0x0a37('0x1')](_0x0a37('0x2'),_0x0a37('0x3'),_0x0a37('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x0a37('0x0')]}}; \ No newline at end of file +var _0x6037=['second','STRING','exports','first'];(function(_0x32821f,_0x10124b){var _0x16efef=function(_0x43bc23){while(--_0x43bc23){_0x32821f['push'](_0x32821f['shift']());}};_0x16efef(++_0x10124b);}(_0x6037,0xb6));var _0x7603=function(_0x11f8ea,_0x53ddb8){_0x11f8ea=_0x11f8ea-0x0;var _0x43321e=_0x6037[_0x11f8ea];return _0x43321e;};'use strict';var Sequelize=require('sequelize');module[_0x7603('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x7603('0x1'),_0x7603('0x2'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x7603('0x3')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 210c478..fd23645 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 _0xf6c1=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','name','send','index','map','Disposition','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xf6c1,0x99));var _0x1f6c=function(_0x541277,_0xbba8d6){_0x541277=_0x541277-0x0;var _0x48582f=_0xf6c1[_0x541277];return _0x48582f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1f6c('0x0'));var jsonpatch=require(_0x1f6c('0x1'));var rp=require(_0x1f6c('0x2'));var moment=require('moment');var BPromise=require(_0x1f6c('0x3'));var Mustache=require('mustache');var util=require(_0x1f6c('0x4'));var path=require(_0x1f6c('0x5'));var sox=require(_0x1f6c('0x6'));var csv=require(_0x1f6c('0x7'));var ejs=require(_0x1f6c('0x8'));var fs=require('fs');var fs_extra=require(_0x1f6c('0x9'));var _=require('lodash');var squel=require(_0x1f6c('0xa'));var crypto=require(_0x1f6c('0xb'));var jsforce=require(_0x1f6c('0xc'));var deskjs=require(_0x1f6c('0xd'));var toCsv=require(_0x1f6c('0x7'));var querystring=require(_0x1f6c('0xe'));var Papa=require(_0x1f6c('0xf'));var Redis=require(_0x1f6c('0x10'));var authService=require(_0x1f6c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f6c('0x12'))(_0x1f6c('0x13'));var utils=require(_0x1f6c('0x14'));var config=require(_0x1f6c('0x15'));var licenseUtil=require(_0x1f6c('0x16'));var db=require(_0x1f6c('0x17'))['db'];function respondWithStatusCode(_0x507a06,_0x7963a9){_0x7963a9=_0x7963a9||0xcc;return function(_0x1e7060){if(_0x1e7060){return _0x507a06[_0x1f6c('0x18')](_0x7963a9);}return _0x507a06[_0x1f6c('0x19')](_0x7963a9)[_0x1f6c('0x1a')]();};}function respondWithResult(_0x1315b7,_0x31fc67){_0x31fc67=_0x31fc67||0xc8;return function(_0x147c01){if(_0x147c01){return _0x1315b7['status'](_0x31fc67)[_0x1f6c('0x1b')](_0x147c01);}};}function respondWithFilteredResult(_0x302026,_0x26652b){return function(_0x43ce04){if(_0x43ce04){var _0xc8b6f2=typeof _0x26652b[_0x1f6c('0x1c')]==='undefined'&&typeof _0x26652b['limit']===_0x1f6c('0x1d');var _0x30a8dc=_0x43ce04['count'];var _0x2328f2=_0xc8b6f2?0x0:_0x26652b['offset'];var _0x31c887=_0xc8b6f2?_0x43ce04[_0x1f6c('0x1e')]:_0x26652b[_0x1f6c('0x1c')]+_0x26652b[_0x1f6c('0x1f')];var _0xd71b77;if(_0x31c887>=_0x30a8dc){_0x31c887=_0x30a8dc;_0xd71b77=0xc8;}else{_0xd71b77=0xce;}_0x302026[_0x1f6c('0x19')](_0xd71b77);return _0x302026[_0x1f6c('0x20')](_0x1f6c('0x21'),_0x2328f2+'-'+_0x31c887+'/'+_0x30a8dc)[_0x1f6c('0x1b')](_0x43ce04);}return null;};}function patchUpdates(_0x459944){return function(_0x44b1c5){try{jsonpatch[_0x1f6c('0x22')](_0x44b1c5,_0x459944,!![]);}catch(_0x196356){return BPromise[_0x1f6c('0x23')](_0x196356);}return _0x44b1c5[_0x1f6c('0x24')]();};}function saveUpdates(_0x55881f,_0x2644e9){return function(_0x511191){if(_0x511191){return _0x511191[_0x1f6c('0x25')](_0x55881f)[_0x1f6c('0x26')](function(_0x536eb6){return _0x536eb6;});}return null;};}function removeEntity(_0x1aa1f6,_0x4ef92a){return function(_0x32a812){if(_0x32a812){return _0x32a812[_0x1f6c('0x27')]()[_0x1f6c('0x26')](function(){var _0x185eb0=_0x32a812[_0x1f6c('0x28')]({'plain':!![]});var _0x386016=_0x1f6c('0x29');return db[_0x1f6c('0x2a')][_0x1f6c('0x27')]({'where':{'type':_0x386016,'resourceId':_0x185eb0['id']}})[_0x1f6c('0x26')](function(){return _0x32a812;});})['then'](function(){_0x1aa1f6[_0x1f6c('0x19')](0xcc)[_0x1f6c('0x1a')]();});}};}function handleEntityNotFound(_0x2b59b8,_0x5389e5){return function(_0x3374dc){if(!_0x3374dc){_0x2b59b8[_0x1f6c('0x18')](0x194);}return _0x3374dc;};}function handleError(_0x2ce9df,_0x30fdea){_0x30fdea=_0x30fdea||0x1f4;return function(_0xeaeccd){logger[_0x1f6c('0x2b')](_0xeaeccd['stack']);if(_0xeaeccd[_0x1f6c('0x2c')]){delete _0xeaeccd['name'];}_0x2ce9df[_0x1f6c('0x19')](_0x30fdea)[_0x1f6c('0x2d')](_0xeaeccd);};}exports[_0x1f6c('0x2e')]=function(_0x463543,_0xe574ac){var _0x497d8c={},_0x7a927a={},_0x47db8b={'count':0x0,'rows':[]};var _0x4ed20c=_[_0x1f6c('0x2f')](db[_0x1f6c('0x30')][_0x1f6c('0x31')],function(_0x29ad8d){return{'name':_0x29ad8d['fieldName'],'type':_0x29ad8d[_0x1f6c('0x32')][_0x1f6c('0x33')]};});_0x7a927a[_0x1f6c('0x34')]=_[_0x1f6c('0x2f')](_0x4ed20c,_0x1f6c('0x2c'));_0x7a927a['query']=_['keys'](_0x463543[_0x1f6c('0x35')]);_0x7a927a[_0x1f6c('0x36')]=_[_0x1f6c('0x37')](_0x7a927a[_0x1f6c('0x34')],_0x7a927a['query']);_0x497d8c[_0x1f6c('0x38')]=_['intersection'](_0x7a927a['model'],qs[_0x1f6c('0x39')](_0x463543[_0x1f6c('0x35')][_0x1f6c('0x39')]));_0x497d8c[_0x1f6c('0x38')]=_0x497d8c[_0x1f6c('0x38')][_0x1f6c('0x3a')]?_0x497d8c[_0x1f6c('0x38')]:_0x7a927a[_0x1f6c('0x34')];if(!_0x463543[_0x1f6c('0x35')][_0x1f6c('0x3b')](_0x1f6c('0x3c'))){_0x497d8c[_0x1f6c('0x1f')]=qs[_0x1f6c('0x1f')](_0x463543[_0x1f6c('0x35')][_0x1f6c('0x1f')]);_0x497d8c[_0x1f6c('0x1c')]=qs[_0x1f6c('0x1c')](_0x463543['query'][_0x1f6c('0x1c')]);}_0x497d8c[_0x1f6c('0x3d')]=qs[_0x1f6c('0x3e')](_0x463543[_0x1f6c('0x35')][_0x1f6c('0x3e')]);_0x497d8c['where']=qs['filters'](_[_0x1f6c('0x3f')](_0x463543[_0x1f6c('0x35')],_0x7a927a[_0x1f6c('0x36')]),_0x4ed20c);if(_0x463543[_0x1f6c('0x35')][_0x1f6c('0x40')]){_0x497d8c[_0x1f6c('0x41')]=_['merge'](_0x497d8c[_0x1f6c('0x41')],{'$or':_[_0x1f6c('0x2f')](_0x4ed20c,function(_0x23f4bd){if(_0x23f4bd[_0x1f6c('0x32')]!==_0x1f6c('0x42')){var _0x74d4a6={};_0x74d4a6[_0x23f4bd[_0x1f6c('0x2c')]]={'$like':'%'+_0x463543[_0x1f6c('0x35')]['filter']+'%'};return _0x74d4a6;}})});}_0x497d8c=_['merge']({},_0x497d8c,_0x463543[_0x1f6c('0x43')]);var _0x48c2a1={'where':_0x497d8c['where']};return db[_0x1f6c('0x30')][_0x1f6c('0x1e')](_0x48c2a1)[_0x1f6c('0x26')](function(_0x1a2fff){_0x47db8b[_0x1f6c('0x1e')]=_0x1a2fff;if(_0x463543[_0x1f6c('0x35')][_0x1f6c('0x44')]){_0x497d8c[_0x1f6c('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x1f6c('0x46')](_0x497d8c);})['then'](function(_0x4b92ac){_0x47db8b[_0x1f6c('0x47')]=_0x4b92ac;return _0x47db8b;})[_0x1f6c('0x26')](respondWithFilteredResult(_0xe574ac,_0x497d8c))[_0x1f6c('0x48')](handleError(_0xe574ac,null));};exports['show']=function(_0x13034d,_0x4e2cdb){var _0x42ae1d={'raw':!![],'where':{'id':_0x13034d['params']['id']}},_0x2c7f71={};_0x2c7f71[_0x1f6c('0x34')]=_['keys'](db[_0x1f6c('0x30')][_0x1f6c('0x31')]);_0x2c7f71['query']=_[_0x1f6c('0x49')](_0x13034d['query']);_0x2c7f71['filters']=_[_0x1f6c('0x37')](_0x2c7f71['model'],_0x2c7f71[_0x1f6c('0x35')]);_0x42ae1d['attributes']=_[_0x1f6c('0x37')](_0x2c7f71[_0x1f6c('0x34')],qs[_0x1f6c('0x39')](_0x13034d['query'][_0x1f6c('0x39')]));_0x42ae1d[_0x1f6c('0x38')]=_0x42ae1d[_0x1f6c('0x38')]['length']?_0x42ae1d['attributes']:_0x2c7f71['model'];if(_0x13034d['query'][_0x1f6c('0x44')]){_0x42ae1d[_0x1f6c('0x45')]=[{'all':!![]}];}_0x42ae1d=_['merge']({},_0x42ae1d,_0x13034d['options']);return db[_0x1f6c('0x30')][_0x1f6c('0x4a')](_0x42ae1d)[_0x1f6c('0x26')](handleEntityNotFound(_0x4e2cdb,null))[_0x1f6c('0x26')](respondWithResult(_0x4e2cdb,null))[_0x1f6c('0x48')](handleError(_0x4e2cdb,null));};exports[_0x1f6c('0x4b')]=function(_0x508fdb,_0x303c50){return db[_0x1f6c('0x30')]['create'](_0x508fdb[_0x1f6c('0x4c')],{})[_0x1f6c('0x26')](function(_0x4bd86d){var _0x28a02a=_0x508fdb['user'][_0x1f6c('0x28')]({'plain':!![]});if(!_0x28a02a)throw new Error(_0x1f6c('0x4d'));if(_0x28a02a[_0x1f6c('0x4e')]==='user'){var _0xd4d0b1=_0x4bd86d[_0x1f6c('0x28')]({'plain':!![]});var _0x4b4621=_0x1f6c('0x29');return db['UserProfileSection'][_0x1f6c('0x4a')]({'where':{'name':_0x4b4621,'userProfileId':_0x28a02a[_0x1f6c('0x4f')]},'raw':!![]})[_0x1f6c('0x26')](function(_0x48f713){if(_0x48f713&&_0x48f713[_0x1f6c('0x50')]===0x0){return db[_0x1f6c('0x2a')]['create']({'name':_0xd4d0b1[_0x1f6c('0x2c')],'resourceId':_0xd4d0b1['id'],'type':_0x48f713['name'],'sectionId':_0x48f713['id']},{})[_0x1f6c('0x26')](function(){return _0x4bd86d;});}else{return _0x4bd86d;}})[_0x1f6c('0x48')](function(_0xd4d119){logger[_0x1f6c('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd4d119);throw _0xd4d119;});}return _0x4bd86d;})['then'](respondWithResult(_0x303c50,0xc9))['catch'](handleError(_0x303c50,null));};exports[_0x1f6c('0x25')]=function(_0x426761,_0x335974){if(_0x426761[_0x1f6c('0x4c')]['id']){delete _0x426761[_0x1f6c('0x4c')]['id'];}return db[_0x1f6c('0x30')][_0x1f6c('0x4a')]({'where':{'id':_0x426761[_0x1f6c('0x51')]['id']}})[_0x1f6c('0x26')](handleEntityNotFound(_0x335974,null))[_0x1f6c('0x26')](saveUpdates(_0x426761[_0x1f6c('0x4c')],null))[_0x1f6c('0x26')](respondWithResult(_0x335974,null))[_0x1f6c('0x48')](handleError(_0x335974,null));};exports[_0x1f6c('0x27')]=function(_0xc76c51,_0x38a288){return db[_0x1f6c('0x30')][_0x1f6c('0x4a')]({'where':{'id':_0xc76c51[_0x1f6c('0x51')]['id']}})['then'](handleEntityNotFound(_0x38a288,null))[_0x1f6c('0x26')](removeEntity(_0x38a288,null))['catch'](handleError(_0x38a288,null));}; \ No newline at end of file +var _0xfd0f=['type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','Disposition','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','get','Dispositions','UserProfileResource','sendStatus','error','name','index','rawAttributes','fieldName'];(function(_0x3d6721,_0x261121){var _0x1cfd87=function(_0x552fa2){while(--_0x552fa2){_0x3d6721['push'](_0x3d6721['shift']());}};_0x1cfd87(++_0x261121);}(_0xfd0f,0x1b8));var _0xffd0=function(_0x17d7ea,_0x2e0974){_0x17d7ea=_0x17d7ea-0x0;var _0x243d72=_0xfd0f[_0x17d7ea];return _0x243d72;};'use strict';var emlformat=require(_0xffd0('0x0'));var rimraf=require(_0xffd0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xffd0('0x2'));var rp=require(_0xffd0('0x3'));var moment=require(_0xffd0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xffd0('0x5'));var util=require('util');var path=require(_0xffd0('0x6'));var sox=require(_0xffd0('0x7'));var csv=require(_0xffd0('0x8'));var ejs=require(_0xffd0('0x9'));var fs=require('fs');var fs_extra=require(_0xffd0('0xa'));var _=require(_0xffd0('0xb'));var squel=require(_0xffd0('0xc'));var crypto=require(_0xffd0('0xd'));var jsforce=require(_0xffd0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xffd0('0x8'));var querystring=require(_0xffd0('0xf'));var Papa=require(_0xffd0('0x10'));var Redis=require(_0xffd0('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xffd0('0x12'));var hardwareService=require(_0xffd0('0x13'));var logger=require(_0xffd0('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xffd0('0x15'));var licenseUtil=require(_0xffd0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa6e1ad,_0xaf12c1){_0xaf12c1=_0xaf12c1||0xcc;return function(_0x2ca16d){if(_0x2ca16d){return _0xa6e1ad['sendStatus'](_0xaf12c1);}return _0xa6e1ad[_0xffd0('0x17')](_0xaf12c1)[_0xffd0('0x18')]();};}function respondWithResult(_0x5be5aa,_0x3cf549){_0x3cf549=_0x3cf549||0xc8;return function(_0x48fc60){if(_0x48fc60){return _0x5be5aa['status'](_0x3cf549)[_0xffd0('0x19')](_0x48fc60);}};}function respondWithFilteredResult(_0x5c799c,_0x321ceb){return function(_0x2e030d){if(_0x2e030d){var _0x15e710=typeof _0x321ceb[_0xffd0('0x1a')]===_0xffd0('0x1b')&&typeof _0x321ceb['limit']==='undefined';var _0x285c52=_0x2e030d[_0xffd0('0x1c')];var _0x2e9463=_0x15e710?0x0:_0x321ceb[_0xffd0('0x1a')];var _0x409b90=_0x15e710?_0x2e030d[_0xffd0('0x1c')]:_0x321ceb[_0xffd0('0x1a')]+_0x321ceb[_0xffd0('0x1d')];var _0x684579;if(_0x409b90>=_0x285c52){_0x409b90=_0x285c52;_0x684579=0xc8;}else{_0x684579=0xce;}_0x5c799c[_0xffd0('0x17')](_0x684579);return _0x5c799c[_0xffd0('0x1e')](_0xffd0('0x1f'),_0x2e9463+'-'+_0x409b90+'/'+_0x285c52)[_0xffd0('0x19')](_0x2e030d);}return null;};}function patchUpdates(_0x19c523){return function(_0x3deed6){try{jsonpatch[_0xffd0('0x20')](_0x3deed6,_0x19c523,!![]);}catch(_0x5219ca){return BPromise['reject'](_0x5219ca);}return _0x3deed6[_0xffd0('0x21')]();};}function saveUpdates(_0x13c117,_0x4fbb72){return function(_0x4f3cb3){if(_0x4f3cb3){return _0x4f3cb3[_0xffd0('0x22')](_0x13c117)['then'](function(_0x10467e){return _0x10467e;});}return null;};}function removeEntity(_0x329864,_0x2c8d64){return function(_0x38f25f){if(_0x38f25f){return _0x38f25f[_0xffd0('0x23')]()[_0xffd0('0x24')](function(){var _0x45edb3=_0x38f25f[_0xffd0('0x25')]({'plain':!![]});var _0x2e3046=_0xffd0('0x26');return db[_0xffd0('0x27')][_0xffd0('0x23')]({'where':{'type':_0x2e3046,'resourceId':_0x45edb3['id']}})[_0xffd0('0x24')](function(){return _0x38f25f;});})['then'](function(){_0x329864['status'](0xcc)[_0xffd0('0x18')]();});}};}function handleEntityNotFound(_0x4928ea,_0x5a7c44){return function(_0x142921){if(!_0x142921){_0x4928ea[_0xffd0('0x28')](0x194);}return _0x142921;};}function handleError(_0x3a28b7,_0xe8a70){_0xe8a70=_0xe8a70||0x1f4;return function(_0x3f5423){logger[_0xffd0('0x29')](_0x3f5423['stack']);if(_0x3f5423[_0xffd0('0x2a')]){delete _0x3f5423['name'];}_0x3a28b7['status'](_0xe8a70)['send'](_0x3f5423);};}exports[_0xffd0('0x2b')]=function(_0x896a70,_0x3b71ac){var _0xdb9da8={},_0x3bb309={},_0x326e8f={'count':0x0,'rows':[]};var _0x5c3be5=_['map'](db['Disposition'][_0xffd0('0x2c')],function(_0x5bb7f1){return{'name':_0x5bb7f1[_0xffd0('0x2d')],'type':_0x5bb7f1[_0xffd0('0x2e')]['key']};});_0x3bb309[_0xffd0('0x2f')]=_['map'](_0x5c3be5,'name');_0x3bb309['query']=_[_0xffd0('0x30')](_0x896a70[_0xffd0('0x31')]);_0x3bb309[_0xffd0('0x32')]=_[_0xffd0('0x33')](_0x3bb309[_0xffd0('0x2f')],_0x3bb309['query']);_0xdb9da8[_0xffd0('0x34')]=_[_0xffd0('0x33')](_0x3bb309['model'],qs[_0xffd0('0x35')](_0x896a70[_0xffd0('0x31')][_0xffd0('0x35')]));_0xdb9da8[_0xffd0('0x34')]=_0xdb9da8[_0xffd0('0x34')][_0xffd0('0x36')]?_0xdb9da8['attributes']:_0x3bb309[_0xffd0('0x2f')];if(!_0x896a70[_0xffd0('0x31')]['hasOwnProperty'](_0xffd0('0x37'))){_0xdb9da8[_0xffd0('0x1d')]=qs['limit'](_0x896a70[_0xffd0('0x31')][_0xffd0('0x1d')]);_0xdb9da8['offset']=qs[_0xffd0('0x1a')](_0x896a70['query'][_0xffd0('0x1a')]);}_0xdb9da8[_0xffd0('0x38')]=qs['sort'](_0x896a70[_0xffd0('0x31')][_0xffd0('0x39')]);_0xdb9da8[_0xffd0('0x3a')]=qs[_0xffd0('0x32')](_[_0xffd0('0x3b')](_0x896a70[_0xffd0('0x31')],_0x3bb309[_0xffd0('0x32')]),_0x5c3be5);if(_0x896a70[_0xffd0('0x31')][_0xffd0('0x3c')]){_0xdb9da8[_0xffd0('0x3a')]=_[_0xffd0('0x3d')](_0xdb9da8[_0xffd0('0x3a')],{'$or':_[_0xffd0('0x3e')](_0x5c3be5,function(_0x2ccb38){if(_0x2ccb38[_0xffd0('0x2e')]!==_0xffd0('0x3f')){var _0x338f04={};_0x338f04[_0x2ccb38['name']]={'$like':'%'+_0x896a70[_0xffd0('0x31')][_0xffd0('0x3c')]+'%'};return _0x338f04;}})});}_0xdb9da8=_[_0xffd0('0x3d')]({},_0xdb9da8,_0x896a70[_0xffd0('0x40')]);var _0x4e06ea={'where':_0xdb9da8['where']};return db[_0xffd0('0x41')][_0xffd0('0x1c')](_0x4e06ea)[_0xffd0('0x24')](function(_0xc0aa){_0x326e8f['count']=_0xc0aa;if(_0x896a70[_0xffd0('0x31')][_0xffd0('0x42')]){_0xdb9da8[_0xffd0('0x43')]=[{'all':!![]}];}return db[_0xffd0('0x41')][_0xffd0('0x44')](_0xdb9da8);})[_0xffd0('0x24')](function(_0x9558c0){_0x326e8f[_0xffd0('0x45')]=_0x9558c0;return _0x326e8f;})[_0xffd0('0x24')](respondWithFilteredResult(_0x3b71ac,_0xdb9da8))[_0xffd0('0x46')](handleError(_0x3b71ac,null));};exports[_0xffd0('0x47')]=function(_0x18ef0b,_0x236c1d){var _0x1f660c={'raw':!![],'where':{'id':_0x18ef0b[_0xffd0('0x48')]['id']}},_0x3a99d5={};_0x3a99d5[_0xffd0('0x2f')]=_[_0xffd0('0x30')](db[_0xffd0('0x41')][_0xffd0('0x2c')]);_0x3a99d5[_0xffd0('0x31')]=_['keys'](_0x18ef0b[_0xffd0('0x31')]);_0x3a99d5[_0xffd0('0x32')]=_[_0xffd0('0x33')](_0x3a99d5[_0xffd0('0x2f')],_0x3a99d5[_0xffd0('0x31')]);_0x1f660c[_0xffd0('0x34')]=_[_0xffd0('0x33')](_0x3a99d5[_0xffd0('0x2f')],qs[_0xffd0('0x35')](_0x18ef0b['query'][_0xffd0('0x35')]));_0x1f660c[_0xffd0('0x34')]=_0x1f660c[_0xffd0('0x34')][_0xffd0('0x36')]?_0x1f660c[_0xffd0('0x34')]:_0x3a99d5['model'];if(_0x18ef0b['query']['includeAll']){_0x1f660c[_0xffd0('0x43')]=[{'all':!![]}];}_0x1f660c=_[_0xffd0('0x3d')]({},_0x1f660c,_0x18ef0b['options']);return db[_0xffd0('0x41')][_0xffd0('0x49')](_0x1f660c)[_0xffd0('0x24')](handleEntityNotFound(_0x236c1d,null))[_0xffd0('0x24')](respondWithResult(_0x236c1d,null))[_0xffd0('0x46')](handleError(_0x236c1d,null));};exports[_0xffd0('0x4a')]=function(_0x3b70a7,_0x2c0ffd){return db[_0xffd0('0x41')][_0xffd0('0x4a')](_0x3b70a7[_0xffd0('0x4b')],{})[_0xffd0('0x24')](function(_0x300a52){var _0x57b453=_0x3b70a7['user'][_0xffd0('0x25')]({'plain':!![]});if(!_0x57b453)throw new Error(_0xffd0('0x4c'));if(_0x57b453[_0xffd0('0x4d')]==='user'){var _0x35b42e=_0x300a52['get']({'plain':!![]});var _0x31c80e=_0xffd0('0x26');return db[_0xffd0('0x4e')][_0xffd0('0x49')]({'where':{'name':_0x31c80e,'userProfileId':_0x57b453['userProfileId']},'raw':!![]})['then'](function(_0x57d072){if(_0x57d072&&_0x57d072[_0xffd0('0x4f')]===0x0){return db[_0xffd0('0x27')][_0xffd0('0x4a')]({'name':_0x35b42e[_0xffd0('0x2a')],'resourceId':_0x35b42e['id'],'type':_0x57d072[_0xffd0('0x2a')],'sectionId':_0x57d072['id']},{})[_0xffd0('0x24')](function(){return _0x300a52;});}else{return _0x300a52;}})[_0xffd0('0x46')](function(_0x4721a6){logger[_0xffd0('0x29')](_0xffd0('0x50'),_0x4721a6);throw _0x4721a6;});}return _0x300a52;})[_0xffd0('0x24')](respondWithResult(_0x2c0ffd,0xc9))[_0xffd0('0x46')](handleError(_0x2c0ffd,null));};exports['update']=function(_0x3ab6dd,_0x1521c9){if(_0x3ab6dd[_0xffd0('0x4b')]['id']){delete _0x3ab6dd[_0xffd0('0x4b')]['id'];}return db[_0xffd0('0x41')][_0xffd0('0x49')]({'where':{'id':_0x3ab6dd[_0xffd0('0x48')]['id']}})['then'](handleEntityNotFound(_0x1521c9,null))[_0xffd0('0x24')](saveUpdates(_0x3ab6dd[_0xffd0('0x4b')],null))[_0xffd0('0x24')](respondWithResult(_0x1521c9,null))[_0xffd0('0x46')](handleError(_0x1521c9,null));};exports['destroy']=function(_0x58acd3,_0x4b863e){return db[_0xffd0('0x41')][_0xffd0('0x49')]({'where':{'id':_0x58acd3[_0xffd0('0x48')]['id']}})[_0xffd0('0x24')](handleEntityNotFound(_0x4b863e,null))[_0xffd0('0x24')](removeEntity(_0x4b863e,null))[_0xffd0('0x46')](handleError(_0x4b863e,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 6f627a2..9359567 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 _0x3f27=['path','exports','define','Disposition','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x10b5c2,_0x2ca0b){var _0x3f9526=function(_0x4a9397){while(--_0x4a9397){_0x10b5c2['push'](_0x10b5c2['shift']());}};_0x3f9526(++_0x2ca0b);}(_0x3f27,0x1f4));var _0x73f2=function(_0x839f88,_0x39e68b){_0x839f88=_0x839f88-0x0;var _0xce5316=_0x3f27[_0x839f88];return _0xce5316;};'use strict';var _=require(_0x73f2('0x0'));var util=require(_0x73f2('0x1'));var logger=require(_0x73f2('0x2'))(_0x73f2('0x3'));var moment=require(_0x73f2('0x4'));var BPromise=require('bluebird');var rp=require(_0x73f2('0x5'));var fs=require('fs');var path=require(_0x73f2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0x73f2('0x7')]=function(_0x54631b,_0x17f054){return _0x54631b[_0x73f2('0x8')](_0x73f2('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x73f2('0xa'),_0x73f2('0xb')]},{'unique':!![],'name':_0x73f2('0xc'),'fields':[_0x73f2('0xa'),_0x73f2('0xd')]},{'unique':!![],'name':_0x73f2('0xe'),'fields':['name',_0x73f2('0xf')]},{'unique':!![],'name':_0x73f2('0x10'),'fields':[_0x73f2('0xa'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':['name',_0x73f2('0x11')]},{'unique':!![],'name':_0x73f2('0x12'),'fields':[_0x73f2('0xa'),_0x73f2('0x13')]},{'unique':!![],'name':_0x73f2('0x14'),'fields':[_0x73f2('0xa'),_0x73f2('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xafa5=['define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports'];(function(_0x3f52cb,_0x22ff7d){var _0x1f151a=function(_0x5d4bb8){while(--_0x5d4bb8){_0x3f52cb['push'](_0x3f52cb['shift']());}};_0x1f151a(++_0x22ff7d);}(_0xafa5,0x1af));var _0x5afa=function(_0x5bea60,_0x1c5008){_0x5bea60=_0x5bea60-0x0;var _0x15d89b=_0xafa5[_0x5bea60];return _0x15d89b;};'use strict';var _=require('lodash');var util=require(_0x5afa('0x0'));var logger=require(_0x5afa('0x1'))(_0x5afa('0x2'));var moment=require(_0x5afa('0x3'));var BPromise=require(_0x5afa('0x4'));var rp=require(_0x5afa('0x5'));var fs=require('fs');var path=require(_0x5afa('0x6'));var rimraf=require(_0x5afa('0x7'));var config=require(_0x5afa('0x8'));var attributes=require(_0x5afa('0x9'));module[_0x5afa('0xa')]=function(_0x58998c,_0x166388){return _0x58998c[_0x5afa('0xb')](_0x5afa('0xc'),attributes,{'tableName':_0x5afa('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x5afa('0xe'),'fields':[_0x5afa('0xf'),_0x5afa('0x10')]},{'unique':!![],'name':_0x5afa('0x11'),'fields':[_0x5afa('0xf'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x5afa('0xf'),_0x5afa('0x12')]},{'unique':!![],'name':_0x5afa('0x13'),'fields':[_0x5afa('0xf'),_0x5afa('0x14')]},{'unique':!![],'name':_0x5afa('0x15'),'fields':[_0x5afa('0xf'),_0x5afa('0x16')]},{'unique':!![],'name':'name_openchannel','fields':[_0x5afa('0xf'),_0x5afa('0x17')]},{'unique':!![],'name':_0x5afa('0x18'),'fields':[_0x5afa('0xf'),_0x5afa('0x19')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 3c9d7f5..1c96059 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 _0x3612=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','Disposition,\x20%s,\x20%s','debug','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x3612,0x102));var _0x2361=function(_0x3074f3,_0x4f2c03){_0x3074f3=_0x3074f3-0x0;var _0x53f112=_0x3612[_0x3074f3];return _0x53f112;};'use strict';var _=require(_0x2361('0x0'));var util=require(_0x2361('0x1'));var moment=require(_0x2361('0x2'));var BPromise=require(_0x2361('0x3'));var rs=require(_0x2361('0x4'));var fs=require('fs');var Redis=require(_0x2361('0x5'));var db=require(_0x2361('0x6'))['db'];var utils=require(_0x2361('0x7'));var logger=require(_0x2361('0x8'))(_0x2361('0x9'));var config=require('../../config/environment');var jayson=require(_0x2361('0xa'));var client=jayson[_0x2361('0xb')][_0x2361('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3365be,_0x4ea06e,_0x175607){return new BPromise(function(_0x439f12,_0x4d4586){return client[_0x2361('0xd')](_0x3365be,_0x175607)['then'](function(_0x5afe8a){logger['info'](_0x2361('0xe'),_0x4ea06e,'request\x20sent');logger[_0x2361('0xf')](_0x2361('0x10'),_0x4ea06e,_0x2361('0x11'),JSON[_0x2361('0x12')](_0x5afe8a));if(_0x5afe8a[_0x2361('0x13')]){if(_0x5afe8a['error'][_0x2361('0x14')]===0x1f4){logger[_0x2361('0x13')](_0x2361('0xe'),_0x4ea06e,_0x5afe8a['error'][_0x2361('0x15')]);return _0x4d4586(_0x5afe8a[_0x2361('0x13')][_0x2361('0x15')]);}logger['error'](_0x2361('0xe'),_0x4ea06e,_0x5afe8a[_0x2361('0x13')][_0x2361('0x15')]);return _0x439f12(_0x5afe8a[_0x2361('0x13')][_0x2361('0x15')]);}else{logger['info'](_0x2361('0xe'),_0x4ea06e,'request\x20sent');_0x439f12(_0x5afe8a[_0x2361('0x16')][_0x2361('0x15')]);}})[_0x2361('0x17')](function(_0x28a720){logger[_0x2361('0x13')](_0x2361('0xe'),_0x4ea06e,_0x28a720);_0x4d4586(_0x28a720);});});} \ No newline at end of file +var _0x7142=['error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','client','http','request','then','Disposition,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x7142,0x181));var _0x2714=function(_0x247b83,_0x166650){_0x247b83=_0x247b83-0x0;var _0x179b6e=_0x7142[_0x247b83];return _0x179b6e;};'use strict';var _=require(_0x2714('0x0'));var util=require(_0x2714('0x1'));var moment=require(_0x2714('0x2'));var BPromise=require(_0x2714('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2714('0x4'));var db=require(_0x2714('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2714('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2714('0x7')][_0x2714('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x588c3b,_0x39b473,_0x5186dd){return new BPromise(function(_0x4a2d11,_0x96a0ae){return client[_0x2714('0x9')](_0x588c3b,_0x5186dd)[_0x2714('0xa')](function(_0x35885a){logger['info'](_0x2714('0xb'),_0x39b473,_0x2714('0xc'));logger['debug']('Disposition,\x20%s,\x20%s,\x20%s',_0x39b473,_0x2714('0xc'),JSON[_0x2714('0xd')](_0x35885a));if(_0x35885a[_0x2714('0xe')]){if(_0x35885a[_0x2714('0xe')][_0x2714('0xf')]===0x1f4){logger[_0x2714('0xe')]('Disposition,\x20%s,\x20%s',_0x39b473,_0x35885a[_0x2714('0xe')][_0x2714('0x10')]);return _0x96a0ae(_0x35885a[_0x2714('0xe')][_0x2714('0x10')]);}logger[_0x2714('0xe')](_0x2714('0xb'),_0x39b473,_0x35885a[_0x2714('0xe')][_0x2714('0x10')]);return _0x4a2d11(_0x35885a[_0x2714('0xe')][_0x2714('0x10')]);}else{logger[_0x2714('0x11')](_0x2714('0xb'),_0x39b473,_0x2714('0xc'));_0x4a2d11(_0x35885a[_0x2714('0x12')][_0x2714('0x10')]);}})['catch'](function(_0x3cc717){logger['error'](_0x2714('0xb'),_0x39b473,_0x3cc717);_0x96a0ae(_0x3cc717);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index ea7e699..509fd77 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 _0x139e=['isAuthenticated','index','get','/:id','create','put','update','delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x7974e0,_0x3a7447){var _0x24c210=function(_0x179cca){while(--_0x179cca){_0x7974e0['push'](_0x7974e0['shift']());}};_0x24c210(++_0x3a7447);}(_0x139e,0x1d8));var _0xe139=function(_0x354a09,_0x4c7fee){_0x354a09=_0x354a09-0x0;var _0x3dfef5=_0x139e[_0x354a09];return _0x3dfef5;};'use strict';var multer=require(_0xe139('0x0'));var util=require(_0xe139('0x1'));var path=require(_0xe139('0x2'));var timeout=require(_0xe139('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe139('0x4'));var auth=require(_0xe139('0x5'));var interaction=require(_0xe139('0x6'));var config=require(_0xe139('0x7'));var controller=require('./disposition.controller');router['get']('/',auth[_0xe139('0x8')](),controller[_0xe139('0x9')]);router[_0xe139('0xa')](_0xe139('0xb'),auth[_0xe139('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xe139('0xc')]);router[_0xe139('0xd')]('/:id',auth[_0xe139('0x8')](),controller[_0xe139('0xe')]);router[_0xe139('0xf')](_0xe139('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x763c=['isAuthenticated','get','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller'];(function(_0x1a8755,_0x2f4259){var _0x4b4599=function(_0xb749e3){while(--_0xb749e3){_0x1a8755['push'](_0x1a8755['shift']());}};_0x4b4599(++_0x2f4259);}(_0x763c,0x172));var _0xc763=function(_0x3ecc36,_0x30e780){_0x3ecc36=_0x3ecc36-0x0;var _0x57816f=_0x763c[_0x3ecc36];return _0x57816f;};'use strict';var multer=require(_0xc763('0x0'));var util=require(_0xc763('0x1'));var path=require(_0xc763('0x2'));var timeout=require(_0xc763('0x3'));var express=require('express');var router=express[_0xc763('0x4')]();var fs_extra=require(_0xc763('0x5'));var auth=require(_0xc763('0x6'));var interaction=require(_0xc763('0x7'));var config=require(_0xc763('0x8'));var controller=require(_0xc763('0x9'));router['get']('/',auth[_0xc763('0xa')](),controller['index']);router[_0xc763('0xb')](_0xc763('0xc'),auth[_0xc763('0xa')](),controller[_0xc763('0xd')]);router[_0xc763('0xe')]('/',auth[_0xc763('0xa')](),controller[_0xc763('0xf')]);router[_0xc763('0x10')](_0xc763('0xc'),auth[_0xc763('0xa')](),controller[_0xc763('0x11')]);router[_0xc763('0x12')]('/:id',auth[_0xc763('0xa')](),controller['destroy']);module[_0xc763('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index df7fa66..594f416 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 _0xc9b1=['2400','4800','7200','9600','12000','14400','IAX','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid'];(function(_0x2b92cb,_0x1676ae){var _0x290b76=function(_0x5d7b13){while(--_0x5d7b13){_0x2b92cb['push'](_0x2b92cb['shift']());}};_0x290b76(++_0x1676ae);}(_0xc9b1,0x101));var _0x1c9b=function(_0x29913c,_0x5e59da){_0x29913c=_0x29913c-0x0;var _0x2b9769=_0xc9b1[_0x29913c];return _0x2b9769;};'use strict';var Sequelize=require(_0x1c9b('0x0'));module[_0x1c9b('0x1')]={'name':{'type':Sequelize[_0x1c9b('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x1c9b('0x3')](_0x1c9b('0x4'),'no'),'defaultValue':_0x1c9b('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x1c9b('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x1c9b('0x6')},'minrate':{'type':Sequelize[_0x1c9b('0x3')](_0x1c9b('0x7'),_0x1c9b('0x8'),_0x1c9b('0x9'),_0x1c9b('0xa'),_0x1c9b('0xb'),'14400'),'defaultValue':_0x1c9b('0x8')},'maxrate':{'type':Sequelize[_0x1c9b('0x3')](_0x1c9b('0x7'),_0x1c9b('0x8'),_0x1c9b('0x9'),'9600',_0x1c9b('0xb'),'14400'),'defaultValue':_0x1c9b('0xc')},'modem':{'type':Sequelize[_0x1c9b('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x1c9b('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x1c9b('0x3')]('SIP',_0x1c9b('0xd'),'DADHI',_0x1c9b('0xe')),'defaultValue':_0x1c9b('0xf')},'key':{'type':Sequelize[_0x1c9b('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1c9b('0x10')],'defaultValue':function(){return _0x1c9b('0x11');}},'notificationSound':{'type':Sequelize[_0x1c9b('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1c9b('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1c9b('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1c9b('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1c9b('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1c9b('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1c9b('0x13')],'allowNull':!![],'defaultValue':null,'comment':_0x1c9b('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x1c9b('0x12')],'defaultValue':![],'comment':_0x1c9b('0x15'),'set':function(_0x433091){if(!_0x433091)this[_0x1c9b('0x16')](_0x1c9b('0x17'),null);this[_0x1c9b('0x16')]('mandatoryDisposition',_0x433091);}}}; \ No newline at end of file +var _0x4777=['BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','yes','localstationid','2400','4800','9600','12000','14400','7200','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x49d610,_0x3b14e2){var _0x4c6a73=function(_0x2f3215){while(--_0x2f3215){_0x49d610['push'](_0x49d610['shift']());}};_0x4c6a73(++_0x3b14e2);}(_0x4777,0xd4));var _0x7477=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x4777[_0x1a8f86];return _0x20d876;};'use strict';var Sequelize=require(_0x7477('0x0'));module['exports']={'name':{'type':Sequelize[_0x7477('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7477('0x1')]},'ecm':{'type':Sequelize[_0x7477('0x2')](_0x7477('0x3'),'no'),'defaultValue':_0x7477('0x3')},'headerinfo':{'type':Sequelize[_0x7477('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x7477('0x1')],'unique':_0x7477('0x4')},'minrate':{'type':Sequelize[_0x7477('0x2')](_0x7477('0x5'),_0x7477('0x6'),'7200',_0x7477('0x7'),_0x7477('0x8'),_0x7477('0x9')),'defaultValue':_0x7477('0x6')},'maxrate':{'type':Sequelize[_0x7477('0x2')](_0x7477('0x5'),'4800',_0x7477('0xa'),_0x7477('0x7'),_0x7477('0x8'),_0x7477('0x9')),'defaultValue':_0x7477('0x9')},'modem':{'type':Sequelize[_0x7477('0x1')],'defaultValue':_0x7477('0xb')},'gateway':{'type':Sequelize[_0x7477('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x7477('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x7477('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x7477('0x2')](_0x7477('0xd'),_0x7477('0xe'),_0x7477('0xf'),_0x7477('0x10')),'defaultValue':_0x7477('0xd')},'key':{'type':Sequelize[_0x7477('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7477('0x11');}},'notificationSound':{'type':Sequelize[_0x7477('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7477('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7477('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7477('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7477('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7477('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7477('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x7477('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x7477('0x12')],'defaultValue':![],'comment':_0x7477('0x14'),'set':function(_0x4e2372){if(!_0x4e2372)this[_0x7477('0x15')]('mandatoryDispositionPauseId',null);this[_0x7477('0x15')](_0x7477('0x16'),_0x4e2372);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index a942f66..42719d3 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 _0xe545=['headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updatedAt','ListId','findById','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','findAll','catch','show','params','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','FaxAccountId','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','nolimit','removeAnswers','FaxInteraction','omit','getInteractions','CmContact','Contact','internal','color','tag','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','FaxApplication','context','from-voip-provider','localstationid','system','description','Fax\x20Extension','priority','push','CDR(type)=inbound-fax','Set','faxdetect'];(function(_0x4ed37d,_0x1a84c9){var _0x4fb2c5=function(_0x5c9013){while(--_0x5c9013){_0x4ed37d['push'](_0x4ed37d['shift']());}};_0x4fb2c5(++_0x1a84c9);}(_0xe545,0xeb));var _0x5e54=function(_0x49277e,_0x5c2b7c){_0x49277e=_0x49277e-0x0;var _0x5ea0e3=_0xe545[_0x49277e];return _0x5ea0e3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5e54('0x0'));var rp=require(_0x5e54('0x1'));var moment=require(_0x5e54('0x2'));var BPromise=require(_0x5e54('0x3'));var Mustache=require('mustache');var util=require(_0x5e54('0x4'));var path=require(_0x5e54('0x5'));var sox=require(_0x5e54('0x6'));var csv=require(_0x5e54('0x7'));var ejs=require(_0x5e54('0x8'));var fs=require('fs');var fs_extra=require(_0x5e54('0x9'));var _=require('lodash');var squel=require(_0x5e54('0xa'));var crypto=require(_0x5e54('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5e54('0x7'));var querystring=require(_0x5e54('0xc'));var Papa=require('papaparse');var Redis=require(_0x5e54('0xd'));var authService=require(_0x5e54('0xe'));var qs=require(_0x5e54('0xf'));var as=require(_0x5e54('0x10'));var hardwareService=require(_0x5e54('0x11'));var logger=require(_0x5e54('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x5e54('0x13'));var licenseUtil=require(_0x5e54('0x14'));var db=require(_0x5e54('0x15'))['db'];config['redis']=_[_0x5e54('0x16')](config[_0x5e54('0x17')],{'host':_0x5e54('0x18'),'port':0x18eb});var socket=require(_0x5e54('0x19'))(new Redis(config[_0x5e54('0x17')]));require(_0x5e54('0x1a'))[_0x5e54('0x1b')](socket);var jayson=require(_0x5e54('0x1c'));var client=jayson[_0x5e54('0x1d')][_0x5e54('0x1e')]({'port':0x232c});var client9002=jayson[_0x5e54('0x1d')][_0x5e54('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x10454f,_0x4fa16a,_0x43f951,_0x50f233){return new BPromise(function(_0x833351,_0x1947cb){var _0x2375af=_0x50f233||client;return _0x2375af['request'](_0x10454f,_0x43f951)[_0x5e54('0x1f')](function(_0x434993){logger[_0x5e54('0x20')](_0x5e54('0x21'),_0x4fa16a,_0x5e54('0x22'));logger['debug'](_0x5e54('0x23'),_0x4fa16a,'request\x20sent',JSON[_0x5e54('0x24')](_0x434993));if(_0x434993[_0x5e54('0x25')]){if(_0x434993[_0x5e54('0x25')][_0x5e54('0x26')]===0x1f4){logger[_0x5e54('0x25')](_0x5e54('0x21'),_0x4fa16a,_0x434993['error'][_0x5e54('0x27')]);return _0x1947cb(_0x434993['error']['message']);}logger[_0x5e54('0x25')](_0x5e54('0x21'),_0x4fa16a,_0x434993[_0x5e54('0x25')][_0x5e54('0x27')]);return _0x833351(_0x434993['error'][_0x5e54('0x27')]);}else{logger[_0x5e54('0x20')](_0x5e54('0x21'),_0x4fa16a,'request\x20sent');_0x833351(_0x434993['result'][_0x5e54('0x27')]);}})['catch'](function(_0xd0d881){logger[_0x5e54('0x25')]('FaxAccount,\x20%s,\x20%s',_0x4fa16a,_0xd0d881);_0x1947cb(_0xd0d881);});});}function respondWithStatusCode(_0x3302dc,_0x586ecb){_0x586ecb=_0x586ecb||0xcc;return function(_0x4ac825){if(_0x4ac825){return _0x3302dc['sendStatus'](_0x586ecb);}return _0x3302dc['status'](_0x586ecb)['end']();};}function respondWithResult(_0x44aa92,_0x33e3ba){_0x33e3ba=_0x33e3ba||0xc8;return function(_0x40c0bf){if(_0x40c0bf){return _0x44aa92['status'](_0x33e3ba)[_0x5e54('0x28')](_0x40c0bf);}};}function respondWithFilteredResult(_0x2c3462,_0x57b7dc){return function(_0x4874f5){if(_0x4874f5){var _0x13778a=typeof _0x57b7dc[_0x5e54('0x29')]===_0x5e54('0x2a')&&typeof _0x57b7dc[_0x5e54('0x2b')]===_0x5e54('0x2a');var _0x2655e7=_0x4874f5[_0x5e54('0x2c')];var _0x2ae97d=_0x13778a?0x0:_0x57b7dc[_0x5e54('0x29')];var _0x32093f=_0x13778a?_0x4874f5[_0x5e54('0x2c')]:_0x57b7dc[_0x5e54('0x29')]+_0x57b7dc[_0x5e54('0x2b')];var _0x17f2f9;if(_0x32093f>=_0x2655e7){_0x32093f=_0x2655e7;_0x17f2f9=0xc8;}else{_0x17f2f9=0xce;}_0x2c3462[_0x5e54('0x2d')](_0x17f2f9);return _0x2c3462[_0x5e54('0x2e')](_0x5e54('0x2f'),_0x2ae97d+'-'+_0x32093f+'/'+_0x2655e7)[_0x5e54('0x28')](_0x4874f5);}return null;};}function patchUpdates(_0x526c67){return function(_0x544c01){try{jsonpatch[_0x5e54('0x30')](_0x544c01,_0x526c67,!![]);}catch(_0xf85cab){return BPromise['reject'](_0xf85cab);}return _0x544c01[_0x5e54('0x31')]();};}function saveUpdates(_0x513a3e,_0x32d88f){return function(_0x32ec7c){if(_0x32ec7c){return _0x32ec7c[_0x5e54('0x32')](_0x513a3e)[_0x5e54('0x1f')](function(_0xfb8407){return _0xfb8407;});}return null;};}function removeEntity(_0x3f1c44,_0xab4b8){return function(_0x3cb0ab){if(_0x3cb0ab){return _0x3cb0ab[_0x5e54('0x33')]()[_0x5e54('0x1f')](function(){var _0x286cbf=_0x3cb0ab[_0x5e54('0x34')]({'plain':!![]});var _0x2dbaa5=_0x5e54('0x35');return db[_0x5e54('0x36')][_0x5e54('0x33')]({'where':{'type':_0x2dbaa5,'resourceId':_0x286cbf['id']}})[_0x5e54('0x1f')](function(){return _0x3cb0ab;});})[_0x5e54('0x1f')](function(){_0x3f1c44[_0x5e54('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb4b60b,_0x449987){return function(_0x24729c){if(!_0x24729c){_0xb4b60b[_0x5e54('0x37')](0x194);}return _0x24729c;};}function handleError(_0x37ca81,_0x5f50bd){_0x5f50bd=_0x5f50bd||0x1f4;return function(_0x331689){logger[_0x5e54('0x25')](_0x331689[_0x5e54('0x38')]);if(_0x331689[_0x5e54('0x39')]){delete _0x331689[_0x5e54('0x39')];}_0x37ca81[_0x5e54('0x2d')](_0x5f50bd)[_0x5e54('0x3a')](_0x331689);};}exports[_0x5e54('0x3b')]=function(_0x485733,_0x4cc40f){var _0x4bebc4={'include':[{'model':db[_0x5e54('0x3c')],'as':_0x5e54('0x3d')}]},_0x56c4d8={},_0x266b6f={'count':0x0,'rows':[]};var _0x53636a=_[_0x5e54('0x3e')](db[_0x5e54('0x3f')][_0x5e54('0x40')],function(_0x585e66){return{'name':_0x585e66[_0x5e54('0x41')],'type':_0x585e66[_0x5e54('0x42')][_0x5e54('0x43')]};});_0x56c4d8[_0x5e54('0x44')]=_[_0x5e54('0x3e')](_0x53636a,_0x5e54('0x39'));_0x56c4d8[_0x5e54('0x45')]=_[_0x5e54('0x46')](_0x485733[_0x5e54('0x45')]);_0x56c4d8['filters']=_[_0x5e54('0x47')](_0x56c4d8[_0x5e54('0x44')],_0x56c4d8[_0x5e54('0x45')]);_0x4bebc4[_0x5e54('0x48')]=_[_0x5e54('0x47')](_0x56c4d8['model'],qs[_0x5e54('0x49')](_0x485733[_0x5e54('0x45')][_0x5e54('0x49')]));_0x4bebc4['attributes']=_0x4bebc4[_0x5e54('0x48')][_0x5e54('0x4a')]?_0x4bebc4['attributes']:_0x56c4d8[_0x5e54('0x44')];if(!_0x485733[_0x5e54('0x45')][_0x5e54('0x4b')]('nolimit')){_0x4bebc4[_0x5e54('0x2b')]=qs[_0x5e54('0x2b')](_0x485733[_0x5e54('0x45')][_0x5e54('0x2b')]);_0x4bebc4[_0x5e54('0x29')]=qs[_0x5e54('0x29')](_0x485733['query'][_0x5e54('0x29')]);}_0x4bebc4[_0x5e54('0x4c')]=qs[_0x5e54('0x4d')](_0x485733[_0x5e54('0x45')][_0x5e54('0x4d')]);_0x4bebc4[_0x5e54('0x4e')]=qs['filters'](_[_0x5e54('0x4f')](_0x485733[_0x5e54('0x45')],_0x56c4d8[_0x5e54('0x50')]),_0x53636a);if(_0x485733['query'][_0x5e54('0x51')]){_0x4bebc4[_0x5e54('0x4e')]=_[_0x5e54('0x52')](_0x4bebc4['where'],{'$or':_[_0x5e54('0x3e')](_0x53636a,function(_0x16d562){if(_0x16d562[_0x5e54('0x42')]!==_0x5e54('0x53')){var _0xe2e6c7={};_0xe2e6c7[_0x16d562[_0x5e54('0x39')]]={'$like':'%'+_0x485733[_0x5e54('0x45')]['filter']+'%'};return _0xe2e6c7;}})});}_0x4bebc4=_[_0x5e54('0x52')]({},_0x4bebc4,_0x485733[_0x5e54('0x54')]);var _0x33e38c={'where':_0x4bebc4['where']};return db['FaxAccount'][_0x5e54('0x2c')](_0x33e38c)[_0x5e54('0x1f')](function(_0x54e0e6){_0x266b6f['count']=_0x54e0e6;if(_0x485733[_0x5e54('0x45')]['includeAll']){_0x4bebc4['include']=[{'all':!![]}];}return db[_0x5e54('0x3f')][_0x5e54('0x55')](_0x4bebc4);})['then'](function(_0x30bbbc){_0x266b6f['rows']=_0x30bbbc;return _0x266b6f;})[_0x5e54('0x1f')](respondWithFilteredResult(_0x4cc40f,_0x4bebc4))[_0x5e54('0x56')](handleError(_0x4cc40f,null));};exports[_0x5e54('0x57')]=function(_0x524a34,_0xc1f5f9){var _0x77d257={'raw':![],'where':{'id':_0x524a34[_0x5e54('0x58')]['id']},'include':[{'model':db[_0x5e54('0x3c')],'as':_0x5e54('0x3d')}]},_0x465c96={};_0x465c96[_0x5e54('0x44')]=_[_0x5e54('0x46')](db[_0x5e54('0x3f')][_0x5e54('0x40')]);_0x465c96[_0x5e54('0x45')]=_[_0x5e54('0x46')](_0x524a34['query']);_0x465c96['filters']=_['intersection'](_0x465c96[_0x5e54('0x44')],_0x465c96[_0x5e54('0x45')]);_0x77d257['attributes']=_[_0x5e54('0x47')](_0x465c96['model'],qs[_0x5e54('0x49')](_0x524a34['query']['fields']));_0x77d257['attributes']=_0x77d257[_0x5e54('0x48')][_0x5e54('0x4a')]?_0x77d257['attributes']:_0x465c96[_0x5e54('0x44')];if(_0x524a34['query'][_0x5e54('0x59')]){_0x77d257[_0x5e54('0x5a')]=[{'all':!![]}];}_0x77d257=_['merge']({},_0x77d257,_0x524a34[_0x5e54('0x54')]);return db[_0x5e54('0x3f')][_0x5e54('0x5b')](_0x77d257)['then'](handleEntityNotFound(_0xc1f5f9,null))[_0x5e54('0x1f')](respondWithResult(_0xc1f5f9,null))[_0x5e54('0x56')](handleError(_0xc1f5f9,null));};exports['create']=function(_0x25635b,_0x37d17a){return db[_0x5e54('0x3f')][_0x5e54('0x5c')](_0x25635b[_0x5e54('0x5d')],{})[_0x5e54('0x1f')](function(_0x337fdd){var _0x1b363d=_0x25635b[_0x5e54('0x5e')][_0x5e54('0x34')]({'plain':!![]});if(!_0x1b363d)throw new Error(_0x5e54('0x5f'));if(_0x1b363d['role']===_0x5e54('0x5e')){var _0x430d58=_0x337fdd[_0x5e54('0x34')]({'plain':!![]});var _0x202a15=_0x5e54('0x35');return db[_0x5e54('0x60')][_0x5e54('0x5b')]({'where':{'name':_0x202a15,'userProfileId':_0x1b363d[_0x5e54('0x61')]},'raw':!![]})[_0x5e54('0x1f')](function(_0x3061cf){if(_0x3061cf&&_0x3061cf[_0x5e54('0x62')]===0x0){return db[_0x5e54('0x36')][_0x5e54('0x5c')]({'name':_0x430d58['name'],'resourceId':_0x430d58['id'],'type':_0x3061cf[_0x5e54('0x39')],'sectionId':_0x3061cf['id']},{})[_0x5e54('0x1f')](function(){return _0x337fdd;});}else{return _0x337fdd;}})[_0x5e54('0x56')](function(_0x32b455){logger[_0x5e54('0x25')](_0x5e54('0x63'),_0x32b455);throw _0x32b455;});}return _0x337fdd;})[_0x5e54('0x1f')](respondWithResult(_0x37d17a,0xc9))[_0x5e54('0x56')](handleError(_0x37d17a,null));};exports[_0x5e54('0x32')]=function(_0x3b6b8e,_0x1671f7){if(_0x3b6b8e['body']['id']){delete _0x3b6b8e[_0x5e54('0x5d')]['id'];}return db[_0x5e54('0x3f')][_0x5e54('0x5b')]({'where':{'id':_0x3b6b8e[_0x5e54('0x58')]['id']},'include':[{'model':db[_0x5e54('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x5e54('0x1f')](handleEntityNotFound(_0x1671f7,null))[_0x5e54('0x1f')](saveUpdates(_0x3b6b8e['body'],null))[_0x5e54('0x1f')](respondWithResult(_0x1671f7,null))[_0x5e54('0x56')](handleError(_0x1671f7,null));};exports[_0x5e54('0x33')]=function(_0x1cafae,_0xbb7740){return db[_0x5e54('0x3f')][_0x5e54('0x5b')]({'where':{'id':_0x1cafae[_0x5e54('0x58')]['id']}})[_0x5e54('0x1f')](handleEntityNotFound(_0xbb7740,null))[_0x5e54('0x1f')](removeEntity(_0xbb7740,null))[_0x5e54('0x56')](handleError(_0xbb7740,null));};exports[_0x5e54('0x64')]=function(_0x51d581,_0xb2261c){return db[_0x5e54('0x3f')][_0x5e54('0x64')]()[_0x5e54('0x1f')](respondWithResult(_0xb2261c,null))['catch'](handleError(_0xb2261c,null));};exports[_0x5e54('0x65')]=function(_0x124e33,_0x4dec43,_0x59963a){if(_0x124e33[_0x5e54('0x5d')]['id']){delete _0x124e33[_0x5e54('0x5d')]['id'];}return db[_0x5e54('0x3f')][_0x5e54('0x5b')]({'where':{'id':_0x124e33[_0x5e54('0x58')]['id']}})[_0x5e54('0x1f')](handleEntityNotFound(_0x4dec43,null))[_0x5e54('0x1f')](function(_0x114692){if(_0x114692){_0x124e33[_0x5e54('0x5d')]['FaxAccountId']=_0x114692['id'];return db[_0x5e54('0x66')][_0x5e54('0x5c')](_0x124e33[_0x5e54('0x5d')]);}})[_0x5e54('0x1f')](respondWithResult(_0x4dec43,null))[_0x5e54('0x56')](handleError(_0x4dec43,null));};exports['getDispositions']=function(_0x42e43b,_0x53323b,_0x57deeb){var _0x523915={'raw':![],'where':{}};var _0x45b815={};var _0x3b769f={'count':0x0,'rows':[]};return db[_0x5e54('0x3f')]['findOne']({'where':{'id':_0x42e43b['params']['id']}})[_0x5e54('0x1f')](handleEntityNotFound(_0x53323b,null))[_0x5e54('0x1f')](function(_0x13c2c5){if(_0x13c2c5){_0x45b815[_0x5e54('0x44')]=_[_0x5e54('0x46')](db[_0x5e54('0x66')]['rawAttributes']);_0x45b815[_0x5e54('0x45')]=_[_0x5e54('0x46')](_0x42e43b['query']);_0x45b815['filters']=_[_0x5e54('0x47')](_0x45b815[_0x5e54('0x44')],_0x45b815['query']);_0x523915[_0x5e54('0x48')]=_[_0x5e54('0x47')](_0x45b815[_0x5e54('0x44')],qs['fields'](_0x42e43b[_0x5e54('0x45')][_0x5e54('0x49')]));_0x523915['attributes']=_0x523915[_0x5e54('0x48')][_0x5e54('0x4a')]?_0x523915['attributes']:_0x45b815['model'];if(!_0x42e43b[_0x5e54('0x45')][_0x5e54('0x4b')]('nolimit')){_0x523915[_0x5e54('0x2b')]=qs[_0x5e54('0x2b')](_0x42e43b[_0x5e54('0x45')][_0x5e54('0x2b')]);_0x523915[_0x5e54('0x29')]=qs[_0x5e54('0x29')](_0x42e43b[_0x5e54('0x45')][_0x5e54('0x29')]);}_0x523915['order']=qs['sort'](_0x42e43b[_0x5e54('0x45')][_0x5e54('0x4d')]);_0x523915[_0x5e54('0x4e')]=qs[_0x5e54('0x50')](_[_0x5e54('0x4f')](_0x42e43b[_0x5e54('0x45')],_0x45b815['filters']));_0x523915[_0x5e54('0x4e')][_0x5e54('0x67')]=_0x13c2c5['id'];if(_0x42e43b[_0x5e54('0x45')][_0x5e54('0x51')]){_0x523915[_0x5e54('0x4e')]=_[_0x5e54('0x52')](_0x523915[_0x5e54('0x4e')],{'$or':_[_0x5e54('0x3e')](_0x523915['attributes'],function(_0x1df6cd){var _0x329afe={};_0x329afe[_0x1df6cd]={'$like':'%'+_0x42e43b[_0x5e54('0x45')][_0x5e54('0x51')]+'%'};return _0x329afe;})});}_0x523915=_['merge']({},_0x523915,_0x42e43b[_0x5e54('0x54')]);return db['Disposition'][_0x5e54('0x2c')]({'where':_0x523915['where']})[_0x5e54('0x1f')](function(_0x4931b6){_0x3b769f['count']=_0x4931b6;if(_0x42e43b[_0x5e54('0x45')][_0x5e54('0x59')]){_0x523915[_0x5e54('0x5a')]=[{'all':!![]}];}return db[_0x5e54('0x66')][_0x5e54('0x55')](_0x523915);})[_0x5e54('0x1f')](function(_0x4652e9){_0x3b769f[_0x5e54('0x68')]=_0x4652e9;return _0x3b769f;});}})['then'](respondWithFilteredResult(_0x53323b,_0x523915))[_0x5e54('0x56')](handleError(_0x53323b,null));};exports[_0x5e54('0x69')]=function(_0x7ed763,_0x12e4c9,_0x321170){return db['FaxAccount'][_0x5e54('0x5b')]({'where':{'id':_0x7ed763[_0x5e54('0x58')]['id']}})[_0x5e54('0x1f')](handleEntityNotFound(_0x12e4c9,null))[_0x5e54('0x1f')](function(_0x1e670f){if(_0x1e670f){return _0x1e670f['removeDispositions'](_0x7ed763[_0x5e54('0x45')][_0x5e54('0x6a')]);}})['then'](respondWithStatusCode(_0x12e4c9,null))['catch'](handleError(_0x12e4c9,null));};exports[_0x5e54('0x6b')]=function(_0x4630c3,_0x15ee9b,_0x3f403c){if(_0x4630c3['body']['id']){delete _0x4630c3[_0x5e54('0x5d')]['id'];}return db[_0x5e54('0x3f')][_0x5e54('0x5b')]({'where':{'id':_0x4630c3[_0x5e54('0x58')]['id']}})[_0x5e54('0x1f')](handleEntityNotFound(_0x15ee9b,null))[_0x5e54('0x1f')](function(_0x5f3711){if(_0x5f3711){_0x4630c3[_0x5e54('0x5d')][_0x5e54('0x67')]=_0x5f3711['id'];return db[_0x5e54('0x6c')][_0x5e54('0x5c')](_0x4630c3['body']);}})[_0x5e54('0x1f')](respondWithResult(_0x15ee9b,null))['catch'](handleError(_0x15ee9b,null));};exports[_0x5e54('0x6d')]=function(_0x373b12,_0x1936ae,_0x482499){var _0x44a785={'raw':![],'where':{}};var _0x2e5410={};var _0x408da1={'count':0x0,'rows':[]};return db[_0x5e54('0x3f')][_0x5e54('0x6e')]({'where':{'id':_0x373b12[_0x5e54('0x58')]['id']}})[_0x5e54('0x1f')](handleEntityNotFound(_0x1936ae,null))[_0x5e54('0x1f')](function(_0xdb0ca){if(_0xdb0ca){_0x2e5410[_0x5e54('0x44')]=_[_0x5e54('0x46')](db[_0x5e54('0x6c')]['rawAttributes']);_0x2e5410[_0x5e54('0x45')]=_['keys'](_0x373b12[_0x5e54('0x45')]);_0x2e5410[_0x5e54('0x50')]=_[_0x5e54('0x47')](_0x2e5410['model'],_0x2e5410[_0x5e54('0x45')]);_0x44a785[_0x5e54('0x48')]=_[_0x5e54('0x47')](_0x2e5410[_0x5e54('0x44')],qs['fields'](_0x373b12[_0x5e54('0x45')][_0x5e54('0x49')]));_0x44a785[_0x5e54('0x48')]=_0x44a785[_0x5e54('0x48')][_0x5e54('0x4a')]?_0x44a785[_0x5e54('0x48')]:_0x2e5410['model'];if(!_0x373b12['query'][_0x5e54('0x4b')](_0x5e54('0x6f'))){_0x44a785[_0x5e54('0x2b')]=qs[_0x5e54('0x2b')](_0x373b12[_0x5e54('0x45')][_0x5e54('0x2b')]);_0x44a785[_0x5e54('0x29')]=qs['offset'](_0x373b12['query'][_0x5e54('0x29')]);}_0x44a785[_0x5e54('0x4c')]=qs[_0x5e54('0x4d')](_0x373b12[_0x5e54('0x45')][_0x5e54('0x4d')]);_0x44a785[_0x5e54('0x4e')]=qs[_0x5e54('0x50')](_[_0x5e54('0x4f')](_0x373b12['query'],_0x2e5410[_0x5e54('0x50')]));_0x44a785[_0x5e54('0x4e')][_0x5e54('0x67')]=_0xdb0ca['id'];if(_0x373b12[_0x5e54('0x45')][_0x5e54('0x51')]){_0x44a785[_0x5e54('0x4e')]=_[_0x5e54('0x52')](_0x44a785[_0x5e54('0x4e')],{'$or':_[_0x5e54('0x3e')](_0x44a785[_0x5e54('0x48')],function(_0x1e874a){var _0x262b7f={};_0x262b7f[_0x1e874a]={'$like':'%'+_0x373b12[_0x5e54('0x45')][_0x5e54('0x51')]+'%'};return _0x262b7f;})});}_0x44a785=_[_0x5e54('0x52')]({},_0x44a785,_0x373b12[_0x5e54('0x54')]);return db[_0x5e54('0x6c')][_0x5e54('0x2c')]({'where':_0x44a785[_0x5e54('0x4e')]})[_0x5e54('0x1f')](function(_0x22dee2){_0x408da1['count']=_0x22dee2;if(_0x373b12[_0x5e54('0x45')]['includeAll']){_0x44a785[_0x5e54('0x5a')]=[{'all':!![]}];}return db[_0x5e54('0x6c')][_0x5e54('0x55')](_0x44a785);})[_0x5e54('0x1f')](function(_0x6e72d9){_0x408da1[_0x5e54('0x68')]=_0x6e72d9;return _0x408da1;});}})['then'](respondWithFilteredResult(_0x1936ae,_0x44a785))[_0x5e54('0x56')](handleError(_0x1936ae,null));};exports[_0x5e54('0x70')]=function(_0x548de3,_0x23b545,_0xcdf562){return db[_0x5e54('0x3f')][_0x5e54('0x5b')]({'where':{'id':_0x548de3[_0x5e54('0x58')]['id']}})[_0x5e54('0x1f')](handleEntityNotFound(_0x23b545,null))[_0x5e54('0x1f')](function(_0x28a127){if(_0x28a127){return _0x28a127[_0x5e54('0x70')](_0x548de3[_0x5e54('0x45')][_0x5e54('0x6a')]);}})[_0x5e54('0x1f')](respondWithStatusCode(_0x23b545,null))['catch'](handleError(_0x23b545,null));};exports['addInteraction']=function(_0x23c32b,_0x313285,_0x455541){return db[_0x5e54('0x71')][_0x5e54('0x5b')]({'where':{'id':_0x23c32b[_0x5e54('0x58')]['id']}})[_0x5e54('0x1f')](handleEntityNotFound(_0x313285,null))[_0x5e54('0x1f')](function(_0x247aab){if(_0x247aab){return _0x247aab['addInteraction'](_0x23c32b['body'][_0x5e54('0x6a')],_[_0x5e54('0x72')](_0x23c32b[_0x5e54('0x5d')],[_0x5e54('0x6a'),'id'])||{});}})[_0x5e54('0x1f')](respondWithResult(_0x313285,null))['catch'](handleError(_0x313285,null));};exports[_0x5e54('0x73')]=function(_0x2e8a18,_0x108a3e,_0x48eb63){var _0x7296b8={'raw':![],'where':{}};var _0x5c7433={};var _0x46ad62={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x2e8a18[_0x5e54('0x58')]['id']}})[_0x5e54('0x1f')](handleEntityNotFound(_0x108a3e,null))[_0x5e54('0x1f')](function(_0x400f62){if(_0x400f62){_0x5c7433['model']=_[_0x5e54('0x46')](db['FaxInteraction']['rawAttributes']);_0x5c7433['query']=_[_0x5e54('0x46')](_0x2e8a18[_0x5e54('0x45')]);_0x5c7433[_0x5e54('0x50')]=_[_0x5e54('0x47')](_0x5c7433[_0x5e54('0x44')],_0x5c7433['query']);_0x7296b8[_0x5e54('0x48')]=_[_0x5e54('0x47')](_0x5c7433[_0x5e54('0x44')],qs[_0x5e54('0x49')](_0x2e8a18[_0x5e54('0x45')][_0x5e54('0x49')]));_0x7296b8['attributes']=_0x7296b8[_0x5e54('0x48')][_0x5e54('0x4a')]?_0x7296b8[_0x5e54('0x48')]:_0x5c7433[_0x5e54('0x44')];if(!_0x2e8a18['query'][_0x5e54('0x4b')]('nolimit')){_0x7296b8[_0x5e54('0x2b')]=qs[_0x5e54('0x2b')](_0x2e8a18['query'][_0x5e54('0x2b')]);_0x7296b8[_0x5e54('0x29')]=qs[_0x5e54('0x29')](_0x2e8a18['query'][_0x5e54('0x29')]);}_0x7296b8[_0x5e54('0x4c')]=qs[_0x5e54('0x4d')](_0x2e8a18['query'][_0x5e54('0x4d')]);_0x7296b8[_0x5e54('0x4e')]=qs[_0x5e54('0x50')](_['pick'](_0x2e8a18[_0x5e54('0x45')],_0x5c7433['filters']));_0x7296b8[_0x5e54('0x4e')]['FaxAccountId']=_0x400f62['id'];if(_0x2e8a18[_0x5e54('0x45')]['filter']){_0x7296b8[_0x5e54('0x4e')]=_[_0x5e54('0x52')](_0x7296b8[_0x5e54('0x4e')],{'$or':_[_0x5e54('0x3e')](_0x7296b8[_0x5e54('0x48')],function(_0x501abe){var _0x232b95={};_0x232b95[_0x501abe]={'$like':'%'+_0x2e8a18[_0x5e54('0x45')][_0x5e54('0x51')]+'%'};return _0x232b95;})});}_0x7296b8=_[_0x5e54('0x52')]({},_0x7296b8,_0x2e8a18[_0x5e54('0x54')]);return db[_0x5e54('0x71')][_0x5e54('0x2c')]({'where':_0x7296b8[_0x5e54('0x4e')]})[_0x5e54('0x1f')](function(_0x3995be){_0x46ad62['count']=_0x3995be;if(_0x2e8a18['query'][_0x5e54('0x59')]){_0x7296b8[_0x5e54('0x5a')]=[{'model':db[_0x5e54('0x74')],'as':_0x5e54('0x75'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x5e54('0x39'),'fullname',_0x5e54('0x76')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x5e54('0x39'),_0x5e54('0x77')],'where':_0x2e8a18[_0x5e54('0x45')][_0x5e54('0x78')]?{'id':_0x2e8a18[_0x5e54('0x45')][_0x5e54('0x78')]}:undefined,'required':_0x2e8a18['query'][_0x5e54('0x78')]?!![]:![]}];}return db[_0x5e54('0x71')][_0x5e54('0x55')](_0x7296b8);})[_0x5e54('0x1f')](function(_0x329d54){_0x46ad62[_0x5e54('0x68')]=_0x329d54;return _0x46ad62;});}})['then'](respondWithFilteredResult(_0x108a3e,_0x7296b8))[_0x5e54('0x56')](handleError(_0x108a3e,null));};exports[_0x5e54('0x79')]=function(_0x51bcf3,_0xc85031,_0x3d0303){return db[_0x5e54('0x3f')][_0x5e54('0x6e')]({'where':{'id':_0x51bcf3[_0x5e54('0x58')]['id']}})['then'](handleEntityNotFound(_0xc85031,null))['then'](function(_0x39ffa6){if(_0x39ffa6){return db[_0x5e54('0x7a')][_0x5e54('0x7b')](function(_0x313a2b){return db['FaxApplication'][_0x5e54('0x33')]({'where':{'FaxAccountId':_0x51bcf3[_0x5e54('0x58')]['id']},'transaction':_0x313a2b})[_0x5e54('0x1f')](function(_0x4d452b){var _0x4e3704=_['map'](_0x51bcf3[_0x5e54('0x5d')],function(_0x4bb128){_0x4bb128[_0x5e54('0x67')]=_0x51bcf3[_0x5e54('0x58')]['id'];return _0x4bb128;});return db['FaxApplication'][_0x5e54('0x7c')](_0x4e3704,{'transaction':_0x313a2b});});})[_0x5e54('0x1f')](function(){return db['FaxApplication'][_0x5e54('0x7d')]({'where':{'FaxAccountId':_0x51bcf3['params']['id']},'order':'priority'});});}})[_0x5e54('0x1f')](respondWithResult(_0xc85031,null))[_0x5e54('0x56')](handleError(_0xc85031,null));};exports[_0x5e54('0x7e')]=function(_0x4ceef3,_0x27b0cf,_0x49470a){var _0x4f3b63={};var _0x595a58={};var _0x502ea0;var _0x6f0d41;return db[_0x5e54('0x3f')][_0x5e54('0x6e')]({'where':{'id':_0x4ceef3[_0x5e54('0x58')]['id']}})[_0x5e54('0x1f')](handleEntityNotFound(_0x27b0cf,null))['then'](function(_0x2115df){if(_0x2115df){_0x502ea0=_0x2115df;_0x595a58[_0x5e54('0x44')]=_[_0x5e54('0x46')](db[_0x5e54('0x7f')][_0x5e54('0x40')]);_0x595a58[_0x5e54('0x45')]=_[_0x5e54('0x46')](_0x4ceef3[_0x5e54('0x45')]);_0x595a58[_0x5e54('0x50')]=_[_0x5e54('0x47')](_0x595a58['model'],_0x595a58[_0x5e54('0x45')]);_0x4f3b63[_0x5e54('0x48')]=_[_0x5e54('0x47')](_0x595a58['model'],qs[_0x5e54('0x49')](_0x4ceef3[_0x5e54('0x45')][_0x5e54('0x49')]));_0x4f3b63[_0x5e54('0x48')]=_0x4f3b63[_0x5e54('0x48')][_0x5e54('0x4a')]?_0x4f3b63[_0x5e54('0x48')]:_0x595a58['model'];_0x4f3b63['order']=qs[_0x5e54('0x4d')](_0x4ceef3[_0x5e54('0x45')]['sort']);_0x4f3b63[_0x5e54('0x4e')]=qs[_0x5e54('0x50')](_['pick'](_0x4ceef3[_0x5e54('0x45')],_0x595a58['filters']));if(_0x4ceef3[_0x5e54('0x45')]['filter']){_0x4f3b63[_0x5e54('0x4e')]=_[_0x5e54('0x52')](_0x4f3b63[_0x5e54('0x4e')],{'$or':_[_0x5e54('0x3e')](_0x4f3b63[_0x5e54('0x48')],function(_0x56de75){var _0xd9fae0={};_0xd9fae0[_0x56de75]={'$like':'%'+_0x4ceef3[_0x5e54('0x45')][_0x5e54('0x51')]+'%'};return _0xd9fae0;})});}_0x4f3b63=_[_0x5e54('0x52')]({},_0x4f3b63,_0x4ceef3[_0x5e54('0x54')]);return _0x502ea0['getApplications'](_0x4f3b63);}})[_0x5e54('0x1f')](function(_0x134fc2){if(_0x134fc2){_0x6f0d41=_0x134fc2[_0x5e54('0x4a')];if(!_0x4ceef3[_0x5e54('0x45')][_0x5e54('0x4b')](_0x5e54('0x6f'))){_0x4f3b63[_0x5e54('0x2b')]=qs[_0x5e54('0x2b')](_0x4ceef3['query'][_0x5e54('0x2b')]);_0x4f3b63[_0x5e54('0x29')]=qs[_0x5e54('0x29')](_0x4ceef3[_0x5e54('0x45')][_0x5e54('0x29')]);}return _0x502ea0[_0x5e54('0x7e')](_0x4f3b63);}})[_0x5e54('0x1f')](function(_0x3be8ab){if(_0x3be8ab){return _0x3be8ab?{'count':_0x6f0d41,'rows':_0x3be8ab}:null;}})[_0x5e54('0x1f')](respondWithResult(_0x27b0cf,null))[_0x5e54('0x56')](handleError(_0x27b0cf,null));};function Extension(_0x518904,_0x330d03,_0x2964aa,_0x1e46aa){this[_0x5e54('0x80')]=_0x5e54('0x81');this['exten']=_0x518904[_0x5e54('0x82')];this['app']=_0x1e46aa;this[_0x5e54('0x42')]=_0x5e54('0x83');this[_0x5e54('0x84')]=_0x5e54('0x85');this[_0x5e54('0x67')]=_0x518904['id'];this[_0x5e54('0x86')]=_0x330d03;this['appdata']=_0x2964aa;}function createExtensionsReciveFax(_0x52ee5e){var _0x10d79e=0x1;var _0x3ddc15=[];_0x3ddc15[_0x5e54('0x87')](new Extension(_0x52ee5e,_0x10d79e,'','Answer'));_0x10d79e+=0x1;_0x3ddc15[_0x5e54('0x87')](new Extension(_0x52ee5e,_0x10d79e,_0x5e54('0x88'),_0x5e54('0x89')));_0x10d79e+=0x1;for(var _0x1a535d in _0x52ee5e){if(_0x52ee5e[_0x5e54('0x4b')](_0x1a535d)&&(_0x1a535d==='ecm'||_0x1a535d===_0x5e54('0x82')||_0x1a535d==='gateway'||_0x1a535d===_0x5e54('0x8a')||_0x1a535d===_0x5e54('0x8b')||_0x1a535d===_0x5e54('0x8c')||_0x1a535d===_0x5e54('0x8d')||_0x1a535d===_0x5e54('0x8e')||_0x1a535d===_0x5e54('0x8f'))){_0x3ddc15[_0x5e54('0x87')](new Extension(_0x52ee5e,_0x10d79e,_0x5e54('0x90')+_0x1a535d+')='+_0x52ee5e[_0x1a535d],'Set'));_0x10d79e+=0x1;}}_0x3ddc15[_0x5e54('0x87')](new Extension(_0x52ee5e,_0x10d79e,'6',_0x5e54('0x91')));_0x10d79e+=0x1;_0x3ddc15[_0x5e54('0x87')](new Extension(_0x52ee5e,_0x10d79e,_0x5e54('0x92'),_0x5e54('0x93')));_0x10d79e=0x0;return _0x3ddc15;}exports[_0x5e54('0x94')]=function(_0x2b2da1,_0x3ae5ca,_0x422f3d){var _0x2578ef;return db[_0x5e54('0x7a')]['transaction'](function(_0x2c6c36){return db[_0x5e54('0x3f')]['create'](_0x2b2da1['body'],{'transaction':_0x2c6c36})[_0x5e54('0x1f')](function(_0x322136){_0x2578ef=_0x322136[_0x5e54('0x34')]({'plain':!![]});return db[_0x5e54('0x95')][_0x5e54('0x7c')](createExtensionsReciveFax(_0x2578ef),{'transaction':_0x2c6c36});});})[_0x5e54('0x1f')](function(){return _0x2578ef;})[_0x5e54('0x1f')](respondWithResult(_0x3ae5ca,null))[_0x5e54('0x56')](handleError(_0x3ae5ca,null));};exports['updateAccountApplications']=function(_0x364579,_0x4ca596,_0xbd380f){var _0x20ef6b;return db['sequelize'][_0x5e54('0x7b')](function(_0x2825f8){return db['FaxAccount'][_0x5e54('0x32')](_0x364579[_0x5e54('0x5d')],{'where':{'id':_0x364579['body']['id']},'transaction':_0x2825f8})[_0x5e54('0x1f')](function(_0x3d0aef){return db[_0x5e54('0x95')][_0x5e54('0x33')]({'where':{'FaxAccountId':_0x364579[_0x5e54('0x5d')]['id']},'transaction':_0x2825f8})[_0x5e54('0x1f')](function(_0x126663){return db[_0x5e54('0x95')][_0x5e54('0x7c')](createExtensionsReciveFax(_[_0x5e54('0x72')](_0x364579[_0x5e54('0x5d')],['tech',_0x5e54('0x43'),'createdAt',_0x5e54('0x96'),'TrunkId',_0x5e54('0x97')])),{'transaction':_0x2825f8});});});})[_0x5e54('0x1f')](function(){return db[_0x5e54('0x3f')][_0x5e54('0x98')](_0x364579['body']['id']);})[_0x5e54('0x1f')](respondWithResult(_0x4ca596,null))[_0x5e54('0x56')](handleError(_0x4ca596,null));};exports['getMessages']=function(_0x350a4c,_0x4fb881,_0x30e51d){var _0xab3abf={'raw':!![],'where':{}};var _0x3acc68={};var _0x30a4f4={'count':0x0,'rows':[]};return db[_0x5e54('0x3f')]['findOne']({'where':{'id':_0x350a4c[_0x5e54('0x58')]['id']}})[_0x5e54('0x1f')](handleEntityNotFound(_0x4fb881,null))[_0x5e54('0x1f')](function(_0x282a51){if(_0x282a51){_0x3acc68['model']=_[_0x5e54('0x46')](db[_0x5e54('0x99')][_0x5e54('0x40')]);_0x3acc68[_0x5e54('0x45')]=_[_0x5e54('0x46')](_0x350a4c[_0x5e54('0x45')]);_0x3acc68['filters']=_[_0x5e54('0x47')](_0x3acc68[_0x5e54('0x44')],_0x3acc68[_0x5e54('0x45')]);_0xab3abf[_0x5e54('0x48')]=_[_0x5e54('0x47')](_0x3acc68[_0x5e54('0x44')],qs[_0x5e54('0x49')](_0x350a4c['query'][_0x5e54('0x49')]));_0xab3abf[_0x5e54('0x48')]=_0xab3abf[_0x5e54('0x48')][_0x5e54('0x4a')]?_0xab3abf['attributes']:_0x3acc68[_0x5e54('0x44')];if(!_0x350a4c[_0x5e54('0x45')]['hasOwnProperty'](_0x5e54('0x6f'))){_0xab3abf['limit']=qs[_0x5e54('0x2b')](_0x350a4c[_0x5e54('0x45')][_0x5e54('0x2b')]);_0xab3abf[_0x5e54('0x29')]=qs[_0x5e54('0x29')](_0x350a4c[_0x5e54('0x45')][_0x5e54('0x29')]);}_0xab3abf[_0x5e54('0x4c')]=qs[_0x5e54('0x4d')](_0x350a4c[_0x5e54('0x45')][_0x5e54('0x4d')]);_0xab3abf['where']=qs['filters'](_['pick'](_0x350a4c[_0x5e54('0x45')],_0x3acc68[_0x5e54('0x50')]));_0xab3abf[_0x5e54('0x4e')][_0x5e54('0x67')]=_0x282a51['id'];if(_0x350a4c[_0x5e54('0x45')]['filter']){_0xab3abf['where']=_[_0x5e54('0x52')](_0xab3abf[_0x5e54('0x4e')],{'$or':_['map'](_0xab3abf[_0x5e54('0x48')],function(_0x11d06d){var _0x4b0d47={};_0x4b0d47[_0x11d06d]={'$like':'%'+_0x350a4c[_0x5e54('0x45')]['filter']+'%'};return _0x4b0d47;})});}if(_0x350a4c[_0x5e54('0x45')][_0x5e54('0x9a')]){var _0x2ab406=_0x350a4c[_0x5e54('0x45')][_0x5e54('0x9a')]['split'](',');var _0x5a7c9c={};_0x5a7c9c[_0x2ab406[0x0]]={'$gte':moment(_0x2ab406[0x1])[_0x5e54('0x9b')](_0x5e54('0x9c'))};_0xab3abf[_0x5e54('0x4e')]=_[_0x5e54('0x52')](_0xab3abf['where'],_0x5a7c9c);}_0xab3abf=_[_0x5e54('0x52')]({},_0xab3abf,_0x350a4c['options']);return db[_0x5e54('0x99')][_0x5e54('0x2c')]({'where':_0xab3abf[_0x5e54('0x4e')]})['then'](function(_0x2ac378){_0x30a4f4[_0x5e54('0x2c')]=_0x2ac378;if(_0x350a4c['query'][_0x5e54('0x59')]){_0xab3abf[_0x5e54('0x5a')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0xab3abf);})[_0x5e54('0x1f')](function(_0x315989){_0x30a4f4[_0x5e54('0x68')]=_0x315989;return _0x30a4f4;});}})[_0x5e54('0x1f')](respondWithFilteredResult(_0x4fb881,_0xab3abf))['catch'](handleError(_0x4fb881,null));};exports[_0x5e54('0x3a')]=function(_0x512d32,_0x4281f8,_0x27deea){var _0x115c2b,_0xd8b540={},_0x536fdb;if(_0x512d32['body']['to']){_0x536fdb=_0x512d32[_0x5e54('0x5d')]['to'][0x0];}return db[_0x5e54('0x3f')]['find']({'where':{'id':_0x512d32[_0x5e54('0x58')]['id']},'include':[{'model':db[_0x5e54('0x9d')],'as':_0x5e54('0x9e'),'include':[{'model':db['CmContact'],'as':_0x5e54('0x9f'),'where':{'fax':_0x536fdb},'limit':0x1,'order':[[_0x5e54('0x96'),_0x5e54('0xa0')]]}]}]})[_0x5e54('0x1f')](handleEntityNotFound(_0x4281f8,null))[_0x5e54('0x1f')](function(_0xcbcc2b){_0x115c2b=_0xcbcc2b;if(_0x512d32[_0x5e54('0x5d')][_0x5e54('0xa1')]&&_0x512d32[_0x5e54('0x5d')][_0x5e54('0xa1')]['length']){for(var _0x9da255=0x0;_0x9da255<_0x512d32[_0x5e54('0x5d')]['attachments'][_0x5e54('0x4a')];_0x9da255+=0x1){_0x512d32['body'][_0x5e54('0xa1')][_0x9da255]={'filename':_0x512d32[_0x5e54('0x5d')][_0x5e54('0xa1')][_0x9da255][_0x5e54('0x39')],'id':_0x512d32[_0x5e54('0x5d')][_0x5e54('0xa1')][_0x9da255]['id'],'path':path[_0x5e54('0xa2')](config['root'],_0x5e54('0xa3'),_0x512d32[_0x5e54('0x5d')][_0x5e54('0xa1')][_0x9da255][_0x5e54('0xa4')])};}}return respondWithRpcPromise(_0x5e54('0xa5'),_0x5e54('0xa5'),{'FaxAccountId':_[_0x5e54('0xa6')](_0x512d32[_0x5e54('0x58')]['id'])?undefined:_0x512d32[_0x5e54('0x58')]['id'],'path':_['isNil'](_0x512d32[_0x5e54('0x5d')][_0x5e54('0xa1')][0x0][_0x5e54('0x5')])?undefined:_0x512d32[_0x5e54('0x5d')][_0x5e54('0xa1')][0x0][_0x5e54('0x5')],'fax':_['isNil'](_0x512d32[_0x5e54('0x5d')]['to'][0x0])?undefined:_0x512d32[_0x5e54('0x5d')]['to'][0x0]},client9002);})[_0x5e54('0x1f')](function(){if(_0x115c2b){if(_[_0x5e54('0xa6')](_0x512d32['body'][_0x5e54('0xa7')])){_0x512d32[_0x5e54('0x5d')][_0x5e54('0xa7')]=util[_0x5e54('0x9b')]('\x22%s\x22\x20<%s>',_0x115c2b[_0x5e54('0x39')],_0x115c2b[_0x5e54('0xa8')]);}if(_0x115c2b[_0x5e54('0x9e')]){if(_0x115c2b[_0x5e54('0x9e')][_0x5e54('0x9f')][_0x5e54('0x4a')]){return _0x115c2b['List'][_0x5e54('0x9f')][0x0];}else{return db[_0x5e54('0x74')]['create'](_[_0x5e54('0x16')](_0x512d32[_0x5e54('0x5d')],{'firstName':_0x512d32[_0x5e54('0x5d')]['to'][0x0],'phone':_0x512d32[_0x5e54('0x5d')]['to'][0x0],'fax':_0x512d32[_0x5e54('0x5d')]['to'][0x0],'ListId':_0x115c2b[_0x5e54('0x97')]}));}}else{throw new Error(_0x5e54('0xa9'));}}else{throw new Error(_0x5e54('0xaa'));}})[_0x5e54('0x1f')](function(_0x554c58){if(_0x554c58){return db['FaxInteraction']['find']({'where':{'ContactId':_0x554c58['id'],'closed':![],'FaxAccountId':_0x115c2b['id']}})[_0x5e54('0x1f')](function(_0xaa76e7){if(_0xaa76e7){return[_0xaa76e7,![]];}return db['FaxInteraction'][_0x5e54('0x5c')]({'UserId':_0x512d32['user']['id'],'ContactId':_0x554c58['id'],'FaxAccountId':_0x115c2b['id'],'fax':_0x512d32['body']['to'][0x0],'firstMsgDirection':_0x5e54('0xab'),'Messages':[_[_0x5e54('0x52')](_0x512d32[_0x5e54('0x5d')],{'read':![],'body':_0x512d32['body'][_0x5e54('0xa1')][0x0]['filename'],'FaxAccountId':_0x115c2b['id'],'UserId':_0x512d32['user']['id'],'ContactId':_0x554c58['id'],'AttachmentId':_0x512d32[_0x5e54('0x5d')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x5e54('0x99')],'as':_0x5e54('0xac')}]})[_0x5e54('0x1f')](function(_0x49b069){return[_0x49b069,!![]];});});}else{throw new Error(_0x5e54('0xad'));}})[_0x5e54('0xae')](function(_0x11cbd4,_0xd31a13){if(_0xd31a13){return _0x11cbd4;}return db[_0x5e54('0x99')][_0x5e54('0x5c')]({'direction':_0x5e54('0xab'),'read':![],'body':_0x512d32[_0x5e54('0x5d')]['attachments'][0x0]['filename'],'FaxAccountId':_0x115c2b['id'],'FaxInteractionId':_0x11cbd4['id'],'UserId':_0x512d32[_0x5e54('0x5e')]['id'],'ContactId':_0x11cbd4[_0x5e54('0xaf')],'AttachmentId':_0x512d32[_0x5e54('0x5d')][_0x5e54('0xa1')][0x0]['id']})[_0x5e54('0x1f')](function(_0x44a7ae){_0x11cbd4[_0x5e54('0xb0')][_0x5e54('0xac')]=[];_0x11cbd4['dataValues'][_0x5e54('0xac')]['push'](_0x44a7ae[_0x5e54('0xb0')]);return _0x11cbd4;});})['then'](function(_0x4dddd7){respondWithRpcPromise(_0x5e54('0xb1'),_0x5e54('0xb1'),{'FaxAccountId':_[_0x5e54('0xa6')](_0x512d32[_0x5e54('0x58')]['id'])?undefined:_0x512d32['params']['id'],'path':_['isNil'](_0x512d32[_0x5e54('0x5d')][_0x5e54('0xa1')][0x0]['path'])?undefined:_0x512d32[_0x5e54('0x5d')][_0x5e54('0xa1')][0x0][_0x5e54('0x5')],'fax':_[_0x5e54('0xa6')](_0x512d32[_0x5e54('0x5d')]['to'][0x0])?undefined:_0x512d32[_0x5e54('0x5d')]['to'][0x0],'AttachmentId':_0x512d32[_0x5e54('0x5d')][_0x5e54('0xa1')][0x0]['id']},client9002)['then'](function(_0x4dd761){logger[_0x5e54('0x20')](_0x5e54('0xb2'),_0x4dd761);})[_0x5e54('0x56')](function(_0x39e02e){logger[_0x5e54('0x20')]('SendFaxRpc,\x20%s',_0x39e02e);});return _0x4dddd7;})[_0x5e54('0x1f')](respondWithResult(_0x4281f8,null))[_0x5e54('0x56')](handleError(_0x4281f8,null));};exports[_0x5e54('0xb3')]=function(_0x469dc1,_0x2a01df,_0x2cc999){return db[_0x5e54('0x3f')]['find']({'where':{'id':_0x469dc1[_0x5e54('0x58')]['id']}})['then'](handleEntityNotFound(_0x2a01df,null))[_0x5e54('0x1f')](function(_0x5d118b){if(_0x5d118b){return _0x5d118b[_0x5e54('0xb3')](_0x469dc1[_0x5e54('0x5d')][_0x5e54('0x6a')],_[_0x5e54('0x72')](_0x469dc1[_0x5e54('0x5d')],[_0x5e54('0x6a'),'id'])||{})[_0x5e54('0xae')](function(_0x56f372){for(var _0x3e4f8f=0x0;_0x3e4f8f<_0x469dc1['body'][_0x5e54('0x6a')][_0x5e54('0x4a')];_0x3e4f8f+=0x1){socket[_0x5e54('0xb4')](_0x5e54('0xb5'),{'UserId':_0x469dc1[_0x5e54('0x5d')][_0x5e54('0x6a')][_0x3e4f8f],'FaxAccountId':_0x469dc1['params']['id']});}return _0x56f372;});}})[_0x5e54('0x1f')](respondWithResult(_0x2a01df,null))['catch'](handleError(_0x2a01df,null));};exports[_0x5e54('0xb6')]=function(_0x205b57,_0x451fd9,_0x32e617){return db['FaxAccount'][_0x5e54('0x5b')]({'where':{'id':_0x205b57[_0x5e54('0x58')]['id']}})['then'](handleEntityNotFound(_0x451fd9,null))[_0x5e54('0x1f')](function(_0x1704ff){if(_0x1704ff){return _0x1704ff[_0x5e54('0xb6')](_0x205b57[_0x5e54('0x45')][_0x5e54('0x6a')])[_0x5e54('0x1f')](function(){if(_[_0x5e54('0xb7')](_0x205b57[_0x5e54('0x45')][_0x5e54('0x6a')])){for(var _0x316f1f=0x0;_0x316f1f<_0x205b57[_0x5e54('0x45')][_0x5e54('0x6a')][_0x5e54('0x4a')];_0x316f1f+=0x1){socket['emit'](_0x5e54('0xb8'),{'UserId':Number(_0x205b57[_0x5e54('0x45')]['ids'][_0x316f1f]),'FaxAccountId':Number(_0x205b57[_0x5e54('0x58')]['id'])});}}else{socket[_0x5e54('0xb4')](_0x5e54('0xb8'),{'UserId':Number(_0x205b57[_0x5e54('0x45')][_0x5e54('0x6a')]),'FaxAccountId':Number(_0x205b57[_0x5e54('0x58')]['id'])});}});}})[_0x5e54('0x1f')](respondWithStatusCode(_0x451fd9,null))['catch'](handleError(_0x451fd9,null));};exports[_0x5e54('0xb9')]=function(_0x4fcff4,_0x335ef4,_0x30ca5b){var _0x70d0e2={};var _0x58f9c4={};var _0x368ae7;var _0x290bc4;return db[_0x5e54('0x3f')]['findOne']({'where':{'id':_0x4fcff4[_0x5e54('0x58')]['id']}})[_0x5e54('0x1f')](handleEntityNotFound(_0x335ef4,null))['then'](function(_0x39d4a2){if(_0x39d4a2){_0x368ae7=_0x39d4a2;_0x58f9c4['model']=_[_0x5e54('0x46')](db[_0x5e54('0xba')][_0x5e54('0x40')]);_0x58f9c4[_0x5e54('0x45')]=_['keys'](_0x4fcff4[_0x5e54('0x45')]);_0x58f9c4[_0x5e54('0x50')]=_['intersection'](_0x58f9c4[_0x5e54('0x44')],_0x58f9c4[_0x5e54('0x45')]);_0x70d0e2[_0x5e54('0x48')]=_[_0x5e54('0x47')](_0x58f9c4[_0x5e54('0x44')],qs[_0x5e54('0x49')](_0x4fcff4[_0x5e54('0x45')][_0x5e54('0x49')]));_0x70d0e2[_0x5e54('0x48')]=_0x70d0e2['attributes']['length']?_0x70d0e2[_0x5e54('0x48')]:_0x58f9c4[_0x5e54('0x44')];_0x70d0e2[_0x5e54('0x4c')]=qs[_0x5e54('0x4d')](_0x4fcff4[_0x5e54('0x45')][_0x5e54('0x4d')]);_0x70d0e2[_0x5e54('0x4e')]=qs[_0x5e54('0x50')](_[_0x5e54('0x4f')](_0x4fcff4['query'],_0x58f9c4['filters']));if(_0x4fcff4['query']['filter']){_0x70d0e2['where']=_[_0x5e54('0x52')](_0x70d0e2[_0x5e54('0x4e')],{'$or':_[_0x5e54('0x3e')](_0x70d0e2[_0x5e54('0x48')],function(_0x5d2adc){var _0x5af3a8={};_0x5af3a8[_0x5d2adc]={'$like':'%'+_0x4fcff4[_0x5e54('0x45')]['filter']+'%'};return _0x5af3a8;})});}_0x70d0e2=_[_0x5e54('0x52')]({},_0x70d0e2,_0x4fcff4[_0x5e54('0x54')]);return _0x368ae7[_0x5e54('0xb9')](_0x70d0e2);}})['then'](function(_0x5ec0ba){if(_0x5ec0ba){_0x290bc4=_0x5ec0ba[_0x5e54('0x4a')];if(!_0x4fcff4[_0x5e54('0x45')]['hasOwnProperty'](_0x5e54('0x6f'))){_0x70d0e2[_0x5e54('0x2b')]=qs[_0x5e54('0x2b')](_0x4fcff4['query'][_0x5e54('0x2b')]);_0x70d0e2[_0x5e54('0x29')]=qs[_0x5e54('0x29')](_0x4fcff4[_0x5e54('0x45')][_0x5e54('0x29')]);}return _0x368ae7[_0x5e54('0xb9')](_0x70d0e2);}})[_0x5e54('0x1f')](function(_0x5a4fb0){if(_0x5a4fb0){return _0x5a4fb0?{'count':_0x290bc4,'rows':_0x5a4fb0}:null;}})['then'](respondWithResult(_0x335ef4,null))[_0x5e54('0x56')](handleError(_0x335ef4,null));}; \ No newline at end of file +var _0x341d=['model','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','nolimit','removeAnswers','FaxInteraction','omit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','push','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','minrate','modem','t38timeout','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','Contacts','updatedAt','DESC','attachments','join','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','CmContact','List\x20not\x20found','Send\x20Fax\x20failed','user','out','filename','Messages','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','User','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','Pause','map','FaxAccount','fieldName','type','key','query','keys','filters'];(function(_0x2ac32d,_0xd00c08){var _0x200bc5=function(_0x393dd5){while(--_0x393dd5){_0x2ac32d['push'](_0x2ac32d['shift']());}};_0x200bc5(++_0xd00c08);}(_0x341d,0x83));var _0xd341=function(_0x31d1d6,_0x2c9544){_0x31d1d6=_0x31d1d6-0x0;var _0x242bc9=_0x341d[_0x31d1d6];return _0x242bc9;};'use strict';var emlformat=require(_0xd341('0x0'));var rimraf=require(_0xd341('0x1'));var zipdir=require(_0xd341('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd341('0x3'));var moment=require(_0xd341('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd341('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd341('0x6'));var csv=require('to-csv');var ejs=require(_0xd341('0x7'));var fs=require('fs');var fs_extra=require(_0xd341('0x8'));var _=require(_0xd341('0x9'));var squel=require(_0xd341('0xa'));var crypto=require(_0xd341('0xb'));var jsforce=require(_0xd341('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd341('0xd'));var querystring=require(_0xd341('0xe'));var Papa=require('papaparse');var Redis=require(_0xd341('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd341('0x10'));var logger=require(_0xd341('0x11'))(_0xd341('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd341('0x13'));var db=require(_0xd341('0x14'))['db'];config[_0xd341('0x15')]=_[_0xd341('0x16')](config[_0xd341('0x15')],{'host':_0xd341('0x17'),'port':0x18eb});var socket=require(_0xd341('0x18'))(new Redis(config[_0xd341('0x15')]));require(_0xd341('0x19'))[_0xd341('0x1a')](socket);var jayson=require(_0xd341('0x1b'));var client=jayson[_0xd341('0x1c')][_0xd341('0x1d')]({'port':0x232c});var client9002=jayson[_0xd341('0x1c')][_0xd341('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xaa3581,_0xb85bfc,_0x4448f8,_0x3ee18e){return new BPromise(function(_0x4ed527,_0x1ee17e){var _0x3a3ede=_0x3ee18e||client;return _0x3a3ede['request'](_0xaa3581,_0x4448f8)[_0xd341('0x1e')](function(_0x2a22bf){logger['info'](_0xd341('0x1f'),_0xb85bfc,'request\x20sent');logger[_0xd341('0x20')](_0xd341('0x21'),_0xb85bfc,'request\x20sent',JSON[_0xd341('0x22')](_0x2a22bf));if(_0x2a22bf[_0xd341('0x23')]){if(_0x2a22bf[_0xd341('0x23')][_0xd341('0x24')]===0x1f4){logger[_0xd341('0x23')](_0xd341('0x1f'),_0xb85bfc,_0x2a22bf['error'][_0xd341('0x25')]);return _0x1ee17e(_0x2a22bf[_0xd341('0x23')][_0xd341('0x25')]);}logger[_0xd341('0x23')]('FaxAccount,\x20%s,\x20%s',_0xb85bfc,_0x2a22bf[_0xd341('0x23')][_0xd341('0x25')]);return _0x4ed527(_0x2a22bf[_0xd341('0x23')][_0xd341('0x25')]);}else{logger[_0xd341('0x26')](_0xd341('0x1f'),_0xb85bfc,_0xd341('0x27'));_0x4ed527(_0x2a22bf[_0xd341('0x28')][_0xd341('0x25')]);}})[_0xd341('0x29')](function(_0x3ee8ef){logger[_0xd341('0x23')]('FaxAccount,\x20%s,\x20%s',_0xb85bfc,_0x3ee8ef);_0x1ee17e(_0x3ee8ef);});});}function respondWithStatusCode(_0x47b8b3,_0x4df4d3){_0x4df4d3=_0x4df4d3||0xcc;return function(_0x2a4120){if(_0x2a4120){return _0x47b8b3['sendStatus'](_0x4df4d3);}return _0x47b8b3['status'](_0x4df4d3)[_0xd341('0x2a')]();};}function respondWithResult(_0x3092dc,_0x22875b){_0x22875b=_0x22875b||0xc8;return function(_0x1bfdc3){if(_0x1bfdc3){return _0x3092dc[_0xd341('0x2b')](_0x22875b)[_0xd341('0x2c')](_0x1bfdc3);}};}function respondWithFilteredResult(_0x5c956f,_0xf7a42b){return function(_0x164288){if(_0x164288){var _0x4859fa=typeof _0xf7a42b['offset']===_0xd341('0x2d')&&typeof _0xf7a42b[_0xd341('0x2e')]==='undefined';var _0x1e33a1=_0x164288[_0xd341('0x2f')];var _0x16ef31=_0x4859fa?0x0:_0xf7a42b['offset'];var _0x41ea67=_0x4859fa?_0x164288[_0xd341('0x2f')]:_0xf7a42b[_0xd341('0x30')]+_0xf7a42b['limit'];var _0x486471;if(_0x41ea67>=_0x1e33a1){_0x41ea67=_0x1e33a1;_0x486471=0xc8;}else{_0x486471=0xce;}_0x5c956f[_0xd341('0x2b')](_0x486471);return _0x5c956f[_0xd341('0x31')](_0xd341('0x32'),_0x16ef31+'-'+_0x41ea67+'/'+_0x1e33a1)[_0xd341('0x2c')](_0x164288);}return null;};}function patchUpdates(_0x335c45){return function(_0x191272){try{jsonpatch[_0xd341('0x33')](_0x191272,_0x335c45,!![]);}catch(_0x23c763){return BPromise[_0xd341('0x34')](_0x23c763);}return _0x191272[_0xd341('0x35')]();};}function saveUpdates(_0x3e75d7,_0x4f1af6){return function(_0x29af3b){if(_0x29af3b){return _0x29af3b[_0xd341('0x36')](_0x3e75d7)['then'](function(_0x2ba757){return _0x2ba757;});}return null;};}function removeEntity(_0x20f8a0,_0x1bb18e){return function(_0x326a80){if(_0x326a80){return _0x326a80[_0xd341('0x37')]()[_0xd341('0x1e')](function(){var _0x169b40=_0x326a80[_0xd341('0x38')]({'plain':!![]});var _0x32e464='FaxAccounts';return db['UserProfileResource'][_0xd341('0x37')]({'where':{'type':_0x32e464,'resourceId':_0x169b40['id']}})[_0xd341('0x1e')](function(){return _0x326a80;});})[_0xd341('0x1e')](function(){_0x20f8a0[_0xd341('0x2b')](0xcc)[_0xd341('0x2a')]();});}};}function handleEntityNotFound(_0x5bcd6d,_0x207f31){return function(_0x2273ef){if(!_0x2273ef){_0x5bcd6d['sendStatus'](0x194);}return _0x2273ef;};}function handleError(_0x598aa0,_0x30ec19){_0x30ec19=_0x30ec19||0x1f4;return function(_0x5c7e82){logger[_0xd341('0x23')](_0x5c7e82['stack']);if(_0x5c7e82['name']){delete _0x5c7e82['name'];}_0x598aa0['status'](_0x30ec19)['send'](_0x5c7e82);};}exports['index']=function(_0x5a2267,_0x2dfe52){var _0x568189={'include':[{'model':db[_0xd341('0x39')],'as':'mandatoryDispositionPause'}]},_0x556a10={},_0x1c955b={'count':0x0,'rows':[]};var _0x243e79=_[_0xd341('0x3a')](db[_0xd341('0x3b')]['rawAttributes'],function(_0x164531){return{'name':_0x164531[_0xd341('0x3c')],'type':_0x164531[_0xd341('0x3d')][_0xd341('0x3e')]};});_0x556a10['model']=_['map'](_0x243e79,'name');_0x556a10[_0xd341('0x3f')]=_[_0xd341('0x40')](_0x5a2267['query']);_0x556a10[_0xd341('0x41')]=_['intersection'](_0x556a10[_0xd341('0x42')],_0x556a10['query']);_0x568189['attributes']=_[_0xd341('0x43')](_0x556a10[_0xd341('0x42')],qs[_0xd341('0x44')](_0x5a2267['query'][_0xd341('0x44')]));_0x568189['attributes']=_0x568189[_0xd341('0x45')][_0xd341('0x46')]?_0x568189[_0xd341('0x45')]:_0x556a10['model'];if(!_0x5a2267[_0xd341('0x3f')][_0xd341('0x47')]('nolimit')){_0x568189['limit']=qs[_0xd341('0x2e')](_0x5a2267[_0xd341('0x3f')]['limit']);_0x568189[_0xd341('0x30')]=qs[_0xd341('0x30')](_0x5a2267[_0xd341('0x3f')][_0xd341('0x30')]);}_0x568189[_0xd341('0x48')]=qs[_0xd341('0x49')](_0x5a2267['query'][_0xd341('0x49')]);_0x568189[_0xd341('0x4a')]=qs[_0xd341('0x41')](_[_0xd341('0x4b')](_0x5a2267[_0xd341('0x3f')],_0x556a10[_0xd341('0x41')]),_0x243e79);if(_0x5a2267[_0xd341('0x3f')][_0xd341('0x4c')]){_0x568189['where']=_[_0xd341('0x4d')](_0x568189[_0xd341('0x4a')],{'$or':_[_0xd341('0x3a')](_0x243e79,function(_0xc68e0b){if(_0xc68e0b[_0xd341('0x3d')]!==_0xd341('0x4e')){var _0x4b1082={};_0x4b1082[_0xc68e0b[_0xd341('0x4f')]]={'$like':'%'+_0x5a2267[_0xd341('0x3f')][_0xd341('0x4c')]+'%'};return _0x4b1082;}})});}_0x568189=_[_0xd341('0x4d')]({},_0x568189,_0x5a2267[_0xd341('0x50')]);var _0x2e2390={'where':_0x568189[_0xd341('0x4a')]};return db[_0xd341('0x3b')]['count'](_0x2e2390)[_0xd341('0x1e')](function(_0x39a68b){_0x1c955b[_0xd341('0x2f')]=_0x39a68b;if(_0x5a2267[_0xd341('0x3f')][_0xd341('0x51')]){_0x568189['include']=[{'all':!![]}];}return db[_0xd341('0x3b')][_0xd341('0x52')](_0x568189);})[_0xd341('0x1e')](function(_0x2ac07e){_0x1c955b[_0xd341('0x53')]=_0x2ac07e;return _0x1c955b;})[_0xd341('0x1e')](respondWithFilteredResult(_0x2dfe52,_0x568189))[_0xd341('0x29')](handleError(_0x2dfe52,null));};exports[_0xd341('0x54')]=function(_0x2a5d1e,_0x47db69){var _0x4451c7={'raw':![],'where':{'id':_0x2a5d1e[_0xd341('0x55')]['id']},'include':[{'model':db[_0xd341('0x39')],'as':'mandatoryDispositionPause'}]},_0x270fc5={};_0x270fc5['model']=_[_0xd341('0x40')](db[_0xd341('0x3b')][_0xd341('0x56')]);_0x270fc5[_0xd341('0x3f')]=_[_0xd341('0x40')](_0x2a5d1e[_0xd341('0x3f')]);_0x270fc5[_0xd341('0x41')]=_[_0xd341('0x43')](_0x270fc5['model'],_0x270fc5[_0xd341('0x3f')]);_0x4451c7[_0xd341('0x45')]=_[_0xd341('0x43')](_0x270fc5[_0xd341('0x42')],qs[_0xd341('0x44')](_0x2a5d1e[_0xd341('0x3f')][_0xd341('0x44')]));_0x4451c7[_0xd341('0x45')]=_0x4451c7[_0xd341('0x45')]['length']?_0x4451c7['attributes']:_0x270fc5[_0xd341('0x42')];if(_0x2a5d1e[_0xd341('0x3f')][_0xd341('0x51')]){_0x4451c7[_0xd341('0x57')]=[{'all':!![]}];}_0x4451c7=_[_0xd341('0x4d')]({},_0x4451c7,_0x2a5d1e[_0xd341('0x50')]);return db[_0xd341('0x3b')][_0xd341('0x58')](_0x4451c7)[_0xd341('0x1e')](handleEntityNotFound(_0x47db69,null))[_0xd341('0x1e')](respondWithResult(_0x47db69,null))[_0xd341('0x29')](handleError(_0x47db69,null));};exports[_0xd341('0x59')]=function(_0x253959,_0x173d9c){return db[_0xd341('0x3b')][_0xd341('0x59')](_0x253959[_0xd341('0x5a')],{})['then'](function(_0x4e9b79){var _0x10c9ca=_0x253959['user'][_0xd341('0x38')]({'plain':!![]});if(!_0x10c9ca)throw new Error(_0xd341('0x5b'));if(_0x10c9ca[_0xd341('0x5c')]==='user'){var _0x173908=_0x4e9b79[_0xd341('0x38')]({'plain':!![]});var _0x37b81c=_0xd341('0x5d');return db[_0xd341('0x5e')][_0xd341('0x58')]({'where':{'name':_0x37b81c,'userProfileId':_0x10c9ca['userProfileId']},'raw':!![]})[_0xd341('0x1e')](function(_0x3f74f6){if(_0x3f74f6&&_0x3f74f6[_0xd341('0x5f')]===0x0){return db[_0xd341('0x60')][_0xd341('0x59')]({'name':_0x173908[_0xd341('0x4f')],'resourceId':_0x173908['id'],'type':_0x3f74f6[_0xd341('0x4f')],'sectionId':_0x3f74f6['id']},{})[_0xd341('0x1e')](function(){return _0x4e9b79;});}else{return _0x4e9b79;}})[_0xd341('0x29')](function(_0x2649ab){logger[_0xd341('0x23')](_0xd341('0x61'),_0x2649ab);throw _0x2649ab;});}return _0x4e9b79;})[_0xd341('0x1e')](respondWithResult(_0x173d9c,0xc9))['catch'](handleError(_0x173d9c,null));};exports[_0xd341('0x36')]=function(_0x421bc5,_0x1b1109){if(_0x421bc5[_0xd341('0x5a')]['id']){delete _0x421bc5[_0xd341('0x5a')]['id'];}return db[_0xd341('0x3b')][_0xd341('0x58')]({'where':{'id':_0x421bc5['params']['id']},'include':[{'model':db[_0xd341('0x39')],'as':_0xd341('0x62')}]})[_0xd341('0x1e')](handleEntityNotFound(_0x1b1109,null))['then'](saveUpdates(_0x421bc5[_0xd341('0x5a')],null))['then'](respondWithResult(_0x1b1109,null))[_0xd341('0x29')](handleError(_0x1b1109,null));};exports[_0xd341('0x37')]=function(_0x42cd3a,_0x2b08a0){return db[_0xd341('0x3b')][_0xd341('0x58')]({'where':{'id':_0x42cd3a[_0xd341('0x55')]['id']}})[_0xd341('0x1e')](handleEntityNotFound(_0x2b08a0,null))[_0xd341('0x1e')](removeEntity(_0x2b08a0,null))['catch'](handleError(_0x2b08a0,null));};exports[_0xd341('0x63')]=function(_0x17f40c,_0x284fba){return db[_0xd341('0x3b')]['describe']()['then'](respondWithResult(_0x284fba,null))[_0xd341('0x29')](handleError(_0x284fba,null));};exports[_0xd341('0x64')]=function(_0x839025,_0x1d461e,_0x12b7fa){if(_0x839025[_0xd341('0x5a')]['id']){delete _0x839025['body']['id'];}return db['FaxAccount'][_0xd341('0x58')]({'where':{'id':_0x839025[_0xd341('0x55')]['id']}})[_0xd341('0x1e')](handleEntityNotFound(_0x1d461e,null))['then'](function(_0x3cb4cb){if(_0x3cb4cb){_0x839025[_0xd341('0x5a')][_0xd341('0x65')]=_0x3cb4cb['id'];return db[_0xd341('0x66')][_0xd341('0x59')](_0x839025[_0xd341('0x5a')]);}})[_0xd341('0x1e')](respondWithResult(_0x1d461e,null))[_0xd341('0x29')](handleError(_0x1d461e,null));};exports[_0xd341('0x67')]=function(_0x348905,_0x26f8da,_0x35fe23){var _0x17eb7f={'raw':![],'where':{}};var _0x4bac52={};var _0x4c0aab={'count':0x0,'rows':[]};return db[_0xd341('0x3b')][_0xd341('0x68')]({'where':{'id':_0x348905[_0xd341('0x55')]['id']}})[_0xd341('0x1e')](handleEntityNotFound(_0x26f8da,null))[_0xd341('0x1e')](function(_0x134883){if(_0x134883){_0x4bac52[_0xd341('0x42')]=_[_0xd341('0x40')](db[_0xd341('0x66')][_0xd341('0x56')]);_0x4bac52[_0xd341('0x3f')]=_[_0xd341('0x40')](_0x348905[_0xd341('0x3f')]);_0x4bac52['filters']=_[_0xd341('0x43')](_0x4bac52[_0xd341('0x42')],_0x4bac52[_0xd341('0x3f')]);_0x17eb7f['attributes']=_[_0xd341('0x43')](_0x4bac52['model'],qs[_0xd341('0x44')](_0x348905[_0xd341('0x3f')][_0xd341('0x44')]));_0x17eb7f[_0xd341('0x45')]=_0x17eb7f['attributes']['length']?_0x17eb7f[_0xd341('0x45')]:_0x4bac52[_0xd341('0x42')];if(!_0x348905[_0xd341('0x3f')][_0xd341('0x47')]('nolimit')){_0x17eb7f['limit']=qs[_0xd341('0x2e')](_0x348905[_0xd341('0x3f')][_0xd341('0x2e')]);_0x17eb7f[_0xd341('0x30')]=qs['offset'](_0x348905['query']['offset']);}_0x17eb7f[_0xd341('0x48')]=qs[_0xd341('0x49')](_0x348905[_0xd341('0x3f')]['sort']);_0x17eb7f[_0xd341('0x4a')]=qs[_0xd341('0x41')](_[_0xd341('0x4b')](_0x348905[_0xd341('0x3f')],_0x4bac52[_0xd341('0x41')]));_0x17eb7f['where'][_0xd341('0x65')]=_0x134883['id'];if(_0x348905['query'][_0xd341('0x4c')]){_0x17eb7f['where']=_['merge'](_0x17eb7f['where'],{'$or':_[_0xd341('0x3a')](_0x17eb7f['attributes'],function(_0x4a8337){var _0x2b9fc3={};_0x2b9fc3[_0x4a8337]={'$like':'%'+_0x348905[_0xd341('0x3f')][_0xd341('0x4c')]+'%'};return _0x2b9fc3;})});}_0x17eb7f=_[_0xd341('0x4d')]({},_0x17eb7f,_0x348905[_0xd341('0x50')]);return db[_0xd341('0x66')][_0xd341('0x2f')]({'where':_0x17eb7f[_0xd341('0x4a')]})[_0xd341('0x1e')](function(_0x1c4f85){_0x4c0aab[_0xd341('0x2f')]=_0x1c4f85;if(_0x348905[_0xd341('0x3f')][_0xd341('0x51')]){_0x17eb7f[_0xd341('0x57')]=[{'all':!![]}];}return db[_0xd341('0x66')][_0xd341('0x52')](_0x17eb7f);})['then'](function(_0x1f652e){_0x4c0aab[_0xd341('0x53')]=_0x1f652e;return _0x4c0aab;});}})[_0xd341('0x1e')](respondWithFilteredResult(_0x26f8da,_0x17eb7f))[_0xd341('0x29')](handleError(_0x26f8da,null));};exports[_0xd341('0x69')]=function(_0x3bb972,_0x56e4a5,_0x1fd0a2){return db[_0xd341('0x3b')][_0xd341('0x58')]({'where':{'id':_0x3bb972[_0xd341('0x55')]['id']}})[_0xd341('0x1e')](handleEntityNotFound(_0x56e4a5,null))[_0xd341('0x1e')](function(_0x22179a){if(_0x22179a){return _0x22179a[_0xd341('0x69')](_0x3bb972[_0xd341('0x3f')][_0xd341('0x6a')]);}})['then'](respondWithStatusCode(_0x56e4a5,null))['catch'](handleError(_0x56e4a5,null));};exports['addAnswer']=function(_0xc6fec9,_0x2357dc,_0x352366){if(_0xc6fec9[_0xd341('0x5a')]['id']){delete _0xc6fec9[_0xd341('0x5a')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0xc6fec9[_0xd341('0x55')]['id']}})[_0xd341('0x1e')](handleEntityNotFound(_0x2357dc,null))[_0xd341('0x1e')](function(_0x1ef6d7){if(_0x1ef6d7){_0xc6fec9[_0xd341('0x5a')][_0xd341('0x65')]=_0x1ef6d7['id'];return db[_0xd341('0x6b')]['create'](_0xc6fec9[_0xd341('0x5a')]);}})['then'](respondWithResult(_0x2357dc,null))[_0xd341('0x29')](handleError(_0x2357dc,null));};exports['getAnswers']=function(_0x5ab207,_0x47ae78,_0x14c6d1){var _0x2f768b={'raw':![],'where':{}};var _0x1d6b9b={};var _0x2743b7={'count':0x0,'rows':[]};return db[_0xd341('0x3b')][_0xd341('0x68')]({'where':{'id':_0x5ab207['params']['id']}})[_0xd341('0x1e')](handleEntityNotFound(_0x47ae78,null))[_0xd341('0x1e')](function(_0x3d46a3){if(_0x3d46a3){_0x1d6b9b[_0xd341('0x42')]=_[_0xd341('0x40')](db[_0xd341('0x6b')][_0xd341('0x56')]);_0x1d6b9b['query']=_[_0xd341('0x40')](_0x5ab207[_0xd341('0x3f')]);_0x1d6b9b[_0xd341('0x41')]=_[_0xd341('0x43')](_0x1d6b9b[_0xd341('0x42')],_0x1d6b9b[_0xd341('0x3f')]);_0x2f768b[_0xd341('0x45')]=_['intersection'](_0x1d6b9b[_0xd341('0x42')],qs[_0xd341('0x44')](_0x5ab207[_0xd341('0x3f')][_0xd341('0x44')]));_0x2f768b[_0xd341('0x45')]=_0x2f768b[_0xd341('0x45')][_0xd341('0x46')]?_0x2f768b[_0xd341('0x45')]:_0x1d6b9b['model'];if(!_0x5ab207[_0xd341('0x3f')][_0xd341('0x47')](_0xd341('0x6c'))){_0x2f768b[_0xd341('0x2e')]=qs['limit'](_0x5ab207[_0xd341('0x3f')][_0xd341('0x2e')]);_0x2f768b['offset']=qs[_0xd341('0x30')](_0x5ab207['query'][_0xd341('0x30')]);}_0x2f768b[_0xd341('0x48')]=qs[_0xd341('0x49')](_0x5ab207[_0xd341('0x3f')][_0xd341('0x49')]);_0x2f768b['where']=qs['filters'](_[_0xd341('0x4b')](_0x5ab207['query'],_0x1d6b9b['filters']));_0x2f768b[_0xd341('0x4a')]['FaxAccountId']=_0x3d46a3['id'];if(_0x5ab207[_0xd341('0x3f')][_0xd341('0x4c')]){_0x2f768b[_0xd341('0x4a')]=_[_0xd341('0x4d')](_0x2f768b[_0xd341('0x4a')],{'$or':_[_0xd341('0x3a')](_0x2f768b[_0xd341('0x45')],function(_0xa853c0){var _0x5b355c={};_0x5b355c[_0xa853c0]={'$like':'%'+_0x5ab207[_0xd341('0x3f')][_0xd341('0x4c')]+'%'};return _0x5b355c;})});}_0x2f768b=_[_0xd341('0x4d')]({},_0x2f768b,_0x5ab207[_0xd341('0x50')]);return db[_0xd341('0x6b')][_0xd341('0x2f')]({'where':_0x2f768b[_0xd341('0x4a')]})['then'](function(_0x101e9e){_0x2743b7[_0xd341('0x2f')]=_0x101e9e;if(_0x5ab207[_0xd341('0x3f')][_0xd341('0x51')]){_0x2f768b[_0xd341('0x57')]=[{'all':!![]}];}return db[_0xd341('0x6b')][_0xd341('0x52')](_0x2f768b);})[_0xd341('0x1e')](function(_0x119e54){_0x2743b7[_0xd341('0x53')]=_0x119e54;return _0x2743b7;});}})['then'](respondWithFilteredResult(_0x47ae78,_0x2f768b))['catch'](handleError(_0x47ae78,null));};exports[_0xd341('0x6d')]=function(_0x4cbde7,_0xcd7a0,_0x448b68){return db[_0xd341('0x3b')][_0xd341('0x58')]({'where':{'id':_0x4cbde7[_0xd341('0x55')]['id']}})['then'](handleEntityNotFound(_0xcd7a0,null))[_0xd341('0x1e')](function(_0x589999){if(_0x589999){return _0x589999['removeAnswers'](_0x4cbde7[_0xd341('0x3f')]['ids']);}})['then'](respondWithStatusCode(_0xcd7a0,null))['catch'](handleError(_0xcd7a0,null));};exports['addInteraction']=function(_0x5affa9,_0x4d2d8a,_0x5b997c){return db[_0xd341('0x6e')][_0xd341('0x58')]({'where':{'id':_0x5affa9['params']['id']}})[_0xd341('0x1e')](handleEntityNotFound(_0x4d2d8a,null))[_0xd341('0x1e')](function(_0x316f94){if(_0x316f94){return _0x316f94['addInteraction'](_0x5affa9[_0xd341('0x5a')][_0xd341('0x6a')],_[_0xd341('0x6f')](_0x5affa9['body'],[_0xd341('0x6a'),'id'])||{});}})[_0xd341('0x1e')](respondWithResult(_0x4d2d8a,null))[_0xd341('0x29')](handleError(_0x4d2d8a,null));};exports['getInteractions']=function(_0x2ebc1a,_0x2428b6,_0x1313f1){var _0x599db8={'raw':![],'where':{}};var _0x54a439={};var _0x5674b5={'count':0x0,'rows':[]};return db['FaxAccount'][_0xd341('0x68')]({'where':{'id':_0x2ebc1a[_0xd341('0x55')]['id']}})[_0xd341('0x1e')](handleEntityNotFound(_0x2428b6,null))[_0xd341('0x1e')](function(_0x2008ae){if(_0x2008ae){_0x54a439['model']=_[_0xd341('0x40')](db[_0xd341('0x6e')][_0xd341('0x56')]);_0x54a439[_0xd341('0x3f')]=_[_0xd341('0x40')](_0x2ebc1a[_0xd341('0x3f')]);_0x54a439[_0xd341('0x41')]=_[_0xd341('0x43')](_0x54a439['model'],_0x54a439['query']);_0x599db8[_0xd341('0x45')]=_[_0xd341('0x43')](_0x54a439[_0xd341('0x42')],qs[_0xd341('0x44')](_0x2ebc1a[_0xd341('0x3f')][_0xd341('0x44')]));_0x599db8['attributes']=_0x599db8['attributes']['length']?_0x599db8['attributes']:_0x54a439['model'];if(!_0x2ebc1a['query']['hasOwnProperty'](_0xd341('0x6c'))){_0x599db8['limit']=qs[_0xd341('0x2e')](_0x2ebc1a[_0xd341('0x3f')][_0xd341('0x2e')]);_0x599db8[_0xd341('0x30')]=qs[_0xd341('0x30')](_0x2ebc1a[_0xd341('0x3f')][_0xd341('0x30')]);}_0x599db8[_0xd341('0x48')]=qs[_0xd341('0x49')](_0x2ebc1a['query']['sort']);_0x599db8[_0xd341('0x4a')]=qs[_0xd341('0x41')](_[_0xd341('0x4b')](_0x2ebc1a[_0xd341('0x3f')],_0x54a439[_0xd341('0x41')]));_0x599db8[_0xd341('0x4a')]['FaxAccountId']=_0x2008ae['id'];if(_0x2ebc1a[_0xd341('0x3f')][_0xd341('0x4c')]){_0x599db8[_0xd341('0x4a')]=_[_0xd341('0x4d')](_0x599db8[_0xd341('0x4a')],{'$or':_[_0xd341('0x3a')](_0x599db8[_0xd341('0x45')],function(_0x1932a4){var _0x4dc9e6={};_0x4dc9e6[_0x1932a4]={'$like':'%'+_0x2ebc1a[_0xd341('0x3f')]['filter']+'%'};return _0x4dc9e6;})});}_0x599db8=_['merge']({},_0x599db8,_0x2ebc1a[_0xd341('0x50')]);return db[_0xd341('0x6e')]['count']({'where':_0x599db8[_0xd341('0x4a')]})['then'](function(_0x34f85f){_0x5674b5[_0xd341('0x2f')]=_0x34f85f;if(_0x2ebc1a[_0xd341('0x3f')][_0xd341('0x51')]){_0x599db8[_0xd341('0x57')]=[{'model':db['CmContact'],'as':_0xd341('0x70'),'required':![]},{'model':db['User'],'as':_0xd341('0x71'),'attributes':['name',_0xd341('0x72'),_0xd341('0x73')],'required':![]},{'model':db[_0xd341('0x74')],'as':_0xd341('0x75'),'attributes':['id',_0xd341('0x4f'),_0xd341('0x76')],'where':_0x2ebc1a[_0xd341('0x3f')][_0xd341('0x77')]?{'id':_0x2ebc1a[_0xd341('0x3f')][_0xd341('0x77')]}:undefined,'required':_0x2ebc1a['query'][_0xd341('0x77')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x599db8);})['then'](function(_0x272998){_0x5674b5[_0xd341('0x53')]=_0x272998;return _0x5674b5;});}})['then'](respondWithFilteredResult(_0x2428b6,_0x599db8))['catch'](handleError(_0x2428b6,null));};exports[_0xd341('0x78')]=function(_0x157965,_0x548195,_0x546426){return db[_0xd341('0x3b')][_0xd341('0x68')]({'where':{'id':_0x157965[_0xd341('0x55')]['id']}})[_0xd341('0x1e')](handleEntityNotFound(_0x548195,null))['then'](function(_0xa9d753){if(_0xa9d753){return db[_0xd341('0x79')][_0xd341('0x7a')](function(_0x7eda76){return db[_0xd341('0x7b')][_0xd341('0x37')]({'where':{'FaxAccountId':_0x157965['params']['id']},'transaction':_0x7eda76})[_0xd341('0x1e')](function(_0x4b5a78){var _0x3a0ed9=_['map'](_0x157965[_0xd341('0x5a')],function(_0x59fa6b){_0x59fa6b[_0xd341('0x65')]=_0x157965[_0xd341('0x55')]['id'];return _0x59fa6b;});return db['FaxApplication'][_0xd341('0x7c')](_0x3a0ed9,{'transaction':_0x7eda76});});})[_0xd341('0x1e')](function(){return db[_0xd341('0x7b')][_0xd341('0x7d')]({'where':{'FaxAccountId':_0x157965[_0xd341('0x55')]['id']},'order':_0xd341('0x7e')});});}})[_0xd341('0x1e')](respondWithResult(_0x548195,null))['catch'](handleError(_0x548195,null));};exports[_0xd341('0x7f')]=function(_0x1fb6ec,_0x34daa4,_0x2e70d5){var _0x45a1ab={};var _0x4c8bb7={};var _0x5db0b6;var _0x182b31;return db[_0xd341('0x3b')]['findOne']({'where':{'id':_0x1fb6ec[_0xd341('0x55')]['id']}})[_0xd341('0x1e')](handleEntityNotFound(_0x34daa4,null))[_0xd341('0x1e')](function(_0x622737){if(_0x622737){_0x5db0b6=_0x622737;_0x4c8bb7[_0xd341('0x42')]=_[_0xd341('0x40')](db[_0xd341('0x7b')][_0xd341('0x56')]);_0x4c8bb7['query']=_[_0xd341('0x40')](_0x1fb6ec[_0xd341('0x3f')]);_0x4c8bb7[_0xd341('0x41')]=_[_0xd341('0x43')](_0x4c8bb7[_0xd341('0x42')],_0x4c8bb7['query']);_0x45a1ab[_0xd341('0x45')]=_[_0xd341('0x43')](_0x4c8bb7[_0xd341('0x42')],qs[_0xd341('0x44')](_0x1fb6ec['query'][_0xd341('0x44')]));_0x45a1ab[_0xd341('0x45')]=_0x45a1ab[_0xd341('0x45')][_0xd341('0x46')]?_0x45a1ab[_0xd341('0x45')]:_0x4c8bb7[_0xd341('0x42')];_0x45a1ab[_0xd341('0x48')]=qs[_0xd341('0x49')](_0x1fb6ec[_0xd341('0x3f')][_0xd341('0x49')]);_0x45a1ab[_0xd341('0x4a')]=qs['filters'](_[_0xd341('0x4b')](_0x1fb6ec[_0xd341('0x3f')],_0x4c8bb7[_0xd341('0x41')]));if(_0x1fb6ec[_0xd341('0x3f')][_0xd341('0x4c')]){_0x45a1ab['where']=_[_0xd341('0x4d')](_0x45a1ab['where'],{'$or':_['map'](_0x45a1ab['attributes'],function(_0x20a3ca){var _0x172cfd={};_0x172cfd[_0x20a3ca]={'$like':'%'+_0x1fb6ec['query']['filter']+'%'};return _0x172cfd;})});}_0x45a1ab=_['merge']({},_0x45a1ab,_0x1fb6ec[_0xd341('0x50')]);return _0x5db0b6[_0xd341('0x7f')](_0x45a1ab);}})[_0xd341('0x1e')](function(_0x1bf676){if(_0x1bf676){_0x182b31=_0x1bf676[_0xd341('0x46')];if(!_0x1fb6ec[_0xd341('0x3f')][_0xd341('0x47')](_0xd341('0x6c'))){_0x45a1ab['limit']=qs[_0xd341('0x2e')](_0x1fb6ec[_0xd341('0x3f')][_0xd341('0x2e')]);_0x45a1ab['offset']=qs[_0xd341('0x30')](_0x1fb6ec[_0xd341('0x3f')][_0xd341('0x30')]);}return _0x5db0b6[_0xd341('0x7f')](_0x45a1ab);}})['then'](function(_0x353cc7){if(_0x353cc7){return _0x353cc7?{'count':_0x182b31,'rows':_0x353cc7}:null;}})[_0xd341('0x1e')](respondWithResult(_0x34daa4,null))['catch'](handleError(_0x34daa4,null));};function Extension(_0x4770e5,_0xcdd9a3,_0x599708,_0x425145){this['context']=_0xd341('0x80');this[_0xd341('0x81')]=_0x4770e5[_0xd341('0x82')];this[_0xd341('0x83')]=_0x425145;this[_0xd341('0x3d')]=_0xd341('0x84');this[_0xd341('0x85')]=_0xd341('0x86');this[_0xd341('0x65')]=_0x4770e5['id'];this[_0xd341('0x7e')]=_0xcdd9a3;this['appdata']=_0x599708;}function createExtensionsReciveFax(_0x42c51f){var _0x77d775=0x1;var _0x196711=[];_0x196711[_0xd341('0x87')](new Extension(_0x42c51f,_0x77d775,'','Answer'));_0x77d775+=0x1;_0x196711[_0xd341('0x87')](new Extension(_0x42c51f,_0x77d775,_0xd341('0x88'),'Set'));_0x77d775+=0x1;for(var _0x31fd3d in _0x42c51f){if(_0x42c51f[_0xd341('0x47')](_0x31fd3d)&&(_0x31fd3d===_0xd341('0x89')||_0x31fd3d===_0xd341('0x82')||_0x31fd3d===_0xd341('0x8a')||_0x31fd3d===_0xd341('0x8b')||_0x31fd3d===_0xd341('0x8c')||_0x31fd3d==='maxrate'||_0x31fd3d===_0xd341('0x8d')||_0x31fd3d===_0xd341('0x8e')||_0x31fd3d===_0xd341('0x8f'))){_0x196711['push'](new Extension(_0x42c51f,_0x77d775,'FAXOPT('+_0x31fd3d+')='+_0x42c51f[_0x31fd3d],_0xd341('0x90')));_0x77d775+=0x1;}}_0x196711[_0xd341('0x87')](new Extension(_0x42c51f,_0x77d775,'6',_0xd341('0x91')));_0x77d775+=0x1;_0x196711[_0xd341('0x87')](new Extension(_0x42c51f,_0x77d775,_0xd341('0x92'),_0xd341('0x93')));_0x77d775=0x0;return _0x196711;}exports[_0xd341('0x94')]=function(_0x4fa738,_0x2ee80d,_0xaf2aa3){var _0x3edb24;return db[_0xd341('0x79')][_0xd341('0x7a')](function(_0x67cac5){return db[_0xd341('0x3b')]['create'](_0x4fa738['body'],{'transaction':_0x67cac5})['then'](function(_0x2e612d){_0x3edb24=_0x2e612d[_0xd341('0x38')]({'plain':!![]});return db[_0xd341('0x95')][_0xd341('0x7c')](createExtensionsReciveFax(_0x3edb24),{'transaction':_0x67cac5});});})[_0xd341('0x1e')](function(){return _0x3edb24;})[_0xd341('0x1e')](respondWithResult(_0x2ee80d,null))[_0xd341('0x29')](handleError(_0x2ee80d,null));};exports[_0xd341('0x96')]=function(_0x1ce876,_0x25549f,_0x49cc78){var _0x1bb72d;return db[_0xd341('0x79')][_0xd341('0x7a')](function(_0x13f229){return db[_0xd341('0x3b')][_0xd341('0x36')](_0x1ce876[_0xd341('0x5a')],{'where':{'id':_0x1ce876[_0xd341('0x5a')]['id']},'transaction':_0x13f229})['then'](function(_0x183c8b){return db[_0xd341('0x95')][_0xd341('0x37')]({'where':{'FaxAccountId':_0x1ce876[_0xd341('0x5a')]['id']},'transaction':_0x13f229})[_0xd341('0x1e')](function(_0x449704){return db[_0xd341('0x95')][_0xd341('0x7c')](createExtensionsReciveFax(_['omit'](_0x1ce876[_0xd341('0x5a')],[_0xd341('0x97'),_0xd341('0x3e'),_0xd341('0x98'),'updatedAt',_0xd341('0x99'),_0xd341('0x9a')])),{'transaction':_0x13f229});});});})['then'](function(){return db['FaxAccount'][_0xd341('0x9b')](_0x1ce876['body']['id']);})['then'](respondWithResult(_0x25549f,null))[_0xd341('0x29')](handleError(_0x25549f,null));};exports[_0xd341('0x9c')]=function(_0x579dcb,_0x2bd5a7,_0x2fed79){var _0x58e633={'raw':!![],'where':{}};var _0x42431f={};var _0x34bc18={'count':0x0,'rows':[]};return db[_0xd341('0x3b')][_0xd341('0x68')]({'where':{'id':_0x579dcb[_0xd341('0x55')]['id']}})[_0xd341('0x1e')](handleEntityNotFound(_0x2bd5a7,null))[_0xd341('0x1e')](function(_0xbd3139){if(_0xbd3139){_0x42431f['model']=_[_0xd341('0x40')](db[_0xd341('0x9d')][_0xd341('0x56')]);_0x42431f['query']=_['keys'](_0x579dcb[_0xd341('0x3f')]);_0x42431f[_0xd341('0x41')]=_[_0xd341('0x43')](_0x42431f[_0xd341('0x42')],_0x42431f[_0xd341('0x3f')]);_0x58e633[_0xd341('0x45')]=_[_0xd341('0x43')](_0x42431f[_0xd341('0x42')],qs[_0xd341('0x44')](_0x579dcb['query'][_0xd341('0x44')]));_0x58e633[_0xd341('0x45')]=_0x58e633['attributes'][_0xd341('0x46')]?_0x58e633['attributes']:_0x42431f[_0xd341('0x42')];if(!_0x579dcb[_0xd341('0x3f')][_0xd341('0x47')](_0xd341('0x6c'))){_0x58e633[_0xd341('0x2e')]=qs[_0xd341('0x2e')](_0x579dcb[_0xd341('0x3f')][_0xd341('0x2e')]);_0x58e633[_0xd341('0x30')]=qs[_0xd341('0x30')](_0x579dcb[_0xd341('0x3f')][_0xd341('0x30')]);}_0x58e633[_0xd341('0x48')]=qs['sort'](_0x579dcb[_0xd341('0x3f')][_0xd341('0x49')]);_0x58e633[_0xd341('0x4a')]=qs[_0xd341('0x41')](_['pick'](_0x579dcb[_0xd341('0x3f')],_0x42431f[_0xd341('0x41')]));_0x58e633['where'][_0xd341('0x65')]=_0xbd3139['id'];if(_0x579dcb[_0xd341('0x3f')]['filter']){_0x58e633[_0xd341('0x4a')]=_[_0xd341('0x4d')](_0x58e633[_0xd341('0x4a')],{'$or':_['map'](_0x58e633[_0xd341('0x45')],function(_0x5eb4ce){var _0x329c83={};_0x329c83[_0x5eb4ce]={'$like':'%'+_0x579dcb[_0xd341('0x3f')]['filter']+'%'};return _0x329c83;})});}if(_0x579dcb[_0xd341('0x3f')]['$gte']){var _0xb30715=_0x579dcb[_0xd341('0x3f')][_0xd341('0x9e')][_0xd341('0x9f')](',');var _0x53c398={};_0x53c398[_0xb30715[0x0]]={'$gte':moment(_0xb30715[0x1])[_0xd341('0xa0')](_0xd341('0xa1'))};_0x58e633['where']=_[_0xd341('0x4d')](_0x58e633[_0xd341('0x4a')],_0x53c398);}_0x58e633=_['merge']({},_0x58e633,_0x579dcb[_0xd341('0x50')]);return db['FaxMessage']['count']({'where':_0x58e633[_0xd341('0x4a')]})['then'](function(_0x310c76){_0x34bc18['count']=_0x310c76;if(_0x579dcb['query'][_0xd341('0x51')]){_0x58e633[_0xd341('0x57')]=[{'all':!![]}];}return db['FaxMessage'][_0xd341('0x52')](_0x58e633);})[_0xd341('0x1e')](function(_0x15a6fa){_0x34bc18['rows']=_0x15a6fa;return _0x34bc18;});}})[_0xd341('0x1e')](respondWithFilteredResult(_0x2bd5a7,_0x58e633))[_0xd341('0x29')](handleError(_0x2bd5a7,null));};exports[_0xd341('0xa2')]=function(_0x1865c6,_0x249c3d,_0x3df96a){var _0x480886,_0x18bfc5={},_0x18ad80;if(_0x1865c6[_0xd341('0x5a')]['to']){_0x18ad80=_0x1865c6['body']['to'][0x0];}return db['FaxAccount'][_0xd341('0x58')]({'where':{'id':_0x1865c6['params']['id']},'include':[{'model':db[_0xd341('0xa3')],'as':_0xd341('0xa4'),'include':[{'model':db['CmContact'],'as':_0xd341('0xa5'),'where':{'fax':_0x18ad80},'limit':0x1,'order':[[_0xd341('0xa6'),_0xd341('0xa7')]]}]}]})[_0xd341('0x1e')](handleEntityNotFound(_0x249c3d,null))[_0xd341('0x1e')](function(_0x46ec8b){_0x480886=_0x46ec8b;if(_0x1865c6['body'][_0xd341('0xa8')]&&_0x1865c6[_0xd341('0x5a')]['attachments']['length']){for(var _0x31d5f2=0x0;_0x31d5f2<_0x1865c6[_0xd341('0x5a')]['attachments']['length'];_0x31d5f2+=0x1){_0x1865c6[_0xd341('0x5a')]['attachments'][_0x31d5f2]={'filename':_0x1865c6[_0xd341('0x5a')][_0xd341('0xa8')][_0x31d5f2][_0xd341('0x4f')],'id':_0x1865c6[_0xd341('0x5a')][_0xd341('0xa8')][_0x31d5f2]['id'],'path':path[_0xd341('0xa9')](config['root'],'server/files/attachments',_0x1865c6[_0xd341('0x5a')]['attachments'][_0x31d5f2][_0xd341('0xaa')])};}}return respondWithRpcPromise(_0xd341('0xab'),_0xd341('0xab'),{'FaxAccountId':_[_0xd341('0xac')](_0x1865c6[_0xd341('0x55')]['id'])?undefined:_0x1865c6['params']['id'],'path':_[_0xd341('0xac')](_0x1865c6[_0xd341('0x5a')][_0xd341('0xa8')][0x0][_0xd341('0xad')])?undefined:_0x1865c6[_0xd341('0x5a')][_0xd341('0xa8')][0x0][_0xd341('0xad')],'fax':_[_0xd341('0xac')](_0x1865c6[_0xd341('0x5a')]['to'][0x0])?undefined:_0x1865c6[_0xd341('0x5a')]['to'][0x0]},client9002);})[_0xd341('0x1e')](function(){if(_0x480886){if(_[_0xd341('0xac')](_0x1865c6[_0xd341('0x5a')][_0xd341('0xae')])){_0x1865c6[_0xd341('0x5a')][_0xd341('0xae')]=util[_0xd341('0xa0')](_0xd341('0xaf'),_0x480886[_0xd341('0x4f')],_0x480886[_0xd341('0xb0')]);}if(_0x480886[_0xd341('0xa4')]){if(_0x480886[_0xd341('0xa4')]['Contacts'][_0xd341('0x46')]){return _0x480886[_0xd341('0xa4')][_0xd341('0xa5')][0x0];}else{return db[_0xd341('0xb1')]['create'](_[_0xd341('0x16')](_0x1865c6[_0xd341('0x5a')],{'firstName':_0x1865c6[_0xd341('0x5a')]['to'][0x0],'phone':_0x1865c6[_0xd341('0x5a')]['to'][0x0],'fax':_0x1865c6[_0xd341('0x5a')]['to'][0x0],'ListId':_0x480886[_0xd341('0x9a')]}));}}else{throw new Error(_0xd341('0xb2'));}}else{throw new Error(_0xd341('0xb3'));}})[_0xd341('0x1e')](function(_0x42bb1d){if(_0x42bb1d){return db[_0xd341('0x6e')][_0xd341('0x58')]({'where':{'ContactId':_0x42bb1d['id'],'closed':![],'FaxAccountId':_0x480886['id']}})[_0xd341('0x1e')](function(_0x102dcc){if(_0x102dcc){return[_0x102dcc,![]];}return db['FaxInteraction'][_0xd341('0x59')]({'UserId':_0x1865c6[_0xd341('0xb4')]['id'],'ContactId':_0x42bb1d['id'],'FaxAccountId':_0x480886['id'],'fax':_0x1865c6[_0xd341('0x5a')]['to'][0x0],'firstMsgDirection':_0xd341('0xb5'),'Messages':[_[_0xd341('0x4d')](_0x1865c6[_0xd341('0x5a')],{'read':![],'body':_0x1865c6[_0xd341('0x5a')][_0xd341('0xa8')][0x0][_0xd341('0xb6')],'FaxAccountId':_0x480886['id'],'UserId':_0x1865c6[_0xd341('0xb4')]['id'],'ContactId':_0x42bb1d['id'],'AttachmentId':_0x1865c6[_0xd341('0x5a')][_0xd341('0xa8')][0x0]['id']})]},{'include':[{'model':db[_0xd341('0x9d')],'as':_0xd341('0xb7')}]})[_0xd341('0x1e')](function(_0x1e5c6e){return[_0x1e5c6e,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xd341('0xb8')](function(_0x35bebe,_0x479c69){if(_0x479c69){return _0x35bebe;}return db[_0xd341('0x9d')][_0xd341('0x59')]({'direction':_0xd341('0xb5'),'read':![],'body':_0x1865c6[_0xd341('0x5a')][_0xd341('0xa8')][0x0][_0xd341('0xb6')],'FaxAccountId':_0x480886['id'],'FaxInteractionId':_0x35bebe['id'],'UserId':_0x1865c6['user']['id'],'ContactId':_0x35bebe[_0xd341('0xb9')],'AttachmentId':_0x1865c6[_0xd341('0x5a')]['attachments'][0x0]['id']})[_0xd341('0x1e')](function(_0x192714){_0x35bebe['dataValues'][_0xd341('0xb7')]=[];_0x35bebe[_0xd341('0xba')][_0xd341('0xb7')][_0xd341('0x87')](_0x192714[_0xd341('0xba')]);return _0x35bebe;});})[_0xd341('0x1e')](function(_0x42f97d){respondWithRpcPromise('SendFax',_0xd341('0xbb'),{'FaxAccountId':_[_0xd341('0xac')](_0x1865c6[_0xd341('0x55')]['id'])?undefined:_0x1865c6[_0xd341('0x55')]['id'],'path':_[_0xd341('0xac')](_0x1865c6['body'][_0xd341('0xa8')][0x0][_0xd341('0xad')])?undefined:_0x1865c6[_0xd341('0x5a')][_0xd341('0xa8')][0x0][_0xd341('0xad')],'fax':_[_0xd341('0xac')](_0x1865c6[_0xd341('0x5a')]['to'][0x0])?undefined:_0x1865c6[_0xd341('0x5a')]['to'][0x0],'AttachmentId':_0x1865c6[_0xd341('0x5a')]['attachments'][0x0]['id']},client9002)['then'](function(_0x3ead9d){logger[_0xd341('0x26')](_0xd341('0xbc'),_0x3ead9d);})[_0xd341('0x29')](function(_0x1d4189){logger[_0xd341('0x26')](_0xd341('0xbc'),_0x1d4189);});return _0x42f97d;})[_0xd341('0x1e')](respondWithResult(_0x249c3d,null))[_0xd341('0x29')](handleError(_0x249c3d,null));};exports[_0xd341('0xbd')]=function(_0xfda73c,_0x3727b3,_0x3a766a){return db[_0xd341('0x3b')][_0xd341('0x58')]({'where':{'id':_0xfda73c[_0xd341('0x55')]['id']}})[_0xd341('0x1e')](handleEntityNotFound(_0x3727b3,null))['then'](function(_0x7b2629){if(_0x7b2629){return _0x7b2629['addAgents'](_0xfda73c['body']['ids'],_[_0xd341('0x6f')](_0xfda73c[_0xd341('0x5a')],[_0xd341('0x6a'),'id'])||{})[_0xd341('0xb8')](function(_0x50ad2c){for(var _0x40dece=0x0;_0x40dece<_0xfda73c['body'][_0xd341('0x6a')]['length'];_0x40dece+=0x1){socket[_0xd341('0xbe')](_0xd341('0xbf'),{'UserId':_0xfda73c[_0xd341('0x5a')][_0xd341('0x6a')][_0x40dece],'FaxAccountId':_0xfda73c[_0xd341('0x55')]['id']});}return _0x50ad2c;});}})['then'](respondWithResult(_0x3727b3,null))['catch'](handleError(_0x3727b3,null));};exports[_0xd341('0xc0')]=function(_0x2ef847,_0x3f9247,_0x27add4){return db[_0xd341('0x3b')][_0xd341('0x58')]({'where':{'id':_0x2ef847[_0xd341('0x55')]['id']}})[_0xd341('0x1e')](handleEntityNotFound(_0x3f9247,null))[_0xd341('0x1e')](function(_0x1765f4){if(_0x1765f4){return _0x1765f4[_0xd341('0xc0')](_0x2ef847[_0xd341('0x3f')][_0xd341('0x6a')])[_0xd341('0x1e')](function(){if(_[_0xd341('0xc1')](_0x2ef847['query'][_0xd341('0x6a')])){for(var _0x37d839=0x0;_0x37d839<_0x2ef847[_0xd341('0x3f')][_0xd341('0x6a')][_0xd341('0x46')];_0x37d839+=0x1){socket[_0xd341('0xbe')](_0xd341('0xc2'),{'UserId':Number(_0x2ef847['query'][_0xd341('0x6a')][_0x37d839]),'FaxAccountId':Number(_0x2ef847[_0xd341('0x55')]['id'])});}}else{socket[_0xd341('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0x2ef847[_0xd341('0x3f')][_0xd341('0x6a')]),'FaxAccountId':Number(_0x2ef847[_0xd341('0x55')]['id'])});}});}})[_0xd341('0x1e')](respondWithStatusCode(_0x3f9247,null))['catch'](handleError(_0x3f9247,null));};exports['getAgents']=function(_0x5aa60c,_0x5aa0d7,_0x5410f4){var _0x2d2af7={};var _0x175490={};var _0x57355f;var _0x29a4f3;return db[_0xd341('0x3b')]['findOne']({'where':{'id':_0x5aa60c['params']['id']}})[_0xd341('0x1e')](handleEntityNotFound(_0x5aa0d7,null))[_0xd341('0x1e')](function(_0x581549){if(_0x581549){_0x57355f=_0x581549;_0x175490[_0xd341('0x42')]=_[_0xd341('0x40')](db[_0xd341('0xc3')][_0xd341('0x56')]);_0x175490[_0xd341('0x3f')]=_[_0xd341('0x40')](_0x5aa60c[_0xd341('0x3f')]);_0x175490[_0xd341('0x41')]=_[_0xd341('0x43')](_0x175490[_0xd341('0x42')],_0x175490[_0xd341('0x3f')]);_0x2d2af7[_0xd341('0x45')]=_[_0xd341('0x43')](_0x175490['model'],qs[_0xd341('0x44')](_0x5aa60c[_0xd341('0x3f')][_0xd341('0x44')]));_0x2d2af7[_0xd341('0x45')]=_0x2d2af7[_0xd341('0x45')]['length']?_0x2d2af7[_0xd341('0x45')]:_0x175490[_0xd341('0x42')];_0x2d2af7[_0xd341('0x48')]=qs[_0xd341('0x49')](_0x5aa60c[_0xd341('0x3f')][_0xd341('0x49')]);_0x2d2af7[_0xd341('0x4a')]=qs[_0xd341('0x41')](_[_0xd341('0x4b')](_0x5aa60c[_0xd341('0x3f')],_0x175490[_0xd341('0x41')]));if(_0x5aa60c['query'][_0xd341('0x4c')]){_0x2d2af7[_0xd341('0x4a')]=_[_0xd341('0x4d')](_0x2d2af7['where'],{'$or':_[_0xd341('0x3a')](_0x2d2af7[_0xd341('0x45')],function(_0x5d34d7){var _0x1e09df={};_0x1e09df[_0x5d34d7]={'$like':'%'+_0x5aa60c[_0xd341('0x3f')]['filter']+'%'};return _0x1e09df;})});}_0x2d2af7=_[_0xd341('0x4d')]({},_0x2d2af7,_0x5aa60c[_0xd341('0x50')]);return _0x57355f[_0xd341('0xc4')](_0x2d2af7);}})[_0xd341('0x1e')](function(_0x3d7ac1){if(_0x3d7ac1){_0x29a4f3=_0x3d7ac1[_0xd341('0x46')];if(!_0x5aa60c[_0xd341('0x3f')]['hasOwnProperty'](_0xd341('0x6c'))){_0x2d2af7['limit']=qs[_0xd341('0x2e')](_0x5aa60c['query'][_0xd341('0x2e')]);_0x2d2af7[_0xd341('0x30')]=qs[_0xd341('0x30')](_0x5aa60c[_0xd341('0x3f')][_0xd341('0x30')]);}return _0x57355f[_0xd341('0xc4')](_0x2d2af7);}})[_0xd341('0x1e')](function(_0x30b633){if(_0x30b633){return _0x30b633?{'count':_0x29a4f3,'rows':_0x30b633}:null;}})['then'](respondWithResult(_0x5aa0d7,null))['catch'](handleError(_0x5aa0d7,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 7c276da..7f74b09 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 _0x0102=['setMaxListeners','save','emit','hasOwnProperty','exports','../../mysqldb','FaxAccount'];(function(_0x582b33,_0x4cac7b){var _0x4ca81a=function(_0x3a2242){while(--_0x3a2242){_0x582b33['push'](_0x582b33['shift']());}};_0x4ca81a(++_0x4cac7b);}(_0x0102,0x186));var _0x2010=function(_0x2a421b,_0x5e5167){_0x2a421b=_0x2a421b-0x0;var _0x51efb0=_0x0102[_0x2a421b];return _0x51efb0;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x2010('0x0'))['db'][_0x2010('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x2010('0x2')](0x0);var events={'afterCreate':_0x2010('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x575b0a){return function(_0x4e30b3,_0x59082d,_0x22e49f){FaxAccountEvents[_0x2010('0x4')](_0x575b0a+':'+_0x4e30b3['id'],_0x4e30b3);FaxAccountEvents[_0x2010('0x4')](_0x575b0a,_0x4e30b3);_0x22e49f(null);};}for(var e in events){if(events[_0x2010('0x5')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x2010('0x6')]=FaxAccountEvents; \ No newline at end of file +var _0x6cd7=['exports','events','FaxAccount','setMaxListeners','save','update','remove','emit','hook'];(function(_0x3eb713,_0x437874){var _0x1d7128=function(_0x2b9cea){while(--_0x2b9cea){_0x3eb713['push'](_0x3eb713['shift']());}};_0x1d7128(++_0x437874);}(_0x6cd7,0x1de));var _0x76cd=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x6cd7[_0x2ec461];return _0x28603d;};'use strict';var EventEmitter=require(_0x76cd('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x76cd('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x76cd('0x2')](0x0);var events={'afterCreate':_0x76cd('0x3'),'afterUpdate':_0x76cd('0x4'),'afterDestroy':_0x76cd('0x5')};function emitEvent(_0x13e497){return function(_0x16b7a8,_0x5c29fd,_0x5e0248){FaxAccountEvents[_0x76cd('0x6')](_0x13e497+':'+_0x16b7a8['id'],_0x16b7a8);FaxAccountEvents[_0x76cd('0x6')](_0x13e497,_0x16b7a8);_0x5e0248(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x76cd('0x7')](e,emitEvent(event));}}module[_0x76cd('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index c709767..28d0561 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 _0xb88c=['request-promise','path','rimraf','./faxAccount.attributes','define','FaxAccount','lodash','util','../../config/logger','moment'];(function(_0x1a4c39,_0x13aade){var _0x55b641=function(_0x222d9f){while(--_0x222d9f){_0x1a4c39['push'](_0x1a4c39['shift']());}};_0x55b641(++_0x13aade);}(_0xb88c,0x178));var _0xcb88=function(_0x2d2885,_0x667d70){_0x2d2885=_0x2d2885-0x0;var _0x2cea6=_0xb88c[_0x2d2885];return _0x2cea6;};'use strict';var _=require(_0xcb88('0x0'));var util=require(_0xcb88('0x1'));var logger=require(_0xcb88('0x2'))('api');var moment=require(_0xcb88('0x3'));var BPromise=require('bluebird');var rp=require(_0xcb88('0x4'));var fs=require('fs');var path=require(_0xcb88('0x5'));var rimraf=require(_0xcb88('0x6'));var config=require('../../config/environment');var attributes=require(_0xcb88('0x7'));module['exports']=function(_0x28c97d,_0x5aab73){return _0x28c97d[_0xcb88('0x8')](_0xcb88('0x9'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c73=['bluebird','request-promise','path','rimraf','./faxAccount.attributes','exports','define','FaxAccount','util','../../config/logger','api','moment'];(function(_0x4de222,_0x22f7ee){var _0x27c851=function(_0x4775da){while(--_0x4775da){_0x4de222['push'](_0x4de222['shift']());}};_0x27c851(++_0x22f7ee);}(_0x9c73,0xa4));var _0x39c7=function(_0x1d1f8c,_0x4c9727){_0x1d1f8c=_0x1d1f8c-0x0;var _0x1d90e2=_0x9c73[_0x1d1f8c];return _0x1d90e2;};'use strict';var _=require('lodash');var util=require(_0x39c7('0x0'));var logger=require(_0x39c7('0x1'))(_0x39c7('0x2'));var moment=require(_0x39c7('0x3'));var BPromise=require(_0x39c7('0x4'));var rp=require(_0x39c7('0x5'));var fs=require('fs');var path=require(_0x39c7('0x6'));var rimraf=require(_0x39c7('0x7'));var config=require('../../config/environment');var attributes=require(_0x39c7('0x8'));module[_0x39c7('0x9')]=function(_0x2029a0,_0x501129){return _0x2029a0[_0x39c7('0xa')](_0x39c7('0xb'),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 e9351b2..32e09b3 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 _0xdc1f=['FaxApplication','Applications','list','List','applications','priority','asc','length','create','contact','Contact\x20not\x20found','spread','get','autoclose','close','unmanaged','created','interaction','FaxMessage','UserId','User','find','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','FaxAccount,\x20%s,\x20%s','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','include','map','model','attributes','NotifyFaxAccount','body','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','CmList','Contacts','DESC'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xdc1f,0x78));var _0xfdc1=function(_0xaf12a7,_0x2ee396){_0xaf12a7=_0xaf12a7-0x0;var _0x38cc23=_0xdc1f[_0xaf12a7];return _0x38cc23;};'use strict';var _=require(_0xfdc1('0x0'));var util=require(_0xfdc1('0x1'));var moment=require('moment');var BPromise=require(_0xfdc1('0x2'));var rs=require(_0xfdc1('0x3'));var fs=require('fs');var Redis=require(_0xfdc1('0x4'));var db=require(_0xfdc1('0x5'))['db'];var utils=require(_0xfdc1('0x6'));var logger=require(_0xfdc1('0x7'))(_0xfdc1('0x8'));var config=require(_0xfdc1('0x9'));var jayson=require(_0xfdc1('0xa'));var client=jayson['client']['http']({'port':0x232c});config[_0xfdc1('0xb')]=_[_0xfdc1('0xc')](config[_0xfdc1('0xb')],{'host':_0xfdc1('0xd'),'port':0x18eb});var socket=require(_0xfdc1('0xe'))(new Redis(config[_0xfdc1('0xb')]));require(_0xfdc1('0xf'))[_0xfdc1('0x10')](socket);function respondWithRpcPromise(_0x4c3f6e,_0x466d61,_0x518186){return new BPromise(function(_0x13f794,_0x320141){return client['request'](_0x4c3f6e,_0x518186)[_0xfdc1('0x11')](function(_0x34d151){logger[_0xfdc1('0x12')]('FaxAccount,\x20%s,\x20%s',_0x466d61,_0xfdc1('0x13'));logger[_0xfdc1('0x14')](_0xfdc1('0x15'),_0x466d61,_0xfdc1('0x13'),JSON['stringify'](_0x34d151));if(_0x34d151[_0xfdc1('0x16')]){if(_0x34d151[_0xfdc1('0x16')][_0xfdc1('0x17')]===0x1f4){logger[_0xfdc1('0x16')]('FaxAccount,\x20%s,\x20%s',_0x466d61,_0x34d151['error']['message']);return _0x320141(_0x34d151[_0xfdc1('0x16')][_0xfdc1('0x18')]);}logger[_0xfdc1('0x16')](_0xfdc1('0x19'),_0x466d61,_0x34d151[_0xfdc1('0x16')][_0xfdc1('0x18')]);return _0x13f794(_0x34d151['error'][_0xfdc1('0x18')]);}else{logger[_0xfdc1('0x12')]('FaxAccount,\x20%s,\x20%s',_0x466d61,_0xfdc1('0x13'));_0x13f794(_0x34d151[_0xfdc1('0x1a')][_0xfdc1('0x18')]);}})[_0xfdc1('0x1b')](function(_0x583e89){logger['error']('FaxAccount,\x20%s,\x20%s',_0x466d61,_0x583e89);_0x320141(_0x583e89);});});}exports[_0xfdc1('0x1c')]=function(_0xae39c4){var _0x3a4c7b=this;return new Promise(function(_0x312d2e,_0x55afbe){return db[_0xfdc1('0x1d')][_0xfdc1('0x1e')]({'raw':_0xae39c4[_0xfdc1('0x1f')]?_0xae39c4[_0xfdc1('0x1f')][_0xfdc1('0x20')]===undefined?!![]:![]:!![],'where':_0xae39c4[_0xfdc1('0x1f')]?_0xae39c4[_0xfdc1('0x1f')][_0xfdc1('0x21')]||null:null,'attributes':_0xae39c4[_0xfdc1('0x1f')]?_0xae39c4[_0xfdc1('0x1f')]['attributes']||null:null,'limit':_0xae39c4[_0xfdc1('0x1f')]?_0xae39c4[_0xfdc1('0x1f')]['limit']||null:null,'include':_0xae39c4[_0xfdc1('0x1f')]?_0xae39c4[_0xfdc1('0x1f')][_0xfdc1('0x22')]?_[_0xfdc1('0x23')](_0xae39c4[_0xfdc1('0x1f')][_0xfdc1('0x22')],function(_0x1674e5){return{'model':db[_0x1674e5[_0xfdc1('0x24')]],'as':_0x1674e5['as'],'attributes':_0x1674e5[_0xfdc1('0x25')],'include':_0x1674e5['include']?_[_0xfdc1('0x23')](_0x1674e5[_0xfdc1('0x22')],function(_0x81467b){return{'model':db[_0x81467b[_0xfdc1('0x24')]],'as':_0x81467b['as'],'attributes':_0x81467b[_0xfdc1('0x25')],'include':_0x81467b[_0xfdc1('0x22')]?_[_0xfdc1('0x23')](_0x81467b[_0xfdc1('0x22')],function(_0x451624){return{'model':db[_0x451624[_0xfdc1('0x24')]],'as':_0x451624['as'],'attributes':_0x451624['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a14e1){logger[_0xfdc1('0x12')](_0xfdc1('0x1c'),_0xae39c4);logger['debug'](_0xfdc1('0x1c'),_0xae39c4,JSON['stringify'](_0x2a14e1));_0x312d2e(_0x2a14e1);})['catch'](function(_0x294948){logger[_0xfdc1('0x16')](_0xfdc1('0x1c'),_0x294948[_0xfdc1('0x18')],_0xae39c4);_0x55afbe(_0x3a4c7b['error'](0x1f4,_0x294948['message']));});});};exports[_0xfdc1('0x26')]=function(_0x286ff8,_0x2e152d,_0x4e0487){var _0x384b72=this;return new Promise(function(_0xc69e58,_0x3dae48){var _0x1b5977={'body':_0x286ff8[_0xfdc1('0x27')],'channel':_0xfdc1('0x28')};var _0xa50831=[];var _0x2e1d37=[];var _0x731976={};return db['CmContact'][_0xfdc1('0x29')]()[_0xfdc1('0x11')](function(_0x517ad7){if(!_0x517ad7){throw new db[(_0xfdc1('0x2a'))][(_0xfdc1('0x2b'))](_0xfdc1('0x2c'));}_0xa50831=_[_0xfdc1('0x2d')](_[_0xfdc1('0x2e')](_0x517ad7),[_0xfdc1('0x2f'),'updatedAt']);_0x2e1d37=_[_0xfdc1('0x2d')](_[_0xfdc1('0x2e')](_0x517ad7),[_0xfdc1('0x2f'),_0xfdc1('0x30'),_0xfdc1('0x31'),_0xfdc1('0x32')]);if(_0x286ff8[_0xfdc1('0x27')]['id']){delete _0x286ff8[_0xfdc1('0x27')]['id'];}if(_[_0xfdc1('0x33')](_0x286ff8[_0xfdc1('0x27')][_0xfdc1('0x34')])){throw new db['Sequelize'][(_0xfdc1('0x2b'))](_0xfdc1('0x35'));}if(_[_0xfdc1('0x33')](_0x286ff8[_0xfdc1('0x27')]['body'])||_0x286ff8[_0xfdc1('0x27')][_0xfdc1('0x27')]===''){throw new db['Sequelize'][(_0xfdc1('0x2b'))](_0xfdc1('0x36'));}if(_[_0xfdc1('0x33')](_0x286ff8[_0xfdc1('0x27')][_0xfdc1('0x37')])){throw new db['Sequelize'][(_0xfdc1('0x2b'))](_0xfdc1('0x38')+_0x2e1d37);}if(!_[_0xfdc1('0x39')](_0x2e1d37,_0x286ff8['body'][_0xfdc1('0x37')])){throw new db[(_0xfdc1('0x2a'))][(_0xfdc1('0x2b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2e1d37);}_0x731976[_0x286ff8[_0xfdc1('0x27')][_0xfdc1('0x37')]]=_0x286ff8['body'][_0xfdc1('0x34')];})[_0xfdc1('0x11')](function(){return db[_0xfdc1('0x1d')]['find']({'where':{'id':_0x286ff8[_0xfdc1('0x3a')]['id']},'include':[{'model':db[_0xfdc1('0x3b')],'as':'List','include':[{'model':db['CmContact'],'as':_0xfdc1('0x3c'),'where':_0x731976,'limit':0x1,'order':[['updatedAt',_0xfdc1('0x3d')]]}]},{'model':db[_0xfdc1('0x3e')],'as':_0xfdc1('0x3f')}]});})[_0xfdc1('0x11')](function(_0x184492){if(_0x184492&&_0x184492['List']){var _0x3af170=_0x184492['get']({'plain':!![]});_0x1b5977[_0xfdc1('0x3a')]=_0x3af170;_0x1b5977['applications']=_0x3af170[_0xfdc1('0x3f')];_0x1b5977[_0xfdc1('0x40')]=_0x3af170[_0xfdc1('0x41')];_0x1b5977[_0xfdc1('0x42')]=_['orderBy'](_0x1b5977['applications'],[_0xfdc1('0x43')],[_0xfdc1('0x44')]);if(_0x1b5977['account'][_0xfdc1('0x3f')]){delete _0x1b5977['account'][_0xfdc1('0x3f')];}if(_0x1b5977[_0xfdc1('0x3a')][_0xfdc1('0x41')]&&_0x1b5977[_0xfdc1('0x3a')][_0xfdc1('0x41')][_0xfdc1('0x3c')][_0xfdc1('0x45')]){return _0x1b5977['account'][_0xfdc1('0x41')][_0xfdc1('0x3c')][0x0];}var _0x45e070=_[_0xfdc1('0xc')](_0x286ff8[_0xfdc1('0x27')],{'firstName':_0x286ff8[_0xfdc1('0x27')][_0xfdc1('0x34')],'ListId':_0x3af170[_0xfdc1('0x32')]});_0x45e070[_0x286ff8['body']['mapKey']]=_0x286ff8[_0xfdc1('0x27')]['from'];return db['CmContact'][_0xfdc1('0x46')](_0x45e070,{'fields':_0xa50831,'raw':!![]});}})[_0xfdc1('0x11')](function(_0x2d0255){_0x1b5977[_0xfdc1('0x47')]=_0x2d0255;if(_0x2d0255){var _0x418bab={'ContactId':_0x2d0255['id'],'FaxAccountId':_0x286ff8[_0xfdc1('0x3a')]['id'],'fax':_0x2d0255[_0xfdc1('0x28')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x2d0255['id'],'closed':![],'FaxAccountId':_0x286ff8['account']['id']}})[_0xfdc1('0x11')](function(_0x158b82){if(_0x158b82){return[_0x158b82,![]];}return db['FaxInteraction'][_0xfdc1('0x46')](_0x418bab)[_0xfdc1('0x11')](function(_0x2bc388){return[_0x2bc388,!![]];});});}else{throw new Error(_0xfdc1('0x48'));}})[_0xfdc1('0x49')](function(_0x3b0363,_0x395fa6){var _0x3723de=_0x3b0363[_0xfdc1('0x4a')]({'plain':!![]});if(_0x395fa6){if(_0x1b5977[_0xfdc1('0x3a')][_0xfdc1('0x4b')]){_0x1b5977[_0xfdc1('0x42')]['push']({'id':0x0,'priority':_0x1b5977[_0xfdc1('0x42')][_0xfdc1('0x45')]+0x1,'app':_0xfdc1('0x4c'),'appdata':_0xfdc1('0x4d'),'interval':'*,*,*,*'});}_0x3723de[_0xfdc1('0x4e')]=!![];}else{_0x3723de[_0xfdc1('0x4e')]=![];}_0x1b5977[_0xfdc1('0x4f')]=_0x3723de;return db[_0xfdc1('0x50')][_0xfdc1('0x46')]({'body':_0x286ff8[_0xfdc1('0x27')][_0xfdc1('0x27')],'FaxAccountId':_0x286ff8[_0xfdc1('0x3a')]['id'],'FaxInteractionId':_0x3b0363['id'],'direction':'in','ContactId':_0x3b0363['ContactId'],'AttachmentId':_0x286ff8[_0xfdc1('0x27')]['AttachmentId']});})[_0xfdc1('0x11')](function(_0x3db55d){_0x1b5977[_0xfdc1('0x18')]=_0x3db55d;if(_0x1b5977[_0xfdc1('0x4f')][_0xfdc1('0x51')]){return db[_0xfdc1('0x52')][_0xfdc1('0x53')]({'attributes':['id',_0xfdc1('0x54')],'where':{'id':_0x1b5977[_0xfdc1('0x4f')][_0xfdc1('0x51')]}})[_0xfdc1('0x11')](function(_0x35cfa4){if(_0x35cfa4){_0x1b5977[_0xfdc1('0x42')][_0xfdc1('0x55')]({'id':0x0,'priority':0x0,'app':_0xfdc1('0x56'),'appdata':_0x35cfa4[_0xfdc1('0x54')]+','+(_0x1b5977[_0xfdc1('0x3a')][_0xfdc1('0x57')]||0xa),'interval':_0xfdc1('0x58')});}return respondWithRpcPromise(_0xfdc1('0x59'),'startRouting',_0x1b5977);});}return respondWithRpcPromise(_0xfdc1('0x59'),_0xfdc1('0x5a'),_0x1b5977);})[_0xfdc1('0x11')](function(_0x41f6eb){_0xc69e58(_0x41f6eb);})[_0xfdc1('0x1b')](function(_0x17e2d1){_0x3dae48(_0x384b72['error'](0x1f4,_0x17e2d1[_0xfdc1('0x18')]));});});}; \ No newline at end of file +var _0x8318=['keys','createdAt','CompanyId','ListId','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','length','create','fax','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','waitForTheAssignedAgent','startRouting','Start','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','map','include','model','NotifyFaxAccount','body','CmContact','no\x20available\x20attributes','difference','updatedAt'];(function(_0x2b1d7c,_0x409329){var _0x218be9=function(_0x5cb654){while(--_0x5cb654){_0x2b1d7c['push'](_0x2b1d7c['shift']());}};_0x218be9(++_0x409329);}(_0x8318,0xd8));var _0x8831=function(_0x3b6ed3,_0x39f5fb){_0x3b6ed3=_0x3b6ed3-0x0;var _0x44832d=_0x8318[_0x3b6ed3];return _0x44832d;};'use strict';var _=require(_0x8831('0x0'));var util=require(_0x8831('0x1'));var moment=require('moment');var BPromise=require(_0x8831('0x2'));var rs=require(_0x8831('0x3'));var fs=require('fs');var Redis=require(_0x8831('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8831('0x5'));var logger=require(_0x8831('0x6'))(_0x8831('0x7'));var config=require(_0x8831('0x8'));var jayson=require(_0x8831('0x9'));var client=jayson['client'][_0x8831('0xa')]({'port':0x232c});config['redis']=_[_0x8831('0xb')](config['redis'],{'host':_0x8831('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8831('0xd'))[_0x8831('0xe')](socket);function respondWithRpcPromise(_0x1ad7e2,_0x361dc1,_0x24de96){return new BPromise(function(_0x286eaf,_0x40a675){return client[_0x8831('0xf')](_0x1ad7e2,_0x24de96)[_0x8831('0x10')](function(_0x112e59){logger[_0x8831('0x11')](_0x8831('0x12'),_0x361dc1,_0x8831('0x13'));logger[_0x8831('0x14')](_0x8831('0x15'),_0x361dc1,'request\x20sent',JSON[_0x8831('0x16')](_0x112e59));if(_0x112e59[_0x8831('0x17')]){if(_0x112e59[_0x8831('0x17')][_0x8831('0x18')]===0x1f4){logger['error'](_0x8831('0x12'),_0x361dc1,_0x112e59[_0x8831('0x17')][_0x8831('0x19')]);return _0x40a675(_0x112e59[_0x8831('0x17')][_0x8831('0x19')]);}logger[_0x8831('0x17')](_0x8831('0x12'),_0x361dc1,_0x112e59[_0x8831('0x17')][_0x8831('0x19')]);return _0x286eaf(_0x112e59[_0x8831('0x17')][_0x8831('0x19')]);}else{logger[_0x8831('0x11')](_0x8831('0x12'),_0x361dc1,_0x8831('0x13'));_0x286eaf(_0x112e59['result'][_0x8831('0x19')]);}})[_0x8831('0x1a')](function(_0x368909){logger[_0x8831('0x17')](_0x8831('0x12'),_0x361dc1,_0x368909);_0x40a675(_0x368909);});});}exports[_0x8831('0x1b')]=function(_0x2c9521){var _0x1484cd=this;return new Promise(function(_0x1f48e9,_0x46581b){return db[_0x8831('0x1c')][_0x8831('0x1d')]({'raw':_0x2c9521[_0x8831('0x1e')]?_0x2c9521['options'][_0x8831('0x1f')]===undefined?!![]:![]:!![],'where':_0x2c9521[_0x8831('0x1e')]?_0x2c9521[_0x8831('0x1e')]['where']||null:null,'attributes':_0x2c9521['options']?_0x2c9521[_0x8831('0x1e')][_0x8831('0x20')]||null:null,'limit':_0x2c9521[_0x8831('0x1e')]?_0x2c9521[_0x8831('0x1e')]['limit']||null:null,'include':_0x2c9521[_0x8831('0x1e')]?_0x2c9521[_0x8831('0x1e')]['include']?_[_0x8831('0x21')](_0x2c9521[_0x8831('0x1e')]['include'],function(_0x43b0c0){return{'model':db[_0x43b0c0['model']],'as':_0x43b0c0['as'],'attributes':_0x43b0c0[_0x8831('0x20')],'include':_0x43b0c0[_0x8831('0x22')]?_[_0x8831('0x21')](_0x43b0c0[_0x8831('0x22')],function(_0x42ede1){return{'model':db[_0x42ede1[_0x8831('0x23')]],'as':_0x42ede1['as'],'attributes':_0x42ede1[_0x8831('0x20')],'include':_0x42ede1[_0x8831('0x22')]?_['map'](_0x42ede1['include'],function(_0x45b17b){return{'model':db[_0x45b17b[_0x8831('0x23')]],'as':_0x45b17b['as'],'attributes':_0x45b17b[_0x8831('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32ec2d){logger[_0x8831('0x11')]('GetFaxAccount',_0x2c9521);logger[_0x8831('0x14')](_0x8831('0x1b'),_0x2c9521,JSON[_0x8831('0x16')](_0x32ec2d));_0x1f48e9(_0x32ec2d);})[_0x8831('0x1a')](function(_0x3c989d){logger[_0x8831('0x17')](_0x8831('0x1b'),_0x3c989d['message'],_0x2c9521);_0x46581b(_0x1484cd[_0x8831('0x17')](0x1f4,_0x3c989d[_0x8831('0x19')]));});});};exports[_0x8831('0x24')]=function(_0x530004,_0x51e16f,_0x270434){var _0x4f78f6=this;return new Promise(function(_0x1e9e79,_0x3bf755){var _0x476358={'body':_0x530004[_0x8831('0x25')],'channel':'fax'};var _0x1447fa=[];var _0x5b579a=[];var _0x7c96e6={};return db[_0x8831('0x26')]['describe']()[_0x8831('0x10')](function(_0xb3c2b4){if(!_0xb3c2b4){throw new db['Sequelize']['ValidationError'](_0x8831('0x27'));}_0x1447fa=_[_0x8831('0x28')](_['keys'](_0xb3c2b4),['createdAt',_0x8831('0x29')]);_0x5b579a=_['difference'](_[_0x8831('0x2a')](_0xb3c2b4),[_0x8831('0x2b'),'updatedAt',_0x8831('0x2c'),_0x8831('0x2d')]);if(_0x530004[_0x8831('0x25')]['id']){delete _0x530004['body']['id'];}if(_[_0x8831('0x2e')](_0x530004['body'][_0x8831('0x2f')])){throw new db[(_0x8831('0x30'))][(_0x8831('0x31'))](_0x8831('0x32'));}if(_[_0x8831('0x2e')](_0x530004[_0x8831('0x25')][_0x8831('0x25')])||_0x530004[_0x8831('0x25')][_0x8831('0x25')]===''){throw new db[(_0x8831('0x30'))][(_0x8831('0x31'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8831('0x2e')](_0x530004['body']['mapKey'])){throw new db['Sequelize'][(_0x8831('0x31'))](_0x8831('0x33')+_0x5b579a);}if(!_[_0x8831('0x34')](_0x5b579a,_0x530004[_0x8831('0x25')][_0x8831('0x35')])){throw new db[(_0x8831('0x30'))][(_0x8831('0x31'))](_0x8831('0x36')+_0x5b579a);}_0x7c96e6[_0x530004[_0x8831('0x25')][_0x8831('0x35')]]=_0x530004[_0x8831('0x25')]['from'];})[_0x8831('0x10')](function(){return db['FaxAccount'][_0x8831('0x37')]({'where':{'id':_0x530004[_0x8831('0x38')]['id']},'include':[{'model':db[_0x8831('0x39')],'as':_0x8831('0x3a'),'include':[{'model':db['CmContact'],'as':_0x8831('0x3b'),'where':_0x7c96e6,'limit':0x1,'order':[[_0x8831('0x29'),_0x8831('0x3c')]]}]},{'model':db[_0x8831('0x3d')],'as':_0x8831('0x3e')}]});})['then'](function(_0x4ef5a2){if(_0x4ef5a2&&_0x4ef5a2[_0x8831('0x3a')]){var _0x2067dd=_0x4ef5a2[_0x8831('0x3f')]({'plain':!![]});_0x476358[_0x8831('0x38')]=_0x2067dd;_0x476358[_0x8831('0x40')]=_0x2067dd[_0x8831('0x3e')];_0x476358[_0x8831('0x41')]=_0x2067dd[_0x8831('0x3a')];_0x476358[_0x8831('0x40')]=_[_0x8831('0x42')](_0x476358['applications'],[_0x8831('0x43')],['asc']);if(_0x476358[_0x8831('0x38')]['Applications']){delete _0x476358['account'][_0x8831('0x3e')];}if(_0x476358['account']['List']&&_0x476358[_0x8831('0x38')]['List'][_0x8831('0x3b')][_0x8831('0x44')]){return _0x476358[_0x8831('0x38')]['List'][_0x8831('0x3b')][0x0];}var _0x108018=_['defaults'](_0x530004[_0x8831('0x25')],{'firstName':_0x530004[_0x8831('0x25')][_0x8831('0x2f')],'ListId':_0x2067dd['ListId']});_0x108018[_0x530004[_0x8831('0x25')]['mapKey']]=_0x530004[_0x8831('0x25')][_0x8831('0x2f')];return db['CmContact'][_0x8831('0x45')](_0x108018,{'fields':_0x1447fa,'raw':!![]});}})[_0x8831('0x10')](function(_0x338296){_0x476358['contact']=_0x338296;if(_0x338296){var _0x3ad748={'ContactId':_0x338296['id'],'FaxAccountId':_0x530004[_0x8831('0x38')]['id'],'fax':_0x338296[_0x8831('0x46')]};return db['FaxInteraction'][_0x8831('0x37')]({'where':{'ContactId':_0x338296['id'],'closed':![],'FaxAccountId':_0x530004[_0x8831('0x38')]['id']}})[_0x8831('0x10')](function(_0x4df743){if(_0x4df743){return[_0x4df743,![]];}return db[_0x8831('0x47')]['create'](_0x3ad748)[_0x8831('0x10')](function(_0x5ea6ac){return[_0x5ea6ac,!![]];});});}else{throw new Error(_0x8831('0x48'));}})[_0x8831('0x49')](function(_0x3c21c4,_0x778a9a){var _0x2a3418=_0x3c21c4[_0x8831('0x3f')]({'plain':!![]});if(_0x778a9a){if(_0x476358[_0x8831('0x38')][_0x8831('0x4a')]){_0x476358[_0x8831('0x40')][_0x8831('0x4b')]({'id':0x0,'priority':_0x476358[_0x8831('0x40')][_0x8831('0x44')]+0x1,'app':'close','appdata':_0x8831('0x4c'),'interval':_0x8831('0x4d')});}_0x2a3418[_0x8831('0x4e')]=!![];}else{_0x2a3418[_0x8831('0x4e')]=![];}_0x476358[_0x8831('0x4f')]=_0x2a3418;return db[_0x8831('0x50')][_0x8831('0x45')]({'body':_0x530004[_0x8831('0x25')][_0x8831('0x25')],'FaxAccountId':_0x530004[_0x8831('0x38')]['id'],'FaxInteractionId':_0x3c21c4['id'],'direction':'in','ContactId':_0x3c21c4[_0x8831('0x51')],'AttachmentId':_0x530004[_0x8831('0x25')]['AttachmentId']});})[_0x8831('0x10')](function(_0x459c43){_0x476358['message']=_0x459c43;if(_0x476358[_0x8831('0x4f')][_0x8831('0x52')]){return db['User'][_0x8831('0x37')]({'attributes':['id','name'],'where':{'id':_0x476358['interaction'][_0x8831('0x52')]}})['then'](function(_0x1fa034){if(_0x1fa034){_0x476358[_0x8831('0x40')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1fa034['name']+','+(_0x476358[_0x8831('0x38')][_0x8831('0x53')]||0xa),'interval':_0x8831('0x4d')});}return respondWithRpcPromise('Start',_0x8831('0x54'),_0x476358);});}return respondWithRpcPromise(_0x8831('0x55'),_0x8831('0x54'),_0x476358);})[_0x8831('0x10')](function(_0x17b415){_0x1e9e79(_0x17b415);})['catch'](function(_0x71e780){_0x3bf755(_0x4f78f6['error'](0x1f4,_0x71e780[_0x8831('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 0a33446..5b2015e 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 _0xf61e=['faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x1da173,_0x26fd7c){var _0x1e448b=function(_0x5d0382){while(--_0x5d0382){_0x1da173['push'](_0x1da173['shift']());}};_0x1e448b(++_0x26fd7c);}(_0xf61e,0x191));var _0xef61=function(_0x3a4801,_0x4f3f7d){_0x3a4801=_0x3a4801-0x0;var _0xf61136=_0xf61e[_0x3a4801];return _0xf61136;};'use strict';var FaxAccountEvents=require(_0xef61('0x0'));var events=[_0xef61('0x1'),_0xef61('0x2'),_0xef61('0x3')];function createListener(_0x205269,_0xeccd26){return function(_0x3613e6){_0xeccd26[_0xef61('0x4')](_0x205269,_0x3613e6);};}function removeListener(_0x2bd1d0,_0x14122a){return function(){FaxAccountEvents[_0xef61('0x5')](_0x2bd1d0,_0x14122a);};}exports[_0xef61('0x6')]=function(_0x5b00b2){for(var _0x9e17f4=0x0,_0x3e2f79=events['length'];_0x9e17f4<_0x3e2f79;_0x9e17f4++){var _0x2242a7=events[_0x9e17f4];var _0x277fa1=createListener(_0xef61('0x7')+_0x2242a7,_0x5b00b2);FaxAccountEvents['on'](_0x2242a7,_0x277fa1);}}; \ No newline at end of file +var _0x430c=['register','length','faxAccount:','./faxAccount.events','update','removeListener'];(function(_0x251d59,_0x195b11){var _0x50e7a3=function(_0x434484){while(--_0x434484){_0x251d59['push'](_0x251d59['shift']());}};_0x50e7a3(++_0x195b11);}(_0x430c,0x1a1));var _0xc430=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x430c[_0x1589dd];return _0x1bddd1;};'use strict';var FaxAccountEvents=require(_0xc430('0x0'));var events=['save','remove',_0xc430('0x1')];function createListener(_0xe2d084,_0x1d5b5e){return function(_0x503988){_0x1d5b5e['emit'](_0xe2d084,_0x503988);};}function removeListener(_0x5ccda6,_0x47d8b9){return function(){FaxAccountEvents[_0xc430('0x2')](_0x5ccda6,_0x47d8b9);};}exports[_0xc430('0x3')]=function(_0x50b256){for(var _0x42aa9c=0x0,_0x4de44f=events[_0xc430('0x4')];_0x42aa9c<_0x4de44f;_0x42aa9c++){var _0x2e51c6=events[_0x42aa9c];var _0x814a90=createListener(_0xc430('0x5')+_0x2e51c6,_0x50b256);FaxAccountEvents['on'](_0x2e51c6,_0x814a90);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 0f4119e..80b0680 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 _0x015a=['removeAnswers','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','getApplications','getMessages','/:id/users','post','create','addAnswer','addInteraction','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','update','removeDispositions'];(function(_0x301ea6,_0x202cf3){var _0x3bd1ae=function(_0xc27c01){while(--_0xc27c01){_0x301ea6['push'](_0x301ea6['shift']());}};_0x3bd1ae(++_0x202cf3);}(_0x015a,0x137));var _0xa015=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x015a[_0x565ed7];return _0x183ad7;};'use strict';var multer=require(_0xa015('0x0'));var util=require(_0xa015('0x1'));var path=require('path');var timeout=require(_0xa015('0x2'));var express=require(_0xa015('0x3'));var router=express[_0xa015('0x4')]();var fs_extra=require(_0xa015('0x5'));var auth=require(_0xa015('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa015('0x7'));var controller=require(_0xa015('0x8'));router[_0xa015('0x9')]('/',auth[_0xa015('0xa')](),controller[_0xa015('0xb')]);router[_0xa015('0x9')](_0xa015('0xc'),auth[_0xa015('0xa')](),controller[_0xa015('0xd')]);router[_0xa015('0x9')](_0xa015('0xe'),auth[_0xa015('0xa')](),controller[_0xa015('0xf')]);router[_0xa015('0x9')](_0xa015('0x10'),auth[_0xa015('0xa')](),controller[_0xa015('0x11')]);router[_0xa015('0x9')](_0xa015('0x12'),auth[_0xa015('0xa')](),controller[_0xa015('0x13')]);router['get'](_0xa015('0x14'),auth[_0xa015('0xa')](),controller[_0xa015('0x15')]);router[_0xa015('0x9')]('/:id/applications',auth[_0xa015('0xa')](),controller[_0xa015('0x16')]);router[_0xa015('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0xa015('0x17')]);router[_0xa015('0x9')](_0xa015('0x18'),auth[_0xa015('0xa')](),controller['getAgents']);router[_0xa015('0x19')]('/',auth[_0xa015('0xa')](),controller[_0xa015('0x1a')]);router['post'](_0xa015('0x10'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xa015('0x19')]('/:id/canned_answers',auth[_0xa015('0xa')](),controller[_0xa015('0x1b')]);router['post'](_0xa015('0x14'),auth[_0xa015('0xa')](),controller[_0xa015('0x1c')]);router[_0xa015('0x19')](_0xa015('0x1d'),auth[_0xa015('0xa')](),controller[_0xa015('0x1e')]);router[_0xa015('0x19')](_0xa015('0x1f'),auth[_0xa015('0xa')](),controller[_0xa015('0x20')]);router[_0xa015('0x19')](_0xa015('0x21'),auth[_0xa015('0xa')](),controller[_0xa015('0x22')]);router[_0xa015('0x19')](_0xa015('0x23'),auth[_0xa015('0xa')](),controller[_0xa015('0x24')]);router['post']('/:id/users',auth[_0xa015('0xa')](),controller[_0xa015('0x25')]);router[_0xa015('0x26')]('/:id',auth[_0xa015('0xa')](),controller[_0xa015('0x27')]);router['delete']('/:id',auth[_0xa015('0xa')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0xa015('0xa')](),controller[_0xa015('0x28')]);router['delete'](_0xa015('0x12'),auth[_0xa015('0xa')](),controller[_0xa015('0x29')]);router[_0xa015('0x2a')]('/:id/users',auth[_0xa015('0xa')](),controller['removeAgents']);module[_0xa015('0x2b')]=router; \ No newline at end of file +var _0x1d66=['delete','destroy','removeDispositions','removeAnswers','multer','util','express','Router','../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/applications','getApplications','getMessages','/:id/users','post','create','addDisposition','addAnswer','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','send','addAgents','put','update'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1d66,0x124));var _0x61d6=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x1d66[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0x61d6('0x0'));var util=require(_0x61d6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x61d6('0x2'));var router=express[_0x61d6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x61d6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x61d6('0x5'));var controller=require(_0x61d6('0x6'));router[_0x61d6('0x7')]('/',auth[_0x61d6('0x8')](),controller[_0x61d6('0x9')]);router[_0x61d6('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x61d6('0x7')](_0x61d6('0xa'),auth[_0x61d6('0x8')](),controller['show']);router['get'](_0x61d6('0xb'),auth['isAuthenticated'](),controller[_0x61d6('0xc')]);router[_0x61d6('0x7')](_0x61d6('0xd'),auth[_0x61d6('0x8')](),controller[_0x61d6('0xe')]);router[_0x61d6('0x7')]('/:id/interactions',auth[_0x61d6('0x8')](),controller[_0x61d6('0xf')]);router['get'](_0x61d6('0x10'),auth[_0x61d6('0x8')](),controller[_0x61d6('0x11')]);router[_0x61d6('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0x61d6('0x12')]);router[_0x61d6('0x7')](_0x61d6('0x13'),auth[_0x61d6('0x8')](),controller['getAgents']);router[_0x61d6('0x14')]('/',auth[_0x61d6('0x8')](),controller[_0x61d6('0x15')]);router[_0x61d6('0x14')](_0x61d6('0xb'),auth['isAuthenticated'](),controller[_0x61d6('0x16')]);router[_0x61d6('0x14')](_0x61d6('0xd'),auth[_0x61d6('0x8')](),controller[_0x61d6('0x17')]);router[_0x61d6('0x14')]('/:id/interactions',auth[_0x61d6('0x8')](),controller['addInteraction']);router[_0x61d6('0x14')](_0x61d6('0x10'),auth[_0x61d6('0x8')](),controller['addApplications']);router[_0x61d6('0x14')](_0x61d6('0x18'),auth[_0x61d6('0x8')](),controller[_0x61d6('0x19')]);router[_0x61d6('0x14')](_0x61d6('0x1a'),auth[_0x61d6('0x8')](),controller[_0x61d6('0x1b')]);router['post']('/:id/send',auth[_0x61d6('0x8')](),controller[_0x61d6('0x1c')]);router[_0x61d6('0x14')](_0x61d6('0x13'),auth[_0x61d6('0x8')](),controller[_0x61d6('0x1d')]);router[_0x61d6('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x61d6('0x1f')]);router[_0x61d6('0x20')](_0x61d6('0xa'),auth[_0x61d6('0x8')](),controller[_0x61d6('0x21')]);router['delete']('/:id/dispositions',auth[_0x61d6('0x8')](),controller[_0x61d6('0x22')]);router[_0x61d6('0x20')](_0x61d6('0xd'),auth[_0x61d6('0x8')](),controller[_0x61d6('0x23')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);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 6829c02..233701d 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 _0xbff5=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x21a5ff,_0x571074){var _0x1f9af8=function(_0x5a3f84){while(--_0x5a3f84){_0x21a5ff['push'](_0x21a5ff['shift']());}};_0x1f9af8(++_0x571074);}(_0xbff5,0x1bc));var _0x5bff=function(_0x253492,_0x1dd85b){_0x253492=_0x253492-0x0;var _0x287243=_0xbff5[_0x253492];return _0x287243;};'use strict';var Sequelize=require(_0x5bff('0x0'));module[_0x5bff('0x1')]={'priority':{'type':Sequelize[_0x5bff('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5bff('0x3')],'allowNull':![],'defaultValue':_0x5bff('0x4')},'appdata':{'type':Sequelize[_0x5bff('0x5')]()},'description':{'type':Sequelize[_0x5bff('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5bff('0x6')}}; \ No newline at end of file +var _0x3166=['TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3166,0xbb));var _0x6316=function(_0x94cbfd,_0xcf3905){_0x94cbfd=_0x94cbfd-0x0;var _0x1fb158=_0x3166[_0x94cbfd];return _0x1fb158;};'use strict';var Sequelize=require('sequelize');module[_0x6316('0x0')]={'priority':{'type':Sequelize[_0x6316('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6316('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6316('0x3')]()},'description':{'type':Sequelize[_0x6316('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x6316('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 871910a..9c696c0 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 _0x0e4b=['status','end','json','offset','undefined','limit','count','set','apply','reject','then','error','stack','name','index','map','FaxApplication','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','params','options','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0e4b,0x15a));var _0xb0e4=function(_0x1d6858,_0x246713){_0x1d6858=_0x1d6858-0x0;var _0xdcf458=_0x0e4b[_0x1d6858];return _0xdcf458;};'use strict';var emlformat=require(_0xb0e4('0x0'));var rimraf=require(_0xb0e4('0x1'));var zipdir=require(_0xb0e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb0e4('0x3'));var moment=require(_0xb0e4('0x4'));var BPromise=require(_0xb0e4('0x5'));var Mustache=require(_0xb0e4('0x6'));var util=require(_0xb0e4('0x7'));var path=require(_0xb0e4('0x8'));var sox=require(_0xb0e4('0x9'));var csv=require(_0xb0e4('0xa'));var ejs=require(_0xb0e4('0xb'));var fs=require('fs');var fs_extra=require(_0xb0e4('0xc'));var _=require(_0xb0e4('0xd'));var squel=require(_0xb0e4('0xe'));var crypto=require(_0xb0e4('0xf'));var jsforce=require(_0xb0e4('0x10'));var deskjs=require(_0xb0e4('0x11'));var toCsv=require(_0xb0e4('0xa'));var querystring=require(_0xb0e4('0x12'));var Papa=require(_0xb0e4('0x13'));var Redis=require('ioredis');var authService=require(_0xb0e4('0x14'));var qs=require(_0xb0e4('0x15'));var as=require(_0xb0e4('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb0e4('0x17'))(_0xb0e4('0x18'));var utils=require(_0xb0e4('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xb0e4('0x1a'));var db=require(_0xb0e4('0x1b'))['db'];function respondWithStatusCode(_0x27d18c,_0x8523ad){_0x8523ad=_0x8523ad||0xcc;return function(_0x1693a5){if(_0x1693a5){return _0x27d18c[_0xb0e4('0x1c')](_0x8523ad);}return _0x27d18c[_0xb0e4('0x1d')](_0x8523ad)[_0xb0e4('0x1e')]();};}function respondWithResult(_0x1355f2,_0x436c07){_0x436c07=_0x436c07||0xc8;return function(_0x1bc455){if(_0x1bc455){return _0x1355f2[_0xb0e4('0x1d')](_0x436c07)[_0xb0e4('0x1f')](_0x1bc455);}};}function respondWithFilteredResult(_0x571261,_0x5548cd){return function(_0x3eb829){if(_0x3eb829){var _0x4f3b4f=typeof _0x5548cd[_0xb0e4('0x20')]===_0xb0e4('0x21')&&typeof _0x5548cd[_0xb0e4('0x22')]===_0xb0e4('0x21');var _0x9e001d=_0x3eb829[_0xb0e4('0x23')];var _0x296a24=_0x4f3b4f?0x0:_0x5548cd[_0xb0e4('0x20')];var _0x2cbf7a=_0x4f3b4f?_0x3eb829[_0xb0e4('0x23')]:_0x5548cd[_0xb0e4('0x20')]+_0x5548cd[_0xb0e4('0x22')];var _0x466815;if(_0x2cbf7a>=_0x9e001d){_0x2cbf7a=_0x9e001d;_0x466815=0xc8;}else{_0x466815=0xce;}_0x571261[_0xb0e4('0x1d')](_0x466815);return _0x571261[_0xb0e4('0x24')]('Content-Range',_0x296a24+'-'+_0x2cbf7a+'/'+_0x9e001d)[_0xb0e4('0x1f')](_0x3eb829);}return null;};}function patchUpdates(_0x3f1c7c){return function(_0x53817b){try{jsonpatch[_0xb0e4('0x25')](_0x53817b,_0x3f1c7c,!![]);}catch(_0x13c714){return BPromise[_0xb0e4('0x26')](_0x13c714);}return _0x53817b['save']();};}function saveUpdates(_0x33ef01,_0x9d6dd9){return function(_0x39764d){if(_0x39764d){return _0x39764d['update'](_0x33ef01)[_0xb0e4('0x27')](function(_0x23ac33){return _0x23ac33;});}return null;};}function removeEntity(_0x42b5e8,_0x1bd73d){return function(_0x1ee632){if(_0x1ee632){return _0x1ee632['destroy']()[_0xb0e4('0x27')](function(){_0x42b5e8[_0xb0e4('0x1d')](0xcc)[_0xb0e4('0x1e')]();});}};}function handleEntityNotFound(_0x34ba60,_0x5e566a){return function(_0xfefbee){if(!_0xfefbee){_0x34ba60['sendStatus'](0x194);}return _0xfefbee;};}function handleError(_0x18ca0e,_0x563cf6){_0x563cf6=_0x563cf6||0x1f4;return function(_0x40d104){logger[_0xb0e4('0x28')](_0x40d104[_0xb0e4('0x29')]);if(_0x40d104[_0xb0e4('0x2a')]){delete _0x40d104['name'];}_0x18ca0e[_0xb0e4('0x1d')](_0x563cf6)['send'](_0x40d104);};}exports[_0xb0e4('0x2b')]=function(_0x11ffac,_0x8ffe0f){var _0x5846ea={},_0x5deb73={},_0x3bef1a={'count':0x0,'rows':[]};var _0x3c62fa=_[_0xb0e4('0x2c')](db[_0xb0e4('0x2d')][_0xb0e4('0x2e')],function(_0x3bf014){return{'name':_0x3bf014['fieldName'],'type':_0x3bf014[_0xb0e4('0x2f')][_0xb0e4('0x30')]};});_0x5deb73[_0xb0e4('0x31')]=_['map'](_0x3c62fa,_0xb0e4('0x2a'));_0x5deb73['query']=_[_0xb0e4('0x32')](_0x11ffac[_0xb0e4('0x33')]);_0x5deb73[_0xb0e4('0x34')]=_[_0xb0e4('0x35')](_0x5deb73[_0xb0e4('0x31')],_0x5deb73[_0xb0e4('0x33')]);_0x5846ea[_0xb0e4('0x36')]=_[_0xb0e4('0x35')](_0x5deb73[_0xb0e4('0x31')],qs[_0xb0e4('0x37')](_0x11ffac['query']['fields']));_0x5846ea[_0xb0e4('0x36')]=_0x5846ea[_0xb0e4('0x36')][_0xb0e4('0x38')]?_0x5846ea['attributes']:_0x5deb73[_0xb0e4('0x31')];if(!_0x11ffac['query'][_0xb0e4('0x39')]('nolimit')){_0x5846ea[_0xb0e4('0x22')]=qs['limit'](_0x11ffac['query'][_0xb0e4('0x22')]);_0x5846ea[_0xb0e4('0x20')]=qs[_0xb0e4('0x20')](_0x11ffac[_0xb0e4('0x33')][_0xb0e4('0x20')]);}_0x5846ea[_0xb0e4('0x3a')]=qs[_0xb0e4('0x3b')](_0x11ffac['query']['sort']);_0x5846ea[_0xb0e4('0x3c')]=qs['filters'](_[_0xb0e4('0x3d')](_0x11ffac['query'],_0x5deb73[_0xb0e4('0x34')]),_0x3c62fa);if(_0x11ffac['query'][_0xb0e4('0x3e')]){_0x5846ea[_0xb0e4('0x3c')]=_['merge'](_0x5846ea['where'],{'$or':_[_0xb0e4('0x2c')](_0x3c62fa,function(_0xd0d675){if(_0xd0d675['type']!==_0xb0e4('0x3f')){var _0x48e653={};_0x48e653[_0xd0d675['name']]={'$like':'%'+_0x11ffac['query'][_0xb0e4('0x3e')]+'%'};return _0x48e653;}})});}_0x5846ea=_[_0xb0e4('0x40')]({},_0x5846ea,_0x11ffac['options']);var _0x4d0e7c={'where':_0x5846ea[_0xb0e4('0x3c')]};return db[_0xb0e4('0x2d')]['count'](_0x4d0e7c)[_0xb0e4('0x27')](function(_0x107a31){_0x3bef1a[_0xb0e4('0x23')]=_0x107a31;if(_0x11ffac['query'][_0xb0e4('0x41')]){_0x5846ea['include']=[{'all':!![]}];}return db[_0xb0e4('0x2d')][_0xb0e4('0x42')](_0x5846ea);})[_0xb0e4('0x27')](function(_0x15e655){_0x3bef1a[_0xb0e4('0x43')]=_0x15e655;return _0x3bef1a;})[_0xb0e4('0x27')](respondWithFilteredResult(_0x8ffe0f,_0x5846ea))[_0xb0e4('0x44')](handleError(_0x8ffe0f,null));};exports['show']=function(_0x31f06c,_0x234bf3){var _0x3c2cd3={'raw':!![],'where':{'id':_0x31f06c[_0xb0e4('0x45')]['id']}},_0x51dd0d={};_0x51dd0d[_0xb0e4('0x31')]=_['keys'](db['FaxApplication'][_0xb0e4('0x2e')]);_0x51dd0d[_0xb0e4('0x33')]=_['keys'](_0x31f06c[_0xb0e4('0x33')]);_0x51dd0d[_0xb0e4('0x34')]=_[_0xb0e4('0x35')](_0x51dd0d[_0xb0e4('0x31')],_0x51dd0d['query']);_0x3c2cd3[_0xb0e4('0x36')]=_[_0xb0e4('0x35')](_0x51dd0d['model'],qs['fields'](_0x31f06c[_0xb0e4('0x33')][_0xb0e4('0x37')]));_0x3c2cd3[_0xb0e4('0x36')]=_0x3c2cd3['attributes'][_0xb0e4('0x38')]?_0x3c2cd3[_0xb0e4('0x36')]:_0x51dd0d['model'];if(_0x31f06c[_0xb0e4('0x33')][_0xb0e4('0x41')]){_0x3c2cd3['include']=[{'all':!![]}];}_0x3c2cd3=_[_0xb0e4('0x40')]({},_0x3c2cd3,_0x31f06c[_0xb0e4('0x46')]);return db[_0xb0e4('0x2d')][_0xb0e4('0x47')](_0x3c2cd3)[_0xb0e4('0x27')](handleEntityNotFound(_0x234bf3,null))[_0xb0e4('0x27')](respondWithResult(_0x234bf3,null))[_0xb0e4('0x44')](handleError(_0x234bf3,null));};exports[_0xb0e4('0x48')]=function(_0x4e42b3,_0x5817b0){return db[_0xb0e4('0x2d')][_0xb0e4('0x48')](_0x4e42b3[_0xb0e4('0x49')],{})[_0xb0e4('0x27')](respondWithResult(_0x5817b0,0xc9))[_0xb0e4('0x44')](handleError(_0x5817b0,null));};exports['update']=function(_0x5ac8c2,_0x468e31){if(_0x5ac8c2[_0xb0e4('0x49')]['id']){delete _0x5ac8c2['body']['id'];}return db[_0xb0e4('0x2d')][_0xb0e4('0x47')]({'where':{'id':_0x5ac8c2[_0xb0e4('0x45')]['id']}})[_0xb0e4('0x27')](handleEntityNotFound(_0x468e31,null))[_0xb0e4('0x27')](saveUpdates(_0x5ac8c2[_0xb0e4('0x49')],null))['then'](respondWithResult(_0x468e31,null))['catch'](handleError(_0x468e31,null));};exports[_0xb0e4('0x4a')]=function(_0x404f1e,_0x53f127){return db[_0xb0e4('0x2d')][_0xb0e4('0x47')]({'where':{'id':_0x404f1e[_0xb0e4('0x45')]['id']}})[_0xb0e4('0x27')](handleEntityNotFound(_0x53f127,null))[_0xb0e4('0x27')](removeEntity(_0x53f127,null))[_0xb0e4('0x44')](handleError(_0x53f127,null));}; \ No newline at end of file +var _0xe604=['../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','index','map','FaxApplication','rawAttributes','fieldName','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','pick','filter','where','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','eml-format','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x1e7d7e,_0x3fb963){var _0x540baf=function(_0x5c2694){while(--_0x5c2694){_0x1e7d7e['push'](_0x1e7d7e['shift']());}};_0x540baf(++_0x3fb963);}(_0xe604,0x101));var _0x4e60=function(_0x402203,_0x2f64de){_0x402203=_0x402203-0x0;var _0x3e6309=_0xe604[_0x402203];return _0x3e6309;};'use strict';var emlformat=require(_0x4e60('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4e60('0x1'));var BPromise=require(_0x4e60('0x2'));var Mustache=require(_0x4e60('0x3'));var util=require(_0x4e60('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x4e60('0x5'));var ejs=require(_0x4e60('0x6'));var fs=require('fs');var fs_extra=require(_0x4e60('0x7'));var _=require('lodash');var squel=require(_0x4e60('0x8'));var crypto=require(_0x4e60('0x9'));var jsforce=require(_0x4e60('0xa'));var deskjs=require(_0x4e60('0xb'));var toCsv=require(_0x4e60('0x5'));var querystring=require('querystring');var Papa=require(_0x4e60('0xc'));var Redis=require(_0x4e60('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4e60('0xe'));var hardwareService=require(_0x4e60('0xf'));var logger=require(_0x4e60('0x10'))(_0x4e60('0x11'));var utils=require('../../config/utils');var config=require(_0x4e60('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x4e60('0x13'))['db'];function respondWithStatusCode(_0x54a1ac,_0x5672ac){_0x5672ac=_0x5672ac||0xcc;return function(_0x563c42){if(_0x563c42){return _0x54a1ac[_0x4e60('0x14')](_0x5672ac);}return _0x54a1ac['status'](_0x5672ac)[_0x4e60('0x15')]();};}function respondWithResult(_0x5489fc,_0x5787d1){_0x5787d1=_0x5787d1||0xc8;return function(_0x230a72){if(_0x230a72){return _0x5489fc[_0x4e60('0x16')](_0x5787d1)['json'](_0x230a72);}};}function respondWithFilteredResult(_0xd362fb,_0x47fada){return function(_0x5a4552){if(_0x5a4552){var _0x1ca2e5=typeof _0x47fada[_0x4e60('0x17')]==='undefined'&&typeof _0x47fada['limit']===_0x4e60('0x18');var _0xa6ab07=_0x5a4552[_0x4e60('0x19')];var _0x5ef6bd=_0x1ca2e5?0x0:_0x47fada[_0x4e60('0x17')];var _0x486090=_0x1ca2e5?_0x5a4552[_0x4e60('0x19')]:_0x47fada[_0x4e60('0x17')]+_0x47fada[_0x4e60('0x1a')];var _0x1f3669;if(_0x486090>=_0xa6ab07){_0x486090=_0xa6ab07;_0x1f3669=0xc8;}else{_0x1f3669=0xce;}_0xd362fb[_0x4e60('0x16')](_0x1f3669);return _0xd362fb[_0x4e60('0x1b')](_0x4e60('0x1c'),_0x5ef6bd+'-'+_0x486090+'/'+_0xa6ab07)[_0x4e60('0x1d')](_0x5a4552);}return null;};}function patchUpdates(_0x5e5806){return function(_0x6bffe4){try{jsonpatch[_0x4e60('0x1e')](_0x6bffe4,_0x5e5806,!![]);}catch(_0x594a26){return BPromise[_0x4e60('0x1f')](_0x594a26);}return _0x6bffe4[_0x4e60('0x20')]();};}function saveUpdates(_0x3857c3,_0x17423a){return function(_0xf059c9){if(_0xf059c9){return _0xf059c9[_0x4e60('0x21')](_0x3857c3)['then'](function(_0xc12a96){return _0xc12a96;});}return null;};}function removeEntity(_0x14c5ea,_0x217020){return function(_0x37af6e){if(_0x37af6e){return _0x37af6e[_0x4e60('0x22')]()[_0x4e60('0x23')](function(){_0x14c5ea[_0x4e60('0x16')](0xcc)[_0x4e60('0x15')]();});}};}function handleEntityNotFound(_0xc96a2e,_0x3f75a3){return function(_0x4d540e){if(!_0x4d540e){_0xc96a2e['sendStatus'](0x194);}return _0x4d540e;};}function handleError(_0x38bcaa,_0x788fcd){_0x788fcd=_0x788fcd||0x1f4;return function(_0x5d3ada){logger['error'](_0x5d3ada[_0x4e60('0x24')]);if(_0x5d3ada[_0x4e60('0x25')]){delete _0x5d3ada[_0x4e60('0x25')];}_0x38bcaa[_0x4e60('0x16')](_0x788fcd)['send'](_0x5d3ada);};}exports[_0x4e60('0x26')]=function(_0x312ac1,_0x4e145a){var _0x41dcc0={},_0xd11ccd={},_0x49ed0e={'count':0x0,'rows':[]};var _0x18341c=_[_0x4e60('0x27')](db[_0x4e60('0x28')][_0x4e60('0x29')],function(_0x2d121c){return{'name':_0x2d121c[_0x4e60('0x2a')],'type':_0x2d121c['type']['key']};});_0xd11ccd['model']=_[_0x4e60('0x27')](_0x18341c,'name');_0xd11ccd[_0x4e60('0x2b')]=_['keys'](_0x312ac1[_0x4e60('0x2b')]);_0xd11ccd[_0x4e60('0x2c')]=_[_0x4e60('0x2d')](_0xd11ccd['model'],_0xd11ccd[_0x4e60('0x2b')]);_0x41dcc0[_0x4e60('0x2e')]=_['intersection'](_0xd11ccd[_0x4e60('0x2f')],qs[_0x4e60('0x30')](_0x312ac1['query']['fields']));_0x41dcc0['attributes']=_0x41dcc0[_0x4e60('0x2e')]['length']?_0x41dcc0[_0x4e60('0x2e')]:_0xd11ccd[_0x4e60('0x2f')];if(!_0x312ac1[_0x4e60('0x2b')][_0x4e60('0x31')](_0x4e60('0x32'))){_0x41dcc0[_0x4e60('0x1a')]=qs[_0x4e60('0x1a')](_0x312ac1[_0x4e60('0x2b')][_0x4e60('0x1a')]);_0x41dcc0[_0x4e60('0x17')]=qs[_0x4e60('0x17')](_0x312ac1[_0x4e60('0x2b')]['offset']);}_0x41dcc0[_0x4e60('0x33')]=qs['sort'](_0x312ac1['query']['sort']);_0x41dcc0['where']=qs['filters'](_[_0x4e60('0x34')](_0x312ac1['query'],_0xd11ccd[_0x4e60('0x2c')]),_0x18341c);if(_0x312ac1[_0x4e60('0x2b')][_0x4e60('0x35')]){_0x41dcc0[_0x4e60('0x36')]=_[_0x4e60('0x37')](_0x41dcc0[_0x4e60('0x36')],{'$or':_[_0x4e60('0x27')](_0x18341c,function(_0x570d8a){if(_0x570d8a[_0x4e60('0x38')]!==_0x4e60('0x39')){var _0xe341a9={};_0xe341a9[_0x570d8a[_0x4e60('0x25')]]={'$like':'%'+_0x312ac1[_0x4e60('0x2b')][_0x4e60('0x35')]+'%'};return _0xe341a9;}})});}_0x41dcc0=_[_0x4e60('0x37')]({},_0x41dcc0,_0x312ac1['options']);var _0x4a9304={'where':_0x41dcc0['where']};return db[_0x4e60('0x28')][_0x4e60('0x19')](_0x4a9304)[_0x4e60('0x23')](function(_0x35f7ba){_0x49ed0e['count']=_0x35f7ba;if(_0x312ac1['query'][_0x4e60('0x3a')]){_0x41dcc0['include']=[{'all':!![]}];}return db['FaxApplication'][_0x4e60('0x3b')](_0x41dcc0);})[_0x4e60('0x23')](function(_0x17d174){_0x49ed0e[_0x4e60('0x3c')]=_0x17d174;return _0x49ed0e;})[_0x4e60('0x23')](respondWithFilteredResult(_0x4e145a,_0x41dcc0))[_0x4e60('0x3d')](handleError(_0x4e145a,null));};exports[_0x4e60('0x3e')]=function(_0x1c99f4,_0x2e1ce3){var _0x31d460={'raw':!![],'where':{'id':_0x1c99f4[_0x4e60('0x3f')]['id']}},_0x2c881b={};_0x2c881b['model']=_[_0x4e60('0x40')](db[_0x4e60('0x28')][_0x4e60('0x29')]);_0x2c881b[_0x4e60('0x2b')]=_[_0x4e60('0x40')](_0x1c99f4[_0x4e60('0x2b')]);_0x2c881b[_0x4e60('0x2c')]=_[_0x4e60('0x2d')](_0x2c881b[_0x4e60('0x2f')],_0x2c881b[_0x4e60('0x2b')]);_0x31d460[_0x4e60('0x2e')]=_[_0x4e60('0x2d')](_0x2c881b[_0x4e60('0x2f')],qs[_0x4e60('0x30')](_0x1c99f4[_0x4e60('0x2b')][_0x4e60('0x30')]));_0x31d460[_0x4e60('0x2e')]=_0x31d460['attributes']['length']?_0x31d460[_0x4e60('0x2e')]:_0x2c881b[_0x4e60('0x2f')];if(_0x1c99f4['query'][_0x4e60('0x3a')]){_0x31d460[_0x4e60('0x41')]=[{'all':!![]}];}_0x31d460=_['merge']({},_0x31d460,_0x1c99f4['options']);return db[_0x4e60('0x28')][_0x4e60('0x42')](_0x31d460)['then'](handleEntityNotFound(_0x2e1ce3,null))[_0x4e60('0x23')](respondWithResult(_0x2e1ce3,null))[_0x4e60('0x3d')](handleError(_0x2e1ce3,null));};exports[_0x4e60('0x43')]=function(_0x33e2ce,_0x2745b2){return db[_0x4e60('0x28')]['create'](_0x33e2ce['body'],{})['then'](respondWithResult(_0x2745b2,0xc9))[_0x4e60('0x3d')](handleError(_0x2745b2,null));};exports[_0x4e60('0x21')]=function(_0xd53d10,_0x86e0ca){if(_0xd53d10['body']['id']){delete _0xd53d10[_0x4e60('0x44')]['id'];}return db[_0x4e60('0x28')][_0x4e60('0x42')]({'where':{'id':_0xd53d10[_0x4e60('0x3f')]['id']}})['then'](handleEntityNotFound(_0x86e0ca,null))[_0x4e60('0x23')](saveUpdates(_0xd53d10[_0x4e60('0x44')],null))[_0x4e60('0x23')](respondWithResult(_0x86e0ca,null))['catch'](handleError(_0x86e0ca,null));};exports[_0x4e60('0x22')]=function(_0x3090f0,_0x70cd98){return db[_0x4e60('0x28')][_0x4e60('0x42')]({'where':{'id':_0x3090f0[_0x4e60('0x3f')]['id']}})['then'](handleEntityNotFound(_0x70cd98,null))[_0x4e60('0x23')](removeEntity(_0x70cd98,null))[_0x4e60('0x3d')](handleError(_0x70cd98,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index bfb7861..a7125d4 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 _0xc220=['../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x45cef5,_0x270f70){var _0x2355f3=function(_0x3d5891){while(--_0x3d5891){_0x45cef5['push'](_0x45cef5['shift']());}};_0x2355f3(++_0x270f70);}(_0xc220,0x136));var _0x0c22=function(_0x4a7e43,_0x2aead5){_0x4a7e43=_0x4a7e43-0x0;var _0x1547e6=_0xc220[_0x4a7e43];return _0x1547e6;};'use strict';var _=require(_0x0c22('0x0'));var util=require(_0x0c22('0x1'));var logger=require(_0x0c22('0x2'))('api');var moment=require(_0x0c22('0x3'));var BPromise=require(_0x0c22('0x4'));var rp=require(_0x0c22('0x5'));var fs=require('fs');var path=require(_0x0c22('0x6'));var rimraf=require(_0x0c22('0x7'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0x0c22('0x8')]=function(_0x17f209,_0x13d365){return _0x17f209[_0x0c22('0x9')](_0x0c22('0xa'),attributes,{'tableName':_0x0c22('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0c22('0xc')});}; \ No newline at end of file +var _0x26af=['define','FaxApplication','fax_applications','utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise','path','../../config/environment','./faxApplication.attributes','exports'];(function(_0x5b163b,_0x1aa5b3){var _0x4cd0b4=function(_0x487c01){while(--_0x487c01){_0x5b163b['push'](_0x5b163b['shift']());}};_0x4cd0b4(++_0x1aa5b3);}(_0x26af,0x1f0));var _0xf26a=function(_0x2df724,_0x411382){_0x2df724=_0x2df724-0x0;var _0x1b2504=_0x26af[_0x2df724];return _0x1b2504;};'use strict';var _=require('lodash');var util=require(_0xf26a('0x0'));var logger=require(_0xf26a('0x1'))('api');var moment=require(_0xf26a('0x2'));var BPromise=require('bluebird');var rp=require(_0xf26a('0x3'));var fs=require('fs');var path=require(_0xf26a('0x4'));var rimraf=require('rimraf');var config=require(_0xf26a('0x5'));var attributes=require(_0xf26a('0x6'));module[_0xf26a('0x7')]=function(_0xe7bd88,_0x3358fa){return _0xe7bd88[_0xf26a('0x8')](_0xf26a('0x9'),attributes,{'tableName':_0xf26a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf26a('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 4205915..f162b04 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 _0x3691=['rpc','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','where','attributes','stringify','lodash','util','moment','bluebird','../../config/utils','../../config/logger'];(function(_0x28a465,_0x558c2c){var _0x258386=function(_0x384486){while(--_0x384486){_0x28a465['push'](_0x28a465['shift']());}};_0x258386(++_0x558c2c);}(_0x3691,0x112));var _0x1369=function(_0x3bd974,_0x3280e4){_0x3bd974=_0x3bd974-0x0;var _0x1154a7=_0x3691[_0x3bd974];return _0x1154a7;};'use strict';var _=require(_0x1369('0x0'));var util=require(_0x1369('0x1'));var moment=require(_0x1369('0x2'));var BPromise=require(_0x1369('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1369('0x4'));var logger=require(_0x1369('0x5'))(_0x1369('0x6'));var config=require('../../config/environment');var jayson=require(_0x1369('0x7'));var client=jayson['client'][_0x1369('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5712ce,_0x351c4b,_0x36842c){return new BPromise(function(_0x3cc491,_0x266051){return client[_0x1369('0x9')](_0x5712ce,_0x36842c)[_0x1369('0xa')](function(_0x1f915e){logger[_0x1369('0xb')](_0x1369('0xc'),_0x351c4b,_0x1369('0xd'));logger[_0x1369('0xe')](_0x1369('0xf'),_0x351c4b,_0x1369('0xd'),JSON['stringify'](_0x1f915e));if(_0x1f915e[_0x1369('0x10')]){if(_0x1f915e[_0x1369('0x10')][_0x1369('0x11')]===0x1f4){logger[_0x1369('0x10')]('FaxApplication,\x20%s,\x20%s',_0x351c4b,_0x1f915e[_0x1369('0x10')]['message']);return _0x266051(_0x1f915e['error'][_0x1369('0x12')]);}logger[_0x1369('0x10')]('FaxApplication,\x20%s,\x20%s',_0x351c4b,_0x1f915e[_0x1369('0x10')][_0x1369('0x12')]);return _0x3cc491(_0x1f915e[_0x1369('0x10')][_0x1369('0x12')]);}else{logger[_0x1369('0xb')](_0x1369('0xc'),_0x351c4b,_0x1369('0xd'));_0x3cc491(_0x1f915e[_0x1369('0x13')][_0x1369('0x12')]);}})[_0x1369('0x14')](function(_0x37c656){logger[_0x1369('0x10')](_0x1369('0xc'),_0x351c4b,_0x37c656);_0x266051(_0x37c656);});});}exports[_0x1369('0x15')]=function(_0x5dd47c){var _0x21ddb9=this;return new Promise(function(_0x2f4e78,_0x4d84c2){return db[_0x1369('0x16')]['update'](_0x5dd47c[_0x1369('0x17')],{'raw':_0x5dd47c[_0x1369('0x18')]?_0x5dd47c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5dd47c[_0x1369('0x18')]?_0x5dd47c['options'][_0x1369('0x19')]||null:null,'attributes':_0x5dd47c[_0x1369('0x18')]?_0x5dd47c[_0x1369('0x18')][_0x1369('0x1a')]||null:null,'limit':_0x5dd47c[_0x1369('0x18')]?_0x5dd47c[_0x1369('0x18')]['limit']||null:null})[_0x1369('0xa')](function(_0x168235){logger[_0x1369('0xb')](_0x1369('0x15'),_0x5dd47c);logger['debug'](_0x1369('0x15'),_0x5dd47c,JSON[_0x1369('0x1b')](_0x168235));_0x2f4e78(_0x168235);})[_0x1369('0x14')](function(_0x54af6c){logger[_0x1369('0x10')](_0x1369('0x15'),_0x54af6c[_0x1369('0x12')],_0x5dd47c);_0x4d84c2(_0x21ddb9['error'](0x1f4,_0x54af6c['message']));});});}; \ No newline at end of file +var _0xeaee=['raw','where','attributes','limit','then','UpdateFaxApplication','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxApplication','update','body','options'];(function(_0x1fd5eb,_0x235203){var _0x102365=function(_0x54de1f){while(--_0x54de1f){_0x1fd5eb['push'](_0x1fd5eb['shift']());}};_0x102365(++_0x235203);}(_0xeaee,0x138));var _0xeeae=function(_0x2f5d2f,_0x406b24){_0x2f5d2f=_0x2f5d2f-0x0;var _0x10ee86=_0xeaee[_0x2f5d2f];return _0x10ee86;};'use strict';var _=require('lodash');var util=require(_0xeeae('0x0'));var moment=require(_0xeeae('0x1'));var BPromise=require(_0xeeae('0x2'));var rs=require(_0xeeae('0x3'));var fs=require('fs');var Redis=require(_0xeeae('0x4'));var db=require(_0xeeae('0x5'))['db'];var utils=require(_0xeeae('0x6'));var logger=require(_0xeeae('0x7'))(_0xeeae('0x8'));var config=require(_0xeeae('0x9'));var jayson=require(_0xeeae('0xa'));var client=jayson[_0xeeae('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11a962,_0x4ab33a,_0x5318b9){return new BPromise(function(_0x23a804,_0x5c9353){return client[_0xeeae('0xc')](_0x11a962,_0x5318b9)['then'](function(_0x63c50f){logger[_0xeeae('0xd')](_0xeeae('0xe'),_0x4ab33a,_0xeeae('0xf'));logger[_0xeeae('0x10')](_0xeeae('0x11'),_0x4ab33a,'request\x20sent',JSON[_0xeeae('0x12')](_0x63c50f));if(_0x63c50f[_0xeeae('0x13')]){if(_0x63c50f['error'][_0xeeae('0x14')]===0x1f4){logger[_0xeeae('0x13')](_0xeeae('0xe'),_0x4ab33a,_0x63c50f['error']['message']);return _0x5c9353(_0x63c50f['error']['message']);}logger[_0xeeae('0x13')](_0xeeae('0xe'),_0x4ab33a,_0x63c50f[_0xeeae('0x13')]['message']);return _0x23a804(_0x63c50f[_0xeeae('0x13')][_0xeeae('0x15')]);}else{logger[_0xeeae('0xd')](_0xeeae('0xe'),_0x4ab33a,_0xeeae('0xf'));_0x23a804(_0x63c50f[_0xeeae('0x16')][_0xeeae('0x15')]);}})[_0xeeae('0x17')](function(_0x2adbb9){logger[_0xeeae('0x13')](_0xeeae('0xe'),_0x4ab33a,_0x2adbb9);_0x5c9353(_0x2adbb9);});});}exports['UpdateFaxApplication']=function(_0x2b3baa){var _0x3c8b51=this;return new Promise(function(_0x151e75,_0x5e0227){return db[_0xeeae('0x18')][_0xeeae('0x19')](_0x2b3baa[_0xeeae('0x1a')],{'raw':_0x2b3baa[_0xeeae('0x1b')]?_0x2b3baa[_0xeeae('0x1b')][_0xeeae('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b3baa[_0xeeae('0x1b')]?_0x2b3baa[_0xeeae('0x1b')][_0xeeae('0x1d')]||null:null,'attributes':_0x2b3baa[_0xeeae('0x1b')]?_0x2b3baa['options'][_0xeeae('0x1e')]||null:null,'limit':_0x2b3baa['options']?_0x2b3baa[_0xeeae('0x1b')][_0xeeae('0x1f')]||null:null})[_0xeeae('0x20')](function(_0x5b2470){logger[_0xeeae('0xd')](_0xeeae('0x21'),_0x2b3baa);logger['debug'](_0xeeae('0x21'),_0x2b3baa,JSON['stringify'](_0x5b2470));_0x151e75(_0x5b2470);})[_0xeeae('0x17')](function(_0x1a815e){logger[_0xeeae('0x13')](_0xeeae('0x21'),_0x1a815e[_0xeeae('0x15')],_0x2b3baa);_0x5e0227(_0x3c8b51[_0xeeae('0x13')](0x1f4,_0x1a815e['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index d4b2378..36a49f3 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 _0x1eb2=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x2b0549,_0x102137){var _0x2041d3=function(_0x481eed){while(--_0x481eed){_0x2b0549['push'](_0x2b0549['shift']());}};_0x2041d3(++_0x102137);}(_0x1eb2,0x94));var _0x21eb=function(_0x5a6b43,_0x78871f){_0x5a6b43=_0x5a6b43-0x0;var _0x2fa4e3=_0x1eb2[_0x5a6b43];return _0x2fa4e3;};'use strict';var multer=require(_0x21eb('0x0'));var util=require(_0x21eb('0x1'));var path=require(_0x21eb('0x2'));var timeout=require(_0x21eb('0x3'));var express=require('express');var router=express[_0x21eb('0x4')]();var fs_extra=require(_0x21eb('0x5'));var auth=require(_0x21eb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x21eb('0x7'));var controller=require('./faxApplication.controller');router[_0x21eb('0x8')]('/',auth[_0x21eb('0x9')](),controller[_0x21eb('0xa')]);router['get']('/:id',auth[_0x21eb('0x9')](),controller['show']);router[_0x21eb('0xb')]('/',auth[_0x21eb('0x9')](),controller[_0x21eb('0xc')]);router[_0x21eb('0xd')](_0x21eb('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x21eb('0xe'),auth['isAuthenticated'](),controller[_0x21eb('0xf')]);module[_0x21eb('0x10')]=router; \ No newline at end of file +var _0x705b=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','show','post','isAuthenticated'];(function(_0x3b0c11,_0x488ac1){var _0x32d4f6=function(_0x3a0a4f){while(--_0x3a0a4f){_0x3b0c11['push'](_0x3b0c11['shift']());}};_0x32d4f6(++_0x488ac1);}(_0x705b,0x16d));var _0xb705=function(_0x3a5462,_0x101820){_0x3a5462=_0x3a5462-0x0;var _0x16ea24=_0x705b[_0x3a5462];return _0x16ea24;};'use strict';var multer=require(_0xb705('0x0'));var util=require(_0xb705('0x1'));var path=require(_0xb705('0x2'));var timeout=require(_0xb705('0x3'));var express=require(_0xb705('0x4'));var router=express[_0xb705('0x5')]();var fs_extra=require(_0xb705('0x6'));var auth=require(_0xb705('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb705('0x8'));var controller=require('./faxApplication.controller');router[_0xb705('0x9')]('/',auth['isAuthenticated'](),controller[_0xb705('0xa')]);router[_0xb705('0x9')](_0xb705('0xb'),auth['isAuthenticated'](),controller[_0xb705('0xc')]);router[_0xb705('0xd')]('/',auth[_0xb705('0xe')](),controller['create']);router[_0xb705('0xf')]('/:id',auth[_0xb705('0xe')](),controller[_0xb705('0x10')]);router[_0xb705('0x11')](_0xb705('0xb'),auth['isAuthenticated'](),controller[_0xb705('0x12')]);module[_0xb705('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 0814140..1bff9a2 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 _0xe77f=['sequelize','exports','DATE','STRING','ENUM','out'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xe77f,0xba));var _0xfe77=function(_0x3d945a,_0x26f0f6){_0x3d945a=_0x3d945a-0x0;var _0x8e3510=_0xe77f[_0x3d945a];return _0x8e3510;};'use strict';var Sequelize=require(_0xfe77('0x0'));module[_0xfe77('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfe77('0x2')]},'disposition':{'type':Sequelize[_0xfe77('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xfe77('0x3')]},'note':{'type':Sequelize[_0xfe77('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xfe77('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xfe77('0x4')]('in',_0xfe77('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfe77('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xfe77('0x4')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x2263=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x41b666,_0x4c3e13){var _0x48841e=function(_0x3d17e0){while(--_0x3d17e0){_0x41b666['push'](_0x41b666['shift']());}};_0x48841e(++_0x4c3e13);}(_0x2263,0x6e));var _0x3226=function(_0x3ef45e,_0xe84f33){_0x3ef45e=_0x3ef45e-0x0;var _0x69e7c=_0x2263[_0x3ef45e];return _0x69e7c;};'use strict';var Sequelize=require(_0x3226('0x0'));module[_0x3226('0x1')]={'closed':{'type':Sequelize[_0x3226('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3226('0x3')]},'disposition':{'type':Sequelize[_0x3226('0x4')]},'secondDisposition':{'type':Sequelize[_0x3226('0x4')]},'thirdDisposition':{'type':Sequelize[_0x3226('0x4')]},'note':{'type':Sequelize[_0x3226('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x3226('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x3226('0x5')]('in',_0x3226('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3226('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x3226('0x5')]('in','out'),'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 20cbea1..738be2d 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 _0x30fb=['\x20=\x20?','read','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','isEmpty','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','params','rawAttributes','includeAll','include','options','create','describe','addMessage','FaxMessage','ids','omit','getMessages','pick','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','Tag','emit','faxInteractionTags:save','removeTags','unix','root','files','join','server','attachments','format','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','json','offset','undefined','count','set','apply','reject','save','update','destroy','error','stack','name','send','map','fullname','TagIds','split','forEach','push','then','catch','FaxInteraction','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','select','field','color','from','u.id','u.fullname','user_has_fax_interactions','u.id\x20=\x20ui.UserId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','search','sqlOperator','length','conditions','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','start','body','some','compact','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x30fb,0x132));var _0xb30f=function(_0x11f539,_0x1026d1){_0x11f539=_0x11f539-0x0;var _0x3a5963=_0x30fb[_0x11f539];return _0x3a5963;};'use strict';var emlformat=require(_0xb30f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb30f('0x1'));var jsonpatch=require(_0xb30f('0x2'));var rp=require(_0xb30f('0x3'));var moment=require(_0xb30f('0x4'));var BPromise=require(_0xb30f('0x5'));var Mustache=require(_0xb30f('0x6'));var util=require(_0xb30f('0x7'));var path=require(_0xb30f('0x8'));var sox=require(_0xb30f('0x9'));var csv=require('to-csv');var ejs=require(_0xb30f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb30f('0xb'));var squel=require(_0xb30f('0xc'));var crypto=require('crypto');var jsforce=require(_0xb30f('0xd'));var deskjs=require(_0xb30f('0xe'));var toCsv=require(_0xb30f('0xf'));var querystring=require(_0xb30f('0x10'));var Papa=require('papaparse');var Redis=require(_0xb30f('0x11'));var authService=require(_0xb30f('0x12'));var qs=require(_0xb30f('0x13'));var as=require(_0xb30f('0x14'));var hardwareService=require(_0xb30f('0x15'));var logger=require(_0xb30f('0x16'))('api');var utils=require(_0xb30f('0x17'));var config=require(_0xb30f('0x18'));var licenseUtil=require(_0xb30f('0x19'));var db=require(_0xb30f('0x1a'))['db'];config[_0xb30f('0x1b')]=_[_0xb30f('0x1c')](config[_0xb30f('0x1b')],{'host':_0xb30f('0x1d'),'port':0x18eb});var socket=require(_0xb30f('0x1e'))(new Redis(config[_0xb30f('0x1b')]));require(_0xb30f('0x1f'))[_0xb30f('0x20')](socket);function respondWithStatusCode(_0x205e89,_0xa184e8){_0xa184e8=_0xa184e8||0xcc;return function(_0x31fec4){if(_0x31fec4){return _0x205e89[_0xb30f('0x21')](_0xa184e8);}return _0x205e89['status'](_0xa184e8)[_0xb30f('0x22')]();};}function respondWithResult(_0x5b69bf,_0x409ad3){_0x409ad3=_0x409ad3||0xc8;return function(_0x5de8f3){if(_0x5de8f3){return _0x5b69bf[_0xb30f('0x23')](_0x409ad3)[_0xb30f('0x24')](_0x5de8f3);}};}function respondWithFilteredResult(_0x5bedfa,_0x42bbc5){return function(_0x295ee1){if(_0x295ee1){var _0x22e6f1=typeof _0x42bbc5[_0xb30f('0x25')]===_0xb30f('0x26')&&typeof _0x42bbc5['limit']===_0xb30f('0x26');var _0x47b80a=_0x295ee1[_0xb30f('0x27')];var _0x4497a7=_0x22e6f1?0x0:_0x42bbc5[_0xb30f('0x25')];var _0xc73cf1=_0x22e6f1?_0x295ee1[_0xb30f('0x27')]:_0x42bbc5[_0xb30f('0x25')]+_0x42bbc5['limit'];var _0x26cdb4;if(_0xc73cf1>=_0x47b80a){_0xc73cf1=_0x47b80a;_0x26cdb4=0xc8;}else{_0x26cdb4=0xce;}_0x5bedfa[_0xb30f('0x23')](_0x26cdb4);return _0x5bedfa[_0xb30f('0x28')]('Content-Range',_0x4497a7+'-'+_0xc73cf1+'/'+_0x47b80a)[_0xb30f('0x24')](_0x295ee1);}return null;};}function patchUpdates(_0x54d468){return function(_0x4e0d75){try{jsonpatch[_0xb30f('0x29')](_0x4e0d75,_0x54d468,!![]);}catch(_0x3e683a){return BPromise[_0xb30f('0x2a')](_0x3e683a);}return _0x4e0d75[_0xb30f('0x2b')]();};}function saveUpdates(_0x2e3320,_0x32f569){return function(_0x4f58db){if(_0x4f58db){return _0x4f58db[_0xb30f('0x2c')](_0x2e3320)['then'](function(_0x195551){return _0x195551;});}return null;};}function removeEntity(_0x3747ab,_0xb92fb5){return function(_0x34304c){if(_0x34304c){return _0x34304c[_0xb30f('0x2d')]()['then'](function(){_0x3747ab[_0xb30f('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x440feb,_0x5b9514){return function(_0x132cbf){if(!_0x132cbf){_0x440feb[_0xb30f('0x21')](0x194);}return _0x132cbf;};}function handleError(_0x4a5c68,_0x2ba728){_0x2ba728=_0x2ba728||0x1f4;return function(_0x523659){logger[_0xb30f('0x2e')](_0x523659[_0xb30f('0x2f')]);if(_0x523659['name']){delete _0x523659[_0xb30f('0x30')];}_0x4a5c68[_0xb30f('0x23')](_0x2ba728)[_0xb30f('0x31')](_0x523659);};}function getInteractionUsers(_0x1e67f7,_0x561852){return new BPromise(function(_0x5a2817,_0x4e7455){try{if(_0x561852[_0x1e67f7['id']]){_0x1e67f7['Users']=_[_0xb30f('0x32')](_0x561852[_0x1e67f7['id']],function(_0x1d0faa){return{'id':_0x1d0faa['id'],'fullname':_0x1d0faa[_0xb30f('0x33')]};});}}catch(_0x32b38b){_0x4e7455(_0x32b38b);}_0x5a2817(_0x1e67f7);});}function getInteractionTags(_0x2b2a9f,_0x2e882c){return new BPromise(function(_0x205e0a,_0x3225cc){try{if(_0x2b2a9f[_0xb30f('0x34')]){_0x2b2a9f['Tags']=[];_0x2b2a9f[_0xb30f('0x34')][_0xb30f('0x35')](',')[_0xb30f('0x36')](function(_0x4cbf63){_0x2b2a9f['Tags'][_0xb30f('0x37')](_0x2e882c[_0x4cbf63]);});}delete _0x2b2a9f[_0xb30f('0x34')];}catch(_0xf7b6df){_0x3225cc(_0xf7b6df);}_0x205e0a(_0x2b2a9f);});}function updateFaxInteraction(_0xc4fe07,_0x3d69d4,_0x1ac87e){return new BPromise(function(_0x3eb23f,_0x31f721){return getInteractionUsers(_0xc4fe07,_0x1ac87e)[_0xb30f('0x38')](function(_0x529314){return getInteractionTags(_0x529314,_0x3d69d4);})[_0xb30f('0x38')](function(_0x498487){_0x3eb23f(_0x498487);})[_0xb30f('0x39')](function(_0x1ae639){_0x31f721(_0x1ae639);});});}exports['index']=function(_0x133541,_0x3cf4f3){var _0x54c708={},_0x39669a={},_0x5588f5={'count':0x0,'rows':[]};var _0x50c8bd=_[_0xb30f('0x32')](db[_0xb30f('0x3a')]['rawAttributes'],function(_0x5898f3){return{'name':_0x5898f3[_0xb30f('0x3b')],'type':_0x5898f3[_0xb30f('0x3c')][_0xb30f('0x3d')]};});_0x39669a[_0xb30f('0x3e')]=_[_0xb30f('0x32')](_0x50c8bd,_0xb30f('0x30'));_0x39669a[_0xb30f('0x3f')]=_[_0xb30f('0x40')](_0x133541['query']);_0x39669a[_0xb30f('0x41')]=_[_0xb30f('0x42')](_0x39669a[_0xb30f('0x3e')],_0x39669a[_0xb30f('0x3f')]);_0x54c708['attributes']=_[_0xb30f('0x42')](_0x39669a['model'],qs['fields'](_0x133541[_0xb30f('0x3f')][_0xb30f('0x43')]));_0x54c708[_0xb30f('0x44')]=_0x54c708[_0xb30f('0x44')]['length']?_0x54c708[_0xb30f('0x44')]:_0x39669a[_0xb30f('0x3e')];if(!_0x133541['query'][_0xb30f('0x45')](_0xb30f('0x46'))){_0x54c708['limit']=qs[_0xb30f('0x47')](_0x133541[_0xb30f('0x3f')][_0xb30f('0x47')]);_0x54c708[_0xb30f('0x25')]=qs['offset'](_0x133541['query'][_0xb30f('0x25')]);}_0x54c708[_0xb30f('0x48')]=qs['sort'](_0x133541['query'][_0xb30f('0x49')]);_0x54c708[_0xb30f('0x4a')]=qs[_0xb30f('0x41')](_['pick'](_0x133541[_0xb30f('0x3f')],_0x39669a[_0xb30f('0x41')]),_0x50c8bd);var _0x3619cf=[];var _0x34de54=squel[_0xb30f('0x4b')]()[_0xb30f('0x4c')]('id')[_0xb30f('0x4c')](_0xb30f('0x30'))['field'](_0xb30f('0x4d'))[_0xb30f('0x4e')]('tools_tags');var _0x216c57=squel['select']()[_0xb30f('0x4c')](_0xb30f('0x4f'))[_0xb30f('0x4c')](_0xb30f('0x50'))['field']('ui.FaxInteractionId')[_0xb30f('0x4e')](_0xb30f('0x51'),'ui')['left_join']('users','u',_0xb30f('0x52'));var _0x4be193=squel[_0xb30f('0x4b')]()[_0xb30f('0x4e')]('fax_interactions','i')[_0xb30f('0x53')](_0xb30f('0x54'),'c',_0xb30f('0x55'))[_0xb30f('0x53')](_0xb30f('0x56'),'o',_0xb30f('0x57'))[_0xb30f('0x53')](_0xb30f('0x58'),'a',_0xb30f('0x59'))[_0xb30f('0x53')](_0xb30f('0x5a'),'me',_0xb30f('0x5b'))[_0xb30f('0x53')](_0xb30f('0x5c'),'it',_0xb30f('0x5d'))[_0xb30f('0x53')](_0xb30f('0x5e'),'t',_0xb30f('0x5f'));var _0x28ebc8=squel['expr']();var _0x32e2d3=[];var _0x286479=squel['expr']();var _0x5d8de9;if(_0x133541['query'][_0xb30f('0x60')]){_0x5d8de9=as['parseSearch'](_0x133541['query'][_0xb30f('0x60')]);var _0xfd0f13=_0x5d8de9[_0xb30f('0x61')];for(var _0x4a6d2b=0x0;_0x4a6d2b<_0x5d8de9['conditions'][_0xb30f('0x62')];_0x4a6d2b++){var _0x5f510b=_0x5d8de9[_0xb30f('0x63')][_0x4a6d2b];var _0x23b359='i';var _0x126d23=_['find'](_0x50c8bd,[_0xb30f('0x30'),_0x5f510b['field']]);if(!_0x126d23){switch(_0x5f510b[_0xb30f('0x4c')]){case _0xb30f('0x64'):if(_0x5f510b[_0xb30f('0x65')]==0x1){_0x4be193['having']('`'+_0x5f510b['field']+_0xb30f('0x66'));}else{_0x4be193[_0xb30f('0x67')]('`'+_0x5f510b[_0xb30f('0x4c')]+_0xb30f('0x68'));}break;case'Contact':if(_0x5f510b['operator']===_0xb30f('0x69')){if(_0x5f510b[_0xb30f('0x65')]['split']('\x20')[_0xb30f('0x62')]>0x1){_0x28ebc8[_0xfd0f13](_0xb30f('0x6a'),qs[_0xb30f('0x6b')](_0x5f510b[_0xb30f('0x65')]),null);}else{var _0x5e5ac8='%'+_0x5f510b['value']+'%';_0x28ebc8[_0xfd0f13](_0xb30f('0x6c'),_0x5e5ac8,_0x5e5ac8,_0x5e5ac8);}}else{_0x126d23=_[_0xb30f('0x6d')](_0x50c8bd,['name',_0xb30f('0x6e')]);_0x5f510b[_0xb30f('0x4c')]=_0xb30f('0x6e');_0x360d93=as['buildExpression'](_0x23b359,_0x126d23['type'],_0x5f510b);_0x28ebc8[_0xfd0f13](_0x360d93['text'],_0x360d93[_0xb30f('0x65')]['start'],_0x360d93[_0xb30f('0x65')][_0xb30f('0x22')]);}break;case'Tag':var _0x2f7b4b=_0x5f510b['value'][_0xb30f('0x35')](',')[_0xb30f('0x32')](function(_0x3502ed){return Number(_0x3502ed);});_0x2f7b4b['forEach'](function(_0x4101f9){_0x286479['or'](_0xb30f('0x6f'),'%,'+_0x4101f9+',%');});_0x32e2d3=_[_0xb30f('0x70')](_0x32e2d3,_0x2f7b4b);break;case _0xb30f('0x71'):if(_0x5f510b[_0xb30f('0x72')]==='$substring'){_0x28ebc8[_0xfd0f13](_0xb30f('0x73'),'%'+_0x5f510b['value']+'%',null);}else{_0x126d23=_[_0xb30f('0x6d')](_0x50c8bd,[_0xb30f('0x30'),'UserId']);_0x5f510b[_0xb30f('0x4c')]=_0xb30f('0x74');_0x360d93=as[_0xb30f('0x75')](_0x23b359,_0x126d23[_0xb30f('0x3c')],_0x5f510b);_0x28ebc8[_0xfd0f13](_0x360d93[_0xb30f('0x76')],_0x360d93[_0xb30f('0x65')][_0xb30f('0x77')],_0x360d93[_0xb30f('0x65')][_0xb30f('0x22')]);}break;case _0xb30f('0x78'):_0x360d93=as['buildExpression']('me',null,_0x5f510b);_0x28ebc8[_0xfd0f13](_0x360d93[_0xb30f('0x76')],_0x360d93[_0xb30f('0x65')][_0xb30f('0x77')],_0x360d93[_0xb30f('0x65')][_0xb30f('0x22')]);break;}}else{var _0x360d93=as[_0xb30f('0x75')](_0x23b359,_0x126d23['type'],_0x5f510b);_0x28ebc8[_0xfd0f13](_0x360d93[_0xb30f('0x76')],_0x360d93[_0xb30f('0x65')][_0xb30f('0x77')],_0x360d93[_0xb30f('0x65')]['end']);}}}else{var _0x3cce63=_(_0x133541[_0xb30f('0x3f')])['keys']()['map'](function(_0x1f2e6e){return _[_0xb30f('0x79')](_0x50c8bd,[_0xb30f('0x30'),_0x1f2e6e])?_0x1f2e6e:undefined;})[_0xb30f('0x7a')]()['value']();if(!_['isEmpty'](_0x3cce63)){_0x3cce63[_0xb30f('0x36')](function(_0x113f38){if(_0x113f38==='FaxAccountId'){_0x4be193[_0xb30f('0x4a')](_0xb30f('0x7b'),[][_0xb30f('0x7c')](_0x133541[_0xb30f('0x3f')][_0x113f38]));}else if(_0x113f38===_0xb30f('0x7d')){var _0x2fd372=JSON[_0xb30f('0x7e')](_0x133541[_0xb30f('0x3f')][_0x113f38])[_0xb30f('0x7f')];var _0x26bba0=JSON[_0xb30f('0x7e')](_0x133541[_0xb30f('0x3f')][_0x113f38])[_0xb30f('0x80')];_0x4be193['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2fd372,_0x26bba0);}else{if(_0x133541[_0xb30f('0x3f')][_0x113f38]===_0xb30f('0x81')){_0x4be193[_0xb30f('0x4a')]('i.'+_0x113f38+'\x20IS\x20NULL');}else{_0x4be193[_0xb30f('0x4a')]('i.'+_0x113f38+_0xb30f('0x82'),_0x133541[_0xb30f('0x3f')][_0x113f38]);}}});}if(_0x133541[_0xb30f('0x3f')][_0xb30f('0x83')]){if(_0x133541[_0xb30f('0x3f')][_0xb30f('0x83')]==0x1){_0x4be193['having']('`unreadMessages`\x20=\x200');}else{_0x4be193['having']('`unreadMessages`\x20>\x200');}}if(_0x133541[_0xb30f('0x3f')][_0xb30f('0x84')]){_0x32e2d3=_[_0xb30f('0x85')](_0x133541[_0xb30f('0x3f')][_0xb30f('0x84')])?_0x133541[_0xb30f('0x3f')][_0xb30f('0x84')]:new Array(_0x133541[_0xb30f('0x3f')]['tag']);_0x32e2d3['forEach'](function(_0x2b5845){_0x286479['or'](_0xb30f('0x6f'),'%,'+_0x2b5845+',%');});}if(_0x133541[_0xb30f('0x3f')]['filter']){var _0x1295dc=_0x133541[_0xb30f('0x3f')][_0xb30f('0x86')][_0xb30f('0x87')]('\x5c','\x5c\x5c')[_0xb30f('0x87')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1295dc)){_0x28ebc8['or'](_0xb30f('0x88'),_0x1295dc+'%')['or'](_0xb30f('0x89'),_0x1295dc+'%');}_0x28ebc8['or'](_0xb30f('0x8a'),_0x1295dc+'%');}}_0x4be193[_0xb30f('0x4a')](_0x28ebc8);_0x4be193[_0xb30f('0x8b')](_0xb30f('0x8c'));var _0x24d28a={'type':db[_0xb30f('0x8d')][_0xb30f('0x8e')][_0xb30f('0x8f')],'raw':!![]};var _0x4d91c9=_0x4be193[_0xb30f('0x90')]();_0x4d91c9['field'](_0xb30f('0x8c'));_0x4d91c9[_0xb30f('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x54c708[_0xb30f('0x48')]){_0x54c708[_0xb30f('0x48')][_0xb30f('0x36')](function(_0x45153e){var _0x57b11a=_0x45153e[0x0]===_0xb30f('0x91')?_0x45153e[0x0]:'i.'+_0x45153e[0x0];_0x4be193[_0xb30f('0x48')](_0x57b11a,_0x45153e[0x1]==='DESC'?![]:!![]);});}if(!_[_0xb30f('0x92')](_0x32e2d3)){_0x4be193[_0xb30f('0x67')](_0x286479);_0x4d91c9['where'](_0xb30f('0x93'),_0x32e2d3);}BPromise[_0xb30f('0x94')]()[_0xb30f('0x38')](function(){if(!_0x5d8de9){if(_0x133541[_0xb30f('0x3f')]['FaxAccountId'])return;_0x4d91c9['where'](_0xb30f('0x95'));_0x4be193['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x133541[_0xb30f('0x96')][_0xb30f('0x97')]!==_0xb30f('0x98'))return;return _0x133541[_0xb30f('0x96')][_0xb30f('0x99')]({'attributes':['id'],'raw':!![]})[_0xb30f('0x38')](function(_0x50f625){if(_['isEmpty'](_0x50f625)){_0x4d91c9[_0xb30f('0x4a')]('i.FaxAccountId\x20IS\x20NULL');_0x4be193['where'](_0xb30f('0x9a'));}else{_0x4d91c9[_0xb30f('0x4a')](_0xb30f('0x7b'),_['map'](_0x50f625,'id'));_0x4be193[_0xb30f('0x4a')](_0xb30f('0x7b'),_[_0xb30f('0x32')](_0x50f625,'id'));}});})['then'](function(){if(_0x133541[_0xb30f('0x96')][_0xb30f('0x97')]===_0xb30f('0x98')&&!_0x5d8de9&&!_0x133541['query']['FaxAccountId'])return[];return db[_0xb30f('0x9b')][_0xb30f('0x3f')](_0x4d91c9[_0xb30f('0x9c')](),_0x24d28a);})[_0xb30f('0x38')](function(_0x12a242){_0x5588f5[_0xb30f('0x27')]=_0x12a242[_0xb30f('0x62')];if(_0x5588f5[_0xb30f('0x27')]===0x0)return[];return db[_0xb30f('0x9b')]['query'](_0x34de54['toString'](),_0x24d28a)[_0xb30f('0x38')](function(_0x3fa74c){_0x3619cf=_['keyBy'](_0x3fa74c,'id');_0x24d28a=_[_0xb30f('0x9d')](_0x24d28a,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x133541[_0xb30f('0x3f')][_0xb30f('0x43')]){_0x54c708[_0xb30f('0x44')]['forEach'](function(_0x6b67af){_0x4be193[_0xb30f('0x4c')]('i.'+_0x6b67af);});}else{_0x4be193['field'](_0xb30f('0x9e'),_0xb30f('0x64'));_0x4be193[_0xb30f('0x4c')]('a.key',_0xb30f('0x9f'));_0x4be193[_0xb30f('0x4c')](_0xb30f('0xa0'),_0xb30f('0xa1'));_0x4be193[_0xb30f('0x4c')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xb30f('0x91'));_0x4be193[_0xb30f('0x4c')]('i.*');_0x4be193['field']('c.firstName',_0xb30f('0xa2'));_0x4be193[_0xb30f('0x4c')](_0xb30f('0xa3'),'Contact.lastName');_0x4be193[_0xb30f('0x4c')](_0xb30f('0xa4'),_0xb30f('0xa5'));_0x4be193['field'](_0xb30f('0xa6'),_0xb30f('0xa7'));_0x4be193['field'](_0xb30f('0xa8'),'Contact.mobile');_0x4be193[_0xb30f('0x4c')](_0xb30f('0xa9'),_0xb30f('0xaa'));_0x4be193[_0xb30f('0x4c')](_0xb30f('0xab'),_0xb30f('0xac'));_0x4be193[_0xb30f('0x4c')](_0xb30f('0xad'),_0xb30f('0xae'));_0x4be193['field'](_0xb30f('0xaf'),_0xb30f('0x34'));}if(_0x54c708[_0xb30f('0x47')])_0x4be193[_0xb30f('0x47')](_0x54c708[_0xb30f('0x47')]);if(_0x54c708[_0xb30f('0x25')])_0x4be193['offset'](_0x54c708['offset']);return db[_0xb30f('0x9b')][_0xb30f('0x3f')](_0x4be193[_0xb30f('0x9c')](),_0x24d28a);})[_0xb30f('0x38')](function(_0x394e7c){if(_0x394e7c[_0xb30f('0x62')]>0x0)_0x216c57[_0xb30f('0x4a')](_0xb30f('0xb0'),_['map'](_0x394e7c,'id'));return db['sequelize'][_0xb30f('0x3f')](_0x216c57[_0xb30f('0x9c')](),_0x24d28a)[_0xb30f('0x38')](function(_0x544627){var _0x4b9eab=_[_0xb30f('0xb1')](_0x544627,'FaxInteractionId');var _0x2820c8=[];_0x394e7c[_0xb30f('0x36')](function(_0x249ed4){_0x2820c8[_0xb30f('0x37')](updateFaxInteraction(_0x249ed4,_0x3619cf,_0x4b9eab));});return BPromise[_0xb30f('0xb2')](_0x2820c8);});});})[_0xb30f('0x38')](function(_0x1d2a9e){_0x5588f5['rows']=_0x1d2a9e;return _0x5588f5;})[_0xb30f('0x38')](respondWithFilteredResult(_0x3cf4f3,_0x54c708))[_0xb30f('0x39')](handleError(_0x3cf4f3,null));};exports['show']=function(_0x50ad95,_0x314067){var _0x39b01e={'raw':![],'where':{'id':_0x50ad95[_0xb30f('0xb3')]['id']}},_0x46f907={};_0x46f907[_0xb30f('0x3e')]=_[_0xb30f('0x40')](db['FaxInteraction'][_0xb30f('0xb4')]);_0x46f907[_0xb30f('0x3f')]=_['keys'](_0x50ad95[_0xb30f('0x3f')]);_0x46f907[_0xb30f('0x41')]=_[_0xb30f('0x42')](_0x46f907[_0xb30f('0x3e')],_0x46f907[_0xb30f('0x3f')]);_0x39b01e[_0xb30f('0x44')]=_[_0xb30f('0x42')](_0x46f907[_0xb30f('0x3e')],qs[_0xb30f('0x43')](_0x50ad95['query'][_0xb30f('0x43')]));_0x39b01e[_0xb30f('0x44')]=_0x39b01e[_0xb30f('0x44')][_0xb30f('0x62')]?_0x39b01e[_0xb30f('0x44')]:_0x46f907['model'];if(_0x50ad95['query'][_0xb30f('0xb5')]){_0x39b01e[_0xb30f('0xb6')]=[{'all':!![]}];}_0x39b01e=_[_0xb30f('0x9d')]({},_0x39b01e,_0x50ad95[_0xb30f('0xb7')]);return db[_0xb30f('0x3a')]['find'](_0x39b01e)[_0xb30f('0x38')](handleEntityNotFound(_0x314067,null))[_0xb30f('0x38')](respondWithResult(_0x314067,null))[_0xb30f('0x39')](handleError(_0x314067,null));};exports[_0xb30f('0xb8')]=function(_0x1c00a9,_0x219580){return db[_0xb30f('0x3a')][_0xb30f('0xb8')](_0x1c00a9[_0xb30f('0x78')],{})['then'](respondWithResult(_0x219580,0xc9))[_0xb30f('0x39')](handleError(_0x219580,null));};exports[_0xb30f('0x2c')]=function(_0x4063ba,_0x2f5090){if(_0x4063ba[_0xb30f('0x78')]['id']){delete _0x4063ba[_0xb30f('0x78')]['id'];}return db[_0xb30f('0x3a')][_0xb30f('0x6d')]({'where':{'id':_0x4063ba[_0xb30f('0xb3')]['id']}})[_0xb30f('0x38')](handleEntityNotFound(_0x2f5090,null))[_0xb30f('0x38')](saveUpdates(_0x4063ba[_0xb30f('0x78')],null))[_0xb30f('0x38')](respondWithResult(_0x2f5090,null))['catch'](handleError(_0x2f5090,null));};exports[_0xb30f('0x2d')]=function(_0x5b8e11,_0x941910){return db[_0xb30f('0x3a')][_0xb30f('0x6d')]({'where':{'id':_0x5b8e11[_0xb30f('0xb3')]['id']}})[_0xb30f('0x38')](handleEntityNotFound(_0x941910,null))[_0xb30f('0x38')](removeEntity(_0x941910,null))[_0xb30f('0x39')](handleError(_0x941910,null));};exports[_0xb30f('0xb9')]=function(_0x696df1,_0x505b67){return db[_0xb30f('0x3a')]['describe']()[_0xb30f('0x38')](respondWithResult(_0x505b67,null))[_0xb30f('0x39')](handleError(_0x505b67,null));};exports[_0xb30f('0xba')]=function(_0x38d81c,_0x4ad388,_0x4ca958){return db[_0xb30f('0xbb')][_0xb30f('0x6d')]({'where':{'id':_0x38d81c['params']['id']}})[_0xb30f('0x38')](handleEntityNotFound(_0x4ad388,null))[_0xb30f('0x38')](function(_0x4bc67a){if(_0x4bc67a){return _0x4bc67a[_0xb30f('0xba')](_0x38d81c[_0xb30f('0x78')][_0xb30f('0xbc')],_[_0xb30f('0xbd')](_0x38d81c[_0xb30f('0x78')],[_0xb30f('0xbc'),'id'])||{});}})[_0xb30f('0x38')](respondWithResult(_0x4ad388,null))[_0xb30f('0x39')](handleError(_0x4ad388,null));};exports[_0xb30f('0xbe')]=function(_0x5c06c8,_0x179be7,_0x2c6548){var _0x2f91c8={'raw':![],'where':{}};var _0x487700={};var _0x2c040a={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x5c06c8[_0xb30f('0xb3')]['id']}})['then'](handleEntityNotFound(_0x179be7,null))['then'](function(_0x122765){if(_0x122765){_0x487700[_0xb30f('0x3e')]=_[_0xb30f('0x40')](db[_0xb30f('0xbb')]['rawAttributes']);_0x487700['query']=_[_0xb30f('0x40')](_0x5c06c8['query']);_0x487700[_0xb30f('0x41')]=_[_0xb30f('0x42')](_0x487700['model'],_0x487700[_0xb30f('0x3f')]);_0x2f91c8[_0xb30f('0x44')]=_[_0xb30f('0x42')](_0x487700[_0xb30f('0x3e')],qs[_0xb30f('0x43')](_0x5c06c8[_0xb30f('0x3f')][_0xb30f('0x43')]));_0x2f91c8[_0xb30f('0x44')]=_0x2f91c8['attributes'][_0xb30f('0x62')]?_0x2f91c8[_0xb30f('0x44')]:_0x487700['model'];if(!_0x5c06c8[_0xb30f('0x3f')][_0xb30f('0x45')](_0xb30f('0x46'))){_0x2f91c8['limit']=qs['limit'](_0x5c06c8[_0xb30f('0x3f')][_0xb30f('0x47')]);_0x2f91c8[_0xb30f('0x25')]=qs[_0xb30f('0x25')](_0x5c06c8[_0xb30f('0x3f')][_0xb30f('0x25')]);}_0x2f91c8[_0xb30f('0x48')]=qs[_0xb30f('0x49')](_0x5c06c8['query'][_0xb30f('0x49')]);_0x2f91c8[_0xb30f('0x4a')]=qs['filters'](_[_0xb30f('0xbf')](_0x5c06c8[_0xb30f('0x3f')],_0x487700[_0xb30f('0x41')]));_0x2f91c8[_0xb30f('0x4a')]['FaxInteractionId']=_0x122765['id'];if(_0x5c06c8[_0xb30f('0x3f')][_0xb30f('0x86')]){_0x2f91c8[_0xb30f('0x4a')]=_['merge'](_0x2f91c8['where'],{'$or':_[_0xb30f('0x32')](_0x2f91c8[_0xb30f('0x44')],function(_0x5c3d28){var _0x1abab4={};_0x1abab4[_0x5c3d28]={'$like':'%'+_0x5c06c8[_0xb30f('0x3f')][_0xb30f('0x86')]+'%'};return _0x1abab4;})});}if(_0x5c06c8[_0xb30f('0x3f')][_0xb30f('0x7f')]){var _0x17af75=_0x5c06c8[_0xb30f('0x3f')][_0xb30f('0x7f')]['split'](',');var _0x22b632={};_0x22b632[_0x17af75[0x0]]={'$gte':moment(_0x17af75[0x1])['format'](_0xb30f('0xc0'))};_0x2f91c8[_0xb30f('0x4a')]=_[_0xb30f('0x9d')](_0x2f91c8[_0xb30f('0x4a')],_0x22b632);}_0x2f91c8=_['merge']({},_0x2f91c8,_0x5c06c8[_0xb30f('0xb7')]);return db[_0xb30f('0xbb')][_0xb30f('0x27')]({'where':_0x2f91c8[_0xb30f('0x4a')]})[_0xb30f('0x38')](function(_0x595966){_0x2c040a[_0xb30f('0x27')]=_0x595966;if(_0x5c06c8[_0xb30f('0x3f')]['includeAll']){_0x2f91c8[_0xb30f('0xb6')]=[{'all':!![]}];}return db[_0xb30f('0xbb')][_0xb30f('0xc1')](_0x2f91c8);})[_0xb30f('0x38')](function(_0x5d4533){_0x2c040a['rows']=_0x5d4533;return _0x2c040a;});}})['then'](respondWithFilteredResult(_0x179be7,_0x2f91c8))[_0xb30f('0x39')](handleError(_0x179be7,null));};exports['addTags']=function(_0x3d0cd2,_0x16ad83,_0x34026c){return db[_0xb30f('0x3a')]['find']({'where':{'id':_0x3d0cd2[_0xb30f('0xb3')]['id']}})['then'](handleEntityNotFound(_0x16ad83,null))[_0xb30f('0x38')](function(_0x4d9fae){if(_0x4d9fae){return _0x4d9fae[_0xb30f('0xc2')](_0x3d0cd2[_0xb30f('0x78')][_0xb30f('0xbc')],_['omit'](_0x3d0cd2[_0xb30f('0x78')],[_0xb30f('0xbc'),'id'])||{})['spread'](function(){return db[_0xb30f('0xc3')]['findAll']({'attributes':['id',_0xb30f('0x30'),_0xb30f('0x4d')],'where':{'id':_0x3d0cd2[_0xb30f('0x78')][_0xb30f('0xbc')]}});})[_0xb30f('0x38')](function(_0x332403){socket[_0xb30f('0xc4')](_0xb30f('0xc5'),{'id':Number(_0x3d0cd2[_0xb30f('0xb3')]['id']),'tags':_0x332403||[]});return{'id':Number(_0x3d0cd2['params']['id']),'tags':_0x332403||[]};});}})[_0xb30f('0x38')](respondWithResult(_0x16ad83,null))['catch'](handleError(_0x16ad83,null));};exports['removeTags']=function(_0x3b98cb,_0x171d11,_0x5c31a5){return db['FaxInteraction'][_0xb30f('0x6d')]({'where':{'id':_0x3b98cb[_0xb30f('0xb3')]['id']}})[_0xb30f('0x38')](handleEntityNotFound(_0x171d11,null))[_0xb30f('0x38')](function(_0x527ab8){if(_0x527ab8){return _0x527ab8[_0xb30f('0xc6')](_0x3b98cb[_0xb30f('0x3f')][_0xb30f('0xbc')]);}})['then'](respondWithStatusCode(_0x171d11,null))[_0xb30f('0x39')](handleError(_0x171d11,null));};exports['download']=function(_0x1ba2da,_0x2ef2c7){var _0x3c6b3e=moment()[_0xb30f('0xc7')]()[_0xb30f('0x9c')]();var _0x3908bb=path['join'](config[_0xb30f('0xc8')],'server',_0xb30f('0xc9'),'tmp');var _0x5c2f4e=path[_0xb30f('0xca')](config['root'],_0xb30f('0xcb'),_0xb30f('0xc9'),_0xb30f('0xcc'));var _0x2cc15f=path['join'](_0x3908bb,_0x3c6b3e);var _0x19a6b0=util[_0xb30f('0xcd')](_0xb30f('0xce'),_0x1ba2da[_0xb30f('0xb3')]['id'],_0x3c6b3e);var _0x33e8eb=path['join'](_0x3908bb,_0x19a6b0);var _0x41b6f3=[];_0x41b6f3[_0xb30f('0x37')]({'model':db[_0xb30f('0xcf')],'as':_0xb30f('0xcf'),'raw':!![]});var _0x7f9c4d=[{'model':db['FaxMessage'],'as':_0xb30f('0xd0'),'attributes':['id','body','createdAt'],'include':_0x41b6f3}];return db[_0xb30f('0x3a')][_0xb30f('0x6d')]({'where':{'id':_0x1ba2da['params']['id']},'include':_0x7f9c4d})[_0xb30f('0x38')](handleEntityNotFound(_0x2ef2c7,null))[_0xb30f('0x38')](function(_0x518308){if(_0x518308&&_0x518308[_0xb30f('0xd0')]){var _0x5c8e97=_0x518308[_0xb30f('0xd1')]({'plain':!![]});fs[_0xb30f('0xd2')](_0x2cc15f);for(var _0x33cfc1=0x0;_0x33cfc1<_0x5c8e97[_0xb30f('0xd0')][_0xb30f('0x62')];_0x33cfc1++){var _0x7a9866=_0x5c8e97[_0xb30f('0xd0')][_0x33cfc1][_0xb30f('0xcf')];if(_0x7a9866){var _0x34e2c8=path[_0xb30f('0xca')](_0x5c2f4e,_0x7a9866['basename']);if(fs[_0xb30f('0xd3')](_0x34e2c8)){fs[_0xb30f('0xd4')](_0x34e2c8)[_0xb30f('0xd5')](fs[_0xb30f('0xd6')](path[_0xb30f('0xca')](_0x2cc15f,_0x7a9866['basename'])));}}}return BPromise['resolve']()[_0xb30f('0x38')](function(){return new BPromise(function(_0x5b2b4b,_0x54e53c){zipdir(_0x2cc15f,{'saveTo':_0x33e8eb},function(_0x57d81a,_0x3b5210){if(_0x57d81a)return _0x54e53c(_0x57d81a);return _0x5b2b4b(_0x3b5210);});})[_0xb30f('0x38')](function(){return new BPromise(function(_0x4ddbb6,_0x4483b6){rimraf(_0x2cc15f,function(_0x2638f0){if(_0x2638f0)_0x4483b6(_0x2638f0);return _0x4ddbb6();});});})['then'](function(){return _0x2ef2c7['download'](_0x33e8eb,_0x19a6b0,function(_0x2264e2){if(_0x2264e2){console[_0xb30f('0xd7')](_0xb30f('0xd8'),_0x2264e2);}else{fs[_0xb30f('0xd9')](_0x33e8eb);}});});});}else{return _0x2ef2c7[_0xb30f('0x21')](0xc8);}})[_0xb30f('0x39')](handleError(_0x2ef2c7,null));}; \ No newline at end of file +var _0x9800=['existsSync','createReadStream','pipe','resolve','download','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./faxInteraction.socket','register','end','json','offset','undefined','count','limit','status','set','apply','reject','save','then','destroy','sendStatus','error','name','send','map','TagIds','Tags','split','forEach','push','catch','index','FaxInteraction','fieldName','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','field','from','tools_tags','select','u.id','u.fullname','ui.FaxInteractionId','left_join','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','UserId','body','keys','compact','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','isEmpty','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','rawAttributes','includeAll','include','options','create','update','describe','FaxMessage','addMessage','omit','ids','findOne','sort','pick','$gte','format','findAll','addTags','setTags','spread','color','emit','faxInteractionTags:save','removeTags','unix','join','server','root','attachments','transcript-%d-%s.zip','Attachment','createdAt','Messages','mkdirSync','basename'];(function(_0x233e13,_0x2fa2de){var _0x53b1a2=function(_0x10e305){while(--_0x10e305){_0x233e13['push'](_0x233e13['shift']());}};_0x53b1a2(++_0x2fa2de);}(_0x9800,0xe5));var _0x0980=function(_0x1a2dab,_0x32ac42){_0x1a2dab=_0x1a2dab-0x0;var _0x59cced=_0x9800[_0x1a2dab];return _0x59cced;};'use strict';var emlformat=require(_0x0980('0x0'));var rimraf=require(_0x0980('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0980('0x2'));var rp=require(_0x0980('0x3'));var moment=require(_0x0980('0x4'));var BPromise=require(_0x0980('0x5'));var Mustache=require('mustache');var util=require(_0x0980('0x6'));var path=require(_0x0980('0x7'));var sox=require('sox');var csv=require(_0x0980('0x8'));var ejs=require(_0x0980('0x9'));var fs=require('fs');var fs_extra=require(_0x0980('0xa'));var _=require(_0x0980('0xb'));var squel=require(_0x0980('0xc'));var crypto=require(_0x0980('0xd'));var jsforce=require(_0x0980('0xe'));var deskjs=require(_0x0980('0xf'));var toCsv=require(_0x0980('0x8'));var querystring=require(_0x0980('0x10'));var Papa=require(_0x0980('0x11'));var Redis=require(_0x0980('0x12'));var authService=require(_0x0980('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0980('0x14'));var hardwareService=require(_0x0980('0x15'));var logger=require('../../config/logger')(_0x0980('0x16'));var utils=require(_0x0980('0x17'));var config=require(_0x0980('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0980('0x19'))['db'];config['redis']=_[_0x0980('0x1a')](config[_0x0980('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x0980('0x1c'))(new Redis(config[_0x0980('0x1b')]));require(_0x0980('0x1d'))[_0x0980('0x1e')](socket);function respondWithStatusCode(_0x5e7ac2,_0x72baf7){_0x72baf7=_0x72baf7||0xcc;return function(_0x11b022){if(_0x11b022){return _0x5e7ac2['sendStatus'](_0x72baf7);}return _0x5e7ac2['status'](_0x72baf7)[_0x0980('0x1f')]();};}function respondWithResult(_0x35ddbf,_0x5c7607){_0x5c7607=_0x5c7607||0xc8;return function(_0x4ff75f){if(_0x4ff75f){return _0x35ddbf['status'](_0x5c7607)[_0x0980('0x20')](_0x4ff75f);}};}function respondWithFilteredResult(_0x1cad5e,_0x5e5878){return function(_0x55a46b){if(_0x55a46b){var _0x34eb8f=typeof _0x5e5878[_0x0980('0x21')]==='undefined'&&typeof _0x5e5878['limit']===_0x0980('0x22');var _0x289e1a=_0x55a46b[_0x0980('0x23')];var _0x1b9a95=_0x34eb8f?0x0:_0x5e5878['offset'];var _0x11f5dd=_0x34eb8f?_0x55a46b[_0x0980('0x23')]:_0x5e5878[_0x0980('0x21')]+_0x5e5878[_0x0980('0x24')];var _0x218a72;if(_0x11f5dd>=_0x289e1a){_0x11f5dd=_0x289e1a;_0x218a72=0xc8;}else{_0x218a72=0xce;}_0x1cad5e[_0x0980('0x25')](_0x218a72);return _0x1cad5e[_0x0980('0x26')]('Content-Range',_0x1b9a95+'-'+_0x11f5dd+'/'+_0x289e1a)[_0x0980('0x20')](_0x55a46b);}return null;};}function patchUpdates(_0x290c1c){return function(_0x4a3879){try{jsonpatch[_0x0980('0x27')](_0x4a3879,_0x290c1c,!![]);}catch(_0x108280){return BPromise[_0x0980('0x28')](_0x108280);}return _0x4a3879[_0x0980('0x29')]();};}function saveUpdates(_0x101cd2,_0x97e437){return function(_0x2d617c){if(_0x2d617c){return _0x2d617c['update'](_0x101cd2)[_0x0980('0x2a')](function(_0x2e6e24){return _0x2e6e24;});}return null;};}function removeEntity(_0x2c1291,_0x3babd9){return function(_0x237590){if(_0x237590){return _0x237590[_0x0980('0x2b')]()[_0x0980('0x2a')](function(){_0x2c1291[_0x0980('0x25')](0xcc)[_0x0980('0x1f')]();});}};}function handleEntityNotFound(_0x2d6b88,_0x4157d0){return function(_0x27129d){if(!_0x27129d){_0x2d6b88[_0x0980('0x2c')](0x194);}return _0x27129d;};}function handleError(_0x4f1972,_0x7aa4e4){_0x7aa4e4=_0x7aa4e4||0x1f4;return function(_0x24a821){logger[_0x0980('0x2d')](_0x24a821['stack']);if(_0x24a821[_0x0980('0x2e')]){delete _0x24a821[_0x0980('0x2e')];}_0x4f1972[_0x0980('0x25')](_0x7aa4e4)[_0x0980('0x2f')](_0x24a821);};}function getInteractionUsers(_0x4abbdb,_0x582859){return new BPromise(function(_0xb258d8,_0x4d5c7d){try{if(_0x582859[_0x4abbdb['id']]){_0x4abbdb['Users']=_[_0x0980('0x30')](_0x582859[_0x4abbdb['id']],function(_0x53f8a2){return{'id':_0x53f8a2['id'],'fullname':_0x53f8a2['fullname']};});}}catch(_0x51a27b){_0x4d5c7d(_0x51a27b);}_0xb258d8(_0x4abbdb);});}function getInteractionTags(_0x2015da,_0x5dc68b){return new BPromise(function(_0x14979c,_0x5810c7){try{if(_0x2015da[_0x0980('0x31')]){_0x2015da[_0x0980('0x32')]=[];_0x2015da['TagIds'][_0x0980('0x33')](',')[_0x0980('0x34')](function(_0x271908){_0x2015da[_0x0980('0x32')][_0x0980('0x35')](_0x5dc68b[_0x271908]);});}delete _0x2015da['TagIds'];}catch(_0x456c3f){_0x5810c7(_0x456c3f);}_0x14979c(_0x2015da);});}function updateFaxInteraction(_0x296901,_0x5b75cb,_0x195aff){return new BPromise(function(_0x3d4b6f,_0x52b12f){return getInteractionUsers(_0x296901,_0x195aff)[_0x0980('0x2a')](function(_0x2c46cb){return getInteractionTags(_0x2c46cb,_0x5b75cb);})[_0x0980('0x2a')](function(_0x2074ac){_0x3d4b6f(_0x2074ac);})[_0x0980('0x36')](function(_0x3d5a04){_0x52b12f(_0x3d5a04);});});}exports[_0x0980('0x37')]=function(_0x1a1612,_0x3c434f){var _0x233342={},_0x30fc52={},_0xd561fe={'count':0x0,'rows':[]};var _0x50dfea=_[_0x0980('0x30')](db[_0x0980('0x38')]['rawAttributes'],function(_0x2c14bb){return{'name':_0x2c14bb[_0x0980('0x39')],'type':_0x2c14bb[_0x0980('0x3a')]['key']};});_0x30fc52['model']=_['map'](_0x50dfea,_0x0980('0x2e'));_0x30fc52[_0x0980('0x3b')]=_['keys'](_0x1a1612['query']);_0x30fc52[_0x0980('0x3c')]=_[_0x0980('0x3d')](_0x30fc52[_0x0980('0x3e')],_0x30fc52[_0x0980('0x3b')]);_0x233342[_0x0980('0x3f')]=_[_0x0980('0x3d')](_0x30fc52['model'],qs[_0x0980('0x40')](_0x1a1612[_0x0980('0x3b')][_0x0980('0x40')]));_0x233342[_0x0980('0x3f')]=_0x233342[_0x0980('0x3f')]['length']?_0x233342[_0x0980('0x3f')]:_0x30fc52[_0x0980('0x3e')];if(!_0x1a1612['query'][_0x0980('0x41')](_0x0980('0x42'))){_0x233342[_0x0980('0x24')]=qs[_0x0980('0x24')](_0x1a1612['query'][_0x0980('0x24')]);_0x233342[_0x0980('0x21')]=qs[_0x0980('0x21')](_0x1a1612[_0x0980('0x3b')][_0x0980('0x21')]);}_0x233342[_0x0980('0x43')]=qs['sort'](_0x1a1612[_0x0980('0x3b')]['sort']);_0x233342[_0x0980('0x44')]=qs['filters'](_['pick'](_0x1a1612['query'],_0x30fc52['filters']),_0x50dfea);var _0x5b5d9b=[];var _0x2cbae6=squel['select']()[_0x0980('0x45')]('id')[_0x0980('0x45')](_0x0980('0x2e'))[_0x0980('0x45')]('color')[_0x0980('0x46')](_0x0980('0x47'));var _0x243bac=squel[_0x0980('0x48')]()[_0x0980('0x45')](_0x0980('0x49'))[_0x0980('0x45')](_0x0980('0x4a'))['field'](_0x0980('0x4b'))['from']('user_has_fax_interactions','ui')[_0x0980('0x4c')]('users','u',_0x0980('0x4d'));var _0x64e952=squel['select']()[_0x0980('0x46')](_0x0980('0x4e'),'i')[_0x0980('0x4c')](_0x0980('0x4f'),'c',_0x0980('0x50'))[_0x0980('0x4c')](_0x0980('0x51'),'o',_0x0980('0x52'))[_0x0980('0x4c')](_0x0980('0x53'),'a',_0x0980('0x54'))[_0x0980('0x4c')](_0x0980('0x55'),'me',_0x0980('0x56'))['left_join'](_0x0980('0x57'),'it',_0x0980('0x58'))[_0x0980('0x4c')](_0x0980('0x47'),'t',_0x0980('0x59'));var _0x22c14f=squel[_0x0980('0x5a')]();var _0x269eca=[];var _0xd9deb1=squel['expr']();var _0x20e38e;if(_0x1a1612['query'][_0x0980('0x5b')]){_0x20e38e=as[_0x0980('0x5c')](_0x1a1612[_0x0980('0x3b')]['search']);var _0xd021bb=_0x20e38e[_0x0980('0x5d')];for(var _0x144b9c=0x0;_0x144b9c<_0x20e38e[_0x0980('0x5e')][_0x0980('0x5f')];_0x144b9c++){var _0x181432=_0x20e38e[_0x0980('0x5e')][_0x144b9c];var _0x1eadc2='i';var _0x5a0500=_[_0x0980('0x60')](_0x50dfea,[_0x0980('0x2e'),_0x181432[_0x0980('0x45')]]);if(!_0x5a0500){switch(_0x181432[_0x0980('0x45')]){case'unreadMessages':if(_0x181432[_0x0980('0x61')]==0x1){_0x64e952[_0x0980('0x62')]('`'+_0x181432[_0x0980('0x45')]+_0x0980('0x63'));}else{_0x64e952[_0x0980('0x62')]('`'+_0x181432[_0x0980('0x45')]+'`\x20>\x200');}break;case _0x0980('0x64'):if(_0x181432[_0x0980('0x65')]===_0x0980('0x66')){if(_0x181432[_0x0980('0x61')][_0x0980('0x33')]('\x20')['length']>0x1){_0x22c14f[_0xd021bb](_0x0980('0x67'),qs['getFullTextValue'](_0x181432[_0x0980('0x61')]),null);}else{var _0xfc18f3='%'+_0x181432[_0x0980('0x61')]+'%';_0x22c14f[_0xd021bb](_0x0980('0x68'),_0xfc18f3,_0xfc18f3,_0xfc18f3);}}else{_0x5a0500=_[_0x0980('0x60')](_0x50dfea,[_0x0980('0x2e'),_0x0980('0x69')]);_0x181432[_0x0980('0x45')]=_0x0980('0x69');_0x3deaf1=as[_0x0980('0x6a')](_0x1eadc2,_0x5a0500[_0x0980('0x3a')],_0x181432);_0x22c14f[_0xd021bb](_0x3deaf1[_0x0980('0x6b')],_0x3deaf1[_0x0980('0x61')][_0x0980('0x6c')],_0x3deaf1[_0x0980('0x61')][_0x0980('0x1f')]);}break;case _0x0980('0x6d'):var _0x135723=_0x181432[_0x0980('0x61')][_0x0980('0x33')](',')[_0x0980('0x30')](function(_0x344a83){return Number(_0x344a83);});_0x135723[_0x0980('0x34')](function(_0x5ee0e0){_0xd9deb1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5ee0e0+',%');});_0x269eca=_['union'](_0x269eca,_0x135723);break;case'User':if(_0x181432['operator']==='$substring'){_0x22c14f[_0xd021bb]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x181432[_0x0980('0x61')]+'%',null);}else{_0x5a0500=_[_0x0980('0x60')](_0x50dfea,[_0x0980('0x2e'),_0x0980('0x6e')]);_0x181432[_0x0980('0x45')]=_0x0980('0x6e');_0x3deaf1=as[_0x0980('0x6a')](_0x1eadc2,_0x5a0500[_0x0980('0x3a')],_0x181432);_0x22c14f[_0xd021bb](_0x3deaf1['text'],_0x3deaf1[_0x0980('0x61')][_0x0980('0x6c')],_0x3deaf1[_0x0980('0x61')][_0x0980('0x1f')]);}break;case _0x0980('0x6f'):_0x3deaf1=as[_0x0980('0x6a')]('me',null,_0x181432);_0x22c14f[_0xd021bb](_0x3deaf1[_0x0980('0x6b')],_0x3deaf1['value']['start'],_0x3deaf1[_0x0980('0x61')][_0x0980('0x1f')]);break;}}else{var _0x3deaf1=as[_0x0980('0x6a')](_0x1eadc2,_0x5a0500[_0x0980('0x3a')],_0x181432);_0x22c14f[_0xd021bb](_0x3deaf1[_0x0980('0x6b')],_0x3deaf1[_0x0980('0x61')][_0x0980('0x6c')],_0x3deaf1[_0x0980('0x61')][_0x0980('0x1f')]);}}}else{var _0x2535cb=_(_0x1a1612[_0x0980('0x3b')])[_0x0980('0x70')]()['map'](function(_0x26a22c){return _['some'](_0x50dfea,['name',_0x26a22c])?_0x26a22c:undefined;})[_0x0980('0x71')]()[_0x0980('0x61')]();if(!_['isEmpty'](_0x2535cb)){_0x2535cb[_0x0980('0x34')](function(_0x5d9add){if(_0x5d9add===_0x0980('0x72')){_0x64e952[_0x0980('0x44')](_0x0980('0x73'),[][_0x0980('0x74')](_0x1a1612[_0x0980('0x3b')][_0x5d9add]));}else if(_0x5d9add==='createdAt'){var _0xa1228=JSON[_0x0980('0x75')](_0x1a1612[_0x0980('0x3b')][_0x5d9add])['$gte'];var _0x11541f=JSON[_0x0980('0x75')](_0x1a1612[_0x0980('0x3b')][_0x5d9add])[_0x0980('0x76')];_0x64e952[_0x0980('0x44')](_0x0980('0x77'),_0xa1228,_0x11541f);}else{if(_0x1a1612[_0x0980('0x3b')][_0x5d9add]===_0x0980('0x78')){_0x64e952['where']('i.'+_0x5d9add+_0x0980('0x79'));}else{_0x64e952[_0x0980('0x44')]('i.'+_0x5d9add+_0x0980('0x7a'),_0x1a1612[_0x0980('0x3b')][_0x5d9add]);}}});}if(_0x1a1612['query'][_0x0980('0x7b')]){if(_0x1a1612[_0x0980('0x3b')][_0x0980('0x7b')]==0x1){_0x64e952[_0x0980('0x62')](_0x0980('0x7c'));}else{_0x64e952[_0x0980('0x62')]('`unreadMessages`\x20>\x200');}}if(_0x1a1612[_0x0980('0x3b')][_0x0980('0x7d')]){_0x269eca=_[_0x0980('0x7e')](_0x1a1612['query']['tag'])?_0x1a1612[_0x0980('0x3b')][_0x0980('0x7d')]:new Array(_0x1a1612[_0x0980('0x3b')][_0x0980('0x7d')]);_0x269eca['forEach'](function(_0x27ea99){_0xd9deb1['or'](_0x0980('0x7f'),'%,'+_0x27ea99+',%');});}if(_0x1a1612[_0x0980('0x3b')][_0x0980('0x80')]){var _0x512596=_0x1a1612['query'][_0x0980('0x80')][_0x0980('0x81')]('\x5c','\x5c\x5c')[_0x0980('0x81')](/'/g,'\x27\x27');if(qs[_0x0980('0x82')](_0x512596)){_0x22c14f['or']('i.id\x20LIKE\x20?',_0x512596+'%')['or'](_0x0980('0x83'),_0x512596+'%');}_0x22c14f['or'](_0x0980('0x84'),_0x512596+'%');}}_0x64e952[_0x0980('0x44')](_0x22c14f);_0x64e952[_0x0980('0x85')](_0x0980('0x86'));var _0xe35d15={'type':db[_0x0980('0x87')][_0x0980('0x88')][_0x0980('0x89')],'raw':!![]};var _0x2e2b2e=_0x64e952[_0x0980('0x8a')]();_0x2e2b2e[_0x0980('0x45')](_0x0980('0x86'));_0x2e2b2e[_0x0980('0x45')](_0x0980('0x8b'),_0x0980('0x8c'));if(_0x233342[_0x0980('0x43')]){_0x233342[_0x0980('0x43')]['forEach'](function(_0x1937b7){var _0x192e15=_0x1937b7[0x0]===_0x0980('0x8d')?_0x1937b7[0x0]:'i.'+_0x1937b7[0x0];_0x64e952[_0x0980('0x43')](_0x192e15,_0x1937b7[0x1]===_0x0980('0x8e')?![]:!![]);});}if(!_[_0x0980('0x8f')](_0x269eca)){_0x64e952['having'](_0xd9deb1);_0x2e2b2e[_0x0980('0x44')](_0x0980('0x90'),_0x269eca);}BPromise['resolve']()['then'](function(){if(!_0x20e38e){if(_0x1a1612[_0x0980('0x3b')][_0x0980('0x72')])return;_0x2e2b2e[_0x0980('0x44')](_0x0980('0x91'));_0x64e952[_0x0980('0x44')](_0x0980('0x91'));return;}if(_0x1a1612['user'][_0x0980('0x92')]!==_0x0980('0x93'))return;return _0x1a1612[_0x0980('0x94')][_0x0980('0x95')]({'attributes':['id'],'raw':!![]})[_0x0980('0x2a')](function(_0x59d59d){if(_[_0x0980('0x8f')](_0x59d59d)){_0x2e2b2e['where'](_0x0980('0x96'));_0x64e952['where']('i.FaxAccountId\x20IS\x20NULL');}else{_0x2e2b2e['where'](_0x0980('0x73'),_[_0x0980('0x30')](_0x59d59d,'id'));_0x64e952[_0x0980('0x44')](_0x0980('0x73'),_[_0x0980('0x30')](_0x59d59d,'id'));}});})['then'](function(){if(_0x1a1612[_0x0980('0x94')][_0x0980('0x92')]===_0x0980('0x93')&&!_0x20e38e&&!_0x1a1612[_0x0980('0x3b')][_0x0980('0x72')])return[];return db[_0x0980('0x97')][_0x0980('0x3b')](_0x2e2b2e[_0x0980('0x98')](),_0xe35d15);})['then'](function(_0x2ad56b){_0xd561fe[_0x0980('0x23')]=_0x2ad56b[_0x0980('0x5f')];if(_0xd561fe[_0x0980('0x23')]===0x0)return[];return db[_0x0980('0x97')][_0x0980('0x3b')](_0x2cbae6[_0x0980('0x98')](),_0xe35d15)[_0x0980('0x2a')](function(_0x4aa279){_0x5b5d9b=_[_0x0980('0x99')](_0x4aa279,'id');_0xe35d15=_[_0x0980('0x9a')](_0xe35d15,{'model':db[_0x0980('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1a1612['query']['fields']){_0x233342['attributes']['forEach'](function(_0x5a8385){_0x64e952[_0x0980('0x45')]('i.'+_0x5a8385);});}else{_0x64e952[_0x0980('0x45')](_0x0980('0x8b'),_0x0980('0x8c'));_0x64e952[_0x0980('0x45')]('a.key',_0x0980('0x9b'));_0x64e952['field'](_0x0980('0x9c'),_0x0980('0x9d'));_0x64e952[_0x0980('0x45')](_0x0980('0x9e'),_0x0980('0x8d'));_0x64e952['field'](_0x0980('0x9f'));_0x64e952['field'](_0x0980('0xa0'),_0x0980('0xa1'));_0x64e952[_0x0980('0x45')](_0x0980('0xa2'),'Contact.lastName');_0x64e952['field'](_0x0980('0xa3'),_0x0980('0xa4'));_0x64e952[_0x0980('0x45')]('c.phone','Contact.phone');_0x64e952['field'](_0x0980('0xa5'),_0x0980('0xa6'));_0x64e952[_0x0980('0x45')](_0x0980('0xa7'),_0x0980('0xa8'));_0x64e952[_0x0980('0x45')]('o.fullname',_0x0980('0xa9'));_0x64e952[_0x0980('0x45')](_0x0980('0xaa'),'Owner.internal');_0x64e952[_0x0980('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x0980('0x31'));}if(_0x233342[_0x0980('0x24')])_0x64e952[_0x0980('0x24')](_0x233342[_0x0980('0x24')]);if(_0x233342[_0x0980('0x21')])_0x64e952['offset'](_0x233342[_0x0980('0x21')]);return db[_0x0980('0x97')][_0x0980('0x3b')](_0x64e952[_0x0980('0x98')](),_0xe35d15);})[_0x0980('0x2a')](function(_0x3e4659){if(_0x3e4659['length']>0x0)_0x243bac[_0x0980('0x44')](_0x0980('0xab'),_[_0x0980('0x30')](_0x3e4659,'id'));return db[_0x0980('0x97')][_0x0980('0x3b')](_0x243bac[_0x0980('0x98')](),_0xe35d15)[_0x0980('0x2a')](function(_0x30f64b){var _0x55cb48=_[_0x0980('0xac')](_0x30f64b,_0x0980('0xad'));var _0x1c3579=[];_0x3e4659[_0x0980('0x34')](function(_0x356be6){_0x1c3579[_0x0980('0x35')](updateFaxInteraction(_0x356be6,_0x5b5d9b,_0x55cb48));});return BPromise[_0x0980('0xae')](_0x1c3579);});});})[_0x0980('0x2a')](function(_0x455746){_0xd561fe[_0x0980('0xaf')]=_0x455746;return _0xd561fe;})[_0x0980('0x2a')](respondWithFilteredResult(_0x3c434f,_0x233342))['catch'](handleError(_0x3c434f,null));};exports[_0x0980('0xb0')]=function(_0x56715f,_0x478b1b){var _0x4918fd={'raw':![],'where':{'id':_0x56715f[_0x0980('0xb1')]['id']}},_0x1f9b21={};_0x1f9b21[_0x0980('0x3e')]=_[_0x0980('0x70')](db[_0x0980('0x38')][_0x0980('0xb2')]);_0x1f9b21[_0x0980('0x3b')]=_['keys'](_0x56715f['query']);_0x1f9b21['filters']=_['intersection'](_0x1f9b21['model'],_0x1f9b21['query']);_0x4918fd[_0x0980('0x3f')]=_[_0x0980('0x3d')](_0x1f9b21[_0x0980('0x3e')],qs[_0x0980('0x40')](_0x56715f[_0x0980('0x3b')][_0x0980('0x40')]));_0x4918fd[_0x0980('0x3f')]=_0x4918fd[_0x0980('0x3f')]['length']?_0x4918fd[_0x0980('0x3f')]:_0x1f9b21[_0x0980('0x3e')];if(_0x56715f[_0x0980('0x3b')][_0x0980('0xb3')]){_0x4918fd[_0x0980('0xb4')]=[{'all':!![]}];}_0x4918fd=_['merge']({},_0x4918fd,_0x56715f[_0x0980('0xb5')]);return db['FaxInteraction'][_0x0980('0x60')](_0x4918fd)[_0x0980('0x2a')](handleEntityNotFound(_0x478b1b,null))['then'](respondWithResult(_0x478b1b,null))[_0x0980('0x36')](handleError(_0x478b1b,null));};exports[_0x0980('0xb6')]=function(_0x4134fa,_0x5a9430){return db[_0x0980('0x38')][_0x0980('0xb6')](_0x4134fa[_0x0980('0x6f')],{})[_0x0980('0x2a')](respondWithResult(_0x5a9430,0xc9))['catch'](handleError(_0x5a9430,null));};exports[_0x0980('0xb7')]=function(_0x53aaae,_0x4e86a4){if(_0x53aaae[_0x0980('0x6f')]['id']){delete _0x53aaae[_0x0980('0x6f')]['id'];}return db[_0x0980('0x38')][_0x0980('0x60')]({'where':{'id':_0x53aaae['params']['id']}})[_0x0980('0x2a')](handleEntityNotFound(_0x4e86a4,null))[_0x0980('0x2a')](saveUpdates(_0x53aaae['body'],null))[_0x0980('0x2a')](respondWithResult(_0x4e86a4,null))[_0x0980('0x36')](handleError(_0x4e86a4,null));};exports['destroy']=function(_0x1a1304,_0x509ed2){return db[_0x0980('0x38')]['find']({'where':{'id':_0x1a1304[_0x0980('0xb1')]['id']}})[_0x0980('0x2a')](handleEntityNotFound(_0x509ed2,null))[_0x0980('0x2a')](removeEntity(_0x509ed2,null))[_0x0980('0x36')](handleError(_0x509ed2,null));};exports[_0x0980('0xb8')]=function(_0x1dcd31,_0x5643c3){return db[_0x0980('0x38')]['describe']()[_0x0980('0x2a')](respondWithResult(_0x5643c3,null))[_0x0980('0x36')](handleError(_0x5643c3,null));};exports['addMessage']=function(_0x42e8a1,_0x176f60,_0x1c3afa){return db[_0x0980('0xb9')][_0x0980('0x60')]({'where':{'id':_0x42e8a1[_0x0980('0xb1')]['id']}})[_0x0980('0x2a')](handleEntityNotFound(_0x176f60,null))[_0x0980('0x2a')](function(_0x18fe95){if(_0x18fe95){return _0x18fe95[_0x0980('0xba')](_0x42e8a1['body']['ids'],_[_0x0980('0xbb')](_0x42e8a1[_0x0980('0x6f')],[_0x0980('0xbc'),'id'])||{});}})[_0x0980('0x2a')](respondWithResult(_0x176f60,null))['catch'](handleError(_0x176f60,null));};exports['getMessages']=function(_0x4a4b56,_0x158ad1,_0xa519df){var _0x523f4c={'raw':![],'where':{}};var _0x57e0af={};var _0x85710e={'count':0x0,'rows':[]};return db[_0x0980('0x38')][_0x0980('0xbd')]({'where':{'id':_0x4a4b56[_0x0980('0xb1')]['id']}})['then'](handleEntityNotFound(_0x158ad1,null))['then'](function(_0x144dfd){if(_0x144dfd){_0x57e0af[_0x0980('0x3e')]=_[_0x0980('0x70')](db[_0x0980('0xb9')][_0x0980('0xb2')]);_0x57e0af[_0x0980('0x3b')]=_[_0x0980('0x70')](_0x4a4b56['query']);_0x57e0af[_0x0980('0x3c')]=_[_0x0980('0x3d')](_0x57e0af[_0x0980('0x3e')],_0x57e0af[_0x0980('0x3b')]);_0x523f4c['attributes']=_[_0x0980('0x3d')](_0x57e0af[_0x0980('0x3e')],qs[_0x0980('0x40')](_0x4a4b56[_0x0980('0x3b')]['fields']));_0x523f4c[_0x0980('0x3f')]=_0x523f4c[_0x0980('0x3f')][_0x0980('0x5f')]?_0x523f4c[_0x0980('0x3f')]:_0x57e0af[_0x0980('0x3e')];if(!_0x4a4b56[_0x0980('0x3b')]['hasOwnProperty'](_0x0980('0x42'))){_0x523f4c['limit']=qs[_0x0980('0x24')](_0x4a4b56['query'][_0x0980('0x24')]);_0x523f4c[_0x0980('0x21')]=qs['offset'](_0x4a4b56['query'][_0x0980('0x21')]);}_0x523f4c[_0x0980('0x43')]=qs[_0x0980('0xbe')](_0x4a4b56[_0x0980('0x3b')][_0x0980('0xbe')]);_0x523f4c['where']=qs[_0x0980('0x3c')](_[_0x0980('0xbf')](_0x4a4b56[_0x0980('0x3b')],_0x57e0af[_0x0980('0x3c')]));_0x523f4c[_0x0980('0x44')][_0x0980('0xad')]=_0x144dfd['id'];if(_0x4a4b56[_0x0980('0x3b')]['filter']){_0x523f4c['where']=_['merge'](_0x523f4c[_0x0980('0x44')],{'$or':_[_0x0980('0x30')](_0x523f4c[_0x0980('0x3f')],function(_0x5219aa){var _0x4df6b1={};_0x4df6b1[_0x5219aa]={'$like':'%'+_0x4a4b56[_0x0980('0x3b')][_0x0980('0x80')]+'%'};return _0x4df6b1;})});}if(_0x4a4b56[_0x0980('0x3b')][_0x0980('0xc0')]){var _0x208955=_0x4a4b56[_0x0980('0x3b')]['$gte'][_0x0980('0x33')](',');var _0x229a43={};_0x229a43[_0x208955[0x0]]={'$gte':moment(_0x208955[0x1])[_0x0980('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x523f4c[_0x0980('0x44')]=_[_0x0980('0x9a')](_0x523f4c[_0x0980('0x44')],_0x229a43);}_0x523f4c=_['merge']({},_0x523f4c,_0x4a4b56[_0x0980('0xb5')]);return db[_0x0980('0xb9')][_0x0980('0x23')]({'where':_0x523f4c[_0x0980('0x44')]})[_0x0980('0x2a')](function(_0x58b1d9){_0x85710e[_0x0980('0x23')]=_0x58b1d9;if(_0x4a4b56[_0x0980('0x3b')][_0x0980('0xb3')]){_0x523f4c[_0x0980('0xb4')]=[{'all':!![]}];}return db[_0x0980('0xb9')][_0x0980('0xc2')](_0x523f4c);})[_0x0980('0x2a')](function(_0x524d86){_0x85710e[_0x0980('0xaf')]=_0x524d86;return _0x85710e;});}})[_0x0980('0x2a')](respondWithFilteredResult(_0x158ad1,_0x523f4c))[_0x0980('0x36')](handleError(_0x158ad1,null));};exports[_0x0980('0xc3')]=function(_0x5189f6,_0x339c04,_0x3078b7){return db[_0x0980('0x38')]['find']({'where':{'id':_0x5189f6[_0x0980('0xb1')]['id']}})[_0x0980('0x2a')](handleEntityNotFound(_0x339c04,null))[_0x0980('0x2a')](function(_0x18def3){if(_0x18def3){return _0x18def3[_0x0980('0xc4')](_0x5189f6['body'][_0x0980('0xbc')],_['omit'](_0x5189f6[_0x0980('0x6f')],[_0x0980('0xbc'),'id'])||{})[_0x0980('0xc5')](function(){return db['Tag']['findAll']({'attributes':['id',_0x0980('0x2e'),_0x0980('0xc6')],'where':{'id':_0x5189f6[_0x0980('0x6f')][_0x0980('0xbc')]}});})[_0x0980('0x2a')](function(_0x3d1cdc){socket[_0x0980('0xc7')](_0x0980('0xc8'),{'id':Number(_0x5189f6['params']['id']),'tags':_0x3d1cdc||[]});return{'id':Number(_0x5189f6[_0x0980('0xb1')]['id']),'tags':_0x3d1cdc||[]};});}})[_0x0980('0x2a')](respondWithResult(_0x339c04,null))[_0x0980('0x36')](handleError(_0x339c04,null));};exports[_0x0980('0xc9')]=function(_0x31b20b,_0x4a9dac,_0x8342ca){return db[_0x0980('0x38')][_0x0980('0x60')]({'where':{'id':_0x31b20b['params']['id']}})[_0x0980('0x2a')](handleEntityNotFound(_0x4a9dac,null))[_0x0980('0x2a')](function(_0x2d4f14){if(_0x2d4f14){return _0x2d4f14[_0x0980('0xc9')](_0x31b20b[_0x0980('0x3b')]['ids']);}})[_0x0980('0x2a')](respondWithStatusCode(_0x4a9dac,null))[_0x0980('0x36')](handleError(_0x4a9dac,null));};exports['download']=function(_0xedc00d,_0x330844){var _0x19f6f3=moment()[_0x0980('0xca')]()[_0x0980('0x98')]();var _0xbeefcd=path[_0x0980('0xcb')](config['root'],_0x0980('0xcc'),'files','tmp');var _0x5df483=path[_0x0980('0xcb')](config[_0x0980('0xcd')],_0x0980('0xcc'),'files',_0x0980('0xce'));var _0x431b37=path[_0x0980('0xcb')](_0xbeefcd,_0x19f6f3);var _0x184a99=util[_0x0980('0xc1')](_0x0980('0xcf'),_0xedc00d[_0x0980('0xb1')]['id'],_0x19f6f3);var _0x49b7a7=path[_0x0980('0xcb')](_0xbeefcd,_0x184a99);var _0xb9569f=[];_0xb9569f[_0x0980('0x35')]({'model':db['Attachment'],'as':_0x0980('0xd0'),'raw':!![]});var _0x7abfa1=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id',_0x0980('0x6f'),_0x0980('0xd1')],'include':_0xb9569f}];return db[_0x0980('0x38')]['find']({'where':{'id':_0xedc00d[_0x0980('0xb1')]['id']},'include':_0x7abfa1})[_0x0980('0x2a')](handleEntityNotFound(_0x330844,null))[_0x0980('0x2a')](function(_0x2aeafe){if(_0x2aeafe&&_0x2aeafe[_0x0980('0xd2')]){var _0x1b96af=_0x2aeafe['get']({'plain':!![]});fs[_0x0980('0xd3')](_0x431b37);for(var _0x2845fd=0x0;_0x2845fd<_0x1b96af[_0x0980('0xd2')][_0x0980('0x5f')];_0x2845fd++){var _0xb91583=_0x1b96af[_0x0980('0xd2')][_0x2845fd][_0x0980('0xd0')];if(_0xb91583){var _0x202e61=path[_0x0980('0xcb')](_0x5df483,_0xb91583[_0x0980('0xd4')]);if(fs[_0x0980('0xd5')](_0x202e61)){fs[_0x0980('0xd6')](_0x202e61)[_0x0980('0xd7')](fs['createWriteStream'](path[_0x0980('0xcb')](_0x431b37,_0xb91583[_0x0980('0xd4')])));}}}return BPromise[_0x0980('0xd8')]()['then'](function(){return new BPromise(function(_0x500e34,_0x322f8d){zipdir(_0x431b37,{'saveTo':_0x49b7a7},function(_0x4e6fe0,_0x29b794){if(_0x4e6fe0)return _0x322f8d(_0x4e6fe0);return _0x500e34(_0x29b794);});})[_0x0980('0x2a')](function(){return new BPromise(function(_0x6860fd,_0x352ce1){rimraf(_0x431b37,function(_0xc9f8de){if(_0xc9f8de)_0x352ce1(_0xc9f8de);return _0x6860fd();});});})[_0x0980('0x2a')](function(){return _0x330844[_0x0980('0xd9')](_0x49b7a7,_0x184a99,function(_0x6a98c3){if(_0x6a98c3){console[_0x0980('0xda')](_0x0980('0xdb'),_0x6a98c3);}else{fs[_0x0980('0xdc')](_0x49b7a7);}});});});}else{return _0x330844[_0x0980('0x2c')](0xc8);}})[_0x0980('0x36')](handleError(_0x330844,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 8e9de92..02fa7f5 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 _0x7a54=['setDataValue','map','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers'];(function(_0x2662eb,_0x5669ac){var _0x27776d=function(_0xad9bac){while(--_0xad9bac){_0x2662eb['push'](_0x2662eb['shift']());}};_0x27776d(++_0x5669ac);}(_0x7a54,0x106));var _0x47a5=function(_0x303868,_0x28f469){_0x303868=_0x303868-0x0;var _0x537e52=_0x7a54[_0x303868];return _0x537e52;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var FaxInteraction=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x47a5('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x47a5('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x47a5('0x5'),'afterDestroy':_0x47a5('0x6')};function emitEvent(_0x2a1a7e){return function(_0x3717e1,_0xfdf934,_0x545a97){_0x3717e1[_0x47a5('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x343372){_0x3717e1[_0x47a5('0x8')]('Users',_0x343372[_0x47a5('0x9')](function(_0x5077f3){return{'id':_0x5077f3['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x3717e1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2a0e98){_0x3717e1[_0x47a5('0x8')]('unreadMessages',_0x2a0e98[_0x47a5('0xa')]);FaxInteractionEvents['emit'](_0x2a1a7e+':'+_0x3717e1['id'],_0x3717e1);FaxInteractionEvents['emit'](_0x2a1a7e,_0x3717e1);_0x545a97(null);})[_0x47a5('0xb')](_0x545a97(null));};}for(var e in events){if(events[_0x47a5('0xc')](e)){var event=events[e];FaxInteraction[_0x47a5('0xd')](e,emitEvent(event));}}module[_0x47a5('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x7a54=['setDataValue','map','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers'];(function(_0x24122,_0x28a27b){var _0x5b40ad=function(_0x53d34b){while(--_0x53d34b){_0x24122['push'](_0x24122['shift']());}};_0x5b40ad(++_0x28a27b);}(_0x7a54,0x106));var _0x47a5=function(_0x5d84b5,_0x3d3dc9){_0x5d84b5=_0x5d84b5-0x0;var _0x25a6da=_0x7a54[_0x5d84b5];return _0x25a6da;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var FaxInteraction=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x47a5('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x47a5('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x47a5('0x5'),'afterDestroy':_0x47a5('0x6')};function emitEvent(_0x2a1a7e){return function(_0x3717e1,_0xfdf934,_0x545a97){_0x3717e1[_0x47a5('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x343372){_0x3717e1[_0x47a5('0x8')]('Users',_0x343372[_0x47a5('0x9')](function(_0x5077f3){return{'id':_0x5077f3['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x3717e1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2a0e98){_0x3717e1[_0x47a5('0x8')]('unreadMessages',_0x2a0e98[_0x47a5('0xa')]);FaxInteractionEvents['emit'](_0x2a1a7e+':'+_0x3717e1['id'],_0x3717e1);FaxInteractionEvents['emit'](_0x2a1a7e,_0x3717e1);_0x545a97(null);})[_0x47a5('0xb')](_0x545a97(null));};}for(var e in events){if(events[_0x47a5('0xc')](e)){var event=events[e];FaxInteraction[_0x47a5('0xd')](e,emitEvent(event));}}module[_0x47a5('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 726abb1..6ac18db 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 _0x2a86=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x442b33,_0x4b79d1){var _0x5cbd4a=function(_0x373192){while(--_0x373192){_0x442b33['push'](_0x442b33['shift']());}};_0x5cbd4a(++_0x4b79d1);}(_0x2a86,0xd0));var _0x62a8=function(_0x34cb23,_0x16f4cc){_0x34cb23=_0x34cb23-0x0;var _0x316f93=_0x2a86[_0x34cb23];return _0x316f93;};'use strict';var _=require(_0x62a8('0x0'));var util=require(_0x62a8('0x1'));var logger=require('../../config/logger')(_0x62a8('0x2'));var moment=require(_0x62a8('0x3'));var BPromise=require(_0x62a8('0x4'));var rp=require(_0x62a8('0x5'));var fs=require('fs');var path=require(_0x62a8('0x6'));var rimraf=require(_0x62a8('0x7'));var config=require(_0x62a8('0x8'));var attributes=require(_0x62a8('0x9'));module[_0x62a8('0xa')]=function(_0x3e698a,_0x2fcf5c){return _0x3e698a[_0x62a8('0xb')](_0x62a8('0xc'),attributes,{'tableName':_0x62a8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x528bc0,_0x1d9c56,_0x3605d4){if(_0x528bc0[_0x62a8('0xe')](_0x62a8('0xf'))){_0x528bc0[_0x62a8('0x10')]=moment()[_0x62a8('0x11')](_0x62a8('0x12'));}_0x3605d4(null,_0x528bc0);}}});}; \ No newline at end of file +var _0x26ee=['define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','exports'];(function(_0x26cefd,_0x53e737){var _0x2b1b1c=function(_0x399906){while(--_0x399906){_0x26cefd['push'](_0x26cefd['shift']());}};_0x2b1b1c(++_0x53e737);}(_0x26ee,0x19f));var _0xe26e=function(_0x293fab,_0x58f6aa){_0x293fab=_0x293fab-0x0;var _0x40513b=_0x26ee[_0x293fab];return _0x40513b;};'use strict';var _=require(_0xe26e('0x0'));var util=require(_0xe26e('0x1'));var logger=require(_0xe26e('0x2'))(_0xe26e('0x3'));var moment=require('moment');var BPromise=require(_0xe26e('0x4'));var rp=require(_0xe26e('0x5'));var fs=require('fs');var path=require(_0xe26e('0x6'));var rimraf=require('rimraf');var config=require(_0xe26e('0x7'));var attributes=require(_0xe26e('0x8'));module[_0xe26e('0x9')]=function(_0x49d4f6,_0x131d1a){return _0x49d4f6[_0xe26e('0xa')](_0xe26e('0xb'),attributes,{'tableName':_0xe26e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b648,_0x566a8d,_0x78bb44){if(_0x4b648[_0xe26e('0xd')]('closed')){_0x4b648[_0xe26e('0xe')]=moment()[_0xe26e('0xf')](_0xe26e('0x10'));}_0x78bb44(null,_0x4b648);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 17fff6f..b0fa565 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 _0xb537=['./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','attributes','limit','AddTagsToFaxInteraction','find','where','then','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x548a14,_0x122830){var _0x15d6d3=function(_0x328b65){while(--_0x328b65){_0x548a14['push'](_0x548a14['shift']());}};_0x15d6d3(++_0x122830);}(_0xb537,0x14a));var _0x7b53=function(_0x50e596,_0x5e0661){_0x50e596=_0x50e596-0x0;var _0x333516=_0xb537[_0x50e596];return _0x333516;};'use strict';var _=require(_0x7b53('0x0'));var util=require(_0x7b53('0x1'));var moment=require(_0x7b53('0x2'));var BPromise=require(_0x7b53('0x3'));var rs=require(_0x7b53('0x4'));var fs=require('fs');var Redis=require(_0x7b53('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b53('0x6'));var logger=require('../../config/logger')(_0x7b53('0x7'));var config=require(_0x7b53('0x8'));var jayson=require(_0x7b53('0x9'));var client=jayson[_0x7b53('0xa')][_0x7b53('0xb')]({'port':0x232a});config[_0x7b53('0xc')]=_[_0x7b53('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7b53('0xc')]));require(_0x7b53('0xe'))[_0x7b53('0xf')](socket);function respondWithRpcPromise(_0x3099ba,_0x591785,_0x354019){return new BPromise(function(_0x332dc3,_0x4bd6cf){return client[_0x7b53('0x10')](_0x3099ba,_0x354019)['then'](function(_0x4b7400){logger[_0x7b53('0x11')](_0x7b53('0x12'),_0x591785,'request\x20sent');logger[_0x7b53('0x13')](_0x7b53('0x14'),_0x591785,_0x7b53('0x15'),JSON[_0x7b53('0x16')](_0x4b7400));if(_0x4b7400['error']){if(_0x4b7400[_0x7b53('0x17')][_0x7b53('0x18')]===0x1f4){logger[_0x7b53('0x17')](_0x7b53('0x12'),_0x591785,_0x4b7400[_0x7b53('0x17')]['message']);return _0x4bd6cf(_0x4b7400['error'][_0x7b53('0x19')]);}logger[_0x7b53('0x17')](_0x7b53('0x12'),_0x591785,_0x4b7400[_0x7b53('0x17')][_0x7b53('0x19')]);return _0x332dc3(_0x4b7400[_0x7b53('0x17')][_0x7b53('0x19')]);}else{logger[_0x7b53('0x11')](_0x7b53('0x12'),_0x591785,_0x7b53('0x15'));_0x332dc3(_0x4b7400[_0x7b53('0x1a')]['message']);}})[_0x7b53('0x1b')](function(_0x9e54b4){logger[_0x7b53('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x591785,_0x9e54b4);_0x4bd6cf(_0x9e54b4);});});}exports[_0x7b53('0x1c')]=function(_0x3c2664){var _0x19262d=this;return new Promise(function(_0x2d4fb5,_0x1da0c3){return db[_0x7b53('0x1d')][_0x7b53('0x1e')](_0x3c2664[_0x7b53('0x1f')],{'raw':_0x3c2664[_0x7b53('0x20')]?_0x3c2664[_0x7b53('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c2664[_0x7b53('0x20')]?_0x3c2664[_0x7b53('0x20')]['where']||null:null,'attributes':_0x3c2664[_0x7b53('0x20')]?_0x3c2664['options'][_0x7b53('0x21')]||null:null,'limit':_0x3c2664[_0x7b53('0x20')]?_0x3c2664[_0x7b53('0x20')][_0x7b53('0x22')]||null:null})['then'](function(_0x535fbb){logger[_0x7b53('0x11')]('UpdateFaxInteraction',_0x3c2664);logger['debug']('UpdateFaxInteraction',_0x3c2664,JSON[_0x7b53('0x16')](_0x535fbb));_0x2d4fb5(_0x535fbb);})[_0x7b53('0x1b')](function(_0xfe20cf){logger[_0x7b53('0x17')](_0x7b53('0x1c'),_0xfe20cf[_0x7b53('0x19')],_0x3c2664);_0x1da0c3(_0x19262d[_0x7b53('0x17')](0x1f4,_0xfe20cf[_0x7b53('0x19')]));});});};exports[_0x7b53('0x23')]=function(_0x5ce4dd){return new Promise(function(_0x25db4d,_0x2256ef){return db[_0x7b53('0x1d')][_0x7b53('0x24')]({'where':_0x5ce4dd[_0x7b53('0x20')]?_0x5ce4dd[_0x7b53('0x20')][_0x7b53('0x25')]||null:null})[_0x7b53('0x26')](function(_0xf0807a){if(_0xf0807a){return _0xf0807a['addTags'](_0x5ce4dd[_0x7b53('0x1f')][_0x7b53('0x27')],_[_0x7b53('0x28')](_0x5ce4dd[_0x7b53('0x1f')],[_0x7b53('0x27'),'id'])||{});}})[_0x7b53('0x29')](function(_0x53b2ac){logger[_0x7b53('0x11')](_0x7b53('0x2a'),_0x5ce4dd);logger[_0x7b53('0x13')](_0x7b53('0x2a'),_0x5ce4dd,JSON[_0x7b53('0x16')](_0x53b2ac));_0x25db4d(_0x53b2ac);})[_0x7b53('0x1b')](function(_0x552b2c){logger[_0x7b53('0x17')]('AddTags',_0x552b2c[_0x7b53('0x19')],_0x5ce4dd);_0x2256ef(_this['error'](0x1f4,_0x552b2c['message']));});});}; \ No newline at end of file +var _0x7edd=['AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','then','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','UpdateFaxInteraction','FaxInteraction','update','body','options','attributes','limit','catch','AddTagsToFaxInteraction','find','where','addTags','ids','spread'];(function(_0x5e6c64,_0x2a876b){var _0x33f722=function(_0x3637e5){while(--_0x3637e5){_0x5e6c64['push'](_0x5e6c64['shift']());}};_0x33f722(++_0x2a876b);}(_0x7edd,0xa9));var _0xd7ed=function(_0x287b2b,_0x3cbb34){_0x287b2b=_0x287b2b-0x0;var _0xc9b2c4=_0x7edd[_0x287b2b];return _0xc9b2c4;};'use strict';var _=require(_0xd7ed('0x0'));var util=require(_0xd7ed('0x1'));var moment=require(_0xd7ed('0x2'));var BPromise=require(_0xd7ed('0x3'));var rs=require(_0xd7ed('0x4'));var fs=require('fs');var Redis=require(_0xd7ed('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd7ed('0x6'));var logger=require('../../config/logger')(_0xd7ed('0x7'));var config=require('../../config/environment');var jayson=require(_0xd7ed('0x8'));var client=jayson[_0xd7ed('0x9')]['http']({'port':0x232a});config[_0xd7ed('0xa')]=_[_0xd7ed('0xb')](config['redis'],{'host':_0xd7ed('0xc'),'port':0x18eb});var socket=require(_0xd7ed('0xd'))(new Redis(config['redis']));require(_0xd7ed('0xe'))[_0xd7ed('0xf')](socket);function respondWithRpcPromise(_0x425ce0,_0x14dbc4,_0x1f0b08){return new BPromise(function(_0x4fca1b,_0x20c8ba){return client['request'](_0x425ce0,_0x1f0b08)[_0xd7ed('0x10')](function(_0x5e15e8){logger['info'](_0xd7ed('0x11'),_0x14dbc4,'request\x20sent');logger[_0xd7ed('0x12')](_0xd7ed('0x13'),_0x14dbc4,_0xd7ed('0x14'),JSON[_0xd7ed('0x15')](_0x5e15e8));if(_0x5e15e8['error']){if(_0x5e15e8[_0xd7ed('0x16')][_0xd7ed('0x17')]===0x1f4){logger[_0xd7ed('0x16')](_0xd7ed('0x11'),_0x14dbc4,_0x5e15e8[_0xd7ed('0x16')][_0xd7ed('0x18')]);return _0x20c8ba(_0x5e15e8['error']['message']);}logger[_0xd7ed('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x14dbc4,_0x5e15e8[_0xd7ed('0x16')][_0xd7ed('0x18')]);return _0x4fca1b(_0x5e15e8[_0xd7ed('0x16')]['message']);}else{logger[_0xd7ed('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x14dbc4,_0xd7ed('0x14'));_0x4fca1b(_0x5e15e8[_0xd7ed('0x1a')][_0xd7ed('0x18')]);}})['catch'](function(_0x2f7a93){logger[_0xd7ed('0x16')](_0xd7ed('0x11'),_0x14dbc4,_0x2f7a93);_0x20c8ba(_0x2f7a93);});});}exports[_0xd7ed('0x1b')]=function(_0x3c34c3){var _0x5c2ca4=this;return new Promise(function(_0xa55749,_0xa97adc){return db[_0xd7ed('0x1c')][_0xd7ed('0x1d')](_0x3c34c3[_0xd7ed('0x1e')],{'raw':_0x3c34c3['options']?_0x3c34c3[_0xd7ed('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c34c3['options']?_0x3c34c3['options']['where']||null:null,'attributes':_0x3c34c3[_0xd7ed('0x1f')]?_0x3c34c3[_0xd7ed('0x1f')][_0xd7ed('0x20')]||null:null,'limit':_0x3c34c3[_0xd7ed('0x1f')]?_0x3c34c3[_0xd7ed('0x1f')][_0xd7ed('0x21')]||null:null})['then'](function(_0x58822f){logger[_0xd7ed('0x19')](_0xd7ed('0x1b'),_0x3c34c3);logger[_0xd7ed('0x12')](_0xd7ed('0x1b'),_0x3c34c3,JSON['stringify'](_0x58822f));_0xa55749(_0x58822f);})[_0xd7ed('0x22')](function(_0xa3a14b){logger['error'](_0xd7ed('0x1b'),_0xa3a14b['message'],_0x3c34c3);_0xa97adc(_0x5c2ca4['error'](0x1f4,_0xa3a14b[_0xd7ed('0x18')]));});});};exports[_0xd7ed('0x23')]=function(_0x2cb511){return new Promise(function(_0x106609,_0x467d27){return db[_0xd7ed('0x1c')][_0xd7ed('0x24')]({'where':_0x2cb511[_0xd7ed('0x1f')]?_0x2cb511[_0xd7ed('0x1f')][_0xd7ed('0x25')]||null:null})['then'](function(_0xfb5c8c){if(_0xfb5c8c){return _0xfb5c8c[_0xd7ed('0x26')](_0x2cb511['body'][_0xd7ed('0x27')],_['omit'](_0x2cb511[_0xd7ed('0x1e')],[_0xd7ed('0x27'),'id'])||{});}})[_0xd7ed('0x28')](function(_0x28e33a){logger['info'](_0xd7ed('0x29'),_0x2cb511);logger[_0xd7ed('0x12')]('AddTags',_0x2cb511,JSON['stringify'](_0x28e33a));_0x106609(_0x28e33a);})['catch'](function(_0x4ea497){logger[_0xd7ed('0x16')](_0xd7ed('0x29'),_0x4ea497[_0xd7ed('0x18')],_0x2cb511);_0x467d27(_this[_0xd7ed('0x16')](0x1f4,_0x4ea497[_0xd7ed('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 6ed6fec..a124f50 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 _0x4280=['removeListener','register','length','faxInteraction:','./faxInteraction.events','emit'];(function(_0x28fbcc,_0x512282){var _0x5e9121=function(_0x45610c){while(--_0x45610c){_0x28fbcc['push'](_0x28fbcc['shift']());}};_0x5e9121(++_0x512282);}(_0x4280,0x7c));var _0x0428=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4280[_0x3dd15e];return _0x231fd0;};'use strict';var FaxInteractionEvents=require(_0x0428('0x0'));var events=['save','remove','update'];function createListener(_0x411878,_0x19c1b3){return function(_0x58ee9b){_0x19c1b3[_0x0428('0x1')](_0x411878,_0x58ee9b);};}function removeListener(_0x3980ca,_0x4e604d){return function(){FaxInteractionEvents[_0x0428('0x2')](_0x3980ca,_0x4e604d);};}exports[_0x0428('0x3')]=function(_0x162390){for(var _0x565a38=0x0,_0x326168=events[_0x0428('0x4')];_0x565a38<_0x326168;_0x565a38++){var _0x433026=events[_0x565a38];var _0x4c94ba=createListener(_0x0428('0x5')+_0x433026,_0x162390);FaxInteractionEvents['on'](_0x433026,_0x4c94ba);}}; \ No newline at end of file +var _0x4a4c=['save','update','removeListener','./faxInteraction.events'];(function(_0x36ce8d,_0x24e4ea){var _0x3c1e57=function(_0x433926){while(--_0x433926){_0x36ce8d['push'](_0x36ce8d['shift']());}};_0x3c1e57(++_0x24e4ea);}(_0x4a4c,0x187));var _0xc4a4=function(_0x2c768d,_0x5b3efb){_0x2c768d=_0x2c768d-0x0;var _0x2e0941=_0x4a4c[_0x2c768d];return _0x2e0941;};'use strict';var FaxInteractionEvents=require(_0xc4a4('0x0'));var events=[_0xc4a4('0x1'),'remove',_0xc4a4('0x2')];function createListener(_0x23023a,_0x50dcf4){return function(_0x33256e){_0x50dcf4['emit'](_0x23023a,_0x33256e);};}function removeListener(_0x36ef03,_0x53227d){return function(){FaxInteractionEvents[_0xc4a4('0x3')](_0x36ef03,_0x53227d);};}exports['register']=function(_0x21a65d){for(var _0x3b3325=0x0,_0x3c5866=events['length'];_0x3b3325<_0x3c5866;_0x3b3325++){var _0x58053c=events[_0x3b3325];var _0x53f323=createListener('faxInteraction:'+_0x58053c,_0x21a65d);FaxInteractionEvents['on'](_0x58053c,_0x53f323);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index b012249..c3a913b 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 _0x3ef4=['update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id/messages','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update'];(function(_0x119629,_0x246787){var _0x49a771=function(_0x23624c){while(--_0x23624c){_0x119629['push'](_0x119629['shift']());}};_0x49a771(++_0x246787);}(_0x3ef4,0x166));var _0x43ef=function(_0x21c80a,_0x275d41){_0x21c80a=_0x21c80a-0x0;var _0x4a7719=_0x3ef4[_0x21c80a];return _0x4a7719;};'use strict';var multer=require(_0x43ef('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x43ef('0x1'));var express=require(_0x43ef('0x2'));var router=express[_0x43ef('0x3')]();var fs_extra=require(_0x43ef('0x4'));var auth=require(_0x43ef('0x5'));var interaction=require(_0x43ef('0x6'));var config=require(_0x43ef('0x7'));var controller=require(_0x43ef('0x8'));router[_0x43ef('0x9')]('/',auth['isAuthenticated'](),controller[_0x43ef('0xa')]);router[_0x43ef('0x9')](_0x43ef('0xb'),auth[_0x43ef('0xc')](),controller[_0x43ef('0xd')]);router['get']('/:id',auth[_0x43ef('0xc')](),controller['show']);router[_0x43ef('0x9')](_0x43ef('0xe'),auth[_0x43ef('0xc')](),controller['getMessages']);router[_0x43ef('0x9')]('/:id/download',auth[_0x43ef('0xc')](),controller['download']);router[_0x43ef('0xf')]('/',auth[_0x43ef('0xc')](),controller[_0x43ef('0x10')]);router[_0x43ef('0xf')](_0x43ef('0xe'),auth[_0x43ef('0xc')](),controller[_0x43ef('0x11')]);router['post'](_0x43ef('0x12'),auth['isAuthenticated'](),interaction[_0x43ef('0x13')](_0x43ef('0x14'),_0x43ef('0x15')),controller[_0x43ef('0x16')]);router[_0x43ef('0x17')](_0x43ef('0x18'),auth[_0x43ef('0xc')](),interaction[_0x43ef('0x13')](_0x43ef('0x14'),_0x43ef('0x19')),controller[_0x43ef('0x1a')]);router[_0x43ef('0x1b')](_0x43ef('0x18'),auth[_0x43ef('0xc')](),interaction[_0x43ef('0x13')](_0x43ef('0x14'),_0x43ef('0x1c')),controller[_0x43ef('0x1d')]);router['delete'](_0x43ef('0x12'),auth[_0x43ef('0xc')](),controller[_0x43ef('0x1e')]);module[_0x43ef('0x1f')]=router; \ No newline at end of file +var _0x83ea=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','addTags','put','fax','update','delete','destroy','removeTags','exports'];(function(_0x3ebeb1,_0x42622e){var _0x1bb2b1=function(_0x25ef3f){while(--_0x25ef3f){_0x3ebeb1['push'](_0x3ebeb1['shift']());}};_0x1bb2b1(++_0x42622e);}(_0x83ea,0x80));var _0xa83e=function(_0x2a3b6e,_0x191964){_0x2a3b6e=_0x2a3b6e-0x0;var _0x70c2b5=_0x83ea[_0x2a3b6e];return _0x70c2b5;};'use strict';var multer=require(_0xa83e('0x0'));var util=require(_0xa83e('0x1'));var path=require('path');var timeout=require(_0xa83e('0x2'));var express=require(_0xa83e('0x3'));var router=express[_0xa83e('0x4')]();var fs_extra=require(_0xa83e('0x5'));var auth=require(_0xa83e('0x6'));var interaction=require(_0xa83e('0x7'));var config=require(_0xa83e('0x8'));var controller=require('./faxInteraction.controller');router['get']('/',auth[_0xa83e('0x9')](),controller[_0xa83e('0xa')]);router[_0xa83e('0xb')](_0xa83e('0xc'),auth[_0xa83e('0x9')](),controller['describe']);router[_0xa83e('0xb')](_0xa83e('0xd'),auth[_0xa83e('0x9')](),controller[_0xa83e('0xe')]);router[_0xa83e('0xb')](_0xa83e('0xf'),auth[_0xa83e('0x9')](),controller[_0xa83e('0x10')]);router[_0xa83e('0xb')](_0xa83e('0x11'),auth[_0xa83e('0x9')](),controller[_0xa83e('0x12')]);router[_0xa83e('0x13')]('/',auth[_0xa83e('0x9')](),controller[_0xa83e('0x14')]);router[_0xa83e('0x13')](_0xa83e('0xf'),auth[_0xa83e('0x9')](),controller[_0xa83e('0x15')]);router[_0xa83e('0x13')](_0xa83e('0x16'),auth[_0xa83e('0x9')](),interaction[_0xa83e('0x17')]('fax','faxinteraction:addtags'),controller[_0xa83e('0x18')]);router[_0xa83e('0x19')]('/:id',auth[_0xa83e('0x9')](),interaction[_0xa83e('0x17')](_0xa83e('0x1a'),'faxinteraction:update'),controller[_0xa83e('0x1b')]);router[_0xa83e('0x1c')](_0xa83e('0xd'),auth[_0xa83e('0x9')](),interaction[_0xa83e('0x17')](_0xa83e('0x1a'),'faxinteraction:destroy'),controller[_0xa83e('0x1d')]);router['delete'](_0xa83e('0x16'),auth[_0xa83e('0x9')](),controller[_0xa83e('0x1e')]);module[_0xa83e('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index d6e014c..0af2516 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 _0x062d=['out','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x15ace7,_0x5c1bf8){var _0x31f1b8=function(_0x1a7f2f){while(--_0x1a7f2f){_0x15ace7['push'](_0x15ace7['shift']());}};_0x31f1b8(++_0x5c1bf8);}(_0x062d,0x197));var _0xd062=function(_0x1c208e,_0x2a0a5b){_0x1c208e=_0x1c208e-0x0;var _0x5104ff=_0x062d[_0x1c208e];return _0x5104ff;};'use strict';var Sequelize=require(_0xd062('0x0'));module[_0xd062('0x1')]={'body':{'type':Sequelize[_0xd062('0x2')](_0xd062('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd062('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd062('0x5')]('in',_0xd062('0x6')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xd062('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xba79=['TEXT','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x282c6e,_0x4bf2ca){var _0x26545f=function(_0x1d5db3){while(--_0x1d5db3){_0x282c6e['push'](_0x282c6e['shift']());}};_0x26545f(++_0x4bf2ca);}(_0xba79,0x157));var _0x9ba7=function(_0x14eb24,_0x592e97){_0x14eb24=_0x14eb24-0x0;var _0x30aa1e=_0xba79[_0x14eb24];return _0x30aa1e;};'use strict';var Sequelize=require(_0x9ba7('0x0'));module[_0x9ba7('0x1')]={'body':{'type':Sequelize['TEXT'](_0x9ba7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9ba7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9ba7('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x9ba7('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 d9dd9e9..6515ec2 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 _0x2433=['include','findAll','rows','params','options','find','body','describe','fax-interactions','accept','fax','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','CmContact','Contact','get','FaxInteraction','read1stAt','user','role','interaction','null','AcceptMessage','cf_','push','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','SIP/%s','channel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','interface','rejectmessage','create','findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','includeAll'];(function(_0x368cd6,_0x275b63){var _0x16161d=function(_0x360aec){while(--_0x360aec){_0x368cd6['push'](_0x368cd6['shift']());}};_0x16161d(++_0x275b63);}(_0x2433,0x158));var _0x3243=function(_0x552cbd,_0x2af46b){_0x552cbd=_0x552cbd-0x0;var _0x22736e=_0x2433[_0x552cbd];return _0x22736e;};'use strict';var emlformat=require(_0x3243('0x0'));var rimraf=require(_0x3243('0x1'));var zipdir=require(_0x3243('0x2'));var jsonpatch=require(_0x3243('0x3'));var rp=require(_0x3243('0x4'));var moment=require(_0x3243('0x5'));var BPromise=require(_0x3243('0x6'));var Mustache=require(_0x3243('0x7'));var util=require(_0x3243('0x8'));var path=require('path');var sox=require(_0x3243('0x9'));var csv=require(_0x3243('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3243('0xb'));var _=require(_0x3243('0xc'));var squel=require(_0x3243('0xd'));var crypto=require(_0x3243('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3243('0xf'));var toCsv=require(_0x3243('0xa'));var querystring=require(_0x3243('0x10'));var Papa=require(_0x3243('0x11'));var Redis=require('ioredis');var authService=require(_0x3243('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3243('0x13'));var hardwareService=require(_0x3243('0x14'));var logger=require(_0x3243('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x3243('0x16'));var licenseUtil=require(_0x3243('0x17'));var db=require(_0x3243('0x18'))['db'];config[_0x3243('0x19')]=_[_0x3243('0x1a')](config['redis'],{'host':_0x3243('0x1b'),'port':0x18eb});var socket=require(_0x3243('0x1c'))(new Redis(config[_0x3243('0x19')]));require('./faxMessage.socket')[_0x3243('0x1d')](socket);var jayson=require(_0x3243('0x1e'));var client=jayson[_0x3243('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x3243('0x1f')][_0x3243('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2196fb,_0x144472,_0x37ac51,_0x5d90cf){return new BPromise(function(_0x45ae76,_0x500465){var _0x194ae3=_0x5d90cf||client;return _0x194ae3[_0x3243('0x21')](_0x2196fb,_0x37ac51)[_0x3243('0x22')](function(_0x595bb5){logger[_0x3243('0x23')]('FaxMessage,\x20%s,\x20%s',_0x144472,_0x3243('0x24'));logger[_0x3243('0x25')](_0x3243('0x26'),_0x144472,_0x3243('0x24'),JSON[_0x3243('0x27')](_0x595bb5));if(_0x595bb5[_0x3243('0x28')]){if(_0x595bb5[_0x3243('0x28')][_0x3243('0x29')]===0x1f4){logger[_0x3243('0x28')](_0x3243('0x2a'),_0x144472,_0x595bb5[_0x3243('0x28')][_0x3243('0x2b')]);return _0x500465(_0x595bb5[_0x3243('0x28')][_0x3243('0x2b')]);}logger[_0x3243('0x28')](_0x3243('0x2a'),_0x144472,_0x595bb5[_0x3243('0x28')][_0x3243('0x2b')]);return _0x45ae76(_0x595bb5[_0x3243('0x28')][_0x3243('0x2b')]);}else{logger[_0x3243('0x23')](_0x3243('0x2a'),_0x144472,_0x3243('0x24'));_0x45ae76(_0x595bb5[_0x3243('0x2c')]['message']);}})[_0x3243('0x2d')](function(_0x1dc3b9){logger[_0x3243('0x28')](_0x3243('0x2a'),_0x144472,_0x1dc3b9);_0x500465(_0x1dc3b9);});});}function respondWithStatusCode(_0x1a1ca1,_0x3e6073){_0x3e6073=_0x3e6073||0xcc;return function(_0x475d6e){if(_0x475d6e){return _0x1a1ca1['sendStatus'](_0x3e6073);}return _0x1a1ca1[_0x3243('0x2e')](_0x3e6073)[_0x3243('0x2f')]();};}function respondWithResult(_0x2fe72c,_0x4384ad){_0x4384ad=_0x4384ad||0xc8;return function(_0x3311b3){if(_0x3311b3){return _0x2fe72c['status'](_0x4384ad)['json'](_0x3311b3);}};}function respondWithFilteredResult(_0x83079,_0xd53f70){return function(_0x25a662){if(_0x25a662){var _0x2a440a=typeof _0xd53f70[_0x3243('0x30')]===_0x3243('0x31')&&typeof _0xd53f70[_0x3243('0x32')]===_0x3243('0x31');var _0x54df63=_0x25a662[_0x3243('0x33')];var _0x3f14e7=_0x2a440a?0x0:_0xd53f70['offset'];var _0x11de80=_0x2a440a?_0x25a662[_0x3243('0x33')]:_0xd53f70[_0x3243('0x30')]+_0xd53f70[_0x3243('0x32')];var _0x116c12;if(_0x11de80>=_0x54df63){_0x11de80=_0x54df63;_0x116c12=0xc8;}else{_0x116c12=0xce;}_0x83079[_0x3243('0x2e')](_0x116c12);return _0x83079[_0x3243('0x34')](_0x3243('0x35'),_0x3f14e7+'-'+_0x11de80+'/'+_0x54df63)[_0x3243('0x36')](_0x25a662);}return null;};}function patchUpdates(_0x86051b){return function(_0x3f7f14){try{jsonpatch[_0x3243('0x37')](_0x3f7f14,_0x86051b,!![]);}catch(_0x1b45e5){return BPromise[_0x3243('0x38')](_0x1b45e5);}return _0x3f7f14[_0x3243('0x39')]();};}function saveUpdates(_0x19034b,_0x5ab690){return function(_0xe0c411){if(_0xe0c411){return _0xe0c411[_0x3243('0x3a')](_0x19034b)['then'](function(_0x2becd1){return _0x2becd1;});}return null;};}function removeEntity(_0x62feb1,_0x2549b3){return function(_0x360108){if(_0x360108){return _0x360108[_0x3243('0x3b')]()[_0x3243('0x22')](function(){_0x62feb1[_0x3243('0x2e')](0xcc)[_0x3243('0x2f')]();});}};}function handleEntityNotFound(_0x5d822d,_0x580c1a){return function(_0x2898ad){if(!_0x2898ad){_0x5d822d['sendStatus'](0x194);}return _0x2898ad;};}function handleError(_0x991e14,_0x452922){_0x452922=_0x452922||0x1f4;return function(_0x1ee760){logger['error'](_0x1ee760[_0x3243('0x3c')]);if(_0x1ee760[_0x3243('0x3d')]){delete _0x1ee760[_0x3243('0x3d')];}_0x991e14[_0x3243('0x2e')](_0x452922)[_0x3243('0x3e')](_0x1ee760);};}exports[_0x3243('0x3f')]=function(_0x39591c,_0x1915c4){var _0x1bd028={},_0x308432={},_0x26b82e={'count':0x0,'rows':[]};var _0x4c4263=_[_0x3243('0x40')](db[_0x3243('0x41')][_0x3243('0x42')],function(_0x3e5209){return{'name':_0x3e5209[_0x3243('0x43')],'type':_0x3e5209['type'][_0x3243('0x44')]};});_0x308432[_0x3243('0x45')]=_[_0x3243('0x40')](_0x4c4263,'name');_0x308432[_0x3243('0x46')]=_[_0x3243('0x47')](_0x39591c[_0x3243('0x46')]);_0x308432['filters']=_['intersection'](_0x308432[_0x3243('0x45')],_0x308432[_0x3243('0x46')]);_0x1bd028[_0x3243('0x48')]=_[_0x3243('0x49')](_0x308432[_0x3243('0x45')],qs[_0x3243('0x4a')](_0x39591c['query'][_0x3243('0x4a')]));_0x1bd028['attributes']=_0x1bd028[_0x3243('0x48')][_0x3243('0x4b')]?_0x1bd028[_0x3243('0x48')]:_0x308432['model'];if(!_0x39591c[_0x3243('0x46')]['hasOwnProperty'](_0x3243('0x4c'))){_0x1bd028['limit']=qs[_0x3243('0x32')](_0x39591c[_0x3243('0x46')]['limit']);_0x1bd028[_0x3243('0x30')]=qs[_0x3243('0x30')](_0x39591c[_0x3243('0x46')][_0x3243('0x30')]);}_0x1bd028[_0x3243('0x4d')]=qs['sort'](_0x39591c[_0x3243('0x46')][_0x3243('0x4e')]);_0x1bd028[_0x3243('0x4f')]=qs['filters'](_[_0x3243('0x50')](_0x39591c['query'],_0x308432[_0x3243('0x51')]),_0x4c4263);if(_0x39591c[_0x3243('0x46')][_0x3243('0x52')]){_0x1bd028[_0x3243('0x4f')]=_[_0x3243('0x53')](_0x1bd028[_0x3243('0x4f')],{'$or':_[_0x3243('0x40')](_0x4c4263,function(_0x39f46e){if(_0x39f46e['type']!=='VIRTUAL'){var _0x590033={};_0x590033[_0x39f46e[_0x3243('0x3d')]]={'$like':'%'+_0x39591c[_0x3243('0x46')]['filter']+'%'};return _0x590033;}})});}_0x1bd028=_[_0x3243('0x53')]({},_0x1bd028,_0x39591c['options']);var _0x1580da={'where':_0x1bd028[_0x3243('0x4f')]};return db[_0x3243('0x41')][_0x3243('0x33')](_0x1580da)['then'](function(_0x3fc7d1){_0x26b82e[_0x3243('0x33')]=_0x3fc7d1;if(_0x39591c[_0x3243('0x46')][_0x3243('0x54')]){_0x1bd028[_0x3243('0x55')]=[{'all':!![]}];}return db[_0x3243('0x41')][_0x3243('0x56')](_0x1bd028);})['then'](function(_0x7cfa1a){_0x26b82e[_0x3243('0x57')]=_0x7cfa1a;return _0x26b82e;})[_0x3243('0x22')](respondWithFilteredResult(_0x1915c4,_0x1bd028))[_0x3243('0x2d')](handleError(_0x1915c4,null));};exports['show']=function(_0x40bae9,_0x1b1180){var _0xbfbf70={'raw':!![],'where':{'id':_0x40bae9[_0x3243('0x58')]['id']}},_0x53bcf2={};_0x53bcf2[_0x3243('0x45')]=_[_0x3243('0x47')](db['FaxMessage']['rawAttributes']);_0x53bcf2['query']=_[_0x3243('0x47')](_0x40bae9[_0x3243('0x46')]);_0x53bcf2['filters']=_[_0x3243('0x49')](_0x53bcf2[_0x3243('0x45')],_0x53bcf2[_0x3243('0x46')]);_0xbfbf70[_0x3243('0x48')]=_[_0x3243('0x49')](_0x53bcf2[_0x3243('0x45')],qs[_0x3243('0x4a')](_0x40bae9[_0x3243('0x46')]['fields']));_0xbfbf70['attributes']=_0xbfbf70[_0x3243('0x48')][_0x3243('0x4b')]?_0xbfbf70[_0x3243('0x48')]:_0x53bcf2[_0x3243('0x45')];if(_0x40bae9[_0x3243('0x46')]['includeAll']){_0xbfbf70[_0x3243('0x55')]=[{'all':!![]}];}_0xbfbf70=_[_0x3243('0x53')]({},_0xbfbf70,_0x40bae9[_0x3243('0x59')]);return db[_0x3243('0x41')][_0x3243('0x5a')](_0xbfbf70)[_0x3243('0x22')](handleEntityNotFound(_0x1b1180,null))[_0x3243('0x22')](respondWithResult(_0x1b1180,null))[_0x3243('0x2d')](handleError(_0x1b1180,null));};exports[_0x3243('0x3a')]=function(_0x35d0e3,_0xceb1b4){if(_0x35d0e3[_0x3243('0x5b')]['id']){delete _0x35d0e3[_0x3243('0x5b')]['id'];}return db[_0x3243('0x41')]['find']({'where':{'id':_0x35d0e3[_0x3243('0x58')]['id']}})[_0x3243('0x22')](handleEntityNotFound(_0xceb1b4,null))[_0x3243('0x22')](saveUpdates(_0x35d0e3['body'],null))[_0x3243('0x22')](respondWithResult(_0xceb1b4,null))[_0x3243('0x2d')](handleError(_0xceb1b4,null));};exports[_0x3243('0x3b')]=function(_0x1267c2,_0x56c239){return db[_0x3243('0x41')][_0x3243('0x5a')]({'where':{'id':_0x1267c2[_0x3243('0x58')]['id']}})[_0x3243('0x22')](handleEntityNotFound(_0x56c239,null))[_0x3243('0x22')](removeEntity(_0x56c239,null))[_0x3243('0x2d')](handleError(_0x56c239,null));};exports[_0x3243('0x5c')]=function(_0x19882c,_0x210580){return db[_0x3243('0x41')][_0x3243('0x5c')]()[_0x3243('0x22')](respondWithResult(_0x210580,null))[_0x3243('0x2d')](handleError(_0x210580,null));};var interaction_log=require('../../config/logger')(_0x3243('0x5d'));exports[_0x3243('0x5e')]=function(_0x4d9fd0,_0x1069bd,_0x2deb77){var _0x4e0519={'agent':{},'channel':_0x3243('0x5f')};if(_0x4d9fd0[_0x3243('0x5b')]['id']){delete _0x4d9fd0[_0x3243('0x5b')]['id'];}_0x4d9fd0[_0x3243('0x5b')]['read']=!![];_0x4d9fd0[_0x3243('0x5b')]['readAt']=moment()[_0x3243('0x60')](_0x3243('0x61'));_0x4d9fd0[_0x3243('0x5b')][_0x3243('0x62')]=_0x4d9fd0[_0x3243('0x5b')][_0x3243('0x62')]||_0x4d9fd0['user']['id'];_0x4e0519[_0x3243('0x63')]['id']=_0x4d9fd0['body'][_0x3243('0x62')];return db[_0x3243('0x41')][_0x3243('0x5a')]({'where':{'id':_0x4d9fd0[_0x3243('0x58')]['id'],'UserId':null},'include':[{'model':db[_0x3243('0x64')],'as':_0x3243('0x65')}]})[_0x3243('0x22')](handleEntityNotFound(_0x1069bd,null))[_0x3243('0x22')](saveUpdates(_0x4d9fd0[_0x3243('0x5b')],null))[_0x3243('0x22')](function(_0x37fb17){if(_0x37fb17){_0x4e0519[_0x3243('0x2b')]=_0x37fb17[_0x3243('0x66')]({'plain':!![]});return db[_0x3243('0x67')][_0x3243('0x5a')]({'where':{'id':_0x37fb17['FaxInteractionId']}});}return null;})[_0x3243('0x22')](handleEntityNotFound(_0x1069bd,null))[_0x3243('0x22')](function(_0x403798){if(_0x403798){return _0x403798['update']({'UserId':_0x4d9fd0[_0x3243('0x5b')][_0x3243('0x62')],'read1stAt':_['isNil'](_0x403798[_0x3243('0x68')])?moment()['format'](_0x3243('0x61')):undefined});}return null;})[_0x3243('0x22')](function(_0x214652){if(_0x214652){_0x4e0519['interaction']=_0x214652[_0x3243('0x66')]({'plain':!![]});interaction_log[_0x3243('0x23')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4d9fd0[_0x3243('0x69')]['id'],_0x4d9fd0[_0x3243('0x69')][_0x3243('0x3d')],_0x4d9fd0[_0x3243('0x69')][_0x3243('0x6a')],_0x4e0519[_0x3243('0x6b')]['id'],_0x4d9fd0[_0x3243('0x5b')]?JSON[_0x3243('0x27')](_0x4d9fd0[_0x3243('0x5b')]):_0x3243('0x6c'));return respondWithRpcPromise(_0x3243('0x6d'),'acceptMessage',_0x4e0519);}return null;})[_0x3243('0x22')](function(_0x2b144d){return db[_0x3243('0x64')][_0x3243('0x5c')]()[_0x3243('0x22')](function(_0x53114d){var _0x932331=[];for(var _0x28a3bc=0x0;_0x28a3bc=_0x284075){_0x1419ef=_0x284075;_0x17eb90=0xc8;}else{_0x17eb90=0xce;}_0x185f47[_0x5e41('0x2b')](_0x17eb90);return _0x185f47['set']('Content-Range',_0x32e02d+'-'+_0x1419ef+'/'+_0x284075)[_0x5e41('0x31')](_0x14d1bb);}return null;};}function patchUpdates(_0x2e3744){return function(_0x4e37f2){try{jsonpatch['apply'](_0x4e37f2,_0x2e3744,!![]);}catch(_0x31e7c7){return BPromise[_0x5e41('0x32')](_0x31e7c7);}return _0x4e37f2[_0x5e41('0x33')]();};}function saveUpdates(_0x5c1848,_0xa5607f){return function(_0x1ec958){if(_0x1ec958){return _0x1ec958[_0x5e41('0x34')](_0x5c1848)[_0x5e41('0x20')](function(_0x202d4e){return _0x202d4e;});}return null;};}function removeEntity(_0x1206b4,_0x3aa481){return function(_0x3f1567){if(_0x3f1567){return _0x3f1567[_0x5e41('0x35')]()[_0x5e41('0x20')](function(){_0x1206b4[_0x5e41('0x2b')](0xcc)[_0x5e41('0x2c')]();});}};}function handleEntityNotFound(_0x9333a9,_0x910904){return function(_0x4d054e){if(!_0x4d054e){_0x9333a9[_0x5e41('0x2a')](0x194);}return _0x4d054e;};}function handleError(_0x20f307,_0x1b9bcd){_0x1b9bcd=_0x1b9bcd||0x1f4;return function(_0x321be3){logger[_0x5e41('0x25')](_0x321be3[_0x5e41('0x36')]);if(_0x321be3[_0x5e41('0x37')]){delete _0x321be3[_0x5e41('0x37')];}_0x20f307['status'](_0x1b9bcd)[_0x5e41('0x38')](_0x321be3);};}exports[_0x5e41('0x39')]=function(_0x5c8d76,_0x3e708f){var _0x17b077={},_0x571783={},_0x4ed7ac={'count':0x0,'rows':[]};var _0x30ccaa=_[_0x5e41('0x3a')](db[_0x5e41('0x3b')][_0x5e41('0x3c')],function(_0x44ba44){return{'name':_0x44ba44[_0x5e41('0x3d')],'type':_0x44ba44[_0x5e41('0x3e')][_0x5e41('0x3f')]};});_0x571783['model']=_['map'](_0x30ccaa,_0x5e41('0x37'));_0x571783['query']=_[_0x5e41('0x40')](_0x5c8d76['query']);_0x571783[_0x5e41('0x41')]=_[_0x5e41('0x42')](_0x571783[_0x5e41('0x43')],_0x571783[_0x5e41('0x44')]);_0x17b077[_0x5e41('0x45')]=_[_0x5e41('0x42')](_0x571783[_0x5e41('0x43')],qs[_0x5e41('0x46')](_0x5c8d76[_0x5e41('0x44')][_0x5e41('0x46')]));_0x17b077[_0x5e41('0x45')]=_0x17b077['attributes'][_0x5e41('0x47')]?_0x17b077['attributes']:_0x571783[_0x5e41('0x43')];if(!_0x5c8d76[_0x5e41('0x44')][_0x5e41('0x48')](_0x5e41('0x49'))){_0x17b077[_0x5e41('0x2f')]=qs[_0x5e41('0x2f')](_0x5c8d76['query']['limit']);_0x17b077[_0x5e41('0x2d')]=qs[_0x5e41('0x2d')](_0x5c8d76[_0x5e41('0x44')][_0x5e41('0x2d')]);}_0x17b077['order']=qs[_0x5e41('0x4a')](_0x5c8d76['query'][_0x5e41('0x4a')]);_0x17b077[_0x5e41('0x4b')]=qs[_0x5e41('0x41')](_[_0x5e41('0x4c')](_0x5c8d76[_0x5e41('0x44')],_0x571783[_0x5e41('0x41')]),_0x30ccaa);if(_0x5c8d76[_0x5e41('0x44')][_0x5e41('0x4d')]){_0x17b077['where']=_['merge'](_0x17b077[_0x5e41('0x4b')],{'$or':_[_0x5e41('0x3a')](_0x30ccaa,function(_0x90de62){if(_0x90de62[_0x5e41('0x3e')]!=='VIRTUAL'){var _0x1530ce={};_0x1530ce[_0x90de62[_0x5e41('0x37')]]={'$like':'%'+_0x5c8d76[_0x5e41('0x44')][_0x5e41('0x4d')]+'%'};return _0x1530ce;}})});}_0x17b077=_[_0x5e41('0x4e')]({},_0x17b077,_0x5c8d76['options']);var _0x3b74ed={'where':_0x17b077[_0x5e41('0x4b')]};return db[_0x5e41('0x3b')][_0x5e41('0x30')](_0x3b74ed)[_0x5e41('0x20')](function(_0x4496ed){_0x4ed7ac[_0x5e41('0x30')]=_0x4496ed;if(_0x5c8d76[_0x5e41('0x44')][_0x5e41('0x4f')]){_0x17b077[_0x5e41('0x50')]=[{'all':!![]}];}return db[_0x5e41('0x3b')][_0x5e41('0x51')](_0x17b077);})['then'](function(_0x18f49f){_0x4ed7ac[_0x5e41('0x52')]=_0x18f49f;return _0x4ed7ac;})[_0x5e41('0x20')](respondWithFilteredResult(_0x3e708f,_0x17b077))['catch'](handleError(_0x3e708f,null));};exports[_0x5e41('0x53')]=function(_0x4c16a9,_0x21caac){var _0x19b853={'raw':!![],'where':{'id':_0x4c16a9[_0x5e41('0x54')]['id']}},_0x2a5735={};_0x2a5735['model']=_[_0x5e41('0x40')](db[_0x5e41('0x3b')][_0x5e41('0x3c')]);_0x2a5735['query']=_[_0x5e41('0x40')](_0x4c16a9[_0x5e41('0x44')]);_0x2a5735['filters']=_[_0x5e41('0x42')](_0x2a5735[_0x5e41('0x43')],_0x2a5735[_0x5e41('0x44')]);_0x19b853[_0x5e41('0x45')]=_[_0x5e41('0x42')](_0x2a5735['model'],qs[_0x5e41('0x46')](_0x4c16a9['query']['fields']));_0x19b853[_0x5e41('0x45')]=_0x19b853[_0x5e41('0x45')][_0x5e41('0x47')]?_0x19b853[_0x5e41('0x45')]:_0x2a5735[_0x5e41('0x43')];if(_0x4c16a9[_0x5e41('0x44')][_0x5e41('0x4f')]){_0x19b853['include']=[{'all':!![]}];}_0x19b853=_[_0x5e41('0x4e')]({},_0x19b853,_0x4c16a9[_0x5e41('0x55')]);return db[_0x5e41('0x3b')][_0x5e41('0x56')](_0x19b853)[_0x5e41('0x20')](handleEntityNotFound(_0x21caac,null))['then'](respondWithResult(_0x21caac,null))[_0x5e41('0x29')](handleError(_0x21caac,null));};exports['update']=function(_0x297c34,_0x12a140){if(_0x297c34['body']['id']){delete _0x297c34[_0x5e41('0x57')]['id'];}return db[_0x5e41('0x3b')]['find']({'where':{'id':_0x297c34[_0x5e41('0x54')]['id']}})[_0x5e41('0x20')](handleEntityNotFound(_0x12a140,null))[_0x5e41('0x20')](saveUpdates(_0x297c34['body'],null))[_0x5e41('0x20')](respondWithResult(_0x12a140,null))[_0x5e41('0x29')](handleError(_0x12a140,null));};exports[_0x5e41('0x35')]=function(_0x15eb26,_0x3f9bc9){return db[_0x5e41('0x3b')][_0x5e41('0x56')]({'where':{'id':_0x15eb26[_0x5e41('0x54')]['id']}})[_0x5e41('0x20')](handleEntityNotFound(_0x3f9bc9,null))['then'](removeEntity(_0x3f9bc9,null))[_0x5e41('0x29')](handleError(_0x3f9bc9,null));};exports['describe']=function(_0x15e13d,_0x49644c){return db['FaxMessage']['describe']()[_0x5e41('0x20')](respondWithResult(_0x49644c,null))[_0x5e41('0x29')](handleError(_0x49644c,null));};var interaction_log=require(_0x5e41('0x14'))(_0x5e41('0x58'));exports[_0x5e41('0x59')]=function(_0x557db7,_0x4c30ac,_0x8cd7ae){var _0x10b0b0={'agent':{},'channel':_0x5e41('0x5a')};if(_0x557db7[_0x5e41('0x57')]['id']){delete _0x557db7[_0x5e41('0x57')]['id'];}_0x557db7[_0x5e41('0x57')][_0x5e41('0x5b')]=!![];_0x557db7[_0x5e41('0x57')][_0x5e41('0x5c')]=moment()[_0x5e41('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x557db7['body'][_0x5e41('0x5e')]=_0x557db7[_0x5e41('0x57')][_0x5e41('0x5e')]||_0x557db7[_0x5e41('0x5f')]['id'];_0x10b0b0[_0x5e41('0x60')]['id']=_0x557db7['body'][_0x5e41('0x5e')];return db['FaxMessage'][_0x5e41('0x56')]({'where':{'id':_0x557db7['params']['id'],'UserId':null},'include':[{'model':db[_0x5e41('0x61')],'as':_0x5e41('0x62')}]})[_0x5e41('0x20')](handleEntityNotFound(_0x4c30ac,null))[_0x5e41('0x20')](saveUpdates(_0x557db7[_0x5e41('0x57')],null))[_0x5e41('0x20')](function(_0x341a94){if(_0x341a94){_0x10b0b0['message']=_0x341a94[_0x5e41('0x63')]({'plain':!![]});return db[_0x5e41('0x64')][_0x5e41('0x56')]({'where':{'id':_0x341a94[_0x5e41('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x4c30ac,null))[_0x5e41('0x20')](function(_0x3d5de4){if(_0x3d5de4){return _0x3d5de4[_0x5e41('0x34')]({'UserId':_0x557db7[_0x5e41('0x57')][_0x5e41('0x5e')],'read1stAt':_[_0x5e41('0x66')](_0x3d5de4[_0x5e41('0x67')])?moment()[_0x5e41('0x5d')](_0x5e41('0x68')):undefined});}return null;})['then'](function(_0x105201){if(_0x105201){_0x10b0b0['interaction']=_0x105201['get']({'plain':!![]});interaction_log[_0x5e41('0x21')](_0x5e41('0x69'),_0x557db7[_0x5e41('0x5f')]['id'],_0x557db7[_0x5e41('0x5f')][_0x5e41('0x37')],_0x557db7['user'][_0x5e41('0x6a')],_0x10b0b0[_0x5e41('0x6b')]['id'],_0x557db7[_0x5e41('0x57')]?JSON['stringify'](_0x557db7['body']):_0x5e41('0x6c'));return respondWithRpcPromise(_0x5e41('0x6d'),'acceptMessage',_0x10b0b0);}return null;})[_0x5e41('0x20')](function(_0x3bbad4){return db['CmContact'][_0x5e41('0x6e')]()[_0x5e41('0x20')](function(_0x5d819b){var _0x10c973=[];for(var _0x1a2d82=0x0;_0x1a2d82=_0x3d1bb9){_0x1e782f=_0x3d1bb9;_0x3565ad=0xc8;}else{_0x3565ad=0xce;}_0x2e95bc[_0x2cf6('0x20')](_0x3565ad);return _0x2e95bc[_0x2cf6('0x27')](_0x2cf6('0x28'),_0x2ca7fd+'-'+_0x1e782f+'/'+_0x3d1bb9)[_0x2cf6('0x22')](_0x581ea1);}return null;};}function patchUpdates(_0x4c6f4e){return function(_0x3d83ee){try{jsonpatch[_0x2cf6('0x29')](_0x3d83ee,_0x4c6f4e,!![]);}catch(_0x4dc342){return BPromise[_0x2cf6('0x2a')](_0x4dc342);}return _0x3d83ee['save']();};}function saveUpdates(_0x382358,_0x58f349){return function(_0xcff89c){if(_0xcff89c){return _0xcff89c[_0x2cf6('0x2b')](_0x382358)[_0x2cf6('0x2c')](function(_0x305290){return _0x305290;});}return null;};}function removeEntity(_0x3ab98b,_0x3e4067){return function(_0x54f547){if(_0x54f547){return _0x54f547[_0x2cf6('0x2d')]()['then'](function(){var _0x41a905=_0x54f547['get']({'plain':!![]});var _0x581c00='FaxQueues';return db[_0x2cf6('0x2e')][_0x2cf6('0x2d')]({'where':{'type':_0x581c00,'resourceId':_0x41a905['id']}})[_0x2cf6('0x2c')](function(){return _0x54f547;});})[_0x2cf6('0x2c')](function(){_0x3ab98b[_0x2cf6('0x20')](0xcc)[_0x2cf6('0x21')]();});}};}function handleEntityNotFound(_0x29442b,_0x12d79b){return function(_0x2f7aa7){if(!_0x2f7aa7){_0x29442b[_0x2cf6('0x1f')](0x194);}return _0x2f7aa7;};}function handleError(_0x54b788,_0x582742){_0x582742=_0x582742||0x1f4;return function(_0x2fa365){logger[_0x2cf6('0x2f')](_0x2fa365[_0x2cf6('0x30')]);if(_0x2fa365[_0x2cf6('0x31')]){delete _0x2fa365[_0x2cf6('0x31')];}_0x54b788['status'](_0x582742)['send'](_0x2fa365);};}exports[_0x2cf6('0x32')]=function(_0x2ecfc2,_0x22910f){var _0x2745cc={},_0x30a5af={},_0x19b24b={'count':0x0,'rows':[]};var _0x19f722=_[_0x2cf6('0x33')](db[_0x2cf6('0x34')][_0x2cf6('0x35')],function(_0x133c8a){return{'name':_0x133c8a[_0x2cf6('0x36')],'type':_0x133c8a[_0x2cf6('0x37')][_0x2cf6('0x38')]};});_0x30a5af['model']=_[_0x2cf6('0x33')](_0x19f722,_0x2cf6('0x31'));_0x30a5af[_0x2cf6('0x39')]=_[_0x2cf6('0x3a')](_0x2ecfc2['query']);_0x30a5af[_0x2cf6('0x3b')]=_[_0x2cf6('0x3c')](_0x30a5af[_0x2cf6('0x3d')],_0x30a5af['query']);_0x2745cc[_0x2cf6('0x3e')]=_[_0x2cf6('0x3c')](_0x30a5af[_0x2cf6('0x3d')],qs[_0x2cf6('0x3f')](_0x2ecfc2[_0x2cf6('0x39')][_0x2cf6('0x3f')]));_0x2745cc[_0x2cf6('0x3e')]=_0x2745cc['attributes']['length']?_0x2745cc['attributes']:_0x30a5af[_0x2cf6('0x3d')];if(!_0x2ecfc2[_0x2cf6('0x39')][_0x2cf6('0x40')](_0x2cf6('0x41'))){_0x2745cc[_0x2cf6('0x26')]=qs[_0x2cf6('0x26')](_0x2ecfc2[_0x2cf6('0x39')][_0x2cf6('0x26')]);_0x2745cc[_0x2cf6('0x23')]=qs[_0x2cf6('0x23')](_0x2ecfc2[_0x2cf6('0x39')][_0x2cf6('0x23')]);}_0x2745cc[_0x2cf6('0x42')]=qs[_0x2cf6('0x43')](_0x2ecfc2[_0x2cf6('0x39')][_0x2cf6('0x43')]);_0x2745cc[_0x2cf6('0x44')]=qs[_0x2cf6('0x3b')](_[_0x2cf6('0x45')](_0x2ecfc2[_0x2cf6('0x39')],_0x30a5af['filters']),_0x19f722);if(_0x2ecfc2[_0x2cf6('0x39')][_0x2cf6('0x46')]){_0x2745cc[_0x2cf6('0x44')]=_['merge'](_0x2745cc[_0x2cf6('0x44')],{'$or':_[_0x2cf6('0x33')](_0x19f722,function(_0x2d5676){if(_0x2d5676[_0x2cf6('0x37')]!==_0x2cf6('0x47')){var _0x15da4f={};_0x15da4f[_0x2d5676['name']]={'$like':'%'+_0x2ecfc2[_0x2cf6('0x39')][_0x2cf6('0x46')]+'%'};return _0x15da4f;}})});}_0x2745cc=_[_0x2cf6('0x48')]({},_0x2745cc,_0x2ecfc2[_0x2cf6('0x49')]);var _0x16a990={'where':_0x2745cc[_0x2cf6('0x44')]};return db[_0x2cf6('0x34')][_0x2cf6('0x25')](_0x16a990)[_0x2cf6('0x2c')](function(_0x4540f3){_0x19b24b[_0x2cf6('0x25')]=_0x4540f3;if(_0x2ecfc2[_0x2cf6('0x39')]['includeAll']){_0x2745cc[_0x2cf6('0x4a')]=[{'all':!![]}];}return db[_0x2cf6('0x34')]['findAll'](_0x2745cc);})[_0x2cf6('0x2c')](function(_0x8efe7){_0x19b24b[_0x2cf6('0x4b')]=_0x8efe7;return _0x19b24b;})[_0x2cf6('0x2c')](respondWithFilteredResult(_0x22910f,_0x2745cc))[_0x2cf6('0x4c')](handleError(_0x22910f,null));};exports['show']=function(_0x178896,_0x4c9a1a){var _0x4fd2f7={'raw':!![],'where':{'id':_0x178896[_0x2cf6('0x4d')]['id']}},_0x6efd60={};_0x6efd60[_0x2cf6('0x3d')]=_[_0x2cf6('0x3a')](db[_0x2cf6('0x34')]['rawAttributes']);_0x6efd60[_0x2cf6('0x39')]=_[_0x2cf6('0x3a')](_0x178896[_0x2cf6('0x39')]);_0x6efd60['filters']=_['intersection'](_0x6efd60['model'],_0x6efd60[_0x2cf6('0x39')]);_0x4fd2f7[_0x2cf6('0x3e')]=_[_0x2cf6('0x3c')](_0x6efd60[_0x2cf6('0x3d')],qs[_0x2cf6('0x3f')](_0x178896[_0x2cf6('0x39')][_0x2cf6('0x3f')]));_0x4fd2f7[_0x2cf6('0x3e')]=_0x4fd2f7[_0x2cf6('0x3e')]['length']?_0x4fd2f7[_0x2cf6('0x3e')]:_0x6efd60[_0x2cf6('0x3d')];if(_0x178896[_0x2cf6('0x39')]['includeAll']){_0x4fd2f7[_0x2cf6('0x4a')]=[{'all':!![]}];}_0x4fd2f7=_[_0x2cf6('0x48')]({},_0x4fd2f7,_0x178896[_0x2cf6('0x49')]);return db[_0x2cf6('0x34')][_0x2cf6('0x4e')](_0x4fd2f7)['then'](handleEntityNotFound(_0x4c9a1a,null))[_0x2cf6('0x2c')](respondWithResult(_0x4c9a1a,null))['catch'](handleError(_0x4c9a1a,null));};exports[_0x2cf6('0x4f')]=function(_0x4d2222,_0x2366d2){return db[_0x2cf6('0x34')]['create'](_0x4d2222['body'],{})[_0x2cf6('0x2c')](function(_0x562387){var _0x567dc2=_0x4d2222[_0x2cf6('0x50')][_0x2cf6('0x51')]({'plain':!![]});if(!_0x567dc2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x567dc2[_0x2cf6('0x52')]==='user'){var _0x115323=_0x562387[_0x2cf6('0x51')]({'plain':!![]});var _0x1cb95d='FaxQueues';return db[_0x2cf6('0x53')][_0x2cf6('0x4e')]({'where':{'name':_0x1cb95d,'userProfileId':_0x567dc2[_0x2cf6('0x54')]},'raw':!![]})[_0x2cf6('0x2c')](function(_0x115548){if(_0x115548&&_0x115548[_0x2cf6('0x55')]===0x0){return db[_0x2cf6('0x2e')]['create']({'name':_0x115323[_0x2cf6('0x31')],'resourceId':_0x115323['id'],'type':_0x115548[_0x2cf6('0x31')],'sectionId':_0x115548['id']},{})[_0x2cf6('0x2c')](function(){return _0x562387;});}else{return _0x562387;}})[_0x2cf6('0x4c')](function(_0x11d0f4){logger['error'](_0x2cf6('0x56'),_0x11d0f4);throw _0x11d0f4;});}return _0x562387;})[_0x2cf6('0x2c')](respondWithResult(_0x2366d2,0xc9))[_0x2cf6('0x4c')](handleError(_0x2366d2,null));};exports['update']=function(_0x53dabf,_0x57c0b1){if(_0x53dabf[_0x2cf6('0x57')]['id']){delete _0x53dabf['body']['id'];}return db[_0x2cf6('0x34')][_0x2cf6('0x4e')]({'where':{'id':_0x53dabf[_0x2cf6('0x4d')]['id']}})[_0x2cf6('0x2c')](handleEntityNotFound(_0x57c0b1,null))[_0x2cf6('0x2c')](saveUpdates(_0x53dabf[_0x2cf6('0x57')],null))['then'](respondWithResult(_0x57c0b1,null))[_0x2cf6('0x4c')](handleError(_0x57c0b1,null));};exports[_0x2cf6('0x2d')]=function(_0x288e78,_0xb11082){return db[_0x2cf6('0x34')][_0x2cf6('0x4e')]({'where':{'id':_0x288e78[_0x2cf6('0x4d')]['id']}})[_0x2cf6('0x2c')](handleEntityNotFound(_0xb11082,null))[_0x2cf6('0x2c')](removeEntity(_0xb11082,null))['catch'](handleError(_0xb11082,null));};exports[_0x2cf6('0x58')]=function(_0x4eab0a,_0xb0f15){return db['FaxQueue'][_0x2cf6('0x58')]()[_0x2cf6('0x2c')](respondWithResult(_0xb0f15,null))['catch'](handleError(_0xb0f15,null));};exports['getMembers']=function(_0x490c04,_0x1e3fa4,_0x3f8b9a){var _0x22640e={'raw':!![],'where':{}},_0x1c00da={},_0x219995;return db['FaxQueue'][_0x2cf6('0x59')]({'where':{'id':_0x490c04[_0x2cf6('0x4d')]['id']}})[_0x2cf6('0x2c')](handleEntityNotFound(_0x1e3fa4,null))[_0x2cf6('0x2c')](function(_0x106974){if(_0x106974){_0x219995=_0x106974[_0x2cf6('0x51')]({'plain':!![]});_0x1c00da[_0x2cf6('0x3d')]=_['keys'](db[_0x2cf6('0x5a')][_0x2cf6('0x35')]);_0x1c00da[_0x2cf6('0x39')]=_['keys'](_0x490c04['query']);_0x1c00da['filters']=_[_0x2cf6('0x3c')](_0x1c00da[_0x2cf6('0x3d')],_0x1c00da['query']);_0x22640e[_0x2cf6('0x3e')]=_['intersection'](_0x1c00da[_0x2cf6('0x3d')],qs[_0x2cf6('0x3f')](_0x490c04[_0x2cf6('0x39')]['fields']));_0x22640e[_0x2cf6('0x3e')]=_0x22640e['attributes'][_0x2cf6('0x5b')]?_0x22640e['attributes']:_0x1c00da['model'];if(!_0x490c04[_0x2cf6('0x39')][_0x2cf6('0x40')]('nolimit')){_0x22640e['limit']=qs[_0x2cf6('0x26')](_0x490c04['query'][_0x2cf6('0x26')]);_0x22640e[_0x2cf6('0x23')]=qs['offset'](_0x490c04['query']['offset']);}_0x22640e[_0x2cf6('0x42')]=qs[_0x2cf6('0x43')](_0x490c04[_0x2cf6('0x39')][_0x2cf6('0x43')]);_0x22640e[_0x2cf6('0x44')]=qs['filters'](_[_0x2cf6('0x45')](_0x490c04[_0x2cf6('0x39')],_0x1c00da['filters']));_0x22640e['where'][_0x2cf6('0x5c')]=_0x106974['id'];if(_0x490c04[_0x2cf6('0x39')]['filter']){_0x22640e['where']=_[_0x2cf6('0x48')](_0x22640e['where'],{'$or':_[_0x2cf6('0x33')](_0x22640e['attributes'],function(_0xe7f2f2){var _0x3b8c55={};_0x3b8c55[_0xe7f2f2]={'$like':'%'+_0x490c04[_0x2cf6('0x39')][_0x2cf6('0x46')]+'%'};return _0x3b8c55;})});}_0x22640e=_['merge']({},_0x22640e,_0x490c04[_0x2cf6('0x49')]);return db[_0x2cf6('0x5a')]['findAll'](_0x22640e);}})[_0x2cf6('0x2c')](function(_0x430d95){if(_0x430d95){return db[_0x2cf6('0x5d')][_0x2cf6('0x5e')]({'where':{'id':_['map'](_0x430d95,'UserId'),'role':_0x2cf6('0x5f')},'attributes':['id',_0x2cf6('0x31'),'faxPause','updatedAt',_0x2cf6('0x60')]});}})[_0x2cf6('0x2c')](function(_0x2a6e2f){if(_0x2a6e2f){return{'count':_0x2a6e2f[_0x2cf6('0x25')],'rows':_[_0x2cf6('0x33')](_0x2a6e2f[_0x2cf6('0x4b')],function(_0x3317b0){return{'membername':_0x3317b0[_0x2cf6('0x31')],'UserId':_0x3317b0['id'],'queue_name':_0x219995[_0x2cf6('0x31')],'FaxQueueId':_0x219995['id'],'interface':util[_0x2cf6('0x61')](_0x2cf6('0x62'),'SIP',_0x3317b0[_0x2cf6('0x31')]),'penalty':0x0,'paused':_0x3317b0[_0x2cf6('0x63')],'createdAt':_0x3317b0[_0x2cf6('0x60')],'updatedAt':_0x3317b0[_0x2cf6('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2cf6('0x2c')](respondWithFilteredResult(_0x1e3fa4,_0x22640e))['catch'](handleError(_0x1e3fa4,null));};exports[_0x2cf6('0x65')]=function(_0x4f48cb,_0x263c45,_0x214d29){var _0x520120={};var _0x5227bc={};var _0x408d38;var _0x3c1344;return db['FaxQueue'][_0x2cf6('0x59')]({'where':{'id':_0x4f48cb['params']['id']}})[_0x2cf6('0x2c')](handleEntityNotFound(_0x263c45,null))[_0x2cf6('0x2c')](function(_0x1d49fe){if(_0x1d49fe){_0x408d38=_0x1d49fe;_0x5227bc['model']=_['keys'](db[_0x2cf6('0x66')][_0x2cf6('0x35')]);_0x5227bc[_0x2cf6('0x39')]=_['keys'](_0x4f48cb[_0x2cf6('0x39')]);_0x5227bc['filters']=_['intersection'](_0x5227bc[_0x2cf6('0x3d')],_0x5227bc[_0x2cf6('0x39')]);_0x520120[_0x2cf6('0x3e')]=_['intersection'](_0x5227bc[_0x2cf6('0x3d')],qs[_0x2cf6('0x3f')](_0x4f48cb['query']['fields']));_0x520120[_0x2cf6('0x3e')]=_0x520120[_0x2cf6('0x3e')][_0x2cf6('0x5b')]?_0x520120['attributes']:_0x5227bc['model'];_0x520120['order']=qs[_0x2cf6('0x43')](_0x4f48cb[_0x2cf6('0x39')][_0x2cf6('0x43')]);_0x520120[_0x2cf6('0x44')]=qs[_0x2cf6('0x3b')](_[_0x2cf6('0x45')](_0x4f48cb[_0x2cf6('0x39')],_0x5227bc[_0x2cf6('0x3b')]));if(_0x4f48cb['query'][_0x2cf6('0x46')]){_0x520120[_0x2cf6('0x44')]=_[_0x2cf6('0x48')](_0x520120[_0x2cf6('0x44')],{'$or':_[_0x2cf6('0x33')](_0x520120[_0x2cf6('0x3e')],function(_0x17ba86){var _0x399cb7={};_0x399cb7[_0x17ba86]={'$like':'%'+_0x4f48cb[_0x2cf6('0x39')][_0x2cf6('0x46')]+'%'};return _0x399cb7;})});}_0x520120=_[_0x2cf6('0x48')]({},_0x520120,_0x4f48cb['options']);return _0x408d38[_0x2cf6('0x65')](_0x520120);}})[_0x2cf6('0x2c')](function(_0x5cd901){if(_0x5cd901){_0x3c1344=_0x5cd901[_0x2cf6('0x5b')];if(!_0x4f48cb[_0x2cf6('0x39')][_0x2cf6('0x40')](_0x2cf6('0x41'))){_0x520120[_0x2cf6('0x26')]=qs[_0x2cf6('0x26')](_0x4f48cb['query']['limit']);_0x520120[_0x2cf6('0x23')]=qs[_0x2cf6('0x23')](_0x4f48cb['query'][_0x2cf6('0x23')]);}return _0x408d38[_0x2cf6('0x65')](_0x520120);}})[_0x2cf6('0x2c')](function(_0x3a1756){if(_0x3a1756){return _0x3a1756?{'count':_0x3c1344,'rows':_0x3a1756}:null;}})[_0x2cf6('0x2c')](respondWithResult(_0x263c45,null))[_0x2cf6('0x4c')](handleError(_0x263c45,null));};exports['addTeams']=function(_0x39341d,_0x4cbe18,_0x3acd0d){var _0xf67124=_0x39341d[_0x2cf6('0x57')][_0x2cf6('0x67')];return db[_0x2cf6('0x66')][_0x2cf6('0x68')]({'where':{'id':_0xf67124},'attributes':['id'],'include':[{'model':db[_0x2cf6('0x5d')],'as':_0x2cf6('0x69'),'attributes':['id',_0x2cf6('0x31'),_0x2cf6('0x6a'),'voicePause',_0x2cf6('0x6b')],'raw':!![]}]})[_0x2cf6('0x2c')](function(_0xb880a8){if(_0xb880a8){var _0x5ccc3c=_[_0x2cf6('0x6c')](_0xb880a8,function(_0x312494){var _0x193aa0=_0x312494[_0x2cf6('0x51')]({'plain':!![]});return _0x193aa0[_0x2cf6('0x69')];});return db[_0x2cf6('0x34')]['find']({'where':{'id':_0x39341d['params']['id']}})[_0x2cf6('0x2c')](function(_0x72253f){return db[_0x2cf6('0x6d')][_0x2cf6('0x6e')](function(_0x422038){return _0x72253f[_0x2cf6('0x6f')](_0xf67124,{'transaction':_0x422038})[_0x2cf6('0x2c')](function(){return BPromise[_0x2cf6('0x70')](_0x5ccc3c,function(_0x4f9d51){return db[_0x2cf6('0x5a')]['findOrCreate']({'where':{'UserId':_0x4f9d51['id'],'FaxQueueId':_0x39341d[_0x2cf6('0x4d')]['id']},'transaction':_0x422038});});})[_0x2cf6('0x2c')](function(){_0x5ccc3c[_0x2cf6('0x71')](function(_0x230ae6){socket['emit'](_0x2cf6('0x72'),{'UserId':_0x230ae6['id'],'FaxQueueId':_0x72253f['id']});});});});});}})[_0x2cf6('0x2c')](respondWithStatusCode(_0x4cbe18,null))[_0x2cf6('0x4c')](handleError(_0x4cbe18,null));};exports[_0x2cf6('0x73')]=function(_0x41f684,_0x172549,_0x4157fc){return db[_0x2cf6('0x66')][_0x2cf6('0x68')]({'where':{'id':_0x41f684[_0x2cf6('0x39')][_0x2cf6('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2cf6('0x69'),'attributes':['id'],'raw':!![]}]})[_0x2cf6('0x2c')](handleEntityNotFound(_0x172549,null))['then'](function(_0x370681){var _0x312b1e=_[_0x2cf6('0x33')](_0x370681,'id');var _0x4102e3=[];var _0xb8b480=[];var _0x2c98c5=squel[_0x2cf6('0x74')]();_0x2c98c5['field'](_0x2cf6('0x75'))[_0x2cf6('0x76')](_0x2cf6('0x77'),'tq')[_0x2cf6('0x78')](_0x2cf6('0x79'),'ut',_0x2cf6('0x7a'))['where'](_0x2cf6('0x7b'),_0x41f684['params']['id']);for(var _0x395307=0x0;_0x395307<_0x370681['length'];_0x395307+=0x1){let _0x55a7c0=_0x370681[_0x395307];for(var _0x441827=0x0;_0x441827<_0x55a7c0[_0x2cf6('0x69')][_0x2cf6('0x5b')];_0x441827+=0x1){let _0x488878=_0x55a7c0['Agents'][_0x441827];var _0x26bd22=_0x2c98c5[_0x2cf6('0x7c')]();_0x26bd22[_0x2cf6('0x44')]('ut.UserId\x20=\x20?',_0x488878['id']);_0xb8b480[_0x2cf6('0x7d')](db[_0x2cf6('0x6d')][_0x2cf6('0x39')](_0x26bd22[_0x2cf6('0x7e')](),{'type':db[_0x2cf6('0x6d')][_0x2cf6('0x7f')][_0x2cf6('0x80')]})[_0x2cf6('0x2c')](function(_0x44632b){if(_0x44632b['length']===0x1){return _0x488878['id'];}else{var _0x15baf2=_[_0x2cf6('0x81')](_[_0x2cf6('0x33')](_0x44632b,'TeamId'),function(_0x4b5cfe){return _[_0x2cf6('0x82')](_0x312b1e,_0x4b5cfe);});if(_0x15baf2){return _0x488878['id'];}}}));}}return BPromise[_0x2cf6('0x83')](_0xb8b480)['then'](function(_0x197960){_0x4102e3=_(_0x4102e3)['union'](_0x197960)[_0x2cf6('0x84')]()[_0x2cf6('0x85')]();return db['FaxQueue'][_0x2cf6('0x4e')]({'where':{'id':_0x41f684[_0x2cf6('0x4d')]['id']}})[_0x2cf6('0x2c')](function(_0x2a1bac){return db[_0x2cf6('0x6d')][_0x2cf6('0x6e')](function(_0xfb6ed3){return _0x2a1bac['removeTeams'](_0x41f684[_0x2cf6('0x39')]['ids'],{'transaction':_0xfb6ed3})[_0x2cf6('0x2c')](function(){if(!_[_0x2cf6('0x86')](_0x4102e3)){return _0x2a1bac[_0x2cf6('0x87')](_0x4102e3,{'transaction':_0xfb6ed3});}})[_0x2cf6('0x2c')](function(){_0x4102e3[_0x2cf6('0x71')](function(_0x4f0606){socket[_0x2cf6('0x88')](_0x2cf6('0x89'),{'UserId':_0x4f0606,'FaxQueueId':_0x2a1bac['id']});});});});});});})['then'](respondWithStatusCode(_0x172549,null))[_0x2cf6('0x4c')](handleError(_0x172549,null));};exports[_0x2cf6('0x8a')]=function(_0x4093ad,_0x5f27db,_0x1de492){return db['FaxQueue'][_0x2cf6('0x4e')]({'where':{'id':_0x4093ad[_0x2cf6('0x4d')]['id']}})[_0x2cf6('0x2c')](handleEntityNotFound(_0x5f27db,null))[_0x2cf6('0x2c')](function(_0x3bc60e){if(_0x3bc60e){return _0x3bc60e[_0x2cf6('0x8a')](_0x4093ad[_0x2cf6('0x57')][_0x2cf6('0x67')],_[_0x2cf6('0x8b')](_0x4093ad['body'],[_0x2cf6('0x67'),'id'])||{})['spread'](function(_0x592bb9){for(var _0x57093e=0x0;_0x57093e<_0x4093ad[_0x2cf6('0x57')][_0x2cf6('0x67')][_0x2cf6('0x5b')];_0x57093e+=0x1){socket[_0x2cf6('0x88')](_0x2cf6('0x72'),{'UserId':_0x4093ad[_0x2cf6('0x57')][_0x2cf6('0x67')][_0x57093e],'FaxQueueId':_0x4093ad['params']['id']});}return _0x592bb9;});}})[_0x2cf6('0x2c')](respondWithResult(_0x5f27db,null))[_0x2cf6('0x4c')](handleError(_0x5f27db,null));};exports['removeAgents']=function(_0x55dd91,_0x5f5681,_0x1d38ab){return db[_0x2cf6('0x34')][_0x2cf6('0x4e')]({'where':{'id':_0x55dd91['params']['id']}})[_0x2cf6('0x2c')](handleEntityNotFound(_0x5f5681,null))[_0x2cf6('0x2c')](function(_0x597ea8){if(_0x597ea8){return _0x597ea8[_0x2cf6('0x87')](_0x55dd91[_0x2cf6('0x39')]['ids'])['then'](function(){if(_[_0x2cf6('0x8c')](_0x55dd91['query'][_0x2cf6('0x67')])){for(var _0x532879=0x0;_0x532879<_0x55dd91[_0x2cf6('0x39')][_0x2cf6('0x67')][_0x2cf6('0x5b')];_0x532879+=0x1){socket[_0x2cf6('0x88')]('userFaxQueue:remove',{'UserId':Number(_0x55dd91[_0x2cf6('0x39')]['ids'][_0x532879]),'FaxQueueId':Number(_0x55dd91[_0x2cf6('0x4d')]['id'])});}}else{socket[_0x2cf6('0x88')]('userFaxQueue:remove',{'UserId':Number(_0x55dd91['query']['ids']),'FaxQueueId':Number(_0x55dd91[_0x2cf6('0x4d')]['id'])});}});}})[_0x2cf6('0x2c')](respondWithStatusCode(_0x5f5681,null))['catch'](handleError(_0x5f5681,null));};exports[_0x2cf6('0x8d')]=function(_0xfb4ef9,_0x5e79fa,_0x534991){var _0x59d695={};var _0x5a5d08={};var _0x41d324;var _0x361a46;return db['FaxQueue'][_0x2cf6('0x59')]({'where':{'id':_0xfb4ef9[_0x2cf6('0x4d')]['id']}})[_0x2cf6('0x2c')](handleEntityNotFound(_0x5e79fa,null))['then'](function(_0x209069){if(_0x209069){_0x41d324=_0x209069;_0x5a5d08[_0x2cf6('0x3d')]=_[_0x2cf6('0x3a')](db[_0x2cf6('0x5d')][_0x2cf6('0x35')]);_0x5a5d08[_0x2cf6('0x39')]=_[_0x2cf6('0x3a')](_0xfb4ef9[_0x2cf6('0x39')]);_0x5a5d08[_0x2cf6('0x3b')]=_[_0x2cf6('0x3c')](_0x5a5d08['model'],_0x5a5d08['query']);_0x59d695[_0x2cf6('0x3e')]=_['intersection'](_0x5a5d08[_0x2cf6('0x3d')],qs[_0x2cf6('0x3f')](_0xfb4ef9[_0x2cf6('0x39')][_0x2cf6('0x3f')]));_0x59d695[_0x2cf6('0x3e')]=_0x59d695[_0x2cf6('0x3e')][_0x2cf6('0x5b')]?_0x59d695['attributes']:_0x5a5d08[_0x2cf6('0x3d')];_0x59d695[_0x2cf6('0x42')]=qs[_0x2cf6('0x43')](_0xfb4ef9[_0x2cf6('0x39')][_0x2cf6('0x43')]);_0x59d695[_0x2cf6('0x44')]=qs[_0x2cf6('0x3b')](_['pick'](_0xfb4ef9[_0x2cf6('0x39')],_0x5a5d08[_0x2cf6('0x3b')]));if(_0xfb4ef9['query'][_0x2cf6('0x46')]){_0x59d695[_0x2cf6('0x44')]=_[_0x2cf6('0x48')](_0x59d695[_0x2cf6('0x44')],{'$or':_[_0x2cf6('0x33')](_0x59d695['attributes'],function(_0x28dc5d){var _0x4ea650={};_0x4ea650[_0x28dc5d]={'$like':'%'+_0xfb4ef9[_0x2cf6('0x39')][_0x2cf6('0x46')]+'%'};return _0x4ea650;})});}_0x59d695=_[_0x2cf6('0x48')]({},_0x59d695,_0xfb4ef9[_0x2cf6('0x49')]);return _0x41d324['getAgents'](_0x59d695);}})[_0x2cf6('0x2c')](function(_0x525d16){if(_0x525d16){_0x361a46=_0x525d16[_0x2cf6('0x5b')];if(!_0xfb4ef9[_0x2cf6('0x39')][_0x2cf6('0x40')](_0x2cf6('0x41'))){_0x59d695[_0x2cf6('0x26')]=qs[_0x2cf6('0x26')](_0xfb4ef9[_0x2cf6('0x39')]['limit']);_0x59d695[_0x2cf6('0x23')]=qs[_0x2cf6('0x23')](_0xfb4ef9[_0x2cf6('0x39')][_0x2cf6('0x23')]);}return _0x41d324[_0x2cf6('0x8d')](_0x59d695);}})['then'](function(_0x29c723){if(_0x29c723){return _0x29c723?{'count':_0x361a46,'rows':_0x29c723}:null;}})[_0x2cf6('0x2c')](respondWithResult(_0x5e79fa,null))[_0x2cf6('0x4c')](handleError(_0x5e79fa,null));}; \ No newline at end of file +var _0xd947=['field','tq.TeamId','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','union','value','isEmpty','userFaxQueue:remove','addAgents','omit','spread','emit','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','FaxQueues','UserProfileResource','stack','name','send','FaxQueue','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','FaxQueueId','findAll','User','findAndCountAll','UserId','agent','faxPause','rows','format','SIP','createdAt','updatedAt','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userFaxQueue:save','removeTeams'];(function(_0x37ed57,_0x2190eb){var _0x14f826=function(_0xf2d5e1){while(--_0xf2d5e1){_0x37ed57['push'](_0x37ed57['shift']());}};_0x14f826(++_0x2190eb);}(_0xd947,0x130));var _0x7d94=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xd947[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0x7d94('0x0'));var rimraf=require(_0x7d94('0x1'));var zipdir=require(_0x7d94('0x2'));var jsonpatch=require(_0x7d94('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7d94('0x4'));var Mustache=require('mustache');var util=require(_0x7d94('0x5'));var path=require(_0x7d94('0x6'));var sox=require('sox');var csv=require(_0x7d94('0x7'));var ejs=require(_0x7d94('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d94('0x9'));var squel=require(_0x7d94('0xa'));var crypto=require('crypto');var jsforce=require(_0x7d94('0xb'));var deskjs=require(_0x7d94('0xc'));var toCsv=require(_0x7d94('0x7'));var querystring=require(_0x7d94('0xd'));var Papa=require(_0x7d94('0xe'));var Redis=require(_0x7d94('0xf'));var authService=require(_0x7d94('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7d94('0x11'));var hardwareService=require(_0x7d94('0x12'));var logger=require('../../config/logger')(_0x7d94('0x13'));var utils=require('../../config/utils');var config=require(_0x7d94('0x14'));var licenseUtil=require(_0x7d94('0x15'));var db=require(_0x7d94('0x16'))['db'];config[_0x7d94('0x17')]=_[_0x7d94('0x18')](config[_0x7d94('0x17')],{'host':_0x7d94('0x19'),'port':0x18eb});var socket=require(_0x7d94('0x1a'))(new Redis(config[_0x7d94('0x17')]));require(_0x7d94('0x1b'))[_0x7d94('0x1c')](socket);function respondWithStatusCode(_0x4463ac,_0x423e3d){_0x423e3d=_0x423e3d||0xcc;return function(_0x292015){if(_0x292015){return _0x4463ac[_0x7d94('0x1d')](_0x423e3d);}return _0x4463ac[_0x7d94('0x1e')](_0x423e3d)[_0x7d94('0x1f')]();};}function respondWithResult(_0x58fdcb,_0x5e3871){_0x5e3871=_0x5e3871||0xc8;return function(_0x1d47f1){if(_0x1d47f1){return _0x58fdcb[_0x7d94('0x1e')](_0x5e3871)[_0x7d94('0x20')](_0x1d47f1);}};}function respondWithFilteredResult(_0x241ec7,_0x5e61a3){return function(_0x214d17){if(_0x214d17){var _0x5395cd=typeof _0x5e61a3[_0x7d94('0x21')]===_0x7d94('0x22')&&typeof _0x5e61a3[_0x7d94('0x23')]===_0x7d94('0x22');var _0x5df57e=_0x214d17['count'];var _0xea5bee=_0x5395cd?0x0:_0x5e61a3[_0x7d94('0x21')];var _0xfcfd91=_0x5395cd?_0x214d17[_0x7d94('0x24')]:_0x5e61a3[_0x7d94('0x21')]+_0x5e61a3['limit'];var _0x1aa801;if(_0xfcfd91>=_0x5df57e){_0xfcfd91=_0x5df57e;_0x1aa801=0xc8;}else{_0x1aa801=0xce;}_0x241ec7['status'](_0x1aa801);return _0x241ec7[_0x7d94('0x25')](_0x7d94('0x26'),_0xea5bee+'-'+_0xfcfd91+'/'+_0x5df57e)[_0x7d94('0x20')](_0x214d17);}return null;};}function patchUpdates(_0x5045c3){return function(_0x4771b8){try{jsonpatch[_0x7d94('0x27')](_0x4771b8,_0x5045c3,!![]);}catch(_0x200e42){return BPromise['reject'](_0x200e42);}return _0x4771b8[_0x7d94('0x28')]();};}function saveUpdates(_0x1d2a95,_0x36aec8){return function(_0x39f6e1){if(_0x39f6e1){return _0x39f6e1[_0x7d94('0x29')](_0x1d2a95)[_0x7d94('0x2a')](function(_0x23b1bd){return _0x23b1bd;});}return null;};}function removeEntity(_0x69e9d8,_0x488c2e){return function(_0x266681){if(_0x266681){return _0x266681[_0x7d94('0x2b')]()[_0x7d94('0x2a')](function(){var _0xc0a980=_0x266681[_0x7d94('0x2c')]({'plain':!![]});var _0x3c2fcb=_0x7d94('0x2d');return db[_0x7d94('0x2e')]['destroy']({'where':{'type':_0x3c2fcb,'resourceId':_0xc0a980['id']}})[_0x7d94('0x2a')](function(){return _0x266681;});})[_0x7d94('0x2a')](function(){_0x69e9d8[_0x7d94('0x1e')](0xcc)[_0x7d94('0x1f')]();});}};}function handleEntityNotFound(_0x586b7f,_0x324478){return function(_0x26df2c){if(!_0x26df2c){_0x586b7f[_0x7d94('0x1d')](0x194);}return _0x26df2c;};}function handleError(_0x2b2c58,_0x4b7c48){_0x4b7c48=_0x4b7c48||0x1f4;return function(_0x5eeb23){logger['error'](_0x5eeb23[_0x7d94('0x2f')]);if(_0x5eeb23[_0x7d94('0x30')]){delete _0x5eeb23[_0x7d94('0x30')];}_0x2b2c58[_0x7d94('0x1e')](_0x4b7c48)[_0x7d94('0x31')](_0x5eeb23);};}exports['index']=function(_0x5812e3,_0x1b0bf0){var _0x17564f={},_0x5ed067={},_0x2d399c={'count':0x0,'rows':[]};var _0xd013c5=_['map'](db[_0x7d94('0x32')][_0x7d94('0x33')],function(_0x115834){return{'name':_0x115834[_0x7d94('0x34')],'type':_0x115834['type'][_0x7d94('0x35')]};});_0x5ed067[_0x7d94('0x36')]=_[_0x7d94('0x37')](_0xd013c5,_0x7d94('0x30'));_0x5ed067[_0x7d94('0x38')]=_[_0x7d94('0x39')](_0x5812e3[_0x7d94('0x38')]);_0x5ed067[_0x7d94('0x3a')]=_['intersection'](_0x5ed067['model'],_0x5ed067[_0x7d94('0x38')]);_0x17564f[_0x7d94('0x3b')]=_[_0x7d94('0x3c')](_0x5ed067[_0x7d94('0x36')],qs[_0x7d94('0x3d')](_0x5812e3[_0x7d94('0x38')][_0x7d94('0x3d')]));_0x17564f[_0x7d94('0x3b')]=_0x17564f[_0x7d94('0x3b')][_0x7d94('0x3e')]?_0x17564f[_0x7d94('0x3b')]:_0x5ed067[_0x7d94('0x36')];if(!_0x5812e3[_0x7d94('0x38')]['hasOwnProperty'](_0x7d94('0x3f'))){_0x17564f[_0x7d94('0x23')]=qs[_0x7d94('0x23')](_0x5812e3['query'][_0x7d94('0x23')]);_0x17564f[_0x7d94('0x21')]=qs['offset'](_0x5812e3[_0x7d94('0x38')][_0x7d94('0x21')]);}_0x17564f[_0x7d94('0x40')]=qs['sort'](_0x5812e3[_0x7d94('0x38')][_0x7d94('0x41')]);_0x17564f[_0x7d94('0x42')]=qs['filters'](_[_0x7d94('0x43')](_0x5812e3[_0x7d94('0x38')],_0x5ed067[_0x7d94('0x3a')]),_0xd013c5);if(_0x5812e3[_0x7d94('0x38')][_0x7d94('0x44')]){_0x17564f[_0x7d94('0x42')]=_[_0x7d94('0x45')](_0x17564f[_0x7d94('0x42')],{'$or':_[_0x7d94('0x37')](_0xd013c5,function(_0x501f25){if(_0x501f25[_0x7d94('0x46')]!==_0x7d94('0x47')){var _0x40b7d5={};_0x40b7d5[_0x501f25['name']]={'$like':'%'+_0x5812e3[_0x7d94('0x38')][_0x7d94('0x44')]+'%'};return _0x40b7d5;}})});}_0x17564f=_[_0x7d94('0x45')]({},_0x17564f,_0x5812e3[_0x7d94('0x48')]);var _0x297ea5={'where':_0x17564f[_0x7d94('0x42')]};return db[_0x7d94('0x32')][_0x7d94('0x24')](_0x297ea5)['then'](function(_0x57dac2){_0x2d399c[_0x7d94('0x24')]=_0x57dac2;if(_0x5812e3[_0x7d94('0x38')][_0x7d94('0x49')]){_0x17564f[_0x7d94('0x4a')]=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0x17564f);})[_0x7d94('0x2a')](function(_0x2a03cf){_0x2d399c['rows']=_0x2a03cf;return _0x2d399c;})[_0x7d94('0x2a')](respondWithFilteredResult(_0x1b0bf0,_0x17564f))[_0x7d94('0x4b')](handleError(_0x1b0bf0,null));};exports[_0x7d94('0x4c')]=function(_0x55caa8,_0x32d605){var _0x5df18f={'raw':!![],'where':{'id':_0x55caa8[_0x7d94('0x4d')]['id']}},_0x4ea2ec={};_0x4ea2ec[_0x7d94('0x36')]=_[_0x7d94('0x39')](db['FaxQueue'][_0x7d94('0x33')]);_0x4ea2ec[_0x7d94('0x38')]=_[_0x7d94('0x39')](_0x55caa8['query']);_0x4ea2ec['filters']=_[_0x7d94('0x3c')](_0x4ea2ec['model'],_0x4ea2ec[_0x7d94('0x38')]);_0x5df18f[_0x7d94('0x3b')]=_[_0x7d94('0x3c')](_0x4ea2ec[_0x7d94('0x36')],qs[_0x7d94('0x3d')](_0x55caa8[_0x7d94('0x38')][_0x7d94('0x3d')]));_0x5df18f[_0x7d94('0x3b')]=_0x5df18f[_0x7d94('0x3b')][_0x7d94('0x3e')]?_0x5df18f[_0x7d94('0x3b')]:_0x4ea2ec[_0x7d94('0x36')];if(_0x55caa8[_0x7d94('0x38')][_0x7d94('0x49')]){_0x5df18f[_0x7d94('0x4a')]=[{'all':!![]}];}_0x5df18f=_[_0x7d94('0x45')]({},_0x5df18f,_0x55caa8['options']);return db['FaxQueue'][_0x7d94('0x4e')](_0x5df18f)['then'](handleEntityNotFound(_0x32d605,null))[_0x7d94('0x2a')](respondWithResult(_0x32d605,null))['catch'](handleError(_0x32d605,null));};exports[_0x7d94('0x4f')]=function(_0x23d593,_0x3b75a7){return db['FaxQueue'][_0x7d94('0x4f')](_0x23d593['body'],{})['then'](function(_0x58464c){var _0x7a4bf7=_0x23d593[_0x7d94('0x50')]['get']({'plain':!![]});if(!_0x7a4bf7)throw new Error(_0x7d94('0x51'));if(_0x7a4bf7[_0x7d94('0x52')]===_0x7d94('0x50')){var _0x3b5989=_0x58464c[_0x7d94('0x2c')]({'plain':!![]});var _0x39cd1b=_0x7d94('0x2d');return db[_0x7d94('0x53')]['find']({'where':{'name':_0x39cd1b,'userProfileId':_0x7a4bf7['userProfileId']},'raw':!![]})['then'](function(_0x116b2a){if(_0x116b2a&&_0x116b2a['autoAssociation']===0x0){return db[_0x7d94('0x2e')][_0x7d94('0x4f')]({'name':_0x3b5989[_0x7d94('0x30')],'resourceId':_0x3b5989['id'],'type':_0x116b2a[_0x7d94('0x30')],'sectionId':_0x116b2a['id']},{})[_0x7d94('0x2a')](function(){return _0x58464c;});}else{return _0x58464c;}})[_0x7d94('0x4b')](function(_0x1040d7){logger[_0x7d94('0x54')](_0x7d94('0x55'),_0x1040d7);throw _0x1040d7;});}return _0x58464c;})[_0x7d94('0x2a')](respondWithResult(_0x3b75a7,0xc9))['catch'](handleError(_0x3b75a7,null));};exports[_0x7d94('0x29')]=function(_0x17e7b1,_0x1b4f9d){if(_0x17e7b1[_0x7d94('0x56')]['id']){delete _0x17e7b1['body']['id'];}return db[_0x7d94('0x32')][_0x7d94('0x4e')]({'where':{'id':_0x17e7b1['params']['id']}})[_0x7d94('0x2a')](handleEntityNotFound(_0x1b4f9d,null))['then'](saveUpdates(_0x17e7b1[_0x7d94('0x56')],null))[_0x7d94('0x2a')](respondWithResult(_0x1b4f9d,null))['catch'](handleError(_0x1b4f9d,null));};exports['destroy']=function(_0x2dacb3,_0x2201d7){return db[_0x7d94('0x32')][_0x7d94('0x4e')]({'where':{'id':_0x2dacb3[_0x7d94('0x4d')]['id']}})[_0x7d94('0x2a')](handleEntityNotFound(_0x2201d7,null))[_0x7d94('0x2a')](removeEntity(_0x2201d7,null))[_0x7d94('0x4b')](handleError(_0x2201d7,null));};exports[_0x7d94('0x57')]=function(_0x2f058c,_0x366f2a){return db[_0x7d94('0x32')][_0x7d94('0x57')]()['then'](respondWithResult(_0x366f2a,null))['catch'](handleError(_0x366f2a,null));};exports[_0x7d94('0x58')]=function(_0x5c1c77,_0x1c2fb1,_0x4e07ce){var _0x5530b4={'raw':!![],'where':{}},_0x2c617b={},_0x25c2a4;return db[_0x7d94('0x32')][_0x7d94('0x59')]({'where':{'id':_0x5c1c77[_0x7d94('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1c2fb1,null))[_0x7d94('0x2a')](function(_0x2af83d){if(_0x2af83d){_0x25c2a4=_0x2af83d[_0x7d94('0x2c')]({'plain':!![]});_0x2c617b[_0x7d94('0x36')]=_[_0x7d94('0x39')](db[_0x7d94('0x5a')][_0x7d94('0x33')]);_0x2c617b[_0x7d94('0x38')]=_[_0x7d94('0x39')](_0x5c1c77[_0x7d94('0x38')]);_0x2c617b[_0x7d94('0x3a')]=_['intersection'](_0x2c617b[_0x7d94('0x36')],_0x2c617b[_0x7d94('0x38')]);_0x5530b4[_0x7d94('0x3b')]=_[_0x7d94('0x3c')](_0x2c617b['model'],qs['fields'](_0x5c1c77['query'][_0x7d94('0x3d')]));_0x5530b4[_0x7d94('0x3b')]=_0x5530b4[_0x7d94('0x3b')][_0x7d94('0x3e')]?_0x5530b4['attributes']:_0x2c617b['model'];if(!_0x5c1c77[_0x7d94('0x38')][_0x7d94('0x5b')](_0x7d94('0x3f'))){_0x5530b4[_0x7d94('0x23')]=qs['limit'](_0x5c1c77['query']['limit']);_0x5530b4[_0x7d94('0x21')]=qs['offset'](_0x5c1c77[_0x7d94('0x38')][_0x7d94('0x21')]);}_0x5530b4[_0x7d94('0x40')]=qs[_0x7d94('0x41')](_0x5c1c77[_0x7d94('0x38')][_0x7d94('0x41')]);_0x5530b4[_0x7d94('0x42')]=qs[_0x7d94('0x3a')](_[_0x7d94('0x43')](_0x5c1c77['query'],_0x2c617b[_0x7d94('0x3a')]));_0x5530b4['where'][_0x7d94('0x5c')]=_0x2af83d['id'];if(_0x5c1c77[_0x7d94('0x38')][_0x7d94('0x44')]){_0x5530b4[_0x7d94('0x42')]=_[_0x7d94('0x45')](_0x5530b4[_0x7d94('0x42')],{'$or':_[_0x7d94('0x37')](_0x5530b4[_0x7d94('0x3b')],function(_0x4ea4b2){var _0x53d84d={};_0x53d84d[_0x4ea4b2]={'$like':'%'+_0x5c1c77['query'][_0x7d94('0x44')]+'%'};return _0x53d84d;})});}_0x5530b4=_[_0x7d94('0x45')]({},_0x5530b4,_0x5c1c77[_0x7d94('0x48')]);return db[_0x7d94('0x5a')][_0x7d94('0x5d')](_0x5530b4);}})['then'](function(_0x3a5227){if(_0x3a5227){return db[_0x7d94('0x5e')][_0x7d94('0x5f')]({'where':{'id':_[_0x7d94('0x37')](_0x3a5227,_0x7d94('0x60')),'role':_0x7d94('0x61')},'attributes':['id',_0x7d94('0x30'),_0x7d94('0x62'),'updatedAt','createdAt']});}})['then'](function(_0x1e14e9){if(_0x1e14e9){return{'count':_0x1e14e9[_0x7d94('0x24')],'rows':_[_0x7d94('0x37')](_0x1e14e9[_0x7d94('0x63')],function(_0x480ad6){return{'membername':_0x480ad6[_0x7d94('0x30')],'UserId':_0x480ad6['id'],'queue_name':_0x25c2a4[_0x7d94('0x30')],'FaxQueueId':_0x25c2a4['id'],'interface':util[_0x7d94('0x64')]('%s/%s',_0x7d94('0x65'),_0x480ad6[_0x7d94('0x30')]),'penalty':0x0,'paused':_0x480ad6[_0x7d94('0x62')],'createdAt':_0x480ad6[_0x7d94('0x66')],'updatedAt':_0x480ad6[_0x7d94('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1c2fb1,_0x5530b4))[_0x7d94('0x4b')](handleError(_0x1c2fb1,null));};exports[_0x7d94('0x68')]=function(_0x4f1b52,_0x1f4f76,_0x13ca7b){var _0x181547={};var _0x594630={};var _0x1d99d7;var _0x173147;return db[_0x7d94('0x32')]['findOne']({'where':{'id':_0x4f1b52['params']['id']}})['then'](handleEntityNotFound(_0x1f4f76,null))[_0x7d94('0x2a')](function(_0x4d6e5b){if(_0x4d6e5b){_0x1d99d7=_0x4d6e5b;_0x594630['model']=_['keys'](db[_0x7d94('0x69')]['rawAttributes']);_0x594630[_0x7d94('0x38')]=_[_0x7d94('0x39')](_0x4f1b52['query']);_0x594630[_0x7d94('0x3a')]=_[_0x7d94('0x3c')](_0x594630[_0x7d94('0x36')],_0x594630[_0x7d94('0x38')]);_0x181547[_0x7d94('0x3b')]=_['intersection'](_0x594630[_0x7d94('0x36')],qs[_0x7d94('0x3d')](_0x4f1b52[_0x7d94('0x38')]['fields']));_0x181547[_0x7d94('0x3b')]=_0x181547[_0x7d94('0x3b')]['length']?_0x181547[_0x7d94('0x3b')]:_0x594630[_0x7d94('0x36')];_0x181547[_0x7d94('0x40')]=qs[_0x7d94('0x41')](_0x4f1b52['query'][_0x7d94('0x41')]);_0x181547[_0x7d94('0x42')]=qs[_0x7d94('0x3a')](_[_0x7d94('0x43')](_0x4f1b52[_0x7d94('0x38')],_0x594630[_0x7d94('0x3a')]));if(_0x4f1b52[_0x7d94('0x38')]['filter']){_0x181547[_0x7d94('0x42')]=_[_0x7d94('0x45')](_0x181547['where'],{'$or':_[_0x7d94('0x37')](_0x181547['attributes'],function(_0x2f3e6b){var _0x4ca8fb={};_0x4ca8fb[_0x2f3e6b]={'$like':'%'+_0x4f1b52[_0x7d94('0x38')][_0x7d94('0x44')]+'%'};return _0x4ca8fb;})});}_0x181547=_[_0x7d94('0x45')]({},_0x181547,_0x4f1b52[_0x7d94('0x48')]);return _0x1d99d7['getTeams'](_0x181547);}})[_0x7d94('0x2a')](function(_0x31a1ce){if(_0x31a1ce){_0x173147=_0x31a1ce[_0x7d94('0x3e')];if(!_0x4f1b52[_0x7d94('0x38')][_0x7d94('0x5b')](_0x7d94('0x3f'))){_0x181547[_0x7d94('0x23')]=qs[_0x7d94('0x23')](_0x4f1b52[_0x7d94('0x38')]['limit']);_0x181547[_0x7d94('0x21')]=qs['offset'](_0x4f1b52[_0x7d94('0x38')]['offset']);}return _0x1d99d7[_0x7d94('0x68')](_0x181547);}})['then'](function(_0x3899e8){if(_0x3899e8){return _0x3899e8?{'count':_0x173147,'rows':_0x3899e8}:null;}})['then'](respondWithResult(_0x1f4f76,null))[_0x7d94('0x4b')](handleError(_0x1f4f76,null));};exports[_0x7d94('0x6a')]=function(_0x345972,_0x94258f,_0x4d1202){var _0x2c2cfd=_0x345972[_0x7d94('0x56')][_0x7d94('0x6b')];return db['Team'][_0x7d94('0x5d')]({'where':{'id':_0x2c2cfd},'attributes':['id'],'include':[{'model':db[_0x7d94('0x5e')],'as':_0x7d94('0x6c'),'attributes':['id',_0x7d94('0x30'),'online',_0x7d94('0x6d'),_0x7d94('0x6e')],'raw':!![]}]})[_0x7d94('0x2a')](function(_0x703ed){if(_0x703ed){var _0x49c10d=_[_0x7d94('0x6f')](_0x703ed,function(_0x2637aa){var _0x35f561=_0x2637aa[_0x7d94('0x2c')]({'plain':!![]});return _0x35f561[_0x7d94('0x6c')];});return db[_0x7d94('0x32')][_0x7d94('0x4e')]({'where':{'id':_0x345972['params']['id']}})[_0x7d94('0x2a')](function(_0xc6f275){return db[_0x7d94('0x70')][_0x7d94('0x71')](function(_0x560adc){return _0xc6f275[_0x7d94('0x6a')](_0x2c2cfd,{'transaction':_0x560adc})['then'](function(){return BPromise[_0x7d94('0x72')](_0x49c10d,function(_0x52511b){return db[_0x7d94('0x5a')][_0x7d94('0x73')]({'where':{'UserId':_0x52511b['id'],'FaxQueueId':_0x345972['params']['id']},'transaction':_0x560adc});});})[_0x7d94('0x2a')](function(){_0x49c10d[_0x7d94('0x74')](function(_0x105f90){socket['emit'](_0x7d94('0x75'),{'UserId':_0x105f90['id'],'FaxQueueId':_0xc6f275['id']});});});});});}})[_0x7d94('0x2a')](respondWithStatusCode(_0x94258f,null))[_0x7d94('0x4b')](handleError(_0x94258f,null));};exports[_0x7d94('0x76')]=function(_0x3270be,_0x5b90f6,_0x468bf8){return db[_0x7d94('0x69')][_0x7d94('0x5d')]({'where':{'id':_0x3270be[_0x7d94('0x38')][_0x7d94('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x7d94('0x5e')],'as':_0x7d94('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x7d94('0x2a')](handleEntityNotFound(_0x5b90f6,null))[_0x7d94('0x2a')](function(_0x4e1a24){var _0x24569f=_['map'](_0x4e1a24,'id');var _0x2afc5a=[];var _0x46cb73=[];var _0x2072ef=squel['select']();_0x2072ef[_0x7d94('0x77')](_0x7d94('0x78'))['from'](_0x7d94('0x79'),'tq')['join'](_0x7d94('0x7a'),'ut',_0x7d94('0x7b'))[_0x7d94('0x42')](_0x7d94('0x7c'),_0x3270be['params']['id']);for(var _0x57ddd9=0x0;_0x57ddd9<_0x4e1a24[_0x7d94('0x3e')];_0x57ddd9+=0x1){let _0x210a06=_0x4e1a24[_0x57ddd9];for(var _0x1ab28e=0x0;_0x1ab28e<_0x210a06[_0x7d94('0x6c')][_0x7d94('0x3e')];_0x1ab28e+=0x1){let _0x52cd22=_0x210a06[_0x7d94('0x6c')][_0x1ab28e];var _0x31847b=_0x2072ef['clone']();_0x31847b[_0x7d94('0x42')]('ut.UserId\x20=\x20?',_0x52cd22['id']);_0x46cb73[_0x7d94('0x7d')](db[_0x7d94('0x70')]['query'](_0x31847b['toString'](),{'type':db[_0x7d94('0x70')][_0x7d94('0x7e')][_0x7d94('0x7f')]})[_0x7d94('0x2a')](function(_0x36c489){if(_0x36c489['length']===0x1){return _0x52cd22['id'];}else{var _0x13a293=_[_0x7d94('0x80')](_[_0x7d94('0x37')](_0x36c489,_0x7d94('0x81')),function(_0x5124a5){return _['includes'](_0x24569f,_0x5124a5);});if(_0x13a293){return _0x52cd22['id'];}}}));}}return BPromise['all'](_0x46cb73)[_0x7d94('0x2a')](function(_0x499da1){_0x2afc5a=_(_0x2afc5a)[_0x7d94('0x82')](_0x499da1)['compact']()[_0x7d94('0x83')]();return db[_0x7d94('0x32')][_0x7d94('0x4e')]({'where':{'id':_0x3270be[_0x7d94('0x4d')]['id']}})[_0x7d94('0x2a')](function(_0x4b348c){return db['sequelize'][_0x7d94('0x71')](function(_0x35502a){return _0x4b348c['removeTeams'](_0x3270be['query'][_0x7d94('0x6b')],{'transaction':_0x35502a})[_0x7d94('0x2a')](function(){if(!_[_0x7d94('0x84')](_0x2afc5a)){return _0x4b348c['removeAgents'](_0x2afc5a,{'transaction':_0x35502a});}})[_0x7d94('0x2a')](function(){_0x2afc5a[_0x7d94('0x74')](function(_0x1175e2){socket['emit'](_0x7d94('0x85'),{'UserId':_0x1175e2,'FaxQueueId':_0x4b348c['id']});});});});});});})[_0x7d94('0x2a')](respondWithStatusCode(_0x5b90f6,null))[_0x7d94('0x4b')](handleError(_0x5b90f6,null));};exports[_0x7d94('0x86')]=function(_0x2f9efc,_0x17fdf8,_0x15cf9d){return db[_0x7d94('0x32')][_0x7d94('0x4e')]({'where':{'id':_0x2f9efc[_0x7d94('0x4d')]['id']}})[_0x7d94('0x2a')](handleEntityNotFound(_0x17fdf8,null))[_0x7d94('0x2a')](function(_0x36c007){if(_0x36c007){return _0x36c007[_0x7d94('0x86')](_0x2f9efc[_0x7d94('0x56')][_0x7d94('0x6b')],_[_0x7d94('0x87')](_0x2f9efc[_0x7d94('0x56')],['ids','id'])||{})[_0x7d94('0x88')](function(_0xd6fd4){for(var _0x16f4e7=0x0;_0x16f4e7<_0x2f9efc[_0x7d94('0x56')][_0x7d94('0x6b')][_0x7d94('0x3e')];_0x16f4e7+=0x1){socket[_0x7d94('0x89')](_0x7d94('0x75'),{'UserId':_0x2f9efc['body']['ids'][_0x16f4e7],'FaxQueueId':_0x2f9efc[_0x7d94('0x4d')]['id']});}return _0xd6fd4;});}})[_0x7d94('0x2a')](respondWithResult(_0x17fdf8,null))['catch'](handleError(_0x17fdf8,null));};exports[_0x7d94('0x8a')]=function(_0x18514e,_0x66f88a,_0x114905){return db[_0x7d94('0x32')]['find']({'where':{'id':_0x18514e[_0x7d94('0x4d')]['id']}})['then'](handleEntityNotFound(_0x66f88a,null))[_0x7d94('0x2a')](function(_0x59772f){if(_0x59772f){return _0x59772f['removeAgents'](_0x18514e['query'][_0x7d94('0x6b')])[_0x7d94('0x2a')](function(){if(_[_0x7d94('0x8b')](_0x18514e[_0x7d94('0x38')]['ids'])){for(var _0x29d66c=0x0;_0x29d66c<_0x18514e[_0x7d94('0x38')][_0x7d94('0x6b')][_0x7d94('0x3e')];_0x29d66c+=0x1){socket[_0x7d94('0x89')](_0x7d94('0x85'),{'UserId':Number(_0x18514e[_0x7d94('0x38')][_0x7d94('0x6b')][_0x29d66c]),'FaxQueueId':Number(_0x18514e['params']['id'])});}}else{socket[_0x7d94('0x89')]('userFaxQueue:remove',{'UserId':Number(_0x18514e['query'][_0x7d94('0x6b')]),'FaxQueueId':Number(_0x18514e[_0x7d94('0x4d')]['id'])});}});}})[_0x7d94('0x2a')](respondWithStatusCode(_0x66f88a,null))[_0x7d94('0x4b')](handleError(_0x66f88a,null));};exports['getAgents']=function(_0x55a0d5,_0x495ae8,_0x44fd73){var _0x23f33b={};var _0x3f174f={};var _0x367039;var _0x507689;return db[_0x7d94('0x32')][_0x7d94('0x59')]({'where':{'id':_0x55a0d5[_0x7d94('0x4d')]['id']}})[_0x7d94('0x2a')](handleEntityNotFound(_0x495ae8,null))[_0x7d94('0x2a')](function(_0x376f97){if(_0x376f97){_0x367039=_0x376f97;_0x3f174f[_0x7d94('0x36')]=_['keys'](db[_0x7d94('0x5e')][_0x7d94('0x33')]);_0x3f174f['query']=_[_0x7d94('0x39')](_0x55a0d5[_0x7d94('0x38')]);_0x3f174f[_0x7d94('0x3a')]=_[_0x7d94('0x3c')](_0x3f174f[_0x7d94('0x36')],_0x3f174f['query']);_0x23f33b[_0x7d94('0x3b')]=_[_0x7d94('0x3c')](_0x3f174f[_0x7d94('0x36')],qs[_0x7d94('0x3d')](_0x55a0d5['query'][_0x7d94('0x3d')]));_0x23f33b[_0x7d94('0x3b')]=_0x23f33b[_0x7d94('0x3b')]['length']?_0x23f33b['attributes']:_0x3f174f[_0x7d94('0x36')];_0x23f33b[_0x7d94('0x40')]=qs[_0x7d94('0x41')](_0x55a0d5[_0x7d94('0x38')][_0x7d94('0x41')]);_0x23f33b[_0x7d94('0x42')]=qs[_0x7d94('0x3a')](_[_0x7d94('0x43')](_0x55a0d5[_0x7d94('0x38')],_0x3f174f['filters']));if(_0x55a0d5[_0x7d94('0x38')]['filter']){_0x23f33b[_0x7d94('0x42')]=_['merge'](_0x23f33b[_0x7d94('0x42')],{'$or':_[_0x7d94('0x37')](_0x23f33b[_0x7d94('0x3b')],function(_0xb7df24){var _0x3d5789={};_0x3d5789[_0xb7df24]={'$like':'%'+_0x55a0d5['query'][_0x7d94('0x44')]+'%'};return _0x3d5789;})});}_0x23f33b=_[_0x7d94('0x45')]({},_0x23f33b,_0x55a0d5['options']);return _0x367039['getAgents'](_0x23f33b);}})[_0x7d94('0x2a')](function(_0xe8fc47){if(_0xe8fc47){_0x507689=_0xe8fc47['length'];if(!_0x55a0d5[_0x7d94('0x38')][_0x7d94('0x5b')](_0x7d94('0x3f'))){_0x23f33b['limit']=qs[_0x7d94('0x23')](_0x55a0d5[_0x7d94('0x38')][_0x7d94('0x23')]);_0x23f33b[_0x7d94('0x21')]=qs[_0x7d94('0x21')](_0x55a0d5['query']['offset']);}return _0x367039[_0x7d94('0x8c')](_0x23f33b);}})['then'](function(_0x18642f){if(_0x18642f){return _0x18642f?{'count':_0x507689,'rows':_0x18642f}:null;}})['then'](respondWithResult(_0x495ae8,null))[_0x7d94('0x4b')](handleError(_0x495ae8,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 55601c0..736136a 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 _0x0e18=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxQueue','save'];(function(_0x307ba9,_0x55cb03){var _0x198dcb=function(_0x4ec59c){while(--_0x4ec59c){_0x307ba9['push'](_0x307ba9['shift']());}};_0x198dcb(++_0x55cb03);}(_0x0e18,0x115));var _0x80e1=function(_0x2b68ca,_0x1eee15){_0x2b68ca=_0x2b68ca-0x0;var _0x3af483=_0x0e18[_0x2b68ca];return _0x3af483;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x80e1('0x0'))['db'][_0x80e1('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x80e1('0x2'),'afterUpdate':'update','afterDestroy':_0x80e1('0x3')};function emitEvent(_0x2c74f1){return function(_0x38faea,_0xce6cf1,_0xb28f8c){FaxQueueEvents[_0x80e1('0x4')](_0x2c74f1+':'+_0x38faea['id'],_0x38faea);FaxQueueEvents[_0x80e1('0x4')](_0x2c74f1,_0x38faea);_0xb28f8c(null);};}for(var e in events){if(events[_0x80e1('0x5')](e)){var event=events[e];FaxQueue[_0x80e1('0x6')](e,emitEvent(event));}}module[_0x80e1('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xeb15=['../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty','exports','events'];(function(_0x277289,_0x41f961){var _0x5d7735=function(_0x28926d){while(--_0x28926d){_0x277289['push'](_0x277289['shift']());}};_0x5d7735(++_0x41f961);}(_0xeb15,0x1ca));var _0x5eb1=function(_0x2a403a,_0x4ec334){_0x2a403a=_0x2a403a-0x0;var _0x3a0f0d=_0xeb15[_0x2a403a];return _0x3a0f0d;};'use strict';var EventEmitter=require(_0x5eb1('0x0'));var FaxQueue=require(_0x5eb1('0x1'))['db'][_0x5eb1('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x5eb1('0x3')](0x0);var events={'afterCreate':_0x5eb1('0x4'),'afterUpdate':_0x5eb1('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5603dc){return function(_0x3bc378,_0x40f47c,_0x381eb4){FaxQueueEvents[_0x5eb1('0x6')](_0x5603dc+':'+_0x3bc378['id'],_0x3bc378);FaxQueueEvents[_0x5eb1('0x6')](_0x5603dc,_0x3bc378);_0x381eb4(null);};}for(var e in events){if(events[_0x5eb1('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x5eb1('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 5a2d438..a77c989 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 _0xa329=['bluebird','request-promise','path','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash','util','../../config/logger','moment'];(function(_0x335111,_0x591ab1){var _0xddade4=function(_0x1edaaf){while(--_0x1edaaf){_0x335111['push'](_0x335111['shift']());}};_0xddade4(++_0x591ab1);}(_0xa329,0x134));var _0x9a32=function(_0xfa05ed,_0x488b68){_0xfa05ed=_0xfa05ed-0x0;var _0x1cf76d=_0xa329[_0xfa05ed];return _0x1cf76d;};'use strict';var _=require(_0x9a32('0x0'));var util=require(_0x9a32('0x1'));var logger=require(_0x9a32('0x2'))('api');var moment=require(_0x9a32('0x3'));var BPromise=require(_0x9a32('0x4'));var rp=require(_0x9a32('0x5'));var fs=require('fs');var path=require(_0x9a32('0x6'));var rimraf=require('rimraf');var config=require(_0x9a32('0x7'));var attributes=require(_0x9a32('0x8'));module[_0x9a32('0x9')]=function(_0x1659b2,_0x203188){return _0x1659b2[_0x9a32('0xa')]('FaxQueue',attributes,{'tableName':_0x9a32('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b6b=['path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash','../../config/logger','bluebird','request-promise'];(function(_0x1b9d9f,_0x4162a7){var _0x3ad4e6=function(_0x1af759){while(--_0x1af759){_0x1b9d9f['push'](_0x1b9d9f['shift']());}};_0x3ad4e6(++_0x4162a7);}(_0x5b6b,0x17d));var _0xb5b6=function(_0x987255,_0x5c6354){_0x987255=_0x987255-0x0;var _0x1ed652=_0x5b6b[_0x987255];return _0x1ed652;};'use strict';var _=require(_0xb5b6('0x0'));var util=require('util');var logger=require(_0xb5b6('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb5b6('0x2'));var rp=require(_0xb5b6('0x3'));var fs=require('fs');var path=require(_0xb5b6('0x4'));var rimraf=require(_0xb5b6('0x5'));var config=require(_0xb5b6('0x6'));var attributes=require(_0xb5b6('0x7'));module[_0xb5b6('0x8')]=function(_0x5b3e73,_0x123ba3){return _0x5b3e73[_0xb5b6('0x9')]('FaxQueue',attributes,{'tableName':_0xb5b6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 627cac1..2fbc61c 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 _0x1ac8=['request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','lodash','util','moment','bluebird','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s'];(function(_0x50d648,_0x9e9924){var _0x595c81=function(_0x219702){while(--_0x219702){_0x50d648['push'](_0x50d648['shift']());}};_0x595c81(++_0x9e9924);}(_0x1ac8,0x158));var _0x81ac=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1ac8[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x81ac('0x0'));var util=require(_0x81ac('0x1'));var moment=require(_0x81ac('0x2'));var BPromise=require(_0x81ac('0x3'));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(_0x81ac('0x4'))('rpc');var config=require(_0x81ac('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x81ac('0x6')][_0x81ac('0x7')]({'port':0x232a});config[_0x81ac('0x8')]=_['defaults'](config[_0x81ac('0x8')],{'host':_0x81ac('0x9'),'port':0x18eb});var socket=require(_0x81ac('0xa'))(new Redis(config[_0x81ac('0x8')]));require(_0x81ac('0xb'))[_0x81ac('0xc')](socket);function respondWithRpcPromise(_0x2cdd3d,_0x4f4f49,_0x12b439){return new BPromise(function(_0x2efb1c,_0x316713){return client['request'](_0x2cdd3d,_0x12b439)[_0x81ac('0xd')](function(_0x4c9d67){logger[_0x81ac('0xe')](_0x81ac('0xf'),_0x4f4f49,_0x81ac('0x10'));logger[_0x81ac('0x11')](_0x81ac('0x12'),_0x4f4f49,_0x81ac('0x10'),JSON[_0x81ac('0x13')](_0x4c9d67));if(_0x4c9d67[_0x81ac('0x14')]){if(_0x4c9d67[_0x81ac('0x14')][_0x81ac('0x15')]===0x1f4){logger[_0x81ac('0x14')](_0x81ac('0xf'),_0x4f4f49,_0x4c9d67['error'][_0x81ac('0x16')]);return _0x316713(_0x4c9d67[_0x81ac('0x14')][_0x81ac('0x16')]);}logger[_0x81ac('0x14')](_0x81ac('0xf'),_0x4f4f49,_0x4c9d67[_0x81ac('0x14')][_0x81ac('0x16')]);return _0x2efb1c(_0x4c9d67[_0x81ac('0x14')][_0x81ac('0x16')]);}else{logger[_0x81ac('0xe')](_0x81ac('0xf'),_0x4f4f49,'request\x20sent');_0x2efb1c(_0x4c9d67[_0x81ac('0x17')]['message']);}})[_0x81ac('0x18')](function(_0x2b2bc1){logger[_0x81ac('0x14')](_0x81ac('0xf'),_0x4f4f49,_0x2b2bc1);_0x316713(_0x2b2bc1);});});}exports[_0x81ac('0x19')]=function(_0x33045a){var _0xa044d7=this;return new Promise(function(_0x2f69b2,_0x222bbd){return db[_0x81ac('0x1a')]['findAll']({'raw':_0x33045a[_0x81ac('0x1b')]?_0x33045a[_0x81ac('0x1b')][_0x81ac('0x1c')]===undefined?!![]:![]:!![],'where':_0x33045a[_0x81ac('0x1b')]?_0x33045a[_0x81ac('0x1b')][_0x81ac('0x1d')]||null:null,'attributes':_0x33045a[_0x81ac('0x1b')]?_0x33045a['options'][_0x81ac('0x1e')]||null:null,'limit':_0x33045a[_0x81ac('0x1b')]?_0x33045a['options'][_0x81ac('0x1f')]||null:null,'include':_0x33045a[_0x81ac('0x1b')]?_0x33045a[_0x81ac('0x1b')][_0x81ac('0x20')]?_[_0x81ac('0x21')](_0x33045a[_0x81ac('0x1b')][_0x81ac('0x20')],function(_0x58ec2d){return{'model':db[_0x58ec2d[_0x81ac('0x22')]],'as':_0x58ec2d['as'],'attributes':_0x58ec2d[_0x81ac('0x1e')],'include':_0x58ec2d[_0x81ac('0x20')]?_[_0x81ac('0x21')](_0x58ec2d[_0x81ac('0x20')],function(_0xd3c249){return{'model':db[_0xd3c249['model']],'as':_0xd3c249['as'],'attributes':_0xd3c249[_0x81ac('0x1e')],'include':_0xd3c249[_0x81ac('0x20')]?_['map'](_0xd3c249[_0x81ac('0x20')],function(_0x9a2d16){return{'model':db[_0x9a2d16[_0x81ac('0x22')]],'as':_0x9a2d16['as'],'attributes':_0x9a2d16['attributes']};}):[]};}):[]};}):[]:[]})[_0x81ac('0xd')](function(_0x3da6cb){logger[_0x81ac('0xe')](_0x81ac('0x19'),_0x33045a);logger[_0x81ac('0x11')](_0x81ac('0x19'),_0x33045a,JSON['stringify'](_0x3da6cb));_0x2f69b2(_0x3da6cb);})[_0x81ac('0x18')](function(_0x35185c){logger[_0x81ac('0x14')](_0x81ac('0x19'),_0x35185c[_0x81ac('0x16')],_0x33045a);_0x222bbd(_0xa044d7[_0x81ac('0x14')](0x1f4,_0x35185c[_0x81ac('0x16')]));});});};exports[_0x81ac('0x23')]=function(_0x3ee578){var _0x51af75=this;return new Promise(function(_0x547388,_0x21c193){return db['FaxQueue']['find']({'raw':_0x3ee578[_0x81ac('0x1b')]?_0x3ee578[_0x81ac('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3ee578[_0x81ac('0x1b')]?_0x3ee578[_0x81ac('0x1b')][_0x81ac('0x1d')]||null:null,'attributes':_0x3ee578[_0x81ac('0x1b')]?_0x3ee578['options']['attributes']||null:null,'include':_0x3ee578[_0x81ac('0x1b')]?_0x3ee578[_0x81ac('0x1b')][_0x81ac('0x20')]?_[_0x81ac('0x21')](_0x3ee578[_0x81ac('0x1b')][_0x81ac('0x20')],function(_0x21fe39){return{'model':db[_0x21fe39['model']],'as':_0x21fe39['as'],'attributes':_0x21fe39[_0x81ac('0x1e')],'include':_0x21fe39['include']?_['map'](_0x21fe39[_0x81ac('0x20')],function(_0x907229){return{'model':db[_0x907229[_0x81ac('0x22')]],'as':_0x907229['as'],'attributes':_0x907229[_0x81ac('0x1e')],'include':_0x907229['include']?_[_0x81ac('0x21')](_0x907229[_0x81ac('0x20')],function(_0x7ecd33){return{'model':db[_0x7ecd33['model']],'as':_0x7ecd33['as'],'attributes':_0x7ecd33['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x14aa5a){logger[_0x81ac('0xe')](_0x81ac('0x23'),_0x3ee578);logger[_0x81ac('0x11')]('ShowFaxQueue',_0x3ee578,JSON['stringify'](_0x14aa5a));_0x547388(_0x14aa5a);})[_0x81ac('0x18')](function(_0x5001e4){logger[_0x81ac('0x14')](_0x81ac('0x23'),_0x5001e4['message'],_0x3ee578);_0x21c193(_0x51af75[_0x81ac('0x14')](0x1f4,_0x5001e4[_0x81ac('0x16')]));});});}; \ No newline at end of file +var _0xad67=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FaxQueue','options','raw','where','limit','map','include','model','attributes','GetFaxQueue','debug','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring'];(function(_0x258570,_0x2f30ef){var _0x483bc3=function(_0x4a1a7b){while(--_0x4a1a7b){_0x258570['push'](_0x258570['shift']());}};_0x483bc3(++_0x2f30ef);}(_0xad67,0x73));var _0x7ad6=function(_0x5f55b5,_0x372ef9){_0x5f55b5=_0x5f55b5-0x0;var _0x489ba1=_0xad67[_0x5f55b5];return _0x489ba1;};'use strict';var _=require(_0x7ad6('0x0'));var util=require(_0x7ad6('0x1'));var moment=require(_0x7ad6('0x2'));var BPromise=require(_0x7ad6('0x3'));var rs=require(_0x7ad6('0x4'));var fs=require('fs');var Redis=require(_0x7ad6('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7ad6('0x6'))(_0x7ad6('0x7'));var config=require(_0x7ad6('0x8'));var jayson=require(_0x7ad6('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x7ad6('0xa')]=_[_0x7ad6('0xb')](config[_0x7ad6('0xa')],{'host':_0x7ad6('0xc'),'port':0x18eb});var socket=require(_0x7ad6('0xd'))(new Redis(config['redis']));require(_0x7ad6('0xe'))[_0x7ad6('0xf')](socket);function respondWithRpcPromise(_0x16d8d2,_0x5d92d0,_0x345b12){return new BPromise(function(_0x2a0ac1,_0x52537f){return client[_0x7ad6('0x10')](_0x16d8d2,_0x345b12)[_0x7ad6('0x11')](function(_0x590415){logger[_0x7ad6('0x12')](_0x7ad6('0x13'),_0x5d92d0,_0x7ad6('0x14'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x5d92d0,'request\x20sent',JSON[_0x7ad6('0x15')](_0x590415));if(_0x590415[_0x7ad6('0x16')]){if(_0x590415['error'][_0x7ad6('0x17')]===0x1f4){logger[_0x7ad6('0x16')]('FaxQueue,\x20%s,\x20%s',_0x5d92d0,_0x590415[_0x7ad6('0x16')]['message']);return _0x52537f(_0x590415[_0x7ad6('0x16')]['message']);}logger[_0x7ad6('0x16')](_0x7ad6('0x13'),_0x5d92d0,_0x590415[_0x7ad6('0x16')][_0x7ad6('0x18')]);return _0x2a0ac1(_0x590415[_0x7ad6('0x16')][_0x7ad6('0x18')]);}else{logger[_0x7ad6('0x12')]('FaxQueue,\x20%s,\x20%s',_0x5d92d0,'request\x20sent');_0x2a0ac1(_0x590415[_0x7ad6('0x19')]['message']);}})[_0x7ad6('0x1a')](function(_0x2ab540){logger['error'](_0x7ad6('0x13'),_0x5d92d0,_0x2ab540);_0x52537f(_0x2ab540);});});}exports['GetFaxQueue']=function(_0x1199cf){var _0x51d7b5=this;return new Promise(function(_0x14302e,_0x41066f){return db[_0x7ad6('0x1b')]['findAll']({'raw':_0x1199cf[_0x7ad6('0x1c')]?_0x1199cf[_0x7ad6('0x1c')][_0x7ad6('0x1d')]===undefined?!![]:![]:!![],'where':_0x1199cf[_0x7ad6('0x1c')]?_0x1199cf[_0x7ad6('0x1c')][_0x7ad6('0x1e')]||null:null,'attributes':_0x1199cf[_0x7ad6('0x1c')]?_0x1199cf[_0x7ad6('0x1c')]['attributes']||null:null,'limit':_0x1199cf[_0x7ad6('0x1c')]?_0x1199cf[_0x7ad6('0x1c')][_0x7ad6('0x1f')]||null:null,'include':_0x1199cf[_0x7ad6('0x1c')]?_0x1199cf['options']['include']?_[_0x7ad6('0x20')](_0x1199cf[_0x7ad6('0x1c')][_0x7ad6('0x21')],function(_0x12d394){return{'model':db[_0x12d394[_0x7ad6('0x22')]],'as':_0x12d394['as'],'attributes':_0x12d394[_0x7ad6('0x23')],'include':_0x12d394['include']?_['map'](_0x12d394[_0x7ad6('0x21')],function(_0x10b805){return{'model':db[_0x10b805[_0x7ad6('0x22')]],'as':_0x10b805['as'],'attributes':_0x10b805[_0x7ad6('0x23')],'include':_0x10b805[_0x7ad6('0x21')]?_[_0x7ad6('0x20')](_0x10b805['include'],function(_0x57dfac){return{'model':db[_0x57dfac['model']],'as':_0x57dfac['as'],'attributes':_0x57dfac[_0x7ad6('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7ad6('0x11')](function(_0x2d5eaa){logger[_0x7ad6('0x12')](_0x7ad6('0x24'),_0x1199cf);logger[_0x7ad6('0x25')](_0x7ad6('0x24'),_0x1199cf,JSON['stringify'](_0x2d5eaa));_0x14302e(_0x2d5eaa);})[_0x7ad6('0x1a')](function(_0x2a8595){logger['error'](_0x7ad6('0x24'),_0x2a8595[_0x7ad6('0x18')],_0x1199cf);_0x41066f(_0x51d7b5[_0x7ad6('0x16')](0x1f4,_0x2a8595[_0x7ad6('0x18')]));});});};exports[_0x7ad6('0x26')]=function(_0x33a789){var _0x4aaa94=this;return new Promise(function(_0xf9f7ae,_0x1fab48){return db[_0x7ad6('0x1b')][_0x7ad6('0x27')]({'raw':_0x33a789['options']?_0x33a789[_0x7ad6('0x1c')][_0x7ad6('0x1d')]===undefined?!![]:![]:!![],'where':_0x33a789[_0x7ad6('0x1c')]?_0x33a789[_0x7ad6('0x1c')]['where']||null:null,'attributes':_0x33a789[_0x7ad6('0x1c')]?_0x33a789['options'][_0x7ad6('0x23')]||null:null,'include':_0x33a789['options']?_0x33a789[_0x7ad6('0x1c')]['include']?_[_0x7ad6('0x20')](_0x33a789['options'][_0x7ad6('0x21')],function(_0xaaebe8){return{'model':db[_0xaaebe8['model']],'as':_0xaaebe8['as'],'attributes':_0xaaebe8[_0x7ad6('0x23')],'include':_0xaaebe8[_0x7ad6('0x21')]?_[_0x7ad6('0x20')](_0xaaebe8[_0x7ad6('0x21')],function(_0x283913){return{'model':db[_0x283913[_0x7ad6('0x22')]],'as':_0x283913['as'],'attributes':_0x283913[_0x7ad6('0x23')],'include':_0x283913[_0x7ad6('0x21')]?_[_0x7ad6('0x20')](_0x283913[_0x7ad6('0x21')],function(_0xa1948d){return{'model':db[_0xa1948d[_0x7ad6('0x22')]],'as':_0xa1948d['as'],'attributes':_0xa1948d[_0x7ad6('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7ad6('0x11')](function(_0x255475){logger[_0x7ad6('0x12')](_0x7ad6('0x26'),_0x33a789);logger['debug']('ShowFaxQueue',_0x33a789,JSON[_0x7ad6('0x15')](_0x255475));_0xf9f7ae(_0x255475);})['catch'](function(_0x5e70df){logger[_0x7ad6('0x16')](_0x7ad6('0x26'),_0x5e70df[_0x7ad6('0x18')],_0x33a789);_0x1fab48(_0x4aaa94[_0x7ad6('0x16')](0x1f4,_0x5e70df[_0x7ad6('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index b876070..0c5c2d2 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 _0x0dd6=['./faxQueue.events','remove','update','emit','removeListener','register','faxQueue:'];(function(_0x2df3b5,_0x18fd71){var _0xc0cc9d=function(_0x24b19a){while(--_0x24b19a){_0x2df3b5['push'](_0x2df3b5['shift']());}};_0xc0cc9d(++_0x18fd71);}(_0x0dd6,0x196));var _0x60dd=function(_0x1f83ac,_0x8016fc){_0x1f83ac=_0x1f83ac-0x0;var _0x1985de=_0x0dd6[_0x1f83ac];return _0x1985de;};'use strict';var FaxQueueEvents=require(_0x60dd('0x0'));var events=['save',_0x60dd('0x1'),_0x60dd('0x2')];function createListener(_0x341484,_0x11675c){return function(_0x486b7e){_0x11675c[_0x60dd('0x3')](_0x341484,_0x486b7e);};}function removeListener(_0x4f22d3,_0x369b7d){return function(){FaxQueueEvents[_0x60dd('0x4')](_0x4f22d3,_0x369b7d);};}exports[_0x60dd('0x5')]=function(_0x1b28ea){for(var _0x4ebb18=0x0,_0x581ae7=events['length'];_0x4ebb18<_0x581ae7;_0x4ebb18++){var _0x59eb27=events[_0x4ebb18];var _0x1b2136=createListener(_0x60dd('0x6')+_0x59eb27,_0x1b28ea);FaxQueueEvents['on'](_0x59eb27,_0x1b2136);}}; \ No newline at end of file +var _0x2b59=['register','length','./faxQueue.events','save','remove','emit','removeListener'];(function(_0x65056f,_0x288376){var _0x3ed4bf=function(_0x3b3928){while(--_0x3b3928){_0x65056f['push'](_0x65056f['shift']());}};_0x3ed4bf(++_0x288376);}(_0x2b59,0x1d0));var _0x92b5=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2b59[_0x3ab51d];return _0x29a04e;};'use strict';var FaxQueueEvents=require(_0x92b5('0x0'));var events=[_0x92b5('0x1'),_0x92b5('0x2'),'update'];function createListener(_0x209602,_0xe40ee1){return function(_0x8828b2){_0xe40ee1[_0x92b5('0x3')](_0x209602,_0x8828b2);};}function removeListener(_0x287736,_0x117830){return function(){FaxQueueEvents[_0x92b5('0x4')](_0x287736,_0x117830);};}exports[_0x92b5('0x5')]=function(_0x18f33a){for(var _0x18b7f7=0x0,_0x50d588=events[_0x92b5('0x6')];_0x18b7f7<_0x50d588;_0x18b7f7++){var _0x9c41c4=events[_0x18b7f7];var _0x1d9af2=createListener('faxQueue:'+_0x9c41c4,_0x18f33a);FaxQueueEvents['on'](_0x9c41c4,_0x1d9af2);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 2253bab..8bd9b7b 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 _0x5561=['index','get','/describe','describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','isAuthenticated'];(function(_0x4b3e23,_0x1649b3){var _0x5dac4f=function(_0x413295){while(--_0x413295){_0x4b3e23['push'](_0x4b3e23['shift']());}};_0x5dac4f(++_0x1649b3);}(_0x5561,0x173));var _0x1556=function(_0x4312c9,_0x42c3e0){_0x4312c9=_0x4312c9-0x0;var _0x342373=_0x5561[_0x4312c9];return _0x342373;};'use strict';var multer=require(_0x1556('0x0'));var util=require(_0x1556('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1556('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x1556('0x3'));var config=require(_0x1556('0x4'));var controller=require(_0x1556('0x5'));router['get']('/',auth[_0x1556('0x6')](),controller[_0x1556('0x7')]);router[_0x1556('0x8')](_0x1556('0x9'),auth[_0x1556('0x6')](),controller[_0x1556('0xa')]);router['get'](_0x1556('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1556('0x8')]('/:id/members',auth[_0x1556('0x6')](),controller[_0x1556('0xc')]);router[_0x1556('0x8')](_0x1556('0xd'),auth[_0x1556('0x6')](),controller[_0x1556('0xe')]);router[_0x1556('0x8')](_0x1556('0xf'),auth[_0x1556('0x6')](),controller[_0x1556('0x10')]);router[_0x1556('0x11')]('/',auth[_0x1556('0x6')](),controller[_0x1556('0x12')]);router[_0x1556('0x11')]('/:id/teams',auth[_0x1556('0x6')](),controller[_0x1556('0x13')]);router[_0x1556('0x11')](_0x1556('0xf'),auth['isAuthenticated'](),controller['addAgents']);router[_0x1556('0x14')]('/:id',auth[_0x1556('0x6')](),controller[_0x1556('0x15')]);router[_0x1556('0x16')]('/:id',auth[_0x1556('0x6')](),controller[_0x1556('0x17')]);router['delete'](_0x1556('0xd'),auth[_0x1556('0x6')](),controller[_0x1556('0x18')]);router[_0x1556('0x16')](_0x1556('0xf'),auth['isAuthenticated'](),controller[_0x1556('0x19')]);module[_0x1556('0x1a')]=router; \ No newline at end of file +var _0x97c4=['isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','post','create','addTeams','/:id/users','addAgents','put','update','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','get'];(function(_0x299ac8,_0x1ae81d){var _0xd36727=function(_0x4b7d46){while(--_0x4b7d46){_0x299ac8['push'](_0x299ac8['shift']());}};_0xd36727(++_0x1ae81d);}(_0x97c4,0x6e));var _0x497c=function(_0x6888b8,_0x24e37b){_0x6888b8=_0x6888b8-0x0;var _0x51d86d=_0x97c4[_0x6888b8];return _0x51d86d;};'use strict';var multer=require(_0x497c('0x0'));var util=require(_0x497c('0x1'));var path=require(_0x497c('0x2'));var timeout=require('connect-timeout');var express=require(_0x497c('0x3'));var router=express[_0x497c('0x4')]();var fs_extra=require(_0x497c('0x5'));var auth=require(_0x497c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x497c('0x7'));var controller=require(_0x497c('0x8'));router[_0x497c('0x9')]('/',auth[_0x497c('0xa')](),controller[_0x497c('0xb')]);router[_0x497c('0x9')](_0x497c('0xc'),auth[_0x497c('0xa')](),controller[_0x497c('0xd')]);router[_0x497c('0x9')](_0x497c('0xe'),auth[_0x497c('0xa')](),controller[_0x497c('0xf')]);router['get'](_0x497c('0x10'),auth['isAuthenticated'](),controller[_0x497c('0x11')]);router['get'](_0x497c('0x12'),auth[_0x497c('0xa')](),controller['getTeams']);router[_0x497c('0x9')]('/:id/users',auth[_0x497c('0xa')](),controller['getAgents']);router[_0x497c('0x13')]('/',auth['isAuthenticated'](),controller[_0x497c('0x14')]);router[_0x497c('0x13')]('/:id/teams',auth[_0x497c('0xa')](),controller[_0x497c('0x15')]);router[_0x497c('0x13')](_0x497c('0x16'),auth[_0x497c('0xa')](),controller[_0x497c('0x17')]);router[_0x497c('0x18')](_0x497c('0xe'),auth['isAuthenticated'](),controller[_0x497c('0x19')]);router['delete'](_0x497c('0xe'),auth[_0x497c('0xa')](),controller[_0x497c('0x1a')]);router['delete'](_0x497c('0x12'),auth[_0x497c('0xa')](),controller[_0x497c('0x1b')]);router['delete'](_0x497c('0x16'),auth[_0x497c('0xa')](),controller[_0x497c('0x1c')]);module[_0x497c('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index d31b150..8ca0274 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 _0x3abe=['STRING','DATE','moment','exports'];(function(_0x31de89,_0x14ce92){var _0x2c2ad0=function(_0xbec64e){while(--_0xbec64e){_0x31de89['push'](_0x31de89['shift']());}};_0x2c2ad0(++_0x14ce92);}(_0x3abe,0xc2));var _0xe3ab=function(_0x4ec3f2,_0x23cf5e){_0x4ec3f2=_0x4ec3f2-0x0;var _0x311575=_0x3abe[_0x4ec3f2];return _0x311575;};'use strict';var moment=require(_0xe3ab('0x0'));var Sequelize=require('sequelize');module[_0xe3ab('0x1')]={'uniqueid':{'type':Sequelize[_0xe3ab('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xe3ab('0x3')]},'leaveAt':{'type':Sequelize[_0xe3ab('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xe3ab('0x2')]}}; \ No newline at end of file +var _0xc216=['DATE','moment','sequelize','exports','STRING'];(function(_0x4491dd,_0x21d8aa){var _0x15abe3=function(_0x41245f){while(--_0x41245f){_0x4491dd['push'](_0x4491dd['shift']());}};_0x15abe3(++_0x21d8aa);}(_0xc216,0x1b9));var _0x6c21=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0xc216[_0x43d16c];return _0x208cce;};'use strict';var moment=require(_0x6c21('0x0'));var Sequelize=require(_0x6c21('0x1'));module[_0x6c21('0x2')]={'uniqueid':{'type':Sequelize[_0x6c21('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x6c21('0x3')]},'joinAt':{'type':Sequelize[_0x6c21('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x6c21('0x4')]},'exitAt':{'type':Sequelize[_0x6c21('0x4')]},'reason':{'type':Sequelize[_0x6c21('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 3bf8922..a8a9d03 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 _0x4cbc=['findAll','rows','catch','show','params','rawAttributes','keys','length','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','FaxQueueReport','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','include'];(function(_0x154940,_0x4a448a){var _0x401409=function(_0x45cdcf){while(--_0x45cdcf){_0x154940['push'](_0x154940['shift']());}};_0x401409(++_0x4a448a);}(_0x4cbc,0x1cf));var _0xc4cb=function(_0x1bd845,_0x567d93){_0x1bd845=_0x1bd845-0x0;var _0x2257b3=_0x4cbc[_0x1bd845];return _0x2257b3;};'use strict';var emlformat=require(_0xc4cb('0x0'));var rimraf=require(_0xc4cb('0x1'));var zipdir=require(_0xc4cb('0x2'));var jsonpatch=require(_0xc4cb('0x3'));var rp=require(_0xc4cb('0x4'));var moment=require(_0xc4cb('0x5'));var BPromise=require(_0xc4cb('0x6'));var Mustache=require(_0xc4cb('0x7'));var util=require(_0xc4cb('0x8'));var path=require(_0xc4cb('0x9'));var sox=require(_0xc4cb('0xa'));var csv=require(_0xc4cb('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc4cb('0xc'));var _=require('lodash');var squel=require(_0xc4cb('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc4cb('0xe'));var toCsv=require(_0xc4cb('0xb'));var querystring=require('querystring');var Papa=require(_0xc4cb('0xf'));var Redis=require(_0xc4cb('0x10'));var authService=require(_0xc4cb('0x11'));var qs=require(_0xc4cb('0x12'));var as=require(_0xc4cb('0x13'));var hardwareService=require(_0xc4cb('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xc4cb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc4cb('0x16'));var db=require(_0xc4cb('0x17'))['db'];function respondWithStatusCode(_0x59603f,_0x2eff6d){_0x2eff6d=_0x2eff6d||0xcc;return function(_0x6c7ffd){if(_0x6c7ffd){return _0x59603f[_0xc4cb('0x18')](_0x2eff6d);}return _0x59603f[_0xc4cb('0x19')](_0x2eff6d)[_0xc4cb('0x1a')]();};}function respondWithResult(_0x5b04a7,_0x1e5bb9){_0x1e5bb9=_0x1e5bb9||0xc8;return function(_0x2b9185){if(_0x2b9185){return _0x5b04a7[_0xc4cb('0x19')](_0x1e5bb9)[_0xc4cb('0x1b')](_0x2b9185);}};}function respondWithFilteredResult(_0x5aa2a1,_0x21d2c1){return function(_0x31feef){if(_0x31feef){var _0x1860d3=typeof _0x21d2c1[_0xc4cb('0x1c')]===_0xc4cb('0x1d')&&typeof _0x21d2c1['limit']===_0xc4cb('0x1d');var _0x2cfa7d=_0x31feef[_0xc4cb('0x1e')];var _0x11ca22=_0x1860d3?0x0:_0x21d2c1['offset'];var _0x149d3d=_0x1860d3?_0x31feef[_0xc4cb('0x1e')]:_0x21d2c1[_0xc4cb('0x1c')]+_0x21d2c1[_0xc4cb('0x1f')];var _0xa0a35;if(_0x149d3d>=_0x2cfa7d){_0x149d3d=_0x2cfa7d;_0xa0a35=0xc8;}else{_0xa0a35=0xce;}_0x5aa2a1['status'](_0xa0a35);return _0x5aa2a1['set'](_0xc4cb('0x20'),_0x11ca22+'-'+_0x149d3d+'/'+_0x2cfa7d)[_0xc4cb('0x1b')](_0x31feef);}return null;};}function patchUpdates(_0x4dd97b){return function(_0x4b0007){try{jsonpatch['apply'](_0x4b0007,_0x4dd97b,!![]);}catch(_0x1289ee){return BPromise[_0xc4cb('0x21')](_0x1289ee);}return _0x4b0007[_0xc4cb('0x22')]();};}function saveUpdates(_0x574e68,_0x14482a){return function(_0x5b16ac){if(_0x5b16ac){return _0x5b16ac[_0xc4cb('0x23')](_0x574e68)[_0xc4cb('0x24')](function(_0x5a4687){return _0x5a4687;});}return null;};}function removeEntity(_0x4ae1de,_0x3b4710){return function(_0x2715fa){if(_0x2715fa){return _0x2715fa[_0xc4cb('0x25')]()['then'](function(){_0x4ae1de['status'](0xcc)[_0xc4cb('0x1a')]();});}};}function handleEntityNotFound(_0x10b42a,_0x179ea0){return function(_0x301666){if(!_0x301666){_0x10b42a[_0xc4cb('0x18')](0x194);}return _0x301666;};}function handleError(_0x395bee,_0xb51fdf){_0xb51fdf=_0xb51fdf||0x1f4;return function(_0x1b3305){logger[_0xc4cb('0x26')](_0x1b3305[_0xc4cb('0x27')]);if(_0x1b3305[_0xc4cb('0x28')]){delete _0x1b3305['name'];}_0x395bee['status'](_0xb51fdf)[_0xc4cb('0x29')](_0x1b3305);};}exports['index']=function(_0x3ea5fd,_0x525db4){var _0x6ca0f6={},_0x287b9f={},_0x419ad0={'count':0x0,'rows':[]};var _0x299d2c=_[_0xc4cb('0x2a')](db[_0xc4cb('0x2b')]['rawAttributes'],function(_0x531d1b){return{'name':_0x531d1b['fieldName'],'type':_0x531d1b[_0xc4cb('0x2c')][_0xc4cb('0x2d')]};});_0x287b9f[_0xc4cb('0x2e')]=_['map'](_0x299d2c,_0xc4cb('0x28'));_0x287b9f['query']=_['keys'](_0x3ea5fd[_0xc4cb('0x2f')]);_0x287b9f[_0xc4cb('0x30')]=_[_0xc4cb('0x31')](_0x287b9f[_0xc4cb('0x2e')],_0x287b9f[_0xc4cb('0x2f')]);_0x6ca0f6[_0xc4cb('0x32')]=_[_0xc4cb('0x31')](_0x287b9f[_0xc4cb('0x2e')],qs[_0xc4cb('0x33')](_0x3ea5fd[_0xc4cb('0x2f')][_0xc4cb('0x33')]));_0x6ca0f6['attributes']=_0x6ca0f6[_0xc4cb('0x32')]['length']?_0x6ca0f6[_0xc4cb('0x32')]:_0x287b9f[_0xc4cb('0x2e')];if(!_0x3ea5fd[_0xc4cb('0x2f')][_0xc4cb('0x34')](_0xc4cb('0x35'))){_0x6ca0f6[_0xc4cb('0x1f')]=qs['limit'](_0x3ea5fd[_0xc4cb('0x2f')][_0xc4cb('0x1f')]);_0x6ca0f6['offset']=qs['offset'](_0x3ea5fd[_0xc4cb('0x2f')][_0xc4cb('0x1c')]);}_0x6ca0f6[_0xc4cb('0x36')]=qs['sort'](_0x3ea5fd[_0xc4cb('0x2f')]['sort']);_0x6ca0f6[_0xc4cb('0x37')]=qs[_0xc4cb('0x30')](_[_0xc4cb('0x38')](_0x3ea5fd[_0xc4cb('0x2f')],_0x287b9f['filters']),_0x299d2c);if(_0x3ea5fd[_0xc4cb('0x2f')][_0xc4cb('0x39')]){_0x6ca0f6[_0xc4cb('0x37')]=_['merge'](_0x6ca0f6[_0xc4cb('0x37')],{'$or':_[_0xc4cb('0x2a')](_0x299d2c,function(_0x4a4882){if(_0x4a4882['type']!==_0xc4cb('0x3a')){var _0x5d9a59={};_0x5d9a59[_0x4a4882['name']]={'$like':'%'+_0x3ea5fd[_0xc4cb('0x2f')]['filter']+'%'};return _0x5d9a59;}})});}_0x6ca0f6=_[_0xc4cb('0x3b')]({},_0x6ca0f6,_0x3ea5fd[_0xc4cb('0x3c')]);var _0x4f1c2e={'where':_0x6ca0f6[_0xc4cb('0x37')]};return db[_0xc4cb('0x2b')][_0xc4cb('0x1e')](_0x4f1c2e)[_0xc4cb('0x24')](function(_0x42dfcb){_0x419ad0['count']=_0x42dfcb;if(_0x3ea5fd[_0xc4cb('0x2f')]['includeAll']){_0x6ca0f6[_0xc4cb('0x3d')]=[{'all':!![]}];}return db[_0xc4cb('0x2b')][_0xc4cb('0x3e')](_0x6ca0f6);})[_0xc4cb('0x24')](function(_0x299f7d){_0x419ad0[_0xc4cb('0x3f')]=_0x299f7d;return _0x419ad0;})[_0xc4cb('0x24')](respondWithFilteredResult(_0x525db4,_0x6ca0f6))[_0xc4cb('0x40')](handleError(_0x525db4,null));};exports[_0xc4cb('0x41')]=function(_0x52689c,_0x4fbbcc){var _0x4fd927={'raw':!![],'where':{'id':_0x52689c[_0xc4cb('0x42')]['id']}},_0x3804bf={};_0x3804bf['model']=_['keys'](db[_0xc4cb('0x2b')][_0xc4cb('0x43')]);_0x3804bf[_0xc4cb('0x2f')]=_[_0xc4cb('0x44')](_0x52689c[_0xc4cb('0x2f')]);_0x3804bf[_0xc4cb('0x30')]=_[_0xc4cb('0x31')](_0x3804bf[_0xc4cb('0x2e')],_0x3804bf['query']);_0x4fd927[_0xc4cb('0x32')]=_[_0xc4cb('0x31')](_0x3804bf[_0xc4cb('0x2e')],qs[_0xc4cb('0x33')](_0x52689c['query'][_0xc4cb('0x33')]));_0x4fd927[_0xc4cb('0x32')]=_0x4fd927[_0xc4cb('0x32')][_0xc4cb('0x45')]?_0x4fd927[_0xc4cb('0x32')]:_0x3804bf[_0xc4cb('0x2e')];if(_0x52689c['query'][_0xc4cb('0x46')]){_0x4fd927['include']=[{'all':!![]}];}_0x4fd927=_[_0xc4cb('0x3b')]({},_0x4fd927,_0x52689c[_0xc4cb('0x3c')]);return db['FaxQueueReport'][_0xc4cb('0x47')](_0x4fd927)[_0xc4cb('0x24')](handleEntityNotFound(_0x4fbbcc,null))[_0xc4cb('0x24')](respondWithResult(_0x4fbbcc,null))[_0xc4cb('0x40')](handleError(_0x4fbbcc,null));};exports[_0xc4cb('0x48')]=function(_0x102d8a,_0x560c14){return db[_0xc4cb('0x2b')][_0xc4cb('0x48')](_0x102d8a['body'],{})[_0xc4cb('0x24')](respondWithResult(_0x560c14,0xc9))[_0xc4cb('0x40')](handleError(_0x560c14,null));};exports['update']=function(_0x591de3,_0x39e1d9){if(_0x591de3[_0xc4cb('0x49')]['id']){delete _0x591de3[_0xc4cb('0x49')]['id'];}return db[_0xc4cb('0x2b')]['find']({'where':{'id':_0x591de3[_0xc4cb('0x42')]['id']}})[_0xc4cb('0x24')](handleEntityNotFound(_0x39e1d9,null))[_0xc4cb('0x24')](saveUpdates(_0x591de3['body'],null))[_0xc4cb('0x24')](respondWithResult(_0x39e1d9,null))[_0xc4cb('0x40')](handleError(_0x39e1d9,null));};exports[_0xc4cb('0x25')]=function(_0x10358e,_0x745159){return db[_0xc4cb('0x2b')]['find']({'where':{'id':_0x10358e['params']['id']}})[_0xc4cb('0x24')](handleEntityNotFound(_0x745159,null))['then'](removeEntity(_0x745159,null))[_0xc4cb('0x40')](handleError(_0x745159,null));};exports[_0xc4cb('0x4a')]=function(_0x9c6e93,_0x481619){return db['FaxQueueReport']['describe']()['then'](respondWithResult(_0x481619,null))['catch'](handleError(_0x481619,null));}; \ No newline at end of file +var _0x9a8a=['squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','intersection','query','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','FaxQueueReport','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x28ec94,_0x7cb244){var _0x3bbb8e=function(_0x5288be){while(--_0x5288be){_0x28ec94['push'](_0x28ec94['shift']());}};_0x3bbb8e(++_0x7cb244);}(_0x9a8a,0x1d9));var _0xa9a8=function(_0x160b10,_0x36c9e3){_0x160b10=_0x160b10-0x0;var _0x5793af=_0x9a8a[_0x160b10];return _0x5793af;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa9a8('0x0'));var zipdir=require(_0xa9a8('0x1'));var jsonpatch=require(_0xa9a8('0x2'));var rp=require('request-promise');var moment=require(_0xa9a8('0x3'));var BPromise=require(_0xa9a8('0x4'));var Mustache=require(_0xa9a8('0x5'));var util=require(_0xa9a8('0x6'));var path=require(_0xa9a8('0x7'));var sox=require(_0xa9a8('0x8'));var csv=require(_0xa9a8('0x9'));var ejs=require(_0xa9a8('0xa'));var fs=require('fs');var fs_extra=require(_0xa9a8('0xb'));var _=require(_0xa9a8('0xc'));var squel=require(_0xa9a8('0xd'));var crypto=require(_0xa9a8('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa9a8('0xf'));var Papa=require(_0xa9a8('0x10'));var Redis=require(_0xa9a8('0x11'));var authService=require(_0xa9a8('0x12'));var qs=require(_0xa9a8('0x13'));var as=require(_0xa9a8('0x14'));var hardwareService=require(_0xa9a8('0x15'));var logger=require(_0xa9a8('0x16'))(_0xa9a8('0x17'));var utils=require(_0xa9a8('0x18'));var config=require(_0xa9a8('0x19'));var licenseUtil=require(_0xa9a8('0x1a'));var db=require(_0xa9a8('0x1b'))['db'];function respondWithStatusCode(_0x427452,_0xdfa7aa){_0xdfa7aa=_0xdfa7aa||0xcc;return function(_0xaff158){if(_0xaff158){return _0x427452[_0xa9a8('0x1c')](_0xdfa7aa);}return _0x427452['status'](_0xdfa7aa)[_0xa9a8('0x1d')]();};}function respondWithResult(_0x25c69f,_0x1af85d){_0x1af85d=_0x1af85d||0xc8;return function(_0x153a5d){if(_0x153a5d){return _0x25c69f[_0xa9a8('0x1e')](_0x1af85d)[_0xa9a8('0x1f')](_0x153a5d);}};}function respondWithFilteredResult(_0x2390c7,_0x233b36){return function(_0x4304f3){if(_0x4304f3){var _0x5dcfdf=typeof _0x233b36[_0xa9a8('0x20')]===_0xa9a8('0x21')&&typeof _0x233b36[_0xa9a8('0x22')]===_0xa9a8('0x21');var _0x8d173e=_0x4304f3['count'];var _0x4ba0bc=_0x5dcfdf?0x0:_0x233b36[_0xa9a8('0x20')];var _0x4dd1a4=_0x5dcfdf?_0x4304f3[_0xa9a8('0x23')]:_0x233b36[_0xa9a8('0x20')]+_0x233b36[_0xa9a8('0x22')];var _0x233a63;if(_0x4dd1a4>=_0x8d173e){_0x4dd1a4=_0x8d173e;_0x233a63=0xc8;}else{_0x233a63=0xce;}_0x2390c7['status'](_0x233a63);return _0x2390c7[_0xa9a8('0x24')](_0xa9a8('0x25'),_0x4ba0bc+'-'+_0x4dd1a4+'/'+_0x8d173e)['json'](_0x4304f3);}return null;};}function patchUpdates(_0x276db4){return function(_0x501f47){try{jsonpatch[_0xa9a8('0x26')](_0x501f47,_0x276db4,!![]);}catch(_0x15770c){return BPromise[_0xa9a8('0x27')](_0x15770c);}return _0x501f47[_0xa9a8('0x28')]();};}function saveUpdates(_0x270aeb,_0x40ffa2){return function(_0x5d53f0){if(_0x5d53f0){return _0x5d53f0[_0xa9a8('0x29')](_0x270aeb)['then'](function(_0x3f5ce1){return _0x3f5ce1;});}return null;};}function removeEntity(_0x1c865d,_0x4441be){return function(_0x90e240){if(_0x90e240){return _0x90e240[_0xa9a8('0x2a')]()[_0xa9a8('0x2b')](function(){_0x1c865d[_0xa9a8('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cd4ce,_0x4e9f77){return function(_0xd4b0ca){if(!_0xd4b0ca){_0x3cd4ce[_0xa9a8('0x1c')](0x194);}return _0xd4b0ca;};}function handleError(_0x53e3fb,_0x5d0a9e){_0x5d0a9e=_0x5d0a9e||0x1f4;return function(_0x2e6a9e){logger['error'](_0x2e6a9e[_0xa9a8('0x2c')]);if(_0x2e6a9e[_0xa9a8('0x2d')]){delete _0x2e6a9e['name'];}_0x53e3fb[_0xa9a8('0x1e')](_0x5d0a9e)[_0xa9a8('0x2e')](_0x2e6a9e);};}exports[_0xa9a8('0x2f')]=function(_0x1c9e0c,_0x215299){var _0x394561={},_0x1293d7={},_0x388396={'count':0x0,'rows':[]};var _0x50b1be=_['map'](db['FaxQueueReport'][_0xa9a8('0x30')],function(_0x32462f){return{'name':_0x32462f[_0xa9a8('0x31')],'type':_0x32462f[_0xa9a8('0x32')][_0xa9a8('0x33')]};});_0x1293d7[_0xa9a8('0x34')]=_[_0xa9a8('0x35')](_0x50b1be,_0xa9a8('0x2d'));_0x1293d7['query']=_[_0xa9a8('0x36')](_0x1c9e0c['query']);_0x1293d7['filters']=_[_0xa9a8('0x37')](_0x1293d7[_0xa9a8('0x34')],_0x1293d7[_0xa9a8('0x38')]);_0x394561['attributes']=_[_0xa9a8('0x37')](_0x1293d7['model'],qs[_0xa9a8('0x39')](_0x1c9e0c[_0xa9a8('0x38')][_0xa9a8('0x39')]));_0x394561['attributes']=_0x394561[_0xa9a8('0x3a')][_0xa9a8('0x3b')]?_0x394561['attributes']:_0x1293d7[_0xa9a8('0x34')];if(!_0x1c9e0c['query']['hasOwnProperty'](_0xa9a8('0x3c'))){_0x394561[_0xa9a8('0x22')]=qs[_0xa9a8('0x22')](_0x1c9e0c[_0xa9a8('0x38')][_0xa9a8('0x22')]);_0x394561[_0xa9a8('0x20')]=qs[_0xa9a8('0x20')](_0x1c9e0c[_0xa9a8('0x38')]['offset']);}_0x394561[_0xa9a8('0x3d')]=qs[_0xa9a8('0x3e')](_0x1c9e0c[_0xa9a8('0x38')]['sort']);_0x394561[_0xa9a8('0x3f')]=qs[_0xa9a8('0x40')](_[_0xa9a8('0x41')](_0x1c9e0c[_0xa9a8('0x38')],_0x1293d7['filters']),_0x50b1be);if(_0x1c9e0c['query'][_0xa9a8('0x42')]){_0x394561[_0xa9a8('0x3f')]=_[_0xa9a8('0x43')](_0x394561[_0xa9a8('0x3f')],{'$or':_[_0xa9a8('0x35')](_0x50b1be,function(_0x416f94){if(_0x416f94[_0xa9a8('0x32')]!==_0xa9a8('0x44')){var _0x2afb99={};_0x2afb99[_0x416f94[_0xa9a8('0x2d')]]={'$like':'%'+_0x1c9e0c[_0xa9a8('0x38')][_0xa9a8('0x42')]+'%'};return _0x2afb99;}})});}_0x394561=_[_0xa9a8('0x43')]({},_0x394561,_0x1c9e0c[_0xa9a8('0x45')]);var _0x530f21={'where':_0x394561[_0xa9a8('0x3f')]};return db[_0xa9a8('0x46')][_0xa9a8('0x23')](_0x530f21)[_0xa9a8('0x2b')](function(_0x4be6b9){_0x388396[_0xa9a8('0x23')]=_0x4be6b9;if(_0x1c9e0c[_0xa9a8('0x38')]['includeAll']){_0x394561[_0xa9a8('0x47')]=[{'all':!![]}];}return db[_0xa9a8('0x46')][_0xa9a8('0x48')](_0x394561);})[_0xa9a8('0x2b')](function(_0x5704d1){_0x388396[_0xa9a8('0x49')]=_0x5704d1;return _0x388396;})[_0xa9a8('0x2b')](respondWithFilteredResult(_0x215299,_0x394561))[_0xa9a8('0x4a')](handleError(_0x215299,null));};exports[_0xa9a8('0x4b')]=function(_0x4a9e41,_0x1e2b45){var _0x17e378={'raw':!![],'where':{'id':_0x4a9e41[_0xa9a8('0x4c')]['id']}},_0x99f09f={};_0x99f09f[_0xa9a8('0x34')]=_[_0xa9a8('0x36')](db[_0xa9a8('0x46')]['rawAttributes']);_0x99f09f[_0xa9a8('0x38')]=_[_0xa9a8('0x36')](_0x4a9e41['query']);_0x99f09f[_0xa9a8('0x40')]=_[_0xa9a8('0x37')](_0x99f09f[_0xa9a8('0x34')],_0x99f09f[_0xa9a8('0x38')]);_0x17e378['attributes']=_[_0xa9a8('0x37')](_0x99f09f['model'],qs[_0xa9a8('0x39')](_0x4a9e41[_0xa9a8('0x38')][_0xa9a8('0x39')]));_0x17e378['attributes']=_0x17e378[_0xa9a8('0x3a')][_0xa9a8('0x3b')]?_0x17e378['attributes']:_0x99f09f[_0xa9a8('0x34')];if(_0x4a9e41[_0xa9a8('0x38')]['includeAll']){_0x17e378[_0xa9a8('0x47')]=[{'all':!![]}];}_0x17e378=_[_0xa9a8('0x43')]({},_0x17e378,_0x4a9e41[_0xa9a8('0x45')]);return db[_0xa9a8('0x46')][_0xa9a8('0x4d')](_0x17e378)['then'](handleEntityNotFound(_0x1e2b45,null))[_0xa9a8('0x2b')](respondWithResult(_0x1e2b45,null))[_0xa9a8('0x4a')](handleError(_0x1e2b45,null));};exports[_0xa9a8('0x4e')]=function(_0x2681c5,_0x1f3329){return db[_0xa9a8('0x46')]['create'](_0x2681c5[_0xa9a8('0x4f')],{})[_0xa9a8('0x2b')](respondWithResult(_0x1f3329,0xc9))[_0xa9a8('0x4a')](handleError(_0x1f3329,null));};exports[_0xa9a8('0x29')]=function(_0x5c1f9b,_0x2b1ed0){if(_0x5c1f9b[_0xa9a8('0x4f')]['id']){delete _0x5c1f9b[_0xa9a8('0x4f')]['id'];}return db[_0xa9a8('0x46')][_0xa9a8('0x4d')]({'where':{'id':_0x5c1f9b[_0xa9a8('0x4c')]['id']}})[_0xa9a8('0x2b')](handleEntityNotFound(_0x2b1ed0,null))['then'](saveUpdates(_0x5c1f9b[_0xa9a8('0x4f')],null))[_0xa9a8('0x2b')](respondWithResult(_0x2b1ed0,null))[_0xa9a8('0x4a')](handleError(_0x2b1ed0,null));};exports[_0xa9a8('0x2a')]=function(_0x20562a,_0x1869ab){return db['FaxQueueReport'][_0xa9a8('0x4d')]({'where':{'id':_0x20562a[_0xa9a8('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1869ab,null))[_0xa9a8('0x2b')](removeEntity(_0x1869ab,null))[_0xa9a8('0x4a')](handleError(_0x1869ab,null));};exports[_0xa9a8('0x50')]=function(_0x5696c5,_0xe26d6){return db[_0xa9a8('0x46')][_0xa9a8('0x50')]()[_0xa9a8('0x2b')](respondWithResult(_0xe26d6,null))['catch'](handleError(_0xe26d6,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 75f4300..728d6ac 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 _0xbf19=['../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbf19,0x1b9));var _0x9bf1=function(_0x1d0c0a,_0x39498d){_0x1d0c0a=_0x1d0c0a-0x0;var _0x1f1804=_0xbf19[_0x1d0c0a];return _0x1f1804;};'use strict';var _=require(_0x9bf1('0x0'));var util=require(_0x9bf1('0x1'));var logger=require('../../config/logger')(_0x9bf1('0x2'));var moment=require(_0x9bf1('0x3'));var BPromise=require(_0x9bf1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9bf1('0x5'));var rimraf=require(_0x9bf1('0x6'));var config=require(_0x9bf1('0x7'));var attributes=require(_0x9bf1('0x8'));module[_0x9bf1('0x9')]=function(_0x10662e,_0x48d8ec){return _0x10662e[_0x9bf1('0xa')](_0x9bf1('0xb'),attributes,{'tableName':_0x9bf1('0xc'),'paranoid':![],'indexes':[{'name':_0x9bf1('0xd'),'fields':[_0x9bf1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f96=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_fax_queue','uniqueid'];(function(_0x42c576,_0x2b93de){var _0x4cb4e5=function(_0x4a2f71){while(--_0x4a2f71){_0x42c576['push'](_0x42c576['shift']());}};_0x4cb4e5(++_0x2b93de);}(_0x9f96,0x1ce));var _0x69f9=function(_0x5e4a3f,_0x2a56d1){_0x5e4a3f=_0x5e4a3f-0x0;var _0x4d6b61=_0x9f96[_0x5e4a3f];return _0x4d6b61;};'use strict';var _=require(_0x69f9('0x0'));var util=require(_0x69f9('0x1'));var logger=require(_0x69f9('0x2'))(_0x69f9('0x3'));var moment=require(_0x69f9('0x4'));var BPromise=require(_0x69f9('0x5'));var rp=require(_0x69f9('0x6'));var fs=require('fs');var path=require(_0x69f9('0x7'));var rimraf=require(_0x69f9('0x8'));var config=require(_0x69f9('0x9'));var attributes=require('./faxQueueReport.attributes');module[_0x69f9('0xa')]=function(_0x3c3178,_0x73f9d0){return _0x3c3178[_0x69f9('0xb')]('FaxQueueReport',attributes,{'tableName':_0x69f9('0xc'),'paranoid':![],'indexes':[{'name':_0x69f9('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index f37411a..7cb0290 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 _0xf3bc=['options','raw','then','UpdateFaxQueueReport','FaxQueueReport','update','where','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateFaxQueueReport','create','body'];(function(_0x1c573f,_0x4e2b63){var _0x18754e=function(_0x5a58ed){while(--_0x5a58ed){_0x1c573f['push'](_0x1c573f['shift']());}};_0x18754e(++_0x4e2b63);}(_0xf3bc,0xf0));var _0xcf3b=function(_0x48d659,_0x21dac7){_0x48d659=_0x48d659-0x0;var _0x4424e1=_0xf3bc[_0x48d659];return _0x4424e1;};'use strict';var _=require(_0xcf3b('0x0'));var util=require('util');var moment=require(_0xcf3b('0x1'));var BPromise=require(_0xcf3b('0x2'));var rs=require(_0xcf3b('0x3'));var fs=require('fs');var Redis=require(_0xcf3b('0x4'));var db=require(_0xcf3b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcf3b('0x6'));var config=require('../../config/environment');var jayson=require(_0xcf3b('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x346410,_0x194788,_0x17ce6b){return new BPromise(function(_0x2d9053,_0x2d7645){return client['request'](_0x346410,_0x17ce6b)['then'](function(_0x35b47d){logger[_0xcf3b('0x8')](_0xcf3b('0x9'),_0x194788,_0xcf3b('0xa'));logger[_0xcf3b('0xb')](_0xcf3b('0xc'),_0x194788,_0xcf3b('0xa'),JSON[_0xcf3b('0xd')](_0x35b47d));if(_0x35b47d[_0xcf3b('0xe')]){if(_0x35b47d[_0xcf3b('0xe')][_0xcf3b('0xf')]===0x1f4){logger[_0xcf3b('0xe')](_0xcf3b('0x9'),_0x194788,_0x35b47d[_0xcf3b('0xe')][_0xcf3b('0x10')]);return _0x2d7645(_0x35b47d['error'][_0xcf3b('0x10')]);}logger[_0xcf3b('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x194788,_0x35b47d[_0xcf3b('0xe')][_0xcf3b('0x10')]);return _0x2d9053(_0x35b47d[_0xcf3b('0xe')][_0xcf3b('0x10')]);}else{logger['info'](_0xcf3b('0x9'),_0x194788,_0xcf3b('0xa'));_0x2d9053(_0x35b47d['result'][_0xcf3b('0x10')]);}})[_0xcf3b('0x11')](function(_0x46eaaf){logger['error'](_0xcf3b('0x9'),_0x194788,_0x46eaaf);_0x2d7645(_0x46eaaf);});});}exports[_0xcf3b('0x12')]=function(_0x1cafa8){var _0x40e8f3=this;return new Promise(function(_0x5ea5f6,_0x1cac87){return db['FaxQueueReport'][_0xcf3b('0x13')](_0x1cafa8[_0xcf3b('0x14')],{'raw':_0x1cafa8[_0xcf3b('0x15')]?_0x1cafa8[_0xcf3b('0x15')][_0xcf3b('0x16')]===undefined?!![]:![]:!![]})[_0xcf3b('0x17')](function(_0x3d178d){logger['info'](_0xcf3b('0x12'),_0x1cafa8);logger['debug']('CreateFaxQueueReport',_0x1cafa8,JSON[_0xcf3b('0xd')](_0x3d178d));_0x5ea5f6(_0x3d178d);})[_0xcf3b('0x11')](function(_0x1744e0){logger[_0xcf3b('0xe')](_0xcf3b('0x12'),_0x1744e0[_0xcf3b('0x10')],_0x1cafa8);_0x1cac87(_0x40e8f3[_0xcf3b('0xe')](0x1f4,_0x1744e0[_0xcf3b('0x10')]));});});};exports[_0xcf3b('0x18')]=function(_0x42caf8){var _0x3f743b=this;return new Promise(function(_0x4dae65,_0x4bde13){return db[_0xcf3b('0x19')][_0xcf3b('0x1a')](_0x42caf8[_0xcf3b('0x14')],{'raw':_0x42caf8['options']?_0x42caf8[_0xcf3b('0x15')][_0xcf3b('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42caf8[_0xcf3b('0x15')]?_0x42caf8[_0xcf3b('0x15')][_0xcf3b('0x1b')]||null:null,'attributes':_0x42caf8[_0xcf3b('0x15')]?_0x42caf8[_0xcf3b('0x15')][_0xcf3b('0x1c')]||null:null,'limit':_0x42caf8['options']?_0x42caf8[_0xcf3b('0x15')]['limit']||null:null})[_0xcf3b('0x17')](function(_0x548672){logger['info']('UpdateFaxQueueReport',_0x42caf8);logger[_0xcf3b('0xb')]('UpdateFaxQueueReport',_0x42caf8,JSON[_0xcf3b('0xd')](_0x548672));_0x4dae65(_0x548672);})[_0xcf3b('0x11')](function(_0x83e302){logger[_0xcf3b('0xe')](_0xcf3b('0x18'),_0x83e302[_0xcf3b('0x10')],_0x42caf8);_0x4bde13(_0x3f743b['error'](0x1f4,_0x83e302['message']));});});}; \ No newline at end of file +var _0xf0ee=['FaxQueueReport','body','options','stringify','UpdateFaxQueueReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateFaxQueueReport'];(function(_0x24fc8a,_0x14c1fb){var _0x58b1b8=function(_0x4df32b){while(--_0x4df32b){_0x24fc8a['push'](_0x24fc8a['shift']());}};_0x58b1b8(++_0x14c1fb);}(_0xf0ee,0x180));var _0xef0e=function(_0x22a9fa,_0x292f7c){_0x22a9fa=_0x22a9fa-0x0;var _0x379451=_0xf0ee[_0x22a9fa];return _0x379451;};'use strict';var _=require(_0xef0e('0x0'));var util=require(_0xef0e('0x1'));var moment=require(_0xef0e('0x2'));var BPromise=require(_0xef0e('0x3'));var rs=require(_0xef0e('0x4'));var fs=require('fs');var Redis=require(_0xef0e('0x5'));var db=require(_0xef0e('0x6'))['db'];var utils=require(_0xef0e('0x7'));var logger=require(_0xef0e('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xef0e('0x9'));var client=jayson['client'][_0xef0e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2140cd,_0x583da8,_0x495f3e){return new BPromise(function(_0x1db346,_0x4b10bd){return client[_0xef0e('0xb')](_0x2140cd,_0x495f3e)[_0xef0e('0xc')](function(_0x18b51a){logger['info'](_0xef0e('0xd'),_0x583da8,_0xef0e('0xe'));logger[_0xef0e('0xf')](_0xef0e('0x10'),_0x583da8,'request\x20sent',JSON['stringify'](_0x18b51a));if(_0x18b51a['error']){if(_0x18b51a[_0xef0e('0x11')][_0xef0e('0x12')]===0x1f4){logger[_0xef0e('0x11')](_0xef0e('0xd'),_0x583da8,_0x18b51a[_0xef0e('0x11')]['message']);return _0x4b10bd(_0x18b51a[_0xef0e('0x11')][_0xef0e('0x13')]);}logger[_0xef0e('0x11')](_0xef0e('0xd'),_0x583da8,_0x18b51a['error'][_0xef0e('0x13')]);return _0x1db346(_0x18b51a['error'][_0xef0e('0x13')]);}else{logger[_0xef0e('0x14')](_0xef0e('0xd'),_0x583da8,'request\x20sent');_0x1db346(_0x18b51a[_0xef0e('0x15')][_0xef0e('0x13')]);}})[_0xef0e('0x16')](function(_0x5afd52){logger[_0xef0e('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x583da8,_0x5afd52);_0x4b10bd(_0x5afd52);});});}exports[_0xef0e('0x17')]=function(_0x53c408){var _0x46f285=this;return new Promise(function(_0x59874f,_0x34b9cd){return db[_0xef0e('0x18')]['create'](_0x53c408[_0xef0e('0x19')],{'raw':_0x53c408['options']?_0x53c408[_0xef0e('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xef0e('0xc')](function(_0x46af7b){logger[_0xef0e('0x14')](_0xef0e('0x17'),_0x53c408);logger['debug'](_0xef0e('0x17'),_0x53c408,JSON[_0xef0e('0x1b')](_0x46af7b));_0x59874f(_0x46af7b);})['catch'](function(_0x1e580c){logger['error']('CreateFaxQueueReport',_0x1e580c[_0xef0e('0x13')],_0x53c408);_0x34b9cd(_0x46f285[_0xef0e('0x11')](0x1f4,_0x1e580c['message']));});});};exports[_0xef0e('0x1c')]=function(_0x2c768f){var _0x55f5e8=this;return new Promise(function(_0x45260f,_0x1c690f){return db[_0xef0e('0x18')][_0xef0e('0x1d')](_0x2c768f[_0xef0e('0x19')],{'raw':_0x2c768f[_0xef0e('0x1a')]?_0x2c768f[_0xef0e('0x1a')][_0xef0e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c768f[_0xef0e('0x1a')]?_0x2c768f[_0xef0e('0x1a')][_0xef0e('0x1f')]||null:null,'attributes':_0x2c768f['options']?_0x2c768f['options'][_0xef0e('0x20')]||null:null,'limit':_0x2c768f[_0xef0e('0x1a')]?_0x2c768f['options'][_0xef0e('0x21')]||null:null})[_0xef0e('0xc')](function(_0x2b6f29){logger[_0xef0e('0x14')](_0xef0e('0x1c'),_0x2c768f);logger[_0xef0e('0xf')](_0xef0e('0x1c'),_0x2c768f,JSON[_0xef0e('0x1b')](_0x2b6f29));_0x45260f(_0x2b6f29);})[_0xef0e('0x16')](function(_0x59ea71){logger['error']('UpdateFaxQueueReport',_0x59ea71['message'],_0x2c768f);_0x1c690f(_0x55f5e8['error'](0x1f4,_0x59ea71['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 68f84c6..7591ffb 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 _0x01cc=['./faxQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x475247,_0x574bce){var _0x5e397f=function(_0x189f93){while(--_0x189f93){_0x475247['push'](_0x475247['shift']());}};_0x5e397f(++_0x574bce);}(_0x01cc,0xac));var _0xc01c=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x01cc[_0xf50820];return _0x2a9b10;};'use strict';var multer=require('multer');var util=require(_0xc01c('0x0'));var path=require(_0xc01c('0x1'));var timeout=require(_0xc01c('0x2'));var express=require(_0xc01c('0x3'));var router=express['Router']();var fs_extra=require(_0xc01c('0x4'));var auth=require(_0xc01c('0x5'));var interaction=require(_0xc01c('0x6'));var config=require(_0xc01c('0x7'));var controller=require(_0xc01c('0x8'));router[_0xc01c('0x9')]('/',auth[_0xc01c('0xa')](),controller[_0xc01c('0xb')]);router[_0xc01c('0x9')](_0xc01c('0xc'),auth[_0xc01c('0xa')](),controller['describe']);router[_0xc01c('0x9')](_0xc01c('0xd'),auth[_0xc01c('0xa')](),controller[_0xc01c('0xe')]);router[_0xc01c('0xf')]('/',auth['isAuthenticated'](),controller[_0xc01c('0x10')]);router['put'](_0xc01c('0xd'),auth[_0xc01c('0xa')](),controller[_0xc01c('0x11')]);router[_0xc01c('0x12')](_0xc01c('0xd'),auth['isAuthenticated'](),controller[_0xc01c('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3d69=['put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create'];(function(_0x16acc0,_0x5dda04){var _0x54ec89=function(_0x141441){while(--_0x141441){_0x16acc0['push'](_0x16acc0['shift']());}};_0x54ec89(++_0x5dda04);}(_0x3d69,0x143));var _0x93d6=function(_0x2d49b7,_0x1b6f15){_0x2d49b7=_0x2d49b7-0x0;var _0x129fb7=_0x3d69[_0x2d49b7];return _0x129fb7;};'use strict';var multer=require(_0x93d6('0x0'));var util=require(_0x93d6('0x1'));var path=require(_0x93d6('0x2'));var timeout=require(_0x93d6('0x3'));var express=require(_0x93d6('0x4'));var router=express[_0x93d6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x93d6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x93d6('0x7'));var controller=require(_0x93d6('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x93d6('0x9')](_0x93d6('0xa'),auth[_0x93d6('0xb')](),controller[_0x93d6('0xc')]);router['get'](_0x93d6('0xd'),auth[_0x93d6('0xb')](),controller[_0x93d6('0xe')]);router[_0x93d6('0xf')]('/',auth[_0x93d6('0xb')](),controller[_0x93d6('0x10')]);router[_0x93d6('0x11')](_0x93d6('0xd'),auth[_0x93d6('0xb')](),controller['update']);router[_0x93d6('0x12')](_0x93d6('0xd'),auth[_0x93d6('0xb')](),controller[_0x93d6('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index d8a3f10..2a5abc1 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 _0xa3f6=['queue','moment','sequelize','STRING','account'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0xa3f6,0xbf));var _0x6a3f=function(_0x1293df,_0x3e1cd0){_0x1293df=_0x1293df-0x0;var _0x184959=_0xa3f6[_0x1293df];return _0x184959;};'use strict';var moment=require(_0x6a3f('0x0'));var Sequelize=require(_0x6a3f('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x6a3f('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6a3f('0x3'),'agent',_0x6a3f('0x4')),'allowNull':![],'defaultValue':_0x6a3f('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x45c4=['account','agent','queue','DATE','moment','STRING','ENUM'];(function(_0x399e8e,_0x303361){var _0x38ae1b=function(_0x5a205c){while(--_0x5a205c){_0x399e8e['push'](_0x399e8e['shift']());}};_0x38ae1b(++_0x303361);}(_0x45c4,0x17e));var _0x445c=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x45c4[_0x2c7618];return _0x5ce3f0;};'use strict';var moment=require(_0x445c('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x445c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x445c('0x2')](_0x445c('0x3'),_0x445c('0x4'),'queue'),'allowNull':![],'defaultValue':_0x445c('0x5')},'transferredAt':{'type':Sequelize[_0x445c('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 4320f20..559cb21 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 _0x4afd=['apply','save','update','destroy','then','stack','name','send','index','map','FaxTransferReport','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','include','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','Content-Range'];(function(_0xae0e93,_0x3e4a88){var _0x2e6f1b=function(_0x960458){while(--_0x960458){_0xae0e93['push'](_0xae0e93['shift']());}};_0x2e6f1b(++_0x3e4a88);}(_0x4afd,0x1ec));var _0xd4af=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4afd[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0xd4af('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd4af('0x1'));var jsonpatch=require(_0xd4af('0x2'));var rp=require('request-promise');var moment=require(_0xd4af('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd4af('0x4'));var util=require(_0xd4af('0x5'));var path=require(_0xd4af('0x6'));var sox=require(_0xd4af('0x7'));var csv=require(_0xd4af('0x8'));var ejs=require(_0xd4af('0x9'));var fs=require('fs');var fs_extra=require(_0xd4af('0xa'));var _=require(_0xd4af('0xb'));var squel=require(_0xd4af('0xc'));var crypto=require(_0xd4af('0xd'));var jsforce=require(_0xd4af('0xe'));var deskjs=require(_0xd4af('0xf'));var toCsv=require(_0xd4af('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd4af('0x10'));var authService=require(_0xd4af('0x11'));var qs=require(_0xd4af('0x12'));var as=require(_0xd4af('0x13'));var hardwareService=require(_0xd4af('0x14'));var logger=require('../../config/logger')(_0xd4af('0x15'));var utils=require(_0xd4af('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd4af('0x17'));var db=require(_0xd4af('0x18'))['db'];function respondWithStatusCode(_0x33e86a,_0x4cf3b4){_0x4cf3b4=_0x4cf3b4||0xcc;return function(_0x59c64a){if(_0x59c64a){return _0x33e86a[_0xd4af('0x19')](_0x4cf3b4);}return _0x33e86a[_0xd4af('0x1a')](_0x4cf3b4)['end']();};}function respondWithResult(_0x44b6f6,_0xa90556){_0xa90556=_0xa90556||0xc8;return function(_0x598a56){if(_0x598a56){return _0x44b6f6[_0xd4af('0x1a')](_0xa90556)[_0xd4af('0x1b')](_0x598a56);}};}function respondWithFilteredResult(_0x29d57d,_0xdcb6e0){return function(_0x51065f){if(_0x51065f){var _0x2b2c0d=typeof _0xdcb6e0['offset']===_0xd4af('0x1c')&&typeof _0xdcb6e0['limit']===_0xd4af('0x1c');var _0x44cdf3=_0x51065f[_0xd4af('0x1d')];var _0x3bfe34=_0x2b2c0d?0x0:_0xdcb6e0[_0xd4af('0x1e')];var _0x3c856f=_0x2b2c0d?_0x51065f[_0xd4af('0x1d')]:_0xdcb6e0['offset']+_0xdcb6e0['limit'];var _0x44b272;if(_0x3c856f>=_0x44cdf3){_0x3c856f=_0x44cdf3;_0x44b272=0xc8;}else{_0x44b272=0xce;}_0x29d57d[_0xd4af('0x1a')](_0x44b272);return _0x29d57d[_0xd4af('0x1f')](_0xd4af('0x20'),_0x3bfe34+'-'+_0x3c856f+'/'+_0x44cdf3)[_0xd4af('0x1b')](_0x51065f);}return null;};}function patchUpdates(_0x36384d){return function(_0x38e329){try{jsonpatch[_0xd4af('0x21')](_0x38e329,_0x36384d,!![]);}catch(_0x85b83f){return BPromise['reject'](_0x85b83f);}return _0x38e329[_0xd4af('0x22')]();};}function saveUpdates(_0x12eb46,_0x40a285){return function(_0x120992){if(_0x120992){return _0x120992[_0xd4af('0x23')](_0x12eb46)['then'](function(_0x5e340a){return _0x5e340a;});}return null;};}function removeEntity(_0xda60c0,_0x1e4cb1){return function(_0xb1d23e){if(_0xb1d23e){return _0xb1d23e[_0xd4af('0x24')]()[_0xd4af('0x25')](function(){_0xda60c0[_0xd4af('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb60959,_0x218061){return function(_0x19b1dd){if(!_0x19b1dd){_0xb60959[_0xd4af('0x19')](0x194);}return _0x19b1dd;};}function handleError(_0x3241b6,_0x540c95){_0x540c95=_0x540c95||0x1f4;return function(_0x4852a5){logger['error'](_0x4852a5[_0xd4af('0x26')]);if(_0x4852a5[_0xd4af('0x27')]){delete _0x4852a5[_0xd4af('0x27')];}_0x3241b6[_0xd4af('0x1a')](_0x540c95)[_0xd4af('0x28')](_0x4852a5);};}exports[_0xd4af('0x29')]=function(_0x3168f7,_0x846a1c){var _0x2eb19c={},_0x424f83={},_0x161768={'count':0x0,'rows':[]};var _0x1a48d5=_[_0xd4af('0x2a')](db[_0xd4af('0x2b')]['rawAttributes'],function(_0x5f49f8){return{'name':_0x5f49f8[_0xd4af('0x2c')],'type':_0x5f49f8[_0xd4af('0x2d')][_0xd4af('0x2e')]};});_0x424f83['model']=_[_0xd4af('0x2a')](_0x1a48d5,_0xd4af('0x27'));_0x424f83[_0xd4af('0x2f')]=_['keys'](_0x3168f7[_0xd4af('0x2f')]);_0x424f83[_0xd4af('0x30')]=_['intersection'](_0x424f83[_0xd4af('0x31')],_0x424f83['query']);_0x2eb19c[_0xd4af('0x32')]=_[_0xd4af('0x33')](_0x424f83[_0xd4af('0x31')],qs[_0xd4af('0x34')](_0x3168f7['query'][_0xd4af('0x34')]));_0x2eb19c['attributes']=_0x2eb19c[_0xd4af('0x32')][_0xd4af('0x35')]?_0x2eb19c['attributes']:_0x424f83[_0xd4af('0x31')];if(!_0x3168f7[_0xd4af('0x2f')][_0xd4af('0x36')](_0xd4af('0x37'))){_0x2eb19c['limit']=qs[_0xd4af('0x38')](_0x3168f7[_0xd4af('0x2f')]['limit']);_0x2eb19c['offset']=qs[_0xd4af('0x1e')](_0x3168f7['query'][_0xd4af('0x1e')]);}_0x2eb19c[_0xd4af('0x39')]=qs[_0xd4af('0x3a')](_0x3168f7[_0xd4af('0x2f')]['sort']);_0x2eb19c[_0xd4af('0x3b')]=qs[_0xd4af('0x30')](_[_0xd4af('0x3c')](_0x3168f7['query'],_0x424f83['filters']),_0x1a48d5);if(_0x3168f7[_0xd4af('0x2f')][_0xd4af('0x3d')]){_0x2eb19c[_0xd4af('0x3b')]=_['merge'](_0x2eb19c['where'],{'$or':_[_0xd4af('0x2a')](_0x1a48d5,function(_0x368309){if(_0x368309['type']!=='VIRTUAL'){var _0x169210={};_0x169210[_0x368309[_0xd4af('0x27')]]={'$like':'%'+_0x3168f7['query'][_0xd4af('0x3d')]+'%'};return _0x169210;}})});}_0x2eb19c=_[_0xd4af('0x3e')]({},_0x2eb19c,_0x3168f7['options']);var _0x2c057f={'where':_0x2eb19c['where']};return db[_0xd4af('0x2b')]['count'](_0x2c057f)[_0xd4af('0x25')](function(_0x56a741){_0x161768[_0xd4af('0x1d')]=_0x56a741;if(_0x3168f7['query']['includeAll']){_0x2eb19c[_0xd4af('0x3f')]=[{'all':!![]}];}return db[_0xd4af('0x2b')]['findAll'](_0x2eb19c);})[_0xd4af('0x25')](function(_0x5b5fec){_0x161768[_0xd4af('0x40')]=_0x5b5fec;return _0x161768;})['then'](respondWithFilteredResult(_0x846a1c,_0x2eb19c))[_0xd4af('0x41')](handleError(_0x846a1c,null));};exports[_0xd4af('0x42')]=function(_0x6ec683,_0x156888){var _0x8fd8cf={'raw':!![],'where':{'id':_0x6ec683[_0xd4af('0x43')]['id']}},_0x4ccac8={};_0x4ccac8[_0xd4af('0x31')]=_['keys'](db[_0xd4af('0x2b')][_0xd4af('0x44')]);_0x4ccac8['query']=_['keys'](_0x6ec683[_0xd4af('0x2f')]);_0x4ccac8[_0xd4af('0x30')]=_[_0xd4af('0x33')](_0x4ccac8[_0xd4af('0x31')],_0x4ccac8['query']);_0x8fd8cf[_0xd4af('0x32')]=_[_0xd4af('0x33')](_0x4ccac8['model'],qs[_0xd4af('0x34')](_0x6ec683[_0xd4af('0x2f')][_0xd4af('0x34')]));_0x8fd8cf[_0xd4af('0x32')]=_0x8fd8cf[_0xd4af('0x32')][_0xd4af('0x35')]?_0x8fd8cf[_0xd4af('0x32')]:_0x4ccac8[_0xd4af('0x31')];if(_0x6ec683['query'][_0xd4af('0x45')]){_0x8fd8cf['include']=[{'all':!![]}];}_0x8fd8cf=_['merge']({},_0x8fd8cf,_0x6ec683[_0xd4af('0x46')]);return db[_0xd4af('0x2b')][_0xd4af('0x47')](_0x8fd8cf)[_0xd4af('0x25')](handleEntityNotFound(_0x156888,null))[_0xd4af('0x25')](respondWithResult(_0x156888,null))['catch'](handleError(_0x156888,null));};exports[_0xd4af('0x48')]=function(_0x20b23a,_0x29404f){return db[_0xd4af('0x2b')][_0xd4af('0x48')](_0x20b23a[_0xd4af('0x49')],{})[_0xd4af('0x25')](respondWithResult(_0x29404f,0xc9))['catch'](handleError(_0x29404f,null));};exports['update']=function(_0x1358ea,_0x48f82d){if(_0x1358ea['body']['id']){delete _0x1358ea[_0xd4af('0x49')]['id'];}return db[_0xd4af('0x2b')]['find']({'where':{'id':_0x1358ea[_0xd4af('0x43')]['id']}})[_0xd4af('0x25')](handleEntityNotFound(_0x48f82d,null))[_0xd4af('0x25')](saveUpdates(_0x1358ea['body'],null))[_0xd4af('0x25')](respondWithResult(_0x48f82d,null))[_0xd4af('0x41')](handleError(_0x48f82d,null));};exports[_0xd4af('0x24')]=function(_0x501af8,_0x3be950){return db[_0xd4af('0x2b')]['find']({'where':{'id':_0x501af8['params']['id']}})[_0xd4af('0x25')](handleEntityNotFound(_0x3be950,null))[_0xd4af('0x25')](removeEntity(_0x3be950,null))[_0xd4af('0x41')](handleError(_0x3be950,null));};exports['describe']=function(_0x4eb0f9,_0x43c0b1){return db[_0xd4af('0x2b')][_0xd4af('0x4a')]()[_0xd4af('0x25')](respondWithResult(_0x43c0b1,null))['catch'](handleError(_0x43c0b1,null));}; \ No newline at end of file +var _0xd4d6=['apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','FaxTransferReport','fieldName','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x368eb1,_0x11343a){var _0xbf8b62=function(_0xa3d625){while(--_0xa3d625){_0x368eb1['push'](_0x368eb1['shift']());}};_0xbf8b62(++_0x11343a);}(_0xd4d6,0x78));var _0x6d4d=function(_0x54e489,_0xfcb075){_0x54e489=_0x54e489-0x0;var _0xd07b8c=_0xd4d6[_0x54e489];return _0xd07b8c;};'use strict';var emlformat=require(_0x6d4d('0x0'));var rimraf=require(_0x6d4d('0x1'));var zipdir=require(_0x6d4d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d4d('0x3'));var moment=require('moment');var BPromise=require(_0x6d4d('0x4'));var Mustache=require(_0x6d4d('0x5'));var util=require(_0x6d4d('0x6'));var path=require(_0x6d4d('0x7'));var sox=require('sox');var csv=require(_0x6d4d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d4d('0x9'));var _=require(_0x6d4d('0xa'));var squel=require('squel');var crypto=require(_0x6d4d('0xb'));var jsforce=require(_0x6d4d('0xc'));var deskjs=require(_0x6d4d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6d4d('0xe'));var Papa=require('papaparse');var Redis=require(_0x6d4d('0xf'));var authService=require(_0x6d4d('0x10'));var qs=require(_0x6d4d('0x11'));var as=require(_0x6d4d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6d4d('0x13'))(_0x6d4d('0x14'));var utils=require('../../config/utils');var config=require(_0x6d4d('0x15'));var licenseUtil=require(_0x6d4d('0x16'));var db=require(_0x6d4d('0x17'))['db'];function respondWithStatusCode(_0x339374,_0x2beacf){_0x2beacf=_0x2beacf||0xcc;return function(_0x2a15ef){if(_0x2a15ef){return _0x339374[_0x6d4d('0x18')](_0x2beacf);}return _0x339374[_0x6d4d('0x19')](_0x2beacf)['end']();};}function respondWithResult(_0x12de31,_0x56c972){_0x56c972=_0x56c972||0xc8;return function(_0x117baa){if(_0x117baa){return _0x12de31[_0x6d4d('0x19')](_0x56c972)[_0x6d4d('0x1a')](_0x117baa);}};}function respondWithFilteredResult(_0x272a54,_0x1454d4){return function(_0xfd877a){if(_0xfd877a){var _0x5cc8c5=typeof _0x1454d4[_0x6d4d('0x1b')]===_0x6d4d('0x1c')&&typeof _0x1454d4[_0x6d4d('0x1d')]==='undefined';var _0x4c42c2=_0xfd877a[_0x6d4d('0x1e')];var _0x4d2f21=_0x5cc8c5?0x0:_0x1454d4[_0x6d4d('0x1b')];var _0x50fa0f=_0x5cc8c5?_0xfd877a[_0x6d4d('0x1e')]:_0x1454d4['offset']+_0x1454d4[_0x6d4d('0x1d')];var _0x3a7877;if(_0x50fa0f>=_0x4c42c2){_0x50fa0f=_0x4c42c2;_0x3a7877=0xc8;}else{_0x3a7877=0xce;}_0x272a54[_0x6d4d('0x19')](_0x3a7877);return _0x272a54[_0x6d4d('0x1f')]('Content-Range',_0x4d2f21+'-'+_0x50fa0f+'/'+_0x4c42c2)[_0x6d4d('0x1a')](_0xfd877a);}return null;};}function patchUpdates(_0x1cba50){return function(_0x5ab093){try{jsonpatch[_0x6d4d('0x20')](_0x5ab093,_0x1cba50,!![]);}catch(_0x5c97bd){return BPromise[_0x6d4d('0x21')](_0x5c97bd);}return _0x5ab093[_0x6d4d('0x22')]();};}function saveUpdates(_0x41483f,_0x1a6ac6){return function(_0x452345){if(_0x452345){return _0x452345[_0x6d4d('0x23')](_0x41483f)[_0x6d4d('0x24')](function(_0x20e1b9){return _0x20e1b9;});}return null;};}function removeEntity(_0x26d50f,_0x330c2e){return function(_0x7491fd){if(_0x7491fd){return _0x7491fd[_0x6d4d('0x25')]()[_0x6d4d('0x24')](function(){_0x26d50f[_0x6d4d('0x19')](0xcc)[_0x6d4d('0x26')]();});}};}function handleEntityNotFound(_0x445b21,_0x4a50cf){return function(_0x1ae018){if(!_0x1ae018){_0x445b21[_0x6d4d('0x18')](0x194);}return _0x1ae018;};}function handleError(_0xbb2616,_0x83c880){_0x83c880=_0x83c880||0x1f4;return function(_0x4ed74f){logger[_0x6d4d('0x27')](_0x4ed74f[_0x6d4d('0x28')]);if(_0x4ed74f[_0x6d4d('0x29')]){delete _0x4ed74f[_0x6d4d('0x29')];}_0xbb2616[_0x6d4d('0x19')](_0x83c880)[_0x6d4d('0x2a')](_0x4ed74f);};}exports[_0x6d4d('0x2b')]=function(_0x3bfd6e,_0x1f0e2f){var _0x7f698e={},_0x4b741a={},_0x2045ce={'count':0x0,'rows':[]};var _0x499b6c=_[_0x6d4d('0x2c')](db[_0x6d4d('0x2d')]['rawAttributes'],function(_0x385e1b){return{'name':_0x385e1b[_0x6d4d('0x2e')],'type':_0x385e1b['type']['key']};});_0x4b741a['model']=_['map'](_0x499b6c,_0x6d4d('0x29'));_0x4b741a[_0x6d4d('0x2f')]=_['keys'](_0x3bfd6e['query']);_0x4b741a[_0x6d4d('0x30')]=_[_0x6d4d('0x31')](_0x4b741a['model'],_0x4b741a[_0x6d4d('0x2f')]);_0x7f698e[_0x6d4d('0x32')]=_[_0x6d4d('0x31')](_0x4b741a[_0x6d4d('0x33')],qs['fields'](_0x3bfd6e[_0x6d4d('0x2f')][_0x6d4d('0x34')]));_0x7f698e['attributes']=_0x7f698e[_0x6d4d('0x32')]['length']?_0x7f698e[_0x6d4d('0x32')]:_0x4b741a[_0x6d4d('0x33')];if(!_0x3bfd6e[_0x6d4d('0x2f')][_0x6d4d('0x35')](_0x6d4d('0x36'))){_0x7f698e[_0x6d4d('0x1d')]=qs[_0x6d4d('0x1d')](_0x3bfd6e[_0x6d4d('0x2f')][_0x6d4d('0x1d')]);_0x7f698e['offset']=qs[_0x6d4d('0x1b')](_0x3bfd6e[_0x6d4d('0x2f')][_0x6d4d('0x1b')]);}_0x7f698e[_0x6d4d('0x37')]=qs[_0x6d4d('0x38')](_0x3bfd6e['query'][_0x6d4d('0x38')]);_0x7f698e[_0x6d4d('0x39')]=qs[_0x6d4d('0x30')](_[_0x6d4d('0x3a')](_0x3bfd6e['query'],_0x4b741a[_0x6d4d('0x30')]),_0x499b6c);if(_0x3bfd6e[_0x6d4d('0x2f')][_0x6d4d('0x3b')]){_0x7f698e['where']=_[_0x6d4d('0x3c')](_0x7f698e['where'],{'$or':_[_0x6d4d('0x2c')](_0x499b6c,function(_0x285901){if(_0x285901[_0x6d4d('0x3d')]!==_0x6d4d('0x3e')){var _0x31e97e={};_0x31e97e[_0x285901['name']]={'$like':'%'+_0x3bfd6e[_0x6d4d('0x2f')][_0x6d4d('0x3b')]+'%'};return _0x31e97e;}})});}_0x7f698e=_[_0x6d4d('0x3c')]({},_0x7f698e,_0x3bfd6e[_0x6d4d('0x3f')]);var _0x8fcb7e={'where':_0x7f698e[_0x6d4d('0x39')]};return db['FaxTransferReport'][_0x6d4d('0x1e')](_0x8fcb7e)[_0x6d4d('0x24')](function(_0xa334e){_0x2045ce[_0x6d4d('0x1e')]=_0xa334e;if(_0x3bfd6e[_0x6d4d('0x2f')]['includeAll']){_0x7f698e[_0x6d4d('0x40')]=[{'all':!![]}];}return db[_0x6d4d('0x2d')]['findAll'](_0x7f698e);})[_0x6d4d('0x24')](function(_0x7afc50){_0x2045ce[_0x6d4d('0x41')]=_0x7afc50;return _0x2045ce;})[_0x6d4d('0x24')](respondWithFilteredResult(_0x1f0e2f,_0x7f698e))[_0x6d4d('0x42')](handleError(_0x1f0e2f,null));};exports[_0x6d4d('0x43')]=function(_0x253499,_0x2bac32){var _0x3a1c09={'raw':!![],'where':{'id':_0x253499[_0x6d4d('0x44')]['id']}},_0x57cb44={};_0x57cb44[_0x6d4d('0x33')]=_['keys'](db['FaxTransferReport'][_0x6d4d('0x45')]);_0x57cb44[_0x6d4d('0x2f')]=_[_0x6d4d('0x46')](_0x253499[_0x6d4d('0x2f')]);_0x57cb44['filters']=_[_0x6d4d('0x31')](_0x57cb44['model'],_0x57cb44[_0x6d4d('0x2f')]);_0x3a1c09[_0x6d4d('0x32')]=_[_0x6d4d('0x31')](_0x57cb44[_0x6d4d('0x33')],qs['fields'](_0x253499[_0x6d4d('0x2f')][_0x6d4d('0x34')]));_0x3a1c09['attributes']=_0x3a1c09[_0x6d4d('0x32')][_0x6d4d('0x47')]?_0x3a1c09[_0x6d4d('0x32')]:_0x57cb44[_0x6d4d('0x33')];if(_0x253499[_0x6d4d('0x2f')]['includeAll']){_0x3a1c09[_0x6d4d('0x40')]=[{'all':!![]}];}_0x3a1c09=_['merge']({},_0x3a1c09,_0x253499[_0x6d4d('0x3f')]);return db[_0x6d4d('0x2d')][_0x6d4d('0x48')](_0x3a1c09)[_0x6d4d('0x24')](handleEntityNotFound(_0x2bac32,null))[_0x6d4d('0x24')](respondWithResult(_0x2bac32,null))['catch'](handleError(_0x2bac32,null));};exports[_0x6d4d('0x49')]=function(_0x16ec3d,_0x401fc){return db[_0x6d4d('0x2d')][_0x6d4d('0x49')](_0x16ec3d[_0x6d4d('0x4a')],{})['then'](respondWithResult(_0x401fc,0xc9))[_0x6d4d('0x42')](handleError(_0x401fc,null));};exports[_0x6d4d('0x23')]=function(_0x520a28,_0x2439e0){if(_0x520a28[_0x6d4d('0x4a')]['id']){delete _0x520a28[_0x6d4d('0x4a')]['id'];}return db[_0x6d4d('0x2d')][_0x6d4d('0x48')]({'where':{'id':_0x520a28['params']['id']}})[_0x6d4d('0x24')](handleEntityNotFound(_0x2439e0,null))[_0x6d4d('0x24')](saveUpdates(_0x520a28['body'],null))[_0x6d4d('0x24')](respondWithResult(_0x2439e0,null))[_0x6d4d('0x42')](handleError(_0x2439e0,null));};exports['destroy']=function(_0x8a95a1,_0x19144d){return db[_0x6d4d('0x2d')][_0x6d4d('0x48')]({'where':{'id':_0x8a95a1[_0x6d4d('0x44')]['id']}})['then'](handleEntityNotFound(_0x19144d,null))[_0x6d4d('0x24')](removeEntity(_0x19144d,null))[_0x6d4d('0x42')](handleError(_0x19144d,null));};exports[_0x6d4d('0x4b')]=function(_0x4e4793,_0x22e73b){return db[_0x6d4d('0x2d')][_0x6d4d('0x4b')]()[_0x6d4d('0x24')](respondWithResult(_0x22e73b,null))[_0x6d4d('0x42')](handleError(_0x22e73b,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 1be12ec..5d48900 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 _0x6c64=['util','api','../../config/environment','./faxTransferReport.attributes','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x3a98da,_0x563268){var _0x1267b4=function(_0x4d61ca){while(--_0x4d61ca){_0x3a98da['push'](_0x3a98da['shift']());}};_0x1267b4(++_0x563268);}(_0x6c64,0x8f));var _0x46c6=function(_0x1cfcc0,_0x4efe17){_0x1cfcc0=_0x1cfcc0-0x0;var _0x1c7c4d=_0x6c64[_0x1cfcc0];return _0x1c7c4d;};'use strict';var _=require(_0x46c6('0x0'));var util=require(_0x46c6('0x1'));var logger=require('../../config/logger')(_0x46c6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x46c6('0x3'));var attributes=require(_0x46c6('0x4'));module['exports']=function(_0x220ae2,_0x3b78ea){return _0x220ae2['define'](_0x46c6('0x5'),attributes,{'tableName':_0x46c6('0x6'),'paranoid':![],'indexes':[{'name':_0x46c6('0x7'),'fields':[_0x46c6('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c8c=['define','report_fax_transfer','uniqueid','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x9c8c,0x1b1));var _0xc9c8=function(_0x44a647,_0x37db85){_0x44a647=_0x44a647-0x0;var _0x610306=_0x9c8c[_0x44a647];return _0x610306;};'use strict';var _=require(_0xc9c8('0x0'));var util=require('util');var logger=require(_0xc9c8('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc9c8('0x2'));var fs=require('fs');var path=require(_0xc9c8('0x3'));var rimraf=require(_0xc9c8('0x4'));var config=require(_0xc9c8('0x5'));var attributes=require(_0xc9c8('0x6'));module['exports']=function(_0xf86118,_0x294dfb){return _0xf86118[_0xc9c8('0x7')]('FaxTransferReport',attributes,{'tableName':_0xc9c8('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc9c8('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index d63d318..90a9cd5 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 _0x9d18=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x58d914,_0x580874){var _0x455161=function(_0x2d6a90){while(--_0x2d6a90){_0x58d914['push'](_0x58d914['shift']());}};_0x455161(++_0x580874);}(_0x9d18,0x97));var _0x89d1=function(_0xaa36a4,_0x11fbe4){_0xaa36a4=_0xaa36a4-0x0;var _0xbb2151=_0x9d18[_0xaa36a4];return _0xbb2151;};'use strict';var _=require(_0x89d1('0x0'));var util=require(_0x89d1('0x1'));var moment=require(_0x89d1('0x2'));var BPromise=require(_0x89d1('0x3'));var rs=require(_0x89d1('0x4'));var fs=require('fs');var Redis=require(_0x89d1('0x5'));var db=require(_0x89d1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x89d1('0x7'))(_0x89d1('0x8'));var config=require('../../config/environment');var jayson=require(_0x89d1('0x9'));var client=jayson[_0x89d1('0xa')][_0x89d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x116f7b,_0x54e333,_0x120c6d){return new BPromise(function(_0x14958d,_0x76aa6b){return client[_0x89d1('0xc')](_0x116f7b,_0x120c6d)['then'](function(_0x1b7d7b){logger['info'](_0x89d1('0xd'),_0x54e333,_0x89d1('0xe'));logger['debug'](_0x89d1('0xf'),_0x54e333,_0x89d1('0xe'),JSON[_0x89d1('0x10')](_0x1b7d7b));if(_0x1b7d7b['error']){if(_0x1b7d7b[_0x89d1('0x11')][_0x89d1('0x12')]===0x1f4){logger[_0x89d1('0x11')](_0x89d1('0xd'),_0x54e333,_0x1b7d7b[_0x89d1('0x11')][_0x89d1('0x13')]);return _0x76aa6b(_0x1b7d7b[_0x89d1('0x11')][_0x89d1('0x13')]);}logger[_0x89d1('0x11')](_0x89d1('0xd'),_0x54e333,_0x1b7d7b['error'][_0x89d1('0x13')]);return _0x14958d(_0x1b7d7b['error']['message']);}else{logger['info'](_0x89d1('0xd'),_0x54e333,_0x89d1('0xe'));_0x14958d(_0x1b7d7b[_0x89d1('0x14')][_0x89d1('0x13')]);}})['catch'](function(_0x38e4d9){logger['error'](_0x89d1('0xd'),_0x54e333,_0x38e4d9);_0x76aa6b(_0x38e4d9);});});} \ No newline at end of file +var _0x5f00=['stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x446c5b,_0x232230){var _0x3d07db=function(_0x28834b){while(--_0x28834b){_0x446c5b['push'](_0x446c5b['shift']());}};_0x3d07db(++_0x232230);}(_0x5f00,0x123));var _0x05f0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f00[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x05f0('0x0'));var util=require(_0x05f0('0x1'));var moment=require(_0x05f0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x05f0('0x3'));var db=require(_0x05f0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x05f0('0x5'))('rpc');var config=require(_0x05f0('0x6'));var jayson=require(_0x05f0('0x7'));var client=jayson[_0x05f0('0x8')][_0x05f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3121f2,_0x5d31eb,_0x235570){return new BPromise(function(_0x2a45b5,_0x11c2a5){return client[_0x05f0('0xa')](_0x3121f2,_0x235570)[_0x05f0('0xb')](function(_0x5877d2){logger[_0x05f0('0xc')](_0x05f0('0xd'),_0x5d31eb,'request\x20sent');logger[_0x05f0('0xe')](_0x05f0('0xf'),_0x5d31eb,_0x05f0('0x10'),JSON[_0x05f0('0x11')](_0x5877d2));if(_0x5877d2['error']){if(_0x5877d2[_0x05f0('0x12')][_0x05f0('0x13')]===0x1f4){logger[_0x05f0('0x12')](_0x05f0('0xd'),_0x5d31eb,_0x5877d2[_0x05f0('0x12')][_0x05f0('0x14')]);return _0x11c2a5(_0x5877d2['error'][_0x05f0('0x14')]);}logger['error'](_0x05f0('0xd'),_0x5d31eb,_0x5877d2['error'][_0x05f0('0x14')]);return _0x2a45b5(_0x5877d2[_0x05f0('0x12')][_0x05f0('0x14')]);}else{logger['info'](_0x05f0('0xd'),_0x5d31eb,'request\x20sent');_0x2a45b5(_0x5877d2['result']['message']);}})[_0x05f0('0x15')](function(_0x3e2cfe){logger[_0x05f0('0x12')](_0x05f0('0xd'),_0x5d31eb,_0x3e2cfe);_0x11c2a5(_0x3e2cfe);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 51ab4e9..347bb84 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 _0xc58b=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxTransferReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x22dbd1,_0x47e0bb){var _0x50a4fd=function(_0x5cadf4){while(--_0x5cadf4){_0x22dbd1['push'](_0x22dbd1['shift']());}};_0x50a4fd(++_0x47e0bb);}(_0xc58b,0xb8));var _0xbc58=function(_0x27b26a,_0x190781){_0x27b26a=_0x27b26a-0x0;var _0xd1a024=_0xc58b[_0x27b26a];return _0xd1a024;};'use strict';var multer=require(_0xbc58('0x0'));var util=require(_0xbc58('0x1'));var path=require(_0xbc58('0x2'));var timeout=require(_0xbc58('0x3'));var express=require(_0xbc58('0x4'));var router=express[_0xbc58('0x5')]();var fs_extra=require(_0xbc58('0x6'));var auth=require(_0xbc58('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbc58('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbc58('0x9')]);router[_0xbc58('0xa')](_0xbc58('0xb'),auth[_0xbc58('0xc')](),controller[_0xbc58('0xd')]);router[_0xbc58('0xa')](_0xbc58('0xe'),auth[_0xbc58('0xc')](),controller[_0xbc58('0xf')]);router[_0xbc58('0x10')]('/',auth['isAuthenticated'](),controller[_0xbc58('0x11')]);router[_0xbc58('0x12')](_0xbc58('0xe'),auth[_0xbc58('0xc')](),controller[_0xbc58('0x13')]);router[_0xbc58('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xbc58('0x15')]);module[_0xbc58('0x16')]=router; \ No newline at end of file +var _0xebca=['post','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','./faxTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','show'];(function(_0x13bc40,_0x3c6a05){var _0x587e27=function(_0x5811d2){while(--_0x5811d2){_0x13bc40['push'](_0x13bc40['shift']());}};_0x587e27(++_0x3c6a05);}(_0xebca,0x1f4));var _0xaebc=function(_0x250514,_0x389eda){_0x250514=_0x250514-0x0;var _0x59c25b=_0xebca[_0x250514];return _0x59c25b;};'use strict';var multer=require(_0xaebc('0x0'));var util=require(_0xaebc('0x1'));var path=require('path');var timeout=require(_0xaebc('0x2'));var express=require('express');var router=express[_0xaebc('0x3')]();var fs_extra=require(_0xaebc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xaebc('0x5'));var config=require('../../config/environment');var controller=require(_0xaebc('0x6'));router['get']('/',auth[_0xaebc('0x7')](),controller['index']);router[_0xaebc('0x8')](_0xaebc('0x9'),auth['isAuthenticated'](),controller[_0xaebc('0xa')]);router[_0xaebc('0x8')](_0xaebc('0xb'),auth[_0xaebc('0x7')](),controller[_0xaebc('0xc')]);router[_0xaebc('0xd')]('/',auth[_0xaebc('0x7')](),controller[_0xaebc('0xe')]);router['put'](_0xaebc('0xb'),auth[_0xaebc('0x7')](),controller[_0xaebc('0xf')]);router[_0xaebc('0x10')](_0xaebc('0xb'),auth['isAuthenticated'](),controller[_0xaebc('0x11')]);module[_0xaebc('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 810f748..8995476 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 _0x33f8=['../../components/auth/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x42706c,_0x3ee8a8){var _0x163442=function(_0x2def5f){while(--_0x2def5f){_0x42706c['push'](_0x42706c['shift']());}};_0x163442(++_0x3ee8a8);}(_0x33f8,0xa9));var _0x833f=function(_0x1d8dcb,_0x1e1456){_0x1d8dcb=_0x1d8dcb-0x0;var _0x57cca3=_0x33f8[_0x1d8dcb];return _0x57cca3;};'use strict';var multer=require(_0x833f('0x0'));var util=require(_0x833f('0x1'));var path=require(_0x833f('0x2'));var timeout=require(_0x833f('0x3'));var express=require('express');var router=express[_0x833f('0x4')]();var fs_extra=require(_0x833f('0x5'));var auth=require(_0x833f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x833f('0x7'));var controller=require(_0x833f('0x8'));router['get']('/',auth[_0x833f('0x9')](),controller[_0x833f('0xa')]);router[_0x833f('0xb')](_0x833f('0xc'),auth[_0x833f('0x9')](),controller[_0x833f('0xd')]);router['get']('/:id/configurations',auth[_0x833f('0x9')](),controller[_0x833f('0xe')]);router['get'](_0x833f('0xf'),auth['isAuthenticated'](),controller[_0x833f('0x10')]);router[_0x833f('0x11')]('/',auth[_0x833f('0x9')](),controller[_0x833f('0x12')]);router['post']('/:id/configurations',auth[_0x833f('0x9')](),controller[_0x833f('0x13')]);router[_0x833f('0x14')](_0x833f('0xc'),auth[_0x833f('0x9')](),controller[_0x833f('0x15')]);router[_0x833f('0x16')](_0x833f('0xc'),auth[_0x833f('0x9')](),controller[_0x833f('0x17')]);module[_0x833f('0x18')]=router; \ No newline at end of file +var _0x3743=['delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put'];(function(_0x58bd44,_0x2a26cd){var _0x561dff=function(_0x45ddc8){while(--_0x45ddc8){_0x58bd44['push'](_0x58bd44['shift']());}};_0x561dff(++_0x2a26cd);}(_0x3743,0x14b));var _0x3374=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0x3743[_0x190ff6];return _0x5356d2;};'use strict';var multer=require('multer');var util=require(_0x3374('0x0'));var path=require(_0x3374('0x1'));var timeout=require(_0x3374('0x2'));var express=require(_0x3374('0x3'));var router=express[_0x3374('0x4')]();var fs_extra=require(_0x3374('0x5'));var auth=require(_0x3374('0x6'));var interaction=require(_0x3374('0x7'));var config=require(_0x3374('0x8'));var controller=require(_0x3374('0x9'));router[_0x3374('0xa')]('/',auth['isAuthenticated'](),controller[_0x3374('0xb')]);router[_0x3374('0xa')](_0x3374('0xc'),auth[_0x3374('0xd')](),controller['show']);router[_0x3374('0xa')]('/:id/configurations',auth[_0x3374('0xd')](),controller[_0x3374('0xe')]);router[_0x3374('0xa')](_0x3374('0xf'),auth['isAuthenticated'](),controller[_0x3374('0x10')]);router[_0x3374('0x11')]('/',auth[_0x3374('0xd')](),controller[_0x3374('0x12')]);router[_0x3374('0x11')](_0x3374('0x13'),auth[_0x3374('0xd')](),controller['addConfiguration']);router[_0x3374('0x14')](_0x3374('0xc'),auth[_0x3374('0xd')](),controller['update']);router[_0x3374('0x15')](_0x3374('0xc'),auth[_0x3374('0xd')](),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 86dd2cf..89f118a 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 _0x419f=['ENUM','integrationTab','newTab','sequelize','exports','STRING','basic'];(function(_0x4657d5,_0x28ef5f){var _0x3dcb73=function(_0x28d790){while(--_0x28d790){_0x4657d5['push'](_0x4657d5['shift']());}};_0x3dcb73(++_0x28ef5f);}(_0x419f,0x176));var _0xf419=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x419f[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xf419('0x0'));module[_0xf419('0x1')]={'name':{'type':Sequelize[_0xf419('0x2')]},'description':{'type':Sequelize[_0xf419('0x2')]},'username':{'type':Sequelize[_0xf419('0x2')]},'remoteUri':{'type':Sequelize[_0xf419('0x2')]},'authType':{'type':Sequelize['ENUM'](_0xf419('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xf419('0x2')]},'consumerKey':{'type':Sequelize[_0xf419('0x2')]},'consumerSecret':{'type':Sequelize[_0xf419('0x2')]},'token':{'type':Sequelize[_0xf419('0x2')]},'tokenSecret':{'type':Sequelize[_0xf419('0x2')]},'serverUrl':{'type':Sequelize[_0xf419('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf419('0x4')](_0xf419('0x5'),_0xf419('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x7292=['exports','STRING','ENUM','basic','integrationTab','sequelize'];(function(_0x447746,_0x561230){var _0x1cc244=function(_0x50cce9){while(--_0x50cce9){_0x447746['push'](_0x447746['shift']());}};_0x1cc244(++_0x561230);}(_0x7292,0x107));var _0x2729=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x7292[_0x1beef3];return _0x5af964;};'use strict';var Sequelize=require(_0x2729('0x0'));module[_0x2729('0x1')]={'name':{'type':Sequelize[_0x2729('0x2')]},'description':{'type':Sequelize[_0x2729('0x2')]},'username':{'type':Sequelize[_0x2729('0x2')]},'remoteUri':{'type':Sequelize[_0x2729('0x2')]},'authType':{'type':Sequelize[_0x2729('0x3')]('basic'),'defaultValue':_0x2729('0x4')},'password':{'type':Sequelize[_0x2729('0x2')]},'consumerKey':{'type':Sequelize[_0x2729('0x2')]},'consumerSecret':{'type':Sequelize[_0x2729('0x2')]},'token':{'type':Sequelize[_0x2729('0x2')]},'tokenSecret':{'type':Sequelize[_0x2729('0x2')]},'serverUrl':{'type':Sequelize[_0x2729('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2729('0x3')](_0x2729('0x5'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 7d954a3..aa4103d 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 _0x3787=['end','json','offset','undefined','limit','count','set','Content-Range','reject','save','stack','send','index','map','DeskAccount','rawAttributes','key','model','name','keys','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','params','create','body','find','destroy','getConfigurations','findOne','DeskConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','base64','concat','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status'];(function(_0x5f41d1,_0x2eaa6f){var _0x2e5c62=function(_0x2bbd62){while(--_0x2bbd62){_0x5f41d1['push'](_0x5f41d1['shift']());}};_0x2e5c62(++_0x2eaa6f);}(_0x3787,0xd3));var _0x7378=function(_0x183790,_0x432da0){_0x183790=_0x183790-0x0;var _0xa017c0=_0x3787[_0x183790];return _0xa017c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7378('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7378('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7378('0x2'));var util=require(_0x7378('0x3'));var path=require(_0x7378('0x4'));var sox=require(_0x7378('0x5'));var csv=require(_0x7378('0x6'));var ejs=require(_0x7378('0x7'));var fs=require('fs');var fs_extra=require(_0x7378('0x8'));var _=require(_0x7378('0x9'));var squel=require(_0x7378('0xa'));var crypto=require(_0x7378('0xb'));var jsforce=require(_0x7378('0xc'));var deskjs=require(_0x7378('0xd'));var toCsv=require(_0x7378('0x6'));var querystring=require(_0x7378('0xe'));var Papa=require(_0x7378('0xf'));var Redis=require(_0x7378('0x10'));var authService=require(_0x7378('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7378('0x12'));var hardwareService=require(_0x7378('0x13'));var logger=require('../../config/logger')(_0x7378('0x14'));var utils=require(_0x7378('0x15'));var config=require(_0x7378('0x16'));var licenseUtil=require(_0x7378('0x17'));var db=require(_0x7378('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client'][_0x7378('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x21a69d,_0x4d42ca,_0x1377f5,_0x319dfb){return new BPromise(function(_0x485021,_0xcf3e11){var _0x48e00a=_0x319dfb||client;return _0x48e00a[_0x7378('0x1a')](_0x21a69d,_0x1377f5)[_0x7378('0x1b')](function(_0x873f4f){logger[_0x7378('0x1c')](_0x7378('0x1d'),_0x4d42ca,_0x7378('0x1e'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x4d42ca,_0x7378('0x1e'),JSON[_0x7378('0x1f')](_0x873f4f));if(_0x873f4f[_0x7378('0x20')]){if(_0x873f4f[_0x7378('0x20')][_0x7378('0x21')]===0x1f4){logger['error'](_0x7378('0x1d'),_0x4d42ca,_0x873f4f[_0x7378('0x20')][_0x7378('0x22')]);return _0xcf3e11(_0x873f4f[_0x7378('0x20')]['message']);}logger[_0x7378('0x20')](_0x7378('0x1d'),_0x4d42ca,_0x873f4f[_0x7378('0x20')]['message']);return _0x485021(_0x873f4f[_0x7378('0x20')]['message']);}else{logger[_0x7378('0x1c')](_0x7378('0x1d'),_0x4d42ca,_0x7378('0x1e'));_0x485021(_0x873f4f[_0x7378('0x23')][_0x7378('0x22')]);}})[_0x7378('0x24')](function(_0x537625){logger['error'](_0x7378('0x1d'),_0x4d42ca,_0x537625);_0xcf3e11(_0x537625);});});}function respondWithStatusCode(_0x3afe0c,_0x57e44e){_0x57e44e=_0x57e44e||0xcc;return function(_0x43f46d){if(_0x43f46d){return _0x3afe0c[_0x7378('0x25')](_0x57e44e);}return _0x3afe0c[_0x7378('0x26')](_0x57e44e)[_0x7378('0x27')]();};}function respondWithResult(_0x4293f3,_0x5c7b19){_0x5c7b19=_0x5c7b19||0xc8;return function(_0x5868bf){if(_0x5868bf){return _0x4293f3[_0x7378('0x26')](_0x5c7b19)[_0x7378('0x28')](_0x5868bf);}};}function respondWithFilteredResult(_0x2f1c82,_0x3015a2){return function(_0x2a7c60){if(_0x2a7c60){var _0x4e2fd2=typeof _0x3015a2[_0x7378('0x29')]===_0x7378('0x2a')&&typeof _0x3015a2[_0x7378('0x2b')]==='undefined';var _0x148842=_0x2a7c60[_0x7378('0x2c')];var _0x149c49=_0x4e2fd2?0x0:_0x3015a2[_0x7378('0x29')];var _0x1b3e19=_0x4e2fd2?_0x2a7c60['count']:_0x3015a2['offset']+_0x3015a2[_0x7378('0x2b')];var _0x3f9ea7;if(_0x1b3e19>=_0x148842){_0x1b3e19=_0x148842;_0x3f9ea7=0xc8;}else{_0x3f9ea7=0xce;}_0x2f1c82[_0x7378('0x26')](_0x3f9ea7);return _0x2f1c82[_0x7378('0x2d')](_0x7378('0x2e'),_0x149c49+'-'+_0x1b3e19+'/'+_0x148842)['json'](_0x2a7c60);}return null;};}function patchUpdates(_0x4760ce){return function(_0x1fb897){try{jsonpatch['apply'](_0x1fb897,_0x4760ce,!![]);}catch(_0x467e5a){return BPromise[_0x7378('0x2f')](_0x467e5a);}return _0x1fb897[_0x7378('0x30')]();};}function saveUpdates(_0x24acb0,_0xab2366){return function(_0x5bd583){if(_0x5bd583){return _0x5bd583['update'](_0x24acb0)[_0x7378('0x1b')](function(_0xaf7ab6){return _0xaf7ab6;});}return null;};}function removeEntity(_0x17ff22,_0x1e1d49){return function(_0x18a538){if(_0x18a538){return _0x18a538['destroy']()[_0x7378('0x1b')](function(){_0x17ff22[_0x7378('0x26')](0xcc)[_0x7378('0x27')]();});}};}function handleEntityNotFound(_0x3713b4,_0x271eb1){return function(_0x5d739a){if(!_0x5d739a){_0x3713b4[_0x7378('0x25')](0x194);}return _0x5d739a;};}function handleError(_0x5f05b3,_0x45bba8){_0x45bba8=_0x45bba8||0x1f4;return function(_0x3ca40a){logger['error'](_0x3ca40a[_0x7378('0x31')]);if(_0x3ca40a['name']){delete _0x3ca40a['name'];}_0x5f05b3['status'](_0x45bba8)[_0x7378('0x32')](_0x3ca40a);};}exports[_0x7378('0x33')]=function(_0x307820,_0x3ce0e0){var _0x4927fa={},_0x1136b7={},_0x701c19={'count':0x0,'rows':[]};var _0x40f85d=_[_0x7378('0x34')](db[_0x7378('0x35')][_0x7378('0x36')],function(_0x190827){return{'name':_0x190827['fieldName'],'type':_0x190827['type'][_0x7378('0x37')]};});_0x1136b7[_0x7378('0x38')]=_['map'](_0x40f85d,_0x7378('0x39'));_0x1136b7['query']=_[_0x7378('0x3a')](_0x307820[_0x7378('0x3b')]);_0x1136b7[_0x7378('0x3c')]=_[_0x7378('0x3d')](_0x1136b7[_0x7378('0x38')],_0x1136b7[_0x7378('0x3b')]);_0x4927fa['attributes']=_[_0x7378('0x3d')](_0x1136b7[_0x7378('0x38')],qs[_0x7378('0x3e')](_0x307820['query'][_0x7378('0x3e')]));_0x4927fa[_0x7378('0x3f')]=_0x4927fa[_0x7378('0x3f')][_0x7378('0x40')]?_0x4927fa[_0x7378('0x3f')]:_0x1136b7['model'];if(!_0x307820[_0x7378('0x3b')]['hasOwnProperty']('nolimit')){_0x4927fa[_0x7378('0x2b')]=qs['limit'](_0x307820[_0x7378('0x3b')]['limit']);_0x4927fa[_0x7378('0x29')]=qs[_0x7378('0x29')](_0x307820[_0x7378('0x3b')][_0x7378('0x29')]);}_0x4927fa[_0x7378('0x41')]=qs[_0x7378('0x42')](_0x307820[_0x7378('0x3b')][_0x7378('0x42')]);_0x4927fa[_0x7378('0x43')]=qs['filters'](_[_0x7378('0x44')](_0x307820[_0x7378('0x3b')],_0x1136b7[_0x7378('0x3c')]),_0x40f85d);if(_0x307820['query'][_0x7378('0x45')]){_0x4927fa['where']=_[_0x7378('0x46')](_0x4927fa[_0x7378('0x43')],{'$or':_[_0x7378('0x34')](_0x40f85d,function(_0x30155b){if(_0x30155b[_0x7378('0x47')]!=='VIRTUAL'){var _0x57e3e7={};_0x57e3e7[_0x30155b[_0x7378('0x39')]]={'$like':'%'+_0x307820[_0x7378('0x3b')]['filter']+'%'};return _0x57e3e7;}})});}_0x4927fa=_[_0x7378('0x46')]({},_0x4927fa,_0x307820[_0x7378('0x48')]);var _0x54959d={'where':_0x4927fa['where']};return db[_0x7378('0x35')]['count'](_0x54959d)[_0x7378('0x1b')](function(_0x19f1f7){_0x701c19[_0x7378('0x2c')]=_0x19f1f7;if(_0x307820[_0x7378('0x3b')][_0x7378('0x49')]){_0x4927fa[_0x7378('0x4a')]=[{'all':!![]}];}return db[_0x7378('0x35')][_0x7378('0x4b')](_0x4927fa);})['then'](function(_0x1a4d30){_0x701c19[_0x7378('0x4c')]=_0x1a4d30;return _0x701c19;})[_0x7378('0x1b')](respondWithFilteredResult(_0x3ce0e0,_0x4927fa))[_0x7378('0x24')](handleError(_0x3ce0e0,null));};exports[_0x7378('0x4d')]=function(_0xae4299,_0xb39228){var _0x4842be={'raw':![],'where':{'id':_0xae4299[_0x7378('0x4e')]['id']}},_0x1ebfe5={};_0x1ebfe5[_0x7378('0x38')]=_[_0x7378('0x3a')](db[_0x7378('0x35')][_0x7378('0x36')]);_0x1ebfe5['query']=_['keys'](_0xae4299[_0x7378('0x3b')]);_0x1ebfe5[_0x7378('0x3c')]=_['intersection'](_0x1ebfe5[_0x7378('0x38')],_0x1ebfe5['query']);_0x4842be[_0x7378('0x3f')]=_[_0x7378('0x3d')](_0x1ebfe5[_0x7378('0x38')],qs[_0x7378('0x3e')](_0xae4299[_0x7378('0x3b')]['fields']));_0x4842be[_0x7378('0x3f')]=_0x4842be[_0x7378('0x3f')][_0x7378('0x40')]?_0x4842be[_0x7378('0x3f')]:_0x1ebfe5[_0x7378('0x38')];if(_0xae4299[_0x7378('0x3b')][_0x7378('0x49')]){_0x4842be[_0x7378('0x4a')]=[{'all':!![]}];}_0x4842be=_[_0x7378('0x46')]({},_0x4842be,_0xae4299['options']);return db[_0x7378('0x35')]['find'](_0x4842be)[_0x7378('0x1b')](handleEntityNotFound(_0xb39228,null))[_0x7378('0x1b')](respondWithResult(_0xb39228,null))['catch'](handleError(_0xb39228,null));};exports[_0x7378('0x4f')]=function(_0x34d2ab,_0x349d25){return db[_0x7378('0x35')][_0x7378('0x4f')](_0x34d2ab[_0x7378('0x50')],{})[_0x7378('0x1b')](respondWithResult(_0x349d25,0xc9))[_0x7378('0x24')](handleError(_0x349d25,null));};exports['update']=function(_0x54e2e9,_0x512212){if(_0x54e2e9[_0x7378('0x50')]['id']){delete _0x54e2e9[_0x7378('0x50')]['id'];}return db[_0x7378('0x35')][_0x7378('0x51')]({'where':{'id':_0x54e2e9[_0x7378('0x4e')]['id']}})[_0x7378('0x1b')](handleEntityNotFound(_0x512212,null))[_0x7378('0x1b')](saveUpdates(_0x54e2e9['body'],null))[_0x7378('0x1b')](respondWithResult(_0x512212,null))[_0x7378('0x24')](handleError(_0x512212,null));};exports[_0x7378('0x52')]=function(_0x5dca38,_0x5c9f02){return db[_0x7378('0x35')][_0x7378('0x51')]({'where':{'id':_0x5dca38['params']['id']}})[_0x7378('0x1b')](handleEntityNotFound(_0x5c9f02,null))[_0x7378('0x1b')](removeEntity(_0x5c9f02,null))[_0x7378('0x24')](handleError(_0x5c9f02,null));};exports[_0x7378('0x53')]=function(_0xbe4d5c,_0x47d419,_0x23a33a){var _0x149f3c={};var _0x7e6487={};var _0x2c43b6;var _0x273cde;return db[_0x7378('0x35')][_0x7378('0x54')]({'where':{'id':_0xbe4d5c[_0x7378('0x4e')]['id']}})['then'](handleEntityNotFound(_0x47d419,null))['then'](function(_0x453f95){if(_0x453f95){_0x2c43b6=_0x453f95;_0x7e6487[_0x7378('0x38')]=_[_0x7378('0x3a')](db[_0x7378('0x55')]['rawAttributes']);_0x7e6487['query']=_['keys'](_0xbe4d5c[_0x7378('0x3b')]);_0x7e6487[_0x7378('0x3c')]=_[_0x7378('0x3d')](_0x7e6487[_0x7378('0x38')],_0x7e6487[_0x7378('0x3b')]);_0x149f3c[_0x7378('0x3f')]=_[_0x7378('0x3d')](_0x7e6487[_0x7378('0x38')],qs[_0x7378('0x3e')](_0xbe4d5c['query'][_0x7378('0x3e')]));_0x149f3c[_0x7378('0x3f')]=_0x149f3c['attributes']['length']?_0x149f3c[_0x7378('0x3f')]:_0x7e6487[_0x7378('0x38')];_0x149f3c[_0x7378('0x41')]=qs[_0x7378('0x42')](_0xbe4d5c[_0x7378('0x3b')]['sort']);_0x149f3c['where']=qs['filters'](_[_0x7378('0x44')](_0xbe4d5c[_0x7378('0x3b')],_0x7e6487[_0x7378('0x3c')]));if(_0xbe4d5c['query'][_0x7378('0x45')]){_0x149f3c[_0x7378('0x43')]=_[_0x7378('0x46')](_0x149f3c['where'],{'$or':_['map'](_0x149f3c['attributes'],function(_0x43c8bb){var _0x54474f={};_0x54474f[_0x43c8bb]={'$like':'%'+_0xbe4d5c[_0x7378('0x3b')][_0x7378('0x45')]+'%'};return _0x54474f;})});}_0x149f3c=_[_0x7378('0x46')]({},_0x149f3c,_0xbe4d5c[_0x7378('0x48')]);return _0x2c43b6[_0x7378('0x53')](_0x149f3c);}})[_0x7378('0x1b')](function(_0x86b0e){if(_0x86b0e){_0x273cde=_0x86b0e[_0x7378('0x40')];if(!_0xbe4d5c[_0x7378('0x3b')][_0x7378('0x56')](_0x7378('0x57'))){_0x149f3c[_0x7378('0x2b')]=qs[_0x7378('0x2b')](_0xbe4d5c[_0x7378('0x3b')][_0x7378('0x2b')]);_0x149f3c[_0x7378('0x29')]=qs[_0x7378('0x29')](_0xbe4d5c[_0x7378('0x3b')][_0x7378('0x29')]);}return _0x2c43b6[_0x7378('0x53')](_0x149f3c);}})['then'](function(_0x35ca1a){if(_0x35ca1a){return _0x35ca1a?{'count':_0x273cde,'rows':_0x35ca1a}:null;}})[_0x7378('0x1b')](respondWithResult(_0x47d419,null))[_0x7378('0x24')](handleError(_0x47d419,null));};exports[_0x7378('0x58')]=function(_0x23ccb9,_0x25b0c8,_0x182cf2){if(_0x23ccb9[_0x7378('0x50')]['id']){delete _0x23ccb9[_0x7378('0x50')]['id'];}return db[_0x7378('0x35')][_0x7378('0x54')]({'where':{'id':_0x23ccb9[_0x7378('0x4e')]['id']}})[_0x7378('0x1b')](handleEntityNotFound(_0x25b0c8,null))[_0x7378('0x1b')](function(_0x4c02c0){if(_0x4c02c0){_0x23ccb9[_0x7378('0x50')][_0x7378('0x59')]=_0x4c02c0['id'];_0x23ccb9[_0x7378('0x50')][_0x7378('0x5a')]=integrations['getSubjects'](_0x23ccb9[_0x7378('0x50')][_0x7378('0x5b')],_0x23ccb9['body']['type']);_0x23ccb9[_0x7378('0x50')]['Descriptions']=integrations['getDescriptions'](_0x23ccb9[_0x7378('0x50')][_0x7378('0x5b')],_0x23ccb9[_0x7378('0x50')][_0x7378('0x47')]);return db['DeskConfiguration'][_0x7378('0x4f')](_0x23ccb9[_0x7378('0x50')],{'include':[{'model':db[_0x7378('0x5c')],'as':_0x7378('0x5a')},{'model':db[_0x7378('0x5c')],'as':_0x7378('0x5d')}]});}return null;})[_0x7378('0x1b')](respondWithResult(_0x25b0c8,null))[_0x7378('0x24')](handleError(_0x25b0c8,null));};exports[_0x7378('0x5e')]=function(_0x47d840,_0x1ccca7,_0x29d5aa){var _0x471ca1=[{'name':'priority','label':_0x7378('0x5f'),'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 _0x4d3124='';return db[_0x7378('0x35')][_0x7378('0x54')]({'where':{'id':_0x47d840[_0x7378('0x4e')]['id']},'attributes':['id',_0x7378('0x60'),_0x7378('0x61'),_0x7378('0x62'),_0x7378('0x63'),_0x7378('0x64'),_0x7378('0x65'),_0x7378('0x66'),_0x7378('0x67')]})[_0x7378('0x1b')](handleEntityNotFound(_0x1ccca7,null))['then'](function(_0x19ee71){if(_0x19ee71){_0x4d3124=_0x19ee71['remoteUri'];var _0x2c08dc=_0x4d3124[_0x7378('0x68')](-0x1);if(_0x2c08dc==='/'){_0x4d3124=_0x4d3124[_0x7378('0x69')](0x0,_0x4d3124[_0x7378('0x6a')](_0x2c08dc));}var _0x51779c={'method':_0x7378('0x6b'),'uri':util[_0x7378('0x6c')](_0x7378('0x6d'),_0x4d3124),'headers':{'Content-Type':_0x7378('0x6e'),'Accept':_0x7378('0x6e')},'json':!![]};if(_0x19ee71[_0x7378('0x61')]===_0x7378('0x6f')){_0x51779c[_0x7378('0x70')][_0x7378('0x71')]=util[_0x7378('0x6c')](_0x7378('0x72'),new Buffer(util[_0x7378('0x6c')](_0x7378('0x73'),_0x19ee71['username'],_0x19ee71['password']))['toString'](_0x7378('0x74')));}return rp(_0x51779c)[_0x7378('0x1b')](function(_0x328a2c){return _0x471ca1[_0x7378('0x75')](_[_0x7378('0x34')](_0x328a2c[_0x7378('0x76')][_0x7378('0x77')],function(_0x198803){return{'id':_0x198803[_0x7378('0x39')],'name':_0x198803['name'],'type':_0x198803[_0x7378('0x47')],'active':_0x198803[_0x7378('0x78')],'label':_0x198803[_0x7378('0x79')],'custom':!![]};}));});}})[_0x7378('0x1b')](function(_0x2d693e){return{'count':_0x2d693e['length'],'rows':_0x2d693e};})[_0x7378('0x1b')](respondWithResult(_0x1ccca7,null))[_0x7378('0x24')](function(_0x47e980){var _0xf8420f=_0x47d840[_0x7378('0x3b')]['test']?0x1f4:_0x47e980[_0x7378('0x7a')]||0x1f4;logger[_0x7378('0x20')](_0x7378('0x7b'),_0x7378('0x5e'),_0xf8420f,JSON[_0x7378('0x1f')](_0x47e980));delete _0x47e980[_0x7378('0x39')];if(_0xf8420f===0x191){_0xf8420f=0x190;}_0x1ccca7[_0x7378('0x26')](_0xf8420f)[_0x7378('0x32')](_0x47d840[_0x7378('0x3b')]['test']?{'message':_0x7378('0x7c'),'statusCode':_0x47e980[_0x7378('0x7a')]}:_0x47e980);});}; \ No newline at end of file +var _0x3423=['%s/custom_fields','application/json','basic','headers','Basic\x20%s','%s:%s','password','toString','base64','concat','_embedded','entries','active','test','statusCode','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','jayson/promise','request','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','stack','name','send','index','DeskAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','keys','options','create','body','find','getConfigurations','findOne','DeskConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','remoteUri','username','token','tokenSecret','substring','GET','format'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x3423,0x1f0));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3342('0x0'));var rimraf=require(_0x3342('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3342('0x2'));var rp=require(_0x3342('0x3'));var moment=require(_0x3342('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3342('0x5'));var util=require(_0x3342('0x6'));var path=require(_0x3342('0x7'));var sox=require('sox');var csv=require(_0x3342('0x8'));var ejs=require(_0x3342('0x9'));var fs=require('fs');var fs_extra=require(_0x3342('0xa'));var _=require(_0x3342('0xb'));var squel=require(_0x3342('0xc'));var crypto=require(_0x3342('0xd'));var jsforce=require(_0x3342('0xe'));var deskjs=require(_0x3342('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3342('0x10'));var Papa=require(_0x3342('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3342('0x12'));var as=require(_0x3342('0x13'));var hardwareService=require(_0x3342('0x14'));var logger=require('../../config/logger')(_0x3342('0x15'));var utils=require('../../config/utils');var config=require(_0x3342('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x3342('0x17'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x124745,_0x27e6b1,_0x2dd9d0,_0x24e1ea){return new BPromise(function(_0x10be5d,_0x5705f3){var _0x239468=_0x24e1ea||client;return _0x239468[_0x3342('0x18')](_0x124745,_0x2dd9d0)[_0x3342('0x19')](function(_0xb1428f){logger[_0x3342('0x1a')](_0x3342('0x1b'),_0x27e6b1,'request\x20sent');logger[_0x3342('0x1c')](_0x3342('0x1d'),_0x27e6b1,_0x3342('0x1e'),JSON[_0x3342('0x1f')](_0xb1428f));if(_0xb1428f['error']){if(_0xb1428f[_0x3342('0x20')][_0x3342('0x21')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x27e6b1,_0xb1428f[_0x3342('0x20')][_0x3342('0x22')]);return _0x5705f3(_0xb1428f[_0x3342('0x20')]['message']);}logger[_0x3342('0x20')](_0x3342('0x1b'),_0x27e6b1,_0xb1428f[_0x3342('0x20')][_0x3342('0x22')]);return _0x10be5d(_0xb1428f['error'][_0x3342('0x22')]);}else{logger[_0x3342('0x1a')](_0x3342('0x1b'),_0x27e6b1,_0x3342('0x1e'));_0x10be5d(_0xb1428f[_0x3342('0x23')]['message']);}})[_0x3342('0x24')](function(_0x2a4273){logger['error'](_0x3342('0x1b'),_0x27e6b1,_0x2a4273);_0x5705f3(_0x2a4273);});});}function respondWithStatusCode(_0x58d2a0,_0x1b8298){_0x1b8298=_0x1b8298||0xcc;return function(_0x5172f9){if(_0x5172f9){return _0x58d2a0[_0x3342('0x25')](_0x1b8298);}return _0x58d2a0[_0x3342('0x26')](_0x1b8298)[_0x3342('0x27')]();};}function respondWithResult(_0x3cf3fb,_0x5c310a){_0x5c310a=_0x5c310a||0xc8;return function(_0x4f52e1){if(_0x4f52e1){return _0x3cf3fb[_0x3342('0x26')](_0x5c310a)[_0x3342('0x28')](_0x4f52e1);}};}function respondWithFilteredResult(_0x4d156d,_0xcbc395){return function(_0x510f65){if(_0x510f65){var _0xf7a119=typeof _0xcbc395[_0x3342('0x29')]===_0x3342('0x2a')&&typeof _0xcbc395[_0x3342('0x2b')]===_0x3342('0x2a');var _0x3d3317=_0x510f65[_0x3342('0x2c')];var _0x4602f6=_0xf7a119?0x0:_0xcbc395['offset'];var _0x248ff7=_0xf7a119?_0x510f65[_0x3342('0x2c')]:_0xcbc395[_0x3342('0x29')]+_0xcbc395[_0x3342('0x2b')];var _0x50e869;if(_0x248ff7>=_0x3d3317){_0x248ff7=_0x3d3317;_0x50e869=0xc8;}else{_0x50e869=0xce;}_0x4d156d[_0x3342('0x26')](_0x50e869);return _0x4d156d[_0x3342('0x2d')](_0x3342('0x2e'),_0x4602f6+'-'+_0x248ff7+'/'+_0x3d3317)[_0x3342('0x28')](_0x510f65);}return null;};}function patchUpdates(_0x2e2701){return function(_0x41f562){try{jsonpatch['apply'](_0x41f562,_0x2e2701,!![]);}catch(_0x47f31b){return BPromise[_0x3342('0x2f')](_0x47f31b);}return _0x41f562['save']();};}function saveUpdates(_0x4ddfba,_0x5a9fce){return function(_0x53aecd){if(_0x53aecd){return _0x53aecd[_0x3342('0x30')](_0x4ddfba)[_0x3342('0x19')](function(_0x5e3a37){return _0x5e3a37;});}return null;};}function removeEntity(_0x660db1,_0x14ca8e){return function(_0x3adf77){if(_0x3adf77){return _0x3adf77[_0x3342('0x31')]()[_0x3342('0x19')](function(){_0x660db1[_0x3342('0x26')](0xcc)[_0x3342('0x27')]();});}};}function handleEntityNotFound(_0x5b4d0e,_0x278231){return function(_0x2ff98b){if(!_0x2ff98b){_0x5b4d0e[_0x3342('0x25')](0x194);}return _0x2ff98b;};}function handleError(_0x3e8e13,_0x2fd1d8){_0x2fd1d8=_0x2fd1d8||0x1f4;return function(_0x100b0c){logger[_0x3342('0x20')](_0x100b0c[_0x3342('0x32')]);if(_0x100b0c[_0x3342('0x33')]){delete _0x100b0c[_0x3342('0x33')];}_0x3e8e13['status'](_0x2fd1d8)[_0x3342('0x34')](_0x100b0c);};}exports[_0x3342('0x35')]=function(_0x45078a,_0x88ddfb){var _0xf3bfe3={},_0x1a78be={},_0xeb3301={'count':0x0,'rows':[]};var _0x5d9b53=_['map'](db[_0x3342('0x36')][_0x3342('0x37')],function(_0x27e573){return{'name':_0x27e573[_0x3342('0x38')],'type':_0x27e573[_0x3342('0x39')][_0x3342('0x3a')]};});_0x1a78be[_0x3342('0x3b')]=_[_0x3342('0x3c')](_0x5d9b53,'name');_0x1a78be['query']=_['keys'](_0x45078a[_0x3342('0x3d')]);_0x1a78be[_0x3342('0x3e')]=_[_0x3342('0x3f')](_0x1a78be[_0x3342('0x3b')],_0x1a78be['query']);_0xf3bfe3[_0x3342('0x40')]=_[_0x3342('0x3f')](_0x1a78be['model'],qs[_0x3342('0x41')](_0x45078a['query']['fields']));_0xf3bfe3['attributes']=_0xf3bfe3[_0x3342('0x40')][_0x3342('0x42')]?_0xf3bfe3['attributes']:_0x1a78be[_0x3342('0x3b')];if(!_0x45078a[_0x3342('0x3d')]['hasOwnProperty'](_0x3342('0x43'))){_0xf3bfe3[_0x3342('0x2b')]=qs[_0x3342('0x2b')](_0x45078a['query'][_0x3342('0x2b')]);_0xf3bfe3[_0x3342('0x29')]=qs[_0x3342('0x29')](_0x45078a['query'][_0x3342('0x29')]);}_0xf3bfe3[_0x3342('0x44')]=qs[_0x3342('0x45')](_0x45078a[_0x3342('0x3d')][_0x3342('0x45')]);_0xf3bfe3[_0x3342('0x46')]=qs[_0x3342('0x3e')](_[_0x3342('0x47')](_0x45078a[_0x3342('0x3d')],_0x1a78be[_0x3342('0x3e')]),_0x5d9b53);if(_0x45078a[_0x3342('0x3d')][_0x3342('0x48')]){_0xf3bfe3[_0x3342('0x46')]=_[_0x3342('0x49')](_0xf3bfe3['where'],{'$or':_['map'](_0x5d9b53,function(_0x4b2f99){if(_0x4b2f99[_0x3342('0x39')]!=='VIRTUAL'){var _0x5a8bca={};_0x5a8bca[_0x4b2f99[_0x3342('0x33')]]={'$like':'%'+_0x45078a[_0x3342('0x3d')][_0x3342('0x48')]+'%'};return _0x5a8bca;}})});}_0xf3bfe3=_[_0x3342('0x49')]({},_0xf3bfe3,_0x45078a['options']);var _0x156eb1={'where':_0xf3bfe3['where']};return db['DeskAccount'][_0x3342('0x2c')](_0x156eb1)[_0x3342('0x19')](function(_0x1dbed9){_0xeb3301[_0x3342('0x2c')]=_0x1dbed9;if(_0x45078a[_0x3342('0x3d')][_0x3342('0x4a')]){_0xf3bfe3[_0x3342('0x4b')]=[{'all':!![]}];}return db[_0x3342('0x36')][_0x3342('0x4c')](_0xf3bfe3);})[_0x3342('0x19')](function(_0x229587){_0xeb3301[_0x3342('0x4d')]=_0x229587;return _0xeb3301;})[_0x3342('0x19')](respondWithFilteredResult(_0x88ddfb,_0xf3bfe3))[_0x3342('0x24')](handleError(_0x88ddfb,null));};exports[_0x3342('0x4e')]=function(_0x3988f5,_0x525d95){var _0x5cb788={'raw':![],'where':{'id':_0x3988f5[_0x3342('0x4f')]['id']}},_0x22a51f={};_0x22a51f['model']=_[_0x3342('0x50')](db[_0x3342('0x36')][_0x3342('0x37')]);_0x22a51f['query']=_[_0x3342('0x50')](_0x3988f5[_0x3342('0x3d')]);_0x22a51f[_0x3342('0x3e')]=_[_0x3342('0x3f')](_0x22a51f[_0x3342('0x3b')],_0x22a51f[_0x3342('0x3d')]);_0x5cb788[_0x3342('0x40')]=_[_0x3342('0x3f')](_0x22a51f[_0x3342('0x3b')],qs[_0x3342('0x41')](_0x3988f5[_0x3342('0x3d')][_0x3342('0x41')]));_0x5cb788[_0x3342('0x40')]=_0x5cb788['attributes'][_0x3342('0x42')]?_0x5cb788[_0x3342('0x40')]:_0x22a51f['model'];if(_0x3988f5[_0x3342('0x3d')][_0x3342('0x4a')]){_0x5cb788[_0x3342('0x4b')]=[{'all':!![]}];}_0x5cb788=_[_0x3342('0x49')]({},_0x5cb788,_0x3988f5[_0x3342('0x51')]);return db[_0x3342('0x36')]['find'](_0x5cb788)[_0x3342('0x19')](handleEntityNotFound(_0x525d95,null))[_0x3342('0x19')](respondWithResult(_0x525d95,null))[_0x3342('0x24')](handleError(_0x525d95,null));};exports[_0x3342('0x52')]=function(_0x3a53fc,_0x2e1c59){return db[_0x3342('0x36')][_0x3342('0x52')](_0x3a53fc[_0x3342('0x53')],{})[_0x3342('0x19')](respondWithResult(_0x2e1c59,0xc9))[_0x3342('0x24')](handleError(_0x2e1c59,null));};exports[_0x3342('0x30')]=function(_0x21e962,_0x4e80b6){if(_0x21e962[_0x3342('0x53')]['id']){delete _0x21e962['body']['id'];}return db[_0x3342('0x36')][_0x3342('0x54')]({'where':{'id':_0x21e962['params']['id']}})[_0x3342('0x19')](handleEntityNotFound(_0x4e80b6,null))[_0x3342('0x19')](saveUpdates(_0x21e962['body'],null))[_0x3342('0x19')](respondWithResult(_0x4e80b6,null))[_0x3342('0x24')](handleError(_0x4e80b6,null));};exports[_0x3342('0x31')]=function(_0x2da140,_0x54e703){return db[_0x3342('0x36')][_0x3342('0x54')]({'where':{'id':_0x2da140[_0x3342('0x4f')]['id']}})[_0x3342('0x19')](handleEntityNotFound(_0x54e703,null))[_0x3342('0x19')](removeEntity(_0x54e703,null))[_0x3342('0x24')](handleError(_0x54e703,null));};exports[_0x3342('0x55')]=function(_0x3d4f61,_0xe822fc,_0x521e3b){var _0x367d99={};var _0x5576e2={};var _0x2d56c2;var _0x255f5f;return db[_0x3342('0x36')][_0x3342('0x56')]({'where':{'id':_0x3d4f61[_0x3342('0x4f')]['id']}})['then'](handleEntityNotFound(_0xe822fc,null))[_0x3342('0x19')](function(_0x2fedf5){if(_0x2fedf5){_0x2d56c2=_0x2fedf5;_0x5576e2['model']=_[_0x3342('0x50')](db[_0x3342('0x57')]['rawAttributes']);_0x5576e2[_0x3342('0x3d')]=_[_0x3342('0x50')](_0x3d4f61[_0x3342('0x3d')]);_0x5576e2[_0x3342('0x3e')]=_[_0x3342('0x3f')](_0x5576e2['model'],_0x5576e2['query']);_0x367d99[_0x3342('0x40')]=_[_0x3342('0x3f')](_0x5576e2['model'],qs['fields'](_0x3d4f61[_0x3342('0x3d')][_0x3342('0x41')]));_0x367d99[_0x3342('0x40')]=_0x367d99[_0x3342('0x40')][_0x3342('0x42')]?_0x367d99[_0x3342('0x40')]:_0x5576e2['model'];_0x367d99[_0x3342('0x44')]=qs[_0x3342('0x45')](_0x3d4f61[_0x3342('0x3d')][_0x3342('0x45')]);_0x367d99['where']=qs[_0x3342('0x3e')](_['pick'](_0x3d4f61[_0x3342('0x3d')],_0x5576e2[_0x3342('0x3e')]));if(_0x3d4f61[_0x3342('0x3d')][_0x3342('0x48')]){_0x367d99[_0x3342('0x46')]=_['merge'](_0x367d99[_0x3342('0x46')],{'$or':_[_0x3342('0x3c')](_0x367d99[_0x3342('0x40')],function(_0x244ea5){var _0x44ac5b={};_0x44ac5b[_0x244ea5]={'$like':'%'+_0x3d4f61[_0x3342('0x3d')][_0x3342('0x48')]+'%'};return _0x44ac5b;})});}_0x367d99=_['merge']({},_0x367d99,_0x3d4f61[_0x3342('0x51')]);return _0x2d56c2[_0x3342('0x55')](_0x367d99);}})[_0x3342('0x19')](function(_0x273683){if(_0x273683){_0x255f5f=_0x273683[_0x3342('0x42')];if(!_0x3d4f61[_0x3342('0x3d')]['hasOwnProperty'](_0x3342('0x43'))){_0x367d99[_0x3342('0x2b')]=qs[_0x3342('0x2b')](_0x3d4f61['query']['limit']);_0x367d99['offset']=qs['offset'](_0x3d4f61[_0x3342('0x3d')][_0x3342('0x29')]);}return _0x2d56c2[_0x3342('0x55')](_0x367d99);}})[_0x3342('0x19')](function(_0x24473e){if(_0x24473e){return _0x24473e?{'count':_0x255f5f,'rows':_0x24473e}:null;}})[_0x3342('0x19')](respondWithResult(_0xe822fc,null))[_0x3342('0x24')](handleError(_0xe822fc,null));};exports['addConfiguration']=function(_0x2ef20a,_0x1f36ae,_0x3f49d6){if(_0x2ef20a[_0x3342('0x53')]['id']){delete _0x2ef20a[_0x3342('0x53')]['id'];}return db[_0x3342('0x36')][_0x3342('0x56')]({'where':{'id':_0x2ef20a[_0x3342('0x4f')]['id']}})[_0x3342('0x19')](handleEntityNotFound(_0x1f36ae,null))[_0x3342('0x19')](function(_0x443814){if(_0x443814){_0x2ef20a[_0x3342('0x53')][_0x3342('0x58')]=_0x443814['id'];_0x2ef20a[_0x3342('0x53')][_0x3342('0x59')]=integrations[_0x3342('0x5a')](_0x2ef20a['body']['channel'],_0x2ef20a[_0x3342('0x53')][_0x3342('0x39')]);_0x2ef20a['body'][_0x3342('0x5b')]=integrations[_0x3342('0x5c')](_0x2ef20a[_0x3342('0x53')][_0x3342('0x5d')],_0x2ef20a[_0x3342('0x53')][_0x3342('0x39')]);return db['DeskConfiguration']['create'](_0x2ef20a['body'],{'include':[{'model':db[_0x3342('0x5e')],'as':'Subjects'},{'model':db[_0x3342('0x5e')],'as':_0x3342('0x5b')}]});}return null;})[_0x3342('0x19')](respondWithResult(_0x1f36ae,null))['catch'](handleError(_0x1f36ae,null));};exports[_0x3342('0x5f')]=function(_0x3aae5f,_0x4453c7,_0x2531c4){var _0x4b0ab1=[{'name':_0x3342('0x60'),'label':_0x3342('0x60'),'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 _0x560246='';return db['DeskAccount'][_0x3342('0x56')]({'where':{'id':_0x3aae5f[_0x3342('0x4f')]['id']},'attributes':['id',_0x3342('0x61'),'authType',_0x3342('0x62'),'password','consumerKey','consumerSecret',_0x3342('0x63'),_0x3342('0x64')]})[_0x3342('0x19')](handleEntityNotFound(_0x4453c7,null))[_0x3342('0x19')](function(_0x7a68cd){if(_0x7a68cd){_0x560246=_0x7a68cd[_0x3342('0x61')];var _0x1cf87f=_0x560246['slice'](-0x1);if(_0x1cf87f==='/'){_0x560246=_0x560246[_0x3342('0x65')](0x0,_0x560246['lastIndexOf'](_0x1cf87f));}var _0x4c1352={'method':_0x3342('0x66'),'uri':util[_0x3342('0x67')](_0x3342('0x68'),_0x560246),'headers':{'Content-Type':_0x3342('0x69'),'Accept':'application/json'},'json':!![]};if(_0x7a68cd['authType']===_0x3342('0x6a')){_0x4c1352[_0x3342('0x6b')]['Authorization']=util['format'](_0x3342('0x6c'),new Buffer(util[_0x3342('0x67')](_0x3342('0x6d'),_0x7a68cd[_0x3342('0x62')],_0x7a68cd[_0x3342('0x6e')]))[_0x3342('0x6f')](_0x3342('0x70')));}return rp(_0x4c1352)['then'](function(_0x31dc55){return _0x4b0ab1[_0x3342('0x71')](_[_0x3342('0x3c')](_0x31dc55[_0x3342('0x72')][_0x3342('0x73')],function(_0x4cf398){return{'id':_0x4cf398[_0x3342('0x33')],'name':_0x4cf398['name'],'type':_0x4cf398[_0x3342('0x39')],'active':_0x4cf398[_0x3342('0x74')],'label':_0x4cf398['label'],'custom':!![]};}));});}})[_0x3342('0x19')](function(_0x308cf9){return{'count':_0x308cf9[_0x3342('0x42')],'rows':_0x308cf9};})[_0x3342('0x19')](respondWithResult(_0x4453c7,null))[_0x3342('0x24')](function(_0x4fd99){var _0x215964=_0x3aae5f[_0x3342('0x3d')][_0x3342('0x75')]?0x1f4:_0x4fd99[_0x3342('0x76')]||0x1f4;logger[_0x3342('0x20')]('getFields,\x20%s,\x20%s,\x20%s',_0x3342('0x5f'),_0x215964,JSON['stringify'](_0x4fd99));delete _0x4fd99['name'];if(_0x215964===0x191){_0x215964=0x190;}_0x4453c7[_0x3342('0x26')](_0x215964)[_0x3342('0x34')](_0x3aae5f[_0x3342('0x3d')][_0x3342('0x75')]?{'message':_0x3342('0x77'),'statusCode':_0x4fd99[_0x3342('0x76')]}:_0x4fd99);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index ef71f3f..5936f7c 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 _0x2317=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','DeskAccount','lodash','moment'];(function(_0x93aa47,_0xaeb5f9){var _0x26d122=function(_0x493121){while(--_0x493121){_0x93aa47['push'](_0x93aa47['shift']());}};_0x26d122(++_0xaeb5f9);}(_0x2317,0x198));var _0x7231=function(_0x2b85a7,_0x4aea3c){_0x2b85a7=_0x2b85a7-0x0;var _0x5422b3=_0x2317[_0x2b85a7];return _0x5422b3;};'use strict';var _=require(_0x7231('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7231('0x1'));var BPromise=require(_0x7231('0x2'));var rp=require(_0x7231('0x3'));var fs=require('fs');var path=require(_0x7231('0x4'));var rimraf=require(_0x7231('0x5'));var config=require(_0x7231('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x7231('0x7'));module[_0x7231('0x8')]=function(_0x263065,_0xeae9f5){return _0x263065['define'](_0x7231('0x9'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87bb=['define','DeskAccount','int_desk_accounts','lodash','moment','bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x87bb,0xc3));var _0xb87b=function(_0x29d663,_0x445803){_0x29d663=_0x29d663-0x0;var _0x2b294d=_0x87bb[_0x29d663];return _0x2b294d;};'use strict';var _=require(_0xb87b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb87b('0x1'));var BPromise=require(_0xb87b('0x2'));var rp=require(_0xb87b('0x3'));var fs=require('fs');var path=require(_0xb87b('0x4'));var rimraf=require(_0xb87b('0x5'));var config=require('../../config/environment');var attributes=require(_0xb87b('0x6'));var integrations=require(_0xb87b('0x7'));module[_0xb87b('0x8')]=function(_0x521d83,_0x4835fa){return _0x521d83[_0xb87b('0x9')](_0xb87b('0xa'),attributes,{'tableName':_0xb87b('0xb'),'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 014d669..5b558fb 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 _0x4813=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','DeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetDeskAccount','findAll','options','raw','where','attributes','include','model','map','DeskAccount','find','ShowDeskAccount','lodash'];(function(_0x2cdfe2,_0x2458ab){var _0x3d0bd5=function(_0x3b7989){while(--_0x3b7989){_0x2cdfe2['push'](_0x2cdfe2['shift']());}};_0x3d0bd5(++_0x2458ab);}(_0x4813,0x175));var _0x3481=function(_0x343916,_0x331db9){_0x343916=_0x343916-0x0;var _0x173319=_0x4813[_0x343916];return _0x173319;};'use strict';var _=require(_0x3481('0x0'));var util=require(_0x3481('0x1'));var moment=require('moment');var BPromise=require(_0x3481('0x2'));var rs=require(_0x3481('0x3'));var fs=require('fs');var Redis=require(_0x3481('0x4'));var db=require(_0x3481('0x5'))['db'];var utils=require(_0x3481('0x6'));var logger=require(_0x3481('0x7'))('rpc');var config=require(_0x3481('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3481('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bf4af,_0x370398,_0x486ec2){return new BPromise(function(_0x19f5b6,_0x42fff0){return client[_0x3481('0xa')](_0x5bf4af,_0x486ec2)[_0x3481('0xb')](function(_0x3b810e){logger[_0x3481('0xc')](_0x3481('0xd'),_0x370398,'request\x20sent');logger[_0x3481('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x370398,_0x3481('0xf'),JSON[_0x3481('0x10')](_0x3b810e));if(_0x3b810e['error']){if(_0x3b810e[_0x3481('0x11')][_0x3481('0x12')]===0x1f4){logger[_0x3481('0x11')](_0x3481('0xd'),_0x370398,_0x3b810e['error']['message']);return _0x42fff0(_0x3b810e[_0x3481('0x11')][_0x3481('0x13')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x370398,_0x3b810e[_0x3481('0x11')][_0x3481('0x13')]);return _0x19f5b6(_0x3b810e['error'][_0x3481('0x13')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x370398,_0x3481('0xf'));_0x19f5b6(_0x3b810e[_0x3481('0x14')][_0x3481('0x13')]);}})[_0x3481('0x15')](function(_0x230e6a){logger[_0x3481('0x11')](_0x3481('0xd'),_0x370398,_0x230e6a);_0x42fff0(_0x230e6a);});});}exports[_0x3481('0x16')]=function(_0x28e160){var _0x39ec6a=this;return new Promise(function(_0x52ef79,_0x4237fb){return db['DeskAccount'][_0x3481('0x17')]({'raw':_0x28e160['options']?_0x28e160[_0x3481('0x18')][_0x3481('0x19')]===undefined?!![]:![]:!![],'where':_0x28e160[_0x3481('0x18')]?_0x28e160[_0x3481('0x18')][_0x3481('0x1a')]||null:null,'attributes':_0x28e160[_0x3481('0x18')]?_0x28e160[_0x3481('0x18')][_0x3481('0x1b')]||null:null,'limit':_0x28e160[_0x3481('0x18')]?_0x28e160['options']['limit']||null:null,'include':_0x28e160[_0x3481('0x18')]?_0x28e160[_0x3481('0x18')][_0x3481('0x1c')]?_['map'](_0x28e160['options'][_0x3481('0x1c')],function(_0x162b87){return{'model':db[_0x162b87['model']],'as':_0x162b87['as'],'attributes':_0x162b87['attributes'],'include':_0x162b87['include']?_['map'](_0x162b87[_0x3481('0x1c')],function(_0x58e2c8){return{'model':db[_0x58e2c8[_0x3481('0x1d')]],'as':_0x58e2c8['as'],'attributes':_0x58e2c8[_0x3481('0x1b')],'include':_0x58e2c8['include']?_[_0x3481('0x1e')](_0x58e2c8[_0x3481('0x1c')],function(_0x3c490d){return{'model':db[_0x3c490d[_0x3481('0x1d')]],'as':_0x3c490d['as'],'attributes':_0x3c490d['attributes']};}):[]};}):[]};}):[]:[]})[_0x3481('0xb')](function(_0x5c6f2b){logger[_0x3481('0xc')]('GetDeskAccount',_0x28e160);logger[_0x3481('0xe')](_0x3481('0x16'),_0x28e160,JSON[_0x3481('0x10')](_0x5c6f2b));_0x52ef79(_0x5c6f2b);})['catch'](function(_0x20704e){logger[_0x3481('0x11')](_0x3481('0x16'),_0x20704e[_0x3481('0x13')],_0x28e160);_0x4237fb(_0x39ec6a[_0x3481('0x11')](0x1f4,_0x20704e[_0x3481('0x13')]));});});};exports['ShowDeskAccount']=function(_0x7838c4){var _0x18a32e=this;return new Promise(function(_0x25890c,_0x34b213){return db[_0x3481('0x1f')][_0x3481('0x20')]({'raw':_0x7838c4['options']?_0x7838c4[_0x3481('0x18')][_0x3481('0x19')]===undefined?!![]:![]:!![],'where':_0x7838c4[_0x3481('0x18')]?_0x7838c4[_0x3481('0x18')][_0x3481('0x1a')]||null:null,'attributes':_0x7838c4[_0x3481('0x18')]?_0x7838c4['options']['attributes']||null:null,'include':_0x7838c4[_0x3481('0x18')]?_0x7838c4[_0x3481('0x18')][_0x3481('0x1c')]?_[_0x3481('0x1e')](_0x7838c4[_0x3481('0x18')][_0x3481('0x1c')],function(_0x250a07){return{'model':db[_0x250a07[_0x3481('0x1d')]],'as':_0x250a07['as'],'attributes':_0x250a07[_0x3481('0x1b')],'include':_0x250a07['include']?_['map'](_0x250a07['include'],function(_0x4e787a){return{'model':db[_0x4e787a['model']],'as':_0x4e787a['as'],'attributes':_0x4e787a[_0x3481('0x1b')],'include':_0x4e787a[_0x3481('0x1c')]?_['map'](_0x4e787a[_0x3481('0x1c')],function(_0x44f970){return{'model':db[_0x44f970[_0x3481('0x1d')]],'as':_0x44f970['as'],'attributes':_0x44f970[_0x3481('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3481('0xb')](function(_0x5bfafa){logger[_0x3481('0xc')](_0x3481('0x21'),_0x7838c4);logger[_0x3481('0xe')](_0x3481('0x21'),_0x7838c4,JSON[_0x3481('0x10')](_0x5bfafa));_0x25890c(_0x5bfafa);})[_0x3481('0x15')](function(_0x2ae50c){logger[_0x3481('0x11')](_0x3481('0x21'),_0x2ae50c[_0x3481('0x13')],_0x7838c4);_0x34b213(_0x18a32e[_0x3481('0x11')](0x1f4,_0x2ae50c[_0x3481('0x13')]));});});}; \ No newline at end of file +var _0xff27=['include','model','then','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','DeskAccount,\x20%s,\x20%s','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','map'];(function(_0x3ae3d7,_0x3b31de){var _0x3218ca=function(_0x54b500){while(--_0x54b500){_0x3ae3d7['push'](_0x3ae3d7['shift']());}};_0x3218ca(++_0x3b31de);}(_0xff27,0x115));var _0x7ff2=function(_0x25d4ee,_0xc95872){_0x25d4ee=_0x25d4ee-0x0;var _0x214a35=_0xff27[_0x25d4ee];return _0x214a35;};'use strict';var _=require(_0x7ff2('0x0'));var util=require(_0x7ff2('0x1'));var moment=require(_0x7ff2('0x2'));var BPromise=require(_0x7ff2('0x3'));var rs=require(_0x7ff2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7ff2('0x5'));var logger=require('../../config/logger')(_0x7ff2('0x6'));var config=require('../../config/environment');var jayson=require(_0x7ff2('0x7'));var client=jayson[_0x7ff2('0x8')][_0x7ff2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cfa98,_0x55d99f,_0x56a6a8){return new BPromise(function(_0x4b67b0,_0x55a922){return client['request'](_0x3cfa98,_0x56a6a8)['then'](function(_0x258dd0){logger[_0x7ff2('0xa')]('DeskAccount,\x20%s,\x20%s',_0x55d99f,_0x7ff2('0xb'));logger[_0x7ff2('0xc')](_0x7ff2('0xd'),_0x55d99f,_0x7ff2('0xb'),JSON[_0x7ff2('0xe')](_0x258dd0));if(_0x258dd0['error']){if(_0x258dd0[_0x7ff2('0xf')]['code']===0x1f4){logger[_0x7ff2('0xf')]('DeskAccount,\x20%s,\x20%s',_0x55d99f,_0x258dd0[_0x7ff2('0xf')][_0x7ff2('0x10')]);return _0x55a922(_0x258dd0[_0x7ff2('0xf')][_0x7ff2('0x10')]);}logger[_0x7ff2('0xf')](_0x7ff2('0x11'),_0x55d99f,_0x258dd0[_0x7ff2('0xf')][_0x7ff2('0x10')]);return _0x4b67b0(_0x258dd0[_0x7ff2('0xf')][_0x7ff2('0x10')]);}else{logger[_0x7ff2('0xa')](_0x7ff2('0x11'),_0x55d99f,_0x7ff2('0xb'));_0x4b67b0(_0x258dd0[_0x7ff2('0x12')][_0x7ff2('0x10')]);}})[_0x7ff2('0x13')](function(_0x233c99){logger[_0x7ff2('0xf')](_0x7ff2('0x11'),_0x55d99f,_0x233c99);_0x55a922(_0x233c99);});});}exports[_0x7ff2('0x14')]=function(_0x408288){var _0x5db666=this;return new Promise(function(_0x5ec586,_0x53b256){return db[_0x7ff2('0x15')][_0x7ff2('0x16')]({'raw':_0x408288[_0x7ff2('0x17')]?_0x408288[_0x7ff2('0x17')][_0x7ff2('0x18')]===undefined?!![]:![]:!![],'where':_0x408288[_0x7ff2('0x17')]?_0x408288[_0x7ff2('0x17')][_0x7ff2('0x19')]||null:null,'attributes':_0x408288[_0x7ff2('0x17')]?_0x408288[_0x7ff2('0x17')][_0x7ff2('0x1a')]||null:null,'limit':_0x408288[_0x7ff2('0x17')]?_0x408288['options'][_0x7ff2('0x1b')]||null:null,'include':_0x408288['options']?_0x408288[_0x7ff2('0x17')]['include']?_[_0x7ff2('0x1c')](_0x408288[_0x7ff2('0x17')][_0x7ff2('0x1d')],function(_0x109fd0){return{'model':db[_0x109fd0[_0x7ff2('0x1e')]],'as':_0x109fd0['as'],'attributes':_0x109fd0[_0x7ff2('0x1a')],'include':_0x109fd0[_0x7ff2('0x1d')]?_[_0x7ff2('0x1c')](_0x109fd0[_0x7ff2('0x1d')],function(_0x319d1b){return{'model':db[_0x319d1b[_0x7ff2('0x1e')]],'as':_0x319d1b['as'],'attributes':_0x319d1b['attributes'],'include':_0x319d1b[_0x7ff2('0x1d')]?_[_0x7ff2('0x1c')](_0x319d1b[_0x7ff2('0x1d')],function(_0x8651c){return{'model':db[_0x8651c[_0x7ff2('0x1e')]],'as':_0x8651c['as'],'attributes':_0x8651c[_0x7ff2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7ff2('0x1f')](function(_0x1a8423){logger[_0x7ff2('0xa')](_0x7ff2('0x14'),_0x408288);logger[_0x7ff2('0xc')](_0x7ff2('0x14'),_0x408288,JSON[_0x7ff2('0xe')](_0x1a8423));_0x5ec586(_0x1a8423);})[_0x7ff2('0x13')](function(_0x17b4ed){logger[_0x7ff2('0xf')](_0x7ff2('0x14'),_0x17b4ed[_0x7ff2('0x10')],_0x408288);_0x53b256(_0x5db666[_0x7ff2('0xf')](0x1f4,_0x17b4ed['message']));});});};exports[_0x7ff2('0x20')]=function(_0xa24b65){var _0x83ea2f=this;return new Promise(function(_0x3b01ed,_0x391ed8){return db[_0x7ff2('0x15')][_0x7ff2('0x21')]({'raw':_0xa24b65[_0x7ff2('0x17')]?_0xa24b65[_0x7ff2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xa24b65['options']?_0xa24b65['options']['where']||null:null,'attributes':_0xa24b65[_0x7ff2('0x17')]?_0xa24b65[_0x7ff2('0x17')][_0x7ff2('0x1a')]||null:null,'include':_0xa24b65[_0x7ff2('0x17')]?_0xa24b65[_0x7ff2('0x17')][_0x7ff2('0x1d')]?_[_0x7ff2('0x1c')](_0xa24b65[_0x7ff2('0x17')][_0x7ff2('0x1d')],function(_0x1c2ebe){return{'model':db[_0x1c2ebe[_0x7ff2('0x1e')]],'as':_0x1c2ebe['as'],'attributes':_0x1c2ebe[_0x7ff2('0x1a')],'include':_0x1c2ebe['include']?_[_0x7ff2('0x1c')](_0x1c2ebe[_0x7ff2('0x1d')],function(_0x2e6b75){return{'model':db[_0x2e6b75['model']],'as':_0x2e6b75['as'],'attributes':_0x2e6b75[_0x7ff2('0x1a')],'include':_0x2e6b75['include']?_['map'](_0x2e6b75[_0x7ff2('0x1d')],function(_0x546d4c){return{'model':db[_0x546d4c[_0x7ff2('0x1e')]],'as':_0x546d4c['as'],'attributes':_0x546d4c[_0x7ff2('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b3584){logger[_0x7ff2('0xa')](_0x7ff2('0x20'),_0xa24b65);logger['debug'](_0x7ff2('0x20'),_0xa24b65,JSON[_0x7ff2('0xe')](_0x1b3584));_0x3b01ed(_0x1b3584);})[_0x7ff2('0x13')](function(_0xf14e1a){logger[_0x7ff2('0xf')](_0x7ff2('0x20'),_0xf14e1a['message'],_0xa24b65);_0x391ed8(_0x83ea2f[_0x7ff2('0xf')](0x1f4,_0xf14e1a[_0x7ff2('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 92cf1ae..098caf2 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 _0xba64=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getSubjects','/:id/descriptions','getTags','create','post','put','update'];(function(_0x57b248,_0x2d5053){var _0x3a55f5=function(_0x145403){while(--_0x145403){_0x57b248['push'](_0x57b248['shift']());}};_0x3a55f5(++_0x2d5053);}(_0xba64,0x86));var _0x4ba6=function(_0x464b3a,_0x2f13aa){_0x464b3a=_0x464b3a-0x0;var _0x156655=_0xba64[_0x464b3a];return _0x156655;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4ba6('0x0'));var timeout=require(_0x4ba6('0x1'));var express=require(_0x4ba6('0x2'));var router=express[_0x4ba6('0x3')]();var fs_extra=require(_0x4ba6('0x4'));var auth=require(_0x4ba6('0x5'));var interaction=require(_0x4ba6('0x6'));var config=require('../../config/environment');var controller=require(_0x4ba6('0x7'));router[_0x4ba6('0x8')]('/',auth[_0x4ba6('0x9')](),controller[_0x4ba6('0xa')]);router['get'](_0x4ba6('0xb'),auth[_0x4ba6('0x9')](),controller['show']);router[_0x4ba6('0x8')](_0x4ba6('0xc'),auth[_0x4ba6('0x9')](),controller['getFields']);router[_0x4ba6('0x8')]('/:id/subjects',auth[_0x4ba6('0x9')](),controller[_0x4ba6('0xd')]);router['get'](_0x4ba6('0xe'),auth[_0x4ba6('0x9')](),controller['getDescriptions']);router[_0x4ba6('0x8')]('/:id/tags',auth[_0x4ba6('0x9')](),controller[_0x4ba6('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4ba6('0x10')]);router[_0x4ba6('0x11')]('/:id/tags',auth[_0x4ba6('0x9')](),controller['setTags']);router[_0x4ba6('0x12')]('/:id',auth[_0x4ba6('0x9')](),controller[_0x4ba6('0x13')]);router['delete'](_0x4ba6('0xb'),auth[_0x4ba6('0x9')](),controller[_0x4ba6('0x14')]);module[_0x4ba6('0x15')]=router; \ No newline at end of file +var _0xfb6f=['destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getTags','post','create','setTags','update','delete'];(function(_0x5fd57,_0x162af9){var _0x1d19aa=function(_0x4a1f66){while(--_0x4a1f66){_0x5fd57['push'](_0x5fd57['shift']());}};_0x1d19aa(++_0x162af9);}(_0xfb6f,0x188));var _0xffb6=function(_0x3dbe8e,_0x2b98bd){_0x3dbe8e=_0x3dbe8e-0x0;var _0x3f124f=_0xfb6f[_0x3dbe8e];return _0x3f124f;};'use strict';var multer=require(_0xffb6('0x0'));var util=require(_0xffb6('0x1'));var path=require('path');var timeout=require(_0xffb6('0x2'));var express=require(_0xffb6('0x3'));var router=express['Router']();var fs_extra=require(_0xffb6('0x4'));var auth=require(_0xffb6('0x5'));var interaction=require(_0xffb6('0x6'));var config=require('../../config/environment');var controller=require(_0xffb6('0x7'));router[_0xffb6('0x8')]('/',auth[_0xffb6('0x9')](),controller[_0xffb6('0xa')]);router[_0xffb6('0x8')](_0xffb6('0xb'),auth[_0xffb6('0x9')](),controller[_0xffb6('0xc')]);router[_0xffb6('0x8')](_0xffb6('0xd'),auth['isAuthenticated'](),controller[_0xffb6('0xe')]);router[_0xffb6('0x8')](_0xffb6('0xf'),auth[_0xffb6('0x9')](),controller[_0xffb6('0x10')]);router[_0xffb6('0x8')](_0xffb6('0x11'),auth[_0xffb6('0x9')](),controller['getDescriptions']);router[_0xffb6('0x8')]('/:id/tags',auth[_0xffb6('0x9')](),controller[_0xffb6('0x12')]);router[_0xffb6('0x13')]('/',auth['isAuthenticated'](),controller[_0xffb6('0x14')]);router['post']('/:id/tags',auth[_0xffb6('0x9')](),controller[_0xffb6('0x15')]);router['put'](_0xffb6('0xb'),auth[_0xffb6('0x9')](),controller[_0xffb6('0x16')]);router[_0xffb6('0x17')](_0xffb6('0xb'),auth[_0xffb6('0x9')](),controller[_0xffb6('0x18')]);module[_0xffb6('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index f6665ca..cc906a0 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 _0xd64b=['STRING','sequelize','exports'];(function(_0x467622,_0x4ad91){var _0x35ca1a=function(_0x1cdb34){while(--_0x1cdb34){_0x467622['push'](_0x467622['shift']());}};_0x35ca1a(++_0x4ad91);}(_0xd64b,0x6d));var _0xbd64=function(_0x3cdd7a,_0x266f22){_0x3cdd7a=_0x3cdd7a-0x0;var _0xca7994=_0xd64b[_0x3cdd7a];return _0xca7994;};'use strict';var Sequelize=require(_0xbd64('0x0'));module[_0xbd64('0x1')]={'name':{'type':Sequelize[_0xbd64('0x2')]},'description':{'type':Sequelize[_0xbd64('0x2')]}}; \ No newline at end of file +var _0x17f7=['exports','STRING','sequelize'];(function(_0x42e87e,_0x48a789){var _0x4931a4=function(_0x478895){while(--_0x478895){_0x42e87e['push'](_0x42e87e['shift']());}};_0x4931a4(++_0x48a789);}(_0x17f7,0xd4));var _0x717f=function(_0x51af6b,_0x217b57){_0x51af6b=_0x51af6b-0x0;var _0x38530c=_0x17f7[_0x51af6b];return _0x38530c;};'use strict';var Sequelize=require(_0x717f('0x0'));module[_0x717f('0x1')]={'name':{'type':Sequelize[_0x717f('0x2')]},'description':{'type':Sequelize[_0x717f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index efa923c..c810841 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 _0x36ee=['offset','limit','set','apply','reject','save','destroy','stack','name','map','DeskConfiguration','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','params','rawAttributes','length','include','find','create','update','body','getFields','findOne','DeskField','getSubjects','getDescriptions','Tag','getTags','setTags','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','end','json'];(function(_0x1e607d,_0x3c429c){var _0x4a7089=function(_0x41d80b){while(--_0x41d80b){_0x1e607d['push'](_0x1e607d['shift']());}};_0x4a7089(++_0x3c429c);}(_0x36ee,0xe8));var _0xe36e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x36ee[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe36e('0x1'));var moment=require(_0xe36e('0x2'));var BPromise=require(_0xe36e('0x3'));var Mustache=require(_0xe36e('0x4'));var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var licenseUtil=require(_0xe36e('0x17'));var db=require(_0xe36e('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe36e('0x19')][_0xe36e('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x23abfb,_0x1fdea2,_0x5c3f3c,_0x3e264a){return new BPromise(function(_0x521afa,_0x525155){var _0x27ff47=_0x3e264a||client;return _0x27ff47[_0xe36e('0x1b')](_0x23abfb,_0x5c3f3c)[_0xe36e('0x1c')](function(_0x278135){logger[_0xe36e('0x1d')](_0xe36e('0x1e'),_0x1fdea2,_0xe36e('0x1f'));logger[_0xe36e('0x20')](_0xe36e('0x21'),_0x1fdea2,_0xe36e('0x1f'),JSON['stringify'](_0x278135));if(_0x278135[_0xe36e('0x22')]){if(_0x278135[_0xe36e('0x22')]['code']===0x1f4){logger[_0xe36e('0x22')]('DeskConfiguration,\x20%s,\x20%s',_0x1fdea2,_0x278135[_0xe36e('0x22')][_0xe36e('0x23')]);return _0x525155(_0x278135['error'][_0xe36e('0x23')]);}logger[_0xe36e('0x22')](_0xe36e('0x1e'),_0x1fdea2,_0x278135['error'][_0xe36e('0x23')]);return _0x521afa(_0x278135[_0xe36e('0x22')][_0xe36e('0x23')]);}else{logger[_0xe36e('0x1d')](_0xe36e('0x1e'),_0x1fdea2,_0xe36e('0x1f'));_0x521afa(_0x278135['result'][_0xe36e('0x23')]);}})[_0xe36e('0x24')](function(_0x23bcf3){logger[_0xe36e('0x22')](_0xe36e('0x1e'),_0x1fdea2,_0x23bcf3);_0x525155(_0x23bcf3);});});}function respondWithStatusCode(_0x53e13a,_0x598a7a){_0x598a7a=_0x598a7a||0xcc;return function(_0x4749a8){if(_0x4749a8){return _0x53e13a[_0xe36e('0x25')](_0x598a7a);}return _0x53e13a[_0xe36e('0x26')](_0x598a7a)[_0xe36e('0x27')]();};}function respondWithResult(_0x31c12c,_0x1507f9){_0x1507f9=_0x1507f9||0xc8;return function(_0x1a045c){if(_0x1a045c){return _0x31c12c['status'](_0x1507f9)[_0xe36e('0x28')](_0x1a045c);}};}function respondWithFilteredResult(_0x35f9e7,_0x10597f){return function(_0x262caa){if(_0x262caa){var _0x5e58d8=typeof _0x10597f[_0xe36e('0x29')]==='undefined'&&typeof _0x10597f[_0xe36e('0x2a')]==='undefined';var _0x19f001=_0x262caa['count'];var _0x410504=_0x5e58d8?0x0:_0x10597f['offset'];var _0x3b1045=_0x5e58d8?_0x262caa['count']:_0x10597f['offset']+_0x10597f['limit'];var _0x5b5d53;if(_0x3b1045>=_0x19f001){_0x3b1045=_0x19f001;_0x5b5d53=0xc8;}else{_0x5b5d53=0xce;}_0x35f9e7[_0xe36e('0x26')](_0x5b5d53);return _0x35f9e7[_0xe36e('0x2b')]('Content-Range',_0x410504+'-'+_0x3b1045+'/'+_0x19f001)['json'](_0x262caa);}return null;};}function patchUpdates(_0x1fa1ec){return function(_0xb8d44e){try{jsonpatch[_0xe36e('0x2c')](_0xb8d44e,_0x1fa1ec,!![]);}catch(_0x1b18aa){return BPromise[_0xe36e('0x2d')](_0x1b18aa);}return _0xb8d44e[_0xe36e('0x2e')]();};}function saveUpdates(_0x57bb9b,_0xb98e78){return function(_0x11c95d){if(_0x11c95d){return _0x11c95d['update'](_0x57bb9b)[_0xe36e('0x1c')](function(_0xa06f61){return _0xa06f61;});}return null;};}function removeEntity(_0xba4869,_0x5d6f41){return function(_0x21623e){if(_0x21623e){return _0x21623e[_0xe36e('0x2f')]()[_0xe36e('0x1c')](function(){_0xba4869[_0xe36e('0x26')](0xcc)[_0xe36e('0x27')]();});}};}function handleEntityNotFound(_0x1cc329,_0xf808f5){return function(_0x4c0c46){if(!_0x4c0c46){_0x1cc329[_0xe36e('0x25')](0x194);}return _0x4c0c46;};}function handleError(_0x59231e,_0x4a717e){_0x4a717e=_0x4a717e||0x1f4;return function(_0x81cf9a){logger['error'](_0x81cf9a[_0xe36e('0x30')]);if(_0x81cf9a[_0xe36e('0x31')]){delete _0x81cf9a[_0xe36e('0x31')];}_0x59231e[_0xe36e('0x26')](_0x4a717e)['send'](_0x81cf9a);};}exports['index']=function(_0x45689d,_0x222c65){var _0x19a53f={},_0x243338={},_0x51894c={'count':0x0,'rows':[]};var _0xb2046c=_[_0xe36e('0x32')](db[_0xe36e('0x33')]['rawAttributes'],function(_0x2c58d1){return{'name':_0x2c58d1[_0xe36e('0x34')],'type':_0x2c58d1['type'][_0xe36e('0x35')]};});_0x243338[_0xe36e('0x36')]=_[_0xe36e('0x32')](_0xb2046c,_0xe36e('0x31'));_0x243338[_0xe36e('0x37')]=_[_0xe36e('0x38')](_0x45689d[_0xe36e('0x37')]);_0x243338[_0xe36e('0x39')]=_[_0xe36e('0x3a')](_0x243338[_0xe36e('0x36')],_0x243338[_0xe36e('0x37')]);_0x19a53f[_0xe36e('0x3b')]=_[_0xe36e('0x3a')](_0x243338['model'],qs[_0xe36e('0x3c')](_0x45689d[_0xe36e('0x37')][_0xe36e('0x3c')]));_0x19a53f[_0xe36e('0x3b')]=_0x19a53f[_0xe36e('0x3b')]['length']?_0x19a53f['attributes']:_0x243338[_0xe36e('0x36')];if(!_0x45689d[_0xe36e('0x37')][_0xe36e('0x3d')](_0xe36e('0x3e'))){_0x19a53f[_0xe36e('0x2a')]=qs[_0xe36e('0x2a')](_0x45689d[_0xe36e('0x37')][_0xe36e('0x2a')]);_0x19a53f['offset']=qs[_0xe36e('0x29')](_0x45689d[_0xe36e('0x37')]['offset']);}_0x19a53f[_0xe36e('0x3f')]=qs['sort'](_0x45689d[_0xe36e('0x37')][_0xe36e('0x40')]);_0x19a53f[_0xe36e('0x41')]=qs[_0xe36e('0x39')](_[_0xe36e('0x42')](_0x45689d['query'],_0x243338[_0xe36e('0x39')]),_0xb2046c);if(_0x45689d[_0xe36e('0x37')][_0xe36e('0x43')]){_0x19a53f[_0xe36e('0x41')]=_[_0xe36e('0x44')](_0x19a53f[_0xe36e('0x41')],{'$or':_['map'](_0xb2046c,function(_0x122704){if(_0x122704[_0xe36e('0x45')]!==_0xe36e('0x46')){var _0x2fe9e5={};_0x2fe9e5[_0x122704[_0xe36e('0x31')]]={'$like':'%'+_0x45689d['query'][_0xe36e('0x43')]+'%'};return _0x2fe9e5;}})});}_0x19a53f=_[_0xe36e('0x44')]({},_0x19a53f,_0x45689d[_0xe36e('0x47')]);var _0x9debd7={'where':_0x19a53f[_0xe36e('0x41')]};return db[_0xe36e('0x33')][_0xe36e('0x48')](_0x9debd7)[_0xe36e('0x1c')](function(_0x43c2d4){_0x51894c['count']=_0x43c2d4;if(_0x45689d['query'][_0xe36e('0x49')]){_0x19a53f['include']=[{'all':!![]}];}return db[_0xe36e('0x33')][_0xe36e('0x4a')](_0x19a53f);})[_0xe36e('0x1c')](function(_0x25aa09){_0x51894c['rows']=_0x25aa09;return _0x51894c;})[_0xe36e('0x1c')](respondWithFilteredResult(_0x222c65,_0x19a53f))[_0xe36e('0x24')](handleError(_0x222c65,null));};exports['show']=function(_0x125e62,_0x40634a){var _0x2c26e6={'raw':![],'where':{'id':_0x125e62[_0xe36e('0x4b')]['id']}},_0x42eae5={};_0x42eae5[_0xe36e('0x36')]=_[_0xe36e('0x38')](db[_0xe36e('0x33')][_0xe36e('0x4c')]);_0x42eae5[_0xe36e('0x37')]=_[_0xe36e('0x38')](_0x125e62[_0xe36e('0x37')]);_0x42eae5[_0xe36e('0x39')]=_[_0xe36e('0x3a')](_0x42eae5[_0xe36e('0x36')],_0x42eae5['query']);_0x2c26e6[_0xe36e('0x3b')]=_['intersection'](_0x42eae5['model'],qs[_0xe36e('0x3c')](_0x125e62[_0xe36e('0x37')]['fields']));_0x2c26e6[_0xe36e('0x3b')]=_0x2c26e6[_0xe36e('0x3b')][_0xe36e('0x4d')]?_0x2c26e6[_0xe36e('0x3b')]:_0x42eae5[_0xe36e('0x36')];if(_0x125e62[_0xe36e('0x37')][_0xe36e('0x49')]){_0x2c26e6[_0xe36e('0x4e')]=[{'all':!![]}];}_0x2c26e6=_[_0xe36e('0x44')]({},_0x2c26e6,_0x125e62['options']);return db[_0xe36e('0x33')][_0xe36e('0x4f')](_0x2c26e6)['then'](handleEntityNotFound(_0x40634a,null))[_0xe36e('0x1c')](respondWithResult(_0x40634a,null))[_0xe36e('0x24')](handleError(_0x40634a,null));};exports[_0xe36e('0x50')]=function(_0x206f75,_0x3770bd){return db['DeskConfiguration']['create'](_0x206f75['body'],{})['then'](respondWithResult(_0x3770bd,0xc9))[_0xe36e('0x24')](handleError(_0x3770bd,null));};exports[_0xe36e('0x51')]=function(_0x283365,_0x3e3d4d){if(_0x283365[_0xe36e('0x52')]['id']){delete _0x283365[_0xe36e('0x52')]['id'];}return db[_0xe36e('0x33')][_0xe36e('0x4f')]({'where':{'id':_0x283365[_0xe36e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3e3d4d,null))[_0xe36e('0x1c')](saveUpdates(_0x283365[_0xe36e('0x52')],null))['then'](respondWithResult(_0x3e3d4d,null))[_0xe36e('0x24')](handleError(_0x3e3d4d,null));};exports[_0xe36e('0x2f')]=function(_0x169369,_0x443154){return db[_0xe36e('0x33')][_0xe36e('0x4f')]({'where':{'id':_0x169369[_0xe36e('0x4b')]['id']}})[_0xe36e('0x1c')](handleEntityNotFound(_0x443154,null))[_0xe36e('0x1c')](removeEntity(_0x443154,null))[_0xe36e('0x24')](handleError(_0x443154,null));};exports[_0xe36e('0x53')]=function(_0x2cf7fc,_0x389e91,_0x6f979f){var _0x3512ec={};var _0x3e4860={};var _0x3c78ea;var _0x275142;return db[_0xe36e('0x33')][_0xe36e('0x54')]({'where':{'id':_0x2cf7fc[_0xe36e('0x4b')]['id']}})[_0xe36e('0x1c')](handleEntityNotFound(_0x389e91,null))[_0xe36e('0x1c')](function(_0x434d88){if(_0x434d88){_0x3c78ea=_0x434d88;_0x3e4860[_0xe36e('0x36')]=_['keys'](db[_0xe36e('0x55')][_0xe36e('0x4c')]);_0x3e4860['query']=_[_0xe36e('0x38')](_0x2cf7fc[_0xe36e('0x37')]);_0x3e4860[_0xe36e('0x39')]=_[_0xe36e('0x3a')](_0x3e4860[_0xe36e('0x36')],_0x3e4860[_0xe36e('0x37')]);_0x3512ec['attributes']=_[_0xe36e('0x3a')](_0x3e4860['model'],qs[_0xe36e('0x3c')](_0x2cf7fc[_0xe36e('0x37')][_0xe36e('0x3c')]));_0x3512ec[_0xe36e('0x3b')]=_0x3512ec[_0xe36e('0x3b')][_0xe36e('0x4d')]?_0x3512ec[_0xe36e('0x3b')]:_0x3e4860[_0xe36e('0x36')];_0x3512ec['order']=qs[_0xe36e('0x40')](_0x2cf7fc[_0xe36e('0x37')]['sort']);_0x3512ec[_0xe36e('0x41')]=qs[_0xe36e('0x39')](_[_0xe36e('0x42')](_0x2cf7fc[_0xe36e('0x37')],_0x3e4860[_0xe36e('0x39')]));if(_0x2cf7fc[_0xe36e('0x37')][_0xe36e('0x43')]){_0x3512ec['where']=_[_0xe36e('0x44')](_0x3512ec[_0xe36e('0x41')],{'$or':_[_0xe36e('0x32')](_0x3512ec[_0xe36e('0x3b')],function(_0x1fd5d1){var _0x43d8c2={};_0x43d8c2[_0x1fd5d1]={'$like':'%'+_0x2cf7fc[_0xe36e('0x37')][_0xe36e('0x43')]+'%'};return _0x43d8c2;})});}_0x3512ec=_[_0xe36e('0x44')]({},_0x3512ec,_0x2cf7fc[_0xe36e('0x47')]);return _0x3c78ea[_0xe36e('0x53')](_0x3512ec);}})['then'](function(_0x371af5){if(_0x371af5){_0x275142=_0x371af5[_0xe36e('0x4d')];if(!_0x2cf7fc[_0xe36e('0x37')][_0xe36e('0x3d')]('nolimit')){_0x3512ec['limit']=qs[_0xe36e('0x2a')](_0x2cf7fc['query']['limit']);_0x3512ec['offset']=qs[_0xe36e('0x29')](_0x2cf7fc['query'][_0xe36e('0x29')]);}return _0x3c78ea[_0xe36e('0x53')](_0x3512ec);}})[_0xe36e('0x1c')](function(_0x221a90){if(_0x221a90){return _0x221a90?{'count':_0x275142,'rows':_0x221a90}:null;}})[_0xe36e('0x1c')](respondWithResult(_0x389e91,null))[_0xe36e('0x24')](handleError(_0x389e91,null));};exports[_0xe36e('0x56')]=function(_0x14a9b4,_0x2a26f4,_0x5e7c92){var _0x7b9501={};var _0x54f14c={};var _0x13ad07;var _0x517c2a;return db[_0xe36e('0x33')][_0xe36e('0x54')]({'where':{'id':_0x14a9b4[_0xe36e('0x4b')]['id']}})[_0xe36e('0x1c')](handleEntityNotFound(_0x2a26f4,null))['then'](function(_0x5035cf){if(_0x5035cf){_0x13ad07=_0x5035cf;_0x54f14c[_0xe36e('0x36')]=_[_0xe36e('0x38')](db[_0xe36e('0x55')][_0xe36e('0x4c')]);_0x54f14c[_0xe36e('0x37')]=_[_0xe36e('0x38')](_0x14a9b4['query']);_0x54f14c[_0xe36e('0x39')]=_[_0xe36e('0x3a')](_0x54f14c['model'],_0x54f14c[_0xe36e('0x37')]);_0x7b9501['attributes']=_[_0xe36e('0x3a')](_0x54f14c[_0xe36e('0x36')],qs[_0xe36e('0x3c')](_0x14a9b4[_0xe36e('0x37')]['fields']));_0x7b9501[_0xe36e('0x3b')]=_0x7b9501['attributes']['length']?_0x7b9501[_0xe36e('0x3b')]:_0x54f14c[_0xe36e('0x36')];_0x7b9501['order']=qs['sort'](_0x14a9b4[_0xe36e('0x37')]['sort']);_0x7b9501[_0xe36e('0x41')]=qs[_0xe36e('0x39')](_[_0xe36e('0x42')](_0x14a9b4[_0xe36e('0x37')],_0x54f14c[_0xe36e('0x39')]));if(_0x14a9b4[_0xe36e('0x37')]['filter']){_0x7b9501[_0xe36e('0x41')]=_[_0xe36e('0x44')](_0x7b9501[_0xe36e('0x41')],{'$or':_[_0xe36e('0x32')](_0x7b9501['attributes'],function(_0x8e9f30){var _0x37409f={};_0x37409f[_0x8e9f30]={'$like':'%'+_0x14a9b4[_0xe36e('0x37')][_0xe36e('0x43')]+'%'};return _0x37409f;})});}_0x7b9501=_['merge']({},_0x7b9501,_0x14a9b4[_0xe36e('0x47')]);return _0x13ad07['getSubjects'](_0x7b9501);}})[_0xe36e('0x1c')](function(_0x5d3dac){if(_0x5d3dac){_0x517c2a=_0x5d3dac[_0xe36e('0x4d')];if(!_0x14a9b4['query']['hasOwnProperty'](_0xe36e('0x3e'))){_0x7b9501[_0xe36e('0x2a')]=qs[_0xe36e('0x2a')](_0x14a9b4['query'][_0xe36e('0x2a')]);_0x7b9501[_0xe36e('0x29')]=qs['offset'](_0x14a9b4[_0xe36e('0x37')][_0xe36e('0x29')]);}return _0x13ad07[_0xe36e('0x56')](_0x7b9501);}})['then'](function(_0x59d513){if(_0x59d513){return _0x59d513?{'count':_0x517c2a,'rows':_0x59d513}:null;}})[_0xe36e('0x1c')](respondWithResult(_0x2a26f4,null))[_0xe36e('0x24')](handleError(_0x2a26f4,null));};exports[_0xe36e('0x57')]=function(_0x327506,_0x411305,_0x51bc99){var _0x3797f0={};var _0x2847a2={};var _0x15334c;var _0x79882;return db[_0xe36e('0x33')]['findOne']({'where':{'id':_0x327506[_0xe36e('0x4b')]['id']}})[_0xe36e('0x1c')](handleEntityNotFound(_0x411305,null))[_0xe36e('0x1c')](function(_0x493d0f){if(_0x493d0f){_0x15334c=_0x493d0f;_0x2847a2[_0xe36e('0x36')]=_['keys'](db[_0xe36e('0x55')]['rawAttributes']);_0x2847a2[_0xe36e('0x37')]=_[_0xe36e('0x38')](_0x327506['query']);_0x2847a2[_0xe36e('0x39')]=_['intersection'](_0x2847a2[_0xe36e('0x36')],_0x2847a2[_0xe36e('0x37')]);_0x3797f0[_0xe36e('0x3b')]=_[_0xe36e('0x3a')](_0x2847a2[_0xe36e('0x36')],qs['fields'](_0x327506[_0xe36e('0x37')]['fields']));_0x3797f0[_0xe36e('0x3b')]=_0x3797f0[_0xe36e('0x3b')][_0xe36e('0x4d')]?_0x3797f0[_0xe36e('0x3b')]:_0x2847a2[_0xe36e('0x36')];_0x3797f0[_0xe36e('0x3f')]=qs['sort'](_0x327506[_0xe36e('0x37')][_0xe36e('0x40')]);_0x3797f0[_0xe36e('0x41')]=qs['filters'](_[_0xe36e('0x42')](_0x327506[_0xe36e('0x37')],_0x2847a2[_0xe36e('0x39')]));if(_0x327506[_0xe36e('0x37')]['filter']){_0x3797f0[_0xe36e('0x41')]=_['merge'](_0x3797f0[_0xe36e('0x41')],{'$or':_['map'](_0x3797f0[_0xe36e('0x3b')],function(_0x357d74){var _0xecf9d8={};_0xecf9d8[_0x357d74]={'$like':'%'+_0x327506['query'][_0xe36e('0x43')]+'%'};return _0xecf9d8;})});}_0x3797f0=_[_0xe36e('0x44')]({},_0x3797f0,_0x327506['options']);return _0x15334c[_0xe36e('0x57')](_0x3797f0);}})[_0xe36e('0x1c')](function(_0x1f4dd2){if(_0x1f4dd2){_0x79882=_0x1f4dd2['length'];if(!_0x327506['query'][_0xe36e('0x3d')](_0xe36e('0x3e'))){_0x3797f0[_0xe36e('0x2a')]=qs[_0xe36e('0x2a')](_0x327506[_0xe36e('0x37')]['limit']);_0x3797f0[_0xe36e('0x29')]=qs[_0xe36e('0x29')](_0x327506[_0xe36e('0x37')][_0xe36e('0x29')]);}return _0x15334c['getDescriptions'](_0x3797f0);}})[_0xe36e('0x1c')](function(_0x173544){if(_0x173544){return _0x173544?{'count':_0x79882,'rows':_0x173544}:null;}})['then'](respondWithResult(_0x411305,null))['catch'](handleError(_0x411305,null));};exports['getTags']=function(_0x1acffb,_0x50709f,_0x58b0df){var _0x310ec2={};var _0x96f37a={};var _0x116f20;var _0x266a5f;return db[_0xe36e('0x33')][_0xe36e('0x54')]({'where':{'id':_0x1acffb['params']['id']}})[_0xe36e('0x1c')](handleEntityNotFound(_0x50709f,null))['then'](function(_0x493692){if(_0x493692){_0x116f20=_0x493692;_0x96f37a[_0xe36e('0x36')]=_[_0xe36e('0x38')](db[_0xe36e('0x58')][_0xe36e('0x4c')]);_0x96f37a['query']=_[_0xe36e('0x38')](_0x1acffb[_0xe36e('0x37')]);_0x96f37a[_0xe36e('0x39')]=_[_0xe36e('0x3a')](_0x96f37a['model'],_0x96f37a[_0xe36e('0x37')]);_0x310ec2['attributes']=_[_0xe36e('0x3a')](_0x96f37a[_0xe36e('0x36')],qs[_0xe36e('0x3c')](_0x1acffb[_0xe36e('0x37')][_0xe36e('0x3c')]));_0x310ec2['attributes']=_0x310ec2[_0xe36e('0x3b')][_0xe36e('0x4d')]?_0x310ec2[_0xe36e('0x3b')]:_0x96f37a[_0xe36e('0x36')];_0x310ec2[_0xe36e('0x3f')]=qs[_0xe36e('0x40')](_0x1acffb[_0xe36e('0x37')][_0xe36e('0x40')]);_0x310ec2[_0xe36e('0x41')]=qs[_0xe36e('0x39')](_[_0xe36e('0x42')](_0x1acffb[_0xe36e('0x37')],_0x96f37a[_0xe36e('0x39')]));if(_0x1acffb['query']['filter']){_0x310ec2['where']=_[_0xe36e('0x44')](_0x310ec2[_0xe36e('0x41')],{'$or':_[_0xe36e('0x32')](_0x310ec2[_0xe36e('0x3b')],function(_0x5026ee){var _0x1edfd5={};_0x1edfd5[_0x5026ee]={'$like':'%'+_0x1acffb[_0xe36e('0x37')][_0xe36e('0x43')]+'%'};return _0x1edfd5;})});}_0x310ec2=_[_0xe36e('0x44')]({},_0x310ec2,_0x1acffb['options']);return _0x116f20[_0xe36e('0x59')](_0x310ec2);}})[_0xe36e('0x1c')](function(_0xdd1816){if(_0xdd1816){_0x266a5f=_0xdd1816[_0xe36e('0x4d')];if(!_0x1acffb['query']['hasOwnProperty'](_0xe36e('0x3e'))){_0x310ec2[_0xe36e('0x2a')]=qs['limit'](_0x1acffb['query']['limit']);_0x310ec2[_0xe36e('0x29')]=qs[_0xe36e('0x29')](_0x1acffb[_0xe36e('0x37')]['offset']);}return _0x116f20[_0xe36e('0x59')](_0x310ec2);}})[_0xe36e('0x1c')](function(_0x280812){if(_0x280812){return _0x280812?{'count':_0x266a5f,'rows':_0x280812}:null;}})[_0xe36e('0x1c')](respondWithResult(_0x50709f,null))['catch'](handleError(_0x50709f,null));};exports[_0xe36e('0x5a')]=function(_0xd25f52,_0x18c16b,_0x3b4152){if(_0xd25f52['body']['id']){delete _0xd25f52[_0xe36e('0x52')]['id'];}return db['DeskConfiguration'][_0xe36e('0x54')]({'where':{'id':_0xd25f52['params']['id']}})[_0xe36e('0x1c')](handleEntityNotFound(_0x18c16b,null))[_0xe36e('0x1c')](function(_0x498822){if(_0x498822){return _0x498822[_0xe36e('0x5a')](_0xd25f52[_0xe36e('0x52')]['ids']||[]);}return null;})[_0xe36e('0x1c')](respondWithResult(_0x18c16b,null))[_0xe36e('0x24')](handleError(_0x18c16b,null));}; \ No newline at end of file +var _0x4024=['set','Content-Range','apply','reject','save','destroy','end','stack','name','send','index','map','DeskConfiguration','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','show','params','rawAttributes','find','create','body','getFields','findOne','DeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','undefined','limit','count','offset'];(function(_0x4b5e77,_0x1898e7){var _0x301f24=function(_0x2593e1){while(--_0x2593e1){_0x4b5e77['push'](_0x4b5e77['shift']());}};_0x301f24(++_0x1898e7);}(_0x4024,0x89));var _0x4402=function(_0x313533,_0x517477){_0x313533=_0x313533-0x0;var _0x1a99e3=_0x4024[_0x313533];return _0x1a99e3;};'use strict';var emlformat=require(_0x4402('0x0'));var rimraf=require(_0x4402('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4402('0x2'));var rp=require(_0x4402('0x3'));var moment=require('moment');var BPromise=require(_0x4402('0x4'));var Mustache=require('mustache');var util=require(_0x4402('0x5'));var path=require(_0x4402('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4402('0x7'));var fs=require('fs');var fs_extra=require(_0x4402('0x8'));var _=require(_0x4402('0x9'));var squel=require('squel');var crypto=require(_0x4402('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4402('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4402('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4402('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4402('0xe'));var logger=require('../../config/logger')(_0x4402('0xf'));var utils=require(_0x4402('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4402('0x11'));var db=require(_0x4402('0x12'))['db'];var jayson=require(_0x4402('0x13'));var client=jayson['client'][_0x4402('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x34d952,_0x42f1b0,_0x19d2f4,_0x248ad9){return new BPromise(function(_0x31710c,_0x18c7a8){var _0x3c7dd2=_0x248ad9||client;return _0x3c7dd2[_0x4402('0x15')](_0x34d952,_0x19d2f4)[_0x4402('0x16')](function(_0x375166){logger[_0x4402('0x17')](_0x4402('0x18'),_0x42f1b0,_0x4402('0x19'));logger[_0x4402('0x1a')](_0x4402('0x1b'),_0x42f1b0,_0x4402('0x19'),JSON[_0x4402('0x1c')](_0x375166));if(_0x375166[_0x4402('0x1d')]){if(_0x375166[_0x4402('0x1d')]['code']===0x1f4){logger['error'](_0x4402('0x18'),_0x42f1b0,_0x375166[_0x4402('0x1d')]['message']);return _0x18c7a8(_0x375166[_0x4402('0x1d')][_0x4402('0x1e')]);}logger['error'](_0x4402('0x18'),_0x42f1b0,_0x375166['error']['message']);return _0x31710c(_0x375166[_0x4402('0x1d')][_0x4402('0x1e')]);}else{logger[_0x4402('0x17')]('DeskConfiguration,\x20%s,\x20%s',_0x42f1b0,_0x4402('0x19'));_0x31710c(_0x375166['result']['message']);}})[_0x4402('0x1f')](function(_0x275c70){logger[_0x4402('0x1d')](_0x4402('0x18'),_0x42f1b0,_0x275c70);_0x18c7a8(_0x275c70);});});}function respondWithStatusCode(_0x258d10,_0x2e6fee){_0x2e6fee=_0x2e6fee||0xcc;return function(_0x289a3e){if(_0x289a3e){return _0x258d10[_0x4402('0x20')](_0x2e6fee);}return _0x258d10[_0x4402('0x21')](_0x2e6fee)['end']();};}function respondWithResult(_0x1409a9,_0x4e1c04){_0x4e1c04=_0x4e1c04||0xc8;return function(_0x3733cd){if(_0x3733cd){return _0x1409a9[_0x4402('0x21')](_0x4e1c04)[_0x4402('0x22')](_0x3733cd);}};}function respondWithFilteredResult(_0x211424,_0x5a43d0){return function(_0x15c19f){if(_0x15c19f){var _0x4e9cb5=typeof _0x5a43d0['offset']===_0x4402('0x23')&&typeof _0x5a43d0[_0x4402('0x24')]===_0x4402('0x23');var _0xabf61b=_0x15c19f[_0x4402('0x25')];var _0x514e41=_0x4e9cb5?0x0:_0x5a43d0[_0x4402('0x26')];var _0x52e625=_0x4e9cb5?_0x15c19f[_0x4402('0x25')]:_0x5a43d0[_0x4402('0x26')]+_0x5a43d0[_0x4402('0x24')];var _0x48d20d;if(_0x52e625>=_0xabf61b){_0x52e625=_0xabf61b;_0x48d20d=0xc8;}else{_0x48d20d=0xce;}_0x211424[_0x4402('0x21')](_0x48d20d);return _0x211424[_0x4402('0x27')](_0x4402('0x28'),_0x514e41+'-'+_0x52e625+'/'+_0xabf61b)[_0x4402('0x22')](_0x15c19f);}return null;};}function patchUpdates(_0x2526d1){return function(_0x605702){try{jsonpatch[_0x4402('0x29')](_0x605702,_0x2526d1,!![]);}catch(_0x435cfe){return BPromise[_0x4402('0x2a')](_0x435cfe);}return _0x605702[_0x4402('0x2b')]();};}function saveUpdates(_0xcea26b,_0x50748c){return function(_0x39f3fc){if(_0x39f3fc){return _0x39f3fc['update'](_0xcea26b)[_0x4402('0x16')](function(_0x554096){return _0x554096;});}return null;};}function removeEntity(_0x2dea0f,_0x3c7c65){return function(_0x145003){if(_0x145003){return _0x145003[_0x4402('0x2c')]()[_0x4402('0x16')](function(){_0x2dea0f['status'](0xcc)[_0x4402('0x2d')]();});}};}function handleEntityNotFound(_0x3fa7ae,_0x169340){return function(_0x566782){if(!_0x566782){_0x3fa7ae[_0x4402('0x20')](0x194);}return _0x566782;};}function handleError(_0x3383e3,_0x535e1d){_0x535e1d=_0x535e1d||0x1f4;return function(_0x2db1fe){logger[_0x4402('0x1d')](_0x2db1fe[_0x4402('0x2e')]);if(_0x2db1fe[_0x4402('0x2f')]){delete _0x2db1fe[_0x4402('0x2f')];}_0x3383e3[_0x4402('0x21')](_0x535e1d)[_0x4402('0x30')](_0x2db1fe);};}exports[_0x4402('0x31')]=function(_0xd66864,_0x5c819a){var _0x2995b6={},_0x28fee8={},_0x2a1657={'count':0x0,'rows':[]};var _0x566a80=_[_0x4402('0x32')](db[_0x4402('0x33')]['rawAttributes'],function(_0x52f75f){return{'name':_0x52f75f[_0x4402('0x34')],'type':_0x52f75f[_0x4402('0x35')][_0x4402('0x36')]};});_0x28fee8[_0x4402('0x37')]=_['map'](_0x566a80,'name');_0x28fee8['query']=_[_0x4402('0x38')](_0xd66864[_0x4402('0x39')]);_0x28fee8[_0x4402('0x3a')]=_[_0x4402('0x3b')](_0x28fee8['model'],_0x28fee8[_0x4402('0x39')]);_0x2995b6[_0x4402('0x3c')]=_[_0x4402('0x3b')](_0x28fee8['model'],qs[_0x4402('0x3d')](_0xd66864['query'][_0x4402('0x3d')]));_0x2995b6[_0x4402('0x3c')]=_0x2995b6['attributes'][_0x4402('0x3e')]?_0x2995b6['attributes']:_0x28fee8[_0x4402('0x37')];if(!_0xd66864[_0x4402('0x39')]['hasOwnProperty'](_0x4402('0x3f'))){_0x2995b6[_0x4402('0x24')]=qs[_0x4402('0x24')](_0xd66864[_0x4402('0x39')]['limit']);_0x2995b6['offset']=qs[_0x4402('0x26')](_0xd66864['query'][_0x4402('0x26')]);}_0x2995b6[_0x4402('0x40')]=qs[_0x4402('0x41')](_0xd66864[_0x4402('0x39')][_0x4402('0x41')]);_0x2995b6[_0x4402('0x42')]=qs[_0x4402('0x3a')](_[_0x4402('0x43')](_0xd66864[_0x4402('0x39')],_0x28fee8[_0x4402('0x3a')]),_0x566a80);if(_0xd66864['query'][_0x4402('0x44')]){_0x2995b6[_0x4402('0x42')]=_['merge'](_0x2995b6[_0x4402('0x42')],{'$or':_[_0x4402('0x32')](_0x566a80,function(_0x50552a){if(_0x50552a[_0x4402('0x35')]!==_0x4402('0x45')){var _0x1822c8={};_0x1822c8[_0x50552a[_0x4402('0x2f')]]={'$like':'%'+_0xd66864[_0x4402('0x39')]['filter']+'%'};return _0x1822c8;}})});}_0x2995b6=_[_0x4402('0x46')]({},_0x2995b6,_0xd66864[_0x4402('0x47')]);var _0x21d34f={'where':_0x2995b6[_0x4402('0x42')]};return db[_0x4402('0x33')][_0x4402('0x25')](_0x21d34f)[_0x4402('0x16')](function(_0x136c9c){_0x2a1657[_0x4402('0x25')]=_0x136c9c;if(_0xd66864[_0x4402('0x39')][_0x4402('0x48')]){_0x2995b6['include']=[{'all':!![]}];}return db[_0x4402('0x33')]['findAll'](_0x2995b6);})[_0x4402('0x16')](function(_0x34ce00){_0x2a1657['rows']=_0x34ce00;return _0x2a1657;})[_0x4402('0x16')](respondWithFilteredResult(_0x5c819a,_0x2995b6))[_0x4402('0x1f')](handleError(_0x5c819a,null));};exports[_0x4402('0x49')]=function(_0x21aa2d,_0x4436b2){var _0x2503eb={'raw':![],'where':{'id':_0x21aa2d[_0x4402('0x4a')]['id']}},_0x5b094b={};_0x5b094b[_0x4402('0x37')]=_[_0x4402('0x38')](db[_0x4402('0x33')][_0x4402('0x4b')]);_0x5b094b[_0x4402('0x39')]=_[_0x4402('0x38')](_0x21aa2d[_0x4402('0x39')]);_0x5b094b[_0x4402('0x3a')]=_['intersection'](_0x5b094b['model'],_0x5b094b['query']);_0x2503eb['attributes']=_[_0x4402('0x3b')](_0x5b094b[_0x4402('0x37')],qs[_0x4402('0x3d')](_0x21aa2d[_0x4402('0x39')]['fields']));_0x2503eb[_0x4402('0x3c')]=_0x2503eb[_0x4402('0x3c')][_0x4402('0x3e')]?_0x2503eb[_0x4402('0x3c')]:_0x5b094b[_0x4402('0x37')];if(_0x21aa2d[_0x4402('0x39')][_0x4402('0x48')]){_0x2503eb['include']=[{'all':!![]}];}_0x2503eb=_[_0x4402('0x46')]({},_0x2503eb,_0x21aa2d[_0x4402('0x47')]);return db[_0x4402('0x33')][_0x4402('0x4c')](_0x2503eb)[_0x4402('0x16')](handleEntityNotFound(_0x4436b2,null))[_0x4402('0x16')](respondWithResult(_0x4436b2,null))['catch'](handleError(_0x4436b2,null));};exports[_0x4402('0x4d')]=function(_0x642ab4,_0x3f45c3){return db[_0x4402('0x33')][_0x4402('0x4d')](_0x642ab4[_0x4402('0x4e')],{})[_0x4402('0x16')](respondWithResult(_0x3f45c3,0xc9))['catch'](handleError(_0x3f45c3,null));};exports['update']=function(_0x1a94f5,_0xb82409){if(_0x1a94f5[_0x4402('0x4e')]['id']){delete _0x1a94f5['body']['id'];}return db['DeskConfiguration'][_0x4402('0x4c')]({'where':{'id':_0x1a94f5[_0x4402('0x4a')]['id']}})[_0x4402('0x16')](handleEntityNotFound(_0xb82409,null))[_0x4402('0x16')](saveUpdates(_0x1a94f5[_0x4402('0x4e')],null))[_0x4402('0x16')](respondWithResult(_0xb82409,null))[_0x4402('0x1f')](handleError(_0xb82409,null));};exports[_0x4402('0x2c')]=function(_0x394ac9,_0x3f2599){return db[_0x4402('0x33')][_0x4402('0x4c')]({'where':{'id':_0x394ac9[_0x4402('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3f2599,null))[_0x4402('0x16')](removeEntity(_0x3f2599,null))['catch'](handleError(_0x3f2599,null));};exports[_0x4402('0x4f')]=function(_0x55922e,_0x3fb9f0,_0x1e5891){var _0x1e4f1a={};var _0x31e36c={};var _0x1f298c;var _0x3cff5b;return db['DeskConfiguration'][_0x4402('0x50')]({'where':{'id':_0x55922e[_0x4402('0x4a')]['id']}})[_0x4402('0x16')](handleEntityNotFound(_0x3fb9f0,null))[_0x4402('0x16')](function(_0xb341ab){if(_0xb341ab){_0x1f298c=_0xb341ab;_0x31e36c['model']=_[_0x4402('0x38')](db[_0x4402('0x51')][_0x4402('0x4b')]);_0x31e36c[_0x4402('0x39')]=_[_0x4402('0x38')](_0x55922e[_0x4402('0x39')]);_0x31e36c[_0x4402('0x3a')]=_[_0x4402('0x3b')](_0x31e36c['model'],_0x31e36c[_0x4402('0x39')]);_0x1e4f1a[_0x4402('0x3c')]=_['intersection'](_0x31e36c[_0x4402('0x37')],qs[_0x4402('0x3d')](_0x55922e['query']['fields']));_0x1e4f1a[_0x4402('0x3c')]=_0x1e4f1a[_0x4402('0x3c')][_0x4402('0x3e')]?_0x1e4f1a['attributes']:_0x31e36c[_0x4402('0x37')];_0x1e4f1a[_0x4402('0x40')]=qs[_0x4402('0x41')](_0x55922e['query'][_0x4402('0x41')]);_0x1e4f1a[_0x4402('0x42')]=qs[_0x4402('0x3a')](_['pick'](_0x55922e[_0x4402('0x39')],_0x31e36c[_0x4402('0x3a')]));if(_0x55922e['query']['filter']){_0x1e4f1a[_0x4402('0x42')]=_['merge'](_0x1e4f1a[_0x4402('0x42')],{'$or':_[_0x4402('0x32')](_0x1e4f1a['attributes'],function(_0x4803b6){var _0x432c2e={};_0x432c2e[_0x4803b6]={'$like':'%'+_0x55922e[_0x4402('0x39')][_0x4402('0x44')]+'%'};return _0x432c2e;})});}_0x1e4f1a=_[_0x4402('0x46')]({},_0x1e4f1a,_0x55922e['options']);return _0x1f298c[_0x4402('0x4f')](_0x1e4f1a);}})[_0x4402('0x16')](function(_0x22ed41){if(_0x22ed41){_0x3cff5b=_0x22ed41[_0x4402('0x3e')];if(!_0x55922e[_0x4402('0x39')][_0x4402('0x52')](_0x4402('0x3f'))){_0x1e4f1a['limit']=qs[_0x4402('0x24')](_0x55922e[_0x4402('0x39')]['limit']);_0x1e4f1a['offset']=qs[_0x4402('0x26')](_0x55922e['query'][_0x4402('0x26')]);}return _0x1f298c['getFields'](_0x1e4f1a);}})[_0x4402('0x16')](function(_0x10b89a){if(_0x10b89a){return _0x10b89a?{'count':_0x3cff5b,'rows':_0x10b89a}:null;}})[_0x4402('0x16')](respondWithResult(_0x3fb9f0,null))[_0x4402('0x1f')](handleError(_0x3fb9f0,null));};exports[_0x4402('0x53')]=function(_0x1c1857,_0x436a74,_0x2bd8a3){var _0x187fec={};var _0x88864={};var _0x41534c;var _0xfd35f7;return db[_0x4402('0x33')][_0x4402('0x50')]({'where':{'id':_0x1c1857[_0x4402('0x4a')]['id']}})[_0x4402('0x16')](handleEntityNotFound(_0x436a74,null))['then'](function(_0x2ce936){if(_0x2ce936){_0x41534c=_0x2ce936;_0x88864[_0x4402('0x37')]=_[_0x4402('0x38')](db['DeskField'][_0x4402('0x4b')]);_0x88864['query']=_[_0x4402('0x38')](_0x1c1857[_0x4402('0x39')]);_0x88864[_0x4402('0x3a')]=_[_0x4402('0x3b')](_0x88864['model'],_0x88864[_0x4402('0x39')]);_0x187fec['attributes']=_[_0x4402('0x3b')](_0x88864[_0x4402('0x37')],qs[_0x4402('0x3d')](_0x1c1857['query'][_0x4402('0x3d')]));_0x187fec['attributes']=_0x187fec[_0x4402('0x3c')][_0x4402('0x3e')]?_0x187fec[_0x4402('0x3c')]:_0x88864[_0x4402('0x37')];_0x187fec[_0x4402('0x40')]=qs[_0x4402('0x41')](_0x1c1857[_0x4402('0x39')][_0x4402('0x41')]);_0x187fec[_0x4402('0x42')]=qs['filters'](_[_0x4402('0x43')](_0x1c1857[_0x4402('0x39')],_0x88864[_0x4402('0x3a')]));if(_0x1c1857[_0x4402('0x39')][_0x4402('0x44')]){_0x187fec[_0x4402('0x42')]=_[_0x4402('0x46')](_0x187fec[_0x4402('0x42')],{'$or':_[_0x4402('0x32')](_0x187fec['attributes'],function(_0x291015){var _0x2a6dc1={};_0x2a6dc1[_0x291015]={'$like':'%'+_0x1c1857[_0x4402('0x39')]['filter']+'%'};return _0x2a6dc1;})});}_0x187fec=_[_0x4402('0x46')]({},_0x187fec,_0x1c1857['options']);return _0x41534c[_0x4402('0x53')](_0x187fec);}})['then'](function(_0xc1d540){if(_0xc1d540){_0xfd35f7=_0xc1d540[_0x4402('0x3e')];if(!_0x1c1857['query'][_0x4402('0x52')]('nolimit')){_0x187fec[_0x4402('0x24')]=qs[_0x4402('0x24')](_0x1c1857['query'][_0x4402('0x24')]);_0x187fec[_0x4402('0x26')]=qs['offset'](_0x1c1857[_0x4402('0x39')][_0x4402('0x26')]);}return _0x41534c['getSubjects'](_0x187fec);}})[_0x4402('0x16')](function(_0x391867){if(_0x391867){return _0x391867?{'count':_0xfd35f7,'rows':_0x391867}:null;}})[_0x4402('0x16')](respondWithResult(_0x436a74,null))[_0x4402('0x1f')](handleError(_0x436a74,null));};exports[_0x4402('0x54')]=function(_0x17b133,_0x7f28d3,_0x370493){var _0x3da0b9={};var _0x476ae3={};var _0xac63f6;var _0xaa8da3;return db[_0x4402('0x33')][_0x4402('0x50')]({'where':{'id':_0x17b133['params']['id']}})[_0x4402('0x16')](handleEntityNotFound(_0x7f28d3,null))[_0x4402('0x16')](function(_0x4b9ac8){if(_0x4b9ac8){_0xac63f6=_0x4b9ac8;_0x476ae3[_0x4402('0x37')]=_['keys'](db[_0x4402('0x51')][_0x4402('0x4b')]);_0x476ae3[_0x4402('0x39')]=_['keys'](_0x17b133[_0x4402('0x39')]);_0x476ae3[_0x4402('0x3a')]=_[_0x4402('0x3b')](_0x476ae3['model'],_0x476ae3[_0x4402('0x39')]);_0x3da0b9[_0x4402('0x3c')]=_[_0x4402('0x3b')](_0x476ae3[_0x4402('0x37')],qs['fields'](_0x17b133[_0x4402('0x39')][_0x4402('0x3d')]));_0x3da0b9[_0x4402('0x3c')]=_0x3da0b9[_0x4402('0x3c')][_0x4402('0x3e')]?_0x3da0b9[_0x4402('0x3c')]:_0x476ae3[_0x4402('0x37')];_0x3da0b9[_0x4402('0x40')]=qs[_0x4402('0x41')](_0x17b133[_0x4402('0x39')][_0x4402('0x41')]);_0x3da0b9[_0x4402('0x42')]=qs[_0x4402('0x3a')](_['pick'](_0x17b133[_0x4402('0x39')],_0x476ae3[_0x4402('0x3a')]));if(_0x17b133[_0x4402('0x39')][_0x4402('0x44')]){_0x3da0b9['where']=_['merge'](_0x3da0b9[_0x4402('0x42')],{'$or':_[_0x4402('0x32')](_0x3da0b9[_0x4402('0x3c')],function(_0x2c09ab){var _0x4bdb42={};_0x4bdb42[_0x2c09ab]={'$like':'%'+_0x17b133[_0x4402('0x39')][_0x4402('0x44')]+'%'};return _0x4bdb42;})});}_0x3da0b9=_['merge']({},_0x3da0b9,_0x17b133[_0x4402('0x47')]);return _0xac63f6[_0x4402('0x54')](_0x3da0b9);}})[_0x4402('0x16')](function(_0x1271eb){if(_0x1271eb){_0xaa8da3=_0x1271eb[_0x4402('0x3e')];if(!_0x17b133['query'][_0x4402('0x52')](_0x4402('0x3f'))){_0x3da0b9[_0x4402('0x24')]=qs[_0x4402('0x24')](_0x17b133[_0x4402('0x39')][_0x4402('0x24')]);_0x3da0b9[_0x4402('0x26')]=qs['offset'](_0x17b133[_0x4402('0x39')][_0x4402('0x26')]);}return _0xac63f6[_0x4402('0x54')](_0x3da0b9);}})[_0x4402('0x16')](function(_0x2ea904){if(_0x2ea904){return _0x2ea904?{'count':_0xaa8da3,'rows':_0x2ea904}:null;}})['then'](respondWithResult(_0x7f28d3,null))[_0x4402('0x1f')](handleError(_0x7f28d3,null));};exports[_0x4402('0x55')]=function(_0x572e21,_0x2325c7,_0x4c994a){var _0x5bf78a={};var _0x364a26={};var _0x505a13;var _0x32be98;return db['DeskConfiguration']['findOne']({'where':{'id':_0x572e21[_0x4402('0x4a')]['id']}})[_0x4402('0x16')](handleEntityNotFound(_0x2325c7,null))[_0x4402('0x16')](function(_0x1f1222){if(_0x1f1222){_0x505a13=_0x1f1222;_0x364a26[_0x4402('0x37')]=_[_0x4402('0x38')](db['Tag'][_0x4402('0x4b')]);_0x364a26[_0x4402('0x39')]=_['keys'](_0x572e21[_0x4402('0x39')]);_0x364a26['filters']=_['intersection'](_0x364a26[_0x4402('0x37')],_0x364a26['query']);_0x5bf78a[_0x4402('0x3c')]=_[_0x4402('0x3b')](_0x364a26[_0x4402('0x37')],qs[_0x4402('0x3d')](_0x572e21[_0x4402('0x39')]['fields']));_0x5bf78a['attributes']=_0x5bf78a[_0x4402('0x3c')][_0x4402('0x3e')]?_0x5bf78a['attributes']:_0x364a26[_0x4402('0x37')];_0x5bf78a[_0x4402('0x40')]=qs[_0x4402('0x41')](_0x572e21[_0x4402('0x39')][_0x4402('0x41')]);_0x5bf78a[_0x4402('0x42')]=qs['filters'](_['pick'](_0x572e21[_0x4402('0x39')],_0x364a26[_0x4402('0x3a')]));if(_0x572e21[_0x4402('0x39')][_0x4402('0x44')]){_0x5bf78a[_0x4402('0x42')]=_[_0x4402('0x46')](_0x5bf78a['where'],{'$or':_[_0x4402('0x32')](_0x5bf78a[_0x4402('0x3c')],function(_0xe21a69){var _0x7fd131={};_0x7fd131[_0xe21a69]={'$like':'%'+_0x572e21[_0x4402('0x39')]['filter']+'%'};return _0x7fd131;})});}_0x5bf78a=_[_0x4402('0x46')]({},_0x5bf78a,_0x572e21[_0x4402('0x47')]);return _0x505a13[_0x4402('0x55')](_0x5bf78a);}})[_0x4402('0x16')](function(_0x3b89e8){if(_0x3b89e8){_0x32be98=_0x3b89e8[_0x4402('0x3e')];if(!_0x572e21['query']['hasOwnProperty'](_0x4402('0x3f'))){_0x5bf78a['limit']=qs[_0x4402('0x24')](_0x572e21[_0x4402('0x39')][_0x4402('0x24')]);_0x5bf78a[_0x4402('0x26')]=qs[_0x4402('0x26')](_0x572e21[_0x4402('0x39')][_0x4402('0x26')]);}return _0x505a13[_0x4402('0x55')](_0x5bf78a);}})[_0x4402('0x16')](function(_0x23306f){if(_0x23306f){return _0x23306f?{'count':_0x32be98,'rows':_0x23306f}:null;}})[_0x4402('0x16')](respondWithResult(_0x2325c7,null))[_0x4402('0x1f')](handleError(_0x2325c7,null));};exports[_0x4402('0x56')]=function(_0x372c6e,_0x127d5e,_0x1ba5a1){if(_0x372c6e[_0x4402('0x4e')]['id']){delete _0x372c6e[_0x4402('0x4e')]['id'];}return db[_0x4402('0x33')][_0x4402('0x50')]({'where':{'id':_0x372c6e[_0x4402('0x4a')]['id']}})[_0x4402('0x16')](handleEntityNotFound(_0x127d5e,null))[_0x4402('0x16')](function(_0x47a76a){if(_0x47a76a){return _0x47a76a[_0x4402('0x56')](_0x372c6e[_0x4402('0x4e')][_0x4402('0x57')]||[]);}return null;})[_0x4402('0x16')](respondWithResult(_0x127d5e,null))[_0x4402('0x1f')](handleError(_0x127d5e,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 376a8cb..0ba3fb1 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 _0xbbe6=['path','rimraf','./intDeskConfiguration.attributes','define','DeskConfiguration','util','../../config/logger','api','moment','request-promise'];(function(_0x341383,_0x346a4f){var _0xde8724=function(_0x2309a2){while(--_0x2309a2){_0x341383['push'](_0x341383['shift']());}};_0xde8724(++_0x346a4f);}(_0xbbe6,0x1c7));var _0x6bbe=function(_0x11bf17,_0x1f6fc3){_0x11bf17=_0x11bf17-0x0;var _0x26e010=_0xbbe6[_0x11bf17];return _0x26e010;};'use strict';var _=require('lodash');var util=require(_0x6bbe('0x0'));var logger=require(_0x6bbe('0x1'))(_0x6bbe('0x2'));var moment=require(_0x6bbe('0x3'));var BPromise=require('bluebird');var rp=require(_0x6bbe('0x4'));var fs=require('fs');var path=require(_0x6bbe('0x5'));var rimraf=require(_0x6bbe('0x6'));var config=require('../../config/environment');var attributes=require(_0x6bbe('0x7'));module['exports']=function(_0x721dc,_0x21a1f2){return _0x721dc[_0x6bbe('0x8')](_0x6bbe('0x9'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6ab=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0xb6ab,0x1dc));var _0xbb6a=function(_0x4d275d,_0x530222){_0x4d275d=_0x4d275d-0x0;var _0x41d6a8=_0xb6ab[_0x4d275d];return _0x41d6a8;};'use strict';var _=require(_0xbb6a('0x0'));var util=require(_0xbb6a('0x1'));var logger=require(_0xbb6a('0x2'))(_0xbb6a('0x3'));var moment=require(_0xbb6a('0x4'));var BPromise=require(_0xbb6a('0x5'));var rp=require(_0xbb6a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb6a('0x7'));var config=require(_0xbb6a('0x8'));var attributes=require(_0xbb6a('0x9'));module[_0xbb6a('0xa')]=function(_0xf1431f,_0x964353){return _0xf1431f[_0xbb6a('0xb')](_0xbb6a('0xc'),attributes,{'tableName':_0xbb6a('0xd'),'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 132316f..a71c296 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 _0x74b1=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','request','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','info'];(function(_0x2774b5,_0x18de2f){var _0x5d3b4d=function(_0x3c5f77){while(--_0x3c5f77){_0x2774b5['push'](_0x2774b5['shift']());}};_0x5d3b4d(++_0x18de2f);}(_0x74b1,0xb5));var _0x174b=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0x74b1[_0xf0bc07];return _0x1c50c2;};'use strict';var _=require(_0x174b('0x0'));var util=require(_0x174b('0x1'));var moment=require('moment');var BPromise=require(_0x174b('0x2'));var rs=require(_0x174b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x174b('0x4'))['db'];var utils=require(_0x174b('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x174b('0x6'));var client=jayson[_0x174b('0x7')][_0x174b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5127e6,_0x1858ab,_0x3dbdef){return new BPromise(function(_0x48edc5,_0x483ec9){return client[_0x174b('0x9')](_0x5127e6,_0x3dbdef)['then'](function(_0x907686){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x1858ab,_0x174b('0xa'));logger[_0x174b('0xb')](_0x174b('0xc'),_0x1858ab,_0x174b('0xa'),JSON[_0x174b('0xd')](_0x907686));if(_0x907686[_0x174b('0xe')]){if(_0x907686[_0x174b('0xe')][_0x174b('0xf')]===0x1f4){logger[_0x174b('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x1858ab,_0x907686[_0x174b('0xe')][_0x174b('0x10')]);return _0x483ec9(_0x907686[_0x174b('0xe')][_0x174b('0x10')]);}logger[_0x174b('0xe')](_0x174b('0x11'),_0x1858ab,_0x907686[_0x174b('0xe')][_0x174b('0x10')]);return _0x48edc5(_0x907686[_0x174b('0xe')]['message']);}else{logger[_0x174b('0x12')](_0x174b('0x11'),_0x1858ab,_0x174b('0xa'));_0x48edc5(_0x907686['result']['message']);}})[_0x174b('0x13')](function(_0x10995c){logger[_0x174b('0xe')](_0x174b('0x11'),_0x1858ab,_0x10995c);_0x483ec9(_0x10995c);});});} \ No newline at end of file +var _0x028d=['result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x25d573,_0x2f606a){var _0x341a2a=function(_0x1398cd){while(--_0x1398cd){_0x25d573['push'](_0x25d573['shift']());}};_0x341a2a(++_0x2f606a);}(_0x028d,0xff));var _0xd028=function(_0x3be3ad,_0x17c9de){_0x3be3ad=_0x3be3ad-0x0;var _0x7b29c4=_0x028d[_0x3be3ad];return _0x7b29c4;};'use strict';var _=require('lodash');var util=require(_0xd028('0x0'));var moment=require(_0xd028('0x1'));var BPromise=require('bluebird');var rs=require(_0xd028('0x2'));var fs=require('fs');var Redis=require(_0xd028('0x3'));var db=require(_0xd028('0x4'))['db'];var utils=require(_0xd028('0x5'));var logger=require(_0xd028('0x6'))(_0xd028('0x7'));var config=require('../../config/environment');var jayson=require(_0xd028('0x8'));var client=jayson[_0xd028('0x9')][_0xd028('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35b879,_0x110b50,_0xb35f34){return new BPromise(function(_0xab6e68,_0x487e07){return client[_0xd028('0xb')](_0x35b879,_0xb35f34)[_0xd028('0xc')](function(_0xb9d983){logger[_0xd028('0xd')](_0xd028('0xe'),_0x110b50,_0xd028('0xf'));logger['debug'](_0xd028('0x10'),_0x110b50,_0xd028('0xf'),JSON[_0xd028('0x11')](_0xb9d983));if(_0xb9d983[_0xd028('0x12')]){if(_0xb9d983[_0xd028('0x12')][_0xd028('0x13')]===0x1f4){logger['error'](_0xd028('0xe'),_0x110b50,_0xb9d983[_0xd028('0x12')]['message']);return _0x487e07(_0xb9d983[_0xd028('0x12')][_0xd028('0x14')]);}logger[_0xd028('0x12')](_0xd028('0xe'),_0x110b50,_0xb9d983[_0xd028('0x12')][_0xd028('0x14')]);return _0xab6e68(_0xb9d983[_0xd028('0x12')][_0xd028('0x14')]);}else{logger[_0xd028('0xd')](_0xd028('0xe'),_0x110b50,_0xd028('0xf'));_0xab6e68(_0xb9d983[_0xd028('0x15')]['message']);}})[_0xd028('0x16')](function(_0x5a6670){logger[_0xd028('0x12')](_0xd028('0xe'),_0x110b50,_0x5a6670);_0x487e07(_0x5a6670);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 374965f..5f47882 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 _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x7a54,0x106));var _0x47a5=function(_0x197376,_0x2be7b2){_0x197376=_0x197376-0x0;var _0x189702=_0x7a54[_0x197376];return _0x189702;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x7a54,0x106));var _0x47a5=function(_0x67060,_0x5c1b4a){_0x67060=_0x67060-0x0;var _0x5d9503=_0x7a54[_0x67060];return _0x5d9503;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index cb02051..6042f8b 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 _0x9b92=['variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','ENUM','string'];(function(_0x3b30cf,_0x17b43c){var _0x438e91=function(_0x54bfc6){while(--_0x54bfc6){_0x3b30cf['push'](_0x3b30cf['shift']());}};_0x438e91(++_0x17b43c);}(_0x9b92,0x1e3));var _0x29b9=function(_0x329aaa,_0x38ab7e){_0x329aaa=_0x329aaa-0x0;var _0x33c3bc=_0x9b92[_0x329aaa];return _0x33c3bc;};'use strict';var Sequelize=require(_0x29b9('0x0'));module['exports']={'type':{'type':Sequelize[_0x29b9('0x1')](_0x29b9('0x2'),_0x29b9('0x3'),'customVariable',_0x29b9('0x4'),_0x29b9('0x5')),'defaultValue':_0x29b9('0x2')},'content':{'type':Sequelize[_0x29b9('0x6')]},'key':{'type':Sequelize[_0x29b9('0x6')]},'keyType':{'type':Sequelize[_0x29b9('0x1')]('string',_0x29b9('0x3'),_0x29b9('0x7'))},'keyContent':{'type':Sequelize[_0x29b9('0x6')]},'idField':{'type':Sequelize[_0x29b9('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x29b9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x29b9('0x6')]}}; \ No newline at end of file +var _0xb23d=['picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x4b05e3,_0x54ca9c){var _0x411224=function(_0x5b2644){while(--_0x5b2644){_0x4b05e3['push'](_0x4b05e3['shift']());}};_0x411224(++_0x54ca9c);}(_0xb23d,0x6a));var _0xdb23=function(_0x198446,_0x119c8f){_0x198446=_0x198446-0x0;var _0x38d7b7=_0xb23d[_0x198446];return _0x38d7b7;};'use strict';var Sequelize=require(_0xdb23('0x0'));module[_0xdb23('0x1')]={'type':{'type':Sequelize[_0xdb23('0x2')](_0xdb23('0x3'),_0xdb23('0x4'),_0xdb23('0x5'),'keyValue',_0xdb23('0x6')),'defaultValue':_0xdb23('0x3')},'content':{'type':Sequelize[_0xdb23('0x7')]},'key':{'type':Sequelize[_0xdb23('0x7')]},'keyType':{'type':Sequelize[_0xdb23('0x2')](_0xdb23('0x3'),_0xdb23('0x4'),_0xdb23('0x5'))},'keyContent':{'type':Sequelize[_0xdb23('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdb23('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 82580c7..5ad5542 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 _0x4e2e=['json','apply','reject','save','then','destroy','stack','name','send','map','DeskField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range'];(function(_0x3b8eeb,_0x11cd67){var _0x1d84f4=function(_0xa837aa){while(--_0xa837aa){_0x3b8eeb['push'](_0x3b8eeb['shift']());}};_0x1d84f4(++_0x11cd67);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x1dcfcf,_0x410094){_0x1dcfcf=_0x1dcfcf-0x0;var _0x3a7232=_0x4e2e[_0x1dcfcf];return _0x3a7232;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4e2('0x0'));var zipdir=require(_0xe4e2('0x1'));var jsonpatch=require(_0xe4e2('0x2'));var rp=require(_0xe4e2('0x3'));var moment=require(_0xe4e2('0x4'));var BPromise=require(_0xe4e2('0x5'));var Mustache=require('mustache');var util=require(_0xe4e2('0x6'));var path=require(_0xe4e2('0x7'));var sox=require(_0xe4e2('0x8'));var csv=require(_0xe4e2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe4e2('0xa'));var _=require(_0xe4e2('0xb'));var squel=require(_0xe4e2('0xc'));var crypto=require(_0xe4e2('0xd'));var jsforce=require(_0xe4e2('0xe'));var deskjs=require(_0xe4e2('0xf'));var toCsv=require(_0xe4e2('0x9'));var querystring=require(_0xe4e2('0x10'));var Papa=require('papaparse');var Redis=require(_0xe4e2('0x11'));var authService=require(_0xe4e2('0x12'));var qs=require(_0xe4e2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4e2('0x14'));var logger=require(_0xe4e2('0x15'))(_0xe4e2('0x16'));var utils=require(_0xe4e2('0x17'));var config=require(_0xe4e2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4e2('0x19'))['db'];function respondWithStatusCode(_0x20d34e,_0x19c6ef){_0x19c6ef=_0x19c6ef||0xcc;return function(_0x13657c){if(_0x13657c){return _0x20d34e['sendStatus'](_0x19c6ef);}return _0x20d34e[_0xe4e2('0x1a')](_0x19c6ef)[_0xe4e2('0x1b')]();};}function respondWithResult(_0xb45217,_0x4e0bc2){_0x4e0bc2=_0x4e0bc2||0xc8;return function(_0x202486){if(_0x202486){return _0xb45217['status'](_0x4e0bc2)['json'](_0x202486);}};}function respondWithFilteredResult(_0x117a2a,_0x2d2018){return function(_0x1f9b2d){if(_0x1f9b2d){var _0x28ee12=typeof _0x2d2018[_0xe4e2('0x1c')]==='undefined'&&typeof _0x2d2018[_0xe4e2('0x1d')]===_0xe4e2('0x1e');var _0x340935=_0x1f9b2d['count'];var _0x196f16=_0x28ee12?0x0:_0x2d2018['offset'];var _0x1d5e9d=_0x28ee12?_0x1f9b2d[_0xe4e2('0x1f')]:_0x2d2018[_0xe4e2('0x1c')]+_0x2d2018[_0xe4e2('0x1d')];var _0x3dfbdf;if(_0x1d5e9d>=_0x340935){_0x1d5e9d=_0x340935;_0x3dfbdf=0xc8;}else{_0x3dfbdf=0xce;}_0x117a2a[_0xe4e2('0x1a')](_0x3dfbdf);return _0x117a2a[_0xe4e2('0x20')](_0xe4e2('0x21'),_0x196f16+'-'+_0x1d5e9d+'/'+_0x340935)[_0xe4e2('0x22')](_0x1f9b2d);}return null;};}function patchUpdates(_0x362741){return function(_0x5a84c5){try{jsonpatch[_0xe4e2('0x23')](_0x5a84c5,_0x362741,!![]);}catch(_0x2e7ecd){return BPromise[_0xe4e2('0x24')](_0x2e7ecd);}return _0x5a84c5[_0xe4e2('0x25')]();};}function saveUpdates(_0xbdf1ad,_0x23b466){return function(_0x16f14b){if(_0x16f14b){return _0x16f14b['update'](_0xbdf1ad)[_0xe4e2('0x26')](function(_0x2ab435){return _0x2ab435;});}return null;};}function removeEntity(_0x2088b9,_0x5373c0){return function(_0x353030){if(_0x353030){return _0x353030[_0xe4e2('0x27')]()['then'](function(){_0x2088b9[_0xe4e2('0x1a')](0xcc)[_0xe4e2('0x1b')]();});}};}function handleEntityNotFound(_0x29143c,_0x3f5265){return function(_0x249b7e){if(!_0x249b7e){_0x29143c['sendStatus'](0x194);}return _0x249b7e;};}function handleError(_0x166610,_0x357903){_0x357903=_0x357903||0x1f4;return function(_0x1f6d1f){logger['error'](_0x1f6d1f[_0xe4e2('0x28')]);if(_0x1f6d1f[_0xe4e2('0x29')]){delete _0x1f6d1f[_0xe4e2('0x29')];}_0x166610['status'](_0x357903)[_0xe4e2('0x2a')](_0x1f6d1f);};}exports['index']=function(_0x477b5c,_0x1e21c0){var _0x52c849={},_0x46926a={},_0x18e2e5={'count':0x0,'rows':[]};var _0x135116=_[_0xe4e2('0x2b')](db[_0xe4e2('0x2c')]['rawAttributes'],function(_0x5f30dc){return{'name':_0x5f30dc[_0xe4e2('0x2d')],'type':_0x5f30dc[_0xe4e2('0x2e')][_0xe4e2('0x2f')]};});_0x46926a[_0xe4e2('0x30')]=_[_0xe4e2('0x2b')](_0x135116,_0xe4e2('0x29'));_0x46926a[_0xe4e2('0x31')]=_[_0xe4e2('0x32')](_0x477b5c[_0xe4e2('0x31')]);_0x46926a[_0xe4e2('0x33')]=_[_0xe4e2('0x34')](_0x46926a[_0xe4e2('0x30')],_0x46926a['query']);_0x52c849[_0xe4e2('0x35')]=_[_0xe4e2('0x34')](_0x46926a[_0xe4e2('0x30')],qs[_0xe4e2('0x36')](_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x36')]));_0x52c849['attributes']=_0x52c849[_0xe4e2('0x35')][_0xe4e2('0x37')]?_0x52c849[_0xe4e2('0x35')]:_0x46926a[_0xe4e2('0x30')];if(!_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x38')](_0xe4e2('0x39'))){_0x52c849[_0xe4e2('0x1d')]=qs[_0xe4e2('0x1d')](_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x1d')]);_0x52c849['offset']=qs[_0xe4e2('0x1c')](_0x477b5c['query'][_0xe4e2('0x1c')]);}_0x52c849[_0xe4e2('0x3a')]=qs['sort'](_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x3b')]);_0x52c849[_0xe4e2('0x3c')]=qs[_0xe4e2('0x33')](_['pick'](_0x477b5c[_0xe4e2('0x31')],_0x46926a['filters']),_0x135116);if(_0x477b5c[_0xe4e2('0x31')]['filter']){_0x52c849[_0xe4e2('0x3c')]=_[_0xe4e2('0x3d')](_0x52c849[_0xe4e2('0x3c')],{'$or':_['map'](_0x135116,function(_0x2f5576){if(_0x2f5576[_0xe4e2('0x2e')]!=='VIRTUAL'){var _0x2b0f61={};_0x2b0f61[_0x2f5576[_0xe4e2('0x29')]]={'$like':'%'+_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x3e')]+'%'};return _0x2b0f61;}})});}_0x52c849=_[_0xe4e2('0x3d')]({},_0x52c849,_0x477b5c[_0xe4e2('0x3f')]);var _0x18fa94={'where':_0x52c849[_0xe4e2('0x3c')]};return db[_0xe4e2('0x2c')]['count'](_0x18fa94)['then'](function(_0xf4f15f){_0x18e2e5[_0xe4e2('0x1f')]=_0xf4f15f;if(_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x40')]){_0x52c849['include']=[{'all':!![]}];}return db['DeskField'][_0xe4e2('0x41')](_0x52c849);})[_0xe4e2('0x26')](function(_0x3080d5){_0x18e2e5[_0xe4e2('0x42')]=_0x3080d5;return _0x18e2e5;})['then'](respondWithFilteredResult(_0x1e21c0,_0x52c849))[_0xe4e2('0x43')](handleError(_0x1e21c0,null));};exports[_0xe4e2('0x44')]=function(_0x385572,_0x577d4c){var _0x1b54f6={'raw':!![],'where':{'id':_0x385572[_0xe4e2('0x45')]['id']}},_0x4789cf={};_0x4789cf[_0xe4e2('0x30')]=_['keys'](db['DeskField'][_0xe4e2('0x46')]);_0x4789cf[_0xe4e2('0x31')]=_[_0xe4e2('0x32')](_0x385572['query']);_0x4789cf[_0xe4e2('0x33')]=_[_0xe4e2('0x34')](_0x4789cf['model'],_0x4789cf[_0xe4e2('0x31')]);_0x1b54f6[_0xe4e2('0x35')]=_[_0xe4e2('0x34')](_0x4789cf[_0xe4e2('0x30')],qs[_0xe4e2('0x36')](_0x385572[_0xe4e2('0x31')][_0xe4e2('0x36')]));_0x1b54f6[_0xe4e2('0x35')]=_0x1b54f6['attributes'][_0xe4e2('0x37')]?_0x1b54f6[_0xe4e2('0x35')]:_0x4789cf['model'];if(_0x385572['query'][_0xe4e2('0x40')]){_0x1b54f6[_0xe4e2('0x47')]=[{'all':!![]}];}_0x1b54f6=_[_0xe4e2('0x3d')]({},_0x1b54f6,_0x385572['options']);return db[_0xe4e2('0x2c')][_0xe4e2('0x48')](_0x1b54f6)[_0xe4e2('0x26')](handleEntityNotFound(_0x577d4c,null))[_0xe4e2('0x26')](respondWithResult(_0x577d4c,null))['catch'](handleError(_0x577d4c,null));};exports[_0xe4e2('0x49')]=function(_0x918c17,_0x32a7c6){return db[_0xe4e2('0x2c')]['create'](_0x918c17[_0xe4e2('0x4a')],{})[_0xe4e2('0x26')](respondWithResult(_0x32a7c6,0xc9))['catch'](handleError(_0x32a7c6,null));};exports[_0xe4e2('0x4b')]=function(_0xedcd86,_0x21e5d7){if(_0xedcd86['body']['id']){delete _0xedcd86[_0xe4e2('0x4a')]['id'];}return db[_0xe4e2('0x2c')][_0xe4e2('0x48')]({'where':{'id':_0xedcd86['params']['id']}})['then'](handleEntityNotFound(_0x21e5d7,null))[_0xe4e2('0x26')](saveUpdates(_0xedcd86['body'],null))[_0xe4e2('0x26')](respondWithResult(_0x21e5d7,null))['catch'](handleError(_0x21e5d7,null));};exports[_0xe4e2('0x27')]=function(_0x2125df,_0x2a2e76){return db['DeskField'][_0xe4e2('0x48')]({'where':{'id':_0x2125df['params']['id']}})[_0xe4e2('0x26')](handleEntityNotFound(_0x2a2e76,null))[_0xe4e2('0x26')](removeEntity(_0x2a2e76,null))['catch'](handleError(_0x2a2e76,null));}; \ No newline at end of file +var _0x282b=['type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','order','where','filters','pick','filter','merge','VIRTUAL','options','DeskField','includeAll','include','findAll','rows','catch','show','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','error','name','send','map','rawAttributes','fieldName'];(function(_0x225843,_0x1ea62f){var _0x2684a8=function(_0x43c540){while(--_0x43c540){_0x225843['push'](_0x225843['shift']());}};_0x2684a8(++_0x1ea62f);}(_0x282b,0xec));var _0xb282=function(_0x699bff,_0x70a37d){_0x699bff=_0x699bff-0x0;var _0x36caf6=_0x282b[_0x699bff];return _0x36caf6;};'use strict';var emlformat=require(_0xb282('0x0'));var rimraf=require(_0xb282('0x1'));var zipdir=require(_0xb282('0x2'));var jsonpatch=require(_0xb282('0x3'));var rp=require(_0xb282('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb282('0x5'));var util=require('util');var path=require(_0xb282('0x6'));var sox=require(_0xb282('0x7'));var csv=require(_0xb282('0x8'));var ejs=require(_0xb282('0x9'));var fs=require('fs');var fs_extra=require(_0xb282('0xa'));var _=require(_0xb282('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb282('0xc'));var deskjs=require(_0xb282('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb282('0xe'));var Papa=require(_0xb282('0xf'));var Redis=require(_0xb282('0x10'));var authService=require(_0xb282('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb282('0x12'));var logger=require(_0xb282('0x13'))(_0xb282('0x14'));var utils=require(_0xb282('0x15'));var config=require(_0xb282('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x338bdb,_0xc08746){_0xc08746=_0xc08746||0xcc;return function(_0x40d7b8){if(_0x40d7b8){return _0x338bdb[_0xb282('0x17')](_0xc08746);}return _0x338bdb[_0xb282('0x18')](_0xc08746)['end']();};}function respondWithResult(_0x34c595,_0x5adf7f){_0x5adf7f=_0x5adf7f||0xc8;return function(_0xe1d53){if(_0xe1d53){return _0x34c595[_0xb282('0x18')](_0x5adf7f)['json'](_0xe1d53);}};}function respondWithFilteredResult(_0x525cfa,_0x5bc7c3){return function(_0x13cea1){if(_0x13cea1){var _0x350676=typeof _0x5bc7c3[_0xb282('0x19')]===_0xb282('0x1a')&&typeof _0x5bc7c3[_0xb282('0x1b')]==='undefined';var _0x191a31=_0x13cea1[_0xb282('0x1c')];var _0xca5f12=_0x350676?0x0:_0x5bc7c3[_0xb282('0x19')];var _0x3f8a3f=_0x350676?_0x13cea1['count']:_0x5bc7c3['offset']+_0x5bc7c3[_0xb282('0x1b')];var _0x2cdeb1;if(_0x3f8a3f>=_0x191a31){_0x3f8a3f=_0x191a31;_0x2cdeb1=0xc8;}else{_0x2cdeb1=0xce;}_0x525cfa['status'](_0x2cdeb1);return _0x525cfa[_0xb282('0x1d')](_0xb282('0x1e'),_0xca5f12+'-'+_0x3f8a3f+'/'+_0x191a31)[_0xb282('0x1f')](_0x13cea1);}return null;};}function patchUpdates(_0x438dbe){return function(_0x1c3084){try{jsonpatch['apply'](_0x1c3084,_0x438dbe,!![]);}catch(_0x1de407){return BPromise[_0xb282('0x20')](_0x1de407);}return _0x1c3084[_0xb282('0x21')]();};}function saveUpdates(_0x4b79d7,_0x437d66){return function(_0x2a7ef8){if(_0x2a7ef8){return _0x2a7ef8[_0xb282('0x22')](_0x4b79d7)[_0xb282('0x23')](function(_0x680095){return _0x680095;});}return null;};}function removeEntity(_0x56645f,_0x4d624f){return function(_0x360f15){if(_0x360f15){return _0x360f15[_0xb282('0x24')]()['then'](function(){_0x56645f['status'](0xcc)[_0xb282('0x25')]();});}};}function handleEntityNotFound(_0x114f77,_0x3451e5){return function(_0x3c4018){if(!_0x3c4018){_0x114f77[_0xb282('0x17')](0x194);}return _0x3c4018;};}function handleError(_0x2b1303,_0x5b1d3d){_0x5b1d3d=_0x5b1d3d||0x1f4;return function(_0xa0d7fb){logger[_0xb282('0x26')](_0xa0d7fb['stack']);if(_0xa0d7fb[_0xb282('0x27')]){delete _0xa0d7fb[_0xb282('0x27')];}_0x2b1303[_0xb282('0x18')](_0x5b1d3d)[_0xb282('0x28')](_0xa0d7fb);};}exports['index']=function(_0x1520b1,_0x1fb89f){var _0xe337b8={},_0x433ad5={},_0x4cee93={'count':0x0,'rows':[]};var _0xfddd2e=_[_0xb282('0x29')](db['DeskField'][_0xb282('0x2a')],function(_0x1e2861){return{'name':_0x1e2861[_0xb282('0x2b')],'type':_0x1e2861[_0xb282('0x2c')][_0xb282('0x2d')]};});_0x433ad5['model']=_[_0xb282('0x29')](_0xfddd2e,'name');_0x433ad5[_0xb282('0x2e')]=_[_0xb282('0x2f')](_0x1520b1[_0xb282('0x2e')]);_0x433ad5['filters']=_[_0xb282('0x30')](_0x433ad5['model'],_0x433ad5[_0xb282('0x2e')]);_0xe337b8[_0xb282('0x31')]=_[_0xb282('0x30')](_0x433ad5[_0xb282('0x32')],qs[_0xb282('0x33')](_0x1520b1[_0xb282('0x2e')]['fields']));_0xe337b8[_0xb282('0x31')]=_0xe337b8[_0xb282('0x31')]['length']?_0xe337b8['attributes']:_0x433ad5[_0xb282('0x32')];if(!_0x1520b1[_0xb282('0x2e')][_0xb282('0x34')]('nolimit')){_0xe337b8['limit']=qs['limit'](_0x1520b1[_0xb282('0x2e')][_0xb282('0x1b')]);_0xe337b8[_0xb282('0x19')]=qs[_0xb282('0x19')](_0x1520b1[_0xb282('0x2e')][_0xb282('0x19')]);}_0xe337b8[_0xb282('0x35')]=qs['sort'](_0x1520b1[_0xb282('0x2e')]['sort']);_0xe337b8[_0xb282('0x36')]=qs[_0xb282('0x37')](_[_0xb282('0x38')](_0x1520b1['query'],_0x433ad5[_0xb282('0x37')]),_0xfddd2e);if(_0x1520b1['query'][_0xb282('0x39')]){_0xe337b8[_0xb282('0x36')]=_[_0xb282('0x3a')](_0xe337b8[_0xb282('0x36')],{'$or':_['map'](_0xfddd2e,function(_0x5c86bb){if(_0x5c86bb[_0xb282('0x2c')]!==_0xb282('0x3b')){var _0x3791fd={};_0x3791fd[_0x5c86bb[_0xb282('0x27')]]={'$like':'%'+_0x1520b1['query'][_0xb282('0x39')]+'%'};return _0x3791fd;}})});}_0xe337b8=_['merge']({},_0xe337b8,_0x1520b1[_0xb282('0x3c')]);var _0x1a1b50={'where':_0xe337b8['where']};return db[_0xb282('0x3d')][_0xb282('0x1c')](_0x1a1b50)[_0xb282('0x23')](function(_0x2c988a){_0x4cee93[_0xb282('0x1c')]=_0x2c988a;if(_0x1520b1[_0xb282('0x2e')][_0xb282('0x3e')]){_0xe337b8[_0xb282('0x3f')]=[{'all':!![]}];}return db[_0xb282('0x3d')][_0xb282('0x40')](_0xe337b8);})[_0xb282('0x23')](function(_0x91fe43){_0x4cee93[_0xb282('0x41')]=_0x91fe43;return _0x4cee93;})[_0xb282('0x23')](respondWithFilteredResult(_0x1fb89f,_0xe337b8))[_0xb282('0x42')](handleError(_0x1fb89f,null));};exports[_0xb282('0x43')]=function(_0x2416a4,_0x7332d2){var _0x573da7={'raw':!![],'where':{'id':_0x2416a4['params']['id']}},_0x310ad1={};_0x310ad1[_0xb282('0x32')]=_[_0xb282('0x2f')](db[_0xb282('0x3d')][_0xb282('0x2a')]);_0x310ad1[_0xb282('0x2e')]=_[_0xb282('0x2f')](_0x2416a4['query']);_0x310ad1['filters']=_[_0xb282('0x30')](_0x310ad1['model'],_0x310ad1[_0xb282('0x2e')]);_0x573da7[_0xb282('0x31')]=_['intersection'](_0x310ad1[_0xb282('0x32')],qs[_0xb282('0x33')](_0x2416a4[_0xb282('0x2e')]['fields']));_0x573da7['attributes']=_0x573da7[_0xb282('0x31')]['length']?_0x573da7[_0xb282('0x31')]:_0x310ad1[_0xb282('0x32')];if(_0x2416a4[_0xb282('0x2e')][_0xb282('0x3e')]){_0x573da7[_0xb282('0x3f')]=[{'all':!![]}];}_0x573da7=_[_0xb282('0x3a')]({},_0x573da7,_0x2416a4['options']);return db[_0xb282('0x3d')][_0xb282('0x44')](_0x573da7)[_0xb282('0x23')](handleEntityNotFound(_0x7332d2,null))['then'](respondWithResult(_0x7332d2,null))[_0xb282('0x42')](handleError(_0x7332d2,null));};exports['create']=function(_0x32fc1d,_0x4b0822){return db[_0xb282('0x3d')]['create'](_0x32fc1d['body'],{})['then'](respondWithResult(_0x4b0822,0xc9))[_0xb282('0x42')](handleError(_0x4b0822,null));};exports[_0xb282('0x22')]=function(_0x42d99f,_0x7a5aa4){if(_0x42d99f['body']['id']){delete _0x42d99f['body']['id'];}return db['DeskField'][_0xb282('0x44')]({'where':{'id':_0x42d99f[_0xb282('0x45')]['id']}})[_0xb282('0x23')](handleEntityNotFound(_0x7a5aa4,null))[_0xb282('0x23')](saveUpdates(_0x42d99f['body'],null))[_0xb282('0x23')](respondWithResult(_0x7a5aa4,null))[_0xb282('0x42')](handleError(_0x7a5aa4,null));};exports['destroy']=function(_0x33bded,_0x9f4d79){return db[_0xb282('0x3d')][_0xb282('0x44')]({'where':{'id':_0x33bded[_0xb282('0x45')]['id']}})['then'](handleEntityNotFound(_0x9f4d79,null))[_0xb282('0x23')](removeEntity(_0x9f4d79,null))[_0xb282('0x42')](handleError(_0x9f4d79,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 4ec4fd4..9287bb9 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 _0xb544=['DeskField','desk_unique_index','idField','FieldId','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define'];(function(_0x5bf35e,_0x4ccc17){var _0x35b3d7=function(_0xefa9e4){while(--_0xefa9e4){_0x5bf35e['push'](_0x5bf35e['shift']());}};_0x35b3d7(++_0x4ccc17);}(_0xb544,0x11c));var _0x4b54=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xb544[_0x51020b];return _0x371e47;};'use strict';var _=require(_0x4b54('0x0'));var util=require('util');var logger=require(_0x4b54('0x1'))('api');var moment=require(_0x4b54('0x2'));var BPromise=require(_0x4b54('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b54('0x4'));var rimraf=require(_0x4b54('0x5'));var config=require(_0x4b54('0x6'));var attributes=require(_0x4b54('0x7'));module[_0x4b54('0x8')]=function(_0x4dd5ce,_0x577e82){return _0x4dd5ce[_0x4b54('0x9')](_0x4b54('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x4b54('0xb'),'fields':[_0x4b54('0xc'),_0x4b54('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xef88=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','desk_unique_index','idField','FieldId','lodash'];(function(_0x48e2dd,_0x4e0336){var _0x37460b=function(_0x5580c6){while(--_0x5580c6){_0x48e2dd['push'](_0x48e2dd['shift']());}};_0x37460b(++_0x4e0336);}(_0xef88,0x1a8));var _0x8ef8=function(_0x193266,_0x37c379){_0x193266=_0x193266-0x0;var _0x2a9bde=_0xef88[_0x193266];return _0x2a9bde;};'use strict';var _=require(_0x8ef8('0x0'));var util=require(_0x8ef8('0x1'));var logger=require(_0x8ef8('0x2'))(_0x8ef8('0x3'));var moment=require(_0x8ef8('0x4'));var BPromise=require(_0x8ef8('0x5'));var rp=require(_0x8ef8('0x6'));var fs=require('fs');var path=require(_0x8ef8('0x7'));var rimraf=require(_0x8ef8('0x8'));var config=require(_0x8ef8('0x9'));var attributes=require(_0x8ef8('0xa'));module[_0x8ef8('0xb')]=function(_0x9089e6,_0x402b41){return _0x9089e6[_0x8ef8('0xc')](_0x8ef8('0xd'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x8ef8('0xe'),'fields':[_0x8ef8('0xf'),_0x8ef8('0x10')],'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 ec7a24a..e97b5ab 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 _0x511e=['DeskField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','jayson/promise','client','request','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x486c14,_0x22542d){var _0x1d3ff9=function(_0x3150ef){while(--_0x3150ef){_0x486c14['push'](_0x486c14['shift']());}};_0x1d3ff9(++_0x22542d);}(_0x511e,0xa3));var _0xe511=function(_0x2a9548,_0x2742f6){_0x2a9548=_0x2a9548-0x0;var _0xf55c55=_0x511e[_0x2a9548];return _0xf55c55;};'use strict';var _=require(_0xe511('0x0'));var util=require(_0xe511('0x1'));var moment=require(_0xe511('0x2'));var BPromise=require(_0xe511('0x3'));var rs=require(_0xe511('0x4'));var fs=require('fs');var Redis=require(_0xe511('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe511('0x6'));var client=jayson[_0xe511('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e358f,_0x1131f4,_0x47db3d){return new BPromise(function(_0x2a069e,_0x4ebdba){return client[_0xe511('0x8')](_0x1e358f,_0x47db3d)[_0xe511('0x9')](function(_0x7b4963){logger[_0xe511('0xa')]('DeskField,\x20%s,\x20%s',_0x1131f4,_0xe511('0xb'));logger[_0xe511('0xc')](_0xe511('0xd'),_0x1131f4,_0xe511('0xb'),JSON['stringify'](_0x7b4963));if(_0x7b4963[_0xe511('0xe')]){if(_0x7b4963['error'][_0xe511('0xf')]===0x1f4){logger[_0xe511('0xe')]('DeskField,\x20%s,\x20%s',_0x1131f4,_0x7b4963[_0xe511('0xe')][_0xe511('0x10')]);return _0x4ebdba(_0x7b4963[_0xe511('0xe')][_0xe511('0x10')]);}logger[_0xe511('0xe')](_0xe511('0x11'),_0x1131f4,_0x7b4963['error'][_0xe511('0x10')]);return _0x2a069e(_0x7b4963['error'][_0xe511('0x10')]);}else{logger[_0xe511('0xa')](_0xe511('0x11'),_0x1131f4,_0xe511('0xb'));_0x2a069e(_0x7b4963[_0xe511('0x12')][_0xe511('0x10')]);}})[_0xe511('0x13')](function(_0x383c49){logger['error'](_0xe511('0x11'),_0x1131f4,_0x383c49);_0x4ebdba(_0x383c49);});});} \ No newline at end of file +var _0xeba8=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash'];(function(_0x10a4df,_0x526a9f){var _0x4612c9=function(_0x2b92ee){while(--_0x2b92ee){_0x10a4df['push'](_0x10a4df['shift']());}};_0x4612c9(++_0x526a9f);}(_0xeba8,0xe6));var _0x8eba=function(_0x5f25b3,_0x35481a){_0x5f25b3=_0x5f25b3-0x0;var _0x4ab9bf=_0xeba8[_0x5f25b3];return _0x4ab9bf;};'use strict';var _=require(_0x8eba('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8eba('0x1'));var fs=require('fs');var Redis=require(_0x8eba('0x2'));var db=require(_0x8eba('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8eba('0x4'))(_0x8eba('0x5'));var config=require(_0x8eba('0x6'));var jayson=require(_0x8eba('0x7'));var client=jayson[_0x8eba('0x8')][_0x8eba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22d246,_0x5eb0ff,_0x1beb63){return new BPromise(function(_0x302c08,_0x2c03b4){return client[_0x8eba('0xa')](_0x22d246,_0x1beb63)[_0x8eba('0xb')](function(_0x1902d8){logger[_0x8eba('0xc')](_0x8eba('0xd'),_0x5eb0ff,_0x8eba('0xe'));logger[_0x8eba('0xf')](_0x8eba('0x10'),_0x5eb0ff,_0x8eba('0xe'),JSON[_0x8eba('0x11')](_0x1902d8));if(_0x1902d8[_0x8eba('0x12')]){if(_0x1902d8[_0x8eba('0x12')]['code']===0x1f4){logger[_0x8eba('0x12')](_0x8eba('0xd'),_0x5eb0ff,_0x1902d8[_0x8eba('0x12')][_0x8eba('0x13')]);return _0x2c03b4(_0x1902d8[_0x8eba('0x12')][_0x8eba('0x13')]);}logger[_0x8eba('0x12')](_0x8eba('0xd'),_0x5eb0ff,_0x1902d8[_0x8eba('0x12')][_0x8eba('0x13')]);return _0x302c08(_0x1902d8[_0x8eba('0x12')][_0x8eba('0x13')]);}else{logger['info'](_0x8eba('0xd'),_0x5eb0ff,_0x8eba('0xe'));_0x302c08(_0x1902d8[_0x8eba('0x14')][_0x8eba('0x13')]);}})['catch'](function(_0x2453bf){logger[_0x8eba('0x12')](_0x8eba('0xd'),_0x5eb0ff,_0x2453bf);_0x2c03b4(_0x2453bf);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 9f215fa..1faee5a 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 _0x691d=['getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/configurations'];(function(_0x6f5e66,_0x2f5281){var _0x104b19=function(_0x2b24aa){while(--_0x2b24aa){_0x6f5e66['push'](_0x6f5e66['shift']());}};_0x104b19(++_0x2f5281);}(_0x691d,0x16a));var _0xd691=function(_0x5a4462,_0x5e5419){_0x5a4462=_0x5a4462-0x0;var _0x2b38e5=_0x691d[_0x5a4462];return _0x2b38e5;};'use strict';var multer=require(_0xd691('0x0'));var util=require('util');var path=require(_0xd691('0x1'));var timeout=require('connect-timeout');var express=require(_0xd691('0x2'));var router=express[_0xd691('0x3')]();var fs_extra=require(_0xd691('0x4'));var auth=require(_0xd691('0x5'));var interaction=require(_0xd691('0x6'));var config=require(_0xd691('0x7'));var controller=require('./intDynamics365Account.controller');router[_0xd691('0x8')]('/',auth[_0xd691('0x9')](),controller['index']);router[_0xd691('0x8')]('/:id',auth[_0xd691('0x9')](),controller[_0xd691('0xa')]);router[_0xd691('0x8')](_0xd691('0xb'),auth['isAuthenticated'](),controller[_0xd691('0xc')]);router[_0xd691('0x8')](_0xd691('0xd'),auth[_0xd691('0x9')](),controller[_0xd691('0xe')]);router[_0xd691('0xf')]('/',auth[_0xd691('0x9')](),controller['create']);router[_0xd691('0xf')](_0xd691('0xb'),auth['isAuthenticated'](),controller[_0xd691('0x10')]);router[_0xd691('0x11')](_0xd691('0x12'),auth[_0xd691('0x9')](),controller[_0xd691('0x13')]);router[_0xd691('0x14')](_0xd691('0x12'),auth[_0xd691('0x9')](),controller['destroy']);module[_0xd691('0x15')]=router; \ No newline at end of file +var _0x40b0=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','isAuthenticated','index','get','show','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy'];(function(_0x346165,_0x243d24){var _0x2cdc36=function(_0x4f9b29){while(--_0x4f9b29){_0x346165['push'](_0x346165['shift']());}};_0x2cdc36(++_0x243d24);}(_0x40b0,0xa9));var _0x040b=function(_0x289a67,_0x1e5a3c){_0x289a67=_0x289a67-0x0;var _0x572b49=_0x40b0[_0x289a67];return _0x572b49;};'use strict';var multer=require(_0x040b('0x0'));var util=require(_0x040b('0x1'));var path=require(_0x040b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x040b('0x3')]();var fs_extra=require(_0x040b('0x4'));var auth=require(_0x040b('0x5'));var interaction=require(_0x040b('0x6'));var config=require('../../config/environment');var controller=require(_0x040b('0x7'));router['get']('/',auth[_0x040b('0x8')](),controller[_0x040b('0x9')]);router[_0x040b('0xa')]('/:id',auth[_0x040b('0x8')](),controller[_0x040b('0xb')]);router[_0x040b('0xa')]('/:id/configurations',auth[_0x040b('0x8')](),controller[_0x040b('0xc')]);router['get'](_0x040b('0xd'),auth[_0x040b('0x8')](),controller['getFields']);router[_0x040b('0xe')]('/',auth['isAuthenticated'](),controller[_0x040b('0xf')]);router['post'](_0x040b('0x10'),auth['isAuthenticated'](),controller[_0x040b('0x11')]);router[_0x040b('0x12')](_0x040b('0x13'),auth[_0x040b('0x8')](),controller[_0x040b('0x14')]);router[_0x040b('0x15')](_0x040b('0x13'),auth['isAuthenticated'](),controller[_0x040b('0x16')]);module[_0x040b('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index c873673..31af3ca 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 _0x8cb3=['STRING','exports'];(function(_0xed0c3d,_0x3758d4){var _0x162912=function(_0x40fb4f){while(--_0x40fb4f){_0xed0c3d['push'](_0xed0c3d['shift']());}};_0x162912(++_0x3758d4);}(_0x8cb3,0x171));var _0x38cb=function(_0x5e41b4,_0xa7ce2){_0x5e41b4=_0x5e41b4-0x0;var _0x2876e3=_0x8cb3[_0x5e41b4];return _0x2876e3;};'use strict';var Sequelize=require('sequelize');module[_0x38cb('0x0')]={'name':{'type':Sequelize[_0x38cb('0x1')]},'username':{'type':Sequelize[_0x38cb('0x1')]},'password':{'type':Sequelize[_0x38cb('0x1')]},'remoteUri':{'type':Sequelize[_0x38cb('0x1')]},'tenantId':{'type':Sequelize[_0x38cb('0x1')]},'clientId':{'type':Sequelize[_0x38cb('0x1')]},'clientSecret':{'type':Sequelize[_0x38cb('0x1')]},'serverUrl':{'type':Sequelize[_0x38cb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x38cb('0x1')]}}; \ No newline at end of file +var _0x3f6c=['STRING','sequelize','exports'];(function(_0x4494bd,_0x5d4c66){var _0x49ede9=function(_0x360670){while(--_0x360670){_0x4494bd['push'](_0x4494bd['shift']());}};_0x49ede9(++_0x5d4c66);}(_0x3f6c,0x133));var _0xc3f6=function(_0x126e4b,_0x2e18ac){_0x126e4b=_0x126e4b-0x0;var _0x179cb3=_0x3f6c[_0x126e4b];return _0x179cb3;};'use strict';var Sequelize=require(_0xc3f6('0x0'));module[_0xc3f6('0x1')]={'name':{'type':Sequelize[_0xc3f6('0x2')]},'username':{'type':Sequelize[_0xc3f6('0x2')]},'password':{'type':Sequelize[_0xc3f6('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xc3f6('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xc3f6('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xc3f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 4852d23..5ea738f 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 _0x12c5=['map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Dynamics365Account','includeAll','include','rows','show','rawAttributes','find','create','body','params','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridyominame','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','remoteUri','clientId','clientSecret','substring','lastIndexOf','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','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','@odata.type','PicklistAttributeMetadata','isNil','BooleanAttributeMetadata','all','forEach','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','push','test','statusCode','stack','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','true','FalseOption','DisplayName','?$select=DisplayName,LogicalName','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','status','end','json','offset','undefined','count','limit','set','reject','update','destroy','sendStatus','name','send','index'];(function(_0x30049b,_0x4be899){var _0x11562c=function(_0x13ff73){while(--_0x13ff73){_0x30049b['push'](_0x30049b['shift']());}};_0x11562c(++_0x4be899);}(_0x12c5,0xa5));var _0x512c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x12c5[_0xfae23b];return _0x200640;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x512c('0x0'));var zipdir=require(_0x512c('0x1'));var jsonpatch=require(_0x512c('0x2'));var rp=require(_0x512c('0x3'));var moment=require(_0x512c('0x4'));var BPromise=require(_0x512c('0x5'));var Mustache=require(_0x512c('0x6'));var util=require(_0x512c('0x7'));var path=require('path');var sox=require(_0x512c('0x8'));var csv=require('to-csv');var ejs=require(_0x512c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x512c('0xa'));var squel=require('squel');var crypto=require(_0x512c('0xb'));var jsforce=require(_0x512c('0xc'));var deskjs=require(_0x512c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x512c('0xe'));var Papa=require(_0x512c('0xf'));var Redis=require(_0x512c('0x10'));var authService=require(_0x512c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x512c('0x12'));var hardwareService=require(_0x512c('0x13'));var logger=require(_0x512c('0x14'))('api');var utils=require(_0x512c('0x15'));var config=require(_0x512c('0x16'));var licenseUtil=require(_0x512c('0x17'));var db=require(_0x512c('0x18'))['db'];var integrations=require(_0x512c('0x19'));var jayson=require('jayson/promise');var client=jayson['client'][_0x512c('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x232efa,_0x20f19b,_0x4d3b9b,_0x148d46){return new BPromise(function(_0x4d6551,_0x520753){var _0x58927d=_0x148d46||client;return _0x58927d[_0x512c('0x1b')](_0x232efa,_0x4d3b9b)[_0x512c('0x1c')](function(_0x2fcab6){logger['info'](_0x512c('0x1d'),_0x20f19b,_0x512c('0x1e'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x20f19b,_0x512c('0x1e'),JSON[_0x512c('0x1f')](_0x2fcab6));if(_0x2fcab6[_0x512c('0x20')]){if(_0x2fcab6[_0x512c('0x20')]['code']===0x1f4){logger[_0x512c('0x20')]('Dynamics365Account,\x20%s,\x20%s',_0x20f19b,_0x2fcab6['error'][_0x512c('0x21')]);return _0x520753(_0x2fcab6[_0x512c('0x20')]['message']);}logger[_0x512c('0x20')](_0x512c('0x1d'),_0x20f19b,_0x2fcab6[_0x512c('0x20')]['message']);return _0x4d6551(_0x2fcab6[_0x512c('0x20')]['message']);}else{logger[_0x512c('0x22')](_0x512c('0x1d'),_0x20f19b,'request\x20sent');_0x4d6551(_0x2fcab6[_0x512c('0x23')][_0x512c('0x21')]);}})[_0x512c('0x24')](function(_0x21807d){logger['error'](_0x512c('0x1d'),_0x20f19b,_0x21807d);_0x520753(_0x21807d);});});}function respondWithStatusCode(_0x226133,_0x24eb57){_0x24eb57=_0x24eb57||0xcc;return function(_0x320b11){if(_0x320b11){return _0x226133['sendStatus'](_0x24eb57);}return _0x226133[_0x512c('0x25')](_0x24eb57)[_0x512c('0x26')]();};}function respondWithResult(_0x3a2be7,_0x1b83bd){_0x1b83bd=_0x1b83bd||0xc8;return function(_0x19fbad){if(_0x19fbad){return _0x3a2be7[_0x512c('0x25')](_0x1b83bd)[_0x512c('0x27')](_0x19fbad);}};}function respondWithFilteredResult(_0x42e235,_0x4f193d){return function(_0x36a828){if(_0x36a828){var _0x9d6d8b=typeof _0x4f193d[_0x512c('0x28')]===_0x512c('0x29')&&typeof _0x4f193d['limit']==='undefined';var _0x1467ae=_0x36a828[_0x512c('0x2a')];var _0x6f6fb0=_0x9d6d8b?0x0:_0x4f193d['offset'];var _0x36bb41=_0x9d6d8b?_0x36a828[_0x512c('0x2a')]:_0x4f193d[_0x512c('0x28')]+_0x4f193d[_0x512c('0x2b')];var _0x4a7052;if(_0x36bb41>=_0x1467ae){_0x36bb41=_0x1467ae;_0x4a7052=0xc8;}else{_0x4a7052=0xce;}_0x42e235['status'](_0x4a7052);return _0x42e235[_0x512c('0x2c')]('Content-Range',_0x6f6fb0+'-'+_0x36bb41+'/'+_0x1467ae)[_0x512c('0x27')](_0x36a828);}return null;};}function patchUpdates(_0x3704aa){return function(_0x1b9a06){try{jsonpatch['apply'](_0x1b9a06,_0x3704aa,!![]);}catch(_0x547c6a){return BPromise[_0x512c('0x2d')](_0x547c6a);}return _0x1b9a06['save']();};}function saveUpdates(_0x2a0fed,_0xe63e77){return function(_0x386698){if(_0x386698){return _0x386698[_0x512c('0x2e')](_0x2a0fed)[_0x512c('0x1c')](function(_0x20560e){return _0x20560e;});}return null;};}function removeEntity(_0x7e15d9,_0x2d1c38){return function(_0x3d1832){if(_0x3d1832){return _0x3d1832[_0x512c('0x2f')]()[_0x512c('0x1c')](function(){_0x7e15d9['status'](0xcc)[_0x512c('0x26')]();});}};}function handleEntityNotFound(_0x1c4471,_0x40979a){return function(_0x5ec201){if(!_0x5ec201){_0x1c4471[_0x512c('0x30')](0x194);}return _0x5ec201;};}function handleError(_0x379ccb,_0x4c9338){_0x4c9338=_0x4c9338||0x1f4;return function(_0x21efc9){logger[_0x512c('0x20')](_0x21efc9['stack']);if(_0x21efc9[_0x512c('0x31')]){delete _0x21efc9[_0x512c('0x31')];}_0x379ccb[_0x512c('0x25')](_0x4c9338)[_0x512c('0x32')](_0x21efc9);};}exports[_0x512c('0x33')]=function(_0x418b9c,_0x374c9e){var _0x24cfdd={},_0x49581a={},_0x267765={'count':0x0,'rows':[]};var _0x13d6af=_[_0x512c('0x34')](db['Dynamics365Account']['rawAttributes'],function(_0x57c8ad){return{'name':_0x57c8ad[_0x512c('0x35')],'type':_0x57c8ad[_0x512c('0x36')]['key']};});_0x49581a[_0x512c('0x37')]=_[_0x512c('0x34')](_0x13d6af,_0x512c('0x31'));_0x49581a[_0x512c('0x38')]=_[_0x512c('0x39')](_0x418b9c['query']);_0x49581a[_0x512c('0x3a')]=_[_0x512c('0x3b')](_0x49581a[_0x512c('0x37')],_0x49581a[_0x512c('0x38')]);_0x24cfdd[_0x512c('0x3c')]=_['intersection'](_0x49581a[_0x512c('0x37')],qs[_0x512c('0x3d')](_0x418b9c[_0x512c('0x38')][_0x512c('0x3d')]));_0x24cfdd[_0x512c('0x3c')]=_0x24cfdd['attributes'][_0x512c('0x3e')]?_0x24cfdd[_0x512c('0x3c')]:_0x49581a[_0x512c('0x37')];if(!_0x418b9c[_0x512c('0x38')][_0x512c('0x3f')](_0x512c('0x40'))){_0x24cfdd[_0x512c('0x2b')]=qs['limit'](_0x418b9c[_0x512c('0x38')][_0x512c('0x2b')]);_0x24cfdd[_0x512c('0x28')]=qs[_0x512c('0x28')](_0x418b9c[_0x512c('0x38')][_0x512c('0x28')]);}_0x24cfdd[_0x512c('0x41')]=qs['sort'](_0x418b9c[_0x512c('0x38')][_0x512c('0x42')]);_0x24cfdd[_0x512c('0x43')]=qs['filters'](_[_0x512c('0x44')](_0x418b9c[_0x512c('0x38')],_0x49581a[_0x512c('0x3a')]),_0x13d6af);if(_0x418b9c[_0x512c('0x38')][_0x512c('0x45')]){_0x24cfdd[_0x512c('0x43')]=_[_0x512c('0x46')](_0x24cfdd['where'],{'$or':_['map'](_0x13d6af,function(_0x25e5bc){if(_0x25e5bc[_0x512c('0x36')]!=='VIRTUAL'){var _0x409432={};_0x409432[_0x25e5bc['name']]={'$like':'%'+_0x418b9c[_0x512c('0x38')]['filter']+'%'};return _0x409432;}})});}_0x24cfdd=_[_0x512c('0x46')]({},_0x24cfdd,_0x418b9c[_0x512c('0x47')]);var _0x303749={'where':_0x24cfdd[_0x512c('0x43')]};return db[_0x512c('0x48')][_0x512c('0x2a')](_0x303749)['then'](function(_0x3a867d){_0x267765[_0x512c('0x2a')]=_0x3a867d;if(_0x418b9c[_0x512c('0x38')][_0x512c('0x49')]){_0x24cfdd[_0x512c('0x4a')]=[{'all':!![]}];}return db[_0x512c('0x48')]['findAll'](_0x24cfdd);})['then'](function(_0x28cd63){_0x267765[_0x512c('0x4b')]=_0x28cd63;return _0x267765;})[_0x512c('0x1c')](respondWithFilteredResult(_0x374c9e,_0x24cfdd))[_0x512c('0x24')](handleError(_0x374c9e,null));};exports[_0x512c('0x4c')]=function(_0x8cdbf5,_0x1c5eac){var _0x536855={'raw':![],'where':{'id':_0x8cdbf5['params']['id']}},_0xe6ebd8={};_0xe6ebd8[_0x512c('0x37')]=_[_0x512c('0x39')](db[_0x512c('0x48')][_0x512c('0x4d')]);_0xe6ebd8[_0x512c('0x38')]=_[_0x512c('0x39')](_0x8cdbf5[_0x512c('0x38')]);_0xe6ebd8[_0x512c('0x3a')]=_[_0x512c('0x3b')](_0xe6ebd8[_0x512c('0x37')],_0xe6ebd8[_0x512c('0x38')]);_0x536855[_0x512c('0x3c')]=_['intersection'](_0xe6ebd8[_0x512c('0x37')],qs[_0x512c('0x3d')](_0x8cdbf5[_0x512c('0x38')][_0x512c('0x3d')]));_0x536855[_0x512c('0x3c')]=_0x536855[_0x512c('0x3c')][_0x512c('0x3e')]?_0x536855[_0x512c('0x3c')]:_0xe6ebd8[_0x512c('0x37')];if(_0x8cdbf5[_0x512c('0x38')][_0x512c('0x49')]){_0x536855[_0x512c('0x4a')]=[{'all':!![]}];}_0x536855=_['merge']({},_0x536855,_0x8cdbf5[_0x512c('0x47')]);return db[_0x512c('0x48')][_0x512c('0x4e')](_0x536855)[_0x512c('0x1c')](handleEntityNotFound(_0x1c5eac,null))[_0x512c('0x1c')](respondWithResult(_0x1c5eac,null))[_0x512c('0x24')](handleError(_0x1c5eac,null));};exports[_0x512c('0x4f')]=function(_0x52be6c,_0x589f42){return db[_0x512c('0x48')][_0x512c('0x4f')](_0x52be6c['body'],{})[_0x512c('0x1c')](respondWithResult(_0x589f42,0xc9))['catch'](handleError(_0x589f42,null));};exports[_0x512c('0x2e')]=function(_0xab09f0,_0x17b96c){if(_0xab09f0['body']['id']){delete _0xab09f0[_0x512c('0x50')]['id'];}return db[_0x512c('0x48')][_0x512c('0x4e')]({'where':{'id':_0xab09f0[_0x512c('0x51')]['id']}})[_0x512c('0x1c')](handleEntityNotFound(_0x17b96c,null))[_0x512c('0x1c')](saveUpdates(_0xab09f0[_0x512c('0x50')],null))[_0x512c('0x1c')](respondWithResult(_0x17b96c,null))[_0x512c('0x24')](handleError(_0x17b96c,null));};exports['destroy']=function(_0x11443d,_0x25597f){return db['Dynamics365Account']['find']({'where':{'id':_0x11443d[_0x512c('0x51')]['id']}})['then'](handleEntityNotFound(_0x25597f,null))['then'](removeEntity(_0x25597f,null))[_0x512c('0x24')](handleError(_0x25597f,null));};exports[_0x512c('0x52')]=function(_0x29165f,_0xd5afc5,_0x5538c2){var _0x12f965={};var _0x38453d={};var _0xc1fb6e;var _0x27a1ba;return db['Dynamics365Account'][_0x512c('0x53')]({'where':{'id':_0x29165f[_0x512c('0x51')]['id']}})['then'](handleEntityNotFound(_0xd5afc5,null))[_0x512c('0x1c')](function(_0x2143cc){if(_0x2143cc){_0xc1fb6e=_0x2143cc;_0x38453d[_0x512c('0x37')]=_[_0x512c('0x39')](db['Dynamics365Configuration'][_0x512c('0x4d')]);_0x38453d['query']=_[_0x512c('0x39')](_0x29165f[_0x512c('0x38')]);_0x38453d[_0x512c('0x3a')]=_[_0x512c('0x3b')](_0x38453d['model'],_0x38453d['query']);_0x12f965[_0x512c('0x3c')]=_[_0x512c('0x3b')](_0x38453d['model'],qs[_0x512c('0x3d')](_0x29165f[_0x512c('0x38')]['fields']));_0x12f965[_0x512c('0x3c')]=_0x12f965[_0x512c('0x3c')][_0x512c('0x3e')]?_0x12f965['attributes']:_0x38453d[_0x512c('0x37')];_0x12f965[_0x512c('0x41')]=qs[_0x512c('0x42')](_0x29165f[_0x512c('0x38')][_0x512c('0x42')]);_0x12f965['where']=qs['filters'](_[_0x512c('0x44')](_0x29165f['query'],_0x38453d[_0x512c('0x3a')]));if(_0x29165f[_0x512c('0x38')]['filter']){_0x12f965[_0x512c('0x43')]=_[_0x512c('0x46')](_0x12f965[_0x512c('0x43')],{'$or':_['map'](_0x12f965[_0x512c('0x3c')],function(_0x26ce5d){var _0x2118b4={};_0x2118b4[_0x26ce5d]={'$like':'%'+_0x29165f['query'][_0x512c('0x45')]+'%'};return _0x2118b4;})});}_0x12f965=_[_0x512c('0x46')]({},_0x12f965,_0x29165f[_0x512c('0x47')]);return _0xc1fb6e[_0x512c('0x52')](_0x12f965);}})[_0x512c('0x1c')](function(_0x573a62){if(_0x573a62){_0x27a1ba=_0x573a62[_0x512c('0x3e')];if(!_0x29165f['query'][_0x512c('0x3f')](_0x512c('0x40'))){_0x12f965[_0x512c('0x2b')]=qs[_0x512c('0x2b')](_0x29165f[_0x512c('0x38')][_0x512c('0x2b')]);_0x12f965['offset']=qs[_0x512c('0x28')](_0x29165f[_0x512c('0x38')][_0x512c('0x28')]);}return _0xc1fb6e[_0x512c('0x52')](_0x12f965);}})[_0x512c('0x1c')](function(_0x368b37){if(_0x368b37){return _0x368b37?{'count':_0x27a1ba,'rows':_0x368b37}:null;}})[_0x512c('0x1c')](respondWithResult(_0xd5afc5,null))[_0x512c('0x24')](handleError(_0xd5afc5,null));};exports['addConfiguration']=function(_0xaeb78f,_0x3d54cb,_0x245744){if(_0xaeb78f[_0x512c('0x50')]['id']){delete _0xaeb78f[_0x512c('0x50')]['id'];}return db[_0x512c('0x48')][_0x512c('0x53')]({'where':{'id':_0xaeb78f['params']['id']}})[_0x512c('0x1c')](handleEntityNotFound(_0x3d54cb,null))['then'](function(_0x2c9c79){if(_0x2c9c79){_0xaeb78f[_0x512c('0x50')][_0x512c('0x54')]=_0x2c9c79['id'];_0xaeb78f[_0x512c('0x50')][_0x512c('0x55')]=integrations[_0x512c('0x56')](_0xaeb78f[_0x512c('0x50')][_0x512c('0x57')],_0xaeb78f[_0x512c('0x50')][_0x512c('0x36')]);_0xaeb78f[_0x512c('0x50')][_0x512c('0x58')]=integrations[_0x512c('0x59')](_0xaeb78f['body'][_0x512c('0x57')],_0xaeb78f['body'][_0x512c('0x36')]);return db[_0x512c('0x5a')][_0x512c('0x4f')](_0xaeb78f[_0x512c('0x50')],{'include':[{'model':db[_0x512c('0x5b')],'as':_0x512c('0x55')},{'model':db[_0x512c('0x5b')],'as':_0x512c('0x58')}]});}return null;})[_0x512c('0x1c')](respondWithResult(_0x3d54cb,null))[_0x512c('0x24')](handleError(_0x3d54cb,null));};exports[_0x512c('0x5c')]=function(_0x461cb9,_0x45fac7,_0x5bcaaf){var _0x5b45a1=_0x461cb9[_0x512c('0x38')][_0x512c('0x5d')];var _0x4e245a=_0x5b45a1===_0x512c('0x5e')?_0x512c('0x5f'):_0x512c('0x60');var _0x40b926='';var _0x128178='';var _0x4a96b5='';var _0x2c1cde='';var _0x36a167='';var _0x337e10='';var _0x5e9e9f='';var _0x48296b='';var _0x57753b=[_0x512c('0x61'),_0x512c('0x62'),_0x512c('0x63'),_0x512c('0x64'),_0x512c('0x65'),'subject',_0x512c('0x66'),'regardingobjectid',_0x512c('0x67'),_0x512c('0x68')];var _0x7243cb=[_0x512c('0x69'),'accountidyominame',_0x512c('0x6a'),_0x512c('0x6b'),_0x512c('0x6c'),_0x512c('0x6d'),_0x512c('0x6e'),_0x512c('0x6f'),_0x512c('0x70'),_0x512c('0x71'),_0x512c('0x72'),_0x512c('0x73'),_0x512c('0x74'),'createdonbehalfbyname',_0x512c('0x75'),_0x512c('0x76'),'customeridtype',_0x512c('0x77'),_0x512c('0x78'),_0x512c('0x79'),_0x512c('0x7a'),_0x512c('0x7b'),_0x512c('0x7c'),_0x512c('0x7d'),_0x512c('0x7e'),_0x512c('0x7f'),_0x512c('0x80'),_0x512c('0x81'),_0x512c('0x82'),_0x512c('0x83'),_0x512c('0x84'),_0x512c('0x85'),_0x512c('0x86'),_0x512c('0x87'),_0x512c('0x88'),_0x512c('0x89'),_0x512c('0x8a'),'modifiedonbehalfbyyominame',_0x512c('0x8b'),_0x512c('0x8c'),_0x512c('0x8d'),_0x512c('0x8e'),'overriddencreatedon',_0x512c('0x8f'),'owneridtype',_0x512c('0x90'),'parentcaseidname',_0x512c('0x91'),_0x512c('0x92'),'prioritycodename',_0x512c('0x93'),_0x512c('0x94'),_0x512c('0x95'),_0x512c('0x96'),'responseby',_0x512c('0x97'),_0x512c('0x98'),_0x512c('0x99'),_0x512c('0x9a'),'slaname','socialprofileidname','statecode',_0x512c('0x9b'),_0x512c('0x9c'),_0x512c('0x9d'),_0x512c('0x9e'),_0x512c('0x9f'),_0x512c('0xa0'),_0x512c('0xa1'),'versionnumber'];var _0x349ed5=_0x57753b[_0x512c('0xa2')](_0x7243cb);return db[_0x512c('0x48')][_0x512c('0x53')]({'where':{'id':_0x461cb9['params']['id']},'attributes':['id',_0x512c('0xa3'),'password',_0x512c('0xa4'),'tenantId',_0x512c('0xa5'),_0x512c('0xa6')]})[_0x512c('0x1c')](handleEntityNotFound(_0x45fac7,null))[_0x512c('0x1c')](function(_0x269e0e){if(_0x269e0e){_0x48296b=_0x269e0e[_0x512c('0xa4')];var _0x18f183=_0x48296b['slice'](-0x1);if(_0x18f183==='/'){_0x48296b=_0x48296b[_0x512c('0xa7')](0x0,_0x48296b[_0x512c('0xa8')](_0x18f183));}_0x5e9e9f=util[_0x512c('0xa9')](_0x512c('0xaa'),_0x48296b);var _0xd6104d={'method':_0x512c('0xab'),'uri':_0x512c('0xac')+_0x269e0e['tenantId']+_0x512c('0xad'),'form':{'client_id':_0x269e0e['clientId'],'resource':_0x48296b,'username':_0x269e0e[_0x512c('0xa3')],'password':_0x269e0e[_0x512c('0xae')],'grant_type':'password','client_secret':_0x269e0e[_0x512c('0xa6')]},'json':!![]};return rp(_0xd6104d);}})[_0x512c('0x1c')](function(_0x3d35c4){_0x337e10=_0x3d35c4[_0x512c('0xaf')];var _0x20e444={'method':_0x512c('0xb0'),'uri':encodeURI(_0x5e9e9f+_0x512c('0xb1')+_0x4e245a+'\x27'),'headers':{'Authorization':_0x512c('0xb2')+_0x337e10,'If-None-Match':null,'OData-Version':_0x512c('0xb3')},'json':!![]};return rp(_0x20e444);})[_0x512c('0x1c')](function(_0x283af1){var _0x33315=_0x283af1[_0x512c('0xb4')][0x0];var _0x5fba18=_0x33315[_0x512c('0xb5')];var _0x34f009={'method':_0x512c('0xb0'),'uri':_0x5e9e9f+_0x512c('0xb6')+_0x5fba18+_0x512c('0xb7'),'headers':{'Authorization':'Bearer\x20'+_0x337e10,'If-None-Match':null,'OData-Version':_0x512c('0xb3')},'json':!![]};return rp(_0x34f009);})[_0x512c('0x1c')](function(_0x37d7e0){_0x40b926=_0x37d7e0;_0x128178=_0x40b926[_0x512c('0xb8')];_0x128178=_[_0x512c('0xb9')](_0x128178,function(_0x3d4fdd){return!_0x349ed5['includes'](_0x3d4fdd[_0x512c('0xba')]);});var _0x59ec5c=[];var _0x2c72de=[];_0x128178['forEach'](function(_0x430a72){if(_0x430a72[_0x512c('0xbb')]){var _0x3fddfd=_0x430a72[_0x512c('0xbb')][_0x512c('0xa7')](_0x430a72[_0x512c('0xbb')][_0x512c('0xa8')]('.')+0x1);if(_0x3fddfd===_0x512c('0xbc')){_0x59ec5c['push'](getSelectList(_0x5e9e9f,_0x5b45a1,_0x2c72de,_0x40b926[_0x512c('0xb5')],_0x430a72['MetadataId'],_0x337e10));}}});return Promise['all'](_0x59ec5c);})[_0x512c('0x1c')](function(_0x4e8d7d){_0x4a96b5=_0x4e8d7d[0x0];var _0x4c5a4e=[];var _0x34921d=[];_0x128178['forEach'](function(_0x410ffb){if(!_[_0x512c('0xbd')](_0x410ffb[_0x512c('0xbb')])){var _0x30fc2b=_0x410ffb[_0x512c('0xbb')]['substring'](_0x410ffb['@odata.type'][_0x512c('0xa8')]('.')+0x1);if(_0x30fc2b===_0x512c('0xbe')){_0x4c5a4e['push'](getBooleanList(_0x5e9e9f,_0x5b45a1,_0x34921d,_0x40b926[_0x512c('0xb5')],_0x410ffb[_0x512c('0xb5')],_0x337e10));}}});return Promise[_0x512c('0xbf')](_0x4c5a4e);})['then'](function(_0x23c17c){_0x2c1cde=_0x23c17c[0x0];var _0x4ebe1e=[];var _0x38a5df=[];_0x128178[_0x512c('0xc0')](function(_0x3aba72){if(_0x3aba72[_0x512c('0xbb')]){var _0x55330f=_0x3aba72[_0x512c('0xbb')][_0x512c('0xa7')](_0x3aba72[_0x512c('0xbb')][_0x512c('0xa8')]('.')+0x1);if(_0x55330f===_0x512c('0xc1')||_0x55330f===_0x512c('0xc2')||_0x55330f===_0x512c('0xc3')||_0x55330f==='IntegerAttributeMetadata'||_0x55330f==='MemoAttributeMetadata'||_0x55330f===_0x512c('0xc4')||_0x55330f===_0x512c('0xc5')||_0x55330f===_0x512c('0xc6')||_0x55330f==='StateAttributeMetadata'||_0x55330f===_0x512c('0xc7')){_0x4ebe1e[_0x512c('0xc8')](getInputList(_0x5e9e9f,_0x5b45a1,_0x55330f,_0x38a5df,_0x40b926[_0x512c('0xb5')],_0x3aba72[_0x512c('0xb5')],_0x337e10));}}});return Promise[_0x512c('0xbf')](_0x4ebe1e);})[_0x512c('0x1c')](function(_0xe5d2b4){_0x36a167=_0xe5d2b4[0x0];var _0x5ed2cd=_0x4a96b5[_0x512c('0xa2')](_0x2c1cde)[_0x512c('0xa2')](_0x36a167);var _0x1a6d97={'count':_0x5ed2cd['length'],'rows':_0x5ed2cd};return _0x1a6d97;})[_0x512c('0x1c')](respondWithResult(_0x45fac7,null))[_0x512c('0x24')](function(_0x49b543){var _0x5b1483=_0x461cb9[_0x512c('0x38')][_0x512c('0xc9')]?0x1f4:_0x49b543[_0x512c('0xca')]||0x1f4;logger[_0x512c('0x20')](_0x49b543[_0x512c('0xcb')]);delete _0x49b543[_0x512c('0x31')];if(_0x5b1483===0x191){_0x5b1483=0x190;}_0x45fac7[_0x512c('0x25')](_0x5b1483)[_0x512c('0x32')](_0x461cb9[_0x512c('0x38')][_0x512c('0xc9')]?{'message':_0x512c('0xcc'),'statusCode':_0x49b543['statusCode']}:_0x49b543);});};function getSelectList(_0x14f9fd,_0x50fec5,_0xb60472,_0x1058e0,_0x3ef6c7,_0x33591b){var _0x597d17={'method':_0x512c('0xb0'),'uri':_0x14f9fd+_0x512c('0xb6')+_0x1058e0+_0x512c('0xcd')+_0x3ef6c7+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x512c('0xce'),'headers':{'Authorization':_0x512c('0xb2')+_0x33591b,'If-None-Match':null,'OData-Version':_0x512c('0xb3')},'json':!![]};return rp(_0x597d17)[_0x512c('0x1c')](function(_0x3e861b){var _0x3a39ab=[];var _0x128f0b=_0x3e861b['OptionSet'][_0x512c('0xcf')];_0x128f0b[_0x512c('0xc0')](function(_0x279aa5){_0x3a39ab[_0x512c('0xc8')]({'name':_0x279aa5[_0x512c('0xd0')][_0x512c('0xd1')][_0x512c('0xd0')],'value':String(_0x279aa5[_0x512c('0xd2')])});});var _0x1162d6={'id':_0x50fec5+'_'+_0x3e861b[_0x512c('0xba')],'name':_0x3e861b['DisplayName'][_0x512c('0xd1')][_0x512c('0xd0')],'custom':![],'options':_0x3a39ab};_0xb60472[_0x512c('0xc8')](_0x1162d6);return _0xb60472;});}function getBooleanList(_0x214537,_0x178f42,_0x47b0ff,_0x354faa,_0x1c61c9,_0x8c2b61){var _0x400ed3={'method':'GET','uri':_0x214537+'EntityDefinitions('+_0x354faa+')/Attributes('+_0x1c61c9+_0x512c('0xd3'),'headers':{'Authorization':_0x512c('0xb2')+_0x8c2b61,'If-None-Match':null,'OData-Version':_0x512c('0xb3')},'json':!![]};return rp(_0x400ed3)[_0x512c('0x1c')](function(_0x310b10){var _0x5a8897=[];_0x5a8897[_0x512c('0xc8')]({'name':_0x310b10[_0x512c('0xd4')]['TrueOption']['Label'][_0x512c('0xd1')]['Label'],'value':_0x512c('0xd5')},{'name':_0x310b10[_0x512c('0xd4')][_0x512c('0xd6')]['Label'][_0x512c('0xd1')][_0x512c('0xd0')],'value':'false'});var _0x521415={'id':_0x178f42+'_'+_0x310b10[_0x512c('0xba')],'name':_0x310b10[_0x512c('0xd7')][_0x512c('0xd1')][_0x512c('0xd0')],'custom':![],'options':_0x5a8897};_0x47b0ff[_0x512c('0xc8')](_0x521415);return _0x47b0ff;});}function getInputList(_0x4396ff,_0x473f8c,_0x4dccb9,_0x27351f,_0x37505a,_0x1e5fc5,_0x351b77){var _0x127e21={'method':'GET','uri':_0x4396ff+_0x512c('0xb6')+_0x37505a+_0x512c('0xcd')+_0x1e5fc5+')/Microsoft.Dynamics.CRM.'+_0x4dccb9+_0x512c('0xd8'),'headers':{'Authorization':_0x512c('0xb2')+_0x351b77,'If-None-Match':null,'OData-Version':_0x512c('0xb3')},'json':!![]};return rp(_0x127e21)['then'](function(_0x595650){var _0x5456da={'id':_0x473f8c+'_'+_0x595650['LogicalName'],'name':_0x595650[_0x512c('0xd7')]['UserLocalizedLabel']?_0x595650['DisplayName'][_0x512c('0xd1')][_0x512c('0xd0')]:_0x595650[_0x512c('0xba')],'custom':![],'options':[]};_0x27351f[_0x512c('0xc8')](_0x5456da);return _0x27351f;});} \ No newline at end of file +var _0x9a64=['show','params','intersection','fields','includeAll','find','create','update','body','destroy','findOne','Dynamics365Configuration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','incident','Incident','title','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyname','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','importsequencenumber','influencescore','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','remoteUri','tenantId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','concat','stack','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','false','LogicalName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','name','send','map','Dynamics365Account','rawAttributes','fieldName','key','model','keys','query','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows'];(function(_0x2431fe,_0x140c07){var _0x3de86d=function(_0x3d0dd8){while(--_0x3d0dd8){_0x2431fe['push'](_0x2431fe['shift']());}};_0x3de86d(++_0x140c07);}(_0x9a64,0x8c));var _0x49a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a64[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x49a6('0x0'));var rimraf=require(_0x49a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x49a6('0x2'));var rp=require('request-promise');var moment=require(_0x49a6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x49a6('0x4'));var util=require(_0x49a6('0x5'));var path=require(_0x49a6('0x6'));var sox=require('sox');var csv=require(_0x49a6('0x7'));var ejs=require(_0x49a6('0x8'));var fs=require('fs');var fs_extra=require(_0x49a6('0x9'));var _=require(_0x49a6('0xa'));var squel=require('squel');var crypto=require(_0x49a6('0xb'));var jsforce=require(_0x49a6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x49a6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x49a6('0xe'));var qs=require(_0x49a6('0xf'));var as=require(_0x49a6('0x10'));var hardwareService=require(_0x49a6('0x11'));var logger=require(_0x49a6('0x12'))(_0x49a6('0x13'));var utils=require(_0x49a6('0x14'));var config=require(_0x49a6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x49a6('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x49a6('0x17'));var client=jayson[_0x49a6('0x18')][_0x49a6('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x56bd3c,_0x1bd130,_0x36fe01,_0x3d9b3c){return new BPromise(function(_0x138800,_0x3be880){var _0x35f62c=_0x3d9b3c||client;return _0x35f62c[_0x49a6('0x1a')](_0x56bd3c,_0x36fe01)[_0x49a6('0x1b')](function(_0x2ccfc9){logger[_0x49a6('0x1c')](_0x49a6('0x1d'),_0x1bd130,_0x49a6('0x1e'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x1bd130,_0x49a6('0x1e'),JSON['stringify'](_0x2ccfc9));if(_0x2ccfc9[_0x49a6('0x1f')]){if(_0x2ccfc9['error'][_0x49a6('0x20')]===0x1f4){logger[_0x49a6('0x1f')](_0x49a6('0x1d'),_0x1bd130,_0x2ccfc9[_0x49a6('0x1f')][_0x49a6('0x21')]);return _0x3be880(_0x2ccfc9[_0x49a6('0x1f')]['message']);}logger[_0x49a6('0x1f')](_0x49a6('0x1d'),_0x1bd130,_0x2ccfc9[_0x49a6('0x1f')][_0x49a6('0x21')]);return _0x138800(_0x2ccfc9['error'][_0x49a6('0x21')]);}else{logger[_0x49a6('0x1c')]('Dynamics365Account,\x20%s,\x20%s',_0x1bd130,_0x49a6('0x1e'));_0x138800(_0x2ccfc9[_0x49a6('0x22')][_0x49a6('0x21')]);}})[_0x49a6('0x23')](function(_0x39808a){logger[_0x49a6('0x1f')](_0x49a6('0x1d'),_0x1bd130,_0x39808a);_0x3be880(_0x39808a);});});}function respondWithStatusCode(_0x535e76,_0x38c39b){_0x38c39b=_0x38c39b||0xcc;return function(_0x16b93f){if(_0x16b93f){return _0x535e76[_0x49a6('0x24')](_0x38c39b);}return _0x535e76[_0x49a6('0x25')](_0x38c39b)[_0x49a6('0x26')]();};}function respondWithResult(_0x415384,_0x51d2fe){_0x51d2fe=_0x51d2fe||0xc8;return function(_0x572b31){if(_0x572b31){return _0x415384[_0x49a6('0x25')](_0x51d2fe)[_0x49a6('0x27')](_0x572b31);}};}function respondWithFilteredResult(_0x372cbd,_0x213d48){return function(_0x3cbae1){if(_0x3cbae1){var _0x107a28=typeof _0x213d48[_0x49a6('0x28')]===_0x49a6('0x29')&&typeof _0x213d48['limit']==='undefined';var _0x3768bc=_0x3cbae1[_0x49a6('0x2a')];var _0x8e7a65=_0x107a28?0x0:_0x213d48[_0x49a6('0x28')];var _0x4ff3b8=_0x107a28?_0x3cbae1[_0x49a6('0x2a')]:_0x213d48[_0x49a6('0x28')]+_0x213d48[_0x49a6('0x2b')];var _0x526f74;if(_0x4ff3b8>=_0x3768bc){_0x4ff3b8=_0x3768bc;_0x526f74=0xc8;}else{_0x526f74=0xce;}_0x372cbd[_0x49a6('0x25')](_0x526f74);return _0x372cbd[_0x49a6('0x2c')](_0x49a6('0x2d'),_0x8e7a65+'-'+_0x4ff3b8+'/'+_0x3768bc)['json'](_0x3cbae1);}return null;};}function patchUpdates(_0x33e967){return function(_0x129562){try{jsonpatch['apply'](_0x129562,_0x33e967,!![]);}catch(_0x537cef){return BPromise[_0x49a6('0x2e')](_0x537cef);}return _0x129562['save']();};}function saveUpdates(_0x31c2e9,_0x48a441){return function(_0xa3743d){if(_0xa3743d){return _0xa3743d['update'](_0x31c2e9)[_0x49a6('0x1b')](function(_0x4565b0){return _0x4565b0;});}return null;};}function removeEntity(_0xaf7972,_0x1317ee){return function(_0x21e898){if(_0x21e898){return _0x21e898['destroy']()[_0x49a6('0x1b')](function(){_0xaf7972[_0x49a6('0x25')](0xcc)[_0x49a6('0x26')]();});}};}function handleEntityNotFound(_0x19f520,_0x2aefc8){return function(_0x41dfe4){if(!_0x41dfe4){_0x19f520[_0x49a6('0x24')](0x194);}return _0x41dfe4;};}function handleError(_0x236933,_0x164a42){_0x164a42=_0x164a42||0x1f4;return function(_0x39048c){logger[_0x49a6('0x1f')](_0x39048c['stack']);if(_0x39048c[_0x49a6('0x2f')]){delete _0x39048c[_0x49a6('0x2f')];}_0x236933[_0x49a6('0x25')](_0x164a42)[_0x49a6('0x30')](_0x39048c);};}exports['index']=function(_0xdd8c1a,_0x2d0d42){var _0x10b0e5={},_0x2314ea={},_0x24c92f={'count':0x0,'rows':[]};var _0x5af76e=_[_0x49a6('0x31')](db[_0x49a6('0x32')][_0x49a6('0x33')],function(_0x57d99f){return{'name':_0x57d99f[_0x49a6('0x34')],'type':_0x57d99f['type'][_0x49a6('0x35')]};});_0x2314ea[_0x49a6('0x36')]=_[_0x49a6('0x31')](_0x5af76e,_0x49a6('0x2f'));_0x2314ea['query']=_[_0x49a6('0x37')](_0xdd8c1a[_0x49a6('0x38')]);_0x2314ea[_0x49a6('0x39')]=_['intersection'](_0x2314ea[_0x49a6('0x36')],_0x2314ea[_0x49a6('0x38')]);_0x10b0e5[_0x49a6('0x3a')]=_['intersection'](_0x2314ea[_0x49a6('0x36')],qs['fields'](_0xdd8c1a[_0x49a6('0x38')]['fields']));_0x10b0e5['attributes']=_0x10b0e5[_0x49a6('0x3a')][_0x49a6('0x3b')]?_0x10b0e5[_0x49a6('0x3a')]:_0x2314ea[_0x49a6('0x36')];if(!_0xdd8c1a[_0x49a6('0x38')][_0x49a6('0x3c')](_0x49a6('0x3d'))){_0x10b0e5[_0x49a6('0x2b')]=qs[_0x49a6('0x2b')](_0xdd8c1a[_0x49a6('0x38')][_0x49a6('0x2b')]);_0x10b0e5[_0x49a6('0x28')]=qs[_0x49a6('0x28')](_0xdd8c1a[_0x49a6('0x38')][_0x49a6('0x28')]);}_0x10b0e5[_0x49a6('0x3e')]=qs[_0x49a6('0x3f')](_0xdd8c1a[_0x49a6('0x38')][_0x49a6('0x3f')]);_0x10b0e5[_0x49a6('0x40')]=qs[_0x49a6('0x39')](_[_0x49a6('0x41')](_0xdd8c1a[_0x49a6('0x38')],_0x2314ea[_0x49a6('0x39')]),_0x5af76e);if(_0xdd8c1a[_0x49a6('0x38')][_0x49a6('0x42')]){_0x10b0e5[_0x49a6('0x40')]=_[_0x49a6('0x43')](_0x10b0e5['where'],{'$or':_[_0x49a6('0x31')](_0x5af76e,function(_0x769dca){if(_0x769dca[_0x49a6('0x44')]!==_0x49a6('0x45')){var _0x157f23={};_0x157f23[_0x769dca[_0x49a6('0x2f')]]={'$like':'%'+_0xdd8c1a[_0x49a6('0x38')][_0x49a6('0x42')]+'%'};return _0x157f23;}})});}_0x10b0e5=_['merge']({},_0x10b0e5,_0xdd8c1a[_0x49a6('0x46')]);var _0x2f01c5={'where':_0x10b0e5[_0x49a6('0x40')]};return db[_0x49a6('0x32')][_0x49a6('0x2a')](_0x2f01c5)[_0x49a6('0x1b')](function(_0x3ed82d){_0x24c92f[_0x49a6('0x2a')]=_0x3ed82d;if(_0xdd8c1a[_0x49a6('0x38')]['includeAll']){_0x10b0e5[_0x49a6('0x47')]=[{'all':!![]}];}return db[_0x49a6('0x32')][_0x49a6('0x48')](_0x10b0e5);})['then'](function(_0x44d211){_0x24c92f[_0x49a6('0x49')]=_0x44d211;return _0x24c92f;})[_0x49a6('0x1b')](respondWithFilteredResult(_0x2d0d42,_0x10b0e5))[_0x49a6('0x23')](handleError(_0x2d0d42,null));};exports[_0x49a6('0x4a')]=function(_0x36dc7b,_0x4654e9){var _0x4042de={'raw':![],'where':{'id':_0x36dc7b[_0x49a6('0x4b')]['id']}},_0x19928e={};_0x19928e['model']=_['keys'](db[_0x49a6('0x32')]['rawAttributes']);_0x19928e[_0x49a6('0x38')]=_[_0x49a6('0x37')](_0x36dc7b[_0x49a6('0x38')]);_0x19928e[_0x49a6('0x39')]=_[_0x49a6('0x4c')](_0x19928e[_0x49a6('0x36')],_0x19928e['query']);_0x4042de[_0x49a6('0x3a')]=_['intersection'](_0x19928e[_0x49a6('0x36')],qs[_0x49a6('0x4d')](_0x36dc7b[_0x49a6('0x38')]['fields']));_0x4042de['attributes']=_0x4042de[_0x49a6('0x3a')][_0x49a6('0x3b')]?_0x4042de['attributes']:_0x19928e[_0x49a6('0x36')];if(_0x36dc7b[_0x49a6('0x38')][_0x49a6('0x4e')]){_0x4042de[_0x49a6('0x47')]=[{'all':!![]}];}_0x4042de=_['merge']({},_0x4042de,_0x36dc7b[_0x49a6('0x46')]);return db['Dynamics365Account'][_0x49a6('0x4f')](_0x4042de)[_0x49a6('0x1b')](handleEntityNotFound(_0x4654e9,null))[_0x49a6('0x1b')](respondWithResult(_0x4654e9,null))['catch'](handleError(_0x4654e9,null));};exports[_0x49a6('0x50')]=function(_0x3be2f0,_0x1e533b){return db[_0x49a6('0x32')][_0x49a6('0x50')](_0x3be2f0['body'],{})[_0x49a6('0x1b')](respondWithResult(_0x1e533b,0xc9))[_0x49a6('0x23')](handleError(_0x1e533b,null));};exports[_0x49a6('0x51')]=function(_0x12ad27,_0x3d8292){if(_0x12ad27['body']['id']){delete _0x12ad27[_0x49a6('0x52')]['id'];}return db['Dynamics365Account'][_0x49a6('0x4f')]({'where':{'id':_0x12ad27['params']['id']}})['then'](handleEntityNotFound(_0x3d8292,null))[_0x49a6('0x1b')](saveUpdates(_0x12ad27[_0x49a6('0x52')],null))[_0x49a6('0x1b')](respondWithResult(_0x3d8292,null))[_0x49a6('0x23')](handleError(_0x3d8292,null));};exports[_0x49a6('0x53')]=function(_0x3283b8,_0x2f54ec){return db[_0x49a6('0x32')]['find']({'where':{'id':_0x3283b8['params']['id']}})[_0x49a6('0x1b')](handleEntityNotFound(_0x2f54ec,null))['then'](removeEntity(_0x2f54ec,null))[_0x49a6('0x23')](handleError(_0x2f54ec,null));};exports['getConfigurations']=function(_0x4d364e,_0x344517,_0x285187){var _0x355c8f={};var _0x59200b={};var _0x1ea1e2;var _0x186f16;return db[_0x49a6('0x32')][_0x49a6('0x54')]({'where':{'id':_0x4d364e[_0x49a6('0x4b')]['id']}})[_0x49a6('0x1b')](handleEntityNotFound(_0x344517,null))['then'](function(_0x91cf5b){if(_0x91cf5b){_0x1ea1e2=_0x91cf5b;_0x59200b[_0x49a6('0x36')]=_[_0x49a6('0x37')](db[_0x49a6('0x55')][_0x49a6('0x33')]);_0x59200b[_0x49a6('0x38')]=_[_0x49a6('0x37')](_0x4d364e[_0x49a6('0x38')]);_0x59200b[_0x49a6('0x39')]=_[_0x49a6('0x4c')](_0x59200b[_0x49a6('0x36')],_0x59200b[_0x49a6('0x38')]);_0x355c8f[_0x49a6('0x3a')]=_['intersection'](_0x59200b[_0x49a6('0x36')],qs[_0x49a6('0x4d')](_0x4d364e[_0x49a6('0x38')][_0x49a6('0x4d')]));_0x355c8f[_0x49a6('0x3a')]=_0x355c8f[_0x49a6('0x3a')][_0x49a6('0x3b')]?_0x355c8f['attributes']:_0x59200b['model'];_0x355c8f['order']=qs[_0x49a6('0x3f')](_0x4d364e[_0x49a6('0x38')][_0x49a6('0x3f')]);_0x355c8f[_0x49a6('0x40')]=qs[_0x49a6('0x39')](_[_0x49a6('0x41')](_0x4d364e[_0x49a6('0x38')],_0x59200b['filters']));if(_0x4d364e[_0x49a6('0x38')]['filter']){_0x355c8f['where']=_['merge'](_0x355c8f[_0x49a6('0x40')],{'$or':_[_0x49a6('0x31')](_0x355c8f[_0x49a6('0x3a')],function(_0x235fa8){var _0x3c1b5b={};_0x3c1b5b[_0x235fa8]={'$like':'%'+_0x4d364e[_0x49a6('0x38')][_0x49a6('0x42')]+'%'};return _0x3c1b5b;})});}_0x355c8f=_['merge']({},_0x355c8f,_0x4d364e[_0x49a6('0x46')]);return _0x1ea1e2[_0x49a6('0x56')](_0x355c8f);}})[_0x49a6('0x1b')](function(_0x217741){if(_0x217741){_0x186f16=_0x217741[_0x49a6('0x3b')];if(!_0x4d364e[_0x49a6('0x38')][_0x49a6('0x3c')](_0x49a6('0x3d'))){_0x355c8f[_0x49a6('0x2b')]=qs[_0x49a6('0x2b')](_0x4d364e['query'][_0x49a6('0x2b')]);_0x355c8f[_0x49a6('0x28')]=qs[_0x49a6('0x28')](_0x4d364e[_0x49a6('0x38')]['offset']);}return _0x1ea1e2[_0x49a6('0x56')](_0x355c8f);}})[_0x49a6('0x1b')](function(_0x57d91f){if(_0x57d91f){return _0x57d91f?{'count':_0x186f16,'rows':_0x57d91f}:null;}})['then'](respondWithResult(_0x344517,null))[_0x49a6('0x23')](handleError(_0x344517,null));};exports[_0x49a6('0x57')]=function(_0x41eba4,_0x26df58,_0x367545){if(_0x41eba4[_0x49a6('0x52')]['id']){delete _0x41eba4[_0x49a6('0x52')]['id'];}return db[_0x49a6('0x32')]['findOne']({'where':{'id':_0x41eba4[_0x49a6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x26df58,null))[_0x49a6('0x1b')](function(_0x3d4f98){if(_0x3d4f98){_0x41eba4[_0x49a6('0x52')][_0x49a6('0x58')]=_0x3d4f98['id'];_0x41eba4[_0x49a6('0x52')][_0x49a6('0x59')]=integrations[_0x49a6('0x5a')](_0x41eba4[_0x49a6('0x52')]['channel'],_0x41eba4[_0x49a6('0x52')][_0x49a6('0x44')]);_0x41eba4['body'][_0x49a6('0x5b')]=integrations[_0x49a6('0x5c')](_0x41eba4['body'][_0x49a6('0x5d')],_0x41eba4[_0x49a6('0x52')][_0x49a6('0x44')]);return db['Dynamics365Configuration'][_0x49a6('0x50')](_0x41eba4['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0x49a6('0x59')},{'model':db[_0x49a6('0x5e')],'as':_0x49a6('0x5b')}]});}return null;})[_0x49a6('0x1b')](respondWithResult(_0x26df58,null))[_0x49a6('0x23')](handleError(_0x26df58,null));};exports['getFields']=function(_0x4b2362,_0x1334b6,_0x46fe35){var _0x4b1b2d=_0x4b2362[_0x49a6('0x38')]['ticketType'];var _0x5c851f=_0x4b1b2d===_0x49a6('0x5f')?_0x49a6('0x60'):'PhoneCall';var _0x4a41b6='';var _0x597e19='';var _0x43550c='';var _0x509932='';var _0x44d62c='';var _0x1860f9='';var _0x4f0d3d='';var _0x264954='';var _0x59dce9=[_0x49a6('0x61'),_0x49a6('0x62'),'customerid',_0x49a6('0x63'),_0x49a6('0x64'),_0x49a6('0x65'),_0x49a6('0x66'),_0x49a6('0x67'),_0x49a6('0x68'),'phonecall_activity_parties'];var _0x981e21=[_0x49a6('0x69'),_0x49a6('0x6a'),_0x49a6('0x6b'),_0x49a6('0x6c'),_0x49a6('0x6d'),_0x49a6('0x6e'),'contractdetailidname',_0x49a6('0x6f'),'createdbyexternalpartyname','createdbyexternalpartyyominame',_0x49a6('0x70'),'createdbyyominame',_0x49a6('0x71'),'createdonbehalfbyname',_0x49a6('0x72'),_0x49a6('0x73'),_0x49a6('0x74'),_0x49a6('0x75'),_0x49a6('0x76'),_0x49a6('0x77'),'entityimage_timestamp',_0x49a6('0x78'),_0x49a6('0x79'),'exchangerate','firstresponsebykpiidname','followupby',_0x49a6('0x7a'),_0x49a6('0x7b'),'kbarticleidname','lastonholdtime',_0x49a6('0x7c'),_0x49a6('0x7d'),'modifiedbyexternalpartyyominame',_0x49a6('0x7e'),_0x49a6('0x7f'),'modifiedon',_0x49a6('0x80'),_0x49a6('0x81'),_0x49a6('0x82'),_0x49a6('0x83'),_0x49a6('0x84'),'onholdtime',_0x49a6('0x85'),_0x49a6('0x86'),_0x49a6('0x87'),_0x49a6('0x88'),'parentcaseidname',_0x49a6('0x89'),_0x49a6('0x8a'),_0x49a6('0x8b'),_0x49a6('0x8c'),_0x49a6('0x8d'),_0x49a6('0x8e'),'resolvebykpiidname',_0x49a6('0x8f'),_0x49a6('0x90'),_0x49a6('0x91'),'sentimentvalue',_0x49a6('0x92'),_0x49a6('0x93'),_0x49a6('0x94'),'statecode',_0x49a6('0x95'),_0x49a6('0x96'),_0x49a6('0x97'),_0x49a6('0x98'),_0x49a6('0x99'),_0x49a6('0x9a'),_0x49a6('0x9b'),_0x49a6('0x9c')];var _0x5193bf=_0x59dce9['concat'](_0x981e21);return db[_0x49a6('0x32')][_0x49a6('0x54')]({'where':{'id':_0x4b2362[_0x49a6('0x4b')]['id']},'attributes':['id',_0x49a6('0x9d'),'password',_0x49a6('0x9e'),_0x49a6('0x9f'),'clientId',_0x49a6('0xa0')]})[_0x49a6('0x1b')](handleEntityNotFound(_0x1334b6,null))[_0x49a6('0x1b')](function(_0x13d614){if(_0x13d614){_0x264954=_0x13d614[_0x49a6('0x9e')];var _0x19d7fc=_0x264954[_0x49a6('0xa1')](-0x1);if(_0x19d7fc==='/'){_0x264954=_0x264954[_0x49a6('0xa2')](0x0,_0x264954[_0x49a6('0xa3')](_0x19d7fc));}_0x4f0d3d=util[_0x49a6('0xa4')](_0x49a6('0xa5'),_0x264954);var _0x1c94ed={'method':_0x49a6('0xa6'),'uri':_0x49a6('0xa7')+_0x13d614[_0x49a6('0x9f')]+_0x49a6('0xa8'),'form':{'client_id':_0x13d614[_0x49a6('0xa9')],'resource':_0x264954,'username':_0x13d614[_0x49a6('0x9d')],'password':_0x13d614['password'],'grant_type':_0x49a6('0xaa'),'client_secret':_0x13d614[_0x49a6('0xa0')]},'json':!![]};return rp(_0x1c94ed);}})[_0x49a6('0x1b')](function(_0x2bb897){_0x1860f9=_0x2bb897[_0x49a6('0xab')];var _0x3694a3={'method':_0x49a6('0xac'),'uri':encodeURI(_0x4f0d3d+_0x49a6('0xad')+_0x5c851f+'\x27'),'headers':{'Authorization':_0x49a6('0xae')+_0x1860f9,'If-None-Match':null,'OData-Version':_0x49a6('0xaf')},'json':!![]};return rp(_0x3694a3);})[_0x49a6('0x1b')](function(_0x3ce731){var _0x262483=_0x3ce731['value'][0x0];var _0x1238d6=_0x262483['MetadataId'];var _0x26ac72={'method':_0x49a6('0xac'),'uri':_0x4f0d3d+_0x49a6('0xb0')+_0x1238d6+_0x49a6('0xb1'),'headers':{'Authorization':'Bearer\x20'+_0x1860f9,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x26ac72);})[_0x49a6('0x1b')](function(_0xc7faec){_0x4a41b6=_0xc7faec;_0x597e19=_0x4a41b6[_0x49a6('0xb2')];_0x597e19=_[_0x49a6('0xb3')](_0x597e19,function(_0x507d50){return!_0x5193bf[_0x49a6('0xb4')](_0x507d50['LogicalName']);});var _0x206cdc=[];var _0x587c78=[];_0x597e19[_0x49a6('0xb5')](function(_0x32bc64){if(_0x32bc64[_0x49a6('0xb6')]){var _0xeda294=_0x32bc64[_0x49a6('0xb6')][_0x49a6('0xa2')](_0x32bc64[_0x49a6('0xb6')][_0x49a6('0xa3')]('.')+0x1);if(_0xeda294===_0x49a6('0xb7')){_0x206cdc[_0x49a6('0xb8')](getSelectList(_0x4f0d3d,_0x4b1b2d,_0x587c78,_0x4a41b6[_0x49a6('0xb9')],_0x32bc64['MetadataId'],_0x1860f9));}}});return Promise[_0x49a6('0xba')](_0x206cdc);})[_0x49a6('0x1b')](function(_0x14b87f){_0x43550c=_0x14b87f[0x0];var _0x247b2d=[];var _0xb0487c=[];_0x597e19[_0x49a6('0xb5')](function(_0x33bfe0){if(!_['isNil'](_0x33bfe0[_0x49a6('0xb6')])){var _0x3f2aa3=_0x33bfe0[_0x49a6('0xb6')][_0x49a6('0xa2')](_0x33bfe0[_0x49a6('0xb6')]['lastIndexOf']('.')+0x1);if(_0x3f2aa3==='BooleanAttributeMetadata'){_0x247b2d['push'](getBooleanList(_0x4f0d3d,_0x4b1b2d,_0xb0487c,_0x4a41b6['MetadataId'],_0x33bfe0[_0x49a6('0xb9')],_0x1860f9));}}});return Promise['all'](_0x247b2d);})[_0x49a6('0x1b')](function(_0x39fea6){_0x509932=_0x39fea6[0x0];var _0x258e01=[];var _0x809aca=[];_0x597e19[_0x49a6('0xb5')](function(_0x4b79cc){if(_0x4b79cc['@odata.type']){var _0x525f82=_0x4b79cc[_0x49a6('0xb6')]['substring'](_0x4b79cc[_0x49a6('0xb6')][_0x49a6('0xa3')]('.')+0x1);if(_0x525f82===_0x49a6('0xbb')||_0x525f82===_0x49a6('0xbc')||_0x525f82===_0x49a6('0xbd')||_0x525f82===_0x49a6('0xbe')||_0x525f82===_0x49a6('0xbf')||_0x525f82===_0x49a6('0xc0')||_0x525f82==='StatusAttributeMetadata'||_0x525f82===_0x49a6('0xc1')||_0x525f82==='StateAttributeMetadata'||_0x525f82===_0x49a6('0xc2')){_0x258e01[_0x49a6('0xb8')](getInputList(_0x4f0d3d,_0x4b1b2d,_0x525f82,_0x809aca,_0x4a41b6[_0x49a6('0xb9')],_0x4b79cc[_0x49a6('0xb9')],_0x1860f9));}}});return Promise['all'](_0x258e01);})['then'](function(_0x3b5f65){_0x44d62c=_0x3b5f65[0x0];var _0x5ded21=_0x43550c[_0x49a6('0xc3')](_0x509932)['concat'](_0x44d62c);var _0x18aeec={'count':_0x5ded21[_0x49a6('0x3b')],'rows':_0x5ded21};return _0x18aeec;})[_0x49a6('0x1b')](respondWithResult(_0x1334b6,null))[_0x49a6('0x23')](function(_0x3ebbb1){var _0x51c61d=_0x4b2362[_0x49a6('0x38')]['test']?0x1f4:_0x3ebbb1['statusCode']||0x1f4;logger[_0x49a6('0x1f')](_0x3ebbb1[_0x49a6('0xc4')]);delete _0x3ebbb1[_0x49a6('0x2f')];if(_0x51c61d===0x191){_0x51c61d=0x190;}_0x1334b6['status'](_0x51c61d)[_0x49a6('0x30')](_0x4b2362[_0x49a6('0x38')]['test']?{'message':_0x49a6('0xc5'),'statusCode':_0x3ebbb1[_0x49a6('0xc6')]}:_0x3ebbb1);});};function getSelectList(_0x4274da,_0x58bdfb,_0x22d62c,_0x61d1b1,_0x259db6,_0x5d1a23){var _0x4a6bd6={'method':_0x49a6('0xac'),'uri':_0x4274da+_0x49a6('0xb0')+_0x61d1b1+_0x49a6('0xc7')+_0x259db6+_0x49a6('0xc8')+_0x49a6('0xc9'),'headers':{'Authorization':_0x49a6('0xae')+_0x5d1a23,'If-None-Match':null,'OData-Version':_0x49a6('0xaf')},'json':!![]};return rp(_0x4a6bd6)[_0x49a6('0x1b')](function(_0x1d5925){var _0x90a919=[];var _0x30701a=_0x1d5925['OptionSet'][_0x49a6('0xca')];_0x30701a['forEach'](function(_0x3d431f){_0x90a919[_0x49a6('0xb8')]({'name':_0x3d431f[_0x49a6('0xcb')][_0x49a6('0xcc')][_0x49a6('0xcb')],'value':String(_0x3d431f[_0x49a6('0xcd')])});});var _0x1a082a={'id':_0x58bdfb+'_'+_0x1d5925['LogicalName'],'name':_0x1d5925[_0x49a6('0xce')][_0x49a6('0xcc')]['Label'],'custom':![],'options':_0x90a919};_0x22d62c[_0x49a6('0xb8')](_0x1a082a);return _0x22d62c;});}function getBooleanList(_0x1ae642,_0x20fa41,_0x5ad754,_0x56d494,_0x4e5335,_0x4717cf){var _0x3db3eb={'method':'GET','uri':_0x1ae642+'EntityDefinitions('+_0x56d494+')/Attributes('+_0x4e5335+_0x49a6('0xcf'),'headers':{'Authorization':_0x49a6('0xae')+_0x4717cf,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3db3eb)[_0x49a6('0x1b')](function(_0x161128){var _0x151f2d=[];_0x151f2d['push']({'name':_0x161128[_0x49a6('0xd0')][_0x49a6('0xd1')][_0x49a6('0xcb')][_0x49a6('0xcc')][_0x49a6('0xcb')],'value':'true'},{'name':_0x161128[_0x49a6('0xd0')]['FalseOption']['Label'][_0x49a6('0xcc')]['Label'],'value':_0x49a6('0xd2')});var _0x3195d0={'id':_0x20fa41+'_'+_0x161128[_0x49a6('0xd3')],'name':_0x161128[_0x49a6('0xce')][_0x49a6('0xcc')][_0x49a6('0xcb')],'custom':![],'options':_0x151f2d};_0x5ad754[_0x49a6('0xb8')](_0x3195d0);return _0x5ad754;});}function getInputList(_0x3ce5ba,_0x899e5,_0x8172e1,_0x1d8bd2,_0x303b88,_0x561513,_0x28bcf3){var _0x208f08={'method':'GET','uri':_0x3ce5ba+_0x49a6('0xb0')+_0x303b88+_0x49a6('0xc7')+_0x561513+_0x49a6('0xd4')+_0x8172e1+_0x49a6('0xd5'),'headers':{'Authorization':_0x49a6('0xae')+_0x28bcf3,'If-None-Match':null,'OData-Version':_0x49a6('0xaf')},'json':!![]};return rp(_0x208f08)[_0x49a6('0x1b')](function(_0x3df95f){var _0x2dbd68={'id':_0x899e5+'_'+_0x3df95f[_0x49a6('0xd3')],'name':_0x3df95f['DisplayName'][_0x49a6('0xcc')]?_0x3df95f[_0x49a6('0xce')][_0x49a6('0xcc')][_0x49a6('0xcb')]:_0x3df95f[_0x49a6('0xd3')],'custom':![],'options':[]};_0x1d8bd2[_0x49a6('0xb8')](_0x2dbd68);return _0x1d8bd2;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 4f372d5..5e36443 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 _0x010d=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x4b90d3,_0x5f498a){var _0x31d502=function(_0x589542){while(--_0x589542){_0x4b90d3['push'](_0x4b90d3['shift']());}};_0x31d502(++_0x5f498a);}(_0x010d,0x8c));var _0xd010=function(_0x104600,_0x33bb2c){_0x104600=_0x104600-0x0;var _0x1b3cca=_0x010d[_0x104600];return _0x1b3cca;};'use strict';var _=require('lodash');var util=require(_0xd010('0x0'));var logger=require(_0xd010('0x1'))(_0xd010('0x2'));var moment=require(_0xd010('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd010('0x4'));var rimraf=require(_0xd010('0x5'));var config=require(_0xd010('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x1a54cf,_0x2d3134){return _0x1a54cf[_0xd010('0x7')](_0xd010('0x8'),attributes,{'tableName':_0xd010('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd37=['../../config/environment','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util','api','moment','bluebird','rimraf'];(function(_0x51674a,_0x77ccff){var _0x13fca6=function(_0x3d6c27){while(--_0x3d6c27){_0x51674a['push'](_0x51674a['shift']());}};_0x13fca6(++_0x77ccff);}(_0xbd37,0x1de));var _0x7bd3=function(_0x2c508c,_0x2a365b){_0x2c508c=_0x2c508c-0x0;var _0x5af45a=_0xbd37[_0x2c508c];return _0x5af45a;};'use strict';var _=require(_0x7bd3('0x0'));var util=require(_0x7bd3('0x1'));var logger=require('../../config/logger')(_0x7bd3('0x2'));var moment=require(_0x7bd3('0x3'));var BPromise=require(_0x7bd3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7bd3('0x5'));var config=require(_0x7bd3('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x7bd3('0x7')]=function(_0x218c6a,_0x390473){return _0x218c6a[_0x7bd3('0x8')](_0x7bd3('0x9'),attributes,{'tableName':_0x7bd3('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 20cc115..39d546b 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 _0x6c65=['message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','where','map','include','model','attributes','raw','info','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x39ea7f,_0x38c2cd){var _0x113179=function(_0x124e90){while(--_0x124e90){_0x39ea7f['push'](_0x39ea7f['shift']());}};_0x113179(++_0x38c2cd);}(_0x6c65,0x78));var _0x56c6=function(_0x32be53,_0x50860d){_0x32be53=_0x32be53-0x0;var _0x10d08e=_0x6c65[_0x32be53];return _0x10d08e;};'use strict';var _=require(_0x56c6('0x0'));var util=require(_0x56c6('0x1'));var moment=require(_0x56c6('0x2'));var BPromise=require(_0x56c6('0x3'));var rs=require(_0x56c6('0x4'));var fs=require('fs');var Redis=require(_0x56c6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x56c6('0x6'));var logger=require(_0x56c6('0x7'))(_0x56c6('0x8'));var config=require(_0x56c6('0x9'));var jayson=require(_0x56c6('0xa'));var client=jayson['client'][_0x56c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f7d43,_0x12834a,_0x3123cb){return new BPromise(function(_0x2422a9,_0x5f35af){return client[_0x56c6('0xc')](_0x2f7d43,_0x3123cb)[_0x56c6('0xd')](function(_0x394683){logger['info'](_0x56c6('0xe'),_0x12834a,_0x56c6('0xf'));logger[_0x56c6('0x10')](_0x56c6('0x11'),_0x12834a,_0x56c6('0xf'),JSON[_0x56c6('0x12')](_0x394683));if(_0x394683['error']){if(_0x394683[_0x56c6('0x13')]['code']===0x1f4){logger['error'](_0x56c6('0xe'),_0x12834a,_0x394683[_0x56c6('0x13')][_0x56c6('0x14')]);return _0x5f35af(_0x394683[_0x56c6('0x13')]['message']);}logger[_0x56c6('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x12834a,_0x394683[_0x56c6('0x13')]['message']);return _0x2422a9(_0x394683[_0x56c6('0x13')]['message']);}else{logger['info'](_0x56c6('0xe'),_0x12834a,'request\x20sent');_0x2422a9(_0x394683[_0x56c6('0x15')]['message']);}})[_0x56c6('0x16')](function(_0x5daebf){logger[_0x56c6('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x12834a,_0x5daebf);_0x5f35af(_0x5daebf);});});}exports[_0x56c6('0x17')]=function(_0x5625f2){var _0x129b17=this;return new Promise(function(_0x288325,_0x4a6b95){return db[_0x56c6('0x18')][_0x56c6('0x19')]({'raw':_0x5625f2[_0x56c6('0x1a')]?_0x5625f2[_0x56c6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5625f2[_0x56c6('0x1a')]?_0x5625f2[_0x56c6('0x1a')][_0x56c6('0x1b')]||null:null,'attributes':_0x5625f2[_0x56c6('0x1a')]?_0x5625f2[_0x56c6('0x1a')]['attributes']||null:null,'limit':_0x5625f2[_0x56c6('0x1a')]?_0x5625f2[_0x56c6('0x1a')]['limit']||null:null,'include':_0x5625f2[_0x56c6('0x1a')]?_0x5625f2['options']['include']?_[_0x56c6('0x1c')](_0x5625f2[_0x56c6('0x1a')][_0x56c6('0x1d')],function(_0x5c6682){return{'model':db[_0x5c6682[_0x56c6('0x1e')]],'as':_0x5c6682['as'],'attributes':_0x5c6682[_0x56c6('0x1f')],'include':_0x5c6682[_0x56c6('0x1d')]?_[_0x56c6('0x1c')](_0x5c6682[_0x56c6('0x1d')],function(_0x207f05){return{'model':db[_0x207f05['model']],'as':_0x207f05['as'],'attributes':_0x207f05['attributes'],'include':_0x207f05[_0x56c6('0x1d')]?_[_0x56c6('0x1c')](_0x207f05['include'],function(_0x33f95e){return{'model':db[_0x33f95e['model']],'as':_0x33f95e['as'],'attributes':_0x33f95e[_0x56c6('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7ef8d9){logger['info'](_0x56c6('0x17'),_0x5625f2);logger[_0x56c6('0x10')](_0x56c6('0x17'),_0x5625f2,JSON[_0x56c6('0x12')](_0x7ef8d9));_0x288325(_0x7ef8d9);})[_0x56c6('0x16')](function(_0x67fec3){logger[_0x56c6('0x13')](_0x56c6('0x17'),_0x67fec3[_0x56c6('0x14')],_0x5625f2);_0x4a6b95(_0x129b17[_0x56c6('0x13')](0x1f4,_0x67fec3[_0x56c6('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x271c38){var _0x22a98e=this;return new Promise(function(_0x53dc4e,_0x5909cf){return db[_0x56c6('0x18')]['find']({'raw':_0x271c38[_0x56c6('0x1a')]?_0x271c38['options'][_0x56c6('0x20')]===undefined?!![]:![]:!![],'where':_0x271c38[_0x56c6('0x1a')]?_0x271c38[_0x56c6('0x1a')]['where']||null:null,'attributes':_0x271c38[_0x56c6('0x1a')]?_0x271c38[_0x56c6('0x1a')][_0x56c6('0x1f')]||null:null,'include':_0x271c38[_0x56c6('0x1a')]?_0x271c38[_0x56c6('0x1a')][_0x56c6('0x1d')]?_[_0x56c6('0x1c')](_0x271c38[_0x56c6('0x1a')][_0x56c6('0x1d')],function(_0x35572b){return{'model':db[_0x35572b['model']],'as':_0x35572b['as'],'attributes':_0x35572b[_0x56c6('0x1f')],'include':_0x35572b[_0x56c6('0x1d')]?_['map'](_0x35572b[_0x56c6('0x1d')],function(_0x23e2d7){return{'model':db[_0x23e2d7[_0x56c6('0x1e')]],'as':_0x23e2d7['as'],'attributes':_0x23e2d7[_0x56c6('0x1f')],'include':_0x23e2d7[_0x56c6('0x1d')]?_[_0x56c6('0x1c')](_0x23e2d7[_0x56c6('0x1d')],function(_0x5aa1d7){return{'model':db[_0x5aa1d7[_0x56c6('0x1e')]],'as':_0x5aa1d7['as'],'attributes':_0x5aa1d7[_0x56c6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x56c6('0xd')](function(_0x475f50){logger[_0x56c6('0x21')](_0x56c6('0x22'),_0x271c38);logger[_0x56c6('0x10')]('ShowDynamics365Account',_0x271c38,JSON['stringify'](_0x475f50));_0x53dc4e(_0x475f50);})[_0x56c6('0x16')](function(_0x13a927){logger[_0x56c6('0x13')](_0x56c6('0x22'),_0x13a927[_0x56c6('0x14')],_0x271c38);_0x5909cf(_0x22a98e[_0x56c6('0x13')](0x1f4,_0x13a927[_0x56c6('0x14')]));});});}; \ No newline at end of file +var _0x8ac9=['GetDynamics365Account','findAll','options','raw','where','attributes','limit','map','model','include','ShowDynamics365Account','Dynamics365Account','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','catch'];(function(_0x5f519b,_0x5b606f){var _0x2461e2=function(_0x510241){while(--_0x510241){_0x5f519b['push'](_0x5f519b['shift']());}};_0x2461e2(++_0x5b606f);}(_0x8ac9,0x199));var _0x98ac=function(_0x211a7b,_0x429abf){_0x211a7b=_0x211a7b-0x0;var _0x24ed23=_0x8ac9[_0x211a7b];return _0x24ed23;};'use strict';var _=require(_0x98ac('0x0'));var util=require(_0x98ac('0x1'));var moment=require(_0x98ac('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98ac('0x3'));var db=require(_0x98ac('0x4'))['db'];var utils=require(_0x98ac('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x98ac('0x6'));var jayson=require(_0x98ac('0x7'));var client=jayson[_0x98ac('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x556d23,_0x3b3780,_0x1702d6){return new BPromise(function(_0x3e025e,_0x146dc1){return client[_0x98ac('0x9')](_0x556d23,_0x1702d6)[_0x98ac('0xa')](function(_0x5bb362){logger[_0x98ac('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x3b3780,_0x98ac('0xc'));logger[_0x98ac('0xd')](_0x98ac('0xe'),_0x3b3780,_0x98ac('0xc'),JSON[_0x98ac('0xf')](_0x5bb362));if(_0x5bb362[_0x98ac('0x10')]){if(_0x5bb362[_0x98ac('0x10')]['code']===0x1f4){logger['error'](_0x98ac('0x11'),_0x3b3780,_0x5bb362[_0x98ac('0x10')][_0x98ac('0x12')]);return _0x146dc1(_0x5bb362[_0x98ac('0x10')]['message']);}logger[_0x98ac('0x10')](_0x98ac('0x11'),_0x3b3780,_0x5bb362[_0x98ac('0x10')]['message']);return _0x3e025e(_0x5bb362['error'][_0x98ac('0x12')]);}else{logger[_0x98ac('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x3b3780,'request\x20sent');_0x3e025e(_0x5bb362['result'][_0x98ac('0x12')]);}})[_0x98ac('0x13')](function(_0x5634c4){logger[_0x98ac('0x10')](_0x98ac('0x11'),_0x3b3780,_0x5634c4);_0x146dc1(_0x5634c4);});});}exports[_0x98ac('0x14')]=function(_0x4b907e){var _0x4715c9=this;return new Promise(function(_0x42f64e,_0x225024){return db['Dynamics365Account'][_0x98ac('0x15')]({'raw':_0x4b907e[_0x98ac('0x16')]?_0x4b907e[_0x98ac('0x16')][_0x98ac('0x17')]===undefined?!![]:![]:!![],'where':_0x4b907e['options']?_0x4b907e['options'][_0x98ac('0x18')]||null:null,'attributes':_0x4b907e[_0x98ac('0x16')]?_0x4b907e[_0x98ac('0x16')][_0x98ac('0x19')]||null:null,'limit':_0x4b907e[_0x98ac('0x16')]?_0x4b907e[_0x98ac('0x16')][_0x98ac('0x1a')]||null:null,'include':_0x4b907e[_0x98ac('0x16')]?_0x4b907e[_0x98ac('0x16')]['include']?_[_0x98ac('0x1b')](_0x4b907e[_0x98ac('0x16')]['include'],function(_0x92f4bc){return{'model':db[_0x92f4bc[_0x98ac('0x1c')]],'as':_0x92f4bc['as'],'attributes':_0x92f4bc['attributes'],'include':_0x92f4bc[_0x98ac('0x1d')]?_[_0x98ac('0x1b')](_0x92f4bc[_0x98ac('0x1d')],function(_0x5887ee){return{'model':db[_0x5887ee[_0x98ac('0x1c')]],'as':_0x5887ee['as'],'attributes':_0x5887ee[_0x98ac('0x19')],'include':_0x5887ee[_0x98ac('0x1d')]?_[_0x98ac('0x1b')](_0x5887ee[_0x98ac('0x1d')],function(_0x293c63){return{'model':db[_0x293c63[_0x98ac('0x1c')]],'as':_0x293c63['as'],'attributes':_0x293c63[_0x98ac('0x19')]};}):[]};}):[]};}):[]:[]})[_0x98ac('0xa')](function(_0x1caa3f){logger['info'](_0x98ac('0x14'),_0x4b907e);logger[_0x98ac('0xd')](_0x98ac('0x14'),_0x4b907e,JSON[_0x98ac('0xf')](_0x1caa3f));_0x42f64e(_0x1caa3f);})[_0x98ac('0x13')](function(_0x4305f3){logger[_0x98ac('0x10')]('GetDynamics365Account',_0x4305f3['message'],_0x4b907e);_0x225024(_0x4715c9[_0x98ac('0x10')](0x1f4,_0x4305f3[_0x98ac('0x12')]));});});};exports[_0x98ac('0x1e')]=function(_0x45c5cb){var _0x2c57b1=this;return new Promise(function(_0x19f4f9,_0x67ca39){return db[_0x98ac('0x1f')][_0x98ac('0x20')]({'raw':_0x45c5cb[_0x98ac('0x16')]?_0x45c5cb['options']['raw']===undefined?!![]:![]:!![],'where':_0x45c5cb[_0x98ac('0x16')]?_0x45c5cb['options'][_0x98ac('0x18')]||null:null,'attributes':_0x45c5cb['options']?_0x45c5cb[_0x98ac('0x16')][_0x98ac('0x19')]||null:null,'include':_0x45c5cb['options']?_0x45c5cb[_0x98ac('0x16')]['include']?_[_0x98ac('0x1b')](_0x45c5cb[_0x98ac('0x16')][_0x98ac('0x1d')],function(_0xcf88da){return{'model':db[_0xcf88da[_0x98ac('0x1c')]],'as':_0xcf88da['as'],'attributes':_0xcf88da[_0x98ac('0x19')],'include':_0xcf88da[_0x98ac('0x1d')]?_[_0x98ac('0x1b')](_0xcf88da['include'],function(_0xe9c537){return{'model':db[_0xe9c537[_0x98ac('0x1c')]],'as':_0xe9c537['as'],'attributes':_0xe9c537[_0x98ac('0x19')],'include':_0xe9c537[_0x98ac('0x1d')]?_[_0x98ac('0x1b')](_0xe9c537[_0x98ac('0x1d')],function(_0x37b0ad){return{'model':db[_0x37b0ad[_0x98ac('0x1c')]],'as':_0x37b0ad['as'],'attributes':_0x37b0ad[_0x98ac('0x19')]};}):[]};}):[]};}):[]:[]})[_0x98ac('0xa')](function(_0x24e4ad){logger[_0x98ac('0xb')](_0x98ac('0x1e'),_0x45c5cb);logger[_0x98ac('0xd')](_0x98ac('0x1e'),_0x45c5cb,JSON['stringify'](_0x24e4ad));_0x19f4f9(_0x24e4ad);})[_0x98ac('0x13')](function(_0x290288){logger[_0x98ac('0x10')](_0x98ac('0x1e'),_0x290288[_0x98ac('0x12')],_0x45c5cb);_0x67ca39(_0x2c57b1[_0x98ac('0x10')](0x1f4,_0x290288[_0x98ac('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 0f024e6..77ce2f1 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 _0xb07e=['getSubjects','/:id/descriptions','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xb07e,0xf7));var _0xeb07=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xb07e[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0xeb07('0x0'));var util=require(_0xeb07('0x1'));var path=require(_0xeb07('0x2'));var timeout=require('connect-timeout');var express=require(_0xeb07('0x3'));var router=express[_0xeb07('0x4')]();var fs_extra=require(_0xeb07('0x5'));var auth=require(_0xeb07('0x6'));var interaction=require(_0xeb07('0x7'));var config=require(_0xeb07('0x8'));var controller=require(_0xeb07('0x9'));router[_0xeb07('0xa')]('/',auth[_0xeb07('0xb')](),controller['index']);router[_0xeb07('0xa')](_0xeb07('0xc'),auth['isAuthenticated'](),controller[_0xeb07('0xd')]);router['get'](_0xeb07('0xe'),auth[_0xeb07('0xb')](),controller[_0xeb07('0xf')]);router['get'](_0xeb07('0x10'),auth[_0xeb07('0xb')](),controller[_0xeb07('0x11')]);router[_0xeb07('0xa')](_0xeb07('0x12'),auth[_0xeb07('0xb')](),controller['getDescriptions']);router['post']('/',auth[_0xeb07('0xb')](),controller['create']);router[_0xeb07('0x13')](_0xeb07('0xc'),auth[_0xeb07('0xb')](),controller[_0xeb07('0x14')]);router[_0xeb07('0x15')]('/:id',auth[_0xeb07('0xb')](),controller[_0xeb07('0x16')]);module[_0xeb07('0x17')]=router; \ No newline at end of file +var _0xc583=['getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','get','show','/:id/fields'];(function(_0x1451ac,_0x57506d){var _0x56b918=function(_0x149d4c){while(--_0x149d4c){_0x1451ac['push'](_0x1451ac['shift']());}};_0x56b918(++_0x57506d);}(_0xc583,0x140));var _0x3c58=function(_0xe9ff89,_0x1f7a2e){_0xe9ff89=_0xe9ff89-0x0;var _0x3f2f9c=_0xc583[_0xe9ff89];return _0x3f2f9c;};'use strict';var multer=require(_0x3c58('0x0'));var util=require(_0x3c58('0x1'));var path=require(_0x3c58('0x2'));var timeout=require(_0x3c58('0x3'));var express=require(_0x3c58('0x4'));var router=express[_0x3c58('0x5')]();var fs_extra=require(_0x3c58('0x6'));var auth=require(_0x3c58('0x7'));var interaction=require(_0x3c58('0x8'));var config=require(_0x3c58('0x9'));var controller=require(_0x3c58('0xa'));router['get']('/',auth[_0x3c58('0xb')](),controller[_0x3c58('0xc')]);router[_0x3c58('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x3c58('0xe')]);router[_0x3c58('0xd')](_0x3c58('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x3c58('0xd')]('/:id/subjects',auth[_0x3c58('0xb')](),controller[_0x3c58('0x10')]);router[_0x3c58('0xd')](_0x3c58('0x11'),auth[_0x3c58('0xb')](),controller[_0x3c58('0x12')]);router[_0x3c58('0x13')]('/',auth[_0x3c58('0xb')](),controller[_0x3c58('0x14')]);router[_0x3c58('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x3c58('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3c58('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index c40af94..2788c5b 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 _0xe4b7=['phonecall','sequelize','exports','STRING','incident'];(function(_0x3b94c3,_0x7f0fc6){var _0x1134e0=function(_0x4b3a12){while(--_0x4b3a12){_0x3b94c3['push'](_0x3b94c3['shift']());}};_0x1134e0(++_0x7f0fc6);}(_0xe4b7,0x15f));var _0x7e4b=function(_0x33d7e9,_0x500ef5){_0x33d7e9=_0x33d7e9-0x0;var _0x269ff1=_0xe4b7[_0x33d7e9];return _0x269ff1;};'use strict';var Sequelize=require(_0x7e4b('0x0'));module[_0x7e4b('0x1')]={'name':{'type':Sequelize[_0x7e4b('0x2')]},'description':{'type':Sequelize[_0x7e4b('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x7e4b('0x3'),_0x7e4b('0x4')),'defaultValue':_0x7e4b('0x3')}}; \ No newline at end of file +var _0x060c=['sequelize','exports','STRING','ENUM','incident','phonecall'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x060c,0x84));var _0xc060=function(_0x13dc7f,_0x57ca98){_0x13dc7f=_0x13dc7f-0x0;var _0x26f6ae=_0x060c[_0x13dc7f];return _0x26f6ae;};'use strict';var Sequelize=require(_0xc060('0x0'));module[_0xc060('0x1')]={'name':{'type':Sequelize[_0xc060('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xc060('0x3')](_0xc060('0x4'),_0xc060('0x5')),'defaultValue':_0xc060('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 19163fb..2c8e585 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 _0x3e77=['getFields','getSubjects','getDescriptions','findOne','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','jayson/promise','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','stack','name','Dynamics365Configuration','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','catch','params','keys','options','find','create','body','Dynamics365Field'];(function(_0x2b51b4,_0x4cef01){var _0x16ec0b=function(_0x4496e5){while(--_0x4496e5){_0x2b51b4['push'](_0x2b51b4['shift']());}};_0x16ec0b(++_0x4cef01);}(_0x3e77,0x154));var _0x73e7=function(_0x1e7570,_0x2b399c){_0x1e7570=_0x1e7570-0x0;var _0x21cbe6=_0x3e77[_0x1e7570];return _0x21cbe6;};'use strict';var emlformat=require(_0x73e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x73e7('0x1'));var jsonpatch=require(_0x73e7('0x2'));var rp=require(_0x73e7('0x3'));var moment=require('moment');var BPromise=require(_0x73e7('0x4'));var Mustache=require(_0x73e7('0x5'));var util=require('util');var path=require('path');var sox=require(_0x73e7('0x6'));var csv=require('to-csv');var ejs=require(_0x73e7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x73e7('0x8'));var squel=require(_0x73e7('0x9'));var crypto=require(_0x73e7('0xa'));var jsforce=require(_0x73e7('0xb'));var deskjs=require(_0x73e7('0xc'));var toCsv=require(_0x73e7('0xd'));var querystring=require(_0x73e7('0xe'));var Papa=require(_0x73e7('0xf'));var Redis=require(_0x73e7('0x10'));var authService=require(_0x73e7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x73e7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x73e7('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x73e7('0x14'));var licenseUtil=require(_0x73e7('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x73e7('0x16'));var client=jayson['client'][_0x73e7('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4b9efc,_0x4eb958,_0x372f3a,_0x2fdb1a){return new BPromise(function(_0x34e05d,_0x374381){var _0xf201b9=_0x2fdb1a||client;return _0xf201b9['request'](_0x4b9efc,_0x372f3a)[_0x73e7('0x18')](function(_0x257453){logger[_0x73e7('0x19')](_0x73e7('0x1a'),_0x4eb958,_0x73e7('0x1b'));logger['debug'](_0x73e7('0x1c'),_0x4eb958,_0x73e7('0x1b'),JSON['stringify'](_0x257453));if(_0x257453[_0x73e7('0x1d')]){if(_0x257453[_0x73e7('0x1d')][_0x73e7('0x1e')]===0x1f4){logger[_0x73e7('0x1d')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4eb958,_0x257453[_0x73e7('0x1d')][_0x73e7('0x1f')]);return _0x374381(_0x257453[_0x73e7('0x1d')][_0x73e7('0x1f')]);}logger[_0x73e7('0x1d')](_0x73e7('0x1a'),_0x4eb958,_0x257453[_0x73e7('0x1d')][_0x73e7('0x1f')]);return _0x34e05d(_0x257453[_0x73e7('0x1d')][_0x73e7('0x1f')]);}else{logger[_0x73e7('0x19')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4eb958,'request\x20sent');_0x34e05d(_0x257453['result'][_0x73e7('0x1f')]);}})['catch'](function(_0x2d094b){logger[_0x73e7('0x1d')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4eb958,_0x2d094b);_0x374381(_0x2d094b);});});}function respondWithStatusCode(_0x2f2878,_0x2a8379){_0x2a8379=_0x2a8379||0xcc;return function(_0x5d3ac2){if(_0x5d3ac2){return _0x2f2878[_0x73e7('0x20')](_0x2a8379);}return _0x2f2878[_0x73e7('0x21')](_0x2a8379)[_0x73e7('0x22')]();};}function respondWithResult(_0x413a48,_0xcd216a){_0xcd216a=_0xcd216a||0xc8;return function(_0x136b31){if(_0x136b31){return _0x413a48[_0x73e7('0x21')](_0xcd216a)[_0x73e7('0x23')](_0x136b31);}};}function respondWithFilteredResult(_0xea76b8,_0x1f3f5d){return function(_0x5d8cd2){if(_0x5d8cd2){var _0x548549=typeof _0x1f3f5d[_0x73e7('0x24')]===_0x73e7('0x25')&&typeof _0x1f3f5d[_0x73e7('0x26')]===_0x73e7('0x25');var _0x536bc0=_0x5d8cd2[_0x73e7('0x27')];var _0x1f2cef=_0x548549?0x0:_0x1f3f5d['offset'];var _0x243f7d=_0x548549?_0x5d8cd2[_0x73e7('0x27')]:_0x1f3f5d[_0x73e7('0x24')]+_0x1f3f5d['limit'];var _0x3bec01;if(_0x243f7d>=_0x536bc0){_0x243f7d=_0x536bc0;_0x3bec01=0xc8;}else{_0x3bec01=0xce;}_0xea76b8[_0x73e7('0x21')](_0x3bec01);return _0xea76b8[_0x73e7('0x28')]('Content-Range',_0x1f2cef+'-'+_0x243f7d+'/'+_0x536bc0)[_0x73e7('0x23')](_0x5d8cd2);}return null;};}function patchUpdates(_0xc5ffc3){return function(_0x445fce){try{jsonpatch['apply'](_0x445fce,_0xc5ffc3,!![]);}catch(_0x158116){return BPromise[_0x73e7('0x29')](_0x158116);}return _0x445fce[_0x73e7('0x2a')]();};}function saveUpdates(_0x33764d,_0x54a9e5){return function(_0x2cb9b7){if(_0x2cb9b7){return _0x2cb9b7[_0x73e7('0x2b')](_0x33764d)['then'](function(_0x20d4ec){return _0x20d4ec;});}return null;};}function removeEntity(_0x500474,_0x5542cd){return function(_0x2ce6ec){if(_0x2ce6ec){return _0x2ce6ec[_0x73e7('0x2c')]()[_0x73e7('0x18')](function(){_0x500474[_0x73e7('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x470ad9,_0x5301a0){return function(_0x59b658){if(!_0x59b658){_0x470ad9[_0x73e7('0x20')](0x194);}return _0x59b658;};}function handleError(_0x358033,_0x1bf22a){_0x1bf22a=_0x1bf22a||0x1f4;return function(_0x4cfb2d){logger[_0x73e7('0x1d')](_0x4cfb2d[_0x73e7('0x2d')]);if(_0x4cfb2d[_0x73e7('0x2e')]){delete _0x4cfb2d['name'];}_0x358033[_0x73e7('0x21')](_0x1bf22a)['send'](_0x4cfb2d);};}exports['index']=function(_0x7b2349,_0x3279be){var _0x1444fd={},_0x1cf71b={},_0x71c04b={'count':0x0,'rows':[]};var _0x213beb=_['map'](db[_0x73e7('0x2f')][_0x73e7('0x30')],function(_0xbd9326){return{'name':_0xbd9326[_0x73e7('0x31')],'type':_0xbd9326['type'][_0x73e7('0x32')]};});_0x1cf71b['model']=_['map'](_0x213beb,_0x73e7('0x2e'));_0x1cf71b[_0x73e7('0x33')]=_['keys'](_0x7b2349[_0x73e7('0x33')]);_0x1cf71b['filters']=_[_0x73e7('0x34')](_0x1cf71b[_0x73e7('0x35')],_0x1cf71b[_0x73e7('0x33')]);_0x1444fd[_0x73e7('0x36')]=_[_0x73e7('0x34')](_0x1cf71b[_0x73e7('0x35')],qs[_0x73e7('0x37')](_0x7b2349['query'][_0x73e7('0x37')]));_0x1444fd['attributes']=_0x1444fd[_0x73e7('0x36')][_0x73e7('0x38')]?_0x1444fd['attributes']:_0x1cf71b[_0x73e7('0x35')];if(!_0x7b2349[_0x73e7('0x33')][_0x73e7('0x39')](_0x73e7('0x3a'))){_0x1444fd['limit']=qs['limit'](_0x7b2349['query']['limit']);_0x1444fd[_0x73e7('0x24')]=qs[_0x73e7('0x24')](_0x7b2349[_0x73e7('0x33')][_0x73e7('0x24')]);}_0x1444fd[_0x73e7('0x3b')]=qs[_0x73e7('0x3c')](_0x7b2349['query'][_0x73e7('0x3c')]);_0x1444fd[_0x73e7('0x3d')]=qs[_0x73e7('0x3e')](_[_0x73e7('0x3f')](_0x7b2349[_0x73e7('0x33')],_0x1cf71b['filters']),_0x213beb);if(_0x7b2349[_0x73e7('0x33')][_0x73e7('0x40')]){_0x1444fd[_0x73e7('0x3d')]=_[_0x73e7('0x41')](_0x1444fd[_0x73e7('0x3d')],{'$or':_[_0x73e7('0x42')](_0x213beb,function(_0x46fe39){if(_0x46fe39[_0x73e7('0x43')]!==_0x73e7('0x44')){var _0x3c62c9={};_0x3c62c9[_0x46fe39[_0x73e7('0x2e')]]={'$like':'%'+_0x7b2349[_0x73e7('0x33')][_0x73e7('0x40')]+'%'};return _0x3c62c9;}})});}_0x1444fd=_[_0x73e7('0x41')]({},_0x1444fd,_0x7b2349['options']);var _0x2c7cb5={'where':_0x1444fd[_0x73e7('0x3d')]};return db[_0x73e7('0x2f')]['count'](_0x2c7cb5)['then'](function(_0x59bb55){_0x71c04b[_0x73e7('0x27')]=_0x59bb55;if(_0x7b2349[_0x73e7('0x33')][_0x73e7('0x45')]){_0x1444fd[_0x73e7('0x46')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x73e7('0x47')](_0x1444fd);})[_0x73e7('0x18')](function(_0x292eb2){_0x71c04b['rows']=_0x292eb2;return _0x71c04b;})[_0x73e7('0x18')](respondWithFilteredResult(_0x3279be,_0x1444fd))[_0x73e7('0x48')](handleError(_0x3279be,null));};exports['show']=function(_0x4db34d,_0x3c773d){var _0x25a920={'raw':![],'where':{'id':_0x4db34d[_0x73e7('0x49')]['id']}},_0x27cdac={};_0x27cdac[_0x73e7('0x35')]=_['keys'](db['Dynamics365Configuration'][_0x73e7('0x30')]);_0x27cdac[_0x73e7('0x33')]=_[_0x73e7('0x4a')](_0x4db34d[_0x73e7('0x33')]);_0x27cdac[_0x73e7('0x3e')]=_['intersection'](_0x27cdac[_0x73e7('0x35')],_0x27cdac['query']);_0x25a920[_0x73e7('0x36')]=_[_0x73e7('0x34')](_0x27cdac[_0x73e7('0x35')],qs[_0x73e7('0x37')](_0x4db34d[_0x73e7('0x33')][_0x73e7('0x37')]));_0x25a920[_0x73e7('0x36')]=_0x25a920[_0x73e7('0x36')][_0x73e7('0x38')]?_0x25a920[_0x73e7('0x36')]:_0x27cdac[_0x73e7('0x35')];if(_0x4db34d['query'][_0x73e7('0x45')]){_0x25a920['include']=[{'all':!![]}];}_0x25a920=_['merge']({},_0x25a920,_0x4db34d[_0x73e7('0x4b')]);return db[_0x73e7('0x2f')][_0x73e7('0x4c')](_0x25a920)[_0x73e7('0x18')](handleEntityNotFound(_0x3c773d,null))[_0x73e7('0x18')](respondWithResult(_0x3c773d,null))[_0x73e7('0x48')](handleError(_0x3c773d,null));};exports[_0x73e7('0x4d')]=function(_0x82d9b9,_0x121c1f){return db[_0x73e7('0x2f')]['create'](_0x82d9b9['body'],{})[_0x73e7('0x18')](respondWithResult(_0x121c1f,0xc9))[_0x73e7('0x48')](handleError(_0x121c1f,null));};exports['update']=function(_0x50b647,_0x1f0e30){if(_0x50b647[_0x73e7('0x4e')]['id']){delete _0x50b647[_0x73e7('0x4e')]['id'];}return db[_0x73e7('0x2f')]['find']({'where':{'id':_0x50b647[_0x73e7('0x49')]['id']}})[_0x73e7('0x18')](handleEntityNotFound(_0x1f0e30,null))['then'](saveUpdates(_0x50b647[_0x73e7('0x4e')],null))[_0x73e7('0x18')](respondWithResult(_0x1f0e30,null))['catch'](handleError(_0x1f0e30,null));};exports[_0x73e7('0x2c')]=function(_0x5213b9,_0x409816){return db[_0x73e7('0x2f')][_0x73e7('0x4c')]({'where':{'id':_0x5213b9[_0x73e7('0x49')]['id']}})[_0x73e7('0x18')](handleEntityNotFound(_0x409816,null))['then'](removeEntity(_0x409816,null))[_0x73e7('0x48')](handleError(_0x409816,null));};exports['getFields']=function(_0x470d49,_0x5ea250,_0x222414){var _0x46cc0b={};var _0x534138={};var _0x3ea949;var _0x5870ee;return db[_0x73e7('0x2f')]['findOne']({'where':{'id':_0x470d49[_0x73e7('0x49')]['id']}})['then'](handleEntityNotFound(_0x5ea250,null))['then'](function(_0xf4d9fd){if(_0xf4d9fd){_0x3ea949=_0xf4d9fd;_0x534138[_0x73e7('0x35')]=_['keys'](db[_0x73e7('0x4f')][_0x73e7('0x30')]);_0x534138[_0x73e7('0x33')]=_[_0x73e7('0x4a')](_0x470d49[_0x73e7('0x33')]);_0x534138['filters']=_['intersection'](_0x534138[_0x73e7('0x35')],_0x534138[_0x73e7('0x33')]);_0x46cc0b['attributes']=_[_0x73e7('0x34')](_0x534138['model'],qs['fields'](_0x470d49[_0x73e7('0x33')][_0x73e7('0x37')]));_0x46cc0b[_0x73e7('0x36')]=_0x46cc0b[_0x73e7('0x36')]['length']?_0x46cc0b[_0x73e7('0x36')]:_0x534138[_0x73e7('0x35')];_0x46cc0b[_0x73e7('0x3b')]=qs[_0x73e7('0x3c')](_0x470d49['query'][_0x73e7('0x3c')]);_0x46cc0b[_0x73e7('0x3d')]=qs[_0x73e7('0x3e')](_[_0x73e7('0x3f')](_0x470d49[_0x73e7('0x33')],_0x534138[_0x73e7('0x3e')]));if(_0x470d49[_0x73e7('0x33')]['filter']){_0x46cc0b[_0x73e7('0x3d')]=_[_0x73e7('0x41')](_0x46cc0b[_0x73e7('0x3d')],{'$or':_[_0x73e7('0x42')](_0x46cc0b['attributes'],function(_0x5b9ac7){var _0x51e0ce={};_0x51e0ce[_0x5b9ac7]={'$like':'%'+_0x470d49[_0x73e7('0x33')][_0x73e7('0x40')]+'%'};return _0x51e0ce;})});}_0x46cc0b=_[_0x73e7('0x41')]({},_0x46cc0b,_0x470d49[_0x73e7('0x4b')]);return _0x3ea949[_0x73e7('0x50')](_0x46cc0b);}})[_0x73e7('0x18')](function(_0x5e0d2e){if(_0x5e0d2e){_0x5870ee=_0x5e0d2e['length'];if(!_0x470d49[_0x73e7('0x33')][_0x73e7('0x39')](_0x73e7('0x3a'))){_0x46cc0b[_0x73e7('0x26')]=qs[_0x73e7('0x26')](_0x470d49[_0x73e7('0x33')][_0x73e7('0x26')]);_0x46cc0b[_0x73e7('0x24')]=qs[_0x73e7('0x24')](_0x470d49['query'][_0x73e7('0x24')]);}return _0x3ea949[_0x73e7('0x50')](_0x46cc0b);}})['then'](function(_0x4cceca){if(_0x4cceca){return _0x4cceca?{'count':_0x5870ee,'rows':_0x4cceca}:null;}})[_0x73e7('0x18')](respondWithResult(_0x5ea250,null))[_0x73e7('0x48')](handleError(_0x5ea250,null));};exports[_0x73e7('0x51')]=function(_0x1b55f4,_0x4664fe,_0x4f3020){var _0x348026={};var _0x2751a4={};var _0x32142e;var _0xd1d980;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x1b55f4['params']['id']}})[_0x73e7('0x18')](handleEntityNotFound(_0x4664fe,null))[_0x73e7('0x18')](function(_0x3d6a9e){if(_0x3d6a9e){_0x32142e=_0x3d6a9e;_0x2751a4[_0x73e7('0x35')]=_[_0x73e7('0x4a')](db[_0x73e7('0x4f')][_0x73e7('0x30')]);_0x2751a4['query']=_[_0x73e7('0x4a')](_0x1b55f4[_0x73e7('0x33')]);_0x2751a4[_0x73e7('0x3e')]=_[_0x73e7('0x34')](_0x2751a4[_0x73e7('0x35')],_0x2751a4['query']);_0x348026[_0x73e7('0x36')]=_[_0x73e7('0x34')](_0x2751a4['model'],qs[_0x73e7('0x37')](_0x1b55f4[_0x73e7('0x33')][_0x73e7('0x37')]));_0x348026[_0x73e7('0x36')]=_0x348026[_0x73e7('0x36')][_0x73e7('0x38')]?_0x348026[_0x73e7('0x36')]:_0x2751a4[_0x73e7('0x35')];_0x348026[_0x73e7('0x3b')]=qs[_0x73e7('0x3c')](_0x1b55f4[_0x73e7('0x33')][_0x73e7('0x3c')]);_0x348026[_0x73e7('0x3d')]=qs['filters'](_[_0x73e7('0x3f')](_0x1b55f4[_0x73e7('0x33')],_0x2751a4['filters']));if(_0x1b55f4[_0x73e7('0x33')][_0x73e7('0x40')]){_0x348026[_0x73e7('0x3d')]=_[_0x73e7('0x41')](_0x348026['where'],{'$or':_[_0x73e7('0x42')](_0x348026[_0x73e7('0x36')],function(_0x163ed6){var _0x507bc7={};_0x507bc7[_0x163ed6]={'$like':'%'+_0x1b55f4[_0x73e7('0x33')][_0x73e7('0x40')]+'%'};return _0x507bc7;})});}_0x348026=_[_0x73e7('0x41')]({},_0x348026,_0x1b55f4['options']);return _0x32142e[_0x73e7('0x51')](_0x348026);}})[_0x73e7('0x18')](function(_0x35fe8f){if(_0x35fe8f){_0xd1d980=_0x35fe8f['length'];if(!_0x1b55f4[_0x73e7('0x33')][_0x73e7('0x39')]('nolimit')){_0x348026['limit']=qs[_0x73e7('0x26')](_0x1b55f4[_0x73e7('0x33')][_0x73e7('0x26')]);_0x348026[_0x73e7('0x24')]=qs['offset'](_0x1b55f4[_0x73e7('0x33')][_0x73e7('0x24')]);}return _0x32142e[_0x73e7('0x51')](_0x348026);}})[_0x73e7('0x18')](function(_0x1f70a7){if(_0x1f70a7){return _0x1f70a7?{'count':_0xd1d980,'rows':_0x1f70a7}:null;}})[_0x73e7('0x18')](respondWithResult(_0x4664fe,null))[_0x73e7('0x48')](handleError(_0x4664fe,null));};exports[_0x73e7('0x52')]=function(_0x2f7c40,_0x393ea2,_0x4138f8){var _0x1c1237={};var _0x2a09d7={};var _0x3ce2a6;var _0x5d2c63;return db[_0x73e7('0x2f')][_0x73e7('0x53')]({'where':{'id':_0x2f7c40['params']['id']}})[_0x73e7('0x18')](handleEntityNotFound(_0x393ea2,null))[_0x73e7('0x18')](function(_0x705d4b){if(_0x705d4b){_0x3ce2a6=_0x705d4b;_0x2a09d7[_0x73e7('0x35')]=_[_0x73e7('0x4a')](db[_0x73e7('0x4f')][_0x73e7('0x30')]);_0x2a09d7['query']=_['keys'](_0x2f7c40['query']);_0x2a09d7[_0x73e7('0x3e')]=_[_0x73e7('0x34')](_0x2a09d7[_0x73e7('0x35')],_0x2a09d7[_0x73e7('0x33')]);_0x1c1237[_0x73e7('0x36')]=_[_0x73e7('0x34')](_0x2a09d7[_0x73e7('0x35')],qs[_0x73e7('0x37')](_0x2f7c40[_0x73e7('0x33')][_0x73e7('0x37')]));_0x1c1237[_0x73e7('0x36')]=_0x1c1237[_0x73e7('0x36')][_0x73e7('0x38')]?_0x1c1237[_0x73e7('0x36')]:_0x2a09d7[_0x73e7('0x35')];_0x1c1237['order']=qs[_0x73e7('0x3c')](_0x2f7c40[_0x73e7('0x33')][_0x73e7('0x3c')]);_0x1c1237[_0x73e7('0x3d')]=qs['filters'](_[_0x73e7('0x3f')](_0x2f7c40['query'],_0x2a09d7[_0x73e7('0x3e')]));if(_0x2f7c40['query'][_0x73e7('0x40')]){_0x1c1237[_0x73e7('0x3d')]=_[_0x73e7('0x41')](_0x1c1237['where'],{'$or':_['map'](_0x1c1237[_0x73e7('0x36')],function(_0x490286){var _0x27b45f={};_0x27b45f[_0x490286]={'$like':'%'+_0x2f7c40[_0x73e7('0x33')]['filter']+'%'};return _0x27b45f;})});}_0x1c1237=_['merge']({},_0x1c1237,_0x2f7c40['options']);return _0x3ce2a6[_0x73e7('0x52')](_0x1c1237);}})[_0x73e7('0x18')](function(_0x4bfb2c){if(_0x4bfb2c){_0x5d2c63=_0x4bfb2c['length'];if(!_0x2f7c40[_0x73e7('0x33')][_0x73e7('0x39')]('nolimit')){_0x1c1237[_0x73e7('0x26')]=qs[_0x73e7('0x26')](_0x2f7c40[_0x73e7('0x33')][_0x73e7('0x26')]);_0x1c1237[_0x73e7('0x24')]=qs[_0x73e7('0x24')](_0x2f7c40[_0x73e7('0x33')][_0x73e7('0x24')]);}return _0x3ce2a6['getDescriptions'](_0x1c1237);}})[_0x73e7('0x18')](function(_0x3668aa){if(_0x3668aa){return _0x3668aa?{'count':_0x5d2c63,'rows':_0x3668aa}:null;}})[_0x73e7('0x18')](respondWithResult(_0x393ea2,null))[_0x73e7('0x48')](handleError(_0x393ea2,null));}; \ No newline at end of file +var _0xb32f=['show','params','keys','includeAll','merge','find','create','body','Dynamics365Field','getFields','getSubjects','findOne','pick','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','fs-extra','squel','crypto','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','Dynamics365Configuration','include','rows'];(function(_0x3a4d84,_0x28376c){var _0x58d3f4=function(_0xbf2d90){while(--_0xbf2d90){_0x3a4d84['push'](_0x3a4d84['shift']());}};_0x58d3f4(++_0x28376c);}(_0xb32f,0x119));var _0xfb32=function(_0x3dee66,_0x27faa3){_0x3dee66=_0x3dee66-0x0;var _0x4063dc=_0xb32f[_0x3dee66];return _0x4063dc;};'use strict';var emlformat=require(_0xfb32('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfb32('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb32('0x2'));var moment=require(_0xfb32('0x3'));var BPromise=require(_0xfb32('0x4'));var Mustache=require('mustache');var util=require(_0xfb32('0x5'));var path=require(_0xfb32('0x6'));var sox=require(_0xfb32('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfb32('0x8'));var _=require('lodash');var squel=require(_0xfb32('0x9'));var crypto=require(_0xfb32('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfb32('0xb'));var querystring=require('querystring');var Papa=require(_0xfb32('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfb32('0xd'));var as=require(_0xfb32('0xe'));var hardwareService=require(_0xfb32('0xf'));var logger=require(_0xfb32('0x10'))(_0xfb32('0x11'));var utils=require(_0xfb32('0x12'));var config=require(_0xfb32('0x13'));var licenseUtil=require(_0xfb32('0x14'));var db=require(_0xfb32('0x15'))['db'];var jayson=require(_0xfb32('0x16'));var client=jayson[_0xfb32('0x17')][_0xfb32('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3965ea,_0xe90e61,_0x1b4839,_0x3debf9){return new BPromise(function(_0x59dd3c,_0x584fd5){var _0xf0cb33=_0x3debf9||client;return _0xf0cb33['request'](_0x3965ea,_0x1b4839)['then'](function(_0x2cfc3d){logger[_0xfb32('0x19')](_0xfb32('0x1a'),_0xe90e61,_0xfb32('0x1b'));logger['debug'](_0xfb32('0x1c'),_0xe90e61,_0xfb32('0x1b'),JSON[_0xfb32('0x1d')](_0x2cfc3d));if(_0x2cfc3d[_0xfb32('0x1e')]){if(_0x2cfc3d['error']['code']===0x1f4){logger[_0xfb32('0x1e')](_0xfb32('0x1a'),_0xe90e61,_0x2cfc3d[_0xfb32('0x1e')]['message']);return _0x584fd5(_0x2cfc3d[_0xfb32('0x1e')][_0xfb32('0x1f')]);}logger[_0xfb32('0x1e')]('Dynamics365Configuration,\x20%s,\x20%s',_0xe90e61,_0x2cfc3d[_0xfb32('0x1e')]['message']);return _0x59dd3c(_0x2cfc3d[_0xfb32('0x1e')][_0xfb32('0x1f')]);}else{logger['info'](_0xfb32('0x1a'),_0xe90e61,_0xfb32('0x1b'));_0x59dd3c(_0x2cfc3d['result'][_0xfb32('0x1f')]);}})[_0xfb32('0x20')](function(_0x4b235c){logger['error'](_0xfb32('0x1a'),_0xe90e61,_0x4b235c);_0x584fd5(_0x4b235c);});});}function respondWithStatusCode(_0x46934f,_0x104e71){_0x104e71=_0x104e71||0xcc;return function(_0x3ee69e){if(_0x3ee69e){return _0x46934f[_0xfb32('0x21')](_0x104e71);}return _0x46934f[_0xfb32('0x22')](_0x104e71)[_0xfb32('0x23')]();};}function respondWithResult(_0x4ffe40,_0x350999){_0x350999=_0x350999||0xc8;return function(_0x215c57){if(_0x215c57){return _0x4ffe40[_0xfb32('0x22')](_0x350999)[_0xfb32('0x24')](_0x215c57);}};}function respondWithFilteredResult(_0x2a01ee,_0x5a7efb){return function(_0x58c76c){if(_0x58c76c){var _0x34c494=typeof _0x5a7efb[_0xfb32('0x25')]==='undefined'&&typeof _0x5a7efb[_0xfb32('0x26')]===_0xfb32('0x27');var _0x174e40=_0x58c76c[_0xfb32('0x28')];var _0x3729fa=_0x34c494?0x0:_0x5a7efb[_0xfb32('0x25')];var _0x2a015d=_0x34c494?_0x58c76c['count']:_0x5a7efb['offset']+_0x5a7efb[_0xfb32('0x26')];var _0x14325c;if(_0x2a015d>=_0x174e40){_0x2a015d=_0x174e40;_0x14325c=0xc8;}else{_0x14325c=0xce;}_0x2a01ee[_0xfb32('0x22')](_0x14325c);return _0x2a01ee[_0xfb32('0x29')](_0xfb32('0x2a'),_0x3729fa+'-'+_0x2a015d+'/'+_0x174e40)[_0xfb32('0x24')](_0x58c76c);}return null;};}function patchUpdates(_0x6460f6){return function(_0x52b434){try{jsonpatch[_0xfb32('0x2b')](_0x52b434,_0x6460f6,!![]);}catch(_0x7a58ae){return BPromise[_0xfb32('0x2c')](_0x7a58ae);}return _0x52b434['save']();};}function saveUpdates(_0x2fd7fa,_0x1c322a){return function(_0x481ae6){if(_0x481ae6){return _0x481ae6[_0xfb32('0x2d')](_0x2fd7fa)[_0xfb32('0x2e')](function(_0x5c69f5){return _0x5c69f5;});}return null;};}function removeEntity(_0x94aa25,_0x55b5cd){return function(_0x188750){if(_0x188750){return _0x188750[_0xfb32('0x2f')]()[_0xfb32('0x2e')](function(){_0x94aa25[_0xfb32('0x22')](0xcc)[_0xfb32('0x23')]();});}};}function handleEntityNotFound(_0x18ff43,_0x3c2e1d){return function(_0x2adcbb){if(!_0x2adcbb){_0x18ff43[_0xfb32('0x21')](0x194);}return _0x2adcbb;};}function handleError(_0x5c765c,_0x91e3b5){_0x91e3b5=_0x91e3b5||0x1f4;return function(_0x3f9071){logger[_0xfb32('0x1e')](_0x3f9071[_0xfb32('0x30')]);if(_0x3f9071['name']){delete _0x3f9071[_0xfb32('0x31')];}_0x5c765c[_0xfb32('0x22')](_0x91e3b5)[_0xfb32('0x32')](_0x3f9071);};}exports[_0xfb32('0x33')]=function(_0xd24fd2,_0x2adc2a){var _0x593248={},_0x52bc41={},_0x1ce665={'count':0x0,'rows':[]};var _0x20046a=_['map'](db['Dynamics365Configuration'][_0xfb32('0x34')],function(_0x57958b){return{'name':_0x57958b[_0xfb32('0x35')],'type':_0x57958b[_0xfb32('0x36')][_0xfb32('0x37')]};});_0x52bc41[_0xfb32('0x38')]=_[_0xfb32('0x39')](_0x20046a,_0xfb32('0x31'));_0x52bc41[_0xfb32('0x3a')]=_['keys'](_0xd24fd2[_0xfb32('0x3a')]);_0x52bc41[_0xfb32('0x3b')]=_[_0xfb32('0x3c')](_0x52bc41['model'],_0x52bc41[_0xfb32('0x3a')]);_0x593248[_0xfb32('0x3d')]=_['intersection'](_0x52bc41[_0xfb32('0x38')],qs['fields'](_0xd24fd2[_0xfb32('0x3a')][_0xfb32('0x3e')]));_0x593248[_0xfb32('0x3d')]=_0x593248[_0xfb32('0x3d')][_0xfb32('0x3f')]?_0x593248[_0xfb32('0x3d')]:_0x52bc41['model'];if(!_0xd24fd2['query'][_0xfb32('0x40')](_0xfb32('0x41'))){_0x593248['limit']=qs[_0xfb32('0x26')](_0xd24fd2[_0xfb32('0x3a')][_0xfb32('0x26')]);_0x593248[_0xfb32('0x25')]=qs[_0xfb32('0x25')](_0xd24fd2['query'][_0xfb32('0x25')]);}_0x593248[_0xfb32('0x42')]=qs[_0xfb32('0x43')](_0xd24fd2[_0xfb32('0x3a')][_0xfb32('0x43')]);_0x593248[_0xfb32('0x44')]=qs[_0xfb32('0x3b')](_['pick'](_0xd24fd2[_0xfb32('0x3a')],_0x52bc41[_0xfb32('0x3b')]),_0x20046a);if(_0xd24fd2['query'][_0xfb32('0x45')]){_0x593248['where']=_['merge'](_0x593248[_0xfb32('0x44')],{'$or':_[_0xfb32('0x39')](_0x20046a,function(_0x44e5cf){if(_0x44e5cf[_0xfb32('0x36')]!==_0xfb32('0x46')){var _0x338ea3={};_0x338ea3[_0x44e5cf[_0xfb32('0x31')]]={'$like':'%'+_0xd24fd2['query'][_0xfb32('0x45')]+'%'};return _0x338ea3;}})});}_0x593248=_['merge']({},_0x593248,_0xd24fd2[_0xfb32('0x47')]);var _0x243028={'where':_0x593248[_0xfb32('0x44')]};return db[_0xfb32('0x48')][_0xfb32('0x28')](_0x243028)[_0xfb32('0x2e')](function(_0x42b4c8){_0x1ce665[_0xfb32('0x28')]=_0x42b4c8;if(_0xd24fd2[_0xfb32('0x3a')]['includeAll']){_0x593248[_0xfb32('0x49')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x593248);})[_0xfb32('0x2e')](function(_0x543ddc){_0x1ce665[_0xfb32('0x4a')]=_0x543ddc;return _0x1ce665;})[_0xfb32('0x2e')](respondWithFilteredResult(_0x2adc2a,_0x593248))[_0xfb32('0x20')](handleError(_0x2adc2a,null));};exports[_0xfb32('0x4b')]=function(_0x347919,_0x46dc0b){var _0x262756={'raw':![],'where':{'id':_0x347919[_0xfb32('0x4c')]['id']}},_0x4adaad={};_0x4adaad['model']=_[_0xfb32('0x4d')](db[_0xfb32('0x48')][_0xfb32('0x34')]);_0x4adaad[_0xfb32('0x3a')]=_['keys'](_0x347919[_0xfb32('0x3a')]);_0x4adaad['filters']=_[_0xfb32('0x3c')](_0x4adaad[_0xfb32('0x38')],_0x4adaad[_0xfb32('0x3a')]);_0x262756['attributes']=_[_0xfb32('0x3c')](_0x4adaad[_0xfb32('0x38')],qs[_0xfb32('0x3e')](_0x347919['query'][_0xfb32('0x3e')]));_0x262756[_0xfb32('0x3d')]=_0x262756[_0xfb32('0x3d')][_0xfb32('0x3f')]?_0x262756[_0xfb32('0x3d')]:_0x4adaad[_0xfb32('0x38')];if(_0x347919[_0xfb32('0x3a')][_0xfb32('0x4e')]){_0x262756[_0xfb32('0x49')]=[{'all':!![]}];}_0x262756=_[_0xfb32('0x4f')]({},_0x262756,_0x347919['options']);return db[_0xfb32('0x48')][_0xfb32('0x50')](_0x262756)[_0xfb32('0x2e')](handleEntityNotFound(_0x46dc0b,null))['then'](respondWithResult(_0x46dc0b,null))[_0xfb32('0x20')](handleError(_0x46dc0b,null));};exports[_0xfb32('0x51')]=function(_0x44c43f,_0x18f2ee){return db['Dynamics365Configuration']['create'](_0x44c43f[_0xfb32('0x52')],{})[_0xfb32('0x2e')](respondWithResult(_0x18f2ee,0xc9))[_0xfb32('0x20')](handleError(_0x18f2ee,null));};exports[_0xfb32('0x2d')]=function(_0x236cca,_0x42413f){if(_0x236cca[_0xfb32('0x52')]['id']){delete _0x236cca[_0xfb32('0x52')]['id'];}return db[_0xfb32('0x48')][_0xfb32('0x50')]({'where':{'id':_0x236cca[_0xfb32('0x4c')]['id']}})[_0xfb32('0x2e')](handleEntityNotFound(_0x42413f,null))[_0xfb32('0x2e')](saveUpdates(_0x236cca[_0xfb32('0x52')],null))[_0xfb32('0x2e')](respondWithResult(_0x42413f,null))[_0xfb32('0x20')](handleError(_0x42413f,null));};exports[_0xfb32('0x2f')]=function(_0x43aa4a,_0x5b8228){return db[_0xfb32('0x48')][_0xfb32('0x50')]({'where':{'id':_0x43aa4a[_0xfb32('0x4c')]['id']}})[_0xfb32('0x2e')](handleEntityNotFound(_0x5b8228,null))[_0xfb32('0x2e')](removeEntity(_0x5b8228,null))[_0xfb32('0x20')](handleError(_0x5b8228,null));};exports['getFields']=function(_0x330d5a,_0x4b5428,_0x51a9ac){var _0x31da5e={};var _0x69b2ff={};var _0x2e7fac;var _0x37ad11;return db[_0xfb32('0x48')]['findOne']({'where':{'id':_0x330d5a[_0xfb32('0x4c')]['id']}})[_0xfb32('0x2e')](handleEntityNotFound(_0x4b5428,null))[_0xfb32('0x2e')](function(_0x33d298){if(_0x33d298){_0x2e7fac=_0x33d298;_0x69b2ff[_0xfb32('0x38')]=_[_0xfb32('0x4d')](db[_0xfb32('0x53')][_0xfb32('0x34')]);_0x69b2ff[_0xfb32('0x3a')]=_[_0xfb32('0x4d')](_0x330d5a['query']);_0x69b2ff['filters']=_['intersection'](_0x69b2ff[_0xfb32('0x38')],_0x69b2ff[_0xfb32('0x3a')]);_0x31da5e[_0xfb32('0x3d')]=_[_0xfb32('0x3c')](_0x69b2ff[_0xfb32('0x38')],qs[_0xfb32('0x3e')](_0x330d5a[_0xfb32('0x3a')][_0xfb32('0x3e')]));_0x31da5e['attributes']=_0x31da5e[_0xfb32('0x3d')][_0xfb32('0x3f')]?_0x31da5e[_0xfb32('0x3d')]:_0x69b2ff[_0xfb32('0x38')];_0x31da5e[_0xfb32('0x42')]=qs['sort'](_0x330d5a[_0xfb32('0x3a')][_0xfb32('0x43')]);_0x31da5e[_0xfb32('0x44')]=qs[_0xfb32('0x3b')](_['pick'](_0x330d5a['query'],_0x69b2ff['filters']));if(_0x330d5a[_0xfb32('0x3a')]['filter']){_0x31da5e[_0xfb32('0x44')]=_['merge'](_0x31da5e['where'],{'$or':_[_0xfb32('0x39')](_0x31da5e[_0xfb32('0x3d')],function(_0x40a9a9){var _0x35d15e={};_0x35d15e[_0x40a9a9]={'$like':'%'+_0x330d5a[_0xfb32('0x3a')][_0xfb32('0x45')]+'%'};return _0x35d15e;})});}_0x31da5e=_['merge']({},_0x31da5e,_0x330d5a['options']);return _0x2e7fac['getFields'](_0x31da5e);}})[_0xfb32('0x2e')](function(_0xb9ed59){if(_0xb9ed59){_0x37ad11=_0xb9ed59[_0xfb32('0x3f')];if(!_0x330d5a['query'][_0xfb32('0x40')]('nolimit')){_0x31da5e[_0xfb32('0x26')]=qs[_0xfb32('0x26')](_0x330d5a['query']['limit']);_0x31da5e[_0xfb32('0x25')]=qs[_0xfb32('0x25')](_0x330d5a[_0xfb32('0x3a')][_0xfb32('0x25')]);}return _0x2e7fac[_0xfb32('0x54')](_0x31da5e);}})[_0xfb32('0x2e')](function(_0x46145c){if(_0x46145c){return _0x46145c?{'count':_0x37ad11,'rows':_0x46145c}:null;}})['then'](respondWithResult(_0x4b5428,null))[_0xfb32('0x20')](handleError(_0x4b5428,null));};exports[_0xfb32('0x55')]=function(_0x49d40d,_0xe9ac4a,_0x11ba52){var _0x4c07d1={};var _0xf72e60={};var _0x21f95e;var _0x5d58f5;return db[_0xfb32('0x48')][_0xfb32('0x56')]({'where':{'id':_0x49d40d['params']['id']}})[_0xfb32('0x2e')](handleEntityNotFound(_0xe9ac4a,null))[_0xfb32('0x2e')](function(_0x186239){if(_0x186239){_0x21f95e=_0x186239;_0xf72e60[_0xfb32('0x38')]=_[_0xfb32('0x4d')](db[_0xfb32('0x53')][_0xfb32('0x34')]);_0xf72e60[_0xfb32('0x3a')]=_['keys'](_0x49d40d['query']);_0xf72e60[_0xfb32('0x3b')]=_[_0xfb32('0x3c')](_0xf72e60[_0xfb32('0x38')],_0xf72e60['query']);_0x4c07d1[_0xfb32('0x3d')]=_[_0xfb32('0x3c')](_0xf72e60[_0xfb32('0x38')],qs[_0xfb32('0x3e')](_0x49d40d[_0xfb32('0x3a')][_0xfb32('0x3e')]));_0x4c07d1[_0xfb32('0x3d')]=_0x4c07d1[_0xfb32('0x3d')][_0xfb32('0x3f')]?_0x4c07d1[_0xfb32('0x3d')]:_0xf72e60['model'];_0x4c07d1['order']=qs[_0xfb32('0x43')](_0x49d40d[_0xfb32('0x3a')]['sort']);_0x4c07d1[_0xfb32('0x44')]=qs[_0xfb32('0x3b')](_[_0xfb32('0x57')](_0x49d40d[_0xfb32('0x3a')],_0xf72e60[_0xfb32('0x3b')]));if(_0x49d40d[_0xfb32('0x3a')]['filter']){_0x4c07d1[_0xfb32('0x44')]=_[_0xfb32('0x4f')](_0x4c07d1[_0xfb32('0x44')],{'$or':_[_0xfb32('0x39')](_0x4c07d1[_0xfb32('0x3d')],function(_0x11b47f){var _0xce4eb6={};_0xce4eb6[_0x11b47f]={'$like':'%'+_0x49d40d[_0xfb32('0x3a')]['filter']+'%'};return _0xce4eb6;})});}_0x4c07d1=_[_0xfb32('0x4f')]({},_0x4c07d1,_0x49d40d[_0xfb32('0x47')]);return _0x21f95e['getSubjects'](_0x4c07d1);}})[_0xfb32('0x2e')](function(_0x30751e){if(_0x30751e){_0x5d58f5=_0x30751e[_0xfb32('0x3f')];if(!_0x49d40d[_0xfb32('0x3a')][_0xfb32('0x40')](_0xfb32('0x41'))){_0x4c07d1[_0xfb32('0x26')]=qs[_0xfb32('0x26')](_0x49d40d[_0xfb32('0x3a')][_0xfb32('0x26')]);_0x4c07d1['offset']=qs['offset'](_0x49d40d[_0xfb32('0x3a')][_0xfb32('0x25')]);}return _0x21f95e[_0xfb32('0x55')](_0x4c07d1);}})[_0xfb32('0x2e')](function(_0x1b5450){if(_0x1b5450){return _0x1b5450?{'count':_0x5d58f5,'rows':_0x1b5450}:null;}})[_0xfb32('0x2e')](respondWithResult(_0xe9ac4a,null))[_0xfb32('0x20')](handleError(_0xe9ac4a,null));};exports[_0xfb32('0x58')]=function(_0x51e8b2,_0x4563ae,_0x1c5992){var _0x1fdc45={};var _0x3aa21d={};var _0x56e45d;var _0x33caf3;return db['Dynamics365Configuration'][_0xfb32('0x56')]({'where':{'id':_0x51e8b2[_0xfb32('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4563ae,null))['then'](function(_0x126acd){if(_0x126acd){_0x56e45d=_0x126acd;_0x3aa21d[_0xfb32('0x38')]=_[_0xfb32('0x4d')](db[_0xfb32('0x53')]['rawAttributes']);_0x3aa21d['query']=_[_0xfb32('0x4d')](_0x51e8b2[_0xfb32('0x3a')]);_0x3aa21d[_0xfb32('0x3b')]=_[_0xfb32('0x3c')](_0x3aa21d[_0xfb32('0x38')],_0x3aa21d['query']);_0x1fdc45[_0xfb32('0x3d')]=_[_0xfb32('0x3c')](_0x3aa21d[_0xfb32('0x38')],qs[_0xfb32('0x3e')](_0x51e8b2['query']['fields']));_0x1fdc45[_0xfb32('0x3d')]=_0x1fdc45['attributes']['length']?_0x1fdc45[_0xfb32('0x3d')]:_0x3aa21d[_0xfb32('0x38')];_0x1fdc45[_0xfb32('0x42')]=qs[_0xfb32('0x43')](_0x51e8b2['query'][_0xfb32('0x43')]);_0x1fdc45[_0xfb32('0x44')]=qs['filters'](_['pick'](_0x51e8b2[_0xfb32('0x3a')],_0x3aa21d[_0xfb32('0x3b')]));if(_0x51e8b2['query'][_0xfb32('0x45')]){_0x1fdc45[_0xfb32('0x44')]=_[_0xfb32('0x4f')](_0x1fdc45[_0xfb32('0x44')],{'$or':_[_0xfb32('0x39')](_0x1fdc45[_0xfb32('0x3d')],function(_0x2128a5){var _0x2dd17d={};_0x2dd17d[_0x2128a5]={'$like':'%'+_0x51e8b2[_0xfb32('0x3a')]['filter']+'%'};return _0x2dd17d;})});}_0x1fdc45=_[_0xfb32('0x4f')]({},_0x1fdc45,_0x51e8b2[_0xfb32('0x47')]);return _0x56e45d[_0xfb32('0x58')](_0x1fdc45);}})[_0xfb32('0x2e')](function(_0x170070){if(_0x170070){_0x33caf3=_0x170070['length'];if(!_0x51e8b2['query']['hasOwnProperty'](_0xfb32('0x41'))){_0x1fdc45[_0xfb32('0x26')]=qs[_0xfb32('0x26')](_0x51e8b2[_0xfb32('0x3a')]['limit']);_0x1fdc45[_0xfb32('0x25')]=qs[_0xfb32('0x25')](_0x51e8b2[_0xfb32('0x3a')][_0xfb32('0x25')]);}return _0x56e45d['getDescriptions'](_0x1fdc45);}})[_0xfb32('0x2e')](function(_0x125dbd){if(_0x125dbd){return _0x125dbd?{'count':_0x33caf3,'rows':_0x125dbd}:null;}})[_0xfb32('0x2e')](respondWithResult(_0x4563ae,null))[_0xfb32('0x20')](handleError(_0x4563ae,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 2d24576..e05c4c7 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 _0x8eca=['bluebird','request-promise','path','rimraf','Dynamics365Configuration','lodash','util','../../config/logger','moment'];(function(_0x53767b,_0x3aa30b){var _0x29f67b=function(_0xd1d3e8){while(--_0xd1d3e8){_0x53767b['push'](_0x53767b['shift']());}};_0x29f67b(++_0x3aa30b);}(_0x8eca,0x1e2));var _0xa8ec=function(_0x35cc8b,_0x201f50){_0x35cc8b=_0x35cc8b-0x0;var _0x486b80=_0x8eca[_0x35cc8b];return _0x486b80;};'use strict';var _=require(_0xa8ec('0x0'));var util=require(_0xa8ec('0x1'));var logger=require(_0xa8ec('0x2'))('api');var moment=require(_0xa8ec('0x3'));var BPromise=require(_0xa8ec('0x4'));var rp=require(_0xa8ec('0x5'));var fs=require('fs');var path=require(_0xa8ec('0x6'));var rimraf=require(_0xa8ec('0x7'));var config=require('../../config/environment');var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x5363ad,_0x278798){return _0x5363ad['define'](_0xa8ec('0x8'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacca=['api','moment','bluebird','request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','lodash','util','../../config/logger'];(function(_0x545eb3,_0x2d590c){var _0x24beed=function(_0x4fe828){while(--_0x4fe828){_0x545eb3['push'](_0x545eb3['shift']());}};_0x24beed(++_0x2d590c);}(_0xacca,0xed));var _0xaacc=function(_0x42b91d,_0x23b924){_0x42b91d=_0x42b91d-0x0;var _0x59fdae=_0xacca[_0x42b91d];return _0x59fdae;};'use strict';var _=require(_0xaacc('0x0'));var util=require(_0xaacc('0x1'));var logger=require(_0xaacc('0x2'))(_0xaacc('0x3'));var moment=require(_0xaacc('0x4'));var BPromise=require(_0xaacc('0x5'));var rp=require(_0xaacc('0x6'));var fs=require('fs');var path=require(_0xaacc('0x7'));var rimraf=require('rimraf');var config=require(_0xaacc('0x8'));var attributes=require(_0xaacc('0x9'));module[_0xaacc('0xa')]=function(_0x1fcbf2,_0x1faccb){return _0x1fcbf2['define'](_0xaacc('0xb'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 9b51db3..de58a52 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 _0x4281=['client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4140a6,_0x493bb2){var _0x202fee=function(_0x14a1e7){while(--_0x14a1e7){_0x4140a6['push'](_0x4140a6['shift']());}};_0x202fee(++_0x493bb2);}(_0x4281,0x1ea));var _0x1428=function(_0x42bb6d,_0x412255){_0x42bb6d=_0x42bb6d-0x0;var _0x1db89b=_0x4281[_0x42bb6d];return _0x1db89b;};'use strict';var _=require(_0x1428('0x0'));var util=require(_0x1428('0x1'));var moment=require(_0x1428('0x2'));var BPromise=require('bluebird');var rs=require(_0x1428('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1428('0x4'))['db'];var utils=require(_0x1428('0x5'));var logger=require(_0x1428('0x6'))(_0x1428('0x7'));var config=require(_0x1428('0x8'));var jayson=require(_0x1428('0x9'));var client=jayson[_0x1428('0xa')][_0x1428('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e2f28,_0x319d99,_0x76db9e){return new BPromise(function(_0x2ea752,_0x3502d0){return client[_0x1428('0xc')](_0x2e2f28,_0x76db9e)[_0x1428('0xd')](function(_0x3974c6){logger[_0x1428('0xe')](_0x1428('0xf'),_0x319d99,_0x1428('0x10'));logger[_0x1428('0x11')](_0x1428('0x12'),_0x319d99,_0x1428('0x10'),JSON[_0x1428('0x13')](_0x3974c6));if(_0x3974c6[_0x1428('0x14')]){if(_0x3974c6[_0x1428('0x14')][_0x1428('0x15')]===0x1f4){logger[_0x1428('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x319d99,_0x3974c6[_0x1428('0x14')][_0x1428('0x16')]);return _0x3502d0(_0x3974c6[_0x1428('0x14')][_0x1428('0x16')]);}logger[_0x1428('0x14')](_0x1428('0xf'),_0x319d99,_0x3974c6[_0x1428('0x14')][_0x1428('0x16')]);return _0x2ea752(_0x3974c6[_0x1428('0x14')][_0x1428('0x16')]);}else{logger[_0x1428('0xe')](_0x1428('0xf'),_0x319d99,'request\x20sent');_0x2ea752(_0x3974c6[_0x1428('0x17')][_0x1428('0x16')]);}})[_0x1428('0x18')](function(_0x329e9a){logger[_0x1428('0x14')](_0x1428('0xf'),_0x319d99,_0x329e9a);_0x3502d0(_0x329e9a);});});} \ No newline at end of file +var _0x9f3c=['error','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x2bda0a,_0x280e93){var _0x161bb0=function(_0x41ee00){while(--_0x41ee00){_0x2bda0a['push'](_0x2bda0a['shift']());}};_0x161bb0(++_0x280e93);}(_0x9f3c,0xc1));var _0xc9f3=function(_0x2cd2d5,_0x1b24bc){_0x2cd2d5=_0x2cd2d5-0x0;var _0x138207=_0x9f3c[_0x2cd2d5];return _0x138207;};'use strict';var _=require(_0xc9f3('0x0'));var util=require(_0xc9f3('0x1'));var moment=require(_0xc9f3('0x2'));var BPromise=require(_0xc9f3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9f3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc9f3('0x5'))('rpc');var config=require(_0xc9f3('0x6'));var jayson=require(_0xc9f3('0x7'));var client=jayson[_0xc9f3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34e9e2,_0x33ac02,_0x201cf2){return new BPromise(function(_0x4c6846,_0x6d4c32){return client[_0xc9f3('0x9')](_0x34e9e2,_0x201cf2)[_0xc9f3('0xa')](function(_0x48f15f){logger[_0xc9f3('0xb')](_0xc9f3('0xc'),_0x33ac02,'request\x20sent');logger[_0xc9f3('0xd')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x33ac02,_0xc9f3('0xe'),JSON[_0xc9f3('0xf')](_0x48f15f));if(_0x48f15f[_0xc9f3('0x10')]){if(_0x48f15f[_0xc9f3('0x10')]['code']===0x1f4){logger[_0xc9f3('0x10')](_0xc9f3('0xc'),_0x33ac02,_0x48f15f[_0xc9f3('0x10')][_0xc9f3('0x11')]);return _0x6d4c32(_0x48f15f[_0xc9f3('0x10')][_0xc9f3('0x11')]);}logger[_0xc9f3('0x10')](_0xc9f3('0xc'),_0x33ac02,_0x48f15f[_0xc9f3('0x10')][_0xc9f3('0x11')]);return _0x4c6846(_0x48f15f['error'][_0xc9f3('0x11')]);}else{logger['info'](_0xc9f3('0xc'),_0x33ac02,_0xc9f3('0xe'));_0x4c6846(_0x48f15f['result'][_0xc9f3('0x11')]);}})[_0xc9f3('0x12')](function(_0x20c59a){logger['error'](_0xc9f3('0xc'),_0x33ac02,_0x20c59a);_0x6d4c32(_0x20c59a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 3f3b493..2d88255 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 _0xc36d=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','put'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xc36d,0x7d));var _0xdc36=function(_0x39ff5c,_0x3de001){_0x39ff5c=_0x39ff5c-0x0;var _0x1eba54=_0xc36d[_0x39ff5c];return _0x1eba54;};'use strict';var multer=require(_0xdc36('0x0'));var util=require(_0xdc36('0x1'));var path=require(_0xdc36('0x2'));var timeout=require(_0xdc36('0x3'));var express=require(_0xdc36('0x4'));var router=express[_0xdc36('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdc36('0x6'));var interaction=require(_0xdc36('0x7'));var config=require('../../config/environment');var controller=require(_0xdc36('0x8'));router[_0xdc36('0x9')]('/',auth[_0xdc36('0xa')](),controller[_0xdc36('0xb')]);router[_0xdc36('0x9')]('/:id',auth[_0xdc36('0xa')](),controller[_0xdc36('0xc')]);router[_0xdc36('0xd')]('/',auth[_0xdc36('0xa')](),controller['create']);router[_0xdc36('0xe')](_0xdc36('0xf'),auth['isAuthenticated'](),controller[_0xdc36('0x10')]);router[_0xdc36('0x11')](_0xdc36('0xf'),auth['isAuthenticated'](),controller[_0xdc36('0x12')]);module[_0xdc36('0x13')]=router; \ No newline at end of file +var _0x159b=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post'];(function(_0x2677d7,_0x53fb6b){var _0x4d4017=function(_0x12621b){while(--_0x12621b){_0x2677d7['push'](_0x2677d7['shift']());}};_0x4d4017(++_0x53fb6b);}(_0x159b,0x181));var _0xb159=function(_0x434af7,_0x1b0154){_0x434af7=_0x434af7-0x0;var _0x42035f=_0x159b[_0x434af7];return _0x42035f;};'use strict';var multer=require(_0xb159('0x0'));var util=require(_0xb159('0x1'));var path=require(_0xb159('0x2'));var timeout=require(_0xb159('0x3'));var express=require(_0xb159('0x4'));var router=express[_0xb159('0x5')]();var fs_extra=require(_0xb159('0x6'));var auth=require(_0xb159('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb159('0x8'));var controller=require(_0xb159('0x9'));router[_0xb159('0xa')]('/',auth[_0xb159('0xb')](),controller['index']);router[_0xb159('0xa')](_0xb159('0xc'),auth[_0xb159('0xb')](),controller[_0xb159('0xd')]);router[_0xb159('0xe')]('/',auth[_0xb159('0xb')](),controller[_0xb159('0xf')]);router[_0xb159('0x10')](_0xb159('0xc'),auth[_0xb159('0xb')](),controller[_0xb159('0x11')]);router[_0xb159('0x12')](_0xb159('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xb159('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index fed8627..5e4046a 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 _0xfdbd=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x2486a4,_0x3e3650){var _0x14cf68=function(_0x1b6f40){while(--_0x1b6f40){_0x2486a4['push'](_0x2486a4['shift']());}};_0x14cf68(++_0x3e3650);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x456af7,_0x3d36d3){_0x456af7=_0x456af7-0x0;var _0x3818f7=_0xfdbd[_0x456af7];return _0x3818f7;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'type':{'type':Sequelize[_0xdfdb('0x2')](_0xdfdb('0x3'),_0xdfdb('0x4'),_0xdfdb('0x5'),_0xdfdb('0x6'),_0xdfdb('0x7')),'defaultValue':_0xdfdb('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdfdb('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xdfdb('0x3'),_0xdfdb('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdfdb('0x8')]},'customField':{'type':Sequelize[_0xdfdb('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8ef6=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x8ef6,0xf2));var _0x68ef=function(_0x15e1fd,_0x17d7f4){_0x15e1fd=_0x15e1fd-0x0;var _0xb808ae=_0x8ef6[_0x15e1fd];return _0xb808ae;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'type':{'type':Sequelize[_0x68ef('0x2')](_0x68ef('0x3'),_0x68ef('0x4'),_0x68ef('0x5'),_0x68ef('0x6'),'picklist'),'defaultValue':_0x68ef('0x3')},'content':{'type':Sequelize[_0x68ef('0x7')]},'key':{'type':Sequelize[_0x68ef('0x7')]},'keyType':{'type':Sequelize[_0x68ef('0x2')]('string','variable',_0x68ef('0x5'))},'keyContent':{'type':Sequelize[_0x68ef('0x7')]},'idField':{'type':Sequelize[_0x68ef('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x68ef('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x68ef('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index ad9f362..5196a84 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 _0x7226=['type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','merge','options','includeAll','include','catch','show','params','length','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','Dynamics365Field','rawAttributes'];(function(_0x2862e8,_0x598048){var _0xd59bc6=function(_0x198276){while(--_0x198276){_0x2862e8['push'](_0x2862e8['shift']());}};_0xd59bc6(++_0x598048);}(_0x7226,0x139));var _0x6722=function(_0x49c7f9,_0x41d6b7){_0x49c7f9=_0x49c7f9-0x0;var _0x274e0f=_0x7226[_0x49c7f9];return _0x274e0f;};'use strict';var emlformat=require(_0x6722('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6722('0x1'));var jsonpatch=require(_0x6722('0x2'));var rp=require(_0x6722('0x3'));var moment=require(_0x6722('0x4'));var BPromise=require(_0x6722('0x5'));var Mustache=require(_0x6722('0x6'));var util=require(_0x6722('0x7'));var path=require(_0x6722('0x8'));var sox=require('sox');var csv=require(_0x6722('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6722('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6722('0x9'));var querystring=require(_0x6722('0xb'));var Papa=require(_0x6722('0xc'));var Redis=require('ioredis');var authService=require(_0x6722('0xd'));var qs=require(_0x6722('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6722('0xf'));var logger=require(_0x6722('0x10'))(_0x6722('0x11'));var utils=require(_0x6722('0x12'));var config=require(_0x6722('0x13'));var licenseUtil=require(_0x6722('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e24d4,_0x48f1d2){_0x48f1d2=_0x48f1d2||0xcc;return function(_0x48e05a){if(_0x48e05a){return _0x2e24d4[_0x6722('0x15')](_0x48f1d2);}return _0x2e24d4[_0x6722('0x16')](_0x48f1d2)[_0x6722('0x17')]();};}function respondWithResult(_0x30c1f4,_0x1fa880){_0x1fa880=_0x1fa880||0xc8;return function(_0x946bb0){if(_0x946bb0){return _0x30c1f4[_0x6722('0x16')](_0x1fa880)[_0x6722('0x18')](_0x946bb0);}};}function respondWithFilteredResult(_0x279a6d,_0x1747a5){return function(_0x253c42){if(_0x253c42){var _0x4a5d9d=typeof _0x1747a5[_0x6722('0x19')]===_0x6722('0x1a')&&typeof _0x1747a5[_0x6722('0x1b')]==='undefined';var _0x55ddc0=_0x253c42[_0x6722('0x1c')];var _0x383e4a=_0x4a5d9d?0x0:_0x1747a5[_0x6722('0x19')];var _0x3dfcd7=_0x4a5d9d?_0x253c42['count']:_0x1747a5[_0x6722('0x19')]+_0x1747a5[_0x6722('0x1b')];var _0x3ff277;if(_0x3dfcd7>=_0x55ddc0){_0x3dfcd7=_0x55ddc0;_0x3ff277=0xc8;}else{_0x3ff277=0xce;}_0x279a6d[_0x6722('0x16')](_0x3ff277);return _0x279a6d[_0x6722('0x1d')]('Content-Range',_0x383e4a+'-'+_0x3dfcd7+'/'+_0x55ddc0)[_0x6722('0x18')](_0x253c42);}return null;};}function patchUpdates(_0x4b5510){return function(_0x391a84){try{jsonpatch[_0x6722('0x1e')](_0x391a84,_0x4b5510,!![]);}catch(_0x2e0f8c){return BPromise[_0x6722('0x1f')](_0x2e0f8c);}return _0x391a84[_0x6722('0x20')]();};}function saveUpdates(_0x2204d5,_0x2c0335){return function(_0x40ef9f){if(_0x40ef9f){return _0x40ef9f['update'](_0x2204d5)[_0x6722('0x21')](function(_0x310566){return _0x310566;});}return null;};}function removeEntity(_0x3659fb,_0x1bc528){return function(_0x354813){if(_0x354813){return _0x354813[_0x6722('0x22')]()['then'](function(){_0x3659fb[_0x6722('0x16')](0xcc)[_0x6722('0x17')]();});}};}function handleEntityNotFound(_0x4388b0,_0x19edf2){return function(_0x4bf340){if(!_0x4bf340){_0x4388b0[_0x6722('0x15')](0x194);}return _0x4bf340;};}function handleError(_0x54be09,_0x5a648d){_0x5a648d=_0x5a648d||0x1f4;return function(_0xabbe95){logger[_0x6722('0x23')](_0xabbe95[_0x6722('0x24')]);if(_0xabbe95[_0x6722('0x25')]){delete _0xabbe95[_0x6722('0x25')];}_0x54be09['status'](_0x5a648d)[_0x6722('0x26')](_0xabbe95);};}exports[_0x6722('0x27')]=function(_0x500cb2,_0x4df5bc){var _0xa5e583={},_0x3fd959={},_0x573ccd={'count':0x0,'rows':[]};var _0x3b53be=_['map'](db[_0x6722('0x28')][_0x6722('0x29')],function(_0x1805d1){return{'name':_0x1805d1['fieldName'],'type':_0x1805d1[_0x6722('0x2a')][_0x6722('0x2b')]};});_0x3fd959[_0x6722('0x2c')]=_['map'](_0x3b53be,_0x6722('0x25'));_0x3fd959[_0x6722('0x2d')]=_[_0x6722('0x2e')](_0x500cb2['query']);_0x3fd959[_0x6722('0x2f')]=_[_0x6722('0x30')](_0x3fd959[_0x6722('0x2c')],_0x3fd959[_0x6722('0x2d')]);_0xa5e583[_0x6722('0x31')]=_['intersection'](_0x3fd959[_0x6722('0x2c')],qs[_0x6722('0x32')](_0x500cb2[_0x6722('0x2d')][_0x6722('0x32')]));_0xa5e583[_0x6722('0x31')]=_0xa5e583['attributes']['length']?_0xa5e583[_0x6722('0x31')]:_0x3fd959[_0x6722('0x2c')];if(!_0x500cb2['query'][_0x6722('0x33')](_0x6722('0x34'))){_0xa5e583[_0x6722('0x1b')]=qs[_0x6722('0x1b')](_0x500cb2[_0x6722('0x2d')][_0x6722('0x1b')]);_0xa5e583[_0x6722('0x19')]=qs['offset'](_0x500cb2[_0x6722('0x2d')][_0x6722('0x19')]);}_0xa5e583[_0x6722('0x35')]=qs[_0x6722('0x36')](_0x500cb2[_0x6722('0x2d')][_0x6722('0x36')]);_0xa5e583['where']=qs[_0x6722('0x2f')](_[_0x6722('0x37')](_0x500cb2[_0x6722('0x2d')],_0x3fd959[_0x6722('0x2f')]),_0x3b53be);if(_0x500cb2[_0x6722('0x2d')][_0x6722('0x38')]){_0xa5e583[_0x6722('0x39')]=_['merge'](_0xa5e583['where'],{'$or':_[_0x6722('0x3a')](_0x3b53be,function(_0x361b63){if(_0x361b63[_0x6722('0x2a')]!=='VIRTUAL'){var _0x2d889a={};_0x2d889a[_0x361b63['name']]={'$like':'%'+_0x500cb2[_0x6722('0x2d')][_0x6722('0x38')]+'%'};return _0x2d889a;}})});}_0xa5e583=_[_0x6722('0x3b')]({},_0xa5e583,_0x500cb2[_0x6722('0x3c')]);var _0x2756ce={'where':_0xa5e583[_0x6722('0x39')]};return db[_0x6722('0x28')][_0x6722('0x1c')](_0x2756ce)[_0x6722('0x21')](function(_0x833a39){_0x573ccd[_0x6722('0x1c')]=_0x833a39;if(_0x500cb2[_0x6722('0x2d')][_0x6722('0x3d')]){_0xa5e583[_0x6722('0x3e')]=[{'all':!![]}];}return db[_0x6722('0x28')]['findAll'](_0xa5e583);})[_0x6722('0x21')](function(_0x53e14b){_0x573ccd['rows']=_0x53e14b;return _0x573ccd;})[_0x6722('0x21')](respondWithFilteredResult(_0x4df5bc,_0xa5e583))[_0x6722('0x3f')](handleError(_0x4df5bc,null));};exports[_0x6722('0x40')]=function(_0x1f8b6c,_0x41a9cd){var _0x3fc613={'raw':!![],'where':{'id':_0x1f8b6c[_0x6722('0x41')]['id']}},_0x5b17da={};_0x5b17da['model']=_[_0x6722('0x2e')](db[_0x6722('0x28')][_0x6722('0x29')]);_0x5b17da['query']=_[_0x6722('0x2e')](_0x1f8b6c[_0x6722('0x2d')]);_0x5b17da['filters']=_[_0x6722('0x30')](_0x5b17da[_0x6722('0x2c')],_0x5b17da[_0x6722('0x2d')]);_0x3fc613[_0x6722('0x31')]=_[_0x6722('0x30')](_0x5b17da[_0x6722('0x2c')],qs['fields'](_0x1f8b6c[_0x6722('0x2d')][_0x6722('0x32')]));_0x3fc613[_0x6722('0x31')]=_0x3fc613[_0x6722('0x31')][_0x6722('0x42')]?_0x3fc613[_0x6722('0x31')]:_0x5b17da[_0x6722('0x2c')];if(_0x1f8b6c[_0x6722('0x2d')][_0x6722('0x3d')]){_0x3fc613[_0x6722('0x3e')]=[{'all':!![]}];}_0x3fc613=_['merge']({},_0x3fc613,_0x1f8b6c[_0x6722('0x3c')]);return db[_0x6722('0x28')][_0x6722('0x43')](_0x3fc613)[_0x6722('0x21')](handleEntityNotFound(_0x41a9cd,null))[_0x6722('0x21')](respondWithResult(_0x41a9cd,null))[_0x6722('0x3f')](handleError(_0x41a9cd,null));};exports[_0x6722('0x44')]=function(_0x2f5c16,_0x77aeab){return db[_0x6722('0x28')][_0x6722('0x44')](_0x2f5c16[_0x6722('0x45')],{})['then'](respondWithResult(_0x77aeab,0xc9))[_0x6722('0x3f')](handleError(_0x77aeab,null));};exports[_0x6722('0x46')]=function(_0x922bdc,_0xdf835d){if(_0x922bdc[_0x6722('0x45')]['id']){delete _0x922bdc[_0x6722('0x45')]['id'];}return db[_0x6722('0x28')][_0x6722('0x43')]({'where':{'id':_0x922bdc['params']['id']}})[_0x6722('0x21')](handleEntityNotFound(_0xdf835d,null))['then'](saveUpdates(_0x922bdc['body'],null))[_0x6722('0x21')](respondWithResult(_0xdf835d,null))['catch'](handleError(_0xdf835d,null));};exports[_0x6722('0x22')]=function(_0x41a553,_0x2609e7){return db['Dynamics365Field']['find']({'where':{'id':_0x41a553[_0x6722('0x41')]['id']}})['then'](handleEntityNotFound(_0x2609e7,null))[_0x6722('0x21')](removeEntity(_0x2609e7,null))[_0x6722('0x3f')](handleError(_0x2609e7,null));}; \ No newline at end of file +var _0x2f1e=['util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','Dynamics365Field','findAll','show','catch','create','body','update','params','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x31c218,_0x5209c3){var _0x4b6c8a=function(_0x150fc9){while(--_0x150fc9){_0x31c218['push'](_0x31c218['shift']());}};_0x4b6c8a(++_0x5209c3);}(_0x2f1e,0x1c7));var _0xe2f1=function(_0x32eb8b,_0x5ac0b5){_0x32eb8b=_0x32eb8b-0x0;var _0x5bc68b=_0x2f1e[_0x32eb8b];return _0x5bc68b;};'use strict';var emlformat=require(_0xe2f1('0x0'));var rimraf=require(_0xe2f1('0x1'));var zipdir=require(_0xe2f1('0x2'));var jsonpatch=require(_0xe2f1('0x3'));var rp=require(_0xe2f1('0x4'));var moment=require(_0xe2f1('0x5'));var BPromise=require(_0xe2f1('0x6'));var Mustache=require('mustache');var util=require(_0xe2f1('0x7'));var path=require('path');var sox=require(_0xe2f1('0x8'));var csv=require(_0xe2f1('0x9'));var ejs=require(_0xe2f1('0xa'));var fs=require('fs');var fs_extra=require(_0xe2f1('0xb'));var _=require('lodash');var squel=require(_0xe2f1('0xc'));var crypto=require(_0xe2f1('0xd'));var jsforce=require(_0xe2f1('0xe'));var deskjs=require(_0xe2f1('0xf'));var toCsv=require(_0xe2f1('0x9'));var querystring=require('querystring');var Papa=require(_0xe2f1('0x10'));var Redis=require(_0xe2f1('0x11'));var authService=require(_0xe2f1('0x12'));var qs=require(_0xe2f1('0x13'));var as=require(_0xe2f1('0x14'));var hardwareService=require(_0xe2f1('0x15'));var logger=require(_0xe2f1('0x16'))(_0xe2f1('0x17'));var utils=require(_0xe2f1('0x18'));var config=require(_0xe2f1('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe2f1('0x1a'))['db'];function respondWithStatusCode(_0xd482c4,_0x3b12f8){_0x3b12f8=_0x3b12f8||0xcc;return function(_0x207616){if(_0x207616){return _0xd482c4[_0xe2f1('0x1b')](_0x3b12f8);}return _0xd482c4[_0xe2f1('0x1c')](_0x3b12f8)[_0xe2f1('0x1d')]();};}function respondWithResult(_0x54cefd,_0x4ad4cd){_0x4ad4cd=_0x4ad4cd||0xc8;return function(_0x5362de){if(_0x5362de){return _0x54cefd[_0xe2f1('0x1c')](_0x4ad4cd)['json'](_0x5362de);}};}function respondWithFilteredResult(_0x13ca8b,_0x5c7d17){return function(_0x3eb2c1){if(_0x3eb2c1){var _0xca0272=typeof _0x5c7d17[_0xe2f1('0x1e')]===_0xe2f1('0x1f')&&typeof _0x5c7d17[_0xe2f1('0x20')]==='undefined';var _0x3f0428=_0x3eb2c1[_0xe2f1('0x21')];var _0x5b70a7=_0xca0272?0x0:_0x5c7d17[_0xe2f1('0x1e')];var _0x1a1957=_0xca0272?_0x3eb2c1[_0xe2f1('0x21')]:_0x5c7d17[_0xe2f1('0x1e')]+_0x5c7d17[_0xe2f1('0x20')];var _0x3ca349;if(_0x1a1957>=_0x3f0428){_0x1a1957=_0x3f0428;_0x3ca349=0xc8;}else{_0x3ca349=0xce;}_0x13ca8b[_0xe2f1('0x1c')](_0x3ca349);return _0x13ca8b[_0xe2f1('0x22')](_0xe2f1('0x23'),_0x5b70a7+'-'+_0x1a1957+'/'+_0x3f0428)['json'](_0x3eb2c1);}return null;};}function patchUpdates(_0xe9eeb7){return function(_0x120b1b){try{jsonpatch[_0xe2f1('0x24')](_0x120b1b,_0xe9eeb7,!![]);}catch(_0x4a0b3a){return BPromise[_0xe2f1('0x25')](_0x4a0b3a);}return _0x120b1b[_0xe2f1('0x26')]();};}function saveUpdates(_0x5299f9,_0x5fb9b8){return function(_0x1c2c3f){if(_0x1c2c3f){return _0x1c2c3f['update'](_0x5299f9)[_0xe2f1('0x27')](function(_0x111522){return _0x111522;});}return null;};}function removeEntity(_0xd1b0fe,_0x34480b){return function(_0xc6c998){if(_0xc6c998){return _0xc6c998[_0xe2f1('0x28')]()[_0xe2f1('0x27')](function(){_0xd1b0fe['status'](0xcc)[_0xe2f1('0x1d')]();});}};}function handleEntityNotFound(_0x221c60,_0x3f6ec9){return function(_0x5c91fc){if(!_0x5c91fc){_0x221c60[_0xe2f1('0x1b')](0x194);}return _0x5c91fc;};}function handleError(_0xeef8d2,_0x2ed8c2){_0x2ed8c2=_0x2ed8c2||0x1f4;return function(_0x45825d){logger['error'](_0x45825d[_0xe2f1('0x29')]);if(_0x45825d['name']){delete _0x45825d[_0xe2f1('0x2a')];}_0xeef8d2[_0xe2f1('0x1c')](_0x2ed8c2)[_0xe2f1('0x2b')](_0x45825d);};}exports[_0xe2f1('0x2c')]=function(_0xde3c4d,_0x3afa53){var _0x442827={},_0x4761d5={},_0x4d38d6={'count':0x0,'rows':[]};var _0xf9f453=_[_0xe2f1('0x2d')](db['Dynamics365Field'][_0xe2f1('0x2e')],function(_0x40e796){return{'name':_0x40e796[_0xe2f1('0x2f')],'type':_0x40e796[_0xe2f1('0x30')][_0xe2f1('0x31')]};});_0x4761d5[_0xe2f1('0x32')]=_[_0xe2f1('0x2d')](_0xf9f453,_0xe2f1('0x2a'));_0x4761d5['query']=_[_0xe2f1('0x33')](_0xde3c4d[_0xe2f1('0x34')]);_0x4761d5[_0xe2f1('0x35')]=_['intersection'](_0x4761d5[_0xe2f1('0x32')],_0x4761d5['query']);_0x442827['attributes']=_[_0xe2f1('0x36')](_0x4761d5[_0xe2f1('0x32')],qs['fields'](_0xde3c4d['query'][_0xe2f1('0x37')]));_0x442827['attributes']=_0x442827[_0xe2f1('0x38')][_0xe2f1('0x39')]?_0x442827[_0xe2f1('0x38')]:_0x4761d5[_0xe2f1('0x32')];if(!_0xde3c4d[_0xe2f1('0x34')][_0xe2f1('0x3a')]('nolimit')){_0x442827[_0xe2f1('0x20')]=qs[_0xe2f1('0x20')](_0xde3c4d['query'][_0xe2f1('0x20')]);_0x442827['offset']=qs['offset'](_0xde3c4d[_0xe2f1('0x34')][_0xe2f1('0x1e')]);}_0x442827[_0xe2f1('0x3b')]=qs['sort'](_0xde3c4d['query'][_0xe2f1('0x3c')]);_0x442827[_0xe2f1('0x3d')]=qs[_0xe2f1('0x35')](_[_0xe2f1('0x3e')](_0xde3c4d['query'],_0x4761d5[_0xe2f1('0x35')]),_0xf9f453);if(_0xde3c4d[_0xe2f1('0x34')][_0xe2f1('0x3f')]){_0x442827[_0xe2f1('0x3d')]=_[_0xe2f1('0x40')](_0x442827[_0xe2f1('0x3d')],{'$or':_[_0xe2f1('0x2d')](_0xf9f453,function(_0x3316ff){if(_0x3316ff[_0xe2f1('0x30')]!=='VIRTUAL'){var _0x48934f={};_0x48934f[_0x3316ff[_0xe2f1('0x2a')]]={'$like':'%'+_0xde3c4d[_0xe2f1('0x34')][_0xe2f1('0x3f')]+'%'};return _0x48934f;}})});}_0x442827=_[_0xe2f1('0x40')]({},_0x442827,_0xde3c4d[_0xe2f1('0x41')]);var _0x5e8bfa={'where':_0x442827[_0xe2f1('0x3d')]};return db['Dynamics365Field'][_0xe2f1('0x21')](_0x5e8bfa)[_0xe2f1('0x27')](function(_0x4f1a8d){_0x4d38d6['count']=_0x4f1a8d;if(_0xde3c4d[_0xe2f1('0x34')][_0xe2f1('0x42')]){_0x442827[_0xe2f1('0x43')]=[{'all':!![]}];}return db[_0xe2f1('0x44')][_0xe2f1('0x45')](_0x442827);})[_0xe2f1('0x27')](function(_0x264c82){_0x4d38d6['rows']=_0x264c82;return _0x4d38d6;})[_0xe2f1('0x27')](respondWithFilteredResult(_0x3afa53,_0x442827))['catch'](handleError(_0x3afa53,null));};exports[_0xe2f1('0x46')]=function(_0x40754f,_0x4ac647){var _0x1a20d8={'raw':!![],'where':{'id':_0x40754f['params']['id']}},_0x3cd962={};_0x3cd962[_0xe2f1('0x32')]=_['keys'](db[_0xe2f1('0x44')][_0xe2f1('0x2e')]);_0x3cd962['query']=_[_0xe2f1('0x33')](_0x40754f[_0xe2f1('0x34')]);_0x3cd962[_0xe2f1('0x35')]=_[_0xe2f1('0x36')](_0x3cd962[_0xe2f1('0x32')],_0x3cd962[_0xe2f1('0x34')]);_0x1a20d8[_0xe2f1('0x38')]=_['intersection'](_0x3cd962['model'],qs[_0xe2f1('0x37')](_0x40754f['query']['fields']));_0x1a20d8['attributes']=_0x1a20d8['attributes'][_0xe2f1('0x39')]?_0x1a20d8[_0xe2f1('0x38')]:_0x3cd962[_0xe2f1('0x32')];if(_0x40754f[_0xe2f1('0x34')][_0xe2f1('0x42')]){_0x1a20d8[_0xe2f1('0x43')]=[{'all':!![]}];}_0x1a20d8=_[_0xe2f1('0x40')]({},_0x1a20d8,_0x40754f[_0xe2f1('0x41')]);return db['Dynamics365Field']['find'](_0x1a20d8)[_0xe2f1('0x27')](handleEntityNotFound(_0x4ac647,null))[_0xe2f1('0x27')](respondWithResult(_0x4ac647,null))[_0xe2f1('0x47')](handleError(_0x4ac647,null));};exports[_0xe2f1('0x48')]=function(_0x11e537,_0x12b16e){return db['Dynamics365Field'][_0xe2f1('0x48')](_0x11e537[_0xe2f1('0x49')],{})[_0xe2f1('0x27')](respondWithResult(_0x12b16e,0xc9))[_0xe2f1('0x47')](handleError(_0x12b16e,null));};exports[_0xe2f1('0x4a')]=function(_0x3336c4,_0x4ee1ae){if(_0x3336c4[_0xe2f1('0x49')]['id']){delete _0x3336c4[_0xe2f1('0x49')]['id'];}return db[_0xe2f1('0x44')]['find']({'where':{'id':_0x3336c4[_0xe2f1('0x4b')]['id']}})[_0xe2f1('0x27')](handleEntityNotFound(_0x4ee1ae,null))['then'](saveUpdates(_0x3336c4['body'],null))[_0xe2f1('0x27')](respondWithResult(_0x4ee1ae,null))[_0xe2f1('0x47')](handleError(_0x4ee1ae,null));};exports[_0xe2f1('0x28')]=function(_0x499419,_0x591404){return db[_0xe2f1('0x44')][_0xe2f1('0x4c')]({'where':{'id':_0x499419['params']['id']}})['then'](handleEntityNotFound(_0x591404,null))['then'](removeEntity(_0x591404,null))[_0xe2f1('0x47')](handleError(_0x591404,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 4a9964b..c63573c 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 _0x447f=['idField','FieldId','util','../../config/logger','api','moment','rimraf','../../config/environment','./intDynamics365Field.attributes','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index'];(function(_0x2b6482,_0x95e8a8){var _0x53e68f=function(_0x544be1){while(--_0x544be1){_0x2b6482['push'](_0x2b6482['shift']());}};_0x53e68f(++_0x95e8a8);}(_0x447f,0x86));var _0xf447=function(_0x3977c7,_0xefafd5){_0x3977c7=_0x3977c7-0x0;var _0xa85846=_0x447f[_0x3977c7];return _0xa85846;};'use strict';var _=require('lodash');var util=require(_0xf447('0x0'));var logger=require(_0xf447('0x1'))(_0xf447('0x2'));var moment=require(_0xf447('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf447('0x4'));var config=require(_0xf447('0x5'));var attributes=require(_0xf447('0x6'));module['exports']=function(_0x301cd3,_0x13bc06){return _0x301cd3['define'](_0xf447('0x7'),attributes,{'tableName':_0xf447('0x8'),'paranoid':![],'indexes':[{'name':_0xf447('0x9'),'fields':[_0xf447('0xa'),_0xf447('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b24=['int_dynamics365_fields','idField','FieldId','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field'];(function(_0x4216ba,_0x5739c5){var _0x2592ca=function(_0x58ecea){while(--_0x58ecea){_0x4216ba['push'](_0x4216ba['shift']());}};_0x2592ca(++_0x5739c5);}(_0x4b24,0x12e));var _0x44b2=function(_0x5262f6,_0x28ae52){_0x5262f6=_0x5262f6-0x0;var _0x1aebe2=_0x4b24[_0x5262f6];return _0x1aebe2;};'use strict';var _=require('lodash');var util=require(_0x44b2('0x0'));var logger=require(_0x44b2('0x1'))('api');var moment=require(_0x44b2('0x2'));var BPromise=require(_0x44b2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b2('0x4'));var rimraf=require(_0x44b2('0x5'));var config=require(_0x44b2('0x6'));var attributes=require(_0x44b2('0x7'));module['exports']=function(_0x2e1c3f,_0x1462c7){return _0x2e1c3f[_0x44b2('0x8')](_0x44b2('0x9'),attributes,{'tableName':_0x44b2('0xa'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x44b2('0xb'),_0x44b2('0xc')],'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 aac8e1e..4a18fc8 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 _0x61f1=['jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x146651,_0x408b69){var _0x23ba58=function(_0x4b2bb3){while(--_0x4b2bb3){_0x146651['push'](_0x146651['shift']());}};_0x23ba58(++_0x408b69);}(_0x61f1,0x18a));var _0x161f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x61f1[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x161f('0x0'));var moment=require('moment');var BPromise=require(_0x161f('0x1'));var rs=require(_0x161f('0x2'));var fs=require('fs');var Redis=require(_0x161f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x161f('0x4'))(_0x161f('0x5'));var config=require('../../config/environment');var jayson=require(_0x161f('0x6'));var client=jayson[_0x161f('0x7')][_0x161f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf8174c,_0xd1ad5d,_0x4ff5e1){return new BPromise(function(_0x910af4,_0x31f44e){return client[_0x161f('0x9')](_0xf8174c,_0x4ff5e1)[_0x161f('0xa')](function(_0x24bc8a){logger[_0x161f('0xb')](_0x161f('0xc'),_0xd1ad5d,_0x161f('0xd'));logger[_0x161f('0xe')](_0x161f('0xf'),_0xd1ad5d,_0x161f('0xd'),JSON['stringify'](_0x24bc8a));if(_0x24bc8a[_0x161f('0x10')]){if(_0x24bc8a[_0x161f('0x10')][_0x161f('0x11')]===0x1f4){logger[_0x161f('0x10')](_0x161f('0xc'),_0xd1ad5d,_0x24bc8a['error'][_0x161f('0x12')]);return _0x31f44e(_0x24bc8a[_0x161f('0x10')][_0x161f('0x12')]);}logger[_0x161f('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0xd1ad5d,_0x24bc8a[_0x161f('0x10')][_0x161f('0x12')]);return _0x910af4(_0x24bc8a[_0x161f('0x10')][_0x161f('0x12')]);}else{logger[_0x161f('0xb')](_0x161f('0xc'),_0xd1ad5d,'request\x20sent');_0x910af4(_0x24bc8a['result'][_0x161f('0x12')]);}})[_0x161f('0x13')](function(_0x189a95){logger['error'](_0x161f('0xc'),_0xd1ad5d,_0x189a95);_0x31f44e(_0x189a95);});});} \ No newline at end of file +var _0x2581=['request','then','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','Dynamics365Field,\x20%s,\x20%s','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3f7dad,_0x32d464){var _0x862fc7=function(_0x4d76a2){while(--_0x4d76a2){_0x3f7dad['push'](_0x3f7dad['shift']());}};_0x862fc7(++_0x32d464);}(_0x2581,0xcb));var _0x1258=function(_0x1c26de,_0x5c69a3){_0x1c26de=_0x1c26de-0x0;var _0x33c1dd=_0x2581[_0x1c26de];return _0x33c1dd;};'use strict';var _=require(_0x1258('0x0'));var util=require(_0x1258('0x1'));var moment=require(_0x1258('0x2'));var BPromise=require(_0x1258('0x3'));var rs=require(_0x1258('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1258('0x5'))['db'];var utils=require(_0x1258('0x6'));var logger=require(_0x1258('0x7'))(_0x1258('0x8'));var config=require(_0x1258('0x9'));var jayson=require(_0x1258('0xa'));var client=jayson[_0x1258('0xb')][_0x1258('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x582ed7,_0x3e1044,_0x21cd98){return new BPromise(function(_0x468494,_0x18bbac){return client[_0x1258('0xd')](_0x582ed7,_0x21cd98)[_0x1258('0xe')](function(_0x429efc){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x3e1044,_0x1258('0xf'));logger[_0x1258('0x10')](_0x1258('0x11'),_0x3e1044,_0x1258('0xf'),JSON['stringify'](_0x429efc));if(_0x429efc[_0x1258('0x12')]){if(_0x429efc[_0x1258('0x12')][_0x1258('0x13')]===0x1f4){logger[_0x1258('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x3e1044,_0x429efc[_0x1258('0x12')][_0x1258('0x14')]);return _0x18bbac(_0x429efc[_0x1258('0x12')][_0x1258('0x14')]);}logger[_0x1258('0x12')](_0x1258('0x15'),_0x3e1044,_0x429efc[_0x1258('0x12')]['message']);return _0x468494(_0x429efc[_0x1258('0x12')]['message']);}else{logger[_0x1258('0x16')](_0x1258('0x15'),_0x3e1044,_0x1258('0xf'));_0x468494(_0x429efc[_0x1258('0x17')][_0x1258('0x14')]);}})['catch'](function(_0x1645a6){logger[_0x1258('0x12')](_0x1258('0x15'),_0x3e1044,_0x1645a6);_0x18bbac(_0x1645a6);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 2671391..63942f7 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 _0x63f5=['update','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','create','post'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x63f5,0x80));var _0x563f=function(_0x1bc445,_0x2d6fe0){_0x1bc445=_0x1bc445-0x0;var _0x589e6b=_0x63f5[_0x1bc445];return _0x589e6b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x563f('0x0'));var timeout=require(_0x563f('0x1'));var express=require('express');var router=express[_0x563f('0x2')]();var fs_extra=require(_0x563f('0x3'));var auth=require(_0x563f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x563f('0x5'));var controller=require(_0x563f('0x6'));router[_0x563f('0x7')]('/',auth[_0x563f('0x8')](),controller['index']);router[_0x563f('0x7')](_0x563f('0x9'),auth[_0x563f('0x8')](),controller[_0x563f('0xa')]);router[_0x563f('0x7')](_0x563f('0xb'),auth[_0x563f('0x8')](),controller['getConfigurations']);router['get'](_0x563f('0xc'),auth[_0x563f('0x8')](),controller[_0x563f('0xd')]);router['post']('/',auth[_0x563f('0x8')](),controller[_0x563f('0xe')]);router[_0x563f('0xf')](_0x563f('0xb'),auth[_0x563f('0x8')](),controller['addConfiguration']);router['put'](_0x563f('0x9'),auth[_0x563f('0x8')](),controller[_0x563f('0x10')]);router['delete'](_0x563f('0x9'),auth[_0x563f('0x8')](),controller[_0x563f('0x11')]);module['exports']=router; \ No newline at end of file +var _0x83af=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x43aafc,_0x310e66){var _0x489eb3=function(_0x33d34f){while(--_0x33d34f){_0x43aafc['push'](_0x43aafc['shift']());}};_0x489eb3(++_0x310e66);}(_0x83af,0x1d1));var _0xf83a=function(_0x596e98,_0xc326c9){_0x596e98=_0x596e98-0x0;var _0x1c09ac=_0x83af[_0x596e98];return _0x1c09ac;};'use strict';var multer=require('multer');var util=require(_0xf83a('0x0'));var path=require(_0xf83a('0x1'));var timeout=require(_0xf83a('0x2'));var express=require(_0xf83a('0x3'));var router=express[_0xf83a('0x4')]();var fs_extra=require(_0xf83a('0x5'));var auth=require(_0xf83a('0x6'));var interaction=require(_0xf83a('0x7'));var config=require(_0xf83a('0x8'));var controller=require('./intFreshdeskAccount.controller');router[_0xf83a('0x9')]('/',auth[_0xf83a('0xa')](),controller[_0xf83a('0xb')]);router['get']('/:id',auth[_0xf83a('0xa')](),controller[_0xf83a('0xc')]);router[_0xf83a('0x9')](_0xf83a('0xd'),auth[_0xf83a('0xa')](),controller[_0xf83a('0xe')]);router[_0xf83a('0x9')](_0xf83a('0xf'),auth['isAuthenticated'](),controller[_0xf83a('0x10')]);router[_0xf83a('0x11')]('/',auth[_0xf83a('0xa')](),controller[_0xf83a('0x12')]);router[_0xf83a('0x11')]('/:id/configurations',auth[_0xf83a('0xa')](),controller[_0xf83a('0x13')]);router[_0xf83a('0x14')](_0xf83a('0x15'),auth[_0xf83a('0xa')](),controller[_0xf83a('0x16')]);router[_0xf83a('0x17')](_0xf83a('0x15'),auth['isAuthenticated'](),controller[_0xf83a('0x18')]);module[_0xf83a('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index a291561..302bf42 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 _0xed8f=['remoteUri','sequelize','exports','STRING'];(function(_0x4dad09,_0x1b80d1){var _0x3bac29=function(_0x148e24){while(--_0x148e24){_0x4dad09['push'](_0x4dad09['shift']());}};_0x3bac29(++_0x1b80d1);}(_0xed8f,0x1a9));var _0xfed8=function(_0x3ec111,_0x4b33d8){_0x3ec111=_0x3ec111-0x0;var _0x2e0332=_0xed8f[_0x3ec111];return _0x2e0332;};'use strict';var Sequelize=require(_0xfed8('0x0'));module[_0xfed8('0x1')]={'name':{'type':Sequelize[_0xfed8('0x2')]},'description':{'type':Sequelize[_0xfed8('0x2')]},'username':{'type':Sequelize[_0xfed8('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xfed8('0x2')],'unique':_0xfed8('0x3')},'serverUrl':{'type':Sequelize[_0xfed8('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x84d1=['STRING','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84d1,0x1c2));var _0x184d=function(_0x4711fc,_0x31742c){_0x4711fc=_0x4711fc-0x0;var _0x4c1eaf=_0x84d1[_0x4711fc];return _0x4c1eaf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x184d('0x0')]},'username':{'type':Sequelize[_0x184d('0x0')],'unique':_0x184d('0x1')},'apiKey':{'type':Sequelize[_0x184d('0x0')]},'remoteUri':{'type':Sequelize[_0x184d('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x184d('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 14cf5d2..8be2b36 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 _0xf740=['Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','destroy','then','end','stack','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','findAll','rows','show','params','keys','includeAll','options','find','create','body','update','getConfigurations','FreshdeskConfiguration','nolimit','Subjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','findOne','remoteUri','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','subject','agent','description','ticket_type','group','company','includes','custom_text','custom_dropdown','label','default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2f7a62,_0xc1e5ce){var _0x17ecca=function(_0x5af810){while(--_0x5af810){_0x2f7a62['push'](_0x2f7a62['shift']());}};_0x17ecca(++_0xc1e5ce);}(_0xf740,0x1e9));var _0x0f74=function(_0x5ad771,_0x34186f){_0x5ad771=_0x5ad771-0x0;var _0x5b5dce=_0xf740[_0x5ad771];return _0x5b5dce;};'use strict';var emlformat=require(_0x0f74('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0f74('0x1'));var jsonpatch=require(_0x0f74('0x2'));var rp=require(_0x0f74('0x3'));var moment=require(_0x0f74('0x4'));var BPromise=require(_0x0f74('0x5'));var Mustache=require('mustache');var util=require(_0x0f74('0x6'));var path=require('path');var sox=require(_0x0f74('0x7'));var csv=require(_0x0f74('0x8'));var ejs=require(_0x0f74('0x9'));var fs=require('fs');var fs_extra=require(_0x0f74('0xa'));var _=require(_0x0f74('0xb'));var squel=require(_0x0f74('0xc'));var crypto=require(_0x0f74('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0f74('0xe'));var toCsv=require(_0x0f74('0x8'));var querystring=require(_0x0f74('0xf'));var Papa=require(_0x0f74('0x10'));var Redis=require(_0x0f74('0x11'));var authService=require(_0x0f74('0x12'));var qs=require(_0x0f74('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f74('0x14'));var logger=require(_0x0f74('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x0f74('0x16'));var licenseUtil=require(_0x0f74('0x17'));var db=require(_0x0f74('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x0f74('0x19'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x241996,_0x25221c,_0x1ba2e5,_0x2bbede){return new BPromise(function(_0x47c1cf,_0xe2a79b){var _0x703741=_0x2bbede||client;return _0x703741['request'](_0x241996,_0x1ba2e5)['then'](function(_0x1e07f9){logger[_0x0f74('0x1a')]('FreshdeskAccount,\x20%s,\x20%s',_0x25221c,'request\x20sent');logger[_0x0f74('0x1b')](_0x0f74('0x1c'),_0x25221c,_0x0f74('0x1d'),JSON['stringify'](_0x1e07f9));if(_0x1e07f9[_0x0f74('0x1e')]){if(_0x1e07f9[_0x0f74('0x1e')][_0x0f74('0x1f')]===0x1f4){logger['error'](_0x0f74('0x20'),_0x25221c,_0x1e07f9[_0x0f74('0x1e')][_0x0f74('0x21')]);return _0xe2a79b(_0x1e07f9[_0x0f74('0x1e')][_0x0f74('0x21')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x25221c,_0x1e07f9[_0x0f74('0x1e')][_0x0f74('0x21')]);return _0x47c1cf(_0x1e07f9['error'][_0x0f74('0x21')]);}else{logger[_0x0f74('0x1a')](_0x0f74('0x20'),_0x25221c,_0x0f74('0x1d'));_0x47c1cf(_0x1e07f9[_0x0f74('0x22')][_0x0f74('0x21')]);}})[_0x0f74('0x23')](function(_0x5bd4a4){logger['error'](_0x0f74('0x20'),_0x25221c,_0x5bd4a4);_0xe2a79b(_0x5bd4a4);});});}function respondWithStatusCode(_0x40a1ed,_0x39f8ff){_0x39f8ff=_0x39f8ff||0xcc;return function(_0x543301){if(_0x543301){return _0x40a1ed[_0x0f74('0x24')](_0x39f8ff);}return _0x40a1ed[_0x0f74('0x25')](_0x39f8ff)['end']();};}function respondWithResult(_0x312114,_0x1e4ba5){_0x1e4ba5=_0x1e4ba5||0xc8;return function(_0x89c758){if(_0x89c758){return _0x312114[_0x0f74('0x25')](_0x1e4ba5)[_0x0f74('0x26')](_0x89c758);}};}function respondWithFilteredResult(_0xc460a3,_0x1491be){return function(_0x46f37f){if(_0x46f37f){var _0x445605=typeof _0x1491be[_0x0f74('0x27')]===_0x0f74('0x28')&&typeof _0x1491be[_0x0f74('0x29')]===_0x0f74('0x28');var _0x190e26=_0x46f37f[_0x0f74('0x2a')];var _0xef8419=_0x445605?0x0:_0x1491be[_0x0f74('0x27')];var _0x57596e=_0x445605?_0x46f37f[_0x0f74('0x2a')]:_0x1491be[_0x0f74('0x27')]+_0x1491be[_0x0f74('0x29')];var _0x1f5ac7;if(_0x57596e>=_0x190e26){_0x57596e=_0x190e26;_0x1f5ac7=0xc8;}else{_0x1f5ac7=0xce;}_0xc460a3['status'](_0x1f5ac7);return _0xc460a3[_0x0f74('0x2b')](_0x0f74('0x2c'),_0xef8419+'-'+_0x57596e+'/'+_0x190e26)['json'](_0x46f37f);}return null;};}function patchUpdates(_0x16cd7b){return function(_0x1abc08){try{jsonpatch['apply'](_0x1abc08,_0x16cd7b,!![]);}catch(_0x13f723){return BPromise['reject'](_0x13f723);}return _0x1abc08['save']();};}function saveUpdates(_0x23fdf3,_0x583ffd){return function(_0xf04c0a){if(_0xf04c0a){return _0xf04c0a['update'](_0x23fdf3)['then'](function(_0x13e92b){return _0x13e92b;});}return null;};}function removeEntity(_0x1abe18,_0x34a228){return function(_0x23f5a0){if(_0x23f5a0){return _0x23f5a0[_0x0f74('0x2d')]()[_0x0f74('0x2e')](function(){_0x1abe18['status'](0xcc)[_0x0f74('0x2f')]();});}};}function handleEntityNotFound(_0x3daa04,_0x22cb86){return function(_0x4ae695){if(!_0x4ae695){_0x3daa04[_0x0f74('0x24')](0x194);}return _0x4ae695;};}function handleError(_0x51bfc9,_0x5ea530){_0x5ea530=_0x5ea530||0x1f4;return function(_0x276894){logger[_0x0f74('0x1e')](_0x276894[_0x0f74('0x30')]);if(_0x276894[_0x0f74('0x31')]){delete _0x276894['name'];}_0x51bfc9['status'](_0x5ea530)[_0x0f74('0x32')](_0x276894);};}exports[_0x0f74('0x33')]=function(_0x1f4cb6,_0x36c724){var _0x4c1ba6={},_0x371cf6={},_0x21dda5={'count':0x0,'rows':[]};var _0x20aa73=_['map'](db[_0x0f74('0x34')][_0x0f74('0x35')],function(_0x48e459){return{'name':_0x48e459[_0x0f74('0x36')],'type':_0x48e459[_0x0f74('0x37')][_0x0f74('0x38')]};});_0x371cf6[_0x0f74('0x39')]=_[_0x0f74('0x3a')](_0x20aa73,_0x0f74('0x31'));_0x371cf6[_0x0f74('0x3b')]=_['keys'](_0x1f4cb6[_0x0f74('0x3b')]);_0x371cf6[_0x0f74('0x3c')]=_[_0x0f74('0x3d')](_0x371cf6[_0x0f74('0x39')],_0x371cf6['query']);_0x4c1ba6[_0x0f74('0x3e')]=_['intersection'](_0x371cf6[_0x0f74('0x39')],qs[_0x0f74('0x3f')](_0x1f4cb6['query']['fields']));_0x4c1ba6[_0x0f74('0x3e')]=_0x4c1ba6[_0x0f74('0x3e')][_0x0f74('0x40')]?_0x4c1ba6['attributes']:_0x371cf6[_0x0f74('0x39')];if(!_0x1f4cb6[_0x0f74('0x3b')][_0x0f74('0x41')]('nolimit')){_0x4c1ba6['limit']=qs[_0x0f74('0x29')](_0x1f4cb6['query']['limit']);_0x4c1ba6['offset']=qs[_0x0f74('0x27')](_0x1f4cb6[_0x0f74('0x3b')][_0x0f74('0x27')]);}_0x4c1ba6[_0x0f74('0x42')]=qs['sort'](_0x1f4cb6['query'][_0x0f74('0x43')]);_0x4c1ba6['where']=qs[_0x0f74('0x3c')](_[_0x0f74('0x44')](_0x1f4cb6[_0x0f74('0x3b')],_0x371cf6[_0x0f74('0x3c')]),_0x20aa73);if(_0x1f4cb6[_0x0f74('0x3b')]['filter']){_0x4c1ba6[_0x0f74('0x45')]=_[_0x0f74('0x46')](_0x4c1ba6[_0x0f74('0x45')],{'$or':_['map'](_0x20aa73,function(_0x13581a){if(_0x13581a['type']!==_0x0f74('0x47')){var _0x4cdc2f={};_0x4cdc2f[_0x13581a[_0x0f74('0x31')]]={'$like':'%'+_0x1f4cb6[_0x0f74('0x3b')][_0x0f74('0x48')]+'%'};return _0x4cdc2f;}})});}_0x4c1ba6=_[_0x0f74('0x46')]({},_0x4c1ba6,_0x1f4cb6['options']);var _0x49fa5b={'where':_0x4c1ba6[_0x0f74('0x45')]};return db[_0x0f74('0x34')][_0x0f74('0x2a')](_0x49fa5b)[_0x0f74('0x2e')](function(_0x774e36){_0x21dda5[_0x0f74('0x2a')]=_0x774e36;if(_0x1f4cb6[_0x0f74('0x3b')]['includeAll']){_0x4c1ba6['include']=[{'all':!![]}];}return db[_0x0f74('0x34')][_0x0f74('0x49')](_0x4c1ba6);})[_0x0f74('0x2e')](function(_0x53c6e3){_0x21dda5[_0x0f74('0x4a')]=_0x53c6e3;return _0x21dda5;})[_0x0f74('0x2e')](respondWithFilteredResult(_0x36c724,_0x4c1ba6))[_0x0f74('0x23')](handleError(_0x36c724,null));};exports[_0x0f74('0x4b')]=function(_0x344542,_0xa51ec8){var _0x45f44d={'raw':![],'where':{'id':_0x344542[_0x0f74('0x4c')]['id']}},_0x1991e9={};_0x1991e9['model']=_[_0x0f74('0x4d')](db[_0x0f74('0x34')][_0x0f74('0x35')]);_0x1991e9[_0x0f74('0x3b')]=_[_0x0f74('0x4d')](_0x344542[_0x0f74('0x3b')]);_0x1991e9['filters']=_[_0x0f74('0x3d')](_0x1991e9['model'],_0x1991e9[_0x0f74('0x3b')]);_0x45f44d[_0x0f74('0x3e')]=_[_0x0f74('0x3d')](_0x1991e9[_0x0f74('0x39')],qs[_0x0f74('0x3f')](_0x344542['query'][_0x0f74('0x3f')]));_0x45f44d['attributes']=_0x45f44d[_0x0f74('0x3e')]['length']?_0x45f44d[_0x0f74('0x3e')]:_0x1991e9[_0x0f74('0x39')];if(_0x344542[_0x0f74('0x3b')][_0x0f74('0x4e')]){_0x45f44d['include']=[{'all':!![]}];}_0x45f44d=_['merge']({},_0x45f44d,_0x344542[_0x0f74('0x4f')]);return db[_0x0f74('0x34')][_0x0f74('0x50')](_0x45f44d)[_0x0f74('0x2e')](handleEntityNotFound(_0xa51ec8,null))['then'](respondWithResult(_0xa51ec8,null))[_0x0f74('0x23')](handleError(_0xa51ec8,null));};exports[_0x0f74('0x51')]=function(_0x5a7974,_0x5c0d4c){return db[_0x0f74('0x34')][_0x0f74('0x51')](_0x5a7974[_0x0f74('0x52')],{})[_0x0f74('0x2e')](respondWithResult(_0x5c0d4c,0xc9))[_0x0f74('0x23')](handleError(_0x5c0d4c,null));};exports[_0x0f74('0x53')]=function(_0x19e505,_0x2cded3){if(_0x19e505[_0x0f74('0x52')]['id']){delete _0x19e505[_0x0f74('0x52')]['id'];}return db['FreshdeskAccount'][_0x0f74('0x50')]({'where':{'id':_0x19e505['params']['id']}})[_0x0f74('0x2e')](handleEntityNotFound(_0x2cded3,null))['then'](saveUpdates(_0x19e505['body'],null))[_0x0f74('0x2e')](respondWithResult(_0x2cded3,null))['catch'](handleError(_0x2cded3,null));};exports[_0x0f74('0x2d')]=function(_0x1fdf75,_0x29ea2e){return db[_0x0f74('0x34')][_0x0f74('0x50')]({'where':{'id':_0x1fdf75[_0x0f74('0x4c')]['id']}})[_0x0f74('0x2e')](handleEntityNotFound(_0x29ea2e,null))[_0x0f74('0x2e')](removeEntity(_0x29ea2e,null))[_0x0f74('0x23')](handleError(_0x29ea2e,null));};exports[_0x0f74('0x54')]=function(_0x31acab,_0x2311d0,_0x31434f){var _0x54b794={};var _0x552691={};var _0x59edfc;var _0x4ac186;return db[_0x0f74('0x34')]['findOne']({'where':{'id':_0x31acab[_0x0f74('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2311d0,null))['then'](function(_0x348c91){if(_0x348c91){_0x59edfc=_0x348c91;_0x552691[_0x0f74('0x39')]=_[_0x0f74('0x4d')](db[_0x0f74('0x55')][_0x0f74('0x35')]);_0x552691[_0x0f74('0x3b')]=_['keys'](_0x31acab[_0x0f74('0x3b')]);_0x552691[_0x0f74('0x3c')]=_[_0x0f74('0x3d')](_0x552691['model'],_0x552691[_0x0f74('0x3b')]);_0x54b794[_0x0f74('0x3e')]=_['intersection'](_0x552691[_0x0f74('0x39')],qs[_0x0f74('0x3f')](_0x31acab[_0x0f74('0x3b')][_0x0f74('0x3f')]));_0x54b794['attributes']=_0x54b794[_0x0f74('0x3e')]['length']?_0x54b794[_0x0f74('0x3e')]:_0x552691[_0x0f74('0x39')];_0x54b794[_0x0f74('0x42')]=qs[_0x0f74('0x43')](_0x31acab[_0x0f74('0x3b')][_0x0f74('0x43')]);_0x54b794['where']=qs[_0x0f74('0x3c')](_[_0x0f74('0x44')](_0x31acab[_0x0f74('0x3b')],_0x552691[_0x0f74('0x3c')]));if(_0x31acab[_0x0f74('0x3b')]['filter']){_0x54b794['where']=_['merge'](_0x54b794['where'],{'$or':_[_0x0f74('0x3a')](_0x54b794['attributes'],function(_0x214bfa){var _0x4085c5={};_0x4085c5[_0x214bfa]={'$like':'%'+_0x31acab[_0x0f74('0x3b')][_0x0f74('0x48')]+'%'};return _0x4085c5;})});}_0x54b794=_[_0x0f74('0x46')]({},_0x54b794,_0x31acab['options']);return _0x59edfc[_0x0f74('0x54')](_0x54b794);}})[_0x0f74('0x2e')](function(_0x2871ef){if(_0x2871ef){_0x4ac186=_0x2871ef[_0x0f74('0x40')];if(!_0x31acab['query'][_0x0f74('0x41')](_0x0f74('0x56'))){_0x54b794[_0x0f74('0x29')]=qs[_0x0f74('0x29')](_0x31acab[_0x0f74('0x3b')][_0x0f74('0x29')]);_0x54b794[_0x0f74('0x27')]=qs['offset'](_0x31acab[_0x0f74('0x3b')]['offset']);}return _0x59edfc['getConfigurations'](_0x54b794);}})['then'](function(_0x42876f){if(_0x42876f){return _0x42876f?{'count':_0x4ac186,'rows':_0x42876f}:null;}})[_0x0f74('0x2e')](respondWithResult(_0x2311d0,null))[_0x0f74('0x23')](handleError(_0x2311d0,null));};exports['addConfiguration']=function(_0x1256da,_0x525247,_0x2ddebd){if(_0x1256da[_0x0f74('0x52')]['id']){delete _0x1256da[_0x0f74('0x52')]['id'];}return db[_0x0f74('0x34')]['findOne']({'where':{'id':_0x1256da[_0x0f74('0x4c')]['id']}})[_0x0f74('0x2e')](handleEntityNotFound(_0x525247,null))[_0x0f74('0x2e')](function(_0x5468f2){if(_0x5468f2){_0x1256da[_0x0f74('0x52')]['AccountId']=_0x5468f2['id'];_0x1256da[_0x0f74('0x52')][_0x0f74('0x57')]=integrations['getSubjects'](_0x1256da['body'][_0x0f74('0x58')],_0x1256da['body'][_0x0f74('0x37')]);_0x1256da['body'][_0x0f74('0x59')]=integrations[_0x0f74('0x5a')](_0x1256da[_0x0f74('0x52')][_0x0f74('0x58')],_0x1256da[_0x0f74('0x52')][_0x0f74('0x37')]);return db[_0x0f74('0x55')]['create'](_0x1256da['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x0f74('0x57')},{'model':db[_0x0f74('0x5b')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x525247,null))[_0x0f74('0x23')](handleError(_0x525247,null));};exports[_0x0f74('0x5c')]=function(_0x58f225,_0x369bf0,_0xafa4c6){var _0x11a386='';return db[_0x0f74('0x34')][_0x0f74('0x5d')]({'where':{'id':_0x58f225[_0x0f74('0x4c')]['id']},'attributes':['id',_0x0f74('0x5e'),'apiKey']})[_0x0f74('0x2e')](handleEntityNotFound(_0x369bf0,null))[_0x0f74('0x2e')](function(_0x18e89d){if(_0x18e89d){_0x11a386=_0x18e89d[_0x0f74('0x5e')];var _0x497b4f=_0x11a386['slice'](-0x1);if(_0x497b4f==='/'){_0x11a386=_0x11a386['substring'](0x0,_0x11a386['lastIndexOf'](_0x497b4f));}return rp({'method':'GET','uri':util[_0x0f74('0x5f')](_0x0f74('0x60'),_0x11a386,_0x0f74('0x61')),'headers':{'Authorization':util[_0x0f74('0x5f')](_0x0f74('0x62'),new Buffer(util[_0x0f74('0x5f')](_0x0f74('0x63'),_0x18e89d[_0x0f74('0x64')]))[_0x0f74('0x65')](_0x0f74('0x66')))},'json':!![]});}})[_0x0f74('0x2e')](function(_0x1a4db5){if(_0x1a4db5){var _0x983972=[_0x0f74('0x67'),_0x0f74('0x68'),_0x0f74('0x69'),_0x0f74('0x6a'),_0x0f74('0x25'),'priority','group','source',_0x0f74('0x6b'),_0x0f74('0x6c'),_0x0f74('0x6d')];_['remove'](_0x1a4db5,function(_0x149f27){return _0x983972[_0x0f74('0x6e')](_0x149f27[_0x0f74('0x31')])||!_0x149f27['default']&&_0x149f27['type']!==_0x0f74('0x6f')&&_0x149f27[_0x0f74('0x37')]!==_0x0f74('0x70');});return{'count':_0x1a4db5[_0x0f74('0x40')],'rows':_[_0x0f74('0x3a')](_0x1a4db5,function(_0x50738c){return{'id':_0x50738c[_0x0f74('0x31')],'name':_0x50738c[_0x0f74('0x71')],'custom':!_0x50738c[_0x0f74('0x72')],'options':_0x50738c[_0x0f74('0x73')]?_[_0x0f74('0x3a')](_0x50738c['choices'],function(_0x11d22d){return{'name':_[_0x0f74('0x74')](_0x11d22d),'value':_0x11d22d};}):[]};})};}})[_0x0f74('0x2e')](respondWithResult(_0x369bf0,null))[_0x0f74('0x23')](function(_0x23f0dd){var _0x1d045d=_0x58f225[_0x0f74('0x3b')][_0x0f74('0x75')]?0x1f4:_0x23f0dd[_0x0f74('0x76')]||0x1f4;logger['error'](_0x0f74('0x77'),'getFields',_0x1d045d,JSON[_0x0f74('0x78')](_0x23f0dd));delete _0x23f0dd[_0x0f74('0x31')];if(_0x1d045d===0x191){_0x1d045d=0x190;}_0x369bf0[_0x0f74('0x25')](_0x1d045d)[_0x0f74('0x32')](_0x58f225[_0x0f74('0x3b')]['test']?{'message':_0x0f74('0x79'),'statusCode':_0x23f0dd['statusCode']}:_0x23f0dd);});}; \ No newline at end of file +var _0xa8bb=['request-promise','bluebird','util','sox','ejs','fs-extra','squel','jsforce','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','end','json','offset','undefined','limit','count','status','set','apply','reject','save','sendStatus','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','type','merge','options','include','findAll','show','params','create','body','find','destroy','findOne','FreshdeskConfiguration','sort','getConfigurations','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','Subjects','getFields','apiKey','remoteUri','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','base64','requester','priority','group','company','remove','includes','default','custom_text','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch'];(function(_0x479341,_0x91784){var _0x42e88d=function(_0x43e2bd){while(--_0x43e2bd){_0x479341['push'](_0x479341['shift']());}};_0x42e88d(++_0x91784);}(_0xa8bb,0x1d1));var _0xba8b=function(_0x2bf0a5,_0x5a96bb){_0x2bf0a5=_0x2bf0a5-0x0;var _0x5996ef=_0xa8bb[_0x2bf0a5];return _0x5996ef;};'use strict';var emlformat=require(_0xba8b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xba8b('0x1'));var jsonpatch=require(_0xba8b('0x2'));var rp=require(_0xba8b('0x3'));var moment=require('moment');var BPromise=require(_0xba8b('0x4'));var Mustache=require('mustache');var util=require(_0xba8b('0x5'));var path=require('path');var sox=require(_0xba8b('0x6'));var csv=require('to-csv');var ejs=require(_0xba8b('0x7'));var fs=require('fs');var fs_extra=require(_0xba8b('0x8'));var _=require('lodash');var squel=require(_0xba8b('0x9'));var crypto=require('crypto');var jsforce=require(_0xba8b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xba8b('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xba8b('0xc'));var authService=require(_0xba8b('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba8b('0xe'));var logger=require(_0xba8b('0xf'))(_0xba8b('0x10'));var utils=require(_0xba8b('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xba8b('0x12'));var db=require(_0xba8b('0x13'))['db'];var integrations=require(_0xba8b('0x14'));var jayson=require(_0xba8b('0x15'));var client=jayson[_0xba8b('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2bf14e,_0x4c89d3,_0x138243,_0x2fba97){return new BPromise(function(_0x141a59,_0x38b667){var _0x2fc1cc=_0x2fba97||client;return _0x2fc1cc[_0xba8b('0x17')](_0x2bf14e,_0x138243)[_0xba8b('0x18')](function(_0x310434){logger['info'](_0xba8b('0x19'),_0x4c89d3,_0xba8b('0x1a'));logger[_0xba8b('0x1b')](_0xba8b('0x1c'),_0x4c89d3,'request\x20sent',JSON[_0xba8b('0x1d')](_0x310434));if(_0x310434['error']){if(_0x310434[_0xba8b('0x1e')][_0xba8b('0x1f')]===0x1f4){logger[_0xba8b('0x1e')](_0xba8b('0x19'),_0x4c89d3,_0x310434[_0xba8b('0x1e')]['message']);return _0x38b667(_0x310434['error'][_0xba8b('0x20')]);}logger['error'](_0xba8b('0x19'),_0x4c89d3,_0x310434[_0xba8b('0x1e')][_0xba8b('0x20')]);return _0x141a59(_0x310434[_0xba8b('0x1e')][_0xba8b('0x20')]);}else{logger[_0xba8b('0x21')](_0xba8b('0x19'),_0x4c89d3,'request\x20sent');_0x141a59(_0x310434[_0xba8b('0x22')][_0xba8b('0x20')]);}})[_0xba8b('0x23')](function(_0x5a277a){logger[_0xba8b('0x1e')](_0xba8b('0x19'),_0x4c89d3,_0x5a277a);_0x38b667(_0x5a277a);});});}function respondWithStatusCode(_0x25f96b,_0x865f29){_0x865f29=_0x865f29||0xcc;return function(_0x1a09d2){if(_0x1a09d2){return _0x25f96b['sendStatus'](_0x865f29);}return _0x25f96b['status'](_0x865f29)[_0xba8b('0x24')]();};}function respondWithResult(_0x533971,_0x1b8d68){_0x1b8d68=_0x1b8d68||0xc8;return function(_0x32fe43){if(_0x32fe43){return _0x533971['status'](_0x1b8d68)[_0xba8b('0x25')](_0x32fe43);}};}function respondWithFilteredResult(_0x39d94c,_0x176ca3){return function(_0x20b4d5){if(_0x20b4d5){var _0x20cc03=typeof _0x176ca3[_0xba8b('0x26')]===_0xba8b('0x27')&&typeof _0x176ca3[_0xba8b('0x28')]===_0xba8b('0x27');var _0x1be00f=_0x20b4d5[_0xba8b('0x29')];var _0x433299=_0x20cc03?0x0:_0x176ca3['offset'];var _0x323844=_0x20cc03?_0x20b4d5['count']:_0x176ca3[_0xba8b('0x26')]+_0x176ca3[_0xba8b('0x28')];var _0x33b10b;if(_0x323844>=_0x1be00f){_0x323844=_0x1be00f;_0x33b10b=0xc8;}else{_0x33b10b=0xce;}_0x39d94c[_0xba8b('0x2a')](_0x33b10b);return _0x39d94c[_0xba8b('0x2b')]('Content-Range',_0x433299+'-'+_0x323844+'/'+_0x1be00f)[_0xba8b('0x25')](_0x20b4d5);}return null;};}function patchUpdates(_0x52d577){return function(_0xc1e32f){try{jsonpatch[_0xba8b('0x2c')](_0xc1e32f,_0x52d577,!![]);}catch(_0x176928){return BPromise[_0xba8b('0x2d')](_0x176928);}return _0xc1e32f[_0xba8b('0x2e')]();};}function saveUpdates(_0x35ca5e,_0xbb550f){return function(_0x3e4326){if(_0x3e4326){return _0x3e4326['update'](_0x35ca5e)['then'](function(_0xac12cc){return _0xac12cc;});}return null;};}function removeEntity(_0x585110,_0x8c490e){return function(_0x56c159){if(_0x56c159){return _0x56c159['destroy']()[_0xba8b('0x18')](function(){_0x585110['status'](0xcc)[_0xba8b('0x24')]();});}};}function handleEntityNotFound(_0x454dea,_0x12d5fa){return function(_0x21b471){if(!_0x21b471){_0x454dea[_0xba8b('0x2f')](0x194);}return _0x21b471;};}function handleError(_0x4e7b95,_0x1b27f5){_0x1b27f5=_0x1b27f5||0x1f4;return function(_0x409b9a){logger[_0xba8b('0x1e')](_0x409b9a[_0xba8b('0x30')]);if(_0x409b9a[_0xba8b('0x31')]){delete _0x409b9a['name'];}_0x4e7b95[_0xba8b('0x2a')](_0x1b27f5)[_0xba8b('0x32')](_0x409b9a);};}exports[_0xba8b('0x33')]=function(_0x43b6a7,_0x39ddc0){var _0x358f55={},_0x415102={},_0x3062f5={'count':0x0,'rows':[]};var _0x397104=_[_0xba8b('0x34')](db[_0xba8b('0x35')][_0xba8b('0x36')],function(_0x1909eb){return{'name':_0x1909eb[_0xba8b('0x37')],'type':_0x1909eb['type'][_0xba8b('0x38')]};});_0x415102['model']=_[_0xba8b('0x34')](_0x397104,_0xba8b('0x31'));_0x415102[_0xba8b('0x39')]=_[_0xba8b('0x3a')](_0x43b6a7['query']);_0x415102[_0xba8b('0x3b')]=_[_0xba8b('0x3c')](_0x415102[_0xba8b('0x3d')],_0x415102[_0xba8b('0x39')]);_0x358f55[_0xba8b('0x3e')]=_[_0xba8b('0x3c')](_0x415102['model'],qs[_0xba8b('0x3f')](_0x43b6a7[_0xba8b('0x39')]['fields']));_0x358f55[_0xba8b('0x3e')]=_0x358f55['attributes'][_0xba8b('0x40')]?_0x358f55[_0xba8b('0x3e')]:_0x415102[_0xba8b('0x3d')];if(!_0x43b6a7[_0xba8b('0x39')][_0xba8b('0x41')](_0xba8b('0x42'))){_0x358f55[_0xba8b('0x28')]=qs[_0xba8b('0x28')](_0x43b6a7['query'][_0xba8b('0x28')]);_0x358f55[_0xba8b('0x26')]=qs[_0xba8b('0x26')](_0x43b6a7[_0xba8b('0x39')][_0xba8b('0x26')]);}_0x358f55[_0xba8b('0x43')]=qs['sort'](_0x43b6a7['query']['sort']);_0x358f55[_0xba8b('0x44')]=qs['filters'](_[_0xba8b('0x45')](_0x43b6a7[_0xba8b('0x39')],_0x415102['filters']),_0x397104);if(_0x43b6a7[_0xba8b('0x39')][_0xba8b('0x46')]){_0x358f55[_0xba8b('0x44')]=_['merge'](_0x358f55[_0xba8b('0x44')],{'$or':_[_0xba8b('0x34')](_0x397104,function(_0x59aff1){if(_0x59aff1[_0xba8b('0x47')]!=='VIRTUAL'){var _0x20d64f={};_0x20d64f[_0x59aff1['name']]={'$like':'%'+_0x43b6a7[_0xba8b('0x39')][_0xba8b('0x46')]+'%'};return _0x20d64f;}})});}_0x358f55=_[_0xba8b('0x48')]({},_0x358f55,_0x43b6a7[_0xba8b('0x49')]);var _0x20c19e={'where':_0x358f55['where']};return db['FreshdeskAccount']['count'](_0x20c19e)[_0xba8b('0x18')](function(_0x302b7c){_0x3062f5[_0xba8b('0x29')]=_0x302b7c;if(_0x43b6a7[_0xba8b('0x39')]['includeAll']){_0x358f55[_0xba8b('0x4a')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xba8b('0x4b')](_0x358f55);})[_0xba8b('0x18')](function(_0xeea28a){_0x3062f5['rows']=_0xeea28a;return _0x3062f5;})[_0xba8b('0x18')](respondWithFilteredResult(_0x39ddc0,_0x358f55))[_0xba8b('0x23')](handleError(_0x39ddc0,null));};exports[_0xba8b('0x4c')]=function(_0x3edee,_0x5ab0da){var _0x4e366a={'raw':![],'where':{'id':_0x3edee[_0xba8b('0x4d')]['id']}},_0x314f93={};_0x314f93[_0xba8b('0x3d')]=_[_0xba8b('0x3a')](db[_0xba8b('0x35')][_0xba8b('0x36')]);_0x314f93['query']=_[_0xba8b('0x3a')](_0x3edee[_0xba8b('0x39')]);_0x314f93[_0xba8b('0x3b')]=_[_0xba8b('0x3c')](_0x314f93['model'],_0x314f93[_0xba8b('0x39')]);_0x4e366a['attributes']=_[_0xba8b('0x3c')](_0x314f93[_0xba8b('0x3d')],qs[_0xba8b('0x3f')](_0x3edee[_0xba8b('0x39')]['fields']));_0x4e366a[_0xba8b('0x3e')]=_0x4e366a[_0xba8b('0x3e')][_0xba8b('0x40')]?_0x4e366a[_0xba8b('0x3e')]:_0x314f93[_0xba8b('0x3d')];if(_0x3edee[_0xba8b('0x39')]['includeAll']){_0x4e366a[_0xba8b('0x4a')]=[{'all':!![]}];}_0x4e366a=_[_0xba8b('0x48')]({},_0x4e366a,_0x3edee[_0xba8b('0x49')]);return db[_0xba8b('0x35')]['find'](_0x4e366a)['then'](handleEntityNotFound(_0x5ab0da,null))['then'](respondWithResult(_0x5ab0da,null))[_0xba8b('0x23')](handleError(_0x5ab0da,null));};exports[_0xba8b('0x4e')]=function(_0x58559e,_0x79bcc9){return db[_0xba8b('0x35')][_0xba8b('0x4e')](_0x58559e[_0xba8b('0x4f')],{})[_0xba8b('0x18')](respondWithResult(_0x79bcc9,0xc9))[_0xba8b('0x23')](handleError(_0x79bcc9,null));};exports['update']=function(_0x284927,_0x5eb1a2){if(_0x284927[_0xba8b('0x4f')]['id']){delete _0x284927[_0xba8b('0x4f')]['id'];}return db['FreshdeskAccount'][_0xba8b('0x50')]({'where':{'id':_0x284927[_0xba8b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5eb1a2,null))['then'](saveUpdates(_0x284927[_0xba8b('0x4f')],null))[_0xba8b('0x18')](respondWithResult(_0x5eb1a2,null))['catch'](handleError(_0x5eb1a2,null));};exports[_0xba8b('0x51')]=function(_0x244da2,_0x5b9fe0){return db[_0xba8b('0x35')][_0xba8b('0x50')]({'where':{'id':_0x244da2['params']['id']}})['then'](handleEntityNotFound(_0x5b9fe0,null))[_0xba8b('0x18')](removeEntity(_0x5b9fe0,null))[_0xba8b('0x23')](handleError(_0x5b9fe0,null));};exports['getConfigurations']=function(_0x2ba01e,_0x1f3fd2,_0x27b79c){var _0x26323f={};var _0x5e7755={};var _0x262c73;var _0x3532fa;return db['FreshdeskAccount'][_0xba8b('0x52')]({'where':{'id':_0x2ba01e[_0xba8b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1f3fd2,null))[_0xba8b('0x18')](function(_0x7cbf3e){if(_0x7cbf3e){_0x262c73=_0x7cbf3e;_0x5e7755[_0xba8b('0x3d')]=_[_0xba8b('0x3a')](db[_0xba8b('0x53')][_0xba8b('0x36')]);_0x5e7755[_0xba8b('0x39')]=_[_0xba8b('0x3a')](_0x2ba01e[_0xba8b('0x39')]);_0x5e7755[_0xba8b('0x3b')]=_[_0xba8b('0x3c')](_0x5e7755[_0xba8b('0x3d')],_0x5e7755[_0xba8b('0x39')]);_0x26323f[_0xba8b('0x3e')]=_[_0xba8b('0x3c')](_0x5e7755[_0xba8b('0x3d')],qs[_0xba8b('0x3f')](_0x2ba01e['query']['fields']));_0x26323f[_0xba8b('0x3e')]=_0x26323f['attributes'][_0xba8b('0x40')]?_0x26323f[_0xba8b('0x3e')]:_0x5e7755[_0xba8b('0x3d')];_0x26323f[_0xba8b('0x43')]=qs[_0xba8b('0x54')](_0x2ba01e[_0xba8b('0x39')][_0xba8b('0x54')]);_0x26323f['where']=qs[_0xba8b('0x3b')](_[_0xba8b('0x45')](_0x2ba01e[_0xba8b('0x39')],_0x5e7755[_0xba8b('0x3b')]));if(_0x2ba01e[_0xba8b('0x39')]['filter']){_0x26323f[_0xba8b('0x44')]=_['merge'](_0x26323f[_0xba8b('0x44')],{'$or':_[_0xba8b('0x34')](_0x26323f[_0xba8b('0x3e')],function(_0x4cfff8){var _0x25cdda={};_0x25cdda[_0x4cfff8]={'$like':'%'+_0x2ba01e['query'][_0xba8b('0x46')]+'%'};return _0x25cdda;})});}_0x26323f=_[_0xba8b('0x48')]({},_0x26323f,_0x2ba01e[_0xba8b('0x49')]);return _0x262c73[_0xba8b('0x55')](_0x26323f);}})[_0xba8b('0x18')](function(_0x2fb30c){if(_0x2fb30c){_0x3532fa=_0x2fb30c['length'];if(!_0x2ba01e[_0xba8b('0x39')][_0xba8b('0x41')]('nolimit')){_0x26323f[_0xba8b('0x28')]=qs[_0xba8b('0x28')](_0x2ba01e[_0xba8b('0x39')][_0xba8b('0x28')]);_0x26323f[_0xba8b('0x26')]=qs[_0xba8b('0x26')](_0x2ba01e[_0xba8b('0x39')][_0xba8b('0x26')]);}return _0x262c73['getConfigurations'](_0x26323f);}})[_0xba8b('0x18')](function(_0x51eeca){if(_0x51eeca){return _0x51eeca?{'count':_0x3532fa,'rows':_0x51eeca}:null;}})[_0xba8b('0x18')](respondWithResult(_0x1f3fd2,null))[_0xba8b('0x23')](handleError(_0x1f3fd2,null));};exports[_0xba8b('0x56')]=function(_0x19da8e,_0x4f6de4,_0x4d65cf){if(_0x19da8e[_0xba8b('0x4f')]['id']){delete _0x19da8e[_0xba8b('0x4f')]['id'];}return db[_0xba8b('0x35')][_0xba8b('0x52')]({'where':{'id':_0x19da8e[_0xba8b('0x4d')]['id']}})[_0xba8b('0x18')](handleEntityNotFound(_0x4f6de4,null))[_0xba8b('0x18')](function(_0x385a89){if(_0x385a89){_0x19da8e[_0xba8b('0x4f')][_0xba8b('0x57')]=_0x385a89['id'];_0x19da8e['body']['Subjects']=integrations[_0xba8b('0x58')](_0x19da8e[_0xba8b('0x4f')]['channel'],_0x19da8e[_0xba8b('0x4f')][_0xba8b('0x47')]);_0x19da8e[_0xba8b('0x4f')][_0xba8b('0x59')]=integrations[_0xba8b('0x5a')](_0x19da8e['body'][_0xba8b('0x5b')],_0x19da8e[_0xba8b('0x4f')][_0xba8b('0x47')]);return db[_0xba8b('0x53')]['create'](_0x19da8e[_0xba8b('0x4f')],{'include':[{'model':db[_0xba8b('0x5c')],'as':_0xba8b('0x5d')},{'model':db[_0xba8b('0x5c')],'as':_0xba8b('0x59')}]});}return null;})[_0xba8b('0x18')](respondWithResult(_0x4f6de4,null))[_0xba8b('0x23')](handleError(_0x4f6de4,null));};exports[_0xba8b('0x5e')]=function(_0x5241c9,_0x43a535,_0x106952){var _0x5f352e='';return db[_0xba8b('0x35')][_0xba8b('0x52')]({'where':{'id':_0x5241c9[_0xba8b('0x4d')]['id']},'attributes':['id','remoteUri',_0xba8b('0x5f')]})['then'](handleEntityNotFound(_0x43a535,null))[_0xba8b('0x18')](function(_0x490761){if(_0x490761){_0x5f352e=_0x490761[_0xba8b('0x60')];var _0x242f74=_0x5f352e['slice'](-0x1);if(_0x242f74==='/'){_0x5f352e=_0x5f352e[_0xba8b('0x61')](0x0,_0x5f352e[_0xba8b('0x62')](_0x242f74));}return rp({'method':_0xba8b('0x63'),'uri':util[_0xba8b('0x64')](_0xba8b('0x65'),_0x5f352e,_0xba8b('0x66')),'headers':{'Authorization':util[_0xba8b('0x64')]('Basic\x20%s',new Buffer(util[_0xba8b('0x64')](_0xba8b('0x67'),_0x490761['apiKey']))['toString'](_0xba8b('0x68')))},'json':!![]});}})[_0xba8b('0x18')](function(_0xcd79cd){if(_0xcd79cd){var _0x367cc3=[_0xba8b('0x69'),'subject','agent','description','status',_0xba8b('0x6a'),_0xba8b('0x6b'),'source','ticket_type',_0xba8b('0x6b'),_0xba8b('0x6c')];_[_0xba8b('0x6d')](_0xcd79cd,function(_0x5e9db4){return _0x367cc3[_0xba8b('0x6e')](_0x5e9db4[_0xba8b('0x31')])||!_0x5e9db4[_0xba8b('0x6f')]&&_0x5e9db4[_0xba8b('0x47')]!==_0xba8b('0x70')&&_0x5e9db4[_0xba8b('0x47')]!=='custom_dropdown';});return{'count':_0xcd79cd[_0xba8b('0x40')],'rows':_[_0xba8b('0x34')](_0xcd79cd,function(_0x3e1825){return{'id':_0x3e1825[_0xba8b('0x31')],'name':_0x3e1825['label'],'custom':!_0x3e1825[_0xba8b('0x6f')],'options':_0x3e1825[_0xba8b('0x71')]?_[_0xba8b('0x34')](_0x3e1825[_0xba8b('0x71')],function(_0x4cb277){return{'name':_['capitalize'](_0x4cb277),'value':_0x4cb277};}):[]};})};}})['then'](respondWithResult(_0x43a535,null))[_0xba8b('0x23')](function(_0x127fd7){var _0x875ee=_0x5241c9['query'][_0xba8b('0x72')]?0x1f4:_0x127fd7[_0xba8b('0x73')]||0x1f4;logger[_0xba8b('0x1e')](_0xba8b('0x74'),_0xba8b('0x5e'),_0x875ee,JSON[_0xba8b('0x1d')](_0x127fd7));delete _0x127fd7['name'];if(_0x875ee===0x191){_0x875ee=0x190;}_0x43a535[_0xba8b('0x2a')](_0x875ee)[_0xba8b('0x32')](_0x5241c9[_0xba8b('0x39')][_0xba8b('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x127fd7['statusCode']}:_0x127fd7);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index f66a38b..ab706e0 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 _0xcbac=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','int_freshdesk_accounts','lodash','../../config/logger'];(function(_0x64c9bc,_0x40a092){var _0x12ae52=function(_0x1fcca4){while(--_0x1fcca4){_0x64c9bc['push'](_0x64c9bc['shift']());}};_0x12ae52(++_0x40a092);}(_0xcbac,0x129));var _0xccba=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xcbac[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0xccba('0x0'));var util=require('util');var logger=require(_0xccba('0x1'))(_0xccba('0x2'));var moment=require('moment');var BPromise=require(_0xccba('0x3'));var rp=require(_0xccba('0x4'));var fs=require('fs');var path=require(_0xccba('0x5'));var rimraf=require(_0xccba('0x6'));var config=require(_0xccba('0x7'));var attributes=require(_0xccba('0x8'));var integrations=require(_0xccba('0x9'));module[_0xccba('0xa')]=function(_0x464459,_0x4f1e28){return _0x464459[_0xccba('0xb')]('FreshdeskAccount',attributes,{'tableName':_0xccba('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17aa=['path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','../../config/logger','api','request-promise'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x17aa,0x1b9));var _0xa17a=function(_0xfda3ea,_0x242ea1){_0xfda3ea=_0xfda3ea-0x0;var _0x524531=_0x17aa[_0xfda3ea];return _0x524531;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa17a('0x0'))(_0xa17a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa17a('0x2'));var fs=require('fs');var path=require(_0xa17a('0x3'));var rimraf=require(_0xa17a('0x4'));var config=require(_0xa17a('0x5'));var attributes=require(_0xa17a('0x6'));var integrations=require(_0xa17a('0x7'));module[_0xa17a('0x8')]=function(_0x118006,_0x22092b){return _0x118006[_0xa17a('0x9')](_0xa17a('0xa'),attributes,{'tableName':_0xa17a('0xb'),'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 21368a6..4210fe7 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 _0x71e6=['error','code','message','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','result','catch','GetFreshdeskAccount','findAll','options','where','limit','include','model','attributes','map','ShowFreshdeskAccount','FreshdeskAccount','find','raw','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x33a246,_0x209ba8){var _0x4ad682=function(_0x3bc293){while(--_0x3bc293){_0x33a246['push'](_0x33a246['shift']());}};_0x4ad682(++_0x209ba8);}(_0x71e6,0x80));var _0x671e=function(_0x13c22c,_0x170015){_0x13c22c=_0x13c22c-0x0;var _0x16237c=_0x71e6[_0x13c22c];return _0x16237c;};'use strict';var _=require(_0x671e('0x0'));var util=require(_0x671e('0x1'));var moment=require(_0x671e('0x2'));var BPromise=require(_0x671e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x671e('0x4'));var logger=require(_0x671e('0x5'))(_0x671e('0x6'));var config=require(_0x671e('0x7'));var jayson=require(_0x671e('0x8'));var client=jayson[_0x671e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1234a8,_0x3b27a7,_0xef2b6){return new BPromise(function(_0x427d1b,_0x57fde6){return client[_0x671e('0xa')](_0x1234a8,_0xef2b6)[_0x671e('0xb')](function(_0x394c59){logger[_0x671e('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x3b27a7,'request\x20sent');logger[_0x671e('0xd')](_0x671e('0xe'),_0x3b27a7,'request\x20sent',JSON[_0x671e('0xf')](_0x394c59));if(_0x394c59[_0x671e('0x10')]){if(_0x394c59[_0x671e('0x10')][_0x671e('0x11')]===0x1f4){logger[_0x671e('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x3b27a7,_0x394c59['error'][_0x671e('0x12')]);return _0x57fde6(_0x394c59['error'][_0x671e('0x12')]);}logger[_0x671e('0x10')](_0x671e('0x13'),_0x3b27a7,_0x394c59['error'][_0x671e('0x12')]);return _0x427d1b(_0x394c59['error'][_0x671e('0x12')]);}else{logger[_0x671e('0xc')](_0x671e('0x13'),_0x3b27a7,_0x671e('0x14'));_0x427d1b(_0x394c59[_0x671e('0x15')][_0x671e('0x12')]);}})[_0x671e('0x16')](function(_0x247b87){logger[_0x671e('0x10')](_0x671e('0x13'),_0x3b27a7,_0x247b87);_0x57fde6(_0x247b87);});});}exports[_0x671e('0x17')]=function(_0x36cb4e){var _0x5ef6cd=this;return new Promise(function(_0x2e0250,_0x4fcbb6){return db['FreshdeskAccount'][_0x671e('0x18')]({'raw':_0x36cb4e[_0x671e('0x19')]?_0x36cb4e[_0x671e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x36cb4e[_0x671e('0x19')]?_0x36cb4e['options'][_0x671e('0x1a')]||null:null,'attributes':_0x36cb4e[_0x671e('0x19')]?_0x36cb4e[_0x671e('0x19')]['attributes']||null:null,'limit':_0x36cb4e['options']?_0x36cb4e[_0x671e('0x19')][_0x671e('0x1b')]||null:null,'include':_0x36cb4e['options']?_0x36cb4e[_0x671e('0x19')][_0x671e('0x1c')]?_['map'](_0x36cb4e[_0x671e('0x19')][_0x671e('0x1c')],function(_0x2a8edf){return{'model':db[_0x2a8edf[_0x671e('0x1d')]],'as':_0x2a8edf['as'],'attributes':_0x2a8edf[_0x671e('0x1e')],'include':_0x2a8edf[_0x671e('0x1c')]?_[_0x671e('0x1f')](_0x2a8edf[_0x671e('0x1c')],function(_0x2ed193){return{'model':db[_0x2ed193[_0x671e('0x1d')]],'as':_0x2ed193['as'],'attributes':_0x2ed193[_0x671e('0x1e')],'include':_0x2ed193['include']?_['map'](_0x2ed193[_0x671e('0x1c')],function(_0x3aa85b){return{'model':db[_0x3aa85b[_0x671e('0x1d')]],'as':_0x3aa85b['as'],'attributes':_0x3aa85b[_0x671e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x671e('0xb')](function(_0x494014){logger[_0x671e('0xc')](_0x671e('0x17'),_0x36cb4e);logger['debug'](_0x671e('0x17'),_0x36cb4e,JSON[_0x671e('0xf')](_0x494014));_0x2e0250(_0x494014);})['catch'](function(_0x35d0f2){logger[_0x671e('0x10')]('GetFreshdeskAccount',_0x35d0f2[_0x671e('0x12')],_0x36cb4e);_0x4fcbb6(_0x5ef6cd['error'](0x1f4,_0x35d0f2[_0x671e('0x12')]));});});};exports[_0x671e('0x20')]=function(_0x85d5b0){var _0xd11c1=this;return new Promise(function(_0x42bd69,_0x1bfb50){return db[_0x671e('0x21')][_0x671e('0x22')]({'raw':_0x85d5b0[_0x671e('0x19')]?_0x85d5b0['options'][_0x671e('0x23')]===undefined?!![]:![]:!![],'where':_0x85d5b0['options']?_0x85d5b0[_0x671e('0x19')][_0x671e('0x1a')]||null:null,'attributes':_0x85d5b0['options']?_0x85d5b0[_0x671e('0x19')]['attributes']||null:null,'include':_0x85d5b0[_0x671e('0x19')]?_0x85d5b0[_0x671e('0x19')][_0x671e('0x1c')]?_[_0x671e('0x1f')](_0x85d5b0[_0x671e('0x19')][_0x671e('0x1c')],function(_0x55e814){return{'model':db[_0x55e814['model']],'as':_0x55e814['as'],'attributes':_0x55e814[_0x671e('0x1e')],'include':_0x55e814[_0x671e('0x1c')]?_[_0x671e('0x1f')](_0x55e814[_0x671e('0x1c')],function(_0x2a86db){return{'model':db[_0x2a86db[_0x671e('0x1d')]],'as':_0x2a86db['as'],'attributes':_0x2a86db['attributes'],'include':_0x2a86db[_0x671e('0x1c')]?_[_0x671e('0x1f')](_0x2a86db[_0x671e('0x1c')],function(_0x3ed427){return{'model':db[_0x3ed427[_0x671e('0x1d')]],'as':_0x3ed427['as'],'attributes':_0x3ed427[_0x671e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x671e('0xb')](function(_0x44672a){logger[_0x671e('0xc')](_0x671e('0x20'),_0x85d5b0);logger['debug'](_0x671e('0x20'),_0x85d5b0,JSON[_0x671e('0xf')](_0x44672a));_0x42bd69(_0x44672a);})[_0x671e('0x16')](function(_0x38a4b2){logger['error'](_0x671e('0x20'),_0x38a4b2[_0x671e('0x12')],_0x85d5b0);_0x1bfb50(_0xd11c1['error'](0x1f4,_0x38a4b2[_0x671e('0x12')]));});});}; \ No newline at end of file +var _0xd44a=['options','raw','attributes','include','model','map','GetFreshdeskAccount','debug','catch','ShowFreshdeskAccount','find','where','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','FreshdeskAccount','findAll'];(function(_0x177cc9,_0x3f6fdd){var _0x2fe577=function(_0xa98e83){while(--_0xa98e83){_0x177cc9['push'](_0x177cc9['shift']());}};_0x2fe577(++_0x3f6fdd);}(_0xd44a,0x136));var _0xad44=function(_0x4cb5c6,_0x6d9d98){_0x4cb5c6=_0x4cb5c6-0x0;var _0x4ad65a=_0xd44a[_0x4cb5c6];return _0x4ad65a;};'use strict';var _=require(_0xad44('0x0'));var util=require('util');var moment=require(_0xad44('0x1'));var BPromise=require(_0xad44('0x2'));var rs=require(_0xad44('0x3'));var fs=require('fs');var Redis=require(_0xad44('0x4'));var db=require(_0xad44('0x5'))['db'];var utils=require(_0xad44('0x6'));var logger=require(_0xad44('0x7'))(_0xad44('0x8'));var config=require(_0xad44('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xad44('0xa')][_0xad44('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53c43,_0x3a4203,_0x32378a){return new BPromise(function(_0x13bdae,_0x301726){return client['request'](_0x53c43,_0x32378a)['then'](function(_0x565451){logger[_0xad44('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x3a4203,'request\x20sent');logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x3a4203,'request\x20sent',JSON[_0xad44('0xd')](_0x565451));if(_0x565451[_0xad44('0xe')]){if(_0x565451[_0xad44('0xe')][_0xad44('0xf')]===0x1f4){logger[_0xad44('0xe')](_0xad44('0x10'),_0x3a4203,_0x565451[_0xad44('0xe')][_0xad44('0x11')]);return _0x301726(_0x565451[_0xad44('0xe')]['message']);}logger[_0xad44('0xe')](_0xad44('0x10'),_0x3a4203,_0x565451[_0xad44('0xe')][_0xad44('0x11')]);return _0x13bdae(_0x565451['error'][_0xad44('0x11')]);}else{logger['info'](_0xad44('0x10'),_0x3a4203,'request\x20sent');_0x13bdae(_0x565451['result'][_0xad44('0x11')]);}})['catch'](function(_0x2eed72){logger[_0xad44('0xe')](_0xad44('0x10'),_0x3a4203,_0x2eed72);_0x301726(_0x2eed72);});});}exports['GetFreshdeskAccount']=function(_0x18cb5a){var _0x2014da=this;return new Promise(function(_0x15c401,_0x991209){return db[_0xad44('0x12')][_0xad44('0x13')]({'raw':_0x18cb5a[_0xad44('0x14')]?_0x18cb5a[_0xad44('0x14')][_0xad44('0x15')]===undefined?!![]:![]:!![],'where':_0x18cb5a[_0xad44('0x14')]?_0x18cb5a[_0xad44('0x14')]['where']||null:null,'attributes':_0x18cb5a[_0xad44('0x14')]?_0x18cb5a[_0xad44('0x14')][_0xad44('0x16')]||null:null,'limit':_0x18cb5a[_0xad44('0x14')]?_0x18cb5a[_0xad44('0x14')]['limit']||null:null,'include':_0x18cb5a[_0xad44('0x14')]?_0x18cb5a[_0xad44('0x14')][_0xad44('0x17')]?_['map'](_0x18cb5a[_0xad44('0x14')][_0xad44('0x17')],function(_0x293fcd){return{'model':db[_0x293fcd[_0xad44('0x18')]],'as':_0x293fcd['as'],'attributes':_0x293fcd['attributes'],'include':_0x293fcd[_0xad44('0x17')]?_[_0xad44('0x19')](_0x293fcd[_0xad44('0x17')],function(_0x1a9bab){return{'model':db[_0x1a9bab[_0xad44('0x18')]],'as':_0x1a9bab['as'],'attributes':_0x1a9bab[_0xad44('0x16')],'include':_0x1a9bab[_0xad44('0x17')]?_[_0xad44('0x19')](_0x1a9bab[_0xad44('0x17')],function(_0x440611){return{'model':db[_0x440611[_0xad44('0x18')]],'as':_0x440611['as'],'attributes':_0x440611[_0xad44('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23d917){logger['info'](_0xad44('0x1a'),_0x18cb5a);logger[_0xad44('0x1b')](_0xad44('0x1a'),_0x18cb5a,JSON[_0xad44('0xd')](_0x23d917));_0x15c401(_0x23d917);})[_0xad44('0x1c')](function(_0x40450c){logger[_0xad44('0xe')](_0xad44('0x1a'),_0x40450c[_0xad44('0x11')],_0x18cb5a);_0x991209(_0x2014da['error'](0x1f4,_0x40450c[_0xad44('0x11')]));});});};exports[_0xad44('0x1d')]=function(_0x29faaf){var _0x21447c=this;return new Promise(function(_0xbef550,_0x445220){return db[_0xad44('0x12')][_0xad44('0x1e')]({'raw':_0x29faaf['options']?_0x29faaf['options'][_0xad44('0x15')]===undefined?!![]:![]:!![],'where':_0x29faaf[_0xad44('0x14')]?_0x29faaf['options'][_0xad44('0x1f')]||null:null,'attributes':_0x29faaf['options']?_0x29faaf[_0xad44('0x14')][_0xad44('0x16')]||null:null,'include':_0x29faaf['options']?_0x29faaf[_0xad44('0x14')][_0xad44('0x17')]?_[_0xad44('0x19')](_0x29faaf['options'][_0xad44('0x17')],function(_0x10f53c){return{'model':db[_0x10f53c[_0xad44('0x18')]],'as':_0x10f53c['as'],'attributes':_0x10f53c['attributes'],'include':_0x10f53c[_0xad44('0x17')]?_[_0xad44('0x19')](_0x10f53c[_0xad44('0x17')],function(_0x2abf18){return{'model':db[_0x2abf18[_0xad44('0x18')]],'as':_0x2abf18['as'],'attributes':_0x2abf18[_0xad44('0x16')],'include':_0x2abf18[_0xad44('0x17')]?_['map'](_0x2abf18[_0xad44('0x17')],function(_0x2c8dd9){return{'model':db[_0x2c8dd9[_0xad44('0x18')]],'as':_0x2c8dd9['as'],'attributes':_0x2c8dd9[_0xad44('0x16')]};}):[]};}):[]};}):[]:[]})[_0xad44('0x20')](function(_0x40b98b){logger[_0xad44('0xc')](_0xad44('0x1d'),_0x29faaf);logger['debug'](_0xad44('0x1d'),_0x29faaf,JSON[_0xad44('0xd')](_0x40b98b));_0xbef550(_0x40b98b);})[_0xad44('0x1c')](function(_0x460292){logger[_0xad44('0xe')](_0xad44('0x1d'),_0x460292['message'],_0x29faaf);_0x445220(_0x21447c[_0xad44('0xe')](0x1f4,_0x460292[_0xad44('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 185fab5..5055d4e 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 _0x13e2=['setTags','put','/:id','update','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post'];(function(_0x344e24,_0x59423a){var _0x2fbf22=function(_0x2b5d9f){while(--_0x2b5d9f){_0x344e24['push'](_0x344e24['shift']());}};_0x2fbf22(++_0x59423a);}(_0x13e2,0x14a));var _0x213e=function(_0x2bb927,_0xe715fc){_0x2bb927=_0x2bb927-0x0;var _0x448656=_0x13e2[_0x2bb927];return _0x448656;};'use strict';var multer=require(_0x213e('0x0'));var util=require('util');var path=require(_0x213e('0x1'));var timeout=require(_0x213e('0x2'));var express=require('express');var router=express[_0x213e('0x3')]();var fs_extra=require(_0x213e('0x4'));var auth=require(_0x213e('0x5'));var interaction=require(_0x213e('0x6'));var config=require(_0x213e('0x7'));var controller=require(_0x213e('0x8'));router[_0x213e('0x9')]('/',auth[_0x213e('0xa')](),controller['index']);router['get']('/:id',auth[_0x213e('0xa')](),controller[_0x213e('0xb')]);router[_0x213e('0x9')]('/:id/fields',auth[_0x213e('0xa')](),controller[_0x213e('0xc')]);router[_0x213e('0x9')](_0x213e('0xd'),auth[_0x213e('0xa')](),controller['getSubjects']);router[_0x213e('0x9')](_0x213e('0xe'),auth[_0x213e('0xa')](),controller[_0x213e('0xf')]);router[_0x213e('0x9')](_0x213e('0x10'),auth[_0x213e('0xa')](),controller[_0x213e('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x213e('0x12')]);router[_0x213e('0x13')](_0x213e('0x10'),auth[_0x213e('0xa')](),controller[_0x213e('0x14')]);router[_0x213e('0x15')](_0x213e('0x16'),auth[_0x213e('0xa')](),controller[_0x213e('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x213e('0x18')]);module['exports']=router; \ No newline at end of file +var _0xebb2=['multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','delete','destroy','exports'];(function(_0x4ae660,_0x150d3a){var _0x2e59bd=function(_0x378228){while(--_0x378228){_0x4ae660['push'](_0x4ae660['shift']());}};_0x2e59bd(++_0x150d3a);}(_0xebb2,0x145));var _0x2ebb=function(_0x39417f,_0x2ac630){_0x39417f=_0x39417f-0x0;var _0x52ec97=_0xebb2[_0x39417f];return _0x52ec97;};'use strict';var multer=require(_0x2ebb('0x0'));var util=require('util');var path=require(_0x2ebb('0x1'));var timeout=require(_0x2ebb('0x2'));var express=require(_0x2ebb('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2ebb('0x4'));var interaction=require(_0x2ebb('0x5'));var config=require(_0x2ebb('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x2ebb('0x7')]('/',auth[_0x2ebb('0x8')](),controller['index']);router[_0x2ebb('0x7')](_0x2ebb('0x9'),auth[_0x2ebb('0x8')](),controller[_0x2ebb('0xa')]);router[_0x2ebb('0x7')](_0x2ebb('0xb'),auth[_0x2ebb('0x8')](),controller[_0x2ebb('0xc')]);router[_0x2ebb('0x7')](_0x2ebb('0xd'),auth[_0x2ebb('0x8')](),controller[_0x2ebb('0xe')]);router[_0x2ebb('0x7')](_0x2ebb('0xf'),auth['isAuthenticated'](),controller[_0x2ebb('0x10')]);router['get'](_0x2ebb('0x11'),auth['isAuthenticated'](),controller['getTags']);router[_0x2ebb('0x12')]('/',auth[_0x2ebb('0x8')](),controller[_0x2ebb('0x13')]);router[_0x2ebb('0x12')](_0x2ebb('0x11'),auth['isAuthenticated'](),controller['setTags']);router[_0x2ebb('0x14')](_0x2ebb('0x9'),auth[_0x2ebb('0x8')](),controller[_0x2ebb('0x15')]);router[_0x2ebb('0x16')](_0x2ebb('0x9'),auth['isAuthenticated'](),controller[_0x2ebb('0x17')]);module[_0x2ebb('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 1f27270..a688135 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 _0xd5b0=['exports','STRING','sequelize'];(function(_0x57c601,_0x3293a2){var _0x10d301=function(_0x37c889){while(--_0x37c889){_0x57c601['push'](_0x57c601['shift']());}};_0x10d301(++_0x3293a2);}(_0xd5b0,0x7a));var _0x0d5b=function(_0x3dd3df,_0x4a6216){_0x3dd3df=_0x3dd3df-0x0;var _0x4ce332=_0xd5b0[_0x3dd3df];return _0x4ce332;};'use strict';var Sequelize=require(_0x0d5b('0x0'));module[_0x0d5b('0x1')]={'name':{'type':Sequelize[_0x0d5b('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'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 178c832..19c400d 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 _0x78a9=['map','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','FreshdeskConfiguration','include','findAll','rows','show','params','keys','rawAttributes','includeAll','options','update','body','find','getFields','findOne','FreshdeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','destroy','sendStatus','stack','name','send','index'];(function(_0x5870ce,_0x347c07){var _0x2d45fc=function(_0x17af0e){while(--_0x17af0e){_0x5870ce['push'](_0x5870ce['shift']());}};_0x2d45fc(++_0x347c07);}(_0x78a9,0x85));var _0x978a=function(_0x3eaa71,_0x112013){_0x3eaa71=_0x3eaa71-0x0;var _0x3481df=_0x78a9[_0x3eaa71];return _0x3481df;};'use strict';var emlformat=require(_0x978a('0x0'));var rimraf=require(_0x978a('0x1'));var zipdir=require(_0x978a('0x2'));var jsonpatch=require(_0x978a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x978a('0x4'));var util=require(_0x978a('0x5'));var path=require('path');var sox=require(_0x978a('0x6'));var csv=require('to-csv');var ejs=require(_0x978a('0x7'));var fs=require('fs');var fs_extra=require(_0x978a('0x8'));var _=require(_0x978a('0x9'));var squel=require(_0x978a('0xa'));var crypto=require(_0x978a('0xb'));var jsforce=require(_0x978a('0xc'));var deskjs=require(_0x978a('0xd'));var toCsv=require(_0x978a('0xe'));var querystring=require(_0x978a('0xf'));var Papa=require('papaparse');var Redis=require(_0x978a('0x10'));var authService=require(_0x978a('0x11'));var qs=require(_0x978a('0x12'));var as=require(_0x978a('0x13'));var hardwareService=require(_0x978a('0x14'));var logger=require(_0x978a('0x15'))('api');var utils=require(_0x978a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x978a('0x17'))['db'];var jayson=require(_0x978a('0x18'));var client=jayson[_0x978a('0x19')][_0x978a('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1df263,_0x45f2c3,_0x7383e7,_0x32532a){return new BPromise(function(_0x592598,_0x1ce9f2){var _0x2a7ea9=_0x32532a||client;return _0x2a7ea9[_0x978a('0x1b')](_0x1df263,_0x7383e7)[_0x978a('0x1c')](function(_0x15411f){logger[_0x978a('0x1d')](_0x978a('0x1e'),_0x45f2c3,_0x978a('0x1f'));logger['debug'](_0x978a('0x20'),_0x45f2c3,'request\x20sent',JSON['stringify'](_0x15411f));if(_0x15411f[_0x978a('0x21')]){if(_0x15411f[_0x978a('0x21')]['code']===0x1f4){logger[_0x978a('0x21')](_0x978a('0x1e'),_0x45f2c3,_0x15411f[_0x978a('0x21')][_0x978a('0x22')]);return _0x1ce9f2(_0x15411f['error'][_0x978a('0x22')]);}logger[_0x978a('0x21')](_0x978a('0x1e'),_0x45f2c3,_0x15411f[_0x978a('0x21')][_0x978a('0x22')]);return _0x592598(_0x15411f[_0x978a('0x21')][_0x978a('0x22')]);}else{logger['info'](_0x978a('0x1e'),_0x45f2c3,_0x978a('0x1f'));_0x592598(_0x15411f['result'][_0x978a('0x22')]);}})[_0x978a('0x23')](function(_0x441408){logger[_0x978a('0x21')](_0x978a('0x1e'),_0x45f2c3,_0x441408);_0x1ce9f2(_0x441408);});});}function respondWithStatusCode(_0x2038ac,_0x8c0ddf){_0x8c0ddf=_0x8c0ddf||0xcc;return function(_0x377a97){if(_0x377a97){return _0x2038ac['sendStatus'](_0x8c0ddf);}return _0x2038ac[_0x978a('0x24')](_0x8c0ddf)[_0x978a('0x25')]();};}function respondWithResult(_0x4e1a4a,_0x320abc){_0x320abc=_0x320abc||0xc8;return function(_0x4e3832){if(_0x4e3832){return _0x4e1a4a[_0x978a('0x24')](_0x320abc)['json'](_0x4e3832);}};}function respondWithFilteredResult(_0x4d9cb3,_0x2e9aa){return function(_0x3345e7){if(_0x3345e7){var _0x143bae=typeof _0x2e9aa[_0x978a('0x26')]===_0x978a('0x27')&&typeof _0x2e9aa[_0x978a('0x28')]===_0x978a('0x27');var _0x2dfaf6=_0x3345e7[_0x978a('0x29')];var _0xe7f86a=_0x143bae?0x0:_0x2e9aa['offset'];var _0x5b9bc1=_0x143bae?_0x3345e7[_0x978a('0x29')]:_0x2e9aa[_0x978a('0x26')]+_0x2e9aa[_0x978a('0x28')];var _0x45e3b9;if(_0x5b9bc1>=_0x2dfaf6){_0x5b9bc1=_0x2dfaf6;_0x45e3b9=0xc8;}else{_0x45e3b9=0xce;}_0x4d9cb3[_0x978a('0x24')](_0x45e3b9);return _0x4d9cb3[_0x978a('0x2a')](_0x978a('0x2b'),_0xe7f86a+'-'+_0x5b9bc1+'/'+_0x2dfaf6)[_0x978a('0x2c')](_0x3345e7);}return null;};}function patchUpdates(_0x1bfc61){return function(_0xf0e348){try{jsonpatch[_0x978a('0x2d')](_0xf0e348,_0x1bfc61,!![]);}catch(_0x3f5b3d){return BPromise['reject'](_0x3f5b3d);}return _0xf0e348[_0x978a('0x2e')]();};}function saveUpdates(_0x520d22,_0x310455){return function(_0x5cf5c8){if(_0x5cf5c8){return _0x5cf5c8['update'](_0x520d22)[_0x978a('0x1c')](function(_0x21d5a4){return _0x21d5a4;});}return null;};}function removeEntity(_0xdc51f2,_0x11cec5){return function(_0x3d5f44){if(_0x3d5f44){return _0x3d5f44[_0x978a('0x2f')]()[_0x978a('0x1c')](function(){_0xdc51f2[_0x978a('0x24')](0xcc)[_0x978a('0x25')]();});}};}function handleEntityNotFound(_0x5c27c2,_0x325e65){return function(_0x367593){if(!_0x367593){_0x5c27c2[_0x978a('0x30')](0x194);}return _0x367593;};}function handleError(_0x224f9f,_0x5bb909){_0x5bb909=_0x5bb909||0x1f4;return function(_0x24b4dc){logger[_0x978a('0x21')](_0x24b4dc[_0x978a('0x31')]);if(_0x24b4dc[_0x978a('0x32')]){delete _0x24b4dc[_0x978a('0x32')];}_0x224f9f[_0x978a('0x24')](_0x5bb909)[_0x978a('0x33')](_0x24b4dc);};}exports[_0x978a('0x34')]=function(_0xd68a9c,_0x4b5d79){var _0xeeff8={},_0x16e379={},_0x15ff62={'count':0x0,'rows':[]};var _0x5c2b49=_[_0x978a('0x35')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x1216e){return{'name':_0x1216e['fieldName'],'type':_0x1216e[_0x978a('0x36')][_0x978a('0x37')]};});_0x16e379[_0x978a('0x38')]=_[_0x978a('0x35')](_0x5c2b49,_0x978a('0x32'));_0x16e379['query']=_['keys'](_0xd68a9c[_0x978a('0x39')]);_0x16e379[_0x978a('0x3a')]=_[_0x978a('0x3b')](_0x16e379['model'],_0x16e379[_0x978a('0x39')]);_0xeeff8[_0x978a('0x3c')]=_[_0x978a('0x3b')](_0x16e379[_0x978a('0x38')],qs[_0x978a('0x3d')](_0xd68a9c['query'][_0x978a('0x3d')]));_0xeeff8['attributes']=_0xeeff8['attributes'][_0x978a('0x3e')]?_0xeeff8['attributes']:_0x16e379['model'];if(!_0xd68a9c[_0x978a('0x39')][_0x978a('0x3f')]('nolimit')){_0xeeff8[_0x978a('0x28')]=qs[_0x978a('0x28')](_0xd68a9c['query'][_0x978a('0x28')]);_0xeeff8['offset']=qs[_0x978a('0x26')](_0xd68a9c[_0x978a('0x39')]['offset']);}_0xeeff8[_0x978a('0x40')]=qs[_0x978a('0x41')](_0xd68a9c['query']['sort']);_0xeeff8[_0x978a('0x42')]=qs[_0x978a('0x3a')](_[_0x978a('0x43')](_0xd68a9c[_0x978a('0x39')],_0x16e379[_0x978a('0x3a')]),_0x5c2b49);if(_0xd68a9c[_0x978a('0x39')][_0x978a('0x44')]){_0xeeff8[_0x978a('0x42')]=_[_0x978a('0x45')](_0xeeff8['where'],{'$or':_['map'](_0x5c2b49,function(_0x32307b){if(_0x32307b[_0x978a('0x36')]!=='VIRTUAL'){var _0x52a3b8={};_0x52a3b8[_0x32307b[_0x978a('0x32')]]={'$like':'%'+_0xd68a9c[_0x978a('0x39')]['filter']+'%'};return _0x52a3b8;}})});}_0xeeff8=_[_0x978a('0x45')]({},_0xeeff8,_0xd68a9c['options']);var _0x48cdb3={'where':_0xeeff8[_0x978a('0x42')]};return db[_0x978a('0x46')][_0x978a('0x29')](_0x48cdb3)['then'](function(_0x202e3e){_0x15ff62[_0x978a('0x29')]=_0x202e3e;if(_0xd68a9c[_0x978a('0x39')]['includeAll']){_0xeeff8[_0x978a('0x47')]=[{'all':!![]}];}return db[_0x978a('0x46')][_0x978a('0x48')](_0xeeff8);})[_0x978a('0x1c')](function(_0x2250a3){_0x15ff62[_0x978a('0x49')]=_0x2250a3;return _0x15ff62;})[_0x978a('0x1c')](respondWithFilteredResult(_0x4b5d79,_0xeeff8))[_0x978a('0x23')](handleError(_0x4b5d79,null));};exports[_0x978a('0x4a')]=function(_0x17341c,_0x4936ac){var _0x28eecc={'raw':![],'where':{'id':_0x17341c[_0x978a('0x4b')]['id']}},_0x2d6f67={};_0x2d6f67[_0x978a('0x38')]=_[_0x978a('0x4c')](db[_0x978a('0x46')][_0x978a('0x4d')]);_0x2d6f67['query']=_['keys'](_0x17341c[_0x978a('0x39')]);_0x2d6f67[_0x978a('0x3a')]=_[_0x978a('0x3b')](_0x2d6f67['model'],_0x2d6f67[_0x978a('0x39')]);_0x28eecc[_0x978a('0x3c')]=_[_0x978a('0x3b')](_0x2d6f67['model'],qs[_0x978a('0x3d')](_0x17341c[_0x978a('0x39')][_0x978a('0x3d')]));_0x28eecc[_0x978a('0x3c')]=_0x28eecc[_0x978a('0x3c')][_0x978a('0x3e')]?_0x28eecc['attributes']:_0x2d6f67[_0x978a('0x38')];if(_0x17341c['query'][_0x978a('0x4e')]){_0x28eecc[_0x978a('0x47')]=[{'all':!![]}];}_0x28eecc=_['merge']({},_0x28eecc,_0x17341c[_0x978a('0x4f')]);return db['FreshdeskConfiguration']['find'](_0x28eecc)[_0x978a('0x1c')](handleEntityNotFound(_0x4936ac,null))[_0x978a('0x1c')](respondWithResult(_0x4936ac,null))[_0x978a('0x23')](handleError(_0x4936ac,null));};exports['create']=function(_0x3beb95,_0x186164){return db['FreshdeskConfiguration']['create'](_0x3beb95['body'],{})[_0x978a('0x1c')](respondWithResult(_0x186164,0xc9))[_0x978a('0x23')](handleError(_0x186164,null));};exports[_0x978a('0x50')]=function(_0x215fff,_0x54ef9f){if(_0x215fff[_0x978a('0x51')]['id']){delete _0x215fff[_0x978a('0x51')]['id'];}return db[_0x978a('0x46')]['find']({'where':{'id':_0x215fff[_0x978a('0x4b')]['id']}})[_0x978a('0x1c')](handleEntityNotFound(_0x54ef9f,null))[_0x978a('0x1c')](saveUpdates(_0x215fff[_0x978a('0x51')],null))[_0x978a('0x1c')](respondWithResult(_0x54ef9f,null))[_0x978a('0x23')](handleError(_0x54ef9f,null));};exports[_0x978a('0x2f')]=function(_0xab4a72,_0x1ba442){return db[_0x978a('0x46')][_0x978a('0x52')]({'where':{'id':_0xab4a72[_0x978a('0x4b')]['id']}})[_0x978a('0x1c')](handleEntityNotFound(_0x1ba442,null))[_0x978a('0x1c')](removeEntity(_0x1ba442,null))[_0x978a('0x23')](handleError(_0x1ba442,null));};exports[_0x978a('0x53')]=function(_0x2ad48d,_0x86f387,_0x297ff1){var _0x16a261={};var _0x34be66={};var _0x52176a;var _0x32b39e;return db[_0x978a('0x46')][_0x978a('0x54')]({'where':{'id':_0x2ad48d[_0x978a('0x4b')]['id']}})[_0x978a('0x1c')](handleEntityNotFound(_0x86f387,null))[_0x978a('0x1c')](function(_0x33ec06){if(_0x33ec06){_0x52176a=_0x33ec06;_0x34be66[_0x978a('0x38')]=_[_0x978a('0x4c')](db[_0x978a('0x55')][_0x978a('0x4d')]);_0x34be66[_0x978a('0x39')]=_[_0x978a('0x4c')](_0x2ad48d['query']);_0x34be66[_0x978a('0x3a')]=_[_0x978a('0x3b')](_0x34be66[_0x978a('0x38')],_0x34be66[_0x978a('0x39')]);_0x16a261[_0x978a('0x3c')]=_[_0x978a('0x3b')](_0x34be66[_0x978a('0x38')],qs[_0x978a('0x3d')](_0x2ad48d[_0x978a('0x39')]['fields']));_0x16a261[_0x978a('0x3c')]=_0x16a261[_0x978a('0x3c')][_0x978a('0x3e')]?_0x16a261[_0x978a('0x3c')]:_0x34be66['model'];_0x16a261[_0x978a('0x40')]=qs['sort'](_0x2ad48d[_0x978a('0x39')][_0x978a('0x41')]);_0x16a261[_0x978a('0x42')]=qs[_0x978a('0x3a')](_['pick'](_0x2ad48d[_0x978a('0x39')],_0x34be66[_0x978a('0x3a')]));if(_0x2ad48d[_0x978a('0x39')][_0x978a('0x44')]){_0x16a261['where']=_[_0x978a('0x45')](_0x16a261[_0x978a('0x42')],{'$or':_[_0x978a('0x35')](_0x16a261[_0x978a('0x3c')],function(_0x11f13b){var _0x2b1967={};_0x2b1967[_0x11f13b]={'$like':'%'+_0x2ad48d['query']['filter']+'%'};return _0x2b1967;})});}_0x16a261=_[_0x978a('0x45')]({},_0x16a261,_0x2ad48d['options']);return _0x52176a['getFields'](_0x16a261);}})[_0x978a('0x1c')](function(_0x54a04d){if(_0x54a04d){_0x32b39e=_0x54a04d[_0x978a('0x3e')];if(!_0x2ad48d[_0x978a('0x39')][_0x978a('0x3f')](_0x978a('0x56'))){_0x16a261[_0x978a('0x28')]=qs[_0x978a('0x28')](_0x2ad48d[_0x978a('0x39')][_0x978a('0x28')]);_0x16a261[_0x978a('0x26')]=qs['offset'](_0x2ad48d[_0x978a('0x39')][_0x978a('0x26')]);}return _0x52176a[_0x978a('0x53')](_0x16a261);}})[_0x978a('0x1c')](function(_0x3109c3){if(_0x3109c3){return _0x3109c3?{'count':_0x32b39e,'rows':_0x3109c3}:null;}})[_0x978a('0x1c')](respondWithResult(_0x86f387,null))[_0x978a('0x23')](handleError(_0x86f387,null));};exports[_0x978a('0x57')]=function(_0x349a95,_0x199a29,_0x31d380){var _0x173114={};var _0x83bad6={};var _0x26af18;var _0x1927e9;return db[_0x978a('0x46')][_0x978a('0x54')]({'where':{'id':_0x349a95[_0x978a('0x4b')]['id']}})[_0x978a('0x1c')](handleEntityNotFound(_0x199a29,null))[_0x978a('0x1c')](function(_0x29e9fc){if(_0x29e9fc){_0x26af18=_0x29e9fc;_0x83bad6[_0x978a('0x38')]=_[_0x978a('0x4c')](db[_0x978a('0x55')][_0x978a('0x4d')]);_0x83bad6[_0x978a('0x39')]=_[_0x978a('0x4c')](_0x349a95['query']);_0x83bad6[_0x978a('0x3a')]=_[_0x978a('0x3b')](_0x83bad6[_0x978a('0x38')],_0x83bad6['query']);_0x173114[_0x978a('0x3c')]=_[_0x978a('0x3b')](_0x83bad6['model'],qs['fields'](_0x349a95['query']['fields']));_0x173114[_0x978a('0x3c')]=_0x173114[_0x978a('0x3c')][_0x978a('0x3e')]?_0x173114[_0x978a('0x3c')]:_0x83bad6[_0x978a('0x38')];_0x173114[_0x978a('0x40')]=qs[_0x978a('0x41')](_0x349a95[_0x978a('0x39')][_0x978a('0x41')]);_0x173114['where']=qs[_0x978a('0x3a')](_[_0x978a('0x43')](_0x349a95[_0x978a('0x39')],_0x83bad6[_0x978a('0x3a')]));if(_0x349a95[_0x978a('0x39')][_0x978a('0x44')]){_0x173114[_0x978a('0x42')]=_[_0x978a('0x45')](_0x173114[_0x978a('0x42')],{'$or':_['map'](_0x173114[_0x978a('0x3c')],function(_0x1fe414){var _0x415c13={};_0x415c13[_0x1fe414]={'$like':'%'+_0x349a95[_0x978a('0x39')]['filter']+'%'};return _0x415c13;})});}_0x173114=_[_0x978a('0x45')]({},_0x173114,_0x349a95[_0x978a('0x4f')]);return _0x26af18[_0x978a('0x57')](_0x173114);}})[_0x978a('0x1c')](function(_0x28979f){if(_0x28979f){_0x1927e9=_0x28979f[_0x978a('0x3e')];if(!_0x349a95[_0x978a('0x39')][_0x978a('0x3f')](_0x978a('0x56'))){_0x173114[_0x978a('0x28')]=qs[_0x978a('0x28')](_0x349a95[_0x978a('0x39')][_0x978a('0x28')]);_0x173114[_0x978a('0x26')]=qs[_0x978a('0x26')](_0x349a95['query'][_0x978a('0x26')]);}return _0x26af18['getSubjects'](_0x173114);}})['then'](function(_0x58c5e7){if(_0x58c5e7){return _0x58c5e7?{'count':_0x1927e9,'rows':_0x58c5e7}:null;}})[_0x978a('0x1c')](respondWithResult(_0x199a29,null))[_0x978a('0x23')](handleError(_0x199a29,null));};exports[_0x978a('0x58')]=function(_0x31736e,_0x407d7c,_0x946601){var _0x5e1373={};var _0x475711={};var _0x532c25;var _0x1a3c82;return db[_0x978a('0x46')][_0x978a('0x54')]({'where':{'id':_0x31736e[_0x978a('0x4b')]['id']}})[_0x978a('0x1c')](handleEntityNotFound(_0x407d7c,null))[_0x978a('0x1c')](function(_0x9d50a5){if(_0x9d50a5){_0x532c25=_0x9d50a5;_0x475711['model']=_[_0x978a('0x4c')](db[_0x978a('0x55')][_0x978a('0x4d')]);_0x475711['query']=_[_0x978a('0x4c')](_0x31736e[_0x978a('0x39')]);_0x475711[_0x978a('0x3a')]=_[_0x978a('0x3b')](_0x475711[_0x978a('0x38')],_0x475711[_0x978a('0x39')]);_0x5e1373[_0x978a('0x3c')]=_[_0x978a('0x3b')](_0x475711[_0x978a('0x38')],qs['fields'](_0x31736e[_0x978a('0x39')][_0x978a('0x3d')]));_0x5e1373[_0x978a('0x3c')]=_0x5e1373[_0x978a('0x3c')][_0x978a('0x3e')]?_0x5e1373[_0x978a('0x3c')]:_0x475711[_0x978a('0x38')];_0x5e1373['order']=qs[_0x978a('0x41')](_0x31736e[_0x978a('0x39')][_0x978a('0x41')]);_0x5e1373[_0x978a('0x42')]=qs[_0x978a('0x3a')](_[_0x978a('0x43')](_0x31736e[_0x978a('0x39')],_0x475711[_0x978a('0x3a')]));if(_0x31736e[_0x978a('0x39')][_0x978a('0x44')]){_0x5e1373[_0x978a('0x42')]=_[_0x978a('0x45')](_0x5e1373[_0x978a('0x42')],{'$or':_[_0x978a('0x35')](_0x5e1373[_0x978a('0x3c')],function(_0x271619){var _0x1dec05={};_0x1dec05[_0x271619]={'$like':'%'+_0x31736e[_0x978a('0x39')]['filter']+'%'};return _0x1dec05;})});}_0x5e1373=_[_0x978a('0x45')]({},_0x5e1373,_0x31736e[_0x978a('0x4f')]);return _0x532c25['getDescriptions'](_0x5e1373);}})[_0x978a('0x1c')](function(_0x5c96a1){if(_0x5c96a1){_0x1a3c82=_0x5c96a1[_0x978a('0x3e')];if(!_0x31736e[_0x978a('0x39')][_0x978a('0x3f')](_0x978a('0x56'))){_0x5e1373['limit']=qs[_0x978a('0x28')](_0x31736e[_0x978a('0x39')][_0x978a('0x28')]);_0x5e1373[_0x978a('0x26')]=qs['offset'](_0x31736e[_0x978a('0x39')][_0x978a('0x26')]);}return _0x532c25['getDescriptions'](_0x5e1373);}})[_0x978a('0x1c')](function(_0x1acc9a){if(_0x1acc9a){return _0x1acc9a?{'count':_0x1a3c82,'rows':_0x1acc9a}:null;}})[_0x978a('0x1c')](respondWithResult(_0x407d7c,null))[_0x978a('0x23')](handleError(_0x407d7c,null));};exports[_0x978a('0x59')]=function(_0x272c7f,_0x43050c,_0x4a9f75){var _0x54c86a={};var _0x3ad9bf={};var _0x594dee;var _0x3c1665;return db[_0x978a('0x46')][_0x978a('0x54')]({'where':{'id':_0x272c7f[_0x978a('0x4b')]['id']}})[_0x978a('0x1c')](handleEntityNotFound(_0x43050c,null))[_0x978a('0x1c')](function(_0x102b15){if(_0x102b15){_0x594dee=_0x102b15;_0x3ad9bf[_0x978a('0x38')]=_[_0x978a('0x4c')](db[_0x978a('0x5a')]['rawAttributes']);_0x3ad9bf[_0x978a('0x39')]=_[_0x978a('0x4c')](_0x272c7f[_0x978a('0x39')]);_0x3ad9bf[_0x978a('0x3a')]=_['intersection'](_0x3ad9bf[_0x978a('0x38')],_0x3ad9bf[_0x978a('0x39')]);_0x54c86a[_0x978a('0x3c')]=_[_0x978a('0x3b')](_0x3ad9bf[_0x978a('0x38')],qs['fields'](_0x272c7f[_0x978a('0x39')][_0x978a('0x3d')]));_0x54c86a['attributes']=_0x54c86a[_0x978a('0x3c')]['length']?_0x54c86a['attributes']:_0x3ad9bf['model'];_0x54c86a[_0x978a('0x40')]=qs[_0x978a('0x41')](_0x272c7f[_0x978a('0x39')]['sort']);_0x54c86a[_0x978a('0x42')]=qs[_0x978a('0x3a')](_[_0x978a('0x43')](_0x272c7f[_0x978a('0x39')],_0x3ad9bf['filters']));if(_0x272c7f[_0x978a('0x39')]['filter']){_0x54c86a[_0x978a('0x42')]=_[_0x978a('0x45')](_0x54c86a[_0x978a('0x42')],{'$or':_[_0x978a('0x35')](_0x54c86a[_0x978a('0x3c')],function(_0x655c25){var _0xaa0418={};_0xaa0418[_0x655c25]={'$like':'%'+_0x272c7f[_0x978a('0x39')]['filter']+'%'};return _0xaa0418;})});}_0x54c86a=_[_0x978a('0x45')]({},_0x54c86a,_0x272c7f[_0x978a('0x4f')]);return _0x594dee['getTags'](_0x54c86a);}})[_0x978a('0x1c')](function(_0x5ec15e){if(_0x5ec15e){_0x3c1665=_0x5ec15e[_0x978a('0x3e')];if(!_0x272c7f[_0x978a('0x39')][_0x978a('0x3f')](_0x978a('0x56'))){_0x54c86a[_0x978a('0x28')]=qs['limit'](_0x272c7f[_0x978a('0x39')][_0x978a('0x28')]);_0x54c86a['offset']=qs[_0x978a('0x26')](_0x272c7f[_0x978a('0x39')][_0x978a('0x26')]);}return _0x594dee[_0x978a('0x59')](_0x54c86a);}})[_0x978a('0x1c')](function(_0x281e14){if(_0x281e14){return _0x281e14?{'count':_0x3c1665,'rows':_0x281e14}:null;}})[_0x978a('0x1c')](respondWithResult(_0x43050c,null))[_0x978a('0x23')](handleError(_0x43050c,null));};exports[_0x978a('0x5b')]=function(_0x1f60e5,_0x30e2b7,_0x2e54da){if(_0x1f60e5[_0x978a('0x51')]['id']){delete _0x1f60e5[_0x978a('0x51')]['id'];}return db[_0x978a('0x46')]['findOne']({'where':{'id':_0x1f60e5[_0x978a('0x4b')]['id']}})[_0x978a('0x1c')](handleEntityNotFound(_0x30e2b7,null))[_0x978a('0x1c')](function(_0x58dafd){if(_0x58dafd){return _0x58dafd[_0x978a('0x5b')](_0x1f60e5[_0x978a('0x51')][_0x978a('0x5c')]||[]);}return null;})[_0x978a('0x1c')](respondWithResult(_0x30e2b7,null))['catch'](handleError(_0x30e2b7,null));}; \ No newline at end of file +var _0x6845=['json','save','send','index','map','fieldName','type','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','FreshdeskConfiguration','include','findAll','rawAttributes','includeAll','find','create','body','update','getFields','findOne','params','FreshdeskField','order','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count'];(function(_0xe67d1c,_0x1b21d1){var _0x11673c=function(_0x119660){while(--_0x119660){_0xe67d1c['push'](_0xe67d1c['shift']());}};_0x11673c(++_0x1b21d1);}(_0x6845,0x1ef));var _0x5684=function(_0xc9155c,_0x53f2ad){_0xc9155c=_0xc9155c-0x0;var _0x5cb3e6=_0x6845[_0xc9155c];return _0x5cb3e6;};'use strict';var emlformat=require(_0x5684('0x0'));var rimraf=require(_0x5684('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5684('0x2'));var moment=require(_0x5684('0x3'));var BPromise=require(_0x5684('0x4'));var Mustache=require(_0x5684('0x5'));var util=require(_0x5684('0x6'));var path=require(_0x5684('0x7'));var sox=require('sox');var csv=require(_0x5684('0x8'));var ejs=require(_0x5684('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5684('0xa'));var squel=require('squel');var crypto=require(_0x5684('0xb'));var jsforce=require(_0x5684('0xc'));var deskjs=require(_0x5684('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5684('0xe'));var Papa=require(_0x5684('0xf'));var Redis=require(_0x5684('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5684('0x11'));var hardwareService=require(_0x5684('0x12'));var logger=require(_0x5684('0x13'))(_0x5684('0x14'));var utils=require(_0x5684('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5684('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x5684('0x17'));var client=jayson['client'][_0x5684('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x392d42,_0x491b84,_0x20fa02,_0x13eded){return new BPromise(function(_0x109d75,_0x177809){var _0x5a14ce=_0x13eded||client;return _0x5a14ce[_0x5684('0x19')](_0x392d42,_0x20fa02)[_0x5684('0x1a')](function(_0x4fee39){logger[_0x5684('0x1b')](_0x5684('0x1c'),_0x491b84,_0x5684('0x1d'));logger[_0x5684('0x1e')](_0x5684('0x1f'),_0x491b84,_0x5684('0x1d'),JSON[_0x5684('0x20')](_0x4fee39));if(_0x4fee39[_0x5684('0x21')]){if(_0x4fee39[_0x5684('0x21')][_0x5684('0x22')]===0x1f4){logger[_0x5684('0x21')](_0x5684('0x1c'),_0x491b84,_0x4fee39['error'][_0x5684('0x23')]);return _0x177809(_0x4fee39[_0x5684('0x21')][_0x5684('0x23')]);}logger['error'](_0x5684('0x1c'),_0x491b84,_0x4fee39['error'][_0x5684('0x23')]);return _0x109d75(_0x4fee39[_0x5684('0x21')]['message']);}else{logger['info'](_0x5684('0x1c'),_0x491b84,_0x5684('0x1d'));_0x109d75(_0x4fee39[_0x5684('0x24')][_0x5684('0x23')]);}})[_0x5684('0x25')](function(_0x31a5dd){logger[_0x5684('0x21')](_0x5684('0x1c'),_0x491b84,_0x31a5dd);_0x177809(_0x31a5dd);});});}function respondWithStatusCode(_0x37c612,_0x2d04d7){_0x2d04d7=_0x2d04d7||0xcc;return function(_0x38ac3f){if(_0x38ac3f){return _0x37c612[_0x5684('0x26')](_0x2d04d7);}return _0x37c612[_0x5684('0x27')](_0x2d04d7)[_0x5684('0x28')]();};}function respondWithResult(_0xf2fb4,_0x4c5015){_0x4c5015=_0x4c5015||0xc8;return function(_0x345293){if(_0x345293){return _0xf2fb4[_0x5684('0x27')](_0x4c5015)['json'](_0x345293);}};}function respondWithFilteredResult(_0x2a7c3e,_0x10bc7c){return function(_0x88a914){if(_0x88a914){var _0xd65ab7=typeof _0x10bc7c[_0x5684('0x29')]===_0x5684('0x2a')&&typeof _0x10bc7c[_0x5684('0x2b')]===_0x5684('0x2a');var _0x15c003=_0x88a914[_0x5684('0x2c')];var _0x4809cc=_0xd65ab7?0x0:_0x10bc7c['offset'];var _0x21fe39=_0xd65ab7?_0x88a914['count']:_0x10bc7c['offset']+_0x10bc7c[_0x5684('0x2b')];var _0x4cbf75;if(_0x21fe39>=_0x15c003){_0x21fe39=_0x15c003;_0x4cbf75=0xc8;}else{_0x4cbf75=0xce;}_0x2a7c3e['status'](_0x4cbf75);return _0x2a7c3e['set']('Content-Range',_0x4809cc+'-'+_0x21fe39+'/'+_0x15c003)[_0x5684('0x2d')](_0x88a914);}return null;};}function patchUpdates(_0x491394){return function(_0x4d0163){try{jsonpatch['apply'](_0x4d0163,_0x491394,!![]);}catch(_0x4d4e93){return BPromise['reject'](_0x4d4e93);}return _0x4d0163[_0x5684('0x2e')]();};}function saveUpdates(_0x486200,_0x2e8b1f){return function(_0x58142d){if(_0x58142d){return _0x58142d['update'](_0x486200)[_0x5684('0x1a')](function(_0x1ee20d){return _0x1ee20d;});}return null;};}function removeEntity(_0x1e2176,_0x18824f){return function(_0x2005cd){if(_0x2005cd){return _0x2005cd['destroy']()[_0x5684('0x1a')](function(){_0x1e2176[_0x5684('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10fc23,_0x565b00){return function(_0xb7a8a5){if(!_0xb7a8a5){_0x10fc23[_0x5684('0x26')](0x194);}return _0xb7a8a5;};}function handleError(_0x5279b9,_0x491b09){_0x491b09=_0x491b09||0x1f4;return function(_0x45b7c3){logger['error'](_0x45b7c3['stack']);if(_0x45b7c3['name']){delete _0x45b7c3['name'];}_0x5279b9[_0x5684('0x27')](_0x491b09)[_0x5684('0x2f')](_0x45b7c3);};}exports[_0x5684('0x30')]=function(_0x3c201b,_0x4e2fdb){var _0x8d953c={},_0x21b76f={},_0x1a7630={'count':0x0,'rows':[]};var _0x238b70=_[_0x5684('0x31')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x5d5d33){return{'name':_0x5d5d33[_0x5684('0x32')],'type':_0x5d5d33[_0x5684('0x33')]['key']};});_0x21b76f['model']=_['map'](_0x238b70,_0x5684('0x34'));_0x21b76f[_0x5684('0x35')]=_[_0x5684('0x36')](_0x3c201b[_0x5684('0x35')]);_0x21b76f[_0x5684('0x37')]=_[_0x5684('0x38')](_0x21b76f[_0x5684('0x39')],_0x21b76f[_0x5684('0x35')]);_0x8d953c[_0x5684('0x3a')]=_[_0x5684('0x38')](_0x21b76f['model'],qs[_0x5684('0x3b')](_0x3c201b['query'][_0x5684('0x3b')]));_0x8d953c['attributes']=_0x8d953c['attributes'][_0x5684('0x3c')]?_0x8d953c[_0x5684('0x3a')]:_0x21b76f['model'];if(!_0x3c201b[_0x5684('0x35')][_0x5684('0x3d')](_0x5684('0x3e'))){_0x8d953c['limit']=qs[_0x5684('0x2b')](_0x3c201b[_0x5684('0x35')]['limit']);_0x8d953c[_0x5684('0x29')]=qs[_0x5684('0x29')](_0x3c201b[_0x5684('0x35')]['offset']);}_0x8d953c['order']=qs[_0x5684('0x3f')](_0x3c201b['query'][_0x5684('0x3f')]);_0x8d953c[_0x5684('0x40')]=qs[_0x5684('0x37')](_['pick'](_0x3c201b[_0x5684('0x35')],_0x21b76f[_0x5684('0x37')]),_0x238b70);if(_0x3c201b[_0x5684('0x35')][_0x5684('0x41')]){_0x8d953c[_0x5684('0x40')]=_[_0x5684('0x42')](_0x8d953c[_0x5684('0x40')],{'$or':_['map'](_0x238b70,function(_0x1bbe0f){if(_0x1bbe0f[_0x5684('0x33')]!==_0x5684('0x43')){var _0x253205={};_0x253205[_0x1bbe0f[_0x5684('0x34')]]={'$like':'%'+_0x3c201b['query'][_0x5684('0x41')]+'%'};return _0x253205;}})});}_0x8d953c=_[_0x5684('0x42')]({},_0x8d953c,_0x3c201b[_0x5684('0x44')]);var _0x20ff62={'where':_0x8d953c[_0x5684('0x40')]};return db[_0x5684('0x45')][_0x5684('0x2c')](_0x20ff62)[_0x5684('0x1a')](function(_0x2ddc45){_0x1a7630['count']=_0x2ddc45;if(_0x3c201b[_0x5684('0x35')]['includeAll']){_0x8d953c[_0x5684('0x46')]=[{'all':!![]}];}return db[_0x5684('0x45')][_0x5684('0x47')](_0x8d953c);})[_0x5684('0x1a')](function(_0x9671ba){_0x1a7630['rows']=_0x9671ba;return _0x1a7630;})[_0x5684('0x1a')](respondWithFilteredResult(_0x4e2fdb,_0x8d953c))[_0x5684('0x25')](handleError(_0x4e2fdb,null));};exports['show']=function(_0x5be039,_0x256ba8){var _0x32df64={'raw':![],'where':{'id':_0x5be039['params']['id']}},_0x4d784e={};_0x4d784e['model']=_[_0x5684('0x36')](db[_0x5684('0x45')][_0x5684('0x48')]);_0x4d784e['query']=_[_0x5684('0x36')](_0x5be039[_0x5684('0x35')]);_0x4d784e[_0x5684('0x37')]=_[_0x5684('0x38')](_0x4d784e[_0x5684('0x39')],_0x4d784e[_0x5684('0x35')]);_0x32df64[_0x5684('0x3a')]=_['intersection'](_0x4d784e[_0x5684('0x39')],qs['fields'](_0x5be039[_0x5684('0x35')]['fields']));_0x32df64[_0x5684('0x3a')]=_0x32df64[_0x5684('0x3a')][_0x5684('0x3c')]?_0x32df64[_0x5684('0x3a')]:_0x4d784e[_0x5684('0x39')];if(_0x5be039[_0x5684('0x35')][_0x5684('0x49')]){_0x32df64[_0x5684('0x46')]=[{'all':!![]}];}_0x32df64=_[_0x5684('0x42')]({},_0x32df64,_0x5be039[_0x5684('0x44')]);return db[_0x5684('0x45')][_0x5684('0x4a')](_0x32df64)[_0x5684('0x1a')](handleEntityNotFound(_0x256ba8,null))[_0x5684('0x1a')](respondWithResult(_0x256ba8,null))[_0x5684('0x25')](handleError(_0x256ba8,null));};exports[_0x5684('0x4b')]=function(_0x228748,_0x581074){return db['FreshdeskConfiguration']['create'](_0x228748[_0x5684('0x4c')],{})[_0x5684('0x1a')](respondWithResult(_0x581074,0xc9))[_0x5684('0x25')](handleError(_0x581074,null));};exports[_0x5684('0x4d')]=function(_0x1e644b,_0x48fae0){if(_0x1e644b[_0x5684('0x4c')]['id']){delete _0x1e644b[_0x5684('0x4c')]['id'];}return db['FreshdeskConfiguration'][_0x5684('0x4a')]({'where':{'id':_0x1e644b['params']['id']}})['then'](handleEntityNotFound(_0x48fae0,null))[_0x5684('0x1a')](saveUpdates(_0x1e644b['body'],null))[_0x5684('0x1a')](respondWithResult(_0x48fae0,null))[_0x5684('0x25')](handleError(_0x48fae0,null));};exports['destroy']=function(_0xc03660,_0x3bf169){return db['FreshdeskConfiguration'][_0x5684('0x4a')]({'where':{'id':_0xc03660['params']['id']}})['then'](handleEntityNotFound(_0x3bf169,null))[_0x5684('0x1a')](removeEntity(_0x3bf169,null))[_0x5684('0x25')](handleError(_0x3bf169,null));};exports[_0x5684('0x4e')]=function(_0x353f6d,_0x1b11a9,_0x27d86f){var _0x5195e3={};var _0x3c861e={};var _0x1a7c14;var _0x2d918;return db[_0x5684('0x45')][_0x5684('0x4f')]({'where':{'id':_0x353f6d[_0x5684('0x50')]['id']}})[_0x5684('0x1a')](handleEntityNotFound(_0x1b11a9,null))[_0x5684('0x1a')](function(_0x548aec){if(_0x548aec){_0x1a7c14=_0x548aec;_0x3c861e['model']=_['keys'](db[_0x5684('0x51')]['rawAttributes']);_0x3c861e[_0x5684('0x35')]=_['keys'](_0x353f6d[_0x5684('0x35')]);_0x3c861e[_0x5684('0x37')]=_[_0x5684('0x38')](_0x3c861e[_0x5684('0x39')],_0x3c861e[_0x5684('0x35')]);_0x5195e3[_0x5684('0x3a')]=_['intersection'](_0x3c861e[_0x5684('0x39')],qs[_0x5684('0x3b')](_0x353f6d['query']['fields']));_0x5195e3['attributes']=_0x5195e3[_0x5684('0x3a')]['length']?_0x5195e3[_0x5684('0x3a')]:_0x3c861e['model'];_0x5195e3[_0x5684('0x52')]=qs[_0x5684('0x3f')](_0x353f6d['query']['sort']);_0x5195e3[_0x5684('0x40')]=qs[_0x5684('0x37')](_[_0x5684('0x53')](_0x353f6d[_0x5684('0x35')],_0x3c861e['filters']));if(_0x353f6d[_0x5684('0x35')][_0x5684('0x41')]){_0x5195e3[_0x5684('0x40')]=_[_0x5684('0x42')](_0x5195e3[_0x5684('0x40')],{'$or':_[_0x5684('0x31')](_0x5195e3[_0x5684('0x3a')],function(_0x58fbb9){var _0x17f82f={};_0x17f82f[_0x58fbb9]={'$like':'%'+_0x353f6d[_0x5684('0x35')][_0x5684('0x41')]+'%'};return _0x17f82f;})});}_0x5195e3=_[_0x5684('0x42')]({},_0x5195e3,_0x353f6d[_0x5684('0x44')]);return _0x1a7c14[_0x5684('0x4e')](_0x5195e3);}})['then'](function(_0x2858ee){if(_0x2858ee){_0x2d918=_0x2858ee['length'];if(!_0x353f6d[_0x5684('0x35')][_0x5684('0x3d')](_0x5684('0x3e'))){_0x5195e3[_0x5684('0x2b')]=qs[_0x5684('0x2b')](_0x353f6d[_0x5684('0x35')][_0x5684('0x2b')]);_0x5195e3[_0x5684('0x29')]=qs[_0x5684('0x29')](_0x353f6d[_0x5684('0x35')][_0x5684('0x29')]);}return _0x1a7c14[_0x5684('0x4e')](_0x5195e3);}})['then'](function(_0x45ebfc){if(_0x45ebfc){return _0x45ebfc?{'count':_0x2d918,'rows':_0x45ebfc}:null;}})[_0x5684('0x1a')](respondWithResult(_0x1b11a9,null))['catch'](handleError(_0x1b11a9,null));};exports[_0x5684('0x54')]=function(_0x46784b,_0x306460,_0xa672fc){var _0x1b0b4e={};var _0x5ea240={};var _0xdf54dc;var _0x48a9ad;return db[_0x5684('0x45')][_0x5684('0x4f')]({'where':{'id':_0x46784b[_0x5684('0x50')]['id']}})[_0x5684('0x1a')](handleEntityNotFound(_0x306460,null))[_0x5684('0x1a')](function(_0x5ac3c3){if(_0x5ac3c3){_0xdf54dc=_0x5ac3c3;_0x5ea240['model']=_['keys'](db[_0x5684('0x51')][_0x5684('0x48')]);_0x5ea240[_0x5684('0x35')]=_[_0x5684('0x36')](_0x46784b[_0x5684('0x35')]);_0x5ea240[_0x5684('0x37')]=_[_0x5684('0x38')](_0x5ea240['model'],_0x5ea240[_0x5684('0x35')]);_0x1b0b4e[_0x5684('0x3a')]=_[_0x5684('0x38')](_0x5ea240['model'],qs[_0x5684('0x3b')](_0x46784b[_0x5684('0x35')][_0x5684('0x3b')]));_0x1b0b4e[_0x5684('0x3a')]=_0x1b0b4e['attributes'][_0x5684('0x3c')]?_0x1b0b4e[_0x5684('0x3a')]:_0x5ea240[_0x5684('0x39')];_0x1b0b4e['order']=qs[_0x5684('0x3f')](_0x46784b[_0x5684('0x35')][_0x5684('0x3f')]);_0x1b0b4e['where']=qs[_0x5684('0x37')](_[_0x5684('0x53')](_0x46784b[_0x5684('0x35')],_0x5ea240[_0x5684('0x37')]));if(_0x46784b[_0x5684('0x35')][_0x5684('0x41')]){_0x1b0b4e[_0x5684('0x40')]=_[_0x5684('0x42')](_0x1b0b4e[_0x5684('0x40')],{'$or':_[_0x5684('0x31')](_0x1b0b4e['attributes'],function(_0x3b6964){var _0x18b39b={};_0x18b39b[_0x3b6964]={'$like':'%'+_0x46784b[_0x5684('0x35')]['filter']+'%'};return _0x18b39b;})});}_0x1b0b4e=_[_0x5684('0x42')]({},_0x1b0b4e,_0x46784b[_0x5684('0x44')]);return _0xdf54dc[_0x5684('0x54')](_0x1b0b4e);}})[_0x5684('0x1a')](function(_0x28ffc4){if(_0x28ffc4){_0x48a9ad=_0x28ffc4[_0x5684('0x3c')];if(!_0x46784b[_0x5684('0x35')][_0x5684('0x3d')](_0x5684('0x3e'))){_0x1b0b4e[_0x5684('0x2b')]=qs[_0x5684('0x2b')](_0x46784b[_0x5684('0x35')][_0x5684('0x2b')]);_0x1b0b4e[_0x5684('0x29')]=qs[_0x5684('0x29')](_0x46784b[_0x5684('0x35')][_0x5684('0x29')]);}return _0xdf54dc[_0x5684('0x54')](_0x1b0b4e);}})[_0x5684('0x1a')](function(_0x1a61a0){if(_0x1a61a0){return _0x1a61a0?{'count':_0x48a9ad,'rows':_0x1a61a0}:null;}})[_0x5684('0x1a')](respondWithResult(_0x306460,null))[_0x5684('0x25')](handleError(_0x306460,null));};exports[_0x5684('0x55')]=function(_0x4c2bdc,_0x3e86e3,_0x16da95){var _0xf7e1e7={};var _0x1a90e9={};var _0x5e449d;var _0x5ca262;return db['FreshdeskConfiguration'][_0x5684('0x4f')]({'where':{'id':_0x4c2bdc[_0x5684('0x50')]['id']}})[_0x5684('0x1a')](handleEntityNotFound(_0x3e86e3,null))[_0x5684('0x1a')](function(_0x4fc092){if(_0x4fc092){_0x5e449d=_0x4fc092;_0x1a90e9[_0x5684('0x39')]=_[_0x5684('0x36')](db[_0x5684('0x51')]['rawAttributes']);_0x1a90e9[_0x5684('0x35')]=_[_0x5684('0x36')](_0x4c2bdc[_0x5684('0x35')]);_0x1a90e9[_0x5684('0x37')]=_[_0x5684('0x38')](_0x1a90e9['model'],_0x1a90e9[_0x5684('0x35')]);_0xf7e1e7['attributes']=_[_0x5684('0x38')](_0x1a90e9[_0x5684('0x39')],qs[_0x5684('0x3b')](_0x4c2bdc[_0x5684('0x35')][_0x5684('0x3b')]));_0xf7e1e7[_0x5684('0x3a')]=_0xf7e1e7[_0x5684('0x3a')]['length']?_0xf7e1e7[_0x5684('0x3a')]:_0x1a90e9[_0x5684('0x39')];_0xf7e1e7['order']=qs['sort'](_0x4c2bdc[_0x5684('0x35')]['sort']);_0xf7e1e7[_0x5684('0x40')]=qs[_0x5684('0x37')](_[_0x5684('0x53')](_0x4c2bdc[_0x5684('0x35')],_0x1a90e9[_0x5684('0x37')]));if(_0x4c2bdc[_0x5684('0x35')]['filter']){_0xf7e1e7[_0x5684('0x40')]=_[_0x5684('0x42')](_0xf7e1e7[_0x5684('0x40')],{'$or':_[_0x5684('0x31')](_0xf7e1e7['attributes'],function(_0x5a0005){var _0x306d69={};_0x306d69[_0x5a0005]={'$like':'%'+_0x4c2bdc[_0x5684('0x35')][_0x5684('0x41')]+'%'};return _0x306d69;})});}_0xf7e1e7=_['merge']({},_0xf7e1e7,_0x4c2bdc[_0x5684('0x44')]);return _0x5e449d['getDescriptions'](_0xf7e1e7);}})[_0x5684('0x1a')](function(_0x37519b){if(_0x37519b){_0x5ca262=_0x37519b['length'];if(!_0x4c2bdc[_0x5684('0x35')][_0x5684('0x3d')](_0x5684('0x3e'))){_0xf7e1e7['limit']=qs[_0x5684('0x2b')](_0x4c2bdc[_0x5684('0x35')][_0x5684('0x2b')]);_0xf7e1e7[_0x5684('0x29')]=qs[_0x5684('0x29')](_0x4c2bdc['query']['offset']);}return _0x5e449d[_0x5684('0x55')](_0xf7e1e7);}})[_0x5684('0x1a')](function(_0x398b56){if(_0x398b56){return _0x398b56?{'count':_0x5ca262,'rows':_0x398b56}:null;}})[_0x5684('0x1a')](respondWithResult(_0x3e86e3,null))[_0x5684('0x25')](handleError(_0x3e86e3,null));};exports[_0x5684('0x56')]=function(_0x2899c0,_0x41d7b3,_0x388c0e){var _0x139fc6={};var _0x8bf316={};var _0x354578;var _0x23fab2;return db[_0x5684('0x45')][_0x5684('0x4f')]({'where':{'id':_0x2899c0[_0x5684('0x50')]['id']}})['then'](handleEntityNotFound(_0x41d7b3,null))['then'](function(_0x3d4374){if(_0x3d4374){_0x354578=_0x3d4374;_0x8bf316[_0x5684('0x39')]=_[_0x5684('0x36')](db[_0x5684('0x57')][_0x5684('0x48')]);_0x8bf316[_0x5684('0x35')]=_[_0x5684('0x36')](_0x2899c0[_0x5684('0x35')]);_0x8bf316[_0x5684('0x37')]=_['intersection'](_0x8bf316[_0x5684('0x39')],_0x8bf316['query']);_0x139fc6['attributes']=_['intersection'](_0x8bf316[_0x5684('0x39')],qs[_0x5684('0x3b')](_0x2899c0[_0x5684('0x35')][_0x5684('0x3b')]));_0x139fc6[_0x5684('0x3a')]=_0x139fc6[_0x5684('0x3a')][_0x5684('0x3c')]?_0x139fc6[_0x5684('0x3a')]:_0x8bf316[_0x5684('0x39')];_0x139fc6[_0x5684('0x52')]=qs[_0x5684('0x3f')](_0x2899c0[_0x5684('0x35')][_0x5684('0x3f')]);_0x139fc6['where']=qs[_0x5684('0x37')](_['pick'](_0x2899c0[_0x5684('0x35')],_0x8bf316[_0x5684('0x37')]));if(_0x2899c0[_0x5684('0x35')][_0x5684('0x41')]){_0x139fc6[_0x5684('0x40')]=_[_0x5684('0x42')](_0x139fc6[_0x5684('0x40')],{'$or':_[_0x5684('0x31')](_0x139fc6['attributes'],function(_0x491d62){var _0x31969f={};_0x31969f[_0x491d62]={'$like':'%'+_0x2899c0[_0x5684('0x35')][_0x5684('0x41')]+'%'};return _0x31969f;})});}_0x139fc6=_[_0x5684('0x42')]({},_0x139fc6,_0x2899c0[_0x5684('0x44')]);return _0x354578[_0x5684('0x56')](_0x139fc6);}})[_0x5684('0x1a')](function(_0x49a47a){if(_0x49a47a){_0x23fab2=_0x49a47a[_0x5684('0x3c')];if(!_0x2899c0['query'][_0x5684('0x3d')](_0x5684('0x3e'))){_0x139fc6[_0x5684('0x2b')]=qs[_0x5684('0x2b')](_0x2899c0['query'][_0x5684('0x2b')]);_0x139fc6[_0x5684('0x29')]=qs[_0x5684('0x29')](_0x2899c0[_0x5684('0x35')][_0x5684('0x29')]);}return _0x354578[_0x5684('0x56')](_0x139fc6);}})[_0x5684('0x1a')](function(_0x2d6ded){if(_0x2d6ded){return _0x2d6ded?{'count':_0x23fab2,'rows':_0x2d6ded}:null;}})['then'](respondWithResult(_0x41d7b3,null))[_0x5684('0x25')](handleError(_0x41d7b3,null));};exports[_0x5684('0x58')]=function(_0x31725d,_0x18e7b5,_0x345db5){if(_0x31725d[_0x5684('0x4c')]['id']){delete _0x31725d[_0x5684('0x4c')]['id'];}return db['FreshdeskConfiguration'][_0x5684('0x4f')]({'where':{'id':_0x31725d['params']['id']}})['then'](handleEntityNotFound(_0x18e7b5,null))[_0x5684('0x1a')](function(_0x38a04f){if(_0x38a04f){return _0x38a04f[_0x5684('0x58')](_0x31725d[_0x5684('0x4c')][_0x5684('0x59')]||[]);}return null;})[_0x5684('0x1a')](respondWithResult(_0x18e7b5,null))[_0x5684('0x25')](handleError(_0x18e7b5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 29d6b8e..47425bc 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 _0x1e4d=['rimraf','../../config/environment','define','int_freshdesk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2e2e4f,_0xda7272){var _0x25916a=function(_0xa7f9de){while(--_0xa7f9de){_0x2e2e4f['push'](_0x2e2e4f['shift']());}};_0x25916a(++_0xda7272);}(_0x1e4d,0x122));var _0xd1e4=function(_0x21a18e,_0x3f206f){_0x21a18e=_0x21a18e-0x0;var _0x49f485=_0x1e4d[_0x21a18e];return _0x49f485;};'use strict';var _=require(_0xd1e4('0x0'));var util=require(_0xd1e4('0x1'));var logger=require(_0xd1e4('0x2'))(_0xd1e4('0x3'));var moment=require('moment');var BPromise=require(_0xd1e4('0x4'));var rp=require(_0xd1e4('0x5'));var fs=require('fs');var path=require(_0xd1e4('0x6'));var rimraf=require(_0xd1e4('0x7'));var config=require(_0xd1e4('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x31d7fa,_0x2e4000){return _0x31d7fa[_0xd1e4('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0xd1e4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0409=['../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','bluebird','path'];(function(_0xc7e8c,_0x1a2912){var _0x3d97e3=function(_0x137d05){while(--_0x137d05){_0xc7e8c['push'](_0xc7e8c['shift']());}};_0x3d97e3(++_0x1a2912);}(_0x0409,0x195));var _0x9040=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x0409[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x9040('0x0'));var util=require(_0x9040('0x1'));var logger=require(_0x9040('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9040('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9040('0x4'));var rimraf=require('rimraf');var config=require(_0x9040('0x5'));var attributes=require(_0x9040('0x6'));module['exports']=function(_0xc597a7,_0x37efe2){return _0xc597a7[_0x9040('0x7')](_0x9040('0x8'),attributes,{'tableName':_0x9040('0x9'),'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 c080d39..9f9d810 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 _0x1690=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','bluebird'];(function(_0x35b95a,_0x704969){var _0x2349ce=function(_0x1c9567){while(--_0x1c9567){_0x35b95a['push'](_0x35b95a['shift']());}};_0x2349ce(++_0x704969);}(_0x1690,0x108));var _0x0169=function(_0xb900d8,_0x38c82b){_0xb900d8=_0xb900d8-0x0;var _0x429240=_0x1690[_0xb900d8];return _0x429240;};'use strict';var _=require(_0x0169('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0169('0x1'));var rs=require(_0x0169('0x2'));var fs=require('fs');var Redis=require(_0x0169('0x3'));var db=require(_0x0169('0x4'))['db'];var utils=require(_0x0169('0x5'));var logger=require('../../config/logger')(_0x0169('0x6'));var config=require('../../config/environment');var jayson=require(_0x0169('0x7'));var client=jayson['client'][_0x0169('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3040bb,_0x3c3d52,_0x7b631b){return new BPromise(function(_0x1e946d,_0x1c23f4){return client[_0x0169('0x9')](_0x3040bb,_0x7b631b)['then'](function(_0x5e6929){logger['info'](_0x0169('0xa'),_0x3c3d52,_0x0169('0xb'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3c3d52,_0x0169('0xb'),JSON[_0x0169('0xc')](_0x5e6929));if(_0x5e6929[_0x0169('0xd')]){if(_0x5e6929['error'][_0x0169('0xe')]===0x1f4){logger[_0x0169('0xd')](_0x0169('0xa'),_0x3c3d52,_0x5e6929[_0x0169('0xd')][_0x0169('0xf')]);return _0x1c23f4(_0x5e6929[_0x0169('0xd')]['message']);}logger['error'](_0x0169('0xa'),_0x3c3d52,_0x5e6929[_0x0169('0xd')][_0x0169('0xf')]);return _0x1e946d(_0x5e6929[_0x0169('0xd')][_0x0169('0xf')]);}else{logger[_0x0169('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3c3d52,_0x0169('0xb'));_0x1e946d(_0x5e6929[_0x0169('0x11')][_0x0169('0xf')]);}})[_0x0169('0x12')](function(_0x4e727c){logger[_0x0169('0xd')](_0x0169('0xa'),_0x3c3d52,_0x4e727c);_0x1c23f4(_0x4e727c);});});} \ No newline at end of file +var _0xad0e=['../../config/logger','jayson/promise','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x17b23c,_0x423472){var _0x3af1b4=function(_0x34e307){while(--_0x34e307){_0x17b23c['push'](_0x17b23c['shift']());}};_0x3af1b4(++_0x423472);}(_0xad0e,0x1da));var _0xead0=function(_0x23ad74,_0x4bd754){_0x23ad74=_0x23ad74-0x0;var _0x43d709=_0xad0e[_0x23ad74];return _0x43d709;};'use strict';var _=require(_0xead0('0x0'));var util=require('util');var moment=require(_0xead0('0x1'));var BPromise=require('bluebird');var rs=require(_0xead0('0x2'));var fs=require('fs');var Redis=require(_0xead0('0x3'));var db=require(_0xead0('0x4'))['db'];var utils=require(_0xead0('0x5'));var logger=require(_0xead0('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xead0('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x161ca9,_0x6b5d10,_0x7b38e6){return new BPromise(function(_0x8ff94c,_0xaf13fc){return client['request'](_0x161ca9,_0x7b38e6)[_0xead0('0x8')](function(_0xdded63){logger[_0xead0('0x9')](_0xead0('0xa'),_0x6b5d10,_0xead0('0xb'));logger[_0xead0('0xc')](_0xead0('0xd'),_0x6b5d10,_0xead0('0xb'),JSON[_0xead0('0xe')](_0xdded63));if(_0xdded63[_0xead0('0xf')]){if(_0xdded63[_0xead0('0xf')][_0xead0('0x10')]===0x1f4){logger[_0xead0('0xf')](_0xead0('0xa'),_0x6b5d10,_0xdded63['error']['message']);return _0xaf13fc(_0xdded63[_0xead0('0xf')][_0xead0('0x11')]);}logger[_0xead0('0xf')](_0xead0('0xa'),_0x6b5d10,_0xdded63[_0xead0('0xf')][_0xead0('0x11')]);return _0x8ff94c(_0xdded63[_0xead0('0xf')][_0xead0('0x11')]);}else{logger[_0xead0('0x9')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x6b5d10,_0xead0('0xb'));_0x8ff94c(_0xdded63[_0xead0('0x12')][_0xead0('0x11')]);}})[_0xead0('0x13')](function(_0x3ddb55){logger[_0xead0('0xf')](_0xead0('0xa'),_0x6b5d10,_0x3ddb55);_0xaf13fc(_0x3ddb55);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 4f2259d..0bed5c8 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 _0x9326=['destroy','util','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x4f40b7,_0x25132a){var _0x4a95bb=function(_0x2ee934){while(--_0x2ee934){_0x4f40b7['push'](_0x4f40b7['shift']());}};_0x4a95bb(++_0x25132a);}(_0x9326,0x171));var _0x6932=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x9326[_0x4ae625];return _0x31accf;};'use strict';var multer=require('multer');var util=require(_0x6932('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6932('0x1'));var router=express['Router']();var fs_extra=require(_0x6932('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x6932('0x3'));var config=require(_0x6932('0x4'));var controller=require(_0x6932('0x5'));router[_0x6932('0x6')]('/',auth[_0x6932('0x7')](),controller[_0x6932('0x8')]);router[_0x6932('0x6')](_0x6932('0x9'),auth['isAuthenticated'](),controller[_0x6932('0xa')]);router[_0x6932('0xb')]('/',auth['isAuthenticated'](),controller[_0x6932('0xc')]);router[_0x6932('0xd')](_0x6932('0x9'),auth['isAuthenticated'](),controller[_0x6932('0xe')]);router['delete'](_0x6932('0x9'),auth[_0x6932('0x7')](),controller[_0x6932('0xf')]);module['exports']=router; \ No newline at end of file +var _0x8962=['/:id','update','destroy','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','show','post','create'];(function(_0x509c83,_0x511882){var _0x534626=function(_0x9d21cf){while(--_0x9d21cf){_0x509c83['push'](_0x509c83['shift']());}};_0x534626(++_0x511882);}(_0x8962,0x1a7));var _0x2896=function(_0x3f6e31,_0x120798){_0x3f6e31=_0x3f6e31-0x0;var _0x3de77a=_0x8962[_0x3f6e31];return _0x3de77a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2896('0x0'));var express=require('express');var router=express[_0x2896('0x1')]();var fs_extra=require(_0x2896('0x2'));var auth=require(_0x2896('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2896('0x4'));var controller=require(_0x2896('0x5'));router['get']('/',auth[_0x2896('0x6')](),controller[_0x2896('0x7')]);router['get']('/:id',auth[_0x2896('0x6')](),controller[_0x2896('0x8')]);router[_0x2896('0x9')]('/',auth[_0x2896('0x6')](),controller[_0x2896('0xa')]);router['put'](_0x2896('0xb'),auth[_0x2896('0x6')](),controller[_0x2896('0xc')]);router['delete'](_0x2896('0xb'),auth[_0x2896('0x6')](),controller[_0x2896('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 9f8cfac..5628c12 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 _0x61a5=['keyValue','STRING','sequelize','ENUM','string','variable','customVariable'];(function(_0x4658b6,_0x5b2949){var _0x556717=function(_0x5a2645){while(--_0x5a2645){_0x4658b6['push'](_0x4658b6['shift']());}};_0x556717(++_0x5b2949);}(_0x61a5,0xf0));var _0x561a=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x61a5[_0x4b73a2];return _0x383c66;};'use strict';var Sequelize=require(_0x561a('0x0'));module['exports']={'type':{'type':Sequelize[_0x561a('0x1')](_0x561a('0x2'),_0x561a('0x3'),_0x561a('0x4'),_0x561a('0x5'),'picklist'),'defaultValue':_0x561a('0x2')},'content':{'type':Sequelize[_0x561a('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x561a('0x1')](_0x561a('0x2'),_0x561a('0x3'),_0x561a('0x4'))},'keyContent':{'type':Sequelize[_0x561a('0x6')]},'idField':{'type':Sequelize[_0x561a('0x6')]},'nameField':{'type':Sequelize[_0x561a('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x561a('0x6')]}}; \ No newline at end of file +var _0x5712=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x5a3e9d,_0x419dba){var _0x37a34d=function(_0x59f8e2){while(--_0x59f8e2){_0x5a3e9d['push'](_0x5a3e9d['shift']());}};_0x37a34d(++_0x419dba);}(_0x5712,0x140));var _0x2571=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5712[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x2571('0x0'));module[_0x2571('0x1')]={'type':{'type':Sequelize[_0x2571('0x2')](_0x2571('0x3'),_0x2571('0x4'),_0x2571('0x5'),_0x2571('0x6'),_0x2571('0x7')),'defaultValue':_0x2571('0x3')},'content':{'type':Sequelize[_0x2571('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x2571('0x3'),'variable',_0x2571('0x5'))},'keyContent':{'type':Sequelize[_0x2571('0x8')]},'idField':{'type':Sequelize[_0x2571('0x8')]},'nameField':{'type':Sequelize[_0x2571('0x8')]},'customField':{'type':Sequelize[_0x2571('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2571('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index f6a2cc4..271dca7 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 _0xb688=['bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','send','index','map','FreshdeskField','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','sort','where','merge','filter','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','update','params','rimraf','zip-dir','request-promise','moment'];(function(_0x4c0ef1,_0x4b819d){var _0x133477=function(_0x4f1962){while(--_0x4f1962){_0x4c0ef1['push'](_0x4c0ef1['shift']());}};_0x133477(++_0x4b819d);}(_0xb688,0x1b2));var _0x8b68=function(_0xa0b471,_0x30378d){_0xa0b471=_0xa0b471-0x0;var _0xc48f93=_0xb688[_0xa0b471];return _0xc48f93;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b68('0x0'));var zipdir=require(_0x8b68('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b68('0x2'));var moment=require(_0x8b68('0x3'));var BPromise=require(_0x8b68('0x4'));var Mustache=require(_0x8b68('0x5'));var util=require(_0x8b68('0x6'));var path=require(_0x8b68('0x7'));var sox=require(_0x8b68('0x8'));var csv=require(_0x8b68('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b68('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8b68('0xb'));var jsforce=require(_0x8b68('0xc'));var deskjs=require(_0x8b68('0xd'));var toCsv=require(_0x8b68('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8b68('0xe'));var authService=require(_0x8b68('0xf'));var qs=require(_0x8b68('0x10'));var as=require(_0x8b68('0x11'));var hardwareService=require(_0x8b68('0x12'));var logger=require('../../config/logger')(_0x8b68('0x13'));var utils=require(_0x8b68('0x14'));var config=require(_0x8b68('0x15'));var licenseUtil=require(_0x8b68('0x16'));var db=require(_0x8b68('0x17'))['db'];function respondWithStatusCode(_0x4d3483,_0x1f0d31){_0x1f0d31=_0x1f0d31||0xcc;return function(_0x57f7eb){if(_0x57f7eb){return _0x4d3483[_0x8b68('0x18')](_0x1f0d31);}return _0x4d3483[_0x8b68('0x19')](_0x1f0d31)[_0x8b68('0x1a')]();};}function respondWithResult(_0x8e206f,_0x12d17d){_0x12d17d=_0x12d17d||0xc8;return function(_0x381e54){if(_0x381e54){return _0x8e206f['status'](_0x12d17d)[_0x8b68('0x1b')](_0x381e54);}};}function respondWithFilteredResult(_0x4fde26,_0x2d894e){return function(_0xbb76c6){if(_0xbb76c6){var _0x558edc=typeof _0x2d894e[_0x8b68('0x1c')]===_0x8b68('0x1d')&&typeof _0x2d894e[_0x8b68('0x1e')]===_0x8b68('0x1d');var _0x6be574=_0xbb76c6[_0x8b68('0x1f')];var _0x2b2462=_0x558edc?0x0:_0x2d894e[_0x8b68('0x1c')];var _0x2abc4a=_0x558edc?_0xbb76c6['count']:_0x2d894e['offset']+_0x2d894e[_0x8b68('0x1e')];var _0x42a0fc;if(_0x2abc4a>=_0x6be574){_0x2abc4a=_0x6be574;_0x42a0fc=0xc8;}else{_0x42a0fc=0xce;}_0x4fde26[_0x8b68('0x19')](_0x42a0fc);return _0x4fde26[_0x8b68('0x20')]('Content-Range',_0x2b2462+'-'+_0x2abc4a+'/'+_0x6be574)[_0x8b68('0x1b')](_0xbb76c6);}return null;};}function patchUpdates(_0x7cab30){return function(_0x2c02d2){try{jsonpatch[_0x8b68('0x21')](_0x2c02d2,_0x7cab30,!![]);}catch(_0x2213a5){return BPromise[_0x8b68('0x22')](_0x2213a5);}return _0x2c02d2[_0x8b68('0x23')]();};}function saveUpdates(_0x1538d3,_0x28e858){return function(_0x2f8174){if(_0x2f8174){return _0x2f8174['update'](_0x1538d3)[_0x8b68('0x24')](function(_0x1fe2e7){return _0x1fe2e7;});}return null;};}function removeEntity(_0x1e8988,_0x4fc122){return function(_0x5509dc){if(_0x5509dc){return _0x5509dc[_0x8b68('0x25')]()[_0x8b68('0x24')](function(){_0x1e8988[_0x8b68('0x19')](0xcc)[_0x8b68('0x1a')]();});}};}function handleEntityNotFound(_0x33be66,_0x1a56f4){return function(_0x5c5229){if(!_0x5c5229){_0x33be66['sendStatus'](0x194);}return _0x5c5229;};}function handleError(_0x529f00,_0x121eb2){_0x121eb2=_0x121eb2||0x1f4;return function(_0x2a46c9){logger[_0x8b68('0x26')](_0x2a46c9[_0x8b68('0x27')]);if(_0x2a46c9['name']){delete _0x2a46c9['name'];}_0x529f00[_0x8b68('0x19')](_0x121eb2)[_0x8b68('0x28')](_0x2a46c9);};}exports[_0x8b68('0x29')]=function(_0x4d6271,_0x5a6661){var _0x4aaebc={},_0x2e4546={},_0x1755e3={'count':0x0,'rows':[]};var _0x52bca4=_[_0x8b68('0x2a')](db[_0x8b68('0x2b')]['rawAttributes'],function(_0x1baae5){return{'name':_0x1baae5[_0x8b68('0x2c')],'type':_0x1baae5[_0x8b68('0x2d')][_0x8b68('0x2e')]};});_0x2e4546[_0x8b68('0x2f')]=_[_0x8b68('0x2a')](_0x52bca4,_0x8b68('0x30'));_0x2e4546[_0x8b68('0x31')]=_[_0x8b68('0x32')](_0x4d6271[_0x8b68('0x31')]);_0x2e4546[_0x8b68('0x33')]=_[_0x8b68('0x34')](_0x2e4546[_0x8b68('0x2f')],_0x2e4546[_0x8b68('0x31')]);_0x4aaebc[_0x8b68('0x35')]=_[_0x8b68('0x34')](_0x2e4546[_0x8b68('0x2f')],qs[_0x8b68('0x36')](_0x4d6271[_0x8b68('0x31')]['fields']));_0x4aaebc[_0x8b68('0x35')]=_0x4aaebc[_0x8b68('0x35')][_0x8b68('0x37')]?_0x4aaebc['attributes']:_0x2e4546[_0x8b68('0x2f')];if(!_0x4d6271[_0x8b68('0x31')]['hasOwnProperty']('nolimit')){_0x4aaebc[_0x8b68('0x1e')]=qs[_0x8b68('0x1e')](_0x4d6271[_0x8b68('0x31')][_0x8b68('0x1e')]);_0x4aaebc[_0x8b68('0x1c')]=qs[_0x8b68('0x1c')](_0x4d6271[_0x8b68('0x31')][_0x8b68('0x1c')]);}_0x4aaebc['order']=qs[_0x8b68('0x38')](_0x4d6271[_0x8b68('0x31')][_0x8b68('0x38')]);_0x4aaebc[_0x8b68('0x39')]=qs[_0x8b68('0x33')](_['pick'](_0x4d6271[_0x8b68('0x31')],_0x2e4546[_0x8b68('0x33')]),_0x52bca4);if(_0x4d6271['query']['filter']){_0x4aaebc['where']=_[_0x8b68('0x3a')](_0x4aaebc['where'],{'$or':_['map'](_0x52bca4,function(_0x52e95e){if(_0x52e95e[_0x8b68('0x2d')]!=='VIRTUAL'){var _0x2df2b8={};_0x2df2b8[_0x52e95e[_0x8b68('0x30')]]={'$like':'%'+_0x4d6271['query'][_0x8b68('0x3b')]+'%'};return _0x2df2b8;}})});}_0x4aaebc=_[_0x8b68('0x3a')]({},_0x4aaebc,_0x4d6271[_0x8b68('0x3c')]);var _0x2d2636={'where':_0x4aaebc[_0x8b68('0x39')]};return db[_0x8b68('0x2b')]['count'](_0x2d2636)['then'](function(_0x3569bc){_0x1755e3[_0x8b68('0x1f')]=_0x3569bc;if(_0x4d6271[_0x8b68('0x31')][_0x8b68('0x3d')]){_0x4aaebc[_0x8b68('0x3e')]=[{'all':!![]}];}return db[_0x8b68('0x2b')][_0x8b68('0x3f')](_0x4aaebc);})[_0x8b68('0x24')](function(_0x54f1a3){_0x1755e3[_0x8b68('0x40')]=_0x54f1a3;return _0x1755e3;})[_0x8b68('0x24')](respondWithFilteredResult(_0x5a6661,_0x4aaebc))['catch'](handleError(_0x5a6661,null));};exports[_0x8b68('0x41')]=function(_0x3fa341,_0x5dadeb){var _0x5f0719={'raw':!![],'where':{'id':_0x3fa341['params']['id']}},_0x3463a3={};_0x3463a3[_0x8b68('0x2f')]=_['keys'](db[_0x8b68('0x2b')][_0x8b68('0x42')]);_0x3463a3[_0x8b68('0x31')]=_['keys'](_0x3fa341[_0x8b68('0x31')]);_0x3463a3[_0x8b68('0x33')]=_[_0x8b68('0x34')](_0x3463a3['model'],_0x3463a3[_0x8b68('0x31')]);_0x5f0719[_0x8b68('0x35')]=_[_0x8b68('0x34')](_0x3463a3[_0x8b68('0x2f')],qs[_0x8b68('0x36')](_0x3fa341['query'][_0x8b68('0x36')]));_0x5f0719[_0x8b68('0x35')]=_0x5f0719[_0x8b68('0x35')][_0x8b68('0x37')]?_0x5f0719['attributes']:_0x3463a3['model'];if(_0x3fa341['query'][_0x8b68('0x3d')]){_0x5f0719['include']=[{'all':!![]}];}_0x5f0719=_[_0x8b68('0x3a')]({},_0x5f0719,_0x3fa341[_0x8b68('0x3c')]);return db[_0x8b68('0x2b')][_0x8b68('0x43')](_0x5f0719)[_0x8b68('0x24')](handleEntityNotFound(_0x5dadeb,null))['then'](respondWithResult(_0x5dadeb,null))[_0x8b68('0x44')](handleError(_0x5dadeb,null));};exports[_0x8b68('0x45')]=function(_0x5597b4,_0x4601bc){return db[_0x8b68('0x2b')][_0x8b68('0x45')](_0x5597b4[_0x8b68('0x46')],{})['then'](respondWithResult(_0x4601bc,0xc9))[_0x8b68('0x44')](handleError(_0x4601bc,null));};exports[_0x8b68('0x47')]=function(_0x1ef20a,_0x40d608){if(_0x1ef20a[_0x8b68('0x46')]['id']){delete _0x1ef20a[_0x8b68('0x46')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x1ef20a[_0x8b68('0x48')]['id']}})[_0x8b68('0x24')](handleEntityNotFound(_0x40d608,null))[_0x8b68('0x24')](saveUpdates(_0x1ef20a[_0x8b68('0x46')],null))[_0x8b68('0x24')](respondWithResult(_0x40d608,null))[_0x8b68('0x44')](handleError(_0x40d608,null));};exports[_0x8b68('0x25')]=function(_0x1f421c,_0x5a02b8){return db['FreshdeskField']['find']({'where':{'id':_0x1f421c[_0x8b68('0x48')]['id']}})[_0x8b68('0x24')](handleEntityNotFound(_0x5a02b8,null))[_0x8b68('0x24')](removeEntity(_0x5a02b8,null))[_0x8b68('0x44')](handleError(_0x5a02b8,null));}; \ No newline at end of file +var _0x7cb2=['ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','include','findAll','rows','catch','params','keys','rawAttributes','includeAll','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox'];(function(_0x485a73,_0x318bc9){var _0xf21947=function(_0x527fdf){while(--_0x527fdf){_0x485a73['push'](_0x485a73['shift']());}};_0xf21947(++_0x318bc9);}(_0x7cb2,0x178));var _0x27cb=function(_0x4102a0,_0x215450){_0x4102a0=_0x4102a0-0x0;var _0x2be13f=_0x7cb2[_0x4102a0];return _0x2be13f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27cb('0x0'));var zipdir=require(_0x27cb('0x1'));var jsonpatch=require(_0x27cb('0x2'));var rp=require(_0x27cb('0x3'));var moment=require(_0x27cb('0x4'));var BPromise=require(_0x27cb('0x5'));var Mustache=require('mustache');var util=require(_0x27cb('0x6'));var path=require(_0x27cb('0x7'));var sox=require(_0x27cb('0x8'));var csv=require('to-csv');var ejs=require(_0x27cb('0x9'));var fs=require('fs');var fs_extra=require(_0x27cb('0xa'));var _=require(_0x27cb('0xb'));var squel=require(_0x27cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x27cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x27cb('0xe'));var querystring=require(_0x27cb('0xf'));var Papa=require('papaparse');var Redis=require(_0x27cb('0x10'));var authService=require(_0x27cb('0x11'));var qs=require(_0x27cb('0x12'));var as=require(_0x27cb('0x13'));var hardwareService=require(_0x27cb('0x14'));var logger=require(_0x27cb('0x15'))(_0x27cb('0x16'));var utils=require(_0x27cb('0x17'));var config=require(_0x27cb('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x272e27,_0x7a028d){_0x7a028d=_0x7a028d||0xcc;return function(_0x21d138){if(_0x21d138){return _0x272e27[_0x27cb('0x19')](_0x7a028d);}return _0x272e27[_0x27cb('0x1a')](_0x7a028d)[_0x27cb('0x1b')]();};}function respondWithResult(_0x584d00,_0x41e29b){_0x41e29b=_0x41e29b||0xc8;return function(_0x4a6268){if(_0x4a6268){return _0x584d00[_0x27cb('0x1a')](_0x41e29b)[_0x27cb('0x1c')](_0x4a6268);}};}function respondWithFilteredResult(_0x3bec47,_0x3eced4){return function(_0x1cdb1e){if(_0x1cdb1e){var _0x266be5=typeof _0x3eced4[_0x27cb('0x1d')]===_0x27cb('0x1e')&&typeof _0x3eced4[_0x27cb('0x1f')]==='undefined';var _0x17f97b=_0x1cdb1e[_0x27cb('0x20')];var _0x5d4279=_0x266be5?0x0:_0x3eced4['offset'];var _0x3ddd16=_0x266be5?_0x1cdb1e[_0x27cb('0x20')]:_0x3eced4['offset']+_0x3eced4['limit'];var _0x327c96;if(_0x3ddd16>=_0x17f97b){_0x3ddd16=_0x17f97b;_0x327c96=0xc8;}else{_0x327c96=0xce;}_0x3bec47[_0x27cb('0x1a')](_0x327c96);return _0x3bec47[_0x27cb('0x21')](_0x27cb('0x22'),_0x5d4279+'-'+_0x3ddd16+'/'+_0x17f97b)[_0x27cb('0x1c')](_0x1cdb1e);}return null;};}function patchUpdates(_0x5313d3){return function(_0x5e9da5){try{jsonpatch[_0x27cb('0x23')](_0x5e9da5,_0x5313d3,!![]);}catch(_0x5c9bd4){return BPromise[_0x27cb('0x24')](_0x5c9bd4);}return _0x5e9da5[_0x27cb('0x25')]();};}function saveUpdates(_0x4f892c,_0x4bd396){return function(_0xb6d193){if(_0xb6d193){return _0xb6d193[_0x27cb('0x26')](_0x4f892c)[_0x27cb('0x27')](function(_0x36527f){return _0x36527f;});}return null;};}function removeEntity(_0x4dee29,_0x564ae5){return function(_0x3777f1){if(_0x3777f1){return _0x3777f1[_0x27cb('0x28')]()['then'](function(){_0x4dee29[_0x27cb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x513eba,_0x32c5a8){return function(_0x3ae4ee){if(!_0x3ae4ee){_0x513eba[_0x27cb('0x19')](0x194);}return _0x3ae4ee;};}function handleError(_0x560f0f,_0x324353){_0x324353=_0x324353||0x1f4;return function(_0x5ab569){logger[_0x27cb('0x29')](_0x5ab569[_0x27cb('0x2a')]);if(_0x5ab569[_0x27cb('0x2b')]){delete _0x5ab569[_0x27cb('0x2b')];}_0x560f0f[_0x27cb('0x1a')](_0x324353)[_0x27cb('0x2c')](_0x5ab569);};}exports[_0x27cb('0x2d')]=function(_0x5a9ffd,_0x594ff9){var _0x285bcd={},_0x56080c={},_0xa98b5={'count':0x0,'rows':[]};var _0x40aaee=_[_0x27cb('0x2e')](db[_0x27cb('0x2f')]['rawAttributes'],function(_0x1904a6){return{'name':_0x1904a6[_0x27cb('0x30')],'type':_0x1904a6[_0x27cb('0x31')][_0x27cb('0x32')]};});_0x56080c[_0x27cb('0x33')]=_[_0x27cb('0x2e')](_0x40aaee,_0x27cb('0x2b'));_0x56080c[_0x27cb('0x34')]=_['keys'](_0x5a9ffd[_0x27cb('0x34')]);_0x56080c[_0x27cb('0x35')]=_[_0x27cb('0x36')](_0x56080c[_0x27cb('0x33')],_0x56080c[_0x27cb('0x34')]);_0x285bcd['attributes']=_[_0x27cb('0x36')](_0x56080c['model'],qs['fields'](_0x5a9ffd[_0x27cb('0x34')][_0x27cb('0x37')]));_0x285bcd[_0x27cb('0x38')]=_0x285bcd['attributes'][_0x27cb('0x39')]?_0x285bcd[_0x27cb('0x38')]:_0x56080c[_0x27cb('0x33')];if(!_0x5a9ffd[_0x27cb('0x34')][_0x27cb('0x3a')](_0x27cb('0x3b'))){_0x285bcd[_0x27cb('0x1f')]=qs[_0x27cb('0x1f')](_0x5a9ffd[_0x27cb('0x34')][_0x27cb('0x1f')]);_0x285bcd[_0x27cb('0x1d')]=qs[_0x27cb('0x1d')](_0x5a9ffd[_0x27cb('0x34')][_0x27cb('0x1d')]);}_0x285bcd['order']=qs[_0x27cb('0x3c')](_0x5a9ffd[_0x27cb('0x34')][_0x27cb('0x3c')]);_0x285bcd['where']=qs[_0x27cb('0x35')](_['pick'](_0x5a9ffd[_0x27cb('0x34')],_0x56080c['filters']),_0x40aaee);if(_0x5a9ffd['query']['filter']){_0x285bcd[_0x27cb('0x3d')]=_[_0x27cb('0x3e')](_0x285bcd['where'],{'$or':_[_0x27cb('0x2e')](_0x40aaee,function(_0x138b39){if(_0x138b39[_0x27cb('0x31')]!==_0x27cb('0x3f')){var _0x3f41ac={};_0x3f41ac[_0x138b39['name']]={'$like':'%'+_0x5a9ffd[_0x27cb('0x34')][_0x27cb('0x40')]+'%'};return _0x3f41ac;}})});}_0x285bcd=_[_0x27cb('0x3e')]({},_0x285bcd,_0x5a9ffd['options']);var _0x39cc23={'where':_0x285bcd['where']};return db[_0x27cb('0x2f')]['count'](_0x39cc23)['then'](function(_0x8fc474){_0xa98b5['count']=_0x8fc474;if(_0x5a9ffd[_0x27cb('0x34')]['includeAll']){_0x285bcd[_0x27cb('0x41')]=[{'all':!![]}];}return db['FreshdeskField'][_0x27cb('0x42')](_0x285bcd);})['then'](function(_0x5b1fad){_0xa98b5[_0x27cb('0x43')]=_0x5b1fad;return _0xa98b5;})[_0x27cb('0x27')](respondWithFilteredResult(_0x594ff9,_0x285bcd))[_0x27cb('0x44')](handleError(_0x594ff9,null));};exports['show']=function(_0x22416f,_0x1c34b2){var _0x5b564e={'raw':!![],'where':{'id':_0x22416f[_0x27cb('0x45')]['id']}},_0x358785={};_0x358785['model']=_[_0x27cb('0x46')](db[_0x27cb('0x2f')][_0x27cb('0x47')]);_0x358785['query']=_[_0x27cb('0x46')](_0x22416f[_0x27cb('0x34')]);_0x358785[_0x27cb('0x35')]=_['intersection'](_0x358785[_0x27cb('0x33')],_0x358785[_0x27cb('0x34')]);_0x5b564e[_0x27cb('0x38')]=_['intersection'](_0x358785[_0x27cb('0x33')],qs['fields'](_0x22416f[_0x27cb('0x34')][_0x27cb('0x37')]));_0x5b564e[_0x27cb('0x38')]=_0x5b564e[_0x27cb('0x38')][_0x27cb('0x39')]?_0x5b564e[_0x27cb('0x38')]:_0x358785[_0x27cb('0x33')];if(_0x22416f[_0x27cb('0x34')][_0x27cb('0x48')]){_0x5b564e[_0x27cb('0x41')]=[{'all':!![]}];}_0x5b564e=_['merge']({},_0x5b564e,_0x22416f[_0x27cb('0x49')]);return db[_0x27cb('0x2f')][_0x27cb('0x4a')](_0x5b564e)[_0x27cb('0x27')](handleEntityNotFound(_0x1c34b2,null))['then'](respondWithResult(_0x1c34b2,null))[_0x27cb('0x44')](handleError(_0x1c34b2,null));};exports['create']=function(_0x2e9777,_0x1ef91d){return db['FreshdeskField'][_0x27cb('0x4b')](_0x2e9777[_0x27cb('0x4c')],{})[_0x27cb('0x27')](respondWithResult(_0x1ef91d,0xc9))[_0x27cb('0x44')](handleError(_0x1ef91d,null));};exports[_0x27cb('0x26')]=function(_0x3fceb9,_0x178873){if(_0x3fceb9['body']['id']){delete _0x3fceb9[_0x27cb('0x4c')]['id'];}return db[_0x27cb('0x2f')]['find']({'where':{'id':_0x3fceb9[_0x27cb('0x45')]['id']}})[_0x27cb('0x27')](handleEntityNotFound(_0x178873,null))[_0x27cb('0x27')](saveUpdates(_0x3fceb9[_0x27cb('0x4c')],null))['then'](respondWithResult(_0x178873,null))['catch'](handleError(_0x178873,null));};exports['destroy']=function(_0x4d7db8,_0x1b83d1){return db[_0x27cb('0x2f')]['find']({'where':{'id':_0x4d7db8[_0x27cb('0x45')]['id']}})['then'](handleEntityNotFound(_0x1b83d1,null))['then'](removeEntity(_0x1b83d1,null))[_0x27cb('0x44')](handleError(_0x1b83d1,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 483b319..bf747a6 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 _0x4332=['FreshdeskField','int_freshdesk_fields','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define'];(function(_0x2ff1ab,_0x188ede){var _0x1f3461=function(_0x2ef1da){while(--_0x2ef1da){_0x2ff1ab['push'](_0x2ff1ab['shift']());}};_0x1f3461(++_0x188ede);}(_0x4332,0xed));var _0x2433=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4332[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2433('0x0'));var util=require(_0x2433('0x1'));var logger=require(_0x2433('0x2'))(_0x2433('0x3'));var moment=require(_0x2433('0x4'));var BPromise=require(_0x2433('0x5'));var rp=require(_0x2433('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2433('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0x2433('0x8')]=function(_0x516175,_0x47a3bc){return _0x516175[_0x2433('0x9')](_0x2433('0xa'),attributes,{'tableName':_0x2433('0xb'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0x2433('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe27c=['lodash','../../config/logger','moment','request-promise','rimraf','exports','FreshdeskField','FieldId'];(function(_0x12f53f,_0x1c8f6d){var _0x710bd6=function(_0x4c35c3){while(--_0x4c35c3){_0x12f53f['push'](_0x12f53f['shift']());}};_0x710bd6(++_0x1c8f6d);}(_0xe27c,0x138));var _0xce27=function(_0x4a8512,_0x4594c2){_0x4a8512=_0x4a8512-0x0;var _0x21d5a6=_0xe27c[_0x4a8512];return _0x21d5a6;};'use strict';var _=require(_0xce27('0x0'));var util=require('util');var logger=require(_0xce27('0x1'))('api');var moment=require(_0xce27('0x2'));var BPromise=require('bluebird');var rp=require(_0xce27('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xce27('0x4'));var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0xce27('0x5')]=function(_0x5b47ab,_0x4cdfd9){return _0x5b47ab['define'](_0xce27('0x6'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0xce27('0x7')],'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 6e9f834..f8963aa 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 _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x6b7556,_0x3268da){_0x6b7556=_0x6b7556-0x0;var _0x33167e=_0x7a54[_0x6b7556];return _0x33167e;};'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')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x349339,_0x32392e){_0x349339=_0x349339-0x0;var _0x5356ec=_0x7a54[_0x349339];return _0x5356ec;};'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')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 0c40987..74d85d3 100644 --- a/server/api/intFreshsalesAccount/index.js +++ b/server/api/intFreshsalesAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbca0=['index','get','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','./intFreshsalesAccount.controller','isAuthenticated'];(function(_0x72ce88,_0x3c7c5f){var _0x75b806=function(_0x248684){while(--_0x248684){_0x72ce88['push'](_0x72ce88['shift']());}};_0x75b806(++_0x3c7c5f);}(_0xbca0,0x17f));var _0x0bca=function(_0x5eca87,_0x3c82d5){_0x5eca87=_0x5eca87-0x0;var _0x29b94c=_0xbca0[_0x5eca87];return _0x29b94c;};'use strict';var multer=require(_0x0bca('0x0'));var util=require(_0x0bca('0x1'));var path=require(_0x0bca('0x2'));var timeout=require(_0x0bca('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0bca('0x4'));var auth=require(_0x0bca('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0bca('0x6'));router['get']('/',auth[_0x0bca('0x7')](),controller[_0x0bca('0x8')]);router[_0x0bca('0x9')]('/:id',auth[_0x0bca('0x7')](),controller[_0x0bca('0xa')]);router[_0x0bca('0x9')]('/:id/configurations',auth[_0x0bca('0x7')](),controller[_0x0bca('0xb')]);router[_0x0bca('0x9')](_0x0bca('0xc'),auth[_0x0bca('0x7')](),controller[_0x0bca('0xd')]);router[_0x0bca('0xe')]('/',auth[_0x0bca('0x7')](),controller[_0x0bca('0xf')]);router[_0x0bca('0xe')](_0x0bca('0x10'),auth['isAuthenticated'](),controller[_0x0bca('0x11')]);router[_0x0bca('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0bca('0x13')]);router[_0x0bca('0x14')](_0x0bca('0x15'),auth[_0x0bca('0x7')](),controller[_0x0bca('0x16')]);module['exports']=router; \ No newline at end of file +var _0x7908=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','post','create'];(function(_0x3494d5,_0x240e41){var _0x3c9ba8=function(_0x595aee){while(--_0x595aee){_0x3494d5['push'](_0x3494d5['shift']());}};_0x3c9ba8(++_0x240e41);}(_0x7908,0x138));var _0x8790=function(_0x2f10f6,_0xc9c8e6){_0x2f10f6=_0x2f10f6-0x0;var _0x175576=_0x7908[_0x2f10f6];return _0x175576;};'use strict';var multer=require(_0x8790('0x0'));var util=require(_0x8790('0x1'));var path=require(_0x8790('0x2'));var timeout=require(_0x8790('0x3'));var express=require('express');var router=express[_0x8790('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8790('0x5'));var interaction=require(_0x8790('0x6'));var config=require(_0x8790('0x7'));var controller=require(_0x8790('0x8'));router[_0x8790('0x9')]('/',auth[_0x8790('0xa')](),controller[_0x8790('0xb')]);router[_0x8790('0x9')](_0x8790('0xc'),auth[_0x8790('0xa')](),controller[_0x8790('0xd')]);router[_0x8790('0x9')](_0x8790('0xe'),auth[_0x8790('0xa')](),controller[_0x8790('0xf')]);router['get']('/:id/fields',auth[_0x8790('0xa')](),controller['getFields']);router[_0x8790('0x10')]('/',auth[_0x8790('0xa')](),controller[_0x8790('0x11')]);router['post'](_0x8790('0xe'),auth[_0x8790('0xa')](),controller['addConfiguration']);router['put']('/:id',auth[_0x8790('0xa')](),controller[_0x8790('0x12')]);router[_0x8790('0x13')](_0x8790('0xc'),auth[_0x8790('0xa')](),controller[_0x8790('0x14')]);module[_0x8790('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 23a722f..fd036ac 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0876=['username','remoteUri','sequelize','exports','STRING'];(function(_0x58556a,_0xae25c){var _0x1d2800=function(_0x5de292){while(--_0x5de292){_0x58556a['push'](_0x58556a['shift']());}};_0x1d2800(++_0xae25c);}(_0x0876,0x16f));var _0x6087=function(_0x3ec7d1,_0x563ca5){_0x3ec7d1=_0x3ec7d1-0x0;var _0x38f923=_0x0876[_0x3ec7d1];return _0x38f923;};'use strict';var Sequelize=require(_0x6087('0x0'));module[_0x6087('0x1')]={'name':{'type':Sequelize[_0x6087('0x2')]},'description':{'type':Sequelize[_0x6087('0x2')]},'username':{'type':Sequelize[_0x6087('0x2')],'unique':_0x6087('0x3')},'apiKey':{'type':Sequelize[_0x6087('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x6087('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xdb1d=['exports','STRING','remoteUri','sequelize'];(function(_0x41a25e,_0x3bc4e3){var _0x1a3383=function(_0x322a0c){while(--_0x322a0c){_0x41a25e['push'](_0x41a25e['shift']());}};_0x1a3383(++_0x3bc4e3);}(_0xdb1d,0x183));var _0xddb1=function(_0x4044bd,_0x390ebf){_0x4044bd=_0x4044bd-0x0;var _0x46f00f=_0xdb1d[_0x4044bd];return _0x46f00f;};'use strict';var Sequelize=require(_0xddb1('0x0'));module[_0xddb1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xddb1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xddb1('0x2')]},'remoteUri':{'type':Sequelize[_0xddb1('0x2')],'unique':_0xddb1('0x3')},'serverUrl':{'type':Sequelize[_0xddb1('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 62ebf82..aec316f 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2e0=['FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','findOne','length','addConfiguration','AccountId','getSubjects','channel','FreshsalesConfiguration','FreshsalesField','Subjects','getFields','username','remoteUri','apiKey','substring','lastIndexOf','format','%s%s','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4d1a32,_0x5a6328){var _0x3a9112=function(_0x107090){while(--_0x107090){_0x4d1a32['push'](_0x4d1a32['shift']());}};_0x3a9112(++_0x5a6328);}(_0xf2e0,0xc7));var _0x0f2e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf2e0[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x0f2e('0x0'));var rimraf=require(_0x0f2e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0f2e('0x2'));var rp=require(_0x0f2e('0x3'));var moment=require('moment');var BPromise=require(_0x0f2e('0x4'));var Mustache=require(_0x0f2e('0x5'));var util=require(_0x0f2e('0x6'));var path=require('path');var sox=require(_0x0f2e('0x7'));var csv=require(_0x0f2e('0x8'));var ejs=require(_0x0f2e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0f2e('0xa'));var crypto=require('crypto');var jsforce=require(_0x0f2e('0xb'));var deskjs=require(_0x0f2e('0xc'));var toCsv=require(_0x0f2e('0x8'));var querystring=require('querystring');var Papa=require(_0x0f2e('0xd'));var Redis=require(_0x0f2e('0xe'));var authService=require(_0x0f2e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0f2e('0x10'));var hardwareService=require(_0x0f2e('0x11'));var logger=require('../../config/logger')(_0x0f2e('0x12'));var utils=require(_0x0f2e('0x13'));var config=require(_0x0f2e('0x14'));var licenseUtil=require(_0x0f2e('0x15'));var db=require(_0x0f2e('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x0f2e('0x17')][_0x0f2e('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x2a4718,_0x2521a9,_0x15b723,_0x72e89f){return new BPromise(function(_0x5858ac,_0x418b1d){var _0x2b02df=_0x72e89f||client;return _0x2b02df[_0x0f2e('0x19')](_0x2a4718,_0x15b723)[_0x0f2e('0x1a')](function(_0x2f557f){logger[_0x0f2e('0x1b')](_0x0f2e('0x1c'),_0x2521a9,_0x0f2e('0x1d'));logger[_0x0f2e('0x1e')](_0x0f2e('0x1f'),_0x2521a9,_0x0f2e('0x1d'),JSON[_0x0f2e('0x20')](_0x2f557f));if(_0x2f557f['error']){if(_0x2f557f[_0x0f2e('0x21')][_0x0f2e('0x22')]===0x1f4){logger[_0x0f2e('0x21')]('FreshsalesAccount,\x20%s,\x20%s',_0x2521a9,_0x2f557f[_0x0f2e('0x21')][_0x0f2e('0x23')]);return _0x418b1d(_0x2f557f['error']['message']);}logger[_0x0f2e('0x21')]('FreshsalesAccount,\x20%s,\x20%s',_0x2521a9,_0x2f557f[_0x0f2e('0x21')][_0x0f2e('0x23')]);return _0x5858ac(_0x2f557f['error'][_0x0f2e('0x23')]);}else{logger[_0x0f2e('0x1b')](_0x0f2e('0x1c'),_0x2521a9,_0x0f2e('0x1d'));_0x5858ac(_0x2f557f[_0x0f2e('0x24')][_0x0f2e('0x23')]);}})[_0x0f2e('0x25')](function(_0x103014){logger['error'](_0x0f2e('0x1c'),_0x2521a9,_0x103014);_0x418b1d(_0x103014);});});}function respondWithStatusCode(_0x1153be,_0x1dc4d7){_0x1dc4d7=_0x1dc4d7||0xcc;return function(_0x2f4624){if(_0x2f4624){return _0x1153be['sendStatus'](_0x1dc4d7);}return _0x1153be['status'](_0x1dc4d7)[_0x0f2e('0x26')]();};}function respondWithResult(_0x2a3b9f,_0x296caf){_0x296caf=_0x296caf||0xc8;return function(_0x56247e){if(_0x56247e){return _0x2a3b9f['status'](_0x296caf)[_0x0f2e('0x27')](_0x56247e);}};}function respondWithFilteredResult(_0x48cd20,_0x525a30){return function(_0x39f59a){if(_0x39f59a){var _0x27a4b1=typeof _0x525a30[_0x0f2e('0x28')]===_0x0f2e('0x29')&&typeof _0x525a30[_0x0f2e('0x2a')]==='undefined';var _0x18eea3=_0x39f59a[_0x0f2e('0x2b')];var _0x44c117=_0x27a4b1?0x0:_0x525a30[_0x0f2e('0x28')];var _0x5a11b5=_0x27a4b1?_0x39f59a[_0x0f2e('0x2b')]:_0x525a30[_0x0f2e('0x28')]+_0x525a30[_0x0f2e('0x2a')];var _0xe3c2d0;if(_0x5a11b5>=_0x18eea3){_0x5a11b5=_0x18eea3;_0xe3c2d0=0xc8;}else{_0xe3c2d0=0xce;}_0x48cd20[_0x0f2e('0x2c')](_0xe3c2d0);return _0x48cd20[_0x0f2e('0x2d')](_0x0f2e('0x2e'),_0x44c117+'-'+_0x5a11b5+'/'+_0x18eea3)['json'](_0x39f59a);}return null;};}function patchUpdates(_0x52e2ce){return function(_0x304164){try{jsonpatch[_0x0f2e('0x2f')](_0x304164,_0x52e2ce,!![]);}catch(_0xb8dc21){return BPromise[_0x0f2e('0x30')](_0xb8dc21);}return _0x304164[_0x0f2e('0x31')]();};}function saveUpdates(_0x50ff75,_0x432a53){return function(_0x2da777){if(_0x2da777){return _0x2da777[_0x0f2e('0x32')](_0x50ff75)[_0x0f2e('0x1a')](function(_0x264157){return _0x264157;});}return null;};}function removeEntity(_0xf63ee6,_0x432b07){return function(_0x4e9ff5){if(_0x4e9ff5){return _0x4e9ff5[_0x0f2e('0x33')]()[_0x0f2e('0x1a')](function(){_0xf63ee6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a0bb9,_0x2643a2){return function(_0x440343){if(!_0x440343){_0x2a0bb9[_0x0f2e('0x34')](0x194);}return _0x440343;};}function handleError(_0x525dc3,_0x845028){_0x845028=_0x845028||0x1f4;return function(_0x3ebfeb){logger[_0x0f2e('0x21')](_0x3ebfeb[_0x0f2e('0x35')]);if(_0x3ebfeb[_0x0f2e('0x36')]){delete _0x3ebfeb[_0x0f2e('0x36')];}_0x525dc3[_0x0f2e('0x2c')](_0x845028)['send'](_0x3ebfeb);};}exports[_0x0f2e('0x37')]=function(_0x2168f2,_0x312d0e){var _0x407110={},_0x30b988={},_0x5c5256={'count':0x0,'rows':[]};var _0x200323=_[_0x0f2e('0x38')](db[_0x0f2e('0x39')][_0x0f2e('0x3a')],function(_0x2a2ae3){return{'name':_0x2a2ae3[_0x0f2e('0x3b')],'type':_0x2a2ae3['type'][_0x0f2e('0x3c')]};});_0x30b988[_0x0f2e('0x3d')]=_[_0x0f2e('0x38')](_0x200323,_0x0f2e('0x36'));_0x30b988[_0x0f2e('0x3e')]=_[_0x0f2e('0x3f')](_0x2168f2[_0x0f2e('0x3e')]);_0x30b988['filters']=_[_0x0f2e('0x40')](_0x30b988[_0x0f2e('0x3d')],_0x30b988['query']);_0x407110[_0x0f2e('0x41')]=_['intersection'](_0x30b988['model'],qs[_0x0f2e('0x42')](_0x2168f2['query']['fields']));_0x407110[_0x0f2e('0x41')]=_0x407110[_0x0f2e('0x41')]['length']?_0x407110[_0x0f2e('0x41')]:_0x30b988[_0x0f2e('0x3d')];if(!_0x2168f2['query'][_0x0f2e('0x43')](_0x0f2e('0x44'))){_0x407110[_0x0f2e('0x2a')]=qs['limit'](_0x2168f2[_0x0f2e('0x3e')][_0x0f2e('0x2a')]);_0x407110[_0x0f2e('0x28')]=qs[_0x0f2e('0x28')](_0x2168f2[_0x0f2e('0x3e')]['offset']);}_0x407110[_0x0f2e('0x45')]=qs[_0x0f2e('0x46')](_0x2168f2['query'][_0x0f2e('0x46')]);_0x407110[_0x0f2e('0x47')]=qs[_0x0f2e('0x48')](_[_0x0f2e('0x49')](_0x2168f2[_0x0f2e('0x3e')],_0x30b988[_0x0f2e('0x48')]),_0x200323);if(_0x2168f2['query'][_0x0f2e('0x4a')]){_0x407110[_0x0f2e('0x47')]=_[_0x0f2e('0x4b')](_0x407110['where'],{'$or':_[_0x0f2e('0x38')](_0x200323,function(_0x3fec59){if(_0x3fec59[_0x0f2e('0x4c')]!==_0x0f2e('0x4d')){var _0x156d14={};_0x156d14[_0x3fec59[_0x0f2e('0x36')]]={'$like':'%'+_0x2168f2['query'][_0x0f2e('0x4a')]+'%'};return _0x156d14;}})});}_0x407110=_[_0x0f2e('0x4b')]({},_0x407110,_0x2168f2[_0x0f2e('0x4e')]);var _0x3f80d2={'where':_0x407110[_0x0f2e('0x47')]};return db[_0x0f2e('0x39')][_0x0f2e('0x2b')](_0x3f80d2)[_0x0f2e('0x1a')](function(_0x5f0533){_0x5c5256[_0x0f2e('0x2b')]=_0x5f0533;if(_0x2168f2['query'][_0x0f2e('0x4f')]){_0x407110[_0x0f2e('0x50')]=[{'all':!![]}];}return db[_0x0f2e('0x39')][_0x0f2e('0x51')](_0x407110);})['then'](function(_0x4296bd){_0x5c5256[_0x0f2e('0x52')]=_0x4296bd;return _0x5c5256;})['then'](respondWithFilteredResult(_0x312d0e,_0x407110))[_0x0f2e('0x25')](handleError(_0x312d0e,null));};exports[_0x0f2e('0x53')]=function(_0x508ab9,_0x20911f){var _0x13c402={'raw':![],'where':{'id':_0x508ab9[_0x0f2e('0x54')]['id']}},_0x20cc16={};_0x20cc16[_0x0f2e('0x3d')]=_[_0x0f2e('0x3f')](db['FreshsalesAccount']['rawAttributes']);_0x20cc16[_0x0f2e('0x3e')]=_[_0x0f2e('0x3f')](_0x508ab9[_0x0f2e('0x3e')]);_0x20cc16['filters']=_['intersection'](_0x20cc16[_0x0f2e('0x3d')],_0x20cc16['query']);_0x13c402[_0x0f2e('0x41')]=_[_0x0f2e('0x40')](_0x20cc16['model'],qs[_0x0f2e('0x42')](_0x508ab9['query'][_0x0f2e('0x42')]));_0x13c402[_0x0f2e('0x41')]=_0x13c402[_0x0f2e('0x41')]['length']?_0x13c402[_0x0f2e('0x41')]:_0x20cc16[_0x0f2e('0x3d')];if(_0x508ab9[_0x0f2e('0x3e')][_0x0f2e('0x4f')]){_0x13c402[_0x0f2e('0x50')]=[{'all':!![]}];}_0x13c402=_[_0x0f2e('0x4b')]({},_0x13c402,_0x508ab9[_0x0f2e('0x4e')]);return db[_0x0f2e('0x39')][_0x0f2e('0x55')](_0x13c402)[_0x0f2e('0x1a')](handleEntityNotFound(_0x20911f,null))['then'](respondWithResult(_0x20911f,null))[_0x0f2e('0x25')](handleError(_0x20911f,null));};exports[_0x0f2e('0x56')]=function(_0x4dfe85,_0x4f9c9){return db[_0x0f2e('0x39')][_0x0f2e('0x56')](_0x4dfe85[_0x0f2e('0x57')],{})['then'](respondWithResult(_0x4f9c9,0xc9))[_0x0f2e('0x25')](handleError(_0x4f9c9,null));};exports[_0x0f2e('0x32')]=function(_0x249d67,_0x404b37){if(_0x249d67[_0x0f2e('0x57')]['id']){delete _0x249d67['body']['id'];}return db[_0x0f2e('0x39')][_0x0f2e('0x55')]({'where':{'id':_0x249d67[_0x0f2e('0x54')]['id']}})[_0x0f2e('0x1a')](handleEntityNotFound(_0x404b37,null))[_0x0f2e('0x1a')](saveUpdates(_0x249d67[_0x0f2e('0x57')],null))[_0x0f2e('0x1a')](respondWithResult(_0x404b37,null))[_0x0f2e('0x25')](handleError(_0x404b37,null));};exports['destroy']=function(_0x241be3,_0x36ca9e){return db[_0x0f2e('0x39')][_0x0f2e('0x55')]({'where':{'id':_0x241be3[_0x0f2e('0x54')]['id']}})[_0x0f2e('0x1a')](handleEntityNotFound(_0x36ca9e,null))[_0x0f2e('0x1a')](removeEntity(_0x36ca9e,null))['catch'](handleError(_0x36ca9e,null));};exports[_0x0f2e('0x58')]=function(_0x32acb7,_0x1d8687,_0x3167bc){var _0x20abfc={};var _0x14eb16={};var _0x480596;var _0x2e0ec3;return db[_0x0f2e('0x39')][_0x0f2e('0x59')]({'where':{'id':_0x32acb7[_0x0f2e('0x54')]['id']}})['then'](handleEntityNotFound(_0x1d8687,null))[_0x0f2e('0x1a')](function(_0x571280){if(_0x571280){_0x480596=_0x571280;_0x14eb16['model']=_[_0x0f2e('0x3f')](db['FreshsalesConfiguration']['rawAttributes']);_0x14eb16[_0x0f2e('0x3e')]=_[_0x0f2e('0x3f')](_0x32acb7[_0x0f2e('0x3e')]);_0x14eb16[_0x0f2e('0x48')]=_['intersection'](_0x14eb16['model'],_0x14eb16[_0x0f2e('0x3e')]);_0x20abfc[_0x0f2e('0x41')]=_[_0x0f2e('0x40')](_0x14eb16['model'],qs['fields'](_0x32acb7[_0x0f2e('0x3e')][_0x0f2e('0x42')]));_0x20abfc['attributes']=_0x20abfc[_0x0f2e('0x41')][_0x0f2e('0x5a')]?_0x20abfc[_0x0f2e('0x41')]:_0x14eb16[_0x0f2e('0x3d')];_0x20abfc['order']=qs[_0x0f2e('0x46')](_0x32acb7[_0x0f2e('0x3e')]['sort']);_0x20abfc[_0x0f2e('0x47')]=qs[_0x0f2e('0x48')](_[_0x0f2e('0x49')](_0x32acb7[_0x0f2e('0x3e')],_0x14eb16['filters']));if(_0x32acb7[_0x0f2e('0x3e')][_0x0f2e('0x4a')]){_0x20abfc[_0x0f2e('0x47')]=_['merge'](_0x20abfc[_0x0f2e('0x47')],{'$or':_[_0x0f2e('0x38')](_0x20abfc[_0x0f2e('0x41')],function(_0x37ff08){var _0x3e2467={};_0x3e2467[_0x37ff08]={'$like':'%'+_0x32acb7[_0x0f2e('0x3e')][_0x0f2e('0x4a')]+'%'};return _0x3e2467;})});}_0x20abfc=_[_0x0f2e('0x4b')]({},_0x20abfc,_0x32acb7[_0x0f2e('0x4e')]);return _0x480596[_0x0f2e('0x58')](_0x20abfc);}})[_0x0f2e('0x1a')](function(_0x298186){if(_0x298186){_0x2e0ec3=_0x298186[_0x0f2e('0x5a')];if(!_0x32acb7[_0x0f2e('0x3e')][_0x0f2e('0x43')](_0x0f2e('0x44'))){_0x20abfc['limit']=qs[_0x0f2e('0x2a')](_0x32acb7[_0x0f2e('0x3e')][_0x0f2e('0x2a')]);_0x20abfc[_0x0f2e('0x28')]=qs[_0x0f2e('0x28')](_0x32acb7[_0x0f2e('0x3e')]['offset']);}return _0x480596[_0x0f2e('0x58')](_0x20abfc);}})[_0x0f2e('0x1a')](function(_0x3b225a){if(_0x3b225a){return _0x3b225a?{'count':_0x2e0ec3,'rows':_0x3b225a}:null;}})[_0x0f2e('0x1a')](respondWithResult(_0x1d8687,null))[_0x0f2e('0x25')](handleError(_0x1d8687,null));};exports[_0x0f2e('0x5b')]=function(_0x58219f,_0x45bb58,_0x4047c0){if(_0x58219f[_0x0f2e('0x57')]['id']){delete _0x58219f[_0x0f2e('0x57')]['id'];}return db[_0x0f2e('0x39')][_0x0f2e('0x59')]({'where':{'id':_0x58219f['params']['id']}})['then'](handleEntityNotFound(_0x45bb58,null))[_0x0f2e('0x1a')](function(_0x119586){if(_0x119586){_0x58219f[_0x0f2e('0x57')][_0x0f2e('0x5c')]=_0x119586['id'];_0x58219f[_0x0f2e('0x57')]['Subjects']=integrations[_0x0f2e('0x5d')](_0x58219f['body'][_0x0f2e('0x5e')],_0x58219f['body'][_0x0f2e('0x4c')]);_0x58219f[_0x0f2e('0x57')]['Descriptions']=integrations['getDescriptions'](_0x58219f[_0x0f2e('0x57')]['channel'],_0x58219f['body']['type']);return db[_0x0f2e('0x5f')][_0x0f2e('0x56')](_0x58219f[_0x0f2e('0x57')],{'include':[{'model':db[_0x0f2e('0x60')],'as':_0x0f2e('0x61')},{'model':db[_0x0f2e('0x60')],'as':'Descriptions'}]});}return null;})[_0x0f2e('0x1a')](respondWithResult(_0x45bb58,null))[_0x0f2e('0x25')](handleError(_0x45bb58,null));};exports[_0x0f2e('0x62')]=function(_0x52c01d,_0x45a37a,_0x1cce02){var _0x6d01df='';var _0x4d99a5='';return db['FreshsalesAccount'][_0x0f2e('0x59')]({'where':{'id':_0x52c01d['params']['id']},'attributes':['id',_0x0f2e('0x63'),_0x0f2e('0x64'),_0x0f2e('0x65')]})[_0x0f2e('0x1a')](handleEntityNotFound(_0x45a37a,null))[_0x0f2e('0x1a')](function(_0x1d141b){if(_0x1d141b){_0x4d99a5=_0x1d141b['username'];_0x6d01df=_0x1d141b[_0x0f2e('0x64')];var _0x3c3e8d=_0x1d141b[_0x0f2e('0x64')]['slice'](-0x1);if(_0x3c3e8d==='/'){_0x6d01df=_0x6d01df[_0x0f2e('0x66')](0x0,_0x6d01df[_0x0f2e('0x67')](_0x3c3e8d));}return rp({'method':'GET','uri':util[_0x0f2e('0x68')](_0x0f2e('0x69'),_0x6d01df,'/api/selector/owners'),'headers':{'Authorization':_0x0f2e('0x6a')+_0x1d141b[_0x0f2e('0x65')]},'json':!![]});}})[_0x0f2e('0x1a')](function(_0x3fcf2a){if(_0x3fcf2a){var _0x3a97aa=_0x3fcf2a[_0x0f2e('0x6b')];var _0x581171=![];var _0x4b0ae5=null;for(_0x4b0ae5=0x0;_0x4b0ae5<_0x3a97aa[_0x0f2e('0x5a')];_0x4b0ae5++){if(_0x3a97aa[_0x4b0ae5][_0x0f2e('0x6c')]===_0x4d99a5){_0x581171=!![];}}if(_0x581171){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0f2e('0x6d')});}}})['then'](respondWithResult(_0x45a37a,null))[_0x0f2e('0x25')](function(_0x57e970){var _0x15fbdc=_0x52c01d[_0x0f2e('0x3e')][_0x0f2e('0x6e')]?0x1f4:_0x57e970['statusCode']||0x1f4;logger[_0x0f2e('0x21')](_0x0f2e('0x6f'),_0x0f2e('0x62'),_0x15fbdc,JSON[_0x0f2e('0x20')](_0x57e970));delete _0x57e970['name'];if(_0x15fbdc===0x191){_0x15fbdc=0x190;}_0x45a37a[_0x0f2e('0x2c')](_0x15fbdc)[_0x0f2e('0x70')](_0x52c01d[_0x0f2e('0x3e')][_0x0f2e('0x6e')]?{'message':_0x0f2e('0x71'),'statusCode':_0x57e970[_0x0f2e('0x72')]}:_0x57e970);});}; \ No newline at end of file +var _0xe7de=['update','getConfigurations','where','hasOwnProperty','findOne','AccountId','Subjects','Descriptions','getDescriptions','channel','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','apiKey','users','email','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','name','send','index','map','FreshsalesAccount','rawAttributes','type','model','keys','query','filters','attributes','fields','length','nolimit','order','sort','pick','filter','merge','options','include','findAll','rows','show','params','intersection','find','create','body'];(function(_0x26b0ae,_0x37ec6a){var _0x28a55b=function(_0xcbfe02){while(--_0xcbfe02){_0x26b0ae['push'](_0x26b0ae['shift']());}};_0x28a55b(++_0x37ec6a);}(_0xe7de,0x165));var _0xee7d=function(_0x4ad48a,_0x309ddd){_0x4ad48a=_0x4ad48a-0x0;var _0xb011e5=_0xe7de[_0x4ad48a];return _0xb011e5;};'use strict';var emlformat=require(_0xee7d('0x0'));var rimraf=require(_0xee7d('0x1'));var zipdir=require(_0xee7d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xee7d('0x3'));var BPromise=require(_0xee7d('0x4'));var Mustache=require(_0xee7d('0x5'));var util=require(_0xee7d('0x6'));var path=require(_0xee7d('0x7'));var sox=require(_0xee7d('0x8'));var csv=require(_0xee7d('0x9'));var ejs=require(_0xee7d('0xa'));var fs=require('fs');var fs_extra=require(_0xee7d('0xb'));var _=require(_0xee7d('0xc'));var squel=require(_0xee7d('0xd'));var crypto=require(_0xee7d('0xe'));var jsforce=require(_0xee7d('0xf'));var deskjs=require(_0xee7d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xee7d('0x11'));var Papa=require(_0xee7d('0x12'));var Redis=require(_0xee7d('0x13'));var authService=require(_0xee7d('0x14'));var qs=require(_0xee7d('0x15'));var as=require(_0xee7d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee7d('0x17'))('api');var utils=require(_0xee7d('0x18'));var config=require(_0xee7d('0x19'));var licenseUtil=require(_0xee7d('0x1a'));var db=require(_0xee7d('0x1b'))['db'];var integrations=require(_0xee7d('0x1c'));var jayson=require(_0xee7d('0x1d'));var client=jayson[_0xee7d('0x1e')][_0xee7d('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x733352,_0x3a3ddd,_0x41ca24,_0x47eb16){return new BPromise(function(_0x4bfdab,_0x2f1184){var _0x1e9ea0=_0x47eb16||client;return _0x1e9ea0[_0xee7d('0x20')](_0x733352,_0x41ca24)[_0xee7d('0x21')](function(_0x1a2976){logger[_0xee7d('0x22')]('FreshsalesAccount,\x20%s,\x20%s',_0x3a3ddd,_0xee7d('0x23'));logger[_0xee7d('0x24')](_0xee7d('0x25'),_0x3a3ddd,_0xee7d('0x23'),JSON[_0xee7d('0x26')](_0x1a2976));if(_0x1a2976[_0xee7d('0x27')]){if(_0x1a2976['error'][_0xee7d('0x28')]===0x1f4){logger[_0xee7d('0x27')](_0xee7d('0x29'),_0x3a3ddd,_0x1a2976['error'][_0xee7d('0x2a')]);return _0x2f1184(_0x1a2976['error'][_0xee7d('0x2a')]);}logger[_0xee7d('0x27')](_0xee7d('0x29'),_0x3a3ddd,_0x1a2976['error'][_0xee7d('0x2a')]);return _0x4bfdab(_0x1a2976['error'][_0xee7d('0x2a')]);}else{logger[_0xee7d('0x22')](_0xee7d('0x29'),_0x3a3ddd,_0xee7d('0x23'));_0x4bfdab(_0x1a2976['result'][_0xee7d('0x2a')]);}})[_0xee7d('0x2b')](function(_0x222ffc){logger[_0xee7d('0x27')](_0xee7d('0x29'),_0x3a3ddd,_0x222ffc);_0x2f1184(_0x222ffc);});});}function respondWithStatusCode(_0x4d0efb,_0x172850){_0x172850=_0x172850||0xcc;return function(_0x34af16){if(_0x34af16){return _0x4d0efb[_0xee7d('0x2c')](_0x172850);}return _0x4d0efb['status'](_0x172850)[_0xee7d('0x2d')]();};}function respondWithResult(_0x293382,_0x379de9){_0x379de9=_0x379de9||0xc8;return function(_0x576d56){if(_0x576d56){return _0x293382[_0xee7d('0x2e')](_0x379de9)[_0xee7d('0x2f')](_0x576d56);}};}function respondWithFilteredResult(_0x4532cb,_0x2b9482){return function(_0x2e2264){if(_0x2e2264){var _0x1b4492=typeof _0x2b9482[_0xee7d('0x30')]===_0xee7d('0x31')&&typeof _0x2b9482[_0xee7d('0x32')]==='undefined';var _0x440bc4=_0x2e2264['count'];var _0x5ca947=_0x1b4492?0x0:_0x2b9482[_0xee7d('0x30')];var _0x4d4ff0=_0x1b4492?_0x2e2264[_0xee7d('0x33')]:_0x2b9482[_0xee7d('0x30')]+_0x2b9482['limit'];var _0x6b6174;if(_0x4d4ff0>=_0x440bc4){_0x4d4ff0=_0x440bc4;_0x6b6174=0xc8;}else{_0x6b6174=0xce;}_0x4532cb[_0xee7d('0x2e')](_0x6b6174);return _0x4532cb[_0xee7d('0x34')](_0xee7d('0x35'),_0x5ca947+'-'+_0x4d4ff0+'/'+_0x440bc4)[_0xee7d('0x2f')](_0x2e2264);}return null;};}function patchUpdates(_0x4c7401){return function(_0x382630){try{jsonpatch[_0xee7d('0x36')](_0x382630,_0x4c7401,!![]);}catch(_0x2b37f4){return BPromise[_0xee7d('0x37')](_0x2b37f4);}return _0x382630[_0xee7d('0x38')]();};}function saveUpdates(_0x6405b4,_0x14d60c){return function(_0x2d3700){if(_0x2d3700){return _0x2d3700['update'](_0x6405b4)[_0xee7d('0x21')](function(_0x3ad5c6){return _0x3ad5c6;});}return null;};}function removeEntity(_0xccf52c,_0x58fe68){return function(_0x2dab1e){if(_0x2dab1e){return _0x2dab1e['destroy']()[_0xee7d('0x21')](function(){_0xccf52c[_0xee7d('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a6d69,_0xbc7eb1){return function(_0x5371b7){if(!_0x5371b7){_0x5a6d69[_0xee7d('0x2c')](0x194);}return _0x5371b7;};}function handleError(_0x2564a8,_0xd31202){_0xd31202=_0xd31202||0x1f4;return function(_0x25f960){logger[_0xee7d('0x27')](_0x25f960['stack']);if(_0x25f960['name']){delete _0x25f960[_0xee7d('0x39')];}_0x2564a8['status'](_0xd31202)[_0xee7d('0x3a')](_0x25f960);};}exports[_0xee7d('0x3b')]=function(_0x29268e,_0x1decf2){var _0xf7ed45={},_0x36a554={},_0xa190f1={'count':0x0,'rows':[]};var _0x3d0f1f=_[_0xee7d('0x3c')](db[_0xee7d('0x3d')][_0xee7d('0x3e')],function(_0x4095f7){return{'name':_0x4095f7['fieldName'],'type':_0x4095f7[_0xee7d('0x3f')]['key']};});_0x36a554[_0xee7d('0x40')]=_[_0xee7d('0x3c')](_0x3d0f1f,_0xee7d('0x39'));_0x36a554['query']=_[_0xee7d('0x41')](_0x29268e[_0xee7d('0x42')]);_0x36a554[_0xee7d('0x43')]=_['intersection'](_0x36a554[_0xee7d('0x40')],_0x36a554['query']);_0xf7ed45[_0xee7d('0x44')]=_['intersection'](_0x36a554['model'],qs[_0xee7d('0x45')](_0x29268e[_0xee7d('0x42')][_0xee7d('0x45')]));_0xf7ed45[_0xee7d('0x44')]=_0xf7ed45['attributes'][_0xee7d('0x46')]?_0xf7ed45['attributes']:_0x36a554['model'];if(!_0x29268e[_0xee7d('0x42')]['hasOwnProperty'](_0xee7d('0x47'))){_0xf7ed45['limit']=qs[_0xee7d('0x32')](_0x29268e[_0xee7d('0x42')][_0xee7d('0x32')]);_0xf7ed45[_0xee7d('0x30')]=qs['offset'](_0x29268e[_0xee7d('0x42')][_0xee7d('0x30')]);}_0xf7ed45[_0xee7d('0x48')]=qs[_0xee7d('0x49')](_0x29268e[_0xee7d('0x42')][_0xee7d('0x49')]);_0xf7ed45['where']=qs[_0xee7d('0x43')](_[_0xee7d('0x4a')](_0x29268e[_0xee7d('0x42')],_0x36a554[_0xee7d('0x43')]),_0x3d0f1f);if(_0x29268e['query'][_0xee7d('0x4b')]){_0xf7ed45['where']=_[_0xee7d('0x4c')](_0xf7ed45['where'],{'$or':_[_0xee7d('0x3c')](_0x3d0f1f,function(_0x8da1bb){if(_0x8da1bb[_0xee7d('0x3f')]!=='VIRTUAL'){var _0x39a069={};_0x39a069[_0x8da1bb['name']]={'$like':'%'+_0x29268e[_0xee7d('0x42')]['filter']+'%'};return _0x39a069;}})});}_0xf7ed45=_[_0xee7d('0x4c')]({},_0xf7ed45,_0x29268e[_0xee7d('0x4d')]);var _0x7b6d8d={'where':_0xf7ed45['where']};return db[_0xee7d('0x3d')][_0xee7d('0x33')](_0x7b6d8d)['then'](function(_0x5895a6){_0xa190f1[_0xee7d('0x33')]=_0x5895a6;if(_0x29268e[_0xee7d('0x42')]['includeAll']){_0xf7ed45[_0xee7d('0x4e')]=[{'all':!![]}];}return db[_0xee7d('0x3d')][_0xee7d('0x4f')](_0xf7ed45);})['then'](function(_0x58cbfe){_0xa190f1[_0xee7d('0x50')]=_0x58cbfe;return _0xa190f1;})[_0xee7d('0x21')](respondWithFilteredResult(_0x1decf2,_0xf7ed45))[_0xee7d('0x2b')](handleError(_0x1decf2,null));};exports[_0xee7d('0x51')]=function(_0x1920bb,_0xd13c3a){var _0x486cfc={'raw':![],'where':{'id':_0x1920bb[_0xee7d('0x52')]['id']}},_0x2306e9={};_0x2306e9[_0xee7d('0x40')]=_[_0xee7d('0x41')](db[_0xee7d('0x3d')][_0xee7d('0x3e')]);_0x2306e9[_0xee7d('0x42')]=_[_0xee7d('0x41')](_0x1920bb[_0xee7d('0x42')]);_0x2306e9[_0xee7d('0x43')]=_['intersection'](_0x2306e9['model'],_0x2306e9[_0xee7d('0x42')]);_0x486cfc[_0xee7d('0x44')]=_[_0xee7d('0x53')](_0x2306e9[_0xee7d('0x40')],qs[_0xee7d('0x45')](_0x1920bb[_0xee7d('0x42')][_0xee7d('0x45')]));_0x486cfc['attributes']=_0x486cfc[_0xee7d('0x44')]['length']?_0x486cfc[_0xee7d('0x44')]:_0x2306e9[_0xee7d('0x40')];if(_0x1920bb['query']['includeAll']){_0x486cfc['include']=[{'all':!![]}];}_0x486cfc=_[_0xee7d('0x4c')]({},_0x486cfc,_0x1920bb[_0xee7d('0x4d')]);return db[_0xee7d('0x3d')][_0xee7d('0x54')](_0x486cfc)[_0xee7d('0x21')](handleEntityNotFound(_0xd13c3a,null))['then'](respondWithResult(_0xd13c3a,null))[_0xee7d('0x2b')](handleError(_0xd13c3a,null));};exports[_0xee7d('0x55')]=function(_0x1dd159,_0x244db8){return db[_0xee7d('0x3d')][_0xee7d('0x55')](_0x1dd159[_0xee7d('0x56')],{})[_0xee7d('0x21')](respondWithResult(_0x244db8,0xc9))['catch'](handleError(_0x244db8,null));};exports[_0xee7d('0x57')]=function(_0x36881b,_0x1bc239){if(_0x36881b[_0xee7d('0x56')]['id']){delete _0x36881b[_0xee7d('0x56')]['id'];}return db['FreshsalesAccount'][_0xee7d('0x54')]({'where':{'id':_0x36881b['params']['id']}})['then'](handleEntityNotFound(_0x1bc239,null))[_0xee7d('0x21')](saveUpdates(_0x36881b['body'],null))[_0xee7d('0x21')](respondWithResult(_0x1bc239,null))[_0xee7d('0x2b')](handleError(_0x1bc239,null));};exports['destroy']=function(_0x526c95,_0x5b2695){return db[_0xee7d('0x3d')][_0xee7d('0x54')]({'where':{'id':_0x526c95[_0xee7d('0x52')]['id']}})[_0xee7d('0x21')](handleEntityNotFound(_0x5b2695,null))[_0xee7d('0x21')](removeEntity(_0x5b2695,null))['catch'](handleError(_0x5b2695,null));};exports[_0xee7d('0x58')]=function(_0x256b46,_0x384de4,_0x434ddb){var _0x1cdc47={};var _0x35d1a8={};var _0x4e349e;var _0x52c8f1;return db[_0xee7d('0x3d')]['findOne']({'where':{'id':_0x256b46[_0xee7d('0x52')]['id']}})[_0xee7d('0x21')](handleEntityNotFound(_0x384de4,null))[_0xee7d('0x21')](function(_0xa92874){if(_0xa92874){_0x4e349e=_0xa92874;_0x35d1a8['model']=_['keys'](db['FreshsalesConfiguration'][_0xee7d('0x3e')]);_0x35d1a8[_0xee7d('0x42')]=_[_0xee7d('0x41')](_0x256b46[_0xee7d('0x42')]);_0x35d1a8['filters']=_[_0xee7d('0x53')](_0x35d1a8['model'],_0x35d1a8[_0xee7d('0x42')]);_0x1cdc47[_0xee7d('0x44')]=_[_0xee7d('0x53')](_0x35d1a8[_0xee7d('0x40')],qs[_0xee7d('0x45')](_0x256b46[_0xee7d('0x42')][_0xee7d('0x45')]));_0x1cdc47[_0xee7d('0x44')]=_0x1cdc47[_0xee7d('0x44')][_0xee7d('0x46')]?_0x1cdc47[_0xee7d('0x44')]:_0x35d1a8[_0xee7d('0x40')];_0x1cdc47['order']=qs[_0xee7d('0x49')](_0x256b46[_0xee7d('0x42')][_0xee7d('0x49')]);_0x1cdc47[_0xee7d('0x59')]=qs[_0xee7d('0x43')](_[_0xee7d('0x4a')](_0x256b46[_0xee7d('0x42')],_0x35d1a8['filters']));if(_0x256b46[_0xee7d('0x42')][_0xee7d('0x4b')]){_0x1cdc47['where']=_[_0xee7d('0x4c')](_0x1cdc47[_0xee7d('0x59')],{'$or':_[_0xee7d('0x3c')](_0x1cdc47[_0xee7d('0x44')],function(_0xfc5f96){var _0x37197f={};_0x37197f[_0xfc5f96]={'$like':'%'+_0x256b46[_0xee7d('0x42')][_0xee7d('0x4b')]+'%'};return _0x37197f;})});}_0x1cdc47=_['merge']({},_0x1cdc47,_0x256b46['options']);return _0x4e349e[_0xee7d('0x58')](_0x1cdc47);}})[_0xee7d('0x21')](function(_0x19b8b8){if(_0x19b8b8){_0x52c8f1=_0x19b8b8[_0xee7d('0x46')];if(!_0x256b46[_0xee7d('0x42')][_0xee7d('0x5a')]('nolimit')){_0x1cdc47[_0xee7d('0x32')]=qs[_0xee7d('0x32')](_0x256b46[_0xee7d('0x42')][_0xee7d('0x32')]);_0x1cdc47['offset']=qs['offset'](_0x256b46[_0xee7d('0x42')][_0xee7d('0x30')]);}return _0x4e349e[_0xee7d('0x58')](_0x1cdc47);}})[_0xee7d('0x21')](function(_0x4c2390){if(_0x4c2390){return _0x4c2390?{'count':_0x52c8f1,'rows':_0x4c2390}:null;}})['then'](respondWithResult(_0x384de4,null))[_0xee7d('0x2b')](handleError(_0x384de4,null));};exports['addConfiguration']=function(_0x28c0b7,_0x3d81a7,_0x5ba075){if(_0x28c0b7[_0xee7d('0x56')]['id']){delete _0x28c0b7[_0xee7d('0x56')]['id'];}return db[_0xee7d('0x3d')][_0xee7d('0x5b')]({'where':{'id':_0x28c0b7[_0xee7d('0x52')]['id']}})[_0xee7d('0x21')](handleEntityNotFound(_0x3d81a7,null))[_0xee7d('0x21')](function(_0x585d7b){if(_0x585d7b){_0x28c0b7[_0xee7d('0x56')][_0xee7d('0x5c')]=_0x585d7b['id'];_0x28c0b7['body'][_0xee7d('0x5d')]=integrations['getSubjects'](_0x28c0b7['body']['channel'],_0x28c0b7['body'][_0xee7d('0x3f')]);_0x28c0b7[_0xee7d('0x56')][_0xee7d('0x5e')]=integrations[_0xee7d('0x5f')](_0x28c0b7[_0xee7d('0x56')][_0xee7d('0x60')],_0x28c0b7[_0xee7d('0x56')][_0xee7d('0x3f')]);return db['FreshsalesConfiguration']['create'](_0x28c0b7['body'],{'include':[{'model':db['FreshsalesField'],'as':_0xee7d('0x5d')},{'model':db['FreshsalesField'],'as':_0xee7d('0x5e')}]});}return null;})[_0xee7d('0x21')](respondWithResult(_0x3d81a7,null))['catch'](handleError(_0x3d81a7,null));};exports[_0xee7d('0x61')]=function(_0xd828cc,_0x33b598,_0x3d520a){var _0x382263='';var _0x293bd2='';return db['FreshsalesAccount'][_0xee7d('0x5b')]({'where':{'id':_0xd828cc[_0xee7d('0x52')]['id']},'attributes':['id','username',_0xee7d('0x62'),'apiKey']})[_0xee7d('0x21')](handleEntityNotFound(_0x33b598,null))[_0xee7d('0x21')](function(_0xd9ae4d){if(_0xd9ae4d){_0x293bd2=_0xd9ae4d['username'];_0x382263=_0xd9ae4d['remoteUri'];var _0x25ccab=_0xd9ae4d[_0xee7d('0x62')][_0xee7d('0x63')](-0x1);if(_0x25ccab==='/'){_0x382263=_0x382263[_0xee7d('0x64')](0x0,_0x382263[_0xee7d('0x65')](_0x25ccab));}return rp({'method':_0xee7d('0x66'),'uri':util[_0xee7d('0x67')](_0xee7d('0x68'),_0x382263,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0xd9ae4d[_0xee7d('0x69')]},'json':!![]});}})[_0xee7d('0x21')](function(_0x1fc49f){if(_0x1fc49f){var _0x1c6269=_0x1fc49f[_0xee7d('0x6a')];var _0x47806f=![];var _0x184384=null;for(_0x184384=0x0;_0x184384<_0x1c6269[_0xee7d('0x46')];_0x184384++){if(_0x1c6269[_0x184384][_0xee7d('0x6b')]===_0x293bd2){_0x47806f=!![];}}if(_0x47806f){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x33b598,null))[_0xee7d('0x2b')](function(_0x6c2149){var _0x1b6ac8=_0xd828cc[_0xee7d('0x42')][_0xee7d('0x6c')]?0x1f4:_0x6c2149[_0xee7d('0x6d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xee7d('0x61'),_0x1b6ac8,JSON[_0xee7d('0x26')](_0x6c2149));delete _0x6c2149[_0xee7d('0x39')];if(_0x1b6ac8===0x191){_0x1b6ac8=0x190;}_0x33b598[_0xee7d('0x2e')](_0x1b6ac8)['send'](_0xd828cc[_0xee7d('0x42')][_0xee7d('0x6c')]?{'message':_0xee7d('0x6e'),'statusCode':_0x6c2149[_0xee7d('0x6d')]}:_0x6c2149);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 3716706..ea314ee 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6fc2=['util','../../config/logger','moment','bluebird','../../config/environment','./intFreshsalesAccount.attributes','exports','define','int_freshsales_accounts','lodash'];(function(_0x183959,_0x324aef){var _0x448a90=function(_0xf2cdb1){while(--_0xf2cdb1){_0x183959['push'](_0x183959['shift']());}};_0x448a90(++_0x324aef);}(_0x6fc2,0x117));var _0x26fc=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x6fc2[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x26fc('0x0'));var util=require(_0x26fc('0x1'));var logger=require(_0x26fc('0x2'))('api');var moment=require(_0x26fc('0x3'));var BPromise=require(_0x26fc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x26fc('0x5'));var attributes=require(_0x26fc('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x26fc('0x7')]=function(_0x3018aa,_0x2f5258){return _0x3018aa[_0x26fc('0x8')]('FreshsalesAccount',attributes,{'tableName':_0x26fc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a28=['util','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','exports','define','int_freshsales_accounts','lodash'];(function(_0x3245dc,_0x40a4c8){var _0x34c6b3=function(_0x42dd1a){while(--_0x42dd1a){_0x3245dc['push'](_0x3245dc['shift']());}};_0x34c6b3(++_0x40a4c8);}(_0x9a28,0x16a));var _0x89a2=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x9a28[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x89a2('0x0'));var util=require(_0x89a2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x89a2('0x2'));var BPromise=require(_0x89a2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x89a2('0x4'));var rimraf=require(_0x89a2('0x5'));var config=require(_0x89a2('0x6'));var attributes=require(_0x89a2('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x89a2('0x8')]=function(_0x558aae,_0x53c88c){return _0x558aae[_0x89a2('0x9')]('FreshsalesAccount',attributes,{'tableName':_0x89a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 62a38fb..50ed772 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe1c4=['result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','stringify','ShowFreshsalesAccount','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x1db86d,_0x42060a){var _0x54ca99=function(_0x185fbc){while(--_0x185fbc){_0x1db86d['push'](_0x1db86d['shift']());}};_0x54ca99(++_0x42060a);}(_0xe1c4,0x1ec));var _0x4e1c=function(_0x61a7b2,_0x1ebc7f){_0x61a7b2=_0x61a7b2-0x0;var _0xfe0901=_0xe1c4[_0x61a7b2];return _0xfe0901;};'use strict';var _=require(_0x4e1c('0x0'));var util=require(_0x4e1c('0x1'));var moment=require(_0x4e1c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e1c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e1c('0x4'));var logger=require(_0x4e1c('0x5'))(_0x4e1c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4e1c('0x7')][_0x4e1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44db21,_0x1c7e52,_0x460295){return new BPromise(function(_0x108830,_0x2622b4){return client[_0x4e1c('0x9')](_0x44db21,_0x460295)[_0x4e1c('0xa')](function(_0x60e98c){logger[_0x4e1c('0xb')](_0x4e1c('0xc'),_0x1c7e52,_0x4e1c('0xd'));logger['debug'](_0x4e1c('0xe'),_0x1c7e52,_0x4e1c('0xd'),JSON['stringify'](_0x60e98c));if(_0x60e98c[_0x4e1c('0xf')]){if(_0x60e98c[_0x4e1c('0xf')][_0x4e1c('0x10')]===0x1f4){logger[_0x4e1c('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x1c7e52,_0x60e98c[_0x4e1c('0xf')][_0x4e1c('0x11')]);return _0x2622b4(_0x60e98c[_0x4e1c('0xf')][_0x4e1c('0x11')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x1c7e52,_0x60e98c['error'][_0x4e1c('0x11')]);return _0x108830(_0x60e98c[_0x4e1c('0xf')][_0x4e1c('0x11')]);}else{logger[_0x4e1c('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x1c7e52,_0x4e1c('0xd'));_0x108830(_0x60e98c[_0x4e1c('0x12')][_0x4e1c('0x11')]);}})[_0x4e1c('0x13')](function(_0x44a842){logger[_0x4e1c('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x1c7e52,_0x44a842);_0x2622b4(_0x44a842);});});}exports[_0x4e1c('0x14')]=function(_0x399bcc){var _0x2af3db=this;return new Promise(function(_0x46a887,_0x116a01){return db[_0x4e1c('0x15')][_0x4e1c('0x16')]({'raw':_0x399bcc['options']?_0x399bcc[_0x4e1c('0x17')][_0x4e1c('0x18')]===undefined?!![]:![]:!![],'where':_0x399bcc[_0x4e1c('0x17')]?_0x399bcc[_0x4e1c('0x17')][_0x4e1c('0x19')]||null:null,'attributes':_0x399bcc[_0x4e1c('0x17')]?_0x399bcc[_0x4e1c('0x17')]['attributes']||null:null,'limit':_0x399bcc[_0x4e1c('0x17')]?_0x399bcc[_0x4e1c('0x17')][_0x4e1c('0x1a')]||null:null,'include':_0x399bcc[_0x4e1c('0x17')]?_0x399bcc[_0x4e1c('0x17')][_0x4e1c('0x1b')]?_[_0x4e1c('0x1c')](_0x399bcc[_0x4e1c('0x17')][_0x4e1c('0x1b')],function(_0x5ada14){return{'model':db[_0x5ada14[_0x4e1c('0x1d')]],'as':_0x5ada14['as'],'attributes':_0x5ada14[_0x4e1c('0x1e')],'include':_0x5ada14[_0x4e1c('0x1b')]?_['map'](_0x5ada14['include'],function(_0x17f5a5){return{'model':db[_0x17f5a5['model']],'as':_0x17f5a5['as'],'attributes':_0x17f5a5[_0x4e1c('0x1e')],'include':_0x17f5a5[_0x4e1c('0x1b')]?_[_0x4e1c('0x1c')](_0x17f5a5[_0x4e1c('0x1b')],function(_0x12364d){return{'model':db[_0x12364d[_0x4e1c('0x1d')]],'as':_0x12364d['as'],'attributes':_0x12364d['attributes']};}):[]};}):[]};}):[]:[]})[_0x4e1c('0xa')](function(_0x2526a6){logger[_0x4e1c('0xb')](_0x4e1c('0x14'),_0x399bcc);logger[_0x4e1c('0x1f')]('GetFreshsalesAccount',_0x399bcc,JSON[_0x4e1c('0x20')](_0x2526a6));_0x46a887(_0x2526a6);})[_0x4e1c('0x13')](function(_0x1b5ba8){logger[_0x4e1c('0xf')]('GetFreshsalesAccount',_0x1b5ba8[_0x4e1c('0x11')],_0x399bcc);_0x116a01(_0x2af3db[_0x4e1c('0xf')](0x1f4,_0x1b5ba8['message']));});});};exports[_0x4e1c('0x21')]=function(_0x5ae521){var _0x88df92=this;return new Promise(function(_0x3c007f,_0x39f8fc){return db[_0x4e1c('0x15')]['find']({'raw':_0x5ae521[_0x4e1c('0x17')]?_0x5ae521['options'][_0x4e1c('0x18')]===undefined?!![]:![]:!![],'where':_0x5ae521['options']?_0x5ae521[_0x4e1c('0x17')][_0x4e1c('0x19')]||null:null,'attributes':_0x5ae521['options']?_0x5ae521[_0x4e1c('0x17')]['attributes']||null:null,'include':_0x5ae521[_0x4e1c('0x17')]?_0x5ae521[_0x4e1c('0x17')][_0x4e1c('0x1b')]?_[_0x4e1c('0x1c')](_0x5ae521[_0x4e1c('0x17')][_0x4e1c('0x1b')],function(_0x44477f){return{'model':db[_0x44477f[_0x4e1c('0x1d')]],'as':_0x44477f['as'],'attributes':_0x44477f[_0x4e1c('0x1e')],'include':_0x44477f[_0x4e1c('0x1b')]?_['map'](_0x44477f[_0x4e1c('0x1b')],function(_0x35763f){return{'model':db[_0x35763f[_0x4e1c('0x1d')]],'as':_0x35763f['as'],'attributes':_0x35763f[_0x4e1c('0x1e')],'include':_0x35763f[_0x4e1c('0x1b')]?_[_0x4e1c('0x1c')](_0x35763f['include'],function(_0x545d6b){return{'model':db[_0x545d6b[_0x4e1c('0x1d')]],'as':_0x545d6b['as'],'attributes':_0x545d6b[_0x4e1c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4e1c('0xa')](function(_0x4365eb){logger['info'](_0x4e1c('0x21'),_0x5ae521);logger[_0x4e1c('0x1f')]('ShowFreshsalesAccount',_0x5ae521,JSON[_0x4e1c('0x20')](_0x4365eb));_0x3c007f(_0x4365eb);})[_0x4e1c('0x13')](function(_0x729915){logger['error'](_0x4e1c('0x21'),_0x729915[_0x4e1c('0x11')],_0x5ae521);_0x39f8fc(_0x88df92['error'](0x1f4,_0x729915[_0x4e1c('0x11')]));});});}; \ No newline at end of file +var _0x9f0e=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','limit','include','map','model','attributes','ShowFreshsalesAccount','find','where','lodash','util'];(function(_0x301910,_0xbf20f){var _0x543a81=function(_0x9ea910){while(--_0x9ea910){_0x301910['push'](_0x301910['shift']());}};_0x543a81(++_0xbf20f);}(_0x9f0e,0x116));var _0xe9f0=function(_0x4ac765,_0x46f863){_0x4ac765=_0x4ac765-0x0;var _0x5dadd1=_0x9f0e[_0x4ac765];return _0x5dadd1;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var config=require(_0xe9f0('0x8'));var jayson=require(_0xe9f0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a17b3,_0x167198,_0xe64a79){return new BPromise(function(_0x4be6a6,_0xf4a256){return client[_0xe9f0('0xa')](_0x3a17b3,_0xe64a79)[_0xe9f0('0xb')](function(_0x3386a8){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x167198,'request\x20sent',JSON[_0xe9f0('0x11')](_0x3386a8));if(_0x3386a8[_0xe9f0('0x12')]){if(_0x3386a8[_0xe9f0('0x12')]['code']===0x1f4){logger[_0xe9f0('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x167198,_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);return _0xf4a256(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}logger['error'](_0xe9f0('0xd'),_0x167198,_0x3386a8['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}else{logger['info'](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));_0x4be6a6(_0x3386a8[_0xe9f0('0x14')]['message']);}})[_0xe9f0('0x15')](function(_0x1e16e0){logger[_0xe9f0('0x12')](_0xe9f0('0xd'),_0x167198,_0x1e16e0);_0xf4a256(_0x1e16e0);});});}exports[_0xe9f0('0x16')]=function(_0x2ab12b){var _0x3da237=this;return new Promise(function(_0x59bf5a,_0x15a33b){return db[_0xe9f0('0x17')][_0xe9f0('0x18')]({'raw':_0x2ab12b['options']?_0x2ab12b[_0xe9f0('0x19')][_0xe9f0('0x1a')]===undefined?!![]:![]:!![],'where':_0x2ab12b[_0xe9f0('0x19')]?_0x2ab12b[_0xe9f0('0x19')]['where']||null:null,'attributes':_0x2ab12b[_0xe9f0('0x19')]?_0x2ab12b[_0xe9f0('0x19')]['attributes']||null:null,'limit':_0x2ab12b['options']?_0x2ab12b['options'][_0xe9f0('0x1b')]||null:null,'include':_0x2ab12b[_0xe9f0('0x19')]?_0x2ab12b[_0xe9f0('0x19')][_0xe9f0('0x1c')]?_[_0xe9f0('0x1d')](_0x2ab12b['options'][_0xe9f0('0x1c')],function(_0x38b7ee){return{'model':db[_0x38b7ee[_0xe9f0('0x1e')]],'as':_0x38b7ee['as'],'attributes':_0x38b7ee[_0xe9f0('0x1f')],'include':_0x38b7ee[_0xe9f0('0x1c')]?_[_0xe9f0('0x1d')](_0x38b7ee[_0xe9f0('0x1c')],function(_0x1321bb){return{'model':db[_0x1321bb[_0xe9f0('0x1e')]],'as':_0x1321bb['as'],'attributes':_0x1321bb[_0xe9f0('0x1f')],'include':_0x1321bb['include']?_[_0xe9f0('0x1d')](_0x1321bb[_0xe9f0('0x1c')],function(_0x2ddfba){return{'model':db[_0x2ddfba[_0xe9f0('0x1e')]],'as':_0x2ddfba['as'],'attributes':_0x2ddfba['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9f0('0xb')](function(_0x2613fd){logger[_0xe9f0('0xc')](_0xe9f0('0x16'),_0x2ab12b);logger[_0xe9f0('0xf')]('GetFreshsalesAccount',_0x2ab12b,JSON[_0xe9f0('0x11')](_0x2613fd));_0x59bf5a(_0x2613fd);})[_0xe9f0('0x15')](function(_0x44fb5b){logger[_0xe9f0('0x12')](_0xe9f0('0x16'),_0x44fb5b[_0xe9f0('0x13')],_0x2ab12b);_0x15a33b(_0x3da237[_0xe9f0('0x12')](0x1f4,_0x44fb5b[_0xe9f0('0x13')]));});});};exports[_0xe9f0('0x20')]=function(_0x3dbe49){var _0x22806c=this;return new Promise(function(_0x617ad3,_0x445ad0){return db[_0xe9f0('0x17')][_0xe9f0('0x21')]({'raw':_0x3dbe49[_0xe9f0('0x19')]?_0x3dbe49[_0xe9f0('0x19')][_0xe9f0('0x1a')]===undefined?!![]:![]:!![],'where':_0x3dbe49[_0xe9f0('0x19')]?_0x3dbe49[_0xe9f0('0x19')][_0xe9f0('0x22')]||null:null,'attributes':_0x3dbe49[_0xe9f0('0x19')]?_0x3dbe49[_0xe9f0('0x19')][_0xe9f0('0x1f')]||null:null,'include':_0x3dbe49['options']?_0x3dbe49['options']['include']?_[_0xe9f0('0x1d')](_0x3dbe49['options'][_0xe9f0('0x1c')],function(_0xc5fa13){return{'model':db[_0xc5fa13['model']],'as':_0xc5fa13['as'],'attributes':_0xc5fa13[_0xe9f0('0x1f')],'include':_0xc5fa13['include']?_['map'](_0xc5fa13['include'],function(_0x165440){return{'model':db[_0x165440[_0xe9f0('0x1e')]],'as':_0x165440['as'],'attributes':_0x165440['attributes'],'include':_0x165440[_0xe9f0('0x1c')]?_[_0xe9f0('0x1d')](_0x165440[_0xe9f0('0x1c')],function(_0x4d4186){return{'model':db[_0x4d4186['model']],'as':_0x4d4186['as'],'attributes':_0x4d4186[_0xe9f0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe9f0('0xb')](function(_0x1917c8){logger['info'](_0xe9f0('0x20'),_0x3dbe49);logger[_0xe9f0('0xf')](_0xe9f0('0x20'),_0x3dbe49,JSON[_0xe9f0('0x11')](_0x1917c8));_0x617ad3(_0x1917c8);})[_0xe9f0('0x15')](function(_0x552ec2){logger[_0xe9f0('0x12')](_0xe9f0('0x20'),_0x552ec2[_0xe9f0('0x13')],_0x3dbe49);_0x445ad0(_0x22806c['error'](0x1f4,_0x552ec2[_0xe9f0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 1be1a19..6f26113 100644 --- a/server/api/intFreshsalesConfiguration/index.js +++ b/server/api/intFreshsalesConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x45bf=['/:id/fields','getFields','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','/:id','isAuthenticated','show','/:id/subjects','getSubjects','getDescriptions'];(function(_0x40e514,_0x5488ec){var _0x575499=function(_0x31dae9){while(--_0x31dae9){_0x40e514['push'](_0x40e514['shift']());}};_0x575499(++_0x5488ec);}(_0x45bf,0x198));var _0xf45b=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0x45bf[_0x25248b];return _0x509939;};'use strict';var multer=require(_0xf45b('0x0'));var util=require(_0xf45b('0x1'));var path=require('path');var timeout=require(_0xf45b('0x2'));var express=require(_0xf45b('0x3'));var router=express[_0xf45b('0x4')]();var fs_extra=require(_0xf45b('0x5'));var auth=require(_0xf45b('0x6'));var interaction=require(_0xf45b('0x7'));var config=require(_0xf45b('0x8'));var controller=require(_0xf45b('0x9'));router[_0xf45b('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf45b('0xa')](_0xf45b('0xb'),auth[_0xf45b('0xc')](),controller[_0xf45b('0xd')]);router[_0xf45b('0xa')](_0xf45b('0xe'),auth[_0xf45b('0xc')](),controller[_0xf45b('0xf')]);router[_0xf45b('0xa')]('/:id/descriptions',auth[_0xf45b('0xc')](),controller[_0xf45b('0x10')]);router[_0xf45b('0xa')](_0xf45b('0x11'),auth[_0xf45b('0xc')](),controller[_0xf45b('0x12')]);router[_0xf45b('0x13')]('/',auth[_0xf45b('0xc')](),controller[_0xf45b('0x14')]);router[_0xf45b('0x15')](_0xf45b('0xb'),auth[_0xf45b('0xc')](),controller['update']);router[_0xf45b('0x16')](_0xf45b('0xb'),auth[_0xf45b('0xc')](),controller[_0xf45b('0x17')]);module[_0xf45b('0x18')]=router; \ No newline at end of file +var _0xe9c3=['get','index','/:id','isAuthenticated','show','getSubjects','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x396f22,_0x4d87a8){var _0x7aeaa6=function(_0x430844){while(--_0x430844){_0x396f22['push'](_0x396f22['shift']());}};_0x7aeaa6(++_0x4d87a8);}(_0xe9c3,0x122));var _0x3e9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9c3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3e9c('0x0'));var util=require(_0x3e9c('0x1'));var path=require(_0x3e9c('0x2'));var timeout=require('connect-timeout');var express=require(_0x3e9c('0x3'));var router=express[_0x3e9c('0x4')]();var fs_extra=require(_0x3e9c('0x5'));var auth=require(_0x3e9c('0x6'));var interaction=require(_0x3e9c('0x7'));var config=require(_0x3e9c('0x8'));var controller=require(_0x3e9c('0x9'));router[_0x3e9c('0xa')]('/',auth['isAuthenticated'](),controller[_0x3e9c('0xb')]);router['get'](_0x3e9c('0xc'),auth[_0x3e9c('0xd')](),controller[_0x3e9c('0xe')]);router[_0x3e9c('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x3e9c('0xf')]);router[_0x3e9c('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x3e9c('0xa')](_0x3e9c('0x10'),auth[_0x3e9c('0xd')](),controller[_0x3e9c('0x11')]);router[_0x3e9c('0x12')]('/',auth[_0x3e9c('0xd')](),controller[_0x3e9c('0x13')]);router[_0x3e9c('0x14')]('/:id',auth[_0x3e9c('0xd')](),controller[_0x3e9c('0x15')]);router[_0x3e9c('0x16')](_0x3e9c('0xc'),auth[_0x3e9c('0xd')](),controller[_0x3e9c('0x17')]);module[_0x3e9c('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 461f272..db48911 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x363e=['STRING'];(function(_0x2ff38f,_0xefceba){var _0x19a75f=function(_0x22c3b1){while(--_0x22c3b1){_0x2ff38f['push'](_0x2ff38f['shift']());}};_0x19a75f(++_0xefceba);}(_0x363e,0x10a));var _0xe363=function(_0x2bebc4,_0x4f6f05){_0x2bebc4=_0x2bebc4-0x0;var _0x503bd8=_0x363e[_0x2bebc4];return _0x503bd8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe363('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf891=['STRING','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf891,0xbe));var _0x1f89=function(_0x2383f4,_0x29526e){_0x2383f4=_0x2383f4-0x0;var _0x3429d4=_0xf891[_0x2383f4];return _0x3429d4;};'use strict';var Sequelize=require(_0x1f89('0x0'));module[_0x1f89('0x1')]={'name':{'type':Sequelize[_0x1f89('0x2')]},'description':{'type':Sequelize[_0x1f89('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index c320608..d897785 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x61b8=['request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','end','stack','name','send','FreshsalesConfiguration','rawAttributes','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','show','keys','fields','find','create','body','params','destroy','getSubjects','findOne','getDescriptions','FreshsalesField','getFields','eml-format','rimraf','zip-dir'];(function(_0x513e1b,_0x2fbd04){var _0x5861d1=function(_0x5acd6a){while(--_0x5acd6a){_0x513e1b['push'](_0x513e1b['shift']());}};_0x5861d1(++_0x2fbd04);}(_0x61b8,0x169));var _0x861b=function(_0x4d23d7,_0x4cd591){_0x4d23d7=_0x4d23d7-0x0;var _0x29fdd7=_0x61b8[_0x4d23d7];return _0x29fdd7;};'use strict';var emlformat=require(_0x861b('0x0'));var rimraf=require(_0x861b('0x1'));var zipdir=require(_0x861b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x861b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x861b('0x4'));var util=require(_0x861b('0x5'));var path=require(_0x861b('0x6'));var sox=require('sox');var csv=require(_0x861b('0x7'));var ejs=require(_0x861b('0x8'));var fs=require('fs');var fs_extra=require(_0x861b('0x9'));var _=require(_0x861b('0xa'));var squel=require(_0x861b('0xb'));var crypto=require(_0x861b('0xc'));var jsforce=require(_0x861b('0xd'));var deskjs=require(_0x861b('0xe'));var toCsv=require(_0x861b('0x7'));var querystring=require(_0x861b('0xf'));var Papa=require(_0x861b('0x10'));var Redis=require('ioredis');var authService=require(_0x861b('0x11'));var qs=require(_0x861b('0x12'));var as=require(_0x861b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x861b('0x14'))('api');var utils=require(_0x861b('0x15'));var config=require(_0x861b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x861b('0x17'))['db'];var jayson=require(_0x861b('0x18'));var client=jayson[_0x861b('0x19')][_0x861b('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x202a74,_0xff4c8c,_0x245c41,_0x21c585){return new BPromise(function(_0x44b444,_0x226ee9){var _0x1b57ee=_0x21c585||client;return _0x1b57ee[_0x861b('0x1b')](_0x202a74,_0x245c41)[_0x861b('0x1c')](function(_0x3ee3ab){logger[_0x861b('0x1d')](_0x861b('0x1e'),_0xff4c8c,'request\x20sent');logger[_0x861b('0x1f')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0xff4c8c,'request\x20sent',JSON[_0x861b('0x20')](_0x3ee3ab));if(_0x3ee3ab['error']){if(_0x3ee3ab[_0x861b('0x21')][_0x861b('0x22')]===0x1f4){logger['error'](_0x861b('0x1e'),_0xff4c8c,_0x3ee3ab[_0x861b('0x21')][_0x861b('0x23')]);return _0x226ee9(_0x3ee3ab[_0x861b('0x21')]['message']);}logger['error'](_0x861b('0x1e'),_0xff4c8c,_0x3ee3ab[_0x861b('0x21')][_0x861b('0x23')]);return _0x44b444(_0x3ee3ab['error'][_0x861b('0x23')]);}else{logger['info'](_0x861b('0x1e'),_0xff4c8c,_0x861b('0x24'));_0x44b444(_0x3ee3ab['result']['message']);}})[_0x861b('0x25')](function(_0x907bd){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0xff4c8c,_0x907bd);_0x226ee9(_0x907bd);});});}function respondWithStatusCode(_0x24aed8,_0x47be04){_0x47be04=_0x47be04||0xcc;return function(_0x5b91db){if(_0x5b91db){return _0x24aed8[_0x861b('0x26')](_0x47be04);}return _0x24aed8['status'](_0x47be04)['end']();};}function respondWithResult(_0x1b0cc3,_0x24d378){_0x24d378=_0x24d378||0xc8;return function(_0x22369c){if(_0x22369c){return _0x1b0cc3[_0x861b('0x27')](_0x24d378)[_0x861b('0x28')](_0x22369c);}};}function respondWithFilteredResult(_0x58527c,_0x536c97){return function(_0x726496){if(_0x726496){var _0x130dbb=typeof _0x536c97[_0x861b('0x29')]===_0x861b('0x2a')&&typeof _0x536c97[_0x861b('0x2b')]===_0x861b('0x2a');var _0x47e89a=_0x726496['count'];var _0x3882a1=_0x130dbb?0x0:_0x536c97[_0x861b('0x29')];var _0x419259=_0x130dbb?_0x726496[_0x861b('0x2c')]:_0x536c97[_0x861b('0x29')]+_0x536c97[_0x861b('0x2b')];var _0x5bee82;if(_0x419259>=_0x47e89a){_0x419259=_0x47e89a;_0x5bee82=0xc8;}else{_0x5bee82=0xce;}_0x58527c['status'](_0x5bee82);return _0x58527c[_0x861b('0x2d')]('Content-Range',_0x3882a1+'-'+_0x419259+'/'+_0x47e89a)[_0x861b('0x28')](_0x726496);}return null;};}function patchUpdates(_0x13d1c0){return function(_0x35f343){try{jsonpatch[_0x861b('0x2e')](_0x35f343,_0x13d1c0,!![]);}catch(_0x3ff1f2){return BPromise[_0x861b('0x2f')](_0x3ff1f2);}return _0x35f343[_0x861b('0x30')]();};}function saveUpdates(_0x39f1be,_0x4f17c1){return function(_0x4dc9e3){if(_0x4dc9e3){return _0x4dc9e3[_0x861b('0x31')](_0x39f1be)['then'](function(_0x1a8a6c){return _0x1a8a6c;});}return null;};}function removeEntity(_0x39e279,_0x50e5d8){return function(_0x29e31d){if(_0x29e31d){return _0x29e31d['destroy']()['then'](function(){_0x39e279[_0x861b('0x27')](0xcc)[_0x861b('0x32')]();});}};}function handleEntityNotFound(_0x56c22e,_0x3469c2){return function(_0x3dce55){if(!_0x3dce55){_0x56c22e['sendStatus'](0x194);}return _0x3dce55;};}function handleError(_0x1ecf53,_0xce2f23){_0xce2f23=_0xce2f23||0x1f4;return function(_0x5e0410){logger[_0x861b('0x21')](_0x5e0410[_0x861b('0x33')]);if(_0x5e0410[_0x861b('0x34')]){delete _0x5e0410[_0x861b('0x34')];}_0x1ecf53[_0x861b('0x27')](_0xce2f23)[_0x861b('0x35')](_0x5e0410);};}exports['index']=function(_0x1b8520,_0x415562){var _0x1a677e={},_0x2936fc={},_0x5fa252={'count':0x0,'rows':[]};var _0x4dbaaa=_['map'](db[_0x861b('0x36')][_0x861b('0x37')],function(_0x4b0ac2){return{'name':_0x4b0ac2['fieldName'],'type':_0x4b0ac2[_0x861b('0x38')][_0x861b('0x39')]};});_0x2936fc[_0x861b('0x3a')]=_[_0x861b('0x3b')](_0x4dbaaa,_0x861b('0x34'));_0x2936fc[_0x861b('0x3c')]=_['keys'](_0x1b8520[_0x861b('0x3c')]);_0x2936fc[_0x861b('0x3d')]=_[_0x861b('0x3e')](_0x2936fc[_0x861b('0x3a')],_0x2936fc[_0x861b('0x3c')]);_0x1a677e[_0x861b('0x3f')]=_['intersection'](_0x2936fc[_0x861b('0x3a')],qs['fields'](_0x1b8520[_0x861b('0x3c')]['fields']));_0x1a677e[_0x861b('0x3f')]=_0x1a677e[_0x861b('0x3f')][_0x861b('0x40')]?_0x1a677e[_0x861b('0x3f')]:_0x2936fc[_0x861b('0x3a')];if(!_0x1b8520['query'][_0x861b('0x41')](_0x861b('0x42'))){_0x1a677e[_0x861b('0x2b')]=qs[_0x861b('0x2b')](_0x1b8520['query'][_0x861b('0x2b')]);_0x1a677e[_0x861b('0x29')]=qs['offset'](_0x1b8520[_0x861b('0x3c')][_0x861b('0x29')]);}_0x1a677e[_0x861b('0x43')]=qs['sort'](_0x1b8520[_0x861b('0x3c')][_0x861b('0x44')]);_0x1a677e['where']=qs[_0x861b('0x3d')](_[_0x861b('0x45')](_0x1b8520['query'],_0x2936fc[_0x861b('0x3d')]),_0x4dbaaa);if(_0x1b8520[_0x861b('0x3c')]['filter']){_0x1a677e[_0x861b('0x46')]=_[_0x861b('0x47')](_0x1a677e[_0x861b('0x46')],{'$or':_[_0x861b('0x3b')](_0x4dbaaa,function(_0x1f0983){if(_0x1f0983[_0x861b('0x38')]!=='VIRTUAL'){var _0x8f3581={};_0x8f3581[_0x1f0983['name']]={'$like':'%'+_0x1b8520[_0x861b('0x3c')][_0x861b('0x48')]+'%'};return _0x8f3581;}})});}_0x1a677e=_['merge']({},_0x1a677e,_0x1b8520[_0x861b('0x49')]);var _0x186135={'where':_0x1a677e[_0x861b('0x46')]};return db[_0x861b('0x36')][_0x861b('0x2c')](_0x186135)['then'](function(_0xb793be){_0x5fa252[_0x861b('0x2c')]=_0xb793be;if(_0x1b8520['query'][_0x861b('0x4a')]){_0x1a677e[_0x861b('0x4b')]=[{'all':!![]}];}return db[_0x861b('0x36')][_0x861b('0x4c')](_0x1a677e);})[_0x861b('0x1c')](function(_0x1302a0){_0x5fa252[_0x861b('0x4d')]=_0x1302a0;return _0x5fa252;})[_0x861b('0x1c')](respondWithFilteredResult(_0x415562,_0x1a677e))[_0x861b('0x25')](handleError(_0x415562,null));};exports[_0x861b('0x4e')]=function(_0x5b3953,_0x3415d4){var _0x5f2145={'raw':![],'where':{'id':_0x5b3953['params']['id']}},_0x1074f1={};_0x1074f1[_0x861b('0x3a')]=_[_0x861b('0x4f')](db['FreshsalesConfiguration'][_0x861b('0x37')]);_0x1074f1['query']=_[_0x861b('0x4f')](_0x5b3953[_0x861b('0x3c')]);_0x1074f1[_0x861b('0x3d')]=_['intersection'](_0x1074f1[_0x861b('0x3a')],_0x1074f1[_0x861b('0x3c')]);_0x5f2145[_0x861b('0x3f')]=_[_0x861b('0x3e')](_0x1074f1[_0x861b('0x3a')],qs[_0x861b('0x50')](_0x5b3953[_0x861b('0x3c')][_0x861b('0x50')]));_0x5f2145['attributes']=_0x5f2145[_0x861b('0x3f')][_0x861b('0x40')]?_0x5f2145[_0x861b('0x3f')]:_0x1074f1['model'];if(_0x5b3953[_0x861b('0x3c')][_0x861b('0x4a')]){_0x5f2145['include']=[{'all':!![]}];}_0x5f2145=_[_0x861b('0x47')]({},_0x5f2145,_0x5b3953['options']);return db[_0x861b('0x36')][_0x861b('0x51')](_0x5f2145)[_0x861b('0x1c')](handleEntityNotFound(_0x3415d4,null))[_0x861b('0x1c')](respondWithResult(_0x3415d4,null))['catch'](handleError(_0x3415d4,null));};exports[_0x861b('0x52')]=function(_0x1d9f1a,_0x479c38){return db[_0x861b('0x36')][_0x861b('0x52')](_0x1d9f1a['body'],{})[_0x861b('0x1c')](respondWithResult(_0x479c38,0xc9))[_0x861b('0x25')](handleError(_0x479c38,null));};exports[_0x861b('0x31')]=function(_0x14a90c,_0x28cc8e){if(_0x14a90c[_0x861b('0x53')]['id']){delete _0x14a90c[_0x861b('0x53')]['id'];}return db[_0x861b('0x36')][_0x861b('0x51')]({'where':{'id':_0x14a90c[_0x861b('0x54')]['id']}})['then'](handleEntityNotFound(_0x28cc8e,null))[_0x861b('0x1c')](saveUpdates(_0x14a90c[_0x861b('0x53')],null))[_0x861b('0x1c')](respondWithResult(_0x28cc8e,null))[_0x861b('0x25')](handleError(_0x28cc8e,null));};exports[_0x861b('0x55')]=function(_0x505401,_0x1244af){return db[_0x861b('0x36')][_0x861b('0x51')]({'where':{'id':_0x505401['params']['id']}})[_0x861b('0x1c')](handleEntityNotFound(_0x1244af,null))['then'](removeEntity(_0x1244af,null))['catch'](handleError(_0x1244af,null));};exports[_0x861b('0x56')]=function(_0x2d6016,_0x5d8a70,_0x1e5e46){var _0x1f8bc6={};var _0x1530aa={};var _0x40ead7;var _0x3ea660;return db[_0x861b('0x36')][_0x861b('0x57')]({'where':{'id':_0x2d6016[_0x861b('0x54')]['id']}})[_0x861b('0x1c')](handleEntityNotFound(_0x5d8a70,null))[_0x861b('0x1c')](function(_0x11e64d){if(_0x11e64d){_0x40ead7=_0x11e64d;_0x1530aa[_0x861b('0x3a')]=_[_0x861b('0x4f')](db['FreshsalesField']['rawAttributes']);_0x1530aa[_0x861b('0x3c')]=_[_0x861b('0x4f')](_0x2d6016[_0x861b('0x3c')]);_0x1530aa[_0x861b('0x3d')]=_[_0x861b('0x3e')](_0x1530aa[_0x861b('0x3a')],_0x1530aa[_0x861b('0x3c')]);_0x1f8bc6[_0x861b('0x3f')]=_['intersection'](_0x1530aa['model'],qs['fields'](_0x2d6016[_0x861b('0x3c')][_0x861b('0x50')]));_0x1f8bc6[_0x861b('0x3f')]=_0x1f8bc6[_0x861b('0x3f')]['length']?_0x1f8bc6[_0x861b('0x3f')]:_0x1530aa[_0x861b('0x3a')];_0x1f8bc6[_0x861b('0x43')]=qs[_0x861b('0x44')](_0x2d6016[_0x861b('0x3c')]['sort']);_0x1f8bc6[_0x861b('0x46')]=qs[_0x861b('0x3d')](_[_0x861b('0x45')](_0x2d6016[_0x861b('0x3c')],_0x1530aa[_0x861b('0x3d')]));if(_0x2d6016['query'][_0x861b('0x48')]){_0x1f8bc6[_0x861b('0x46')]=_[_0x861b('0x47')](_0x1f8bc6['where'],{'$or':_[_0x861b('0x3b')](_0x1f8bc6[_0x861b('0x3f')],function(_0x4f79e8){var _0x40c85c={};_0x40c85c[_0x4f79e8]={'$like':'%'+_0x2d6016['query']['filter']+'%'};return _0x40c85c;})});}_0x1f8bc6=_['merge']({},_0x1f8bc6,_0x2d6016[_0x861b('0x49')]);return _0x40ead7[_0x861b('0x56')](_0x1f8bc6);}})[_0x861b('0x1c')](function(_0x1e285f){if(_0x1e285f){_0x3ea660=_0x1e285f[_0x861b('0x40')];if(!_0x2d6016[_0x861b('0x3c')][_0x861b('0x41')]('nolimit')){_0x1f8bc6[_0x861b('0x2b')]=qs['limit'](_0x2d6016[_0x861b('0x3c')][_0x861b('0x2b')]);_0x1f8bc6['offset']=qs['offset'](_0x2d6016[_0x861b('0x3c')]['offset']);}return _0x40ead7[_0x861b('0x56')](_0x1f8bc6);}})[_0x861b('0x1c')](function(_0x47d232){if(_0x47d232){return _0x47d232?{'count':_0x3ea660,'rows':_0x47d232}:null;}})['then'](respondWithResult(_0x5d8a70,null))[_0x861b('0x25')](handleError(_0x5d8a70,null));};exports[_0x861b('0x58')]=function(_0x307ca0,_0x2800e7,_0x47848a){var _0x32e723={};var _0xb3895f={};var _0x12682e;var _0x2cdc74;return db[_0x861b('0x36')][_0x861b('0x57')]({'where':{'id':_0x307ca0[_0x861b('0x54')]['id']}})[_0x861b('0x1c')](handleEntityNotFound(_0x2800e7,null))[_0x861b('0x1c')](function(_0xa2b441){if(_0xa2b441){_0x12682e=_0xa2b441;_0xb3895f['model']=_[_0x861b('0x4f')](db[_0x861b('0x59')][_0x861b('0x37')]);_0xb3895f[_0x861b('0x3c')]=_[_0x861b('0x4f')](_0x307ca0[_0x861b('0x3c')]);_0xb3895f[_0x861b('0x3d')]=_[_0x861b('0x3e')](_0xb3895f['model'],_0xb3895f[_0x861b('0x3c')]);_0x32e723[_0x861b('0x3f')]=_['intersection'](_0xb3895f['model'],qs['fields'](_0x307ca0[_0x861b('0x3c')][_0x861b('0x50')]));_0x32e723[_0x861b('0x3f')]=_0x32e723[_0x861b('0x3f')][_0x861b('0x40')]?_0x32e723['attributes']:_0xb3895f['model'];_0x32e723[_0x861b('0x43')]=qs[_0x861b('0x44')](_0x307ca0['query'][_0x861b('0x44')]);_0x32e723[_0x861b('0x46')]=qs[_0x861b('0x3d')](_[_0x861b('0x45')](_0x307ca0[_0x861b('0x3c')],_0xb3895f['filters']));if(_0x307ca0[_0x861b('0x3c')]['filter']){_0x32e723[_0x861b('0x46')]=_[_0x861b('0x47')](_0x32e723[_0x861b('0x46')],{'$or':_[_0x861b('0x3b')](_0x32e723[_0x861b('0x3f')],function(_0x1b09bd){var _0x9d98b6={};_0x9d98b6[_0x1b09bd]={'$like':'%'+_0x307ca0[_0x861b('0x3c')][_0x861b('0x48')]+'%'};return _0x9d98b6;})});}_0x32e723=_['merge']({},_0x32e723,_0x307ca0['options']);return _0x12682e[_0x861b('0x58')](_0x32e723);}})[_0x861b('0x1c')](function(_0x31f949){if(_0x31f949){_0x2cdc74=_0x31f949[_0x861b('0x40')];if(!_0x307ca0[_0x861b('0x3c')][_0x861b('0x41')](_0x861b('0x42'))){_0x32e723['limit']=qs[_0x861b('0x2b')](_0x307ca0['query'][_0x861b('0x2b')]);_0x32e723[_0x861b('0x29')]=qs['offset'](_0x307ca0['query'][_0x861b('0x29')]);}return _0x12682e[_0x861b('0x58')](_0x32e723);}})['then'](function(_0x546ce3){if(_0x546ce3){return _0x546ce3?{'count':_0x2cdc74,'rows':_0x546ce3}:null;}})['then'](respondWithResult(_0x2800e7,null))[_0x861b('0x25')](handleError(_0x2800e7,null));};exports[_0x861b('0x5a')]=function(_0x4f5bd6,_0x2c8e89,_0x2c8797){var _0x3b3ee5={};var _0x439236={};var _0xc9ac7c;var _0x5e5ff9;return db['FreshsalesConfiguration'][_0x861b('0x57')]({'where':{'id':_0x4f5bd6[_0x861b('0x54')]['id']}})['then'](handleEntityNotFound(_0x2c8e89,null))[_0x861b('0x1c')](function(_0x5f3e8b){if(_0x5f3e8b){_0xc9ac7c=_0x5f3e8b;_0x439236['model']=_['keys'](db['FreshsalesField'][_0x861b('0x37')]);_0x439236[_0x861b('0x3c')]=_[_0x861b('0x4f')](_0x4f5bd6[_0x861b('0x3c')]);_0x439236['filters']=_['intersection'](_0x439236['model'],_0x439236[_0x861b('0x3c')]);_0x3b3ee5['attributes']=_['intersection'](_0x439236[_0x861b('0x3a')],qs[_0x861b('0x50')](_0x4f5bd6[_0x861b('0x3c')]['fields']));_0x3b3ee5['attributes']=_0x3b3ee5[_0x861b('0x3f')][_0x861b('0x40')]?_0x3b3ee5[_0x861b('0x3f')]:_0x439236[_0x861b('0x3a')];_0x3b3ee5[_0x861b('0x43')]=qs['sort'](_0x4f5bd6[_0x861b('0x3c')][_0x861b('0x44')]);_0x3b3ee5['where']=qs[_0x861b('0x3d')](_['pick'](_0x4f5bd6[_0x861b('0x3c')],_0x439236['filters']));if(_0x4f5bd6[_0x861b('0x3c')][_0x861b('0x48')]){_0x3b3ee5['where']=_[_0x861b('0x47')](_0x3b3ee5[_0x861b('0x46')],{'$or':_[_0x861b('0x3b')](_0x3b3ee5[_0x861b('0x3f')],function(_0x3cbd2a){var _0x2468e5={};_0x2468e5[_0x3cbd2a]={'$like':'%'+_0x4f5bd6[_0x861b('0x3c')]['filter']+'%'};return _0x2468e5;})});}_0x3b3ee5=_[_0x861b('0x47')]({},_0x3b3ee5,_0x4f5bd6['options']);return _0xc9ac7c[_0x861b('0x5a')](_0x3b3ee5);}})[_0x861b('0x1c')](function(_0x2606f5){if(_0x2606f5){_0x5e5ff9=_0x2606f5['length'];if(!_0x4f5bd6['query'][_0x861b('0x41')](_0x861b('0x42'))){_0x3b3ee5[_0x861b('0x2b')]=qs[_0x861b('0x2b')](_0x4f5bd6[_0x861b('0x3c')][_0x861b('0x2b')]);_0x3b3ee5['offset']=qs[_0x861b('0x29')](_0x4f5bd6[_0x861b('0x3c')][_0x861b('0x29')]);}return _0xc9ac7c[_0x861b('0x5a')](_0x3b3ee5);}})[_0x861b('0x1c')](function(_0x19c94b){if(_0x19c94b){return _0x19c94b?{'count':_0x5e5ff9,'rows':_0x19c94b}:null;}})[_0x861b('0x1c')](respondWithResult(_0x2c8e89,null))[_0x861b('0x25')](handleError(_0x2c8e89,null));}; \ No newline at end of file +var _0xd983=['filters','query','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','FreshsalesConfiguration','include','findAll','rows','catch','show','params','intersection','includeAll','find','create','body','destroy','getSubjects','order','getDescriptions','findOne','getFields','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','stack','name','send','index','rawAttributes','type','model','map','keys'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd983,0x7d));var _0x3d98=function(_0x42c380,_0x35c686){_0x42c380=_0x42c380-0x0;var _0x4697d6=_0xd983[_0x42c380];return _0x4697d6;};'use strict';var emlformat=require(_0x3d98('0x0'));var rimraf=require(_0x3d98('0x1'));var zipdir=require(_0x3d98('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d98('0x3'));var moment=require(_0x3d98('0x4'));var BPromise=require(_0x3d98('0x5'));var Mustache=require(_0x3d98('0x6'));var util=require(_0x3d98('0x7'));var path=require(_0x3d98('0x8'));var sox=require(_0x3d98('0x9'));var csv=require(_0x3d98('0xa'));var ejs=require(_0x3d98('0xb'));var fs=require('fs');var fs_extra=require(_0x3d98('0xc'));var _=require(_0x3d98('0xd'));var squel=require(_0x3d98('0xe'));var crypto=require(_0x3d98('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3d98('0x10'));var toCsv=require(_0x3d98('0xa'));var querystring=require('querystring');var Papa=require(_0x3d98('0x11'));var Redis=require(_0x3d98('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3d98('0x13'));var as=require(_0x3d98('0x14'));var hardwareService=require(_0x3d98('0x15'));var logger=require(_0x3d98('0x16'))(_0x3d98('0x17'));var utils=require(_0x3d98('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x3d98('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x3d98('0x1a'));var client=jayson[_0x3d98('0x1b')][_0x3d98('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xcf4025,_0x5a4e7f,_0xd33fd4,_0x478da8){return new BPromise(function(_0xc92387,_0x5bc61f){var _0x3b2387=_0x478da8||client;return _0x3b2387[_0x3d98('0x1d')](_0xcf4025,_0xd33fd4)[_0x3d98('0x1e')](function(_0xd9bea7){logger[_0x3d98('0x1f')](_0x3d98('0x20'),_0x5a4e7f,'request\x20sent');logger[_0x3d98('0x21')](_0x3d98('0x22'),_0x5a4e7f,_0x3d98('0x23'),JSON['stringify'](_0xd9bea7));if(_0xd9bea7[_0x3d98('0x24')]){if(_0xd9bea7[_0x3d98('0x24')]['code']===0x1f4){logger['error'](_0x3d98('0x20'),_0x5a4e7f,_0xd9bea7['error'][_0x3d98('0x25')]);return _0x5bc61f(_0xd9bea7[_0x3d98('0x24')][_0x3d98('0x25')]);}logger[_0x3d98('0x24')](_0x3d98('0x20'),_0x5a4e7f,_0xd9bea7['error'][_0x3d98('0x25')]);return _0xc92387(_0xd9bea7[_0x3d98('0x24')][_0x3d98('0x25')]);}else{logger['info'](_0x3d98('0x20'),_0x5a4e7f,'request\x20sent');_0xc92387(_0xd9bea7[_0x3d98('0x26')][_0x3d98('0x25')]);}})['catch'](function(_0x151cee){logger[_0x3d98('0x24')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5a4e7f,_0x151cee);_0x5bc61f(_0x151cee);});});}function respondWithStatusCode(_0x84fc59,_0xa8f877){_0xa8f877=_0xa8f877||0xcc;return function(_0x4aad7b){if(_0x4aad7b){return _0x84fc59[_0x3d98('0x27')](_0xa8f877);}return _0x84fc59['status'](_0xa8f877)[_0x3d98('0x28')]();};}function respondWithResult(_0x924260,_0x20d22f){_0x20d22f=_0x20d22f||0xc8;return function(_0x47a3fa){if(_0x47a3fa){return _0x924260[_0x3d98('0x29')](_0x20d22f)[_0x3d98('0x2a')](_0x47a3fa);}};}function respondWithFilteredResult(_0x221031,_0x1ad9b1){return function(_0x2907de){if(_0x2907de){var _0x3dcc24=typeof _0x1ad9b1['offset']===_0x3d98('0x2b')&&typeof _0x1ad9b1[_0x3d98('0x2c')]===_0x3d98('0x2b');var _0x32ac39=_0x2907de[_0x3d98('0x2d')];var _0x40ba72=_0x3dcc24?0x0:_0x1ad9b1[_0x3d98('0x2e')];var _0x22e9b6=_0x3dcc24?_0x2907de[_0x3d98('0x2d')]:_0x1ad9b1[_0x3d98('0x2e')]+_0x1ad9b1[_0x3d98('0x2c')];var _0x272435;if(_0x22e9b6>=_0x32ac39){_0x22e9b6=_0x32ac39;_0x272435=0xc8;}else{_0x272435=0xce;}_0x221031[_0x3d98('0x29')](_0x272435);return _0x221031[_0x3d98('0x2f')]('Content-Range',_0x40ba72+'-'+_0x22e9b6+'/'+_0x32ac39)[_0x3d98('0x2a')](_0x2907de);}return null;};}function patchUpdates(_0x5f1a17){return function(_0x3b2666){try{jsonpatch[_0x3d98('0x30')](_0x3b2666,_0x5f1a17,!![]);}catch(_0xcec8df){return BPromise[_0x3d98('0x31')](_0xcec8df);}return _0x3b2666[_0x3d98('0x32')]();};}function saveUpdates(_0x381101,_0xf16ee5){return function(_0x38559b){if(_0x38559b){return _0x38559b[_0x3d98('0x33')](_0x381101)[_0x3d98('0x1e')](function(_0x3099bf){return _0x3099bf;});}return null;};}function removeEntity(_0x314e2c,_0x48f9bd){return function(_0x338101){if(_0x338101){return _0x338101['destroy']()[_0x3d98('0x1e')](function(){_0x314e2c['status'](0xcc)[_0x3d98('0x28')]();});}};}function handleEntityNotFound(_0x2cec73,_0xbbc965){return function(_0x417bc7){if(!_0x417bc7){_0x2cec73[_0x3d98('0x27')](0x194);}return _0x417bc7;};}function handleError(_0x1389cb,_0x21e7d6){_0x21e7d6=_0x21e7d6||0x1f4;return function(_0x5cb4be){logger[_0x3d98('0x24')](_0x5cb4be[_0x3d98('0x34')]);if(_0x5cb4be[_0x3d98('0x35')]){delete _0x5cb4be['name'];}_0x1389cb[_0x3d98('0x29')](_0x21e7d6)[_0x3d98('0x36')](_0x5cb4be);};}exports[_0x3d98('0x37')]=function(_0x29b8ae,_0x382ea5){var _0x311799={},_0x34807f={},_0x2bf346={'count':0x0,'rows':[]};var _0x2c5af0=_['map'](db['FreshsalesConfiguration'][_0x3d98('0x38')],function(_0x2e9e0d){return{'name':_0x2e9e0d['fieldName'],'type':_0x2e9e0d[_0x3d98('0x39')]['key']};});_0x34807f[_0x3d98('0x3a')]=_[_0x3d98('0x3b')](_0x2c5af0,_0x3d98('0x35'));_0x34807f['query']=_[_0x3d98('0x3c')](_0x29b8ae['query']);_0x34807f[_0x3d98('0x3d')]=_['intersection'](_0x34807f[_0x3d98('0x3a')],_0x34807f[_0x3d98('0x3e')]);_0x311799['attributes']=_['intersection'](_0x34807f[_0x3d98('0x3a')],qs[_0x3d98('0x3f')](_0x29b8ae[_0x3d98('0x3e')][_0x3d98('0x3f')]));_0x311799[_0x3d98('0x40')]=_0x311799[_0x3d98('0x40')][_0x3d98('0x41')]?_0x311799[_0x3d98('0x40')]:_0x34807f[_0x3d98('0x3a')];if(!_0x29b8ae[_0x3d98('0x3e')][_0x3d98('0x42')](_0x3d98('0x43'))){_0x311799['limit']=qs['limit'](_0x29b8ae['query']['limit']);_0x311799['offset']=qs[_0x3d98('0x2e')](_0x29b8ae[_0x3d98('0x3e')][_0x3d98('0x2e')]);}_0x311799['order']=qs[_0x3d98('0x44')](_0x29b8ae[_0x3d98('0x3e')][_0x3d98('0x44')]);_0x311799['where']=qs[_0x3d98('0x3d')](_[_0x3d98('0x45')](_0x29b8ae['query'],_0x34807f['filters']),_0x2c5af0);if(_0x29b8ae[_0x3d98('0x3e')][_0x3d98('0x46')]){_0x311799[_0x3d98('0x47')]=_['merge'](_0x311799['where'],{'$or':_[_0x3d98('0x3b')](_0x2c5af0,function(_0x37e613){if(_0x37e613[_0x3d98('0x39')]!==_0x3d98('0x48')){var _0x453932={};_0x453932[_0x37e613[_0x3d98('0x35')]]={'$like':'%'+_0x29b8ae[_0x3d98('0x3e')][_0x3d98('0x46')]+'%'};return _0x453932;}})});}_0x311799=_[_0x3d98('0x49')]({},_0x311799,_0x29b8ae[_0x3d98('0x4a')]);var _0x2d8be1={'where':_0x311799['where']};return db[_0x3d98('0x4b')]['count'](_0x2d8be1)[_0x3d98('0x1e')](function(_0x52c811){_0x2bf346[_0x3d98('0x2d')]=_0x52c811;if(_0x29b8ae[_0x3d98('0x3e')]['includeAll']){_0x311799[_0x3d98('0x4c')]=[{'all':!![]}];}return db[_0x3d98('0x4b')][_0x3d98('0x4d')](_0x311799);})[_0x3d98('0x1e')](function(_0x1ac29a){_0x2bf346[_0x3d98('0x4e')]=_0x1ac29a;return _0x2bf346;})['then'](respondWithFilteredResult(_0x382ea5,_0x311799))[_0x3d98('0x4f')](handleError(_0x382ea5,null));};exports[_0x3d98('0x50')]=function(_0x580c57,_0x3cb3e2){var _0x59e851={'raw':![],'where':{'id':_0x580c57[_0x3d98('0x51')]['id']}},_0x4be629={};_0x4be629[_0x3d98('0x3a')]=_['keys'](db[_0x3d98('0x4b')][_0x3d98('0x38')]);_0x4be629[_0x3d98('0x3e')]=_[_0x3d98('0x3c')](_0x580c57[_0x3d98('0x3e')]);_0x4be629['filters']=_[_0x3d98('0x52')](_0x4be629[_0x3d98('0x3a')],_0x4be629[_0x3d98('0x3e')]);_0x59e851[_0x3d98('0x40')]=_[_0x3d98('0x52')](_0x4be629['model'],qs[_0x3d98('0x3f')](_0x580c57[_0x3d98('0x3e')]['fields']));_0x59e851[_0x3d98('0x40')]=_0x59e851[_0x3d98('0x40')]['length']?_0x59e851[_0x3d98('0x40')]:_0x4be629[_0x3d98('0x3a')];if(_0x580c57[_0x3d98('0x3e')][_0x3d98('0x53')]){_0x59e851[_0x3d98('0x4c')]=[{'all':!![]}];}_0x59e851=_[_0x3d98('0x49')]({},_0x59e851,_0x580c57[_0x3d98('0x4a')]);return db[_0x3d98('0x4b')][_0x3d98('0x54')](_0x59e851)[_0x3d98('0x1e')](handleEntityNotFound(_0x3cb3e2,null))[_0x3d98('0x1e')](respondWithResult(_0x3cb3e2,null))[_0x3d98('0x4f')](handleError(_0x3cb3e2,null));};exports[_0x3d98('0x55')]=function(_0x12dae4,_0x58ca53){return db[_0x3d98('0x4b')][_0x3d98('0x55')](_0x12dae4[_0x3d98('0x56')],{})[_0x3d98('0x1e')](respondWithResult(_0x58ca53,0xc9))[_0x3d98('0x4f')](handleError(_0x58ca53,null));};exports[_0x3d98('0x33')]=function(_0x3830c3,_0x47eb4f){if(_0x3830c3[_0x3d98('0x56')]['id']){delete _0x3830c3['body']['id'];}return db[_0x3d98('0x4b')][_0x3d98('0x54')]({'where':{'id':_0x3830c3[_0x3d98('0x51')]['id']}})[_0x3d98('0x1e')](handleEntityNotFound(_0x47eb4f,null))['then'](saveUpdates(_0x3830c3['body'],null))[_0x3d98('0x1e')](respondWithResult(_0x47eb4f,null))[_0x3d98('0x4f')](handleError(_0x47eb4f,null));};exports[_0x3d98('0x57')]=function(_0x9de961,_0x125017){return db[_0x3d98('0x4b')][_0x3d98('0x54')]({'where':{'id':_0x9de961[_0x3d98('0x51')]['id']}})['then'](handleEntityNotFound(_0x125017,null))[_0x3d98('0x1e')](removeEntity(_0x125017,null))[_0x3d98('0x4f')](handleError(_0x125017,null));};exports[_0x3d98('0x58')]=function(_0x374530,_0x48017f,_0xa8d53a){var _0x44823b={};var _0x1e15c4={};var _0x4c4d0e;var _0x19e66d;return db[_0x3d98('0x4b')]['findOne']({'where':{'id':_0x374530[_0x3d98('0x51')]['id']}})[_0x3d98('0x1e')](handleEntityNotFound(_0x48017f,null))[_0x3d98('0x1e')](function(_0x2c3bee){if(_0x2c3bee){_0x4c4d0e=_0x2c3bee;_0x1e15c4[_0x3d98('0x3a')]=_['keys'](db['FreshsalesField'][_0x3d98('0x38')]);_0x1e15c4['query']=_[_0x3d98('0x3c')](_0x374530[_0x3d98('0x3e')]);_0x1e15c4['filters']=_[_0x3d98('0x52')](_0x1e15c4[_0x3d98('0x3a')],_0x1e15c4['query']);_0x44823b['attributes']=_[_0x3d98('0x52')](_0x1e15c4[_0x3d98('0x3a')],qs[_0x3d98('0x3f')](_0x374530[_0x3d98('0x3e')][_0x3d98('0x3f')]));_0x44823b['attributes']=_0x44823b[_0x3d98('0x40')][_0x3d98('0x41')]?_0x44823b['attributes']:_0x1e15c4[_0x3d98('0x3a')];_0x44823b[_0x3d98('0x59')]=qs[_0x3d98('0x44')](_0x374530[_0x3d98('0x3e')][_0x3d98('0x44')]);_0x44823b[_0x3d98('0x47')]=qs[_0x3d98('0x3d')](_['pick'](_0x374530[_0x3d98('0x3e')],_0x1e15c4[_0x3d98('0x3d')]));if(_0x374530['query'][_0x3d98('0x46')]){_0x44823b[_0x3d98('0x47')]=_[_0x3d98('0x49')](_0x44823b[_0x3d98('0x47')],{'$or':_['map'](_0x44823b[_0x3d98('0x40')],function(_0x2aaa12){var _0x2b9207={};_0x2b9207[_0x2aaa12]={'$like':'%'+_0x374530[_0x3d98('0x3e')][_0x3d98('0x46')]+'%'};return _0x2b9207;})});}_0x44823b=_['merge']({},_0x44823b,_0x374530[_0x3d98('0x4a')]);return _0x4c4d0e[_0x3d98('0x58')](_0x44823b);}})[_0x3d98('0x1e')](function(_0x262903){if(_0x262903){_0x19e66d=_0x262903[_0x3d98('0x41')];if(!_0x374530[_0x3d98('0x3e')][_0x3d98('0x42')](_0x3d98('0x43'))){_0x44823b[_0x3d98('0x2c')]=qs['limit'](_0x374530['query']['limit']);_0x44823b[_0x3d98('0x2e')]=qs[_0x3d98('0x2e')](_0x374530['query'][_0x3d98('0x2e')]);}return _0x4c4d0e[_0x3d98('0x58')](_0x44823b);}})['then'](function(_0x4b3d9a){if(_0x4b3d9a){return _0x4b3d9a?{'count':_0x19e66d,'rows':_0x4b3d9a}:null;}})[_0x3d98('0x1e')](respondWithResult(_0x48017f,null))[_0x3d98('0x4f')](handleError(_0x48017f,null));};exports[_0x3d98('0x5a')]=function(_0xecc987,_0x12953e,_0x5b5bf0){var _0x355274={};var _0x2481a1={};var _0x1d8be9;var _0xd8cc0b;return db[_0x3d98('0x4b')][_0x3d98('0x5b')]({'where':{'id':_0xecc987[_0x3d98('0x51')]['id']}})[_0x3d98('0x1e')](handleEntityNotFound(_0x12953e,null))[_0x3d98('0x1e')](function(_0x484450){if(_0x484450){_0x1d8be9=_0x484450;_0x2481a1[_0x3d98('0x3a')]=_['keys'](db['FreshsalesField'][_0x3d98('0x38')]);_0x2481a1[_0x3d98('0x3e')]=_[_0x3d98('0x3c')](_0xecc987[_0x3d98('0x3e')]);_0x2481a1['filters']=_[_0x3d98('0x52')](_0x2481a1['model'],_0x2481a1[_0x3d98('0x3e')]);_0x355274[_0x3d98('0x40')]=_[_0x3d98('0x52')](_0x2481a1[_0x3d98('0x3a')],qs[_0x3d98('0x3f')](_0xecc987[_0x3d98('0x3e')][_0x3d98('0x3f')]));_0x355274[_0x3d98('0x40')]=_0x355274[_0x3d98('0x40')][_0x3d98('0x41')]?_0x355274[_0x3d98('0x40')]:_0x2481a1[_0x3d98('0x3a')];_0x355274[_0x3d98('0x59')]=qs['sort'](_0xecc987[_0x3d98('0x3e')][_0x3d98('0x44')]);_0x355274[_0x3d98('0x47')]=qs['filters'](_['pick'](_0xecc987[_0x3d98('0x3e')],_0x2481a1[_0x3d98('0x3d')]));if(_0xecc987['query'][_0x3d98('0x46')]){_0x355274[_0x3d98('0x47')]=_[_0x3d98('0x49')](_0x355274['where'],{'$or':_[_0x3d98('0x3b')](_0x355274[_0x3d98('0x40')],function(_0x311a04){var _0xfb1df3={};_0xfb1df3[_0x311a04]={'$like':'%'+_0xecc987[_0x3d98('0x3e')]['filter']+'%'};return _0xfb1df3;})});}_0x355274=_[_0x3d98('0x49')]({},_0x355274,_0xecc987[_0x3d98('0x4a')]);return _0x1d8be9[_0x3d98('0x5a')](_0x355274);}})['then'](function(_0x4fb836){if(_0x4fb836){_0xd8cc0b=_0x4fb836[_0x3d98('0x41')];if(!_0xecc987[_0x3d98('0x3e')]['hasOwnProperty'](_0x3d98('0x43'))){_0x355274['limit']=qs[_0x3d98('0x2c')](_0xecc987[_0x3d98('0x3e')][_0x3d98('0x2c')]);_0x355274[_0x3d98('0x2e')]=qs[_0x3d98('0x2e')](_0xecc987['query']['offset']);}return _0x1d8be9[_0x3d98('0x5a')](_0x355274);}})[_0x3d98('0x1e')](function(_0x4c29a2){if(_0x4c29a2){return _0x4c29a2?{'count':_0xd8cc0b,'rows':_0x4c29a2}:null;}})[_0x3d98('0x1e')](respondWithResult(_0x12953e,null))[_0x3d98('0x4f')](handleError(_0x12953e,null));};exports['getFields']=function(_0x2d7275,_0x223587,_0x23ed59){var _0x183a75={};var _0x45c7fc={};var _0x4928d1;var _0x2357b3;return db[_0x3d98('0x4b')][_0x3d98('0x5b')]({'where':{'id':_0x2d7275[_0x3d98('0x51')]['id']}})[_0x3d98('0x1e')](handleEntityNotFound(_0x223587,null))[_0x3d98('0x1e')](function(_0x29b159){if(_0x29b159){_0x4928d1=_0x29b159;_0x45c7fc[_0x3d98('0x3a')]=_[_0x3d98('0x3c')](db['FreshsalesField'][_0x3d98('0x38')]);_0x45c7fc[_0x3d98('0x3e')]=_[_0x3d98('0x3c')](_0x2d7275[_0x3d98('0x3e')]);_0x45c7fc['filters']=_[_0x3d98('0x52')](_0x45c7fc[_0x3d98('0x3a')],_0x45c7fc[_0x3d98('0x3e')]);_0x183a75[_0x3d98('0x40')]=_['intersection'](_0x45c7fc[_0x3d98('0x3a')],qs[_0x3d98('0x3f')](_0x2d7275[_0x3d98('0x3e')][_0x3d98('0x3f')]));_0x183a75['attributes']=_0x183a75['attributes'][_0x3d98('0x41')]?_0x183a75['attributes']:_0x45c7fc['model'];_0x183a75[_0x3d98('0x59')]=qs[_0x3d98('0x44')](_0x2d7275[_0x3d98('0x3e')]['sort']);_0x183a75[_0x3d98('0x47')]=qs[_0x3d98('0x3d')](_['pick'](_0x2d7275['query'],_0x45c7fc[_0x3d98('0x3d')]));if(_0x2d7275[_0x3d98('0x3e')][_0x3d98('0x46')]){_0x183a75[_0x3d98('0x47')]=_[_0x3d98('0x49')](_0x183a75[_0x3d98('0x47')],{'$or':_[_0x3d98('0x3b')](_0x183a75[_0x3d98('0x40')],function(_0x41e30b){var _0x4fef51={};_0x4fef51[_0x41e30b]={'$like':'%'+_0x2d7275['query']['filter']+'%'};return _0x4fef51;})});}_0x183a75=_[_0x3d98('0x49')]({},_0x183a75,_0x2d7275[_0x3d98('0x4a')]);return _0x4928d1[_0x3d98('0x5c')](_0x183a75);}})[_0x3d98('0x1e')](function(_0x373811){if(_0x373811){_0x2357b3=_0x373811['length'];if(!_0x2d7275[_0x3d98('0x3e')][_0x3d98('0x42')](_0x3d98('0x43'))){_0x183a75[_0x3d98('0x2c')]=qs[_0x3d98('0x2c')](_0x2d7275[_0x3d98('0x3e')][_0x3d98('0x2c')]);_0x183a75[_0x3d98('0x2e')]=qs[_0x3d98('0x2e')](_0x2d7275[_0x3d98('0x3e')]['offset']);}return _0x4928d1['getFields'](_0x183a75);}})[_0x3d98('0x1e')](function(_0x56fa9b){if(_0x56fa9b){return _0x56fa9b?{'count':_0x2357b3,'rows':_0x56fa9b}:null;}})['then'](respondWithResult(_0x223587,null))[_0x3d98('0x4f')](handleError(_0x223587,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index fb9b600..afd0c7f 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f88=['int_freshsales_configurations','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration'];(function(_0x2f3922,_0x4ff9ea){var _0x5631c9=function(_0x2d7333){while(--_0x2d7333){_0x2f3922['push'](_0x2f3922['shift']());}};_0x5631c9(++_0x4ff9ea);}(_0x4f88,0xf3));var _0x84f8=function(_0x58ee19,_0xdf0765){_0x58ee19=_0x58ee19-0x0;var _0x49af25=_0x4f88[_0x58ee19];return _0x49af25;};'use strict';var _=require(_0x84f8('0x0'));var util=require(_0x84f8('0x1'));var logger=require('../../config/logger')(_0x84f8('0x2'));var moment=require(_0x84f8('0x3'));var BPromise=require(_0x84f8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x84f8('0x5'));var config=require(_0x84f8('0x6'));var attributes=require(_0x84f8('0x7'));module[_0x84f8('0x8')]=function(_0x79dcec,_0x1ac0c8){return _0x79dcec['define'](_0x84f8('0x9'),attributes,{'tableName':_0x84f8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2e8=['lodash','util','moment','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0xc2e8,0x70));var _0x8c2e=function(_0x1f0694,_0x2e2abd){_0x1f0694=_0x1f0694-0x0;var _0x42d3bd=_0xc2e8[_0x1f0694];return _0x42d3bd;};'use strict';var _=require(_0x8c2e('0x0'));var util=require(_0x8c2e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8c2e('0x2'));var BPromise=require('bluebird');var rp=require(_0x8c2e('0x3'));var fs=require('fs');var path=require(_0x8c2e('0x4'));var rimraf=require(_0x8c2e('0x5'));var config=require('../../config/environment');var attributes=require(_0x8c2e('0x6'));module[_0x8c2e('0x7')]=function(_0x2b784d,_0x4d1434){return _0x2b784d['define']('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 1faf029..faeaf54 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfbac=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xfbac,0x167));var _0xcfba=function(_0x587ba2,_0x56944f){_0x587ba2=_0x587ba2-0x0;var _0x373427=_0xfbac[_0x587ba2];return _0x373427;};'use strict';var _=require('lodash');var util=require(_0xcfba('0x0'));var moment=require(_0xcfba('0x1'));var BPromise=require(_0xcfba('0x2'));var rs=require(_0xcfba('0x3'));var fs=require('fs');var Redis=require(_0xcfba('0x4'));var db=require(_0xcfba('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcfba('0x6'));var config=require(_0xcfba('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcfba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5af20d,_0x2ca4c6,_0x5b7669){return new BPromise(function(_0x15e8d6,_0x2c68cd){return client['request'](_0x5af20d,_0x5b7669)[_0xcfba('0x9')](function(_0xeae9f2){logger[_0xcfba('0xa')](_0xcfba('0xb'),_0x2ca4c6,_0xcfba('0xc'));logger[_0xcfba('0xd')](_0xcfba('0xe'),_0x2ca4c6,_0xcfba('0xc'),JSON[_0xcfba('0xf')](_0xeae9f2));if(_0xeae9f2[_0xcfba('0x10')]){if(_0xeae9f2[_0xcfba('0x10')][_0xcfba('0x11')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x2ca4c6,_0xeae9f2[_0xcfba('0x10')][_0xcfba('0x12')]);return _0x2c68cd(_0xeae9f2['error'][_0xcfba('0x12')]);}logger[_0xcfba('0x10')](_0xcfba('0xb'),_0x2ca4c6,_0xeae9f2[_0xcfba('0x10')][_0xcfba('0x12')]);return _0x15e8d6(_0xeae9f2[_0xcfba('0x10')][_0xcfba('0x12')]);}else{logger[_0xcfba('0xa')](_0xcfba('0xb'),_0x2ca4c6,_0xcfba('0xc'));_0x15e8d6(_0xeae9f2[_0xcfba('0x13')][_0xcfba('0x12')]);}})[_0xcfba('0x14')](function(_0x5bff45){logger[_0xcfba('0x10')](_0xcfba('0xb'),_0x2ca4c6,_0x5bff45);_0x2c68cd(_0x5bff45);});});} \ No newline at end of file +var _0x757a=['request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x490414,_0xe5877b){var _0x42273e=function(_0x267b58){while(--_0x267b58){_0x490414['push'](_0x490414['shift']());}};_0x42273e(++_0xe5877b);}(_0x757a,0xde));var _0xa757=function(_0x16d689,_0x105c9d){_0x16d689=_0x16d689-0x0;var _0x3e861f=_0x757a[_0x16d689];return _0x3e861f;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 73921f8..3493101 100644 --- a/server/api/intFreshsalesField/index.js +++ b/server/api/intFreshsalesField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bb5=['put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','/:id','isAuthenticated','show','create'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0bb5,0x148));var _0x50bb=function(_0x19085e,_0x26f269){_0x19085e=_0x19085e-0x0;var _0x3d707a=_0x0bb5[_0x19085e];return _0x3d707a;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x50bb('0xd')]);router[_0x50bb('0xe')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller['update']);router[_0x50bb('0xf')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x10')]);module[_0x50bb('0x11')]=router; \ No newline at end of file +var _0x1be1=['fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','show','post','create','/:id','delete','destroy','path','connect-timeout','Router'];(function(_0x110c61,_0x4da2e4){var _0x690e16=function(_0x335acd){while(--_0x335acd){_0x110c61['push'](_0x110c61['shift']());}};_0x690e16(++_0x4da2e4);}(_0x1be1,0x192));var _0x11be=function(_0x17f346,_0x1a8787){_0x17f346=_0x17f346-0x0;var _0x4288d9=_0x1be1[_0x17f346];return _0x4288d9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require('../../config/environment');var controller=require(_0x11be('0x6'));router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller['index']);router[_0x11be('0x7')]('/:id',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0xa')]('/',auth[_0x11be('0x8')](),controller[_0x11be('0xb')]);router['put'](_0x11be('0xc'),auth[_0x11be('0x8')](),controller['update']);router[_0x11be('0xd')](_0x11be('0xc'),auth[_0x11be('0x8')](),controller[_0x11be('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index edb5b53..f01257f 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.attributes.js +++ b/server/api/intFreshsalesField/intFreshsalesField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71ab=['BOOLEAN','exports','string','customVariable','keyValue','picklist','STRING','ENUM','variable'];(function(_0x32f3bc,_0x2b5218){var _0x3f8cc2=function(_0x5dca80){while(--_0x5dca80){_0x32f3bc['push'](_0x32f3bc['shift']());}};_0x3f8cc2(++_0x2b5218);}(_0x71ab,0x64));var _0xb71a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x71ab[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'type':{'type':Sequelize['ENUM'](_0xb71a('0x1'),'variable',_0xb71a('0x2'),_0xb71a('0x3'),_0xb71a('0x4')),'defaultValue':_0xb71a('0x1')},'content':{'type':Sequelize[_0xb71a('0x5')]},'key':{'type':Sequelize[_0xb71a('0x5')]},'keyType':{'type':Sequelize[_0xb71a('0x6')](_0xb71a('0x1'),_0xb71a('0x7'),_0xb71a('0x2'))},'keyContent':{'type':Sequelize[_0xb71a('0x5')]},'idField':{'type':Sequelize[_0xb71a('0x5')]},'nameField':{'type':Sequelize[_0xb71a('0x5')]},'customField':{'type':Sequelize[_0xb71a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb71a('0x5')]}}; \ No newline at end of file +var _0xd67b=['STRING','ENUM','BOOLEAN','exports','string','variable','customVariable','picklist'];(function(_0x17ead5,_0x46a287){var _0x4c4441=function(_0x3d978c){while(--_0x3d978c){_0x17ead5['push'](_0x17ead5['shift']());}};_0x4c4441(++_0x46a287);}(_0xd67b,0x133));var _0xbd67=function(_0x536d84,_0x5591af){_0x536d84=_0x536d84-0x0;var _0x2de977=_0xd67b[_0x536d84];return _0x2de977;};'use strict';var Sequelize=require('sequelize');module[_0xbd67('0x0')]={'type':{'type':Sequelize['ENUM'](_0xbd67('0x1'),_0xbd67('0x2'),_0xbd67('0x3'),'keyValue',_0xbd67('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xbd67('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbd67('0x6')](_0xbd67('0x1'),_0xbd67('0x2'),_0xbd67('0x3'))},'keyContent':{'type':Sequelize[_0xbd67('0x5')]},'idField':{'type':Sequelize[_0xbd67('0x5')]},'nameField':{'type':Sequelize[_0xbd67('0x5')]},'customField':{'type':Sequelize[_0xbd67('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbd67('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index efe7bd5..f97e9de 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.controller.js +++ b/server/api/intFreshsalesField/intFreshsalesField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4c2=['map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','VIRTUAL','name','merge','options','FreshsalesField','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','save','update','then','destroy','end','stack','send'];(function(_0x1df7b8,_0x2fe5e5){var _0x29d911=function(_0x340121){while(--_0x340121){_0x1df7b8['push'](_0x1df7b8['shift']());}};_0x29d911(++_0x2fe5e5);}(_0xc4c2,0x14d));var _0x2c4c=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xc4c2[_0x40ac5e];return _0x2839d6;};'use strict';var emlformat=require(_0x2c4c('0x0'));var rimraf=require(_0x2c4c('0x1'));var zipdir=require(_0x2c4c('0x2'));var jsonpatch=require(_0x2c4c('0x3'));var rp=require('request-promise');var moment=require(_0x2c4c('0x4'));var BPromise=require(_0x2c4c('0x5'));var Mustache=require(_0x2c4c('0x6'));var util=require(_0x2c4c('0x7'));var path=require(_0x2c4c('0x8'));var sox=require(_0x2c4c('0x9'));var csv=require(_0x2c4c('0xa'));var ejs=require(_0x2c4c('0xb'));var fs=require('fs');var fs_extra=require(_0x2c4c('0xc'));var _=require(_0x2c4c('0xd'));var squel=require('squel');var crypto=require(_0x2c4c('0xe'));var jsforce=require(_0x2c4c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2c4c('0xa'));var querystring=require(_0x2c4c('0x10'));var Papa=require('papaparse');var Redis=require(_0x2c4c('0x11'));var authService=require(_0x2c4c('0x12'));var qs=require(_0x2c4c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c4c('0x14'));var logger=require(_0x2c4c('0x15'))(_0x2c4c('0x16'));var utils=require(_0x2c4c('0x17'));var config=require(_0x2c4c('0x18'));var licenseUtil=require(_0x2c4c('0x19'));var db=require(_0x2c4c('0x1a'))['db'];function respondWithStatusCode(_0x155e34,_0x20dd98){_0x20dd98=_0x20dd98||0xcc;return function(_0x982371){if(_0x982371){return _0x155e34[_0x2c4c('0x1b')](_0x20dd98);}return _0x155e34[_0x2c4c('0x1c')](_0x20dd98)['end']();};}function respondWithResult(_0x31cc4c,_0x3fc556){_0x3fc556=_0x3fc556||0xc8;return function(_0x12a9f4){if(_0x12a9f4){return _0x31cc4c[_0x2c4c('0x1c')](_0x3fc556)['json'](_0x12a9f4);}};}function respondWithFilteredResult(_0x401261,_0x3b23bd){return function(_0x5c2504){if(_0x5c2504){var _0x4f5d68=typeof _0x3b23bd[_0x2c4c('0x1d')]===_0x2c4c('0x1e')&&typeof _0x3b23bd[_0x2c4c('0x1f')]===_0x2c4c('0x1e');var _0x1d11da=_0x5c2504['count'];var _0x40db78=_0x4f5d68?0x0:_0x3b23bd[_0x2c4c('0x1d')];var _0x1bf975=_0x4f5d68?_0x5c2504[_0x2c4c('0x20')]:_0x3b23bd[_0x2c4c('0x1d')]+_0x3b23bd[_0x2c4c('0x1f')];var _0x19bb95;if(_0x1bf975>=_0x1d11da){_0x1bf975=_0x1d11da;_0x19bb95=0xc8;}else{_0x19bb95=0xce;}_0x401261[_0x2c4c('0x1c')](_0x19bb95);return _0x401261[_0x2c4c('0x21')]('Content-Range',_0x40db78+'-'+_0x1bf975+'/'+_0x1d11da)[_0x2c4c('0x22')](_0x5c2504);}return null;};}function patchUpdates(_0xfadfc3){return function(_0x453e30){try{jsonpatch['apply'](_0x453e30,_0xfadfc3,!![]);}catch(_0x4b07f2){return BPromise['reject'](_0x4b07f2);}return _0x453e30[_0x2c4c('0x23')]();};}function saveUpdates(_0x11bd57,_0x18ae15){return function(_0x256f23){if(_0x256f23){return _0x256f23[_0x2c4c('0x24')](_0x11bd57)[_0x2c4c('0x25')](function(_0x585c4b){return _0x585c4b;});}return null;};}function removeEntity(_0x4ac0bd,_0x149c57){return function(_0x53e7fd){if(_0x53e7fd){return _0x53e7fd[_0x2c4c('0x26')]()['then'](function(){_0x4ac0bd[_0x2c4c('0x1c')](0xcc)[_0x2c4c('0x27')]();});}};}function handleEntityNotFound(_0x1293d2,_0x453fdf){return function(_0x109e17){if(!_0x109e17){_0x1293d2[_0x2c4c('0x1b')](0x194);}return _0x109e17;};}function handleError(_0x459471,_0x389958){_0x389958=_0x389958||0x1f4;return function(_0x3bdb8c){logger['error'](_0x3bdb8c[_0x2c4c('0x28')]);if(_0x3bdb8c['name']){delete _0x3bdb8c['name'];}_0x459471['status'](_0x389958)[_0x2c4c('0x29')](_0x3bdb8c);};}exports['index']=function(_0x4aede8,_0x49bcb4){var _0x611b3b={},_0x5d7dda={},_0x2b071b={'count':0x0,'rows':[]};var _0x3f84a8=_[_0x2c4c('0x2a')](db['FreshsalesField'][_0x2c4c('0x2b')],function(_0x40a8a0){return{'name':_0x40a8a0[_0x2c4c('0x2c')],'type':_0x40a8a0[_0x2c4c('0x2d')][_0x2c4c('0x2e')]};});_0x5d7dda[_0x2c4c('0x2f')]=_[_0x2c4c('0x2a')](_0x3f84a8,'name');_0x5d7dda[_0x2c4c('0x30')]=_[_0x2c4c('0x31')](_0x4aede8[_0x2c4c('0x30')]);_0x5d7dda[_0x2c4c('0x32')]=_[_0x2c4c('0x33')](_0x5d7dda[_0x2c4c('0x2f')],_0x5d7dda['query']);_0x611b3b[_0x2c4c('0x34')]=_['intersection'](_0x5d7dda[_0x2c4c('0x2f')],qs[_0x2c4c('0x35')](_0x4aede8['query'][_0x2c4c('0x35')]));_0x611b3b[_0x2c4c('0x34')]=_0x611b3b[_0x2c4c('0x34')]['length']?_0x611b3b['attributes']:_0x5d7dda[_0x2c4c('0x2f')];if(!_0x4aede8[_0x2c4c('0x30')][_0x2c4c('0x36')]('nolimit')){_0x611b3b['limit']=qs[_0x2c4c('0x1f')](_0x4aede8[_0x2c4c('0x30')]['limit']);_0x611b3b[_0x2c4c('0x1d')]=qs['offset'](_0x4aede8[_0x2c4c('0x30')][_0x2c4c('0x1d')]);}_0x611b3b[_0x2c4c('0x37')]=qs[_0x2c4c('0x38')](_0x4aede8[_0x2c4c('0x30')][_0x2c4c('0x38')]);_0x611b3b[_0x2c4c('0x39')]=qs[_0x2c4c('0x32')](_['pick'](_0x4aede8[_0x2c4c('0x30')],_0x5d7dda[_0x2c4c('0x32')]),_0x3f84a8);if(_0x4aede8[_0x2c4c('0x30')][_0x2c4c('0x3a')]){_0x611b3b['where']=_['merge'](_0x611b3b[_0x2c4c('0x39')],{'$or':_[_0x2c4c('0x2a')](_0x3f84a8,function(_0x2d9cbb){if(_0x2d9cbb[_0x2c4c('0x2d')]!==_0x2c4c('0x3b')){var _0x5d00ed={};_0x5d00ed[_0x2d9cbb[_0x2c4c('0x3c')]]={'$like':'%'+_0x4aede8[_0x2c4c('0x30')]['filter']+'%'};return _0x5d00ed;}})});}_0x611b3b=_[_0x2c4c('0x3d')]({},_0x611b3b,_0x4aede8[_0x2c4c('0x3e')]);var _0x2e4c4b={'where':_0x611b3b[_0x2c4c('0x39')]};return db[_0x2c4c('0x3f')][_0x2c4c('0x20')](_0x2e4c4b)['then'](function(_0x4370a1){_0x2b071b['count']=_0x4370a1;if(_0x4aede8[_0x2c4c('0x30')][_0x2c4c('0x40')]){_0x611b3b[_0x2c4c('0x41')]=[{'all':!![]}];}return db['FreshsalesField'][_0x2c4c('0x42')](_0x611b3b);})[_0x2c4c('0x25')](function(_0x534a28){_0x2b071b[_0x2c4c('0x43')]=_0x534a28;return _0x2b071b;})[_0x2c4c('0x25')](respondWithFilteredResult(_0x49bcb4,_0x611b3b))[_0x2c4c('0x44')](handleError(_0x49bcb4,null));};exports[_0x2c4c('0x45')]=function(_0x13576d,_0x4dce24){var _0x93c047={'raw':!![],'where':{'id':_0x13576d[_0x2c4c('0x46')]['id']}},_0x5b3773={};_0x5b3773[_0x2c4c('0x2f')]=_[_0x2c4c('0x31')](db[_0x2c4c('0x3f')][_0x2c4c('0x2b')]);_0x5b3773[_0x2c4c('0x30')]=_[_0x2c4c('0x31')](_0x13576d[_0x2c4c('0x30')]);_0x5b3773['filters']=_[_0x2c4c('0x33')](_0x5b3773[_0x2c4c('0x2f')],_0x5b3773[_0x2c4c('0x30')]);_0x93c047[_0x2c4c('0x34')]=_[_0x2c4c('0x33')](_0x5b3773[_0x2c4c('0x2f')],qs['fields'](_0x13576d[_0x2c4c('0x30')]['fields']));_0x93c047['attributes']=_0x93c047[_0x2c4c('0x34')][_0x2c4c('0x47')]?_0x93c047[_0x2c4c('0x34')]:_0x5b3773[_0x2c4c('0x2f')];if(_0x13576d[_0x2c4c('0x30')][_0x2c4c('0x40')]){_0x93c047['include']=[{'all':!![]}];}_0x93c047=_[_0x2c4c('0x3d')]({},_0x93c047,_0x13576d[_0x2c4c('0x3e')]);return db['FreshsalesField']['find'](_0x93c047)[_0x2c4c('0x25')](handleEntityNotFound(_0x4dce24,null))[_0x2c4c('0x25')](respondWithResult(_0x4dce24,null))['catch'](handleError(_0x4dce24,null));};exports[_0x2c4c('0x48')]=function(_0xcf48e1,_0x68dd41){return db[_0x2c4c('0x3f')][_0x2c4c('0x48')](_0xcf48e1[_0x2c4c('0x49')],{})[_0x2c4c('0x25')](respondWithResult(_0x68dd41,0xc9))[_0x2c4c('0x44')](handleError(_0x68dd41,null));};exports[_0x2c4c('0x24')]=function(_0x4cd9ee,_0x56dadb){if(_0x4cd9ee['body']['id']){delete _0x4cd9ee[_0x2c4c('0x49')]['id'];}return db[_0x2c4c('0x3f')][_0x2c4c('0x4a')]({'where':{'id':_0x4cd9ee[_0x2c4c('0x46')]['id']}})[_0x2c4c('0x25')](handleEntityNotFound(_0x56dadb,null))[_0x2c4c('0x25')](saveUpdates(_0x4cd9ee[_0x2c4c('0x49')],null))[_0x2c4c('0x25')](respondWithResult(_0x56dadb,null))[_0x2c4c('0x44')](handleError(_0x56dadb,null));};exports['destroy']=function(_0xf0ebd5,_0x462980){return db[_0x2c4c('0x3f')][_0x2c4c('0x4a')]({'where':{'id':_0xf0ebd5['params']['id']}})[_0x2c4c('0x25')](handleEntityNotFound(_0x462980,null))[_0x2c4c('0x25')](removeEntity(_0x462980,null))[_0x2c4c('0x44')](handleError(_0x462980,null));}; \ No newline at end of file +var _0xf4a1=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end','error','name','map','FreshsalesField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','length','options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x4b7c0b,_0x3f1145){var _0x4236b4=function(_0x54af6a){while(--_0x54af6a){_0x4b7c0b['push'](_0x4b7c0b['shift']());}};_0x4236b4(++_0x3f1145);}(_0xf4a1,0x1af));var _0x1f4a=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0xf4a1[_0x5d8018];return _0x151ac4;};'use strict';var emlformat=require(_0x1f4a('0x0'));var rimraf=require(_0x1f4a('0x1'));var zipdir=require(_0x1f4a('0x2'));var jsonpatch=require(_0x1f4a('0x3'));var rp=require(_0x1f4a('0x4'));var moment=require(_0x1f4a('0x5'));var BPromise=require(_0x1f4a('0x6'));var Mustache=require(_0x1f4a('0x7'));var util=require(_0x1f4a('0x8'));var path=require(_0x1f4a('0x9'));var sox=require(_0x1f4a('0xa'));var csv=require(_0x1f4a('0xb'));var ejs=require(_0x1f4a('0xc'));var fs=require('fs');var fs_extra=require(_0x1f4a('0xd'));var _=require(_0x1f4a('0xe'));var squel=require(_0x1f4a('0xf'));var crypto=require('crypto');var jsforce=require(_0x1f4a('0x10'));var deskjs=require(_0x1f4a('0x11'));var toCsv=require(_0x1f4a('0xb'));var querystring=require(_0x1f4a('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1f4a('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f4a('0x14'));var logger=require(_0x1f4a('0x15'))(_0x1f4a('0x16'));var utils=require(_0x1f4a('0x17'));var config=require(_0x1f4a('0x18'));var licenseUtil=require(_0x1f4a('0x19'));var db=require(_0x1f4a('0x1a'))['db'];function respondWithStatusCode(_0x14a83b,_0x41f31e){_0x41f31e=_0x41f31e||0xcc;return function(_0x10600b){if(_0x10600b){return _0x14a83b[_0x1f4a('0x1b')](_0x41f31e);}return _0x14a83b[_0x1f4a('0x1c')](_0x41f31e)['end']();};}function respondWithResult(_0x376ec3,_0x3d9ac4){_0x3d9ac4=_0x3d9ac4||0xc8;return function(_0x54220b){if(_0x54220b){return _0x376ec3[_0x1f4a('0x1c')](_0x3d9ac4)[_0x1f4a('0x1d')](_0x54220b);}};}function respondWithFilteredResult(_0x23e778,_0x4da9ca){return function(_0x5eba80){if(_0x5eba80){var _0x48df80=typeof _0x4da9ca[_0x1f4a('0x1e')]===_0x1f4a('0x1f')&&typeof _0x4da9ca[_0x1f4a('0x20')]==='undefined';var _0x35b26a=_0x5eba80[_0x1f4a('0x21')];var _0x75c95f=_0x48df80?0x0:_0x4da9ca[_0x1f4a('0x1e')];var _0x12066e=_0x48df80?_0x5eba80[_0x1f4a('0x21')]:_0x4da9ca[_0x1f4a('0x1e')]+_0x4da9ca['limit'];var _0x714843;if(_0x12066e>=_0x35b26a){_0x12066e=_0x35b26a;_0x714843=0xc8;}else{_0x714843=0xce;}_0x23e778['status'](_0x714843);return _0x23e778[_0x1f4a('0x22')]('Content-Range',_0x75c95f+'-'+_0x12066e+'/'+_0x35b26a)[_0x1f4a('0x1d')](_0x5eba80);}return null;};}function patchUpdates(_0x2af5fe){return function(_0x339263){try{jsonpatch[_0x1f4a('0x23')](_0x339263,_0x2af5fe,!![]);}catch(_0x197061){return BPromise[_0x1f4a('0x24')](_0x197061);}return _0x339263[_0x1f4a('0x25')]();};}function saveUpdates(_0x4e7e10,_0x49a1b5){return function(_0xcb350d){if(_0xcb350d){return _0xcb350d['update'](_0x4e7e10)[_0x1f4a('0x26')](function(_0x7308c5){return _0x7308c5;});}return null;};}function removeEntity(_0x45b565,_0x8b6e2){return function(_0x4fbc12){if(_0x4fbc12){return _0x4fbc12[_0x1f4a('0x27')]()['then'](function(){_0x45b565['status'](0xcc)[_0x1f4a('0x28')]();});}};}function handleEntityNotFound(_0x116490,_0x71e7d){return function(_0x48c93c){if(!_0x48c93c){_0x116490[_0x1f4a('0x1b')](0x194);}return _0x48c93c;};}function handleError(_0x47e07c,_0x538ac6){_0x538ac6=_0x538ac6||0x1f4;return function(_0x4f6015){logger[_0x1f4a('0x29')](_0x4f6015['stack']);if(_0x4f6015['name']){delete _0x4f6015[_0x1f4a('0x2a')];}_0x47e07c[_0x1f4a('0x1c')](_0x538ac6)['send'](_0x4f6015);};}exports['index']=function(_0xa4db28,_0x345ca6){var _0x256392={},_0x399dec={},_0x309381={'count':0x0,'rows':[]};var _0x489a96=_[_0x1f4a('0x2b')](db[_0x1f4a('0x2c')][_0x1f4a('0x2d')],function(_0x4dcdea){return{'name':_0x4dcdea[_0x1f4a('0x2e')],'type':_0x4dcdea[_0x1f4a('0x2f')]['key']};});_0x399dec[_0x1f4a('0x30')]=_[_0x1f4a('0x2b')](_0x489a96,_0x1f4a('0x2a'));_0x399dec['query']=_[_0x1f4a('0x31')](_0xa4db28[_0x1f4a('0x32')]);_0x399dec[_0x1f4a('0x33')]=_[_0x1f4a('0x34')](_0x399dec[_0x1f4a('0x30')],_0x399dec['query']);_0x256392[_0x1f4a('0x35')]=_['intersection'](_0x399dec['model'],qs[_0x1f4a('0x36')](_0xa4db28[_0x1f4a('0x32')][_0x1f4a('0x36')]));_0x256392[_0x1f4a('0x35')]=_0x256392[_0x1f4a('0x35')]['length']?_0x256392[_0x1f4a('0x35')]:_0x399dec[_0x1f4a('0x30')];if(!_0xa4db28['query']['hasOwnProperty'](_0x1f4a('0x37'))){_0x256392[_0x1f4a('0x20')]=qs[_0x1f4a('0x20')](_0xa4db28[_0x1f4a('0x32')][_0x1f4a('0x20')]);_0x256392['offset']=qs[_0x1f4a('0x1e')](_0xa4db28[_0x1f4a('0x32')][_0x1f4a('0x1e')]);}_0x256392[_0x1f4a('0x38')]=qs[_0x1f4a('0x39')](_0xa4db28[_0x1f4a('0x32')][_0x1f4a('0x39')]);_0x256392[_0x1f4a('0x3a')]=qs['filters'](_[_0x1f4a('0x3b')](_0xa4db28[_0x1f4a('0x32')],_0x399dec[_0x1f4a('0x33')]),_0x489a96);if(_0xa4db28[_0x1f4a('0x32')][_0x1f4a('0x3c')]){_0x256392[_0x1f4a('0x3a')]=_['merge'](_0x256392[_0x1f4a('0x3a')],{'$or':_[_0x1f4a('0x2b')](_0x489a96,function(_0x4a93c3){if(_0x4a93c3[_0x1f4a('0x2f')]!==_0x1f4a('0x3d')){var _0x18fb08={};_0x18fb08[_0x4a93c3['name']]={'$like':'%'+_0xa4db28[_0x1f4a('0x32')][_0x1f4a('0x3c')]+'%'};return _0x18fb08;}})});}_0x256392=_[_0x1f4a('0x3e')]({},_0x256392,_0xa4db28['options']);var _0xce7e38={'where':_0x256392[_0x1f4a('0x3a')]};return db['FreshsalesField'][_0x1f4a('0x21')](_0xce7e38)['then'](function(_0x4058eb){_0x309381['count']=_0x4058eb;if(_0xa4db28[_0x1f4a('0x32')][_0x1f4a('0x3f')]){_0x256392[_0x1f4a('0x40')]=[{'all':!![]}];}return db[_0x1f4a('0x2c')][_0x1f4a('0x41')](_0x256392);})[_0x1f4a('0x26')](function(_0x261c65){_0x309381[_0x1f4a('0x42')]=_0x261c65;return _0x309381;})['then'](respondWithFilteredResult(_0x345ca6,_0x256392))['catch'](handleError(_0x345ca6,null));};exports[_0x1f4a('0x43')]=function(_0x46a59e,_0x4b793e){var _0x3327d0={'raw':!![],'where':{'id':_0x46a59e['params']['id']}},_0x16228b={};_0x16228b[_0x1f4a('0x30')]=_[_0x1f4a('0x31')](db['FreshsalesField'][_0x1f4a('0x2d')]);_0x16228b[_0x1f4a('0x32')]=_[_0x1f4a('0x31')](_0x46a59e['query']);_0x16228b[_0x1f4a('0x33')]=_[_0x1f4a('0x34')](_0x16228b[_0x1f4a('0x30')],_0x16228b[_0x1f4a('0x32')]);_0x3327d0[_0x1f4a('0x35')]=_[_0x1f4a('0x34')](_0x16228b[_0x1f4a('0x30')],qs[_0x1f4a('0x36')](_0x46a59e['query']['fields']));_0x3327d0[_0x1f4a('0x35')]=_0x3327d0[_0x1f4a('0x35')][_0x1f4a('0x44')]?_0x3327d0['attributes']:_0x16228b[_0x1f4a('0x30')];if(_0x46a59e[_0x1f4a('0x32')][_0x1f4a('0x3f')]){_0x3327d0['include']=[{'all':!![]}];}_0x3327d0=_['merge']({},_0x3327d0,_0x46a59e[_0x1f4a('0x45')]);return db['FreshsalesField'][_0x1f4a('0x46')](_0x3327d0)[_0x1f4a('0x26')](handleEntityNotFound(_0x4b793e,null))[_0x1f4a('0x26')](respondWithResult(_0x4b793e,null))[_0x1f4a('0x47')](handleError(_0x4b793e,null));};exports['create']=function(_0x2b07b4,_0x2286f0){return db['FreshsalesField']['create'](_0x2b07b4['body'],{})[_0x1f4a('0x26')](respondWithResult(_0x2286f0,0xc9))[_0x1f4a('0x47')](handleError(_0x2286f0,null));};exports['update']=function(_0x49e0df,_0x1a8782){if(_0x49e0df[_0x1f4a('0x48')]['id']){delete _0x49e0df[_0x1f4a('0x48')]['id'];}return db[_0x1f4a('0x2c')][_0x1f4a('0x46')]({'where':{'id':_0x49e0df['params']['id']}})[_0x1f4a('0x26')](handleEntityNotFound(_0x1a8782,null))[_0x1f4a('0x26')](saveUpdates(_0x49e0df[_0x1f4a('0x48')],null))[_0x1f4a('0x26')](respondWithResult(_0x1a8782,null))['catch'](handleError(_0x1a8782,null));};exports[_0x1f4a('0x27')]=function(_0x759bb9,_0x5216f9){return db[_0x1f4a('0x2c')][_0x1f4a('0x46')]({'where':{'id':_0x759bb9['params']['id']}})['then'](handleEntityNotFound(_0x5216f9,null))[_0x1f4a('0x26')](removeEntity(_0x5216f9,null))['catch'](handleError(_0x5216f9,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 5213ede..9cb81e4 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.model.js +++ b/server/api/intFreshsalesField/intFreshsalesField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf894=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util'];(function(_0x3a7c8b,_0x2bc953){var _0x4f823c=function(_0x17bb77){while(--_0x17bb77){_0x3a7c8b['push'](_0x3a7c8b['shift']());}};_0x4f823c(++_0x2bc953);}(_0xf894,0xfd));var _0x4f89=function(_0x538c63,_0x317ffb){_0x538c63=_0x538c63-0x0;var _0x214361=_0xf894[_0x538c63];return _0x214361;};'use strict';var _=require(_0x4f89('0x0'));var util=require(_0x4f89('0x1'));var logger=require(_0x4f89('0x2'))(_0x4f89('0x3'));var moment=require(_0x4f89('0x4'));var BPromise=require(_0x4f89('0x5'));var rp=require(_0x4f89('0x6'));var fs=require('fs');var path=require(_0x4f89('0x7'));var rimraf=require(_0x4f89('0x8'));var config=require(_0x4f89('0x9'));var attributes=require(_0x4f89('0xa'));module[_0x4f89('0xb')]=function(_0x8837a0,_0x343593){return _0x8837a0[_0x4f89('0xc')](_0x4f89('0xd'),attributes,{'tableName':_0x4f89('0xe'),'paranoid':![],'indexes':[{'name':_0x4f89('0xf'),'fields':['idField',_0x4f89('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe72e=['define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xe72e,0x119));var _0xee72=function(_0x143cd5,_0x46be90){_0x143cd5=_0x143cd5-0x0;var _0x41f15f=_0xe72e[_0x143cd5];return _0x41f15f;};'use strict';var _=require(_0xee72('0x0'));var util=require(_0xee72('0x1'));var logger=require(_0xee72('0x2'))(_0xee72('0x3'));var moment=require(_0xee72('0x4'));var BPromise=require(_0xee72('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xee72('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0xf8fe3b,_0x1a0d8e){return _0xf8fe3b[_0xee72('0x7')](_0xee72('0x8'),attributes,{'tableName':_0xee72('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xee72('0xa'),_0xee72('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index cf6140a..247c080 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.rpc.js +++ b/server/api/intFreshsalesField/intFreshsalesField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x40f3=['FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x22b39b,_0x2b7d63){var _0x280e1d=function(_0xc74635){while(--_0xc74635){_0x22b39b['push'](_0x22b39b['shift']());}};_0x280e1d(++_0x2b7d63);}(_0x40f3,0x8b));var _0x340f=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x40f3[_0x4e9d3c];return _0x2d0825;};'use strict';var _=require('lodash');var util=require(_0x340f('0x0'));var moment=require(_0x340f('0x1'));var BPromise=require('bluebird');var rs=require(_0x340f('0x2'));var fs=require('fs');var Redis=require(_0x340f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x340f('0x4'))(_0x340f('0x5'));var config=require('../../config/environment');var jayson=require(_0x340f('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d92f2,_0x264754,_0x22dd4b){return new BPromise(function(_0x5af823,_0x4f1f9b){return client[_0x340f('0x7')](_0x2d92f2,_0x22dd4b)[_0x340f('0x8')](function(_0x112b1f){logger[_0x340f('0x9')](_0x340f('0xa'),_0x264754,_0x340f('0xb'));logger[_0x340f('0xc')](_0x340f('0xd'),_0x264754,_0x340f('0xb'),JSON[_0x340f('0xe')](_0x112b1f));if(_0x112b1f[_0x340f('0xf')]){if(_0x112b1f['error'][_0x340f('0x10')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x264754,_0x112b1f[_0x340f('0xf')][_0x340f('0x11')]);return _0x4f1f9b(_0x112b1f[_0x340f('0xf')]['message']);}logger[_0x340f('0xf')](_0x340f('0xa'),_0x264754,_0x112b1f[_0x340f('0xf')][_0x340f('0x11')]);return _0x5af823(_0x112b1f['error'][_0x340f('0x11')]);}else{logger[_0x340f('0x9')](_0x340f('0xa'),_0x264754,'request\x20sent');_0x5af823(_0x112b1f[_0x340f('0x12')][_0x340f('0x11')]);}})['catch'](function(_0x161c08){logger[_0x340f('0xf')](_0x340f('0xa'),_0x264754,_0x161c08);_0x4f1f9b(_0x161c08);});});} \ No newline at end of file +var _0xaac2=['stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaac2,0x1eb));var _0x2aac=function(_0x3233c9,_0x2b1b66){_0x3233c9=_0x3233c9-0x0;var _0x4dbd10=_0xaac2[_0x3233c9];return _0x4dbd10;};'use strict';var _=require(_0x2aac('0x0'));var util=require('util');var moment=require(_0x2aac('0x1'));var BPromise=require(_0x2aac('0x2'));var rs=require(_0x2aac('0x3'));var fs=require('fs');var Redis=require(_0x2aac('0x4'));var db=require(_0x2aac('0x5'))['db'];var utils=require(_0x2aac('0x6'));var logger=require(_0x2aac('0x7'))(_0x2aac('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2aac('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53e009,_0x479797,_0x10e0b3){return new BPromise(function(_0x4c999d,_0x1ec4f2){return client[_0x2aac('0xa')](_0x53e009,_0x10e0b3)[_0x2aac('0xb')](function(_0x3c3a7e){logger['info'](_0x2aac('0xc'),_0x479797,_0x2aac('0xd'));logger['debug'](_0x2aac('0xe'),_0x479797,_0x2aac('0xd'),JSON[_0x2aac('0xf')](_0x3c3a7e));if(_0x3c3a7e[_0x2aac('0x10')]){if(_0x3c3a7e[_0x2aac('0x10')][_0x2aac('0x11')]===0x1f4){logger[_0x2aac('0x10')](_0x2aac('0xc'),_0x479797,_0x3c3a7e['error'][_0x2aac('0x12')]);return _0x1ec4f2(_0x3c3a7e['error'][_0x2aac('0x12')]);}logger[_0x2aac('0x10')](_0x2aac('0xc'),_0x479797,_0x3c3a7e['error'][_0x2aac('0x12')]);return _0x4c999d(_0x3c3a7e[_0x2aac('0x10')][_0x2aac('0x12')]);}else{logger[_0x2aac('0x13')](_0x2aac('0xc'),_0x479797,_0x2aac('0xd'));_0x4c999d(_0x3c3a7e[_0x2aac('0x14')]['message']);}})[_0x2aac('0x15')](function(_0x35b326){logger[_0x2aac('0x10')](_0x2aac('0xc'),_0x479797,_0x35b326);_0x1ec4f2(_0x35b326);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 529c23e..80b7a73 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 _0x7879=['getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations'];(function(_0x46a671,_0x758e9a){var _0x526d75=function(_0xde3640){while(--_0xde3640){_0x46a671['push'](_0x46a671['shift']());}};_0x526d75(++_0x758e9a);}(_0x7879,0x141));var _0x9787=function(_0x228637,_0x7a0f5){_0x228637=_0x228637-0x0;var _0x49578e=_0x7879[_0x228637];return _0x49578e;};'use strict';var multer=require(_0x9787('0x0'));var util=require('util');var path=require(_0x9787('0x1'));var timeout=require('connect-timeout');var express=require(_0x9787('0x2'));var router=express[_0x9787('0x3')]();var fs_extra=require(_0x9787('0x4'));var auth=require(_0x9787('0x5'));var interaction=require(_0x9787('0x6'));var config=require(_0x9787('0x7'));var controller=require(_0x9787('0x8'));router[_0x9787('0x9')]('/',auth[_0x9787('0xa')](),controller['index']);router[_0x9787('0x9')](_0x9787('0xb'),auth[_0x9787('0xa')](),controller[_0x9787('0xc')]);router[_0x9787('0x9')](_0x9787('0xd'),auth[_0x9787('0xa')](),controller[_0x9787('0xe')]);router[_0x9787('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x9787('0xf')]);router[_0x9787('0x10')]('/',auth['isAuthenticated'](),controller[_0x9787('0x11')]);router['post'](_0x9787('0xd'),auth[_0x9787('0xa')](),controller[_0x9787('0x12')]);router[_0x9787('0x13')](_0x9787('0xb'),auth['isAuthenticated'](),controller[_0x9787('0x14')]);router[_0x9787('0x15')](_0x9787('0xb'),auth[_0x9787('0xa')](),controller[_0x9787('0x16')]);module[_0x9787('0x17')]=router; \ No newline at end of file +var _0xbab5=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xbab5,0x138));var _0x5bab=function(_0x25bfce,_0x288e69){_0x25bfce=_0x25bfce-0x0;var _0x2ab6eb=_0xbab5[_0x25bfce];return _0x2ab6eb;};'use strict';var multer=require(_0x5bab('0x0'));var util=require(_0x5bab('0x1'));var path=require('path');var timeout=require(_0x5bab('0x2'));var express=require(_0x5bab('0x3'));var router=express[_0x5bab('0x4')]();var fs_extra=require(_0x5bab('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5bab('0x6'));var config=require('../../config/environment');var controller=require(_0x5bab('0x7'));router[_0x5bab('0x8')]('/',auth[_0x5bab('0x9')](),controller[_0x5bab('0xa')]);router[_0x5bab('0x8')](_0x5bab('0xb'),auth[_0x5bab('0x9')](),controller['show']);router[_0x5bab('0x8')](_0x5bab('0xc'),auth[_0x5bab('0x9')](),controller[_0x5bab('0xd')]);router[_0x5bab('0x8')](_0x5bab('0xe'),auth['isAuthenticated'](),controller[_0x5bab('0xf')]);router[_0x5bab('0x10')]('/',auth[_0x5bab('0x9')](),controller['create']);router[_0x5bab('0x10')](_0x5bab('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x5bab('0x11')](_0x5bab('0xb'),auth[_0x5bab('0x9')](),controller[_0x5bab('0x12')]);router[_0x5bab('0x13')](_0x5bab('0xb'),auth['isAuthenticated'](),controller[_0x5bab('0x14')]);module[_0x5bab('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 4ee7340..79c68e0 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 _0x7ae3=['newTab','sequelize','STRING','username','ENUM','integrationTab'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x7ae3,0x15d));var _0x37ae=function(_0x46ed01,_0x5af9e6){_0x46ed01=_0x46ed01-0x0;var _0x809d68=_0x7ae3[_0x46ed01];return _0x809d68;};'use strict';var Sequelize=require(_0x37ae('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x37ae('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x37ae('0x2')},'remoteUri':{'type':Sequelize[_0x37ae('0x1')]},'password':{'type':Sequelize[_0x37ae('0x1')]},'clientId':{'type':Sequelize[_0x37ae('0x1')]},'clientSecret':{'type':Sequelize[_0x37ae('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x37ae('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x37ae('0x3')](_0x37ae('0x4'),_0x37ae('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xd9c4=['ENUM','integrationTab','sequelize','exports','STRING','username'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd9c4,0x176));var _0x4d9c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd9c4[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x4d9c('0x0'));module[_0x4d9c('0x1')]={'name':{'type':Sequelize[_0x4d9c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4d9c('0x2')],'unique':_0x4d9c('0x3')},'remoteUri':{'type':Sequelize[_0x4d9c('0x2')]},'password':{'type':Sequelize[_0x4d9c('0x2')]},'clientId':{'type':Sequelize[_0x4d9c('0x2')]},'clientSecret':{'type':Sequelize[_0x4d9c('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x4d9c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4d9c('0x4')](_0x4d9c('0x5'),'newTab'),'defaultValue':_0x4d9c('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 184c32d..b0b88e0 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 _0xceb0=['status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','end','sendStatus','stack','name','send','map','SalesforceAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','rows','params','rawAttributes','includeAll','options','create','body','find','getConfigurations','SalesforceConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','getDescriptions','channel','SalesforceField','Descriptions','Task','remoteUri','clientId','username','password','securityToken','substring','lastIndexOf','Connection','clientSecret','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','int','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x5daba1,_0x5904ed){var _0x56c4f8=function(_0x1d6d51){while(--_0x1d6d51){_0x5daba1['push'](_0x5daba1['shift']());}};_0x56c4f8(++_0x5904ed);}(_0xceb0,0x173));var _0x0ceb=function(_0x4c84bf,_0x21a8ff){_0x4c84bf=_0x4c84bf-0x0;var _0x28ccd7=_0xceb0[_0x4c84bf];return _0x28ccd7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0ceb('0x0'));var moment=require('moment');var BPromise=require(_0x0ceb('0x1'));var Mustache=require(_0x0ceb('0x2'));var util=require(_0x0ceb('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x0ceb('0x4'));var ejs=require(_0x0ceb('0x5'));var fs=require('fs');var fs_extra=require(_0x0ceb('0x6'));var _=require('lodash');var squel=require(_0x0ceb('0x7'));var crypto=require(_0x0ceb('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x0ceb('0x9'));var toCsv=require('to-csv');var querystring=require(_0x0ceb('0xa'));var Papa=require(_0x0ceb('0xb'));var Redis=require(_0x0ceb('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0ceb('0xd'));var hardwareService=require(_0x0ceb('0xe'));var logger=require(_0x0ceb('0xf'))(_0x0ceb('0x10'));var utils=require(_0x0ceb('0x11'));var config=require(_0x0ceb('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x0ceb('0x13'))['db'];var integrations=require(_0x0ceb('0x14'));var jayson=require(_0x0ceb('0x15'));var client=jayson[_0x0ceb('0x16')][_0x0ceb('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xb2a488,_0x1528f0,_0x54f34e,_0x416fbb){return new BPromise(function(_0x54a173,_0x55620b){var _0x440f0e=_0x416fbb||client;return _0x440f0e[_0x0ceb('0x18')](_0xb2a488,_0x54f34e)[_0x0ceb('0x19')](function(_0x536bdd){logger[_0x0ceb('0x1a')](_0x0ceb('0x1b'),_0x1528f0,'request\x20sent');logger[_0x0ceb('0x1c')](_0x0ceb('0x1d'),_0x1528f0,_0x0ceb('0x1e'),JSON[_0x0ceb('0x1f')](_0x536bdd));if(_0x536bdd[_0x0ceb('0x20')]){if(_0x536bdd[_0x0ceb('0x20')][_0x0ceb('0x21')]===0x1f4){logger[_0x0ceb('0x20')](_0x0ceb('0x1b'),_0x1528f0,_0x536bdd[_0x0ceb('0x20')][_0x0ceb('0x22')]);return _0x55620b(_0x536bdd[_0x0ceb('0x20')][_0x0ceb('0x22')]);}logger[_0x0ceb('0x20')](_0x0ceb('0x1b'),_0x1528f0,_0x536bdd[_0x0ceb('0x20')][_0x0ceb('0x22')]);return _0x54a173(_0x536bdd['error']['message']);}else{logger[_0x0ceb('0x1a')](_0x0ceb('0x1b'),_0x1528f0,'request\x20sent');_0x54a173(_0x536bdd[_0x0ceb('0x23')]['message']);}})[_0x0ceb('0x24')](function(_0xc2b85c){logger[_0x0ceb('0x20')](_0x0ceb('0x1b'),_0x1528f0,_0xc2b85c);_0x55620b(_0xc2b85c);});});}function respondWithStatusCode(_0x27e058,_0x4a2b69){_0x4a2b69=_0x4a2b69||0xcc;return function(_0x5c41dd){if(_0x5c41dd){return _0x27e058['sendStatus'](_0x4a2b69);}return _0x27e058[_0x0ceb('0x25')](_0x4a2b69)['end']();};}function respondWithResult(_0x336ce9,_0x4c3e4c){_0x4c3e4c=_0x4c3e4c||0xc8;return function(_0x45f2fe){if(_0x45f2fe){return _0x336ce9[_0x0ceb('0x25')](_0x4c3e4c)[_0x0ceb('0x26')](_0x45f2fe);}};}function respondWithFilteredResult(_0x72e51,_0x5a15ee){return function(_0x106916){if(_0x106916){var _0x9246e1=typeof _0x5a15ee[_0x0ceb('0x27')]===_0x0ceb('0x28')&&typeof _0x5a15ee[_0x0ceb('0x29')]==='undefined';var _0x2de4f3=_0x106916[_0x0ceb('0x2a')];var _0x3c934b=_0x9246e1?0x0:_0x5a15ee[_0x0ceb('0x27')];var _0x1ca4cb=_0x9246e1?_0x106916[_0x0ceb('0x2a')]:_0x5a15ee['offset']+_0x5a15ee[_0x0ceb('0x29')];var _0x105011;if(_0x1ca4cb>=_0x2de4f3){_0x1ca4cb=_0x2de4f3;_0x105011=0xc8;}else{_0x105011=0xce;}_0x72e51[_0x0ceb('0x25')](_0x105011);return _0x72e51[_0x0ceb('0x2b')](_0x0ceb('0x2c'),_0x3c934b+'-'+_0x1ca4cb+'/'+_0x2de4f3)[_0x0ceb('0x26')](_0x106916);}return null;};}function patchUpdates(_0x1b97b4){return function(_0x293d4d){try{jsonpatch[_0x0ceb('0x2d')](_0x293d4d,_0x1b97b4,!![]);}catch(_0x200641){return BPromise['reject'](_0x200641);}return _0x293d4d[_0x0ceb('0x2e')]();};}function saveUpdates(_0x3ee0e1,_0x5b121e){return function(_0x2f2b8e){if(_0x2f2b8e){return _0x2f2b8e[_0x0ceb('0x2f')](_0x3ee0e1)[_0x0ceb('0x19')](function(_0x5f2a70){return _0x5f2a70;});}return null;};}function removeEntity(_0x39d68a,_0x1a5af9){return function(_0x1725fe){if(_0x1725fe){return _0x1725fe[_0x0ceb('0x30')]()[_0x0ceb('0x19')](function(){_0x39d68a[_0x0ceb('0x25')](0xcc)[_0x0ceb('0x31')]();});}};}function handleEntityNotFound(_0x1eb2a8,_0x2ad461){return function(_0x3dadbd){if(!_0x3dadbd){_0x1eb2a8[_0x0ceb('0x32')](0x194);}return _0x3dadbd;};}function handleError(_0x116a47,_0x40b21e){_0x40b21e=_0x40b21e||0x1f4;return function(_0x540851){logger[_0x0ceb('0x20')](_0x540851[_0x0ceb('0x33')]);if(_0x540851[_0x0ceb('0x34')]){delete _0x540851[_0x0ceb('0x34')];}_0x116a47[_0x0ceb('0x25')](_0x40b21e)[_0x0ceb('0x35')](_0x540851);};}exports['index']=function(_0x44806d,_0x48bf08){var _0x4938e2={},_0x5e440a={},_0x2a7c7c={'count':0x0,'rows':[]};var _0x5e4dcc=_[_0x0ceb('0x36')](db[_0x0ceb('0x37')]['rawAttributes'],function(_0x3f730b){return{'name':_0x3f730b[_0x0ceb('0x38')],'type':_0x3f730b[_0x0ceb('0x39')]['key']};});_0x5e440a[_0x0ceb('0x3a')]=_[_0x0ceb('0x36')](_0x5e4dcc,_0x0ceb('0x34'));_0x5e440a[_0x0ceb('0x3b')]=_[_0x0ceb('0x3c')](_0x44806d[_0x0ceb('0x3b')]);_0x5e440a[_0x0ceb('0x3d')]=_[_0x0ceb('0x3e')](_0x5e440a[_0x0ceb('0x3a')],_0x5e440a[_0x0ceb('0x3b')]);_0x4938e2[_0x0ceb('0x3f')]=_[_0x0ceb('0x3e')](_0x5e440a[_0x0ceb('0x3a')],qs[_0x0ceb('0x40')](_0x44806d[_0x0ceb('0x3b')][_0x0ceb('0x40')]));_0x4938e2[_0x0ceb('0x3f')]=_0x4938e2[_0x0ceb('0x3f')][_0x0ceb('0x41')]?_0x4938e2[_0x0ceb('0x3f')]:_0x5e440a[_0x0ceb('0x3a')];if(!_0x44806d[_0x0ceb('0x3b')][_0x0ceb('0x42')](_0x0ceb('0x43'))){_0x4938e2[_0x0ceb('0x29')]=qs[_0x0ceb('0x29')](_0x44806d[_0x0ceb('0x3b')][_0x0ceb('0x29')]);_0x4938e2['offset']=qs[_0x0ceb('0x27')](_0x44806d['query']['offset']);}_0x4938e2[_0x0ceb('0x44')]=qs[_0x0ceb('0x45')](_0x44806d[_0x0ceb('0x3b')]['sort']);_0x4938e2['where']=qs[_0x0ceb('0x3d')](_[_0x0ceb('0x46')](_0x44806d[_0x0ceb('0x3b')],_0x5e440a[_0x0ceb('0x3d')]),_0x5e4dcc);if(_0x44806d[_0x0ceb('0x3b')][_0x0ceb('0x47')]){_0x4938e2[_0x0ceb('0x48')]=_[_0x0ceb('0x49')](_0x4938e2[_0x0ceb('0x48')],{'$or':_['map'](_0x5e4dcc,function(_0xb6bb8c){if(_0xb6bb8c[_0x0ceb('0x39')]!==_0x0ceb('0x4a')){var _0x29409d={};_0x29409d[_0xb6bb8c['name']]={'$like':'%'+_0x44806d[_0x0ceb('0x3b')]['filter']+'%'};return _0x29409d;}})});}_0x4938e2=_[_0x0ceb('0x49')]({},_0x4938e2,_0x44806d['options']);var _0x22c8e8={'where':_0x4938e2[_0x0ceb('0x48')]};return db[_0x0ceb('0x37')][_0x0ceb('0x2a')](_0x22c8e8)[_0x0ceb('0x19')](function(_0x2c03af){_0x2a7c7c[_0x0ceb('0x2a')]=_0x2c03af;if(_0x44806d[_0x0ceb('0x3b')]['includeAll']){_0x4938e2[_0x0ceb('0x4b')]=[{'all':!![]}];}return db[_0x0ceb('0x37')]['findAll'](_0x4938e2);})[_0x0ceb('0x19')](function(_0x24efd4){_0x2a7c7c[_0x0ceb('0x4c')]=_0x24efd4;return _0x2a7c7c;})[_0x0ceb('0x19')](respondWithFilteredResult(_0x48bf08,_0x4938e2))[_0x0ceb('0x24')](handleError(_0x48bf08,null));};exports['show']=function(_0x34daf8,_0x256760){var _0x1a7c52={'raw':![],'where':{'id':_0x34daf8[_0x0ceb('0x4d')]['id']}},_0xf17e0b={};_0xf17e0b[_0x0ceb('0x3a')]=_[_0x0ceb('0x3c')](db[_0x0ceb('0x37')][_0x0ceb('0x4e')]);_0xf17e0b['query']=_[_0x0ceb('0x3c')](_0x34daf8[_0x0ceb('0x3b')]);_0xf17e0b[_0x0ceb('0x3d')]=_[_0x0ceb('0x3e')](_0xf17e0b['model'],_0xf17e0b['query']);_0x1a7c52[_0x0ceb('0x3f')]=_[_0x0ceb('0x3e')](_0xf17e0b[_0x0ceb('0x3a')],qs[_0x0ceb('0x40')](_0x34daf8[_0x0ceb('0x3b')]['fields']));_0x1a7c52[_0x0ceb('0x3f')]=_0x1a7c52[_0x0ceb('0x3f')]['length']?_0x1a7c52['attributes']:_0xf17e0b['model'];if(_0x34daf8[_0x0ceb('0x3b')][_0x0ceb('0x4f')]){_0x1a7c52[_0x0ceb('0x4b')]=[{'all':!![]}];}_0x1a7c52=_['merge']({},_0x1a7c52,_0x34daf8[_0x0ceb('0x50')]);return db[_0x0ceb('0x37')]['find'](_0x1a7c52)[_0x0ceb('0x19')](handleEntityNotFound(_0x256760,null))[_0x0ceb('0x19')](respondWithResult(_0x256760,null))[_0x0ceb('0x24')](handleError(_0x256760,null));};exports['create']=function(_0x3fe549,_0x4d057f){return db[_0x0ceb('0x37')][_0x0ceb('0x51')](_0x3fe549[_0x0ceb('0x52')],{})[_0x0ceb('0x19')](respondWithResult(_0x4d057f,0xc9))[_0x0ceb('0x24')](handleError(_0x4d057f,null));};exports['update']=function(_0x162a6b,_0x28c87f){if(_0x162a6b[_0x0ceb('0x52')]['id']){delete _0x162a6b[_0x0ceb('0x52')]['id'];}return db[_0x0ceb('0x37')][_0x0ceb('0x53')]({'where':{'id':_0x162a6b[_0x0ceb('0x4d')]['id']}})[_0x0ceb('0x19')](handleEntityNotFound(_0x28c87f,null))[_0x0ceb('0x19')](saveUpdates(_0x162a6b[_0x0ceb('0x52')],null))['then'](respondWithResult(_0x28c87f,null))[_0x0ceb('0x24')](handleError(_0x28c87f,null));};exports[_0x0ceb('0x30')]=function(_0x263b6b,_0x3a79d3){return db[_0x0ceb('0x37')][_0x0ceb('0x53')]({'where':{'id':_0x263b6b[_0x0ceb('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3a79d3,null))[_0x0ceb('0x19')](removeEntity(_0x3a79d3,null))[_0x0ceb('0x24')](handleError(_0x3a79d3,null));};exports[_0x0ceb('0x54')]=function(_0x4184aa,_0x433044,_0xa088dc){var _0x472b5c={};var _0x22bdba={};var _0x2bbd32;var _0x1d672c;return db[_0x0ceb('0x37')]['findOne']({'where':{'id':_0x4184aa[_0x0ceb('0x4d')]['id']}})[_0x0ceb('0x19')](handleEntityNotFound(_0x433044,null))[_0x0ceb('0x19')](function(_0x1609c3){if(_0x1609c3){_0x2bbd32=_0x1609c3;_0x22bdba[_0x0ceb('0x3a')]=_['keys'](db[_0x0ceb('0x55')][_0x0ceb('0x4e')]);_0x22bdba['query']=_[_0x0ceb('0x3c')](_0x4184aa['query']);_0x22bdba[_0x0ceb('0x3d')]=_[_0x0ceb('0x3e')](_0x22bdba[_0x0ceb('0x3a')],_0x22bdba[_0x0ceb('0x3b')]);_0x472b5c[_0x0ceb('0x3f')]=_['intersection'](_0x22bdba[_0x0ceb('0x3a')],qs[_0x0ceb('0x40')](_0x4184aa[_0x0ceb('0x3b')][_0x0ceb('0x40')]));_0x472b5c[_0x0ceb('0x3f')]=_0x472b5c[_0x0ceb('0x3f')]['length']?_0x472b5c[_0x0ceb('0x3f')]:_0x22bdba[_0x0ceb('0x3a')];_0x472b5c[_0x0ceb('0x44')]=qs[_0x0ceb('0x45')](_0x4184aa['query']['sort']);_0x472b5c[_0x0ceb('0x48')]=qs[_0x0ceb('0x3d')](_[_0x0ceb('0x46')](_0x4184aa[_0x0ceb('0x3b')],_0x22bdba[_0x0ceb('0x3d')]));if(_0x4184aa[_0x0ceb('0x3b')][_0x0ceb('0x47')]){_0x472b5c['where']=_[_0x0ceb('0x49')](_0x472b5c[_0x0ceb('0x48')],{'$or':_[_0x0ceb('0x36')](_0x472b5c[_0x0ceb('0x3f')],function(_0x21f437){var _0x187fe5={};_0x187fe5[_0x21f437]={'$like':'%'+_0x4184aa[_0x0ceb('0x3b')][_0x0ceb('0x47')]+'%'};return _0x187fe5;})});}_0x472b5c=_[_0x0ceb('0x49')]({},_0x472b5c,_0x4184aa[_0x0ceb('0x50')]);return _0x2bbd32[_0x0ceb('0x54')](_0x472b5c);}})['then'](function(_0x337bab){if(_0x337bab){_0x1d672c=_0x337bab[_0x0ceb('0x41')];if(!_0x4184aa[_0x0ceb('0x3b')][_0x0ceb('0x42')](_0x0ceb('0x43'))){_0x472b5c[_0x0ceb('0x29')]=qs[_0x0ceb('0x29')](_0x4184aa['query'][_0x0ceb('0x29')]);_0x472b5c[_0x0ceb('0x27')]=qs[_0x0ceb('0x27')](_0x4184aa['query'][_0x0ceb('0x27')]);}return _0x2bbd32[_0x0ceb('0x54')](_0x472b5c);}})[_0x0ceb('0x19')](function(_0x126a03){if(_0x126a03){return _0x126a03?{'count':_0x1d672c,'rows':_0x126a03}:null;}})[_0x0ceb('0x19')](respondWithResult(_0x433044,null))[_0x0ceb('0x24')](handleError(_0x433044,null));};exports[_0x0ceb('0x56')]=function(_0x107171,_0x44929e,_0x22ee40){if(_0x107171['body']['id']){delete _0x107171[_0x0ceb('0x52')]['id'];}return db[_0x0ceb('0x37')][_0x0ceb('0x57')]({'where':{'id':_0x107171['params']['id']}})[_0x0ceb('0x19')](handleEntityNotFound(_0x44929e,null))[_0x0ceb('0x19')](function(_0x1de261){if(_0x1de261){_0x107171['body'][_0x0ceb('0x58')]=_0x1de261['id'];_0x107171[_0x0ceb('0x52')][_0x0ceb('0x59')]=integrations[_0x0ceb('0x5a')](_0x107171[_0x0ceb('0x52')]['channel'],_0x107171['body']['type']);_0x107171[_0x0ceb('0x52')]['Descriptions']=integrations[_0x0ceb('0x5b')](_0x107171[_0x0ceb('0x52')][_0x0ceb('0x5c')],_0x107171[_0x0ceb('0x52')]['type']);return db[_0x0ceb('0x55')][_0x0ceb('0x51')](_0x107171['body'],{'include':[{'model':db[_0x0ceb('0x5d')],'as':'Subjects'},{'model':db[_0x0ceb('0x5d')],'as':_0x0ceb('0x5e')}]});}return null;})[_0x0ceb('0x19')](respondWithResult(_0x44929e,null))[_0x0ceb('0x24')](handleError(_0x44929e,null));};exports['getFields']=function(_0x5839d8,_0x35c39f,_0x22e918){var _0x54b049;var _0x33c892='';var _0x598133=_0x0ceb('0x5f');return db[_0x0ceb('0x37')][_0x0ceb('0x57')]({'where':{'id':_0x5839d8[_0x0ceb('0x4d')]['id']},'attributes':['id',_0x0ceb('0x60'),_0x0ceb('0x61'),'clientSecret',_0x0ceb('0x62'),_0x0ceb('0x63'),_0x0ceb('0x64')]})[_0x0ceb('0x19')](handleEntityNotFound(_0x35c39f,null))[_0x0ceb('0x19')](function(_0x39d852){if(_0x39d852){_0x33c892=_0x39d852[_0x0ceb('0x60')];var _0x448051=_0x33c892['slice'](-0x1);if(_0x448051==='/'){_0x33c892=_0x33c892[_0x0ceb('0x65')](0x0,_0x33c892[_0x0ceb('0x66')](_0x448051));}_0x54b049=new jsforce[(_0x0ceb('0x67'))]({'oauth2':{'loginUrl':_0x33c892,'clientId':_0x39d852['clientId'],'clientSecret':_0x39d852[_0x0ceb('0x68')]}});return _0x54b049[_0x0ceb('0x69')](_0x39d852[_0x0ceb('0x62')],_0x39d852['password'][_0x0ceb('0x6a')](_0x39d852['securityToken']));}})['then'](function(_0x33ba4d){if(_0x33ba4d){if(!_[_0x0ceb('0x6b')](_0x5839d8['query'][_0x0ceb('0x6c')])){_0x598133=_0x5839d8[_0x0ceb('0x3b')]['ticketType'];}return _0x54b049[_0x0ceb('0x6d')](_0x598133)[_0x0ceb('0x6e')]();}})['then'](function(_0x5efd29){var _0x147f95=[_0x0ceb('0x6f'),_0x0ceb('0x70'),_0x0ceb('0x71'),_0x0ceb('0x72'),_0x0ceb('0x73'),_0x0ceb('0x74')];var _0x271056=['string',_0x0ceb('0x75'),_0x0ceb('0x76'),_0x0ceb('0x77'),_0x0ceb('0x78'),_0x0ceb('0x79'),_0x0ceb('0x7a')];if(_0x5efd29){_[_0x0ceb('0x7b')](_0x5efd29['fields'],function(_0x186e45){return _0x147f95[_0x0ceb('0x7c')](_0x186e45[_0x0ceb('0x34')])||!_0x271056[_0x0ceb('0x7c')](_0x186e45[_0x0ceb('0x39')]);});return{'count':_0x5efd29[_0x0ceb('0x40')]['length'],'rows':_[_0x0ceb('0x36')](_0x5efd29[_0x0ceb('0x40')],function(_0x337ddf){return{'id':_0x337ddf[_0x0ceb('0x34')],'name':_0x337ddf[_0x0ceb('0x7d')],'custom':_0x337ddf[_0x0ceb('0x7e')],'options':_0x337ddf['picklistValues'][_0x0ceb('0x41')]>0x0?_[_0x0ceb('0x36')](_0x337ddf[_0x0ceb('0x7f')],function(_0x3009dc){return{'name':_0x3009dc[_0x0ceb('0x7d')],'value':_0x3009dc['value']};}):_0x337ddf[_0x0ceb('0x39')]=='boolean'?[{'name':_0x0ceb('0x80'),'value':_0x0ceb('0x81')},{'name':_0x0ceb('0x82'),'value':_0x0ceb('0x83')}]:[]};})};}})[_0x0ceb('0x19')](respondWithResult(_0x35c39f,null))[_0x0ceb('0x24')](function(_0x2084a9){var _0x973586=_0x5839d8[_0x0ceb('0x3b')]['test']?0x1f4:_0x2084a9[_0x0ceb('0x84')]||0x1f4;logger[_0x0ceb('0x20')](_0x0ceb('0x85'),_0x0ceb('0x86'),_0x973586,JSON[_0x0ceb('0x1f')](_0x2084a9));delete _0x2084a9['name'];if(_0x973586===0x191){_0x973586=0x190;}_0x35c39f[_0x0ceb('0x25')](_0x973586)[_0x0ceb('0x35')](_0x5839d8['query']['test']?{'message':_0x0ceb('0x87'),'statusCode':_0x2084a9[_0x0ceb('0x84')]}:_0x2084a9);});}; \ No newline at end of file +var _0x4ad3=['getFields','remoteUri','clientId','username','securityToken','slice','substring','lastIndexOf','Connection','clientSecret','login','password','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsRecurrence','string','int','picklist','boolean','email','textarea','remove','includes','label','custom','picklistValues','value','True','true','False','false','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','offset','undefined','count','limit','set','Content-Range','save','end','stack','name','send','index','map','SalesforceAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','filter','options','includeAll','include','params','find','body','update','destroy','getConfigurations','findOne','SalesforceConfiguration','order','Subjects','getSubjects','getDescriptions','channel','create','SalesforceField','Descriptions'];(function(_0x44f286,_0x48bd5a){var _0x2b0f49=function(_0x5248d0){while(--_0x5248d0){_0x44f286['push'](_0x44f286['shift']());}};_0x2b0f49(++_0x48bd5a);}(_0x4ad3,0x1b1));var _0x34ad=function(_0x33e613,_0x2e55f0){_0x33e613=_0x33e613-0x0;var _0x421c4b=_0x4ad3[_0x33e613];return _0x421c4b;};'use strict';var emlformat=require(_0x34ad('0x0'));var rimraf=require(_0x34ad('0x1'));var zipdir=require(_0x34ad('0x2'));var jsonpatch=require(_0x34ad('0x3'));var rp=require(_0x34ad('0x4'));var moment=require(_0x34ad('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x34ad('0x6'));var util=require(_0x34ad('0x7'));var path=require(_0x34ad('0x8'));var sox=require(_0x34ad('0x9'));var csv=require(_0x34ad('0xa'));var ejs=require(_0x34ad('0xb'));var fs=require('fs');var fs_extra=require(_0x34ad('0xc'));var _=require(_0x34ad('0xd'));var squel=require(_0x34ad('0xe'));var crypto=require(_0x34ad('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x34ad('0xa'));var querystring=require(_0x34ad('0x10'));var Papa=require(_0x34ad('0x11'));var Redis=require(_0x34ad('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x34ad('0x13'));var as=require(_0x34ad('0x14'));var hardwareService=require(_0x34ad('0x15'));var logger=require(_0x34ad('0x16'))(_0x34ad('0x17'));var utils=require(_0x34ad('0x18'));var config=require(_0x34ad('0x19'));var licenseUtil=require(_0x34ad('0x1a'));var db=require(_0x34ad('0x1b'))['db'];var integrations=require(_0x34ad('0x1c'));var jayson=require(_0x34ad('0x1d'));var client=jayson[_0x34ad('0x1e')][_0x34ad('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x35192d,_0x20d8ba,_0xc64e62,_0x558097){return new BPromise(function(_0x4764e9,_0x5d166b){var _0x2c3a38=_0x558097||client;return _0x2c3a38['request'](_0x35192d,_0xc64e62)[_0x34ad('0x20')](function(_0x262123){logger[_0x34ad('0x21')](_0x34ad('0x22'),_0x20d8ba,_0x34ad('0x23'));logger['debug'](_0x34ad('0x24'),_0x20d8ba,'request\x20sent',JSON[_0x34ad('0x25')](_0x262123));if(_0x262123[_0x34ad('0x26')]){if(_0x262123[_0x34ad('0x26')][_0x34ad('0x27')]===0x1f4){logger[_0x34ad('0x26')]('SalesforceAccount,\x20%s,\x20%s',_0x20d8ba,_0x262123[_0x34ad('0x26')][_0x34ad('0x28')]);return _0x5d166b(_0x262123[_0x34ad('0x26')][_0x34ad('0x28')]);}logger[_0x34ad('0x26')](_0x34ad('0x22'),_0x20d8ba,_0x262123[_0x34ad('0x26')][_0x34ad('0x28')]);return _0x4764e9(_0x262123[_0x34ad('0x26')]['message']);}else{logger[_0x34ad('0x21')]('SalesforceAccount,\x20%s,\x20%s',_0x20d8ba,_0x34ad('0x23'));_0x4764e9(_0x262123['result'][_0x34ad('0x28')]);}})[_0x34ad('0x29')](function(_0x418dea){logger[_0x34ad('0x26')](_0x34ad('0x22'),_0x20d8ba,_0x418dea);_0x5d166b(_0x418dea);});});}function respondWithStatusCode(_0x4a06a7,_0x5a8379){_0x5a8379=_0x5a8379||0xcc;return function(_0x3a8418){if(_0x3a8418){return _0x4a06a7['sendStatus'](_0x5a8379);}return _0x4a06a7[_0x34ad('0x2a')](_0x5a8379)['end']();};}function respondWithResult(_0x5d5495,_0x34d2ae){_0x34d2ae=_0x34d2ae||0xc8;return function(_0x3df4ca){if(_0x3df4ca){return _0x5d5495[_0x34ad('0x2a')](_0x34d2ae)[_0x34ad('0x2b')](_0x3df4ca);}};}function respondWithFilteredResult(_0x17fc51,_0x320b6a){return function(_0x158aa7){if(_0x158aa7){var _0x3b7ac5=typeof _0x320b6a[_0x34ad('0x2c')]===_0x34ad('0x2d')&&typeof _0x320b6a['limit']===_0x34ad('0x2d');var _0x25316a=_0x158aa7[_0x34ad('0x2e')];var _0x31b880=_0x3b7ac5?0x0:_0x320b6a[_0x34ad('0x2c')];var _0x1b2387=_0x3b7ac5?_0x158aa7[_0x34ad('0x2e')]:_0x320b6a[_0x34ad('0x2c')]+_0x320b6a[_0x34ad('0x2f')];var _0x27d9fe;if(_0x1b2387>=_0x25316a){_0x1b2387=_0x25316a;_0x27d9fe=0xc8;}else{_0x27d9fe=0xce;}_0x17fc51[_0x34ad('0x2a')](_0x27d9fe);return _0x17fc51[_0x34ad('0x30')](_0x34ad('0x31'),_0x31b880+'-'+_0x1b2387+'/'+_0x25316a)[_0x34ad('0x2b')](_0x158aa7);}return null;};}function patchUpdates(_0x603161){return function(_0x14be3a){try{jsonpatch['apply'](_0x14be3a,_0x603161,!![]);}catch(_0xc5bd61){return BPromise['reject'](_0xc5bd61);}return _0x14be3a[_0x34ad('0x32')]();};}function saveUpdates(_0xedd677,_0x41c1da){return function(_0x3750a8){if(_0x3750a8){return _0x3750a8['update'](_0xedd677)[_0x34ad('0x20')](function(_0x7c5854){return _0x7c5854;});}return null;};}function removeEntity(_0x418efd,_0x1c3f90){return function(_0x5e0a29){if(_0x5e0a29){return _0x5e0a29['destroy']()['then'](function(){_0x418efd[_0x34ad('0x2a')](0xcc)[_0x34ad('0x33')]();});}};}function handleEntityNotFound(_0x1f5d90,_0x4d7260){return function(_0x3fbf7d){if(!_0x3fbf7d){_0x1f5d90['sendStatus'](0x194);}return _0x3fbf7d;};}function handleError(_0x3a6efe,_0xe8eb43){_0xe8eb43=_0xe8eb43||0x1f4;return function(_0x27f873){logger[_0x34ad('0x26')](_0x27f873[_0x34ad('0x34')]);if(_0x27f873[_0x34ad('0x35')]){delete _0x27f873[_0x34ad('0x35')];}_0x3a6efe[_0x34ad('0x2a')](_0xe8eb43)[_0x34ad('0x36')](_0x27f873);};}exports[_0x34ad('0x37')]=function(_0x437930,_0x30bec3){var _0x3b518f={},_0x206d13={},_0x1302db={'count':0x0,'rows':[]};var _0x2d5d28=_[_0x34ad('0x38')](db[_0x34ad('0x39')][_0x34ad('0x3a')],function(_0x1a5bbe){return{'name':_0x1a5bbe['fieldName'],'type':_0x1a5bbe['type'][_0x34ad('0x3b')]};});_0x206d13[_0x34ad('0x3c')]=_[_0x34ad('0x38')](_0x2d5d28,_0x34ad('0x35'));_0x206d13[_0x34ad('0x3d')]=_[_0x34ad('0x3e')](_0x437930[_0x34ad('0x3d')]);_0x206d13[_0x34ad('0x3f')]=_[_0x34ad('0x40')](_0x206d13[_0x34ad('0x3c')],_0x206d13['query']);_0x3b518f[_0x34ad('0x41')]=_[_0x34ad('0x40')](_0x206d13[_0x34ad('0x3c')],qs[_0x34ad('0x42')](_0x437930[_0x34ad('0x3d')][_0x34ad('0x42')]));_0x3b518f[_0x34ad('0x41')]=_0x3b518f[_0x34ad('0x41')][_0x34ad('0x43')]?_0x3b518f['attributes']:_0x206d13[_0x34ad('0x3c')];if(!_0x437930['query'][_0x34ad('0x44')](_0x34ad('0x45'))){_0x3b518f[_0x34ad('0x2f')]=qs[_0x34ad('0x2f')](_0x437930[_0x34ad('0x3d')][_0x34ad('0x2f')]);_0x3b518f['offset']=qs[_0x34ad('0x2c')](_0x437930['query'][_0x34ad('0x2c')]);}_0x3b518f['order']=qs['sort'](_0x437930[_0x34ad('0x3d')][_0x34ad('0x46')]);_0x3b518f[_0x34ad('0x47')]=qs['filters'](_[_0x34ad('0x48')](_0x437930[_0x34ad('0x3d')],_0x206d13[_0x34ad('0x3f')]),_0x2d5d28);if(_0x437930['query']['filter']){_0x3b518f[_0x34ad('0x47')]=_[_0x34ad('0x49')](_0x3b518f['where'],{'$or':_[_0x34ad('0x38')](_0x2d5d28,function(_0x2a0261){if(_0x2a0261[_0x34ad('0x4a')]!=='VIRTUAL'){var _0x47b23e={};_0x47b23e[_0x2a0261[_0x34ad('0x35')]]={'$like':'%'+_0x437930[_0x34ad('0x3d')][_0x34ad('0x4b')]+'%'};return _0x47b23e;}})});}_0x3b518f=_[_0x34ad('0x49')]({},_0x3b518f,_0x437930[_0x34ad('0x4c')]);var _0x1f2d6a={'where':_0x3b518f['where']};return db[_0x34ad('0x39')][_0x34ad('0x2e')](_0x1f2d6a)['then'](function(_0x118dea){_0x1302db[_0x34ad('0x2e')]=_0x118dea;if(_0x437930[_0x34ad('0x3d')][_0x34ad('0x4d')]){_0x3b518f[_0x34ad('0x4e')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x3b518f);})[_0x34ad('0x20')](function(_0x402cb6){_0x1302db['rows']=_0x402cb6;return _0x1302db;})['then'](respondWithFilteredResult(_0x30bec3,_0x3b518f))[_0x34ad('0x29')](handleError(_0x30bec3,null));};exports['show']=function(_0xd23555,_0x28ca13){var _0x287401={'raw':![],'where':{'id':_0xd23555[_0x34ad('0x4f')]['id']}},_0x5a3ef5={};_0x5a3ef5[_0x34ad('0x3c')]=_['keys'](db['SalesforceAccount']['rawAttributes']);_0x5a3ef5['query']=_[_0x34ad('0x3e')](_0xd23555[_0x34ad('0x3d')]);_0x5a3ef5[_0x34ad('0x3f')]=_[_0x34ad('0x40')](_0x5a3ef5['model'],_0x5a3ef5[_0x34ad('0x3d')]);_0x287401[_0x34ad('0x41')]=_['intersection'](_0x5a3ef5['model'],qs[_0x34ad('0x42')](_0xd23555[_0x34ad('0x3d')][_0x34ad('0x42')]));_0x287401[_0x34ad('0x41')]=_0x287401[_0x34ad('0x41')][_0x34ad('0x43')]?_0x287401['attributes']:_0x5a3ef5[_0x34ad('0x3c')];if(_0xd23555[_0x34ad('0x3d')]['includeAll']){_0x287401[_0x34ad('0x4e')]=[{'all':!![]}];}_0x287401=_['merge']({},_0x287401,_0xd23555['options']);return db[_0x34ad('0x39')][_0x34ad('0x50')](_0x287401)[_0x34ad('0x20')](handleEntityNotFound(_0x28ca13,null))['then'](respondWithResult(_0x28ca13,null))[_0x34ad('0x29')](handleError(_0x28ca13,null));};exports['create']=function(_0x3556a2,_0x22ecbd){return db[_0x34ad('0x39')]['create'](_0x3556a2[_0x34ad('0x51')],{})[_0x34ad('0x20')](respondWithResult(_0x22ecbd,0xc9))[_0x34ad('0x29')](handleError(_0x22ecbd,null));};exports[_0x34ad('0x52')]=function(_0x1c7c78,_0x11c10e){if(_0x1c7c78[_0x34ad('0x51')]['id']){delete _0x1c7c78[_0x34ad('0x51')]['id'];}return db[_0x34ad('0x39')]['find']({'where':{'id':_0x1c7c78[_0x34ad('0x4f')]['id']}})[_0x34ad('0x20')](handleEntityNotFound(_0x11c10e,null))[_0x34ad('0x20')](saveUpdates(_0x1c7c78[_0x34ad('0x51')],null))[_0x34ad('0x20')](respondWithResult(_0x11c10e,null))[_0x34ad('0x29')](handleError(_0x11c10e,null));};exports[_0x34ad('0x53')]=function(_0x15d671,_0x2dd5c5){return db[_0x34ad('0x39')][_0x34ad('0x50')]({'where':{'id':_0x15d671[_0x34ad('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2dd5c5,null))[_0x34ad('0x20')](removeEntity(_0x2dd5c5,null))[_0x34ad('0x29')](handleError(_0x2dd5c5,null));};exports[_0x34ad('0x54')]=function(_0xf9815a,_0x114904,_0x4e1ae1){var _0x13c8a1={};var _0x5d898e={};var _0x1611bb;var _0x33ef0f;return db['SalesforceAccount'][_0x34ad('0x55')]({'where':{'id':_0xf9815a[_0x34ad('0x4f')]['id']}})[_0x34ad('0x20')](handleEntityNotFound(_0x114904,null))[_0x34ad('0x20')](function(_0x178429){if(_0x178429){_0x1611bb=_0x178429;_0x5d898e[_0x34ad('0x3c')]=_['keys'](db[_0x34ad('0x56')][_0x34ad('0x3a')]);_0x5d898e[_0x34ad('0x3d')]=_['keys'](_0xf9815a[_0x34ad('0x3d')]);_0x5d898e[_0x34ad('0x3f')]=_[_0x34ad('0x40')](_0x5d898e[_0x34ad('0x3c')],_0x5d898e[_0x34ad('0x3d')]);_0x13c8a1['attributes']=_[_0x34ad('0x40')](_0x5d898e[_0x34ad('0x3c')],qs['fields'](_0xf9815a['query'][_0x34ad('0x42')]));_0x13c8a1['attributes']=_0x13c8a1[_0x34ad('0x41')][_0x34ad('0x43')]?_0x13c8a1[_0x34ad('0x41')]:_0x5d898e[_0x34ad('0x3c')];_0x13c8a1[_0x34ad('0x57')]=qs[_0x34ad('0x46')](_0xf9815a[_0x34ad('0x3d')][_0x34ad('0x46')]);_0x13c8a1[_0x34ad('0x47')]=qs[_0x34ad('0x3f')](_['pick'](_0xf9815a[_0x34ad('0x3d')],_0x5d898e[_0x34ad('0x3f')]));if(_0xf9815a[_0x34ad('0x3d')]['filter']){_0x13c8a1[_0x34ad('0x47')]=_[_0x34ad('0x49')](_0x13c8a1['where'],{'$or':_[_0x34ad('0x38')](_0x13c8a1['attributes'],function(_0x32ecee){var _0x23ca57={};_0x23ca57[_0x32ecee]={'$like':'%'+_0xf9815a[_0x34ad('0x3d')][_0x34ad('0x4b')]+'%'};return _0x23ca57;})});}_0x13c8a1=_[_0x34ad('0x49')]({},_0x13c8a1,_0xf9815a[_0x34ad('0x4c')]);return _0x1611bb[_0x34ad('0x54')](_0x13c8a1);}})['then'](function(_0x187cf6){if(_0x187cf6){_0x33ef0f=_0x187cf6[_0x34ad('0x43')];if(!_0xf9815a[_0x34ad('0x3d')][_0x34ad('0x44')](_0x34ad('0x45'))){_0x13c8a1['limit']=qs[_0x34ad('0x2f')](_0xf9815a['query']['limit']);_0x13c8a1[_0x34ad('0x2c')]=qs[_0x34ad('0x2c')](_0xf9815a[_0x34ad('0x3d')]['offset']);}return _0x1611bb['getConfigurations'](_0x13c8a1);}})['then'](function(_0x2caa7e){if(_0x2caa7e){return _0x2caa7e?{'count':_0x33ef0f,'rows':_0x2caa7e}:null;}})[_0x34ad('0x20')](respondWithResult(_0x114904,null))[_0x34ad('0x29')](handleError(_0x114904,null));};exports['addConfiguration']=function(_0x4e7009,_0x2c9cc8,_0x972c0b){if(_0x4e7009[_0x34ad('0x51')]['id']){delete _0x4e7009['body']['id'];}return db['SalesforceAccount'][_0x34ad('0x55')]({'where':{'id':_0x4e7009[_0x34ad('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2c9cc8,null))[_0x34ad('0x20')](function(_0x4aee60){if(_0x4aee60){_0x4e7009['body']['AccountId']=_0x4aee60['id'];_0x4e7009['body'][_0x34ad('0x58')]=integrations[_0x34ad('0x59')](_0x4e7009[_0x34ad('0x51')]['channel'],_0x4e7009[_0x34ad('0x51')][_0x34ad('0x4a')]);_0x4e7009[_0x34ad('0x51')]['Descriptions']=integrations[_0x34ad('0x5a')](_0x4e7009['body'][_0x34ad('0x5b')],_0x4e7009[_0x34ad('0x51')][_0x34ad('0x4a')]);return db['SalesforceConfiguration'][_0x34ad('0x5c')](_0x4e7009[_0x34ad('0x51')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x34ad('0x5d')],'as':_0x34ad('0x5e')}]});}return null;})['then'](respondWithResult(_0x2c9cc8,null))[_0x34ad('0x29')](handleError(_0x2c9cc8,null));};exports[_0x34ad('0x5f')]=function(_0x98784,_0x41901a,_0x8f736d){var _0x598b;var _0x1739b8='';var _0x49a3aa='Task';return db[_0x34ad('0x39')][_0x34ad('0x55')]({'where':{'id':_0x98784[_0x34ad('0x4f')]['id']},'attributes':['id',_0x34ad('0x60'),_0x34ad('0x61'),'clientSecret',_0x34ad('0x62'),'password',_0x34ad('0x63')]})[_0x34ad('0x20')](handleEntityNotFound(_0x41901a,null))[_0x34ad('0x20')](function(_0x25841b){if(_0x25841b){_0x1739b8=_0x25841b[_0x34ad('0x60')];var _0x30adcb=_0x1739b8[_0x34ad('0x64')](-0x1);if(_0x30adcb==='/'){_0x1739b8=_0x1739b8[_0x34ad('0x65')](0x0,_0x1739b8[_0x34ad('0x66')](_0x30adcb));}_0x598b=new jsforce[(_0x34ad('0x67'))]({'oauth2':{'loginUrl':_0x1739b8,'clientId':_0x25841b[_0x34ad('0x61')],'clientSecret':_0x25841b[_0x34ad('0x68')]}});return _0x598b[_0x34ad('0x69')](_0x25841b[_0x34ad('0x62')],_0x25841b[_0x34ad('0x6a')]['concat'](_0x25841b[_0x34ad('0x63')]));}})['then'](function(_0x51abf2){if(_0x51abf2){if(!_[_0x34ad('0x6b')](_0x98784[_0x34ad('0x3d')][_0x34ad('0x6c')])){_0x49a3aa=_0x98784[_0x34ad('0x3d')][_0x34ad('0x6c')];}return _0x598b[_0x34ad('0x6d')](_0x49a3aa)[_0x34ad('0x6e')]();}})[_0x34ad('0x20')](function(_0x1acb1b){var _0xb0c8ba=[_0x34ad('0x6f'),_0x34ad('0x70'),'IsReminderSet',_0x34ad('0x71'),'Subject','Description'];var _0x12a48e=[_0x34ad('0x72'),_0x34ad('0x73'),_0x34ad('0x74'),_0x34ad('0x75'),_0x34ad('0x76'),_0x34ad('0x77'),'phone'];if(_0x1acb1b){_[_0x34ad('0x78')](_0x1acb1b['fields'],function(_0x4be3d5){return _0xb0c8ba[_0x34ad('0x79')](_0x4be3d5['name'])||!_0x12a48e['includes'](_0x4be3d5[_0x34ad('0x4a')]);});return{'count':_0x1acb1b[_0x34ad('0x42')][_0x34ad('0x43')],'rows':_[_0x34ad('0x38')](_0x1acb1b[_0x34ad('0x42')],function(_0x55c7f3){return{'id':_0x55c7f3[_0x34ad('0x35')],'name':_0x55c7f3[_0x34ad('0x7a')],'custom':_0x55c7f3[_0x34ad('0x7b')],'options':_0x55c7f3[_0x34ad('0x7c')][_0x34ad('0x43')]>0x0?_[_0x34ad('0x38')](_0x55c7f3['picklistValues'],function(_0x44613f){return{'name':_0x44613f['label'],'value':_0x44613f[_0x34ad('0x7d')]};}):_0x55c7f3[_0x34ad('0x4a')]=='boolean'?[{'name':_0x34ad('0x7e'),'value':_0x34ad('0x7f')},{'name':_0x34ad('0x80'),'value':_0x34ad('0x81')}]:[]};})};}})[_0x34ad('0x20')](respondWithResult(_0x41901a,null))['catch'](function(_0x595f4b){var _0x5c2d71=_0x98784[_0x34ad('0x3d')]['test']?0x1f4:_0x595f4b['statusCode']||0x1f4;logger[_0x34ad('0x26')](_0x34ad('0x82'),_0x34ad('0x5f'),_0x5c2d71,JSON[_0x34ad('0x25')](_0x595f4b));delete _0x595f4b[_0x34ad('0x35')];if(_0x5c2d71===0x191){_0x5c2d71=0x190;}_0x41901a[_0x34ad('0x2a')](_0x5c2d71)[_0x34ad('0x36')](_0x98784[_0x34ad('0x3d')]['test']?{'message':_0x34ad('0x83'),'statusCode':_0x595f4b['statusCode']}:_0x595f4b);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 307e3ce..6161517 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 _0x83af=['./intSalesforceAccount.attributes','exports','define','int_salesforce_accounts','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x1491f8,_0x27e0a5){var _0x4dfb6a=function(_0x3f7f89){while(--_0x3f7f89){_0x1491f8['push'](_0x1491f8['shift']());}};_0x4dfb6a(++_0x27e0a5);}(_0x83af,0x1dd));var _0xf83a=function(_0x4ffc34,_0x5db65f){_0x4ffc34=_0x4ffc34-0x0;var _0x46b4df=_0x83af[_0x4ffc34];return _0x46b4df;};'use strict';var _=require(_0xf83a('0x0'));var util=require('util');var logger=require(_0xf83a('0x1'))(_0xf83a('0x2'));var moment=require(_0xf83a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf83a('0x4'));var rimraf=require(_0xf83a('0x5'));var config=require(_0xf83a('0x6'));var attributes=require(_0xf83a('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xf83a('0x8')]=function(_0x4f04c0,_0x47fc0d){return _0x4f04c0[_0xf83a('0x9')]('SalesforceAccount',attributes,{'tableName':_0xf83a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc497=['define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x421791,_0x3625d8){var _0x495838=function(_0x5190c3){while(--_0x5190c3){_0x421791['push'](_0x421791['shift']());}};_0x495838(++_0x3625d8);}(_0xc497,0x81));var _0x7c49=function(_0x3f4488,_0x614e80){_0x3f4488=_0x3f4488-0x0;var _0x2db4cd=_0xc497[_0x3f4488];return _0x2db4cd;};'use strict';var _=require(_0x7c49('0x0'));var util=require(_0x7c49('0x1'));var logger=require(_0x7c49('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7c49('0x3'));var rp=require(_0x7c49('0x4'));var fs=require('fs');var path=require(_0x7c49('0x5'));var rimraf=require(_0x7c49('0x6'));var config=require(_0x7c49('0x7'));var attributes=require(_0x7c49('0x8'));var integrations=require(_0x7c49('0x9'));module[_0x7c49('0xa')]=function(_0x449e9d,_0x3cc1fd){return _0x449e9d[_0x7c49('0xb')](_0x7c49('0xc'),attributes,{'tableName':_0x7c49('0xd'),'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 623c7a3..cc2c9b3 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 _0xf021=['GetSalesforceAccount','ShowSalesforceAccount','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','then','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','SalesforceAccount,\x20%s,\x20%s','result','catch','SalesforceAccount','findAll','options','where','attributes','limit','include','map','model'];(function(_0x21af97,_0x28a291){var _0x1cf50b=function(_0x3ce476){while(--_0x3ce476){_0x21af97['push'](_0x21af97['shift']());}};_0x1cf50b(++_0x28a291);}(_0xf021,0x18f));var _0x1f02=function(_0x13bcbb,_0x2eb915){_0x13bcbb=_0x13bcbb-0x0;var _0x457c81=_0xf021[_0x13bcbb];return _0x457c81;};'use strict';var _=require(_0x1f02('0x0'));var util=require(_0x1f02('0x1'));var moment=require(_0x1f02('0x2'));var BPromise=require(_0x1f02('0x3'));var rs=require(_0x1f02('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f02('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f02('0x6'))(_0x1f02('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1f02('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x383d0b,_0x257d6a,_0x2a6c50){return new BPromise(function(_0x4193d2,_0x1f1cec){return client['request'](_0x383d0b,_0x2a6c50)[_0x1f02('0x9')](function(_0x5dc295){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x257d6a,_0x1f02('0xa'));logger[_0x1f02('0xb')](_0x1f02('0xc'),_0x257d6a,_0x1f02('0xa'),JSON[_0x1f02('0xd')](_0x5dc295));if(_0x5dc295['error']){if(_0x5dc295[_0x1f02('0xe')][_0x1f02('0xf')]===0x1f4){logger[_0x1f02('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x257d6a,_0x5dc295[_0x1f02('0xe')][_0x1f02('0x10')]);return _0x1f1cec(_0x5dc295[_0x1f02('0xe')]['message']);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x257d6a,_0x5dc295[_0x1f02('0xe')][_0x1f02('0x10')]);return _0x4193d2(_0x5dc295[_0x1f02('0xe')][_0x1f02('0x10')]);}else{logger[_0x1f02('0x11')](_0x1f02('0x12'),_0x257d6a,_0x1f02('0xa'));_0x4193d2(_0x5dc295[_0x1f02('0x13')]['message']);}})[_0x1f02('0x14')](function(_0x5cca16){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x257d6a,_0x5cca16);_0x1f1cec(_0x5cca16);});});}exports['GetSalesforceAccount']=function(_0x4d1e4f){var _0x2cd7db=this;return new Promise(function(_0x3033a2,_0x5f1f30){return db[_0x1f02('0x15')][_0x1f02('0x16')]({'raw':_0x4d1e4f[_0x1f02('0x17')]?_0x4d1e4f[_0x1f02('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4d1e4f['options']?_0x4d1e4f[_0x1f02('0x17')][_0x1f02('0x18')]||null:null,'attributes':_0x4d1e4f['options']?_0x4d1e4f['options'][_0x1f02('0x19')]||null:null,'limit':_0x4d1e4f[_0x1f02('0x17')]?_0x4d1e4f[_0x1f02('0x17')][_0x1f02('0x1a')]||null:null,'include':_0x4d1e4f['options']?_0x4d1e4f[_0x1f02('0x17')][_0x1f02('0x1b')]?_[_0x1f02('0x1c')](_0x4d1e4f[_0x1f02('0x17')][_0x1f02('0x1b')],function(_0x134398){return{'model':db[_0x134398[_0x1f02('0x1d')]],'as':_0x134398['as'],'attributes':_0x134398['attributes'],'include':_0x134398[_0x1f02('0x1b')]?_[_0x1f02('0x1c')](_0x134398['include'],function(_0x25a8d1){return{'model':db[_0x25a8d1[_0x1f02('0x1d')]],'as':_0x25a8d1['as'],'attributes':_0x25a8d1['attributes'],'include':_0x25a8d1['include']?_[_0x1f02('0x1c')](_0x25a8d1[_0x1f02('0x1b')],function(_0x3c3fda){return{'model':db[_0x3c3fda[_0x1f02('0x1d')]],'as':_0x3c3fda['as'],'attributes':_0x3c3fda[_0x1f02('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1f02('0x9')](function(_0x297cf4){logger['info']('GetSalesforceAccount',_0x4d1e4f);logger['debug'](_0x1f02('0x1e'),_0x4d1e4f,JSON[_0x1f02('0xd')](_0x297cf4));_0x3033a2(_0x297cf4);})[_0x1f02('0x14')](function(_0x496afd){logger['error'](_0x1f02('0x1e'),_0x496afd[_0x1f02('0x10')],_0x4d1e4f);_0x5f1f30(_0x2cd7db[_0x1f02('0xe')](0x1f4,_0x496afd[_0x1f02('0x10')]));});});};exports[_0x1f02('0x1f')]=function(_0x3080a6){var _0x442333=this;return new Promise(function(_0x23fa22,_0x1c2a0d){return db[_0x1f02('0x15')]['find']({'raw':_0x3080a6[_0x1f02('0x17')]?_0x3080a6['options'][_0x1f02('0x20')]===undefined?!![]:![]:!![],'where':_0x3080a6[_0x1f02('0x17')]?_0x3080a6[_0x1f02('0x17')][_0x1f02('0x18')]||null:null,'attributes':_0x3080a6[_0x1f02('0x17')]?_0x3080a6[_0x1f02('0x17')]['attributes']||null:null,'include':_0x3080a6['options']?_0x3080a6[_0x1f02('0x17')][_0x1f02('0x1b')]?_['map'](_0x3080a6[_0x1f02('0x17')]['include'],function(_0x34b0d2){return{'model':db[_0x34b0d2['model']],'as':_0x34b0d2['as'],'attributes':_0x34b0d2[_0x1f02('0x19')],'include':_0x34b0d2['include']?_['map'](_0x34b0d2[_0x1f02('0x1b')],function(_0x2dac47){return{'model':db[_0x2dac47[_0x1f02('0x1d')]],'as':_0x2dac47['as'],'attributes':_0x2dac47[_0x1f02('0x19')],'include':_0x2dac47['include']?_[_0x1f02('0x1c')](_0x2dac47[_0x1f02('0x1b')],function(_0x23e825){return{'model':db[_0x23e825['model']],'as':_0x23e825['as'],'attributes':_0x23e825[_0x1f02('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1f02('0x9')](function(_0x2a82fa){logger[_0x1f02('0x11')](_0x1f02('0x1f'),_0x3080a6);logger[_0x1f02('0xb')]('ShowSalesforceAccount',_0x3080a6,JSON[_0x1f02('0xd')](_0x2a82fa));_0x23fa22(_0x2a82fa);})[_0x1f02('0x14')](function(_0x1ad162){logger['error'](_0x1f02('0x1f'),_0x1ad162['message'],_0x3080a6);_0x1c2a0d(_0x442333[_0x1f02('0xe')](0x1f4,_0x1ad162['message']));});});}; \ No newline at end of file +var _0xe205=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','include','map','model','attributes','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xe205,0xa7));var _0x5e20=function(_0x2b8691,_0x3db6b9){_0x2b8691=_0x2b8691-0x0;var _0x4045ea=_0xe205[_0x2b8691];return _0x4045ea;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var moment=require(_0x5e20('0x2'));var BPromise=require(_0x5e20('0x3'));var rs=require(_0x5e20('0x4'));var fs=require('fs');var Redis=require(_0x5e20('0x5'));var db=require(_0x5e20('0x6'))['db'];var utils=require(_0x5e20('0x7'));var logger=require(_0x5e20('0x8'))('rpc');var config=require(_0x5e20('0x9'));var jayson=require(_0x5e20('0xa'));var client=jayson[_0x5e20('0xb')][_0x5e20('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5eca5c,_0x4cc88d,_0x3a382f){return new BPromise(function(_0x4c9332,_0x533e18){return client[_0x5e20('0xd')](_0x5eca5c,_0x3a382f)[_0x5e20('0xe')](function(_0x5c1eee){logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));logger[_0x5e20('0x12')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x4cc88d,_0x5e20('0x11'),JSON[_0x5e20('0x13')](_0x5c1eee));if(_0x5c1eee[_0x5e20('0x14')]){if(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x15')]===0x1f4){logger[_0x5e20('0x14')]('SalesforceAccount,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);return _0x533e18(_0x5c1eee[_0x5e20('0x14')]['message']);}logger[_0x5e20('0x14')]('SalesforceAccount,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')]['message']);return _0x4c9332(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);}else{logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));_0x4c9332(_0x5c1eee['result'][_0x5e20('0x16')]);}})[_0x5e20('0x17')](function(_0x166ffd){logger[_0x5e20('0x14')](_0x5e20('0x10'),_0x4cc88d,_0x166ffd);_0x533e18(_0x166ffd);});});}exports[_0x5e20('0x18')]=function(_0x1cc706){var _0xf3488f=this;return new Promise(function(_0x4d3e4a,_0x434686){return db[_0x5e20('0x19')]['findAll']({'raw':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1b')]===undefined?!![]:![]:!![],'where':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706['options'][_0x5e20('0x1c')]||null:null,'attributes':_0x1cc706['options']?_0x1cc706['options']['attributes']||null:null,'limit':_0x1cc706['options']?_0x1cc706[_0x5e20('0x1a')]['limit']||null:null,'include':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1d')],function(_0x4c5732){return{'model':db[_0x4c5732[_0x5e20('0x1f')]],'as':_0x4c5732['as'],'attributes':_0x4c5732['attributes'],'include':_0x4c5732['include']?_[_0x5e20('0x1e')](_0x4c5732[_0x5e20('0x1d')],function(_0x2bae08){return{'model':db[_0x2bae08[_0x5e20('0x1f')]],'as':_0x2bae08['as'],'attributes':_0x2bae08[_0x5e20('0x20')],'include':_0x2bae08[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x2bae08['include'],function(_0x3bf4f4){return{'model':db[_0x3bf4f4[_0x5e20('0x1f')]],'as':_0x3bf4f4['as'],'attributes':_0x3bf4f4[_0x5e20('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5e20('0xe')](function(_0x4c799d){logger[_0x5e20('0xf')](_0x5e20('0x18'),_0x1cc706);logger[_0x5e20('0x12')](_0x5e20('0x18'),_0x1cc706,JSON[_0x5e20('0x13')](_0x4c799d));_0x4d3e4a(_0x4c799d);})[_0x5e20('0x17')](function(_0x5ec45b){logger[_0x5e20('0x14')](_0x5e20('0x18'),_0x5ec45b['message'],_0x1cc706);_0x434686(_0xf3488f[_0x5e20('0x14')](0x1f4,_0x5ec45b[_0x5e20('0x16')]));});});};exports[_0x5e20('0x21')]=function(_0x4196a3){var _0x1548c8=this;return new Promise(function(_0x395a27,_0x4ff715){return db[_0x5e20('0x19')][_0x5e20('0x22')]({'raw':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1b')]===undefined?!![]:![]:!![],'where':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1c')]||null:null,'attributes':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x20')]||null:null,'include':_0x4196a3['options']?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x4196a3['options'][_0x5e20('0x1d')],function(_0x2d397b){return{'model':db[_0x2d397b[_0x5e20('0x1f')]],'as':_0x2d397b['as'],'attributes':_0x2d397b[_0x5e20('0x20')],'include':_0x2d397b[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x2d397b[_0x5e20('0x1d')],function(_0x173165){return{'model':db[_0x173165[_0x5e20('0x1f')]],'as':_0x173165['as'],'attributes':_0x173165[_0x5e20('0x20')],'include':_0x173165[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x173165[_0x5e20('0x1d')],function(_0x255b67){return{'model':db[_0x255b67['model']],'as':_0x255b67['as'],'attributes':_0x255b67[_0x5e20('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x549f01){logger[_0x5e20('0xf')](_0x5e20('0x21'),_0x4196a3);logger['debug'](_0x5e20('0x21'),_0x4196a3,JSON[_0x5e20('0x13')](_0x549f01));_0x395a27(_0x549f01);})['catch'](function(_0x3f3908){logger[_0x5e20('0x14')](_0x5e20('0x21'),_0x3f3908[_0x5e20('0x16')],_0x4196a3);_0x4ff715(_0x1548c8[_0x5e20('0x14')](0x1f4,_0x3f3908[_0x5e20('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index ac897f3..6334c33 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 _0xbc5c=['index','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','multer','util','path','Router','fs-extra','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated'];(function(_0xb7fc1,_0x56f837){var _0x1f1713=function(_0x2cbfa1){while(--_0x2cbfa1){_0xb7fc1['push'](_0xb7fc1['shift']());}};_0x1f1713(++_0x56f837);}(_0xbc5c,0x11d));var _0xcbc5=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xbc5c[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0xcbc5('0x0'));var util=require(_0xcbc5('0x1'));var path=require(_0xcbc5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcbc5('0x3')]();var fs_extra=require(_0xcbc5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcbc5('0x5'));var controller=require(_0xcbc5('0x6'));router[_0xcbc5('0x7')]('/',auth[_0xcbc5('0x8')](),controller[_0xcbc5('0x9')]);router[_0xcbc5('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xcbc5('0x7')](_0xcbc5('0xa'),auth[_0xcbc5('0x8')](),controller[_0xcbc5('0xb')]);router[_0xcbc5('0x7')]('/:id/subjects',auth[_0xcbc5('0x8')](),controller['getSubjects']);router['get'](_0xcbc5('0xc'),auth[_0xcbc5('0x8')](),controller[_0xcbc5('0xd')]);router[_0xcbc5('0xe')]('/',auth[_0xcbc5('0x8')](),controller[_0xcbc5('0xf')]);router[_0xcbc5('0x10')](_0xcbc5('0x11'),auth[_0xcbc5('0x8')](),controller[_0xcbc5('0x12')]);router[_0xcbc5('0x13')](_0xcbc5('0x11'),auth['isAuthenticated'](),controller[_0xcbc5('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1ef0=['isAuthenticated','index','get','/:id','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','put','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller'];(function(_0x41cb6f,_0x236dba){var _0x540bde=function(_0x1ad6c8){while(--_0x1ad6c8){_0x41cb6f['push'](_0x41cb6f['shift']());}};_0x540bde(++_0x236dba);}(_0x1ef0,0x138));var _0x01ef=function(_0x2204ef,_0x10b4eb){_0x2204ef=_0x2204ef-0x0;var _0x4ac9f2=_0x1ef0[_0x2204ef];return _0x4ac9f2;};'use strict';var multer=require(_0x01ef('0x0'));var util=require(_0x01ef('0x1'));var path=require(_0x01ef('0x2'));var timeout=require(_0x01ef('0x3'));var express=require('express');var router=express[_0x01ef('0x4')]();var fs_extra=require(_0x01ef('0x5'));var auth=require(_0x01ef('0x6'));var interaction=require(_0x01ef('0x7'));var config=require(_0x01ef('0x8'));var controller=require(_0x01ef('0x9'));router['get']('/',auth[_0x01ef('0xa')](),controller[_0x01ef('0xb')]);router[_0x01ef('0xc')](_0x01ef('0xd'),auth[_0x01ef('0xa')](),controller['show']);router[_0x01ef('0xc')](_0x01ef('0xe'),auth[_0x01ef('0xa')](),controller['getFields']);router[_0x01ef('0xc')](_0x01ef('0xf'),auth[_0x01ef('0xa')](),controller[_0x01ef('0x10')]);router[_0x01ef('0xc')]('/:id/descriptions',auth[_0x01ef('0xa')](),controller[_0x01ef('0x11')]);router[_0x01ef('0x12')]('/',auth[_0x01ef('0xa')](),controller[_0x01ef('0x13')]);router[_0x01ef('0x14')](_0x01ef('0xd'),auth[_0x01ef('0xa')](),controller['update']);router[_0x01ef('0x15')](_0x01ef('0xd'),auth[_0x01ef('0xa')](),controller[_0x01ef('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 9723ce7..4f8ab72 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 _0xac90=['ENUM','nothing','contact','sequelize','exports','STRING','Task','contact_lead','lead','account_contact_lead','account'];(function(_0x4f5713,_0x469ee9){var _0x9ca19d=function(_0x12528b){while(--_0x12528b){_0x4f5713['push'](_0x4f5713['shift']());}};_0x9ca19d(++_0x469ee9);}(_0xac90,0x1b0));var _0x0ac9=function(_0x292895,_0x55d7a0){_0x292895=_0x292895-0x0;var _0x2b102e=_0xac90[_0x292895];return _0x2b102e;};'use strict';var Sequelize=require(_0x0ac9('0x0'));module[_0x0ac9('0x1')]={'name':{'type':Sequelize[_0x0ac9('0x2')]},'description':{'type':Sequelize[_0x0ac9('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x0ac9('0x3'),'Case'),'defaultValue':_0x0ac9('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x0ac9('0x4'),'contact',_0x0ac9('0x5'),_0x0ac9('0x6'),_0x0ac9('0x7')),'defaultValue':_0x0ac9('0x4')},'moduleCreate':{'type':Sequelize[_0x0ac9('0x8')](_0x0ac9('0x9'),_0x0ac9('0xa'),_0x0ac9('0x5'),'account'),'defaultValue':_0x0ac9('0x5')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x0ac9('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x0ac9('0x2')]}}; \ No newline at end of file +var _0x62d2=['exports','STRING','ENUM','Task','lead','account_contact_lead','account','contact_lead','sequelize'];(function(_0x1f10ff,_0x4d8a07){var _0x401eec=function(_0x3f9312){while(--_0x3f9312){_0x1f10ff['push'](_0x1f10ff['shift']());}};_0x401eec(++_0x4d8a07);}(_0x62d2,0xce));var _0x262d=function(_0x49fa98,_0x11accf){_0x49fa98=_0x49fa98-0x0;var _0x1698f1=_0x62d2[_0x49fa98];return _0x1698f1;};'use strict';var Sequelize=require(_0x262d('0x0'));module[_0x262d('0x1')]={'name':{'type':Sequelize[_0x262d('0x2')]},'description':{'type':Sequelize[_0x262d('0x2')]},'ticketType':{'type':Sequelize[_0x262d('0x3')](_0x262d('0x4'),'Case'),'defaultValue':_0x262d('0x4')},'moduleSearch':{'type':Sequelize[_0x262d('0x3')]('contact_lead','contact',_0x262d('0x5'),_0x262d('0x6'),_0x262d('0x7')),'defaultValue':_0x262d('0x8')},'moduleCreate':{'type':Sequelize[_0x262d('0x3')]('nothing','contact','lead',_0x262d('0x7')),'defaultValue':_0x262d('0x5')},'leadId':{'type':Sequelize[_0x262d('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x262d('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x262d('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index e4a94e6..746fe90 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 _0x6817=['findAll','rows','show','keys','include','merge','find','create','body','getFields','findOne','SalesforceField','pick','getSubjects','params','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','SalesforceConfiguration','includeAll'];(function(_0x20f3a3,_0xe879a){var _0x4ecd05=function(_0x353942){while(--_0x353942){_0x20f3a3['push'](_0x20f3a3['shift']());}};_0x4ecd05(++_0xe879a);}(_0x6817,0x1eb));var _0x7681=function(_0x2e6913,_0x5c275d){_0x2e6913=_0x2e6913-0x0;var _0x4129d9=_0x6817[_0x2e6913];return _0x4129d9;};'use strict';var emlformat=require(_0x7681('0x0'));var rimraf=require(_0x7681('0x1'));var zipdir=require(_0x7681('0x2'));var jsonpatch=require(_0x7681('0x3'));var rp=require('request-promise');var moment=require(_0x7681('0x4'));var BPromise=require(_0x7681('0x5'));var Mustache=require('mustache');var util=require(_0x7681('0x6'));var path=require(_0x7681('0x7'));var sox=require(_0x7681('0x8'));var csv=require(_0x7681('0x9'));var ejs=require(_0x7681('0xa'));var fs=require('fs');var fs_extra=require(_0x7681('0xb'));var _=require(_0x7681('0xc'));var squel=require(_0x7681('0xd'));var crypto=require(_0x7681('0xe'));var jsforce=require(_0x7681('0xf'));var deskjs=require(_0x7681('0x10'));var toCsv=require(_0x7681('0x9'));var querystring=require(_0x7681('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7681('0x12'));var qs=require(_0x7681('0x13'));var as=require(_0x7681('0x14'));var hardwareService=require(_0x7681('0x15'));var logger=require(_0x7681('0x16'))(_0x7681('0x17'));var utils=require(_0x7681('0x18'));var config=require(_0x7681('0x19'));var licenseUtil=require(_0x7681('0x1a'));var db=require(_0x7681('0x1b'))['db'];var jayson=require(_0x7681('0x1c'));var client=jayson[_0x7681('0x1d')][_0x7681('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x195542,_0x222bcd,_0x526345,_0x4d1813){return new BPromise(function(_0x3aa07e,_0x21aad0){var _0x1c045f=_0x4d1813||client;return _0x1c045f['request'](_0x195542,_0x526345)[_0x7681('0x1f')](function(_0x5a1555){logger[_0x7681('0x20')](_0x7681('0x21'),_0x222bcd,'request\x20sent');logger['debug'](_0x7681('0x22'),_0x222bcd,'request\x20sent',JSON[_0x7681('0x23')](_0x5a1555));if(_0x5a1555[_0x7681('0x24')]){if(_0x5a1555[_0x7681('0x24')]['code']===0x1f4){logger[_0x7681('0x24')](_0x7681('0x21'),_0x222bcd,_0x5a1555[_0x7681('0x24')][_0x7681('0x25')]);return _0x21aad0(_0x5a1555[_0x7681('0x24')][_0x7681('0x25')]);}logger[_0x7681('0x24')](_0x7681('0x21'),_0x222bcd,_0x5a1555[_0x7681('0x24')][_0x7681('0x25')]);return _0x3aa07e(_0x5a1555[_0x7681('0x24')][_0x7681('0x25')]);}else{logger[_0x7681('0x20')](_0x7681('0x21'),_0x222bcd,'request\x20sent');_0x3aa07e(_0x5a1555[_0x7681('0x26')][_0x7681('0x25')]);}})[_0x7681('0x27')](function(_0x178b1a){logger[_0x7681('0x24')](_0x7681('0x21'),_0x222bcd,_0x178b1a);_0x21aad0(_0x178b1a);});});}function respondWithStatusCode(_0x376065,_0xdfb1ed){_0xdfb1ed=_0xdfb1ed||0xcc;return function(_0x5c9edb){if(_0x5c9edb){return _0x376065[_0x7681('0x28')](_0xdfb1ed);}return _0x376065[_0x7681('0x29')](_0xdfb1ed)[_0x7681('0x2a')]();};}function respondWithResult(_0x4c959a,_0x476483){_0x476483=_0x476483||0xc8;return function(_0x484007){if(_0x484007){return _0x4c959a[_0x7681('0x29')](_0x476483)[_0x7681('0x2b')](_0x484007);}};}function respondWithFilteredResult(_0x540584,_0x2c48e0){return function(_0x144fc8){if(_0x144fc8){var _0x47c61a=typeof _0x2c48e0[_0x7681('0x2c')]===_0x7681('0x2d')&&typeof _0x2c48e0[_0x7681('0x2e')]===_0x7681('0x2d');var _0x1d9dc3=_0x144fc8[_0x7681('0x2f')];var _0x1eedb6=_0x47c61a?0x0:_0x2c48e0['offset'];var _0x5967b1=_0x47c61a?_0x144fc8[_0x7681('0x2f')]:_0x2c48e0[_0x7681('0x2c')]+_0x2c48e0['limit'];var _0x4a5962;if(_0x5967b1>=_0x1d9dc3){_0x5967b1=_0x1d9dc3;_0x4a5962=0xc8;}else{_0x4a5962=0xce;}_0x540584[_0x7681('0x29')](_0x4a5962);return _0x540584[_0x7681('0x30')](_0x7681('0x31'),_0x1eedb6+'-'+_0x5967b1+'/'+_0x1d9dc3)[_0x7681('0x2b')](_0x144fc8);}return null;};}function patchUpdates(_0x5e12e8){return function(_0x15b650){try{jsonpatch[_0x7681('0x32')](_0x15b650,_0x5e12e8,!![]);}catch(_0x144182){return BPromise['reject'](_0x144182);}return _0x15b650[_0x7681('0x33')]();};}function saveUpdates(_0x40c7c5,_0x3572a4){return function(_0x80ac64){if(_0x80ac64){return _0x80ac64[_0x7681('0x34')](_0x40c7c5)[_0x7681('0x1f')](function(_0x433650){return _0x433650;});}return null;};}function removeEntity(_0x218a3a,_0x15c09f){return function(_0x3ebc75){if(_0x3ebc75){return _0x3ebc75[_0x7681('0x35')]()[_0x7681('0x1f')](function(){_0x218a3a[_0x7681('0x29')](0xcc)[_0x7681('0x2a')]();});}};}function handleEntityNotFound(_0xbb23e6,_0x58fa9e){return function(_0x586097){if(!_0x586097){_0xbb23e6['sendStatus'](0x194);}return _0x586097;};}function handleError(_0x12adf8,_0x404efc){_0x404efc=_0x404efc||0x1f4;return function(_0x5e6075){logger[_0x7681('0x24')](_0x5e6075[_0x7681('0x36')]);if(_0x5e6075[_0x7681('0x37')]){delete _0x5e6075[_0x7681('0x37')];}_0x12adf8['status'](_0x404efc)[_0x7681('0x38')](_0x5e6075);};}exports[_0x7681('0x39')]=function(_0x31037b,_0x194b46){var _0x3fc32c={},_0x47fb12={},_0x4763aa={'count':0x0,'rows':[]};var _0x2ad786=_[_0x7681('0x3a')](db['SalesforceConfiguration'][_0x7681('0x3b')],function(_0x5d183a){return{'name':_0x5d183a['fieldName'],'type':_0x5d183a[_0x7681('0x3c')][_0x7681('0x3d')]};});_0x47fb12[_0x7681('0x3e')]=_[_0x7681('0x3a')](_0x2ad786,_0x7681('0x37'));_0x47fb12[_0x7681('0x3f')]=_['keys'](_0x31037b[_0x7681('0x3f')]);_0x47fb12[_0x7681('0x40')]=_[_0x7681('0x41')](_0x47fb12[_0x7681('0x3e')],_0x47fb12['query']);_0x3fc32c[_0x7681('0x42')]=_[_0x7681('0x41')](_0x47fb12[_0x7681('0x3e')],qs[_0x7681('0x43')](_0x31037b[_0x7681('0x3f')][_0x7681('0x43')]));_0x3fc32c[_0x7681('0x42')]=_0x3fc32c['attributes'][_0x7681('0x44')]?_0x3fc32c[_0x7681('0x42')]:_0x47fb12[_0x7681('0x3e')];if(!_0x31037b[_0x7681('0x3f')][_0x7681('0x45')](_0x7681('0x46'))){_0x3fc32c['limit']=qs['limit'](_0x31037b[_0x7681('0x3f')][_0x7681('0x2e')]);_0x3fc32c[_0x7681('0x2c')]=qs['offset'](_0x31037b['query'][_0x7681('0x2c')]);}_0x3fc32c[_0x7681('0x47')]=qs[_0x7681('0x48')](_0x31037b['query'][_0x7681('0x48')]);_0x3fc32c[_0x7681('0x49')]=qs['filters'](_['pick'](_0x31037b[_0x7681('0x3f')],_0x47fb12[_0x7681('0x40')]),_0x2ad786);if(_0x31037b['query'][_0x7681('0x4a')]){_0x3fc32c['where']=_['merge'](_0x3fc32c[_0x7681('0x49')],{'$or':_[_0x7681('0x3a')](_0x2ad786,function(_0x500644){if(_0x500644['type']!==_0x7681('0x4b')){var _0x3cc72d={};_0x3cc72d[_0x500644[_0x7681('0x37')]]={'$like':'%'+_0x31037b[_0x7681('0x3f')][_0x7681('0x4a')]+'%'};return _0x3cc72d;}})});}_0x3fc32c=_['merge']({},_0x3fc32c,_0x31037b[_0x7681('0x4c')]);var _0x533d73={'where':_0x3fc32c[_0x7681('0x49')]};return db[_0x7681('0x4d')][_0x7681('0x2f')](_0x533d73)[_0x7681('0x1f')](function(_0x9a48a1){_0x4763aa[_0x7681('0x2f')]=_0x9a48a1;if(_0x31037b[_0x7681('0x3f')][_0x7681('0x4e')]){_0x3fc32c['include']=[{'all':!![]}];}return db[_0x7681('0x4d')][_0x7681('0x4f')](_0x3fc32c);})['then'](function(_0x5bd3ee){_0x4763aa[_0x7681('0x50')]=_0x5bd3ee;return _0x4763aa;})[_0x7681('0x1f')](respondWithFilteredResult(_0x194b46,_0x3fc32c))['catch'](handleError(_0x194b46,null));};exports[_0x7681('0x51')]=function(_0x6658c2,_0x8ce749){var _0x3f55b0={'raw':![],'where':{'id':_0x6658c2['params']['id']}},_0x44708b={};_0x44708b['model']=_[_0x7681('0x52')](db[_0x7681('0x4d')][_0x7681('0x3b')]);_0x44708b[_0x7681('0x3f')]=_[_0x7681('0x52')](_0x6658c2['query']);_0x44708b[_0x7681('0x40')]=_[_0x7681('0x41')](_0x44708b['model'],_0x44708b['query']);_0x3f55b0[_0x7681('0x42')]=_['intersection'](_0x44708b[_0x7681('0x3e')],qs['fields'](_0x6658c2['query']['fields']));_0x3f55b0['attributes']=_0x3f55b0[_0x7681('0x42')][_0x7681('0x44')]?_0x3f55b0[_0x7681('0x42')]:_0x44708b[_0x7681('0x3e')];if(_0x6658c2[_0x7681('0x3f')][_0x7681('0x4e')]){_0x3f55b0[_0x7681('0x53')]=[{'all':!![]}];}_0x3f55b0=_[_0x7681('0x54')]({},_0x3f55b0,_0x6658c2[_0x7681('0x4c')]);return db['SalesforceConfiguration'][_0x7681('0x55')](_0x3f55b0)[_0x7681('0x1f')](handleEntityNotFound(_0x8ce749,null))[_0x7681('0x1f')](respondWithResult(_0x8ce749,null))['catch'](handleError(_0x8ce749,null));};exports[_0x7681('0x56')]=function(_0x326075,_0x142cd1){return db[_0x7681('0x4d')][_0x7681('0x56')](_0x326075[_0x7681('0x57')],{})[_0x7681('0x1f')](respondWithResult(_0x142cd1,0xc9))[_0x7681('0x27')](handleError(_0x142cd1,null));};exports['update']=function(_0x117851,_0x1145ba){if(_0x117851[_0x7681('0x57')]['id']){delete _0x117851[_0x7681('0x57')]['id'];}return db[_0x7681('0x4d')][_0x7681('0x55')]({'where':{'id':_0x117851['params']['id']}})[_0x7681('0x1f')](handleEntityNotFound(_0x1145ba,null))[_0x7681('0x1f')](saveUpdates(_0x117851['body'],null))[_0x7681('0x1f')](respondWithResult(_0x1145ba,null))['catch'](handleError(_0x1145ba,null));};exports['destroy']=function(_0x105999,_0x3b531a){return db[_0x7681('0x4d')][_0x7681('0x55')]({'where':{'id':_0x105999['params']['id']}})[_0x7681('0x1f')](handleEntityNotFound(_0x3b531a,null))[_0x7681('0x1f')](removeEntity(_0x3b531a,null))[_0x7681('0x27')](handleError(_0x3b531a,null));};exports[_0x7681('0x58')]=function(_0x2c771f,_0x7492a2,_0x378c7b){var _0x38d135={};var _0xfbd4e7={};var _0x117101;var _0x32fb6d;return db[_0x7681('0x4d')][_0x7681('0x59')]({'where':{'id':_0x2c771f['params']['id']}})[_0x7681('0x1f')](handleEntityNotFound(_0x7492a2,null))['then'](function(_0x53e58c){if(_0x53e58c){_0x117101=_0x53e58c;_0xfbd4e7[_0x7681('0x3e')]=_[_0x7681('0x52')](db[_0x7681('0x5a')][_0x7681('0x3b')]);_0xfbd4e7[_0x7681('0x3f')]=_[_0x7681('0x52')](_0x2c771f[_0x7681('0x3f')]);_0xfbd4e7[_0x7681('0x40')]=_['intersection'](_0xfbd4e7[_0x7681('0x3e')],_0xfbd4e7[_0x7681('0x3f')]);_0x38d135[_0x7681('0x42')]=_[_0x7681('0x41')](_0xfbd4e7[_0x7681('0x3e')],qs[_0x7681('0x43')](_0x2c771f[_0x7681('0x3f')]['fields']));_0x38d135[_0x7681('0x42')]=_0x38d135[_0x7681('0x42')][_0x7681('0x44')]?_0x38d135[_0x7681('0x42')]:_0xfbd4e7['model'];_0x38d135[_0x7681('0x47')]=qs[_0x7681('0x48')](_0x2c771f[_0x7681('0x3f')][_0x7681('0x48')]);_0x38d135[_0x7681('0x49')]=qs[_0x7681('0x40')](_[_0x7681('0x5b')](_0x2c771f['query'],_0xfbd4e7['filters']));if(_0x2c771f[_0x7681('0x3f')]['filter']){_0x38d135[_0x7681('0x49')]=_[_0x7681('0x54')](_0x38d135[_0x7681('0x49')],{'$or':_[_0x7681('0x3a')](_0x38d135[_0x7681('0x42')],function(_0x11b3f7){var _0x4c680a={};_0x4c680a[_0x11b3f7]={'$like':'%'+_0x2c771f[_0x7681('0x3f')][_0x7681('0x4a')]+'%'};return _0x4c680a;})});}_0x38d135=_[_0x7681('0x54')]({},_0x38d135,_0x2c771f[_0x7681('0x4c')]);return _0x117101[_0x7681('0x58')](_0x38d135);}})['then'](function(_0x11b93d){if(_0x11b93d){_0x32fb6d=_0x11b93d[_0x7681('0x44')];if(!_0x2c771f['query']['hasOwnProperty'](_0x7681('0x46'))){_0x38d135[_0x7681('0x2e')]=qs[_0x7681('0x2e')](_0x2c771f['query']['limit']);_0x38d135[_0x7681('0x2c')]=qs[_0x7681('0x2c')](_0x2c771f[_0x7681('0x3f')][_0x7681('0x2c')]);}return _0x117101[_0x7681('0x58')](_0x38d135);}})[_0x7681('0x1f')](function(_0x4fd27a){if(_0x4fd27a){return _0x4fd27a?{'count':_0x32fb6d,'rows':_0x4fd27a}:null;}})[_0x7681('0x1f')](respondWithResult(_0x7492a2,null))[_0x7681('0x27')](handleError(_0x7492a2,null));};exports[_0x7681('0x5c')]=function(_0x6318ca,_0x466540,_0x3c0ef4){var _0x5707bb={};var _0x289408={};var _0x34e6c9;var _0x3867b6;return db[_0x7681('0x4d')][_0x7681('0x59')]({'where':{'id':_0x6318ca[_0x7681('0x5d')]['id']}})[_0x7681('0x1f')](handleEntityNotFound(_0x466540,null))[_0x7681('0x1f')](function(_0x45f0c8){if(_0x45f0c8){_0x34e6c9=_0x45f0c8;_0x289408[_0x7681('0x3e')]=_[_0x7681('0x52')](db[_0x7681('0x5a')]['rawAttributes']);_0x289408[_0x7681('0x3f')]=_['keys'](_0x6318ca[_0x7681('0x3f')]);_0x289408[_0x7681('0x40')]=_[_0x7681('0x41')](_0x289408[_0x7681('0x3e')],_0x289408['query']);_0x5707bb[_0x7681('0x42')]=_[_0x7681('0x41')](_0x289408[_0x7681('0x3e')],qs[_0x7681('0x43')](_0x6318ca['query']['fields']));_0x5707bb['attributes']=_0x5707bb['attributes'][_0x7681('0x44')]?_0x5707bb['attributes']:_0x289408['model'];_0x5707bb[_0x7681('0x47')]=qs[_0x7681('0x48')](_0x6318ca[_0x7681('0x3f')][_0x7681('0x48')]);_0x5707bb[_0x7681('0x49')]=qs['filters'](_[_0x7681('0x5b')](_0x6318ca['query'],_0x289408[_0x7681('0x40')]));if(_0x6318ca[_0x7681('0x3f')][_0x7681('0x4a')]){_0x5707bb[_0x7681('0x49')]=_[_0x7681('0x54')](_0x5707bb[_0x7681('0x49')],{'$or':_[_0x7681('0x3a')](_0x5707bb[_0x7681('0x42')],function(_0x35d717){var _0x323f64={};_0x323f64[_0x35d717]={'$like':'%'+_0x6318ca['query']['filter']+'%'};return _0x323f64;})});}_0x5707bb=_[_0x7681('0x54')]({},_0x5707bb,_0x6318ca[_0x7681('0x4c')]);return _0x34e6c9[_0x7681('0x5c')](_0x5707bb);}})[_0x7681('0x1f')](function(_0x13d6dd){if(_0x13d6dd){_0x3867b6=_0x13d6dd[_0x7681('0x44')];if(!_0x6318ca['query'][_0x7681('0x45')]('nolimit')){_0x5707bb['limit']=qs[_0x7681('0x2e')](_0x6318ca['query'][_0x7681('0x2e')]);_0x5707bb['offset']=qs[_0x7681('0x2c')](_0x6318ca[_0x7681('0x3f')]['offset']);}return _0x34e6c9[_0x7681('0x5c')](_0x5707bb);}})[_0x7681('0x1f')](function(_0xf5cb30){if(_0xf5cb30){return _0xf5cb30?{'count':_0x3867b6,'rows':_0xf5cb30}:null;}})[_0x7681('0x1f')](respondWithResult(_0x466540,null))['catch'](handleError(_0x466540,null));};exports[_0x7681('0x5e')]=function(_0x448042,_0xeed9d3,_0x1d9394){var _0x1fcecb={};var _0x2c981b={};var _0x516608;var _0x325e3d;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x448042[_0x7681('0x5d')]['id']}})[_0x7681('0x1f')](handleEntityNotFound(_0xeed9d3,null))[_0x7681('0x1f')](function(_0x1ef865){if(_0x1ef865){_0x516608=_0x1ef865;_0x2c981b[_0x7681('0x3e')]=_[_0x7681('0x52')](db['SalesforceField'][_0x7681('0x3b')]);_0x2c981b[_0x7681('0x3f')]=_[_0x7681('0x52')](_0x448042[_0x7681('0x3f')]);_0x2c981b[_0x7681('0x40')]=_[_0x7681('0x41')](_0x2c981b[_0x7681('0x3e')],_0x2c981b[_0x7681('0x3f')]);_0x1fcecb['attributes']=_[_0x7681('0x41')](_0x2c981b[_0x7681('0x3e')],qs[_0x7681('0x43')](_0x448042['query']['fields']));_0x1fcecb['attributes']=_0x1fcecb[_0x7681('0x42')][_0x7681('0x44')]?_0x1fcecb['attributes']:_0x2c981b['model'];_0x1fcecb[_0x7681('0x47')]=qs['sort'](_0x448042['query'][_0x7681('0x48')]);_0x1fcecb[_0x7681('0x49')]=qs['filters'](_[_0x7681('0x5b')](_0x448042[_0x7681('0x3f')],_0x2c981b[_0x7681('0x40')]));if(_0x448042[_0x7681('0x3f')][_0x7681('0x4a')]){_0x1fcecb[_0x7681('0x49')]=_[_0x7681('0x54')](_0x1fcecb[_0x7681('0x49')],{'$or':_['map'](_0x1fcecb['attributes'],function(_0x206957){var _0x1d55ac={};_0x1d55ac[_0x206957]={'$like':'%'+_0x448042[_0x7681('0x3f')][_0x7681('0x4a')]+'%'};return _0x1d55ac;})});}_0x1fcecb=_[_0x7681('0x54')]({},_0x1fcecb,_0x448042[_0x7681('0x4c')]);return _0x516608[_0x7681('0x5e')](_0x1fcecb);}})[_0x7681('0x1f')](function(_0x158a57){if(_0x158a57){_0x325e3d=_0x158a57[_0x7681('0x44')];if(!_0x448042[_0x7681('0x3f')]['hasOwnProperty'](_0x7681('0x46'))){_0x1fcecb[_0x7681('0x2e')]=qs[_0x7681('0x2e')](_0x448042[_0x7681('0x3f')][_0x7681('0x2e')]);_0x1fcecb[_0x7681('0x2c')]=qs[_0x7681('0x2c')](_0x448042[_0x7681('0x3f')]['offset']);}return _0x516608[_0x7681('0x5e')](_0x1fcecb);}})[_0x7681('0x1f')](function(_0x45b96f){if(_0x45b96f){return _0x45b96f?{'count':_0x325e3d,'rows':_0x45b96f}:null;}})[_0x7681('0x1f')](respondWithResult(_0xeed9d3,null))[_0x7681('0x27')](handleError(_0xeed9d3,null));}; \ No newline at end of file +var _0x980b=['client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','save','update','stack','name','send','map','SalesforceConfiguration','rawAttributes','key','model','query','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','type','VIRTUAL','include','findAll','catch','show','params','keys','length','includeAll','create','body','find','findOne','merge','options','nolimit','getFields','getSubjects','SalesforceField','getDescriptions','zip-dir','fast-json-patch','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise'];(function(_0x4c7425,_0x304790){var _0x564a6e=function(_0x1f94fe){while(--_0x1f94fe){_0x4c7425['push'](_0x4c7425['shift']());}};_0x564a6e(++_0x304790);}(_0x980b,0x143));var _0xb980=function(_0x27ba9b,_0x570bb6){_0x27ba9b=_0x27ba9b-0x0;var _0x32b62c=_0x980b[_0x27ba9b];return _0x32b62c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb980('0x0'));var jsonpatch=require(_0xb980('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb980('0x2'));var util=require(_0xb980('0x3'));var path=require(_0xb980('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb980('0x5'));var squel=require(_0xb980('0x6'));var crypto=require(_0xb980('0x7'));var jsforce=require(_0xb980('0x8'));var deskjs=require(_0xb980('0x9'));var toCsv=require(_0xb980('0xa'));var querystring=require(_0xb980('0xb'));var Papa=require(_0xb980('0xc'));var Redis=require(_0xb980('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xb980('0xe'));var as=require(_0xb980('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb980('0x10'));var config=require(_0xb980('0x11'));var licenseUtil=require(_0xb980('0x12'));var db=require(_0xb980('0x13'))['db'];var jayson=require(_0xb980('0x14'));var client=jayson[_0xb980('0x15')][_0xb980('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x5143f7,_0x1212b3,_0x39db2e,_0x5f01d4){return new BPromise(function(_0x4bf8d3,_0x2a19fa){var _0x3b8148=_0x5f01d4||client;return _0x3b8148[_0xb980('0x17')](_0x5143f7,_0x39db2e)[_0xb980('0x18')](function(_0xe1ef5f){logger[_0xb980('0x19')](_0xb980('0x1a'),_0x1212b3,'request\x20sent');logger[_0xb980('0x1b')](_0xb980('0x1c'),_0x1212b3,_0xb980('0x1d'),JSON[_0xb980('0x1e')](_0xe1ef5f));if(_0xe1ef5f[_0xb980('0x1f')]){if(_0xe1ef5f['error'][_0xb980('0x20')]===0x1f4){logger['error'](_0xb980('0x1a'),_0x1212b3,_0xe1ef5f[_0xb980('0x1f')][_0xb980('0x21')]);return _0x2a19fa(_0xe1ef5f[_0xb980('0x1f')][_0xb980('0x21')]);}logger[_0xb980('0x1f')](_0xb980('0x1a'),_0x1212b3,_0xe1ef5f[_0xb980('0x1f')][_0xb980('0x21')]);return _0x4bf8d3(_0xe1ef5f['error']['message']);}else{logger[_0xb980('0x19')](_0xb980('0x1a'),_0x1212b3,_0xb980('0x1d'));_0x4bf8d3(_0xe1ef5f['result']['message']);}})['catch'](function(_0x4cb6b0){logger[_0xb980('0x1f')](_0xb980('0x1a'),_0x1212b3,_0x4cb6b0);_0x2a19fa(_0x4cb6b0);});});}function respondWithStatusCode(_0x8c2ea9,_0x3ab640){_0x3ab640=_0x3ab640||0xcc;return function(_0x36ed5b){if(_0x36ed5b){return _0x8c2ea9[_0xb980('0x22')](_0x3ab640);}return _0x8c2ea9[_0xb980('0x23')](_0x3ab640)[_0xb980('0x24')]();};}function respondWithResult(_0x5fe7cf,_0x1cf06f){_0x1cf06f=_0x1cf06f||0xc8;return function(_0x21bd7d){if(_0x21bd7d){return _0x5fe7cf[_0xb980('0x23')](_0x1cf06f)[_0xb980('0x25')](_0x21bd7d);}};}function respondWithFilteredResult(_0x32c7d9,_0x56231f){return function(_0x456e8f){if(_0x456e8f){var _0x4af495=typeof _0x56231f[_0xb980('0x26')]===_0xb980('0x27')&&typeof _0x56231f['limit']===_0xb980('0x27');var _0x133942=_0x456e8f[_0xb980('0x28')];var _0x381911=_0x4af495?0x0:_0x56231f[_0xb980('0x26')];var _0xe8f648=_0x4af495?_0x456e8f['count']:_0x56231f[_0xb980('0x26')]+_0x56231f['limit'];var _0x65be6;if(_0xe8f648>=_0x133942){_0xe8f648=_0x133942;_0x65be6=0xc8;}else{_0x65be6=0xce;}_0x32c7d9[_0xb980('0x23')](_0x65be6);return _0x32c7d9[_0xb980('0x29')](_0xb980('0x2a'),_0x381911+'-'+_0xe8f648+'/'+_0x133942)['json'](_0x456e8f);}return null;};}function patchUpdates(_0x618b58){return function(_0x1b34f4){try{jsonpatch['apply'](_0x1b34f4,_0x618b58,!![]);}catch(_0x167ad2){return BPromise['reject'](_0x167ad2);}return _0x1b34f4[_0xb980('0x2b')]();};}function saveUpdates(_0x5ccfc4,_0x4cccc5){return function(_0x4bbdc0){if(_0x4bbdc0){return _0x4bbdc0[_0xb980('0x2c')](_0x5ccfc4)[_0xb980('0x18')](function(_0x481062){return _0x481062;});}return null;};}function removeEntity(_0x1d9755,_0x268f45){return function(_0x18d42c){if(_0x18d42c){return _0x18d42c['destroy']()[_0xb980('0x18')](function(){_0x1d9755[_0xb980('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa9d74c,_0x17ceec){return function(_0x4b9c82){if(!_0x4b9c82){_0xa9d74c[_0xb980('0x22')](0x194);}return _0x4b9c82;};}function handleError(_0x367545,_0x520c7f){_0x520c7f=_0x520c7f||0x1f4;return function(_0x19cd95){logger[_0xb980('0x1f')](_0x19cd95[_0xb980('0x2d')]);if(_0x19cd95[_0xb980('0x2e')]){delete _0x19cd95[_0xb980('0x2e')];}_0x367545[_0xb980('0x23')](_0x520c7f)[_0xb980('0x2f')](_0x19cd95);};}exports['index']=function(_0x49b0ac,_0xb8e918){var _0x2b81e6={},_0x12f9be={},_0x4aa985={'count':0x0,'rows':[]};var _0x235492=_[_0xb980('0x30')](db[_0xb980('0x31')][_0xb980('0x32')],function(_0x2e1b26){return{'name':_0x2e1b26['fieldName'],'type':_0x2e1b26['type'][_0xb980('0x33')]};});_0x12f9be[_0xb980('0x34')]=_[_0xb980('0x30')](_0x235492,'name');_0x12f9be[_0xb980('0x35')]=_['keys'](_0x49b0ac[_0xb980('0x35')]);_0x12f9be['filters']=_[_0xb980('0x36')](_0x12f9be['model'],_0x12f9be[_0xb980('0x35')]);_0x2b81e6[_0xb980('0x37')]=_['intersection'](_0x12f9be['model'],qs[_0xb980('0x38')](_0x49b0ac[_0xb980('0x35')][_0xb980('0x38')]));_0x2b81e6[_0xb980('0x37')]=_0x2b81e6[_0xb980('0x37')]['length']?_0x2b81e6[_0xb980('0x37')]:_0x12f9be[_0xb980('0x34')];if(!_0x49b0ac[_0xb980('0x35')][_0xb980('0x39')]('nolimit')){_0x2b81e6[_0xb980('0x3a')]=qs[_0xb980('0x3a')](_0x49b0ac[_0xb980('0x35')][_0xb980('0x3a')]);_0x2b81e6['offset']=qs[_0xb980('0x26')](_0x49b0ac[_0xb980('0x35')]['offset']);}_0x2b81e6[_0xb980('0x3b')]=qs[_0xb980('0x3c')](_0x49b0ac['query'][_0xb980('0x3c')]);_0x2b81e6[_0xb980('0x3d')]=qs[_0xb980('0x3e')](_[_0xb980('0x3f')](_0x49b0ac['query'],_0x12f9be[_0xb980('0x3e')]),_0x235492);if(_0x49b0ac[_0xb980('0x35')][_0xb980('0x40')]){_0x2b81e6[_0xb980('0x3d')]=_['merge'](_0x2b81e6[_0xb980('0x3d')],{'$or':_[_0xb980('0x30')](_0x235492,function(_0x3685d5){if(_0x3685d5[_0xb980('0x41')]!==_0xb980('0x42')){var _0xb8c9={};_0xb8c9[_0x3685d5[_0xb980('0x2e')]]={'$like':'%'+_0x49b0ac[_0xb980('0x35')][_0xb980('0x40')]+'%'};return _0xb8c9;}})});}_0x2b81e6=_['merge']({},_0x2b81e6,_0x49b0ac['options']);var _0x2a6b0f={'where':_0x2b81e6[_0xb980('0x3d')]};return db['SalesforceConfiguration'][_0xb980('0x28')](_0x2a6b0f)[_0xb980('0x18')](function(_0x4c833a){_0x4aa985[_0xb980('0x28')]=_0x4c833a;if(_0x49b0ac[_0xb980('0x35')]['includeAll']){_0x2b81e6[_0xb980('0x43')]=[{'all':!![]}];}return db[_0xb980('0x31')][_0xb980('0x44')](_0x2b81e6);})[_0xb980('0x18')](function(_0x430995){_0x4aa985['rows']=_0x430995;return _0x4aa985;})[_0xb980('0x18')](respondWithFilteredResult(_0xb8e918,_0x2b81e6))[_0xb980('0x45')](handleError(_0xb8e918,null));};exports[_0xb980('0x46')]=function(_0xd10654,_0xca3621){var _0x453150={'raw':![],'where':{'id':_0xd10654[_0xb980('0x47')]['id']}},_0x3fdd7c={};_0x3fdd7c['model']=_['keys'](db['SalesforceConfiguration'][_0xb980('0x32')]);_0x3fdd7c[_0xb980('0x35')]=_[_0xb980('0x48')](_0xd10654[_0xb980('0x35')]);_0x3fdd7c[_0xb980('0x3e')]=_[_0xb980('0x36')](_0x3fdd7c[_0xb980('0x34')],_0x3fdd7c['query']);_0x453150[_0xb980('0x37')]=_[_0xb980('0x36')](_0x3fdd7c[_0xb980('0x34')],qs[_0xb980('0x38')](_0xd10654[_0xb980('0x35')][_0xb980('0x38')]));_0x453150[_0xb980('0x37')]=_0x453150['attributes'][_0xb980('0x49')]?_0x453150[_0xb980('0x37')]:_0x3fdd7c[_0xb980('0x34')];if(_0xd10654[_0xb980('0x35')][_0xb980('0x4a')]){_0x453150[_0xb980('0x43')]=[{'all':!![]}];}_0x453150=_['merge']({},_0x453150,_0xd10654['options']);return db[_0xb980('0x31')]['find'](_0x453150)[_0xb980('0x18')](handleEntityNotFound(_0xca3621,null))[_0xb980('0x18')](respondWithResult(_0xca3621,null))[_0xb980('0x45')](handleError(_0xca3621,null));};exports[_0xb980('0x4b')]=function(_0x2ecddc,_0x232e10){return db[_0xb980('0x31')][_0xb980('0x4b')](_0x2ecddc[_0xb980('0x4c')],{})['then'](respondWithResult(_0x232e10,0xc9))[_0xb980('0x45')](handleError(_0x232e10,null));};exports[_0xb980('0x2c')]=function(_0x2ea908,_0xe0e16c){if(_0x2ea908[_0xb980('0x4c')]['id']){delete _0x2ea908[_0xb980('0x4c')]['id'];}return db[_0xb980('0x31')][_0xb980('0x4d')]({'where':{'id':_0x2ea908['params']['id']}})[_0xb980('0x18')](handleEntityNotFound(_0xe0e16c,null))[_0xb980('0x18')](saveUpdates(_0x2ea908[_0xb980('0x4c')],null))[_0xb980('0x18')](respondWithResult(_0xe0e16c,null))['catch'](handleError(_0xe0e16c,null));};exports['destroy']=function(_0x3b4336,_0x2aff3a){return db[_0xb980('0x31')][_0xb980('0x4d')]({'where':{'id':_0x3b4336['params']['id']}})[_0xb980('0x18')](handleEntityNotFound(_0x2aff3a,null))[_0xb980('0x18')](removeEntity(_0x2aff3a,null))['catch'](handleError(_0x2aff3a,null));};exports['getFields']=function(_0x413bdd,_0x51c2a4,_0x50ef94){var _0x29a9b3={};var _0x286bec={};var _0x1639bf;var _0x1c11b2;return db[_0xb980('0x31')][_0xb980('0x4e')]({'where':{'id':_0x413bdd[_0xb980('0x47')]['id']}})['then'](handleEntityNotFound(_0x51c2a4,null))['then'](function(_0x163dae){if(_0x163dae){_0x1639bf=_0x163dae;_0x286bec[_0xb980('0x34')]=_[_0xb980('0x48')](db['SalesforceField'][_0xb980('0x32')]);_0x286bec[_0xb980('0x35')]=_['keys'](_0x413bdd[_0xb980('0x35')]);_0x286bec[_0xb980('0x3e')]=_['intersection'](_0x286bec[_0xb980('0x34')],_0x286bec[_0xb980('0x35')]);_0x29a9b3[_0xb980('0x37')]=_[_0xb980('0x36')](_0x286bec[_0xb980('0x34')],qs[_0xb980('0x38')](_0x413bdd['query'][_0xb980('0x38')]));_0x29a9b3[_0xb980('0x37')]=_0x29a9b3[_0xb980('0x37')][_0xb980('0x49')]?_0x29a9b3['attributes']:_0x286bec[_0xb980('0x34')];_0x29a9b3[_0xb980('0x3b')]=qs[_0xb980('0x3c')](_0x413bdd['query']['sort']);_0x29a9b3[_0xb980('0x3d')]=qs[_0xb980('0x3e')](_['pick'](_0x413bdd[_0xb980('0x35')],_0x286bec[_0xb980('0x3e')]));if(_0x413bdd['query'][_0xb980('0x40')]){_0x29a9b3[_0xb980('0x3d')]=_['merge'](_0x29a9b3[_0xb980('0x3d')],{'$or':_[_0xb980('0x30')](_0x29a9b3[_0xb980('0x37')],function(_0x12633f){var _0x34ddff={};_0x34ddff[_0x12633f]={'$like':'%'+_0x413bdd[_0xb980('0x35')][_0xb980('0x40')]+'%'};return _0x34ddff;})});}_0x29a9b3=_[_0xb980('0x4f')]({},_0x29a9b3,_0x413bdd[_0xb980('0x50')]);return _0x1639bf['getFields'](_0x29a9b3);}})[_0xb980('0x18')](function(_0x343bdd){if(_0x343bdd){_0x1c11b2=_0x343bdd[_0xb980('0x49')];if(!_0x413bdd[_0xb980('0x35')][_0xb980('0x39')](_0xb980('0x51'))){_0x29a9b3[_0xb980('0x3a')]=qs[_0xb980('0x3a')](_0x413bdd[_0xb980('0x35')]['limit']);_0x29a9b3[_0xb980('0x26')]=qs[_0xb980('0x26')](_0x413bdd['query'][_0xb980('0x26')]);}return _0x1639bf[_0xb980('0x52')](_0x29a9b3);}})[_0xb980('0x18')](function(_0x2de4a8){if(_0x2de4a8){return _0x2de4a8?{'count':_0x1c11b2,'rows':_0x2de4a8}:null;}})[_0xb980('0x18')](respondWithResult(_0x51c2a4,null))[_0xb980('0x45')](handleError(_0x51c2a4,null));};exports[_0xb980('0x53')]=function(_0x10ad8f,_0x498e51,_0x407b77){var _0x1d521c={};var _0x2d080f={};var _0x2f981a;var _0x357d91;return db[_0xb980('0x31')][_0xb980('0x4e')]({'where':{'id':_0x10ad8f[_0xb980('0x47')]['id']}})[_0xb980('0x18')](handleEntityNotFound(_0x498e51,null))[_0xb980('0x18')](function(_0x7506be){if(_0x7506be){_0x2f981a=_0x7506be;_0x2d080f[_0xb980('0x34')]=_[_0xb980('0x48')](db[_0xb980('0x54')]['rawAttributes']);_0x2d080f[_0xb980('0x35')]=_['keys'](_0x10ad8f[_0xb980('0x35')]);_0x2d080f[_0xb980('0x3e')]=_[_0xb980('0x36')](_0x2d080f[_0xb980('0x34')],_0x2d080f['query']);_0x1d521c[_0xb980('0x37')]=_[_0xb980('0x36')](_0x2d080f[_0xb980('0x34')],qs[_0xb980('0x38')](_0x10ad8f[_0xb980('0x35')][_0xb980('0x38')]));_0x1d521c[_0xb980('0x37')]=_0x1d521c['attributes']['length']?_0x1d521c[_0xb980('0x37')]:_0x2d080f['model'];_0x1d521c[_0xb980('0x3b')]=qs['sort'](_0x10ad8f[_0xb980('0x35')]['sort']);_0x1d521c[_0xb980('0x3d')]=qs[_0xb980('0x3e')](_[_0xb980('0x3f')](_0x10ad8f[_0xb980('0x35')],_0x2d080f[_0xb980('0x3e')]));if(_0x10ad8f[_0xb980('0x35')]['filter']){_0x1d521c['where']=_['merge'](_0x1d521c[_0xb980('0x3d')],{'$or':_['map'](_0x1d521c[_0xb980('0x37')],function(_0x3c51b5){var _0x317c7b={};_0x317c7b[_0x3c51b5]={'$like':'%'+_0x10ad8f['query']['filter']+'%'};return _0x317c7b;})});}_0x1d521c=_[_0xb980('0x4f')]({},_0x1d521c,_0x10ad8f['options']);return _0x2f981a[_0xb980('0x53')](_0x1d521c);}})[_0xb980('0x18')](function(_0x11e865){if(_0x11e865){_0x357d91=_0x11e865[_0xb980('0x49')];if(!_0x10ad8f['query'][_0xb980('0x39')](_0xb980('0x51'))){_0x1d521c[_0xb980('0x3a')]=qs[_0xb980('0x3a')](_0x10ad8f[_0xb980('0x35')][_0xb980('0x3a')]);_0x1d521c[_0xb980('0x26')]=qs[_0xb980('0x26')](_0x10ad8f['query'][_0xb980('0x26')]);}return _0x2f981a[_0xb980('0x53')](_0x1d521c);}})[_0xb980('0x18')](function(_0x6d778e){if(_0x6d778e){return _0x6d778e?{'count':_0x357d91,'rows':_0x6d778e}:null;}})['then'](respondWithResult(_0x498e51,null))[_0xb980('0x45')](handleError(_0x498e51,null));};exports['getDescriptions']=function(_0x2f301e,_0x4c64f2,_0x1e79b8){var _0x55c642={};var _0x342792={};var _0x542f63;var _0x5ec0c6;return db[_0xb980('0x31')]['findOne']({'where':{'id':_0x2f301e[_0xb980('0x47')]['id']}})[_0xb980('0x18')](handleEntityNotFound(_0x4c64f2,null))[_0xb980('0x18')](function(_0x1105f4){if(_0x1105f4){_0x542f63=_0x1105f4;_0x342792[_0xb980('0x34')]=_[_0xb980('0x48')](db[_0xb980('0x54')][_0xb980('0x32')]);_0x342792[_0xb980('0x35')]=_[_0xb980('0x48')](_0x2f301e['query']);_0x342792[_0xb980('0x3e')]=_['intersection'](_0x342792[_0xb980('0x34')],_0x342792['query']);_0x55c642[_0xb980('0x37')]=_[_0xb980('0x36')](_0x342792[_0xb980('0x34')],qs[_0xb980('0x38')](_0x2f301e[_0xb980('0x35')][_0xb980('0x38')]));_0x55c642[_0xb980('0x37')]=_0x55c642['attributes'][_0xb980('0x49')]?_0x55c642['attributes']:_0x342792[_0xb980('0x34')];_0x55c642[_0xb980('0x3b')]=qs[_0xb980('0x3c')](_0x2f301e[_0xb980('0x35')]['sort']);_0x55c642[_0xb980('0x3d')]=qs[_0xb980('0x3e')](_[_0xb980('0x3f')](_0x2f301e[_0xb980('0x35')],_0x342792[_0xb980('0x3e')]));if(_0x2f301e['query'][_0xb980('0x40')]){_0x55c642[_0xb980('0x3d')]=_['merge'](_0x55c642['where'],{'$or':_[_0xb980('0x30')](_0x55c642[_0xb980('0x37')],function(_0x1fe324){var _0x206234={};_0x206234[_0x1fe324]={'$like':'%'+_0x2f301e[_0xb980('0x35')][_0xb980('0x40')]+'%'};return _0x206234;})});}_0x55c642=_[_0xb980('0x4f')]({},_0x55c642,_0x2f301e['options']);return _0x542f63[_0xb980('0x55')](_0x55c642);}})[_0xb980('0x18')](function(_0x521e23){if(_0x521e23){_0x5ec0c6=_0x521e23['length'];if(!_0x2f301e['query'][_0xb980('0x39')]('nolimit')){_0x55c642[_0xb980('0x3a')]=qs[_0xb980('0x3a')](_0x2f301e['query'][_0xb980('0x3a')]);_0x55c642[_0xb980('0x26')]=qs[_0xb980('0x26')](_0x2f301e[_0xb980('0x35')][_0xb980('0x26')]);}return _0x542f63[_0xb980('0x55')](_0x55c642);}})[_0xb980('0x18')](function(_0x514d3e){if(_0x514d3e){return _0x514d3e?{'count':_0x5ec0c6,'rows':_0x514d3e}:null;}})[_0xb980('0x18')](respondWithResult(_0x4c64f2,null))[_0xb980('0x45')](handleError(_0x4c64f2,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 72ec67f..0367d26 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 _0x128e=['path','rimraf','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','util','api','moment','request-promise'];(function(_0x1a31f7,_0x36c8d8){var _0x394424=function(_0x412e9d){while(--_0x412e9d){_0x1a31f7['push'](_0x1a31f7['shift']());}};_0x394424(++_0x36c8d8);}(_0x128e,0xab));var _0xe128=function(_0x25fb05,_0x504aed){_0x25fb05=_0x25fb05-0x0;var _0x3a5f80=_0x128e[_0x25fb05];return _0x3a5f80;};'use strict';var _=require(_0xe128('0x0'));var util=require(_0xe128('0x1'));var logger=require('../../config/logger')(_0xe128('0x2'));var moment=require(_0xe128('0x3'));var BPromise=require('bluebird');var rp=require(_0xe128('0x4'));var fs=require('fs');var path=require(_0xe128('0x5'));var rimraf=require(_0xe128('0x6'));var config=require('../../config/environment');var attributes=require(_0xe128('0x7'));module[_0xe128('0x8')]=function(_0x3512d9,_0x29c7c4){return _0x3512d9[_0xe128('0x9')]('SalesforceConfiguration',attributes,{'tableName':_0xe128('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2608=['rimraf','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2608,0x65));var _0x8260=function(_0xda023d,_0x2a8199){_0xda023d=_0xda023d-0x0;var _0x43855d=_0x2608[_0xda023d];return _0x43855d;};'use strict';var _=require(_0x8260('0x0'));var util=require(_0x8260('0x1'));var logger=require('../../config/logger')(_0x8260('0x2'));var moment=require(_0x8260('0x3'));var BPromise=require(_0x8260('0x4'));var rp=require(_0x8260('0x5'));var fs=require('fs');var path=require(_0x8260('0x6'));var rimraf=require(_0x8260('0x7'));var config=require('../../config/environment');var attributes=require(_0x8260('0x8'));module[_0x8260('0x9')]=function(_0x173ee9,_0x3c316d){return _0x173ee9[_0x8260('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0x8260('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index d99ef69..f7cddb5 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 _0x2dc1=['message','info','result','catch','SalesforceConfiguration,\x20%s,\x20%s','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x33815c,_0x272c21){var _0x3ded3b=function(_0x11505b){while(--_0x11505b){_0x33815c['push'](_0x33815c['shift']());}};_0x3ded3b(++_0x272c21);}(_0x2dc1,0x1e5));var _0x12dc=function(_0x27e343,_0x24792d){_0x27e343=_0x27e343-0x0;var _0x296c2c=_0x2dc1[_0x27e343];return _0x296c2c;};'use strict';var _=require('lodash');var util=require(_0x12dc('0x0'));var moment=require('moment');var BPromise=require(_0x12dc('0x1'));var rs=require(_0x12dc('0x2'));var fs=require('fs');var Redis=require(_0x12dc('0x3'));var db=require(_0x12dc('0x4'))['db'];var utils=require(_0x12dc('0x5'));var logger=require(_0x12dc('0x6'))('rpc');var config=require(_0x12dc('0x7'));var jayson=require(_0x12dc('0x8'));var client=jayson[_0x12dc('0x9')][_0x12dc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a8c0e,_0x383741,_0xf3474b){return new BPromise(function(_0x503d4c,_0x12399e){return client[_0x12dc('0xb')](_0x4a8c0e,_0xf3474b)[_0x12dc('0xc')](function(_0x181587){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x383741,_0x12dc('0xd'));logger[_0x12dc('0xe')](_0x12dc('0xf'),_0x383741,_0x12dc('0xd'),JSON[_0x12dc('0x10')](_0x181587));if(_0x181587[_0x12dc('0x11')]){if(_0x181587[_0x12dc('0x11')][_0x12dc('0x12')]===0x1f4){logger[_0x12dc('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x383741,_0x181587[_0x12dc('0x11')][_0x12dc('0x13')]);return _0x12399e(_0x181587[_0x12dc('0x11')]['message']);}logger[_0x12dc('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x383741,_0x181587[_0x12dc('0x11')][_0x12dc('0x13')]);return _0x503d4c(_0x181587[_0x12dc('0x11')][_0x12dc('0x13')]);}else{logger[_0x12dc('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x383741,_0x12dc('0xd'));_0x503d4c(_0x181587[_0x12dc('0x15')][_0x12dc('0x13')]);}})[_0x12dc('0x16')](function(_0x513908){logger['error'](_0x12dc('0x17'),_0x383741,_0x513908);_0x12399e(_0x513908);});});} \ No newline at end of file +var _0xd443=['debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x1ef560,_0x281094){var _0xdccd1=function(_0x4f7fba){while(--_0x4f7fba){_0x1ef560['push'](_0x1ef560['shift']());}};_0xdccd1(++_0x281094);}(_0xd443,0x8b));var _0x3d44=function(_0x5cc806,_0x513bbe){_0x5cc806=_0x5cc806-0x0;var _0x46290a=_0xd443[_0x5cc806];return _0x46290a;};'use strict';var _=require(_0x3d44('0x0'));var util=require(_0x3d44('0x1'));var moment=require(_0x3d44('0x2'));var BPromise=require(_0x3d44('0x3'));var rs=require(_0x3d44('0x4'));var fs=require('fs');var Redis=require(_0x3d44('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d44('0x6'));var logger=require(_0x3d44('0x7'))(_0x3d44('0x8'));var config=require(_0x3d44('0x9'));var jayson=require(_0x3d44('0xa'));var client=jayson[_0x3d44('0xb')][_0x3d44('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e90b2,_0x540176,_0x36895a){return new BPromise(function(_0x4f2070,_0x4bc9cf){return client[_0x3d44('0xd')](_0x5e90b2,_0x36895a)[_0x3d44('0xe')](function(_0x2d7eff){logger[_0x3d44('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x540176,_0x3d44('0x10'));logger[_0x3d44('0x11')](_0x3d44('0x12'),_0x540176,'request\x20sent',JSON[_0x3d44('0x13')](_0x2d7eff));if(_0x2d7eff[_0x3d44('0x14')]){if(_0x2d7eff[_0x3d44('0x14')][_0x3d44('0x15')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x540176,_0x2d7eff[_0x3d44('0x14')][_0x3d44('0x16')]);return _0x4bc9cf(_0x2d7eff['error'][_0x3d44('0x16')]);}logger['error'](_0x3d44('0x17'),_0x540176,_0x2d7eff[_0x3d44('0x14')][_0x3d44('0x16')]);return _0x4f2070(_0x2d7eff['error'][_0x3d44('0x16')]);}else{logger[_0x3d44('0xf')](_0x3d44('0x17'),_0x540176,_0x3d44('0x10'));_0x4f2070(_0x2d7eff[_0x3d44('0x18')][_0x3d44('0x16')]);}})[_0x3d44('0x19')](function(_0x4670cd){logger['error'](_0x3d44('0x17'),_0x540176,_0x4670cd);_0x4bc9cf(_0x4670cd);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 64e6afb..59e1681 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 _0x7d37=['fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','create','update','destroy','exports','multer','util','path','express','Router'];(function(_0x4765c0,_0x297da5){var _0x4a6ad7=function(_0x35c378){while(--_0x35c378){_0x4765c0['push'](_0x4765c0['shift']());}};_0x4a6ad7(++_0x297da5);}(_0x7d37,0x1db));var _0x77d3=function(_0x28cc6b,_0x25e52f){_0x28cc6b=_0x28cc6b-0x0;var _0xe73e25=_0x7d37[_0x28cc6b];return _0xe73e25;};'use strict';var multer=require(_0x77d3('0x0'));var util=require(_0x77d3('0x1'));var path=require(_0x77d3('0x2'));var timeout=require('connect-timeout');var express=require(_0x77d3('0x3'));var router=express[_0x77d3('0x4')]();var fs_extra=require(_0x77d3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x77d3('0x6'));var config=require(_0x77d3('0x7'));var controller=require('./intSalesforceField.controller');router[_0x77d3('0x8')]('/',auth['isAuthenticated'](),controller[_0x77d3('0x9')]);router['get'](_0x77d3('0xa'),auth[_0x77d3('0xb')](),controller['show']);router['post']('/',auth[_0x77d3('0xb')](),controller[_0x77d3('0xc')]);router['put'](_0x77d3('0xa'),auth['isAuthenticated'](),controller[_0x77d3('0xd')]);router['delete'](_0x77d3('0xa'),auth['isAuthenticated'](),controller[_0x77d3('0xe')]);module[_0x77d3('0xf')]=router; \ No newline at end of file +var _0xcac2=['get','isAuthenticated','index','/:id','put','delete','destroy','multer','util','path','express','Router','./intSalesforceField.controller'];(function(_0x4e68be,_0x57ec0e){var _0x234853=function(_0x449642){while(--_0x449642){_0x4e68be['push'](_0x4e68be['shift']());}};_0x234853(++_0x57ec0e);}(_0xcac2,0x1e8));var _0x2cac=function(_0x1ee70a,_0x34f506){_0x1ee70a=_0x1ee70a-0x0;var _0x1256cf=_0xcac2[_0x1ee70a];return _0x1256cf;};'use strict';var multer=require(_0x2cac('0x0'));var util=require(_0x2cac('0x1'));var path=require(_0x2cac('0x2'));var timeout=require('connect-timeout');var express=require(_0x2cac('0x3'));var router=express[_0x2cac('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2cac('0x5'));router[_0x2cac('0x6')]('/',auth[_0x2cac('0x7')](),controller[_0x2cac('0x8')]);router[_0x2cac('0x6')](_0x2cac('0x9'),auth[_0x2cac('0x7')](),controller['show']);router['post']('/',auth[_0x2cac('0x7')](),controller['create']);router[_0x2cac('0xa')](_0x2cac('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x2cac('0xb')](_0x2cac('0x9'),auth['isAuthenticated'](),controller[_0x2cac('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 7e096b2..6e37716 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 _0xe706=['STRING','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x4e80be,_0x5a6e8b){var _0x479b2d=function(_0x7c08f0){while(--_0x7c08f0){_0x4e80be['push'](_0x4e80be['shift']());}};_0x479b2d(++_0x5a6e8b);}(_0xe706,0xa3));var _0x6e70=function(_0x52de9b,_0x19df61){_0x52de9b=_0x52de9b-0x0;var _0x1ad0c7=_0xe706[_0x52de9b];return _0x1ad0c7;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'type':{'type':Sequelize[_0x6e70('0x2')]('string',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'defaultValue':_0x6e70('0x7')},'content':{'type':Sequelize[_0x6e70('0x8')]},'key':{'type':Sequelize[_0x6e70('0x8')]},'keyType':{'type':Sequelize[_0x6e70('0x2')](_0x6e70('0x7'),_0x6e70('0x3'),_0x6e70('0x4'))},'keyContent':{'type':Sequelize[_0x6e70('0x8')]},'idField':{'type':Sequelize[_0x6e70('0x8')]},'variableName':{'type':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0x70e0=['picklist','string','STRING','sequelize','exports','ENUM','customVariable','keyValue'];(function(_0x353cb5,_0x5982a9){var _0x10840a=function(_0x16adb1){while(--_0x16adb1){_0x353cb5['push'](_0x353cb5['shift']());}};_0x10840a(++_0x5982a9);}(_0x70e0,0x17b));var _0x070e=function(_0x145ac7,_0x34f629){_0x145ac7=_0x145ac7-0x0;var _0xdd8ab3=_0x70e0[_0x145ac7];return _0xdd8ab3;};'use strict';var Sequelize=require(_0x070e('0x0'));module[_0x070e('0x1')]={'type':{'type':Sequelize[_0x070e('0x2')]('string','variable',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'defaultValue':_0x070e('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x070e('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x070e('0x6'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x070e('0x7')]},'variableName':{'type':Sequelize[_0x070e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index ed2a42a..059bb0c 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 _0x1040=['../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','sendStatus','error','name','send','map','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','SalesforceField','includeAll','include','findAll','rows','catch','show','params','length','create','update','body','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util'];(function(_0xedf7b0,_0x1a6c84){var _0x14e8d7=function(_0x2f852d){while(--_0x2f852d){_0xedf7b0['push'](_0xedf7b0['shift']());}};_0x14e8d7(++_0x1a6c84);}(_0x1040,0x7c));var _0x0104=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0x1040[_0x4bc65f];return _0x44f85f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0104('0x0'));var jsonpatch=require(_0x0104('0x1'));var rp=require(_0x0104('0x2'));var moment=require(_0x0104('0x3'));var BPromise=require(_0x0104('0x4'));var Mustache=require(_0x0104('0x5'));var util=require(_0x0104('0x6'));var path=require(_0x0104('0x7'));var sox=require(_0x0104('0x8'));var csv=require('to-csv');var ejs=require(_0x0104('0x9'));var fs=require('fs');var fs_extra=require(_0x0104('0xa'));var _=require(_0x0104('0xb'));var squel=require(_0x0104('0xc'));var crypto=require(_0x0104('0xd'));var jsforce=require(_0x0104('0xe'));var deskjs=require(_0x0104('0xf'));var toCsv=require(_0x0104('0x10'));var querystring=require(_0x0104('0x11'));var Papa=require(_0x0104('0x12'));var Redis=require(_0x0104('0x13'));var authService=require(_0x0104('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x0104('0x15'));var hardwareService=require(_0x0104('0x16'));var logger=require('../../config/logger')(_0x0104('0x17'));var utils=require('../../config/utils');var config=require(_0x0104('0x18'));var licenseUtil=require(_0x0104('0x19'));var db=require(_0x0104('0x1a'))['db'];function respondWithStatusCode(_0x1c9b92,_0x5bedd8){_0x5bedd8=_0x5bedd8||0xcc;return function(_0x5911ab){if(_0x5911ab){return _0x1c9b92['sendStatus'](_0x5bedd8);}return _0x1c9b92[_0x0104('0x1b')](_0x5bedd8)[_0x0104('0x1c')]();};}function respondWithResult(_0x4f8452,_0x3df308){_0x3df308=_0x3df308||0xc8;return function(_0x4b33ba){if(_0x4b33ba){return _0x4f8452[_0x0104('0x1b')](_0x3df308)[_0x0104('0x1d')](_0x4b33ba);}};}function respondWithFilteredResult(_0x58966b,_0x3179d1){return function(_0x25463a){if(_0x25463a){var _0x59beb2=typeof _0x3179d1['offset']===_0x0104('0x1e')&&typeof _0x3179d1[_0x0104('0x1f')]===_0x0104('0x1e');var _0x21f689=_0x25463a[_0x0104('0x20')];var _0x13d401=_0x59beb2?0x0:_0x3179d1[_0x0104('0x21')];var _0x2d16a2=_0x59beb2?_0x25463a[_0x0104('0x20')]:_0x3179d1[_0x0104('0x21')]+_0x3179d1[_0x0104('0x1f')];var _0x47f614;if(_0x2d16a2>=_0x21f689){_0x2d16a2=_0x21f689;_0x47f614=0xc8;}else{_0x47f614=0xce;}_0x58966b['status'](_0x47f614);return _0x58966b[_0x0104('0x22')](_0x0104('0x23'),_0x13d401+'-'+_0x2d16a2+'/'+_0x21f689)[_0x0104('0x1d')](_0x25463a);}return null;};}function patchUpdates(_0x59a470){return function(_0x2d8ab6){try{jsonpatch[_0x0104('0x24')](_0x2d8ab6,_0x59a470,!![]);}catch(_0x2cd582){return BPromise[_0x0104('0x25')](_0x2cd582);}return _0x2d8ab6['save']();};}function saveUpdates(_0x1a7643,_0x8e8362){return function(_0x19f0a2){if(_0x19f0a2){return _0x19f0a2['update'](_0x1a7643)[_0x0104('0x26')](function(_0x578369){return _0x578369;});}return null;};}function removeEntity(_0x3adb67,_0xa08ec9){return function(_0x1c13f6){if(_0x1c13f6){return _0x1c13f6[_0x0104('0x27')]()['then'](function(){_0x3adb67[_0x0104('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28c163,_0x511b8c){return function(_0x4b3b66){if(!_0x4b3b66){_0x28c163[_0x0104('0x28')](0x194);}return _0x4b3b66;};}function handleError(_0x24ec50,_0x2178ee){_0x2178ee=_0x2178ee||0x1f4;return function(_0x2e51a5){logger[_0x0104('0x29')](_0x2e51a5['stack']);if(_0x2e51a5[_0x0104('0x2a')]){delete _0x2e51a5[_0x0104('0x2a')];}_0x24ec50[_0x0104('0x1b')](_0x2178ee)[_0x0104('0x2b')](_0x2e51a5);};}exports['index']=function(_0x21358b,_0x4505a9){var _0x453025={},_0x4b2dee={},_0x4452cd={'count':0x0,'rows':[]};var _0x320696=_[_0x0104('0x2c')](db['SalesforceField']['rawAttributes'],function(_0x161896){return{'name':_0x161896[_0x0104('0x2d')],'type':_0x161896['type'][_0x0104('0x2e')]};});_0x4b2dee[_0x0104('0x2f')]=_[_0x0104('0x2c')](_0x320696,'name');_0x4b2dee['query']=_[_0x0104('0x30')](_0x21358b[_0x0104('0x31')]);_0x4b2dee[_0x0104('0x32')]=_[_0x0104('0x33')](_0x4b2dee[_0x0104('0x2f')],_0x4b2dee['query']);_0x453025['attributes']=_[_0x0104('0x33')](_0x4b2dee[_0x0104('0x2f')],qs['fields'](_0x21358b[_0x0104('0x31')][_0x0104('0x34')]));_0x453025[_0x0104('0x35')]=_0x453025[_0x0104('0x35')]['length']?_0x453025[_0x0104('0x35')]:_0x4b2dee[_0x0104('0x2f')];if(!_0x21358b[_0x0104('0x31')][_0x0104('0x36')](_0x0104('0x37'))){_0x453025['limit']=qs['limit'](_0x21358b[_0x0104('0x31')][_0x0104('0x1f')]);_0x453025['offset']=qs[_0x0104('0x21')](_0x21358b['query'][_0x0104('0x21')]);}_0x453025['order']=qs[_0x0104('0x38')](_0x21358b[_0x0104('0x31')][_0x0104('0x38')]);_0x453025[_0x0104('0x39')]=qs[_0x0104('0x32')](_[_0x0104('0x3a')](_0x21358b['query'],_0x4b2dee[_0x0104('0x32')]),_0x320696);if(_0x21358b[_0x0104('0x31')]['filter']){_0x453025['where']=_[_0x0104('0x3b')](_0x453025[_0x0104('0x39')],{'$or':_['map'](_0x320696,function(_0x38eff7){if(_0x38eff7['type']!=='VIRTUAL'){var _0x53f2ad={};_0x53f2ad[_0x38eff7['name']]={'$like':'%'+_0x21358b[_0x0104('0x31')][_0x0104('0x3c')]+'%'};return _0x53f2ad;}})});}_0x453025=_[_0x0104('0x3b')]({},_0x453025,_0x21358b[_0x0104('0x3d')]);var _0xa9ccb9={'where':_0x453025[_0x0104('0x39')]};return db[_0x0104('0x3e')][_0x0104('0x20')](_0xa9ccb9)[_0x0104('0x26')](function(_0x1d15f3){_0x4452cd['count']=_0x1d15f3;if(_0x21358b[_0x0104('0x31')][_0x0104('0x3f')]){_0x453025[_0x0104('0x40')]=[{'all':!![]}];}return db['SalesforceField'][_0x0104('0x41')](_0x453025);})[_0x0104('0x26')](function(_0x1c4417){_0x4452cd[_0x0104('0x42')]=_0x1c4417;return _0x4452cd;})[_0x0104('0x26')](respondWithFilteredResult(_0x4505a9,_0x453025))[_0x0104('0x43')](handleError(_0x4505a9,null));};exports[_0x0104('0x44')]=function(_0x105ed8,_0x1e1f14){var _0x39d616={'raw':!![],'where':{'id':_0x105ed8[_0x0104('0x45')]['id']}},_0x185b59={};_0x185b59[_0x0104('0x2f')]=_[_0x0104('0x30')](db['SalesforceField']['rawAttributes']);_0x185b59[_0x0104('0x31')]=_['keys'](_0x105ed8['query']);_0x185b59[_0x0104('0x32')]=_[_0x0104('0x33')](_0x185b59['model'],_0x185b59['query']);_0x39d616['attributes']=_[_0x0104('0x33')](_0x185b59[_0x0104('0x2f')],qs[_0x0104('0x34')](_0x105ed8[_0x0104('0x31')][_0x0104('0x34')]));_0x39d616['attributes']=_0x39d616['attributes'][_0x0104('0x46')]?_0x39d616[_0x0104('0x35')]:_0x185b59[_0x0104('0x2f')];if(_0x105ed8[_0x0104('0x31')]['includeAll']){_0x39d616['include']=[{'all':!![]}];}_0x39d616=_[_0x0104('0x3b')]({},_0x39d616,_0x105ed8[_0x0104('0x3d')]);return db[_0x0104('0x3e')]['find'](_0x39d616)[_0x0104('0x26')](handleEntityNotFound(_0x1e1f14,null))['then'](respondWithResult(_0x1e1f14,null))[_0x0104('0x43')](handleError(_0x1e1f14,null));};exports[_0x0104('0x47')]=function(_0x3dbdd9,_0x26228d){return db['SalesforceField']['create'](_0x3dbdd9['body'],{})[_0x0104('0x26')](respondWithResult(_0x26228d,0xc9))[_0x0104('0x43')](handleError(_0x26228d,null));};exports[_0x0104('0x48')]=function(_0x14b358,_0x1ed6f9){if(_0x14b358[_0x0104('0x49')]['id']){delete _0x14b358[_0x0104('0x49')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x14b358['params']['id']}})[_0x0104('0x26')](handleEntityNotFound(_0x1ed6f9,null))['then'](saveUpdates(_0x14b358['body'],null))[_0x0104('0x26')](respondWithResult(_0x1ed6f9,null))['catch'](handleError(_0x1ed6f9,null));};exports[_0x0104('0x27')]=function(_0x11989e,_0x2e9db1){return db[_0x0104('0x3e')][_0x0104('0x4a')]({'where':{'id':_0x11989e[_0x0104('0x45')]['id']}})[_0x0104('0x26')](handleEntityNotFound(_0x2e9db1,null))['then'](removeEntity(_0x2e9db1,null))[_0x0104('0x43')](handleError(_0x2e9db1,null));}; \ No newline at end of file +var _0xb586=['model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','rows','show','params','intersection','options','catch','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','keys','query','filters'];(function(_0x114d60,_0x462104){var _0x331ed5=function(_0x477082){while(--_0x477082){_0x114d60['push'](_0x114d60['shift']());}};_0x331ed5(++_0x462104);}(_0xb586,0x10c));var _0x6b58=function(_0x58de4a,_0x564dbc){_0x58de4a=_0x58de4a-0x0;var _0x178820=_0xb586[_0x58de4a];return _0x178820;};'use strict';var emlformat=require(_0x6b58('0x0'));var rimraf=require(_0x6b58('0x1'));var zipdir=require(_0x6b58('0x2'));var jsonpatch=require(_0x6b58('0x3'));var rp=require(_0x6b58('0x4'));var moment=require(_0x6b58('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6b58('0x6'));var util=require(_0x6b58('0x7'));var path=require(_0x6b58('0x8'));var sox=require(_0x6b58('0x9'));var csv=require(_0x6b58('0xa'));var ejs=require(_0x6b58('0xb'));var fs=require('fs');var fs_extra=require(_0x6b58('0xc'));var _=require(_0x6b58('0xd'));var squel=require(_0x6b58('0xe'));var crypto=require(_0x6b58('0xf'));var jsforce=require(_0x6b58('0x10'));var deskjs=require(_0x6b58('0x11'));var toCsv=require(_0x6b58('0xa'));var querystring=require(_0x6b58('0x12'));var Papa=require(_0x6b58('0x13'));var Redis=require(_0x6b58('0x14'));var authService=require(_0x6b58('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b58('0x16'));var logger=require(_0x6b58('0x17'))(_0x6b58('0x18'));var utils=require(_0x6b58('0x19'));var config=require(_0x6b58('0x1a'));var licenseUtil=require(_0x6b58('0x1b'));var db=require(_0x6b58('0x1c'))['db'];function respondWithStatusCode(_0x169ed8,_0x1a57a2){_0x1a57a2=_0x1a57a2||0xcc;return function(_0x2bcbaf){if(_0x2bcbaf){return _0x169ed8[_0x6b58('0x1d')](_0x1a57a2);}return _0x169ed8[_0x6b58('0x1e')](_0x1a57a2)[_0x6b58('0x1f')]();};}function respondWithResult(_0x444e98,_0x1a1f75){_0x1a1f75=_0x1a1f75||0xc8;return function(_0x32d10e){if(_0x32d10e){return _0x444e98[_0x6b58('0x1e')](_0x1a1f75)['json'](_0x32d10e);}};}function respondWithFilteredResult(_0x2fb620,_0xe4b29e){return function(_0x4dc4d6){if(_0x4dc4d6){var _0x4bf4b1=typeof _0xe4b29e[_0x6b58('0x20')]===_0x6b58('0x21')&&typeof _0xe4b29e[_0x6b58('0x22')]==='undefined';var _0x4bfb8c=_0x4dc4d6['count'];var _0x4e32d0=_0x4bf4b1?0x0:_0xe4b29e[_0x6b58('0x20')];var _0x109f70=_0x4bf4b1?_0x4dc4d6['count']:_0xe4b29e[_0x6b58('0x20')]+_0xe4b29e['limit'];var _0x38f81c;if(_0x109f70>=_0x4bfb8c){_0x109f70=_0x4bfb8c;_0x38f81c=0xc8;}else{_0x38f81c=0xce;}_0x2fb620[_0x6b58('0x1e')](_0x38f81c);return _0x2fb620['set'](_0x6b58('0x23'),_0x4e32d0+'-'+_0x109f70+'/'+_0x4bfb8c)[_0x6b58('0x24')](_0x4dc4d6);}return null;};}function patchUpdates(_0x4e943b){return function(_0x4c9a7f){try{jsonpatch[_0x6b58('0x25')](_0x4c9a7f,_0x4e943b,!![]);}catch(_0x1c6de8){return BPromise[_0x6b58('0x26')](_0x1c6de8);}return _0x4c9a7f[_0x6b58('0x27')]();};}function saveUpdates(_0x141783,_0x922fa3){return function(_0x1f39cf){if(_0x1f39cf){return _0x1f39cf['update'](_0x141783)[_0x6b58('0x28')](function(_0xb761c8){return _0xb761c8;});}return null;};}function removeEntity(_0x461bf3,_0x1f0214){return function(_0x4e1c74){if(_0x4e1c74){return _0x4e1c74[_0x6b58('0x29')]()[_0x6b58('0x28')](function(){_0x461bf3[_0x6b58('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x74da0a,_0x61b473){return function(_0x275d70){if(!_0x275d70){_0x74da0a[_0x6b58('0x1d')](0x194);}return _0x275d70;};}function handleError(_0x3f8614,_0xdc2216){_0xdc2216=_0xdc2216||0x1f4;return function(_0x9c2b40){logger[_0x6b58('0x2a')](_0x9c2b40[_0x6b58('0x2b')]);if(_0x9c2b40[_0x6b58('0x2c')]){delete _0x9c2b40[_0x6b58('0x2c')];}_0x3f8614[_0x6b58('0x1e')](_0xdc2216)[_0x6b58('0x2d')](_0x9c2b40);};}exports[_0x6b58('0x2e')]=function(_0x39ec00,_0x41204c){var _0x4a508c={},_0x1de712={},_0xabf9eb={'count':0x0,'rows':[]};var _0x2bea0b=_[_0x6b58('0x2f')](db[_0x6b58('0x30')][_0x6b58('0x31')],function(_0x5138cc){return{'name':_0x5138cc[_0x6b58('0x32')],'type':_0x5138cc[_0x6b58('0x33')][_0x6b58('0x34')]};});_0x1de712['model']=_[_0x6b58('0x2f')](_0x2bea0b,_0x6b58('0x2c'));_0x1de712['query']=_[_0x6b58('0x35')](_0x39ec00[_0x6b58('0x36')]);_0x1de712[_0x6b58('0x37')]=_['intersection'](_0x1de712[_0x6b58('0x38')],_0x1de712[_0x6b58('0x36')]);_0x4a508c['attributes']=_['intersection'](_0x1de712[_0x6b58('0x38')],qs[_0x6b58('0x39')](_0x39ec00[_0x6b58('0x36')][_0x6b58('0x39')]));_0x4a508c[_0x6b58('0x3a')]=_0x4a508c[_0x6b58('0x3a')][_0x6b58('0x3b')]?_0x4a508c[_0x6b58('0x3a')]:_0x1de712[_0x6b58('0x38')];if(!_0x39ec00[_0x6b58('0x36')][_0x6b58('0x3c')](_0x6b58('0x3d'))){_0x4a508c[_0x6b58('0x22')]=qs[_0x6b58('0x22')](_0x39ec00[_0x6b58('0x36')][_0x6b58('0x22')]);_0x4a508c[_0x6b58('0x20')]=qs[_0x6b58('0x20')](_0x39ec00[_0x6b58('0x36')][_0x6b58('0x20')]);}_0x4a508c['order']=qs[_0x6b58('0x3e')](_0x39ec00['query'][_0x6b58('0x3e')]);_0x4a508c[_0x6b58('0x3f')]=qs[_0x6b58('0x37')](_[_0x6b58('0x40')](_0x39ec00[_0x6b58('0x36')],_0x1de712[_0x6b58('0x37')]),_0x2bea0b);if(_0x39ec00[_0x6b58('0x36')][_0x6b58('0x41')]){_0x4a508c[_0x6b58('0x3f')]=_[_0x6b58('0x42')](_0x4a508c['where'],{'$or':_['map'](_0x2bea0b,function(_0x28e85c){if(_0x28e85c['type']!==_0x6b58('0x43')){var _0x5a2588={};_0x5a2588[_0x28e85c[_0x6b58('0x2c')]]={'$like':'%'+_0x39ec00[_0x6b58('0x36')]['filter']+'%'};return _0x5a2588;}})});}_0x4a508c=_[_0x6b58('0x42')]({},_0x4a508c,_0x39ec00['options']);var _0x5dab07={'where':_0x4a508c['where']};return db[_0x6b58('0x30')][_0x6b58('0x44')](_0x5dab07)['then'](function(_0x25ff17){_0xabf9eb['count']=_0x25ff17;if(_0x39ec00['query'][_0x6b58('0x45')]){_0x4a508c[_0x6b58('0x46')]=[{'all':!![]}];}return db[_0x6b58('0x30')]['findAll'](_0x4a508c);})[_0x6b58('0x28')](function(_0x12932e){_0xabf9eb[_0x6b58('0x47')]=_0x12932e;return _0xabf9eb;})[_0x6b58('0x28')](respondWithFilteredResult(_0x41204c,_0x4a508c))['catch'](handleError(_0x41204c,null));};exports[_0x6b58('0x48')]=function(_0x4a9f35,_0x2e9139){var _0x2f63f3={'raw':!![],'where':{'id':_0x4a9f35[_0x6b58('0x49')]['id']}},_0x30616a={};_0x30616a[_0x6b58('0x38')]=_['keys'](db['SalesforceField'][_0x6b58('0x31')]);_0x30616a[_0x6b58('0x36')]=_[_0x6b58('0x35')](_0x4a9f35[_0x6b58('0x36')]);_0x30616a[_0x6b58('0x37')]=_[_0x6b58('0x4a')](_0x30616a['model'],_0x30616a[_0x6b58('0x36')]);_0x2f63f3[_0x6b58('0x3a')]=_['intersection'](_0x30616a[_0x6b58('0x38')],qs[_0x6b58('0x39')](_0x4a9f35[_0x6b58('0x36')][_0x6b58('0x39')]));_0x2f63f3[_0x6b58('0x3a')]=_0x2f63f3[_0x6b58('0x3a')][_0x6b58('0x3b')]?_0x2f63f3[_0x6b58('0x3a')]:_0x30616a['model'];if(_0x4a9f35[_0x6b58('0x36')][_0x6b58('0x45')]){_0x2f63f3['include']=[{'all':!![]}];}_0x2f63f3=_[_0x6b58('0x42')]({},_0x2f63f3,_0x4a9f35[_0x6b58('0x4b')]);return db[_0x6b58('0x30')]['find'](_0x2f63f3)[_0x6b58('0x28')](handleEntityNotFound(_0x2e9139,null))[_0x6b58('0x28')](respondWithResult(_0x2e9139,null))[_0x6b58('0x4c')](handleError(_0x2e9139,null));};exports[_0x6b58('0x4d')]=function(_0x536e28,_0x43b899){return db[_0x6b58('0x30')][_0x6b58('0x4d')](_0x536e28[_0x6b58('0x4e')],{})[_0x6b58('0x28')](respondWithResult(_0x43b899,0xc9))[_0x6b58('0x4c')](handleError(_0x43b899,null));};exports[_0x6b58('0x4f')]=function(_0x1e60f2,_0x1aa238){if(_0x1e60f2[_0x6b58('0x4e')]['id']){delete _0x1e60f2[_0x6b58('0x4e')]['id'];}return db[_0x6b58('0x30')][_0x6b58('0x50')]({'where':{'id':_0x1e60f2[_0x6b58('0x49')]['id']}})[_0x6b58('0x28')](handleEntityNotFound(_0x1aa238,null))[_0x6b58('0x28')](saveUpdates(_0x1e60f2[_0x6b58('0x4e')],null))['then'](respondWithResult(_0x1aa238,null))[_0x6b58('0x4c')](handleError(_0x1aa238,null));};exports[_0x6b58('0x29')]=function(_0x426215,_0x51c52a){return db[_0x6b58('0x30')][_0x6b58('0x50')]({'where':{'id':_0x426215[_0x6b58('0x49')]['id']}})[_0x6b58('0x28')](handleEntityNotFound(_0x51c52a,null))[_0x6b58('0x28')](removeEntity(_0x51c52a,null))[_0x6b58('0x4c')](handleError(_0x51c52a,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 4f09950..fd996ae 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 _0x3650=['int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0x3650,0x19c));var _0x0365=function(_0x2a9436,_0x42d66e){_0x2a9436=_0x2a9436-0x0;var _0x2955f9=_0x3650[_0x2a9436];return _0x2955f9;};'use strict';var _=require(_0x0365('0x0'));var util=require(_0x0365('0x1'));var logger=require(_0x0365('0x2'))(_0x0365('0x3'));var moment=require('moment');var BPromise=require(_0x0365('0x4'));var rp=require(_0x0365('0x5'));var fs=require('fs');var path=require(_0x0365('0x6'));var rimraf=require(_0x0365('0x7'));var config=require(_0x0365('0x8'));var attributes=require(_0x0365('0x9'));module[_0x0365('0xa')]=function(_0xcd38df,_0x2a7230){return _0xcd38df[_0x0365('0xb')](_0x0365('0xc'),attributes,{'tableName':_0x0365('0xd'),'paranoid':![],'indexes':[{'name':_0x0365('0xe'),'fields':[_0x0365('0xf'),_0x0365('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9bc7=['request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','idField','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x51e2bd,_0x351253){var _0x4f0b14=function(_0x52abb9){while(--_0x52abb9){_0x51e2bd['push'](_0x51e2bd['shift']());}};_0x4f0b14(++_0x351253);}(_0x9bc7,0xda));var _0x79bc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9bc7[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x79bc('0x0'));var util=require(_0x79bc('0x1'));var logger=require(_0x79bc('0x2'))(_0x79bc('0x3'));var moment=require(_0x79bc('0x4'));var BPromise=require(_0x79bc('0x5'));var rp=require(_0x79bc('0x6'));var fs=require('fs');var path=require(_0x79bc('0x7'));var rimraf=require(_0x79bc('0x8'));var config=require(_0x79bc('0x9'));var attributes=require(_0x79bc('0xa'));module[_0x79bc('0xb')]=function(_0x45a333,_0x3795da){return _0x45a333[_0x79bc('0xc')](_0x79bc('0xd'),attributes,{'tableName':_0x79bc('0xe'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x79bc('0xf'),'FieldId'],'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 89acec8..c4b5a2d 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 _0xf109=['util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x570945,_0x2fd25b){var _0x979ec4=function(_0x4dbe7e){while(--_0x4dbe7e){_0x570945['push'](_0x570945['shift']());}};_0x979ec4(++_0x2fd25b);}(_0xf109,0xce));var _0x9f10=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xf109[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var moment=require(_0x9f10('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f10('0x3'))['db'];var utils=require(_0x9f10('0x4'));var logger=require(_0x9f10('0x5'))(_0x9f10('0x6'));var config=require(_0x9f10('0x7'));var jayson=require(_0x9f10('0x8'));var client=jayson[_0x9f10('0x9')][_0x9f10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x227a29,_0x2a877e,_0x3fd82f){return new BPromise(function(_0x5c8719,_0x42a8cd){return client[_0x9f10('0xb')](_0x227a29,_0x3fd82f)[_0x9f10('0xc')](function(_0x1bde2e){logger[_0x9f10('0xd')]('SalesforceField,\x20%s,\x20%s',_0x2a877e,_0x9f10('0xe'));logger[_0x9f10('0xf')](_0x9f10('0x10'),_0x2a877e,'request\x20sent',JSON['stringify'](_0x1bde2e));if(_0x1bde2e[_0x9f10('0x11')]){if(_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x12')]===0x1f4){logger['error'](_0x9f10('0x13'),_0x2a877e,_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x14')]);return _0x42a8cd(_0x1bde2e['error'][_0x9f10('0x14')]);}logger[_0x9f10('0x11')]('SalesforceField,\x20%s,\x20%s',_0x2a877e,_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x14')]);return _0x5c8719(_0x1bde2e['error']['message']);}else{logger[_0x9f10('0xd')](_0x9f10('0x13'),_0x2a877e,'request\x20sent');_0x5c8719(_0x1bde2e[_0x9f10('0x15')]['message']);}})[_0x9f10('0x16')](function(_0x1f68d8){logger['error'](_0x9f10('0x13'),_0x2a877e,_0x1f68d8);_0x42a8cd(_0x1f68d8);});});} \ No newline at end of file +var _0xb7e7=['SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x25bfee,_0x1a764d){var _0x2df7e4=function(_0x34d0e2){while(--_0x34d0e2){_0x25bfee['push'](_0x25bfee['shift']());}};_0x2df7e4(++_0x1a764d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb7e7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('SalesforceField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 42ddf22..c7244b5 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 _0xf7b4=['destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','put','update'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xf7b4,0x152));var _0x4f7b=function(_0x276c56,_0x4b6105){_0x276c56=_0x276c56-0x0;var _0x37c7d5=_0xf7b4[_0x276c56];return _0x37c7d5;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f7b('0x3'));var interaction=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var controller=require(_0x4f7b('0x6'));router[_0x4f7b('0x7')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x9')]);router[_0x4f7b('0x7')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xb')]);router[_0x4f7b('0x7')](_0x4f7b('0xc'),auth['isAuthenticated'](),controller[_0x4f7b('0xd')]);router[_0x4f7b('0x7')]('/:id/fields',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xe')]);router[_0x4f7b('0xf')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x10')]);router['post'](_0x4f7b('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x4f7b('0x11')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x12')]);router['delete'](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x13')]);module[_0x4f7b('0x14')]=router; \ No newline at end of file +var _0x93e9=['post','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x34843c,_0x14f6d3){var _0x256767=function(_0x2c814e){while(--_0x2c814e){_0x34843c['push'](_0x34843c['shift']());}};_0x256767(++_0x14f6d3);}(_0x93e9,0xcc));var _0x993e=function(_0x11f46e,_0x5b89cb){_0x11f46e=_0x11f46e-0x0;var _0x21f0fe=_0x93e9[_0x11f46e];return _0x21f0fe;};'use strict';var multer=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var path=require(_0x993e('0x2'));var timeout=require(_0x993e('0x3'));var express=require(_0x993e('0x4'));var router=express[_0x993e('0x5')]();var fs_extra=require(_0x993e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x993e('0x7'));var controller=require(_0x993e('0x8'));router[_0x993e('0x9')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xb')]);router[_0x993e('0x9')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['show']);router[_0x993e('0x9')](_0x993e('0xd'),auth[_0x993e('0xa')](),controller[_0x993e('0xe')]);router[_0x993e('0x9')](_0x993e('0xf'),auth[_0x993e('0xa')](),controller['getFields']);router[_0x993e('0x10')]('/',auth[_0x993e('0xa')](),controller['create']);router['post'](_0x993e('0xd'),auth['isAuthenticated'](),controller[_0x993e('0x11')]);router['put']('/:id',auth[_0x993e('0xa')](),controller[_0x993e('0x12')]);router[_0x993e('0x13')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller[_0x993e('0x14')]);module[_0x993e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index b97c331..35266a9 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 _0xaf3c=['STRING','username','sequelize','exports'];(function(_0x341978,_0x3c8166){var _0x14612e=function(_0x428658){while(--_0x428658){_0x341978['push'](_0x341978['shift']());}};_0x14612e(++_0x3c8166);}(_0xaf3c,0x126));var _0xcaf3=function(_0x32be87,_0x4dcf0a){_0x32be87=_0x32be87-0x0;var _0xb6f8f=_0xaf3c[_0x32be87];return _0xb6f8f;};'use strict';var Sequelize=require(_0xcaf3('0x0'));module[_0xcaf3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcaf3('0x2')]},'username':{'type':Sequelize[_0xcaf3('0x2')],'unique':_0xcaf3('0x3')},'password':{'type':Sequelize[_0xcaf3('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xcaf3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x337d=['STRING'];(function(_0x28f117,_0x846dc1){var _0x5797a0=function(_0x1f37d7){while(--_0x1f37d7){_0x28f117['push'](_0x28f117['shift']());}};_0x5797a0(++_0x846dc1);}(_0x337d,0xd4));var _0xd337=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x337d[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd337('0x0')],'unique':'username'},'password':{'type':Sequelize[_0xd337('0x0')]},'email':{'type':Sequelize[_0xd337('0x0')]},'remoteUri':{'type':Sequelize[_0xd337('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index c0feaa6..3992539 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 _0xceee=['index','map','ServicenowAccount','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','rawAttributes','fields','includeAll','create','body','find','getConfigurations','ServicenowConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','close_code','notify','incident_state','category','parent','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','caller_id','approval_set','subcategory','short_description','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','log','assign','remove','includes','internalType','label','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','push','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','false','inactive','value','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','reject','save','update','destroy','stack','name','send'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xceee,0x157));var _0xecee=function(_0x4bf28e,_0x1d7b2d){_0x4bf28e=_0x4bf28e-0x0;var _0x52c5a6=_0xceee[_0x4bf28e];return _0x52c5a6;};'use strict';var emlformat=require(_0xecee('0x0'));var rimraf=require(_0xecee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xecee('0x2'));var rp=require(_0xecee('0x3'));var moment=require('moment');var BPromise=require(_0xecee('0x4'));var Mustache=require(_0xecee('0x5'));var util=require(_0xecee('0x6'));var path=require(_0xecee('0x7'));var sox=require(_0xecee('0x8'));var csv=require(_0xecee('0x9'));var ejs=require(_0xecee('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xecee('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xecee('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xecee('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xecee('0xd'));var as=require(_0xecee('0xe'));var hardwareService=require(_0xecee('0xf'));var logger=require(_0xecee('0x10'))(_0xecee('0x11'));var utils=require('../../config/utils');var config=require(_0xecee('0x12'));var licenseUtil=require(_0xecee('0x13'));var db=require(_0xecee('0x14'))['db'];var integrations=require(_0xecee('0x15'));var jayson=require(_0xecee('0x16'));var client=jayson[_0xecee('0x17')][_0xecee('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x350b66,_0x5640b0,_0x44f2e2,_0x14474e){return new BPromise(function(_0x44eedb,_0x337d8a){var _0x18779f=_0x14474e||client;return _0x18779f[_0xecee('0x19')](_0x350b66,_0x44f2e2)[_0xecee('0x1a')](function(_0x37f7d0){logger[_0xecee('0x1b')](_0xecee('0x1c'),_0x5640b0,_0xecee('0x1d'));logger[_0xecee('0x1e')](_0xecee('0x1f'),_0x5640b0,_0xecee('0x1d'),JSON[_0xecee('0x20')](_0x37f7d0));if(_0x37f7d0[_0xecee('0x21')]){if(_0x37f7d0[_0xecee('0x21')][_0xecee('0x22')]===0x1f4){logger[_0xecee('0x21')](_0xecee('0x1c'),_0x5640b0,_0x37f7d0[_0xecee('0x21')]['message']);return _0x337d8a(_0x37f7d0['error'][_0xecee('0x23')]);}logger[_0xecee('0x21')]('ServicenowAccount,\x20%s,\x20%s',_0x5640b0,_0x37f7d0[_0xecee('0x21')][_0xecee('0x23')]);return _0x44eedb(_0x37f7d0[_0xecee('0x21')][_0xecee('0x23')]);}else{logger[_0xecee('0x1b')](_0xecee('0x1c'),_0x5640b0,'request\x20sent');_0x44eedb(_0x37f7d0[_0xecee('0x24')][_0xecee('0x23')]);}})[_0xecee('0x25')](function(_0x136d31){logger['error'](_0xecee('0x1c'),_0x5640b0,_0x136d31);_0x337d8a(_0x136d31);});});}function respondWithStatusCode(_0x28e6b3,_0x487caa){_0x487caa=_0x487caa||0xcc;return function(_0x244aad){if(_0x244aad){return _0x28e6b3[_0xecee('0x26')](_0x487caa);}return _0x28e6b3['status'](_0x487caa)[_0xecee('0x27')]();};}function respondWithResult(_0x242210,_0x31fc3c){_0x31fc3c=_0x31fc3c||0xc8;return function(_0x730549){if(_0x730549){return _0x242210[_0xecee('0x28')](_0x31fc3c)[_0xecee('0x29')](_0x730549);}};}function respondWithFilteredResult(_0x52c632,_0x1e8bc5){return function(_0x5aba6e){if(_0x5aba6e){var _0xf1aa5e=typeof _0x1e8bc5[_0xecee('0x2a')]===_0xecee('0x2b')&&typeof _0x1e8bc5[_0xecee('0x2c')]==='undefined';var _0x1e9f18=_0x5aba6e[_0xecee('0x2d')];var _0x21a5de=_0xf1aa5e?0x0:_0x1e8bc5['offset'];var _0x3706af=_0xf1aa5e?_0x5aba6e[_0xecee('0x2d')]:_0x1e8bc5[_0xecee('0x2a')]+_0x1e8bc5[_0xecee('0x2c')];var _0x228ac8;if(_0x3706af>=_0x1e9f18){_0x3706af=_0x1e9f18;_0x228ac8=0xc8;}else{_0x228ac8=0xce;}_0x52c632[_0xecee('0x28')](_0x228ac8);return _0x52c632['set']('Content-Range',_0x21a5de+'-'+_0x3706af+'/'+_0x1e9f18)[_0xecee('0x29')](_0x5aba6e);}return null;};}function patchUpdates(_0x3cb1da){return function(_0xa83d52){try{jsonpatch['apply'](_0xa83d52,_0x3cb1da,!![]);}catch(_0x333b4f){return BPromise[_0xecee('0x2e')](_0x333b4f);}return _0xa83d52[_0xecee('0x2f')]();};}function saveUpdates(_0x2dec72,_0x93fdd2){return function(_0x125135){if(_0x125135){return _0x125135[_0xecee('0x30')](_0x2dec72)[_0xecee('0x1a')](function(_0x264902){return _0x264902;});}return null;};}function removeEntity(_0x54a3ae,_0x3622ef){return function(_0x1ddaf1){if(_0x1ddaf1){return _0x1ddaf1[_0xecee('0x31')]()[_0xecee('0x1a')](function(){_0x54a3ae[_0xecee('0x28')](0xcc)[_0xecee('0x27')]();});}};}function handleEntityNotFound(_0x18cb40,_0x21f58c){return function(_0x456971){if(!_0x456971){_0x18cb40[_0xecee('0x26')](0x194);}return _0x456971;};}function handleError(_0x127e81,_0x192114){_0x192114=_0x192114||0x1f4;return function(_0x5b633b){logger[_0xecee('0x21')](_0x5b633b[_0xecee('0x32')]);if(_0x5b633b['name']){delete _0x5b633b[_0xecee('0x33')];}_0x127e81[_0xecee('0x28')](_0x192114)[_0xecee('0x34')](_0x5b633b);};}exports[_0xecee('0x35')]=function(_0x11e21c,_0x179e75){var _0x588df9={},_0x4cb731={},_0x38fd10={'count':0x0,'rows':[]};var _0x3f8fc1=_[_0xecee('0x36')](db[_0xecee('0x37')]['rawAttributes'],function(_0x4501aa){return{'name':_0x4501aa[_0xecee('0x38')],'type':_0x4501aa[_0xecee('0x39')][_0xecee('0x3a')]};});_0x4cb731[_0xecee('0x3b')]=_['map'](_0x3f8fc1,'name');_0x4cb731[_0xecee('0x3c')]=_[_0xecee('0x3d')](_0x11e21c[_0xecee('0x3c')]);_0x4cb731['filters']=_[_0xecee('0x3e')](_0x4cb731[_0xecee('0x3b')],_0x4cb731['query']);_0x588df9[_0xecee('0x3f')]=_['intersection'](_0x4cb731[_0xecee('0x3b')],qs['fields'](_0x11e21c[_0xecee('0x3c')]['fields']));_0x588df9[_0xecee('0x3f')]=_0x588df9['attributes'][_0xecee('0x40')]?_0x588df9['attributes']:_0x4cb731['model'];if(!_0x11e21c[_0xecee('0x3c')][_0xecee('0x41')](_0xecee('0x42'))){_0x588df9['limit']=qs[_0xecee('0x2c')](_0x11e21c[_0xecee('0x3c')][_0xecee('0x2c')]);_0x588df9[_0xecee('0x2a')]=qs[_0xecee('0x2a')](_0x11e21c[_0xecee('0x3c')][_0xecee('0x2a')]);}_0x588df9[_0xecee('0x43')]=qs[_0xecee('0x44')](_0x11e21c['query']['sort']);_0x588df9[_0xecee('0x45')]=qs['filters'](_[_0xecee('0x46')](_0x11e21c[_0xecee('0x3c')],_0x4cb731[_0xecee('0x47')]),_0x3f8fc1);if(_0x11e21c['query'][_0xecee('0x48')]){_0x588df9[_0xecee('0x45')]=_['merge'](_0x588df9['where'],{'$or':_['map'](_0x3f8fc1,function(_0x1780c2){if(_0x1780c2[_0xecee('0x39')]!==_0xecee('0x49')){var _0x15282f={};_0x15282f[_0x1780c2[_0xecee('0x33')]]={'$like':'%'+_0x11e21c[_0xecee('0x3c')][_0xecee('0x48')]+'%'};return _0x15282f;}})});}_0x588df9=_[_0xecee('0x4a')]({},_0x588df9,_0x11e21c[_0xecee('0x4b')]);var _0x4226e3={'where':_0x588df9['where']};return db[_0xecee('0x37')]['count'](_0x4226e3)[_0xecee('0x1a')](function(_0x40e8e7){_0x38fd10[_0xecee('0x2d')]=_0x40e8e7;if(_0x11e21c['query']['includeAll']){_0x588df9[_0xecee('0x4c')]=[{'all':!![]}];}return db[_0xecee('0x37')][_0xecee('0x4d')](_0x588df9);})[_0xecee('0x1a')](function(_0x6b3ad4){_0x38fd10[_0xecee('0x4e')]=_0x6b3ad4;return _0x38fd10;})['then'](respondWithFilteredResult(_0x179e75,_0x588df9))['catch'](handleError(_0x179e75,null));};exports[_0xecee('0x4f')]=function(_0x460195,_0xc50c34){var _0xea849c={'raw':![],'where':{'id':_0x460195[_0xecee('0x50')]['id']}},_0xbda402={};_0xbda402[_0xecee('0x3b')]=_[_0xecee('0x3d')](db[_0xecee('0x37')][_0xecee('0x51')]);_0xbda402['query']=_[_0xecee('0x3d')](_0x460195[_0xecee('0x3c')]);_0xbda402[_0xecee('0x47')]=_['intersection'](_0xbda402[_0xecee('0x3b')],_0xbda402[_0xecee('0x3c')]);_0xea849c[_0xecee('0x3f')]=_[_0xecee('0x3e')](_0xbda402[_0xecee('0x3b')],qs[_0xecee('0x52')](_0x460195['query'][_0xecee('0x52')]));_0xea849c[_0xecee('0x3f')]=_0xea849c['attributes'][_0xecee('0x40')]?_0xea849c['attributes']:_0xbda402[_0xecee('0x3b')];if(_0x460195[_0xecee('0x3c')][_0xecee('0x53')]){_0xea849c[_0xecee('0x4c')]=[{'all':!![]}];}_0xea849c=_['merge']({},_0xea849c,_0x460195[_0xecee('0x4b')]);return db[_0xecee('0x37')]['find'](_0xea849c)[_0xecee('0x1a')](handleEntityNotFound(_0xc50c34,null))[_0xecee('0x1a')](respondWithResult(_0xc50c34,null))[_0xecee('0x25')](handleError(_0xc50c34,null));};exports[_0xecee('0x54')]=function(_0x5bf9a6,_0x48a4f3){return db[_0xecee('0x37')]['create'](_0x5bf9a6['body'],{})[_0xecee('0x1a')](respondWithResult(_0x48a4f3,0xc9))['catch'](handleError(_0x48a4f3,null));};exports[_0xecee('0x30')]=function(_0x577176,_0x3080fd){if(_0x577176[_0xecee('0x55')]['id']){delete _0x577176['body']['id'];}return db[_0xecee('0x37')][_0xecee('0x56')]({'where':{'id':_0x577176['params']['id']}})[_0xecee('0x1a')](handleEntityNotFound(_0x3080fd,null))['then'](saveUpdates(_0x577176['body'],null))[_0xecee('0x1a')](respondWithResult(_0x3080fd,null))[_0xecee('0x25')](handleError(_0x3080fd,null));};exports[_0xecee('0x31')]=function(_0x5d3991,_0x5b669e){return db[_0xecee('0x37')][_0xecee('0x56')]({'where':{'id':_0x5d3991[_0xecee('0x50')]['id']}})[_0xecee('0x1a')](handleEntityNotFound(_0x5b669e,null))[_0xecee('0x1a')](removeEntity(_0x5b669e,null))[_0xecee('0x25')](handleError(_0x5b669e,null));};exports[_0xecee('0x57')]=function(_0x23dce1,_0x4c1007,_0x5e93d5){var _0x5a5be9={};var _0x15068={};var _0x3ceea6;var _0x15f2a8;return db[_0xecee('0x37')]['findOne']({'where':{'id':_0x23dce1[_0xecee('0x50')]['id']}})[_0xecee('0x1a')](handleEntityNotFound(_0x4c1007,null))['then'](function(_0x1cb473){if(_0x1cb473){_0x3ceea6=_0x1cb473;_0x15068[_0xecee('0x3b')]=_[_0xecee('0x3d')](db[_0xecee('0x58')][_0xecee('0x51')]);_0x15068[_0xecee('0x3c')]=_['keys'](_0x23dce1[_0xecee('0x3c')]);_0x15068[_0xecee('0x47')]=_[_0xecee('0x3e')](_0x15068[_0xecee('0x3b')],_0x15068[_0xecee('0x3c')]);_0x5a5be9[_0xecee('0x3f')]=_['intersection'](_0x15068[_0xecee('0x3b')],qs[_0xecee('0x52')](_0x23dce1[_0xecee('0x3c')]['fields']));_0x5a5be9['attributes']=_0x5a5be9[_0xecee('0x3f')][_0xecee('0x40')]?_0x5a5be9[_0xecee('0x3f')]:_0x15068[_0xecee('0x3b')];_0x5a5be9[_0xecee('0x43')]=qs[_0xecee('0x44')](_0x23dce1[_0xecee('0x3c')][_0xecee('0x44')]);_0x5a5be9[_0xecee('0x45')]=qs['filters'](_[_0xecee('0x46')](_0x23dce1[_0xecee('0x3c')],_0x15068['filters']));if(_0x23dce1['query'][_0xecee('0x48')]){_0x5a5be9[_0xecee('0x45')]=_[_0xecee('0x4a')](_0x5a5be9[_0xecee('0x45')],{'$or':_[_0xecee('0x36')](_0x5a5be9['attributes'],function(_0x1ce83f){var _0x5a0435={};_0x5a0435[_0x1ce83f]={'$like':'%'+_0x23dce1[_0xecee('0x3c')][_0xecee('0x48')]+'%'};return _0x5a0435;})});}_0x5a5be9=_[_0xecee('0x4a')]({},_0x5a5be9,_0x23dce1[_0xecee('0x4b')]);return _0x3ceea6[_0xecee('0x57')](_0x5a5be9);}})[_0xecee('0x1a')](function(_0xd05d2){if(_0xd05d2){_0x15f2a8=_0xd05d2['length'];if(!_0x23dce1[_0xecee('0x3c')][_0xecee('0x41')](_0xecee('0x42'))){_0x5a5be9[_0xecee('0x2c')]=qs[_0xecee('0x2c')](_0x23dce1['query'][_0xecee('0x2c')]);_0x5a5be9[_0xecee('0x2a')]=qs[_0xecee('0x2a')](_0x23dce1[_0xecee('0x3c')][_0xecee('0x2a')]);}return _0x3ceea6[_0xecee('0x57')](_0x5a5be9);}})[_0xecee('0x1a')](function(_0x24f6e3){if(_0x24f6e3){return _0x24f6e3?{'count':_0x15f2a8,'rows':_0x24f6e3}:null;}})[_0xecee('0x1a')](respondWithResult(_0x4c1007,null))[_0xecee('0x25')](handleError(_0x4c1007,null));};exports['addConfiguration']=function(_0x5f2206,_0x2d6c85,_0x5c4824){if(_0x5f2206[_0xecee('0x55')]['id']){delete _0x5f2206[_0xecee('0x55')]['id'];}return db[_0xecee('0x37')][_0xecee('0x59')]({'where':{'id':_0x5f2206[_0xecee('0x50')]['id']}})['then'](handleEntityNotFound(_0x2d6c85,null))[_0xecee('0x1a')](function(_0x3da5c3){if(_0x3da5c3){_0x5f2206['body'][_0xecee('0x5a')]=_0x3da5c3['id'];_0x5f2206[_0xecee('0x55')][_0xecee('0x5b')]=integrations['getSubjects'](_0x5f2206[_0xecee('0x55')][_0xecee('0x5c')],_0x5f2206[_0xecee('0x55')]['type']);_0x5f2206[_0xecee('0x55')][_0xecee('0x5d')]=integrations[_0xecee('0x5e')](_0x5f2206[_0xecee('0x55')]['channel'],_0x5f2206[_0xecee('0x55')][_0xecee('0x39')]);return db[_0xecee('0x58')][_0xecee('0x54')](_0x5f2206[_0xecee('0x55')],{'include':[{'model':db[_0xecee('0x5f')],'as':_0xecee('0x5b')},{'model':db[_0xecee('0x5f')],'as':'Descriptions'}]});}return null;})[_0xecee('0x1a')](respondWithResult(_0x2d6c85,null))[_0xecee('0x25')](handleError(_0x2d6c85,null));};exports[_0xecee('0x60')]=function(_0x2a4f49,_0x3409ac,_0x13f6e4){var _0x795fb5=[_0xecee('0x61'),_0xecee('0x62'),_0xecee('0x63'),'subcategory',_0xecee('0x64'),_0xecee('0x65'),_0xecee('0x66'),'severity',_0xecee('0x67')];var _0x5f466c=[_0xecee('0x68'),_0xecee('0x61'),'caused_by',_0xecee('0x69'),'upon_reject',_0xecee('0x6a'),_0xecee('0x6b'),'hold_reason',_0xecee('0x6c'),_0xecee('0x6d'),_0xecee('0x6e'),_0xecee('0x6f'),_0xecee('0x70'),_0xecee('0x71'),'sys_created_on','sys_domain','state','sys_created_by',_0xecee('0x63'),'order',_0xecee('0x72'),_0xecee('0x73'),_0xecee('0x74'),_0xecee('0x75'),_0xecee('0x76'),_0xecee('0x77'),_0xecee('0x78'),_0xecee('0x79'),_0xecee('0x7a'),_0xecee('0x7b'),'rfc',_0xecee('0x7c'),_0xecee('0x7d'),_0xecee('0x7e'),_0xecee('0x7f'),_0xecee('0x80'),_0xecee('0x81'),_0xecee('0x82'),'resolved_at',_0xecee('0x83'),_0xecee('0x84'),_0xecee('0x85'),'work_notes',_0xecee('0x86'),_0xecee('0x64'),_0xecee('0x87'),'delivery_task',_0xecee('0x88'),_0xecee('0x89'),_0xecee('0x8a'),_0xecee('0x8b'),_0xecee('0x8c'),_0xecee('0x8d'),_0xecee('0x65'),_0xecee('0x8e'),_0xecee('0x8f'),'closed_by',_0xecee('0x90'),_0xecee('0x91'),'sys_id',_0xecee('0x92'),_0xecee('0x93'),_0xecee('0x66'),_0xecee('0x94'),_0xecee('0x95'),_0xecee('0x96'),_0xecee('0x97'),_0xecee('0x98'),_0xecee('0x99'),_0xecee('0x9a'),_0xecee('0x9b'),_0xecee('0x9c'),_0xecee('0x9d'),_0xecee('0x9e'),'due_date',_0xecee('0x9f'),'reopen_count',_0xecee('0xa0'),_0xecee('0xa1'),_0xecee('0xa2'),_0xecee('0xa3'),_0xecee('0xa4'),_0xecee('0x67')];var _0x15b933='';var _0x1e1b03='';var _0x9cf7ef=[];var _0x10cc55='';var _0xf12f9b='';var _0x3b0116=[];var _0x49161a='';var _0x1d6abe='';var _0x33b654={};var _0x520b03='';return db[_0xecee('0x37')][_0xecee('0x59')]({'where':{'id':_0x2a4f49['params']['id']},'attributes':['id',_0xecee('0xa5'),_0xecee('0xa6'),_0xecee('0xa7'),'remoteUri',_0xecee('0xa8')]})['then'](handleEntityNotFound(_0x3409ac,null))[_0xecee('0x1a')](function(_0x432ca9){if(_0x432ca9){_0x520b03=_0x432ca9['remoteUri'];var _0x259c22=_0x520b03[_0xecee('0xa9')](-0x1);if(_0x259c22==='/'){_0x520b03=_0x520b03[_0xecee('0xaa')](0x0,_0x520b03[_0xecee('0xab')](_0x259c22));}_0x1d6abe=util[_0xecee('0xac')](_0xecee('0xad'),_0x520b03);_0x49161a=util['format']('%s/api/now/table/',_0x520b03);_0x33b654={'user':_0x432ca9[_0xecee('0xa5')],'pass':_0x432ca9[_0xecee('0xa6')]};var _0x1861bd={'method':_0xecee('0xae'),'uri':_0x1d6abe+_0xecee('0xaf'),'auth':_0x33b654,'json':!![]};return rp(_0x1861bd);}})[_0xecee('0x1a')](function(_0x3e3813){if(_0x3e3813[_0xecee('0x24')]['length']>0x0){_0x15b933=_0x3e3813[_0xecee('0x24')];}console[_0xecee('0xb0')]('incident\x20table\x20objects',_0x15b933);_0x3b0116=[];_0x1e1b03=Object[_0xecee('0xb1')]([],_0x15b933);_[_0xecee('0xb2')](_0x1e1b03,function(_0x4b7818){return!_0x795fb5[_0xecee('0xb3')](_0x4b7818[_0xecee('0x33')]);});_0x1e1b03['forEach'](function(_0xe31db2){var _0x4bb6bb=createFieldObject(_0x49161a,_0x33b654,_0xe31db2[_0xecee('0xb4')],_0xe31db2[_0xecee('0x33')],_0xe31db2[_0xecee('0xb5')],![]);_0x3b0116['push'](_0x4bb6bb);});return Promise[_0xecee('0xb6')](_0x3b0116);})[_0xecee('0x1a')](function(_0x1ef915){_0x9cf7ef=_0x1ef915;_0x10cc55=Object[_0xecee('0xb1')]([],_0x15b933);console[_0xecee('0xb0')](_0xecee('0xb7'),_0x15b933);_[_0xecee('0xb2')](_0x10cc55,function(_0x409c81){return _0x5f466c[_0xecee('0xb3')](_0x409c81[_0xecee('0x33')]);});console[_0xecee('0xb0')](_0xecee('0xb8'),_0x10cc55);_0x3b0116=[];_0x10cc55[_0xecee('0xb9')](function(_0x3336ae){var _0x1e365a=createFieldObject(_0x49161a,_0x33b654,_0x3336ae[_0xecee('0xb4')],_0x3336ae[_0xecee('0x33')],_0x3336ae[_0xecee('0xb5')],!![]);_0x3b0116[_0xecee('0xba')](_0x1e365a);});return Promise[_0xecee('0xb6')](_0x3b0116);})[_0xecee('0x1a')](function(_0x2d0be9){_0xf12f9b=_0x2d0be9;var _0x68d64d=_0x9cf7ef[_0xecee('0xbb')](_0xf12f9b);return{'count':_0x68d64d['length'],'rows':_0x68d64d};})[_0xecee('0x1a')](respondWithResult(_0x3409ac,null))[_0xecee('0x25')](function(_0x45f094){console['log'](_0xecee('0xbc')+_0x45f094);var _0x1c27e9=_0x2a4f49[_0xecee('0x3c')][_0xecee('0xbd')]?0x1f4:_0x45f094[_0xecee('0xbe')]||0x1f4;logger[_0xecee('0x21')](_0x45f094['stack']);delete _0x45f094['name'];if(_0x1c27e9===0x191){_0x1c27e9=0x190;}_0x3409ac['status'](_0x1c27e9)[_0xecee('0x34')](_0x2a4f49[_0xecee('0x3c')][_0xecee('0xbd')]?{'message':_0xecee('0xbf'),'statusCode':_0x45f094['statusCode']}:_0x45f094);});};function createFieldObject(_0x21e367,_0x271cfa,_0x1363b3,_0x2659a9,_0x37b797,_0x3ba2ca){return new Promise(function(_0x32a3a4,_0x5bc1f0){var _0x201cf8={'id':_0x2659a9,'name':_0x37b797,'custom':_0x3ba2ca};if(_0x1363b3===_0xecee('0xc0')){_0x201cf8[_0xecee('0x4b')]=[{'name':_0xecee('0xc1'),'value':_0xecee('0xc2')},{'name':'False','value':_0xecee('0xc3')}];_0x32a3a4(_0x201cf8);}else{var _0x41896f={'method':_0xecee('0xae'),'uri':_0x21e367+'sys_choice?sysparm_query=name=incident^element='+_0x2659a9,'auth':_0x271cfa,'json':!![]};return rp(_0x41896f)[_0xecee('0x1a')](function(_0x30fe8a){var _0x24f42e=[];if(_0x30fe8a[_0xecee('0x24')][_0xecee('0x40')]>0x0){_0x30fe8a['result']['forEach'](function(_0x3d2ecb){if(_0x3d2ecb[_0xecee('0xc4')]==='false'){var _0x4fadb8={'name':_0x3d2ecb[_0xecee('0xb5')],'value':_0x3d2ecb[_0xecee('0xc5')]};_0x24f42e[_0xecee('0xba')](_0x4fadb8);}});}_0x201cf8[_0xecee('0x4b')]=_0x24f42e;if(_0x201cf8[_0xecee('0x4b')][_0xecee('0x40')]>0x0){_0x32a3a4(_0x201cf8);}else{if(_0x3ba2ca==![]){_0x32a3a4();}else{_0x32a3a4(_0x201cf8);}}});}});} \ No newline at end of file +var _0xf5b1=['assign','includes','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','label','ServiceNow\x20error:\x20','test','statusCode','stack','Wrong\x20credentials','boolean','True','true','False','false','inactive','value','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','update','destroy','name','send','index','rawAttributes','type','key','model','map','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','query','order','sort','pick','merge','where','VIRTUAL','filter','options','ServicenowAccount','includeAll','include','findAll','catch','show','params','fields','create','body','find','getConfigurations','findOne','AccountId','Subjects','channel','Descriptions','ServicenowField','hold_reason','knowledge','subcategory','close_code','notify','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','delivery_plan','impact','active','work_notes_list','business_service','rfc','time_worked','expected_start','business_duration','work_end','reopened_time','resolved_at','caller_id','work_notes','short_description','correlation_display','work_start','additional_assignee_list','calendar_duration','sys_class_name','closed_by','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','company','activity_due','assigned_to','comments','approval','sys_mod_count','reopen_count','sys_tags','escalation','location','category','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects'];(function(_0x3b75ec,_0x1643c1){var _0x39f781=function(_0x1eadc0){while(--_0x1eadc0){_0x3b75ec['push'](_0x3b75ec['shift']());}};_0x39f781(++_0x1643c1);}(_0xf5b1,0xd4));var _0x1f5b=function(_0x3bb4d5,_0x3172a6){_0x3bb4d5=_0x3bb4d5-0x0;var _0x366c9b=_0xf5b1[_0x3bb4d5];return _0x366c9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1f5b('0x0'));var zipdir=require(_0x1f5b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f5b('0x2'));var moment=require(_0x1f5b('0x3'));var BPromise=require(_0x1f5b('0x4'));var Mustache=require(_0x1f5b('0x5'));var util=require(_0x1f5b('0x6'));var path=require(_0x1f5b('0x7'));var sox=require('sox');var csv=require(_0x1f5b('0x8'));var ejs=require(_0x1f5b('0x9'));var fs=require('fs');var fs_extra=require(_0x1f5b('0xa'));var _=require(_0x1f5b('0xb'));var squel=require('squel');var crypto=require(_0x1f5b('0xc'));var jsforce=require(_0x1f5b('0xd'));var deskjs=require(_0x1f5b('0xe'));var toCsv=require(_0x1f5b('0x8'));var querystring=require(_0x1f5b('0xf'));var Papa=require(_0x1f5b('0x10'));var Redis=require(_0x1f5b('0x11'));var authService=require(_0x1f5b('0x12'));var qs=require(_0x1f5b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f5b('0x14'));var logger=require(_0x1f5b('0x15'))(_0x1f5b('0x16'));var utils=require(_0x1f5b('0x17'));var config=require(_0x1f5b('0x18'));var licenseUtil=require(_0x1f5b('0x19'));var db=require(_0x1f5b('0x1a'))['db'];var integrations=require(_0x1f5b('0x1b'));var jayson=require(_0x1f5b('0x1c'));var client=jayson[_0x1f5b('0x1d')][_0x1f5b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1d711d,_0x1d58bf,_0x10a272,_0x215aa4){return new BPromise(function(_0x964313,_0x3b87b4){var _0x2098c5=_0x215aa4||client;return _0x2098c5['request'](_0x1d711d,_0x10a272)[_0x1f5b('0x1f')](function(_0x35d922){logger[_0x1f5b('0x20')](_0x1f5b('0x21'),_0x1d58bf,_0x1f5b('0x22'));logger[_0x1f5b('0x23')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1d58bf,_0x1f5b('0x22'),JSON[_0x1f5b('0x24')](_0x35d922));if(_0x35d922[_0x1f5b('0x25')]){if(_0x35d922[_0x1f5b('0x25')][_0x1f5b('0x26')]===0x1f4){logger[_0x1f5b('0x25')](_0x1f5b('0x21'),_0x1d58bf,_0x35d922['error'][_0x1f5b('0x27')]);return _0x3b87b4(_0x35d922[_0x1f5b('0x25')]['message']);}logger[_0x1f5b('0x25')](_0x1f5b('0x21'),_0x1d58bf,_0x35d922[_0x1f5b('0x25')][_0x1f5b('0x27')]);return _0x964313(_0x35d922[_0x1f5b('0x25')][_0x1f5b('0x27')]);}else{logger['info'](_0x1f5b('0x21'),_0x1d58bf,_0x1f5b('0x22'));_0x964313(_0x35d922['result'][_0x1f5b('0x27')]);}})['catch'](function(_0xe9f2e){logger[_0x1f5b('0x25')](_0x1f5b('0x21'),_0x1d58bf,_0xe9f2e);_0x3b87b4(_0xe9f2e);});});}function respondWithStatusCode(_0x1f9e8c,_0x5403da){_0x5403da=_0x5403da||0xcc;return function(_0x30153c){if(_0x30153c){return _0x1f9e8c['sendStatus'](_0x5403da);}return _0x1f9e8c[_0x1f5b('0x28')](_0x5403da)[_0x1f5b('0x29')]();};}function respondWithResult(_0xd30b10,_0x30a105){_0x30a105=_0x30a105||0xc8;return function(_0x22668b){if(_0x22668b){return _0xd30b10[_0x1f5b('0x28')](_0x30a105)['json'](_0x22668b);}};}function respondWithFilteredResult(_0x9bd2c9,_0x57ed3f){return function(_0x7abbe1){if(_0x7abbe1){var _0x59dfa9=typeof _0x57ed3f[_0x1f5b('0x2a')]==='undefined'&&typeof _0x57ed3f[_0x1f5b('0x2b')]===_0x1f5b('0x2c');var _0x220251=_0x7abbe1[_0x1f5b('0x2d')];var _0x3d0d93=_0x59dfa9?0x0:_0x57ed3f['offset'];var _0x434ed0=_0x59dfa9?_0x7abbe1[_0x1f5b('0x2d')]:_0x57ed3f[_0x1f5b('0x2a')]+_0x57ed3f[_0x1f5b('0x2b')];var _0x43ace3;if(_0x434ed0>=_0x220251){_0x434ed0=_0x220251;_0x43ace3=0xc8;}else{_0x43ace3=0xce;}_0x9bd2c9[_0x1f5b('0x28')](_0x43ace3);return _0x9bd2c9[_0x1f5b('0x2e')](_0x1f5b('0x2f'),_0x3d0d93+'-'+_0x434ed0+'/'+_0x220251)[_0x1f5b('0x30')](_0x7abbe1);}return null;};}function patchUpdates(_0x3bf183){return function(_0x26fbdb){try{jsonpatch[_0x1f5b('0x31')](_0x26fbdb,_0x3bf183,!![]);}catch(_0x9a11d0){return BPromise['reject'](_0x9a11d0);}return _0x26fbdb['save']();};}function saveUpdates(_0x4c220e,_0x5970f8){return function(_0x4f2ff1){if(_0x4f2ff1){return _0x4f2ff1[_0x1f5b('0x32')](_0x4c220e)['then'](function(_0x2b8bbb){return _0x2b8bbb;});}return null;};}function removeEntity(_0x375022,_0x4c4959){return function(_0x43603c){if(_0x43603c){return _0x43603c[_0x1f5b('0x33')]()[_0x1f5b('0x1f')](function(){_0x375022[_0x1f5b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ac74e,_0x1f1800){return function(_0x4ec4cd){if(!_0x4ec4cd){_0x3ac74e['sendStatus'](0x194);}return _0x4ec4cd;};}function handleError(_0x3b8350,_0x38a1be){_0x38a1be=_0x38a1be||0x1f4;return function(_0x2f6a2a){logger[_0x1f5b('0x25')](_0x2f6a2a['stack']);if(_0x2f6a2a[_0x1f5b('0x34')]){delete _0x2f6a2a[_0x1f5b('0x34')];}_0x3b8350[_0x1f5b('0x28')](_0x38a1be)[_0x1f5b('0x35')](_0x2f6a2a);};}exports[_0x1f5b('0x36')]=function(_0x522827,_0x656b0a){var _0x4a7081={},_0x454b53={},_0x5e45d6={'count':0x0,'rows':[]};var _0x34b8aa=_['map'](db['ServicenowAccount'][_0x1f5b('0x37')],function(_0x505ed8){return{'name':_0x505ed8['fieldName'],'type':_0x505ed8[_0x1f5b('0x38')][_0x1f5b('0x39')]};});_0x454b53[_0x1f5b('0x3a')]=_[_0x1f5b('0x3b')](_0x34b8aa,_0x1f5b('0x34'));_0x454b53['query']=_[_0x1f5b('0x3c')](_0x522827['query']);_0x454b53[_0x1f5b('0x3d')]=_[_0x1f5b('0x3e')](_0x454b53['model'],_0x454b53['query']);_0x4a7081[_0x1f5b('0x3f')]=_['intersection'](_0x454b53['model'],qs['fields'](_0x522827['query']['fields']));_0x4a7081[_0x1f5b('0x3f')]=_0x4a7081[_0x1f5b('0x3f')][_0x1f5b('0x40')]?_0x4a7081['attributes']:_0x454b53[_0x1f5b('0x3a')];if(!_0x522827['query'][_0x1f5b('0x41')](_0x1f5b('0x42'))){_0x4a7081[_0x1f5b('0x2b')]=qs[_0x1f5b('0x2b')](_0x522827[_0x1f5b('0x43')][_0x1f5b('0x2b')]);_0x4a7081[_0x1f5b('0x2a')]=qs['offset'](_0x522827[_0x1f5b('0x43')]['offset']);}_0x4a7081[_0x1f5b('0x44')]=qs['sort'](_0x522827[_0x1f5b('0x43')][_0x1f5b('0x45')]);_0x4a7081['where']=qs['filters'](_[_0x1f5b('0x46')](_0x522827[_0x1f5b('0x43')],_0x454b53['filters']),_0x34b8aa);if(_0x522827['query']['filter']){_0x4a7081['where']=_[_0x1f5b('0x47')](_0x4a7081[_0x1f5b('0x48')],{'$or':_['map'](_0x34b8aa,function(_0x3c1d1c){if(_0x3c1d1c[_0x1f5b('0x38')]!==_0x1f5b('0x49')){var _0x40f068={};_0x40f068[_0x3c1d1c[_0x1f5b('0x34')]]={'$like':'%'+_0x522827[_0x1f5b('0x43')][_0x1f5b('0x4a')]+'%'};return _0x40f068;}})});}_0x4a7081=_[_0x1f5b('0x47')]({},_0x4a7081,_0x522827[_0x1f5b('0x4b')]);var _0x58e106={'where':_0x4a7081[_0x1f5b('0x48')]};return db[_0x1f5b('0x4c')][_0x1f5b('0x2d')](_0x58e106)[_0x1f5b('0x1f')](function(_0x55ee27){_0x5e45d6[_0x1f5b('0x2d')]=_0x55ee27;if(_0x522827['query'][_0x1f5b('0x4d')]){_0x4a7081[_0x1f5b('0x4e')]=[{'all':!![]}];}return db[_0x1f5b('0x4c')][_0x1f5b('0x4f')](_0x4a7081);})[_0x1f5b('0x1f')](function(_0x46f4d3){_0x5e45d6['rows']=_0x46f4d3;return _0x5e45d6;})[_0x1f5b('0x1f')](respondWithFilteredResult(_0x656b0a,_0x4a7081))[_0x1f5b('0x50')](handleError(_0x656b0a,null));};exports[_0x1f5b('0x51')]=function(_0x1ff2f3,_0x1022db){var _0x257df1={'raw':![],'where':{'id':_0x1ff2f3[_0x1f5b('0x52')]['id']}},_0x6ebba2={};_0x6ebba2[_0x1f5b('0x3a')]=_['keys'](db[_0x1f5b('0x4c')]['rawAttributes']);_0x6ebba2[_0x1f5b('0x43')]=_['keys'](_0x1ff2f3[_0x1f5b('0x43')]);_0x6ebba2['filters']=_[_0x1f5b('0x3e')](_0x6ebba2['model'],_0x6ebba2[_0x1f5b('0x43')]);_0x257df1[_0x1f5b('0x3f')]=_[_0x1f5b('0x3e')](_0x6ebba2[_0x1f5b('0x3a')],qs[_0x1f5b('0x53')](_0x1ff2f3[_0x1f5b('0x43')][_0x1f5b('0x53')]));_0x257df1['attributes']=_0x257df1['attributes'][_0x1f5b('0x40')]?_0x257df1['attributes']:_0x6ebba2[_0x1f5b('0x3a')];if(_0x1ff2f3['query']['includeAll']){_0x257df1[_0x1f5b('0x4e')]=[{'all':!![]}];}_0x257df1=_[_0x1f5b('0x47')]({},_0x257df1,_0x1ff2f3[_0x1f5b('0x4b')]);return db[_0x1f5b('0x4c')]['find'](_0x257df1)[_0x1f5b('0x1f')](handleEntityNotFound(_0x1022db,null))['then'](respondWithResult(_0x1022db,null))[_0x1f5b('0x50')](handleError(_0x1022db,null));};exports[_0x1f5b('0x54')]=function(_0x1050f7,_0x360d48){return db[_0x1f5b('0x4c')][_0x1f5b('0x54')](_0x1050f7[_0x1f5b('0x55')],{})[_0x1f5b('0x1f')](respondWithResult(_0x360d48,0xc9))[_0x1f5b('0x50')](handleError(_0x360d48,null));};exports[_0x1f5b('0x32')]=function(_0x131837,_0x3441e6){if(_0x131837[_0x1f5b('0x55')]['id']){delete _0x131837['body']['id'];}return db[_0x1f5b('0x4c')][_0x1f5b('0x56')]({'where':{'id':_0x131837[_0x1f5b('0x52')]['id']}})['then'](handleEntityNotFound(_0x3441e6,null))[_0x1f5b('0x1f')](saveUpdates(_0x131837[_0x1f5b('0x55')],null))['then'](respondWithResult(_0x3441e6,null))[_0x1f5b('0x50')](handleError(_0x3441e6,null));};exports[_0x1f5b('0x33')]=function(_0x552a0e,_0x1c094d){return db[_0x1f5b('0x4c')][_0x1f5b('0x56')]({'where':{'id':_0x552a0e['params']['id']}})[_0x1f5b('0x1f')](handleEntityNotFound(_0x1c094d,null))[_0x1f5b('0x1f')](removeEntity(_0x1c094d,null))['catch'](handleError(_0x1c094d,null));};exports[_0x1f5b('0x57')]=function(_0x470bb0,_0x249467,_0x1a52b9){var _0x44d726={};var _0x4915bb={};var _0x24285b;var _0x51c1d1;return db[_0x1f5b('0x4c')][_0x1f5b('0x58')]({'where':{'id':_0x470bb0[_0x1f5b('0x52')]['id']}})[_0x1f5b('0x1f')](handleEntityNotFound(_0x249467,null))[_0x1f5b('0x1f')](function(_0x9b849c){if(_0x9b849c){_0x24285b=_0x9b849c;_0x4915bb['model']=_[_0x1f5b('0x3c')](db['ServicenowConfiguration'][_0x1f5b('0x37')]);_0x4915bb['query']=_['keys'](_0x470bb0[_0x1f5b('0x43')]);_0x4915bb[_0x1f5b('0x3d')]=_[_0x1f5b('0x3e')](_0x4915bb[_0x1f5b('0x3a')],_0x4915bb[_0x1f5b('0x43')]);_0x44d726[_0x1f5b('0x3f')]=_[_0x1f5b('0x3e')](_0x4915bb[_0x1f5b('0x3a')],qs[_0x1f5b('0x53')](_0x470bb0[_0x1f5b('0x43')][_0x1f5b('0x53')]));_0x44d726[_0x1f5b('0x3f')]=_0x44d726[_0x1f5b('0x3f')][_0x1f5b('0x40')]?_0x44d726[_0x1f5b('0x3f')]:_0x4915bb[_0x1f5b('0x3a')];_0x44d726[_0x1f5b('0x44')]=qs[_0x1f5b('0x45')](_0x470bb0[_0x1f5b('0x43')][_0x1f5b('0x45')]);_0x44d726[_0x1f5b('0x48')]=qs['filters'](_[_0x1f5b('0x46')](_0x470bb0['query'],_0x4915bb[_0x1f5b('0x3d')]));if(_0x470bb0[_0x1f5b('0x43')][_0x1f5b('0x4a')]){_0x44d726['where']=_['merge'](_0x44d726[_0x1f5b('0x48')],{'$or':_[_0x1f5b('0x3b')](_0x44d726['attributes'],function(_0x19f8fc){var _0x183ff7={};_0x183ff7[_0x19f8fc]={'$like':'%'+_0x470bb0[_0x1f5b('0x43')][_0x1f5b('0x4a')]+'%'};return _0x183ff7;})});}_0x44d726=_[_0x1f5b('0x47')]({},_0x44d726,_0x470bb0[_0x1f5b('0x4b')]);return _0x24285b[_0x1f5b('0x57')](_0x44d726);}})[_0x1f5b('0x1f')](function(_0x368c81){if(_0x368c81){_0x51c1d1=_0x368c81[_0x1f5b('0x40')];if(!_0x470bb0[_0x1f5b('0x43')]['hasOwnProperty']('nolimit')){_0x44d726[_0x1f5b('0x2b')]=qs['limit'](_0x470bb0[_0x1f5b('0x43')][_0x1f5b('0x2b')]);_0x44d726[_0x1f5b('0x2a')]=qs['offset'](_0x470bb0['query'][_0x1f5b('0x2a')]);}return _0x24285b['getConfigurations'](_0x44d726);}})['then'](function(_0x425ed4){if(_0x425ed4){return _0x425ed4?{'count':_0x51c1d1,'rows':_0x425ed4}:null;}})[_0x1f5b('0x1f')](respondWithResult(_0x249467,null))[_0x1f5b('0x50')](handleError(_0x249467,null));};exports['addConfiguration']=function(_0x353365,_0x503b11,_0x4b4fb1){if(_0x353365[_0x1f5b('0x55')]['id']){delete _0x353365[_0x1f5b('0x55')]['id'];}return db[_0x1f5b('0x4c')][_0x1f5b('0x58')]({'where':{'id':_0x353365[_0x1f5b('0x52')]['id']}})[_0x1f5b('0x1f')](handleEntityNotFound(_0x503b11,null))[_0x1f5b('0x1f')](function(_0x8f5851){if(_0x8f5851){_0x353365[_0x1f5b('0x55')][_0x1f5b('0x59')]=_0x8f5851['id'];_0x353365[_0x1f5b('0x55')][_0x1f5b('0x5a')]=integrations['getSubjects'](_0x353365['body'][_0x1f5b('0x5b')],_0x353365['body'][_0x1f5b('0x38')]);_0x353365[_0x1f5b('0x55')][_0x1f5b('0x5c')]=integrations['getDescriptions'](_0x353365['body'][_0x1f5b('0x5b')],_0x353365['body'][_0x1f5b('0x38')]);return db['ServicenowConfiguration']['create'](_0x353365[_0x1f5b('0x55')],{'include':[{'model':db['ServicenowField'],'as':_0x1f5b('0x5a')},{'model':db[_0x1f5b('0x5d')],'as':_0x1f5b('0x5c')}]});}return null;})[_0x1f5b('0x1f')](respondWithResult(_0x503b11,null))[_0x1f5b('0x50')](handleError(_0x503b11,null));};exports['getFields']=function(_0x53d12f,_0x318c11,_0xfa796a){var _0x2ae580=['made_sla',_0x1f5b('0x5e'),_0x1f5b('0x5f'),_0x1f5b('0x60'),_0x1f5b('0x61'),_0x1f5b('0x62'),'incident_state',_0x1f5b('0x63'),'category'];var _0x4ce8b7=[_0x1f5b('0x64'),'made_sla',_0x1f5b('0x65'),_0x1f5b('0x66'),_0x1f5b('0x67'),_0x1f5b('0x68'),_0x1f5b('0x69'),_0x1f5b('0x5e'),_0x1f5b('0x6a'),_0x1f5b('0x6b'),_0x1f5b('0x6c'),_0x1f5b('0x6d'),_0x1f5b('0x6e'),_0x1f5b('0x6f'),_0x1f5b('0x70'),_0x1f5b('0x71'),_0x1f5b('0x72'),_0x1f5b('0x73'),_0x1f5b('0x5f'),_0x1f5b('0x44'),'calendar_stc','closed_at','cmdb_ci',_0x1f5b('0x74'),_0x1f5b('0x75'),_0x1f5b('0x76'),_0x1f5b('0x77'),_0x1f5b('0x78'),'priority','sys_domain_path',_0x1f5b('0x79'),_0x1f5b('0x7a'),_0x1f5b('0x7b'),'opened_at',_0x1f5b('0x7c'),'group_list',_0x1f5b('0x7d'),_0x1f5b('0x7e'),_0x1f5b('0x7f'),_0x1f5b('0x80'),'approval_set','subcategory',_0x1f5b('0x81'),_0x1f5b('0x82'),_0x1f5b('0x61'),_0x1f5b('0x83'),'delivery_task',_0x1f5b('0x84'),'assignment_group','business_stc',_0x1f5b('0x85'),'description',_0x1f5b('0x86'),_0x1f5b('0x62'),_0x1f5b('0x87'),'close_notes',_0x1f5b('0x88'),'follow_up',_0x1f5b('0x89'),_0x1f5b('0x8a'),_0x1f5b('0x8b'),_0x1f5b('0x8c'),_0x1f5b('0x8d'),_0x1f5b('0x8e'),_0x1f5b('0x8f'),_0x1f5b('0x90'),'reassignment_count',_0x1f5b('0x91'),_0x1f5b('0x92'),_0x1f5b('0x63'),_0x1f5b('0x93'),'sla_due',_0x1f5b('0x94'),'comments_and_work_notes','due_date',_0x1f5b('0x95'),_0x1f5b('0x96'),_0x1f5b('0x97'),_0x1f5b('0x98'),'upon_approval','correlation_id',_0x1f5b('0x99'),_0x1f5b('0x9a')];var _0x289426='';var _0xe1ccaf='';var _0xd81271=[];var _0x7dc3a4='';var _0x267b42='';var _0x12a613=[];var _0x43058c='';var _0x2c640b='';var _0x33f52e={};var _0x2d5083='';return db[_0x1f5b('0x4c')][_0x1f5b('0x58')]({'where':{'id':_0x53d12f[_0x1f5b('0x52')]['id']},'attributes':['id',_0x1f5b('0x9b'),_0x1f5b('0x9c'),_0x1f5b('0x9d'),_0x1f5b('0x9e'),_0x1f5b('0x9f')]})[_0x1f5b('0x1f')](handleEntityNotFound(_0x318c11,null))[_0x1f5b('0x1f')](function(_0x2c8947){if(_0x2c8947){_0x2d5083=_0x2c8947[_0x1f5b('0x9e')];var _0x303d29=_0x2d5083[_0x1f5b('0xa0')](-0x1);if(_0x303d29==='/'){_0x2d5083=_0x2d5083[_0x1f5b('0xa1')](0x0,_0x2d5083[_0x1f5b('0xa2')](_0x303d29));}_0x2c640b=util[_0x1f5b('0xa3')]('%s/api/now/doc/table/schema/',_0x2d5083);_0x43058c=util['format'](_0x1f5b('0xa4'),_0x2d5083);_0x33f52e={'user':_0x2c8947[_0x1f5b('0x9b')],'pass':_0x2c8947[_0x1f5b('0x9c')]};var _0x3f518d={'method':_0x1f5b('0xa5'),'uri':_0x2c640b+_0x1f5b('0xa6'),'auth':_0x33f52e,'json':!![]};return rp(_0x3f518d);}})[_0x1f5b('0x1f')](function(_0x5bd9dd){if(_0x5bd9dd[_0x1f5b('0xa7')][_0x1f5b('0x40')]>0x0){_0x289426=_0x5bd9dd[_0x1f5b('0xa7')];}console[_0x1f5b('0xa8')](_0x1f5b('0xa9'),_0x289426);_0x12a613=[];_0xe1ccaf=Object[_0x1f5b('0xaa')]([],_0x289426);_['remove'](_0xe1ccaf,function(_0x8fd270){return!_0x2ae580[_0x1f5b('0xab')](_0x8fd270[_0x1f5b('0x34')]);});_0xe1ccaf['forEach'](function(_0x47300b){var _0x514f14=createFieldObject(_0x43058c,_0x33f52e,_0x47300b[_0x1f5b('0xac')],_0x47300b['name'],_0x47300b['label'],![]);_0x12a613[_0x1f5b('0xad')](_0x514f14);});return Promise[_0x1f5b('0xae')](_0x12a613);})[_0x1f5b('0x1f')](function(_0x304383){_0xd81271=_0x304383;_0x7dc3a4=Object[_0x1f5b('0xaa')]([],_0x289426);console['log'](_0x1f5b('0xaf'),_0x289426);_['remove'](_0x7dc3a4,function(_0x380b30){return _0x4ce8b7['includes'](_0x380b30['name']);});console[_0x1f5b('0xa8')](_0x1f5b('0xb0'),_0x7dc3a4);_0x12a613=[];_0x7dc3a4[_0x1f5b('0xb1')](function(_0x30ef37){var _0x38fdc0=createFieldObject(_0x43058c,_0x33f52e,_0x30ef37[_0x1f5b('0xac')],_0x30ef37[_0x1f5b('0x34')],_0x30ef37[_0x1f5b('0xb2')],!![]);_0x12a613['push'](_0x38fdc0);});return Promise['all'](_0x12a613);})['then'](function(_0x39cc18){_0x267b42=_0x39cc18;var _0x4404f9=_0xd81271['concat'](_0x267b42);return{'count':_0x4404f9[_0x1f5b('0x40')],'rows':_0x4404f9};})[_0x1f5b('0x1f')](respondWithResult(_0x318c11,null))[_0x1f5b('0x50')](function(_0x4a99b8){console['log'](_0x1f5b('0xb3')+_0x4a99b8);var _0x3caeea=_0x53d12f['query'][_0x1f5b('0xb4')]?0x1f4:_0x4a99b8[_0x1f5b('0xb5')]||0x1f4;logger[_0x1f5b('0x25')](_0x4a99b8[_0x1f5b('0xb6')]);delete _0x4a99b8['name'];if(_0x3caeea===0x191){_0x3caeea=0x190;}_0x318c11[_0x1f5b('0x28')](_0x3caeea)[_0x1f5b('0x35')](_0x53d12f[_0x1f5b('0x43')][_0x1f5b('0xb4')]?{'message':_0x1f5b('0xb7'),'statusCode':_0x4a99b8[_0x1f5b('0xb5')]}:_0x4a99b8);});};function createFieldObject(_0x5bb791,_0x55896e,_0xa50288,_0x3fb9c0,_0x1f9293,_0x1ca9f7){return new Promise(function(_0x5c6c3d,_0x5421bf){var _0x5e94dd={'id':_0x3fb9c0,'name':_0x1f9293,'custom':_0x1ca9f7};if(_0xa50288===_0x1f5b('0xb8')){_0x5e94dd[_0x1f5b('0x4b')]=[{'name':_0x1f5b('0xb9'),'value':_0x1f5b('0xba')},{'name':_0x1f5b('0xbb'),'value':_0x1f5b('0xbc')}];_0x5c6c3d(_0x5e94dd);}else{var _0x12752b={'method':_0x1f5b('0xa5'),'uri':_0x5bb791+'sys_choice?sysparm_query=name=incident^element='+_0x3fb9c0,'auth':_0x55896e,'json':!![]};return rp(_0x12752b)[_0x1f5b('0x1f')](function(_0x5db066){var _0x203d40=[];if(_0x5db066[_0x1f5b('0xa7')][_0x1f5b('0x40')]>0x0){_0x5db066[_0x1f5b('0xa7')]['forEach'](function(_0x5c0d78){if(_0x5c0d78[_0x1f5b('0xbd')]===_0x1f5b('0xbc')){var _0x55fdbc={'name':_0x5c0d78[_0x1f5b('0xb2')],'value':_0x5c0d78[_0x1f5b('0xbe')]};_0x203d40[_0x1f5b('0xad')](_0x55fdbc);}});}_0x5e94dd[_0x1f5b('0x4b')]=_0x203d40;if(_0x5e94dd[_0x1f5b('0x4b')][_0x1f5b('0x40')]>0x0){_0x5c6c3d(_0x5e94dd);}else{if(_0x1ca9f7==![]){_0x5c6c3d();}else{_0x5c6c3d(_0x5e94dd);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index ab1a7bc..10ccb13 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 _0x8ef6=['bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','lodash','util','../../config/logger','api','moment'];(function(_0x35247e,_0x9b1742){var _0x4686c8=function(_0x144cd5){while(--_0x144cd5){_0x35247e['push'](_0x35247e['shift']());}};_0x4686c8(++_0x9b1742);}(_0x8ef6,0xf2));var _0x68ef=function(_0x40499f,_0x53aac9){_0x40499f=_0x40499f-0x0;var _0x17d828=_0x8ef6[_0x40499f];return _0x17d828;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));var integrations=require(_0x68ef('0xa'));module['exports']=function(_0x4f77f3,_0x3c2ff3){return _0x4f77f3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56a4=['moment','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','ServicenowAccount','int_servicenow_accounts','lodash','util','api'];(function(_0x87ffa9,_0x2c55b4){var _0x53b4b3=function(_0x1904a2){while(--_0x1904a2){_0x87ffa9['push'](_0x87ffa9['shift']());}};_0x53b4b3(++_0x2c55b4);}(_0x56a4,0x11b));var _0x456a=function(_0x1f9179,_0x598964){_0x1f9179=_0x1f9179-0x0;var _0x2974c9=_0x56a4[_0x1f9179];return _0x2974c9;};'use strict';var _=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var logger=require('../../config/logger')(_0x456a('0x2'));var moment=require(_0x456a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x456a('0x4'));var rimraf=require(_0x456a('0x5'));var config=require(_0x456a('0x6'));var attributes=require(_0x456a('0x7'));var integrations=require(_0x456a('0x8'));module['exports']=function(_0x3b0145,_0x52b38d){return _0x3b0145['define'](_0x456a('0x9'),attributes,{'tableName':_0x456a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index dd77411..840c1c6 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 _0xf813=['where','attributes','include','map','model','debug','ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw'];(function(_0x5cfcee,_0x392025){var _0x54163f=function(_0x1955a5){while(--_0x1955a5){_0x5cfcee['push'](_0x5cfcee['shift']());}};_0x54163f(++_0x392025);}(_0xf813,0x170));var _0x3f81=function(_0x3f6565,_0x12a8bb){_0x3f6565=_0x3f6565-0x0;var _0x4abd23=_0xf813[_0x3f6565];return _0x4abd23;};'use strict';var _=require(_0x3f81('0x0'));var util=require(_0x3f81('0x1'));var moment=require(_0x3f81('0x2'));var BPromise=require(_0x3f81('0x3'));var rs=require(_0x3f81('0x4'));var fs=require('fs');var Redis=require(_0x3f81('0x5'));var db=require(_0x3f81('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3f81('0x7'));var config=require(_0x3f81('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3f81('0x9')][_0x3f81('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3377ef,_0x1482e2,_0x367fa0){return new BPromise(function(_0x4bbb57,_0x1ab86b){return client[_0x3f81('0xb')](_0x3377ef,_0x367fa0)[_0x3f81('0xc')](function(_0x232949){logger[_0x3f81('0xd')](_0x3f81('0xe'),_0x1482e2,'request\x20sent');logger['debug'](_0x3f81('0xf'),_0x1482e2,'request\x20sent',JSON[_0x3f81('0x10')](_0x232949));if(_0x232949[_0x3f81('0x11')]){if(_0x232949[_0x3f81('0x11')][_0x3f81('0x12')]===0x1f4){logger['error'](_0x3f81('0xe'),_0x1482e2,_0x232949[_0x3f81('0x11')][_0x3f81('0x13')]);return _0x1ab86b(_0x232949[_0x3f81('0x11')]['message']);}logger[_0x3f81('0x11')](_0x3f81('0xe'),_0x1482e2,_0x232949[_0x3f81('0x11')][_0x3f81('0x13')]);return _0x4bbb57(_0x232949[_0x3f81('0x11')]['message']);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x1482e2,_0x3f81('0x14'));_0x4bbb57(_0x232949[_0x3f81('0x15')][_0x3f81('0x13')]);}})[_0x3f81('0x16')](function(_0x1511d1){logger[_0x3f81('0x11')](_0x3f81('0xe'),_0x1482e2,_0x1511d1);_0x1ab86b(_0x1511d1);});});}exports[_0x3f81('0x17')]=function(_0x11915b){var _0x562005=this;return new Promise(function(_0xae83eb,_0x26880c){return db[_0x3f81('0x18')][_0x3f81('0x19')]({'raw':_0x11915b[_0x3f81('0x1a')]?_0x11915b[_0x3f81('0x1a')][_0x3f81('0x1b')]===undefined?!![]:![]:!![],'where':_0x11915b[_0x3f81('0x1a')]?_0x11915b[_0x3f81('0x1a')][_0x3f81('0x1c')]||null:null,'attributes':_0x11915b[_0x3f81('0x1a')]?_0x11915b[_0x3f81('0x1a')][_0x3f81('0x1d')]||null:null,'limit':_0x11915b[_0x3f81('0x1a')]?_0x11915b['options']['limit']||null:null,'include':_0x11915b[_0x3f81('0x1a')]?_0x11915b[_0x3f81('0x1a')][_0x3f81('0x1e')]?_[_0x3f81('0x1f')](_0x11915b[_0x3f81('0x1a')][_0x3f81('0x1e')],function(_0x1d927b){return{'model':db[_0x1d927b[_0x3f81('0x20')]],'as':_0x1d927b['as'],'attributes':_0x1d927b['attributes'],'include':_0x1d927b[_0x3f81('0x1e')]?_[_0x3f81('0x1f')](_0x1d927b[_0x3f81('0x1e')],function(_0x239317){return{'model':db[_0x239317[_0x3f81('0x20')]],'as':_0x239317['as'],'attributes':_0x239317[_0x3f81('0x1d')],'include':_0x239317[_0x3f81('0x1e')]?_['map'](_0x239317[_0x3f81('0x1e')],function(_0x253fdf){return{'model':db[_0x253fdf[_0x3f81('0x20')]],'as':_0x253fdf['as'],'attributes':_0x253fdf[_0x3f81('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3f81('0xc')](function(_0x33ed40){logger['info']('GetServicenowAccount',_0x11915b);logger[_0x3f81('0x21')](_0x3f81('0x17'),_0x11915b,JSON[_0x3f81('0x10')](_0x33ed40));_0xae83eb(_0x33ed40);})[_0x3f81('0x16')](function(_0x2f96ab){logger[_0x3f81('0x11')](_0x3f81('0x17'),_0x2f96ab['message'],_0x11915b);_0x26880c(_0x562005[_0x3f81('0x11')](0x1f4,_0x2f96ab['message']));});});};exports[_0x3f81('0x22')]=function(_0xe766b1){var _0x46e73a=this;return new Promise(function(_0x3e5572,_0x1706dc){return db[_0x3f81('0x18')][_0x3f81('0x23')]({'raw':_0xe766b1[_0x3f81('0x1a')]?_0xe766b1['options']['raw']===undefined?!![]:![]:!![],'where':_0xe766b1[_0x3f81('0x1a')]?_0xe766b1[_0x3f81('0x1a')][_0x3f81('0x1c')]||null:null,'attributes':_0xe766b1[_0x3f81('0x1a')]?_0xe766b1[_0x3f81('0x1a')][_0x3f81('0x1d')]||null:null,'include':_0xe766b1[_0x3f81('0x1a')]?_0xe766b1['options']['include']?_[_0x3f81('0x1f')](_0xe766b1['options'][_0x3f81('0x1e')],function(_0x237394){return{'model':db[_0x237394[_0x3f81('0x20')]],'as':_0x237394['as'],'attributes':_0x237394[_0x3f81('0x1d')],'include':_0x237394[_0x3f81('0x1e')]?_[_0x3f81('0x1f')](_0x237394['include'],function(_0x200964){return{'model':db[_0x200964[_0x3f81('0x20')]],'as':_0x200964['as'],'attributes':_0x200964['attributes'],'include':_0x200964[_0x3f81('0x1e')]?_[_0x3f81('0x1f')](_0x200964[_0x3f81('0x1e')],function(_0x229719){return{'model':db[_0x229719[_0x3f81('0x20')]],'as':_0x229719['as'],'attributes':_0x229719[_0x3f81('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3f81('0xc')](function(_0x36ea62){logger[_0x3f81('0xd')](_0x3f81('0x22'),_0xe766b1);logger[_0x3f81('0x21')]('ShowServicenowAccount',_0xe766b1,JSON['stringify'](_0x36ea62));_0x3e5572(_0x36ea62);})[_0x3f81('0x16')](function(_0x55e20b){logger[_0x3f81('0x11')](_0x3f81('0x22'),_0x55e20b[_0x3f81('0x13')],_0xe766b1);_0x1706dc(_0x46e73a['error'](0x1f4,_0x55e20b[_0x3f81('0x13')]));});});}; \ No newline at end of file +var _0x919d=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','result','ServicenowAccount','findAll','options','raw','limit','include','map','model','attributes','then','GetServicenowAccount','debug','catch','ShowServicenowAccount','find','ioredis','../../mysqldb'];(function(_0x246434,_0x54d9fd){var _0x2791e0=function(_0x3f6328){while(--_0x3f6328){_0x246434['push'](_0x246434['shift']());}};_0x2791e0(++_0x54d9fd);}(_0x919d,0x76));var _0xd919=function(_0x5c0b9c,_0x3718ab){_0x5c0b9c=_0x5c0b9c-0x0;var _0x439fd1=_0x919d[_0x5c0b9c];return _0x439fd1;};'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(_0xd919('0x0'));var db=require(_0xd919('0x1'))['db'];var utils=require(_0xd919('0x2'));var logger=require('../../config/logger')(_0xd919('0x3'));var config=require(_0xd919('0x4'));var jayson=require(_0xd919('0x5'));var client=jayson['client'][_0xd919('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2ec7ee,_0xd4e853,_0x12fbc5){return new BPromise(function(_0x50dab8,_0x126de8){return client[_0xd919('0x7')](_0x2ec7ee,_0x12fbc5)['then'](function(_0x4159eb){logger[_0xd919('0x8')]('ServicenowAccount,\x20%s,\x20%s',_0xd4e853,_0xd919('0x9'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0xd4e853,_0xd919('0x9'),JSON[_0xd919('0xa')](_0x4159eb));if(_0x4159eb[_0xd919('0xb')]){if(_0x4159eb[_0xd919('0xb')]['code']===0x1f4){logger[_0xd919('0xb')](_0xd919('0xc'),_0xd4e853,_0x4159eb[_0xd919('0xb')]['message']);return _0x126de8(_0x4159eb[_0xd919('0xb')][_0xd919('0xd')]);}logger[_0xd919('0xb')](_0xd919('0xc'),_0xd4e853,_0x4159eb[_0xd919('0xb')][_0xd919('0xd')]);return _0x50dab8(_0x4159eb[_0xd919('0xb')][_0xd919('0xd')]);}else{logger['info'](_0xd919('0xc'),_0xd4e853,_0xd919('0x9'));_0x50dab8(_0x4159eb[_0xd919('0xe')][_0xd919('0xd')]);}})['catch'](function(_0xaeddb5){logger[_0xd919('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0xd4e853,_0xaeddb5);_0x126de8(_0xaeddb5);});});}exports['GetServicenowAccount']=function(_0x46aea6){var _0x3ce6c1=this;return new Promise(function(_0x2edd3b,_0x4e404b){return db[_0xd919('0xf')][_0xd919('0x10')]({'raw':_0x46aea6[_0xd919('0x11')]?_0x46aea6[_0xd919('0x11')][_0xd919('0x12')]===undefined?!![]:![]:!![],'where':_0x46aea6[_0xd919('0x11')]?_0x46aea6[_0xd919('0x11')]['where']||null:null,'attributes':_0x46aea6[_0xd919('0x11')]?_0x46aea6['options']['attributes']||null:null,'limit':_0x46aea6[_0xd919('0x11')]?_0x46aea6[_0xd919('0x11')][_0xd919('0x13')]||null:null,'include':_0x46aea6[_0xd919('0x11')]?_0x46aea6[_0xd919('0x11')][_0xd919('0x14')]?_[_0xd919('0x15')](_0x46aea6[_0xd919('0x11')][_0xd919('0x14')],function(_0x236c23){return{'model':db[_0x236c23[_0xd919('0x16')]],'as':_0x236c23['as'],'attributes':_0x236c23[_0xd919('0x17')],'include':_0x236c23[_0xd919('0x14')]?_[_0xd919('0x15')](_0x236c23[_0xd919('0x14')],function(_0x50e837){return{'model':db[_0x50e837[_0xd919('0x16')]],'as':_0x50e837['as'],'attributes':_0x50e837[_0xd919('0x17')],'include':_0x50e837[_0xd919('0x14')]?_[_0xd919('0x15')](_0x50e837[_0xd919('0x14')],function(_0x349ffe){return{'model':db[_0x349ffe['model']],'as':_0x349ffe['as'],'attributes':_0x349ffe[_0xd919('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd919('0x18')](function(_0x5f0d38){logger['info'](_0xd919('0x19'),_0x46aea6);logger[_0xd919('0x1a')](_0xd919('0x19'),_0x46aea6,JSON['stringify'](_0x5f0d38));_0x2edd3b(_0x5f0d38);})[_0xd919('0x1b')](function(_0x222271){logger[_0xd919('0xb')](_0xd919('0x19'),_0x222271[_0xd919('0xd')],_0x46aea6);_0x4e404b(_0x3ce6c1[_0xd919('0xb')](0x1f4,_0x222271['message']));});});};exports[_0xd919('0x1c')]=function(_0x2b2ccf){var _0x19c0b4=this;return new Promise(function(_0x4ca43f,_0x4655b7){return db[_0xd919('0xf')][_0xd919('0x1d')]({'raw':_0x2b2ccf[_0xd919('0x11')]?_0x2b2ccf['options'][_0xd919('0x12')]===undefined?!![]:![]:!![],'where':_0x2b2ccf[_0xd919('0x11')]?_0x2b2ccf['options']['where']||null:null,'attributes':_0x2b2ccf[_0xd919('0x11')]?_0x2b2ccf['options'][_0xd919('0x17')]||null:null,'include':_0x2b2ccf[_0xd919('0x11')]?_0x2b2ccf[_0xd919('0x11')][_0xd919('0x14')]?_[_0xd919('0x15')](_0x2b2ccf[_0xd919('0x11')]['include'],function(_0x207879){return{'model':db[_0x207879[_0xd919('0x16')]],'as':_0x207879['as'],'attributes':_0x207879[_0xd919('0x17')],'include':_0x207879['include']?_[_0xd919('0x15')](_0x207879[_0xd919('0x14')],function(_0x4304a9){return{'model':db[_0x4304a9[_0xd919('0x16')]],'as':_0x4304a9['as'],'attributes':_0x4304a9[_0xd919('0x17')],'include':_0x4304a9[_0xd919('0x14')]?_[_0xd919('0x15')](_0x4304a9[_0xd919('0x14')],function(_0x155821){return{'model':db[_0x155821[_0xd919('0x16')]],'as':_0x155821['as'],'attributes':_0x155821[_0xd919('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd919('0x18')](function(_0x526c6b){logger[_0xd919('0x8')]('ShowServicenowAccount',_0x2b2ccf);logger['debug'](_0xd919('0x1c'),_0x2b2ccf,JSON[_0xd919('0xa')](_0x526c6b));_0x4ca43f(_0x526c6b);})[_0xd919('0x1b')](function(_0xa38a9){logger['error']('ShowServicenowAccount',_0xa38a9['message'],_0x2b2ccf);_0x4655b7(_0x19c0b4[_0xd919('0xb')](0x1f4,_0xa38a9[_0xd919('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 18f90c8..266c1c6 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 _0x8782=['post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../config/environment','./intServicenowConfiguration.controller','index','get','/:id','/:id/fields','isAuthenticated','getFields','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x4ac10f,_0x4d9cb8){var _0x41cb6a=function(_0x39d183){while(--_0x39d183){_0x4ac10f['push'](_0x4ac10f['shift']());}};_0x41cb6a(++_0x4d9cb8);}(_0x8782,0x1bc));var _0x2878=function(_0x3e036f,_0x361755){_0x3e036f=_0x3e036f-0x0;var _0x5f278e=_0x8782[_0x3e036f];return _0x5f278e;};'use strict';var multer=require('multer');var util=require(_0x2878('0x0'));var path=require(_0x2878('0x1'));var timeout=require(_0x2878('0x2'));var express=require('express');var router=express[_0x2878('0x3')]();var fs_extra=require(_0x2878('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2878('0x5'));var controller=require(_0x2878('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x2878('0x7')]);router[_0x2878('0x8')](_0x2878('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x2878('0x8')](_0x2878('0xa'),auth[_0x2878('0xb')](),controller[_0x2878('0xc')]);router[_0x2878('0x8')]('/:id/subjects',auth[_0x2878('0xb')](),controller[_0x2878('0xd')]);router[_0x2878('0x8')](_0x2878('0xe'),auth['isAuthenticated'](),controller[_0x2878('0xf')]);router[_0x2878('0x10')]('/',auth[_0x2878('0xb')](),controller[_0x2878('0x11')]);router[_0x2878('0x12')]('/:id',auth[_0x2878('0xb')](),controller[_0x2878('0x13')]);router[_0x2878('0x14')](_0x2878('0x9'),auth[_0x2878('0xb')](),controller[_0x2878('0x15')]);module[_0x2878('0x16')]=router; \ No newline at end of file +var _0xcb26=['index','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','getDescriptions','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get'];(function(_0x299089,_0x3cff81){var _0x11c91f=function(_0x3e135b){while(--_0x3e135b){_0x299089['push'](_0x299089['shift']());}};_0x11c91f(++_0x3cff81);}(_0xcb26,0x6c));var _0x6cb2=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0xcb26[_0x36ed3c];return _0x52a2e0;};'use strict';var multer=require(_0x6cb2('0x0'));var util=require(_0x6cb2('0x1'));var path=require(_0x6cb2('0x2'));var timeout=require(_0x6cb2('0x3'));var express=require(_0x6cb2('0x4'));var router=express[_0x6cb2('0x5')]();var fs_extra=require(_0x6cb2('0x6'));var auth=require(_0x6cb2('0x7'));var interaction=require(_0x6cb2('0x8'));var config=require(_0x6cb2('0x9'));var controller=require(_0x6cb2('0xa'));router[_0x6cb2('0xb')]('/',auth['isAuthenticated'](),controller[_0x6cb2('0xc')]);router[_0x6cb2('0xb')](_0x6cb2('0xd'),auth[_0x6cb2('0xe')](),controller['show']);router[_0x6cb2('0xb')](_0x6cb2('0xf'),auth[_0x6cb2('0xe')](),controller[_0x6cb2('0x10')]);router[_0x6cb2('0xb')]('/:id/subjects',auth[_0x6cb2('0xe')](),controller[_0x6cb2('0x11')]);router['get']('/:id/descriptions',auth[_0x6cb2('0xe')](),controller[_0x6cb2('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6cb2('0x13')]);router[_0x6cb2('0x14')](_0x6cb2('0xd'),auth[_0x6cb2('0xe')](),controller[_0x6cb2('0x15')]);router[_0x6cb2('0x16')](_0x6cb2('0xd'),auth[_0x6cb2('0xe')](),controller['destroy']);module[_0x6cb2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index c897bf4..b2a4e14 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 _0x5cc9=['exports','STRING','sequelize'];(function(_0x867b0a,_0x587ccf){var _0x137438=function(_0xbeafa6){while(--_0xbeafa6){_0x867b0a['push'](_0x867b0a['shift']());}};_0x137438(++_0x587ccf);}(_0x5cc9,0x119));var _0x95cc=function(_0x54ebba,_0x4f58c4){_0x54ebba=_0x54ebba-0x0;var _0x53f0cf=_0x5cc9[_0x54ebba];return _0x53f0cf;};'use strict';var Sequelize=require(_0x95cc('0x0'));module[_0x95cc('0x1')]={'name':{'type':Sequelize[_0x95cc('0x2')]},'description':{'type':Sequelize[_0x95cc('0x2')]}}; \ No newline at end of file +var _0x731a=['exports','STRING','sequelize'];(function(_0x17cda4,_0x359ee4){var _0x156340=function(_0x3c22f9){while(--_0x3c22f9){_0x17cda4['push'](_0x17cda4['shift']());}};_0x156340(++_0x359ee4);}(_0x731a,0xa4));var _0xa731=function(_0x2694f6,_0x31b042){_0x2694f6=_0x2694f6-0x0;var _0x13ab43=_0x731a[_0x2694f6];return _0x13ab43;};'use strict';var Sequelize=require(_0xa731('0x0'));module[_0xa731('0x1')]={'name':{'type':Sequelize[_0xa731('0x2')]},'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 ae0d786..2de6e73 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 _0xdab2=['util','ejs','fs-extra','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','client','http','request','then','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','ServicenowConfiguration','rows','show','include','body','params','destroy','getFields','findOne','pick','options','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xdab2,0x1b0));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2dab('0x0'));var rimraf=require(_0x2dab('0x1'));var zipdir=require(_0x2dab('0x2'));var jsonpatch=require(_0x2dab('0x3'));var rp=require(_0x2dab('0x4'));var moment=require(_0x2dab('0x5'));var BPromise=require(_0x2dab('0x6'));var Mustache=require(_0x2dab('0x7'));var util=require(_0x2dab('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2dab('0x9'));var fs=require('fs');var fs_extra=require(_0x2dab('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2dab('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2dab('0xc'));var toCsv=require(_0x2dab('0xd'));var querystring=require(_0x2dab('0xe'));var Papa=require('papaparse');var Redis=require(_0x2dab('0xf'));var authService=require(_0x2dab('0x10'));var qs=require(_0x2dab('0x11'));var as=require(_0x2dab('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2dab('0x13'))(_0x2dab('0x14'));var utils=require(_0x2dab('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2dab('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x2dab('0x17')][_0x2dab('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x2b5a6f,_0x46c043,_0x2670e2,_0x9a8720){return new BPromise(function(_0x5b5ac5,_0x5b2512){var _0x100f12=_0x9a8720||client;return _0x100f12[_0x2dab('0x19')](_0x2b5a6f,_0x2670e2)[_0x2dab('0x1a')](function(_0x3315a7){logger[_0x2dab('0x1b')]('ServicenowConfiguration,\x20%s,\x20%s',_0x46c043,_0x2dab('0x1c'));logger[_0x2dab('0x1d')](_0x2dab('0x1e'),_0x46c043,'request\x20sent',JSON[_0x2dab('0x1f')](_0x3315a7));if(_0x3315a7[_0x2dab('0x20')]){if(_0x3315a7[_0x2dab('0x20')][_0x2dab('0x21')]===0x1f4){logger[_0x2dab('0x20')](_0x2dab('0x22'),_0x46c043,_0x3315a7[_0x2dab('0x20')]['message']);return _0x5b2512(_0x3315a7[_0x2dab('0x20')][_0x2dab('0x23')]);}logger['error'](_0x2dab('0x22'),_0x46c043,_0x3315a7[_0x2dab('0x20')]['message']);return _0x5b5ac5(_0x3315a7[_0x2dab('0x20')][_0x2dab('0x23')]);}else{logger[_0x2dab('0x1b')](_0x2dab('0x22'),_0x46c043,'request\x20sent');_0x5b5ac5(_0x3315a7[_0x2dab('0x24')][_0x2dab('0x23')]);}})[_0x2dab('0x25')](function(_0x544d13){logger[_0x2dab('0x20')](_0x2dab('0x22'),_0x46c043,_0x544d13);_0x5b2512(_0x544d13);});});}function respondWithStatusCode(_0x5418db,_0x42a0b5){_0x42a0b5=_0x42a0b5||0xcc;return function(_0x1b77d8){if(_0x1b77d8){return _0x5418db[_0x2dab('0x26')](_0x42a0b5);}return _0x5418db[_0x2dab('0x27')](_0x42a0b5)[_0x2dab('0x28')]();};}function respondWithResult(_0x551596,_0x53f201){_0x53f201=_0x53f201||0xc8;return function(_0x1fa288){if(_0x1fa288){return _0x551596[_0x2dab('0x27')](_0x53f201)['json'](_0x1fa288);}};}function respondWithFilteredResult(_0x3ccaf7,_0x36b87f){return function(_0x33fa9f){if(_0x33fa9f){var _0x1291b1=typeof _0x36b87f[_0x2dab('0x29')]===_0x2dab('0x2a')&&typeof _0x36b87f[_0x2dab('0x2b')]==='undefined';var _0xd7389b=_0x33fa9f[_0x2dab('0x2c')];var _0x6638cb=_0x1291b1?0x0:_0x36b87f[_0x2dab('0x29')];var _0x4c2c19=_0x1291b1?_0x33fa9f[_0x2dab('0x2c')]:_0x36b87f[_0x2dab('0x29')]+_0x36b87f['limit'];var _0x4fe748;if(_0x4c2c19>=_0xd7389b){_0x4c2c19=_0xd7389b;_0x4fe748=0xc8;}else{_0x4fe748=0xce;}_0x3ccaf7[_0x2dab('0x27')](_0x4fe748);return _0x3ccaf7[_0x2dab('0x2d')]('Content-Range',_0x6638cb+'-'+_0x4c2c19+'/'+_0xd7389b)[_0x2dab('0x2e')](_0x33fa9f);}return null;};}function patchUpdates(_0x571acd){return function(_0x51e24c){try{jsonpatch[_0x2dab('0x2f')](_0x51e24c,_0x571acd,!![]);}catch(_0xe3ae75){return BPromise[_0x2dab('0x30')](_0xe3ae75);}return _0x51e24c[_0x2dab('0x31')]();};}function saveUpdates(_0x405494,_0x1d3087){return function(_0x1b86b8){if(_0x1b86b8){return _0x1b86b8[_0x2dab('0x32')](_0x405494)[_0x2dab('0x1a')](function(_0xc597b7){return _0xc597b7;});}return null;};}function removeEntity(_0x5dc4f3,_0x54cd6e){return function(_0x20064a){if(_0x20064a){return _0x20064a['destroy']()[_0x2dab('0x1a')](function(){_0x5dc4f3[_0x2dab('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x140f0c,_0x40535d){return function(_0x31c391){if(!_0x31c391){_0x140f0c['sendStatus'](0x194);}return _0x31c391;};}function handleError(_0x55b4e0,_0x2de637){_0x2de637=_0x2de637||0x1f4;return function(_0x4bfc47){logger[_0x2dab('0x20')](_0x4bfc47[_0x2dab('0x33')]);if(_0x4bfc47['name']){delete _0x4bfc47[_0x2dab('0x34')];}_0x55b4e0[_0x2dab('0x27')](_0x2de637)['send'](_0x4bfc47);};}exports[_0x2dab('0x35')]=function(_0x5e3b5a,_0x5e8b66){var _0x288af5={},_0x1144ed={},_0x5b7e43={'count':0x0,'rows':[]};var _0x372640=_[_0x2dab('0x36')](db['ServicenowConfiguration'][_0x2dab('0x37')],function(_0x23e524){return{'name':_0x23e524[_0x2dab('0x38')],'type':_0x23e524[_0x2dab('0x39')]['key']};});_0x1144ed[_0x2dab('0x3a')]=_['map'](_0x372640,_0x2dab('0x34'));_0x1144ed[_0x2dab('0x3b')]=_[_0x2dab('0x3c')](_0x5e3b5a[_0x2dab('0x3b')]);_0x1144ed[_0x2dab('0x3d')]=_[_0x2dab('0x3e')](_0x1144ed[_0x2dab('0x3a')],_0x1144ed['query']);_0x288af5['attributes']=_[_0x2dab('0x3e')](_0x1144ed[_0x2dab('0x3a')],qs[_0x2dab('0x3f')](_0x5e3b5a[_0x2dab('0x3b')][_0x2dab('0x3f')]));_0x288af5['attributes']=_0x288af5[_0x2dab('0x40')][_0x2dab('0x41')]?_0x288af5['attributes']:_0x1144ed[_0x2dab('0x3a')];if(!_0x5e3b5a[_0x2dab('0x3b')][_0x2dab('0x42')](_0x2dab('0x43'))){_0x288af5[_0x2dab('0x2b')]=qs[_0x2dab('0x2b')](_0x5e3b5a[_0x2dab('0x3b')][_0x2dab('0x2b')]);_0x288af5[_0x2dab('0x29')]=qs['offset'](_0x5e3b5a['query'][_0x2dab('0x29')]);}_0x288af5[_0x2dab('0x44')]=qs[_0x2dab('0x45')](_0x5e3b5a[_0x2dab('0x3b')][_0x2dab('0x45')]);_0x288af5[_0x2dab('0x46')]=qs[_0x2dab('0x3d')](_['pick'](_0x5e3b5a['query'],_0x1144ed[_0x2dab('0x3d')]),_0x372640);if(_0x5e3b5a[_0x2dab('0x3b')][_0x2dab('0x47')]){_0x288af5[_0x2dab('0x46')]=_[_0x2dab('0x48')](_0x288af5['where'],{'$or':_[_0x2dab('0x36')](_0x372640,function(_0xef65ec){if(_0xef65ec[_0x2dab('0x39')]!==_0x2dab('0x49')){var _0x5d21cf={};_0x5d21cf[_0xef65ec[_0x2dab('0x34')]]={'$like':'%'+_0x5e3b5a[_0x2dab('0x3b')][_0x2dab('0x47')]+'%'};return _0x5d21cf;}})});}_0x288af5=_['merge']({},_0x288af5,_0x5e3b5a['options']);var _0x2e729f={'where':_0x288af5[_0x2dab('0x46')]};return db['ServicenowConfiguration'][_0x2dab('0x2c')](_0x2e729f)[_0x2dab('0x1a')](function(_0x1c4ebc){_0x5b7e43[_0x2dab('0x2c')]=_0x1c4ebc;if(_0x5e3b5a[_0x2dab('0x3b')][_0x2dab('0x4a')]){_0x288af5['include']=[{'all':!![]}];}return db[_0x2dab('0x4b')]['findAll'](_0x288af5);})[_0x2dab('0x1a')](function(_0x42782d){_0x5b7e43[_0x2dab('0x4c')]=_0x42782d;return _0x5b7e43;})[_0x2dab('0x1a')](respondWithFilteredResult(_0x5e8b66,_0x288af5))[_0x2dab('0x25')](handleError(_0x5e8b66,null));};exports[_0x2dab('0x4d')]=function(_0x2e94c9,_0xdde541){var _0x51618f={'raw':![],'where':{'id':_0x2e94c9['params']['id']}},_0xe81ec4={};_0xe81ec4[_0x2dab('0x3a')]=_['keys'](db[_0x2dab('0x4b')][_0x2dab('0x37')]);_0xe81ec4[_0x2dab('0x3b')]=_[_0x2dab('0x3c')](_0x2e94c9[_0x2dab('0x3b')]);_0xe81ec4['filters']=_[_0x2dab('0x3e')](_0xe81ec4['model'],_0xe81ec4[_0x2dab('0x3b')]);_0x51618f[_0x2dab('0x40')]=_[_0x2dab('0x3e')](_0xe81ec4[_0x2dab('0x3a')],qs['fields'](_0x2e94c9['query'][_0x2dab('0x3f')]));_0x51618f[_0x2dab('0x40')]=_0x51618f['attributes'][_0x2dab('0x41')]?_0x51618f[_0x2dab('0x40')]:_0xe81ec4[_0x2dab('0x3a')];if(_0x2e94c9[_0x2dab('0x3b')][_0x2dab('0x4a')]){_0x51618f[_0x2dab('0x4e')]=[{'all':!![]}];}_0x51618f=_[_0x2dab('0x48')]({},_0x51618f,_0x2e94c9['options']);return db[_0x2dab('0x4b')]['find'](_0x51618f)[_0x2dab('0x1a')](handleEntityNotFound(_0xdde541,null))['then'](respondWithResult(_0xdde541,null))[_0x2dab('0x25')](handleError(_0xdde541,null));};exports['create']=function(_0x29884d,_0x4f9568){return db['ServicenowConfiguration']['create'](_0x29884d[_0x2dab('0x4f')],{})[_0x2dab('0x1a')](respondWithResult(_0x4f9568,0xc9))[_0x2dab('0x25')](handleError(_0x4f9568,null));};exports[_0x2dab('0x32')]=function(_0xbd2b17,_0xa9f7d0){if(_0xbd2b17[_0x2dab('0x4f')]['id']){delete _0xbd2b17[_0x2dab('0x4f')]['id'];}return db[_0x2dab('0x4b')]['find']({'where':{'id':_0xbd2b17[_0x2dab('0x50')]['id']}})[_0x2dab('0x1a')](handleEntityNotFound(_0xa9f7d0,null))['then'](saveUpdates(_0xbd2b17[_0x2dab('0x4f')],null))['then'](respondWithResult(_0xa9f7d0,null))[_0x2dab('0x25')](handleError(_0xa9f7d0,null));};exports[_0x2dab('0x51')]=function(_0x57a1ac,_0x4bfe99){return db[_0x2dab('0x4b')]['find']({'where':{'id':_0x57a1ac[_0x2dab('0x50')]['id']}})[_0x2dab('0x1a')](handleEntityNotFound(_0x4bfe99,null))[_0x2dab('0x1a')](removeEntity(_0x4bfe99,null))[_0x2dab('0x25')](handleError(_0x4bfe99,null));};exports[_0x2dab('0x52')]=function(_0x2f900e,_0x262c40,_0x59126a){var _0x2c0fa2={};var _0x39b592={};var _0x2edd5c;var _0xb36251;return db['ServicenowConfiguration'][_0x2dab('0x53')]({'where':{'id':_0x2f900e[_0x2dab('0x50')]['id']}})[_0x2dab('0x1a')](handleEntityNotFound(_0x262c40,null))[_0x2dab('0x1a')](function(_0x5397cf){if(_0x5397cf){_0x2edd5c=_0x5397cf;_0x39b592[_0x2dab('0x3a')]=_[_0x2dab('0x3c')](db['ServicenowField']['rawAttributes']);_0x39b592[_0x2dab('0x3b')]=_[_0x2dab('0x3c')](_0x2f900e[_0x2dab('0x3b')]);_0x39b592[_0x2dab('0x3d')]=_['intersection'](_0x39b592[_0x2dab('0x3a')],_0x39b592[_0x2dab('0x3b')]);_0x2c0fa2[_0x2dab('0x40')]=_[_0x2dab('0x3e')](_0x39b592[_0x2dab('0x3a')],qs['fields'](_0x2f900e[_0x2dab('0x3b')][_0x2dab('0x3f')]));_0x2c0fa2['attributes']=_0x2c0fa2[_0x2dab('0x40')][_0x2dab('0x41')]?_0x2c0fa2[_0x2dab('0x40')]:_0x39b592[_0x2dab('0x3a')];_0x2c0fa2[_0x2dab('0x44')]=qs[_0x2dab('0x45')](_0x2f900e[_0x2dab('0x3b')]['sort']);_0x2c0fa2[_0x2dab('0x46')]=qs[_0x2dab('0x3d')](_[_0x2dab('0x54')](_0x2f900e[_0x2dab('0x3b')],_0x39b592[_0x2dab('0x3d')]));if(_0x2f900e[_0x2dab('0x3b')][_0x2dab('0x47')]){_0x2c0fa2['where']=_[_0x2dab('0x48')](_0x2c0fa2[_0x2dab('0x46')],{'$or':_[_0x2dab('0x36')](_0x2c0fa2['attributes'],function(_0x2c440b){var _0x40ca77={};_0x40ca77[_0x2c440b]={'$like':'%'+_0x2f900e[_0x2dab('0x3b')][_0x2dab('0x47')]+'%'};return _0x40ca77;})});}_0x2c0fa2=_['merge']({},_0x2c0fa2,_0x2f900e[_0x2dab('0x55')]);return _0x2edd5c[_0x2dab('0x52')](_0x2c0fa2);}})['then'](function(_0x5d0ca1){if(_0x5d0ca1){_0xb36251=_0x5d0ca1['length'];if(!_0x2f900e['query']['hasOwnProperty'](_0x2dab('0x43'))){_0x2c0fa2[_0x2dab('0x2b')]=qs[_0x2dab('0x2b')](_0x2f900e['query'][_0x2dab('0x2b')]);_0x2c0fa2['offset']=qs['offset'](_0x2f900e[_0x2dab('0x3b')][_0x2dab('0x29')]);}return _0x2edd5c[_0x2dab('0x52')](_0x2c0fa2);}})[_0x2dab('0x1a')](function(_0xd9a18){if(_0xd9a18){return _0xd9a18?{'count':_0xb36251,'rows':_0xd9a18}:null;}})[_0x2dab('0x1a')](respondWithResult(_0x262c40,null))['catch'](handleError(_0x262c40,null));};exports[_0x2dab('0x56')]=function(_0x19261e,_0x54a619,_0x1d1bfa){var _0x21f1e1={};var _0x1664b4={};var _0x2a2396;var _0x57472f;return db['ServicenowConfiguration'][_0x2dab('0x53')]({'where':{'id':_0x19261e['params']['id']}})['then'](handleEntityNotFound(_0x54a619,null))[_0x2dab('0x1a')](function(_0x48fa99){if(_0x48fa99){_0x2a2396=_0x48fa99;_0x1664b4[_0x2dab('0x3a')]=_[_0x2dab('0x3c')](db['ServicenowField'][_0x2dab('0x37')]);_0x1664b4['query']=_[_0x2dab('0x3c')](_0x19261e[_0x2dab('0x3b')]);_0x1664b4[_0x2dab('0x3d')]=_['intersection'](_0x1664b4[_0x2dab('0x3a')],_0x1664b4[_0x2dab('0x3b')]);_0x21f1e1[_0x2dab('0x40')]=_[_0x2dab('0x3e')](_0x1664b4[_0x2dab('0x3a')],qs[_0x2dab('0x3f')](_0x19261e['query'][_0x2dab('0x3f')]));_0x21f1e1['attributes']=_0x21f1e1['attributes'][_0x2dab('0x41')]?_0x21f1e1[_0x2dab('0x40')]:_0x1664b4[_0x2dab('0x3a')];_0x21f1e1[_0x2dab('0x44')]=qs['sort'](_0x19261e['query'][_0x2dab('0x45')]);_0x21f1e1[_0x2dab('0x46')]=qs[_0x2dab('0x3d')](_[_0x2dab('0x54')](_0x19261e[_0x2dab('0x3b')],_0x1664b4[_0x2dab('0x3d')]));if(_0x19261e[_0x2dab('0x3b')][_0x2dab('0x47')]){_0x21f1e1[_0x2dab('0x46')]=_[_0x2dab('0x48')](_0x21f1e1[_0x2dab('0x46')],{'$or':_[_0x2dab('0x36')](_0x21f1e1['attributes'],function(_0x222242){var _0x3ec842={};_0x3ec842[_0x222242]={'$like':'%'+_0x19261e[_0x2dab('0x3b')][_0x2dab('0x47')]+'%'};return _0x3ec842;})});}_0x21f1e1=_[_0x2dab('0x48')]({},_0x21f1e1,_0x19261e[_0x2dab('0x55')]);return _0x2a2396['getSubjects'](_0x21f1e1);}})[_0x2dab('0x1a')](function(_0x4ecdf4){if(_0x4ecdf4){_0x57472f=_0x4ecdf4[_0x2dab('0x41')];if(!_0x19261e[_0x2dab('0x3b')]['hasOwnProperty']('nolimit')){_0x21f1e1[_0x2dab('0x2b')]=qs[_0x2dab('0x2b')](_0x19261e[_0x2dab('0x3b')][_0x2dab('0x2b')]);_0x21f1e1[_0x2dab('0x29')]=qs['offset'](_0x19261e[_0x2dab('0x3b')][_0x2dab('0x29')]);}return _0x2a2396[_0x2dab('0x56')](_0x21f1e1);}})[_0x2dab('0x1a')](function(_0x57b9f8){if(_0x57b9f8){return _0x57b9f8?{'count':_0x57472f,'rows':_0x57b9f8}:null;}})[_0x2dab('0x1a')](respondWithResult(_0x54a619,null))[_0x2dab('0x25')](handleError(_0x54a619,null));};exports[_0x2dab('0x57')]=function(_0x64125f,_0x346e17,_0x537e47){var _0x2570a6={};var _0x4996ce={};var _0x6cd64;var _0x168a16;return db[_0x2dab('0x4b')][_0x2dab('0x53')]({'where':{'id':_0x64125f[_0x2dab('0x50')]['id']}})[_0x2dab('0x1a')](handleEntityNotFound(_0x346e17,null))[_0x2dab('0x1a')](function(_0x34a074){if(_0x34a074){_0x6cd64=_0x34a074;_0x4996ce['model']=_['keys'](db['ServicenowField']['rawAttributes']);_0x4996ce[_0x2dab('0x3b')]=_[_0x2dab('0x3c')](_0x64125f[_0x2dab('0x3b')]);_0x4996ce['filters']=_['intersection'](_0x4996ce['model'],_0x4996ce['query']);_0x2570a6[_0x2dab('0x40')]=_[_0x2dab('0x3e')](_0x4996ce[_0x2dab('0x3a')],qs['fields'](_0x64125f[_0x2dab('0x3b')][_0x2dab('0x3f')]));_0x2570a6[_0x2dab('0x40')]=_0x2570a6[_0x2dab('0x40')][_0x2dab('0x41')]?_0x2570a6[_0x2dab('0x40')]:_0x4996ce['model'];_0x2570a6[_0x2dab('0x44')]=qs[_0x2dab('0x45')](_0x64125f[_0x2dab('0x3b')][_0x2dab('0x45')]);_0x2570a6[_0x2dab('0x46')]=qs['filters'](_[_0x2dab('0x54')](_0x64125f['query'],_0x4996ce['filters']));if(_0x64125f[_0x2dab('0x3b')][_0x2dab('0x47')]){_0x2570a6[_0x2dab('0x46')]=_[_0x2dab('0x48')](_0x2570a6['where'],{'$or':_[_0x2dab('0x36')](_0x2570a6['attributes'],function(_0x1f6a09){var _0x8be301={};_0x8be301[_0x1f6a09]={'$like':'%'+_0x64125f['query']['filter']+'%'};return _0x8be301;})});}_0x2570a6=_[_0x2dab('0x48')]({},_0x2570a6,_0x64125f[_0x2dab('0x55')]);return _0x6cd64[_0x2dab('0x57')](_0x2570a6);}})[_0x2dab('0x1a')](function(_0x273784){if(_0x273784){_0x168a16=_0x273784['length'];if(!_0x64125f[_0x2dab('0x3b')][_0x2dab('0x42')](_0x2dab('0x43'))){_0x2570a6['limit']=qs[_0x2dab('0x2b')](_0x64125f[_0x2dab('0x3b')][_0x2dab('0x2b')]);_0x2570a6['offset']=qs[_0x2dab('0x29')](_0x64125f[_0x2dab('0x3b')][_0x2dab('0x29')]);}return _0x6cd64[_0x2dab('0x57')](_0x2570a6);}})[_0x2dab('0x1a')](function(_0x12ab77){if(_0x12ab77){return _0x12ab77?{'count':_0x168a16,'rows':_0x12ab77}:null;}})['then'](respondWithResult(_0x346e17,null))[_0x2dab('0x25')](handleError(_0x346e17,null));}; \ No newline at end of file +var _0xa772=['type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','body','update','findOne','getFields','nolimit','getSubjects','ServicenowField','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','json','limit','undefined','offset','count','status','set','reject','save','destroy','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName'];(function(_0x39eecd,_0x4dccf4){var _0x15af88=function(_0x4a7e87){while(--_0x4a7e87){_0x39eecd['push'](_0x39eecd['shift']());}};_0x15af88(++_0x4dccf4);}(_0xa772,0xd6));var _0x2a77=function(_0x273305,_0x57815f){_0x273305=_0x273305-0x0;var _0x12cf22=_0xa772[_0x273305];return _0x12cf22;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2a77('0x0'));var jsonpatch=require(_0x2a77('0x1'));var rp=require(_0x2a77('0x2'));var moment=require(_0x2a77('0x3'));var BPromise=require(_0x2a77('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2a77('0x5'));var sox=require(_0x2a77('0x6'));var csv=require(_0x2a77('0x7'));var ejs=require(_0x2a77('0x8'));var fs=require('fs');var fs_extra=require(_0x2a77('0x9'));var _=require(_0x2a77('0xa'));var squel=require(_0x2a77('0xb'));var crypto=require(_0x2a77('0xc'));var jsforce=require(_0x2a77('0xd'));var deskjs=require(_0x2a77('0xe'));var toCsv=require(_0x2a77('0x7'));var querystring=require(_0x2a77('0xf'));var Papa=require(_0x2a77('0x10'));var Redis=require(_0x2a77('0x11'));var authService=require(_0x2a77('0x12'));var qs=require(_0x2a77('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a77('0x14'))(_0x2a77('0x15'));var utils=require(_0x2a77('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2a77('0x17'));var db=require(_0x2a77('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x2a77('0x19')][_0x2a77('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x449c13,_0x32edec,_0x58f0dd,_0x46a3a7){return new BPromise(function(_0x225023,_0x453ea8){var _0x2990e3=_0x46a3a7||client;return _0x2990e3[_0x2a77('0x1b')](_0x449c13,_0x58f0dd)[_0x2a77('0x1c')](function(_0x127795){logger[_0x2a77('0x1d')](_0x2a77('0x1e'),_0x32edec,_0x2a77('0x1f'));logger[_0x2a77('0x20')](_0x2a77('0x21'),_0x32edec,_0x2a77('0x1f'),JSON[_0x2a77('0x22')](_0x127795));if(_0x127795[_0x2a77('0x23')]){if(_0x127795[_0x2a77('0x23')]['code']===0x1f4){logger['error'](_0x2a77('0x1e'),_0x32edec,_0x127795[_0x2a77('0x23')][_0x2a77('0x24')]);return _0x453ea8(_0x127795[_0x2a77('0x23')]['message']);}logger[_0x2a77('0x23')](_0x2a77('0x1e'),_0x32edec,_0x127795[_0x2a77('0x23')][_0x2a77('0x24')]);return _0x225023(_0x127795[_0x2a77('0x23')]['message']);}else{logger[_0x2a77('0x1d')](_0x2a77('0x1e'),_0x32edec,_0x2a77('0x1f'));_0x225023(_0x127795[_0x2a77('0x25')][_0x2a77('0x24')]);}})[_0x2a77('0x26')](function(_0x1ef3eb){logger[_0x2a77('0x23')](_0x2a77('0x1e'),_0x32edec,_0x1ef3eb);_0x453ea8(_0x1ef3eb);});});}function respondWithStatusCode(_0x4f3732,_0x4d57a0){_0x4d57a0=_0x4d57a0||0xcc;return function(_0x235396){if(_0x235396){return _0x4f3732[_0x2a77('0x27')](_0x4d57a0);}return _0x4f3732['status'](_0x4d57a0)[_0x2a77('0x28')]();};}function respondWithResult(_0x9b96a3,_0x50ba20){_0x50ba20=_0x50ba20||0xc8;return function(_0x3e346b){if(_0x3e346b){return _0x9b96a3['status'](_0x50ba20)[_0x2a77('0x29')](_0x3e346b);}};}function respondWithFilteredResult(_0xa70772,_0x403791){return function(_0x4b7102){if(_0x4b7102){var _0x519ce7=typeof _0x403791['offset']==='undefined'&&typeof _0x403791[_0x2a77('0x2a')]===_0x2a77('0x2b');var _0x24e456=_0x4b7102['count'];var _0x100c7c=_0x519ce7?0x0:_0x403791[_0x2a77('0x2c')];var _0x257a56=_0x519ce7?_0x4b7102[_0x2a77('0x2d')]:_0x403791[_0x2a77('0x2c')]+_0x403791[_0x2a77('0x2a')];var _0x53f91a;if(_0x257a56>=_0x24e456){_0x257a56=_0x24e456;_0x53f91a=0xc8;}else{_0x53f91a=0xce;}_0xa70772[_0x2a77('0x2e')](_0x53f91a);return _0xa70772[_0x2a77('0x2f')]('Content-Range',_0x100c7c+'-'+_0x257a56+'/'+_0x24e456)[_0x2a77('0x29')](_0x4b7102);}return null;};}function patchUpdates(_0x26c1be){return function(_0x5cc2bc){try{jsonpatch['apply'](_0x5cc2bc,_0x26c1be,!![]);}catch(_0x4726eb){return BPromise[_0x2a77('0x30')](_0x4726eb);}return _0x5cc2bc[_0x2a77('0x31')]();};}function saveUpdates(_0x364a4e,_0x380832){return function(_0x238045){if(_0x238045){return _0x238045['update'](_0x364a4e)[_0x2a77('0x1c')](function(_0x44b32f){return _0x44b32f;});}return null;};}function removeEntity(_0x457267,_0xe40b8d){return function(_0x322c10){if(_0x322c10){return _0x322c10[_0x2a77('0x32')]()[_0x2a77('0x1c')](function(){_0x457267[_0x2a77('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30592f,_0xd7bcff){return function(_0x127e40){if(!_0x127e40){_0x30592f[_0x2a77('0x27')](0x194);}return _0x127e40;};}function handleError(_0x2dfc4e,_0x22e22a){_0x22e22a=_0x22e22a||0x1f4;return function(_0x59addb){logger['error'](_0x59addb[_0x2a77('0x33')]);if(_0x59addb[_0x2a77('0x34')]){delete _0x59addb[_0x2a77('0x34')];}_0x2dfc4e[_0x2a77('0x2e')](_0x22e22a)[_0x2a77('0x35')](_0x59addb);};}exports[_0x2a77('0x36')]=function(_0x562241,_0x447618){var _0x40764b={},_0x474560={},_0x378fc8={'count':0x0,'rows':[]};var _0x58a47f=_[_0x2a77('0x37')](db[_0x2a77('0x38')][_0x2a77('0x39')],function(_0x30ed7d){return{'name':_0x30ed7d[_0x2a77('0x3a')],'type':_0x30ed7d[_0x2a77('0x3b')]['key']};});_0x474560[_0x2a77('0x3c')]=_[_0x2a77('0x37')](_0x58a47f,'name');_0x474560['query']=_[_0x2a77('0x3d')](_0x562241[_0x2a77('0x3e')]);_0x474560[_0x2a77('0x3f')]=_[_0x2a77('0x40')](_0x474560[_0x2a77('0x3c')],_0x474560['query']);_0x40764b[_0x2a77('0x41')]=_[_0x2a77('0x40')](_0x474560[_0x2a77('0x3c')],qs[_0x2a77('0x42')](_0x562241[_0x2a77('0x3e')][_0x2a77('0x42')]));_0x40764b[_0x2a77('0x41')]=_0x40764b[_0x2a77('0x41')][_0x2a77('0x43')]?_0x40764b[_0x2a77('0x41')]:_0x474560[_0x2a77('0x3c')];if(!_0x562241[_0x2a77('0x3e')][_0x2a77('0x44')]('nolimit')){_0x40764b['limit']=qs[_0x2a77('0x2a')](_0x562241['query'][_0x2a77('0x2a')]);_0x40764b[_0x2a77('0x2c')]=qs[_0x2a77('0x2c')](_0x562241['query'][_0x2a77('0x2c')]);}_0x40764b[_0x2a77('0x45')]=qs['sort'](_0x562241[_0x2a77('0x3e')][_0x2a77('0x46')]);_0x40764b[_0x2a77('0x47')]=qs[_0x2a77('0x3f')](_[_0x2a77('0x48')](_0x562241[_0x2a77('0x3e')],_0x474560[_0x2a77('0x3f')]),_0x58a47f);if(_0x562241[_0x2a77('0x3e')][_0x2a77('0x49')]){_0x40764b[_0x2a77('0x47')]=_[_0x2a77('0x4a')](_0x40764b[_0x2a77('0x47')],{'$or':_[_0x2a77('0x37')](_0x58a47f,function(_0x3cf04c){if(_0x3cf04c[_0x2a77('0x3b')]!=='VIRTUAL'){var _0x2ac14c={};_0x2ac14c[_0x3cf04c[_0x2a77('0x34')]]={'$like':'%'+_0x562241['query']['filter']+'%'};return _0x2ac14c;}})});}_0x40764b=_['merge']({},_0x40764b,_0x562241[_0x2a77('0x4b')]);var _0x5b598b={'where':_0x40764b[_0x2a77('0x47')]};return db[_0x2a77('0x38')]['count'](_0x5b598b)['then'](function(_0x5ab00b){_0x378fc8[_0x2a77('0x2d')]=_0x5ab00b;if(_0x562241[_0x2a77('0x3e')][_0x2a77('0x4c')]){_0x40764b[_0x2a77('0x4d')]=[{'all':!![]}];}return db[_0x2a77('0x38')][_0x2a77('0x4e')](_0x40764b);})[_0x2a77('0x1c')](function(_0x5aea63){_0x378fc8[_0x2a77('0x4f')]=_0x5aea63;return _0x378fc8;})[_0x2a77('0x1c')](respondWithFilteredResult(_0x447618,_0x40764b))[_0x2a77('0x26')](handleError(_0x447618,null));};exports[_0x2a77('0x50')]=function(_0x532306,_0x2bd315){var _0x1bb624={'raw':![],'where':{'id':_0x532306[_0x2a77('0x51')]['id']}},_0x11d63b={};_0x11d63b[_0x2a77('0x3c')]=_[_0x2a77('0x3d')](db['ServicenowConfiguration'][_0x2a77('0x39')]);_0x11d63b[_0x2a77('0x3e')]=_['keys'](_0x532306['query']);_0x11d63b['filters']=_[_0x2a77('0x40')](_0x11d63b['model'],_0x11d63b[_0x2a77('0x3e')]);_0x1bb624[_0x2a77('0x41')]=_[_0x2a77('0x40')](_0x11d63b[_0x2a77('0x3c')],qs['fields'](_0x532306[_0x2a77('0x3e')][_0x2a77('0x42')]));_0x1bb624[_0x2a77('0x41')]=_0x1bb624[_0x2a77('0x41')][_0x2a77('0x43')]?_0x1bb624[_0x2a77('0x41')]:_0x11d63b[_0x2a77('0x3c')];if(_0x532306[_0x2a77('0x3e')][_0x2a77('0x4c')]){_0x1bb624['include']=[{'all':!![]}];}_0x1bb624=_[_0x2a77('0x4a')]({},_0x1bb624,_0x532306[_0x2a77('0x4b')]);return db[_0x2a77('0x38')][_0x2a77('0x52')](_0x1bb624)[_0x2a77('0x1c')](handleEntityNotFound(_0x2bd315,null))['then'](respondWithResult(_0x2bd315,null))['catch'](handleError(_0x2bd315,null));};exports['create']=function(_0x2a10b3,_0xb93b3){return db[_0x2a77('0x38')]['create'](_0x2a10b3[_0x2a77('0x53')],{})[_0x2a77('0x1c')](respondWithResult(_0xb93b3,0xc9))['catch'](handleError(_0xb93b3,null));};exports[_0x2a77('0x54')]=function(_0x39407e,_0x24b471){if(_0x39407e[_0x2a77('0x53')]['id']){delete _0x39407e[_0x2a77('0x53')]['id'];}return db[_0x2a77('0x38')]['find']({'where':{'id':_0x39407e[_0x2a77('0x51')]['id']}})[_0x2a77('0x1c')](handleEntityNotFound(_0x24b471,null))[_0x2a77('0x1c')](saveUpdates(_0x39407e[_0x2a77('0x53')],null))[_0x2a77('0x1c')](respondWithResult(_0x24b471,null))[_0x2a77('0x26')](handleError(_0x24b471,null));};exports['destroy']=function(_0x19c229,_0x4ac3a3){return db[_0x2a77('0x38')][_0x2a77('0x52')]({'where':{'id':_0x19c229[_0x2a77('0x51')]['id']}})[_0x2a77('0x1c')](handleEntityNotFound(_0x4ac3a3,null))[_0x2a77('0x1c')](removeEntity(_0x4ac3a3,null))[_0x2a77('0x26')](handleError(_0x4ac3a3,null));};exports['getFields']=function(_0x5e2388,_0x454864,_0x1d71e9){var _0x581fc7={};var _0x2f7ba0={};var _0x5535b8;var _0x2ebdff;return db[_0x2a77('0x38')][_0x2a77('0x55')]({'where':{'id':_0x5e2388[_0x2a77('0x51')]['id']}})[_0x2a77('0x1c')](handleEntityNotFound(_0x454864,null))['then'](function(_0x2c99b5){if(_0x2c99b5){_0x5535b8=_0x2c99b5;_0x2f7ba0['model']=_[_0x2a77('0x3d')](db['ServicenowField'][_0x2a77('0x39')]);_0x2f7ba0[_0x2a77('0x3e')]=_[_0x2a77('0x3d')](_0x5e2388[_0x2a77('0x3e')]);_0x2f7ba0[_0x2a77('0x3f')]=_['intersection'](_0x2f7ba0[_0x2a77('0x3c')],_0x2f7ba0['query']);_0x581fc7['attributes']=_[_0x2a77('0x40')](_0x2f7ba0['model'],qs[_0x2a77('0x42')](_0x5e2388[_0x2a77('0x3e')][_0x2a77('0x42')]));_0x581fc7[_0x2a77('0x41')]=_0x581fc7[_0x2a77('0x41')][_0x2a77('0x43')]?_0x581fc7[_0x2a77('0x41')]:_0x2f7ba0[_0x2a77('0x3c')];_0x581fc7['order']=qs[_0x2a77('0x46')](_0x5e2388['query'][_0x2a77('0x46')]);_0x581fc7[_0x2a77('0x47')]=qs[_0x2a77('0x3f')](_[_0x2a77('0x48')](_0x5e2388[_0x2a77('0x3e')],_0x2f7ba0[_0x2a77('0x3f')]));if(_0x5e2388[_0x2a77('0x3e')][_0x2a77('0x49')]){_0x581fc7[_0x2a77('0x47')]=_[_0x2a77('0x4a')](_0x581fc7[_0x2a77('0x47')],{'$or':_[_0x2a77('0x37')](_0x581fc7['attributes'],function(_0xf0eed2){var _0x4229e6={};_0x4229e6[_0xf0eed2]={'$like':'%'+_0x5e2388[_0x2a77('0x3e')][_0x2a77('0x49')]+'%'};return _0x4229e6;})});}_0x581fc7=_[_0x2a77('0x4a')]({},_0x581fc7,_0x5e2388[_0x2a77('0x4b')]);return _0x5535b8[_0x2a77('0x56')](_0x581fc7);}})[_0x2a77('0x1c')](function(_0x29b7d5){if(_0x29b7d5){_0x2ebdff=_0x29b7d5[_0x2a77('0x43')];if(!_0x5e2388[_0x2a77('0x3e')][_0x2a77('0x44')](_0x2a77('0x57'))){_0x581fc7[_0x2a77('0x2a')]=qs[_0x2a77('0x2a')](_0x5e2388[_0x2a77('0x3e')][_0x2a77('0x2a')]);_0x581fc7[_0x2a77('0x2c')]=qs[_0x2a77('0x2c')](_0x5e2388['query'][_0x2a77('0x2c')]);}return _0x5535b8[_0x2a77('0x56')](_0x581fc7);}})[_0x2a77('0x1c')](function(_0x246f98){if(_0x246f98){return _0x246f98?{'count':_0x2ebdff,'rows':_0x246f98}:null;}})['then'](respondWithResult(_0x454864,null))[_0x2a77('0x26')](handleError(_0x454864,null));};exports[_0x2a77('0x58')]=function(_0x331393,_0x17fb06,_0x150fc2){var _0x499149={};var _0x5172bc={};var _0x349f7a;var _0x4ef82c;return db[_0x2a77('0x38')][_0x2a77('0x55')]({'where':{'id':_0x331393['params']['id']}})['then'](handleEntityNotFound(_0x17fb06,null))[_0x2a77('0x1c')](function(_0x461e69){if(_0x461e69){_0x349f7a=_0x461e69;_0x5172bc[_0x2a77('0x3c')]=_['keys'](db[_0x2a77('0x59')]['rawAttributes']);_0x5172bc['query']=_[_0x2a77('0x3d')](_0x331393[_0x2a77('0x3e')]);_0x5172bc[_0x2a77('0x3f')]=_[_0x2a77('0x40')](_0x5172bc[_0x2a77('0x3c')],_0x5172bc[_0x2a77('0x3e')]);_0x499149[_0x2a77('0x41')]=_[_0x2a77('0x40')](_0x5172bc[_0x2a77('0x3c')],qs[_0x2a77('0x42')](_0x331393[_0x2a77('0x3e')]['fields']));_0x499149[_0x2a77('0x41')]=_0x499149['attributes'][_0x2a77('0x43')]?_0x499149[_0x2a77('0x41')]:_0x5172bc[_0x2a77('0x3c')];_0x499149['order']=qs[_0x2a77('0x46')](_0x331393[_0x2a77('0x3e')]['sort']);_0x499149[_0x2a77('0x47')]=qs[_0x2a77('0x3f')](_['pick'](_0x331393['query'],_0x5172bc['filters']));if(_0x331393[_0x2a77('0x3e')][_0x2a77('0x49')]){_0x499149['where']=_[_0x2a77('0x4a')](_0x499149[_0x2a77('0x47')],{'$or':_[_0x2a77('0x37')](_0x499149['attributes'],function(_0x4eba27){var _0x16cd75={};_0x16cd75[_0x4eba27]={'$like':'%'+_0x331393[_0x2a77('0x3e')][_0x2a77('0x49')]+'%'};return _0x16cd75;})});}_0x499149=_[_0x2a77('0x4a')]({},_0x499149,_0x331393[_0x2a77('0x4b')]);return _0x349f7a[_0x2a77('0x58')](_0x499149);}})[_0x2a77('0x1c')](function(_0x196b73){if(_0x196b73){_0x4ef82c=_0x196b73[_0x2a77('0x43')];if(!_0x331393[_0x2a77('0x3e')][_0x2a77('0x44')](_0x2a77('0x57'))){_0x499149[_0x2a77('0x2a')]=qs[_0x2a77('0x2a')](_0x331393[_0x2a77('0x3e')][_0x2a77('0x2a')]);_0x499149[_0x2a77('0x2c')]=qs[_0x2a77('0x2c')](_0x331393[_0x2a77('0x3e')][_0x2a77('0x2c')]);}return _0x349f7a[_0x2a77('0x58')](_0x499149);}})[_0x2a77('0x1c')](function(_0x20bd00){if(_0x20bd00){return _0x20bd00?{'count':_0x4ef82c,'rows':_0x20bd00}:null;}})['then'](respondWithResult(_0x17fb06,null))['catch'](handleError(_0x17fb06,null));};exports[_0x2a77('0x5a')]=function(_0x20a9c7,_0x5230b0,_0x12b686){var _0x415b43={};var _0x42a35f={};var _0x34a4be;var _0x4997ca;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x20a9c7['params']['id']}})['then'](handleEntityNotFound(_0x5230b0,null))[_0x2a77('0x1c')](function(_0x3de262){if(_0x3de262){_0x34a4be=_0x3de262;_0x42a35f[_0x2a77('0x3c')]=_[_0x2a77('0x3d')](db[_0x2a77('0x59')]['rawAttributes']);_0x42a35f[_0x2a77('0x3e')]=_['keys'](_0x20a9c7[_0x2a77('0x3e')]);_0x42a35f[_0x2a77('0x3f')]=_[_0x2a77('0x40')](_0x42a35f['model'],_0x42a35f[_0x2a77('0x3e')]);_0x415b43[_0x2a77('0x41')]=_['intersection'](_0x42a35f['model'],qs[_0x2a77('0x42')](_0x20a9c7[_0x2a77('0x3e')][_0x2a77('0x42')]));_0x415b43[_0x2a77('0x41')]=_0x415b43[_0x2a77('0x41')][_0x2a77('0x43')]?_0x415b43[_0x2a77('0x41')]:_0x42a35f[_0x2a77('0x3c')];_0x415b43[_0x2a77('0x45')]=qs[_0x2a77('0x46')](_0x20a9c7[_0x2a77('0x3e')][_0x2a77('0x46')]);_0x415b43['where']=qs['filters'](_[_0x2a77('0x48')](_0x20a9c7[_0x2a77('0x3e')],_0x42a35f[_0x2a77('0x3f')]));if(_0x20a9c7[_0x2a77('0x3e')][_0x2a77('0x49')]){_0x415b43[_0x2a77('0x47')]=_['merge'](_0x415b43[_0x2a77('0x47')],{'$or':_['map'](_0x415b43[_0x2a77('0x41')],function(_0x45029a){var _0x562ae0={};_0x562ae0[_0x45029a]={'$like':'%'+_0x20a9c7['query'][_0x2a77('0x49')]+'%'};return _0x562ae0;})});}_0x415b43=_[_0x2a77('0x4a')]({},_0x415b43,_0x20a9c7[_0x2a77('0x4b')]);return _0x34a4be['getDescriptions'](_0x415b43);}})['then'](function(_0x2e29d1){if(_0x2e29d1){_0x4997ca=_0x2e29d1['length'];if(!_0x20a9c7['query'][_0x2a77('0x44')](_0x2a77('0x57'))){_0x415b43[_0x2a77('0x2a')]=qs['limit'](_0x20a9c7[_0x2a77('0x3e')][_0x2a77('0x2a')]);_0x415b43['offset']=qs[_0x2a77('0x2c')](_0x20a9c7['query'][_0x2a77('0x2c')]);}return _0x34a4be[_0x2a77('0x5a')](_0x415b43);}})[_0x2a77('0x1c')](function(_0x419d31){if(_0x419d31){return _0x419d31?{'count':_0x4997ca,'rows':_0x419d31}:null;}})[_0x2a77('0x1c')](respondWithResult(_0x5230b0,null))[_0x2a77('0x26')](handleError(_0x5230b0,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 5d514c0..709251a 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 _0x22b1=['define','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x3313ec,_0x2c1ad6){var _0x408972=function(_0x45bc9e){while(--_0x45bc9e){_0x3313ec['push'](_0x3313ec['shift']());}};_0x408972(++_0x2c1ad6);}(_0x22b1,0xc9));var _0x122b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x22b1[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x122b('0x0'));var logger=require(_0x122b('0x1'))('api');var moment=require(_0x122b('0x2'));var BPromise=require(_0x122b('0x3'));var rp=require(_0x122b('0x4'));var fs=require('fs');var path=require(_0x122b('0x5'));var rimraf=require('rimraf');var config=require(_0x122b('0x6'));var attributes=require(_0x122b('0x7'));module['exports']=function(_0x245b1b,_0x585858){return _0x245b1b[_0x122b('0x8')](_0x122b('0x9'),attributes,{'tableName':_0x122b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3193=['define','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3193,0xbf));var _0x3319=function(_0x2b5e53,_0x37bb2d){_0x2b5e53=_0x2b5e53-0x0;var _0x10ed26=_0x3193[_0x2b5e53];return _0x10ed26;};'use strict';var _=require('lodash');var util=require(_0x3319('0x0'));var logger=require(_0x3319('0x1'))(_0x3319('0x2'));var moment=require(_0x3319('0x3'));var BPromise=require(_0x3319('0x4'));var rp=require(_0x3319('0x5'));var fs=require('fs');var path=require(_0x3319('0x6'));var rimraf=require(_0x3319('0x7'));var config=require(_0x3319('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x20f15c,_0x51af56){return _0x20f15c[_0x3319('0x9')]('ServicenowConfiguration',attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index eaf0618..230bba2 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 _0xc6d4=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','then','info','request\x20sent','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message'];(function(_0x4b02d4,_0x4674b5){var _0x31b4cb=function(_0x46972e){while(--_0x46972e){_0x4b02d4['push'](_0x4b02d4['shift']());}};_0x31b4cb(++_0x4674b5);}(_0xc6d4,0x1c3));var _0x4c6d=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xc6d4[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x4c6d('0x0'));var util=require(_0x4c6d('0x1'));var moment=require(_0x4c6d('0x2'));var BPromise=require(_0x4c6d('0x3'));var rs=require(_0x4c6d('0x4'));var fs=require('fs');var Redis=require(_0x4c6d('0x5'));var db=require(_0x4c6d('0x6'))['db'];var utils=require(_0x4c6d('0x7'));var logger=require(_0x4c6d('0x8'))('rpc');var config=require(_0x4c6d('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15dce8,_0x280965,_0x2ffaf2){return new BPromise(function(_0x2c2ad2,_0x5006e3){return client['request'](_0x15dce8,_0x2ffaf2)[_0x4c6d('0xa')](function(_0x7bdd32){logger[_0x4c6d('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x280965,'request\x20sent');logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x280965,_0x4c6d('0xc'),JSON[_0x4c6d('0xd')](_0x7bdd32));if(_0x7bdd32[_0x4c6d('0xe')]){if(_0x7bdd32[_0x4c6d('0xe')]['code']===0x1f4){logger['error'](_0x4c6d('0xf'),_0x280965,_0x7bdd32[_0x4c6d('0xe')][_0x4c6d('0x10')]);return _0x5006e3(_0x7bdd32[_0x4c6d('0xe')]['message']);}logger[_0x4c6d('0xe')](_0x4c6d('0xf'),_0x280965,_0x7bdd32['error'][_0x4c6d('0x10')]);return _0x2c2ad2(_0x7bdd32['error'][_0x4c6d('0x10')]);}else{logger[_0x4c6d('0xb')](_0x4c6d('0xf'),_0x280965,_0x4c6d('0xc'));_0x2c2ad2(_0x7bdd32[_0x4c6d('0x11')]['message']);}})['catch'](function(_0xf4fcab){logger[_0x4c6d('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x280965,_0xf4fcab);_0x5006e3(_0xf4fcab);});});} \ No newline at end of file +var _0x3aa7=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x3d504a,_0x2f8a7b){var _0x1e9253=function(_0x4c7183){while(--_0x4c7183){_0x3d504a['push'](_0x3d504a['shift']());}};_0x1e9253(++_0x2f8a7b);}(_0x3aa7,0x1c4));var _0x73aa=function(_0x334aaa,_0x450d50){_0x334aaa=_0x334aaa-0x0;var _0x366047=_0x3aa7[_0x334aaa];return _0x366047;};'use strict';var _=require(_0x73aa('0x0'));var util=require(_0x73aa('0x1'));var moment=require(_0x73aa('0x2'));var BPromise=require(_0x73aa('0x3'));var rs=require(_0x73aa('0x4'));var fs=require('fs');var Redis=require(_0x73aa('0x5'));var db=require(_0x73aa('0x6'))['db'];var utils=require(_0x73aa('0x7'));var logger=require(_0x73aa('0x8'))(_0x73aa('0x9'));var config=require(_0x73aa('0xa'));var jayson=require(_0x73aa('0xb'));var client=jayson[_0x73aa('0xc')][_0x73aa('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x51bbaf,_0x4a840a,_0x3655df){return new BPromise(function(_0x2d59b1,_0x2272ad){return client[_0x73aa('0xe')](_0x51bbaf,_0x3655df)[_0x73aa('0xf')](function(_0x13e623){logger[_0x73aa('0x10')](_0x73aa('0x11'),_0x4a840a,_0x73aa('0x12'));logger[_0x73aa('0x13')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4a840a,'request\x20sent',JSON['stringify'](_0x13e623));if(_0x13e623[_0x73aa('0x14')]){if(_0x13e623[_0x73aa('0x14')][_0x73aa('0x15')]===0x1f4){logger[_0x73aa('0x14')](_0x73aa('0x11'),_0x4a840a,_0x13e623[_0x73aa('0x14')]['message']);return _0x2272ad(_0x13e623[_0x73aa('0x14')][_0x73aa('0x16')]);}logger[_0x73aa('0x14')](_0x73aa('0x11'),_0x4a840a,_0x13e623[_0x73aa('0x14')][_0x73aa('0x16')]);return _0x2d59b1(_0x13e623[_0x73aa('0x14')]['message']);}else{logger[_0x73aa('0x10')](_0x73aa('0x11'),_0x4a840a,'request\x20sent');_0x2d59b1(_0x13e623[_0x73aa('0x17')]['message']);}})[_0x73aa('0x18')](function(_0x3763a1){logger[_0x73aa('0x14')](_0x73aa('0x11'),_0x4a840a,_0x3763a1);_0x2272ad(_0x3763a1);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index fb22da1..643c998 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 _0x5e2e=['../../config/environment','get','index','/:id','isAuthenticated','show','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2b03c5,_0xa4bf5){var _0x16e7b7=function(_0x16499b){while(--_0x16499b){_0x2b03c5['push'](_0x2b03c5['shift']());}};_0x16e7b7(++_0xa4bf5);}(_0x5e2e,0x124));var _0xe5e2=function(_0x3afdcf,_0x4aaf08){_0x3afdcf=_0x3afdcf-0x0;var _0x3b1af0=_0x5e2e[_0x3afdcf];return _0x3b1af0;};'use strict';var multer=require(_0xe5e2('0x0'));var util=require(_0xe5e2('0x1'));var path=require(_0xe5e2('0x2'));var timeout=require(_0xe5e2('0x3'));var express=require(_0xe5e2('0x4'));var router=express[_0xe5e2('0x5')]();var fs_extra=require(_0xe5e2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe5e2('0x7'));var config=require(_0xe5e2('0x8'));var controller=require('./intServicenowField.controller');router[_0xe5e2('0x9')]('/',auth['isAuthenticated'](),controller[_0xe5e2('0xa')]);router[_0xe5e2('0x9')](_0xe5e2('0xb'),auth[_0xe5e2('0xc')](),controller[_0xe5e2('0xd')]);router['post']('/',auth[_0xe5e2('0xc')](),controller['create']);router['put'](_0xe5e2('0xb'),auth[_0xe5e2('0xc')](),controller['update']);router[_0xe5e2('0xe')](_0xe5e2('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd2d4=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','../../components/interaction/service','./intServicenowField.controller','get','index','/:id'];(function(_0x311e77,_0x49a459){var _0x559c54=function(_0x283a97){while(--_0x283a97){_0x311e77['push'](_0x311e77['shift']());}};_0x559c54(++_0x49a459);}(_0xd2d4,0x6f));var _0x4d2d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd2d4[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x4d2d('0x0'));var util=require(_0x4d2d('0x1'));var path=require('path');var timeout=require(_0x4d2d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4d2d('0x3'));var config=require('../../config/environment');var controller=require(_0x4d2d('0x4'));router[_0x4d2d('0x5')]('/',auth['isAuthenticated'](),controller[_0x4d2d('0x6')]);router[_0x4d2d('0x5')](_0x4d2d('0x7'),auth[_0x4d2d('0x8')](),controller[_0x4d2d('0x9')]);router[_0x4d2d('0xa')]('/',auth[_0x4d2d('0x8')](),controller[_0x4d2d('0xb')]);router[_0x4d2d('0xc')](_0x4d2d('0x7'),auth[_0x4d2d('0x8')](),controller[_0x4d2d('0xd')]);router[_0x4d2d('0xe')](_0x4d2d('0x7'),auth['isAuthenticated'](),controller[_0x4d2d('0xf')]);module[_0x4d2d('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 f412943..6fb7e06 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 _0x1883=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x28cc16,_0x3c85d8){var _0x6e0a45=function(_0x3aa572){while(--_0x3aa572){_0x28cc16['push'](_0x28cc16['shift']());}};_0x6e0a45(++_0x3c85d8);}(_0x1883,0xab));var _0x3188=function(_0x23721d,_0x268856){_0x23721d=_0x23721d-0x0;var _0x192834=_0x1883[_0x23721d];return _0x192834;};'use strict';var Sequelize=require(_0x3188('0x0'));module[_0x3188('0x1')]={'type':{'type':Sequelize[_0x3188('0x2')](_0x3188('0x3'),_0x3188('0x4'),_0x3188('0x5'),_0x3188('0x6'),_0x3188('0x7')),'defaultValue':_0x3188('0x3')},'content':{'type':Sequelize[_0x3188('0x8')]},'key':{'type':Sequelize[_0x3188('0x8')]},'keyType':{'type':Sequelize[_0x3188('0x2')](_0x3188('0x3'),_0x3188('0x4'),_0x3188('0x5'))},'keyContent':{'type':Sequelize[_0x3188('0x8')]},'idField':{'type':Sequelize[_0x3188('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3188('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3188('0x8')]}}; \ No newline at end of file +var _0xc4aa=['ENUM','string','variable','customVariable','STRING','sequelize','exports'];(function(_0x35a0e2,_0x302ad1){var _0x31ea9a=function(_0x356d7d){while(--_0x356d7d){_0x35a0e2['push'](_0x35a0e2['shift']());}};_0x31ea9a(++_0x302ad1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc4aa[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'type':{'type':Sequelize[_0xac4a('0x2')](_0xac4a('0x3'),_0xac4a('0x4'),_0xac4a('0x5'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xac4a('0x6')]},'key':{'type':Sequelize[_0xac4a('0x6')]},'keyType':{'type':Sequelize[_0xac4a('0x2')](_0xac4a('0x3'),_0xac4a('0x4'),_0xac4a('0x5'))},'keyContent':{'type':Sequelize[_0xac4a('0x6')]},'idField':{'type':Sequelize[_0xac4a('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xac4a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index d723bf3..45d0521 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 _0xa7c9=['status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','ServicenowField','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x265673,_0x433599){var _0x5c41bc=function(_0x1531c8){while(--_0x1531c8){_0x265673['push'](_0x265673['shift']());}};_0x5c41bc(++_0x433599);}(_0xa7c9,0x116));var _0x9a7c=function(_0x4bf182,_0xf467e){_0x4bf182=_0x4bf182-0x0;var _0x1d4818=_0xa7c9[_0x4bf182];return _0x1d4818;};'use strict';var emlformat=require(_0x9a7c('0x0'));var rimraf=require(_0x9a7c('0x1'));var zipdir=require(_0x9a7c('0x2'));var jsonpatch=require(_0x9a7c('0x3'));var rp=require('request-promise');var moment=require(_0x9a7c('0x4'));var BPromise=require(_0x9a7c('0x5'));var Mustache=require(_0x9a7c('0x6'));var util=require('util');var path=require(_0x9a7c('0x7'));var sox=require(_0x9a7c('0x8'));var csv=require(_0x9a7c('0x9'));var ejs=require(_0x9a7c('0xa'));var fs=require('fs');var fs_extra=require(_0x9a7c('0xb'));var _=require('lodash');var squel=require(_0x9a7c('0xc'));var crypto=require(_0x9a7c('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9a7c('0x9'));var querystring=require(_0x9a7c('0xe'));var Papa=require(_0x9a7c('0xf'));var Redis=require(_0x9a7c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9a7c('0x11'));var as=require(_0x9a7c('0x12'));var hardwareService=require(_0x9a7c('0x13'));var logger=require(_0x9a7c('0x14'))(_0x9a7c('0x15'));var utils=require(_0x9a7c('0x16'));var config=require(_0x9a7c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9a7c('0x18'))['db'];function respondWithStatusCode(_0x1a3c4e,_0x43845d){_0x43845d=_0x43845d||0xcc;return function(_0x323d9a){if(_0x323d9a){return _0x1a3c4e[_0x9a7c('0x19')](_0x43845d);}return _0x1a3c4e[_0x9a7c('0x1a')](_0x43845d)['end']();};}function respondWithResult(_0x1857db,_0x19d9a0){_0x19d9a0=_0x19d9a0||0xc8;return function(_0x4a59b3){if(_0x4a59b3){return _0x1857db['status'](_0x19d9a0)[_0x9a7c('0x1b')](_0x4a59b3);}};}function respondWithFilteredResult(_0x3aa453,_0x484a65){return function(_0x2b46c5){if(_0x2b46c5){var _0x3801a8=typeof _0x484a65[_0x9a7c('0x1c')]===_0x9a7c('0x1d')&&typeof _0x484a65['limit']===_0x9a7c('0x1d');var _0x5425a1=_0x2b46c5['count'];var _0x3068a7=_0x3801a8?0x0:_0x484a65['offset'];var _0x50e26d=_0x3801a8?_0x2b46c5['count']:_0x484a65[_0x9a7c('0x1c')]+_0x484a65[_0x9a7c('0x1e')];var _0x39e609;if(_0x50e26d>=_0x5425a1){_0x50e26d=_0x5425a1;_0x39e609=0xc8;}else{_0x39e609=0xce;}_0x3aa453[_0x9a7c('0x1a')](_0x39e609);return _0x3aa453['set'](_0x9a7c('0x1f'),_0x3068a7+'-'+_0x50e26d+'/'+_0x5425a1)['json'](_0x2b46c5);}return null;};}function patchUpdates(_0x4525b8){return function(_0x5360e3){try{jsonpatch[_0x9a7c('0x20')](_0x5360e3,_0x4525b8,!![]);}catch(_0x37ebcf){return BPromise[_0x9a7c('0x21')](_0x37ebcf);}return _0x5360e3[_0x9a7c('0x22')]();};}function saveUpdates(_0x343209,_0x5ec2ee){return function(_0x1f794f){if(_0x1f794f){return _0x1f794f[_0x9a7c('0x23')](_0x343209)[_0x9a7c('0x24')](function(_0x534443){return _0x534443;});}return null;};}function removeEntity(_0x6d63de,_0xe52cde){return function(_0x3858b9){if(_0x3858b9){return _0x3858b9[_0x9a7c('0x25')]()[_0x9a7c('0x24')](function(){_0x6d63de[_0x9a7c('0x1a')](0xcc)[_0x9a7c('0x26')]();});}};}function handleEntityNotFound(_0x5f545e,_0x1ae68c){return function(_0x215467){if(!_0x215467){_0x5f545e[_0x9a7c('0x19')](0x194);}return _0x215467;};}function handleError(_0x45982b,_0x3bd2b3){_0x3bd2b3=_0x3bd2b3||0x1f4;return function(_0x559f62){logger['error'](_0x559f62[_0x9a7c('0x27')]);if(_0x559f62['name']){delete _0x559f62[_0x9a7c('0x28')];}_0x45982b[_0x9a7c('0x1a')](_0x3bd2b3)[_0x9a7c('0x29')](_0x559f62);};}exports[_0x9a7c('0x2a')]=function(_0x47d4d6,_0x22fce7){var _0x1ab916={},_0x543752={},_0x387899={'count':0x0,'rows':[]};var _0x67674d=_[_0x9a7c('0x2b')](db[_0x9a7c('0x2c')]['rawAttributes'],function(_0x16fb5a){return{'name':_0x16fb5a[_0x9a7c('0x2d')],'type':_0x16fb5a['type'][_0x9a7c('0x2e')]};});_0x543752[_0x9a7c('0x2f')]=_[_0x9a7c('0x2b')](_0x67674d,_0x9a7c('0x28'));_0x543752[_0x9a7c('0x30')]=_[_0x9a7c('0x31')](_0x47d4d6[_0x9a7c('0x30')]);_0x543752['filters']=_[_0x9a7c('0x32')](_0x543752['model'],_0x543752[_0x9a7c('0x30')]);_0x1ab916[_0x9a7c('0x33')]=_[_0x9a7c('0x32')](_0x543752[_0x9a7c('0x2f')],qs[_0x9a7c('0x34')](_0x47d4d6[_0x9a7c('0x30')][_0x9a7c('0x34')]));_0x1ab916[_0x9a7c('0x33')]=_0x1ab916['attributes'][_0x9a7c('0x35')]?_0x1ab916[_0x9a7c('0x33')]:_0x543752[_0x9a7c('0x2f')];if(!_0x47d4d6[_0x9a7c('0x30')]['hasOwnProperty'](_0x9a7c('0x36'))){_0x1ab916['limit']=qs[_0x9a7c('0x1e')](_0x47d4d6[_0x9a7c('0x30')][_0x9a7c('0x1e')]);_0x1ab916['offset']=qs[_0x9a7c('0x1c')](_0x47d4d6[_0x9a7c('0x30')][_0x9a7c('0x1c')]);}_0x1ab916[_0x9a7c('0x37')]=qs[_0x9a7c('0x38')](_0x47d4d6[_0x9a7c('0x30')]['sort']);_0x1ab916[_0x9a7c('0x39')]=qs[_0x9a7c('0x3a')](_[_0x9a7c('0x3b')](_0x47d4d6['query'],_0x543752[_0x9a7c('0x3a')]),_0x67674d);if(_0x47d4d6['query']['filter']){_0x1ab916[_0x9a7c('0x39')]=_[_0x9a7c('0x3c')](_0x1ab916[_0x9a7c('0x39')],{'$or':_[_0x9a7c('0x2b')](_0x67674d,function(_0x565afd){if(_0x565afd[_0x9a7c('0x3d')]!==_0x9a7c('0x3e')){var _0x5a5ec9={};_0x5a5ec9[_0x565afd['name']]={'$like':'%'+_0x47d4d6[_0x9a7c('0x30')][_0x9a7c('0x3f')]+'%'};return _0x5a5ec9;}})});}_0x1ab916=_[_0x9a7c('0x3c')]({},_0x1ab916,_0x47d4d6[_0x9a7c('0x40')]);var _0x530382={'where':_0x1ab916[_0x9a7c('0x39')]};return db[_0x9a7c('0x2c')][_0x9a7c('0x41')](_0x530382)[_0x9a7c('0x24')](function(_0x3f4ce1){_0x387899[_0x9a7c('0x41')]=_0x3f4ce1;if(_0x47d4d6[_0x9a7c('0x30')][_0x9a7c('0x42')]){_0x1ab916[_0x9a7c('0x43')]=[{'all':!![]}];}return db[_0x9a7c('0x2c')][_0x9a7c('0x44')](_0x1ab916);})[_0x9a7c('0x24')](function(_0xfb79ef){_0x387899[_0x9a7c('0x45')]=_0xfb79ef;return _0x387899;})['then'](respondWithFilteredResult(_0x22fce7,_0x1ab916))[_0x9a7c('0x46')](handleError(_0x22fce7,null));};exports['show']=function(_0x50d9c9,_0x2f6a10){var _0xe7533e={'raw':!![],'where':{'id':_0x50d9c9[_0x9a7c('0x47')]['id']}},_0x4953f9={};_0x4953f9['model']=_[_0x9a7c('0x31')](db[_0x9a7c('0x2c')][_0x9a7c('0x48')]);_0x4953f9[_0x9a7c('0x30')]=_[_0x9a7c('0x31')](_0x50d9c9[_0x9a7c('0x30')]);_0x4953f9[_0x9a7c('0x3a')]=_[_0x9a7c('0x32')](_0x4953f9[_0x9a7c('0x2f')],_0x4953f9[_0x9a7c('0x30')]);_0xe7533e[_0x9a7c('0x33')]=_[_0x9a7c('0x32')](_0x4953f9['model'],qs[_0x9a7c('0x34')](_0x50d9c9['query'][_0x9a7c('0x34')]));_0xe7533e['attributes']=_0xe7533e[_0x9a7c('0x33')][_0x9a7c('0x35')]?_0xe7533e[_0x9a7c('0x33')]:_0x4953f9['model'];if(_0x50d9c9[_0x9a7c('0x30')][_0x9a7c('0x42')]){_0xe7533e['include']=[{'all':!![]}];}_0xe7533e=_[_0x9a7c('0x3c')]({},_0xe7533e,_0x50d9c9[_0x9a7c('0x40')]);return db[_0x9a7c('0x2c')][_0x9a7c('0x49')](_0xe7533e)['then'](handleEntityNotFound(_0x2f6a10,null))[_0x9a7c('0x24')](respondWithResult(_0x2f6a10,null))['catch'](handleError(_0x2f6a10,null));};exports[_0x9a7c('0x4a')]=function(_0x18e0e5,_0x32ee74){return db[_0x9a7c('0x2c')][_0x9a7c('0x4a')](_0x18e0e5['body'],{})[_0x9a7c('0x24')](respondWithResult(_0x32ee74,0xc9))[_0x9a7c('0x46')](handleError(_0x32ee74,null));};exports['update']=function(_0x38a3fd,_0x427cc6){if(_0x38a3fd[_0x9a7c('0x4b')]['id']){delete _0x38a3fd['body']['id'];}return db['ServicenowField'][_0x9a7c('0x49')]({'where':{'id':_0x38a3fd[_0x9a7c('0x47')]['id']}})[_0x9a7c('0x24')](handleEntityNotFound(_0x427cc6,null))['then'](saveUpdates(_0x38a3fd[_0x9a7c('0x4b')],null))['then'](respondWithResult(_0x427cc6,null))['catch'](handleError(_0x427cc6,null));};exports[_0x9a7c('0x25')]=function(_0xc81bd0,_0x3591e1){return db[_0x9a7c('0x2c')][_0x9a7c('0x49')]({'where':{'id':_0xc81bd0[_0x9a7c('0x47')]['id']}})['then'](handleEntityNotFound(_0x3591e1,null))[_0x9a7c('0x24')](removeEntity(_0x3591e1,null))[_0x9a7c('0x46')](handleError(_0x3591e1,null));}; \ No newline at end of file +var _0x1d71=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','apply','save','update','then','destroy','end','name','send','index','ServicenowField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','merge','create','body','find','params','rimraf','request-promise','moment','mustache','util','path','sox'];(function(_0x45afc4,_0xeaa0e3){var _0x43e32b=function(_0x4fa1b0){while(--_0x4fa1b0){_0x45afc4['push'](_0x45afc4['shift']());}};_0x43e32b(++_0xeaa0e3);}(_0x1d71,0x1af));var _0x11d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d71[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x11d7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x11d7('0x1'));var moment=require(_0x11d7('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x11d7('0x3'));var util=require(_0x11d7('0x4'));var path=require(_0x11d7('0x5'));var sox=require(_0x11d7('0x6'));var csv=require(_0x11d7('0x7'));var ejs=require(_0x11d7('0x8'));var fs=require('fs');var fs_extra=require(_0x11d7('0x9'));var _=require(_0x11d7('0xa'));var squel=require(_0x11d7('0xb'));var crypto=require(_0x11d7('0xc'));var jsforce=require(_0x11d7('0xd'));var deskjs=require(_0x11d7('0xe'));var toCsv=require(_0x11d7('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x11d7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x11d7('0x10'));var as=require(_0x11d7('0x11'));var hardwareService=require(_0x11d7('0x12'));var logger=require(_0x11d7('0x13'))(_0x11d7('0x14'));var utils=require('../../config/utils');var config=require(_0x11d7('0x15'));var licenseUtil=require(_0x11d7('0x16'));var db=require(_0x11d7('0x17'))['db'];function respondWithStatusCode(_0x3815a1,_0x31da4a){_0x31da4a=_0x31da4a||0xcc;return function(_0x350013){if(_0x350013){return _0x3815a1[_0x11d7('0x18')](_0x31da4a);}return _0x3815a1[_0x11d7('0x19')](_0x31da4a)['end']();};}function respondWithResult(_0x2c9027,_0x209553){_0x209553=_0x209553||0xc8;return function(_0x4a1cb1){if(_0x4a1cb1){return _0x2c9027[_0x11d7('0x19')](_0x209553)[_0x11d7('0x1a')](_0x4a1cb1);}};}function respondWithFilteredResult(_0x53c676,_0x23a933){return function(_0x14feb0){if(_0x14feb0){var _0x2c5c5f=typeof _0x23a933['offset']===_0x11d7('0x1b')&&typeof _0x23a933[_0x11d7('0x1c')]===_0x11d7('0x1b');var _0x1e7ad5=_0x14feb0[_0x11d7('0x1d')];var _0x354145=_0x2c5c5f?0x0:_0x23a933['offset'];var _0x3b8817=_0x2c5c5f?_0x14feb0[_0x11d7('0x1d')]:_0x23a933[_0x11d7('0x1e')]+_0x23a933[_0x11d7('0x1c')];var _0x45652e;if(_0x3b8817>=_0x1e7ad5){_0x3b8817=_0x1e7ad5;_0x45652e=0xc8;}else{_0x45652e=0xce;}_0x53c676[_0x11d7('0x19')](_0x45652e);return _0x53c676['set']('Content-Range',_0x354145+'-'+_0x3b8817+'/'+_0x1e7ad5)[_0x11d7('0x1a')](_0x14feb0);}return null;};}function patchUpdates(_0x4f5476){return function(_0x482c6d){try{jsonpatch[_0x11d7('0x1f')](_0x482c6d,_0x4f5476,!![]);}catch(_0x5ca8cf){return BPromise['reject'](_0x5ca8cf);}return _0x482c6d[_0x11d7('0x20')]();};}function saveUpdates(_0x12cc0a,_0x3c0746){return function(_0x4a1d1d){if(_0x4a1d1d){return _0x4a1d1d[_0x11d7('0x21')](_0x12cc0a)[_0x11d7('0x22')](function(_0x3572c7){return _0x3572c7;});}return null;};}function removeEntity(_0x229caf,_0x41f123){return function(_0x57a881){if(_0x57a881){return _0x57a881[_0x11d7('0x23')]()[_0x11d7('0x22')](function(){_0x229caf[_0x11d7('0x19')](0xcc)[_0x11d7('0x24')]();});}};}function handleEntityNotFound(_0x46880a,_0x1702fb){return function(_0x3b639c){if(!_0x3b639c){_0x46880a[_0x11d7('0x18')](0x194);}return _0x3b639c;};}function handleError(_0x5696ec,_0x1de10e){_0x1de10e=_0x1de10e||0x1f4;return function(_0x2e8953){logger['error'](_0x2e8953['stack']);if(_0x2e8953['name']){delete _0x2e8953[_0x11d7('0x25')];}_0x5696ec[_0x11d7('0x19')](_0x1de10e)[_0x11d7('0x26')](_0x2e8953);};}exports[_0x11d7('0x27')]=function(_0x3b4fca,_0x22f325){var _0xfbd6b1={},_0x31867f={},_0x1ea99c={'count':0x0,'rows':[]};var _0x3a0f08=_['map'](db[_0x11d7('0x28')][_0x11d7('0x29')],function(_0x3b6240){return{'name':_0x3b6240[_0x11d7('0x2a')],'type':_0x3b6240[_0x11d7('0x2b')][_0x11d7('0x2c')]};});_0x31867f[_0x11d7('0x2d')]=_[_0x11d7('0x2e')](_0x3a0f08,_0x11d7('0x25'));_0x31867f[_0x11d7('0x2f')]=_[_0x11d7('0x30')](_0x3b4fca[_0x11d7('0x2f')]);_0x31867f[_0x11d7('0x31')]=_[_0x11d7('0x32')](_0x31867f[_0x11d7('0x2d')],_0x31867f[_0x11d7('0x2f')]);_0xfbd6b1['attributes']=_[_0x11d7('0x32')](_0x31867f[_0x11d7('0x2d')],qs[_0x11d7('0x33')](_0x3b4fca[_0x11d7('0x2f')][_0x11d7('0x33')]));_0xfbd6b1['attributes']=_0xfbd6b1['attributes'][_0x11d7('0x34')]?_0xfbd6b1[_0x11d7('0x35')]:_0x31867f[_0x11d7('0x2d')];if(!_0x3b4fca[_0x11d7('0x2f')][_0x11d7('0x36')]('nolimit')){_0xfbd6b1[_0x11d7('0x1c')]=qs[_0x11d7('0x1c')](_0x3b4fca[_0x11d7('0x2f')][_0x11d7('0x1c')]);_0xfbd6b1[_0x11d7('0x1e')]=qs[_0x11d7('0x1e')](_0x3b4fca[_0x11d7('0x2f')]['offset']);}_0xfbd6b1[_0x11d7('0x37')]=qs['sort'](_0x3b4fca['query'][_0x11d7('0x38')]);_0xfbd6b1[_0x11d7('0x39')]=qs[_0x11d7('0x31')](_[_0x11d7('0x3a')](_0x3b4fca[_0x11d7('0x2f')],_0x31867f[_0x11d7('0x31')]),_0x3a0f08);if(_0x3b4fca[_0x11d7('0x2f')][_0x11d7('0x3b')]){_0xfbd6b1['where']=_['merge'](_0xfbd6b1[_0x11d7('0x39')],{'$or':_[_0x11d7('0x2e')](_0x3a0f08,function(_0x509916){if(_0x509916[_0x11d7('0x2b')]!==_0x11d7('0x3c')){var _0xba3e98={};_0xba3e98[_0x509916['name']]={'$like':'%'+_0x3b4fca[_0x11d7('0x2f')][_0x11d7('0x3b')]+'%'};return _0xba3e98;}})});}_0xfbd6b1=_['merge']({},_0xfbd6b1,_0x3b4fca[_0x11d7('0x3d')]);var _0x5c5ae1={'where':_0xfbd6b1[_0x11d7('0x39')]};return db[_0x11d7('0x28')][_0x11d7('0x1d')](_0x5c5ae1)[_0x11d7('0x22')](function(_0x4b967b){_0x1ea99c[_0x11d7('0x1d')]=_0x4b967b;if(_0x3b4fca[_0x11d7('0x2f')]['includeAll']){_0xfbd6b1[_0x11d7('0x3e')]=[{'all':!![]}];}return db['ServicenowField'][_0x11d7('0x3f')](_0xfbd6b1);})[_0x11d7('0x22')](function(_0x3e0da5){_0x1ea99c[_0x11d7('0x40')]=_0x3e0da5;return _0x1ea99c;})[_0x11d7('0x22')](respondWithFilteredResult(_0x22f325,_0xfbd6b1))[_0x11d7('0x41')](handleError(_0x22f325,null));};exports[_0x11d7('0x42')]=function(_0x5134e0,_0x4d64f8){var _0x29ee88={'raw':!![],'where':{'id':_0x5134e0['params']['id']}},_0x5c5cad={};_0x5c5cad[_0x11d7('0x2d')]=_['keys'](db[_0x11d7('0x28')][_0x11d7('0x29')]);_0x5c5cad[_0x11d7('0x2f')]=_[_0x11d7('0x30')](_0x5134e0[_0x11d7('0x2f')]);_0x5c5cad[_0x11d7('0x31')]=_[_0x11d7('0x32')](_0x5c5cad[_0x11d7('0x2d')],_0x5c5cad[_0x11d7('0x2f')]);_0x29ee88[_0x11d7('0x35')]=_[_0x11d7('0x32')](_0x5c5cad[_0x11d7('0x2d')],qs[_0x11d7('0x33')](_0x5134e0[_0x11d7('0x2f')][_0x11d7('0x33')]));_0x29ee88[_0x11d7('0x35')]=_0x29ee88['attributes'][_0x11d7('0x34')]?_0x29ee88['attributes']:_0x5c5cad[_0x11d7('0x2d')];if(_0x5134e0[_0x11d7('0x2f')][_0x11d7('0x43')]){_0x29ee88['include']=[{'all':!![]}];}_0x29ee88=_[_0x11d7('0x44')]({},_0x29ee88,_0x5134e0[_0x11d7('0x3d')]);return db[_0x11d7('0x28')]['find'](_0x29ee88)[_0x11d7('0x22')](handleEntityNotFound(_0x4d64f8,null))[_0x11d7('0x22')](respondWithResult(_0x4d64f8,null))[_0x11d7('0x41')](handleError(_0x4d64f8,null));};exports['create']=function(_0x1c811f,_0x180312){return db[_0x11d7('0x28')][_0x11d7('0x45')](_0x1c811f[_0x11d7('0x46')],{})[_0x11d7('0x22')](respondWithResult(_0x180312,0xc9))[_0x11d7('0x41')](handleError(_0x180312,null));};exports[_0x11d7('0x21')]=function(_0x5b185e,_0x592f23){if(_0x5b185e[_0x11d7('0x46')]['id']){delete _0x5b185e[_0x11d7('0x46')]['id'];}return db[_0x11d7('0x28')][_0x11d7('0x47')]({'where':{'id':_0x5b185e[_0x11d7('0x48')]['id']}})[_0x11d7('0x22')](handleEntityNotFound(_0x592f23,null))[_0x11d7('0x22')](saveUpdates(_0x5b185e[_0x11d7('0x46')],null))[_0x11d7('0x22')](respondWithResult(_0x592f23,null))[_0x11d7('0x41')](handleError(_0x592f23,null));};exports[_0x11d7('0x23')]=function(_0x389ba4,_0x22d4d9){return db['ServicenowField'][_0x11d7('0x47')]({'where':{'id':_0x389ba4[_0x11d7('0x48')]['id']}})[_0x11d7('0x22')](handleEntityNotFound(_0x22d4d9,null))[_0x11d7('0x22')](removeEntity(_0x22d4d9,null))['catch'](handleError(_0x22d4d9,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index d1ebd01..491cff7 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 _0xd027=['moment','bluebird','path','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index','idField','lodash','util'];(function(_0x4c612c,_0x38c9fc){var _0x4daff6=function(_0x2dd706){while(--_0x2dd706){_0x4c612c['push'](_0x4c612c['shift']());}};_0x4daff6(++_0x38c9fc);}(_0xd027,0x106));var _0x7d02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd027[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7d02('0x0'));var util=require(_0x7d02('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7d02('0x2'));var BPromise=require(_0x7d02('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d02('0x4'));var rimraf=require('rimraf');var config=require(_0x7d02('0x5'));var attributes=require(_0x7d02('0x6'));module[_0x7d02('0x7')]=function(_0x190066,_0x515d2d){return _0x190066[_0x7d02('0x8')]('ServicenowField',attributes,{'tableName':_0x7d02('0x9'),'paranoid':![],'indexes':[{'name':_0x7d02('0xa'),'fields':[_0x7d02('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa488=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','ServicenowField','int_servicenow_fields','servicenow_unique_index'];(function(_0x464fb0,_0x38d987){var _0x4f94ad=function(_0x22d1f1){while(--_0x22d1f1){_0x464fb0['push'](_0x464fb0['shift']());}};_0x4f94ad(++_0x38d987);}(_0xa488,0x6a));var _0x8a48=function(_0x65eae,_0x32dc5f){_0x65eae=_0x65eae-0x0;var _0x18e82b=_0xa488[_0x65eae];return _0x18e82b;};'use strict';var _=require(_0x8a48('0x0'));var util=require(_0x8a48('0x1'));var logger=require(_0x8a48('0x2'))(_0x8a48('0x3'));var moment=require(_0x8a48('0x4'));var BPromise=require(_0x8a48('0x5'));var rp=require(_0x8a48('0x6'));var fs=require('fs');var path=require(_0x8a48('0x7'));var rimraf=require(_0x8a48('0x8'));var config=require(_0x8a48('0x9'));var attributes=require(_0x8a48('0xa'));module['exports']=function(_0x4af466,_0x59a9e3){return _0x4af466['define'](_0x8a48('0xb'),attributes,{'tableName':_0x8a48('0xc'),'paranoid':![],'indexes':[{'name':_0x8a48('0xd'),'fields':['idField',_0x8a48('0xe')],'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 31e7448..ded122a 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 _0xb1e3=['../../config/logger','../../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','ioredis','../../mysqldb','../../config/utils'];(function(_0x3a2154,_0x1ae023){var _0x5b42d7=function(_0x2d14f3){while(--_0x2d14f3){_0x3a2154['push'](_0x3a2154['shift']());}};_0x5b42d7(++_0x1ae023);}(_0xb1e3,0x188));var _0x3b1e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb1e3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3b1e('0x0'));var util=require(_0x3b1e('0x1'));var moment=require(_0x3b1e('0x2'));var BPromise=require(_0x3b1e('0x3'));var rs=require(_0x3b1e('0x4'));var fs=require('fs');var Redis=require(_0x3b1e('0x5'));var db=require(_0x3b1e('0x6'))['db'];var utils=require(_0x3b1e('0x7'));var logger=require(_0x3b1e('0x8'))('rpc');var config=require(_0x3b1e('0x9'));var jayson=require(_0x3b1e('0xa'));var client=jayson[_0x3b1e('0xb')][_0x3b1e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ee2f3,_0x5b287e,_0x150bdc){return new BPromise(function(_0x475d9d,_0x3b124f){return client[_0x3b1e('0xd')](_0x1ee2f3,_0x150bdc)['then'](function(_0x5c7c45){logger[_0x3b1e('0xe')](_0x3b1e('0xf'),_0x5b287e,_0x3b1e('0x10'));logger[_0x3b1e('0x11')](_0x3b1e('0x12'),_0x5b287e,'request\x20sent',JSON[_0x3b1e('0x13')](_0x5c7c45));if(_0x5c7c45[_0x3b1e('0x14')]){if(_0x5c7c45[_0x3b1e('0x14')][_0x3b1e('0x15')]===0x1f4){logger[_0x3b1e('0x14')](_0x3b1e('0xf'),_0x5b287e,_0x5c7c45['error'][_0x3b1e('0x16')]);return _0x3b124f(_0x5c7c45[_0x3b1e('0x14')][_0x3b1e('0x16')]);}logger['error'](_0x3b1e('0xf'),_0x5b287e,_0x5c7c45['error'][_0x3b1e('0x16')]);return _0x475d9d(_0x5c7c45[_0x3b1e('0x14')][_0x3b1e('0x16')]);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x5b287e,'request\x20sent');_0x475d9d(_0x5c7c45[_0x3b1e('0x17')][_0x3b1e('0x16')]);}})[_0x3b1e('0x18')](function(_0x23cff5){logger[_0x3b1e('0x14')]('ServicenowField,\x20%s,\x20%s',_0x5b287e,_0x23cff5);_0x3b124f(_0x23cff5);});});} \ No newline at end of file +var _0x6316=['ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent'];(function(_0x209ad7,_0x4ca1d7){var _0x4e9cbb=function(_0x262934){while(--_0x262934){_0x209ad7['push'](_0x209ad7['shift']());}};_0x4e9cbb(++_0x4ca1d7);}(_0x6316,0x1e7));var _0x6631=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6316[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x6631('0x0'));var moment=require('moment');var BPromise=require(_0x6631('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6631('0x2'));var db=require(_0x6631('0x3'))['db'];var utils=require(_0x6631('0x4'));var logger=require('../../config/logger')(_0x6631('0x5'));var config=require('../../config/environment');var jayson=require(_0x6631('0x6'));var client=jayson['client'][_0x6631('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x424f87,_0x1b7f43,_0x23532b){return new BPromise(function(_0x26f14c,_0x1a4fb4){return client[_0x6631('0x8')](_0x424f87,_0x23532b)[_0x6631('0x9')](function(_0x563afd){logger[_0x6631('0xa')](_0x6631('0xb'),_0x1b7f43,_0x6631('0xc'));logger['debug'](_0x6631('0xd'),_0x1b7f43,_0x6631('0xc'),JSON[_0x6631('0xe')](_0x563afd));if(_0x563afd['error']){if(_0x563afd[_0x6631('0xf')][_0x6631('0x10')]===0x1f4){logger[_0x6631('0xf')](_0x6631('0xb'),_0x1b7f43,_0x563afd[_0x6631('0xf')][_0x6631('0x11')]);return _0x1a4fb4(_0x563afd[_0x6631('0xf')][_0x6631('0x11')]);}logger[_0x6631('0xf')](_0x6631('0xb'),_0x1b7f43,_0x563afd[_0x6631('0xf')][_0x6631('0x11')]);return _0x26f14c(_0x563afd[_0x6631('0xf')][_0x6631('0x11')]);}else{logger[_0x6631('0xa')](_0x6631('0xb'),_0x1b7f43,_0x6631('0xc'));_0x26f14c(_0x563afd[_0x6631('0x12')][_0x6631('0x11')]);}})[_0x6631('0x13')](function(_0x543b28){logger[_0x6631('0xf')]('ServicenowField,\x20%s,\x20%s',_0x1b7f43,_0x543b28);_0x1a4fb4(_0x543b28);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index d7d9bcb..04b3356 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 _0xcb3c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','isAuthenticated','show','get','/:id/configurations','/:id/fields','post','put','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2d4a54,_0x1f759f){var _0x489a0f=function(_0x1d89b4){while(--_0x1d89b4){_0x2d4a54['push'](_0x2d4a54['shift']());}};_0x489a0f(++_0x1f759f);}(_0xcb3c,0xce));var _0xccb3=function(_0x44dcdb,_0x4ebb58){_0x44dcdb=_0x44dcdb-0x0;var _0x152a5b=_0xcb3c[_0x44dcdb];return _0x152a5b;};'use strict';var multer=require(_0xccb3('0x0'));var util=require(_0xccb3('0x1'));var path=require(_0xccb3('0x2'));var timeout=require(_0xccb3('0x3'));var express=require(_0xccb3('0x4'));var router=express[_0xccb3('0x5')]();var fs_extra=require(_0xccb3('0x6'));var auth=require(_0xccb3('0x7'));var interaction=require(_0xccb3('0x8'));var config=require(_0xccb3('0x9'));var controller=require(_0xccb3('0xa'));router['get']('/',auth[_0xccb3('0xb')](),controller['index']);router['get']('/:id',auth[_0xccb3('0xb')](),controller[_0xccb3('0xc')]);router[_0xccb3('0xd')](_0xccb3('0xe'),auth[_0xccb3('0xb')](),controller['getConfigurations']);router[_0xccb3('0xd')](_0xccb3('0xf'),auth[_0xccb3('0xb')](),controller['getFields']);router['post']('/',auth[_0xccb3('0xb')](),controller['create']);router[_0xccb3('0x10')](_0xccb3('0xe'),auth[_0xccb3('0xb')](),controller['addConfiguration']);router[_0xccb3('0x11')](_0xccb3('0x12'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xccb3('0x12'),auth[_0xccb3('0xb')](),controller[_0xccb3('0x13')]);module[_0xccb3('0x14')]=router; \ No newline at end of file +var _0x09ae=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index'];(function(_0x34cd54,_0x428351){var _0x1bb079=function(_0x333851){while(--_0x333851){_0x34cd54['push'](_0x34cd54['shift']());}};_0x1bb079(++_0x428351);}(_0x09ae,0x89));var _0xe09a=function(_0x42b848,_0x105663){_0x42b848=_0x42b848-0x0;var _0x39bb89=_0x09ae[_0x42b848];return _0x39bb89;};'use strict';var multer=require(_0xe09a('0x0'));var util=require(_0xe09a('0x1'));var path=require(_0xe09a('0x2'));var timeout=require(_0xe09a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe09a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe09a('0x5'));var controller=require(_0xe09a('0x6'));router[_0xe09a('0x7')]('/',auth[_0xe09a('0x8')](),controller[_0xe09a('0x9')]);router[_0xe09a('0x7')](_0xe09a('0xa'),auth[_0xe09a('0x8')](),controller[_0xe09a('0xb')]);router['get'](_0xe09a('0xc'),auth[_0xe09a('0x8')](),controller[_0xe09a('0xd')]);router[_0xe09a('0x7')](_0xe09a('0xe'),auth[_0xe09a('0x8')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0xe09a('0xf')]);router[_0xe09a('0x10')](_0xe09a('0xc'),auth[_0xe09a('0x8')](),controller[_0xe09a('0x11')]);router['put'](_0xe09a('0xa'),auth[_0xe09a('0x8')](),controller['update']);router[_0xe09a('0x12')](_0xe09a('0xa'),auth[_0xe09a('0x8')](),controller[_0xe09a('0x13')]);module[_0xe09a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index a3fe592..96ae765 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 _0x744d=['sequelize','exports','STRING','username'];(function(_0x3f60cb,_0x21316d){var _0x25d951=function(_0x1c0d16){while(--_0x1c0d16){_0x3f60cb['push'](_0x3f60cb['shift']());}};_0x25d951(++_0x21316d);}(_0x744d,0xf8));var _0xd744=function(_0x1b1a3b,_0x52a88a){_0x1b1a3b=_0x1b1a3b-0x0;var _0x385347=_0x744d[_0x1b1a3b];return _0x385347;};'use strict';var Sequelize=require(_0xd744('0x0'));module[_0xd744('0x1')]={'name':{'type':Sequelize[_0xd744('0x2')]},'description':{'type':Sequelize[_0xd744('0x2')]},'username':{'type':Sequelize[_0xd744('0x2')],'unique':_0xd744('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd744('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xd744('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x889c=['sequelize','exports','STRING'];(function(_0x5050fc,_0x166a92){var _0x57fc2b=function(_0x4b617b){while(--_0x4b617b){_0x5050fc['push'](_0x5050fc['shift']());}};_0x57fc2b(++_0x166a92);}(_0x889c,0x150));var _0xc889=function(_0x4c666f,_0x39fbdb){_0x4c666f=_0x4c666f-0x0;var _0x565d46=_0x889c[_0x4c666f];return _0x565d46;};'use strict';var Sequelize=require(_0xc889('0x0'));module[_0xc889('0x1')]={'name':{'type':Sequelize[_0xc889('0x2')]},'description':{'type':Sequelize[_0xc889('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0xc889('0x2')]},'remoteUri':{'type':Sequelize[_0xc889('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xc889('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 3e47d4a..33eeaa5 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 _0xb75d=['body','getConfigurations','findOne','keys','SugarcrmConfiguration','options','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','assigned_user_id','date_start','duration_hours','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','JSON','values','module_fields','remove','includes','value','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','name','send','map','rawAttributes','fieldName','type','key','model','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','SugarcrmAccount','includeAll','include','findAll','rows','params','find','create'];(function(_0x5f3562,_0x212f41){var _0x1b39b4=function(_0x153e49){while(--_0x153e49){_0x5f3562['push'](_0x5f3562['shift']());}};_0x1b39b4(++_0x212f41);}(_0xb75d,0xac));var _0xdb75=function(_0x146837,_0x2aa6a2){_0x146837=_0x146837-0x0;var _0x3d7e60=_0xb75d[_0x146837];return _0x3d7e60;};'use strict';var emlformat=require(_0xdb75('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb75('0x1'));var jsonpatch=require(_0xdb75('0x2'));var rp=require('request-promise');var moment=require(_0xdb75('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdb75('0x4'));var util=require('util');var path=require(_0xdb75('0x5'));var sox=require(_0xdb75('0x6'));var csv=require(_0xdb75('0x7'));var ejs=require(_0xdb75('0x8'));var fs=require('fs');var fs_extra=require(_0xdb75('0x9'));var _=require('lodash');var squel=require(_0xdb75('0xa'));var crypto=require(_0xdb75('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xdb75('0xc'));var toCsv=require(_0xdb75('0x7'));var querystring=require(_0xdb75('0xd'));var Papa=require(_0xdb75('0xe'));var Redis=require('ioredis');var authService=require(_0xdb75('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xdb75('0x10'));var hardwareService=require(_0xdb75('0x11'));var logger=require(_0xdb75('0x12'))(_0xdb75('0x13'));var utils=require('../../config/utils');var config=require(_0xdb75('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb75('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xdb75('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28cf79,_0x3187fe,_0x45b77c,_0x25b4fd){return new BPromise(function(_0x1156ba,_0x56800){var _0x5b2e69=_0x25b4fd||client;return _0x5b2e69[_0xdb75('0x17')](_0x28cf79,_0x45b77c)[_0xdb75('0x18')](function(_0x57cd9f){logger[_0xdb75('0x19')](_0xdb75('0x1a'),_0x3187fe,'request\x20sent');logger[_0xdb75('0x1b')](_0xdb75('0x1c'),_0x3187fe,_0xdb75('0x1d'),JSON[_0xdb75('0x1e')](_0x57cd9f));if(_0x57cd9f[_0xdb75('0x1f')]){if(_0x57cd9f[_0xdb75('0x1f')][_0xdb75('0x20')]===0x1f4){logger[_0xdb75('0x1f')](_0xdb75('0x1a'),_0x3187fe,_0x57cd9f['error'][_0xdb75('0x21')]);return _0x56800(_0x57cd9f[_0xdb75('0x1f')]['message']);}logger[_0xdb75('0x1f')](_0xdb75('0x1a'),_0x3187fe,_0x57cd9f[_0xdb75('0x1f')][_0xdb75('0x21')]);return _0x1156ba(_0x57cd9f[_0xdb75('0x1f')][_0xdb75('0x21')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x3187fe,'request\x20sent');_0x1156ba(_0x57cd9f['result'][_0xdb75('0x21')]);}})[_0xdb75('0x22')](function(_0x148705){logger[_0xdb75('0x1f')](_0xdb75('0x1a'),_0x3187fe,_0x148705);_0x56800(_0x148705);});});}function respondWithStatusCode(_0x1f9e89,_0x407325){_0x407325=_0x407325||0xcc;return function(_0x53daff){if(_0x53daff){return _0x1f9e89[_0xdb75('0x23')](_0x407325);}return _0x1f9e89[_0xdb75('0x24')](_0x407325)['end']();};}function respondWithResult(_0x56d09f,_0x3d9822){_0x3d9822=_0x3d9822||0xc8;return function(_0x106197){if(_0x106197){return _0x56d09f[_0xdb75('0x24')](_0x3d9822)[_0xdb75('0x25')](_0x106197);}};}function respondWithFilteredResult(_0x2aa4cf,_0x428f0d){return function(_0x481ca5){if(_0x481ca5){var _0xad828b=typeof _0x428f0d['offset']===_0xdb75('0x26')&&typeof _0x428f0d['limit']==='undefined';var _0x3696e5=_0x481ca5[_0xdb75('0x27')];var _0x4efeba=_0xad828b?0x0:_0x428f0d[_0xdb75('0x28')];var _0x435d52=_0xad828b?_0x481ca5[_0xdb75('0x27')]:_0x428f0d['offset']+_0x428f0d[_0xdb75('0x29')];var _0x3efddb;if(_0x435d52>=_0x3696e5){_0x435d52=_0x3696e5;_0x3efddb=0xc8;}else{_0x3efddb=0xce;}_0x2aa4cf[_0xdb75('0x24')](_0x3efddb);return _0x2aa4cf[_0xdb75('0x2a')](_0xdb75('0x2b'),_0x4efeba+'-'+_0x435d52+'/'+_0x3696e5)[_0xdb75('0x25')](_0x481ca5);}return null;};}function patchUpdates(_0x552edd){return function(_0x26bcff){try{jsonpatch[_0xdb75('0x2c')](_0x26bcff,_0x552edd,!![]);}catch(_0x4f1623){return BPromise[_0xdb75('0x2d')](_0x4f1623);}return _0x26bcff[_0xdb75('0x2e')]();};}function saveUpdates(_0x223ab7,_0x38201b){return function(_0x582471){if(_0x582471){return _0x582471[_0xdb75('0x2f')](_0x223ab7)[_0xdb75('0x18')](function(_0x4be380){return _0x4be380;});}return null;};}function removeEntity(_0x2de196,_0x1a3e5f){return function(_0x228a7a){if(_0x228a7a){return _0x228a7a[_0xdb75('0x30')]()[_0xdb75('0x18')](function(){_0x2de196[_0xdb75('0x24')](0xcc)[_0xdb75('0x31')]();});}};}function handleEntityNotFound(_0x1bf4d5,_0x4756d7){return function(_0x27ca02){if(!_0x27ca02){_0x1bf4d5['sendStatus'](0x194);}return _0x27ca02;};}function handleError(_0x58f9a6,_0x3e336c){_0x3e336c=_0x3e336c||0x1f4;return function(_0x1ec8df){logger[_0xdb75('0x1f')](_0x1ec8df['stack']);if(_0x1ec8df[_0xdb75('0x32')]){delete _0x1ec8df[_0xdb75('0x32')];}_0x58f9a6[_0xdb75('0x24')](_0x3e336c)[_0xdb75('0x33')](_0x1ec8df);};}exports['index']=function(_0x1d5865,_0x24bc84){var _0x78dc4b={},_0x508df3={},_0x1cbbec={'count':0x0,'rows':[]};var _0x3892f4=_[_0xdb75('0x34')](db['SugarcrmAccount'][_0xdb75('0x35')],function(_0x34608b){return{'name':_0x34608b[_0xdb75('0x36')],'type':_0x34608b[_0xdb75('0x37')][_0xdb75('0x38')]};});_0x508df3[_0xdb75('0x39')]=_['map'](_0x3892f4,'name');_0x508df3['query']=_['keys'](_0x1d5865['query']);_0x508df3[_0xdb75('0x3a')]=_['intersection'](_0x508df3[_0xdb75('0x39')],_0x508df3[_0xdb75('0x3b')]);_0x78dc4b[_0xdb75('0x3c')]=_[_0xdb75('0x3d')](_0x508df3[_0xdb75('0x39')],qs['fields'](_0x1d5865['query'][_0xdb75('0x3e')]));_0x78dc4b[_0xdb75('0x3c')]=_0x78dc4b[_0xdb75('0x3c')][_0xdb75('0x3f')]?_0x78dc4b['attributes']:_0x508df3[_0xdb75('0x39')];if(!_0x1d5865[_0xdb75('0x3b')][_0xdb75('0x40')](_0xdb75('0x41'))){_0x78dc4b[_0xdb75('0x29')]=qs[_0xdb75('0x29')](_0x1d5865[_0xdb75('0x3b')][_0xdb75('0x29')]);_0x78dc4b['offset']=qs['offset'](_0x1d5865[_0xdb75('0x3b')][_0xdb75('0x28')]);}_0x78dc4b['order']=qs[_0xdb75('0x42')](_0x1d5865[_0xdb75('0x3b')]['sort']);_0x78dc4b[_0xdb75('0x43')]=qs[_0xdb75('0x3a')](_[_0xdb75('0x44')](_0x1d5865['query'],_0x508df3['filters']),_0x3892f4);if(_0x1d5865[_0xdb75('0x3b')][_0xdb75('0x45')]){_0x78dc4b[_0xdb75('0x43')]=_['merge'](_0x78dc4b[_0xdb75('0x43')],{'$or':_['map'](_0x3892f4,function(_0x2c36d3){if(_0x2c36d3['type']!==_0xdb75('0x46')){var _0x2fc208={};_0x2fc208[_0x2c36d3[_0xdb75('0x32')]]={'$like':'%'+_0x1d5865[_0xdb75('0x3b')][_0xdb75('0x45')]+'%'};return _0x2fc208;}})});}_0x78dc4b=_[_0xdb75('0x47')]({},_0x78dc4b,_0x1d5865['options']);var _0x5f0e48={'where':_0x78dc4b['where']};return db[_0xdb75('0x48')][_0xdb75('0x27')](_0x5f0e48)[_0xdb75('0x18')](function(_0x20e4f3){_0x1cbbec[_0xdb75('0x27')]=_0x20e4f3;if(_0x1d5865[_0xdb75('0x3b')][_0xdb75('0x49')]){_0x78dc4b[_0xdb75('0x4a')]=[{'all':!![]}];}return db[_0xdb75('0x48')][_0xdb75('0x4b')](_0x78dc4b);})[_0xdb75('0x18')](function(_0x429a08){_0x1cbbec[_0xdb75('0x4c')]=_0x429a08;return _0x1cbbec;})[_0xdb75('0x18')](respondWithFilteredResult(_0x24bc84,_0x78dc4b))[_0xdb75('0x22')](handleError(_0x24bc84,null));};exports['show']=function(_0x1af074,_0x2235f8){var _0x562952={'raw':![],'where':{'id':_0x1af074[_0xdb75('0x4d')]['id']}},_0x297be5={};_0x297be5[_0xdb75('0x39')]=_['keys'](db[_0xdb75('0x48')][_0xdb75('0x35')]);_0x297be5[_0xdb75('0x3b')]=_['keys'](_0x1af074[_0xdb75('0x3b')]);_0x297be5[_0xdb75('0x3a')]=_[_0xdb75('0x3d')](_0x297be5['model'],_0x297be5[_0xdb75('0x3b')]);_0x562952[_0xdb75('0x3c')]=_[_0xdb75('0x3d')](_0x297be5[_0xdb75('0x39')],qs[_0xdb75('0x3e')](_0x1af074[_0xdb75('0x3b')][_0xdb75('0x3e')]));_0x562952['attributes']=_0x562952[_0xdb75('0x3c')][_0xdb75('0x3f')]?_0x562952['attributes']:_0x297be5['model'];if(_0x1af074[_0xdb75('0x3b')][_0xdb75('0x49')]){_0x562952[_0xdb75('0x4a')]=[{'all':!![]}];}_0x562952=_[_0xdb75('0x47')]({},_0x562952,_0x1af074['options']);return db[_0xdb75('0x48')][_0xdb75('0x4e')](_0x562952)[_0xdb75('0x18')](handleEntityNotFound(_0x2235f8,null))[_0xdb75('0x18')](respondWithResult(_0x2235f8,null))[_0xdb75('0x22')](handleError(_0x2235f8,null));};exports[_0xdb75('0x4f')]=function(_0xf80f66,_0x543be7){return db['SugarcrmAccount'][_0xdb75('0x4f')](_0xf80f66[_0xdb75('0x50')],{})[_0xdb75('0x18')](respondWithResult(_0x543be7,0xc9))['catch'](handleError(_0x543be7,null));};exports[_0xdb75('0x2f')]=function(_0x598feb,_0x227a79){if(_0x598feb[_0xdb75('0x50')]['id']){delete _0x598feb[_0xdb75('0x50')]['id'];}return db[_0xdb75('0x48')][_0xdb75('0x4e')]({'where':{'id':_0x598feb[_0xdb75('0x4d')]['id']}})[_0xdb75('0x18')](handleEntityNotFound(_0x227a79,null))[_0xdb75('0x18')](saveUpdates(_0x598feb['body'],null))['then'](respondWithResult(_0x227a79,null))[_0xdb75('0x22')](handleError(_0x227a79,null));};exports[_0xdb75('0x30')]=function(_0x183421,_0x155395){return db[_0xdb75('0x48')][_0xdb75('0x4e')]({'where':{'id':_0x183421[_0xdb75('0x4d')]['id']}})[_0xdb75('0x18')](handleEntityNotFound(_0x155395,null))['then'](removeEntity(_0x155395,null))[_0xdb75('0x22')](handleError(_0x155395,null));};exports[_0xdb75('0x51')]=function(_0x35373c,_0x427eb0,_0x5ddc8f){var _0x3ee686={};var _0x22ffa8={};var _0x467938;var _0x470d5e;return db[_0xdb75('0x48')][_0xdb75('0x52')]({'where':{'id':_0x35373c[_0xdb75('0x4d')]['id']}})[_0xdb75('0x18')](handleEntityNotFound(_0x427eb0,null))['then'](function(_0x38e174){if(_0x38e174){_0x467938=_0x38e174;_0x22ffa8[_0xdb75('0x39')]=_[_0xdb75('0x53')](db[_0xdb75('0x54')][_0xdb75('0x35')]);_0x22ffa8[_0xdb75('0x3b')]=_[_0xdb75('0x53')](_0x35373c['query']);_0x22ffa8[_0xdb75('0x3a')]=_[_0xdb75('0x3d')](_0x22ffa8[_0xdb75('0x39')],_0x22ffa8[_0xdb75('0x3b')]);_0x3ee686[_0xdb75('0x3c')]=_[_0xdb75('0x3d')](_0x22ffa8['model'],qs[_0xdb75('0x3e')](_0x35373c[_0xdb75('0x3b')][_0xdb75('0x3e')]));_0x3ee686[_0xdb75('0x3c')]=_0x3ee686[_0xdb75('0x3c')][_0xdb75('0x3f')]?_0x3ee686[_0xdb75('0x3c')]:_0x22ffa8[_0xdb75('0x39')];_0x3ee686['order']=qs['sort'](_0x35373c[_0xdb75('0x3b')][_0xdb75('0x42')]);_0x3ee686[_0xdb75('0x43')]=qs[_0xdb75('0x3a')](_[_0xdb75('0x44')](_0x35373c[_0xdb75('0x3b')],_0x22ffa8[_0xdb75('0x3a')]));if(_0x35373c[_0xdb75('0x3b')]['filter']){_0x3ee686[_0xdb75('0x43')]=_['merge'](_0x3ee686[_0xdb75('0x43')],{'$or':_['map'](_0x3ee686['attributes'],function(_0x25f17f){var _0x3bb027={};_0x3bb027[_0x25f17f]={'$like':'%'+_0x35373c[_0xdb75('0x3b')][_0xdb75('0x45')]+'%'};return _0x3bb027;})});}_0x3ee686=_[_0xdb75('0x47')]({},_0x3ee686,_0x35373c[_0xdb75('0x55')]);return _0x467938[_0xdb75('0x51')](_0x3ee686);}})['then'](function(_0x16c4e6){if(_0x16c4e6){_0x470d5e=_0x16c4e6['length'];if(!_0x35373c[_0xdb75('0x3b')]['hasOwnProperty'](_0xdb75('0x41'))){_0x3ee686[_0xdb75('0x29')]=qs['limit'](_0x35373c[_0xdb75('0x3b')][_0xdb75('0x29')]);_0x3ee686[_0xdb75('0x28')]=qs[_0xdb75('0x28')](_0x35373c[_0xdb75('0x3b')][_0xdb75('0x28')]);}return _0x467938[_0xdb75('0x51')](_0x3ee686);}})[_0xdb75('0x18')](function(_0x58af23){if(_0x58af23){return _0x58af23?{'count':_0x470d5e,'rows':_0x58af23}:null;}})[_0xdb75('0x18')](respondWithResult(_0x427eb0,null))[_0xdb75('0x22')](handleError(_0x427eb0,null));};exports[_0xdb75('0x56')]=function(_0x4faaef,_0x3d3c8e,_0x4fe0fa){if(_0x4faaef[_0xdb75('0x50')]['id']){delete _0x4faaef[_0xdb75('0x50')]['id'];}return db[_0xdb75('0x48')][_0xdb75('0x52')]({'where':{'id':_0x4faaef[_0xdb75('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3d3c8e,null))[_0xdb75('0x18')](function(_0x222b04){if(_0x222b04){_0x4faaef[_0xdb75('0x50')][_0xdb75('0x57')]=_0x222b04['id'];_0x4faaef[_0xdb75('0x50')]['Subjects']=integrations[_0xdb75('0x58')](_0x4faaef[_0xdb75('0x50')][_0xdb75('0x59')],_0x4faaef[_0xdb75('0x50')][_0xdb75('0x37')]);_0x4faaef[_0xdb75('0x50')][_0xdb75('0x5a')]=integrations[_0xdb75('0x5b')](_0x4faaef[_0xdb75('0x50')][_0xdb75('0x59')],_0x4faaef[_0xdb75('0x50')][_0xdb75('0x37')]);return db['SugarcrmConfiguration'][_0xdb75('0x4f')](_0x4faaef[_0xdb75('0x50')],{'include':[{'model':db[_0xdb75('0x5c')],'as':_0xdb75('0x5d')},{'model':db[_0xdb75('0x5c')],'as':_0xdb75('0x5a')}]});}return null;})[_0xdb75('0x18')](respondWithResult(_0x3d3c8e,null))[_0xdb75('0x22')](handleError(_0x3d3c8e,null));};exports[_0xdb75('0x5e')]=function(_0x231da1,_0x2eb833,_0x18d897){var _0x4b2beb='';var _0x30ac31=['id','name',_0xdb75('0x5f'),'created_by','description',_0xdb75('0x60'),_0xdb75('0x61'),'duration_minutes',_0xdb75('0x62'),_0xdb75('0x63'),_0xdb75('0x64'),_0xdb75('0x65')];return db[_0xdb75('0x48')][_0xdb75('0x52')]({'where':{'id':_0x231da1[_0xdb75('0x4d')]['id']},'attributes':['id',_0xdb75('0x66'),_0xdb75('0x67'),_0xdb75('0x68')]})[_0xdb75('0x18')](handleEntityNotFound(_0x2eb833,null))[_0xdb75('0x18')](function(_0x401442){if(_0x401442){_0x4b2beb=_0x401442['remoteUri'];var _0x4270bf=_0x4b2beb[_0xdb75('0x69')](-0x1);if(_0x4270bf==='/'){_0x4b2beb=_0x4b2beb[_0xdb75('0x6a')](0x0,_0x4b2beb[_0xdb75('0x6b')](_0x4270bf));}return rp({'method':_0xdb75('0x6c'),'uri':util[_0xdb75('0x6d')](_0xdb75('0x6e'),_0x4b2beb,_0xdb75('0x6f')),'json':!![],'form':{'method':_0xdb75('0x70'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xdb75('0x1e')]({'user_auth':{'user_name':_0x401442[_0xdb75('0x66')],'password':_0x401442[_0xdb75('0x67')],'encryption':_0xdb75('0x71')},'application':_0xdb75('0x72')})}});}})[_0xdb75('0x18')](function(_0xa61df1){if(_0xa61df1&&_0xa61df1['name']!==_0xdb75('0x73')&&_0xa61df1[_0xdb75('0x32')]!==_0xdb75('0x74')){return rp({'method':_0xdb75('0x6c'),'uri':util[_0xdb75('0x6d')](_0xdb75('0x6e'),_0x4b2beb,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xdb75('0x75'),'input_type':_0xdb75('0x76'),'response_type':_0xdb75('0x76'),'rest_data':JSON[_0xdb75('0x1e')]({'session':_0xa61df1['id'],'module_name':'Calls'})}})[_0xdb75('0x18')](function(_0x29ec59){if(_0x29ec59){var _0x447441=_[_0xdb75('0x77')](_0x29ec59[_0xdb75('0x78')]);_[_0xdb75('0x79')](_0x447441,function(_0xaec7b6){return _0x30ac31[_0xdb75('0x7a')](_0xaec7b6[_0xdb75('0x32')]);});return{'count':_0x447441['length'],'rows':_[_0xdb75('0x34')](_0x447441,function(_0x42a535){return{'id':_0x42a535[_0xdb75('0x32')],'name':_0x42a535['label'],'custom':_['endsWith'](_0x42a535[_0xdb75('0x32')],'_c')?!![]:![],'options':_0x42a535[_0xdb75('0x55')]?_['map'](_[_0xdb75('0x77')](_0x42a535['options']),function(_0x1e0124){return{'name':_0x1e0124[_0xdb75('0x7b')],'value':_0x1e0124[_0xdb75('0x32')]};}):[]};})};}})[_0xdb75('0x18')](respondWithResult(_0x2eb833,null))[_0xdb75('0x22')](function(_0x307a02){var _0x1171d5=_0x231da1[_0xdb75('0x3b')][_0xdb75('0x7c')]?0x1f4:_0x307a02['statusCode']||0x1f4;logger[_0xdb75('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0xdb75('0x5e'),_0x1171d5,JSON['stringify'](_0x307a02));delete _0x307a02[_0xdb75('0x32')];if(_0x1171d5===0x191){_0x1171d5=0x190;}_0x2eb833[_0xdb75('0x24')](_0x1171d5)['send'](_0x231da1[_0xdb75('0x3b')][_0xdb75('0x7c')]?{'message':_0xdb75('0x7d'),'statusCode':_0x307a02['statusCode']}:_0x307a02);});}else{var _0x5164f7=0x1f4;_0x2eb833[_0xdb75('0x24')](_0x5164f7)['send']({'message':_0xdb75('0x7d'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xff96=['create','body','destroy','options','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','POST','format','login','JSON','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','/service/v4_1/rest.php','Calls','values','remove','includes','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','send','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','end','status','json','offset','undefined','count','set','Content-Range','reject','save','update','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','SugarcrmAccount','includeAll','findAll','rows','show','params','include','find'];(function(_0x3b447c,_0x2d3820){var _0x4caf28=function(_0x3f49ee){while(--_0x3f49ee){_0x3b447c['push'](_0x3b447c['shift']());}};_0x4caf28(++_0x2d3820);}(_0xff96,0x1bc));var _0x6ff9=function(_0x19c64a,_0x5de14e){_0x19c64a=_0x19c64a-0x0;var _0x1b1a06=_0xff96[_0x19c64a];return _0x1b1a06;};'use strict';var emlformat=require(_0x6ff9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6ff9('0x1'));var jsonpatch=require(_0x6ff9('0x2'));var rp=require('request-promise');var moment=require(_0x6ff9('0x3'));var BPromise=require(_0x6ff9('0x4'));var Mustache=require(_0x6ff9('0x5'));var util=require(_0x6ff9('0x6'));var path=require(_0x6ff9('0x7'));var sox=require('sox');var csv=require(_0x6ff9('0x8'));var ejs=require(_0x6ff9('0x9'));var fs=require('fs');var fs_extra=require(_0x6ff9('0xa'));var _=require(_0x6ff9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6ff9('0xc'));var deskjs=require(_0x6ff9('0xd'));var toCsv=require(_0x6ff9('0x8'));var querystring=require(_0x6ff9('0xe'));var Papa=require(_0x6ff9('0xf'));var Redis=require(_0x6ff9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6ff9('0x11'));var as=require(_0x6ff9('0x12'));var hardwareService=require(_0x6ff9('0x13'));var logger=require(_0x6ff9('0x14'))(_0x6ff9('0x15'));var utils=require('../../config/utils');var config=require(_0x6ff9('0x16'));var licenseUtil=require(_0x6ff9('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6ff9('0x18'));var jayson=require(_0x6ff9('0x19'));var client=jayson[_0x6ff9('0x1a')][_0x6ff9('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2dfc2a,_0x451cf4,_0x19ae5e,_0x3c8f4b){return new BPromise(function(_0x1eb440,_0x5ed082){var _0x2fb7b0=_0x3c8f4b||client;return _0x2fb7b0['request'](_0x2dfc2a,_0x19ae5e)[_0x6ff9('0x1c')](function(_0xea79dd){logger[_0x6ff9('0x1d')](_0x6ff9('0x1e'),_0x451cf4,'request\x20sent');logger[_0x6ff9('0x1f')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x451cf4,_0x6ff9('0x20'),JSON[_0x6ff9('0x21')](_0xea79dd));if(_0xea79dd[_0x6ff9('0x22')]){if(_0xea79dd['error'][_0x6ff9('0x23')]===0x1f4){logger['error'](_0x6ff9('0x1e'),_0x451cf4,_0xea79dd[_0x6ff9('0x22')][_0x6ff9('0x24')]);return _0x5ed082(_0xea79dd[_0x6ff9('0x22')]['message']);}logger['error'](_0x6ff9('0x1e'),_0x451cf4,_0xea79dd[_0x6ff9('0x22')][_0x6ff9('0x24')]);return _0x1eb440(_0xea79dd[_0x6ff9('0x22')][_0x6ff9('0x24')]);}else{logger['info'](_0x6ff9('0x1e'),_0x451cf4,_0x6ff9('0x20'));_0x1eb440(_0xea79dd[_0x6ff9('0x25')][_0x6ff9('0x24')]);}})[_0x6ff9('0x26')](function(_0x3f038a){logger[_0x6ff9('0x22')](_0x6ff9('0x1e'),_0x451cf4,_0x3f038a);_0x5ed082(_0x3f038a);});});}function respondWithStatusCode(_0x1ed5cf,_0xbc3480){_0xbc3480=_0xbc3480||0xcc;return function(_0x507e9b){if(_0x507e9b){return _0x1ed5cf['sendStatus'](_0xbc3480);}return _0x1ed5cf['status'](_0xbc3480)[_0x6ff9('0x27')]();};}function respondWithResult(_0x1fa3c7,_0x358e7e){_0x358e7e=_0x358e7e||0xc8;return function(_0x1dc95c){if(_0x1dc95c){return _0x1fa3c7[_0x6ff9('0x28')](_0x358e7e)[_0x6ff9('0x29')](_0x1dc95c);}};}function respondWithFilteredResult(_0x5c269c,_0x2a3b04){return function(_0x20802b){if(_0x20802b){var _0x4fe9d6=typeof _0x2a3b04[_0x6ff9('0x2a')]==='undefined'&&typeof _0x2a3b04['limit']===_0x6ff9('0x2b');var _0x16d93a=_0x20802b['count'];var _0x42e2d4=_0x4fe9d6?0x0:_0x2a3b04[_0x6ff9('0x2a')];var _0x30da46=_0x4fe9d6?_0x20802b[_0x6ff9('0x2c')]:_0x2a3b04[_0x6ff9('0x2a')]+_0x2a3b04['limit'];var _0x698714;if(_0x30da46>=_0x16d93a){_0x30da46=_0x16d93a;_0x698714=0xc8;}else{_0x698714=0xce;}_0x5c269c[_0x6ff9('0x28')](_0x698714);return _0x5c269c[_0x6ff9('0x2d')](_0x6ff9('0x2e'),_0x42e2d4+'-'+_0x30da46+'/'+_0x16d93a)[_0x6ff9('0x29')](_0x20802b);}return null;};}function patchUpdates(_0x97ffe4){return function(_0xff9b3b){try{jsonpatch['apply'](_0xff9b3b,_0x97ffe4,!![]);}catch(_0x5bc447){return BPromise[_0x6ff9('0x2f')](_0x5bc447);}return _0xff9b3b[_0x6ff9('0x30')]();};}function saveUpdates(_0x3984bb,_0x1ccebe){return function(_0x41581e){if(_0x41581e){return _0x41581e[_0x6ff9('0x31')](_0x3984bb)['then'](function(_0x22a65d){return _0x22a65d;});}return null;};}function removeEntity(_0x296ad1,_0x4ab4c9){return function(_0x5edffb){if(_0x5edffb){return _0x5edffb['destroy']()[_0x6ff9('0x1c')](function(){_0x296ad1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x127abb,_0x254a78){return function(_0x4410e8){if(!_0x4410e8){_0x127abb[_0x6ff9('0x32')](0x194);}return _0x4410e8;};}function handleError(_0x82f923,_0x26a9c0){_0x26a9c0=_0x26a9c0||0x1f4;return function(_0x1b7438){logger[_0x6ff9('0x22')](_0x1b7438[_0x6ff9('0x33')]);if(_0x1b7438[_0x6ff9('0x34')]){delete _0x1b7438[_0x6ff9('0x34')];}_0x82f923[_0x6ff9('0x28')](_0x26a9c0)['send'](_0x1b7438);};}exports[_0x6ff9('0x35')]=function(_0xb0bad1,_0x1b10c6){var _0x3e7f0e={},_0x51a22a={},_0x1dd68d={'count':0x0,'rows':[]};var _0xde9020=_[_0x6ff9('0x36')](db['SugarcrmAccount'][_0x6ff9('0x37')],function(_0x1d6512){return{'name':_0x1d6512[_0x6ff9('0x38')],'type':_0x1d6512[_0x6ff9('0x39')][_0x6ff9('0x3a')]};});_0x51a22a[_0x6ff9('0x3b')]=_[_0x6ff9('0x36')](_0xde9020,_0x6ff9('0x34'));_0x51a22a[_0x6ff9('0x3c')]=_[_0x6ff9('0x3d')](_0xb0bad1[_0x6ff9('0x3c')]);_0x51a22a[_0x6ff9('0x3e')]=_[_0x6ff9('0x3f')](_0x51a22a[_0x6ff9('0x3b')],_0x51a22a[_0x6ff9('0x3c')]);_0x3e7f0e[_0x6ff9('0x40')]=_['intersection'](_0x51a22a['model'],qs[_0x6ff9('0x41')](_0xb0bad1[_0x6ff9('0x3c')][_0x6ff9('0x41')]));_0x3e7f0e[_0x6ff9('0x40')]=_0x3e7f0e[_0x6ff9('0x40')][_0x6ff9('0x42')]?_0x3e7f0e[_0x6ff9('0x40')]:_0x51a22a[_0x6ff9('0x3b')];if(!_0xb0bad1[_0x6ff9('0x3c')]['hasOwnProperty'](_0x6ff9('0x43'))){_0x3e7f0e[_0x6ff9('0x44')]=qs['limit'](_0xb0bad1['query']['limit']);_0x3e7f0e[_0x6ff9('0x2a')]=qs[_0x6ff9('0x2a')](_0xb0bad1[_0x6ff9('0x3c')][_0x6ff9('0x2a')]);}_0x3e7f0e[_0x6ff9('0x45')]=qs[_0x6ff9('0x46')](_0xb0bad1[_0x6ff9('0x3c')]['sort']);_0x3e7f0e[_0x6ff9('0x47')]=qs[_0x6ff9('0x3e')](_[_0x6ff9('0x48')](_0xb0bad1[_0x6ff9('0x3c')],_0x51a22a[_0x6ff9('0x3e')]),_0xde9020);if(_0xb0bad1['query'][_0x6ff9('0x49')]){_0x3e7f0e[_0x6ff9('0x47')]=_[_0x6ff9('0x4a')](_0x3e7f0e['where'],{'$or':_[_0x6ff9('0x36')](_0xde9020,function(_0x4d37c3){if(_0x4d37c3[_0x6ff9('0x39')]!==_0x6ff9('0x4b')){var _0x42b69f={};_0x42b69f[_0x4d37c3['name']]={'$like':'%'+_0xb0bad1['query'][_0x6ff9('0x49')]+'%'};return _0x42b69f;}})});}_0x3e7f0e=_['merge']({},_0x3e7f0e,_0xb0bad1['options']);var _0x4e09b3={'where':_0x3e7f0e[_0x6ff9('0x47')]};return db[_0x6ff9('0x4c')][_0x6ff9('0x2c')](_0x4e09b3)[_0x6ff9('0x1c')](function(_0x3fad37){_0x1dd68d[_0x6ff9('0x2c')]=_0x3fad37;if(_0xb0bad1[_0x6ff9('0x3c')][_0x6ff9('0x4d')]){_0x3e7f0e['include']=[{'all':!![]}];}return db['SugarcrmAccount'][_0x6ff9('0x4e')](_0x3e7f0e);})[_0x6ff9('0x1c')](function(_0x425a0f){_0x1dd68d[_0x6ff9('0x4f')]=_0x425a0f;return _0x1dd68d;})[_0x6ff9('0x1c')](respondWithFilteredResult(_0x1b10c6,_0x3e7f0e))['catch'](handleError(_0x1b10c6,null));};exports[_0x6ff9('0x50')]=function(_0x355a1a,_0x3a136d){var _0x4e6371={'raw':![],'where':{'id':_0x355a1a[_0x6ff9('0x51')]['id']}},_0x162631={};_0x162631[_0x6ff9('0x3b')]=_['keys'](db[_0x6ff9('0x4c')][_0x6ff9('0x37')]);_0x162631[_0x6ff9('0x3c')]=_['keys'](_0x355a1a[_0x6ff9('0x3c')]);_0x162631[_0x6ff9('0x3e')]=_[_0x6ff9('0x3f')](_0x162631[_0x6ff9('0x3b')],_0x162631[_0x6ff9('0x3c')]);_0x4e6371[_0x6ff9('0x40')]=_[_0x6ff9('0x3f')](_0x162631[_0x6ff9('0x3b')],qs[_0x6ff9('0x41')](_0x355a1a[_0x6ff9('0x3c')][_0x6ff9('0x41')]));_0x4e6371[_0x6ff9('0x40')]=_0x4e6371[_0x6ff9('0x40')][_0x6ff9('0x42')]?_0x4e6371['attributes']:_0x162631[_0x6ff9('0x3b')];if(_0x355a1a[_0x6ff9('0x3c')][_0x6ff9('0x4d')]){_0x4e6371[_0x6ff9('0x52')]=[{'all':!![]}];}_0x4e6371=_['merge']({},_0x4e6371,_0x355a1a['options']);return db[_0x6ff9('0x4c')][_0x6ff9('0x53')](_0x4e6371)['then'](handleEntityNotFound(_0x3a136d,null))[_0x6ff9('0x1c')](respondWithResult(_0x3a136d,null))[_0x6ff9('0x26')](handleError(_0x3a136d,null));};exports[_0x6ff9('0x54')]=function(_0x34bab1,_0x4adb1f){return db[_0x6ff9('0x4c')][_0x6ff9('0x54')](_0x34bab1[_0x6ff9('0x55')],{})['then'](respondWithResult(_0x4adb1f,0xc9))[_0x6ff9('0x26')](handleError(_0x4adb1f,null));};exports[_0x6ff9('0x31')]=function(_0x45f965,_0x3e1942){if(_0x45f965[_0x6ff9('0x55')]['id']){delete _0x45f965['body']['id'];}return db['SugarcrmAccount'][_0x6ff9('0x53')]({'where':{'id':_0x45f965[_0x6ff9('0x51')]['id']}})['then'](handleEntityNotFound(_0x3e1942,null))[_0x6ff9('0x1c')](saveUpdates(_0x45f965[_0x6ff9('0x55')],null))[_0x6ff9('0x1c')](respondWithResult(_0x3e1942,null))[_0x6ff9('0x26')](handleError(_0x3e1942,null));};exports[_0x6ff9('0x56')]=function(_0x1d9e85,_0x2c31e0){return db[_0x6ff9('0x4c')][_0x6ff9('0x53')]({'where':{'id':_0x1d9e85[_0x6ff9('0x51')]['id']}})['then'](handleEntityNotFound(_0x2c31e0,null))[_0x6ff9('0x1c')](removeEntity(_0x2c31e0,null))[_0x6ff9('0x26')](handleError(_0x2c31e0,null));};exports['getConfigurations']=function(_0x2a7449,_0x54a1b8,_0x51efdb){var _0x466517={};var _0x42b82f={};var _0x2b0fee;var _0x14bb4e;return db[_0x6ff9('0x4c')]['findOne']({'where':{'id':_0x2a7449['params']['id']}})[_0x6ff9('0x1c')](handleEntityNotFound(_0x54a1b8,null))[_0x6ff9('0x1c')](function(_0x2ff821){if(_0x2ff821){_0x2b0fee=_0x2ff821;_0x42b82f[_0x6ff9('0x3b')]=_['keys'](db['SugarcrmConfiguration'][_0x6ff9('0x37')]);_0x42b82f[_0x6ff9('0x3c')]=_[_0x6ff9('0x3d')](_0x2a7449[_0x6ff9('0x3c')]);_0x42b82f[_0x6ff9('0x3e')]=_[_0x6ff9('0x3f')](_0x42b82f[_0x6ff9('0x3b')],_0x42b82f['query']);_0x466517[_0x6ff9('0x40')]=_['intersection'](_0x42b82f[_0x6ff9('0x3b')],qs['fields'](_0x2a7449['query'][_0x6ff9('0x41')]));_0x466517[_0x6ff9('0x40')]=_0x466517['attributes'][_0x6ff9('0x42')]?_0x466517[_0x6ff9('0x40')]:_0x42b82f[_0x6ff9('0x3b')];_0x466517[_0x6ff9('0x45')]=qs[_0x6ff9('0x46')](_0x2a7449[_0x6ff9('0x3c')]['sort']);_0x466517[_0x6ff9('0x47')]=qs[_0x6ff9('0x3e')](_['pick'](_0x2a7449['query'],_0x42b82f['filters']));if(_0x2a7449['query'][_0x6ff9('0x49')]){_0x466517[_0x6ff9('0x47')]=_['merge'](_0x466517[_0x6ff9('0x47')],{'$or':_[_0x6ff9('0x36')](_0x466517['attributes'],function(_0x41b59a){var _0x1e8cd8={};_0x1e8cd8[_0x41b59a]={'$like':'%'+_0x2a7449[_0x6ff9('0x3c')]['filter']+'%'};return _0x1e8cd8;})});}_0x466517=_[_0x6ff9('0x4a')]({},_0x466517,_0x2a7449[_0x6ff9('0x57')]);return _0x2b0fee[_0x6ff9('0x58')](_0x466517);}})['then'](function(_0x33e69e){if(_0x33e69e){_0x14bb4e=_0x33e69e['length'];if(!_0x2a7449[_0x6ff9('0x3c')]['hasOwnProperty'](_0x6ff9('0x43'))){_0x466517[_0x6ff9('0x44')]=qs[_0x6ff9('0x44')](_0x2a7449[_0x6ff9('0x3c')][_0x6ff9('0x44')]);_0x466517['offset']=qs[_0x6ff9('0x2a')](_0x2a7449['query'][_0x6ff9('0x2a')]);}return _0x2b0fee[_0x6ff9('0x58')](_0x466517);}})['then'](function(_0x1b935a){if(_0x1b935a){return _0x1b935a?{'count':_0x14bb4e,'rows':_0x1b935a}:null;}})[_0x6ff9('0x1c')](respondWithResult(_0x54a1b8,null))[_0x6ff9('0x26')](handleError(_0x54a1b8,null));};exports[_0x6ff9('0x59')]=function(_0x25119f,_0x5acb74,_0x167e45){if(_0x25119f[_0x6ff9('0x55')]['id']){delete _0x25119f['body']['id'];}return db[_0x6ff9('0x4c')][_0x6ff9('0x5a')]({'where':{'id':_0x25119f[_0x6ff9('0x51')]['id']}})[_0x6ff9('0x1c')](handleEntityNotFound(_0x5acb74,null))['then'](function(_0x5f860b){if(_0x5f860b){_0x25119f[_0x6ff9('0x55')]['AccountId']=_0x5f860b['id'];_0x25119f[_0x6ff9('0x55')][_0x6ff9('0x5b')]=integrations[_0x6ff9('0x5c')](_0x25119f[_0x6ff9('0x55')][_0x6ff9('0x5d')],_0x25119f[_0x6ff9('0x55')][_0x6ff9('0x39')]);_0x25119f['body']['Descriptions']=integrations[_0x6ff9('0x5e')](_0x25119f[_0x6ff9('0x55')][_0x6ff9('0x5d')],_0x25119f[_0x6ff9('0x55')][_0x6ff9('0x39')]);return db['SugarcrmConfiguration'][_0x6ff9('0x54')](_0x25119f[_0x6ff9('0x55')],{'include':[{'model':db[_0x6ff9('0x5f')],'as':_0x6ff9('0x5b')},{'model':db[_0x6ff9('0x5f')],'as':_0x6ff9('0x60')}]});}return null;})[_0x6ff9('0x1c')](respondWithResult(_0x5acb74,null))[_0x6ff9('0x26')](handleError(_0x5acb74,null));};exports[_0x6ff9('0x61')]=function(_0x4607a4,_0x4691c8,_0x22c291){var _0x5c275f='';var _0x44f3b2=['id',_0x6ff9('0x34'),_0x6ff9('0x62'),_0x6ff9('0x63'),'description',_0x6ff9('0x64'),_0x6ff9('0x65'),_0x6ff9('0x66'),_0x6ff9('0x67'),_0x6ff9('0x68'),_0x6ff9('0x69'),_0x6ff9('0x6a')];return db[_0x6ff9('0x4c')][_0x6ff9('0x5a')]({'where':{'id':_0x4607a4[_0x6ff9('0x51')]['id']},'attributes':['id',_0x6ff9('0x6b'),_0x6ff9('0x6c'),_0x6ff9('0x6d')]})['then'](handleEntityNotFound(_0x4691c8,null))[_0x6ff9('0x1c')](function(_0x2472e9){if(_0x2472e9){_0x5c275f=_0x2472e9[_0x6ff9('0x6d')];var _0x5da8c4=_0x5c275f[_0x6ff9('0x6e')](-0x1);if(_0x5da8c4==='/'){_0x5c275f=_0x5c275f['substring'](0x0,_0x5c275f[_0x6ff9('0x6f')](_0x5da8c4));}return rp({'method':_0x6ff9('0x70'),'uri':util[_0x6ff9('0x71')]('%s%s',_0x5c275f,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x6ff9('0x72'),'input_type':'JSON','response_type':_0x6ff9('0x73'),'rest_data':JSON[_0x6ff9('0x21')]({'user_auth':{'user_name':_0x2472e9[_0x6ff9('0x6b')],'password':_0x2472e9['password'],'encryption':'PLAIN'},'application':_0x6ff9('0x74')})}});}})[_0x6ff9('0x1c')](function(_0x297ed8){if(_0x297ed8&&_0x297ed8[_0x6ff9('0x34')]!==_0x6ff9('0x75')&&_0x297ed8[_0x6ff9('0x34')]!==_0x6ff9('0x76')){return rp({'method':_0x6ff9('0x70'),'uri':util[_0x6ff9('0x71')](_0x6ff9('0x77'),_0x5c275f,_0x6ff9('0x78')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x6ff9('0x73'),'response_type':_0x6ff9('0x73'),'rest_data':JSON[_0x6ff9('0x21')]({'session':_0x297ed8['id'],'module_name':_0x6ff9('0x79')})}})[_0x6ff9('0x1c')](function(_0x334286){if(_0x334286){var _0x557b2e=_[_0x6ff9('0x7a')](_0x334286['module_fields']);_[_0x6ff9('0x7b')](_0x557b2e,function(_0x2c3046){return _0x44f3b2[_0x6ff9('0x7c')](_0x2c3046[_0x6ff9('0x34')]);});return{'count':_0x557b2e[_0x6ff9('0x42')],'rows':_[_0x6ff9('0x36')](_0x557b2e,function(_0x223e5d){return{'id':_0x223e5d['name'],'name':_0x223e5d['label'],'custom':_[_0x6ff9('0x7d')](_0x223e5d[_0x6ff9('0x34')],'_c')?!![]:![],'options':_0x223e5d[_0x6ff9('0x57')]?_['map'](_[_0x6ff9('0x7a')](_0x223e5d['options']),function(_0x54d43d){return{'name':_0x54d43d[_0x6ff9('0x7e')],'value':_0x54d43d[_0x6ff9('0x34')]};}):[]};})};}})['then'](respondWithResult(_0x4691c8,null))[_0x6ff9('0x26')](function(_0x2507ba){var _0x2308a3=_0x4607a4[_0x6ff9('0x3c')][_0x6ff9('0x7f')]?0x1f4:_0x2507ba[_0x6ff9('0x80')]||0x1f4;logger[_0x6ff9('0x22')](_0x6ff9('0x81'),_0x6ff9('0x61'),_0x2308a3,JSON['stringify'](_0x2507ba));delete _0x2507ba[_0x6ff9('0x34')];if(_0x2308a3===0x191){_0x2308a3=0x190;}_0x4691c8[_0x6ff9('0x28')](_0x2308a3)['send'](_0x4607a4['query'][_0x6ff9('0x7f')]?{'message':_0x6ff9('0x82'),'statusCode':_0x2507ba[_0x6ff9('0x80')]}:_0x2507ba);});}else{var _0x2420db=0x1f4;_0x4691c8[_0x6ff9('0x28')](_0x2420db)[_0x6ff9('0x83')]({'message':'Wrong\x20credentials','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 7eb746e..4ba5899 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 _0x9141=['../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x11ded1,_0x960131){var _0x2b644a=function(_0x33f0c8){while(--_0x33f0c8){_0x11ded1['push'](_0x11ded1['shift']());}};_0x2b644a(++_0x960131);}(_0x9141,0xac));var _0x1914=function(_0x6d5cde,_0x25198e){_0x6d5cde=_0x6d5cde-0x0;var _0x27ee85=_0x9141[_0x6d5cde];return _0x27ee85;};'use strict';var _=require('lodash');var util=require(_0x1914('0x0'));var logger=require(_0x1914('0x1'))(_0x1914('0x2'));var moment=require(_0x1914('0x3'));var BPromise=require(_0x1914('0x4'));var rp=require(_0x1914('0x5'));var fs=require('fs');var path=require(_0x1914('0x6'));var rimraf=require(_0x1914('0x7'));var config=require(_0x1914('0x8'));var attributes=require(_0x1914('0x9'));var integrations=require(_0x1914('0xa'));module[_0x1914('0xb')]=function(_0x2e76b7,_0x3ed77f){return _0x2e76b7[_0x1914('0xc')](_0x1914('0xd'),attributes,{'tableName':_0x1914('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2125=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x5bb9ac,_0x417c09){var _0x38fd65=function(_0x17b739){while(--_0x17b739){_0x5bb9ac['push'](_0x5bb9ac['shift']());}};_0x38fd65(++_0x417c09);}(_0x2125,0xa2));var _0x5212=function(_0x52b784,_0x3148ce){_0x52b784=_0x52b784-0x0;var _0x43018b=_0x2125[_0x52b784];return _0x43018b;};'use strict';var _=require(_0x5212('0x0'));var util=require(_0x5212('0x1'));var logger=require('../../config/logger')(_0x5212('0x2'));var moment=require(_0x5212('0x3'));var BPromise=require(_0x5212('0x4'));var rp=require(_0x5212('0x5'));var fs=require('fs');var path=require(_0x5212('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5212('0x7'));var integrations=require(_0x5212('0x8'));module[_0x5212('0x9')]=function(_0x3df22b,_0x1e97fb){return _0x3df22b[_0x5212('0xa')](_0x5212('0xb'),attributes,{'tableName':_0x5212('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 89a8d2a..d4e5fcc 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 _0xa4c0=['rpc','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowSugarcrmAccount','find','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4ae2fb,_0x1c1c67){var _0x4f5268=function(_0x11236b){while(--_0x11236b){_0x4ae2fb['push'](_0x4ae2fb['shift']());}};_0x4f5268(++_0x1c1c67);}(_0xa4c0,0x192));var _0x0a4c=function(_0x2f2ea6,_0x55a23d){_0x2f2ea6=_0x2f2ea6-0x0;var _0xa4157=_0xa4c0[_0x2f2ea6];return _0xa4157;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0a4c('0x0'));var BPromise=require(_0x0a4c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a4c('0x2'));var db=require(_0x0a4c('0x3'))['db'];var utils=require(_0x0a4c('0x4'));var logger=require(_0x0a4c('0x5'))(_0x0a4c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0a4c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d6929,_0x29d09c,_0x5c1dce){return new BPromise(function(_0x113d66,_0x39e89a){return client[_0x0a4c('0x8')](_0x5d6929,_0x5c1dce)[_0x0a4c('0x9')](function(_0x539f30){logger[_0x0a4c('0xa')](_0x0a4c('0xb'),_0x29d09c,_0x0a4c('0xc'));logger[_0x0a4c('0xd')](_0x0a4c('0xe'),_0x29d09c,_0x0a4c('0xc'),JSON[_0x0a4c('0xf')](_0x539f30));if(_0x539f30[_0x0a4c('0x10')]){if(_0x539f30[_0x0a4c('0x10')][_0x0a4c('0x11')]===0x1f4){logger['error'](_0x0a4c('0xb'),_0x29d09c,_0x539f30[_0x0a4c('0x10')][_0x0a4c('0x12')]);return _0x39e89a(_0x539f30[_0x0a4c('0x10')][_0x0a4c('0x12')]);}logger[_0x0a4c('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x29d09c,_0x539f30['error']['message']);return _0x113d66(_0x539f30['error'][_0x0a4c('0x12')]);}else{logger[_0x0a4c('0xa')](_0x0a4c('0xb'),_0x29d09c,_0x0a4c('0xc'));_0x113d66(_0x539f30[_0x0a4c('0x13')]['message']);}})[_0x0a4c('0x14')](function(_0xa3fa77){logger[_0x0a4c('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x29d09c,_0xa3fa77);_0x39e89a(_0xa3fa77);});});}exports[_0x0a4c('0x15')]=function(_0x1c40a4){var _0x4e8012=this;return new Promise(function(_0x1525e6,_0x427db6){return db[_0x0a4c('0x16')][_0x0a4c('0x17')]({'raw':_0x1c40a4[_0x0a4c('0x18')]?_0x1c40a4['options'][_0x0a4c('0x19')]===undefined?!![]:![]:!![],'where':_0x1c40a4[_0x0a4c('0x18')]?_0x1c40a4['options'][_0x0a4c('0x1a')]||null:null,'attributes':_0x1c40a4[_0x0a4c('0x18')]?_0x1c40a4[_0x0a4c('0x18')]['attributes']||null:null,'limit':_0x1c40a4[_0x0a4c('0x18')]?_0x1c40a4['options'][_0x0a4c('0x1b')]||null:null,'include':_0x1c40a4[_0x0a4c('0x18')]?_0x1c40a4[_0x0a4c('0x18')][_0x0a4c('0x1c')]?_[_0x0a4c('0x1d')](_0x1c40a4[_0x0a4c('0x18')][_0x0a4c('0x1c')],function(_0x115ff3){return{'model':db[_0x115ff3[_0x0a4c('0x1e')]],'as':_0x115ff3['as'],'attributes':_0x115ff3[_0x0a4c('0x1f')],'include':_0x115ff3['include']?_['map'](_0x115ff3['include'],function(_0x391545){return{'model':db[_0x391545[_0x0a4c('0x1e')]],'as':_0x391545['as'],'attributes':_0x391545['attributes'],'include':_0x391545['include']?_[_0x0a4c('0x1d')](_0x391545[_0x0a4c('0x1c')],function(_0x2ce06d){return{'model':db[_0x2ce06d['model']],'as':_0x2ce06d['as'],'attributes':_0x2ce06d['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a4c('0x9')](function(_0x615d53){logger['info'](_0x0a4c('0x15'),_0x1c40a4);logger[_0x0a4c('0xd')](_0x0a4c('0x15'),_0x1c40a4,JSON[_0x0a4c('0xf')](_0x615d53));_0x1525e6(_0x615d53);})[_0x0a4c('0x14')](function(_0x298acf){logger[_0x0a4c('0x10')]('GetSugarcrmAccount',_0x298acf[_0x0a4c('0x12')],_0x1c40a4);_0x427db6(_0x4e8012['error'](0x1f4,_0x298acf[_0x0a4c('0x12')]));});});};exports[_0x0a4c('0x20')]=function(_0x1fac47){var _0x212c38=this;return new Promise(function(_0x653f2d,_0x5a76b8){return db[_0x0a4c('0x16')][_0x0a4c('0x21')]({'raw':_0x1fac47[_0x0a4c('0x18')]?_0x1fac47[_0x0a4c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1fac47[_0x0a4c('0x18')]?_0x1fac47['options'][_0x0a4c('0x1a')]||null:null,'attributes':_0x1fac47[_0x0a4c('0x18')]?_0x1fac47[_0x0a4c('0x18')][_0x0a4c('0x1f')]||null:null,'include':_0x1fac47[_0x0a4c('0x18')]?_0x1fac47[_0x0a4c('0x18')][_0x0a4c('0x1c')]?_[_0x0a4c('0x1d')](_0x1fac47[_0x0a4c('0x18')][_0x0a4c('0x1c')],function(_0x22ebda){return{'model':db[_0x22ebda[_0x0a4c('0x1e')]],'as':_0x22ebda['as'],'attributes':_0x22ebda[_0x0a4c('0x1f')],'include':_0x22ebda[_0x0a4c('0x1c')]?_[_0x0a4c('0x1d')](_0x22ebda[_0x0a4c('0x1c')],function(_0x13b989){return{'model':db[_0x13b989[_0x0a4c('0x1e')]],'as':_0x13b989['as'],'attributes':_0x13b989['attributes'],'include':_0x13b989[_0x0a4c('0x1c')]?_[_0x0a4c('0x1d')](_0x13b989[_0x0a4c('0x1c')],function(_0xb11269){return{'model':db[_0xb11269[_0x0a4c('0x1e')]],'as':_0xb11269['as'],'attributes':_0xb11269[_0x0a4c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0a4c('0x9')](function(_0x3fe974){logger['info'](_0x0a4c('0x20'),_0x1fac47);logger[_0x0a4c('0xd')](_0x0a4c('0x20'),_0x1fac47,JSON[_0x0a4c('0xf')](_0x3fe974));_0x653f2d(_0x3fe974);})['catch'](function(_0x3f2b20){logger['error'](_0x0a4c('0x20'),_0x3f2b20[_0x0a4c('0x12')],_0x1fac47);_0x5a76b8(_0x212c38[_0x0a4c('0x10')](0x1f4,_0x3f2b20['message']));});});}; \ No newline at end of file +var _0xe446=['where','limit','include','model','attributes','map','ShowSugarcrmAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw'];(function(_0x51cc1d,_0xaa88ae){var _0x2eb9f2=function(_0x1ca525){while(--_0x1ca525){_0x51cc1d['push'](_0x51cc1d['shift']());}};_0x2eb9f2(++_0xaa88ae);}(_0xe446,0x189));var _0x6e44=function(_0x3d92a8,_0xa9bba1){_0x3d92a8=_0x3d92a8-0x0;var _0x3a3f23=_0xe446[_0x3d92a8];return _0x3a3f23;};'use strict';var _=require(_0x6e44('0x0'));var util=require(_0x6e44('0x1'));var moment=require('moment');var BPromise=require(_0x6e44('0x2'));var rs=require(_0x6e44('0x3'));var fs=require('fs');var Redis=require(_0x6e44('0x4'));var db=require(_0x6e44('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e44('0x6'))(_0x6e44('0x7'));var config=require(_0x6e44('0x8'));var jayson=require(_0x6e44('0x9'));var client=jayson[_0x6e44('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5609a0,_0x43e923,_0x464b45){return new BPromise(function(_0x47fcf3,_0x262eb9){return client[_0x6e44('0xb')](_0x5609a0,_0x464b45)[_0x6e44('0xc')](function(_0x35ce8c){logger[_0x6e44('0xd')](_0x6e44('0xe'),_0x43e923,'request\x20sent');logger[_0x6e44('0xf')](_0x6e44('0x10'),_0x43e923,_0x6e44('0x11'),JSON[_0x6e44('0x12')](_0x35ce8c));if(_0x35ce8c[_0x6e44('0x13')]){if(_0x35ce8c[_0x6e44('0x13')]['code']===0x1f4){logger[_0x6e44('0x13')](_0x6e44('0xe'),_0x43e923,_0x35ce8c[_0x6e44('0x13')][_0x6e44('0x14')]);return _0x262eb9(_0x35ce8c[_0x6e44('0x13')][_0x6e44('0x14')]);}logger[_0x6e44('0x13')](_0x6e44('0xe'),_0x43e923,_0x35ce8c[_0x6e44('0x13')][_0x6e44('0x14')]);return _0x47fcf3(_0x35ce8c[_0x6e44('0x13')][_0x6e44('0x14')]);}else{logger[_0x6e44('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x43e923,_0x6e44('0x11'));_0x47fcf3(_0x35ce8c['result'][_0x6e44('0x14')]);}})[_0x6e44('0x15')](function(_0x1690b0){logger[_0x6e44('0x13')](_0x6e44('0xe'),_0x43e923,_0x1690b0);_0x262eb9(_0x1690b0);});});}exports[_0x6e44('0x16')]=function(_0x7eafe){var _0xde2e43=this;return new Promise(function(_0x3d7f1b,_0x53d187){return db[_0x6e44('0x17')][_0x6e44('0x18')]({'raw':_0x7eafe[_0x6e44('0x19')]?_0x7eafe['options'][_0x6e44('0x1a')]===undefined?!![]:![]:!![],'where':_0x7eafe[_0x6e44('0x19')]?_0x7eafe['options'][_0x6e44('0x1b')]||null:null,'attributes':_0x7eafe[_0x6e44('0x19')]?_0x7eafe[_0x6e44('0x19')]['attributes']||null:null,'limit':_0x7eafe['options']?_0x7eafe[_0x6e44('0x19')][_0x6e44('0x1c')]||null:null,'include':_0x7eafe[_0x6e44('0x19')]?_0x7eafe[_0x6e44('0x19')]['include']?_['map'](_0x7eafe[_0x6e44('0x19')][_0x6e44('0x1d')],function(_0x320e67){return{'model':db[_0x320e67[_0x6e44('0x1e')]],'as':_0x320e67['as'],'attributes':_0x320e67[_0x6e44('0x1f')],'include':_0x320e67[_0x6e44('0x1d')]?_[_0x6e44('0x20')](_0x320e67[_0x6e44('0x1d')],function(_0x24e5bf){return{'model':db[_0x24e5bf['model']],'as':_0x24e5bf['as'],'attributes':_0x24e5bf[_0x6e44('0x1f')],'include':_0x24e5bf['include']?_[_0x6e44('0x20')](_0x24e5bf[_0x6e44('0x1d')],function(_0x11b9ea){return{'model':db[_0x11b9ea['model']],'as':_0x11b9ea['as'],'attributes':_0x11b9ea[_0x6e44('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1db22f){logger[_0x6e44('0xd')]('GetSugarcrmAccount',_0x7eafe);logger[_0x6e44('0xf')](_0x6e44('0x16'),_0x7eafe,JSON[_0x6e44('0x12')](_0x1db22f));_0x3d7f1b(_0x1db22f);})[_0x6e44('0x15')](function(_0x22baae){logger[_0x6e44('0x13')](_0x6e44('0x16'),_0x22baae[_0x6e44('0x14')],_0x7eafe);_0x53d187(_0xde2e43['error'](0x1f4,_0x22baae[_0x6e44('0x14')]));});});};exports[_0x6e44('0x21')]=function(_0x35741d){var _0x2283ee=this;return new Promise(function(_0x320417,_0xab6879){return db[_0x6e44('0x17')][_0x6e44('0x22')]({'raw':_0x35741d['options']?_0x35741d['options'][_0x6e44('0x1a')]===undefined?!![]:![]:!![],'where':_0x35741d[_0x6e44('0x19')]?_0x35741d['options'][_0x6e44('0x1b')]||null:null,'attributes':_0x35741d['options']?_0x35741d[_0x6e44('0x19')][_0x6e44('0x1f')]||null:null,'include':_0x35741d[_0x6e44('0x19')]?_0x35741d[_0x6e44('0x19')][_0x6e44('0x1d')]?_[_0x6e44('0x20')](_0x35741d['options'][_0x6e44('0x1d')],function(_0x214351){return{'model':db[_0x214351[_0x6e44('0x1e')]],'as':_0x214351['as'],'attributes':_0x214351['attributes'],'include':_0x214351[_0x6e44('0x1d')]?_[_0x6e44('0x20')](_0x214351[_0x6e44('0x1d')],function(_0x482d4d){return{'model':db[_0x482d4d['model']],'as':_0x482d4d['as'],'attributes':_0x482d4d[_0x6e44('0x1f')],'include':_0x482d4d[_0x6e44('0x1d')]?_[_0x6e44('0x20')](_0x482d4d[_0x6e44('0x1d')],function(_0x4b65c7){return{'model':db[_0x4b65c7[_0x6e44('0x1e')]],'as':_0x4b65c7['as'],'attributes':_0x4b65c7[_0x6e44('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6e44('0xc')](function(_0x3d2cdd){logger[_0x6e44('0xd')](_0x6e44('0x21'),_0x35741d);logger[_0x6e44('0xf')](_0x6e44('0x21'),_0x35741d,JSON[_0x6e44('0x12')](_0x3d2cdd));_0x320417(_0x3d2cdd);})[_0x6e44('0x15')](function(_0x2472a5){logger['error'](_0x6e44('0x21'),_0x2472a5['message'],_0x35741d);_0xab6879(_0x2283ee[_0x6e44('0x13')](0x1f4,_0x2472a5[_0x6e44('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index b4bcedd..c92f09d 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 _0x4da1=['post','create','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x223902,_0x4601c1){var _0x289a2a=function(_0x1806fb){while(--_0x1806fb){_0x223902['push'](_0x223902['shift']());}};_0x289a2a(++_0x4601c1);}(_0x4da1,0x1bd));var _0x14da=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4da1[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x14da('0x0'));var util=require(_0x14da('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x14da('0x2')]();var fs_extra=require(_0x14da('0x3'));var auth=require(_0x14da('0x4'));var interaction=require(_0x14da('0x5'));var config=require(_0x14da('0x6'));var controller=require(_0x14da('0x7'));router['get']('/',auth[_0x14da('0x8')](),controller[_0x14da('0x9')]);router[_0x14da('0xa')](_0x14da('0xb'),auth[_0x14da('0x8')](),controller[_0x14da('0xc')]);router[_0x14da('0xa')](_0x14da('0xd'),auth[_0x14da('0x8')](),controller['getFields']);router[_0x14da('0xa')](_0x14da('0xe'),auth[_0x14da('0x8')](),controller[_0x14da('0xf')]);router[_0x14da('0xa')](_0x14da('0x10'),auth[_0x14da('0x8')](),controller['getDescriptions']);router[_0x14da('0x11')]('/',auth['isAuthenticated'](),controller[_0x14da('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x14da('0x13')](_0x14da('0xb'),auth[_0x14da('0x8')](),controller[_0x14da('0x14')]);module[_0x14da('0x15')]=router; \ No newline at end of file +var _0xee6e=['destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete'];(function(_0x2efdfc,_0x4d21e7){var _0x20cdc4=function(_0x269b55){while(--_0x269b55){_0x2efdfc['push'](_0x2efdfc['shift']());}};_0x20cdc4(++_0x4d21e7);}(_0xee6e,0x1ca));var _0xeee6=function(_0x4632c6,_0x497902){_0x4632c6=_0x4632c6-0x0;var _0x51916d=_0xee6e[_0x4632c6];return _0x51916d;};'use strict';var multer=require(_0xeee6('0x0'));var util=require(_0xeee6('0x1'));var path=require('path');var timeout=require(_0xeee6('0x2'));var express=require('express');var router=express[_0xeee6('0x3')]();var fs_extra=require(_0xeee6('0x4'));var auth=require(_0xeee6('0x5'));var interaction=require(_0xeee6('0x6'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0xeee6('0x7')]('/',auth[_0xeee6('0x8')](),controller[_0xeee6('0x9')]);router[_0xeee6('0x7')](_0xeee6('0xa'),auth[_0xeee6('0x8')](),controller[_0xeee6('0xb')]);router[_0xeee6('0x7')](_0xeee6('0xc'),auth['isAuthenticated'](),controller[_0xeee6('0xd')]);router['get'](_0xeee6('0xe'),auth[_0xeee6('0x8')](),controller[_0xeee6('0xf')]);router[_0xeee6('0x7')](_0xeee6('0x10'),auth['isAuthenticated'](),controller[_0xeee6('0x11')]);router[_0xeee6('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xeee6('0x13')]('/:id',auth[_0xeee6('0x8')](),controller[_0xeee6('0x14')]);router[_0xeee6('0x15')](_0xeee6('0xa'),auth[_0xeee6('0x8')](),controller[_0xeee6('0x16')]);module[_0xeee6('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 4dbb684..d566fc9 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 _0xf07d=['sequelize','exports','STRING'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xf07d,0xe4));var _0xdf07=function(_0x5e947d,_0x35b027){_0x5e947d=_0x5e947d-0x0;var _0x41678e=_0xf07d[_0x5e947d];return _0x41678e;};'use strict';var Sequelize=require(_0xdf07('0x0'));module[_0xdf07('0x1')]={'name':{'type':Sequelize[_0xdf07('0x2')]},'description':{'type':Sequelize[_0xdf07('0x2')]}}; \ No newline at end of file +var _0x09eb=['exports','STRING','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x09eb,0xe3));var _0xb09e=function(_0x644560,_0x1783aa){_0x644560=_0x644560-0x0;var _0x41b76b=_0x09eb[_0x644560];return _0x41b76b;};'use strict';var Sequelize=require(_0xb09e('0x0'));module[_0xb09e('0x1')]={'name':{'type':Sequelize[_0xb09e('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 89735e5..a0cde83 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 _0x6f4e=['../../config/license/hardware','../../config/logger','api','../../config/license/util','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','json','offset','undefined','limit','set','apply','reject','save','destroy','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','nolimit','where','pick','filter','merge','VIRTUAL','options','count','findAll','show','keys','includeAll','include','find','create','body','update','params','getFields','SugarcrmField','order','sort','hasOwnProperty','getSubjects','getDescriptions','findOne','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3ee08b,_0x1cac1b){var _0x24a65b=function(_0x259c17){while(--_0x259c17){_0x3ee08b['push'](_0x3ee08b['shift']());}};_0x24a65b(++_0x1cac1b);}(_0x6f4e,0x1ae));var _0xe6f4=function(_0x38bede,_0x2c45c3){_0x38bede=_0x38bede-0x0;var _0x501209=_0x6f4e[_0x38bede];return _0x501209;};'use strict';var emlformat=require(_0xe6f4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe6f4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe6f4('0x2'));var moment=require(_0xe6f4('0x3'));var BPromise=require(_0xe6f4('0x4'));var Mustache=require(_0xe6f4('0x5'));var util=require(_0xe6f4('0x6'));var path=require('path');var sox=require(_0xe6f4('0x7'));var csv=require(_0xe6f4('0x8'));var ejs=require(_0xe6f4('0x9'));var fs=require('fs');var fs_extra=require(_0xe6f4('0xa'));var _=require('lodash');var squel=require(_0xe6f4('0xb'));var crypto=require(_0xe6f4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe6f4('0xd'));var toCsv=require(_0xe6f4('0x8'));var querystring=require(_0xe6f4('0xe'));var Papa=require(_0xe6f4('0xf'));var Redis=require(_0xe6f4('0x10'));var authService=require(_0xe6f4('0x11'));var qs=require(_0xe6f4('0x12'));var as=require(_0xe6f4('0x13'));var hardwareService=require(_0xe6f4('0x14'));var logger=require(_0xe6f4('0x15'))(_0xe6f4('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe6f4('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xe6f4('0x18'));var client=jayson[_0xe6f4('0x19')][_0xe6f4('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4115dd,_0xf1f65b,_0x5f0398,_0xc43cb1){return new BPromise(function(_0x150bc5,_0x315266){var _0x609b9=_0xc43cb1||client;return _0x609b9[_0xe6f4('0x1b')](_0x4115dd,_0x5f0398)[_0xe6f4('0x1c')](function(_0x1017ba){logger[_0xe6f4('0x1d')](_0xe6f4('0x1e'),_0xf1f65b,_0xe6f4('0x1f'));logger[_0xe6f4('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0xf1f65b,'request\x20sent',JSON[_0xe6f4('0x21')](_0x1017ba));if(_0x1017ba['error']){if(_0x1017ba[_0xe6f4('0x22')][_0xe6f4('0x23')]===0x1f4){logger[_0xe6f4('0x22')](_0xe6f4('0x1e'),_0xf1f65b,_0x1017ba[_0xe6f4('0x22')]['message']);return _0x315266(_0x1017ba['error'][_0xe6f4('0x24')]);}logger[_0xe6f4('0x22')](_0xe6f4('0x1e'),_0xf1f65b,_0x1017ba[_0xe6f4('0x22')][_0xe6f4('0x24')]);return _0x150bc5(_0x1017ba[_0xe6f4('0x22')][_0xe6f4('0x24')]);}else{logger[_0xe6f4('0x1d')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xf1f65b,_0xe6f4('0x1f'));_0x150bc5(_0x1017ba['result'][_0xe6f4('0x24')]);}})[_0xe6f4('0x25')](function(_0x10d87f){logger[_0xe6f4('0x22')](_0xe6f4('0x1e'),_0xf1f65b,_0x10d87f);_0x315266(_0x10d87f);});});}function respondWithStatusCode(_0x5402a2,_0x4d15b3){_0x4d15b3=_0x4d15b3||0xcc;return function(_0x51b7c8){if(_0x51b7c8){return _0x5402a2[_0xe6f4('0x26')](_0x4d15b3);}return _0x5402a2[_0xe6f4('0x27')](_0x4d15b3)['end']();};}function respondWithResult(_0x42c0aa,_0x37f6bd){_0x37f6bd=_0x37f6bd||0xc8;return function(_0x2f8952){if(_0x2f8952){return _0x42c0aa[_0xe6f4('0x27')](_0x37f6bd)[_0xe6f4('0x28')](_0x2f8952);}};}function respondWithFilteredResult(_0x1f3404,_0x51a826){return function(_0x4290e7){if(_0x4290e7){var _0x1d799a=typeof _0x51a826[_0xe6f4('0x29')]===_0xe6f4('0x2a')&&typeof _0x51a826[_0xe6f4('0x2b')]===_0xe6f4('0x2a');var _0x42a82e=_0x4290e7['count'];var _0x5d15f2=_0x1d799a?0x0:_0x51a826[_0xe6f4('0x29')];var _0x5e9be0=_0x1d799a?_0x4290e7['count']:_0x51a826[_0xe6f4('0x29')]+_0x51a826[_0xe6f4('0x2b')];var _0x4eba1a;if(_0x5e9be0>=_0x42a82e){_0x5e9be0=_0x42a82e;_0x4eba1a=0xc8;}else{_0x4eba1a=0xce;}_0x1f3404[_0xe6f4('0x27')](_0x4eba1a);return _0x1f3404[_0xe6f4('0x2c')]('Content-Range',_0x5d15f2+'-'+_0x5e9be0+'/'+_0x42a82e)[_0xe6f4('0x28')](_0x4290e7);}return null;};}function patchUpdates(_0x564c7e){return function(_0x2dd4b8){try{jsonpatch[_0xe6f4('0x2d')](_0x2dd4b8,_0x564c7e,!![]);}catch(_0x3b98ca){return BPromise[_0xe6f4('0x2e')](_0x3b98ca);}return _0x2dd4b8[_0xe6f4('0x2f')]();};}function saveUpdates(_0x50c626,_0x56bcc1){return function(_0x4e7a21){if(_0x4e7a21){return _0x4e7a21['update'](_0x50c626)[_0xe6f4('0x1c')](function(_0x4cfc84){return _0x4cfc84;});}return null;};}function removeEntity(_0x2e076b,_0x13b572){return function(_0x199a8d){if(_0x199a8d){return _0x199a8d[_0xe6f4('0x30')]()[_0xe6f4('0x1c')](function(){_0x2e076b[_0xe6f4('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x388ec2,_0x59f4e0){return function(_0x2f27a1){if(!_0x2f27a1){_0x388ec2['sendStatus'](0x194);}return _0x2f27a1;};}function handleError(_0x431d03,_0x52787b){_0x52787b=_0x52787b||0x1f4;return function(_0x495db9){logger[_0xe6f4('0x22')](_0x495db9['stack']);if(_0x495db9[_0xe6f4('0x31')]){delete _0x495db9[_0xe6f4('0x31')];}_0x431d03[_0xe6f4('0x27')](_0x52787b)[_0xe6f4('0x32')](_0x495db9);};}exports[_0xe6f4('0x33')]=function(_0x4f6539,_0x13417d){var _0x57b947={},_0x392f8a={},_0x13d75b={'count':0x0,'rows':[]};var _0x4372c9=_[_0xe6f4('0x34')](db[_0xe6f4('0x35')][_0xe6f4('0x36')],function(_0x2c8c78){return{'name':_0x2c8c78[_0xe6f4('0x37')],'type':_0x2c8c78[_0xe6f4('0x38')]['key']};});_0x392f8a[_0xe6f4('0x39')]=_[_0xe6f4('0x34')](_0x4372c9,'name');_0x392f8a[_0xe6f4('0x3a')]=_['keys'](_0x4f6539['query']);_0x392f8a[_0xe6f4('0x3b')]=_[_0xe6f4('0x3c')](_0x392f8a[_0xe6f4('0x39')],_0x392f8a[_0xe6f4('0x3a')]);_0x57b947['attributes']=_[_0xe6f4('0x3c')](_0x392f8a[_0xe6f4('0x39')],qs['fields'](_0x4f6539[_0xe6f4('0x3a')][_0xe6f4('0x3d')]));_0x57b947[_0xe6f4('0x3e')]=_0x57b947['attributes'][_0xe6f4('0x3f')]?_0x57b947['attributes']:_0x392f8a['model'];if(!_0x4f6539['query']['hasOwnProperty'](_0xe6f4('0x40'))){_0x57b947[_0xe6f4('0x2b')]=qs[_0xe6f4('0x2b')](_0x4f6539[_0xe6f4('0x3a')][_0xe6f4('0x2b')]);_0x57b947[_0xe6f4('0x29')]=qs[_0xe6f4('0x29')](_0x4f6539['query'][_0xe6f4('0x29')]);}_0x57b947['order']=qs['sort'](_0x4f6539[_0xe6f4('0x3a')]['sort']);_0x57b947[_0xe6f4('0x41')]=qs[_0xe6f4('0x3b')](_[_0xe6f4('0x42')](_0x4f6539[_0xe6f4('0x3a')],_0x392f8a[_0xe6f4('0x3b')]),_0x4372c9);if(_0x4f6539[_0xe6f4('0x3a')][_0xe6f4('0x43')]){_0x57b947[_0xe6f4('0x41')]=_[_0xe6f4('0x44')](_0x57b947[_0xe6f4('0x41')],{'$or':_[_0xe6f4('0x34')](_0x4372c9,function(_0x10616b){if(_0x10616b[_0xe6f4('0x38')]!==_0xe6f4('0x45')){var _0x3944e6={};_0x3944e6[_0x10616b[_0xe6f4('0x31')]]={'$like':'%'+_0x4f6539[_0xe6f4('0x3a')]['filter']+'%'};return _0x3944e6;}})});}_0x57b947=_[_0xe6f4('0x44')]({},_0x57b947,_0x4f6539[_0xe6f4('0x46')]);var _0xbcfa12={'where':_0x57b947['where']};return db[_0xe6f4('0x35')][_0xe6f4('0x47')](_0xbcfa12)['then'](function(_0x141d24){_0x13d75b[_0xe6f4('0x47')]=_0x141d24;if(_0x4f6539[_0xe6f4('0x3a')]['includeAll']){_0x57b947['include']=[{'all':!![]}];}return db[_0xe6f4('0x35')][_0xe6f4('0x48')](_0x57b947);})[_0xe6f4('0x1c')](function(_0x341ad4){_0x13d75b['rows']=_0x341ad4;return _0x13d75b;})[_0xe6f4('0x1c')](respondWithFilteredResult(_0x13417d,_0x57b947))[_0xe6f4('0x25')](handleError(_0x13417d,null));};exports[_0xe6f4('0x49')]=function(_0xd7e748,_0x3c9da1){var _0x3fb746={'raw':![],'where':{'id':_0xd7e748['params']['id']}},_0x19d069={};_0x19d069[_0xe6f4('0x39')]=_[_0xe6f4('0x4a')](db['SugarcrmConfiguration']['rawAttributes']);_0x19d069[_0xe6f4('0x3a')]=_[_0xe6f4('0x4a')](_0xd7e748['query']);_0x19d069[_0xe6f4('0x3b')]=_['intersection'](_0x19d069[_0xe6f4('0x39')],_0x19d069[_0xe6f4('0x3a')]);_0x3fb746[_0xe6f4('0x3e')]=_[_0xe6f4('0x3c')](_0x19d069[_0xe6f4('0x39')],qs[_0xe6f4('0x3d')](_0xd7e748[_0xe6f4('0x3a')][_0xe6f4('0x3d')]));_0x3fb746[_0xe6f4('0x3e')]=_0x3fb746[_0xe6f4('0x3e')]['length']?_0x3fb746[_0xe6f4('0x3e')]:_0x19d069[_0xe6f4('0x39')];if(_0xd7e748['query'][_0xe6f4('0x4b')]){_0x3fb746[_0xe6f4('0x4c')]=[{'all':!![]}];}_0x3fb746=_[_0xe6f4('0x44')]({},_0x3fb746,_0xd7e748[_0xe6f4('0x46')]);return db[_0xe6f4('0x35')][_0xe6f4('0x4d')](_0x3fb746)[_0xe6f4('0x1c')](handleEntityNotFound(_0x3c9da1,null))[_0xe6f4('0x1c')](respondWithResult(_0x3c9da1,null))['catch'](handleError(_0x3c9da1,null));};exports[_0xe6f4('0x4e')]=function(_0x55a7c5,_0xf54d56){return db['SugarcrmConfiguration'][_0xe6f4('0x4e')](_0x55a7c5[_0xe6f4('0x4f')],{})[_0xe6f4('0x1c')](respondWithResult(_0xf54d56,0xc9))[_0xe6f4('0x25')](handleError(_0xf54d56,null));};exports[_0xe6f4('0x50')]=function(_0x1be084,_0x11299a){if(_0x1be084[_0xe6f4('0x4f')]['id']){delete _0x1be084[_0xe6f4('0x4f')]['id'];}return db[_0xe6f4('0x35')][_0xe6f4('0x4d')]({'where':{'id':_0x1be084['params']['id']}})['then'](handleEntityNotFound(_0x11299a,null))['then'](saveUpdates(_0x1be084[_0xe6f4('0x4f')],null))[_0xe6f4('0x1c')](respondWithResult(_0x11299a,null))[_0xe6f4('0x25')](handleError(_0x11299a,null));};exports['destroy']=function(_0x503130,_0x26a7f9){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x503130[_0xe6f4('0x51')]['id']}})[_0xe6f4('0x1c')](handleEntityNotFound(_0x26a7f9,null))[_0xe6f4('0x1c')](removeEntity(_0x26a7f9,null))[_0xe6f4('0x25')](handleError(_0x26a7f9,null));};exports[_0xe6f4('0x52')]=function(_0x514e30,_0x39977e,_0x4e1703){var _0x4ba3f3={};var _0x431094={};var _0x54a87a;var _0x30adc6;return db[_0xe6f4('0x35')]['findOne']({'where':{'id':_0x514e30[_0xe6f4('0x51')]['id']}})[_0xe6f4('0x1c')](handleEntityNotFound(_0x39977e,null))[_0xe6f4('0x1c')](function(_0x4f372f){if(_0x4f372f){_0x54a87a=_0x4f372f;_0x431094[_0xe6f4('0x39')]=_[_0xe6f4('0x4a')](db[_0xe6f4('0x53')][_0xe6f4('0x36')]);_0x431094['query']=_[_0xe6f4('0x4a')](_0x514e30[_0xe6f4('0x3a')]);_0x431094[_0xe6f4('0x3b')]=_['intersection'](_0x431094[_0xe6f4('0x39')],_0x431094[_0xe6f4('0x3a')]);_0x4ba3f3['attributes']=_[_0xe6f4('0x3c')](_0x431094['model'],qs[_0xe6f4('0x3d')](_0x514e30[_0xe6f4('0x3a')]['fields']));_0x4ba3f3[_0xe6f4('0x3e')]=_0x4ba3f3['attributes']['length']?_0x4ba3f3[_0xe6f4('0x3e')]:_0x431094[_0xe6f4('0x39')];_0x4ba3f3[_0xe6f4('0x54')]=qs[_0xe6f4('0x55')](_0x514e30[_0xe6f4('0x3a')][_0xe6f4('0x55')]);_0x4ba3f3[_0xe6f4('0x41')]=qs[_0xe6f4('0x3b')](_['pick'](_0x514e30[_0xe6f4('0x3a')],_0x431094[_0xe6f4('0x3b')]));if(_0x514e30[_0xe6f4('0x3a')][_0xe6f4('0x43')]){_0x4ba3f3[_0xe6f4('0x41')]=_['merge'](_0x4ba3f3[_0xe6f4('0x41')],{'$or':_['map'](_0x4ba3f3[_0xe6f4('0x3e')],function(_0x34b6ed){var _0x10d58b={};_0x10d58b[_0x34b6ed]={'$like':'%'+_0x514e30['query'][_0xe6f4('0x43')]+'%'};return _0x10d58b;})});}_0x4ba3f3=_['merge']({},_0x4ba3f3,_0x514e30[_0xe6f4('0x46')]);return _0x54a87a[_0xe6f4('0x52')](_0x4ba3f3);}})['then'](function(_0x3f9f0e){if(_0x3f9f0e){_0x30adc6=_0x3f9f0e[_0xe6f4('0x3f')];if(!_0x514e30[_0xe6f4('0x3a')][_0xe6f4('0x56')](_0xe6f4('0x40'))){_0x4ba3f3['limit']=qs[_0xe6f4('0x2b')](_0x514e30[_0xe6f4('0x3a')][_0xe6f4('0x2b')]);_0x4ba3f3[_0xe6f4('0x29')]=qs[_0xe6f4('0x29')](_0x514e30[_0xe6f4('0x3a')]['offset']);}return _0x54a87a['getFields'](_0x4ba3f3);}})[_0xe6f4('0x1c')](function(_0x155fca){if(_0x155fca){return _0x155fca?{'count':_0x30adc6,'rows':_0x155fca}:null;}})['then'](respondWithResult(_0x39977e,null))[_0xe6f4('0x25')](handleError(_0x39977e,null));};exports[_0xe6f4('0x57')]=function(_0x5c1bfb,_0x1ff4b4,_0x447a9b){var _0x28c0c9={};var _0x1cf325={};var _0x3613b1;var _0x47e6cf;return db[_0xe6f4('0x35')]['findOne']({'where':{'id':_0x5c1bfb[_0xe6f4('0x51')]['id']}})[_0xe6f4('0x1c')](handleEntityNotFound(_0x1ff4b4,null))[_0xe6f4('0x1c')](function(_0x38f399){if(_0x38f399){_0x3613b1=_0x38f399;_0x1cf325[_0xe6f4('0x39')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x1cf325[_0xe6f4('0x3a')]=_[_0xe6f4('0x4a')](_0x5c1bfb['query']);_0x1cf325[_0xe6f4('0x3b')]=_[_0xe6f4('0x3c')](_0x1cf325[_0xe6f4('0x39')],_0x1cf325[_0xe6f4('0x3a')]);_0x28c0c9[_0xe6f4('0x3e')]=_[_0xe6f4('0x3c')](_0x1cf325['model'],qs[_0xe6f4('0x3d')](_0x5c1bfb[_0xe6f4('0x3a')][_0xe6f4('0x3d')]));_0x28c0c9['attributes']=_0x28c0c9['attributes'][_0xe6f4('0x3f')]?_0x28c0c9['attributes']:_0x1cf325[_0xe6f4('0x39')];_0x28c0c9[_0xe6f4('0x54')]=qs[_0xe6f4('0x55')](_0x5c1bfb[_0xe6f4('0x3a')][_0xe6f4('0x55')]);_0x28c0c9['where']=qs[_0xe6f4('0x3b')](_[_0xe6f4('0x42')](_0x5c1bfb[_0xe6f4('0x3a')],_0x1cf325[_0xe6f4('0x3b')]));if(_0x5c1bfb[_0xe6f4('0x3a')]['filter']){_0x28c0c9['where']=_[_0xe6f4('0x44')](_0x28c0c9[_0xe6f4('0x41')],{'$or':_['map'](_0x28c0c9['attributes'],function(_0x7b9d6c){var _0x16e6e6={};_0x16e6e6[_0x7b9d6c]={'$like':'%'+_0x5c1bfb['query']['filter']+'%'};return _0x16e6e6;})});}_0x28c0c9=_[_0xe6f4('0x44')]({},_0x28c0c9,_0x5c1bfb[_0xe6f4('0x46')]);return _0x3613b1[_0xe6f4('0x57')](_0x28c0c9);}})['then'](function(_0xd066f8){if(_0xd066f8){_0x47e6cf=_0xd066f8[_0xe6f4('0x3f')];if(!_0x5c1bfb[_0xe6f4('0x3a')][_0xe6f4('0x56')](_0xe6f4('0x40'))){_0x28c0c9[_0xe6f4('0x2b')]=qs[_0xe6f4('0x2b')](_0x5c1bfb[_0xe6f4('0x3a')][_0xe6f4('0x2b')]);_0x28c0c9[_0xe6f4('0x29')]=qs[_0xe6f4('0x29')](_0x5c1bfb[_0xe6f4('0x3a')]['offset']);}return _0x3613b1[_0xe6f4('0x57')](_0x28c0c9);}})[_0xe6f4('0x1c')](function(_0x1f71f0){if(_0x1f71f0){return _0x1f71f0?{'count':_0x47e6cf,'rows':_0x1f71f0}:null;}})['then'](respondWithResult(_0x1ff4b4,null))[_0xe6f4('0x25')](handleError(_0x1ff4b4,null));};exports[_0xe6f4('0x58')]=function(_0xcc6bec,_0x2346f2,_0x4b2487){var _0x407540={};var _0x386e31={};var _0x130d6e;var _0x4d3573;return db[_0xe6f4('0x35')][_0xe6f4('0x59')]({'where':{'id':_0xcc6bec['params']['id']}})[_0xe6f4('0x1c')](handleEntityNotFound(_0x2346f2,null))[_0xe6f4('0x1c')](function(_0x2d8ba8){if(_0x2d8ba8){_0x130d6e=_0x2d8ba8;_0x386e31[_0xe6f4('0x39')]=_[_0xe6f4('0x4a')](db[_0xe6f4('0x53')][_0xe6f4('0x36')]);_0x386e31[_0xe6f4('0x3a')]=_['keys'](_0xcc6bec[_0xe6f4('0x3a')]);_0x386e31['filters']=_['intersection'](_0x386e31[_0xe6f4('0x39')],_0x386e31[_0xe6f4('0x3a')]);_0x407540[_0xe6f4('0x3e')]=_['intersection'](_0x386e31[_0xe6f4('0x39')],qs[_0xe6f4('0x3d')](_0xcc6bec[_0xe6f4('0x3a')][_0xe6f4('0x3d')]));_0x407540[_0xe6f4('0x3e')]=_0x407540['attributes'][_0xe6f4('0x3f')]?_0x407540[_0xe6f4('0x3e')]:_0x386e31['model'];_0x407540['order']=qs[_0xe6f4('0x55')](_0xcc6bec[_0xe6f4('0x3a')]['sort']);_0x407540[_0xe6f4('0x41')]=qs[_0xe6f4('0x3b')](_[_0xe6f4('0x42')](_0xcc6bec[_0xe6f4('0x3a')],_0x386e31[_0xe6f4('0x3b')]));if(_0xcc6bec[_0xe6f4('0x3a')][_0xe6f4('0x43')]){_0x407540[_0xe6f4('0x41')]=_[_0xe6f4('0x44')](_0x407540[_0xe6f4('0x41')],{'$or':_['map'](_0x407540['attributes'],function(_0x5f06b1){var _0x36c92d={};_0x36c92d[_0x5f06b1]={'$like':'%'+_0xcc6bec[_0xe6f4('0x3a')]['filter']+'%'};return _0x36c92d;})});}_0x407540=_[_0xe6f4('0x44')]({},_0x407540,_0xcc6bec['options']);return _0x130d6e[_0xe6f4('0x58')](_0x407540);}})[_0xe6f4('0x1c')](function(_0x395743){if(_0x395743){_0x4d3573=_0x395743[_0xe6f4('0x3f')];if(!_0xcc6bec[_0xe6f4('0x3a')][_0xe6f4('0x56')](_0xe6f4('0x40'))){_0x407540[_0xe6f4('0x2b')]=qs['limit'](_0xcc6bec['query']['limit']);_0x407540[_0xe6f4('0x29')]=qs[_0xe6f4('0x29')](_0xcc6bec['query'][_0xe6f4('0x29')]);}return _0x130d6e['getDescriptions'](_0x407540);}})[_0xe6f4('0x1c')](function(_0x1820cd){if(_0x1820cd){return _0x1820cd?{'count':_0x4d3573,'rows':_0x1820cd}:null;}})[_0xe6f4('0x1c')](respondWithResult(_0x2346f2,null))[_0xe6f4('0x25')](handleError(_0x2346f2,null));}; \ No newline at end of file +var _0x34d8=['findAll','rows','params','intersection','length','find','create','update','body','getFields','SugarcrmField','filter','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','end','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','SugarcrmConfiguration','includeAll','include'];(function(_0x596dde,_0x102475){var _0x310929=function(_0x276987){while(--_0x276987){_0x596dde['push'](_0x596dde['shift']());}};_0x310929(++_0x102475);}(_0x34d8,0x167));var _0x834d=function(_0x5d3cae,_0x5f093c){_0x5d3cae=_0x5d3cae-0x0;var _0x4ef648=_0x34d8[_0x5d3cae];return _0x4ef648;};'use strict';var emlformat=require(_0x834d('0x0'));var rimraf=require(_0x834d('0x1'));var zipdir=require(_0x834d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x834d('0x3'));var Mustache=require(_0x834d('0x4'));var util=require(_0x834d('0x5'));var path=require(_0x834d('0x6'));var sox=require(_0x834d('0x7'));var csv=require('to-csv');var ejs=require(_0x834d('0x8'));var fs=require('fs');var fs_extra=require(_0x834d('0x9'));var _=require(_0x834d('0xa'));var squel=require('squel');var crypto=require(_0x834d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x834d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x834d('0xd'));var Redis=require('ioredis');var authService=require(_0x834d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x834d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x834d('0x10'))('api');var utils=require(_0x834d('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x834d('0x12'));var db=require(_0x834d('0x13'))['db'];var jayson=require(_0x834d('0x14'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c7715,_0x11d6bb,_0x42eb16,_0x48bc96){return new BPromise(function(_0x356b0b,_0x1514db){var _0x2a5075=_0x48bc96||client;return _0x2a5075[_0x834d('0x15')](_0x2c7715,_0x42eb16)[_0x834d('0x16')](function(_0x24a69b){logger[_0x834d('0x17')](_0x834d('0x18'),_0x11d6bb,'request\x20sent');logger[_0x834d('0x19')](_0x834d('0x1a'),_0x11d6bb,_0x834d('0x1b'),JSON[_0x834d('0x1c')](_0x24a69b));if(_0x24a69b['error']){if(_0x24a69b[_0x834d('0x1d')]['code']===0x1f4){logger[_0x834d('0x1d')](_0x834d('0x18'),_0x11d6bb,_0x24a69b[_0x834d('0x1d')]['message']);return _0x1514db(_0x24a69b['error']['message']);}logger['error'](_0x834d('0x18'),_0x11d6bb,_0x24a69b['error'][_0x834d('0x1e')]);return _0x356b0b(_0x24a69b['error'][_0x834d('0x1e')]);}else{logger[_0x834d('0x17')](_0x834d('0x18'),_0x11d6bb,'request\x20sent');_0x356b0b(_0x24a69b['result'][_0x834d('0x1e')]);}})[_0x834d('0x1f')](function(_0x1f089e){logger[_0x834d('0x1d')](_0x834d('0x18'),_0x11d6bb,_0x1f089e);_0x1514db(_0x1f089e);});});}function respondWithStatusCode(_0x591dfc,_0x5b1458){_0x5b1458=_0x5b1458||0xcc;return function(_0x63bb75){if(_0x63bb75){return _0x591dfc[_0x834d('0x20')](_0x5b1458);}return _0x591dfc[_0x834d('0x21')](_0x5b1458)['end']();};}function respondWithResult(_0x39fbbe,_0x20443a){_0x20443a=_0x20443a||0xc8;return function(_0x90ba74){if(_0x90ba74){return _0x39fbbe[_0x834d('0x21')](_0x20443a)[_0x834d('0x22')](_0x90ba74);}};}function respondWithFilteredResult(_0x7f2d59,_0x573760){return function(_0x33a997){if(_0x33a997){var _0x16cd6a=typeof _0x573760[_0x834d('0x23')]===_0x834d('0x24')&&typeof _0x573760[_0x834d('0x25')]==='undefined';var _0x5bce1a=_0x33a997[_0x834d('0x26')];var _0x1b0559=_0x16cd6a?0x0:_0x573760[_0x834d('0x23')];var _0x4dc063=_0x16cd6a?_0x33a997[_0x834d('0x26')]:_0x573760[_0x834d('0x23')]+_0x573760[_0x834d('0x25')];var _0x468e3c;if(_0x4dc063>=_0x5bce1a){_0x4dc063=_0x5bce1a;_0x468e3c=0xc8;}else{_0x468e3c=0xce;}_0x7f2d59[_0x834d('0x21')](_0x468e3c);return _0x7f2d59[_0x834d('0x27')](_0x834d('0x28'),_0x1b0559+'-'+_0x4dc063+'/'+_0x5bce1a)[_0x834d('0x22')](_0x33a997);}return null;};}function patchUpdates(_0x325f66){return function(_0x4a0a15){try{jsonpatch[_0x834d('0x29')](_0x4a0a15,_0x325f66,!![]);}catch(_0x473ae5){return BPromise['reject'](_0x473ae5);}return _0x4a0a15[_0x834d('0x2a')]();};}function saveUpdates(_0x14f846,_0x49cbfe){return function(_0x4e5c9f){if(_0x4e5c9f){return _0x4e5c9f['update'](_0x14f846)[_0x834d('0x16')](function(_0x316a0f){return _0x316a0f;});}return null;};}function removeEntity(_0x43e39a,_0x314873){return function(_0x173e2b){if(_0x173e2b){return _0x173e2b[_0x834d('0x2b')]()[_0x834d('0x16')](function(){_0x43e39a[_0x834d('0x21')](0xcc)[_0x834d('0x2c')]();});}};}function handleEntityNotFound(_0x61e3c9,_0x460426){return function(_0x8d9633){if(!_0x8d9633){_0x61e3c9['sendStatus'](0x194);}return _0x8d9633;};}function handleError(_0x525d24,_0xa8a5db){_0xa8a5db=_0xa8a5db||0x1f4;return function(_0x2fd2dd){logger[_0x834d('0x1d')](_0x2fd2dd[_0x834d('0x2d')]);if(_0x2fd2dd[_0x834d('0x2e')]){delete _0x2fd2dd['name'];}_0x525d24[_0x834d('0x21')](_0xa8a5db)[_0x834d('0x2f')](_0x2fd2dd);};}exports['index']=function(_0x4e1003,_0x3ad253){var _0x475127={},_0x25e48a={},_0x1392d4={'count':0x0,'rows':[]};var _0x6968de=_['map'](db['SugarcrmConfiguration'][_0x834d('0x30')],function(_0x58e1f0){return{'name':_0x58e1f0[_0x834d('0x31')],'type':_0x58e1f0[_0x834d('0x32')][_0x834d('0x33')]};});_0x25e48a[_0x834d('0x34')]=_[_0x834d('0x35')](_0x6968de,'name');_0x25e48a[_0x834d('0x36')]=_[_0x834d('0x37')](_0x4e1003[_0x834d('0x36')]);_0x25e48a[_0x834d('0x38')]=_['intersection'](_0x25e48a[_0x834d('0x34')],_0x25e48a[_0x834d('0x36')]);_0x475127[_0x834d('0x39')]=_['intersection'](_0x25e48a[_0x834d('0x34')],qs[_0x834d('0x3a')](_0x4e1003[_0x834d('0x36')][_0x834d('0x3a')]));_0x475127[_0x834d('0x39')]=_0x475127[_0x834d('0x39')]['length']?_0x475127[_0x834d('0x39')]:_0x25e48a[_0x834d('0x34')];if(!_0x4e1003['query'][_0x834d('0x3b')](_0x834d('0x3c'))){_0x475127['limit']=qs[_0x834d('0x25')](_0x4e1003[_0x834d('0x36')][_0x834d('0x25')]);_0x475127['offset']=qs[_0x834d('0x23')](_0x4e1003[_0x834d('0x36')][_0x834d('0x23')]);}_0x475127[_0x834d('0x3d')]=qs[_0x834d('0x3e')](_0x4e1003[_0x834d('0x36')][_0x834d('0x3e')]);_0x475127[_0x834d('0x3f')]=qs[_0x834d('0x38')](_[_0x834d('0x40')](_0x4e1003['query'],_0x25e48a[_0x834d('0x38')]),_0x6968de);if(_0x4e1003['query']['filter']){_0x475127[_0x834d('0x3f')]=_['merge'](_0x475127['where'],{'$or':_[_0x834d('0x35')](_0x6968de,function(_0x54bb42){if(_0x54bb42[_0x834d('0x32')]!==_0x834d('0x41')){var _0x102ced={};_0x102ced[_0x54bb42[_0x834d('0x2e')]]={'$like':'%'+_0x4e1003[_0x834d('0x36')]['filter']+'%'};return _0x102ced;}})});}_0x475127=_[_0x834d('0x42')]({},_0x475127,_0x4e1003[_0x834d('0x43')]);var _0x29dd56={'where':_0x475127['where']};return db[_0x834d('0x44')]['count'](_0x29dd56)['then'](function(_0x1f151f){_0x1392d4[_0x834d('0x26')]=_0x1f151f;if(_0x4e1003['query'][_0x834d('0x45')]){_0x475127[_0x834d('0x46')]=[{'all':!![]}];}return db[_0x834d('0x44')][_0x834d('0x47')](_0x475127);})[_0x834d('0x16')](function(_0x4877f){_0x1392d4[_0x834d('0x48')]=_0x4877f;return _0x1392d4;})[_0x834d('0x16')](respondWithFilteredResult(_0x3ad253,_0x475127))['catch'](handleError(_0x3ad253,null));};exports['show']=function(_0xb46dca,_0x3fc0e4){var _0x58b5ea={'raw':![],'where':{'id':_0xb46dca[_0x834d('0x49')]['id']}},_0x180b24={};_0x180b24[_0x834d('0x34')]=_['keys'](db[_0x834d('0x44')]['rawAttributes']);_0x180b24[_0x834d('0x36')]=_[_0x834d('0x37')](_0xb46dca[_0x834d('0x36')]);_0x180b24[_0x834d('0x38')]=_[_0x834d('0x4a')](_0x180b24[_0x834d('0x34')],_0x180b24[_0x834d('0x36')]);_0x58b5ea['attributes']=_[_0x834d('0x4a')](_0x180b24['model'],qs[_0x834d('0x3a')](_0xb46dca[_0x834d('0x36')][_0x834d('0x3a')]));_0x58b5ea[_0x834d('0x39')]=_0x58b5ea[_0x834d('0x39')][_0x834d('0x4b')]?_0x58b5ea[_0x834d('0x39')]:_0x180b24[_0x834d('0x34')];if(_0xb46dca['query'][_0x834d('0x45')]){_0x58b5ea['include']=[{'all':!![]}];}_0x58b5ea=_[_0x834d('0x42')]({},_0x58b5ea,_0xb46dca[_0x834d('0x43')]);return db['SugarcrmConfiguration'][_0x834d('0x4c')](_0x58b5ea)[_0x834d('0x16')](handleEntityNotFound(_0x3fc0e4,null))[_0x834d('0x16')](respondWithResult(_0x3fc0e4,null))['catch'](handleError(_0x3fc0e4,null));};exports['create']=function(_0x174744,_0x406d3f){return db[_0x834d('0x44')][_0x834d('0x4d')](_0x174744['body'],{})['then'](respondWithResult(_0x406d3f,0xc9))[_0x834d('0x1f')](handleError(_0x406d3f,null));};exports[_0x834d('0x4e')]=function(_0x3e07c7,_0x46dfb9){if(_0x3e07c7['body']['id']){delete _0x3e07c7['body']['id'];}return db['SugarcrmConfiguration'][_0x834d('0x4c')]({'where':{'id':_0x3e07c7[_0x834d('0x49')]['id']}})[_0x834d('0x16')](handleEntityNotFound(_0x46dfb9,null))[_0x834d('0x16')](saveUpdates(_0x3e07c7[_0x834d('0x4f')],null))[_0x834d('0x16')](respondWithResult(_0x46dfb9,null))[_0x834d('0x1f')](handleError(_0x46dfb9,null));};exports['destroy']=function(_0x205495,_0x38a7dc){return db[_0x834d('0x44')][_0x834d('0x4c')]({'where':{'id':_0x205495[_0x834d('0x49')]['id']}})[_0x834d('0x16')](handleEntityNotFound(_0x38a7dc,null))[_0x834d('0x16')](removeEntity(_0x38a7dc,null))[_0x834d('0x1f')](handleError(_0x38a7dc,null));};exports[_0x834d('0x50')]=function(_0x1b7933,_0x108766,_0x5ab4f9){var _0x10a989={};var _0x30e3a6={};var _0x1b7e71;var _0x8cd882;return db[_0x834d('0x44')]['findOne']({'where':{'id':_0x1b7933['params']['id']}})[_0x834d('0x16')](handleEntityNotFound(_0x108766,null))[_0x834d('0x16')](function(_0x3e1110){if(_0x3e1110){_0x1b7e71=_0x3e1110;_0x30e3a6[_0x834d('0x34')]=_['keys'](db[_0x834d('0x51')][_0x834d('0x30')]);_0x30e3a6['query']=_[_0x834d('0x37')](_0x1b7933[_0x834d('0x36')]);_0x30e3a6[_0x834d('0x38')]=_['intersection'](_0x30e3a6[_0x834d('0x34')],_0x30e3a6['query']);_0x10a989[_0x834d('0x39')]=_[_0x834d('0x4a')](_0x30e3a6['model'],qs['fields'](_0x1b7933[_0x834d('0x36')][_0x834d('0x3a')]));_0x10a989[_0x834d('0x39')]=_0x10a989[_0x834d('0x39')][_0x834d('0x4b')]?_0x10a989[_0x834d('0x39')]:_0x30e3a6[_0x834d('0x34')];_0x10a989[_0x834d('0x3d')]=qs[_0x834d('0x3e')](_0x1b7933['query'][_0x834d('0x3e')]);_0x10a989[_0x834d('0x3f')]=qs[_0x834d('0x38')](_[_0x834d('0x40')](_0x1b7933[_0x834d('0x36')],_0x30e3a6['filters']));if(_0x1b7933[_0x834d('0x36')][_0x834d('0x52')]){_0x10a989['where']=_[_0x834d('0x42')](_0x10a989[_0x834d('0x3f')],{'$or':_[_0x834d('0x35')](_0x10a989[_0x834d('0x39')],function(_0x585fd0){var _0x1912a7={};_0x1912a7[_0x585fd0]={'$like':'%'+_0x1b7933[_0x834d('0x36')]['filter']+'%'};return _0x1912a7;})});}_0x10a989=_[_0x834d('0x42')]({},_0x10a989,_0x1b7933[_0x834d('0x43')]);return _0x1b7e71['getFields'](_0x10a989);}})[_0x834d('0x16')](function(_0x2a6802){if(_0x2a6802){_0x8cd882=_0x2a6802[_0x834d('0x4b')];if(!_0x1b7933[_0x834d('0x36')][_0x834d('0x3b')]('nolimit')){_0x10a989[_0x834d('0x25')]=qs['limit'](_0x1b7933[_0x834d('0x36')][_0x834d('0x25')]);_0x10a989[_0x834d('0x23')]=qs['offset'](_0x1b7933[_0x834d('0x36')]['offset']);}return _0x1b7e71[_0x834d('0x50')](_0x10a989);}})[_0x834d('0x16')](function(_0x4c7b45){if(_0x4c7b45){return _0x4c7b45?{'count':_0x8cd882,'rows':_0x4c7b45}:null;}})[_0x834d('0x16')](respondWithResult(_0x108766,null))[_0x834d('0x1f')](handleError(_0x108766,null));};exports[_0x834d('0x53')]=function(_0x39207f,_0x1f61f2,_0x2c488e){var _0x2f0002={};var _0x45487a={};var _0xef670b;var _0x57859d;return db[_0x834d('0x44')]['findOne']({'where':{'id':_0x39207f[_0x834d('0x49')]['id']}})[_0x834d('0x16')](handleEntityNotFound(_0x1f61f2,null))[_0x834d('0x16')](function(_0x58d493){if(_0x58d493){_0xef670b=_0x58d493;_0x45487a['model']=_[_0x834d('0x37')](db[_0x834d('0x51')][_0x834d('0x30')]);_0x45487a[_0x834d('0x36')]=_[_0x834d('0x37')](_0x39207f[_0x834d('0x36')]);_0x45487a[_0x834d('0x38')]=_[_0x834d('0x4a')](_0x45487a[_0x834d('0x34')],_0x45487a[_0x834d('0x36')]);_0x2f0002[_0x834d('0x39')]=_['intersection'](_0x45487a[_0x834d('0x34')],qs[_0x834d('0x3a')](_0x39207f[_0x834d('0x36')][_0x834d('0x3a')]));_0x2f0002[_0x834d('0x39')]=_0x2f0002[_0x834d('0x39')]['length']?_0x2f0002[_0x834d('0x39')]:_0x45487a[_0x834d('0x34')];_0x2f0002[_0x834d('0x3d')]=qs[_0x834d('0x3e')](_0x39207f[_0x834d('0x36')]['sort']);_0x2f0002[_0x834d('0x3f')]=qs[_0x834d('0x38')](_['pick'](_0x39207f['query'],_0x45487a[_0x834d('0x38')]));if(_0x39207f['query']['filter']){_0x2f0002[_0x834d('0x3f')]=_[_0x834d('0x42')](_0x2f0002[_0x834d('0x3f')],{'$or':_[_0x834d('0x35')](_0x2f0002[_0x834d('0x39')],function(_0x3df05c){var _0x25afc1={};_0x25afc1[_0x3df05c]={'$like':'%'+_0x39207f[_0x834d('0x36')][_0x834d('0x52')]+'%'};return _0x25afc1;})});}_0x2f0002=_[_0x834d('0x42')]({},_0x2f0002,_0x39207f[_0x834d('0x43')]);return _0xef670b[_0x834d('0x53')](_0x2f0002);}})[_0x834d('0x16')](function(_0x22158b){if(_0x22158b){_0x57859d=_0x22158b[_0x834d('0x4b')];if(!_0x39207f[_0x834d('0x36')][_0x834d('0x3b')](_0x834d('0x3c'))){_0x2f0002['limit']=qs[_0x834d('0x25')](_0x39207f[_0x834d('0x36')][_0x834d('0x25')]);_0x2f0002['offset']=qs['offset'](_0x39207f['query']['offset']);}return _0xef670b[_0x834d('0x53')](_0x2f0002);}})[_0x834d('0x16')](function(_0x2f5e35){if(_0x2f5e35){return _0x2f5e35?{'count':_0x57859d,'rows':_0x2f5e35}:null;}})[_0x834d('0x16')](respondWithResult(_0x1f61f2,null))[_0x834d('0x1f')](handleError(_0x1f61f2,null));};exports[_0x834d('0x54')]=function(_0x178d08,_0x4a68f0,_0x36e0fe){var _0x126ed5={};var _0x4b9847={};var _0x11eb8f;var _0x5927ff;return db[_0x834d('0x44')][_0x834d('0x55')]({'where':{'id':_0x178d08['params']['id']}})[_0x834d('0x16')](handleEntityNotFound(_0x4a68f0,null))['then'](function(_0x2f8e93){if(_0x2f8e93){_0x11eb8f=_0x2f8e93;_0x4b9847[_0x834d('0x34')]=_['keys'](db[_0x834d('0x51')][_0x834d('0x30')]);_0x4b9847[_0x834d('0x36')]=_['keys'](_0x178d08[_0x834d('0x36')]);_0x4b9847[_0x834d('0x38')]=_['intersection'](_0x4b9847[_0x834d('0x34')],_0x4b9847[_0x834d('0x36')]);_0x126ed5[_0x834d('0x39')]=_[_0x834d('0x4a')](_0x4b9847[_0x834d('0x34')],qs[_0x834d('0x3a')](_0x178d08[_0x834d('0x36')][_0x834d('0x3a')]));_0x126ed5[_0x834d('0x39')]=_0x126ed5[_0x834d('0x39')]['length']?_0x126ed5[_0x834d('0x39')]:_0x4b9847['model'];_0x126ed5['order']=qs[_0x834d('0x3e')](_0x178d08['query']['sort']);_0x126ed5['where']=qs[_0x834d('0x38')](_['pick'](_0x178d08[_0x834d('0x36')],_0x4b9847[_0x834d('0x38')]));if(_0x178d08[_0x834d('0x36')][_0x834d('0x52')]){_0x126ed5[_0x834d('0x3f')]=_[_0x834d('0x42')](_0x126ed5[_0x834d('0x3f')],{'$or':_[_0x834d('0x35')](_0x126ed5[_0x834d('0x39')],function(_0x143017){var _0x19ef58={};_0x19ef58[_0x143017]={'$like':'%'+_0x178d08[_0x834d('0x36')][_0x834d('0x52')]+'%'};return _0x19ef58;})});}_0x126ed5=_[_0x834d('0x42')]({},_0x126ed5,_0x178d08['options']);return _0x11eb8f[_0x834d('0x54')](_0x126ed5);}})[_0x834d('0x16')](function(_0x92d189){if(_0x92d189){_0x5927ff=_0x92d189[_0x834d('0x4b')];if(!_0x178d08[_0x834d('0x36')][_0x834d('0x3b')](_0x834d('0x3c'))){_0x126ed5[_0x834d('0x25')]=qs['limit'](_0x178d08['query'][_0x834d('0x25')]);_0x126ed5[_0x834d('0x23')]=qs[_0x834d('0x23')](_0x178d08[_0x834d('0x36')]['offset']);}return _0x11eb8f[_0x834d('0x54')](_0x126ed5);}})['then'](function(_0xe95a54){if(_0xe95a54){return _0xe95a54?{'count':_0x5927ff,'rows':_0xe95a54}:null;}})[_0x834d('0x16')](respondWithResult(_0x4a68f0,null))[_0x834d('0x1f')](handleError(_0x4a68f0,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index d022ffd..ffc8134 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 _0xd708=['exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x5d454c,_0x227671){var _0x47ffe8=function(_0x7a5410){while(--_0x7a5410){_0x5d454c['push'](_0x5d454c['shift']());}};_0x47ffe8(++_0x227671);}(_0xd708,0x10c));var _0x8d70=function(_0x1c5145,_0x5ec47d){_0x1c5145=_0x1c5145-0x0;var _0xdbecf5=_0xd708[_0x1c5145];return _0xdbecf5;};'use strict';var _=require(_0x8d70('0x0'));var util=require(_0x8d70('0x1'));var logger=require(_0x8d70('0x2'))(_0x8d70('0x3'));var moment=require(_0x8d70('0x4'));var BPromise=require('bluebird');var rp=require(_0x8d70('0x5'));var fs=require('fs');var path=require(_0x8d70('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x8d70('0x7')]=function(_0x3320c4,_0x48a4a7){return _0x3320c4[_0x8d70('0x8')](_0x8d70('0x9'),attributes,{'tableName':_0x8d70('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a78=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x230e39,_0x5341){var _0xa804e=function(_0xe14796){while(--_0xe14796){_0x230e39['push'](_0x230e39['shift']());}};_0xa804e(++_0x5341);}(_0x1a78,0x1da));var _0x81a7=function(_0x5d7097,_0x4f7575){_0x5d7097=_0x5d7097-0x0;var _0x280bba=_0x1a78[_0x5d7097];return _0x280bba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x81a7('0x0'))(_0x81a7('0x1'));var moment=require(_0x81a7('0x2'));var BPromise=require(_0x81a7('0x3'));var rp=require(_0x81a7('0x4'));var fs=require('fs');var path=require(_0x81a7('0x5'));var rimraf=require(_0x81a7('0x6'));var config=require(_0x81a7('0x7'));var attributes=require(_0x81a7('0x8'));module[_0x81a7('0x9')]=function(_0x2a401d,_0x1e34b4){return _0x2a401d[_0x81a7('0xa')](_0x81a7('0xb'),attributes,{'tableName':_0x81a7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index ec2731e..6e8f323 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 _0x49f6=['rpc','../../config/environment','jayson/promise','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x388bea,_0x11c3f0){var _0x352e95=function(_0x6cfd9){while(--_0x6cfd9){_0x388bea['push'](_0x388bea['shift']());}};_0x352e95(++_0x11c3f0);}(_0x49f6,0x135));var _0x649f=function(_0x7dbf60,_0x4b8652){_0x7dbf60=_0x7dbf60-0x0;var _0xcd57c=_0x49f6[_0x7dbf60];return _0xcd57c;};'use strict';var _=require(_0x649f('0x0'));var util=require('util');var moment=require(_0x649f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x649f('0x2'));var db=require(_0x649f('0x3'))['db'];var utils=require(_0x649f('0x4'));var logger=require(_0x649f('0x5'))(_0x649f('0x6'));var config=require(_0x649f('0x7'));var jayson=require(_0x649f('0x8'));var client=jayson[_0x649f('0x9')][_0x649f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x547175,_0x31f48b,_0x1e1231){return new BPromise(function(_0x261873,_0x555775){return client['request'](_0x547175,_0x1e1231)[_0x649f('0xb')](function(_0x57387e){logger[_0x649f('0xc')](_0x649f('0xd'),_0x31f48b,_0x649f('0xe'));logger['debug'](_0x649f('0xf'),_0x31f48b,_0x649f('0xe'),JSON[_0x649f('0x10')](_0x57387e));if(_0x57387e[_0x649f('0x11')]){if(_0x57387e[_0x649f('0x11')]['code']===0x1f4){logger[_0x649f('0x11')](_0x649f('0xd'),_0x31f48b,_0x57387e[_0x649f('0x11')][_0x649f('0x12')]);return _0x555775(_0x57387e['error'][_0x649f('0x12')]);}logger[_0x649f('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x31f48b,_0x57387e['error']['message']);return _0x261873(_0x57387e[_0x649f('0x11')][_0x649f('0x12')]);}else{logger['info'](_0x649f('0xd'),_0x31f48b,'request\x20sent');_0x261873(_0x57387e[_0x649f('0x13')][_0x649f('0x12')]);}})[_0x649f('0x14')](function(_0x1ac166){logger[_0x649f('0x11')](_0x649f('0xd'),_0x31f48b,_0x1ac166);_0x555775(_0x1ac166);});});} \ No newline at end of file +var _0x34f5=['SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x209b0a,_0x12fef1){var _0x20db2f=function(_0x38c34){while(--_0x38c34){_0x209b0a['push'](_0x209b0a['shift']());}};_0x20db2f(++_0x12fef1);}(_0x34f5,0xfe));var _0x534f=function(_0x4aa1df,_0x215aad){_0x4aa1df=_0x4aa1df-0x0;var _0x58e374=_0x34f5[_0x4aa1df];return _0x58e374;};'use strict';var _=require(_0x534f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x534f('0x1'));var rs=require(_0x534f('0x2'));var fs=require('fs');var Redis=require(_0x534f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x534f('0x4'));var logger=require('../../config/logger')(_0x534f('0x5'));var config=require(_0x534f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x534f('0x7')][_0x534f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b5321,_0x231b08,_0x401dd8){return new BPromise(function(_0x4bb9e2,_0x224369){return client[_0x534f('0x9')](_0x5b5321,_0x401dd8)[_0x534f('0xa')](function(_0x4c3aee){logger[_0x534f('0xb')](_0x534f('0xc'),_0x231b08,_0x534f('0xd'));logger['debug'](_0x534f('0xe'),_0x231b08,_0x534f('0xd'),JSON['stringify'](_0x4c3aee));if(_0x4c3aee[_0x534f('0xf')]){if(_0x4c3aee['error'][_0x534f('0x10')]===0x1f4){logger[_0x534f('0xf')](_0x534f('0xc'),_0x231b08,_0x4c3aee['error'][_0x534f('0x11')]);return _0x224369(_0x4c3aee['error'][_0x534f('0x11')]);}logger['error'](_0x534f('0xc'),_0x231b08,_0x4c3aee['error'][_0x534f('0x11')]);return _0x4bb9e2(_0x4c3aee[_0x534f('0xf')][_0x534f('0x11')]);}else{logger[_0x534f('0xb')](_0x534f('0xc'),_0x231b08,_0x534f('0xd'));_0x4bb9e2(_0x4c3aee['result']['message']);}})[_0x534f('0x12')](function(_0x156395){logger[_0x534f('0xf')](_0x534f('0xc'),_0x231b08,_0x156395);_0x224369(_0x156395);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index af4f4cc..c76822f 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 _0x2743=['util','path','fs-extra','../../components/interaction/service','./intSugarcrmField.controller','isAuthenticated','index','get','show','create','/:id','delete','destroy','exports','multer'];(function(_0x559cc4,_0x12334c){var _0x49be10=function(_0x115f8f){while(--_0x115f8f){_0x559cc4['push'](_0x559cc4['shift']());}};_0x49be10(++_0x12334c);}(_0x2743,0x176));var _0x3274=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2743[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3274('0x0'));var util=require(_0x3274('0x1'));var path=require(_0x3274('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x3274('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3274('0x4'));var config=require('../../config/environment');var controller=require(_0x3274('0x5'));router['get']('/',auth[_0x3274('0x6')](),controller[_0x3274('0x7')]);router[_0x3274('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3274('0x9')]);router['post']('/',auth[_0x3274('0x6')](),controller[_0x3274('0xa')]);router['put'](_0x3274('0xb'),auth[_0x3274('0x6')](),controller['update']);router[_0x3274('0xc')](_0x3274('0xb'),auth[_0x3274('0x6')](),controller[_0x3274('0xd')]);module[_0x3274('0xe')]=router; \ No newline at end of file +var _0x5199=['./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3edd2d,_0x91dcb2){var _0x4e5484=function(_0x5c7099){while(--_0x5c7099){_0x3edd2d['push'](_0x3edd2d['shift']());}};_0x4e5484(++_0x91dcb2);}(_0x5199,0x115));var _0x9519=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5199[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x9519('0x0'));var util=require(_0x9519('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9519('0x2'));var router=express[_0x9519('0x3')]();var fs_extra=require(_0x9519('0x4'));var auth=require(_0x9519('0x5'));var interaction=require(_0x9519('0x6'));var config=require(_0x9519('0x7'));var controller=require(_0x9519('0x8'));router[_0x9519('0x9')]('/',auth[_0x9519('0xa')](),controller[_0x9519('0xb')]);router[_0x9519('0x9')](_0x9519('0xc'),auth[_0x9519('0xa')](),controller[_0x9519('0xd')]);router[_0x9519('0xe')]('/',auth[_0x9519('0xa')](),controller['create']);router[_0x9519('0xf')](_0x9519('0xc'),auth[_0x9519('0xa')](),controller[_0x9519('0x10')]);router[_0x9519('0x11')](_0x9519('0xc'),auth[_0x9519('0xa')](),controller['destroy']);module[_0x9519('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 1d9406a..8ee40fb 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 _0x5712=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x4cf92e,_0x572955){var _0x3fcc29=function(_0x248cb3){while(--_0x248cb3){_0x4cf92e['push'](_0x4cf92e['shift']());}};_0x3fcc29(++_0x572955);}(_0x5712,0x140));var _0x2571=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5712[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x2571('0x0'));module[_0x2571('0x1')]={'type':{'type':Sequelize[_0x2571('0x2')](_0x2571('0x3'),_0x2571('0x4'),_0x2571('0x5'),_0x2571('0x6'),_0x2571('0x7')),'defaultValue':_0x2571('0x3')},'content':{'type':Sequelize[_0x2571('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x2571('0x3'),'variable',_0x2571('0x5'))},'keyContent':{'type':Sequelize[_0x2571('0x8')]},'idField':{'type':Sequelize[_0x2571('0x8')]},'nameField':{'type':Sequelize[_0x2571('0x8')]},'customField':{'type':Sequelize[_0x2571('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2571('0x8')]}}; \ No newline at end of file +var _0x495e=['STRING','ENUM','BOOLEAN','sequelize','string','variable','customVariable','keyValue'];(function(_0x2bb3f6,_0x25fde0){var _0x62b339=function(_0x53e014){while(--_0x53e014){_0x2bb3f6['push'](_0x2bb3f6['shift']());}};_0x62b339(++_0x25fde0);}(_0x495e,0xfb));var _0xe495=function(_0xaaf2e2,_0x19d28a){_0xaaf2e2=_0xaaf2e2-0x0;var _0x28bc36=_0x495e[_0xaaf2e2];return _0x28bc36;};'use strict';var Sequelize=require(_0xe495('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xe495('0x1'),_0xe495('0x2'),_0xe495('0x3'),_0xe495('0x4'),'picklist'),'defaultValue':_0xe495('0x1')},'content':{'type':Sequelize[_0xe495('0x5')]},'key':{'type':Sequelize[_0xe495('0x5')]},'keyType':{'type':Sequelize[_0xe495('0x6')](_0xe495('0x1'),_0xe495('0x2'),_0xe495('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe495('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 95fcc96..ca44b42 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 _0x9a19=['../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','send','map','SugarcrmField','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x5472c4,_0xff473e){var _0x1d092a=function(_0x17ff54){while(--_0x17ff54){_0x5472c4['push'](_0x5472c4['shift']());}};_0x1d092a(++_0xff473e);}(_0x9a19,0x114));var _0x99a1=function(_0x2132a3,_0x4639e9){_0x2132a3=_0x2132a3-0x0;var _0x21890c=_0x9a19[_0x2132a3];return _0x21890c;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0x3c813,_0x491341){return function(_0x4fe7f7){if(!_0x4fe7f7){_0x3c813[_0x99a1('0x19')](0x194);}return _0x4fe7f7;};}function handleError(_0x5dabd9,_0x5dc733){_0x5dc733=_0x5dc733||0x1f4;return function(_0xafea84){logger[_0x99a1('0x25')](_0xafea84[_0x99a1('0x26')]);if(_0xafea84[_0x99a1('0x27')]){delete _0xafea84[_0x99a1('0x27')];}_0x5dabd9[_0x99a1('0x1a')](_0x5dc733)[_0x99a1('0x28')](_0xafea84);};}exports['index']=function(_0xf41b0d,_0x499eef){var _0x255197={},_0x1137f2={},_0x26fbae={'count':0x0,'rows':[]};var _0x523668=_[_0x99a1('0x29')](db[_0x99a1('0x2a')]['rawAttributes'],function(_0x37514e){return{'name':_0x37514e[_0x99a1('0x2b')],'type':_0x37514e[_0x99a1('0x2c')][_0x99a1('0x2d')]};});_0x1137f2[_0x99a1('0x2e')]=_[_0x99a1('0x29')](_0x523668,_0x99a1('0x27'));_0x1137f2[_0x99a1('0x2f')]=_['keys'](_0xf41b0d['query']);_0x1137f2[_0x99a1('0x30')]=_['intersection'](_0x1137f2[_0x99a1('0x2e')],_0x1137f2[_0x99a1('0x2f')]);_0x255197['attributes']=_[_0x99a1('0x31')](_0x1137f2[_0x99a1('0x2e')],qs[_0x99a1('0x32')](_0xf41b0d[_0x99a1('0x2f')][_0x99a1('0x32')]));_0x255197[_0x99a1('0x33')]=_0x255197[_0x99a1('0x33')][_0x99a1('0x34')]?_0x255197[_0x99a1('0x33')]:_0x1137f2[_0x99a1('0x2e')];if(!_0xf41b0d[_0x99a1('0x2f')][_0x99a1('0x35')](_0x99a1('0x36'))){_0x255197[_0x99a1('0x1e')]=qs['limit'](_0xf41b0d['query'][_0x99a1('0x1e')]);_0x255197[_0x99a1('0x1c')]=qs[_0x99a1('0x1c')](_0xf41b0d[_0x99a1('0x2f')][_0x99a1('0x1c')]);}_0x255197[_0x99a1('0x37')]=qs[_0x99a1('0x38')](_0xf41b0d['query'][_0x99a1('0x38')]);_0x255197[_0x99a1('0x39')]=qs['filters'](_[_0x99a1('0x3a')](_0xf41b0d[_0x99a1('0x2f')],_0x1137f2[_0x99a1('0x30')]),_0x523668);if(_0xf41b0d[_0x99a1('0x2f')][_0x99a1('0x3b')]){_0x255197[_0x99a1('0x39')]=_[_0x99a1('0x3c')](_0x255197[_0x99a1('0x39')],{'$or':_[_0x99a1('0x29')](_0x523668,function(_0x17bb50){if(_0x17bb50[_0x99a1('0x2c')]!==_0x99a1('0x3d')){var _0x1f224c={};_0x1f224c[_0x17bb50['name']]={'$like':'%'+_0xf41b0d['query']['filter']+'%'};return _0x1f224c;}})});}_0x255197=_[_0x99a1('0x3c')]({},_0x255197,_0xf41b0d[_0x99a1('0x3e')]);var _0x1d3f85={'where':_0x255197[_0x99a1('0x39')]};return db[_0x99a1('0x2a')]['count'](_0x1d3f85)[_0x99a1('0x23')](function(_0x173d7f){_0x26fbae[_0x99a1('0x1f')]=_0x173d7f;if(_0xf41b0d['query']['includeAll']){_0x255197[_0x99a1('0x3f')]=[{'all':!![]}];}return db[_0x99a1('0x2a')][_0x99a1('0x40')](_0x255197);})['then'](function(_0x6c4cb){_0x26fbae[_0x99a1('0x41')]=_0x6c4cb;return _0x26fbae;})[_0x99a1('0x23')](respondWithFilteredResult(_0x499eef,_0x255197))[_0x99a1('0x42')](handleError(_0x499eef,null));};exports[_0x99a1('0x43')]=function(_0x376b95,_0x8b49a6){var _0x29d0a0={'raw':!![],'where':{'id':_0x376b95[_0x99a1('0x44')]['id']}},_0x1c4ce4={};_0x1c4ce4['model']=_[_0x99a1('0x45')](db[_0x99a1('0x2a')][_0x99a1('0x46')]);_0x1c4ce4['query']=_[_0x99a1('0x45')](_0x376b95['query']);_0x1c4ce4[_0x99a1('0x30')]=_[_0x99a1('0x31')](_0x1c4ce4[_0x99a1('0x2e')],_0x1c4ce4[_0x99a1('0x2f')]);_0x29d0a0[_0x99a1('0x33')]=_[_0x99a1('0x31')](_0x1c4ce4['model'],qs[_0x99a1('0x32')](_0x376b95['query'][_0x99a1('0x32')]));_0x29d0a0[_0x99a1('0x33')]=_0x29d0a0[_0x99a1('0x33')][_0x99a1('0x34')]?_0x29d0a0[_0x99a1('0x33')]:_0x1c4ce4[_0x99a1('0x2e')];if(_0x376b95[_0x99a1('0x2f')][_0x99a1('0x47')]){_0x29d0a0[_0x99a1('0x3f')]=[{'all':!![]}];}_0x29d0a0=_[_0x99a1('0x3c')]({},_0x29d0a0,_0x376b95[_0x99a1('0x3e')]);return db['SugarcrmField'][_0x99a1('0x48')](_0x29d0a0)[_0x99a1('0x23')](handleEntityNotFound(_0x8b49a6,null))['then'](respondWithResult(_0x8b49a6,null))[_0x99a1('0x42')](handleError(_0x8b49a6,null));};exports[_0x99a1('0x49')]=function(_0x3e35fb,_0x2e377b){return db[_0x99a1('0x2a')][_0x99a1('0x49')](_0x3e35fb[_0x99a1('0x4a')],{})['then'](respondWithResult(_0x2e377b,0xc9))[_0x99a1('0x42')](handleError(_0x2e377b,null));};exports['update']=function(_0x1d4d3f,_0x269798){if(_0x1d4d3f['body']['id']){delete _0x1d4d3f['body']['id'];}return db[_0x99a1('0x2a')][_0x99a1('0x48')]({'where':{'id':_0x1d4d3f[_0x99a1('0x44')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x269798,null))[_0x99a1('0x23')](saveUpdates(_0x1d4d3f['body'],null))['then'](respondWithResult(_0x269798,null))['catch'](handleError(_0x269798,null));};exports[_0x99a1('0x24')]=function(_0x4ae90e,_0x463e49){return db[_0x99a1('0x2a')][_0x99a1('0x48')]({'where':{'id':_0x4ae90e[_0x99a1('0x44')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x463e49,null))['then'](removeEntity(_0x463e49,null))[_0x99a1('0x42')](handleError(_0x463e49,null));}; \ No newline at end of file +var _0xf021=['lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','limit','reject','save','update','then','error','stack','name','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','count','includeAll','include','rows','catch','show','params','keys','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs'];(function(_0x462ed1,_0x18b3a7){var _0x3337e1=function(_0x3d13ad){while(--_0x3d13ad){_0x462ed1['push'](_0x462ed1['shift']());}};_0x3337e1(++_0x18b3a7);}(_0xf021,0x18f));var _0x1f02=function(_0x5b57ae,_0x31bac6){_0x5b57ae=_0x5b57ae-0x0;var _0x1877c2=_0xf021[_0x5b57ae];return _0x1877c2;};'use strict';var emlformat=require(_0x1f02('0x0'));var rimraf=require(_0x1f02('0x1'));var zipdir=require(_0x1f02('0x2'));var jsonpatch=require(_0x1f02('0x3'));var rp=require(_0x1f02('0x4'));var moment=require('moment');var BPromise=require(_0x1f02('0x5'));var Mustache=require('mustache');var util=require(_0x1f02('0x6'));var path=require(_0x1f02('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1f02('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f02('0x9'));var squel=require(_0x1f02('0xa'));var crypto=require(_0x1f02('0xb'));var jsforce=require(_0x1f02('0xc'));var deskjs=require(_0x1f02('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1f02('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1f02('0xf'));var as=require(_0x1f02('0x10'));var hardwareService=require(_0x1f02('0x11'));var logger=require(_0x1f02('0x12'))(_0x1f02('0x13'));var utils=require('../../config/utils');var config=require(_0x1f02('0x14'));var licenseUtil=require(_0x1f02('0x15'));var db=require(_0x1f02('0x16'))['db'];function respondWithStatusCode(_0x56a2c2,_0x24e9b8){_0x24e9b8=_0x24e9b8||0xcc;return function(_0x1ac6eb){if(_0x1ac6eb){return _0x56a2c2[_0x1f02('0x17')](_0x24e9b8);}return _0x56a2c2['status'](_0x24e9b8)['end']();};}function respondWithResult(_0x4974bd,_0x11ba7e){_0x11ba7e=_0x11ba7e||0xc8;return function(_0x2c08ad){if(_0x2c08ad){return _0x4974bd[_0x1f02('0x18')](_0x11ba7e)[_0x1f02('0x19')](_0x2c08ad);}};}function respondWithFilteredResult(_0x1c16ce,_0x45bae1){return function(_0x440328){if(_0x440328){var _0x3b0a3d=typeof _0x45bae1['offset']===_0x1f02('0x1a')&&typeof _0x45bae1['limit']==='undefined';var _0x4a66a5=_0x440328['count'];var _0x4d1e4f=_0x3b0a3d?0x0:_0x45bae1[_0x1f02('0x1b')];var _0x3033a2=_0x3b0a3d?_0x440328['count']:_0x45bae1[_0x1f02('0x1b')]+_0x45bae1[_0x1f02('0x1c')];var _0x356444;if(_0x3033a2>=_0x4a66a5){_0x3033a2=_0x4a66a5;_0x356444=0xc8;}else{_0x356444=0xce;}_0x1c16ce[_0x1f02('0x18')](_0x356444);return _0x1c16ce['set']('Content-Range',_0x4d1e4f+'-'+_0x3033a2+'/'+_0x4a66a5)[_0x1f02('0x19')](_0x440328);}return null;};}function patchUpdates(_0x37393a){return function(_0x5e78c2){try{jsonpatch['apply'](_0x5e78c2,_0x37393a,!![]);}catch(_0x339c29){return BPromise[_0x1f02('0x1d')](_0x339c29);}return _0x5e78c2[_0x1f02('0x1e')]();};}function saveUpdates(_0xbabbd7,_0x480297){return function(_0x12c4af){if(_0x12c4af){return _0x12c4af[_0x1f02('0x1f')](_0xbabbd7)[_0x1f02('0x20')](function(_0x2f422c){return _0x2f422c;});}return null;};}function removeEntity(_0x43b3e7,_0x134398){return function(_0x1328ea){if(_0x1328ea){return _0x1328ea['destroy']()[_0x1f02('0x20')](function(){_0x43b3e7[_0x1f02('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25a8d1,_0x43db49){return function(_0x575a86){if(!_0x575a86){_0x25a8d1['sendStatus'](0x194);}return _0x575a86;};}function handleError(_0x3f7426,_0x36c8c1){_0x36c8c1=_0x36c8c1||0x1f4;return function(_0x3c3fda){logger[_0x1f02('0x21')](_0x3c3fda[_0x1f02('0x22')]);if(_0x3c3fda[_0x1f02('0x23')]){delete _0x3c3fda[_0x1f02('0x23')];}_0x3f7426['status'](_0x36c8c1)['send'](_0x3c3fda);};}exports['index']=function(_0x3ef4bf,_0x1d380a){var _0x23059a={},_0x496afd={},_0x5c2c42={'count':0x0,'rows':[]};var _0x227567=_[_0x1f02('0x24')](db[_0x1f02('0x25')][_0x1f02('0x26')],function(_0x220345){return{'name':_0x220345[_0x1f02('0x27')],'type':_0x220345[_0x1f02('0x28')][_0x1f02('0x29')]};});_0x496afd[_0x1f02('0x2a')]=_[_0x1f02('0x24')](_0x227567,'name');_0x496afd[_0x1f02('0x2b')]=_['keys'](_0x3ef4bf[_0x1f02('0x2b')]);_0x496afd[_0x1f02('0x2c')]=_[_0x1f02('0x2d')](_0x496afd[_0x1f02('0x2a')],_0x496afd[_0x1f02('0x2b')]);_0x23059a[_0x1f02('0x2e')]=_['intersection'](_0x496afd['model'],qs[_0x1f02('0x2f')](_0x3ef4bf[_0x1f02('0x2b')]['fields']));_0x23059a[_0x1f02('0x2e')]=_0x23059a['attributes'][_0x1f02('0x30')]?_0x23059a['attributes']:_0x496afd[_0x1f02('0x2a')];if(!_0x3ef4bf['query']['hasOwnProperty'](_0x1f02('0x31'))){_0x23059a[_0x1f02('0x1c')]=qs[_0x1f02('0x1c')](_0x3ef4bf[_0x1f02('0x2b')]['limit']);_0x23059a[_0x1f02('0x1b')]=qs[_0x1f02('0x1b')](_0x3ef4bf[_0x1f02('0x2b')]['offset']);}_0x23059a[_0x1f02('0x32')]=qs[_0x1f02('0x33')](_0x3ef4bf[_0x1f02('0x2b')][_0x1f02('0x33')]);_0x23059a[_0x1f02('0x34')]=qs[_0x1f02('0x2c')](_['pick'](_0x3ef4bf[_0x1f02('0x2b')],_0x496afd[_0x1f02('0x2c')]),_0x227567);if(_0x3ef4bf[_0x1f02('0x2b')]['filter']){_0x23059a[_0x1f02('0x34')]=_['merge'](_0x23059a[_0x1f02('0x34')],{'$or':_['map'](_0x227567,function(_0x554665){if(_0x554665[_0x1f02('0x28')]!=='VIRTUAL'){var _0x591a1c={};_0x591a1c[_0x554665[_0x1f02('0x23')]]={'$like':'%'+_0x3ef4bf[_0x1f02('0x2b')][_0x1f02('0x35')]+'%'};return _0x591a1c;}})});}_0x23059a=_[_0x1f02('0x36')]({},_0x23059a,_0x3ef4bf['options']);var _0x2b48a3={'where':_0x23059a['where']};return db[_0x1f02('0x25')][_0x1f02('0x37')](_0x2b48a3)[_0x1f02('0x20')](function(_0x43e7bf){_0x5c2c42[_0x1f02('0x37')]=_0x43e7bf;if(_0x3ef4bf[_0x1f02('0x2b')][_0x1f02('0x38')]){_0x23059a[_0x1f02('0x39')]=[{'all':!![]}];}return db[_0x1f02('0x25')]['findAll'](_0x23059a);})[_0x1f02('0x20')](function(_0x5aab10){_0x5c2c42[_0x1f02('0x3a')]=_0x5aab10;return _0x5c2c42;})['then'](respondWithFilteredResult(_0x1d380a,_0x23059a))[_0x1f02('0x3b')](handleError(_0x1d380a,null));};exports[_0x1f02('0x3c')]=function(_0x1c7182,_0x5b15be){var _0x5938e1={'raw':!![],'where':{'id':_0x1c7182[_0x1f02('0x3d')]['id']}},_0x1c3f09={};_0x1c3f09[_0x1f02('0x2a')]=_[_0x1f02('0x3e')](db[_0x1f02('0x25')][_0x1f02('0x26')]);_0x1c3f09[_0x1f02('0x2b')]=_[_0x1f02('0x3e')](_0x1c7182[_0x1f02('0x2b')]);_0x1c3f09['filters']=_[_0x1f02('0x2d')](_0x1c3f09['model'],_0x1c3f09['query']);_0x5938e1[_0x1f02('0x2e')]=_['intersection'](_0x1c3f09['model'],qs[_0x1f02('0x2f')](_0x1c7182['query']['fields']));_0x5938e1[_0x1f02('0x2e')]=_0x5938e1[_0x1f02('0x2e')]['length']?_0x5938e1[_0x1f02('0x2e')]:_0x1c3f09[_0x1f02('0x2a')];if(_0x1c7182[_0x1f02('0x2b')][_0x1f02('0x38')]){_0x5938e1['include']=[{'all':!![]}];}_0x5938e1=_[_0x1f02('0x36')]({},_0x5938e1,_0x1c7182[_0x1f02('0x3f')]);return db[_0x1f02('0x25')][_0x1f02('0x40')](_0x5938e1)[_0x1f02('0x20')](handleEntityNotFound(_0x5b15be,null))[_0x1f02('0x20')](respondWithResult(_0x5b15be,null))[_0x1f02('0x3b')](handleError(_0x5b15be,null));};exports[_0x1f02('0x41')]=function(_0x16bec7,_0x282e5b){return db[_0x1f02('0x25')][_0x1f02('0x41')](_0x16bec7[_0x1f02('0x42')],{})[_0x1f02('0x20')](respondWithResult(_0x282e5b,0xc9))['catch'](handleError(_0x282e5b,null));};exports[_0x1f02('0x1f')]=function(_0x50d5ed,_0x37759d){if(_0x50d5ed['body']['id']){delete _0x50d5ed[_0x1f02('0x42')]['id'];}return db[_0x1f02('0x25')][_0x1f02('0x40')]({'where':{'id':_0x50d5ed[_0x1f02('0x3d')]['id']}})[_0x1f02('0x20')](handleEntityNotFound(_0x37759d,null))[_0x1f02('0x20')](saveUpdates(_0x50d5ed[_0x1f02('0x42')],null))[_0x1f02('0x20')](respondWithResult(_0x37759d,null))[_0x1f02('0x3b')](handleError(_0x37759d,null));};exports[_0x1f02('0x43')]=function(_0x1241c5,_0x5792d8){return db[_0x1f02('0x25')][_0x1f02('0x40')]({'where':{'id':_0x1241c5[_0x1f02('0x3d')]['id']}})[_0x1f02('0x20')](handleEntityNotFound(_0x5792d8,null))[_0x1f02('0x20')](removeEntity(_0x5792d8,null))[_0x1f02('0x3b')](handleError(_0x5792d8,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 84c9a58..4720eef 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 _0x2fab=['rimraf','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','FieldId','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x2fab,0xbd));var _0xb2fa=function(_0x49b8b5,_0x30fd7a){_0x49b8b5=_0x49b8b5-0x0;var _0x5a99dd=_0x2fab[_0x49b8b5];return _0x5a99dd;};'use strict';var _=require(_0xb2fa('0x0'));var util=require('util');var logger=require(_0xb2fa('0x1'))(_0xb2fa('0x2'));var moment=require(_0xb2fa('0x3'));var BPromise=require(_0xb2fa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2fa('0x5'));var rimraf=require(_0xb2fa('0x6'));var config=require(_0xb2fa('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0xb2fa('0x8')]=function(_0x3c2df2,_0x1c2587){return _0x3c2df2[_0xb2fa('0x9')](_0xb2fa('0xa'),attributes,{'tableName':_0xb2fa('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0xb2fa('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f15=['./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x272376,_0x18e088){var _0x10b72c=function(_0x1509b1){while(--_0x1509b1){_0x272376['push'](_0x272376['shift']());}};_0x10b72c(++_0x18e088);}(_0x4f15,0x1c1));var _0x54f1=function(_0x384c3c,_0x43c1c0){_0x384c3c=_0x384c3c-0x0;var _0x3edf2e=_0x4f15[_0x384c3c];return _0x3edf2e;};'use strict';var _=require(_0x54f1('0x0'));var util=require(_0x54f1('0x1'));var logger=require(_0x54f1('0x2'))(_0x54f1('0x3'));var moment=require(_0x54f1('0x4'));var BPromise=require(_0x54f1('0x5'));var rp=require(_0x54f1('0x6'));var fs=require('fs');var path=require(_0x54f1('0x7'));var rimraf=require(_0x54f1('0x8'));var config=require(_0x54f1('0x9'));var attributes=require(_0x54f1('0xa'));module[_0x54f1('0xb')]=function(_0x3f6509,_0x5a17ed){return _0x3f6509[_0x54f1('0xc')](_0x54f1('0xd'),attributes,{'tableName':_0x54f1('0xe'),'paranoid':![],'indexes':[{'name':_0x54f1('0xf'),'fields':['idField',_0x54f1('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 5acaee9..dc4b20c 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 _0x0b0e=['SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug'];(function(_0x1c289a,_0x277fe7){var _0x28d68e=function(_0x2f8e98){while(--_0x2f8e98){_0x1c289a['push'](_0x1c289a['shift']());}};_0x28d68e(++_0x277fe7);}(_0x0b0e,0x187));var _0xe0b0=function(_0x166e96,_0x55191d){_0x166e96=_0x166e96-0x0;var _0x553d73=_0x0b0e[_0x166e96];return _0x553d73;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x3fcfa4,_0x3b6fb7){var _0x40ecea=function(_0x4205bc){while(--_0x4205bc){_0x3fcfa4['push'](_0x3fcfa4['shift']());}};_0x40ecea(++_0x3b6fb7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 9a925b8..adc85f1 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 _0x1159=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','post','create','addConfiguration','put','update','delete'];(function(_0x41e18c,_0x11d953){var _0x52de75=function(_0xc8dd00){while(--_0xc8dd00){_0x41e18c['push'](_0x41e18c['shift']());}};_0x52de75(++_0x11d953);}(_0x1159,0xf3));var _0x9115=function(_0x2d83b3,_0x22a180){_0x2d83b3=_0x2d83b3-0x0;var _0x44bc17=_0x1159[_0x2d83b3];return _0x44bc17;};'use strict';var multer=require(_0x9115('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9115('0x1'));var express=require(_0x9115('0x2'));var router=express[_0x9115('0x3')]();var fs_extra=require(_0x9115('0x4'));var auth=require(_0x9115('0x5'));var interaction=require(_0x9115('0x6'));var config=require(_0x9115('0x7'));var controller=require(_0x9115('0x8'));router['get']('/',auth[_0x9115('0x9')](),controller[_0x9115('0xa')]);router[_0x9115('0xb')](_0x9115('0xc'),auth[_0x9115('0x9')](),controller[_0x9115('0xd')]);router[_0x9115('0xb')]('/:id/configurations',auth[_0x9115('0x9')](),controller[_0x9115('0xe')]);router['get']('/:id/fields',auth[_0x9115('0x9')](),controller['getFields']);router[_0x9115('0xf')]('/',auth[_0x9115('0x9')](),controller[_0x9115('0x10')]);router[_0x9115('0xf')]('/:id/configurations',auth[_0x9115('0x9')](),controller[_0x9115('0x11')]);router[_0x9115('0x12')](_0x9115('0xc'),auth[_0x9115('0x9')](),controller[_0x9115('0x13')]);router[_0x9115('0x14')](_0x9115('0xc'),auth[_0x9115('0x9')](),controller['destroy']);module[_0x9115('0x15')]=router; \ No newline at end of file +var _0x741c=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','/:id','update','delete'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x741c,0x98));var _0xc741=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x741c[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express['Router']();var fs_extra=require(_0xc741('0x5'));var auth=require(_0xc741('0x6'));var interaction=require(_0xc741('0x7'));var config=require(_0xc741('0x8'));var controller=require('./intVtigerAccount.controller');router[_0xc741('0x9')]('/',auth[_0xc741('0xa')](),controller[_0xc741('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc741('0xc')]);router[_0xc741('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xc741('0xd')]);router[_0xc741('0x9')](_0xc741('0xe'),auth[_0xc741('0xa')](),controller[_0xc741('0xf')]);router[_0xc741('0x10')]('/',auth['isAuthenticated'](),controller[_0xc741('0x11')]);router[_0xc741('0x10')](_0xc741('0x12'),auth[_0xc741('0xa')](),controller['addConfiguration']);router[_0xc741('0x13')](_0xc741('0x14'),auth[_0xc741('0xa')](),controller[_0xc741('0x15')]);router[_0xc741('0x16')](_0xc741('0x14'),auth[_0xc741('0xa')](),controller[_0xc741('0x17')]);module[_0xc741('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index bc9fee1..a758947 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 _0xe1e4=['STRING','HelpDesk','sequelize','exports'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xe1e4,0x18e));var _0x4e1e=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe1e4[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x4e1e('0x0'));module[_0x4e1e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4e1e('0x2')]},'username':{'type':Sequelize[_0x4e1e('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4e1e('0x2')],'allowNull':![],'defaultValue':_0x4e1e('0x3')},'remoteUri':{'type':Sequelize[_0x4e1e('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4e1e('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x4e1e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0683=['exports','STRING','HelpDesk'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0683,0xe1));var _0x3068=function(_0xf094a0,_0x5774cd){_0xf094a0=_0xf094a0-0x0;var _0x1bf5ce=_0x0683[_0xf094a0];return _0x1bf5ce;};'use strict';var Sequelize=require('sequelize');module[_0x3068('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x3068('0x1')]},'username':{'type':Sequelize[_0x3068('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3068('0x2')},'remoteUri':{'type':Sequelize[_0x3068('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x3068('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3068('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index f4382ac..5d83306 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 _0x0713=['VtigerAccount','includeAll','include','findAll','params','keys','length','find','create','body','getConfigurations','findOne','VtigerConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','remoteUri','accessKey','moduleName','slice','lastIndexOf','format','GET','getchallenge','login','token','success','describe','sessionName','autogenerated','reference','owner','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','stack','name','send','index','map','rawAttributes','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options'];(function(_0x5d7f49,_0x5b4580){var _0x119a7b=function(_0x53747d){while(--_0x53747d){_0x5d7f49['push'](_0x5d7f49['shift']());}};_0x119a7b(++_0x5b4580);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));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('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x3071('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31c220,_0x44fbae,_0x5d4883,_0x104e73){return new BPromise(function(_0x4e1219,_0x2fc15d){var _0x45c93b=_0x104e73||client;return _0x45c93b[_0x3071('0x1c')](_0x31c220,_0x5d4883)[_0x3071('0x1d')](function(_0x1caa5d){logger[_0x3071('0x1e')](_0x3071('0x1f'),_0x44fbae,_0x3071('0x20'));logger[_0x3071('0x21')](_0x3071('0x22'),_0x44fbae,'request\x20sent',JSON[_0x3071('0x23')](_0x1caa5d));if(_0x1caa5d[_0x3071('0x24')]){if(_0x1caa5d[_0x3071('0x24')][_0x3071('0x25')]===0x1f4){logger[_0x3071('0x24')](_0x3071('0x1f'),_0x44fbae,_0x1caa5d[_0x3071('0x24')][_0x3071('0x26')]);return _0x2fc15d(_0x1caa5d['error'][_0x3071('0x26')]);}logger[_0x3071('0x24')](_0x3071('0x1f'),_0x44fbae,_0x1caa5d['error'][_0x3071('0x26')]);return _0x4e1219(_0x1caa5d['error'][_0x3071('0x26')]);}else{logger[_0x3071('0x1e')](_0x3071('0x1f'),_0x44fbae,_0x3071('0x20'));_0x4e1219(_0x1caa5d[_0x3071('0x27')][_0x3071('0x26')]);}})[_0x3071('0x28')](function(_0x211b4f){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x44fbae,_0x211b4f);_0x2fc15d(_0x211b4f);});});}function respondWithStatusCode(_0x2ce48a,_0xb05b1d){_0xb05b1d=_0xb05b1d||0xcc;return function(_0x412652){if(_0x412652){return _0x2ce48a[_0x3071('0x29')](_0xb05b1d);}return _0x2ce48a[_0x3071('0x2a')](_0xb05b1d)[_0x3071('0x2b')]();};}function respondWithResult(_0x7a4cb4,_0x1fe727){_0x1fe727=_0x1fe727||0xc8;return function(_0x1de5fb){if(_0x1de5fb){return _0x7a4cb4['status'](_0x1fe727)[_0x3071('0x2c')](_0x1de5fb);}};}function respondWithFilteredResult(_0x3f1e6e,_0x177138){return function(_0x4d5c4b){if(_0x4d5c4b){var _0x4fb1ca=typeof _0x177138[_0x3071('0x2d')]===_0x3071('0x2e')&&typeof _0x177138[_0x3071('0x2f')]===_0x3071('0x2e');var _0x25b96b=_0x4d5c4b[_0x3071('0x30')];var _0x3921a1=_0x4fb1ca?0x0:_0x177138[_0x3071('0x2d')];var _0x292205=_0x4fb1ca?_0x4d5c4b[_0x3071('0x30')]:_0x177138['offset']+_0x177138['limit'];var _0x9e26d1;if(_0x292205>=_0x25b96b){_0x292205=_0x25b96b;_0x9e26d1=0xc8;}else{_0x9e26d1=0xce;}_0x3f1e6e[_0x3071('0x2a')](_0x9e26d1);return _0x3f1e6e[_0x3071('0x31')](_0x3071('0x32'),_0x3921a1+'-'+_0x292205+'/'+_0x25b96b)[_0x3071('0x2c')](_0x4d5c4b);}return null;};}function patchUpdates(_0x29538c){return function(_0x32b6b1){try{jsonpatch[_0x3071('0x33')](_0x32b6b1,_0x29538c,!![]);}catch(_0x53709a){return BPromise['reject'](_0x53709a);}return _0x32b6b1['save']();};}function saveUpdates(_0x1b0aaf,_0x392800){return function(_0x5b5bf1){if(_0x5b5bf1){return _0x5b5bf1[_0x3071('0x34')](_0x1b0aaf)[_0x3071('0x1d')](function(_0x25250e){return _0x25250e;});}return null;};}function removeEntity(_0x13ae2c,_0x5e1d2b){return function(_0x218a82){if(_0x218a82){return _0x218a82[_0x3071('0x35')]()[_0x3071('0x1d')](function(){_0x13ae2c[_0x3071('0x2a')](0xcc)[_0x3071('0x2b')]();});}};}function handleEntityNotFound(_0x2068ce,_0x3c55c){return function(_0x148f7a){if(!_0x148f7a){_0x2068ce['sendStatus'](0x194);}return _0x148f7a;};}function handleError(_0x3988eb,_0x54e52f){_0x54e52f=_0x54e52f||0x1f4;return function(_0x4fb1ec){logger[_0x3071('0x24')](_0x4fb1ec[_0x3071('0x36')]);if(_0x4fb1ec['name']){delete _0x4fb1ec[_0x3071('0x37')];}_0x3988eb[_0x3071('0x2a')](_0x54e52f)[_0x3071('0x38')](_0x4fb1ec);};}exports[_0x3071('0x39')]=function(_0xc60572,_0x232235){var _0x5610ab={},_0x36afdc={},_0xd7971f={'count':0x0,'rows':[]};var _0x4ce6d4=_[_0x3071('0x3a')](db['VtigerAccount'][_0x3071('0x3b')],function(_0x43133a){return{'name':_0x43133a['fieldName'],'type':_0x43133a['type'][_0x3071('0x3c')]};});_0x36afdc[_0x3071('0x3d')]=_[_0x3071('0x3a')](_0x4ce6d4,'name');_0x36afdc[_0x3071('0x3e')]=_['keys'](_0xc60572[_0x3071('0x3e')]);_0x36afdc['filters']=_[_0x3071('0x3f')](_0x36afdc[_0x3071('0x3d')],_0x36afdc[_0x3071('0x3e')]);_0x5610ab[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x36afdc['model'],qs['fields'](_0xc60572[_0x3071('0x3e')][_0x3071('0x41')]));_0x5610ab[_0x3071('0x40')]=_0x5610ab[_0x3071('0x40')]['length']?_0x5610ab[_0x3071('0x40')]:_0x36afdc[_0x3071('0x3d')];if(!_0xc60572[_0x3071('0x3e')][_0x3071('0x42')](_0x3071('0x43'))){_0x5610ab[_0x3071('0x2f')]=qs['limit'](_0xc60572[_0x3071('0x3e')]['limit']);_0x5610ab['offset']=qs['offset'](_0xc60572['query'][_0x3071('0x2d')]);}_0x5610ab[_0x3071('0x44')]=qs[_0x3071('0x45')](_0xc60572[_0x3071('0x3e')][_0x3071('0x45')]);_0x5610ab[_0x3071('0x46')]=qs[_0x3071('0x47')](_[_0x3071('0x48')](_0xc60572['query'],_0x36afdc[_0x3071('0x47')]),_0x4ce6d4);if(_0xc60572[_0x3071('0x3e')][_0x3071('0x49')]){_0x5610ab[_0x3071('0x46')]=_[_0x3071('0x4a')](_0x5610ab['where'],{'$or':_['map'](_0x4ce6d4,function(_0x1721d0){if(_0x1721d0[_0x3071('0x4b')]!==_0x3071('0x4c')){var _0x5c5865={};_0x5c5865[_0x1721d0[_0x3071('0x37')]]={'$like':'%'+_0xc60572['query'][_0x3071('0x49')]+'%'};return _0x5c5865;}})});}_0x5610ab=_['merge']({},_0x5610ab,_0xc60572[_0x3071('0x4d')]);var _0x509178={'where':_0x5610ab['where']};return db[_0x3071('0x4e')]['count'](_0x509178)[_0x3071('0x1d')](function(_0x5a0a69){_0xd7971f[_0x3071('0x30')]=_0x5a0a69;if(_0xc60572[_0x3071('0x3e')][_0x3071('0x4f')]){_0x5610ab[_0x3071('0x50')]=[{'all':!![]}];}return db['VtigerAccount'][_0x3071('0x51')](_0x5610ab);})['then'](function(_0xd273ec){_0xd7971f['rows']=_0xd273ec;return _0xd7971f;})[_0x3071('0x1d')](respondWithFilteredResult(_0x232235,_0x5610ab))[_0x3071('0x28')](handleError(_0x232235,null));};exports['show']=function(_0x131ae6,_0x117e73){var _0x224a70={'raw':![],'where':{'id':_0x131ae6[_0x3071('0x52')]['id']}},_0x38bcc2={};_0x38bcc2[_0x3071('0x3d')]=_[_0x3071('0x53')](db['VtigerAccount'][_0x3071('0x3b')]);_0x38bcc2[_0x3071('0x3e')]=_[_0x3071('0x53')](_0x131ae6[_0x3071('0x3e')]);_0x38bcc2['filters']=_[_0x3071('0x3f')](_0x38bcc2[_0x3071('0x3d')],_0x38bcc2[_0x3071('0x3e')]);_0x224a70[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x38bcc2[_0x3071('0x3d')],qs[_0x3071('0x41')](_0x131ae6[_0x3071('0x3e')][_0x3071('0x41')]));_0x224a70[_0x3071('0x40')]=_0x224a70[_0x3071('0x40')][_0x3071('0x54')]?_0x224a70[_0x3071('0x40')]:_0x38bcc2[_0x3071('0x3d')];if(_0x131ae6[_0x3071('0x3e')][_0x3071('0x4f')]){_0x224a70['include']=[{'all':!![]}];}_0x224a70=_['merge']({},_0x224a70,_0x131ae6[_0x3071('0x4d')]);return db['VtigerAccount'][_0x3071('0x55')](_0x224a70)[_0x3071('0x1d')](handleEntityNotFound(_0x117e73,null))[_0x3071('0x1d')](respondWithResult(_0x117e73,null))['catch'](handleError(_0x117e73,null));};exports[_0x3071('0x56')]=function(_0x1ada95,_0x5bc69e){return db['VtigerAccount'][_0x3071('0x56')](_0x1ada95[_0x3071('0x57')],{})[_0x3071('0x1d')](respondWithResult(_0x5bc69e,0xc9))[_0x3071('0x28')](handleError(_0x5bc69e,null));};exports['update']=function(_0x43fa57,_0xeae1f){if(_0x43fa57[_0x3071('0x57')]['id']){delete _0x43fa57[_0x3071('0x57')]['id'];}return db[_0x3071('0x4e')]['find']({'where':{'id':_0x43fa57[_0x3071('0x52')]['id']}})[_0x3071('0x1d')](handleEntityNotFound(_0xeae1f,null))[_0x3071('0x1d')](saveUpdates(_0x43fa57[_0x3071('0x57')],null))[_0x3071('0x1d')](respondWithResult(_0xeae1f,null))[_0x3071('0x28')](handleError(_0xeae1f,null));};exports[_0x3071('0x35')]=function(_0x4bea5d,_0x4d6ed0){return db[_0x3071('0x4e')]['find']({'where':{'id':_0x4bea5d[_0x3071('0x52')]['id']}})[_0x3071('0x1d')](handleEntityNotFound(_0x4d6ed0,null))['then'](removeEntity(_0x4d6ed0,null))[_0x3071('0x28')](handleError(_0x4d6ed0,null));};exports[_0x3071('0x58')]=function(_0x4d3886,_0x108b14,_0x1878e2){var _0x180344={};var _0x6e96c7={};var _0x2aaccb;var _0x53a399;return db[_0x3071('0x4e')][_0x3071('0x59')]({'where':{'id':_0x4d3886[_0x3071('0x52')]['id']}})['then'](handleEntityNotFound(_0x108b14,null))[_0x3071('0x1d')](function(_0x238fa9){if(_0x238fa9){_0x2aaccb=_0x238fa9;_0x6e96c7[_0x3071('0x3d')]=_[_0x3071('0x53')](db[_0x3071('0x5a')][_0x3071('0x3b')]);_0x6e96c7[_0x3071('0x3e')]=_[_0x3071('0x53')](_0x4d3886[_0x3071('0x3e')]);_0x6e96c7['filters']=_[_0x3071('0x3f')](_0x6e96c7[_0x3071('0x3d')],_0x6e96c7[_0x3071('0x3e')]);_0x180344[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x6e96c7[_0x3071('0x3d')],qs[_0x3071('0x41')](_0x4d3886[_0x3071('0x3e')][_0x3071('0x41')]));_0x180344[_0x3071('0x40')]=_0x180344[_0x3071('0x40')]['length']?_0x180344[_0x3071('0x40')]:_0x6e96c7[_0x3071('0x3d')];_0x180344[_0x3071('0x44')]=qs[_0x3071('0x45')](_0x4d3886[_0x3071('0x3e')][_0x3071('0x45')]);_0x180344[_0x3071('0x46')]=qs[_0x3071('0x47')](_['pick'](_0x4d3886[_0x3071('0x3e')],_0x6e96c7[_0x3071('0x47')]));if(_0x4d3886['query']['filter']){_0x180344[_0x3071('0x46')]=_[_0x3071('0x4a')](_0x180344[_0x3071('0x46')],{'$or':_[_0x3071('0x3a')](_0x180344['attributes'],function(_0x52955a){var _0x33c39a={};_0x33c39a[_0x52955a]={'$like':'%'+_0x4d3886['query']['filter']+'%'};return _0x33c39a;})});}_0x180344=_['merge']({},_0x180344,_0x4d3886['options']);return _0x2aaccb[_0x3071('0x58')](_0x180344);}})[_0x3071('0x1d')](function(_0xd928e8){if(_0xd928e8){_0x53a399=_0xd928e8['length'];if(!_0x4d3886[_0x3071('0x3e')][_0x3071('0x42')](_0x3071('0x43'))){_0x180344[_0x3071('0x2f')]=qs['limit'](_0x4d3886[_0x3071('0x3e')][_0x3071('0x2f')]);_0x180344['offset']=qs[_0x3071('0x2d')](_0x4d3886[_0x3071('0x3e')][_0x3071('0x2d')]);}return _0x2aaccb[_0x3071('0x58')](_0x180344);}})[_0x3071('0x1d')](function(_0x11ffdd){if(_0x11ffdd){return _0x11ffdd?{'count':_0x53a399,'rows':_0x11ffdd}:null;}})[_0x3071('0x1d')](respondWithResult(_0x108b14,null))['catch'](handleError(_0x108b14,null));};exports['addConfiguration']=function(_0x21c1e3,_0x168025,_0x1456ce){if(_0x21c1e3['body']['id']){delete _0x21c1e3['body']['id'];}return db[_0x3071('0x4e')][_0x3071('0x59')]({'where':{'id':_0x21c1e3[_0x3071('0x52')]['id']}})[_0x3071('0x1d')](handleEntityNotFound(_0x168025,null))[_0x3071('0x1d')](function(_0x314ce6){if(_0x314ce6){_0x21c1e3[_0x3071('0x57')][_0x3071('0x5b')]=_0x314ce6['id'];_0x21c1e3['body'][_0x3071('0x5c')]=integrations['getSubjects'](_0x21c1e3[_0x3071('0x57')][_0x3071('0x5d')],_0x21c1e3[_0x3071('0x57')][_0x3071('0x4b')]);_0x21c1e3[_0x3071('0x57')][_0x3071('0x5e')]=integrations[_0x3071('0x5f')](_0x21c1e3[_0x3071('0x57')]['channel'],_0x21c1e3[_0x3071('0x57')][_0x3071('0x4b')]);return db[_0x3071('0x5a')]['create'](_0x21c1e3[_0x3071('0x57')],{'include':[{'model':db[_0x3071('0x60')],'as':_0x3071('0x5c')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0x3071('0x1d')](respondWithResult(_0x168025,null))['catch'](handleError(_0x168025,null));};var md5=require(_0x3071('0x61'));exports[_0x3071('0x62')]=function(_0x40d987,_0x23bc22,_0x311939){var _0x437098=null;var _0x242665=null;var _0x4c67ec=null;var _0x1f2be3=null;var _0x5e2b17='';return db[_0x3071('0x4e')][_0x3071('0x59')]({'where':{'id':_0x40d987[_0x3071('0x52')]['id']},'attributes':['id',_0x3071('0x37'),_0x3071('0x63'),_0x3071('0x64'),'moduleName',_0x3071('0x65'),'serverUrl',_0x3071('0x66')]})[_0x3071('0x1d')](handleEntityNotFound(_0x23bc22,null))[_0x3071('0x1d')](function(_0x45879b){if(_0x45879b){_0x437098=_0x45879b[_0x3071('0x63')];_0x242665=_0x45879b[_0x3071('0x66')];_0x4c67ec=_0x45879b[_0x3071('0x67')];_0x5e2b17=_0x45879b[_0x3071('0x65')];var _0x77df0=_0x5e2b17[_0x3071('0x68')](-0x1);if(_0x77df0==='/'){_0x5e2b17=_0x5e2b17['substring'](0x0,_0x5e2b17[_0x3071('0x69')](_0x77df0));}_0x1f2be3=util[_0x3071('0x6a')]('%s/webservice.php',_0x5e2b17);var _0x156826={'method':_0x3071('0x6b'),'uri':_0x1f2be3,'qs':{'operation':_0x3071('0x6c'),'username':_0x45879b[_0x3071('0x63')]},'json':!![]};return rp(_0x156826);}})[_0x3071('0x1d')](function(_0x5c39b1){if(_0x5c39b1['success']){var _0x3d2860={'method':'POST','uri':_0x1f2be3,'form':{'operation':_0x3071('0x6d'),'username':_0x437098,'accessKey':md5(_0x5c39b1[_0x3071('0x27')][_0x3071('0x6e')]+_0x242665)},'json':!![]};return rp(_0x3d2860);}})[_0x3071('0x1d')](function(_0x22783b){if(_0x22783b[_0x3071('0x6f')]){var _0x568386={'method':_0x3071('0x6b'),'uri':_0x1f2be3,'qs':{'operation':_0x3071('0x70'),'username':_0x437098,'sessionName':_0x22783b[_0x3071('0x27')][_0x3071('0x71')],'elementType':_0x4c67ec},'json':!![]};return rp(_0x568386);}})['then'](function(_0x45fcb1){if(_0x45fcb1[_0x3071('0x6f')]){var _0x4db74f=[_0x3071('0x72'),_0x3071('0x73'),_0x3071('0x74')];_[_0x3071('0x75')](_0x45fcb1[_0x3071('0x27')]['fields'],function(_0x44cecd){return _0x4db74f['includes'](_0x44cecd[_0x3071('0x4b')][_0x3071('0x37')]);});_[_0x3071('0x75')](_0x45fcb1[_0x3071('0x27')][_0x3071('0x41')],function(_0x247cda){return _0x247cda[_0x3071('0x76')]===_0x3071('0x77');});return{'count':_0x45fcb1['result'][_0x3071('0x41')][_0x3071('0x54')],'rows':_[_0x3071('0x3a')](_0x45fcb1['result'][_0x3071('0x41')],function(_0x5d22b0){return{'id':_0x5d22b0[_0x3071('0x37')],'name':_0x5d22b0[_0x3071('0x78')],'custom':_[_0x3071('0x79')](_0x5d22b0['name'],_0x3071('0x7a'))?!![]:![],'options':_0x5d22b0[_0x3071('0x4b')][_0x3071('0x37')]===_0x3071('0x7b')&&_0x5d22b0[_0x3071('0x4b')][_0x3071('0x7c')][_0x3071('0x54')]>0x0?_[_0x3071('0x3a')](_0x5d22b0[_0x3071('0x4b')]['picklistValues'],function(_0x1429d2){return{'name':_0x1429d2[_0x3071('0x78')],'value':_0x1429d2[_0x3071('0x7d')]};}):[]};})};}})['then'](respondWithResult(_0x23bc22,null))['catch'](function(_0x51e468){console['log']('vTiger\x20error:\x20'+_0x51e468);var _0x8c77b7=_0x40d987[_0x3071('0x3e')]['test']?0x1f4:_0x51e468[_0x3071('0x7e')]||0x1f4;logger[_0x3071('0x24')](_0x3071('0x7f'),'getFields',_0x8c77b7,JSON['stringify'](_0x51e468));delete _0x51e468[_0x3071('0x37')];if(_0x8c77b7===0x191){_0x8c77b7=0x190;}_0x23bc22[_0x3071('0x2a')](_0x8c77b7)[_0x3071('0x38')](_0x40d987[_0x3071('0x3e')][_0x3071('0x80')]?{'message':_0x3071('0x81'),'statusCode':_0x51e468[_0x3071('0x7e')]}:_0x51e468);});}; \ No newline at end of file +var _0x9ffd=['getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','VtigerField','Subjects','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','login','token','GET','autogenerated','reference','owner','remove','includes','false','label','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','stack','name','index','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','VtigerAccount','include','findAll','rows','params','keys','rawAttributes','includeAll','options','find','create','body','findOne','VtigerConfiguration','order','merge'];(function(_0x12745e,_0x2d7507){var _0x156708=function(_0x1166d3){while(--_0x1166d3){_0x12745e['push'](_0x12745e['shift']());}};_0x156708(++_0x2d7507);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1317af,_0x19f6d7){_0x1317af=_0x1317af-0x0;var _0x40f59f=_0x9ffd[_0x1317af];return _0x40f59f;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var hardwareService=require(_0xd9ff('0x13'));var logger=require(_0xd9ff('0x14'))(_0xd9ff('0x15'));var utils=require(_0xd9ff('0x16'));var config=require(_0xd9ff('0x17'));var licenseUtil=require(_0xd9ff('0x18'));var db=require(_0xd9ff('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x1a')][_0xd9ff('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x415c58,_0x350a5d,_0x12c39a,_0x556aa4){return new BPromise(function(_0x2f78c1,_0x3c9ace){var _0x5c1a28=_0x556aa4||client;return _0x5c1a28[_0xd9ff('0x1c')](_0x415c58,_0x12c39a)['then'](function(_0x4ffe54){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x350a5d,_0xd9ff('0x1d'));logger['debug'](_0xd9ff('0x1e'),_0x350a5d,_0xd9ff('0x1d'),JSON[_0xd9ff('0x1f')](_0x4ffe54));if(_0x4ffe54[_0xd9ff('0x20')]){if(_0x4ffe54[_0xd9ff('0x20')][_0xd9ff('0x21')]===0x1f4){logger[_0xd9ff('0x20')](_0xd9ff('0x22'),_0x350a5d,_0x4ffe54[_0xd9ff('0x20')][_0xd9ff('0x23')]);return _0x3c9ace(_0x4ffe54[_0xd9ff('0x20')][_0xd9ff('0x23')]);}logger[_0xd9ff('0x20')]('VtigerAccount,\x20%s,\x20%s',_0x350a5d,_0x4ffe54['error'][_0xd9ff('0x23')]);return _0x2f78c1(_0x4ffe54[_0xd9ff('0x20')]['message']);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x350a5d,'request\x20sent');_0x2f78c1(_0x4ffe54[_0xd9ff('0x24')]['message']);}})[_0xd9ff('0x25')](function(_0x3fd141){logger[_0xd9ff('0x20')](_0xd9ff('0x22'),_0x350a5d,_0x3fd141);_0x3c9ace(_0x3fd141);});});}function respondWithStatusCode(_0x278b66,_0x42a828){_0x42a828=_0x42a828||0xcc;return function(_0x4b058a){if(_0x4b058a){return _0x278b66['sendStatus'](_0x42a828);}return _0x278b66[_0xd9ff('0x26')](_0x42a828)['end']();};}function respondWithResult(_0x3ca906,_0x4d86fe){_0x4d86fe=_0x4d86fe||0xc8;return function(_0x285002){if(_0x285002){return _0x3ca906['status'](_0x4d86fe)[_0xd9ff('0x27')](_0x285002);}};}function respondWithFilteredResult(_0x159e56,_0x2138b4){return function(_0x2970e8){if(_0x2970e8){var _0x5d685e=typeof _0x2138b4[_0xd9ff('0x28')]===_0xd9ff('0x29')&&typeof _0x2138b4[_0xd9ff('0x2a')]===_0xd9ff('0x29');var _0x5c1c1f=_0x2970e8[_0xd9ff('0x2b')];var _0x3792d9=_0x5d685e?0x0:_0x2138b4[_0xd9ff('0x28')];var _0x45fb63=_0x5d685e?_0x2970e8[_0xd9ff('0x2b')]:_0x2138b4[_0xd9ff('0x28')]+_0x2138b4[_0xd9ff('0x2a')];var _0x1b5953;if(_0x45fb63>=_0x5c1c1f){_0x45fb63=_0x5c1c1f;_0x1b5953=0xc8;}else{_0x1b5953=0xce;}_0x159e56[_0xd9ff('0x26')](_0x1b5953);return _0x159e56['set'](_0xd9ff('0x2c'),_0x3792d9+'-'+_0x45fb63+'/'+_0x5c1c1f)['json'](_0x2970e8);}return null;};}function patchUpdates(_0x1d55fd){return function(_0x29c532){try{jsonpatch[_0xd9ff('0x2d')](_0x29c532,_0x1d55fd,!![]);}catch(_0x552d08){return BPromise[_0xd9ff('0x2e')](_0x552d08);}return _0x29c532[_0xd9ff('0x2f')]();};}function saveUpdates(_0x56e5be,_0x436a55){return function(_0x509291){if(_0x509291){return _0x509291[_0xd9ff('0x30')](_0x56e5be)['then'](function(_0x18c28b){return _0x18c28b;});}return null;};}function removeEntity(_0x2419f5,_0x323cb5){return function(_0x206424){if(_0x206424){return _0x206424[_0xd9ff('0x31')]()[_0xd9ff('0x32')](function(){_0x2419f5[_0xd9ff('0x26')](0xcc)[_0xd9ff('0x33')]();});}};}function handleEntityNotFound(_0x36749c,_0x190fac){return function(_0x4813a5){if(!_0x4813a5){_0x36749c[_0xd9ff('0x34')](0x194);}return _0x4813a5;};}function handleError(_0x4670e4,_0x66f4d){_0x66f4d=_0x66f4d||0x1f4;return function(_0x498025){logger[_0xd9ff('0x20')](_0x498025[_0xd9ff('0x35')]);if(_0x498025[_0xd9ff('0x36')]){delete _0x498025['name'];}_0x4670e4[_0xd9ff('0x26')](_0x66f4d)['send'](_0x498025);};}exports[_0xd9ff('0x37')]=function(_0x4ae56b,_0x20a021){var _0x5db498={},_0x1a6c4d={},_0x99ea5b={'count':0x0,'rows':[]};var _0x11566b=_['map'](db['VtigerAccount']['rawAttributes'],function(_0x7ac3d1){return{'name':_0x7ac3d1[_0xd9ff('0x38')],'type':_0x7ac3d1[_0xd9ff('0x39')][_0xd9ff('0x3a')]};});_0x1a6c4d[_0xd9ff('0x3b')]=_[_0xd9ff('0x3c')](_0x11566b,'name');_0x1a6c4d['query']=_['keys'](_0x4ae56b[_0xd9ff('0x3d')]);_0x1a6c4d[_0xd9ff('0x3e')]=_[_0xd9ff('0x3f')](_0x1a6c4d[_0xd9ff('0x3b')],_0x1a6c4d['query']);_0x5db498[_0xd9ff('0x40')]=_['intersection'](_0x1a6c4d[_0xd9ff('0x3b')],qs[_0xd9ff('0x41')](_0x4ae56b[_0xd9ff('0x3d')][_0xd9ff('0x41')]));_0x5db498['attributes']=_0x5db498[_0xd9ff('0x40')][_0xd9ff('0x42')]?_0x5db498['attributes']:_0x1a6c4d[_0xd9ff('0x3b')];if(!_0x4ae56b[_0xd9ff('0x3d')][_0xd9ff('0x43')](_0xd9ff('0x44'))){_0x5db498[_0xd9ff('0x2a')]=qs[_0xd9ff('0x2a')](_0x4ae56b['query'][_0xd9ff('0x2a')]);_0x5db498[_0xd9ff('0x28')]=qs[_0xd9ff('0x28')](_0x4ae56b[_0xd9ff('0x3d')][_0xd9ff('0x28')]);}_0x5db498['order']=qs[_0xd9ff('0x45')](_0x4ae56b[_0xd9ff('0x3d')][_0xd9ff('0x45')]);_0x5db498['where']=qs['filters'](_[_0xd9ff('0x46')](_0x4ae56b[_0xd9ff('0x3d')],_0x1a6c4d[_0xd9ff('0x3e')]),_0x11566b);if(_0x4ae56b[_0xd9ff('0x3d')][_0xd9ff('0x47')]){_0x5db498[_0xd9ff('0x48')]=_['merge'](_0x5db498[_0xd9ff('0x48')],{'$or':_[_0xd9ff('0x3c')](_0x11566b,function(_0x54726c){if(_0x54726c[_0xd9ff('0x39')]!==_0xd9ff('0x49')){var _0x13a1ec={};_0x13a1ec[_0x54726c[_0xd9ff('0x36')]]={'$like':'%'+_0x4ae56b[_0xd9ff('0x3d')]['filter']+'%'};return _0x13a1ec;}})});}_0x5db498=_['merge']({},_0x5db498,_0x4ae56b['options']);var _0x301ebb={'where':_0x5db498['where']};return db[_0xd9ff('0x4a')][_0xd9ff('0x2b')](_0x301ebb)[_0xd9ff('0x32')](function(_0x4cfba7){_0x99ea5b[_0xd9ff('0x2b')]=_0x4cfba7;if(_0x4ae56b[_0xd9ff('0x3d')]['includeAll']){_0x5db498[_0xd9ff('0x4b')]=[{'all':!![]}];}return db[_0xd9ff('0x4a')][_0xd9ff('0x4c')](_0x5db498);})[_0xd9ff('0x32')](function(_0x559101){_0x99ea5b[_0xd9ff('0x4d')]=_0x559101;return _0x99ea5b;})['then'](respondWithFilteredResult(_0x20a021,_0x5db498))[_0xd9ff('0x25')](handleError(_0x20a021,null));};exports['show']=function(_0x450ca1,_0x3d91e6){var _0x2bf37a={'raw':![],'where':{'id':_0x450ca1[_0xd9ff('0x4e')]['id']}},_0x1760c3={};_0x1760c3['model']=_[_0xd9ff('0x4f')](db[_0xd9ff('0x4a')][_0xd9ff('0x50')]);_0x1760c3[_0xd9ff('0x3d')]=_['keys'](_0x450ca1['query']);_0x1760c3['filters']=_[_0xd9ff('0x3f')](_0x1760c3[_0xd9ff('0x3b')],_0x1760c3[_0xd9ff('0x3d')]);_0x2bf37a['attributes']=_[_0xd9ff('0x3f')](_0x1760c3[_0xd9ff('0x3b')],qs[_0xd9ff('0x41')](_0x450ca1[_0xd9ff('0x3d')][_0xd9ff('0x41')]));_0x2bf37a[_0xd9ff('0x40')]=_0x2bf37a[_0xd9ff('0x40')][_0xd9ff('0x42')]?_0x2bf37a[_0xd9ff('0x40')]:_0x1760c3[_0xd9ff('0x3b')];if(_0x450ca1[_0xd9ff('0x3d')][_0xd9ff('0x51')]){_0x2bf37a[_0xd9ff('0x4b')]=[{'all':!![]}];}_0x2bf37a=_['merge']({},_0x2bf37a,_0x450ca1[_0xd9ff('0x52')]);return db['VtigerAccount'][_0xd9ff('0x53')](_0x2bf37a)['then'](handleEntityNotFound(_0x3d91e6,null))[_0xd9ff('0x32')](respondWithResult(_0x3d91e6,null))['catch'](handleError(_0x3d91e6,null));};exports[_0xd9ff('0x54')]=function(_0x5624a0,_0x3aea70){return db['VtigerAccount'][_0xd9ff('0x54')](_0x5624a0['body'],{})[_0xd9ff('0x32')](respondWithResult(_0x3aea70,0xc9))['catch'](handleError(_0x3aea70,null));};exports[_0xd9ff('0x30')]=function(_0x103c99,_0x122c9d){if(_0x103c99[_0xd9ff('0x55')]['id']){delete _0x103c99['body']['id'];}return db[_0xd9ff('0x4a')][_0xd9ff('0x53')]({'where':{'id':_0x103c99[_0xd9ff('0x4e')]['id']}})['then'](handleEntityNotFound(_0x122c9d,null))[_0xd9ff('0x32')](saveUpdates(_0x103c99[_0xd9ff('0x55')],null))[_0xd9ff('0x32')](respondWithResult(_0x122c9d,null))[_0xd9ff('0x25')](handleError(_0x122c9d,null));};exports[_0xd9ff('0x31')]=function(_0x56e8e8,_0x27cc9e){return db[_0xd9ff('0x4a')][_0xd9ff('0x53')]({'where':{'id':_0x56e8e8[_0xd9ff('0x4e')]['id']}})[_0xd9ff('0x32')](handleEntityNotFound(_0x27cc9e,null))[_0xd9ff('0x32')](removeEntity(_0x27cc9e,null))[_0xd9ff('0x25')](handleError(_0x27cc9e,null));};exports['getConfigurations']=function(_0x3be850,_0x11251f,_0x561a9b){var _0x1c885f={};var _0x17c1b2={};var _0x5b17c0;var _0x11b0a5;return db[_0xd9ff('0x4a')][_0xd9ff('0x56')]({'where':{'id':_0x3be850['params']['id']}})['then'](handleEntityNotFound(_0x11251f,null))[_0xd9ff('0x32')](function(_0x4f0c33){if(_0x4f0c33){_0x5b17c0=_0x4f0c33;_0x17c1b2[_0xd9ff('0x3b')]=_[_0xd9ff('0x4f')](db[_0xd9ff('0x57')][_0xd9ff('0x50')]);_0x17c1b2['query']=_['keys'](_0x3be850['query']);_0x17c1b2[_0xd9ff('0x3e')]=_[_0xd9ff('0x3f')](_0x17c1b2[_0xd9ff('0x3b')],_0x17c1b2[_0xd9ff('0x3d')]);_0x1c885f[_0xd9ff('0x40')]=_['intersection'](_0x17c1b2[_0xd9ff('0x3b')],qs['fields'](_0x3be850[_0xd9ff('0x3d')][_0xd9ff('0x41')]));_0x1c885f[_0xd9ff('0x40')]=_0x1c885f[_0xd9ff('0x40')][_0xd9ff('0x42')]?_0x1c885f[_0xd9ff('0x40')]:_0x17c1b2[_0xd9ff('0x3b')];_0x1c885f[_0xd9ff('0x58')]=qs['sort'](_0x3be850[_0xd9ff('0x3d')][_0xd9ff('0x45')]);_0x1c885f['where']=qs['filters'](_[_0xd9ff('0x46')](_0x3be850['query'],_0x17c1b2[_0xd9ff('0x3e')]));if(_0x3be850[_0xd9ff('0x3d')]['filter']){_0x1c885f[_0xd9ff('0x48')]=_[_0xd9ff('0x59')](_0x1c885f[_0xd9ff('0x48')],{'$or':_[_0xd9ff('0x3c')](_0x1c885f[_0xd9ff('0x40')],function(_0x49c5fa){var _0x12a8d7={};_0x12a8d7[_0x49c5fa]={'$like':'%'+_0x3be850['query']['filter']+'%'};return _0x12a8d7;})});}_0x1c885f=_[_0xd9ff('0x59')]({},_0x1c885f,_0x3be850[_0xd9ff('0x52')]);return _0x5b17c0[_0xd9ff('0x5a')](_0x1c885f);}})[_0xd9ff('0x32')](function(_0x56d822){if(_0x56d822){_0x11b0a5=_0x56d822[_0xd9ff('0x42')];if(!_0x3be850[_0xd9ff('0x3d')][_0xd9ff('0x43')](_0xd9ff('0x44'))){_0x1c885f[_0xd9ff('0x2a')]=qs[_0xd9ff('0x2a')](_0x3be850[_0xd9ff('0x3d')][_0xd9ff('0x2a')]);_0x1c885f['offset']=qs['offset'](_0x3be850['query'][_0xd9ff('0x28')]);}return _0x5b17c0[_0xd9ff('0x5a')](_0x1c885f);}})['then'](function(_0x196670){if(_0x196670){return _0x196670?{'count':_0x11b0a5,'rows':_0x196670}:null;}})[_0xd9ff('0x32')](respondWithResult(_0x11251f,null))[_0xd9ff('0x25')](handleError(_0x11251f,null));};exports[_0xd9ff('0x5b')]=function(_0x17884a,_0x471e03,_0x2a9fdf){if(_0x17884a[_0xd9ff('0x55')]['id']){delete _0x17884a['body']['id'];}return db[_0xd9ff('0x4a')][_0xd9ff('0x56')]({'where':{'id':_0x17884a[_0xd9ff('0x4e')]['id']}})['then'](handleEntityNotFound(_0x471e03,null))[_0xd9ff('0x32')](function(_0x58c9c2){if(_0x58c9c2){_0x17884a[_0xd9ff('0x55')][_0xd9ff('0x5c')]=_0x58c9c2['id'];_0x17884a[_0xd9ff('0x55')]['Subjects']=integrations[_0xd9ff('0x5d')](_0x17884a[_0xd9ff('0x55')][_0xd9ff('0x5e')],_0x17884a[_0xd9ff('0x55')]['type']);_0x17884a[_0xd9ff('0x55')][_0xd9ff('0x5f')]=integrations[_0xd9ff('0x60')](_0x17884a['body'][_0xd9ff('0x5e')],_0x17884a[_0xd9ff('0x55')][_0xd9ff('0x39')]);return db['VtigerConfiguration'][_0xd9ff('0x54')](_0x17884a[_0xd9ff('0x55')],{'include':[{'model':db[_0xd9ff('0x61')],'as':_0xd9ff('0x62')},{'model':db[_0xd9ff('0x61')],'as':'Descriptions'}]});}return null;})[_0xd9ff('0x32')](respondWithResult(_0x471e03,null))[_0xd9ff('0x25')](handleError(_0x471e03,null));};var md5=require('md5');exports[_0xd9ff('0x63')]=function(_0x2404ed,_0xf75739,_0x5d1973){var _0x432644=null;var _0x48f57d=null;var _0x1e46fc=null;var _0x478e0d=null;var _0x3b2848='';return db[_0xd9ff('0x4a')][_0xd9ff('0x56')]({'where':{'id':_0x2404ed[_0xd9ff('0x4e')]['id']},'attributes':['id',_0xd9ff('0x36'),_0xd9ff('0x64'),_0xd9ff('0x65'),_0xd9ff('0x66'),_0xd9ff('0x67'),_0xd9ff('0x68'),'accessKey']})[_0xd9ff('0x32')](handleEntityNotFound(_0xf75739,null))[_0xd9ff('0x32')](function(_0x1f6cb9){if(_0x1f6cb9){_0x432644=_0x1f6cb9[_0xd9ff('0x64')];_0x48f57d=_0x1f6cb9[_0xd9ff('0x69')];_0x1e46fc=_0x1f6cb9[_0xd9ff('0x66')];_0x3b2848=_0x1f6cb9['remoteUri'];var _0x4b2b32=_0x3b2848[_0xd9ff('0x6a')](-0x1);if(_0x4b2b32==='/'){_0x3b2848=_0x3b2848[_0xd9ff('0x6b')](0x0,_0x3b2848[_0xd9ff('0x6c')](_0x4b2b32));}_0x478e0d=util[_0xd9ff('0x6d')](_0xd9ff('0x6e'),_0x3b2848);var _0x183199={'method':'GET','uri':_0x478e0d,'qs':{'operation':_0xd9ff('0x6f'),'username':_0x1f6cb9[_0xd9ff('0x64')]},'json':!![]};return rp(_0x183199);}})[_0xd9ff('0x32')](function(_0x3d4953){if(_0x3d4953[_0xd9ff('0x70')]){var _0x32aa19={'method':'POST','uri':_0x478e0d,'form':{'operation':_0xd9ff('0x71'),'username':_0x432644,'accessKey':md5(_0x3d4953[_0xd9ff('0x24')][_0xd9ff('0x72')]+_0x48f57d)},'json':!![]};return rp(_0x32aa19);}})[_0xd9ff('0x32')](function(_0x373a32){if(_0x373a32[_0xd9ff('0x70')]){var _0x1c4fb6={'method':_0xd9ff('0x73'),'uri':_0x478e0d,'qs':{'operation':'describe','username':_0x432644,'sessionName':_0x373a32[_0xd9ff('0x24')]['sessionName'],'elementType':_0x1e46fc},'json':!![]};return rp(_0x1c4fb6);}})[_0xd9ff('0x32')](function(_0x304d1e){if(_0x304d1e[_0xd9ff('0x70')]){var _0x2d2d1c=[_0xd9ff('0x74'),_0xd9ff('0x75'),_0xd9ff('0x76')];_[_0xd9ff('0x77')](_0x304d1e[_0xd9ff('0x24')][_0xd9ff('0x41')],function(_0x44b20b){return _0x2d2d1c[_0xd9ff('0x78')](_0x44b20b[_0xd9ff('0x39')]['name']);});_[_0xd9ff('0x77')](_0x304d1e[_0xd9ff('0x24')][_0xd9ff('0x41')],function(_0x19ecf3){return _0x19ecf3['editable']===_0xd9ff('0x79');});return{'count':_0x304d1e[_0xd9ff('0x24')]['fields'][_0xd9ff('0x42')],'rows':_[_0xd9ff('0x3c')](_0x304d1e[_0xd9ff('0x24')][_0xd9ff('0x41')],function(_0x15f805){return{'id':_0x15f805[_0xd9ff('0x36')],'name':_0x15f805[_0xd9ff('0x7a')],'custom':_['startsWith'](_0x15f805[_0xd9ff('0x36')],'cf_')?!![]:![],'options':_0x15f805[_0xd9ff('0x39')][_0xd9ff('0x36')]===_0xd9ff('0x7b')&&_0x15f805[_0xd9ff('0x39')][_0xd9ff('0x7c')][_0xd9ff('0x42')]>0x0?_[_0xd9ff('0x3c')](_0x15f805[_0xd9ff('0x39')][_0xd9ff('0x7c')],function(_0x108583){return{'name':_0x108583[_0xd9ff('0x7a')],'value':_0x108583['value']};}):[]};})};}})[_0xd9ff('0x32')](respondWithResult(_0xf75739,null))[_0xd9ff('0x25')](function(_0x50b4aa){console[_0xd9ff('0x7d')](_0xd9ff('0x7e')+_0x50b4aa);var _0x3b3511=_0x2404ed[_0xd9ff('0x3d')][_0xd9ff('0x7f')]?0x1f4:_0x50b4aa[_0xd9ff('0x80')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xd9ff('0x63'),_0x3b3511,JSON['stringify'](_0x50b4aa));delete _0x50b4aa['name'];if(_0x3b3511===0x191){_0x3b3511=0x190;}_0xf75739['status'](_0x3b3511)['send'](_0x2404ed[_0xd9ff('0x3d')][_0xd9ff('0x7f')]?{'message':_0xd9ff('0x81'),'statusCode':_0x50b4aa['statusCode']}:_0x50b4aa);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index f8d1488..eab8246 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 _0x26ba=['int_vtiger_accounts','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','VtigerAccount'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x26ba,0x10f));var _0xa26b=function(_0x2f4ee6,_0x24a540){_0x2f4ee6=_0x2f4ee6-0x0;var _0x28f20e=_0x26ba[_0x2f4ee6];return _0x28f20e;};'use strict';var _=require('lodash');var util=require(_0xa26b('0x0'));var logger=require(_0xa26b('0x1'))(_0xa26b('0x2'));var moment=require('moment');var BPromise=require(_0xa26b('0x3'));var rp=require(_0xa26b('0x4'));var fs=require('fs');var path=require(_0xa26b('0x5'));var rimraf=require(_0xa26b('0x6'));var config=require(_0xa26b('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x444e8e,_0xa4b700){return _0x444e8e['define'](_0xa26b('0x8'),attributes,{'tableName':_0xa26b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d99=['../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x3c41c1,_0x460f61){var _0x3ebc17=function(_0x46c2b5){while(--_0x46c2b5){_0x3c41c1['push'](_0x3c41c1['shift']());}};_0x3ebc17(++_0x460f61);}(_0x9d99,0x158));var _0x99d9=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x9d99[_0x4e9d3c];return _0x2d0825;};'use strict';var _=require(_0x99d9('0x0'));var util=require(_0x99d9('0x1'));var logger=require(_0x99d9('0x2'))(_0x99d9('0x3'));var moment=require('moment');var BPromise=require(_0x99d9('0x4'));var rp=require(_0x99d9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x99d9('0x6'));var config=require(_0x99d9('0x7'));var attributes=require(_0x99d9('0x8'));var integrations=require(_0x99d9('0x9'));module[_0x99d9('0xa')]=function(_0x19f1c2,_0x1d36b8){return _0x19f1c2[_0x99d9('0xb')](_0x99d9('0xc'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index a4c86b6..d77f34d 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 _0xe5f2=['message','catch','GetVtigerAccount','findAll','options','raw','attributes','limit','include','map','model','stringify','VtigerAccount','find','where','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x397b21,_0x53d2ac){var _0x344052=function(_0x2064d3){while(--_0x2064d3){_0x397b21['push'](_0x397b21['shift']());}};_0x344052(++_0x53d2ac);}(_0xe5f2,0x15a));var _0x2e5f=function(_0x5e4267,_0x5e0c3d){_0x5e4267=_0x5e4267-0x0;var _0x46d138=_0xe5f2[_0x5e4267];return _0x46d138;};'use strict';var _=require(_0x2e5f('0x0'));var util=require(_0x2e5f('0x1'));var moment=require(_0x2e5f('0x2'));var BPromise=require(_0x2e5f('0x3'));var rs=require(_0x2e5f('0x4'));var fs=require('fs');var Redis=require(_0x2e5f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2e5f('0x6'));var jayson=require(_0x2e5f('0x7'));var client=jayson[_0x2e5f('0x8')][_0x2e5f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a6188,_0x2da6b2,_0x2c4ade){return new BPromise(function(_0x50f1ac,_0x34c3fb){return client['request'](_0x3a6188,_0x2c4ade)[_0x2e5f('0xa')](function(_0x33c8e1){logger[_0x2e5f('0xb')](_0x2e5f('0xc'),_0x2da6b2,_0x2e5f('0xd'));logger[_0x2e5f('0xe')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x2da6b2,_0x2e5f('0xd'),JSON['stringify'](_0x33c8e1));if(_0x33c8e1[_0x2e5f('0xf')]){if(_0x33c8e1[_0x2e5f('0xf')][_0x2e5f('0x10')]===0x1f4){logger['error'](_0x2e5f('0xc'),_0x2da6b2,_0x33c8e1[_0x2e5f('0xf')][_0x2e5f('0x11')]);return _0x34c3fb(_0x33c8e1['error'][_0x2e5f('0x11')]);}logger[_0x2e5f('0xf')](_0x2e5f('0xc'),_0x2da6b2,_0x33c8e1[_0x2e5f('0xf')][_0x2e5f('0x11')]);return _0x50f1ac(_0x33c8e1[_0x2e5f('0xf')]['message']);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x2da6b2,'request\x20sent');_0x50f1ac(_0x33c8e1['result'][_0x2e5f('0x11')]);}})[_0x2e5f('0x12')](function(_0x10c8a8){logger['error'](_0x2e5f('0xc'),_0x2da6b2,_0x10c8a8);_0x34c3fb(_0x10c8a8);});});}exports[_0x2e5f('0x13')]=function(_0x137109){var _0x26baa6=this;return new Promise(function(_0x34aec6,_0x13fe0b){return db['VtigerAccount'][_0x2e5f('0x14')]({'raw':_0x137109[_0x2e5f('0x15')]?_0x137109['options'][_0x2e5f('0x16')]===undefined?!![]:![]:!![],'where':_0x137109[_0x2e5f('0x15')]?_0x137109['options']['where']||null:null,'attributes':_0x137109[_0x2e5f('0x15')]?_0x137109[_0x2e5f('0x15')][_0x2e5f('0x17')]||null:null,'limit':_0x137109[_0x2e5f('0x15')]?_0x137109['options'][_0x2e5f('0x18')]||null:null,'include':_0x137109[_0x2e5f('0x15')]?_0x137109[_0x2e5f('0x15')]['include']?_['map'](_0x137109[_0x2e5f('0x15')]['include'],function(_0x263275){return{'model':db[_0x263275['model']],'as':_0x263275['as'],'attributes':_0x263275['attributes'],'include':_0x263275[_0x2e5f('0x19')]?_[_0x2e5f('0x1a')](_0x263275[_0x2e5f('0x19')],function(_0x4264bd){return{'model':db[_0x4264bd[_0x2e5f('0x1b')]],'as':_0x4264bd['as'],'attributes':_0x4264bd['attributes'],'include':_0x4264bd[_0x2e5f('0x19')]?_[_0x2e5f('0x1a')](_0x4264bd[_0x2e5f('0x19')],function(_0x17cb7c){return{'model':db[_0x17cb7c['model']],'as':_0x17cb7c['as'],'attributes':_0x17cb7c[_0x2e5f('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2e5f('0xa')](function(_0x5197af){logger['info']('GetVtigerAccount',_0x137109);logger[_0x2e5f('0xe')]('GetVtigerAccount',_0x137109,JSON[_0x2e5f('0x1c')](_0x5197af));_0x34aec6(_0x5197af);})[_0x2e5f('0x12')](function(_0x8acca5){logger[_0x2e5f('0xf')](_0x2e5f('0x13'),_0x8acca5[_0x2e5f('0x11')],_0x137109);_0x13fe0b(_0x26baa6[_0x2e5f('0xf')](0x1f4,_0x8acca5['message']));});});};exports['ShowVtigerAccount']=function(_0x2c8846){var _0x148e5b=this;return new Promise(function(_0x1aaf3b,_0x177b44){return db[_0x2e5f('0x1d')][_0x2e5f('0x1e')]({'raw':_0x2c8846[_0x2e5f('0x15')]?_0x2c8846[_0x2e5f('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2c8846['options']?_0x2c8846[_0x2e5f('0x15')][_0x2e5f('0x1f')]||null:null,'attributes':_0x2c8846[_0x2e5f('0x15')]?_0x2c8846[_0x2e5f('0x15')][_0x2e5f('0x17')]||null:null,'include':_0x2c8846['options']?_0x2c8846[_0x2e5f('0x15')][_0x2e5f('0x19')]?_[_0x2e5f('0x1a')](_0x2c8846[_0x2e5f('0x15')][_0x2e5f('0x19')],function(_0xab60a0){return{'model':db[_0xab60a0[_0x2e5f('0x1b')]],'as':_0xab60a0['as'],'attributes':_0xab60a0[_0x2e5f('0x17')],'include':_0xab60a0[_0x2e5f('0x19')]?_[_0x2e5f('0x1a')](_0xab60a0[_0x2e5f('0x19')],function(_0x1e987e){return{'model':db[_0x1e987e['model']],'as':_0x1e987e['as'],'attributes':_0x1e987e['attributes'],'include':_0x1e987e[_0x2e5f('0x19')]?_[_0x2e5f('0x1a')](_0x1e987e['include'],function(_0x1335b7){return{'model':db[_0x1335b7[_0x2e5f('0x1b')]],'as':_0x1335b7['as'],'attributes':_0x1335b7[_0x2e5f('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2e5f('0xa')](function(_0x8df87a){logger[_0x2e5f('0xb')](_0x2e5f('0x20'),_0x2c8846);logger[_0x2e5f('0xe')](_0x2e5f('0x20'),_0x2c8846,JSON['stringify'](_0x8df87a));_0x1aaf3b(_0x8df87a);})[_0x2e5f('0x12')](function(_0x167aee){logger[_0x2e5f('0xf')](_0x2e5f('0x20'),_0x167aee[_0x2e5f('0x11')],_0x2c8846);_0x177b44(_0x148e5b[_0x2e5f('0xf')](0x1f4,_0x167aee[_0x2e5f('0x11')]));});});}; \ No newline at end of file +var _0x79c4=['jayson/promise','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','raw','options','attributes','include','map','model','ShowVtigerAccount','find','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x79c4,0x11c));var _0x479c=function(_0x2ce645,_0x2943bc){_0x2ce645=_0x2ce645-0x0;var _0xbbbcaa=_0x79c4[_0x2ce645];return _0xbbbcaa;};'use strict';var _=require('lodash');var util=require(_0x479c('0x0'));var moment=require(_0x479c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x479c('0x2'));var db=require(_0x479c('0x3'))['db'];var utils=require(_0x479c('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x479c('0x5'));var jayson=require(_0x479c('0x6'));var client=jayson['client'][_0x479c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x175f61,_0x4c40fb,_0x4a8c66){return new BPromise(function(_0x3e6f67,_0x5c67ed){return client['request'](_0x175f61,_0x4a8c66)[_0x479c('0x8')](function(_0x558967){logger[_0x479c('0x9')](_0x479c('0xa'),_0x4c40fb,_0x479c('0xb'));logger[_0x479c('0xc')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4c40fb,'request\x20sent',JSON['stringify'](_0x558967));if(_0x558967[_0x479c('0xd')]){if(_0x558967['error'][_0x479c('0xe')]===0x1f4){logger[_0x479c('0xd')](_0x479c('0xa'),_0x4c40fb,_0x558967['error']['message']);return _0x5c67ed(_0x558967[_0x479c('0xd')]['message']);}logger[_0x479c('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x4c40fb,_0x558967[_0x479c('0xd')][_0x479c('0xf')]);return _0x3e6f67(_0x558967[_0x479c('0xd')][_0x479c('0xf')]);}else{logger['info'](_0x479c('0xa'),_0x4c40fb,_0x479c('0xb'));_0x3e6f67(_0x558967[_0x479c('0x10')][_0x479c('0xf')]);}})[_0x479c('0x11')](function(_0x76cfef){logger[_0x479c('0xd')](_0x479c('0xa'),_0x4c40fb,_0x76cfef);_0x5c67ed(_0x76cfef);});});}exports[_0x479c('0x12')]=function(_0xdab02){var _0x187940=this;return new Promise(function(_0x12642d,_0x49222c){return db[_0x479c('0x13')][_0x479c('0x14')]({'raw':_0xdab02['options']?_0xdab02['options'][_0x479c('0x15')]===undefined?!![]:![]:!![],'where':_0xdab02[_0x479c('0x16')]?_0xdab02[_0x479c('0x16')]['where']||null:null,'attributes':_0xdab02[_0x479c('0x16')]?_0xdab02[_0x479c('0x16')][_0x479c('0x17')]||null:null,'limit':_0xdab02[_0x479c('0x16')]?_0xdab02[_0x479c('0x16')]['limit']||null:null,'include':_0xdab02[_0x479c('0x16')]?_0xdab02[_0x479c('0x16')][_0x479c('0x18')]?_[_0x479c('0x19')](_0xdab02[_0x479c('0x16')][_0x479c('0x18')],function(_0x9c97b){return{'model':db[_0x9c97b[_0x479c('0x1a')]],'as':_0x9c97b['as'],'attributes':_0x9c97b[_0x479c('0x17')],'include':_0x9c97b[_0x479c('0x18')]?_[_0x479c('0x19')](_0x9c97b[_0x479c('0x18')],function(_0x39fe2b){return{'model':db[_0x39fe2b[_0x479c('0x1a')]],'as':_0x39fe2b['as'],'attributes':_0x39fe2b[_0x479c('0x17')],'include':_0x39fe2b['include']?_[_0x479c('0x19')](_0x39fe2b[_0x479c('0x18')],function(_0x50308d){return{'model':db[_0x50308d[_0x479c('0x1a')]],'as':_0x50308d['as'],'attributes':_0x50308d['attributes']};}):[]};}):[]};}):[]:[]})[_0x479c('0x8')](function(_0x2812c6){logger[_0x479c('0x9')](_0x479c('0x12'),_0xdab02);logger[_0x479c('0xc')]('GetVtigerAccount',_0xdab02,JSON['stringify'](_0x2812c6));_0x12642d(_0x2812c6);})[_0x479c('0x11')](function(_0x133e6e){logger['error']('GetVtigerAccount',_0x133e6e[_0x479c('0xf')],_0xdab02);_0x49222c(_0x187940[_0x479c('0xd')](0x1f4,_0x133e6e[_0x479c('0xf')]));});});};exports[_0x479c('0x1b')]=function(_0x1e3ab9){var _0x3b5872=this;return new Promise(function(_0x21c95c,_0x3841c8){return db[_0x479c('0x13')][_0x479c('0x1c')]({'raw':_0x1e3ab9[_0x479c('0x16')]?_0x1e3ab9[_0x479c('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1e3ab9['options']?_0x1e3ab9['options']['where']||null:null,'attributes':_0x1e3ab9[_0x479c('0x16')]?_0x1e3ab9[_0x479c('0x16')]['attributes']||null:null,'include':_0x1e3ab9['options']?_0x1e3ab9[_0x479c('0x16')][_0x479c('0x18')]?_[_0x479c('0x19')](_0x1e3ab9[_0x479c('0x16')][_0x479c('0x18')],function(_0x162149){return{'model':db[_0x162149['model']],'as':_0x162149['as'],'attributes':_0x162149['attributes'],'include':_0x162149[_0x479c('0x18')]?_[_0x479c('0x19')](_0x162149[_0x479c('0x18')],function(_0x122971){return{'model':db[_0x122971['model']],'as':_0x122971['as'],'attributes':_0x122971[_0x479c('0x17')],'include':_0x122971['include']?_[_0x479c('0x19')](_0x122971[_0x479c('0x18')],function(_0x10754d){return{'model':db[_0x10754d[_0x479c('0x1a')]],'as':_0x10754d['as'],'attributes':_0x10754d[_0x479c('0x17')]};}):[]};}):[]};}):[]:[]})[_0x479c('0x8')](function(_0x20cfb9){logger[_0x479c('0x9')]('ShowVtigerAccount',_0x1e3ab9);logger[_0x479c('0xc')](_0x479c('0x1b'),_0x1e3ab9,JSON['stringify'](_0x20cfb9));_0x21c95c(_0x20cfb9);})['catch'](function(_0x228ae0){logger[_0x479c('0xd')](_0x479c('0x1b'),_0x228ae0['message'],_0x1e3ab9);_0x3841c8(_0x3b5872['error'](0x1f4,_0x228ae0['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index c96d8a9..a3c5590 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 _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x3e29c2,_0x2175cf){var _0x4b8eea=function(_0x21fdfb){while(--_0x21fdfb){_0x3e29c2['push'](_0x3e29c2['shift']());}};_0x4b8eea(++_0x2175cf);}(_0xadb5,0xad));var _0x5adb=function(_0x55d4c4,_0x53846c){_0x55d4c4=_0x55d4c4-0x0;var _0x3848a4=_0xadb5[_0x55d4c4];return _0x3848a4;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intVtigerConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +var _0xc4aa=['getDescriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xc4aa[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0x12')]);router[_0xac4a('0x13')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x14')]);router[_0xac4a('0x15')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x16')]);module[_0xac4a('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 8f1b1c7..32aa20b 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 _0x9f88=['exports','sequelize'];(function(_0xfb6d1e,_0x42d91f){var _0x19edbd=function(_0x2e295b){while(--_0x2e295b){_0xfb6d1e['push'](_0xfb6d1e['shift']());}};_0x19edbd(++_0x42d91f);}(_0x9f88,0x17b));var _0x89f8=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9f88[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x89f8('0x0'));module[_0x89f8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x55cc=['STRING','sequelize'];(function(_0x65ffa1,_0x14114b){var _0x1ab722=function(_0x135778){while(--_0x135778){_0x65ffa1['push'](_0x65ffa1['shift']());}};_0x1ab722(++_0x14114b);}(_0x55cc,0x7b));var _0xc55c=function(_0xe8c7e7,_0x46781f){_0xe8c7e7=_0xe8c7e7-0x0;var _0x276a8f=_0x55cc[_0xe8c7e7];return _0x276a8f;};'use strict';var Sequelize=require(_0xc55c('0x0'));module['exports']={'name':{'type':Sequelize[_0xc55c('0x1')]},'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 9344ff5..4084736 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 _0x1c67=['VIRTUAL','options','include','findAll','rows','show','rawAttributes','find','create','body','params','getFields','findOne','pick','getSubjects','getDescriptions','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','client','request','then','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerConfiguration,\x20%s,\x20%s','info','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','destroy','name','send','map','VtigerConfiguration','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0xb82555,_0x37dfa3){var _0x294f0b=function(_0x3432fc){while(--_0x3432fc){_0xb82555['push'](_0xb82555['shift']());}};_0x294f0b(++_0x37dfa3);}(_0x1c67,0x67));var _0x71c6=function(_0x47016b,_0x1ec4b9){_0x47016b=_0x47016b-0x0;var _0x2d53bb=_0x1c67[_0x47016b];return _0x2d53bb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x71c6('0x0'));var jsonpatch=require(_0x71c6('0x1'));var rp=require('request-promise');var moment=require(_0x71c6('0x2'));var BPromise=require(_0x71c6('0x3'));var Mustache=require(_0x71c6('0x4'));var util=require(_0x71c6('0x5'));var path=require(_0x71c6('0x6'));var sox=require(_0x71c6('0x7'));var csv=require(_0x71c6('0x8'));var ejs=require(_0x71c6('0x9'));var fs=require('fs');var fs_extra=require(_0x71c6('0xa'));var _=require(_0x71c6('0xb'));var squel=require(_0x71c6('0xc'));var crypto=require(_0x71c6('0xd'));var jsforce=require(_0x71c6('0xe'));var deskjs=require(_0x71c6('0xf'));var toCsv=require(_0x71c6('0x8'));var querystring=require('querystring');var Papa=require(_0x71c6('0x10'));var Redis=require(_0x71c6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x71c6('0x12'));var as=require(_0x71c6('0x13'));var hardwareService=require(_0x71c6('0x14'));var logger=require(_0x71c6('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71c6('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x71c6('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x476029,_0x43a9ca,_0x2c5f20,_0x522583){return new BPromise(function(_0xc65f04,_0x278a8d){var _0xd1d8c7=_0x522583||client;return _0xd1d8c7[_0x71c6('0x18')](_0x476029,_0x2c5f20)[_0x71c6('0x19')](function(_0x2ceda6){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x43a9ca,_0x71c6('0x1a'));logger[_0x71c6('0x1b')](_0x71c6('0x1c'),_0x43a9ca,'request\x20sent',JSON[_0x71c6('0x1d')](_0x2ceda6));if(_0x2ceda6['error']){if(_0x2ceda6[_0x71c6('0x1e')][_0x71c6('0x1f')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x43a9ca,_0x2ceda6[_0x71c6('0x1e')][_0x71c6('0x20')]);return _0x278a8d(_0x2ceda6['error'][_0x71c6('0x20')]);}logger[_0x71c6('0x1e')](_0x71c6('0x21'),_0x43a9ca,_0x2ceda6[_0x71c6('0x1e')]['message']);return _0xc65f04(_0x2ceda6[_0x71c6('0x1e')]['message']);}else{logger[_0x71c6('0x22')](_0x71c6('0x21'),_0x43a9ca,_0x71c6('0x1a'));_0xc65f04(_0x2ceda6['result'][_0x71c6('0x20')]);}})[_0x71c6('0x23')](function(_0x3a4065){logger['error'](_0x71c6('0x21'),_0x43a9ca,_0x3a4065);_0x278a8d(_0x3a4065);});});}function respondWithStatusCode(_0xf3165,_0x1c191a){_0x1c191a=_0x1c191a||0xcc;return function(_0x469c7e){if(_0x469c7e){return _0xf3165[_0x71c6('0x24')](_0x1c191a);}return _0xf3165[_0x71c6('0x25')](_0x1c191a)[_0x71c6('0x26')]();};}function respondWithResult(_0x22deee,_0x3566c7){_0x3566c7=_0x3566c7||0xc8;return function(_0x5a1636){if(_0x5a1636){return _0x22deee['status'](_0x3566c7)['json'](_0x5a1636);}};}function respondWithFilteredResult(_0x482e8b,_0x54cc0c){return function(_0x2eb0ca){if(_0x2eb0ca){var _0x1a99e4=typeof _0x54cc0c[_0x71c6('0x27')]===_0x71c6('0x28')&&typeof _0x54cc0c['limit']===_0x71c6('0x28');var _0x197642=_0x2eb0ca['count'];var _0x2ceeba=_0x1a99e4?0x0:_0x54cc0c[_0x71c6('0x27')];var _0x4ec687=_0x1a99e4?_0x2eb0ca[_0x71c6('0x29')]:_0x54cc0c[_0x71c6('0x27')]+_0x54cc0c[_0x71c6('0x2a')];var _0x505ae0;if(_0x4ec687>=_0x197642){_0x4ec687=_0x197642;_0x505ae0=0xc8;}else{_0x505ae0=0xce;}_0x482e8b[_0x71c6('0x25')](_0x505ae0);return _0x482e8b[_0x71c6('0x2b')](_0x71c6('0x2c'),_0x2ceeba+'-'+_0x4ec687+'/'+_0x197642)[_0x71c6('0x2d')](_0x2eb0ca);}return null;};}function patchUpdates(_0x48fd34){return function(_0x102acf){try{jsonpatch[_0x71c6('0x2e')](_0x102acf,_0x48fd34,!![]);}catch(_0x1fe388){return BPromise[_0x71c6('0x2f')](_0x1fe388);}return _0x102acf['save']();};}function saveUpdates(_0x353a51,_0x38d73c){return function(_0x2cd74b){if(_0x2cd74b){return _0x2cd74b[_0x71c6('0x30')](_0x353a51)[_0x71c6('0x19')](function(_0x1f9d01){return _0x1f9d01;});}return null;};}function removeEntity(_0x3d1547,_0x16a6b7){return function(_0x10ac0e){if(_0x10ac0e){return _0x10ac0e[_0x71c6('0x31')]()['then'](function(){_0x3d1547['status'](0xcc)[_0x71c6('0x26')]();});}};}function handleEntityNotFound(_0x370c6a,_0x32896c){return function(_0x391aad){if(!_0x391aad){_0x370c6a[_0x71c6('0x24')](0x194);}return _0x391aad;};}function handleError(_0x37977d,_0x2456d7){_0x2456d7=_0x2456d7||0x1f4;return function(_0x5c646c){logger[_0x71c6('0x1e')](_0x5c646c['stack']);if(_0x5c646c['name']){delete _0x5c646c[_0x71c6('0x32')];}_0x37977d[_0x71c6('0x25')](_0x2456d7)[_0x71c6('0x33')](_0x5c646c);};}exports['index']=function(_0x233b34,_0x44a4cd){var _0x1b1b65={},_0x1b325f={},_0x187b67={'count':0x0,'rows':[]};var _0x533302=_[_0x71c6('0x34')](db[_0x71c6('0x35')]['rawAttributes'],function(_0x287b6b){return{'name':_0x287b6b[_0x71c6('0x36')],'type':_0x287b6b[_0x71c6('0x37')]['key']};});_0x1b325f[_0x71c6('0x38')]=_['map'](_0x533302,'name');_0x1b325f[_0x71c6('0x39')]=_[_0x71c6('0x3a')](_0x233b34[_0x71c6('0x39')]);_0x1b325f[_0x71c6('0x3b')]=_[_0x71c6('0x3c')](_0x1b325f[_0x71c6('0x38')],_0x1b325f[_0x71c6('0x39')]);_0x1b1b65[_0x71c6('0x3d')]=_[_0x71c6('0x3c')](_0x1b325f[_0x71c6('0x38')],qs[_0x71c6('0x3e')](_0x233b34['query'][_0x71c6('0x3e')]));_0x1b1b65['attributes']=_0x1b1b65['attributes'][_0x71c6('0x3f')]?_0x1b1b65[_0x71c6('0x3d')]:_0x1b325f[_0x71c6('0x38')];if(!_0x233b34[_0x71c6('0x39')][_0x71c6('0x40')](_0x71c6('0x41'))){_0x1b1b65[_0x71c6('0x2a')]=qs[_0x71c6('0x2a')](_0x233b34['query']['limit']);_0x1b1b65[_0x71c6('0x27')]=qs[_0x71c6('0x27')](_0x233b34[_0x71c6('0x39')][_0x71c6('0x27')]);}_0x1b1b65[_0x71c6('0x42')]=qs[_0x71c6('0x43')](_0x233b34[_0x71c6('0x39')]['sort']);_0x1b1b65[_0x71c6('0x44')]=qs['filters'](_['pick'](_0x233b34[_0x71c6('0x39')],_0x1b325f[_0x71c6('0x3b')]),_0x533302);if(_0x233b34['query'][_0x71c6('0x45')]){_0x1b1b65[_0x71c6('0x44')]=_[_0x71c6('0x46')](_0x1b1b65['where'],{'$or':_['map'](_0x533302,function(_0x4bba8c){if(_0x4bba8c[_0x71c6('0x37')]!==_0x71c6('0x47')){var _0x5aeb87={};_0x5aeb87[_0x4bba8c[_0x71c6('0x32')]]={'$like':'%'+_0x233b34[_0x71c6('0x39')][_0x71c6('0x45')]+'%'};return _0x5aeb87;}})});}_0x1b1b65=_[_0x71c6('0x46')]({},_0x1b1b65,_0x233b34[_0x71c6('0x48')]);var _0x4e870f={'where':_0x1b1b65['where']};return db['VtigerConfiguration'][_0x71c6('0x29')](_0x4e870f)[_0x71c6('0x19')](function(_0x268443){_0x187b67[_0x71c6('0x29')]=_0x268443;if(_0x233b34[_0x71c6('0x39')]['includeAll']){_0x1b1b65[_0x71c6('0x49')]=[{'all':!![]}];}return db[_0x71c6('0x35')][_0x71c6('0x4a')](_0x1b1b65);})[_0x71c6('0x19')](function(_0x1d0110){_0x187b67[_0x71c6('0x4b')]=_0x1d0110;return _0x187b67;})['then'](respondWithFilteredResult(_0x44a4cd,_0x1b1b65))[_0x71c6('0x23')](handleError(_0x44a4cd,null));};exports[_0x71c6('0x4c')]=function(_0x330b65,_0x5b0953){var _0x48811e={'raw':![],'where':{'id':_0x330b65['params']['id']}},_0x16e93f={};_0x16e93f['model']=_[_0x71c6('0x3a')](db[_0x71c6('0x35')][_0x71c6('0x4d')]);_0x16e93f[_0x71c6('0x39')]=_[_0x71c6('0x3a')](_0x330b65[_0x71c6('0x39')]);_0x16e93f[_0x71c6('0x3b')]=_[_0x71c6('0x3c')](_0x16e93f[_0x71c6('0x38')],_0x16e93f[_0x71c6('0x39')]);_0x48811e[_0x71c6('0x3d')]=_[_0x71c6('0x3c')](_0x16e93f[_0x71c6('0x38')],qs[_0x71c6('0x3e')](_0x330b65[_0x71c6('0x39')][_0x71c6('0x3e')]));_0x48811e[_0x71c6('0x3d')]=_0x48811e[_0x71c6('0x3d')][_0x71c6('0x3f')]?_0x48811e[_0x71c6('0x3d')]:_0x16e93f[_0x71c6('0x38')];if(_0x330b65[_0x71c6('0x39')]['includeAll']){_0x48811e['include']=[{'all':!![]}];}_0x48811e=_[_0x71c6('0x46')]({},_0x48811e,_0x330b65['options']);return db[_0x71c6('0x35')][_0x71c6('0x4e')](_0x48811e)[_0x71c6('0x19')](handleEntityNotFound(_0x5b0953,null))[_0x71c6('0x19')](respondWithResult(_0x5b0953,null))['catch'](handleError(_0x5b0953,null));};exports['create']=function(_0x120073,_0x84d581){return db[_0x71c6('0x35')][_0x71c6('0x4f')](_0x120073[_0x71c6('0x50')],{})[_0x71c6('0x19')](respondWithResult(_0x84d581,0xc9))[_0x71c6('0x23')](handleError(_0x84d581,null));};exports[_0x71c6('0x30')]=function(_0xa12eb6,_0xc0168c){if(_0xa12eb6[_0x71c6('0x50')]['id']){delete _0xa12eb6[_0x71c6('0x50')]['id'];}return db[_0x71c6('0x35')][_0x71c6('0x4e')]({'where':{'id':_0xa12eb6[_0x71c6('0x51')]['id']}})['then'](handleEntityNotFound(_0xc0168c,null))['then'](saveUpdates(_0xa12eb6['body'],null))[_0x71c6('0x19')](respondWithResult(_0xc0168c,null))[_0x71c6('0x23')](handleError(_0xc0168c,null));};exports['destroy']=function(_0x5eb066,_0x327eb2){return db['VtigerConfiguration']['find']({'where':{'id':_0x5eb066[_0x71c6('0x51')]['id']}})[_0x71c6('0x19')](handleEntityNotFound(_0x327eb2,null))[_0x71c6('0x19')](removeEntity(_0x327eb2,null))[_0x71c6('0x23')](handleError(_0x327eb2,null));};exports[_0x71c6('0x52')]=function(_0x21351a,_0x48a0b3,_0x3c8e2e){var _0x105a22={};var _0x460fb6={};var _0x5ceb51;var _0x4aa6d1;return db[_0x71c6('0x35')][_0x71c6('0x53')]({'where':{'id':_0x21351a[_0x71c6('0x51')]['id']}})[_0x71c6('0x19')](handleEntityNotFound(_0x48a0b3,null))['then'](function(_0x5cc5fc){if(_0x5cc5fc){_0x5ceb51=_0x5cc5fc;_0x460fb6[_0x71c6('0x38')]=_[_0x71c6('0x3a')](db['VtigerField'][_0x71c6('0x4d')]);_0x460fb6[_0x71c6('0x39')]=_[_0x71c6('0x3a')](_0x21351a[_0x71c6('0x39')]);_0x460fb6[_0x71c6('0x3b')]=_[_0x71c6('0x3c')](_0x460fb6[_0x71c6('0x38')],_0x460fb6[_0x71c6('0x39')]);_0x105a22['attributes']=_[_0x71c6('0x3c')](_0x460fb6[_0x71c6('0x38')],qs['fields'](_0x21351a[_0x71c6('0x39')][_0x71c6('0x3e')]));_0x105a22[_0x71c6('0x3d')]=_0x105a22[_0x71c6('0x3d')]['length']?_0x105a22[_0x71c6('0x3d')]:_0x460fb6[_0x71c6('0x38')];_0x105a22[_0x71c6('0x42')]=qs[_0x71c6('0x43')](_0x21351a[_0x71c6('0x39')]['sort']);_0x105a22[_0x71c6('0x44')]=qs[_0x71c6('0x3b')](_[_0x71c6('0x54')](_0x21351a[_0x71c6('0x39')],_0x460fb6[_0x71c6('0x3b')]));if(_0x21351a['query'][_0x71c6('0x45')]){_0x105a22['where']=_[_0x71c6('0x46')](_0x105a22['where'],{'$or':_[_0x71c6('0x34')](_0x105a22[_0x71c6('0x3d')],function(_0x26eead){var _0x2b7dd7={};_0x2b7dd7[_0x26eead]={'$like':'%'+_0x21351a[_0x71c6('0x39')][_0x71c6('0x45')]+'%'};return _0x2b7dd7;})});}_0x105a22=_[_0x71c6('0x46')]({},_0x105a22,_0x21351a['options']);return _0x5ceb51[_0x71c6('0x52')](_0x105a22);}})[_0x71c6('0x19')](function(_0x59d60e){if(_0x59d60e){_0x4aa6d1=_0x59d60e[_0x71c6('0x3f')];if(!_0x21351a[_0x71c6('0x39')][_0x71c6('0x40')]('nolimit')){_0x105a22[_0x71c6('0x2a')]=qs['limit'](_0x21351a[_0x71c6('0x39')][_0x71c6('0x2a')]);_0x105a22[_0x71c6('0x27')]=qs[_0x71c6('0x27')](_0x21351a[_0x71c6('0x39')][_0x71c6('0x27')]);}return _0x5ceb51[_0x71c6('0x52')](_0x105a22);}})['then'](function(_0x5bb5a6){if(_0x5bb5a6){return _0x5bb5a6?{'count':_0x4aa6d1,'rows':_0x5bb5a6}:null;}})[_0x71c6('0x19')](respondWithResult(_0x48a0b3,null))[_0x71c6('0x23')](handleError(_0x48a0b3,null));};exports[_0x71c6('0x55')]=function(_0x339fb7,_0x193d02,_0x3817c8){var _0x5f2419={};var _0x20a768={};var _0x243dd5;var _0x4927ad;return db[_0x71c6('0x35')]['findOne']({'where':{'id':_0x339fb7[_0x71c6('0x51')]['id']}})[_0x71c6('0x19')](handleEntityNotFound(_0x193d02,null))[_0x71c6('0x19')](function(_0x556681){if(_0x556681){_0x243dd5=_0x556681;_0x20a768[_0x71c6('0x38')]=_['keys'](db['VtigerField']['rawAttributes']);_0x20a768[_0x71c6('0x39')]=_[_0x71c6('0x3a')](_0x339fb7['query']);_0x20a768[_0x71c6('0x3b')]=_[_0x71c6('0x3c')](_0x20a768[_0x71c6('0x38')],_0x20a768[_0x71c6('0x39')]);_0x5f2419[_0x71c6('0x3d')]=_[_0x71c6('0x3c')](_0x20a768['model'],qs['fields'](_0x339fb7[_0x71c6('0x39')]['fields']));_0x5f2419[_0x71c6('0x3d')]=_0x5f2419[_0x71c6('0x3d')][_0x71c6('0x3f')]?_0x5f2419[_0x71c6('0x3d')]:_0x20a768[_0x71c6('0x38')];_0x5f2419[_0x71c6('0x42')]=qs[_0x71c6('0x43')](_0x339fb7[_0x71c6('0x39')][_0x71c6('0x43')]);_0x5f2419[_0x71c6('0x44')]=qs['filters'](_[_0x71c6('0x54')](_0x339fb7[_0x71c6('0x39')],_0x20a768[_0x71c6('0x3b')]));if(_0x339fb7[_0x71c6('0x39')][_0x71c6('0x45')]){_0x5f2419[_0x71c6('0x44')]=_['merge'](_0x5f2419['where'],{'$or':_[_0x71c6('0x34')](_0x5f2419[_0x71c6('0x3d')],function(_0x5be9d2){var _0x188d4e={};_0x188d4e[_0x5be9d2]={'$like':'%'+_0x339fb7[_0x71c6('0x39')][_0x71c6('0x45')]+'%'};return _0x188d4e;})});}_0x5f2419=_[_0x71c6('0x46')]({},_0x5f2419,_0x339fb7['options']);return _0x243dd5[_0x71c6('0x55')](_0x5f2419);}})[_0x71c6('0x19')](function(_0x244db0){if(_0x244db0){_0x4927ad=_0x244db0['length'];if(!_0x339fb7['query'][_0x71c6('0x40')](_0x71c6('0x41'))){_0x5f2419[_0x71c6('0x2a')]=qs[_0x71c6('0x2a')](_0x339fb7['query'][_0x71c6('0x2a')]);_0x5f2419[_0x71c6('0x27')]=qs[_0x71c6('0x27')](_0x339fb7[_0x71c6('0x39')][_0x71c6('0x27')]);}return _0x243dd5[_0x71c6('0x55')](_0x5f2419);}})[_0x71c6('0x19')](function(_0x3f4e44){if(_0x3f4e44){return _0x3f4e44?{'count':_0x4927ad,'rows':_0x3f4e44}:null;}})[_0x71c6('0x19')](respondWithResult(_0x193d02,null))['catch'](handleError(_0x193d02,null));};exports[_0x71c6('0x56')]=function(_0x758d39,_0x153821,_0x2e495d){var _0x3f5711={};var _0xe94815={};var _0xb17cc4;var _0x1e7217;return db[_0x71c6('0x35')][_0x71c6('0x53')]({'where':{'id':_0x758d39[_0x71c6('0x51')]['id']}})[_0x71c6('0x19')](handleEntityNotFound(_0x153821,null))[_0x71c6('0x19')](function(_0x4600c9){if(_0x4600c9){_0xb17cc4=_0x4600c9;_0xe94815[_0x71c6('0x38')]=_[_0x71c6('0x3a')](db['VtigerField'][_0x71c6('0x4d')]);_0xe94815['query']=_[_0x71c6('0x3a')](_0x758d39[_0x71c6('0x39')]);_0xe94815[_0x71c6('0x3b')]=_[_0x71c6('0x3c')](_0xe94815[_0x71c6('0x38')],_0xe94815[_0x71c6('0x39')]);_0x3f5711[_0x71c6('0x3d')]=_['intersection'](_0xe94815[_0x71c6('0x38')],qs[_0x71c6('0x3e')](_0x758d39['query'][_0x71c6('0x3e')]));_0x3f5711[_0x71c6('0x3d')]=_0x3f5711[_0x71c6('0x3d')][_0x71c6('0x3f')]?_0x3f5711[_0x71c6('0x3d')]:_0xe94815[_0x71c6('0x38')];_0x3f5711['order']=qs[_0x71c6('0x43')](_0x758d39['query'][_0x71c6('0x43')]);_0x3f5711[_0x71c6('0x44')]=qs[_0x71c6('0x3b')](_[_0x71c6('0x54')](_0x758d39[_0x71c6('0x39')],_0xe94815[_0x71c6('0x3b')]));if(_0x758d39['query'][_0x71c6('0x45')]){_0x3f5711['where']=_['merge'](_0x3f5711[_0x71c6('0x44')],{'$or':_['map'](_0x3f5711[_0x71c6('0x3d')],function(_0x2decac){var _0x5f52b={};_0x5f52b[_0x2decac]={'$like':'%'+_0x758d39[_0x71c6('0x39')][_0x71c6('0x45')]+'%'};return _0x5f52b;})});}_0x3f5711=_[_0x71c6('0x46')]({},_0x3f5711,_0x758d39[_0x71c6('0x48')]);return _0xb17cc4['getDescriptions'](_0x3f5711);}})[_0x71c6('0x19')](function(_0x3e1ea1){if(_0x3e1ea1){_0x1e7217=_0x3e1ea1[_0x71c6('0x3f')];if(!_0x758d39[_0x71c6('0x39')][_0x71c6('0x40')](_0x71c6('0x41'))){_0x3f5711[_0x71c6('0x2a')]=qs['limit'](_0x758d39[_0x71c6('0x39')][_0x71c6('0x2a')]);_0x3f5711[_0x71c6('0x27')]=qs[_0x71c6('0x27')](_0x758d39[_0x71c6('0x39')][_0x71c6('0x27')]);}return _0xb17cc4[_0x71c6('0x56')](_0x3f5711);}})[_0x71c6('0x19')](function(_0x536d51){if(_0x536d51){return _0x536d51?{'count':_0x1e7217,'rows':_0x536d51}:null;}})[_0x71c6('0x19')](respondWithResult(_0x153821,null))[_0x71c6('0x23')](handleError(_0x153821,null));}; \ No newline at end of file +var _0x3694=['squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','client','http','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','save','update','destroy','then','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','VtigerConfiguration','findAll','rows','catch','show','params','rawAttributes','create','body','find','getFields','VtigerField','findOne','getSubjects','getDescriptions','eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x96be88,_0x2c01a4){var _0x1c14c0=function(_0x20aeff){while(--_0x20aeff){_0x96be88['push'](_0x96be88['shift']());}};_0x1c14c0(++_0x2c01a4);}(_0x3694,0x1ae));var _0x4369=function(_0x514714,_0x224dcf){_0x514714=_0x514714-0x0;var _0x23f4c2=_0x3694[_0x514714];return _0x23f4c2;};'use strict';var emlformat=require(_0x4369('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4369('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4369('0x2'));var moment=require(_0x4369('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4369('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4369('0x5'));var csv=require(_0x4369('0x6'));var ejs=require(_0x4369('0x7'));var fs=require('fs');var fs_extra=require(_0x4369('0x8'));var _=require(_0x4369('0x9'));var squel=require(_0x4369('0xa'));var crypto=require('crypto');var jsforce=require(_0x4369('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4369('0x6'));var querystring=require('querystring');var Papa=require(_0x4369('0xc'));var Redis=require(_0x4369('0xd'));var authService=require(_0x4369('0xe'));var qs=require(_0x4369('0xf'));var as=require(_0x4369('0x10'));var hardwareService=require(_0x4369('0x11'));var logger=require(_0x4369('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x4369('0x13'));var licenseUtil=require(_0x4369('0x14'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x4369('0x15')][_0x4369('0x16')]({'port':0x232a});function respondWithRpcPromise(_0xa8d239,_0x2f412c,_0xe076a7,_0x223298){return new BPromise(function(_0x21c1a9,_0x22653f){var _0x31d0f8=_0x223298||client;return _0x31d0f8['request'](_0xa8d239,_0xe076a7)['then'](function(_0x58bfae){logger[_0x4369('0x17')](_0x4369('0x18'),_0x2f412c,'request\x20sent');logger[_0x4369('0x19')](_0x4369('0x1a'),_0x2f412c,_0x4369('0x1b'),JSON[_0x4369('0x1c')](_0x58bfae));if(_0x58bfae[_0x4369('0x1d')]){if(_0x58bfae[_0x4369('0x1d')][_0x4369('0x1e')]===0x1f4){logger['error'](_0x4369('0x18'),_0x2f412c,_0x58bfae[_0x4369('0x1d')][_0x4369('0x1f')]);return _0x22653f(_0x58bfae['error']['message']);}logger[_0x4369('0x1d')](_0x4369('0x18'),_0x2f412c,_0x58bfae['error'][_0x4369('0x1f')]);return _0x21c1a9(_0x58bfae[_0x4369('0x1d')]['message']);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x2f412c,_0x4369('0x1b'));_0x21c1a9(_0x58bfae[_0x4369('0x20')][_0x4369('0x1f')]);}})['catch'](function(_0x21fa3f){logger[_0x4369('0x1d')](_0x4369('0x18'),_0x2f412c,_0x21fa3f);_0x22653f(_0x21fa3f);});});}function respondWithStatusCode(_0x323159,_0x343e65){_0x343e65=_0x343e65||0xcc;return function(_0x24608d){if(_0x24608d){return _0x323159[_0x4369('0x21')](_0x343e65);}return _0x323159['status'](_0x343e65)[_0x4369('0x22')]();};}function respondWithResult(_0xa6c2de,_0xb2d868){_0xb2d868=_0xb2d868||0xc8;return function(_0x277496){if(_0x277496){return _0xa6c2de[_0x4369('0x23')](_0xb2d868)['json'](_0x277496);}};}function respondWithFilteredResult(_0x369049,_0xe09e7b){return function(_0x754fba){if(_0x754fba){var _0x2151d3=typeof _0xe09e7b[_0x4369('0x24')]===_0x4369('0x25')&&typeof _0xe09e7b['limit']===_0x4369('0x25');var _0xab0cb3=_0x754fba['count'];var _0x30f976=_0x2151d3?0x0:_0xe09e7b[_0x4369('0x24')];var _0x5409a2=_0x2151d3?_0x754fba[_0x4369('0x26')]:_0xe09e7b[_0x4369('0x24')]+_0xe09e7b[_0x4369('0x27')];var _0x27a339;if(_0x5409a2>=_0xab0cb3){_0x5409a2=_0xab0cb3;_0x27a339=0xc8;}else{_0x27a339=0xce;}_0x369049[_0x4369('0x23')](_0x27a339);return _0x369049[_0x4369('0x28')](_0x4369('0x29'),_0x30f976+'-'+_0x5409a2+'/'+_0xab0cb3)[_0x4369('0x2a')](_0x754fba);}return null;};}function patchUpdates(_0x2cd406){return function(_0x380d2b){try{jsonpatch['apply'](_0x380d2b,_0x2cd406,!![]);}catch(_0x3a0283){return BPromise['reject'](_0x3a0283);}return _0x380d2b[_0x4369('0x2b')]();};}function saveUpdates(_0x37ab77,_0x62e82c){return function(_0x475638){if(_0x475638){return _0x475638[_0x4369('0x2c')](_0x37ab77)['then'](function(_0x1b5b83){return _0x1b5b83;});}return null;};}function removeEntity(_0xe9cc1a,_0x311b07){return function(_0x1d4201){if(_0x1d4201){return _0x1d4201[_0x4369('0x2d')]()[_0x4369('0x2e')](function(){_0xe9cc1a[_0x4369('0x23')](0xcc)[_0x4369('0x22')]();});}};}function handleEntityNotFound(_0x13ddd9,_0x418a42){return function(_0x35d049){if(!_0x35d049){_0x13ddd9[_0x4369('0x21')](0x194);}return _0x35d049;};}function handleError(_0x2406c8,_0x56ee4b){_0x56ee4b=_0x56ee4b||0x1f4;return function(_0x5b5053){logger[_0x4369('0x1d')](_0x5b5053[_0x4369('0x2f')]);if(_0x5b5053['name']){delete _0x5b5053[_0x4369('0x30')];}_0x2406c8[_0x4369('0x23')](_0x56ee4b)[_0x4369('0x31')](_0x5b5053);};}exports[_0x4369('0x32')]=function(_0x464828,_0x428967){var _0x51f4c6={},_0x1f93ea={},_0x459b14={'count':0x0,'rows':[]};var _0x5e6edc=_[_0x4369('0x33')](db['VtigerConfiguration']['rawAttributes'],function(_0x3fda3f){return{'name':_0x3fda3f[_0x4369('0x34')],'type':_0x3fda3f[_0x4369('0x35')]['key']};});_0x1f93ea[_0x4369('0x36')]=_['map'](_0x5e6edc,_0x4369('0x30'));_0x1f93ea[_0x4369('0x37')]=_[_0x4369('0x38')](_0x464828[_0x4369('0x37')]);_0x1f93ea[_0x4369('0x39')]=_[_0x4369('0x3a')](_0x1f93ea[_0x4369('0x36')],_0x1f93ea[_0x4369('0x37')]);_0x51f4c6[_0x4369('0x3b')]=_[_0x4369('0x3a')](_0x1f93ea[_0x4369('0x36')],qs[_0x4369('0x3c')](_0x464828[_0x4369('0x37')][_0x4369('0x3c')]));_0x51f4c6[_0x4369('0x3b')]=_0x51f4c6['attributes'][_0x4369('0x3d')]?_0x51f4c6[_0x4369('0x3b')]:_0x1f93ea[_0x4369('0x36')];if(!_0x464828[_0x4369('0x37')][_0x4369('0x3e')](_0x4369('0x3f'))){_0x51f4c6[_0x4369('0x27')]=qs[_0x4369('0x27')](_0x464828['query']['limit']);_0x51f4c6[_0x4369('0x24')]=qs[_0x4369('0x24')](_0x464828[_0x4369('0x37')]['offset']);}_0x51f4c6[_0x4369('0x40')]=qs[_0x4369('0x41')](_0x464828['query'][_0x4369('0x41')]);_0x51f4c6[_0x4369('0x42')]=qs[_0x4369('0x39')](_[_0x4369('0x43')](_0x464828[_0x4369('0x37')],_0x1f93ea[_0x4369('0x39')]),_0x5e6edc);if(_0x464828[_0x4369('0x37')][_0x4369('0x44')]){_0x51f4c6[_0x4369('0x42')]=_[_0x4369('0x45')](_0x51f4c6[_0x4369('0x42')],{'$or':_[_0x4369('0x33')](_0x5e6edc,function(_0x355bda){if(_0x355bda['type']!==_0x4369('0x46')){var _0x4f5c54={};_0x4f5c54[_0x355bda[_0x4369('0x30')]]={'$like':'%'+_0x464828[_0x4369('0x37')][_0x4369('0x44')]+'%'};return _0x4f5c54;}})});}_0x51f4c6=_[_0x4369('0x45')]({},_0x51f4c6,_0x464828[_0x4369('0x47')]);var _0x39dcc1={'where':_0x51f4c6['where']};return db['VtigerConfiguration'][_0x4369('0x26')](_0x39dcc1)[_0x4369('0x2e')](function(_0x24487f){_0x459b14['count']=_0x24487f;if(_0x464828['query']['includeAll']){_0x51f4c6[_0x4369('0x48')]=[{'all':!![]}];}return db[_0x4369('0x49')][_0x4369('0x4a')](_0x51f4c6);})['then'](function(_0x34180d){_0x459b14[_0x4369('0x4b')]=_0x34180d;return _0x459b14;})['then'](respondWithFilteredResult(_0x428967,_0x51f4c6))[_0x4369('0x4c')](handleError(_0x428967,null));};exports[_0x4369('0x4d')]=function(_0x2ce1c0,_0x42a9eb){var _0x70c043={'raw':![],'where':{'id':_0x2ce1c0[_0x4369('0x4e')]['id']}},_0x543769={};_0x543769[_0x4369('0x36')]=_[_0x4369('0x38')](db[_0x4369('0x49')][_0x4369('0x4f')]);_0x543769[_0x4369('0x37')]=_[_0x4369('0x38')](_0x2ce1c0['query']);_0x543769[_0x4369('0x39')]=_[_0x4369('0x3a')](_0x543769[_0x4369('0x36')],_0x543769[_0x4369('0x37')]);_0x70c043[_0x4369('0x3b')]=_[_0x4369('0x3a')](_0x543769['model'],qs[_0x4369('0x3c')](_0x2ce1c0['query'][_0x4369('0x3c')]));_0x70c043[_0x4369('0x3b')]=_0x70c043[_0x4369('0x3b')]['length']?_0x70c043[_0x4369('0x3b')]:_0x543769[_0x4369('0x36')];if(_0x2ce1c0[_0x4369('0x37')]['includeAll']){_0x70c043[_0x4369('0x48')]=[{'all':!![]}];}_0x70c043=_[_0x4369('0x45')]({},_0x70c043,_0x2ce1c0[_0x4369('0x47')]);return db[_0x4369('0x49')]['find'](_0x70c043)[_0x4369('0x2e')](handleEntityNotFound(_0x42a9eb,null))['then'](respondWithResult(_0x42a9eb,null))['catch'](handleError(_0x42a9eb,null));};exports[_0x4369('0x50')]=function(_0x157244,_0x55b190){return db['VtigerConfiguration']['create'](_0x157244[_0x4369('0x51')],{})['then'](respondWithResult(_0x55b190,0xc9))[_0x4369('0x4c')](handleError(_0x55b190,null));};exports[_0x4369('0x2c')]=function(_0x1ecb59,_0x10d249){if(_0x1ecb59[_0x4369('0x51')]['id']){delete _0x1ecb59[_0x4369('0x51')]['id'];}return db[_0x4369('0x49')][_0x4369('0x52')]({'where':{'id':_0x1ecb59[_0x4369('0x4e')]['id']}})[_0x4369('0x2e')](handleEntityNotFound(_0x10d249,null))[_0x4369('0x2e')](saveUpdates(_0x1ecb59[_0x4369('0x51')],null))['then'](respondWithResult(_0x10d249,null))['catch'](handleError(_0x10d249,null));};exports[_0x4369('0x2d')]=function(_0x366a7b,_0x203eae){return db[_0x4369('0x49')]['find']({'where':{'id':_0x366a7b[_0x4369('0x4e')]['id']}})[_0x4369('0x2e')](handleEntityNotFound(_0x203eae,null))[_0x4369('0x2e')](removeEntity(_0x203eae,null))[_0x4369('0x4c')](handleError(_0x203eae,null));};exports[_0x4369('0x53')]=function(_0x18ba79,_0x3aa8e8,_0xf1cb7){var _0x26bb96={};var _0x47626c={};var _0x2cd102;var _0x392859;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x18ba79[_0x4369('0x4e')]['id']}})[_0x4369('0x2e')](handleEntityNotFound(_0x3aa8e8,null))[_0x4369('0x2e')](function(_0x5d4c30){if(_0x5d4c30){_0x2cd102=_0x5d4c30;_0x47626c['model']=_[_0x4369('0x38')](db[_0x4369('0x54')]['rawAttributes']);_0x47626c[_0x4369('0x37')]=_[_0x4369('0x38')](_0x18ba79['query']);_0x47626c[_0x4369('0x39')]=_['intersection'](_0x47626c['model'],_0x47626c[_0x4369('0x37')]);_0x26bb96[_0x4369('0x3b')]=_[_0x4369('0x3a')](_0x47626c[_0x4369('0x36')],qs[_0x4369('0x3c')](_0x18ba79[_0x4369('0x37')][_0x4369('0x3c')]));_0x26bb96[_0x4369('0x3b')]=_0x26bb96[_0x4369('0x3b')][_0x4369('0x3d')]?_0x26bb96[_0x4369('0x3b')]:_0x47626c[_0x4369('0x36')];_0x26bb96[_0x4369('0x40')]=qs[_0x4369('0x41')](_0x18ba79[_0x4369('0x37')][_0x4369('0x41')]);_0x26bb96['where']=qs[_0x4369('0x39')](_[_0x4369('0x43')](_0x18ba79['query'],_0x47626c[_0x4369('0x39')]));if(_0x18ba79['query']['filter']){_0x26bb96[_0x4369('0x42')]=_['merge'](_0x26bb96['where'],{'$or':_[_0x4369('0x33')](_0x26bb96['attributes'],function(_0xb008a7){var _0x2f22da={};_0x2f22da[_0xb008a7]={'$like':'%'+_0x18ba79[_0x4369('0x37')][_0x4369('0x44')]+'%'};return _0x2f22da;})});}_0x26bb96=_['merge']({},_0x26bb96,_0x18ba79[_0x4369('0x47')]);return _0x2cd102[_0x4369('0x53')](_0x26bb96);}})[_0x4369('0x2e')](function(_0x3e4e6b){if(_0x3e4e6b){_0x392859=_0x3e4e6b[_0x4369('0x3d')];if(!_0x18ba79['query'][_0x4369('0x3e')](_0x4369('0x3f'))){_0x26bb96[_0x4369('0x27')]=qs[_0x4369('0x27')](_0x18ba79[_0x4369('0x37')]['limit']);_0x26bb96[_0x4369('0x24')]=qs['offset'](_0x18ba79[_0x4369('0x37')][_0x4369('0x24')]);}return _0x2cd102[_0x4369('0x53')](_0x26bb96);}})[_0x4369('0x2e')](function(_0x5905f2){if(_0x5905f2){return _0x5905f2?{'count':_0x392859,'rows':_0x5905f2}:null;}})[_0x4369('0x2e')](respondWithResult(_0x3aa8e8,null))[_0x4369('0x4c')](handleError(_0x3aa8e8,null));};exports['getSubjects']=function(_0x37d610,_0x32d079,_0x42a1b5){var _0x522da5={};var _0x24f3ab={};var _0x1b9ba5;var _0x56d54;return db[_0x4369('0x49')][_0x4369('0x55')]({'where':{'id':_0x37d610[_0x4369('0x4e')]['id']}})[_0x4369('0x2e')](handleEntityNotFound(_0x32d079,null))[_0x4369('0x2e')](function(_0x22ad7f){if(_0x22ad7f){_0x1b9ba5=_0x22ad7f;_0x24f3ab[_0x4369('0x36')]=_[_0x4369('0x38')](db['VtigerField'][_0x4369('0x4f')]);_0x24f3ab[_0x4369('0x37')]=_[_0x4369('0x38')](_0x37d610[_0x4369('0x37')]);_0x24f3ab[_0x4369('0x39')]=_['intersection'](_0x24f3ab[_0x4369('0x36')],_0x24f3ab[_0x4369('0x37')]);_0x522da5[_0x4369('0x3b')]=_[_0x4369('0x3a')](_0x24f3ab['model'],qs[_0x4369('0x3c')](_0x37d610['query'][_0x4369('0x3c')]));_0x522da5[_0x4369('0x3b')]=_0x522da5[_0x4369('0x3b')][_0x4369('0x3d')]?_0x522da5['attributes']:_0x24f3ab[_0x4369('0x36')];_0x522da5[_0x4369('0x40')]=qs[_0x4369('0x41')](_0x37d610[_0x4369('0x37')][_0x4369('0x41')]);_0x522da5[_0x4369('0x42')]=qs[_0x4369('0x39')](_['pick'](_0x37d610[_0x4369('0x37')],_0x24f3ab[_0x4369('0x39')]));if(_0x37d610[_0x4369('0x37')][_0x4369('0x44')]){_0x522da5['where']=_[_0x4369('0x45')](_0x522da5[_0x4369('0x42')],{'$or':_[_0x4369('0x33')](_0x522da5[_0x4369('0x3b')],function(_0x48a3ef){var _0x530afc={};_0x530afc[_0x48a3ef]={'$like':'%'+_0x37d610[_0x4369('0x37')][_0x4369('0x44')]+'%'};return _0x530afc;})});}_0x522da5=_[_0x4369('0x45')]({},_0x522da5,_0x37d610[_0x4369('0x47')]);return _0x1b9ba5[_0x4369('0x56')](_0x522da5);}})['then'](function(_0x27c359){if(_0x27c359){_0x56d54=_0x27c359[_0x4369('0x3d')];if(!_0x37d610[_0x4369('0x37')][_0x4369('0x3e')](_0x4369('0x3f'))){_0x522da5[_0x4369('0x27')]=qs[_0x4369('0x27')](_0x37d610[_0x4369('0x37')][_0x4369('0x27')]);_0x522da5['offset']=qs[_0x4369('0x24')](_0x37d610[_0x4369('0x37')][_0x4369('0x24')]);}return _0x1b9ba5['getSubjects'](_0x522da5);}})['then'](function(_0x9bc40c){if(_0x9bc40c){return _0x9bc40c?{'count':_0x56d54,'rows':_0x9bc40c}:null;}})['then'](respondWithResult(_0x32d079,null))[_0x4369('0x4c')](handleError(_0x32d079,null));};exports['getDescriptions']=function(_0x1859c6,_0x522a31,_0x46cb0b){var _0x3e840e={};var _0x176cb3={};var _0x249922;var _0x5a1e27;return db[_0x4369('0x49')][_0x4369('0x55')]({'where':{'id':_0x1859c6[_0x4369('0x4e')]['id']}})['then'](handleEntityNotFound(_0x522a31,null))[_0x4369('0x2e')](function(_0x33a550){if(_0x33a550){_0x249922=_0x33a550;_0x176cb3['model']=_[_0x4369('0x38')](db[_0x4369('0x54')][_0x4369('0x4f')]);_0x176cb3['query']=_['keys'](_0x1859c6['query']);_0x176cb3[_0x4369('0x39')]=_[_0x4369('0x3a')](_0x176cb3[_0x4369('0x36')],_0x176cb3[_0x4369('0x37')]);_0x3e840e[_0x4369('0x3b')]=_[_0x4369('0x3a')](_0x176cb3[_0x4369('0x36')],qs['fields'](_0x1859c6[_0x4369('0x37')][_0x4369('0x3c')]));_0x3e840e['attributes']=_0x3e840e[_0x4369('0x3b')][_0x4369('0x3d')]?_0x3e840e[_0x4369('0x3b')]:_0x176cb3['model'];_0x3e840e['order']=qs[_0x4369('0x41')](_0x1859c6[_0x4369('0x37')][_0x4369('0x41')]);_0x3e840e['where']=qs['filters'](_[_0x4369('0x43')](_0x1859c6[_0x4369('0x37')],_0x176cb3[_0x4369('0x39')]));if(_0x1859c6[_0x4369('0x37')][_0x4369('0x44')]){_0x3e840e[_0x4369('0x42')]=_[_0x4369('0x45')](_0x3e840e[_0x4369('0x42')],{'$or':_[_0x4369('0x33')](_0x3e840e[_0x4369('0x3b')],function(_0x53baf6){var _0x40647e={};_0x40647e[_0x53baf6]={'$like':'%'+_0x1859c6[_0x4369('0x37')][_0x4369('0x44')]+'%'};return _0x40647e;})});}_0x3e840e=_['merge']({},_0x3e840e,_0x1859c6[_0x4369('0x47')]);return _0x249922['getDescriptions'](_0x3e840e);}})[_0x4369('0x2e')](function(_0x4eccb0){if(_0x4eccb0){_0x5a1e27=_0x4eccb0['length'];if(!_0x1859c6[_0x4369('0x37')][_0x4369('0x3e')](_0x4369('0x3f'))){_0x3e840e['limit']=qs[_0x4369('0x27')](_0x1859c6[_0x4369('0x37')][_0x4369('0x27')]);_0x3e840e[_0x4369('0x24')]=qs[_0x4369('0x24')](_0x1859c6[_0x4369('0x37')][_0x4369('0x24')]);}return _0x249922[_0x4369('0x57')](_0x3e840e);}})[_0x4369('0x2e')](function(_0x5914b3){if(_0x5914b3){return _0x5914b3?{'count':_0x5a1e27,'rows':_0x5914b3}:null;}})[_0x4369('0x2e')](respondWithResult(_0x522a31,null))['catch'](handleError(_0x522a31,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index e069504..d5f4013 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 _0xa3b1=['moment','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','lodash','util','../../config/logger','api'];(function(_0x4baa6d,_0x5e7794){var _0x537716=function(_0x200197){while(--_0x200197){_0x4baa6d['push'](_0x4baa6d['shift']());}};_0x537716(++_0x5e7794);}(_0xa3b1,0x1b6));var _0x1a3b=function(_0x40b0b9,_0x59cd60){_0x40b0b9=_0x40b0b9-0x0;var _0x28e0e2=_0xa3b1[_0x40b0b9];return _0x28e0e2;};'use strict';var _=require(_0x1a3b('0x0'));var util=require(_0x1a3b('0x1'));var logger=require(_0x1a3b('0x2'))(_0x1a3b('0x3'));var moment=require(_0x1a3b('0x4'));var BPromise=require('bluebird');var rp=require(_0x1a3b('0x5'));var fs=require('fs');var path=require(_0x1a3b('0x6'));var rimraf=require(_0x1a3b('0x7'));var config=require(_0x1a3b('0x8'));var attributes=require(_0x1a3b('0x9'));module[_0x1a3b('0xa')]=function(_0x33a1d0,_0x49e472){return _0x33a1d0[_0x1a3b('0xb')]('VtigerConfiguration',attributes,{'tableName':_0x1a3b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x964f=['request-promise','rimraf','../../config/environment','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger','bluebird'];(function(_0x52d0f6,_0x38a8e8){var _0x15e5b9=function(_0x556f47){while(--_0x556f47){_0x52d0f6['push'](_0x52d0f6['shift']());}};_0x15e5b9(++_0x38a8e8);}(_0x964f,0xa7));var _0xf964=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x964f[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xf964('0x0'));var util=require('util');var logger=require(_0xf964('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf964('0x2'));var rp=require(_0xf964('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf964('0x4'));var config=require(_0xf964('0x5'));var attributes=require('./intVtigerConfiguration.attributes');module[_0xf964('0x6')]=function(_0x69d5a5,_0x3ecb73){return _0x69d5a5[_0xf964('0x7')](_0xf964('0x8'),attributes,{'tableName':_0xf964('0x9'),'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 882ea09..ec3ad89 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 _0x8717=['error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x550d26,_0x1c36e9){var _0x38027d=function(_0x293f72){while(--_0x293f72){_0x550d26['push'](_0x550d26['shift']());}};_0x38027d(++_0x1c36e9);}(_0x8717,0x181));var _0x7871=function(_0x507ea9,_0x5894e9){_0x507ea9=_0x507ea9-0x0;var _0x8abb72=_0x8717[_0x507ea9];return _0x8abb72;};'use strict';var _=require(_0x7871('0x0'));var util=require(_0x7871('0x1'));var moment=require(_0x7871('0x2'));var BPromise=require(_0x7871('0x3'));var rs=require(_0x7871('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7871('0x5'))['db'];var utils=require(_0x7871('0x6'));var logger=require(_0x7871('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7871('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c89df,_0x20d3fe,_0x5c3d50){return new BPromise(function(_0x2d3a4f,_0x232583){return client['request'](_0x2c89df,_0x5c3d50)[_0x7871('0x9')](function(_0x3b1323){logger['info'](_0x7871('0xa'),_0x20d3fe,_0x7871('0xb'));logger['debug'](_0x7871('0xc'),_0x20d3fe,_0x7871('0xb'),JSON[_0x7871('0xd')](_0x3b1323));if(_0x3b1323[_0x7871('0xe')]){if(_0x3b1323[_0x7871('0xe')][_0x7871('0xf')]===0x1f4){logger[_0x7871('0xe')](_0x7871('0xa'),_0x20d3fe,_0x3b1323[_0x7871('0xe')][_0x7871('0x10')]);return _0x232583(_0x3b1323[_0x7871('0xe')][_0x7871('0x10')]);}logger[_0x7871('0xe')](_0x7871('0xa'),_0x20d3fe,_0x3b1323['error']['message']);return _0x2d3a4f(_0x3b1323[_0x7871('0xe')][_0x7871('0x10')]);}else{logger[_0x7871('0x11')](_0x7871('0xa'),_0x20d3fe,_0x7871('0xb'));_0x2d3a4f(_0x3b1323['result'][_0x7871('0x10')]);}})[_0x7871('0x12')](function(_0x4223f9){logger[_0x7871('0xe')](_0x7871('0xa'),_0x20d3fe,_0x4223f9);_0x232583(_0x4223f9);});});} \ No newline at end of file +var _0x4682=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x54c695,_0x5d6677){var _0x3ce06b=function(_0x55bdf1){while(--_0x55bdf1){_0x54c695['push'](_0x54c695['shift']());}};_0x3ce06b(++_0x5d6677);}(_0x4682,0x15f));var _0x2468=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x4682[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require('lodash');var util=require(_0x2468('0x0'));var moment=require('moment');var BPromise=require(_0x2468('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2468('0x2'));var db=require(_0x2468('0x3'))['db'];var utils=require(_0x2468('0x4'));var logger=require(_0x2468('0x5'))('rpc');var config=require(_0x2468('0x6'));var jayson=require(_0x2468('0x7'));var client=jayson['client'][_0x2468('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x9ab7dd,_0x116973,_0x5f4439){return new BPromise(function(_0x3d606a,_0x45d68f){return client[_0x2468('0x9')](_0x9ab7dd,_0x5f4439)[_0x2468('0xa')](function(_0x1ec8fd){logger[_0x2468('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x116973,_0x2468('0xc'));logger[_0x2468('0xd')](_0x2468('0xe'),_0x116973,'request\x20sent',JSON[_0x2468('0xf')](_0x1ec8fd));if(_0x1ec8fd[_0x2468('0x10')]){if(_0x1ec8fd[_0x2468('0x10')]['code']===0x1f4){logger[_0x2468('0x10')](_0x2468('0x11'),_0x116973,_0x1ec8fd['error'][_0x2468('0x12')]);return _0x45d68f(_0x1ec8fd['error']['message']);}logger['error'](_0x2468('0x11'),_0x116973,_0x1ec8fd[_0x2468('0x10')]['message']);return _0x3d606a(_0x1ec8fd[_0x2468('0x10')][_0x2468('0x12')]);}else{logger[_0x2468('0xb')](_0x2468('0x11'),_0x116973,_0x2468('0xc'));_0x3d606a(_0x1ec8fd[_0x2468('0x13')][_0x2468('0x12')]);}})[_0x2468('0x14')](function(_0x463f67){logger['error'](_0x2468('0x11'),_0x116973,_0x463f67);_0x45d68f(_0x463f67);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 00f46d4..2268b1d 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 _0xc4aa=['connect-timeout','express','Router','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','exports','multer','util','path'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xc')]);router[_0xac4a('0xd')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['destroy']);module[_0xac4a('0x10')]=router; \ No newline at end of file +var _0xc4aa=['connect-timeout','express','Router','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','exports','multer','util','path'];(function(_0x7ae92b,_0x153311){var _0x4599e1=function(_0x4b5108){while(--_0x4b5108){_0x7ae92b['push'](_0x7ae92b['shift']());}};_0x4599e1(++_0x153311);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xc4aa[_0x88cd7b];return _0x56fcc8;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xc')]);router[_0xac4a('0xd')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['destroy']);module[_0xac4a('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 5b77611..2c64148 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 _0x0a9a=['STRING','ENUM','BOOLEAN','exports','string','variable','customVariable','keyValue'];(function(_0x305d29,_0x5d5400){var _0x30e260=function(_0x551a36){while(--_0x551a36){_0x305d29['push'](_0x305d29['shift']());}};_0x30e260(++_0x5d5400);}(_0x0a9a,0x183));var _0xa0a9=function(_0x234457,_0xed3cd5){_0x234457=_0x234457-0x0;var _0x6a1ed6=_0x0a9a[_0x234457];return _0x6a1ed6;};'use strict';var Sequelize=require('sequelize');module[_0xa0a9('0x0')]={'type':{'type':Sequelize['ENUM'](_0xa0a9('0x1'),_0xa0a9('0x2'),_0xa0a9('0x3'),_0xa0a9('0x4'),'picklist'),'defaultValue':_0xa0a9('0x1')},'content':{'type':Sequelize[_0xa0a9('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa0a9('0x6')](_0xa0a9('0x1'),_0xa0a9('0x2'),_0xa0a9('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa0a9('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa0a9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa0a9('0x5')]}}; \ No newline at end of file +var _0xb6b1=['STRING','string','BOOLEAN','sequelize','ENUM','variable','customVariable','picklist'];(function(_0x348d93,_0x39bccb){var _0xa59df6=function(_0x2d1803){while(--_0x2d1803){_0x348d93['push'](_0x348d93['shift']());}};_0xa59df6(++_0x39bccb);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0xb6b1[_0x1e6db3];return _0x1de886;};'use strict';var Sequelize=require(_0x1b6b('0x0'));module['exports']={'type':{'type':Sequelize[_0x1b6b('0x1')]('string',_0x1b6b('0x2'),_0x1b6b('0x3'),'keyValue',_0x1b6b('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1b6b('0x5')]},'key':{'type':Sequelize[_0x1b6b('0x5')]},'keyType':{'type':Sequelize[_0x1b6b('0x1')](_0x1b6b('0x6'),'variable',_0x1b6b('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1b6b('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1b6b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1b6b('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 0d9c8c7..a6f1353 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 _0x512e=['pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','VtigerField','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where'];(function(_0x5aa0ce,_0x33e547){var _0x22b1df=function(_0x56dd69){while(--_0x56dd69){_0x5aa0ce['push'](_0x5aa0ce['shift']());}};_0x22b1df(++_0x33e547);}(_0x512e,0x14c));var _0xe512=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x512e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe512('0x0'));var rimraf=require(_0xe512('0x1'));var zipdir=require(_0xe512('0x2'));var jsonpatch=require(_0xe512('0x3'));var rp=require(_0xe512('0x4'));var moment=require(_0xe512('0x5'));var BPromise=require(_0xe512('0x6'));var Mustache=require(_0xe512('0x7'));var util=require(_0xe512('0x8'));var path=require(_0xe512('0x9'));var sox=require(_0xe512('0xa'));var csv=require(_0xe512('0xb'));var ejs=require(_0xe512('0xc'));var fs=require('fs');var fs_extra=require(_0xe512('0xd'));var _=require(_0xe512('0xe'));var squel=require(_0xe512('0xf'));var crypto=require(_0xe512('0x10'));var jsforce=require(_0xe512('0x11'));var deskjs=require(_0xe512('0x12'));var toCsv=require(_0xe512('0xb'));var querystring=require(_0xe512('0x13'));var Papa=require(_0xe512('0x14'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe512('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe512('0x16'))(_0xe512('0x17'));var utils=require('../../config/utils');var config=require(_0xe512('0x18'));var licenseUtil=require(_0xe512('0x19'));var db=require(_0xe512('0x1a'))['db'];function respondWithStatusCode(_0x1ccbdb,_0x589a63){_0x589a63=_0x589a63||0xcc;return function(_0x439f47){if(_0x439f47){return _0x1ccbdb[_0xe512('0x1b')](_0x589a63);}return _0x1ccbdb[_0xe512('0x1c')](_0x589a63)[_0xe512('0x1d')]();};}function respondWithResult(_0x57ce2b,_0x3142da){_0x3142da=_0x3142da||0xc8;return function(_0x180282){if(_0x180282){return _0x57ce2b[_0xe512('0x1c')](_0x3142da)[_0xe512('0x1e')](_0x180282);}};}function respondWithFilteredResult(_0x1ebad2,_0x5e59da){return function(_0x5c679b){if(_0x5c679b){var _0x1647ef=typeof _0x5e59da[_0xe512('0x1f')]===_0xe512('0x20')&&typeof _0x5e59da['limit']===_0xe512('0x20');var _0x1f21fd=_0x5c679b[_0xe512('0x21')];var _0x112119=_0x1647ef?0x0:_0x5e59da[_0xe512('0x1f')];var _0x1d2331=_0x1647ef?_0x5c679b[_0xe512('0x21')]:_0x5e59da[_0xe512('0x1f')]+_0x5e59da['limit'];var _0x535bee;if(_0x1d2331>=_0x1f21fd){_0x1d2331=_0x1f21fd;_0x535bee=0xc8;}else{_0x535bee=0xce;}_0x1ebad2['status'](_0x535bee);return _0x1ebad2[_0xe512('0x22')](_0xe512('0x23'),_0x112119+'-'+_0x1d2331+'/'+_0x1f21fd)['json'](_0x5c679b);}return null;};}function patchUpdates(_0x14fab1){return function(_0x4ad7f7){try{jsonpatch[_0xe512('0x24')](_0x4ad7f7,_0x14fab1,!![]);}catch(_0x12306e){return BPromise[_0xe512('0x25')](_0x12306e);}return _0x4ad7f7[_0xe512('0x26')]();};}function saveUpdates(_0xdb9064,_0x4e3d35){return function(_0x4b2dab){if(_0x4b2dab){return _0x4b2dab[_0xe512('0x27')](_0xdb9064)[_0xe512('0x28')](function(_0x337089){return _0x337089;});}return null;};}function removeEntity(_0x53b3f5,_0x1722a4){return function(_0x324497){if(_0x324497){return _0x324497[_0xe512('0x29')]()['then'](function(){_0x53b3f5[_0xe512('0x1c')](0xcc)[_0xe512('0x1d')]();});}};}function handleEntityNotFound(_0x47a3e9,_0x4dd708){return function(_0x16454b){if(!_0x16454b){_0x47a3e9[_0xe512('0x1b')](0x194);}return _0x16454b;};}function handleError(_0x379640,_0xc980b3){_0xc980b3=_0xc980b3||0x1f4;return function(_0x4c0e84){logger['error'](_0x4c0e84[_0xe512('0x2a')]);if(_0x4c0e84[_0xe512('0x2b')]){delete _0x4c0e84['name'];}_0x379640[_0xe512('0x1c')](_0xc980b3)[_0xe512('0x2c')](_0x4c0e84);};}exports['index']=function(_0x3ba487,_0x28aa65){var _0x3e13a3={},_0x4470c1={},_0x2b9d5c={'count':0x0,'rows':[]};var _0x2d266c=_[_0xe512('0x2d')](db[_0xe512('0x2e')][_0xe512('0x2f')],function(_0x536d93){return{'name':_0x536d93['fieldName'],'type':_0x536d93['type'][_0xe512('0x30')]};});_0x4470c1[_0xe512('0x31')]=_[_0xe512('0x2d')](_0x2d266c,_0xe512('0x2b'));_0x4470c1[_0xe512('0x32')]=_[_0xe512('0x33')](_0x3ba487[_0xe512('0x32')]);_0x4470c1[_0xe512('0x34')]=_[_0xe512('0x35')](_0x4470c1[_0xe512('0x31')],_0x4470c1[_0xe512('0x32')]);_0x3e13a3[_0xe512('0x36')]=_[_0xe512('0x35')](_0x4470c1['model'],qs[_0xe512('0x37')](_0x3ba487['query'][_0xe512('0x37')]));_0x3e13a3[_0xe512('0x36')]=_0x3e13a3[_0xe512('0x36')][_0xe512('0x38')]?_0x3e13a3[_0xe512('0x36')]:_0x4470c1[_0xe512('0x31')];if(!_0x3ba487['query'][_0xe512('0x39')](_0xe512('0x3a'))){_0x3e13a3[_0xe512('0x3b')]=qs[_0xe512('0x3b')](_0x3ba487[_0xe512('0x32')]['limit']);_0x3e13a3['offset']=qs[_0xe512('0x1f')](_0x3ba487[_0xe512('0x32')][_0xe512('0x1f')]);}_0x3e13a3[_0xe512('0x3c')]=qs['sort'](_0x3ba487[_0xe512('0x32')][_0xe512('0x3d')]);_0x3e13a3[_0xe512('0x3e')]=qs[_0xe512('0x34')](_[_0xe512('0x3f')](_0x3ba487[_0xe512('0x32')],_0x4470c1['filters']),_0x2d266c);if(_0x3ba487['query']['filter']){_0x3e13a3[_0xe512('0x3e')]=_[_0xe512('0x40')](_0x3e13a3[_0xe512('0x3e')],{'$or':_[_0xe512('0x2d')](_0x2d266c,function(_0x52aa50){if(_0x52aa50[_0xe512('0x41')]!==_0xe512('0x42')){var _0x483b19={};_0x483b19[_0x52aa50[_0xe512('0x2b')]]={'$like':'%'+_0x3ba487[_0xe512('0x32')][_0xe512('0x43')]+'%'};return _0x483b19;}})});}_0x3e13a3=_[_0xe512('0x40')]({},_0x3e13a3,_0x3ba487[_0xe512('0x44')]);var _0x4ea6ae={'where':_0x3e13a3['where']};return db[_0xe512('0x2e')][_0xe512('0x21')](_0x4ea6ae)['then'](function(_0x58a4e1){_0x2b9d5c[_0xe512('0x21')]=_0x58a4e1;if(_0x3ba487[_0xe512('0x32')][_0xe512('0x45')]){_0x3e13a3[_0xe512('0x46')]=[{'all':!![]}];}return db[_0xe512('0x2e')][_0xe512('0x47')](_0x3e13a3);})[_0xe512('0x28')](function(_0x239b06){_0x2b9d5c[_0xe512('0x48')]=_0x239b06;return _0x2b9d5c;})[_0xe512('0x28')](respondWithFilteredResult(_0x28aa65,_0x3e13a3))[_0xe512('0x49')](handleError(_0x28aa65,null));};exports[_0xe512('0x4a')]=function(_0x237543,_0x2a5bae){var _0xa90ab9={'raw':!![],'where':{'id':_0x237543[_0xe512('0x4b')]['id']}},_0x9bb812={};_0x9bb812[_0xe512('0x31')]=_[_0xe512('0x33')](db[_0xe512('0x2e')][_0xe512('0x2f')]);_0x9bb812['query']=_[_0xe512('0x33')](_0x237543[_0xe512('0x32')]);_0x9bb812[_0xe512('0x34')]=_[_0xe512('0x35')](_0x9bb812[_0xe512('0x31')],_0x9bb812[_0xe512('0x32')]);_0xa90ab9[_0xe512('0x36')]=_['intersection'](_0x9bb812[_0xe512('0x31')],qs[_0xe512('0x37')](_0x237543[_0xe512('0x32')][_0xe512('0x37')]));_0xa90ab9['attributes']=_0xa90ab9[_0xe512('0x36')]['length']?_0xa90ab9[_0xe512('0x36')]:_0x9bb812[_0xe512('0x31')];if(_0x237543[_0xe512('0x32')][_0xe512('0x45')]){_0xa90ab9[_0xe512('0x46')]=[{'all':!![]}];}_0xa90ab9=_[_0xe512('0x40')]({},_0xa90ab9,_0x237543['options']);return db['VtigerField'][_0xe512('0x4c')](_0xa90ab9)['then'](handleEntityNotFound(_0x2a5bae,null))[_0xe512('0x28')](respondWithResult(_0x2a5bae,null))[_0xe512('0x49')](handleError(_0x2a5bae,null));};exports['create']=function(_0x2a9f8b,_0x19d882){return db[_0xe512('0x2e')][_0xe512('0x4d')](_0x2a9f8b[_0xe512('0x4e')],{})[_0xe512('0x28')](respondWithResult(_0x19d882,0xc9))[_0xe512('0x49')](handleError(_0x19d882,null));};exports[_0xe512('0x27')]=function(_0x1e20c8,_0x385084){if(_0x1e20c8[_0xe512('0x4e')]['id']){delete _0x1e20c8[_0xe512('0x4e')]['id'];}return db[_0xe512('0x2e')]['find']({'where':{'id':_0x1e20c8['params']['id']}})[_0xe512('0x28')](handleEntityNotFound(_0x385084,null))[_0xe512('0x28')](saveUpdates(_0x1e20c8[_0xe512('0x4e')],null))[_0xe512('0x28')](respondWithResult(_0x385084,null))['catch'](handleError(_0x385084,null));};exports[_0xe512('0x29')]=function(_0x42ea69,_0x31c638){return db[_0xe512('0x2e')][_0xe512('0x4c')]({'where':{'id':_0x42ea69[_0xe512('0x4b')]['id']}})[_0xe512('0x28')](handleEntityNotFound(_0x31c638,null))[_0xe512('0x28')](removeEntity(_0x31c638,null))[_0xe512('0x49')](handleError(_0x31c638,null));}; \ No newline at end of file +var _0xada1=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','find','catch','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','keys','query','intersection','attributes','fields','length','model','nolimit','order','sort','where','filters'];(function(_0x12f98d,_0x1c3b5f){var _0x5c8d41=function(_0x15199d){while(--_0x15199d){_0x12f98d['push'](_0x12f98d['shift']());}};_0x5c8d41(++_0x1c3b5f);}(_0xada1,0x12d));var _0x1ada=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xada1[_0x2112d4];return _0x434972;};'use strict';var emlformat=require(_0x1ada('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1ada('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ada('0x2'));var moment=require(_0x1ada('0x3'));var BPromise=require(_0x1ada('0x4'));var Mustache=require(_0x1ada('0x5'));var util=require(_0x1ada('0x6'));var path=require(_0x1ada('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1ada('0x8'));var fs=require('fs');var fs_extra=require(_0x1ada('0x9'));var _=require('lodash');var squel=require(_0x1ada('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1ada('0xb'));var toCsv=require(_0x1ada('0xc'));var querystring=require('querystring');var Papa=require(_0x1ada('0xd'));var Redis=require(_0x1ada('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1ada('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ada('0x10'));var logger=require('../../config/logger')(_0x1ada('0x11'));var utils=require('../../config/utils');var config=require(_0x1ada('0x12'));var licenseUtil=require(_0x1ada('0x13'));var db=require(_0x1ada('0x14'))['db'];function respondWithStatusCode(_0x23985c,_0x25ab77){_0x25ab77=_0x25ab77||0xcc;return function(_0x426c7e){if(_0x426c7e){return _0x23985c['sendStatus'](_0x25ab77);}return _0x23985c[_0x1ada('0x15')](_0x25ab77)[_0x1ada('0x16')]();};}function respondWithResult(_0x5a3bed,_0x2724d0){_0x2724d0=_0x2724d0||0xc8;return function(_0x366943){if(_0x366943){return _0x5a3bed[_0x1ada('0x15')](_0x2724d0)[_0x1ada('0x17')](_0x366943);}};}function respondWithFilteredResult(_0x3dcb12,_0x525b7d){return function(_0x1aa18b){if(_0x1aa18b){var _0x2157de=typeof _0x525b7d['offset']===_0x1ada('0x18')&&typeof _0x525b7d[_0x1ada('0x19')]===_0x1ada('0x18');var _0x51ce1f=_0x1aa18b[_0x1ada('0x1a')];var _0x2bd224=_0x2157de?0x0:_0x525b7d[_0x1ada('0x1b')];var _0x22fa43=_0x2157de?_0x1aa18b['count']:_0x525b7d[_0x1ada('0x1b')]+_0x525b7d['limit'];var _0x2c426c;if(_0x22fa43>=_0x51ce1f){_0x22fa43=_0x51ce1f;_0x2c426c=0xc8;}else{_0x2c426c=0xce;}_0x3dcb12[_0x1ada('0x15')](_0x2c426c);return _0x3dcb12[_0x1ada('0x1c')](_0x1ada('0x1d'),_0x2bd224+'-'+_0x22fa43+'/'+_0x51ce1f)[_0x1ada('0x17')](_0x1aa18b);}return null;};}function patchUpdates(_0x1d96a8){return function(_0x2eb4e1){try{jsonpatch[_0x1ada('0x1e')](_0x2eb4e1,_0x1d96a8,!![]);}catch(_0x9945e4){return BPromise[_0x1ada('0x1f')](_0x9945e4);}return _0x2eb4e1[_0x1ada('0x20')]();};}function saveUpdates(_0xc6366e,_0x12da6c){return function(_0x4ad25a){if(_0x4ad25a){return _0x4ad25a[_0x1ada('0x21')](_0xc6366e)[_0x1ada('0x22')](function(_0x4dca59){return _0x4dca59;});}return null;};}function removeEntity(_0x5eda2d,_0x166f58){return function(_0x5db8fb){if(_0x5db8fb){return _0x5db8fb[_0x1ada('0x23')]()['then'](function(){_0x5eda2d[_0x1ada('0x15')](0xcc)[_0x1ada('0x16')]();});}};}function handleEntityNotFound(_0x31fd2f,_0x752e17){return function(_0x3ac289){if(!_0x3ac289){_0x31fd2f['sendStatus'](0x194);}return _0x3ac289;};}function handleError(_0x5c8c4c,_0x1078e5){_0x1078e5=_0x1078e5||0x1f4;return function(_0x25758f){logger[_0x1ada('0x24')](_0x25758f[_0x1ada('0x25')]);if(_0x25758f[_0x1ada('0x26')]){delete _0x25758f[_0x1ada('0x26')];}_0x5c8c4c[_0x1ada('0x15')](_0x1078e5)[_0x1ada('0x27')](_0x25758f);};}exports[_0x1ada('0x28')]=function(_0x23648c,_0x5d91dc){var _0x25a2e2={},_0x569ef1={},_0x228207={'count':0x0,'rows':[]};var _0x12b6e9=_[_0x1ada('0x29')](db[_0x1ada('0x2a')][_0x1ada('0x2b')],function(_0x2c9a95){return{'name':_0x2c9a95[_0x1ada('0x2c')],'type':_0x2c9a95[_0x1ada('0x2d')][_0x1ada('0x2e')]};});_0x569ef1['model']=_['map'](_0x12b6e9,_0x1ada('0x26'));_0x569ef1['query']=_[_0x1ada('0x2f')](_0x23648c[_0x1ada('0x30')]);_0x569ef1['filters']=_[_0x1ada('0x31')](_0x569ef1['model'],_0x569ef1[_0x1ada('0x30')]);_0x25a2e2[_0x1ada('0x32')]=_[_0x1ada('0x31')](_0x569ef1['model'],qs['fields'](_0x23648c[_0x1ada('0x30')][_0x1ada('0x33')]));_0x25a2e2['attributes']=_0x25a2e2['attributes'][_0x1ada('0x34')]?_0x25a2e2[_0x1ada('0x32')]:_0x569ef1[_0x1ada('0x35')];if(!_0x23648c['query']['hasOwnProperty'](_0x1ada('0x36'))){_0x25a2e2['limit']=qs[_0x1ada('0x19')](_0x23648c[_0x1ada('0x30')][_0x1ada('0x19')]);_0x25a2e2[_0x1ada('0x1b')]=qs['offset'](_0x23648c['query'][_0x1ada('0x1b')]);}_0x25a2e2[_0x1ada('0x37')]=qs[_0x1ada('0x38')](_0x23648c['query'][_0x1ada('0x38')]);_0x25a2e2[_0x1ada('0x39')]=qs[_0x1ada('0x3a')](_[_0x1ada('0x3b')](_0x23648c[_0x1ada('0x30')],_0x569ef1[_0x1ada('0x3a')]),_0x12b6e9);if(_0x23648c[_0x1ada('0x30')][_0x1ada('0x3c')]){_0x25a2e2['where']=_[_0x1ada('0x3d')](_0x25a2e2[_0x1ada('0x39')],{'$or':_[_0x1ada('0x29')](_0x12b6e9,function(_0x31dc9f){if(_0x31dc9f[_0x1ada('0x2d')]!==_0x1ada('0x3e')){var _0x192eac={};_0x192eac[_0x31dc9f['name']]={'$like':'%'+_0x23648c[_0x1ada('0x30')][_0x1ada('0x3c')]+'%'};return _0x192eac;}})});}_0x25a2e2=_['merge']({},_0x25a2e2,_0x23648c[_0x1ada('0x3f')]);var _0x10e6f1={'where':_0x25a2e2[_0x1ada('0x39')]};return db[_0x1ada('0x2a')][_0x1ada('0x1a')](_0x10e6f1)['then'](function(_0x4ba444){_0x228207[_0x1ada('0x1a')]=_0x4ba444;if(_0x23648c[_0x1ada('0x30')][_0x1ada('0x40')]){_0x25a2e2[_0x1ada('0x41')]=[{'all':!![]}];}return db[_0x1ada('0x2a')][_0x1ada('0x42')](_0x25a2e2);})[_0x1ada('0x22')](function(_0x5d23f8){_0x228207['rows']=_0x5d23f8;return _0x228207;})[_0x1ada('0x22')](respondWithFilteredResult(_0x5d91dc,_0x25a2e2))['catch'](handleError(_0x5d91dc,null));};exports['show']=function(_0x375912,_0x2ea087){var _0x8317d7={'raw':!![],'where':{'id':_0x375912[_0x1ada('0x43')]['id']}},_0x55db60={};_0x55db60[_0x1ada('0x35')]=_['keys'](db[_0x1ada('0x2a')][_0x1ada('0x2b')]);_0x55db60['query']=_[_0x1ada('0x2f')](_0x375912[_0x1ada('0x30')]);_0x55db60[_0x1ada('0x3a')]=_[_0x1ada('0x31')](_0x55db60[_0x1ada('0x35')],_0x55db60[_0x1ada('0x30')]);_0x8317d7[_0x1ada('0x32')]=_[_0x1ada('0x31')](_0x55db60['model'],qs['fields'](_0x375912['query'][_0x1ada('0x33')]));_0x8317d7[_0x1ada('0x32')]=_0x8317d7[_0x1ada('0x32')]['length']?_0x8317d7[_0x1ada('0x32')]:_0x55db60[_0x1ada('0x35')];if(_0x375912[_0x1ada('0x30')][_0x1ada('0x40')]){_0x8317d7[_0x1ada('0x41')]=[{'all':!![]}];}_0x8317d7=_[_0x1ada('0x3d')]({},_0x8317d7,_0x375912[_0x1ada('0x3f')]);return db[_0x1ada('0x2a')][_0x1ada('0x44')](_0x8317d7)[_0x1ada('0x22')](handleEntityNotFound(_0x2ea087,null))[_0x1ada('0x22')](respondWithResult(_0x2ea087,null))[_0x1ada('0x45')](handleError(_0x2ea087,null));};exports[_0x1ada('0x46')]=function(_0xd894f4,_0x1b09fe){return db[_0x1ada('0x2a')]['create'](_0xd894f4[_0x1ada('0x47')],{})[_0x1ada('0x22')](respondWithResult(_0x1b09fe,0xc9))[_0x1ada('0x45')](handleError(_0x1b09fe,null));};exports[_0x1ada('0x21')]=function(_0x464b26,_0xddf5a5){if(_0x464b26[_0x1ada('0x47')]['id']){delete _0x464b26[_0x1ada('0x47')]['id'];}return db['VtigerField'][_0x1ada('0x44')]({'where':{'id':_0x464b26['params']['id']}})[_0x1ada('0x22')](handleEntityNotFound(_0xddf5a5,null))[_0x1ada('0x22')](saveUpdates(_0x464b26['body'],null))[_0x1ada('0x22')](respondWithResult(_0xddf5a5,null))[_0x1ada('0x45')](handleError(_0xddf5a5,null));};exports[_0x1ada('0x23')]=function(_0x75e2c3,_0x3094e2){return db[_0x1ada('0x2a')]['find']({'where':{'id':_0x75e2c3[_0x1ada('0x43')]['id']}})['then'](handleEntityNotFound(_0x3094e2,null))[_0x1ada('0x22')](removeEntity(_0x3094e2,null))[_0x1ada('0x45')](handleError(_0x3094e2,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 0d1eb1a..c70d204 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 _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0xf35439,_0x5a13db){var _0xd9a883=function(_0x2a73be){while(--_0x2a73be){_0xf35439['push'](_0xf35439['shift']());}};_0xd9a883(++_0x5a13db);}(_0x7a54,0x106));var _0x47a5=function(_0x2bcf5,_0x812fb4){_0x2bcf5=_0x2bcf5-0x0;var _0x324226=_0x7a54[_0x2bcf5];return _0x324226;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x1b760d,_0x15a65b){var _0x2dfe37=function(_0x20cc9e){while(--_0x20cc9e){_0x1b760d['push'](_0x1b760d['shift']());}};_0x2dfe37(++_0x15a65b);}(_0x7a54,0x106));var _0x47a5=function(_0xf55cda,_0x2ac913){_0xf55cda=_0xf55cda-0x0;var _0x158040=_0x7a54[_0xf55cda];return _0x158040;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index d8f6b36..030818e 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 _0x47fd=['VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info'];(function(_0x15467e,_0xbacb9e){var _0x783a49=function(_0x4652a2){while(--_0x4652a2){_0x15467e['push'](_0x15467e['shift']());}};_0x783a49(++_0xbacb9e);}(_0x47fd,0x13c));var _0xd47f=function(_0x3f096b,_0x1a864f){_0x3f096b=_0x3f096b-0x0;var _0x204ba4=_0x47fd[_0x3f096b];return _0x204ba4;};'use strict';var _=require(_0xd47f('0x0'));var util=require(_0xd47f('0x1'));var moment=require(_0xd47f('0x2'));var BPromise=require(_0xd47f('0x3'));var rs=require(_0xd47f('0x4'));var fs=require('fs');var Redis=require(_0xd47f('0x5'));var db=require(_0xd47f('0x6'))['db'];var utils=require(_0xd47f('0x7'));var logger=require(_0xd47f('0x8'))(_0xd47f('0x9'));var config=require('../../config/environment');var jayson=require(_0xd47f('0xa'));var client=jayson[_0xd47f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11c1d4,_0x4f4706,_0x55433e){return new BPromise(function(_0x38b07c,_0x56a97a){return client['request'](_0x11c1d4,_0x55433e)[_0xd47f('0xc')](function(_0x2b694d){logger[_0xd47f('0xd')](_0xd47f('0xe'),_0x4f4706,_0xd47f('0xf'));logger[_0xd47f('0x10')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x4f4706,_0xd47f('0xf'),JSON[_0xd47f('0x11')](_0x2b694d));if(_0x2b694d['error']){if(_0x2b694d[_0xd47f('0x12')][_0xd47f('0x13')]===0x1f4){logger[_0xd47f('0x12')](_0xd47f('0xe'),_0x4f4706,_0x2b694d[_0xd47f('0x12')][_0xd47f('0x14')]);return _0x56a97a(_0x2b694d['error'][_0xd47f('0x14')]);}logger[_0xd47f('0x12')](_0xd47f('0xe'),_0x4f4706,_0x2b694d[_0xd47f('0x12')][_0xd47f('0x14')]);return _0x38b07c(_0x2b694d[_0xd47f('0x12')][_0xd47f('0x14')]);}else{logger[_0xd47f('0xd')](_0xd47f('0xe'),_0x4f4706,'request\x20sent');_0x38b07c(_0x2b694d['result'][_0xd47f('0x14')]);}})[_0xd47f('0x15')](function(_0x4d23b5){logger[_0xd47f('0x12')](_0xd47f('0xe'),_0x4f4706,_0x4d23b5);_0x56a97a(_0x4d23b5);});});} \ No newline at end of file +var _0x19e1=['moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','VtigerField,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0xa317a6,_0x2934eb){var _0x3747c8=function(_0x110927){while(--_0x110927){_0xa317a6['push'](_0xa317a6['shift']());}};_0x3747c8(++_0x2934eb);}(_0x19e1,0x163));var _0x119e=function(_0x2de020,_0x252df0){_0x2de020=_0x2de020-0x0;var _0x182b7c=_0x19e1[_0x2de020];return _0x182b7c;};'use strict';var _=require(_0x119e('0x0'));var util=require(_0x119e('0x1'));var moment=require(_0x119e('0x2'));var BPromise=require(_0x119e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x119e('0x4'))['db'];var utils=require(_0x119e('0x5'));var logger=require('../../config/logger')(_0x119e('0x6'));var config=require(_0x119e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x119e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b5306,_0x25e166,_0x16a2ee){return new BPromise(function(_0x1b3797,_0x53d5b7){return client[_0x119e('0x9')](_0x1b5306,_0x16a2ee)[_0x119e('0xa')](function(_0x1a6747){logger['info']('VtigerField,\x20%s,\x20%s',_0x25e166,_0x119e('0xb'));logger[_0x119e('0xc')](_0x119e('0xd'),_0x25e166,_0x119e('0xb'),JSON[_0x119e('0xe')](_0x1a6747));if(_0x1a6747[_0x119e('0xf')]){if(_0x1a6747[_0x119e('0xf')]['code']===0x1f4){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x53d5b7(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}logger['error'](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x1b3797(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}else{logger[_0x119e('0x12')](_0x119e('0x10'),_0x25e166,_0x119e('0xb'));_0x1b3797(_0x1a6747[_0x119e('0x13')][_0x119e('0x11')]);}})[_0x119e('0x14')](function(_0x54c326){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x54c326);_0x53d5b7(_0x54c326);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index d288b05..daa1afe 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 _0x9d5c=['create','addConfiguration','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','post'];(function(_0x2057df,_0x28fca4){var _0x19474b=function(_0x3c3b77){while(--_0x3c3b77){_0x2057df['push'](_0x2057df['shift']());}};_0x19474b(++_0x28fca4);}(_0x9d5c,0x98));var _0xc9d5=function(_0x3c5b84,_0xaa08b8){_0x3c5b84=_0x3c5b84-0x0;var _0x340d3c=_0x9d5c[_0x3c5b84];return _0x340d3c;};'use strict';var multer=require(_0xc9d5('0x0'));var util=require('util');var path=require(_0xc9d5('0x1'));var timeout=require(_0xc9d5('0x2'));var express=require('express');var router=express[_0xc9d5('0x3')]();var fs_extra=require(_0xc9d5('0x4'));var auth=require(_0xc9d5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc9d5('0x6'));var controller=require(_0xc9d5('0x7'));router['get']('/',auth[_0xc9d5('0x8')](),controller[_0xc9d5('0x9')]);router[_0xc9d5('0xa')](_0xc9d5('0xb'),auth[_0xc9d5('0x8')](),controller[_0xc9d5('0xc')]);router[_0xc9d5('0xa')](_0xc9d5('0xd'),auth[_0xc9d5('0x8')](),controller[_0xc9d5('0xe')]);router['get']('/:id/fields',auth[_0xc9d5('0x8')](),controller['getFields']);router[_0xc9d5('0xf')]('/',auth[_0xc9d5('0x8')](),controller[_0xc9d5('0x10')]);router[_0xc9d5('0xf')](_0xc9d5('0xd'),auth[_0xc9d5('0x8')](),controller[_0xc9d5('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc9d5('0x12')]);router[_0xc9d5('0x13')](_0xc9d5('0xb'),auth[_0xc9d5('0x8')](),controller['destroy']);module[_0xc9d5('0x14')]=router; \ No newline at end of file +var _0xd8fb=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','index','/:id','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','isAuthenticated','put','update','delete','destroy','exports','multer'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xd8fb,0x99));var _0xbd8f=function(_0x564aa6,_0x21b8da){_0x564aa6=_0x564aa6-0x0;var _0x133d68=_0xd8fb[_0x564aa6];return _0x133d68;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd8f('0x4'));var interaction=require(_0xbd8f('0x5'));var config=require('../../config/environment');var controller=require(_0xbd8f('0x6'));router[_0xbd8f('0x7')]('/',auth['isAuthenticated'](),controller[_0xbd8f('0x8')]);router['get'](_0xbd8f('0x9'),auth['isAuthenticated'](),controller[_0xbd8f('0xa')]);router[_0xbd8f('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xbd8f('0xb')]);router[_0xbd8f('0x7')](_0xbd8f('0xc'),auth['isAuthenticated'](),controller[_0xbd8f('0xd')]);router[_0xbd8f('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbd8f('0xe')](_0xbd8f('0xf'),auth[_0xbd8f('0x10')](),controller['addConfiguration']);router[_0xbd8f('0x11')](_0xbd8f('0x9'),auth[_0xbd8f('0x10')](),controller[_0xbd8f('0x12')]);router[_0xbd8f('0x13')](_0xbd8f('0x9'),auth[_0xbd8f('0x10')](),controller[_0xbd8f('0x14')]);module[_0xbd8f('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 9052870..0161a0b 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 _0xd973=['remoteUri','ENUM','token','password','integrationTab','newTab','sequelize','STRING','username'];(function(_0x4f9fa3,_0xa17931){var _0x23ec26=function(_0x3aee8c){while(--_0x3aee8c){_0x4f9fa3['push'](_0x4f9fa3['shift']());}};_0x23ec26(++_0xa17931);}(_0xd973,0x8d));var _0x3d97=function(_0x47165c,_0x3a28dd){_0x47165c=_0x47165c-0x0;var _0x22e340=_0xd973[_0x47165c];return _0x22e340;};'use strict';var Sequelize=require(_0x3d97('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3d97('0x1')]},'username':{'type':Sequelize[_0x3d97('0x1')],'unique':_0x3d97('0x2')},'password':{'type':Sequelize[_0x3d97('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x3d97('0x3')},'authType':{'type':Sequelize[_0x3d97('0x4')]('password',_0x3d97('0x5')),'defaultValue':_0x3d97('0x6')},'serverUrl':{'type':Sequelize[_0x3d97('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3d97('0x4')](_0x3d97('0x7'),_0x3d97('0x8')),'defaultValue':_0x3d97('0x7')}}; \ No newline at end of file +var _0x163b=['integrationTab','newTab','sequelize','exports','STRING','remoteUri','ENUM','token','password'];(function(_0x49c78d,_0x146218){var _0xa9d0c9=function(_0x1bdc0a){while(--_0x1bdc0a){_0x49c78d['push'](_0x49c78d['shift']());}};_0xa9d0c9(++_0x146218);}(_0x163b,0x158));var _0xb163=function(_0x596bcf,_0x54405e){_0x596bcf=_0x596bcf-0x0;var _0x43a9db=_0x163b[_0x596bcf];return _0x43a9db;};'use strict';var Sequelize=require(_0xb163('0x0'));module[_0xb163('0x1')]={'name':{'type':Sequelize[_0xb163('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb163('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xb163('0x2')]},'token':{'type':Sequelize[_0xb163('0x2')]},'remoteUri':{'type':Sequelize[_0xb163('0x2')],'unique':_0xb163('0x3')},'authType':{'type':Sequelize[_0xb163('0x4')]('password',_0xb163('0x5')),'defaultValue':_0xb163('0x6')},'serverUrl':{'type':Sequelize[_0xb163('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb163('0x4')](_0xb163('0x7'),_0xb163('0x8')),'defaultValue':_0xb163('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 6156bdd..fdeff08 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 _0x59b4=['channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','includes','position','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','ejs','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','name','index','map','ZendeskAccount','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','includeAll','find','create','body','params','destroy','getConfigurations','findOne','ZendeskConfiguration','rawAttributes','length','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x59b4,0x122));var _0x459b=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x59b4[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require(_0x459b('0x0'));var rimraf=require(_0x459b('0x1'));var zipdir=require(_0x459b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x459b('0x3'));var moment=require(_0x459b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x459b('0x5'));var path=require('path');var sox=require(_0x459b('0x6'));var csv=require('to-csv');var ejs=require(_0x459b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x459b('0x8'));var crypto=require('crypto');var jsforce=require(_0x459b('0x9'));var deskjs=require(_0x459b('0xa'));var toCsv=require(_0x459b('0xb'));var querystring=require('querystring');var Papa=require(_0x459b('0xc'));var Redis=require('ioredis');var authService=require(_0x459b('0xd'));var qs=require(_0x459b('0xe'));var as=require(_0x459b('0xf'));var hardwareService=require(_0x459b('0x10'));var logger=require(_0x459b('0x11'))(_0x459b('0x12'));var utils=require(_0x459b('0x13'));var config=require(_0x459b('0x14'));var licenseUtil=require(_0x459b('0x15'));var db=require(_0x459b('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x459b('0x17'));var client=jayson[_0x459b('0x18')][_0x459b('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x39f880,_0x26ce1f,_0x1a28d5,_0x373e42){return new BPromise(function(_0xf3f9f3,_0x5dd64f){var _0x51353e=_0x373e42||client;return _0x51353e[_0x459b('0x1a')](_0x39f880,_0x1a28d5)[_0x459b('0x1b')](function(_0x48c91e){logger[_0x459b('0x1c')](_0x459b('0x1d'),_0x26ce1f,_0x459b('0x1e'));logger[_0x459b('0x1f')](_0x459b('0x20'),_0x26ce1f,_0x459b('0x1e'),JSON[_0x459b('0x21')](_0x48c91e));if(_0x48c91e[_0x459b('0x22')]){if(_0x48c91e[_0x459b('0x22')][_0x459b('0x23')]===0x1f4){logger['error'](_0x459b('0x1d'),_0x26ce1f,_0x48c91e[_0x459b('0x22')][_0x459b('0x24')]);return _0x5dd64f(_0x48c91e[_0x459b('0x22')][_0x459b('0x24')]);}logger[_0x459b('0x22')](_0x459b('0x1d'),_0x26ce1f,_0x48c91e['error'][_0x459b('0x24')]);return _0xf3f9f3(_0x48c91e['error']['message']);}else{logger[_0x459b('0x1c')](_0x459b('0x1d'),_0x26ce1f,'request\x20sent');_0xf3f9f3(_0x48c91e['result'][_0x459b('0x24')]);}})[_0x459b('0x25')](function(_0x44b8c9){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x26ce1f,_0x44b8c9);_0x5dd64f(_0x44b8c9);});});}function respondWithStatusCode(_0x211f1e,_0x3d6241){_0x3d6241=_0x3d6241||0xcc;return function(_0x2dd111){if(_0x2dd111){return _0x211f1e[_0x459b('0x26')](_0x3d6241);}return _0x211f1e['status'](_0x3d6241)[_0x459b('0x27')]();};}function respondWithResult(_0x27e1eb,_0x540c61){_0x540c61=_0x540c61||0xc8;return function(_0x432a68){if(_0x432a68){return _0x27e1eb[_0x459b('0x28')](_0x540c61)[_0x459b('0x29')](_0x432a68);}};}function respondWithFilteredResult(_0x5ee8d6,_0x29be22){return function(_0x4c557b){if(_0x4c557b){var _0x1f43d3=typeof _0x29be22[_0x459b('0x2a')]===_0x459b('0x2b')&&typeof _0x29be22[_0x459b('0x2c')]==='undefined';var _0x52c72a=_0x4c557b[_0x459b('0x2d')];var _0x1565c1=_0x1f43d3?0x0:_0x29be22[_0x459b('0x2a')];var _0x3e029f=_0x1f43d3?_0x4c557b[_0x459b('0x2d')]:_0x29be22[_0x459b('0x2a')]+_0x29be22['limit'];var _0x4d2b1c;if(_0x3e029f>=_0x52c72a){_0x3e029f=_0x52c72a;_0x4d2b1c=0xc8;}else{_0x4d2b1c=0xce;}_0x5ee8d6[_0x459b('0x28')](_0x4d2b1c);return _0x5ee8d6['set'](_0x459b('0x2e'),_0x1565c1+'-'+_0x3e029f+'/'+_0x52c72a)[_0x459b('0x29')](_0x4c557b);}return null;};}function patchUpdates(_0x379d32){return function(_0x4b81e9){try{jsonpatch[_0x459b('0x2f')](_0x4b81e9,_0x379d32,!![]);}catch(_0x46cb30){return BPromise[_0x459b('0x30')](_0x46cb30);}return _0x4b81e9['save']();};}function saveUpdates(_0xa33229,_0x20335a){return function(_0xb14fce){if(_0xb14fce){return _0xb14fce['update'](_0xa33229)[_0x459b('0x1b')](function(_0xe9fc3){return _0xe9fc3;});}return null;};}function removeEntity(_0xe43927,_0x75eb30){return function(_0x2bf3c2){if(_0x2bf3c2){return _0x2bf3c2['destroy']()['then'](function(){_0xe43927['status'](0xcc)[_0x459b('0x27')]();});}};}function handleEntityNotFound(_0x547b70,_0x21fd28){return function(_0x278014){if(!_0x278014){_0x547b70[_0x459b('0x26')](0x194);}return _0x278014;};}function handleError(_0x419421,_0x4e1715){_0x4e1715=_0x4e1715||0x1f4;return function(_0x195641){logger[_0x459b('0x22')](_0x195641['stack']);if(_0x195641[_0x459b('0x31')]){delete _0x195641[_0x459b('0x31')];}_0x419421[_0x459b('0x28')](_0x4e1715)['send'](_0x195641);};}exports[_0x459b('0x32')]=function(_0x33cd73,_0x1e969f){var _0x13a801={},_0x32dbb0={},_0x4f4691={'count':0x0,'rows':[]};var _0x5973e3=_[_0x459b('0x33')](db[_0x459b('0x34')]['rawAttributes'],function(_0x2b88e9){return{'name':_0x2b88e9['fieldName'],'type':_0x2b88e9['type'][_0x459b('0x35')]};});_0x32dbb0[_0x459b('0x36')]=_[_0x459b('0x33')](_0x5973e3,_0x459b('0x31'));_0x32dbb0[_0x459b('0x37')]=_[_0x459b('0x38')](_0x33cd73[_0x459b('0x37')]);_0x32dbb0['filters']=_[_0x459b('0x39')](_0x32dbb0['model'],_0x32dbb0[_0x459b('0x37')]);_0x13a801[_0x459b('0x3a')]=_[_0x459b('0x39')](_0x32dbb0[_0x459b('0x36')],qs[_0x459b('0x3b')](_0x33cd73[_0x459b('0x37')][_0x459b('0x3b')]));_0x13a801[_0x459b('0x3a')]=_0x13a801['attributes']['length']?_0x13a801['attributes']:_0x32dbb0[_0x459b('0x36')];if(!_0x33cd73['query']['hasOwnProperty'](_0x459b('0x3c'))){_0x13a801[_0x459b('0x2c')]=qs[_0x459b('0x2c')](_0x33cd73[_0x459b('0x37')]['limit']);_0x13a801[_0x459b('0x2a')]=qs[_0x459b('0x2a')](_0x33cd73[_0x459b('0x37')][_0x459b('0x2a')]);}_0x13a801[_0x459b('0x3d')]=qs[_0x459b('0x3e')](_0x33cd73[_0x459b('0x37')][_0x459b('0x3e')]);_0x13a801[_0x459b('0x3f')]=qs['filters'](_[_0x459b('0x40')](_0x33cd73[_0x459b('0x37')],_0x32dbb0[_0x459b('0x41')]),_0x5973e3);if(_0x33cd73[_0x459b('0x37')][_0x459b('0x42')]){_0x13a801[_0x459b('0x3f')]=_[_0x459b('0x43')](_0x13a801['where'],{'$or':_[_0x459b('0x33')](_0x5973e3,function(_0x158f38){if(_0x158f38[_0x459b('0x44')]!==_0x459b('0x45')){var _0x2df3fd={};_0x2df3fd[_0x158f38[_0x459b('0x31')]]={'$like':'%'+_0x33cd73['query'][_0x459b('0x42')]+'%'};return _0x2df3fd;}})});}_0x13a801=_[_0x459b('0x43')]({},_0x13a801,_0x33cd73[_0x459b('0x46')]);var _0x4fe3bf={'where':_0x13a801[_0x459b('0x3f')]};return db['ZendeskAccount'][_0x459b('0x2d')](_0x4fe3bf)['then'](function(_0x87fd22){_0x4f4691[_0x459b('0x2d')]=_0x87fd22;if(_0x33cd73[_0x459b('0x37')]['includeAll']){_0x13a801[_0x459b('0x47')]=[{'all':!![]}];}return db[_0x459b('0x34')][_0x459b('0x48')](_0x13a801);})[_0x459b('0x1b')](function(_0x3e0118){_0x4f4691[_0x459b('0x49')]=_0x3e0118;return _0x4f4691;})['then'](respondWithFilteredResult(_0x1e969f,_0x13a801))['catch'](handleError(_0x1e969f,null));};exports[_0x459b('0x4a')]=function(_0x187fe7,_0x318a9a){var _0x4ec859={'raw':![],'where':{'id':_0x187fe7['params']['id']}},_0x5b3add={};_0x5b3add['model']=_[_0x459b('0x38')](db['ZendeskAccount']['rawAttributes']);_0x5b3add[_0x459b('0x37')]=_[_0x459b('0x38')](_0x187fe7[_0x459b('0x37')]);_0x5b3add[_0x459b('0x41')]=_[_0x459b('0x39')](_0x5b3add['model'],_0x5b3add[_0x459b('0x37')]);_0x4ec859[_0x459b('0x3a')]=_[_0x459b('0x39')](_0x5b3add[_0x459b('0x36')],qs[_0x459b('0x3b')](_0x187fe7[_0x459b('0x37')][_0x459b('0x3b')]));_0x4ec859['attributes']=_0x4ec859[_0x459b('0x3a')]['length']?_0x4ec859[_0x459b('0x3a')]:_0x5b3add[_0x459b('0x36')];if(_0x187fe7[_0x459b('0x37')][_0x459b('0x4b')]){_0x4ec859[_0x459b('0x47')]=[{'all':!![]}];}_0x4ec859=_[_0x459b('0x43')]({},_0x4ec859,_0x187fe7[_0x459b('0x46')]);return db[_0x459b('0x34')][_0x459b('0x4c')](_0x4ec859)[_0x459b('0x1b')](handleEntityNotFound(_0x318a9a,null))[_0x459b('0x1b')](respondWithResult(_0x318a9a,null))[_0x459b('0x25')](handleError(_0x318a9a,null));};exports[_0x459b('0x4d')]=function(_0x27c955,_0x3a98d9){return db[_0x459b('0x34')][_0x459b('0x4d')](_0x27c955['body'],{})[_0x459b('0x1b')](respondWithResult(_0x3a98d9,0xc9))['catch'](handleError(_0x3a98d9,null));};exports['update']=function(_0x28824b,_0x23c4c3){if(_0x28824b[_0x459b('0x4e')]['id']){delete _0x28824b[_0x459b('0x4e')]['id'];}return db[_0x459b('0x34')][_0x459b('0x4c')]({'where':{'id':_0x28824b[_0x459b('0x4f')]['id']}})[_0x459b('0x1b')](handleEntityNotFound(_0x23c4c3,null))[_0x459b('0x1b')](saveUpdates(_0x28824b[_0x459b('0x4e')],null))[_0x459b('0x1b')](respondWithResult(_0x23c4c3,null))[_0x459b('0x25')](handleError(_0x23c4c3,null));};exports[_0x459b('0x50')]=function(_0x38e08d,_0x176ebf){return db['ZendeskAccount'][_0x459b('0x4c')]({'where':{'id':_0x38e08d[_0x459b('0x4f')]['id']}})[_0x459b('0x1b')](handleEntityNotFound(_0x176ebf,null))[_0x459b('0x1b')](removeEntity(_0x176ebf,null))[_0x459b('0x25')](handleError(_0x176ebf,null));};exports[_0x459b('0x51')]=function(_0x414c28,_0xb648b9,_0x335484){var _0x52b370={};var _0x341b35={};var _0x4b31ea;var _0x43f18b;return db[_0x459b('0x34')][_0x459b('0x52')]({'where':{'id':_0x414c28[_0x459b('0x4f')]['id']}})[_0x459b('0x1b')](handleEntityNotFound(_0xb648b9,null))[_0x459b('0x1b')](function(_0x5037ea){if(_0x5037ea){_0x4b31ea=_0x5037ea;_0x341b35[_0x459b('0x36')]=_[_0x459b('0x38')](db[_0x459b('0x53')][_0x459b('0x54')]);_0x341b35[_0x459b('0x37')]=_[_0x459b('0x38')](_0x414c28[_0x459b('0x37')]);_0x341b35[_0x459b('0x41')]=_[_0x459b('0x39')](_0x341b35[_0x459b('0x36')],_0x341b35[_0x459b('0x37')]);_0x52b370['attributes']=_[_0x459b('0x39')](_0x341b35[_0x459b('0x36')],qs['fields'](_0x414c28[_0x459b('0x37')]['fields']));_0x52b370['attributes']=_0x52b370['attributes'][_0x459b('0x55')]?_0x52b370[_0x459b('0x3a')]:_0x341b35[_0x459b('0x36')];_0x52b370[_0x459b('0x3d')]=qs[_0x459b('0x3e')](_0x414c28['query'][_0x459b('0x3e')]);_0x52b370[_0x459b('0x3f')]=qs['filters'](_[_0x459b('0x40')](_0x414c28[_0x459b('0x37')],_0x341b35[_0x459b('0x41')]));if(_0x414c28[_0x459b('0x37')][_0x459b('0x42')]){_0x52b370[_0x459b('0x3f')]=_['merge'](_0x52b370[_0x459b('0x3f')],{'$or':_[_0x459b('0x33')](_0x52b370[_0x459b('0x3a')],function(_0x485d6b){var _0x22d650={};_0x22d650[_0x485d6b]={'$like':'%'+_0x414c28['query']['filter']+'%'};return _0x22d650;})});}_0x52b370=_[_0x459b('0x43')]({},_0x52b370,_0x414c28[_0x459b('0x46')]);return _0x4b31ea[_0x459b('0x51')](_0x52b370);}})[_0x459b('0x1b')](function(_0x4c59d3){if(_0x4c59d3){_0x43f18b=_0x4c59d3[_0x459b('0x55')];if(!_0x414c28[_0x459b('0x37')][_0x459b('0x56')](_0x459b('0x3c'))){_0x52b370['limit']=qs[_0x459b('0x2c')](_0x414c28['query'][_0x459b('0x2c')]);_0x52b370['offset']=qs['offset'](_0x414c28[_0x459b('0x37')]['offset']);}return _0x4b31ea[_0x459b('0x51')](_0x52b370);}})[_0x459b('0x1b')](function(_0x237f5d){if(_0x237f5d){return _0x237f5d?{'count':_0x43f18b,'rows':_0x237f5d}:null;}})[_0x459b('0x1b')](respondWithResult(_0xb648b9,null))[_0x459b('0x25')](handleError(_0xb648b9,null));};exports[_0x459b('0x57')]=function(_0x13a75d,_0x290234,_0xe76116){if(_0x13a75d['body']['id']){delete _0x13a75d[_0x459b('0x4e')]['id'];}return db[_0x459b('0x34')]['findOne']({'where':{'id':_0x13a75d[_0x459b('0x4f')]['id']}})[_0x459b('0x1b')](handleEntityNotFound(_0x290234,null))[_0x459b('0x1b')](function(_0x3c6e03){if(_0x3c6e03){_0x13a75d[_0x459b('0x4e')][_0x459b('0x58')]=_0x3c6e03['id'];_0x13a75d['body'][_0x459b('0x59')]=integrations[_0x459b('0x5a')](_0x13a75d[_0x459b('0x4e')][_0x459b('0x5b')],_0x13a75d[_0x459b('0x4e')][_0x459b('0x44')]);_0x13a75d['body'][_0x459b('0x5c')]=integrations[_0x459b('0x5d')](_0x13a75d['body'][_0x459b('0x5b')],_0x13a75d['body'][_0x459b('0x44')]);return db[_0x459b('0x53')][_0x459b('0x4d')](_0x13a75d['body'],{'include':[{'model':db['ZendeskField'],'as':_0x459b('0x59')},{'model':db[_0x459b('0x5e')],'as':_0x459b('0x5c')}]});}return null;})['then'](respondWithResult(_0x290234,null))[_0x459b('0x25')](handleError(_0x290234,null));};exports[_0x459b('0x5f')]=function(_0x25a2f6,_0x52c97d,_0x265b25){var _0x358fb0='';return db[_0x459b('0x34')][_0x459b('0x52')]({'where':{'id':_0x25a2f6['params']['id']},'attributes':['id',_0x459b('0x60'),_0x459b('0x61'),_0x459b('0x62'),_0x459b('0x63'),_0x459b('0x64')]})[_0x459b('0x1b')](handleEntityNotFound(_0x52c97d,null))[_0x459b('0x1b')](function(_0x2816c4){if(_0x2816c4){_0x358fb0=_0x2816c4['remoteUri'];var _0x419c39=_0x358fb0[_0x459b('0x65')](-0x1);if(_0x419c39==='/'){_0x358fb0=_0x358fb0['substring'](0x0,_0x358fb0[_0x459b('0x66')](_0x419c39));}var _0x412095={'method':_0x459b('0x67'),'uri':util[_0x459b('0x68')](_0x459b('0x69'),_0x358fb0,_0x459b('0x6a')),'json':!![]};switch(_0x2816c4[_0x459b('0x63')]){case _0x459b('0x61'):_0x412095[_0x459b('0x6b')]={'Authorization':util[_0x459b('0x68')](_0x459b('0x6c'),new Buffer(util['format']('%s:%s',_0x2816c4[_0x459b('0x60')],_0x2816c4['password']))[_0x459b('0x6d')]('base64'))};break;case _0x459b('0x62'):_0x412095[_0x459b('0x6b')]={'Authorization':util[_0x459b('0x68')]('Basic\x20%s',new Buffer(util['format']('%s/token:%s',_0x2816c4['username'],_0x2816c4['token']))[_0x459b('0x6d')](_0x459b('0x6e')))};break;default:throw new db[(_0x459b('0x6f'))][(_0x459b('0x70'))](_0x459b('0x71'));}return rp(_0x412095);}})['then'](function(_0x54bfde){if(_0x54bfde){var _0x47c79f=[_0x459b('0x72'),_0x459b('0x73'),_0x459b('0x74'),_0x459b('0x75')];_['remove'](_0x54bfde[_0x459b('0x6a')],function(_0x3ab076){return _0x47c79f[_0x459b('0x76')](_0x3ab076[_0x459b('0x44')]);});return{'count':_0x54bfde[_0x459b('0x6a')]['length'],'rows':_[_0x459b('0x33')](_0x54bfde[_0x459b('0x6a')],function(_0xb3d822){return{'id':_0xb3d822['id'],'name':_0xb3d822[_0x459b('0x77')]>0x7?_0xb3d822['title']:_0xb3d822[_0x459b('0x44')],'custom':_0xb3d822[_0x459b('0x77')]>0x7?!![]:![],'options':_0xb3d822[_0x459b('0x78')]?_0xb3d822[_0x459b('0x78')]:_0xb3d822[_0x459b('0x79')]?_0xb3d822[_0x459b('0x79')]:[]};})};}})[_0x459b('0x1b')](respondWithResult(_0x52c97d,null))['catch'](function(_0x140c36){var _0x4c5a21=_0x25a2f6['query'][_0x459b('0x7a')]?0x1f4:_0x140c36['statusCode']||0x1f4;logger[_0x459b('0x22')](_0x459b('0x7b'),_0x459b('0x5f'),_0x4c5a21,JSON[_0x459b('0x21')](_0x140c36));delete _0x140c36[_0x459b('0x31')];if(_0x4c5a21===0x191){_0x4c5a21=0x190;}_0x52c97d[_0x459b('0x28')](_0x4c5a21)[_0x459b('0x7c')](_0x25a2f6[_0x459b('0x37')]['test']?{'message':_0x459b('0x7d'),'statusCode':_0x140c36[_0x459b('0x7e')]}:_0x140c36);});}; \ No newline at end of file +var _0x3e87=['key','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create','body','findOne','length','order','options','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskConfiguration','ZendeskField','username','remoteUri','slice','substring','%s/%s','ticket_fields','headers','format','Basic\x20%s','%s:%s','password','toString','base64','token','Sequelize','Unknown\x20authentication\x20type','subject','description','group','remove','includes','position','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','end','stack','name','send','index','ZendeskAccount','fieldName','type'];(function(_0x2b5979,_0x3773e0){var _0x49cb09=function(_0x24dbfc){while(--_0x24dbfc){_0x2b5979['push'](_0x2b5979['shift']());}};_0x49cb09(++_0x3773e0);}(_0x3e87,0x1b5));var _0x73e8=function(_0x1abb54,_0x16cf32){_0x1abb54=_0x1abb54-0x0;var _0xeb83f0=_0x3e87[_0x1abb54];return _0xeb83f0;};'use strict';var emlformat=require(_0x73e8('0x0'));var rimraf=require(_0x73e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x73e8('0x2'));var rp=require(_0x73e8('0x3'));var moment=require('moment');var BPromise=require(_0x73e8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x73e8('0x5'));var csv=require(_0x73e8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x73e8('0x7'));var _=require(_0x73e8('0x8'));var squel=require('squel');var crypto=require(_0x73e8('0x9'));var jsforce=require(_0x73e8('0xa'));var deskjs=require(_0x73e8('0xb'));var toCsv=require(_0x73e8('0x6'));var querystring=require(_0x73e8('0xc'));var Papa=require(_0x73e8('0xd'));var Redis=require(_0x73e8('0xe'));var authService=require(_0x73e8('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x73e8('0x10'));var logger=require('../../config/logger')(_0x73e8('0x11'));var utils=require('../../config/utils');var config=require(_0x73e8('0x12'));var licenseUtil=require(_0x73e8('0x13'));var db=require(_0x73e8('0x14'))['db'];var integrations=require(_0x73e8('0x15'));var jayson=require(_0x73e8('0x16'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10716,_0x24898f,_0x2a9e27,_0xdaec86){return new BPromise(function(_0x2e6d27,_0x1e9fe7){var _0x527b3b=_0xdaec86||client;return _0x527b3b['request'](_0x10716,_0x2a9e27)['then'](function(_0x250ab){logger[_0x73e8('0x17')](_0x73e8('0x18'),_0x24898f,'request\x20sent');logger[_0x73e8('0x19')](_0x73e8('0x1a'),_0x24898f,_0x73e8('0x1b'),JSON['stringify'](_0x250ab));if(_0x250ab[_0x73e8('0x1c')]){if(_0x250ab[_0x73e8('0x1c')][_0x73e8('0x1d')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x24898f,_0x250ab[_0x73e8('0x1c')][_0x73e8('0x1e')]);return _0x1e9fe7(_0x250ab[_0x73e8('0x1c')][_0x73e8('0x1e')]);}logger[_0x73e8('0x1c')](_0x73e8('0x18'),_0x24898f,_0x250ab[_0x73e8('0x1c')][_0x73e8('0x1e')]);return _0x2e6d27(_0x250ab[_0x73e8('0x1c')]['message']);}else{logger[_0x73e8('0x17')](_0x73e8('0x18'),_0x24898f,_0x73e8('0x1b'));_0x2e6d27(_0x250ab[_0x73e8('0x1f')][_0x73e8('0x1e')]);}})[_0x73e8('0x20')](function(_0x169bb0){logger[_0x73e8('0x1c')](_0x73e8('0x18'),_0x24898f,_0x169bb0);_0x1e9fe7(_0x169bb0);});});}function respondWithStatusCode(_0x31ce5c,_0x5bc0de){_0x5bc0de=_0x5bc0de||0xcc;return function(_0xa2922c){if(_0xa2922c){return _0x31ce5c[_0x73e8('0x21')](_0x5bc0de);}return _0x31ce5c['status'](_0x5bc0de)['end']();};}function respondWithResult(_0x191c99,_0x1bbb4c){_0x1bbb4c=_0x1bbb4c||0xc8;return function(_0x249b58){if(_0x249b58){return _0x191c99[_0x73e8('0x22')](_0x1bbb4c)['json'](_0x249b58);}};}function respondWithFilteredResult(_0x5d05b9,_0x14df3f){return function(_0x224fe7){if(_0x224fe7){var _0x3d1301=typeof _0x14df3f['offset']===_0x73e8('0x23')&&typeof _0x14df3f[_0x73e8('0x24')]===_0x73e8('0x23');var _0x2e1bf6=_0x224fe7[_0x73e8('0x25')];var _0x10073b=_0x3d1301?0x0:_0x14df3f[_0x73e8('0x26')];var _0x5c1d18=_0x3d1301?_0x224fe7[_0x73e8('0x25')]:_0x14df3f[_0x73e8('0x26')]+_0x14df3f[_0x73e8('0x24')];var _0x4e38f4;if(_0x5c1d18>=_0x2e1bf6){_0x5c1d18=_0x2e1bf6;_0x4e38f4=0xc8;}else{_0x4e38f4=0xce;}_0x5d05b9[_0x73e8('0x22')](_0x4e38f4);return _0x5d05b9[_0x73e8('0x27')](_0x73e8('0x28'),_0x10073b+'-'+_0x5c1d18+'/'+_0x2e1bf6)[_0x73e8('0x29')](_0x224fe7);}return null;};}function patchUpdates(_0x4634ef){return function(_0x1d670d){try{jsonpatch['apply'](_0x1d670d,_0x4634ef,!![]);}catch(_0x1ef159){return BPromise[_0x73e8('0x2a')](_0x1ef159);}return _0x1d670d[_0x73e8('0x2b')]();};}function saveUpdates(_0x4442d8,_0x342b77){return function(_0x599b26){if(_0x599b26){return _0x599b26[_0x73e8('0x2c')](_0x4442d8)[_0x73e8('0x2d')](function(_0x221fae){return _0x221fae;});}return null;};}function removeEntity(_0x145949,_0x7dbdc4){return function(_0x19e4e7){if(_0x19e4e7){return _0x19e4e7[_0x73e8('0x2e')]()['then'](function(){_0x145949[_0x73e8('0x22')](0xcc)[_0x73e8('0x2f')]();});}};}function handleEntityNotFound(_0x484cc4,_0x6df5ab){return function(_0x231f5b){if(!_0x231f5b){_0x484cc4['sendStatus'](0x194);}return _0x231f5b;};}function handleError(_0x2cda90,_0x4aee60){_0x4aee60=_0x4aee60||0x1f4;return function(_0x429c1e){logger[_0x73e8('0x1c')](_0x429c1e[_0x73e8('0x30')]);if(_0x429c1e[_0x73e8('0x31')]){delete _0x429c1e[_0x73e8('0x31')];}_0x2cda90['status'](_0x4aee60)[_0x73e8('0x32')](_0x429c1e);};}exports[_0x73e8('0x33')]=function(_0x50484c,_0x3c8eb0){var _0x612b47={},_0x3b6118={},_0x593bd5={'count':0x0,'rows':[]};var _0x1e69db=_['map'](db[_0x73e8('0x34')]['rawAttributes'],function(_0x1e9c89){return{'name':_0x1e9c89[_0x73e8('0x35')],'type':_0x1e9c89[_0x73e8('0x36')][_0x73e8('0x37')]};});_0x3b6118[_0x73e8('0x38')]=_[_0x73e8('0x39')](_0x1e69db,_0x73e8('0x31'));_0x3b6118[_0x73e8('0x3a')]=_['keys'](_0x50484c[_0x73e8('0x3a')]);_0x3b6118[_0x73e8('0x3b')]=_['intersection'](_0x3b6118[_0x73e8('0x38')],_0x3b6118[_0x73e8('0x3a')]);_0x612b47[_0x73e8('0x3c')]=_[_0x73e8('0x3d')](_0x3b6118[_0x73e8('0x38')],qs[_0x73e8('0x3e')](_0x50484c[_0x73e8('0x3a')][_0x73e8('0x3e')]));_0x612b47[_0x73e8('0x3c')]=_0x612b47['attributes']['length']?_0x612b47[_0x73e8('0x3c')]:_0x3b6118[_0x73e8('0x38')];if(!_0x50484c['query'][_0x73e8('0x3f')](_0x73e8('0x40'))){_0x612b47[_0x73e8('0x24')]=qs['limit'](_0x50484c['query']['limit']);_0x612b47['offset']=qs[_0x73e8('0x26')](_0x50484c['query'][_0x73e8('0x26')]);}_0x612b47['order']=qs[_0x73e8('0x41')](_0x50484c[_0x73e8('0x3a')][_0x73e8('0x41')]);_0x612b47[_0x73e8('0x42')]=qs['filters'](_[_0x73e8('0x43')](_0x50484c['query'],_0x3b6118[_0x73e8('0x3b')]),_0x1e69db);if(_0x50484c[_0x73e8('0x3a')][_0x73e8('0x44')]){_0x612b47[_0x73e8('0x42')]=_[_0x73e8('0x45')](_0x612b47[_0x73e8('0x42')],{'$or':_['map'](_0x1e69db,function(_0x388702){if(_0x388702[_0x73e8('0x36')]!==_0x73e8('0x46')){var _0x30af76={};_0x30af76[_0x388702[_0x73e8('0x31')]]={'$like':'%'+_0x50484c[_0x73e8('0x3a')]['filter']+'%'};return _0x30af76;}})});}_0x612b47=_[_0x73e8('0x45')]({},_0x612b47,_0x50484c['options']);var _0xdb7df5={'where':_0x612b47[_0x73e8('0x42')]};return db['ZendeskAccount']['count'](_0xdb7df5)[_0x73e8('0x2d')](function(_0x40da38){_0x593bd5[_0x73e8('0x25')]=_0x40da38;if(_0x50484c['query'][_0x73e8('0x47')]){_0x612b47[_0x73e8('0x48')]=[{'all':!![]}];}return db[_0x73e8('0x34')][_0x73e8('0x49')](_0x612b47);})[_0x73e8('0x2d')](function(_0x52141f){_0x593bd5[_0x73e8('0x4a')]=_0x52141f;return _0x593bd5;})[_0x73e8('0x2d')](respondWithFilteredResult(_0x3c8eb0,_0x612b47))[_0x73e8('0x20')](handleError(_0x3c8eb0,null));};exports[_0x73e8('0x4b')]=function(_0x4a95e2,_0x3e191f){var _0x31731f={'raw':![],'where':{'id':_0x4a95e2[_0x73e8('0x4c')]['id']}},_0xf77ac0={};_0xf77ac0[_0x73e8('0x38')]=_[_0x73e8('0x4d')](db[_0x73e8('0x34')][_0x73e8('0x4e')]);_0xf77ac0[_0x73e8('0x3a')]=_[_0x73e8('0x4d')](_0x4a95e2['query']);_0xf77ac0[_0x73e8('0x3b')]=_[_0x73e8('0x3d')](_0xf77ac0[_0x73e8('0x38')],_0xf77ac0[_0x73e8('0x3a')]);_0x31731f['attributes']=_[_0x73e8('0x3d')](_0xf77ac0[_0x73e8('0x38')],qs[_0x73e8('0x3e')](_0x4a95e2[_0x73e8('0x3a')][_0x73e8('0x3e')]));_0x31731f[_0x73e8('0x3c')]=_0x31731f[_0x73e8('0x3c')]['length']?_0x31731f['attributes']:_0xf77ac0[_0x73e8('0x38')];if(_0x4a95e2['query'][_0x73e8('0x47')]){_0x31731f['include']=[{'all':!![]}];}_0x31731f=_[_0x73e8('0x45')]({},_0x31731f,_0x4a95e2['options']);return db['ZendeskAccount'][_0x73e8('0x4f')](_0x31731f)['then'](handleEntityNotFound(_0x3e191f,null))[_0x73e8('0x2d')](respondWithResult(_0x3e191f,null))[_0x73e8('0x20')](handleError(_0x3e191f,null));};exports[_0x73e8('0x50')]=function(_0x2ef872,_0x5a5c61){return db[_0x73e8('0x34')]['create'](_0x2ef872[_0x73e8('0x51')],{})['then'](respondWithResult(_0x5a5c61,0xc9))[_0x73e8('0x20')](handleError(_0x5a5c61,null));};exports[_0x73e8('0x2c')]=function(_0x536d61,_0x15a00d){if(_0x536d61['body']['id']){delete _0x536d61[_0x73e8('0x51')]['id'];}return db['ZendeskAccount'][_0x73e8('0x4f')]({'where':{'id':_0x536d61['params']['id']}})[_0x73e8('0x2d')](handleEntityNotFound(_0x15a00d,null))[_0x73e8('0x2d')](saveUpdates(_0x536d61[_0x73e8('0x51')],null))[_0x73e8('0x2d')](respondWithResult(_0x15a00d,null))[_0x73e8('0x20')](handleError(_0x15a00d,null));};exports[_0x73e8('0x2e')]=function(_0x463ece,_0x2c61a5){return db[_0x73e8('0x34')][_0x73e8('0x4f')]({'where':{'id':_0x463ece[_0x73e8('0x4c')]['id']}})[_0x73e8('0x2d')](handleEntityNotFound(_0x2c61a5,null))['then'](removeEntity(_0x2c61a5,null))[_0x73e8('0x20')](handleError(_0x2c61a5,null));};exports['getConfigurations']=function(_0x412b5c,_0x8eddaa,_0x27f083){var _0x35b79c={};var _0x2b16e1={};var _0x1fa686;var _0x2686aa;return db[_0x73e8('0x34')][_0x73e8('0x52')]({'where':{'id':_0x412b5c[_0x73e8('0x4c')]['id']}})[_0x73e8('0x2d')](handleEntityNotFound(_0x8eddaa,null))[_0x73e8('0x2d')](function(_0x3091ac){if(_0x3091ac){_0x1fa686=_0x3091ac;_0x2b16e1[_0x73e8('0x38')]=_['keys'](db['ZendeskConfiguration'][_0x73e8('0x4e')]);_0x2b16e1[_0x73e8('0x3a')]=_[_0x73e8('0x4d')](_0x412b5c[_0x73e8('0x3a')]);_0x2b16e1[_0x73e8('0x3b')]=_['intersection'](_0x2b16e1[_0x73e8('0x38')],_0x2b16e1[_0x73e8('0x3a')]);_0x35b79c[_0x73e8('0x3c')]=_[_0x73e8('0x3d')](_0x2b16e1[_0x73e8('0x38')],qs[_0x73e8('0x3e')](_0x412b5c[_0x73e8('0x3a')][_0x73e8('0x3e')]));_0x35b79c[_0x73e8('0x3c')]=_0x35b79c[_0x73e8('0x3c')][_0x73e8('0x53')]?_0x35b79c[_0x73e8('0x3c')]:_0x2b16e1[_0x73e8('0x38')];_0x35b79c[_0x73e8('0x54')]=qs['sort'](_0x412b5c[_0x73e8('0x3a')][_0x73e8('0x41')]);_0x35b79c[_0x73e8('0x42')]=qs['filters'](_[_0x73e8('0x43')](_0x412b5c[_0x73e8('0x3a')],_0x2b16e1[_0x73e8('0x3b')]));if(_0x412b5c[_0x73e8('0x3a')]['filter']){_0x35b79c[_0x73e8('0x42')]=_['merge'](_0x35b79c[_0x73e8('0x42')],{'$or':_[_0x73e8('0x39')](_0x35b79c[_0x73e8('0x3c')],function(_0x28d5ae){var _0x2305db={};_0x2305db[_0x28d5ae]={'$like':'%'+_0x412b5c['query'][_0x73e8('0x44')]+'%'};return _0x2305db;})});}_0x35b79c=_['merge']({},_0x35b79c,_0x412b5c[_0x73e8('0x55')]);return _0x1fa686[_0x73e8('0x56')](_0x35b79c);}})[_0x73e8('0x2d')](function(_0x2d03d8){if(_0x2d03d8){_0x2686aa=_0x2d03d8[_0x73e8('0x53')];if(!_0x412b5c[_0x73e8('0x3a')]['hasOwnProperty'](_0x73e8('0x40'))){_0x35b79c[_0x73e8('0x24')]=qs[_0x73e8('0x24')](_0x412b5c['query'][_0x73e8('0x24')]);_0x35b79c[_0x73e8('0x26')]=qs[_0x73e8('0x26')](_0x412b5c['query'][_0x73e8('0x26')]);}return _0x1fa686[_0x73e8('0x56')](_0x35b79c);}})['then'](function(_0x53d9c9){if(_0x53d9c9){return _0x53d9c9?{'count':_0x2686aa,'rows':_0x53d9c9}:null;}})[_0x73e8('0x2d')](respondWithResult(_0x8eddaa,null))[_0x73e8('0x20')](handleError(_0x8eddaa,null));};exports[_0x73e8('0x57')]=function(_0xb89ca0,_0x53c1bd,_0x5abf4b){if(_0xb89ca0[_0x73e8('0x51')]['id']){delete _0xb89ca0[_0x73e8('0x51')]['id'];}return db[_0x73e8('0x34')][_0x73e8('0x52')]({'where':{'id':_0xb89ca0[_0x73e8('0x4c')]['id']}})[_0x73e8('0x2d')](handleEntityNotFound(_0x53c1bd,null))[_0x73e8('0x2d')](function(_0x15de8e){if(_0x15de8e){_0xb89ca0['body'][_0x73e8('0x58')]=_0x15de8e['id'];_0xb89ca0['body'][_0x73e8('0x59')]=integrations[_0x73e8('0x5a')](_0xb89ca0['body'][_0x73e8('0x5b')],_0xb89ca0[_0x73e8('0x51')][_0x73e8('0x36')]);_0xb89ca0[_0x73e8('0x51')][_0x73e8('0x5c')]=integrations['getDescriptions'](_0xb89ca0[_0x73e8('0x51')]['channel'],_0xb89ca0['body']['type']);return db[_0x73e8('0x5d')]['create'](_0xb89ca0[_0x73e8('0x51')],{'include':[{'model':db[_0x73e8('0x5e')],'as':_0x73e8('0x59')},{'model':db[_0x73e8('0x5e')],'as':_0x73e8('0x5c')}]});}return null;})[_0x73e8('0x2d')](respondWithResult(_0x53c1bd,null))[_0x73e8('0x20')](handleError(_0x53c1bd,null));};exports['getFields']=function(_0x3413b1,_0x1dd16c,_0x2ab8f8){var _0x2c69ba='';return db['ZendeskAccount'][_0x73e8('0x52')]({'where':{'id':_0x3413b1[_0x73e8('0x4c')]['id']},'attributes':['id',_0x73e8('0x5f'),'password','token','authType',_0x73e8('0x60')]})[_0x73e8('0x2d')](handleEntityNotFound(_0x1dd16c,null))[_0x73e8('0x2d')](function(_0x349c02){if(_0x349c02){_0x2c69ba=_0x349c02[_0x73e8('0x60')];var _0x522029=_0x2c69ba[_0x73e8('0x61')](-0x1);if(_0x522029==='/'){_0x2c69ba=_0x2c69ba[_0x73e8('0x62')](0x0,_0x2c69ba['lastIndexOf'](_0x522029));}var _0x241e96={'method':'GET','uri':util['format'](_0x73e8('0x63'),_0x2c69ba,_0x73e8('0x64')),'json':!![]};switch(_0x349c02['authType']){case'password':_0x241e96[_0x73e8('0x65')]={'Authorization':util[_0x73e8('0x66')](_0x73e8('0x67'),new Buffer(util[_0x73e8('0x66')](_0x73e8('0x68'),_0x349c02[_0x73e8('0x5f')],_0x349c02[_0x73e8('0x69')]))[_0x73e8('0x6a')](_0x73e8('0x6b')))};break;case _0x73e8('0x6c'):_0x241e96[_0x73e8('0x65')]={'Authorization':util[_0x73e8('0x66')](_0x73e8('0x67'),new Buffer(util[_0x73e8('0x66')]('%s/token:%s',_0x349c02[_0x73e8('0x5f')],_0x349c02['token']))[_0x73e8('0x6a')](_0x73e8('0x6b')))};break;default:throw new db[(_0x73e8('0x6d'))]['ValidationError'](_0x73e8('0x6e'));}return rp(_0x241e96);}})[_0x73e8('0x2d')](function(_0x1d22b8){if(_0x1d22b8){var _0x375abb=[_0x73e8('0x6f'),_0x73e8('0x70'),_0x73e8('0x71'),'assignee'];_[_0x73e8('0x72')](_0x1d22b8[_0x73e8('0x64')],function(_0x6e8a12){return _0x375abb[_0x73e8('0x73')](_0x6e8a12['type']);});return{'count':_0x1d22b8[_0x73e8('0x64')]['length'],'rows':_[_0x73e8('0x39')](_0x1d22b8['ticket_fields'],function(_0x3c9943){return{'id':_0x3c9943['id'],'name':_0x3c9943[_0x73e8('0x74')]>0x7?_0x3c9943['title']:_0x3c9943[_0x73e8('0x36')],'custom':_0x3c9943[_0x73e8('0x74')]>0x7?!![]:![],'options':_0x3c9943[_0x73e8('0x75')]?_0x3c9943[_0x73e8('0x75')]:_0x3c9943[_0x73e8('0x76')]?_0x3c9943['custom_field_options']:[]};})};}})[_0x73e8('0x2d')](respondWithResult(_0x1dd16c,null))[_0x73e8('0x20')](function(_0x341ab4){var _0xce5011=_0x3413b1[_0x73e8('0x3a')]['test']?0x1f4:_0x341ab4[_0x73e8('0x77')]||0x1f4;logger[_0x73e8('0x1c')](_0x73e8('0x78'),_0x73e8('0x79'),_0xce5011,JSON['stringify'](_0x341ab4));delete _0x341ab4['name'];if(_0xce5011===0x191){_0xce5011=0x190;}_0x1dd16c[_0x73e8('0x22')](_0xce5011)['send'](_0x3413b1[_0x73e8('0x3a')]['test']?{'message':_0x73e8('0x7a'),'statusCode':_0x341ab4[_0x73e8('0x77')]}:_0x341ab4);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 6f46b89..1b38d6f 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 _0x6cd3=['path','rimraf','../../config/environment','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x47d7ec,_0x17f197){var _0x98674a=function(_0x4f7db3){while(--_0x4f7db3){_0x47d7ec['push'](_0x47d7ec['shift']());}};_0x98674a(++_0x17f197);}(_0x6cd3,0x1ab));var _0x36cd=function(_0xdbe2de,_0x3bdc5a){_0xdbe2de=_0xdbe2de-0x0;var _0x2facd7=_0x6cd3[_0xdbe2de];return _0x2facd7;};'use strict';var _=require(_0x36cd('0x0'));var util=require(_0x36cd('0x1'));var logger=require(_0x36cd('0x2'))(_0x36cd('0x3'));var moment=require(_0x36cd('0x4'));var BPromise=require(_0x36cd('0x5'));var rp=require(_0x36cd('0x6'));var fs=require('fs');var path=require(_0x36cd('0x7'));var rimraf=require(_0x36cd('0x8'));var config=require(_0x36cd('0x9'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x36cd('0xa'));module[_0x36cd('0xb')]=function(_0x27381d,_0x40a5da){return _0x27381d['define'](_0x36cd('0xc'),attributes,{'tableName':_0x36cd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x154d=['ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x23b910,_0x591718){var _0x124c00=function(_0x11269c){while(--_0x11269c){_0x23b910['push'](_0x23b910['shift']());}};_0x124c00(++_0x591718);}(_0x154d,0x9e));var _0xd154=function(_0xf4639c,_0x213932){_0xf4639c=_0xf4639c-0x0;var _0x22cc63=_0x154d[_0xf4639c];return _0x22cc63;};'use strict';var _=require(_0xd154('0x0'));var util=require(_0xd154('0x1'));var logger=require(_0xd154('0x2'))(_0xd154('0x3'));var moment=require(_0xd154('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd154('0x5'));var rimraf=require(_0xd154('0x6'));var config=require('../../config/environment');var attributes=require(_0xd154('0x7'));var integrations=require(_0xd154('0x8'));module[_0xd154('0x9')]=function(_0x3654a9,_0x6563e){return _0x3654a9[_0xd154('0xa')](_0xd154('0xb'),attributes,{'tableName':_0xd154('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 00a2e95..14719e9 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 _0x757a=['stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2a2a12,_0x738c8d){var _0x20335d=function(_0x5aef2e){while(--_0x5aef2e){_0x2a2a12['push'](_0x2a2a12['shift']());}};_0x20335d(++_0x738c8d);}(_0x757a,0xde));var _0xa757=function(_0x1a9a54,_0x296b85){_0x1a9a54=_0x1a9a54-0x0;var _0x221121=_0x757a[_0x1a9a54];return _0x221121;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetZendeskAccount',_0x4d9f58);logger['debug']('GetZendeskAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetZendeskAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file +var _0xd8b0=['raw','where','include','map','model','attributes','ShowZendeskAccount','find','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','options'];(function(_0x59add1,_0x541f05){var _0x371082=function(_0x191e54){while(--_0x191e54){_0x59add1['push'](_0x59add1['shift']());}};_0x371082(++_0x541f05);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['findAll']({'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,'limit':_0x5fecbd['options']?_0x5fecbd[_0x0d8b('0x18')]['limit']||null:null,'include':_0x5fecbd['options']?_0x5fecbd['options'][_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x221071){return{'model':db[_0x221071[_0x0d8b('0x1d')]],'as':_0x221071['as'],'attributes':_0x221071[_0x0d8b('0x1e')],'include':_0x221071[_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x221071['include'],function(_0xe8bbee){return{'model':db[_0xe8bbee[_0x0d8b('0x1d')]],'as':_0xe8bbee['as'],'attributes':_0xe8bbee['attributes'],'include':_0xe8bbee[_0x0d8b('0x1b')]?_['map'](_0xe8bbee[_0x0d8b('0x1b')],function(_0x234bdd){return{'model':db[_0x234bdd[_0x0d8b('0x1d')]],'as':_0x234bdd['as'],'attributes':_0x234bdd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x28f639){logger[_0x0d8b('0xb')]('GetZendeskAccount',_0x5fecbd);logger[_0x0d8b('0xe')]('GetZendeskAccount',_0x5fecbd,JSON[_0x0d8b('0x10')](_0x28f639));_0x18dd2d(_0x28f639);})['catch'](function(_0x97050a){logger['error'](_0x0d8b('0x16'),_0x97050a['message'],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x97050a['message']));});});};exports[_0x0d8b('0x1f')]=function(_0x106e4c){var _0x2c058d=this;return new Promise(function(_0x56120a,_0x4c80a2){return db['ZendeskAccount'][_0x0d8b('0x20')]({'raw':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1e')]||null:null,'include':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')]?_['map'](_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x4b3ea0){return{'model':db[_0x4b3ea0[_0x0d8b('0x1d')]],'as':_0x4b3ea0['as'],'attributes':_0x4b3ea0[_0x0d8b('0x1e')],'include':_0x4b3ea0[_0x0d8b('0x1b')]?_['map'](_0x4b3ea0[_0x0d8b('0x1b')],function(_0x2c507e){return{'model':db[_0x2c507e[_0x0d8b('0x1d')]],'as':_0x2c507e['as'],'attributes':_0x2c507e[_0x0d8b('0x1e')],'include':_0x2c507e[_0x0d8b('0x1b')]?_['map'](_0x2c507e[_0x0d8b('0x1b')],function(_0x1649fc){return{'model':db[_0x1649fc['model']],'as':_0x1649fc['as'],'attributes':_0x1649fc[_0x0d8b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0d8b('0xa')](function(_0x188af2){logger[_0x0d8b('0xb')](_0x0d8b('0x1f'),_0x106e4c);logger['debug']('ShowZendeskAccount',_0x106e4c,JSON[_0x0d8b('0x10')](_0x188af2));_0x56120a(_0x188af2);})['catch'](function(_0x531c55){logger[_0x0d8b('0x11')](_0x0d8b('0x1f'),_0x531c55[_0x0d8b('0x13')],_0x106e4c);_0x4c80a2(_0x2c058d[_0x0d8b('0x11')](0x1f4,_0x531c55[_0x0d8b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index d11d754..f1e5ed4 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 _0x67a0=['getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0xb4a704,_0x1deea9){var _0x23a1d5=function(_0x2f0120){while(--_0x2f0120){_0xb4a704['push'](_0xb4a704['shift']());}};_0x23a1d5(++_0x1deea9);}(_0x67a0,0x1ec));var _0x067a=function(_0x545459,_0x201c06){_0x545459=_0x545459-0x0;var _0x445b21=_0x67a0[_0x545459];return _0x445b21;};'use strict';var multer=require(_0x067a('0x0'));var util=require(_0x067a('0x1'));var path=require(_0x067a('0x2'));var timeout=require('connect-timeout');var express=require(_0x067a('0x3'));var router=express[_0x067a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x067a('0x5'));var interaction=require(_0x067a('0x6'));var config=require(_0x067a('0x7'));var controller=require('./intZendeskConfiguration.controller');router[_0x067a('0x8')]('/',auth[_0x067a('0x9')](),controller[_0x067a('0xa')]);router[_0x067a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x067a('0xb')]);router[_0x067a('0x8')]('/:id/fields',auth[_0x067a('0x9')](),controller[_0x067a('0xc')]);router[_0x067a('0x8')](_0x067a('0xd'),auth['isAuthenticated'](),controller[_0x067a('0xe')]);router[_0x067a('0x8')]('/:id/descriptions',auth[_0x067a('0x9')](),controller[_0x067a('0xf')]);router[_0x067a('0x8')](_0x067a('0x10'),auth[_0x067a('0x9')](),controller[_0x067a('0x11')]);router[_0x067a('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x067a('0x12')](_0x067a('0x10'),auth[_0x067a('0x9')](),controller[_0x067a('0x13')]);router[_0x067a('0x14')](_0x067a('0x15'),auth[_0x067a('0x9')](),controller['update']);router[_0x067a('0x16')](_0x067a('0x15'),auth[_0x067a('0x9')](),controller[_0x067a('0x17')]);module['exports']=router; \ No newline at end of file +var _0x8b6e=['post','create','setTags','update','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/descriptions','/:id/tags','getTags'];(function(_0x46fe2b,_0x3931b3){var _0x33a923=function(_0x286913){while(--_0x286913){_0x46fe2b['push'](_0x46fe2b['shift']());}};_0x33a923(++_0x3931b3);}(_0x8b6e,0x16f));var _0xe8b6=function(_0x30e045,_0x278ce2){_0x30e045=_0x30e045-0x0;var _0x488323=_0x8b6e[_0x30e045];return _0x488323;};'use strict';var multer=require('multer');var util=require(_0xe8b6('0x0'));var path=require(_0xe8b6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe8b6('0x2')]();var fs_extra=require(_0xe8b6('0x3'));var auth=require(_0xe8b6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe8b6('0x5'));var controller=require(_0xe8b6('0x6'));router['get']('/',auth[_0xe8b6('0x7')](),controller[_0xe8b6('0x8')]);router[_0xe8b6('0x9')](_0xe8b6('0xa'),auth['isAuthenticated'](),controller[_0xe8b6('0xb')]);router[_0xe8b6('0x9')](_0xe8b6('0xc'),auth[_0xe8b6('0x7')](),controller[_0xe8b6('0xd')]);router['get']('/:id/subjects',auth[_0xe8b6('0x7')](),controller['getSubjects']);router[_0xe8b6('0x9')](_0xe8b6('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xe8b6('0x9')](_0xe8b6('0xf'),auth['isAuthenticated'](),controller[_0xe8b6('0x10')]);router[_0xe8b6('0x11')]('/',auth[_0xe8b6('0x7')](),controller[_0xe8b6('0x12')]);router['post'](_0xe8b6('0xf'),auth[_0xe8b6('0x7')](),controller[_0xe8b6('0x13')]);router['put'](_0xe8b6('0xa'),auth[_0xe8b6('0x7')](),controller[_0xe8b6('0x14')]);router[_0xe8b6('0x15')](_0xe8b6('0xa'),auth[_0xe8b6('0x7')](),controller[_0xe8b6('0x16')]);module[_0xe8b6('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 4c9c389..692037d 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 _0x3260=['STRING'];(function(_0x398a03,_0x326e0c){var _0x67ef9f=function(_0x17555b){while(--_0x17555b){_0x398a03['push'](_0x398a03['shift']());}};_0x67ef9f(++_0x326e0c);}(_0x3260,0xda));var _0x0326=function(_0x260360,_0xdcca2f){_0x260360=_0x260360-0x0;var _0x1db10b=_0x3260[_0x260360];return _0x1db10b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0326('0x0')]}}; \ No newline at end of file +var _0x1e39=['exports','STRING'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1e39,0x9e));var _0x91e3=function(_0x54bac5,_0x8d3a16){_0x54bac5=_0x54bac5-0x0;var _0xc15971=_0x1e39[_0x54bac5];return _0xc15971;};'use strict';var Sequelize=require('sequelize');module[_0x91e3('0x0')]={'name':{'type':Sequelize[_0x91e3('0x1')]},'description':{'type':Sequelize[_0x91e3('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index afd34ec..d7e51a5 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 _0xf7b3=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','catch','sendStatus','end','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','destroy','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','rows','params','find','create','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','setTags','ids','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x3b4a5a,_0x309a3c){var _0x4305a1=function(_0x40b3c5){while(--_0x40b3c5){_0x3b4a5a['push'](_0x3b4a5a['shift']());}};_0x4305a1(++_0x309a3c);}(_0xf7b3,0x1d7));var _0x3f7b=function(_0xb83ec2,_0x18e73b){_0xb83ec2=_0xb83ec2-0x0;var _0x4d2fbf=_0xf7b3[_0xb83ec2];return _0x4d2fbf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3f7b('0x0'));var jsonpatch=require(_0x3f7b('0x1'));var rp=require(_0x3f7b('0x2'));var moment=require(_0x3f7b('0x3'));var BPromise=require(_0x3f7b('0x4'));var Mustache=require(_0x3f7b('0x5'));var util=require(_0x3f7b('0x6'));var path=require(_0x3f7b('0x7'));var sox=require(_0x3f7b('0x8'));var csv=require(_0x3f7b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f7b('0xa'));var _=require(_0x3f7b('0xb'));var squel=require(_0x3f7b('0xc'));var crypto=require(_0x3f7b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3f7b('0xe'));var toCsv=require(_0x3f7b('0x9'));var querystring=require(_0x3f7b('0xf'));var Papa=require(_0x3f7b('0x10'));var Redis=require(_0x3f7b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3f7b('0x12'));var as=require(_0x3f7b('0x13'));var hardwareService=require(_0x3f7b('0x14'));var logger=require(_0x3f7b('0x15'))(_0x3f7b('0x16'));var utils=require(_0x3f7b('0x17'));var config=require(_0x3f7b('0x18'));var licenseUtil=require(_0x3f7b('0x19'));var db=require(_0x3f7b('0x1a'))['db'];var jayson=require(_0x3f7b('0x1b'));var client=jayson[_0x3f7b('0x1c')][_0x3f7b('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2cb3fb,_0xba6ab1,_0x1e9e73,_0x36eb22){return new BPromise(function(_0x54fa73,_0xd179c8){var _0x911105=_0x36eb22||client;return _0x911105[_0x3f7b('0x1e')](_0x2cb3fb,_0x1e9e73)[_0x3f7b('0x1f')](function(_0x1773a6){logger[_0x3f7b('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0xba6ab1,_0x3f7b('0x21'));logger[_0x3f7b('0x22')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0xba6ab1,_0x3f7b('0x21'),JSON[_0x3f7b('0x23')](_0x1773a6));if(_0x1773a6[_0x3f7b('0x24')]){if(_0x1773a6[_0x3f7b('0x24')][_0x3f7b('0x25')]===0x1f4){logger['error'](_0x3f7b('0x26'),_0xba6ab1,_0x1773a6[_0x3f7b('0x24')][_0x3f7b('0x27')]);return _0xd179c8(_0x1773a6[_0x3f7b('0x24')][_0x3f7b('0x27')]);}logger[_0x3f7b('0x24')](_0x3f7b('0x26'),_0xba6ab1,_0x1773a6[_0x3f7b('0x24')][_0x3f7b('0x27')]);return _0x54fa73(_0x1773a6[_0x3f7b('0x24')]['message']);}else{logger[_0x3f7b('0x20')](_0x3f7b('0x26'),_0xba6ab1,_0x3f7b('0x21'));_0x54fa73(_0x1773a6['result'][_0x3f7b('0x27')]);}})[_0x3f7b('0x28')](function(_0x2ef770){logger[_0x3f7b('0x24')](_0x3f7b('0x26'),_0xba6ab1,_0x2ef770);_0xd179c8(_0x2ef770);});});}function respondWithStatusCode(_0x4bc643,_0x1a1a75){_0x1a1a75=_0x1a1a75||0xcc;return function(_0x1f70ca){if(_0x1f70ca){return _0x4bc643[_0x3f7b('0x29')](_0x1a1a75);}return _0x4bc643['status'](_0x1a1a75)[_0x3f7b('0x2a')]();};}function respondWithResult(_0x1808dc,_0x209ce9){_0x209ce9=_0x209ce9||0xc8;return function(_0x1af02e){if(_0x1af02e){return _0x1808dc[_0x3f7b('0x2b')](_0x209ce9)['json'](_0x1af02e);}};}function respondWithFilteredResult(_0x529132,_0x3d9a42){return function(_0x4d7f77){if(_0x4d7f77){var _0x4e533e=typeof _0x3d9a42[_0x3f7b('0x2c')]==='undefined'&&typeof _0x3d9a42[_0x3f7b('0x2d')]===_0x3f7b('0x2e');var _0x71f210=_0x4d7f77['count'];var _0x3ae564=_0x4e533e?0x0:_0x3d9a42[_0x3f7b('0x2c')];var _0x3ebf93=_0x4e533e?_0x4d7f77['count']:_0x3d9a42['offset']+_0x3d9a42[_0x3f7b('0x2d')];var _0x32005c;if(_0x3ebf93>=_0x71f210){_0x3ebf93=_0x71f210;_0x32005c=0xc8;}else{_0x32005c=0xce;}_0x529132['status'](_0x32005c);return _0x529132[_0x3f7b('0x2f')](_0x3f7b('0x30'),_0x3ae564+'-'+_0x3ebf93+'/'+_0x71f210)[_0x3f7b('0x31')](_0x4d7f77);}return null;};}function patchUpdates(_0x599a27){return function(_0xf07a9b){try{jsonpatch[_0x3f7b('0x32')](_0xf07a9b,_0x599a27,!![]);}catch(_0x31dc57){return BPromise[_0x3f7b('0x33')](_0x31dc57);}return _0xf07a9b['save']();};}function saveUpdates(_0x476e01,_0x1e730f){return function(_0x2057a0){if(_0x2057a0){return _0x2057a0[_0x3f7b('0x34')](_0x476e01)['then'](function(_0x2c59f2){return _0x2c59f2;});}return null;};}function removeEntity(_0x209082,_0x258a1d){return function(_0x379715){if(_0x379715){return _0x379715[_0x3f7b('0x35')]()[_0x3f7b('0x1f')](function(){_0x209082[_0x3f7b('0x2b')](0xcc)[_0x3f7b('0x2a')]();});}};}function handleEntityNotFound(_0xd078e7,_0x571959){return function(_0x30dcfd){if(!_0x30dcfd){_0xd078e7['sendStatus'](0x194);}return _0x30dcfd;};}function handleError(_0x31e77d,_0x1c1684){_0x1c1684=_0x1c1684||0x1f4;return function(_0x5a43e2){logger['error'](_0x5a43e2[_0x3f7b('0x36')]);if(_0x5a43e2[_0x3f7b('0x37')]){delete _0x5a43e2[_0x3f7b('0x37')];}_0x31e77d['status'](_0x1c1684)[_0x3f7b('0x38')](_0x5a43e2);};}exports[_0x3f7b('0x39')]=function(_0x46f327,_0x1ddeaa){var _0x1bddd9={},_0x32fb61={},_0x3ae317={'count':0x0,'rows':[]};var _0x17a87d=_[_0x3f7b('0x3a')](db[_0x3f7b('0x3b')][_0x3f7b('0x3c')],function(_0x109966){return{'name':_0x109966[_0x3f7b('0x3d')],'type':_0x109966[_0x3f7b('0x3e')][_0x3f7b('0x3f')]};});_0x32fb61[_0x3f7b('0x40')]=_[_0x3f7b('0x3a')](_0x17a87d,_0x3f7b('0x37'));_0x32fb61['query']=_[_0x3f7b('0x41')](_0x46f327['query']);_0x32fb61[_0x3f7b('0x42')]=_[_0x3f7b('0x43')](_0x32fb61[_0x3f7b('0x40')],_0x32fb61['query']);_0x1bddd9[_0x3f7b('0x44')]=_[_0x3f7b('0x43')](_0x32fb61[_0x3f7b('0x40')],qs[_0x3f7b('0x45')](_0x46f327[_0x3f7b('0x46')][_0x3f7b('0x45')]));_0x1bddd9[_0x3f7b('0x44')]=_0x1bddd9[_0x3f7b('0x44')][_0x3f7b('0x47')]?_0x1bddd9[_0x3f7b('0x44')]:_0x32fb61[_0x3f7b('0x40')];if(!_0x46f327[_0x3f7b('0x46')][_0x3f7b('0x48')](_0x3f7b('0x49'))){_0x1bddd9[_0x3f7b('0x2d')]=qs[_0x3f7b('0x2d')](_0x46f327[_0x3f7b('0x46')]['limit']);_0x1bddd9[_0x3f7b('0x2c')]=qs[_0x3f7b('0x2c')](_0x46f327[_0x3f7b('0x46')][_0x3f7b('0x2c')]);}_0x1bddd9[_0x3f7b('0x4a')]=qs[_0x3f7b('0x4b')](_0x46f327['query'][_0x3f7b('0x4b')]);_0x1bddd9[_0x3f7b('0x4c')]=qs[_0x3f7b('0x42')](_[_0x3f7b('0x4d')](_0x46f327[_0x3f7b('0x46')],_0x32fb61['filters']),_0x17a87d);if(_0x46f327['query'][_0x3f7b('0x4e')]){_0x1bddd9[_0x3f7b('0x4c')]=_['merge'](_0x1bddd9[_0x3f7b('0x4c')],{'$or':_[_0x3f7b('0x3a')](_0x17a87d,function(_0x3ce7ac){if(_0x3ce7ac[_0x3f7b('0x3e')]!==_0x3f7b('0x4f')){var _0x33a864={};_0x33a864[_0x3ce7ac[_0x3f7b('0x37')]]={'$like':'%'+_0x46f327[_0x3f7b('0x46')][_0x3f7b('0x4e')]+'%'};return _0x33a864;}})});}_0x1bddd9=_[_0x3f7b('0x50')]({},_0x1bddd9,_0x46f327[_0x3f7b('0x51')]);var _0x29c65f={'where':_0x1bddd9[_0x3f7b('0x4c')]};return db['ZendeskConfiguration']['count'](_0x29c65f)[_0x3f7b('0x1f')](function(_0xbddeb1){_0x3ae317[_0x3f7b('0x52')]=_0xbddeb1;if(_0x46f327[_0x3f7b('0x46')][_0x3f7b('0x53')]){_0x1bddd9[_0x3f7b('0x54')]=[{'all':!![]}];}return db[_0x3f7b('0x3b')]['findAll'](_0x1bddd9);})[_0x3f7b('0x1f')](function(_0x3d4c32){_0x3ae317[_0x3f7b('0x55')]=_0x3d4c32;return _0x3ae317;})[_0x3f7b('0x1f')](respondWithFilteredResult(_0x1ddeaa,_0x1bddd9))[_0x3f7b('0x28')](handleError(_0x1ddeaa,null));};exports['show']=function(_0x3fc52b,_0xe5836c){var _0x2dfe5d={'raw':![],'where':{'id':_0x3fc52b[_0x3f7b('0x56')]['id']}},_0x58bbfa={};_0x58bbfa[_0x3f7b('0x40')]=_[_0x3f7b('0x41')](db[_0x3f7b('0x3b')][_0x3f7b('0x3c')]);_0x58bbfa['query']=_[_0x3f7b('0x41')](_0x3fc52b['query']);_0x58bbfa[_0x3f7b('0x42')]=_['intersection'](_0x58bbfa[_0x3f7b('0x40')],_0x58bbfa['query']);_0x2dfe5d[_0x3f7b('0x44')]=_[_0x3f7b('0x43')](_0x58bbfa[_0x3f7b('0x40')],qs[_0x3f7b('0x45')](_0x3fc52b[_0x3f7b('0x46')]['fields']));_0x2dfe5d[_0x3f7b('0x44')]=_0x2dfe5d[_0x3f7b('0x44')]['length']?_0x2dfe5d[_0x3f7b('0x44')]:_0x58bbfa[_0x3f7b('0x40')];if(_0x3fc52b['query']['includeAll']){_0x2dfe5d[_0x3f7b('0x54')]=[{'all':!![]}];}_0x2dfe5d=_[_0x3f7b('0x50')]({},_0x2dfe5d,_0x3fc52b['options']);return db[_0x3f7b('0x3b')][_0x3f7b('0x57')](_0x2dfe5d)['then'](handleEntityNotFound(_0xe5836c,null))[_0x3f7b('0x1f')](respondWithResult(_0xe5836c,null))[_0x3f7b('0x28')](handleError(_0xe5836c,null));};exports[_0x3f7b('0x58')]=function(_0x8fe5ac,_0xa0bd69){return db['ZendeskConfiguration'][_0x3f7b('0x58')](_0x8fe5ac['body'],{})['then'](respondWithResult(_0xa0bd69,0xc9))['catch'](handleError(_0xa0bd69,null));};exports['update']=function(_0x27e990,_0x415f6e){if(_0x27e990[_0x3f7b('0x59')]['id']){delete _0x27e990[_0x3f7b('0x59')]['id'];}return db[_0x3f7b('0x3b')][_0x3f7b('0x57')]({'where':{'id':_0x27e990[_0x3f7b('0x56')]['id']}})['then'](handleEntityNotFound(_0x415f6e,null))[_0x3f7b('0x1f')](saveUpdates(_0x27e990[_0x3f7b('0x59')],null))[_0x3f7b('0x1f')](respondWithResult(_0x415f6e,null))[_0x3f7b('0x28')](handleError(_0x415f6e,null));};exports[_0x3f7b('0x35')]=function(_0x5f5c94,_0x353c11){return db[_0x3f7b('0x3b')][_0x3f7b('0x57')]({'where':{'id':_0x5f5c94['params']['id']}})[_0x3f7b('0x1f')](handleEntityNotFound(_0x353c11,null))[_0x3f7b('0x1f')](removeEntity(_0x353c11,null))['catch'](handleError(_0x353c11,null));};exports[_0x3f7b('0x5a')]=function(_0x5c3be3,_0x33e49b,_0x2989ab){var _0x425cc3={};var _0xd255f8={};var _0x542a53;var _0x2c57e3;return db['ZendeskConfiguration'][_0x3f7b('0x5b')]({'where':{'id':_0x5c3be3[_0x3f7b('0x56')]['id']}})[_0x3f7b('0x1f')](handleEntityNotFound(_0x33e49b,null))[_0x3f7b('0x1f')](function(_0x4e8182){if(_0x4e8182){_0x542a53=_0x4e8182;_0xd255f8[_0x3f7b('0x40')]=_[_0x3f7b('0x41')](db[_0x3f7b('0x5c')]['rawAttributes']);_0xd255f8[_0x3f7b('0x46')]=_[_0x3f7b('0x41')](_0x5c3be3[_0x3f7b('0x46')]);_0xd255f8[_0x3f7b('0x42')]=_[_0x3f7b('0x43')](_0xd255f8[_0x3f7b('0x40')],_0xd255f8[_0x3f7b('0x46')]);_0x425cc3['attributes']=_[_0x3f7b('0x43')](_0xd255f8[_0x3f7b('0x40')],qs[_0x3f7b('0x45')](_0x5c3be3['query'][_0x3f7b('0x45')]));_0x425cc3['attributes']=_0x425cc3['attributes'][_0x3f7b('0x47')]?_0x425cc3[_0x3f7b('0x44')]:_0xd255f8['model'];_0x425cc3['order']=qs[_0x3f7b('0x4b')](_0x5c3be3[_0x3f7b('0x46')][_0x3f7b('0x4b')]);_0x425cc3[_0x3f7b('0x4c')]=qs[_0x3f7b('0x42')](_[_0x3f7b('0x4d')](_0x5c3be3[_0x3f7b('0x46')],_0xd255f8[_0x3f7b('0x42')]));if(_0x5c3be3['query'][_0x3f7b('0x4e')]){_0x425cc3[_0x3f7b('0x4c')]=_[_0x3f7b('0x50')](_0x425cc3[_0x3f7b('0x4c')],{'$or':_['map'](_0x425cc3[_0x3f7b('0x44')],function(_0x2593b5){var _0x5733b8={};_0x5733b8[_0x2593b5]={'$like':'%'+_0x5c3be3[_0x3f7b('0x46')][_0x3f7b('0x4e')]+'%'};return _0x5733b8;})});}_0x425cc3=_[_0x3f7b('0x50')]({},_0x425cc3,_0x5c3be3['options']);return _0x542a53[_0x3f7b('0x5a')](_0x425cc3);}})[_0x3f7b('0x1f')](function(_0x5d977){if(_0x5d977){_0x2c57e3=_0x5d977[_0x3f7b('0x47')];if(!_0x5c3be3[_0x3f7b('0x46')][_0x3f7b('0x48')]('nolimit')){_0x425cc3[_0x3f7b('0x2d')]=qs[_0x3f7b('0x2d')](_0x5c3be3[_0x3f7b('0x46')]['limit']);_0x425cc3['offset']=qs['offset'](_0x5c3be3['query'][_0x3f7b('0x2c')]);}return _0x542a53[_0x3f7b('0x5a')](_0x425cc3);}})['then'](function(_0x493940){if(_0x493940){return _0x493940?{'count':_0x2c57e3,'rows':_0x493940}:null;}})['then'](respondWithResult(_0x33e49b,null))[_0x3f7b('0x28')](handleError(_0x33e49b,null));};exports[_0x3f7b('0x5d')]=function(_0x3d609d,_0x1f5e93,_0x4ad175){var _0x437aa4={};var _0x537557={};var _0x30b150;var _0x4a34e1;return db[_0x3f7b('0x3b')][_0x3f7b('0x5b')]({'where':{'id':_0x3d609d[_0x3f7b('0x56')]['id']}})[_0x3f7b('0x1f')](handleEntityNotFound(_0x1f5e93,null))['then'](function(_0x57bc70){if(_0x57bc70){_0x30b150=_0x57bc70;_0x537557[_0x3f7b('0x40')]=_[_0x3f7b('0x41')](db[_0x3f7b('0x5c')][_0x3f7b('0x3c')]);_0x537557[_0x3f7b('0x46')]=_[_0x3f7b('0x41')](_0x3d609d[_0x3f7b('0x46')]);_0x537557[_0x3f7b('0x42')]=_[_0x3f7b('0x43')](_0x537557[_0x3f7b('0x40')],_0x537557[_0x3f7b('0x46')]);_0x437aa4[_0x3f7b('0x44')]=_[_0x3f7b('0x43')](_0x537557[_0x3f7b('0x40')],qs[_0x3f7b('0x45')](_0x3d609d[_0x3f7b('0x46')][_0x3f7b('0x45')]));_0x437aa4[_0x3f7b('0x44')]=_0x437aa4[_0x3f7b('0x44')][_0x3f7b('0x47')]?_0x437aa4[_0x3f7b('0x44')]:_0x537557['model'];_0x437aa4[_0x3f7b('0x4a')]=qs[_0x3f7b('0x4b')](_0x3d609d[_0x3f7b('0x46')]['sort']);_0x437aa4[_0x3f7b('0x4c')]=qs[_0x3f7b('0x42')](_[_0x3f7b('0x4d')](_0x3d609d[_0x3f7b('0x46')],_0x537557[_0x3f7b('0x42')]));if(_0x3d609d[_0x3f7b('0x46')][_0x3f7b('0x4e')]){_0x437aa4[_0x3f7b('0x4c')]=_[_0x3f7b('0x50')](_0x437aa4[_0x3f7b('0x4c')],{'$or':_[_0x3f7b('0x3a')](_0x437aa4['attributes'],function(_0x515c4c){var _0x39e193={};_0x39e193[_0x515c4c]={'$like':'%'+_0x3d609d[_0x3f7b('0x46')][_0x3f7b('0x4e')]+'%'};return _0x39e193;})});}_0x437aa4=_[_0x3f7b('0x50')]({},_0x437aa4,_0x3d609d[_0x3f7b('0x51')]);return _0x30b150[_0x3f7b('0x5d')](_0x437aa4);}})['then'](function(_0x4ff009){if(_0x4ff009){_0x4a34e1=_0x4ff009[_0x3f7b('0x47')];if(!_0x3d609d['query']['hasOwnProperty'](_0x3f7b('0x49'))){_0x437aa4[_0x3f7b('0x2d')]=qs['limit'](_0x3d609d[_0x3f7b('0x46')]['limit']);_0x437aa4[_0x3f7b('0x2c')]=qs[_0x3f7b('0x2c')](_0x3d609d[_0x3f7b('0x46')][_0x3f7b('0x2c')]);}return _0x30b150[_0x3f7b('0x5d')](_0x437aa4);}})[_0x3f7b('0x1f')](function(_0xc99569){if(_0xc99569){return _0xc99569?{'count':_0x4a34e1,'rows':_0xc99569}:null;}})[_0x3f7b('0x1f')](respondWithResult(_0x1f5e93,null))[_0x3f7b('0x28')](handleError(_0x1f5e93,null));};exports[_0x3f7b('0x5e')]=function(_0x48fe69,_0x3861f5,_0x25b711){var _0x13525d={};var _0xd9f1ad={};var _0x18586a;var _0x3d8226;return db['ZendeskConfiguration'][_0x3f7b('0x5b')]({'where':{'id':_0x48fe69[_0x3f7b('0x56')]['id']}})[_0x3f7b('0x1f')](handleEntityNotFound(_0x3861f5,null))['then'](function(_0x2a7234){if(_0x2a7234){_0x18586a=_0x2a7234;_0xd9f1ad[_0x3f7b('0x40')]=_[_0x3f7b('0x41')](db['ZendeskField'][_0x3f7b('0x3c')]);_0xd9f1ad[_0x3f7b('0x46')]=_[_0x3f7b('0x41')](_0x48fe69['query']);_0xd9f1ad[_0x3f7b('0x42')]=_[_0x3f7b('0x43')](_0xd9f1ad['model'],_0xd9f1ad[_0x3f7b('0x46')]);_0x13525d['attributes']=_['intersection'](_0xd9f1ad[_0x3f7b('0x40')],qs[_0x3f7b('0x45')](_0x48fe69[_0x3f7b('0x46')][_0x3f7b('0x45')]));_0x13525d[_0x3f7b('0x44')]=_0x13525d[_0x3f7b('0x44')]['length']?_0x13525d[_0x3f7b('0x44')]:_0xd9f1ad['model'];_0x13525d[_0x3f7b('0x4a')]=qs['sort'](_0x48fe69[_0x3f7b('0x46')][_0x3f7b('0x4b')]);_0x13525d[_0x3f7b('0x4c')]=qs[_0x3f7b('0x42')](_[_0x3f7b('0x4d')](_0x48fe69[_0x3f7b('0x46')],_0xd9f1ad[_0x3f7b('0x42')]));if(_0x48fe69[_0x3f7b('0x46')]['filter']){_0x13525d[_0x3f7b('0x4c')]=_[_0x3f7b('0x50')](_0x13525d[_0x3f7b('0x4c')],{'$or':_[_0x3f7b('0x3a')](_0x13525d[_0x3f7b('0x44')],function(_0x341388){var _0x56126d={};_0x56126d[_0x341388]={'$like':'%'+_0x48fe69['query'][_0x3f7b('0x4e')]+'%'};return _0x56126d;})});}_0x13525d=_[_0x3f7b('0x50')]({},_0x13525d,_0x48fe69[_0x3f7b('0x51')]);return _0x18586a[_0x3f7b('0x5e')](_0x13525d);}})[_0x3f7b('0x1f')](function(_0x1aa24a){if(_0x1aa24a){_0x3d8226=_0x1aa24a[_0x3f7b('0x47')];if(!_0x48fe69[_0x3f7b('0x46')][_0x3f7b('0x48')](_0x3f7b('0x49'))){_0x13525d[_0x3f7b('0x2d')]=qs[_0x3f7b('0x2d')](_0x48fe69[_0x3f7b('0x46')]['limit']);_0x13525d[_0x3f7b('0x2c')]=qs['offset'](_0x48fe69[_0x3f7b('0x46')][_0x3f7b('0x2c')]);}return _0x18586a[_0x3f7b('0x5e')](_0x13525d);}})[_0x3f7b('0x1f')](function(_0x38020e){if(_0x38020e){return _0x38020e?{'count':_0x3d8226,'rows':_0x38020e}:null;}})['then'](respondWithResult(_0x3861f5,null))[_0x3f7b('0x28')](handleError(_0x3861f5,null));};exports['getTags']=function(_0x3963fd,_0x348d9e,_0x77229){var _0x310157={};var _0x315213={};var _0x8aa3dc;var _0x26e1b2;return db['ZendeskConfiguration'][_0x3f7b('0x5b')]({'where':{'id':_0x3963fd[_0x3f7b('0x56')]['id']}})[_0x3f7b('0x1f')](handleEntityNotFound(_0x348d9e,null))['then'](function(_0x399c34){if(_0x399c34){_0x8aa3dc=_0x399c34;_0x315213[_0x3f7b('0x40')]=_[_0x3f7b('0x41')](db['Tag'][_0x3f7b('0x3c')]);_0x315213[_0x3f7b('0x46')]=_[_0x3f7b('0x41')](_0x3963fd[_0x3f7b('0x46')]);_0x315213[_0x3f7b('0x42')]=_['intersection'](_0x315213[_0x3f7b('0x40')],_0x315213[_0x3f7b('0x46')]);_0x310157[_0x3f7b('0x44')]=_[_0x3f7b('0x43')](_0x315213[_0x3f7b('0x40')],qs[_0x3f7b('0x45')](_0x3963fd[_0x3f7b('0x46')][_0x3f7b('0x45')]));_0x310157[_0x3f7b('0x44')]=_0x310157[_0x3f7b('0x44')][_0x3f7b('0x47')]?_0x310157[_0x3f7b('0x44')]:_0x315213[_0x3f7b('0x40')];_0x310157[_0x3f7b('0x4a')]=qs[_0x3f7b('0x4b')](_0x3963fd[_0x3f7b('0x46')][_0x3f7b('0x4b')]);_0x310157['where']=qs['filters'](_[_0x3f7b('0x4d')](_0x3963fd['query'],_0x315213['filters']));if(_0x3963fd[_0x3f7b('0x46')][_0x3f7b('0x4e')]){_0x310157['where']=_[_0x3f7b('0x50')](_0x310157['where'],{'$or':_['map'](_0x310157[_0x3f7b('0x44')],function(_0x218001){var _0x34f610={};_0x34f610[_0x218001]={'$like':'%'+_0x3963fd[_0x3f7b('0x46')][_0x3f7b('0x4e')]+'%'};return _0x34f610;})});}_0x310157=_[_0x3f7b('0x50')]({},_0x310157,_0x3963fd[_0x3f7b('0x51')]);return _0x8aa3dc[_0x3f7b('0x5f')](_0x310157);}})[_0x3f7b('0x1f')](function(_0x516428){if(_0x516428){_0x26e1b2=_0x516428[_0x3f7b('0x47')];if(!_0x3963fd[_0x3f7b('0x46')][_0x3f7b('0x48')](_0x3f7b('0x49'))){_0x310157[_0x3f7b('0x2d')]=qs[_0x3f7b('0x2d')](_0x3963fd['query'][_0x3f7b('0x2d')]);_0x310157['offset']=qs[_0x3f7b('0x2c')](_0x3963fd[_0x3f7b('0x46')][_0x3f7b('0x2c')]);}return _0x8aa3dc['getTags'](_0x310157);}})['then'](function(_0x5ec491){if(_0x5ec491){return _0x5ec491?{'count':_0x26e1b2,'rows':_0x5ec491}:null;}})[_0x3f7b('0x1f')](respondWithResult(_0x348d9e,null))[_0x3f7b('0x28')](handleError(_0x348d9e,null));};exports[_0x3f7b('0x60')]=function(_0x3313c4,_0x409ed5,_0x464cad){if(_0x3313c4['body']['id']){delete _0x3313c4[_0x3f7b('0x59')]['id'];}return db['ZendeskConfiguration'][_0x3f7b('0x5b')]({'where':{'id':_0x3313c4['params']['id']}})[_0x3f7b('0x1f')](handleEntityNotFound(_0x409ed5,null))[_0x3f7b('0x1f')](function(_0x3613ff){if(_0x3613ff){return _0x3613ff[_0x3f7b('0x60')](_0x3313c4[_0x3f7b('0x59')][_0x3f7b('0x61')]||[]);}return null;})[_0x3f7b('0x1f')](respondWithResult(_0x409ed5,null))[_0x3f7b('0x28')](handleError(_0x409ed5,null));}; \ No newline at end of file +var _0x1880=['rows','show','params','keys','intersection','includeAll','find','create','body','update','destroy','getFields','findOne','ZendeskField','getSubjects','getDescriptions','options','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include'];(function(_0x3b58c6,_0x2c740d){var _0x4b42a4=function(_0x4ca724){while(--_0x4ca724){_0x3b58c6['push'](_0x3b58c6['shift']());}};_0x4b42a4(++_0x2c740d);}(_0x1880,0x12e));var _0x0188=function(_0x29a707,_0x342505){_0x29a707=_0x29a707-0x0;var _0x229e83=_0x1880[_0x29a707];return _0x229e83;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0188('0x0'));var zipdir=require(_0x0188('0x1'));var jsonpatch=require(_0x0188('0x2'));var rp=require('request-promise');var moment=require(_0x0188('0x3'));var BPromise=require(_0x0188('0x4'));var Mustache=require(_0x0188('0x5'));var util=require('util');var path=require(_0x0188('0x6'));var sox=require(_0x0188('0x7'));var csv=require(_0x0188('0x8'));var ejs=require(_0x0188('0x9'));var fs=require('fs');var fs_extra=require(_0x0188('0xa'));var _=require('lodash');var squel=require(_0x0188('0xb'));var crypto=require(_0x0188('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0188('0xd'));var toCsv=require(_0x0188('0x8'));var querystring=require(_0x0188('0xe'));var Papa=require(_0x0188('0xf'));var Redis=require(_0x0188('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0188('0x11'));var as=require(_0x0188('0x12'));var hardwareService=require(_0x0188('0x13'));var logger=require(_0x0188('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x0188('0x15'));var licenseUtil=require(_0x0188('0x16'));var db=require(_0x0188('0x17'))['db'];var jayson=require(_0x0188('0x18'));var client=jayson[_0x0188('0x19')][_0x0188('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x24ae54,_0x2b1640,_0x32b677,_0x386c6e){return new BPromise(function(_0x1313ba,_0x5f35cb){var _0x403768=_0x386c6e||client;return _0x403768['request'](_0x24ae54,_0x32b677)[_0x0188('0x1b')](function(_0x5a8bab){logger['info'](_0x0188('0x1c'),_0x2b1640,_0x0188('0x1d'));logger[_0x0188('0x1e')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2b1640,_0x0188('0x1d'),JSON[_0x0188('0x1f')](_0x5a8bab));if(_0x5a8bab[_0x0188('0x20')]){if(_0x5a8bab[_0x0188('0x20')]['code']===0x1f4){logger[_0x0188('0x20')](_0x0188('0x1c'),_0x2b1640,_0x5a8bab[_0x0188('0x20')][_0x0188('0x21')]);return _0x5f35cb(_0x5a8bab[_0x0188('0x20')][_0x0188('0x21')]);}logger[_0x0188('0x20')](_0x0188('0x1c'),_0x2b1640,_0x5a8bab['error'][_0x0188('0x21')]);return _0x1313ba(_0x5a8bab[_0x0188('0x20')][_0x0188('0x21')]);}else{logger[_0x0188('0x22')](_0x0188('0x1c'),_0x2b1640,'request\x20sent');_0x1313ba(_0x5a8bab[_0x0188('0x23')][_0x0188('0x21')]);}})[_0x0188('0x24')](function(_0x1c219f){logger[_0x0188('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2b1640,_0x1c219f);_0x5f35cb(_0x1c219f);});});}function respondWithStatusCode(_0x3a013f,_0xcf711b){_0xcf711b=_0xcf711b||0xcc;return function(_0x33c7a2){if(_0x33c7a2){return _0x3a013f[_0x0188('0x25')](_0xcf711b);}return _0x3a013f[_0x0188('0x26')](_0xcf711b)[_0x0188('0x27')]();};}function respondWithResult(_0x1a80b7,_0x33d9f4){_0x33d9f4=_0x33d9f4||0xc8;return function(_0x45189f){if(_0x45189f){return _0x1a80b7[_0x0188('0x26')](_0x33d9f4)[_0x0188('0x28')](_0x45189f);}};}function respondWithFilteredResult(_0x5074e2,_0xacca56){return function(_0x32d749){if(_0x32d749){var _0x260631=typeof _0xacca56[_0x0188('0x29')]==='undefined'&&typeof _0xacca56[_0x0188('0x2a')]===_0x0188('0x2b');var _0x267321=_0x32d749[_0x0188('0x2c')];var _0x5c3aac=_0x260631?0x0:_0xacca56[_0x0188('0x29')];var _0x49da49=_0x260631?_0x32d749[_0x0188('0x2c')]:_0xacca56[_0x0188('0x29')]+_0xacca56[_0x0188('0x2a')];var _0x3a39ed;if(_0x49da49>=_0x267321){_0x49da49=_0x267321;_0x3a39ed=0xc8;}else{_0x3a39ed=0xce;}_0x5074e2['status'](_0x3a39ed);return _0x5074e2[_0x0188('0x2d')]('Content-Range',_0x5c3aac+'-'+_0x49da49+'/'+_0x267321)[_0x0188('0x28')](_0x32d749);}return null;};}function patchUpdates(_0x2cd991){return function(_0xbd2c0){try{jsonpatch[_0x0188('0x2e')](_0xbd2c0,_0x2cd991,!![]);}catch(_0x5345b6){return BPromise[_0x0188('0x2f')](_0x5345b6);}return _0xbd2c0[_0x0188('0x30')]();};}function saveUpdates(_0x246f5d,_0x63cd0a){return function(_0x472339){if(_0x472339){return _0x472339['update'](_0x246f5d)[_0x0188('0x1b')](function(_0x4030a5){return _0x4030a5;});}return null;};}function removeEntity(_0x1410dc,_0x48e6f8){return function(_0x53fc70){if(_0x53fc70){return _0x53fc70['destroy']()[_0x0188('0x1b')](function(){_0x1410dc[_0x0188('0x26')](0xcc)[_0x0188('0x27')]();});}};}function handleEntityNotFound(_0x2d4eb4,_0x5b15c4){return function(_0x405513){if(!_0x405513){_0x2d4eb4[_0x0188('0x25')](0x194);}return _0x405513;};}function handleError(_0x46e2d7,_0x2123e3){_0x2123e3=_0x2123e3||0x1f4;return function(_0x323c08){logger['error'](_0x323c08['stack']);if(_0x323c08[_0x0188('0x31')]){delete _0x323c08[_0x0188('0x31')];}_0x46e2d7[_0x0188('0x26')](_0x2123e3)[_0x0188('0x32')](_0x323c08);};}exports[_0x0188('0x33')]=function(_0x230331,_0x469e13){var _0x4495e5={},_0x4fedd5={},_0x41f432={'count':0x0,'rows':[]};var _0x3b6360=_[_0x0188('0x34')](db[_0x0188('0x35')][_0x0188('0x36')],function(_0x2c5808){return{'name':_0x2c5808[_0x0188('0x37')],'type':_0x2c5808[_0x0188('0x38')][_0x0188('0x39')]};});_0x4fedd5[_0x0188('0x3a')]=_[_0x0188('0x34')](_0x3b6360,_0x0188('0x31'));_0x4fedd5[_0x0188('0x3b')]=_['keys'](_0x230331[_0x0188('0x3b')]);_0x4fedd5[_0x0188('0x3c')]=_['intersection'](_0x4fedd5[_0x0188('0x3a')],_0x4fedd5[_0x0188('0x3b')]);_0x4495e5['attributes']=_['intersection'](_0x4fedd5['model'],qs['fields'](_0x230331[_0x0188('0x3b')][_0x0188('0x3d')]));_0x4495e5[_0x0188('0x3e')]=_0x4495e5[_0x0188('0x3e')][_0x0188('0x3f')]?_0x4495e5[_0x0188('0x3e')]:_0x4fedd5[_0x0188('0x3a')];if(!_0x230331[_0x0188('0x3b')][_0x0188('0x40')](_0x0188('0x41'))){_0x4495e5['limit']=qs[_0x0188('0x2a')](_0x230331[_0x0188('0x3b')]['limit']);_0x4495e5[_0x0188('0x29')]=qs[_0x0188('0x29')](_0x230331[_0x0188('0x3b')]['offset']);}_0x4495e5[_0x0188('0x42')]=qs['sort'](_0x230331[_0x0188('0x3b')][_0x0188('0x43')]);_0x4495e5[_0x0188('0x44')]=qs['filters'](_[_0x0188('0x45')](_0x230331[_0x0188('0x3b')],_0x4fedd5[_0x0188('0x3c')]),_0x3b6360);if(_0x230331[_0x0188('0x3b')][_0x0188('0x46')]){_0x4495e5['where']=_[_0x0188('0x47')](_0x4495e5['where'],{'$or':_['map'](_0x3b6360,function(_0x5005b8){if(_0x5005b8[_0x0188('0x38')]!==_0x0188('0x48')){var _0x991d87={};_0x991d87[_0x5005b8[_0x0188('0x31')]]={'$like':'%'+_0x230331[_0x0188('0x3b')]['filter']+'%'};return _0x991d87;}})});}_0x4495e5=_[_0x0188('0x47')]({},_0x4495e5,_0x230331['options']);var _0x2ed242={'where':_0x4495e5['where']};return db['ZendeskConfiguration'][_0x0188('0x2c')](_0x2ed242)[_0x0188('0x1b')](function(_0x56fdc7){_0x41f432['count']=_0x56fdc7;if(_0x230331[_0x0188('0x3b')]['includeAll']){_0x4495e5[_0x0188('0x49')]=[{'all':!![]}];}return db[_0x0188('0x35')]['findAll'](_0x4495e5);})[_0x0188('0x1b')](function(_0x5c1b2e){_0x41f432[_0x0188('0x4a')]=_0x5c1b2e;return _0x41f432;})[_0x0188('0x1b')](respondWithFilteredResult(_0x469e13,_0x4495e5))[_0x0188('0x24')](handleError(_0x469e13,null));};exports[_0x0188('0x4b')]=function(_0x505ee7,_0x52bc55){var _0x5bbd1f={'raw':![],'where':{'id':_0x505ee7[_0x0188('0x4c')]['id']}},_0x14c389={};_0x14c389[_0x0188('0x3a')]=_[_0x0188('0x4d')](db['ZendeskConfiguration']['rawAttributes']);_0x14c389[_0x0188('0x3b')]=_['keys'](_0x505ee7[_0x0188('0x3b')]);_0x14c389[_0x0188('0x3c')]=_[_0x0188('0x4e')](_0x14c389['model'],_0x14c389[_0x0188('0x3b')]);_0x5bbd1f['attributes']=_[_0x0188('0x4e')](_0x14c389['model'],qs['fields'](_0x505ee7[_0x0188('0x3b')]['fields']));_0x5bbd1f['attributes']=_0x5bbd1f['attributes'][_0x0188('0x3f')]?_0x5bbd1f[_0x0188('0x3e')]:_0x14c389[_0x0188('0x3a')];if(_0x505ee7[_0x0188('0x3b')][_0x0188('0x4f')]){_0x5bbd1f[_0x0188('0x49')]=[{'all':!![]}];}_0x5bbd1f=_[_0x0188('0x47')]({},_0x5bbd1f,_0x505ee7['options']);return db[_0x0188('0x35')][_0x0188('0x50')](_0x5bbd1f)[_0x0188('0x1b')](handleEntityNotFound(_0x52bc55,null))[_0x0188('0x1b')](respondWithResult(_0x52bc55,null))[_0x0188('0x24')](handleError(_0x52bc55,null));};exports[_0x0188('0x51')]=function(_0x338d4a,_0x30570e){return db[_0x0188('0x35')][_0x0188('0x51')](_0x338d4a[_0x0188('0x52')],{})['then'](respondWithResult(_0x30570e,0xc9))[_0x0188('0x24')](handleError(_0x30570e,null));};exports[_0x0188('0x53')]=function(_0x4ecde9,_0x5a97eb){if(_0x4ecde9[_0x0188('0x52')]['id']){delete _0x4ecde9[_0x0188('0x52')]['id'];}return db[_0x0188('0x35')][_0x0188('0x50')]({'where':{'id':_0x4ecde9[_0x0188('0x4c')]['id']}})[_0x0188('0x1b')](handleEntityNotFound(_0x5a97eb,null))[_0x0188('0x1b')](saveUpdates(_0x4ecde9[_0x0188('0x52')],null))[_0x0188('0x1b')](respondWithResult(_0x5a97eb,null))[_0x0188('0x24')](handleError(_0x5a97eb,null));};exports[_0x0188('0x54')]=function(_0x1db1e6,_0x4428b4){return db[_0x0188('0x35')][_0x0188('0x50')]({'where':{'id':_0x1db1e6[_0x0188('0x4c')]['id']}})[_0x0188('0x1b')](handleEntityNotFound(_0x4428b4,null))[_0x0188('0x1b')](removeEntity(_0x4428b4,null))[_0x0188('0x24')](handleError(_0x4428b4,null));};exports[_0x0188('0x55')]=function(_0xab7f2b,_0xad406d,_0x46ee19){var _0x4e1519={};var _0x1b0422={};var _0x377891;var _0x352773;return db[_0x0188('0x35')][_0x0188('0x56')]({'where':{'id':_0xab7f2b[_0x0188('0x4c')]['id']}})[_0x0188('0x1b')](handleEntityNotFound(_0xad406d,null))['then'](function(_0x447371){if(_0x447371){_0x377891=_0x447371;_0x1b0422[_0x0188('0x3a')]=_[_0x0188('0x4d')](db[_0x0188('0x57')][_0x0188('0x36')]);_0x1b0422['query']=_['keys'](_0xab7f2b[_0x0188('0x3b')]);_0x1b0422[_0x0188('0x3c')]=_[_0x0188('0x4e')](_0x1b0422[_0x0188('0x3a')],_0x1b0422[_0x0188('0x3b')]);_0x4e1519[_0x0188('0x3e')]=_[_0x0188('0x4e')](_0x1b0422[_0x0188('0x3a')],qs[_0x0188('0x3d')](_0xab7f2b[_0x0188('0x3b')]['fields']));_0x4e1519[_0x0188('0x3e')]=_0x4e1519[_0x0188('0x3e')][_0x0188('0x3f')]?_0x4e1519[_0x0188('0x3e')]:_0x1b0422[_0x0188('0x3a')];_0x4e1519['order']=qs[_0x0188('0x43')](_0xab7f2b[_0x0188('0x3b')][_0x0188('0x43')]);_0x4e1519[_0x0188('0x44')]=qs['filters'](_['pick'](_0xab7f2b['query'],_0x1b0422[_0x0188('0x3c')]));if(_0xab7f2b[_0x0188('0x3b')]['filter']){_0x4e1519[_0x0188('0x44')]=_[_0x0188('0x47')](_0x4e1519[_0x0188('0x44')],{'$or':_['map'](_0x4e1519[_0x0188('0x3e')],function(_0x3e5689){var _0x5be905={};_0x5be905[_0x3e5689]={'$like':'%'+_0xab7f2b[_0x0188('0x3b')][_0x0188('0x46')]+'%'};return _0x5be905;})});}_0x4e1519=_[_0x0188('0x47')]({},_0x4e1519,_0xab7f2b['options']);return _0x377891[_0x0188('0x55')](_0x4e1519);}})[_0x0188('0x1b')](function(_0x35db72){if(_0x35db72){_0x352773=_0x35db72[_0x0188('0x3f')];if(!_0xab7f2b['query'][_0x0188('0x40')](_0x0188('0x41'))){_0x4e1519[_0x0188('0x2a')]=qs['limit'](_0xab7f2b[_0x0188('0x3b')][_0x0188('0x2a')]);_0x4e1519[_0x0188('0x29')]=qs[_0x0188('0x29')](_0xab7f2b[_0x0188('0x3b')][_0x0188('0x29')]);}return _0x377891['getFields'](_0x4e1519);}})[_0x0188('0x1b')](function(_0x5aa39a){if(_0x5aa39a){return _0x5aa39a?{'count':_0x352773,'rows':_0x5aa39a}:null;}})['then'](respondWithResult(_0xad406d,null))['catch'](handleError(_0xad406d,null));};exports['getSubjects']=function(_0x5d3313,_0x1cb88f,_0x47fac5){var _0x1ea1db={};var _0x4956f6={};var _0x28251d;var _0x32cbaa;return db[_0x0188('0x35')]['findOne']({'where':{'id':_0x5d3313[_0x0188('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1cb88f,null))[_0x0188('0x1b')](function(_0x41b225){if(_0x41b225){_0x28251d=_0x41b225;_0x4956f6[_0x0188('0x3a')]=_['keys'](db['ZendeskField'][_0x0188('0x36')]);_0x4956f6[_0x0188('0x3b')]=_[_0x0188('0x4d')](_0x5d3313[_0x0188('0x3b')]);_0x4956f6[_0x0188('0x3c')]=_[_0x0188('0x4e')](_0x4956f6[_0x0188('0x3a')],_0x4956f6[_0x0188('0x3b')]);_0x1ea1db['attributes']=_['intersection'](_0x4956f6[_0x0188('0x3a')],qs['fields'](_0x5d3313['query']['fields']));_0x1ea1db[_0x0188('0x3e')]=_0x1ea1db[_0x0188('0x3e')]['length']?_0x1ea1db['attributes']:_0x4956f6[_0x0188('0x3a')];_0x1ea1db[_0x0188('0x42')]=qs['sort'](_0x5d3313[_0x0188('0x3b')][_0x0188('0x43')]);_0x1ea1db[_0x0188('0x44')]=qs['filters'](_['pick'](_0x5d3313[_0x0188('0x3b')],_0x4956f6[_0x0188('0x3c')]));if(_0x5d3313[_0x0188('0x3b')]['filter']){_0x1ea1db['where']=_[_0x0188('0x47')](_0x1ea1db[_0x0188('0x44')],{'$or':_[_0x0188('0x34')](_0x1ea1db[_0x0188('0x3e')],function(_0x212fb7){var _0x32b7bc={};_0x32b7bc[_0x212fb7]={'$like':'%'+_0x5d3313['query'][_0x0188('0x46')]+'%'};return _0x32b7bc;})});}_0x1ea1db=_['merge']({},_0x1ea1db,_0x5d3313['options']);return _0x28251d['getSubjects'](_0x1ea1db);}})[_0x0188('0x1b')](function(_0x111bd3){if(_0x111bd3){_0x32cbaa=_0x111bd3[_0x0188('0x3f')];if(!_0x5d3313[_0x0188('0x3b')][_0x0188('0x40')](_0x0188('0x41'))){_0x1ea1db[_0x0188('0x2a')]=qs['limit'](_0x5d3313[_0x0188('0x3b')][_0x0188('0x2a')]);_0x1ea1db['offset']=qs[_0x0188('0x29')](_0x5d3313[_0x0188('0x3b')]['offset']);}return _0x28251d[_0x0188('0x58')](_0x1ea1db);}})[_0x0188('0x1b')](function(_0x12abfd){if(_0x12abfd){return _0x12abfd?{'count':_0x32cbaa,'rows':_0x12abfd}:null;}})[_0x0188('0x1b')](respondWithResult(_0x1cb88f,null))[_0x0188('0x24')](handleError(_0x1cb88f,null));};exports[_0x0188('0x59')]=function(_0x478f14,_0x5684ba,_0x1f1649){var _0x54561f={};var _0x5c16ed={};var _0x2040e3;var _0xc5aa40;return db[_0x0188('0x35')][_0x0188('0x56')]({'where':{'id':_0x478f14['params']['id']}})[_0x0188('0x1b')](handleEntityNotFound(_0x5684ba,null))[_0x0188('0x1b')](function(_0x1252b1){if(_0x1252b1){_0x2040e3=_0x1252b1;_0x5c16ed[_0x0188('0x3a')]=_[_0x0188('0x4d')](db['ZendeskField'][_0x0188('0x36')]);_0x5c16ed[_0x0188('0x3b')]=_[_0x0188('0x4d')](_0x478f14['query']);_0x5c16ed[_0x0188('0x3c')]=_[_0x0188('0x4e')](_0x5c16ed[_0x0188('0x3a')],_0x5c16ed[_0x0188('0x3b')]);_0x54561f['attributes']=_[_0x0188('0x4e')](_0x5c16ed['model'],qs[_0x0188('0x3d')](_0x478f14[_0x0188('0x3b')][_0x0188('0x3d')]));_0x54561f[_0x0188('0x3e')]=_0x54561f[_0x0188('0x3e')][_0x0188('0x3f')]?_0x54561f['attributes']:_0x5c16ed['model'];_0x54561f[_0x0188('0x42')]=qs[_0x0188('0x43')](_0x478f14['query'][_0x0188('0x43')]);_0x54561f[_0x0188('0x44')]=qs[_0x0188('0x3c')](_[_0x0188('0x45')](_0x478f14[_0x0188('0x3b')],_0x5c16ed[_0x0188('0x3c')]));if(_0x478f14[_0x0188('0x3b')]['filter']){_0x54561f[_0x0188('0x44')]=_['merge'](_0x54561f['where'],{'$or':_[_0x0188('0x34')](_0x54561f['attributes'],function(_0x1c9ba4){var _0x55053d={};_0x55053d[_0x1c9ba4]={'$like':'%'+_0x478f14['query'][_0x0188('0x46')]+'%'};return _0x55053d;})});}_0x54561f=_[_0x0188('0x47')]({},_0x54561f,_0x478f14[_0x0188('0x5a')]);return _0x2040e3['getDescriptions'](_0x54561f);}})[_0x0188('0x1b')](function(_0xfe56e3){if(_0xfe56e3){_0xc5aa40=_0xfe56e3[_0x0188('0x3f')];if(!_0x478f14[_0x0188('0x3b')][_0x0188('0x40')]('nolimit')){_0x54561f[_0x0188('0x2a')]=qs[_0x0188('0x2a')](_0x478f14[_0x0188('0x3b')]['limit']);_0x54561f['offset']=qs[_0x0188('0x29')](_0x478f14[_0x0188('0x3b')]['offset']);}return _0x2040e3[_0x0188('0x59')](_0x54561f);}})[_0x0188('0x1b')](function(_0x530eae){if(_0x530eae){return _0x530eae?{'count':_0xc5aa40,'rows':_0x530eae}:null;}})[_0x0188('0x1b')](respondWithResult(_0x5684ba,null))[_0x0188('0x24')](handleError(_0x5684ba,null));};exports[_0x0188('0x5b')]=function(_0x5c105c,_0x1cd031,_0x5c933c){var _0x434bb7={};var _0x27f094={};var _0x418273;var _0x4da2ea;return db['ZendeskConfiguration'][_0x0188('0x56')]({'where':{'id':_0x5c105c[_0x0188('0x4c')]['id']}})[_0x0188('0x1b')](handleEntityNotFound(_0x1cd031,null))[_0x0188('0x1b')](function(_0xffabff){if(_0xffabff){_0x418273=_0xffabff;_0x27f094[_0x0188('0x3a')]=_[_0x0188('0x4d')](db['Tag'][_0x0188('0x36')]);_0x27f094['query']=_[_0x0188('0x4d')](_0x5c105c[_0x0188('0x3b')]);_0x27f094[_0x0188('0x3c')]=_[_0x0188('0x4e')](_0x27f094[_0x0188('0x3a')],_0x27f094['query']);_0x434bb7[_0x0188('0x3e')]=_[_0x0188('0x4e')](_0x27f094[_0x0188('0x3a')],qs[_0x0188('0x3d')](_0x5c105c[_0x0188('0x3b')][_0x0188('0x3d')]));_0x434bb7[_0x0188('0x3e')]=_0x434bb7['attributes']['length']?_0x434bb7[_0x0188('0x3e')]:_0x27f094[_0x0188('0x3a')];_0x434bb7[_0x0188('0x42')]=qs['sort'](_0x5c105c[_0x0188('0x3b')][_0x0188('0x43')]);_0x434bb7['where']=qs[_0x0188('0x3c')](_[_0x0188('0x45')](_0x5c105c['query'],_0x27f094[_0x0188('0x3c')]));if(_0x5c105c[_0x0188('0x3b')][_0x0188('0x46')]){_0x434bb7[_0x0188('0x44')]=_[_0x0188('0x47')](_0x434bb7['where'],{'$or':_[_0x0188('0x34')](_0x434bb7[_0x0188('0x3e')],function(_0x10a26d){var _0x29c683={};_0x29c683[_0x10a26d]={'$like':'%'+_0x5c105c['query'][_0x0188('0x46')]+'%'};return _0x29c683;})});}_0x434bb7=_[_0x0188('0x47')]({},_0x434bb7,_0x5c105c[_0x0188('0x5a')]);return _0x418273[_0x0188('0x5b')](_0x434bb7);}})[_0x0188('0x1b')](function(_0x43892b){if(_0x43892b){_0x4da2ea=_0x43892b[_0x0188('0x3f')];if(!_0x5c105c['query'][_0x0188('0x40')]('nolimit')){_0x434bb7[_0x0188('0x2a')]=qs[_0x0188('0x2a')](_0x5c105c[_0x0188('0x3b')]['limit']);_0x434bb7[_0x0188('0x29')]=qs[_0x0188('0x29')](_0x5c105c[_0x0188('0x3b')][_0x0188('0x29')]);}return _0x418273['getTags'](_0x434bb7);}})[_0x0188('0x1b')](function(_0x4c88e5){if(_0x4c88e5){return _0x4c88e5?{'count':_0x4da2ea,'rows':_0x4c88e5}:null;}})['then'](respondWithResult(_0x1cd031,null))[_0x0188('0x24')](handleError(_0x1cd031,null));};exports[_0x0188('0x5c')]=function(_0xfc37e,_0x5b9ba9,_0x3029ee){if(_0xfc37e[_0x0188('0x52')]['id']){delete _0xfc37e[_0x0188('0x52')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0xfc37e[_0x0188('0x4c')]['id']}})[_0x0188('0x1b')](handleEntityNotFound(_0x5b9ba9,null))['then'](function(_0x37e1c1){if(_0x37e1c1){return _0x37e1c1['setTags'](_0xfc37e[_0x0188('0x52')][_0x0188('0x5d')]||[]);}return null;})['then'](respondWithResult(_0x5b9ba9,null))[_0x0188('0x24')](handleError(_0x5b9ba9,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 2100fcd..e0d03cc 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 _0x3613=['rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','api','path'];(function(_0x37255c,_0x359f09){var _0x3aa2d6=function(_0x9c9de3){while(--_0x9c9de3){_0x37255c['push'](_0x37255c['shift']());}};_0x3aa2d6(++_0x359f09);}(_0x3613,0x103));var _0x3361=function(_0x2286b9,_0x2ffe8b){_0x2286b9=_0x2286b9-0x0;var _0x41a30e=_0x3613[_0x2286b9];return _0x41a30e;};'use strict';var _=require(_0x3361('0x0'));var util=require(_0x3361('0x1'));var logger=require(_0x3361('0x2'))(_0x3361('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3361('0x4'));var rimraf=require(_0x3361('0x5'));var config=require(_0x3361('0x6'));var attributes=require(_0x3361('0x7'));module[_0x3361('0x8')]=function(_0x23d475,_0x1f64a7){return _0x23d475[_0x3361('0x9')]('ZendeskConfiguration',attributes,{'tableName':_0x3361('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x650b=['./intZendeskConfiguration.attributes','exports','int_zendesk_configurations','lodash','util','moment','bluebird','path','../../config/environment'];(function(_0x16bf0c,_0x158962){var _0xaff2fd=function(_0x2619b6){while(--_0x2619b6){_0x16bf0c['push'](_0x16bf0c['shift']());}};_0xaff2fd(++_0x158962);}(_0x650b,0x11a));var _0xb650=function(_0x2ec344,_0x133bcc){_0x2ec344=_0x2ec344-0x0;var _0x3ddebf=_0x650b[_0x2ec344];return _0x3ddebf;};'use strict';var _=require(_0xb650('0x0'));var util=require(_0xb650('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb650('0x2'));var BPromise=require(_0xb650('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb650('0x4'));var rimraf=require('rimraf');var config=require(_0xb650('0x5'));var attributes=require(_0xb650('0x6'));module[_0xb650('0x7')]=function(_0x3a328d,_0x78b5e9){return _0x3a328d['define']('ZendeskConfiguration',attributes,{'tableName':_0xb650('0x8'),'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 60077f4..f9c6f61 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 _0x0d05=['../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','message','ZendeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x2ad8cd,_0x37ca73){var _0x5e2a86=function(_0x2df67f){while(--_0x2df67f){_0x2ad8cd['push'](_0x2ad8cd['shift']());}};_0x5e2a86(++_0x37ca73);}(_0x0d05,0x152));var _0x50d0=function(_0x16ae8b,_0x49a3ba){_0x16ae8b=_0x16ae8b-0x0;var _0x58ec3b=_0x0d05[_0x16ae8b];return _0x58ec3b;};'use strict';var _=require(_0x50d0('0x0'));var util=require(_0x50d0('0x1'));var moment=require(_0x50d0('0x2'));var BPromise=require(_0x50d0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x50d0('0x4'));var db=require(_0x50d0('0x5'))['db'];var utils=require(_0x50d0('0x6'));var logger=require(_0x50d0('0x7'))(_0x50d0('0x8'));var config=require('../../config/environment');var jayson=require(_0x50d0('0x9'));var client=jayson[_0x50d0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eb0e5,_0x5ac0e0,_0x17d7e4){return new BPromise(function(_0x53552b,_0x7923b4){return client[_0x50d0('0xb')](_0x2eb0e5,_0x17d7e4)[_0x50d0('0xc')](function(_0x50fbe8){logger[_0x50d0('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5ac0e0,_0x50d0('0xe'));logger[_0x50d0('0xf')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5ac0e0,_0x50d0('0xe'),JSON[_0x50d0('0x10')](_0x50fbe8));if(_0x50fbe8[_0x50d0('0x11')]){if(_0x50fbe8[_0x50d0('0x11')][_0x50d0('0x12')]===0x1f4){logger[_0x50d0('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5ac0e0,_0x50fbe8[_0x50d0('0x11')][_0x50d0('0x13')]);return _0x7923b4(_0x50fbe8[_0x50d0('0x11')]['message']);}logger[_0x50d0('0x11')](_0x50d0('0x14'),_0x5ac0e0,_0x50fbe8[_0x50d0('0x11')][_0x50d0('0x13')]);return _0x53552b(_0x50fbe8[_0x50d0('0x11')][_0x50d0('0x13')]);}else{logger[_0x50d0('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5ac0e0,_0x50d0('0xe'));_0x53552b(_0x50fbe8[_0x50d0('0x15')][_0x50d0('0x13')]);}})[_0x50d0('0x16')](function(_0x429f6c){logger[_0x50d0('0x11')](_0x50d0('0x14'),_0x5ac0e0,_0x429f6c);_0x7923b4(_0x429f6c);});});} \ No newline at end of file +var _0x838d=['../../config/environment','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1c1e36,_0x3a04d4){var _0x5e746a=function(_0x51b112){while(--_0x51b112){_0x1c1e36['push'](_0x1c1e36['shift']());}};_0x5e746a(++_0x3a04d4);}(_0x838d,0x172));var _0xd838=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x838d[_0x2dea24];return _0x309d58;};'use strict';var _=require(_0xd838('0x0'));var util=require('util');var moment=require(_0xd838('0x1'));var BPromise=require('bluebird');var rs=require(_0xd838('0x2'));var fs=require('fs');var Redis=require(_0xd838('0x3'));var db=require(_0xd838('0x4'))['db'];var utils=require(_0xd838('0x5'));var logger=require(_0xd838('0x6'))(_0xd838('0x7'));var config=require(_0xd838('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd838('0x9')][_0xd838('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x495f84,_0x4a8c3d,_0x48c65a){return new BPromise(function(_0x396c56,_0x1371ab){return client[_0xd838('0xb')](_0x495f84,_0x48c65a)[_0xd838('0xc')](function(_0x5e13a7){logger[_0xd838('0xd')](_0xd838('0xe'),_0x4a8c3d,_0xd838('0xf'));logger[_0xd838('0x10')](_0xd838('0x11'),_0x4a8c3d,_0xd838('0xf'),JSON['stringify'](_0x5e13a7));if(_0x5e13a7['error']){if(_0x5e13a7['error']['code']===0x1f4){logger[_0xd838('0x12')](_0xd838('0xe'),_0x4a8c3d,_0x5e13a7['error'][_0xd838('0x13')]);return _0x1371ab(_0x5e13a7[_0xd838('0x12')]['message']);}logger[_0xd838('0x12')](_0xd838('0xe'),_0x4a8c3d,_0x5e13a7[_0xd838('0x12')][_0xd838('0x13')]);return _0x396c56(_0x5e13a7[_0xd838('0x12')][_0xd838('0x13')]);}else{logger[_0xd838('0xd')](_0xd838('0xe'),_0x4a8c3d,'request\x20sent');_0x396c56(_0x5e13a7[_0xd838('0x14')]['message']);}})['catch'](function(_0x1fc3d5){logger[_0xd838('0x12')](_0xd838('0xe'),_0x4a8c3d,_0x1fc3d5);_0x1371ab(_0x1fc3d5);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 18d1fea..ecc7825 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 _0x0986=['fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','delete','exports','multer','path','connect-timeout','Router'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0986,0x1eb));var _0x6098=function(_0x20a5cc,_0x22a4fb){_0x20a5cc=_0x20a5cc-0x0;var _0x20c401=_0x0986[_0x20a5cc];return _0x20c401;};'use strict';var multer=require(_0x6098('0x0'));var util=require('util');var path=require(_0x6098('0x1'));var timeout=require(_0x6098('0x2'));var express=require('express');var router=express[_0x6098('0x3')]();var fs_extra=require(_0x6098('0x4'));var auth=require(_0x6098('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6098('0x6'));var controller=require(_0x6098('0x7'));router[_0x6098('0x8')]('/',auth[_0x6098('0x9')](),controller['index']);router['get'](_0x6098('0xa'),auth['isAuthenticated'](),controller[_0x6098('0xb')]);router[_0x6098('0xc')]('/',auth[_0x6098('0x9')](),controller['create']);router['put'](_0x6098('0xa'),auth[_0x6098('0x9')](),controller['update']);router[_0x6098('0xd')](_0x6098('0xa'),auth[_0x6098('0x9')](),controller['destroy']);module[_0x6098('0xe')]=router; \ No newline at end of file +var _0xc124=['./intZendeskField.controller','get','index','/:id','isAuthenticated','post','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2ff238,_0x1811d2){var _0x204a56=function(_0x5bf2e1){while(--_0x5bf2e1){_0x2ff238['push'](_0x2ff238['shift']());}};_0x204a56(++_0x1811d2);}(_0xc124,0x118));var _0x4c12=function(_0x251d24,_0x428b32){_0x251d24=_0x251d24-0x0;var _0x302497=_0xc124[_0x251d24];return _0x302497;};'use strict';var multer=require(_0x4c12('0x0'));var util=require(_0x4c12('0x1'));var path=require(_0x4c12('0x2'));var timeout=require(_0x4c12('0x3'));var express=require(_0x4c12('0x4'));var router=express[_0x4c12('0x5')]();var fs_extra=require(_0x4c12('0x6'));var auth=require(_0x4c12('0x7'));var interaction=require(_0x4c12('0x8'));var config=require('../../config/environment');var controller=require(_0x4c12('0x9'));router[_0x4c12('0xa')]('/',auth['isAuthenticated'](),controller[_0x4c12('0xb')]);router['get'](_0x4c12('0xc'),auth[_0x4c12('0xd')](),controller['show']);router[_0x4c12('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x4c12('0xc'),auth[_0x4c12('0xd')](),controller['update']);router['delete'](_0x4c12('0xc'),auth[_0x4c12('0xd')](),controller[_0x4c12('0xf')]);module[_0x4c12('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 0464a08..ee5a9b0 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 _0xb458=['ENUM','customVariable','keyValue','picklist','string','STRING','variable','sequelize','exports'];(function(_0x32a26d,_0x3783f9){var _0xb9d4ce=function(_0x3db66e){while(--_0x3db66e){_0x32a26d['push'](_0x32a26d['shift']());}};_0xb9d4ce(++_0x3783f9);}(_0xb458,0x103));var _0x8b45=function(_0x29653a,_0x3ea341){_0x29653a=_0x29653a-0x0;var _0x84da67=_0xb458[_0x29653a];return _0x84da67;};'use strict';var Sequelize=require(_0x8b45('0x0'));module[_0x8b45('0x1')]={'type':{'type':Sequelize[_0x8b45('0x2')]('string','variable',_0x8b45('0x3'),_0x8b45('0x4'),_0x8b45('0x5')),'defaultValue':_0x8b45('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8b45('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x8b45('0x8'),_0x8b45('0x3'))},'keyContent':{'type':Sequelize[_0x8b45('0x7')]},'idField':{'type':Sequelize[_0x8b45('0x7')]},'nameField':{'type':Sequelize[_0x8b45('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8b45('0x7')]}}; \ No newline at end of file +var _0x4b1f=['exports','string','variable','customVariable','picklist','STRING','sequelize'];(function(_0x2c6b92,_0x1dd332){var _0x2e3580=function(_0x3cb817){while(--_0x3cb817){_0x2c6b92['push'](_0x2c6b92['shift']());}};_0x2e3580(++_0x1dd332);}(_0x4b1f,0x195));var _0xf4b1=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x4b1f[_0x2070da];return _0x4f9fe1;};'use strict';var Sequelize=require(_0xf4b1('0x0'));module[_0xf4b1('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf4b1('0x2'),_0xf4b1('0x3'),_0xf4b1('0x4'),'keyValue',_0xf4b1('0x5')),'defaultValue':_0xf4b1('0x2')},'content':{'type':Sequelize[_0xf4b1('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xf4b1('0x2'),_0xf4b1('0x3'),_0xf4b1('0x4'))},'keyContent':{'type':Sequelize[_0xf4b1('0x6')]},'idField':{'type':Sequelize[_0xf4b1('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 563d656..2100a58 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 _0x6d39=['fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','ZendeskField','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','include','rows','catch','show','keys','includeAll','options','find','create','body','params','destroy','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x422d6d,_0x1809f6){var _0x2bdd94=function(_0xf20f9e){while(--_0xf20f9e){_0x422d6d['push'](_0x422d6d['shift']());}};_0x2bdd94(++_0x1809f6);}(_0x6d39,0x177));var _0x96d3=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x6d39[_0x5f09c5];return _0x426ad9;};'use strict';var emlformat=require(_0x96d3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x96d3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x96d3('0x2'));var moment=require(_0x96d3('0x3'));var BPromise=require(_0x96d3('0x4'));var Mustache=require('mustache');var util=require(_0x96d3('0x5'));var path=require(_0x96d3('0x6'));var sox=require(_0x96d3('0x7'));var csv=require(_0x96d3('0x8'));var ejs=require(_0x96d3('0x9'));var fs=require('fs');var fs_extra=require(_0x96d3('0xa'));var _=require(_0x96d3('0xb'));var squel=require('squel');var crypto=require(_0x96d3('0xc'));var jsforce=require(_0x96d3('0xd'));var deskjs=require(_0x96d3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x96d3('0xf'));var Papa=require(_0x96d3('0x10'));var Redis=require(_0x96d3('0x11'));var authService=require(_0x96d3('0x12'));var qs=require(_0x96d3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96d3('0x14'));var logger=require('../../config/logger')(_0x96d3('0x15'));var utils=require(_0x96d3('0x16'));var config=require(_0x96d3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x96d3('0x18'))['db'];function respondWithStatusCode(_0x5d329e,_0x2b5693){_0x2b5693=_0x2b5693||0xcc;return function(_0x1a8210){if(_0x1a8210){return _0x5d329e[_0x96d3('0x19')](_0x2b5693);}return _0x5d329e[_0x96d3('0x1a')](_0x2b5693)[_0x96d3('0x1b')]();};}function respondWithResult(_0x5b43ee,_0x16b637){_0x16b637=_0x16b637||0xc8;return function(_0x3fcba1){if(_0x3fcba1){return _0x5b43ee[_0x96d3('0x1a')](_0x16b637)[_0x96d3('0x1c')](_0x3fcba1);}};}function respondWithFilteredResult(_0x3fa914,_0xe30196){return function(_0x330e53){if(_0x330e53){var _0x20b2ed=typeof _0xe30196[_0x96d3('0x1d')]===_0x96d3('0x1e')&&typeof _0xe30196['limit']==='undefined';var _0x256043=_0x330e53[_0x96d3('0x1f')];var _0x235703=_0x20b2ed?0x0:_0xe30196[_0x96d3('0x1d')];var _0x8a4ee=_0x20b2ed?_0x330e53[_0x96d3('0x1f')]:_0xe30196[_0x96d3('0x1d')]+_0xe30196[_0x96d3('0x20')];var _0x54e0c3;if(_0x8a4ee>=_0x256043){_0x8a4ee=_0x256043;_0x54e0c3=0xc8;}else{_0x54e0c3=0xce;}_0x3fa914[_0x96d3('0x1a')](_0x54e0c3);return _0x3fa914[_0x96d3('0x21')](_0x96d3('0x22'),_0x235703+'-'+_0x8a4ee+'/'+_0x256043)[_0x96d3('0x1c')](_0x330e53);}return null;};}function patchUpdates(_0x12e76b){return function(_0x51c630){try{jsonpatch[_0x96d3('0x23')](_0x51c630,_0x12e76b,!![]);}catch(_0x2e69e6){return BPromise[_0x96d3('0x24')](_0x2e69e6);}return _0x51c630[_0x96d3('0x25')]();};}function saveUpdates(_0x2b14c2,_0x397aba){return function(_0x52fc0d){if(_0x52fc0d){return _0x52fc0d[_0x96d3('0x26')](_0x2b14c2)[_0x96d3('0x27')](function(_0x2d28a2){return _0x2d28a2;});}return null;};}function removeEntity(_0x485120,_0x553716){return function(_0x3155cd){if(_0x3155cd){return _0x3155cd['destroy']()['then'](function(){_0x485120['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4efc6e,_0x38837e){return function(_0x14424d){if(!_0x14424d){_0x4efc6e[_0x96d3('0x19')](0x194);}return _0x14424d;};}function handleError(_0x257fe8,_0x13e7e9){_0x13e7e9=_0x13e7e9||0x1f4;return function(_0x144643){logger[_0x96d3('0x28')](_0x144643[_0x96d3('0x29')]);if(_0x144643[_0x96d3('0x2a')]){delete _0x144643[_0x96d3('0x2a')];}_0x257fe8['status'](_0x13e7e9)[_0x96d3('0x2b')](_0x144643);};}exports['index']=function(_0x32fef4,_0x51818e){var _0x45a0a3={},_0xc9526c={},_0xd7b9cb={'count':0x0,'rows':[]};var _0x314b60=_['map'](db[_0x96d3('0x2c')][_0x96d3('0x2d')],function(_0x426622){return{'name':_0x426622[_0x96d3('0x2e')],'type':_0x426622['type'][_0x96d3('0x2f')]};});_0xc9526c[_0x96d3('0x30')]=_[_0x96d3('0x31')](_0x314b60,_0x96d3('0x2a'));_0xc9526c[_0x96d3('0x32')]=_['keys'](_0x32fef4[_0x96d3('0x32')]);_0xc9526c[_0x96d3('0x33')]=_[_0x96d3('0x34')](_0xc9526c[_0x96d3('0x30')],_0xc9526c[_0x96d3('0x32')]);_0x45a0a3[_0x96d3('0x35')]=_[_0x96d3('0x34')](_0xc9526c[_0x96d3('0x30')],qs[_0x96d3('0x36')](_0x32fef4[_0x96d3('0x32')][_0x96d3('0x36')]));_0x45a0a3[_0x96d3('0x35')]=_0x45a0a3['attributes'][_0x96d3('0x37')]?_0x45a0a3['attributes']:_0xc9526c[_0x96d3('0x30')];if(!_0x32fef4[_0x96d3('0x32')][_0x96d3('0x38')]('nolimit')){_0x45a0a3[_0x96d3('0x20')]=qs[_0x96d3('0x20')](_0x32fef4[_0x96d3('0x32')][_0x96d3('0x20')]);_0x45a0a3[_0x96d3('0x1d')]=qs[_0x96d3('0x1d')](_0x32fef4['query'][_0x96d3('0x1d')]);}_0x45a0a3[_0x96d3('0x39')]=qs[_0x96d3('0x3a')](_0x32fef4[_0x96d3('0x32')][_0x96d3('0x3a')]);_0x45a0a3[_0x96d3('0x3b')]=qs[_0x96d3('0x33')](_[_0x96d3('0x3c')](_0x32fef4['query'],_0xc9526c[_0x96d3('0x33')]),_0x314b60);if(_0x32fef4[_0x96d3('0x32')]['filter']){_0x45a0a3[_0x96d3('0x3b')]=_[_0x96d3('0x3d')](_0x45a0a3[_0x96d3('0x3b')],{'$or':_['map'](_0x314b60,function(_0x28c27b){if(_0x28c27b[_0x96d3('0x3e')]!==_0x96d3('0x3f')){var _0x5d5ded={};_0x5d5ded[_0x28c27b[_0x96d3('0x2a')]]={'$like':'%'+_0x32fef4['query'][_0x96d3('0x40')]+'%'};return _0x5d5ded;}})});}_0x45a0a3=_['merge']({},_0x45a0a3,_0x32fef4['options']);var _0x31f09={'where':_0x45a0a3[_0x96d3('0x3b')]};return db[_0x96d3('0x2c')][_0x96d3('0x1f')](_0x31f09)[_0x96d3('0x27')](function(_0x3f08eb){_0xd7b9cb[_0x96d3('0x1f')]=_0x3f08eb;if(_0x32fef4[_0x96d3('0x32')]['includeAll']){_0x45a0a3[_0x96d3('0x41')]=[{'all':!![]}];}return db[_0x96d3('0x2c')]['findAll'](_0x45a0a3);})[_0x96d3('0x27')](function(_0x2b74d5){_0xd7b9cb[_0x96d3('0x42')]=_0x2b74d5;return _0xd7b9cb;})[_0x96d3('0x27')](respondWithFilteredResult(_0x51818e,_0x45a0a3))[_0x96d3('0x43')](handleError(_0x51818e,null));};exports[_0x96d3('0x44')]=function(_0x4222d2,_0x20f3a3){var _0x111f65={'raw':!![],'where':{'id':_0x4222d2['params']['id']}},_0x4de507={};_0x4de507[_0x96d3('0x30')]=_['keys'](db[_0x96d3('0x2c')][_0x96d3('0x2d')]);_0x4de507[_0x96d3('0x32')]=_[_0x96d3('0x45')](_0x4222d2['query']);_0x4de507['filters']=_[_0x96d3('0x34')](_0x4de507[_0x96d3('0x30')],_0x4de507['query']);_0x111f65[_0x96d3('0x35')]=_[_0x96d3('0x34')](_0x4de507[_0x96d3('0x30')],qs[_0x96d3('0x36')](_0x4222d2[_0x96d3('0x32')][_0x96d3('0x36')]));_0x111f65[_0x96d3('0x35')]=_0x111f65[_0x96d3('0x35')][_0x96d3('0x37')]?_0x111f65[_0x96d3('0x35')]:_0x4de507[_0x96d3('0x30')];if(_0x4222d2[_0x96d3('0x32')][_0x96d3('0x46')]){_0x111f65[_0x96d3('0x41')]=[{'all':!![]}];}_0x111f65=_[_0x96d3('0x3d')]({},_0x111f65,_0x4222d2[_0x96d3('0x47')]);return db['ZendeskField'][_0x96d3('0x48')](_0x111f65)[_0x96d3('0x27')](handleEntityNotFound(_0x20f3a3,null))[_0x96d3('0x27')](respondWithResult(_0x20f3a3,null))[_0x96d3('0x43')](handleError(_0x20f3a3,null));};exports[_0x96d3('0x49')]=function(_0x4ce364,_0x15804e){return db[_0x96d3('0x2c')][_0x96d3('0x49')](_0x4ce364['body'],{})['then'](respondWithResult(_0x15804e,0xc9))[_0x96d3('0x43')](handleError(_0x15804e,null));};exports[_0x96d3('0x26')]=function(_0x39ca2a,_0x31cfb5){if(_0x39ca2a[_0x96d3('0x4a')]['id']){delete _0x39ca2a[_0x96d3('0x4a')]['id'];}return db[_0x96d3('0x2c')]['find']({'where':{'id':_0x39ca2a[_0x96d3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x31cfb5,null))[_0x96d3('0x27')](saveUpdates(_0x39ca2a[_0x96d3('0x4a')],null))[_0x96d3('0x27')](respondWithResult(_0x31cfb5,null))[_0x96d3('0x43')](handleError(_0x31cfb5,null));};exports[_0x96d3('0x4c')]=function(_0x349c40,_0x564640){return db[_0x96d3('0x2c')][_0x96d3('0x48')]({'where':{'id':_0x349c40[_0x96d3('0x4b')]['id']}})[_0x96d3('0x27')](handleEntityNotFound(_0x564640,null))[_0x96d3('0x27')](removeEntity(_0x564640,null))[_0x96d3('0x43')](handleError(_0x564640,null));}; \ No newline at end of file +var _0x44d8=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','ZendeskField','fieldName','type','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x20c356,_0xcf42fe){var _0x33bdd7=function(_0x1e0f4c){while(--_0x1e0f4c){_0x20c356['push'](_0x20c356['shift']());}};_0x33bdd7(++_0xcf42fe);}(_0x44d8,0x170));var _0x844d=function(_0x40c3e4,_0x59d4df){_0x40c3e4=_0x40c3e4-0x0;var _0x2871e2=_0x44d8[_0x40c3e4];return _0x2871e2;};'use strict';var emlformat=require(_0x844d('0x0'));var rimraf=require(_0x844d('0x1'));var zipdir=require(_0x844d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x844d('0x3'));var moment=require(_0x844d('0x4'));var BPromise=require(_0x844d('0x5'));var Mustache=require(_0x844d('0x6'));var util=require(_0x844d('0x7'));var path=require(_0x844d('0x8'));var sox=require('sox');var csv=require(_0x844d('0x9'));var ejs=require(_0x844d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x844d('0xb'));var squel=require(_0x844d('0xc'));var crypto=require('crypto');var jsforce=require(_0x844d('0xd'));var deskjs=require(_0x844d('0xe'));var toCsv=require(_0x844d('0x9'));var querystring=require(_0x844d('0xf'));var Papa=require(_0x844d('0x10'));var Redis=require('ioredis');var authService=require(_0x844d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x844d('0x12'));var logger=require(_0x844d('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x844d('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ceba2,_0x4c6259){_0x4c6259=_0x4c6259||0xcc;return function(_0xa01351){if(_0xa01351){return _0x3ceba2[_0x844d('0x15')](_0x4c6259);}return _0x3ceba2[_0x844d('0x16')](_0x4c6259)['end']();};}function respondWithResult(_0x3086f9,_0xfbf899){_0xfbf899=_0xfbf899||0xc8;return function(_0x51e2d4){if(_0x51e2d4){return _0x3086f9[_0x844d('0x16')](_0xfbf899)[_0x844d('0x17')](_0x51e2d4);}};}function respondWithFilteredResult(_0x4afda2,_0x3d1633){return function(_0x4af9cf){if(_0x4af9cf){var _0x5b9fb0=typeof _0x3d1633['offset']===_0x844d('0x18')&&typeof _0x3d1633[_0x844d('0x19')]===_0x844d('0x18');var _0x1c88a3=_0x4af9cf[_0x844d('0x1a')];var _0x313a0e=_0x5b9fb0?0x0:_0x3d1633[_0x844d('0x1b')];var _0x1a1583=_0x5b9fb0?_0x4af9cf[_0x844d('0x1a')]:_0x3d1633['offset']+_0x3d1633[_0x844d('0x19')];var _0x3ec57f;if(_0x1a1583>=_0x1c88a3){_0x1a1583=_0x1c88a3;_0x3ec57f=0xc8;}else{_0x3ec57f=0xce;}_0x4afda2[_0x844d('0x16')](_0x3ec57f);return _0x4afda2[_0x844d('0x1c')](_0x844d('0x1d'),_0x313a0e+'-'+_0x1a1583+'/'+_0x1c88a3)[_0x844d('0x17')](_0x4af9cf);}return null;};}function patchUpdates(_0x503c52){return function(_0x1973d3){try{jsonpatch[_0x844d('0x1e')](_0x1973d3,_0x503c52,!![]);}catch(_0x53a985){return BPromise[_0x844d('0x1f')](_0x53a985);}return _0x1973d3[_0x844d('0x20')]();};}function saveUpdates(_0x38ce46,_0x15d151){return function(_0x5995c9){if(_0x5995c9){return _0x5995c9[_0x844d('0x21')](_0x38ce46)[_0x844d('0x22')](function(_0x32fffa){return _0x32fffa;});}return null;};}function removeEntity(_0x53f9f0,_0xe40d30){return function(_0x2d9b28){if(_0x2d9b28){return _0x2d9b28[_0x844d('0x23')]()['then'](function(){_0x53f9f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x340b24,_0x34df57){return function(_0x2d89dd){if(!_0x2d89dd){_0x340b24[_0x844d('0x15')](0x194);}return _0x2d89dd;};}function handleError(_0x412f01,_0x3958d2){_0x3958d2=_0x3958d2||0x1f4;return function(_0x23b094){logger[_0x844d('0x24')](_0x23b094[_0x844d('0x25')]);if(_0x23b094[_0x844d('0x26')]){delete _0x23b094[_0x844d('0x26')];}_0x412f01[_0x844d('0x16')](_0x3958d2)['send'](_0x23b094);};}exports['index']=function(_0xac147e,_0x4993da){var _0xb369bc={},_0x5569ba={},_0x50cc35={'count':0x0,'rows':[]};var _0xec774a=_[_0x844d('0x27')](db[_0x844d('0x28')]['rawAttributes'],function(_0x482e3d){return{'name':_0x482e3d[_0x844d('0x29')],'type':_0x482e3d[_0x844d('0x2a')]['key']};});_0x5569ba[_0x844d('0x2b')]=_[_0x844d('0x27')](_0xec774a,_0x844d('0x26'));_0x5569ba['query']=_['keys'](_0xac147e['query']);_0x5569ba[_0x844d('0x2c')]=_[_0x844d('0x2d')](_0x5569ba[_0x844d('0x2b')],_0x5569ba[_0x844d('0x2e')]);_0xb369bc[_0x844d('0x2f')]=_[_0x844d('0x2d')](_0x5569ba[_0x844d('0x2b')],qs[_0x844d('0x30')](_0xac147e[_0x844d('0x2e')][_0x844d('0x30')]));_0xb369bc[_0x844d('0x2f')]=_0xb369bc[_0x844d('0x2f')][_0x844d('0x31')]?_0xb369bc[_0x844d('0x2f')]:_0x5569ba['model'];if(!_0xac147e[_0x844d('0x2e')][_0x844d('0x32')](_0x844d('0x33'))){_0xb369bc['limit']=qs['limit'](_0xac147e['query']['limit']);_0xb369bc[_0x844d('0x1b')]=qs[_0x844d('0x1b')](_0xac147e[_0x844d('0x2e')][_0x844d('0x1b')]);}_0xb369bc[_0x844d('0x34')]=qs[_0x844d('0x35')](_0xac147e['query'][_0x844d('0x35')]);_0xb369bc[_0x844d('0x36')]=qs[_0x844d('0x2c')](_[_0x844d('0x37')](_0xac147e[_0x844d('0x2e')],_0x5569ba[_0x844d('0x2c')]),_0xec774a);if(_0xac147e['query'][_0x844d('0x38')]){_0xb369bc[_0x844d('0x36')]=_[_0x844d('0x39')](_0xb369bc[_0x844d('0x36')],{'$or':_[_0x844d('0x27')](_0xec774a,function(_0x31a0ad){if(_0x31a0ad[_0x844d('0x2a')]!==_0x844d('0x3a')){var _0x32aad9={};_0x32aad9[_0x31a0ad[_0x844d('0x26')]]={'$like':'%'+_0xac147e['query'][_0x844d('0x38')]+'%'};return _0x32aad9;}})});}_0xb369bc=_[_0x844d('0x39')]({},_0xb369bc,_0xac147e[_0x844d('0x3b')]);var _0x17dbf3={'where':_0xb369bc[_0x844d('0x36')]};return db['ZendeskField'][_0x844d('0x1a')](_0x17dbf3)['then'](function(_0x587bfe){_0x50cc35[_0x844d('0x1a')]=_0x587bfe;if(_0xac147e[_0x844d('0x2e')][_0x844d('0x3c')]){_0xb369bc[_0x844d('0x3d')]=[{'all':!![]}];}return db['ZendeskField'][_0x844d('0x3e')](_0xb369bc);})[_0x844d('0x22')](function(_0xfddb2c){_0x50cc35[_0x844d('0x3f')]=_0xfddb2c;return _0x50cc35;})[_0x844d('0x22')](respondWithFilteredResult(_0x4993da,_0xb369bc))[_0x844d('0x40')](handleError(_0x4993da,null));};exports['show']=function(_0x267c48,_0x43a3bc){var _0x19527b={'raw':!![],'where':{'id':_0x267c48['params']['id']}},_0x18ce62={};_0x18ce62[_0x844d('0x2b')]=_[_0x844d('0x41')](db['ZendeskField'][_0x844d('0x42')]);_0x18ce62[_0x844d('0x2e')]=_[_0x844d('0x41')](_0x267c48[_0x844d('0x2e')]);_0x18ce62['filters']=_[_0x844d('0x2d')](_0x18ce62[_0x844d('0x2b')],_0x18ce62[_0x844d('0x2e')]);_0x19527b[_0x844d('0x2f')]=_[_0x844d('0x2d')](_0x18ce62[_0x844d('0x2b')],qs['fields'](_0x267c48[_0x844d('0x2e')][_0x844d('0x30')]));_0x19527b[_0x844d('0x2f')]=_0x19527b[_0x844d('0x2f')][_0x844d('0x31')]?_0x19527b[_0x844d('0x2f')]:_0x18ce62[_0x844d('0x2b')];if(_0x267c48[_0x844d('0x2e')][_0x844d('0x3c')]){_0x19527b[_0x844d('0x3d')]=[{'all':!![]}];}_0x19527b=_[_0x844d('0x39')]({},_0x19527b,_0x267c48[_0x844d('0x3b')]);return db[_0x844d('0x28')][_0x844d('0x43')](_0x19527b)[_0x844d('0x22')](handleEntityNotFound(_0x43a3bc,null))[_0x844d('0x22')](respondWithResult(_0x43a3bc,null))[_0x844d('0x40')](handleError(_0x43a3bc,null));};exports[_0x844d('0x44')]=function(_0x367167,_0x5a1486){return db[_0x844d('0x28')][_0x844d('0x44')](_0x367167[_0x844d('0x45')],{})[_0x844d('0x22')](respondWithResult(_0x5a1486,0xc9))['catch'](handleError(_0x5a1486,null));};exports[_0x844d('0x21')]=function(_0x1b8f0a,_0x3b579b){if(_0x1b8f0a['body']['id']){delete _0x1b8f0a[_0x844d('0x45')]['id'];}return db[_0x844d('0x28')]['find']({'where':{'id':_0x1b8f0a['params']['id']}})[_0x844d('0x22')](handleEntityNotFound(_0x3b579b,null))[_0x844d('0x22')](saveUpdates(_0x1b8f0a['body'],null))[_0x844d('0x22')](respondWithResult(_0x3b579b,null))[_0x844d('0x40')](handleError(_0x3b579b,null));};exports[_0x844d('0x23')]=function(_0x5ed2d2,_0x5742b8){return db['ZendeskField'][_0x844d('0x43')]({'where':{'id':_0x5ed2d2['params']['id']}})[_0x844d('0x22')](handleEntityNotFound(_0x5742b8,null))[_0x844d('0x22')](removeEntity(_0x5742b8,null))['catch'](handleError(_0x5742b8,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 7932846..0e1311e 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 _0x7b37=['moment','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','int_zendesk_fields','idField','FieldId','lodash','util','api'];(function(_0x511278,_0x1fe6e5){var _0x37706b=function(_0x4fb13a){while(--_0x4fb13a){_0x511278['push'](_0x511278['shift']());}};_0x37706b(++_0x1fe6e5);}(_0x7b37,0xd9));var _0x77b3=function(_0x3333bd,_0x23cf4c){_0x3333bd=_0x3333bd-0x0;var _0x5edb96=_0x7b37[_0x3333bd];return _0x5edb96;};'use strict';var _=require(_0x77b3('0x0'));var util=require(_0x77b3('0x1'));var logger=require('../../config/logger')(_0x77b3('0x2'));var moment=require(_0x77b3('0x3'));var BPromise=require('bluebird');var rp=require(_0x77b3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77b3('0x5'));var config=require(_0x77b3('0x6'));var attributes=require(_0x77b3('0x7'));module['exports']=function(_0x3acdea,_0x32345c){return _0x3acdea['define']('ZendeskField',attributes,{'tableName':_0x77b3('0x8'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x77b3('0x9'),_0x77b3('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6be1=['ZendeskField','zendesk_unique_index','idField','FieldId','lodash','util','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define'];(function(_0x17876c,_0x17c9e3){var _0x26844b=function(_0x497029){while(--_0x497029){_0x17876c['push'](_0x17876c['shift']());}};_0x26844b(++_0x17c9e3);}(_0x6be1,0x12f));var _0x16be=function(_0x207b43,_0x4caa13){_0x207b43=_0x207b43-0x0;var _0x262998=_0x6be1[_0x207b43];return _0x262998;};'use strict';var _=require(_0x16be('0x0'));var util=require(_0x16be('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x16be('0x2'));var fs=require('fs');var path=require(_0x16be('0x3'));var rimraf=require(_0x16be('0x4'));var config=require(_0x16be('0x5'));var attributes=require(_0x16be('0x6'));module[_0x16be('0x7')]=function(_0x36e4da,_0x19754e){return _0x36e4da[_0x16be('0x8')](_0x16be('0x9'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x16be('0xa'),'fields':[_0x16be('0xb'),_0x16be('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 f1a9a71..f29f8cc 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 _0xc18e=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x299e1e,_0x20eab5){var _0x3757dc=function(_0x211535){while(--_0x211535){_0x299e1e['push'](_0x299e1e['shift']());}};_0x3757dc(++_0x20eab5);}(_0xc18e,0x10f));var _0xec18=function(_0x29f80e,_0x9027ff){_0x29f80e=_0x29f80e-0x0;var _0x5c7eaa=_0xc18e[_0x29f80e];return _0x5c7eaa;};'use strict';var _=require(_0xec18('0x0'));var util=require(_0xec18('0x1'));var moment=require(_0xec18('0x2'));var BPromise=require(_0xec18('0x3'));var rs=require(_0xec18('0x4'));var fs=require('fs');var Redis=require(_0xec18('0x5'));var db=require(_0xec18('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xec18('0x7'));var config=require(_0xec18('0x8'));var jayson=require(_0xec18('0x9'));var client=jayson[_0xec18('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2492fb,_0x140c7a,_0x170c19){return new BPromise(function(_0x4c811d,_0x30a8b5){return client[_0xec18('0xb')](_0x2492fb,_0x170c19)[_0xec18('0xc')](function(_0x5362ba){logger[_0xec18('0xd')](_0xec18('0xe'),_0x140c7a,_0xec18('0xf'));logger[_0xec18('0x10')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x140c7a,_0xec18('0xf'),JSON[_0xec18('0x11')](_0x5362ba));if(_0x5362ba[_0xec18('0x12')]){if(_0x5362ba[_0xec18('0x12')][_0xec18('0x13')]===0x1f4){logger[_0xec18('0x12')](_0xec18('0xe'),_0x140c7a,_0x5362ba[_0xec18('0x12')]['message']);return _0x30a8b5(_0x5362ba['error'][_0xec18('0x14')]);}logger[_0xec18('0x12')]('ZendeskField,\x20%s,\x20%s',_0x140c7a,_0x5362ba[_0xec18('0x12')]['message']);return _0x4c811d(_0x5362ba[_0xec18('0x12')][_0xec18('0x14')]);}else{logger['info'](_0xec18('0xe'),_0x140c7a,'request\x20sent');_0x4c811d(_0x5362ba[_0xec18('0x15')]['message']);}})[_0xec18('0x16')](function(_0x228395){logger['error'](_0xec18('0xe'),_0x140c7a,_0x228395);_0x30a8b5(_0x228395);});});} \ No newline at end of file +var _0xe030=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','debug','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','info','result','catch'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xe030,0x19e));var _0x0e03=function(_0x5746a1,_0x11eab1){_0x5746a1=_0x5746a1-0x0;var _0x551a43=_0xe030[_0x5746a1];return _0x551a43;};'use strict';var _=require(_0x0e03('0x0'));var util=require(_0x0e03('0x1'));var moment=require('moment');var BPromise=require(_0x0e03('0x2'));var rs=require(_0x0e03('0x3'));var fs=require('fs');var Redis=require(_0x0e03('0x4'));var db=require(_0x0e03('0x5'))['db'];var utils=require(_0x0e03('0x6'));var logger=require(_0x0e03('0x7'))(_0x0e03('0x8'));var config=require(_0x0e03('0x9'));var jayson=require(_0x0e03('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x86e356,_0x191370,_0x21a506){return new BPromise(function(_0xc5193f,_0x1badff){return client[_0x0e03('0xb')](_0x86e356,_0x21a506)[_0x0e03('0xc')](function(_0xea5c){logger['info']('ZendeskField,\x20%s,\x20%s',_0x191370,_0x0e03('0xd'));logger[_0x0e03('0xe')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x191370,_0x0e03('0xd'),JSON[_0x0e03('0xf')](_0xea5c));if(_0xea5c[_0x0e03('0x10')]){if(_0xea5c[_0x0e03('0x10')][_0x0e03('0x11')]===0x1f4){logger[_0x0e03('0x10')](_0x0e03('0x12'),_0x191370,_0xea5c[_0x0e03('0x10')][_0x0e03('0x13')]);return _0x1badff(_0xea5c['error']['message']);}logger[_0x0e03('0x10')]('ZendeskField,\x20%s,\x20%s',_0x191370,_0xea5c[_0x0e03('0x10')]['message']);return _0xc5193f(_0xea5c[_0x0e03('0x10')][_0x0e03('0x13')]);}else{logger[_0x0e03('0x14')](_0x0e03('0x12'),_0x191370,_0x0e03('0xd'));_0xc5193f(_0xea5c[_0x0e03('0x15')]['message']);}})[_0x0e03('0x16')](function(_0x392c9b){logger['error'](_0x0e03('0x12'),_0x191370,_0x392c9b);_0x1badff(_0x392c9b);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 1bebf98..15bebc7 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 _0xef97=['post','/:id/configurations','put','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields'];(function(_0x1f07c5,_0x2f99bd){var _0x45c6fc=function(_0x57823f){while(--_0x57823f){_0x1f07c5['push'](_0x1f07c5['shift']());}};_0x45c6fc(++_0x2f99bd);}(_0xef97,0xe2));var _0x7ef9=function(_0x5aa373,_0x54c7f4){_0x5aa373=_0x5aa373-0x0;var _0x590e8e=_0xef97[_0x5aa373];return _0x590e8e;};'use strict';var multer=require('multer');var util=require(_0x7ef9('0x0'));var path=require('path');var timeout=require(_0x7ef9('0x1'));var express=require(_0x7ef9('0x2'));var router=express[_0x7ef9('0x3')]();var fs_extra=require(_0x7ef9('0x4'));var auth=require(_0x7ef9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7ef9('0x6'));var controller=require(_0x7ef9('0x7'));router[_0x7ef9('0x8')]('/',auth[_0x7ef9('0x9')](),controller[_0x7ef9('0xa')]);router[_0x7ef9('0x8')](_0x7ef9('0xb'),auth[_0x7ef9('0x9')](),controller[_0x7ef9('0xc')]);router[_0x7ef9('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x7ef9('0xd')]);router[_0x7ef9('0x8')](_0x7ef9('0xe'),auth[_0x7ef9('0x9')](),controller[_0x7ef9('0xf')]);router[_0x7ef9('0x10')]('/',auth[_0x7ef9('0x9')](),controller['create']);router[_0x7ef9('0x10')](_0x7ef9('0x11'),auth[_0x7ef9('0x9')](),controller['addConfiguration']);router[_0x7ef9('0x12')](_0x7ef9('0xb'),auth['isAuthenticated'](),controller[_0x7ef9('0x13')]);router['delete'](_0x7ef9('0xb'),auth[_0x7ef9('0x9')](),controller[_0x7ef9('0x14')]);module[_0x7ef9('0x15')]=router; \ No newline at end of file +var _0xa2ea=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','util','path'];(function(_0x434903,_0x2bae84){var _0x31021e=function(_0x176a5f){while(--_0x176a5f){_0x434903['push'](_0x434903['shift']());}};_0x31021e(++_0x2bae84);}(_0xa2ea,0xbb));var _0xaa2e=function(_0x4f6259,_0x35094b){_0x4f6259=_0x4f6259-0x0;var _0x35f1bb=_0xa2ea[_0x4f6259];return _0x35f1bb;};'use strict';var multer=require('multer');var util=require(_0xaa2e('0x0'));var path=require(_0xaa2e('0x1'));var timeout=require('connect-timeout');var express=require(_0xaa2e('0x2'));var router=express[_0xaa2e('0x3')]();var fs_extra=require(_0xaa2e('0x4'));var auth=require(_0xaa2e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaa2e('0x6'));var controller=require('./intZohoAccount.controller');router[_0xaa2e('0x7')]('/',auth[_0xaa2e('0x8')](),controller[_0xaa2e('0x9')]);router[_0xaa2e('0x7')](_0xaa2e('0xa'),auth[_0xaa2e('0x8')](),controller[_0xaa2e('0xb')]);router[_0xaa2e('0x7')]('/:id/configurations',auth[_0xaa2e('0x8')](),controller[_0xaa2e('0xc')]);router['get']('/:id/fields',auth[_0xaa2e('0x8')](),controller['getFields']);router[_0xaa2e('0xd')]('/',auth['isAuthenticated'](),controller[_0xaa2e('0xe')]);router['post'](_0xaa2e('0xf'),auth[_0xaa2e('0x8')](),controller[_0xaa2e('0x10')]);router[_0xaa2e('0x11')](_0xaa2e('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xaa2e('0x12')](_0xaa2e('0xa'),auth[_0xaa2e('0x8')](),controller[_0xaa2e('0x13')]);module[_0xaa2e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index cbd3149..3c00766 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 _0x0005=['exports','STRING'];(function(_0x14c103,_0x2b2bd8){var _0x21e5ea=function(_0x1fb04e){while(--_0x1fb04e){_0x14c103['push'](_0x14c103['shift']());}};_0x21e5ea(++_0x2b2bd8);}(_0x0005,0x1d4));var _0x5000=function(_0x652209,_0x243c43){_0x652209=_0x652209-0x0;var _0x443cbc=_0x0005[_0x652209];return _0x443cbc;};'use strict';var Sequelize=require('sequelize');module[_0x5000('0x0')]={'name':{'type':Sequelize[_0x5000('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x5000('0x1')]},'clientId':{'type':Sequelize[_0x5000('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x5000('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x5000('0x1')]},'refreshToken':{'type':Sequelize[_0x5000('0x1')]}}; \ No newline at end of file +var _0x3225=['STRING','sequelize','exports'];(function(_0x257e8f,_0xdc7fc9){var _0x2d8b1e=function(_0x24739a){while(--_0x24739a){_0x257e8f['push'](_0x257e8f['shift']());}};_0x2d8b1e(++_0xdc7fc9);}(_0x3225,0xc7));var _0x5322=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3225[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5322('0x0'));module[_0x5322('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5322('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x5322('0x2')]},'serverUrl':{'type':Sequelize[_0x5322('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x5322('0x2')]},'refreshToken':{'type':Sequelize[_0x5322('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 27f6dcd..237ff89 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 _0xa5fa=['getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','stack','name','index','map','ZohoAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','show','params','options','find','create','body','findOne','ZohoConfiguration'];(function(_0x39affa,_0x49d88d){var _0x38c31e=function(_0x544b57){while(--_0x544b57){_0x39affa['push'](_0x39affa['shift']());}};_0x38c31e(++_0x49d88d);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x5cce57,_0x3cbadd){_0x5cce57=_0x5cce57-0x0;var _0x114fc2=_0xa5fa[_0x5cce57];return _0x114fc2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa5f('0x0'));var zipdir=require(_0xaa5f('0x1'));var jsonpatch=require(_0xaa5f('0x2'));var rp=require(_0xaa5f('0x3'));var moment=require('moment');var BPromise=require(_0xaa5f('0x4'));var Mustache=require(_0xaa5f('0x5'));var util=require('util');var path=require(_0xaa5f('0x6'));var sox=require(_0xaa5f('0x7'));var csv=require(_0xaa5f('0x8'));var ejs=require(_0xaa5f('0x9'));var fs=require('fs');var fs_extra=require(_0xaa5f('0xa'));var _=require(_0xaa5f('0xb'));var squel=require(_0xaa5f('0xc'));var crypto=require(_0xaa5f('0xd'));var jsforce=require(_0xaa5f('0xe'));var deskjs=require(_0xaa5f('0xf'));var toCsv=require(_0xaa5f('0x8'));var querystring=require('querystring');var Papa=require(_0xaa5f('0x10'));var Redis=require(_0xaa5f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaa5f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa5f('0x13'));var utils=require('../../config/utils');var config=require(_0xaa5f('0x14'));var licenseUtil=require(_0xaa5f('0x15'));var db=require(_0xaa5f('0x16'))['db'];var integrations=require(_0xaa5f('0x17'));var jayson=require(_0xaa5f('0x18'));var client=jayson['client'][_0xaa5f('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x552c53,_0x372881,_0x23f872,_0x31eabc){return new BPromise(function(_0x19aa27,_0x2e1ca5){var _0x5a4c41=_0x31eabc||client;return _0x5a4c41['request'](_0x552c53,_0x23f872)[_0xaa5f('0x1a')](function(_0x291042){logger[_0xaa5f('0x1b')](_0xaa5f('0x1c'),_0x372881,_0xaa5f('0x1d'));logger[_0xaa5f('0x1e')](_0xaa5f('0x1f'),_0x372881,_0xaa5f('0x1d'),JSON[_0xaa5f('0x20')](_0x291042));if(_0x291042[_0xaa5f('0x21')]){if(_0x291042[_0xaa5f('0x21')][_0xaa5f('0x22')]===0x1f4){logger['error'](_0xaa5f('0x1c'),_0x372881,_0x291042[_0xaa5f('0x21')][_0xaa5f('0x23')]);return _0x2e1ca5(_0x291042[_0xaa5f('0x21')][_0xaa5f('0x23')]);}logger[_0xaa5f('0x21')](_0xaa5f('0x1c'),_0x372881,_0x291042[_0xaa5f('0x21')][_0xaa5f('0x23')]);return _0x19aa27(_0x291042[_0xaa5f('0x21')][_0xaa5f('0x23')]);}else{logger[_0xaa5f('0x1b')](_0xaa5f('0x1c'),_0x372881,'request\x20sent');_0x19aa27(_0x291042[_0xaa5f('0x24')]['message']);}})[_0xaa5f('0x25')](function(_0x34ca72){logger['error'](_0xaa5f('0x1c'),_0x372881,_0x34ca72);_0x2e1ca5(_0x34ca72);});});}function respondWithStatusCode(_0x1032ce,_0x5b9f0b){_0x5b9f0b=_0x5b9f0b||0xcc;return function(_0xf6a8c3){if(_0xf6a8c3){return _0x1032ce[_0xaa5f('0x26')](_0x5b9f0b);}return _0x1032ce[_0xaa5f('0x27')](_0x5b9f0b)[_0xaa5f('0x28')]();};}function respondWithResult(_0x1f66c0,_0xacbded){_0xacbded=_0xacbded||0xc8;return function(_0x3d7bca){if(_0x3d7bca){return _0x1f66c0[_0xaa5f('0x27')](_0xacbded)['json'](_0x3d7bca);}};}function respondWithFilteredResult(_0x2445a6,_0x3a66e8){return function(_0x1ed8eb){if(_0x1ed8eb){var _0x5a7cf1=typeof _0x3a66e8[_0xaa5f('0x29')]===_0xaa5f('0x2a')&&typeof _0x3a66e8[_0xaa5f('0x2b')]==='undefined';var _0x5a90e5=_0x1ed8eb['count'];var _0x5990d2=_0x5a7cf1?0x0:_0x3a66e8[_0xaa5f('0x29')];var _0x50998f=_0x5a7cf1?_0x1ed8eb[_0xaa5f('0x2c')]:_0x3a66e8['offset']+_0x3a66e8['limit'];var _0x49dcd6;if(_0x50998f>=_0x5a90e5){_0x50998f=_0x5a90e5;_0x49dcd6=0xc8;}else{_0x49dcd6=0xce;}_0x2445a6[_0xaa5f('0x27')](_0x49dcd6);return _0x2445a6['set'](_0xaa5f('0x2d'),_0x5990d2+'-'+_0x50998f+'/'+_0x5a90e5)[_0xaa5f('0x2e')](_0x1ed8eb);}return null;};}function patchUpdates(_0x555876){return function(_0x58f608){try{jsonpatch[_0xaa5f('0x2f')](_0x58f608,_0x555876,!![]);}catch(_0x5e858a){return BPromise[_0xaa5f('0x30')](_0x5e858a);}return _0x58f608[_0xaa5f('0x31')]();};}function saveUpdates(_0x52132c,_0xda1742){return function(_0x1610b8){if(_0x1610b8){return _0x1610b8[_0xaa5f('0x32')](_0x52132c)['then'](function(_0xecaac7){return _0xecaac7;});}return null;};}function removeEntity(_0x160198,_0x527866){return function(_0x57591f){if(_0x57591f){return _0x57591f['destroy']()['then'](function(){_0x160198[_0xaa5f('0x27')](0xcc)[_0xaa5f('0x28')]();});}};}function handleEntityNotFound(_0x2a6015,_0x3ff8b9){return function(_0x462fe6){if(!_0x462fe6){_0x2a6015[_0xaa5f('0x26')](0x194);}return _0x462fe6;};}function handleError(_0x3887dd,_0x501dc3){_0x501dc3=_0x501dc3||0x1f4;return function(_0x1ab07f){logger[_0xaa5f('0x21')](_0x1ab07f[_0xaa5f('0x33')]);if(_0x1ab07f[_0xaa5f('0x34')]){delete _0x1ab07f[_0xaa5f('0x34')];}_0x3887dd[_0xaa5f('0x27')](_0x501dc3)['send'](_0x1ab07f);};}exports[_0xaa5f('0x35')]=function(_0x3131c2,_0x200f6a){var _0x2ac0f8={},_0x3dc2f5={},_0x56ac45={'count':0x0,'rows':[]};var _0x4dd41a=_[_0xaa5f('0x36')](db[_0xaa5f('0x37')][_0xaa5f('0x38')],function(_0x964105){return{'name':_0x964105['fieldName'],'type':_0x964105[_0xaa5f('0x39')][_0xaa5f('0x3a')]};});_0x3dc2f5[_0xaa5f('0x3b')]=_[_0xaa5f('0x36')](_0x4dd41a,_0xaa5f('0x34'));_0x3dc2f5[_0xaa5f('0x3c')]=_[_0xaa5f('0x3d')](_0x3131c2[_0xaa5f('0x3c')]);_0x3dc2f5[_0xaa5f('0x3e')]=_[_0xaa5f('0x3f')](_0x3dc2f5[_0xaa5f('0x3b')],_0x3dc2f5['query']);_0x2ac0f8[_0xaa5f('0x40')]=_[_0xaa5f('0x3f')](_0x3dc2f5[_0xaa5f('0x3b')],qs[_0xaa5f('0x41')](_0x3131c2[_0xaa5f('0x3c')][_0xaa5f('0x41')]));_0x2ac0f8[_0xaa5f('0x40')]=_0x2ac0f8[_0xaa5f('0x40')][_0xaa5f('0x42')]?_0x2ac0f8[_0xaa5f('0x40')]:_0x3dc2f5['model'];if(!_0x3131c2[_0xaa5f('0x3c')]['hasOwnProperty'](_0xaa5f('0x43'))){_0x2ac0f8[_0xaa5f('0x2b')]=qs[_0xaa5f('0x2b')](_0x3131c2['query'][_0xaa5f('0x2b')]);_0x2ac0f8[_0xaa5f('0x29')]=qs[_0xaa5f('0x29')](_0x3131c2['query'][_0xaa5f('0x29')]);}_0x2ac0f8[_0xaa5f('0x44')]=qs[_0xaa5f('0x45')](_0x3131c2[_0xaa5f('0x3c')]['sort']);_0x2ac0f8[_0xaa5f('0x46')]=qs[_0xaa5f('0x3e')](_[_0xaa5f('0x47')](_0x3131c2[_0xaa5f('0x3c')],_0x3dc2f5[_0xaa5f('0x3e')]),_0x4dd41a);if(_0x3131c2[_0xaa5f('0x3c')][_0xaa5f('0x48')]){_0x2ac0f8[_0xaa5f('0x46')]=_['merge'](_0x2ac0f8[_0xaa5f('0x46')],{'$or':_['map'](_0x4dd41a,function(_0x28df31){if(_0x28df31['type']!==_0xaa5f('0x49')){var _0xdba4d8={};_0xdba4d8[_0x28df31['name']]={'$like':'%'+_0x3131c2[_0xaa5f('0x3c')][_0xaa5f('0x48')]+'%'};return _0xdba4d8;}})});}_0x2ac0f8=_[_0xaa5f('0x4a')]({},_0x2ac0f8,_0x3131c2['options']);var _0x53343a={'where':_0x2ac0f8['where']};return db[_0xaa5f('0x37')]['count'](_0x53343a)[_0xaa5f('0x1a')](function(_0x44600c){_0x56ac45[_0xaa5f('0x2c')]=_0x44600c;if(_0x3131c2[_0xaa5f('0x3c')]['includeAll']){_0x2ac0f8[_0xaa5f('0x4b')]=[{'all':!![]}];}return db[_0xaa5f('0x37')][_0xaa5f('0x4c')](_0x2ac0f8);})[_0xaa5f('0x1a')](function(_0x27ea4b){_0x56ac45[_0xaa5f('0x4d')]=_0x27ea4b;return _0x56ac45;})[_0xaa5f('0x1a')](respondWithFilteredResult(_0x200f6a,_0x2ac0f8))[_0xaa5f('0x25')](handleError(_0x200f6a,null));};exports[_0xaa5f('0x4e')]=function(_0x16f8bf,_0x3ea553){var _0x2de737={'raw':![],'where':{'id':_0x16f8bf[_0xaa5f('0x4f')]['id']}},_0x2be44d={};_0x2be44d[_0xaa5f('0x3b')]=_[_0xaa5f('0x3d')](db['ZohoAccount'][_0xaa5f('0x38')]);_0x2be44d[_0xaa5f('0x3c')]=_[_0xaa5f('0x3d')](_0x16f8bf[_0xaa5f('0x3c')]);_0x2be44d[_0xaa5f('0x3e')]=_[_0xaa5f('0x3f')](_0x2be44d[_0xaa5f('0x3b')],_0x2be44d['query']);_0x2de737[_0xaa5f('0x40')]=_[_0xaa5f('0x3f')](_0x2be44d[_0xaa5f('0x3b')],qs[_0xaa5f('0x41')](_0x16f8bf['query'][_0xaa5f('0x41')]));_0x2de737[_0xaa5f('0x40')]=_0x2de737[_0xaa5f('0x40')]['length']?_0x2de737['attributes']:_0x2be44d['model'];if(_0x16f8bf['query']['includeAll']){_0x2de737['include']=[{'all':!![]}];}_0x2de737=_[_0xaa5f('0x4a')]({},_0x2de737,_0x16f8bf[_0xaa5f('0x50')]);return db[_0xaa5f('0x37')][_0xaa5f('0x51')](_0x2de737)[_0xaa5f('0x1a')](handleEntityNotFound(_0x3ea553,null))[_0xaa5f('0x1a')](respondWithResult(_0x3ea553,null))['catch'](handleError(_0x3ea553,null));};exports['create']=function(_0x157eb4,_0x3e0f41){return db['ZohoAccount'][_0xaa5f('0x52')](_0x157eb4[_0xaa5f('0x53')],{})[_0xaa5f('0x1a')](respondWithResult(_0x3e0f41,0xc9))[_0xaa5f('0x25')](handleError(_0x3e0f41,null));};exports[_0xaa5f('0x32')]=function(_0x3db842,_0x3aff09){if(_0x3db842['body']['id']){delete _0x3db842['body']['id'];}return db[_0xaa5f('0x37')][_0xaa5f('0x51')]({'where':{'id':_0x3db842['params']['id']}})['then'](handleEntityNotFound(_0x3aff09,null))['then'](saveUpdates(_0x3db842[_0xaa5f('0x53')],null))['then'](respondWithResult(_0x3aff09,null))[_0xaa5f('0x25')](handleError(_0x3aff09,null));};exports['destroy']=function(_0x4c5bf6,_0x29b323){return db[_0xaa5f('0x37')][_0xaa5f('0x51')]({'where':{'id':_0x4c5bf6['params']['id']}})[_0xaa5f('0x1a')](handleEntityNotFound(_0x29b323,null))[_0xaa5f('0x1a')](removeEntity(_0x29b323,null))[_0xaa5f('0x25')](handleError(_0x29b323,null));};exports['getConfigurations']=function(_0x21d494,_0x2fd00c,_0x52feeb){var _0x902e5b={};var _0x2b2300={};var _0x455702;var _0x3fdc46;return db[_0xaa5f('0x37')][_0xaa5f('0x54')]({'where':{'id':_0x21d494[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x1a')](handleEntityNotFound(_0x2fd00c,null))[_0xaa5f('0x1a')](function(_0x5ed3b8){if(_0x5ed3b8){_0x455702=_0x5ed3b8;_0x2b2300[_0xaa5f('0x3b')]=_[_0xaa5f('0x3d')](db[_0xaa5f('0x55')][_0xaa5f('0x38')]);_0x2b2300[_0xaa5f('0x3c')]=_[_0xaa5f('0x3d')](_0x21d494[_0xaa5f('0x3c')]);_0x2b2300[_0xaa5f('0x3e')]=_['intersection'](_0x2b2300[_0xaa5f('0x3b')],_0x2b2300['query']);_0x902e5b[_0xaa5f('0x40')]=_[_0xaa5f('0x3f')](_0x2b2300[_0xaa5f('0x3b')],qs[_0xaa5f('0x41')](_0x21d494['query'][_0xaa5f('0x41')]));_0x902e5b[_0xaa5f('0x40')]=_0x902e5b[_0xaa5f('0x40')]['length']?_0x902e5b[_0xaa5f('0x40')]:_0x2b2300['model'];_0x902e5b[_0xaa5f('0x44')]=qs['sort'](_0x21d494[_0xaa5f('0x3c')][_0xaa5f('0x45')]);_0x902e5b[_0xaa5f('0x46')]=qs[_0xaa5f('0x3e')](_['pick'](_0x21d494[_0xaa5f('0x3c')],_0x2b2300[_0xaa5f('0x3e')]));if(_0x21d494['query']['filter']){_0x902e5b[_0xaa5f('0x46')]=_[_0xaa5f('0x4a')](_0x902e5b['where'],{'$or':_[_0xaa5f('0x36')](_0x902e5b[_0xaa5f('0x40')],function(_0x3047bd){var _0x4bb874={};_0x4bb874[_0x3047bd]={'$like':'%'+_0x21d494[_0xaa5f('0x3c')][_0xaa5f('0x48')]+'%'};return _0x4bb874;})});}_0x902e5b=_['merge']({},_0x902e5b,_0x21d494[_0xaa5f('0x50')]);return _0x455702[_0xaa5f('0x56')](_0x902e5b);}})[_0xaa5f('0x1a')](function(_0x5abaf6){if(_0x5abaf6){_0x3fdc46=_0x5abaf6[_0xaa5f('0x42')];if(!_0x21d494[_0xaa5f('0x3c')]['hasOwnProperty'](_0xaa5f('0x43'))){_0x902e5b[_0xaa5f('0x2b')]=qs[_0xaa5f('0x2b')](_0x21d494[_0xaa5f('0x3c')][_0xaa5f('0x2b')]);_0x902e5b['offset']=qs[_0xaa5f('0x29')](_0x21d494[_0xaa5f('0x3c')][_0xaa5f('0x29')]);}return _0x455702[_0xaa5f('0x56')](_0x902e5b);}})[_0xaa5f('0x1a')](function(_0x508fe7){if(_0x508fe7){return _0x508fe7?{'count':_0x3fdc46,'rows':_0x508fe7}:null;}})[_0xaa5f('0x1a')](respondWithResult(_0x2fd00c,null))['catch'](handleError(_0x2fd00c,null));};exports[_0xaa5f('0x57')]=function(_0x15afd2,_0x22d0ad,_0x15d1d8){if(_0x15afd2['body']['id']){delete _0x15afd2[_0xaa5f('0x53')]['id'];}return db[_0xaa5f('0x37')][_0xaa5f('0x54')]({'where':{'id':_0x15afd2[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x1a')](handleEntityNotFound(_0x22d0ad,null))[_0xaa5f('0x1a')](function(_0x5ca9bd){if(_0x5ca9bd){_0x15afd2['body'][_0xaa5f('0x58')]=_0x5ca9bd['id'];_0x15afd2[_0xaa5f('0x53')][_0xaa5f('0x59')]=integrations[_0xaa5f('0x5a')](_0x15afd2[_0xaa5f('0x53')]['channel'],_0x15afd2['body'][_0xaa5f('0x39')]);_0x15afd2[_0xaa5f('0x53')]['Descriptions']=integrations[_0xaa5f('0x5b')](_0x15afd2['body'][_0xaa5f('0x5c')],_0x15afd2[_0xaa5f('0x53')]['type']);return db[_0xaa5f('0x55')][_0xaa5f('0x52')](_0x15afd2[_0xaa5f('0x53')],{'include':[{'model':db[_0xaa5f('0x5d')],'as':_0xaa5f('0x59')},{'model':db[_0xaa5f('0x5d')],'as':_0xaa5f('0x5e')}]});}return null;})['then'](respondWithResult(_0x22d0ad,null))[_0xaa5f('0x25')](handleError(_0x22d0ad,null));};function getAccessToken(_0x2974bd){return new Promise(function(_0x3fee9f,_0x5e86af){var _0x12fedd;switch(_0x2974bd[_0xaa5f('0x5f')]){case'US':_0x12fedd=_0xaa5f('0x60');break;case'AU':_0x12fedd=_0xaa5f('0x61');break;case'EU':_0x12fedd=_0xaa5f('0x62');break;case'IN':_0x12fedd='https://accounts.zoho.in';break;case'CN':_0x12fedd=_0xaa5f('0x63');break;default:_0x12fedd=_0xaa5f('0x62');break;}var _0x3ca3b6={'method':_0xaa5f('0x64'),'uri':_0x12fedd+_0xaa5f('0x65'),'qs':{'refresh_token':_0x2974bd[_0xaa5f('0x66')],'client_id':_0x2974bd[_0xaa5f('0x67')],'client_secret':_0x2974bd[_0xaa5f('0x68')],'grant_type':_0xaa5f('0x69')},'json':!![]};return rp(_0x3ca3b6)[_0xaa5f('0x1a')](function(_0x47bf08){if(_0x47bf08['access_token']){_0x3fee9f(_0x47bf08[_0xaa5f('0x6a')]);}else{_0x5e86af(_0xaa5f('0x6b'));}})[_0xaa5f('0x25')](function(_0x40acb0){_0x5e86af(_0x40acb0);});});}exports[_0xaa5f('0x6c')]=function(_0x2bafc2,_0x38e920,_0xdb2a8b){var _0x59c314,_0xf004f1,_0x5871b1,_0x24a7a7,_0x5f2484;return db['ZohoAccount'][_0xaa5f('0x54')]({'where':{'id':_0x2bafc2[_0xaa5f('0x4f')]['id']},'attributes':['id',_0xaa5f('0x6d'),_0xaa5f('0x5f'),_0xaa5f('0x67'),_0xaa5f('0x68'),_0xaa5f('0x6e'),_0xaa5f('0x22'),_0xaa5f('0x66')]})[_0xaa5f('0x1a')](handleEntityNotFound(_0x38e920,null))['then'](function(_0x5a2102){_0x5f2484=_0x5a2102;_0x59c314=_0x5f2484[_0xaa5f('0x6d')];_0xf004f1=_0x59c314===_0xaa5f('0x6f')?'eu':_0xaa5f('0x70');_0x5871b1=_0x5f2484[_0xaa5f('0x6e')];var _0x4c3b3b=_0x5871b1[_0xaa5f('0x71')](-0x1);if(_0x4c3b3b==='/'||_0x4c3b3b==='\x5c'||_0x4c3b3b===':'){_0x5871b1=_0x5871b1[_0xaa5f('0x72')](0x0,_0x5871b1[_0xaa5f('0x73')](_0x4c3b3b));}if(!_0x5f2484['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x5f2484);})['then'](function(_0x1e08b2){if(_0x1e08b2){return rp({'method':_0xaa5f('0x74'),'uri':util[_0xaa5f('0x75')](_0xaa5f('0x76'),_0xf004f1),'qs':{'module':'Calls'},'headers':{'Authorization':_0xaa5f('0x77')+_0x1e08b2},'json':!![]});}})[_0xaa5f('0x1a')](function(_0x1cff42){if(_0x1cff42){if(_0x1cff42[_0xaa5f('0x78')]&&_0x1cff42[_0xaa5f('0x78')][_0xaa5f('0x21')]){throw new Error(_0x1cff42[_0xaa5f('0x78')][_0xaa5f('0x21')][_0xaa5f('0x23')]);}var _0xaa49aa=[];var _0x16b757=[];var _0x27d0a2=[_0xaa5f('0x79'),_0xaa5f('0x7a'),_0xaa5f('0x7b'),_0xaa5f('0x7c'),_0xaa5f('0x7d'),_0xaa5f('0x7e'),_0xaa5f('0x7f'),'Call_Type'];_0x16b757=_[_0xaa5f('0x80')](_0x1cff42[_0xaa5f('0x41')],function(_0x43d235){return _0x27d0a2[_0xaa5f('0x81')](_0x43d235[_0xaa5f('0x82')]);});for(var _0x5d8fa6=0x0;_0x5d8fa6<_0x16b757[_0xaa5f('0x42')];_0x5d8fa6++){if(_0x16b757[_0x5d8fa6]['system_mandatory']===![]){_0xaa49aa[_0xaa5f('0x83')]({'id':_0x16b757[_0x5d8fa6]['id'],'name':_0x16b757[_0x5d8fa6][_0xaa5f('0x84')],'custom':_0x16b757[_0x5d8fa6][_0xaa5f('0x85')],'options':_0x16b757[_0x5d8fa6][_0xaa5f('0x86')]===_0xaa5f('0x87')&&_0x16b757[_0x5d8fa6][_0xaa5f('0x88')][_0xaa5f('0x42')]>-0x1?_['map'](_0x16b757[_0x5d8fa6][_0xaa5f('0x88')],function(_0x598d86){return{'name':_0x598d86,'value':_0x598d86};}):[]});}}return{'count':_0xaa49aa[_0xaa5f('0x42')],'rows':_0xaa49aa};}else{return{'count':0x0,'rows':[]};}})[_0xaa5f('0x1a')](respondWithResult(_0x38e920,null))[_0xaa5f('0x25')](function(_0x1a88c9){var _0x524dbe=_0x2bafc2[_0xaa5f('0x3c')]['test']?0x1f4:_0x1a88c9[_0xaa5f('0x89')]||0x1f4;logger['error'](_0xaa5f('0x8a'),'getFields',_0x524dbe,JSON[_0xaa5f('0x20')](_0x1a88c9));delete _0x1a88c9[_0xaa5f('0x34')];if(_0x524dbe===0x191){_0x524dbe=0x190;}_0x38e920[_0xaa5f('0x27')](_0x524dbe)[_0xaa5f('0x8b')](_0x2bafc2['query'][_0xaa5f('0x8c')]?{'message':'Wrong\x20credentials','statusCode':_0x1a88c9[_0xaa5f('0x89')]}:_0x1a88c9);});}; \ No newline at end of file +var _0x9aea=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ZohoAccount','includeAll','include','findAll','rows','params','find','catch','create','body','getConfigurations','ZohoConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','api_name','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','map','rawAttributes','fieldName','key','model','query'];(function(_0x436d88,_0x481b5c){var _0x4e2387=function(_0x56ae00){while(--_0x56ae00){_0x436d88['push'](_0x436d88['shift']());}};_0x4e2387(++_0x481b5c);}(_0x9aea,0xdd));var _0xa9ae=function(_0x44d0e3,_0x241bd8){_0x44d0e3=_0x44d0e3-0x0;var _0x4c362c=_0x9aea[_0x44d0e3];return _0x4c362c;};'use strict';var emlformat=require(_0xa9ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa9ae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9ae('0x2'));var moment=require(_0xa9ae('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa9ae('0x4'));var util=require(_0xa9ae('0x5'));var path=require(_0xa9ae('0x6'));var sox=require(_0xa9ae('0x7'));var csv=require(_0xa9ae('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9ae('0x9'));var _=require(_0xa9ae('0xa'));var squel=require(_0xa9ae('0xb'));var crypto=require('crypto');var jsforce=require(_0xa9ae('0xc'));var deskjs=require(_0xa9ae('0xd'));var toCsv=require(_0xa9ae('0x8'));var querystring=require(_0xa9ae('0xe'));var Papa=require(_0xa9ae('0xf'));var Redis=require(_0xa9ae('0x10'));var authService=require(_0xa9ae('0x11'));var qs=require(_0xa9ae('0x12'));var as=require(_0xa9ae('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9ae('0x14'))('api');var utils=require(_0xa9ae('0x15'));var config=require(_0xa9ae('0x16'));var licenseUtil=require(_0xa9ae('0x17'));var db=require(_0xa9ae('0x18'))['db'];var integrations=require(_0xa9ae('0x19'));var jayson=require(_0xa9ae('0x1a'));var client=jayson[_0xa9ae('0x1b')][_0xa9ae('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x56de45,_0x1859c3,_0x365e90,_0x10882e){return new BPromise(function(_0x3f7f61,_0x4d0bd9){var _0x28ce2d=_0x10882e||client;return _0x28ce2d[_0xa9ae('0x1d')](_0x56de45,_0x365e90)[_0xa9ae('0x1e')](function(_0x40b756){logger[_0xa9ae('0x1f')](_0xa9ae('0x20'),_0x1859c3,'request\x20sent');logger[_0xa9ae('0x21')](_0xa9ae('0x22'),_0x1859c3,_0xa9ae('0x23'),JSON['stringify'](_0x40b756));if(_0x40b756['error']){if(_0x40b756[_0xa9ae('0x24')]['code']===0x1f4){logger['error'](_0xa9ae('0x20'),_0x1859c3,_0x40b756[_0xa9ae('0x24')][_0xa9ae('0x25')]);return _0x4d0bd9(_0x40b756[_0xa9ae('0x24')]['message']);}logger[_0xa9ae('0x24')](_0xa9ae('0x20'),_0x1859c3,_0x40b756[_0xa9ae('0x24')][_0xa9ae('0x25')]);return _0x3f7f61(_0x40b756[_0xa9ae('0x24')][_0xa9ae('0x25')]);}else{logger[_0xa9ae('0x1f')]('ZohoAccount,\x20%s,\x20%s',_0x1859c3,_0xa9ae('0x23'));_0x3f7f61(_0x40b756['result']['message']);}})['catch'](function(_0x478bb7){logger[_0xa9ae('0x24')]('ZohoAccount,\x20%s,\x20%s',_0x1859c3,_0x478bb7);_0x4d0bd9(_0x478bb7);});});}function respondWithStatusCode(_0x13fb05,_0x5093ad){_0x5093ad=_0x5093ad||0xcc;return function(_0x2ff25c){if(_0x2ff25c){return _0x13fb05[_0xa9ae('0x26')](_0x5093ad);}return _0x13fb05[_0xa9ae('0x27')](_0x5093ad)[_0xa9ae('0x28')]();};}function respondWithResult(_0x12b061,_0x3f3f97){_0x3f3f97=_0x3f3f97||0xc8;return function(_0x23c1ec){if(_0x23c1ec){return _0x12b061['status'](_0x3f3f97)[_0xa9ae('0x29')](_0x23c1ec);}};}function respondWithFilteredResult(_0x3873aa,_0x2aac9e){return function(_0xfe9ef1){if(_0xfe9ef1){var _0x222db7=typeof _0x2aac9e[_0xa9ae('0x2a')]===_0xa9ae('0x2b')&&typeof _0x2aac9e['limit']==='undefined';var _0x2f1a9f=_0xfe9ef1[_0xa9ae('0x2c')];var _0x3d1131=_0x222db7?0x0:_0x2aac9e[_0xa9ae('0x2a')];var _0x74cd94=_0x222db7?_0xfe9ef1['count']:_0x2aac9e['offset']+_0x2aac9e[_0xa9ae('0x2d')];var _0x34616f;if(_0x74cd94>=_0x2f1a9f){_0x74cd94=_0x2f1a9f;_0x34616f=0xc8;}else{_0x34616f=0xce;}_0x3873aa[_0xa9ae('0x27')](_0x34616f);return _0x3873aa[_0xa9ae('0x2e')](_0xa9ae('0x2f'),_0x3d1131+'-'+_0x74cd94+'/'+_0x2f1a9f)[_0xa9ae('0x29')](_0xfe9ef1);}return null;};}function patchUpdates(_0x5d0c84){return function(_0x5415f1){try{jsonpatch[_0xa9ae('0x30')](_0x5415f1,_0x5d0c84,!![]);}catch(_0x268137){return BPromise[_0xa9ae('0x31')](_0x268137);}return _0x5415f1[_0xa9ae('0x32')]();};}function saveUpdates(_0x36c4d5,_0x231152){return function(_0x15f060){if(_0x15f060){return _0x15f060[_0xa9ae('0x33')](_0x36c4d5)['then'](function(_0x220858){return _0x220858;});}return null;};}function removeEntity(_0x4ea36a,_0x24cc1b){return function(_0x107ef8){if(_0x107ef8){return _0x107ef8[_0xa9ae('0x34')]()['then'](function(){_0x4ea36a[_0xa9ae('0x27')](0xcc)[_0xa9ae('0x28')]();});}};}function handleEntityNotFound(_0x383511,_0x22f737){return function(_0x353227){if(!_0x353227){_0x383511['sendStatus'](0x194);}return _0x353227;};}function handleError(_0xeb1639,_0xa0730a){_0xa0730a=_0xa0730a||0x1f4;return function(_0x44053a){logger['error'](_0x44053a['stack']);if(_0x44053a[_0xa9ae('0x35')]){delete _0x44053a[_0xa9ae('0x35')];}_0xeb1639[_0xa9ae('0x27')](_0xa0730a)[_0xa9ae('0x36')](_0x44053a);};}exports['index']=function(_0x356307,_0x2f5ba4){var _0x231192={},_0x9766c9={},_0x276842={'count':0x0,'rows':[]};var _0x4eafaf=_[_0xa9ae('0x37')](db['ZohoAccount'][_0xa9ae('0x38')],function(_0x38f360){return{'name':_0x38f360[_0xa9ae('0x39')],'type':_0x38f360['type'][_0xa9ae('0x3a')]};});_0x9766c9[_0xa9ae('0x3b')]=_[_0xa9ae('0x37')](_0x4eafaf,'name');_0x9766c9[_0xa9ae('0x3c')]=_[_0xa9ae('0x3d')](_0x356307['query']);_0x9766c9[_0xa9ae('0x3e')]=_['intersection'](_0x9766c9[_0xa9ae('0x3b')],_0x9766c9[_0xa9ae('0x3c')]);_0x231192['attributes']=_[_0xa9ae('0x3f')](_0x9766c9[_0xa9ae('0x3b')],qs[_0xa9ae('0x40')](_0x356307[_0xa9ae('0x3c')][_0xa9ae('0x40')]));_0x231192[_0xa9ae('0x41')]=_0x231192['attributes'][_0xa9ae('0x42')]?_0x231192[_0xa9ae('0x41')]:_0x9766c9['model'];if(!_0x356307['query'][_0xa9ae('0x43')](_0xa9ae('0x44'))){_0x231192[_0xa9ae('0x2d')]=qs[_0xa9ae('0x2d')](_0x356307['query'][_0xa9ae('0x2d')]);_0x231192[_0xa9ae('0x2a')]=qs[_0xa9ae('0x2a')](_0x356307[_0xa9ae('0x3c')][_0xa9ae('0x2a')]);}_0x231192[_0xa9ae('0x45')]=qs[_0xa9ae('0x46')](_0x356307['query'][_0xa9ae('0x46')]);_0x231192[_0xa9ae('0x47')]=qs['filters'](_[_0xa9ae('0x48')](_0x356307['query'],_0x9766c9[_0xa9ae('0x3e')]),_0x4eafaf);if(_0x356307[_0xa9ae('0x3c')][_0xa9ae('0x49')]){_0x231192[_0xa9ae('0x47')]=_[_0xa9ae('0x4a')](_0x231192[_0xa9ae('0x47')],{'$or':_[_0xa9ae('0x37')](_0x4eafaf,function(_0x4ce0ac){if(_0x4ce0ac[_0xa9ae('0x4b')]!==_0xa9ae('0x4c')){var _0x5cc0e3={};_0x5cc0e3[_0x4ce0ac[_0xa9ae('0x35')]]={'$like':'%'+_0x356307[_0xa9ae('0x3c')][_0xa9ae('0x49')]+'%'};return _0x5cc0e3;}})});}_0x231192=_[_0xa9ae('0x4a')]({},_0x231192,_0x356307[_0xa9ae('0x4d')]);var _0x76502d={'where':_0x231192['where']};return db[_0xa9ae('0x4e')]['count'](_0x76502d)[_0xa9ae('0x1e')](function(_0x44539a){_0x276842['count']=_0x44539a;if(_0x356307['query'][_0xa9ae('0x4f')]){_0x231192[_0xa9ae('0x50')]=[{'all':!![]}];}return db[_0xa9ae('0x4e')][_0xa9ae('0x51')](_0x231192);})[_0xa9ae('0x1e')](function(_0x27f19e){_0x276842[_0xa9ae('0x52')]=_0x27f19e;return _0x276842;})[_0xa9ae('0x1e')](respondWithFilteredResult(_0x2f5ba4,_0x231192))['catch'](handleError(_0x2f5ba4,null));};exports['show']=function(_0x10e02f,_0x3cf89c){var _0x4efe55={'raw':![],'where':{'id':_0x10e02f[_0xa9ae('0x53')]['id']}},_0x2aada4={};_0x2aada4[_0xa9ae('0x3b')]=_[_0xa9ae('0x3d')](db[_0xa9ae('0x4e')][_0xa9ae('0x38')]);_0x2aada4[_0xa9ae('0x3c')]=_[_0xa9ae('0x3d')](_0x10e02f['query']);_0x2aada4[_0xa9ae('0x3e')]=_[_0xa9ae('0x3f')](_0x2aada4['model'],_0x2aada4[_0xa9ae('0x3c')]);_0x4efe55['attributes']=_['intersection'](_0x2aada4['model'],qs[_0xa9ae('0x40')](_0x10e02f[_0xa9ae('0x3c')]['fields']));_0x4efe55['attributes']=_0x4efe55['attributes'][_0xa9ae('0x42')]?_0x4efe55['attributes']:_0x2aada4[_0xa9ae('0x3b')];if(_0x10e02f[_0xa9ae('0x3c')]['includeAll']){_0x4efe55[_0xa9ae('0x50')]=[{'all':!![]}];}_0x4efe55=_['merge']({},_0x4efe55,_0x10e02f[_0xa9ae('0x4d')]);return db[_0xa9ae('0x4e')][_0xa9ae('0x54')](_0x4efe55)[_0xa9ae('0x1e')](handleEntityNotFound(_0x3cf89c,null))[_0xa9ae('0x1e')](respondWithResult(_0x3cf89c,null))[_0xa9ae('0x55')](handleError(_0x3cf89c,null));};exports[_0xa9ae('0x56')]=function(_0x314a7c,_0x2fab05){return db[_0xa9ae('0x4e')][_0xa9ae('0x56')](_0x314a7c[_0xa9ae('0x57')],{})['then'](respondWithResult(_0x2fab05,0xc9))[_0xa9ae('0x55')](handleError(_0x2fab05,null));};exports[_0xa9ae('0x33')]=function(_0x24087a,_0x205c90){if(_0x24087a[_0xa9ae('0x57')]['id']){delete _0x24087a['body']['id'];}return db['ZohoAccount'][_0xa9ae('0x54')]({'where':{'id':_0x24087a[_0xa9ae('0x53')]['id']}})['then'](handleEntityNotFound(_0x205c90,null))['then'](saveUpdates(_0x24087a[_0xa9ae('0x57')],null))['then'](respondWithResult(_0x205c90,null))[_0xa9ae('0x55')](handleError(_0x205c90,null));};exports[_0xa9ae('0x34')]=function(_0x1a1605,_0x57c2e6){return db[_0xa9ae('0x4e')]['find']({'where':{'id':_0x1a1605[_0xa9ae('0x53')]['id']}})['then'](handleEntityNotFound(_0x57c2e6,null))[_0xa9ae('0x1e')](removeEntity(_0x57c2e6,null))[_0xa9ae('0x55')](handleError(_0x57c2e6,null));};exports[_0xa9ae('0x58')]=function(_0x3d4988,_0x158afa,_0x44c3cc){var _0x57971e={};var _0x3f54fa={};var _0x466f03;var _0x19f58d;return db[_0xa9ae('0x4e')]['findOne']({'where':{'id':_0x3d4988[_0xa9ae('0x53')]['id']}})[_0xa9ae('0x1e')](handleEntityNotFound(_0x158afa,null))[_0xa9ae('0x1e')](function(_0x1219fa){if(_0x1219fa){_0x466f03=_0x1219fa;_0x3f54fa[_0xa9ae('0x3b')]=_[_0xa9ae('0x3d')](db[_0xa9ae('0x59')][_0xa9ae('0x38')]);_0x3f54fa[_0xa9ae('0x3c')]=_[_0xa9ae('0x3d')](_0x3d4988['query']);_0x3f54fa[_0xa9ae('0x3e')]=_[_0xa9ae('0x3f')](_0x3f54fa[_0xa9ae('0x3b')],_0x3f54fa[_0xa9ae('0x3c')]);_0x57971e['attributes']=_[_0xa9ae('0x3f')](_0x3f54fa[_0xa9ae('0x3b')],qs['fields'](_0x3d4988[_0xa9ae('0x3c')][_0xa9ae('0x40')]));_0x57971e[_0xa9ae('0x41')]=_0x57971e['attributes']['length']?_0x57971e[_0xa9ae('0x41')]:_0x3f54fa[_0xa9ae('0x3b')];_0x57971e['order']=qs['sort'](_0x3d4988[_0xa9ae('0x3c')][_0xa9ae('0x46')]);_0x57971e[_0xa9ae('0x47')]=qs['filters'](_[_0xa9ae('0x48')](_0x3d4988[_0xa9ae('0x3c')],_0x3f54fa[_0xa9ae('0x3e')]));if(_0x3d4988[_0xa9ae('0x3c')][_0xa9ae('0x49')]){_0x57971e[_0xa9ae('0x47')]=_[_0xa9ae('0x4a')](_0x57971e[_0xa9ae('0x47')],{'$or':_[_0xa9ae('0x37')](_0x57971e[_0xa9ae('0x41')],function(_0x53445e){var _0x4acac8={};_0x4acac8[_0x53445e]={'$like':'%'+_0x3d4988[_0xa9ae('0x3c')][_0xa9ae('0x49')]+'%'};return _0x4acac8;})});}_0x57971e=_[_0xa9ae('0x4a')]({},_0x57971e,_0x3d4988['options']);return _0x466f03[_0xa9ae('0x58')](_0x57971e);}})[_0xa9ae('0x1e')](function(_0x3f823c){if(_0x3f823c){_0x19f58d=_0x3f823c['length'];if(!_0x3d4988['query'][_0xa9ae('0x43')]('nolimit')){_0x57971e[_0xa9ae('0x2d')]=qs[_0xa9ae('0x2d')](_0x3d4988[_0xa9ae('0x3c')][_0xa9ae('0x2d')]);_0x57971e[_0xa9ae('0x2a')]=qs[_0xa9ae('0x2a')](_0x3d4988[_0xa9ae('0x3c')][_0xa9ae('0x2a')]);}return _0x466f03[_0xa9ae('0x58')](_0x57971e);}})[_0xa9ae('0x1e')](function(_0x4fc3fa){if(_0x4fc3fa){return _0x4fc3fa?{'count':_0x19f58d,'rows':_0x4fc3fa}:null;}})[_0xa9ae('0x1e')](respondWithResult(_0x158afa,null))['catch'](handleError(_0x158afa,null));};exports[_0xa9ae('0x5a')]=function(_0x3bca8f,_0x255ddb,_0xe80696){if(_0x3bca8f[_0xa9ae('0x57')]['id']){delete _0x3bca8f['body']['id'];}return db[_0xa9ae('0x4e')][_0xa9ae('0x5b')]({'where':{'id':_0x3bca8f[_0xa9ae('0x53')]['id']}})[_0xa9ae('0x1e')](handleEntityNotFound(_0x255ddb,null))[_0xa9ae('0x1e')](function(_0x5c02d3){if(_0x5c02d3){_0x3bca8f[_0xa9ae('0x57')][_0xa9ae('0x5c')]=_0x5c02d3['id'];_0x3bca8f[_0xa9ae('0x57')][_0xa9ae('0x5d')]=integrations[_0xa9ae('0x5e')](_0x3bca8f['body']['channel'],_0x3bca8f[_0xa9ae('0x57')][_0xa9ae('0x4b')]);_0x3bca8f[_0xa9ae('0x57')][_0xa9ae('0x5f')]=integrations[_0xa9ae('0x60')](_0x3bca8f['body']['channel'],_0x3bca8f[_0xa9ae('0x57')][_0xa9ae('0x4b')]);return db['ZohoConfiguration']['create'](_0x3bca8f[_0xa9ae('0x57')],{'include':[{'model':db[_0xa9ae('0x61')],'as':_0xa9ae('0x5d')},{'model':db[_0xa9ae('0x61')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x255ddb,null))[_0xa9ae('0x55')](handleError(_0x255ddb,null));};function getAccessToken(_0x5275c9){return new Promise(function(_0x54294c,_0x592ff4){var _0x4b3847;switch(_0x5275c9[_0xa9ae('0x62')]){case'US':_0x4b3847=_0xa9ae('0x63');break;case'AU':_0x4b3847=_0xa9ae('0x64');break;case'EU':_0x4b3847=_0xa9ae('0x65');break;case'IN':_0x4b3847='https://accounts.zoho.in';break;case'CN':_0x4b3847=_0xa9ae('0x66');break;default:_0x4b3847=_0xa9ae('0x65');break;}var _0x4903df={'method':_0xa9ae('0x67'),'uri':_0x4b3847+'/oauth/v2/token','qs':{'refresh_token':_0x5275c9[_0xa9ae('0x68')],'client_id':_0x5275c9[_0xa9ae('0x69')],'client_secret':_0x5275c9[_0xa9ae('0x6a')],'grant_type':_0xa9ae('0x6b')},'json':!![]};return rp(_0x4903df)[_0xa9ae('0x1e')](function(_0xb66631){if(_0xb66631['access_token']){_0x54294c(_0xb66631[_0xa9ae('0x6c')]);}else{_0x592ff4(_0xa9ae('0x6d'));}})[_0xa9ae('0x55')](function(_0x11c9a8){_0x592ff4(_0x11c9a8);});});}exports[_0xa9ae('0x6e')]=function(_0x36bc83,_0x193579,_0x998cd0){var _0x5c6ae6,_0x468777,_0x2143de,_0x3dc17a,_0x190a2e;return db[_0xa9ae('0x4e')][_0xa9ae('0x5b')]({'where':{'id':_0x36bc83[_0xa9ae('0x53')]['id']},'attributes':['id',_0xa9ae('0x6f'),_0xa9ae('0x62'),_0xa9ae('0x69'),_0xa9ae('0x6a'),_0xa9ae('0x70'),_0xa9ae('0x71'),_0xa9ae('0x68')]})[_0xa9ae('0x1e')](handleEntityNotFound(_0x193579,null))[_0xa9ae('0x1e')](function(_0x2c8e7a){_0x190a2e=_0x2c8e7a;_0x5c6ae6=_0x190a2e[_0xa9ae('0x6f')];_0x468777=_0x5c6ae6===_0xa9ae('0x72')?'eu':'com';_0x2143de=_0x190a2e[_0xa9ae('0x70')];var _0x45bb2f=_0x2143de[_0xa9ae('0x73')](-0x1);if(_0x45bb2f==='/'||_0x45bb2f==='\x5c'||_0x45bb2f===':'){_0x2143de=_0x2143de[_0xa9ae('0x74')](0x0,_0x2143de[_0xa9ae('0x75')](_0x45bb2f));}if(!_0x190a2e[_0xa9ae('0x68')]){throw new Error(_0xa9ae('0x76'));}return getAccessToken(_0x190a2e);})[_0xa9ae('0x1e')](function(_0x383397){if(_0x383397){return rp({'method':'GET','uri':util[_0xa9ae('0x77')](_0xa9ae('0x78'),_0x468777),'qs':{'module':_0xa9ae('0x79')},'headers':{'Authorization':_0xa9ae('0x7a')+_0x383397},'json':!![]});}})[_0xa9ae('0x1e')](function(_0x49595d){if(_0x49595d){if(_0x49595d['response']&&_0x49595d[_0xa9ae('0x7b')][_0xa9ae('0x24')]){throw new Error(_0x49595d['response'][_0xa9ae('0x24')][_0xa9ae('0x25')]);}var _0x2751f4=[];var _0x43ce6c=[];var _0x418ace=[_0xa9ae('0x7c'),'Subject',_0xa9ae('0x7d'),_0xa9ae('0x7e'),_0xa9ae('0x7f'),_0xa9ae('0x80'),_0xa9ae('0x81'),'Call_Type'];_0x43ce6c=_[_0xa9ae('0x82')](_0x49595d['fields'],function(_0x1bcf51){return _0x418ace['includes'](_0x1bcf51[_0xa9ae('0x83')]);});for(var _0x12cc91=0x0;_0x12cc91<_0x43ce6c['length'];_0x12cc91++){if(_0x43ce6c[_0x12cc91]['system_mandatory']===![]){_0x2751f4[_0xa9ae('0x84')]({'id':_0x43ce6c[_0x12cc91]['id'],'name':_0x43ce6c[_0x12cc91][_0xa9ae('0x85')],'custom':_0x43ce6c[_0x12cc91][_0xa9ae('0x86')],'options':_0x43ce6c[_0x12cc91][_0xa9ae('0x87')]===_0xa9ae('0x88')&&_0x43ce6c[_0x12cc91][_0xa9ae('0x89')][_0xa9ae('0x42')]>-0x1?_['map'](_0x43ce6c[_0x12cc91][_0xa9ae('0x89')],function(_0x49fd54){return{'name':_0x49fd54,'value':_0x49fd54};}):[]});}}return{'count':_0x2751f4[_0xa9ae('0x42')],'rows':_0x2751f4};}else{return{'count':0x0,'rows':[]};}})[_0xa9ae('0x1e')](respondWithResult(_0x193579,null))['catch'](function(_0x4968f8){var _0x43d82d=_0x36bc83[_0xa9ae('0x3c')][_0xa9ae('0x8a')]?0x1f4:_0x4968f8[_0xa9ae('0x8b')]||0x1f4;logger[_0xa9ae('0x24')](_0xa9ae('0x8c'),_0xa9ae('0x6e'),_0x43d82d,JSON['stringify'](_0x4968f8));delete _0x4968f8[_0xa9ae('0x35')];if(_0x43d82d===0x191){_0x43d82d=0x190;}_0x193579[_0xa9ae('0x27')](_0x43d82d)['send'](_0x36bc83[_0xa9ae('0x3c')][_0xa9ae('0x8a')]?{'message':'Wrong\x20credentials','statusCode':_0x4968f8[_0xa9ae('0x8b')]}:_0x4968f8);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index d6611e4..3bcee22 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 _0x7048=['code','host','slice','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','then','parse','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','POST','refresh_token','info','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','serverUrl','clientId'];(function(_0x572568,_0x3bcd62){var _0x53d315=function(_0x33564d){while(--_0x33564d){_0x572568['push'](_0x572568['shift']());}};_0x53d315(++_0x3bcd62);}(_0x7048,0x1bf));var _0x8704=function(_0x1ad43c,_0x60033f){_0x1ad43c=_0x1ad43c-0x0;var _0x2833f6=_0x7048[_0x1ad43c];return _0x2833f6;};'use strict';var _=require(_0x8704('0x0'));var util=require(_0x8704('0x1'));var logger=require(_0x8704('0x2'))(_0x8704('0x3'));var moment=require(_0x8704('0x4'));var BPromise=require(_0x8704('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8704('0x6'));var config=require(_0x8704('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x8704('0x8'));module[_0x8704('0x9')]=function(_0x407463,_0x4dded7){return _0x407463[_0x8704('0xa')]('ZohoAccount',attributes,{'tableName':_0x8704('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x459f1c,_0x121290,_0x5a632d){if(_0x459f1c[_0x8704('0xc')]('zone')||_0x459f1c[_0x8704('0xc')](_0x8704('0xd'))||_0x459f1c['changed'](_0x8704('0xe'))||_0x459f1c[_0x8704('0xc')]('clientSecret')||_0x459f1c['changed'](_0x8704('0xf'))||_0x459f1c[_0x8704('0xc')](_0x8704('0x10'))){var _0x3cb791,_0x2ad991;_0x3cb791=_0x459f1c[_0x8704('0xd')];var _0x48759b=_0x3cb791[_0x8704('0x11')](-0x1);if(_0x48759b==='/'||_0x48759b==='\x5c'||_0x48759b===':'){_0x3cb791=_0x3cb791[_0x8704('0x12')](0x0,_0x3cb791[_0x8704('0x13')](_0x48759b));}switch(_0x459f1c[_0x8704('0x14')]){case'US':_0x2ad991=_0x8704('0x15');break;case'AU':_0x2ad991='https://accounts.zoho.com.au';break;case'IN':_0x2ad991=_0x8704('0x16');break;case'CN':_0x2ad991=_0x8704('0x17');break;default:_0x2ad991=_0x8704('0x18');break;}var _0x3a50dc={'method':'POST','uri':_0x2ad991+_0x8704('0x19'),'form':{'grant_type':_0x8704('0x1a'),'client_id':_0x459f1c['clientId'],'client_secret':_0x459f1c[_0x8704('0x1b')],'redirect_uri':_0x459f1c[_0x8704('0xd')],'code':_0x459f1c[_0x8704('0xf')]},'headers':{'Content-Type':_0x8704('0x1c')}};return rp(_0x3a50dc)[_0x8704('0x1d')](function(_0x392f07){var _0x498bfa=JSON[_0x8704('0x1e')](_0x392f07);if(_0x498bfa['refresh_token']){_0x459f1c[_0x8704('0x1f')]=_0x498bfa['refresh_token'];logger['info'](util[_0x8704('0x20')](_0x8704('0x21'),_0x459f1c['name'],_0x459f1c['id']));}else{logger[_0x8704('0x22')](util[_0x8704('0x20')](_0x8704('0x23'),_0x459f1c[_0x8704('0x24')],_0x459f1c['id']),util[_0x8704('0x25')](_0x498bfa,{'showHidden':![],'depth':null}));}return _0x5a632d(null,_0x121290);})[_0x8704('0x26')](function(_0x4adf10){logger[_0x8704('0x22')](util[_0x8704('0x20')](_0x8704('0x23'),_0x459f1c[_0x8704('0x24')],_0x459f1c['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x5a632d(_0x4adf10);});}else{return _0x5a632d(null,_0x121290);}},'beforeUpdate':function(_0x5476db,_0x3de074,_0x4def36){if(_0x5476db['changed'](_0x8704('0x14'))||_0x5476db[_0x8704('0xc')](_0x8704('0xd'))||_0x5476db[_0x8704('0xc')](_0x8704('0xe'))||_0x5476db[_0x8704('0xc')](_0x8704('0x1b'))||_0x5476db['changed'](_0x8704('0xf'))||_0x5476db['changed'](_0x8704('0x10'))){var _0x1432d3,_0x1888a5;_0x1432d3=_0x5476db[_0x8704('0xd')];var _0x5c6f8d=_0x1432d3[_0x8704('0x11')](-0x1);if(_0x5c6f8d==='/'||_0x5c6f8d==='\x5c'||_0x5c6f8d===':'){_0x1432d3=_0x1432d3[_0x8704('0x12')](0x0,_0x1432d3[_0x8704('0x13')](_0x5c6f8d));}switch(_0x5476db[_0x8704('0x14')]){case'US':_0x1888a5='https://accounts.zoho.com';break;case'AU':_0x1888a5='https://accounts.zoho.com.au';break;case'IN':_0x1888a5=_0x8704('0x16');break;case'CN':_0x1888a5=_0x8704('0x17');break;default:_0x1888a5=_0x8704('0x18');break;}var _0x4ee659={'method':_0x8704('0x27'),'uri':_0x1888a5+_0x8704('0x19'),'form':{'grant_type':_0x8704('0x1a'),'client_id':_0x5476db['clientId'],'client_secret':_0x5476db['clientSecret'],'redirect_uri':_0x5476db[_0x8704('0xd')],'code':_0x5476db['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4ee659)[_0x8704('0x1d')](function(_0x8f016b){var _0x138d33=JSON[_0x8704('0x1e')](_0x8f016b);if(_0x138d33[_0x8704('0x28')]){_0x5476db['refreshToken']=_0x138d33[_0x8704('0x28')];logger[_0x8704('0x29')](util[_0x8704('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5476db[_0x8704('0x24')],_0x5476db['id']));}else{logger[_0x8704('0x22')](util[_0x8704('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5476db['name'],_0x5476db['id']),util[_0x8704('0x25')](_0x138d33,{'showHidden':![],'depth':null}));}return _0x4def36(null,_0x3de074);})[_0x8704('0x26')](function(_0x1ab049){logger[_0x8704('0x22')](util[_0x8704('0x20')](_0x8704('0x23'),_0x5476db[_0x8704('0x24')],_0x5476db['id']),util[_0x8704('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x4def36(_0x1ab049);});}else{return _0x4def36(null,_0x3de074);}}}});}; \ No newline at end of file +var _0x0671=['https://accounts.zoho.in','https://accounts.zoho.eu','POST','authorization_code','clientId','application/x-www-form-urlencoded','parse','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','host','substring','/oauth/v2/token','then','refreshToken','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','changed','serverUrl','clientSecret','code','slice','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0671,0x13b));var _0x1067=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0x0671[_0x2405bc];return _0x5272d4;};'use strict';var _=require(_0x1067('0x0'));var util=require(_0x1067('0x1'));var logger=require(_0x1067('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1067('0x3'));var rp=require(_0x1067('0x4'));var fs=require('fs');var path=require(_0x1067('0x5'));var rimraf=require(_0x1067('0x6'));var config=require(_0x1067('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x1067('0x8'));module[_0x1067('0x9')]=function(_0x37b6b1,_0x56b865){return _0x37b6b1[_0x1067('0xa')](_0x1067('0xb'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x970813,_0x1d888f,_0x3b3f59){if(_0x970813[_0x1067('0xc')]('zone')||_0x970813['changed'](_0x1067('0xd'))||_0x970813[_0x1067('0xc')]('clientId')||_0x970813[_0x1067('0xc')](_0x1067('0xe'))||_0x970813[_0x1067('0xc')](_0x1067('0xf'))||_0x970813[_0x1067('0xc')]('host')){var _0x6c1e69,_0x23b6ac;_0x6c1e69=_0x970813[_0x1067('0xd')];var _0x373ca7=_0x6c1e69[_0x1067('0x10')](-0x1);if(_0x373ca7==='/'||_0x373ca7==='\x5c'||_0x373ca7===':'){_0x6c1e69=_0x6c1e69['substring'](0x0,_0x6c1e69[_0x1067('0x11')](_0x373ca7));}switch(_0x970813[_0x1067('0x12')]){case'US':_0x23b6ac=_0x1067('0x13');break;case'AU':_0x23b6ac=_0x1067('0x14');break;case'IN':_0x23b6ac=_0x1067('0x15');break;case'CN':_0x23b6ac='https://accounts.zoho.com.cn';break;default:_0x23b6ac=_0x1067('0x16');break;}var _0x49c37d={'method':_0x1067('0x17'),'uri':_0x23b6ac+'/oauth/v2/token','form':{'grant_type':_0x1067('0x18'),'client_id':_0x970813[_0x1067('0x19')],'client_secret':_0x970813['clientSecret'],'redirect_uri':_0x970813[_0x1067('0xd')],'code':_0x970813[_0x1067('0xf')]},'headers':{'Content-Type':_0x1067('0x1a')}};return rp(_0x49c37d)['then'](function(_0x4e179a){var _0x99ddfe=JSON[_0x1067('0x1b')](_0x4e179a);if(_0x99ddfe[_0x1067('0x1c')]){_0x970813['refreshToken']=_0x99ddfe[_0x1067('0x1c')];logger[_0x1067('0x1d')](util['format'](_0x1067('0x1e'),_0x970813[_0x1067('0x1f')],_0x970813['id']));}else{logger[_0x1067('0x20')](util[_0x1067('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x970813[_0x1067('0x1f')],_0x970813['id']),util[_0x1067('0x22')](_0x99ddfe,{'showHidden':![],'depth':null}));}return _0x3b3f59(null,_0x1d888f);})[_0x1067('0x23')](function(_0x489e10){logger['error'](util[_0x1067('0x21')](_0x1067('0x24'),_0x970813[_0x1067('0x1f')],_0x970813['id']),util[_0x1067('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x3b3f59(_0x489e10);});}else{return _0x3b3f59(null,_0x1d888f);}},'beforeUpdate':function(_0x11c9c4,_0x24d2e7,_0x3a0db7){if(_0x11c9c4[_0x1067('0xc')]('zone')||_0x11c9c4[_0x1067('0xc')]('serverUrl')||_0x11c9c4[_0x1067('0xc')](_0x1067('0x19'))||_0x11c9c4['changed'](_0x1067('0xe'))||_0x11c9c4[_0x1067('0xc')]('code')||_0x11c9c4[_0x1067('0xc')](_0x1067('0x25'))){var _0xecbe49,_0x593699;_0xecbe49=_0x11c9c4[_0x1067('0xd')];var _0x147ab1=_0xecbe49[_0x1067('0x10')](-0x1);if(_0x147ab1==='/'||_0x147ab1==='\x5c'||_0x147ab1===':'){_0xecbe49=_0xecbe49[_0x1067('0x26')](0x0,_0xecbe49[_0x1067('0x11')](_0x147ab1));}switch(_0x11c9c4[_0x1067('0x12')]){case'US':_0x593699=_0x1067('0x13');break;case'AU':_0x593699='https://accounts.zoho.com.au';break;case'IN':_0x593699='https://accounts.zoho.in';break;case'CN':_0x593699='https://accounts.zoho.com.cn';break;default:_0x593699=_0x1067('0x16');break;}var _0x7cc590={'method':_0x1067('0x17'),'uri':_0x593699+_0x1067('0x27'),'form':{'grant_type':_0x1067('0x18'),'client_id':_0x11c9c4[_0x1067('0x19')],'client_secret':_0x11c9c4[_0x1067('0xe')],'redirect_uri':_0x11c9c4[_0x1067('0xd')],'code':_0x11c9c4[_0x1067('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x7cc590)[_0x1067('0x28')](function(_0x41a8bb){var _0x4a562d=JSON[_0x1067('0x1b')](_0x41a8bb);if(_0x4a562d['refresh_token']){_0x11c9c4[_0x1067('0x29')]=_0x4a562d[_0x1067('0x1c')];logger[_0x1067('0x1d')](util['format'](_0x1067('0x1e'),_0x11c9c4[_0x1067('0x1f')],_0x11c9c4['id']));}else{logger['error'](util[_0x1067('0x21')](_0x1067('0x24'),_0x11c9c4[_0x1067('0x1f')],_0x11c9c4['id']),util[_0x1067('0x22')](_0x4a562d,{'showHidden':![],'depth':null}));}return _0x3a0db7(null,_0x24d2e7);})[_0x1067('0x23')](function(_0x37f729){logger[_0x1067('0x20')](util[_0x1067('0x21')](_0x1067('0x24'),_0x11c9c4[_0x1067('0x1f')],_0x11c9c4['id']),util[_0x1067('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x3a0db7(_0x37f729);});}else{return _0x3a0db7(null,_0x24d2e7);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 9cfbf44..3814490 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 _0xb78c=['client','request','then','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','info','result','catch','GetZohoAccount','ZohoAccount','options','raw','where','attributes','limit','include','map','model','ShowZohoAccount','find','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x530cb6,_0x2bb010){var _0x10195e=function(_0xe80657){while(--_0xe80657){_0x530cb6['push'](_0x530cb6['shift']());}};_0x10195e(++_0x2bb010);}(_0xb78c,0x19a));var _0xcb78=function(_0x31b2a5,_0x2480b4){_0x31b2a5=_0x31b2a5-0x0;var _0x198fa4=_0xb78c[_0x31b2a5];return _0x198fa4;};'use strict';var _=require(_0xcb78('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb78('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcb78('0x2'))(_0xcb78('0x3'));var config=require(_0xcb78('0x4'));var jayson=require(_0xcb78('0x5'));var client=jayson[_0xcb78('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42b3ae,_0x4b548a,_0x3a721c){return new BPromise(function(_0xa86cee,_0x5253d3){return client[_0xcb78('0x7')](_0x42b3ae,_0x3a721c)[_0xcb78('0x8')](function(_0x2d78e9){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x4b548a,_0xcb78('0x9'));logger[_0xcb78('0xa')](_0xcb78('0xb'),_0x4b548a,_0xcb78('0x9'),JSON[_0xcb78('0xc')](_0x2d78e9));if(_0x2d78e9[_0xcb78('0xd')]){if(_0x2d78e9[_0xcb78('0xd')][_0xcb78('0xe')]===0x1f4){logger['error'](_0xcb78('0xf'),_0x4b548a,_0x2d78e9['error']['message']);return _0x5253d3(_0x2d78e9['error'][_0xcb78('0x10')]);}logger[_0xcb78('0xd')](_0xcb78('0xf'),_0x4b548a,_0x2d78e9[_0xcb78('0xd')][_0xcb78('0x10')]);return _0xa86cee(_0x2d78e9[_0xcb78('0xd')][_0xcb78('0x10')]);}else{logger[_0xcb78('0x11')](_0xcb78('0xf'),_0x4b548a,_0xcb78('0x9'));_0xa86cee(_0x2d78e9[_0xcb78('0x12')][_0xcb78('0x10')]);}})[_0xcb78('0x13')](function(_0x3f068e){logger[_0xcb78('0xd')](_0xcb78('0xf'),_0x4b548a,_0x3f068e);_0x5253d3(_0x3f068e);});});}exports[_0xcb78('0x14')]=function(_0x2aeb52){var _0x26ad79=this;return new Promise(function(_0x3b3c48,_0x616e3f){return db[_0xcb78('0x15')]['findAll']({'raw':_0x2aeb52[_0xcb78('0x16')]?_0x2aeb52[_0xcb78('0x16')][_0xcb78('0x17')]===undefined?!![]:![]:!![],'where':_0x2aeb52[_0xcb78('0x16')]?_0x2aeb52[_0xcb78('0x16')][_0xcb78('0x18')]||null:null,'attributes':_0x2aeb52[_0xcb78('0x16')]?_0x2aeb52[_0xcb78('0x16')][_0xcb78('0x19')]||null:null,'limit':_0x2aeb52[_0xcb78('0x16')]?_0x2aeb52[_0xcb78('0x16')][_0xcb78('0x1a')]||null:null,'include':_0x2aeb52[_0xcb78('0x16')]?_0x2aeb52['options'][_0xcb78('0x1b')]?_[_0xcb78('0x1c')](_0x2aeb52['options'][_0xcb78('0x1b')],function(_0x3dafb5){return{'model':db[_0x3dafb5['model']],'as':_0x3dafb5['as'],'attributes':_0x3dafb5[_0xcb78('0x19')],'include':_0x3dafb5[_0xcb78('0x1b')]?_[_0xcb78('0x1c')](_0x3dafb5[_0xcb78('0x1b')],function(_0x24b26d){return{'model':db[_0x24b26d['model']],'as':_0x24b26d['as'],'attributes':_0x24b26d[_0xcb78('0x19')],'include':_0x24b26d[_0xcb78('0x1b')]?_[_0xcb78('0x1c')](_0x24b26d[_0xcb78('0x1b')],function(_0x179ecd){return{'model':db[_0x179ecd[_0xcb78('0x1d')]],'as':_0x179ecd['as'],'attributes':_0x179ecd['attributes']};}):[]};}):[]};}):[]:[]})[_0xcb78('0x8')](function(_0x273037){logger['info'](_0xcb78('0x14'),_0x2aeb52);logger['debug'](_0xcb78('0x14'),_0x2aeb52,JSON[_0xcb78('0xc')](_0x273037));_0x3b3c48(_0x273037);})[_0xcb78('0x13')](function(_0x2cb91c){logger[_0xcb78('0xd')](_0xcb78('0x14'),_0x2cb91c[_0xcb78('0x10')],_0x2aeb52);_0x616e3f(_0x26ad79[_0xcb78('0xd')](0x1f4,_0x2cb91c[_0xcb78('0x10')]));});});};exports[_0xcb78('0x1e')]=function(_0x437e46){var _0x357da5=this;return new Promise(function(_0x1970b3,_0x23dcff){return db[_0xcb78('0x15')][_0xcb78('0x1f')]({'raw':_0x437e46['options']?_0x437e46[_0xcb78('0x16')][_0xcb78('0x17')]===undefined?!![]:![]:!![],'where':_0x437e46[_0xcb78('0x16')]?_0x437e46['options']['where']||null:null,'attributes':_0x437e46[_0xcb78('0x16')]?_0x437e46[_0xcb78('0x16')]['attributes']||null:null,'include':_0x437e46[_0xcb78('0x16')]?_0x437e46[_0xcb78('0x16')][_0xcb78('0x1b')]?_[_0xcb78('0x1c')](_0x437e46[_0xcb78('0x16')][_0xcb78('0x1b')],function(_0x1bea2b){return{'model':db[_0x1bea2b[_0xcb78('0x1d')]],'as':_0x1bea2b['as'],'attributes':_0x1bea2b[_0xcb78('0x19')],'include':_0x1bea2b[_0xcb78('0x1b')]?_[_0xcb78('0x1c')](_0x1bea2b[_0xcb78('0x1b')],function(_0x2a3348){return{'model':db[_0x2a3348['model']],'as':_0x2a3348['as'],'attributes':_0x2a3348[_0xcb78('0x19')],'include':_0x2a3348[_0xcb78('0x1b')]?_[_0xcb78('0x1c')](_0x2a3348[_0xcb78('0x1b')],function(_0x3970ff){return{'model':db[_0x3970ff['model']],'as':_0x3970ff['as'],'attributes':_0x3970ff[_0xcb78('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27822d){logger[_0xcb78('0x11')](_0xcb78('0x1e'),_0x437e46);logger[_0xcb78('0xa')](_0xcb78('0x1e'),_0x437e46,JSON[_0xcb78('0xc')](_0x27822d));_0x1970b3(_0x27822d);})[_0xcb78('0x13')](function(_0x8529bd){logger['error'](_0xcb78('0x1e'),_0x8529bd['message'],_0x437e46);_0x23dcff(_0x357da5[_0xcb78('0xd')](0x1f4,_0x8529bd[_0xcb78('0x10')]));});});}; \ No newline at end of file +var _0x9ba8=['client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetZohoAccount','ZohoAccount','options','attributes','include','map','model','ShowZohoAccount','find','raw','where','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x16311c,_0x550fd7){var _0x33951d=function(_0x453500){while(--_0x453500){_0x16311c['push'](_0x16311c['shift']());}};_0x33951d(++_0x550fd7);}(_0x9ba8,0x78));var _0x89ba=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x9ba8[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0x89ba('0x0'));var util=require(_0x89ba('0x1'));var moment=require('moment');var BPromise=require(_0x89ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89ba('0x3'));var db=require(_0x89ba('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x89ba('0x5'))(_0x89ba('0x6'));var config=require('../../config/environment');var jayson=require(_0x89ba('0x7'));var client=jayson[_0x89ba('0x8')][_0x89ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2466b8,_0x467222,_0x242a07){return new BPromise(function(_0x5f0b4c,_0x23464d){return client['request'](_0x2466b8,_0x242a07)[_0x89ba('0xa')](function(_0x1872b5){logger[_0x89ba('0xb')](_0x89ba('0xc'),_0x467222,_0x89ba('0xd'));logger[_0x89ba('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x467222,_0x89ba('0xd'),JSON['stringify'](_0x1872b5));if(_0x1872b5[_0x89ba('0xf')]){if(_0x1872b5[_0x89ba('0xf')][_0x89ba('0x10')]===0x1f4){logger[_0x89ba('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x467222,_0x1872b5[_0x89ba('0xf')][_0x89ba('0x11')]);return _0x23464d(_0x1872b5[_0x89ba('0xf')][_0x89ba('0x11')]);}logger[_0x89ba('0xf')](_0x89ba('0xc'),_0x467222,_0x1872b5[_0x89ba('0xf')][_0x89ba('0x11')]);return _0x5f0b4c(_0x1872b5[_0x89ba('0xf')][_0x89ba('0x11')]);}else{logger[_0x89ba('0xb')](_0x89ba('0xc'),_0x467222,_0x89ba('0xd'));_0x5f0b4c(_0x1872b5[_0x89ba('0x12')][_0x89ba('0x11')]);}})[_0x89ba('0x13')](function(_0x4af2ec){logger[_0x89ba('0xf')](_0x89ba('0xc'),_0x467222,_0x4af2ec);_0x23464d(_0x4af2ec);});});}exports[_0x89ba('0x14')]=function(_0x12984c){var _0x45a225=this;return new Promise(function(_0x3c510c,_0x1db985){return db[_0x89ba('0x15')]['findAll']({'raw':_0x12984c[_0x89ba('0x16')]?_0x12984c[_0x89ba('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x12984c[_0x89ba('0x16')]?_0x12984c[_0x89ba('0x16')]['where']||null:null,'attributes':_0x12984c[_0x89ba('0x16')]?_0x12984c[_0x89ba('0x16')][_0x89ba('0x17')]||null:null,'limit':_0x12984c['options']?_0x12984c['options']['limit']||null:null,'include':_0x12984c[_0x89ba('0x16')]?_0x12984c[_0x89ba('0x16')][_0x89ba('0x18')]?_[_0x89ba('0x19')](_0x12984c[_0x89ba('0x16')]['include'],function(_0x365944){return{'model':db[_0x365944[_0x89ba('0x1a')]],'as':_0x365944['as'],'attributes':_0x365944[_0x89ba('0x17')],'include':_0x365944['include']?_[_0x89ba('0x19')](_0x365944['include'],function(_0x469ece){return{'model':db[_0x469ece[_0x89ba('0x1a')]],'as':_0x469ece['as'],'attributes':_0x469ece[_0x89ba('0x17')],'include':_0x469ece[_0x89ba('0x18')]?_[_0x89ba('0x19')](_0x469ece[_0x89ba('0x18')],function(_0x188cdf){return{'model':db[_0x188cdf['model']],'as':_0x188cdf['as'],'attributes':_0x188cdf['attributes']};}):[]};}):[]};}):[]:[]})[_0x89ba('0xa')](function(_0x486c33){logger[_0x89ba('0xb')](_0x89ba('0x14'),_0x12984c);logger['debug'](_0x89ba('0x14'),_0x12984c,JSON['stringify'](_0x486c33));_0x3c510c(_0x486c33);})[_0x89ba('0x13')](function(_0x277184){logger[_0x89ba('0xf')](_0x89ba('0x14'),_0x277184['message'],_0x12984c);_0x1db985(_0x45a225[_0x89ba('0xf')](0x1f4,_0x277184[_0x89ba('0x11')]));});});};exports[_0x89ba('0x1b')]=function(_0x18b141){var _0x350740=this;return new Promise(function(_0x3fe50c,_0x333015){return db[_0x89ba('0x15')][_0x89ba('0x1c')]({'raw':_0x18b141[_0x89ba('0x16')]?_0x18b141['options'][_0x89ba('0x1d')]===undefined?!![]:![]:!![],'where':_0x18b141[_0x89ba('0x16')]?_0x18b141[_0x89ba('0x16')][_0x89ba('0x1e')]||null:null,'attributes':_0x18b141[_0x89ba('0x16')]?_0x18b141[_0x89ba('0x16')][_0x89ba('0x17')]||null:null,'include':_0x18b141[_0x89ba('0x16')]?_0x18b141['options'][_0x89ba('0x18')]?_[_0x89ba('0x19')](_0x18b141[_0x89ba('0x16')]['include'],function(_0x367a24){return{'model':db[_0x367a24[_0x89ba('0x1a')]],'as':_0x367a24['as'],'attributes':_0x367a24[_0x89ba('0x17')],'include':_0x367a24[_0x89ba('0x18')]?_[_0x89ba('0x19')](_0x367a24[_0x89ba('0x18')],function(_0x2fb014){return{'model':db[_0x2fb014['model']],'as':_0x2fb014['as'],'attributes':_0x2fb014['attributes'],'include':_0x2fb014[_0x89ba('0x18')]?_['map'](_0x2fb014[_0x89ba('0x18')],function(_0x4339eb){return{'model':db[_0x4339eb[_0x89ba('0x1a')]],'as':_0x4339eb['as'],'attributes':_0x4339eb[_0x89ba('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf74609){logger[_0x89ba('0xb')](_0x89ba('0x1b'),_0x18b141);logger[_0x89ba('0xe')](_0x89ba('0x1b'),_0x18b141,JSON[_0x89ba('0x1f')](_0xf74609));_0x3fe50c(_0xf74609);})['catch'](function(_0x28cba7){logger['error'](_0x89ba('0x1b'),_0x28cba7[_0x89ba('0x11')],_0x18b141);_0x333015(_0x350740[_0x89ba('0xf')](0x1f4,_0x28cba7[_0x89ba('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index acc4bdb..57789a0 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 _0x5a88=['/:id/descriptions','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects'];(function(_0x4659b7,_0x228e8a){var _0x289c1c=function(_0x415cf5){while(--_0x415cf5){_0x4659b7['push'](_0x4659b7['shift']());}};_0x289c1c(++_0x228e8a);}(_0x5a88,0x106));var _0x85a8=function(_0x1c1019,_0x363682){_0x1c1019=_0x1c1019-0x0;var _0x26d200=_0x5a88[_0x1c1019];return _0x26d200;};'use strict';var multer=require('multer');var util=require(_0x85a8('0x0'));var path=require(_0x85a8('0x1'));var timeout=require(_0x85a8('0x2'));var express=require(_0x85a8('0x3'));var router=express[_0x85a8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x85a8('0x5'));var config=require(_0x85a8('0x6'));var controller=require(_0x85a8('0x7'));router[_0x85a8('0x8')]('/',auth[_0x85a8('0x9')](),controller['index']);router[_0x85a8('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x85a8('0xa')]);router[_0x85a8('0x8')](_0x85a8('0xb'),auth[_0x85a8('0x9')](),controller[_0x85a8('0xc')]);router[_0x85a8('0x8')](_0x85a8('0xd'),auth[_0x85a8('0x9')](),controller['getSubjects']);router['get'](_0x85a8('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x85a8('0xf')]('/',auth['isAuthenticated'](),controller[_0x85a8('0x10')]);router[_0x85a8('0x11')](_0x85a8('0x12'),auth[_0x85a8('0x9')](),controller[_0x85a8('0x13')]);router[_0x85a8('0x14')](_0x85a8('0x12'),auth[_0x85a8('0x9')](),controller[_0x85a8('0x15')]);module[_0x85a8('0x16')]=router; \ No newline at end of file +var _0x5d90=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','update','destroy','exports','util'];(function(_0x3a441a,_0x43eb56){var _0x3128a2=function(_0x5d5a17){while(--_0x5d5a17){_0x3a441a['push'](_0x3a441a['shift']());}};_0x3128a2(++_0x43eb56);}(_0x5d90,0xdb));var _0x05d9=function(_0x1802a6,_0x23bce6){_0x1802a6=_0x1802a6-0x0;var _0x238a1a=_0x5d90[_0x1802a6];return _0x238a1a;};'use strict';var multer=require('multer');var util=require(_0x05d9('0x0'));var path=require(_0x05d9('0x1'));var timeout=require(_0x05d9('0x2'));var express=require('express');var router=express[_0x05d9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x05d9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x05d9('0x5'));var controller=require(_0x05d9('0x6'));router[_0x05d9('0x7')]('/',auth['isAuthenticated'](),controller[_0x05d9('0x8')]);router[_0x05d9('0x7')](_0x05d9('0x9'),auth[_0x05d9('0xa')](),controller[_0x05d9('0xb')]);router[_0x05d9('0x7')](_0x05d9('0xc'),auth[_0x05d9('0xa')](),controller[_0x05d9('0xd')]);router[_0x05d9('0x7')](_0x05d9('0xe'),auth[_0x05d9('0xa')](),controller[_0x05d9('0xf')]);router['get'](_0x05d9('0x10'),auth[_0x05d9('0xa')](),controller[_0x05d9('0x11')]);router[_0x05d9('0x12')]('/',auth[_0x05d9('0xa')](),controller['create']);router['put'](_0x05d9('0x9'),auth[_0x05d9('0xa')](),controller[_0x05d9('0x13')]);router['delete'](_0x05d9('0x9'),auth[_0x05d9('0xa')](),controller[_0x05d9('0x14')]);module[_0x05d9('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index aa72112..b830431 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 _0x4c8e=['exports','lead','contact','nothing','ENUM','contact_lead','sequelize'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4c8e,0x1b8));var _0xe4c8=function(_0x708c47,_0x6eaa1f){_0x708c47=_0x708c47-0x0;var _0x52a470=_0x4c8e[_0x708c47];return _0x52a470;};'use strict';var Sequelize=require(_0xe4c8('0x0'));module[_0xe4c8('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0xe4c8('0x2'),_0xe4c8('0x3'),_0xe4c8('0x4')),'defaultValue':_0xe4c8('0x2')},'moduleSearch':{'type':Sequelize[_0xe4c8('0x5')](_0xe4c8('0x6'),'contact',_0xe4c8('0x2')),'defaultValue':_0xe4c8('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa40e=['STRING','ENUM','contact','lead','contact_lead','sequelize','exports'];(function(_0x24f4cd,_0x1ce85a){var _0x40be68=function(_0x49d910){while(--_0x49d910){_0x24f4cd['push'](_0x24f4cd['shift']());}};_0x40be68(++_0x1ce85a);}(_0xa40e,0x1e8));var _0xea40=function(_0x5c224b,_0x382967){_0x5c224b=_0x5c224b-0x0;var _0x2f1868=_0xa40e[_0x5c224b];return _0x2f1868;};'use strict';var Sequelize=require(_0xea40('0x0'));module[_0xea40('0x1')]={'name':{'type':Sequelize[_0xea40('0x2')]},'moduleCreate':{'type':Sequelize[_0xea40('0x3')]('lead',_0xea40('0x4'),'nothing'),'defaultValue':_0xea40('0x5')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xea40('0x4'),'lead'),'defaultValue':_0xea40('0x6')},'description':{'type':Sequelize[_0xea40('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index fd4c43d..5128129 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 _0x032e=['fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','include','rows','show','params','includeAll','find','create','body','findOne','ZohoField','length','order','getFields','getSubjects','getDescriptions','eml-format','zip-dir'];(function(_0xc5438b,_0x28002f){var _0x4977ca=function(_0xa041f5){while(--_0xa041f5){_0xc5438b['push'](_0xc5438b['shift']());}};_0x4977ca(++_0x28002f);}(_0x032e,0x124));var _0xe032=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x032e[_0x24237f];return _0x48298e;};'use strict';var emlformat=require(_0xe032('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe032('0x1'));var jsonpatch=require(_0xe032('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe032('0x3'));var Mustache=require(_0xe032('0x4'));var util=require(_0xe032('0x5'));var path=require(_0xe032('0x6'));var sox=require(_0xe032('0x7'));var csv=require(_0xe032('0x8'));var ejs=require(_0xe032('0x9'));var fs=require('fs');var fs_extra=require(_0xe032('0xa'));var _=require(_0xe032('0xb'));var squel=require(_0xe032('0xc'));var crypto=require(_0xe032('0xd'));var jsforce=require(_0xe032('0xe'));var deskjs=require(_0xe032('0xf'));var toCsv=require(_0xe032('0x8'));var querystring=require(_0xe032('0x10'));var Papa=require(_0xe032('0x11'));var Redis=require(_0xe032('0x12'));var authService=require(_0xe032('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe032('0x14'));var hardwareService=require(_0xe032('0x15'));var logger=require(_0xe032('0x16'))(_0xe032('0x17'));var utils=require(_0xe032('0x18'));var config=require(_0xe032('0x19'));var licenseUtil=require(_0xe032('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0xe032('0x1b'));var client=jayson[_0xe032('0x1c')][_0xe032('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1a53ab,_0x4aee44,_0x311592,_0x2e267b){return new BPromise(function(_0x176547,_0x422e96){var _0x17b3aa=_0x2e267b||client;return _0x17b3aa[_0xe032('0x1e')](_0x1a53ab,_0x311592)[_0xe032('0x1f')](function(_0x4da5b7){logger[_0xe032('0x20')](_0xe032('0x21'),_0x4aee44,_0xe032('0x22'));logger[_0xe032('0x23')](_0xe032('0x24'),_0x4aee44,_0xe032('0x22'),JSON['stringify'](_0x4da5b7));if(_0x4da5b7[_0xe032('0x25')]){if(_0x4da5b7[_0xe032('0x25')][_0xe032('0x26')]===0x1f4){logger[_0xe032('0x25')](_0xe032('0x21'),_0x4aee44,_0x4da5b7['error']['message']);return _0x422e96(_0x4da5b7['error'][_0xe032('0x27')]);}logger['error'](_0xe032('0x21'),_0x4aee44,_0x4da5b7[_0xe032('0x25')][_0xe032('0x27')]);return _0x176547(_0x4da5b7[_0xe032('0x25')][_0xe032('0x27')]);}else{logger[_0xe032('0x20')](_0xe032('0x21'),_0x4aee44,'request\x20sent');_0x176547(_0x4da5b7[_0xe032('0x28')][_0xe032('0x27')]);}})[_0xe032('0x29')](function(_0x2be433){logger[_0xe032('0x25')](_0xe032('0x21'),_0x4aee44,_0x2be433);_0x422e96(_0x2be433);});});}function respondWithStatusCode(_0x22831a,_0xe89aa7){_0xe89aa7=_0xe89aa7||0xcc;return function(_0x499da5){if(_0x499da5){return _0x22831a['sendStatus'](_0xe89aa7);}return _0x22831a['status'](_0xe89aa7)[_0xe032('0x2a')]();};}function respondWithResult(_0x2568ce,_0x302559){_0x302559=_0x302559||0xc8;return function(_0x2a56e5){if(_0x2a56e5){return _0x2568ce[_0xe032('0x2b')](_0x302559)[_0xe032('0x2c')](_0x2a56e5);}};}function respondWithFilteredResult(_0x36ece7,_0x2b6ffa){return function(_0x4dcbf1){if(_0x4dcbf1){var _0x1ac20b=typeof _0x2b6ffa['offset']===_0xe032('0x2d')&&typeof _0x2b6ffa[_0xe032('0x2e')]===_0xe032('0x2d');var _0x2a521b=_0x4dcbf1['count'];var _0x5573e4=_0x1ac20b?0x0:_0x2b6ffa[_0xe032('0x2f')];var _0x38e7ea=_0x1ac20b?_0x4dcbf1[_0xe032('0x30')]:_0x2b6ffa[_0xe032('0x2f')]+_0x2b6ffa['limit'];var _0x541aa8;if(_0x38e7ea>=_0x2a521b){_0x38e7ea=_0x2a521b;_0x541aa8=0xc8;}else{_0x541aa8=0xce;}_0x36ece7['status'](_0x541aa8);return _0x36ece7[_0xe032('0x31')](_0xe032('0x32'),_0x5573e4+'-'+_0x38e7ea+'/'+_0x2a521b)[_0xe032('0x2c')](_0x4dcbf1);}return null;};}function patchUpdates(_0x707b){return function(_0x50db2d){try{jsonpatch[_0xe032('0x33')](_0x50db2d,_0x707b,!![]);}catch(_0x236da9){return BPromise[_0xe032('0x34')](_0x236da9);}return _0x50db2d[_0xe032('0x35')]();};}function saveUpdates(_0x25810a,_0x4a0198){return function(_0xd90bd5){if(_0xd90bd5){return _0xd90bd5[_0xe032('0x36')](_0x25810a)[_0xe032('0x1f')](function(_0x2cc18c){return _0x2cc18c;});}return null;};}function removeEntity(_0x522bdc,_0x44b78b){return function(_0x4c86e9){if(_0x4c86e9){return _0x4c86e9[_0xe032('0x37')]()['then'](function(){_0x522bdc[_0xe032('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c1ec0,_0x517df6){return function(_0x3970e1){if(!_0x3970e1){_0x2c1ec0[_0xe032('0x38')](0x194);}return _0x3970e1;};}function handleError(_0x55fac1,_0x3e3598){_0x3e3598=_0x3e3598||0x1f4;return function(_0x2fdf41){logger[_0xe032('0x25')](_0x2fdf41[_0xe032('0x39')]);if(_0x2fdf41['name']){delete _0x2fdf41[_0xe032('0x3a')];}_0x55fac1['status'](_0x3e3598)[_0xe032('0x3b')](_0x2fdf41);};}exports[_0xe032('0x3c')]=function(_0x5d02c1,_0x450ba4){var _0x23b790={},_0x4a4447={},_0x3efdef={'count':0x0,'rows':[]};var _0x2cfc49=_[_0xe032('0x3d')](db[_0xe032('0x3e')][_0xe032('0x3f')],function(_0x42f58a){return{'name':_0x42f58a[_0xe032('0x40')],'type':_0x42f58a[_0xe032('0x41')][_0xe032('0x42')]};});_0x4a4447[_0xe032('0x43')]=_[_0xe032('0x3d')](_0x2cfc49,_0xe032('0x3a'));_0x4a4447[_0xe032('0x44')]=_[_0xe032('0x45')](_0x5d02c1[_0xe032('0x44')]);_0x4a4447[_0xe032('0x46')]=_[_0xe032('0x47')](_0x4a4447['model'],_0x4a4447[_0xe032('0x44')]);_0x23b790['attributes']=_[_0xe032('0x47')](_0x4a4447[_0xe032('0x43')],qs[_0xe032('0x48')](_0x5d02c1[_0xe032('0x44')][_0xe032('0x48')]));_0x23b790['attributes']=_0x23b790[_0xe032('0x49')]['length']?_0x23b790[_0xe032('0x49')]:_0x4a4447['model'];if(!_0x5d02c1[_0xe032('0x44')][_0xe032('0x4a')](_0xe032('0x4b'))){_0x23b790[_0xe032('0x2e')]=qs['limit'](_0x5d02c1[_0xe032('0x44')]['limit']);_0x23b790[_0xe032('0x2f')]=qs[_0xe032('0x2f')](_0x5d02c1[_0xe032('0x44')][_0xe032('0x2f')]);}_0x23b790['order']=qs['sort'](_0x5d02c1[_0xe032('0x44')][_0xe032('0x4c')]);_0x23b790['where']=qs[_0xe032('0x46')](_[_0xe032('0x4d')](_0x5d02c1[_0xe032('0x44')],_0x4a4447[_0xe032('0x46')]),_0x2cfc49);if(_0x5d02c1[_0xe032('0x44')]['filter']){_0x23b790[_0xe032('0x4e')]=_[_0xe032('0x4f')](_0x23b790[_0xe032('0x4e')],{'$or':_[_0xe032('0x3d')](_0x2cfc49,function(_0x24b929){if(_0x24b929[_0xe032('0x41')]!==_0xe032('0x50')){var _0x318f86={};_0x318f86[_0x24b929['name']]={'$like':'%'+_0x5d02c1['query'][_0xe032('0x51')]+'%'};return _0x318f86;}})});}_0x23b790=_['merge']({},_0x23b790,_0x5d02c1[_0xe032('0x52')]);var _0x277207={'where':_0x23b790[_0xe032('0x4e')]};return db[_0xe032('0x3e')][_0xe032('0x30')](_0x277207)[_0xe032('0x1f')](function(_0x27495d){_0x3efdef[_0xe032('0x30')]=_0x27495d;if(_0x5d02c1[_0xe032('0x44')]['includeAll']){_0x23b790[_0xe032('0x53')]=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x23b790);})[_0xe032('0x1f')](function(_0x2583e9){_0x3efdef[_0xe032('0x54')]=_0x2583e9;return _0x3efdef;})[_0xe032('0x1f')](respondWithFilteredResult(_0x450ba4,_0x23b790))['catch'](handleError(_0x450ba4,null));};exports[_0xe032('0x55')]=function(_0x14d372,_0xdfdbd6){var _0x39ffb7={'raw':![],'where':{'id':_0x14d372[_0xe032('0x56')]['id']}},_0x1b3172={};_0x1b3172[_0xe032('0x43')]=_['keys'](db[_0xe032('0x3e')][_0xe032('0x3f')]);_0x1b3172['query']=_[_0xe032('0x45')](_0x14d372[_0xe032('0x44')]);_0x1b3172[_0xe032('0x46')]=_[_0xe032('0x47')](_0x1b3172[_0xe032('0x43')],_0x1b3172[_0xe032('0x44')]);_0x39ffb7[_0xe032('0x49')]=_[_0xe032('0x47')](_0x1b3172[_0xe032('0x43')],qs[_0xe032('0x48')](_0x14d372[_0xe032('0x44')][_0xe032('0x48')]));_0x39ffb7[_0xe032('0x49')]=_0x39ffb7[_0xe032('0x49')]['length']?_0x39ffb7[_0xe032('0x49')]:_0x1b3172['model'];if(_0x14d372[_0xe032('0x44')][_0xe032('0x57')]){_0x39ffb7[_0xe032('0x53')]=[{'all':!![]}];}_0x39ffb7=_[_0xe032('0x4f')]({},_0x39ffb7,_0x14d372[_0xe032('0x52')]);return db[_0xe032('0x3e')][_0xe032('0x58')](_0x39ffb7)[_0xe032('0x1f')](handleEntityNotFound(_0xdfdbd6,null))[_0xe032('0x1f')](respondWithResult(_0xdfdbd6,null))[_0xe032('0x29')](handleError(_0xdfdbd6,null));};exports[_0xe032('0x59')]=function(_0x564fe0,_0x414b73){return db[_0xe032('0x3e')]['create'](_0x564fe0[_0xe032('0x5a')],{})['then'](respondWithResult(_0x414b73,0xc9))[_0xe032('0x29')](handleError(_0x414b73,null));};exports[_0xe032('0x36')]=function(_0x20f25b,_0x414243){if(_0x20f25b[_0xe032('0x5a')]['id']){delete _0x20f25b['body']['id'];}return db[_0xe032('0x3e')][_0xe032('0x58')]({'where':{'id':_0x20f25b[_0xe032('0x56')]['id']}})[_0xe032('0x1f')](handleEntityNotFound(_0x414243,null))[_0xe032('0x1f')](saveUpdates(_0x20f25b[_0xe032('0x5a')],null))[_0xe032('0x1f')](respondWithResult(_0x414243,null))['catch'](handleError(_0x414243,null));};exports[_0xe032('0x37')]=function(_0x19bbc1,_0x454b29){return db[_0xe032('0x3e')][_0xe032('0x58')]({'where':{'id':_0x19bbc1[_0xe032('0x56')]['id']}})[_0xe032('0x1f')](handleEntityNotFound(_0x454b29,null))[_0xe032('0x1f')](removeEntity(_0x454b29,null))[_0xe032('0x29')](handleError(_0x454b29,null));};exports['getFields']=function(_0x795a58,_0xc27d9d,_0x366b73){var _0x560e26={};var _0x283832={};var _0x11720e;var _0x49a8bd;return db[_0xe032('0x3e')][_0xe032('0x5b')]({'where':{'id':_0x795a58[_0xe032('0x56')]['id']}})[_0xe032('0x1f')](handleEntityNotFound(_0xc27d9d,null))[_0xe032('0x1f')](function(_0x27427a){if(_0x27427a){_0x11720e=_0x27427a;_0x283832[_0xe032('0x43')]=_[_0xe032('0x45')](db[_0xe032('0x5c')][_0xe032('0x3f')]);_0x283832[_0xe032('0x44')]=_['keys'](_0x795a58[_0xe032('0x44')]);_0x283832[_0xe032('0x46')]=_[_0xe032('0x47')](_0x283832[_0xe032('0x43')],_0x283832[_0xe032('0x44')]);_0x560e26['attributes']=_[_0xe032('0x47')](_0x283832['model'],qs[_0xe032('0x48')](_0x795a58[_0xe032('0x44')][_0xe032('0x48')]));_0x560e26[_0xe032('0x49')]=_0x560e26[_0xe032('0x49')][_0xe032('0x5d')]?_0x560e26[_0xe032('0x49')]:_0x283832[_0xe032('0x43')];_0x560e26[_0xe032('0x5e')]=qs['sort'](_0x795a58['query']['sort']);_0x560e26[_0xe032('0x4e')]=qs[_0xe032('0x46')](_[_0xe032('0x4d')](_0x795a58[_0xe032('0x44')],_0x283832[_0xe032('0x46')]));if(_0x795a58[_0xe032('0x44')]['filter']){_0x560e26[_0xe032('0x4e')]=_[_0xe032('0x4f')](_0x560e26[_0xe032('0x4e')],{'$or':_['map'](_0x560e26[_0xe032('0x49')],function(_0x522713){var _0x1f5d15={};_0x1f5d15[_0x522713]={'$like':'%'+_0x795a58[_0xe032('0x44')]['filter']+'%'};return _0x1f5d15;})});}_0x560e26=_['merge']({},_0x560e26,_0x795a58['options']);return _0x11720e[_0xe032('0x5f')](_0x560e26);}})['then'](function(_0x5157f7){if(_0x5157f7){_0x49a8bd=_0x5157f7[_0xe032('0x5d')];if(!_0x795a58[_0xe032('0x44')][_0xe032('0x4a')]('nolimit')){_0x560e26[_0xe032('0x2e')]=qs['limit'](_0x795a58[_0xe032('0x44')][_0xe032('0x2e')]);_0x560e26[_0xe032('0x2f')]=qs[_0xe032('0x2f')](_0x795a58[_0xe032('0x44')][_0xe032('0x2f')]);}return _0x11720e[_0xe032('0x5f')](_0x560e26);}})[_0xe032('0x1f')](function(_0xc18f6f){if(_0xc18f6f){return _0xc18f6f?{'count':_0x49a8bd,'rows':_0xc18f6f}:null;}})[_0xe032('0x1f')](respondWithResult(_0xc27d9d,null))[_0xe032('0x29')](handleError(_0xc27d9d,null));};exports['getSubjects']=function(_0x8b4464,_0x338ef2,_0x5aa7a6){var _0x55bafe={};var _0x228df8={};var _0xffd314;var _0x3b89b8;return db[_0xe032('0x3e')][_0xe032('0x5b')]({'where':{'id':_0x8b4464[_0xe032('0x56')]['id']}})['then'](handleEntityNotFound(_0x338ef2,null))[_0xe032('0x1f')](function(_0x242b8f){if(_0x242b8f){_0xffd314=_0x242b8f;_0x228df8['model']=_[_0xe032('0x45')](db[_0xe032('0x5c')][_0xe032('0x3f')]);_0x228df8['query']=_[_0xe032('0x45')](_0x8b4464[_0xe032('0x44')]);_0x228df8[_0xe032('0x46')]=_['intersection'](_0x228df8['model'],_0x228df8[_0xe032('0x44')]);_0x55bafe['attributes']=_[_0xe032('0x47')](_0x228df8[_0xe032('0x43')],qs[_0xe032('0x48')](_0x8b4464[_0xe032('0x44')][_0xe032('0x48')]));_0x55bafe[_0xe032('0x49')]=_0x55bafe['attributes'][_0xe032('0x5d')]?_0x55bafe[_0xe032('0x49')]:_0x228df8[_0xe032('0x43')];_0x55bafe['order']=qs[_0xe032('0x4c')](_0x8b4464['query'][_0xe032('0x4c')]);_0x55bafe['where']=qs[_0xe032('0x46')](_[_0xe032('0x4d')](_0x8b4464[_0xe032('0x44')],_0x228df8['filters']));if(_0x8b4464[_0xe032('0x44')][_0xe032('0x51')]){_0x55bafe[_0xe032('0x4e')]=_[_0xe032('0x4f')](_0x55bafe[_0xe032('0x4e')],{'$or':_[_0xe032('0x3d')](_0x55bafe['attributes'],function(_0xdebe46){var _0x24902d={};_0x24902d[_0xdebe46]={'$like':'%'+_0x8b4464['query']['filter']+'%'};return _0x24902d;})});}_0x55bafe=_[_0xe032('0x4f')]({},_0x55bafe,_0x8b4464[_0xe032('0x52')]);return _0xffd314[_0xe032('0x60')](_0x55bafe);}})[_0xe032('0x1f')](function(_0x33dd57){if(_0x33dd57){_0x3b89b8=_0x33dd57['length'];if(!_0x8b4464[_0xe032('0x44')]['hasOwnProperty'](_0xe032('0x4b'))){_0x55bafe['limit']=qs[_0xe032('0x2e')](_0x8b4464[_0xe032('0x44')][_0xe032('0x2e')]);_0x55bafe[_0xe032('0x2f')]=qs[_0xe032('0x2f')](_0x8b4464[_0xe032('0x44')]['offset']);}return _0xffd314[_0xe032('0x60')](_0x55bafe);}})['then'](function(_0x4ee54a){if(_0x4ee54a){return _0x4ee54a?{'count':_0x3b89b8,'rows':_0x4ee54a}:null;}})['then'](respondWithResult(_0x338ef2,null))[_0xe032('0x29')](handleError(_0x338ef2,null));};exports[_0xe032('0x61')]=function(_0x50cd07,_0x24c4cb,_0x5f5d3d){var _0x5f42b1={};var _0x2f2b74={};var _0x10873b;var _0x577f56;return db['ZohoConfiguration'][_0xe032('0x5b')]({'where':{'id':_0x50cd07[_0xe032('0x56')]['id']}})['then'](handleEntityNotFound(_0x24c4cb,null))[_0xe032('0x1f')](function(_0xeedf7a){if(_0xeedf7a){_0x10873b=_0xeedf7a;_0x2f2b74[_0xe032('0x43')]=_[_0xe032('0x45')](db['ZohoField'][_0xe032('0x3f')]);_0x2f2b74['query']=_[_0xe032('0x45')](_0x50cd07[_0xe032('0x44')]);_0x2f2b74[_0xe032('0x46')]=_['intersection'](_0x2f2b74[_0xe032('0x43')],_0x2f2b74[_0xe032('0x44')]);_0x5f42b1['attributes']=_[_0xe032('0x47')](_0x2f2b74[_0xe032('0x43')],qs[_0xe032('0x48')](_0x50cd07[_0xe032('0x44')][_0xe032('0x48')]));_0x5f42b1[_0xe032('0x49')]=_0x5f42b1['attributes'][_0xe032('0x5d')]?_0x5f42b1[_0xe032('0x49')]:_0x2f2b74[_0xe032('0x43')];_0x5f42b1[_0xe032('0x5e')]=qs[_0xe032('0x4c')](_0x50cd07[_0xe032('0x44')][_0xe032('0x4c')]);_0x5f42b1[_0xe032('0x4e')]=qs[_0xe032('0x46')](_[_0xe032('0x4d')](_0x50cd07[_0xe032('0x44')],_0x2f2b74['filters']));if(_0x50cd07[_0xe032('0x44')]['filter']){_0x5f42b1[_0xe032('0x4e')]=_['merge'](_0x5f42b1[_0xe032('0x4e')],{'$or':_[_0xe032('0x3d')](_0x5f42b1['attributes'],function(_0x183cfe){var _0x47fc9d={};_0x47fc9d[_0x183cfe]={'$like':'%'+_0x50cd07['query']['filter']+'%'};return _0x47fc9d;})});}_0x5f42b1=_[_0xe032('0x4f')]({},_0x5f42b1,_0x50cd07[_0xe032('0x52')]);return _0x10873b[_0xe032('0x61')](_0x5f42b1);}})['then'](function(_0x210e7a){if(_0x210e7a){_0x577f56=_0x210e7a[_0xe032('0x5d')];if(!_0x50cd07[_0xe032('0x44')]['hasOwnProperty'](_0xe032('0x4b'))){_0x5f42b1['limit']=qs[_0xe032('0x2e')](_0x50cd07[_0xe032('0x44')][_0xe032('0x2e')]);_0x5f42b1[_0xe032('0x2f')]=qs[_0xe032('0x2f')](_0x50cd07[_0xe032('0x44')][_0xe032('0x2f')]);}return _0x10873b[_0xe032('0x61')](_0x5f42b1);}})[_0xe032('0x1f')](function(_0xe63d0){if(_0xe63d0){return _0xe63d0?{'count':_0x577f56,'rows':_0xe63d0}:null;}})['then'](respondWithResult(_0x24c4cb,null))['catch'](handleError(_0x24c4cb,null));}; \ No newline at end of file +var _0x55ca=['pick','type','VIRTUAL','filter','options','ZohoConfiguration','includeAll','include','findAll','rows','show','params','keys','intersection','merge','find','create','body','findOne','ZohoField','order','getFields','getSubjects','getDescriptions','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','end','sendStatus','stack','name','map','rawAttributes','fieldName','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where'];(function(_0x30d87a,_0xf3a07f){var _0x48f64b=function(_0x2078b7){while(--_0x2078b7){_0x30d87a['push'](_0x30d87a['shift']());}};_0x48f64b(++_0xf3a07f);}(_0x55ca,0x126));var _0xa55c=function(_0x1ee5be,_0x5f46e3){_0x1ee5be=_0x1ee5be-0x0;var _0x177140=_0x55ca[_0x1ee5be];return _0x177140;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa55c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x576044,_0x5a3672,_0x59ea8d,_0x18ee85){return new BPromise(function(_0x3930e4,_0x462cd6){var _0x938bd6=_0x18ee85||client;return _0x938bd6[_0xa55c('0x19')](_0x576044,_0x59ea8d)[_0xa55c('0x1a')](function(_0x4e0b2f){logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,_0xa55c('0x1d'));logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x5a3672,_0xa55c('0x1d'),JSON[_0xa55c('0x20')](_0x4e0b2f));if(_0x4e0b2f[_0xa55c('0x21')]){if(_0x4e0b2f[_0xa55c('0x21')]['code']===0x1f4){logger[_0xa55c('0x21')](_0xa55c('0x1c'),_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x462cd6(_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x3930e4(_0x4e0b2f[_0xa55c('0x21')]['message']);}else{logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,'request\x20sent');_0x3930e4(_0x4e0b2f[_0xa55c('0x23')][_0xa55c('0x22')]);}})[_0xa55c('0x24')](function(_0x1965f1){logger[_0xa55c('0x21')]('ZohoConfiguration,\x20%s,\x20%s',_0x5a3672,_0x1965f1);_0x462cd6(_0x1965f1);});});}function respondWithStatusCode(_0x1fc828,_0x504c24){_0x504c24=_0x504c24||0xcc;return function(_0x5ba836){if(_0x5ba836){return _0x1fc828['sendStatus'](_0x504c24);}return _0x1fc828[_0xa55c('0x25')](_0x504c24)['end']();};}function respondWithResult(_0x3ecbe7,_0x190757){_0x190757=_0x190757||0xc8;return function(_0x3f64de){if(_0x3f64de){return _0x3ecbe7[_0xa55c('0x25')](_0x190757)[_0xa55c('0x26')](_0x3f64de);}};}function respondWithFilteredResult(_0x170ba4,_0x1da633){return function(_0x11e7f7){if(_0x11e7f7){var _0x192df2=typeof _0x1da633[_0xa55c('0x27')]===_0xa55c('0x28')&&typeof _0x1da633['limit']===_0xa55c('0x28');var _0x28814f=_0x11e7f7[_0xa55c('0x29')];var _0x906caa=_0x192df2?0x0:_0x1da633['offset'];var _0x1377b0=_0x192df2?_0x11e7f7[_0xa55c('0x29')]:_0x1da633[_0xa55c('0x27')]+_0x1da633[_0xa55c('0x2a')];var _0x45ee8d;if(_0x1377b0>=_0x28814f){_0x1377b0=_0x28814f;_0x45ee8d=0xc8;}else{_0x45ee8d=0xce;}_0x170ba4[_0xa55c('0x25')](_0x45ee8d);return _0x170ba4['set'](_0xa55c('0x2b'),_0x906caa+'-'+_0x1377b0+'/'+_0x28814f)['json'](_0x11e7f7);}return null;};}function patchUpdates(_0x35c9c2){return function(_0x1d730b){try{jsonpatch[_0xa55c('0x2c')](_0x1d730b,_0x35c9c2,!![]);}catch(_0x223813){return BPromise['reject'](_0x223813);}return _0x1d730b[_0xa55c('0x2d')]();};}function saveUpdates(_0x2096ae,_0x331e58){return function(_0x20da31){if(_0x20da31){return _0x20da31[_0xa55c('0x2e')](_0x2096ae)[_0xa55c('0x1a')](function(_0x29748a){return _0x29748a;});}return null;};}function removeEntity(_0x24d44d,_0x2808e9){return function(_0xcbaf2e){if(_0xcbaf2e){return _0xcbaf2e[_0xa55c('0x2f')]()['then'](function(){_0x24d44d['status'](0xcc)[_0xa55c('0x30')]();});}};}function handleEntityNotFound(_0x19733e,_0x4932d0){return function(_0x30fadd){if(!_0x30fadd){_0x19733e[_0xa55c('0x31')](0x194);}return _0x30fadd;};}function handleError(_0x2e9623,_0x1839ac){_0x1839ac=_0x1839ac||0x1f4;return function(_0x30d4f8){logger[_0xa55c('0x21')](_0x30d4f8[_0xa55c('0x32')]);if(_0x30d4f8[_0xa55c('0x33')]){delete _0x30d4f8[_0xa55c('0x33')];}_0x2e9623['status'](_0x1839ac)['send'](_0x30d4f8);};}exports['index']=function(_0x3fd75f,_0x18e00e){var _0x2bb4f0={},_0x5802e4={},_0x768408={'count':0x0,'rows':[]};var _0x547930=_[_0xa55c('0x34')](db['ZohoConfiguration'][_0xa55c('0x35')],function(_0x39267c){return{'name':_0x39267c[_0xa55c('0x36')],'type':_0x39267c['type'][_0xa55c('0x37')]};});_0x5802e4[_0xa55c('0x38')]=_['map'](_0x547930,_0xa55c('0x33'));_0x5802e4[_0xa55c('0x39')]=_['keys'](_0x3fd75f['query']);_0x5802e4[_0xa55c('0x3a')]=_['intersection'](_0x5802e4[_0xa55c('0x38')],_0x5802e4[_0xa55c('0x39')]);_0x2bb4f0['attributes']=_['intersection'](_0x5802e4['model'],qs['fields'](_0x3fd75f[_0xa55c('0x39')][_0xa55c('0x3b')]));_0x2bb4f0[_0xa55c('0x3c')]=_0x2bb4f0[_0xa55c('0x3c')][_0xa55c('0x3d')]?_0x2bb4f0['attributes']:_0x5802e4[_0xa55c('0x38')];if(!_0x3fd75f[_0xa55c('0x39')][_0xa55c('0x3e')](_0xa55c('0x3f'))){_0x2bb4f0[_0xa55c('0x2a')]=qs[_0xa55c('0x2a')](_0x3fd75f['query'][_0xa55c('0x2a')]);_0x2bb4f0['offset']=qs['offset'](_0x3fd75f[_0xa55c('0x39')][_0xa55c('0x27')]);}_0x2bb4f0['order']=qs[_0xa55c('0x40')](_0x3fd75f['query']['sort']);_0x2bb4f0[_0xa55c('0x41')]=qs[_0xa55c('0x3a')](_[_0xa55c('0x42')](_0x3fd75f['query'],_0x5802e4[_0xa55c('0x3a')]),_0x547930);if(_0x3fd75f[_0xa55c('0x39')]['filter']){_0x2bb4f0[_0xa55c('0x41')]=_['merge'](_0x2bb4f0[_0xa55c('0x41')],{'$or':_[_0xa55c('0x34')](_0x547930,function(_0x5be43f){if(_0x5be43f[_0xa55c('0x43')]!==_0xa55c('0x44')){var _0x5d834d={};_0x5d834d[_0x5be43f[_0xa55c('0x33')]]={'$like':'%'+_0x3fd75f[_0xa55c('0x39')][_0xa55c('0x45')]+'%'};return _0x5d834d;}})});}_0x2bb4f0=_['merge']({},_0x2bb4f0,_0x3fd75f[_0xa55c('0x46')]);var _0x582901={'where':_0x2bb4f0[_0xa55c('0x41')]};return db[_0xa55c('0x47')][_0xa55c('0x29')](_0x582901)['then'](function(_0x41eab1){_0x768408[_0xa55c('0x29')]=_0x41eab1;if(_0x3fd75f['query'][_0xa55c('0x48')]){_0x2bb4f0[_0xa55c('0x49')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xa55c('0x4a')](_0x2bb4f0);})[_0xa55c('0x1a')](function(_0x52f9a7){_0x768408[_0xa55c('0x4b')]=_0x52f9a7;return _0x768408;})[_0xa55c('0x1a')](respondWithFilteredResult(_0x18e00e,_0x2bb4f0))[_0xa55c('0x24')](handleError(_0x18e00e,null));};exports[_0xa55c('0x4c')]=function(_0x564cb3,_0x143989){var _0x58a7ea={'raw':![],'where':{'id':_0x564cb3[_0xa55c('0x4d')]['id']}},_0x2157d6={};_0x2157d6[_0xa55c('0x38')]=_['keys'](db[_0xa55c('0x47')][_0xa55c('0x35')]);_0x2157d6['query']=_[_0xa55c('0x4e')](_0x564cb3[_0xa55c('0x39')]);_0x2157d6[_0xa55c('0x3a')]=_[_0xa55c('0x4f')](_0x2157d6[_0xa55c('0x38')],_0x2157d6[_0xa55c('0x39')]);_0x58a7ea[_0xa55c('0x3c')]=_[_0xa55c('0x4f')](_0x2157d6[_0xa55c('0x38')],qs[_0xa55c('0x3b')](_0x564cb3['query'][_0xa55c('0x3b')]));_0x58a7ea[_0xa55c('0x3c')]=_0x58a7ea[_0xa55c('0x3c')]['length']?_0x58a7ea[_0xa55c('0x3c')]:_0x2157d6[_0xa55c('0x38')];if(_0x564cb3['query'][_0xa55c('0x48')]){_0x58a7ea['include']=[{'all':!![]}];}_0x58a7ea=_[_0xa55c('0x50')]({},_0x58a7ea,_0x564cb3[_0xa55c('0x46')]);return db[_0xa55c('0x47')][_0xa55c('0x51')](_0x58a7ea)[_0xa55c('0x1a')](handleEntityNotFound(_0x143989,null))['then'](respondWithResult(_0x143989,null))[_0xa55c('0x24')](handleError(_0x143989,null));};exports[_0xa55c('0x52')]=function(_0x4b85cc,_0x3929a6){return db[_0xa55c('0x47')][_0xa55c('0x52')](_0x4b85cc[_0xa55c('0x53')],{})['then'](respondWithResult(_0x3929a6,0xc9))['catch'](handleError(_0x3929a6,null));};exports[_0xa55c('0x2e')]=function(_0x250dea,_0x3ca5b8){if(_0x250dea[_0xa55c('0x53')]['id']){delete _0x250dea['body']['id'];}return db[_0xa55c('0x47')]['find']({'where':{'id':_0x250dea[_0xa55c('0x4d')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x3ca5b8,null))[_0xa55c('0x1a')](saveUpdates(_0x250dea[_0xa55c('0x53')],null))[_0xa55c('0x1a')](respondWithResult(_0x3ca5b8,null))['catch'](handleError(_0x3ca5b8,null));};exports[_0xa55c('0x2f')]=function(_0x54f776,_0x23f67f){return db[_0xa55c('0x47')][_0xa55c('0x51')]({'where':{'id':_0x54f776[_0xa55c('0x4d')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x23f67f,null))[_0xa55c('0x1a')](removeEntity(_0x23f67f,null))[_0xa55c('0x24')](handleError(_0x23f67f,null));};exports['getFields']=function(_0x450567,_0x449e00,_0x2f2d21){var _0x23a30e={};var _0x3fa00f={};var _0x5ba2b0;var _0xa72718;return db[_0xa55c('0x47')][_0xa55c('0x54')]({'where':{'id':_0x450567[_0xa55c('0x4d')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x449e00,null))['then'](function(_0xdd92c1){if(_0xdd92c1){_0x5ba2b0=_0xdd92c1;_0x3fa00f[_0xa55c('0x38')]=_[_0xa55c('0x4e')](db[_0xa55c('0x55')][_0xa55c('0x35')]);_0x3fa00f['query']=_[_0xa55c('0x4e')](_0x450567['query']);_0x3fa00f[_0xa55c('0x3a')]=_['intersection'](_0x3fa00f[_0xa55c('0x38')],_0x3fa00f['query']);_0x23a30e[_0xa55c('0x3c')]=_[_0xa55c('0x4f')](_0x3fa00f[_0xa55c('0x38')],qs[_0xa55c('0x3b')](_0x450567[_0xa55c('0x39')][_0xa55c('0x3b')]));_0x23a30e[_0xa55c('0x3c')]=_0x23a30e[_0xa55c('0x3c')][_0xa55c('0x3d')]?_0x23a30e[_0xa55c('0x3c')]:_0x3fa00f['model'];_0x23a30e[_0xa55c('0x56')]=qs[_0xa55c('0x40')](_0x450567['query'][_0xa55c('0x40')]);_0x23a30e[_0xa55c('0x41')]=qs[_0xa55c('0x3a')](_[_0xa55c('0x42')](_0x450567[_0xa55c('0x39')],_0x3fa00f[_0xa55c('0x3a')]));if(_0x450567[_0xa55c('0x39')][_0xa55c('0x45')]){_0x23a30e['where']=_[_0xa55c('0x50')](_0x23a30e[_0xa55c('0x41')],{'$or':_[_0xa55c('0x34')](_0x23a30e[_0xa55c('0x3c')],function(_0x1a52b9){var _0x1bcb40={};_0x1bcb40[_0x1a52b9]={'$like':'%'+_0x450567[_0xa55c('0x39')][_0xa55c('0x45')]+'%'};return _0x1bcb40;})});}_0x23a30e=_[_0xa55c('0x50')]({},_0x23a30e,_0x450567['options']);return _0x5ba2b0[_0xa55c('0x57')](_0x23a30e);}})[_0xa55c('0x1a')](function(_0x40c56a){if(_0x40c56a){_0xa72718=_0x40c56a[_0xa55c('0x3d')];if(!_0x450567[_0xa55c('0x39')][_0xa55c('0x3e')](_0xa55c('0x3f'))){_0x23a30e[_0xa55c('0x2a')]=qs[_0xa55c('0x2a')](_0x450567[_0xa55c('0x39')][_0xa55c('0x2a')]);_0x23a30e['offset']=qs[_0xa55c('0x27')](_0x450567['query'][_0xa55c('0x27')]);}return _0x5ba2b0[_0xa55c('0x57')](_0x23a30e);}})[_0xa55c('0x1a')](function(_0x4f2a7b){if(_0x4f2a7b){return _0x4f2a7b?{'count':_0xa72718,'rows':_0x4f2a7b}:null;}})['then'](respondWithResult(_0x449e00,null))[_0xa55c('0x24')](handleError(_0x449e00,null));};exports[_0xa55c('0x58')]=function(_0x23c84c,_0x42529f,_0x4c7ee1){var _0x149cb9={};var _0xd02251={};var _0x8ea1c6;var _0x3a9910;return db[_0xa55c('0x47')]['findOne']({'where':{'id':_0x23c84c['params']['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x42529f,null))[_0xa55c('0x1a')](function(_0x3f9d0a){if(_0x3f9d0a){_0x8ea1c6=_0x3f9d0a;_0xd02251[_0xa55c('0x38')]=_[_0xa55c('0x4e')](db['ZohoField'][_0xa55c('0x35')]);_0xd02251[_0xa55c('0x39')]=_['keys'](_0x23c84c[_0xa55c('0x39')]);_0xd02251[_0xa55c('0x3a')]=_[_0xa55c('0x4f')](_0xd02251['model'],_0xd02251[_0xa55c('0x39')]);_0x149cb9[_0xa55c('0x3c')]=_[_0xa55c('0x4f')](_0xd02251[_0xa55c('0x38')],qs[_0xa55c('0x3b')](_0x23c84c['query'][_0xa55c('0x3b')]));_0x149cb9[_0xa55c('0x3c')]=_0x149cb9['attributes']['length']?_0x149cb9[_0xa55c('0x3c')]:_0xd02251['model'];_0x149cb9[_0xa55c('0x56')]=qs[_0xa55c('0x40')](_0x23c84c[_0xa55c('0x39')][_0xa55c('0x40')]);_0x149cb9[_0xa55c('0x41')]=qs[_0xa55c('0x3a')](_[_0xa55c('0x42')](_0x23c84c[_0xa55c('0x39')],_0xd02251[_0xa55c('0x3a')]));if(_0x23c84c['query'][_0xa55c('0x45')]){_0x149cb9[_0xa55c('0x41')]=_[_0xa55c('0x50')](_0x149cb9[_0xa55c('0x41')],{'$or':_['map'](_0x149cb9[_0xa55c('0x3c')],function(_0x409346){var _0x1baa8b={};_0x1baa8b[_0x409346]={'$like':'%'+_0x23c84c[_0xa55c('0x39')]['filter']+'%'};return _0x1baa8b;})});}_0x149cb9=_['merge']({},_0x149cb9,_0x23c84c[_0xa55c('0x46')]);return _0x8ea1c6[_0xa55c('0x58')](_0x149cb9);}})[_0xa55c('0x1a')](function(_0x12347c){if(_0x12347c){_0x3a9910=_0x12347c['length'];if(!_0x23c84c['query'][_0xa55c('0x3e')](_0xa55c('0x3f'))){_0x149cb9[_0xa55c('0x2a')]=qs[_0xa55c('0x2a')](_0x23c84c[_0xa55c('0x39')][_0xa55c('0x2a')]);_0x149cb9[_0xa55c('0x27')]=qs['offset'](_0x23c84c[_0xa55c('0x39')]['offset']);}return _0x8ea1c6[_0xa55c('0x58')](_0x149cb9);}})['then'](function(_0x36ded7){if(_0x36ded7){return _0x36ded7?{'count':_0x3a9910,'rows':_0x36ded7}:null;}})[_0xa55c('0x1a')](respondWithResult(_0x42529f,null))[_0xa55c('0x24')](handleError(_0x42529f,null));};exports[_0xa55c('0x59')]=function(_0xe3444f,_0x402f02,_0x1ea5b6){var _0x2c71ca={};var _0x576a1b={};var _0x59414d;var _0x14cb74;return db[_0xa55c('0x47')][_0xa55c('0x54')]({'where':{'id':_0xe3444f[_0xa55c('0x4d')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x402f02,null))[_0xa55c('0x1a')](function(_0x47e8e2){if(_0x47e8e2){_0x59414d=_0x47e8e2;_0x576a1b[_0xa55c('0x38')]=_[_0xa55c('0x4e')](db[_0xa55c('0x55')][_0xa55c('0x35')]);_0x576a1b[_0xa55c('0x39')]=_[_0xa55c('0x4e')](_0xe3444f[_0xa55c('0x39')]);_0x576a1b[_0xa55c('0x3a')]=_['intersection'](_0x576a1b[_0xa55c('0x38')],_0x576a1b[_0xa55c('0x39')]);_0x2c71ca[_0xa55c('0x3c')]=_[_0xa55c('0x4f')](_0x576a1b[_0xa55c('0x38')],qs['fields'](_0xe3444f[_0xa55c('0x39')][_0xa55c('0x3b')]));_0x2c71ca['attributes']=_0x2c71ca['attributes'][_0xa55c('0x3d')]?_0x2c71ca[_0xa55c('0x3c')]:_0x576a1b['model'];_0x2c71ca['order']=qs['sort'](_0xe3444f['query'][_0xa55c('0x40')]);_0x2c71ca[_0xa55c('0x41')]=qs[_0xa55c('0x3a')](_[_0xa55c('0x42')](_0xe3444f[_0xa55c('0x39')],_0x576a1b[_0xa55c('0x3a')]));if(_0xe3444f['query'][_0xa55c('0x45')]){_0x2c71ca[_0xa55c('0x41')]=_[_0xa55c('0x50')](_0x2c71ca[_0xa55c('0x41')],{'$or':_['map'](_0x2c71ca[_0xa55c('0x3c')],function(_0x25e4e0){var _0x36824c={};_0x36824c[_0x25e4e0]={'$like':'%'+_0xe3444f['query'][_0xa55c('0x45')]+'%'};return _0x36824c;})});}_0x2c71ca=_['merge']({},_0x2c71ca,_0xe3444f['options']);return _0x59414d[_0xa55c('0x59')](_0x2c71ca);}})[_0xa55c('0x1a')](function(_0x1e298d){if(_0x1e298d){_0x14cb74=_0x1e298d[_0xa55c('0x3d')];if(!_0xe3444f[_0xa55c('0x39')][_0xa55c('0x3e')](_0xa55c('0x3f'))){_0x2c71ca['limit']=qs['limit'](_0xe3444f[_0xa55c('0x39')][_0xa55c('0x2a')]);_0x2c71ca[_0xa55c('0x27')]=qs[_0xa55c('0x27')](_0xe3444f[_0xa55c('0x39')][_0xa55c('0x27')]);}return _0x59414d[_0xa55c('0x59')](_0x2c71ca);}})[_0xa55c('0x1a')](function(_0xc79fb8){if(_0xc79fb8){return _0xc79fb8?{'count':_0x14cb74,'rows':_0xc79fb8}:null;}})[_0xa55c('0x1a')](respondWithResult(_0x402f02,null))['catch'](handleError(_0x402f02,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index fbdd0c4..daff1da 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 _0x5383=['path','../../config/environment','exports','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5383,0x89));var _0x3538=function(_0x58a6cf,_0x5cc584){_0x58a6cf=_0x58a6cf-0x0;var _0x55d016=_0x5383[_0x58a6cf];return _0x55d016;};'use strict';var _=require('lodash');var util=require(_0x3538('0x0'));var logger=require(_0x3538('0x1'))(_0x3538('0x2'));var moment=require(_0x3538('0x3'));var BPromise=require(_0x3538('0x4'));var rp=require(_0x3538('0x5'));var fs=require('fs');var path=require(_0x3538('0x6'));var rimraf=require('rimraf');var config=require(_0x3538('0x7'));var attributes=require('./intZohoConfiguration.attributes');module[_0x3538('0x8')]=function(_0x46483c,_0x546a88){return _0x46483c['define'](_0x3538('0x9'),attributes,{'tableName':_0x3538('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ed1=['rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x59f9e,_0x8614a3){var _0x191398=function(_0x2b598a){while(--_0x2b598a){_0x59f9e['push'](_0x59f9e['shift']());}};_0x191398(++_0x8614a3);}(_0x9ed1,0x7d));var _0x19ed=function(_0x380144,_0xe473c1){_0x380144=_0x380144-0x0;var _0x298587=_0x9ed1[_0x380144];return _0x298587;};'use strict';var _=require(_0x19ed('0x0'));var util=require(_0x19ed('0x1'));var logger=require(_0x19ed('0x2'))(_0x19ed('0x3'));var moment=require(_0x19ed('0x4'));var BPromise=require(_0x19ed('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x19ed('0x6'));var rimraf=require(_0x19ed('0x7'));var config=require(_0x19ed('0x8'));var attributes=require(_0x19ed('0x9'));module[_0x19ed('0xa')]=function(_0x1603c5,_0x9b8194){return _0x1603c5['define']('ZohoConfiguration',attributes,{'tableName':_0x19ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 9bb630a..e4ccabb 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 _0x3f14=['jayson/promise','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment'];(function(_0x40a782,_0x5c43b9){var _0x1323b0=function(_0x6a505){while(--_0x6a505){_0x40a782['push'](_0x40a782['shift']());}};_0x1323b0(++_0x5c43b9);}(_0x3f14,0x111));var _0x43f1=function(_0x1f78f1,_0x999b5){_0x1f78f1=_0x1f78f1-0x0;var _0x37f1da=_0x3f14[_0x1f78f1];return _0x37f1da;};'use strict';var _=require('lodash');var util=require(_0x43f1('0x0'));var moment=require(_0x43f1('0x1'));var BPromise=require(_0x43f1('0x2'));var rs=require(_0x43f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43f1('0x4'));var logger=require('../../config/logger')(_0x43f1('0x5'));var config=require(_0x43f1('0x6'));var jayson=require(_0x43f1('0x7'));var client=jayson[_0x43f1('0x8')][_0x43f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e5cf2,_0x4aca33,_0x1c17d3){return new BPromise(function(_0x5a3664,_0x49d6ef){return client[_0x43f1('0xa')](_0x2e5cf2,_0x1c17d3)['then'](function(_0x3ee602){logger[_0x43f1('0xb')](_0x43f1('0xc'),_0x4aca33,_0x43f1('0xd'));logger['debug'](_0x43f1('0xe'),_0x4aca33,_0x43f1('0xd'),JSON['stringify'](_0x3ee602));if(_0x3ee602['error']){if(_0x3ee602[_0x43f1('0xf')][_0x43f1('0x10')]===0x1f4){logger[_0x43f1('0xf')](_0x43f1('0xc'),_0x4aca33,_0x3ee602[_0x43f1('0xf')]['message']);return _0x49d6ef(_0x3ee602[_0x43f1('0xf')][_0x43f1('0x11')]);}logger[_0x43f1('0xf')](_0x43f1('0xc'),_0x4aca33,_0x3ee602[_0x43f1('0xf')][_0x43f1('0x11')]);return _0x5a3664(_0x3ee602[_0x43f1('0xf')][_0x43f1('0x11')]);}else{logger[_0x43f1('0xb')](_0x43f1('0xc'),_0x4aca33,_0x43f1('0xd'));_0x5a3664(_0x3ee602[_0x43f1('0x12')][_0x43f1('0x11')]);}})[_0x43f1('0x13')](function(_0x5e93c1){logger[_0x43f1('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x4aca33,_0x5e93c1);_0x49d6ef(_0x5e93c1);});});} \ No newline at end of file +var _0x1211=['ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x17db90,_0x2377ed){var _0x5d50e0=function(_0x3852c0){while(--_0x3852c0){_0x17db90['push'](_0x17db90['shift']());}};_0x5d50e0(++_0x2377ed);}(_0x1211,0x10d));var _0x1121=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1211[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1121('0x0'));var util=require('util');var moment=require(_0x1121('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1121('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x1121('0x3'))(_0x1121('0x4'));var config=require(_0x1121('0x5'));var jayson=require(_0x1121('0x6'));var client=jayson[_0x1121('0x7')][_0x1121('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e2ddd,_0x3dbf65,_0x7901b3){return new BPromise(function(_0x15ee17,_0x59b870){return client[_0x1121('0x9')](_0x1e2ddd,_0x7901b3)[_0x1121('0xa')](function(_0x2a0e01){logger['info'](_0x1121('0xb'),_0x3dbf65,_0x1121('0xc'));logger[_0x1121('0xd')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3dbf65,'request\x20sent',JSON[_0x1121('0xe')](_0x2a0e01));if(_0x2a0e01['error']){if(_0x2a0e01[_0x1121('0xf')][_0x1121('0x10')]===0x1f4){logger[_0x1121('0xf')](_0x1121('0xb'),_0x3dbf65,_0x2a0e01['error']['message']);return _0x59b870(_0x2a0e01[_0x1121('0xf')][_0x1121('0x11')]);}logger[_0x1121('0xf')](_0x1121('0xb'),_0x3dbf65,_0x2a0e01['error'][_0x1121('0x11')]);return _0x15ee17(_0x2a0e01[_0x1121('0xf')][_0x1121('0x11')]);}else{logger[_0x1121('0x12')](_0x1121('0xb'),_0x3dbf65,_0x1121('0xc'));_0x15ee17(_0x2a0e01[_0x1121('0x13')][_0x1121('0x11')]);}})['catch'](function(_0x4256e5){logger[_0x1121('0xf')](_0x1121('0xb'),_0x3dbf65,_0x4256e5);_0x59b870(_0x4256e5);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 041bb6b..8908294 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 _0xc15c=['index','show','post','create','/:id','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../config/environment','isAuthenticated'];(function(_0x3633b0,_0x5ba87e){var _0x372e32=function(_0x48c5ac){while(--_0x48c5ac){_0x3633b0['push'](_0x3633b0['shift']());}};_0x372e32(++_0x5ba87e);}(_0xc15c,0xae));var _0xcc15=function(_0x89cfc4,_0x52f7a2){_0x89cfc4=_0x89cfc4-0x0;var _0x67c093=_0xc15c[_0x89cfc4];return _0x67c093;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcc15('0x0'));var timeout=require(_0xcc15('0x1'));var express=require(_0xcc15('0x2'));var router=express['Router']();var fs_extra=require(_0xcc15('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcc15('0x4'));var controller=require('./intZohoField.controller');router['get']('/',auth[_0xcc15('0x5')](),controller[_0xcc15('0x6')]);router['get']('/:id',auth[_0xcc15('0x5')](),controller[_0xcc15('0x7')]);router[_0xcc15('0x8')]('/',auth[_0xcc15('0x5')](),controller[_0xcc15('0x9')]);router['put'](_0xcc15('0xa'),auth[_0xcc15('0x5')](),controller[_0xcc15('0xb')]);router[_0xcc15('0xc')]('/:id',auth[_0xcc15('0x5')](),controller[_0xcc15('0xd')]);module[_0xcc15('0xe')]=router; \ No newline at end of file +var _0x5236=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5236,0x109));var _0x6523=function(_0x4a58fe,_0x37d1b8){_0x4a58fe=_0x4a58fe-0x0;var _0x29a6c9=_0x5236[_0x4a58fe];return _0x29a6c9;};'use strict';var multer=require(_0x6523('0x0'));var util=require(_0x6523('0x1'));var path=require(_0x6523('0x2'));var timeout=require(_0x6523('0x3'));var express=require(_0x6523('0x4'));var router=express['Router']();var fs_extra=require(_0x6523('0x5'));var auth=require(_0x6523('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6523('0x7'));var controller=require(_0x6523('0x8'));router[_0x6523('0x9')]('/',auth[_0x6523('0xa')](),controller[_0x6523('0xb')]);router['get'](_0x6523('0xc'),auth[_0x6523('0xa')](),controller[_0x6523('0xd')]);router['post']('/',auth[_0x6523('0xa')](),controller[_0x6523('0xe')]);router[_0x6523('0xf')](_0x6523('0xc'),auth[_0x6523('0xa')](),controller[_0x6523('0x10')]);router['delete'](_0x6523('0xc'),auth[_0x6523('0xa')](),controller[_0x6523('0x11')]);module[_0x6523('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index d1f8f92..0c84412 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 _0xb205=['sequelize','exports','ENUM','string','variable','picklist','STRING','customVariable'];(function(_0x48accc,_0x3142e9){var _0x460cc4=function(_0x4af897){while(--_0x4af897){_0x48accc['push'](_0x48accc['shift']());}};_0x460cc4(++_0x3142e9);}(_0xb205,0xf0));var _0x5b20=function(_0x4cc342,_0x134980){_0x4cc342=_0x4cc342-0x0;var _0x4ad315=_0xb205[_0x4cc342];return _0x4ad315;};'use strict';var Sequelize=require(_0x5b20('0x0'));module[_0x5b20('0x1')]={'type':{'type':Sequelize[_0x5b20('0x2')](_0x5b20('0x3'),_0x5b20('0x4'),'customVariable','keyValue',_0x5b20('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5b20('0x6')]},'key':{'type':Sequelize[_0x5b20('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x5b20('0x3'),_0x5b20('0x4'),_0x5b20('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5b20('0x6')]},'nameField':{'type':Sequelize[_0x5b20('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8664=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x4871a,_0x3fc52e){var _0x13e1e6=function(_0x3baf82){while(--_0x3baf82){_0x4871a['push'](_0x4871a['shift']());}};_0x13e1e6(++_0x3fc52e);}(_0x8664,0x11a));var _0x4866=function(_0x59b258,_0x1ff184){_0x59b258=_0x59b258-0x0;var _0x26ffcf=_0x8664[_0x59b258];return _0x26ffcf;};'use strict';var Sequelize=require(_0x4866('0x0'));module[_0x4866('0x1')]={'type':{'type':Sequelize[_0x4866('0x2')](_0x4866('0x3'),_0x4866('0x4'),_0x4866('0x5'),_0x4866('0x6'),_0x4866('0x7')),'defaultValue':_0x4866('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4866('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x4866('0x3'),_0x4866('0x4'),_0x4866('0x5'))},'keyContent':{'type':Sequelize[_0x4866('0x8')]},'idField':{'type':Sequelize[_0x4866('0x8')]},'nameField':{'type':Sequelize[_0x4866('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4866('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 42fabd2..3d10b0a 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 _0x78dc=['count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','pick','filter','merge','map','VIRTUAL','options','ZohoField','includeAll','show','params','intersection','include','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit'];(function(_0x2e2857,_0x2c8066){var _0x294569=function(_0x439aba){while(--_0x439aba){_0x2e2857['push'](_0x2e2857['shift']());}};_0x294569(++_0x2c8066);}(_0x78dc,0x75));var _0xc78d=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x78dc[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0xc78d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc78d('0x1'));var jsonpatch=require(_0xc78d('0x2'));var rp=require(_0xc78d('0x3'));var moment=require(_0xc78d('0x4'));var BPromise=require(_0xc78d('0x5'));var Mustache=require(_0xc78d('0x6'));var util=require(_0xc78d('0x7'));var path=require('path');var sox=require(_0xc78d('0x8'));var csv=require(_0xc78d('0x9'));var ejs=require(_0xc78d('0xa'));var fs=require('fs');var fs_extra=require(_0xc78d('0xb'));var _=require(_0xc78d('0xc'));var squel=require('squel');var crypto=require(_0xc78d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc78d('0xe'));var toCsv=require(_0xc78d('0x9'));var querystring=require(_0xc78d('0xf'));var Papa=require(_0xc78d('0x10'));var Redis=require(_0xc78d('0x11'));var authService=require(_0xc78d('0x12'));var qs=require(_0xc78d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc78d('0x14'));var logger=require(_0xc78d('0x15'))(_0xc78d('0x16'));var utils=require(_0xc78d('0x17'));var config=require(_0xc78d('0x18'));var licenseUtil=require(_0xc78d('0x19'));var db=require(_0xc78d('0x1a'))['db'];function respondWithStatusCode(_0x16b11f,_0x4afdc1){_0x4afdc1=_0x4afdc1||0xcc;return function(_0x171ade){if(_0x171ade){return _0x16b11f[_0xc78d('0x1b')](_0x4afdc1);}return _0x16b11f['status'](_0x4afdc1)['end']();};}function respondWithResult(_0x53727a,_0x559339){_0x559339=_0x559339||0xc8;return function(_0x2e316a){if(_0x2e316a){return _0x53727a[_0xc78d('0x1c')](_0x559339)[_0xc78d('0x1d')](_0x2e316a);}};}function respondWithFilteredResult(_0x4ea209,_0x2ebce4){return function(_0x2e97aa){if(_0x2e97aa){var _0x31da45=typeof _0x2ebce4[_0xc78d('0x1e')]===_0xc78d('0x1f')&&typeof _0x2ebce4[_0xc78d('0x20')]===_0xc78d('0x1f');var _0x239fc5=_0x2e97aa['count'];var _0x1690b4=_0x31da45?0x0:_0x2ebce4['offset'];var _0x25672e=_0x31da45?_0x2e97aa[_0xc78d('0x21')]:_0x2ebce4[_0xc78d('0x1e')]+_0x2ebce4[_0xc78d('0x20')];var _0x4d4ae4;if(_0x25672e>=_0x239fc5){_0x25672e=_0x239fc5;_0x4d4ae4=0xc8;}else{_0x4d4ae4=0xce;}_0x4ea209[_0xc78d('0x1c')](_0x4d4ae4);return _0x4ea209[_0xc78d('0x22')](_0xc78d('0x23'),_0x1690b4+'-'+_0x25672e+'/'+_0x239fc5)[_0xc78d('0x1d')](_0x2e97aa);}return null;};}function patchUpdates(_0x20b960){return function(_0x4592db){try{jsonpatch[_0xc78d('0x24')](_0x4592db,_0x20b960,!![]);}catch(_0x39b816){return BPromise[_0xc78d('0x25')](_0x39b816);}return _0x4592db[_0xc78d('0x26')]();};}function saveUpdates(_0x5395fc,_0x4bb343){return function(_0x215fa6){if(_0x215fa6){return _0x215fa6[_0xc78d('0x27')](_0x5395fc)[_0xc78d('0x28')](function(_0x221352){return _0x221352;});}return null;};}function removeEntity(_0x53fe8d,_0x400cd7){return function(_0x11100c){if(_0x11100c){return _0x11100c[_0xc78d('0x29')]()[_0xc78d('0x28')](function(){_0x53fe8d[_0xc78d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x589bb1,_0x6ab8b9){return function(_0x5c0ed0){if(!_0x5c0ed0){_0x589bb1[_0xc78d('0x1b')](0x194);}return _0x5c0ed0;};}function handleError(_0x54f45a,_0x4ae165){_0x4ae165=_0x4ae165||0x1f4;return function(_0x467b58){logger[_0xc78d('0x2a')](_0x467b58[_0xc78d('0x2b')]);if(_0x467b58[_0xc78d('0x2c')]){delete _0x467b58[_0xc78d('0x2c')];}_0x54f45a[_0xc78d('0x1c')](_0x4ae165)['send'](_0x467b58);};}exports[_0xc78d('0x2d')]=function(_0x301c81,_0x4ddc1b){var _0x2e6930={},_0x25c2f2={},_0x3ab6b6={'count':0x0,'rows':[]};var _0x59d89c=_['map'](db['ZohoField'][_0xc78d('0x2e')],function(_0x413bd5){return{'name':_0x413bd5[_0xc78d('0x2f')],'type':_0x413bd5[_0xc78d('0x30')][_0xc78d('0x31')]};});_0x25c2f2[_0xc78d('0x32')]=_['map'](_0x59d89c,'name');_0x25c2f2[_0xc78d('0x33')]=_[_0xc78d('0x34')](_0x301c81[_0xc78d('0x33')]);_0x25c2f2[_0xc78d('0x35')]=_['intersection'](_0x25c2f2[_0xc78d('0x32')],_0x25c2f2['query']);_0x2e6930[_0xc78d('0x36')]=_['intersection'](_0x25c2f2[_0xc78d('0x32')],qs[_0xc78d('0x37')](_0x301c81[_0xc78d('0x33')]['fields']));_0x2e6930[_0xc78d('0x36')]=_0x2e6930[_0xc78d('0x36')][_0xc78d('0x38')]?_0x2e6930[_0xc78d('0x36')]:_0x25c2f2[_0xc78d('0x32')];if(!_0x301c81[_0xc78d('0x33')][_0xc78d('0x39')]('nolimit')){_0x2e6930[_0xc78d('0x20')]=qs['limit'](_0x301c81[_0xc78d('0x33')][_0xc78d('0x20')]);_0x2e6930[_0xc78d('0x1e')]=qs[_0xc78d('0x1e')](_0x301c81[_0xc78d('0x33')][_0xc78d('0x1e')]);}_0x2e6930['order']=qs[_0xc78d('0x3a')](_0x301c81[_0xc78d('0x33')][_0xc78d('0x3a')]);_0x2e6930['where']=qs[_0xc78d('0x35')](_[_0xc78d('0x3b')](_0x301c81[_0xc78d('0x33')],_0x25c2f2[_0xc78d('0x35')]),_0x59d89c);if(_0x301c81[_0xc78d('0x33')][_0xc78d('0x3c')]){_0x2e6930['where']=_[_0xc78d('0x3d')](_0x2e6930['where'],{'$or':_[_0xc78d('0x3e')](_0x59d89c,function(_0x3cdf06){if(_0x3cdf06[_0xc78d('0x30')]!==_0xc78d('0x3f')){var _0x32ff3b={};_0x32ff3b[_0x3cdf06[_0xc78d('0x2c')]]={'$like':'%'+_0x301c81[_0xc78d('0x33')][_0xc78d('0x3c')]+'%'};return _0x32ff3b;}})});}_0x2e6930=_['merge']({},_0x2e6930,_0x301c81[_0xc78d('0x40')]);var _0x8bc091={'where':_0x2e6930['where']};return db[_0xc78d('0x41')][_0xc78d('0x21')](_0x8bc091)[_0xc78d('0x28')](function(_0x3bdd34){_0x3ab6b6[_0xc78d('0x21')]=_0x3bdd34;if(_0x301c81[_0xc78d('0x33')][_0xc78d('0x42')]){_0x2e6930['include']=[{'all':!![]}];}return db[_0xc78d('0x41')]['findAll'](_0x2e6930);})[_0xc78d('0x28')](function(_0x2daac7){_0x3ab6b6['rows']=_0x2daac7;return _0x3ab6b6;})['then'](respondWithFilteredResult(_0x4ddc1b,_0x2e6930))['catch'](handleError(_0x4ddc1b,null));};exports[_0xc78d('0x43')]=function(_0x33185c,_0x3cfe4a){var _0x23349c={'raw':!![],'where':{'id':_0x33185c[_0xc78d('0x44')]['id']}},_0x527110={};_0x527110[_0xc78d('0x32')]=_[_0xc78d('0x34')](db[_0xc78d('0x41')][_0xc78d('0x2e')]);_0x527110[_0xc78d('0x33')]=_[_0xc78d('0x34')](_0x33185c[_0xc78d('0x33')]);_0x527110[_0xc78d('0x35')]=_[_0xc78d('0x45')](_0x527110[_0xc78d('0x32')],_0x527110['query']);_0x23349c[_0xc78d('0x36')]=_[_0xc78d('0x45')](_0x527110[_0xc78d('0x32')],qs[_0xc78d('0x37')](_0x33185c[_0xc78d('0x33')][_0xc78d('0x37')]));_0x23349c[_0xc78d('0x36')]=_0x23349c['attributes'][_0xc78d('0x38')]?_0x23349c[_0xc78d('0x36')]:_0x527110[_0xc78d('0x32')];if(_0x33185c[_0xc78d('0x33')]['includeAll']){_0x23349c[_0xc78d('0x46')]=[{'all':!![]}];}_0x23349c=_[_0xc78d('0x3d')]({},_0x23349c,_0x33185c[_0xc78d('0x40')]);return db['ZohoField'][_0xc78d('0x47')](_0x23349c)[_0xc78d('0x28')](handleEntityNotFound(_0x3cfe4a,null))[_0xc78d('0x28')](respondWithResult(_0x3cfe4a,null))[_0xc78d('0x48')](handleError(_0x3cfe4a,null));};exports[_0xc78d('0x49')]=function(_0x24c2c8,_0x3ced92){return db[_0xc78d('0x41')][_0xc78d('0x49')](_0x24c2c8[_0xc78d('0x4a')],{})['then'](respondWithResult(_0x3ced92,0xc9))[_0xc78d('0x48')](handleError(_0x3ced92,null));};exports[_0xc78d('0x27')]=function(_0x24ffa8,_0x1817fb){if(_0x24ffa8[_0xc78d('0x4a')]['id']){delete _0x24ffa8[_0xc78d('0x4a')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x24ffa8[_0xc78d('0x44')]['id']}})[_0xc78d('0x28')](handleEntityNotFound(_0x1817fb,null))[_0xc78d('0x28')](saveUpdates(_0x24ffa8[_0xc78d('0x4a')],null))['then'](respondWithResult(_0x1817fb,null))['catch'](handleError(_0x1817fb,null));};exports[_0xc78d('0x29')]=function(_0xb52343,_0x203a49){return db['ZohoField'][_0xc78d('0x47')]({'where':{'id':_0xb52343['params']['id']}})[_0xc78d('0x28')](handleEntityNotFound(_0x203a49,null))[_0xc78d('0x28')](removeEntity(_0x203a49,null))['catch'](handleError(_0x203a49,null));}; \ No newline at end of file +var _0xf570=['pick','filter','merge','options','includeAll','include','catch','show','params','find','create','body','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','update','then','destroy','error','stack','name','send','map','ZohoField','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters'];(function(_0x1c22ac,_0x4c86bd){var _0x4c867a=function(_0x370c7d){while(--_0x370c7d){_0x1c22ac['push'](_0x1c22ac['shift']());}};_0x4c867a(++_0x4c86bd);}(_0xf570,0x160));var _0x0f57=function(_0x40db6b,_0x377f92){_0x40db6b=_0x40db6b-0x0;var _0x1071c8=_0xf570[_0x40db6b];return _0x1071c8;};'use strict';var emlformat=require(_0x0f57('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0f57('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f57('0x2'));var moment=require('moment');var BPromise=require(_0x0f57('0x3'));var Mustache=require(_0x0f57('0x4'));var util=require(_0x0f57('0x5'));var path=require(_0x0f57('0x6'));var sox=require('sox');var csv=require(_0x0f57('0x7'));var ejs=require(_0x0f57('0x8'));var fs=require('fs');var fs_extra=require(_0x0f57('0x9'));var _=require(_0x0f57('0xa'));var squel=require(_0x0f57('0xb'));var crypto=require(_0x0f57('0xc'));var jsforce=require(_0x0f57('0xd'));var deskjs=require(_0x0f57('0xe'));var toCsv=require(_0x0f57('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0f57('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0f57('0x10'));var hardwareService=require(_0x0f57('0x11'));var logger=require('../../config/logger')(_0x0f57('0x12'));var utils=require(_0x0f57('0x13'));var config=require(_0x0f57('0x14'));var licenseUtil=require(_0x0f57('0x15'));var db=require(_0x0f57('0x16'))['db'];function respondWithStatusCode(_0x543975,_0x54cc5f){_0x54cc5f=_0x54cc5f||0xcc;return function(_0x556a46){if(_0x556a46){return _0x543975[_0x0f57('0x17')](_0x54cc5f);}return _0x543975[_0x0f57('0x18')](_0x54cc5f)[_0x0f57('0x19')]();};}function respondWithResult(_0x3e7d25,_0x252469){_0x252469=_0x252469||0xc8;return function(_0x11b700){if(_0x11b700){return _0x3e7d25['status'](_0x252469)[_0x0f57('0x1a')](_0x11b700);}};}function respondWithFilteredResult(_0x259d11,_0x1c3bef){return function(_0x1b6056){if(_0x1b6056){var _0x5ef20d=typeof _0x1c3bef[_0x0f57('0x1b')]===_0x0f57('0x1c')&&typeof _0x1c3bef['limit']===_0x0f57('0x1c');var _0x3e4f97=_0x1b6056[_0x0f57('0x1d')];var _0x273c3b=_0x5ef20d?0x0:_0x1c3bef[_0x0f57('0x1b')];var _0x1758f0=_0x5ef20d?_0x1b6056[_0x0f57('0x1d')]:_0x1c3bef[_0x0f57('0x1b')]+_0x1c3bef[_0x0f57('0x1e')];var _0x5c1746;if(_0x1758f0>=_0x3e4f97){_0x1758f0=_0x3e4f97;_0x5c1746=0xc8;}else{_0x5c1746=0xce;}_0x259d11[_0x0f57('0x18')](_0x5c1746);return _0x259d11[_0x0f57('0x1f')]('Content-Range',_0x273c3b+'-'+_0x1758f0+'/'+_0x3e4f97)[_0x0f57('0x1a')](_0x1b6056);}return null;};}function patchUpdates(_0x584ca2){return function(_0x41f255){try{jsonpatch['apply'](_0x41f255,_0x584ca2,!![]);}catch(_0x151dd0){return BPromise['reject'](_0x151dd0);}return _0x41f255['save']();};}function saveUpdates(_0x5f0b2d,_0x285026){return function(_0x4adbc6){if(_0x4adbc6){return _0x4adbc6[_0x0f57('0x20')](_0x5f0b2d)[_0x0f57('0x21')](function(_0x594178){return _0x594178;});}return null;};}function removeEntity(_0x2cef00,_0x4b5e66){return function(_0x1b5782){if(_0x1b5782){return _0x1b5782[_0x0f57('0x22')]()[_0x0f57('0x21')](function(){_0x2cef00[_0x0f57('0x18')](0xcc)[_0x0f57('0x19')]();});}};}function handleEntityNotFound(_0x47e413,_0x813495){return function(_0x4549fc){if(!_0x4549fc){_0x47e413[_0x0f57('0x17')](0x194);}return _0x4549fc;};}function handleError(_0x3b5c47,_0x5691ea){_0x5691ea=_0x5691ea||0x1f4;return function(_0x1d3120){logger[_0x0f57('0x23')](_0x1d3120[_0x0f57('0x24')]);if(_0x1d3120[_0x0f57('0x25')]){delete _0x1d3120[_0x0f57('0x25')];}_0x3b5c47[_0x0f57('0x18')](_0x5691ea)[_0x0f57('0x26')](_0x1d3120);};}exports['index']=function(_0x3ebebe,_0x4d164a){var _0x7cd431={},_0xaa8c79={},_0x36676c={'count':0x0,'rows':[]};var _0xf34bfa=_[_0x0f57('0x27')](db[_0x0f57('0x28')][_0x0f57('0x29')],function(_0x24b873){return{'name':_0x24b873[_0x0f57('0x2a')],'type':_0x24b873[_0x0f57('0x2b')]['key']};});_0xaa8c79[_0x0f57('0x2c')]=_['map'](_0xf34bfa,_0x0f57('0x25'));_0xaa8c79['query']=_[_0x0f57('0x2d')](_0x3ebebe[_0x0f57('0x2e')]);_0xaa8c79['filters']=_[_0x0f57('0x2f')](_0xaa8c79[_0x0f57('0x2c')],_0xaa8c79[_0x0f57('0x2e')]);_0x7cd431['attributes']=_[_0x0f57('0x2f')](_0xaa8c79[_0x0f57('0x2c')],qs[_0x0f57('0x30')](_0x3ebebe[_0x0f57('0x2e')][_0x0f57('0x30')]));_0x7cd431[_0x0f57('0x31')]=_0x7cd431['attributes'][_0x0f57('0x32')]?_0x7cd431[_0x0f57('0x31')]:_0xaa8c79[_0x0f57('0x2c')];if(!_0x3ebebe[_0x0f57('0x2e')][_0x0f57('0x33')](_0x0f57('0x34'))){_0x7cd431[_0x0f57('0x1e')]=qs[_0x0f57('0x1e')](_0x3ebebe[_0x0f57('0x2e')][_0x0f57('0x1e')]);_0x7cd431['offset']=qs[_0x0f57('0x1b')](_0x3ebebe[_0x0f57('0x2e')][_0x0f57('0x1b')]);}_0x7cd431['order']=qs[_0x0f57('0x35')](_0x3ebebe['query'][_0x0f57('0x35')]);_0x7cd431[_0x0f57('0x36')]=qs[_0x0f57('0x37')](_[_0x0f57('0x38')](_0x3ebebe[_0x0f57('0x2e')],_0xaa8c79[_0x0f57('0x37')]),_0xf34bfa);if(_0x3ebebe['query'][_0x0f57('0x39')]){_0x7cd431[_0x0f57('0x36')]=_[_0x0f57('0x3a')](_0x7cd431[_0x0f57('0x36')],{'$or':_[_0x0f57('0x27')](_0xf34bfa,function(_0x115b97){if(_0x115b97['type']!=='VIRTUAL'){var _0x313e84={};_0x313e84[_0x115b97[_0x0f57('0x25')]]={'$like':'%'+_0x3ebebe[_0x0f57('0x2e')][_0x0f57('0x39')]+'%'};return _0x313e84;}})});}_0x7cd431=_['merge']({},_0x7cd431,_0x3ebebe[_0x0f57('0x3b')]);var _0x19706f={'where':_0x7cd431[_0x0f57('0x36')]};return db['ZohoField'][_0x0f57('0x1d')](_0x19706f)[_0x0f57('0x21')](function(_0x336d20){_0x36676c[_0x0f57('0x1d')]=_0x336d20;if(_0x3ebebe[_0x0f57('0x2e')][_0x0f57('0x3c')]){_0x7cd431[_0x0f57('0x3d')]=[{'all':!![]}];}return db[_0x0f57('0x28')]['findAll'](_0x7cd431);})[_0x0f57('0x21')](function(_0x447a6b){_0x36676c['rows']=_0x447a6b;return _0x36676c;})[_0x0f57('0x21')](respondWithFilteredResult(_0x4d164a,_0x7cd431))[_0x0f57('0x3e')](handleError(_0x4d164a,null));};exports[_0x0f57('0x3f')]=function(_0x55c52e,_0x6ac706){var _0x4af2f1={'raw':!![],'where':{'id':_0x55c52e[_0x0f57('0x40')]['id']}},_0x431d57={};_0x431d57['model']=_[_0x0f57('0x2d')](db[_0x0f57('0x28')][_0x0f57('0x29')]);_0x431d57['query']=_['keys'](_0x55c52e[_0x0f57('0x2e')]);_0x431d57[_0x0f57('0x37')]=_[_0x0f57('0x2f')](_0x431d57[_0x0f57('0x2c')],_0x431d57[_0x0f57('0x2e')]);_0x4af2f1[_0x0f57('0x31')]=_[_0x0f57('0x2f')](_0x431d57['model'],qs[_0x0f57('0x30')](_0x55c52e[_0x0f57('0x2e')][_0x0f57('0x30')]));_0x4af2f1[_0x0f57('0x31')]=_0x4af2f1['attributes'][_0x0f57('0x32')]?_0x4af2f1[_0x0f57('0x31')]:_0x431d57['model'];if(_0x55c52e['query']['includeAll']){_0x4af2f1[_0x0f57('0x3d')]=[{'all':!![]}];}_0x4af2f1=_[_0x0f57('0x3a')]({},_0x4af2f1,_0x55c52e[_0x0f57('0x3b')]);return db[_0x0f57('0x28')][_0x0f57('0x41')](_0x4af2f1)[_0x0f57('0x21')](handleEntityNotFound(_0x6ac706,null))[_0x0f57('0x21')](respondWithResult(_0x6ac706,null))[_0x0f57('0x3e')](handleError(_0x6ac706,null));};exports[_0x0f57('0x42')]=function(_0x1b0638,_0x3d2858){return db[_0x0f57('0x28')][_0x0f57('0x42')](_0x1b0638['body'],{})[_0x0f57('0x21')](respondWithResult(_0x3d2858,0xc9))[_0x0f57('0x3e')](handleError(_0x3d2858,null));};exports[_0x0f57('0x20')]=function(_0x3b7c83,_0x51771b){if(_0x3b7c83[_0x0f57('0x43')]['id']){delete _0x3b7c83[_0x0f57('0x43')]['id'];}return db[_0x0f57('0x28')]['find']({'where':{'id':_0x3b7c83['params']['id']}})[_0x0f57('0x21')](handleEntityNotFound(_0x51771b,null))[_0x0f57('0x21')](saveUpdates(_0x3b7c83[_0x0f57('0x43')],null))[_0x0f57('0x21')](respondWithResult(_0x51771b,null))[_0x0f57('0x3e')](handleError(_0x51771b,null));};exports['destroy']=function(_0xda3aaf,_0x512f57){return db[_0x0f57('0x28')]['find']({'where':{'id':_0xda3aaf[_0x0f57('0x40')]['id']}})[_0x0f57('0x21')](handleEntityNotFound(_0x512f57,null))[_0x0f57('0x21')](removeEntity(_0x512f57,null))[_0x0f57('0x3e')](handleError(_0x512f57,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index d5dc5ec..82d51aa 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 _0x9f35=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','ZohoField','int_zoho_fields','FieldId','lodash','util','../../config/logger','api'];(function(_0x208a98,_0x2c9406){var _0x3eee28=function(_0x26fd68){while(--_0x26fd68){_0x208a98['push'](_0x208a98['shift']());}};_0x3eee28(++_0x2c9406);}(_0x9f35,0x1ca));var _0x59f3=function(_0x12eb95,_0x2884e2){_0x12eb95=_0x12eb95-0x0;var _0x31e16b=_0x9f35[_0x12eb95];return _0x31e16b;};'use strict';var _=require(_0x59f3('0x0'));var util=require(_0x59f3('0x1'));var logger=require(_0x59f3('0x2'))(_0x59f3('0x3'));var moment=require(_0x59f3('0x4'));var BPromise=require(_0x59f3('0x5'));var rp=require(_0x59f3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x59f3('0x7'));var config=require(_0x59f3('0x8'));var attributes=require('./intZohoField.attributes');module[_0x59f3('0x9')]=function(_0x2baa6f,_0x362e61){return _0x2baa6f[_0x59f3('0xa')](_0x59f3('0xb'),attributes,{'tableName':_0x59f3('0xc'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x59f3('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x07c9=['int_zoho_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x07c9,0x179));var _0x907c=function(_0x4c6325,_0x4b9b56){_0x4c6325=_0x4c6325-0x0;var _0x12544b=_0x07c9[_0x4c6325];return _0x12544b;};'use strict';var _=require(_0x907c('0x0'));var util=require(_0x907c('0x1'));var logger=require(_0x907c('0x2'))(_0x907c('0x3'));var moment=require(_0x907c('0x4'));var BPromise=require(_0x907c('0x5'));var rp=require(_0x907c('0x6'));var fs=require('fs');var path=require(_0x907c('0x7'));var rimraf=require(_0x907c('0x8'));var config=require(_0x907c('0x9'));var attributes=require(_0x907c('0xa'));module[_0x907c('0xb')]=function(_0x4554f8,_0x370cbf){return _0x4554f8[_0x907c('0xc')](_0x907c('0xd'),attributes,{'tableName':_0x907c('0xe'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x907c('0xf'),_0x907c('0x10')],'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 2547ec6..992dc55 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 _0xf2ca=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x29eb10,_0x190cb3){var _0x5371a2=function(_0x3109ea){while(--_0x3109ea){_0x29eb10['push'](_0x29eb10['shift']());}};_0x5371a2(++_0x190cb3);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x11dde4,_0x1d4852){_0x11dde4=_0x11dde4-0x0;var _0x6eea94=_0xf2ca[_0x11dde4];return _0x6eea94;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var moment=require(_0xaf2c('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf2c('0x3'));var fs=require('fs');var Redis=require(_0xaf2c('0x4'));var db=require(_0xaf2c('0x5'))['db'];var utils=require(_0xaf2c('0x6'));var logger=require(_0xaf2c('0x7'))(_0xaf2c('0x8'));var config=require('../../config/environment');var jayson=require(_0xaf2c('0x9'));var client=jayson[_0xaf2c('0xa')][_0xaf2c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f9531,_0x58351f,_0x37fedd){return new BPromise(function(_0x3c0421,_0x4a7397){return client[_0xaf2c('0xc')](_0x1f9531,_0x37fedd)['then'](function(_0x439ca3){logger['info'](_0xaf2c('0xd'),_0x58351f,_0xaf2c('0xe'));logger[_0xaf2c('0xf')](_0xaf2c('0x10'),_0x58351f,'request\x20sent',JSON['stringify'](_0x439ca3));if(_0x439ca3[_0xaf2c('0x11')]){if(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x12')]===0x1f4){logger[_0xaf2c('0x11')](_0xaf2c('0xd'),_0x58351f,_0x439ca3['error']['message']);return _0x4a7397(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);}logger[_0xaf2c('0x11')](_0xaf2c('0xd'),_0x58351f,_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);return _0x3c0421(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);}else{logger[_0xaf2c('0x14')](_0xaf2c('0xd'),_0x58351f,_0xaf2c('0xe'));_0x3c0421(_0x439ca3[_0xaf2c('0x15')][_0xaf2c('0x13')]);}})[_0xaf2c('0x16')](function(_0x705d09){logger['error'](_0xaf2c('0xd'),_0x58351f,_0x705d09);_0x4a7397(_0x705d09);});});} \ No newline at end of file +var _0x2d17=['ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1f404a,_0x5088b2){var _0x2cdcd5=function(_0xe30d8c){while(--_0xe30d8c){_0x1f404a['push'](_0x1f404a['shift']());}};_0x2cdcd5(++_0x5088b2);}(_0x2d17,0x17e));var _0x72d1=function(_0x57db93,_0x49661b){_0x57db93=_0x57db93-0x0;var _0x130f35=_0x2d17[_0x57db93];return _0x130f35;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var moment=require('moment');var BPromise=require(_0x72d1('0x2'));var rs=require(_0x72d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d1('0x4'))['db'];var utils=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72d1('0x7'));var client=jayson['client'][_0x72d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x239d1f,_0x5b40a9,_0x477264){return new BPromise(function(_0x422f5a,_0x19e248){return client['request'](_0x239d1f,_0x477264)[_0x72d1('0x9')](function(_0x288362){logger[_0x72d1('0xa')]('ZohoField,\x20%s,\x20%s',_0x5b40a9,_0x72d1('0xb'));logger[_0x72d1('0xc')](_0x72d1('0xd'),_0x5b40a9,_0x72d1('0xb'),JSON[_0x72d1('0xe')](_0x288362));if(_0x288362[_0x72d1('0xf')]){if(_0x288362[_0x72d1('0xf')][_0x72d1('0x10')]===0x1f4){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362['error'][_0x72d1('0x12')]);return _0x19e248(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);return _0x422f5a(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}else{logger[_0x72d1('0xa')](_0x72d1('0x11'),_0x5b40a9,_0x72d1('0xb'));_0x422f5a(_0x288362[_0x72d1('0x13')]['message']);}})[_0x72d1('0x14')](function(_0x5262b0){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x5262b0);_0x19e248(_0x5262b0);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index d42a1b5..dc0a88b 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 _0x0457=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','util'];(function(_0x34f267,_0x5e9456){var _0x50574a=function(_0x167ea1){while(--_0x167ea1){_0x34f267['push'](_0x34f267['shift']());}};_0x50574a(++_0x5e9456);}(_0x0457,0x11f));var _0x7045=function(_0x32d9ec,_0x4e9ad8){_0x32d9ec=_0x32d9ec-0x0;var _0x2ba2d7=_0x0457[_0x32d9ec];return _0x2ba2d7;};'use strict';var multer=require('multer');var util=require(_0x7045('0x0'));var path=require(_0x7045('0x1'));var timeout=require('connect-timeout');var express=require(_0x7045('0x2'));var router=express[_0x7045('0x3')]();var fs_extra=require(_0x7045('0x4'));var auth=require(_0x7045('0x5'));var interaction=require(_0x7045('0x6'));var config=require(_0x7045('0x7'));module['exports']=router; \ No newline at end of file +var _0x2c91=['../../components/auth/service','../../config/environment','util','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c91,0xe0));var _0x12c9=function(_0x3e1ec5,_0x2a695f){_0x3e1ec5=_0x3e1ec5-0x0;var _0x1118cf=_0x2c91[_0x3e1ec5];return _0x1118cf;};'use strict';var multer=require('multer');var util=require(_0x12c9('0x0'));var path=require('path');var timeout=require(_0x12c9('0x1'));var express=require(_0x12c9('0x2'));var router=express[_0x12c9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x12c9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x12c9('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index e8fc7a7..4ff7e0d 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 _0x2f92=['BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x562faa,_0x23adc7){var _0xc70f59=function(_0x2d7dec){while(--_0x2d7dec){_0x562faa['push'](_0x562faa['shift']());}};_0xc70f59(++_0x23adc7);}(_0x2f92,0x18a));var _0x22f9=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x2f92[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require(_0x22f9('0x0'));module[_0x22f9('0x1')]={'name':{'type':Sequelize[_0x22f9('0x2')],'allowNull':![],'unique':_0x22f9('0x3')},'version':{'type':Sequelize[_0x22f9('0x2')],'allowNull':![],'unique':_0x22f9('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x22f9('0x4')},'filename':{'type':Sequelize[_0x22f9('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x22f9('0x5')]},'active':{'type':Sequelize[_0x22f9('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x22f9('0x2')]},'logo':{'type':Sequelize[_0x22f9('0x2')]},'state':{'type':Sequelize[_0x22f9('0x2')],'unique':_0x22f9('0x7')},'description':{'type':Sequelize[_0x22f9('0x2')]},'title':{'type':Sequelize[_0x22f9('0x2')]},'remoteUri':{'type':Sequelize[_0x22f9('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x5a9a=['INTEGER','BOOLEAN','sequelize','exports','unique_name_and_version','STRING','app.js'];(function(_0x18f8d3,_0x55bac8){var _0x46d055=function(_0x202721){while(--_0x202721){_0x18f8d3['push'](_0x18f8d3['shift']());}};_0x46d055(++_0x55bac8);}(_0x5a9a,0x9c));var _0xa5a9=function(_0x2f0e9c,_0x369f99){_0x2f0e9c=_0x2f0e9c-0x0;var _0x304209=_0x5a9a[_0x2f0e9c];return _0x304209;};'use strict';var Sequelize=require(_0xa5a9('0x0'));module[_0xa5a9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa5a9('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa5a9('0x2')},'main':{'type':Sequelize[_0xa5a9('0x3')],'defaultValue':_0xa5a9('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xa5a9('0x3')]},'type':{'type':Sequelize[_0xa5a9('0x3')]},'size':{'type':Sequelize[_0xa5a9('0x5')]},'active':{'type':Sequelize[_0xa5a9('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xa5a9('0x3')]},'state':{'type':Sequelize[_0xa5a9('0x3')],'unique':'state'},'description':{'type':Sequelize[_0xa5a9('0x3')]},'title':{'type':Sequelize[_0xa5a9('0x3')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xa5a9('0x3')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 0c427bb..189536b 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 _0xbad8=['squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','limit','count','offset','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','fields','attributes','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','Integration','includeAll','include','findAll','rows','params','keys','find','catch','create','update','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x26d6d3,_0x294128){var _0x44cc7a=function(_0xc5a309){while(--_0xc5a309){_0x26d6d3['push'](_0x26d6d3['shift']());}};_0x44cc7a(++_0x294128);}(_0xbad8,0x14c));var _0x8bad=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0xbad8[_0x1ab180];return _0xfb2c2d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8bad('0x0'));var zipdir=require(_0x8bad('0x1'));var jsonpatch=require(_0x8bad('0x2'));var rp=require(_0x8bad('0x3'));var moment=require(_0x8bad('0x4'));var BPromise=require(_0x8bad('0x5'));var Mustache=require(_0x8bad('0x6'));var util=require(_0x8bad('0x7'));var path=require(_0x8bad('0x8'));var sox=require(_0x8bad('0x9'));var csv=require(_0x8bad('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8bad('0xb'));var _=require(_0x8bad('0xc'));var squel=require(_0x8bad('0xd'));var crypto=require('crypto');var jsforce=require(_0x8bad('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8bad('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8bad('0xf'));var authService=require(_0x8bad('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8bad('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8bad('0x12'))(_0x8bad('0x13'));var utils=require(_0x8bad('0x14'));var config=require(_0x8bad('0x15'));var licenseUtil=require(_0x8bad('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8a99af,_0x59c02e){_0x59c02e=_0x59c02e||0xcc;return function(_0x4b3447){if(_0x4b3447){return _0x8a99af['sendStatus'](_0x59c02e);}return _0x8a99af[_0x8bad('0x17')](_0x59c02e)['end']();};}function respondWithResult(_0x53782e,_0x5e86b3){_0x5e86b3=_0x5e86b3||0xc8;return function(_0x4a8160){if(_0x4a8160){return _0x53782e['status'](_0x5e86b3)[_0x8bad('0x18')](_0x4a8160);}};}function respondWithFilteredResult(_0x146376,_0x188871){return function(_0x1041a0){if(_0x1041a0){var _0x46d8bf=typeof _0x188871['offset']==='undefined'&&typeof _0x188871[_0x8bad('0x19')]==='undefined';var _0x3497e9=_0x1041a0[_0x8bad('0x1a')];var _0x139b38=_0x46d8bf?0x0:_0x188871['offset'];var _0x411459=_0x46d8bf?_0x1041a0[_0x8bad('0x1a')]:_0x188871[_0x8bad('0x1b')]+_0x188871[_0x8bad('0x19')];var _0x64000;if(_0x411459>=_0x3497e9){_0x411459=_0x3497e9;_0x64000=0xc8;}else{_0x64000=0xce;}_0x146376[_0x8bad('0x17')](_0x64000);return _0x146376[_0x8bad('0x1c')](_0x8bad('0x1d'),_0x139b38+'-'+_0x411459+'/'+_0x3497e9)[_0x8bad('0x18')](_0x1041a0);}return null;};}function patchUpdates(_0x265a9e){return function(_0x4b6182){try{jsonpatch[_0x8bad('0x1e')](_0x4b6182,_0x265a9e,!![]);}catch(_0x2a1007){return BPromise['reject'](_0x2a1007);}return _0x4b6182[_0x8bad('0x1f')]();};}function saveUpdates(_0x9e231c,_0x2513fb){return function(_0x442cdd){if(_0x442cdd){return _0x442cdd['update'](_0x9e231c)['then'](function(_0x5a0f30){return _0x5a0f30;});}return null;};}function removeEntity(_0x3bc24a,_0xc0a9c3){return function(_0x169f4c){if(_0x169f4c){return _0x169f4c[_0x8bad('0x20')]()[_0x8bad('0x21')](function(){_0x3bc24a[_0x8bad('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4911f5,_0x384552){return function(_0x1d739f){if(!_0x1d739f){_0x4911f5['sendStatus'](0x194);}return _0x1d739f;};}function handleError(_0x548df0,_0x443868){_0x443868=_0x443868||0x1f4;return function(_0x10be71){logger[_0x8bad('0x22')](_0x10be71[_0x8bad('0x23')]);if(_0x10be71[_0x8bad('0x24')]){delete _0x10be71['name'];}_0x548df0['status'](_0x443868)[_0x8bad('0x25')](_0x10be71);};}exports[_0x8bad('0x26')]=function(_0x285585,_0xa311f8){var _0x12ed4d={},_0x1bccc3={},_0x212646={'count':0x0,'rows':[]};var _0x4b3915=_[_0x8bad('0x27')](db['Integration'][_0x8bad('0x28')],function(_0x1f1403){return{'name':_0x1f1403['fieldName'],'type':_0x1f1403[_0x8bad('0x29')][_0x8bad('0x2a')]};});_0x1bccc3[_0x8bad('0x2b')]=_[_0x8bad('0x27')](_0x4b3915,_0x8bad('0x24'));_0x1bccc3[_0x8bad('0x2c')]=_['keys'](_0x285585['query']);_0x1bccc3['filters']=_[_0x8bad('0x2d')](_0x1bccc3[_0x8bad('0x2b')],_0x1bccc3['query']);_0x12ed4d['attributes']=_[_0x8bad('0x2d')](_0x1bccc3['model'],qs[_0x8bad('0x2e')](_0x285585[_0x8bad('0x2c')][_0x8bad('0x2e')]));_0x12ed4d[_0x8bad('0x2f')]=_0x12ed4d[_0x8bad('0x2f')][_0x8bad('0x30')]?_0x12ed4d[_0x8bad('0x2f')]:_0x1bccc3[_0x8bad('0x2b')];if(!_0x285585[_0x8bad('0x2c')]['hasOwnProperty']('nolimit')){_0x12ed4d[_0x8bad('0x19')]=qs['limit'](_0x285585[_0x8bad('0x2c')]['limit']);_0x12ed4d[_0x8bad('0x1b')]=qs[_0x8bad('0x1b')](_0x285585[_0x8bad('0x2c')][_0x8bad('0x1b')]);}_0x12ed4d[_0x8bad('0x31')]=qs[_0x8bad('0x32')](_0x285585[_0x8bad('0x2c')][_0x8bad('0x32')]);_0x12ed4d[_0x8bad('0x33')]=qs[_0x8bad('0x34')](_[_0x8bad('0x35')](_0x285585[_0x8bad('0x2c')],_0x1bccc3[_0x8bad('0x34')]),_0x4b3915);if(_0x285585[_0x8bad('0x2c')]['filter']){_0x12ed4d[_0x8bad('0x33')]=_[_0x8bad('0x36')](_0x12ed4d[_0x8bad('0x33')],{'$or':_[_0x8bad('0x27')](_0x4b3915,function(_0x47fa03){if(_0x47fa03['type']!==_0x8bad('0x37')){var _0x2c00b3={};_0x2c00b3[_0x47fa03[_0x8bad('0x24')]]={'$like':'%'+_0x285585[_0x8bad('0x2c')][_0x8bad('0x38')]+'%'};return _0x2c00b3;}})});}_0x12ed4d=_[_0x8bad('0x36')]({},_0x12ed4d,_0x285585['options']);var _0x373fab={'where':_0x12ed4d['where']};return db[_0x8bad('0x39')][_0x8bad('0x1a')](_0x373fab)[_0x8bad('0x21')](function(_0x11bb5a){_0x212646['count']=_0x11bb5a;if(_0x285585[_0x8bad('0x2c')][_0x8bad('0x3a')]){_0x12ed4d[_0x8bad('0x3b')]=[{'all':!![]}];}return db['Integration'][_0x8bad('0x3c')](_0x12ed4d);})[_0x8bad('0x21')](function(_0x1bbeaa){_0x212646[_0x8bad('0x3d')]=_0x1bbeaa;return _0x212646;})[_0x8bad('0x21')](respondWithFilteredResult(_0xa311f8,_0x12ed4d))['catch'](handleError(_0xa311f8,null));};exports['show']=function(_0x64c54,_0x4d6db9){var _0x4be880={'raw':![],'where':{'id':_0x64c54[_0x8bad('0x3e')]['id']}},_0x4d3376={};_0x4d3376['model']=_[_0x8bad('0x3f')](db[_0x8bad('0x39')][_0x8bad('0x28')]);_0x4d3376[_0x8bad('0x2c')]=_[_0x8bad('0x3f')](_0x64c54[_0x8bad('0x2c')]);_0x4d3376[_0x8bad('0x34')]=_[_0x8bad('0x2d')](_0x4d3376[_0x8bad('0x2b')],_0x4d3376['query']);_0x4be880[_0x8bad('0x2f')]=_[_0x8bad('0x2d')](_0x4d3376[_0x8bad('0x2b')],qs[_0x8bad('0x2e')](_0x64c54['query'][_0x8bad('0x2e')]));_0x4be880[_0x8bad('0x2f')]=_0x4be880[_0x8bad('0x2f')][_0x8bad('0x30')]?_0x4be880['attributes']:_0x4d3376[_0x8bad('0x2b')];if(_0x64c54[_0x8bad('0x2c')][_0x8bad('0x3a')]){_0x4be880[_0x8bad('0x3b')]=[{'all':!![]}];}_0x4be880=_[_0x8bad('0x36')]({},_0x4be880,_0x64c54['options']);return db[_0x8bad('0x39')][_0x8bad('0x40')](_0x4be880)[_0x8bad('0x21')](handleEntityNotFound(_0x4d6db9,null))['then'](respondWithResult(_0x4d6db9,null))[_0x8bad('0x41')](handleError(_0x4d6db9,null));};exports['create']=function(_0x528673,_0x3b82e4){return db[_0x8bad('0x39')][_0x8bad('0x42')](_0x528673['body'],{})[_0x8bad('0x21')](respondWithResult(_0x3b82e4,0xc9))[_0x8bad('0x41')](handleError(_0x3b82e4,null));};exports[_0x8bad('0x43')]=function(_0x80abef,_0x29ed82){if(_0x80abef['body']['id']){delete _0x80abef[_0x8bad('0x44')]['id'];}return db[_0x8bad('0x39')][_0x8bad('0x40')]({'where':{'id':_0x80abef[_0x8bad('0x3e')]['id']}})[_0x8bad('0x21')](handleEntityNotFound(_0x29ed82,null))[_0x8bad('0x21')](saveUpdates(_0x80abef[_0x8bad('0x44')],null))[_0x8bad('0x21')](respondWithResult(_0x29ed82,null))['catch'](handleError(_0x29ed82,null));};exports[_0x8bad('0x20')]=function(_0x5c9bab,_0xa95c12){return db[_0x8bad('0x39')][_0x8bad('0x40')]({'where':{'id':_0x5c9bab[_0x8bad('0x3e')]['id']}})[_0x8bad('0x21')](handleEntityNotFound(_0xa95c12,null))[_0x8bad('0x21')](removeEntity(_0xa95c12,null))['catch'](handleError(_0xa95c12,null));}; \ No newline at end of file +var _0xc694=['limit','set','Content-Range','json','apply','reject','sendStatus','error','stack','name','map','Integration','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','filter','options','then','includeAll','include','catch','show','params','keys','find','create','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','count'];(function(_0x1b6294,_0x179c76){var _0x43335a=function(_0x238a23){while(--_0x238a23){_0x1b6294['push'](_0x1b6294['shift']());}};_0x43335a(++_0x179c76);}(_0xc694,0x1da));var _0x4c69=function(_0x3e8cae,_0x4cb96a){_0x3e8cae=_0x3e8cae-0x0;var _0x45c4d6=_0xc694[_0x3e8cae];return _0x45c4d6;};'use strict';var emlformat=require(_0x4c69('0x0'));var rimraf=require(_0x4c69('0x1'));var zipdir=require(_0x4c69('0x2'));var jsonpatch=require(_0x4c69('0x3'));var rp=require(_0x4c69('0x4'));var moment=require('moment');var BPromise=require(_0x4c69('0x5'));var Mustache=require(_0x4c69('0x6'));var util=require(_0x4c69('0x7'));var path=require(_0x4c69('0x8'));var sox=require(_0x4c69('0x9'));var csv=require(_0x4c69('0xa'));var ejs=require(_0x4c69('0xb'));var fs=require('fs');var fs_extra=require(_0x4c69('0xc'));var _=require('lodash');var squel=require(_0x4c69('0xd'));var crypto=require('crypto');var jsforce=require(_0x4c69('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4c69('0xa'));var querystring=require(_0x4c69('0xf'));var Papa=require('papaparse');var Redis=require(_0x4c69('0x10'));var authService=require(_0x4c69('0x11'));var qs=require(_0x4c69('0x12'));var as=require(_0x4c69('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c69('0x14'))(_0x4c69('0x15'));var utils=require(_0x4c69('0x16'));var config=require(_0x4c69('0x17'));var licenseUtil=require(_0x4c69('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x435e4a,_0x1ce35f){_0x1ce35f=_0x1ce35f||0xcc;return function(_0x16e965){if(_0x16e965){return _0x435e4a['sendStatus'](_0x1ce35f);}return _0x435e4a[_0x4c69('0x19')](_0x1ce35f)[_0x4c69('0x1a')]();};}function respondWithResult(_0x4e38bd,_0x34df9e){_0x34df9e=_0x34df9e||0xc8;return function(_0x1aa3b6){if(_0x1aa3b6){return _0x4e38bd[_0x4c69('0x19')](_0x34df9e)['json'](_0x1aa3b6);}};}function respondWithFilteredResult(_0xa54050,_0x5eed13){return function(_0x47f1fa){if(_0x47f1fa){var _0x512cee=typeof _0x5eed13[_0x4c69('0x1b')]===_0x4c69('0x1c')&&typeof _0x5eed13['limit']===_0x4c69('0x1c');var _0x36cf56=_0x47f1fa[_0x4c69('0x1d')];var _0x574af3=_0x512cee?0x0:_0x5eed13['offset'];var _0x24570a=_0x512cee?_0x47f1fa[_0x4c69('0x1d')]:_0x5eed13[_0x4c69('0x1b')]+_0x5eed13[_0x4c69('0x1e')];var _0x4eb4c4;if(_0x24570a>=_0x36cf56){_0x24570a=_0x36cf56;_0x4eb4c4=0xc8;}else{_0x4eb4c4=0xce;}_0xa54050['status'](_0x4eb4c4);return _0xa54050[_0x4c69('0x1f')](_0x4c69('0x20'),_0x574af3+'-'+_0x24570a+'/'+_0x36cf56)[_0x4c69('0x21')](_0x47f1fa);}return null;};}function patchUpdates(_0x286783){return function(_0x532edf){try{jsonpatch[_0x4c69('0x22')](_0x532edf,_0x286783,!![]);}catch(_0x5bd874){return BPromise[_0x4c69('0x23')](_0x5bd874);}return _0x532edf['save']();};}function saveUpdates(_0x873bd5,_0xa4995f){return function(_0x2eba82){if(_0x2eba82){return _0x2eba82['update'](_0x873bd5)['then'](function(_0x46ef3d){return _0x46ef3d;});}return null;};}function removeEntity(_0x2b0a57,_0x182f39){return function(_0xd6d3b9){if(_0xd6d3b9){return _0xd6d3b9['destroy']()['then'](function(){_0x2b0a57[_0x4c69('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48f7ee,_0xf5845){return function(_0x15f2ac){if(!_0x15f2ac){_0x48f7ee[_0x4c69('0x24')](0x194);}return _0x15f2ac;};}function handleError(_0xfbd7f8,_0x16d044){_0x16d044=_0x16d044||0x1f4;return function(_0x1ec7d8){logger[_0x4c69('0x25')](_0x1ec7d8[_0x4c69('0x26')]);if(_0x1ec7d8[_0x4c69('0x27')]){delete _0x1ec7d8[_0x4c69('0x27')];}_0xfbd7f8[_0x4c69('0x19')](_0x16d044)['send'](_0x1ec7d8);};}exports['index']=function(_0x389015,_0x5ade99){var _0x40bd83={},_0x515273={},_0x2357da={'count':0x0,'rows':[]};var _0x354211=_[_0x4c69('0x28')](db[_0x4c69('0x29')][_0x4c69('0x2a')],function(_0x5085aa){return{'name':_0x5085aa[_0x4c69('0x2b')],'type':_0x5085aa[_0x4c69('0x2c')][_0x4c69('0x2d')]};});_0x515273['model']=_[_0x4c69('0x28')](_0x354211,_0x4c69('0x27'));_0x515273[_0x4c69('0x2e')]=_['keys'](_0x389015[_0x4c69('0x2e')]);_0x515273[_0x4c69('0x2f')]=_[_0x4c69('0x30')](_0x515273[_0x4c69('0x31')],_0x515273[_0x4c69('0x2e')]);_0x40bd83[_0x4c69('0x32')]=_[_0x4c69('0x30')](_0x515273['model'],qs[_0x4c69('0x33')](_0x389015[_0x4c69('0x2e')][_0x4c69('0x33')]));_0x40bd83[_0x4c69('0x32')]=_0x40bd83[_0x4c69('0x32')][_0x4c69('0x34')]?_0x40bd83[_0x4c69('0x32')]:_0x515273[_0x4c69('0x31')];if(!_0x389015[_0x4c69('0x2e')][_0x4c69('0x35')]('nolimit')){_0x40bd83['limit']=qs['limit'](_0x389015[_0x4c69('0x2e')]['limit']);_0x40bd83[_0x4c69('0x1b')]=qs['offset'](_0x389015[_0x4c69('0x2e')][_0x4c69('0x1b')]);}_0x40bd83['order']=qs['sort'](_0x389015[_0x4c69('0x2e')][_0x4c69('0x36')]);_0x40bd83[_0x4c69('0x37')]=qs[_0x4c69('0x2f')](_[_0x4c69('0x38')](_0x389015[_0x4c69('0x2e')],_0x515273[_0x4c69('0x2f')]),_0x354211);if(_0x389015[_0x4c69('0x2e')]['filter']){_0x40bd83[_0x4c69('0x37')]=_[_0x4c69('0x39')](_0x40bd83[_0x4c69('0x37')],{'$or':_[_0x4c69('0x28')](_0x354211,function(_0x144196){if(_0x144196['type']!=='VIRTUAL'){var _0x5403ea={};_0x5403ea[_0x144196[_0x4c69('0x27')]]={'$like':'%'+_0x389015[_0x4c69('0x2e')][_0x4c69('0x3a')]+'%'};return _0x5403ea;}})});}_0x40bd83=_[_0x4c69('0x39')]({},_0x40bd83,_0x389015[_0x4c69('0x3b')]);var _0x5a1abe={'where':_0x40bd83[_0x4c69('0x37')]};return db[_0x4c69('0x29')][_0x4c69('0x1d')](_0x5a1abe)[_0x4c69('0x3c')](function(_0x48c6cb){_0x2357da[_0x4c69('0x1d')]=_0x48c6cb;if(_0x389015['query'][_0x4c69('0x3d')]){_0x40bd83[_0x4c69('0x3e')]=[{'all':!![]}];}return db[_0x4c69('0x29')]['findAll'](_0x40bd83);})[_0x4c69('0x3c')](function(_0x451be4){_0x2357da['rows']=_0x451be4;return _0x2357da;})['then'](respondWithFilteredResult(_0x5ade99,_0x40bd83))[_0x4c69('0x3f')](handleError(_0x5ade99,null));};exports[_0x4c69('0x40')]=function(_0x473aed,_0x3b3983){var _0x5ba699={'raw':![],'where':{'id':_0x473aed[_0x4c69('0x41')]['id']}},_0x4747e9={};_0x4747e9[_0x4c69('0x31')]=_[_0x4c69('0x42')](db[_0x4c69('0x29')][_0x4c69('0x2a')]);_0x4747e9['query']=_[_0x4c69('0x42')](_0x473aed['query']);_0x4747e9[_0x4c69('0x2f')]=_['intersection'](_0x4747e9['model'],_0x4747e9['query']);_0x5ba699[_0x4c69('0x32')]=_['intersection'](_0x4747e9['model'],qs['fields'](_0x473aed[_0x4c69('0x2e')][_0x4c69('0x33')]));_0x5ba699[_0x4c69('0x32')]=_0x5ba699[_0x4c69('0x32')]['length']?_0x5ba699[_0x4c69('0x32')]:_0x4747e9['model'];if(_0x473aed[_0x4c69('0x2e')][_0x4c69('0x3d')]){_0x5ba699[_0x4c69('0x3e')]=[{'all':!![]}];}_0x5ba699=_['merge']({},_0x5ba699,_0x473aed[_0x4c69('0x3b')]);return db[_0x4c69('0x29')][_0x4c69('0x43')](_0x5ba699)[_0x4c69('0x3c')](handleEntityNotFound(_0x3b3983,null))['then'](respondWithResult(_0x3b3983,null))[_0x4c69('0x3f')](handleError(_0x3b3983,null));};exports[_0x4c69('0x44')]=function(_0x57cfd7,_0x2b843b){return db['Integration'][_0x4c69('0x44')](_0x57cfd7['body'],{})['then'](respondWithResult(_0x2b843b,0xc9))[_0x4c69('0x3f')](handleError(_0x2b843b,null));};exports[_0x4c69('0x45')]=function(_0x123ac1,_0xa99955){if(_0x123ac1[_0x4c69('0x46')]['id']){delete _0x123ac1[_0x4c69('0x46')]['id'];}return db['Integration'][_0x4c69('0x43')]({'where':{'id':_0x123ac1[_0x4c69('0x41')]['id']}})[_0x4c69('0x3c')](handleEntityNotFound(_0xa99955,null))[_0x4c69('0x3c')](saveUpdates(_0x123ac1[_0x4c69('0x46')],null))[_0x4c69('0x3c')](respondWithResult(_0xa99955,null))['catch'](handleError(_0xa99955,null));};exports[_0x4c69('0x47')]=function(_0x328895,_0xd87bb4){return db[_0x4c69('0x29')][_0x4c69('0x43')]({'where':{'id':_0x328895[_0x4c69('0x41')]['id']}})[_0x4c69('0x3c')](handleEntityNotFound(_0xd87bb4,null))[_0x4c69('0x3c')](removeEntity(_0xd87bb4,null))[_0x4c69('0x3f')](handleError(_0xd87bb4,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index a7ac158..aa3b896 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 _0xb1b8=['util','../../config/logger','api','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash'];(function(_0x3b0b34,_0xe6a14f){var _0x5f5496=function(_0x24fda6){while(--_0x24fda6){_0x3b0b34['push'](_0x3b0b34['shift']());}};_0x5f5496(++_0xe6a14f);}(_0xb1b8,0x78));var _0x8b1b=function(_0x192772,_0x100b16){_0x192772=_0x192772-0x0;var _0x2b50bd=_0xb1b8[_0x192772];return _0x2b50bd;};'use strict';var _=require(_0x8b1b('0x0'));var util=require(_0x8b1b('0x1'));var logger=require(_0x8b1b('0x2'))(_0x8b1b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8b1b('0x4'));var config=require(_0x8b1b('0x5'));var attributes=require(_0x8b1b('0x6'));module[_0x8b1b('0x7')]=function(_0x9a5c6,_0x2c6107){return _0x9a5c6[_0x8b1b('0x8')](_0x8b1b('0x9'),attributes,{'tableName':_0x8b1b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe82=['request-promise','path','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','bluebird'];(function(_0x315aa8,_0x15a9ba){var _0x431d49=function(_0x30aa5a){while(--_0x30aa5a){_0x315aa8['push'](_0x315aa8['shift']());}};_0x431d49(++_0x15a9ba);}(_0xfe82,0x14b));var _0x2fe8=function(_0x449d22,_0x4b1fe4){_0x449d22=_0x449d22-0x0;var _0x5dabb1=_0xfe82[_0x449d22];return _0x5dabb1;};'use strict';var _=require(_0x2fe8('0x0'));var util=require(_0x2fe8('0x1'));var logger=require(_0x2fe8('0x2'))(_0x2fe8('0x3'));var moment=require('moment');var BPromise=require(_0x2fe8('0x4'));var rp=require(_0x2fe8('0x5'));var fs=require('fs');var path=require(_0x2fe8('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2fe8('0x7'));module[_0x2fe8('0x8')]=function(_0x50574b,_0x21c361){return _0x50574b[_0x2fe8('0x9')](_0x2fe8('0xa'),attributes,{'tableName':_0x2fe8('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 25765c4..e21b79f 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 _0x83f7=['Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Integration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3866bb,_0x4387a0){var _0x57b897=function(_0x322e8){while(--_0x322e8){_0x3866bb['push'](_0x3866bb['shift']());}};_0x57b897(++_0x4387a0);}(_0x83f7,0x84));var _0x783f=function(_0x5f27ba,_0x216d03){_0x5f27ba=_0x5f27ba-0x0;var _0x36268c=_0x83f7[_0x5f27ba];return _0x36268c;};'use strict';var _=require(_0x783f('0x0'));var util=require(_0x783f('0x1'));var moment=require(_0x783f('0x2'));var BPromise=require('bluebird');var rs=require(_0x783f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x783f('0x4'));var logger=require(_0x783f('0x5'))(_0x783f('0x6'));var config=require(_0x783f('0x7'));var jayson=require(_0x783f('0x8'));var client=jayson[_0x783f('0x9')][_0x783f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25ab5f,_0x58c5db,_0x197e0b){return new BPromise(function(_0x2fd0ec,_0x426ffa){return client[_0x783f('0xb')](_0x25ab5f,_0x197e0b)['then'](function(_0x2e450c){logger['info'](_0x783f('0xc'),_0x58c5db,_0x783f('0xd'));logger[_0x783f('0xe')](_0x783f('0xf'),_0x58c5db,_0x783f('0xd'),JSON[_0x783f('0x10')](_0x2e450c));if(_0x2e450c[_0x783f('0x11')]){if(_0x2e450c[_0x783f('0x11')]['code']===0x1f4){logger[_0x783f('0x11')](_0x783f('0xc'),_0x58c5db,_0x2e450c['error'][_0x783f('0x12')]);return _0x426ffa(_0x2e450c[_0x783f('0x11')][_0x783f('0x12')]);}logger[_0x783f('0x11')](_0x783f('0xc'),_0x58c5db,_0x2e450c['error'][_0x783f('0x12')]);return _0x2fd0ec(_0x2e450c[_0x783f('0x11')][_0x783f('0x12')]);}else{logger['info']('Integration,\x20%s,\x20%s',_0x58c5db,_0x783f('0xd'));_0x2fd0ec(_0x2e450c[_0x783f('0x13')][_0x783f('0x12')]);}})[_0x783f('0x14')](function(_0xc2163a){logger[_0x783f('0x11')]('Integration,\x20%s,\x20%s',_0x58c5db,_0xc2163a);_0x426ffa(_0xc2163a);});});} \ No newline at end of file +var _0x653d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x653d,0x133));var _0xd653=function(_0x379a70,_0x367de6){_0x379a70=_0x379a70-0x0;var _0x3ddaa4=_0x653d[_0x379a70];return _0x3ddaa4;};'use strict';var _=require('lodash');var util=require(_0xd653('0x0'));var moment=require(_0xd653('0x1'));var BPromise=require(_0xd653('0x2'));var rs=require(_0xd653('0x3'));var fs=require('fs');var Redis=require(_0xd653('0x4'));var db=require(_0xd653('0x5'))['db'];var utils=require(_0xd653('0x6'));var logger=require(_0xd653('0x7'))(_0xd653('0x8'));var config=require(_0xd653('0x9'));var jayson=require(_0xd653('0xa'));var client=jayson[_0xd653('0xb')][_0xd653('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2bf7a1,_0x490041,_0x5cbb43){return new BPromise(function(_0x378ba9,_0x5b46f9){return client[_0xd653('0xd')](_0x2bf7a1,_0x5cbb43)[_0xd653('0xe')](function(_0x5234e0){logger[_0xd653('0xf')](_0xd653('0x10'),_0x490041,_0xd653('0x11'));logger['debug'](_0xd653('0x12'),_0x490041,'request\x20sent',JSON[_0xd653('0x13')](_0x5234e0));if(_0x5234e0[_0xd653('0x14')]){if(_0x5234e0[_0xd653('0x14')][_0xd653('0x15')]===0x1f4){logger[_0xd653('0x14')](_0xd653('0x10'),_0x490041,_0x5234e0[_0xd653('0x14')]['message']);return _0x5b46f9(_0x5234e0['error'][_0xd653('0x16')]);}logger[_0xd653('0x14')](_0xd653('0x10'),_0x490041,_0x5234e0[_0xd653('0x14')][_0xd653('0x16')]);return _0x378ba9(_0x5234e0[_0xd653('0x14')]['message']);}else{logger['info']('Integration,\x20%s,\x20%s',_0x490041,_0xd653('0x11'));_0x378ba9(_0x5234e0[_0xd653('0x17')][_0xd653('0x16')]);}})['catch'](function(_0x2a4d7f){logger[_0xd653('0x14')](_0xd653('0x10'),_0x490041,_0x2a4d7f);_0x5b46f9(_0x2a4d7f);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 3d38e08..1eedfd7 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 _0xeefd=['/describe','describe','show','post','create','put','/:id','update','delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index'];(function(_0x148879,_0x5b4c11){var _0x4f7027=function(_0xad056b){while(--_0xad056b){_0x148879['push'](_0x148879['shift']());}};_0x4f7027(++_0x5b4c11);}(_0xeefd,0x106));var _0xdeef=function(_0x80cb,_0x421f2e){_0x80cb=_0x80cb-0x0;var _0x2ad4f4=_0xeefd[_0x80cb];return _0x2ad4f4;};'use strict';var multer=require(_0xdeef('0x0'));var util=require(_0xdeef('0x1'));var path=require(_0xdeef('0x2'));var timeout=require('connect-timeout');var express=require(_0xdeef('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdeef('0x4'));var interaction=require(_0xdeef('0x5'));var config=require(_0xdeef('0x6'));var controller=require(_0xdeef('0x7'));router[_0xdeef('0x8')]('/',auth[_0xdeef('0x9')](),controller[_0xdeef('0xa')]);router[_0xdeef('0x8')](_0xdeef('0xb'),auth[_0xdeef('0x9')](),controller[_0xdeef('0xc')]);router[_0xdeef('0x8')]('/:id',auth[_0xdeef('0x9')](),controller[_0xdeef('0xd')]);router[_0xdeef('0xe')]('/',auth['isAuthenticated'](),controller[_0xdeef('0xf')]);router[_0xdeef('0x10')](_0xdeef('0x11'),auth[_0xdeef('0x9')](),controller[_0xdeef('0x12')]);router[_0xdeef('0x13')](_0xdeef('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xdeef('0x14')]=router; \ No newline at end of file +var _0x69dc=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','show','post','create','put','isAuthenticated','update','delete','destroy'];(function(_0x2d1238,_0x444f4e){var _0x36c1a7=function(_0x20452f){while(--_0x20452f){_0x2d1238['push'](_0x2d1238['shift']());}};_0x36c1a7(++_0x444f4e);}(_0x69dc,0x1b9));var _0xc69d=function(_0x1e6bc2,_0x3c62f6){_0x1e6bc2=_0x1e6bc2-0x0;var _0x5bd7d8=_0x69dc[_0x1e6bc2];return _0x5bd7d8;};'use strict';var multer=require(_0xc69d('0x0'));var util=require(_0xc69d('0x1'));var path=require(_0xc69d('0x2'));var timeout=require(_0xc69d('0x3'));var express=require('express');var router=express[_0xc69d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc69d('0x5'));var interaction=require(_0xc69d('0x6'));var config=require(_0xc69d('0x7'));var controller=require('./integrationReport.controller');router[_0xc69d('0x8')]('/',auth['isAuthenticated'](),controller[_0xc69d('0x9')]);router['get'](_0xc69d('0xa'),auth['isAuthenticated'](),controller[_0xc69d('0xb')]);router[_0xc69d('0x8')](_0xc69d('0xc'),auth['isAuthenticated'](),controller[_0xc69d('0xd')]);router[_0xc69d('0xe')]('/',auth['isAuthenticated'](),controller[_0xc69d('0xf')]);router[_0xc69d('0x10')]('/:id',auth[_0xc69d('0x11')](),controller[_0xc69d('0x12')]);router[_0xc69d('0x13')](_0xc69d('0xc'),auth[_0xc69d('0x11')](),controller[_0xc69d('0x14')]);module[_0xc69d('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 4813f32..e6fbb31 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 _0xda9a=['SENT','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x5f5bcb,_0x2499f5){var _0x4a8918=function(_0x91f8a7){while(--_0x91f8a7){_0x5f5bcb['push'](_0x5f5bcb['shift']());}};_0x4a8918(++_0x2499f5);}(_0xda9a,0x1dc));var _0xada9=function(_0xddce13,_0x2957df){_0xddce13=_0xddce13-0x0;var _0x3c1580=_0xda9a[_0xddce13];return _0x3c1580;};'use strict';var Sequelize=require(_0xada9('0x0'));module[_0xada9('0x1')]={'integration':{'type':Sequelize[_0xada9('0x2')]},'eventChannel':{'type':Sequelize[_0xada9('0x2')]},'exitStatus':{'type':Sequelize[_0xada9('0x2')]},'ticketId':{'type':Sequelize[_0xada9('0x2')]},'integrationId':{'type':Sequelize[_0xada9('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xada9('0x2')]},'calleridnum':{'type':Sequelize[_0xada9('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xada9('0x2')]},'interface':{'type':Sequelize[_0xada9('0x2')]},'membername':{'type':Sequelize[_0xada9('0x2')]},'agentcalledAt':{'type':Sequelize[_0xada9('0x4')]},'agentconnectAt':{'type':Sequelize[_0xada9('0x4')]},'holdtime':{'type':Sequelize[_0xada9('0x3')]},'agentcomplete':{'type':Sequelize[_0xada9('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xada9('0x4')]},'talktime':{'type':Sequelize[_0xada9('0x3')]},'agentacw':{'type':Sequelize[_0xada9('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xada9('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xada9('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xada9('0x4')]},'agentdump':{'type':Sequelize[_0xada9('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xada9('0x4')]},'lastevent':{'type':Sequelize[_0xada9('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xada9('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xada9('0x2')]},'language':{'type':Sequelize[_0xada9('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xada9('0x2')]},'exten':{'type':Sequelize[_0xada9('0x2')]},'priority':{'type':Sequelize[_0xada9('0x2')]},'destchannel':{'type':Sequelize[_0xada9('0x2')]},'destchannelstate':{'type':Sequelize[_0xada9('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xada9('0x2')]},'destcalleridname':{'type':Sequelize[_0xada9('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xada9('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xada9('0x2')]},'destlanguage':{'type':Sequelize[_0xada9('0x2')]},'destaccountcode':{'type':Sequelize[_0xada9('0x2')]},'destcontext':{'type':Sequelize[_0xada9('0x2')]},'destexten':{'type':Sequelize[_0xada9('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xada9('0x2')]},'messageId':{'type':Sequelize[_0xada9('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xada9('0x2')]},'from':{'type':Sequelize[_0xada9('0x2')]},'to':{'type':Sequelize[_0xada9('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xada9('0x6')]},'html':{'type':Sequelize[_0xada9('0x6')]},'text':{'type':Sequelize[_0xada9('0x6')]},'status':{'type':Sequelize[_0xada9('0x7')](_0xada9('0x8'),'SENDING',_0xada9('0x9'),_0xada9('0xa'))},'url':{'type':Sequelize[_0xada9('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xada9('0x2')]},'projectId':{'type':Sequelize[_0xada9('0x3')]}}; \ No newline at end of file +var _0xd82d=['SENDING','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x48c440,_0x3b2aee){var _0x32f4d8=function(_0x1601b2){while(--_0x1601b2){_0x48c440['push'](_0x48c440['shift']());}};_0x32f4d8(++_0x3b2aee);}(_0xd82d,0x65));var _0xdd82=function(_0x24eec7,_0x557292){_0x24eec7=_0x24eec7-0x0;var _0xa1ea56=_0xd82d[_0x24eec7];return _0xa1ea56;};'use strict';var Sequelize=require(_0xdd82('0x0'));module[_0xdd82('0x1')]={'integration':{'type':Sequelize[_0xdd82('0x2')]},'eventChannel':{'type':Sequelize[_0xdd82('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xdd82('0x2')]},'integrationId':{'type':Sequelize[_0xdd82('0x3')]},'contacts':{'type':Sequelize[_0xdd82('0x2')]},'uniqueid':{'type':Sequelize[_0xdd82('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdd82('0x2')]},'queue':{'type':Sequelize[_0xdd82('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xdd82('0x2')]},'agentcalledAt':{'type':Sequelize[_0xdd82('0x4')]},'agentconnectAt':{'type':Sequelize[_0xdd82('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xdd82('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xdd82('0x4')]},'talktime':{'type':Sequelize[_0xdd82('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xdd82('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xdd82('0x4')]},'agentdump':{'type':Sequelize[_0xdd82('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xdd82('0x4')]},'lastevent':{'type':Sequelize[_0xdd82('0x2')]},'channel':{'type':Sequelize[_0xdd82('0x2')]},'channelstate':{'type':Sequelize[_0xdd82('0x3')]},'channelstatedesc':{'type':Sequelize[_0xdd82('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdd82('0x2')]},'connectedlinename':{'type':Sequelize[_0xdd82('0x2')]},'language':{'type':Sequelize[_0xdd82('0x2')]},'accountcode':{'type':Sequelize[_0xdd82('0x2')]},'context':{'type':Sequelize[_0xdd82('0x2')]},'exten':{'type':Sequelize[_0xdd82('0x2')]},'priority':{'type':Sequelize[_0xdd82('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xdd82('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xdd82('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xdd82('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xdd82('0x2')]},'destlanguage':{'type':Sequelize[_0xdd82('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xdd82('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xdd82('0x2')]},'inReplyTo':{'type':Sequelize[_0xdd82('0x2')]},'subject':{'type':Sequelize[_0xdd82('0x2')]},'from':{'type':Sequelize[_0xdd82('0x2')]},'to':{'type':Sequelize[_0xdd82('0x2')]},'cc':{'type':Sequelize[_0xdd82('0x2')]},'attachment':{'type':Sequelize[_0xdd82('0x6')]},'html':{'type':Sequelize[_0xdd82('0x6')]},'text':{'type':Sequelize[_0xdd82('0x6')]},'status':{'type':Sequelize[_0xdd82('0x7')](_0xdd82('0x8'),_0xdd82('0x9'),'RECEIVED',_0xdd82('0xa'))},'url':{'type':Sequelize[_0xdd82('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xdd82('0x2')]},'projectId':{'type':Sequelize[_0xdd82('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 1fc8885..ff07295 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 _0x35f5=['map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','IntegrationReport','includeAll','findAll','rows','show','include','find','catch','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','count','offset','limit','status','set','Content-Range','apply','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x35f5,0x100));var _0x535f=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x35f5[_0x411017];return _0x2adeea;};'use strict';var emlformat=require(_0x535f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x535f('0x1'));var jsonpatch=require(_0x535f('0x2'));var rp=require(_0x535f('0x3'));var moment=require(_0x535f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x535f('0x5'));var sox=require(_0x535f('0x6'));var csv=require('to-csv');var ejs=require(_0x535f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x535f('0x8'));var squel=require(_0x535f('0x9'));var crypto=require('crypto');var jsforce=require(_0x535f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x535f('0xb'));var querystring=require(_0x535f('0xc'));var Papa=require(_0x535f('0xd'));var Redis=require(_0x535f('0xe'));var authService=require(_0x535f('0xf'));var qs=require(_0x535f('0x10'));var as=require(_0x535f('0x11'));var hardwareService=require(_0x535f('0x12'));var logger=require('../../config/logger')(_0x535f('0x13'));var utils=require(_0x535f('0x14'));var config=require(_0x535f('0x15'));var licenseUtil=require(_0x535f('0x16'));var db=require(_0x535f('0x17'))['db'];function respondWithStatusCode(_0x2d24cf,_0x54a095){_0x54a095=_0x54a095||0xcc;return function(_0x1cd819){if(_0x1cd819){return _0x2d24cf['sendStatus'](_0x54a095);}return _0x2d24cf['status'](_0x54a095)[_0x535f('0x18')]();};}function respondWithResult(_0x465521,_0x423f95){_0x423f95=_0x423f95||0xc8;return function(_0x47e080){if(_0x47e080){return _0x465521['status'](_0x423f95)[_0x535f('0x19')](_0x47e080);}};}function respondWithFilteredResult(_0x4a97fc,_0x3119e1){return function(_0x3ea018){if(_0x3ea018){var _0x592a67=typeof _0x3119e1['offset']===_0x535f('0x1a')&&typeof _0x3119e1['limit']===_0x535f('0x1a');var _0xa6c20b=_0x3ea018[_0x535f('0x1b')];var _0x16f614=_0x592a67?0x0:_0x3119e1[_0x535f('0x1c')];var _0x3b4f3f=_0x592a67?_0x3ea018[_0x535f('0x1b')]:_0x3119e1[_0x535f('0x1c')]+_0x3119e1[_0x535f('0x1d')];var _0x20655c;if(_0x3b4f3f>=_0xa6c20b){_0x3b4f3f=_0xa6c20b;_0x20655c=0xc8;}else{_0x20655c=0xce;}_0x4a97fc[_0x535f('0x1e')](_0x20655c);return _0x4a97fc[_0x535f('0x1f')](_0x535f('0x20'),_0x16f614+'-'+_0x3b4f3f+'/'+_0xa6c20b)[_0x535f('0x19')](_0x3ea018);}return null;};}function patchUpdates(_0xa59e26){return function(_0xe13d3e){try{jsonpatch[_0x535f('0x21')](_0xe13d3e,_0xa59e26,!![]);}catch(_0x1a8623){return BPromise['reject'](_0x1a8623);}return _0xe13d3e['save']();};}function saveUpdates(_0x2b3297,_0x5f2b70){return function(_0x1f3938){if(_0x1f3938){return _0x1f3938[_0x535f('0x22')](_0x2b3297)[_0x535f('0x23')](function(_0x2f02b1){return _0x2f02b1;});}return null;};}function removeEntity(_0x362a78,_0x556512){return function(_0x45eb4b){if(_0x45eb4b){return _0x45eb4b[_0x535f('0x24')]()['then'](function(){_0x362a78[_0x535f('0x1e')](0xcc)[_0x535f('0x18')]();});}};}function handleEntityNotFound(_0xa6cf8,_0x293e05){return function(_0x49de3a){if(!_0x49de3a){_0xa6cf8['sendStatus'](0x194);}return _0x49de3a;};}function handleError(_0x43a3e1,_0x573ef0){_0x573ef0=_0x573ef0||0x1f4;return function(_0x1896e8){logger['error'](_0x1896e8[_0x535f('0x25')]);if(_0x1896e8[_0x535f('0x26')]){delete _0x1896e8[_0x535f('0x26')];}_0x43a3e1['status'](_0x573ef0)[_0x535f('0x27')](_0x1896e8);};}exports[_0x535f('0x28')]=function(_0xc8b843,_0x5105ee){var _0x122b7d={},_0x38b464={},_0x285b9d={'count':0x0,'rows':[]};var _0x23c5e4=_['map'](db['IntegrationReport'][_0x535f('0x29')],function(_0x2af771){return{'name':_0x2af771[_0x535f('0x2a')],'type':_0x2af771[_0x535f('0x2b')]['key']};});_0x38b464['model']=_[_0x535f('0x2c')](_0x23c5e4,'name');_0x38b464[_0x535f('0x2d')]=_[_0x535f('0x2e')](_0xc8b843[_0x535f('0x2d')]);_0x38b464[_0x535f('0x2f')]=_['intersection'](_0x38b464[_0x535f('0x30')],_0x38b464[_0x535f('0x2d')]);_0x122b7d[_0x535f('0x31')]=_[_0x535f('0x32')](_0x38b464[_0x535f('0x30')],qs[_0x535f('0x33')](_0xc8b843[_0x535f('0x2d')][_0x535f('0x33')]));_0x122b7d[_0x535f('0x31')]=_0x122b7d[_0x535f('0x31')][_0x535f('0x34')]?_0x122b7d[_0x535f('0x31')]:_0x38b464[_0x535f('0x30')];if(!_0xc8b843[_0x535f('0x2d')][_0x535f('0x35')](_0x535f('0x36'))){_0x122b7d[_0x535f('0x1d')]=qs[_0x535f('0x1d')](_0xc8b843[_0x535f('0x2d')][_0x535f('0x1d')]);_0x122b7d['offset']=qs[_0x535f('0x1c')](_0xc8b843[_0x535f('0x2d')][_0x535f('0x1c')]);}_0x122b7d[_0x535f('0x37')]=qs['sort'](_0xc8b843[_0x535f('0x2d')][_0x535f('0x38')]);_0x122b7d[_0x535f('0x39')]=qs[_0x535f('0x2f')](_[_0x535f('0x3a')](_0xc8b843[_0x535f('0x2d')],_0x38b464[_0x535f('0x2f')]),_0x23c5e4);if(_0xc8b843[_0x535f('0x2d')][_0x535f('0x3b')]){_0x122b7d[_0x535f('0x39')]=_[_0x535f('0x3c')](_0x122b7d[_0x535f('0x39')],{'$or':_[_0x535f('0x2c')](_0x23c5e4,function(_0xd7f9e){if(_0xd7f9e['type']!==_0x535f('0x3d')){var _0x46a825={};_0x46a825[_0xd7f9e[_0x535f('0x26')]]={'$like':'%'+_0xc8b843[_0x535f('0x2d')][_0x535f('0x3b')]+'%'};return _0x46a825;}})});}_0x122b7d=_[_0x535f('0x3c')]({},_0x122b7d,_0xc8b843[_0x535f('0x3e')]);var _0x3e3d4d={'where':_0x122b7d[_0x535f('0x39')]};return db[_0x535f('0x3f')][_0x535f('0x1b')](_0x3e3d4d)[_0x535f('0x23')](function(_0x1b7d05){_0x285b9d[_0x535f('0x1b')]=_0x1b7d05;if(_0xc8b843['query'][_0x535f('0x40')]){_0x122b7d['include']=[{'all':!![]}];}return db['IntegrationReport'][_0x535f('0x41')](_0x122b7d);})[_0x535f('0x23')](function(_0x534370){_0x285b9d[_0x535f('0x42')]=_0x534370;return _0x285b9d;})[_0x535f('0x23')](respondWithFilteredResult(_0x5105ee,_0x122b7d))['catch'](handleError(_0x5105ee,null));};exports[_0x535f('0x43')]=function(_0x59dec0,_0x4bf123){var _0x53fc90={'raw':![],'where':{'id':_0x59dec0['params']['id']}},_0x9868e5={};_0x9868e5['model']=_['keys'](db[_0x535f('0x3f')][_0x535f('0x29')]);_0x9868e5[_0x535f('0x2d')]=_[_0x535f('0x2e')](_0x59dec0[_0x535f('0x2d')]);_0x9868e5[_0x535f('0x2f')]=_['intersection'](_0x9868e5['model'],_0x9868e5['query']);_0x53fc90[_0x535f('0x31')]=_[_0x535f('0x32')](_0x9868e5['model'],qs[_0x535f('0x33')](_0x59dec0[_0x535f('0x2d')][_0x535f('0x33')]));_0x53fc90[_0x535f('0x31')]=_0x53fc90[_0x535f('0x31')][_0x535f('0x34')]?_0x53fc90[_0x535f('0x31')]:_0x9868e5[_0x535f('0x30')];if(_0x59dec0[_0x535f('0x2d')]['includeAll']){_0x53fc90[_0x535f('0x44')]=[{'all':!![]}];}_0x53fc90=_['merge']({},_0x53fc90,_0x59dec0[_0x535f('0x3e')]);return db['IntegrationReport'][_0x535f('0x45')](_0x53fc90)[_0x535f('0x23')](handleEntityNotFound(_0x4bf123,null))['then'](respondWithResult(_0x4bf123,null))[_0x535f('0x46')](handleError(_0x4bf123,null));};exports['create']=function(_0x438b9a,_0x3f491d){return db[_0x535f('0x3f')][_0x535f('0x47')](_0x438b9a[_0x535f('0x48')],{})[_0x535f('0x23')](respondWithResult(_0x3f491d,0xc9))['catch'](handleError(_0x3f491d,null));};exports[_0x535f('0x22')]=function(_0x51f4d4,_0x517623){if(_0x51f4d4['body']['id']){delete _0x51f4d4['body']['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x51f4d4[_0x535f('0x49')]['id']}})['then'](handleEntityNotFound(_0x517623,null))['then'](saveUpdates(_0x51f4d4['body'],null))[_0x535f('0x23')](respondWithResult(_0x517623,null))[_0x535f('0x46')](handleError(_0x517623,null));};exports[_0x535f('0x24')]=function(_0x21d73f,_0x33e338){return db[_0x535f('0x3f')]['find']({'where':{'id':_0x21d73f['params']['id']}})[_0x535f('0x23')](handleEntityNotFound(_0x33e338,null))[_0x535f('0x23')](removeEntity(_0x33e338,null))['catch'](handleError(_0x33e338,null));};exports['describe']=function(_0x35c7b3,_0x312860){return db[_0x535f('0x3f')][_0x535f('0x4a')]()[_0x535f('0x23')](respondWithResult(_0x312860,null))[_0x535f('0x46')](handleError(_0x312860,null));}; \ No newline at end of file +var _0x8c39=['squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','stack','name','IntegrationReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','catch','create','body','find','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra'];(function(_0xea587d,_0x3fc7e0){var _0x10c67c=function(_0x230823){while(--_0x230823){_0xea587d['push'](_0xea587d['shift']());}};_0x10c67c(++_0x3fc7e0);}(_0x8c39,0x1df));var _0x98c3=function(_0x378405,_0x14b3d7){_0x378405=_0x378405-0x0;var _0x5855a8=_0x8c39[_0x378405];return _0x5855a8;};'use strict';var emlformat=require(_0x98c3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x98c3('0x1'));var jsonpatch=require(_0x98c3('0x2'));var rp=require(_0x98c3('0x3'));var moment=require(_0x98c3('0x4'));var BPromise=require(_0x98c3('0x5'));var Mustache=require('mustache');var util=require(_0x98c3('0x6'));var path=require(_0x98c3('0x7'));var sox=require(_0x98c3('0x8'));var csv=require('to-csv');var ejs=require(_0x98c3('0x9'));var fs=require('fs');var fs_extra=require(_0x98c3('0xa'));var _=require('lodash');var squel=require(_0x98c3('0xb'));var crypto=require('crypto');var jsforce=require(_0x98c3('0xc'));var deskjs=require(_0x98c3('0xd'));var toCsv=require('to-csv');var querystring=require(_0x98c3('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x98c3('0xf'));var qs=require(_0x98c3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98c3('0x11'));var logger=require(_0x98c3('0x12'))(_0x98c3('0x13'));var utils=require(_0x98c3('0x14'));var config=require(_0x98c3('0x15'));var licenseUtil=require(_0x98c3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1eae01,_0x56c0e7){_0x56c0e7=_0x56c0e7||0xcc;return function(_0x9242a7){if(_0x9242a7){return _0x1eae01[_0x98c3('0x17')](_0x56c0e7);}return _0x1eae01[_0x98c3('0x18')](_0x56c0e7)[_0x98c3('0x19')]();};}function respondWithResult(_0x3c8000,_0x519666){_0x519666=_0x519666||0xc8;return function(_0x28b674){if(_0x28b674){return _0x3c8000[_0x98c3('0x18')](_0x519666)[_0x98c3('0x1a')](_0x28b674);}};}function respondWithFilteredResult(_0x31d89e,_0x555036){return function(_0x5a61c1){if(_0x5a61c1){var _0x238c26=typeof _0x555036['offset']===_0x98c3('0x1b')&&typeof _0x555036[_0x98c3('0x1c')]===_0x98c3('0x1b');var _0x99f9ce=_0x5a61c1[_0x98c3('0x1d')];var _0x3518fa=_0x238c26?0x0:_0x555036[_0x98c3('0x1e')];var _0x1ec557=_0x238c26?_0x5a61c1['count']:_0x555036[_0x98c3('0x1e')]+_0x555036['limit'];var _0x1cb944;if(_0x1ec557>=_0x99f9ce){_0x1ec557=_0x99f9ce;_0x1cb944=0xc8;}else{_0x1cb944=0xce;}_0x31d89e[_0x98c3('0x18')](_0x1cb944);return _0x31d89e['set'](_0x98c3('0x1f'),_0x3518fa+'-'+_0x1ec557+'/'+_0x99f9ce)['json'](_0x5a61c1);}return null;};}function patchUpdates(_0x3a0aa5){return function(_0x171dcf){try{jsonpatch[_0x98c3('0x20')](_0x171dcf,_0x3a0aa5,!![]);}catch(_0x4e63b7){return BPromise[_0x98c3('0x21')](_0x4e63b7);}return _0x171dcf[_0x98c3('0x22')]();};}function saveUpdates(_0x40da4c,_0x1ee8e6){return function(_0x21b284){if(_0x21b284){return _0x21b284['update'](_0x40da4c)[_0x98c3('0x23')](function(_0x1a8d24){return _0x1a8d24;});}return null;};}function removeEntity(_0x17a24,_0x365806){return function(_0x2ee5eb){if(_0x2ee5eb){return _0x2ee5eb['destroy']()[_0x98c3('0x23')](function(){_0x17a24[_0x98c3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29f9f7,_0x1d5985){return function(_0x13df06){if(!_0x13df06){_0x29f9f7[_0x98c3('0x17')](0x194);}return _0x13df06;};}function handleError(_0x27c548,_0x726e48){_0x726e48=_0x726e48||0x1f4;return function(_0x4aca0e){logger['error'](_0x4aca0e[_0x98c3('0x24')]);if(_0x4aca0e[_0x98c3('0x25')]){delete _0x4aca0e['name'];}_0x27c548[_0x98c3('0x18')](_0x726e48)['send'](_0x4aca0e);};}exports['index']=function(_0x26a939,_0xcec32b){var _0x5ee2ce={},_0x15822c={},_0x5ea272={'count':0x0,'rows':[]};var _0x4e88e5=_['map'](db[_0x98c3('0x26')][_0x98c3('0x27')],function(_0x339532){return{'name':_0x339532[_0x98c3('0x28')],'type':_0x339532[_0x98c3('0x29')][_0x98c3('0x2a')]};});_0x15822c[_0x98c3('0x2b')]=_[_0x98c3('0x2c')](_0x4e88e5,_0x98c3('0x25'));_0x15822c[_0x98c3('0x2d')]=_[_0x98c3('0x2e')](_0x26a939[_0x98c3('0x2d')]);_0x15822c[_0x98c3('0x2f')]=_[_0x98c3('0x30')](_0x15822c['model'],_0x15822c[_0x98c3('0x2d')]);_0x5ee2ce['attributes']=_[_0x98c3('0x30')](_0x15822c['model'],qs[_0x98c3('0x31')](_0x26a939['query'][_0x98c3('0x31')]));_0x5ee2ce[_0x98c3('0x32')]=_0x5ee2ce[_0x98c3('0x32')][_0x98c3('0x33')]?_0x5ee2ce['attributes']:_0x15822c[_0x98c3('0x2b')];if(!_0x26a939[_0x98c3('0x2d')][_0x98c3('0x34')]('nolimit')){_0x5ee2ce[_0x98c3('0x1c')]=qs['limit'](_0x26a939[_0x98c3('0x2d')][_0x98c3('0x1c')]);_0x5ee2ce['offset']=qs['offset'](_0x26a939['query'][_0x98c3('0x1e')]);}_0x5ee2ce[_0x98c3('0x35')]=qs['sort'](_0x26a939[_0x98c3('0x2d')]['sort']);_0x5ee2ce[_0x98c3('0x36')]=qs['filters'](_[_0x98c3('0x37')](_0x26a939['query'],_0x15822c[_0x98c3('0x2f')]),_0x4e88e5);if(_0x26a939[_0x98c3('0x2d')]['filter']){_0x5ee2ce[_0x98c3('0x36')]=_['merge'](_0x5ee2ce['where'],{'$or':_[_0x98c3('0x2c')](_0x4e88e5,function(_0x36821f){if(_0x36821f[_0x98c3('0x29')]!=='VIRTUAL'){var _0x5255de={};_0x5255de[_0x36821f[_0x98c3('0x25')]]={'$like':'%'+_0x26a939[_0x98c3('0x2d')][_0x98c3('0x38')]+'%'};return _0x5255de;}})});}_0x5ee2ce=_[_0x98c3('0x39')]({},_0x5ee2ce,_0x26a939[_0x98c3('0x3a')]);var _0x17b346={'where':_0x5ee2ce['where']};return db['IntegrationReport'][_0x98c3('0x1d')](_0x17b346)[_0x98c3('0x23')](function(_0x2c19cf){_0x5ea272[_0x98c3('0x1d')]=_0x2c19cf;if(_0x26a939[_0x98c3('0x2d')][_0x98c3('0x3b')]){_0x5ee2ce['include']=[{'all':!![]}];}return db[_0x98c3('0x26')][_0x98c3('0x3c')](_0x5ee2ce);})['then'](function(_0x355f0e){_0x5ea272[_0x98c3('0x3d')]=_0x355f0e;return _0x5ea272;})[_0x98c3('0x23')](respondWithFilteredResult(_0xcec32b,_0x5ee2ce))['catch'](handleError(_0xcec32b,null));};exports[_0x98c3('0x3e')]=function(_0x14a531,_0xaa88ad){var _0x5970ed={'raw':![],'where':{'id':_0x14a531[_0x98c3('0x3f')]['id']}},_0x52e553={};_0x52e553['model']=_[_0x98c3('0x2e')](db[_0x98c3('0x26')][_0x98c3('0x27')]);_0x52e553['query']=_[_0x98c3('0x2e')](_0x14a531[_0x98c3('0x2d')]);_0x52e553[_0x98c3('0x2f')]=_[_0x98c3('0x30')](_0x52e553[_0x98c3('0x2b')],_0x52e553[_0x98c3('0x2d')]);_0x5970ed['attributes']=_[_0x98c3('0x30')](_0x52e553['model'],qs[_0x98c3('0x31')](_0x14a531[_0x98c3('0x2d')]['fields']));_0x5970ed['attributes']=_0x5970ed['attributes'][_0x98c3('0x33')]?_0x5970ed[_0x98c3('0x32')]:_0x52e553[_0x98c3('0x2b')];if(_0x14a531['query']['includeAll']){_0x5970ed[_0x98c3('0x40')]=[{'all':!![]}];}_0x5970ed=_[_0x98c3('0x39')]({},_0x5970ed,_0x14a531['options']);return db[_0x98c3('0x26')]['find'](_0x5970ed)['then'](handleEntityNotFound(_0xaa88ad,null))['then'](respondWithResult(_0xaa88ad,null))[_0x98c3('0x41')](handleError(_0xaa88ad,null));};exports[_0x98c3('0x42')]=function(_0x2b887e,_0x438ef3){return db[_0x98c3('0x26')]['create'](_0x2b887e[_0x98c3('0x43')],{})[_0x98c3('0x23')](respondWithResult(_0x438ef3,0xc9))[_0x98c3('0x41')](handleError(_0x438ef3,null));};exports['update']=function(_0x47866a,_0x5a216d){if(_0x47866a[_0x98c3('0x43')]['id']){delete _0x47866a[_0x98c3('0x43')]['id'];}return db['IntegrationReport'][_0x98c3('0x44')]({'where':{'id':_0x47866a[_0x98c3('0x3f')]['id']}})[_0x98c3('0x23')](handleEntityNotFound(_0x5a216d,null))[_0x98c3('0x23')](saveUpdates(_0x47866a[_0x98c3('0x43')],null))[_0x98c3('0x23')](respondWithResult(_0x5a216d,null))[_0x98c3('0x41')](handleError(_0x5a216d,null));};exports[_0x98c3('0x45')]=function(_0x46a9ad,_0x42f2c3){return db[_0x98c3('0x26')][_0x98c3('0x44')]({'where':{'id':_0x46a9ad['params']['id']}})[_0x98c3('0x23')](handleEntityNotFound(_0x42f2c3,null))[_0x98c3('0x23')](removeEntity(_0x42f2c3,null))[_0x98c3('0x41')](handleError(_0x42f2c3,null));};exports['describe']=function(_0x262456,_0x2f8dd3){return db[_0x98c3('0x26')]['describe']()[_0x98c3('0x23')](respondWithResult(_0x2f8dd3,null))[_0x98c3('0x41')](handleError(_0x2f8dd3,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 411d0e6..139c426 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 _0xdd32=['./integrationReport.attributes','exports','define','IntegrationReport','report_integration','util','api','moment','bluebird','rimraf'];(function(_0x1aed01,_0x3b59f3){var _0x34ccb8=function(_0x1420db){while(--_0x1420db){_0x1aed01['push'](_0x1aed01['shift']());}};_0x34ccb8(++_0x3b59f3);}(_0xdd32,0x87));var _0x2dd3=function(_0x4819a7,_0x12629b){_0x4819a7=_0x4819a7-0x0;var _0x2adef7=_0xdd32[_0x4819a7];return _0x2adef7;};'use strict';var _=require('lodash');var util=require(_0x2dd3('0x0'));var logger=require('../../config/logger')(_0x2dd3('0x1'));var moment=require(_0x2dd3('0x2'));var BPromise=require(_0x2dd3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2dd3('0x4'));var config=require('../../config/environment');var attributes=require(_0x2dd3('0x5'));module[_0x2dd3('0x6')]=function(_0x462c76,_0x40d71b){return _0x462c76[_0x2dd3('0x7')](_0x2dd3('0x8'),attributes,{'tableName':_0x2dd3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e01=['IntegrationReport','report_integration','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./integrationReport.attributes','exports'];(function(_0x22c50e,_0x4ea131){var _0x500f85=function(_0x412f7b){while(--_0x412f7b){_0x22c50e['push'](_0x22c50e['shift']());}};_0x500f85(++_0x4ea131);}(_0x9e01,0x18e));var _0x19e0=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x9e01[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x19e0('0x0'));var util=require(_0x19e0('0x1'));var logger=require(_0x19e0('0x2'))(_0x19e0('0x3'));var moment=require('moment');var BPromise=require(_0x19e0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x19e0('0x5'));var rimraf=require(_0x19e0('0x6'));var config=require(_0x19e0('0x7'));var attributes=require(_0x19e0('0x8'));module[_0x19e0('0x9')]=function(_0xaba3d2,_0x2e52f5){return _0xaba3d2['define'](_0x19e0('0xa'),attributes,{'tableName':_0x19e0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 8bd4cc0..62b8f56 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 _0x757a=['request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x33a44f,_0x4a66ac){var _0x497dea=function(_0x2b12eb){while(--_0x2b12eb){_0x33a44f['push'](_0x33a44f['shift']());}};_0x497dea(++_0x4a66ac);}(_0x757a,0xde));var _0xa757=function(_0x5f42da,_0x28bd1a){_0x5f42da=_0x5f42da-0x0;var _0x12b60a=_0x757a[_0x5f42da];return _0x12b60a;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0xda3f,0xec));var _0xfda3=function(_0x1b8870,_0xb97bb0){_0x1b8870=_0x1b8870-0x0;var _0x4b622e=_0xda3f[_0x1b8870];return _0x4b622e;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('IntegrationReport,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('IntegrationReport,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index f6b34c0..4a6b33b 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 _0xa630=['isAuthenticated','/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0xa630,0xbe));var _0x0a63=function(_0x34535d,_0x3477d7){_0x34535d=_0x34535d-0x0;var _0x354c91=_0xa630[_0x34535d];return _0x354c91;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var fs_extra=require(_0x0a63('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var controller=require(_0x0a63('0x6'));router[_0x0a63('0x7')]('/',auth[_0x0a63('0x8')](),controller['index']);router[_0x0a63('0x7')](_0x0a63('0x9'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xa')]);router[_0x0a63('0x7')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0xc')]);router[_0x0a63('0xd')]('/',auth[_0x0a63('0x8')](),controller[_0x0a63('0xe')]);router[_0x0a63('0xd')](_0x0a63('0xb'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xf')]);router[_0x0a63('0xd')](_0x0a63('0x10'),auth['isAuthenticated'](),controller[_0x0a63('0x11')]);router[_0x0a63('0x12')](_0x0a63('0x9'),auth[_0x0a63('0x8')](),controller['update']);router[_0x0a63('0x13')]('/:id',auth[_0x0a63('0x8')](),controller[_0x0a63('0x14')]);module[_0x0a63('0x15')]=router; \ No newline at end of file +var _0x2d4f=['addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/sub_intervals','isAuthenticated','getIntervals','create','post'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x2d4f,0x7f));var _0xf2d4=function(_0x12893c,_0x539618){_0x12893c=_0x12893c-0x0;var _0x4751ac=_0x2d4f[_0x12893c];return _0x4751ac;};'use strict';var multer=require(_0xf2d4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf2d4('0x1'));var express=require(_0xf2d4('0x2'));var router=express[_0xf2d4('0x3')]();var fs_extra=require(_0xf2d4('0x4'));var auth=require(_0xf2d4('0x5'));var interaction=require(_0xf2d4('0x6'));var config=require(_0xf2d4('0x7'));var controller=require('./interval.controller');router[_0xf2d4('0x8')]('/',auth['isAuthenticated'](),controller[_0xf2d4('0x9')]);router[_0xf2d4('0x8')](_0xf2d4('0xa'),auth['isAuthenticated'](),controller[_0xf2d4('0xb')]);router[_0xf2d4('0x8')](_0xf2d4('0xc'),auth[_0xf2d4('0xd')](),controller[_0xf2d4('0xe')]);router['post']('/',auth[_0xf2d4('0xd')](),controller[_0xf2d4('0xf')]);router[_0xf2d4('0x10')](_0xf2d4('0xc'),auth['isAuthenticated'](),controller[_0xf2d4('0x11')]);router['post'](_0xf2d4('0x12'),auth[_0xf2d4('0xd')](),controller[_0xf2d4('0x13')]);router[_0xf2d4('0x14')]('/:id',auth[_0xf2d4('0xd')](),controller[_0xf2d4('0x15')]);router[_0xf2d4('0x16')](_0xf2d4('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xf2d4('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index dbd0d98..30776e7 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 _0x0714=['exports','STRING','sequelize'];(function(_0xf64500,_0x410815){var _0x58a6e0=function(_0x1fee17){while(--_0x1fee17){_0xf64500['push'](_0xf64500['shift']());}};_0x58a6e0(++_0x410815);}(_0x0714,0x1e8));var _0x4071=function(_0x3b4d06,_0x4b1237){_0x3b4d06=_0x3b4d06-0x0;var _0x10cfee=_0x0714[_0x3b4d06];return _0x10cfee;};'use strict';var Sequelize=require(_0x4071('0x0'));module[_0x4071('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4071('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x8b9c=['STRING','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b9c,0xbb));var _0xc8b9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8b9c[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0xc8b9('0x0')]={'name':{'type':Sequelize[_0xc8b9('0x1')]},'description':{'type':Sequelize[_0xc8b9('0x1')]},'interval':{'type':Sequelize[_0xc8b9('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 0c25419..37b4348 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 _0x5ce6=['zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','rawAttributes','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','Interval','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Intervals','UserProfileSection','userProfileId','autoAssociation','addInterval','IntervalId','getIntervals','findOne','addIntervals','bulkCreate','eml-format','rimraf'];(function(_0x3dd7f4,_0x52f9e2){var _0x5d0e42=function(_0x21a075){while(--_0x21a075){_0x3dd7f4['push'](_0x3dd7f4['shift']());}};_0x5d0e42(++_0x52f9e2);}(_0x5ce6,0x1cf));var _0x65ce=function(_0x6b475b,_0x3b9f10){_0x6b475b=_0x6b475b-0x0;var _0x472550=_0x5ce6[_0x6b475b];return _0x472550;};'use strict';var emlformat=require(_0x65ce('0x0'));var rimraf=require(_0x65ce('0x1'));var zipdir=require(_0x65ce('0x2'));var jsonpatch=require(_0x65ce('0x3'));var rp=require('request-promise');var moment=require(_0x65ce('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x65ce('0x5'));var path=require(_0x65ce('0x6'));var sox=require(_0x65ce('0x7'));var csv=require(_0x65ce('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x65ce('0x9'));var _=require(_0x65ce('0xa'));var squel=require(_0x65ce('0xb'));var crypto=require('crypto');var jsforce=require(_0x65ce('0xc'));var deskjs=require(_0x65ce('0xd'));var toCsv=require('to-csv');var querystring=require(_0x65ce('0xe'));var Papa=require(_0x65ce('0xf'));var Redis=require(_0x65ce('0x10'));var authService=require(_0x65ce('0x11'));var qs=require(_0x65ce('0x12'));var as=require(_0x65ce('0x13'));var hardwareService=require(_0x65ce('0x14'));var logger=require(_0x65ce('0x15'))(_0x65ce('0x16'));var utils=require(_0x65ce('0x17'));var config=require(_0x65ce('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x65ce('0x19'))['db'];var extensions=require(_0x65ce('0x1a'));function respondWithStatusCode(_0x173219,_0x21d513){_0x21d513=_0x21d513||0xcc;return function(_0x2bd9cb){if(_0x2bd9cb){return _0x173219['sendStatus'](_0x21d513);}return _0x173219['status'](_0x21d513)[_0x65ce('0x1b')]();};}function respondWithResult(_0x56566e,_0x540366){_0x540366=_0x540366||0xc8;return function(_0x41c254){if(_0x41c254){return _0x56566e[_0x65ce('0x1c')](_0x540366)[_0x65ce('0x1d')](_0x41c254);}};}function respondWithFilteredResult(_0x46b4d9,_0xacd2ad){return function(_0x3fc03c){if(_0x3fc03c){var _0x3c44f6=typeof _0xacd2ad[_0x65ce('0x1e')]==='undefined'&&typeof _0xacd2ad['limit']===_0x65ce('0x1f');var _0x285d49=_0x3fc03c[_0x65ce('0x20')];var _0x283da9=_0x3c44f6?0x0:_0xacd2ad[_0x65ce('0x1e')];var _0x50e933=_0x3c44f6?_0x3fc03c[_0x65ce('0x20')]:_0xacd2ad[_0x65ce('0x1e')]+_0xacd2ad[_0x65ce('0x21')];var _0x40e406;if(_0x50e933>=_0x285d49){_0x50e933=_0x285d49;_0x40e406=0xc8;}else{_0x40e406=0xce;}_0x46b4d9['status'](_0x40e406);return _0x46b4d9[_0x65ce('0x22')](_0x65ce('0x23'),_0x283da9+'-'+_0x50e933+'/'+_0x285d49)[_0x65ce('0x1d')](_0x3fc03c);}return null;};}function patchUpdates(_0x49e118){return function(_0xfccc82){try{jsonpatch[_0x65ce('0x24')](_0xfccc82,_0x49e118,!![]);}catch(_0x4bc745){return BPromise[_0x65ce('0x25')](_0x4bc745);}return _0xfccc82[_0x65ce('0x26')]();};}function saveUpdates(_0x31b1b8,_0x134ad1){return function(_0x2bb743){if(_0x2bb743){return _0x2bb743['update'](_0x31b1b8)[_0x65ce('0x27')](function(_0x57c0d7){return _0x57c0d7;});}return null;};}function removeEntity(_0x307abc,_0x48453e){return function(_0x46609e){if(_0x46609e){return _0x46609e[_0x65ce('0x28')]()[_0x65ce('0x27')](function(){var _0x3adef6=_0x46609e[_0x65ce('0x29')]({'plain':!![]});var _0x4aa5c4='Intervals';return db[_0x65ce('0x2a')]['destroy']({'where':{'type':_0x4aa5c4,'resourceId':_0x3adef6['id']}})[_0x65ce('0x27')](function(){return _0x46609e;});})[_0x65ce('0x27')](function(){_0x307abc[_0x65ce('0x1c')](0xcc)[_0x65ce('0x1b')]();});}};}function handleEntityNotFound(_0x8ea003,_0x539acb){return function(_0x1d771a){if(!_0x1d771a){_0x8ea003['sendStatus'](0x194);}return _0x1d771a;};}function handleError(_0x5a13e2,_0xc17c74){_0xc17c74=_0xc17c74||0x1f4;return function(_0x47f746){logger[_0x65ce('0x2b')](_0x47f746[_0x65ce('0x2c')]);if(_0x47f746[_0x65ce('0x2d')]){delete _0x47f746[_0x65ce('0x2d')];}_0x5a13e2['status'](_0xc17c74)[_0x65ce('0x2e')](_0x47f746);};}exports[_0x65ce('0x2f')]=function(_0x3b835f,_0x39e867){var _0x45232b={},_0x585f33={},_0x50126c={'count':0x0,'rows':[]};var _0x1fa4ad=_['map'](db['Interval'][_0x65ce('0x30')],function(_0x3ad444){return{'name':_0x3ad444['fieldName'],'type':_0x3ad444['type'][_0x65ce('0x31')]};});_0x585f33[_0x65ce('0x32')]=_[_0x65ce('0x33')](_0x1fa4ad,'name');_0x585f33[_0x65ce('0x34')]=_[_0x65ce('0x35')](_0x3b835f[_0x65ce('0x34')]);_0x585f33['filters']=_[_0x65ce('0x36')](_0x585f33['model'],_0x585f33[_0x65ce('0x34')]);_0x45232b[_0x65ce('0x37')]=_['intersection'](_0x585f33[_0x65ce('0x32')],qs[_0x65ce('0x38')](_0x3b835f['query'][_0x65ce('0x38')]));_0x45232b[_0x65ce('0x37')]=_0x45232b[_0x65ce('0x37')][_0x65ce('0x39')]?_0x45232b[_0x65ce('0x37')]:_0x585f33[_0x65ce('0x32')];if(!_0x3b835f[_0x65ce('0x34')][_0x65ce('0x3a')](_0x65ce('0x3b'))){_0x45232b[_0x65ce('0x21')]=qs[_0x65ce('0x21')](_0x3b835f[_0x65ce('0x34')][_0x65ce('0x21')]);_0x45232b[_0x65ce('0x1e')]=qs[_0x65ce('0x1e')](_0x3b835f[_0x65ce('0x34')][_0x65ce('0x1e')]);}_0x45232b[_0x65ce('0x3c')]=qs[_0x65ce('0x3d')](_0x3b835f[_0x65ce('0x34')][_0x65ce('0x3d')]);_0x45232b[_0x65ce('0x3e')]=qs[_0x65ce('0x3f')](_[_0x65ce('0x40')](_0x3b835f['query'],_0x585f33[_0x65ce('0x3f')]),_0x1fa4ad);if(_0x3b835f['query'][_0x65ce('0x41')]){_0x45232b[_0x65ce('0x3e')]=_['merge'](_0x45232b[_0x65ce('0x3e')],{'$or':_[_0x65ce('0x33')](_0x1fa4ad,function(_0x14c05e){if(_0x14c05e[_0x65ce('0x42')]!==_0x65ce('0x43')){var _0x40f072={};_0x40f072[_0x14c05e[_0x65ce('0x2d')]]={'$like':'%'+_0x3b835f[_0x65ce('0x34')][_0x65ce('0x41')]+'%'};return _0x40f072;}})});}_0x45232b=_[_0x65ce('0x44')]({},_0x45232b,_0x3b835f[_0x65ce('0x45')]);var _0x31e344={'where':_0x45232b[_0x65ce('0x3e')]};return db['Interval'][_0x65ce('0x20')](_0x31e344)['then'](function(_0x5bd43d){_0x50126c[_0x65ce('0x20')]=_0x5bd43d;if(_0x3b835f[_0x65ce('0x34')][_0x65ce('0x46')]){_0x45232b['include']=[{'all':!![]}];}return db[_0x65ce('0x47')][_0x65ce('0x48')](_0x45232b);})[_0x65ce('0x27')](function(_0x26dbb7){_0x50126c[_0x65ce('0x49')]=_0x26dbb7;return _0x50126c;})[_0x65ce('0x27')](respondWithFilteredResult(_0x39e867,_0x45232b))[_0x65ce('0x4a')](handleError(_0x39e867,null));};exports[_0x65ce('0x4b')]=function(_0x1fc520,_0x3ec7a1){var _0x35136f={'raw':!![],'where':{'id':_0x1fc520[_0x65ce('0x4c')]['id']}},_0x4559e3={};_0x4559e3['model']=_[_0x65ce('0x35')](db['Interval']['rawAttributes']);_0x4559e3[_0x65ce('0x34')]=_['keys'](_0x1fc520[_0x65ce('0x34')]);_0x4559e3['filters']=_['intersection'](_0x4559e3[_0x65ce('0x32')],_0x4559e3[_0x65ce('0x34')]);_0x35136f[_0x65ce('0x37')]=_['intersection'](_0x4559e3[_0x65ce('0x32')],qs[_0x65ce('0x38')](_0x1fc520[_0x65ce('0x34')][_0x65ce('0x38')]));_0x35136f[_0x65ce('0x37')]=_0x35136f[_0x65ce('0x37')][_0x65ce('0x39')]?_0x35136f[_0x65ce('0x37')]:_0x4559e3['model'];if(_0x1fc520[_0x65ce('0x34')][_0x65ce('0x46')]){_0x35136f['include']=[{'all':!![]}];}_0x35136f=_[_0x65ce('0x44')]({},_0x35136f,_0x1fc520[_0x65ce('0x45')]);return db[_0x65ce('0x47')][_0x65ce('0x4d')](_0x35136f)['then'](handleEntityNotFound(_0x3ec7a1,null))['then'](respondWithResult(_0x3ec7a1,null))[_0x65ce('0x4a')](handleError(_0x3ec7a1,null));};exports[_0x65ce('0x4e')]=function(_0x5633c9,_0x45131b){return db[_0x65ce('0x47')][_0x65ce('0x4e')](_0x5633c9[_0x65ce('0x4f')],{})[_0x65ce('0x27')](function(_0x3f0f22){var _0x207b60=_0x5633c9['user'][_0x65ce('0x29')]({'plain':!![]});if(!_0x207b60)throw new Error(_0x65ce('0x50'));if(_0x207b60[_0x65ce('0x51')]===_0x65ce('0x52')){var _0x3a1a1e=_0x3f0f22[_0x65ce('0x29')]({'plain':!![]});var _0x544f1d=_0x65ce('0x53');return db[_0x65ce('0x54')]['find']({'where':{'name':_0x544f1d,'userProfileId':_0x207b60[_0x65ce('0x55')]},'raw':!![]})[_0x65ce('0x27')](function(_0x23118b){if(_0x23118b&&_0x23118b[_0x65ce('0x56')]===0x0){return db[_0x65ce('0x2a')][_0x65ce('0x4e')]({'name':_0x3a1a1e[_0x65ce('0x2d')],'resourceId':_0x3a1a1e['id'],'type':_0x23118b[_0x65ce('0x2d')],'sectionId':_0x23118b['id']},{})['then'](function(){return _0x3f0f22;});}else{return _0x3f0f22;}})[_0x65ce('0x4a')](function(_0x4f5de){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f5de);throw _0x4f5de;});}return _0x3f0f22;})[_0x65ce('0x27')](respondWithResult(_0x45131b,0xc9))[_0x65ce('0x4a')](handleError(_0x45131b,null));};exports['update']=function(_0x4802f0,_0xe6a677){if(_0x4802f0['body']['id']){delete _0x4802f0['body']['id'];}return db['Interval']['find']({'where':{'id':_0x4802f0['params']['id']}})['then'](handleEntityNotFound(_0xe6a677,null))[_0x65ce('0x27')](saveUpdates(_0x4802f0[_0x65ce('0x4f')],null))[_0x65ce('0x27')](respondWithResult(_0xe6a677,null))[_0x65ce('0x4a')](handleError(_0xe6a677,null));};exports[_0x65ce('0x28')]=function(_0x3ed1f8,_0x41b3c9){return db[_0x65ce('0x47')][_0x65ce('0x4d')]({'where':{'id':_0x3ed1f8['params']['id']}})[_0x65ce('0x27')](handleEntityNotFound(_0x41b3c9,null))[_0x65ce('0x27')](removeEntity(_0x41b3c9,null))[_0x65ce('0x4a')](handleError(_0x41b3c9,null));};exports[_0x65ce('0x57')]=function(_0x12bb46,_0x127cf4,_0x1700eb){if(_0x12bb46[_0x65ce('0x4f')]['id']){delete _0x12bb46[_0x65ce('0x4f')]['id'];}return db[_0x65ce('0x47')]['find']({'where':{'id':_0x12bb46[_0x65ce('0x4c')]['id']}})['then'](handleEntityNotFound(_0x127cf4,null))[_0x65ce('0x27')](function(_0x5a5c1e){if(_0x5a5c1e){_0x12bb46[_0x65ce('0x4f')][_0x65ce('0x58')]=_0x5a5c1e['id'];return db[_0x65ce('0x47')][_0x65ce('0x4e')](_0x12bb46[_0x65ce('0x4f')]);}})[_0x65ce('0x27')](respondWithResult(_0x127cf4,null))[_0x65ce('0x4a')](handleError(_0x127cf4,null));};exports[_0x65ce('0x59')]=function(_0xf4d66a,_0x374415,_0x217801){var _0x448b4d={};var _0x27f97f={};var _0x52c4bc;var _0x5a05d3;return db[_0x65ce('0x47')][_0x65ce('0x5a')]({'where':{'id':_0xf4d66a[_0x65ce('0x4c')]['id']}})[_0x65ce('0x27')](handleEntityNotFound(_0x374415,null))[_0x65ce('0x27')](function(_0x123429){if(_0x123429){_0x52c4bc=_0x123429;_0x27f97f['model']=_[_0x65ce('0x35')](db[_0x65ce('0x47')]['rawAttributes']);_0x27f97f[_0x65ce('0x34')]=_['keys'](_0xf4d66a[_0x65ce('0x34')]);_0x27f97f[_0x65ce('0x3f')]=_[_0x65ce('0x36')](_0x27f97f[_0x65ce('0x32')],_0x27f97f[_0x65ce('0x34')]);_0x448b4d[_0x65ce('0x37')]=_[_0x65ce('0x36')](_0x27f97f[_0x65ce('0x32')],qs[_0x65ce('0x38')](_0xf4d66a[_0x65ce('0x34')]['fields']));_0x448b4d[_0x65ce('0x37')]=_0x448b4d[_0x65ce('0x37')][_0x65ce('0x39')]?_0x448b4d[_0x65ce('0x37')]:_0x27f97f['model'];_0x448b4d[_0x65ce('0x3c')]=qs[_0x65ce('0x3d')](_0xf4d66a[_0x65ce('0x34')]['sort']);_0x448b4d[_0x65ce('0x3e')]=qs[_0x65ce('0x3f')](_[_0x65ce('0x40')](_0xf4d66a[_0x65ce('0x34')],_0x27f97f[_0x65ce('0x3f')]));if(_0xf4d66a[_0x65ce('0x34')][_0x65ce('0x41')]){_0x448b4d[_0x65ce('0x3e')]=_[_0x65ce('0x44')](_0x448b4d[_0x65ce('0x3e')],{'$or':_[_0x65ce('0x33')](_0x448b4d[_0x65ce('0x37')],function(_0xf263a4){var _0x4fdf03={};_0x4fdf03[_0xf263a4]={'$like':'%'+_0xf4d66a['query'][_0x65ce('0x41')]+'%'};return _0x4fdf03;})});}_0x448b4d=_['merge']({},_0x448b4d,_0xf4d66a[_0x65ce('0x45')]);return _0x52c4bc[_0x65ce('0x59')](_0x448b4d);}})['then'](function(_0x29f21f){if(_0x29f21f){_0x5a05d3=_0x29f21f[_0x65ce('0x39')];if(!_0xf4d66a[_0x65ce('0x34')][_0x65ce('0x3a')]('nolimit')){_0x448b4d[_0x65ce('0x21')]=qs[_0x65ce('0x21')](_0xf4d66a[_0x65ce('0x34')][_0x65ce('0x21')]);_0x448b4d[_0x65ce('0x1e')]=qs['offset'](_0xf4d66a[_0x65ce('0x34')][_0x65ce('0x1e')]);}return _0x52c4bc[_0x65ce('0x59')](_0x448b4d);}})['then'](function(_0x14080b){if(_0x14080b){return _0x14080b?{'count':_0x5a05d3,'rows':_0x14080b}:null;}})[_0x65ce('0x27')](respondWithResult(_0x374415,null))[_0x65ce('0x4a')](handleError(_0x374415,null));};exports[_0x65ce('0x5b')]=function(_0x48ec76,_0x30439a,_0x2d875a){return db['Interval'][_0x65ce('0x5a')]({'where':{'id':_0x48ec76[_0x65ce('0x4c')]['id']}})[_0x65ce('0x27')](handleEntityNotFound(_0x30439a,null))['then'](function(_0x97b483){if(_0x97b483){return db['sequelize']['transaction'](function(_0x5200b0){return db[_0x65ce('0x47')][_0x65ce('0x28')]({'where':{'IntervalId':_0x48ec76[_0x65ce('0x4c')]['id']},'transaction':_0x5200b0})[_0x65ce('0x27')](function(_0x5590cc){var _0x5ae2ff=_[_0x65ce('0x33')](_0x48ec76['body'],function(_0x8d4c64){delete _0x8d4c64['id'];_0x8d4c64['IntervalId']=_0x48ec76[_0x65ce('0x4c')]['id'];return _0x8d4c64;});return db[_0x65ce('0x47')][_0x65ce('0x5c')](_0x5ae2ff,{'transaction':_0x5200b0});});})[_0x65ce('0x27')](function(){return db[_0x65ce('0x47')]['findAll']({'where':{'IntervalId':_0x48ec76[_0x65ce('0x4c')]['id']}});});}})[_0x65ce('0x27')](respondWithResult(_0x30439a,null))['catch'](handleError(_0x30439a,null));}; \ No newline at end of file +var _0x83f7=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Interval','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','find','destroy','addInterval','getIntervals','addIntervals','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','get','Intervals','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields'];(function(_0xc8023,_0xd1912){var _0x448b50=function(_0x4b8a6f){while(--_0x4b8a6f){_0xc8023['push'](_0xc8023['shift']());}};_0x448b50(++_0xd1912);}(_0x83f7,0x84));var _0x783f=function(_0x5de26b,_0x1d2f14){_0x5de26b=_0x5de26b-0x0;var _0x5a0b72=_0x83f7[_0x5de26b];return _0x5a0b72;};'use strict';var emlformat=require(_0x783f('0x0'));var rimraf=require(_0x783f('0x1'));var zipdir=require(_0x783f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x783f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x783f('0x4'));var util=require(_0x783f('0x5'));var path=require(_0x783f('0x6'));var sox=require(_0x783f('0x7'));var csv=require(_0x783f('0x8'));var ejs=require(_0x783f('0x9'));var fs=require('fs');var fs_extra=require(_0x783f('0xa'));var _=require(_0x783f('0xb'));var squel=require('squel');var crypto=require(_0x783f('0xc'));var jsforce=require(_0x783f('0xd'));var deskjs=require(_0x783f('0xe'));var toCsv=require(_0x783f('0x8'));var querystring=require('querystring');var Papa=require(_0x783f('0xf'));var Redis=require('ioredis');var authService=require(_0x783f('0x10'));var qs=require(_0x783f('0x11'));var as=require(_0x783f('0x12'));var hardwareService=require(_0x783f('0x13'));var logger=require(_0x783f('0x14'))(_0x783f('0x15'));var utils=require(_0x783f('0x16'));var config=require(_0x783f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x783f('0x18'))['db'];var extensions=require(_0x783f('0x19'));function respondWithStatusCode(_0x5d9225,_0x334fce){_0x334fce=_0x334fce||0xcc;return function(_0x2eb246){if(_0x2eb246){return _0x5d9225[_0x783f('0x1a')](_0x334fce);}return _0x5d9225[_0x783f('0x1b')](_0x334fce)[_0x783f('0x1c')]();};}function respondWithResult(_0x4bf50e,_0x291d85){_0x291d85=_0x291d85||0xc8;return function(_0x44c18e){if(_0x44c18e){return _0x4bf50e[_0x783f('0x1b')](_0x291d85)['json'](_0x44c18e);}};}function respondWithFilteredResult(_0x59c0d7,_0x204350){return function(_0x15e0ba){if(_0x15e0ba){var _0xcc2994=typeof _0x204350[_0x783f('0x1d')]===_0x783f('0x1e')&&typeof _0x204350[_0x783f('0x1f')]==='undefined';var _0x3e42a9=_0x15e0ba[_0x783f('0x20')];var _0x1ccf42=_0xcc2994?0x0:_0x204350[_0x783f('0x1d')];var _0x486155=_0xcc2994?_0x15e0ba[_0x783f('0x20')]:_0x204350[_0x783f('0x1d')]+_0x204350['limit'];var _0x105f9a;if(_0x486155>=_0x3e42a9){_0x486155=_0x3e42a9;_0x105f9a=0xc8;}else{_0x105f9a=0xce;}_0x59c0d7[_0x783f('0x1b')](_0x105f9a);return _0x59c0d7[_0x783f('0x21')]('Content-Range',_0x1ccf42+'-'+_0x486155+'/'+_0x3e42a9)[_0x783f('0x22')](_0x15e0ba);}return null;};}function patchUpdates(_0x1b8c4e){return function(_0x1266e8){try{jsonpatch[_0x783f('0x23')](_0x1266e8,_0x1b8c4e,!![]);}catch(_0x1a0d72){return BPromise[_0x783f('0x24')](_0x1a0d72);}return _0x1266e8[_0x783f('0x25')]();};}function saveUpdates(_0x20bd86,_0x451d41){return function(_0x4e19a5){if(_0x4e19a5){return _0x4e19a5[_0x783f('0x26')](_0x20bd86)[_0x783f('0x27')](function(_0x2cb017){return _0x2cb017;});}return null;};}function removeEntity(_0x168c90,_0x27a61c){return function(_0x38bc45){if(_0x38bc45){return _0x38bc45['destroy']()[_0x783f('0x27')](function(){var _0xf04f83=_0x38bc45[_0x783f('0x28')]({'plain':!![]});var _0x50c849=_0x783f('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x50c849,'resourceId':_0xf04f83['id']}})['then'](function(){return _0x38bc45;});})[_0x783f('0x27')](function(){_0x168c90[_0x783f('0x1b')](0xcc)[_0x783f('0x1c')]();});}};}function handleEntityNotFound(_0x5534b2,_0x5ddfa5){return function(_0xa19615){if(!_0xa19615){_0x5534b2[_0x783f('0x1a')](0x194);}return _0xa19615;};}function handleError(_0x2ce690,_0x369560){_0x369560=_0x369560||0x1f4;return function(_0x4283d0){logger[_0x783f('0x2a')](_0x4283d0[_0x783f('0x2b')]);if(_0x4283d0[_0x783f('0x2c')]){delete _0x4283d0[_0x783f('0x2c')];}_0x2ce690[_0x783f('0x1b')](_0x369560)[_0x783f('0x2d')](_0x4283d0);};}exports[_0x783f('0x2e')]=function(_0x47eadb,_0x56b28d){var _0x2f82a1={},_0xa243b6={},_0xdf6e1c={'count':0x0,'rows':[]};var _0x136098=_['map'](db['Interval'][_0x783f('0x2f')],function(_0xb302fb){return{'name':_0xb302fb[_0x783f('0x30')],'type':_0xb302fb[_0x783f('0x31')][_0x783f('0x32')]};});_0xa243b6[_0x783f('0x33')]=_[_0x783f('0x34')](_0x136098,'name');_0xa243b6[_0x783f('0x35')]=_[_0x783f('0x36')](_0x47eadb[_0x783f('0x35')]);_0xa243b6[_0x783f('0x37')]=_[_0x783f('0x38')](_0xa243b6[_0x783f('0x33')],_0xa243b6[_0x783f('0x35')]);_0x2f82a1['attributes']=_['intersection'](_0xa243b6[_0x783f('0x33')],qs[_0x783f('0x39')](_0x47eadb['query'][_0x783f('0x39')]));_0x2f82a1[_0x783f('0x3a')]=_0x2f82a1['attributes'][_0x783f('0x3b')]?_0x2f82a1['attributes']:_0xa243b6[_0x783f('0x33')];if(!_0x47eadb[_0x783f('0x35')][_0x783f('0x3c')](_0x783f('0x3d'))){_0x2f82a1[_0x783f('0x1f')]=qs[_0x783f('0x1f')](_0x47eadb[_0x783f('0x35')][_0x783f('0x1f')]);_0x2f82a1[_0x783f('0x1d')]=qs['offset'](_0x47eadb[_0x783f('0x35')][_0x783f('0x1d')]);}_0x2f82a1[_0x783f('0x3e')]=qs[_0x783f('0x3f')](_0x47eadb[_0x783f('0x35')][_0x783f('0x3f')]);_0x2f82a1[_0x783f('0x40')]=qs['filters'](_[_0x783f('0x41')](_0x47eadb[_0x783f('0x35')],_0xa243b6['filters']),_0x136098);if(_0x47eadb[_0x783f('0x35')][_0x783f('0x42')]){_0x2f82a1['where']=_[_0x783f('0x43')](_0x2f82a1['where'],{'$or':_[_0x783f('0x34')](_0x136098,function(_0x31ce04){if(_0x31ce04[_0x783f('0x31')]!==_0x783f('0x44')){var _0x36431d={};_0x36431d[_0x31ce04[_0x783f('0x2c')]]={'$like':'%'+_0x47eadb['query']['filter']+'%'};return _0x36431d;}})});}_0x2f82a1=_[_0x783f('0x43')]({},_0x2f82a1,_0x47eadb[_0x783f('0x45')]);var _0x52224a={'where':_0x2f82a1['where']};return db['Interval']['count'](_0x52224a)['then'](function(_0x172397){_0xdf6e1c[_0x783f('0x20')]=_0x172397;if(_0x47eadb[_0x783f('0x35')][_0x783f('0x46')]){_0x2f82a1[_0x783f('0x47')]=[{'all':!![]}];}return db[_0x783f('0x48')][_0x783f('0x49')](_0x2f82a1);})[_0x783f('0x27')](function(_0x9d9406){_0xdf6e1c[_0x783f('0x4a')]=_0x9d9406;return _0xdf6e1c;})[_0x783f('0x27')](respondWithFilteredResult(_0x56b28d,_0x2f82a1))[_0x783f('0x4b')](handleError(_0x56b28d,null));};exports[_0x783f('0x4c')]=function(_0x417b3a,_0x50c655){var _0x595303={'raw':!![],'where':{'id':_0x417b3a[_0x783f('0x4d')]['id']}},_0x36a610={};_0x36a610[_0x783f('0x33')]=_[_0x783f('0x36')](db[_0x783f('0x48')][_0x783f('0x2f')]);_0x36a610[_0x783f('0x35')]=_['keys'](_0x417b3a[_0x783f('0x35')]);_0x36a610[_0x783f('0x37')]=_[_0x783f('0x38')](_0x36a610[_0x783f('0x33')],_0x36a610[_0x783f('0x35')]);_0x595303['attributes']=_[_0x783f('0x38')](_0x36a610['model'],qs[_0x783f('0x39')](_0x417b3a[_0x783f('0x35')][_0x783f('0x39')]));_0x595303['attributes']=_0x595303['attributes'][_0x783f('0x3b')]?_0x595303[_0x783f('0x3a')]:_0x36a610[_0x783f('0x33')];if(_0x417b3a['query'][_0x783f('0x46')]){_0x595303[_0x783f('0x47')]=[{'all':!![]}];}_0x595303=_[_0x783f('0x43')]({},_0x595303,_0x417b3a[_0x783f('0x45')]);return db['Interval']['find'](_0x595303)[_0x783f('0x27')](handleEntityNotFound(_0x50c655,null))[_0x783f('0x27')](respondWithResult(_0x50c655,null))[_0x783f('0x4b')](handleError(_0x50c655,null));};exports[_0x783f('0x4e')]=function(_0x4ce2d5,_0x14f29c){return db[_0x783f('0x48')]['create'](_0x4ce2d5[_0x783f('0x4f')],{})[_0x783f('0x27')](function(_0x5570fe){var _0x489d00=_0x4ce2d5[_0x783f('0x50')]['get']({'plain':!![]});if(!_0x489d00)throw new Error(_0x783f('0x51'));if(_0x489d00['role']===_0x783f('0x50')){var _0x56f7c9=_0x5570fe['get']({'plain':!![]});var _0x25f45a='Intervals';return db[_0x783f('0x52')]['find']({'where':{'name':_0x25f45a,'userProfileId':_0x489d00[_0x783f('0x53')]},'raw':!![]})[_0x783f('0x27')](function(_0xb02c78){if(_0xb02c78&&_0xb02c78[_0x783f('0x54')]===0x0){return db[_0x783f('0x55')][_0x783f('0x4e')]({'name':_0x56f7c9['name'],'resourceId':_0x56f7c9['id'],'type':_0xb02c78['name'],'sectionId':_0xb02c78['id']},{})[_0x783f('0x27')](function(){return _0x5570fe;});}else{return _0x5570fe;}})['catch'](function(_0x956b17){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x956b17);throw _0x956b17;});}return _0x5570fe;})[_0x783f('0x27')](respondWithResult(_0x14f29c,0xc9))[_0x783f('0x4b')](handleError(_0x14f29c,null));};exports[_0x783f('0x26')]=function(_0x23bb8c,_0x3e7cf3){if(_0x23bb8c[_0x783f('0x4f')]['id']){delete _0x23bb8c[_0x783f('0x4f')]['id'];}return db['Interval'][_0x783f('0x56')]({'where':{'id':_0x23bb8c[_0x783f('0x4d')]['id']}})[_0x783f('0x27')](handleEntityNotFound(_0x3e7cf3,null))['then'](saveUpdates(_0x23bb8c[_0x783f('0x4f')],null))[_0x783f('0x27')](respondWithResult(_0x3e7cf3,null))[_0x783f('0x4b')](handleError(_0x3e7cf3,null));};exports[_0x783f('0x57')]=function(_0x109482,_0x478e0c){return db['Interval'][_0x783f('0x56')]({'where':{'id':_0x109482['params']['id']}})[_0x783f('0x27')](handleEntityNotFound(_0x478e0c,null))[_0x783f('0x27')](removeEntity(_0x478e0c,null))[_0x783f('0x4b')](handleError(_0x478e0c,null));};exports[_0x783f('0x58')]=function(_0x3a1e18,_0x4dc194,_0x4bfae4){if(_0x3a1e18[_0x783f('0x4f')]['id']){delete _0x3a1e18[_0x783f('0x4f')]['id'];}return db['Interval']['find']({'where':{'id':_0x3a1e18[_0x783f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4dc194,null))[_0x783f('0x27')](function(_0x527616){if(_0x527616){_0x3a1e18[_0x783f('0x4f')]['IntervalId']=_0x527616['id'];return db[_0x783f('0x48')][_0x783f('0x4e')](_0x3a1e18[_0x783f('0x4f')]);}})[_0x783f('0x27')](respondWithResult(_0x4dc194,null))['catch'](handleError(_0x4dc194,null));};exports[_0x783f('0x59')]=function(_0x30f356,_0x4815fa,_0x1f1df6){var _0x2bead7={};var _0x3a606f={};var _0x15ba37;var _0x1ac1b0;return db['Interval']['findOne']({'where':{'id':_0x30f356[_0x783f('0x4d')]['id']}})[_0x783f('0x27')](handleEntityNotFound(_0x4815fa,null))[_0x783f('0x27')](function(_0x5383c5){if(_0x5383c5){_0x15ba37=_0x5383c5;_0x3a606f[_0x783f('0x33')]=_[_0x783f('0x36')](db[_0x783f('0x48')][_0x783f('0x2f')]);_0x3a606f['query']=_[_0x783f('0x36')](_0x30f356['query']);_0x3a606f[_0x783f('0x37')]=_[_0x783f('0x38')](_0x3a606f[_0x783f('0x33')],_0x3a606f[_0x783f('0x35')]);_0x2bead7['attributes']=_['intersection'](_0x3a606f[_0x783f('0x33')],qs['fields'](_0x30f356[_0x783f('0x35')][_0x783f('0x39')]));_0x2bead7[_0x783f('0x3a')]=_0x2bead7['attributes'][_0x783f('0x3b')]?_0x2bead7[_0x783f('0x3a')]:_0x3a606f[_0x783f('0x33')];_0x2bead7[_0x783f('0x3e')]=qs['sort'](_0x30f356[_0x783f('0x35')]['sort']);_0x2bead7[_0x783f('0x40')]=qs['filters'](_['pick'](_0x30f356[_0x783f('0x35')],_0x3a606f['filters']));if(_0x30f356[_0x783f('0x35')]['filter']){_0x2bead7['where']=_['merge'](_0x2bead7[_0x783f('0x40')],{'$or':_[_0x783f('0x34')](_0x2bead7[_0x783f('0x3a')],function(_0x4af146){var _0x51ca93={};_0x51ca93[_0x4af146]={'$like':'%'+_0x30f356[_0x783f('0x35')][_0x783f('0x42')]+'%'};return _0x51ca93;})});}_0x2bead7=_[_0x783f('0x43')]({},_0x2bead7,_0x30f356[_0x783f('0x45')]);return _0x15ba37[_0x783f('0x59')](_0x2bead7);}})['then'](function(_0x20c5e0){if(_0x20c5e0){_0x1ac1b0=_0x20c5e0[_0x783f('0x3b')];if(!_0x30f356['query'][_0x783f('0x3c')](_0x783f('0x3d'))){_0x2bead7[_0x783f('0x1f')]=qs[_0x783f('0x1f')](_0x30f356[_0x783f('0x35')][_0x783f('0x1f')]);_0x2bead7[_0x783f('0x1d')]=qs['offset'](_0x30f356[_0x783f('0x35')][_0x783f('0x1d')]);}return _0x15ba37[_0x783f('0x59')](_0x2bead7);}})[_0x783f('0x27')](function(_0x87963d){if(_0x87963d){return _0x87963d?{'count':_0x1ac1b0,'rows':_0x87963d}:null;}})[_0x783f('0x27')](respondWithResult(_0x4815fa,null))[_0x783f('0x4b')](handleError(_0x4815fa,null));};exports[_0x783f('0x5a')]=function(_0x2b554e,_0x157181,_0x398776){return db[_0x783f('0x48')]['findOne']({'where':{'id':_0x2b554e[_0x783f('0x4d')]['id']}})[_0x783f('0x27')](handleEntityNotFound(_0x157181,null))[_0x783f('0x27')](function(_0x5b4ae1){if(_0x5b4ae1){return db[_0x783f('0x5b')][_0x783f('0x5c')](function(_0x1db6dc){return db[_0x783f('0x48')][_0x783f('0x57')]({'where':{'IntervalId':_0x2b554e[_0x783f('0x4d')]['id']},'transaction':_0x1db6dc})[_0x783f('0x27')](function(_0x3cb086){var _0x53ff10=_[_0x783f('0x34')](_0x2b554e[_0x783f('0x4f')],function(_0x3429ca){delete _0x3429ca['id'];_0x3429ca[_0x783f('0x5d')]=_0x2b554e[_0x783f('0x4d')]['id'];return _0x3429ca;});return db[_0x783f('0x48')][_0x783f('0x5e')](_0x53ff10,{'transaction':_0x1db6dc});});})['then'](function(){return db[_0x783f('0x48')][_0x783f('0x49')]({'where':{'IntervalId':_0x2b554e['params']['id']}});});}})[_0x783f('0x27')](respondWithResult(_0x157181,null))[_0x783f('0x4b')](handleError(_0x157181,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 3fd85cb..bbc6c26 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 _0xb458=['path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x431b68,_0x309df4){var _0x30d1cc=function(_0xd65b91){while(--_0xd65b91){_0x431b68['push'](_0x431b68['shift']());}};_0x30d1cc(++_0x309df4);}(_0xb458,0xca));var _0x8b45=function(_0x22d114,_0x2d249b){_0x22d114=_0x22d114-0x0;var _0x17c386=_0xb458[_0x22d114];return _0x17c386;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var logger=require(_0x8b45('0x2'))(_0x8b45('0x3'));var moment=require('moment');var BPromise=require(_0x8b45('0x4'));var rp=require(_0x8b45('0x5'));var fs=require('fs');var path=require(_0x8b45('0x6'));var rimraf=require(_0x8b45('0x7'));var config=require(_0x8b45('0x8'));var attributes=require(_0x8b45('0x9'));var extensions=require(_0x8b45('0xa'));module[_0x8b45('0xb')]=function(_0x2a5b3c,_0x114de0){return _0x2a5b3c[_0x8b45('0xc')](_0x8b45('0xd'),attributes,{'tableName':_0x8b45('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x54f299,_0x122b6d){extensions['rewrite'](_0x2a5b3c,_0x54f299);},'afterBulkCreate':function(_0x4a1617,_0x3c067b,_0x40b585){_0x40b585();extensions[_0x8b45('0xf')](_0x2a5b3c,_0x4a1617[0x0]);},'afterUpdate':function(_0x59ecdf,_0x270cae){extensions['rewrite'](_0x2a5b3c,_0x59ecdf);},'afterDestroy':function(_0x290585,_0x1b8b66){extensions[_0x8b45('0xf')](_0x2a5b3c,_0x290585);}}});}; \ No newline at end of file +var _0xfc61=['lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./interval.attributes','define','Interval','tools_intervals','rewrite'];(function(_0x25c57f,_0x30ca62){var _0x1e77d2=function(_0x4ebb5b){while(--_0x4ebb5b){_0x25c57f['push'](_0x25c57f['shift']());}};_0x1e77d2(++_0x30ca62);}(_0xfc61,0x78));var _0x1fc6=function(_0x29fb49,_0x1b4669){_0x29fb49=_0x29fb49-0x0;var _0x24d579=_0xfc61[_0x29fb49];return _0x24d579;};'use strict';var _=require(_0x1fc6('0x0'));var util=require(_0x1fc6('0x1'));var logger=require(_0x1fc6('0x2'))(_0x1fc6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fc6('0x4'));var rimraf=require(_0x1fc6('0x5'));var config=require(_0x1fc6('0x6'));var attributes=require(_0x1fc6('0x7'));var extensions=require('../../components/extensions/rewrite');module['exports']=function(_0x2c32ca,_0x2afe7c){return _0x2c32ca[_0x1fc6('0x8')](_0x1fc6('0x9'),attributes,{'tableName':_0x1fc6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x567c47,_0x8891cc){extensions[_0x1fc6('0xb')](_0x2c32ca,_0x567c47);},'afterBulkCreate':function(_0x300375,_0x132f16,_0x5a3e6f){_0x5a3e6f();extensions[_0x1fc6('0xb')](_0x2c32ca,_0x300375[0x0]);},'afterUpdate':function(_0xd02ed5,_0x480324){extensions[_0x1fc6('0xb')](_0x2c32ca,_0xd02ed5);},'afterDestroy':function(_0x12c3d9,_0x2bc710){extensions[_0x1fc6('0xb')](_0x2c32ca,_0x12c3d9);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 5397b18..68963cc 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 _0xd876=['jayson/promise','client','then','info','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Interval','options','raw','where','include','attributes','map','model','GetInterval','debug','ShowInterval','find','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3925ff,_0x3fe6e5){var _0x1f16d5=function(_0xc538a2){while(--_0xc538a2){_0x3925ff['push'](_0x3925ff['shift']());}};_0x1f16d5(++_0x3fe6e5);}(_0xd876,0x1c6));var _0x6d87=function(_0x2a60ae,_0x37b1a3){_0x2a60ae=_0x2a60ae-0x0;var _0x1625c0=_0xd876[_0x2a60ae];return _0x1625c0;};'use strict';var _=require(_0x6d87('0x0'));var util=require(_0x6d87('0x1'));var moment=require('moment');var BPromise=require(_0x6d87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d87('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d87('0x4'));var logger=require(_0x6d87('0x5'))(_0x6d87('0x6'));var config=require(_0x6d87('0x7'));var jayson=require(_0x6d87('0x8'));var client=jayson[_0x6d87('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed9f4,_0x5d28d2,_0x284d9f){return new BPromise(function(_0x159c41,_0x392680){return client['request'](_0x4ed9f4,_0x284d9f)[_0x6d87('0xa')](function(_0x7a8fe0){logger[_0x6d87('0xb')](_0x6d87('0xc'),_0x5d28d2,_0x6d87('0xd'));logger['debug'](_0x6d87('0xe'),_0x5d28d2,_0x6d87('0xd'),JSON[_0x6d87('0xf')](_0x7a8fe0));if(_0x7a8fe0[_0x6d87('0x10')]){if(_0x7a8fe0[_0x6d87('0x10')][_0x6d87('0x11')]===0x1f4){logger[_0x6d87('0x10')]('Interval,\x20%s,\x20%s',_0x5d28d2,_0x7a8fe0[_0x6d87('0x10')][_0x6d87('0x12')]);return _0x392680(_0x7a8fe0[_0x6d87('0x10')]['message']);}logger['error'](_0x6d87('0xc'),_0x5d28d2,_0x7a8fe0['error']['message']);return _0x159c41(_0x7a8fe0['error'][_0x6d87('0x12')]);}else{logger['info'](_0x6d87('0xc'),_0x5d28d2,_0x6d87('0xd'));_0x159c41(_0x7a8fe0[_0x6d87('0x13')][_0x6d87('0x12')]);}})[_0x6d87('0x14')](function(_0x1db75f){logger[_0x6d87('0x10')](_0x6d87('0xc'),_0x5d28d2,_0x1db75f);_0x392680(_0x1db75f);});});}exports['GetInterval']=function(_0x815078){var _0x404a58=this;return new Promise(function(_0x3f62d2,_0x5c4b38){return db[_0x6d87('0x15')]['findAll']({'raw':_0x815078['options']?_0x815078[_0x6d87('0x16')][_0x6d87('0x17')]===undefined?!![]:![]:!![],'where':_0x815078[_0x6d87('0x16')]?_0x815078[_0x6d87('0x16')][_0x6d87('0x18')]||null:null,'attributes':_0x815078[_0x6d87('0x16')]?_0x815078[_0x6d87('0x16')]['attributes']||null:null,'limit':_0x815078[_0x6d87('0x16')]?_0x815078[_0x6d87('0x16')]['limit']||null:null,'include':_0x815078[_0x6d87('0x16')]?_0x815078[_0x6d87('0x16')][_0x6d87('0x19')]?_['map'](_0x815078['options']['include'],function(_0x168d58){return{'model':db[_0x168d58['model']],'as':_0x168d58['as'],'attributes':_0x168d58[_0x6d87('0x1a')],'include':_0x168d58[_0x6d87('0x19')]?_['map'](_0x168d58[_0x6d87('0x19')],function(_0x22b649){return{'model':db[_0x22b649['model']],'as':_0x22b649['as'],'attributes':_0x22b649[_0x6d87('0x1a')],'include':_0x22b649['include']?_[_0x6d87('0x1b')](_0x22b649[_0x6d87('0x19')],function(_0x1a8448){return{'model':db[_0x1a8448[_0x6d87('0x1c')]],'as':_0x1a8448['as'],'attributes':_0x1a8448[_0x6d87('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6d87('0xa')](function(_0x4f46a4){logger['info'](_0x6d87('0x1d'),_0x815078);logger[_0x6d87('0x1e')](_0x6d87('0x1d'),_0x815078,JSON['stringify'](_0x4f46a4));_0x3f62d2(_0x4f46a4);})[_0x6d87('0x14')](function(_0x12a139){logger[_0x6d87('0x10')]('GetInterval',_0x12a139[_0x6d87('0x12')],_0x815078);_0x5c4b38(_0x404a58[_0x6d87('0x10')](0x1f4,_0x12a139[_0x6d87('0x12')]));});});};exports[_0x6d87('0x1f')]=function(_0x53ba4e){var _0x53fcfb=this;return new Promise(function(_0xa89b5,_0x5a4313){return db[_0x6d87('0x15')][_0x6d87('0x20')]({'raw':_0x53ba4e[_0x6d87('0x16')]?_0x53ba4e[_0x6d87('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x53ba4e[_0x6d87('0x16')]?_0x53ba4e[_0x6d87('0x16')][_0x6d87('0x18')]||null:null,'attributes':_0x53ba4e[_0x6d87('0x16')]?_0x53ba4e[_0x6d87('0x16')][_0x6d87('0x1a')]||null:null,'include':_0x53ba4e[_0x6d87('0x16')]?_0x53ba4e[_0x6d87('0x16')][_0x6d87('0x19')]?_[_0x6d87('0x1b')](_0x53ba4e['options']['include'],function(_0x2822d2){return{'model':db[_0x2822d2[_0x6d87('0x1c')]],'as':_0x2822d2['as'],'attributes':_0x2822d2['attributes'],'include':_0x2822d2['include']?_[_0x6d87('0x1b')](_0x2822d2[_0x6d87('0x19')],function(_0x1d79b1){return{'model':db[_0x1d79b1['model']],'as':_0x1d79b1['as'],'attributes':_0x1d79b1['attributes'],'include':_0x1d79b1[_0x6d87('0x19')]?_[_0x6d87('0x1b')](_0x1d79b1['include'],function(_0x31692c){return{'model':db[_0x31692c[_0x6d87('0x1c')]],'as':_0x31692c['as'],'attributes':_0x31692c[_0x6d87('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3117b3){logger[_0x6d87('0xb')](_0x6d87('0x1f'),_0x53ba4e);logger[_0x6d87('0x1e')](_0x6d87('0x1f'),_0x53ba4e,JSON[_0x6d87('0xf')](_0x3117b3));_0xa89b5(_0x3117b3);})[_0x6d87('0x14')](function(_0xdcb26){logger[_0x6d87('0x10')](_0x6d87('0x1f'),_0xdcb26[_0x6d87('0x12')],_0x53ba4e);_0x5a4313(_0x53fcfb['error'](0x1f4,_0xdcb26[_0x6d87('0x12')]));});});}; \ No newline at end of file +var _0x2bb2=['options','raw','where','limit','include','map','model','ShowInterval','find','attributes','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','client','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetInterval','Interval','findAll'];(function(_0x2bf635,_0x454fe4){var _0xfed6a=function(_0x35d099){while(--_0x35d099){_0x2bf635['push'](_0x2bf635['shift']());}};_0xfed6a(++_0x454fe4);}(_0x2bb2,0x133));var _0x22bb=function(_0x2e1a9a,_0x11e43f){_0x2e1a9a=_0x2e1a9a-0x0;var _0x33f5e7=_0x2bb2[_0x2e1a9a];return _0x33f5e7;};'use strict';var _=require(_0x22bb('0x0'));var util=require(_0x22bb('0x1'));var moment=require(_0x22bb('0x2'));var BPromise=require('bluebird');var rs=require(_0x22bb('0x3'));var fs=require('fs');var Redis=require(_0x22bb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x22bb('0x5'));var logger=require(_0x22bb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x22bb('0x7')][_0x22bb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x122f7f,_0x265c0a,_0x346899){return new BPromise(function(_0x144438,_0x1ded73){return client[_0x22bb('0x9')](_0x122f7f,_0x346899)[_0x22bb('0xa')](function(_0xd825a4){logger[_0x22bb('0xb')](_0x22bb('0xc'),_0x265c0a,_0x22bb('0xd'));logger[_0x22bb('0xe')](_0x22bb('0xf'),_0x265c0a,_0x22bb('0xd'),JSON[_0x22bb('0x10')](_0xd825a4));if(_0xd825a4[_0x22bb('0x11')]){if(_0xd825a4['error']['code']===0x1f4){logger[_0x22bb('0x11')](_0x22bb('0xc'),_0x265c0a,_0xd825a4[_0x22bb('0x11')][_0x22bb('0x12')]);return _0x1ded73(_0xd825a4[_0x22bb('0x11')]['message']);}logger[_0x22bb('0x11')]('Interval,\x20%s,\x20%s',_0x265c0a,_0xd825a4['error'][_0x22bb('0x12')]);return _0x144438(_0xd825a4['error']['message']);}else{logger[_0x22bb('0xb')](_0x22bb('0xc'),_0x265c0a,'request\x20sent');_0x144438(_0xd825a4['result'][_0x22bb('0x12')]);}})[_0x22bb('0x13')](function(_0x4cd5ab){logger[_0x22bb('0x11')](_0x22bb('0xc'),_0x265c0a,_0x4cd5ab);_0x1ded73(_0x4cd5ab);});});}exports[_0x22bb('0x14')]=function(_0x4deb7f){var _0x1f3f4d=this;return new Promise(function(_0x25f660,_0x353799){return db[_0x22bb('0x15')][_0x22bb('0x16')]({'raw':_0x4deb7f[_0x22bb('0x17')]?_0x4deb7f['options'][_0x22bb('0x18')]===undefined?!![]:![]:!![],'where':_0x4deb7f[_0x22bb('0x17')]?_0x4deb7f[_0x22bb('0x17')][_0x22bb('0x19')]||null:null,'attributes':_0x4deb7f[_0x22bb('0x17')]?_0x4deb7f[_0x22bb('0x17')]['attributes']||null:null,'limit':_0x4deb7f[_0x22bb('0x17')]?_0x4deb7f[_0x22bb('0x17')][_0x22bb('0x1a')]||null:null,'include':_0x4deb7f[_0x22bb('0x17')]?_0x4deb7f['options'][_0x22bb('0x1b')]?_[_0x22bb('0x1c')](_0x4deb7f['options'][_0x22bb('0x1b')],function(_0x1447e0){return{'model':db[_0x1447e0[_0x22bb('0x1d')]],'as':_0x1447e0['as'],'attributes':_0x1447e0['attributes'],'include':_0x1447e0[_0x22bb('0x1b')]?_['map'](_0x1447e0[_0x22bb('0x1b')],function(_0x4583e2){return{'model':db[_0x4583e2['model']],'as':_0x4583e2['as'],'attributes':_0x4583e2['attributes'],'include':_0x4583e2['include']?_[_0x22bb('0x1c')](_0x4583e2['include'],function(_0x272dfa){return{'model':db[_0x272dfa['model']],'as':_0x272dfa['as'],'attributes':_0x272dfa['attributes']};}):[]};}):[]};}):[]:[]})[_0x22bb('0xa')](function(_0x71f705){logger[_0x22bb('0xb')]('GetInterval',_0x4deb7f);logger[_0x22bb('0xe')](_0x22bb('0x14'),_0x4deb7f,JSON[_0x22bb('0x10')](_0x71f705));_0x25f660(_0x71f705);})[_0x22bb('0x13')](function(_0x361f11){logger[_0x22bb('0x11')](_0x22bb('0x14'),_0x361f11[_0x22bb('0x12')],_0x4deb7f);_0x353799(_0x1f3f4d[_0x22bb('0x11')](0x1f4,_0x361f11['message']));});});};exports[_0x22bb('0x1e')]=function(_0x574dd5){var _0x5ab44a=this;return new Promise(function(_0x46aadf,_0x520fd1){return db[_0x22bb('0x15')][_0x22bb('0x1f')]({'raw':_0x574dd5[_0x22bb('0x17')]?_0x574dd5[_0x22bb('0x17')][_0x22bb('0x18')]===undefined?!![]:![]:!![],'where':_0x574dd5[_0x22bb('0x17')]?_0x574dd5[_0x22bb('0x17')]['where']||null:null,'attributes':_0x574dd5[_0x22bb('0x17')]?_0x574dd5[_0x22bb('0x17')]['attributes']||null:null,'include':_0x574dd5[_0x22bb('0x17')]?_0x574dd5['options']['include']?_['map'](_0x574dd5['options'][_0x22bb('0x1b')],function(_0x1c1dd3){return{'model':db[_0x1c1dd3['model']],'as':_0x1c1dd3['as'],'attributes':_0x1c1dd3['attributes'],'include':_0x1c1dd3['include']?_[_0x22bb('0x1c')](_0x1c1dd3['include'],function(_0x1cba5f){return{'model':db[_0x1cba5f[_0x22bb('0x1d')]],'as':_0x1cba5f['as'],'attributes':_0x1cba5f[_0x22bb('0x20')],'include':_0x1cba5f[_0x22bb('0x1b')]?_[_0x22bb('0x1c')](_0x1cba5f['include'],function(_0x6e9f1c){return{'model':db[_0x6e9f1c[_0x22bb('0x1d')]],'as':_0x6e9f1c['as'],'attributes':_0x6e9f1c[_0x22bb('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b88f9){logger[_0x22bb('0xb')](_0x22bb('0x1e'),_0x574dd5);logger[_0x22bb('0xe')](_0x22bb('0x1e'),_0x574dd5,JSON[_0x22bb('0x10')](_0x2b88f9));_0x46aadf(_0x2b88f9);})[_0x22bb('0x13')](function(_0x1efc3d){logger[_0x22bb('0x11')](_0x22bb('0x1e'),_0x1efc3d[_0x22bb('0x12')],_0x574dd5);_0x520fd1(_0x5ab44a['error'](0x1f4,_0x1efc3d[_0x22bb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 2a781ce..ade4f42 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 _0xd252=['post','isAuthenticated','send','exports','express','Router','../../components/auth/service'];(function(_0x20160b,_0x5e9b9d){var _0x20a7a8=function(_0x28c88c){while(--_0x28c88c){_0x20160b['push'](_0x20160b['shift']());}};_0x20a7a8(++_0x5e9b9d);}(_0xd252,0xb3));var _0x2d25=function(_0x3c623f,_0x55efeb){_0x3c623f=_0x3c623f-0x0;var _0xcd5f57=_0xd252[_0x3c623f];return _0xcd5f57;};'use strict';var express=require(_0x2d25('0x0'));var router=express[_0x2d25('0x1')]();var auth=require(_0x2d25('0x2'));var controller=require('./jira.controller');router[_0x2d25('0x3')]('/',auth[_0x2d25('0x4')](),controller[_0x2d25('0x5')]);module[_0x2d25('0x6')]=router; \ No newline at end of file +var _0xeefd=['post','isAuthenticated','send','exports','express','Router','./jira.controller'];(function(_0x3972e9,_0xdd1d03){var _0x4b87c0=function(_0x4c0d34){while(--_0x4c0d34){_0x3972e9['push'](_0x3972e9['shift']());}};_0x4b87c0(++_0xdd1d03);}(_0xeefd,0xeb));var _0xdeef=function(_0x2db175,_0x320320){_0x2db175=_0x2db175-0x0;var _0x4a52ea=_0xeefd[_0x2db175];return _0x4a52ea;};'use strict';var express=require(_0xdeef('0x0'));var router=express[_0xdeef('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xdeef('0x2'));router[_0xdeef('0x3')]('/',auth[_0xdeef('0x4')](),controller[_0xdeef('0x5')]);module[_0xdeef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 8e4fe1d..2680035 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 _0xdd83=['Bug','customfield_11500','email','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','stringify','request','setEncoding','utf8','data','end','status','statusCode','error','json','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','https','api','support','3eAmWpBVP0','key','MOTGUI','\x20from\x20','description','issuetype'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0xdd83,0x1af));var _0x3dd8=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xdd83[_0x4b055c];return _0x4b62bb;};'use strict';var BPromise=require(_0x3dd8('0x0'));var https=require(_0x3dd8('0x1'));var logger=require('../../config/logger')(_0x3dd8('0x2'));var USERNAME=_0x3dd8('0x3');var PASSWORD=_0x3dd8('0x4');function openIssue(_0x4fbc7b,_0x17a3c4){var _0x106fdb={'fields':{'project':{'key':_0x4fbc7b[_0x3dd8('0x5')]||_0x3dd8('0x6')},'summary':(_0x4fbc7b['summary']||'Report')+_0x3dd8('0x7')+_0x4fbc7b['ip'],'description':_0x4fbc7b[_0x3dd8('0x8')]||JSON['stringify'](_0x4fbc7b),'issuetype':{'name':_0x4fbc7b[_0x3dd8('0x9')]||_0x3dd8('0xa')}}};_0x106fdb['fields'][_0x3dd8('0xb')]=_0x4fbc7b[_0x3dd8('0xc')];_0x106fdb[_0x3dd8('0xd')][_0x3dd8('0xe')]=_0x4fbc7b[_0x3dd8('0xf')];_0x106fdb[_0x3dd8('0xd')][_0x3dd8('0x10')]=_0x4fbc7b[_0x3dd8('0x11')];_0x106fdb[_0x3dd8('0xd')][_0x3dd8('0x12')]=_0x4fbc7b[_0x3dd8('0x13')];_0x106fdb[_0x3dd8('0xd')][_0x3dd8('0x14')]=_0x4fbc7b['reason'];_0x106fdb[_0x3dd8('0xd')][_0x3dd8('0x15')]=_0x4fbc7b['ip'];var _0x1eacf9={'host':_0x3dd8('0x16'),'port':0x1bb,'path':_0x3dd8('0x17'),'method':_0x3dd8('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x3dd8('0x19'),'Authorization':_0x3dd8('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0x3dd8('0x1b')]('base64')}};var _0x4c35cf=JSON[_0x3dd8('0x1c')](_0x106fdb);var _0x51339c=https[_0x3dd8('0x1d')](_0x1eacf9,function(_0x545cf0){_0x545cf0[_0x3dd8('0x1e')](_0x3dd8('0x1f'));var _0x4c98ce='';_0x545cf0['on'](_0x3dd8('0x20'),function(_0x65be7a){_0x4c98ce+=_0x65be7a;});_0x545cf0['on'](_0x3dd8('0x21'),function(){if(_0x17a3c4){return _0x17a3c4[_0x3dd8('0x22')](_0x545cf0[_0x3dd8('0x23')])['json'](JSON['parse'](_0x4c98ce));}});});_0x51339c['on'](_0x3dd8('0x24'),function(_0x10b15e){if(_0x17a3c4){return _0x17a3c4['status'](0x1f4)[_0x3dd8('0x25')]({'errors':[{'message':_0x3dd8('0x26'),'type':_0x3dd8('0x27')}]});}});_0x51339c[_0x3dd8('0x28')](_0x4c35cf);_0x51339c[_0x3dd8('0x21')]();}exports[_0x3dd8('0x29')]=openIssue;exports[_0x3dd8('0x2a')]=function(_0x536aee,_0x37239a){_0x536aee[_0x3dd8('0x2b')]['ip']=_0x536aee[_0x3dd8('0x2c')][_0x3dd8('0x2d')]||_0x536aee[_0x3dd8('0x2e')][_0x3dd8('0x2f')]||_0x536aee[_0x3dd8('0x30')][_0x3dd8('0x2f')]||_0x536aee['connection'][_0x3dd8('0x30')]['remoteAddress'];return openIssue(_0x536aee[_0x3dd8('0x2b')],_0x37239a);}; \ No newline at end of file +var _0x5b2e=['customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','request','setEncoding','utf8','data','status','statusCode','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','send','headers','x-forwarded-for','connection','remoteAddress','socket','body','https','../../config/logger','api','support','3eAmWpBVP0','key','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11501','oldToken','customfield_11502','newToken'];(function(_0x25deaf,_0x5d3e5b){var _0x579eb8=function(_0x11990e){while(--_0x11990e){_0x25deaf['push'](_0x25deaf['shift']());}};_0x579eb8(++_0x5d3e5b);}(_0x5b2e,0x1c8));var _0xe5b2=function(_0x19e975,_0x2ad9fc){_0x19e975=_0x19e975-0x0;var _0x283c52=_0x5b2e[_0x19e975];return _0x283c52;};'use strict';var BPromise=require('bluebird');var https=require(_0xe5b2('0x0'));var logger=require(_0xe5b2('0x1'))(_0xe5b2('0x2'));var USERNAME=_0xe5b2('0x3');var PASSWORD=_0xe5b2('0x4');function openIssue(_0x374473,_0x179e87){var _0x1777da={'fields':{'project':{'key':_0x374473[_0xe5b2('0x5')]||'MOTGUI'},'summary':(_0x374473['summary']||_0xe5b2('0x6'))+_0xe5b2('0x7')+_0x374473['ip'],'description':_0x374473[_0xe5b2('0x8')]||JSON[_0xe5b2('0x9')](_0x374473),'issuetype':{'name':_0x374473[_0xe5b2('0xa')]||_0xe5b2('0xb')}}};_0x1777da[_0xe5b2('0xc')]['customfield_11500']=_0x374473['email'];_0x1777da['fields'][_0xe5b2('0xd')]=_0x374473[_0xe5b2('0xe')];_0x1777da[_0xe5b2('0xc')][_0xe5b2('0xf')]=_0x374473[_0xe5b2('0x10')];_0x1777da['fields'][_0xe5b2('0x11')]=_0x374473['name'];_0x1777da[_0xe5b2('0xc')][_0xe5b2('0x12')]=_0x374473[_0xe5b2('0x13')];_0x1777da[_0xe5b2('0xc')][_0xe5b2('0x14')]=_0x374473['ip'];var _0x30f7c6={'host':_0xe5b2('0x15'),'port':0x1bb,'path':_0xe5b2('0x16'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xe5b2('0x17'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x5ec4a0=JSON[_0xe5b2('0x9')](_0x1777da);var _0x3bff08=https[_0xe5b2('0x18')](_0x30f7c6,function(_0x2a53cb){_0x2a53cb[_0xe5b2('0x19')](_0xe5b2('0x1a'));var _0x14766d='';_0x2a53cb['on'](_0xe5b2('0x1b'),function(_0x494f17){_0x14766d+=_0x494f17;});_0x2a53cb['on']('end',function(){if(_0x179e87){return _0x179e87[_0xe5b2('0x1c')](_0x2a53cb[_0xe5b2('0x1d')])['json'](JSON[_0xe5b2('0x1e')](_0x14766d));}});});_0x3bff08['on'](_0xe5b2('0x1f'),function(_0xbf6cb6){if(_0x179e87){return _0x179e87[_0xe5b2('0x1c')](0x1f4)['json']({'errors':[{'message':_0xe5b2('0x20'),'type':_0xe5b2('0x21')}]});}});_0x3bff08[_0xe5b2('0x22')](_0x5ec4a0);_0x3bff08[_0xe5b2('0x23')]();}exports['openIssue']=openIssue;exports[_0xe5b2('0x24')]=function(_0x5cd6a7,_0x3e99e0){_0x5cd6a7['body']['ip']=_0x5cd6a7[_0xe5b2('0x25')][_0xe5b2('0x26')]||_0x5cd6a7[_0xe5b2('0x27')][_0xe5b2('0x28')]||_0x5cd6a7[_0xe5b2('0x29')][_0xe5b2('0x28')]||_0x5cd6a7[_0xe5b2('0x27')]['socket'][_0xe5b2('0x28')];return openIssue(_0x5cd6a7[_0xe5b2('0x2a')],_0x3e99e0);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 2795a84..a3a0996 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 _0x5dc5=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x30fde3,_0x69fd6){var _0x45703f=function(_0x470c4e){while(--_0x470c4e){_0x30fde3['push'](_0x30fde3['shift']());}};_0x45703f(++_0x69fd6);}(_0x5dc5,0x174));var _0x55dc=function(_0xc9fa50,_0x127cf8){_0xc9fa50=_0xc9fa50-0x0;var _0x44d5cb=_0x5dc5[_0xc9fa50];return _0x44d5cb;};'use strict';var multer=require(_0x55dc('0x0'));var util=require(_0x55dc('0x1'));var path=require(_0x55dc('0x2'));var timeout=require(_0x55dc('0x3'));var express=require('express');var router=express[_0x55dc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x55dc('0x5'));var interaction=require(_0x55dc('0x6'));var config=require(_0x55dc('0x7'));var controller=require(_0x55dc('0x8'));router['get']('/',auth[_0x55dc('0x9')](),controller[_0x55dc('0xa')]);router[_0x55dc('0xb')](_0x55dc('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x55dc('0xb')](_0x55dc('0xd'),auth['isAuthenticated'](),controller[_0x55dc('0xe')]);router[_0x55dc('0xf')]('/',auth['isAuthenticated'](),controller[_0x55dc('0x10')]);router[_0x55dc('0x11')](_0x55dc('0xd'),auth[_0x55dc('0x9')](),controller[_0x55dc('0x12')]);router[_0x55dc('0x13')](_0x55dc('0xd'),auth[_0x55dc('0x9')](),controller[_0x55dc('0x14')]);module[_0x55dc('0x15')]=router; \ No newline at end of file +var _0x16f2=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x257fd4,_0x446a74){var _0x3bbcba=function(_0x53549c){while(--_0x53549c){_0x257fd4['push'](_0x257fd4['shift']());}};_0x3bbcba(++_0x446a74);}(_0x16f2,0x135));var _0x216f=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0x16f2[_0x5eb22e];return _0x27fed5;};'use strict';var multer=require(_0x216f('0x0'));var util=require(_0x216f('0x1'));var path=require(_0x216f('0x2'));var timeout=require('connect-timeout');var express=require(_0x216f('0x3'));var router=express[_0x216f('0x4')]();var fs_extra=require(_0x216f('0x5'));var auth=require(_0x216f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x216f('0x7'));var controller=require(_0x216f('0x8'));router['get']('/',auth[_0x216f('0x9')](),controller[_0x216f('0xa')]);router[_0x216f('0xb')](_0x216f('0xc'),auth[_0x216f('0x9')](),controller[_0x216f('0xd')]);router['get'](_0x216f('0xe'),auth[_0x216f('0x9')](),controller[_0x216f('0xf')]);router[_0x216f('0x10')]('/',auth['isAuthenticated'](),controller[_0x216f('0x11')]);router[_0x216f('0x12')](_0x216f('0xe'),auth[_0x216f('0x9')](),controller[_0x216f('0x13')]);router[_0x216f('0x14')]('/:id',auth[_0x216f('0x9')](),controller['destroy']);module[_0x216f('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 1831ff4..a6ed679 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 _0x7be1=['long','STRING','sequelize','exports','TEXT'];(function(_0x3799c9,_0x4784c1){var _0x10227a=function(_0x438ff9){while(--_0x438ff9){_0x3799c9['push'](_0x3799c9['shift']());}};_0x10227a(++_0x4784c1);}(_0x7be1,0x165));var _0x17be=function(_0x1c0b91,_0x691caf){_0x1c0b91=_0x1c0b91-0x0;var _0x3d1ab4=_0x7be1[_0x1c0b91];return _0x3d1ab4;};'use strict';var Sequelize=require(_0x17be('0x0'));module[_0x17be('0x1')]={'question':{'type':Sequelize[_0x17be('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x17be('0x3'))},'membername':{'type':Sequelize[_0x17be('0x4')]},'projectname':{'type':Sequelize[_0x17be('0x4')]},'queue':{'type':Sequelize[_0x17be('0x4')]},'uniqueid':{'type':Sequelize[_0x17be('0x4')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7fce=['sequelize','exports','TEXT','long','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7fce,0xdc));var _0xe7fc=function(_0x52065d,_0x28d621){_0x52065d=_0x52065d-0x0;var _0x20bf41=_0x7fce[_0x52065d];return _0x20bf41;};'use strict';var Sequelize=require(_0xe7fc('0x0'));module[_0xe7fc('0x1')]={'question':{'type':Sequelize[_0xe7fc('0x2')]},'answer':{'type':Sequelize['TEXT'](_0xe7fc('0x3'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xe7fc('0x4')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xe7fc('0x4')]},'calleridname':{'type':Sequelize[_0xe7fc('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 3c13e7b..407d7cd 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 _0x5bce=['order','sort','where','pick','filter','merge','type','VIRTUAL','options','JscriptyAnswerReport','then','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','count','set','apply','reject','save','update','destroy','end','error','stack','name','send','index','fieldName','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x3e6a0e,_0x3a2107){var _0x2e594d=function(_0xeb5c08){while(--_0xeb5c08){_0x3e6a0e['push'](_0x3e6a0e['shift']());}};_0x2e594d(++_0x3a2107);}(_0x5bce,0x1de));var _0xe5bc=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x5bce[_0x565ed7];return _0x183ad7;};'use strict';var emlformat=require(_0xe5bc('0x0'));var rimraf=require(_0xe5bc('0x1'));var zipdir=require(_0xe5bc('0x2'));var jsonpatch=require(_0xe5bc('0x3'));var rp=require(_0xe5bc('0x4'));var moment=require('moment');var BPromise=require(_0xe5bc('0x5'));var Mustache=require('mustache');var util=require(_0xe5bc('0x6'));var path=require('path');var sox=require(_0xe5bc('0x7'));var csv=require(_0xe5bc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe5bc('0x9'));var _=require(_0xe5bc('0xa'));var squel=require(_0xe5bc('0xb'));var crypto=require(_0xe5bc('0xc'));var jsforce=require(_0xe5bc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe5bc('0x8'));var querystring=require('querystring');var Papa=require(_0xe5bc('0xe'));var Redis=require(_0xe5bc('0xf'));var authService=require(_0xe5bc('0x10'));var qs=require(_0xe5bc('0x11'));var as=require(_0xe5bc('0x12'));var hardwareService=require(_0xe5bc('0x13'));var logger=require(_0xe5bc('0x14'))(_0xe5bc('0x15'));var utils=require(_0xe5bc('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe5bc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x114a54,_0x49a932){_0x49a932=_0x49a932||0xcc;return function(_0x40dc1e){if(_0x40dc1e){return _0x114a54[_0xe5bc('0x18')](_0x49a932);}return _0x114a54[_0xe5bc('0x19')](_0x49a932)['end']();};}function respondWithResult(_0x20b586,_0x3628b5){_0x3628b5=_0x3628b5||0xc8;return function(_0x1a9ee9){if(_0x1a9ee9){return _0x20b586[_0xe5bc('0x19')](_0x3628b5)[_0xe5bc('0x1a')](_0x1a9ee9);}};}function respondWithFilteredResult(_0x3c734a,_0x11b826){return function(_0x1c9328){if(_0x1c9328){var _0x38c342=typeof _0x11b826[_0xe5bc('0x1b')]==='undefined'&&typeof _0x11b826[_0xe5bc('0x1c')]==='undefined';var _0x1bdc1a=_0x1c9328[_0xe5bc('0x1d')];var _0x374a8b=_0x38c342?0x0:_0x11b826[_0xe5bc('0x1b')];var _0x4d9f36=_0x38c342?_0x1c9328[_0xe5bc('0x1d')]:_0x11b826[_0xe5bc('0x1b')]+_0x11b826['limit'];var _0x45f8f9;if(_0x4d9f36>=_0x1bdc1a){_0x4d9f36=_0x1bdc1a;_0x45f8f9=0xc8;}else{_0x45f8f9=0xce;}_0x3c734a[_0xe5bc('0x19')](_0x45f8f9);return _0x3c734a[_0xe5bc('0x1e')]('Content-Range',_0x374a8b+'-'+_0x4d9f36+'/'+_0x1bdc1a)[_0xe5bc('0x1a')](_0x1c9328);}return null;};}function patchUpdates(_0x2f890b){return function(_0x5dbd16){try{jsonpatch[_0xe5bc('0x1f')](_0x5dbd16,_0x2f890b,!![]);}catch(_0x97e459){return BPromise[_0xe5bc('0x20')](_0x97e459);}return _0x5dbd16[_0xe5bc('0x21')]();};}function saveUpdates(_0x4c11ac,_0x1d7cd1){return function(_0x4d095e){if(_0x4d095e){return _0x4d095e[_0xe5bc('0x22')](_0x4c11ac)['then'](function(_0x2bb24d){return _0x2bb24d;});}return null;};}function removeEntity(_0x40634a,_0x424b05){return function(_0x1e221a){if(_0x1e221a){return _0x1e221a[_0xe5bc('0x23')]()['then'](function(){_0x40634a['status'](0xcc)[_0xe5bc('0x24')]();});}};}function handleEntityNotFound(_0x1a5f45,_0x948088){return function(_0x1a01e3){if(!_0x1a01e3){_0x1a5f45[_0xe5bc('0x18')](0x194);}return _0x1a01e3;};}function handleError(_0x1d0312,_0x4f039c){_0x4f039c=_0x4f039c||0x1f4;return function(_0x162ac1){logger[_0xe5bc('0x25')](_0x162ac1[_0xe5bc('0x26')]);if(_0x162ac1[_0xe5bc('0x27')]){delete _0x162ac1[_0xe5bc('0x27')];}_0x1d0312[_0xe5bc('0x19')](_0x4f039c)[_0xe5bc('0x28')](_0x162ac1);};}exports[_0xe5bc('0x29')]=function(_0x34427f,_0x274b3f){var _0x1e588f={},_0xeed998={},_0x4b6992={'count':0x0,'rows':[]};var _0x47004b=_['map'](db['JscriptyAnswerReport']['rawAttributes'],function(_0x37d320){return{'name':_0x37d320[_0xe5bc('0x2a')],'type':_0x37d320['type']['key']};});_0xeed998['model']=_[_0xe5bc('0x2b')](_0x47004b,_0xe5bc('0x27'));_0xeed998[_0xe5bc('0x2c')]=_[_0xe5bc('0x2d')](_0x34427f[_0xe5bc('0x2c')]);_0xeed998[_0xe5bc('0x2e')]=_[_0xe5bc('0x2f')](_0xeed998['model'],_0xeed998['query']);_0x1e588f['attributes']=_[_0xe5bc('0x2f')](_0xeed998[_0xe5bc('0x30')],qs[_0xe5bc('0x31')](_0x34427f[_0xe5bc('0x2c')][_0xe5bc('0x31')]));_0x1e588f['attributes']=_0x1e588f[_0xe5bc('0x32')][_0xe5bc('0x33')]?_0x1e588f['attributes']:_0xeed998[_0xe5bc('0x30')];if(!_0x34427f[_0xe5bc('0x2c')][_0xe5bc('0x34')](_0xe5bc('0x35'))){_0x1e588f[_0xe5bc('0x1c')]=qs[_0xe5bc('0x1c')](_0x34427f['query'][_0xe5bc('0x1c')]);_0x1e588f[_0xe5bc('0x1b')]=qs[_0xe5bc('0x1b')](_0x34427f['query'][_0xe5bc('0x1b')]);}_0x1e588f[_0xe5bc('0x36')]=qs[_0xe5bc('0x37')](_0x34427f[_0xe5bc('0x2c')][_0xe5bc('0x37')]);_0x1e588f[_0xe5bc('0x38')]=qs[_0xe5bc('0x2e')](_[_0xe5bc('0x39')](_0x34427f['query'],_0xeed998['filters']),_0x47004b);if(_0x34427f[_0xe5bc('0x2c')][_0xe5bc('0x3a')]){_0x1e588f[_0xe5bc('0x38')]=_[_0xe5bc('0x3b')](_0x1e588f[_0xe5bc('0x38')],{'$or':_[_0xe5bc('0x2b')](_0x47004b,function(_0xaa9c4c){if(_0xaa9c4c[_0xe5bc('0x3c')]!==_0xe5bc('0x3d')){var _0x87ecb={};_0x87ecb[_0xaa9c4c[_0xe5bc('0x27')]]={'$like':'%'+_0x34427f[_0xe5bc('0x2c')][_0xe5bc('0x3a')]+'%'};return _0x87ecb;}})});}_0x1e588f=_[_0xe5bc('0x3b')]({},_0x1e588f,_0x34427f[_0xe5bc('0x3e')]);var _0x271bb6={'where':_0x1e588f[_0xe5bc('0x38')]};return db[_0xe5bc('0x3f')]['count'](_0x271bb6)[_0xe5bc('0x40')](function(_0x5b9e8a){_0x4b6992[_0xe5bc('0x1d')]=_0x5b9e8a;if(_0x34427f[_0xe5bc('0x2c')][_0xe5bc('0x41')]){_0x1e588f[_0xe5bc('0x42')]=[{'all':!![]}];}return db[_0xe5bc('0x3f')][_0xe5bc('0x43')](_0x1e588f);})[_0xe5bc('0x40')](function(_0x122c6f){_0x4b6992['rows']=_0x122c6f;return _0x4b6992;})[_0xe5bc('0x40')](respondWithFilteredResult(_0x274b3f,_0x1e588f))[_0xe5bc('0x44')](handleError(_0x274b3f,null));};exports[_0xe5bc('0x45')]=function(_0x1ff7e1,_0x1bb16c){var _0x351926={'raw':!![],'where':{'id':_0x1ff7e1[_0xe5bc('0x46')]['id']}},_0x3db01b={};_0x3db01b[_0xe5bc('0x30')]=_['keys'](db[_0xe5bc('0x3f')][_0xe5bc('0x47')]);_0x3db01b['query']=_[_0xe5bc('0x2d')](_0x1ff7e1['query']);_0x3db01b[_0xe5bc('0x2e')]=_['intersection'](_0x3db01b[_0xe5bc('0x30')],_0x3db01b[_0xe5bc('0x2c')]);_0x351926[_0xe5bc('0x32')]=_[_0xe5bc('0x2f')](_0x3db01b[_0xe5bc('0x30')],qs[_0xe5bc('0x31')](_0x1ff7e1[_0xe5bc('0x2c')][_0xe5bc('0x31')]));_0x351926[_0xe5bc('0x32')]=_0x351926[_0xe5bc('0x32')][_0xe5bc('0x33')]?_0x351926[_0xe5bc('0x32')]:_0x3db01b[_0xe5bc('0x30')];if(_0x1ff7e1[_0xe5bc('0x2c')][_0xe5bc('0x41')]){_0x351926['include']=[{'all':!![]}];}_0x351926=_['merge']({},_0x351926,_0x1ff7e1[_0xe5bc('0x3e')]);return db[_0xe5bc('0x3f')][_0xe5bc('0x48')](_0x351926)[_0xe5bc('0x40')](handleEntityNotFound(_0x1bb16c,null))[_0xe5bc('0x40')](respondWithResult(_0x1bb16c,null))['catch'](handleError(_0x1bb16c,null));};exports[_0xe5bc('0x49')]=function(_0x47fd2c,_0x37bafd){return db[_0xe5bc('0x3f')]['create'](_0x47fd2c['body'],{})[_0xe5bc('0x40')](respondWithResult(_0x37bafd,0xc9))[_0xe5bc('0x44')](handleError(_0x37bafd,null));};exports[_0xe5bc('0x22')]=function(_0x4ec784,_0x2da476){if(_0x4ec784[_0xe5bc('0x4a')]['id']){delete _0x4ec784[_0xe5bc('0x4a')]['id'];}return db[_0xe5bc('0x3f')][_0xe5bc('0x48')]({'where':{'id':_0x4ec784['params']['id']}})[_0xe5bc('0x40')](handleEntityNotFound(_0x2da476,null))[_0xe5bc('0x40')](saveUpdates(_0x4ec784[_0xe5bc('0x4a')],null))[_0xe5bc('0x40')](respondWithResult(_0x2da476,null))[_0xe5bc('0x44')](handleError(_0x2da476,null));};exports[_0xe5bc('0x23')]=function(_0x405c4f,_0x1d58e0){return db['JscriptyAnswerReport'][_0xe5bc('0x48')]({'where':{'id':_0x405c4f['params']['id']}})[_0xe5bc('0x40')](handleEntityNotFound(_0x1d58e0,null))['then'](removeEntity(_0x1d58e0,null))[_0xe5bc('0x44')](handleError(_0x1d58e0,null));};exports['describe']=function(_0xe4802b,_0x43ff7b){return db[_0xe5bc('0x3f')][_0xe5bc('0x4b')]()[_0xe5bc('0x40')](respondWithResult(_0x43ff7b,null))[_0xe5bc('0x44')](handleError(_0x43ff7b,null));}; \ No newline at end of file +var _0x857e=['offset','set','Content-Range','json','apply','update','then','destroy','stack','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','undefined','limit','count'];(function(_0x2870e6,_0x44e338){var _0x274d99=function(_0x2ef92e){while(--_0x2ef92e){_0x2870e6['push'](_0x2870e6['shift']());}};_0x274d99(++_0x44e338);}(_0x857e,0x14c));var _0xe857=function(_0x576e2b,_0x328953){_0x576e2b=_0x576e2b-0x0;var _0x46461a=_0x857e[_0x576e2b];return _0x46461a;};'use strict';var emlformat=require(_0xe857('0x0'));var rimraf=require(_0xe857('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe857('0x2'));var rp=require(_0xe857('0x3'));var moment=require(_0xe857('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe857('0x5'));var util=require(_0xe857('0x6'));var path=require(_0xe857('0x7'));var sox=require('sox');var csv=require(_0xe857('0x8'));var ejs=require(_0xe857('0x9'));var fs=require('fs');var fs_extra=require(_0xe857('0xa'));var _=require(_0xe857('0xb'));var squel=require(_0xe857('0xc'));var crypto=require('crypto');var jsforce=require(_0xe857('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe857('0xe'));var Papa=require(_0xe857('0xf'));var Redis=require('ioredis');var authService=require(_0xe857('0x10'));var qs=require(_0xe857('0x11'));var as=require(_0xe857('0x12'));var hardwareService=require(_0xe857('0x13'));var logger=require('../../config/logger')(_0xe857('0x14'));var utils=require('../../config/utils');var config=require(_0xe857('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22b699,_0x337204){_0x337204=_0x337204||0xcc;return function(_0x3d518b){if(_0x3d518b){return _0x22b699[_0xe857('0x16')](_0x337204);}return _0x22b699[_0xe857('0x17')](_0x337204)[_0xe857('0x18')]();};}function respondWithResult(_0x1c6054,_0x1497f3){_0x1497f3=_0x1497f3||0xc8;return function(_0x1d3410){if(_0x1d3410){return _0x1c6054[_0xe857('0x17')](_0x1497f3)['json'](_0x1d3410);}};}function respondWithFilteredResult(_0xfae086,_0x202ee7){return function(_0x5f5bcd){if(_0x5f5bcd){var _0x49e164=typeof _0x202ee7['offset']===_0xe857('0x19')&&typeof _0x202ee7[_0xe857('0x1a')]==='undefined';var _0x31d6d8=_0x5f5bcd[_0xe857('0x1b')];var _0x519ec7=_0x49e164?0x0:_0x202ee7[_0xe857('0x1c')];var _0x5a64e0=_0x49e164?_0x5f5bcd['count']:_0x202ee7['offset']+_0x202ee7[_0xe857('0x1a')];var _0x228929;if(_0x5a64e0>=_0x31d6d8){_0x5a64e0=_0x31d6d8;_0x228929=0xc8;}else{_0x228929=0xce;}_0xfae086[_0xe857('0x17')](_0x228929);return _0xfae086[_0xe857('0x1d')](_0xe857('0x1e'),_0x519ec7+'-'+_0x5a64e0+'/'+_0x31d6d8)[_0xe857('0x1f')](_0x5f5bcd);}return null;};}function patchUpdates(_0x877c2b){return function(_0x12ac35){try{jsonpatch[_0xe857('0x20')](_0x12ac35,_0x877c2b,!![]);}catch(_0x3fc18d){return BPromise['reject'](_0x3fc18d);}return _0x12ac35['save']();};}function saveUpdates(_0x43aeba,_0x155082){return function(_0x4f292e){if(_0x4f292e){return _0x4f292e[_0xe857('0x21')](_0x43aeba)[_0xe857('0x22')](function(_0x2d8ced){return _0x2d8ced;});}return null;};}function removeEntity(_0x3fcb29,_0x5c9446){return function(_0x2d437c){if(_0x2d437c){return _0x2d437c[_0xe857('0x23')]()[_0xe857('0x22')](function(){_0x3fcb29[_0xe857('0x17')](0xcc)[_0xe857('0x18')]();});}};}function handleEntityNotFound(_0x3f94ea,_0x2e2bd9){return function(_0x5e5ce4){if(!_0x5e5ce4){_0x3f94ea[_0xe857('0x16')](0x194);}return _0x5e5ce4;};}function handleError(_0x132533,_0x487435){_0x487435=_0x487435||0x1f4;return function(_0x152578){logger['error'](_0x152578[_0xe857('0x24')]);if(_0x152578['name']){delete _0x152578[_0xe857('0x25')];}_0x132533[_0xe857('0x17')](_0x487435)[_0xe857('0x26')](_0x152578);};}exports['index']=function(_0x40567c,_0x4b390d){var _0x422809={},_0x552e6d={},_0x48b9e0={'count':0x0,'rows':[]};var _0x2288b9=_[_0xe857('0x27')](db[_0xe857('0x28')][_0xe857('0x29')],function(_0x308ba3){return{'name':_0x308ba3[_0xe857('0x2a')],'type':_0x308ba3['type'][_0xe857('0x2b')]};});_0x552e6d[_0xe857('0x2c')]=_[_0xe857('0x27')](_0x2288b9,_0xe857('0x25'));_0x552e6d[_0xe857('0x2d')]=_[_0xe857('0x2e')](_0x40567c['query']);_0x552e6d[_0xe857('0x2f')]=_[_0xe857('0x30')](_0x552e6d[_0xe857('0x2c')],_0x552e6d[_0xe857('0x2d')]);_0x422809[_0xe857('0x31')]=_[_0xe857('0x30')](_0x552e6d[_0xe857('0x2c')],qs['fields'](_0x40567c['query'][_0xe857('0x32')]));_0x422809[_0xe857('0x31')]=_0x422809['attributes'][_0xe857('0x33')]?_0x422809['attributes']:_0x552e6d[_0xe857('0x2c')];if(!_0x40567c[_0xe857('0x2d')][_0xe857('0x34')](_0xe857('0x35'))){_0x422809[_0xe857('0x1a')]=qs[_0xe857('0x1a')](_0x40567c[_0xe857('0x2d')][_0xe857('0x1a')]);_0x422809[_0xe857('0x1c')]=qs['offset'](_0x40567c['query']['offset']);}_0x422809[_0xe857('0x36')]=qs[_0xe857('0x37')](_0x40567c['query'][_0xe857('0x37')]);_0x422809[_0xe857('0x38')]=qs[_0xe857('0x2f')](_['pick'](_0x40567c['query'],_0x552e6d[_0xe857('0x2f')]),_0x2288b9);if(_0x40567c[_0xe857('0x2d')][_0xe857('0x39')]){_0x422809[_0xe857('0x38')]=_[_0xe857('0x3a')](_0x422809[_0xe857('0x38')],{'$or':_['map'](_0x2288b9,function(_0x565d45){if(_0x565d45[_0xe857('0x3b')]!==_0xe857('0x3c')){var _0x37c7d4={};_0x37c7d4[_0x565d45['name']]={'$like':'%'+_0x40567c['query'][_0xe857('0x39')]+'%'};return _0x37c7d4;}})});}_0x422809=_[_0xe857('0x3a')]({},_0x422809,_0x40567c[_0xe857('0x3d')]);var _0x1b45af={'where':_0x422809['where']};return db['JscriptyAnswerReport'][_0xe857('0x1b')](_0x1b45af)[_0xe857('0x22')](function(_0x367221){_0x48b9e0[_0xe857('0x1b')]=_0x367221;if(_0x40567c[_0xe857('0x2d')][_0xe857('0x3e')]){_0x422809[_0xe857('0x3f')]=[{'all':!![]}];}return db[_0xe857('0x28')][_0xe857('0x40')](_0x422809);})[_0xe857('0x22')](function(_0x3328c8){_0x48b9e0[_0xe857('0x41')]=_0x3328c8;return _0x48b9e0;})[_0xe857('0x22')](respondWithFilteredResult(_0x4b390d,_0x422809))[_0xe857('0x42')](handleError(_0x4b390d,null));};exports['show']=function(_0x2660c9,_0x442fd2){var _0x556e8d={'raw':!![],'where':{'id':_0x2660c9[_0xe857('0x43')]['id']}},_0x500855={};_0x500855[_0xe857('0x2c')]=_['keys'](db[_0xe857('0x28')][_0xe857('0x29')]);_0x500855[_0xe857('0x2d')]=_[_0xe857('0x2e')](_0x2660c9[_0xe857('0x2d')]);_0x500855['filters']=_[_0xe857('0x30')](_0x500855[_0xe857('0x2c')],_0x500855['query']);_0x556e8d[_0xe857('0x31')]=_[_0xe857('0x30')](_0x500855[_0xe857('0x2c')],qs[_0xe857('0x32')](_0x2660c9['query'][_0xe857('0x32')]));_0x556e8d[_0xe857('0x31')]=_0x556e8d['attributes']['length']?_0x556e8d['attributes']:_0x500855['model'];if(_0x2660c9['query'][_0xe857('0x3e')]){_0x556e8d[_0xe857('0x3f')]=[{'all':!![]}];}_0x556e8d=_['merge']({},_0x556e8d,_0x2660c9['options']);return db['JscriptyAnswerReport'][_0xe857('0x44')](_0x556e8d)[_0xe857('0x22')](handleEntityNotFound(_0x442fd2,null))['then'](respondWithResult(_0x442fd2,null))[_0xe857('0x42')](handleError(_0x442fd2,null));};exports[_0xe857('0x45')]=function(_0x3f1485,_0x566f8d){return db[_0xe857('0x28')]['create'](_0x3f1485[_0xe857('0x46')],{})[_0xe857('0x22')](respondWithResult(_0x566f8d,0xc9))[_0xe857('0x42')](handleError(_0x566f8d,null));};exports[_0xe857('0x21')]=function(_0x4b1acd,_0x3f8191){if(_0x4b1acd[_0xe857('0x46')]['id']){delete _0x4b1acd['body']['id'];}return db['JscriptyAnswerReport'][_0xe857('0x44')]({'where':{'id':_0x4b1acd['params']['id']}})[_0xe857('0x22')](handleEntityNotFound(_0x3f8191,null))[_0xe857('0x22')](saveUpdates(_0x4b1acd[_0xe857('0x46')],null))[_0xe857('0x22')](respondWithResult(_0x3f8191,null))[_0xe857('0x42')](handleError(_0x3f8191,null));};exports['destroy']=function(_0x5c2eac,_0x33e3e7){return db[_0xe857('0x28')]['find']({'where':{'id':_0x5c2eac['params']['id']}})[_0xe857('0x22')](handleEntityNotFound(_0x33e3e7,null))[_0xe857('0x22')](removeEntity(_0x33e3e7,null))[_0xe857('0x42')](handleError(_0x33e3e7,null));};exports[_0xe857('0x47')]=function(_0x5a74e4,_0x2eb917){return db[_0xe857('0x28')][_0xe857('0x47')]()[_0xe857('0x22')](respondWithResult(_0x2eb917,null))[_0xe857('0x42')](handleError(_0x2eb917,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 216a595..3dd9a42 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 _0xc1fd=['../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x204921,_0x475d3b){var _0x2070fb=function(_0x23c501){while(--_0x23c501){_0x204921['push'](_0x204921['shift']());}};_0x2070fb(++_0x475d3b);}(_0xc1fd,0x10a));var _0xdc1f=function(_0x47fb9e,_0x26f0a2){_0x47fb9e=_0x47fb9e-0x0;var _0x591d7f=_0xc1fd[_0x47fb9e];return _0x591d7f;};'use strict';var _=require(_0xdc1f('0x0'));var util=require(_0xdc1f('0x1'));var logger=require(_0xdc1f('0x2'))(_0xdc1f('0x3'));var moment=require('moment');var BPromise=require(_0xdc1f('0x4'));var rp=require(_0xdc1f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdc1f('0x6'));var config=require(_0xdc1f('0x7'));var attributes=require(_0xdc1f('0x8'));module[_0xdc1f('0x9')]=function(_0x2cea1c,_0x340a60){return _0x2cea1c[_0xdc1f('0xa')](_0xdc1f('0xb'),attributes,{'tableName':_0xdc1f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1994=['define','JscriptyAnswerReport','report_jscripty_answers','util','api','moment','bluebird','request-promise','../../config/environment','./jscriptyAnswerReport.attributes','exports'];(function(_0x4cd0d0,_0x717e19){var _0x506f45=function(_0x2b6eb0){while(--_0x2b6eb0){_0x4cd0d0['push'](_0x4cd0d0['shift']());}};_0x506f45(++_0x717e19);}(_0x1994,0x87));var _0x4199=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1994[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x4199('0x0'));var logger=require('../../config/logger')(_0x4199('0x1'));var moment=require(_0x4199('0x2'));var BPromise=require(_0x4199('0x3'));var rp=require(_0x4199('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4199('0x5'));var attributes=require(_0x4199('0x6'));module[_0x4199('0x7')]=function(_0x39138e,_0x47bb7c){return _0x39138e[_0x4199('0x8')](_0x4199('0x9'),attributes,{'tableName':_0x4199('0xa'),'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 c537005..5d5eb4d 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 _0x88f7=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x39b3ea,_0x3f52f2){var _0x1c82e7=function(_0x3c259c){while(--_0x3c259c){_0x39b3ea['push'](_0x39b3ea['shift']());}};_0x1c82e7(++_0x3f52f2);}(_0x88f7,0x1b0));var _0x788f=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x88f7[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0x788f('0x0'));var util=require(_0x788f('0x1'));var moment=require('moment');var BPromise=require(_0x788f('0x2'));var rs=require(_0x788f('0x3'));var fs=require('fs');var Redis=require(_0x788f('0x4'));var db=require(_0x788f('0x5'))['db'];var utils=require(_0x788f('0x6'));var logger=require(_0x788f('0x7'))('rpc');var config=require(_0x788f('0x8'));var jayson=require(_0x788f('0x9'));var client=jayson[_0x788f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb387fa,_0x13cbb8,_0x49f47a){return new BPromise(function(_0x3344b0,_0x514f22){return client[_0x788f('0xb')](_0xb387fa,_0x49f47a)[_0x788f('0xc')](function(_0x3f2f9b){logger[_0x788f('0xd')](_0x788f('0xe'),_0x13cbb8,_0x788f('0xf'));logger[_0x788f('0x10')](_0x788f('0x11'),_0x13cbb8,_0x788f('0xf'),JSON[_0x788f('0x12')](_0x3f2f9b));if(_0x3f2f9b['error']){if(_0x3f2f9b[_0x788f('0x13')][_0x788f('0x14')]===0x1f4){logger[_0x788f('0x13')](_0x788f('0xe'),_0x13cbb8,_0x3f2f9b[_0x788f('0x13')][_0x788f('0x15')]);return _0x514f22(_0x3f2f9b[_0x788f('0x13')][_0x788f('0x15')]);}logger['error'](_0x788f('0xe'),_0x13cbb8,_0x3f2f9b[_0x788f('0x13')]['message']);return _0x3344b0(_0x3f2f9b[_0x788f('0x13')]['message']);}else{logger[_0x788f('0xd')](_0x788f('0xe'),_0x13cbb8,_0x788f('0xf'));_0x3344b0(_0x3f2f9b[_0x788f('0x16')][_0x788f('0x15')]);}})[_0x788f('0x17')](function(_0x364a31){logger[_0x788f('0x13')](_0x788f('0xe'),_0x13cbb8,_0x364a31);_0x514f22(_0x364a31);});});} \ No newline at end of file +var _0xd7fc=['jayson/promise','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x31056f,_0x4082b1){var _0x3c7de0=function(_0x2714c2){while(--_0x2714c2){_0x31056f['push'](_0x31056f['shift']());}};_0x3c7de0(++_0x4082b1);}(_0xd7fc,0x187));var _0xcd7f=function(_0x183256,_0x1a596d){_0x183256=_0x183256-0x0;var _0x5394a2=_0xd7fc[_0x183256];return _0x5394a2;};'use strict';var _=require(_0xcd7f('0x0'));var util=require(_0xcd7f('0x1'));var moment=require(_0xcd7f('0x2'));var BPromise=require(_0xcd7f('0x3'));var rs=require(_0xcd7f('0x4'));var fs=require('fs');var Redis=require(_0xcd7f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcd7f('0x6'));var logger=require('../../config/logger')(_0xcd7f('0x7'));var config=require(_0xcd7f('0x8'));var jayson=require(_0xcd7f('0x9'));var client=jayson[_0xcd7f('0xa')][_0xcd7f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb85839,_0x4f3186,_0x46bab5){return new BPromise(function(_0xb3c645,_0x14f33a){return client[_0xcd7f('0xc')](_0xb85839,_0x46bab5)[_0xcd7f('0xd')](function(_0x300f7e){logger['info'](_0xcd7f('0xe'),_0x4f3186,'request\x20sent');logger[_0xcd7f('0xf')](_0xcd7f('0x10'),_0x4f3186,_0xcd7f('0x11'),JSON[_0xcd7f('0x12')](_0x300f7e));if(_0x300f7e[_0xcd7f('0x13')]){if(_0x300f7e['error'][_0xcd7f('0x14')]===0x1f4){logger[_0xcd7f('0x13')](_0xcd7f('0xe'),_0x4f3186,_0x300f7e[_0xcd7f('0x13')][_0xcd7f('0x15')]);return _0x14f33a(_0x300f7e[_0xcd7f('0x13')][_0xcd7f('0x15')]);}logger[_0xcd7f('0x13')](_0xcd7f('0xe'),_0x4f3186,_0x300f7e[_0xcd7f('0x13')][_0xcd7f('0x15')]);return _0xb3c645(_0x300f7e[_0xcd7f('0x13')][_0xcd7f('0x15')]);}else{logger[_0xcd7f('0x16')](_0xcd7f('0xe'),_0x4f3186,_0xcd7f('0x11'));_0xb3c645(_0x300f7e[_0xcd7f('0x17')][_0xcd7f('0x15')]);}})[_0xcd7f('0x18')](function(_0x33ec44){logger[_0xcd7f('0x13')](_0xcd7f('0xe'),_0x4f3186,_0x33ec44);_0x14f33a(_0x33ec44);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index ce6c2d1..88a744b 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 _0x50e5=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','getSummary','post','put','/:id','update','delete'];(function(_0x58779c,_0xe8471b){var _0x5e1897=function(_0x17ed1f){while(--_0x17ed1f){_0x58779c['push'](_0x58779c['shift']());}};_0x5e1897(++_0xe8471b);}(_0x50e5,0xb7));var _0x550e=function(_0x1055fb,_0x4ad5f5){_0x1055fb=_0x1055fb-0x0;var _0x1ed96a=_0x50e5[_0x1055fb];return _0x1ed96a;};'use strict';var multer=require(_0x550e('0x0'));var util=require(_0x550e('0x1'));var path=require('path');var timeout=require(_0x550e('0x2'));var express=require(_0x550e('0x3'));var router=express[_0x550e('0x4')]();var fs_extra=require(_0x550e('0x5'));var auth=require(_0x550e('0x6'));var interaction=require(_0x550e('0x7'));var config=require(_0x550e('0x8'));var controller=require(_0x550e('0x9'));router[_0x550e('0xa')]('/',auth[_0x550e('0xb')](),controller[_0x550e('0xc')]);router[_0x550e('0xa')]('/:id',auth[_0x550e('0xb')](),controller[_0x550e('0xd')]);router['get'](_0x550e('0xe'),auth[_0x550e('0xb')](),controller[_0x550e('0xf')]);router['get'](_0x550e('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x550e('0xa')](_0x550e('0x11'),auth['isAuthenticated'](),timeout(_0x550e('0x12')),controller[_0x550e('0x13')]);router[_0x550e('0x14')]('/',auth[_0x550e('0xb')](),controller['create']);router[_0x550e('0x14')]('/:id/clone',auth[_0x550e('0xb')](),controller['clone']);router[_0x550e('0x15')](_0x550e('0x16'),auth[_0x550e('0xb')](),controller[_0x550e('0x17')]);router[_0x550e('0x18')]('/:id',auth[_0x550e('0xb')](),controller['destroy']);module[_0x550e('0x19')]=router; \ No newline at end of file +var _0xffd6=['Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','show','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','/:id/clone','clone','update','destroy','multer','util','path'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xffd6,0x97));var _0x6ffd=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xffd6[_0x424a9a];return _0xa7831c;};'use strict';var multer=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var path=require(_0x6ffd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6ffd('0x3')]();var fs_extra=require(_0x6ffd('0x4'));var auth=require(_0x6ffd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6ffd('0x6'));var controller=require(_0x6ffd('0x7'));router[_0x6ffd('0x8')]('/',auth[_0x6ffd('0x9')](),controller['index']);router[_0x6ffd('0x8')](_0x6ffd('0xa'),auth[_0x6ffd('0x9')](),controller[_0x6ffd('0xb')]);router[_0x6ffd('0x8')]('/:id/sessions',auth[_0x6ffd('0x9')](),controller[_0x6ffd('0xc')]);router['get'](_0x6ffd('0xd'),auth[_0x6ffd('0x9')](),controller[_0x6ffd('0xe')]);router[_0x6ffd('0x8')](_0x6ffd('0xf'),auth[_0x6ffd('0x9')](),timeout(_0x6ffd('0x10')),controller['getSummary']);router[_0x6ffd('0x11')]('/',auth[_0x6ffd('0x9')](),controller['create']);router[_0x6ffd('0x11')](_0x6ffd('0x12'),auth[_0x6ffd('0x9')](),controller[_0x6ffd('0x13')]);router['put'](_0x6ffd('0xa'),auth['isAuthenticated'](),controller[_0x6ffd('0x14')]);router['delete'](_0x6ffd('0xa'),auth[_0x6ffd('0x9')](),controller[_0x6ffd('0x15')]);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 db9813e..6f55a7e 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 _0xc14f=['formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','description','BOOLEAN','sequelize','util','exports','STRING','name','TEXT','stringify','isString','setDataValue'];(function(_0x5f52a4,_0x5706d9){var _0xde1bce=function(_0x16ef65){while(--_0x16ef65){_0x5f52a4['push'](_0x5f52a4['shift']());}};_0xde1bce(++_0x5706d9);}(_0xc14f,0xe5));var _0xfc14=function(_0x5792e8,_0x4295cc){_0x5792e8=_0x5792e8-0x0;var _0x3bc789=_0xc14f[_0x5792e8];return _0x3bc789;};'use strict';var Sequelize=require(_0xfc14('0x0'));var _=require('lodash');var util=require(_0xfc14('0x1'));module[_0xfc14('0x2')]={'name':{'type':Sequelize[_0xfc14('0x3')],'unique':_0xfc14('0x4')},'description':{'type':Sequelize[_0xfc14('0x3')]},'formData':{'type':Sequelize[_0xfc14('0x5')]('long'),'set':function(_0x5ac532){if(_['isObjectLike'](_0x5ac532)){this['setDataValue']('formData',JSON[_0xfc14('0x6')](_0x5ac532));}else if(_[_0xfc14('0x7')](_0x5ac532)){this[_0xfc14('0x8')]('formData',_0x5ac532);}else{this[_0xfc14('0x8')](_0xfc14('0x9'),util[_0xfc14('0xa')](_0xfc14('0xb'),this['getDataValue'](_0xfc14('0x4'))||'',this['getDataValue'](_0xfc14('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xfc14('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xfc14('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0xd13c=['isString','getDataValue','BOOLEAN','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData'];(function(_0x25e5c7,_0x119cc0){var _0x5757a6=function(_0x5f1131){while(--_0x5f1131){_0x25e5c7['push'](_0x25e5c7['shift']());}};_0x5757a6(++_0x119cc0);}(_0xd13c,0x163));var _0xcd13=function(_0x3ea6f2,_0x5cb125){_0x3ea6f2=_0x3ea6f2-0x0;var _0x4e5ef4=_0xd13c[_0x3ea6f2];return _0x4e5ef4;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require('util');module[_0xcd13('0x0')]={'name':{'type':Sequelize[_0xcd13('0x1')],'unique':_0xcd13('0x2')},'description':{'type':Sequelize[_0xcd13('0x1')]},'formData':{'type':Sequelize[_0xcd13('0x3')](_0xcd13('0x4')),'set':function(_0x143cbe){if(_[_0xcd13('0x5')](_0x143cbe)){this[_0xcd13('0x6')](_0xcd13('0x7'),JSON['stringify'](_0x143cbe));}else if(_[_0xcd13('0x8')](_0x143cbe)){this[_0xcd13('0x6')](_0xcd13('0x7'),_0x143cbe);}else{this[_0xcd13('0x6')](_0xcd13('0x7'),util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xcd13('0x9')]('name')||'',this[_0xcd13('0x9')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xcd13('0xa')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xcd13('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 45cf2f5..adc746d 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 _0xa9e0=['length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','omit','createdAt','updatedAt','Projects','UserProfileSection','params','getSessions','findOne','JscriptySessionReport','order','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','-createdAt','questionId','question','starttime','SessionId','answer','push','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','index','map','JscriptyProject','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields'];(function(_0x1c9adc,_0x90e66e){var _0x489ed5=function(_0x21465d){while(--_0x21465d){_0x1c9adc['push'](_0x1c9adc['shift']());}};_0x489ed5(++_0x90e66e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x24')]({'plain':!![]});var _0x16b1ca='Projects';return db['UserProfileResource'][_0x0a9e('0x23')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x22')](function(){return _0x2fb0e4;});})[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](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('0x25')](_0x25fba9[_0x0a9e('0x26')]);if(_0x25fba9[_0x0a9e('0x27')]){delete _0x25fba9[_0x0a9e('0x27')];}_0x1dc186[_0x0a9e('0x17')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x28')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x563b45){return{'name':_0x563b45[_0x0a9e('0x2c')],'type':_0x563b45[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x5c877d['model']=_[_0x0a9e('0x29')](_0x40e7a3,'name');_0x5c877d[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x468813[_0x0a9e('0x2f')]);_0x5c877d[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2f')]);_0x2ec755[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5c877d[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x35')]));_0x2ec755[_0x0a9e('0x33')]=_0x2ec755['attributes'][_0x0a9e('0x36')]?_0x2ec755['attributes']:_0x5c877d[_0x0a9e('0x34')];if(!_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x37')](_0x0a9e('0x38'))){_0x2ec755['limit']=qs[_0x0a9e('0x1a')](_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x1a')]);_0x2ec755[_0x0a9e('0x1b')]=qs['offset'](_0x468813['query'][_0x0a9e('0x1b')]);}_0x2ec755['order']=qs[_0x0a9e('0x39')](_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x39')]);_0x2ec755[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3b')](_0x468813[_0x0a9e('0x2f')],_0x5c877d[_0x0a9e('0x31')]),_0x40e7a3);if(_0x468813['query'][_0x0a9e('0x3c')]){_0x2ec755[_0x0a9e('0x3a')]=_[_0x0a9e('0x3d')](_0x2ec755['where'],{'$or':_['map'](_0x40e7a3,function(_0x11b61d){if(_0x11b61d[_0x0a9e('0x2d')]!=='VIRTUAL'){var _0x2b814e={};_0x2b814e[_0x11b61d[_0x0a9e('0x27')]]={'$like':'%'+_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x3c')]+'%'};return _0x2b814e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813['options']);var _0x15e37d={'where':_0x2ec755[_0x0a9e('0x3a')]};return db['JscriptyProject'][_0x0a9e('0x1c')](_0x15e37d)[_0x0a9e('0x22')](function(_0x1459bb){_0x15b200['count']=_0x1459bb;if(_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x3e')]){_0x2ec755[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x2ec755);})[_0x0a9e('0x22')](function(_0x2881b3){_0x15b200[_0x0a9e('0x41')]=_0x2881b3;return _0x15b200;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x148007,_0x1a7bce){var _0x11ca30={'raw':![],'where':{'id':_0x148007['params']['id']}},_0x37f6cc={};_0x37f6cc['model']=_[_0x0a9e('0x30')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x37f6cc[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x148007[_0x0a9e('0x2f')]);_0x37f6cc[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x37f6cc[_0x0a9e('0x34')],_0x37f6cc[_0x0a9e('0x2f')]);_0x11ca30[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x37f6cc['model'],qs[_0x0a9e('0x35')](_0x148007[_0x0a9e('0x2f')][_0x0a9e('0x35')]));_0x11ca30[_0x0a9e('0x33')]=_0x11ca30[_0x0a9e('0x33')][_0x0a9e('0x36')]?_0x11ca30[_0x0a9e('0x33')]:_0x37f6cc[_0x0a9e('0x34')];if(_0x148007['query'][_0x0a9e('0x3e')]){_0x11ca30['include']=[{'all':!![]}];}_0x11ca30=_[_0x0a9e('0x3d')]({},_0x11ca30,_0x148007[_0x0a9e('0x44')]);return db[_0x0a9e('0x2a')]['find'](_0x11ca30)[_0x0a9e('0x22')](handleEntityNotFound(_0x1a7bce,null))[_0x0a9e('0x22')](respondWithResult(_0x1a7bce,null))[_0x0a9e('0x42')](handleError(_0x1a7bce,null));};exports[_0x0a9e('0x45')]=function(_0x45c845,_0x37be73){return db[_0x0a9e('0x2a')]['create'](_0x45c845[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](function(_0x1b5e80){var _0x16f976=_0x45c845[_0x0a9e('0x47')][_0x0a9e('0x24')]({'plain':!![]});if(!_0x16f976)throw new Error(_0x0a9e('0x48'));if(_0x16f976[_0x0a9e('0x49')]===_0x0a9e('0x47')){var _0x58a5c2=_0x1b5e80[_0x0a9e('0x24')]({'plain':!![]});var _0x3fe430='Projects';return db['UserProfileSection']['find']({'where':{'name':_0x3fe430,'userProfileId':_0x16f976[_0x0a9e('0x4a')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x37edaa){if(_0x37edaa&&_0x37edaa[_0x0a9e('0x4b')]===0x0){return db[_0x0a9e('0x4c')][_0x0a9e('0x45')]({'name':_0x58a5c2[_0x0a9e('0x27')],'resourceId':_0x58a5c2['id'],'type':_0x37edaa[_0x0a9e('0x27')],'sectionId':_0x37edaa['id']},{})['then'](function(){return _0x1b5e80;});}else{return _0x1b5e80;}})['catch'](function(_0x53975a){logger[_0x0a9e('0x25')](_0x0a9e('0x4d'),_0x53975a);throw _0x53975a;});}return _0x1b5e80;})[_0x0a9e('0x22')](respondWithResult(_0x37be73,0xc9))['catch'](handleError(_0x37be73,null));};exports[_0x0a9e('0x4e')]=function(_0x161aa7,_0x53d113){var _0x5a88da={'where':{'id':_0x161aa7['params']['id']}},_0x2ef381={};_0x2ef381[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x5a88da[_0x0a9e('0x33')]=_['intersection'](_0x2ef381[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x161aa7['query']['fields']));_0x5a88da[_0x0a9e('0x33')]=_0x5a88da[_0x0a9e('0x33')]['length']?_0x5a88da[_0x0a9e('0x33')]:_0x2ef381['model'];if(_0x161aa7[_0x0a9e('0x2f')]['includeAll']){_0x5a88da[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x5a88da=_['merge']({},_0x5a88da,_0x161aa7['options']);return db['JscriptyProject'][_0x0a9e('0x4f')](_0x5a88da)['then'](handleEntityNotFound(_0x53d113,null))[_0x0a9e('0x22')](function(_0x65432){if(_0x65432){var _0x3cfd00=_0x65432[_0x0a9e('0x24')]({'plain':!![]});_0x3cfd00=qs[_0x0a9e('0x50')](_0x3cfd00,['id',_0x0a9e('0x51'),_0x0a9e('0x52')]);_0x161aa7[_0x0a9e('0x46')]=_['omit'](_0x161aa7[_0x0a9e('0x46')],['id',_0x0a9e('0x51'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x45')](_[_0x0a9e('0x3d')](_0x3cfd00,_0x161aa7['body']),{'include':_0x161aa7[_0x0a9e('0x2f')][_0x0a9e('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x3649cc){var _0x5cc8fb=_0x161aa7[_0x0a9e('0x47')]['get']({'plain':!![]});if(!_0x5cc8fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cc8fb['role']===_0x0a9e('0x47')){var _0x49d231=_0x3649cc[_0x0a9e('0x24')]({'plain':!![]});var _0x1fc70e=_0x0a9e('0x53');return db[_0x0a9e('0x54')][_0x0a9e('0x4f')]({'where':{'name':_0x1fc70e,'userProfileId':_0x5cc8fb[_0x0a9e('0x4a')]},'raw':!![]})['then'](function(_0x1627a7){if(_0x1627a7&&_0x1627a7['autoAssociation']===0x0){return db[_0x0a9e('0x4c')][_0x0a9e('0x45')]({'name':_0x49d231[_0x0a9e('0x27')],'resourceId':_0x49d231['id'],'type':_0x1627a7['name'],'sectionId':_0x1627a7['id']},{})[_0x0a9e('0x22')](function(){return _0x3649cc;});}else{return _0x3649cc;}})[_0x0a9e('0x42')](function(_0x119677){logger[_0x0a9e('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x119677);throw _0x119677;});}return _0x3649cc;});}})[_0x0a9e('0x22')](respondWithResult(_0x53d113,0xc9))[_0x0a9e('0x42')](handleError(_0x53d113,null));};exports['update']=function(_0x797b45,_0x17e88c){if(_0x797b45[_0x0a9e('0x46')]['id']){delete _0x797b45[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x797b45[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x17e88c,null))[_0x0a9e('0x22')](saveUpdates(_0x797b45['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x17e88c,null))['catch'](handleError(_0x17e88c,null));};exports['destroy']=function(_0x242745,_0x4556c5){return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'id':_0x242745[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4556c5,null))[_0x0a9e('0x22')](removeEntity(_0x4556c5,null))[_0x0a9e('0x42')](handleError(_0x4556c5,null));};exports[_0x0a9e('0x56')]=function(_0x1cc4f3,_0x2e89b7,_0x19012b){var _0x2bbb86={'raw':!![],'where':{}};var _0x2b8192={};var _0x320898={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x57')]({'where':{'id':_0x1cc4f3[_0x0a9e('0x55')]['id']}})['then'](handleEntityNotFound(_0x2e89b7,null))[_0x0a9e('0x22')](function(_0x295763){if(_0x295763){_0x2b8192[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x58')][_0x0a9e('0x2b')]);_0x2b8192['query']=_[_0x0a9e('0x30')](_0x1cc4f3[_0x0a9e('0x2f')]);_0x2b8192[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x2b8192[_0x0a9e('0x34')],_0x2b8192['query']);_0x2bbb86['attributes']=_['intersection'](_0x2b8192[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x35')]));_0x2bbb86[_0x0a9e('0x33')]=_0x2bbb86[_0x0a9e('0x33')][_0x0a9e('0x36')]?_0x2bbb86[_0x0a9e('0x33')]:_0x2b8192['model'];if(!_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x37')](_0x0a9e('0x38'))){_0x2bbb86['limit']=qs[_0x0a9e('0x1a')](_0x1cc4f3['query'][_0x0a9e('0x1a')]);_0x2bbb86[_0x0a9e('0x1b')]=qs['offset'](_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x1b')]);}_0x2bbb86[_0x0a9e('0x59')]=qs[_0x0a9e('0x39')](_0x1cc4f3['query'][_0x0a9e('0x39')]);_0x2bbb86[_0x0a9e('0x3a')]=qs[_0x0a9e('0x31')](_[_0x0a9e('0x3b')](_0x1cc4f3['query'],_0x2b8192[_0x0a9e('0x31')]));_0x2bbb86[_0x0a9e('0x3a')][_0x0a9e('0x5a')]=_0x295763['id'];if(_0x1cc4f3[_0x0a9e('0x2f')]['filter']){_0x2bbb86[_0x0a9e('0x3a')]=_[_0x0a9e('0x3d')](_0x2bbb86[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x29')](_0x2bbb86[_0x0a9e('0x33')],function(_0xdb98ca){var _0x40fc56={};_0x40fc56[_0xdb98ca]={'$like':'%'+_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x3c')]+'%'};return _0x40fc56;})});}_0x2bbb86=_[_0x0a9e('0x3d')]({},_0x2bbb86,_0x1cc4f3[_0x0a9e('0x44')]);return db[_0x0a9e('0x58')][_0x0a9e('0x1c')]({'where':_0x2bbb86[_0x0a9e('0x3a')]})['then'](function(_0xf4120f){_0x320898[_0x0a9e('0x1c')]=_0xf4120f;if(_0x1cc4f3[_0x0a9e('0x2f')]['includeAll']){_0x2bbb86[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x58')][_0x0a9e('0x40')](_0x2bbb86);})[_0x0a9e('0x22')](function(_0x56d650){_0x320898['rows']=_0x56d650;return _0x320898;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x2e89b7,_0x2bbb86))[_0x0a9e('0x42')](handleError(_0x2e89b7,null));};exports['getAnswers']=function(_0x45108c,_0x53a6a1,_0x260f4b){var _0x8ebf02={'raw':!![],'where':{}};var _0x5637a1={};var _0x28a942={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x57')]({'where':{'id':_0x45108c[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x53a6a1,null))[_0x0a9e('0x22')](function(_0x444f1f){if(_0x444f1f){_0x5637a1['model']=_[_0x0a9e('0x30')](db[_0x0a9e('0x5b')][_0x0a9e('0x2b')]);_0x5637a1[_0x0a9e('0x2f')]=_['keys'](_0x45108c[_0x0a9e('0x2f')]);_0x5637a1[_0x0a9e('0x31')]=_['intersection'](_0x5637a1[_0x0a9e('0x34')],_0x5637a1['query']);_0x8ebf02[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5637a1[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x45108c['query']['fields']));_0x8ebf02[_0x0a9e('0x33')]=_0x8ebf02[_0x0a9e('0x33')][_0x0a9e('0x36')]?_0x8ebf02['attributes']:_0x5637a1[_0x0a9e('0x34')];if(!_0x45108c[_0x0a9e('0x2f')]['hasOwnProperty']('nolimit')){_0x8ebf02[_0x0a9e('0x1a')]=qs['limit'](_0x45108c['query']['limit']);_0x8ebf02[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x45108c[_0x0a9e('0x2f')][_0x0a9e('0x1b')]);}_0x8ebf02[_0x0a9e('0x59')]=qs[_0x0a9e('0x39')](_0x45108c['query'][_0x0a9e('0x39')]);_0x8ebf02['where']=qs[_0x0a9e('0x31')](_[_0x0a9e('0x3b')](_0x45108c[_0x0a9e('0x2f')],_0x5637a1[_0x0a9e('0x31')]));_0x8ebf02['where'][_0x0a9e('0x5a')]=_0x444f1f['id'];if(_0x45108c[_0x0a9e('0x2f')][_0x0a9e('0x3c')]){_0x8ebf02['where']=_[_0x0a9e('0x3d')](_0x8ebf02[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x29')](_0x8ebf02[_0x0a9e('0x33')],function(_0x255e49){var _0x1910bf={};_0x1910bf[_0x255e49]={'$like':'%'+_0x45108c[_0x0a9e('0x2f')][_0x0a9e('0x3c')]+'%'};return _0x1910bf;})});}_0x8ebf02=_['merge']({},_0x8ebf02,_0x45108c[_0x0a9e('0x44')]);return db[_0x0a9e('0x5b')]['count']({'where':_0x8ebf02[_0x0a9e('0x3a')]})[_0x0a9e('0x22')](function(_0x3a1974){_0x28a942['count']=_0x3a1974;if(_0x45108c[_0x0a9e('0x2f')]['includeAll']){_0x8ebf02[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5b')][_0x0a9e('0x40')](_0x8ebf02);})[_0x0a9e('0x22')](function(_0x842d6f){_0x28a942[_0x0a9e('0x41')]=_0x842d6f;return _0x28a942;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x53a6a1,_0x8ebf02))[_0x0a9e('0x42')](handleError(_0x53a6a1,null));};function char(_0x501050){return _0x0a9e('0x5c')===typeof _0x501050?String[_0x0a9e('0x5d')][_0x0a9e('0x1f')](null,arguments):_0x501050;}function needsEncapsulation(_0x30ef6e){return!!_0x30ef6e&&(_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0xd))>=0x0||_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0xa))>=0x0||_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0x2c))>=0x0||_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x18273f){var _0x4989f9=char(0x22),_0xc81b64='\x5c'+char(0x22),_0x23e2bd=_0x18273f[_0x0a9e('0x5e')]()[_0x0a9e('0x60')](new RegExp(_0x4989f9,'g'),_0xc81b64);return _0x4989f9+_0x23e2bd+_0x4989f9;}exports[_0x0a9e('0x61')]=function(_0x5d9ddb,_0x3afc8c,_0x1756c7){var _0x5ce99d,_0x23b447;var _0x5e725e={'where':{'ProjectId':_0x5d9ddb[_0x0a9e('0x55')]['id']}};if(_0x5d9ddb[_0x0a9e('0x2f')][_0x0a9e('0x62')]){_0x5e725e[_0x0a9e('0x3a')]['starttime']=JSON[_0x0a9e('0x63')](_0x5d9ddb['query'][_0x0a9e('0x62')]);}return db[_0x0a9e('0x58')]['findAll'](_0x5e725e)[_0x0a9e('0x22')](handleEntityNotFound(_0x3afc8c,null))[_0x0a9e('0x22')](function(_0x1dd541){if(_0x1dd541){_0x5ce99d=_0x1dd541;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x0a9e('0x29')](_0x5ce99d,'id')},'ProjectId':_0x5d9ddb[_0x0a9e('0x55')]['id']},'order':_0x0a9e('0x64')});}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3afc8c,null))[_0x0a9e('0x22')](function(_0x2450a8){if(_0x2450a8){_0x23b447=_0x2450a8;var _0x17793e={};for(var _0x3c75b9=0x0,_0x3f8124=_0x23b447['length'];_0x3c75b9<_0x3f8124;_0x3c75b9++){if(!_0x17793e[_0x0a9e('0x37')](_0x23b447[_0x3c75b9]['questionId'])){_0x17793e[_0x23b447[_0x3c75b9][_0x0a9e('0x65')]]=needsEncapsulation(_0x23b447[_0x3c75b9][_0x0a9e('0x66')])?encapsulate(_0x23b447[_0x3c75b9][_0x0a9e('0x66')]):_0x23b447[_0x3c75b9][_0x0a9e('0x66')];}}var _0x1b61d5=[],_0x4e7273={};for(var _0x436313=0x0,_0x4667bf=_0x5ce99d[_0x0a9e('0x36')];_0x436313<_0x4667bf;_0x436313++){_0x4e7273={'ProjectId':_0x5d9ddb[_0x0a9e('0x55')]['id'],'SessionId':_0x5ce99d[_0x436313]['id'],'StartTime':moment(_0x5ce99d[_0x436313][_0x0a9e('0x67')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x22a3cb=0x0,_0x583662=_0x23b447[_0x0a9e('0x36')];_0x22a3cb<_0x583662;_0x22a3cb++){if(_0x23b447[_0x22a3cb][_0x0a9e('0x68')]==_0x5ce99d[_0x436313]['id']&&_0x17793e[_0x0a9e('0x37')](_0x23b447[_0x22a3cb][_0x0a9e('0x65')])){_0x4e7273[_0x17793e[_0x23b447[_0x22a3cb][_0x0a9e('0x65')]]]=_0x23b447[_0x22a3cb][_0x0a9e('0x69')];}}for(var _0x596312 in _0x17793e){if(!_0x4e7273['hasOwnProperty'](_0x17793e[_0x596312])){_0x4e7273[_0x17793e[_0x596312]]=null;}}_0x1b61d5[_0x0a9e('0x6a')](_0x4e7273);}return _0x1b61d5;}})['then'](function(_0x2469d1){if(!_['isEmpty'](_0x2469d1)){var _0x427ccc=toCsv(_0x2469d1);var _0x564db2=Date['now']();fs[_0x0a9e('0x6b')](util[_0x0a9e('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x5d9ddb[_0x0a9e('0x55')]['id'],_0x564db2),_0x427ccc);_0x3afc8c[_0x0a9e('0x6d')](_0x0a9e('0x6e'),_0x0a9e('0x6f')+util[_0x0a9e('0x6c')]('Jscripty_Project_%d_Summary_%s.csv',_0x5d9ddb['params']['id'],_0x564db2));_0x3afc8c[_0x0a9e('0x6d')](_0x0a9e('0x70'),_0x0a9e('0x71'));return _0x3afc8c[_0x0a9e('0x72')](util[_0x0a9e('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x5d9ddb[_0x0a9e('0x55')]['id'],_0x564db2));}else{return _0x3afc8c[_0x0a9e('0x15')](0xcc);}})['catch'](handleError(_0x3afc8c,null));}; \ No newline at end of file +var _0xa9e0=['length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','omit','createdAt','updatedAt','Projects','UserProfileSection','params','getSessions','findOne','JscriptySessionReport','order','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','-createdAt','questionId','question','starttime','SessionId','answer','push','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','index','map','JscriptyProject','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields'];(function(_0x5a7f2d,_0x246701){var _0x429a0b=function(_0x2c961b){while(--_0x2c961b){_0x5a7f2d['push'](_0x5a7f2d['shift']());}};_0x429a0b(++_0x246701);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x24')]({'plain':!![]});var _0x16b1ca='Projects';return db['UserProfileResource'][_0x0a9e('0x23')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x22')](function(){return _0x2fb0e4;});})[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](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('0x25')](_0x25fba9[_0x0a9e('0x26')]);if(_0x25fba9[_0x0a9e('0x27')]){delete _0x25fba9[_0x0a9e('0x27')];}_0x1dc186[_0x0a9e('0x17')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x28')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x563b45){return{'name':_0x563b45[_0x0a9e('0x2c')],'type':_0x563b45[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x5c877d['model']=_[_0x0a9e('0x29')](_0x40e7a3,'name');_0x5c877d[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x468813[_0x0a9e('0x2f')]);_0x5c877d[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2f')]);_0x2ec755[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5c877d[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x35')]));_0x2ec755[_0x0a9e('0x33')]=_0x2ec755['attributes'][_0x0a9e('0x36')]?_0x2ec755['attributes']:_0x5c877d[_0x0a9e('0x34')];if(!_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x37')](_0x0a9e('0x38'))){_0x2ec755['limit']=qs[_0x0a9e('0x1a')](_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x1a')]);_0x2ec755[_0x0a9e('0x1b')]=qs['offset'](_0x468813['query'][_0x0a9e('0x1b')]);}_0x2ec755['order']=qs[_0x0a9e('0x39')](_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x39')]);_0x2ec755[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3b')](_0x468813[_0x0a9e('0x2f')],_0x5c877d[_0x0a9e('0x31')]),_0x40e7a3);if(_0x468813['query'][_0x0a9e('0x3c')]){_0x2ec755[_0x0a9e('0x3a')]=_[_0x0a9e('0x3d')](_0x2ec755['where'],{'$or':_['map'](_0x40e7a3,function(_0x11b61d){if(_0x11b61d[_0x0a9e('0x2d')]!=='VIRTUAL'){var _0x2b814e={};_0x2b814e[_0x11b61d[_0x0a9e('0x27')]]={'$like':'%'+_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x3c')]+'%'};return _0x2b814e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813['options']);var _0x15e37d={'where':_0x2ec755[_0x0a9e('0x3a')]};return db['JscriptyProject'][_0x0a9e('0x1c')](_0x15e37d)[_0x0a9e('0x22')](function(_0x1459bb){_0x15b200['count']=_0x1459bb;if(_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x3e')]){_0x2ec755[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x2ec755);})[_0x0a9e('0x22')](function(_0x2881b3){_0x15b200[_0x0a9e('0x41')]=_0x2881b3;return _0x15b200;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x148007,_0x1a7bce){var _0x11ca30={'raw':![],'where':{'id':_0x148007['params']['id']}},_0x37f6cc={};_0x37f6cc['model']=_[_0x0a9e('0x30')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x37f6cc[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x148007[_0x0a9e('0x2f')]);_0x37f6cc[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x37f6cc[_0x0a9e('0x34')],_0x37f6cc[_0x0a9e('0x2f')]);_0x11ca30[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x37f6cc['model'],qs[_0x0a9e('0x35')](_0x148007[_0x0a9e('0x2f')][_0x0a9e('0x35')]));_0x11ca30[_0x0a9e('0x33')]=_0x11ca30[_0x0a9e('0x33')][_0x0a9e('0x36')]?_0x11ca30[_0x0a9e('0x33')]:_0x37f6cc[_0x0a9e('0x34')];if(_0x148007['query'][_0x0a9e('0x3e')]){_0x11ca30['include']=[{'all':!![]}];}_0x11ca30=_[_0x0a9e('0x3d')]({},_0x11ca30,_0x148007[_0x0a9e('0x44')]);return db[_0x0a9e('0x2a')]['find'](_0x11ca30)[_0x0a9e('0x22')](handleEntityNotFound(_0x1a7bce,null))[_0x0a9e('0x22')](respondWithResult(_0x1a7bce,null))[_0x0a9e('0x42')](handleError(_0x1a7bce,null));};exports[_0x0a9e('0x45')]=function(_0x45c845,_0x37be73){return db[_0x0a9e('0x2a')]['create'](_0x45c845[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](function(_0x1b5e80){var _0x16f976=_0x45c845[_0x0a9e('0x47')][_0x0a9e('0x24')]({'plain':!![]});if(!_0x16f976)throw new Error(_0x0a9e('0x48'));if(_0x16f976[_0x0a9e('0x49')]===_0x0a9e('0x47')){var _0x58a5c2=_0x1b5e80[_0x0a9e('0x24')]({'plain':!![]});var _0x3fe430='Projects';return db['UserProfileSection']['find']({'where':{'name':_0x3fe430,'userProfileId':_0x16f976[_0x0a9e('0x4a')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x37edaa){if(_0x37edaa&&_0x37edaa[_0x0a9e('0x4b')]===0x0){return db[_0x0a9e('0x4c')][_0x0a9e('0x45')]({'name':_0x58a5c2[_0x0a9e('0x27')],'resourceId':_0x58a5c2['id'],'type':_0x37edaa[_0x0a9e('0x27')],'sectionId':_0x37edaa['id']},{})['then'](function(){return _0x1b5e80;});}else{return _0x1b5e80;}})['catch'](function(_0x53975a){logger[_0x0a9e('0x25')](_0x0a9e('0x4d'),_0x53975a);throw _0x53975a;});}return _0x1b5e80;})[_0x0a9e('0x22')](respondWithResult(_0x37be73,0xc9))['catch'](handleError(_0x37be73,null));};exports[_0x0a9e('0x4e')]=function(_0x161aa7,_0x53d113){var _0x5a88da={'where':{'id':_0x161aa7['params']['id']}},_0x2ef381={};_0x2ef381[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x5a88da[_0x0a9e('0x33')]=_['intersection'](_0x2ef381[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x161aa7['query']['fields']));_0x5a88da[_0x0a9e('0x33')]=_0x5a88da[_0x0a9e('0x33')]['length']?_0x5a88da[_0x0a9e('0x33')]:_0x2ef381['model'];if(_0x161aa7[_0x0a9e('0x2f')]['includeAll']){_0x5a88da[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x5a88da=_['merge']({},_0x5a88da,_0x161aa7['options']);return db['JscriptyProject'][_0x0a9e('0x4f')](_0x5a88da)['then'](handleEntityNotFound(_0x53d113,null))[_0x0a9e('0x22')](function(_0x65432){if(_0x65432){var _0x3cfd00=_0x65432[_0x0a9e('0x24')]({'plain':!![]});_0x3cfd00=qs[_0x0a9e('0x50')](_0x3cfd00,['id',_0x0a9e('0x51'),_0x0a9e('0x52')]);_0x161aa7[_0x0a9e('0x46')]=_['omit'](_0x161aa7[_0x0a9e('0x46')],['id',_0x0a9e('0x51'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x45')](_[_0x0a9e('0x3d')](_0x3cfd00,_0x161aa7['body']),{'include':_0x161aa7[_0x0a9e('0x2f')][_0x0a9e('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x3649cc){var _0x5cc8fb=_0x161aa7[_0x0a9e('0x47')]['get']({'plain':!![]});if(!_0x5cc8fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cc8fb['role']===_0x0a9e('0x47')){var _0x49d231=_0x3649cc[_0x0a9e('0x24')]({'plain':!![]});var _0x1fc70e=_0x0a9e('0x53');return db[_0x0a9e('0x54')][_0x0a9e('0x4f')]({'where':{'name':_0x1fc70e,'userProfileId':_0x5cc8fb[_0x0a9e('0x4a')]},'raw':!![]})['then'](function(_0x1627a7){if(_0x1627a7&&_0x1627a7['autoAssociation']===0x0){return db[_0x0a9e('0x4c')][_0x0a9e('0x45')]({'name':_0x49d231[_0x0a9e('0x27')],'resourceId':_0x49d231['id'],'type':_0x1627a7['name'],'sectionId':_0x1627a7['id']},{})[_0x0a9e('0x22')](function(){return _0x3649cc;});}else{return _0x3649cc;}})[_0x0a9e('0x42')](function(_0x119677){logger[_0x0a9e('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x119677);throw _0x119677;});}return _0x3649cc;});}})[_0x0a9e('0x22')](respondWithResult(_0x53d113,0xc9))[_0x0a9e('0x42')](handleError(_0x53d113,null));};exports['update']=function(_0x797b45,_0x17e88c){if(_0x797b45[_0x0a9e('0x46')]['id']){delete _0x797b45[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x797b45[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x17e88c,null))[_0x0a9e('0x22')](saveUpdates(_0x797b45['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x17e88c,null))['catch'](handleError(_0x17e88c,null));};exports['destroy']=function(_0x242745,_0x4556c5){return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'id':_0x242745[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4556c5,null))[_0x0a9e('0x22')](removeEntity(_0x4556c5,null))[_0x0a9e('0x42')](handleError(_0x4556c5,null));};exports[_0x0a9e('0x56')]=function(_0x1cc4f3,_0x2e89b7,_0x19012b){var _0x2bbb86={'raw':!![],'where':{}};var _0x2b8192={};var _0x320898={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x57')]({'where':{'id':_0x1cc4f3[_0x0a9e('0x55')]['id']}})['then'](handleEntityNotFound(_0x2e89b7,null))[_0x0a9e('0x22')](function(_0x295763){if(_0x295763){_0x2b8192[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x58')][_0x0a9e('0x2b')]);_0x2b8192['query']=_[_0x0a9e('0x30')](_0x1cc4f3[_0x0a9e('0x2f')]);_0x2b8192[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x2b8192[_0x0a9e('0x34')],_0x2b8192['query']);_0x2bbb86['attributes']=_['intersection'](_0x2b8192[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x35')]));_0x2bbb86[_0x0a9e('0x33')]=_0x2bbb86[_0x0a9e('0x33')][_0x0a9e('0x36')]?_0x2bbb86[_0x0a9e('0x33')]:_0x2b8192['model'];if(!_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x37')](_0x0a9e('0x38'))){_0x2bbb86['limit']=qs[_0x0a9e('0x1a')](_0x1cc4f3['query'][_0x0a9e('0x1a')]);_0x2bbb86[_0x0a9e('0x1b')]=qs['offset'](_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x1b')]);}_0x2bbb86[_0x0a9e('0x59')]=qs[_0x0a9e('0x39')](_0x1cc4f3['query'][_0x0a9e('0x39')]);_0x2bbb86[_0x0a9e('0x3a')]=qs[_0x0a9e('0x31')](_[_0x0a9e('0x3b')](_0x1cc4f3['query'],_0x2b8192[_0x0a9e('0x31')]));_0x2bbb86[_0x0a9e('0x3a')][_0x0a9e('0x5a')]=_0x295763['id'];if(_0x1cc4f3[_0x0a9e('0x2f')]['filter']){_0x2bbb86[_0x0a9e('0x3a')]=_[_0x0a9e('0x3d')](_0x2bbb86[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x29')](_0x2bbb86[_0x0a9e('0x33')],function(_0xdb98ca){var _0x40fc56={};_0x40fc56[_0xdb98ca]={'$like':'%'+_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x3c')]+'%'};return _0x40fc56;})});}_0x2bbb86=_[_0x0a9e('0x3d')]({},_0x2bbb86,_0x1cc4f3[_0x0a9e('0x44')]);return db[_0x0a9e('0x58')][_0x0a9e('0x1c')]({'where':_0x2bbb86[_0x0a9e('0x3a')]})['then'](function(_0xf4120f){_0x320898[_0x0a9e('0x1c')]=_0xf4120f;if(_0x1cc4f3[_0x0a9e('0x2f')]['includeAll']){_0x2bbb86[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x58')][_0x0a9e('0x40')](_0x2bbb86);})[_0x0a9e('0x22')](function(_0x56d650){_0x320898['rows']=_0x56d650;return _0x320898;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x2e89b7,_0x2bbb86))[_0x0a9e('0x42')](handleError(_0x2e89b7,null));};exports['getAnswers']=function(_0x45108c,_0x53a6a1,_0x260f4b){var _0x8ebf02={'raw':!![],'where':{}};var _0x5637a1={};var _0x28a942={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x57')]({'where':{'id':_0x45108c[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x53a6a1,null))[_0x0a9e('0x22')](function(_0x444f1f){if(_0x444f1f){_0x5637a1['model']=_[_0x0a9e('0x30')](db[_0x0a9e('0x5b')][_0x0a9e('0x2b')]);_0x5637a1[_0x0a9e('0x2f')]=_['keys'](_0x45108c[_0x0a9e('0x2f')]);_0x5637a1[_0x0a9e('0x31')]=_['intersection'](_0x5637a1[_0x0a9e('0x34')],_0x5637a1['query']);_0x8ebf02[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5637a1[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x45108c['query']['fields']));_0x8ebf02[_0x0a9e('0x33')]=_0x8ebf02[_0x0a9e('0x33')][_0x0a9e('0x36')]?_0x8ebf02['attributes']:_0x5637a1[_0x0a9e('0x34')];if(!_0x45108c[_0x0a9e('0x2f')]['hasOwnProperty']('nolimit')){_0x8ebf02[_0x0a9e('0x1a')]=qs['limit'](_0x45108c['query']['limit']);_0x8ebf02[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x45108c[_0x0a9e('0x2f')][_0x0a9e('0x1b')]);}_0x8ebf02[_0x0a9e('0x59')]=qs[_0x0a9e('0x39')](_0x45108c['query'][_0x0a9e('0x39')]);_0x8ebf02['where']=qs[_0x0a9e('0x31')](_[_0x0a9e('0x3b')](_0x45108c[_0x0a9e('0x2f')],_0x5637a1[_0x0a9e('0x31')]));_0x8ebf02['where'][_0x0a9e('0x5a')]=_0x444f1f['id'];if(_0x45108c[_0x0a9e('0x2f')][_0x0a9e('0x3c')]){_0x8ebf02['where']=_[_0x0a9e('0x3d')](_0x8ebf02[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x29')](_0x8ebf02[_0x0a9e('0x33')],function(_0x255e49){var _0x1910bf={};_0x1910bf[_0x255e49]={'$like':'%'+_0x45108c[_0x0a9e('0x2f')][_0x0a9e('0x3c')]+'%'};return _0x1910bf;})});}_0x8ebf02=_['merge']({},_0x8ebf02,_0x45108c[_0x0a9e('0x44')]);return db[_0x0a9e('0x5b')]['count']({'where':_0x8ebf02[_0x0a9e('0x3a')]})[_0x0a9e('0x22')](function(_0x3a1974){_0x28a942['count']=_0x3a1974;if(_0x45108c[_0x0a9e('0x2f')]['includeAll']){_0x8ebf02[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5b')][_0x0a9e('0x40')](_0x8ebf02);})[_0x0a9e('0x22')](function(_0x842d6f){_0x28a942[_0x0a9e('0x41')]=_0x842d6f;return _0x28a942;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x53a6a1,_0x8ebf02))[_0x0a9e('0x42')](handleError(_0x53a6a1,null));};function char(_0x501050){return _0x0a9e('0x5c')===typeof _0x501050?String[_0x0a9e('0x5d')][_0x0a9e('0x1f')](null,arguments):_0x501050;}function needsEncapsulation(_0x30ef6e){return!!_0x30ef6e&&(_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0xd))>=0x0||_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0xa))>=0x0||_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0x2c))>=0x0||_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x18273f){var _0x4989f9=char(0x22),_0xc81b64='\x5c'+char(0x22),_0x23e2bd=_0x18273f[_0x0a9e('0x5e')]()[_0x0a9e('0x60')](new RegExp(_0x4989f9,'g'),_0xc81b64);return _0x4989f9+_0x23e2bd+_0x4989f9;}exports[_0x0a9e('0x61')]=function(_0x5d9ddb,_0x3afc8c,_0x1756c7){var _0x5ce99d,_0x23b447;var _0x5e725e={'where':{'ProjectId':_0x5d9ddb[_0x0a9e('0x55')]['id']}};if(_0x5d9ddb[_0x0a9e('0x2f')][_0x0a9e('0x62')]){_0x5e725e[_0x0a9e('0x3a')]['starttime']=JSON[_0x0a9e('0x63')](_0x5d9ddb['query'][_0x0a9e('0x62')]);}return db[_0x0a9e('0x58')]['findAll'](_0x5e725e)[_0x0a9e('0x22')](handleEntityNotFound(_0x3afc8c,null))[_0x0a9e('0x22')](function(_0x1dd541){if(_0x1dd541){_0x5ce99d=_0x1dd541;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x0a9e('0x29')](_0x5ce99d,'id')},'ProjectId':_0x5d9ddb[_0x0a9e('0x55')]['id']},'order':_0x0a9e('0x64')});}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3afc8c,null))[_0x0a9e('0x22')](function(_0x2450a8){if(_0x2450a8){_0x23b447=_0x2450a8;var _0x17793e={};for(var _0x3c75b9=0x0,_0x3f8124=_0x23b447['length'];_0x3c75b9<_0x3f8124;_0x3c75b9++){if(!_0x17793e[_0x0a9e('0x37')](_0x23b447[_0x3c75b9]['questionId'])){_0x17793e[_0x23b447[_0x3c75b9][_0x0a9e('0x65')]]=needsEncapsulation(_0x23b447[_0x3c75b9][_0x0a9e('0x66')])?encapsulate(_0x23b447[_0x3c75b9][_0x0a9e('0x66')]):_0x23b447[_0x3c75b9][_0x0a9e('0x66')];}}var _0x1b61d5=[],_0x4e7273={};for(var _0x436313=0x0,_0x4667bf=_0x5ce99d[_0x0a9e('0x36')];_0x436313<_0x4667bf;_0x436313++){_0x4e7273={'ProjectId':_0x5d9ddb[_0x0a9e('0x55')]['id'],'SessionId':_0x5ce99d[_0x436313]['id'],'StartTime':moment(_0x5ce99d[_0x436313][_0x0a9e('0x67')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x22a3cb=0x0,_0x583662=_0x23b447[_0x0a9e('0x36')];_0x22a3cb<_0x583662;_0x22a3cb++){if(_0x23b447[_0x22a3cb][_0x0a9e('0x68')]==_0x5ce99d[_0x436313]['id']&&_0x17793e[_0x0a9e('0x37')](_0x23b447[_0x22a3cb][_0x0a9e('0x65')])){_0x4e7273[_0x17793e[_0x23b447[_0x22a3cb][_0x0a9e('0x65')]]]=_0x23b447[_0x22a3cb][_0x0a9e('0x69')];}}for(var _0x596312 in _0x17793e){if(!_0x4e7273['hasOwnProperty'](_0x17793e[_0x596312])){_0x4e7273[_0x17793e[_0x596312]]=null;}}_0x1b61d5[_0x0a9e('0x6a')](_0x4e7273);}return _0x1b61d5;}})['then'](function(_0x2469d1){if(!_['isEmpty'](_0x2469d1)){var _0x427ccc=toCsv(_0x2469d1);var _0x564db2=Date['now']();fs[_0x0a9e('0x6b')](util[_0x0a9e('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x5d9ddb[_0x0a9e('0x55')]['id'],_0x564db2),_0x427ccc);_0x3afc8c[_0x0a9e('0x6d')](_0x0a9e('0x6e'),_0x0a9e('0x6f')+util[_0x0a9e('0x6c')]('Jscripty_Project_%d_Summary_%s.csv',_0x5d9ddb['params']['id'],_0x564db2));_0x3afc8c[_0x0a9e('0x6d')](_0x0a9e('0x70'),_0x0a9e('0x71'));return _0x3afc8c[_0x0a9e('0x72')](util[_0x0a9e('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x5d9ddb[_0x0a9e('0x55')]['id'],_0x564db2));}else{return _0x3afc8c[_0x0a9e('0x15')](0xcc);}})['catch'](handleError(_0x3afc8c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 366f7e2..6a66c47 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 _0x15f7=['jscripty_projects','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject'];(function(_0x3ee0d6,_0x369387){var _0x24e854=function(_0x46cab5){while(--_0x46cab5){_0x3ee0d6['push'](_0x3ee0d6['shift']());}};_0x24e854(++_0x369387);}(_0x15f7,0x109));var _0x715f=function(_0x110d59,_0x50c4fb){_0x110d59=_0x110d59-0x0;var _0x2fce64=_0x15f7[_0x110d59];return _0x2fce64;};'use strict';var _=require(_0x715f('0x0'));var util=require(_0x715f('0x1'));var logger=require(_0x715f('0x2'))(_0x715f('0x3'));var moment=require('moment');var BPromise=require(_0x715f('0x4'));var rp=require(_0x715f('0x5'));var fs=require('fs');var path=require(_0x715f('0x6'));var rimraf=require('rimraf');var config=require(_0x715f('0x7'));var attributes=require(_0x715f('0x8'));module['exports']=function(_0x454881,_0x442c53){return _0x454881[_0x715f('0x9')](_0x715f('0xa'),attributes,{'tableName':_0x715f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fea=['./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x42075c,_0xd4329f){var _0x45eaa1=function(_0x2ed6c4){while(--_0x2ed6c4){_0x42075c['push'](_0x42075c['shift']());}};_0x45eaa1(++_0xd4329f);}(_0x3fea,0x164));var _0xa3fe=function(_0x82f9d6,_0x374fce){_0x82f9d6=_0x82f9d6-0x0;var _0x541c27=_0x3fea[_0x82f9d6];return _0x541c27;};'use strict';var _=require('lodash');var util=require(_0xa3fe('0x0'));var logger=require(_0xa3fe('0x1'))('api');var moment=require(_0xa3fe('0x2'));var BPromise=require(_0xa3fe('0x3'));var rp=require(_0xa3fe('0x4'));var fs=require('fs');var path=require(_0xa3fe('0x5'));var rimraf=require(_0xa3fe('0x6'));var config=require(_0xa3fe('0x7'));var attributes=require(_0xa3fe('0x8'));module[_0xa3fe('0x9')]=function(_0x3e1996,_0x5c2366){return _0x3e1996[_0xa3fe('0xa')](_0xa3fe('0xb'),attributes,{'tableName':_0xa3fe('0xc'),'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 e5f0ad8..d9805a2 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 _0x299f=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','JscriptyProject,\x20%s,\x20%s','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','bluebird','ioredis'];(function(_0x3d9ba7,_0x1c8b5f){var _0x4621ce=function(_0x5e3283){while(--_0x5e3283){_0x3d9ba7['push'](_0x3d9ba7['shift']());}};_0x4621ce(++_0x1c8b5f);}(_0x299f,0xf2));var _0xf299=function(_0x4814c5,_0x17992c){_0x4814c5=_0x4814c5-0x0;var _0x1c5c2e=_0x299f[_0x4814c5];return _0x1c5c2e;};'use strict';var _=require(_0xf299('0x0'));var util=require(_0xf299('0x1'));var moment=require(_0xf299('0x2'));var BPromise=require(_0xf299('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf299('0x4'));var db=require(_0xf299('0x5'))['db'];var utils=require(_0xf299('0x6'));var logger=require(_0xf299('0x7'))('rpc');var config=require(_0xf299('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf299('0x9')][_0xf299('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x491ae7,_0x27cd69,_0x298824){return new BPromise(function(_0x5f4de0,_0x43a341){return client['request'](_0x491ae7,_0x298824)['then'](function(_0x55d3ae){logger['info'](_0xf299('0xb'),_0x27cd69,_0xf299('0xc'));logger['debug'](_0xf299('0xd'),_0x27cd69,'request\x20sent',JSON[_0xf299('0xe')](_0x55d3ae));if(_0x55d3ae[_0xf299('0xf')]){if(_0x55d3ae[_0xf299('0xf')]['code']===0x1f4){logger[_0xf299('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x27cd69,_0x55d3ae[_0xf299('0xf')][_0xf299('0x10')]);return _0x43a341(_0x55d3ae['error'][_0xf299('0x10')]);}logger[_0xf299('0xf')](_0xf299('0xb'),_0x27cd69,_0x55d3ae[_0xf299('0xf')][_0xf299('0x10')]);return _0x5f4de0(_0x55d3ae[_0xf299('0xf')]['message']);}else{logger[_0xf299('0x11')]('JscriptyProject,\x20%s,\x20%s',_0x27cd69,_0xf299('0xc'));_0x5f4de0(_0x55d3ae[_0xf299('0x12')][_0xf299('0x10')]);}})['catch'](function(_0x26d93f){logger[_0xf299('0xf')](_0xf299('0xb'),_0x27cd69,_0x26d93f);_0x43a341(_0x26d93f);});});} \ No newline at end of file +var _0xc7c0=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird','randomstring','ioredis'];(function(_0x242e3f,_0x31b451){var _0x1ba9d9=function(_0x1d9887){while(--_0x1d9887){_0x242e3f['push'](_0x242e3f['shift']());}};_0x1ba9d9(++_0x31b451);}(_0xc7c0,0x10d));var _0x0c7c=function(_0x4a3102,_0x280e04){_0x4a3102=_0x4a3102-0x0;var _0x19fd4d=_0xc7c0[_0x4a3102];return _0x19fd4d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c7c('0x0'));var BPromise=require(_0x0c7c('0x1'));var rs=require(_0x0c7c('0x2'));var fs=require('fs');var Redis=require(_0x0c7c('0x3'));var db=require(_0x0c7c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0c7c('0x5'))(_0x0c7c('0x6'));var config=require(_0x0c7c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0c7c('0x8')][_0x0c7c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3dce89,_0x2e6b8,_0x5bf6bb){return new BPromise(function(_0x1fc0db,_0x58bba9){return client[_0x0c7c('0xa')](_0x3dce89,_0x5bf6bb)[_0x0c7c('0xb')](function(_0x3978b4){logger[_0x0c7c('0xc')](_0x0c7c('0xd'),_0x2e6b8,_0x0c7c('0xe'));logger[_0x0c7c('0xf')](_0x0c7c('0x10'),_0x2e6b8,_0x0c7c('0xe'),JSON[_0x0c7c('0x11')](_0x3978b4));if(_0x3978b4['error']){if(_0x3978b4[_0x0c7c('0x12')][_0x0c7c('0x13')]===0x1f4){logger['error'](_0x0c7c('0xd'),_0x2e6b8,_0x3978b4['error']['message']);return _0x58bba9(_0x3978b4[_0x0c7c('0x12')]['message']);}logger[_0x0c7c('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2e6b8,_0x3978b4['error'][_0x0c7c('0x14')]);return _0x1fc0db(_0x3978b4[_0x0c7c('0x12')][_0x0c7c('0x14')]);}else{logger[_0x0c7c('0xc')](_0x0c7c('0xd'),_0x2e6b8,'request\x20sent');_0x1fc0db(_0x3978b4['result'][_0x0c7c('0x14')]);}})['catch'](function(_0x21a1e6){logger[_0x0c7c('0x12')](_0x0c7c('0xd'),_0x2e6b8,_0x21a1e6);_0x58bba9(_0x21a1e6);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index a605bdb..2455848 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 _0xc792=['./jscriptyQuestionReport.controller','get','/describe','isAuthenticated','describe','show','post','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4bb4cc,_0x51bd82){var _0x28a0aa=function(_0x5813f6){while(--_0x5813f6){_0x4bb4cc['push'](_0x4bb4cc['shift']());}};_0x28a0aa(++_0x51bd82);}(_0xc792,0x1e5));var _0x2c79=function(_0x2c0cc2,_0x2c010b){_0x2c0cc2=_0x2c0cc2-0x0;var _0x135dae=_0xc792[_0x2c0cc2];return _0x135dae;};'use strict';var multer=require(_0x2c79('0x0'));var util=require(_0x2c79('0x1'));var path=require(_0x2c79('0x2'));var timeout=require(_0x2c79('0x3'));var express=require(_0x2c79('0x4'));var router=express[_0x2c79('0x5')]();var fs_extra=require(_0x2c79('0x6'));var auth=require(_0x2c79('0x7'));var interaction=require(_0x2c79('0x8'));var config=require('../../config/environment');var controller=require(_0x2c79('0x9'));router[_0x2c79('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2c79('0xa')](_0x2c79('0xb'),auth[_0x2c79('0xc')](),controller[_0x2c79('0xd')]);router['get']('/:id',auth[_0x2c79('0xc')](),controller[_0x2c79('0xe')]);router[_0x2c79('0xf')]('/',auth[_0x2c79('0xc')](),controller['create']);router['put'](_0x2c79('0x10'),auth[_0x2c79('0xc')](),controller[_0x2c79('0x11')]);router['delete']('/:id',auth[_0x2c79('0xc')](),controller[_0x2c79('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1c2d=['/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe'];(function(_0x570016,_0x111cb9){var _0x3b4176=function(_0x147f5b){while(--_0x147f5b){_0x570016['push'](_0x570016['shift']());}};_0x3b4176(++_0x111cb9);}(_0x1c2d,0x142));var _0xd1c2=function(_0x205496,_0x11ab53){_0x205496=_0x205496-0x0;var _0x449187=_0x1c2d[_0x205496];return _0x449187;};'use strict';var multer=require(_0xd1c2('0x0'));var util=require(_0xd1c2('0x1'));var path=require(_0xd1c2('0x2'));var timeout=require(_0xd1c2('0x3'));var express=require(_0xd1c2('0x4'));var router=express[_0xd1c2('0x5')]();var fs_extra=require(_0xd1c2('0x6'));var auth=require(_0xd1c2('0x7'));var interaction=require(_0xd1c2('0x8'));var config=require(_0xd1c2('0x9'));var controller=require('./jscriptyQuestionReport.controller');router[_0xd1c2('0xa')]('/',auth[_0xd1c2('0xb')](),controller[_0xd1c2('0xc')]);router[_0xd1c2('0xa')]('/describe',auth[_0xd1c2('0xb')](),controller[_0xd1c2('0xd')]);router['get'](_0xd1c2('0xe'),auth[_0xd1c2('0xb')](),controller[_0xd1c2('0xf')]);router['post']('/',auth[_0xd1c2('0xb')](),controller[_0xd1c2('0x10')]);router[_0xd1c2('0x11')](_0xd1c2('0xe'),auth[_0xd1c2('0xb')](),controller[_0xd1c2('0x12')]);router['delete'](_0xd1c2('0xe'),auth['isAuthenticated'](),controller[_0xd1c2('0x13')]);module[_0xd1c2('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 2f6a8cb..d0b14eb 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 _0x1c9a=['sequelize','TEXT','long','STRING'];(function(_0x1d8211,_0xd0919d){var _0x2e9523=function(_0x584aee){while(--_0x584aee){_0x1d8211['push'](_0x1d8211['shift']());}};_0x2e9523(++_0xd0919d);}(_0x1c9a,0x98));var _0xa1c9=function(_0x458248,_0xda97a5){_0x458248=_0x458248-0x0;var _0x5c091b=_0x1c9a[_0x458248];return _0x5c091b;};'use strict';var Sequelize=require(_0xa1c9('0x0'));module['exports']={'question':{'type':Sequelize[_0xa1c9('0x1')]},'answer':{'type':Sequelize['TEXT'](_0xa1c9('0x2'))},'membername':{'type':Sequelize[_0xa1c9('0x3')]},'projectname':{'type':Sequelize[_0xa1c9('0x3')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xa1c9('0x3')]},'calleridname':{'type':Sequelize[_0xa1c9('0x3')]},'calleridnum':{'type':Sequelize[_0xa1c9('0x3')]},'questionId':{'type':Sequelize[_0xa1c9('0x3')]}}; \ No newline at end of file +var _0x7d25=['long','STRING','exports','TEXT'];(function(_0x56ba26,_0x2ce5f7){var _0x28ed24=function(_0x2e1d03){while(--_0x2e1d03){_0x56ba26['push'](_0x56ba26['shift']());}};_0x28ed24(++_0x2ce5f7);}(_0x7d25,0x8a));var _0x57d2=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x7d25[_0x525c7b];return _0x27b33e;};'use strict';var Sequelize=require('sequelize');module[_0x57d2('0x0')]={'question':{'type':Sequelize[_0x57d2('0x1')]},'answer':{'type':Sequelize[_0x57d2('0x1')](_0x57d2('0x2'))},'membername':{'type':Sequelize[_0x57d2('0x3')]},'projectname':{'type':Sequelize[_0x57d2('0x3')]},'queue':{'type':Sequelize[_0x57d2('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 4630375..ad93019 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 _0x7916=['VIRTUAL','options','includeAll','include','findAll','catch','params','length','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','reject','update','then','end','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type'];(function(_0x181459,_0x59c6fc){var _0x5bc6a2=function(_0x2ae2cf){while(--_0x2ae2cf){_0x181459['push'](_0x181459['shift']());}};_0x5bc6a2(++_0x59c6fc);}(_0x7916,0x128));var _0x6791=function(_0x5eb377,_0x3719ec){_0x5eb377=_0x5eb377-0x0;var _0xc6400f=_0x7916[_0x5eb377];return _0xc6400f;};'use strict';var emlformat=require(_0x6791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6791('0x1'));var jsonpatch=require(_0x6791('0x2'));var rp=require('request-promise');var moment=require(_0x6791('0x3'));var BPromise=require(_0x6791('0x4'));var Mustache=require(_0x6791('0x5'));var util=require(_0x6791('0x6'));var path=require('path');var sox=require(_0x6791('0x7'));var csv=require('to-csv');var ejs=require(_0x6791('0x8'));var fs=require('fs');var fs_extra=require(_0x6791('0x9'));var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6791('0x11'))(_0x6791('0x12'));var utils=require(_0x6791('0x13'));var config=require(_0x6791('0x14'));var licenseUtil=require(_0x6791('0x15'));var db=require(_0x6791('0x16'))['db'];function respondWithStatusCode(_0x61ac73,_0x16c62b){_0x16c62b=_0x16c62b||0xcc;return function(_0x423e22){if(_0x423e22){return _0x61ac73[_0x6791('0x17')](_0x16c62b);}return _0x61ac73[_0x6791('0x18')](_0x16c62b)['end']();};}function respondWithResult(_0x4b1719,_0x34b28d){_0x34b28d=_0x34b28d||0xc8;return function(_0x5122f9){if(_0x5122f9){return _0x4b1719[_0x6791('0x18')](_0x34b28d)['json'](_0x5122f9);}};}function respondWithFilteredResult(_0x3be9f0,_0x163898){return function(_0x517910){if(_0x517910){var _0x3e4792=typeof _0x163898['offset']===_0x6791('0x19')&&typeof _0x163898[_0x6791('0x1a')]==='undefined';var _0xbc35d=_0x517910[_0x6791('0x1b')];var _0x5bec14=_0x3e4792?0x0:_0x163898[_0x6791('0x1c')];var _0x4d8a79=_0x3e4792?_0x517910[_0x6791('0x1b')]:_0x163898[_0x6791('0x1c')]+_0x163898[_0x6791('0x1a')];var _0x3a72ce;if(_0x4d8a79>=_0xbc35d){_0x4d8a79=_0xbc35d;_0x3a72ce=0xc8;}else{_0x3a72ce=0xce;}_0x3be9f0[_0x6791('0x18')](_0x3a72ce);return _0x3be9f0[_0x6791('0x1d')](_0x6791('0x1e'),_0x5bec14+'-'+_0x4d8a79+'/'+_0xbc35d)['json'](_0x517910);}return null;};}function patchUpdates(_0x4a2922){return function(_0x306acb){try{jsonpatch['apply'](_0x306acb,_0x4a2922,!![]);}catch(_0x21ef16){return BPromise[_0x6791('0x1f')](_0x21ef16);}return _0x306acb['save']();};}function saveUpdates(_0x17f200,_0x309610){return function(_0x15b9ab){if(_0x15b9ab){return _0x15b9ab[_0x6791('0x20')](_0x17f200)['then'](function(_0x3e17b3){return _0x3e17b3;});}return null;};}function removeEntity(_0x1b516d,_0x4a8717){return function(_0x53bb44){if(_0x53bb44){return _0x53bb44['destroy']()[_0x6791('0x21')](function(){_0x1b516d['status'](0xcc)[_0x6791('0x22')]();});}};}function handleEntityNotFound(_0x5409f1,_0x54a092){return function(_0x496273){if(!_0x496273){_0x5409f1[_0x6791('0x17')](0x194);}return _0x496273;};}function handleError(_0x23442e,_0xd49b84){_0xd49b84=_0xd49b84||0x1f4;return function(_0x56a74e){logger[_0x6791('0x23')](_0x56a74e[_0x6791('0x24')]);if(_0x56a74e['name']){delete _0x56a74e[_0x6791('0x25')];}_0x23442e['status'](_0xd49b84)[_0x6791('0x26')](_0x56a74e);};}exports['index']=function(_0x4fc5d5,_0x270a1d){var _0x551718={},_0x2f56a2={},_0x34b006={'count':0x0,'rows':[]};var _0x483d6c=_[_0x6791('0x27')](db[_0x6791('0x28')][_0x6791('0x29')],function(_0xd36448){return{'name':_0xd36448['fieldName'],'type':_0xd36448['type'][_0x6791('0x2a')]};});_0x2f56a2['model']=_[_0x6791('0x27')](_0x483d6c,_0x6791('0x25'));_0x2f56a2[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x4fc5d5[_0x6791('0x2b')]);_0x2f56a2[_0x6791('0x2d')]=_[_0x6791('0x2e')](_0x2f56a2[_0x6791('0x2f')],_0x2f56a2[_0x6791('0x2b')]);_0x551718[_0x6791('0x30')]=_['intersection'](_0x2f56a2[_0x6791('0x2f')],qs[_0x6791('0x31')](_0x4fc5d5[_0x6791('0x2b')][_0x6791('0x31')]));_0x551718[_0x6791('0x30')]=_0x551718[_0x6791('0x30')]['length']?_0x551718['attributes']:_0x2f56a2['model'];if(!_0x4fc5d5[_0x6791('0x2b')][_0x6791('0x32')](_0x6791('0x33'))){_0x551718['limit']=qs['limit'](_0x4fc5d5[_0x6791('0x2b')][_0x6791('0x1a')]);_0x551718[_0x6791('0x1c')]=qs[_0x6791('0x1c')](_0x4fc5d5['query'][_0x6791('0x1c')]);}_0x551718[_0x6791('0x34')]=qs[_0x6791('0x35')](_0x4fc5d5['query'][_0x6791('0x35')]);_0x551718['where']=qs['filters'](_[_0x6791('0x36')](_0x4fc5d5[_0x6791('0x2b')],_0x2f56a2['filters']),_0x483d6c);if(_0x4fc5d5[_0x6791('0x2b')][_0x6791('0x37')]){_0x551718[_0x6791('0x38')]=_[_0x6791('0x39')](_0x551718[_0x6791('0x38')],{'$or':_['map'](_0x483d6c,function(_0x1798cf){if(_0x1798cf[_0x6791('0x3a')]!==_0x6791('0x3b')){var _0x53f48d={};_0x53f48d[_0x1798cf[_0x6791('0x25')]]={'$like':'%'+_0x4fc5d5[_0x6791('0x2b')][_0x6791('0x37')]+'%'};return _0x53f48d;}})});}_0x551718=_['merge']({},_0x551718,_0x4fc5d5[_0x6791('0x3c')]);var _0x31f2bb={'where':_0x551718[_0x6791('0x38')]};return db[_0x6791('0x28')]['count'](_0x31f2bb)[_0x6791('0x21')](function(_0x1a4b64){_0x34b006[_0x6791('0x1b')]=_0x1a4b64;if(_0x4fc5d5[_0x6791('0x2b')][_0x6791('0x3d')]){_0x551718[_0x6791('0x3e')]=[{'all':!![]}];}return db[_0x6791('0x28')][_0x6791('0x3f')](_0x551718);})[_0x6791('0x21')](function(_0x4e4004){_0x34b006['rows']=_0x4e4004;return _0x34b006;})[_0x6791('0x21')](respondWithFilteredResult(_0x270a1d,_0x551718))[_0x6791('0x40')](handleError(_0x270a1d,null));};exports['show']=function(_0x39dcb7,_0x1c9913){var _0x1c6803={'raw':!![],'where':{'id':_0x39dcb7[_0x6791('0x41')]['id']}},_0x3edb86={};_0x3edb86[_0x6791('0x2f')]=_[_0x6791('0x2c')](db['JscriptyQuestionReport'][_0x6791('0x29')]);_0x3edb86['query']=_[_0x6791('0x2c')](_0x39dcb7[_0x6791('0x2b')]);_0x3edb86[_0x6791('0x2d')]=_[_0x6791('0x2e')](_0x3edb86['model'],_0x3edb86[_0x6791('0x2b')]);_0x1c6803[_0x6791('0x30')]=_[_0x6791('0x2e')](_0x3edb86[_0x6791('0x2f')],qs[_0x6791('0x31')](_0x39dcb7[_0x6791('0x2b')][_0x6791('0x31')]));_0x1c6803[_0x6791('0x30')]=_0x1c6803['attributes'][_0x6791('0x42')]?_0x1c6803[_0x6791('0x30')]:_0x3edb86[_0x6791('0x2f')];if(_0x39dcb7[_0x6791('0x2b')]['includeAll']){_0x1c6803[_0x6791('0x3e')]=[{'all':!![]}];}_0x1c6803=_[_0x6791('0x39')]({},_0x1c6803,_0x39dcb7['options']);return db[_0x6791('0x28')]['find'](_0x1c6803)[_0x6791('0x21')](handleEntityNotFound(_0x1c9913,null))[_0x6791('0x21')](respondWithResult(_0x1c9913,null))[_0x6791('0x40')](handleError(_0x1c9913,null));};exports[_0x6791('0x43')]=function(_0x18d405,_0xb2a2){return db[_0x6791('0x28')][_0x6791('0x43')](_0x18d405[_0x6791('0x44')],{})['then'](respondWithResult(_0xb2a2,0xc9))[_0x6791('0x40')](handleError(_0xb2a2,null));};exports['update']=function(_0x10e806,_0x2bb86a){if(_0x10e806[_0x6791('0x44')]['id']){delete _0x10e806[_0x6791('0x44')]['id'];}return db[_0x6791('0x28')]['find']({'where':{'id':_0x10e806[_0x6791('0x41')]['id']}})[_0x6791('0x21')](handleEntityNotFound(_0x2bb86a,null))[_0x6791('0x21')](saveUpdates(_0x10e806[_0x6791('0x44')],null))[_0x6791('0x21')](respondWithResult(_0x2bb86a,null))['catch'](handleError(_0x2bb86a,null));};exports[_0x6791('0x45')]=function(_0x42948b,_0x4ff9f4){return db[_0x6791('0x28')]['find']({'where':{'id':_0x42948b[_0x6791('0x41')]['id']}})[_0x6791('0x21')](handleEntityNotFound(_0x4ff9f4,null))[_0x6791('0x21')](removeEntity(_0x4ff9f4,null))[_0x6791('0x40')](handleError(_0x4ff9f4,null));};exports['describe']=function(_0x1b838f,_0x243faf){return db['JscriptyQuestionReport'][_0x6791('0x46')]()[_0x6791('0x21')](respondWithResult(_0x243faf,null))[_0x6791('0x40')](handleError(_0x243faf,null));}; \ No newline at end of file +var _0xa571=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','save','update','then','destroy','end','error','name','index','map','JscriptyQuestionReport','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','show','params','rawAttributes','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x36fa16,_0x416a6d){var _0x548bec=function(_0x331e7a){while(--_0x331e7a){_0x36fa16['push'](_0x36fa16['shift']());}};_0x548bec(++_0x416a6d);}(_0xa571,0x107));var _0x1a57=function(_0x4f2654,_0xddb1ad){_0x4f2654=_0x4f2654-0x0;var _0x3858b6=_0xa571[_0x4f2654];return _0x3858b6;};'use strict';var emlformat=require(_0x1a57('0x0'));var rimraf=require(_0x1a57('0x1'));var zipdir=require(_0x1a57('0x2'));var jsonpatch=require(_0x1a57('0x3'));var rp=require('request-promise');var moment=require(_0x1a57('0x4'));var BPromise=require(_0x1a57('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1a57('0x6'));var sox=require('sox');var csv=require(_0x1a57('0x7'));var ejs=require(_0x1a57('0x8'));var fs=require('fs');var fs_extra=require(_0x1a57('0x9'));var _=require(_0x1a57('0xa'));var squel=require(_0x1a57('0xb'));var crypto=require(_0x1a57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1a57('0xd'));var toCsv=require(_0x1a57('0x7'));var querystring=require(_0x1a57('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a57('0xf'));var authService=require(_0x1a57('0x10'));var qs=require(_0x1a57('0x11'));var as=require(_0x1a57('0x12'));var hardwareService=require(_0x1a57('0x13'));var logger=require(_0x1a57('0x14'))(_0x1a57('0x15'));var utils=require(_0x1a57('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a57('0x17'))['db'];function respondWithStatusCode(_0x1911b2,_0x202d9a){_0x202d9a=_0x202d9a||0xcc;return function(_0x5ae643){if(_0x5ae643){return _0x1911b2[_0x1a57('0x18')](_0x202d9a);}return _0x1911b2[_0x1a57('0x19')](_0x202d9a)['end']();};}function respondWithResult(_0x503278,_0x587422){_0x587422=_0x587422||0xc8;return function(_0xd08107){if(_0xd08107){return _0x503278[_0x1a57('0x19')](_0x587422)[_0x1a57('0x1a')](_0xd08107);}};}function respondWithFilteredResult(_0x153d01,_0x5802d6){return function(_0x20f7ad){if(_0x20f7ad){var _0x53c61f=typeof _0x5802d6['offset']===_0x1a57('0x1b')&&typeof _0x5802d6[_0x1a57('0x1c')]===_0x1a57('0x1b');var _0x51b4c2=_0x20f7ad[_0x1a57('0x1d')];var _0x1662a3=_0x53c61f?0x0:_0x5802d6[_0x1a57('0x1e')];var _0x53bb20=_0x53c61f?_0x20f7ad[_0x1a57('0x1d')]:_0x5802d6[_0x1a57('0x1e')]+_0x5802d6[_0x1a57('0x1c')];var _0xcba6b7;if(_0x53bb20>=_0x51b4c2){_0x53bb20=_0x51b4c2;_0xcba6b7=0xc8;}else{_0xcba6b7=0xce;}_0x153d01[_0x1a57('0x19')](_0xcba6b7);return _0x153d01['set']('Content-Range',_0x1662a3+'-'+_0x53bb20+'/'+_0x51b4c2)[_0x1a57('0x1a')](_0x20f7ad);}return null;};}function patchUpdates(_0x21e811){return function(_0x211c63){try{jsonpatch['apply'](_0x211c63,_0x21e811,!![]);}catch(_0x5c200e){return BPromise['reject'](_0x5c200e);}return _0x211c63[_0x1a57('0x1f')]();};}function saveUpdates(_0x113ad4,_0x3f52b9){return function(_0xee133b){if(_0xee133b){return _0xee133b[_0x1a57('0x20')](_0x113ad4)[_0x1a57('0x21')](function(_0x2efa49){return _0x2efa49;});}return null;};}function removeEntity(_0x2f8b00,_0x183ca3){return function(_0x35d5dc){if(_0x35d5dc){return _0x35d5dc[_0x1a57('0x22')]()[_0x1a57('0x21')](function(){_0x2f8b00[_0x1a57('0x19')](0xcc)[_0x1a57('0x23')]();});}};}function handleEntityNotFound(_0x2f9454,_0x182649){return function(_0x25c1e9){if(!_0x25c1e9){_0x2f9454[_0x1a57('0x18')](0x194);}return _0x25c1e9;};}function handleError(_0x27cfe1,_0xf6ffef){_0xf6ffef=_0xf6ffef||0x1f4;return function(_0x26584b){logger[_0x1a57('0x24')](_0x26584b['stack']);if(_0x26584b['name']){delete _0x26584b[_0x1a57('0x25')];}_0x27cfe1[_0x1a57('0x19')](_0xf6ffef)['send'](_0x26584b);};}exports[_0x1a57('0x26')]=function(_0x54f6a5,_0x2d8738){var _0x4a2901={},_0x53bf6e={},_0x8179a4={'count':0x0,'rows':[]};var _0x274fe6=_[_0x1a57('0x27')](db[_0x1a57('0x28')]['rawAttributes'],function(_0x366d5f){return{'name':_0x366d5f[_0x1a57('0x29')],'type':_0x366d5f[_0x1a57('0x2a')][_0x1a57('0x2b')]};});_0x53bf6e['model']=_[_0x1a57('0x27')](_0x274fe6,_0x1a57('0x25'));_0x53bf6e[_0x1a57('0x2c')]=_[_0x1a57('0x2d')](_0x54f6a5[_0x1a57('0x2c')]);_0x53bf6e[_0x1a57('0x2e')]=_[_0x1a57('0x2f')](_0x53bf6e[_0x1a57('0x30')],_0x53bf6e[_0x1a57('0x2c')]);_0x4a2901['attributes']=_[_0x1a57('0x2f')](_0x53bf6e[_0x1a57('0x30')],qs['fields'](_0x54f6a5['query'][_0x1a57('0x31')]));_0x4a2901[_0x1a57('0x32')]=_0x4a2901[_0x1a57('0x32')][_0x1a57('0x33')]?_0x4a2901[_0x1a57('0x32')]:_0x53bf6e[_0x1a57('0x30')];if(!_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x34')](_0x1a57('0x35'))){_0x4a2901[_0x1a57('0x1c')]=qs[_0x1a57('0x1c')](_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x1c')]);_0x4a2901[_0x1a57('0x1e')]=qs[_0x1a57('0x1e')](_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x1e')]);}_0x4a2901[_0x1a57('0x36')]=qs['sort'](_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x37')]);_0x4a2901[_0x1a57('0x38')]=qs[_0x1a57('0x2e')](_[_0x1a57('0x39')](_0x54f6a5[_0x1a57('0x2c')],_0x53bf6e[_0x1a57('0x2e')]),_0x274fe6);if(_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x3a')]){_0x4a2901['where']=_['merge'](_0x4a2901['where'],{'$or':_['map'](_0x274fe6,function(_0x333b32){if(_0x333b32[_0x1a57('0x2a')]!==_0x1a57('0x3b')){var _0x4d6e1e={};_0x4d6e1e[_0x333b32[_0x1a57('0x25')]]={'$like':'%'+_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x3a')]+'%'};return _0x4d6e1e;}})});}_0x4a2901=_[_0x1a57('0x3c')]({},_0x4a2901,_0x54f6a5['options']);var _0x1be254={'where':_0x4a2901['where']};return db[_0x1a57('0x28')][_0x1a57('0x1d')](_0x1be254)[_0x1a57('0x21')](function(_0x534a9a){_0x8179a4[_0x1a57('0x1d')]=_0x534a9a;if(_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x3d')]){_0x4a2901[_0x1a57('0x3e')]=[{'all':!![]}];}return db[_0x1a57('0x28')]['findAll'](_0x4a2901);})[_0x1a57('0x21')](function(_0x47e998){_0x8179a4['rows']=_0x47e998;return _0x8179a4;})[_0x1a57('0x21')](respondWithFilteredResult(_0x2d8738,_0x4a2901))['catch'](handleError(_0x2d8738,null));};exports[_0x1a57('0x3f')]=function(_0x398c59,_0x3fbae1){var _0x59abb1={'raw':!![],'where':{'id':_0x398c59[_0x1a57('0x40')]['id']}},_0x188a50={};_0x188a50[_0x1a57('0x30')]=_[_0x1a57('0x2d')](db['JscriptyQuestionReport'][_0x1a57('0x41')]);_0x188a50[_0x1a57('0x2c')]=_['keys'](_0x398c59[_0x1a57('0x2c')]);_0x188a50['filters']=_['intersection'](_0x188a50[_0x1a57('0x30')],_0x188a50[_0x1a57('0x2c')]);_0x59abb1[_0x1a57('0x32')]=_[_0x1a57('0x2f')](_0x188a50['model'],qs[_0x1a57('0x31')](_0x398c59[_0x1a57('0x2c')][_0x1a57('0x31')]));_0x59abb1[_0x1a57('0x32')]=_0x59abb1[_0x1a57('0x32')]['length']?_0x59abb1[_0x1a57('0x32')]:_0x188a50[_0x1a57('0x30')];if(_0x398c59[_0x1a57('0x2c')][_0x1a57('0x3d')]){_0x59abb1['include']=[{'all':!![]}];}_0x59abb1=_[_0x1a57('0x3c')]({},_0x59abb1,_0x398c59['options']);return db[_0x1a57('0x28')][_0x1a57('0x42')](_0x59abb1)[_0x1a57('0x21')](handleEntityNotFound(_0x3fbae1,null))[_0x1a57('0x21')](respondWithResult(_0x3fbae1,null))[_0x1a57('0x43')](handleError(_0x3fbae1,null));};exports[_0x1a57('0x44')]=function(_0x28f629,_0x401285){return db[_0x1a57('0x28')][_0x1a57('0x44')](_0x28f629[_0x1a57('0x45')],{})[_0x1a57('0x21')](respondWithResult(_0x401285,0xc9))[_0x1a57('0x43')](handleError(_0x401285,null));};exports['update']=function(_0xf4d056,_0x480aff){if(_0xf4d056[_0x1a57('0x45')]['id']){delete _0xf4d056[_0x1a57('0x45')]['id'];}return db[_0x1a57('0x28')][_0x1a57('0x42')]({'where':{'id':_0xf4d056[_0x1a57('0x40')]['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x480aff,null))[_0x1a57('0x21')](saveUpdates(_0xf4d056[_0x1a57('0x45')],null))[_0x1a57('0x21')](respondWithResult(_0x480aff,null))['catch'](handleError(_0x480aff,null));};exports[_0x1a57('0x22')]=function(_0x439a42,_0x51651d){return db[_0x1a57('0x28')][_0x1a57('0x42')]({'where':{'id':_0x439a42['params']['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x51651d,null))[_0x1a57('0x21')](removeEntity(_0x51651d,null))['catch'](handleError(_0x51651d,null));};exports['describe']=function(_0x5b0563,_0x2c1bac){return db[_0x1a57('0x28')]['describe']()[_0x1a57('0x21')](respondWithResult(_0x2c1bac,null))[_0x1a57('0x43')](handleError(_0x2c1bac,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index d7c9788..143fd85 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 _0xe3fa=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x52fc85,_0x963a91){var _0x18c3d9=function(_0x2d65c4){while(--_0x2d65c4){_0x52fc85['push'](_0x52fc85['shift']());}};_0x18c3d9(++_0x963a91);}(_0xe3fa,0xa5));var _0xae3f=function(_0x26d26f,_0x302cce){_0x26d26f=_0x26d26f-0x0;var _0x5c8c0e=_0xe3fa[_0x26d26f];return _0x5c8c0e;};'use strict';var _=require(_0xae3f('0x0'));var util=require(_0xae3f('0x1'));var logger=require(_0xae3f('0x2'))('api');var moment=require(_0xae3f('0x3'));var BPromise=require(_0xae3f('0x4'));var rp=require(_0xae3f('0x5'));var fs=require('fs');var path=require(_0xae3f('0x6'));var rimraf=require(_0xae3f('0x7'));var config=require(_0xae3f('0x8'));var attributes=require(_0xae3f('0x9'));module[_0xae3f('0xa')]=function(_0x2b6133,_0x30efd1){return _0x2b6133[_0xae3f('0xb')](_0xae3f('0xc'),attributes,{'tableName':_0xae3f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ddc=['moment','request-promise','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','lodash','../../config/logger','api'];(function(_0x5c5310,_0x3ab51c){var _0x32da9d=function(_0x399bbf){while(--_0x399bbf){_0x5c5310['push'](_0x5c5310['shift']());}};_0x32da9d(++_0x3ab51c);}(_0x2ddc,0x185));var _0xc2dd=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x2ddc[_0x2aea9e];return _0x430b92;};'use strict';var _=require(_0xc2dd('0x0'));var util=require('util');var logger=require(_0xc2dd('0x1'))(_0xc2dd('0x2'));var moment=require(_0xc2dd('0x3'));var BPromise=require('bluebird');var rp=require(_0xc2dd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc2dd('0x5'));module['exports']=function(_0x4778d7,_0x1a1d04){return _0x4778d7[_0xc2dd('0x6')](_0xc2dd('0x7'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index df83916..4a7f337 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 _0xe3a3=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x13cdd2,_0x3ed1d1){var _0x202e17=function(_0x5b0346){while(--_0x5b0346){_0x13cdd2['push'](_0x13cdd2['shift']());}};_0x202e17(++_0x3ed1d1);}(_0xe3a3,0x162));var _0x3e3a=function(_0x1a017b,_0x1875d7){_0x1a017b=_0x1a017b-0x0;var _0x506017=_0xe3a3[_0x1a017b];return _0x506017;};'use strict';var _=require(_0x3e3a('0x0'));var util=require(_0x3e3a('0x1'));var moment=require(_0x3e3a('0x2'));var BPromise=require(_0x3e3a('0x3'));var rs=require(_0x3e3a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e3a('0x5'))['db'];var utils=require(_0x3e3a('0x6'));var logger=require(_0x3e3a('0x7'))(_0x3e3a('0x8'));var config=require(_0x3e3a('0x9'));var jayson=require(_0x3e3a('0xa'));var client=jayson[_0x3e3a('0xb')][_0x3e3a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x180de5,_0x23ff88,_0x743077){return new BPromise(function(_0x5f2472,_0x99f776){return client['request'](_0x180de5,_0x743077)[_0x3e3a('0xd')](function(_0x288a06){logger[_0x3e3a('0xe')](_0x3e3a('0xf'),_0x23ff88,'request\x20sent');logger[_0x3e3a('0x10')](_0x3e3a('0x11'),_0x23ff88,_0x3e3a('0x12'),JSON[_0x3e3a('0x13')](_0x288a06));if(_0x288a06[_0x3e3a('0x14')]){if(_0x288a06['error'][_0x3e3a('0x15')]===0x1f4){logger[_0x3e3a('0x14')](_0x3e3a('0xf'),_0x23ff88,_0x288a06[_0x3e3a('0x14')][_0x3e3a('0x16')]);return _0x99f776(_0x288a06[_0x3e3a('0x14')]['message']);}logger[_0x3e3a('0x14')](_0x3e3a('0xf'),_0x23ff88,_0x288a06['error'][_0x3e3a('0x16')]);return _0x5f2472(_0x288a06[_0x3e3a('0x14')][_0x3e3a('0x16')]);}else{logger[_0x3e3a('0xe')](_0x3e3a('0xf'),_0x23ff88,_0x3e3a('0x12'));_0x5f2472(_0x288a06[_0x3e3a('0x17')][_0x3e3a('0x16')]);}})[_0x3e3a('0x18')](function(_0xb10794){logger['error'](_0x3e3a('0xf'),_0x23ff88,_0xb10794);_0x99f776(_0xb10794);});});} \ No newline at end of file +var _0x071a=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','JscriptyQuestionReport,\x20%s,\x20%s','message','error','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x3ffb80,_0x209661){var _0x3a8a4c=function(_0x24b3e2){while(--_0x24b3e2){_0x3ffb80['push'](_0x3ffb80['shift']());}};_0x3a8a4c(++_0x209661);}(_0x071a,0x165));var _0xa071=function(_0x439534,_0x4ff786){_0x439534=_0x439534-0x0;var _0x211660=_0x071a[_0x439534];return _0x211660;};'use strict';var _=require(_0xa071('0x0'));var util=require(_0xa071('0x1'));var moment=require(_0xa071('0x2'));var BPromise=require(_0xa071('0x3'));var rs=require(_0xa071('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa071('0x5'))['db'];var utils=require(_0xa071('0x6'));var logger=require(_0xa071('0x7'))(_0xa071('0x8'));var config=require('../../config/environment');var jayson=require(_0xa071('0x9'));var client=jayson[_0xa071('0xa')][_0xa071('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42b022,_0x46a3c1,_0xcd6c20){return new BPromise(function(_0x14fb0d,_0x2a98f6){return client[_0xa071('0xc')](_0x42b022,_0xcd6c20)[_0xa071('0xd')](function(_0x3b8593){logger[_0xa071('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x46a3c1,_0xa071('0xf'));logger[_0xa071('0x10')](_0xa071('0x11'),_0x46a3c1,'request\x20sent',JSON['stringify'](_0x3b8593));if(_0x3b8593['error']){if(_0x3b8593['error']['code']===0x1f4){logger['error'](_0xa071('0x12'),_0x46a3c1,_0x3b8593['error'][_0xa071('0x13')]);return _0x2a98f6(_0x3b8593[_0xa071('0x14')][_0xa071('0x13')]);}logger[_0xa071('0x14')](_0xa071('0x12'),_0x46a3c1,_0x3b8593['error'][_0xa071('0x13')]);return _0x14fb0d(_0x3b8593[_0xa071('0x14')]['message']);}else{logger['info'](_0xa071('0x12'),_0x46a3c1,'request\x20sent');_0x14fb0d(_0x3b8593['result'][_0xa071('0x13')]);}})[_0xa071('0x15')](function(_0xa7dd42){logger[_0xa071('0x14')](_0xa071('0x12'),_0x46a3c1,_0xa7dd42);_0x2a98f6(_0xa7dd42);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 50194ca..939b489 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 _0xe2fe=['describe','/:id','/:id/questions','create','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x3d77ac,_0x1feb3d){var _0x535f82=function(_0x2b5df3){while(--_0x2b5df3){_0x3d77ac['push'](_0x3d77ac['shift']());}};_0x535f82(++_0x1feb3d);}(_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 fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./jscriptySessionReport.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0x7')](_0xee2f('0xc'),auth['isAuthenticated'](),controller['getQuestions']);router['post']('/',auth['isAuthenticated'](),controller[_0xee2f('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xe')]);router[_0xee2f('0xf')](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x10')]);module[_0xee2f('0x11')]=router; \ No newline at end of file +var _0x5fab=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','getQuestions','post','create','put','update'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x5fab,0x177));var _0xb5fa=function(_0x2ce5e3,_0x429426){_0x2ce5e3=_0x2ce5e3-0x0;var _0xe1e73c=_0x5fab[_0x2ce5e3];return _0xe1e73c;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['get']('/:id/questions',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')]('/',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);router['delete'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller['destroy']);module[_0xb5fa('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index c5bc5a6..0e6c496 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 _0xc841=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','DATE','setDataValue','starttime'];(function(_0x2c5398,_0x294d15){var _0x39be21=function(_0x1758ab){while(--_0x1758ab){_0x2c5398['push'](_0x2c5398['shift']());}};_0x39be21(++_0x294d15);}(_0xc841,0x13f));var _0x1c84=function(_0x5e5bcf,_0x43fe4f){_0x5e5bcf=_0x5e5bcf-0x0;var _0x540b64=_0xc841[_0x5e5bcf];return _0x540b64;};'use strict';var moment=require(_0x1c84('0x0'));var Sequelize=require(_0x1c84('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x1c84('0x2')],'set':function(_0x5c5ef0){this[_0x1c84('0x3')](_0x1c84('0x4'),_0x5c5ef0);this[_0x1c84('0x3')](_0x1c84('0x5'),moment()[_0x1c84('0x6')](_0x1c84('0x7')));}},'endtime':{'type':Sequelize[_0x1c84('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x1c84('0x8')]},'queue':{'type':Sequelize[_0x1c84('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1c84('0x8')]},'calleridnum':{'type':Sequelize[_0x1c84('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6dcd=['setDataValue','starttime','endtime','format','STRING','moment','sequelize','DATE'];(function(_0x3c8d1c,_0x293734){var _0x9ad1e3=function(_0x332058){while(--_0x332058){_0x3c8d1c['push'](_0x3c8d1c['shift']());}};_0x9ad1e3(++_0x293734);}(_0x6dcd,0x7d));var _0xd6dc=function(_0x6e79bf,_0x52f2ba){_0x6e79bf=_0x6e79bf-0x0;var _0x5b0e31=_0x6dcd[_0x6e79bf];return _0x5b0e31;};'use strict';var moment=require(_0xd6dc('0x0'));var Sequelize=require(_0xd6dc('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xd6dc('0x2')],'set':function(_0x224100){this[_0xd6dc('0x3')](_0xd6dc('0x4'),_0x224100);this[_0xd6dc('0x3')](_0xd6dc('0x5'),moment()[_0xd6dc('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xd6dc('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xd6dc('0x7')]},'uniqueid':{'type':Sequelize[_0xd6dc('0x7')]},'calleridname':{'type':Sequelize[_0xd6dc('0x7')]},'calleridnum':{'type':Sequelize[_0xd6dc('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 27ad415..70fc458 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 _0x5ded=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','map','rawAttributes','key','keys','model','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','type','VIRTUAL','options','JscriptySessionReport','include','findAll','rows','catch','show','includeAll','find','create','body','params','destroy','describe','getQuestions','findOne','where','SessionId','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce'];(function(_0x133d15,_0x5aee04){var _0x5a8ebc=function(_0x1f93a6){while(--_0x1f93a6){_0x133d15['push'](_0x133d15['shift']());}};_0x5a8ebc(++_0x5aee04);}(_0x5ded,0x146));var _0xd5de=function(_0x533a97,_0x475a73){_0x533a97=_0x533a97-0x0;var _0x5a01f8=_0x5ded[_0x533a97];return _0x5a01f8;};'use strict';var emlformat=require(_0xd5de('0x0'));var rimraf=require(_0xd5de('0x1'));var zipdir=require(_0xd5de('0x2'));var jsonpatch=require(_0xd5de('0x3'));var rp=require(_0xd5de('0x4'));var moment=require(_0xd5de('0x5'));var BPromise=require(_0xd5de('0x6'));var Mustache=require('mustache');var util=require(_0xd5de('0x7'));var path=require('path');var sox=require(_0xd5de('0x8'));var csv=require('to-csv');var ejs=require(_0xd5de('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5de('0xa'));var squel=require(_0xd5de('0xb'));var crypto=require(_0xd5de('0xc'));var jsforce=require(_0xd5de('0xd'));var deskjs=require(_0xd5de('0xe'));var toCsv=require(_0xd5de('0xf'));var querystring=require(_0xd5de('0x10'));var Papa=require(_0xd5de('0x11'));var Redis=require(_0xd5de('0x12'));var authService=require(_0xd5de('0x13'));var qs=require(_0xd5de('0x14'));var as=require(_0xd5de('0x15'));var hardwareService=require(_0xd5de('0x16'));var logger=require(_0xd5de('0x17'))(_0xd5de('0x18'));var utils=require(_0xd5de('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xd5de('0x1a'));var db=require(_0xd5de('0x1b'))['db'];function respondWithStatusCode(_0x48789f,_0x49fd3b){_0x49fd3b=_0x49fd3b||0xcc;return function(_0x1bfed1){if(_0x1bfed1){return _0x48789f[_0xd5de('0x1c')](_0x49fd3b);}return _0x48789f[_0xd5de('0x1d')](_0x49fd3b)[_0xd5de('0x1e')]();};}function respondWithResult(_0x313765,_0x49f07d){_0x49f07d=_0x49f07d||0xc8;return function(_0x3aa356){if(_0x3aa356){return _0x313765['status'](_0x49f07d)['json'](_0x3aa356);}};}function respondWithFilteredResult(_0x1e9f7b,_0x10df6a){return function(_0x577b99){if(_0x577b99){var _0x59ccbc=typeof _0x10df6a['offset']===_0xd5de('0x1f')&&typeof _0x10df6a[_0xd5de('0x20')]===_0xd5de('0x1f');var _0x3c6efc=_0x577b99[_0xd5de('0x21')];var _0x13ef92=_0x59ccbc?0x0:_0x10df6a[_0xd5de('0x22')];var _0x4197f4=_0x59ccbc?_0x577b99['count']:_0x10df6a['offset']+_0x10df6a[_0xd5de('0x20')];var _0x2356f0;if(_0x4197f4>=_0x3c6efc){_0x4197f4=_0x3c6efc;_0x2356f0=0xc8;}else{_0x2356f0=0xce;}_0x1e9f7b[_0xd5de('0x1d')](_0x2356f0);return _0x1e9f7b[_0xd5de('0x23')](_0xd5de('0x24'),_0x13ef92+'-'+_0x4197f4+'/'+_0x3c6efc)[_0xd5de('0x25')](_0x577b99);}return null;};}function patchUpdates(_0xe01b28){return function(_0xbb2700){try{jsonpatch[_0xd5de('0x26')](_0xbb2700,_0xe01b28,!![]);}catch(_0x487d14){return BPromise[_0xd5de('0x27')](_0x487d14);}return _0xbb2700['save']();};}function saveUpdates(_0x3636ba,_0x276adf){return function(_0x38cb68){if(_0x38cb68){return _0x38cb68[_0xd5de('0x28')](_0x3636ba)['then'](function(_0x470cf2){return _0x470cf2;});}return null;};}function removeEntity(_0x1b7b70,_0x2735a0){return function(_0x2b2291){if(_0x2b2291){return _0x2b2291['destroy']()[_0xd5de('0x29')](function(){_0x1b7b70[_0xd5de('0x1d')](0xcc)[_0xd5de('0x1e')]();});}};}function handleEntityNotFound(_0x1ae68f,_0x3c60a0){return function(_0x1ad195){if(!_0x1ad195){_0x1ae68f[_0xd5de('0x1c')](0x194);}return _0x1ad195;};}function handleError(_0x1aad03,_0x464e89){_0x464e89=_0x464e89||0x1f4;return function(_0x2d5980){logger[_0xd5de('0x2a')](_0x2d5980[_0xd5de('0x2b')]);if(_0x2d5980[_0xd5de('0x2c')]){delete _0x2d5980[_0xd5de('0x2c')];}_0x1aad03['status'](_0x464e89)[_0xd5de('0x2d')](_0x2d5980);};}exports['index']=function(_0x218901,_0x299944){var _0x1b7562={},_0x426e51={},_0x33142e={'count':0x0,'rows':[]};var _0x1e2f01=_[_0xd5de('0x2e')](db['JscriptySessionReport'][_0xd5de('0x2f')],function(_0x453fbe){return{'name':_0x453fbe['fieldName'],'type':_0x453fbe['type'][_0xd5de('0x30')]};});_0x426e51['model']=_[_0xd5de('0x2e')](_0x1e2f01,_0xd5de('0x2c'));_0x426e51['query']=_[_0xd5de('0x31')](_0x218901['query']);_0x426e51['filters']=_['intersection'](_0x426e51[_0xd5de('0x32')],_0x426e51['query']);_0x1b7562[_0xd5de('0x33')]=_[_0xd5de('0x34')](_0x426e51[_0xd5de('0x32')],qs[_0xd5de('0x35')](_0x218901[_0xd5de('0x36')][_0xd5de('0x35')]));_0x1b7562['attributes']=_0x1b7562[_0xd5de('0x33')][_0xd5de('0x37')]?_0x1b7562['attributes']:_0x426e51[_0xd5de('0x32')];if(!_0x218901[_0xd5de('0x36')][_0xd5de('0x38')](_0xd5de('0x39'))){_0x1b7562[_0xd5de('0x20')]=qs[_0xd5de('0x20')](_0x218901[_0xd5de('0x36')][_0xd5de('0x20')]);_0x1b7562[_0xd5de('0x22')]=qs[_0xd5de('0x22')](_0x218901[_0xd5de('0x36')][_0xd5de('0x22')]);}_0x1b7562[_0xd5de('0x3a')]=qs[_0xd5de('0x3b')](_0x218901[_0xd5de('0x36')]['sort']);_0x1b7562['where']=qs[_0xd5de('0x3c')](_[_0xd5de('0x3d')](_0x218901[_0xd5de('0x36')],_0x426e51['filters']),_0x1e2f01);if(_0x218901[_0xd5de('0x36')][_0xd5de('0x3e')]){_0x1b7562['where']=_[_0xd5de('0x3f')](_0x1b7562['where'],{'$or':_[_0xd5de('0x2e')](_0x1e2f01,function(_0x49c043){if(_0x49c043[_0xd5de('0x40')]!==_0xd5de('0x41')){var _0x500cd7={};_0x500cd7[_0x49c043[_0xd5de('0x2c')]]={'$like':'%'+_0x218901['query'][_0xd5de('0x3e')]+'%'};return _0x500cd7;}})});}_0x1b7562=_['merge']({},_0x1b7562,_0x218901[_0xd5de('0x42')]);var _0x2f814b={'where':_0x1b7562['where']};return db[_0xd5de('0x43')][_0xd5de('0x21')](_0x2f814b)[_0xd5de('0x29')](function(_0x1b9237){_0x33142e[_0xd5de('0x21')]=_0x1b9237;if(_0x218901[_0xd5de('0x36')]['includeAll']){_0x1b7562[_0xd5de('0x44')]=[{'all':!![]}];}return db[_0xd5de('0x43')][_0xd5de('0x45')](_0x1b7562);})[_0xd5de('0x29')](function(_0x364df4){_0x33142e[_0xd5de('0x46')]=_0x364df4;return _0x33142e;})[_0xd5de('0x29')](respondWithFilteredResult(_0x299944,_0x1b7562))[_0xd5de('0x47')](handleError(_0x299944,null));};exports[_0xd5de('0x48')]=function(_0x4efc27,_0x4e0ceb){var _0x4e9226={'raw':!![],'where':{'id':_0x4efc27['params']['id']}},_0x2b2349={};_0x2b2349[_0xd5de('0x32')]=_[_0xd5de('0x31')](db[_0xd5de('0x43')][_0xd5de('0x2f')]);_0x2b2349[_0xd5de('0x36')]=_[_0xd5de('0x31')](_0x4efc27[_0xd5de('0x36')]);_0x2b2349[_0xd5de('0x3c')]=_[_0xd5de('0x34')](_0x2b2349['model'],_0x2b2349[_0xd5de('0x36')]);_0x4e9226[_0xd5de('0x33')]=_[_0xd5de('0x34')](_0x2b2349[_0xd5de('0x32')],qs[_0xd5de('0x35')](_0x4efc27[_0xd5de('0x36')][_0xd5de('0x35')]));_0x4e9226[_0xd5de('0x33')]=_0x4e9226[_0xd5de('0x33')][_0xd5de('0x37')]?_0x4e9226[_0xd5de('0x33')]:_0x2b2349[_0xd5de('0x32')];if(_0x4efc27[_0xd5de('0x36')][_0xd5de('0x49')]){_0x4e9226['include']=[{'all':!![]}];}_0x4e9226=_[_0xd5de('0x3f')]({},_0x4e9226,_0x4efc27[_0xd5de('0x42')]);return db[_0xd5de('0x43')][_0xd5de('0x4a')](_0x4e9226)['then'](handleEntityNotFound(_0x4e0ceb,null))[_0xd5de('0x29')](respondWithResult(_0x4e0ceb,null))['catch'](handleError(_0x4e0ceb,null));};exports[_0xd5de('0x4b')]=function(_0x598ff2,_0x5c4e67){return db[_0xd5de('0x43')][_0xd5de('0x4b')](_0x598ff2[_0xd5de('0x4c')],{})[_0xd5de('0x29')](respondWithResult(_0x5c4e67,0xc9))[_0xd5de('0x47')](handleError(_0x5c4e67,null));};exports[_0xd5de('0x28')]=function(_0x1465b9,_0x5c2451){if(_0x1465b9[_0xd5de('0x4c')]['id']){delete _0x1465b9[_0xd5de('0x4c')]['id'];}return db['JscriptySessionReport'][_0xd5de('0x4a')]({'where':{'id':_0x1465b9[_0xd5de('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5c2451,null))[_0xd5de('0x29')](saveUpdates(_0x1465b9[_0xd5de('0x4c')],null))[_0xd5de('0x29')](respondWithResult(_0x5c2451,null))[_0xd5de('0x47')](handleError(_0x5c2451,null));};exports[_0xd5de('0x4e')]=function(_0x496f0f,_0x492909){return db[_0xd5de('0x43')][_0xd5de('0x4a')]({'where':{'id':_0x496f0f[_0xd5de('0x4d')]['id']}})[_0xd5de('0x29')](handleEntityNotFound(_0x492909,null))[_0xd5de('0x29')](removeEntity(_0x492909,null))[_0xd5de('0x47')](handleError(_0x492909,null));};exports[_0xd5de('0x4f')]=function(_0x305b91,_0x11e166){return db[_0xd5de('0x43')][_0xd5de('0x4f')]()[_0xd5de('0x29')](respondWithResult(_0x11e166,null))[_0xd5de('0x47')](handleError(_0x11e166,null));};exports[_0xd5de('0x50')]=function(_0x1b0100,_0x43ca4a,_0x428e99){var _0x50276d={'raw':!![],'where':{}};var _0x2778a0={};var _0x546cde={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xd5de('0x51')]({'where':{'id':_0x1b0100[_0xd5de('0x4d')]['id']}})[_0xd5de('0x29')](handleEntityNotFound(_0x43ca4a,null))[_0xd5de('0x29')](function(_0x3846d3){if(_0x3846d3){_0x2778a0['model']=_['keys'](db['JscriptyQuestionReport'][_0xd5de('0x2f')]);_0x2778a0['query']=_[_0xd5de('0x31')](_0x1b0100[_0xd5de('0x36')]);_0x2778a0[_0xd5de('0x3c')]=_[_0xd5de('0x34')](_0x2778a0['model'],_0x2778a0[_0xd5de('0x36')]);_0x50276d[_0xd5de('0x33')]=_[_0xd5de('0x34')](_0x2778a0[_0xd5de('0x32')],qs['fields'](_0x1b0100[_0xd5de('0x36')][_0xd5de('0x35')]));_0x50276d[_0xd5de('0x33')]=_0x50276d[_0xd5de('0x33')][_0xd5de('0x37')]?_0x50276d[_0xd5de('0x33')]:_0x2778a0[_0xd5de('0x32')];if(!_0x1b0100[_0xd5de('0x36')][_0xd5de('0x38')]('nolimit')){_0x50276d[_0xd5de('0x20')]=qs[_0xd5de('0x20')](_0x1b0100[_0xd5de('0x36')][_0xd5de('0x20')]);_0x50276d['offset']=qs[_0xd5de('0x22')](_0x1b0100['query']['offset']);}_0x50276d[_0xd5de('0x3a')]=qs['sort'](_0x1b0100['query'][_0xd5de('0x3b')]);_0x50276d[_0xd5de('0x52')]=qs[_0xd5de('0x3c')](_[_0xd5de('0x3d')](_0x1b0100[_0xd5de('0x36')],_0x2778a0[_0xd5de('0x3c')]));_0x50276d['where'][_0xd5de('0x53')]=_0x3846d3['id'];if(_0x1b0100[_0xd5de('0x36')][_0xd5de('0x3e')]){_0x50276d['where']=_[_0xd5de('0x3f')](_0x50276d['where'],{'$or':_[_0xd5de('0x2e')](_0x50276d[_0xd5de('0x33')],function(_0x46be89){var _0x417181={};_0x417181[_0x46be89]={'$like':'%'+_0x1b0100['query'][_0xd5de('0x3e')]+'%'};return _0x417181;})});}_0x50276d=_[_0xd5de('0x3f')]({},_0x50276d,_0x1b0100[_0xd5de('0x42')]);return db[_0xd5de('0x54')][_0xd5de('0x21')]({'where':_0x50276d[_0xd5de('0x52')]})['then'](function(_0x36c80c){_0x546cde[_0xd5de('0x21')]=_0x36c80c;if(_0x1b0100[_0xd5de('0x36')]['includeAll']){_0x50276d['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xd5de('0x45')](_0x50276d);})[_0xd5de('0x29')](function(_0xc3e5bd){_0x546cde[_0xd5de('0x46')]=_0xc3e5bd;return _0x546cde;});}})[_0xd5de('0x29')](respondWithFilteredResult(_0x43ca4a,_0x50276d))['catch'](handleError(_0x43ca4a,null));}; \ No newline at end of file +var _0x59f3=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','JscriptySessionReport','findAll','rows','catch','show','params','include','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x2a25d9,_0x56192b){var _0x16ec3e=function(_0x3b3a86){while(--_0x3b3a86){_0x2a25d9['push'](_0x2a25d9['shift']());}};_0x16ec3e(++_0x56192b);}(_0x59f3,0x1c3));var _0x359f=function(_0x542d80,_0x150561){_0x542d80=_0x542d80-0x0;var _0x1f4492=_0x59f3[_0x542d80];return _0x1f4492;};'use strict';var emlformat=require(_0x359f('0x0'));var rimraf=require(_0x359f('0x1'));var zipdir=require(_0x359f('0x2'));var jsonpatch=require(_0x359f('0x3'));var rp=require(_0x359f('0x4'));var moment=require(_0x359f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x359f('0x6'));var util=require(_0x359f('0x7'));var path=require(_0x359f('0x8'));var sox=require(_0x359f('0x9'));var csv=require(_0x359f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x359f('0xb'));var squel=require(_0x359f('0xc'));var crypto=require('crypto');var jsforce=require(_0x359f('0xd'));var deskjs=require(_0x359f('0xe'));var toCsv=require(_0x359f('0xa'));var querystring=require(_0x359f('0xf'));var Papa=require(_0x359f('0x10'));var Redis=require(_0x359f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x359f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x359f('0x13'));var logger=require(_0x359f('0x14'))('api');var utils=require(_0x359f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x359f('0x16'));var db=require(_0x359f('0x17'))['db'];function respondWithStatusCode(_0x5e28ea,_0x5c8a86){_0x5c8a86=_0x5c8a86||0xcc;return function(_0x26bdca){if(_0x26bdca){return _0x5e28ea[_0x359f('0x18')](_0x5c8a86);}return _0x5e28ea[_0x359f('0x19')](_0x5c8a86)[_0x359f('0x1a')]();};}function respondWithResult(_0x550a07,_0x5bd21b){_0x5bd21b=_0x5bd21b||0xc8;return function(_0x11ab0d){if(_0x11ab0d){return _0x550a07[_0x359f('0x19')](_0x5bd21b)[_0x359f('0x1b')](_0x11ab0d);}};}function respondWithFilteredResult(_0x2c3bdb,_0x5136e1){return function(_0x3e7c6c){if(_0x3e7c6c){var _0x3af305=typeof _0x5136e1[_0x359f('0x1c')]===_0x359f('0x1d')&&typeof _0x5136e1[_0x359f('0x1e')]===_0x359f('0x1d');var _0x3f3a2f=_0x3e7c6c[_0x359f('0x1f')];var _0xf5609a=_0x3af305?0x0:_0x5136e1[_0x359f('0x1c')];var _0x5bacf9=_0x3af305?_0x3e7c6c[_0x359f('0x1f')]:_0x5136e1[_0x359f('0x1c')]+_0x5136e1[_0x359f('0x1e')];var _0x5064e8;if(_0x5bacf9>=_0x3f3a2f){_0x5bacf9=_0x3f3a2f;_0x5064e8=0xc8;}else{_0x5064e8=0xce;}_0x2c3bdb['status'](_0x5064e8);return _0x2c3bdb[_0x359f('0x20')](_0x359f('0x21'),_0xf5609a+'-'+_0x5bacf9+'/'+_0x3f3a2f)['json'](_0x3e7c6c);}return null;};}function patchUpdates(_0x3df4c6){return function(_0x6cb4ef){try{jsonpatch['apply'](_0x6cb4ef,_0x3df4c6,!![]);}catch(_0x330a0d){return BPromise[_0x359f('0x22')](_0x330a0d);}return _0x6cb4ef['save']();};}function saveUpdates(_0x57bc64,_0x49caed){return function(_0x56bef0){if(_0x56bef0){return _0x56bef0['update'](_0x57bc64)[_0x359f('0x23')](function(_0x3b65f8){return _0x3b65f8;});}return null;};}function removeEntity(_0x22b9dc,_0x3d0371){return function(_0x3e3113){if(_0x3e3113){return _0x3e3113[_0x359f('0x24')]()[_0x359f('0x23')](function(){_0x22b9dc[_0x359f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x128ad2,_0x33a191){return function(_0xc2c134){if(!_0xc2c134){_0x128ad2[_0x359f('0x18')](0x194);}return _0xc2c134;};}function handleError(_0x679451,_0x175279){_0x175279=_0x175279||0x1f4;return function(_0x320e1c){logger[_0x359f('0x25')](_0x320e1c[_0x359f('0x26')]);if(_0x320e1c[_0x359f('0x27')]){delete _0x320e1c[_0x359f('0x27')];}_0x679451[_0x359f('0x19')](_0x175279)['send'](_0x320e1c);};}exports[_0x359f('0x28')]=function(_0x258455,_0x24427d){var _0x3fe8ed={},_0x1052b9={},_0x436d86={'count':0x0,'rows':[]};var _0x4f4b68=_[_0x359f('0x29')](db['JscriptySessionReport'][_0x359f('0x2a')],function(_0x47f8c7){return{'name':_0x47f8c7[_0x359f('0x2b')],'type':_0x47f8c7[_0x359f('0x2c')][_0x359f('0x2d')]};});_0x1052b9[_0x359f('0x2e')]=_[_0x359f('0x29')](_0x4f4b68,_0x359f('0x27'));_0x1052b9['query']=_[_0x359f('0x2f')](_0x258455[_0x359f('0x30')]);_0x1052b9[_0x359f('0x31')]=_[_0x359f('0x32')](_0x1052b9[_0x359f('0x2e')],_0x1052b9[_0x359f('0x30')]);_0x3fe8ed[_0x359f('0x33')]=_[_0x359f('0x32')](_0x1052b9[_0x359f('0x2e')],qs[_0x359f('0x34')](_0x258455[_0x359f('0x30')][_0x359f('0x34')]));_0x3fe8ed[_0x359f('0x33')]=_0x3fe8ed[_0x359f('0x33')][_0x359f('0x35')]?_0x3fe8ed[_0x359f('0x33')]:_0x1052b9[_0x359f('0x2e')];if(!_0x258455[_0x359f('0x30')][_0x359f('0x36')]('nolimit')){_0x3fe8ed[_0x359f('0x1e')]=qs[_0x359f('0x1e')](_0x258455[_0x359f('0x30')]['limit']);_0x3fe8ed[_0x359f('0x1c')]=qs[_0x359f('0x1c')](_0x258455[_0x359f('0x30')][_0x359f('0x1c')]);}_0x3fe8ed[_0x359f('0x37')]=qs[_0x359f('0x38')](_0x258455[_0x359f('0x30')]['sort']);_0x3fe8ed[_0x359f('0x39')]=qs[_0x359f('0x31')](_[_0x359f('0x3a')](_0x258455['query'],_0x1052b9[_0x359f('0x31')]),_0x4f4b68);if(_0x258455[_0x359f('0x30')][_0x359f('0x3b')]){_0x3fe8ed['where']=_[_0x359f('0x3c')](_0x3fe8ed[_0x359f('0x39')],{'$or':_[_0x359f('0x29')](_0x4f4b68,function(_0x376e81){if(_0x376e81['type']!==_0x359f('0x3d')){var _0x41246f={};_0x41246f[_0x376e81['name']]={'$like':'%'+_0x258455[_0x359f('0x30')][_0x359f('0x3b')]+'%'};return _0x41246f;}})});}_0x3fe8ed=_[_0x359f('0x3c')]({},_0x3fe8ed,_0x258455[_0x359f('0x3e')]);var _0x5c5157={'where':_0x3fe8ed['where']};return db[_0x359f('0x3f')][_0x359f('0x1f')](_0x5c5157)['then'](function(_0x5cb01a){_0x436d86['count']=_0x5cb01a;if(_0x258455['query']['includeAll']){_0x3fe8ed['include']=[{'all':!![]}];}return db[_0x359f('0x3f')][_0x359f('0x40')](_0x3fe8ed);})['then'](function(_0x599006){_0x436d86[_0x359f('0x41')]=_0x599006;return _0x436d86;})[_0x359f('0x23')](respondWithFilteredResult(_0x24427d,_0x3fe8ed))[_0x359f('0x42')](handleError(_0x24427d,null));};exports[_0x359f('0x43')]=function(_0x405abe,_0x106eaa){var _0x1bce8e={'raw':!![],'where':{'id':_0x405abe[_0x359f('0x44')]['id']}},_0x55e6b8={};_0x55e6b8[_0x359f('0x2e')]=_[_0x359f('0x2f')](db[_0x359f('0x3f')][_0x359f('0x2a')]);_0x55e6b8[_0x359f('0x30')]=_['keys'](_0x405abe[_0x359f('0x30')]);_0x55e6b8[_0x359f('0x31')]=_[_0x359f('0x32')](_0x55e6b8[_0x359f('0x2e')],_0x55e6b8[_0x359f('0x30')]);_0x1bce8e[_0x359f('0x33')]=_['intersection'](_0x55e6b8[_0x359f('0x2e')],qs['fields'](_0x405abe['query'][_0x359f('0x34')]));_0x1bce8e['attributes']=_0x1bce8e[_0x359f('0x33')]['length']?_0x1bce8e[_0x359f('0x33')]:_0x55e6b8['model'];if(_0x405abe['query']['includeAll']){_0x1bce8e[_0x359f('0x45')]=[{'all':!![]}];}_0x1bce8e=_[_0x359f('0x3c')]({},_0x1bce8e,_0x405abe['options']);return db['JscriptySessionReport'][_0x359f('0x46')](_0x1bce8e)[_0x359f('0x23')](handleEntityNotFound(_0x106eaa,null))['then'](respondWithResult(_0x106eaa,null))[_0x359f('0x42')](handleError(_0x106eaa,null));};exports['create']=function(_0x3cbb6d,_0x1e7f2b){return db[_0x359f('0x3f')][_0x359f('0x47')](_0x3cbb6d[_0x359f('0x48')],{})['then'](respondWithResult(_0x1e7f2b,0xc9))[_0x359f('0x42')](handleError(_0x1e7f2b,null));};exports['update']=function(_0x85a28c,_0x2785d3){if(_0x85a28c[_0x359f('0x48')]['id']){delete _0x85a28c[_0x359f('0x48')]['id'];}return db['JscriptySessionReport'][_0x359f('0x46')]({'where':{'id':_0x85a28c[_0x359f('0x44')]['id']}})[_0x359f('0x23')](handleEntityNotFound(_0x2785d3,null))['then'](saveUpdates(_0x85a28c['body'],null))['then'](respondWithResult(_0x2785d3,null))['catch'](handleError(_0x2785d3,null));};exports['destroy']=function(_0x4de57a,_0x59e7c7){return db[_0x359f('0x3f')][_0x359f('0x46')]({'where':{'id':_0x4de57a['params']['id']}})['then'](handleEntityNotFound(_0x59e7c7,null))[_0x359f('0x23')](removeEntity(_0x59e7c7,null))[_0x359f('0x42')](handleError(_0x59e7c7,null));};exports[_0x359f('0x49')]=function(_0x27e2a2,_0x3ec8f5){return db[_0x359f('0x3f')]['describe']()[_0x359f('0x23')](respondWithResult(_0x3ec8f5,null))[_0x359f('0x42')](handleError(_0x3ec8f5,null));};exports[_0x359f('0x4a')]=function(_0x3882a5,_0xe3af5a,_0x518bee){var _0x5b887e={'raw':!![],'where':{}};var _0x584df4={};var _0x51a765={'count':0x0,'rows':[]};return db[_0x359f('0x3f')][_0x359f('0x4b')]({'where':{'id':_0x3882a5['params']['id']}})['then'](handleEntityNotFound(_0xe3af5a,null))[_0x359f('0x23')](function(_0x1741bd){if(_0x1741bd){_0x584df4[_0x359f('0x2e')]=_['keys'](db[_0x359f('0x4c')][_0x359f('0x2a')]);_0x584df4['query']=_[_0x359f('0x2f')](_0x3882a5[_0x359f('0x30')]);_0x584df4[_0x359f('0x31')]=_[_0x359f('0x32')](_0x584df4[_0x359f('0x2e')],_0x584df4[_0x359f('0x30')]);_0x5b887e[_0x359f('0x33')]=_[_0x359f('0x32')](_0x584df4[_0x359f('0x2e')],qs[_0x359f('0x34')](_0x3882a5[_0x359f('0x30')][_0x359f('0x34')]));_0x5b887e[_0x359f('0x33')]=_0x5b887e[_0x359f('0x33')][_0x359f('0x35')]?_0x5b887e[_0x359f('0x33')]:_0x584df4[_0x359f('0x2e')];if(!_0x3882a5[_0x359f('0x30')]['hasOwnProperty'](_0x359f('0x4d'))){_0x5b887e[_0x359f('0x1e')]=qs[_0x359f('0x1e')](_0x3882a5[_0x359f('0x30')][_0x359f('0x1e')]);_0x5b887e[_0x359f('0x1c')]=qs[_0x359f('0x1c')](_0x3882a5[_0x359f('0x30')][_0x359f('0x1c')]);}_0x5b887e[_0x359f('0x37')]=qs['sort'](_0x3882a5[_0x359f('0x30')][_0x359f('0x38')]);_0x5b887e[_0x359f('0x39')]=qs[_0x359f('0x31')](_[_0x359f('0x3a')](_0x3882a5['query'],_0x584df4[_0x359f('0x31')]));_0x5b887e[_0x359f('0x39')]['SessionId']=_0x1741bd['id'];if(_0x3882a5[_0x359f('0x30')][_0x359f('0x3b')]){_0x5b887e[_0x359f('0x39')]=_[_0x359f('0x3c')](_0x5b887e['where'],{'$or':_[_0x359f('0x29')](_0x5b887e[_0x359f('0x33')],function(_0x1d2f14){var _0x2500bd={};_0x2500bd[_0x1d2f14]={'$like':'%'+_0x3882a5[_0x359f('0x30')][_0x359f('0x3b')]+'%'};return _0x2500bd;})});}_0x5b887e=_[_0x359f('0x3c')]({},_0x5b887e,_0x3882a5[_0x359f('0x3e')]);return db[_0x359f('0x4c')][_0x359f('0x1f')]({'where':_0x5b887e['where']})['then'](function(_0x304691){_0x51a765[_0x359f('0x1f')]=_0x304691;if(_0x3882a5['query']['includeAll']){_0x5b887e[_0x359f('0x45')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x359f('0x40')](_0x5b887e);})[_0x359f('0x23')](function(_0xde3776){_0x51a765['rows']=_0xde3776;return _0x51a765;});}})[_0x359f('0x23')](respondWithFilteredResult(_0xe3af5a,_0x5b887e))[_0x359f('0x42')](handleError(_0xe3af5a,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 9ac219a..3bf5ea7 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 _0xbac2=['./jscriptySessionReport.attributes','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xbac2,0x71));var _0x2bac=function(_0x71cd05,_0x36ac11){_0x71cd05=_0x71cd05-0x0;var _0x59c9e7=_0xbac2[_0x71cd05];return _0x59c9e7;};'use strict';var _=require(_0x2bac('0x0'));var util=require('util');var logger=require(_0x2bac('0x1'))(_0x2bac('0x2'));var moment=require(_0x2bac('0x3'));var BPromise=require(_0x2bac('0x4'));var rp=require(_0x2bac('0x5'));var fs=require('fs');var path=require(_0x2bac('0x6'));var rimraf=require('rimraf');var config=require(_0x2bac('0x7'));var attributes=require(_0x2bac('0x8'));module['exports']=function(_0xf6f60d,_0x46bb6b){return _0xf6f60d['define'](_0x2bac('0x9'),attributes,{'tableName':_0x2bac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8013=['./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x52c251,_0x567698){var _0x4a3ac2=function(_0x260fd0){while(--_0x260fd0){_0x52c251['push'](_0x52c251['shift']());}};_0x4a3ac2(++_0x567698);}(_0x8013,0x149));var _0x3801=function(_0x3afd0a,_0xa8a228){_0x3afd0a=_0x3afd0a-0x0;var _0x26651f=_0x8013[_0x3afd0a];return _0x26651f;};'use strict';var _=require(_0x3801('0x0'));var util=require(_0x3801('0x1'));var logger=require(_0x3801('0x2'))(_0x3801('0x3'));var moment=require(_0x3801('0x4'));var BPromise=require('bluebird');var rp=require(_0x3801('0x5'));var fs=require('fs');var path=require(_0x3801('0x6'));var rimraf=require(_0x3801('0x7'));var config=require(_0x3801('0x8'));var attributes=require(_0x3801('0x9'));module[_0x3801('0xa')]=function(_0x5d52c7,_0x2f024d){return _0x5d52c7[_0x3801('0xb')](_0x3801('0xc'),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 b0926cb..beb30b1 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 _0x2e4c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','message','JscriptySessionReport,\x20%s,\x20%s','result','catch','util'];(function(_0x5d76cc,_0x195736){var _0x4acce4=function(_0x3b889d){while(--_0x3b889d){_0x5d76cc['push'](_0x5d76cc['shift']());}};_0x4acce4(++_0x195736);}(_0x2e4c,0x1df));var _0xc2e4=function(_0x24392f,_0x15a3e5){_0x24392f=_0x24392f-0x0;var _0x591e33=_0x2e4c[_0x24392f];return _0x591e33;};'use strict';var _=require('lodash');var util=require(_0xc2e4('0x0'));var moment=require(_0xc2e4('0x1'));var BPromise=require(_0xc2e4('0x2'));var rs=require(_0xc2e4('0x3'));var fs=require('fs');var Redis=require(_0xc2e4('0x4'));var db=require(_0xc2e4('0x5'))['db'];var utils=require(_0xc2e4('0x6'));var logger=require(_0xc2e4('0x7'))('rpc');var config=require(_0xc2e4('0x8'));var jayson=require(_0xc2e4('0x9'));var client=jayson[_0xc2e4('0xa')][_0xc2e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1251f8,_0x3e3c47,_0x25a2b3){return new BPromise(function(_0x90f831,_0x27041e){return client[_0xc2e4('0xc')](_0x1251f8,_0x25a2b3)[_0xc2e4('0xd')](function(_0x426f4b){logger[_0xc2e4('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x3e3c47,'request\x20sent');logger[_0xc2e4('0xf')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3e3c47,_0xc2e4('0x10'),JSON[_0xc2e4('0x11')](_0x426f4b));if(_0x426f4b[_0xc2e4('0x12')]){if(_0x426f4b[_0xc2e4('0x12')][_0xc2e4('0x13')]===0x1f4){logger[_0xc2e4('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x3e3c47,_0x426f4b['error'][_0xc2e4('0x14')]);return _0x27041e(_0x426f4b['error'][_0xc2e4('0x14')]);}logger[_0xc2e4('0x12')](_0xc2e4('0x15'),_0x3e3c47,_0x426f4b['error']['message']);return _0x90f831(_0x426f4b[_0xc2e4('0x12')]['message']);}else{logger[_0xc2e4('0xe')](_0xc2e4('0x15'),_0x3e3c47,_0xc2e4('0x10'));_0x90f831(_0x426f4b[_0xc2e4('0x16')][_0xc2e4('0x14')]);}})[_0xc2e4('0x17')](function(_0x9cf8ad){logger[_0xc2e4('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x3e3c47,_0x9cf8ad);_0x27041e(_0x9cf8ad);});});} \ No newline at end of file +var _0x8b78=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8b78,0xaa));var _0x88b7=function(_0x5b227d,_0x5f3170){_0x5b227d=_0x5b227d-0x0;var _0x5b88a3=_0x8b78[_0x5b227d];return _0x5b88a3;};'use strict';var _=require(_0x88b7('0x0'));var util=require('util');var moment=require(_0x88b7('0x1'));var BPromise=require('bluebird');var rs=require(_0x88b7('0x2'));var fs=require('fs');var Redis=require(_0x88b7('0x3'));var db=require(_0x88b7('0x4'))['db'];var utils=require(_0x88b7('0x5'));var logger=require('../../config/logger')(_0x88b7('0x6'));var config=require('../../config/environment');var jayson=require(_0x88b7('0x7'));var client=jayson[_0x88b7('0x8')][_0x88b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x500247,_0x117d86,_0x26d62b){return new BPromise(function(_0x1188b6,_0x484c44){return client[_0x88b7('0xa')](_0x500247,_0x26d62b)[_0x88b7('0xb')](function(_0x53ffc7){logger[_0x88b7('0xc')](_0x88b7('0xd'),_0x117d86,_0x88b7('0xe'));logger[_0x88b7('0xf')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x117d86,_0x88b7('0xe'),JSON['stringify'](_0x53ffc7));if(_0x53ffc7[_0x88b7('0x10')]){if(_0x53ffc7['error'][_0x88b7('0x11')]===0x1f4){logger[_0x88b7('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x117d86,_0x53ffc7['error']['message']);return _0x484c44(_0x53ffc7[_0x88b7('0x10')][_0x88b7('0x12')]);}logger['error'](_0x88b7('0xd'),_0x117d86,_0x53ffc7['error']['message']);return _0x1188b6(_0x53ffc7[_0x88b7('0x10')][_0x88b7('0x12')]);}else{logger['info'](_0x88b7('0xd'),_0x117d86,_0x88b7('0xe'));_0x1188b6(_0x53ffc7[_0x88b7('0x13')][_0x88b7('0x12')]);}})[_0x88b7('0x14')](function(_0x3e6b2b){logger[_0x88b7('0x10')](_0x88b7('0xd'),_0x117d86,_0x3e6b2b);_0x484c44(_0x3e6b2b);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index d7ab279..b81e6a3 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 _0xe9e6=['update','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id'];(function(_0x277c15,_0x12ca38){var _0x3ef59d=function(_0x12fb09){while(--_0x12fb09){_0x277c15['push'](_0x277c15['shift']());}};_0x3ef59d(++_0x12ca38);}(_0xe9e6,0x1d6));var _0x6e9e=function(_0x32056c,_0x1b6db7){_0x32056c=_0x32056c-0x0;var _0x317313=_0xe9e6[_0x32056c];return _0x317313;};'use strict';var multer=require(_0x6e9e('0x0'));var util=require(_0x6e9e('0x1'));var path=require(_0x6e9e('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e9e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6e9e('0x4'));var interaction=require(_0x6e9e('0x5'));var config=require(_0x6e9e('0x6'));var controller=require(_0x6e9e('0x7'));router[_0x6e9e('0x8')]('/',controller['index']);router[_0x6e9e('0x9')](_0x6e9e('0xa'),auth['isAuthenticated'](),controller[_0x6e9e('0xb')]);module[_0x6e9e('0xc')]=router; \ No newline at end of file +var _0xda86=['get','index','/:id','isAuthenticated','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller'];(function(_0x33e4a7,_0x2e80a2){var _0x598620=function(_0x65d618){while(--_0x65d618){_0x33e4a7['push'](_0x33e4a7['shift']());}};_0x598620(++_0x2e80a2);}(_0xda86,0x1f3));var _0x6da8=function(_0x19a536,_0x1ff268){_0x19a536=_0x19a536-0x0;var _0x537e52=_0xda86[_0x19a536];return _0x537e52;};'use strict';var multer=require('multer');var util=require(_0x6da8('0x0'));var path=require(_0x6da8('0x1'));var timeout=require(_0x6da8('0x2'));var express=require('express');var router=express[_0x6da8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6da8('0x4'));var interaction=require(_0x6da8('0x5'));var config=require(_0x6da8('0x6'));var controller=require(_0x6da8('0x7'));router[_0x6da8('0x8')]('/',controller[_0x6da8('0x9')]);router['put'](_0x6da8('0xa'),auth[_0x6da8('0xb')](),controller['update']);module[_0x6da8('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 97befbb..48fad12 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 _0x6d38=['exports','TEXT','STRING'];(function(_0x11eaac,_0x414cb2){var _0x4290b9=function(_0x90813d){while(--_0x90813d){_0x11eaac['push'](_0x11eaac['shift']());}};_0x4290b9(++_0x414cb2);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6d38[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x86d3('0x0')]={'license':{'type':Sequelize[_0x86d3('0x1')]},'data1':{'type':Sequelize[_0x86d3('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc4aa=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x5e81e2,_0x1d11bd){var _0x1f8673=function(_0x357ab8){while(--_0x357ab8){_0x5e81e2['push'](_0x5e81e2['shift']());}};_0x1f8673(++_0x1d11bd);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'license':{'type':Sequelize[_0xac4a('0x2')]},'data1':{'type':Sequelize[_0xac4a('0x3')]},'data2':{'type':Sequelize[_0xac4a('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xac4a('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 6fac0f7..89d571b 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 _0x430c=['License','rawAttributes','query','keys','filters','intersection','attributes','length','merge','options','getLicense','update','body','params','checkLicense','key','demo','catch','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','../../config/license/util','index','model'];(function(_0x3833f4,_0x5bfad2){var _0x4eadfb=function(_0x5f6f09){while(--_0x5f6f09){_0x3833f4['push'](_0x3833f4['shift']());}};_0x4eadfb(++_0x5bfad2);}(_0x430c,0x1a1));var _0xc430=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0x430c[_0x57fa33];return _0x12e724;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc430('0x1'));var rp=require(_0xc430('0x2'));var moment=require(_0xc430('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc430('0x4'));var csv=require(_0xc430('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc430('0x6'));var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0x5'));var querystring=require(_0xc430('0xb'));var Papa=require(_0xc430('0xc'));var Redis=require(_0xc430('0xd'));var authService=require(_0xc430('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0xf'));var hardwareService=require(_0xc430('0x10'));var logger=require('../../config/logger')(_0xc430('0x11'));var utils=require('../../config/utils');var config=require(_0xc430('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc430('0x13'))['db'];function respondWithStatusCode(_0x8aa2e6,_0xc5f92){_0xc5f92=_0xc5f92||0xcc;return function(_0x1fb8ce){if(_0x1fb8ce){return _0x8aa2e6[_0xc430('0x14')](_0xc5f92);}return _0x8aa2e6[_0xc430('0x15')](_0xc5f92)[_0xc430('0x16')]();};}function respondWithResult(_0x54d851,_0x4e9134){_0x4e9134=_0x4e9134||0xc8;return function(_0x3f359c){if(_0x3f359c){return _0x54d851[_0xc430('0x15')](_0x4e9134)[_0xc430('0x17')](_0x3f359c);}};}function respondWithFilteredResult(_0x2ef538,_0x31d3b7){return function(_0x55cc6c){if(_0x55cc6c){var _0x111598=typeof _0x31d3b7['offset']==='undefined'&&typeof _0x31d3b7[_0xc430('0x18')]===_0xc430('0x19');var _0x2327c5=_0x55cc6c['count'];var _0x5d3acc=_0x111598?0x0:_0x31d3b7[_0xc430('0x1a')];var _0x4c1937=_0x111598?_0x55cc6c[_0xc430('0x1b')]:_0x31d3b7['offset']+_0x31d3b7['limit'];var _0x2f3203;if(_0x4c1937>=_0x2327c5){_0x4c1937=_0x2327c5;_0x2f3203=0xc8;}else{_0x2f3203=0xce;}_0x2ef538['status'](_0x2f3203);return _0x2ef538[_0xc430('0x1c')](_0xc430('0x1d'),_0x5d3acc+'-'+_0x4c1937+'/'+_0x2327c5)[_0xc430('0x17')](_0x55cc6c);}return null;};}function patchUpdates(_0x1f90bb){return function(_0x2a1ea1){try{jsonpatch['apply'](_0x2a1ea1,_0x1f90bb,!![]);}catch(_0x388a2f){return BPromise['reject'](_0x388a2f);}return _0x2a1ea1['save']();};}function saveUpdates(_0x3b7c3d,_0x2ea352){return function(_0x3c7afa){if(_0x3c7afa){return _0x3c7afa['update'](_0x3b7c3d)[_0xc430('0x1e')](function(_0x57d26e){return _0x57d26e;});}return null;};}function removeEntity(_0x23425d,_0x22ebfb){return function(_0x4efecd){if(_0x4efecd){return _0x4efecd[_0xc430('0x1f')]()[_0xc430('0x1e')](function(){_0x23425d['status'](0xcc)[_0xc430('0x16')]();});}};}function handleEntityNotFound(_0x59c498,_0x3aa85e){return function(_0x4b5280){if(!_0x4b5280){_0x59c498[_0xc430('0x14')](0x194);}return _0x4b5280;};}function handleError(_0x21e28a,_0x50110b){_0x50110b=_0x50110b||0x1f4;return function(_0x33433f){logger[_0xc430('0x20')](_0x33433f[_0xc430('0x21')]);if(_0x33433f[_0xc430('0x22')]){delete _0x33433f[_0xc430('0x22')];}_0x21e28a['status'](_0x50110b)[_0xc430('0x23')](_0x33433f);};}var utilLicense=require(_0xc430('0x24'));exports[_0xc430('0x25')]=function(_0x1591e3,_0x542cba){var _0x1f8086={'raw':!![],'where':{'id':0x1}},_0x4cf56c={};_0x4cf56c[_0xc430('0x26')]=_['keys'](db[_0xc430('0x27')][_0xc430('0x28')]);_0x4cf56c[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x1591e3['query']);_0x4cf56c[_0xc430('0x2b')]=_[_0xc430('0x2c')](_0x4cf56c[_0xc430('0x26')],_0x4cf56c[_0xc430('0x29')]);_0x1f8086['attributes']=_[_0xc430('0x2c')](_0x4cf56c[_0xc430('0x26')],qs['fields'](_0x1591e3[_0xc430('0x29')]['fields']));_0x1f8086['attributes']=_0x1f8086[_0xc430('0x2d')][_0xc430('0x2e')]?_0x1f8086[_0xc430('0x2d')]:_0x4cf56c[_0xc430('0x26')];_0x1f8086=_[_0xc430('0x2f')]({},_0x1f8086,_0x1591e3[_0xc430('0x30')]);return utilLicense[_0xc430('0x31')](_0x1f8086)[_0xc430('0x1e')](respondWithResult(_0x542cba,null))['catch'](handleError(_0x542cba,null));};exports[_0xc430('0x32')]=function(_0x4c7fc8,_0x119bee){if(_0x4c7fc8[_0xc430('0x33')]['id']){delete _0x4c7fc8[_0xc430('0x33')]['id'];}return db[_0xc430('0x27')]['find']({'where':{'id':_0x4c7fc8[_0xc430('0x34')]['id']}})['then'](handleEntityNotFound(_0x119bee,null))['then'](function(_0x2d6cec){var _0x3ebdc0=_0x2d6cec['get']({'plain':!![]});return utilLicense[_0xc430('0x35')](_0x3ebdc0,_0x4c7fc8[_0xc430('0x33')][_0xc430('0x36')]);})[_0xc430('0x1e')](function(_0x2310d3){if(!_0x2310d3[_0xc430('0x37')]){return saveUpdates(_0x4c7fc8[_0xc430('0x33')],null);}return _0x2310d3;})[_0xc430('0x1e')](respondWithResult(_0x119bee,null))[_0xc430('0x38')](handleError(_0x119bee,null));}; \ No newline at end of file +var _0xeda8=['filters','intersection','fields','query','length','attributes','merge','options','getLicense','catch','body','params','get','checkLicense','key','demo','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','stack','name','send','index','model','keys','License','rawAttributes'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xeda8,0x104));var _0x8eda=function(_0x21bedf,_0x3ba1be){_0x21bedf=_0x21bedf-0x0;var _0x4ce187=_0xeda8[_0x21bedf];return _0x4ce187;};'use strict';var emlformat=require(_0x8eda('0x0'));var rimraf=require(_0x8eda('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8eda('0x2'));var rp=require(_0x8eda('0x3'));var moment=require(_0x8eda('0x4'));var BPromise=require(_0x8eda('0x5'));var Mustache=require(_0x8eda('0x6'));var util=require(_0x8eda('0x7'));var path=require(_0x8eda('0x8'));var sox=require(_0x8eda('0x9'));var csv=require(_0x8eda('0xa'));var ejs=require(_0x8eda('0xb'));var fs=require('fs');var fs_extra=require(_0x8eda('0xc'));var _=require(_0x8eda('0xd'));var squel=require('squel');var crypto=require(_0x8eda('0xe'));var jsforce=require(_0x8eda('0xf'));var deskjs=require(_0x8eda('0x10'));var toCsv=require(_0x8eda('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8eda('0x11'));var as=require(_0x8eda('0x12'));var hardwareService=require(_0x8eda('0x13'));var logger=require('../../config/logger')(_0x8eda('0x14'));var utils=require('../../config/utils');var config=require(_0x8eda('0x15'));var licenseUtil=require(_0x8eda('0x16'));var db=require(_0x8eda('0x17'))['db'];function respondWithStatusCode(_0x1ad3df,_0x337573){_0x337573=_0x337573||0xcc;return function(_0x3af00c){if(_0x3af00c){return _0x1ad3df[_0x8eda('0x18')](_0x337573);}return _0x1ad3df[_0x8eda('0x19')](_0x337573)['end']();};}function respondWithResult(_0x500bd4,_0xe04d90){_0xe04d90=_0xe04d90||0xc8;return function(_0x223dcf){if(_0x223dcf){return _0x500bd4['status'](_0xe04d90)[_0x8eda('0x1a')](_0x223dcf);}};}function respondWithFilteredResult(_0x34b1ee,_0x123905){return function(_0x56ff8a){if(_0x56ff8a){var _0x3f2925=typeof _0x123905['offset']===_0x8eda('0x1b')&&typeof _0x123905['limit']===_0x8eda('0x1b');var _0x58023b=_0x56ff8a[_0x8eda('0x1c')];var _0x2a4d2b=_0x3f2925?0x0:_0x123905['offset'];var _0x5e44b7=_0x3f2925?_0x56ff8a[_0x8eda('0x1c')]:_0x123905[_0x8eda('0x1d')]+_0x123905[_0x8eda('0x1e')];var _0x41abfa;if(_0x5e44b7>=_0x58023b){_0x5e44b7=_0x58023b;_0x41abfa=0xc8;}else{_0x41abfa=0xce;}_0x34b1ee[_0x8eda('0x19')](_0x41abfa);return _0x34b1ee[_0x8eda('0x1f')](_0x8eda('0x20'),_0x2a4d2b+'-'+_0x5e44b7+'/'+_0x58023b)[_0x8eda('0x1a')](_0x56ff8a);}return null;};}function patchUpdates(_0x850cce){return function(_0x232786){try{jsonpatch[_0x8eda('0x21')](_0x232786,_0x850cce,!![]);}catch(_0x57f336){return BPromise[_0x8eda('0x22')](_0x57f336);}return _0x232786['save']();};}function saveUpdates(_0x45517e,_0x5183bc){return function(_0x1033d6){if(_0x1033d6){return _0x1033d6[_0x8eda('0x23')](_0x45517e)['then'](function(_0x58e54b){return _0x58e54b;});}return null;};}function removeEntity(_0x56dba4,_0x2a4c99){return function(_0x17cae8){if(_0x17cae8){return _0x17cae8['destroy']()[_0x8eda('0x24')](function(){_0x56dba4[_0x8eda('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25e955,_0xfa57ca){return function(_0x24b1e1){if(!_0x24b1e1){_0x25e955[_0x8eda('0x18')](0x194);}return _0x24b1e1;};}function handleError(_0x2e42e4,_0x5c8488){_0x5c8488=_0x5c8488||0x1f4;return function(_0x41b5a9){logger['error'](_0x41b5a9[_0x8eda('0x25')]);if(_0x41b5a9[_0x8eda('0x26')]){delete _0x41b5a9[_0x8eda('0x26')];}_0x2e42e4['status'](_0x5c8488)[_0x8eda('0x27')](_0x41b5a9);};}var utilLicense=require(_0x8eda('0x16'));exports[_0x8eda('0x28')]=function(_0x4cdd2e,_0x1616ea){var _0x11a999={'raw':!![],'where':{'id':0x1}},_0x5dd315={};_0x5dd315[_0x8eda('0x29')]=_[_0x8eda('0x2a')](db[_0x8eda('0x2b')][_0x8eda('0x2c')]);_0x5dd315['query']=_['keys'](_0x4cdd2e['query']);_0x5dd315[_0x8eda('0x2d')]=_[_0x8eda('0x2e')](_0x5dd315[_0x8eda('0x29')],_0x5dd315['query']);_0x11a999['attributes']=_['intersection'](_0x5dd315[_0x8eda('0x29')],qs[_0x8eda('0x2f')](_0x4cdd2e[_0x8eda('0x30')]['fields']));_0x11a999['attributes']=_0x11a999['attributes'][_0x8eda('0x31')]?_0x11a999[_0x8eda('0x32')]:_0x5dd315[_0x8eda('0x29')];_0x11a999=_[_0x8eda('0x33')]({},_0x11a999,_0x4cdd2e[_0x8eda('0x34')]);return utilLicense[_0x8eda('0x35')](_0x11a999)[_0x8eda('0x24')](respondWithResult(_0x1616ea,null))[_0x8eda('0x36')](handleError(_0x1616ea,null));};exports[_0x8eda('0x23')]=function(_0x11f40e,_0x2bc4c4){if(_0x11f40e[_0x8eda('0x37')]['id']){delete _0x11f40e[_0x8eda('0x37')]['id'];}return db[_0x8eda('0x2b')]['find']({'where':{'id':_0x11f40e[_0x8eda('0x38')]['id']}})[_0x8eda('0x24')](handleEntityNotFound(_0x2bc4c4,null))[_0x8eda('0x24')](function(_0x4e3b81){var _0x5061a3=_0x4e3b81[_0x8eda('0x39')]({'plain':!![]});return utilLicense[_0x8eda('0x3a')](_0x5061a3,_0x11f40e[_0x8eda('0x37')][_0x8eda('0x3b')]);})['then'](function(_0x443058){if(!_0x443058[_0x8eda('0x3c')]){return saveUpdates(_0x11f40e[_0x8eda('0x37')],null);}return _0x443058;})[_0x8eda('0x24')](respondWithResult(_0x2bc4c4,null))[_0x8eda('0x36')](handleError(_0x2bc4c4,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 97126a1..1baa67f 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 _0x19b9=['./license.attributes','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5ce78c,_0x1e14ed){var _0x1df8f4=function(_0x445c53){while(--_0x445c53){_0x5ce78c['push'](_0x5ce78c['shift']());}};_0x1df8f4(++_0x1e14ed);}(_0x19b9,0x169));var _0x919b=function(_0x24cc35,_0x21b4e6){_0x24cc35=_0x24cc35-0x0;var _0x440e29=_0x19b9[_0x24cc35];return _0x440e29;};'use strict';var _=require(_0x919b('0x0'));var util=require(_0x919b('0x1'));var logger=require(_0x919b('0x2'))(_0x919b('0x3'));var moment=require(_0x919b('0x4'));var BPromise=require('bluebird');var rp=require(_0x919b('0x5'));var fs=require('fs');var path=require(_0x919b('0x6'));var rimraf=require(_0x919b('0x7'));var config=require(_0x919b('0x8'));var attributes=require(_0x919b('0x9'));module['exports']=function(_0x563ba9,_0x4c1e92){return _0x563ba9['define']('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc3d=['request-promise','path','rimraf','../../config/environment','exports','define','License','license','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xdc3d,0x14d));var _0xddc3=function(_0x279c21,_0x5a2304){_0x279c21=_0x279c21-0x0;var _0x3d19e2=_0xdc3d[_0x279c21];return _0x3d19e2;};'use strict';var _=require(_0xddc3('0x0'));var util=require('util');var logger=require(_0xddc3('0x1'))(_0xddc3('0x2'));var moment=require(_0xddc3('0x3'));var BPromise=require(_0xddc3('0x4'));var rp=require(_0xddc3('0x5'));var fs=require('fs');var path=require(_0xddc3('0x6'));var rimraf=require(_0xddc3('0x7'));var config=require(_0xddc3('0x8'));var attributes=require('./license.attributes');module[_0xddc3('0x9')]=function(_0x2494ac,_0x5e2c1a){return _0x2494ac[_0xddc3('0xa')](_0xddc3('0xb'),attributes,{'tableName':_0xddc3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 1ca497f..a7fe358 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 _0x8164=['debug','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','client','request','then','info','License,\x20%s,\x20%s'];(function(_0x552d8,_0x287a67){var _0x128706=function(_0x5d5a05){while(--_0x5d5a05){_0x552d8['push'](_0x552d8['shift']());}};_0x128706(++_0x287a67);}(_0x8164,0x170));var _0x4816=function(_0x7a6897,_0x66fa7c){_0x7a6897=_0x7a6897-0x0;var _0x1d49c1=_0x8164[_0x7a6897];return _0x1d49c1;};'use strict';var _=require(_0x4816('0x0'));var util=require(_0x4816('0x1'));var moment=require(_0x4816('0x2'));var BPromise=require('bluebird');var rs=require(_0x4816('0x3'));var fs=require('fs');var Redis=require(_0x4816('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4816('0x5'));var logger=require('../../config/logger')(_0x4816('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4816('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51ab08,_0x2ddb3b,_0x437b8b){return new BPromise(function(_0x170e7a,_0x383974){return client[_0x4816('0x8')](_0x51ab08,_0x437b8b)[_0x4816('0x9')](function(_0x285cab){logger[_0x4816('0xa')](_0x4816('0xb'),_0x2ddb3b,'request\x20sent');logger[_0x4816('0xc')]('License,\x20%s,\x20%s,\x20%s',_0x2ddb3b,_0x4816('0xd'),JSON[_0x4816('0xe')](_0x285cab));if(_0x285cab['error']){if(_0x285cab[_0x4816('0xf')]['code']===0x1f4){logger['error'](_0x4816('0xb'),_0x2ddb3b,_0x285cab['error']['message']);return _0x383974(_0x285cab[_0x4816('0xf')]['message']);}logger[_0x4816('0xf')](_0x4816('0xb'),_0x2ddb3b,_0x285cab[_0x4816('0xf')][_0x4816('0x10')]);return _0x170e7a(_0x285cab[_0x4816('0xf')][_0x4816('0x10')]);}else{logger[_0x4816('0xa')](_0x4816('0xb'),_0x2ddb3b,_0x4816('0xd'));_0x170e7a(_0x285cab[_0x4816('0x11')][_0x4816('0x10')]);}})[_0x4816('0x12')](function(_0x6119f){logger[_0x4816('0xf')](_0x4816('0xb'),_0x2ddb3b,_0x6119f);_0x383974(_0x6119f);});});} \ No newline at end of file +var _0xffaa=['http','request','License,\x20%s,\x20%s','request\x20sent','debug','code','error','message','info','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xffaa,0x130));var _0xaffa=function(_0x436a16,_0x119822){_0x436a16=_0x436a16-0x0;var _0x312e0e=_0xffaa[_0x436a16];return _0x312e0e;};'use strict';var _=require(_0xaffa('0x0'));var util=require(_0xaffa('0x1'));var moment=require(_0xaffa('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaffa('0x3'));var db=require(_0xaffa('0x4'))['db'];var utils=require(_0xaffa('0x5'));var logger=require(_0xaffa('0x6'))(_0xaffa('0x7'));var config=require(_0xaffa('0x8'));var jayson=require(_0xaffa('0x9'));var client=jayson[_0xaffa('0xa')][_0xaffa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x281191,_0x48320d,_0xa081be){return new BPromise(function(_0x7c018f,_0x10be9f){return client[_0xaffa('0xc')](_0x281191,_0xa081be)['then'](function(_0x32eeca){logger['info'](_0xaffa('0xd'),_0x48320d,_0xaffa('0xe'));logger[_0xaffa('0xf')]('License,\x20%s,\x20%s,\x20%s',_0x48320d,_0xaffa('0xe'),JSON['stringify'](_0x32eeca));if(_0x32eeca['error']){if(_0x32eeca['error'][_0xaffa('0x10')]===0x1f4){logger[_0xaffa('0x11')](_0xaffa('0xd'),_0x48320d,_0x32eeca['error'][_0xaffa('0x12')]);return _0x10be9f(_0x32eeca['error'][_0xaffa('0x12')]);}logger['error'](_0xaffa('0xd'),_0x48320d,_0x32eeca[_0xaffa('0x11')][_0xaffa('0x12')]);return _0x7c018f(_0x32eeca[_0xaffa('0x11')][_0xaffa('0x12')]);}else{logger[_0xaffa('0x13')](_0xaffa('0xd'),_0x48320d,_0xaffa('0xe'));_0x7c018f(_0x32eeca['result'][_0xaffa('0x12')]);}})[_0xaffa('0x14')](function(_0x4b7d89){logger[_0xaffa('0x11')]('License,\x20%s,\x20%s',_0x48320d,_0x4b7d89);_0x10be9f(_0x4b7d89);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 3d2c2cb..70b01ab 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 _0xb017=['../../config/environment','./mailAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getInteractions','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','post','addDisposition','addAnswer','create','addImap','/:id/out_servers','addSmtp','/:id/interactions','addApplications','/:id/send','addAgents','put','update','delete','removeAnswers','removeImap','removeSmtp','removeAgents','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb017,0xa9));var _0x7b01=function(_0x5f38,_0xa54440){_0x5f38=_0x5f38-0x0;var _0x2cc70f=_0xb017[_0x5f38];return _0x2cc70f;};'use strict';var multer=require('multer');var util=require(_0x7b01('0x0'));var path=require(_0x7b01('0x1'));var timeout=require(_0x7b01('0x2'));var express=require('express');var router=express[_0x7b01('0x3')]();var fs_extra=require(_0x7b01('0x4'));var auth=require(_0x7b01('0x5'));var interaction=require(_0x7b01('0x6'));var config=require(_0x7b01('0x7'));var controller=require(_0x7b01('0x8'));router['get']('/',auth[_0x7b01('0x9')](),controller['index']);router[_0x7b01('0xa')](_0x7b01('0xb'),auth['isAuthenticated'](),controller[_0x7b01('0xc')]);router[_0x7b01('0xa')](_0x7b01('0xd'),auth[_0x7b01('0x9')](),controller[_0x7b01('0xe')]);router[_0x7b01('0xa')](_0x7b01('0xf'),auth[_0x7b01('0x9')](),controller['getDispositions']);router[_0x7b01('0xa')](_0x7b01('0x10'),auth[_0x7b01('0x9')](),controller[_0x7b01('0x11')]);router['get'](_0x7b01('0x12'),auth[_0x7b01('0x9')](),controller[_0x7b01('0x13')]);router[_0x7b01('0xa')]('/:id/out_servers',auth['isAuthenticated'](),controller['getSmtp']);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x7b01('0x14')]);router['get']('/:id/applications',auth[_0x7b01('0x9')](),controller[_0x7b01('0x15')]);router[_0x7b01('0xa')](_0x7b01('0x16'),auth['isAuthenticated'](),controller[_0x7b01('0x17')]);router['get']('/:id/verify',auth[_0x7b01('0x9')](),controller[_0x7b01('0x18')]);router[_0x7b01('0xa')](_0x7b01('0x19'),auth[_0x7b01('0x9')](),controller['getAgents']);router[_0x7b01('0x1a')]('/:id/dispositions',auth[_0x7b01('0x9')](),controller[_0x7b01('0x1b')]);router[_0x7b01('0x1a')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x7b01('0x1c')]);router[_0x7b01('0x1a')]('/',auth[_0x7b01('0x9')](),controller[_0x7b01('0x1d')]);router[_0x7b01('0x1a')](_0x7b01('0x12'),auth[_0x7b01('0x9')](),controller[_0x7b01('0x1e')]);router[_0x7b01('0x1a')](_0x7b01('0x1f'),auth['isAuthenticated'](),controller[_0x7b01('0x20')]);router['post'](_0x7b01('0x21'),auth[_0x7b01('0x9')](),controller['addInteraction']);router['post']('/:id/applications',auth[_0x7b01('0x9')](),controller[_0x7b01('0x22')]);router[_0x7b01('0x1a')](_0x7b01('0x23'),auth['isAuthenticated'](),controller['send']);router[_0x7b01('0x1a')](_0x7b01('0x19'),auth[_0x7b01('0x9')](),controller[_0x7b01('0x24')]);router[_0x7b01('0x25')](_0x7b01('0xd'),auth['isAuthenticated'](),controller[_0x7b01('0x26')]);router['delete']('/:id/dispositions',auth[_0x7b01('0x9')](),controller['removeDispositions']);router[_0x7b01('0x27')](_0x7b01('0x10'),auth[_0x7b01('0x9')](),controller[_0x7b01('0x28')]);router[_0x7b01('0x27')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x7b01('0x29')]);router[_0x7b01('0x27')]('/:id/out_servers',auth[_0x7b01('0x9')](),controller[_0x7b01('0x2a')]);router[_0x7b01('0x27')]('/:id',auth[_0x7b01('0x9')](),controller['destroy']);router[_0x7b01('0x27')](_0x7b01('0x19'),auth[_0x7b01('0x9')](),controller[_0x7b01('0x2b')]);module['exports']=router; \ No newline at end of file +var _0x4a82=['getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','addAgents','update','removeDispositions','delete','removeSmtp','destroy','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','./mailAccount.controller','isAuthenticated','index','describe','get','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','/:id/users'];(function(_0x5b36bd,_0x4dfb36){var _0x1614fe=function(_0x559b7c){while(--_0x559b7c){_0x5b36bd['push'](_0x5b36bd['shift']());}};_0x1614fe(++_0x4dfb36);}(_0x4a82,0x18b));var _0x24a8=function(_0x49a86c,_0x34bac7){_0x49a86c=_0x49a86c-0x0;var _0x6dddf9=_0x4a82[_0x49a86c];return _0x6dddf9;};'use strict';var multer=require(_0x24a8('0x0'));var util=require('util');var path=require(_0x24a8('0x1'));var timeout=require(_0x24a8('0x2'));var express=require(_0x24a8('0x3'));var router=express['Router']();var fs_extra=require(_0x24a8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x24a8('0x5'));var controller=require(_0x24a8('0x6'));router['get']('/',auth[_0x24a8('0x7')](),controller[_0x24a8('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x24a8('0x9')]);router[_0x24a8('0xa')](_0x24a8('0xb'),auth['isAuthenticated'](),controller[_0x24a8('0xc')]);router[_0x24a8('0xa')](_0x24a8('0xd'),auth['isAuthenticated'](),controller[_0x24a8('0xe')]);router['get'](_0x24a8('0xf'),auth[_0x24a8('0x7')](),controller[_0x24a8('0x10')]);router[_0x24a8('0xa')](_0x24a8('0x11'),auth[_0x24a8('0x7')](),controller[_0x24a8('0x12')]);router[_0x24a8('0xa')](_0x24a8('0x13'),auth['isAuthenticated'](),controller[_0x24a8('0x14')]);router[_0x24a8('0xa')]('/:id/interactions',auth[_0x24a8('0x7')](),controller[_0x24a8('0x15')]);router[_0x24a8('0xa')](_0x24a8('0x16'),auth[_0x24a8('0x7')](),controller[_0x24a8('0x17')]);router['get'](_0x24a8('0x18'),auth[_0x24a8('0x7')](),controller[_0x24a8('0x19')]);router[_0x24a8('0xa')](_0x24a8('0x1a'),auth[_0x24a8('0x7')](),controller['verifySmtp']);router['get'](_0x24a8('0x1b'),auth[_0x24a8('0x7')](),controller[_0x24a8('0x1c')]);router[_0x24a8('0x1d')](_0x24a8('0xd'),auth[_0x24a8('0x7')](),controller[_0x24a8('0x1e')]);router['post'](_0x24a8('0xf'),auth[_0x24a8('0x7')](),controller[_0x24a8('0x1f')]);router[_0x24a8('0x1d')]('/',auth['isAuthenticated'](),controller[_0x24a8('0x20')]);router[_0x24a8('0x1d')](_0x24a8('0x11'),auth[_0x24a8('0x7')](),controller[_0x24a8('0x21')]);router[_0x24a8('0x1d')](_0x24a8('0x13'),auth[_0x24a8('0x7')](),controller[_0x24a8('0x22')]);router[_0x24a8('0x1d')](_0x24a8('0x23'),auth[_0x24a8('0x7')](),controller[_0x24a8('0x24')]);router[_0x24a8('0x1d')](_0x24a8('0x16'),auth['isAuthenticated'](),controller[_0x24a8('0x25')]);router[_0x24a8('0x1d')](_0x24a8('0x26'),auth['isAuthenticated'](),controller['send']);router[_0x24a8('0x1d')]('/:id/users',auth['isAuthenticated'](),controller[_0x24a8('0x27')]);router['put'](_0x24a8('0xb'),auth[_0x24a8('0x7')](),controller[_0x24a8('0x28')]);router['delete']('/:id/dispositions',auth[_0x24a8('0x7')](),controller[_0x24a8('0x29')]);router[_0x24a8('0x2a')](_0x24a8('0xf'),auth[_0x24a8('0x7')](),controller['removeAnswers']);router['delete'](_0x24a8('0x11'),auth[_0x24a8('0x7')](),controller['removeImap']);router[_0x24a8('0x2a')](_0x24a8('0x13'),auth['isAuthenticated'](),controller[_0x24a8('0x2b')]);router[_0x24a8('0x2a')]('/:id',auth[_0x24a8('0x7')](),controller[_0x24a8('0x2c')]);router['delete']('/:id/users',auth[_0x24a8('0x7')](),controller[_0x24a8('0x2d')]);module[_0x24a8('0x2e')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 9750f9a..efb0611 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 _0xcd49=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','exports','STRING','BOOLEAN','TEXT','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'];(function(_0x98d5de,_0x3b0f16){var _0x58f4be=function(_0x3d85ac){while(--_0x3d85ac){_0x98d5de['push'](_0x98d5de['shift']());}};_0x58f4be(++_0x3b0f16);}(_0xcd49,0x16e));var _0x9cd4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xcd49[_0x334841];return _0x5beb4b;};'use strict';var Sequelize=require('sequelize');module[_0x9cd4('0x0')]={'description':{'type':Sequelize[_0x9cd4('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x9cd4('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x9cd4('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x9cd4('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x9cd4('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x9cd4('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9cd4('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x9cd4('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x9cd4('0x3')],'defaultValue':function(){return _0x9cd4('0x6');}},'notificationSound':{'type':Sequelize[_0x9cd4('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9cd4('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9cd4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9cd4('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9cd4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9cd4('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9cd4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9cd4('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9cd4('0x2')],'defaultValue':![],'comment':_0x9cd4('0x8'),'set':function(_0x4fdc26){if(!_0x4fdc26)this[_0x9cd4('0x9')](_0x9cd4('0xa'),null);this[_0x9cd4('0x9')]('mandatoryDisposition',_0x4fdc26);}}}; \ No newline at end of file +var _0xda11=['UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xda11,0x91));var _0x1da1=function(_0x4bf106,_0x8a93d2){_0x4bf106=_0x4bf106-0x0;var _0x4a293e=_0xda11[_0x4bf106];return _0x4a293e;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x1da1('0x0')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x1da1('0x1')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x1da1('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0x1da1('0x2')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x1da1('0x0')],'allowNull':![],'defaultValue':_0x1da1('0x3')},'fontSize':{'type':Sequelize[_0x1da1('0x4')](0x2)[_0x1da1('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1da1('0x6');}},'notificationSound':{'type':Sequelize[_0x1da1('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1da1('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1da1('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1da1('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1da1('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1da1('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1da1('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1da1('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x1da1('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x1da1('0x1')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4d07f4){if(!_0x4d07f4)this['setDataValue'](_0x1da1('0x8'),null);this['setDataValue'](_0x1da1('0x9'),_0x4d07f4);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 7732945..639c806 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 _0xd811=['request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','update','destroy','UserProfileResource','stack','send','index','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','merge','options','includeAll','include','MailAccount','findAll','rows','params','MailServerIn','rawAttributes','find','body','describe','addDisposition','MailAccountId','getDispositions','findOne','Disposition','nolimit','order','filter','map','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','email','ListId','isNil','active','description','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','cservice','get','role','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','Contact','User','Owner','internal','Tag','Tags','color','tag','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','CmContact','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','getAgents','eml-format','rimraf','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./mailAccount.socket','register','jayson/promise','client','request','then','info','MailAccount,\x20%s,\x20%s'];(function(_0x195e27,_0x1bce60){var _0x2583f7=function(_0x639881){while(--_0x639881){_0x195e27['push'](_0x195e27['shift']());}};_0x2583f7(++_0x1bce60);}(_0xd811,0x165));var _0x1d81=function(_0x1a39f3,_0x4d06ce){_0x1a39f3=_0x1a39f3-0x0;var _0x4cf744=_0xd811[_0x1a39f3];return _0x4cf744;};'use strict';var emlformat=require(_0x1d81('0x0'));var rimraf=require(_0x1d81('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1d81('0x2'));var moment=require(_0x1d81('0x3'));var BPromise=require(_0x1d81('0x4'));var Mustache=require('mustache');var util=require(_0x1d81('0x5'));var path=require('path');var sox=require(_0x1d81('0x6'));var csv=require(_0x1d81('0x7'));var ejs=require(_0x1d81('0x8'));var fs=require('fs');var fs_extra=require(_0x1d81('0x9'));var _=require(_0x1d81('0xa'));var squel=require(_0x1d81('0xb'));var crypto=require(_0x1d81('0xc'));var jsforce=require(_0x1d81('0xd'));var deskjs=require(_0x1d81('0xe'));var toCsv=require(_0x1d81('0x7'));var querystring=require(_0x1d81('0xf'));var Papa=require(_0x1d81('0x10'));var htmlToText=require(_0x1d81('0x11'));var juice=require(_0x1d81('0x12'));var Redis=require(_0x1d81('0x13'));var authService=require(_0x1d81('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x1d81('0x15'));var hardwareService=require(_0x1d81('0x16'));var logger=require(_0x1d81('0x17'))(_0x1d81('0x18'));var utils=require(_0x1d81('0x19'));var config=require(_0x1d81('0x1a'));var licenseUtil=require(_0x1d81('0x1b'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x1d81('0x1c')](config[_0x1d81('0x1d')],{'host':_0x1d81('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1d81('0x1d')]));require(_0x1d81('0x1f'))[_0x1d81('0x20')](socket);var jayson=require(_0x1d81('0x21'));var client=jayson[_0x1d81('0x22')]['http']({'port':0x232b});function respondWithRpcPromise(_0xdfd356,_0xbd17a,_0xb69a65,_0x23b362){return new BPromise(function(_0x26460a,_0x3cf0eb){var _0x2dcbe2=_0x23b362||client;return _0x2dcbe2[_0x1d81('0x23')](_0xdfd356,_0xb69a65)[_0x1d81('0x24')](function(_0x311e4e){logger[_0x1d81('0x25')](_0x1d81('0x26'),_0xbd17a,_0x1d81('0x27'));logger[_0x1d81('0x28')](_0x1d81('0x29'),_0xbd17a,_0x1d81('0x27'),JSON['stringify'](_0x311e4e));if(_0x311e4e[_0x1d81('0x2a')]){if(_0x311e4e[_0x1d81('0x2a')][_0x1d81('0x2b')]===0x1f4){logger[_0x1d81('0x2a')](_0x1d81('0x26'),_0xbd17a,_0x311e4e[_0x1d81('0x2a')]['message']);return _0x3cf0eb(_0x311e4e[_0x1d81('0x2a')][_0x1d81('0x2c')]);}logger[_0x1d81('0x2a')](_0x1d81('0x26'),_0xbd17a,_0x311e4e[_0x1d81('0x2a')][_0x1d81('0x2c')]);return _0x26460a(_0x311e4e[_0x1d81('0x2a')][_0x1d81('0x2c')]);}else{logger['info'](_0x1d81('0x26'),_0xbd17a,_0x1d81('0x27'));_0x26460a(_0x311e4e[_0x1d81('0x2d')]['message']);}})[_0x1d81('0x2e')](function(_0x25f559){logger[_0x1d81('0x2a')](_0x1d81('0x26'),_0xbd17a,_0x25f559);_0x3cf0eb(_0x25f559);});});}function respondWithStatusCode(_0x454c77,_0x2d3cfa){_0x2d3cfa=_0x2d3cfa||0xcc;return function(_0x5d4daf){if(_0x5d4daf){return _0x454c77[_0x1d81('0x2f')](_0x2d3cfa);}return _0x454c77['status'](_0x2d3cfa)[_0x1d81('0x30')]();};}function respondWithResult(_0x1ee05c,_0x530d85){_0x530d85=_0x530d85||0xc8;return function(_0x20e7b2){if(_0x20e7b2){return _0x1ee05c[_0x1d81('0x31')](_0x530d85)[_0x1d81('0x32')](_0x20e7b2);}};}function respondWithFilteredResult(_0x56f37c,_0x2d84f0){return function(_0x9ec6b3){if(_0x9ec6b3){var _0x2f5af2=typeof _0x2d84f0[_0x1d81('0x33')]===_0x1d81('0x34')&&typeof _0x2d84f0['limit']===_0x1d81('0x34');var _0x287b3a=_0x9ec6b3[_0x1d81('0x35')];var _0x3d79d7=_0x2f5af2?0x0:_0x2d84f0['offset'];var _0x1a847e=_0x2f5af2?_0x9ec6b3[_0x1d81('0x35')]:_0x2d84f0[_0x1d81('0x33')]+_0x2d84f0['limit'];var _0x1c152d;if(_0x1a847e>=_0x287b3a){_0x1a847e=_0x287b3a;_0x1c152d=0xc8;}else{_0x1c152d=0xce;}_0x56f37c[_0x1d81('0x31')](_0x1c152d);return _0x56f37c['set'](_0x1d81('0x36'),_0x3d79d7+'-'+_0x1a847e+'/'+_0x287b3a)['json'](_0x9ec6b3);}return null;};}function patchUpdates(_0xc3cf83){return function(_0x2bec24){try{jsonpatch[_0x1d81('0x37')](_0x2bec24,_0xc3cf83,!![]);}catch(_0x414af1){return BPromise['reject'](_0x414af1);}return _0x2bec24['save']();};}function saveUpdates(_0x17de0e,_0x12f418){return function(_0x334788){if(_0x334788){return _0x334788[_0x1d81('0x38')](_0x17de0e)[_0x1d81('0x24')](function(_0x560098){return _0x560098;});}return null;};}function removeEntity(_0x1e7b5a,_0x4fd507){return function(_0x1824b8){if(_0x1824b8){return _0x1824b8[_0x1d81('0x39')]()['then'](function(){var _0x2200b9=_0x1824b8['get']({'plain':!![]});var _0x13a0b9='MailAccounts';return db[_0x1d81('0x3a')][_0x1d81('0x39')]({'where':{'type':_0x13a0b9,'resourceId':_0x2200b9['id']}})[_0x1d81('0x24')](function(){return _0x1824b8;});})[_0x1d81('0x24')](function(){_0x1e7b5a['status'](0xcc)[_0x1d81('0x30')]();});}};}function handleEntityNotFound(_0x4d4a1c,_0x5cfadc){return function(_0x20f864){if(!_0x20f864){_0x4d4a1c[_0x1d81('0x2f')](0x194);}return _0x20f864;};}function handleError(_0xd1e4dd,_0x4500c9){_0x4500c9=_0x4500c9||0x1f4;return function(_0x310896){logger[_0x1d81('0x2a')](_0x310896[_0x1d81('0x3b')]);if(_0x310896['name']){delete _0x310896['name'];}_0xd1e4dd['status'](_0x4500c9)[_0x1d81('0x3c')](_0x310896);};}exports[_0x1d81('0x3d')]=function(_0x560a0a,_0x60bd30){var _0x5180b7={'include':[{'model':db['MailServerIn'],'as':_0x1d81('0x3e')},{'model':db[_0x1d81('0x3f')],'as':_0x1d81('0x40')},{'model':db[_0x1d81('0x41')],'as':_0x1d81('0x42')}]},_0x15837f={},_0xebdb9={'count':0x0,'rows':[]};var _0x2ad3b8=_['map'](db['MailAccount']['rawAttributes'],function(_0x27aacd){return{'name':_0x27aacd['fieldName'],'type':_0x27aacd[_0x1d81('0x43')][_0x1d81('0x44')]};});_0x15837f[_0x1d81('0x45')]=_['map'](_0x2ad3b8,_0x1d81('0x46'));_0x15837f[_0x1d81('0x47')]=_[_0x1d81('0x48')](_0x560a0a[_0x1d81('0x47')]);_0x15837f[_0x1d81('0x49')]=_[_0x1d81('0x4a')](_0x15837f[_0x1d81('0x45')],_0x15837f[_0x1d81('0x47')]);_0x5180b7['attributes']=_[_0x1d81('0x4a')](_0x15837f['model'],qs['fields'](_0x560a0a[_0x1d81('0x47')][_0x1d81('0x4b')]));_0x5180b7[_0x1d81('0x4c')]=_0x5180b7[_0x1d81('0x4c')][_0x1d81('0x4d')]?_0x5180b7[_0x1d81('0x4c')]:_0x15837f[_0x1d81('0x45')];if(!_0x560a0a[_0x1d81('0x47')][_0x1d81('0x4e')]('nolimit')){_0x5180b7['limit']=qs[_0x1d81('0x4f')](_0x560a0a[_0x1d81('0x47')][_0x1d81('0x4f')]);_0x5180b7[_0x1d81('0x33')]=qs[_0x1d81('0x33')](_0x560a0a[_0x1d81('0x47')]['offset']);}_0x5180b7['order']=qs[_0x1d81('0x50')](_0x560a0a['query'][_0x1d81('0x50')]);_0x5180b7[_0x1d81('0x51')]=qs[_0x1d81('0x49')](_[_0x1d81('0x52')](_0x560a0a[_0x1d81('0x47')],_0x15837f[_0x1d81('0x49')]),_0x2ad3b8);if(_0x560a0a[_0x1d81('0x47')]['filter']){_0x5180b7[_0x1d81('0x51')]=_[_0x1d81('0x53')](_0x5180b7['where'],{'$or':_['map'](_0x2ad3b8,function(_0x1bfe23){if(_0x1bfe23[_0x1d81('0x43')]!=='VIRTUAL'){var _0xebb9d8={};_0xebb9d8[_0x1bfe23['name']]={'$like':'%'+_0x560a0a[_0x1d81('0x47')]['filter']+'%'};return _0xebb9d8;}})});}_0x5180b7=_[_0x1d81('0x53')]({},_0x5180b7,_0x560a0a[_0x1d81('0x54')]);var _0x502d6d={'where':_0x5180b7['where']};return db['MailAccount'][_0x1d81('0x35')](_0x502d6d)[_0x1d81('0x24')](function(_0x4d68d0){_0xebdb9['count']=_0x4d68d0;if(_0x560a0a[_0x1d81('0x47')][_0x1d81('0x55')]){_0x5180b7[_0x1d81('0x56')]=[{'all':!![]}];}return db[_0x1d81('0x57')][_0x1d81('0x58')](_0x5180b7);})['then'](function(_0x1097e9){_0xebdb9[_0x1d81('0x59')]=_0x1097e9;return _0xebdb9;})[_0x1d81('0x24')](respondWithFilteredResult(_0x60bd30,_0x5180b7))['catch'](handleError(_0x60bd30,null));};exports['show']=function(_0x405d47,_0x3cb90f){var _0xfeb78f={'raw':![],'where':{'id':_0x405d47[_0x1d81('0x5a')]['id']},'include':[{'model':db[_0x1d81('0x5b')],'as':'Imap'},{'model':db[_0x1d81('0x3f')],'as':'Smtp'},{'model':db[_0x1d81('0x41')],'as':_0x1d81('0x42')}]},_0x573691={};_0x573691[_0x1d81('0x45')]=_[_0x1d81('0x48')](db['MailAccount'][_0x1d81('0x5c')]);_0x573691[_0x1d81('0x47')]=_['keys'](_0x405d47[_0x1d81('0x47')]);_0x573691[_0x1d81('0x49')]=_['intersection'](_0x573691[_0x1d81('0x45')],_0x573691[_0x1d81('0x47')]);_0xfeb78f[_0x1d81('0x4c')]=_[_0x1d81('0x4a')](_0x573691['model'],qs[_0x1d81('0x4b')](_0x405d47[_0x1d81('0x47')][_0x1d81('0x4b')]));_0xfeb78f[_0x1d81('0x4c')]=_0xfeb78f[_0x1d81('0x4c')]['length']?_0xfeb78f[_0x1d81('0x4c')]:_0x573691['model'];if(_0x405d47[_0x1d81('0x47')][_0x1d81('0x55')]){_0xfeb78f['include']=[{'all':!![]}];}_0xfeb78f=_[_0x1d81('0x53')]({},_0xfeb78f,_0x405d47['options']);return db['MailAccount'][_0x1d81('0x5d')](_0xfeb78f)[_0x1d81('0x24')](handleEntityNotFound(_0x3cb90f,null))[_0x1d81('0x24')](respondWithResult(_0x3cb90f,null))[_0x1d81('0x2e')](handleError(_0x3cb90f,null));};exports['update']=function(_0x1a8b07,_0x1cb243){if(_0x1a8b07[_0x1d81('0x5e')]['id']){delete _0x1a8b07[_0x1d81('0x5e')]['id'];}return db[_0x1d81('0x57')][_0x1d81('0x5d')]({'where':{'id':_0x1a8b07[_0x1d81('0x5a')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x1d81('0x3e')},{'model':db[_0x1d81('0x3f')],'as':'Smtp'},{'model':db[_0x1d81('0x41')],'as':_0x1d81('0x42')}]})[_0x1d81('0x24')](handleEntityNotFound(_0x1cb243,null))['then'](saveUpdates(_0x1a8b07['body'],null))['then'](function(_0x278b81){if(_0x278b81&&_0x1a8b07[_0x1d81('0x5e')]['Imap']){return db[_0x1d81('0x5b')][_0x1d81('0x38')](_0x1a8b07[_0x1d81('0x5e')]['Imap'],{'where':{'MailAccountId':_0x278b81['id']}})[_0x1d81('0x24')](function(){return _0x278b81;});}return _0x278b81;})[_0x1d81('0x24')](function(_0x4024c3){if(_0x4024c3&&_0x1a8b07[_0x1d81('0x5e')][_0x1d81('0x40')]){return db[_0x1d81('0x3f')][_0x1d81('0x38')](_0x1a8b07[_0x1d81('0x5e')][_0x1d81('0x40')],{'where':{'MailAccountId':_0x4024c3['id']}})['then'](function(){return _0x4024c3;});}return _0x4024c3;})[_0x1d81('0x24')](respondWithResult(_0x1cb243,null))[_0x1d81('0x2e')](handleError(_0x1cb243,null));};exports[_0x1d81('0x5f')]=function(_0x3a295f,_0x5a6ac3){return db['MailAccount'][_0x1d81('0x5f')]()[_0x1d81('0x24')](respondWithResult(_0x5a6ac3,null))[_0x1d81('0x2e')](handleError(_0x5a6ac3,null));};exports[_0x1d81('0x60')]=function(_0xbc3c39,_0x4740ec,_0x2a29c9){if(_0xbc3c39['body']['id']){delete _0xbc3c39[_0x1d81('0x5e')]['id'];}return db[_0x1d81('0x57')][_0x1d81('0x5d')]({'where':{'id':_0xbc3c39[_0x1d81('0x5a')]['id']}})[_0x1d81('0x24')](handleEntityNotFound(_0x4740ec,null))[_0x1d81('0x24')](function(_0x30517c){if(_0x30517c){_0xbc3c39['body'][_0x1d81('0x61')]=_0x30517c['id'];return db['Disposition']['create'](_0xbc3c39[_0x1d81('0x5e')]);}})[_0x1d81('0x24')](respondWithResult(_0x4740ec,null))['catch'](handleError(_0x4740ec,null));};exports[_0x1d81('0x62')]=function(_0x5ada94,_0x52f1a9,_0x5aa678){var _0x3054b2={'raw':![],'where':{}};var _0x320ab8={};var _0x3c4561={'count':0x0,'rows':[]};return db['MailAccount'][_0x1d81('0x63')]({'where':{'id':_0x5ada94[_0x1d81('0x5a')]['id']}})['then'](handleEntityNotFound(_0x52f1a9,null))['then'](function(_0xc655cc){if(_0xc655cc){_0x320ab8['model']=_['keys'](db[_0x1d81('0x64')]['rawAttributes']);_0x320ab8[_0x1d81('0x47')]=_[_0x1d81('0x48')](_0x5ada94[_0x1d81('0x47')]);_0x320ab8['filters']=_[_0x1d81('0x4a')](_0x320ab8[_0x1d81('0x45')],_0x320ab8[_0x1d81('0x47')]);_0x3054b2['attributes']=_['intersection'](_0x320ab8[_0x1d81('0x45')],qs['fields'](_0x5ada94[_0x1d81('0x47')][_0x1d81('0x4b')]));_0x3054b2[_0x1d81('0x4c')]=_0x3054b2[_0x1d81('0x4c')][_0x1d81('0x4d')]?_0x3054b2[_0x1d81('0x4c')]:_0x320ab8[_0x1d81('0x45')];if(!_0x5ada94[_0x1d81('0x47')][_0x1d81('0x4e')](_0x1d81('0x65'))){_0x3054b2[_0x1d81('0x4f')]=qs['limit'](_0x5ada94[_0x1d81('0x47')][_0x1d81('0x4f')]);_0x3054b2['offset']=qs['offset'](_0x5ada94[_0x1d81('0x47')]['offset']);}_0x3054b2[_0x1d81('0x66')]=qs['sort'](_0x5ada94[_0x1d81('0x47')]['sort']);_0x3054b2[_0x1d81('0x51')]=qs[_0x1d81('0x49')](_[_0x1d81('0x52')](_0x5ada94[_0x1d81('0x47')],_0x320ab8['filters']));_0x3054b2[_0x1d81('0x51')][_0x1d81('0x61')]=_0xc655cc['id'];if(_0x5ada94[_0x1d81('0x47')][_0x1d81('0x67')]){_0x3054b2['where']=_['merge'](_0x3054b2[_0x1d81('0x51')],{'$or':_[_0x1d81('0x68')](_0x3054b2[_0x1d81('0x4c')],function(_0x5401cf){var _0x4d332b={};_0x4d332b[_0x5401cf]={'$like':'%'+_0x5ada94[_0x1d81('0x47')][_0x1d81('0x67')]+'%'};return _0x4d332b;})});}_0x3054b2=_['merge']({},_0x3054b2,_0x5ada94['options']);return db[_0x1d81('0x64')][_0x1d81('0x35')]({'where':_0x3054b2[_0x1d81('0x51')]})[_0x1d81('0x24')](function(_0x59a3e0){_0x3c4561[_0x1d81('0x35')]=_0x59a3e0;if(_0x5ada94[_0x1d81('0x47')][_0x1d81('0x55')]){_0x3054b2['include']=[{'all':!![]}];}return db[_0x1d81('0x64')][_0x1d81('0x58')](_0x3054b2);})[_0x1d81('0x24')](function(_0x32d95c){_0x3c4561[_0x1d81('0x59')]=_0x32d95c;return _0x3c4561;});}})[_0x1d81('0x24')](respondWithFilteredResult(_0x52f1a9,_0x3054b2))[_0x1d81('0x2e')](handleError(_0x52f1a9,null));};exports[_0x1d81('0x69')]=function(_0x5d24c9,_0x4436a2,_0x4ab62d){return db[_0x1d81('0x57')][_0x1d81('0x5d')]({'where':{'id':_0x5d24c9[_0x1d81('0x5a')]['id']}})[_0x1d81('0x24')](handleEntityNotFound(_0x4436a2,null))[_0x1d81('0x24')](function(_0x114c71){if(_0x114c71){return _0x114c71[_0x1d81('0x69')](_0x5d24c9['query'][_0x1d81('0x6a')]);}})[_0x1d81('0x24')](respondWithStatusCode(_0x4436a2,null))[_0x1d81('0x2e')](handleError(_0x4436a2,null));};exports[_0x1d81('0x6b')]=function(_0x34e1f2,_0x22f9bc,_0x4c59d0){if(_0x34e1f2[_0x1d81('0x5e')]['id']){delete _0x34e1f2['body']['id'];}return db['MailAccount'][_0x1d81('0x5d')]({'where':{'id':_0x34e1f2[_0x1d81('0x5a')]['id']}})[_0x1d81('0x24')](handleEntityNotFound(_0x22f9bc,null))[_0x1d81('0x24')](function(_0x4d2c72){if(_0x4d2c72){_0x34e1f2[_0x1d81('0x5e')][_0x1d81('0x61')]=_0x4d2c72['id'];return db[_0x1d81('0x6c')][_0x1d81('0x6d')](_0x34e1f2[_0x1d81('0x5e')]);}})['then'](respondWithResult(_0x22f9bc,null))[_0x1d81('0x2e')](handleError(_0x22f9bc,null));};exports[_0x1d81('0x6e')]=function(_0x1d7520,_0x367c52,_0x50c049){var _0x89a370={'raw':![],'where':{}};var _0x391842={};var _0x3340a1={'count':0x0,'rows':[]};return db[_0x1d81('0x57')]['findOne']({'where':{'id':_0x1d7520[_0x1d81('0x5a')]['id']}})[_0x1d81('0x24')](handleEntityNotFound(_0x367c52,null))[_0x1d81('0x24')](function(_0x45723e){if(_0x45723e){_0x391842[_0x1d81('0x45')]=_[_0x1d81('0x48')](db[_0x1d81('0x6c')][_0x1d81('0x5c')]);_0x391842['query']=_[_0x1d81('0x48')](_0x1d7520[_0x1d81('0x47')]);_0x391842['filters']=_['intersection'](_0x391842[_0x1d81('0x45')],_0x391842[_0x1d81('0x47')]);_0x89a370[_0x1d81('0x4c')]=_[_0x1d81('0x4a')](_0x391842['model'],qs['fields'](_0x1d7520[_0x1d81('0x47')][_0x1d81('0x4b')]));_0x89a370[_0x1d81('0x4c')]=_0x89a370[_0x1d81('0x4c')][_0x1d81('0x4d')]?_0x89a370[_0x1d81('0x4c')]:_0x391842[_0x1d81('0x45')];if(!_0x1d7520[_0x1d81('0x47')][_0x1d81('0x4e')](_0x1d81('0x65'))){_0x89a370[_0x1d81('0x4f')]=qs[_0x1d81('0x4f')](_0x1d7520[_0x1d81('0x47')][_0x1d81('0x4f')]);_0x89a370[_0x1d81('0x33')]=qs['offset'](_0x1d7520[_0x1d81('0x47')]['offset']);}_0x89a370[_0x1d81('0x66')]=qs['sort'](_0x1d7520[_0x1d81('0x47')]['sort']);_0x89a370['where']=qs[_0x1d81('0x49')](_['pick'](_0x1d7520['query'],_0x391842[_0x1d81('0x49')]));_0x89a370[_0x1d81('0x51')][_0x1d81('0x61')]=_0x45723e['id'];if(_0x1d7520[_0x1d81('0x47')][_0x1d81('0x67')]){_0x89a370[_0x1d81('0x51')]=_['merge'](_0x89a370[_0x1d81('0x51')],{'$or':_[_0x1d81('0x68')](_0x89a370[_0x1d81('0x4c')],function(_0x383de3){var _0x26e216={};_0x26e216[_0x383de3]={'$like':'%'+_0x1d7520[_0x1d81('0x47')][_0x1d81('0x67')]+'%'};return _0x26e216;})});}_0x89a370=_[_0x1d81('0x53')]({},_0x89a370,_0x1d7520[_0x1d81('0x54')]);return db[_0x1d81('0x6c')][_0x1d81('0x35')]({'where':_0x89a370['where']})[_0x1d81('0x24')](function(_0x7b7cd6){_0x3340a1[_0x1d81('0x35')]=_0x7b7cd6;if(_0x1d7520[_0x1d81('0x47')][_0x1d81('0x55')]){_0x89a370['include']=[{'all':!![]}];}return db[_0x1d81('0x6c')]['findAll'](_0x89a370);})[_0x1d81('0x24')](function(_0x1a2df5){_0x3340a1[_0x1d81('0x59')]=_0x1a2df5;return _0x3340a1;});}})[_0x1d81('0x24')](respondWithFilteredResult(_0x367c52,_0x89a370))['catch'](handleError(_0x367c52,null));};exports[_0x1d81('0x6f')]=function(_0xba7b63,_0x7aad09,_0x110ea7){return db[_0x1d81('0x57')][_0x1d81('0x5d')]({'where':{'id':_0xba7b63['params']['id']}})[_0x1d81('0x24')](handleEntityNotFound(_0x7aad09,null))[_0x1d81('0x24')](function(_0x419812){if(_0x419812){return _0x419812['removeAnswers'](_0xba7b63[_0x1d81('0x47')][_0x1d81('0x6a')]);}})[_0x1d81('0x24')](respondWithStatusCode(_0x7aad09,null))[_0x1d81('0x2e')](handleError(_0x7aad09,null));};exports['create']=function(_0x5e09a2,_0x12ed8b){var _0x249ca4={'name':_0x5e09a2['body'][_0x1d81('0x46')],'key':_0x5e09a2[_0x1d81('0x5e')]['key'],'email':_0x5e09a2[_0x1d81('0x5e')][_0x1d81('0x70')],'ListId':_0x5e09a2[_0x1d81('0x5e')][_0x1d81('0x71')],'active':!_[_0x1d81('0x72')](_0x5e09a2[_0x1d81('0x5e')][_0x1d81('0x73')])?_0x5e09a2[_0x1d81('0x5e')][_0x1d81('0x73')]:!![],'description':_0x5e09a2[_0x1d81('0x5e')][_0x1d81('0x74')]||null,'Imap':{},'Smtp':{}};if(_[_0x1d81('0x72')](_0x5e09a2[_0x1d81('0x5e')]['cservice'])){if(_0x5e09a2[_0x1d81('0x5e')][_0x1d81('0x75')]){_0x249ca4[_0x1d81('0x3e')][_0x1d81('0x76')]=_0x249ca4[_0x1d81('0x40')][_0x1d81('0x76')]=_0x5e09a2['body'][_0x1d81('0x77')];_0x249ca4[_0x1d81('0x3e')][_0x1d81('0x78')]=_0x249ca4[_0x1d81('0x40')][_0x1d81('0x79')]=_0x5e09a2[_0x1d81('0x5e')][_0x1d81('0x7a')];}else{_0x249ca4[_0x1d81('0x3e')][_0x1d81('0x7b')]=_0x249ca4[_0x1d81('0x40')][_0x1d81('0x7b')]=![];}_0x249ca4['Imap'][_0x1d81('0x7c')]=_0x5e09a2[_0x1d81('0x5e')][_0x1d81('0x3e')][_0x1d81('0x7c')];_0x249ca4[_0x1d81('0x3e')][_0x1d81('0x7d')]=_0x5e09a2['body']['Imap']['port'];_0x249ca4[_0x1d81('0x40')][_0x1d81('0x7c')]=_0x5e09a2['body'][_0x1d81('0x40')][_0x1d81('0x7c')];_0x249ca4[_0x1d81('0x40')]['port']=_0x5e09a2[_0x1d81('0x5e')][_0x1d81('0x40')]['port'];}else{_0x249ca4[_0x1d81('0x3e')][_0x1d81('0x7e')]=_0x249ca4[_0x1d81('0x40')][_0x1d81('0x7e')]=_0x5e09a2[_0x1d81('0x5e')][_0x1d81('0x7f')];_0x249ca4['Imap']['user']=_0x249ca4[_0x1d81('0x40')][_0x1d81('0x76')]=_0x5e09a2['body'][_0x1d81('0x77')];_0x249ca4[_0x1d81('0x3e')][_0x1d81('0x78')]=_0x249ca4[_0x1d81('0x40')][_0x1d81('0x79')]=_0x5e09a2[_0x1d81('0x5e')]['cpassword'];}return db[_0x1d81('0x57')][_0x1d81('0x6d')](_0x249ca4,{'include':[{'model':db[_0x1d81('0x3f')],'as':'Smtp'},{'model':db[_0x1d81('0x5b')],'as':_0x1d81('0x3e')}]})['then'](function(_0x5df3ee){var _0x3e20d7=_0x5e09a2[_0x1d81('0x76')][_0x1d81('0x80')]({'plain':!![]});if(!_0x3e20d7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e20d7[_0x1d81('0x81')]===_0x1d81('0x76')){var _0x40a592=_0x5df3ee[_0x1d81('0x80')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x1d81('0x82'),'userProfileId':_0x3e20d7[_0x1d81('0x83')]},'raw':!![]})[_0x1d81('0x24')](function(_0x566850){if(_0x566850&&_0x566850[_0x1d81('0x84')]===0x0){return db['UserProfileResource'][_0x1d81('0x6d')]({'name':_0x40a592['name'],'resourceId':_0x40a592['id'],'type':_0x566850[_0x1d81('0x46')],'sectionId':_0x566850['id']},{})[_0x1d81('0x24')](function(){return _0x5df3ee;});}else{return _0x5df3ee;}})[_0x1d81('0x2e')](function(_0x30f028){logger[_0x1d81('0x2a')](_0x1d81('0x85'),_0x30f028);throw _0x30f028;});}return _0x5df3ee;})['then'](respondWithResult(_0x12ed8b,0xc9))[_0x1d81('0x2e')](handleError(_0x12ed8b,null));};exports[_0x1d81('0x86')]=function(_0x551df1,_0x2b244b,_0x596e7a){return db[_0x1d81('0x57')][_0x1d81('0x63')]({'where':{'id':_0x551df1[_0x1d81('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2b244b,null))[_0x1d81('0x24')](function(_0x343353){if(_0x343353){return _0x343353['getImap']();}return null;})[_0x1d81('0x24')](respondWithResult(_0x2b244b,null))[_0x1d81('0x2e')](handleError(_0x2b244b,null));};exports[_0x1d81('0x87')]=function(_0x10fbdf,_0x205b88,_0x2fd2bf){if(_0x10fbdf['body']['id']){delete _0x10fbdf['body']['id'];}return db['MailAccount'][_0x1d81('0x5d')]({'where':{'id':_0x10fbdf[_0x1d81('0x5a')]['id']}})[_0x1d81('0x24')](handleEntityNotFound(_0x205b88,null))[_0x1d81('0x24')](function(_0x50fd42){if(_0x50fd42){_0x10fbdf[_0x1d81('0x5e')]['MailAccountId']=_0x50fd42['id'];return db[_0x1d81('0x5b')][_0x1d81('0x6d')](_0x10fbdf[_0x1d81('0x5e')]);}})[_0x1d81('0x24')](respondWithResult(_0x205b88,null))[_0x1d81('0x2e')](handleError(_0x205b88,null));};exports[_0x1d81('0x88')]=function(_0x11c90b,_0x9d54,_0xe82e92){return db[_0x1d81('0x57')]['findOne']({'where':{'id':_0x11c90b[_0x1d81('0x5a')]['id']}})[_0x1d81('0x24')](handleEntityNotFound(_0x9d54,null))[_0x1d81('0x24')](function(_0x255dac){if(_0x255dac){return _0x255dac[_0x1d81('0x89')](null);}return null;})[_0x1d81('0x24')](respondWithStatusCode(_0x9d54,null))[_0x1d81('0x2e')](handleError(_0x9d54,null));};exports[_0x1d81('0x8a')]=function(_0x2cd9f7,_0x352563,_0x43bf53){return db['MailAccount'][_0x1d81('0x63')]({'where':{'id':_0x2cd9f7[_0x1d81('0x5a')]['id']}})['then'](handleEntityNotFound(_0x352563,null))[_0x1d81('0x24')](function(_0x42e0c6){if(_0x42e0c6){return _0x42e0c6[_0x1d81('0x8a')]();}return null;})[_0x1d81('0x24')](respondWithResult(_0x352563,null))['catch'](handleError(_0x352563,null));};exports[_0x1d81('0x8b')]=function(_0x1a5ebb,_0x39ce37,_0x5cef5e){if(_0x1a5ebb[_0x1d81('0x5e')]['id']){delete _0x1a5ebb[_0x1d81('0x5e')]['id'];}return db['MailAccount'][_0x1d81('0x5d')]({'where':{'id':_0x1a5ebb[_0x1d81('0x5a')]['id']}})[_0x1d81('0x24')](handleEntityNotFound(_0x39ce37,null))[_0x1d81('0x24')](function(_0x4095cc){if(_0x4095cc){_0x1a5ebb[_0x1d81('0x5e')][_0x1d81('0x61')]=_0x4095cc['id'];return db[_0x1d81('0x3f')][_0x1d81('0x6d')](_0x1a5ebb[_0x1d81('0x5e')]);}})['then'](respondWithResult(_0x39ce37,null))[_0x1d81('0x2e')](handleError(_0x39ce37,null));};exports[_0x1d81('0x8c')]=function(_0x1f0448,_0x4212db,_0x24b10d){return db['MailAccount'][_0x1d81('0x63')]({'where':{'id':_0x1f0448[_0x1d81('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4212db,null))['then'](function(_0x5909fc){if(_0x5909fc){return _0x5909fc['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x4212db,null))[_0x1d81('0x2e')](handleError(_0x4212db,null));};exports[_0x1d81('0x8d')]=function(_0x18772c,_0x5afe8a,_0x3cc22f){return db[_0x1d81('0x8e')][_0x1d81('0x5d')]({'where':{'id':_0x18772c[_0x1d81('0x5a')]['id']}})[_0x1d81('0x24')](handleEntityNotFound(_0x5afe8a,null))[_0x1d81('0x24')](function(_0x625a71){if(_0x625a71){return _0x625a71[_0x1d81('0x8d')](_0x18772c[_0x1d81('0x5e')]['ids'],_[_0x1d81('0x8f')](_0x18772c['body'],[_0x1d81('0x6a'),'id'])||{});}})[_0x1d81('0x24')](respondWithResult(_0x5afe8a,null))[_0x1d81('0x2e')](handleError(_0x5afe8a,null));};exports['getInteractions']=function(_0x4d7e36,_0x45b7e4,_0x15a09a){var _0x3219e7={'raw':![],'where':{}};var _0x187f93={};var _0x1b42a7={'count':0x0,'rows':[]};return db[_0x1d81('0x57')]['findOne']({'where':{'id':_0x4d7e36[_0x1d81('0x5a')]['id']}})[_0x1d81('0x24')](handleEntityNotFound(_0x45b7e4,null))[_0x1d81('0x24')](function(_0x20ecdf){if(_0x20ecdf){_0x187f93[_0x1d81('0x45')]=_['keys'](db[_0x1d81('0x8e')][_0x1d81('0x5c')]);_0x187f93[_0x1d81('0x47')]=_[_0x1d81('0x48')](_0x4d7e36[_0x1d81('0x47')]);_0x187f93[_0x1d81('0x49')]=_['intersection'](_0x187f93['model'],_0x187f93[_0x1d81('0x47')]);_0x3219e7[_0x1d81('0x4c')]=_['intersection'](_0x187f93[_0x1d81('0x45')],qs[_0x1d81('0x4b')](_0x4d7e36['query'][_0x1d81('0x4b')]));_0x3219e7[_0x1d81('0x4c')]=_0x3219e7['attributes']['length']?_0x3219e7[_0x1d81('0x4c')]:_0x187f93[_0x1d81('0x45')];if(!_0x4d7e36[_0x1d81('0x47')][_0x1d81('0x4e')]('nolimit')){_0x3219e7['limit']=qs[_0x1d81('0x4f')](_0x4d7e36[_0x1d81('0x47')][_0x1d81('0x4f')]);_0x3219e7[_0x1d81('0x33')]=qs[_0x1d81('0x33')](_0x4d7e36[_0x1d81('0x47')][_0x1d81('0x33')]);}_0x3219e7[_0x1d81('0x66')]=qs[_0x1d81('0x50')](_0x4d7e36['query'][_0x1d81('0x50')]);_0x3219e7[_0x1d81('0x51')]=qs[_0x1d81('0x49')](_[_0x1d81('0x52')](_0x4d7e36['query'],_0x187f93[_0x1d81('0x49')]));_0x3219e7[_0x1d81('0x51')]['MailAccountId']=_0x20ecdf['id'];if(_0x4d7e36['query']['filter']){_0x3219e7[_0x1d81('0x51')]=_['merge'](_0x3219e7[_0x1d81('0x51')],{'$or':_[_0x1d81('0x68')](_0x3219e7[_0x1d81('0x4c')],function(_0x14879f){var _0xfa52f={};_0xfa52f[_0x14879f]={'$like':'%'+_0x4d7e36['query'][_0x1d81('0x67')]+'%'};return _0xfa52f;})});}_0x3219e7=_[_0x1d81('0x53')]({},_0x3219e7,_0x4d7e36[_0x1d81('0x54')]);return db[_0x1d81('0x8e')][_0x1d81('0x35')]({'where':_0x3219e7[_0x1d81('0x51')]})['then'](function(_0x23bac7){_0x1b42a7[_0x1d81('0x35')]=_0x23bac7;if(_0x4d7e36[_0x1d81('0x47')][_0x1d81('0x55')]){_0x3219e7[_0x1d81('0x56')]=[{'model':db['CmContact'],'as':_0x1d81('0x90'),'required':![]},{'model':db[_0x1d81('0x91')],'as':_0x1d81('0x92'),'attributes':[_0x1d81('0x46'),'fullname',_0x1d81('0x93')],'required':![]},{'model':db[_0x1d81('0x94')],'as':_0x1d81('0x95'),'attributes':['id',_0x1d81('0x46'),_0x1d81('0x96')],'where':_0x4d7e36['query']['tag']?{'id':_0x4d7e36['query'][_0x1d81('0x97')]}:undefined,'required':_0x4d7e36[_0x1d81('0x47')][_0x1d81('0x97')]?!![]:![]}];}return db['MailInteraction'][_0x1d81('0x58')](_0x3219e7);})['then'](function(_0xaead1d){_0x1b42a7['rows']=_0xaead1d;return _0x1b42a7;});}})[_0x1d81('0x24')](respondWithFilteredResult(_0x45b7e4,_0x3219e7))[_0x1d81('0x2e')](handleError(_0x45b7e4,null));};exports['addApplications']=function(_0x3407c9,_0x35d20a,_0x3cfe87){return db[_0x1d81('0x57')][_0x1d81('0x63')]({'where':{'id':_0x3407c9[_0x1d81('0x5a')]['id']}})[_0x1d81('0x24')](handleEntityNotFound(_0x35d20a,null))[_0x1d81('0x24')](function(_0x35b2ca){if(_0x35b2ca){return db['sequelize'][_0x1d81('0x98')](function(_0x31a03b){return db['MailApplication'][_0x1d81('0x39')]({'where':{'MailAccountId':_0x3407c9[_0x1d81('0x5a')]['id']},'transaction':_0x31a03b})['then'](function(_0x2548d2){var _0x5541f7=_[_0x1d81('0x68')](_0x3407c9[_0x1d81('0x5e')],function(_0x12dac2){_0x12dac2[_0x1d81('0x61')]=_0x3407c9[_0x1d81('0x5a')]['id'];return _0x12dac2;});return db[_0x1d81('0x99')][_0x1d81('0x9a')](_0x5541f7,{'transaction':_0x31a03b});});})['then'](function(){return db[_0x1d81('0x99')][_0x1d81('0x9b')]({'where':{'MailAccountId':_0x3407c9[_0x1d81('0x5a')]['id']},'order':_0x1d81('0x9c')});});}})[_0x1d81('0x24')](respondWithResult(_0x35d20a,null))[_0x1d81('0x2e')](handleError(_0x35d20a,null));};exports['getApplications']=function(_0x4ce994,_0x21ed1b,_0x1f046b){var _0x395746={};var _0x41735b={};var _0x2281a6;var _0x291b40;return db[_0x1d81('0x57')][_0x1d81('0x63')]({'where':{'id':_0x4ce994['params']['id']}})[_0x1d81('0x24')](handleEntityNotFound(_0x21ed1b,null))[_0x1d81('0x24')](function(_0x20a952){if(_0x20a952){_0x2281a6=_0x20a952;_0x41735b[_0x1d81('0x45')]=_[_0x1d81('0x48')](db[_0x1d81('0x99')][_0x1d81('0x5c')]);_0x41735b[_0x1d81('0x47')]=_['keys'](_0x4ce994[_0x1d81('0x47')]);_0x41735b[_0x1d81('0x49')]=_[_0x1d81('0x4a')](_0x41735b['model'],_0x41735b[_0x1d81('0x47')]);_0x395746[_0x1d81('0x4c')]=_[_0x1d81('0x4a')](_0x41735b[_0x1d81('0x45')],qs[_0x1d81('0x4b')](_0x4ce994[_0x1d81('0x47')][_0x1d81('0x4b')]));_0x395746[_0x1d81('0x4c')]=_0x395746[_0x1d81('0x4c')][_0x1d81('0x4d')]?_0x395746[_0x1d81('0x4c')]:_0x41735b[_0x1d81('0x45')];_0x395746[_0x1d81('0x66')]=qs[_0x1d81('0x50')](_0x4ce994[_0x1d81('0x47')][_0x1d81('0x50')]);_0x395746[_0x1d81('0x51')]=qs['filters'](_['pick'](_0x4ce994[_0x1d81('0x47')],_0x41735b[_0x1d81('0x49')]));if(_0x4ce994['query'][_0x1d81('0x67')]){_0x395746[_0x1d81('0x51')]=_[_0x1d81('0x53')](_0x395746[_0x1d81('0x51')],{'$or':_[_0x1d81('0x68')](_0x395746[_0x1d81('0x4c')],function(_0x5eef15){var _0x25ea06={};_0x25ea06[_0x5eef15]={'$like':'%'+_0x4ce994['query'][_0x1d81('0x67')]+'%'};return _0x25ea06;})});}_0x395746=_['merge']({},_0x395746,_0x4ce994[_0x1d81('0x54')]);return _0x2281a6['getApplications'](_0x395746);}})[_0x1d81('0x24')](function(_0x31001e){if(_0x31001e){_0x291b40=_0x31001e[_0x1d81('0x4d')];if(!_0x4ce994['query'][_0x1d81('0x4e')]('nolimit')){_0x395746['limit']=qs['limit'](_0x4ce994[_0x1d81('0x47')][_0x1d81('0x4f')]);_0x395746[_0x1d81('0x33')]=qs[_0x1d81('0x33')](_0x4ce994['query'][_0x1d81('0x33')]);}return _0x2281a6[_0x1d81('0x9d')](_0x395746);}})[_0x1d81('0x24')](function(_0x4ffaa4){if(_0x4ffaa4){return _0x4ffaa4?{'count':_0x291b40,'rows':_0x4ffaa4}:null;}})['then'](respondWithResult(_0x21ed1b,null))[_0x1d81('0x2e')](handleError(_0x21ed1b,null));};exports[_0x1d81('0x9e')]=function(_0x3123ab,_0x39daea,_0xd93aa1){var _0x2bccdc={'raw':!![],'where':{}};var _0x1619ca={};var _0x13f107={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x3123ab['params']['id']}})[_0x1d81('0x24')](handleEntityNotFound(_0x39daea,null))['then'](function(_0x5e0348){if(_0x5e0348){_0x1619ca[_0x1d81('0x45')]=_['keys'](db[_0x1d81('0x9f')]['rawAttributes']);_0x1619ca[_0x1d81('0x47')]=_[_0x1d81('0x48')](_0x3123ab['query']);_0x1619ca[_0x1d81('0x49')]=_[_0x1d81('0x4a')](_0x1619ca[_0x1d81('0x45')],_0x1619ca[_0x1d81('0x47')]);_0x2bccdc[_0x1d81('0x4c')]=_[_0x1d81('0x4a')](_0x1619ca[_0x1d81('0x45')],qs[_0x1d81('0x4b')](_0x3123ab['query']['fields']));_0x2bccdc[_0x1d81('0x4c')]=_0x2bccdc[_0x1d81('0x4c')]['length']?_0x2bccdc[_0x1d81('0x4c')]:_0x1619ca[_0x1d81('0x45')];if(!_0x3123ab['query'][_0x1d81('0x4e')]('nolimit')){_0x2bccdc[_0x1d81('0x4f')]=qs[_0x1d81('0x4f')](_0x3123ab[_0x1d81('0x47')]['limit']);_0x2bccdc[_0x1d81('0x33')]=qs[_0x1d81('0x33')](_0x3123ab[_0x1d81('0x47')]['offset']);}_0x2bccdc[_0x1d81('0x66')]=qs[_0x1d81('0x50')](_0x3123ab[_0x1d81('0x47')][_0x1d81('0x50')]);_0x2bccdc[_0x1d81('0x51')]=qs[_0x1d81('0x49')](_[_0x1d81('0x52')](_0x3123ab[_0x1d81('0x47')],_0x1619ca[_0x1d81('0x49')]));_0x2bccdc[_0x1d81('0x51')][_0x1d81('0x61')]=_0x5e0348['id'];if(_0x3123ab[_0x1d81('0x47')][_0x1d81('0x67')]){_0x2bccdc[_0x1d81('0x51')]=_[_0x1d81('0x53')](_0x2bccdc[_0x1d81('0x51')],{'$or':_[_0x1d81('0x68')](_0x2bccdc['attributes'],function(_0x108540){var _0x73e90f={};_0x73e90f[_0x108540]={'$like':'%'+_0x3123ab['query'][_0x1d81('0x67')]+'%'};return _0x73e90f;})});}if(_0x3123ab[_0x1d81('0x47')][_0x1d81('0xa0')]){var _0x1289cd=_0x3123ab[_0x1d81('0x47')]['$gte'][_0x1d81('0xa1')](',');var _0x1af44e={};_0x1af44e[_0x1289cd[0x0]]={'$gte':moment(_0x1289cd[0x1])[_0x1d81('0xa2')](_0x1d81('0xa3'))};_0x2bccdc[_0x1d81('0x51')]=_[_0x1d81('0x53')](_0x2bccdc[_0x1d81('0x51')],_0x1af44e);}_0x2bccdc=_[_0x1d81('0x53')]({},_0x2bccdc,_0x3123ab[_0x1d81('0x54')]);return db[_0x1d81('0x9f')][_0x1d81('0x35')]({'where':_0x2bccdc[_0x1d81('0x51')]})[_0x1d81('0x24')](function(_0x15307a){_0x13f107[_0x1d81('0x35')]=_0x15307a;if(_0x3123ab[_0x1d81('0x47')][_0x1d81('0x55')]){_0x2bccdc['include']=[{'all':!![]}];}return db[_0x1d81('0x9f')][_0x1d81('0x58')](_0x2bccdc);})[_0x1d81('0x24')](function(_0x2776ed){if(_0x3123ab[_0x1d81('0x47')][_0x1d81('0xa4')]===_0x1d81('0xa5')){for(var _0x2e9e16=0x0;_0x2e9e16<_0x2776ed[_0x1d81('0x4d')];_0x2e9e16++){_0x2776ed[_0x2e9e16]['body']=juice(_0x2776ed[_0x2e9e16]['body']);}}_0x13f107[_0x1d81('0x59')]=_0x2776ed;return _0x13f107;});}})[_0x1d81('0x24')](respondWithFilteredResult(_0x39daea,_0x2bccdc))[_0x1d81('0x2e')](handleError(_0x39daea,null));};exports[_0x1d81('0x3c')]=function(_0x311e87,_0x1dad00,_0x45e451){var _0x3860a1,_0x157bc4={},_0x2cba4e;if(_0x311e87['body']['to']){_0x2cba4e=_0x311e87['body']['to']['split'](',')[0x0];}return db[_0x1d81('0x57')][_0x1d81('0x5d')]({'where':{'id':_0x311e87[_0x1d81('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0x1d81('0xa6'),'include':[{'model':db['CmContact'],'as':_0x1d81('0xa7'),'where':{'email':_0x2cba4e},'limit':0x1,'order':[[_0x1d81('0xa8'),_0x1d81('0xa9')]]}]},{'model':db['MailServerOut'],'as':_0x1d81('0x40'),'raw':!![]}]})[_0x1d81('0x24')](handleEntityNotFound(_0x1dad00,null))[_0x1d81('0x24')](function(_0x3ef558){if(_0x3ef558){_0x3860a1=_0x3ef558;if(_0x3ef558['Smtp']){if(_[_0x1d81('0x72')](_0x311e87[_0x1d81('0x5e')]['from'])){_0x311e87[_0x1d81('0x5e')][_0x1d81('0xaa')]=util['format'](_0x1d81('0xab'),_0x3ef558[_0x1d81('0x46')],_0x3ef558[_0x1d81('0x70')]||_0x3ef558[_0x1d81('0x40')][_0x1d81('0x76')]);}if(_0x311e87[_0x1d81('0x5e')][_0x1d81('0xac')]&&_0x311e87['body'][_0x1d81('0xac')][_0x1d81('0x4d')]){for(var _0x410fd0=0x0;_0x410fd0<_0x311e87[_0x1d81('0x5e')][_0x1d81('0xac')][_0x1d81('0x4d')];_0x410fd0+=0x1){_0x311e87[_0x1d81('0x5e')]['attachments'][_0x410fd0]={'filename':_0x311e87[_0x1d81('0x5e')][_0x1d81('0xac')][_0x410fd0]['name'],'path':path[_0x1d81('0xad')](config[_0x1d81('0xae')],'server/files/attachments',_0x311e87['body']['attachments'][_0x410fd0][_0x1d81('0xaf')])};}}var _0x56e6aa={'tls':{'rejectUnauthorized':![]}};if(_[_0x1d81('0x72')](_0x3ef558[_0x1d81('0x40')][_0x1d81('0x7e')])){if(_0x3ef558[_0x1d81('0x40')][_0x1d81('0x7b')]){_0x56e6aa[_0x1d81('0xb0')]={'user':_0x3ef558[_0x1d81('0x40')]['user'],'pass':_0x3ef558[_0x1d81('0x40')]['pass']};}_0x56e6aa['host']=_0x3ef558[_0x1d81('0x40')]['host'];_0x56e6aa[_0x1d81('0x7d')]=_0x3ef558[_0x1d81('0x40')][_0x1d81('0x7d')];_0x56e6aa[_0x1d81('0xb1')]=_0x3ef558['Smtp'][_0x1d81('0xb1')];}else{_0x56e6aa[_0x1d81('0x7e')]=_0x3ef558['Smtp'][_0x1d81('0x7e')];_0x56e6aa['auth']={'user':_0x3ef558[_0x1d81('0x40')][_0x1d81('0x76')],'pass':_0x3ef558[_0x1d81('0x40')]['pass']};}return respondWithRpcPromise(_0x1d81('0xb2'),_0x1d81('0xb3'),{'account':_0x56e6aa,'message':_0x311e87['body']});}else{throw new Error(_0x1d81('0xb4'));}}})[_0x1d81('0x24')](function(_0x412b00){if(_0x412b00){_0x157bc4=_0x412b00;if(_0x3860a1[_0x1d81('0xa6')]){if(_0x3860a1[_0x1d81('0xa6')][_0x1d81('0xa7')][_0x1d81('0x4d')]){return _0x3860a1['List'][_0x1d81('0xa7')][0x0];}else{return db[_0x1d81('0xb5')][_0x1d81('0x6d')](_[_0x1d81('0x1c')](_0x311e87[_0x1d81('0x5e')],{'firstName':_0x311e87[_0x1d81('0x5e')]['to'],'email':_0x311e87[_0x1d81('0x5e')]['to'],'phone':_0x311e87[_0x1d81('0x5e')]['to'],'ListId':_0x3860a1[_0x1d81('0x71')]}));}}else{throw new Error(_0x1d81('0xb4'));}}})[_0x1d81('0x24')](function(_0x24f284){if(_0x24f284){var _0x30f7d7={'UserId':_0x311e87[_0x1d81('0x76')]['id'],'ContactId':_0x24f284['id'],'MailAccountId':_0x3860a1['id'],'inReplyTo':_0x157bc4[_0x1d81('0xb6')],'to':_0x311e87[_0x1d81('0x5e')][_0x1d81('0xaa')],'cc':_0x311e87[_0x1d81('0x5e')]['cc'],'subject':_0x311e87['body'][_0x1d81('0xb7')],'attach':_0x311e87[_0x1d81('0x5e')][_0x1d81('0xb8')],'firstMsgDirection':_0x1d81('0xb9'),'lastMsgAt':moment()[_0x1d81('0xa2')](_0x1d81('0xa3')),'lastMsgDirection':_0x1d81('0xb9'),'Messages':[_['merge'](_0x311e87[_0x1d81('0x5e')],{'messageId':_0x157bc4[_0x1d81('0xb6')],'sentAt':moment()[_0x1d81('0xa2')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x3860a1['id'],'UserId':_0x311e87['user']['id'],'ContactId':_0x24f284['id']})]};if(_0x311e87[_0x1d81('0x5e')][_0x1d81('0xba')]){_0x30f7d7=_[_0x1d81('0x53')](_0x30f7d7,_0x311e87[_0x1d81('0x5e')][_0x1d81('0xba')]);}return db['MailInteraction']['create'](_0x30f7d7,{'include':[{'model':db[_0x1d81('0x9f')],'as':'Messages'}]});}})['then'](respondWithResult(_0x1dad00,null))['catch'](handleError(_0x1dad00,null));};exports[_0x1d81('0xbb')]=function(_0x3379e2,_0x4c2e5f,_0x3828e9){return db[_0x1d81('0x57')][_0x1d81('0x5d')]({'where':{'id':_0x3379e2[_0x1d81('0x5a')]['id']},'include':[{'model':db[_0x1d81('0x3f')],'as':_0x1d81('0x40'),'raw':!![]}]})[_0x1d81('0x24')](handleEntityNotFound(_0x4c2e5f,null))[_0x1d81('0x24')](function(_0x274312){if(_0x274312&&_0x274312[_0x1d81('0x40')]){var _0x4704cf={'id':_0x274312['id'],'tls':{'rejectUnauthorized':![]}};if(_0x274312['Smtp'][_0x1d81('0x7e')]){_0x4704cf['service']=_0x274312[_0x1d81('0x40')][_0x1d81('0x7e')];}else{_0x4704cf[_0x1d81('0x7c')]=_0x274312['Smtp'][_0x1d81('0x7c')];_0x4704cf[_0x1d81('0x7d')]=_0x274312[_0x1d81('0x40')][_0x1d81('0x7d')];_0x4704cf[_0x1d81('0xb1')]=_0x274312['Smtp']['secure'];}if(_0x274312[_0x1d81('0x40')][_0x1d81('0x7b')]){_0x4704cf['auth']={'user':_0x274312[_0x1d81('0x40')]['user'],'pass':_0x274312[_0x1d81('0x40')][_0x1d81('0x79')]};}return respondWithRpcPromise(_0x1d81('0xbc'),_0x1d81('0xbb'),{'account':_0x4704cf});}})['then'](respondWithResult(_0x4c2e5f,null))[_0x1d81('0x2e')](handleError(_0x4c2e5f,null));};exports['destroy']=function(_0x3684c1,_0x2f83bf){return db[_0x1d81('0x57')][_0x1d81('0x5d')]({'where':{'id':_0x3684c1[_0x1d81('0x5a')]['id']}})[_0x1d81('0x24')](handleEntityNotFound(_0x2f83bf,null))[_0x1d81('0x24')](function(_0x5086c5){if(_0x5086c5&&_0x5086c5[_0x1d81('0x7e')]){throw new db[(_0x1d81('0xbd'))]['ValidationError'](_0x1d81('0xbe'));}return _0x5086c5;})['then'](removeEntity(_0x2f83bf,null))[_0x1d81('0x2e')](handleError(_0x2f83bf,null));};exports[_0x1d81('0xbf')]=function(_0x231433,_0x2d6729,_0x3bccc5){return db[_0x1d81('0x57')][_0x1d81('0x5d')]({'where':{'id':_0x231433[_0x1d81('0x5a')]['id']}})[_0x1d81('0x24')](handleEntityNotFound(_0x2d6729,null))['then'](function(_0x3c2cf2){if(_0x3c2cf2){return _0x3c2cf2[_0x1d81('0xbf')](_0x231433[_0x1d81('0x5e')][_0x1d81('0x6a')],_[_0x1d81('0x8f')](_0x231433['body'],[_0x1d81('0x6a'),'id'])||{})[_0x1d81('0xc0')](function(_0x41e045){for(var _0x5d6b8d=0x0;_0x5d6b8d<_0x231433[_0x1d81('0x5e')][_0x1d81('0x6a')]['length'];_0x5d6b8d+=0x1){socket[_0x1d81('0xc1')](_0x1d81('0xc2'),{'UserId':_0x231433[_0x1d81('0x5e')][_0x1d81('0x6a')][_0x5d6b8d],'MailAccountId':_0x231433['params']['id']});}return _0x41e045;});}})['then'](respondWithResult(_0x2d6729,null))['catch'](handleError(_0x2d6729,null));};exports[_0x1d81('0xc3')]=function(_0x1c2eff,_0x1f5784,_0x36b229){return db[_0x1d81('0x57')]['find']({'where':{'id':_0x1c2eff['params']['id']}})[_0x1d81('0x24')](handleEntityNotFound(_0x1f5784,null))['then'](function(_0x377e29){if(_0x377e29){return _0x377e29[_0x1d81('0xc3')](_0x1c2eff['query']['ids'])['then'](function(){if(_[_0x1d81('0xc4')](_0x1c2eff[_0x1d81('0x47')][_0x1d81('0x6a')])){for(var _0x82da8b=0x0;_0x82da8b<_0x1c2eff[_0x1d81('0x47')]['ids'][_0x1d81('0x4d')];_0x82da8b+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x1c2eff[_0x1d81('0x47')]['ids'][_0x82da8b]),'MailAccountId':Number(_0x1c2eff[_0x1d81('0x5a')]['id'])});}}else{socket[_0x1d81('0xc1')]('userMailAccount:remove',{'UserId':Number(_0x1c2eff[_0x1d81('0x47')][_0x1d81('0x6a')]),'MailAccountId':Number(_0x1c2eff[_0x1d81('0x5a')]['id'])});}});}})[_0x1d81('0x24')](respondWithStatusCode(_0x1f5784,null))[_0x1d81('0x2e')](handleError(_0x1f5784,null));};exports[_0x1d81('0xc5')]=function(_0x1711ae,_0x4397e2,_0x5e78b7){var _0x5a1850={};var _0x1a130b={};var _0x541971;var _0x2aece6;return db[_0x1d81('0x57')][_0x1d81('0x63')]({'where':{'id':_0x1711ae['params']['id']}})[_0x1d81('0x24')](handleEntityNotFound(_0x4397e2,null))['then'](function(_0x3f04b8){if(_0x3f04b8){_0x541971=_0x3f04b8;_0x1a130b['model']=_[_0x1d81('0x48')](db[_0x1d81('0x91')][_0x1d81('0x5c')]);_0x1a130b[_0x1d81('0x47')]=_[_0x1d81('0x48')](_0x1711ae[_0x1d81('0x47')]);_0x1a130b[_0x1d81('0x49')]=_['intersection'](_0x1a130b['model'],_0x1a130b[_0x1d81('0x47')]);_0x5a1850[_0x1d81('0x4c')]=_[_0x1d81('0x4a')](_0x1a130b[_0x1d81('0x45')],qs[_0x1d81('0x4b')](_0x1711ae[_0x1d81('0x47')]['fields']));_0x5a1850[_0x1d81('0x4c')]=_0x5a1850[_0x1d81('0x4c')]['length']?_0x5a1850['attributes']:_0x1a130b[_0x1d81('0x45')];_0x5a1850['order']=qs[_0x1d81('0x50')](_0x1711ae[_0x1d81('0x47')][_0x1d81('0x50')]);_0x5a1850[_0x1d81('0x51')]=qs[_0x1d81('0x49')](_[_0x1d81('0x52')](_0x1711ae[_0x1d81('0x47')],_0x1a130b[_0x1d81('0x49')]));if(_0x1711ae['query'][_0x1d81('0x67')]){_0x5a1850[_0x1d81('0x51')]=_[_0x1d81('0x53')](_0x5a1850[_0x1d81('0x51')],{'$or':_[_0x1d81('0x68')](_0x5a1850[_0x1d81('0x4c')],function(_0x21cd49){var _0x2a44c6={};_0x2a44c6[_0x21cd49]={'$like':'%'+_0x1711ae[_0x1d81('0x47')][_0x1d81('0x67')]+'%'};return _0x2a44c6;})});}_0x5a1850=_[_0x1d81('0x53')]({},_0x5a1850,_0x1711ae['options']);return _0x541971[_0x1d81('0xc5')](_0x5a1850);}})[_0x1d81('0x24')](function(_0x3c692a){if(_0x3c692a){_0x2aece6=_0x3c692a[_0x1d81('0x4d')];if(!_0x1711ae[_0x1d81('0x47')][_0x1d81('0x4e')](_0x1d81('0x65'))){_0x5a1850[_0x1d81('0x4f')]=qs[_0x1d81('0x4f')](_0x1711ae['query']['limit']);_0x5a1850[_0x1d81('0x33')]=qs[_0x1d81('0x33')](_0x1711ae['query'][_0x1d81('0x33')]);}return _0x541971[_0x1d81('0xc5')](_0x5a1850);}})[_0x1d81('0x24')](function(_0x2aea98){if(_0x2aea98){return _0x2aea98?{'count':_0x2aece6,'rows':_0x2aea98}:null;}})[_0x1d81('0x24')](respondWithResult(_0x4397e2,null))[_0x1d81('0x2e')](handleError(_0x4397e2,null));}; \ No newline at end of file +var _0xf712=['out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','emit','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./mailAccount.socket','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','status','end','json','offset','limit','undefined','count','set','save','update','get','MailAccounts','UserProfileResource','sendStatus','stack','name','send','index','Imap','MailServerOut','Smtp','Pause','map','MailAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','type','merge','include','findAll','show','params','MailServerIn','mandatoryDispositionPause','length','includeAll','options','body','describe','find','MailAccountId','create','getDispositions','Disposition','order','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','key','email','ListId','isNil','active','description','cservice','cauthentication','user','pass','cpassword','authentication','host','port','service','cuser','password','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tags','tag','sequelize','transaction','MailApplication','destroy','bulkCreate','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','Contacts','updatedAt','DESC','from','attachments','join','root','server/files/attachments','auth','secure','SendMail','sendMail','List','messageId','subject','attach'];(function(_0x3e0dc4,_0x13971b){var _0x586111=function(_0x123c53){while(--_0x123c53){_0x3e0dc4['push'](_0x3e0dc4['shift']());}};_0x586111(++_0x13971b);}(_0xf712,0x195));var _0x2f71=function(_0x1a5498,_0x48f669){_0x1a5498=_0x1a5498-0x0;var _0x20b11a=_0xf712[_0x1a5498];return _0x20b11a;};'use strict';var emlformat=require(_0x2f71('0x0'));var rimraf=require(_0x2f71('0x1'));var zipdir=require(_0x2f71('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2f71('0x3'));var Mustache=require('mustache');var util=require(_0x2f71('0x4'));var path=require(_0x2f71('0x5'));var sox=require(_0x2f71('0x6'));var csv=require(_0x2f71('0x7'));var ejs=require(_0x2f71('0x8'));var fs=require('fs');var fs_extra=require(_0x2f71('0x9'));var _=require(_0x2f71('0xa'));var squel=require('squel');var crypto=require(_0x2f71('0xb'));var jsforce=require(_0x2f71('0xc'));var deskjs=require(_0x2f71('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2f71('0xe'));var htmlToText=require('html-to-text');var juice=require('juice');var Redis=require(_0x2f71('0xf'));var authService=require(_0x2f71('0x10'));var qs=require(_0x2f71('0x11'));var as=require(_0x2f71('0x12'));var hardwareService=require(_0x2f71('0x13'));var logger=require(_0x2f71('0x14'))(_0x2f71('0x15'));var utils=require(_0x2f71('0x16'));var config=require(_0x2f71('0x17'));var licenseUtil=require(_0x2f71('0x18'));var db=require(_0x2f71('0x19'))['db'];config['redis']=_[_0x2f71('0x1a')](config[_0x2f71('0x1b')],{'host':_0x2f71('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2f71('0x1d'))['register'](socket);var jayson=require(_0x2f71('0x1e'));var client=jayson[_0x2f71('0x1f')][_0x2f71('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x4792ca,_0x16501e,_0xef4f35,_0x441435){return new BPromise(function(_0x3b4b6f,_0x4abcf4){var _0x1f8186=_0x441435||client;return _0x1f8186[_0x2f71('0x21')](_0x4792ca,_0xef4f35)[_0x2f71('0x22')](function(_0x48b4aa){logger['info'](_0x2f71('0x23'),_0x16501e,'request\x20sent');logger['debug'](_0x2f71('0x24'),_0x16501e,'request\x20sent',JSON[_0x2f71('0x25')](_0x48b4aa));if(_0x48b4aa[_0x2f71('0x26')]){if(_0x48b4aa[_0x2f71('0x26')]['code']===0x1f4){logger[_0x2f71('0x26')](_0x2f71('0x23'),_0x16501e,_0x48b4aa['error'][_0x2f71('0x27')]);return _0x4abcf4(_0x48b4aa['error'][_0x2f71('0x27')]);}logger['error'](_0x2f71('0x23'),_0x16501e,_0x48b4aa[_0x2f71('0x26')][_0x2f71('0x27')]);return _0x3b4b6f(_0x48b4aa[_0x2f71('0x26')][_0x2f71('0x27')]);}else{logger[_0x2f71('0x28')](_0x2f71('0x23'),_0x16501e,_0x2f71('0x29'));_0x3b4b6f(_0x48b4aa[_0x2f71('0x2a')]['message']);}})[_0x2f71('0x2b')](function(_0x431fd9){logger[_0x2f71('0x26')]('MailAccount,\x20%s,\x20%s',_0x16501e,_0x431fd9);_0x4abcf4(_0x431fd9);});});}function respondWithStatusCode(_0x2ef86c,_0x5392e6){_0x5392e6=_0x5392e6||0xcc;return function(_0x1d4640){if(_0x1d4640){return _0x2ef86c['sendStatus'](_0x5392e6);}return _0x2ef86c[_0x2f71('0x2c')](_0x5392e6)[_0x2f71('0x2d')]();};}function respondWithResult(_0x5d5827,_0x4ebd20){_0x4ebd20=_0x4ebd20||0xc8;return function(_0x33641d){if(_0x33641d){return _0x5d5827[_0x2f71('0x2c')](_0x4ebd20)[_0x2f71('0x2e')](_0x33641d);}};}function respondWithFilteredResult(_0x526581,_0x30db7f){return function(_0x193e2f){if(_0x193e2f){var _0x66c791=typeof _0x30db7f[_0x2f71('0x2f')]==='undefined'&&typeof _0x30db7f[_0x2f71('0x30')]===_0x2f71('0x31');var _0x280cd3=_0x193e2f['count'];var _0x575fb2=_0x66c791?0x0:_0x30db7f[_0x2f71('0x2f')];var _0x56034d=_0x66c791?_0x193e2f[_0x2f71('0x32')]:_0x30db7f[_0x2f71('0x2f')]+_0x30db7f[_0x2f71('0x30')];var _0x5d3171;if(_0x56034d>=_0x280cd3){_0x56034d=_0x280cd3;_0x5d3171=0xc8;}else{_0x5d3171=0xce;}_0x526581[_0x2f71('0x2c')](_0x5d3171);return _0x526581[_0x2f71('0x33')]('Content-Range',_0x575fb2+'-'+_0x56034d+'/'+_0x280cd3)['json'](_0x193e2f);}return null;};}function patchUpdates(_0xaff638){return function(_0xde9ec0){try{jsonpatch['apply'](_0xde9ec0,_0xaff638,!![]);}catch(_0x12c452){return BPromise['reject'](_0x12c452);}return _0xde9ec0[_0x2f71('0x34')]();};}function saveUpdates(_0x5b35da,_0x57f578){return function(_0x3bc021){if(_0x3bc021){return _0x3bc021[_0x2f71('0x35')](_0x5b35da)[_0x2f71('0x22')](function(_0xd6fbcc){return _0xd6fbcc;});}return null;};}function removeEntity(_0x27abba,_0x58df40){return function(_0xa5a7dd){if(_0xa5a7dd){return _0xa5a7dd['destroy']()['then'](function(){var _0x4df836=_0xa5a7dd[_0x2f71('0x36')]({'plain':!![]});var _0x353a91=_0x2f71('0x37');return db[_0x2f71('0x38')]['destroy']({'where':{'type':_0x353a91,'resourceId':_0x4df836['id']}})[_0x2f71('0x22')](function(){return _0xa5a7dd;});})[_0x2f71('0x22')](function(){_0x27abba[_0x2f71('0x2c')](0xcc)[_0x2f71('0x2d')]();});}};}function handleEntityNotFound(_0x22b695,_0x5ab4b5){return function(_0x598c6e){if(!_0x598c6e){_0x22b695[_0x2f71('0x39')](0x194);}return _0x598c6e;};}function handleError(_0x5f154e,_0x340e78){_0x340e78=_0x340e78||0x1f4;return function(_0x402dd2){logger[_0x2f71('0x26')](_0x402dd2[_0x2f71('0x3a')]);if(_0x402dd2[_0x2f71('0x3b')]){delete _0x402dd2[_0x2f71('0x3b')];}_0x5f154e[_0x2f71('0x2c')](_0x340e78)[_0x2f71('0x3c')](_0x402dd2);};}exports[_0x2f71('0x3d')]=function(_0x277de2,_0x591efb){var _0x2ac9b2={'include':[{'model':db['MailServerIn'],'as':_0x2f71('0x3e')},{'model':db[_0x2f71('0x3f')],'as':_0x2f71('0x40')},{'model':db[_0x2f71('0x41')],'as':'mandatoryDispositionPause'}]},_0x396773={},_0x29995c={'count':0x0,'rows':[]};var _0x373116=_[_0x2f71('0x42')](db[_0x2f71('0x43')][_0x2f71('0x44')],function(_0x14feb5){return{'name':_0x14feb5[_0x2f71('0x45')],'type':_0x14feb5['type']['key']};});_0x396773[_0x2f71('0x46')]=_[_0x2f71('0x42')](_0x373116,'name');_0x396773[_0x2f71('0x47')]=_[_0x2f71('0x48')](_0x277de2['query']);_0x396773[_0x2f71('0x49')]=_[_0x2f71('0x4a')](_0x396773[_0x2f71('0x46')],_0x396773[_0x2f71('0x47')]);_0x2ac9b2['attributes']=_[_0x2f71('0x4a')](_0x396773['model'],qs[_0x2f71('0x4b')](_0x277de2[_0x2f71('0x47')]['fields']));_0x2ac9b2['attributes']=_0x2ac9b2[_0x2f71('0x4c')]['length']?_0x2ac9b2[_0x2f71('0x4c')]:_0x396773['model'];if(!_0x277de2['query'][_0x2f71('0x4d')](_0x2f71('0x4e'))){_0x2ac9b2[_0x2f71('0x30')]=qs[_0x2f71('0x30')](_0x277de2[_0x2f71('0x47')][_0x2f71('0x30')]);_0x2ac9b2[_0x2f71('0x2f')]=qs[_0x2f71('0x2f')](_0x277de2[_0x2f71('0x47')]['offset']);}_0x2ac9b2['order']=qs[_0x2f71('0x4f')](_0x277de2['query']['sort']);_0x2ac9b2[_0x2f71('0x50')]=qs[_0x2f71('0x49')](_[_0x2f71('0x51')](_0x277de2['query'],_0x396773[_0x2f71('0x49')]),_0x373116);if(_0x277de2[_0x2f71('0x47')][_0x2f71('0x52')]){_0x2ac9b2[_0x2f71('0x50')]=_['merge'](_0x2ac9b2[_0x2f71('0x50')],{'$or':_[_0x2f71('0x42')](_0x373116,function(_0x25d746){if(_0x25d746[_0x2f71('0x53')]!=='VIRTUAL'){var _0x42e5ff={};_0x42e5ff[_0x25d746['name']]={'$like':'%'+_0x277de2['query'][_0x2f71('0x52')]+'%'};return _0x42e5ff;}})});}_0x2ac9b2=_[_0x2f71('0x54')]({},_0x2ac9b2,_0x277de2['options']);var _0x555598={'where':_0x2ac9b2[_0x2f71('0x50')]};return db['MailAccount'][_0x2f71('0x32')](_0x555598)[_0x2f71('0x22')](function(_0x34241d){_0x29995c[_0x2f71('0x32')]=_0x34241d;if(_0x277de2[_0x2f71('0x47')]['includeAll']){_0x2ac9b2[_0x2f71('0x55')]=[{'all':!![]}];}return db[_0x2f71('0x43')][_0x2f71('0x56')](_0x2ac9b2);})[_0x2f71('0x22')](function(_0x354fee){_0x29995c['rows']=_0x354fee;return _0x29995c;})['then'](respondWithFilteredResult(_0x591efb,_0x2ac9b2))[_0x2f71('0x2b')](handleError(_0x591efb,null));};exports[_0x2f71('0x57')]=function(_0x25a019,_0x31a205){var _0x31e694={'raw':![],'where':{'id':_0x25a019[_0x2f71('0x58')]['id']},'include':[{'model':db[_0x2f71('0x59')],'as':_0x2f71('0x3e')},{'model':db['MailServerOut'],'as':_0x2f71('0x40')},{'model':db[_0x2f71('0x41')],'as':_0x2f71('0x5a')}]},_0x3a911c={};_0x3a911c[_0x2f71('0x46')]=_[_0x2f71('0x48')](db[_0x2f71('0x43')]['rawAttributes']);_0x3a911c[_0x2f71('0x47')]=_[_0x2f71('0x48')](_0x25a019['query']);_0x3a911c['filters']=_[_0x2f71('0x4a')](_0x3a911c[_0x2f71('0x46')],_0x3a911c[_0x2f71('0x47')]);_0x31e694[_0x2f71('0x4c')]=_[_0x2f71('0x4a')](_0x3a911c[_0x2f71('0x46')],qs['fields'](_0x25a019[_0x2f71('0x47')][_0x2f71('0x4b')]));_0x31e694[_0x2f71('0x4c')]=_0x31e694[_0x2f71('0x4c')][_0x2f71('0x5b')]?_0x31e694[_0x2f71('0x4c')]:_0x3a911c[_0x2f71('0x46')];if(_0x25a019['query'][_0x2f71('0x5c')]){_0x31e694[_0x2f71('0x55')]=[{'all':!![]}];}_0x31e694=_['merge']({},_0x31e694,_0x25a019[_0x2f71('0x5d')]);return db[_0x2f71('0x43')]['find'](_0x31e694)[_0x2f71('0x22')](handleEntityNotFound(_0x31a205,null))['then'](respondWithResult(_0x31a205,null))['catch'](handleError(_0x31a205,null));};exports[_0x2f71('0x35')]=function(_0x76977d,_0x3149bf){if(_0x76977d[_0x2f71('0x5e')]['id']){delete _0x76977d[_0x2f71('0x5e')]['id'];}return db[_0x2f71('0x43')]['find']({'where':{'id':_0x76977d[_0x2f71('0x58')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x2f71('0x3e')},{'model':db[_0x2f71('0x3f')],'as':_0x2f71('0x40')},{'model':db[_0x2f71('0x41')],'as':_0x2f71('0x5a')}]})[_0x2f71('0x22')](handleEntityNotFound(_0x3149bf,null))[_0x2f71('0x22')](saveUpdates(_0x76977d[_0x2f71('0x5e')],null))[_0x2f71('0x22')](function(_0x2b88ec){if(_0x2b88ec&&_0x76977d[_0x2f71('0x5e')][_0x2f71('0x3e')]){return db[_0x2f71('0x59')][_0x2f71('0x35')](_0x76977d[_0x2f71('0x5e')][_0x2f71('0x3e')],{'where':{'MailAccountId':_0x2b88ec['id']}})[_0x2f71('0x22')](function(){return _0x2b88ec;});}return _0x2b88ec;})['then'](function(_0x31b08d){if(_0x31b08d&&_0x76977d[_0x2f71('0x5e')][_0x2f71('0x40')]){return db['MailServerOut'][_0x2f71('0x35')](_0x76977d[_0x2f71('0x5e')]['Smtp'],{'where':{'MailAccountId':_0x31b08d['id']}})['then'](function(){return _0x31b08d;});}return _0x31b08d;})[_0x2f71('0x22')](respondWithResult(_0x3149bf,null))[_0x2f71('0x2b')](handleError(_0x3149bf,null));};exports['describe']=function(_0x312c47,_0x5c66ff){return db[_0x2f71('0x43')][_0x2f71('0x5f')]()['then'](respondWithResult(_0x5c66ff,null))[_0x2f71('0x2b')](handleError(_0x5c66ff,null));};exports['addDisposition']=function(_0x115175,_0x20d818,_0x3cfa78){if(_0x115175[_0x2f71('0x5e')]['id']){delete _0x115175[_0x2f71('0x5e')]['id'];}return db['MailAccount'][_0x2f71('0x60')]({'where':{'id':_0x115175[_0x2f71('0x58')]['id']}})[_0x2f71('0x22')](handleEntityNotFound(_0x20d818,null))[_0x2f71('0x22')](function(_0x1c7e95){if(_0x1c7e95){_0x115175['body'][_0x2f71('0x61')]=_0x1c7e95['id'];return db['Disposition'][_0x2f71('0x62')](_0x115175[_0x2f71('0x5e')]);}})[_0x2f71('0x22')](respondWithResult(_0x20d818,null))[_0x2f71('0x2b')](handleError(_0x20d818,null));};exports[_0x2f71('0x63')]=function(_0x293239,_0x49f8d8,_0x441e75){var _0x124149={'raw':![],'where':{}};var _0x105e8d={};var _0x174785={'count':0x0,'rows':[]};return db[_0x2f71('0x43')]['findOne']({'where':{'id':_0x293239[_0x2f71('0x58')]['id']}})[_0x2f71('0x22')](handleEntityNotFound(_0x49f8d8,null))[_0x2f71('0x22')](function(_0x4a4a33){if(_0x4a4a33){_0x105e8d['model']=_[_0x2f71('0x48')](db[_0x2f71('0x64')]['rawAttributes']);_0x105e8d[_0x2f71('0x47')]=_[_0x2f71('0x48')](_0x293239[_0x2f71('0x47')]);_0x105e8d[_0x2f71('0x49')]=_[_0x2f71('0x4a')](_0x105e8d[_0x2f71('0x46')],_0x105e8d[_0x2f71('0x47')]);_0x124149[_0x2f71('0x4c')]=_['intersection'](_0x105e8d['model'],qs[_0x2f71('0x4b')](_0x293239[_0x2f71('0x47')][_0x2f71('0x4b')]));_0x124149[_0x2f71('0x4c')]=_0x124149[_0x2f71('0x4c')][_0x2f71('0x5b')]?_0x124149[_0x2f71('0x4c')]:_0x105e8d[_0x2f71('0x46')];if(!_0x293239['query'][_0x2f71('0x4d')](_0x2f71('0x4e'))){_0x124149['limit']=qs['limit'](_0x293239[_0x2f71('0x47')][_0x2f71('0x30')]);_0x124149[_0x2f71('0x2f')]=qs[_0x2f71('0x2f')](_0x293239[_0x2f71('0x47')][_0x2f71('0x2f')]);}_0x124149[_0x2f71('0x65')]=qs[_0x2f71('0x4f')](_0x293239[_0x2f71('0x47')][_0x2f71('0x4f')]);_0x124149[_0x2f71('0x50')]=qs[_0x2f71('0x49')](_[_0x2f71('0x51')](_0x293239[_0x2f71('0x47')],_0x105e8d[_0x2f71('0x49')]));_0x124149[_0x2f71('0x50')]['MailAccountId']=_0x4a4a33['id'];if(_0x293239['query']['filter']){_0x124149[_0x2f71('0x50')]=_[_0x2f71('0x54')](_0x124149[_0x2f71('0x50')],{'$or':_[_0x2f71('0x42')](_0x124149['attributes'],function(_0x166a67){var _0x5a3d14={};_0x5a3d14[_0x166a67]={'$like':'%'+_0x293239['query'][_0x2f71('0x52')]+'%'};return _0x5a3d14;})});}_0x124149=_[_0x2f71('0x54')]({},_0x124149,_0x293239[_0x2f71('0x5d')]);return db['Disposition'][_0x2f71('0x32')]({'where':_0x124149[_0x2f71('0x50')]})['then'](function(_0xcc980b){_0x174785['count']=_0xcc980b;if(_0x293239[_0x2f71('0x47')]['includeAll']){_0x124149[_0x2f71('0x55')]=[{'all':!![]}];}return db[_0x2f71('0x64')]['findAll'](_0x124149);})['then'](function(_0x42c589){_0x174785[_0x2f71('0x66')]=_0x42c589;return _0x174785;});}})[_0x2f71('0x22')](respondWithFilteredResult(_0x49f8d8,_0x124149))['catch'](handleError(_0x49f8d8,null));};exports['removeDispositions']=function(_0x184887,_0x2aa25a,_0x431fef){return db[_0x2f71('0x43')][_0x2f71('0x60')]({'where':{'id':_0x184887[_0x2f71('0x58')]['id']}})[_0x2f71('0x22')](handleEntityNotFound(_0x2aa25a,null))[_0x2f71('0x22')](function(_0x21be79){if(_0x21be79){return _0x21be79[_0x2f71('0x67')](_0x184887[_0x2f71('0x47')][_0x2f71('0x68')]);}})['then'](respondWithStatusCode(_0x2aa25a,null))[_0x2f71('0x2b')](handleError(_0x2aa25a,null));};exports['addAnswer']=function(_0x562909,_0x2e96be,_0x467f02){if(_0x562909[_0x2f71('0x5e')]['id']){delete _0x562909[_0x2f71('0x5e')]['id'];}return db[_0x2f71('0x43')][_0x2f71('0x60')]({'where':{'id':_0x562909['params']['id']}})[_0x2f71('0x22')](handleEntityNotFound(_0x2e96be,null))['then'](function(_0xf4cd3c){if(_0xf4cd3c){_0x562909['body'][_0x2f71('0x61')]=_0xf4cd3c['id'];return db[_0x2f71('0x69')][_0x2f71('0x62')](_0x562909[_0x2f71('0x5e')]);}})[_0x2f71('0x22')](respondWithResult(_0x2e96be,null))['catch'](handleError(_0x2e96be,null));};exports[_0x2f71('0x6a')]=function(_0x2beaa8,_0x2ed08a,_0x4ee0d4){var _0x37174c={'raw':![],'where':{}};var _0x53698f={};var _0x249327={'count':0x0,'rows':[]};return db[_0x2f71('0x43')]['findOne']({'where':{'id':_0x2beaa8[_0x2f71('0x58')]['id']}})['then'](handleEntityNotFound(_0x2ed08a,null))[_0x2f71('0x22')](function(_0x35dc15){if(_0x35dc15){_0x53698f[_0x2f71('0x46')]=_[_0x2f71('0x48')](db[_0x2f71('0x69')][_0x2f71('0x44')]);_0x53698f[_0x2f71('0x47')]=_[_0x2f71('0x48')](_0x2beaa8['query']);_0x53698f[_0x2f71('0x49')]=_[_0x2f71('0x4a')](_0x53698f['model'],_0x53698f[_0x2f71('0x47')]);_0x37174c[_0x2f71('0x4c')]=_[_0x2f71('0x4a')](_0x53698f[_0x2f71('0x46')],qs['fields'](_0x2beaa8[_0x2f71('0x47')][_0x2f71('0x4b')]));_0x37174c['attributes']=_0x37174c['attributes']['length']?_0x37174c['attributes']:_0x53698f[_0x2f71('0x46')];if(!_0x2beaa8[_0x2f71('0x47')][_0x2f71('0x4d')]('nolimit')){_0x37174c['limit']=qs[_0x2f71('0x30')](_0x2beaa8['query']['limit']);_0x37174c['offset']=qs[_0x2f71('0x2f')](_0x2beaa8[_0x2f71('0x47')]['offset']);}_0x37174c[_0x2f71('0x65')]=qs[_0x2f71('0x4f')](_0x2beaa8[_0x2f71('0x47')][_0x2f71('0x4f')]);_0x37174c['where']=qs['filters'](_[_0x2f71('0x51')](_0x2beaa8[_0x2f71('0x47')],_0x53698f[_0x2f71('0x49')]));_0x37174c['where'][_0x2f71('0x61')]=_0x35dc15['id'];if(_0x2beaa8[_0x2f71('0x47')][_0x2f71('0x52')]){_0x37174c[_0x2f71('0x50')]=_[_0x2f71('0x54')](_0x37174c['where'],{'$or':_[_0x2f71('0x42')](_0x37174c['attributes'],function(_0x5052c7){var _0x57d5ab={};_0x57d5ab[_0x5052c7]={'$like':'%'+_0x2beaa8[_0x2f71('0x47')]['filter']+'%'};return _0x57d5ab;})});}_0x37174c=_[_0x2f71('0x54')]({},_0x37174c,_0x2beaa8[_0x2f71('0x5d')]);return db[_0x2f71('0x69')][_0x2f71('0x32')]({'where':_0x37174c[_0x2f71('0x50')]})[_0x2f71('0x22')](function(_0x50c522){_0x249327['count']=_0x50c522;if(_0x2beaa8[_0x2f71('0x47')][_0x2f71('0x5c')]){_0x37174c[_0x2f71('0x55')]=[{'all':!![]}];}return db[_0x2f71('0x69')][_0x2f71('0x56')](_0x37174c);})[_0x2f71('0x22')](function(_0x2b9349){_0x249327['rows']=_0x2b9349;return _0x249327;});}})[_0x2f71('0x22')](respondWithFilteredResult(_0x2ed08a,_0x37174c))[_0x2f71('0x2b')](handleError(_0x2ed08a,null));};exports[_0x2f71('0x6b')]=function(_0x2152a8,_0x43abf3,_0x5e4553){return db['MailAccount'][_0x2f71('0x60')]({'where':{'id':_0x2152a8[_0x2f71('0x58')]['id']}})[_0x2f71('0x22')](handleEntityNotFound(_0x43abf3,null))[_0x2f71('0x22')](function(_0x40c2c6){if(_0x40c2c6){return _0x40c2c6[_0x2f71('0x6b')](_0x2152a8[_0x2f71('0x47')]['ids']);}})[_0x2f71('0x22')](respondWithStatusCode(_0x43abf3,null))[_0x2f71('0x2b')](handleError(_0x43abf3,null));};exports['create']=function(_0x287036,_0x1cded6){var _0x3fca61={'name':_0x287036['body'][_0x2f71('0x3b')],'key':_0x287036[_0x2f71('0x5e')][_0x2f71('0x6c')],'email':_0x287036['body'][_0x2f71('0x6d')],'ListId':_0x287036[_0x2f71('0x5e')][_0x2f71('0x6e')],'active':!_[_0x2f71('0x6f')](_0x287036[_0x2f71('0x5e')][_0x2f71('0x70')])?_0x287036['body'][_0x2f71('0x70')]:!![],'description':_0x287036[_0x2f71('0x5e')][_0x2f71('0x71')]||null,'Imap':{},'Smtp':{}};if(_[_0x2f71('0x6f')](_0x287036[_0x2f71('0x5e')][_0x2f71('0x72')])){if(_0x287036[_0x2f71('0x5e')][_0x2f71('0x73')]){_0x3fca61[_0x2f71('0x3e')][_0x2f71('0x74')]=_0x3fca61[_0x2f71('0x40')][_0x2f71('0x74')]=_0x287036['body']['cuser'];_0x3fca61['Imap']['password']=_0x3fca61[_0x2f71('0x40')][_0x2f71('0x75')]=_0x287036['body'][_0x2f71('0x76')];}else{_0x3fca61[_0x2f71('0x3e')][_0x2f71('0x77')]=_0x3fca61[_0x2f71('0x40')]['authentication']=![];}_0x3fca61[_0x2f71('0x3e')][_0x2f71('0x78')]=_0x287036[_0x2f71('0x5e')][_0x2f71('0x3e')][_0x2f71('0x78')];_0x3fca61[_0x2f71('0x3e')][_0x2f71('0x79')]=_0x287036[_0x2f71('0x5e')][_0x2f71('0x3e')][_0x2f71('0x79')];_0x3fca61[_0x2f71('0x40')][_0x2f71('0x78')]=_0x287036[_0x2f71('0x5e')]['Smtp']['host'];_0x3fca61[_0x2f71('0x40')][_0x2f71('0x79')]=_0x287036[_0x2f71('0x5e')][_0x2f71('0x40')]['port'];}else{_0x3fca61['Imap']['service']=_0x3fca61[_0x2f71('0x40')][_0x2f71('0x7a')]=_0x287036['body'][_0x2f71('0x72')];_0x3fca61[_0x2f71('0x3e')][_0x2f71('0x74')]=_0x3fca61[_0x2f71('0x40')][_0x2f71('0x74')]=_0x287036[_0x2f71('0x5e')][_0x2f71('0x7b')];_0x3fca61[_0x2f71('0x3e')][_0x2f71('0x7c')]=_0x3fca61[_0x2f71('0x40')][_0x2f71('0x75')]=_0x287036['body']['cpassword'];}return db[_0x2f71('0x43')]['create'](_0x3fca61,{'include':[{'model':db[_0x2f71('0x3f')],'as':_0x2f71('0x40')},{'model':db[_0x2f71('0x59')],'as':_0x2f71('0x3e')}]})[_0x2f71('0x22')](function(_0x5b8e69){var _0xfc935a=_0x287036['user'][_0x2f71('0x36')]({'plain':!![]});if(!_0xfc935a)throw new Error(_0x2f71('0x7d'));if(_0xfc935a[_0x2f71('0x7e')]===_0x2f71('0x74')){var _0x253e68=_0x5b8e69[_0x2f71('0x36')]({'plain':!![]});return db[_0x2f71('0x7f')][_0x2f71('0x60')]({'where':{'name':_0x2f71('0x37'),'userProfileId':_0xfc935a[_0x2f71('0x80')]},'raw':!![]})[_0x2f71('0x22')](function(_0x57ca34){if(_0x57ca34&&_0x57ca34[_0x2f71('0x81')]===0x0){return db[_0x2f71('0x38')]['create']({'name':_0x253e68[_0x2f71('0x3b')],'resourceId':_0x253e68['id'],'type':_0x57ca34[_0x2f71('0x3b')],'sectionId':_0x57ca34['id']},{})[_0x2f71('0x22')](function(){return _0x5b8e69;});}else{return _0x5b8e69;}})[_0x2f71('0x2b')](function(_0x54e511){logger['error'](_0x2f71('0x82'),_0x54e511);throw _0x54e511;});}return _0x5b8e69;})[_0x2f71('0x22')](respondWithResult(_0x1cded6,0xc9))[_0x2f71('0x2b')](handleError(_0x1cded6,null));};exports['getImap']=function(_0x72b509,_0x3aac4c,_0x4b65fe){return db[_0x2f71('0x43')][_0x2f71('0x83')]({'where':{'id':_0x72b509[_0x2f71('0x58')]['id']}})[_0x2f71('0x22')](handleEntityNotFound(_0x3aac4c,null))[_0x2f71('0x22')](function(_0x15d17f){if(_0x15d17f){return _0x15d17f[_0x2f71('0x84')]();}return null;})[_0x2f71('0x22')](respondWithResult(_0x3aac4c,null))[_0x2f71('0x2b')](handleError(_0x3aac4c,null));};exports[_0x2f71('0x85')]=function(_0xd24950,_0x59b3d3,_0x63620){if(_0xd24950[_0x2f71('0x5e')]['id']){delete _0xd24950[_0x2f71('0x5e')]['id'];}return db[_0x2f71('0x43')][_0x2f71('0x60')]({'where':{'id':_0xd24950[_0x2f71('0x58')]['id']}})['then'](handleEntityNotFound(_0x59b3d3,null))[_0x2f71('0x22')](function(_0x54f0c4){if(_0x54f0c4){_0xd24950[_0x2f71('0x5e')][_0x2f71('0x61')]=_0x54f0c4['id'];return db['MailServerIn'][_0x2f71('0x62')](_0xd24950[_0x2f71('0x5e')]);}})[_0x2f71('0x22')](respondWithResult(_0x59b3d3,null))[_0x2f71('0x2b')](handleError(_0x59b3d3,null));};exports[_0x2f71('0x86')]=function(_0x314201,_0x34e252,_0x4e60e6){return db[_0x2f71('0x43')][_0x2f71('0x83')]({'where':{'id':_0x314201['params']['id']}})['then'](handleEntityNotFound(_0x34e252,null))[_0x2f71('0x22')](function(_0x21d1ea){if(_0x21d1ea){return _0x21d1ea[_0x2f71('0x87')](null);}return null;})[_0x2f71('0x22')](respondWithStatusCode(_0x34e252,null))[_0x2f71('0x2b')](handleError(_0x34e252,null));};exports[_0x2f71('0x88')]=function(_0x3b641f,_0x5af77f,_0x434186){return db[_0x2f71('0x43')][_0x2f71('0x83')]({'where':{'id':_0x3b641f['params']['id']}})[_0x2f71('0x22')](handleEntityNotFound(_0x5af77f,null))[_0x2f71('0x22')](function(_0x3bb809){if(_0x3bb809){return _0x3bb809[_0x2f71('0x88')]();}return null;})['then'](respondWithResult(_0x5af77f,null))[_0x2f71('0x2b')](handleError(_0x5af77f,null));};exports[_0x2f71('0x89')]=function(_0x4a42c9,_0x2d3c18,_0x5b782c){if(_0x4a42c9[_0x2f71('0x5e')]['id']){delete _0x4a42c9[_0x2f71('0x5e')]['id'];}return db[_0x2f71('0x43')][_0x2f71('0x60')]({'where':{'id':_0x4a42c9['params']['id']}})[_0x2f71('0x22')](handleEntityNotFound(_0x2d3c18,null))[_0x2f71('0x22')](function(_0x4212c1){if(_0x4212c1){_0x4a42c9[_0x2f71('0x5e')][_0x2f71('0x61')]=_0x4212c1['id'];return db[_0x2f71('0x3f')][_0x2f71('0x62')](_0x4a42c9[_0x2f71('0x5e')]);}})[_0x2f71('0x22')](respondWithResult(_0x2d3c18,null))[_0x2f71('0x2b')](handleError(_0x2d3c18,null));};exports['removeSmtp']=function(_0x523243,_0x1e3ffa,_0x54fc77){return db[_0x2f71('0x43')]['findOne']({'where':{'id':_0x523243[_0x2f71('0x58')]['id']}})[_0x2f71('0x22')](handleEntityNotFound(_0x1e3ffa,null))[_0x2f71('0x22')](function(_0x296e51){if(_0x296e51){return _0x296e51['setSmtp'](null);}return null;})[_0x2f71('0x22')](respondWithStatusCode(_0x1e3ffa,null))[_0x2f71('0x2b')](handleError(_0x1e3ffa,null));};exports[_0x2f71('0x8a')]=function(_0x2515de,_0xda08fc,_0x558b99){return db[_0x2f71('0x8b')][_0x2f71('0x60')]({'where':{'id':_0x2515de[_0x2f71('0x58')]['id']}})[_0x2f71('0x22')](handleEntityNotFound(_0xda08fc,null))[_0x2f71('0x22')](function(_0x5a19f8){if(_0x5a19f8){return _0x5a19f8[_0x2f71('0x8a')](_0x2515de[_0x2f71('0x5e')]['ids'],_[_0x2f71('0x8c')](_0x2515de['body'],[_0x2f71('0x68'),'id'])||{});}})[_0x2f71('0x22')](respondWithResult(_0xda08fc,null))[_0x2f71('0x2b')](handleError(_0xda08fc,null));};exports[_0x2f71('0x8d')]=function(_0x226c4f,_0x4c6102,_0x4a2c10){var _0x3e581e={'raw':![],'where':{}};var _0x154ffc={};var _0xbceca={'count':0x0,'rows':[]};return db['MailAccount'][_0x2f71('0x83')]({'where':{'id':_0x226c4f[_0x2f71('0x58')]['id']}})[_0x2f71('0x22')](handleEntityNotFound(_0x4c6102,null))[_0x2f71('0x22')](function(_0x2c3f62){if(_0x2c3f62){_0x154ffc[_0x2f71('0x46')]=_[_0x2f71('0x48')](db['MailInteraction']['rawAttributes']);_0x154ffc[_0x2f71('0x47')]=_['keys'](_0x226c4f['query']);_0x154ffc[_0x2f71('0x49')]=_[_0x2f71('0x4a')](_0x154ffc[_0x2f71('0x46')],_0x154ffc['query']);_0x3e581e[_0x2f71('0x4c')]=_['intersection'](_0x154ffc[_0x2f71('0x46')],qs[_0x2f71('0x4b')](_0x226c4f[_0x2f71('0x47')][_0x2f71('0x4b')]));_0x3e581e[_0x2f71('0x4c')]=_0x3e581e[_0x2f71('0x4c')][_0x2f71('0x5b')]?_0x3e581e[_0x2f71('0x4c')]:_0x154ffc[_0x2f71('0x46')];if(!_0x226c4f[_0x2f71('0x47')][_0x2f71('0x4d')](_0x2f71('0x4e'))){_0x3e581e[_0x2f71('0x30')]=qs[_0x2f71('0x30')](_0x226c4f[_0x2f71('0x47')][_0x2f71('0x30')]);_0x3e581e[_0x2f71('0x2f')]=qs['offset'](_0x226c4f[_0x2f71('0x47')]['offset']);}_0x3e581e['order']=qs[_0x2f71('0x4f')](_0x226c4f[_0x2f71('0x47')][_0x2f71('0x4f')]);_0x3e581e[_0x2f71('0x50')]=qs[_0x2f71('0x49')](_[_0x2f71('0x51')](_0x226c4f[_0x2f71('0x47')],_0x154ffc[_0x2f71('0x49')]));_0x3e581e['where']['MailAccountId']=_0x2c3f62['id'];if(_0x226c4f[_0x2f71('0x47')][_0x2f71('0x52')]){_0x3e581e[_0x2f71('0x50')]=_[_0x2f71('0x54')](_0x3e581e[_0x2f71('0x50')],{'$or':_[_0x2f71('0x42')](_0x3e581e['attributes'],function(_0x5817d4){var _0x95ca78={};_0x95ca78[_0x5817d4]={'$like':'%'+_0x226c4f[_0x2f71('0x47')]['filter']+'%'};return _0x95ca78;})});}_0x3e581e=_['merge']({},_0x3e581e,_0x226c4f[_0x2f71('0x5d')]);return db[_0x2f71('0x8b')][_0x2f71('0x32')]({'where':_0x3e581e[_0x2f71('0x50')]})[_0x2f71('0x22')](function(_0x480996){_0xbceca['count']=_0x480996;if(_0x226c4f[_0x2f71('0x47')][_0x2f71('0x5c')]){_0x3e581e[_0x2f71('0x55')]=[{'model':db[_0x2f71('0x8e')],'as':_0x2f71('0x8f'),'required':![]},{'model':db[_0x2f71('0x90')],'as':_0x2f71('0x91'),'attributes':[_0x2f71('0x3b'),_0x2f71('0x92'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x2f71('0x93'),'attributes':['id','name','color'],'where':_0x226c4f[_0x2f71('0x47')][_0x2f71('0x94')]?{'id':_0x226c4f[_0x2f71('0x47')][_0x2f71('0x94')]}:undefined,'required':_0x226c4f[_0x2f71('0x47')][_0x2f71('0x94')]?!![]:![]}];}return db[_0x2f71('0x8b')][_0x2f71('0x56')](_0x3e581e);})[_0x2f71('0x22')](function(_0x14de8c){_0xbceca[_0x2f71('0x66')]=_0x14de8c;return _0xbceca;});}})['then'](respondWithFilteredResult(_0x4c6102,_0x3e581e))[_0x2f71('0x2b')](handleError(_0x4c6102,null));};exports['addApplications']=function(_0x1171d3,_0x4db39b,_0x49b09d){return db[_0x2f71('0x43')][_0x2f71('0x83')]({'where':{'id':_0x1171d3[_0x2f71('0x58')]['id']}})[_0x2f71('0x22')](handleEntityNotFound(_0x4db39b,null))[_0x2f71('0x22')](function(_0x1ead1e){if(_0x1ead1e){return db[_0x2f71('0x95')][_0x2f71('0x96')](function(_0x287962){return db[_0x2f71('0x97')][_0x2f71('0x98')]({'where':{'MailAccountId':_0x1171d3['params']['id']},'transaction':_0x287962})['then'](function(_0x532b17){var _0x28fedf=_[_0x2f71('0x42')](_0x1171d3[_0x2f71('0x5e')],function(_0xc52132){_0xc52132[_0x2f71('0x61')]=_0x1171d3[_0x2f71('0x58')]['id'];return _0xc52132;});return db[_0x2f71('0x97')][_0x2f71('0x99')](_0x28fedf,{'transaction':_0x287962});});})['then'](function(){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x1171d3[_0x2f71('0x58')]['id']},'order':_0x2f71('0x9a')});});}})['then'](respondWithResult(_0x4db39b,null))[_0x2f71('0x2b')](handleError(_0x4db39b,null));};exports['getApplications']=function(_0x406cc8,_0x59cb69,_0x4d2490){var _0x58e05f={};var _0x26fd50={};var _0x4d2871;var _0x10ce85;return db['MailAccount'][_0x2f71('0x83')]({'where':{'id':_0x406cc8[_0x2f71('0x58')]['id']}})[_0x2f71('0x22')](handleEntityNotFound(_0x59cb69,null))['then'](function(_0x3fe9b4){if(_0x3fe9b4){_0x4d2871=_0x3fe9b4;_0x26fd50[_0x2f71('0x46')]=_[_0x2f71('0x48')](db['MailApplication'][_0x2f71('0x44')]);_0x26fd50[_0x2f71('0x47')]=_['keys'](_0x406cc8[_0x2f71('0x47')]);_0x26fd50[_0x2f71('0x49')]=_[_0x2f71('0x4a')](_0x26fd50[_0x2f71('0x46')],_0x26fd50[_0x2f71('0x47')]);_0x58e05f['attributes']=_[_0x2f71('0x4a')](_0x26fd50['model'],qs['fields'](_0x406cc8[_0x2f71('0x47')][_0x2f71('0x4b')]));_0x58e05f[_0x2f71('0x4c')]=_0x58e05f[_0x2f71('0x4c')]['length']?_0x58e05f['attributes']:_0x26fd50[_0x2f71('0x46')];_0x58e05f[_0x2f71('0x65')]=qs[_0x2f71('0x4f')](_0x406cc8[_0x2f71('0x47')][_0x2f71('0x4f')]);_0x58e05f[_0x2f71('0x50')]=qs[_0x2f71('0x49')](_[_0x2f71('0x51')](_0x406cc8[_0x2f71('0x47')],_0x26fd50['filters']));if(_0x406cc8[_0x2f71('0x47')][_0x2f71('0x52')]){_0x58e05f['where']=_[_0x2f71('0x54')](_0x58e05f['where'],{'$or':_[_0x2f71('0x42')](_0x58e05f[_0x2f71('0x4c')],function(_0x3d866b){var _0x3c1fe6={};_0x3c1fe6[_0x3d866b]={'$like':'%'+_0x406cc8[_0x2f71('0x47')][_0x2f71('0x52')]+'%'};return _0x3c1fe6;})});}_0x58e05f=_[_0x2f71('0x54')]({},_0x58e05f,_0x406cc8['options']);return _0x4d2871[_0x2f71('0x9b')](_0x58e05f);}})[_0x2f71('0x22')](function(_0x11bdac){if(_0x11bdac){_0x10ce85=_0x11bdac['length'];if(!_0x406cc8[_0x2f71('0x47')][_0x2f71('0x4d')](_0x2f71('0x4e'))){_0x58e05f[_0x2f71('0x30')]=qs['limit'](_0x406cc8[_0x2f71('0x47')][_0x2f71('0x30')]);_0x58e05f[_0x2f71('0x2f')]=qs[_0x2f71('0x2f')](_0x406cc8['query']['offset']);}return _0x4d2871[_0x2f71('0x9b')](_0x58e05f);}})[_0x2f71('0x22')](function(_0x89dff7){if(_0x89dff7){return _0x89dff7?{'count':_0x10ce85,'rows':_0x89dff7}:null;}})[_0x2f71('0x22')](respondWithResult(_0x59cb69,null))[_0x2f71('0x2b')](handleError(_0x59cb69,null));};exports[_0x2f71('0x9c')]=function(_0x524d0f,_0x17bd25,_0x43d986){var _0x3f1603={'raw':!![],'where':{}};var _0x4d59f0={};var _0x4541fa={'count':0x0,'rows':[]};return db['MailAccount'][_0x2f71('0x83')]({'where':{'id':_0x524d0f[_0x2f71('0x58')]['id']}})[_0x2f71('0x22')](handleEntityNotFound(_0x17bd25,null))[_0x2f71('0x22')](function(_0xcd9d5a){if(_0xcd9d5a){_0x4d59f0[_0x2f71('0x46')]=_['keys'](db[_0x2f71('0x9d')]['rawAttributes']);_0x4d59f0[_0x2f71('0x47')]=_[_0x2f71('0x48')](_0x524d0f['query']);_0x4d59f0['filters']=_[_0x2f71('0x4a')](_0x4d59f0[_0x2f71('0x46')],_0x4d59f0[_0x2f71('0x47')]);_0x3f1603[_0x2f71('0x4c')]=_['intersection'](_0x4d59f0['model'],qs['fields'](_0x524d0f[_0x2f71('0x47')][_0x2f71('0x4b')]));_0x3f1603[_0x2f71('0x4c')]=_0x3f1603[_0x2f71('0x4c')][_0x2f71('0x5b')]?_0x3f1603[_0x2f71('0x4c')]:_0x4d59f0['model'];if(!_0x524d0f['query'][_0x2f71('0x4d')](_0x2f71('0x4e'))){_0x3f1603[_0x2f71('0x30')]=qs['limit'](_0x524d0f[_0x2f71('0x47')][_0x2f71('0x30')]);_0x3f1603[_0x2f71('0x2f')]=qs[_0x2f71('0x2f')](_0x524d0f['query'][_0x2f71('0x2f')]);}_0x3f1603[_0x2f71('0x65')]=qs[_0x2f71('0x4f')](_0x524d0f[_0x2f71('0x47')]['sort']);_0x3f1603[_0x2f71('0x50')]=qs['filters'](_[_0x2f71('0x51')](_0x524d0f[_0x2f71('0x47')],_0x4d59f0['filters']));_0x3f1603[_0x2f71('0x50')][_0x2f71('0x61')]=_0xcd9d5a['id'];if(_0x524d0f['query'][_0x2f71('0x52')]){_0x3f1603[_0x2f71('0x50')]=_[_0x2f71('0x54')](_0x3f1603[_0x2f71('0x50')],{'$or':_[_0x2f71('0x42')](_0x3f1603['attributes'],function(_0xb6184d){var _0x31b7e3={};_0x31b7e3[_0xb6184d]={'$like':'%'+_0x524d0f[_0x2f71('0x47')][_0x2f71('0x52')]+'%'};return _0x31b7e3;})});}if(_0x524d0f[_0x2f71('0x47')][_0x2f71('0x9e')]){var _0x355514=_0x524d0f[_0x2f71('0x47')]['$gte'][_0x2f71('0x9f')](',');var _0x22ab46={};_0x22ab46[_0x355514[0x0]]={'$gte':moment(_0x355514[0x1])[_0x2f71('0xa0')](_0x2f71('0xa1'))};_0x3f1603[_0x2f71('0x50')]=_['merge'](_0x3f1603[_0x2f71('0x50')],_0x22ab46);}_0x3f1603=_['merge']({},_0x3f1603,_0x524d0f[_0x2f71('0x5d')]);return db['MailMessage'][_0x2f71('0x32')]({'where':_0x3f1603[_0x2f71('0x50')]})['then'](function(_0x1b513f){_0x4541fa[_0x2f71('0x32')]=_0x1b513f;if(_0x524d0f[_0x2f71('0x47')][_0x2f71('0x5c')]){_0x3f1603[_0x2f71('0x55')]=[{'all':!![]}];}return db['MailMessage'][_0x2f71('0x56')](_0x3f1603);})[_0x2f71('0x22')](function(_0x2d96f4){if(_0x524d0f['query'][_0x2f71('0xa2')]===_0x2f71('0xa3')){for(var _0x17df95=0x0;_0x17df95<_0x2d96f4[_0x2f71('0x5b')];_0x17df95++){_0x2d96f4[_0x17df95][_0x2f71('0x5e')]=juice(_0x2d96f4[_0x17df95][_0x2f71('0x5e')]);}}_0x4541fa[_0x2f71('0x66')]=_0x2d96f4;return _0x4541fa;});}})[_0x2f71('0x22')](respondWithFilteredResult(_0x17bd25,_0x3f1603))['catch'](handleError(_0x17bd25,null));};exports[_0x2f71('0x3c')]=function(_0x92146a,_0x1780af,_0x4ba60b){var _0x5196d2,_0x42559a={},_0x13d7a7;if(_0x92146a[_0x2f71('0x5e')]['to']){_0x13d7a7=_0x92146a[_0x2f71('0x5e')]['to'][_0x2f71('0x9f')](',')[0x0];}return db[_0x2f71('0x43')][_0x2f71('0x60')]({'where':{'id':_0x92146a[_0x2f71('0x58')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x2f71('0x8e')],'as':_0x2f71('0xa4'),'where':{'email':_0x13d7a7},'limit':0x1,'order':[[_0x2f71('0xa5'),_0x2f71('0xa6')]]}]},{'model':db[_0x2f71('0x3f')],'as':_0x2f71('0x40'),'raw':!![]}]})[_0x2f71('0x22')](handleEntityNotFound(_0x1780af,null))['then'](function(_0x52b181){if(_0x52b181){_0x5196d2=_0x52b181;if(_0x52b181[_0x2f71('0x40')]){if(_[_0x2f71('0x6f')](_0x92146a[_0x2f71('0x5e')]['from'])){_0x92146a['body'][_0x2f71('0xa7')]=util[_0x2f71('0xa0')]('%s\x20<%s>',_0x52b181['name'],_0x52b181['email']||_0x52b181[_0x2f71('0x40')]['user']);}if(_0x92146a[_0x2f71('0x5e')][_0x2f71('0xa8')]&&_0x92146a['body'][_0x2f71('0xa8')][_0x2f71('0x5b')]){for(var _0x25fd00=0x0;_0x25fd00<_0x92146a[_0x2f71('0x5e')][_0x2f71('0xa8')][_0x2f71('0x5b')];_0x25fd00+=0x1){_0x92146a[_0x2f71('0x5e')][_0x2f71('0xa8')][_0x25fd00]={'filename':_0x92146a[_0x2f71('0x5e')][_0x2f71('0xa8')][_0x25fd00][_0x2f71('0x3b')],'path':path[_0x2f71('0xa9')](config[_0x2f71('0xaa')],_0x2f71('0xab'),_0x92146a[_0x2f71('0x5e')][_0x2f71('0xa8')][_0x25fd00]['basename'])};}}var _0x3bc88a={'tls':{'rejectUnauthorized':![]}};if(_[_0x2f71('0x6f')](_0x52b181['Smtp'][_0x2f71('0x7a')])){if(_0x52b181[_0x2f71('0x40')][_0x2f71('0x77')]){_0x3bc88a[_0x2f71('0xac')]={'user':_0x52b181[_0x2f71('0x40')][_0x2f71('0x74')],'pass':_0x52b181[_0x2f71('0x40')][_0x2f71('0x75')]};}_0x3bc88a[_0x2f71('0x78')]=_0x52b181['Smtp'][_0x2f71('0x78')];_0x3bc88a[_0x2f71('0x79')]=_0x52b181[_0x2f71('0x40')][_0x2f71('0x79')];_0x3bc88a[_0x2f71('0xad')]=_0x52b181[_0x2f71('0x40')][_0x2f71('0xad')];}else{_0x3bc88a[_0x2f71('0x7a')]=_0x52b181['Smtp']['service'];_0x3bc88a[_0x2f71('0xac')]={'user':_0x52b181[_0x2f71('0x40')]['user'],'pass':_0x52b181['Smtp'][_0x2f71('0x75')]};}return respondWithRpcPromise(_0x2f71('0xae'),_0x2f71('0xaf'),{'account':_0x3bc88a,'message':_0x92146a[_0x2f71('0x5e')]});}else{throw new Error('List\x20not\x20found');}}})[_0x2f71('0x22')](function(_0x14fea3){if(_0x14fea3){_0x42559a=_0x14fea3;if(_0x5196d2[_0x2f71('0xb0')]){if(_0x5196d2[_0x2f71('0xb0')][_0x2f71('0xa4')][_0x2f71('0x5b')]){return _0x5196d2[_0x2f71('0xb0')][_0x2f71('0xa4')][0x0];}else{return db['CmContact'][_0x2f71('0x62')](_[_0x2f71('0x1a')](_0x92146a[_0x2f71('0x5e')],{'firstName':_0x92146a[_0x2f71('0x5e')]['to'],'email':_0x92146a[_0x2f71('0x5e')]['to'],'phone':_0x92146a['body']['to'],'ListId':_0x5196d2[_0x2f71('0x6e')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x2f71('0x22')](function(_0x3253f7){if(_0x3253f7){var _0x581c62={'UserId':_0x92146a['user']['id'],'ContactId':_0x3253f7['id'],'MailAccountId':_0x5196d2['id'],'inReplyTo':_0x42559a[_0x2f71('0xb1')],'to':_0x92146a[_0x2f71('0x5e')][_0x2f71('0xa7')],'cc':_0x92146a[_0x2f71('0x5e')]['cc'],'subject':_0x92146a[_0x2f71('0x5e')][_0x2f71('0xb2')],'attach':_0x92146a[_0x2f71('0x5e')][_0x2f71('0xb3')],'firstMsgDirection':_0x2f71('0xb4'),'lastMsgAt':moment()[_0x2f71('0xa0')](_0x2f71('0xa1')),'lastMsgDirection':_0x2f71('0xb4'),'Messages':[_[_0x2f71('0x54')](_0x92146a[_0x2f71('0x5e')],{'messageId':_0x42559a[_0x2f71('0xb1')],'sentAt':moment()[_0x2f71('0xa0')](_0x2f71('0xa1')),'read':!![],'MailAccountId':_0x5196d2['id'],'UserId':_0x92146a[_0x2f71('0x74')]['id'],'ContactId':_0x3253f7['id']})]};if(_0x92146a[_0x2f71('0x5e')][_0x2f71('0xb5')]){_0x581c62=_['merge'](_0x581c62,_0x92146a[_0x2f71('0x5e')][_0x2f71('0xb5')]);}return db[_0x2f71('0x8b')][_0x2f71('0x62')](_0x581c62,{'include':[{'model':db[_0x2f71('0x9d')],'as':_0x2f71('0xb6')}]});}})[_0x2f71('0x22')](respondWithResult(_0x1780af,null))[_0x2f71('0x2b')](handleError(_0x1780af,null));};exports[_0x2f71('0xb7')]=function(_0x419a5a,_0x235c8d,_0x285954){return db['MailAccount'][_0x2f71('0x60')]({'where':{'id':_0x419a5a[_0x2f71('0x58')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x2f71('0x40'),'raw':!![]}]})[_0x2f71('0x22')](handleEntityNotFound(_0x235c8d,null))[_0x2f71('0x22')](function(_0x10fde8){if(_0x10fde8&&_0x10fde8[_0x2f71('0x40')]){var _0xb2640b={'id':_0x10fde8['id'],'tls':{'rejectUnauthorized':![]}};if(_0x10fde8[_0x2f71('0x40')]['service']){_0xb2640b['service']=_0x10fde8[_0x2f71('0x40')][_0x2f71('0x7a')];}else{_0xb2640b[_0x2f71('0x78')]=_0x10fde8[_0x2f71('0x40')][_0x2f71('0x78')];_0xb2640b[_0x2f71('0x79')]=_0x10fde8[_0x2f71('0x40')][_0x2f71('0x79')];_0xb2640b['secure']=_0x10fde8['Smtp'][_0x2f71('0xad')];}if(_0x10fde8[_0x2f71('0x40')][_0x2f71('0x77')]){_0xb2640b[_0x2f71('0xac')]={'user':_0x10fde8['Smtp'][_0x2f71('0x74')],'pass':_0x10fde8[_0x2f71('0x40')][_0x2f71('0x75')]};}return respondWithRpcPromise(_0x2f71('0xb8'),'verifySmtp',{'account':_0xb2640b});}})[_0x2f71('0x22')](respondWithResult(_0x235c8d,null))['catch'](handleError(_0x235c8d,null));};exports[_0x2f71('0x98')]=function(_0x5909c4,_0x36ec19){return db[_0x2f71('0x43')][_0x2f71('0x60')]({'where':{'id':_0x5909c4['params']['id']}})[_0x2f71('0x22')](handleEntityNotFound(_0x36ec19,null))[_0x2f71('0x22')](function(_0x4f9cb4){if(_0x4f9cb4&&_0x4f9cb4[_0x2f71('0x7a')]){throw new db[(_0x2f71('0xb9'))][(_0x2f71('0xba'))](_0x2f71('0xbb'));}return _0x4f9cb4;})['then'](removeEntity(_0x36ec19,null))[_0x2f71('0x2b')](handleError(_0x36ec19,null));};exports[_0x2f71('0xbc')]=function(_0x326345,_0x1f9641,_0x206c64){return db[_0x2f71('0x43')][_0x2f71('0x60')]({'where':{'id':_0x326345[_0x2f71('0x58')]['id']}})[_0x2f71('0x22')](handleEntityNotFound(_0x1f9641,null))['then'](function(_0x67b76d){if(_0x67b76d){return _0x67b76d[_0x2f71('0xbc')](_0x326345[_0x2f71('0x5e')][_0x2f71('0x68')],_[_0x2f71('0x8c')](_0x326345[_0x2f71('0x5e')],['ids','id'])||{})[_0x2f71('0xbd')](function(_0x1178da){for(var _0x1cea52=0x0;_0x1cea52<_0x326345[_0x2f71('0x5e')][_0x2f71('0x68')]['length'];_0x1cea52+=0x1){socket['emit'](_0x2f71('0xbe'),{'UserId':_0x326345[_0x2f71('0x5e')][_0x2f71('0x68')][_0x1cea52],'MailAccountId':_0x326345['params']['id']});}return _0x1178da;});}})[_0x2f71('0x22')](respondWithResult(_0x1f9641,null))[_0x2f71('0x2b')](handleError(_0x1f9641,null));};exports[_0x2f71('0xbf')]=function(_0x314552,_0x3782b5,_0x19c7f5){return db[_0x2f71('0x43')][_0x2f71('0x60')]({'where':{'id':_0x314552[_0x2f71('0x58')]['id']}})[_0x2f71('0x22')](handleEntityNotFound(_0x3782b5,null))[_0x2f71('0x22')](function(_0x2e9d49){if(_0x2e9d49){return _0x2e9d49[_0x2f71('0xbf')](_0x314552[_0x2f71('0x47')][_0x2f71('0x68')])[_0x2f71('0x22')](function(){if(_['isArray'](_0x314552[_0x2f71('0x47')][_0x2f71('0x68')])){for(var _0x9dd9f1=0x0;_0x9dd9f1<_0x314552[_0x2f71('0x47')]['ids'][_0x2f71('0x5b')];_0x9dd9f1+=0x1){socket[_0x2f71('0xc0')](_0x2f71('0xc1'),{'UserId':Number(_0x314552[_0x2f71('0x47')][_0x2f71('0x68')][_0x9dd9f1]),'MailAccountId':Number(_0x314552[_0x2f71('0x58')]['id'])});}}else{socket['emit'](_0x2f71('0xc1'),{'UserId':Number(_0x314552[_0x2f71('0x47')][_0x2f71('0x68')]),'MailAccountId':Number(_0x314552['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3782b5,null))[_0x2f71('0x2b')](handleError(_0x3782b5,null));};exports['getAgents']=function(_0x2c9238,_0x4159b9,_0x494805){var _0x30adef={};var _0x13bedb={};var _0xf5fda4;var _0x19470f;return db[_0x2f71('0x43')][_0x2f71('0x83')]({'where':{'id':_0x2c9238[_0x2f71('0x58')]['id']}})[_0x2f71('0x22')](handleEntityNotFound(_0x4159b9,null))[_0x2f71('0x22')](function(_0x476a93){if(_0x476a93){_0xf5fda4=_0x476a93;_0x13bedb['model']=_[_0x2f71('0x48')](db[_0x2f71('0x90')][_0x2f71('0x44')]);_0x13bedb[_0x2f71('0x47')]=_['keys'](_0x2c9238['query']);_0x13bedb[_0x2f71('0x49')]=_[_0x2f71('0x4a')](_0x13bedb['model'],_0x13bedb[_0x2f71('0x47')]);_0x30adef['attributes']=_[_0x2f71('0x4a')](_0x13bedb[_0x2f71('0x46')],qs[_0x2f71('0x4b')](_0x2c9238['query']['fields']));_0x30adef[_0x2f71('0x4c')]=_0x30adef[_0x2f71('0x4c')]['length']?_0x30adef[_0x2f71('0x4c')]:_0x13bedb['model'];_0x30adef[_0x2f71('0x65')]=qs['sort'](_0x2c9238['query'][_0x2f71('0x4f')]);_0x30adef['where']=qs['filters'](_[_0x2f71('0x51')](_0x2c9238[_0x2f71('0x47')],_0x13bedb[_0x2f71('0x49')]));if(_0x2c9238[_0x2f71('0x47')][_0x2f71('0x52')]){_0x30adef[_0x2f71('0x50')]=_['merge'](_0x30adef['where'],{'$or':_[_0x2f71('0x42')](_0x30adef['attributes'],function(_0x181ca1){var _0x902b3e={};_0x902b3e[_0x181ca1]={'$like':'%'+_0x2c9238[_0x2f71('0x47')][_0x2f71('0x52')]+'%'};return _0x902b3e;})});}_0x30adef=_[_0x2f71('0x54')]({},_0x30adef,_0x2c9238[_0x2f71('0x5d')]);return _0xf5fda4['getAgents'](_0x30adef);}})[_0x2f71('0x22')](function(_0x347ca7){if(_0x347ca7){_0x19470f=_0x347ca7[_0x2f71('0x5b')];if(!_0x2c9238[_0x2f71('0x47')][_0x2f71('0x4d')]('nolimit')){_0x30adef[_0x2f71('0x30')]=qs[_0x2f71('0x30')](_0x2c9238[_0x2f71('0x47')]['limit']);_0x30adef['offset']=qs[_0x2f71('0x2f')](_0x2c9238['query']['offset']);}return _0xf5fda4[_0x2f71('0xc2')](_0x30adef);}})[_0x2f71('0x22')](function(_0x42e1d8){if(_0x42e1d8){return _0x42e1d8?{'count':_0x19470f,'rows':_0x42e1d8}:null;}})[_0x2f71('0x22')](respondWithResult(_0x4159b9,null))[_0x2f71('0x2b')](handleError(_0x4159b9,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 71bf881..9009456 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 _0xe7fe=['MailAccount','setMaxListeners','save','remove','emit','hook','events','../../mysqldb'];(function(_0x3c4d3a,_0x4a29c8){var _0x549944=function(_0x52b1ad){while(--_0x52b1ad){_0x3c4d3a['push'](_0x3c4d3a['shift']());}};_0x549944(++_0x4a29c8);}(_0xe7fe,0x1de));var _0xee7f=function(_0x424357,_0x9ebe3e){_0x424357=_0x424357-0x0;var _0x29c68e=_0xe7fe[_0x424357];return _0x29c68e;};'use strict';var EventEmitter=require(_0xee7f('0x0'));var MailAccount=require(_0xee7f('0x1'))['db'][_0xee7f('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xee7f('0x3')](0x0);var events={'afterCreate':_0xee7f('0x4'),'afterUpdate':'update','afterDestroy':_0xee7f('0x5')};function emitEvent(_0xba30c1){return function(_0x225226,_0x1bb219,_0x30c7e5){MailAccountEvents[_0xee7f('0x6')](_0xba30c1+':'+_0x225226['id'],_0x225226);MailAccountEvents[_0xee7f('0x6')](_0xba30c1,_0x225226);_0x30c7e5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xee7f('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x9106=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb','MailAccount'];(function(_0x27ca80,_0x20a064){var _0x176f0a=function(_0x1e5d6a){while(--_0x1e5d6a){_0x27ca80['push'](_0x27ca80['shift']());}};_0x176f0a(++_0x20a064);}(_0x9106,0x141));var _0x6910=function(_0x34bd34,_0x1444f7){_0x34bd34=_0x34bd34-0x0;var _0x4e36d6=_0x9106[_0x34bd34];return _0x4e36d6;};'use strict';var EventEmitter=require(_0x6910('0x0'));var MailAccount=require(_0x6910('0x1'))['db'][_0x6910('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x6910('0x3')](0x0);var events={'afterCreate':_0x6910('0x4'),'afterUpdate':_0x6910('0x5'),'afterDestroy':_0x6910('0x6')};function emitEvent(_0x315b62){return function(_0x4597e7,_0x53d05f,_0x206e5c){MailAccountEvents[_0x6910('0x7')](_0x315b62+':'+_0x4597e7['id'],_0x4597e7);MailAccountEvents[_0x6910('0x7')](_0x315b62,_0x4597e7);_0x206e5c(null);};}for(var e in events){if(events[_0x6910('0x8')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index afc94fc..621bd9f 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 _0x2b85=['util','api','moment','bluebird','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','mail_accounts'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x2b85,0x197));var _0x52b8=function(_0xedea8a,_0x1e85b8){_0xedea8a=_0xedea8a-0x0;var _0x51f9f7=_0x2b85[_0xedea8a];return _0x51f9f7;};'use strict';var _=require('lodash');var util=require(_0x52b8('0x0'));var logger=require('../../config/logger')(_0x52b8('0x1'));var moment=require(_0x52b8('0x2'));var BPromise=require(_0x52b8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x52b8('0x4'));var rimraf=require(_0x52b8('0x5'));var config=require(_0x52b8('0x6'));var attributes=require(_0x52b8('0x7'));module[_0x52b8('0x8')]=function(_0x2a9e79,_0x5bde14){return _0x2a9e79[_0x52b8('0x9')]('MailAccount',attributes,{'tableName':_0x52b8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5b7=['path','rimraf','../../config/environment','exports','define','MailAccount','mail_accounts','lodash','util','moment','bluebird','request-promise'];(function(_0x470252,_0xcda744){var _0x8bab4e=function(_0x2e43f2){while(--_0x2e43f2){_0x470252['push'](_0x470252['shift']());}};_0x8bab4e(++_0xcda744);}(_0xd5b7,0xaf));var _0x7d5b=function(_0x56a061,_0x53fb1b){_0x56a061=_0x56a061-0x0;var _0x105fa0=_0xd5b7[_0x56a061];return _0x105fa0;};'use strict';var _=require(_0x7d5b('0x0'));var util=require(_0x7d5b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7d5b('0x2'));var BPromise=require(_0x7d5b('0x3'));var rp=require(_0x7d5b('0x4'));var fs=require('fs');var path=require(_0x7d5b('0x5'));var rimraf=require(_0x7d5b('0x6'));var config=require(_0x7d5b('0x7'));var attributes=require('./mailAccount.attributes');module[_0x7d5b('0x8')]=function(_0x2b45df,_0x2b3c6f){return _0x2b45df[_0x7d5b('0x9')](_0x7d5b('0xa'),attributes,{'tableName':_0x7d5b('0xb'),'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 12990f5..0bf7488 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 _0x63db=['Email','Attachment','Attachments','UserId','unshift','agent','name','Start','startRouting','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetMailAccount','MailAccount','findAll','options','attributes','include','map','model','stringify','ShowMailAccount','find','where','debug','NotifyMailAccount','body','mail','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','Applications','MailServerOut','List','get','account','omit','applications','list','orderBy','priority','asc','push','length','close','autoclose','*,*,*,*','List\x20not\x20found','contact','messageId','subject','format','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','spread','update','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','created','create','originTo','originCc','ChatWebsiteId'];(function(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0x63db,0xd1));var _0xb63d=function(_0x5e608a,_0x39cd42){_0x5e608a=_0x5e608a-0x0;var _0x19a03b=_0x63db[_0x5e608a];return _0x19a03b;};'use strict';var _=require('lodash');var util=require(_0xb63d('0x0'));var moment=require(_0xb63d('0x1'));var BPromise=require(_0xb63d('0x2'));var rs=require(_0xb63d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb63d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb63d('0x5'))('rpc');var config=require(_0xb63d('0x6'));var jayson=require(_0xb63d('0x7'));var client=jayson[_0xb63d('0x8')]['http']({'port':0x232c});config['redis']=_[_0xb63d('0x9')](config['redis'],{'host':_0xb63d('0xa'),'port':0x18eb});var socket=require(_0xb63d('0xb'))(new Redis(config[_0xb63d('0xc')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x3dee53,_0x15150c,_0x4bc077){return new BPromise(function(_0x4995eb,_0x418b1e){return client[_0xb63d('0xd')](_0x3dee53,_0x4bc077)[_0xb63d('0xe')](function(_0x537145){logger['info'](_0xb63d('0xf'),_0x15150c,_0xb63d('0x10'));logger['debug'](_0xb63d('0x11'),_0x15150c,_0xb63d('0x10'),JSON['stringify'](_0x537145));if(_0x537145[_0xb63d('0x12')]){if(_0x537145[_0xb63d('0x12')][_0xb63d('0x13')]===0x1f4){logger[_0xb63d('0x12')](_0xb63d('0xf'),_0x15150c,_0x537145[_0xb63d('0x12')]['message']);return _0x418b1e(_0x537145[_0xb63d('0x12')][_0xb63d('0x14')]);}logger['error'](_0xb63d('0xf'),_0x15150c,_0x537145['error'][_0xb63d('0x14')]);return _0x4995eb(_0x537145['error'][_0xb63d('0x14')]);}else{logger[_0xb63d('0x15')](_0xb63d('0xf'),_0x15150c,_0xb63d('0x10'));_0x4995eb(_0x537145['result'][_0xb63d('0x14')]);}})[_0xb63d('0x16')](function(_0x41eaec){logger[_0xb63d('0x12')]('MailAccount,\x20%s,\x20%s',_0x15150c,_0x41eaec);_0x418b1e(_0x41eaec);});});}exports[_0xb63d('0x17')]=function(_0x3b553c){var _0x133c38=this;return new Promise(function(_0x3b72db,_0x4b2a9a){return db[_0xb63d('0x18')][_0xb63d('0x19')]({'raw':_0x3b553c[_0xb63d('0x1a')]?_0x3b553c[_0xb63d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3b553c['options']?_0x3b553c['options']['where']||null:null,'attributes':_0x3b553c[_0xb63d('0x1a')]?_0x3b553c['options'][_0xb63d('0x1b')]||null:null,'limit':_0x3b553c['options']?_0x3b553c[_0xb63d('0x1a')]['limit']||null:null,'include':_0x3b553c[_0xb63d('0x1a')]?_0x3b553c[_0xb63d('0x1a')][_0xb63d('0x1c')]?_[_0xb63d('0x1d')](_0x3b553c[_0xb63d('0x1a')][_0xb63d('0x1c')],function(_0x102ffc){return{'model':db[_0x102ffc[_0xb63d('0x1e')]],'as':_0x102ffc['as'],'attributes':_0x102ffc[_0xb63d('0x1b')],'include':_0x102ffc[_0xb63d('0x1c')]?_[_0xb63d('0x1d')](_0x102ffc['include'],function(_0x1b43aa){return{'model':db[_0x1b43aa['model']],'as':_0x1b43aa['as'],'attributes':_0x1b43aa[_0xb63d('0x1b')],'include':_0x1b43aa[_0xb63d('0x1c')]?_[_0xb63d('0x1d')](_0x1b43aa[_0xb63d('0x1c')],function(_0x2f5b8c){return{'model':db[_0x2f5b8c[_0xb63d('0x1e')]],'as':_0x2f5b8c['as'],'attributes':_0x2f5b8c[_0xb63d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x946100){logger[_0xb63d('0x15')](_0xb63d('0x17'),_0x3b553c);logger['debug'](_0xb63d('0x17'),_0x3b553c,JSON[_0xb63d('0x1f')](_0x946100));_0x3b72db(_0x946100);})[_0xb63d('0x16')](function(_0x129a8d){logger['error'](_0xb63d('0x17'),_0x129a8d[_0xb63d('0x14')],_0x3b553c);_0x4b2a9a(_0x133c38[_0xb63d('0x12')](0x1f4,_0x129a8d['message']));});});};exports[_0xb63d('0x20')]=function(_0x207993){var _0xe251af=this;return new Promise(function(_0x159547,_0x12a5f0){return db[_0xb63d('0x18')][_0xb63d('0x21')]({'raw':_0x207993[_0xb63d('0x1a')]?_0x207993[_0xb63d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x207993['options']?_0x207993[_0xb63d('0x1a')][_0xb63d('0x22')]||null:null,'attributes':_0x207993[_0xb63d('0x1a')]?_0x207993['options'][_0xb63d('0x1b')]||null:null,'include':_0x207993[_0xb63d('0x1a')]?_0x207993[_0xb63d('0x1a')][_0xb63d('0x1c')]?_[_0xb63d('0x1d')](_0x207993[_0xb63d('0x1a')][_0xb63d('0x1c')],function(_0x4489cf){return{'model':db[_0x4489cf[_0xb63d('0x1e')]],'as':_0x4489cf['as'],'attributes':_0x4489cf[_0xb63d('0x1b')],'include':_0x4489cf[_0xb63d('0x1c')]?_['map'](_0x4489cf[_0xb63d('0x1c')],function(_0x542878){return{'model':db[_0x542878[_0xb63d('0x1e')]],'as':_0x542878['as'],'attributes':_0x542878[_0xb63d('0x1b')],'include':_0x542878[_0xb63d('0x1c')]?_[_0xb63d('0x1d')](_0x542878[_0xb63d('0x1c')],function(_0x26276f){return{'model':db[_0x26276f[_0xb63d('0x1e')]],'as':_0x26276f['as'],'attributes':_0x26276f['attributes']};}):[]};}):[]};}):[]:[]})[_0xb63d('0xe')](function(_0x54bfb1){logger[_0xb63d('0x15')](_0xb63d('0x20'),_0x207993);logger[_0xb63d('0x23')]('ShowMailAccount',_0x207993,JSON[_0xb63d('0x1f')](_0x54bfb1));_0x159547(_0x54bfb1);})[_0xb63d('0x16')](function(_0x36e807){logger[_0xb63d('0x12')](_0xb63d('0x20'),_0x36e807[_0xb63d('0x14')],_0x207993);_0x12a5f0(_0xe251af[_0xb63d('0x12')](0x1f4,_0x36e807[_0xb63d('0x14')]));});});};exports[_0xb63d('0x24')]=function(_0xcafff3){var _0x19358e=this;return new Promise(function(_0xc07ce8,_0x1ab785){var _0x2ff946={'body':_0xcafff3[_0xb63d('0x25')],'channel':_0xb63d('0x26')};var _0x2b1f4a=_['difference'](_[_0xb63d('0x27')](db['CmContact'][_0xb63d('0x28')]),[_0xb63d('0x29'),_0xb63d('0x2a'),_0xb63d('0x2b'),_0xb63d('0x2c')]);var _0x203eab=![];if(_0xcafff3[_0xb63d('0x25')]['id']){delete _0xcafff3[_0xb63d('0x25')]['id'];}if(_[_0xb63d('0x2d')](_0xcafff3['body'][_0xb63d('0x2e')])){return _0x1ab785(_0x19358e[_0xb63d('0x12')](0x1f4,_0xb63d('0x2f')));}if(_[_0xb63d('0x2d')](_0xcafff3[_0xb63d('0x25')][_0xb63d('0x25')])||_0xcafff3['body']['body']===''){return _0x1ab785(_0x19358e[_0xb63d('0x12')](0x1f4,_0xb63d('0x30')));}if(_[_0xb63d('0x2d')](_0xcafff3[_0xb63d('0x25')]['mapKey'])){return _0x1ab785(_0x19358e[_0xb63d('0x12')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2b1f4a));}if(!_[_0xb63d('0x31')](_0x2b1f4a,_0xcafff3['body'][_0xb63d('0x32')])){return _0x1ab785(_0x19358e[_0xb63d('0x12')](0x1f4,_0xb63d('0x33')+_0x2b1f4a));}var _0x14a41b={};_0x14a41b[_0xcafff3[_0xb63d('0x25')]['mapKey']]=_0xcafff3['body'][_0xb63d('0x2e')];return db[_0xb63d('0x18')][_0xb63d('0x21')]({'where':{'id':_0xcafff3['account']['id']},'include':[{'model':db[_0xb63d('0x34')],'as':'List','include':[{'model':db[_0xb63d('0x35')],'as':_0xb63d('0x36'),'where':_0x14a41b,'limit':0x1,'order':[[_0xb63d('0x2a'),_0xb63d('0x37')]]}]},{'model':db['MailApplication'],'as':_0xb63d('0x38')},{'model':db[_0xb63d('0x39')],'as':'Smtp'}]})['then'](function(_0x4c0f7c){if(_0x4c0f7c&&_0x4c0f7c[_0xb63d('0x3a')]){var _0x43ee6e=_0x4c0f7c[_0xb63d('0x3b')]({'plain':!![]});_0x2ff946[_0xb63d('0x3c')]=_[_0xb63d('0x3d')](_0x43ee6e,[_0xb63d('0x38'),_0xb63d('0x3a')]);_0x2ff946[_0xb63d('0x3e')]=_0x43ee6e[_0xb63d('0x38')];_0x2ff946[_0xb63d('0x3f')]=_0x43ee6e[_0xb63d('0x3a')];_0x2ff946[_0xb63d('0x3e')]=_[_0xb63d('0x40')](_0x2ff946[_0xb63d('0x3e')],[_0xb63d('0x41')],[_0xb63d('0x42')]);if(_0x2ff946[_0xb63d('0x3c')]&&_0x2ff946[_0xb63d('0x3c')]['autoclose']){_0x2ff946[_0xb63d('0x3e')][_0xb63d('0x43')]({'id':0x0,'priority':_0x2ff946[_0xb63d('0x3e')][_0xb63d('0x44')]+0x1,'app':_0xb63d('0x45'),'appdata':_0xb63d('0x46'),'interval':_0xb63d('0x47')});}if(_0x2ff946['account'][_0xb63d('0x38')]){delete _0x2ff946[_0xb63d('0x3c')][_0xb63d('0x38')];}if(_0x2ff946['account'][_0xb63d('0x3a')]){delete _0x2ff946[_0xb63d('0x3c')][_0xb63d('0x3a')];}if(_0x43ee6e[_0xb63d('0x3a')][_0xb63d('0x36')][_0xb63d('0x44')]){return _0x43ee6e['List'][_0xb63d('0x36')][0x0];}var _0x414760=_['defaults'](_0xcafff3['body'],{'firstName':_0xcafff3[_0xb63d('0x25')][_0xb63d('0x2e')],'ListId':_0x43ee6e[_0xb63d('0x2c')]});_0x414760[_0xcafff3['body'][_0xb63d('0x32')]]=_0xcafff3[_0xb63d('0x25')][_0xb63d('0x2e')];return db['CmContact']['create'](_0x414760);}else{throw new Error(_0xb63d('0x48'));}})[_0xb63d('0xe')](function(_0x347aee){_0x2ff946[_0xb63d('0x49')]=_0x347aee;if(_0x347aee){if(!_0xcafff3[_0xb63d('0x25')][_0xb63d('0x14')][_0xb63d('0x4a')]){_0xcafff3['body'][_0xb63d('0x14')][_0xb63d('0x4a')]=rs['generate']()+'\x20'+_0xcafff3[_0xb63d('0x25')][_0xb63d('0x14')][_0xb63d('0x2e')];}var _0x5d5564={'ContactId':_0x347aee['id'],'MailAccountId':_0xcafff3['account']['id'],'inReplyTo':_0xcafff3[_0xb63d('0x25')][_0xb63d('0x14')]['messageId'],'to':_0xcafff3['body'][_0xb63d('0x14')][_0xb63d('0x2e')],'cc':_0xcafff3[_0xb63d('0x25')][_0xb63d('0x14')]['cc'],'subject':_0xcafff3['body'][_0xb63d('0x14')][_0xb63d('0x4b')],'attach':_0xcafff3[_0xb63d('0x25')][_0xb63d('0x14')]['attach'],'lastMsgAt':moment()[_0xb63d('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0xb63d('0x4d')]['find']({'where':{'closed':![],'MailAccountId':_0xcafff3[_0xb63d('0x3c')]['id']},'include':[{'model':db[_0xb63d('0x4e')],'as':'Messages','attributes':[_0xb63d('0x4a')],'where':{'messageId':_0xcafff3['body'][_0xb63d('0x14')][_0xb63d('0x4f')]}}]})[_0xb63d('0xe')](function(_0x39aaad){if(_0x39aaad){return[_0x39aaad,![]];}return db[_0xb63d('0x4d')]['create'](_0x5d5564)[_0xb63d('0xe')](function(_0x236fec){return[_0x236fec,!![]];});});}else{throw new Error(_0xb63d('0x50'));}})[_0xb63d('0x51')](function(_0x4e2f76,_0x20f800){if(_0x4e2f76){_0x203eab=_0x20f800;if(!_0x20f800){return _0x4e2f76[_0xb63d('0x52')]({'inReplyTo':_0xcafff3[_0xb63d('0x25')][_0xb63d('0x14')][_0xb63d('0x4a')],'to':_0xcafff3[_0xb63d('0x25')][_0xb63d('0x14')][_0xb63d('0x2e')],'cc':_0xcafff3['body'][_0xb63d('0x14')]['cc'],'subject':_0xcafff3['body'][_0xb63d('0x14')][_0xb63d('0x4b')],'attach':_0x4e2f76[_0xb63d('0x53')]?_0x4e2f76[_0xb63d('0x53')]:_0xcafff3['body'][_0xb63d('0x14')][_0xb63d('0x53')],'substatus':null,'substatusAt':moment()[_0xb63d('0x4c')](_0xb63d('0x54')),'lastMsgAt':moment()[_0xb63d('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x4e2f76;}}})[_0xb63d('0xe')](function(_0x141939){_0x2ff946[_0xb63d('0x55')]=_0x141939[_0xb63d('0x3b')]({'plain':!![]});_0x2ff946[_0xb63d('0x55')][_0xb63d('0x56')]=_0x203eab;return db[_0xb63d('0x4e')][_0xb63d('0x57')]({'body':_0xcafff3[_0xb63d('0x25')]['body'],'MailAccountId':_0xcafff3['account']['id'],'MailInteractionId':_0x141939['id'],'direction':'in','ContactId':_0x2ff946[_0xb63d('0x49')]['id'],'messageId':_0xcafff3[_0xb63d('0x25')][_0xb63d('0x14')][_0xb63d('0x4a')],'from':_0xcafff3['body']['message'][_0xb63d('0x2e')],'to':_0xcafff3[_0xb63d('0x25')][_0xb63d('0x14')]['to'],'cc':_0xcafff3[_0xb63d('0x25')]['message']['cc'],'subject':_0xcafff3['body'][_0xb63d('0x14')]['subject'],'attach':_0xcafff3[_0xb63d('0x25')][_0xb63d('0x14')]['attach'],'Attachments':_0xcafff3[_0xb63d('0x25')][_0xb63d('0x14')]['attachments'],'originTo':_0xcafff3[_0xb63d('0x25')]['message'][_0xb63d('0x58')],'originCc':_0xcafff3['body']['message'][_0xb63d('0x59')],'bcc':_0xcafff3[_0xb63d('0x25')][_0xb63d('0x14')]['bcc'],'ChatWebsiteId':_0xcafff3[_0xb63d('0x25')]['message'][_0xb63d('0x5a')]||null,'originChannel':_0xcafff3[_0xb63d('0x25')]['message']['originChannel']||_0xb63d('0x5b'),'ChatOfflineMessageId':_0xcafff3['body'][_0xb63d('0x14')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xb63d('0x5c')],'as':_0xb63d('0x5d')}]});})[_0xb63d('0xe')](function(_0x27e9cb){_0x2ff946[_0xb63d('0x14')]=_0x27e9cb;if(_0x2ff946[_0xb63d('0x55')]['UserId']){return db['User'][_0xb63d('0x21')]({'attributes':['id','name'],'where':{'id':_0x2ff946[_0xb63d('0x55')][_0xb63d('0x5e')]}})[_0xb63d('0xe')](function(_0x45580a){if(_0x45580a){_0x2ff946[_0xb63d('0x3e')][_0xb63d('0x5f')]({'id':0x0,'priority':0x0,'app':_0xb63d('0x60'),'appdata':_0x45580a[_0xb63d('0x61')]+','+(_0x2ff946['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x2ff946);});}return respondWithRpcPromise(_0xb63d('0x62'),_0xb63d('0x63'),_0x2ff946);})[_0xb63d('0xe')](function(_0xea2093){_0xc07ce8(_0xea2093);})[_0xb63d('0x16')](function(_0x137873){_0x1ab785(_0x19358e[_0xb63d('0x12')](0x1f4,_0x137873[_0xb63d('0x14')]));});});}; \ No newline at end of file +var _0xc1d0=['lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','limit','include','map','model','ShowMailAccount','find','where','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','MailApplication','Applications','Smtp','get','omit','applications','list','orderBy','priority','asc','autoclose','push','length','Contacts','defaults','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Contact\x20not\x20found','spread','interaction','created','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting'];(function(_0x1013e3,_0xccc357){var _0x1b948c=function(_0x516477){while(--_0x516477){_0x1013e3['push'](_0x1013e3['shift']());}};_0x1b948c(++_0xccc357);}(_0xc1d0,0x1a0));var _0x0c1d=function(_0x3c6835,_0x952d5c){_0x3c6835=_0x3c6835-0x0;var _0x1adeb9=_0xc1d0[_0x3c6835];return _0x1adeb9;};'use strict';var _=require(_0x0c1d('0x0'));var util=require(_0x0c1d('0x1'));var moment=require(_0x0c1d('0x2'));var BPromise=require('bluebird');var rs=require(_0x0c1d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0c1d('0x4'));var logger=require(_0x0c1d('0x5'))('rpc');var config=require(_0x0c1d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0c1d('0x7')][_0x0c1d('0x8')]({'port':0x232c});config[_0x0c1d('0x9')]=_['defaults'](config['redis'],{'host':_0x0c1d('0xa'),'port':0x18eb});var socket=require(_0x0c1d('0xb'))(new Redis(config[_0x0c1d('0x9')]));require(_0x0c1d('0xc'))[_0x0c1d('0xd')](socket);function respondWithRpcPromise(_0x5806e7,_0x59feca,_0x53c408){return new BPromise(function(_0x12b9fc,_0x26ecee){return client['request'](_0x5806e7,_0x53c408)[_0x0c1d('0xe')](function(_0xb40b9a){logger[_0x0c1d('0xf')](_0x0c1d('0x10'),_0x59feca,_0x0c1d('0x11'));logger[_0x0c1d('0x12')](_0x0c1d('0x13'),_0x59feca,_0x0c1d('0x11'),JSON[_0x0c1d('0x14')](_0xb40b9a));if(_0xb40b9a[_0x0c1d('0x15')]){if(_0xb40b9a[_0x0c1d('0x15')][_0x0c1d('0x16')]===0x1f4){logger[_0x0c1d('0x15')]('MailAccount,\x20%s,\x20%s',_0x59feca,_0xb40b9a['error'][_0x0c1d('0x17')]);return _0x26ecee(_0xb40b9a[_0x0c1d('0x15')][_0x0c1d('0x17')]);}logger[_0x0c1d('0x15')](_0x0c1d('0x10'),_0x59feca,_0xb40b9a[_0x0c1d('0x15')][_0x0c1d('0x17')]);return _0x12b9fc(_0xb40b9a[_0x0c1d('0x15')][_0x0c1d('0x17')]);}else{logger[_0x0c1d('0xf')]('MailAccount,\x20%s,\x20%s',_0x59feca,_0x0c1d('0x11'));_0x12b9fc(_0xb40b9a['result'][_0x0c1d('0x17')]);}})[_0x0c1d('0x18')](function(_0x329782){logger[_0x0c1d('0x15')](_0x0c1d('0x10'),_0x59feca,_0x329782);_0x26ecee(_0x329782);});});}exports[_0x0c1d('0x19')]=function(_0x40eff8){var _0x333c9e=this;return new Promise(function(_0x208cb2,_0xbf01ca){return db[_0x0c1d('0x1a')][_0x0c1d('0x1b')]({'raw':_0x40eff8[_0x0c1d('0x1c')]?_0x40eff8[_0x0c1d('0x1c')][_0x0c1d('0x1d')]===undefined?!![]:![]:!![],'where':_0x40eff8['options']?_0x40eff8[_0x0c1d('0x1c')]['where']||null:null,'attributes':_0x40eff8[_0x0c1d('0x1c')]?_0x40eff8[_0x0c1d('0x1c')][_0x0c1d('0x1e')]||null:null,'limit':_0x40eff8[_0x0c1d('0x1c')]?_0x40eff8[_0x0c1d('0x1c')][_0x0c1d('0x1f')]||null:null,'include':_0x40eff8['options']?_0x40eff8[_0x0c1d('0x1c')][_0x0c1d('0x20')]?_[_0x0c1d('0x21')](_0x40eff8[_0x0c1d('0x1c')][_0x0c1d('0x20')],function(_0x42119d){return{'model':db[_0x42119d[_0x0c1d('0x22')]],'as':_0x42119d['as'],'attributes':_0x42119d['attributes'],'include':_0x42119d[_0x0c1d('0x20')]?_[_0x0c1d('0x21')](_0x42119d[_0x0c1d('0x20')],function(_0x5200a3){return{'model':db[_0x5200a3[_0x0c1d('0x22')]],'as':_0x5200a3['as'],'attributes':_0x5200a3[_0x0c1d('0x1e')],'include':_0x5200a3[_0x0c1d('0x20')]?_[_0x0c1d('0x21')](_0x5200a3[_0x0c1d('0x20')],function(_0x3e8454){return{'model':db[_0x3e8454[_0x0c1d('0x22')]],'as':_0x3e8454['as'],'attributes':_0x3e8454[_0x0c1d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0c1d('0xe')](function(_0x505836){logger[_0x0c1d('0xf')]('GetMailAccount',_0x40eff8);logger[_0x0c1d('0x12')]('GetMailAccount',_0x40eff8,JSON[_0x0c1d('0x14')](_0x505836));_0x208cb2(_0x505836);})['catch'](function(_0x58d141){logger[_0x0c1d('0x15')](_0x0c1d('0x19'),_0x58d141[_0x0c1d('0x17')],_0x40eff8);_0xbf01ca(_0x333c9e[_0x0c1d('0x15')](0x1f4,_0x58d141[_0x0c1d('0x17')]));});});};exports[_0x0c1d('0x23')]=function(_0x466632){var _0x341b45=this;return new Promise(function(_0x5bdae4,_0x59eb28){return db[_0x0c1d('0x1a')][_0x0c1d('0x24')]({'raw':_0x466632[_0x0c1d('0x1c')]?_0x466632[_0x0c1d('0x1c')][_0x0c1d('0x1d')]===undefined?!![]:![]:!![],'where':_0x466632[_0x0c1d('0x1c')]?_0x466632[_0x0c1d('0x1c')][_0x0c1d('0x25')]||null:null,'attributes':_0x466632[_0x0c1d('0x1c')]?_0x466632[_0x0c1d('0x1c')][_0x0c1d('0x1e')]||null:null,'include':_0x466632[_0x0c1d('0x1c')]?_0x466632[_0x0c1d('0x1c')][_0x0c1d('0x20')]?_[_0x0c1d('0x21')](_0x466632[_0x0c1d('0x1c')][_0x0c1d('0x20')],function(_0x24ed30){return{'model':db[_0x24ed30[_0x0c1d('0x22')]],'as':_0x24ed30['as'],'attributes':_0x24ed30[_0x0c1d('0x1e')],'include':_0x24ed30[_0x0c1d('0x20')]?_[_0x0c1d('0x21')](_0x24ed30[_0x0c1d('0x20')],function(_0x388a80){return{'model':db[_0x388a80['model']],'as':_0x388a80['as'],'attributes':_0x388a80['attributes'],'include':_0x388a80[_0x0c1d('0x20')]?_['map'](_0x388a80[_0x0c1d('0x20')],function(_0x4e7518){return{'model':db[_0x4e7518[_0x0c1d('0x22')]],'as':_0x4e7518['as'],'attributes':_0x4e7518[_0x0c1d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0c1d('0xe')](function(_0x9098a4){logger[_0x0c1d('0xf')](_0x0c1d('0x23'),_0x466632);logger[_0x0c1d('0x12')](_0x0c1d('0x23'),_0x466632,JSON[_0x0c1d('0x14')](_0x9098a4));_0x5bdae4(_0x9098a4);})[_0x0c1d('0x18')](function(_0x2391d8){logger[_0x0c1d('0x15')]('ShowMailAccount',_0x2391d8['message'],_0x466632);_0x59eb28(_0x341b45['error'](0x1f4,_0x2391d8[_0x0c1d('0x17')]));});});};exports[_0x0c1d('0x26')]=function(_0x275e97){var _0x367c70=this;return new Promise(function(_0x16c052,_0x3c8624){var _0x48d37e={'body':_0x275e97[_0x0c1d('0x27')],'channel':_0x0c1d('0x28')};var _0x205d4a=_[_0x0c1d('0x29')](_[_0x0c1d('0x2a')](db[_0x0c1d('0x2b')]['rawAttributes']),[_0x0c1d('0x2c'),_0x0c1d('0x2d'),_0x0c1d('0x2e'),_0x0c1d('0x2f')]);var _0x12653f=![];if(_0x275e97[_0x0c1d('0x27')]['id']){delete _0x275e97[_0x0c1d('0x27')]['id'];}if(_[_0x0c1d('0x30')](_0x275e97[_0x0c1d('0x27')][_0x0c1d('0x31')])){return _0x3c8624(_0x367c70['error'](0x1f4,_0x0c1d('0x32')));}if(_[_0x0c1d('0x30')](_0x275e97[_0x0c1d('0x27')][_0x0c1d('0x27')])||_0x275e97[_0x0c1d('0x27')]['body']===''){return _0x3c8624(_0x367c70[_0x0c1d('0x15')](0x1f4,_0x0c1d('0x33')));}if(_[_0x0c1d('0x30')](_0x275e97['body'][_0x0c1d('0x34')])){return _0x3c8624(_0x367c70[_0x0c1d('0x15')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x205d4a));}if(!_[_0x0c1d('0x35')](_0x205d4a,_0x275e97[_0x0c1d('0x27')][_0x0c1d('0x34')])){return _0x3c8624(_0x367c70[_0x0c1d('0x15')](0x1f4,_0x0c1d('0x36')+_0x205d4a));}var _0x53de63={};_0x53de63[_0x275e97['body']['mapKey']]=_0x275e97[_0x0c1d('0x27')][_0x0c1d('0x31')];return db['MailAccount'][_0x0c1d('0x24')]({'where':{'id':_0x275e97[_0x0c1d('0x37')]['id']},'include':[{'model':db[_0x0c1d('0x38')],'as':_0x0c1d('0x39'),'include':[{'model':db[_0x0c1d('0x2b')],'as':'Contacts','where':_0x53de63,'limit':0x1,'order':[[_0x0c1d('0x2d'),_0x0c1d('0x3a')]]}]},{'model':db[_0x0c1d('0x3b')],'as':_0x0c1d('0x3c')},{'model':db['MailServerOut'],'as':_0x0c1d('0x3d')}]})[_0x0c1d('0xe')](function(_0x223b4c){if(_0x223b4c&&_0x223b4c[_0x0c1d('0x39')]){var _0x59180c=_0x223b4c[_0x0c1d('0x3e')]({'plain':!![]});_0x48d37e[_0x0c1d('0x37')]=_[_0x0c1d('0x3f')](_0x59180c,['Applications','List']);_0x48d37e[_0x0c1d('0x40')]=_0x59180c['Applications'];_0x48d37e[_0x0c1d('0x41')]=_0x59180c[_0x0c1d('0x39')];_0x48d37e[_0x0c1d('0x40')]=_[_0x0c1d('0x42')](_0x48d37e[_0x0c1d('0x40')],[_0x0c1d('0x43')],[_0x0c1d('0x44')]);if(_0x48d37e[_0x0c1d('0x37')]&&_0x48d37e['account'][_0x0c1d('0x45')]){_0x48d37e[_0x0c1d('0x40')][_0x0c1d('0x46')]({'id':0x0,'priority':_0x48d37e[_0x0c1d('0x40')][_0x0c1d('0x47')]+0x1,'app':'close','appdata':_0x0c1d('0x45'),'interval':'*,*,*,*'});}if(_0x48d37e[_0x0c1d('0x37')]['Applications']){delete _0x48d37e['account'][_0x0c1d('0x3c')];}if(_0x48d37e[_0x0c1d('0x37')]['List']){delete _0x48d37e['account'][_0x0c1d('0x39')];}if(_0x59180c[_0x0c1d('0x39')][_0x0c1d('0x48')]['length']){return _0x59180c['List'][_0x0c1d('0x48')][0x0];}var _0x2234fc=_[_0x0c1d('0x49')](_0x275e97[_0x0c1d('0x27')],{'firstName':_0x275e97[_0x0c1d('0x27')][_0x0c1d('0x31')],'ListId':_0x59180c[_0x0c1d('0x2f')]});_0x2234fc[_0x275e97['body']['mapKey']]=_0x275e97[_0x0c1d('0x27')][_0x0c1d('0x31')];return db['CmContact'][_0x0c1d('0x4a')](_0x2234fc);}else{throw new Error(_0x0c1d('0x4b'));}})[_0x0c1d('0xe')](function(_0xb90349){_0x48d37e[_0x0c1d('0x4c')]=_0xb90349;if(_0xb90349){if(!_0x275e97[_0x0c1d('0x27')][_0x0c1d('0x17')][_0x0c1d('0x4d')]){_0x275e97[_0x0c1d('0x27')][_0x0c1d('0x17')][_0x0c1d('0x4d')]=rs[_0x0c1d('0x4e')]()+'\x20'+_0x275e97['body'][_0x0c1d('0x17')][_0x0c1d('0x31')];}var _0x339a11={'ContactId':_0xb90349['id'],'MailAccountId':_0x275e97['account']['id'],'inReplyTo':_0x275e97['body']['message'][_0x0c1d('0x4d')],'to':_0x275e97[_0x0c1d('0x27')]['message'][_0x0c1d('0x31')],'cc':_0x275e97[_0x0c1d('0x27')][_0x0c1d('0x17')]['cc'],'subject':_0x275e97[_0x0c1d('0x27')][_0x0c1d('0x17')][_0x0c1d('0x4f')],'attach':_0x275e97['body'][_0x0c1d('0x17')][_0x0c1d('0x50')],'lastMsgAt':moment()[_0x0c1d('0x51')](_0x0c1d('0x52')),'lastMsgDirection':'in'};return db[_0x0c1d('0x53')]['find']({'where':{'closed':![],'MailAccountId':_0x275e97[_0x0c1d('0x37')]['id']},'include':[{'model':db[_0x0c1d('0x54')],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x275e97[_0x0c1d('0x27')][_0x0c1d('0x17')]['inReplyTo']}}]})[_0x0c1d('0xe')](function(_0xaf1322){if(_0xaf1322){return[_0xaf1322,![]];}return db['MailInteraction']['create'](_0x339a11)[_0x0c1d('0xe')](function(_0x32cf03){return[_0x32cf03,!![]];});});}else{throw new Error(_0x0c1d('0x55'));}})[_0x0c1d('0x56')](function(_0x14bf4c,_0x34761d){if(_0x14bf4c){_0x12653f=_0x34761d;if(!_0x34761d){return _0x14bf4c['update']({'inReplyTo':_0x275e97[_0x0c1d('0x27')][_0x0c1d('0x17')][_0x0c1d('0x4d')],'to':_0x275e97[_0x0c1d('0x27')]['message'][_0x0c1d('0x31')],'cc':_0x275e97[_0x0c1d('0x27')]['message']['cc'],'subject':_0x275e97[_0x0c1d('0x27')][_0x0c1d('0x17')][_0x0c1d('0x4f')],'attach':_0x14bf4c[_0x0c1d('0x50')]?_0x14bf4c[_0x0c1d('0x50')]:_0x275e97[_0x0c1d('0x27')][_0x0c1d('0x17')][_0x0c1d('0x50')],'substatus':null,'substatusAt':moment()['format'](_0x0c1d('0x52')),'lastMsgAt':moment()[_0x0c1d('0x51')](_0x0c1d('0x52')),'lastMsgDirection':'in'});}else{return _0x14bf4c;}}})[_0x0c1d('0xe')](function(_0x1d13ae){_0x48d37e[_0x0c1d('0x57')]=_0x1d13ae[_0x0c1d('0x3e')]({'plain':!![]});_0x48d37e[_0x0c1d('0x57')][_0x0c1d('0x58')]=_0x12653f;return db['MailMessage'][_0x0c1d('0x4a')]({'body':_0x275e97[_0x0c1d('0x27')]['body'],'MailAccountId':_0x275e97[_0x0c1d('0x37')]['id'],'MailInteractionId':_0x1d13ae['id'],'direction':'in','ContactId':_0x48d37e[_0x0c1d('0x4c')]['id'],'messageId':_0x275e97[_0x0c1d('0x27')][_0x0c1d('0x17')][_0x0c1d('0x4d')],'from':_0x275e97[_0x0c1d('0x27')][_0x0c1d('0x17')]['from'],'to':_0x275e97[_0x0c1d('0x27')]['message']['to'],'cc':_0x275e97['body'][_0x0c1d('0x17')]['cc'],'subject':_0x275e97['body'][_0x0c1d('0x17')][_0x0c1d('0x4f')],'attach':_0x275e97[_0x0c1d('0x27')][_0x0c1d('0x17')][_0x0c1d('0x50')],'Attachments':_0x275e97[_0x0c1d('0x27')][_0x0c1d('0x17')]['attachments'],'originTo':_0x275e97[_0x0c1d('0x27')]['message'][_0x0c1d('0x59')],'originCc':_0x275e97[_0x0c1d('0x27')][_0x0c1d('0x17')][_0x0c1d('0x5a')],'bcc':_0x275e97[_0x0c1d('0x27')][_0x0c1d('0x17')]['bcc'],'ChatWebsiteId':_0x275e97['body']['message'][_0x0c1d('0x5b')]||null,'originChannel':_0x275e97[_0x0c1d('0x27')][_0x0c1d('0x17')][_0x0c1d('0x5c')]||_0x0c1d('0x5d'),'ChatOfflineMessageId':_0x275e97['body']['message'][_0x0c1d('0x5e')]||null},{'include':[{'model':db[_0x0c1d('0x5f')],'as':'Attachments'}]});})['then'](function(_0x37ac19){_0x48d37e[_0x0c1d('0x17')]=_0x37ac19;if(_0x48d37e['interaction'][_0x0c1d('0x60')]){return db[_0x0c1d('0x61')][_0x0c1d('0x24')]({'attributes':['id',_0x0c1d('0x62')],'where':{'id':_0x48d37e[_0x0c1d('0x57')][_0x0c1d('0x60')]}})['then'](function(_0x5782fe){if(_0x5782fe){_0x48d37e[_0x0c1d('0x40')]['unshift']({'id':0x0,'priority':0x0,'app':_0x0c1d('0x63'),'appdata':_0x5782fe[_0x0c1d('0x62')]+','+(_0x48d37e[_0x0c1d('0x37')][_0x0c1d('0x64')]||0xa),'interval':_0x0c1d('0x65')});}return respondWithRpcPromise(_0x0c1d('0x66'),_0x0c1d('0x67'),_0x48d37e);});}return respondWithRpcPromise(_0x0c1d('0x66'),'startRouting',_0x48d37e);})[_0x0c1d('0xe')](function(_0xbcbe6){_0x16c052(_0xbcbe6);})[_0x0c1d('0x18')](function(_0x5f24e2){_0x3c8624(_0x367c70[_0x0c1d('0x15')](0x1f4,_0x5f24e2[_0x0c1d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 27d3bd0..2acc5c0 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 _0x9973=['emit','removeListener','length','save','remove'];(function(_0x24783a,_0x75041){var _0x227a77=function(_0x2b736d){while(--_0x2b736d){_0x24783a['push'](_0x24783a['shift']());}};_0x227a77(++_0x75041);}(_0x9973,0x157));var _0x3997=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9973[_0x122ef9];return _0x42fba0;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x3997('0x0'),_0x3997('0x1'),'update'];function createListener(_0x3e174d,_0x403ff4){return function(_0x7e051d){_0x403ff4[_0x3997('0x2')](_0x3e174d,_0x7e051d);};}function removeListener(_0x873171,_0x30c504){return function(){MailAccountEvents[_0x3997('0x3')](_0x873171,_0x30c504);};}exports['register']=function(_0x48c26c){for(var _0x320340=0x0,_0x114d26=events[_0x3997('0x4')];_0x320340<_0x114d26;_0x320340++){var _0x483d44=events[_0x320340];var _0x569ddf=createListener('mailAccount:'+_0x483d44,_0x48c26c);MailAccountEvents['on'](_0x483d44,_0x569ddf);}}; \ No newline at end of file +var _0x2dc3=['mailAccount:','save','remove','update','emit','register','length'];(function(_0x10da23,_0x5869d4){var _0x5f0fe7=function(_0x49e1b3){while(--_0x49e1b3){_0x10da23['push'](_0x10da23['shift']());}};_0x5f0fe7(++_0x5869d4);}(_0x2dc3,0x127));var _0x32dc=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x2dc3[_0x6131cd];return _0x47e916;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x32dc('0x0'),_0x32dc('0x1'),_0x32dc('0x2')];function createListener(_0x25b524,_0x2f8a4c){return function(_0x597050){_0x2f8a4c[_0x32dc('0x3')](_0x25b524,_0x597050);};}function removeListener(_0x15c3f6,_0x53b74c){return function(){MailAccountEvents['removeListener'](_0x15c3f6,_0x53b74c);};}exports[_0x32dc('0x4')]=function(_0x58b6ba){for(var _0x1f59d3=0x0,_0x52336b=events[_0x32dc('0x5')];_0x1f59d3<_0x52336b;_0x1f59d3++){var _0x491a56=events[_0x1f59d3];var _0x49c416=createListener(_0x32dc('0x6')+_0x491a56,_0x58b6ba);MailAccountEvents['on'](_0x491a56,_0x49c416);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 3581a82..5857f03 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 _0x1261=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','isAuthenticated','show','/:id','update','delete','destroy'];(function(_0x4e1211,_0x1c0e26){var _0x4ae887=function(_0x6e55ff){while(--_0x6e55ff){_0x4e1211['push'](_0x4e1211['shift']());}};_0x4ae887(++_0x1c0e26);}(_0x1261,0x144));var _0x1126=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0x1261[_0x45d1fd];return _0xd0e542;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/:id',auth[_0x1126('0xa')](),controller[_0x1126('0xb')]);router['put'](_0x1126('0xc'),auth[_0x1126('0xa')](),controller[_0x1126('0xd')]);router[_0x1126('0xe')](_0x1126('0xc'),auth['isAuthenticated'](),controller[_0x1126('0xf')]);module[_0x1126('0x10')]=router; \ No newline at end of file +var _0x2ef3=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','show','put'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x2ef3,0xba));var _0x32ef=function(_0x104324,_0x4e3dc9){_0x104324=_0x104324-0x0;var _0x2ed30a=_0x2ef3[_0x104324];return _0x2ed30a;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0xc'),auth[_0x32ef('0xd')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')](_0x32ef('0xc'),auth[_0x32ef('0xd')](),controller[_0x32ef('0x10')]);module[_0x32ef('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 0f00ee9..185433d 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 _0x983f=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x340c8e,_0x18f717){var _0x33d19c=function(_0x1a8299){while(--_0x1a8299){_0x340c8e['push'](_0x340c8e['shift']());}};_0x33d19c(++_0x18f717);}(_0x983f,0xce));var _0xf983=function(_0x568d2f,_0x247fe7){_0x568d2f=_0x568d2f-0x0;var _0x14b38a=_0x983f[_0x568d2f];return _0x14b38a;};'use strict';var Sequelize=require(_0xf983('0x0'));module[_0xf983('0x1')]={'priority':{'type':Sequelize[_0xf983('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf983('0x3')],'allowNull':![],'defaultValue':_0xf983('0x4')},'appdata':{'type':Sequelize[_0xf983('0x5')]()},'description':{'type':Sequelize[_0xf983('0x3')]},'interval':{'type':Sequelize[_0xf983('0x3')],'defaultValue':_0xf983('0x6')}}; \ No newline at end of file +var _0x3566=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x5ed85c,_0x3de2b4){var _0x2b3917=function(_0x487356){while(--_0x487356){_0x5ed85c['push'](_0x5ed85c['shift']());}};_0x2b3917(++_0x3de2b4);}(_0x3566,0x96));var _0x6356=function(_0x37f0dc,_0x3725b4){_0x37f0dc=_0x37f0dc-0x0;var _0x495d5f=_0x3566[_0x37f0dc];return _0x495d5f;};'use strict';var Sequelize=require(_0x6356('0x0'));module[_0x6356('0x1')]={'priority':{'type':Sequelize[_0x6356('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6356('0x3')],'allowNull':![],'defaultValue':_0x6356('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x6356('0x3')]},'interval':{'type':Sequelize[_0x6356('0x3')],'defaultValue':_0x6356('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 3ecd1a8..b40af44 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 _0x6fed=['limit','count','set','reject','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','catch','body','find','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined'];(function(_0x13e300,_0x1bcb41){var _0x5a3eea=function(_0x2dfd2a){while(--_0x2dfd2a){_0x13e300['push'](_0x13e300['shift']());}};_0x5a3eea(++_0x1bcb41);}(_0x6fed,0x134));var _0xd6fe=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6fed[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd6fe('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd6fe('0x1'));var moment=require(_0xd6fe('0x2'));var BPromise=require(_0xd6fe('0x3'));var Mustache=require(_0xd6fe('0x4'));var util=require(_0xd6fe('0x5'));var path=require(_0xd6fe('0x6'));var sox=require('sox');var csv=require(_0xd6fe('0x7'));var ejs=require(_0xd6fe('0x8'));var fs=require('fs');var fs_extra=require(_0xd6fe('0x9'));var _=require(_0xd6fe('0xa'));var squel=require(_0xd6fe('0xb'));var crypto=require(_0xd6fe('0xc'));var jsforce=require(_0xd6fe('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd6fe('0x7'));var querystring=require(_0xd6fe('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd6fe('0xf'));var qs=require(_0xd6fe('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6fe('0x11'));var logger=require(_0xd6fe('0x12'))(_0xd6fe('0x13'));var utils=require(_0xd6fe('0x14'));var config=require(_0xd6fe('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28e1f6,_0x45a6a7){_0x45a6a7=_0x45a6a7||0xcc;return function(_0x48d111){if(_0x48d111){return _0x28e1f6[_0xd6fe('0x16')](_0x45a6a7);}return _0x28e1f6[_0xd6fe('0x17')](_0x45a6a7)[_0xd6fe('0x18')]();};}function respondWithResult(_0x1da182,_0x448240){_0x448240=_0x448240||0xc8;return function(_0x55ff4c){if(_0x55ff4c){return _0x1da182['status'](_0x448240)[_0xd6fe('0x19')](_0x55ff4c);}};}function respondWithFilteredResult(_0x245567,_0x483c20){return function(_0xec1579){if(_0xec1579){var _0x5b3bc9=typeof _0x483c20[_0xd6fe('0x1a')]===_0xd6fe('0x1b')&&typeof _0x483c20[_0xd6fe('0x1c')]===_0xd6fe('0x1b');var _0x5b518f=_0xec1579[_0xd6fe('0x1d')];var _0x18c4b8=_0x5b3bc9?0x0:_0x483c20[_0xd6fe('0x1a')];var _0x4c2576=_0x5b3bc9?_0xec1579[_0xd6fe('0x1d')]:_0x483c20[_0xd6fe('0x1a')]+_0x483c20[_0xd6fe('0x1c')];var _0x496070;if(_0x4c2576>=_0x5b518f){_0x4c2576=_0x5b518f;_0x496070=0xc8;}else{_0x496070=0xce;}_0x245567[_0xd6fe('0x17')](_0x496070);return _0x245567[_0xd6fe('0x1e')]('Content-Range',_0x18c4b8+'-'+_0x4c2576+'/'+_0x5b518f)[_0xd6fe('0x19')](_0xec1579);}return null;};}function patchUpdates(_0x99e0e9){return function(_0x1d7da7){try{jsonpatch['apply'](_0x1d7da7,_0x99e0e9,!![]);}catch(_0xf3a2b8){return BPromise[_0xd6fe('0x1f')](_0xf3a2b8);}return _0x1d7da7['save']();};}function saveUpdates(_0x2c8104,_0x15ece4){return function(_0x131f59){if(_0x131f59){return _0x131f59[_0xd6fe('0x20')](_0x2c8104)['then'](function(_0x485d2c){return _0x485d2c;});}return null;};}function removeEntity(_0xab0ecf,_0x202536){return function(_0x2d266b){if(_0x2d266b){return _0x2d266b[_0xd6fe('0x21')]()[_0xd6fe('0x22')](function(){_0xab0ecf[_0xd6fe('0x17')](0xcc)[_0xd6fe('0x18')]();});}};}function handleEntityNotFound(_0xea08b9,_0x58d2b2){return function(_0x5445c1){if(!_0x5445c1){_0xea08b9[_0xd6fe('0x16')](0x194);}return _0x5445c1;};}function handleError(_0x3ff420,_0x1d8b66){_0x1d8b66=_0x1d8b66||0x1f4;return function(_0x1e7311){logger[_0xd6fe('0x23')](_0x1e7311[_0xd6fe('0x24')]);if(_0x1e7311[_0xd6fe('0x25')]){delete _0x1e7311['name'];}_0x3ff420['status'](_0x1d8b66)[_0xd6fe('0x26')](_0x1e7311);};}exports[_0xd6fe('0x27')]=function(_0x158994,_0x23a399){var _0x345bf6={'raw':!![],'where':{'id':_0x158994[_0xd6fe('0x28')]['id']}},_0x44ff9e={};_0x44ff9e[_0xd6fe('0x29')]=_[_0xd6fe('0x2a')](db[_0xd6fe('0x2b')][_0xd6fe('0x2c')]);_0x44ff9e[_0xd6fe('0x2d')]=_[_0xd6fe('0x2a')](_0x158994[_0xd6fe('0x2d')]);_0x44ff9e['filters']=_[_0xd6fe('0x2e')](_0x44ff9e[_0xd6fe('0x29')],_0x44ff9e[_0xd6fe('0x2d')]);_0x345bf6[_0xd6fe('0x2f')]=_['intersection'](_0x44ff9e['model'],qs['fields'](_0x158994[_0xd6fe('0x2d')][_0xd6fe('0x30')]));_0x345bf6['attributes']=_0x345bf6[_0xd6fe('0x2f')][_0xd6fe('0x31')]?_0x345bf6[_0xd6fe('0x2f')]:_0x44ff9e[_0xd6fe('0x29')];if(_0x158994[_0xd6fe('0x2d')][_0xd6fe('0x32')]){_0x345bf6[_0xd6fe('0x33')]=[{'all':!![]}];}_0x345bf6=_[_0xd6fe('0x34')]({},_0x345bf6,_0x158994['options']);return db[_0xd6fe('0x2b')]['find'](_0x345bf6)[_0xd6fe('0x22')](handleEntityNotFound(_0x23a399,null))[_0xd6fe('0x22')](respondWithResult(_0x23a399,null))[_0xd6fe('0x35')](handleError(_0x23a399,null));};exports[_0xd6fe('0x20')]=function(_0x37ffa0,_0x2c5741){if(_0x37ffa0[_0xd6fe('0x36')]['id']){delete _0x37ffa0[_0xd6fe('0x36')]['id'];}return db[_0xd6fe('0x2b')][_0xd6fe('0x37')]({'where':{'id':_0x37ffa0[_0xd6fe('0x28')]['id']}})[_0xd6fe('0x22')](handleEntityNotFound(_0x2c5741,null))['then'](saveUpdates(_0x37ffa0[_0xd6fe('0x36')],null))[_0xd6fe('0x22')](respondWithResult(_0x2c5741,null))['catch'](handleError(_0x2c5741,null));};exports['destroy']=function(_0x24981a,_0x2e27d0){return db['MailApplication'][_0xd6fe('0x37')]({'where':{'id':_0x24981a[_0xd6fe('0x28')]['id']}})[_0xd6fe('0x22')](handleEntityNotFound(_0x2e27d0,null))[_0xd6fe('0x22')](removeEntity(_0x2e27d0,null))['catch'](handleError(_0x2e27d0,null));}; \ No newline at end of file +var _0xae93=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','error','send','show','params','model','MailApplication','rawAttributes','query','keys','filters','attributes','fields','includeAll','include','merge','catch','body','find','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils'];(function(_0x188da4,_0x3e71a3){var _0x40a756=function(_0x584fd8){while(--_0x584fd8){_0x188da4['push'](_0x188da4['shift']());}};_0x40a756(++_0x3e71a3);}(_0xae93,0x131));var _0x3ae9=function(_0x18af8f,_0x35926f){_0x18af8f=_0x18af8f-0x0;var _0x41e9c9=_0xae93[_0x18af8f];return _0x41e9c9;};'use strict';var emlformat=require(_0x3ae9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3ae9('0x1'));var rp=require(_0x3ae9('0x2'));var moment=require(_0x3ae9('0x3'));var BPromise=require(_0x3ae9('0x4'));var Mustache=require(_0x3ae9('0x5'));var util=require('util');var path=require(_0x3ae9('0x6'));var sox=require(_0x3ae9('0x7'));var csv=require(_0x3ae9('0x8'));var ejs=require(_0x3ae9('0x9'));var fs=require('fs');var fs_extra=require(_0x3ae9('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3ae9('0xb'));var jsforce=require(_0x3ae9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3ae9('0x8'));var querystring=require(_0x3ae9('0xd'));var Papa=require(_0x3ae9('0xe'));var Redis=require('ioredis');var authService=require(_0x3ae9('0xf'));var qs=require(_0x3ae9('0x10'));var as=require(_0x3ae9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3ae9('0x12'));var config=require(_0x3ae9('0x13'));var licenseUtil=require(_0x3ae9('0x14'));var db=require(_0x3ae9('0x15'))['db'];function respondWithStatusCode(_0xfafd4,_0x34975f){_0x34975f=_0x34975f||0xcc;return function(_0x50c7b7){if(_0x50c7b7){return _0xfafd4[_0x3ae9('0x16')](_0x34975f);}return _0xfafd4['status'](_0x34975f)['end']();};}function respondWithResult(_0x2b58fa,_0x1a8b78){_0x1a8b78=_0x1a8b78||0xc8;return function(_0x17272e){if(_0x17272e){return _0x2b58fa[_0x3ae9('0x17')](_0x1a8b78)[_0x3ae9('0x18')](_0x17272e);}};}function respondWithFilteredResult(_0x1b601d,_0x343168){return function(_0x6c1f8d){if(_0x6c1f8d){var _0xb34b3a=typeof _0x343168[_0x3ae9('0x19')]===_0x3ae9('0x1a')&&typeof _0x343168[_0x3ae9('0x1b')]===_0x3ae9('0x1a');var _0x1dbdc9=_0x6c1f8d[_0x3ae9('0x1c')];var _0x305eb7=_0xb34b3a?0x0:_0x343168[_0x3ae9('0x19')];var _0x27573d=_0xb34b3a?_0x6c1f8d[_0x3ae9('0x1c')]:_0x343168[_0x3ae9('0x19')]+_0x343168[_0x3ae9('0x1b')];var _0x23cc77;if(_0x27573d>=_0x1dbdc9){_0x27573d=_0x1dbdc9;_0x23cc77=0xc8;}else{_0x23cc77=0xce;}_0x1b601d[_0x3ae9('0x17')](_0x23cc77);return _0x1b601d['set'](_0x3ae9('0x1d'),_0x305eb7+'-'+_0x27573d+'/'+_0x1dbdc9)[_0x3ae9('0x18')](_0x6c1f8d);}return null;};}function patchUpdates(_0x498299){return function(_0x485797){try{jsonpatch[_0x3ae9('0x1e')](_0x485797,_0x498299,!![]);}catch(_0x57472d){return BPromise[_0x3ae9('0x1f')](_0x57472d);}return _0x485797[_0x3ae9('0x20')]();};}function saveUpdates(_0xbdf332,_0x51ca46){return function(_0x28b340){if(_0x28b340){return _0x28b340[_0x3ae9('0x21')](_0xbdf332)[_0x3ae9('0x22')](function(_0xc1fa25){return _0xc1fa25;});}return null;};}function removeEntity(_0x1b1ebd,_0x5bb47c){return function(_0x2695b2){if(_0x2695b2){return _0x2695b2['destroy']()[_0x3ae9('0x22')](function(){_0x1b1ebd['status'](0xcc)[_0x3ae9('0x23')]();});}};}function handleEntityNotFound(_0x2c88ff,_0x348eda){return function(_0x544b59){if(!_0x544b59){_0x2c88ff['sendStatus'](0x194);}return _0x544b59;};}function handleError(_0x467478,_0x5034a5){_0x5034a5=_0x5034a5||0x1f4;return function(_0x10af62){logger[_0x3ae9('0x24')](_0x10af62['stack']);if(_0x10af62['name']){delete _0x10af62['name'];}_0x467478[_0x3ae9('0x17')](_0x5034a5)[_0x3ae9('0x25')](_0x10af62);};}exports[_0x3ae9('0x26')]=function(_0x300a56,_0x58b11c){var _0x40a980={'raw':!![],'where':{'id':_0x300a56[_0x3ae9('0x27')]['id']}},_0x16bd77={};_0x16bd77[_0x3ae9('0x28')]=_['keys'](db[_0x3ae9('0x29')][_0x3ae9('0x2a')]);_0x16bd77[_0x3ae9('0x2b')]=_[_0x3ae9('0x2c')](_0x300a56['query']);_0x16bd77[_0x3ae9('0x2d')]=_['intersection'](_0x16bd77['model'],_0x16bd77['query']);_0x40a980[_0x3ae9('0x2e')]=_['intersection'](_0x16bd77[_0x3ae9('0x28')],qs[_0x3ae9('0x2f')](_0x300a56[_0x3ae9('0x2b')][_0x3ae9('0x2f')]));_0x40a980[_0x3ae9('0x2e')]=_0x40a980[_0x3ae9('0x2e')]['length']?_0x40a980['attributes']:_0x16bd77[_0x3ae9('0x28')];if(_0x300a56[_0x3ae9('0x2b')][_0x3ae9('0x30')]){_0x40a980[_0x3ae9('0x31')]=[{'all':!![]}];}_0x40a980=_[_0x3ae9('0x32')]({},_0x40a980,_0x300a56['options']);return db['MailApplication']['find'](_0x40a980)[_0x3ae9('0x22')](handleEntityNotFound(_0x58b11c,null))[_0x3ae9('0x22')](respondWithResult(_0x58b11c,null))[_0x3ae9('0x33')](handleError(_0x58b11c,null));};exports[_0x3ae9('0x21')]=function(_0xfd17bb,_0x16cec7){if(_0xfd17bb[_0x3ae9('0x34')]['id']){delete _0xfd17bb[_0x3ae9('0x34')]['id'];}return db[_0x3ae9('0x29')][_0x3ae9('0x35')]({'where':{'id':_0xfd17bb['params']['id']}})[_0x3ae9('0x22')](handleEntityNotFound(_0x16cec7,null))[_0x3ae9('0x22')](saveUpdates(_0xfd17bb[_0x3ae9('0x34')],null))[_0x3ae9('0x22')](respondWithResult(_0x16cec7,null))['catch'](handleError(_0x16cec7,null));};exports['destroy']=function(_0x448bd3,_0xd5a162){return db[_0x3ae9('0x29')][_0x3ae9('0x35')]({'where':{'id':_0x448bd3[_0x3ae9('0x27')]['id']}})['then'](handleEntityNotFound(_0xd5a162,null))['then'](removeEntity(_0xd5a162,null))[_0x3ae9('0x33')](handleError(_0xd5a162,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 21991ea..f9b6010 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 _0x87bc=['utf8mb4_unicode_ci','lodash','util','api','request-promise','rimraf','define'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x87bc,0x189));var _0xc87b=function(_0x247ad0,_0x2fefc1){_0x247ad0=_0x247ad0-0x0;var _0x293b3c=_0x87bc[_0x247ad0];return _0x293b3c;};'use strict';var _=require(_0xc87b('0x0'));var util=require(_0xc87b('0x1'));var logger=require('../../config/logger')(_0xc87b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc87b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc87b('0x4'));var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module['exports']=function(_0x1a2172,_0x1dfa75){return _0x1a2172[_0xc87b('0x5')]('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc87b('0x6')});}; \ No newline at end of file +var _0x34bd=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api'];(function(_0x5c9a04,_0x1c1ebd){var _0x1cb316=function(_0xa755cb){while(--_0xa755cb){_0x5c9a04['push'](_0x5c9a04['shift']());}};_0x1cb316(++_0x1c1ebd);}(_0x34bd,0x1d2));var _0xd34b=function(_0x222550,_0x3c0a0c){_0x222550=_0x222550-0x0;var _0x58ac61=_0x34bd[_0x222550];return _0x58ac61;};'use strict';var _=require(_0xd34b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd34b('0x1'));var moment=require(_0xd34b('0x2'));var BPromise=require(_0xd34b('0x3'));var rp=require(_0xd34b('0x4'));var fs=require('fs');var path=require(_0xd34b('0x5'));var rimraf=require(_0xd34b('0x6'));var config=require(_0xd34b('0x7'));var attributes=require('./mailApplication.attributes');module[_0xd34b('0x8')]=function(_0x5d161e,_0x4e6e94){return _0x5d161e['define'](_0xd34b('0x9'),attributes,{'tableName':_0xd34b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd34b('0xb'),'collate':_0xd34b('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 1dde536..d2bf6fc 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 _0xafe7=['attributes','limit','UpdateMailApplication','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','MailApplication','update','body','options','raw'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0xafe7,0x1f3));var _0x7afe=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xafe7[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x7afe('0x0'));var util=require(_0x7afe('0x1'));var moment=require(_0x7afe('0x2'));var BPromise=require(_0x7afe('0x3'));var rs=require(_0x7afe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7afe('0x5'))['db'];var utils=require(_0x7afe('0x6'));var logger=require(_0x7afe('0x7'))(_0x7afe('0x8'));var config=require(_0x7afe('0x9'));var jayson=require(_0x7afe('0xa'));var client=jayson[_0x7afe('0xb')][_0x7afe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31456d,_0x5ea428,_0x22860d){return new BPromise(function(_0x4cbe10,_0x174e68){return client[_0x7afe('0xd')](_0x31456d,_0x22860d)[_0x7afe('0xe')](function(_0x23be5a){logger['info'](_0x7afe('0xf'),_0x5ea428,_0x7afe('0x10'));logger[_0x7afe('0x11')](_0x7afe('0x12'),_0x5ea428,_0x7afe('0x10'),JSON['stringify'](_0x23be5a));if(_0x23be5a['error']){if(_0x23be5a[_0x7afe('0x13')][_0x7afe('0x14')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x5ea428,_0x23be5a[_0x7afe('0x13')][_0x7afe('0x15')]);return _0x174e68(_0x23be5a['error'][_0x7afe('0x15')]);}logger[_0x7afe('0x13')](_0x7afe('0xf'),_0x5ea428,_0x23be5a[_0x7afe('0x13')][_0x7afe('0x15')]);return _0x4cbe10(_0x23be5a[_0x7afe('0x13')]['message']);}else{logger[_0x7afe('0x16')](_0x7afe('0xf'),_0x5ea428,_0x7afe('0x10'));_0x4cbe10(_0x23be5a['result'][_0x7afe('0x15')]);}})[_0x7afe('0x17')](function(_0x45c4bc){logger[_0x7afe('0x13')](_0x7afe('0xf'),_0x5ea428,_0x45c4bc);_0x174e68(_0x45c4bc);});});}exports['UpdateMailApplication']=function(_0x292bb0){var _0x20232e=this;return new Promise(function(_0x140d43,_0x2ad1f3){return db[_0x7afe('0x18')][_0x7afe('0x19')](_0x292bb0[_0x7afe('0x1a')],{'raw':_0x292bb0[_0x7afe('0x1b')]?_0x292bb0[_0x7afe('0x1b')][_0x7afe('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x292bb0[_0x7afe('0x1b')]?_0x292bb0[_0x7afe('0x1b')]['where']||null:null,'attributes':_0x292bb0['options']?_0x292bb0[_0x7afe('0x1b')][_0x7afe('0x1d')]||null:null,'limit':_0x292bb0['options']?_0x292bb0[_0x7afe('0x1b')][_0x7afe('0x1e')]||null:null})[_0x7afe('0xe')](function(_0x1366fe){logger[_0x7afe('0x16')](_0x7afe('0x1f'),_0x292bb0);logger[_0x7afe('0x11')]('UpdateMailApplication',_0x292bb0,JSON[_0x7afe('0x20')](_0x1366fe));_0x140d43(_0x1366fe);})[_0x7afe('0x17')](function(_0x1b567a){logger[_0x7afe('0x13')](_0x7afe('0x1f'),_0x1b567a[_0x7afe('0x15')],_0x292bb0);_0x2ad1f3(_0x20232e[_0x7afe('0x13')](0x1f4,_0x1b567a[_0x7afe('0x15')]));});});}; \ No newline at end of file +var _0xf184=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where'];(function(_0x502c54,_0x567a3d){var _0x14e97c=function(_0x5481cb){while(--_0x5481cb){_0x502c54['push'](_0x502c54['shift']());}};_0x14e97c(++_0x567a3d);}(_0xf184,0x1ee));var _0x4f18=function(_0x4e4061,_0x26503b){_0x4e4061=_0x4e4061-0x0;var _0x371dbd=_0xf184[_0x4e4061];return _0x371dbd;};'use strict';var _=require('lodash');var util=require(_0x4f18('0x0'));var moment=require(_0x4f18('0x1'));var BPromise=require(_0x4f18('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f18('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f18('0x4'));var logger=require(_0x4f18('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4f18('0x6'));var client=jayson[_0x4f18('0x7')][_0x4f18('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5deda4,_0x3dc926,_0x58d953){return new BPromise(function(_0x36ac5a,_0x4f37a5){return client['request'](_0x5deda4,_0x58d953)[_0x4f18('0x9')](function(_0x19b024){logger[_0x4f18('0xa')](_0x4f18('0xb'),_0x3dc926,_0x4f18('0xc'));logger[_0x4f18('0xd')](_0x4f18('0xe'),_0x3dc926,'request\x20sent',JSON[_0x4f18('0xf')](_0x19b024));if(_0x19b024[_0x4f18('0x10')]){if(_0x19b024[_0x4f18('0x10')]['code']===0x1f4){logger[_0x4f18('0x10')](_0x4f18('0xb'),_0x3dc926,_0x19b024['error']['message']);return _0x4f37a5(_0x19b024[_0x4f18('0x10')][_0x4f18('0x11')]);}logger['error'](_0x4f18('0xb'),_0x3dc926,_0x19b024['error'][_0x4f18('0x11')]);return _0x36ac5a(_0x19b024[_0x4f18('0x10')][_0x4f18('0x11')]);}else{logger[_0x4f18('0xa')](_0x4f18('0xb'),_0x3dc926,_0x4f18('0xc'));_0x36ac5a(_0x19b024['result']['message']);}})[_0x4f18('0x12')](function(_0x2a69e6){logger[_0x4f18('0x10')](_0x4f18('0xb'),_0x3dc926,_0x2a69e6);_0x4f37a5(_0x2a69e6);});});}exports[_0x4f18('0x13')]=function(_0x58c9de){var _0x3a17f7=this;return new Promise(function(_0x333bbf,_0x4b4d63){return db[_0x4f18('0x14')][_0x4f18('0x15')](_0x58c9de[_0x4f18('0x16')],{'raw':_0x58c9de[_0x4f18('0x17')]?_0x58c9de['options'][_0x4f18('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58c9de['options']?_0x58c9de[_0x4f18('0x17')][_0x4f18('0x19')]||null:null,'attributes':_0x58c9de['options']?_0x58c9de['options']['attributes']||null:null,'limit':_0x58c9de['options']?_0x58c9de[_0x4f18('0x17')]['limit']||null:null})['then'](function(_0xb526d1){logger['info'](_0x4f18('0x13'),_0x58c9de);logger[_0x4f18('0xd')](_0x4f18('0x13'),_0x58c9de,JSON['stringify'](_0xb526d1));_0x333bbf(_0xb526d1);})[_0x4f18('0x12')](function(_0xd19e90){logger[_0x4f18('0x10')](_0x4f18('0x13'),_0xd19e90[_0x4f18('0x11')],_0x58c9de);_0x4b4d63(_0x3a17f7['error'](0x1f4,_0xd19e90[_0x4f18('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index ff9c776..2c3dff8 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 _0xc3d5=['delete','mailinteraction:destroy','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc3d5,0x159));var _0x5c3d=function(_0x59b286,_0x3fb0fb){_0x59b286=_0x59b286-0x0;var _0x155cdd=_0xc3d5[_0x59b286];return _0x155cdd;};'use strict';var multer=require(_0x5c3d('0x0'));var util=require('util');var path=require(_0x5c3d('0x1'));var timeout=require(_0x5c3d('0x2'));var express=require(_0x5c3d('0x3'));var router=express[_0x5c3d('0x4')]();var fs_extra=require(_0x5c3d('0x5'));var auth=require(_0x5c3d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5c3d('0x7'));router[_0x5c3d('0x8')]('/',auth[_0x5c3d('0x9')](),controller['index']);router['get'](_0x5c3d('0xa'),auth['isAuthenticated'](),controller[_0x5c3d('0xb')]);router['get'](_0x5c3d('0xc'),auth['isAuthenticated'](),controller[_0x5c3d('0xd')]);router[_0x5c3d('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0x5c3d('0xe')]);router[_0x5c3d('0x8')](_0x5c3d('0xf'),auth['isAuthenticated'](),controller[_0x5c3d('0x10')]);router[_0x5c3d('0x11')]('/',auth['isAuthenticated'](),controller[_0x5c3d('0x12')]);router[_0x5c3d('0x11')](_0x5c3d('0x13'),auth[_0x5c3d('0x9')](),controller[_0x5c3d('0x14')]);router[_0x5c3d('0x11')](_0x5c3d('0x15'),auth['isAuthenticated'](),interaction[_0x5c3d('0x16')](_0x5c3d('0x17'),_0x5c3d('0x18')),controller[_0x5c3d('0x19')]);router[_0x5c3d('0x1a')](_0x5c3d('0xc'),auth['isAuthenticated'](),interaction['tracked']('mail','mailinteraction:update'),controller['update']);router[_0x5c3d('0x1b')](_0x5c3d('0xc'),auth[_0x5c3d('0x9')](),interaction[_0x5c3d('0x16')](_0x5c3d('0x17'),_0x5c3d('0x1c')),controller['destroy']);router[_0x5c3d('0x1b')]('/:id/tags',auth[_0x5c3d('0x9')](),controller[_0x5c3d('0x1d')]);module[_0x5c3d('0x1e')]=router; \ No newline at end of file +var _0x49de=['/:id/download','download','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','/:id','tracked','mailinteraction:update','update','mailinteraction:destroy','removeTags','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','describe','show','/:id/messages','getMessages'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x49de,0x171));var _0xe49d=function(_0x51539c,_0x25f587){_0x51539c=_0x51539c-0x0;var _0x4f7914=_0x49de[_0x51539c];return _0x4f7914;};'use strict';var multer=require(_0xe49d('0x0'));var util=require(_0xe49d('0x1'));var path=require(_0xe49d('0x2'));var timeout=require('connect-timeout');var express=require(_0xe49d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe49d('0x4'));var interaction=require(_0xe49d('0x5'));var config=require(_0xe49d('0x6'));var controller=require(_0xe49d('0x7'));router[_0xe49d('0x8')]('/',auth[_0xe49d('0x9')](),controller[_0xe49d('0xa')]);router['get']('/describe',auth[_0xe49d('0x9')](),controller[_0xe49d('0xb')]);router[_0xe49d('0x8')]('/:id',auth[_0xe49d('0x9')](),controller[_0xe49d('0xc')]);router[_0xe49d('0x8')](_0xe49d('0xd'),auth[_0xe49d('0x9')](),controller[_0xe49d('0xe')]);router[_0xe49d('0x8')](_0xe49d('0xf'),auth['isAuthenticated'](),controller[_0xe49d('0x10')]);router[_0xe49d('0x11')]('/',auth[_0xe49d('0x9')](),controller[_0xe49d('0x12')]);router['post'](_0xe49d('0xd'),auth[_0xe49d('0x9')](),controller[_0xe49d('0x13')]);router[_0xe49d('0x11')](_0xe49d('0x14'),auth[_0xe49d('0x9')](),interaction['tracked'](_0xe49d('0x15'),_0xe49d('0x16')),controller[_0xe49d('0x17')]);router[_0xe49d('0x18')](_0xe49d('0x19'),auth[_0xe49d('0x9')](),interaction[_0xe49d('0x1a')]('mail',_0xe49d('0x1b')),controller[_0xe49d('0x1c')]);router['delete'](_0xe49d('0x19'),auth[_0xe49d('0x9')](),interaction[_0xe49d('0x1a')](_0xe49d('0x15'),_0xe49d('0x1d')),controller['destroy']);router['delete'](_0xe49d('0x14'),auth['isAuthenticated'](),controller[_0xe49d('0x1e')]);module[_0xe49d('0x1f')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index ded86b8..58a7b1b 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 _0x87d0=['iconv','exports','DATE','STRING','TEXT','long','BOOLEAN','ENUM','out','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x87d0,0xbd));var _0x087d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x87d0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x087d('0x0'));var iconv=require(_0x087d('0x1'));module[_0x087d('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x087d('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x087d('0x4')]},'thirdDisposition':{'type':Sequelize[_0x087d('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x087d('0x5')](_0x087d('0x6'))},'subject':{'type':Sequelize[_0x087d('0x5')]()},'attach':{'type':Sequelize[_0x087d('0x7')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x087d('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x087d('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x087d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x087d('0x8')]('in',_0x087d('0x9')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x3c71=['iconv','exports','BOOLEAN','STRING','TEXT','DATE','ENUM','out','sequelize'];(function(_0x865ec9,_0x274e5d){var _0x5a4014=function(_0x5eed06){while(--_0x5eed06){_0x865ec9['push'](_0x865ec9['shift']());}};_0x5a4014(++_0x274e5d);}(_0x3c71,0x98));var _0x13c7=function(_0x18497b,_0x215e3b){_0x18497b=_0x18497b-0x0;var _0x1f238e=_0x3c71[_0x18497b];return _0x1f238e;};'use strict';var Sequelize=require(_0x13c7('0x0'));var iconv=require(_0x13c7('0x1'));module[_0x13c7('0x2')]={'closed':{'type':Sequelize[_0x13c7('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x13c7('0x4')]},'secondDisposition':{'type':Sequelize[_0x13c7('0x4')]},'thirdDisposition':{'type':Sequelize[_0x13c7('0x4')]},'note':{'type':Sequelize[_0x13c7('0x4')]},'inReplyTo':{'type':Sequelize[_0x13c7('0x4')](0x1fe)},'to':{'type':Sequelize[_0x13c7('0x4')]},'cc':{'type':Sequelize[_0x13c7('0x5')]('long')},'subject':{'type':Sequelize[_0x13c7('0x5')]()},'attach':{'type':Sequelize[_0x13c7('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x13c7('0x6')]},'substatus':{'type':Sequelize[_0x13c7('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x13c7('0x7')]('in',_0x13c7('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x13c7('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x13c7('0x7')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index e13048e..ecfd2a5 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 _0x26d9=['status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','name','Users','map','fullname','TagIds','Tags','split','push','MailMessage','findOne','plainBody','-id','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','select','field','color','from','tools_tags','u.id','user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','mail_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','Tag','forEach','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','buildExpression','keys','some','compact','isEmpty','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','MailAccountId','sequelize','toString','keyBy','merge','a.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.MailAccountId','i.UserId','Contact.firstName','c.lastName','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','enableEmailPreview','rows','show','params','includeAll','include','options','create','body','describe','addMessage','ids','getMessages','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','spread','emit','removeTags','unix','join','root','server','files','tmp','attachments','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','readFileSync','build','writeFileSync','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','juice','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./mailInteraction.socket','register','sendStatus'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x26d9,0xd3));var _0x926d=function(_0x1b4163,_0x1071bb){_0x1b4163=_0x1b4163-0x0;var _0x51f3b6=_0x26d9[_0x1b4163];return _0x51f3b6;};'use strict';var emlformat=require(_0x926d('0x0'));var rimraf=require(_0x926d('0x1'));var zipdir=require(_0x926d('0x2'));var jsonpatch=require(_0x926d('0x3'));var rp=require(_0x926d('0x4'));var moment=require(_0x926d('0x5'));var BPromise=require(_0x926d('0x6'));var Mustache=require(_0x926d('0x7'));var util=require(_0x926d('0x8'));var path=require('path');var sox=require(_0x926d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x926d('0xa'));var squel=require(_0x926d('0xb'));var crypto=require(_0x926d('0xc'));var jsforce=require(_0x926d('0xd'));var deskjs=require(_0x926d('0xe'));var toCsv=require(_0x926d('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var htmlToText=require('html-to-text');var juice=require(_0x926d('0x10'));var Redis=require('ioredis');var authService=require(_0x926d('0x11'));var qs=require(_0x926d('0x12'));var as=require(_0x926d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x926d('0x14'));var licenseUtil=require(_0x926d('0x15'));var db=require(_0x926d('0x16'))['db'];config[_0x926d('0x17')]=_[_0x926d('0x18')](config[_0x926d('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x926d('0x19'))[_0x926d('0x1a')](socket);function respondWithStatusCode(_0x535fed,_0x419318){_0x419318=_0x419318||0xcc;return function(_0x397ae0){if(_0x397ae0){return _0x535fed[_0x926d('0x1b')](_0x419318);}return _0x535fed[_0x926d('0x1c')](_0x419318)[_0x926d('0x1d')]();};}function respondWithResult(_0xeaca2b,_0x5412fe){_0x5412fe=_0x5412fe||0xc8;return function(_0x306d12){if(_0x306d12){return _0xeaca2b['status'](_0x5412fe)[_0x926d('0x1e')](_0x306d12);}};}function respondWithFilteredResult(_0x5eca57,_0xad46df){return function(_0x1454ee){if(_0x1454ee){var _0x3ac3e7=typeof _0xad46df[_0x926d('0x1f')]===_0x926d('0x20')&&typeof _0xad46df['limit']===_0x926d('0x20');var _0xa581df=_0x1454ee[_0x926d('0x21')];var _0x5c6d1a=_0x3ac3e7?0x0:_0xad46df['offset'];var _0x2e737d=_0x3ac3e7?_0x1454ee[_0x926d('0x21')]:_0xad46df[_0x926d('0x1f')]+_0xad46df[_0x926d('0x22')];var _0x385bae;if(_0x2e737d>=_0xa581df){_0x2e737d=_0xa581df;_0x385bae=0xc8;}else{_0x385bae=0xce;}_0x5eca57['status'](_0x385bae);return _0x5eca57[_0x926d('0x23')](_0x926d('0x24'),_0x5c6d1a+'-'+_0x2e737d+'/'+_0xa581df)[_0x926d('0x1e')](_0x1454ee);}return null;};}function patchUpdates(_0x696284){return function(_0x5e9080){try{jsonpatch[_0x926d('0x25')](_0x5e9080,_0x696284,!![]);}catch(_0xcb3ff3){return BPromise[_0x926d('0x26')](_0xcb3ff3);}return _0x5e9080[_0x926d('0x27')]();};}function saveUpdates(_0x32064c,_0x4826b7){return function(_0x4b446b){if(_0x4b446b){return _0x4b446b['update'](_0x32064c)[_0x926d('0x28')](function(_0x333374){return _0x333374;});}return null;};}function removeEntity(_0x14ace4,_0x53efc9){return function(_0x228bc1){if(_0x228bc1){return _0x228bc1[_0x926d('0x29')]()[_0x926d('0x28')](function(){_0x14ace4[_0x926d('0x1c')](0xcc)[_0x926d('0x1d')]();});}};}function handleEntityNotFound(_0x3994fa,_0x56f534){return function(_0x37b4ed){if(!_0x37b4ed){_0x3994fa[_0x926d('0x1b')](0x194);}return _0x37b4ed;};}function handleError(_0xcb227d,_0xb6ff19){_0xb6ff19=_0xb6ff19||0x1f4;return function(_0x1d76e4){logger['error'](_0x1d76e4['stack']);if(_0x1d76e4[_0x926d('0x2a')]){delete _0x1d76e4[_0x926d('0x2a')];}_0xcb227d[_0x926d('0x1c')](_0xb6ff19)['send'](_0x1d76e4);};}function getInteractionUsers(_0x2acb42,_0x3848e9){return new BPromise(function(_0x491d89,_0x24d92e){try{if(_0x3848e9[_0x2acb42['id']]){_0x2acb42[_0x926d('0x2b')]=_[_0x926d('0x2c')](_0x3848e9[_0x2acb42['id']],function(_0xfb501c){return{'id':_0xfb501c['id'],'fullname':_0xfb501c[_0x926d('0x2d')]};});}}catch(_0x15ccaa){_0x24d92e(_0x15ccaa);}_0x491d89(_0x2acb42);});}function getInteractionTags(_0xbb4056,_0x1b0e92){return new BPromise(function(_0x546648,_0x3b0216){try{if(_0xbb4056[_0x926d('0x2e')]){_0xbb4056[_0x926d('0x2f')]=[];_0xbb4056[_0x926d('0x2e')][_0x926d('0x30')](',')['forEach'](function(_0x57da3d){_0xbb4056[_0x926d('0x2f')][_0x926d('0x31')](_0x1b0e92[_0x57da3d]);});}delete _0xbb4056[_0x926d('0x2e')];}catch(_0x116e59){_0x3b0216(_0x116e59);}_0x546648(_0xbb4056);});}function getLastMessageText(_0x323e52){return new BPromise(function(_0x5a8d4a,_0x4711ba){return db[_0x926d('0x32')][_0x926d('0x33')]({'where':{'$and':[{'MailInteractionId':_0x323e52['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x926d('0x34')],'order':_0x926d('0x35'),'raw':!![]})[_0x926d('0x28')](function(_0x27f71e){if(_0x27f71e&&_0x27f71e[_0x926d('0x34')]){_0x323e52[_0x926d('0x36')]=_[_0x926d('0x37')](_0x27f71e[_0x926d('0x34')]);}_0x5a8d4a(_0x323e52);})[_0x926d('0x38')](function(_0x2ddfd1){_0x4711ba(_0x2ddfd1);});});}function updateMailInteraction(_0x1e9ed5,_0x506ec7,_0x594597,_0x130854){return new BPromise(function(_0x493add,_0x157441){return getInteractionUsers(_0x1e9ed5,_0x594597)[_0x926d('0x28')](function(_0x4b7ab7){return getInteractionTags(_0x4b7ab7,_0x506ec7);})[_0x926d('0x28')](function(_0x5e572b){if(_0x130854){_0x493add(getLastMessageText(_0x5e572b));}else{_0x493add(_0x5e572b);}})['catch'](function(_0x4a972f){_0x157441(_0x4a972f);});});}exports[_0x926d('0x39')]=function(_0x131def,_0x454533){var _0x2d91cf={},_0xa21889={},_0x46f65f={'count':0x0,'rows':[]};var _0x560092=_[_0x926d('0x2c')](db[_0x926d('0x3a')][_0x926d('0x3b')],function(_0x5639b7){return{'name':_0x5639b7[_0x926d('0x3c')],'type':_0x5639b7[_0x926d('0x3d')][_0x926d('0x3e')]};});_0xa21889[_0x926d('0x3f')]=_[_0x926d('0x2c')](_0x560092,_0x926d('0x2a'));_0xa21889['query']=_['keys'](_0x131def[_0x926d('0x40')]);_0xa21889[_0x926d('0x41')]=_[_0x926d('0x42')](_0xa21889[_0x926d('0x3f')],_0xa21889['query']);_0x2d91cf[_0x926d('0x43')]=_['intersection'](_0xa21889['model'],qs[_0x926d('0x44')](_0x131def[_0x926d('0x40')][_0x926d('0x44')]));_0x2d91cf[_0x926d('0x43')]=_0x2d91cf['attributes'][_0x926d('0x45')]?_0x2d91cf[_0x926d('0x43')]:_0xa21889[_0x926d('0x3f')];if(!_0x131def['query']['hasOwnProperty'](_0x926d('0x46'))){_0x2d91cf[_0x926d('0x22')]=qs[_0x926d('0x22')](_0x131def[_0x926d('0x40')][_0x926d('0x22')]);_0x2d91cf[_0x926d('0x1f')]=qs['offset'](_0x131def['query'][_0x926d('0x1f')]);}_0x2d91cf[_0x926d('0x47')]=qs[_0x926d('0x48')](_0x131def[_0x926d('0x40')]['sort']);_0x2d91cf[_0x926d('0x49')]=qs[_0x926d('0x41')](_['pick'](_0x131def[_0x926d('0x40')],_0xa21889[_0x926d('0x41')]),_0x560092);var _0x11215b=[];var _0x42eee0=squel[_0x926d('0x4a')]()[_0x926d('0x4b')]('id')[_0x926d('0x4b')](_0x926d('0x2a'))[_0x926d('0x4b')](_0x926d('0x4c'))[_0x926d('0x4d')](_0x926d('0x4e'));var _0x2dd78a=squel['select']()[_0x926d('0x4b')](_0x926d('0x4f'))[_0x926d('0x4b')]('u.fullname')[_0x926d('0x4b')]('ui.MailInteractionId')[_0x926d('0x4d')](_0x926d('0x50'),'ui')['left_join'](_0x926d('0x51'),'u',_0x926d('0x52'));var _0x2abcdd=squel[_0x926d('0x4a')]()[_0x926d('0x4d')](_0x926d('0x53'),'i')[_0x926d('0x54')](_0x926d('0x55'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x926d('0x54')](_0x926d('0x51'),'o',_0x926d('0x56'))[_0x926d('0x54')](_0x926d('0x57'),'a',_0x926d('0x58'))['left_join'](_0x926d('0x59'),'me',_0x926d('0x5a'))['left_join'](_0x926d('0x5b'),'it',_0x926d('0x5c'))[_0x926d('0x54')](_0x926d('0x4e'),'t',_0x926d('0x5d'));var _0x206e94=squel[_0x926d('0x5e')]();var _0x3e0783=[];var _0x26baac=squel[_0x926d('0x5e')]();var _0x4da049;if(_0x131def['query'][_0x926d('0x5f')]){_0x4da049=as[_0x926d('0x60')](_0x131def[_0x926d('0x40')][_0x926d('0x5f')]);var _0x452698=_0x4da049[_0x926d('0x61')];for(var _0x5653df=0x0;_0x5653df<_0x4da049[_0x926d('0x62')][_0x926d('0x45')];_0x5653df++){var _0x4720ae=_0x4da049[_0x926d('0x62')][_0x5653df];var _0x9273a0='i';var _0x205b52=_[_0x926d('0x63')](_0x560092,[_0x926d('0x2a'),_0x4720ae['field']]);if(!_0x205b52){switch(_0x4720ae[_0x926d('0x4b')]){case _0x926d('0x64'):if(_0x4720ae[_0x926d('0x65')]==0x1){_0x2abcdd[_0x926d('0x66')]('`'+_0x4720ae[_0x926d('0x4b')]+_0x926d('0x67'));}else{_0x2abcdd[_0x926d('0x66')]('`'+_0x4720ae[_0x926d('0x4b')]+_0x926d('0x68'));}break;case _0x926d('0x69'):if(_0x4720ae[_0x926d('0x6a')]===_0x926d('0x6b')){if(_0x4720ae[_0x926d('0x65')][_0x926d('0x30')]('\x20')[_0x926d('0x45')]>0x1){_0x206e94[_0x452698](_0x926d('0x6c'),qs[_0x926d('0x6d')](_0x4720ae['value']),null);}else{var _0x202300='%'+_0x4720ae[_0x926d('0x65')]+'%';_0x206e94[_0x452698](_0x926d('0x6e'),_0x202300,_0x202300,_0x202300);}}else{_0x205b52=_[_0x926d('0x63')](_0x560092,[_0x926d('0x2a'),_0x926d('0x6f')]);_0x4720ae['field']='ContactId';_0x31a897=as['buildExpression'](_0x9273a0,_0x205b52[_0x926d('0x3d')],_0x4720ae);_0x206e94[_0x452698](_0x31a897['text'],_0x31a897[_0x926d('0x65')][_0x926d('0x70')],_0x31a897[_0x926d('0x65')][_0x926d('0x1d')]);}break;case _0x926d('0x71'):var _0xc8ed80=_0x4720ae[_0x926d('0x65')][_0x926d('0x30')](',')[_0x926d('0x2c')](function(_0x40d745){return Number(_0x40d745);});_0xc8ed80[_0x926d('0x72')](function(_0x28719c){_0x26baac['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x28719c+',%');});_0x3e0783=_[_0x926d('0x73')](_0x3e0783,_0xc8ed80);break;case'User':if(_0x4720ae[_0x926d('0x6a')]===_0x926d('0x6b')){_0x206e94[_0x452698](_0x926d('0x74'),'%'+_0x4720ae[_0x926d('0x65')]+'%',null);}else{_0x205b52=_[_0x926d('0x63')](_0x560092,[_0x926d('0x2a'),_0x926d('0x75')]);_0x4720ae[_0x926d('0x4b')]='UserId';_0x31a897=as['buildExpression'](_0x9273a0,_0x205b52[_0x926d('0x3d')],_0x4720ae);_0x206e94[_0x452698](_0x31a897[_0x926d('0x76')],_0x31a897[_0x926d('0x65')]['start'],_0x31a897[_0x926d('0x65')]['end']);}break;case _0x926d('0x34'):_0x31a897=as[_0x926d('0x77')]('me',null,_0x4720ae);_0x206e94[_0x452698](_0x31a897[_0x926d('0x76')],_0x31a897['value'][_0x926d('0x70')],_0x31a897[_0x926d('0x65')][_0x926d('0x1d')]);break;}}else{var _0x31a897=as['buildExpression'](_0x9273a0,_0x205b52[_0x926d('0x3d')],_0x4720ae);_0x206e94[_0x452698](_0x31a897[_0x926d('0x76')],_0x31a897[_0x926d('0x65')][_0x926d('0x70')],_0x31a897['value'][_0x926d('0x1d')]);}}}else{var _0x3b2b75=_(_0x131def[_0x926d('0x40')])[_0x926d('0x78')]()[_0x926d('0x2c')](function(_0x38adac){return _[_0x926d('0x79')](_0x560092,['name',_0x38adac])?_0x38adac:undefined;})[_0x926d('0x7a')]()[_0x926d('0x65')]();if(!_[_0x926d('0x7b')](_0x3b2b75)){_0x3b2b75[_0x926d('0x72')](function(_0x4ab842){if(_0x4ab842==='MailAccountId'){_0x2abcdd['where']('i.MailAccountId\x20IN\x20?',[]['concat'](_0x131def[_0x926d('0x40')][_0x4ab842]));}else if(_0x4ab842===_0x926d('0x7c')){var _0x5d7178=JSON[_0x926d('0x7d')](_0x131def['query'][_0x4ab842])[_0x926d('0x7e')];var _0x592640=JSON[_0x926d('0x7d')](_0x131def['query'][_0x4ab842])[_0x926d('0x7f')];_0x2abcdd[_0x926d('0x49')](_0x926d('0x80'),_0x5d7178,_0x592640);}else{if(_0x131def[_0x926d('0x40')][_0x4ab842]===_0x926d('0x81')){_0x2abcdd[_0x926d('0x49')]('i.'+_0x4ab842+_0x926d('0x82'));}else{_0x2abcdd[_0x926d('0x49')]('i.'+_0x4ab842+_0x926d('0x83'),_0x131def[_0x926d('0x40')][_0x4ab842]);}}});}if(_0x131def[_0x926d('0x40')][_0x926d('0x84')]){if(_0x131def['query'][_0x926d('0x84')]==0x1){_0x2abcdd[_0x926d('0x66')]('`unreadMessages`\x20=\x200');}else{_0x2abcdd['having'](_0x926d('0x85'));}}if(_0x131def[_0x926d('0x40')][_0x926d('0x86')]){_0x3e0783=_[_0x926d('0x87')](_0x131def[_0x926d('0x40')][_0x926d('0x86')])?_0x131def[_0x926d('0x40')][_0x926d('0x86')]:new Array(_0x131def[_0x926d('0x40')][_0x926d('0x86')]);_0x3e0783[_0x926d('0x72')](function(_0x419201){_0x26baac['or'](_0x926d('0x88'),'%,'+_0x419201+',%');});}if(_0x131def[_0x926d('0x40')]['filter']){var _0x45a429=_0x131def[_0x926d('0x40')][_0x926d('0x89')]['replace']('\x5c','\x5c\x5c')[_0x926d('0x8a')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x45a429)){_0x206e94['or'](_0x926d('0x8b'),_0x45a429+'%');}else if(qs[_0x926d('0x8c')](_0x45a429)){_0x206e94['or'](_0x926d('0x8d'),_0x45a429+'%');}else{_0x206e94['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x45a429))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x926d('0x6d')](_0x45a429));}}}_0x2abcdd[_0x926d('0x49')](_0x206e94);_0x2abcdd[_0x926d('0x8e')](_0x926d('0x8f'));var _0x21084f={'type':db[_0x926d('0x90')]['QueryTypes'][_0x926d('0x91')],'raw':!![]};var _0x4da582=_0x2abcdd[_0x926d('0x92')]();_0x4da582[_0x926d('0x4b')]('i.id');_0x4da582[_0x926d('0x4b')](_0x926d('0x93'),_0x926d('0x64'));if(_0x2d91cf[_0x926d('0x47')]){_0x2d91cf[_0x926d('0x47')][_0x926d('0x72')](function(_0x572025){var _0x2cf73f=_0x572025[0x0]===_0x926d('0x94')?_0x572025[0x0]:'i.'+_0x572025[0x0];_0x2abcdd[_0x926d('0x47')](_0x2cf73f,_0x572025[0x1]===_0x926d('0x95')?![]:!![]);});}if(!_[_0x926d('0x7b')](_0x3e0783)){_0x2abcdd[_0x926d('0x66')](_0x26baac);_0x4da582[_0x926d('0x49')](_0x926d('0x96'),_0x3e0783);}BPromise[_0x926d('0x97')]()[_0x926d('0x28')](function(){if(!_0x4da049){if(_0x131def['query']['MailAccountId'])return;_0x4da582[_0x926d('0x49')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x2abcdd[_0x926d('0x49')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x131def[_0x926d('0x98')][_0x926d('0x99')]!==_0x926d('0x9a'))return;return _0x131def[_0x926d('0x98')][_0x926d('0x9b')]({'attributes':['id'],'raw':!![]})[_0x926d('0x28')](function(_0x444072){if(_[_0x926d('0x7b')](_0x444072)){_0x4da582['where'](_0x926d('0x9c'));_0x2abcdd[_0x926d('0x49')]('i.MailAccountId\x20IS\x20NULL');}else{_0x4da582[_0x926d('0x49')]('i.MailAccountId\x20IN\x20?',_[_0x926d('0x2c')](_0x444072,'id'));_0x2abcdd[_0x926d('0x49')](_0x926d('0x9d'),_['map'](_0x444072,'id'));}});})[_0x926d('0x28')](function(){if(_0x131def[_0x926d('0x98')][_0x926d('0x99')]==='agent'&&!_0x4da049&&!_0x131def[_0x926d('0x40')][_0x926d('0x9e')])return[];return db['sequelize']['query'](_0x4da582['toString'](),_0x21084f);})[_0x926d('0x28')](function(_0x18eb5c){_0x46f65f[_0x926d('0x21')]=_0x18eb5c[_0x926d('0x45')];if(_0x46f65f['count']===0x0)return[];return db[_0x926d('0x9f')][_0x926d('0x40')](_0x42eee0[_0x926d('0xa0')](),_0x21084f)[_0x926d('0x28')](function(_0x234733){_0x11215b=_[_0x926d('0xa1')](_0x234733,'id');_0x21084f=_[_0x926d('0xa2')](_0x21084f,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x131def['query']['fields']){_0x2d91cf['attributes'][_0x926d('0x72')](function(_0x4d5823){_0x2abcdd[_0x926d('0x4b')]('i.'+_0x4d5823);});}else{_0x2abcdd['field'](_0x926d('0x93'),_0x926d('0x64'));_0x2abcdd[_0x926d('0x4b')](_0x926d('0xa3'),'Account.key');_0x2abcdd[_0x926d('0x4b')]('a.mandatoryDisposition',_0x926d('0xa4'));_0x2abcdd[_0x926d('0x4b')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x926d('0x94'));_0x2abcdd[_0x926d('0x4b')](_0x926d('0x8f'));_0x2abcdd[_0x926d('0x4b')](_0x926d('0xa5'));_0x2abcdd['field'](_0x926d('0xa6'));_0x2abcdd['field'](_0x926d('0xa7'));_0x2abcdd[_0x926d('0x4b')](_0x926d('0xa8'));_0x2abcdd[_0x926d('0x4b')](_0x926d('0xa9'));_0x2abcdd[_0x926d('0x4b')](_0x926d('0xaa'));_0x2abcdd['field'](_0x926d('0xab'));_0x2abcdd['field'](_0x926d('0xac'));_0x2abcdd[_0x926d('0x4b')](_0x926d('0xad'));_0x2abcdd[_0x926d('0x4b')](_0x926d('0xae'));_0x2abcdd['field'](_0x926d('0xaf'));_0x2abcdd['field'](_0x926d('0xb0'));_0x2abcdd[_0x926d('0x4b')]('i.to');_0x2abcdd[_0x926d('0x4b')]('i.ContactId');_0x2abcdd['field'](_0x926d('0xb1'));_0x2abcdd['field'](_0x926d('0xb2'));_0x2abcdd[_0x926d('0x4b')]('c.firstName',_0x926d('0xb3'));_0x2abcdd[_0x926d('0x4b')](_0x926d('0xb4'),'Contact.lastName');_0x2abcdd[_0x926d('0x4b')]('c.email','Contact.email');_0x2abcdd[_0x926d('0x4b')](_0x926d('0xb5'),_0x926d('0xb6'));_0x2abcdd[_0x926d('0x4b')](_0x926d('0xb7'),'Contact.mobile');_0x2abcdd[_0x926d('0x4b')]('c.fax',_0x926d('0xb8'));_0x2abcdd[_0x926d('0x4b')](_0x926d('0xb9'),_0x926d('0xba'));_0x2abcdd['field']('o.internal',_0x926d('0xbb'));_0x2abcdd['field'](_0x926d('0xbc'),'TagIds');}if(_0x2d91cf[_0x926d('0x22')])_0x2abcdd[_0x926d('0x22')](_0x2d91cf[_0x926d('0x22')]);if(_0x2d91cf['offset'])_0x2abcdd[_0x926d('0x1f')](_0x2d91cf[_0x926d('0x1f')]);return db[_0x926d('0x9f')][_0x926d('0x40')](_0x2abcdd[_0x926d('0xa0')](),_0x21084f);})[_0x926d('0x28')](function(_0x4cfe60){if(_0x4cfe60[_0x926d('0x45')]>0x0)_0x2dd78a['where']('ui.MailInteractionId\x20IN\x20?',_[_0x926d('0x2c')](_0x4cfe60,'id'));return db[_0x926d('0x9f')]['query'](_0x2dd78a['toString'](),_0x21084f)[_0x926d('0x28')](function(_0x1494e3){var _0x1de04f=_['groupBy'](_0x1494e3,'MailInteractionId');var _0x190148=[];return db['Setting'][_0x926d('0x33')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0x926d('0x28')](function(_0x1bf0bc){var _0x4c6595=_0x1bf0bc[_0x926d('0xbd')];_0x4cfe60[_0x926d('0x72')](function(_0x580a53){_0x190148[_0x926d('0x31')](updateMailInteraction(_0x580a53,_0x11215b,_0x1de04f,_0x4c6595));});return BPromise['all'](_0x190148);});});});})[_0x926d('0x28')](function(_0x1ab98c){_0x46f65f[_0x926d('0xbe')]=_0x1ab98c;return _0x46f65f;})['then'](respondWithFilteredResult(_0x454533,_0x2d91cf))[_0x926d('0x38')](handleError(_0x454533,null));};exports[_0x926d('0xbf')]=function(_0x753c7c,_0x361686){var _0x2604b0={'raw':![],'where':{'id':_0x753c7c[_0x926d('0xc0')]['id']}},_0x6950d6={};_0x6950d6[_0x926d('0x3f')]=_[_0x926d('0x78')](db[_0x926d('0x3a')][_0x926d('0x3b')]);_0x6950d6['query']=_[_0x926d('0x78')](_0x753c7c[_0x926d('0x40')]);_0x6950d6[_0x926d('0x41')]=_['intersection'](_0x6950d6[_0x926d('0x3f')],_0x6950d6[_0x926d('0x40')]);_0x2604b0[_0x926d('0x43')]=_[_0x926d('0x42')](_0x6950d6['model'],qs[_0x926d('0x44')](_0x753c7c[_0x926d('0x40')][_0x926d('0x44')]));_0x2604b0[_0x926d('0x43')]=_0x2604b0[_0x926d('0x43')][_0x926d('0x45')]?_0x2604b0[_0x926d('0x43')]:_0x6950d6[_0x926d('0x3f')];if(_0x753c7c[_0x926d('0x40')][_0x926d('0xc1')]){_0x2604b0[_0x926d('0xc2')]=[{'all':!![]}];}_0x2604b0=_[_0x926d('0xa2')]({},_0x2604b0,_0x753c7c[_0x926d('0xc3')]);return db[_0x926d('0x3a')][_0x926d('0x63')](_0x2604b0)[_0x926d('0x28')](handleEntityNotFound(_0x361686,null))['then'](respondWithResult(_0x361686,null))['catch'](handleError(_0x361686,null));};exports[_0x926d('0xc4')]=function(_0x20a50a,_0xa80c14){return db[_0x926d('0x3a')][_0x926d('0xc4')](_0x20a50a['body'],{})[_0x926d('0x28')](respondWithResult(_0xa80c14,0xc9))[_0x926d('0x38')](handleError(_0xa80c14,null));};exports['update']=function(_0x51e06f,_0x17d6e7){if(_0x51e06f[_0x926d('0xc5')]['id']){delete _0x51e06f[_0x926d('0xc5')]['id'];}return db[_0x926d('0x3a')]['find']({'where':{'id':_0x51e06f['params']['id']}})[_0x926d('0x28')](handleEntityNotFound(_0x17d6e7,null))['then'](saveUpdates(_0x51e06f[_0x926d('0xc5')],null))[_0x926d('0x28')](respondWithResult(_0x17d6e7,null))['catch'](handleError(_0x17d6e7,null));};exports[_0x926d('0x29')]=function(_0x215860,_0x3312ed){return db[_0x926d('0x3a')][_0x926d('0x63')]({'where':{'id':_0x215860[_0x926d('0xc0')]['id']}})['then'](handleEntityNotFound(_0x3312ed,null))['then'](removeEntity(_0x3312ed,null))[_0x926d('0x38')](handleError(_0x3312ed,null));};exports[_0x926d('0xc6')]=function(_0x49de7d,_0x48512c){return db[_0x926d('0x3a')][_0x926d('0xc6')]()[_0x926d('0x28')](respondWithResult(_0x48512c,null))[_0x926d('0x38')](handleError(_0x48512c,null));};exports['addMessage']=function(_0x1c0242,_0x439044,_0x21b444){return db[_0x926d('0x32')][_0x926d('0x63')]({'where':{'id':_0x1c0242['params']['id']}})[_0x926d('0x28')](handleEntityNotFound(_0x439044,null))[_0x926d('0x28')](function(_0x1650ae){if(_0x1650ae){return _0x1650ae[_0x926d('0xc7')](_0x1c0242[_0x926d('0xc5')][_0x926d('0xc8')],_['omit'](_0x1c0242[_0x926d('0xc5')],[_0x926d('0xc8'),'id'])||{});}})[_0x926d('0x28')](respondWithResult(_0x439044,null))['catch'](handleError(_0x439044,null));};exports[_0x926d('0xc9')]=function(_0xe7cca3,_0x36f4ba,_0x401be3){var _0x4c06ad={'raw':![],'where':{}};var _0x22090c={};var _0x42d538={'count':0x0,'rows':[]};return db[_0x926d('0x3a')][_0x926d('0x33')]({'where':{'id':_0xe7cca3[_0x926d('0xc0')]['id']}})[_0x926d('0x28')](handleEntityNotFound(_0x36f4ba,null))[_0x926d('0x28')](function(_0x2b806c){if(_0x2b806c){_0x22090c[_0x926d('0x3f')]=_[_0x926d('0x78')](db[_0x926d('0x32')][_0x926d('0x3b')]);_0x22090c[_0x926d('0x40')]=_['keys'](_0xe7cca3[_0x926d('0x40')]);_0x22090c['filters']=_[_0x926d('0x42')](_0x22090c[_0x926d('0x3f')],_0x22090c[_0x926d('0x40')]);_0x4c06ad[_0x926d('0x43')]=_[_0x926d('0x42')](_0x22090c[_0x926d('0x3f')],qs[_0x926d('0x44')](_0xe7cca3[_0x926d('0x40')][_0x926d('0x44')]));_0x4c06ad[_0x926d('0x43')]=_0x4c06ad[_0x926d('0x43')]['length']?_0x4c06ad['attributes']:_0x22090c[_0x926d('0x3f')];if(!_0xe7cca3[_0x926d('0x40')]['hasOwnProperty'](_0x926d('0x46'))){_0x4c06ad[_0x926d('0x22')]=qs[_0x926d('0x22')](_0xe7cca3['query'][_0x926d('0x22')]);_0x4c06ad[_0x926d('0x1f')]=qs['offset'](_0xe7cca3['query'][_0x926d('0x1f')]);}_0x4c06ad[_0x926d('0x47')]=qs[_0x926d('0x48')](_0xe7cca3[_0x926d('0x40')]['sort']);_0x4c06ad['where']=qs[_0x926d('0x41')](_[_0x926d('0xca')](_0xe7cca3[_0x926d('0x40')],_0x22090c['filters']));_0x4c06ad[_0x926d('0x49')]['MailInteractionId']=_0x2b806c['id'];if(_0xe7cca3['query'][_0x926d('0x89')]){_0x4c06ad[_0x926d('0x49')]=_['merge'](_0x4c06ad[_0x926d('0x49')],{'$or':_[_0x926d('0x2c')](_0x4c06ad['attributes'],function(_0x2364bd){var _0x2fd8be={};_0x2fd8be[_0x2364bd]={'$like':'%'+_0xe7cca3[_0x926d('0x40')][_0x926d('0x89')]+'%'};return _0x2fd8be;})});}if(_0xe7cca3[_0x926d('0x40')][_0x926d('0x7e')]){var _0x1760c5=_0xe7cca3[_0x926d('0x40')][_0x926d('0x7e')][_0x926d('0x30')](',');var _0x9573fa={};_0x9573fa[_0x1760c5[0x0]]={'$gte':moment(_0x1760c5[0x1])[_0x926d('0xcb')](_0x926d('0xcc'))};_0x4c06ad[_0x926d('0x49')]=_['merge'](_0x4c06ad['where'],_0x9573fa);}_0x4c06ad=_[_0x926d('0xa2')]({},_0x4c06ad,_0xe7cca3[_0x926d('0xc3')]);return db[_0x926d('0x32')][_0x926d('0x21')]({'where':_0x4c06ad[_0x926d('0x49')]})[_0x926d('0x28')](function(_0x30488f){_0x42d538['count']=_0x30488f;if(_0xe7cca3[_0x926d('0x40')]['includeAll']){_0x4c06ad[_0x926d('0xc2')]=[{'all':!![]}];}return db[_0x926d('0x32')][_0x926d('0xcd')](_0x4c06ad);})[_0x926d('0x28')](function(_0x1e558e){if(_0xe7cca3[_0x926d('0x40')][_0x926d('0xce')]===_0x926d('0xcf')){for(var _0x3317d3=0x0;_0x3317d3<_0x1e558e[_0x926d('0x45')];_0x3317d3++){_0x1e558e[_0x3317d3][_0x926d('0xc5')]=juice(_0x1e558e[_0x3317d3][_0x926d('0xc5')]);}}_0x42d538[_0x926d('0xbe')]=_0x1e558e;return _0x42d538;});}})[_0x926d('0x28')](respondWithFilteredResult(_0x36f4ba,_0x4c06ad))[_0x926d('0x38')](handleError(_0x36f4ba,null));};exports[_0x926d('0xd0')]=function(_0x47794a,_0x56a1be,_0x37f36e){return db[_0x926d('0x3a')][_0x926d('0x63')]({'where':{'id':_0x47794a[_0x926d('0xc0')]['id']}})[_0x926d('0x28')](handleEntityNotFound(_0x56a1be,null))[_0x926d('0x28')](function(_0x1261a2){if(_0x1261a2){return _0x1261a2[_0x926d('0xd1')](_0x47794a[_0x926d('0xc5')][_0x926d('0xc8')],_['omit'](_0x47794a[_0x926d('0xc5')],[_0x926d('0xc8'),'id'])||{})[_0x926d('0xd2')](function(){return db[_0x926d('0x71')][_0x926d('0xcd')]({'attributes':['id','name',_0x926d('0x4c')],'where':{'id':_0x47794a['body'][_0x926d('0xc8')]}});})[_0x926d('0x28')](function(_0x5a57ca){socket[_0x926d('0xd3')]('mailInteractionTags:save',{'id':Number(_0x47794a[_0x926d('0xc0')]['id']),'tags':_0x5a57ca||[]});return{'id':Number(_0x47794a[_0x926d('0xc0')]['id']),'tags':_0x5a57ca||[]};});}})[_0x926d('0x28')](respondWithResult(_0x56a1be,null))[_0x926d('0x38')](handleError(_0x56a1be,null));};exports[_0x926d('0xd4')]=function(_0x3a2779,_0x13875f,_0x449652){return db[_0x926d('0x3a')][_0x926d('0x63')]({'where':{'id':_0x3a2779[_0x926d('0xc0')]['id']}})[_0x926d('0x28')](handleEntityNotFound(_0x13875f,null))[_0x926d('0x28')](function(_0x24192b){if(_0x24192b){return _0x24192b[_0x926d('0xd4')](_0x3a2779['query'][_0x926d('0xc8')]);}})[_0x926d('0x28')](respondWithStatusCode(_0x13875f,null))[_0x926d('0x38')](handleError(_0x13875f,null));};exports['download']=function(_0x84a3e9,_0x5bbe02){var _0x2ba3bd=moment()[_0x926d('0xd5')]()[_0x926d('0xa0')]();var _0x3ba774=path[_0x926d('0xd6')](config[_0x926d('0xd7')],_0x926d('0xd8'),_0x926d('0xd9'),_0x926d('0xda'));var _0x3820f7=path[_0x926d('0xd6')](config[_0x926d('0xd7')],'server','files',_0x926d('0xdb'));var _0x412e3a=path[_0x926d('0xd6')](_0x3ba774,_0x2ba3bd);var _0x501794=util['format']('transcript-%d-%s.zip',_0x84a3e9[_0x926d('0xc0')]['id'],_0x2ba3bd);var _0x470a7c=path[_0x926d('0xd6')](_0x3ba774,_0x501794);var _0x254d85=[];if(_0x84a3e9['query'][_0x926d('0xdb')]){_0x254d85[_0x926d('0x31')]({'model':db[_0x926d('0xdc')],'as':_0x926d('0xdd'),'raw':!![]});}var _0x258ee6=[{'model':db[_0x926d('0x32')],'as':_0x926d('0xde'),'attributes':['id',_0x926d('0xc5'),_0x926d('0x4d'),'to','cc',_0x926d('0xdf'),_0x926d('0xe0'),'createdAt'],'where':{'secret':![]},'order':qs[_0x926d('0x48')]('id'),'include':_0x254d85}];return db[_0x926d('0x3a')][_0x926d('0x63')]({'where':{'id':_0x84a3e9[_0x926d('0xc0')]['id']},'include':_0x258ee6})[_0x926d('0x28')](handleEntityNotFound(_0x5bbe02,null))[_0x926d('0x28')](function(_0x5e3dc9){if(_0x5e3dc9&&_0x5e3dc9[_0x926d('0xde')]){var _0x30d478=_0x5e3dc9[_0x926d('0xe1')]({'plain':!![]});fs[_0x926d('0xe2')](_0x412e3a);return BPromise[_0x926d('0xe3')](_0x30d478['Messages'],function(_0x2e93fd,_0x42f521){var _0x3ec512={'from':_0x2e93fd[_0x926d('0x4d')],'to':_0x2e93fd['to'],'subject':_0x2e93fd['subject'],'html':_0x2e93fd[_0x926d('0xc5')],'headers':{'Date':moment(_0x2e93fd[_0x926d('0x7c')])['format'](_0x926d('0xe4'))},'attachments':[]};if(_0x2e93fd['cc']){_0x3ec512[_0x926d('0xe5')]['Cc']=_0x2e93fd['cc'];}if(_0x2e93fd[_0x926d('0xdf')]){_0x3ec512[_0x926d('0xe5')][_0x926d('0xe6')]=_0x2e93fd['bcc'];}return new BPromise(function(_0x2d554b,_0x23b883){if(_0x2e93fd[_0x926d('0xdd')]){for(var _0x4ec8b7=0x0;_0x4ec8b7<_0x2e93fd[_0x926d('0xdd')][_0x926d('0x45')];_0x4ec8b7++){var _0x1cbca3=_0x2e93fd[_0x926d('0xdd')][_0x4ec8b7];var _0x39a61a=path[_0x926d('0xd6')](_0x3820f7,_0x1cbca3[_0x926d('0xe7')]);if(fs['existsSync'](_0x39a61a)){_0x3ec512[_0x926d('0xdb')][_0x926d('0x31')]({'name':_0x1cbca3[_0x926d('0x2a')],'contentType':_0x1cbca3['type'],'data':fs[_0x926d('0xe8')](_0x39a61a)});}}}emlformat[_0x926d('0xe9')](_0x3ec512,function(_0x5b8297,_0x2ff718){if(_0x5b8297)return _0x23b883(_0x5b8297);fs[_0x926d('0xea')](path[_0x926d('0xd6')](_0x412e3a,util[_0x926d('0xcb')]('message%d.eml',_0x42f521)),_0x2ff718);return _0x2d554b(_0x2ff718);});});})[_0x926d('0x28')](function(){return new BPromise(function(_0x5693fb,_0x169ce2){zipdir(_0x412e3a,{'saveTo':_0x470a7c},function(_0x1d892b,_0x187300){if(_0x1d892b)return _0x169ce2(_0x1d892b);return _0x5693fb(_0x187300);});})[_0x926d('0x28')](function(){return new BPromise(function(_0x2cb43a,_0x4b26dd){rimraf(_0x412e3a,function(_0x563790){if(_0x563790)_0x4b26dd(_0x563790);return _0x2cb43a();});});})[_0x926d('0x28')](function(){return _0x5bbe02[_0x926d('0xeb')](_0x470a7c,_0x501794,function(_0x29724a){if(_0x29724a){console[_0x926d('0xec')](_0x926d('0xed'),_0x29724a);}else{fs[_0x926d('0xee')](_0x470a7c);}});});});}else{return _0x5bbe02['sendStatus'](0xc8);}})[_0x926d('0x38')](handleError(_0x5bbe02,null));}; \ No newline at end of file +var _0x8309=['parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','user','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.thirdDisposition','i.substatus','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','enableEmailPreview','push','all','rows','params','intersection','includeAll','include','options','create','body','describe','addMessage','ids','omit','getMessages','MailMessage','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','spread','emit','removeTags','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','download','log','err','unlinkSync','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','html-to-text','juice','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','status','name','send','map','Tags','TagIds','split','forEach','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','type','key','query','keys','filters','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','ui.MailInteractionId','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','unreadMessages','value','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','start','some','isEmpty','i.MailAccountId\x20IN\x20?','concat','createdAt'];(function(_0xe262e0,_0x5d1962){var _0x3818fa=function(_0xf39ef2){while(--_0xf39ef2){_0xe262e0['push'](_0xe262e0['shift']());}};_0x3818fa(++_0x5d1962);}(_0x8309,0x176));var _0x9830=function(_0xefcb88,_0x21c846){_0xefcb88=_0xefcb88-0x0;var _0x56f006=_0x8309[_0xefcb88];return _0x56f006;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9830('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9830('0x1'));var moment=require(_0x9830('0x2'));var BPromise=require(_0x9830('0x3'));var Mustache=require(_0x9830('0x4'));var util=require(_0x9830('0x5'));var path=require(_0x9830('0x6'));var sox=require(_0x9830('0x7'));var csv=require(_0x9830('0x8'));var ejs=require(_0x9830('0x9'));var fs=require('fs');var fs_extra=require(_0x9830('0xa'));var _=require(_0x9830('0xb'));var squel=require(_0x9830('0xc'));var crypto=require(_0x9830('0xd'));var jsforce=require(_0x9830('0xe'));var deskjs=require(_0x9830('0xf'));var toCsv=require(_0x9830('0x8'));var querystring=require(_0x9830('0x10'));var Papa=require('papaparse');var htmlToText=require(_0x9830('0x11'));var juice=require(_0x9830('0x12'));var Redis=require(_0x9830('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9830('0x14'));var hardwareService=require(_0x9830('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x9830('0x16'));var config=require(_0x9830('0x17'));var licenseUtil=require(_0x9830('0x18'));var db=require(_0x9830('0x19'))['db'];config[_0x9830('0x1a')]=_[_0x9830('0x1b')](config[_0x9830('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x9830('0x1c'))(new Redis(config[_0x9830('0x1a')]));require(_0x9830('0x1d'))[_0x9830('0x1e')](socket);function respondWithStatusCode(_0x3b526b,_0xa2a8d0){_0xa2a8d0=_0xa2a8d0||0xcc;return function(_0x454ba5){if(_0x454ba5){return _0x3b526b[_0x9830('0x1f')](_0xa2a8d0);}return _0x3b526b['status'](_0xa2a8d0)[_0x9830('0x20')]();};}function respondWithResult(_0x41755a,_0xf70578){_0xf70578=_0xf70578||0xc8;return function(_0x3c85ca){if(_0x3c85ca){return _0x41755a['status'](_0xf70578)['json'](_0x3c85ca);}};}function respondWithFilteredResult(_0x29cd45,_0x3a63be){return function(_0x8b78e2){if(_0x8b78e2){var _0xad4570=typeof _0x3a63be[_0x9830('0x21')]===_0x9830('0x22')&&typeof _0x3a63be[_0x9830('0x23')]===_0x9830('0x22');var _0x55b96a=_0x8b78e2[_0x9830('0x24')];var _0x47aa04=_0xad4570?0x0:_0x3a63be[_0x9830('0x21')];var _0x1ca333=_0xad4570?_0x8b78e2[_0x9830('0x24')]:_0x3a63be[_0x9830('0x21')]+_0x3a63be[_0x9830('0x23')];var _0xd8a646;if(_0x1ca333>=_0x55b96a){_0x1ca333=_0x55b96a;_0xd8a646=0xc8;}else{_0xd8a646=0xce;}_0x29cd45['status'](_0xd8a646);return _0x29cd45[_0x9830('0x25')](_0x9830('0x26'),_0x47aa04+'-'+_0x1ca333+'/'+_0x55b96a)[_0x9830('0x27')](_0x8b78e2);}return null;};}function patchUpdates(_0x1c7c13){return function(_0x4cd8de){try{jsonpatch[_0x9830('0x28')](_0x4cd8de,_0x1c7c13,!![]);}catch(_0x45ea84){return BPromise['reject'](_0x45ea84);}return _0x4cd8de[_0x9830('0x29')]();};}function saveUpdates(_0x392785,_0x3a3bf1){return function(_0x12d2db){if(_0x12d2db){return _0x12d2db[_0x9830('0x2a')](_0x392785)['then'](function(_0x5ea837){return _0x5ea837;});}return null;};}function removeEntity(_0x172fbc,_0x2d4562){return function(_0x50c452){if(_0x50c452){return _0x50c452[_0x9830('0x2b')]()[_0x9830('0x2c')](function(){_0x172fbc[_0x9830('0x2d')](0xcc)[_0x9830('0x20')]();});}};}function handleEntityNotFound(_0x524d39,_0x293845){return function(_0x3063be){if(!_0x3063be){_0x524d39[_0x9830('0x1f')](0x194);}return _0x3063be;};}function handleError(_0x41fe58,_0x14d370){_0x14d370=_0x14d370||0x1f4;return function(_0x3466fd){logger['error'](_0x3466fd['stack']);if(_0x3466fd[_0x9830('0x2e')]){delete _0x3466fd[_0x9830('0x2e')];}_0x41fe58[_0x9830('0x2d')](_0x14d370)[_0x9830('0x2f')](_0x3466fd);};}function getInteractionUsers(_0x3c4001,_0x4396c1){return new BPromise(function(_0x4b1654,_0x160580){try{if(_0x4396c1[_0x3c4001['id']]){_0x3c4001['Users']=_[_0x9830('0x30')](_0x4396c1[_0x3c4001['id']],function(_0x2d33b1){return{'id':_0x2d33b1['id'],'fullname':_0x2d33b1['fullname']};});}}catch(_0x4ae84f){_0x160580(_0x4ae84f);}_0x4b1654(_0x3c4001);});}function getInteractionTags(_0x419e91,_0x47b9e8){return new BPromise(function(_0x264a94,_0x2910a7){try{if(_0x419e91['TagIds']){_0x419e91[_0x9830('0x31')]=[];_0x419e91[_0x9830('0x32')][_0x9830('0x33')](',')[_0x9830('0x34')](function(_0xb9f388){_0x419e91[_0x9830('0x31')]['push'](_0x47b9e8[_0xb9f388]);});}delete _0x419e91['TagIds'];}catch(_0x50e4){_0x2910a7(_0x50e4);}_0x264a94(_0x419e91);});}function getLastMessageText(_0x452556){return new BPromise(function(_0x5ab167,_0x27d3ea){return db['MailMessage'][_0x9830('0x35')]({'where':{'$and':[{'MailInteractionId':_0x452556['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x9830('0x36')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x9830('0x37')],'order':_0x9830('0x38'),'raw':!![]})[_0x9830('0x2c')](function(_0x1ae1ca){if(_0x1ae1ca&&_0x1ae1ca['plainBody']){_0x452556[_0x9830('0x39')]=_[_0x9830('0x3a')](_0x1ae1ca[_0x9830('0x37')]);}_0x5ab167(_0x452556);})[_0x9830('0x3b')](function(_0x489c73){_0x27d3ea(_0x489c73);});});}function updateMailInteraction(_0x419938,_0x6d6d53,_0xc68c95,_0x1f29fb){return new BPromise(function(_0x3bbc96,_0x8d5af4){return getInteractionUsers(_0x419938,_0xc68c95)[_0x9830('0x2c')](function(_0x15a982){return getInteractionTags(_0x15a982,_0x6d6d53);})[_0x9830('0x2c')](function(_0xef36ea){if(_0x1f29fb){_0x3bbc96(getLastMessageText(_0xef36ea));}else{_0x3bbc96(_0xef36ea);}})[_0x9830('0x3b')](function(_0x3fd205){_0x8d5af4(_0x3fd205);});});}exports[_0x9830('0x3c')]=function(_0x1ad2f4,_0x4b097c){var _0x341f61={},_0x308534={},_0x1511cb={'count':0x0,'rows':[]};var _0x19bc2d=_[_0x9830('0x30')](db[_0x9830('0x3d')][_0x9830('0x3e')],function(_0x39b57c){return{'name':_0x39b57c[_0x9830('0x3f')],'type':_0x39b57c[_0x9830('0x40')][_0x9830('0x41')]};});_0x308534['model']=_[_0x9830('0x30')](_0x19bc2d,_0x9830('0x2e'));_0x308534[_0x9830('0x42')]=_[_0x9830('0x43')](_0x1ad2f4[_0x9830('0x42')]);_0x308534[_0x9830('0x44')]=_['intersection'](_0x308534['model'],_0x308534[_0x9830('0x42')]);_0x341f61[_0x9830('0x45')]=_['intersection'](_0x308534['model'],qs[_0x9830('0x46')](_0x1ad2f4[_0x9830('0x42')][_0x9830('0x46')]));_0x341f61[_0x9830('0x45')]=_0x341f61[_0x9830('0x45')][_0x9830('0x47')]?_0x341f61[_0x9830('0x45')]:_0x308534[_0x9830('0x48')];if(!_0x1ad2f4['query'][_0x9830('0x49')](_0x9830('0x4a'))){_0x341f61[_0x9830('0x23')]=qs[_0x9830('0x23')](_0x1ad2f4[_0x9830('0x42')][_0x9830('0x23')]);_0x341f61[_0x9830('0x21')]=qs[_0x9830('0x21')](_0x1ad2f4['query'][_0x9830('0x21')]);}_0x341f61[_0x9830('0x4b')]=qs['sort'](_0x1ad2f4[_0x9830('0x42')][_0x9830('0x4c')]);_0x341f61[_0x9830('0x4d')]=qs['filters'](_[_0x9830('0x4e')](_0x1ad2f4[_0x9830('0x42')],_0x308534[_0x9830('0x44')]),_0x19bc2d);var _0x2c3554=[];var _0x153b61=squel[_0x9830('0x4f')]()[_0x9830('0x50')]('id')[_0x9830('0x50')](_0x9830('0x2e'))[_0x9830('0x50')](_0x9830('0x51'))[_0x9830('0x52')]('tools_tags');var _0x533921=squel[_0x9830('0x4f')]()[_0x9830('0x50')]('u.id')[_0x9830('0x50')]('u.fullname')[_0x9830('0x50')](_0x9830('0x53'))[_0x9830('0x52')](_0x9830('0x54'),'ui')[_0x9830('0x55')]('users','u',_0x9830('0x56'));var _0x5eaefc=squel['select']()['from'](_0x9830('0x57'),'i')[_0x9830('0x55')](_0x9830('0x58'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x9830('0x55')](_0x9830('0x59'),'o',_0x9830('0x5a'))[_0x9830('0x55')]('mail_accounts','a',_0x9830('0x5b'))[_0x9830('0x55')]('mail_messages','me',_0x9830('0x5c'))[_0x9830('0x55')](_0x9830('0x5d'),'it',_0x9830('0x5e'))[_0x9830('0x55')](_0x9830('0x5f'),'t',_0x9830('0x60'));var _0x297f5e=squel[_0x9830('0x61')]();var _0x4f0f6f=[];var _0x51d9e2=squel[_0x9830('0x61')]();var _0x388cc5;if(_0x1ad2f4[_0x9830('0x42')]['search']){_0x388cc5=as[_0x9830('0x62')](_0x1ad2f4[_0x9830('0x42')][_0x9830('0x63')]);var _0x41ac3f=_0x388cc5['sqlOperator'];for(var _0x5bddbd=0x0;_0x5bddbd<_0x388cc5[_0x9830('0x64')][_0x9830('0x47')];_0x5bddbd++){var _0x315afd=_0x388cc5['conditions'][_0x5bddbd];var _0x58b1e2='i';var _0x1671c3=_[_0x9830('0x65')](_0x19bc2d,[_0x9830('0x2e'),_0x315afd[_0x9830('0x50')]]);if(!_0x1671c3){switch(_0x315afd[_0x9830('0x50')]){case _0x9830('0x66'):if(_0x315afd[_0x9830('0x67')]==0x1){_0x5eaefc[_0x9830('0x68')]('`'+_0x315afd[_0x9830('0x50')]+'`\x20=\x200');}else{_0x5eaefc[_0x9830('0x68')]('`'+_0x315afd[_0x9830('0x50')]+'`\x20>\x200');}break;case _0x9830('0x69'):if(_0x315afd[_0x9830('0x6a')]==='$substring'){if(_0x315afd[_0x9830('0x67')][_0x9830('0x33')]('\x20')[_0x9830('0x47')]>0x1){_0x297f5e[_0x41ac3f](_0x9830('0x6b'),qs[_0x9830('0x6c')](_0x315afd[_0x9830('0x67')]),null);}else{var _0x51664f='%'+_0x315afd[_0x9830('0x67')]+'%';_0x297f5e[_0x41ac3f](_0x9830('0x6d'),_0x51664f,_0x51664f,_0x51664f);}}else{_0x1671c3=_['find'](_0x19bc2d,[_0x9830('0x2e'),_0x9830('0x6e')]);_0x315afd['field']=_0x9830('0x6e');_0x531815=as['buildExpression'](_0x58b1e2,_0x1671c3[_0x9830('0x40')],_0x315afd);_0x297f5e[_0x41ac3f](_0x531815[_0x9830('0x6f')],_0x531815[_0x9830('0x67')]['start'],_0x531815[_0x9830('0x67')][_0x9830('0x20')]);}break;case _0x9830('0x70'):var _0xa5f16=_0x315afd[_0x9830('0x67')]['split'](',')['map'](function(_0x3bc9af){return Number(_0x3bc9af);});_0xa5f16[_0x9830('0x34')](function(_0x1b3398){_0x51d9e2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1b3398+',%');});_0x4f0f6f=_['union'](_0x4f0f6f,_0xa5f16);break;case _0x9830('0x71'):if(_0x315afd[_0x9830('0x6a')]===_0x9830('0x72')){_0x297f5e[_0x41ac3f](_0x9830('0x73'),'%'+_0x315afd[_0x9830('0x67')]+'%',null);}else{_0x1671c3=_['find'](_0x19bc2d,[_0x9830('0x2e'),_0x9830('0x74')]);_0x315afd[_0x9830('0x50')]=_0x9830('0x74');_0x531815=as[_0x9830('0x75')](_0x58b1e2,_0x1671c3[_0x9830('0x40')],_0x315afd);_0x297f5e[_0x41ac3f](_0x531815[_0x9830('0x6f')],_0x531815[_0x9830('0x67')][_0x9830('0x76')],_0x531815['value']['end']);}break;case _0x9830('0x37'):_0x531815=as[_0x9830('0x75')]('me',null,_0x315afd);_0x297f5e[_0x41ac3f](_0x531815[_0x9830('0x6f')],_0x531815['value'][_0x9830('0x76')],_0x531815['value'][_0x9830('0x20')]);break;}}else{var _0x531815=as[_0x9830('0x75')](_0x58b1e2,_0x1671c3[_0x9830('0x40')],_0x315afd);_0x297f5e[_0x41ac3f](_0x531815[_0x9830('0x6f')],_0x531815[_0x9830('0x67')][_0x9830('0x76')],_0x531815['value'][_0x9830('0x20')]);}}}else{var _0x936e4f=_(_0x1ad2f4[_0x9830('0x42')])[_0x9830('0x43')]()[_0x9830('0x30')](function(_0x1bf188){return _[_0x9830('0x77')](_0x19bc2d,[_0x9830('0x2e'),_0x1bf188])?_0x1bf188:undefined;})['compact']()[_0x9830('0x67')]();if(!_[_0x9830('0x78')](_0x936e4f)){_0x936e4f[_0x9830('0x34')](function(_0x2f5c30){if(_0x2f5c30==='MailAccountId'){_0x5eaefc[_0x9830('0x4d')](_0x9830('0x79'),[][_0x9830('0x7a')](_0x1ad2f4['query'][_0x2f5c30]));}else if(_0x2f5c30===_0x9830('0x7b')){var _0x3e16fc=JSON[_0x9830('0x7c')](_0x1ad2f4[_0x9830('0x42')][_0x2f5c30])[_0x9830('0x7d')];var _0x3f092c=JSON[_0x9830('0x7c')](_0x1ad2f4[_0x9830('0x42')][_0x2f5c30])[_0x9830('0x7e')];_0x5eaefc[_0x9830('0x4d')](_0x9830('0x7f'),_0x3e16fc,_0x3f092c);}else{if(_0x1ad2f4[_0x9830('0x42')][_0x2f5c30]===_0x9830('0x80')){_0x5eaefc[_0x9830('0x4d')]('i.'+_0x2f5c30+'\x20IS\x20NULL');}else{_0x5eaefc[_0x9830('0x4d')]('i.'+_0x2f5c30+_0x9830('0x81'),_0x1ad2f4[_0x9830('0x42')][_0x2f5c30]);}}});}if(_0x1ad2f4['query'][_0x9830('0x82')]){if(_0x1ad2f4['query'][_0x9830('0x82')]==0x1){_0x5eaefc[_0x9830('0x68')]('`unreadMessages`\x20=\x200');}else{_0x5eaefc[_0x9830('0x68')](_0x9830('0x83'));}}if(_0x1ad2f4[_0x9830('0x42')]['tag']){_0x4f0f6f=_['isArray'](_0x1ad2f4[_0x9830('0x42')][_0x9830('0x84')])?_0x1ad2f4[_0x9830('0x42')]['tag']:new Array(_0x1ad2f4[_0x9830('0x42')][_0x9830('0x84')]);_0x4f0f6f[_0x9830('0x34')](function(_0x506284){_0x51d9e2['or'](_0x9830('0x85'),'%,'+_0x506284+',%');});}if(_0x1ad2f4[_0x9830('0x42')][_0x9830('0x86')]){var _0xd15b93=_0x1ad2f4[_0x9830('0x42')][_0x9830('0x86')]['replace']('\x5c','\x5c\x5c')[_0x9830('0x87')](/'/g,'\x27\x27');if(qs[_0x9830('0x88')](_0xd15b93)){_0x297f5e['or'](_0x9830('0x89'),_0xd15b93+'%');}else if(qs['isEmail'](_0xd15b93)){_0x297f5e['or'](_0x9830('0x8a'),_0xd15b93+'%');}else{_0x297f5e['or'](_0x9830('0x8b'),qs[_0x9830('0x6c')](_0xd15b93))['or'](_0x9830('0x8c'),qs[_0x9830('0x6c')](_0xd15b93));}}}_0x5eaefc[_0x9830('0x4d')](_0x297f5e);_0x5eaefc[_0x9830('0x8d')]('i.id');var _0x4eb823={'type':db[_0x9830('0x8e')][_0x9830('0x8f')][_0x9830('0x90')],'raw':!![]};var _0x49a9a9=_0x5eaefc[_0x9830('0x91')]();_0x49a9a9[_0x9830('0x50')](_0x9830('0x92'));_0x49a9a9[_0x9830('0x50')](_0x9830('0x93'),_0x9830('0x66'));if(_0x341f61[_0x9830('0x4b')]){_0x341f61[_0x9830('0x4b')][_0x9830('0x34')](function(_0x4e9924){var _0x28e823=_0x4e9924[0x0]===_0x9830('0x94')?_0x4e9924[0x0]:'i.'+_0x4e9924[0x0];_0x5eaefc[_0x9830('0x4b')](_0x28e823,_0x4e9924[0x1]===_0x9830('0x95')?![]:!![]);});}if(!_[_0x9830('0x78')](_0x4f0f6f)){_0x5eaefc[_0x9830('0x68')](_0x51d9e2);_0x49a9a9[_0x9830('0x4d')](_0x9830('0x96'),_0x4f0f6f);}BPromise[_0x9830('0x97')]()[_0x9830('0x2c')](function(){if(!_0x388cc5){if(_0x1ad2f4[_0x9830('0x42')][_0x9830('0x98')])return;_0x49a9a9[_0x9830('0x4d')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x5eaefc[_0x9830('0x4d')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x1ad2f4[_0x9830('0x99')]['role']!==_0x9830('0x9a'))return;return _0x1ad2f4[_0x9830('0x99')][_0x9830('0x9b')]({'attributes':['id'],'raw':!![]})[_0x9830('0x2c')](function(_0x57ad10){if(_[_0x9830('0x78')](_0x57ad10)){_0x49a9a9[_0x9830('0x4d')]('i.MailAccountId\x20IS\x20NULL');_0x5eaefc['where'](_0x9830('0x9c'));}else{_0x49a9a9[_0x9830('0x4d')](_0x9830('0x79'),_['map'](_0x57ad10,'id'));_0x5eaefc[_0x9830('0x4d')]('i.MailAccountId\x20IN\x20?',_[_0x9830('0x30')](_0x57ad10,'id'));}});})[_0x9830('0x2c')](function(){if(_0x1ad2f4[_0x9830('0x99')][_0x9830('0x9d')]==='agent'&&!_0x388cc5&&!_0x1ad2f4[_0x9830('0x42')][_0x9830('0x98')])return[];return db[_0x9830('0x9e')][_0x9830('0x42')](_0x49a9a9['toString'](),_0x4eb823);})[_0x9830('0x2c')](function(_0x607419){_0x1511cb['count']=_0x607419[_0x9830('0x47')];if(_0x1511cb['count']===0x0)return[];return db[_0x9830('0x9e')]['query'](_0x153b61[_0x9830('0x9f')](),_0x4eb823)[_0x9830('0x2c')](function(_0xdfc776){_0x2c3554=_[_0x9830('0xa0')](_0xdfc776,'id');_0x4eb823=_[_0x9830('0xa1')](_0x4eb823,{'model':db[_0x9830('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1ad2f4[_0x9830('0x42')][_0x9830('0x46')]){_0x341f61['attributes']['forEach'](function(_0x915a27){_0x5eaefc['field']('i.'+_0x915a27);});}else{_0x5eaefc[_0x9830('0x50')](_0x9830('0x93'),'unreadMessages');_0x5eaefc['field'](_0x9830('0xa2'),_0x9830('0xa3'));_0x5eaefc['field'](_0x9830('0xa4'),'Account.mandatoryDisposition');_0x5eaefc[_0x9830('0x50')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x5eaefc[_0x9830('0x50')](_0x9830('0x92'));_0x5eaefc['field'](_0x9830('0xa5'));_0x5eaefc[_0x9830('0x50')](_0x9830('0xa6'));_0x5eaefc[_0x9830('0x50')](_0x9830('0xa7'));_0x5eaefc[_0x9830('0x50')](_0x9830('0xa8'));_0x5eaefc[_0x9830('0x50')]('i.attach');_0x5eaefc[_0x9830('0x50')]('i.lastMsgAt');_0x5eaefc[_0x9830('0x50')](_0x9830('0xa9'));_0x5eaefc['field'](_0x9830('0xaa'));_0x5eaefc[_0x9830('0x50')]('i.disposition');_0x5eaefc[_0x9830('0x50')](_0x9830('0xab'));_0x5eaefc['field'](_0x9830('0xac'));_0x5eaefc[_0x9830('0x50')](_0x9830('0xad'));_0x5eaefc['field']('i.to');_0x5eaefc[_0x9830('0x50')](_0x9830('0xae'));_0x5eaefc[_0x9830('0x50')](_0x9830('0xaf'));_0x5eaefc['field'](_0x9830('0xb0'));_0x5eaefc['field'](_0x9830('0xb1'),_0x9830('0xb2'));_0x5eaefc[_0x9830('0x50')](_0x9830('0xb3'),_0x9830('0xb4'));_0x5eaefc[_0x9830('0x50')](_0x9830('0xb5'),_0x9830('0xb6'));_0x5eaefc[_0x9830('0x50')](_0x9830('0xb7'),_0x9830('0xb8'));_0x5eaefc[_0x9830('0x50')](_0x9830('0xb9'),_0x9830('0xba'));_0x5eaefc[_0x9830('0x50')](_0x9830('0xbb'),_0x9830('0xbc'));_0x5eaefc[_0x9830('0x50')](_0x9830('0xbd'),_0x9830('0xbe'));_0x5eaefc[_0x9830('0x50')]('o.internal',_0x9830('0xbf'));_0x5eaefc['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x9830('0x32'));}if(_0x341f61[_0x9830('0x23')])_0x5eaefc[_0x9830('0x23')](_0x341f61['limit']);if(_0x341f61[_0x9830('0x21')])_0x5eaefc[_0x9830('0x21')](_0x341f61[_0x9830('0x21')]);return db['sequelize'][_0x9830('0x42')](_0x5eaefc[_0x9830('0x9f')](),_0x4eb823);})['then'](function(_0x46fade){if(_0x46fade[_0x9830('0x47')]>0x0)_0x533921[_0x9830('0x4d')](_0x9830('0xc0'),_[_0x9830('0x30')](_0x46fade,'id'));return db[_0x9830('0x9e')][_0x9830('0x42')](_0x533921[_0x9830('0x9f')](),_0x4eb823)[_0x9830('0x2c')](function(_0x1cb057){var _0x168310=_['groupBy'](_0x1cb057,_0x9830('0xc1'));var _0x51ee91=[];return db[_0x9830('0xc2')]['findOne']({'attributes':[_0x9830('0xc3')],'raw':!![]})[_0x9830('0x2c')](function(_0x1e1c24){var _0x4d4250=_0x1e1c24['enableEmailPreview'];_0x46fade[_0x9830('0x34')](function(_0x1ef648){_0x51ee91[_0x9830('0xc4')](updateMailInteraction(_0x1ef648,_0x2c3554,_0x168310,_0x4d4250));});return BPromise[_0x9830('0xc5')](_0x51ee91);});});});})[_0x9830('0x2c')](function(_0x13f553){_0x1511cb[_0x9830('0xc6')]=_0x13f553;return _0x1511cb;})[_0x9830('0x2c')](respondWithFilteredResult(_0x4b097c,_0x341f61))[_0x9830('0x3b')](handleError(_0x4b097c,null));};exports['show']=function(_0x551e5f,_0x15afae){var _0x4f9f95={'raw':![],'where':{'id':_0x551e5f[_0x9830('0xc7')]['id']}},_0x23d26c={};_0x23d26c[_0x9830('0x48')]=_[_0x9830('0x43')](db['MailInteraction'][_0x9830('0x3e')]);_0x23d26c[_0x9830('0x42')]=_[_0x9830('0x43')](_0x551e5f['query']);_0x23d26c[_0x9830('0x44')]=_['intersection'](_0x23d26c[_0x9830('0x48')],_0x23d26c[_0x9830('0x42')]);_0x4f9f95[_0x9830('0x45')]=_[_0x9830('0xc8')](_0x23d26c['model'],qs['fields'](_0x551e5f['query'][_0x9830('0x46')]));_0x4f9f95[_0x9830('0x45')]=_0x4f9f95['attributes'][_0x9830('0x47')]?_0x4f9f95['attributes']:_0x23d26c[_0x9830('0x48')];if(_0x551e5f['query'][_0x9830('0xc9')]){_0x4f9f95[_0x9830('0xca')]=[{'all':!![]}];}_0x4f9f95=_[_0x9830('0xa1')]({},_0x4f9f95,_0x551e5f[_0x9830('0xcb')]);return db[_0x9830('0x3d')][_0x9830('0x65')](_0x4f9f95)[_0x9830('0x2c')](handleEntityNotFound(_0x15afae,null))['then'](respondWithResult(_0x15afae,null))[_0x9830('0x3b')](handleError(_0x15afae,null));};exports[_0x9830('0xcc')]=function(_0x47bc8d,_0x14d90a){return db['MailInteraction'][_0x9830('0xcc')](_0x47bc8d['body'],{})[_0x9830('0x2c')](respondWithResult(_0x14d90a,0xc9))['catch'](handleError(_0x14d90a,null));};exports['update']=function(_0x10ef7c,_0x31dd38){if(_0x10ef7c[_0x9830('0xcd')]['id']){delete _0x10ef7c[_0x9830('0xcd')]['id'];}return db[_0x9830('0x3d')][_0x9830('0x65')]({'where':{'id':_0x10ef7c[_0x9830('0xc7')]['id']}})['then'](handleEntityNotFound(_0x31dd38,null))[_0x9830('0x2c')](saveUpdates(_0x10ef7c[_0x9830('0xcd')],null))[_0x9830('0x2c')](respondWithResult(_0x31dd38,null))[_0x9830('0x3b')](handleError(_0x31dd38,null));};exports[_0x9830('0x2b')]=function(_0x260a71,_0x127ee2){return db[_0x9830('0x3d')][_0x9830('0x65')]({'where':{'id':_0x260a71[_0x9830('0xc7')]['id']}})['then'](handleEntityNotFound(_0x127ee2,null))[_0x9830('0x2c')](removeEntity(_0x127ee2,null))[_0x9830('0x3b')](handleError(_0x127ee2,null));};exports[_0x9830('0xce')]=function(_0x41dd82,_0x275480){return db['MailInteraction'][_0x9830('0xce')]()[_0x9830('0x2c')](respondWithResult(_0x275480,null))[_0x9830('0x3b')](handleError(_0x275480,null));};exports[_0x9830('0xcf')]=function(_0x381c07,_0x51ecee,_0x687213){return db['MailMessage'][_0x9830('0x65')]({'where':{'id':_0x381c07[_0x9830('0xc7')]['id']}})[_0x9830('0x2c')](handleEntityNotFound(_0x51ecee,null))['then'](function(_0xf9ccb1){if(_0xf9ccb1){return _0xf9ccb1[_0x9830('0xcf')](_0x381c07['body'][_0x9830('0xd0')],_[_0x9830('0xd1')](_0x381c07[_0x9830('0xcd')],[_0x9830('0xd0'),'id'])||{});}})[_0x9830('0x2c')](respondWithResult(_0x51ecee,null))[_0x9830('0x3b')](handleError(_0x51ecee,null));};exports[_0x9830('0xd2')]=function(_0x7ff15a,_0x47dd8f,_0xa16e84){var _0x18f0e2={'raw':![],'where':{}};var _0x5db69d={};var _0x538647={'count':0x0,'rows':[]};return db[_0x9830('0x3d')]['findOne']({'where':{'id':_0x7ff15a[_0x9830('0xc7')]['id']}})[_0x9830('0x2c')](handleEntityNotFound(_0x47dd8f,null))['then'](function(_0x4cfeb9){if(_0x4cfeb9){_0x5db69d[_0x9830('0x48')]=_[_0x9830('0x43')](db[_0x9830('0xd3')][_0x9830('0x3e')]);_0x5db69d[_0x9830('0x42')]=_[_0x9830('0x43')](_0x7ff15a['query']);_0x5db69d[_0x9830('0x44')]=_[_0x9830('0xc8')](_0x5db69d[_0x9830('0x48')],_0x5db69d['query']);_0x18f0e2[_0x9830('0x45')]=_[_0x9830('0xc8')](_0x5db69d[_0x9830('0x48')],qs['fields'](_0x7ff15a[_0x9830('0x42')][_0x9830('0x46')]));_0x18f0e2[_0x9830('0x45')]=_0x18f0e2['attributes'][_0x9830('0x47')]?_0x18f0e2[_0x9830('0x45')]:_0x5db69d[_0x9830('0x48')];if(!_0x7ff15a[_0x9830('0x42')][_0x9830('0x49')](_0x9830('0x4a'))){_0x18f0e2[_0x9830('0x23')]=qs[_0x9830('0x23')](_0x7ff15a[_0x9830('0x42')]['limit']);_0x18f0e2[_0x9830('0x21')]=qs['offset'](_0x7ff15a[_0x9830('0x42')]['offset']);}_0x18f0e2[_0x9830('0x4b')]=qs[_0x9830('0x4c')](_0x7ff15a['query'][_0x9830('0x4c')]);_0x18f0e2['where']=qs['filters'](_['pick'](_0x7ff15a[_0x9830('0x42')],_0x5db69d['filters']));_0x18f0e2[_0x9830('0x4d')][_0x9830('0xc1')]=_0x4cfeb9['id'];if(_0x7ff15a[_0x9830('0x42')][_0x9830('0x86')]){_0x18f0e2[_0x9830('0x4d')]=_[_0x9830('0xa1')](_0x18f0e2['where'],{'$or':_[_0x9830('0x30')](_0x18f0e2[_0x9830('0x45')],function(_0x19060d){var _0x7773b3={};_0x7773b3[_0x19060d]={'$like':'%'+_0x7ff15a[_0x9830('0x42')][_0x9830('0x86')]+'%'};return _0x7773b3;})});}if(_0x7ff15a[_0x9830('0x42')][_0x9830('0x7d')]){var _0x24efdb=_0x7ff15a[_0x9830('0x42')][_0x9830('0x7d')][_0x9830('0x33')](',');var _0x5a6605={};_0x5a6605[_0x24efdb[0x0]]={'$gte':moment(_0x24efdb[0x1])[_0x9830('0xd4')](_0x9830('0xd5'))};_0x18f0e2[_0x9830('0x4d')]=_[_0x9830('0xa1')](_0x18f0e2['where'],_0x5a6605);}_0x18f0e2=_[_0x9830('0xa1')]({},_0x18f0e2,_0x7ff15a['options']);return db['MailMessage'][_0x9830('0x24')]({'where':_0x18f0e2[_0x9830('0x4d')]})[_0x9830('0x2c')](function(_0x4f0308){_0x538647[_0x9830('0x24')]=_0x4f0308;if(_0x7ff15a[_0x9830('0x42')][_0x9830('0xc9')]){_0x18f0e2[_0x9830('0xca')]=[{'all':!![]}];}return db[_0x9830('0xd3')][_0x9830('0xd6')](_0x18f0e2);})['then'](function(_0x4f5940){if(_0x7ff15a[_0x9830('0x42')][_0x9830('0xd7')]===_0x9830('0xd8')){for(var _0x36978c=0x0;_0x36978c<_0x4f5940[_0x9830('0x47')];_0x36978c++){_0x4f5940[_0x36978c][_0x9830('0xcd')]=juice(_0x4f5940[_0x36978c]['body']);}}_0x538647['rows']=_0x4f5940;return _0x538647;});}})[_0x9830('0x2c')](respondWithFilteredResult(_0x47dd8f,_0x18f0e2))[_0x9830('0x3b')](handleError(_0x47dd8f,null));};exports[_0x9830('0xd9')]=function(_0x103387,_0x3f48a8,_0x35dcef){return db[_0x9830('0x3d')][_0x9830('0x65')]({'where':{'id':_0x103387[_0x9830('0xc7')]['id']}})[_0x9830('0x2c')](handleEntityNotFound(_0x3f48a8,null))[_0x9830('0x2c')](function(_0x4cbb12){if(_0x4cbb12){return _0x4cbb12[_0x9830('0xda')](_0x103387[_0x9830('0xcd')][_0x9830('0xd0')],_[_0x9830('0xd1')](_0x103387[_0x9830('0xcd')],[_0x9830('0xd0'),'id'])||{})[_0x9830('0xdb')](function(){return db[_0x9830('0x70')]['findAll']({'attributes':['id',_0x9830('0x2e'),_0x9830('0x51')],'where':{'id':_0x103387[_0x9830('0xcd')][_0x9830('0xd0')]}});})[_0x9830('0x2c')](function(_0xc9c3c2){socket[_0x9830('0xdc')]('mailInteractionTags:save',{'id':Number(_0x103387[_0x9830('0xc7')]['id']),'tags':_0xc9c3c2||[]});return{'id':Number(_0x103387[_0x9830('0xc7')]['id']),'tags':_0xc9c3c2||[]};});}})[_0x9830('0x2c')](respondWithResult(_0x3f48a8,null))[_0x9830('0x3b')](handleError(_0x3f48a8,null));};exports[_0x9830('0xdd')]=function(_0x1a2c26,_0x5b4509,_0x5eeed5){return db['MailInteraction']['find']({'where':{'id':_0x1a2c26[_0x9830('0xc7')]['id']}})[_0x9830('0x2c')](handleEntityNotFound(_0x5b4509,null))['then'](function(_0x14860a){if(_0x14860a){return _0x14860a[_0x9830('0xdd')](_0x1a2c26['query'][_0x9830('0xd0')]);}})[_0x9830('0x2c')](respondWithStatusCode(_0x5b4509,null))['catch'](handleError(_0x5b4509,null));};exports['download']=function(_0x1dcdd2,_0x394ef8){var _0x359a85=moment()[_0x9830('0xde')]()[_0x9830('0x9f')]();var _0x3f91e1=path[_0x9830('0xdf')](config[_0x9830('0xe0')],_0x9830('0xe1'),_0x9830('0xe2'),'tmp');var _0x3eb0ba=path[_0x9830('0xdf')](config[_0x9830('0xe0')],_0x9830('0xe1'),'files',_0x9830('0xe3'));var _0x5b328e=path[_0x9830('0xdf')](_0x3f91e1,_0x359a85);var _0x202057=util[_0x9830('0xd4')](_0x9830('0xe4'),_0x1dcdd2[_0x9830('0xc7')]['id'],_0x359a85);var _0x2b3c85=path[_0x9830('0xdf')](_0x3f91e1,_0x202057);var _0x84ef75=[];if(_0x1dcdd2[_0x9830('0x42')][_0x9830('0xe3')]){_0x84ef75[_0x9830('0xc4')]({'model':db[_0x9830('0xe5')],'as':_0x9830('0xe6'),'raw':!![]});}var _0x5f06dd=[{'model':db[_0x9830('0xd3')],'as':_0x9830('0xe7'),'attributes':['id','body',_0x9830('0x52'),'to','cc',_0x9830('0xe8'),_0x9830('0xe9'),'createdAt'],'where':{'secret':![]},'order':qs[_0x9830('0x4c')]('id'),'include':_0x84ef75}];return db[_0x9830('0x3d')]['find']({'where':{'id':_0x1dcdd2[_0x9830('0xc7')]['id']},'include':_0x5f06dd})[_0x9830('0x2c')](handleEntityNotFound(_0x394ef8,null))[_0x9830('0x2c')](function(_0x4e573a){if(_0x4e573a&&_0x4e573a[_0x9830('0xe7')]){var _0x11135a=_0x4e573a['get']({'plain':!![]});fs[_0x9830('0xea')](_0x5b328e);return BPromise[_0x9830('0xeb')](_0x11135a['Messages'],function(_0x53fcc3,_0x3886db){var _0x378fad={'from':_0x53fcc3['from'],'to':_0x53fcc3['to'],'subject':_0x53fcc3[_0x9830('0xe9')],'html':_0x53fcc3[_0x9830('0xcd')],'headers':{'Date':moment(_0x53fcc3[_0x9830('0x7b')])['format'](_0x9830('0xec'))},'attachments':[]};if(_0x53fcc3['cc']){_0x378fad[_0x9830('0xed')]['Cc']=_0x53fcc3['cc'];}if(_0x53fcc3['bcc']){_0x378fad[_0x9830('0xed')][_0x9830('0xee')]=_0x53fcc3[_0x9830('0xe8')];}return new BPromise(function(_0xbba47f,_0x23b557){if(_0x53fcc3[_0x9830('0xe6')]){for(var _0x5a22f5=0x0;_0x5a22f5<_0x53fcc3[_0x9830('0xe6')][_0x9830('0x47')];_0x5a22f5++){var _0x4bcfd0=_0x53fcc3[_0x9830('0xe6')][_0x5a22f5];var _0x3cc1e2=path[_0x9830('0xdf')](_0x3eb0ba,_0x4bcfd0[_0x9830('0xef')]);if(fs[_0x9830('0xf0')](_0x3cc1e2)){_0x378fad[_0x9830('0xe3')][_0x9830('0xc4')]({'name':_0x4bcfd0[_0x9830('0x2e')],'contentType':_0x4bcfd0[_0x9830('0x40')],'data':fs[_0x9830('0xf1')](_0x3cc1e2)});}}}emlformat[_0x9830('0xf2')](_0x378fad,function(_0x1c4c86,_0x37bbc7){if(_0x1c4c86)return _0x23b557(_0x1c4c86);fs[_0x9830('0xf3')](path[_0x9830('0xdf')](_0x5b328e,util['format'](_0x9830('0xf4'),_0x3886db)),_0x37bbc7);return _0xbba47f(_0x37bbc7);});});})[_0x9830('0x2c')](function(){return new BPromise(function(_0x1370c7,_0x2a80e5){zipdir(_0x5b328e,{'saveTo':_0x2b3c85},function(_0x257fdb,_0x850e9b){if(_0x257fdb)return _0x2a80e5(_0x257fdb);return _0x1370c7(_0x850e9b);});})[_0x9830('0x2c')](function(){return new BPromise(function(_0x300d82,_0x27ed24){rimraf(_0x5b328e,function(_0x2db2af){if(_0x2db2af)_0x27ed24(_0x2db2af);return _0x300d82();});});})['then'](function(){return _0x394ef8[_0x9830('0xf5')](_0x2b3c85,_0x202057,function(_0x4f4f6c){if(_0x4f4f6c){console[_0x9830('0xf6')](_0x9830('0xf7'),_0x4f4f6c);}else{fs[_0x9830('0xf8')](_0x2b3c85);}});});});}else{return _0x394ef8[_0x9830('0x1f')](0xc8);}})[_0x9830('0x3b')](handleError(_0x394ef8,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 7c61b9f..26f4d3d 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 _0xaf40=['exports','events','../../mysqldb','MailInteraction','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook'];(function(_0x11f285,_0x9af32b){var _0x2269d7=function(_0x7d846a){while(--_0x7d846a){_0x11f285['push'](_0x11f285['shift']());}};_0x2269d7(++_0x9af32b);}(_0xaf40,0xfd));var _0x0af4=function(_0x4a9f9f,_0xf8f6cb){_0x4a9f9f=_0x4a9f9f-0x0;var _0x1e2bb5=_0xaf40[_0x4a9f9f];return _0x1e2bb5;};'use strict';var EventEmitter=require(_0x0af4('0x0'));var MailInteraction=require(_0x0af4('0x1'))['db'][_0x0af4('0x2')];var MailMessage=require(_0x0af4('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x0af4('0x3')](0x0);var events={'afterCreate':_0x0af4('0x4'),'afterUpdate':_0x0af4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2eb96f){return function(_0x2d5d02,_0x573e73,_0x5cdeaa){_0x2d5d02[_0x0af4('0x6')]({'attributes':['id'],'raw':!![]})[_0x0af4('0x7')](function(_0x441f61){_0x2d5d02[_0x0af4('0x8')](_0x0af4('0x9'),_0x441f61[_0x0af4('0xa')](function(_0x307fca){return{'id':_0x307fca['id']};}));return MailMessage[_0x0af4('0xb')]({'where':{'MailInteractionId':_0x2d5d02['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0af4('0x7')](function(_0x2f8e26){_0x2d5d02['setDataValue'](_0x0af4('0xc'),_0x2f8e26[_0x0af4('0xd')]);MailInteractionEvents[_0x0af4('0xe')](_0x2eb96f+':'+_0x2d5d02['id'],_0x2d5d02);MailInteractionEvents[_0x0af4('0xe')](_0x2eb96f,_0x2d5d02);_0x5cdeaa(null);})[_0x0af4('0xf')](_0x5cdeaa(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x0af4('0x10')](e,emitEvent(event));}}module[_0x0af4('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0xd22b=['exports','events','MailInteraction','../../mysqldb','setMaxListeners','save','remove','getUsers','map','findAll','then','length','emit','catch','hasOwnProperty','hook'];(function(_0x1b4a0a,_0x41a6a9){var _0x3b76f0=function(_0x575b7c){while(--_0x575b7c){_0x1b4a0a['push'](_0x1b4a0a['shift']());}};_0x3b76f0(++_0x41a6a9);}(_0xd22b,0xa1));var _0xbd22=function(_0x5eff9b,_0x5b4d26){_0x5eff9b=_0x5eff9b-0x0;var _0x3504db=_0xd22b[_0x5eff9b];return _0x3504db;};'use strict';var EventEmitter=require(_0xbd22('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xbd22('0x1')];var MailMessage=require(_0xbd22('0x2'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xbd22('0x3')](0x0);var events={'afterCreate':_0xbd22('0x4'),'afterUpdate':'update','afterDestroy':_0xbd22('0x5')};function emitEvent(_0x13f6c9){return function(_0x4c0444,_0xfb23a7,_0x1ac79a){_0x4c0444[_0xbd22('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x58f797){_0x4c0444['setDataValue']('Users',_0x58f797[_0xbd22('0x7')](function(_0x472edc){return{'id':_0x472edc['id']};}));return MailMessage[_0xbd22('0x8')]({'where':{'MailInteractionId':_0x4c0444['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbd22('0x9')](function(_0x2eb78d){_0x4c0444['setDataValue']('unreadMessages',_0x2eb78d[_0xbd22('0xa')]);MailInteractionEvents[_0xbd22('0xb')](_0x13f6c9+':'+_0x4c0444['id'],_0x4c0444);MailInteractionEvents[_0xbd22('0xb')](_0x13f6c9,_0x4c0444);_0x1ac79a(null);})[_0xbd22('0xc')](_0x1ac79a(null));};}for(var e in events){if(events[_0xbd22('0xd')](e)){var event=events[e];MailInteraction[_0xbd22('0xe')](e,emitEvent(event));}}module[_0xbd22('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 29251bb..74205ed 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 _0xe0fd=['changed','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatus','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','substatusAt'];(function(_0xd494de,_0x255edd){var _0x1c2e59=function(_0x54dc74){while(--_0x54dc74){_0xd494de['push'](_0xd494de['shift']());}};_0x1c2e59(++_0x255edd);}(_0xe0fd,0x1bb));var _0xde0f=function(_0x50ccf6,_0x5651d8){_0x50ccf6=_0x50ccf6-0x0;var _0x4bb085=_0xe0fd[_0x50ccf6];return _0x4bb085;};'use strict';var _=require(_0xde0f('0x0'));var util=require(_0xde0f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xde0f('0x2'));var BPromise=require(_0xde0f('0x3'));var rp=require(_0xde0f('0x4'));var fs=require('fs');var path=require(_0xde0f('0x5'));var rimraf=require(_0xde0f('0x6'));var config=require(_0xde0f('0x7'));var attributes=require(_0xde0f('0x8'));module[_0xde0f('0x9')]=function(_0x336ed0,_0x1f45b9){return _0x336ed0[_0xde0f('0xa')](_0xde0f('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xde0f('0xc'),'fields':[_0xde0f('0xd'),'to'],'type':_0xde0f('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x491e7e,_0x360531,_0x1d1ace){if(_0x491e7e[_0xde0f('0xf')]){_0x491e7e['substatusAt']=moment()['format'](_0xde0f('0x10'));}if(_0x491e7e[_0xde0f('0x11')]){_0x491e7e[_0xde0f('0x12')]=moment()[_0xde0f('0x13')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1d1ace(null,_0x360531);},'beforeUpdate':function(_0x95a2ee,_0x3f9d95,_0x3a4039){if(_0x95a2ee['changed'](_0xde0f('0xf'))){_0x95a2ee[_0xde0f('0x14')]=_0x95a2ee[_0xde0f('0xf')]?moment()['format'](_0xde0f('0x10')):null;}if(_0x95a2ee[_0xde0f('0x15')](_0xde0f('0x11'))){_0x95a2ee[_0xde0f('0x12')]=moment()[_0xde0f('0x13')](_0xde0f('0x10'));_0x95a2ee[_0xde0f('0xf')]=null;_0x95a2ee[_0xde0f('0x14')]=null;}_0x3a4039(null,_0x95a2ee);},'afterUpdate':function(_0x14c252,_0x2a70ae,_0x5de7b2){var _0x2d2c71=_0x336ed0['models'];var _0xe31c89=_0x14c252[_0xde0f('0x16')]({'plain':!![]});if(_0xe31c89['closed']){return _0x2d2c71[_0xde0f('0x17')][_0xde0f('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0xe31c89['id']}})[_0xde0f('0x19')](function(){_0x5de7b2();})[_0xde0f('0x1a')](function(_0xba0f35){_0x5de7b2(_0xba0f35);});}else{_0x5de7b2();}}},'charset':_0xde0f('0x1b'),'collate':_0xde0f('0x1c')});}; \ No newline at end of file +var _0xa6f0=['substatusAt','changed','closed','closedAt','models','get','MailMessage','then','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0xa6f0,0xea));var _0x0a6f=function(_0x13d545,_0x48861e){_0x13d545=_0x13d545-0x0;var _0x411cf3=_0xa6f0[_0x13d545];return _0x411cf3;};'use strict';var _=require(_0x0a6f('0x0'));var util=require(_0x0a6f('0x1'));var logger=require(_0x0a6f('0x2'))(_0x0a6f('0x3'));var moment=require(_0x0a6f('0x4'));var BPromise=require(_0x0a6f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a6f('0x6'));var rimraf=require(_0x0a6f('0x7'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x707695,_0x40598f){return _0x707695[_0x0a6f('0x8')]('MailInteraction',attributes,{'tableName':_0x0a6f('0x9'),'paranoid':![],'indexes':[{'name':_0x0a6f('0xa'),'fields':[_0x0a6f('0xb'),'to'],'type':_0x0a6f('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x592903,_0x434512,_0x505376){if(_0x592903[_0x0a6f('0xd')]){_0x592903['substatusAt']=moment()[_0x0a6f('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x592903['closed']){_0x592903['closedAt']=moment()[_0x0a6f('0xe')](_0x0a6f('0xf'));}_0x505376(null,_0x434512);},'beforeUpdate':function(_0x40ea9f,_0xee9bdb,_0x47d3ec){if(_0x40ea9f['changed'](_0x0a6f('0xd'))){_0x40ea9f[_0x0a6f('0x10')]=_0x40ea9f['substatus']?moment()['format'](_0x0a6f('0xf')):null;}if(_0x40ea9f[_0x0a6f('0x11')](_0x0a6f('0x12'))){_0x40ea9f[_0x0a6f('0x13')]=moment()[_0x0a6f('0xe')](_0x0a6f('0xf'));_0x40ea9f['substatus']=null;_0x40ea9f[_0x0a6f('0x10')]=null;}_0x47d3ec(null,_0x40ea9f);},'afterUpdate':function(_0x91e149,_0x31e350,_0x4c6e8a){var _0x2edefd=_0x707695[_0x0a6f('0x14')];var _0x581fee=_0x91e149[_0x0a6f('0x15')]({'plain':!![]});if(_0x581fee[_0x0a6f('0x12')]){return _0x2edefd[_0x0a6f('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x581fee['id']}})[_0x0a6f('0x17')](function(){_0x4c6e8a();})['catch'](function(_0xa59e05){_0x4c6e8a(_0xa59e05);});}else{_0x4c6e8a();}}},'charset':'utf8mb4','collate':_0x0a6f('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 5fc063f..4569fc9 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 _0x4b6c=['options','where','attributes','limit','AddTagsToMailInteraction','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','./mailInteraction.socket','register','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','update','body'];(function(_0x3ff6ac,_0x3ebbe4){var _0x24c2bb=function(_0x17c165){while(--_0x17c165){_0x3ff6ac['push'](_0x3ff6ac['shift']());}};_0x24c2bb(++_0x3ebbe4);}(_0x4b6c,0x14a));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc4b6('0x0'));var util=require(_0xc4b6('0x1'));var moment=require('moment');var BPromise=require(_0xc4b6('0x2'));var rs=require(_0xc4b6('0x3'));var fs=require('fs');var Redis=require(_0xc4b6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc4b6('0x5'));var logger=require(_0xc4b6('0x6'))(_0xc4b6('0x7'));var config=require('../../config/environment');var jayson=require(_0xc4b6('0x8'));var client=jayson[_0xc4b6('0x9')][_0xc4b6('0xa')]({'port':0x232a});config[_0xc4b6('0xb')]=_['defaults'](config[_0xc4b6('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc4b6('0xb')]));require(_0xc4b6('0xc'))[_0xc4b6('0xd')](socket);function respondWithRpcPromise(_0x2f0cc9,_0x8088db,_0x423d81){return new BPromise(function(_0x48faf0,_0x426553){return client[_0xc4b6('0xe')](_0x2f0cc9,_0x423d81)['then'](function(_0x3db899){logger[_0xc4b6('0xf')](_0xc4b6('0x10'),_0x8088db,_0xc4b6('0x11'));logger[_0xc4b6('0x12')](_0xc4b6('0x13'),_0x8088db,_0xc4b6('0x11'),JSON[_0xc4b6('0x14')](_0x3db899));if(_0x3db899[_0xc4b6('0x15')]){if(_0x3db899['error'][_0xc4b6('0x16')]===0x1f4){logger[_0xc4b6('0x15')]('MailInteraction,\x20%s,\x20%s',_0x8088db,_0x3db899[_0xc4b6('0x15')]['message']);return _0x426553(_0x3db899[_0xc4b6('0x15')][_0xc4b6('0x17')]);}logger[_0xc4b6('0x15')](_0xc4b6('0x10'),_0x8088db,_0x3db899['error']['message']);return _0x48faf0(_0x3db899[_0xc4b6('0x15')][_0xc4b6('0x17')]);}else{logger[_0xc4b6('0xf')](_0xc4b6('0x10'),_0x8088db,_0xc4b6('0x11'));_0x48faf0(_0x3db899[_0xc4b6('0x18')][_0xc4b6('0x17')]);}})[_0xc4b6('0x19')](function(_0x3342b9){logger[_0xc4b6('0x15')](_0xc4b6('0x10'),_0x8088db,_0x3342b9);_0x426553(_0x3342b9);});});}exports[_0xc4b6('0x1a')]=function(_0x55b557){var _0x353a12=this;return new Promise(function(_0x142c22,_0x44618b){return db[_0xc4b6('0x1b')][_0xc4b6('0x1c')](_0x55b557[_0xc4b6('0x1d')],{'raw':_0x55b557[_0xc4b6('0x1e')]?_0x55b557[_0xc4b6('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55b557[_0xc4b6('0x1e')]?_0x55b557[_0xc4b6('0x1e')][_0xc4b6('0x1f')]||null:null,'attributes':_0x55b557[_0xc4b6('0x1e')]?_0x55b557[_0xc4b6('0x1e')][_0xc4b6('0x20')]||null:null,'limit':_0x55b557[_0xc4b6('0x1e')]?_0x55b557[_0xc4b6('0x1e')][_0xc4b6('0x21')]||null:null})['then'](function(_0x5a6eff){logger['info'](_0xc4b6('0x1a'),_0x55b557);logger[_0xc4b6('0x12')]('UpdateMailInteraction',_0x55b557,JSON[_0xc4b6('0x14')](_0x5a6eff));_0x142c22(_0x5a6eff);})[_0xc4b6('0x19')](function(_0x50b946){logger[_0xc4b6('0x15')](_0xc4b6('0x1a'),_0x50b946[_0xc4b6('0x17')],_0x55b557);_0x44618b(_0x353a12[_0xc4b6('0x15')](0x1f4,_0x50b946[_0xc4b6('0x17')]));});});};exports[_0xc4b6('0x22')]=function(_0x1a1432){return new Promise(function(_0x391f5b,_0x31a9de){return db[_0xc4b6('0x1b')]['find']({'where':_0x1a1432[_0xc4b6('0x1e')]?_0x1a1432[_0xc4b6('0x1e')][_0xc4b6('0x1f')]||null:null})['then'](function(_0x5a7994){if(_0x5a7994){return _0x5a7994[_0xc4b6('0x23')](_0x1a1432['body'][_0xc4b6('0x24')],_[_0xc4b6('0x25')](_0x1a1432[_0xc4b6('0x1d')],['ids','id'])||{});}})[_0xc4b6('0x26')](function(_0x146532){logger['info'](_0xc4b6('0x27'),_0x1a1432);logger[_0xc4b6('0x12')](_0xc4b6('0x27'),_0x1a1432,JSON['stringify'](_0x146532));_0x391f5b(_0x146532);})['catch'](function(_0x2323ab){logger[_0xc4b6('0x15')]('AddTags',_0x2323ab[_0xc4b6('0x17')],_0x1a1432);_0x31a9de(_this['error'](0x1f4,_0x2323ab[_0xc4b6('0x17')]));});});}; \ No newline at end of file +var _0xfc65=['./mailInteraction.socket','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','MailInteraction','update','body','options','raw','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','where','then','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xfc65,0x1b4));var _0x5fc6=function(_0x45351a,_0x4e610f){_0x45351a=_0x45351a-0x0;var _0x46e2fd=_0xfc65[_0x45351a];return _0x46e2fd;};'use strict';var _=require(_0x5fc6('0x0'));var util=require(_0x5fc6('0x1'));var moment=require(_0x5fc6('0x2'));var BPromise=require(_0x5fc6('0x3'));var rs=require(_0x5fc6('0x4'));var fs=require('fs');var Redis=require(_0x5fc6('0x5'));var db=require(_0x5fc6('0x6'))['db'];var utils=require(_0x5fc6('0x7'));var logger=require(_0x5fc6('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5fc6('0x9'));var client=jayson[_0x5fc6('0xa')][_0x5fc6('0xb')]({'port':0x232a});config[_0x5fc6('0xc')]=_[_0x5fc6('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5fc6('0xe'))(new Redis(config[_0x5fc6('0xc')]));require(_0x5fc6('0xf'))['register'](socket);function respondWithRpcPromise(_0x3c0c98,_0x4e5f13,_0x49a9c8){return new BPromise(function(_0x6daec,_0x3a0a5c){return client['request'](_0x3c0c98,_0x49a9c8)['then'](function(_0x3caadc){logger[_0x5fc6('0x10')](_0x5fc6('0x11'),_0x4e5f13,'request\x20sent');logger[_0x5fc6('0x12')](_0x5fc6('0x13'),_0x4e5f13,_0x5fc6('0x14'),JSON[_0x5fc6('0x15')](_0x3caadc));if(_0x3caadc[_0x5fc6('0x16')]){if(_0x3caadc[_0x5fc6('0x16')]['code']===0x1f4){logger[_0x5fc6('0x16')]('MailInteraction,\x20%s,\x20%s',_0x4e5f13,_0x3caadc[_0x5fc6('0x16')][_0x5fc6('0x17')]);return _0x3a0a5c(_0x3caadc[_0x5fc6('0x16')][_0x5fc6('0x17')]);}logger['error'](_0x5fc6('0x11'),_0x4e5f13,_0x3caadc['error'][_0x5fc6('0x17')]);return _0x6daec(_0x3caadc['error']['message']);}else{logger[_0x5fc6('0x10')](_0x5fc6('0x11'),_0x4e5f13,_0x5fc6('0x14'));_0x6daec(_0x3caadc[_0x5fc6('0x18')][_0x5fc6('0x17')]);}})[_0x5fc6('0x19')](function(_0x47c75b){logger[_0x5fc6('0x16')](_0x5fc6('0x11'),_0x4e5f13,_0x47c75b);_0x3a0a5c(_0x47c75b);});});}exports['UpdateMailInteraction']=function(_0x54855c){var _0x18fe24=this;return new Promise(function(_0x1d39eb,_0x4b3b35){return db[_0x5fc6('0x1a')][_0x5fc6('0x1b')](_0x54855c[_0x5fc6('0x1c')],{'raw':_0x54855c[_0x5fc6('0x1d')]?_0x54855c[_0x5fc6('0x1d')][_0x5fc6('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54855c['options']?_0x54855c['options']['where']||null:null,'attributes':_0x54855c[_0x5fc6('0x1d')]?_0x54855c['options']['attributes']||null:null,'limit':_0x54855c[_0x5fc6('0x1d')]?_0x54855c[_0x5fc6('0x1d')][_0x5fc6('0x1f')]||null:null})['then'](function(_0x5a7c5e){logger[_0x5fc6('0x10')](_0x5fc6('0x20'),_0x54855c);logger[_0x5fc6('0x12')](_0x5fc6('0x20'),_0x54855c,JSON[_0x5fc6('0x15')](_0x5a7c5e));_0x1d39eb(_0x5a7c5e);})[_0x5fc6('0x19')](function(_0x283eff){logger[_0x5fc6('0x16')](_0x5fc6('0x20'),_0x283eff['message'],_0x54855c);_0x4b3b35(_0x18fe24[_0x5fc6('0x16')](0x1f4,_0x283eff['message']));});});};exports[_0x5fc6('0x21')]=function(_0x440e07){return new Promise(function(_0x2d3aeb,_0xec58dc){return db[_0x5fc6('0x1a')][_0x5fc6('0x22')]({'where':_0x440e07[_0x5fc6('0x1d')]?_0x440e07[_0x5fc6('0x1d')][_0x5fc6('0x23')]||null:null})[_0x5fc6('0x24')](function(_0x4a8fc0){if(_0x4a8fc0){return _0x4a8fc0['addTags'](_0x440e07[_0x5fc6('0x1c')][_0x5fc6('0x25')],_[_0x5fc6('0x26')](_0x440e07[_0x5fc6('0x1c')],['ids','id'])||{});}})[_0x5fc6('0x27')](function(_0x4764a4){logger[_0x5fc6('0x10')]('AddTags',_0x440e07);logger[_0x5fc6('0x12')]('AddTags',_0x440e07,JSON[_0x5fc6('0x15')](_0x4764a4));_0x2d3aeb(_0x4764a4);})[_0x5fc6('0x19')](function(_0x15bb78){logger[_0x5fc6('0x16')](_0x5fc6('0x28'),_0x15bb78[_0x5fc6('0x17')],_0x440e07);_0xec58dc(_this['error'](0x1f4,_0x15bb78[_0x5fc6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index ab8e5c3..b1248d0 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 _0x063c=['save','remove','update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x4e6b3c,_0x2ad9db){var _0x344aaf=function(_0x419b2){while(--_0x419b2){_0x4e6b3c['push'](_0x4e6b3c['shift']());}};_0x344aaf(++_0x2ad9db);}(_0x063c,0x1c1));var _0xc063=function(_0x58fc53,_0x5324d4){_0x58fc53=_0x58fc53-0x0;var _0x5a0fd2=_0x063c[_0x58fc53];return _0x5a0fd2;};'use strict';var MailInteractionEvents=require(_0xc063('0x0'));var events=[_0xc063('0x1'),_0xc063('0x2'),_0xc063('0x3')];function createListener(_0x593cb7,_0x929d34){return function(_0x1ae363){_0x929d34[_0xc063('0x4')](_0x593cb7,_0x1ae363);};}function removeListener(_0x29e0c2,_0x137b34){return function(){MailInteractionEvents[_0xc063('0x5')](_0x29e0c2,_0x137b34);};}exports[_0xc063('0x6')]=function(_0x384ac5){for(var _0x152758=0x0,_0x222af3=events[_0xc063('0x7')];_0x152758<_0x222af3;_0x152758++){var _0x48d96a=events[_0x152758];var _0x55f065=createListener(_0xc063('0x8')+_0x48d96a,_0x384ac5);MailInteractionEvents['on'](_0x48d96a,_0x55f065);}}; \ No newline at end of file +var _0x921e=['./mailInteraction.events','remove','update','removeListener'];(function(_0x210fc6,_0x2e27eb){var _0x27cf7a=function(_0x5d8dd0){while(--_0x5d8dd0){_0x210fc6['push'](_0x210fc6['shift']());}};_0x27cf7a(++_0x2e27eb);}(_0x921e,0x13c));var _0xe921=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x921e[_0x3dd15e];return _0x231fd0;};'use strict';var MailInteractionEvents=require(_0xe921('0x0'));var events=['save',_0xe921('0x1'),_0xe921('0x2')];function createListener(_0x4abfe8,_0x2e0ad7){return function(_0x57c0e7){_0x2e0ad7['emit'](_0x4abfe8,_0x57c0e7);};}function removeListener(_0x19f35d,_0x2d3cff){return function(){MailInteractionEvents[_0xe921('0x3')](_0x19f35d,_0x2d3cff);};}exports['register']=function(_0x3a7380){for(var _0x3e6af5=0x0,_0x1aa063=events['length'];_0x3e6af5<_0x1aa063;_0x3e6af5++){var _0x2ed181=events[_0x3e6af5];var _0x4e129b=createListener('mailInteraction:'+_0x2ed181,_0x3a7380);MailInteractionEvents['on'](_0x2ed181,_0x4e129b);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index e515ed2..080f8c0 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 _0xdada=['get','isAuthenticated','index','describe','/:id','show','mailmessage:create','put','update','/:id/reject','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./mailMessage.controller'];(function(_0xf8bc50,_0x32f35a){var _0x40db4b=function(_0x485327){while(--_0x485327){_0xf8bc50['push'](_0xf8bc50['shift']());}};_0x40db4b(++_0x32f35a);}(_0xdada,0x1cd));var _0xadad=function(_0x446a1f,_0x289563){_0x446a1f=_0x446a1f-0x0;var _0x2361ba=_0xdada[_0x446a1f];return _0x2361ba;};'use strict';var multer=require(_0xadad('0x0'));var util=require('util');var path=require(_0xadad('0x1'));var timeout=require(_0xadad('0x2'));var express=require('express');var router=express[_0xadad('0x3')]();var fs_extra=require(_0xadad('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xadad('0x5'));var config=require('../../config/environment');var controller=require(_0xadad('0x6'));router[_0xadad('0x7')]('/',auth[_0xadad('0x8')](),controller[_0xadad('0x9')]);router[_0xadad('0x7')]('/describe',auth[_0xadad('0x8')](),controller[_0xadad('0xa')]);router['get'](_0xadad('0xb'),auth['isAuthenticated'](),controller[_0xadad('0xc')]);router['get']('/:id/download',auth[_0xadad('0x8')](),controller['download']);router['post']('/',auth[_0xadad('0x8')](),interaction['tracked']('mail',_0xadad('0xd')),controller['create']);router[_0xadad('0xe')](_0xadad('0xb'),auth['isAuthenticated'](),controller[_0xadad('0xf')]);router['put']('/:id/accept',auth[_0xadad('0x8')](),controller['accept']);router['put'](_0xadad('0x10'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0xadad('0xb'),auth[_0xadad('0x8')](),controller[_0xadad('0x11')]);module['exports']=router; \ No newline at end of file +var _0x695c=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','describe','/:id','isAuthenticated','show','download','post','tracked','mail','create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','path'];(function(_0x30fe8c,_0x272cb9){var _0x4f1068=function(_0x5f52c7){while(--_0x5f52c7){_0x30fe8c['push'](_0x30fe8c['shift']());}};_0x4f1068(++_0x272cb9);}(_0x695c,0x7c));var _0xc695=function(_0x12b83d,_0x4bcec7){_0x12b83d=_0x12b83d-0x0;var _0x1fd39d=_0x695c[_0x12b83d];return _0x1fd39d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc695('0x0'));var timeout=require(_0xc695('0x1'));var express=require(_0xc695('0x2'));var router=express['Router']();var fs_extra=require(_0xc695('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc695('0x4'));var config=require(_0xc695('0x5'));var controller=require(_0xc695('0x6'));router[_0xc695('0x7')]('/',auth['isAuthenticated'](),controller[_0xc695('0x8')]);router[_0xc695('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xc695('0x9')]);router[_0xc695('0x7')](_0xc695('0xa'),auth[_0xc695('0xb')](),controller[_0xc695('0xc')]);router[_0xc695('0x7')]('/:id/download',auth[_0xc695('0xb')](),controller[_0xc695('0xd')]);router[_0xc695('0xe')]('/',auth[_0xc695('0xb')](),interaction[_0xc695('0xf')](_0xc695('0x10'),'mailmessage:create'),controller[_0xc695('0x11')]);router[_0xc695('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xc695('0x12')](_0xc695('0x13'),auth['isAuthenticated'](),controller[_0xc695('0x14')]);router['put'](_0xc695('0x15'),auth[_0xc695('0xb')](),controller[_0xc695('0x16')]);router[_0xc695('0x17')](_0xc695('0xa'),auth[_0xc695('0xb')](),controller[_0xc695('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 550d8f7..12f471e 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 _0x1d86=['ENUM','out','STRING','DATE','INTEGER','Email','Chat','sequelize','lodash','exports','long','TEXT','BOOLEAN'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x1d86,0x166));var _0x61d8=function(_0x58b669,_0x104077){_0x58b669=_0x58b669-0x0;var _0x329698=_0x1d86[_0x58b669];return _0x329698;};'use strict';var Sequelize=require(_0x61d8('0x0'));var _=require(_0x61d8('0x1'));module[_0x61d8('0x2')]={'body':{'type':Sequelize['TEXT'](_0x61d8('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x61d8('0x4')]('medium')},'read':{'type':Sequelize[_0x61d8('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x61d8('0x6')]('in',_0x61d8('0x7')),'defaultValue':_0x61d8('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x61d8('0x8')](0x1fe)},'from':{'type':Sequelize[_0x61d8('0x8')]},'to':{'type':Sequelize['TEXT'](_0x61d8('0x3'))},'cc':{'type':Sequelize[_0x61d8('0x4')]('long')},'bcc':{'type':Sequelize[_0x61d8('0x4')]('long')},'subject':{'type':Sequelize[_0x61d8('0x4')]},'sentAt':{'type':Sequelize[_0x61d8('0x9')]},'attach':{'type':Sequelize[_0x61d8('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x61d8('0x9')]},'originTo':{'type':Sequelize[_0x61d8('0x4')](_0x61d8('0x3'))},'originCc':{'type':Sequelize['TEXT'](_0x61d8('0x3'))},'originChannel':{'type':Sequelize[_0x61d8('0x6')](_0x61d8('0xb'),_0x61d8('0xc')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0xfae4=['Email','Chat','lodash','exports','long','TEXT','medium','ENUM','out','STRING','INTEGER','BOOLEAN','DATE'];(function(_0x3bc0bc,_0x567fba){var _0x13fb7f=function(_0x302a40){while(--_0x302a40){_0x3bc0bc['push'](_0x3bc0bc['shift']());}};_0x13fb7f(++_0x567fba);}(_0xfae4,0xab));var _0x4fae=function(_0x2f5261,_0x5e44b7){_0x2f5261=_0x2f5261-0x0;var _0x5388a0=_0xfae4[_0x2f5261];return _0x5388a0;};'use strict';var Sequelize=require('sequelize');var _=require(_0x4fae('0x0'));module[_0x4fae('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4fae('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x4fae('0x3')](_0x4fae('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4fae('0x5')]('in',_0x4fae('0x6')),'defaultValue':_0x4fae('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4fae('0x7')](0x1fe)},'from':{'type':Sequelize[_0x4fae('0x7')]},'to':{'type':Sequelize[_0x4fae('0x3')]('long')},'cc':{'type':Sequelize[_0x4fae('0x3')](_0x4fae('0x2'))},'bcc':{'type':Sequelize[_0x4fae('0x3')](_0x4fae('0x2'))},'subject':{'type':Sequelize[_0x4fae('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x4fae('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x4fae('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x4fae('0xa')]},'originTo':{'type':Sequelize['TEXT'](_0x4fae('0x2'))},'originCc':{'type':Sequelize[_0x4fae('0x3')](_0x4fae('0x2'))},'originChannel':{'type':Sequelize[_0x4fae('0x5')](_0x4fae('0xb'),_0x4fae('0xc')),'defaultValue':_0x4fae('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index dc7290e..1b2ed1d 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 _0x803c=['intersection','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','show','params','includeAll','options','find','update','body','describe','create','direction','out','MailAccount','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','port','secure','auth','pass','service','user','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','readAt','UserId','agent','Contact','get','MailInteraction','MailInteractionId','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','startsWith','cf_','push','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','manual','channel','event','EventManager','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','QueryTypes','interface','download','unix','toString','server','files','message-%s.eml','from','bcc','createdAt','Attachment','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','readFileSync','build','log','err','unlinkSync','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','./mailMessage.socket','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','then','name','send','index','map','MailMessage','rawAttributes','fieldName','model','query','keys','filters','attributes'];(function(_0x2825af,_0x184d70){var _0x5ccc79=function(_0x5b099f){while(--_0x5b099f){_0x2825af['push'](_0x2825af['shift']());}};_0x5ccc79(++_0x184d70);}(_0x803c,0x6e));var _0xc803=function(_0x5e7b40,_0x1577ca){_0x5e7b40=_0x5e7b40-0x0;var _0x106fe8=_0x803c[_0x5e7b40];return _0x106fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc803('0x0'));var jsonpatch=require(_0xc803('0x1'));var rp=require('request-promise');var moment=require(_0xc803('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc803('0x3'));var util=require('util');var path=require(_0xc803('0x4'));var sox=require(_0xc803('0x5'));var csv=require(_0xc803('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc803('0x7'));var crypto=require(_0xc803('0x8'));var jsforce=require(_0xc803('0x9'));var deskjs=require(_0xc803('0xa'));var toCsv=require(_0xc803('0x6'));var querystring=require('querystring');var Papa=require(_0xc803('0xb'));var Redis=require(_0xc803('0xc'));var authService=require(_0xc803('0xd'));var qs=require(_0xc803('0xe'));var as=require(_0xc803('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc803('0x10'))(_0xc803('0x11'));var utils=require(_0xc803('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc803('0x13'));var db=require(_0xc803('0x14'))['db'];config['redis']=_[_0xc803('0x15')](config[_0xc803('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc803('0x16')]));require(_0xc803('0x17'))[_0xc803('0x18')](socket);var jayson=require(_0xc803('0x19'));var client=jayson[_0xc803('0x1a')][_0xc803('0x1b')]({'port':0x232c});var client9003=jayson[_0xc803('0x1a')][_0xc803('0x1b')]({'port':0x232b});var client9002=jayson[_0xc803('0x1a')][_0xc803('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1ad8ee,_0x2e6602,_0x55beb8,_0x4f7e76){return new BPromise(function(_0x343ca6,_0x281af0){var _0x5c8dee=_0x4f7e76||client;return _0x5c8dee[_0xc803('0x1c')](_0x1ad8ee,_0x55beb8)['then'](function(_0x429f8f){logger[_0xc803('0x1d')](_0xc803('0x1e'),_0x2e6602,_0xc803('0x1f'));logger[_0xc803('0x20')](_0xc803('0x21'),_0x2e6602,'request\x20sent',JSON[_0xc803('0x22')](_0x429f8f));if(_0x429f8f[_0xc803('0x23')]){if(_0x429f8f[_0xc803('0x23')]['code']===0x1f4){logger[_0xc803('0x23')]('MailMessage,\x20%s,\x20%s',_0x2e6602,_0x429f8f['error']['message']);return _0x281af0(_0x429f8f[_0xc803('0x23')][_0xc803('0x24')]);}logger[_0xc803('0x23')](_0xc803('0x1e'),_0x2e6602,_0x429f8f[_0xc803('0x23')][_0xc803('0x24')]);return _0x343ca6(_0x429f8f[_0xc803('0x23')][_0xc803('0x24')]);}else{logger[_0xc803('0x1d')](_0xc803('0x1e'),_0x2e6602,_0xc803('0x1f'));_0x343ca6(_0x429f8f[_0xc803('0x25')][_0xc803('0x24')]);}})[_0xc803('0x26')](function(_0xb02515){logger[_0xc803('0x23')](_0xc803('0x1e'),_0x2e6602,_0xb02515);_0x281af0(_0xb02515);});});}function respondWithStatusCode(_0x12e429,_0x14ad03){_0x14ad03=_0x14ad03||0xcc;return function(_0x74c19a){if(_0x74c19a){return _0x12e429[_0xc803('0x27')](_0x14ad03);}return _0x12e429['status'](_0x14ad03)[_0xc803('0x28')]();};}function respondWithResult(_0x134c58,_0xf3b42d){_0xf3b42d=_0xf3b42d||0xc8;return function(_0x359e67){if(_0x359e67){return _0x134c58[_0xc803('0x29')](_0xf3b42d)[_0xc803('0x2a')](_0x359e67);}};}function respondWithFilteredResult(_0xeb89c0,_0x52dbea){return function(_0x1f58e9){if(_0x1f58e9){var _0x39baae=typeof _0x52dbea['offset']===_0xc803('0x2b')&&typeof _0x52dbea[_0xc803('0x2c')]===_0xc803('0x2b');var _0x478ae1=_0x1f58e9[_0xc803('0x2d')];var _0x5275fb=_0x39baae?0x0:_0x52dbea['offset'];var _0x1459ad=_0x39baae?_0x1f58e9['count']:_0x52dbea['offset']+_0x52dbea[_0xc803('0x2c')];var _0x125afa;if(_0x1459ad>=_0x478ae1){_0x1459ad=_0x478ae1;_0x125afa=0xc8;}else{_0x125afa=0xce;}_0xeb89c0[_0xc803('0x29')](_0x125afa);return _0xeb89c0[_0xc803('0x2e')](_0xc803('0x2f'),_0x5275fb+'-'+_0x1459ad+'/'+_0x478ae1)[_0xc803('0x2a')](_0x1f58e9);}return null;};}function patchUpdates(_0x2fa82d){return function(_0x4d5aeb){try{jsonpatch[_0xc803('0x30')](_0x4d5aeb,_0x2fa82d,!![]);}catch(_0x2a1693){return BPromise['reject'](_0x2a1693);}return _0x4d5aeb['save']();};}function saveUpdates(_0x5e3812,_0x466010){return function(_0x5727c5){if(_0x5727c5){return _0x5727c5['update'](_0x5e3812)['then'](function(_0x53a9f1){return _0x53a9f1;});}return null;};}function removeEntity(_0x189125,_0x1e1193){return function(_0x4f5aa9){if(_0x4f5aa9){return _0x4f5aa9['destroy']()[_0xc803('0x31')](function(){_0x189125['status'](0xcc)[_0xc803('0x28')]();});}};}function handleEntityNotFound(_0x28c7f5,_0xbd3d52){return function(_0x4163da){if(!_0x4163da){_0x28c7f5[_0xc803('0x27')](0x194);}return _0x4163da;};}function handleError(_0x918dea,_0x218a44){_0x218a44=_0x218a44||0x1f4;return function(_0x489122){logger[_0xc803('0x23')](_0x489122['stack']);if(_0x489122[_0xc803('0x32')]){delete _0x489122[_0xc803('0x32')];}_0x918dea['status'](_0x218a44)[_0xc803('0x33')](_0x489122);};}exports[_0xc803('0x34')]=function(_0x54d60f,_0x39881f){var _0xd2ffac={},_0x5acb27={},_0x5a0b9c={'count':0x0,'rows':[]};var _0x44a5a2=_[_0xc803('0x35')](db[_0xc803('0x36')][_0xc803('0x37')],function(_0x3de1b1){return{'name':_0x3de1b1[_0xc803('0x38')],'type':_0x3de1b1['type']['key']};});_0x5acb27[_0xc803('0x39')]=_[_0xc803('0x35')](_0x44a5a2,_0xc803('0x32'));_0x5acb27[_0xc803('0x3a')]=_[_0xc803('0x3b')](_0x54d60f[_0xc803('0x3a')]);_0x5acb27[_0xc803('0x3c')]=_['intersection'](_0x5acb27[_0xc803('0x39')],_0x5acb27[_0xc803('0x3a')]);_0xd2ffac[_0xc803('0x3d')]=_[_0xc803('0x3e')](_0x5acb27['model'],qs[_0xc803('0x3f')](_0x54d60f[_0xc803('0x3a')][_0xc803('0x3f')]));_0xd2ffac[_0xc803('0x3d')]=_0xd2ffac[_0xc803('0x3d')][_0xc803('0x40')]?_0xd2ffac[_0xc803('0x3d')]:_0x5acb27[_0xc803('0x39')];if(!_0x54d60f[_0xc803('0x3a')][_0xc803('0x41')]('nolimit')){_0xd2ffac[_0xc803('0x2c')]=qs[_0xc803('0x2c')](_0x54d60f[_0xc803('0x3a')][_0xc803('0x2c')]);_0xd2ffac[_0xc803('0x42')]=qs[_0xc803('0x42')](_0x54d60f[_0xc803('0x3a')][_0xc803('0x42')]);}_0xd2ffac[_0xc803('0x43')]=qs[_0xc803('0x44')](_0x54d60f[_0xc803('0x3a')][_0xc803('0x44')]);_0xd2ffac[_0xc803('0x45')]=qs['filters'](_[_0xc803('0x46')](_0x54d60f['query'],_0x5acb27[_0xc803('0x3c')]),_0x44a5a2);if(_0x54d60f[_0xc803('0x3a')][_0xc803('0x47')]){_0xd2ffac[_0xc803('0x45')]=_[_0xc803('0x48')](_0xd2ffac[_0xc803('0x45')],{'$or':_[_0xc803('0x35')](_0x44a5a2,function(_0xe7cd68){if(_0xe7cd68[_0xc803('0x49')]!==_0xc803('0x4a')){var _0x4c6346={};_0x4c6346[_0xe7cd68[_0xc803('0x32')]]={'$like':'%'+_0x54d60f['query'][_0xc803('0x47')]+'%'};return _0x4c6346;}})});}_0xd2ffac=_[_0xc803('0x48')]({},_0xd2ffac,_0x54d60f['options']);var _0x52cd2f={'where':_0xd2ffac['where']};return db['MailMessage'][_0xc803('0x2d')](_0x52cd2f)[_0xc803('0x31')](function(_0x22e008){_0x5a0b9c[_0xc803('0x2d')]=_0x22e008;if(_0x54d60f['query']['includeAll']){_0xd2ffac[_0xc803('0x4b')]=[{'all':!![]}];}return db[_0xc803('0x36')][_0xc803('0x4c')](_0xd2ffac);})[_0xc803('0x31')](function(_0x1d53b6){_0x5a0b9c[_0xc803('0x4d')]=_0x1d53b6;return _0x5a0b9c;})[_0xc803('0x31')](respondWithFilteredResult(_0x39881f,_0xd2ffac))[_0xc803('0x26')](handleError(_0x39881f,null));};exports[_0xc803('0x4e')]=function(_0x3c1b3d,_0x30bfb5){var _0x2f51a8={'raw':!![],'where':{'id':_0x3c1b3d[_0xc803('0x4f')]['id']}},_0x1f5b77={};_0x1f5b77['model']=_[_0xc803('0x3b')](db[_0xc803('0x36')]['rawAttributes']);_0x1f5b77[_0xc803('0x3a')]=_[_0xc803('0x3b')](_0x3c1b3d[_0xc803('0x3a')]);_0x1f5b77['filters']=_[_0xc803('0x3e')](_0x1f5b77[_0xc803('0x39')],_0x1f5b77[_0xc803('0x3a')]);_0x2f51a8[_0xc803('0x3d')]=_[_0xc803('0x3e')](_0x1f5b77[_0xc803('0x39')],qs[_0xc803('0x3f')](_0x3c1b3d[_0xc803('0x3a')]['fields']));_0x2f51a8[_0xc803('0x3d')]=_0x2f51a8['attributes'][_0xc803('0x40')]?_0x2f51a8[_0xc803('0x3d')]:_0x1f5b77[_0xc803('0x39')];if(_0x3c1b3d[_0xc803('0x3a')][_0xc803('0x50')]){_0x2f51a8[_0xc803('0x4b')]=[{'all':!![]}];}_0x2f51a8=_[_0xc803('0x48')]({},_0x2f51a8,_0x3c1b3d[_0xc803('0x51')]);return db[_0xc803('0x36')][_0xc803('0x52')](_0x2f51a8)[_0xc803('0x31')](handleEntityNotFound(_0x30bfb5,null))[_0xc803('0x31')](respondWithResult(_0x30bfb5,null))[_0xc803('0x26')](handleError(_0x30bfb5,null));};exports[_0xc803('0x53')]=function(_0x404e75,_0x54a7bf){if(_0x404e75[_0xc803('0x54')]['id']){delete _0x404e75[_0xc803('0x54')]['id'];}return db[_0xc803('0x36')][_0xc803('0x52')]({'where':{'id':_0x404e75[_0xc803('0x4f')]['id']}})[_0xc803('0x31')](handleEntityNotFound(_0x54a7bf,null))['then'](saveUpdates(_0x404e75['body'],null))[_0xc803('0x31')](respondWithResult(_0x54a7bf,null))[_0xc803('0x26')](handleError(_0x54a7bf,null));};exports['destroy']=function(_0x5baaf8,_0x16cedd){return db[_0xc803('0x36')][_0xc803('0x52')]({'where':{'id':_0x5baaf8['params']['id']}})['then'](handleEntityNotFound(_0x16cedd,null))[_0xc803('0x31')](removeEntity(_0x16cedd,null))['catch'](handleError(_0x16cedd,null));};exports[_0xc803('0x55')]=function(_0xc45d31,_0x511bf6){return db['MailMessage'][_0xc803('0x55')]()[_0xc803('0x31')](respondWithResult(_0x511bf6,null))[_0xc803('0x26')](handleError(_0x511bf6,null));};exports[_0xc803('0x56')]=function(_0x1c3e77,_0x53e8ca){return db[_0xc803('0x36')][_0xc803('0x56')](_0x1c3e77[_0xc803('0x54')])[_0xc803('0x31')](function(_0x1b1c66){if(_0x1b1c66){if(_0x1b1c66[_0xc803('0x57')]===_0xc803('0x58')&&!_0x1b1c66['secret']){var _0x36f270,_0x4bdf3d,_0x4cf83c;if(_0x1c3e77[_0xc803('0x54')]['to']){_0x4bdf3d=_0x1c3e77[_0xc803('0x54')]['to']['split'](',')[0x0];}return db[_0xc803('0x59')]['findOne']({'where':{'id':_0x1b1c66[_0xc803('0x5a')]},'include':[{'model':db[_0xc803('0x5b')],'as':_0xc803('0x5c'),'include':[{'model':db[_0xc803('0x5d')],'as':_0xc803('0x5e'),'where':{'email':_0x4bdf3d},'limit':0x1,'order':[[_0xc803('0x5f'),_0xc803('0x60')]]}]},{'model':db[_0xc803('0x61')],'as':_0xc803('0x62'),'raw':!![]}]})['then'](function(_0x2df370){_0x36f270=_0x2df370;if(_0x36f270&&_0x36f270['Smtp']){var _0x240400={'tls':{'rejectUnauthorized':![]}};if(_[_0xc803('0x63')](_0x36f270[_0xc803('0x62')]['service'])){_0x240400['host']=_0x36f270[_0xc803('0x62')]['host'];_0x240400[_0xc803('0x64')]=_0x36f270['Smtp'][_0xc803('0x64')];_0x240400[_0xc803('0x65')]=_0x36f270[_0xc803('0x62')][_0xc803('0x65')];if(_0x36f270['Smtp']['authentication']){_0x240400[_0xc803('0x66')]={'user':_0x36f270['Smtp']['user'],'pass':_0x36f270[_0xc803('0x62')][_0xc803('0x67')]};}}else{_0x240400[_0xc803('0x68')]=_0x36f270[_0xc803('0x62')][_0xc803('0x68')];_0x240400['auth']={'user':_0x36f270[_0xc803('0x62')][_0xc803('0x69')],'pass':_0x36f270['Smtp'][_0xc803('0x67')]};_0x240400['secure']=_0x36f270[_0xc803('0x62')]['secure'];}if(_0x1c3e77[_0xc803('0x54')][_0xc803('0x6a')]&&_0x1c3e77[_0xc803('0x54')][_0xc803('0x6a')][_0xc803('0x40')]){for(var _0x25f057=0x0;_0x25f057<_0x1c3e77[_0xc803('0x54')]['attachments'][_0xc803('0x40')];_0x25f057+=0x1){_0x1c3e77['body']['attachments'][_0x25f057]={'filename':_0x1c3e77[_0xc803('0x54')][_0xc803('0x6a')][_0x25f057][_0xc803('0x32')],'path':path[_0xc803('0x6b')](config[_0xc803('0x6c')],_0xc803('0x6d'),_0x1c3e77['body'][_0xc803('0x6a')][_0x25f057][_0xc803('0x6e')])};}}_0x4cf83c={'account':_0x240400,'message':_0x1c3e77[_0xc803('0x54')]};return;}})['then'](function(){if(_0x36f270[_0xc803('0x5c')]){if(_0x36f270['List'][_0xc803('0x5e')]['length']){return _0x36f270[_0xc803('0x5c')][_0xc803('0x5e')][0x0];}else{return db[_0xc803('0x5d')][_0xc803('0x56')](_[_0xc803('0x15')](_0x1c3e77[_0xc803('0x54')],{'firstName':_0x1c3e77[_0xc803('0x54')]['to'],'email':_0x1c3e77[_0xc803('0x54')]['to'],'phone':_0x1c3e77['body']['to'],'ListId':_0x36f270[_0xc803('0x6f')]}));}}else{throw new Error(_0xc803('0x70'));}})[_0xc803('0x31')](function(){if(_0x4cf83c){return respondWithRpcPromise(_0xc803('0x71'),_0xc803('0x72'),_0x4cf83c,client9003)[_0xc803('0x31')](function(_0x4b29a9){return _0x1b1c66[_0xc803('0x53')]({'read':!![],'messageId':_0x4b29a9[_0xc803('0x73')],'sentAt':moment()[_0xc803('0x74')](_0xc803('0x75'))});})['catch'](function(_0x14b882){logger[_0xc803('0x23')]('%s',JSON[_0xc803('0x22')](_0x14b882));return _0x1b1c66;});}return _0x1b1c66;});}return _0x1b1c66;}})[_0xc803('0x31')](respondWithResult(_0x53e8ca,0xc9))[_0xc803('0x26')](handleError(_0x53e8ca,null));};var interaction_log=require('../../config/logger')(_0xc803('0x76'));exports[_0xc803('0x77')]=function(_0x4c2b0a,_0x43055f,_0x4419ae){var _0x563dc5={'agent':{},'channel':_0xc803('0x78')};if(_0x4c2b0a['body']['id']){delete _0x4c2b0a[_0xc803('0x54')]['id'];}_0x4c2b0a[_0xc803('0x54')][_0xc803('0x79')]=!![];_0x4c2b0a[_0xc803('0x54')][_0xc803('0x7a')]=moment()[_0xc803('0x74')](_0xc803('0x75'));_0x4c2b0a[_0xc803('0x54')][_0xc803('0x7b')]=_0x4c2b0a[_0xc803('0x54')]['UserId']||_0x4c2b0a[_0xc803('0x69')]['id'];_0x563dc5[_0xc803('0x7c')]['id']=_0x4c2b0a[_0xc803('0x54')][_0xc803('0x7b')];return db[_0xc803('0x36')][_0xc803('0x52')]({'where':{'id':_0x4c2b0a['params']['id'],'UserId':null},'include':[{'model':db[_0xc803('0x5d')],'as':_0xc803('0x7d')}]})[_0xc803('0x31')](handleEntityNotFound(_0x43055f,null))[_0xc803('0x31')](saveUpdates(_0x4c2b0a[_0xc803('0x54')],null))[_0xc803('0x31')](function(_0x292f2d){if(_0x292f2d){_0x563dc5[_0xc803('0x24')]=_0x292f2d[_0xc803('0x7e')]({'plain':!![]});return db[_0xc803('0x7f')]['find']({'where':{'id':_0x292f2d[_0xc803('0x80')]}});}return null;})[_0xc803('0x31')](handleEntityNotFound(_0x43055f,null))[_0xc803('0x31')](function(_0x159fa2){if(_0x159fa2){return _0x159fa2[_0xc803('0x53')]({'UserId':_0x4c2b0a['body'][_0xc803('0x7b')],'read1stAt':_[_0xc803('0x63')](_0x159fa2['read1stAt'])?moment()[_0xc803('0x74')](_0xc803('0x75')):undefined});}return null;})[_0xc803('0x31')](function(_0xc8ca56){if(_0xc8ca56){_0x563dc5[_0xc803('0x81')]=_0xc8ca56['get']({'plain':!![]});interaction_log[_0xc803('0x1d')](_0xc803('0x82'),_0x4c2b0a['user']['id'],_0x4c2b0a[_0xc803('0x69')]['name'],_0x4c2b0a[_0xc803('0x69')]['role'],_0x563dc5[_0xc803('0x81')]['id'],_0x4c2b0a[_0xc803('0x54')]?JSON[_0xc803('0x22')](_0x4c2b0a[_0xc803('0x54')]):'null');return respondWithRpcPromise(_0xc803('0x83'),_0xc803('0x84'),_0x563dc5);}return null;})[_0xc803('0x31')](function(_0x9d5691){return db['CmContact']['describe']()[_0xc803('0x31')](function(_0x126389){var _0x5c3914=[];for(var _0x260ba4=0x0;_0x260ba4=_0x313cb4){_0x3f4e43=_0x313cb4;_0x1b9778=0xc8;}else{_0x1b9778=0xce;}_0xe2a263[_0xb08d('0x2c')](_0x1b9778);return _0xe2a263['set'](_0xb08d('0x33'),_0x14beb2+'-'+_0x3f4e43+'/'+_0x313cb4)[_0xb08d('0x2e')](_0x277332);}return null;};}function patchUpdates(_0xb93c){return function(_0x31155a){try{jsonpatch[_0xb08d('0x34')](_0x31155a,_0xb93c,!![]);}catch(_0x110071){return BPromise['reject'](_0x110071);}return _0x31155a[_0xb08d('0x35')]();};}function saveUpdates(_0x1629ef,_0xbdb3cf){return function(_0x3d72f3){if(_0x3d72f3){return _0x3d72f3[_0xb08d('0x36')](_0x1629ef)['then'](function(_0x34c93d){return _0x34c93d;});}return null;};}function removeEntity(_0x254556,_0x361a95){return function(_0x4dd87d){if(_0x4dd87d){return _0x4dd87d[_0xb08d('0x37')]()['then'](function(){_0x254556[_0xb08d('0x2c')](0xcc)[_0xb08d('0x2d')]();});}};}function handleEntityNotFound(_0x36dccf,_0x370dec){return function(_0x11d55e){if(!_0x11d55e){_0x36dccf[_0xb08d('0x2b')](0x194);}return _0x11d55e;};}function handleError(_0x212895,_0x3a59ac){_0x3a59ac=_0x3a59ac||0x1f4;return function(_0x16f86a){logger[_0xb08d('0x26')](_0x16f86a['stack']);if(_0x16f86a[_0xb08d('0x38')]){delete _0x16f86a['name'];}_0x212895[_0xb08d('0x2c')](_0x3a59ac)[_0xb08d('0x39')](_0x16f86a);};}exports[_0xb08d('0x3a')]=function(_0x534d44,_0x14bf24){var _0x2aff00={},_0x40d140={},_0x537eb4={'count':0x0,'rows':[]};var _0x240e60=_[_0xb08d('0x3b')](db[_0xb08d('0x3c')]['rawAttributes'],function(_0x482309){return{'name':_0x482309['fieldName'],'type':_0x482309[_0xb08d('0x3d')][_0xb08d('0x3e')]};});_0x40d140[_0xb08d('0x3f')]=_['map'](_0x240e60,_0xb08d('0x38'));_0x40d140[_0xb08d('0x40')]=_[_0xb08d('0x41')](_0x534d44[_0xb08d('0x40')]);_0x40d140[_0xb08d('0x42')]=_['intersection'](_0x40d140[_0xb08d('0x3f')],_0x40d140[_0xb08d('0x40')]);_0x2aff00[_0xb08d('0x43')]=_[_0xb08d('0x44')](_0x40d140[_0xb08d('0x3f')],qs[_0xb08d('0x45')](_0x534d44['query'][_0xb08d('0x45')]));_0x2aff00['attributes']=_0x2aff00[_0xb08d('0x43')][_0xb08d('0x46')]?_0x2aff00['attributes']:_0x40d140['model'];if(!_0x534d44[_0xb08d('0x40')][_0xb08d('0x47')](_0xb08d('0x48'))){_0x2aff00['limit']=qs[_0xb08d('0x30')](_0x534d44[_0xb08d('0x40')]['limit']);_0x2aff00[_0xb08d('0x2f')]=qs['offset'](_0x534d44[_0xb08d('0x40')][_0xb08d('0x2f')]);}_0x2aff00[_0xb08d('0x49')]=qs['sort'](_0x534d44[_0xb08d('0x40')][_0xb08d('0x4a')]);_0x2aff00[_0xb08d('0x4b')]=qs[_0xb08d('0x42')](_['pick'](_0x534d44['query'],_0x40d140[_0xb08d('0x42')]),_0x240e60);if(_0x534d44[_0xb08d('0x40')][_0xb08d('0x4c')]){_0x2aff00['where']=_[_0xb08d('0x4d')](_0x2aff00[_0xb08d('0x4b')],{'$or':_[_0xb08d('0x3b')](_0x240e60,function(_0x45bd20){if(_0x45bd20[_0xb08d('0x3d')]!==_0xb08d('0x4e')){var _0xb4fc51={};_0xb4fc51[_0x45bd20[_0xb08d('0x38')]]={'$like':'%'+_0x534d44['query'][_0xb08d('0x4c')]+'%'};return _0xb4fc51;}})});}_0x2aff00=_[_0xb08d('0x4d')]({},_0x2aff00,_0x534d44[_0xb08d('0x4f')]);var _0x2e2439={'where':_0x2aff00['where']};return db['MailMessage'][_0xb08d('0x32')](_0x2e2439)[_0xb08d('0x20')](function(_0x587278){_0x537eb4[_0xb08d('0x32')]=_0x587278;if(_0x534d44[_0xb08d('0x40')][_0xb08d('0x50')]){_0x2aff00[_0xb08d('0x51')]=[{'all':!![]}];}return db[_0xb08d('0x3c')][_0xb08d('0x52')](_0x2aff00);})['then'](function(_0x3f2e0d){_0x537eb4[_0xb08d('0x53')]=_0x3f2e0d;return _0x537eb4;})[_0xb08d('0x20')](respondWithFilteredResult(_0x14bf24,_0x2aff00))[_0xb08d('0x54')](handleError(_0x14bf24,null));};exports[_0xb08d('0x55')]=function(_0x207c5c,_0x404767){var _0x2269ab={'raw':!![],'where':{'id':_0x207c5c['params']['id']}},_0x1d41ea={};_0x1d41ea[_0xb08d('0x3f')]=_[_0xb08d('0x41')](db['MailMessage'][_0xb08d('0x56')]);_0x1d41ea[_0xb08d('0x40')]=_[_0xb08d('0x41')](_0x207c5c[_0xb08d('0x40')]);_0x1d41ea[_0xb08d('0x42')]=_[_0xb08d('0x44')](_0x1d41ea['model'],_0x1d41ea[_0xb08d('0x40')]);_0x2269ab[_0xb08d('0x43')]=_[_0xb08d('0x44')](_0x1d41ea[_0xb08d('0x3f')],qs[_0xb08d('0x45')](_0x207c5c[_0xb08d('0x40')][_0xb08d('0x45')]));_0x2269ab[_0xb08d('0x43')]=_0x2269ab[_0xb08d('0x43')][_0xb08d('0x46')]?_0x2269ab[_0xb08d('0x43')]:_0x1d41ea[_0xb08d('0x3f')];if(_0x207c5c['query'][_0xb08d('0x50')]){_0x2269ab['include']=[{'all':!![]}];}_0x2269ab=_[_0xb08d('0x4d')]({},_0x2269ab,_0x207c5c[_0xb08d('0x4f')]);return db[_0xb08d('0x3c')][_0xb08d('0x57')](_0x2269ab)['then'](handleEntityNotFound(_0x404767,null))[_0xb08d('0x20')](respondWithResult(_0x404767,null))[_0xb08d('0x54')](handleError(_0x404767,null));};exports[_0xb08d('0x36')]=function(_0x3d06ef,_0x5a3455){if(_0x3d06ef[_0xb08d('0x58')]['id']){delete _0x3d06ef[_0xb08d('0x58')]['id'];}return db[_0xb08d('0x3c')][_0xb08d('0x57')]({'where':{'id':_0x3d06ef[_0xb08d('0x59')]['id']}})[_0xb08d('0x20')](handleEntityNotFound(_0x5a3455,null))[_0xb08d('0x20')](saveUpdates(_0x3d06ef['body'],null))['then'](respondWithResult(_0x5a3455,null))[_0xb08d('0x54')](handleError(_0x5a3455,null));};exports['destroy']=function(_0x5738b5,_0x35ef93){return db[_0xb08d('0x3c')][_0xb08d('0x57')]({'where':{'id':_0x5738b5['params']['id']}})[_0xb08d('0x20')](handleEntityNotFound(_0x35ef93,null))[_0xb08d('0x20')](removeEntity(_0x35ef93,null))[_0xb08d('0x54')](handleError(_0x35ef93,null));};exports[_0xb08d('0x5a')]=function(_0x10e2de,_0x2da06c){return db[_0xb08d('0x3c')]['describe']()[_0xb08d('0x20')](respondWithResult(_0x2da06c,null))['catch'](handleError(_0x2da06c,null));};exports[_0xb08d('0x5b')]=function(_0xf9680b,_0x3863c7){return db[_0xb08d('0x3c')]['create'](_0xf9680b[_0xb08d('0x58')])[_0xb08d('0x20')](function(_0x339621){if(_0x339621){if(_0x339621[_0xb08d('0x5c')]===_0xb08d('0x5d')&&!_0x339621[_0xb08d('0x5e')]){var _0x63cf0e,_0x5e0ac1,_0x301612;if(_0xf9680b[_0xb08d('0x58')]['to']){_0x5e0ac1=_0xf9680b[_0xb08d('0x58')]['to'][_0xb08d('0x5f')](',')[0x0];}return db[_0xb08d('0x60')][_0xb08d('0x61')]({'where':{'id':_0x339621[_0xb08d('0x62')]},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xb08d('0x63')],'as':_0xb08d('0x64'),'where':{'email':_0x5e0ac1},'limit':0x1,'order':[[_0xb08d('0x65'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0xb08d('0x66'),'raw':!![]}]})['then'](function(_0x27a2da){_0x63cf0e=_0x27a2da;if(_0x63cf0e&&_0x63cf0e[_0xb08d('0x66')]){var _0x4aa261={'tls':{'rejectUnauthorized':![]}};if(_[_0xb08d('0x67')](_0x63cf0e[_0xb08d('0x66')][_0xb08d('0x68')])){_0x4aa261[_0xb08d('0x69')]=_0x63cf0e[_0xb08d('0x66')][_0xb08d('0x69')];_0x4aa261[_0xb08d('0x6a')]=_0x63cf0e[_0xb08d('0x66')][_0xb08d('0x6a')];_0x4aa261[_0xb08d('0x6b')]=_0x63cf0e[_0xb08d('0x66')][_0xb08d('0x6b')];if(_0x63cf0e[_0xb08d('0x66')]['authentication']){_0x4aa261[_0xb08d('0x6c')]={'user':_0x63cf0e['Smtp'][_0xb08d('0x6d')],'pass':_0x63cf0e[_0xb08d('0x66')]['pass']};}}else{_0x4aa261[_0xb08d('0x68')]=_0x63cf0e['Smtp'][_0xb08d('0x68')];_0x4aa261[_0xb08d('0x6c')]={'user':_0x63cf0e['Smtp'][_0xb08d('0x6d')],'pass':_0x63cf0e[_0xb08d('0x66')][_0xb08d('0x6e')]};_0x4aa261[_0xb08d('0x6b')]=_0x63cf0e['Smtp'][_0xb08d('0x6b')];}if(_0xf9680b[_0xb08d('0x58')][_0xb08d('0x6f')]&&_0xf9680b['body'][_0xb08d('0x6f')][_0xb08d('0x46')]){for(var _0x1742a3=0x0;_0x1742a3<_0xf9680b['body'][_0xb08d('0x6f')][_0xb08d('0x46')];_0x1742a3+=0x1){_0xf9680b[_0xb08d('0x58')][_0xb08d('0x6f')][_0x1742a3]={'filename':_0xf9680b[_0xb08d('0x58')][_0xb08d('0x6f')][_0x1742a3][_0xb08d('0x38')],'path':path[_0xb08d('0x70')](config[_0xb08d('0x71')],_0xb08d('0x72'),_0xf9680b['body'][_0xb08d('0x6f')][_0x1742a3][_0xb08d('0x73')])};}}_0x301612={'account':_0x4aa261,'message':_0xf9680b[_0xb08d('0x58')]};return;}})[_0xb08d('0x20')](function(){if(_0x63cf0e[_0xb08d('0x74')]){if(_0x63cf0e[_0xb08d('0x74')]['Contacts'][_0xb08d('0x46')]){return _0x63cf0e[_0xb08d('0x74')][_0xb08d('0x64')][0x0];}else{return db[_0xb08d('0x63')][_0xb08d('0x5b')](_[_0xb08d('0x18')](_0xf9680b['body'],{'firstName':_0xf9680b[_0xb08d('0x58')]['to'],'email':_0xf9680b[_0xb08d('0x58')]['to'],'phone':_0xf9680b[_0xb08d('0x58')]['to'],'ListId':_0x63cf0e['ListId']}));}}else{throw new Error(_0xb08d('0x75'));}})[_0xb08d('0x20')](function(){if(_0x301612){return respondWithRpcPromise(_0xb08d('0x76'),'sendMail',_0x301612,client9003)['then'](function(_0x34845f){return _0x339621[_0xb08d('0x36')]({'read':!![],'messageId':_0x34845f[_0xb08d('0x77')],'sentAt':moment()['format'](_0xb08d('0x78'))});})[_0xb08d('0x54')](function(_0x551628){logger[_0xb08d('0x26')]('%s',JSON[_0xb08d('0x25')](_0x551628));return _0x339621;});}return _0x339621;});}return _0x339621;}})[_0xb08d('0x20')](respondWithResult(_0x3863c7,0xc9))[_0xb08d('0x54')](handleError(_0x3863c7,null));};var interaction_log=require(_0xb08d('0x12'))(_0xb08d('0x79'));exports[_0xb08d('0x7a')]=function(_0x1c4d51,_0x437d08,_0x44865f){var _0x281228={'agent':{},'channel':_0xb08d('0x7b')};if(_0x1c4d51[_0xb08d('0x58')]['id']){delete _0x1c4d51[_0xb08d('0x58')]['id'];}_0x1c4d51[_0xb08d('0x58')][_0xb08d('0x7c')]=!![];_0x1c4d51['body'][_0xb08d('0x7d')]=moment()[_0xb08d('0x7e')](_0xb08d('0x78'));_0x1c4d51[_0xb08d('0x58')][_0xb08d('0x7f')]=_0x1c4d51[_0xb08d('0x58')][_0xb08d('0x7f')]||_0x1c4d51[_0xb08d('0x6d')]['id'];_0x281228[_0xb08d('0x80')]['id']=_0x1c4d51[_0xb08d('0x58')]['UserId'];return db['MailMessage']['find']({'where':{'id':_0x1c4d51[_0xb08d('0x59')]['id'],'UserId':null},'include':[{'model':db[_0xb08d('0x63')],'as':_0xb08d('0x81')}]})[_0xb08d('0x20')](handleEntityNotFound(_0x437d08,null))[_0xb08d('0x20')](saveUpdates(_0x1c4d51['body'],null))[_0xb08d('0x20')](function(_0x241578){if(_0x241578){_0x281228[_0xb08d('0x28')]=_0x241578[_0xb08d('0x82')]({'plain':!![]});return db['MailInteraction'][_0xb08d('0x57')]({'where':{'id':_0x241578[_0xb08d('0x83')]}});}return null;})['then'](handleEntityNotFound(_0x437d08,null))[_0xb08d('0x20')](function(_0x268fdd){if(_0x268fdd){return _0x268fdd[_0xb08d('0x36')]({'UserId':_0x1c4d51[_0xb08d('0x58')]['UserId'],'read1stAt':_['isNil'](_0x268fdd[_0xb08d('0x84')])?moment()[_0xb08d('0x7e')](_0xb08d('0x78')):undefined});}return null;})[_0xb08d('0x20')](function(_0x45df25){if(_0x45df25){_0x281228[_0xb08d('0x85')]=_0x45df25[_0xb08d('0x82')]({'plain':!![]});interaction_log[_0xb08d('0x29')](_0xb08d('0x86'),_0x1c4d51[_0xb08d('0x6d')]['id'],_0x1c4d51[_0xb08d('0x6d')][_0xb08d('0x38')],_0x1c4d51[_0xb08d('0x6d')]['role'],_0x281228[_0xb08d('0x85')]['id'],_0x1c4d51[_0xb08d('0x58')]?JSON[_0xb08d('0x25')](_0x1c4d51[_0xb08d('0x58')]):'null');return respondWithRpcPromise(_0xb08d('0x87'),_0xb08d('0x88'),_0x281228);}return null;})[_0xb08d('0x20')](function(_0x177129){return db['CmContact'][_0xb08d('0x5a')]()[_0xb08d('0x20')](function(_0x2dc8f8){var _0x2d2145=[];for(var _0x583729=0x0;_0x583729=_0x58fd2d){_0xc65bea=_0x58fd2d;_0x56d54d=0xc8;}else{_0x56d54d=0xce;}_0x5b13f7['status'](_0x56d54d);return _0x5b13f7[_0x5fd8('0x25')](_0x5fd8('0x26'),_0x58f593+'-'+_0xc65bea+'/'+_0x58fd2d)[_0x5fd8('0x20')](_0xbd1079);}return null;};}function patchUpdates(_0x87d6bb){return function(_0x1a32f9){try{jsonpatch['apply'](_0x1a32f9,_0x87d6bb,!![]);}catch(_0x56420c){return BPromise[_0x5fd8('0x27')](_0x56420c);}return _0x1a32f9[_0x5fd8('0x28')]();};}function saveUpdates(_0x1cbeed,_0x14dc4a){return function(_0x1cd076){if(_0x1cd076){return _0x1cd076[_0x5fd8('0x29')](_0x1cbeed)[_0x5fd8('0x2a')](function(_0x202f23){return _0x202f23;});}return null;};}function removeEntity(_0x1fb650,_0x5524e1){return function(_0x33beb1){if(_0x33beb1){return _0x33beb1['destroy']()['then'](function(){var _0x239a54=_0x33beb1[_0x5fd8('0x2b')]({'plain':!![]});var _0x105898=_0x5fd8('0x2c');return db['UserProfileResource'][_0x5fd8('0x2d')]({'where':{'type':_0x105898,'resourceId':_0x239a54['id']}})[_0x5fd8('0x2a')](function(){return _0x33beb1;});})[_0x5fd8('0x2a')](function(){_0x1fb650[_0x5fd8('0x1f')](0xcc)[_0x5fd8('0x2e')]();});}};}function handleEntityNotFound(_0x18ae21,_0x1fbb24){return function(_0x293454){if(!_0x293454){_0x18ae21[_0x5fd8('0x1e')](0x194);}return _0x293454;};}function handleError(_0x6b3d9f,_0x18e1e8){_0x18e1e8=_0x18e1e8||0x1f4;return function(_0x15e16e){logger[_0x5fd8('0x2f')](_0x15e16e[_0x5fd8('0x30')]);if(_0x15e16e['name']){delete _0x15e16e[_0x5fd8('0x31')];}_0x6b3d9f[_0x5fd8('0x1f')](_0x18e1e8)[_0x5fd8('0x32')](_0x15e16e);};}exports[_0x5fd8('0x33')]=function(_0x30b1c5,_0x4d7baa){var _0x34494e={},_0x32dfd7={},_0x5e445c={'count':0x0,'rows':[]};var _0x295f18=_['map'](db[_0x5fd8('0x34')]['rawAttributes'],function(_0x3ec20d){return{'name':_0x3ec20d['fieldName'],'type':_0x3ec20d[_0x5fd8('0x35')][_0x5fd8('0x36')]};});_0x32dfd7[_0x5fd8('0x37')]=_[_0x5fd8('0x38')](_0x295f18,'name');_0x32dfd7[_0x5fd8('0x39')]=_['keys'](_0x30b1c5['query']);_0x32dfd7[_0x5fd8('0x3a')]=_['intersection'](_0x32dfd7[_0x5fd8('0x37')],_0x32dfd7['query']);_0x34494e['attributes']=_['intersection'](_0x32dfd7[_0x5fd8('0x37')],qs[_0x5fd8('0x3b')](_0x30b1c5[_0x5fd8('0x39')][_0x5fd8('0x3b')]));_0x34494e[_0x5fd8('0x3c')]=_0x34494e[_0x5fd8('0x3c')][_0x5fd8('0x3d')]?_0x34494e[_0x5fd8('0x3c')]:_0x32dfd7[_0x5fd8('0x37')];if(!_0x30b1c5[_0x5fd8('0x39')][_0x5fd8('0x3e')]('nolimit')){_0x34494e['limit']=qs[_0x5fd8('0x22')](_0x30b1c5[_0x5fd8('0x39')][_0x5fd8('0x22')]);_0x34494e['offset']=qs[_0x5fd8('0x21')](_0x30b1c5[_0x5fd8('0x39')][_0x5fd8('0x21')]);}_0x34494e[_0x5fd8('0x3f')]=qs['sort'](_0x30b1c5[_0x5fd8('0x39')][_0x5fd8('0x40')]);_0x34494e[_0x5fd8('0x41')]=qs[_0x5fd8('0x3a')](_[_0x5fd8('0x42')](_0x30b1c5[_0x5fd8('0x39')],_0x32dfd7['filters']),_0x295f18);if(_0x30b1c5[_0x5fd8('0x39')][_0x5fd8('0x43')]){_0x34494e[_0x5fd8('0x41')]=_[_0x5fd8('0x44')](_0x34494e[_0x5fd8('0x41')],{'$or':_['map'](_0x295f18,function(_0x153629){if(_0x153629['type']!==_0x5fd8('0x45')){var _0x1d1f39={};_0x1d1f39[_0x153629[_0x5fd8('0x31')]]={'$like':'%'+_0x30b1c5[_0x5fd8('0x39')][_0x5fd8('0x43')]+'%'};return _0x1d1f39;}})});}_0x34494e=_[_0x5fd8('0x44')]({},_0x34494e,_0x30b1c5['options']);var _0x14efdb={'where':_0x34494e[_0x5fd8('0x41')]};return db[_0x5fd8('0x34')][_0x5fd8('0x24')](_0x14efdb)[_0x5fd8('0x2a')](function(_0x2304c8){_0x5e445c[_0x5fd8('0x24')]=_0x2304c8;if(_0x30b1c5['query'][_0x5fd8('0x46')]){_0x34494e['include']=[{'all':!![]}];}return db['MailQueue'][_0x5fd8('0x47')](_0x34494e);})[_0x5fd8('0x2a')](function(_0x36569b){_0x5e445c[_0x5fd8('0x48')]=_0x36569b;return _0x5e445c;})[_0x5fd8('0x2a')](respondWithFilteredResult(_0x4d7baa,_0x34494e))[_0x5fd8('0x49')](handleError(_0x4d7baa,null));};exports[_0x5fd8('0x4a')]=function(_0x11c430,_0x3a39f0){var _0x4058d4={'raw':!![],'where':{'id':_0x11c430[_0x5fd8('0x4b')]['id']}},_0x1cc1f5={};_0x1cc1f5[_0x5fd8('0x37')]=_[_0x5fd8('0x4c')](db[_0x5fd8('0x34')][_0x5fd8('0x4d')]);_0x1cc1f5['query']=_[_0x5fd8('0x4c')](_0x11c430[_0x5fd8('0x39')]);_0x1cc1f5['filters']=_[_0x5fd8('0x4e')](_0x1cc1f5[_0x5fd8('0x37')],_0x1cc1f5[_0x5fd8('0x39')]);_0x4058d4['attributes']=_[_0x5fd8('0x4e')](_0x1cc1f5['model'],qs[_0x5fd8('0x3b')](_0x11c430[_0x5fd8('0x39')]['fields']));_0x4058d4['attributes']=_0x4058d4['attributes'][_0x5fd8('0x3d')]?_0x4058d4[_0x5fd8('0x3c')]:_0x1cc1f5[_0x5fd8('0x37')];if(_0x11c430['query'][_0x5fd8('0x46')]){_0x4058d4['include']=[{'all':!![]}];}_0x4058d4=_[_0x5fd8('0x44')]({},_0x4058d4,_0x11c430[_0x5fd8('0x4f')]);return db[_0x5fd8('0x34')][_0x5fd8('0x50')](_0x4058d4)['then'](handleEntityNotFound(_0x3a39f0,null))['then'](respondWithResult(_0x3a39f0,null))[_0x5fd8('0x49')](handleError(_0x3a39f0,null));};exports[_0x5fd8('0x51')]=function(_0x59ff73,_0x3876ce){return db[_0x5fd8('0x34')][_0x5fd8('0x51')](_0x59ff73['body'],{})[_0x5fd8('0x2a')](function(_0x46a720){var _0x435853=_0x59ff73[_0x5fd8('0x52')]['get']({'plain':!![]});if(!_0x435853)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x435853['role']==='user'){var _0x1ea3ed=_0x46a720[_0x5fd8('0x2b')]({'plain':!![]});var _0x396409=_0x5fd8('0x2c');return db[_0x5fd8('0x53')][_0x5fd8('0x50')]({'where':{'name':_0x396409,'userProfileId':_0x435853[_0x5fd8('0x54')]},'raw':!![]})[_0x5fd8('0x2a')](function(_0x5351a3){if(_0x5351a3&&_0x5351a3['autoAssociation']===0x0){return db[_0x5fd8('0x55')]['create']({'name':_0x1ea3ed[_0x5fd8('0x31')],'resourceId':_0x1ea3ed['id'],'type':_0x5351a3['name'],'sectionId':_0x5351a3['id']},{})[_0x5fd8('0x2a')](function(){return _0x46a720;});}else{return _0x46a720;}})[_0x5fd8('0x49')](function(_0x19cd16){logger[_0x5fd8('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19cd16);throw _0x19cd16;});}return _0x46a720;})[_0x5fd8('0x2a')](respondWithResult(_0x3876ce,0xc9))[_0x5fd8('0x49')](handleError(_0x3876ce,null));};exports['update']=function(_0x4eb6f6,_0x910f54){if(_0x4eb6f6[_0x5fd8('0x56')]['id']){delete _0x4eb6f6['body']['id'];}return db[_0x5fd8('0x34')]['find']({'where':{'id':_0x4eb6f6[_0x5fd8('0x4b')]['id']}})[_0x5fd8('0x2a')](handleEntityNotFound(_0x910f54,null))['then'](saveUpdates(_0x4eb6f6[_0x5fd8('0x56')],null))[_0x5fd8('0x2a')](respondWithResult(_0x910f54,null))[_0x5fd8('0x49')](handleError(_0x910f54,null));};exports['destroy']=function(_0x2f6f03,_0x1874ba){return db[_0x5fd8('0x34')]['find']({'where':{'id':_0x2f6f03['params']['id']}})['then'](handleEntityNotFound(_0x1874ba,null))['then'](removeEntity(_0x1874ba,null))[_0x5fd8('0x49')](handleError(_0x1874ba,null));};exports[_0x5fd8('0x57')]=function(_0x47f33e,_0x5c8b7e){return db[_0x5fd8('0x34')]['describe']()['then'](respondWithResult(_0x5c8b7e,null))[_0x5fd8('0x49')](handleError(_0x5c8b7e,null));};exports[_0x5fd8('0x58')]=function(_0x4071f4,_0x1a4e84,_0x1d961b){var _0xbcf4b8={'raw':!![],'where':{}},_0x2ad397={},_0x12cd1d;return db[_0x5fd8('0x34')][_0x5fd8('0x59')]({'where':{'id':_0x4071f4[_0x5fd8('0x4b')]['id']}})[_0x5fd8('0x2a')](handleEntityNotFound(_0x1a4e84,null))[_0x5fd8('0x2a')](function(_0x5e9212){if(_0x5e9212){_0x12cd1d=_0x5e9212[_0x5fd8('0x2b')]({'plain':!![]});_0x2ad397[_0x5fd8('0x37')]=_['keys'](db[_0x5fd8('0x5a')][_0x5fd8('0x4d')]);_0x2ad397[_0x5fd8('0x39')]=_[_0x5fd8('0x4c')](_0x4071f4[_0x5fd8('0x39')]);_0x2ad397[_0x5fd8('0x3a')]=_[_0x5fd8('0x4e')](_0x2ad397[_0x5fd8('0x37')],_0x2ad397[_0x5fd8('0x39')]);_0xbcf4b8[_0x5fd8('0x3c')]=_[_0x5fd8('0x4e')](_0x2ad397[_0x5fd8('0x37')],qs[_0x5fd8('0x3b')](_0x4071f4[_0x5fd8('0x39')][_0x5fd8('0x3b')]));_0xbcf4b8[_0x5fd8('0x3c')]=_0xbcf4b8[_0x5fd8('0x3c')][_0x5fd8('0x3d')]?_0xbcf4b8[_0x5fd8('0x3c')]:_0x2ad397['model'];if(!_0x4071f4[_0x5fd8('0x39')]['hasOwnProperty'](_0x5fd8('0x5b'))){_0xbcf4b8['limit']=qs[_0x5fd8('0x22')](_0x4071f4[_0x5fd8('0x39')]['limit']);_0xbcf4b8[_0x5fd8('0x21')]=qs[_0x5fd8('0x21')](_0x4071f4[_0x5fd8('0x39')]['offset']);}_0xbcf4b8[_0x5fd8('0x3f')]=qs['sort'](_0x4071f4[_0x5fd8('0x39')][_0x5fd8('0x40')]);_0xbcf4b8[_0x5fd8('0x41')]=qs[_0x5fd8('0x3a')](_[_0x5fd8('0x42')](_0x4071f4[_0x5fd8('0x39')],_0x2ad397[_0x5fd8('0x3a')]));_0xbcf4b8[_0x5fd8('0x41')]['MailQueueId']=_0x5e9212['id'];if(_0x4071f4[_0x5fd8('0x39')]['filter']){_0xbcf4b8[_0x5fd8('0x41')]=_[_0x5fd8('0x44')](_0xbcf4b8[_0x5fd8('0x41')],{'$or':_[_0x5fd8('0x38')](_0xbcf4b8['attributes'],function(_0x1e8fcb){var _0x3da8ff={};_0x3da8ff[_0x1e8fcb]={'$like':'%'+_0x4071f4[_0x5fd8('0x39')][_0x5fd8('0x43')]+'%'};return _0x3da8ff;})});}_0xbcf4b8=_[_0x5fd8('0x44')]({},_0xbcf4b8,_0x4071f4['options']);return db[_0x5fd8('0x5a')][_0x5fd8('0x47')](_0xbcf4b8);}})['then'](function(_0x1e206e){if(_0x1e206e){return db[_0x5fd8('0x5c')][_0x5fd8('0x5d')]({'where':{'id':_[_0x5fd8('0x38')](_0x1e206e,'UserId'),'role':_0x5fd8('0x5e')},'attributes':['id',_0x5fd8('0x31'),_0x5fd8('0x5f'),'updatedAt',_0x5fd8('0x60')]});}})[_0x5fd8('0x2a')](function(_0x577293){if(_0x577293){return{'count':_0x577293[_0x5fd8('0x24')],'rows':_[_0x5fd8('0x38')](_0x577293[_0x5fd8('0x48')],function(_0x180ff3){return{'membername':_0x180ff3[_0x5fd8('0x31')],'UserId':_0x180ff3['id'],'queue_name':_0x12cd1d[_0x5fd8('0x31')],'MailQueueId':_0x12cd1d['id'],'interface':util[_0x5fd8('0x61')]('%s/%s',_0x5fd8('0x62'),_0x180ff3[_0x5fd8('0x31')]),'penalty':0x0,'paused':_0x180ff3[_0x5fd8('0x5f')],'createdAt':_0x180ff3[_0x5fd8('0x60')],'updatedAt':_0x180ff3['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5fd8('0x2a')](respondWithFilteredResult(_0x1a4e84,_0xbcf4b8))[_0x5fd8('0x49')](handleError(_0x1a4e84,null));};exports['getTeams']=function(_0x18d376,_0x45c70a,_0x522493){var _0x521d48={};var _0x331e89={};var _0x40aa57;var _0x292fb5;return db[_0x5fd8('0x34')][_0x5fd8('0x59')]({'where':{'id':_0x18d376[_0x5fd8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x45c70a,null))['then'](function(_0x352517){if(_0x352517){_0x40aa57=_0x352517;_0x331e89[_0x5fd8('0x37')]=_['keys'](db['Team'][_0x5fd8('0x4d')]);_0x331e89[_0x5fd8('0x39')]=_['keys'](_0x18d376[_0x5fd8('0x39')]);_0x331e89[_0x5fd8('0x3a')]=_[_0x5fd8('0x4e')](_0x331e89[_0x5fd8('0x37')],_0x331e89[_0x5fd8('0x39')]);_0x521d48[_0x5fd8('0x3c')]=_[_0x5fd8('0x4e')](_0x331e89[_0x5fd8('0x37')],qs[_0x5fd8('0x3b')](_0x18d376['query']['fields']));_0x521d48[_0x5fd8('0x3c')]=_0x521d48[_0x5fd8('0x3c')][_0x5fd8('0x3d')]?_0x521d48[_0x5fd8('0x3c')]:_0x331e89[_0x5fd8('0x37')];_0x521d48[_0x5fd8('0x3f')]=qs[_0x5fd8('0x40')](_0x18d376[_0x5fd8('0x39')][_0x5fd8('0x40')]);_0x521d48[_0x5fd8('0x41')]=qs[_0x5fd8('0x3a')](_[_0x5fd8('0x42')](_0x18d376['query'],_0x331e89[_0x5fd8('0x3a')]));if(_0x18d376[_0x5fd8('0x39')][_0x5fd8('0x43')]){_0x521d48['where']=_[_0x5fd8('0x44')](_0x521d48[_0x5fd8('0x41')],{'$or':_['map'](_0x521d48[_0x5fd8('0x3c')],function(_0x2ace0f){var _0x930d24={};_0x930d24[_0x2ace0f]={'$like':'%'+_0x18d376[_0x5fd8('0x39')]['filter']+'%'};return _0x930d24;})});}_0x521d48=_[_0x5fd8('0x44')]({},_0x521d48,_0x18d376[_0x5fd8('0x4f')]);return _0x40aa57['getTeams'](_0x521d48);}})[_0x5fd8('0x2a')](function(_0x31bf0a){if(_0x31bf0a){_0x292fb5=_0x31bf0a[_0x5fd8('0x3d')];if(!_0x18d376[_0x5fd8('0x39')]['hasOwnProperty'](_0x5fd8('0x5b'))){_0x521d48[_0x5fd8('0x22')]=qs[_0x5fd8('0x22')](_0x18d376['query'][_0x5fd8('0x22')]);_0x521d48[_0x5fd8('0x21')]=qs['offset'](_0x18d376['query'][_0x5fd8('0x21')]);}return _0x40aa57[_0x5fd8('0x63')](_0x521d48);}})['then'](function(_0x1b0000){if(_0x1b0000){return _0x1b0000?{'count':_0x292fb5,'rows':_0x1b0000}:null;}})[_0x5fd8('0x2a')](respondWithResult(_0x45c70a,null))[_0x5fd8('0x49')](handleError(_0x45c70a,null));};exports['addTeams']=function(_0x20e816,_0x13c92d,_0x4cf9a0){var _0x4fd2e1=_0x20e816[_0x5fd8('0x56')][_0x5fd8('0x64')];return db[_0x5fd8('0x65')][_0x5fd8('0x47')]({'where':{'id':_0x4fd2e1},'attributes':['id'],'include':[{'model':db[_0x5fd8('0x5c')],'as':_0x5fd8('0x66'),'attributes':['id',_0x5fd8('0x31'),_0x5fd8('0x67'),_0x5fd8('0x68'),_0x5fd8('0x69')],'raw':!![]}]})[_0x5fd8('0x2a')](function(_0x13aab6){if(_0x13aab6){var _0x549290=_['flatMap'](_0x13aab6,function(_0xaf3319){var _0x55c67e=_0xaf3319['get']({'plain':!![]});return _0x55c67e['Agents'];});return db[_0x5fd8('0x34')][_0x5fd8('0x50')]({'where':{'id':_0x20e816[_0x5fd8('0x4b')]['id']}})[_0x5fd8('0x2a')](function(_0x7ed854){return db[_0x5fd8('0x6a')]['transaction'](function(_0x179579){return _0x7ed854[_0x5fd8('0x6b')](_0x4fd2e1,{'transaction':_0x179579})[_0x5fd8('0x2a')](function(){return BPromise['each'](_0x549290,function(_0x1db603){return db[_0x5fd8('0x5a')]['findOrCreate']({'where':{'UserId':_0x1db603['id'],'MailQueueId':_0x20e816['params']['id']},'transaction':_0x179579});});})[_0x5fd8('0x2a')](function(){_0x549290[_0x5fd8('0x6c')](function(_0x14c394){socket[_0x5fd8('0x6d')](_0x5fd8('0x6e'),{'UserId':_0x14c394['id'],'MailQueueId':_0x7ed854['id']});});});});});}})[_0x5fd8('0x2a')](respondWithStatusCode(_0x13c92d,null))[_0x5fd8('0x49')](handleError(_0x13c92d,null));};exports[_0x5fd8('0x6f')]=function(_0x4d4477,_0x2f0c86,_0x15b33a){return db[_0x5fd8('0x65')]['findAll']({'where':{'id':_0x4d4477[_0x5fd8('0x39')][_0x5fd8('0x64')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5fd8('0x66'),'attributes':['id'],'raw':!![]}]})[_0x5fd8('0x2a')](handleEntityNotFound(_0x2f0c86,null))[_0x5fd8('0x2a')](function(_0x50c4ab){var _0x5a99f1=_[_0x5fd8('0x38')](_0x50c4ab,'id');var _0x3f153f=[];var _0x54d8b0=[];var _0x23e20e=squel[_0x5fd8('0x70')]();_0x23e20e['field'](_0x5fd8('0x71'))[_0x5fd8('0x72')]('team_has_mail_queues','tq')[_0x5fd8('0x73')](_0x5fd8('0x74'),'ut',_0x5fd8('0x75'))[_0x5fd8('0x41')]('MailQueueId\x20=\x20?',_0x4d4477[_0x5fd8('0x4b')]['id']);for(var _0xeb5860=0x0;_0xeb5860<_0x50c4ab['length'];_0xeb5860+=0x1){let _0x288c48=_0x50c4ab[_0xeb5860];for(var _0x3f7f63=0x0;_0x3f7f63<_0x288c48[_0x5fd8('0x66')]['length'];_0x3f7f63+=0x1){let _0x5f4ad9=_0x288c48[_0x5fd8('0x66')][_0x3f7f63];var _0x861db3=_0x23e20e[_0x5fd8('0x76')]();_0x861db3[_0x5fd8('0x41')](_0x5fd8('0x77'),_0x5f4ad9['id']);_0x54d8b0[_0x5fd8('0x78')](db[_0x5fd8('0x6a')][_0x5fd8('0x39')](_0x861db3[_0x5fd8('0x79')](),{'type':db['sequelize'][_0x5fd8('0x7a')][_0x5fd8('0x7b')]})['then'](function(_0x2e42aa){if(_0x2e42aa[_0x5fd8('0x3d')]===0x1){return _0x5f4ad9['id'];}else{var _0x1fa2df=_[_0x5fd8('0x7c')](_[_0x5fd8('0x38')](_0x2e42aa,_0x5fd8('0x7d')),function(_0xad5bec){return _[_0x5fd8('0x7e')](_0x5a99f1,_0xad5bec);});if(_0x1fa2df){return _0x5f4ad9['id'];}}}));}}return BPromise['all'](_0x54d8b0)[_0x5fd8('0x2a')](function(_0x39e47b){_0x3f153f=_(_0x3f153f)[_0x5fd8('0x7f')](_0x39e47b)[_0x5fd8('0x80')]()[_0x5fd8('0x81')]();return db['MailQueue'][_0x5fd8('0x50')]({'where':{'id':_0x4d4477['params']['id']}})[_0x5fd8('0x2a')](function(_0x952b67){return db[_0x5fd8('0x6a')]['transaction'](function(_0x4e31cd){return _0x952b67['removeTeams'](_0x4d4477[_0x5fd8('0x39')][_0x5fd8('0x64')],{'transaction':_0x4e31cd})[_0x5fd8('0x2a')](function(){if(!_[_0x5fd8('0x82')](_0x3f153f)){return _0x952b67['removeAgents'](_0x3f153f,{'transaction':_0x4e31cd});}})[_0x5fd8('0x2a')](function(){_0x3f153f[_0x5fd8('0x6c')](function(_0x107e93){socket['emit'](_0x5fd8('0x83'),{'UserId':_0x107e93,'MailQueueId':_0x952b67['id']});});});});});});})['then'](respondWithStatusCode(_0x2f0c86,null))[_0x5fd8('0x49')](handleError(_0x2f0c86,null));};exports[_0x5fd8('0x84')]=function(_0x4bd04c,_0x515061,_0x67aedc){return db['MailQueue']['find']({'where':{'id':_0x4bd04c[_0x5fd8('0x4b')]['id']}})[_0x5fd8('0x2a')](handleEntityNotFound(_0x515061,null))[_0x5fd8('0x2a')](function(_0x59ecef){if(_0x59ecef){return _0x59ecef[_0x5fd8('0x84')](_0x4bd04c['body'][_0x5fd8('0x64')],_[_0x5fd8('0x85')](_0x4bd04c[_0x5fd8('0x56')],[_0x5fd8('0x64'),'id'])||{})[_0x5fd8('0x86')](function(_0x4ff3e9){for(var _0x58a0a1=0x0;_0x58a0a1<_0x4bd04c[_0x5fd8('0x56')][_0x5fd8('0x64')][_0x5fd8('0x3d')];_0x58a0a1+=0x1){socket[_0x5fd8('0x6d')](_0x5fd8('0x6e'),{'UserId':_0x4bd04c[_0x5fd8('0x56')][_0x5fd8('0x64')][_0x58a0a1],'MailQueueId':_0x4bd04c[_0x5fd8('0x4b')]['id']});}return _0x4ff3e9;});}})[_0x5fd8('0x2a')](respondWithResult(_0x515061,null))['catch'](handleError(_0x515061,null));};exports[_0x5fd8('0x87')]=function(_0x19d738,_0x4c003a,_0x8891e6){return db[_0x5fd8('0x34')]['find']({'where':{'id':_0x19d738[_0x5fd8('0x4b')]['id']}})[_0x5fd8('0x2a')](handleEntityNotFound(_0x4c003a,null))[_0x5fd8('0x2a')](function(_0x4e9761){if(_0x4e9761){return _0x4e9761['removeAgents'](_0x19d738[_0x5fd8('0x39')][_0x5fd8('0x64')])[_0x5fd8('0x2a')](function(){if(_[_0x5fd8('0x88')](_0x19d738[_0x5fd8('0x39')][_0x5fd8('0x64')])){for(var _0x42c63d=0x0;_0x42c63d<_0x19d738['query'][_0x5fd8('0x64')][_0x5fd8('0x3d')];_0x42c63d+=0x1){socket[_0x5fd8('0x6d')]('userMailQueue:remove',{'UserId':Number(_0x19d738['query'][_0x5fd8('0x64')][_0x42c63d]),'MailQueueId':Number(_0x19d738[_0x5fd8('0x4b')]['id'])});}}else{socket['emit'](_0x5fd8('0x83'),{'UserId':Number(_0x19d738[_0x5fd8('0x39')][_0x5fd8('0x64')]),'MailQueueId':Number(_0x19d738['params']['id'])});}});}})[_0x5fd8('0x2a')](respondWithStatusCode(_0x4c003a,null))[_0x5fd8('0x49')](handleError(_0x4c003a,null));};exports['getAgents']=function(_0x578125,_0x55eb7d,_0x5cb15c){var _0x33df3b={};var _0x1a4e37={};var _0x254aa4;var _0x3ecf00;return db[_0x5fd8('0x34')]['findOne']({'where':{'id':_0x578125[_0x5fd8('0x4b')]['id']}})[_0x5fd8('0x2a')](handleEntityNotFound(_0x55eb7d,null))['then'](function(_0x137d97){if(_0x137d97){_0x254aa4=_0x137d97;_0x1a4e37[_0x5fd8('0x37')]=_[_0x5fd8('0x4c')](db['User'][_0x5fd8('0x4d')]);_0x1a4e37['query']=_[_0x5fd8('0x4c')](_0x578125['query']);_0x1a4e37[_0x5fd8('0x3a')]=_[_0x5fd8('0x4e')](_0x1a4e37[_0x5fd8('0x37')],_0x1a4e37[_0x5fd8('0x39')]);_0x33df3b['attributes']=_[_0x5fd8('0x4e')](_0x1a4e37[_0x5fd8('0x37')],qs[_0x5fd8('0x3b')](_0x578125['query'][_0x5fd8('0x3b')]));_0x33df3b[_0x5fd8('0x3c')]=_0x33df3b[_0x5fd8('0x3c')][_0x5fd8('0x3d')]?_0x33df3b[_0x5fd8('0x3c')]:_0x1a4e37[_0x5fd8('0x37')];_0x33df3b[_0x5fd8('0x3f')]=qs[_0x5fd8('0x40')](_0x578125[_0x5fd8('0x39')][_0x5fd8('0x40')]);_0x33df3b[_0x5fd8('0x41')]=qs[_0x5fd8('0x3a')](_[_0x5fd8('0x42')](_0x578125[_0x5fd8('0x39')],_0x1a4e37[_0x5fd8('0x3a')]));if(_0x578125['query'][_0x5fd8('0x43')]){_0x33df3b[_0x5fd8('0x41')]=_[_0x5fd8('0x44')](_0x33df3b[_0x5fd8('0x41')],{'$or':_[_0x5fd8('0x38')](_0x33df3b['attributes'],function(_0x5caa8c){var _0x43a30f={};_0x43a30f[_0x5caa8c]={'$like':'%'+_0x578125['query'][_0x5fd8('0x43')]+'%'};return _0x43a30f;})});}_0x33df3b=_[_0x5fd8('0x44')]({},_0x33df3b,_0x578125[_0x5fd8('0x4f')]);return _0x254aa4[_0x5fd8('0x89')](_0x33df3b);}})[_0x5fd8('0x2a')](function(_0x287e86){if(_0x287e86){_0x3ecf00=_0x287e86[_0x5fd8('0x3d')];if(!_0x578125[_0x5fd8('0x39')][_0x5fd8('0x3e')](_0x5fd8('0x5b'))){_0x33df3b[_0x5fd8('0x22')]=qs['limit'](_0x578125[_0x5fd8('0x39')]['limit']);_0x33df3b[_0x5fd8('0x21')]=qs[_0x5fd8('0x21')](_0x578125[_0x5fd8('0x39')][_0x5fd8('0x21')]);}return _0x254aa4[_0x5fd8('0x89')](_0x33df3b);}})['then'](function(_0xdf0ef1){if(_0xdf0ef1){return _0xdf0ef1?{'count':_0x3ecf00,'rows':_0xdf0ef1}:null;}})['then'](respondWithResult(_0x55eb7d,null))[_0x5fd8('0x49')](handleError(_0x55eb7d,null));}; \ No newline at end of file +var _0xaf84=['addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','get','MailQueues','UserProfileResource','error','stack','name','index','map','MailQueue','fieldName','type','key','model','query','keys','intersection','attributes','length','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','params','rawAttributes','fields','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','pick','MailQueueId','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','%s/%s','SIP','getTeams','findOne','hasOwnProperty','online','voicePause','Agents','sequelize','transaction','addTeams','each','emit','userMailQueue:save','Team','ids','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','union','compact','removeTeams','isEmpty','removeAgents'];(function(_0x42bafd,_0x3f0fe3){var _0x2ed705=function(_0x4311ea){while(--_0x4311ea){_0x42bafd['push'](_0x42bafd['shift']());}};_0x2ed705(++_0x3f0fe3);}(_0xaf84,0x92));var _0x4af8=function(_0x1e197d,_0x2e551d){_0x1e197d=_0x1e197d-0x0;var _0x4ca88e=_0xaf84[_0x1e197d];return _0x4ca88e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4af8('0x0'));var zipdir=require(_0x4af8('0x1'));var jsonpatch=require(_0x4af8('0x2'));var rp=require(_0x4af8('0x3'));var moment=require(_0x4af8('0x4'));var BPromise=require(_0x4af8('0x5'));var Mustache=require(_0x4af8('0x6'));var util=require(_0x4af8('0x7'));var path=require(_0x4af8('0x8'));var sox=require(_0x4af8('0x9'));var csv=require(_0x4af8('0xa'));var ejs=require(_0x4af8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4af8('0xc'));var crypto=require(_0x4af8('0xd'));var jsforce=require(_0x4af8('0xe'));var deskjs=require(_0x4af8('0xf'));var toCsv=require(_0x4af8('0xa'));var querystring=require(_0x4af8('0x10'));var Papa=require(_0x4af8('0x11'));var Redis=require(_0x4af8('0x12'));var authService=require(_0x4af8('0x13'));var qs=require(_0x4af8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4af8('0x15'));var logger=require('../../config/logger')(_0x4af8('0x16'));var utils=require('../../config/utils');var config=require(_0x4af8('0x17'));var licenseUtil=require(_0x4af8('0x18'));var db=require(_0x4af8('0x19'))['db'];config[_0x4af8('0x1a')]=_['defaults'](config[_0x4af8('0x1a')],{'host':_0x4af8('0x1b'),'port':0x18eb});var socket=require(_0x4af8('0x1c'))(new Redis(config[_0x4af8('0x1a')]));require(_0x4af8('0x1d'))[_0x4af8('0x1e')](socket);function respondWithStatusCode(_0x32f182,_0x3889f8){_0x3889f8=_0x3889f8||0xcc;return function(_0x42e6fd){if(_0x42e6fd){return _0x32f182[_0x4af8('0x1f')](_0x3889f8);}return _0x32f182[_0x4af8('0x20')](_0x3889f8)[_0x4af8('0x21')]();};}function respondWithResult(_0x144d10,_0xe1a6c8){_0xe1a6c8=_0xe1a6c8||0xc8;return function(_0x3a759c){if(_0x3a759c){return _0x144d10[_0x4af8('0x20')](_0xe1a6c8)[_0x4af8('0x22')](_0x3a759c);}};}function respondWithFilteredResult(_0xd996b3,_0x360add){return function(_0x494252){if(_0x494252){var _0x3690e9=typeof _0x360add[_0x4af8('0x23')]===_0x4af8('0x24')&&typeof _0x360add[_0x4af8('0x25')]===_0x4af8('0x24');var _0xb7c37b=_0x494252[_0x4af8('0x26')];var _0x151b20=_0x3690e9?0x0:_0x360add[_0x4af8('0x23')];var _0x1e6bca=_0x3690e9?_0x494252[_0x4af8('0x26')]:_0x360add[_0x4af8('0x23')]+_0x360add[_0x4af8('0x25')];var _0x5168c8;if(_0x1e6bca>=_0xb7c37b){_0x1e6bca=_0xb7c37b;_0x5168c8=0xc8;}else{_0x5168c8=0xce;}_0xd996b3[_0x4af8('0x20')](_0x5168c8);return _0xd996b3[_0x4af8('0x27')](_0x4af8('0x28'),_0x151b20+'-'+_0x1e6bca+'/'+_0xb7c37b)['json'](_0x494252);}return null;};}function patchUpdates(_0x3cdd65){return function(_0x530046){try{jsonpatch[_0x4af8('0x29')](_0x530046,_0x3cdd65,!![]);}catch(_0x3a712f){return BPromise['reject'](_0x3a712f);}return _0x530046['save']();};}function saveUpdates(_0xdf1f6e,_0x43f92a){return function(_0x3b01b2){if(_0x3b01b2){return _0x3b01b2[_0x4af8('0x2a')](_0xdf1f6e)['then'](function(_0x44bea2){return _0x44bea2;});}return null;};}function removeEntity(_0x987f9c,_0x580f68){return function(_0x47de3e){if(_0x47de3e){return _0x47de3e[_0x4af8('0x2b')]()[_0x4af8('0x2c')](function(){var _0x1430a0=_0x47de3e[_0x4af8('0x2d')]({'plain':!![]});var _0x198641=_0x4af8('0x2e');return db[_0x4af8('0x2f')]['destroy']({'where':{'type':_0x198641,'resourceId':_0x1430a0['id']}})[_0x4af8('0x2c')](function(){return _0x47de3e;});})['then'](function(){_0x987f9c[_0x4af8('0x20')](0xcc)[_0x4af8('0x21')]();});}};}function handleEntityNotFound(_0x55d764,_0x101d16){return function(_0x377784){if(!_0x377784){_0x55d764['sendStatus'](0x194);}return _0x377784;};}function handleError(_0x237ceb,_0x2aa07c){_0x2aa07c=_0x2aa07c||0x1f4;return function(_0x382b2b){logger[_0x4af8('0x30')](_0x382b2b[_0x4af8('0x31')]);if(_0x382b2b[_0x4af8('0x32')]){delete _0x382b2b[_0x4af8('0x32')];}_0x237ceb[_0x4af8('0x20')](_0x2aa07c)['send'](_0x382b2b);};}exports[_0x4af8('0x33')]=function(_0x1f579a,_0xe4496d){var _0x52016a={},_0x51df3f={},_0x3adc04={'count':0x0,'rows':[]};var _0x14cfb0=_[_0x4af8('0x34')](db[_0x4af8('0x35')]['rawAttributes'],function(_0x590cc1){return{'name':_0x590cc1[_0x4af8('0x36')],'type':_0x590cc1[_0x4af8('0x37')][_0x4af8('0x38')]};});_0x51df3f[_0x4af8('0x39')]=_['map'](_0x14cfb0,'name');_0x51df3f[_0x4af8('0x3a')]=_[_0x4af8('0x3b')](_0x1f579a[_0x4af8('0x3a')]);_0x51df3f['filters']=_[_0x4af8('0x3c')](_0x51df3f[_0x4af8('0x39')],_0x51df3f['query']);_0x52016a[_0x4af8('0x3d')]=_[_0x4af8('0x3c')](_0x51df3f[_0x4af8('0x39')],qs['fields'](_0x1f579a[_0x4af8('0x3a')]['fields']));_0x52016a[_0x4af8('0x3d')]=_0x52016a[_0x4af8('0x3d')][_0x4af8('0x3e')]?_0x52016a[_0x4af8('0x3d')]:_0x51df3f[_0x4af8('0x39')];if(!_0x1f579a[_0x4af8('0x3a')]['hasOwnProperty'](_0x4af8('0x3f'))){_0x52016a[_0x4af8('0x25')]=qs[_0x4af8('0x25')](_0x1f579a['query'][_0x4af8('0x25')]);_0x52016a[_0x4af8('0x23')]=qs[_0x4af8('0x23')](_0x1f579a['query']['offset']);}_0x52016a[_0x4af8('0x40')]=qs[_0x4af8('0x41')](_0x1f579a['query'][_0x4af8('0x41')]);_0x52016a[_0x4af8('0x42')]=qs[_0x4af8('0x43')](_['pick'](_0x1f579a[_0x4af8('0x3a')],_0x51df3f[_0x4af8('0x43')]),_0x14cfb0);if(_0x1f579a[_0x4af8('0x3a')][_0x4af8('0x44')]){_0x52016a[_0x4af8('0x42')]=_[_0x4af8('0x45')](_0x52016a[_0x4af8('0x42')],{'$or':_[_0x4af8('0x34')](_0x14cfb0,function(_0x24bc46){if(_0x24bc46[_0x4af8('0x37')]!=='VIRTUAL'){var _0x2604ad={};_0x2604ad[_0x24bc46['name']]={'$like':'%'+_0x1f579a[_0x4af8('0x3a')][_0x4af8('0x44')]+'%'};return _0x2604ad;}})});}_0x52016a=_['merge']({},_0x52016a,_0x1f579a[_0x4af8('0x46')]);var _0xecccf1={'where':_0x52016a[_0x4af8('0x42')]};return db[_0x4af8('0x35')]['count'](_0xecccf1)['then'](function(_0x36e532){_0x3adc04[_0x4af8('0x26')]=_0x36e532;if(_0x1f579a[_0x4af8('0x3a')][_0x4af8('0x47')]){_0x52016a[_0x4af8('0x48')]=[{'all':!![]}];}return db[_0x4af8('0x35')][_0x4af8('0x49')](_0x52016a);})['then'](function(_0x17ebe4){_0x3adc04[_0x4af8('0x4a')]=_0x17ebe4;return _0x3adc04;})['then'](respondWithFilteredResult(_0xe4496d,_0x52016a))['catch'](handleError(_0xe4496d,null));};exports['show']=function(_0x1ad902,_0x58e9c2){var _0x2776be={'raw':!![],'where':{'id':_0x1ad902[_0x4af8('0x4b')]['id']}},_0x417234={};_0x417234['model']=_[_0x4af8('0x3b')](db['MailQueue'][_0x4af8('0x4c')]);_0x417234[_0x4af8('0x3a')]=_[_0x4af8('0x3b')](_0x1ad902[_0x4af8('0x3a')]);_0x417234[_0x4af8('0x43')]=_[_0x4af8('0x3c')](_0x417234[_0x4af8('0x39')],_0x417234[_0x4af8('0x3a')]);_0x2776be[_0x4af8('0x3d')]=_['intersection'](_0x417234[_0x4af8('0x39')],qs[_0x4af8('0x4d')](_0x1ad902[_0x4af8('0x3a')][_0x4af8('0x4d')]));_0x2776be[_0x4af8('0x3d')]=_0x2776be['attributes']['length']?_0x2776be[_0x4af8('0x3d')]:_0x417234[_0x4af8('0x39')];if(_0x1ad902[_0x4af8('0x3a')][_0x4af8('0x47')]){_0x2776be[_0x4af8('0x48')]=[{'all':!![]}];}_0x2776be=_[_0x4af8('0x45')]({},_0x2776be,_0x1ad902[_0x4af8('0x46')]);return db[_0x4af8('0x35')][_0x4af8('0x4e')](_0x2776be)['then'](handleEntityNotFound(_0x58e9c2,null))['then'](respondWithResult(_0x58e9c2,null))[_0x4af8('0x4f')](handleError(_0x58e9c2,null));};exports[_0x4af8('0x50')]=function(_0x2050ad,_0x419dfc){return db['MailQueue'][_0x4af8('0x50')](_0x2050ad[_0x4af8('0x51')],{})[_0x4af8('0x2c')](function(_0x598b2b){var _0x5a83e7=_0x2050ad[_0x4af8('0x52')][_0x4af8('0x2d')]({'plain':!![]});if(!_0x5a83e7)throw new Error(_0x4af8('0x53'));if(_0x5a83e7[_0x4af8('0x54')]===_0x4af8('0x52')){var _0x3d91fd=_0x598b2b[_0x4af8('0x2d')]({'plain':!![]});var _0x446958=_0x4af8('0x2e');return db[_0x4af8('0x55')][_0x4af8('0x4e')]({'where':{'name':_0x446958,'userProfileId':_0x5a83e7['userProfileId']},'raw':!![]})[_0x4af8('0x2c')](function(_0xfdaa0){if(_0xfdaa0&&_0xfdaa0[_0x4af8('0x56')]===0x0){return db['UserProfileResource'][_0x4af8('0x50')]({'name':_0x3d91fd['name'],'resourceId':_0x3d91fd['id'],'type':_0xfdaa0[_0x4af8('0x32')],'sectionId':_0xfdaa0['id']},{})['then'](function(){return _0x598b2b;});}else{return _0x598b2b;}})[_0x4af8('0x4f')](function(_0x585c0e){logger[_0x4af8('0x30')](_0x4af8('0x57'),_0x585c0e);throw _0x585c0e;});}return _0x598b2b;})[_0x4af8('0x2c')](respondWithResult(_0x419dfc,0xc9))['catch'](handleError(_0x419dfc,null));};exports['update']=function(_0x4372cc,_0x5de1eb){if(_0x4372cc[_0x4af8('0x51')]['id']){delete _0x4372cc[_0x4af8('0x51')]['id'];}return db[_0x4af8('0x35')][_0x4af8('0x4e')]({'where':{'id':_0x4372cc['params']['id']}})[_0x4af8('0x2c')](handleEntityNotFound(_0x5de1eb,null))[_0x4af8('0x2c')](saveUpdates(_0x4372cc[_0x4af8('0x51')],null))[_0x4af8('0x2c')](respondWithResult(_0x5de1eb,null))[_0x4af8('0x4f')](handleError(_0x5de1eb,null));};exports[_0x4af8('0x2b')]=function(_0x388327,_0x1d5570){return db[_0x4af8('0x35')][_0x4af8('0x4e')]({'where':{'id':_0x388327[_0x4af8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1d5570,null))[_0x4af8('0x2c')](removeEntity(_0x1d5570,null))['catch'](handleError(_0x1d5570,null));};exports[_0x4af8('0x58')]=function(_0x33e9e3,_0xf66276){return db[_0x4af8('0x35')][_0x4af8('0x58')]()['then'](respondWithResult(_0xf66276,null))[_0x4af8('0x4f')](handleError(_0xf66276,null));};exports[_0x4af8('0x59')]=function(_0x295a71,_0x16a58d,_0x5ed1b2){var _0x1ff739={'raw':!![],'where':{}},_0x3ad427={},_0x4cdc56;return db['MailQueue']['findOne']({'where':{'id':_0x295a71[_0x4af8('0x4b')]['id']}})[_0x4af8('0x2c')](handleEntityNotFound(_0x16a58d,null))['then'](function(_0x2cadaf){if(_0x2cadaf){_0x4cdc56=_0x2cadaf[_0x4af8('0x2d')]({'plain':!![]});_0x3ad427[_0x4af8('0x39')]=_[_0x4af8('0x3b')](db[_0x4af8('0x5a')][_0x4af8('0x4c')]);_0x3ad427['query']=_[_0x4af8('0x3b')](_0x295a71[_0x4af8('0x3a')]);_0x3ad427[_0x4af8('0x43')]=_[_0x4af8('0x3c')](_0x3ad427[_0x4af8('0x39')],_0x3ad427['query']);_0x1ff739[_0x4af8('0x3d')]=_[_0x4af8('0x3c')](_0x3ad427[_0x4af8('0x39')],qs[_0x4af8('0x4d')](_0x295a71[_0x4af8('0x3a')][_0x4af8('0x4d')]));_0x1ff739[_0x4af8('0x3d')]=_0x1ff739[_0x4af8('0x3d')][_0x4af8('0x3e')]?_0x1ff739[_0x4af8('0x3d')]:_0x3ad427['model'];if(!_0x295a71['query']['hasOwnProperty'](_0x4af8('0x3f'))){_0x1ff739[_0x4af8('0x25')]=qs[_0x4af8('0x25')](_0x295a71[_0x4af8('0x3a')]['limit']);_0x1ff739[_0x4af8('0x23')]=qs[_0x4af8('0x23')](_0x295a71[_0x4af8('0x3a')][_0x4af8('0x23')]);}_0x1ff739[_0x4af8('0x40')]=qs[_0x4af8('0x41')](_0x295a71[_0x4af8('0x3a')][_0x4af8('0x41')]);_0x1ff739[_0x4af8('0x42')]=qs[_0x4af8('0x43')](_[_0x4af8('0x5b')](_0x295a71[_0x4af8('0x3a')],_0x3ad427['filters']));_0x1ff739[_0x4af8('0x42')][_0x4af8('0x5c')]=_0x2cadaf['id'];if(_0x295a71['query']['filter']){_0x1ff739[_0x4af8('0x42')]=_[_0x4af8('0x45')](_0x1ff739['where'],{'$or':_[_0x4af8('0x34')](_0x1ff739[_0x4af8('0x3d')],function(_0x38e94a){var _0x8be312={};_0x8be312[_0x38e94a]={'$like':'%'+_0x295a71[_0x4af8('0x3a')][_0x4af8('0x44')]+'%'};return _0x8be312;})});}_0x1ff739=_['merge']({},_0x1ff739,_0x295a71[_0x4af8('0x46')]);return db[_0x4af8('0x5a')][_0x4af8('0x49')](_0x1ff739);}})['then'](function(_0xeb1c41){if(_0xeb1c41){return db[_0x4af8('0x5d')][_0x4af8('0x5e')]({'where':{'id':_[_0x4af8('0x34')](_0xeb1c41,'UserId'),'role':_0x4af8('0x5f')},'attributes':['id',_0x4af8('0x32'),_0x4af8('0x60'),_0x4af8('0x61'),_0x4af8('0x62')]});}})['then'](function(_0x392ee9){if(_0x392ee9){return{'count':_0x392ee9[_0x4af8('0x26')],'rows':_['map'](_0x392ee9['rows'],function(_0xf598d3){return{'membername':_0xf598d3[_0x4af8('0x32')],'UserId':_0xf598d3['id'],'queue_name':_0x4cdc56['name'],'MailQueueId':_0x4cdc56['id'],'interface':util['format'](_0x4af8('0x63'),_0x4af8('0x64'),_0xf598d3['name']),'penalty':0x0,'paused':_0xf598d3['mailPause'],'createdAt':_0xf598d3[_0x4af8('0x62')],'updatedAt':_0xf598d3[_0x4af8('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4af8('0x2c')](respondWithFilteredResult(_0x16a58d,_0x1ff739))['catch'](handleError(_0x16a58d,null));};exports[_0x4af8('0x65')]=function(_0x5f03f4,_0x1384ef,_0x657984){var _0x16c54c={};var _0xa10800={};var _0x1c0778;var _0x5ad0d3;return db[_0x4af8('0x35')][_0x4af8('0x66')]({'where':{'id':_0x5f03f4[_0x4af8('0x4b')]['id']}})[_0x4af8('0x2c')](handleEntityNotFound(_0x1384ef,null))[_0x4af8('0x2c')](function(_0x42a163){if(_0x42a163){_0x1c0778=_0x42a163;_0xa10800[_0x4af8('0x39')]=_[_0x4af8('0x3b')](db['Team'][_0x4af8('0x4c')]);_0xa10800['query']=_[_0x4af8('0x3b')](_0x5f03f4[_0x4af8('0x3a')]);_0xa10800[_0x4af8('0x43')]=_[_0x4af8('0x3c')](_0xa10800['model'],_0xa10800['query']);_0x16c54c[_0x4af8('0x3d')]=_[_0x4af8('0x3c')](_0xa10800[_0x4af8('0x39')],qs[_0x4af8('0x4d')](_0x5f03f4[_0x4af8('0x3a')][_0x4af8('0x4d')]));_0x16c54c[_0x4af8('0x3d')]=_0x16c54c['attributes'][_0x4af8('0x3e')]?_0x16c54c[_0x4af8('0x3d')]:_0xa10800[_0x4af8('0x39')];_0x16c54c[_0x4af8('0x40')]=qs[_0x4af8('0x41')](_0x5f03f4[_0x4af8('0x3a')][_0x4af8('0x41')]);_0x16c54c[_0x4af8('0x42')]=qs['filters'](_[_0x4af8('0x5b')](_0x5f03f4[_0x4af8('0x3a')],_0xa10800[_0x4af8('0x43')]));if(_0x5f03f4[_0x4af8('0x3a')]['filter']){_0x16c54c['where']=_[_0x4af8('0x45')](_0x16c54c[_0x4af8('0x42')],{'$or':_[_0x4af8('0x34')](_0x16c54c[_0x4af8('0x3d')],function(_0x19b013){var _0x3c91c0={};_0x3c91c0[_0x19b013]={'$like':'%'+_0x5f03f4[_0x4af8('0x3a')][_0x4af8('0x44')]+'%'};return _0x3c91c0;})});}_0x16c54c=_[_0x4af8('0x45')]({},_0x16c54c,_0x5f03f4['options']);return _0x1c0778[_0x4af8('0x65')](_0x16c54c);}})['then'](function(_0x3d12bd){if(_0x3d12bd){_0x5ad0d3=_0x3d12bd[_0x4af8('0x3e')];if(!_0x5f03f4[_0x4af8('0x3a')][_0x4af8('0x67')](_0x4af8('0x3f'))){_0x16c54c[_0x4af8('0x25')]=qs[_0x4af8('0x25')](_0x5f03f4[_0x4af8('0x3a')]['limit']);_0x16c54c[_0x4af8('0x23')]=qs[_0x4af8('0x23')](_0x5f03f4[_0x4af8('0x3a')][_0x4af8('0x23')]);}return _0x1c0778['getTeams'](_0x16c54c);}})[_0x4af8('0x2c')](function(_0x3d02c0){if(_0x3d02c0){return _0x3d02c0?{'count':_0x5ad0d3,'rows':_0x3d02c0}:null;}})[_0x4af8('0x2c')](respondWithResult(_0x1384ef,null))[_0x4af8('0x4f')](handleError(_0x1384ef,null));};exports['addTeams']=function(_0x1ddf79,_0x1bcaa2,_0x138d8d){var _0x2a9b5c=_0x1ddf79[_0x4af8('0x51')]['ids'];return db['Team'][_0x4af8('0x49')]({'where':{'id':_0x2a9b5c},'attributes':['id'],'include':[{'model':db[_0x4af8('0x5d')],'as':'Agents','attributes':['id',_0x4af8('0x32'),_0x4af8('0x68'),_0x4af8('0x69'),'interface'],'raw':!![]}]})[_0x4af8('0x2c')](function(_0x3c1f5e){if(_0x3c1f5e){var _0x5a8ea9=_['flatMap'](_0x3c1f5e,function(_0x38a1d1){var _0x11a75e=_0x38a1d1[_0x4af8('0x2d')]({'plain':!![]});return _0x11a75e[_0x4af8('0x6a')];});return db[_0x4af8('0x35')][_0x4af8('0x4e')]({'where':{'id':_0x1ddf79[_0x4af8('0x4b')]['id']}})[_0x4af8('0x2c')](function(_0x38b905){return db[_0x4af8('0x6b')][_0x4af8('0x6c')](function(_0x439682){return _0x38b905[_0x4af8('0x6d')](_0x2a9b5c,{'transaction':_0x439682})[_0x4af8('0x2c')](function(){return BPromise[_0x4af8('0x6e')](_0x5a8ea9,function(_0x574504){return db[_0x4af8('0x5a')]['findOrCreate']({'where':{'UserId':_0x574504['id'],'MailQueueId':_0x1ddf79['params']['id']},'transaction':_0x439682});});})['then'](function(){_0x5a8ea9['forEach'](function(_0x1baddd){socket[_0x4af8('0x6f')](_0x4af8('0x70'),{'UserId':_0x1baddd['id'],'MailQueueId':_0x38b905['id']});});});});});}})['then'](respondWithStatusCode(_0x1bcaa2,null))[_0x4af8('0x4f')](handleError(_0x1bcaa2,null));};exports['removeTeams']=function(_0x144ec2,_0x5134d5,_0x446a0a){return db[_0x4af8('0x71')][_0x4af8('0x49')]({'where':{'id':_0x144ec2[_0x4af8('0x3a')][_0x4af8('0x72')]},'attributes':['id'],'include':[{'model':db[_0x4af8('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4af8('0x2c')](handleEntityNotFound(_0x5134d5,null))[_0x4af8('0x2c')](function(_0x1f31eb){var _0x269761=_[_0x4af8('0x34')](_0x1f31eb,'id');var _0x522e79=[];var _0x3408eb=[];var _0x51ef70=squel['select']();_0x51ef70[_0x4af8('0x73')]('tq.TeamId')[_0x4af8('0x74')](_0x4af8('0x75'),'tq')[_0x4af8('0x76')](_0x4af8('0x77'),'ut',_0x4af8('0x78'))[_0x4af8('0x42')](_0x4af8('0x79'),_0x144ec2['params']['id']);for(var _0x5622a2=0x0;_0x5622a2<_0x1f31eb[_0x4af8('0x3e')];_0x5622a2+=0x1){let _0x6b4ce1=_0x1f31eb[_0x5622a2];for(var _0x322114=0x0;_0x322114<_0x6b4ce1['Agents']['length'];_0x322114+=0x1){let _0x19338b=_0x6b4ce1[_0x4af8('0x6a')][_0x322114];var _0x8e1d24=_0x51ef70['clone']();_0x8e1d24[_0x4af8('0x42')](_0x4af8('0x7a'),_0x19338b['id']);_0x3408eb[_0x4af8('0x7b')](db[_0x4af8('0x6b')][_0x4af8('0x3a')](_0x8e1d24[_0x4af8('0x7c')](),{'type':db[_0x4af8('0x6b')][_0x4af8('0x7d')]['SELECT']})[_0x4af8('0x2c')](function(_0x25c3fc){if(_0x25c3fc[_0x4af8('0x3e')]===0x1){return _0x19338b['id'];}else{var _0xdee9=_['every'](_[_0x4af8('0x34')](_0x25c3fc,_0x4af8('0x7e')),function(_0x1c87ed){return _[_0x4af8('0x7f')](_0x269761,_0x1c87ed);});if(_0xdee9){return _0x19338b['id'];}}}));}}return BPromise[_0x4af8('0x80')](_0x3408eb)['then'](function(_0x11f0d8){_0x522e79=_(_0x522e79)[_0x4af8('0x81')](_0x11f0d8)[_0x4af8('0x82')]()['value']();return db[_0x4af8('0x35')][_0x4af8('0x4e')]({'where':{'id':_0x144ec2[_0x4af8('0x4b')]['id']}})[_0x4af8('0x2c')](function(_0x2c5052){return db[_0x4af8('0x6b')][_0x4af8('0x6c')](function(_0x4a5b5b){return _0x2c5052[_0x4af8('0x83')](_0x144ec2['query'][_0x4af8('0x72')],{'transaction':_0x4a5b5b})[_0x4af8('0x2c')](function(){if(!_[_0x4af8('0x84')](_0x522e79)){return _0x2c5052[_0x4af8('0x85')](_0x522e79,{'transaction':_0x4a5b5b});}})[_0x4af8('0x2c')](function(){_0x522e79['forEach'](function(_0x46ace9){socket[_0x4af8('0x6f')]('userMailQueue:remove',{'UserId':_0x46ace9,'MailQueueId':_0x2c5052['id']});});});});});});})[_0x4af8('0x2c')](respondWithStatusCode(_0x5134d5,null))['catch'](handleError(_0x5134d5,null));};exports[_0x4af8('0x86')]=function(_0x5cfa6e,_0x473e42,_0x3a063a){return db['MailQueue'][_0x4af8('0x4e')]({'where':{'id':_0x5cfa6e['params']['id']}})['then'](handleEntityNotFound(_0x473e42,null))['then'](function(_0x21b41a){if(_0x21b41a){return _0x21b41a['addAgents'](_0x5cfa6e[_0x4af8('0x51')][_0x4af8('0x72')],_[_0x4af8('0x87')](_0x5cfa6e[_0x4af8('0x51')],[_0x4af8('0x72'),'id'])||{})[_0x4af8('0x88')](function(_0xa0af2c){for(var _0x1cd531=0x0;_0x1cd531<_0x5cfa6e['body'][_0x4af8('0x72')][_0x4af8('0x3e')];_0x1cd531+=0x1){socket[_0x4af8('0x6f')](_0x4af8('0x70'),{'UserId':_0x5cfa6e[_0x4af8('0x51')][_0x4af8('0x72')][_0x1cd531],'MailQueueId':_0x5cfa6e[_0x4af8('0x4b')]['id']});}return _0xa0af2c;});}})[_0x4af8('0x2c')](respondWithResult(_0x473e42,null))[_0x4af8('0x4f')](handleError(_0x473e42,null));};exports[_0x4af8('0x85')]=function(_0x5dc8e5,_0x4932e7,_0x31789c){return db[_0x4af8('0x35')]['find']({'where':{'id':_0x5dc8e5['params']['id']}})[_0x4af8('0x2c')](handleEntityNotFound(_0x4932e7,null))['then'](function(_0x5343f2){if(_0x5343f2){return _0x5343f2[_0x4af8('0x85')](_0x5dc8e5[_0x4af8('0x3a')][_0x4af8('0x72')])[_0x4af8('0x2c')](function(){if(_[_0x4af8('0x89')](_0x5dc8e5[_0x4af8('0x3a')][_0x4af8('0x72')])){for(var _0x1e2fab=0x0;_0x1e2fab<_0x5dc8e5[_0x4af8('0x3a')][_0x4af8('0x72')][_0x4af8('0x3e')];_0x1e2fab+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x5dc8e5['query'][_0x4af8('0x72')][_0x1e2fab]),'MailQueueId':Number(_0x5dc8e5[_0x4af8('0x4b')]['id'])});}}else{socket[_0x4af8('0x6f')](_0x4af8('0x8a'),{'UserId':Number(_0x5dc8e5[_0x4af8('0x3a')][_0x4af8('0x72')]),'MailQueueId':Number(_0x5dc8e5[_0x4af8('0x4b')]['id'])});}});}})[_0x4af8('0x2c')](respondWithStatusCode(_0x4932e7,null))[_0x4af8('0x4f')](handleError(_0x4932e7,null));};exports[_0x4af8('0x8b')]=function(_0x25c26c,_0x5494d8,_0x35c5a2){var _0x5a5391={};var _0x575e9a={};var _0x1b3521;var _0x4269ea;return db[_0x4af8('0x35')]['findOne']({'where':{'id':_0x25c26c[_0x4af8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5494d8,null))[_0x4af8('0x2c')](function(_0xccd4fb){if(_0xccd4fb){_0x1b3521=_0xccd4fb;_0x575e9a[_0x4af8('0x39')]=_['keys'](db[_0x4af8('0x5d')][_0x4af8('0x4c')]);_0x575e9a[_0x4af8('0x3a')]=_[_0x4af8('0x3b')](_0x25c26c[_0x4af8('0x3a')]);_0x575e9a[_0x4af8('0x43')]=_[_0x4af8('0x3c')](_0x575e9a[_0x4af8('0x39')],_0x575e9a[_0x4af8('0x3a')]);_0x5a5391[_0x4af8('0x3d')]=_[_0x4af8('0x3c')](_0x575e9a['model'],qs['fields'](_0x25c26c[_0x4af8('0x3a')][_0x4af8('0x4d')]));_0x5a5391['attributes']=_0x5a5391['attributes'][_0x4af8('0x3e')]?_0x5a5391[_0x4af8('0x3d')]:_0x575e9a['model'];_0x5a5391['order']=qs[_0x4af8('0x41')](_0x25c26c['query'][_0x4af8('0x41')]);_0x5a5391[_0x4af8('0x42')]=qs[_0x4af8('0x43')](_[_0x4af8('0x5b')](_0x25c26c['query'],_0x575e9a['filters']));if(_0x25c26c[_0x4af8('0x3a')][_0x4af8('0x44')]){_0x5a5391[_0x4af8('0x42')]=_[_0x4af8('0x45')](_0x5a5391[_0x4af8('0x42')],{'$or':_[_0x4af8('0x34')](_0x5a5391['attributes'],function(_0x2042dc){var _0x1a66bb={};_0x1a66bb[_0x2042dc]={'$like':'%'+_0x25c26c['query'][_0x4af8('0x44')]+'%'};return _0x1a66bb;})});}_0x5a5391=_['merge']({},_0x5a5391,_0x25c26c[_0x4af8('0x46')]);return _0x1b3521['getAgents'](_0x5a5391);}})[_0x4af8('0x2c')](function(_0x48908c){if(_0x48908c){_0x4269ea=_0x48908c[_0x4af8('0x3e')];if(!_0x25c26c[_0x4af8('0x3a')][_0x4af8('0x67')](_0x4af8('0x3f'))){_0x5a5391[_0x4af8('0x25')]=qs['limit'](_0x25c26c[_0x4af8('0x3a')][_0x4af8('0x25')]);_0x5a5391[_0x4af8('0x23')]=qs[_0x4af8('0x23')](_0x25c26c[_0x4af8('0x3a')][_0x4af8('0x23')]);}return _0x1b3521[_0x4af8('0x8b')](_0x5a5391);}})[_0x4af8('0x2c')](function(_0x3b5039){if(_0x3b5039){return _0x3b5039?{'count':_0x4269ea,'rows':_0x3b5039}:null;}})[_0x4af8('0x2c')](respondWithResult(_0x5494d8,null))['catch'](handleError(_0x5494d8,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 0da18f1..2ad7d84 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 _0xe713=['save','update','remove','emit','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x1aed80,_0x3ca6f6){var _0x43961e=function(_0x43bf2b){while(--_0x43bf2b){_0x1aed80['push'](_0x1aed80['shift']());}};_0x43961e(++_0x3ca6f6);}(_0xe713,0xde));var _0x3e71=function(_0x22d318,_0x22dc24){_0x22d318=_0x22d318-0x0;var _0x1c8e5c=_0xe713[_0x22d318];return _0x1c8e5c;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x3e71('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x3e71('0x1')](0x0);var events={'afterCreate':_0x3e71('0x2'),'afterUpdate':_0x3e71('0x3'),'afterDestroy':_0x3e71('0x4')};function emitEvent(_0x193a2d){return function(_0x242d85,_0x201dc7,_0x4b0cdb){MailQueueEvents[_0x3e71('0x5')](_0x193a2d+':'+_0x242d85['id'],_0x242d85);MailQueueEvents['emit'](_0x193a2d,_0x242d85);_0x4b0cdb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x3e71('0x6')](e,emitEvent(event));}}module[_0x3e71('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x4d52=['MailQueue','setMaxListeners','save','remove','emit','hook','exports','events'];(function(_0x4de1b1,_0x18c64c){var _0x639f27=function(_0x635e03){while(--_0x635e03){_0x4de1b1['push'](_0x4de1b1['shift']());}};_0x639f27(++_0x18c64c);}(_0x4d52,0x1d7));var _0x24d5=function(_0x23aee1,_0x4280f9){_0x23aee1=_0x23aee1-0x0;var _0x18a9b1=_0x4d52[_0x23aee1];return _0x18a9b1;};'use strict';var EventEmitter=require(_0x24d5('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x24d5('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x24d5('0x2')](0x0);var events={'afterCreate':_0x24d5('0x3'),'afterUpdate':'update','afterDestroy':_0x24d5('0x4')};function emitEvent(_0x2333e8){return function(_0x4f23ee,_0x418101,_0xbf1b0e){MailQueueEvents[_0x24d5('0x5')](_0x2333e8+':'+_0x4f23ee['id'],_0x4f23ee);MailQueueEvents[_0x24d5('0x5')](_0x2333e8,_0x4f23ee);_0xbf1b0e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x24d5('0x6')](e,emitEvent(event));}}module[_0x24d5('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 4c9920e..81e950b 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 _0x5eaa=['bluebird','request-promise','path','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','api','moment'];(function(_0x454ffa,_0x5784f4){var _0x4b93f4=function(_0x33e55e){while(--_0x33e55e){_0x454ffa['push'](_0x454ffa['shift']());}};_0x4b93f4(++_0x5784f4);}(_0x5eaa,0x1dd));var _0xa5ea=function(_0x4fd505,_0x409971){_0x4fd505=_0x4fd505-0x0;var _0x3a1844=_0x5eaa[_0x4fd505];return _0x3a1844;};'use strict';var _=require(_0xa5ea('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa5ea('0x1'));var moment=require(_0xa5ea('0x2'));var BPromise=require(_0xa5ea('0x3'));var rp=require(_0xa5ea('0x4'));var fs=require('fs');var path=require(_0xa5ea('0x5'));var rimraf=require('rimraf');var config=require(_0xa5ea('0x6'));var attributes=require(_0xa5ea('0x7'));module[_0xa5ea('0x8')]=function(_0x538418,_0x147c94){return _0x538418[_0xa5ea('0x9')](_0xa5ea('0xa'),attributes,{'tableName':_0xa5ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3519=['exports','define','MailQueue','mail_queues','lodash','moment','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3519,0x1dd));var _0x9351=function(_0x2ec40b,_0x59a29c){_0x2ec40b=_0x2ec40b-0x0;var _0x28ba77=_0x3519[_0x2ec40b];return _0x28ba77;};'use strict';var _=require(_0x9351('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9351('0x1'));var BPromise=require(_0x9351('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9351('0x3'));var rimraf=require(_0x9351('0x4'));var config=require(_0x9351('0x5'));var attributes=require(_0x9351('0x6'));module[_0x9351('0x7')]=function(_0xa64e85,_0x518603){return _0xa64e85[_0x9351('0x8')](_0x9351('0x9'),attributes,{'tableName':_0x9351('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 8b8f7bc..da22626 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 _0x0a74=['request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetMailQueue','MailQueue','findAll','options','raw','limit','include','map','model','attributes','ShowMailQueue','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','defaults','redis','socket.io-emitter','./mailQueue.socket','request','then','MailQueue,\x20%s,\x20%s'];(function(_0x13143a,_0x50cf10){var _0x7ad09e=function(_0x3040f4){while(--_0x3040f4){_0x13143a['push'](_0x13143a['shift']());}};_0x7ad09e(++_0x50cf10);}(_0x0a74,0x14f));var _0x40a7=function(_0x84b7f2,_0x3bbc1d){_0x84b7f2=_0x84b7f2-0x0;var _0x52f617=_0x0a74[_0x84b7f2];return _0x52f617;};'use strict';var _=require(_0x40a7('0x0'));var util=require(_0x40a7('0x1'));var moment=require(_0x40a7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x40a7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x40a7('0x4'));var logger=require(_0x40a7('0x5'))('rpc');var config=require(_0x40a7('0x6'));var jayson=require(_0x40a7('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x40a7('0x8')](config[_0x40a7('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x40a7('0xa'))(new Redis(config['redis']));require(_0x40a7('0xb'))['register'](socket);function respondWithRpcPromise(_0x5e1c4e,_0x10e08d,_0x416d94){return new BPromise(function(_0x602289,_0x59d687){return client[_0x40a7('0xc')](_0x5e1c4e,_0x416d94)[_0x40a7('0xd')](function(_0x5bee8e){logger['info'](_0x40a7('0xe'),_0x10e08d,_0x40a7('0xf'));logger[_0x40a7('0x10')](_0x40a7('0x11'),_0x10e08d,_0x40a7('0xf'),JSON[_0x40a7('0x12')](_0x5bee8e));if(_0x5bee8e[_0x40a7('0x13')]){if(_0x5bee8e[_0x40a7('0x13')][_0x40a7('0x14')]===0x1f4){logger[_0x40a7('0x13')]('MailQueue,\x20%s,\x20%s',_0x10e08d,_0x5bee8e[_0x40a7('0x13')][_0x40a7('0x15')]);return _0x59d687(_0x5bee8e[_0x40a7('0x13')]['message']);}logger[_0x40a7('0x13')](_0x40a7('0xe'),_0x10e08d,_0x5bee8e['error'][_0x40a7('0x15')]);return _0x602289(_0x5bee8e['error'][_0x40a7('0x15')]);}else{logger[_0x40a7('0x16')](_0x40a7('0xe'),_0x10e08d,_0x40a7('0xf'));_0x602289(_0x5bee8e['result'][_0x40a7('0x15')]);}})[_0x40a7('0x17')](function(_0x1df022){logger['error'](_0x40a7('0xe'),_0x10e08d,_0x1df022);_0x59d687(_0x1df022);});});}exports[_0x40a7('0x18')]=function(_0x49762d){var _0x2cc6e9=this;return new Promise(function(_0x1d8116,_0x3d7ef6){return db[_0x40a7('0x19')][_0x40a7('0x1a')]({'raw':_0x49762d['options']?_0x49762d[_0x40a7('0x1b')][_0x40a7('0x1c')]===undefined?!![]:![]:!![],'where':_0x49762d[_0x40a7('0x1b')]?_0x49762d[_0x40a7('0x1b')]['where']||null:null,'attributes':_0x49762d['options']?_0x49762d['options']['attributes']||null:null,'limit':_0x49762d['options']?_0x49762d[_0x40a7('0x1b')][_0x40a7('0x1d')]||null:null,'include':_0x49762d[_0x40a7('0x1b')]?_0x49762d[_0x40a7('0x1b')][_0x40a7('0x1e')]?_[_0x40a7('0x1f')](_0x49762d['options']['include'],function(_0x2fcf42){return{'model':db[_0x2fcf42[_0x40a7('0x20')]],'as':_0x2fcf42['as'],'attributes':_0x2fcf42[_0x40a7('0x21')],'include':_0x2fcf42['include']?_[_0x40a7('0x1f')](_0x2fcf42[_0x40a7('0x1e')],function(_0x5a6b28){return{'model':db[_0x5a6b28[_0x40a7('0x20')]],'as':_0x5a6b28['as'],'attributes':_0x5a6b28[_0x40a7('0x21')],'include':_0x5a6b28[_0x40a7('0x1e')]?_[_0x40a7('0x1f')](_0x5a6b28[_0x40a7('0x1e')],function(_0x13cdb7){return{'model':db[_0x13cdb7[_0x40a7('0x20')]],'as':_0x13cdb7['as'],'attributes':_0x13cdb7[_0x40a7('0x21')]};}):[]};}):[]};}):[]:[]})[_0x40a7('0xd')](function(_0x276b55){logger[_0x40a7('0x16')](_0x40a7('0x18'),_0x49762d);logger[_0x40a7('0x10')](_0x40a7('0x18'),_0x49762d,JSON[_0x40a7('0x12')](_0x276b55));_0x1d8116(_0x276b55);})['catch'](function(_0x47d9a3){logger['error'](_0x40a7('0x18'),_0x47d9a3[_0x40a7('0x15')],_0x49762d);_0x3d7ef6(_0x2cc6e9['error'](0x1f4,_0x47d9a3[_0x40a7('0x15')]));});});};exports[_0x40a7('0x22')]=function(_0x2b545b){var _0x4352b9=this;return new Promise(function(_0x108fa9,_0x47c8f2){return db['MailQueue']['find']({'raw':_0x2b545b[_0x40a7('0x1b')]?_0x2b545b[_0x40a7('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2b545b['options']?_0x2b545b['options']['where']||null:null,'attributes':_0x2b545b['options']?_0x2b545b[_0x40a7('0x1b')][_0x40a7('0x21')]||null:null,'include':_0x2b545b[_0x40a7('0x1b')]?_0x2b545b[_0x40a7('0x1b')][_0x40a7('0x1e')]?_[_0x40a7('0x1f')](_0x2b545b[_0x40a7('0x1b')][_0x40a7('0x1e')],function(_0x5b83d3){return{'model':db[_0x5b83d3[_0x40a7('0x20')]],'as':_0x5b83d3['as'],'attributes':_0x5b83d3[_0x40a7('0x21')],'include':_0x5b83d3[_0x40a7('0x1e')]?_['map'](_0x5b83d3[_0x40a7('0x1e')],function(_0x45aa80){return{'model':db[_0x45aa80[_0x40a7('0x20')]],'as':_0x45aa80['as'],'attributes':_0x45aa80['attributes'],'include':_0x45aa80[_0x40a7('0x1e')]?_[_0x40a7('0x1f')](_0x45aa80[_0x40a7('0x1e')],function(_0x1377df){return{'model':db[_0x1377df[_0x40a7('0x20')]],'as':_0x1377df['as'],'attributes':_0x1377df[_0x40a7('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b3ce4){logger[_0x40a7('0x16')]('ShowMailQueue',_0x2b545b);logger['debug'](_0x40a7('0x22'),_0x2b545b,JSON[_0x40a7('0x12')](_0x5b3ce4));_0x108fa9(_0x5b3ce4);})[_0x40a7('0x17')](function(_0x32b3d8){logger[_0x40a7('0x13')](_0x40a7('0x22'),_0x32b3d8[_0x40a7('0x15')],_0x2b545b);_0x47c8f2(_0x4352b9[_0x40a7('0x13')](0x1f4,_0x32b3d8['message']));});});}; \ No newline at end of file +var _0xc468=['http','defaults','redis','socket.io-emitter','./mailQueue.socket','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','GetMailQueue','MailQueue','findAll','options','attributes','include','model','map','ShowMailQueue','find','lodash','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x3f0379,_0xf9a815){var _0x10401a=function(_0x133b58){while(--_0x133b58){_0x3f0379['push'](_0x3f0379['shift']());}};_0x10401a(++_0xf9a815);}(_0xc468,0x85));var _0x8c46=function(_0x626e55,_0x22db76){_0x626e55=_0x626e55-0x0;var _0x3d6b19=_0xc468[_0x626e55];return _0x3d6b19;};'use strict';var _=require(_0x8c46('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c46('0x1'));var db=require(_0x8c46('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c46('0x3'))(_0x8c46('0x4'));var config=require('../../config/environment');var jayson=require(_0x8c46('0x5'));var client=jayson[_0x8c46('0x6')][_0x8c46('0x7')]({'port':0x232a});config['redis']=_[_0x8c46('0x8')](config[_0x8c46('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x8c46('0xa'))(new Redis(config['redis']));require(_0x8c46('0xb'))['register'](socket);function respondWithRpcPromise(_0x4a93ae,_0x4c19fd,_0x2aab67){return new BPromise(function(_0x4d79f8,_0x4c8c87){return client[_0x8c46('0xc')](_0x4a93ae,_0x2aab67)[_0x8c46('0xd')](function(_0x1d1555){logger['info'](_0x8c46('0xe'),_0x4c19fd,_0x8c46('0xf'));logger[_0x8c46('0x10')](_0x8c46('0x11'),_0x4c19fd,_0x8c46('0xf'),JSON[_0x8c46('0x12')](_0x1d1555));if(_0x1d1555['error']){if(_0x1d1555['error'][_0x8c46('0x13')]===0x1f4){logger[_0x8c46('0x14')](_0x8c46('0xe'),_0x4c19fd,_0x1d1555['error'][_0x8c46('0x15')]);return _0x4c8c87(_0x1d1555[_0x8c46('0x14')][_0x8c46('0x15')]);}logger['error'](_0x8c46('0xe'),_0x4c19fd,_0x1d1555[_0x8c46('0x14')]['message']);return _0x4d79f8(_0x1d1555[_0x8c46('0x14')][_0x8c46('0x15')]);}else{logger[_0x8c46('0x16')](_0x8c46('0xe'),_0x4c19fd,_0x8c46('0xf'));_0x4d79f8(_0x1d1555[_0x8c46('0x17')][_0x8c46('0x15')]);}})[_0x8c46('0x18')](function(_0x15ab2c){logger['error']('MailQueue,\x20%s,\x20%s',_0x4c19fd,_0x15ab2c);_0x4c8c87(_0x15ab2c);});});}exports[_0x8c46('0x19')]=function(_0x21db0b){var _0x15d7fb=this;return new Promise(function(_0x1caec0,_0x316cb9){return db[_0x8c46('0x1a')][_0x8c46('0x1b')]({'raw':_0x21db0b['options']?_0x21db0b['options']['raw']===undefined?!![]:![]:!![],'where':_0x21db0b[_0x8c46('0x1c')]?_0x21db0b['options']['where']||null:null,'attributes':_0x21db0b[_0x8c46('0x1c')]?_0x21db0b['options'][_0x8c46('0x1d')]||null:null,'limit':_0x21db0b[_0x8c46('0x1c')]?_0x21db0b[_0x8c46('0x1c')]['limit']||null:null,'include':_0x21db0b[_0x8c46('0x1c')]?_0x21db0b[_0x8c46('0x1c')][_0x8c46('0x1e')]?_['map'](_0x21db0b['options'][_0x8c46('0x1e')],function(_0x8672f0){return{'model':db[_0x8672f0[_0x8c46('0x1f')]],'as':_0x8672f0['as'],'attributes':_0x8672f0[_0x8c46('0x1d')],'include':_0x8672f0[_0x8c46('0x1e')]?_[_0x8c46('0x20')](_0x8672f0[_0x8c46('0x1e')],function(_0x4f3969){return{'model':db[_0x4f3969['model']],'as':_0x4f3969['as'],'attributes':_0x4f3969[_0x8c46('0x1d')],'include':_0x4f3969['include']?_[_0x8c46('0x20')](_0x4f3969[_0x8c46('0x1e')],function(_0x200ecb){return{'model':db[_0x200ecb[_0x8c46('0x1f')]],'as':_0x200ecb['as'],'attributes':_0x200ecb[_0x8c46('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8c46('0xd')](function(_0x3655a6){logger[_0x8c46('0x16')](_0x8c46('0x19'),_0x21db0b);logger[_0x8c46('0x10')](_0x8c46('0x19'),_0x21db0b,JSON[_0x8c46('0x12')](_0x3655a6));_0x1caec0(_0x3655a6);})[_0x8c46('0x18')](function(_0x313f31){logger[_0x8c46('0x14')](_0x8c46('0x19'),_0x313f31[_0x8c46('0x15')],_0x21db0b);_0x316cb9(_0x15d7fb['error'](0x1f4,_0x313f31[_0x8c46('0x15')]));});});};exports[_0x8c46('0x21')]=function(_0x1ae4e4){var _0x3f29ea=this;return new Promise(function(_0x76c33a,_0x3d55c5){return db[_0x8c46('0x1a')][_0x8c46('0x22')]({'raw':_0x1ae4e4[_0x8c46('0x1c')]?_0x1ae4e4[_0x8c46('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1ae4e4[_0x8c46('0x1c')]?_0x1ae4e4['options']['where']||null:null,'attributes':_0x1ae4e4[_0x8c46('0x1c')]?_0x1ae4e4['options'][_0x8c46('0x1d')]||null:null,'include':_0x1ae4e4['options']?_0x1ae4e4[_0x8c46('0x1c')][_0x8c46('0x1e')]?_[_0x8c46('0x20')](_0x1ae4e4[_0x8c46('0x1c')]['include'],function(_0x522935){return{'model':db[_0x522935[_0x8c46('0x1f')]],'as':_0x522935['as'],'attributes':_0x522935[_0x8c46('0x1d')],'include':_0x522935[_0x8c46('0x1e')]?_[_0x8c46('0x20')](_0x522935['include'],function(_0x3a08c9){return{'model':db[_0x3a08c9['model']],'as':_0x3a08c9['as'],'attributes':_0x3a08c9[_0x8c46('0x1d')],'include':_0x3a08c9[_0x8c46('0x1e')]?_[_0x8c46('0x20')](_0x3a08c9[_0x8c46('0x1e')],function(_0x48e352){return{'model':db[_0x48e352[_0x8c46('0x1f')]],'as':_0x48e352['as'],'attributes':_0x48e352[_0x8c46('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8c46('0xd')](function(_0x4d3a3a){logger['info'](_0x8c46('0x21'),_0x1ae4e4);logger['debug'](_0x8c46('0x21'),_0x1ae4e4,JSON[_0x8c46('0x12')](_0x4d3a3a));_0x76c33a(_0x4d3a3a);})[_0x8c46('0x18')](function(_0x58d8bf){logger['error'](_0x8c46('0x21'),_0x58d8bf[_0x8c46('0x15')],_0x1ae4e4);_0x3d55c5(_0x3f29ea[_0x8c46('0x14')](0x1f4,_0x58d8bf[_0x8c46('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index e2cebb4..d7183dd 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 _0x8877=['update','emit','removeListener','length','mailQueue:','save','remove'];(function(_0x49d67d,_0x5e0369){var _0x58ba22=function(_0x1dddaa){while(--_0x1dddaa){_0x49d67d['push'](_0x49d67d['shift']());}};_0x58ba22(++_0x5e0369);}(_0x8877,0xf3));var _0x7887=function(_0x3823a8,_0x46543c){_0x3823a8=_0x3823a8-0x0;var _0x197333=_0x8877[_0x3823a8];return _0x197333;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x7887('0x0'),_0x7887('0x1'),_0x7887('0x2')];function createListener(_0x58d8ac,_0x26f1a8){return function(_0x59035c){_0x26f1a8[_0x7887('0x3')](_0x58d8ac,_0x59035c);};}function removeListener(_0xd578c7,_0x7b93d){return function(){MailQueueEvents[_0x7887('0x4')](_0xd578c7,_0x7b93d);};}exports['register']=function(_0x21e954){for(var _0x3b31d3=0x0,_0x1b8e60=events[_0x7887('0x5')];_0x3b31d3<_0x1b8e60;_0x3b31d3++){var _0x1a8eec=events[_0x3b31d3];var _0x550bed=createListener(_0x7887('0x6')+_0x1a8eec,_0x21e954);MailQueueEvents['on'](_0x1a8eec,_0x550bed);}}; \ No newline at end of file +var _0xbddb=['./mailQueue.events','save','remove','update','emit','removeListener','register','length','mailQueue:'];(function(_0xd3aed9,_0x38e8d8){var _0x65f671=function(_0xaa2b06){while(--_0xaa2b06){_0xd3aed9['push'](_0xd3aed9['shift']());}};_0x65f671(++_0x38e8d8);}(_0xbddb,0x18c));var _0xbbdd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbddb[_0x2641f9];return _0x585741;};'use strict';var MailQueueEvents=require(_0xbbdd('0x0'));var events=[_0xbbdd('0x1'),_0xbbdd('0x2'),_0xbbdd('0x3')];function createListener(_0x54510e,_0x13aac6){return function(_0x432602){_0x13aac6[_0xbbdd('0x4')](_0x54510e,_0x432602);};}function removeListener(_0x5cb753,_0x3dbced){return function(){MailQueueEvents[_0xbbdd('0x5')](_0x5cb753,_0x3dbced);};}exports[_0xbbdd('0x6')]=function(_0x37b72d){for(var _0x4201df=0x0,_0x2d88c5=events[_0xbbdd('0x7')];_0x4201df<_0x2d88c5;_0x4201df++){var _0x1a021a=events[_0x4201df];var _0x17cf7b=createListener(_0xbbdd('0x8')+_0x1a021a,_0x37b72d);MailQueueEvents['on'](_0x1a021a,_0x17cf7b);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index dc99356..324fd5b 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 _0x36aa=['show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','/describe','/:id'];(function(_0x2a59a8,_0x34cf09){var _0x231cef=function(_0x20e377){while(--_0x20e377){_0x2a59a8['push'](_0x2a59a8['shift']());}};_0x231cef(++_0x34cf09);}(_0x36aa,0x170));var _0xa36a=function(_0x377da9,_0x5443c8){_0x377da9=_0x377da9-0x0;var _0x52d210=_0x36aa[_0x377da9];return _0x52d210;};'use strict';var multer=require(_0xa36a('0x0'));var util=require('util');var path=require(_0xa36a('0x1'));var timeout=require(_0xa36a('0x2'));var express=require(_0xa36a('0x3'));var router=express[_0xa36a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa36a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0xa36a('0x6')]('/',auth[_0xa36a('0x7')](),controller['index']);router['get'](_0xa36a('0x8'),auth[_0xa36a('0x7')](),controller['describe']);router[_0xa36a('0x6')](_0xa36a('0x9'),auth[_0xa36a('0x7')](),controller[_0xa36a('0xa')]);router[_0xa36a('0xb')]('/',auth[_0xa36a('0x7')](),controller[_0xa36a('0xc')]);router[_0xa36a('0xd')](_0xa36a('0x9'),auth[_0xa36a('0x7')](),controller[_0xa36a('0xe')]);router[_0xa36a('0xf')](_0xa36a('0x9'),auth['isAuthenticated'](),controller[_0xa36a('0x10')]);module[_0xa36a('0x11')]=router; \ No newline at end of file +var _0x98fc=['multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','destroy','exports'];(function(_0x41582d,_0x291b1c){var _0x59c504=function(_0x4d967e){while(--_0x4d967e){_0x41582d['push'](_0x41582d['shift']());}};_0x59c504(++_0x291b1c);}(_0x98fc,0x156));var _0xc98f=function(_0x1e8461,_0x5e1500){_0x1e8461=_0x1e8461-0x0;var _0x528f4d=_0x98fc[_0x1e8461];return _0x528f4d;};'use strict';var multer=require(_0xc98f('0x0'));var util=require(_0xc98f('0x1'));var path=require(_0xc98f('0x2'));var timeout=require(_0xc98f('0x3'));var express=require(_0xc98f('0x4'));var router=express['Router']();var fs_extra=require(_0xc98f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc98f('0x6'));var config=require('../../config/environment');var controller=require(_0xc98f('0x7'));router[_0xc98f('0x8')]('/',auth[_0xc98f('0x9')](),controller[_0xc98f('0xa')]);router[_0xc98f('0x8')](_0xc98f('0xb'),auth[_0xc98f('0x9')](),controller[_0xc98f('0xc')]);router[_0xc98f('0x8')](_0xc98f('0xd'),auth['isAuthenticated'](),controller[_0xc98f('0xe')]);router['post']('/',auth[_0xc98f('0x9')](),controller[_0xc98f('0xf')]);router[_0xc98f('0x10')](_0xc98f('0xd'),auth[_0xc98f('0x9')](),controller['update']);router['delete'](_0xc98f('0xd'),auth[_0xc98f('0x9')](),controller[_0xc98f('0x11')]);module[_0xc98f('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 1b80705..c502779 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 _0xaf39=['DATE','moment','STRING'];(function(_0x13b442,_0x448c33){var _0x49d09c=function(_0x477277){while(--_0x477277){_0x13b442['push'](_0x13b442['shift']());}};_0x49d09c(++_0x448c33);}(_0xaf39,0x1de));var _0x9af3=function(_0x4e8022,_0x53229d){_0x4e8022=_0x4e8022-0x0;var _0xf5e73f=_0xaf39[_0x4e8022];return _0xf5e73f;};'use strict';var moment=require(_0x9af3('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x9af3('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x9af3('0x1')]},'joinAt':{'type':Sequelize[_0x9af3('0x2')]},'leaveAt':{'type':Sequelize[_0x9af3('0x2')]},'acceptAt':{'type':Sequelize[_0x9af3('0x2')]},'exitAt':{'type':Sequelize[_0x9af3('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc942=['moment','sequelize','exports','STRING','DATE'];(function(_0x264333,_0x5aff23){var _0x21cd20=function(_0x38e70b){while(--_0x38e70b){_0x264333['push'](_0x264333['shift']());}};_0x21cd20(++_0x5aff23);}(_0xc942,0x109));var _0x2c94=function(_0x2f3fc9,_0x4b5e2f){_0x2f3fc9=_0x2f3fc9-0x0;var _0x9eb26d=_0xc942[_0x2f3fc9];return _0x9eb26d;};'use strict';var moment=require(_0x2c94('0x0'));var Sequelize=require(_0x2c94('0x1'));module[_0x2c94('0x2')]={'uniqueid':{'type':Sequelize[_0x2c94('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x2c94('0x3')]},'joinAt':{'type':Sequelize[_0x2c94('0x4')]},'leaveAt':{'type':Sequelize[_0x2c94('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 3fa8b9d..ceb5b4e 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 _0xb3a9=['then','destroy','end','error','name','send','index','MailQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','filter','merge','where','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb3a9,0x157));var _0x9b3a=function(_0x152424,_0x8edca2){_0x152424=_0x152424-0x0;var _0x262328=_0xb3a9[_0x152424];return _0x262328;};'use strict';var emlformat=require(_0x9b3a('0x0'));var rimraf=require(_0x9b3a('0x1'));var zipdir=require(_0x9b3a('0x2'));var jsonpatch=require(_0x9b3a('0x3'));var rp=require(_0x9b3a('0x4'));var moment=require(_0x9b3a('0x5'));var BPromise=require(_0x9b3a('0x6'));var Mustache=require(_0x9b3a('0x7'));var util=require('util');var path=require(_0x9b3a('0x8'));var sox=require(_0x9b3a('0x9'));var csv=require(_0x9b3a('0xa'));var ejs=require(_0x9b3a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b3a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9b3a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9b3a('0xe'));var Papa=require(_0x9b3a('0xf'));var Redis=require(_0x9b3a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9b3a('0x11'));var as=require(_0x9b3a('0x12'));var hardwareService=require(_0x9b3a('0x13'));var logger=require(_0x9b3a('0x14'))(_0x9b3a('0x15'));var utils=require(_0x9b3a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9b3a('0x17'))['db'];function respondWithStatusCode(_0x7a354,_0x21445c){_0x21445c=_0x21445c||0xcc;return function(_0x429680){if(_0x429680){return _0x7a354[_0x9b3a('0x18')](_0x21445c);}return _0x7a354[_0x9b3a('0x19')](_0x21445c)['end']();};}function respondWithResult(_0x227094,_0x43c090){_0x43c090=_0x43c090||0xc8;return function(_0x2fd5c0){if(_0x2fd5c0){return _0x227094['status'](_0x43c090)[_0x9b3a('0x1a')](_0x2fd5c0);}};}function respondWithFilteredResult(_0x4cc14a,_0x38d2a3){return function(_0x23b7e4){if(_0x23b7e4){var _0x2bf80d=typeof _0x38d2a3['offset']===_0x9b3a('0x1b')&&typeof _0x38d2a3[_0x9b3a('0x1c')]===_0x9b3a('0x1b');var _0x42a3bf=_0x23b7e4[_0x9b3a('0x1d')];var _0x2253f5=_0x2bf80d?0x0:_0x38d2a3[_0x9b3a('0x1e')];var _0x4659ff=_0x2bf80d?_0x23b7e4[_0x9b3a('0x1d')]:_0x38d2a3['offset']+_0x38d2a3[_0x9b3a('0x1c')];var _0x80b95f;if(_0x4659ff>=_0x42a3bf){_0x4659ff=_0x42a3bf;_0x80b95f=0xc8;}else{_0x80b95f=0xce;}_0x4cc14a[_0x9b3a('0x19')](_0x80b95f);return _0x4cc14a[_0x9b3a('0x1f')](_0x9b3a('0x20'),_0x2253f5+'-'+_0x4659ff+'/'+_0x42a3bf)[_0x9b3a('0x1a')](_0x23b7e4);}return null;};}function patchUpdates(_0x117d35){return function(_0x584dc8){try{jsonpatch[_0x9b3a('0x21')](_0x584dc8,_0x117d35,!![]);}catch(_0x2025b8){return BPromise[_0x9b3a('0x22')](_0x2025b8);}return _0x584dc8[_0x9b3a('0x23')]();};}function saveUpdates(_0x22923e,_0x476abc){return function(_0x5bccf5){if(_0x5bccf5){return _0x5bccf5[_0x9b3a('0x24')](_0x22923e)[_0x9b3a('0x25')](function(_0x38e4ba){return _0x38e4ba;});}return null;};}function removeEntity(_0x99f3b7,_0x388bc7){return function(_0x45d313){if(_0x45d313){return _0x45d313[_0x9b3a('0x26')]()[_0x9b3a('0x25')](function(){_0x99f3b7[_0x9b3a('0x19')](0xcc)[_0x9b3a('0x27')]();});}};}function handleEntityNotFound(_0x4a3eaa,_0x34165f){return function(_0xfad462){if(!_0xfad462){_0x4a3eaa[_0x9b3a('0x18')](0x194);}return _0xfad462;};}function handleError(_0x566806,_0x420a76){_0x420a76=_0x420a76||0x1f4;return function(_0x3ec7f3){logger[_0x9b3a('0x28')](_0x3ec7f3['stack']);if(_0x3ec7f3[_0x9b3a('0x29')]){delete _0x3ec7f3[_0x9b3a('0x29')];}_0x566806[_0x9b3a('0x19')](_0x420a76)[_0x9b3a('0x2a')](_0x3ec7f3);};}exports[_0x9b3a('0x2b')]=function(_0x3a15ab,_0x89d9cb){var _0x3b2011={},_0x5b1c76={},_0x19aa2e={'count':0x0,'rows':[]};var _0x608600=_['map'](db[_0x9b3a('0x2c')][_0x9b3a('0x2d')],function(_0x55363b){return{'name':_0x55363b['fieldName'],'type':_0x55363b[_0x9b3a('0x2e')][_0x9b3a('0x2f')]};});_0x5b1c76[_0x9b3a('0x30')]=_['map'](_0x608600,'name');_0x5b1c76[_0x9b3a('0x31')]=_[_0x9b3a('0x32')](_0x3a15ab[_0x9b3a('0x31')]);_0x5b1c76[_0x9b3a('0x33')]=_[_0x9b3a('0x34')](_0x5b1c76['model'],_0x5b1c76['query']);_0x3b2011['attributes']=_[_0x9b3a('0x34')](_0x5b1c76[_0x9b3a('0x30')],qs[_0x9b3a('0x35')](_0x3a15ab[_0x9b3a('0x31')][_0x9b3a('0x35')]));_0x3b2011[_0x9b3a('0x36')]=_0x3b2011['attributes'][_0x9b3a('0x37')]?_0x3b2011['attributes']:_0x5b1c76[_0x9b3a('0x30')];if(!_0x3a15ab[_0x9b3a('0x31')]['hasOwnProperty'](_0x9b3a('0x38'))){_0x3b2011['limit']=qs[_0x9b3a('0x1c')](_0x3a15ab['query'][_0x9b3a('0x1c')]);_0x3b2011[_0x9b3a('0x1e')]=qs['offset'](_0x3a15ab[_0x9b3a('0x31')][_0x9b3a('0x1e')]);}_0x3b2011[_0x9b3a('0x39')]=qs[_0x9b3a('0x3a')](_0x3a15ab['query']['sort']);_0x3b2011['where']=qs['filters'](_['pick'](_0x3a15ab['query'],_0x5b1c76[_0x9b3a('0x33')]),_0x608600);if(_0x3a15ab['query'][_0x9b3a('0x3b')]){_0x3b2011['where']=_[_0x9b3a('0x3c')](_0x3b2011[_0x9b3a('0x3d')],{'$or':_[_0x9b3a('0x3e')](_0x608600,function(_0x1bc6f4){if(_0x1bc6f4['type']!==_0x9b3a('0x3f')){var _0x4e5356={};_0x4e5356[_0x1bc6f4[_0x9b3a('0x29')]]={'$like':'%'+_0x3a15ab[_0x9b3a('0x31')][_0x9b3a('0x3b')]+'%'};return _0x4e5356;}})});}_0x3b2011=_[_0x9b3a('0x3c')]({},_0x3b2011,_0x3a15ab[_0x9b3a('0x40')]);var _0x19f4ab={'where':_0x3b2011[_0x9b3a('0x3d')]};return db[_0x9b3a('0x2c')][_0x9b3a('0x1d')](_0x19f4ab)['then'](function(_0x4e0c32){_0x19aa2e['count']=_0x4e0c32;if(_0x3a15ab['query'][_0x9b3a('0x41')]){_0x3b2011['include']=[{'all':!![]}];}return db[_0x9b3a('0x2c')][_0x9b3a('0x42')](_0x3b2011);})[_0x9b3a('0x25')](function(_0x4c1afe){_0x19aa2e[_0x9b3a('0x43')]=_0x4c1afe;return _0x19aa2e;})[_0x9b3a('0x25')](respondWithFilteredResult(_0x89d9cb,_0x3b2011))[_0x9b3a('0x44')](handleError(_0x89d9cb,null));};exports[_0x9b3a('0x45')]=function(_0x17e7e6,_0x3ac2d3){var _0x46329a={'raw':!![],'where':{'id':_0x17e7e6['params']['id']}},_0x1a5cf9={};_0x1a5cf9['model']=_[_0x9b3a('0x32')](db[_0x9b3a('0x2c')][_0x9b3a('0x2d')]);_0x1a5cf9[_0x9b3a('0x31')]=_[_0x9b3a('0x32')](_0x17e7e6['query']);_0x1a5cf9[_0x9b3a('0x33')]=_[_0x9b3a('0x34')](_0x1a5cf9[_0x9b3a('0x30')],_0x1a5cf9[_0x9b3a('0x31')]);_0x46329a[_0x9b3a('0x36')]=_[_0x9b3a('0x34')](_0x1a5cf9[_0x9b3a('0x30')],qs[_0x9b3a('0x35')](_0x17e7e6['query'][_0x9b3a('0x35')]));_0x46329a['attributes']=_0x46329a[_0x9b3a('0x36')][_0x9b3a('0x37')]?_0x46329a[_0x9b3a('0x36')]:_0x1a5cf9['model'];if(_0x17e7e6[_0x9b3a('0x31')][_0x9b3a('0x41')]){_0x46329a[_0x9b3a('0x46')]=[{'all':!![]}];}_0x46329a=_[_0x9b3a('0x3c')]({},_0x46329a,_0x17e7e6['options']);return db[_0x9b3a('0x2c')][_0x9b3a('0x47')](_0x46329a)[_0x9b3a('0x25')](handleEntityNotFound(_0x3ac2d3,null))['then'](respondWithResult(_0x3ac2d3,null))['catch'](handleError(_0x3ac2d3,null));};exports['create']=function(_0x245e13,_0x40b8b4){return db[_0x9b3a('0x2c')][_0x9b3a('0x48')](_0x245e13[_0x9b3a('0x49')],{})['then'](respondWithResult(_0x40b8b4,0xc9))[_0x9b3a('0x44')](handleError(_0x40b8b4,null));};exports[_0x9b3a('0x24')]=function(_0x4aebfc,_0x2aad1e){if(_0x4aebfc[_0x9b3a('0x49')]['id']){delete _0x4aebfc['body']['id'];}return db['MailQueueReport'][_0x9b3a('0x47')]({'where':{'id':_0x4aebfc[_0x9b3a('0x4a')]['id']}})[_0x9b3a('0x25')](handleEntityNotFound(_0x2aad1e,null))[_0x9b3a('0x25')](saveUpdates(_0x4aebfc[_0x9b3a('0x49')],null))[_0x9b3a('0x25')](respondWithResult(_0x2aad1e,null))[_0x9b3a('0x44')](handleError(_0x2aad1e,null));};exports[_0x9b3a('0x26')]=function(_0x43cc6f,_0x343d01){return db[_0x9b3a('0x2c')][_0x9b3a('0x47')]({'where':{'id':_0x43cc6f[_0x9b3a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x343d01,null))[_0x9b3a('0x25')](removeEntity(_0x343d01,null))[_0x9b3a('0x44')](handleError(_0x343d01,null));};exports[_0x9b3a('0x4b')]=function(_0x296954,_0x1530d0){return db[_0x9b3a('0x2c')]['describe']()[_0x9b3a('0x25')](respondWithResult(_0x1530d0,null))[_0x9b3a('0x44')](handleError(_0x1530d0,null));}; \ No newline at end of file +var _0xe57e=['undefined','count','offset','status','set','Content-Range','apply','save','then','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','query','keys','intersection','length','attributes','hasOwnProperty','nolimit','order','sort','filters','merge','map','type','filter','options','includeAll','MailQueueReport','rows','catch','show','fields','include','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','sendStatus','end','json','limit'];(function(_0x2f67b1,_0x5c953e){var _0x59b080=function(_0x1e3522){while(--_0x1e3522){_0x2f67b1['push'](_0x2f67b1['shift']());}};_0x59b080(++_0x5c953e);}(_0xe57e,0x100));var _0xee57=function(_0x1e95c9,_0x245c92){_0x1e95c9=_0x1e95c9-0x0;var _0x3c7179=_0xe57e[_0x1e95c9];return _0x3c7179;};'use strict';var emlformat=require(_0xee57('0x0'));var rimraf=require(_0xee57('0x1'));var zipdir=require(_0xee57('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xee57('0x3'));var BPromise=require(_0xee57('0x4'));var Mustache=require(_0xee57('0x5'));var util=require('util');var path=require(_0xee57('0x6'));var sox=require(_0xee57('0x7'));var csv=require('to-csv');var ejs=require(_0xee57('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xee57('0x9'));var jsforce=require(_0xee57('0xa'));var deskjs=require(_0xee57('0xb'));var toCsv=require(_0xee57('0xc'));var querystring=require(_0xee57('0xd'));var Papa=require(_0xee57('0xe'));var Redis=require(_0xee57('0xf'));var authService=require(_0xee57('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xee57('0x11'));var hardwareService=require(_0xee57('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xee57('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4371b3,_0x240df5){_0x240df5=_0x240df5||0xcc;return function(_0x28e707){if(_0x28e707){return _0x4371b3[_0xee57('0x14')](_0x240df5);}return _0x4371b3['status'](_0x240df5)[_0xee57('0x15')]();};}function respondWithResult(_0xcb85c7,_0x35a37b){_0x35a37b=_0x35a37b||0xc8;return function(_0x1c2bc6){if(_0x1c2bc6){return _0xcb85c7['status'](_0x35a37b)[_0xee57('0x16')](_0x1c2bc6);}};}function respondWithFilteredResult(_0x521b96,_0x120c45){return function(_0x5b43ec){if(_0x5b43ec){var _0x19a68b=typeof _0x120c45['offset']==='undefined'&&typeof _0x120c45[_0xee57('0x17')]===_0xee57('0x18');var _0x400907=_0x5b43ec['count'];var _0x1ec268=_0x19a68b?0x0:_0x120c45['offset'];var _0x1f8750=_0x19a68b?_0x5b43ec[_0xee57('0x19')]:_0x120c45[_0xee57('0x1a')]+_0x120c45[_0xee57('0x17')];var _0x24de40;if(_0x1f8750>=_0x400907){_0x1f8750=_0x400907;_0x24de40=0xc8;}else{_0x24de40=0xce;}_0x521b96[_0xee57('0x1b')](_0x24de40);return _0x521b96[_0xee57('0x1c')](_0xee57('0x1d'),_0x1ec268+'-'+_0x1f8750+'/'+_0x400907)[_0xee57('0x16')](_0x5b43ec);}return null;};}function patchUpdates(_0x34b637){return function(_0x44eac1){try{jsonpatch[_0xee57('0x1e')](_0x44eac1,_0x34b637,!![]);}catch(_0x124537){return BPromise['reject'](_0x124537);}return _0x44eac1[_0xee57('0x1f')]();};}function saveUpdates(_0x25e4e3,_0xde1779){return function(_0xa8e808){if(_0xa8e808){return _0xa8e808['update'](_0x25e4e3)[_0xee57('0x20')](function(_0x376a25){return _0x376a25;});}return null;};}function removeEntity(_0x5164f8,_0x2b33cf){return function(_0xdfc315){if(_0xdfc315){return _0xdfc315[_0xee57('0x21')]()[_0xee57('0x20')](function(){_0x5164f8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x37b0d2,_0x476b92){return function(_0x4212c1){if(!_0x4212c1){_0x37b0d2[_0xee57('0x14')](0x194);}return _0x4212c1;};}function handleError(_0x425b1e,_0x2d07c1){_0x2d07c1=_0x2d07c1||0x1f4;return function(_0x15ab94){logger[_0xee57('0x22')](_0x15ab94[_0xee57('0x23')]);if(_0x15ab94[_0xee57('0x24')]){delete _0x15ab94[_0xee57('0x24')];}_0x425b1e['status'](_0x2d07c1)[_0xee57('0x25')](_0x15ab94);};}exports['index']=function(_0x3eea21,_0xa6e051){var _0x2d848a={},_0x4f3ef2={},_0x535d36={'count':0x0,'rows':[]};var _0x48d5ec=_['map'](db['MailQueueReport'][_0xee57('0x26')],function(_0x106740){return{'name':_0x106740[_0xee57('0x27')],'type':_0x106740['type'][_0xee57('0x28')]};});_0x4f3ef2[_0xee57('0x29')]=_['map'](_0x48d5ec,_0xee57('0x24'));_0x4f3ef2[_0xee57('0x2a')]=_[_0xee57('0x2b')](_0x3eea21[_0xee57('0x2a')]);_0x4f3ef2['filters']=_[_0xee57('0x2c')](_0x4f3ef2[_0xee57('0x29')],_0x4f3ef2[_0xee57('0x2a')]);_0x2d848a['attributes']=_[_0xee57('0x2c')](_0x4f3ef2[_0xee57('0x29')],qs['fields'](_0x3eea21[_0xee57('0x2a')]['fields']));_0x2d848a['attributes']=_0x2d848a['attributes'][_0xee57('0x2d')]?_0x2d848a[_0xee57('0x2e')]:_0x4f3ef2[_0xee57('0x29')];if(!_0x3eea21[_0xee57('0x2a')][_0xee57('0x2f')](_0xee57('0x30'))){_0x2d848a[_0xee57('0x17')]=qs[_0xee57('0x17')](_0x3eea21[_0xee57('0x2a')][_0xee57('0x17')]);_0x2d848a[_0xee57('0x1a')]=qs[_0xee57('0x1a')](_0x3eea21[_0xee57('0x2a')]['offset']);}_0x2d848a[_0xee57('0x31')]=qs[_0xee57('0x32')](_0x3eea21[_0xee57('0x2a')][_0xee57('0x32')]);_0x2d848a['where']=qs[_0xee57('0x33')](_['pick'](_0x3eea21[_0xee57('0x2a')],_0x4f3ef2['filters']),_0x48d5ec);if(_0x3eea21[_0xee57('0x2a')]['filter']){_0x2d848a['where']=_[_0xee57('0x34')](_0x2d848a['where'],{'$or':_[_0xee57('0x35')](_0x48d5ec,function(_0xbb8981){if(_0xbb8981[_0xee57('0x36')]!=='VIRTUAL'){var _0x322216={};_0x322216[_0xbb8981[_0xee57('0x24')]]={'$like':'%'+_0x3eea21[_0xee57('0x2a')][_0xee57('0x37')]+'%'};return _0x322216;}})});}_0x2d848a=_[_0xee57('0x34')]({},_0x2d848a,_0x3eea21[_0xee57('0x38')]);var _0x26cd5d={'where':_0x2d848a['where']};return db['MailQueueReport'][_0xee57('0x19')](_0x26cd5d)['then'](function(_0x145422){_0x535d36[_0xee57('0x19')]=_0x145422;if(_0x3eea21[_0xee57('0x2a')][_0xee57('0x39')]){_0x2d848a['include']=[{'all':!![]}];}return db[_0xee57('0x3a')]['findAll'](_0x2d848a);})[_0xee57('0x20')](function(_0x1cbfd0){_0x535d36[_0xee57('0x3b')]=_0x1cbfd0;return _0x535d36;})[_0xee57('0x20')](respondWithFilteredResult(_0xa6e051,_0x2d848a))[_0xee57('0x3c')](handleError(_0xa6e051,null));};exports[_0xee57('0x3d')]=function(_0x2e5619,_0x125a1e){var _0x3b371a={'raw':!![],'where':{'id':_0x2e5619['params']['id']}},_0x8d0d5d={};_0x8d0d5d[_0xee57('0x29')]=_[_0xee57('0x2b')](db[_0xee57('0x3a')]['rawAttributes']);_0x8d0d5d[_0xee57('0x2a')]=_[_0xee57('0x2b')](_0x2e5619['query']);_0x8d0d5d[_0xee57('0x33')]=_[_0xee57('0x2c')](_0x8d0d5d[_0xee57('0x29')],_0x8d0d5d[_0xee57('0x2a')]);_0x3b371a['attributes']=_['intersection'](_0x8d0d5d['model'],qs[_0xee57('0x3e')](_0x2e5619[_0xee57('0x2a')]['fields']));_0x3b371a[_0xee57('0x2e')]=_0x3b371a['attributes'][_0xee57('0x2d')]?_0x3b371a['attributes']:_0x8d0d5d[_0xee57('0x29')];if(_0x2e5619[_0xee57('0x2a')][_0xee57('0x39')]){_0x3b371a[_0xee57('0x3f')]=[{'all':!![]}];}_0x3b371a=_[_0xee57('0x34')]({},_0x3b371a,_0x2e5619[_0xee57('0x38')]);return db[_0xee57('0x3a')][_0xee57('0x40')](_0x3b371a)[_0xee57('0x20')](handleEntityNotFound(_0x125a1e,null))[_0xee57('0x20')](respondWithResult(_0x125a1e,null))[_0xee57('0x3c')](handleError(_0x125a1e,null));};exports['create']=function(_0x31a994,_0x515ada){return db[_0xee57('0x3a')][_0xee57('0x41')](_0x31a994[_0xee57('0x42')],{})[_0xee57('0x20')](respondWithResult(_0x515ada,0xc9))[_0xee57('0x3c')](handleError(_0x515ada,null));};exports[_0xee57('0x43')]=function(_0x2bf296,_0x1ba66a){if(_0x2bf296[_0xee57('0x42')]['id']){delete _0x2bf296['body']['id'];}return db[_0xee57('0x3a')][_0xee57('0x40')]({'where':{'id':_0x2bf296[_0xee57('0x44')]['id']}})[_0xee57('0x20')](handleEntityNotFound(_0x1ba66a,null))[_0xee57('0x20')](saveUpdates(_0x2bf296['body'],null))['then'](respondWithResult(_0x1ba66a,null))[_0xee57('0x3c')](handleError(_0x1ba66a,null));};exports[_0xee57('0x21')]=function(_0x1d361b,_0x59e4c0){return db['MailQueueReport'][_0xee57('0x40')]({'where':{'id':_0x1d361b[_0xee57('0x44')]['id']}})[_0xee57('0x20')](handleEntityNotFound(_0x59e4c0,null))[_0xee57('0x20')](removeEntity(_0x59e4c0,null))['catch'](handleError(_0x59e4c0,null));};exports[_0xee57('0x45')]=function(_0x1de767,_0x37a6bd){return db['MailQueueReport'][_0xee57('0x45')]()['then'](respondWithResult(_0x37a6bd,null))[_0xee57('0x3c')](handleError(_0x37a6bd,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 8abfcd6..eab1f75 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 _0x6bc1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','uniqueid'];(function(_0x5029c2,_0x3c866b){var _0xb887cb=function(_0x495068){while(--_0x495068){_0x5029c2['push'](_0x5029c2['shift']());}};_0xb887cb(++_0x3c866b);}(_0x6bc1,0x12b));var _0x16bc=function(_0x46bf38,_0x5a1a0a){_0x46bf38=_0x46bf38-0x0;var _0x59a235=_0x6bc1[_0x46bf38];return _0x59a235;};'use strict';var _=require(_0x16bc('0x0'));var util=require(_0x16bc('0x1'));var logger=require(_0x16bc('0x2'))(_0x16bc('0x3'));var moment=require(_0x16bc('0x4'));var BPromise=require(_0x16bc('0x5'));var rp=require(_0x16bc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x16bc('0x7'));var config=require(_0x16bc('0x8'));var attributes=require(_0x16bc('0x9'));module['exports']=function(_0xc92a35,_0x5203d9){return _0xc92a35[_0x16bc('0xa')](_0x16bc('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x16bc('0xc'),'fields':[_0x16bc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb072=['../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x1cef68,_0x1b4426){var _0x283998=function(_0x378992){while(--_0x378992){_0x1cef68['push'](_0x1cef68['shift']());}};_0x283998(++_0x1b4426);}(_0xb072,0x1cd));var _0x2b07=function(_0x424bfb,_0x123b8e){_0x424bfb=_0x424bfb-0x0;var _0x4bf457=_0xb072[_0x424bfb];return _0x4bf457;};'use strict';var _=require(_0x2b07('0x0'));var util=require(_0x2b07('0x1'));var logger=require('../../config/logger')(_0x2b07('0x2'));var moment=require(_0x2b07('0x3'));var BPromise=require(_0x2b07('0x4'));var rp=require(_0x2b07('0x5'));var fs=require('fs');var path=require(_0x2b07('0x6'));var rimraf=require('rimraf');var config=require(_0x2b07('0x7'));var attributes=require(_0x2b07('0x8'));module['exports']=function(_0xff0c60,_0x3ea0ea){return _0xff0c60[_0x2b07('0x9')](_0x2b07('0xa'),attributes,{'tableName':_0x2b07('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 3d85704..8548e8b 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 _0xbbab=['jayson/promise','client','request','then','info','MailQueueReport,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateMailQueueReport','MailQueueReport','create','options','debug','UpdateMailQueueReport','update','body','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/environment'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0xbbab,0xf1));var _0xbbba=function(_0xe50371,_0x6e56fd){_0xe50371=_0xe50371-0x0;var _0x41cc6d=_0xbbab[_0xe50371];return _0x41cc6d;};'use strict';var _=require(_0xbbba('0x0'));var util=require(_0xbbba('0x1'));var moment=require(_0xbbba('0x2'));var BPromise=require(_0xbbba('0x3'));var rs=require(_0xbbba('0x4'));var fs=require('fs');var Redis=require(_0xbbba('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xbbba('0x6'));var jayson=require(_0xbbba('0x7'));var client=jayson[_0xbbba('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd00278,_0x3404e8,_0x42d0e2){return new BPromise(function(_0x320689,_0x17980e){return client[_0xbbba('0x9')](_0xd00278,_0x42d0e2)[_0xbbba('0xa')](function(_0x1d5d6e){logger[_0xbbba('0xb')](_0xbbba('0xc'),_0x3404e8,'request\x20sent');logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3404e8,'request\x20sent',JSON[_0xbbba('0xd')](_0x1d5d6e));if(_0x1d5d6e[_0xbbba('0xe')]){if(_0x1d5d6e['error'][_0xbbba('0xf')]===0x1f4){logger[_0xbbba('0xe')](_0xbbba('0xc'),_0x3404e8,_0x1d5d6e[_0xbbba('0xe')][_0xbbba('0x10')]);return _0x17980e(_0x1d5d6e[_0xbbba('0xe')][_0xbbba('0x10')]);}logger[_0xbbba('0xe')](_0xbbba('0xc'),_0x3404e8,_0x1d5d6e['error'][_0xbbba('0x10')]);return _0x320689(_0x1d5d6e['error'][_0xbbba('0x10')]);}else{logger[_0xbbba('0xb')]('MailQueueReport,\x20%s,\x20%s',_0x3404e8,_0xbbba('0x11'));_0x320689(_0x1d5d6e['result'][_0xbbba('0x10')]);}})[_0xbbba('0x12')](function(_0x2812bb){logger[_0xbbba('0xe')]('MailQueueReport,\x20%s,\x20%s',_0x3404e8,_0x2812bb);_0x17980e(_0x2812bb);});});}exports[_0xbbba('0x13')]=function(_0x151e84){var _0x5ee61f=this;return new Promise(function(_0xadc74c,_0x4d8abb){return db[_0xbbba('0x14')][_0xbbba('0x15')](_0x151e84['body'],{'raw':_0x151e84[_0xbbba('0x16')]?_0x151e84[_0xbbba('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xbbba('0xa')](function(_0x2f7e68){logger[_0xbbba('0xb')](_0xbbba('0x13'),_0x151e84);logger[_0xbbba('0x17')](_0xbbba('0x13'),_0x151e84,JSON[_0xbbba('0xd')](_0x2f7e68));_0xadc74c(_0x2f7e68);})[_0xbbba('0x12')](function(_0x1ddef0){logger['error'](_0xbbba('0x13'),_0x1ddef0[_0xbbba('0x10')],_0x151e84);_0x4d8abb(_0x5ee61f[_0xbbba('0xe')](0x1f4,_0x1ddef0[_0xbbba('0x10')]));});});};exports[_0xbbba('0x18')]=function(_0x3a94e1){var _0x3bdff2=this;return new Promise(function(_0x1ef169,_0x292152){return db[_0xbbba('0x14')][_0xbbba('0x19')](_0x3a94e1[_0xbbba('0x1a')],{'raw':_0x3a94e1[_0xbbba('0x16')]?_0x3a94e1[_0xbbba('0x16')][_0xbbba('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a94e1['options']?_0x3a94e1[_0xbbba('0x16')][_0xbbba('0x1c')]||null:null,'attributes':_0x3a94e1[_0xbbba('0x16')]?_0x3a94e1['options'][_0xbbba('0x1d')]||null:null,'limit':_0x3a94e1['options']?_0x3a94e1['options'][_0xbbba('0x1e')]||null:null})[_0xbbba('0xa')](function(_0x3ad64d){logger[_0xbbba('0xb')](_0xbbba('0x18'),_0x3a94e1);logger[_0xbbba('0x17')](_0xbbba('0x18'),_0x3a94e1,JSON[_0xbbba('0xd')](_0x3ad64d));_0x1ef169(_0x3ad64d);})[_0xbbba('0x12')](function(_0xcb6bef){logger['error'](_0xbbba('0x18'),_0xcb6bef['message'],_0x3a94e1);_0x292152(_0x3bdff2[_0xbbba('0xe')](0x1f4,_0xcb6bef[_0xbbba('0x10')]));});});}; \ No newline at end of file +var _0x65a4=['error','message','info','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','where','attributes','limit','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x65a4,0xd6));var _0x465a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x65a4[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x465a('0x0'));var rs=require(_0x465a('0x1'));var fs=require('fs');var Redis=require(_0x465a('0x2'));var db=require(_0x465a('0x3'))['db'];var utils=require(_0x465a('0x4'));var logger=require(_0x465a('0x5'))(_0x465a('0x6'));var config=require(_0x465a('0x7'));var jayson=require(_0x465a('0x8'));var client=jayson[_0x465a('0x9')][_0x465a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x258fa1,_0x264292,_0x52622e){return new BPromise(function(_0x31f34f,_0x31f0b4){return client[_0x465a('0xb')](_0x258fa1,_0x52622e)[_0x465a('0xc')](function(_0x2e81fb){logger['info'](_0x465a('0xd'),_0x264292,_0x465a('0xe'));logger[_0x465a('0xf')](_0x465a('0x10'),_0x264292,_0x465a('0xe'),JSON['stringify'](_0x2e81fb));if(_0x2e81fb[_0x465a('0x11')]){if(_0x2e81fb[_0x465a('0x11')]['code']===0x1f4){logger[_0x465a('0x11')](_0x465a('0xd'),_0x264292,_0x2e81fb[_0x465a('0x11')][_0x465a('0x12')]);return _0x31f0b4(_0x2e81fb[_0x465a('0x11')][_0x465a('0x12')]);}logger['error'](_0x465a('0xd'),_0x264292,_0x2e81fb['error']['message']);return _0x31f34f(_0x2e81fb[_0x465a('0x11')][_0x465a('0x12')]);}else{logger[_0x465a('0x13')](_0x465a('0xd'),_0x264292,_0x465a('0xe'));_0x31f34f(_0x2e81fb[_0x465a('0x14')][_0x465a('0x12')]);}})[_0x465a('0x15')](function(_0x588d20){logger[_0x465a('0x11')](_0x465a('0xd'),_0x264292,_0x588d20);_0x31f0b4(_0x588d20);});});}exports[_0x465a('0x16')]=function(_0x45e03a){var _0x1a944f=this;return new Promise(function(_0x1fbbea,_0x33dd8f){return db[_0x465a('0x17')][_0x465a('0x18')](_0x45e03a[_0x465a('0x19')],{'raw':_0x45e03a[_0x465a('0x1a')]?_0x45e03a[_0x465a('0x1a')][_0x465a('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x1ff5c9){logger[_0x465a('0x13')]('CreateMailQueueReport',_0x45e03a);logger[_0x465a('0xf')](_0x465a('0x16'),_0x45e03a,JSON['stringify'](_0x1ff5c9));_0x1fbbea(_0x1ff5c9);})['catch'](function(_0x4669fc){logger[_0x465a('0x11')]('CreateMailQueueReport',_0x4669fc[_0x465a('0x12')],_0x45e03a);_0x33dd8f(_0x1a944f[_0x465a('0x11')](0x1f4,_0x4669fc[_0x465a('0x12')]));});});};exports[_0x465a('0x1c')]=function(_0x475f1c){var _0x5d79b7=this;return new Promise(function(_0x5acd70,_0x48f5c8){return db['MailQueueReport'][_0x465a('0x1d')](_0x475f1c[_0x465a('0x19')],{'raw':_0x475f1c[_0x465a('0x1a')]?_0x475f1c[_0x465a('0x1a')][_0x465a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x475f1c[_0x465a('0x1a')]?_0x475f1c[_0x465a('0x1a')][_0x465a('0x1e')]||null:null,'attributes':_0x475f1c[_0x465a('0x1a')]?_0x475f1c[_0x465a('0x1a')][_0x465a('0x1f')]||null:null,'limit':_0x475f1c[_0x465a('0x1a')]?_0x475f1c['options'][_0x465a('0x20')]||null:null})[_0x465a('0xc')](function(_0x426389){logger[_0x465a('0x13')]('UpdateMailQueueReport',_0x475f1c);logger['debug'](_0x465a('0x1c'),_0x475f1c,JSON['stringify'](_0x426389));_0x5acd70(_0x426389);})['catch'](function(_0x2afbbc){logger[_0x465a('0x11')]('UpdateMailQueueReport',_0x2afbbc[_0x465a('0x12')],_0x475f1c);_0x48f5c8(_0x5d79b7[_0x465a('0x11')](0x1f4,_0x2afbbc[_0x465a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index a7ee16d..65c2931 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 _0x867f=['Router','fs-extra','../../components/interaction/service','exports','multer','util','path','express'];(function(_0x38efaa,_0x49c440){var _0x2af532=function(_0x599e20){while(--_0x599e20){_0x38efaa['push'](_0x38efaa['shift']());}};_0x2af532(++_0x49c440);}(_0x867f,0xdc));var _0xf867=function(_0x273f77,_0xe5b0cb){_0x273f77=_0x273f77-0x0;var _0x71e147=_0x867f[_0x273f77];return _0x71e147;};'use strict';var multer=require(_0xf867('0x0'));var util=require(_0xf867('0x1'));var path=require(_0xf867('0x2'));var timeout=require('connect-timeout');var express=require(_0xf867('0x3'));var router=express[_0xf867('0x4')]();var fs_extra=require(_0xf867('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf867('0x6'));var config=require('../../config/environment');module[_0xf867('0x7')]=router; \ No newline at end of file +var _0xefda=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','connect-timeout'];(function(_0x1b3126,_0x566a16){var _0x1e6a9e=function(_0x5332c3){while(--_0x5332c3){_0x1b3126['push'](_0x1b3126['shift']());}};_0x1e6a9e(++_0x566a16);}(_0xefda,0x96));var _0xaefd=function(_0x3ac3ef,_0x437ec8){_0x3ac3ef=_0x3ac3ef-0x0;var _0x94eced=_0xefda[_0x3ac3ef];return _0x94eced;};'use strict';var multer=require(_0xaefd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaefd('0x1'));var express=require(_0xaefd('0x2'));var router=express['Router']();var fs_extra=require(_0xaefd('0x3'));var auth=require(_0xaefd('0x4'));var interaction=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));module[_0xaefd('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 3cb031a..02e072c 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 _0x3453=['STRING','BOOLEAN','INTEGER','sequelize'];(function(_0xd71b42,_0x3c9159){var _0x30811b=function(_0xbb1fa0){while(--_0xbb1fa0){_0xd71b42['push'](_0xd71b42['shift']());}};_0x30811b(++_0x3c9159);}(_0x3453,0x6b));var _0x3345=function(_0x12ebd9,_0x339523){_0x12ebd9=_0x12ebd9-0x0;var _0x50eeff=_0x3453[_0x12ebd9];return _0x50eeff;};'use strict';var Sequelize=require(_0x3345('0x0'));module['exports']={'description':{'type':Sequelize[_0x3345('0x1')]},'host':{'type':Sequelize[_0x3345('0x1')]},'authentication':{'type':Sequelize[_0x3345('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x3345('0x3')]},'tls':{'type':Sequelize[_0x3345('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x3345('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x3345('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa55a=['INTEGER','BOOLEAN','INBOX','sequelize','exports','STRING'];(function(_0x455645,_0xce5bc5){var _0x21c157=function(_0x5c6874){while(--_0x5c6874){_0x455645['push'](_0x455645['shift']());}};_0x21c157(++_0xce5bc5);}(_0xa55a,0xc9));var _0xaa55=function(_0x26108a,_0x3cff22){_0x26108a=_0x26108a-0x0;var _0xeddb9a=_0xa55a[_0x26108a];return _0xeddb9a;};'use strict';var Sequelize=require(_0xaa55('0x0'));module[_0xaa55('0x1')]={'description':{'type':Sequelize[_0xaa55('0x2')]},'host':{'type':Sequelize[_0xaa55('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xaa55('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xaa55('0x3')]},'tls':{'type':Sequelize[_0xaa55('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xaa55('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xaa55('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 0848a61..e7c50ed 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 _0xdd4f=['exports','define','MailServerIn','lodash','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x3ccfea,_0x72e716){_0x3ccfea=_0x3ccfea-0x0;var _0x38237a=_0xdd4f[_0x3ccfea];return _0x38237a;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfdd4('0x1'));var BPromise=require(_0xfdd4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdd4('0x3'));var rimraf=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var attributes=require('./mailServerIn.attributes');module[_0xfdd4('0x6')]=function(_0x43cbcf,_0x30e080){return _0x43cbcf[_0xfdd4('0x7')](_0xfdd4('0x8'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x574d=['moment','bluebird','request-promise','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api'];(function(_0x1b97e0,_0x183c1b){var _0x29f394=function(_0x18f714){while(--_0x18f714){_0x1b97e0['push'](_0x1b97e0['shift']());}};_0x29f394(++_0x183c1b);}(_0x574d,0xc0));var _0xd574=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x574d[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xd574('0x0'));var util=require(_0xd574('0x1'));var logger=require(_0xd574('0x2'))(_0xd574('0x3'));var moment=require(_0xd574('0x4'));var BPromise=require(_0xd574('0x5'));var rp=require(_0xd574('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd574('0x7'));var config=require(_0xd574('0x8'));var attributes=require(_0xd574('0x9'));module[_0xd574('0xa')]=function(_0x56ecee,_0x16a152){return _0x56ecee[_0xd574('0xb')](_0xd574('0xc'),attributes,{'tableName':_0xd574('0xd'),'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 a215695..436c475 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 _0x4f29=['request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','attributes','limit','map','include','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','MailServerIn,\x20%s,\x20%s'];(function(_0xf0668b,_0x311f9a){var _0x1490c3=function(_0x1a6a9d){while(--_0x1a6a9d){_0xf0668b['push'](_0xf0668b['shift']());}};_0x1490c3(++_0x311f9a);}(_0x4f29,0xf9));var _0x94f2=function(_0x49b0e9,_0x59bcb6){_0x49b0e9=_0x49b0e9-0x0;var _0x266c9c=_0x4f29[_0x49b0e9];return _0x266c9c;};'use strict';var _=require(_0x94f2('0x0'));var util=require(_0x94f2('0x1'));var moment=require(_0x94f2('0x2'));var BPromise=require(_0x94f2('0x3'));var rs=require(_0x94f2('0x4'));var fs=require('fs');var Redis=require(_0x94f2('0x5'));var db=require(_0x94f2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x94f2('0x7'))(_0x94f2('0x8'));var config=require('../../config/environment');var jayson=require(_0x94f2('0x9'));var client=jayson['client'][_0x94f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ad149,_0x15e3ec,_0x31e4d8){return new BPromise(function(_0x6e7ed1,_0x2a4b2a){return client[_0x94f2('0xb')](_0x1ad149,_0x31e4d8)[_0x94f2('0xc')](function(_0x5caa7b){logger[_0x94f2('0xd')](_0x94f2('0xe'),_0x15e3ec,_0x94f2('0xf'));logger[_0x94f2('0x10')](_0x94f2('0x11'),_0x15e3ec,'request\x20sent',JSON['stringify'](_0x5caa7b));if(_0x5caa7b[_0x94f2('0x12')]){if(_0x5caa7b[_0x94f2('0x12')][_0x94f2('0x13')]===0x1f4){logger[_0x94f2('0x12')](_0x94f2('0xe'),_0x15e3ec,_0x5caa7b[_0x94f2('0x12')]['message']);return _0x2a4b2a(_0x5caa7b[_0x94f2('0x12')][_0x94f2('0x14')]);}logger[_0x94f2('0x12')](_0x94f2('0xe'),_0x15e3ec,_0x5caa7b[_0x94f2('0x12')][_0x94f2('0x14')]);return _0x6e7ed1(_0x5caa7b[_0x94f2('0x12')][_0x94f2('0x14')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x15e3ec,_0x94f2('0xf'));_0x6e7ed1(_0x5caa7b[_0x94f2('0x15')][_0x94f2('0x14')]);}})[_0x94f2('0x16')](function(_0x15940e){logger[_0x94f2('0x12')](_0x94f2('0xe'),_0x15e3ec,_0x15940e);_0x2a4b2a(_0x15940e);});});}exports[_0x94f2('0x17')]=function(_0x30f181){var _0xf3041b=this;return new Promise(function(_0x4c179a,_0x5b2964){return db[_0x94f2('0x18')][_0x94f2('0x19')]({'raw':_0x30f181['options']?_0x30f181[_0x94f2('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x30f181['options']?_0x30f181[_0x94f2('0x1a')]['where']||null:null,'attributes':_0x30f181[_0x94f2('0x1a')]?_0x30f181[_0x94f2('0x1a')][_0x94f2('0x1b')]||null:null,'limit':_0x30f181[_0x94f2('0x1a')]?_0x30f181[_0x94f2('0x1a')][_0x94f2('0x1c')]||null:null,'include':_0x30f181[_0x94f2('0x1a')]?_0x30f181[_0x94f2('0x1a')]['include']?_[_0x94f2('0x1d')](_0x30f181[_0x94f2('0x1a')][_0x94f2('0x1e')],function(_0x13e47e){return{'model':db[_0x13e47e[_0x94f2('0x1f')]],'as':_0x13e47e['as'],'attributes':_0x13e47e[_0x94f2('0x1b')],'include':_0x13e47e[_0x94f2('0x1e')]?_['map'](_0x13e47e[_0x94f2('0x1e')],function(_0x1b951c){return{'model':db[_0x1b951c[_0x94f2('0x1f')]],'as':_0x1b951c['as'],'attributes':_0x1b951c['attributes'],'include':_0x1b951c[_0x94f2('0x1e')]?_['map'](_0x1b951c[_0x94f2('0x1e')],function(_0x551f1c){return{'model':db[_0x551f1c[_0x94f2('0x1f')]],'as':_0x551f1c['as'],'attributes':_0x551f1c[_0x94f2('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31b0ed){logger['info'](_0x94f2('0x17'),_0x30f181);logger[_0x94f2('0x10')](_0x94f2('0x17'),_0x30f181,JSON[_0x94f2('0x20')](_0x31b0ed));_0x4c179a(_0x31b0ed);})[_0x94f2('0x16')](function(_0x27fe31){logger[_0x94f2('0x12')](_0x94f2('0x17'),_0x27fe31[_0x94f2('0x14')],_0x30f181);_0x5b2964(_0xf3041b[_0x94f2('0x12')](0x1f4,_0x27fe31[_0x94f2('0x14')]));});});}; \ No newline at end of file +var _0x3e2e=['MailServerIn,\x20%s,\x20%s','MailServerIn,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','findAll','options','where','limit','include','model','attributes','map','GetMailServerIn','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info'];(function(_0xff4fd2,_0x442a76){var _0x367435=function(_0x336ae5){while(--_0x336ae5){_0xff4fd2['push'](_0xff4fd2['shift']());}};_0x367435(++_0x442a76);}(_0x3e2e,0x1f1));var _0xe3e2=function(_0x48bb2e,_0x2c321c){_0x48bb2e=_0x48bb2e-0x0;var _0x3b9154=_0x3e2e[_0x48bb2e];return _0x3b9154;};'use strict';var _=require(_0xe3e2('0x0'));var util=require('util');var moment=require(_0xe3e2('0x1'));var BPromise=require(_0xe3e2('0x2'));var rs=require(_0xe3e2('0x3'));var fs=require('fs');var Redis=require(_0xe3e2('0x4'));var db=require(_0xe3e2('0x5'))['db'];var utils=require(_0xe3e2('0x6'));var logger=require(_0xe3e2('0x7'))(_0xe3e2('0x8'));var config=require(_0xe3e2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe3e2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b069c,_0x4d889b,_0x234c62){return new BPromise(function(_0x510620,_0x421d9e){return client['request'](_0x4b069c,_0x234c62)[_0xe3e2('0xb')](function(_0x5e06c1){logger[_0xe3e2('0xc')](_0xe3e2('0xd'),_0x4d889b,'request\x20sent');logger['debug'](_0xe3e2('0xe'),_0x4d889b,'request\x20sent',JSON['stringify'](_0x5e06c1));if(_0x5e06c1[_0xe3e2('0xf')]){if(_0x5e06c1[_0xe3e2('0xf')]['code']===0x1f4){logger['error'](_0xe3e2('0xd'),_0x4d889b,_0x5e06c1[_0xe3e2('0xf')][_0xe3e2('0x10')]);return _0x421d9e(_0x5e06c1[_0xe3e2('0xf')][_0xe3e2('0x10')]);}logger[_0xe3e2('0xf')](_0xe3e2('0xd'),_0x4d889b,_0x5e06c1[_0xe3e2('0xf')]['message']);return _0x510620(_0x5e06c1[_0xe3e2('0xf')][_0xe3e2('0x10')]);}else{logger[_0xe3e2('0xc')](_0xe3e2('0xd'),_0x4d889b,_0xe3e2('0x11'));_0x510620(_0x5e06c1[_0xe3e2('0x12')][_0xe3e2('0x10')]);}})[_0xe3e2('0x13')](function(_0x29fd7d){logger[_0xe3e2('0xf')]('MailServerIn,\x20%s,\x20%s',_0x4d889b,_0x29fd7d);_0x421d9e(_0x29fd7d);});});}exports['GetMailServerIn']=function(_0x19a2ff){var _0x3f2d0f=this;return new Promise(function(_0x3b77dd,_0x1a8889){return db['MailServerIn'][_0xe3e2('0x14')]({'raw':_0x19a2ff['options']?_0x19a2ff[_0xe3e2('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x19a2ff['options']?_0x19a2ff[_0xe3e2('0x15')][_0xe3e2('0x16')]||null:null,'attributes':_0x19a2ff[_0xe3e2('0x15')]?_0x19a2ff[_0xe3e2('0x15')]['attributes']||null:null,'limit':_0x19a2ff[_0xe3e2('0x15')]?_0x19a2ff[_0xe3e2('0x15')][_0xe3e2('0x17')]||null:null,'include':_0x19a2ff[_0xe3e2('0x15')]?_0x19a2ff['options'][_0xe3e2('0x18')]?_['map'](_0x19a2ff[_0xe3e2('0x15')]['include'],function(_0x5c3279){return{'model':db[_0x5c3279[_0xe3e2('0x19')]],'as':_0x5c3279['as'],'attributes':_0x5c3279[_0xe3e2('0x1a')],'include':_0x5c3279[_0xe3e2('0x18')]?_[_0xe3e2('0x1b')](_0x5c3279['include'],function(_0x456021){return{'model':db[_0x456021[_0xe3e2('0x19')]],'as':_0x456021['as'],'attributes':_0x456021[_0xe3e2('0x1a')],'include':_0x456021[_0xe3e2('0x18')]?_[_0xe3e2('0x1b')](_0x456021[_0xe3e2('0x18')],function(_0x17beea){return{'model':db[_0x17beea[_0xe3e2('0x19')]],'as':_0x17beea['as'],'attributes':_0x17beea[_0xe3e2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe3e2('0xb')](function(_0xec6dce){logger[_0xe3e2('0xc')]('GetMailServerIn',_0x19a2ff);logger['debug'](_0xe3e2('0x1c'),_0x19a2ff,JSON[_0xe3e2('0x1d')](_0xec6dce));_0x3b77dd(_0xec6dce);})[_0xe3e2('0x13')](function(_0x2bb134){logger['error']('GetMailServerIn',_0x2bb134[_0xe3e2('0x10')],_0x19a2ff);_0x1a8889(_0x3f2d0f['error'](0x1f4,_0x2bb134['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 19c7fda..2151d63 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 _0xa9e0=['isAuthenticated','update','delete','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','index','/:id','post','put'];(function(_0x251af9,_0x92cfba){var _0x705d93=function(_0x2df1dd){while(--_0x2df1dd){_0x251af9['push'](_0x251af9['shift']());}};_0x705d93(++_0x92cfba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xc')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','update','delete','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','index','/:id','post','put'];(function(_0x2c816a,_0x56fb51){var _0x230613=function(_0x5eb903){while(--_0x5eb903){_0x2c816a['push'](_0x2c816a['shift']());}};_0x230613(++_0x56fb51);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xc')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['destroy']);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 c7617e8..9939e68 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 _0x3714=['BOOLEAN','sequelize','exports','STRING'];(function(_0x426602,_0x2d4e5c){var _0x3dc2e8=function(_0x438bfd){while(--_0x438bfd){_0x426602['push'](_0x426602['shift']());}};_0x3dc2e8(++_0x2d4e5c);}(_0x3714,0x95));var _0x4371=function(_0x4a1911,_0x101f54){_0x4a1911=_0x4a1911-0x0;var _0x391d4e=_0x3714[_0x4a1911];return _0x391d4e;};'use strict';var Sequelize=require(_0x4371('0x0'));module[_0x4371('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4371('0x2')]},'user':{'type':Sequelize[_0x4371('0x2')]},'pass':{'type':Sequelize[_0x4371('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x4371('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x4371('0x2')]},'authentication':{'type':Sequelize[_0x4371('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9c48=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0x9c48,0xa1));var _0x89c4=function(_0x5b6354,_0x5002fb){_0x5b6354=_0x5b6354-0x0;var _0x501644=_0x9c48[_0x5b6354];return _0x501644;};'use strict';var Sequelize=require(_0x89c4('0x0'));module[_0x89c4('0x1')]={'description':{'type':Sequelize[_0x89c4('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x89c4('0x2')]},'pass':{'type':Sequelize[_0x89c4('0x2')]},'port':{'type':Sequelize[_0x89c4('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x89c4('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 6de8551..4fa443c 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 _0x13b8=['Content-Range','apply','save','update','then','stack','name','send','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','nolimit','where','filters','pick','filter','merge','options','MailServerOut','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x13b8,0x147));var _0x813b=function(_0x339129,_0x86dcc6){_0x339129=_0x339129-0x0;var _0x1570df=_0x13b8[_0x339129];return _0x1570df;};'use strict';var emlformat=require(_0x813b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x813b('0x1'));var rp=require(_0x813b('0x2'));var moment=require(_0x813b('0x3'));var BPromise=require(_0x813b('0x4'));var Mustache=require(_0x813b('0x5'));var util=require(_0x813b('0x6'));var path=require(_0x813b('0x7'));var sox=require(_0x813b('0x8'));var csv=require(_0x813b('0x9'));var ejs=require(_0x813b('0xa'));var fs=require('fs');var fs_extra=require(_0x813b('0xb'));var _=require('lodash');var squel=require(_0x813b('0xc'));var crypto=require(_0x813b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x813b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x813b('0xf'));var Papa=require(_0x813b('0x10'));var Redis=require(_0x813b('0x11'));var authService=require(_0x813b('0x12'));var qs=require(_0x813b('0x13'));var as=require(_0x813b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x813b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x813b('0x16'));var db=require(_0x813b('0x17'))['db'];function respondWithStatusCode(_0x3944a6,_0x4210eb){_0x4210eb=_0x4210eb||0xcc;return function(_0x25d10f){if(_0x25d10f){return _0x3944a6[_0x813b('0x18')](_0x4210eb);}return _0x3944a6[_0x813b('0x19')](_0x4210eb)[_0x813b('0x1a')]();};}function respondWithResult(_0x3c237b,_0x5e2e62){_0x5e2e62=_0x5e2e62||0xc8;return function(_0x4819e6){if(_0x4819e6){return _0x3c237b[_0x813b('0x19')](_0x5e2e62)[_0x813b('0x1b')](_0x4819e6);}};}function respondWithFilteredResult(_0x19a6b8,_0x5dc367){return function(_0x53ba4b){if(_0x53ba4b){var _0x27e036=typeof _0x5dc367['offset']===_0x813b('0x1c')&&typeof _0x5dc367[_0x813b('0x1d')]===_0x813b('0x1c');var _0x3c7c5e=_0x53ba4b['count'];var _0x355953=_0x27e036?0x0:_0x5dc367['offset'];var _0x5b2039=_0x27e036?_0x53ba4b[_0x813b('0x1e')]:_0x5dc367[_0x813b('0x1f')]+_0x5dc367['limit'];var _0x42f502;if(_0x5b2039>=_0x3c7c5e){_0x5b2039=_0x3c7c5e;_0x42f502=0xc8;}else{_0x42f502=0xce;}_0x19a6b8[_0x813b('0x19')](_0x42f502);return _0x19a6b8[_0x813b('0x20')](_0x813b('0x21'),_0x355953+'-'+_0x5b2039+'/'+_0x3c7c5e)['json'](_0x53ba4b);}return null;};}function patchUpdates(_0x2c64ea){return function(_0x3e9cf9){try{jsonpatch[_0x813b('0x22')](_0x3e9cf9,_0x2c64ea,!![]);}catch(_0x523d96){return BPromise['reject'](_0x523d96);}return _0x3e9cf9[_0x813b('0x23')]();};}function saveUpdates(_0x3a7d28,_0x2e69c9){return function(_0x2f3197){if(_0x2f3197){return _0x2f3197[_0x813b('0x24')](_0x3a7d28)[_0x813b('0x25')](function(_0x571de8){return _0x571de8;});}return null;};}function removeEntity(_0x40f120,_0x1a61a0){return function(_0x4ab362){if(_0x4ab362){return _0x4ab362['destroy']()[_0x813b('0x25')](function(){_0x40f120['status'](0xcc)[_0x813b('0x1a')]();});}};}function handleEntityNotFound(_0xf73213,_0x30f18c){return function(_0x532c11){if(!_0x532c11){_0xf73213[_0x813b('0x18')](0x194);}return _0x532c11;};}function handleError(_0x5cacb7,_0x287d00){_0x287d00=_0x287d00||0x1f4;return function(_0x936416){logger['error'](_0x936416[_0x813b('0x26')]);if(_0x936416[_0x813b('0x27')]){delete _0x936416[_0x813b('0x27')];}_0x5cacb7[_0x813b('0x19')](_0x287d00)[_0x813b('0x28')](_0x936416);};}exports['index']=function(_0x500a36,_0x3a01d9){var _0x5c8e37={},_0x494635={},_0x497d42={'count':0x0,'rows':[]};var _0x3b2960=_['map'](db['MailServerOut']['rawAttributes'],function(_0x5b4b03){return{'name':_0x5b4b03[_0x813b('0x29')],'type':_0x5b4b03[_0x813b('0x2a')][_0x813b('0x2b')]};});_0x494635[_0x813b('0x2c')]=_[_0x813b('0x2d')](_0x3b2960,_0x813b('0x27'));_0x494635[_0x813b('0x2e')]=_[_0x813b('0x2f')](_0x500a36[_0x813b('0x2e')]);_0x494635['filters']=_['intersection'](_0x494635[_0x813b('0x2c')],_0x494635[_0x813b('0x2e')]);_0x5c8e37[_0x813b('0x30')]=_[_0x813b('0x31')](_0x494635['model'],qs[_0x813b('0x32')](_0x500a36[_0x813b('0x2e')]['fields']));_0x5c8e37[_0x813b('0x30')]=_0x5c8e37['attributes'][_0x813b('0x33')]?_0x5c8e37['attributes']:_0x494635['model'];if(!_0x500a36[_0x813b('0x2e')]['hasOwnProperty'](_0x813b('0x34'))){_0x5c8e37['limit']=qs[_0x813b('0x1d')](_0x500a36[_0x813b('0x2e')][_0x813b('0x1d')]);_0x5c8e37[_0x813b('0x1f')]=qs[_0x813b('0x1f')](_0x500a36[_0x813b('0x2e')][_0x813b('0x1f')]);}_0x5c8e37['order']=qs['sort'](_0x500a36[_0x813b('0x2e')]['sort']);_0x5c8e37[_0x813b('0x35')]=qs[_0x813b('0x36')](_[_0x813b('0x37')](_0x500a36['query'],_0x494635[_0x813b('0x36')]),_0x3b2960);if(_0x500a36[_0x813b('0x2e')][_0x813b('0x38')]){_0x5c8e37[_0x813b('0x35')]=_['merge'](_0x5c8e37['where'],{'$or':_[_0x813b('0x2d')](_0x3b2960,function(_0x4bc3bb){if(_0x4bc3bb['type']!=='VIRTUAL'){var _0x212369={};_0x212369[_0x4bc3bb['name']]={'$like':'%'+_0x500a36['query'][_0x813b('0x38')]+'%'};return _0x212369;}})});}_0x5c8e37=_[_0x813b('0x39')]({},_0x5c8e37,_0x500a36[_0x813b('0x3a')]);var _0x5a696f={'where':_0x5c8e37[_0x813b('0x35')]};return db[_0x813b('0x3b')][_0x813b('0x1e')](_0x5a696f)[_0x813b('0x25')](function(_0x21fa11){_0x497d42[_0x813b('0x1e')]=_0x21fa11;if(_0x500a36[_0x813b('0x2e')][_0x813b('0x3c')]){_0x5c8e37[_0x813b('0x3d')]=[{'all':!![]}];}return db['MailServerOut'][_0x813b('0x3e')](_0x5c8e37);})[_0x813b('0x25')](function(_0x452f4b){_0x497d42[_0x813b('0x3f')]=_0x452f4b;return _0x497d42;})[_0x813b('0x25')](respondWithFilteredResult(_0x3a01d9,_0x5c8e37))[_0x813b('0x40')](handleError(_0x3a01d9,null));};exports[_0x813b('0x41')]=function(_0x47f823,_0x36c0c1){var _0x5eb23a={'raw':!![],'where':{'id':_0x47f823[_0x813b('0x42')]['id']}},_0x572506={};_0x572506[_0x813b('0x2c')]=_[_0x813b('0x2f')](db[_0x813b('0x3b')][_0x813b('0x43')]);_0x572506['query']=_[_0x813b('0x2f')](_0x47f823[_0x813b('0x2e')]);_0x572506[_0x813b('0x36')]=_[_0x813b('0x31')](_0x572506[_0x813b('0x2c')],_0x572506['query']);_0x5eb23a['attributes']=_[_0x813b('0x31')](_0x572506['model'],qs[_0x813b('0x32')](_0x47f823[_0x813b('0x2e')][_0x813b('0x32')]));_0x5eb23a[_0x813b('0x30')]=_0x5eb23a['attributes']['length']?_0x5eb23a[_0x813b('0x30')]:_0x572506[_0x813b('0x2c')];if(_0x47f823['query'][_0x813b('0x3c')]){_0x5eb23a[_0x813b('0x3d')]=[{'all':!![]}];}_0x5eb23a=_[_0x813b('0x39')]({},_0x5eb23a,_0x47f823[_0x813b('0x3a')]);return db[_0x813b('0x3b')]['find'](_0x5eb23a)[_0x813b('0x25')](handleEntityNotFound(_0x36c0c1,null))[_0x813b('0x25')](respondWithResult(_0x36c0c1,null))['catch'](handleError(_0x36c0c1,null));};exports[_0x813b('0x44')]=function(_0x33dbdb,_0x39fd8b){return db[_0x813b('0x3b')][_0x813b('0x44')](_0x33dbdb['body'],{})[_0x813b('0x25')](respondWithResult(_0x39fd8b,0xc9))[_0x813b('0x40')](handleError(_0x39fd8b,null));};exports[_0x813b('0x24')]=function(_0x47a33a,_0x3a66d5){if(_0x47a33a['body']['id']){delete _0x47a33a[_0x813b('0x45')]['id'];}return db['MailServerOut'][_0x813b('0x46')]({'where':{'id':_0x47a33a[_0x813b('0x42')]['id']}})[_0x813b('0x25')](handleEntityNotFound(_0x3a66d5,null))[_0x813b('0x25')](saveUpdates(_0x47a33a['body'],null))[_0x813b('0x25')](respondWithResult(_0x3a66d5,null))[_0x813b('0x40')](handleError(_0x3a66d5,null));};exports[_0x813b('0x47')]=function(_0x26f20c,_0x9778a2){return db[_0x813b('0x3b')][_0x813b('0x46')]({'where':{'id':_0x26f20c[_0x813b('0x42')]['id']}})['then'](handleEntityNotFound(_0x9778a2,null))[_0x813b('0x25')](removeEntity(_0x9778a2,null))[_0x813b('0x40')](handleError(_0x9778a2,null));}; \ No newline at end of file +var _0xf0e0=['fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','apply','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','MailServerOut','includeAll','findAll','rows','show','params','include','catch','create','body','find','destroy','eml-format','rimraf','zip-dir'];(function(_0x297339,_0x1854ef){var _0x3507a2=function(_0x41361a){while(--_0x41361a){_0x297339['push'](_0x297339['shift']());}};_0x3507a2(++_0x1854ef);}(_0xf0e0,0x165));var _0x0f0e=function(_0x546802,_0x2078f4){_0x546802=_0x546802-0x0;var _0x28ddaf=_0xf0e0[_0x546802];return _0x28ddaf;};'use strict';var emlformat=require(_0x0f0e('0x0'));var rimraf=require(_0x0f0e('0x1'));var zipdir=require(_0x0f0e('0x2'));var jsonpatch=require(_0x0f0e('0x3'));var rp=require(_0x0f0e('0x4'));var moment=require(_0x0f0e('0x5'));var BPromise=require(_0x0f0e('0x6'));var Mustache=require(_0x0f0e('0x7'));var util=require(_0x0f0e('0x8'));var path=require('path');var sox=require(_0x0f0e('0x9'));var csv=require(_0x0f0e('0xa'));var ejs=require(_0x0f0e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0f0e('0xc'));var squel=require(_0x0f0e('0xd'));var crypto=require(_0x0f0e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0f0e('0xf'));var toCsv=require(_0x0f0e('0xa'));var querystring=require(_0x0f0e('0x10'));var Papa=require('papaparse');var Redis=require(_0x0f0e('0x11'));var authService=require(_0x0f0e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0f0e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f0e('0x14'))(_0x0f0e('0x15'));var utils=require(_0x0f0e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0f0e('0x17'));var db=require(_0x0f0e('0x18'))['db'];function respondWithStatusCode(_0x59e669,_0x550b26){_0x550b26=_0x550b26||0xcc;return function(_0x915aca){if(_0x915aca){return _0x59e669['sendStatus'](_0x550b26);}return _0x59e669[_0x0f0e('0x19')](_0x550b26)[_0x0f0e('0x1a')]();};}function respondWithResult(_0x5989fd,_0x3c19d0){_0x3c19d0=_0x3c19d0||0xc8;return function(_0x1a2e07){if(_0x1a2e07){return _0x5989fd['status'](_0x3c19d0)[_0x0f0e('0x1b')](_0x1a2e07);}};}function respondWithFilteredResult(_0x1acccd,_0x4af35a){return function(_0x917c6b){if(_0x917c6b){var _0x2f3930=typeof _0x4af35a[_0x0f0e('0x1c')]==='undefined'&&typeof _0x4af35a[_0x0f0e('0x1d')]==='undefined';var _0x4cea1b=_0x917c6b[_0x0f0e('0x1e')];var _0x34f9a9=_0x2f3930?0x0:_0x4af35a[_0x0f0e('0x1c')];var _0x2786f0=_0x2f3930?_0x917c6b[_0x0f0e('0x1e')]:_0x4af35a['offset']+_0x4af35a[_0x0f0e('0x1d')];var _0x4f3163;if(_0x2786f0>=_0x4cea1b){_0x2786f0=_0x4cea1b;_0x4f3163=0xc8;}else{_0x4f3163=0xce;}_0x1acccd['status'](_0x4f3163);return _0x1acccd[_0x0f0e('0x1f')]('Content-Range',_0x34f9a9+'-'+_0x2786f0+'/'+_0x4cea1b)[_0x0f0e('0x1b')](_0x917c6b);}return null;};}function patchUpdates(_0x34134f){return function(_0x51c608){try{jsonpatch[_0x0f0e('0x20')](_0x51c608,_0x34134f,!![]);}catch(_0x7c366b){return BPromise['reject'](_0x7c366b);}return _0x51c608['save']();};}function saveUpdates(_0x2d4c04,_0x3339a3){return function(_0x471b84){if(_0x471b84){return _0x471b84[_0x0f0e('0x21')](_0x2d4c04)[_0x0f0e('0x22')](function(_0x5c2748){return _0x5c2748;});}return null;};}function removeEntity(_0x91a8bf,_0x371c20){return function(_0x13212f){if(_0x13212f){return _0x13212f['destroy']()[_0x0f0e('0x22')](function(){_0x91a8bf[_0x0f0e('0x19')](0xcc)[_0x0f0e('0x1a')]();});}};}function handleEntityNotFound(_0x4ed3ba,_0x3978e5){return function(_0x5b0522){if(!_0x5b0522){_0x4ed3ba['sendStatus'](0x194);}return _0x5b0522;};}function handleError(_0x1f6a3c,_0x4ff6d9){_0x4ff6d9=_0x4ff6d9||0x1f4;return function(_0x4a9054){logger[_0x0f0e('0x23')](_0x4a9054[_0x0f0e('0x24')]);if(_0x4a9054[_0x0f0e('0x25')]){delete _0x4a9054[_0x0f0e('0x25')];}_0x1f6a3c[_0x0f0e('0x19')](_0x4ff6d9)[_0x0f0e('0x26')](_0x4a9054);};}exports['index']=function(_0x18d0b9,_0x1b1ca0){var _0x475c1c={},_0x570992={},_0x88e47b={'count':0x0,'rows':[]};var _0x5072fc=_[_0x0f0e('0x27')](db['MailServerOut'][_0x0f0e('0x28')],function(_0x3bd618){return{'name':_0x3bd618[_0x0f0e('0x29')],'type':_0x3bd618[_0x0f0e('0x2a')][_0x0f0e('0x2b')]};});_0x570992[_0x0f0e('0x2c')]=_['map'](_0x5072fc,_0x0f0e('0x25'));_0x570992[_0x0f0e('0x2d')]=_[_0x0f0e('0x2e')](_0x18d0b9['query']);_0x570992[_0x0f0e('0x2f')]=_[_0x0f0e('0x30')](_0x570992[_0x0f0e('0x2c')],_0x570992[_0x0f0e('0x2d')]);_0x475c1c[_0x0f0e('0x31')]=_[_0x0f0e('0x30')](_0x570992['model'],qs['fields'](_0x18d0b9[_0x0f0e('0x2d')][_0x0f0e('0x32')]));_0x475c1c[_0x0f0e('0x31')]=_0x475c1c['attributes'][_0x0f0e('0x33')]?_0x475c1c[_0x0f0e('0x31')]:_0x570992[_0x0f0e('0x2c')];if(!_0x18d0b9[_0x0f0e('0x2d')][_0x0f0e('0x34')]('nolimit')){_0x475c1c[_0x0f0e('0x1d')]=qs['limit'](_0x18d0b9[_0x0f0e('0x2d')][_0x0f0e('0x1d')]);_0x475c1c['offset']=qs[_0x0f0e('0x1c')](_0x18d0b9[_0x0f0e('0x2d')][_0x0f0e('0x1c')]);}_0x475c1c[_0x0f0e('0x35')]=qs[_0x0f0e('0x36')](_0x18d0b9[_0x0f0e('0x2d')]['sort']);_0x475c1c[_0x0f0e('0x37')]=qs[_0x0f0e('0x2f')](_[_0x0f0e('0x38')](_0x18d0b9['query'],_0x570992[_0x0f0e('0x2f')]),_0x5072fc);if(_0x18d0b9[_0x0f0e('0x2d')][_0x0f0e('0x39')]){_0x475c1c['where']=_[_0x0f0e('0x3a')](_0x475c1c[_0x0f0e('0x37')],{'$or':_['map'](_0x5072fc,function(_0x3f1f34){if(_0x3f1f34[_0x0f0e('0x2a')]!=='VIRTUAL'){var _0x5ba888={};_0x5ba888[_0x3f1f34[_0x0f0e('0x25')]]={'$like':'%'+_0x18d0b9[_0x0f0e('0x2d')][_0x0f0e('0x39')]+'%'};return _0x5ba888;}})});}_0x475c1c=_['merge']({},_0x475c1c,_0x18d0b9[_0x0f0e('0x3b')]);var _0x26bec9={'where':_0x475c1c[_0x0f0e('0x37')]};return db[_0x0f0e('0x3c')][_0x0f0e('0x1e')](_0x26bec9)[_0x0f0e('0x22')](function(_0x1d8a90){_0x88e47b['count']=_0x1d8a90;if(_0x18d0b9['query'][_0x0f0e('0x3d')]){_0x475c1c['include']=[{'all':!![]}];}return db['MailServerOut'][_0x0f0e('0x3e')](_0x475c1c);})['then'](function(_0x27205a){_0x88e47b[_0x0f0e('0x3f')]=_0x27205a;return _0x88e47b;})[_0x0f0e('0x22')](respondWithFilteredResult(_0x1b1ca0,_0x475c1c))['catch'](handleError(_0x1b1ca0,null));};exports[_0x0f0e('0x40')]=function(_0x5560b2,_0x47a001){var _0x5dff88={'raw':!![],'where':{'id':_0x5560b2[_0x0f0e('0x41')]['id']}},_0x166ff2={};_0x166ff2[_0x0f0e('0x2c')]=_['keys'](db[_0x0f0e('0x3c')][_0x0f0e('0x28')]);_0x166ff2[_0x0f0e('0x2d')]=_[_0x0f0e('0x2e')](_0x5560b2[_0x0f0e('0x2d')]);_0x166ff2['filters']=_[_0x0f0e('0x30')](_0x166ff2[_0x0f0e('0x2c')],_0x166ff2[_0x0f0e('0x2d')]);_0x5dff88['attributes']=_[_0x0f0e('0x30')](_0x166ff2['model'],qs[_0x0f0e('0x32')](_0x5560b2[_0x0f0e('0x2d')]['fields']));_0x5dff88[_0x0f0e('0x31')]=_0x5dff88[_0x0f0e('0x31')]['length']?_0x5dff88['attributes']:_0x166ff2[_0x0f0e('0x2c')];if(_0x5560b2['query'][_0x0f0e('0x3d')]){_0x5dff88[_0x0f0e('0x42')]=[{'all':!![]}];}_0x5dff88=_[_0x0f0e('0x3a')]({},_0x5dff88,_0x5560b2[_0x0f0e('0x3b')]);return db[_0x0f0e('0x3c')]['find'](_0x5dff88)[_0x0f0e('0x22')](handleEntityNotFound(_0x47a001,null))[_0x0f0e('0x22')](respondWithResult(_0x47a001,null))[_0x0f0e('0x43')](handleError(_0x47a001,null));};exports[_0x0f0e('0x44')]=function(_0x4bf729,_0xf948e7){return db[_0x0f0e('0x3c')][_0x0f0e('0x44')](_0x4bf729[_0x0f0e('0x45')],{})[_0x0f0e('0x22')](respondWithResult(_0xf948e7,0xc9))[_0x0f0e('0x43')](handleError(_0xf948e7,null));};exports[_0x0f0e('0x21')]=function(_0x176e6c,_0x1eb466){if(_0x176e6c[_0x0f0e('0x45')]['id']){delete _0x176e6c[_0x0f0e('0x45')]['id'];}return db[_0x0f0e('0x3c')][_0x0f0e('0x46')]({'where':{'id':_0x176e6c[_0x0f0e('0x41')]['id']}})[_0x0f0e('0x22')](handleEntityNotFound(_0x1eb466,null))[_0x0f0e('0x22')](saveUpdates(_0x176e6c['body'],null))[_0x0f0e('0x22')](respondWithResult(_0x1eb466,null))[_0x0f0e('0x43')](handleError(_0x1eb466,null));};exports[_0x0f0e('0x47')]=function(_0x213b0b,_0x3311b8){return db['MailServerOut']['find']({'where':{'id':_0x213b0b[_0x0f0e('0x41')]['id']}})[_0x0f0e('0x22')](handleEntityNotFound(_0x3311b8,null))['then'](removeEntity(_0x3311b8,null))[_0x0f0e('0x43')](handleError(_0x3311b8,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index c55a899..35431a6 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 _0x687b=['rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x40f46f,_0x16bba2){var _0x9d21a=function(_0x2ad948){while(--_0x2ad948){_0x40f46f['push'](_0x40f46f['shift']());}};_0x9d21a(++_0x16bba2);}(_0x687b,0x14a));var _0xb687=function(_0x849e7c,_0x34014e){_0x849e7c=_0x849e7c-0x0;var _0x11722f=_0x687b[_0x849e7c];return _0x11722f;};'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 fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','MailServerOut','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./mailServerOut.attributes'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_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 logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'mail_servers_out','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 b45d1f1..a063edc 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 _0x468d=['then','info','request\x20sent','debug','stringify','error','code','MailServerOut,\x20%s,\x20%s','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x330f4f,_0x5e1023){var _0x8914ae=function(_0x22ee57){while(--_0x22ee57){_0x330f4f['push'](_0x330f4f['shift']());}};_0x8914ae(++_0x5e1023);}(_0x468d,0x106));var _0xd468=function(_0x4e68b2,_0x5e92f4){_0x4e68b2=_0x4e68b2-0x0;var _0x58cdb4=_0x468d[_0x4e68b2];return _0x58cdb4;};'use strict';var _=require('lodash');var util=require(_0xd468('0x0'));var moment=require('moment');var BPromise=require(_0xd468('0x1'));var rs=require(_0xd468('0x2'));var fs=require('fs');var Redis=require(_0xd468('0x3'));var db=require(_0xd468('0x4'))['db'];var utils=require(_0xd468('0x5'));var logger=require(_0xd468('0x6'))(_0xd468('0x7'));var config=require(_0xd468('0x8'));var jayson=require(_0xd468('0x9'));var client=jayson[_0xd468('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40617b,_0x43df8b,_0x2e3401){return new BPromise(function(_0x215953,_0x31699b){return client['request'](_0x40617b,_0x2e3401)[_0xd468('0xb')](function(_0x2954a2){logger[_0xd468('0xc')]('MailServerOut,\x20%s,\x20%s',_0x43df8b,_0xd468('0xd'));logger[_0xd468('0xe')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x43df8b,'request\x20sent',JSON[_0xd468('0xf')](_0x2954a2));if(_0x2954a2[_0xd468('0x10')]){if(_0x2954a2[_0xd468('0x10')][_0xd468('0x11')]===0x1f4){logger[_0xd468('0x10')](_0xd468('0x12'),_0x43df8b,_0x2954a2[_0xd468('0x10')]['message']);return _0x31699b(_0x2954a2[_0xd468('0x10')]['message']);}logger['error'](_0xd468('0x12'),_0x43df8b,_0x2954a2['error'][_0xd468('0x13')]);return _0x215953(_0x2954a2[_0xd468('0x10')][_0xd468('0x13')]);}else{logger['info'](_0xd468('0x12'),_0x43df8b,_0xd468('0xd'));_0x215953(_0x2954a2['result'][_0xd468('0x13')]);}})[_0xd468('0x14')](function(_0x172909){logger[_0xd468('0x10')](_0xd468('0x12'),_0x43df8b,_0x172909);_0x31699b(_0x172909);});});} \ No newline at end of file +var _0xb064=['rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1619ac,_0x3127b0){var _0x268695=function(_0x2f2854){while(--_0x2f2854){_0x1619ac['push'](_0x1619ac['shift']());}};_0x268695(++_0x3127b0);}(_0xb064,0x1ba));var _0x4b06=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xb064[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x4b06('0x0'));var util=require(_0x4b06('0x1'));var moment=require(_0x4b06('0x2'));var BPromise=require(_0x4b06('0x3'));var rs=require(_0x4b06('0x4'));var fs=require('fs');var Redis=require(_0x4b06('0x5'));var db=require(_0x4b06('0x6'))['db'];var utils=require(_0x4b06('0x7'));var logger=require('../../config/logger')(_0x4b06('0x8'));var config=require(_0x4b06('0x9'));var jayson=require(_0x4b06('0xa'));var client=jayson[_0x4b06('0xb')][_0x4b06('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x97f737,_0xeaf237,_0x50eac5){return new BPromise(function(_0x4278df,_0x3cda99){return client[_0x4b06('0xd')](_0x97f737,_0x50eac5)[_0x4b06('0xe')](function(_0x192570){logger['info'](_0x4b06('0xf'),_0xeaf237,_0x4b06('0x10'));logger[_0x4b06('0x11')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0xeaf237,_0x4b06('0x10'),JSON[_0x4b06('0x12')](_0x192570));if(_0x192570[_0x4b06('0x13')]){if(_0x192570[_0x4b06('0x13')][_0x4b06('0x14')]===0x1f4){logger[_0x4b06('0x13')](_0x4b06('0xf'),_0xeaf237,_0x192570[_0x4b06('0x13')]['message']);return _0x3cda99(_0x192570[_0x4b06('0x13')][_0x4b06('0x15')]);}logger[_0x4b06('0x13')](_0x4b06('0xf'),_0xeaf237,_0x192570[_0x4b06('0x13')][_0x4b06('0x15')]);return _0x4278df(_0x192570[_0x4b06('0x13')][_0x4b06('0x15')]);}else{logger[_0x4b06('0x16')](_0x4b06('0xf'),_0xeaf237,_0x4b06('0x10'));_0x4278df(_0x192570[_0x4b06('0x17')][_0x4b06('0x15')]);}})[_0x4b06('0x18')](function(_0x5e35f8){logger['error'](_0x4b06('0xf'),_0xeaf237,_0x5e35f8);_0x3cda99(_0x5e35f8);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index bb81546..df3e34c 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 _0x71f4=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailSubstatus.controller','isAuthenticated','index','get','/describe','describe','/:id','create','put','update','delete'];(function(_0x2be11b,_0x54af8){var _0x28f7e2=function(_0x33bf15){while(--_0x33bf15){_0x2be11b['push'](_0x2be11b['shift']());}};_0x28f7e2(++_0x54af8);}(_0x71f4,0xf9));var _0x471f=function(_0x8a6078,_0x5e502b){_0x8a6078=_0x8a6078-0x0;var _0x4a035d=_0x71f4[_0x8a6078];return _0x4a035d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x471f('0x0'));var timeout=require(_0x471f('0x1'));var express=require(_0x471f('0x2'));var router=express[_0x471f('0x3')]();var fs_extra=require(_0x471f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x471f('0x5'));var config=require('../../config/environment');var controller=require(_0x471f('0x6'));router['get']('/',auth[_0x471f('0x7')](),controller[_0x471f('0x8')]);router[_0x471f('0x9')](_0x471f('0xa'),auth[_0x471f('0x7')](),controller[_0x471f('0xb')]);router[_0x471f('0x9')](_0x471f('0xc'),auth[_0x471f('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x471f('0xd')]);router[_0x471f('0xe')]('/:id',auth[_0x471f('0x7')](),controller[_0x471f('0xf')]);router[_0x471f('0x10')]('/:id',auth[_0x471f('0x7')](),controller[_0x471f('0x11')]);module[_0x471f('0x12')]=router; \ No newline at end of file +var _0x352e=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put'];(function(_0x297d7b,_0x421583){var _0x2ca5e8=function(_0x31da91){while(--_0x31da91){_0x297d7b['push'](_0x297d7b['shift']());}};_0x2ca5e8(++_0x421583);}(_0x352e,0x1a6));var _0xe352=function(_0xc8cdfb,_0x41c58e){_0xc8cdfb=_0xc8cdfb-0x0;var _0x56a506=_0x352e[_0xc8cdfb];return _0x56a506;};'use strict';var multer=require(_0xe352('0x0'));var util=require(_0xe352('0x1'));var path=require(_0xe352('0x2'));var timeout=require(_0xe352('0x3'));var express=require(_0xe352('0x4'));var router=express[_0xe352('0x5')]();var fs_extra=require(_0xe352('0x6'));var auth=require(_0xe352('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe352('0x8'));var controller=require(_0xe352('0x9'));router['get']('/',auth[_0xe352('0xa')](),controller[_0xe352('0xb')]);router[_0xe352('0xc')](_0xe352('0xd'),auth['isAuthenticated'](),controller[_0xe352('0xe')]);router[_0xe352('0xc')](_0xe352('0xf'),auth[_0xe352('0xa')](),controller['show']);router[_0xe352('0x10')]('/',auth[_0xe352('0xa')](),controller[_0xe352('0x11')]);router[_0xe352('0x12')](_0xe352('0xf'),auth[_0xe352('0xa')](),controller['update']);router['delete'](_0xe352('0xf'),auth[_0xe352('0xa')](),controller[_0xe352('0x13')]);module[_0xe352('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 0f35137..35189c9 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 _0x0324=['exports','STRING','name'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0324,0x90));var _0x4032=function(_0x128e73,_0x1d4d89){_0x128e73=_0x128e73-0x0;var _0x271f24=_0x0324[_0x128e73];return _0x271f24;};'use strict';var Sequelize=require('sequelize');module[_0x4032('0x0')]={'name':{'type':Sequelize[_0x4032('0x1')],'unique':_0x4032('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4032('0x1')]}}; \ No newline at end of file +var _0x6c45=['STRING','sequelize','exports','name'];(function(_0xff615d,_0x173ee1){var _0x12e91b=function(_0x138dfa){while(--_0x138dfa){_0xff615d['push'](_0xff615d['shift']());}};_0x12e91b(++_0x173ee1);}(_0x6c45,0xb1));var _0x56c4=function(_0x38006c,_0x53ca08){_0x38006c=_0x38006c-0x0;var _0x4de9d6=_0x6c45[_0x38006c];return _0x4de9d6;};'use strict';var Sequelize=require(_0x56c4('0x0'));module[_0x56c4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x56c4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x56c4('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 74b63c2..34e4153 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 _0x17f0=['MailSubstatus','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index'];(function(_0x53efad,_0x5abb6f){var _0x3f6b1e=function(_0x591d26){while(--_0x591d26){_0x53efad['push'](_0x53efad['shift']());}};_0x3f6b1e(++_0x5abb6f);}(_0x17f0,0x1ee));var _0x017f=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x17f0[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require(_0x017f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x017f('0x1'));var jsonpatch=require(_0x017f('0x2'));var rp=require(_0x017f('0x3'));var moment=require(_0x017f('0x4'));var BPromise=require(_0x017f('0x5'));var Mustache=require(_0x017f('0x6'));var util=require(_0x017f('0x7'));var path=require(_0x017f('0x8'));var sox=require('sox');var csv=require(_0x017f('0x9'));var ejs=require(_0x017f('0xa'));var fs=require('fs');var fs_extra=require(_0x017f('0xb'));var _=require(_0x017f('0xc'));var squel=require(_0x017f('0xd'));var crypto=require(_0x017f('0xe'));var jsforce=require(_0x017f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x017f('0x9'));var querystring=require(_0x017f('0x10'));var Papa=require(_0x017f('0x11'));var Redis=require(_0x017f('0x12'));var authService=require(_0x017f('0x13'));var qs=require(_0x017f('0x14'));var as=require(_0x017f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x017f('0x16'))(_0x017f('0x17'));var utils=require(_0x017f('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x017f('0x19'))['db'];function respondWithStatusCode(_0x1c7b52,_0x3feea0){_0x3feea0=_0x3feea0||0xcc;return function(_0x2e9cac){if(_0x2e9cac){return _0x1c7b52[_0x017f('0x1a')](_0x3feea0);}return _0x1c7b52[_0x017f('0x1b')](_0x3feea0)[_0x017f('0x1c')]();};}function respondWithResult(_0x5d2c1d,_0x5a9a74){_0x5a9a74=_0x5a9a74||0xc8;return function(_0x424ca0){if(_0x424ca0){return _0x5d2c1d[_0x017f('0x1b')](_0x5a9a74)['json'](_0x424ca0);}};}function respondWithFilteredResult(_0x4b3bbb,_0x286ed){return function(_0xa5ca54){if(_0xa5ca54){var _0x11450d=typeof _0x286ed[_0x017f('0x1d')]===_0x017f('0x1e')&&typeof _0x286ed[_0x017f('0x1f')]===_0x017f('0x1e');var _0x4a6deb=_0xa5ca54[_0x017f('0x20')];var _0x12028f=_0x11450d?0x0:_0x286ed[_0x017f('0x1d')];var _0x39a9e5=_0x11450d?_0xa5ca54[_0x017f('0x20')]:_0x286ed['offset']+_0x286ed[_0x017f('0x1f')];var _0x498029;if(_0x39a9e5>=_0x4a6deb){_0x39a9e5=_0x4a6deb;_0x498029=0xc8;}else{_0x498029=0xce;}_0x4b3bbb['status'](_0x498029);return _0x4b3bbb[_0x017f('0x21')](_0x017f('0x22'),_0x12028f+'-'+_0x39a9e5+'/'+_0x4a6deb)['json'](_0xa5ca54);}return null;};}function patchUpdates(_0x431cc0){return function(_0x594ac7){try{jsonpatch[_0x017f('0x23')](_0x594ac7,_0x431cc0,!![]);}catch(_0x4e2596){return BPromise['reject'](_0x4e2596);}return _0x594ac7[_0x017f('0x24')]();};}function saveUpdates(_0x89513c,_0x133f72){return function(_0x1895b4){if(_0x1895b4){return _0x1895b4[_0x017f('0x25')](_0x89513c)[_0x017f('0x26')](function(_0x2175d9){return _0x2175d9;});}return null;};}function removeEntity(_0x185d2e,_0x4b4900){return function(_0x59a0d8){if(_0x59a0d8){return _0x59a0d8[_0x017f('0x27')]()[_0x017f('0x26')](function(){_0x185d2e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f5fab,_0x2547aa){return function(_0x20910a){if(!_0x20910a){_0x3f5fab[_0x017f('0x1a')](0x194);}return _0x20910a;};}function handleError(_0x163497,_0x5dfa20){_0x5dfa20=_0x5dfa20||0x1f4;return function(_0xa69a2){logger[_0x017f('0x28')](_0xa69a2[_0x017f('0x29')]);if(_0xa69a2[_0x017f('0x2a')]){delete _0xa69a2[_0x017f('0x2a')];}_0x163497['status'](_0x5dfa20)[_0x017f('0x2b')](_0xa69a2);};}exports[_0x017f('0x2c')]=function(_0x14f7c0,_0x1b9848){var _0x69bed3={},_0x6f28fe={},_0x6157f2={'count':0x0,'rows':[]};var _0x741df8=_['map'](db[_0x017f('0x2d')][_0x017f('0x2e')],function(_0x158b7c){return{'name':_0x158b7c[_0x017f('0x2f')],'type':_0x158b7c['type'][_0x017f('0x30')]};});_0x6f28fe['model']=_[_0x017f('0x31')](_0x741df8,_0x017f('0x2a'));_0x6f28fe[_0x017f('0x32')]=_[_0x017f('0x33')](_0x14f7c0[_0x017f('0x32')]);_0x6f28fe[_0x017f('0x34')]=_[_0x017f('0x35')](_0x6f28fe[_0x017f('0x36')],_0x6f28fe[_0x017f('0x32')]);_0x69bed3[_0x017f('0x37')]=_['intersection'](_0x6f28fe[_0x017f('0x36')],qs[_0x017f('0x38')](_0x14f7c0['query']['fields']));_0x69bed3['attributes']=_0x69bed3[_0x017f('0x37')][_0x017f('0x39')]?_0x69bed3[_0x017f('0x37')]:_0x6f28fe[_0x017f('0x36')];if(!_0x14f7c0['query'][_0x017f('0x3a')]('nolimit')){_0x69bed3[_0x017f('0x1f')]=qs[_0x017f('0x1f')](_0x14f7c0[_0x017f('0x32')][_0x017f('0x1f')]);_0x69bed3[_0x017f('0x1d')]=qs[_0x017f('0x1d')](_0x14f7c0['query'][_0x017f('0x1d')]);}_0x69bed3[_0x017f('0x3b')]=qs[_0x017f('0x3c')](_0x14f7c0['query']['sort']);_0x69bed3[_0x017f('0x3d')]=qs['filters'](_[_0x017f('0x3e')](_0x14f7c0[_0x017f('0x32')],_0x6f28fe[_0x017f('0x34')]),_0x741df8);if(_0x14f7c0['query'][_0x017f('0x3f')]){_0x69bed3[_0x017f('0x3d')]=_['merge'](_0x69bed3[_0x017f('0x3d')],{'$or':_[_0x017f('0x31')](_0x741df8,function(_0x182a38){if(_0x182a38[_0x017f('0x40')]!==_0x017f('0x41')){var _0x2da764={};_0x2da764[_0x182a38[_0x017f('0x2a')]]={'$like':'%'+_0x14f7c0[_0x017f('0x32')][_0x017f('0x3f')]+'%'};return _0x2da764;}})});}_0x69bed3=_[_0x017f('0x42')]({},_0x69bed3,_0x14f7c0[_0x017f('0x43')]);var _0x49409b={'where':_0x69bed3[_0x017f('0x3d')]};return db[_0x017f('0x2d')][_0x017f('0x20')](_0x49409b)[_0x017f('0x26')](function(_0x166e66){_0x6157f2[_0x017f('0x20')]=_0x166e66;if(_0x14f7c0[_0x017f('0x32')][_0x017f('0x44')]){_0x69bed3[_0x017f('0x45')]=[{'all':!![]}];}return db[_0x017f('0x2d')][_0x017f('0x46')](_0x69bed3);})[_0x017f('0x26')](function(_0x3c4507){_0x6157f2['rows']=_0x3c4507;return _0x6157f2;})['then'](respondWithFilteredResult(_0x1b9848,_0x69bed3))[_0x017f('0x47')](handleError(_0x1b9848,null));};exports[_0x017f('0x48')]=function(_0x381466,_0x3cef02){var _0x47c7a7={'raw':!![],'where':{'id':_0x381466[_0x017f('0x49')]['id']}},_0x29af01={};_0x29af01[_0x017f('0x36')]=_['keys'](db[_0x017f('0x2d')][_0x017f('0x2e')]);_0x29af01[_0x017f('0x32')]=_[_0x017f('0x33')](_0x381466[_0x017f('0x32')]);_0x29af01[_0x017f('0x34')]=_[_0x017f('0x35')](_0x29af01[_0x017f('0x36')],_0x29af01[_0x017f('0x32')]);_0x47c7a7[_0x017f('0x37')]=_[_0x017f('0x35')](_0x29af01[_0x017f('0x36')],qs[_0x017f('0x38')](_0x381466['query'][_0x017f('0x38')]));_0x47c7a7[_0x017f('0x37')]=_0x47c7a7[_0x017f('0x37')][_0x017f('0x39')]?_0x47c7a7[_0x017f('0x37')]:_0x29af01['model'];if(_0x381466[_0x017f('0x32')][_0x017f('0x44')]){_0x47c7a7[_0x017f('0x45')]=[{'all':!![]}];}_0x47c7a7=_['merge']({},_0x47c7a7,_0x381466['options']);return db[_0x017f('0x2d')][_0x017f('0x4a')](_0x47c7a7)[_0x017f('0x26')](handleEntityNotFound(_0x3cef02,null))[_0x017f('0x26')](respondWithResult(_0x3cef02,null))[_0x017f('0x47')](handleError(_0x3cef02,null));};exports[_0x017f('0x4b')]=function(_0x3c42e7,_0x10be21){return db['MailSubstatus'][_0x017f('0x4b')](_0x3c42e7[_0x017f('0x4c')],{})[_0x017f('0x26')](respondWithResult(_0x10be21,0xc9))[_0x017f('0x47')](handleError(_0x10be21,null));};exports[_0x017f('0x25')]=function(_0x5b9d4b,_0x4686e7){if(_0x5b9d4b['body']['id']){delete _0x5b9d4b[_0x017f('0x4c')]['id'];}return db[_0x017f('0x2d')][_0x017f('0x4a')]({'where':{'id':_0x5b9d4b[_0x017f('0x49')]['id']}})[_0x017f('0x26')](handleEntityNotFound(_0x4686e7,null))[_0x017f('0x26')](saveUpdates(_0x5b9d4b['body'],null))['then'](respondWithResult(_0x4686e7,null))[_0x017f('0x47')](handleError(_0x4686e7,null));};exports[_0x017f('0x27')]=function(_0x423990,_0x39c9fe){return db[_0x017f('0x2d')][_0x017f('0x4a')]({'where':{'id':_0x423990['params']['id']}})[_0x017f('0x26')](handleEntityNotFound(_0x39c9fe,null))[_0x017f('0x26')](removeEntity(_0x39c9fe,null))[_0x017f('0x47')](handleError(_0x39c9fe,null));};exports['describe']=function(_0x18d80d,_0xeeafde){return db['MailSubstatus']['describe']()['then'](respondWithResult(_0xeeafde,null))[_0x017f('0x47')](handleError(_0xeeafde,null));}; \ No newline at end of file +var _0x622d=['save','update','then','end','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','filter','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject'];(function(_0xce6839,_0x68cd47){var _0x4f15e7=function(_0x4079af){while(--_0x4079af){_0xce6839['push'](_0xce6839['shift']());}};_0x4f15e7(++_0x68cd47);}(_0x622d,0x19a));var _0xd622=function(_0x451ca2,_0x27e9ea){_0x451ca2=_0x451ca2-0x0;var _0x270b48=_0x622d[_0x451ca2];return _0x270b48;};'use strict';var emlformat=require(_0xd622('0x0'));var rimraf=require(_0xd622('0x1'));var zipdir=require(_0xd622('0x2'));var jsonpatch=require(_0xd622('0x3'));var rp=require(_0xd622('0x4'));var moment=require(_0xd622('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd622('0x6'));var util=require(_0xd622('0x7'));var path=require('path');var sox=require(_0xd622('0x8'));var csv=require(_0xd622('0x9'));var ejs=require(_0xd622('0xa'));var fs=require('fs');var fs_extra=require(_0xd622('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd622('0xc'));var jsforce=require(_0xd622('0xd'));var deskjs=require(_0xd622('0xe'));var toCsv=require(_0xd622('0x9'));var querystring=require(_0xd622('0xf'));var Papa=require('papaparse');var Redis=require(_0xd622('0x10'));var authService=require(_0xd622('0x11'));var qs=require(_0xd622('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd622('0x13'));var logger=require('../../config/logger')(_0xd622('0x14'));var utils=require(_0xd622('0x15'));var config=require(_0xd622('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd622('0x17'))['db'];function respondWithStatusCode(_0x4dd8a3,_0x88c79f){_0x88c79f=_0x88c79f||0xcc;return function(_0x2db4ec){if(_0x2db4ec){return _0x4dd8a3[_0xd622('0x18')](_0x88c79f);}return _0x4dd8a3[_0xd622('0x19')](_0x88c79f)['end']();};}function respondWithResult(_0x36bc48,_0x49cfaf){_0x49cfaf=_0x49cfaf||0xc8;return function(_0x20d9f4){if(_0x20d9f4){return _0x36bc48[_0xd622('0x19')](_0x49cfaf)[_0xd622('0x1a')](_0x20d9f4);}};}function respondWithFilteredResult(_0x2d4a96,_0x1828fe){return function(_0x291e3f){if(_0x291e3f){var _0x2ef8a3=typeof _0x1828fe[_0xd622('0x1b')]===_0xd622('0x1c')&&typeof _0x1828fe['limit']===_0xd622('0x1c');var _0x1a6cbb=_0x291e3f[_0xd622('0x1d')];var _0x25f2c9=_0x2ef8a3?0x0:_0x1828fe[_0xd622('0x1b')];var _0xe7efa=_0x2ef8a3?_0x291e3f[_0xd622('0x1d')]:_0x1828fe[_0xd622('0x1b')]+_0x1828fe['limit'];var _0x2c02cf;if(_0xe7efa>=_0x1a6cbb){_0xe7efa=_0x1a6cbb;_0x2c02cf=0xc8;}else{_0x2c02cf=0xce;}_0x2d4a96[_0xd622('0x19')](_0x2c02cf);return _0x2d4a96[_0xd622('0x1e')](_0xd622('0x1f'),_0x25f2c9+'-'+_0xe7efa+'/'+_0x1a6cbb)[_0xd622('0x1a')](_0x291e3f);}return null;};}function patchUpdates(_0xb8c03d){return function(_0x4cfc71){try{jsonpatch[_0xd622('0x20')](_0x4cfc71,_0xb8c03d,!![]);}catch(_0x670b8){return BPromise[_0xd622('0x21')](_0x670b8);}return _0x4cfc71[_0xd622('0x22')]();};}function saveUpdates(_0x42264b,_0x40cc20){return function(_0x1abb33){if(_0x1abb33){return _0x1abb33[_0xd622('0x23')](_0x42264b)[_0xd622('0x24')](function(_0x527141){return _0x527141;});}return null;};}function removeEntity(_0x5dcbe2,_0x40c995){return function(_0x4970a1){if(_0x4970a1){return _0x4970a1['destroy']()['then'](function(){_0x5dcbe2['status'](0xcc)[_0xd622('0x25')]();});}};}function handleEntityNotFound(_0x16cbbe,_0x6ccce1){return function(_0x10441e){if(!_0x10441e){_0x16cbbe['sendStatus'](0x194);}return _0x10441e;};}function handleError(_0x2dc3a3,_0x72f856){_0x72f856=_0x72f856||0x1f4;return function(_0x169e7b){logger[_0xd622('0x26')](_0x169e7b[_0xd622('0x27')]);if(_0x169e7b['name']){delete _0x169e7b[_0xd622('0x28')];}_0x2dc3a3['status'](_0x72f856)[_0xd622('0x29')](_0x169e7b);};}exports[_0xd622('0x2a')]=function(_0x3c02fe,_0x2c4147){var _0x4aa59c={},_0x4d97cb={},_0x48a438={'count':0x0,'rows':[]};var _0xb0de6d=_[_0xd622('0x2b')](db[_0xd622('0x2c')][_0xd622('0x2d')],function(_0x7a0ac9){return{'name':_0x7a0ac9[_0xd622('0x2e')],'type':_0x7a0ac9[_0xd622('0x2f')]['key']};});_0x4d97cb[_0xd622('0x30')]=_[_0xd622('0x2b')](_0xb0de6d,_0xd622('0x28'));_0x4d97cb[_0xd622('0x31')]=_[_0xd622('0x32')](_0x3c02fe[_0xd622('0x31')]);_0x4d97cb['filters']=_[_0xd622('0x33')](_0x4d97cb[_0xd622('0x30')],_0x4d97cb[_0xd622('0x31')]);_0x4aa59c[_0xd622('0x34')]=_[_0xd622('0x33')](_0x4d97cb[_0xd622('0x30')],qs[_0xd622('0x35')](_0x3c02fe['query']['fields']));_0x4aa59c['attributes']=_0x4aa59c[_0xd622('0x34')][_0xd622('0x36')]?_0x4aa59c[_0xd622('0x34')]:_0x4d97cb[_0xd622('0x30')];if(!_0x3c02fe[_0xd622('0x31')][_0xd622('0x37')](_0xd622('0x38'))){_0x4aa59c[_0xd622('0x39')]=qs[_0xd622('0x39')](_0x3c02fe[_0xd622('0x31')]['limit']);_0x4aa59c['offset']=qs[_0xd622('0x1b')](_0x3c02fe[_0xd622('0x31')][_0xd622('0x1b')]);}_0x4aa59c['order']=qs['sort'](_0x3c02fe['query'][_0xd622('0x3a')]);_0x4aa59c[_0xd622('0x3b')]=qs[_0xd622('0x3c')](_['pick'](_0x3c02fe[_0xd622('0x31')],_0x4d97cb[_0xd622('0x3c')]),_0xb0de6d);if(_0x3c02fe[_0xd622('0x31')][_0xd622('0x3d')]){_0x4aa59c['where']=_['merge'](_0x4aa59c['where'],{'$or':_[_0xd622('0x2b')](_0xb0de6d,function(_0x388615){if(_0x388615[_0xd622('0x2f')]!==_0xd622('0x3e')){var _0x2a7b99={};_0x2a7b99[_0x388615[_0xd622('0x28')]]={'$like':'%'+_0x3c02fe[_0xd622('0x31')][_0xd622('0x3d')]+'%'};return _0x2a7b99;}})});}_0x4aa59c=_['merge']({},_0x4aa59c,_0x3c02fe['options']);var _0x358cc8={'where':_0x4aa59c[_0xd622('0x3b')]};return db[_0xd622('0x2c')][_0xd622('0x1d')](_0x358cc8)[_0xd622('0x24')](function(_0x1a6fce){_0x48a438[_0xd622('0x1d')]=_0x1a6fce;if(_0x3c02fe[_0xd622('0x31')]['includeAll']){_0x4aa59c[_0xd622('0x3f')]=[{'all':!![]}];}return db['MailSubstatus'][_0xd622('0x40')](_0x4aa59c);})[_0xd622('0x24')](function(_0x18e52e){_0x48a438[_0xd622('0x41')]=_0x18e52e;return _0x48a438;})[_0xd622('0x24')](respondWithFilteredResult(_0x2c4147,_0x4aa59c))[_0xd622('0x42')](handleError(_0x2c4147,null));};exports[_0xd622('0x43')]=function(_0x45addf,_0x539276){var _0x300c7b={'raw':!![],'where':{'id':_0x45addf[_0xd622('0x44')]['id']}},_0x34fa71={};_0x34fa71[_0xd622('0x30')]=_[_0xd622('0x32')](db[_0xd622('0x2c')][_0xd622('0x2d')]);_0x34fa71[_0xd622('0x31')]=_[_0xd622('0x32')](_0x45addf[_0xd622('0x31')]);_0x34fa71[_0xd622('0x3c')]=_[_0xd622('0x33')](_0x34fa71[_0xd622('0x30')],_0x34fa71['query']);_0x300c7b[_0xd622('0x34')]=_[_0xd622('0x33')](_0x34fa71['model'],qs[_0xd622('0x35')](_0x45addf[_0xd622('0x31')][_0xd622('0x35')]));_0x300c7b['attributes']=_0x300c7b['attributes'][_0xd622('0x36')]?_0x300c7b[_0xd622('0x34')]:_0x34fa71[_0xd622('0x30')];if(_0x45addf[_0xd622('0x31')][_0xd622('0x45')]){_0x300c7b[_0xd622('0x3f')]=[{'all':!![]}];}_0x300c7b=_['merge']({},_0x300c7b,_0x45addf['options']);return db[_0xd622('0x2c')]['find'](_0x300c7b)[_0xd622('0x24')](handleEntityNotFound(_0x539276,null))[_0xd622('0x24')](respondWithResult(_0x539276,null))['catch'](handleError(_0x539276,null));};exports[_0xd622('0x46')]=function(_0x32297e,_0x5f4210){return db[_0xd622('0x2c')][_0xd622('0x46')](_0x32297e[_0xd622('0x47')],{})[_0xd622('0x24')](respondWithResult(_0x5f4210,0xc9))[_0xd622('0x42')](handleError(_0x5f4210,null));};exports[_0xd622('0x23')]=function(_0x5ae762,_0xcee086){if(_0x5ae762['body']['id']){delete _0x5ae762['body']['id'];}return db[_0xd622('0x2c')][_0xd622('0x48')]({'where':{'id':_0x5ae762[_0xd622('0x44')]['id']}})[_0xd622('0x24')](handleEntityNotFound(_0xcee086,null))[_0xd622('0x24')](saveUpdates(_0x5ae762[_0xd622('0x47')],null))['then'](respondWithResult(_0xcee086,null))[_0xd622('0x42')](handleError(_0xcee086,null));};exports['destroy']=function(_0xdd134,_0x229ac5){return db['MailSubstatus'][_0xd622('0x48')]({'where':{'id':_0xdd134[_0xd622('0x44')]['id']}})[_0xd622('0x24')](handleEntityNotFound(_0x229ac5,null))[_0xd622('0x24')](removeEntity(_0x229ac5,null))[_0xd622('0x42')](handleError(_0x229ac5,null));};exports[_0xd622('0x49')]=function(_0x47d81c,_0x1263c6){return db[_0xd622('0x2c')]['describe']()[_0xd622('0x24')](respondWithResult(_0x1263c6,null))[_0xd622('0x42')](handleError(_0x1263c6,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 207f74f..71daa82 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 _0x8603=['util','../../config/logger','api','request-promise','path','rimraf','./mailSubstatus.attributes','define','MailSubstatus','mail_substatuses'];(function(_0x71c6b0,_0xeee233){var _0x1a0285=function(_0x12f266){while(--_0x12f266){_0x71c6b0['push'](_0x71c6b0['shift']());}};_0x1a0285(++_0xeee233);}(_0x8603,0x190));var _0x3860=function(_0x5591df,_0x98bf25){_0x5591df=_0x5591df-0x0;var _0x3b4fc6=_0x8603[_0x5591df];return _0x3b4fc6;};'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 fs=require('fs');var path=require(_0x3860('0x4'));var rimraf=require(_0x3860('0x5'));var config=require('../../config/environment');var attributes=require(_0x3860('0x6'));module['exports']=function(_0xb0fc24,_0x40739b){return _0xb0fc24[_0x3860('0x7')](_0x3860('0x8'),attributes,{'tableName':_0x3860('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb846=['request-promise','../../config/environment','./mailSubstatus.attributes','exports','mail_substatuses','lodash','api','moment','bluebird'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0xb846,0x1d0));var _0x6b84=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xb846[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x6b84('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6b84('0x1'));var moment=require(_0x6b84('0x2'));var BPromise=require(_0x6b84('0x3'));var rp=require(_0x6b84('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6b84('0x5'));var attributes=require(_0x6b84('0x6'));module[_0x6b84('0x7')]=function(_0x3448d0,_0x31856c){return _0x3448d0['define']('MailSubstatus',attributes,{'tableName':_0x6b84('0x8'),'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 0e466b6..29dca48 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 _0x22fb=['MailSubstatus,\x20%s,\x20%s,\x20%s','code','message','error','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x161468,_0x14e2f4){var _0x46c59a=function(_0xa3fa90){while(--_0xa3fa90){_0x161468['push'](_0x161468['shift']());}};_0x46c59a(++_0x14e2f4);}(_0x22fb,0x192));var _0xb22f=function(_0x39e94e,_0x547dec){_0x39e94e=_0x39e94e-0x0;var _0x18f74e=_0x22fb[_0x39e94e];return _0x18f74e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x412a95,_0x367d4b,_0x47f61a){return new BPromise(function(_0x34433b,_0x22c509){return client[_0xb22f('0xa')](_0x412a95,_0x47f61a)[_0xb22f('0xb')](function(_0x1a3aae){logger[_0xb22f('0xc')](_0xb22f('0xd'),_0x367d4b,_0xb22f('0xe'));logger[_0xb22f('0xf')](_0xb22f('0x10'),_0x367d4b,_0xb22f('0xe'),JSON['stringify'](_0x1a3aae));if(_0x1a3aae['error']){if(_0x1a3aae['error'][_0xb22f('0x11')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x367d4b,_0x1a3aae['error'][_0xb22f('0x12')]);return _0x22c509(_0x1a3aae[_0xb22f('0x13')][_0xb22f('0x12')]);}logger[_0xb22f('0x13')](_0xb22f('0xd'),_0x367d4b,_0x1a3aae[_0xb22f('0x13')]['message']);return _0x34433b(_0x1a3aae[_0xb22f('0x13')]['message']);}else{logger[_0xb22f('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x367d4b,_0xb22f('0xe'));_0x34433b(_0x1a3aae[_0xb22f('0x14')][_0xb22f('0x12')]);}})[_0xb22f('0x15')](function(_0x447eaf){logger['error'](_0xb22f('0xd'),_0x367d4b,_0x447eaf);_0x22c509(_0x447eaf);});});} \ No newline at end of file +var _0xb58b=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird'];(function(_0x215576,_0x2b3b52){var _0x434ebd=function(_0x371e72){while(--_0x371e72){_0x215576['push'](_0x215576['shift']());}};_0x434ebd(++_0x2b3b52);}(_0xb58b,0x1f1));var _0xbb58=function(_0x56387f,_0x46b179){_0x56387f=_0x56387f-0x0;var _0x327d46=_0xb58b[_0x56387f];return _0x327d46;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var moment=require(_0xbb58('0x1'));var BPromise=require(_0xbb58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb58('0x3'));var db=require(_0xbb58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb58('0x5'))('rpc');var config=require(_0xbb58('0x6'));var jayson=require(_0xbb58('0x7'));var client=jayson[_0xbb58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27cbda,_0x323066,_0xe874f2){return new BPromise(function(_0x5d7fe8,_0xd94f1){return client[_0xbb58('0x9')](_0x27cbda,_0xe874f2)[_0xbb58('0xa')](function(_0x36ca50){logger[_0xbb58('0xb')](_0xbb58('0xc'),_0x323066,_0xbb58('0xd'));logger['debug'](_0xbb58('0xe'),_0x323066,'request\x20sent',JSON[_0xbb58('0xf')](_0x36ca50));if(_0x36ca50[_0xbb58('0x10')]){if(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x11')]===0x1f4){logger['error'](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0xd94f1(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}logger[_0xbb58('0x10')](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0x5d7fe8(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x323066,_0xbb58('0xd'));_0x5d7fe8(_0x36ca50[_0xbb58('0x13')][_0xbb58('0x12')]);}})['catch'](function(_0x5edc97){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x323066,_0x5edc97);_0xd94f1(_0x5edc97);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index a921092..1bc6226 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 _0xf9bb=['isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get'];(function(_0x1fc2a0,_0x4a208a){var _0x16446d=function(_0x366e4d){while(--_0x366e4d){_0x1fc2a0['push'](_0x1fc2a0['shift']());}};_0x16446d(++_0x4a208a);}(_0xf9bb,0x14d));var _0xbf9b=function(_0x3b8363,_0x17bc8){_0x3b8363=_0x3b8363-0x0;var _0x4d8289=_0xf9bb[_0x3b8363];return _0x4d8289;};'use strict';var multer=require(_0xbf9b('0x0'));var util=require(_0xbf9b('0x1'));var path=require(_0xbf9b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbf9b('0x3'));var router=express[_0xbf9b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf9b('0x5'));var config=require(_0xbf9b('0x6'));var controller=require(_0xbf9b('0x7'));router[_0xbf9b('0x8')]('/',auth[_0xbf9b('0x9')](),controller[_0xbf9b('0xa')]);router['get']('/describe',auth[_0xbf9b('0x9')](),controller['describe']);router[_0xbf9b('0x8')](_0xbf9b('0xb'),auth[_0xbf9b('0x9')](),controller[_0xbf9b('0xc')]);router[_0xbf9b('0xd')]('/',auth[_0xbf9b('0x9')](),controller[_0xbf9b('0xe')]);router['put'](_0xbf9b('0xb'),auth[_0xbf9b('0x9')](),controller[_0xbf9b('0xf')]);router[_0xbf9b('0x10')](_0xbf9b('0xb'),auth[_0xbf9b('0x9')](),controller['destroy']);module[_0xbf9b('0x11')]=router; \ No newline at end of file +var _0x8d08=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','isAuthenticated','show','post','create','put','delete','/:id'];(function(_0x272427,_0x6ffc68){var _0x30f430=function(_0x1d3710){while(--_0x1d3710){_0x272427['push'](_0x272427['shift']());}};_0x30f430(++_0x6ffc68);}(_0x8d08,0x118));var _0x88d0=function(_0x4dae00,_0x15b194){_0x4dae00=_0x4dae00-0x0;var _0x16bf42=_0x8d08[_0x4dae00];return _0x16bf42;};'use strict';var multer=require(_0x88d0('0x0'));var util=require(_0x88d0('0x1'));var path=require(_0x88d0('0x2'));var timeout=require(_0x88d0('0x3'));var express=require(_0x88d0('0x4'));var router=express[_0x88d0('0x5')]();var fs_extra=require(_0x88d0('0x6'));var auth=require(_0x88d0('0x7'));var interaction=require(_0x88d0('0x8'));var config=require(_0x88d0('0x9'));var controller=require(_0x88d0('0xa'));router[_0x88d0('0xb')]('/',auth['isAuthenticated'](),controller[_0x88d0('0xc')]);router[_0x88d0('0xb')]('/describe',auth[_0x88d0('0xd')](),controller['describe']);router[_0x88d0('0xb')]('/:id',auth[_0x88d0('0xd')](),controller[_0x88d0('0xe')]);router[_0x88d0('0xf')]('/',auth['isAuthenticated'](),controller[_0x88d0('0x10')]);router[_0x88d0('0x11')]('/:id',auth[_0x88d0('0xd')](),controller['update']);router[_0x88d0('0x12')](_0x88d0('0x13'),auth[_0x88d0('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 68140d9..70aa2c6 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 _0xd120=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x201301,_0x95c6eb){var _0xfc7a2a=function(_0x3e2cf1){while(--_0x3e2cf1){_0x201301['push'](_0x201301['shift']());}};_0xfc7a2a(++_0x95c6eb);}(_0xd120,0xd4));var _0x0d12=function(_0x33da39,_0x2cfe14){_0x33da39=_0x33da39-0x0;var _0x115b74=_0xd120[_0x33da39];return _0x115b74;};'use strict';var moment=require(_0x0d12('0x0'));var Sequelize=require(_0x0d12('0x1'));module[_0x0d12('0x2')]={'uniqueid':{'type':Sequelize[_0x0d12('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0d12('0x4'),_0x0d12('0x5'),_0x0d12('0x6')),'allowNull':![],'defaultValue':_0x0d12('0x6')},'transferredAt':{'type':Sequelize[_0x0d12('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x0d12('0x8')]}}; \ No newline at end of file +var _0xe0ef=['queue','DATE','NOW','sequelize','exports','STRING','ENUM','account','agent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe0ef,0x9c));var _0xfe0e=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xe0ef[_0x4e676e];return _0x336a3c;};'use strict';var moment=require('moment');var Sequelize=require(_0xfe0e('0x0'));module[_0xfe0e('0x1')]={'uniqueid':{'type':Sequelize[_0xfe0e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xfe0e('0x3')](_0xfe0e('0x4'),_0xfe0e('0x5'),_0xfe0e('0x6')),'allowNull':![],'defaultValue':_0xfe0e('0x6')},'transferredAt':{'type':Sequelize[_0xfe0e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xfe0e('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index cb0190b..bba335a 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 _0x8532=['count','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit'];(function(_0xa627ba,_0x3ad71b){var _0x45db82=function(_0x1eaa28){while(--_0x1eaa28){_0xa627ba['push'](_0xa627ba['shift']());}};_0x45db82(++_0x3ad71b);}(_0x8532,0x1f3));var _0x2853=function(_0x17c5f6,_0x4f3fd6){_0x17c5f6=_0x17c5f6-0x0;var _0x13aaa9=_0x8532[_0x17c5f6];return _0x13aaa9;};'use strict';var emlformat=require(_0x2853('0x0'));var rimraf=require(_0x2853('0x1'));var zipdir=require(_0x2853('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2853('0x3'));var moment=require('moment');var BPromise=require(_0x2853('0x4'));var Mustache=require(_0x2853('0x5'));var util=require(_0x2853('0x6'));var path=require(_0x2853('0x7'));var sox=require(_0x2853('0x8'));var csv=require(_0x2853('0x9'));var ejs=require(_0x2853('0xa'));var fs=require('fs');var fs_extra=require(_0x2853('0xb'));var _=require(_0x2853('0xc'));var squel=require(_0x2853('0xd'));var crypto=require(_0x2853('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2853('0xf'));var toCsv=require(_0x2853('0x9'));var querystring=require(_0x2853('0x10'));var Papa=require('papaparse');var Redis=require(_0x2853('0x11'));var authService=require(_0x2853('0x12'));var qs=require(_0x2853('0x13'));var as=require(_0x2853('0x14'));var hardwareService=require(_0x2853('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x2853('0x16'));var config=require(_0x2853('0x17'));var licenseUtil=require(_0x2853('0x18'));var db=require(_0x2853('0x19'))['db'];function respondWithStatusCode(_0x307ad8,_0x69da43){_0x69da43=_0x69da43||0xcc;return function(_0x393cbc){if(_0x393cbc){return _0x307ad8[_0x2853('0x1a')](_0x69da43);}return _0x307ad8['status'](_0x69da43)[_0x2853('0x1b')]();};}function respondWithResult(_0x10cc75,_0x387604){_0x387604=_0x387604||0xc8;return function(_0x13f281){if(_0x13f281){return _0x10cc75[_0x2853('0x1c')](_0x387604)[_0x2853('0x1d')](_0x13f281);}};}function respondWithFilteredResult(_0x4abb18,_0x8ddee){return function(_0x54424b){if(_0x54424b){var _0x360988=typeof _0x8ddee[_0x2853('0x1e')]===_0x2853('0x1f')&&typeof _0x8ddee[_0x2853('0x20')]===_0x2853('0x1f');var _0x1b2c99=_0x54424b['count'];var _0x55b1fd=_0x360988?0x0:_0x8ddee['offset'];var _0x467052=_0x360988?_0x54424b[_0x2853('0x21')]:_0x8ddee[_0x2853('0x1e')]+_0x8ddee[_0x2853('0x20')];var _0x136a52;if(_0x467052>=_0x1b2c99){_0x467052=_0x1b2c99;_0x136a52=0xc8;}else{_0x136a52=0xce;}_0x4abb18[_0x2853('0x1c')](_0x136a52);return _0x4abb18[_0x2853('0x22')](_0x2853('0x23'),_0x55b1fd+'-'+_0x467052+'/'+_0x1b2c99)[_0x2853('0x1d')](_0x54424b);}return null;};}function patchUpdates(_0x354d41){return function(_0x335960){try{jsonpatch[_0x2853('0x24')](_0x335960,_0x354d41,!![]);}catch(_0xf8315c){return BPromise[_0x2853('0x25')](_0xf8315c);}return _0x335960['save']();};}function saveUpdates(_0x30334c,_0x212a9a){return function(_0x5def5b){if(_0x5def5b){return _0x5def5b[_0x2853('0x26')](_0x30334c)['then'](function(_0x2da23d){return _0x2da23d;});}return null;};}function removeEntity(_0x659023,_0x5c5c62){return function(_0xe9b353){if(_0xe9b353){return _0xe9b353[_0x2853('0x27')]()[_0x2853('0x28')](function(){_0x659023[_0x2853('0x1c')](0xcc)[_0x2853('0x1b')]();});}};}function handleEntityNotFound(_0x2ee070,_0x1fe570){return function(_0x18dbe0){if(!_0x18dbe0){_0x2ee070['sendStatus'](0x194);}return _0x18dbe0;};}function handleError(_0x27e151,_0x529bf4){_0x529bf4=_0x529bf4||0x1f4;return function(_0x4adb68){logger['error'](_0x4adb68[_0x2853('0x29')]);if(_0x4adb68[_0x2853('0x2a')]){delete _0x4adb68[_0x2853('0x2a')];}_0x27e151['status'](_0x529bf4)[_0x2853('0x2b')](_0x4adb68);};}exports[_0x2853('0x2c')]=function(_0x3c413c,_0x19dcd2){var _0xfea338={},_0x1a7e3a={},_0x3b4960={'count':0x0,'rows':[]};var _0x4ae0b7=_[_0x2853('0x2d')](db[_0x2853('0x2e')][_0x2853('0x2f')],function(_0x26a699){return{'name':_0x26a699[_0x2853('0x30')],'type':_0x26a699[_0x2853('0x31')][_0x2853('0x32')]};});_0x1a7e3a[_0x2853('0x33')]=_[_0x2853('0x2d')](_0x4ae0b7,_0x2853('0x2a'));_0x1a7e3a[_0x2853('0x34')]=_['keys'](_0x3c413c['query']);_0x1a7e3a[_0x2853('0x35')]=_[_0x2853('0x36')](_0x1a7e3a[_0x2853('0x33')],_0x1a7e3a[_0x2853('0x34')]);_0xfea338['attributes']=_[_0x2853('0x36')](_0x1a7e3a[_0x2853('0x33')],qs[_0x2853('0x37')](_0x3c413c[_0x2853('0x34')][_0x2853('0x37')]));_0xfea338[_0x2853('0x38')]=_0xfea338['attributes'][_0x2853('0x39')]?_0xfea338[_0x2853('0x38')]:_0x1a7e3a[_0x2853('0x33')];if(!_0x3c413c[_0x2853('0x34')][_0x2853('0x3a')]('nolimit')){_0xfea338['limit']=qs[_0x2853('0x20')](_0x3c413c[_0x2853('0x34')][_0x2853('0x20')]);_0xfea338[_0x2853('0x1e')]=qs['offset'](_0x3c413c[_0x2853('0x34')][_0x2853('0x1e')]);}_0xfea338[_0x2853('0x3b')]=qs[_0x2853('0x3c')](_0x3c413c[_0x2853('0x34')][_0x2853('0x3c')]);_0xfea338[_0x2853('0x3d')]=qs[_0x2853('0x35')](_[_0x2853('0x3e')](_0x3c413c[_0x2853('0x34')],_0x1a7e3a[_0x2853('0x35')]),_0x4ae0b7);if(_0x3c413c[_0x2853('0x34')][_0x2853('0x3f')]){_0xfea338['where']=_[_0x2853('0x40')](_0xfea338['where'],{'$or':_['map'](_0x4ae0b7,function(_0x9247b3){if(_0x9247b3[_0x2853('0x31')]!==_0x2853('0x41')){var _0x208623={};_0x208623[_0x9247b3[_0x2853('0x2a')]]={'$like':'%'+_0x3c413c[_0x2853('0x34')][_0x2853('0x3f')]+'%'};return _0x208623;}})});}_0xfea338=_[_0x2853('0x40')]({},_0xfea338,_0x3c413c['options']);var _0x5bd985={'where':_0xfea338[_0x2853('0x3d')]};return db['MailTransferReport'][_0x2853('0x21')](_0x5bd985)['then'](function(_0x4dc692){_0x3b4960[_0x2853('0x21')]=_0x4dc692;if(_0x3c413c[_0x2853('0x34')][_0x2853('0x42')]){_0xfea338[_0x2853('0x43')]=[{'all':!![]}];}return db[_0x2853('0x2e')]['findAll'](_0xfea338);})['then'](function(_0xc95671){_0x3b4960['rows']=_0xc95671;return _0x3b4960;})[_0x2853('0x28')](respondWithFilteredResult(_0x19dcd2,_0xfea338))[_0x2853('0x44')](handleError(_0x19dcd2,null));};exports[_0x2853('0x45')]=function(_0x30bc39,_0x3f0f9b){var _0x3dd191={'raw':!![],'where':{'id':_0x30bc39['params']['id']}},_0x5419e7={};_0x5419e7[_0x2853('0x33')]=_[_0x2853('0x46')](db[_0x2853('0x2e')][_0x2853('0x2f')]);_0x5419e7[_0x2853('0x34')]=_[_0x2853('0x46')](_0x30bc39[_0x2853('0x34')]);_0x5419e7[_0x2853('0x35')]=_['intersection'](_0x5419e7[_0x2853('0x33')],_0x5419e7[_0x2853('0x34')]);_0x3dd191[_0x2853('0x38')]=_[_0x2853('0x36')](_0x5419e7['model'],qs[_0x2853('0x37')](_0x30bc39[_0x2853('0x34')][_0x2853('0x37')]));_0x3dd191[_0x2853('0x38')]=_0x3dd191[_0x2853('0x38')][_0x2853('0x39')]?_0x3dd191[_0x2853('0x38')]:_0x5419e7['model'];if(_0x30bc39[_0x2853('0x34')][_0x2853('0x42')]){_0x3dd191[_0x2853('0x43')]=[{'all':!![]}];}_0x3dd191=_[_0x2853('0x40')]({},_0x3dd191,_0x30bc39['options']);return db[_0x2853('0x2e')][_0x2853('0x47')](_0x3dd191)[_0x2853('0x28')](handleEntityNotFound(_0x3f0f9b,null))[_0x2853('0x28')](respondWithResult(_0x3f0f9b,null))[_0x2853('0x44')](handleError(_0x3f0f9b,null));};exports[_0x2853('0x48')]=function(_0x232d1c,_0x21d0c4){return db['MailTransferReport'][_0x2853('0x48')](_0x232d1c[_0x2853('0x49')],{})[_0x2853('0x28')](respondWithResult(_0x21d0c4,0xc9))[_0x2853('0x44')](handleError(_0x21d0c4,null));};exports[_0x2853('0x26')]=function(_0x2a3acb,_0x492bb9){if(_0x2a3acb[_0x2853('0x49')]['id']){delete _0x2a3acb[_0x2853('0x49')]['id'];}return db[_0x2853('0x2e')][_0x2853('0x47')]({'where':{'id':_0x2a3acb[_0x2853('0x4a')]['id']}})[_0x2853('0x28')](handleEntityNotFound(_0x492bb9,null))[_0x2853('0x28')](saveUpdates(_0x2a3acb[_0x2853('0x49')],null))['then'](respondWithResult(_0x492bb9,null))[_0x2853('0x44')](handleError(_0x492bb9,null));};exports['destroy']=function(_0xf33d29,_0x4a5600){return db[_0x2853('0x2e')][_0x2853('0x47')]({'where':{'id':_0xf33d29[_0x2853('0x4a')]['id']}})[_0x2853('0x28')](handleEntityNotFound(_0x4a5600,null))['then'](removeEntity(_0x4a5600,null))[_0x2853('0x44')](handleError(_0x4a5600,null));};exports[_0x2853('0x4b')]=function(_0x5686a3,_0x2a648f){return db[_0x2853('0x2e')][_0x2853('0x4b')]()['then'](respondWithResult(_0x2a648f,null))[_0x2853('0x44')](handleError(_0x2a648f,null));}; \ No newline at end of file +var _0x7f0d=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','end','error','stack','name','send','index','map','MailTransferReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','rows','catch','show','rawAttributes','includeAll','find','create','body','destroy','params','describe','eml-format'];(function(_0x6148ee,_0x4d2fca){var _0x5afc74=function(_0x351621){while(--_0x351621){_0x6148ee['push'](_0x6148ee['shift']());}};_0x5afc74(++_0x4d2fca);}(_0x7f0d,0x13b));var _0xd7f0=function(_0x350892,_0x43c6bd){_0x350892=_0x350892-0x0;var _0x1828c6=_0x7f0d[_0x350892];return _0x1828c6;};'use strict';var emlformat=require(_0xd7f0('0x0'));var rimraf=require(_0xd7f0('0x1'));var zipdir=require(_0xd7f0('0x2'));var jsonpatch=require(_0xd7f0('0x3'));var rp=require('request-promise');var moment=require(_0xd7f0('0x4'));var BPromise=require(_0xd7f0('0x5'));var Mustache=require(_0xd7f0('0x6'));var util=require(_0xd7f0('0x7'));var path=require(_0xd7f0('0x8'));var sox=require(_0xd7f0('0x9'));var csv=require(_0xd7f0('0xa'));var ejs=require(_0xd7f0('0xb'));var fs=require('fs');var fs_extra=require(_0xd7f0('0xc'));var _=require(_0xd7f0('0xd'));var squel=require('squel');var crypto=require(_0xd7f0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd7f0('0xf'));var toCsv=require(_0xd7f0('0xa'));var querystring=require(_0xd7f0('0x10'));var Papa=require(_0xd7f0('0x11'));var Redis=require('ioredis');var authService=require(_0xd7f0('0x12'));var qs=require(_0xd7f0('0x13'));var as=require(_0xd7f0('0x14'));var hardwareService=require(_0xd7f0('0x15'));var logger=require(_0xd7f0('0x16'))(_0xd7f0('0x17'));var utils=require(_0xd7f0('0x18'));var config=require(_0xd7f0('0x19'));var licenseUtil=require(_0xd7f0('0x1a'));var db=require(_0xd7f0('0x1b'))['db'];function respondWithStatusCode(_0x4b7688,_0x2ab659){_0x2ab659=_0x2ab659||0xcc;return function(_0x24a350){if(_0x24a350){return _0x4b7688[_0xd7f0('0x1c')](_0x2ab659);}return _0x4b7688[_0xd7f0('0x1d')](_0x2ab659)['end']();};}function respondWithResult(_0x9605dd,_0x140cdd){_0x140cdd=_0x140cdd||0xc8;return function(_0x54ca5b){if(_0x54ca5b){return _0x9605dd[_0xd7f0('0x1d')](_0x140cdd)['json'](_0x54ca5b);}};}function respondWithFilteredResult(_0x676cba,_0x4f80d4){return function(_0x53df22){if(_0x53df22){var _0x2d9fec=typeof _0x4f80d4[_0xd7f0('0x1e')]===_0xd7f0('0x1f')&&typeof _0x4f80d4[_0xd7f0('0x20')]===_0xd7f0('0x1f');var _0x52fac7=_0x53df22['count'];var _0x351696=_0x2d9fec?0x0:_0x4f80d4[_0xd7f0('0x1e')];var _0x2ffdd1=_0x2d9fec?_0x53df22[_0xd7f0('0x21')]:_0x4f80d4[_0xd7f0('0x1e')]+_0x4f80d4[_0xd7f0('0x20')];var _0x3a0fa6;if(_0x2ffdd1>=_0x52fac7){_0x2ffdd1=_0x52fac7;_0x3a0fa6=0xc8;}else{_0x3a0fa6=0xce;}_0x676cba[_0xd7f0('0x1d')](_0x3a0fa6);return _0x676cba[_0xd7f0('0x22')]('Content-Range',_0x351696+'-'+_0x2ffdd1+'/'+_0x52fac7)[_0xd7f0('0x23')](_0x53df22);}return null;};}function patchUpdates(_0x34f290){return function(_0x11ee13){try{jsonpatch[_0xd7f0('0x24')](_0x11ee13,_0x34f290,!![]);}catch(_0x22399a){return BPromise[_0xd7f0('0x25')](_0x22399a);}return _0x11ee13[_0xd7f0('0x26')]();};}function saveUpdates(_0x4ce722,_0x168fa0){return function(_0x28c04d){if(_0x28c04d){return _0x28c04d[_0xd7f0('0x27')](_0x4ce722)[_0xd7f0('0x28')](function(_0x58953a){return _0x58953a;});}return null;};}function removeEntity(_0x2894ee,_0x44a8c5){return function(_0x856023){if(_0x856023){return _0x856023['destroy']()[_0xd7f0('0x28')](function(){_0x2894ee[_0xd7f0('0x1d')](0xcc)[_0xd7f0('0x29')]();});}};}function handleEntityNotFound(_0x2a898a,_0xfba7a3){return function(_0x2f6d70){if(!_0x2f6d70){_0x2a898a['sendStatus'](0x194);}return _0x2f6d70;};}function handleError(_0x1566af,_0x8d152d){_0x8d152d=_0x8d152d||0x1f4;return function(_0x281d6c){logger[_0xd7f0('0x2a')](_0x281d6c[_0xd7f0('0x2b')]);if(_0x281d6c[_0xd7f0('0x2c')]){delete _0x281d6c[_0xd7f0('0x2c')];}_0x1566af[_0xd7f0('0x1d')](_0x8d152d)[_0xd7f0('0x2d')](_0x281d6c);};}exports[_0xd7f0('0x2e')]=function(_0x54719e,_0x58f35c){var _0x535391={},_0x160048={},_0xdb1f23={'count':0x0,'rows':[]};var _0x161244=_[_0xd7f0('0x2f')](db[_0xd7f0('0x30')]['rawAttributes'],function(_0x2d987b){return{'name':_0x2d987b[_0xd7f0('0x31')],'type':_0x2d987b[_0xd7f0('0x32')]['key']};});_0x160048[_0xd7f0('0x33')]=_[_0xd7f0('0x2f')](_0x161244,_0xd7f0('0x2c'));_0x160048[_0xd7f0('0x34')]=_[_0xd7f0('0x35')](_0x54719e[_0xd7f0('0x34')]);_0x160048[_0xd7f0('0x36')]=_[_0xd7f0('0x37')](_0x160048[_0xd7f0('0x33')],_0x160048[_0xd7f0('0x34')]);_0x535391[_0xd7f0('0x38')]=_[_0xd7f0('0x37')](_0x160048[_0xd7f0('0x33')],qs[_0xd7f0('0x39')](_0x54719e[_0xd7f0('0x34')][_0xd7f0('0x39')]));_0x535391[_0xd7f0('0x38')]=_0x535391[_0xd7f0('0x38')][_0xd7f0('0x3a')]?_0x535391[_0xd7f0('0x38')]:_0x160048[_0xd7f0('0x33')];if(!_0x54719e[_0xd7f0('0x34')][_0xd7f0('0x3b')](_0xd7f0('0x3c'))){_0x535391['limit']=qs[_0xd7f0('0x20')](_0x54719e[_0xd7f0('0x34')][_0xd7f0('0x20')]);_0x535391[_0xd7f0('0x1e')]=qs[_0xd7f0('0x1e')](_0x54719e[_0xd7f0('0x34')][_0xd7f0('0x1e')]);}_0x535391[_0xd7f0('0x3d')]=qs['sort'](_0x54719e['query'][_0xd7f0('0x3e')]);_0x535391[_0xd7f0('0x3f')]=qs[_0xd7f0('0x36')](_['pick'](_0x54719e[_0xd7f0('0x34')],_0x160048[_0xd7f0('0x36')]),_0x161244);if(_0x54719e[_0xd7f0('0x34')][_0xd7f0('0x40')]){_0x535391['where']=_[_0xd7f0('0x41')](_0x535391['where'],{'$or':_['map'](_0x161244,function(_0x254b60){if(_0x254b60['type']!=='VIRTUAL'){var _0x51caac={};_0x51caac[_0x254b60[_0xd7f0('0x2c')]]={'$like':'%'+_0x54719e[_0xd7f0('0x34')][_0xd7f0('0x40')]+'%'};return _0x51caac;}})});}_0x535391=_[_0xd7f0('0x41')]({},_0x535391,_0x54719e[_0xd7f0('0x42')]);var _0x1fd5d8={'where':_0x535391[_0xd7f0('0x3f')]};return db[_0xd7f0('0x30')]['count'](_0x1fd5d8)['then'](function(_0xe70e86){_0xdb1f23[_0xd7f0('0x21')]=_0xe70e86;if(_0x54719e['query']['includeAll']){_0x535391[_0xd7f0('0x43')]=[{'all':!![]}];}return db[_0xd7f0('0x30')]['findAll'](_0x535391);})[_0xd7f0('0x28')](function(_0x2aa22f){_0xdb1f23[_0xd7f0('0x44')]=_0x2aa22f;return _0xdb1f23;})[_0xd7f0('0x28')](respondWithFilteredResult(_0x58f35c,_0x535391))[_0xd7f0('0x45')](handleError(_0x58f35c,null));};exports[_0xd7f0('0x46')]=function(_0x29e8a3,_0x5f2481){var _0x2e3012={'raw':!![],'where':{'id':_0x29e8a3['params']['id']}},_0x31818b={};_0x31818b[_0xd7f0('0x33')]=_[_0xd7f0('0x35')](db[_0xd7f0('0x30')][_0xd7f0('0x47')]);_0x31818b[_0xd7f0('0x34')]=_[_0xd7f0('0x35')](_0x29e8a3[_0xd7f0('0x34')]);_0x31818b[_0xd7f0('0x36')]=_['intersection'](_0x31818b[_0xd7f0('0x33')],_0x31818b[_0xd7f0('0x34')]);_0x2e3012[_0xd7f0('0x38')]=_[_0xd7f0('0x37')](_0x31818b['model'],qs[_0xd7f0('0x39')](_0x29e8a3[_0xd7f0('0x34')][_0xd7f0('0x39')]));_0x2e3012[_0xd7f0('0x38')]=_0x2e3012[_0xd7f0('0x38')][_0xd7f0('0x3a')]?_0x2e3012[_0xd7f0('0x38')]:_0x31818b[_0xd7f0('0x33')];if(_0x29e8a3[_0xd7f0('0x34')][_0xd7f0('0x48')]){_0x2e3012[_0xd7f0('0x43')]=[{'all':!![]}];}_0x2e3012=_['merge']({},_0x2e3012,_0x29e8a3[_0xd7f0('0x42')]);return db[_0xd7f0('0x30')][_0xd7f0('0x49')](_0x2e3012)[_0xd7f0('0x28')](handleEntityNotFound(_0x5f2481,null))['then'](respondWithResult(_0x5f2481,null))[_0xd7f0('0x45')](handleError(_0x5f2481,null));};exports[_0xd7f0('0x4a')]=function(_0x59ec16,_0x2f662b){return db[_0xd7f0('0x30')]['create'](_0x59ec16['body'],{})['then'](respondWithResult(_0x2f662b,0xc9))[_0xd7f0('0x45')](handleError(_0x2f662b,null));};exports[_0xd7f0('0x27')]=function(_0x30cc5a,_0x3647de){if(_0x30cc5a[_0xd7f0('0x4b')]['id']){delete _0x30cc5a[_0xd7f0('0x4b')]['id'];}return db['MailTransferReport'][_0xd7f0('0x49')]({'where':{'id':_0x30cc5a['params']['id']}})[_0xd7f0('0x28')](handleEntityNotFound(_0x3647de,null))[_0xd7f0('0x28')](saveUpdates(_0x30cc5a[_0xd7f0('0x4b')],null))[_0xd7f0('0x28')](respondWithResult(_0x3647de,null))['catch'](handleError(_0x3647de,null));};exports[_0xd7f0('0x4c')]=function(_0x22459b,_0x46a712){return db[_0xd7f0('0x30')][_0xd7f0('0x49')]({'where':{'id':_0x22459b[_0xd7f0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x46a712,null))[_0xd7f0('0x28')](removeEntity(_0x46a712,null))[_0xd7f0('0x45')](handleError(_0x46a712,null));};exports[_0xd7f0('0x4e')]=function(_0x55ae29,_0x49dc9b){return db['MailTransferReport'][_0xd7f0('0x4e')]()[_0xd7f0('0x28')](respondWithResult(_0x49dc9b,null))[_0xd7f0('0x45')](handleError(_0x49dc9b,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index ed277e8..811c434 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 _0xd3d3=['exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x15e073,_0x336cbe){var _0x2826f1=function(_0x170058){while(--_0x170058){_0x15e073['push'](_0x15e073['shift']());}};_0x2826f1(++_0x336cbe);}(_0xd3d3,0xd7));var _0x3d3d=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xd3d3[_0x456fb1];return _0x4083d6;};'use strict';var _=require('lodash');var util=require(_0x3d3d('0x0'));var logger=require(_0x3d3d('0x1'))(_0x3d3d('0x2'));var moment=require(_0x3d3d('0x3'));var BPromise=require(_0x3d3d('0x4'));var rp=require(_0x3d3d('0x5'));var fs=require('fs');var path=require(_0x3d3d('0x6'));var rimraf=require(_0x3d3d('0x7'));var config=require(_0x3d3d('0x8'));var attributes=require('./mailTransferReport.attributes');module[_0x3d3d('0x9')]=function(_0x262fe8,_0x5671de){return _0x262fe8[_0x3d3d('0xa')](_0x3d3d('0xb'),attributes,{'tableName':_0x3d3d('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3d3d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x576c=['report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport'];(function(_0x60739a,_0x2308ef){var _0x540fe6=function(_0x330f64){while(--_0x330f64){_0x60739a['push'](_0x60739a['shift']());}};_0x540fe6(++_0x2308ef);}(_0x576c,0x1c9));var _0xc576=function(_0x1a455c,_0x3e182c){_0x1a455c=_0x1a455c-0x0;var _0x5d5a35=_0x576c[_0x1a455c];return _0x5d5a35;};'use strict';var _=require(_0xc576('0x0'));var util=require(_0xc576('0x1'));var logger=require(_0xc576('0x2'))(_0xc576('0x3'));var moment=require(_0xc576('0x4'));var BPromise=require('bluebird');var rp=require(_0xc576('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc576('0x6'));var config=require(_0xc576('0x7'));var attributes=require(_0xc576('0x8'));module['exports']=function(_0x1894eb,_0x1a88ce){return _0x1894eb[_0xc576('0x9')](_0xc576('0xa'),attributes,{'tableName':_0xc576('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc576('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 0129363..9861205 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 _0x47d6=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x3fb150,_0x5e32ed){var _0x56f4a8=function(_0x57924c){while(--_0x57924c){_0x3fb150['push'](_0x3fb150['shift']());}};_0x56f4a8(++_0x5e32ed);}(_0x47d6,0x13d));var _0x647d=function(_0x4ad578,_0x4ff3f4){_0x4ad578=_0x4ad578-0x0;var _0x142f67=_0x47d6[_0x4ad578];return _0x142f67;};'use strict';var _=require('lodash');var util=require(_0x647d('0x0'));var moment=require(_0x647d('0x1'));var BPromise=require(_0x647d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x647d('0x3'))['db'];var utils=require(_0x647d('0x4'));var logger=require(_0x647d('0x5'))(_0x647d('0x6'));var config=require('../../config/environment');var jayson=require(_0x647d('0x7'));var client=jayson[_0x647d('0x8')][_0x647d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x500979,_0x30828b,_0xcff1a5){return new BPromise(function(_0x37a42b,_0x3aeb8b){return client[_0x647d('0xa')](_0x500979,_0xcff1a5)[_0x647d('0xb')](function(_0x1db35c){logger[_0x647d('0xc')](_0x647d('0xd'),_0x30828b,_0x647d('0xe'));logger[_0x647d('0xf')](_0x647d('0x10'),_0x30828b,_0x647d('0xe'),JSON[_0x647d('0x11')](_0x1db35c));if(_0x1db35c[_0x647d('0x12')]){if(_0x1db35c[_0x647d('0x12')][_0x647d('0x13')]===0x1f4){logger[_0x647d('0x12')](_0x647d('0xd'),_0x30828b,_0x1db35c[_0x647d('0x12')][_0x647d('0x14')]);return _0x3aeb8b(_0x1db35c[_0x647d('0x12')]['message']);}logger['error'](_0x647d('0xd'),_0x30828b,_0x1db35c['error'][_0x647d('0x14')]);return _0x37a42b(_0x1db35c[_0x647d('0x12')]['message']);}else{logger[_0x647d('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x30828b,_0x647d('0xe'));_0x37a42b(_0x1db35c[_0x647d('0x15')][_0x647d('0x14')]);}})[_0x647d('0x16')](function(_0xa45749){logger[_0x647d('0x12')](_0x647d('0xd'),_0x30828b,_0xa45749);_0x3aeb8b(_0xa45749);});});} \ No newline at end of file +var _0x7c74=['catch','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x505378,_0x209853){var _0x260405=function(_0x3bbd18){while(--_0x3bbd18){_0x505378['push'](_0x505378['shift']());}};_0x260405(++_0x209853);}(_0x7c74,0x191));var _0x47c7=function(_0x151553,_0x295f9c){_0x151553=_0x151553-0x0;var _0x1a0ad6=_0x7c74[_0x151553];return _0x1a0ad6;};'use strict';var _=require(_0x47c7('0x0'));var util=require('util');var moment=require(_0x47c7('0x1'));var BPromise=require(_0x47c7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x47c7('0x3'));var logger=require(_0x47c7('0x4'))(_0x47c7('0x5'));var config=require(_0x47c7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x47c7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x157227,_0x26bf36,_0x500cbf){return new BPromise(function(_0x4826b2,_0x383d58){return client[_0x47c7('0x8')](_0x157227,_0x500cbf)[_0x47c7('0x9')](function(_0x24af63){logger[_0x47c7('0xa')](_0x47c7('0xb'),_0x26bf36,'request\x20sent');logger[_0x47c7('0xc')](_0x47c7('0xd'),_0x26bf36,_0x47c7('0xe'),JSON[_0x47c7('0xf')](_0x24af63));if(_0x24af63['error']){if(_0x24af63[_0x47c7('0x10')]['code']===0x1f4){logger[_0x47c7('0x10')](_0x47c7('0xb'),_0x26bf36,_0x24af63['error'][_0x47c7('0x11')]);return _0x383d58(_0x24af63[_0x47c7('0x10')]['message']);}logger[_0x47c7('0x10')](_0x47c7('0xb'),_0x26bf36,_0x24af63[_0x47c7('0x10')][_0x47c7('0x11')]);return _0x4826b2(_0x24af63['error'][_0x47c7('0x11')]);}else{logger[_0x47c7('0xa')](_0x47c7('0xb'),_0x26bf36,'request\x20sent');_0x4826b2(_0x24af63[_0x47c7('0x12')][_0x47c7('0x11')]);}})[_0x47c7('0x13')](function(_0x2f4eb7){logger[_0x47c7('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x26bf36,_0x2f4eb7);_0x383d58(_0x2f4eb7);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index c4101fa..a823f66 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 _0x8380=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','exports','multer','path'];(function(_0x39106e,_0x586f3d){var _0x892aec=function(_0xded1b5){while(--_0xded1b5){_0x39106e['push'](_0x39106e['shift']());}};_0x892aec(++_0x586f3d);}(_0x8380,0x139));var _0x0838=function(_0x26b953,_0xfa1bba){_0x26b953=_0x26b953-0x0;var _0x3a5b69=_0x8380[_0x26b953];return _0x3a5b69;};'use strict';var multer=require(_0x0838('0x0'));var util=require('util');var path=require(_0x0838('0x1'));var timeout=require(_0x0838('0x2'));var express=require(_0x0838('0x3'));var router=express[_0x0838('0x4')]();var fs_extra=require(_0x0838('0x5'));var auth=require(_0x0838('0x6'));var interaction=require(_0x0838('0x7'));var config=require(_0x0838('0x8'));var controller=require('./memberReport.controller');router[_0x0838('0x9')]('/',auth[_0x0838('0xa')](),controller[_0x0838('0xb')]);router[_0x0838('0x9')](_0x0838('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x0838('0xd'),auth['isAuthenticated'](),controller[_0x0838('0xe')]);router[_0x0838('0xf')]('/',auth[_0x0838('0xa')](),controller[_0x0838('0x10')]);router[_0x0838('0x11')](_0x0838('0xd'),auth[_0x0838('0xa')](),controller[_0x0838('0x12')]);router['delete'](_0x0838('0xd'),auth[_0x0838('0xa')](),controller[_0x0838('0x13')]);module[_0x0838('0x14')]=router; \ No newline at end of file +var _0x933c=['get','isAuthenticated','describe','show','create','put','/:id','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x933c,0x99));var _0xc933=function(_0x1ec355,_0x312bb4){_0x1ec355=_0x1ec355-0x0;var _0x13fdd8=_0x933c[_0x1ec355];return _0x13fdd8;};'use strict';var multer=require(_0xc933('0x0'));var util=require(_0xc933('0x1'));var path=require(_0xc933('0x2'));var timeout=require(_0xc933('0x3'));var express=require(_0xc933('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc933('0x5'));var interaction=require(_0xc933('0x6'));var config=require(_0xc933('0x7'));var controller=require(_0xc933('0x8'));router[_0xc933('0x9')]('/',auth[_0xc933('0xa')](),controller['index']);router[_0xc933('0x9')]('/describe',auth[_0xc933('0xa')](),controller[_0xc933('0xb')]);router['get']('/:id',auth[_0xc933('0xa')](),controller[_0xc933('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc933('0xd')]);router[_0xc933('0xe')](_0xc933('0xf'),auth[_0xc933('0xa')](),controller[_0xc933('0x10')]);router[_0xc933('0x11')](_0xc933('0xf'),auth[_0xc933('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index df74ffe..5599a0c 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 _0x5849=['INTEGER','DATE','getDataValue','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0x35df55,_0x5173e4){var _0x43f2b7=function(_0x2b8507){while(--_0x2b8507){_0x35df55['push'](_0x35df55['shift']());}};_0x43f2b7(++_0x5173e4);}(_0x5849,0x199));var _0x9584=function(_0x5b5a82,_0x5b171f){_0x5b5a82=_0x5b5a82-0x0;var _0x3a28fd=_0x5849[_0x5b5a82];return _0x3a28fd;};'use strict';var Sequelize=require(_0x9584('0x0'));var moment=require('moment');module[_0x9584('0x1')]={'channel':{'type':Sequelize[_0x9584('0x2')]},'membername':{'type':Sequelize[_0x9584('0x2')]},'interface':{'type':Sequelize[_0x9584('0x2')]},'type':{'type':Sequelize[_0x9584('0x2')],'defaultValue':_0x9584('0x3'),'comment':_0x9584('0x4')},'duration':{'type':Sequelize[_0x9584('0x5')]},'enterAt':{'type':Sequelize[_0x9584('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x3f43e8){var _0xdd96bb=moment(_0x3f43e8);var _0x5da09c=moment(this[_0x9584('0x7')]('enterAt'));var _0x268201=_0xdd96bb[_0x9584('0x8')](_0x5da09c,_0x9584('0x9'));this[_0x9584('0xa')](_0x9584('0xb'),_0x3f43e8);this[_0x9584('0xa')](_0x9584('0xc'),_0x268201||null);}},'data1':{'type':Sequelize[_0x9584('0x2')],'comment':_0x9584('0xd')},'data2':{'type':Sequelize['STRING'],'comment':_0x9584('0xe')},'data3':{'type':Sequelize[_0x9584('0x2')],'comment':_0x9584('0xf')},'data4':{'type':Sequelize[_0x9584('0x2')],'comment':_0x9584('0x10')},'data5':{'type':Sequelize[_0x9584('0x2')],'comment':_0x9584('0x11')},'role':{'type':Sequelize[_0x9584('0x2')]},'internal':{'type':Sequelize[_0x9584('0x5')]},'uniqueid':{'type':Sequelize[_0x9584('0x2')]}}; \ No newline at end of file +var _0x5006=['DATE','getDataValue','enterAt','diff','seconds','exitAt','setDataValue','duration','talk:[start]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','INTEGER'];(function(_0x1353ae,_0x2abba7){var _0x4ae816=function(_0x5cea92){while(--_0x5cea92){_0x1353ae['push'](_0x1353ae['shift']());}};_0x4ae816(++_0x2abba7);}(_0x5006,0x13b));var _0x6500=function(_0x1d398f,_0x5d77ab){_0x1d398f=_0x1d398f-0x0;var _0x55553b=_0x5006[_0x1d398f];return _0x55553b;};'use strict';var Sequelize=require(_0x6500('0x0'));var moment=require(_0x6500('0x1'));module[_0x6500('0x2')]={'channel':{'type':Sequelize[_0x6500('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x6500('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x6500('0x4')]},'enterAt':{'type':Sequelize[_0x6500('0x5')]},'exitAt':{'type':Sequelize[_0x6500('0x5')],'set':function(_0x5a16e8){var _0x279aea=moment(_0x5a16e8);var _0x147b96=moment(this[_0x6500('0x6')](_0x6500('0x7')));var _0xbdfd53=_0x279aea[_0x6500('0x8')](_0x147b96,_0x6500('0x9'));this['setDataValue'](_0x6500('0xa'),_0x5a16e8);this[_0x6500('0xb')](_0x6500('0xc'),_0xbdfd53||null);}},'data1':{'type':Sequelize[_0x6500('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0x6500('0xd')},'data3':{'type':Sequelize[_0x6500('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':_0x6500('0xe')},'data5':{'type':Sequelize[_0x6500('0x3')],'comment':_0x6500('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x6500('0x4')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 10596bc..ec84d59 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 _0x53f3=['show','params','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','index','MemberReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','rows'];(function(_0x956c06,_0x654da9){var _0x309403=function(_0x1508a7){while(--_0x1508a7){_0x956c06['push'](_0x956c06['shift']());}};_0x309403(++_0x654da9);}(_0x53f3,0x174));var _0x353f=function(_0x4dd232,_0x2a5d02){_0x4dd232=_0x4dd232-0x0;var _0x24898b=_0x53f3[_0x4dd232];return _0x24898b;};'use strict';var emlformat=require(_0x353f('0x0'));var rimraf=require(_0x353f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x353f('0x2'));var rp=require('request-promise');var moment=require(_0x353f('0x3'));var BPromise=require(_0x353f('0x4'));var Mustache=require(_0x353f('0x5'));var util=require('util');var path=require(_0x353f('0x6'));var sox=require(_0x353f('0x7'));var csv=require(_0x353f('0x8'));var ejs=require(_0x353f('0x9'));var fs=require('fs');var fs_extra=require(_0x353f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x353f('0xb'));var jsforce=require(_0x353f('0xc'));var deskjs=require(_0x353f('0xd'));var toCsv=require(_0x353f('0x8'));var querystring=require(_0x353f('0xe'));var Papa=require(_0x353f('0xf'));var Redis=require(_0x353f('0x10'));var authService=require(_0x353f('0x11'));var qs=require(_0x353f('0x12'));var as=require(_0x353f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x353f('0x14'))('api');var utils=require(_0x353f('0x15'));var config=require(_0x353f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x353f('0x17'))['db'];function respondWithStatusCode(_0x47fdae,_0xfc62fc){_0xfc62fc=_0xfc62fc||0xcc;return function(_0x4d0d02){if(_0x4d0d02){return _0x47fdae[_0x353f('0x18')](_0xfc62fc);}return _0x47fdae['status'](_0xfc62fc)[_0x353f('0x19')]();};}function respondWithResult(_0x112b0f,_0x1d5f03){_0x1d5f03=_0x1d5f03||0xc8;return function(_0x12b9f6){if(_0x12b9f6){return _0x112b0f[_0x353f('0x1a')](_0x1d5f03)[_0x353f('0x1b')](_0x12b9f6);}};}function respondWithFilteredResult(_0x16133a,_0x2d3f71){return function(_0x4f9690){if(_0x4f9690){var _0x5f01d7=typeof _0x2d3f71[_0x353f('0x1c')]===_0x353f('0x1d')&&typeof _0x2d3f71[_0x353f('0x1e')]===_0x353f('0x1d');var _0x524f75=_0x4f9690[_0x353f('0x1f')];var _0x2fe51f=_0x5f01d7?0x0:_0x2d3f71[_0x353f('0x1c')];var _0x1e8c1e=_0x5f01d7?_0x4f9690[_0x353f('0x1f')]:_0x2d3f71[_0x353f('0x1c')]+_0x2d3f71[_0x353f('0x1e')];var _0x3cd72e;if(_0x1e8c1e>=_0x524f75){_0x1e8c1e=_0x524f75;_0x3cd72e=0xc8;}else{_0x3cd72e=0xce;}_0x16133a[_0x353f('0x1a')](_0x3cd72e);return _0x16133a[_0x353f('0x20')]('Content-Range',_0x2fe51f+'-'+_0x1e8c1e+'/'+_0x524f75)[_0x353f('0x1b')](_0x4f9690);}return null;};}function patchUpdates(_0x4ac06c){return function(_0x338da2){try{jsonpatch[_0x353f('0x21')](_0x338da2,_0x4ac06c,!![]);}catch(_0x236662){return BPromise['reject'](_0x236662);}return _0x338da2[_0x353f('0x22')]();};}function saveUpdates(_0x22d5b5,_0x30f51b){return function(_0x367e2a){if(_0x367e2a){return _0x367e2a[_0x353f('0x23')](_0x22d5b5)[_0x353f('0x24')](function(_0x5dbd47){return _0x5dbd47;});}return null;};}function removeEntity(_0x5302b5,_0x1f2fbe){return function(_0x2e5872){if(_0x2e5872){return _0x2e5872['destroy']()['then'](function(){_0x5302b5['status'](0xcc)[_0x353f('0x19')]();});}};}function handleEntityNotFound(_0x193bd2,_0x138d05){return function(_0x3e9624){if(!_0x3e9624){_0x193bd2[_0x353f('0x18')](0x194);}return _0x3e9624;};}function handleError(_0x422375,_0x470af1){_0x470af1=_0x470af1||0x1f4;return function(_0x3fa10e){logger[_0x353f('0x25')](_0x3fa10e[_0x353f('0x26')]);if(_0x3fa10e[_0x353f('0x27')]){delete _0x3fa10e[_0x353f('0x27')];}_0x422375[_0x353f('0x1a')](_0x470af1)['send'](_0x3fa10e);};}exports[_0x353f('0x28')]=function(_0x2da6de,_0x188a17){var _0x330c11={},_0x3f0e92={},_0x1ef0cb={'count':0x0,'rows':[]};var _0x1ea3d6=_['map'](db[_0x353f('0x29')][_0x353f('0x2a')],function(_0x193d2c){return{'name':_0x193d2c[_0x353f('0x2b')],'type':_0x193d2c['type']['key']};});_0x3f0e92[_0x353f('0x2c')]=_['map'](_0x1ea3d6,_0x353f('0x27'));_0x3f0e92[_0x353f('0x2d')]=_[_0x353f('0x2e')](_0x2da6de[_0x353f('0x2d')]);_0x3f0e92[_0x353f('0x2f')]=_[_0x353f('0x30')](_0x3f0e92[_0x353f('0x2c')],_0x3f0e92[_0x353f('0x2d')]);_0x330c11[_0x353f('0x31')]=_[_0x353f('0x30')](_0x3f0e92['model'],qs['fields'](_0x2da6de[_0x353f('0x2d')][_0x353f('0x32')]));_0x330c11[_0x353f('0x31')]=_0x330c11[_0x353f('0x31')][_0x353f('0x33')]?_0x330c11[_0x353f('0x31')]:_0x3f0e92[_0x353f('0x2c')];if(!_0x2da6de[_0x353f('0x2d')][_0x353f('0x34')](_0x353f('0x35'))){_0x330c11[_0x353f('0x1e')]=qs[_0x353f('0x1e')](_0x2da6de['query'][_0x353f('0x1e')]);_0x330c11[_0x353f('0x1c')]=qs['offset'](_0x2da6de[_0x353f('0x2d')][_0x353f('0x1c')]);}_0x330c11[_0x353f('0x36')]=qs[_0x353f('0x37')](_0x2da6de[_0x353f('0x2d')]['sort']);_0x330c11['where']=qs[_0x353f('0x2f')](_[_0x353f('0x38')](_0x2da6de[_0x353f('0x2d')],_0x3f0e92[_0x353f('0x2f')]),_0x1ea3d6);if(_0x2da6de[_0x353f('0x2d')][_0x353f('0x39')]){_0x330c11[_0x353f('0x3a')]=_[_0x353f('0x3b')](_0x330c11['where'],{'$or':_[_0x353f('0x3c')](_0x1ea3d6,function(_0x351a81){if(_0x351a81['type']!==_0x353f('0x3d')){var _0x3093f8={};_0x3093f8[_0x351a81[_0x353f('0x27')]]={'$like':'%'+_0x2da6de['query']['filter']+'%'};return _0x3093f8;}})});}_0x330c11=_[_0x353f('0x3b')]({},_0x330c11,_0x2da6de[_0x353f('0x3e')]);var _0x29a158={'where':_0x330c11[_0x353f('0x3a')]};return db[_0x353f('0x29')][_0x353f('0x1f')](_0x29a158)[_0x353f('0x24')](function(_0xe968f9){_0x1ef0cb['count']=_0xe968f9;if(_0x2da6de[_0x353f('0x2d')][_0x353f('0x3f')]){_0x330c11[_0x353f('0x40')]=[{'all':!![]}];}return db[_0x353f('0x29')]['findAll'](_0x330c11);})['then'](function(_0x5a7074){_0x1ef0cb[_0x353f('0x41')]=_0x5a7074;return _0x1ef0cb;})['then'](respondWithFilteredResult(_0x188a17,_0x330c11))['catch'](handleError(_0x188a17,null));};exports[_0x353f('0x42')]=function(_0x37ced7,_0x43087f){var _0x5c0e84={'raw':!![],'where':{'id':_0x37ced7[_0x353f('0x43')]['id']}},_0x5d7085={};_0x5d7085[_0x353f('0x2c')]=_[_0x353f('0x2e')](db[_0x353f('0x29')]['rawAttributes']);_0x5d7085[_0x353f('0x2d')]=_[_0x353f('0x2e')](_0x37ced7['query']);_0x5d7085['filters']=_[_0x353f('0x30')](_0x5d7085[_0x353f('0x2c')],_0x5d7085[_0x353f('0x2d')]);_0x5c0e84[_0x353f('0x31')]=_['intersection'](_0x5d7085['model'],qs[_0x353f('0x32')](_0x37ced7['query'][_0x353f('0x32')]));_0x5c0e84['attributes']=_0x5c0e84[_0x353f('0x31')]['length']?_0x5c0e84[_0x353f('0x31')]:_0x5d7085[_0x353f('0x2c')];if(_0x37ced7[_0x353f('0x2d')]['includeAll']){_0x5c0e84[_0x353f('0x40')]=[{'all':!![]}];}_0x5c0e84=_[_0x353f('0x3b')]({},_0x5c0e84,_0x37ced7['options']);return db[_0x353f('0x29')][_0x353f('0x44')](_0x5c0e84)['then'](handleEntityNotFound(_0x43087f,null))[_0x353f('0x24')](respondWithResult(_0x43087f,null))[_0x353f('0x45')](handleError(_0x43087f,null));};exports[_0x353f('0x46')]=function(_0x2c9fdc,_0x2259ae){return db[_0x353f('0x29')][_0x353f('0x46')](_0x2c9fdc[_0x353f('0x47')],{})[_0x353f('0x24')](respondWithResult(_0x2259ae,0xc9))[_0x353f('0x45')](handleError(_0x2259ae,null));};exports[_0x353f('0x23')]=function(_0x349d98,_0x3266b7){if(_0x349d98[_0x353f('0x47')]['id']){delete _0x349d98[_0x353f('0x47')]['id'];}return db['MemberReport'][_0x353f('0x44')]({'where':{'id':_0x349d98['params']['id']}})[_0x353f('0x24')](handleEntityNotFound(_0x3266b7,null))[_0x353f('0x24')](saveUpdates(_0x349d98[_0x353f('0x47')],null))[_0x353f('0x24')](respondWithResult(_0x3266b7,null))[_0x353f('0x45')](handleError(_0x3266b7,null));};exports['destroy']=function(_0x38948b,_0x148509){return db[_0x353f('0x29')][_0x353f('0x44')]({'where':{'id':_0x38948b[_0x353f('0x43')]['id']}})['then'](handleEntityNotFound(_0x148509,null))[_0x353f('0x24')](removeEntity(_0x148509,null))[_0x353f('0x45')](handleError(_0x148509,null));};exports[_0x353f('0x48')]=function(_0x146522,_0x1c4046){return db[_0x353f('0x29')][_0x353f('0x48')]()[_0x353f('0x24')](respondWithResult(_0x1c4046,null))['catch'](handleError(_0x1c4046,null));}; \ No newline at end of file +var _0x5fb6=['filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','MemberReport','merge','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick'];(function(_0x466082,_0x59080a){var _0x2cd2be=function(_0x28e417){while(--_0x28e417){_0x466082['push'](_0x466082['shift']());}};_0x2cd2be(++_0x59080a);}(_0x5fb6,0x1c1));var _0x65fb=function(_0xe65c8,_0x5e9904){_0xe65c8=_0xe65c8-0x0;var _0x326b48=_0x5fb6[_0xe65c8];return _0x326b48;};'use strict';var emlformat=require(_0x65fb('0x0'));var rimraf=require(_0x65fb('0x1'));var zipdir=require(_0x65fb('0x2'));var jsonpatch=require(_0x65fb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x65fb('0x4'));var path=require(_0x65fb('0x5'));var sox=require(_0x65fb('0x6'));var csv=require(_0x65fb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x65fb('0x8'));var _=require(_0x65fb('0x9'));var squel=require(_0x65fb('0xa'));var crypto=require(_0x65fb('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x65fb('0xc'));var Papa=require(_0x65fb('0xd'));var Redis=require('ioredis');var authService=require(_0x65fb('0xe'));var qs=require(_0x65fb('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x65fb('0x10'));var config=require(_0x65fb('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x65fb('0x12'))['db'];function respondWithStatusCode(_0x3a765d,_0x44f694){_0x44f694=_0x44f694||0xcc;return function(_0x15636b){if(_0x15636b){return _0x3a765d['sendStatus'](_0x44f694);}return _0x3a765d[_0x65fb('0x13')](_0x44f694)[_0x65fb('0x14')]();};}function respondWithResult(_0x5527cc,_0x55c293){_0x55c293=_0x55c293||0xc8;return function(_0xeec732){if(_0xeec732){return _0x5527cc[_0x65fb('0x13')](_0x55c293)[_0x65fb('0x15')](_0xeec732);}};}function respondWithFilteredResult(_0x10c67c,_0xefe3b5){return function(_0x29309d){if(_0x29309d){var _0x23dc2e=typeof _0xefe3b5[_0x65fb('0x16')]===_0x65fb('0x17')&&typeof _0xefe3b5[_0x65fb('0x18')]===_0x65fb('0x17');var _0x2278fc=_0x29309d[_0x65fb('0x19')];var _0x2d56f4=_0x23dc2e?0x0:_0xefe3b5['offset'];var _0x299728=_0x23dc2e?_0x29309d[_0x65fb('0x19')]:_0xefe3b5[_0x65fb('0x16')]+_0xefe3b5[_0x65fb('0x18')];var _0x93910c;if(_0x299728>=_0x2278fc){_0x299728=_0x2278fc;_0x93910c=0xc8;}else{_0x93910c=0xce;}_0x10c67c[_0x65fb('0x13')](_0x93910c);return _0x10c67c['set'](_0x65fb('0x1a'),_0x2d56f4+'-'+_0x299728+'/'+_0x2278fc)[_0x65fb('0x15')](_0x29309d);}return null;};}function patchUpdates(_0x41dcfd){return function(_0x5b0d22){try{jsonpatch[_0x65fb('0x1b')](_0x5b0d22,_0x41dcfd,!![]);}catch(_0x32c3ea){return BPromise[_0x65fb('0x1c')](_0x32c3ea);}return _0x5b0d22[_0x65fb('0x1d')]();};}function saveUpdates(_0x439ad9,_0x41155f){return function(_0x558c50){if(_0x558c50){return _0x558c50[_0x65fb('0x1e')](_0x439ad9)[_0x65fb('0x1f')](function(_0x48fadb){return _0x48fadb;});}return null;};}function removeEntity(_0xe1b5c9,_0x171f40){return function(_0x216d71){if(_0x216d71){return _0x216d71['destroy']()[_0x65fb('0x1f')](function(){_0xe1b5c9[_0x65fb('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32cd60,_0x12dc4e){return function(_0x2c55bb){if(!_0x2c55bb){_0x32cd60[_0x65fb('0x20')](0x194);}return _0x2c55bb;};}function handleError(_0x158100,_0x5cc29d){_0x5cc29d=_0x5cc29d||0x1f4;return function(_0x29a069){logger['error'](_0x29a069[_0x65fb('0x21')]);if(_0x29a069['name']){delete _0x29a069['name'];}_0x158100['status'](_0x5cc29d)[_0x65fb('0x22')](_0x29a069);};}exports[_0x65fb('0x23')]=function(_0x58c294,_0x5eccb1){var _0x52b4d9={},_0x328c24={},_0x461010={'count':0x0,'rows':[]};var _0x4a6bce=_[_0x65fb('0x24')](db['MemberReport'][_0x65fb('0x25')],function(_0x467e06){return{'name':_0x467e06[_0x65fb('0x26')],'type':_0x467e06[_0x65fb('0x27')][_0x65fb('0x28')]};});_0x328c24[_0x65fb('0x29')]=_[_0x65fb('0x24')](_0x4a6bce,_0x65fb('0x2a'));_0x328c24[_0x65fb('0x2b')]=_[_0x65fb('0x2c')](_0x58c294[_0x65fb('0x2b')]);_0x328c24[_0x65fb('0x2d')]=_[_0x65fb('0x2e')](_0x328c24['model'],_0x328c24[_0x65fb('0x2b')]);_0x52b4d9[_0x65fb('0x2f')]=_[_0x65fb('0x2e')](_0x328c24[_0x65fb('0x29')],qs['fields'](_0x58c294[_0x65fb('0x2b')][_0x65fb('0x30')]));_0x52b4d9['attributes']=_0x52b4d9[_0x65fb('0x2f')][_0x65fb('0x31')]?_0x52b4d9['attributes']:_0x328c24['model'];if(!_0x58c294[_0x65fb('0x2b')]['hasOwnProperty'](_0x65fb('0x32'))){_0x52b4d9[_0x65fb('0x18')]=qs[_0x65fb('0x18')](_0x58c294['query']['limit']);_0x52b4d9['offset']=qs[_0x65fb('0x16')](_0x58c294[_0x65fb('0x2b')][_0x65fb('0x16')]);}_0x52b4d9[_0x65fb('0x33')]=qs['sort'](_0x58c294['query'][_0x65fb('0x34')]);_0x52b4d9[_0x65fb('0x35')]=qs['filters'](_[_0x65fb('0x36')](_0x58c294['query'],_0x328c24[_0x65fb('0x2d')]),_0x4a6bce);if(_0x58c294[_0x65fb('0x2b')][_0x65fb('0x37')]){_0x52b4d9[_0x65fb('0x35')]=_['merge'](_0x52b4d9[_0x65fb('0x35')],{'$or':_[_0x65fb('0x24')](_0x4a6bce,function(_0x3f1492){if(_0x3f1492[_0x65fb('0x27')]!==_0x65fb('0x38')){var _0x585657={};_0x585657[_0x3f1492[_0x65fb('0x2a')]]={'$like':'%'+_0x58c294[_0x65fb('0x2b')][_0x65fb('0x37')]+'%'};return _0x585657;}})});}_0x52b4d9=_['merge']({},_0x52b4d9,_0x58c294[_0x65fb('0x39')]);var _0x34f0d5={'where':_0x52b4d9[_0x65fb('0x35')]};return db['MemberReport'][_0x65fb('0x19')](_0x34f0d5)[_0x65fb('0x1f')](function(_0x2cbb8f){_0x461010[_0x65fb('0x19')]=_0x2cbb8f;if(_0x58c294[_0x65fb('0x2b')][_0x65fb('0x3a')]){_0x52b4d9[_0x65fb('0x3b')]=[{'all':!![]}];}return db['MemberReport'][_0x65fb('0x3c')](_0x52b4d9);})[_0x65fb('0x1f')](function(_0x467503){_0x461010[_0x65fb('0x3d')]=_0x467503;return _0x461010;})['then'](respondWithFilteredResult(_0x5eccb1,_0x52b4d9))[_0x65fb('0x3e')](handleError(_0x5eccb1,null));};exports[_0x65fb('0x3f')]=function(_0x39674d,_0x563dad){var _0x3fa87e={'raw':!![],'where':{'id':_0x39674d[_0x65fb('0x40')]['id']}},_0x5ef265={};_0x5ef265[_0x65fb('0x29')]=_[_0x65fb('0x2c')](db[_0x65fb('0x41')][_0x65fb('0x25')]);_0x5ef265['query']=_['keys'](_0x39674d[_0x65fb('0x2b')]);_0x5ef265['filters']=_[_0x65fb('0x2e')](_0x5ef265[_0x65fb('0x29')],_0x5ef265['query']);_0x3fa87e[_0x65fb('0x2f')]=_[_0x65fb('0x2e')](_0x5ef265['model'],qs['fields'](_0x39674d[_0x65fb('0x2b')][_0x65fb('0x30')]));_0x3fa87e['attributes']=_0x3fa87e[_0x65fb('0x2f')][_0x65fb('0x31')]?_0x3fa87e[_0x65fb('0x2f')]:_0x5ef265[_0x65fb('0x29')];if(_0x39674d[_0x65fb('0x2b')][_0x65fb('0x3a')]){_0x3fa87e[_0x65fb('0x3b')]=[{'all':!![]}];}_0x3fa87e=_[_0x65fb('0x42')]({},_0x3fa87e,_0x39674d['options']);return db[_0x65fb('0x41')][_0x65fb('0x43')](_0x3fa87e)[_0x65fb('0x1f')](handleEntityNotFound(_0x563dad,null))[_0x65fb('0x1f')](respondWithResult(_0x563dad,null))[_0x65fb('0x3e')](handleError(_0x563dad,null));};exports['create']=function(_0x2a744a,_0xb6ff03){return db['MemberReport'][_0x65fb('0x44')](_0x2a744a[_0x65fb('0x45')],{})[_0x65fb('0x1f')](respondWithResult(_0xb6ff03,0xc9))[_0x65fb('0x3e')](handleError(_0xb6ff03,null));};exports['update']=function(_0x3d5219,_0xbc3b28){if(_0x3d5219['body']['id']){delete _0x3d5219[_0x65fb('0x45')]['id'];}return db[_0x65fb('0x41')][_0x65fb('0x43')]({'where':{'id':_0x3d5219[_0x65fb('0x40')]['id']}})[_0x65fb('0x1f')](handleEntityNotFound(_0xbc3b28,null))['then'](saveUpdates(_0x3d5219[_0x65fb('0x45')],null))[_0x65fb('0x1f')](respondWithResult(_0xbc3b28,null))['catch'](handleError(_0xbc3b28,null));};exports[_0x65fb('0x46')]=function(_0x4b21bd,_0x36261e){return db[_0x65fb('0x41')][_0x65fb('0x43')]({'where':{'id':_0x4b21bd[_0x65fb('0x40')]['id']}})['then'](handleEntityNotFound(_0x36261e,null))['then'](removeEntity(_0x36261e,null))[_0x65fb('0x3e')](handleError(_0x36261e,null));};exports['describe']=function(_0x1f6b24,_0xddf96){return db[_0x65fb('0x41')][_0x65fb('0x47')]()[_0x65fb('0x1f')](respondWithResult(_0xddf96,null))[_0x65fb('0x3e')](handleError(_0xddf96,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 3567457..8851871 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 _0x6afb=['define','MemberReport','report_member','membername_interface','membername','lodash','util','api','bluebird','request-promise','path','rimraf','./memberReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6afb,0x18d));var _0xb6af=function(_0x298be3,_0x2ebf8f){_0x298be3=_0x298be3-0x0;var _0x286f11=_0x6afb[_0x298be3];return _0x286f11;};'use strict';var _=require(_0xb6af('0x0'));var util=require(_0xb6af('0x1'));var logger=require('../../config/logger')(_0xb6af('0x2'));var moment=require('moment');var BPromise=require(_0xb6af('0x3'));var rp=require(_0xb6af('0x4'));var fs=require('fs');var path=require(_0xb6af('0x5'));var rimraf=require(_0xb6af('0x6'));var config=require('../../config/environment');var attributes=require(_0xb6af('0x7'));module[_0xb6af('0x8')]=function(_0x105296,_0x1efd57){return _0x105296[_0xb6af('0x9')](_0xb6af('0xa'),attributes,{'tableName':_0xb6af('0xb'),'paranoid':![],'indexes':[{'name':_0xb6af('0xc'),'fields':[_0xb6af('0xd'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d05=['./memberReport.attributes','exports','define','MemberReport','report_member','membername','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x93942f,_0xb48547){var _0x23fcd8=function(_0x4728be){while(--_0x4728be){_0x93942f['push'](_0x93942f['shift']());}};_0x23fcd8(++_0xb48547);}(_0x1d05,0x1e6));var _0x51d0=function(_0x3c2e23,_0x333d1f){_0x3c2e23=_0x3c2e23-0x0;var _0x2b057a=_0x1d05[_0x3c2e23];return _0x2b057a;};'use strict';var _=require(_0x51d0('0x0'));var util=require(_0x51d0('0x1'));var logger=require(_0x51d0('0x2'))(_0x51d0('0x3'));var moment=require(_0x51d0('0x4'));var BPromise=require('bluebird');var rp=require(_0x51d0('0x5'));var fs=require('fs');var path=require(_0x51d0('0x6'));var rimraf=require(_0x51d0('0x7'));var config=require(_0x51d0('0x8'));var attributes=require(_0x51d0('0x9'));module[_0x51d0('0xa')]=function(_0x25c928,_0x56a591){return _0x25c928[_0x51d0('0xb')](_0x51d0('0xc'),attributes,{'tableName':_0x51d0('0xd'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x51d0('0xe'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index b448970..b1bd130 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 _0x1fe9=['info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','where','limit','include','model','attributes','map','GetMemberReport','create','body','raw','CreateMemberReport','UpdateMemberReport','MemberReport','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x1fe9,0x152));var _0x91fe=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1fe9[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x91fe('0x0'));var util=require(_0x91fe('0x1'));var moment=require(_0x91fe('0x2'));var BPromise=require('bluebird');var rs=require(_0x91fe('0x3'));var fs=require('fs');var Redis=require(_0x91fe('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91fe('0x5'));var logger=require(_0x91fe('0x6'))(_0x91fe('0x7'));var config=require(_0x91fe('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x91fe('0x9')][_0x91fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15eeb4,_0x3f1c05,_0x41ec4b){return new BPromise(function(_0x18144f,_0x3178ca){return client[_0x91fe('0xb')](_0x15eeb4,_0x41ec4b)[_0x91fe('0xc')](function(_0x562613){logger[_0x91fe('0xd')](_0x91fe('0xe'),_0x3f1c05,_0x91fe('0xf'));logger[_0x91fe('0x10')](_0x91fe('0x11'),_0x3f1c05,_0x91fe('0xf'),JSON[_0x91fe('0x12')](_0x562613));if(_0x562613[_0x91fe('0x13')]){if(_0x562613['error'][_0x91fe('0x14')]===0x1f4){logger[_0x91fe('0x13')](_0x91fe('0xe'),_0x3f1c05,_0x562613[_0x91fe('0x13')][_0x91fe('0x15')]);return _0x3178ca(_0x562613['error'][_0x91fe('0x15')]);}logger[_0x91fe('0x13')](_0x91fe('0xe'),_0x3f1c05,_0x562613[_0x91fe('0x13')]['message']);return _0x18144f(_0x562613[_0x91fe('0x13')]['message']);}else{logger[_0x91fe('0xd')](_0x91fe('0xe'),_0x3f1c05,_0x91fe('0xf'));_0x18144f(_0x562613[_0x91fe('0x16')][_0x91fe('0x15')]);}})[_0x91fe('0x17')](function(_0x47b1c4){logger[_0x91fe('0x13')](_0x91fe('0xe'),_0x3f1c05,_0x47b1c4);_0x3178ca(_0x47b1c4);});});}exports['GetMemberReport']=function(_0x11dff6){var _0x29c29e=this;return new Promise(function(_0x4293c8,_0x1a7bb8){return db['MemberReport'][_0x91fe('0x18')]({'raw':_0x11dff6['options']?_0x11dff6[_0x91fe('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x11dff6[_0x91fe('0x19')]?_0x11dff6['options'][_0x91fe('0x1a')]||null:null,'attributes':_0x11dff6[_0x91fe('0x19')]?_0x11dff6[_0x91fe('0x19')]['attributes']||null:null,'limit':_0x11dff6[_0x91fe('0x19')]?_0x11dff6['options'][_0x91fe('0x1b')]||null:null,'include':_0x11dff6[_0x91fe('0x19')]?_0x11dff6['options'][_0x91fe('0x1c')]?_['map'](_0x11dff6['options'][_0x91fe('0x1c')],function(_0x15e871){return{'model':db[_0x15e871[_0x91fe('0x1d')]],'as':_0x15e871['as'],'attributes':_0x15e871[_0x91fe('0x1e')],'include':_0x15e871[_0x91fe('0x1c')]?_['map'](_0x15e871[_0x91fe('0x1c')],function(_0x3fd740){return{'model':db[_0x3fd740[_0x91fe('0x1d')]],'as':_0x3fd740['as'],'attributes':_0x3fd740[_0x91fe('0x1e')],'include':_0x3fd740[_0x91fe('0x1c')]?_[_0x91fe('0x1f')](_0x3fd740[_0x91fe('0x1c')],function(_0x353e97){return{'model':db[_0x353e97[_0x91fe('0x1d')]],'as':_0x353e97['as'],'attributes':_0x353e97[_0x91fe('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x91fe('0xc')](function(_0x3ff4eb){logger[_0x91fe('0xd')]('GetMemberReport',_0x11dff6);logger[_0x91fe('0x10')](_0x91fe('0x20'),_0x11dff6,JSON[_0x91fe('0x12')](_0x3ff4eb));_0x4293c8(_0x3ff4eb);})['catch'](function(_0x2aa162){logger[_0x91fe('0x13')]('GetMemberReport',_0x2aa162['message'],_0x11dff6);_0x1a7bb8(_0x29c29e[_0x91fe('0x13')](0x1f4,_0x2aa162[_0x91fe('0x15')]));});});};exports['CreateMemberReport']=function(_0x59f31c){var _0x47379f=this;return new Promise(function(_0x1b2a3f,_0x26905d){return db['MemberReport'][_0x91fe('0x21')](_0x59f31c[_0x91fe('0x22')],{'raw':_0x59f31c[_0x91fe('0x19')]?_0x59f31c[_0x91fe('0x19')][_0x91fe('0x23')]===undefined?!![]:![]:!![]})[_0x91fe('0xc')](function(_0x38dbf1){logger[_0x91fe('0xd')](_0x91fe('0x24'),_0x59f31c);logger[_0x91fe('0x10')]('CreateMemberReport',_0x59f31c,JSON[_0x91fe('0x12')](_0x38dbf1));_0x1b2a3f(_0x38dbf1);})[_0x91fe('0x17')](function(_0x2472bd){logger[_0x91fe('0x13')](_0x91fe('0x24'),_0x2472bd[_0x91fe('0x15')],_0x59f31c);_0x26905d(_0x47379f['error'](0x1f4,_0x2472bd[_0x91fe('0x15')]));});});};exports[_0x91fe('0x25')]=function(_0x2902a0){var _0x21e793=this;return new Promise(function(_0x15e32f,_0x3ede6f){return db[_0x91fe('0x26')]['update'](_0x2902a0['body'],{'raw':_0x2902a0[_0x91fe('0x19')]?_0x2902a0[_0x91fe('0x19')][_0x91fe('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2902a0[_0x91fe('0x19')]?_0x2902a0[_0x91fe('0x19')][_0x91fe('0x1a')]||null:null,'attributes':_0x2902a0[_0x91fe('0x19')]?_0x2902a0[_0x91fe('0x19')][_0x91fe('0x1e')]||null:null,'limit':_0x2902a0[_0x91fe('0x19')]?_0x2902a0[_0x91fe('0x19')]['limit']||null:null})['then'](function(_0x46860b){logger[_0x91fe('0xd')](_0x91fe('0x25'),_0x2902a0);logger[_0x91fe('0x10')]('UpdateMemberReport',_0x2902a0,JSON['stringify'](_0x46860b));_0x15e32f(_0x46860b);})[_0x91fe('0x17')](function(_0x37fb24){logger[_0x91fe('0x13')](_0x91fe('0x25'),_0x37fb24[_0x91fe('0x15')],_0x2902a0);_0x3ede6f(_0x21e793[_0x91fe('0x13')](0x1f4,_0x37fb24[_0x91fe('0x15')]));});});}; \ No newline at end of file +var _0x61fe=['client','http','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','MemberReport,\x20%s,\x20%s','result','catch','GetMemberReport','MemberReport','options','raw','where','attributes','include','map','model','stringify','CreateMemberReport','create','body','then','UpdateMemberReport','update','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x61fe,0x17c));var _0xe61f=function(_0x343e01,_0x2a7c5b){_0x343e01=_0x343e01-0x0;var _0x5c162f=_0x61fe[_0x343e01];return _0x5c162f;};'use strict';var _=require(_0xe61f('0x0'));var util=require(_0xe61f('0x1'));var moment=require(_0xe61f('0x2'));var BPromise=require(_0xe61f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe61f('0x4'));var db=require(_0xe61f('0x5'))['db'];var utils=require(_0xe61f('0x6'));var logger=require('../../config/logger')(_0xe61f('0x7'));var config=require(_0xe61f('0x8'));var jayson=require(_0xe61f('0x9'));var client=jayson[_0xe61f('0xa')][_0xe61f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47101a,_0x3726c1,_0x1676e5){return new BPromise(function(_0xa159b4,_0xf7093a){return client['request'](_0x47101a,_0x1676e5)['then'](function(_0xac3ac){logger[_0xe61f('0xc')]('MemberReport,\x20%s,\x20%s',_0x3726c1,_0xe61f('0xd'));logger[_0xe61f('0xe')](_0xe61f('0xf'),_0x3726c1,'request\x20sent',JSON['stringify'](_0xac3ac));if(_0xac3ac[_0xe61f('0x10')]){if(_0xac3ac[_0xe61f('0x10')][_0xe61f('0x11')]===0x1f4){logger[_0xe61f('0x10')]('MemberReport,\x20%s,\x20%s',_0x3726c1,_0xac3ac[_0xe61f('0x10')]['message']);return _0xf7093a(_0xac3ac[_0xe61f('0x10')]['message']);}logger[_0xe61f('0x10')]('MemberReport,\x20%s,\x20%s',_0x3726c1,_0xac3ac[_0xe61f('0x10')][_0xe61f('0x12')]);return _0xa159b4(_0xac3ac['error'][_0xe61f('0x12')]);}else{logger['info'](_0xe61f('0x13'),_0x3726c1,_0xe61f('0xd'));_0xa159b4(_0xac3ac[_0xe61f('0x14')][_0xe61f('0x12')]);}})[_0xe61f('0x15')](function(_0x583f7c){logger[_0xe61f('0x10')](_0xe61f('0x13'),_0x3726c1,_0x583f7c);_0xf7093a(_0x583f7c);});});}exports[_0xe61f('0x16')]=function(_0x4a64d2){var _0x14233b=this;return new Promise(function(_0x4ade2c,_0x17a0b6){return db[_0xe61f('0x17')]['findAll']({'raw':_0x4a64d2[_0xe61f('0x18')]?_0x4a64d2[_0xe61f('0x18')][_0xe61f('0x19')]===undefined?!![]:![]:!![],'where':_0x4a64d2[_0xe61f('0x18')]?_0x4a64d2[_0xe61f('0x18')][_0xe61f('0x1a')]||null:null,'attributes':_0x4a64d2[_0xe61f('0x18')]?_0x4a64d2[_0xe61f('0x18')][_0xe61f('0x1b')]||null:null,'limit':_0x4a64d2[_0xe61f('0x18')]?_0x4a64d2[_0xe61f('0x18')]['limit']||null:null,'include':_0x4a64d2[_0xe61f('0x18')]?_0x4a64d2['options'][_0xe61f('0x1c')]?_[_0xe61f('0x1d')](_0x4a64d2['options'][_0xe61f('0x1c')],function(_0x4e727b){return{'model':db[_0x4e727b[_0xe61f('0x1e')]],'as':_0x4e727b['as'],'attributes':_0x4e727b[_0xe61f('0x1b')],'include':_0x4e727b['include']?_[_0xe61f('0x1d')](_0x4e727b['include'],function(_0x3435d2){return{'model':db[_0x3435d2[_0xe61f('0x1e')]],'as':_0x3435d2['as'],'attributes':_0x3435d2[_0xe61f('0x1b')],'include':_0x3435d2[_0xe61f('0x1c')]?_['map'](_0x3435d2[_0xe61f('0x1c')],function(_0x255602){return{'model':db[_0x255602[_0xe61f('0x1e')]],'as':_0x255602['as'],'attributes':_0x255602[_0xe61f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1895e5){logger[_0xe61f('0xc')](_0xe61f('0x16'),_0x4a64d2);logger[_0xe61f('0xe')](_0xe61f('0x16'),_0x4a64d2,JSON[_0xe61f('0x1f')](_0x1895e5));_0x4ade2c(_0x1895e5);})[_0xe61f('0x15')](function(_0x4d379c){logger[_0xe61f('0x10')](_0xe61f('0x16'),_0x4d379c[_0xe61f('0x12')],_0x4a64d2);_0x17a0b6(_0x14233b[_0xe61f('0x10')](0x1f4,_0x4d379c[_0xe61f('0x12')]));});});};exports[_0xe61f('0x20')]=function(_0x79da5a){var _0x67d919=this;return new Promise(function(_0x2b2bcc,_0x3f7cd9){return db[_0xe61f('0x17')][_0xe61f('0x21')](_0x79da5a[_0xe61f('0x22')],{'raw':_0x79da5a[_0xe61f('0x18')]?_0x79da5a['options']['raw']===undefined?!![]:![]:!![]})[_0xe61f('0x23')](function(_0x100549){logger[_0xe61f('0xc')](_0xe61f('0x20'),_0x79da5a);logger[_0xe61f('0xe')](_0xe61f('0x20'),_0x79da5a,JSON['stringify'](_0x100549));_0x2b2bcc(_0x100549);})[_0xe61f('0x15')](function(_0x3a70df){logger[_0xe61f('0x10')](_0xe61f('0x20'),_0x3a70df[_0xe61f('0x12')],_0x79da5a);_0x3f7cd9(_0x67d919['error'](0x1f4,_0x3a70df[_0xe61f('0x12')]));});});};exports[_0xe61f('0x24')]=function(_0x45e9dd){var _0x4bee51=this;return new Promise(function(_0x1f8262,_0x23aa17){return db[_0xe61f('0x17')][_0xe61f('0x25')](_0x45e9dd['body'],{'raw':_0x45e9dd['options']?_0x45e9dd['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45e9dd['options']?_0x45e9dd[_0xe61f('0x18')][_0xe61f('0x1a')]||null:null,'attributes':_0x45e9dd[_0xe61f('0x18')]?_0x45e9dd[_0xe61f('0x18')][_0xe61f('0x1b')]||null:null,'limit':_0x45e9dd['options']?_0x45e9dd[_0xe61f('0x18')][_0xe61f('0x26')]||null:null})[_0xe61f('0x23')](function(_0x3b87ea){logger[_0xe61f('0xc')](_0xe61f('0x24'),_0x45e9dd);logger['debug']('UpdateMemberReport',_0x45e9dd,JSON[_0xe61f('0x1f')](_0x3b87ea));_0x1f8262(_0x3b87ea);})[_0xe61f('0x15')](function(_0x52679e){logger['error'](_0xe61f('0x24'),_0x52679e[_0xe61f('0x12')],_0x45e9dd);_0x23aa17(_0x4bee51[_0xe61f('0x10')](0x1f4,_0x52679e['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 4608053..05d1bbc 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 _0x7217=['Router','fs-extra','../../config/environment','./migration.controller','get','index','exports','multer','path','connect-timeout','express'];(function(_0x81b1d3,_0x4f393b){var _0x39ae6f=function(_0x561516){while(--_0x561516){_0x81b1d3['push'](_0x81b1d3['shift']());}};_0x39ae6f(++_0x4f393b);}(_0x7217,0x19e));var _0x7721=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x7217[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',controller[_0x7721('0x9')]);module[_0x7721('0xa')]=router; \ No newline at end of file +var _0xed1f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x47677f,_0x28c987){var _0xde4698=function(_0x459d60){while(--_0x459d60){_0x47677f['push'](_0x47677f['shift']());}};_0xde4698(++_0x28c987);}(_0xed1f,0x6a));var _0xfed1=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0xed1f[_0x4e9d3c];return _0x2d0825;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require(_0xfed1('0x2'));var timeout=require(_0xfed1('0x3'));var express=require(_0xfed1('0x4'));var router=express[_0xfed1('0x5')]();var fs_extra=require(_0xfed1('0x6'));var auth=require(_0xfed1('0x7'));var interaction=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var controller=require(_0xfed1('0xa'));router[_0xfed1('0xb')]('/',controller[_0xfed1('0xc')]);module[_0xfed1('0xd')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 795658e..688a032 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 _0x7f42=['sequelize','exports'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x7f42,0x1be));var _0x27f4=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x7f42[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x27f4('0x0'));module[_0x27f4('0x1')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0x7efb=['version','sequelize'];(function(_0x2f4de8,_0x313395){var _0x4569cb=function(_0x17572f){while(--_0x17572f){_0x2f4de8['push'](_0x2f4de8['shift']());}};_0x4569cb(++_0x313395);}(_0x7efb,0x1e9));var _0xb7ef=function(_0x17e858,_0x1dcd35){_0x17e858=_0x17e858-0x0;var _0x5a5f2e=_0x7efb[_0x17e858];return _0x5a5f2e;};'use strict';var Sequelize=require(_0xb7ef('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0xb7ef('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 10a2945..305d0c1 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 _0xb9b2=['../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x5e4759,_0x1f8793){var _0x1aefe3=function(_0x1be07e){while(--_0x1be07e){_0x5e4759['push'](_0x5e4759['shift']());}};_0x1aefe3(++_0x1f8793);}(_0xb9b2,0x126));var _0x2b9b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xb9b2[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b9b('0x0'));var zipdir=require(_0x2b9b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b9b('0x2'));var moment=require(_0x2b9b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2b9b('0x4'));var util=require('util');var path=require('path');var sox=require(_0x2b9b('0x5'));var csv=require(_0x2b9b('0x6'));var ejs=require(_0x2b9b('0x7'));var fs=require('fs');var fs_extra=require(_0x2b9b('0x8'));var _=require('lodash');var squel=require(_0x2b9b('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2b9b('0xa'));var toCsv=require(_0x2b9b('0x6'));var querystring=require(_0x2b9b('0xb'));var Papa=require(_0x2b9b('0xc'));var Redis=require(_0x2b9b('0xd'));var authService=require(_0x2b9b('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b9b('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x2b9b('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x2b9b('0x11'));var db=require(_0x2b9b('0x12'))['db'];function respondWithStatusCode(_0xc5b779,_0xb6181b){_0xb6181b=_0xb6181b||0xcc;return function(_0x1f799a){if(_0x1f799a){return _0xc5b779['sendStatus'](_0xb6181b);}return _0xc5b779[_0x2b9b('0x13')](_0xb6181b)[_0x2b9b('0x14')]();};}function respondWithResult(_0x414eb2,_0x1f7d66){_0x1f7d66=_0x1f7d66||0xc8;return function(_0x2fabc1){if(_0x2fabc1){return _0x414eb2['status'](_0x1f7d66)['json'](_0x2fabc1);}};}function respondWithFilteredResult(_0xdbfa9f,_0x3f6b1d){return function(_0x1a9858){if(_0x1a9858){var _0x5a0e4a=typeof _0x3f6b1d[_0x2b9b('0x15')]===_0x2b9b('0x16')&&typeof _0x3f6b1d[_0x2b9b('0x17')]===_0x2b9b('0x16');var _0x16e5fb=_0x1a9858[_0x2b9b('0x18')];var _0x3f2f42=_0x5a0e4a?0x0:_0x3f6b1d['offset'];var _0xd97b41=_0x5a0e4a?_0x1a9858['count']:_0x3f6b1d['offset']+_0x3f6b1d[_0x2b9b('0x17')];var _0x320c09;if(_0xd97b41>=_0x16e5fb){_0xd97b41=_0x16e5fb;_0x320c09=0xc8;}else{_0x320c09=0xce;}_0xdbfa9f[_0x2b9b('0x13')](_0x320c09);return _0xdbfa9f[_0x2b9b('0x19')]('Content-Range',_0x3f2f42+'-'+_0xd97b41+'/'+_0x16e5fb)[_0x2b9b('0x1a')](_0x1a9858);}return null;};}function patchUpdates(_0x3918c7){return function(_0xd18cbd){try{jsonpatch[_0x2b9b('0x1b')](_0xd18cbd,_0x3918c7,!![]);}catch(_0x3176e0){return BPromise[_0x2b9b('0x1c')](_0x3176e0);}return _0xd18cbd[_0x2b9b('0x1d')]();};}function saveUpdates(_0x52eea4,_0x5097cb){return function(_0x143a5b){if(_0x143a5b){return _0x143a5b[_0x2b9b('0x1e')](_0x52eea4)[_0x2b9b('0x1f')](function(_0xa493fb){return _0xa493fb;});}return null;};}function removeEntity(_0x560505,_0x49e49c){return function(_0x2399a){if(_0x2399a){return _0x2399a['destroy']()['then'](function(){_0x560505[_0x2b9b('0x13')](0xcc)[_0x2b9b('0x14')]();});}};}function handleEntityNotFound(_0x528168,_0x309aa0){return function(_0x580b0e){if(!_0x580b0e){_0x528168['sendStatus'](0x194);}return _0x580b0e;};}function handleError(_0x18b6de,_0x5bb7d6){_0x5bb7d6=_0x5bb7d6||0x1f4;return function(_0x1247a6){logger['error'](_0x1247a6[_0x2b9b('0x20')]);if(_0x1247a6[_0x2b9b('0x21')]){delete _0x1247a6[_0x2b9b('0x21')];}_0x18b6de[_0x2b9b('0x13')](_0x5bb7d6)[_0x2b9b('0x22')](_0x1247a6);};}exports[_0x2b9b('0x23')]=function(_0x13ba2f,_0x47567a){var _0x65fcd={},_0x100fa2={},_0x3e82af={'count':0x0,'rows':[]};var _0x57acc0=_[_0x2b9b('0x24')](db[_0x2b9b('0x25')][_0x2b9b('0x26')],function(_0x4a8730){return{'name':_0x4a8730[_0x2b9b('0x27')],'type':_0x4a8730[_0x2b9b('0x28')][_0x2b9b('0x29')]};});_0x100fa2[_0x2b9b('0x2a')]=_[_0x2b9b('0x24')](_0x57acc0,'name');_0x100fa2['query']=_[_0x2b9b('0x2b')](_0x13ba2f['query']);_0x100fa2[_0x2b9b('0x2c')]=_[_0x2b9b('0x2d')](_0x100fa2['model'],_0x100fa2[_0x2b9b('0x2e')]);_0x65fcd[_0x2b9b('0x2f')]=_['intersection'](_0x100fa2[_0x2b9b('0x2a')],qs[_0x2b9b('0x30')](_0x13ba2f[_0x2b9b('0x2e')][_0x2b9b('0x30')]));_0x65fcd[_0x2b9b('0x2f')]=_0x65fcd[_0x2b9b('0x2f')][_0x2b9b('0x31')]?_0x65fcd['attributes']:_0x100fa2['model'];if(!_0x13ba2f[_0x2b9b('0x2e')][_0x2b9b('0x32')](_0x2b9b('0x33'))){_0x65fcd[_0x2b9b('0x17')]=qs[_0x2b9b('0x17')](_0x13ba2f[_0x2b9b('0x2e')][_0x2b9b('0x17')]);_0x65fcd[_0x2b9b('0x15')]=qs[_0x2b9b('0x15')](_0x13ba2f[_0x2b9b('0x2e')]['offset']);}_0x65fcd['order']=qs[_0x2b9b('0x34')](_0x13ba2f['query'][_0x2b9b('0x34')]);_0x65fcd[_0x2b9b('0x35')]=qs[_0x2b9b('0x2c')](_['pick'](_0x13ba2f[_0x2b9b('0x2e')],_0x100fa2[_0x2b9b('0x2c')]),_0x57acc0);if(_0x13ba2f[_0x2b9b('0x2e')][_0x2b9b('0x36')]){_0x65fcd[_0x2b9b('0x35')]=_[_0x2b9b('0x37')](_0x65fcd['where'],{'$or':_[_0x2b9b('0x24')](_0x57acc0,function(_0x9d1e50){if(_0x9d1e50[_0x2b9b('0x28')]!==_0x2b9b('0x38')){var _0x183e74={};_0x183e74[_0x9d1e50['name']]={'$like':'%'+_0x13ba2f['query'][_0x2b9b('0x36')]+'%'};return _0x183e74;}})});}_0x65fcd=_[_0x2b9b('0x37')]({},_0x65fcd,_0x13ba2f[_0x2b9b('0x39')]);var _0x494f4f={'where':_0x65fcd[_0x2b9b('0x35')]};return db['Migration'][_0x2b9b('0x18')](_0x494f4f)['then'](function(_0x1b1cfb){_0x3e82af[_0x2b9b('0x18')]=_0x1b1cfb;if(_0x13ba2f['query'][_0x2b9b('0x3a')]){_0x65fcd[_0x2b9b('0x3b')]=[{'all':!![]}];}return db[_0x2b9b('0x25')]['findAll'](_0x65fcd);})[_0x2b9b('0x1f')](function(_0x4ad3ec){_0x3e82af[_0x2b9b('0x3c')]=_0x4ad3ec;return _0x3e82af;})[_0x2b9b('0x1f')](respondWithFilteredResult(_0x47567a,_0x65fcd))[_0x2b9b('0x3d')](handleError(_0x47567a,null));}; \ No newline at end of file +var _0x9b35=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','Migration','includeAll','include','findAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','json','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map'];(function(_0x3ff05b,_0x3556d5){var _0x10323c=function(_0x2e758a){while(--_0x2e758a){_0x3ff05b['push'](_0x3ff05b['shift']());}};_0x10323c(++_0x3556d5);}(_0x9b35,0x11c));var _0x59b3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x9b35[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x59b3('0x0'));var rimraf=require(_0x59b3('0x1'));var zipdir=require(_0x59b3('0x2'));var jsonpatch=require(_0x59b3('0x3'));var rp=require(_0x59b3('0x4'));var moment=require('moment');var BPromise=require(_0x59b3('0x5'));var Mustache=require('mustache');var util=require(_0x59b3('0x6'));var path=require('path');var sox=require(_0x59b3('0x7'));var csv=require('to-csv');var ejs=require(_0x59b3('0x8'));var fs=require('fs');var fs_extra=require(_0x59b3('0x9'));var _=require('lodash');var squel=require(_0x59b3('0xa'));var crypto=require(_0x59b3('0xb'));var jsforce=require(_0x59b3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x59b3('0xd'));var querystring=require(_0x59b3('0xe'));var Papa=require('papaparse');var Redis=require(_0x59b3('0xf'));var authService=require(_0x59b3('0x10'));var qs=require(_0x59b3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x59b3('0x12'));var logger=require(_0x59b3('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x59b3('0x14'));var licenseUtil=require(_0x59b3('0x15'));var db=require(_0x59b3('0x16'))['db'];function respondWithStatusCode(_0x2aca94,_0x1f6c4f){_0x1f6c4f=_0x1f6c4f||0xcc;return function(_0x9fb61f){if(_0x9fb61f){return _0x2aca94['sendStatus'](_0x1f6c4f);}return _0x2aca94[_0x59b3('0x17')](_0x1f6c4f)[_0x59b3('0x18')]();};}function respondWithResult(_0x80134c,_0x286a7c){_0x286a7c=_0x286a7c||0xc8;return function(_0x2839d4){if(_0x2839d4){return _0x80134c['status'](_0x286a7c)['json'](_0x2839d4);}};}function respondWithFilteredResult(_0xb492b7,_0x5f5afa){return function(_0x1b8abf){if(_0x1b8abf){var _0x117106=typeof _0x5f5afa[_0x59b3('0x19')]==='undefined'&&typeof _0x5f5afa[_0x59b3('0x1a')]===_0x59b3('0x1b');var _0x1d672d=_0x1b8abf[_0x59b3('0x1c')];var _0x1e8fe6=_0x117106?0x0:_0x5f5afa['offset'];var _0x13b419=_0x117106?_0x1b8abf['count']:_0x5f5afa[_0x59b3('0x19')]+_0x5f5afa[_0x59b3('0x1a')];var _0x3c6c4f;if(_0x13b419>=_0x1d672d){_0x13b419=_0x1d672d;_0x3c6c4f=0xc8;}else{_0x3c6c4f=0xce;}_0xb492b7['status'](_0x3c6c4f);return _0xb492b7['set']('Content-Range',_0x1e8fe6+'-'+_0x13b419+'/'+_0x1d672d)[_0x59b3('0x1d')](_0x1b8abf);}return null;};}function patchUpdates(_0x186254){return function(_0x209f13){try{jsonpatch['apply'](_0x209f13,_0x186254,!![]);}catch(_0x3c8a12){return BPromise[_0x59b3('0x1e')](_0x3c8a12);}return _0x209f13[_0x59b3('0x1f')]();};}function saveUpdates(_0x4c0cd4,_0x2269e0){return function(_0xfdb570){if(_0xfdb570){return _0xfdb570[_0x59b3('0x20')](_0x4c0cd4)[_0x59b3('0x21')](function(_0x840977){return _0x840977;});}return null;};}function removeEntity(_0x53b814,_0x3dacab){return function(_0x2c3e1b){if(_0x2c3e1b){return _0x2c3e1b[_0x59b3('0x22')]()[_0x59b3('0x21')](function(){_0x53b814[_0x59b3('0x17')](0xcc)[_0x59b3('0x18')]();});}};}function handleEntityNotFound(_0x43bbe3,_0x19a9a2){return function(_0x41c453){if(!_0x41c453){_0x43bbe3[_0x59b3('0x23')](0x194);}return _0x41c453;};}function handleError(_0x337ae7,_0x4409fa){_0x4409fa=_0x4409fa||0x1f4;return function(_0x10968c){logger['error'](_0x10968c[_0x59b3('0x24')]);if(_0x10968c[_0x59b3('0x25')]){delete _0x10968c['name'];}_0x337ae7[_0x59b3('0x17')](_0x4409fa)[_0x59b3('0x26')](_0x10968c);};}exports[_0x59b3('0x27')]=function(_0x711753,_0x54b08a){var _0x230d33={},_0x411fbd={},_0x357e04={'count':0x0,'rows':[]};var _0x217592=_[_0x59b3('0x28')](db['Migration'][_0x59b3('0x29')],function(_0x19ee69){return{'name':_0x19ee69[_0x59b3('0x2a')],'type':_0x19ee69[_0x59b3('0x2b')][_0x59b3('0x2c')]};});_0x411fbd[_0x59b3('0x2d')]=_[_0x59b3('0x28')](_0x217592,'name');_0x411fbd[_0x59b3('0x2e')]=_[_0x59b3('0x2f')](_0x711753['query']);_0x411fbd[_0x59b3('0x30')]=_[_0x59b3('0x31')](_0x411fbd[_0x59b3('0x2d')],_0x411fbd['query']);_0x230d33['attributes']=_[_0x59b3('0x31')](_0x411fbd[_0x59b3('0x2d')],qs[_0x59b3('0x32')](_0x711753[_0x59b3('0x2e')]['fields']));_0x230d33['attributes']=_0x230d33[_0x59b3('0x33')]['length']?_0x230d33[_0x59b3('0x33')]:_0x411fbd[_0x59b3('0x2d')];if(!_0x711753[_0x59b3('0x2e')][_0x59b3('0x34')](_0x59b3('0x35'))){_0x230d33[_0x59b3('0x1a')]=qs[_0x59b3('0x1a')](_0x711753[_0x59b3('0x2e')][_0x59b3('0x1a')]);_0x230d33[_0x59b3('0x19')]=qs[_0x59b3('0x19')](_0x711753[_0x59b3('0x2e')]['offset']);}_0x230d33[_0x59b3('0x36')]=qs['sort'](_0x711753[_0x59b3('0x2e')][_0x59b3('0x37')]);_0x230d33[_0x59b3('0x38')]=qs[_0x59b3('0x30')](_['pick'](_0x711753['query'],_0x411fbd[_0x59b3('0x30')]),_0x217592);if(_0x711753[_0x59b3('0x2e')][_0x59b3('0x39')]){_0x230d33['where']=_['merge'](_0x230d33[_0x59b3('0x38')],{'$or':_['map'](_0x217592,function(_0x8a1fa7){if(_0x8a1fa7['type']!=='VIRTUAL'){var _0x25df1d={};_0x25df1d[_0x8a1fa7[_0x59b3('0x25')]]={'$like':'%'+_0x711753[_0x59b3('0x2e')][_0x59b3('0x39')]+'%'};return _0x25df1d;}})});}_0x230d33=_[_0x59b3('0x3a')]({},_0x230d33,_0x711753[_0x59b3('0x3b')]);var _0x24f258={'where':_0x230d33['where']};return db[_0x59b3('0x3c')][_0x59b3('0x1c')](_0x24f258)[_0x59b3('0x21')](function(_0x372653){_0x357e04[_0x59b3('0x1c')]=_0x372653;if(_0x711753[_0x59b3('0x2e')][_0x59b3('0x3d')]){_0x230d33[_0x59b3('0x3e')]=[{'all':!![]}];}return db[_0x59b3('0x3c')][_0x59b3('0x3f')](_0x230d33);})['then'](function(_0x4445eb){_0x357e04[_0x59b3('0x40')]=_0x4445eb;return _0x357e04;})['then'](respondWithFilteredResult(_0x54b08a,_0x230d33))['catch'](handleError(_0x54b08a,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index eba4fbc..d66e9e8 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 _0x2c42=['../../config/environment','exports','Migration','lodash','util','../../config/logger','api','moment','path'];(function(_0x15e6fe,_0x1a5c39){var _0x34894d=function(_0x32eec2){while(--_0x32eec2){_0x15e6fe['push'](_0x15e6fe['shift']());}};_0x34894d(++_0x1a5c39);}(_0x2c42,0x78));var _0x22c4=function(_0x2a1d93,_0x3c4224){_0x2a1d93=_0x2a1d93-0x0;var _0x2a67df=_0x2c42[_0x2a1d93];return _0x2a67df;};'use strict';var _=require(_0x22c4('0x0'));var util=require(_0x22c4('0x1'));var logger=require(_0x22c4('0x2'))(_0x22c4('0x3'));var moment=require(_0x22c4('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x22c4('0x5'));var rimraf=require('rimraf');var config=require(_0x22c4('0x6'));var attributes=require('./migration.attributes');module[_0x22c4('0x7')]=function(_0x158f69,_0x1ced74){return _0x158f69['define'](_0x22c4('0x8'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b0c=['rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','util','api','bluebird','request-promise','path'];(function(_0x32890a,_0x1f3f36){var _0xc92d70=function(_0x508294){while(--_0x508294){_0x32890a['push'](_0x32890a['shift']());}};_0xc92d70(++_0x1f3f36);}(_0x9b0c,0x132));var _0xc9b0=function(_0x150417,_0x1ad82f){_0x150417=_0x150417-0x0;var _0x3dc372=_0x9b0c[_0x150417];return _0x3dc372;};'use strict';var _=require(_0xc9b0('0x0'));var util=require(_0xc9b0('0x1'));var logger=require('../../config/logger')(_0xc9b0('0x2'));var moment=require('moment');var BPromise=require(_0xc9b0('0x3'));var rp=require(_0xc9b0('0x4'));var fs=require('fs');var path=require(_0xc9b0('0x5'));var rimraf=require(_0xc9b0('0x6'));var config=require(_0xc9b0('0x7'));var attributes=require(_0xc9b0('0x8'));module[_0xc9b0('0x9')]=function(_0x179a56,_0xc97e4b){return _0x179a56[_0xc9b0('0xa')](_0xc9b0('0xb'),attributes,{'tableName':_0xc9b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index a2b3ecb..4cd9cf4 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 _0x3779=['stringify','error','code','message','request\x20sent','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request','Migration,\x20%s,\x20%s','debug'];(function(_0x155574,_0x4e0b0b){var _0x56b559=function(_0x1a4b1d){while(--_0x1a4b1d){_0x155574['push'](_0x155574['shift']());}};_0x56b559(++_0x4e0b0b);}(_0x3779,0x102));var _0x9377=function(_0x5b734b,_0x486a7f){_0x5b734b=_0x5b734b-0x0;var _0x2a15a3=_0x3779[_0x5b734b];return _0x2a15a3;};'use strict';var _=require(_0x9377('0x0'));var util=require(_0x9377('0x1'));var moment=require('moment');var BPromise=require(_0x9377('0x2'));var rs=require(_0x9377('0x3'));var fs=require('fs');var Redis=require(_0x9377('0x4'));var db=require(_0x9377('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9377('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9377('0x7'));var client=jayson[_0x9377('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x270d29,_0x221454,_0x353f5e){return new BPromise(function(_0x494873,_0x4e6904){return client[_0x9377('0x9')](_0x270d29,_0x353f5e)['then'](function(_0x3e0e62){logger['info'](_0x9377('0xa'),_0x221454,'request\x20sent');logger[_0x9377('0xb')]('Migration,\x20%s,\x20%s,\x20%s',_0x221454,'request\x20sent',JSON[_0x9377('0xc')](_0x3e0e62));if(_0x3e0e62[_0x9377('0xd')]){if(_0x3e0e62[_0x9377('0xd')][_0x9377('0xe')]===0x1f4){logger[_0x9377('0xd')](_0x9377('0xa'),_0x221454,_0x3e0e62['error'][_0x9377('0xf')]);return _0x4e6904(_0x3e0e62[_0x9377('0xd')][_0x9377('0xf')]);}logger[_0x9377('0xd')](_0x9377('0xa'),_0x221454,_0x3e0e62[_0x9377('0xd')]['message']);return _0x494873(_0x3e0e62[_0x9377('0xd')]['message']);}else{logger['info']('Migration,\x20%s,\x20%s',_0x221454,_0x9377('0x10'));_0x494873(_0x3e0e62[_0x9377('0x11')]['message']);}})['catch'](function(_0x1b814c){logger['error'](_0x9377('0xa'),_0x221454,_0x1b814c);_0x4e6904(_0x1b814c);});});} \ No newline at end of file +var _0x9d68=['http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d68,0xaf));var _0x89d6=function(_0x409682,_0x370090){_0x409682=_0x409682-0x0;var _0x1ee901=_0x9d68[_0x409682];return _0x1ee901;};'use strict';var _=require('lodash');var util=require(_0x89d6('0x0'));var moment=require('moment');var BPromise=require(_0x89d6('0x1'));var rs=require(_0x89d6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x89d6('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x89d6('0x4'))(_0x89d6('0x5'));var config=require(_0x89d6('0x6'));var jayson=require(_0x89d6('0x7'));var client=jayson[_0x89d6('0x8')][_0x89d6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1799d0,_0x350cfb,_0x4e928f){return new BPromise(function(_0x3ede44,_0x1a6f48){return client[_0x89d6('0xa')](_0x1799d0,_0x4e928f)[_0x89d6('0xb')](function(_0x4ce9d9){logger[_0x89d6('0xc')](_0x89d6('0xd'),_0x350cfb,_0x89d6('0xe'));logger[_0x89d6('0xf')](_0x89d6('0x10'),_0x350cfb,_0x89d6('0xe'),JSON[_0x89d6('0x11')](_0x4ce9d9));if(_0x4ce9d9[_0x89d6('0x12')]){if(_0x4ce9d9['error'][_0x89d6('0x13')]===0x1f4){logger[_0x89d6('0x12')](_0x89d6('0xd'),_0x350cfb,_0x4ce9d9[_0x89d6('0x12')][_0x89d6('0x14')]);return _0x1a6f48(_0x4ce9d9['error']['message']);}logger['error'](_0x89d6('0xd'),_0x350cfb,_0x4ce9d9['error'][_0x89d6('0x14')]);return _0x3ede44(_0x4ce9d9[_0x89d6('0x12')][_0x89d6('0x14')]);}else{logger[_0x89d6('0xc')](_0x89d6('0xd'),_0x350cfb,_0x89d6('0xe'));_0x3ede44(_0x4ce9d9[_0x89d6('0x15')][_0x89d6('0x14')]);}})[_0x89d6('0x16')](function(_0x597e0d){logger['error'](_0x89d6('0xd'),_0x350cfb,_0x597e0d);_0x1a6f48(_0x597e0d);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index cd2092d..7a588f8 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 _0x984d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','util','connect-timeout','express'];(function(_0x598911,_0x523356){var _0x5827f3=function(_0x478dcc){while(--_0x478dcc){_0x598911['push'](_0x598911['shift']());}};_0x5827f3(++_0x523356);}(_0x984d,0xb1));var _0xd984=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x984d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xd984('0x0'));var path=require('path');var timeout=require(_0xd984('0x1'));var express=require(_0xd984('0x2'));var router=express[_0xd984('0x3')]();var fs_extra=require(_0xd984('0x4'));var auth=require(_0xd984('0x5'));var interaction=require(_0xd984('0x6'));var config=require('../../config/environment');var controller=require(_0xd984('0x7'));router[_0xd984('0x8')]('/',auth[_0xd984('0x9')](),controller[_0xd984('0xa')]);router[_0xd984('0x8')](_0xd984('0xb'),auth['isAuthenticated'](),controller[_0xd984('0xc')]);router[_0xd984('0xd')]('/',auth[_0xd984('0x9')](),controller[_0xd984('0xe')]);router[_0xd984('0xf')](_0xd984('0xb'),auth[_0xd984('0x9')](),controller[_0xd984('0x10')]);router['delete'](_0xd984('0xb'),auth[_0xd984('0x9')](),controller[_0xd984('0x11')]);module['exports']=router; \ No newline at end of file +var _0x143c=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get'];(function(_0x19fc44,_0x4bca56){var _0x3414ec=function(_0x696b3d){while(--_0x696b3d){_0x19fc44['push'](_0x19fc44['shift']());}};_0x3414ec(++_0x4bca56);}(_0x143c,0x81));var _0xc143=function(_0x1fe14f,_0x36745d){_0x1fe14f=_0x1fe14f-0x0;var _0x4c4904=_0x143c[_0x1fe14f];return _0x4c4904;};'use strict';var multer=require('multer');var util=require(_0xc143('0x0'));var path=require(_0xc143('0x1'));var timeout=require(_0xc143('0x2'));var express=require(_0xc143('0x3'));var router=express[_0xc143('0x4')]();var fs_extra=require(_0xc143('0x5'));var auth=require(_0xc143('0x6'));var interaction=require(_0xc143('0x7'));var config=require(_0xc143('0x8'));var controller=require(_0xc143('0x9'));router[_0xc143('0xa')]('/',auth[_0xc143('0xb')](),controller[_0xc143('0xc')]);router[_0xc143('0xa')](_0xc143('0xd'),auth[_0xc143('0xb')](),controller[_0xc143('0xe')]);router[_0xc143('0xf')]('/',auth[_0xc143('0xb')](),controller[_0xc143('0x10')]);router[_0xc143('0x11')](_0xc143('0xd'),auth[_0xc143('0xb')](),controller['update']);router[_0xc143('0x12')](_0xc143('0xd'),auth[_0xc143('0xb')](),controller[_0xc143('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index ee4bb0e..3f12534 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 _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x1f822d,_0x5891b6){var _0x243516=function(_0x372a40){while(--_0x372a40){_0x1f822d['push'](_0x1f822d['shift']());}};_0x243516(++_0x5891b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x367567,_0x5ded2a){var _0x2bfce6=function(_0x268463){while(--_0x268463){_0x367567['push'](_0x367567['shift']());}};_0x2bfce6(++_0x5ded2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 537cfb7..f32ceba 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 _0x35ee=['Reload','res_stun_monitor.so','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','render','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','params','/etc/asterisk/turn_xcally.conf','format','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','name','send','Network','rawAttributes','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','includeAll','include','findAll','rows','show','keys','length','merge','options','find','sequelize','create','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf'];(function(_0xee0152,_0xfe1ea7){var _0x1a69d1=function(_0x51e881){while(--_0x51e881){_0xee0152['push'](_0xee0152['shift']());}};_0x1a69d1(++_0xfe1ea7);}(_0x35ee,0xe2));var _0xe35e=function(_0x2ddbc4,_0x489648){_0x2ddbc4=_0x2ddbc4-0x0;var _0x227c8a=_0x35ee[_0x2ddbc4];return _0x227c8a;};'use strict';var emlformat=require(_0xe35e('0x0'));var rimraf=require(_0xe35e('0x1'));var zipdir=require(_0xe35e('0x2'));var jsonpatch=require(_0xe35e('0x3'));var rp=require('request-promise');var moment=require(_0xe35e('0x4'));var BPromise=require(_0xe35e('0x5'));var Mustache=require(_0xe35e('0x6'));var util=require(_0xe35e('0x7'));var path=require(_0xe35e('0x8'));var sox=require('sox');var csv=require(_0xe35e('0x9'));var ejs=require(_0xe35e('0xa'));var fs=require('fs');var fs_extra=require(_0xe35e('0xb'));var _=require('lodash');var squel=require(_0xe35e('0xc'));var crypto=require(_0xe35e('0xd'));var jsforce=require(_0xe35e('0xe'));var deskjs=require(_0xe35e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe35e('0x10'));var Papa=require(_0xe35e('0x11'));var Redis=require(_0xe35e('0x12'));var authService=require(_0xe35e('0x13'));var qs=require(_0xe35e('0x14'));var as=require(_0xe35e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe35e('0x16'))(_0xe35e('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe35e('0x18'));var db=require(_0xe35e('0x19'))['db'];var jayson=require(_0xe35e('0x1a'));var client=jayson['client'][_0xe35e('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1765a6,_0x582b3a,_0x281e9b,_0x4eecbf){return new BPromise(function(_0x56c6a0,_0xc13884){var _0x5658d6=_0x4eecbf||client;return _0x5658d6[_0xe35e('0x1c')](_0x1765a6,_0x281e9b)[_0xe35e('0x1d')](function(_0x51d8d4){logger[_0xe35e('0x1e')](_0xe35e('0x1f'),_0x582b3a,_0xe35e('0x20'));logger[_0xe35e('0x21')]('Network,\x20%s,\x20%s,\x20%s',_0x582b3a,'request\x20sent',JSON[_0xe35e('0x22')](_0x51d8d4));if(_0x51d8d4['error']){if(_0x51d8d4[_0xe35e('0x23')][_0xe35e('0x24')]===0x1f4){logger['error'](_0xe35e('0x1f'),_0x582b3a,_0x51d8d4[_0xe35e('0x23')][_0xe35e('0x25')]);return _0xc13884(_0x51d8d4['error'][_0xe35e('0x25')]);}logger[_0xe35e('0x23')](_0xe35e('0x1f'),_0x582b3a,_0x51d8d4[_0xe35e('0x23')][_0xe35e('0x25')]);return _0x56c6a0(_0x51d8d4[_0xe35e('0x23')][_0xe35e('0x25')]);}else{logger[_0xe35e('0x1e')](_0xe35e('0x1f'),_0x582b3a,_0xe35e('0x20'));_0x56c6a0(_0x51d8d4[_0xe35e('0x26')]['message']);}})[_0xe35e('0x27')](function(_0x932c56){logger[_0xe35e('0x23')](_0xe35e('0x1f'),_0x582b3a,_0x932c56);_0xc13884(_0x932c56);});});}function respondWithStatusCode(_0x15df76,_0x500389){_0x500389=_0x500389||0xcc;return function(_0x260452){if(_0x260452){return _0x15df76[_0xe35e('0x28')](_0x500389);}return _0x15df76[_0xe35e('0x29')](_0x500389)[_0xe35e('0x2a')]();};}function respondWithResult(_0x457a88,_0x3351b1){_0x3351b1=_0x3351b1||0xc8;return function(_0x50be24){if(_0x50be24){return _0x457a88[_0xe35e('0x29')](_0x3351b1)[_0xe35e('0x2b')](_0x50be24);}};}function respondWithFilteredResult(_0x105b00,_0x25e989){return function(_0x18d942){if(_0x18d942){var _0x467731=typeof _0x25e989[_0xe35e('0x2c')]===_0xe35e('0x2d')&&typeof _0x25e989[_0xe35e('0x2e')]===_0xe35e('0x2d');var _0x128b6e=_0x18d942[_0xe35e('0x2f')];var _0x5fa0d8=_0x467731?0x0:_0x25e989[_0xe35e('0x2c')];var _0x4333cf=_0x467731?_0x18d942['count']:_0x25e989[_0xe35e('0x2c')]+_0x25e989['limit'];var _0x125546;if(_0x4333cf>=_0x128b6e){_0x4333cf=_0x128b6e;_0x125546=0xc8;}else{_0x125546=0xce;}_0x105b00[_0xe35e('0x29')](_0x125546);return _0x105b00[_0xe35e('0x30')](_0xe35e('0x31'),_0x5fa0d8+'-'+_0x4333cf+'/'+_0x128b6e)[_0xe35e('0x2b')](_0x18d942);}return null;};}function patchUpdates(_0x31be1d){return function(_0x1b5f96){try{jsonpatch[_0xe35e('0x32')](_0x1b5f96,_0x31be1d,!![]);}catch(_0x3cac4c){return BPromise['reject'](_0x3cac4c);}return _0x1b5f96[_0xe35e('0x33')]();};}function saveUpdates(_0x5b9b5d,_0x12a74e){return function(_0x2c2645){if(_0x2c2645){return _0x2c2645['update'](_0x5b9b5d)[_0xe35e('0x1d')](function(_0x36577f){return _0x36577f;});}return null;};}function removeEntity(_0x180432,_0x50e0e2){return function(_0x29fdef){if(_0x29fdef){return _0x29fdef[_0xe35e('0x34')]()[_0xe35e('0x1d')](function(){_0x180432['status'](0xcc)[_0xe35e('0x2a')]();});}};}function handleEntityNotFound(_0x6b3b88,_0x182edb){return function(_0x129a47){if(!_0x129a47){_0x6b3b88[_0xe35e('0x28')](0x194);}return _0x129a47;};}function handleError(_0x54018d,_0x346cfe){_0x346cfe=_0x346cfe||0x1f4;return function(_0x2fbf33){logger[_0xe35e('0x23')](_0x2fbf33['stack']);if(_0x2fbf33[_0xe35e('0x35')]){delete _0x2fbf33[_0xe35e('0x35')];}_0x54018d[_0xe35e('0x29')](_0x346cfe)[_0xe35e('0x36')](_0x2fbf33);};}exports['index']=function(_0x55b79e,_0x26a49f){var _0xb490f1={},_0x3bf066={},_0x190fc9={'count':0x0,'rows':[]};var _0xcfe783=_['map'](db[_0xe35e('0x37')][_0xe35e('0x38')],function(_0x4cab42){return{'name':_0x4cab42['fieldName'],'type':_0x4cab42[_0xe35e('0x39')][_0xe35e('0x3a')]};});_0x3bf066[_0xe35e('0x3b')]=_[_0xe35e('0x3c')](_0xcfe783,_0xe35e('0x35'));_0x3bf066[_0xe35e('0x3d')]=_['keys'](_0x55b79e['query']);_0x3bf066['filters']=_[_0xe35e('0x3e')](_0x3bf066[_0xe35e('0x3b')],_0x3bf066['query']);_0xb490f1[_0xe35e('0x3f')]=_['intersection'](_0x3bf066['model'],qs[_0xe35e('0x40')](_0x55b79e[_0xe35e('0x3d')][_0xe35e('0x40')]));_0xb490f1['attributes']=_0xb490f1[_0xe35e('0x3f')]['length']?_0xb490f1[_0xe35e('0x3f')]:_0x3bf066[_0xe35e('0x3b')];if(!_0x55b79e[_0xe35e('0x3d')][_0xe35e('0x41')]('nolimit')){_0xb490f1[_0xe35e('0x2e')]=qs[_0xe35e('0x2e')](_0x55b79e[_0xe35e('0x3d')]['limit']);_0xb490f1[_0xe35e('0x2c')]=qs[_0xe35e('0x2c')](_0x55b79e[_0xe35e('0x3d')]['offset']);}_0xb490f1[_0xe35e('0x42')]=qs[_0xe35e('0x43')](_0x55b79e[_0xe35e('0x3d')][_0xe35e('0x43')]);_0xb490f1[_0xe35e('0x44')]=qs[_0xe35e('0x45')](_[_0xe35e('0x46')](_0x55b79e[_0xe35e('0x3d')],_0x3bf066[_0xe35e('0x45')]),_0xcfe783);if(_0x55b79e[_0xe35e('0x3d')]['filter']){_0xb490f1['where']=_['merge'](_0xb490f1[_0xe35e('0x44')],{'$or':_[_0xe35e('0x3c')](_0xcfe783,function(_0x476dd4){if(_0x476dd4['type']!=='VIRTUAL'){var _0x146689={};_0x146689[_0x476dd4[_0xe35e('0x35')]]={'$like':'%'+_0x55b79e[_0xe35e('0x3d')]['filter']+'%'};return _0x146689;}})});}_0xb490f1=_['merge']({},_0xb490f1,_0x55b79e['options']);var _0x37fcdf={'where':_0xb490f1[_0xe35e('0x44')]};return db['Network']['count'](_0x37fcdf)[_0xe35e('0x1d')](function(_0x4f8ed1){_0x190fc9['count']=_0x4f8ed1;if(_0x55b79e[_0xe35e('0x3d')][_0xe35e('0x47')]){_0xb490f1[_0xe35e('0x48')]=[{'all':!![]}];}return db[_0xe35e('0x37')][_0xe35e('0x49')](_0xb490f1);})[_0xe35e('0x1d')](function(_0x485030){_0x190fc9[_0xe35e('0x4a')]=_0x485030;return _0x190fc9;})[_0xe35e('0x1d')](respondWithFilteredResult(_0x26a49f,_0xb490f1))[_0xe35e('0x27')](handleError(_0x26a49f,null));};exports[_0xe35e('0x4b')]=function(_0x581412,_0x3f1283){var _0x2a74f4={'raw':!![],'where':{'id':_0x581412['params']['id']}},_0x19c5d5={};_0x19c5d5[_0xe35e('0x3b')]=_['keys'](db[_0xe35e('0x37')][_0xe35e('0x38')]);_0x19c5d5['query']=_[_0xe35e('0x4c')](_0x581412[_0xe35e('0x3d')]);_0x19c5d5[_0xe35e('0x45')]=_[_0xe35e('0x3e')](_0x19c5d5[_0xe35e('0x3b')],_0x19c5d5[_0xe35e('0x3d')]);_0x2a74f4['attributes']=_[_0xe35e('0x3e')](_0x19c5d5['model'],qs[_0xe35e('0x40')](_0x581412[_0xe35e('0x3d')][_0xe35e('0x40')]));_0x2a74f4[_0xe35e('0x3f')]=_0x2a74f4[_0xe35e('0x3f')][_0xe35e('0x4d')]?_0x2a74f4['attributes']:_0x19c5d5[_0xe35e('0x3b')];if(_0x581412[_0xe35e('0x3d')][_0xe35e('0x47')]){_0x2a74f4[_0xe35e('0x48')]=[{'all':!![]}];}_0x2a74f4=_[_0xe35e('0x4e')]({},_0x2a74f4,_0x581412[_0xe35e('0x4f')]);return db[_0xe35e('0x37')][_0xe35e('0x50')](_0x2a74f4)[_0xe35e('0x1d')](handleEntityNotFound(_0x3f1283,null))[_0xe35e('0x1d')](respondWithResult(_0x3f1283,null))[_0xe35e('0x27')](handleError(_0x3f1283,null));};exports['create']=function(_0x123527,_0x2c956b,_0x73401b){var _0x24f59f;return db[_0xe35e('0x51')]['transaction'](function(_0x30ed63){return db[_0xe35e('0x37')][_0xe35e('0x52')](_0x123527[_0xe35e('0x53')],{'raw':!![]})[_0xe35e('0x1d')](function(_0x3efc51){_0x24f59f=_0x3efc51;return db['Network'][_0xe35e('0x49')]({'where':{'type':_0x123527[_0xe35e('0x53')]['type']},'raw':!![]});})[_0xe35e('0x1d')](function(_0x22bd64){if(_0x24f59f[_0xe35e('0x39')]['toUpperCase']()==_0xe35e('0x54')){var _0x39641c=fs[_0xe35e('0x55')](path[_0xe35e('0x56')](config[_0xe35e('0x57')],_0xe35e('0x58')),_0xe35e('0x59'));var _0x5a72f6=ejs['render'](_0x39641c,{'networks':_0x22bd64||[]});fs[_0xe35e('0x5a')](_0xe35e('0x5b'),_0x5a72f6);return respondWithRpcPromise(_0xe35e('0x5c'),_0xe35e('0x52'),{'module':_0xe35e('0x5d')});}else if(_0x24f59f['type'][_0xe35e('0x5e')]()==_0xe35e('0x5f')){var _0x286730=fs[_0xe35e('0x55')](path['join'](config[_0xe35e('0x57')],_0xe35e('0x60')),'utf8');var _0x23a433=ejs[_0xe35e('0x61')](_0x286730,{'networks':_0x22bd64||[]});fs[_0xe35e('0x5a')]('/etc/asterisk/turn_xcally.conf',_0x23a433);return respondWithRpcPromise(_0xe35e('0x5c'),_0xe35e('0x52'),{'module':_0xe35e('0x5d')});}else{var _0x4f308f=fs[_0xe35e('0x55')](path[_0xe35e('0x56')](config[_0xe35e('0x57')],_0xe35e('0x62')),_0xe35e('0x59'));var _0x217e48=ejs['render'](_0x4f308f,{'networks':_0x22bd64||[]});fs[_0xe35e('0x5a')](util['format'](_0xe35e('0x63'),_0x123527[_0xe35e('0x53')][_0xe35e('0x39')][_0xe35e('0x64')]()),_0x217e48);return respondWithRpcPromise(_0xe35e('0x5c'),_0xe35e('0x52'),{'module':_0xe35e('0x65')});}return null;})[_0xe35e('0x1d')](function(){return _0x24f59f;});})[_0xe35e('0x1d')](respondWithResult(_0x2c956b,0xc9))[_0xe35e('0x27')](handleError(_0x2c956b,null));};exports[_0xe35e('0x66')]=function(_0x17d364,_0x3bf837,_0x21fe30){var _0x3a0b0a;return db[_0xe35e('0x51')]['transaction'](function(_0x4d82a0){return db[_0xe35e('0x37')][_0xe35e('0x50')]({'where':{'id':_0x17d364[_0xe35e('0x67')]['id']}})[_0xe35e('0x1d')](handleEntityNotFound(_0x3bf837,null))[_0xe35e('0x1d')](saveUpdates(_0x17d364[_0xe35e('0x53')],null))[_0xe35e('0x1d')](function(_0x5a0700){if(_0x5a0700){_0x3a0b0a=_0x5a0700;return db[_0xe35e('0x37')][_0xe35e('0x49')]({'where':{'type':_0x3a0b0a['type']},'raw':!![]});}return null;})[_0xe35e('0x1d')](function(_0x480f6f){if(_0x3a0b0a[_0xe35e('0x39')][_0xe35e('0x5e')]()==_0xe35e('0x54')){var _0x2e5ea1=fs[_0xe35e('0x55')](path['join'](config[_0xe35e('0x57')],_0xe35e('0x58')),_0xe35e('0x59'));var _0x5f1c84=ejs[_0xe35e('0x61')](_0x2e5ea1,{'networks':_0x480f6f||[]});fs[_0xe35e('0x5a')](_0xe35e('0x5b'),_0x5f1c84);return respondWithRpcPromise(_0xe35e('0x5c'),_0xe35e('0x66'),{'module':'res_stun_monitor.so'});}else if(_0x3a0b0a[_0xe35e('0x39')][_0xe35e('0x5e')]()==_0xe35e('0x5f')){var _0x25f13c=fs['readFileSync'](path[_0xe35e('0x56')](config['root'],_0xe35e('0x60')),_0xe35e('0x59'));var _0x4ea03d=ejs['render'](_0x25f13c,{'networks':_0x480f6f||[]});fs['writeFileSync'](_0xe35e('0x68'),_0x4ea03d);return respondWithRpcPromise('Reload',_0xe35e('0x66'),{'module':_0xe35e('0x5d')});}else{var _0x2a693e=fs[_0xe35e('0x55')](path[_0xe35e('0x56')](config['root'],_0xe35e('0x62')),_0xe35e('0x59'));var _0x1f3e81=ejs['render'](_0x2a693e,{'networks':_0x480f6f||[]});fs[_0xe35e('0x5a')](util['format'](_0xe35e('0x63'),_0x17d364[_0xe35e('0x53')][_0xe35e('0x39')][_0xe35e('0x64')]()),_0x1f3e81);return respondWithRpcPromise(_0xe35e('0x5c'),_0xe35e('0x66'),{'module':_0xe35e('0x65')});}return null;})['then'](function(_0x4b6884){if(_0x4b6884){return _0x3a0b0a;}return null;});})['then'](respondWithResult(_0x3bf837,null))[_0xe35e('0x27')](handleError(_0x3bf837,null));};exports['destroy']=function(_0x395710,_0xae4fd2,_0x3d2b42){var _0x3461fd;return db['Network']['find']({'where':{'id':_0x395710[_0xe35e('0x67')]['id']}})[_0xe35e('0x1d')](function(_0x2e0a07){_0x3461fd=_0x2e0a07;return _0x2e0a07;})[_0xe35e('0x1d')](handleEntityNotFound(_0xae4fd2,null))[_0xe35e('0x1d')](removeEntity(_0xae4fd2,null))[_0xe35e('0x1d')](function(){if(_0x3461fd){return db[_0xe35e('0x37')]['findAll']({'where':{'type':_0x3461fd[_0xe35e('0x39')]},'raw':!![]});}})['then'](function(_0x3d7f6e){if(_0x3461fd['type'][_0xe35e('0x5e')]()==_0xe35e('0x54')){var _0x112d95=fs[_0xe35e('0x55')](path[_0xe35e('0x56')](config[_0xe35e('0x57')],_0xe35e('0x58')),_0xe35e('0x59'));var _0x3c7e97=ejs[_0xe35e('0x61')](_0x112d95,{'networks':_0x3d7f6e||[]});fs['writeFileSync'](_0xe35e('0x5b'),_0x3c7e97);return respondWithRpcPromise('Reload','destroy',{'module':'res_stun_monitor.so'});}else if(_0x3461fd[_0xe35e('0x39')][_0xe35e('0x5e')]()=='TURN'){var _0x26e553=fs[_0xe35e('0x55')](path[_0xe35e('0x56')](config['root'],_0xe35e('0x60')),'utf8');var _0x11d91f=ejs[_0xe35e('0x61')](_0x26e553,{'networks':_0x3d7f6e||[]});fs['writeFileSync'](_0xe35e('0x68'),_0x11d91f);return respondWithRpcPromise('Reload','destroy',{'module':'res_stun_monitor.so'});}else{var _0x44c8d0=fs[_0xe35e('0x55')](path[_0xe35e('0x56')](config[_0xe35e('0x57')],_0xe35e('0x62')),_0xe35e('0x59'));var _0x5af96e=ejs['render'](_0x44c8d0,{'networks':_0x3d7f6e||[]});fs[_0xe35e('0x5a')](util[_0xe35e('0x69')](_0xe35e('0x63'),_0x395710['body']['type'][_0xe35e('0x64')]()),_0x5af96e);return respondWithRpcPromise(_0xe35e('0x5c'),_0xe35e('0x34'),{'module':_0xe35e('0x65')});}return null;})[_0xe35e('0x27')](handleError(_0xae4fd2,null));}; \ No newline at end of file +var _0x8ddc=['fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','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','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','stack','name','map','Network','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','rows','show','includeAll','find','create','sequelize','transaction','body','findAll','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','update','params','STUN','TURN','toLowerCase','zip-dir'];(function(_0x57f340,_0x3edf9b){var _0x76037b=function(_0x1bd7ba){while(--_0x1bd7ba){_0x57f340['push'](_0x57f340['shift']());}};_0x76037b(++_0x3edf9b);}(_0x8ddc,0x1af));var _0xc8dd=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x8ddc[_0x4de586];return _0x46baf5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc8dd('0x0'));var jsonpatch=require(_0xc8dd('0x1'));var rp=require(_0xc8dd('0x2'));var moment=require(_0xc8dd('0x3'));var BPromise=require(_0xc8dd('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc8dd('0x5'));var sox=require('sox');var csv=require(_0xc8dd('0x6'));var ejs=require(_0xc8dd('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc8dd('0x8'));var squel=require(_0xc8dd('0x9'));var crypto=require(_0xc8dd('0xa'));var jsforce=require(_0xc8dd('0xb'));var deskjs=require(_0xc8dd('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc8dd('0xd'));var Redis=require(_0xc8dd('0xe'));var authService=require(_0xc8dd('0xf'));var qs=require(_0xc8dd('0x10'));var as=require(_0xc8dd('0x11'));var hardwareService=require(_0xc8dd('0x12'));var logger=require(_0xc8dd('0x13'))(_0xc8dd('0x14'));var utils=require(_0xc8dd('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc8dd('0x16'));var db=require(_0xc8dd('0x17'))['db'];var jayson=require(_0xc8dd('0x18'));var client=jayson['client'][_0xc8dd('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4a1af1,_0x49568b,_0x41a2a3,_0x12e854){return new BPromise(function(_0x5bd512,_0x47ab54){var _0xd31a38=_0x12e854||client;return _0xd31a38[_0xc8dd('0x1a')](_0x4a1af1,_0x41a2a3)[_0xc8dd('0x1b')](function(_0xd9e991){logger[_0xc8dd('0x1c')](_0xc8dd('0x1d'),_0x49568b,_0xc8dd('0x1e'));logger[_0xc8dd('0x1f')](_0xc8dd('0x20'),_0x49568b,_0xc8dd('0x1e'),JSON[_0xc8dd('0x21')](_0xd9e991));if(_0xd9e991[_0xc8dd('0x22')]){if(_0xd9e991[_0xc8dd('0x22')][_0xc8dd('0x23')]===0x1f4){logger['error'](_0xc8dd('0x1d'),_0x49568b,_0xd9e991[_0xc8dd('0x22')][_0xc8dd('0x24')]);return _0x47ab54(_0xd9e991[_0xc8dd('0x22')][_0xc8dd('0x24')]);}logger[_0xc8dd('0x22')]('Network,\x20%s,\x20%s',_0x49568b,_0xd9e991['error'][_0xc8dd('0x24')]);return _0x5bd512(_0xd9e991[_0xc8dd('0x22')][_0xc8dd('0x24')]);}else{logger[_0xc8dd('0x1c')](_0xc8dd('0x1d'),_0x49568b,_0xc8dd('0x1e'));_0x5bd512(_0xd9e991[_0xc8dd('0x25')][_0xc8dd('0x24')]);}})[_0xc8dd('0x26')](function(_0x4d8842){logger[_0xc8dd('0x22')]('Network,\x20%s,\x20%s',_0x49568b,_0x4d8842);_0x47ab54(_0x4d8842);});});}function respondWithStatusCode(_0x445b1f,_0x58d8df){_0x58d8df=_0x58d8df||0xcc;return function(_0x1c17e2){if(_0x1c17e2){return _0x445b1f[_0xc8dd('0x27')](_0x58d8df);}return _0x445b1f[_0xc8dd('0x28')](_0x58d8df)[_0xc8dd('0x29')]();};}function respondWithResult(_0x5b69b7,_0x1adb48){_0x1adb48=_0x1adb48||0xc8;return function(_0x56f9e1){if(_0x56f9e1){return _0x5b69b7[_0xc8dd('0x28')](_0x1adb48)[_0xc8dd('0x2a')](_0x56f9e1);}};}function respondWithFilteredResult(_0x5e2f4c,_0x1cc01a){return function(_0x55de22){if(_0x55de22){var _0xf83062=typeof _0x1cc01a[_0xc8dd('0x2b')]==='undefined'&&typeof _0x1cc01a['limit']===_0xc8dd('0x2c');var _0x50a1f7=_0x55de22['count'];var _0x1b2ccb=_0xf83062?0x0:_0x1cc01a[_0xc8dd('0x2b')];var _0x4d27e1=_0xf83062?_0x55de22[_0xc8dd('0x2d')]:_0x1cc01a[_0xc8dd('0x2b')]+_0x1cc01a[_0xc8dd('0x2e')];var _0xcc1f64;if(_0x4d27e1>=_0x50a1f7){_0x4d27e1=_0x50a1f7;_0xcc1f64=0xc8;}else{_0xcc1f64=0xce;}_0x5e2f4c['status'](_0xcc1f64);return _0x5e2f4c[_0xc8dd('0x2f')](_0xc8dd('0x30'),_0x1b2ccb+'-'+_0x4d27e1+'/'+_0x50a1f7)[_0xc8dd('0x2a')](_0x55de22);}return null;};}function patchUpdates(_0xcbdc32){return function(_0x254edb){try{jsonpatch[_0xc8dd('0x31')](_0x254edb,_0xcbdc32,!![]);}catch(_0x2822bd){return BPromise[_0xc8dd('0x32')](_0x2822bd);}return _0x254edb[_0xc8dd('0x33')]();};}function saveUpdates(_0x20307d,_0x4b8167){return function(_0x2dfe29){if(_0x2dfe29){return _0x2dfe29['update'](_0x20307d)['then'](function(_0x47483d){return _0x47483d;});}return null;};}function removeEntity(_0x492198,_0x3dd84f){return function(_0xdf0d9f){if(_0xdf0d9f){return _0xdf0d9f[_0xc8dd('0x34')]()[_0xc8dd('0x1b')](function(){_0x492198['status'](0xcc)[_0xc8dd('0x29')]();});}};}function handleEntityNotFound(_0x576969,_0x3ddb4b){return function(_0x5e2b43){if(!_0x5e2b43){_0x576969[_0xc8dd('0x27')](0x194);}return _0x5e2b43;};}function handleError(_0x48e79b,_0x451831){_0x451831=_0x451831||0x1f4;return function(_0xbf7b21){logger['error'](_0xbf7b21[_0xc8dd('0x35')]);if(_0xbf7b21[_0xc8dd('0x36')]){delete _0xbf7b21['name'];}_0x48e79b[_0xc8dd('0x28')](_0x451831)['send'](_0xbf7b21);};}exports['index']=function(_0x1f4674,_0x480805){var _0x26d9dd={},_0x22ba0c={},_0x3834cf={'count':0x0,'rows':[]};var _0x2d770d=_[_0xc8dd('0x37')](db[_0xc8dd('0x38')][_0xc8dd('0x39')],function(_0x3510b9){return{'name':_0x3510b9['fieldName'],'type':_0x3510b9[_0xc8dd('0x3a')][_0xc8dd('0x3b')]};});_0x22ba0c[_0xc8dd('0x3c')]=_[_0xc8dd('0x37')](_0x2d770d,_0xc8dd('0x36'));_0x22ba0c[_0xc8dd('0x3d')]=_[_0xc8dd('0x3e')](_0x1f4674['query']);_0x22ba0c[_0xc8dd('0x3f')]=_[_0xc8dd('0x40')](_0x22ba0c[_0xc8dd('0x3c')],_0x22ba0c[_0xc8dd('0x3d')]);_0x26d9dd[_0xc8dd('0x41')]=_['intersection'](_0x22ba0c['model'],qs[_0xc8dd('0x42')](_0x1f4674[_0xc8dd('0x3d')][_0xc8dd('0x42')]));_0x26d9dd[_0xc8dd('0x41')]=_0x26d9dd['attributes'][_0xc8dd('0x43')]?_0x26d9dd[_0xc8dd('0x41')]:_0x22ba0c['model'];if(!_0x1f4674[_0xc8dd('0x3d')][_0xc8dd('0x44')](_0xc8dd('0x45'))){_0x26d9dd[_0xc8dd('0x2e')]=qs['limit'](_0x1f4674[_0xc8dd('0x3d')]['limit']);_0x26d9dd['offset']=qs[_0xc8dd('0x2b')](_0x1f4674['query'][_0xc8dd('0x2b')]);}_0x26d9dd[_0xc8dd('0x46')]=qs['sort'](_0x1f4674[_0xc8dd('0x3d')][_0xc8dd('0x47')]);_0x26d9dd[_0xc8dd('0x48')]=qs[_0xc8dd('0x3f')](_['pick'](_0x1f4674[_0xc8dd('0x3d')],_0x22ba0c[_0xc8dd('0x3f')]),_0x2d770d);if(_0x1f4674[_0xc8dd('0x3d')][_0xc8dd('0x49')]){_0x26d9dd[_0xc8dd('0x48')]=_[_0xc8dd('0x4a')](_0x26d9dd[_0xc8dd('0x48')],{'$or':_['map'](_0x2d770d,function(_0x369dda){if(_0x369dda['type']!==_0xc8dd('0x4b')){var _0x4b35af={};_0x4b35af[_0x369dda[_0xc8dd('0x36')]]={'$like':'%'+_0x1f4674[_0xc8dd('0x3d')][_0xc8dd('0x49')]+'%'};return _0x4b35af;}})});}_0x26d9dd=_['merge']({},_0x26d9dd,_0x1f4674[_0xc8dd('0x4c')]);var _0xd36bd2={'where':_0x26d9dd['where']};return db[_0xc8dd('0x38')]['count'](_0xd36bd2)[_0xc8dd('0x1b')](function(_0x3ba2d8){_0x3834cf[_0xc8dd('0x2d')]=_0x3ba2d8;if(_0x1f4674[_0xc8dd('0x3d')]['includeAll']){_0x26d9dd[_0xc8dd('0x4d')]=[{'all':!![]}];}return db[_0xc8dd('0x38')]['findAll'](_0x26d9dd);})[_0xc8dd('0x1b')](function(_0x2d8160){_0x3834cf[_0xc8dd('0x4e')]=_0x2d8160;return _0x3834cf;})[_0xc8dd('0x1b')](respondWithFilteredResult(_0x480805,_0x26d9dd))[_0xc8dd('0x26')](handleError(_0x480805,null));};exports[_0xc8dd('0x4f')]=function(_0x51d64d,_0x17db31){var _0x57db4f={'raw':!![],'where':{'id':_0x51d64d['params']['id']}},_0x453f08={};_0x453f08['model']=_[_0xc8dd('0x3e')](db['Network'][_0xc8dd('0x39')]);_0x453f08[_0xc8dd('0x3d')]=_[_0xc8dd('0x3e')](_0x51d64d[_0xc8dd('0x3d')]);_0x453f08[_0xc8dd('0x3f')]=_['intersection'](_0x453f08[_0xc8dd('0x3c')],_0x453f08[_0xc8dd('0x3d')]);_0x57db4f['attributes']=_[_0xc8dd('0x40')](_0x453f08[_0xc8dd('0x3c')],qs[_0xc8dd('0x42')](_0x51d64d['query'][_0xc8dd('0x42')]));_0x57db4f[_0xc8dd('0x41')]=_0x57db4f['attributes'][_0xc8dd('0x43')]?_0x57db4f['attributes']:_0x453f08[_0xc8dd('0x3c')];if(_0x51d64d['query'][_0xc8dd('0x50')]){_0x57db4f[_0xc8dd('0x4d')]=[{'all':!![]}];}_0x57db4f=_[_0xc8dd('0x4a')]({},_0x57db4f,_0x51d64d[_0xc8dd('0x4c')]);return db[_0xc8dd('0x38')][_0xc8dd('0x51')](_0x57db4f)['then'](handleEntityNotFound(_0x17db31,null))[_0xc8dd('0x1b')](respondWithResult(_0x17db31,null))[_0xc8dd('0x26')](handleError(_0x17db31,null));};exports[_0xc8dd('0x52')]=function(_0x3dfb8d,_0x2239ef,_0x278c35){var _0x580850;return db[_0xc8dd('0x53')][_0xc8dd('0x54')](function(_0x1b84b2){return db[_0xc8dd('0x38')]['create'](_0x3dfb8d[_0xc8dd('0x55')],{'raw':!![]})[_0xc8dd('0x1b')](function(_0x33ae23){_0x580850=_0x33ae23;return db[_0xc8dd('0x38')][_0xc8dd('0x56')]({'where':{'type':_0x3dfb8d[_0xc8dd('0x55')][_0xc8dd('0x3a')]},'raw':!![]});})['then'](function(_0x3d89a7){if(_0x580850['type'][_0xc8dd('0x57')]()=='STUN'){var _0x4ee275=fs[_0xc8dd('0x58')](path[_0xc8dd('0x59')](config[_0xc8dd('0x5a')],_0xc8dd('0x5b')),_0xc8dd('0x5c'));var _0x18762d=ejs[_0xc8dd('0x5d')](_0x4ee275,{'networks':_0x3d89a7||[]});fs[_0xc8dd('0x5e')](_0xc8dd('0x5f'),_0x18762d);return respondWithRpcPromise(_0xc8dd('0x60'),_0xc8dd('0x52'),{'module':_0xc8dd('0x61')});}else if(_0x580850['type'][_0xc8dd('0x57')]()=='TURN'){var _0x348181=fs[_0xc8dd('0x58')](path[_0xc8dd('0x59')](config[_0xc8dd('0x5a')],_0xc8dd('0x62')),'utf8');var _0x5e03fb=ejs[_0xc8dd('0x5d')](_0x348181,{'networks':_0x3d89a7||[]});fs['writeFileSync'](_0xc8dd('0x63'),_0x5e03fb);return respondWithRpcPromise(_0xc8dd('0x60'),'create',{'module':_0xc8dd('0x61')});}else{var _0x8a4bb9=fs['readFileSync'](path['join'](config['root'],_0xc8dd('0x64')),_0xc8dd('0x5c'));var _0x2f6a4a=ejs[_0xc8dd('0x5d')](_0x8a4bb9,{'networks':_0x3d89a7||[]});fs['writeFileSync'](util['format'](_0xc8dd('0x65'),_0x3dfb8d[_0xc8dd('0x55')][_0xc8dd('0x3a')]['toLowerCase']()),_0x2f6a4a);return respondWithRpcPromise(_0xc8dd('0x60'),_0xc8dd('0x52'),{'module':_0xc8dd('0x66')});}return null;})['then'](function(){return _0x580850;});})[_0xc8dd('0x1b')](respondWithResult(_0x2239ef,0xc9))[_0xc8dd('0x26')](handleError(_0x2239ef,null));};exports[_0xc8dd('0x67')]=function(_0x11959a,_0x29d1f8,_0x8338ba){var _0x3d615b;return db[_0xc8dd('0x53')][_0xc8dd('0x54')](function(_0x437a88){return db['Network'][_0xc8dd('0x51')]({'where':{'id':_0x11959a[_0xc8dd('0x68')]['id']}})[_0xc8dd('0x1b')](handleEntityNotFound(_0x29d1f8,null))[_0xc8dd('0x1b')](saveUpdates(_0x11959a[_0xc8dd('0x55')],null))[_0xc8dd('0x1b')](function(_0x9fcec7){if(_0x9fcec7){_0x3d615b=_0x9fcec7;return db['Network'][_0xc8dd('0x56')]({'where':{'type':_0x3d615b[_0xc8dd('0x3a')]},'raw':!![]});}return null;})[_0xc8dd('0x1b')](function(_0x4b5a99){if(_0x3d615b[_0xc8dd('0x3a')][_0xc8dd('0x57')]()==_0xc8dd('0x69')){var _0x25fbb0=fs[_0xc8dd('0x58')](path[_0xc8dd('0x59')](config[_0xc8dd('0x5a')],'server/files/templates/stun_multiple.ejs'),_0xc8dd('0x5c'));var _0x3f66a0=ejs[_0xc8dd('0x5d')](_0x25fbb0,{'networks':_0x4b5a99||[]});fs[_0xc8dd('0x5e')](_0xc8dd('0x5f'),_0x3f66a0);return respondWithRpcPromise(_0xc8dd('0x60'),_0xc8dd('0x67'),{'module':_0xc8dd('0x61')});}else if(_0x3d615b['type'][_0xc8dd('0x57')]()==_0xc8dd('0x6a')){var _0xdcc804=fs[_0xc8dd('0x58')](path[_0xc8dd('0x59')](config[_0xc8dd('0x5a')],_0xc8dd('0x62')),_0xc8dd('0x5c'));var _0x2de69e=ejs['render'](_0xdcc804,{'networks':_0x4b5a99||[]});fs[_0xc8dd('0x5e')]('/etc/asterisk/turn_xcally.conf',_0x2de69e);return respondWithRpcPromise('Reload',_0xc8dd('0x67'),{'module':'res_stun_monitor.so'});}else{var _0x285137=fs[_0xc8dd('0x58')](path['join'](config['root'],_0xc8dd('0x64')),'utf8');var _0x177324=ejs[_0xc8dd('0x5d')](_0x285137,{'networks':_0x4b5a99||[]});fs[_0xc8dd('0x5e')](util['format'](_0xc8dd('0x65'),_0x11959a[_0xc8dd('0x55')][_0xc8dd('0x3a')][_0xc8dd('0x6b')]()),_0x177324);return respondWithRpcPromise('Reload','update',{'module':_0xc8dd('0x66')});}return null;})[_0xc8dd('0x1b')](function(_0x134583){if(_0x134583){return _0x3d615b;}return null;});})[_0xc8dd('0x1b')](respondWithResult(_0x29d1f8,null))[_0xc8dd('0x26')](handleError(_0x29d1f8,null));};exports[_0xc8dd('0x34')]=function(_0x113b83,_0x4bb482,_0x555db2){var _0x15c107;return db[_0xc8dd('0x38')][_0xc8dd('0x51')]({'where':{'id':_0x113b83['params']['id']}})['then'](function(_0x251b82){_0x15c107=_0x251b82;return _0x251b82;})[_0xc8dd('0x1b')](handleEntityNotFound(_0x4bb482,null))[_0xc8dd('0x1b')](removeEntity(_0x4bb482,null))[_0xc8dd('0x1b')](function(){if(_0x15c107){return db[_0xc8dd('0x38')][_0xc8dd('0x56')]({'where':{'type':_0x15c107[_0xc8dd('0x3a')]},'raw':!![]});}})['then'](function(_0x3c35a3){if(_0x15c107[_0xc8dd('0x3a')][_0xc8dd('0x57')]()==_0xc8dd('0x69')){var _0xd6dc79=fs[_0xc8dd('0x58')](path['join'](config[_0xc8dd('0x5a')],_0xc8dd('0x5b')),_0xc8dd('0x5c'));var _0x47d283=ejs[_0xc8dd('0x5d')](_0xd6dc79,{'networks':_0x3c35a3||[]});fs['writeFileSync'](_0xc8dd('0x5f'),_0x47d283);return respondWithRpcPromise(_0xc8dd('0x60'),_0xc8dd('0x34'),{'module':_0xc8dd('0x61')});}else if(_0x15c107['type']['toUpperCase']()==_0xc8dd('0x6a')){var _0x43dba8=fs[_0xc8dd('0x58')](path[_0xc8dd('0x59')](config[_0xc8dd('0x5a')],_0xc8dd('0x62')),_0xc8dd('0x5c'));var _0x20bbdf=ejs[_0xc8dd('0x5d')](_0x43dba8,{'networks':_0x3c35a3||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x20bbdf);return respondWithRpcPromise(_0xc8dd('0x60'),'destroy',{'module':_0xc8dd('0x61')});}else{var _0x8e668=fs[_0xc8dd('0x58')](path[_0xc8dd('0x59')](config[_0xc8dd('0x5a')],_0xc8dd('0x64')),_0xc8dd('0x5c'));var _0x2717ef=ejs[_0xc8dd('0x5d')](_0x8e668,{'networks':_0x3c35a3||[]});fs[_0xc8dd('0x5e')](util['format'](_0xc8dd('0x65'),_0x113b83[_0xc8dd('0x55')][_0xc8dd('0x3a')][_0xc8dd('0x6b')]()),_0x2717ef);return respondWithRpcPromise('Reload',_0xc8dd('0x34'),{'module':_0xc8dd('0x66')});}return null;})[_0xc8dd('0x26')](handleError(_0x4bb482,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index f753c31..5b7ba34 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 _0xd004=['moment','bluebird','path','rimraf','../../config/environment','./network.attributes','exports','Network','network','lodash','../../config/logger','api'];(function(_0x19258b,_0x22e850){var _0x5be66a=function(_0x24e321){while(--_0x24e321){_0x19258b['push'](_0x19258b['shift']());}};_0x5be66a(++_0x22e850);}(_0xd004,0xc9));var _0x4d00=function(_0x26c562,_0xe4be5c){_0x26c562=_0x26c562-0x0;var _0x462368=_0xd004[_0x26c562];return _0x462368;};'use strict';var _=require(_0x4d00('0x0'));var util=require('util');var logger=require(_0x4d00('0x1'))(_0x4d00('0x2'));var moment=require(_0x4d00('0x3'));var BPromise=require(_0x4d00('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d00('0x5'));var rimraf=require(_0x4d00('0x6'));var config=require(_0x4d00('0x7'));var attributes=require(_0x4d00('0x8'));module[_0x4d00('0x9')]=function(_0xe26cd5,_0x5909a7){return _0xe26cd5['define'](_0x4d00('0xa'),attributes,{'tableName':_0x4d00('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3866=['Network','network','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','define'];(function(_0xc80b2e,_0x206b35){var _0x16754c=function(_0x43f22e){while(--_0x43f22e){_0xc80b2e['push'](_0xc80b2e['shift']());}};_0x16754c(++_0x206b35);}(_0x3866,0x1de));var _0x6386=function(_0x425e6a,_0x169c75){_0x425e6a=_0x425e6a-0x0;var _0x17f5e9=_0x3866[_0x425e6a];return _0x17f5e9;};'use strict';var _=require(_0x6386('0x0'));var util=require(_0x6386('0x1'));var logger=require(_0x6386('0x2'))(_0x6386('0x3'));var moment=require(_0x6386('0x4'));var BPromise=require(_0x6386('0x5'));var rp=require(_0x6386('0x6'));var fs=require('fs');var path=require(_0x6386('0x7'));var rimraf=require(_0x6386('0x8'));var config=require(_0x6386('0x9'));var attributes=require(_0x6386('0xa'));module['exports']=function(_0x237e40,_0x4446ad){return _0x237e40[_0x6386('0xb')](_0x6386('0xc'),attributes,{'tableName':_0x6386('0xd'),'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 66972fe..7f3b342 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 _0x3e4b=['error','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','code'];(function(_0x3f7101,_0x3af08b){var _0x1a30a0=function(_0x750e5b){while(--_0x750e5b){_0x3f7101['push'](_0x3f7101['shift']());}};_0x1a30a0(++_0x3af08b);}(_0x3e4b,0x94));var _0xb3e4=function(_0x57df29,_0x50df68){_0x57df29=_0x57df29-0x0;var _0x321b13=_0x3e4b[_0x57df29];return _0x321b13;};'use strict';var _=require(_0xb3e4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb3e4('0x1'));var rs=require(_0xb3e4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3e4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb3e4('0x4'))(_0xb3e4('0x5'));var config=require('../../config/environment');var jayson=require(_0xb3e4('0x6'));var client=jayson[_0xb3e4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f6e0a,_0x173009,_0x426c97){return new BPromise(function(_0x256566,_0x171c76){return client['request'](_0x2f6e0a,_0x426c97)[_0xb3e4('0x8')](function(_0x174221){logger[_0xb3e4('0x9')](_0xb3e4('0xa'),_0x173009,'request\x20sent');logger[_0xb3e4('0xb')](_0xb3e4('0xc'),_0x173009,'request\x20sent',JSON['stringify'](_0x174221));if(_0x174221['error']){if(_0x174221['error'][_0xb3e4('0xd')]===0x1f4){logger[_0xb3e4('0xe')](_0xb3e4('0xa'),_0x173009,_0x174221[_0xb3e4('0xe')][_0xb3e4('0xf')]);return _0x171c76(_0x174221['error'][_0xb3e4('0xf')]);}logger[_0xb3e4('0xe')](_0xb3e4('0xa'),_0x173009,_0x174221[_0xb3e4('0xe')]['message']);return _0x256566(_0x174221['error']['message']);}else{logger[_0xb3e4('0x9')](_0xb3e4('0xa'),_0x173009,'request\x20sent');_0x256566(_0x174221[_0xb3e4('0x10')][_0xb3e4('0xf')]);}})[_0xb3e4('0x11')](function(_0x3c85be){logger[_0xb3e4('0xe')](_0xb3e4('0xa'),_0x173009,_0x3c85be);_0x171c76(_0x3c85be);});});} \ No newline at end of file +var _0xfe0e=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xfe0e,0xdd));var _0xefe0=function(_0x4ef7e2,_0x257e37){_0x4ef7e2=_0x4ef7e2-0x0;var _0x84fa8=_0xfe0e[_0x4ef7e2];return _0x84fa8;};'use strict';var _=require(_0xefe0('0x0'));var util=require('util');var moment=require(_0xefe0('0x1'));var BPromise=require(_0xefe0('0x2'));var rs=require(_0xefe0('0x3'));var fs=require('fs');var Redis=require(_0xefe0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xefe0('0x5'));var logger=require('../../config/logger')(_0xefe0('0x6'));var config=require(_0xefe0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xefe0('0x8')][_0xefe0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x349516,_0x2a982b,_0x23691f){return new BPromise(function(_0x4e5395,_0x3031fe){return client['request'](_0x349516,_0x23691f)[_0xefe0('0xa')](function(_0x4e0d6e){logger[_0xefe0('0xb')](_0xefe0('0xc'),_0x2a982b,_0xefe0('0xd'));logger['debug'](_0xefe0('0xe'),_0x2a982b,_0xefe0('0xd'),JSON[_0xefe0('0xf')](_0x4e0d6e));if(_0x4e0d6e[_0xefe0('0x10')]){if(_0x4e0d6e[_0xefe0('0x10')]['code']===0x1f4){logger[_0xefe0('0x10')](_0xefe0('0xc'),_0x2a982b,_0x4e0d6e['error'][_0xefe0('0x11')]);return _0x3031fe(_0x4e0d6e['error'][_0xefe0('0x11')]);}logger[_0xefe0('0x10')](_0xefe0('0xc'),_0x2a982b,_0x4e0d6e[_0xefe0('0x10')][_0xefe0('0x11')]);return _0x4e5395(_0x4e0d6e[_0xefe0('0x10')][_0xefe0('0x11')]);}else{logger[_0xefe0('0xb')](_0xefe0('0xc'),_0x2a982b,_0xefe0('0xd'));_0x4e5395(_0x4e0d6e[_0xefe0('0x12')][_0xefe0('0x11')]);}})[_0xefe0('0x13')](function(_0xd81a3c){logger[_0xefe0('0x10')]('Network,\x20%s,\x20%s',_0x2a982b,_0xd81a3c);_0x3031fe(_0xd81a3c);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 95a8cc2..a7677ce 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 _0x53ec=['removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','destroy','delete','removeDispositions'];(function(_0xf04c6d,_0xe98786){var _0x4a804e=function(_0x431a0a){while(--_0x431a0a){_0xf04c6d['push'](_0xf04c6d['shift']());}};_0x4a804e(++_0xe98786);}(_0x53ec,0x192));var _0xc53e=function(_0x454cbd,_0x436d19){_0x454cbd=_0x454cbd-0x0;var _0x45b4bf=_0x53ec[_0x454cbd];return _0x45b4bf;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['get']('/:id/canned_answers',auth[_0xc53e('0x9')](),controller['getAnswers']);router['get'](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xc53e('0x13')]);router[_0xc53e('0xa')](_0xc53e('0x14'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x15')]);router[_0xc53e('0x16')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x17')]);router[_0xc53e('0x16')](_0xc53e('0xf'),auth['isAuthenticated'](),controller[_0xc53e('0x18')]);router[_0xc53e('0x16')](_0xc53e('0x19'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1a')]);router[_0xc53e('0x16')](_0xc53e('0x1b'),controller[_0xc53e('0x1c')]);router[_0xc53e('0x16')]('/:id/applications',auth['isAuthenticated'](),controller[_0xc53e('0x1d')]);router[_0xc53e('0x16')](_0xc53e('0x14'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1e')]);router[_0xc53e('0x16')](_0xc53e('0x1f'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x20')]);router[_0xc53e('0x21')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x22')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x23')]);router[_0xc53e('0x24')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x25')]);router['delete']('/:id/canned_answers',auth[_0xc53e('0x9')](),controller['removeAnswers']);router[_0xc53e('0x24')](_0xc53e('0x14'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x26')]);module[_0xc53e('0x27')]=router; \ No newline at end of file +var _0x7217=['Router','fs-extra','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','post','addDisposition','addAnswer','/:id/notify','addApplications','addAgents','/:id/send','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express'];(function(_0xf49bd3,_0x4aead6){var _0x54b2e2=function(_0x265c95){while(--_0x265c95){_0xf49bd3['push'](_0xf49bd3['shift']());}};_0x54b2e2(++_0x4aead6);}(_0x7217,0x19e));var _0x7721=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x7217[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getApplications']);router[_0x7721('0x8')](_0x7721('0x14'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x8')](_0x7721('0x16'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x17')]('/',auth[_0x7721('0x9')](),controller['create']);router['post']('/:id/dispositions',auth[_0x7721('0x9')](),controller[_0x7721('0x18')]);router[_0x7721('0x17')](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router['post'](_0x7721('0x1a'),controller['notify']);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1b')]);router[_0x7721('0x17')](_0x7721('0x16'),auth[_0x7721('0x9')](),controller[_0x7721('0x1c')]);router[_0x7721('0x17')](_0x7721('0x1d'),auth['isAuthenticated'](),controller[_0x7721('0x1e')]);router[_0x7721('0x1f')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x20')]('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x21')]);router[_0x7721('0x20')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller[_0x7721('0x22')]);router[_0x7721('0x20')]('/:id/canned_answers',auth[_0x7721('0x9')](),controller[_0x7721('0x23')]);router[_0x7721('0x20')](_0x7721('0x16'),auth[_0x7721('0x9')](),controller[_0x7721('0x24')]);module[_0x7721('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 9d24e74..43e7290 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 _0x2f9d=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0x2f9d,0x1f1));var _0xd2f9=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x2f9d[_0x47e7cb];return _0x2a8874;};'use strict';var Sequelize=require(_0xd2f9('0x0'));var rs=require(_0xd2f9('0x1'));module['exports']={'name':{'type':Sequelize[_0xd2f9('0x2')],'unique':_0xd2f9('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xd2f9('0x2')]},'token':{'type':Sequelize[_0xd2f9('0x2')],'defaultValue':function(){return rs[_0xd2f9('0x4')]();}},'replyUri':{'type':Sequelize[_0xd2f9('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xd2f9('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd2f9('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xd2f9('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd2f9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xd2f9('0x2')]},'queueTransfer':{'type':Sequelize[_0xd2f9('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd2f9('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd2f9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xd2f9('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xd2f9('0x6')],'defaultValue':![],'comment':_0xd2f9('0x9'),'set':function(_0x52b4c0){if(!_0x52b4c0)this[_0xd2f9('0xa')](_0xd2f9('0xb'),null);this['setDataValue'](_0xd2f9('0xc'),_0x52b4c0);}}}; \ No newline at end of file +var _0x8529=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x250448,_0x274e33){var _0x46d664=function(_0x157974){while(--_0x157974){_0x250448['push'](_0x250448['shift']());}};_0x46d664(++_0x274e33);}(_0x8529,0xff));var _0x9852=function(_0x1d0e7d,_0x1e6fb8){_0x1d0e7d=_0x1d0e7d-0x0;var _0x37b9b7=_0x8529[_0x1d0e7d];return _0x37b9b7;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x9852('0x0')]={'name':{'type':Sequelize[_0x9852('0x1')],'unique':_0x9852('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9852('0x1')]},'token':{'type':Sequelize[_0x9852('0x1')],'defaultValue':function(){return rs[_0x9852('0x3')]();}},'replyUri':{'type':Sequelize[_0x9852('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9852('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9852('0x4')],'defaultValue':function(){return _0x9852('0x5');}},'notificationSound':{'type':Sequelize[_0x9852('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9852('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9852('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x9852('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9852('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9852('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9852('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x9852('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9852('0x9'),'set':function(_0x575738){if(!_0x575738)this[_0x9852('0xa')](_0x9852('0xb'),null);this[_0x9852('0xa')]('mandatoryDisposition',_0x575738);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 0676f99..c12c185 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 _0x43fd=['then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelAccount,\x20%s,\x20%s','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','OpenchannelAccount','includeAll','include','rows','catch','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','getDispositions','rawAttributes','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','updatedAt','CompanyId','ListId','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','List','Contacts','DESC','OpenchannelApplication','Applications','applications','list','orderBy','priority','asc','account','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','OpenchannelMessage','UserId','User','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','findAndCountAll','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','Messages','dataValues','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./openchannelAccount.socket','register','client','http','request'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x43fd,0x150));var _0xd43f=function(_0x1e2e41,_0x103962){_0x1e2e41=_0x1e2e41-0x0;var _0x29124f=_0x43fd[_0x1e2e41];return _0x29124f;};'use strict';var emlformat=require(_0xd43f('0x0'));var rimraf=require(_0xd43f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd43f('0x2'));var rp=require('request-promise');var moment=require(_0xd43f('0x3'));var BPromise=require(_0xd43f('0x4'));var Mustache=require(_0xd43f('0x5'));var util=require(_0xd43f('0x6'));var path=require(_0xd43f('0x7'));var sox=require(_0xd43f('0x8'));var csv=require(_0xd43f('0x9'));var ejs=require(_0xd43f('0xa'));var fs=require('fs');var fs_extra=require(_0xd43f('0xb'));var _=require(_0xd43f('0xc'));var squel=require(_0xd43f('0xd'));var crypto=require(_0xd43f('0xe'));var jsforce=require(_0xd43f('0xf'));var deskjs=require(_0xd43f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xd43f('0x11'));var Papa=require(_0xd43f('0x12'));var Redis=require(_0xd43f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd43f('0x14'));var as=require(_0xd43f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd43f('0x16'))(_0xd43f('0x17'));var utils=require(_0xd43f('0x18'));var config=require(_0xd43f('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd43f('0x1a')]=_[_0xd43f('0x1b')](config['redis'],{'host':_0xd43f('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd43f('0x1d'))[_0xd43f('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd43f('0x1f')][_0xd43f('0x20')]({'port':0x232c});var client9002=jayson['client'][_0xd43f('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x351c9c,_0x10f584,_0x182ed6,_0xce9f7a){return new BPromise(function(_0x5d2f85,_0x47a3d8){var _0x5c03a6=_0xce9f7a||client;return _0x5c03a6[_0xd43f('0x21')](_0x351c9c,_0x182ed6)[_0xd43f('0x22')](function(_0xda0dcc){logger[_0xd43f('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x10f584,_0xd43f('0x24'));logger[_0xd43f('0x25')](_0xd43f('0x26'),_0x10f584,_0xd43f('0x24'),JSON[_0xd43f('0x27')](_0xda0dcc));if(_0xda0dcc['error']){if(_0xda0dcc[_0xd43f('0x28')]['code']===0x1f4){logger[_0xd43f('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x10f584,_0xda0dcc[_0xd43f('0x28')][_0xd43f('0x29')]);return _0x47a3d8(_0xda0dcc['error'][_0xd43f('0x29')]);}logger[_0xd43f('0x28')](_0xd43f('0x2a'),_0x10f584,_0xda0dcc['error'][_0xd43f('0x29')]);return _0x5d2f85(_0xda0dcc['error'][_0xd43f('0x29')]);}else{logger[_0xd43f('0x23')](_0xd43f('0x2a'),_0x10f584,_0xd43f('0x24'));_0x5d2f85(_0xda0dcc[_0xd43f('0x2b')][_0xd43f('0x29')]);}})['catch'](function(_0x3cf19f){logger[_0xd43f('0x28')](_0xd43f('0x2a'),_0x10f584,_0x3cf19f);_0x47a3d8(_0x3cf19f);});});}function respondWithStatusCode(_0x32df4f,_0x3381b6){_0x3381b6=_0x3381b6||0xcc;return function(_0x2f7769){if(_0x2f7769){return _0x32df4f[_0xd43f('0x2c')](_0x3381b6);}return _0x32df4f[_0xd43f('0x2d')](_0x3381b6)[_0xd43f('0x2e')]();};}function respondWithResult(_0x4255ea,_0x5bcdfd){_0x5bcdfd=_0x5bcdfd||0xc8;return function(_0x1a8ab7){if(_0x1a8ab7){return _0x4255ea[_0xd43f('0x2d')](_0x5bcdfd)[_0xd43f('0x2f')](_0x1a8ab7);}};}function respondWithFilteredResult(_0x1215cf,_0x82103b){return function(_0x30d1dc){if(_0x30d1dc){var _0x4efdb5=typeof _0x82103b[_0xd43f('0x30')]===_0xd43f('0x31')&&typeof _0x82103b[_0xd43f('0x32')]===_0xd43f('0x31');var _0xf469b2=_0x30d1dc[_0xd43f('0x33')];var _0xe680a3=_0x4efdb5?0x0:_0x82103b[_0xd43f('0x30')];var _0x19fd9b=_0x4efdb5?_0x30d1dc['count']:_0x82103b[_0xd43f('0x30')]+_0x82103b[_0xd43f('0x32')];var _0x53697e;if(_0x19fd9b>=_0xf469b2){_0x19fd9b=_0xf469b2;_0x53697e=0xc8;}else{_0x53697e=0xce;}_0x1215cf[_0xd43f('0x2d')](_0x53697e);return _0x1215cf['set'](_0xd43f('0x34'),_0xe680a3+'-'+_0x19fd9b+'/'+_0xf469b2)['json'](_0x30d1dc);}return null;};}function patchUpdates(_0x3e8149){return function(_0x58d4a2){try{jsonpatch[_0xd43f('0x35')](_0x58d4a2,_0x3e8149,!![]);}catch(_0x59d7e5){return BPromise[_0xd43f('0x36')](_0x59d7e5);}return _0x58d4a2[_0xd43f('0x37')]();};}function saveUpdates(_0x50144d,_0x100c6e){return function(_0x23cfa1){if(_0x23cfa1){return _0x23cfa1[_0xd43f('0x38')](_0x50144d)[_0xd43f('0x22')](function(_0x35193b){return _0x35193b;});}return null;};}function removeEntity(_0x15fe76,_0x4b15a9){return function(_0x40e57f){if(_0x40e57f){return _0x40e57f[_0xd43f('0x39')]()['then'](function(){var _0x12f22f=_0x40e57f[_0xd43f('0x3a')]({'plain':!![]});var _0x243a41=_0xd43f('0x3b');return db[_0xd43f('0x3c')]['destroy']({'where':{'type':_0x243a41,'resourceId':_0x12f22f['id']}})[_0xd43f('0x22')](function(){return _0x40e57f;});})['then'](function(){_0x15fe76[_0xd43f('0x2d')](0xcc)[_0xd43f('0x2e')]();});}};}function handleEntityNotFound(_0xe8093f,_0x1fa248){return function(_0x2d8359){if(!_0x2d8359){_0xe8093f[_0xd43f('0x2c')](0x194);}return _0x2d8359;};}function handleError(_0x4b6608,_0x147aa0){_0x147aa0=_0x147aa0||0x1f4;return function(_0x1ea54d){logger['error'](_0x1ea54d[_0xd43f('0x3d')]);if(_0x1ea54d[_0xd43f('0x3e')]){delete _0x1ea54d[_0xd43f('0x3e')];}_0x4b6608['status'](_0x147aa0)[_0xd43f('0x3f')](_0x1ea54d);};}exports['index']=function(_0x20b56d,_0x24e341){var _0x5f31ef={'include':[{'model':db[_0xd43f('0x40')],'as':_0xd43f('0x41')}]},_0x289c8e={},_0x579f4b={'count':0x0,'rows':[]};var _0x4b9404=_['map'](db['OpenchannelAccount']['rawAttributes'],function(_0x1d98a5){return{'name':_0x1d98a5[_0xd43f('0x42')],'type':_0x1d98a5[_0xd43f('0x43')][_0xd43f('0x44')]};});_0x289c8e[_0xd43f('0x45')]=_[_0xd43f('0x46')](_0x4b9404,_0xd43f('0x3e'));_0x289c8e[_0xd43f('0x47')]=_['keys'](_0x20b56d['query']);_0x289c8e[_0xd43f('0x48')]=_[_0xd43f('0x49')](_0x289c8e[_0xd43f('0x45')],_0x289c8e[_0xd43f('0x47')]);_0x5f31ef[_0xd43f('0x4a')]=_[_0xd43f('0x49')](_0x289c8e[_0xd43f('0x45')],qs[_0xd43f('0x4b')](_0x20b56d[_0xd43f('0x47')]['fields']));_0x5f31ef[_0xd43f('0x4a')]=_0x5f31ef[_0xd43f('0x4a')][_0xd43f('0x4c')]?_0x5f31ef[_0xd43f('0x4a')]:_0x289c8e[_0xd43f('0x45')];if(!_0x20b56d[_0xd43f('0x47')][_0xd43f('0x4d')](_0xd43f('0x4e'))){_0x5f31ef['limit']=qs[_0xd43f('0x32')](_0x20b56d['query'][_0xd43f('0x32')]);_0x5f31ef[_0xd43f('0x30')]=qs[_0xd43f('0x30')](_0x20b56d['query']['offset']);}_0x5f31ef[_0xd43f('0x4f')]=qs['sort'](_0x20b56d[_0xd43f('0x47')][_0xd43f('0x50')]);_0x5f31ef['where']=qs[_0xd43f('0x48')](_[_0xd43f('0x51')](_0x20b56d[_0xd43f('0x47')],_0x289c8e[_0xd43f('0x48')]),_0x4b9404);if(_0x20b56d[_0xd43f('0x47')]['filter']){_0x5f31ef[_0xd43f('0x52')]=_[_0xd43f('0x53')](_0x5f31ef[_0xd43f('0x52')],{'$or':_['map'](_0x4b9404,function(_0x43a47b){if(_0x43a47b[_0xd43f('0x43')]!=='VIRTUAL'){var _0x1e64a2={};_0x1e64a2[_0x43a47b[_0xd43f('0x3e')]]={'$like':'%'+_0x20b56d[_0xd43f('0x47')][_0xd43f('0x54')]+'%'};return _0x1e64a2;}})});}_0x5f31ef=_[_0xd43f('0x53')]({},_0x5f31ef,_0x20b56d['options']);var _0x4ae991={'where':_0x5f31ef[_0xd43f('0x52')]};return db[_0xd43f('0x55')]['count'](_0x4ae991)[_0xd43f('0x22')](function(_0x47074f){_0x579f4b[_0xd43f('0x33')]=_0x47074f;if(_0x20b56d[_0xd43f('0x47')][_0xd43f('0x56')]){_0x5f31ef[_0xd43f('0x57')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x5f31ef);})[_0xd43f('0x22')](function(_0x2625c6){_0x579f4b[_0xd43f('0x58')]=_0x2625c6;return _0x579f4b;})['then'](respondWithFilteredResult(_0x24e341,_0x5f31ef))[_0xd43f('0x59')](handleError(_0x24e341,null));};exports['show']=function(_0x24b830,_0x487fce){var _0x24a9ef={'raw':![],'where':{'id':_0x24b830[_0xd43f('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0xd43f('0x41')}]},_0x51833e={};_0x51833e[_0xd43f('0x45')]=_['keys'](db[_0xd43f('0x55')]['rawAttributes']);_0x51833e[_0xd43f('0x47')]=_[_0xd43f('0x5b')](_0x24b830[_0xd43f('0x47')]);_0x51833e['filters']=_[_0xd43f('0x49')](_0x51833e[_0xd43f('0x45')],_0x51833e[_0xd43f('0x47')]);_0x24a9ef[_0xd43f('0x4a')]=_[_0xd43f('0x49')](_0x51833e[_0xd43f('0x45')],qs[_0xd43f('0x4b')](_0x24b830[_0xd43f('0x47')][_0xd43f('0x4b')]));_0x24a9ef[_0xd43f('0x4a')]=_0x24a9ef['attributes']['length']?_0x24a9ef[_0xd43f('0x4a')]:_0x51833e['model'];if(_0x24b830[_0xd43f('0x47')][_0xd43f('0x56')]){_0x24a9ef['include']=[{'all':!![]}];}_0x24a9ef=_[_0xd43f('0x53')]({},_0x24a9ef,_0x24b830[_0xd43f('0x5c')]);return db[_0xd43f('0x55')][_0xd43f('0x5d')](_0x24a9ef)[_0xd43f('0x22')](handleEntityNotFound(_0x487fce,null))[_0xd43f('0x22')](respondWithResult(_0x487fce,null))[_0xd43f('0x59')](handleError(_0x487fce,null));};exports[_0xd43f('0x5e')]=function(_0x1dbf5a,_0x55c817){return db['OpenchannelAccount'][_0xd43f('0x5e')](_0x1dbf5a[_0xd43f('0x5f')],{})[_0xd43f('0x22')](function(_0x43d148){var _0x4b991d=_0x1dbf5a[_0xd43f('0x60')][_0xd43f('0x3a')]({'plain':!![]});if(!_0x4b991d)throw new Error(_0xd43f('0x61'));if(_0x4b991d['role']==='user'){var _0x3c87af=_0x43d148[_0xd43f('0x3a')]({'plain':!![]});var _0x584778=_0xd43f('0x3b');return db[_0xd43f('0x62')]['find']({'where':{'name':_0x584778,'userProfileId':_0x4b991d['userProfileId']},'raw':!![]})['then'](function(_0x33228c){if(_0x33228c&&_0x33228c[_0xd43f('0x63')]===0x0){return db[_0xd43f('0x3c')]['create']({'name':_0x3c87af[_0xd43f('0x3e')],'resourceId':_0x3c87af['id'],'type':_0x33228c[_0xd43f('0x3e')],'sectionId':_0x33228c['id']},{})[_0xd43f('0x22')](function(){return _0x43d148;});}else{return _0x43d148;}})[_0xd43f('0x59')](function(_0x24c982){logger['error'](_0xd43f('0x64'),_0x24c982);throw _0x24c982;});}return _0x43d148;})[_0xd43f('0x22')](respondWithResult(_0x55c817,0xc9))['catch'](handleError(_0x55c817,null));};exports[_0xd43f('0x38')]=function(_0x339742,_0x3cd0b0){if(_0x339742['body']['id']){delete _0x339742[_0xd43f('0x5f')]['id'];}return db['OpenchannelAccount'][_0xd43f('0x5d')]({'where':{'id':_0x339742['params']['id']},'include':[{'model':db[_0xd43f('0x40')],'as':'mandatoryDispositionPause'}]})[_0xd43f('0x22')](handleEntityNotFound(_0x3cd0b0,null))[_0xd43f('0x22')](saveUpdates(_0x339742['body'],null))[_0xd43f('0x22')](respondWithResult(_0x3cd0b0,null))[_0xd43f('0x59')](handleError(_0x3cd0b0,null));};exports['destroy']=function(_0x3726cb,_0xaa3ada){return db[_0xd43f('0x55')][_0xd43f('0x5d')]({'where':{'id':_0x3726cb['params']['id']}})['then'](handleEntityNotFound(_0xaa3ada,null))[_0xd43f('0x22')](removeEntity(_0xaa3ada,null))[_0xd43f('0x59')](handleError(_0xaa3ada,null));};exports[_0xd43f('0x65')]=function(_0x3d8b2a,_0x242437){return db[_0xd43f('0x55')][_0xd43f('0x65')]()[_0xd43f('0x22')](respondWithResult(_0x242437,null))['catch'](handleError(_0x242437,null));};exports['addDisposition']=function(_0x5e6a41,_0x4f420b,_0x1af015){if(_0x5e6a41[_0xd43f('0x5f')]['id']){delete _0x5e6a41['body']['id'];}return db[_0xd43f('0x55')]['find']({'where':{'id':_0x5e6a41[_0xd43f('0x5a')]['id']}})[_0xd43f('0x22')](handleEntityNotFound(_0x4f420b,null))['then'](function(_0x54289e){if(_0x54289e){_0x5e6a41[_0xd43f('0x5f')][_0xd43f('0x66')]=_0x54289e['id'];return db[_0xd43f('0x67')][_0xd43f('0x5e')](_0x5e6a41[_0xd43f('0x5f')]);}})[_0xd43f('0x22')](respondWithResult(_0x4f420b,null))[_0xd43f('0x59')](handleError(_0x4f420b,null));};exports[_0xd43f('0x68')]=function(_0xcbbe08,_0x4170fd,_0x4f9f2d){var _0x42ba5d={'raw':![],'where':{}};var _0xf2889={};var _0x1f229b={'count':0x0,'rows':[]};return db[_0xd43f('0x55')]['findOne']({'where':{'id':_0xcbbe08['params']['id']}})[_0xd43f('0x22')](handleEntityNotFound(_0x4170fd,null))['then'](function(_0x172a48){if(_0x172a48){_0xf2889[_0xd43f('0x45')]=_[_0xd43f('0x5b')](db[_0xd43f('0x67')][_0xd43f('0x69')]);_0xf2889[_0xd43f('0x47')]=_['keys'](_0xcbbe08[_0xd43f('0x47')]);_0xf2889[_0xd43f('0x48')]=_[_0xd43f('0x49')](_0xf2889[_0xd43f('0x45')],_0xf2889[_0xd43f('0x47')]);_0x42ba5d[_0xd43f('0x4a')]=_[_0xd43f('0x49')](_0xf2889['model'],qs['fields'](_0xcbbe08[_0xd43f('0x47')][_0xd43f('0x4b')]));_0x42ba5d[_0xd43f('0x4a')]=_0x42ba5d[_0xd43f('0x4a')]['length']?_0x42ba5d['attributes']:_0xf2889[_0xd43f('0x45')];if(!_0xcbbe08['query']['hasOwnProperty'](_0xd43f('0x4e'))){_0x42ba5d[_0xd43f('0x32')]=qs[_0xd43f('0x32')](_0xcbbe08[_0xd43f('0x47')][_0xd43f('0x32')]);_0x42ba5d['offset']=qs[_0xd43f('0x30')](_0xcbbe08[_0xd43f('0x47')][_0xd43f('0x30')]);}_0x42ba5d[_0xd43f('0x4f')]=qs[_0xd43f('0x50')](_0xcbbe08['query']['sort']);_0x42ba5d[_0xd43f('0x52')]=qs[_0xd43f('0x48')](_['pick'](_0xcbbe08[_0xd43f('0x47')],_0xf2889['filters']));_0x42ba5d['where']['OpenchannelAccountId']=_0x172a48['id'];if(_0xcbbe08[_0xd43f('0x47')][_0xd43f('0x54')]){_0x42ba5d[_0xd43f('0x52')]=_['merge'](_0x42ba5d[_0xd43f('0x52')],{'$or':_[_0xd43f('0x46')](_0x42ba5d['attributes'],function(_0x409f28){var _0xf29ceb={};_0xf29ceb[_0x409f28]={'$like':'%'+_0xcbbe08[_0xd43f('0x47')][_0xd43f('0x54')]+'%'};return _0xf29ceb;})});}_0x42ba5d=_[_0xd43f('0x53')]({},_0x42ba5d,_0xcbbe08[_0xd43f('0x5c')]);return db['Disposition'][_0xd43f('0x33')]({'where':_0x42ba5d[_0xd43f('0x52')]})['then'](function(_0x157446){_0x1f229b['count']=_0x157446;if(_0xcbbe08[_0xd43f('0x47')]['includeAll']){_0x42ba5d[_0xd43f('0x57')]=[{'all':!![]}];}return db[_0xd43f('0x67')][_0xd43f('0x6a')](_0x42ba5d);})['then'](function(_0x4f70bc){_0x1f229b['rows']=_0x4f70bc;return _0x1f229b;});}})['then'](respondWithFilteredResult(_0x4170fd,_0x42ba5d))[_0xd43f('0x59')](handleError(_0x4170fd,null));};exports[_0xd43f('0x6b')]=function(_0x1485d8,_0x1a8d48,_0x1bb8c2){return db[_0xd43f('0x55')][_0xd43f('0x5d')]({'where':{'id':_0x1485d8[_0xd43f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1a8d48,null))['then'](function(_0x229adf){if(_0x229adf){return _0x229adf[_0xd43f('0x6b')](_0x1485d8[_0xd43f('0x47')][_0xd43f('0x6c')]);}})['then'](respondWithStatusCode(_0x1a8d48,null))[_0xd43f('0x59')](handleError(_0x1a8d48,null));};exports[_0xd43f('0x6d')]=function(_0x4cc1de,_0x5e820b,_0x51b758){if(_0x4cc1de[_0xd43f('0x5f')]['id']){delete _0x4cc1de['body']['id'];}return db[_0xd43f('0x55')][_0xd43f('0x5d')]({'where':{'id':_0x4cc1de['params']['id']}})[_0xd43f('0x22')](handleEntityNotFound(_0x5e820b,null))['then'](function(_0x1f816b){if(_0x1f816b){_0x4cc1de['body']['OpenchannelAccountId']=_0x1f816b['id'];return db[_0xd43f('0x6e')][_0xd43f('0x5e')](_0x4cc1de['body']);}})[_0xd43f('0x22')](respondWithResult(_0x5e820b,null))[_0xd43f('0x59')](handleError(_0x5e820b,null));};exports[_0xd43f('0x6f')]=function(_0x2b243c,_0x3215c4,_0x29be25){var _0x380048={'raw':![],'where':{}};var _0x3ce6af={};var _0x5c0bcc={'count':0x0,'rows':[]};return db[_0xd43f('0x55')][_0xd43f('0x70')]({'where':{'id':_0x2b243c[_0xd43f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3215c4,null))[_0xd43f('0x22')](function(_0x41ba9d){if(_0x41ba9d){_0x3ce6af['model']=_[_0xd43f('0x5b')](db[_0xd43f('0x6e')][_0xd43f('0x69')]);_0x3ce6af[_0xd43f('0x47')]=_[_0xd43f('0x5b')](_0x2b243c[_0xd43f('0x47')]);_0x3ce6af[_0xd43f('0x48')]=_[_0xd43f('0x49')](_0x3ce6af[_0xd43f('0x45')],_0x3ce6af['query']);_0x380048[_0xd43f('0x4a')]=_[_0xd43f('0x49')](_0x3ce6af['model'],qs[_0xd43f('0x4b')](_0x2b243c['query']['fields']));_0x380048[_0xd43f('0x4a')]=_0x380048['attributes'][_0xd43f('0x4c')]?_0x380048[_0xd43f('0x4a')]:_0x3ce6af[_0xd43f('0x45')];if(!_0x2b243c[_0xd43f('0x47')][_0xd43f('0x4d')](_0xd43f('0x4e'))){_0x380048[_0xd43f('0x32')]=qs[_0xd43f('0x32')](_0x2b243c[_0xd43f('0x47')]['limit']);_0x380048[_0xd43f('0x30')]=qs['offset'](_0x2b243c['query'][_0xd43f('0x30')]);}_0x380048[_0xd43f('0x4f')]=qs[_0xd43f('0x50')](_0x2b243c[_0xd43f('0x47')][_0xd43f('0x50')]);_0x380048[_0xd43f('0x52')]=qs[_0xd43f('0x48')](_['pick'](_0x2b243c['query'],_0x3ce6af[_0xd43f('0x48')]));_0x380048[_0xd43f('0x52')][_0xd43f('0x66')]=_0x41ba9d['id'];if(_0x2b243c[_0xd43f('0x47')]['filter']){_0x380048['where']=_[_0xd43f('0x53')](_0x380048['where'],{'$or':_[_0xd43f('0x46')](_0x380048[_0xd43f('0x4a')],function(_0x4dc346){var _0x3a1e6b={};_0x3a1e6b[_0x4dc346]={'$like':'%'+_0x2b243c['query'][_0xd43f('0x54')]+'%'};return _0x3a1e6b;})});}_0x380048=_[_0xd43f('0x53')]({},_0x380048,_0x2b243c[_0xd43f('0x5c')]);return db[_0xd43f('0x6e')]['count']({'where':_0x380048['where']})[_0xd43f('0x22')](function(_0x356b12){_0x5c0bcc[_0xd43f('0x33')]=_0x356b12;if(_0x2b243c[_0xd43f('0x47')]['includeAll']){_0x380048[_0xd43f('0x57')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x380048);})['then'](function(_0x1e3bcd){_0x5c0bcc['rows']=_0x1e3bcd;return _0x5c0bcc;});}})['then'](respondWithFilteredResult(_0x3215c4,_0x380048))[_0xd43f('0x59')](handleError(_0x3215c4,null));};exports['removeAnswers']=function(_0x1fc7c5,_0x4a3479,_0x26158a){return db[_0xd43f('0x55')]['find']({'where':{'id':_0x1fc7c5[_0xd43f('0x5a')]['id']}})[_0xd43f('0x22')](handleEntityNotFound(_0x4a3479,null))[_0xd43f('0x22')](function(_0x56a3ab){if(_0x56a3ab){return _0x56a3ab[_0xd43f('0x71')](_0x1fc7c5[_0xd43f('0x47')][_0xd43f('0x6c')]);}})[_0xd43f('0x22')](respondWithStatusCode(_0x4a3479,null))['catch'](handleError(_0x4a3479,null));};exports[_0xd43f('0x72')]=function(_0x1611a2,_0x54f030,_0x4c1e60){var _0x3af9b3={'body':_0x1611a2[_0xd43f('0x5f')],'channel':_0xd43f('0x73')};var _0x5734d2=[];var _0xdc364d=[];var _0x5ac496={};var _0x396eff=![];return db[_0xd43f('0x74')]['describe']()['then'](function(_0x1d7738){if(!_0x1d7738){throw new db[(_0xd43f('0x75'))][(_0xd43f('0x76'))]('no\x20available\x20attributes');}_0x5734d2=_['difference'](_['keys'](_0x1d7738),['createdAt',_0xd43f('0x77')]);_0xdc364d=_['difference'](_[_0xd43f('0x5b')](_0x1d7738),['createdAt','updatedAt',_0xd43f('0x78'),_0xd43f('0x79')]);if(_0x1611a2[_0xd43f('0x5f')]['id']){delete _0x1611a2['body']['id'];}if(_[_0xd43f('0x7a')](_0x1611a2[_0xd43f('0x5f')]['from'])){throw new db[(_0xd43f('0x75'))][(_0xd43f('0x76'))]('from\x20is\x20mandatory');}if(_[_0xd43f('0x7a')](_0x1611a2[_0xd43f('0x5f')][_0xd43f('0x5f')])||_0x1611a2[_0xd43f('0x5f')]['body']===''){throw new db['Sequelize'][(_0xd43f('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd43f('0x7a')](_0x1611a2['body'][_0xd43f('0x7b')])){throw new db[(_0xd43f('0x75'))][(_0xd43f('0x76'))](_0xd43f('0x7c')+_0xdc364d);}if(!_[_0xd43f('0x7d')](_0xdc364d,_0x1611a2[_0xd43f('0x5f')][_0xd43f('0x7b')])){throw new db[(_0xd43f('0x75'))][(_0xd43f('0x76'))](_0xd43f('0x7e')+_0xdc364d);}_0x5ac496[_0x1611a2[_0xd43f('0x5f')]['mapKey']]=_0x1611a2['body'][_0xd43f('0x7f')];})[_0xd43f('0x22')](function(){return db['OpenchannelAccount'][_0xd43f('0x5d')]({'where':{'id':_0x1611a2['params']['id']},'include':[{'model':db['CmList'],'as':_0xd43f('0x80'),'include':[{'model':db['CmContact'],'as':_0xd43f('0x81'),'where':_0x5ac496,'limit':0x1,'order':[[_0xd43f('0x77'),_0xd43f('0x82')]]}]},{'model':db[_0xd43f('0x83')],'as':_0xd43f('0x84')}]});})[_0xd43f('0x22')](handleEntityNotFound(_0x54f030,null))[_0xd43f('0x22')](function(_0x4ffa10){if(_0x4ffa10&&_0x4ffa10[_0xd43f('0x80')]){_0x3af9b3['account']=_0x4ffa10;_0x3af9b3[_0xd43f('0x85')]=_0x4ffa10[_0xd43f('0x84')];_0x3af9b3[_0xd43f('0x86')]=_0x4ffa10['List'];_0x3af9b3['applications']=_[_0xd43f('0x87')](_0x3af9b3['applications'],[_0xd43f('0x88')],[_0xd43f('0x89')]);if(_0x3af9b3['account'][_0xd43f('0x84')]){delete _0x3af9b3[_0xd43f('0x8a')][_0xd43f('0x84')];}if(_0x3af9b3[_0xd43f('0x8a')][_0xd43f('0x80')]&&_0x3af9b3['account']['List']['Contacts'][_0xd43f('0x4c')]){return _0x3af9b3[_0xd43f('0x8a')][_0xd43f('0x80')][_0xd43f('0x81')][0x0];}var _0x424ef9=_['defaults'](_0x1611a2[_0xd43f('0x5f')],{'firstName':_0x1611a2[_0xd43f('0x5f')]['from'],'ListId':_0x4ffa10['ListId']});_0x424ef9[_0x1611a2['body']['mapKey']]=_0x1611a2[_0xd43f('0x5f')][_0xd43f('0x7f')];return db[_0xd43f('0x74')][_0xd43f('0x5e')](_0x424ef9,{'fields':_0x5734d2,'raw':!![]});}})['then'](handleEntityNotFound(_0x54f030,null))[_0xd43f('0x22')](function(_0x35383d){_0x3af9b3[_0xd43f('0x8b')]=_0x35383d;if(_0x35383d){var _0x53f713={'ContactId':_0x35383d['id'],'OpenchannelAccountId':_0x1611a2[_0xd43f('0x5a')]['id'],'from':(_0x35383d[_0xd43f('0x8c')]||'')+'\x20'+(_0x35383d['lastName']||'')};var _0x43db3a={'OpenchannelAccountId':_0x1611a2[_0xd43f('0x5a')]['id'],'closed':![]};if(_0x1611a2[_0xd43f('0x5f')][_0xd43f('0x8d')]){_0x43db3a[_0xd43f('0x8d')]=_0x1611a2[_0xd43f('0x5f')][_0xd43f('0x8d')];return db[_0xd43f('0x8e')][_0xd43f('0x5d')]({'where':_0x43db3a})[_0xd43f('0x22')](function(_0x3abb99){if(_0x3abb99){return[_0x3abb99,![]];}_0x53f713[_0xd43f('0x8d')]=_0x1611a2[_0xd43f('0x5f')]['threadId'];_0x53f713[_0xd43f('0x8f')]=_0x1611a2[_0xd43f('0x5f')][_0xd43f('0x8f')];return db[_0xd43f('0x8e')][_0xd43f('0x5e')](_0x53f713)[_0xd43f('0x22')](function(_0x58fb96){return[_0x58fb96,!![]];});});}else{_0x43db3a[_0xd43f('0x8d')]=null;}_0x43db3a[_0xd43f('0x90')]=_0x35383d['id'];return db[_0xd43f('0x8e')][_0xd43f('0x5d')]({'where':_0x43db3a})[_0xd43f('0x22')](function(_0x1349fc){if(_0x1349fc){return[_0x1349fc,![]];}return db[_0xd43f('0x8e')]['create'](_0x53f713)['then'](function(_0x5be86e){return[_0x5be86e,!![]];});});}})[_0xd43f('0x91')](function(_0x4fc650,_0x329856){if(_0x4fc650){_0x396eff=_0x329856;if(!_0x329856){var _0x1dc6c3={'from':(_0x3af9b3[_0xd43f('0x8b')][_0xd43f('0x8c')]||'')+'\x20'+(_0x3af9b3[_0xd43f('0x8b')]['lastName']||'')};if(_0x1611a2['body']['threadId']&&_0x1611a2[_0xd43f('0x5f')][_0xd43f('0x92')]&&_0x1611a2[_0xd43f('0x5f')][_0xd43f('0x8d')]!=_0x1611a2['body'][_0xd43f('0x92')]){_0x1dc6c3[_0xd43f('0x8d')]=_0x1611a2[_0xd43f('0x5f')][_0xd43f('0x92')];}return _0x4fc650['update'](_0x1dc6c3);}else{return _0x4fc650;}}})[_0xd43f('0x22')](function(_0x36baa3){_0x3af9b3['interaction']=_0x36baa3['get']({'plain':!![]});_0x3af9b3['interaction']['created']=_0x396eff;if(_0x3af9b3[_0xd43f('0x93')][_0xd43f('0x94')]){if(_0x3af9b3['account'][_0xd43f('0x95')]){_0x3af9b3['applications'][_0xd43f('0x96')]({'id':0x0,'priority':_0x3af9b3['applications'][_0xd43f('0x4c')]+0x1,'app':_0xd43f('0x97'),'appdata':_0xd43f('0x98'),'interval':'*,*,*,*'});}}return db[_0xd43f('0x99')]['create']({'body':_0x1611a2[_0xd43f('0x5f')][_0xd43f('0x5f')],'OpenchannelAccountId':_0x1611a2[_0xd43f('0x5a')]['id'],'OpenchannelInteractionId':_0x36baa3['id'],'direction':'in','ContactId':_0x3af9b3['contact']['id'],'AttachmentId':_0x1611a2[_0xd43f('0x5f')]['AttachmentId']});})['then'](function(_0x740b74){_0x3af9b3[_0xd43f('0x29')]=_0x740b74;if(_0x3af9b3[_0xd43f('0x93')][_0xd43f('0x9a')]){return db[_0xd43f('0x9b')][_0xd43f('0x5d')]({'attributes':['id','name'],'where':{'id':_0x3af9b3[_0xd43f('0x93')][_0xd43f('0x9a')]}})['then'](function(_0x4eec18){if(_0x4eec18){_0x3af9b3[_0xd43f('0x85')]['unshift']({'id':0x0,'priority':0x0,'app':_0xd43f('0x9c'),'appdata':_0x4eec18[_0xd43f('0x3e')]+','+(_0x3af9b3[_0xd43f('0x8a')]['waitForTheAssignedAgent']||0xa),'interval':_0xd43f('0x9d')});_0x3af9b3[_0xd43f('0x9e')]=![];}return respondWithRpcPromise(_0xd43f('0x9f'),'startRouting',_0x3af9b3);});}return respondWithRpcPromise(_0xd43f('0x9f'),_0xd43f('0xa0'),_0x3af9b3);})[_0xd43f('0x22')](function(_0x2f1e80){respondWithRpcPromise(_0xd43f('0xa1'),_0xd43f('0xa1'),{'event':_0xd43f('0x72'),'message':_0x2f1e80},client9002);return _0x2f1e80;})[_0xd43f('0x22')](respondWithResult(_0x54f030,null))['catch'](handleError(_0x54f030,null));};exports[_0xd43f('0xa2')]=function(_0x3aad23,_0x3ea404,_0x50eacc){return db['OpenchannelAccount'][_0xd43f('0x70')]({'where':{'id':_0x3aad23[_0xd43f('0x5a')]['id']}})[_0xd43f('0x22')](handleEntityNotFound(_0x3ea404,null))[_0xd43f('0x22')](function(_0x25d862){if(_0x25d862){return db['sequelize'][_0xd43f('0xa3')](function(_0x2a2572){return db['OpenchannelApplication'][_0xd43f('0x39')]({'where':{'OpenchannelAccountId':_0x3aad23[_0xd43f('0x5a')]['id']},'transaction':_0x2a2572})['then'](function(_0x49d778){var _0x145489=_[_0xd43f('0x46')](_0x3aad23[_0xd43f('0x5f')],function(_0x5afd1c){_0x5afd1c['OpenchannelAccountId']=_0x3aad23['params']['id'];return _0x5afd1c;});return db[_0xd43f('0x83')]['bulkCreate'](_0x145489,{'transaction':_0x2a2572});});})[_0xd43f('0x22')](function(){return db[_0xd43f('0x83')][_0xd43f('0xa4')]({'where':{'OpenchannelAccountId':_0x3aad23['params']['id']},'order':_0xd43f('0x88')});});}})[_0xd43f('0x22')](respondWithResult(_0x3ea404,null))[_0xd43f('0x59')](handleError(_0x3ea404,null));};exports[_0xd43f('0xa5')]=function(_0x5c4b86,_0x434c0e,_0xf9bbb8){var _0x1b6bad={};var _0x4d4155={};var _0x30c9e6;var _0x240c6a;return db[_0xd43f('0x55')]['findOne']({'where':{'id':_0x5c4b86[_0xd43f('0x5a')]['id']}})[_0xd43f('0x22')](handleEntityNotFound(_0x434c0e,null))[_0xd43f('0x22')](function(_0x477abc){if(_0x477abc){_0x30c9e6=_0x477abc;_0x4d4155[_0xd43f('0x45')]=_[_0xd43f('0x5b')](db['OpenchannelApplication']['rawAttributes']);_0x4d4155[_0xd43f('0x47')]=_['keys'](_0x5c4b86[_0xd43f('0x47')]);_0x4d4155[_0xd43f('0x48')]=_[_0xd43f('0x49')](_0x4d4155[_0xd43f('0x45')],_0x4d4155[_0xd43f('0x47')]);_0x1b6bad[_0xd43f('0x4a')]=_[_0xd43f('0x49')](_0x4d4155[_0xd43f('0x45')],qs['fields'](_0x5c4b86[_0xd43f('0x47')]['fields']));_0x1b6bad[_0xd43f('0x4a')]=_0x1b6bad[_0xd43f('0x4a')]['length']?_0x1b6bad['attributes']:_0x4d4155[_0xd43f('0x45')];_0x1b6bad[_0xd43f('0x4f')]=qs[_0xd43f('0x50')](_0x5c4b86[_0xd43f('0x47')]['sort']);_0x1b6bad['where']=qs[_0xd43f('0x48')](_[_0xd43f('0x51')](_0x5c4b86[_0xd43f('0x47')],_0x4d4155[_0xd43f('0x48')]));if(_0x5c4b86[_0xd43f('0x47')][_0xd43f('0x54')]){_0x1b6bad[_0xd43f('0x52')]=_[_0xd43f('0x53')](_0x1b6bad[_0xd43f('0x52')],{'$or':_['map'](_0x1b6bad[_0xd43f('0x4a')],function(_0x475cf8){var _0x571e57={};_0x571e57[_0x475cf8]={'$like':'%'+_0x5c4b86[_0xd43f('0x47')][_0xd43f('0x54')]+'%'};return _0x571e57;})});}_0x1b6bad=_['merge']({},_0x1b6bad,_0x5c4b86[_0xd43f('0x5c')]);return _0x30c9e6[_0xd43f('0xa5')](_0x1b6bad);}})[_0xd43f('0x22')](function(_0x1301b1){if(_0x1301b1){_0x240c6a=_0x1301b1[_0xd43f('0x4c')];if(!_0x5c4b86['query'][_0xd43f('0x4d')](_0xd43f('0x4e'))){_0x1b6bad[_0xd43f('0x32')]=qs[_0xd43f('0x32')](_0x5c4b86['query'][_0xd43f('0x32')]);_0x1b6bad[_0xd43f('0x30')]=qs[_0xd43f('0x30')](_0x5c4b86[_0xd43f('0x47')]['offset']);}return _0x30c9e6[_0xd43f('0xa5')](_0x1b6bad);}})[_0xd43f('0x22')](function(_0xebef08){if(_0xebef08){return _0xebef08?{'count':_0x240c6a,'rows':_0xebef08}:null;}})['then'](respondWithResult(_0x434c0e,null))[_0xd43f('0x59')](handleError(_0x434c0e,null));};exports[_0xd43f('0xa6')]=function(_0x457b53,_0x29e07f,_0x11e29e){var _0x177d41={'raw':![],'where':{}};var _0x3047c9={};var _0x320258={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xd43f('0x70')]({'where':{'id':_0x457b53[_0xd43f('0x5a')]['id']}})[_0xd43f('0x22')](handleEntityNotFound(_0x29e07f,null))[_0xd43f('0x22')](function(_0x309278){if(_0x309278){_0x3047c9[_0xd43f('0x45')]=_[_0xd43f('0x5b')](db[_0xd43f('0x8e')]['rawAttributes']);_0x3047c9['query']=_[_0xd43f('0x5b')](_0x457b53[_0xd43f('0x47')]);_0x3047c9[_0xd43f('0x48')]=_[_0xd43f('0x49')](_0x3047c9[_0xd43f('0x45')],_0x3047c9[_0xd43f('0x47')]);_0x177d41[_0xd43f('0x4a')]=_[_0xd43f('0x49')](_0x3047c9[_0xd43f('0x45')],qs[_0xd43f('0x4b')](_0x457b53[_0xd43f('0x47')][_0xd43f('0x4b')]));_0x177d41[_0xd43f('0x4a')]=_0x177d41[_0xd43f('0x4a')]['length']?_0x177d41['attributes']:_0x3047c9[_0xd43f('0x45')];if(!_0x457b53['query'][_0xd43f('0x4d')](_0xd43f('0x4e'))){_0x177d41['limit']=qs[_0xd43f('0x32')](_0x457b53[_0xd43f('0x47')]['limit']);_0x177d41['offset']=qs['offset'](_0x457b53['query']['offset']);}_0x177d41['order']=qs['sort'](_0x457b53['query'][_0xd43f('0x50')]);_0x177d41[_0xd43f('0x52')]=qs['filters'](_[_0xd43f('0x51')](_0x457b53[_0xd43f('0x47')],_0x3047c9[_0xd43f('0x48')]));_0x177d41[_0xd43f('0x52')][_0xd43f('0x66')]=_0x309278['id'];if(_0x457b53[_0xd43f('0x47')]['filter']){_0x177d41[_0xd43f('0x52')]=_[_0xd43f('0x53')](_0x177d41[_0xd43f('0x52')],{'$or':_[_0xd43f('0x46')](_0x177d41['attributes'],function(_0x15aece){var _0x5d17f9={};_0x5d17f9[_0x15aece]={'$like':'%'+_0x457b53[_0xd43f('0x47')]['filter']+'%'};return _0x5d17f9;})});}_0x177d41=_[_0xd43f('0x53')]({},_0x177d41,_0x457b53[_0xd43f('0x5c')]);return db[_0xd43f('0x8e')][_0xd43f('0x33')]({'where':_0x177d41['where']})[_0xd43f('0x22')](function(_0x5ca142){_0x320258['count']=_0x5ca142;if(_0x457b53[_0xd43f('0x47')][_0xd43f('0x56')]){_0x177d41[_0xd43f('0x57')]=[{'model':db[_0xd43f('0x74')],'as':_0xd43f('0xa7'),'required':![]},{'model':db[_0xd43f('0x9b')],'as':_0xd43f('0xa8'),'attributes':[_0xd43f('0x3e'),'fullname',_0xd43f('0xa9')],'required':![]},{'model':db[_0xd43f('0xaa')],'as':_0xd43f('0xab'),'attributes':['id','name',_0xd43f('0xac')],'where':_0x457b53[_0xd43f('0x47')][_0xd43f('0xad')]?{'id':_0x457b53[_0xd43f('0x47')][_0xd43f('0xad')]}:undefined,'required':_0x457b53[_0xd43f('0x47')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xd43f('0x6a')](_0x177d41);})[_0xd43f('0x22')](function(_0x290a1d){_0x320258[_0xd43f('0x58')]=_0x290a1d;return _0x320258;});}})[_0xd43f('0x22')](respondWithFilteredResult(_0x29e07f,_0x177d41))[_0xd43f('0x59')](handleError(_0x29e07f,null));};exports[_0xd43f('0xae')]=function(_0x232721,_0x155e09,_0x221233){return db['OpenchannelAccount'][_0xd43f('0x5d')]({'where':{'id':_0x232721['params']['id']}})['then'](handleEntityNotFound(_0x155e09,null))[_0xd43f('0x22')](function(_0x1dabc3){if(_0x1dabc3){return _0x1dabc3[_0xd43f('0xae')](_0x232721['body']['ids'],_[_0xd43f('0xaf')](_0x232721[_0xd43f('0x5f')],[_0xd43f('0x6c'),'id'])||{})[_0xd43f('0x91')](function(_0x138a44){for(var _0xc659f4=0x0;_0xc659f4<_0x232721[_0xd43f('0x5f')][_0xd43f('0x6c')][_0xd43f('0x4c')];_0xc659f4+=0x1){socket[_0xd43f('0xb0')](_0xd43f('0xb1'),{'UserId':_0x232721[_0xd43f('0x5f')]['ids'][_0xc659f4],'OpenchannelAccountId':_0x232721[_0xd43f('0x5a')]['id']});}return _0x138a44;});}})[_0xd43f('0x22')](respondWithResult(_0x155e09,null))[_0xd43f('0x59')](handleError(_0x155e09,null));};exports[_0xd43f('0xb2')]=function(_0x229e4d,_0x20da71,_0x5ef8b4){return db[_0xd43f('0x55')]['find']({'where':{'id':_0x229e4d[_0xd43f('0x5a')]['id']}})[_0xd43f('0x22')](handleEntityNotFound(_0x20da71,null))['then'](function(_0x53d577){if(_0x53d577){return _0x53d577['removeAgents'](_0x229e4d[_0xd43f('0x47')]['ids'])[_0xd43f('0x22')](function(){if(_[_0xd43f('0xb3')](_0x229e4d[_0xd43f('0x47')][_0xd43f('0x6c')])){for(var _0x45281c=0x0;_0x45281c<_0x229e4d['query'][_0xd43f('0x6c')][_0xd43f('0x4c')];_0x45281c+=0x1){socket[_0xd43f('0xb0')](_0xd43f('0xb4'),{'UserId':Number(_0x229e4d['query']['ids'][_0x45281c]),'OpenchannelAccountId':Number(_0x229e4d['params']['id'])});}}else{socket[_0xd43f('0xb0')](_0xd43f('0xb4'),{'UserId':Number(_0x229e4d[_0xd43f('0x47')][_0xd43f('0x6c')]),'OpenchannelAccountId':Number(_0x229e4d['params']['id'])});}});}})[_0xd43f('0x22')](respondWithStatusCode(_0x20da71,null))[_0xd43f('0x59')](handleError(_0x20da71,null));};exports[_0xd43f('0xb5')]=function(_0x229bf1,_0x1551f9,_0x367650){var _0x438f45={};var _0x5b26de={};var _0x522524;var _0x742bc0;return db[_0xd43f('0x55')]['findOne']({'where':{'id':_0x229bf1[_0xd43f('0x5a')]['id']}})[_0xd43f('0x22')](handleEntityNotFound(_0x1551f9,null))[_0xd43f('0x22')](function(_0x4532af){if(_0x4532af){_0x522524=_0x4532af;_0x5b26de[_0xd43f('0x45')]=_[_0xd43f('0x5b')](db[_0xd43f('0x9b')][_0xd43f('0x69')]);_0x5b26de['query']=_[_0xd43f('0x5b')](_0x229bf1[_0xd43f('0x47')]);_0x5b26de[_0xd43f('0x48')]=_['intersection'](_0x5b26de['model'],_0x5b26de[_0xd43f('0x47')]);_0x438f45[_0xd43f('0x4a')]=_[_0xd43f('0x49')](_0x5b26de['model'],qs[_0xd43f('0x4b')](_0x229bf1[_0xd43f('0x47')][_0xd43f('0x4b')]));_0x438f45['attributes']=_0x438f45[_0xd43f('0x4a')]['length']?_0x438f45[_0xd43f('0x4a')]:_0x5b26de[_0xd43f('0x45')];_0x438f45['order']=qs[_0xd43f('0x50')](_0x229bf1['query'][_0xd43f('0x50')]);_0x438f45[_0xd43f('0x52')]=qs[_0xd43f('0x48')](_['pick'](_0x229bf1[_0xd43f('0x47')],_0x5b26de[_0xd43f('0x48')]));if(_0x229bf1[_0xd43f('0x47')][_0xd43f('0x54')]){_0x438f45[_0xd43f('0x52')]=_['merge'](_0x438f45[_0xd43f('0x52')],{'$or':_[_0xd43f('0x46')](_0x438f45['attributes'],function(_0x58ce34){var _0x1a5c0a={};_0x1a5c0a[_0x58ce34]={'$like':'%'+_0x229bf1[_0xd43f('0x47')][_0xd43f('0x54')]+'%'};return _0x1a5c0a;})});}_0x438f45=_[_0xd43f('0x53')]({},_0x438f45,_0x229bf1['options']);return _0x522524[_0xd43f('0xb5')](_0x438f45);}})[_0xd43f('0x22')](function(_0x4399d9){if(_0x4399d9){_0x742bc0=_0x4399d9[_0xd43f('0x4c')];if(!_0x229bf1[_0xd43f('0x47')]['hasOwnProperty'](_0xd43f('0x4e'))){_0x438f45[_0xd43f('0x32')]=qs[_0xd43f('0x32')](_0x229bf1[_0xd43f('0x47')][_0xd43f('0x32')]);_0x438f45[_0xd43f('0x30')]=qs[_0xd43f('0x30')](_0x229bf1[_0xd43f('0x47')]['offset']);}return _0x522524[_0xd43f('0xb5')](_0x438f45);}})[_0xd43f('0x22')](function(_0x27ecd6){if(_0x27ecd6){return _0x27ecd6?{'count':_0x742bc0,'rows':_0x27ecd6}:null;}})['then'](respondWithResult(_0x1551f9,null))['catch'](handleError(_0x1551f9,null));};exports[_0xd43f('0x3f')]=function(_0x2406ad,_0x1d95e6,_0x2a41c7){var _0x4e8855,_0x2732c7,_0x4a8174;if(_[_0xd43f('0x7a')](_0x2406ad[_0xd43f('0x5f')][_0xd43f('0x5f')])||_0x2406ad[_0xd43f('0x5f')]['body']===''){throw new db[(_0xd43f('0x75'))][(_0xd43f('0x76'))](_0xd43f('0xb6'));}if(_[_0xd43f('0x7a')](_0x2406ad['body']['to'])){}_0x4e8855=_0x2406ad[_0xd43f('0x5f')]['to'];return db['OpenchannelAccount'][_0xd43f('0x70')]({'where':{'id':_0x2406ad['params']['id']}})[_0xd43f('0x22')](handleEntityNotFound(_0x1d95e6,null))[_0xd43f('0x22')](function(_0x2730fa){if(_0x2730fa){return db[_0xd43f('0x55')][_0xd43f('0x5d')]({'where':{'id':_0x2730fa['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xd43f('0x74')],'as':_0xd43f('0x81'),'where':{[_0x2730fa[_0xd43f('0x7b')]]:_0x4e8855},'limit':0x1,'order':[['updatedAt',_0xd43f('0x82')]]}]}]})['then'](handleEntityNotFound(_0x1d95e6,null))['then'](function(_0x3eebb7){if(_0x3eebb7&&_0x3eebb7['List']){_0x2732c7=_0x3eebb7[_0xd43f('0x3a')]({'plain':!![]});if(_0x2732c7[_0xd43f('0x80')]&&_0x2732c7[_0xd43f('0x80')][_0xd43f('0x81')][_0xd43f('0x4c')]){return _0x2732c7[_0xd43f('0x80')][_0xd43f('0x81')][0x0];}return db[_0xd43f('0x74')][_0xd43f('0x5e')](_[_0xd43f('0x1b')](_0x2406ad['body'],{'firstName':_0x4e8855,[_0x3eebb7[_0xd43f('0x7b')]]:_0x4e8855,'phone':_0x4e8855,'ListId':_0x2732c7['ListId']}));}})[_0xd43f('0x22')](handleEntityNotFound(_0x1d95e6,null))[_0xd43f('0x22')](function(_0x31a78e){if(_0x31a78e){_0x4a8174=_0x31a78e;return db[_0xd43f('0x8e')]['find']({'where':{'ContactId':_0x4a8174['id'],'closed':![],'OpenchannelAccountId':_0x2732c7['id']}})[_0xd43f('0x22')](function(_0x5bcfb1){if(_0x5bcfb1){return[_0x5bcfb1,![]];}return db[_0xd43f('0x8e')][_0xd43f('0x5e')]({'UserId':_0x2406ad[_0xd43f('0x60')]['id'],'ContactId':_0x4a8174['id'],'OpenchannelAccountId':_0x2732c7['id'],'lastMsgDirection':'out','Messages':[_[_0xd43f('0x53')](_0x2406ad['body'],{'read':![],'body':_0x2406ad[_0xd43f('0x5f')][_0xd43f('0x5f')],'OpenchannelAccountId':_0x2732c7['id'],'UserId':_0x2406ad['user']['id'],'ContactId':_0x4a8174['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xd43f('0xb7')}]})[_0xd43f('0x22')](function(_0x2003b0){return[_0x2003b0,!![]];});});}})[_0xd43f('0x91')](function(_0x4a9662,_0x4712db){if(_0x4712db){return _0x4a9662;}return db[_0xd43f('0x99')][_0xd43f('0x5e')](_['merge'](_0x2406ad[_0xd43f('0x5f')],{'read':![],'body':_0x2406ad[_0xd43f('0x5f')][_0xd43f('0x5f')],'OpenchannelAccountId':_0x2732c7['id'],'OpenchannelInteractionId':_0x4a9662['id'],'UserId':_0x2406ad[_0xd43f('0x60')]['id'],'ContactId':_0x4a8174['id']}))['then'](function(_0x49e79f){_0x4a9662[_0xd43f('0xb8')][_0xd43f('0xb7')]=[];_0x4a9662[_0xd43f('0xb8')][_0xd43f('0xb7')][_0xd43f('0x96')](_0x49e79f[_0xd43f('0xb8')]);return _0x4a9662;});});}})[_0xd43f('0x22')](respondWithResult(_0x1d95e6,null))['catch'](handleError(_0x1d95e6,null));}; \ No newline at end of file +var _0x0855=['params','Pause','keys','length','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','pick','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','Contacts','updatedAt','DESC','OpenchannelApplication','account','applications','list','orderBy','priority','Applications','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','status','offset','undefined','limit','count','Content-Range','json','apply','update','destroy','get','OpenchannelAccounts','end','sendStatus','stack','name','send','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','show'];(function(_0x11d71a,_0x47c0a8){var _0x13fb90=function(_0x1aff04){while(--_0x1aff04){_0x11d71a['push'](_0x11d71a['shift']());}};_0x13fb90(++_0x47c0a8);}(_0x0855,0x1de));var _0x5085=function(_0x3de5f2,_0x445e11){_0x3de5f2=_0x3de5f2-0x0;var _0x31b146=_0x0855[_0x3de5f2];return _0x31b146;};'use strict';var emlformat=require(_0x5085('0x0'));var rimraf=require(_0x5085('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5085('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5085('0x3'));var Mustache=require(_0x5085('0x4'));var util=require('util');var path=require(_0x5085('0x5'));var sox=require('sox');var csv=require(_0x5085('0x6'));var ejs=require(_0x5085('0x7'));var fs=require('fs');var fs_extra=require(_0x5085('0x8'));var _=require(_0x5085('0x9'));var squel=require('squel');var crypto=require(_0x5085('0xa'));var jsforce=require(_0x5085('0xb'));var deskjs=require(_0x5085('0xc'));var toCsv=require(_0x5085('0x6'));var querystring=require(_0x5085('0xd'));var Papa=require(_0x5085('0xe'));var Redis=require(_0x5085('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5085('0x10'));var as=require(_0x5085('0x11'));var hardwareService=require(_0x5085('0x12'));var logger=require(_0x5085('0x13'))(_0x5085('0x14'));var utils=require(_0x5085('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5085('0x16'));var db=require(_0x5085('0x17'))['db'];config[_0x5085('0x18')]=_[_0x5085('0x19')](config[_0x5085('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5085('0x18')]));require(_0x5085('0x1a'))[_0x5085('0x1b')](socket);var jayson=require(_0x5085('0x1c'));var client=jayson[_0x5085('0x1d')][_0x5085('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x5085('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x49d284,_0x429fae,_0x4d9752,_0x5874ab){return new BPromise(function(_0x447db9,_0x168355){var _0x44ebc0=_0x5874ab||client;return _0x44ebc0[_0x5085('0x1f')](_0x49d284,_0x4d9752)[_0x5085('0x20')](function(_0x3671fb){logger[_0x5085('0x21')](_0x5085('0x22'),_0x429fae,'request\x20sent');logger[_0x5085('0x23')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x429fae,_0x5085('0x24'),JSON['stringify'](_0x3671fb));if(_0x3671fb['error']){if(_0x3671fb[_0x5085('0x25')][_0x5085('0x26')]===0x1f4){logger[_0x5085('0x25')](_0x5085('0x22'),_0x429fae,_0x3671fb['error'][_0x5085('0x27')]);return _0x168355(_0x3671fb['error'][_0x5085('0x27')]);}logger[_0x5085('0x25')](_0x5085('0x22'),_0x429fae,_0x3671fb[_0x5085('0x25')][_0x5085('0x27')]);return _0x447db9(_0x3671fb['error'][_0x5085('0x27')]);}else{logger['info'](_0x5085('0x22'),_0x429fae,'request\x20sent');_0x447db9(_0x3671fb[_0x5085('0x28')][_0x5085('0x27')]);}})['catch'](function(_0x5a9240){logger['error'](_0x5085('0x22'),_0x429fae,_0x5a9240);_0x168355(_0x5a9240);});});}function respondWithStatusCode(_0x160754,_0x160f7e){_0x160f7e=_0x160f7e||0xcc;return function(_0x1b1d48){if(_0x1b1d48){return _0x160754['sendStatus'](_0x160f7e);}return _0x160754[_0x5085('0x29')](_0x160f7e)['end']();};}function respondWithResult(_0x1419f1,_0x5c9cc5){_0x5c9cc5=_0x5c9cc5||0xc8;return function(_0x593a04){if(_0x593a04){return _0x1419f1['status'](_0x5c9cc5)['json'](_0x593a04);}};}function respondWithFilteredResult(_0x131a79,_0x11b8cd){return function(_0x19df89){if(_0x19df89){var _0x3b3b40=typeof _0x11b8cd[_0x5085('0x2a')]===_0x5085('0x2b')&&typeof _0x11b8cd[_0x5085('0x2c')]==='undefined';var _0x40acda=_0x19df89[_0x5085('0x2d')];var _0x2048b6=_0x3b3b40?0x0:_0x11b8cd[_0x5085('0x2a')];var _0x2da1cc=_0x3b3b40?_0x19df89[_0x5085('0x2d')]:_0x11b8cd[_0x5085('0x2a')]+_0x11b8cd[_0x5085('0x2c')];var _0x7870bd;if(_0x2da1cc>=_0x40acda){_0x2da1cc=_0x40acda;_0x7870bd=0xc8;}else{_0x7870bd=0xce;}_0x131a79[_0x5085('0x29')](_0x7870bd);return _0x131a79['set'](_0x5085('0x2e'),_0x2048b6+'-'+_0x2da1cc+'/'+_0x40acda)[_0x5085('0x2f')](_0x19df89);}return null;};}function patchUpdates(_0x26b811){return function(_0x598bf7){try{jsonpatch[_0x5085('0x30')](_0x598bf7,_0x26b811,!![]);}catch(_0x446ecc){return BPromise['reject'](_0x446ecc);}return _0x598bf7['save']();};}function saveUpdates(_0x465f85,_0x2de590){return function(_0x3452bd){if(_0x3452bd){return _0x3452bd[_0x5085('0x31')](_0x465f85)[_0x5085('0x20')](function(_0x4e9760){return _0x4e9760;});}return null;};}function removeEntity(_0xa06d21,_0x51ced9){return function(_0x4d21f0){if(_0x4d21f0){return _0x4d21f0[_0x5085('0x32')]()[_0x5085('0x20')](function(){var _0x34ce5b=_0x4d21f0[_0x5085('0x33')]({'plain':!![]});var _0x26bb49=_0x5085('0x34');return db['UserProfileResource']['destroy']({'where':{'type':_0x26bb49,'resourceId':_0x34ce5b['id']}})['then'](function(){return _0x4d21f0;});})[_0x5085('0x20')](function(){_0xa06d21[_0x5085('0x29')](0xcc)[_0x5085('0x35')]();});}};}function handleEntityNotFound(_0x56ee93,_0x1192cb){return function(_0x354777){if(!_0x354777){_0x56ee93[_0x5085('0x36')](0x194);}return _0x354777;};}function handleError(_0x1e1fb2,_0x5ab284){_0x5ab284=_0x5ab284||0x1f4;return function(_0x1de924){logger[_0x5085('0x25')](_0x1de924[_0x5085('0x37')]);if(_0x1de924[_0x5085('0x38')]){delete _0x1de924[_0x5085('0x38')];}_0x1e1fb2[_0x5085('0x29')](_0x5ab284)[_0x5085('0x39')](_0x1de924);};}exports['index']=function(_0x449435,_0x19d0a8){var _0x51452b={'include':[{'model':db['Pause'],'as':_0x5085('0x3a')}]},_0x349ae9={},_0x3a8a05={'count':0x0,'rows':[]};var _0x538d52=_['map'](db[_0x5085('0x3b')][_0x5085('0x3c')],function(_0x1f3452){return{'name':_0x1f3452['fieldName'],'type':_0x1f3452[_0x5085('0x3d')]['key']};});_0x349ae9[_0x5085('0x3e')]=_['map'](_0x538d52,_0x5085('0x38'));_0x349ae9[_0x5085('0x3f')]=_['keys'](_0x449435['query']);_0x349ae9[_0x5085('0x40')]=_['intersection'](_0x349ae9[_0x5085('0x3e')],_0x349ae9[_0x5085('0x3f')]);_0x51452b[_0x5085('0x41')]=_[_0x5085('0x42')](_0x349ae9[_0x5085('0x3e')],qs[_0x5085('0x43')](_0x449435[_0x5085('0x3f')]['fields']));_0x51452b[_0x5085('0x41')]=_0x51452b['attributes']['length']?_0x51452b[_0x5085('0x41')]:_0x349ae9[_0x5085('0x3e')];if(!_0x449435[_0x5085('0x3f')][_0x5085('0x44')](_0x5085('0x45'))){_0x51452b[_0x5085('0x2c')]=qs[_0x5085('0x2c')](_0x449435[_0x5085('0x3f')][_0x5085('0x2c')]);_0x51452b[_0x5085('0x2a')]=qs[_0x5085('0x2a')](_0x449435[_0x5085('0x3f')]['offset']);}_0x51452b[_0x5085('0x46')]=qs[_0x5085('0x47')](_0x449435[_0x5085('0x3f')][_0x5085('0x47')]);_0x51452b[_0x5085('0x48')]=qs[_0x5085('0x40')](_['pick'](_0x449435[_0x5085('0x3f')],_0x349ae9['filters']),_0x538d52);if(_0x449435[_0x5085('0x3f')][_0x5085('0x49')]){_0x51452b[_0x5085('0x48')]=_[_0x5085('0x4a')](_0x51452b[_0x5085('0x48')],{'$or':_[_0x5085('0x4b')](_0x538d52,function(_0x5acc0b){if(_0x5acc0b[_0x5085('0x3d')]!==_0x5085('0x4c')){var _0x33f1c8={};_0x33f1c8[_0x5acc0b[_0x5085('0x38')]]={'$like':'%'+_0x449435[_0x5085('0x3f')][_0x5085('0x49')]+'%'};return _0x33f1c8;}})});}_0x51452b=_['merge']({},_0x51452b,_0x449435[_0x5085('0x4d')]);var _0x3baad8={'where':_0x51452b[_0x5085('0x48')]};return db['OpenchannelAccount'][_0x5085('0x2d')](_0x3baad8)[_0x5085('0x20')](function(_0x255968){_0x3a8a05['count']=_0x255968;if(_0x449435[_0x5085('0x3f')][_0x5085('0x4e')]){_0x51452b[_0x5085('0x4f')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x5085('0x50')](_0x51452b);})[_0x5085('0x20')](function(_0xf0af02){_0x3a8a05['rows']=_0xf0af02;return _0x3a8a05;})[_0x5085('0x20')](respondWithFilteredResult(_0x19d0a8,_0x51452b))[_0x5085('0x51')](handleError(_0x19d0a8,null));};exports[_0x5085('0x52')]=function(_0x56d95d,_0x1c26b8){var _0x8688c9={'raw':![],'where':{'id':_0x56d95d[_0x5085('0x53')]['id']},'include':[{'model':db[_0x5085('0x54')],'as':'mandatoryDispositionPause'}]},_0x2115fa={};_0x2115fa[_0x5085('0x3e')]=_[_0x5085('0x55')](db[_0x5085('0x3b')][_0x5085('0x3c')]);_0x2115fa['query']=_[_0x5085('0x55')](_0x56d95d[_0x5085('0x3f')]);_0x2115fa['filters']=_[_0x5085('0x42')](_0x2115fa[_0x5085('0x3e')],_0x2115fa[_0x5085('0x3f')]);_0x8688c9[_0x5085('0x41')]=_[_0x5085('0x42')](_0x2115fa[_0x5085('0x3e')],qs[_0x5085('0x43')](_0x56d95d[_0x5085('0x3f')][_0x5085('0x43')]));_0x8688c9['attributes']=_0x8688c9[_0x5085('0x41')][_0x5085('0x56')]?_0x8688c9[_0x5085('0x41')]:_0x2115fa[_0x5085('0x3e')];if(_0x56d95d[_0x5085('0x3f')][_0x5085('0x4e')]){_0x8688c9[_0x5085('0x4f')]=[{'all':!![]}];}_0x8688c9=_[_0x5085('0x4a')]({},_0x8688c9,_0x56d95d['options']);return db[_0x5085('0x3b')]['find'](_0x8688c9)[_0x5085('0x20')](handleEntityNotFound(_0x1c26b8,null))[_0x5085('0x20')](respondWithResult(_0x1c26b8,null))[_0x5085('0x51')](handleError(_0x1c26b8,null));};exports[_0x5085('0x57')]=function(_0x2e1e10,_0x1657c4){return db[_0x5085('0x3b')][_0x5085('0x57')](_0x2e1e10[_0x5085('0x58')],{})[_0x5085('0x20')](function(_0x333175){var _0x1a441a=_0x2e1e10[_0x5085('0x59')][_0x5085('0x33')]({'plain':!![]});if(!_0x1a441a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a441a[_0x5085('0x5a')]===_0x5085('0x59')){var _0x1df3b4=_0x333175[_0x5085('0x33')]({'plain':!![]});var _0x23f150=_0x5085('0x34');return db[_0x5085('0x5b')][_0x5085('0x5c')]({'where':{'name':_0x23f150,'userProfileId':_0x1a441a[_0x5085('0x5d')]},'raw':!![]})[_0x5085('0x20')](function(_0x378ee2){if(_0x378ee2&&_0x378ee2[_0x5085('0x5e')]===0x0){return db['UserProfileResource'][_0x5085('0x57')]({'name':_0x1df3b4[_0x5085('0x38')],'resourceId':_0x1df3b4['id'],'type':_0x378ee2[_0x5085('0x38')],'sectionId':_0x378ee2['id']},{})[_0x5085('0x20')](function(){return _0x333175;});}else{return _0x333175;}})[_0x5085('0x51')](function(_0x110099){logger[_0x5085('0x25')](_0x5085('0x5f'),_0x110099);throw _0x110099;});}return _0x333175;})[_0x5085('0x20')](respondWithResult(_0x1657c4,0xc9))['catch'](handleError(_0x1657c4,null));};exports[_0x5085('0x31')]=function(_0x3778df,_0x2d865c){if(_0x3778df[_0x5085('0x58')]['id']){delete _0x3778df[_0x5085('0x58')]['id'];}return db['OpenchannelAccount'][_0x5085('0x5c')]({'where':{'id':_0x3778df[_0x5085('0x53')]['id']},'include':[{'model':db[_0x5085('0x54')],'as':_0x5085('0x3a')}]})[_0x5085('0x20')](handleEntityNotFound(_0x2d865c,null))[_0x5085('0x20')](saveUpdates(_0x3778df[_0x5085('0x58')],null))[_0x5085('0x20')](respondWithResult(_0x2d865c,null))[_0x5085('0x51')](handleError(_0x2d865c,null));};exports['destroy']=function(_0x31a734,_0x3b96b9){return db['OpenchannelAccount'][_0x5085('0x5c')]({'where':{'id':_0x31a734[_0x5085('0x53')]['id']}})[_0x5085('0x20')](handleEntityNotFound(_0x3b96b9,null))[_0x5085('0x20')](removeEntity(_0x3b96b9,null))[_0x5085('0x51')](handleError(_0x3b96b9,null));};exports[_0x5085('0x60')]=function(_0x5582e9,_0x58b910){return db[_0x5085('0x3b')][_0x5085('0x60')]()['then'](respondWithResult(_0x58b910,null))[_0x5085('0x51')](handleError(_0x58b910,null));};exports[_0x5085('0x61')]=function(_0x41a13c,_0x46cc13,_0x3bc6dc){if(_0x41a13c['body']['id']){delete _0x41a13c[_0x5085('0x58')]['id'];}return db[_0x5085('0x3b')][_0x5085('0x5c')]({'where':{'id':_0x41a13c['params']['id']}})['then'](handleEntityNotFound(_0x46cc13,null))[_0x5085('0x20')](function(_0x123135){if(_0x123135){_0x41a13c[_0x5085('0x58')][_0x5085('0x62')]=_0x123135['id'];return db[_0x5085('0x63')]['create'](_0x41a13c[_0x5085('0x58')]);}})['then'](respondWithResult(_0x46cc13,null))[_0x5085('0x51')](handleError(_0x46cc13,null));};exports[_0x5085('0x64')]=function(_0xface10,_0x518d25,_0x5dc26c){var _0xdeb3fe={'raw':![],'where':{}};var _0x326ab2={};var _0x9d58c5={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x5085('0x65')]({'where':{'id':_0xface10['params']['id']}})[_0x5085('0x20')](handleEntityNotFound(_0x518d25,null))[_0x5085('0x20')](function(_0x2a1366){if(_0x2a1366){_0x326ab2[_0x5085('0x3e')]=_[_0x5085('0x55')](db['Disposition'][_0x5085('0x3c')]);_0x326ab2[_0x5085('0x3f')]=_[_0x5085('0x55')](_0xface10['query']);_0x326ab2['filters']=_['intersection'](_0x326ab2[_0x5085('0x3e')],_0x326ab2[_0x5085('0x3f')]);_0xdeb3fe[_0x5085('0x41')]=_[_0x5085('0x42')](_0x326ab2[_0x5085('0x3e')],qs['fields'](_0xface10[_0x5085('0x3f')][_0x5085('0x43')]));_0xdeb3fe[_0x5085('0x41')]=_0xdeb3fe[_0x5085('0x41')][_0x5085('0x56')]?_0xdeb3fe[_0x5085('0x41')]:_0x326ab2[_0x5085('0x3e')];if(!_0xface10[_0x5085('0x3f')][_0x5085('0x44')](_0x5085('0x45'))){_0xdeb3fe[_0x5085('0x2c')]=qs['limit'](_0xface10[_0x5085('0x3f')][_0x5085('0x2c')]);_0xdeb3fe['offset']=qs[_0x5085('0x2a')](_0xface10[_0x5085('0x3f')][_0x5085('0x2a')]);}_0xdeb3fe['order']=qs[_0x5085('0x47')](_0xface10['query'][_0x5085('0x47')]);_0xdeb3fe[_0x5085('0x48')]=qs['filters'](_['pick'](_0xface10[_0x5085('0x3f')],_0x326ab2[_0x5085('0x40')]));_0xdeb3fe[_0x5085('0x48')][_0x5085('0x62')]=_0x2a1366['id'];if(_0xface10[_0x5085('0x3f')][_0x5085('0x49')]){_0xdeb3fe[_0x5085('0x48')]=_['merge'](_0xdeb3fe['where'],{'$or':_[_0x5085('0x4b')](_0xdeb3fe[_0x5085('0x41')],function(_0x390539){var _0x24b37b={};_0x24b37b[_0x390539]={'$like':'%'+_0xface10[_0x5085('0x3f')][_0x5085('0x49')]+'%'};return _0x24b37b;})});}_0xdeb3fe=_[_0x5085('0x4a')]({},_0xdeb3fe,_0xface10['options']);return db[_0x5085('0x63')][_0x5085('0x2d')]({'where':_0xdeb3fe[_0x5085('0x48')]})[_0x5085('0x20')](function(_0x1b9806){_0x9d58c5[_0x5085('0x2d')]=_0x1b9806;if(_0xface10['query'][_0x5085('0x4e')]){_0xdeb3fe[_0x5085('0x4f')]=[{'all':!![]}];}return db[_0x5085('0x63')][_0x5085('0x50')](_0xdeb3fe);})[_0x5085('0x20')](function(_0x675dcc){_0x9d58c5[_0x5085('0x66')]=_0x675dcc;return _0x9d58c5;});}})['then'](respondWithFilteredResult(_0x518d25,_0xdeb3fe))['catch'](handleError(_0x518d25,null));};exports[_0x5085('0x67')]=function(_0x4fb701,_0x3a9597,_0x431fde){return db[_0x5085('0x3b')][_0x5085('0x5c')]({'where':{'id':_0x4fb701['params']['id']}})['then'](handleEntityNotFound(_0x3a9597,null))['then'](function(_0x29e14b){if(_0x29e14b){return _0x29e14b[_0x5085('0x67')](_0x4fb701[_0x5085('0x3f')][_0x5085('0x68')]);}})[_0x5085('0x20')](respondWithStatusCode(_0x3a9597,null))['catch'](handleError(_0x3a9597,null));};exports[_0x5085('0x69')]=function(_0x4ca76c,_0x5be8bf,_0x20fa81){if(_0x4ca76c[_0x5085('0x58')]['id']){delete _0x4ca76c[_0x5085('0x58')]['id'];}return db[_0x5085('0x3b')][_0x5085('0x5c')]({'where':{'id':_0x4ca76c[_0x5085('0x53')]['id']}})[_0x5085('0x20')](handleEntityNotFound(_0x5be8bf,null))['then'](function(_0x1a7a26){if(_0x1a7a26){_0x4ca76c[_0x5085('0x58')]['OpenchannelAccountId']=_0x1a7a26['id'];return db[_0x5085('0x6a')][_0x5085('0x57')](_0x4ca76c[_0x5085('0x58')]);}})[_0x5085('0x20')](respondWithResult(_0x5be8bf,null))['catch'](handleError(_0x5be8bf,null));};exports['getAnswers']=function(_0x6246e2,_0x4591ec,_0x4729d6){var _0x53e82d={'raw':![],'where':{}};var _0x12e61a={};var _0x347e37={'count':0x0,'rows':[]};return db[_0x5085('0x3b')][_0x5085('0x65')]({'where':{'id':_0x6246e2['params']['id']}})['then'](handleEntityNotFound(_0x4591ec,null))['then'](function(_0x988a58){if(_0x988a58){_0x12e61a[_0x5085('0x3e')]=_[_0x5085('0x55')](db['CannedAnswer'][_0x5085('0x3c')]);_0x12e61a[_0x5085('0x3f')]=_['keys'](_0x6246e2[_0x5085('0x3f')]);_0x12e61a[_0x5085('0x40')]=_['intersection'](_0x12e61a[_0x5085('0x3e')],_0x12e61a[_0x5085('0x3f')]);_0x53e82d[_0x5085('0x41')]=_[_0x5085('0x42')](_0x12e61a['model'],qs[_0x5085('0x43')](_0x6246e2[_0x5085('0x3f')]['fields']));_0x53e82d[_0x5085('0x41')]=_0x53e82d[_0x5085('0x41')][_0x5085('0x56')]?_0x53e82d[_0x5085('0x41')]:_0x12e61a[_0x5085('0x3e')];if(!_0x6246e2[_0x5085('0x3f')][_0x5085('0x44')](_0x5085('0x45'))){_0x53e82d['limit']=qs[_0x5085('0x2c')](_0x6246e2['query']['limit']);_0x53e82d[_0x5085('0x2a')]=qs[_0x5085('0x2a')](_0x6246e2[_0x5085('0x3f')][_0x5085('0x2a')]);}_0x53e82d[_0x5085('0x46')]=qs[_0x5085('0x47')](_0x6246e2[_0x5085('0x3f')][_0x5085('0x47')]);_0x53e82d[_0x5085('0x48')]=qs[_0x5085('0x40')](_[_0x5085('0x6b')](_0x6246e2[_0x5085('0x3f')],_0x12e61a[_0x5085('0x40')]));_0x53e82d[_0x5085('0x48')][_0x5085('0x62')]=_0x988a58['id'];if(_0x6246e2[_0x5085('0x3f')][_0x5085('0x49')]){_0x53e82d['where']=_[_0x5085('0x4a')](_0x53e82d[_0x5085('0x48')],{'$or':_[_0x5085('0x4b')](_0x53e82d['attributes'],function(_0x4f114c){var _0x3ff336={};_0x3ff336[_0x4f114c]={'$like':'%'+_0x6246e2[_0x5085('0x3f')][_0x5085('0x49')]+'%'};return _0x3ff336;})});}_0x53e82d=_[_0x5085('0x4a')]({},_0x53e82d,_0x6246e2[_0x5085('0x4d')]);return db['CannedAnswer'][_0x5085('0x2d')]({'where':_0x53e82d['where']})['then'](function(_0x188f54){_0x347e37['count']=_0x188f54;if(_0x6246e2['query'][_0x5085('0x4e')]){_0x53e82d[_0x5085('0x4f')]=[{'all':!![]}];}return db[_0x5085('0x6a')][_0x5085('0x50')](_0x53e82d);})['then'](function(_0x2114e3){_0x347e37[_0x5085('0x66')]=_0x2114e3;return _0x347e37;});}})['then'](respondWithFilteredResult(_0x4591ec,_0x53e82d))[_0x5085('0x51')](handleError(_0x4591ec,null));};exports['removeAnswers']=function(_0x9451c9,_0xe91cac,_0x382a26){return db[_0x5085('0x3b')]['find']({'where':{'id':_0x9451c9[_0x5085('0x53')]['id']}})['then'](handleEntityNotFound(_0xe91cac,null))[_0x5085('0x20')](function(_0x2af1a8){if(_0x2af1a8){return _0x2af1a8[_0x5085('0x6c')](_0x9451c9[_0x5085('0x3f')][_0x5085('0x68')]);}})[_0x5085('0x20')](respondWithStatusCode(_0xe91cac,null))['catch'](handleError(_0xe91cac,null));};exports[_0x5085('0x6d')]=function(_0x1538b4,_0x4c874d,_0x1fde84){var _0x397330={'body':_0x1538b4[_0x5085('0x58')],'channel':_0x5085('0x6e')};var _0x2076d3=[];var _0x33db89=[];var _0x3b21d1={};var _0x598d0f=![];return db[_0x5085('0x6f')][_0x5085('0x60')]()[_0x5085('0x20')](function(_0x35a9e5){if(!_0x35a9e5){throw new db[(_0x5085('0x70'))][(_0x5085('0x71'))](_0x5085('0x72'));}_0x2076d3=_[_0x5085('0x73')](_['keys'](_0x35a9e5),[_0x5085('0x74'),'updatedAt']);_0x33db89=_[_0x5085('0x73')](_['keys'](_0x35a9e5),[_0x5085('0x74'),'updatedAt',_0x5085('0x75'),_0x5085('0x76')]);if(_0x1538b4['body']['id']){delete _0x1538b4[_0x5085('0x58')]['id'];}if(_[_0x5085('0x77')](_0x1538b4[_0x5085('0x58')][_0x5085('0x78')])){throw new db[(_0x5085('0x70'))][(_0x5085('0x71'))](_0x5085('0x79'));}if(_['isNil'](_0x1538b4[_0x5085('0x58')]['body'])||_0x1538b4['body'][_0x5085('0x58')]===''){throw new db[(_0x5085('0x70'))][(_0x5085('0x71'))](_0x5085('0x7a'));}if(_['isNil'](_0x1538b4['body']['mapKey'])){throw new db['Sequelize'][(_0x5085('0x71'))](_0x5085('0x7b')+_0x33db89);}if(!_[_0x5085('0x7c')](_0x33db89,_0x1538b4['body']['mapKey'])){throw new db[(_0x5085('0x70'))][(_0x5085('0x71'))](_0x5085('0x7d')+_0x33db89);}_0x3b21d1[_0x1538b4['body'][_0x5085('0x7e')]]=_0x1538b4[_0x5085('0x58')][_0x5085('0x78')];})[_0x5085('0x20')](function(){return db[_0x5085('0x3b')][_0x5085('0x5c')]({'where':{'id':_0x1538b4['params']['id']},'include':[{'model':db[_0x5085('0x7f')],'as':_0x5085('0x80'),'include':[{'model':db['CmContact'],'as':_0x5085('0x81'),'where':_0x3b21d1,'limit':0x1,'order':[[_0x5085('0x82'),_0x5085('0x83')]]}]},{'model':db[_0x5085('0x84')],'as':'Applications'}]});})[_0x5085('0x20')](handleEntityNotFound(_0x4c874d,null))['then'](function(_0x5b1d2d){if(_0x5b1d2d&&_0x5b1d2d[_0x5085('0x80')]){_0x397330[_0x5085('0x85')]=_0x5b1d2d;_0x397330[_0x5085('0x86')]=_0x5b1d2d['Applications'];_0x397330[_0x5085('0x87')]=_0x5b1d2d[_0x5085('0x80')];_0x397330['applications']=_[_0x5085('0x88')](_0x397330['applications'],[_0x5085('0x89')],['asc']);if(_0x397330[_0x5085('0x85')][_0x5085('0x8a')]){delete _0x397330[_0x5085('0x85')][_0x5085('0x8a')];}if(_0x397330[_0x5085('0x85')][_0x5085('0x80')]&&_0x397330['account'][_0x5085('0x80')]['Contacts'][_0x5085('0x56')]){return _0x397330[_0x5085('0x85')]['List']['Contacts'][0x0];}var _0x478775=_[_0x5085('0x19')](_0x1538b4[_0x5085('0x58')],{'firstName':_0x1538b4['body'][_0x5085('0x78')],'ListId':_0x5b1d2d[_0x5085('0x76')]});_0x478775[_0x1538b4['body'][_0x5085('0x7e')]]=_0x1538b4[_0x5085('0x58')][_0x5085('0x78')];return db[_0x5085('0x6f')][_0x5085('0x57')](_0x478775,{'fields':_0x2076d3,'raw':!![]});}})[_0x5085('0x20')](handleEntityNotFound(_0x4c874d,null))['then'](function(_0x2df0bf){_0x397330[_0x5085('0x8b')]=_0x2df0bf;if(_0x2df0bf){var _0x48131c={'ContactId':_0x2df0bf['id'],'OpenchannelAccountId':_0x1538b4[_0x5085('0x53')]['id'],'from':(_0x2df0bf[_0x5085('0x8c')]||'')+'\x20'+(_0x2df0bf[_0x5085('0x8d')]||'')};var _0x248693={'OpenchannelAccountId':_0x1538b4[_0x5085('0x53')]['id'],'closed':![]};if(_0x1538b4[_0x5085('0x58')]['threadId']){_0x248693[_0x5085('0x8e')]=_0x1538b4[_0x5085('0x58')][_0x5085('0x8e')];return db[_0x5085('0x8f')][_0x5085('0x5c')]({'where':_0x248693})['then'](function(_0x1bc78e){if(_0x1bc78e){return[_0x1bc78e,![]];}_0x48131c[_0x5085('0x8e')]=_0x1538b4[_0x5085('0x58')]['threadId'];_0x48131c[_0x5085('0x90')]=_0x1538b4[_0x5085('0x58')][_0x5085('0x90')];return db[_0x5085('0x8f')]['create'](_0x48131c)[_0x5085('0x20')](function(_0x4e183d){return[_0x4e183d,!![]];});});}else{_0x248693['threadId']=null;}_0x248693[_0x5085('0x91')]=_0x2df0bf['id'];return db[_0x5085('0x8f')]['find']({'where':_0x248693})[_0x5085('0x20')](function(_0x54a3c4){if(_0x54a3c4){return[_0x54a3c4,![]];}return db[_0x5085('0x8f')][_0x5085('0x57')](_0x48131c)[_0x5085('0x20')](function(_0x21e858){return[_0x21e858,!![]];});});}})[_0x5085('0x92')](function(_0x1b28c0,_0xbb631e){if(_0x1b28c0){_0x598d0f=_0xbb631e;if(!_0xbb631e){var _0xbb2219={'from':(_0x397330['contact'][_0x5085('0x8c')]||'')+'\x20'+(_0x397330[_0x5085('0x8b')]['lastName']||'')};if(_0x1538b4[_0x5085('0x58')][_0x5085('0x8e')]&&_0x1538b4['body'][_0x5085('0x93')]&&_0x1538b4[_0x5085('0x58')][_0x5085('0x8e')]!=_0x1538b4[_0x5085('0x58')][_0x5085('0x93')]){_0xbb2219['threadId']=_0x1538b4[_0x5085('0x58')][_0x5085('0x93')];}return _0x1b28c0[_0x5085('0x31')](_0xbb2219);}else{return _0x1b28c0;}}})['then'](function(_0x7d7047){_0x397330[_0x5085('0x94')]=_0x7d7047[_0x5085('0x33')]({'plain':!![]});_0x397330[_0x5085('0x94')][_0x5085('0x95')]=_0x598d0f;if(_0x397330[_0x5085('0x94')][_0x5085('0x95')]){if(_0x397330[_0x5085('0x85')][_0x5085('0x96')]){_0x397330[_0x5085('0x86')][_0x5085('0x97')]({'id':0x0,'priority':_0x397330[_0x5085('0x86')][_0x5085('0x56')]+0x1,'app':'close','appdata':_0x5085('0x98'),'interval':_0x5085('0x99')});}}return db['OpenchannelMessage'][_0x5085('0x57')]({'body':_0x1538b4['body']['body'],'OpenchannelAccountId':_0x1538b4['params']['id'],'OpenchannelInteractionId':_0x7d7047['id'],'direction':'in','ContactId':_0x397330['contact']['id'],'AttachmentId':_0x1538b4['body'][_0x5085('0x9a')]});})[_0x5085('0x20')](function(_0x211638){_0x397330['message']=_0x211638;if(_0x397330['interaction']['UserId']){return db[_0x5085('0x9b')][_0x5085('0x5c')]({'attributes':['id',_0x5085('0x38')],'where':{'id':_0x397330[_0x5085('0x94')][_0x5085('0x9c')]}})[_0x5085('0x20')](function(_0x1d70e6){if(_0x1d70e6){_0x397330[_0x5085('0x86')][_0x5085('0x9d')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1d70e6[_0x5085('0x38')]+','+(_0x397330[_0x5085('0x85')][_0x5085('0x9e')]||0xa),'interval':_0x5085('0x99')});_0x397330[_0x5085('0x9f')]=![];}return respondWithRpcPromise('Start',_0x5085('0xa0'),_0x397330);});}return respondWithRpcPromise(_0x5085('0xa1'),_0x5085('0xa0'),_0x397330);})[_0x5085('0x20')](function(_0x158ec3){respondWithRpcPromise(_0x5085('0xa2'),_0x5085('0xa2'),{'event':'notify','message':_0x158ec3},client9002);return _0x158ec3;})[_0x5085('0x20')](respondWithResult(_0x4c874d,null))[_0x5085('0x51')](handleError(_0x4c874d,null));};exports[_0x5085('0xa3')]=function(_0x4aff43,_0x39dc38,_0x11fe9e){return db[_0x5085('0x3b')][_0x5085('0x65')]({'where':{'id':_0x4aff43[_0x5085('0x53')]['id']}})['then'](handleEntityNotFound(_0x39dc38,null))[_0x5085('0x20')](function(_0x3abadf){if(_0x3abadf){return db[_0x5085('0xa4')][_0x5085('0xa5')](function(_0x260ee9){return db[_0x5085('0x84')][_0x5085('0x32')]({'where':{'OpenchannelAccountId':_0x4aff43['params']['id']},'transaction':_0x260ee9})[_0x5085('0x20')](function(_0x3dcf23){var _0x2b4fde=_[_0x5085('0x4b')](_0x4aff43['body'],function(_0x3df8c8){_0x3df8c8['OpenchannelAccountId']=_0x4aff43[_0x5085('0x53')]['id'];return _0x3df8c8;});return db[_0x5085('0x84')][_0x5085('0xa6')](_0x2b4fde,{'transaction':_0x260ee9});});})[_0x5085('0x20')](function(){return db['OpenchannelApplication'][_0x5085('0xa7')]({'where':{'OpenchannelAccountId':_0x4aff43[_0x5085('0x53')]['id']},'order':_0x5085('0x89')});});}})[_0x5085('0x20')](respondWithResult(_0x39dc38,null))['catch'](handleError(_0x39dc38,null));};exports[_0x5085('0xa8')]=function(_0x232bb0,_0x14f8c2,_0x2edf1c){var _0x1b684d={};var _0x5c05a1={};var _0x12f4a4;var _0x596f5c;return db[_0x5085('0x3b')]['findOne']({'where':{'id':_0x232bb0['params']['id']}})[_0x5085('0x20')](handleEntityNotFound(_0x14f8c2,null))[_0x5085('0x20')](function(_0x265794){if(_0x265794){_0x12f4a4=_0x265794;_0x5c05a1[_0x5085('0x3e')]=_['keys'](db['OpenchannelApplication'][_0x5085('0x3c')]);_0x5c05a1[_0x5085('0x3f')]=_[_0x5085('0x55')](_0x232bb0[_0x5085('0x3f')]);_0x5c05a1[_0x5085('0x40')]=_[_0x5085('0x42')](_0x5c05a1['model'],_0x5c05a1[_0x5085('0x3f')]);_0x1b684d['attributes']=_[_0x5085('0x42')](_0x5c05a1[_0x5085('0x3e')],qs['fields'](_0x232bb0[_0x5085('0x3f')][_0x5085('0x43')]));_0x1b684d[_0x5085('0x41')]=_0x1b684d['attributes'][_0x5085('0x56')]?_0x1b684d['attributes']:_0x5c05a1[_0x5085('0x3e')];_0x1b684d[_0x5085('0x46')]=qs['sort'](_0x232bb0[_0x5085('0x3f')][_0x5085('0x47')]);_0x1b684d[_0x5085('0x48')]=qs[_0x5085('0x40')](_['pick'](_0x232bb0['query'],_0x5c05a1[_0x5085('0x40')]));if(_0x232bb0[_0x5085('0x3f')][_0x5085('0x49')]){_0x1b684d['where']=_[_0x5085('0x4a')](_0x1b684d[_0x5085('0x48')],{'$or':_['map'](_0x1b684d[_0x5085('0x41')],function(_0x2cc0a6){var _0x2f5135={};_0x2f5135[_0x2cc0a6]={'$like':'%'+_0x232bb0[_0x5085('0x3f')]['filter']+'%'};return _0x2f5135;})});}_0x1b684d=_['merge']({},_0x1b684d,_0x232bb0['options']);return _0x12f4a4['getApplications'](_0x1b684d);}})[_0x5085('0x20')](function(_0x123b1c){if(_0x123b1c){_0x596f5c=_0x123b1c[_0x5085('0x56')];if(!_0x232bb0[_0x5085('0x3f')]['hasOwnProperty']('nolimit')){_0x1b684d[_0x5085('0x2c')]=qs['limit'](_0x232bb0[_0x5085('0x3f')][_0x5085('0x2c')]);_0x1b684d[_0x5085('0x2a')]=qs[_0x5085('0x2a')](_0x232bb0[_0x5085('0x3f')][_0x5085('0x2a')]);}return _0x12f4a4[_0x5085('0xa8')](_0x1b684d);}})[_0x5085('0x20')](function(_0x2c4533){if(_0x2c4533){return _0x2c4533?{'count':_0x596f5c,'rows':_0x2c4533}:null;}})[_0x5085('0x20')](respondWithResult(_0x14f8c2,null))[_0x5085('0x51')](handleError(_0x14f8c2,null));};exports[_0x5085('0xa9')]=function(_0x353480,_0x6c3711,_0x59270c){var _0x2dc80f={'raw':![],'where':{}};var _0x19ddf4={};var _0x54d055={'count':0x0,'rows':[]};return db[_0x5085('0x3b')][_0x5085('0x65')]({'where':{'id':_0x353480[_0x5085('0x53')]['id']}})[_0x5085('0x20')](handleEntityNotFound(_0x6c3711,null))['then'](function(_0x1e2b10){if(_0x1e2b10){_0x19ddf4['model']=_[_0x5085('0x55')](db[_0x5085('0x8f')]['rawAttributes']);_0x19ddf4[_0x5085('0x3f')]=_[_0x5085('0x55')](_0x353480[_0x5085('0x3f')]);_0x19ddf4['filters']=_[_0x5085('0x42')](_0x19ddf4[_0x5085('0x3e')],_0x19ddf4[_0x5085('0x3f')]);_0x2dc80f[_0x5085('0x41')]=_[_0x5085('0x42')](_0x19ddf4[_0x5085('0x3e')],qs[_0x5085('0x43')](_0x353480[_0x5085('0x3f')]['fields']));_0x2dc80f[_0x5085('0x41')]=_0x2dc80f[_0x5085('0x41')]['length']?_0x2dc80f['attributes']:_0x19ddf4[_0x5085('0x3e')];if(!_0x353480['query'][_0x5085('0x44')](_0x5085('0x45'))){_0x2dc80f[_0x5085('0x2c')]=qs[_0x5085('0x2c')](_0x353480[_0x5085('0x3f')][_0x5085('0x2c')]);_0x2dc80f[_0x5085('0x2a')]=qs[_0x5085('0x2a')](_0x353480[_0x5085('0x3f')][_0x5085('0x2a')]);}_0x2dc80f['order']=qs[_0x5085('0x47')](_0x353480['query'][_0x5085('0x47')]);_0x2dc80f[_0x5085('0x48')]=qs['filters'](_[_0x5085('0x6b')](_0x353480[_0x5085('0x3f')],_0x19ddf4[_0x5085('0x40')]));_0x2dc80f['where'][_0x5085('0x62')]=_0x1e2b10['id'];if(_0x353480[_0x5085('0x3f')][_0x5085('0x49')]){_0x2dc80f[_0x5085('0x48')]=_[_0x5085('0x4a')](_0x2dc80f[_0x5085('0x48')],{'$or':_[_0x5085('0x4b')](_0x2dc80f[_0x5085('0x41')],function(_0x470a9e){var _0x340b1a={};_0x340b1a[_0x470a9e]={'$like':'%'+_0x353480[_0x5085('0x3f')][_0x5085('0x49')]+'%'};return _0x340b1a;})});}_0x2dc80f=_['merge']({},_0x2dc80f,_0x353480[_0x5085('0x4d')]);return db[_0x5085('0x8f')][_0x5085('0x2d')]({'where':_0x2dc80f[_0x5085('0x48')]})[_0x5085('0x20')](function(_0x234935){_0x54d055['count']=_0x234935;if(_0x353480[_0x5085('0x3f')][_0x5085('0x4e')]){_0x2dc80f[_0x5085('0x4f')]=[{'model':db['CmContact'],'as':_0x5085('0xaa'),'required':![]},{'model':db[_0x5085('0x9b')],'as':'Owner','attributes':[_0x5085('0x38'),_0x5085('0xab'),_0x5085('0xac')],'required':![]},{'model':db['Tag'],'as':_0x5085('0xad'),'attributes':['id',_0x5085('0x38'),_0x5085('0xae')],'where':_0x353480[_0x5085('0x3f')][_0x5085('0xaf')]?{'id':_0x353480[_0x5085('0x3f')][_0x5085('0xaf')]}:undefined,'required':_0x353480[_0x5085('0x3f')][_0x5085('0xaf')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x5085('0x50')](_0x2dc80f);})['then'](function(_0x5b11aa){_0x54d055[_0x5085('0x66')]=_0x5b11aa;return _0x54d055;});}})[_0x5085('0x20')](respondWithFilteredResult(_0x6c3711,_0x2dc80f))['catch'](handleError(_0x6c3711,null));};exports[_0x5085('0xb0')]=function(_0x5be50e,_0x19616b,_0x471546){return db['OpenchannelAccount'][_0x5085('0x5c')]({'where':{'id':_0x5be50e[_0x5085('0x53')]['id']}})[_0x5085('0x20')](handleEntityNotFound(_0x19616b,null))[_0x5085('0x20')](function(_0x441b00){if(_0x441b00){return _0x441b00[_0x5085('0xb0')](_0x5be50e[_0x5085('0x58')][_0x5085('0x68')],_['omit'](_0x5be50e[_0x5085('0x58')],[_0x5085('0x68'),'id'])||{})['spread'](function(_0x1b1011){for(var _0x2bd20c=0x0;_0x2bd20c<_0x5be50e[_0x5085('0x58')][_0x5085('0x68')]['length'];_0x2bd20c+=0x1){socket[_0x5085('0xb1')](_0x5085('0xb2'),{'UserId':_0x5be50e[_0x5085('0x58')][_0x5085('0x68')][_0x2bd20c],'OpenchannelAccountId':_0x5be50e[_0x5085('0x53')]['id']});}return _0x1b1011;});}})[_0x5085('0x20')](respondWithResult(_0x19616b,null))[_0x5085('0x51')](handleError(_0x19616b,null));};exports['removeAgents']=function(_0x38c23a,_0x3f615d,_0x2f043c){return db[_0x5085('0x3b')][_0x5085('0x5c')]({'where':{'id':_0x38c23a[_0x5085('0x53')]['id']}})[_0x5085('0x20')](handleEntityNotFound(_0x3f615d,null))[_0x5085('0x20')](function(_0x594d8e){if(_0x594d8e){return _0x594d8e[_0x5085('0xb3')](_0x38c23a[_0x5085('0x3f')][_0x5085('0x68')])[_0x5085('0x20')](function(){if(_[_0x5085('0xb4')](_0x38c23a[_0x5085('0x3f')][_0x5085('0x68')])){for(var _0x27569c=0x0;_0x27569c<_0x38c23a['query']['ids']['length'];_0x27569c+=0x1){socket[_0x5085('0xb1')](_0x5085('0xb5'),{'UserId':Number(_0x38c23a[_0x5085('0x3f')]['ids'][_0x27569c]),'OpenchannelAccountId':Number(_0x38c23a[_0x5085('0x53')]['id'])});}}else{socket[_0x5085('0xb1')](_0x5085('0xb5'),{'UserId':Number(_0x38c23a[_0x5085('0x3f')][_0x5085('0x68')]),'OpenchannelAccountId':Number(_0x38c23a[_0x5085('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x3f615d,null))[_0x5085('0x51')](handleError(_0x3f615d,null));};exports[_0x5085('0xb6')]=function(_0x1c904f,_0x3cfbd8,_0x182d9b){var _0x5638c8={};var _0x3a8b6b={};var _0x8ebd40;var _0x13c60d;return db[_0x5085('0x3b')][_0x5085('0x65')]({'where':{'id':_0x1c904f['params']['id']}})[_0x5085('0x20')](handleEntityNotFound(_0x3cfbd8,null))['then'](function(_0x22aca2){if(_0x22aca2){_0x8ebd40=_0x22aca2;_0x3a8b6b[_0x5085('0x3e')]=_[_0x5085('0x55')](db[_0x5085('0x9b')][_0x5085('0x3c')]);_0x3a8b6b[_0x5085('0x3f')]=_[_0x5085('0x55')](_0x1c904f[_0x5085('0x3f')]);_0x3a8b6b[_0x5085('0x40')]=_[_0x5085('0x42')](_0x3a8b6b[_0x5085('0x3e')],_0x3a8b6b[_0x5085('0x3f')]);_0x5638c8[_0x5085('0x41')]=_[_0x5085('0x42')](_0x3a8b6b[_0x5085('0x3e')],qs[_0x5085('0x43')](_0x1c904f['query'][_0x5085('0x43')]));_0x5638c8[_0x5085('0x41')]=_0x5638c8[_0x5085('0x41')][_0x5085('0x56')]?_0x5638c8[_0x5085('0x41')]:_0x3a8b6b[_0x5085('0x3e')];_0x5638c8[_0x5085('0x46')]=qs[_0x5085('0x47')](_0x1c904f[_0x5085('0x3f')][_0x5085('0x47')]);_0x5638c8['where']=qs[_0x5085('0x40')](_[_0x5085('0x6b')](_0x1c904f['query'],_0x3a8b6b['filters']));if(_0x1c904f[_0x5085('0x3f')][_0x5085('0x49')]){_0x5638c8[_0x5085('0x48')]=_['merge'](_0x5638c8['where'],{'$or':_[_0x5085('0x4b')](_0x5638c8[_0x5085('0x41')],function(_0x176dca){var _0x888bfd={};_0x888bfd[_0x176dca]={'$like':'%'+_0x1c904f[_0x5085('0x3f')]['filter']+'%'};return _0x888bfd;})});}_0x5638c8=_[_0x5085('0x4a')]({},_0x5638c8,_0x1c904f[_0x5085('0x4d')]);return _0x8ebd40[_0x5085('0xb6')](_0x5638c8);}})[_0x5085('0x20')](function(_0x10240e){if(_0x10240e){_0x13c60d=_0x10240e[_0x5085('0x56')];if(!_0x1c904f[_0x5085('0x3f')][_0x5085('0x44')](_0x5085('0x45'))){_0x5638c8[_0x5085('0x2c')]=qs[_0x5085('0x2c')](_0x1c904f['query'][_0x5085('0x2c')]);_0x5638c8[_0x5085('0x2a')]=qs[_0x5085('0x2a')](_0x1c904f[_0x5085('0x3f')][_0x5085('0x2a')]);}return _0x8ebd40['getAgents'](_0x5638c8);}})[_0x5085('0x20')](function(_0x449c9a){if(_0x449c9a){return _0x449c9a?{'count':_0x13c60d,'rows':_0x449c9a}:null;}})['then'](respondWithResult(_0x3cfbd8,null))[_0x5085('0x51')](handleError(_0x3cfbd8,null));};exports[_0x5085('0x39')]=function(_0x36017f,_0x38f841,_0x5d9e53){var _0x3c3543,_0x17f07e,_0x747724;if(_[_0x5085('0x77')](_0x36017f['body'][_0x5085('0x58')])||_0x36017f[_0x5085('0x58')]['body']===''){throw new db['Sequelize'][(_0x5085('0x71'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5085('0x77')](_0x36017f[_0x5085('0x58')]['to'])){}_0x3c3543=_0x36017f[_0x5085('0x58')]['to'];return db[_0x5085('0x3b')][_0x5085('0x65')]({'where':{'id':_0x36017f['params']['id']}})['then'](handleEntityNotFound(_0x38f841,null))[_0x5085('0x20')](function(_0x2a7346){if(_0x2a7346){return db[_0x5085('0x3b')][_0x5085('0x5c')]({'where':{'id':_0x2a7346['id']},'include':[{'model':db['CmList'],'as':_0x5085('0x80'),'include':[{'model':db[_0x5085('0x6f')],'as':_0x5085('0x81'),'where':{[_0x2a7346[_0x5085('0x7e')]]:_0x3c3543},'limit':0x1,'order':[[_0x5085('0x82'),_0x5085('0x83')]]}]}]})['then'](handleEntityNotFound(_0x38f841,null))['then'](function(_0x27ab14){if(_0x27ab14&&_0x27ab14[_0x5085('0x80')]){_0x17f07e=_0x27ab14[_0x5085('0x33')]({'plain':!![]});if(_0x17f07e[_0x5085('0x80')]&&_0x17f07e[_0x5085('0x80')]['Contacts'][_0x5085('0x56')]){return _0x17f07e[_0x5085('0x80')]['Contacts'][0x0];}return db[_0x5085('0x6f')][_0x5085('0x57')](_[_0x5085('0x19')](_0x36017f[_0x5085('0x58')],{'firstName':_0x3c3543,[_0x27ab14['mapKey']]:_0x3c3543,'phone':_0x3c3543,'ListId':_0x17f07e[_0x5085('0x76')]}));}})[_0x5085('0x20')](handleEntityNotFound(_0x38f841,null))[_0x5085('0x20')](function(_0x287069){if(_0x287069){_0x747724=_0x287069;return db['OpenchannelInteraction'][_0x5085('0x5c')]({'where':{'ContactId':_0x747724['id'],'closed':![],'OpenchannelAccountId':_0x17f07e['id']}})[_0x5085('0x20')](function(_0x295536){if(_0x295536){return[_0x295536,![]];}return db[_0x5085('0x8f')][_0x5085('0x57')]({'UserId':_0x36017f[_0x5085('0x59')]['id'],'ContactId':_0x747724['id'],'OpenchannelAccountId':_0x17f07e['id'],'lastMsgDirection':_0x5085('0xb7'),'Messages':[_[_0x5085('0x4a')](_0x36017f[_0x5085('0x58')],{'read':![],'body':_0x36017f[_0x5085('0x58')][_0x5085('0x58')],'OpenchannelAccountId':_0x17f07e['id'],'UserId':_0x36017f[_0x5085('0x59')]['id'],'ContactId':_0x747724['id']})]},{'include':[{'model':db[_0x5085('0xb8')],'as':_0x5085('0xb9')}]})[_0x5085('0x20')](function(_0x13280e){return[_0x13280e,!![]];});});}})[_0x5085('0x92')](function(_0x466326,_0x5a6c58){if(_0x5a6c58){return _0x466326;}return db[_0x5085('0xb8')][_0x5085('0x57')](_['merge'](_0x36017f[_0x5085('0x58')],{'read':![],'body':_0x36017f[_0x5085('0x58')][_0x5085('0x58')],'OpenchannelAccountId':_0x17f07e['id'],'OpenchannelInteractionId':_0x466326['id'],'UserId':_0x36017f[_0x5085('0x59')]['id'],'ContactId':_0x747724['id']}))[_0x5085('0x20')](function(_0x15447a){_0x466326['dataValues'][_0x5085('0xb9')]=[];_0x466326[_0x5085('0xba')][_0x5085('0xb9')][_0x5085('0x97')](_0x15447a[_0x5085('0xba')]);return _0x466326;});});}})[_0x5085('0x20')](respondWithResult(_0x38f841,null))['catch'](handleError(_0x38f841,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 2c6411d..d726060 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 _0x0195=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x2002b3,_0x11e91c){var _0x2756f0=function(_0x4bf0b3){while(--_0x4bf0b3){_0x2002b3['push'](_0x2002b3['shift']());}};_0x2756f0(++_0x11e91c);}(_0x0195,0xcf));var _0x5019=function(_0x19e0b5,_0x4c2b2f){_0x19e0b5=_0x19e0b5-0x0;var _0x45e469=_0x0195[_0x19e0b5];return _0x45e469;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x5019('0x0'))['db'][_0x5019('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x5019('0x2')](0x0);var events={'afterCreate':_0x5019('0x3'),'afterUpdate':_0x5019('0x4'),'afterDestroy':_0x5019('0x5')};function emitEvent(_0x11feb0){return function(_0x28614c,_0x1ecef4,_0x119434){OpenchannelAccountEvents[_0x5019('0x6')](_0x11feb0+':'+_0x28614c['id'],_0x28614c);OpenchannelAccountEvents[_0x5019('0x6')](_0x11feb0,_0x28614c);_0x119434(null);};}for(var e in events){if(events[_0x5019('0x7')](e)){var event=events[e];OpenchannelAccount[_0x5019('0x8')](e,emitEvent(event));}}module[_0x5019('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xaeaf=['../../mysqldb','OpenchannelAccount','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xd09c6b,_0x2a3b1a){var _0x46a69b=function(_0x2bbf74){while(--_0x2bbf74){_0xd09c6b['push'](_0xd09c6b['shift']());}};_0x46a69b(++_0x2a3b1a);}(_0xaeaf,0x153));var _0xfaea=function(_0x1e8f35,_0x3db390){_0x1e8f35=_0x1e8f35-0x0;var _0x446c13=_0xaeaf[_0x1e8f35];return _0x446c13;};'use strict';var EventEmitter=require(_0xfaea('0x0'));var OpenchannelAccount=require(_0xfaea('0x1'))['db'][_0xfaea('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfaea('0x3'),'afterUpdate':_0xfaea('0x4'),'afterDestroy':_0xfaea('0x5')};function emitEvent(_0x6a3b70){return function(_0x26d147,_0x391a47,_0x517843){OpenchannelAccountEvents[_0xfaea('0x6')](_0x6a3b70+':'+_0x26d147['id'],_0x26d147);OpenchannelAccountEvents[_0xfaea('0x6')](_0x6a3b70,_0x26d147);_0x517843(null);};}for(var e in events){if(events[_0xfaea('0x7')](e)){var event=events[e];OpenchannelAccount[_0xfaea('0x8')](e,emitEvent(event));}}module[_0xfaea('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 8af1aea..099d715 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 _0xa049=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts','util','../../config/logger'];(function(_0x3186a5,_0x4fc7f6){var _0x4f6b69=function(_0x41567e){while(--_0x41567e){_0x3186a5['push'](_0x3186a5['shift']());}};_0x4f6b69(++_0x4fc7f6);}(_0xa049,0x136));var _0x9a04=function(_0xc72a72,_0xfaaf35){_0xc72a72=_0xc72a72-0x0;var _0x20f9a9=_0xa049[_0xc72a72];return _0x20f9a9;};'use strict';var _=require('lodash');var util=require(_0x9a04('0x0'));var logger=require(_0x9a04('0x1'))(_0x9a04('0x2'));var moment=require(_0x9a04('0x3'));var BPromise=require(_0x9a04('0x4'));var rp=require(_0x9a04('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a04('0x6'));var config=require(_0x9a04('0x7'));var attributes=require(_0x9a04('0x8'));module[_0x9a04('0x9')]=function(_0x376afc,_0x15d14a){return _0x376afc[_0x9a04('0xa')](_0x9a04('0xb'),attributes,{'tableName':_0x9a04('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6760=['moment','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelAccount','openchannel_accounts','lodash','util'];(function(_0x11f926,_0x26af58){var _0x355bf6=function(_0x2c2267){while(--_0x2c2267){_0x11f926['push'](_0x11f926['shift']());}};_0x355bf6(++_0x26af58);}(_0x6760,0x98));var _0x0676=function(_0x19bb4c,_0x1380c5){_0x19bb4c=_0x19bb4c-0x0;var _0x6bc86b=_0x6760[_0x19bb4c];return _0x6bc86b;};'use strict';var _=require(_0x0676('0x0'));var util=require(_0x0676('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0676('0x2'));var BPromise=require('bluebird');var rp=require(_0x0676('0x3'));var fs=require('fs');var path=require(_0x0676('0x4'));var rimraf=require(_0x0676('0x5'));var config=require(_0x0676('0x6'));var attributes=require('./openchannelAccount.attributes');module[_0x0676('0x7')]=function(_0x372255,_0x494f7b){return _0x372255[_0x0676('0x8')](_0x0676('0x9'),attributes,{'tableName':_0x0676('0xa'),'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 c43aa03..978d50b 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 _0xfeb0=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./openchannelAccount.socket','register','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird'];(function(_0x5bfe40,_0xa0bb9c){var _0x133f9e=function(_0x3bfd3f){while(--_0x3bfd3f){_0x5bfe40['push'](_0x5bfe40['shift']());}};_0x133f9e(++_0xa0bb9c);}(_0xfeb0,0x1e1));var _0x0feb=function(_0x473738,_0x15ea31){_0x473738=_0x473738-0x0;var _0x1df4ae=_0xfeb0[_0x473738];return _0x1df4ae;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0feb('0x0'));var BPromise=require(_0x0feb('0x1'));var rs=require(_0x0feb('0x2'));var fs=require('fs');var Redis=require(_0x0feb('0x3'));var db=require(_0x0feb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0feb('0x5'))('rpc');var config=require(_0x0feb('0x6'));var jayson=require(_0x0feb('0x7'));var client=jayson[_0x0feb('0x8')]['http']({'port':0x232a});config[_0x0feb('0x9')]=_['defaults'](config[_0x0feb('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x0feb('0xa'))(new Redis(config[_0x0feb('0x9')]));require(_0x0feb('0xb'))[_0x0feb('0xc')](socket);function respondWithRpcPromise(_0x380842,_0x334c7b,_0x19926d){return new BPromise(function(_0x492d47,_0x38e755){return client['request'](_0x380842,_0x19926d)['then'](function(_0x922499){logger[_0x0feb('0xd')](_0x0feb('0xe'),_0x334c7b,'request\x20sent');logger[_0x0feb('0xf')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x334c7b,_0x0feb('0x10'),JSON[_0x0feb('0x11')](_0x922499));if(_0x922499[_0x0feb('0x12')]){if(_0x922499[_0x0feb('0x12')][_0x0feb('0x13')]===0x1f4){logger['error'](_0x0feb('0xe'),_0x334c7b,_0x922499[_0x0feb('0x12')]['message']);return _0x38e755(_0x922499[_0x0feb('0x12')][_0x0feb('0x14')]);}logger[_0x0feb('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x334c7b,_0x922499[_0x0feb('0x12')]['message']);return _0x492d47(_0x922499[_0x0feb('0x12')]['message']);}else{logger[_0x0feb('0xd')]('OpenchannelAccount,\x20%s,\x20%s',_0x334c7b,'request\x20sent');_0x492d47(_0x922499[_0x0feb('0x15')]['message']);}})[_0x0feb('0x16')](function(_0x5599f3){logger[_0x0feb('0x12')](_0x0feb('0xe'),_0x334c7b,_0x5599f3);_0x38e755(_0x5599f3);});});} \ No newline at end of file +var _0x2c70=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelAccount.socket','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5bbe4f,_0x57f4af){var _0x558711=function(_0x19bf57){while(--_0x19bf57){_0x5bbe4f['push'](_0x5bbe4f['shift']());}};_0x558711(++_0x57f4af);}(_0x2c70,0x87));var _0x02c7=function(_0x3dfe4b,_0x2bcfa9){_0x3dfe4b=_0x3dfe4b-0x0;var _0x579aff=_0x2c70[_0x3dfe4b];return _0x579aff;};'use strict';var _=require(_0x02c7('0x0'));var util=require(_0x02c7('0x1'));var moment=require(_0x02c7('0x2'));var BPromise=require(_0x02c7('0x3'));var rs=require(_0x02c7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02c7('0x5'))['db'];var utils=require(_0x02c7('0x6'));var logger=require(_0x02c7('0x7'))('rpc');var config=require(_0x02c7('0x8'));var jayson=require(_0x02c7('0x9'));var client=jayson[_0x02c7('0xa')][_0x02c7('0xb')]({'port':0x232a});config[_0x02c7('0xc')]=_[_0x02c7('0xd')](config[_0x02c7('0xc')],{'host':_0x02c7('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x02c7('0xc')]));require(_0x02c7('0xf'))['register'](socket);function respondWithRpcPromise(_0x5b33b3,_0x571b37,_0x1d4acf){return new BPromise(function(_0x5117af,_0x239577){return client[_0x02c7('0x10')](_0x5b33b3,_0x1d4acf)['then'](function(_0x3c754e){logger[_0x02c7('0x11')](_0x02c7('0x12'),_0x571b37,_0x02c7('0x13'));logger[_0x02c7('0x14')](_0x02c7('0x15'),_0x571b37,_0x02c7('0x13'),JSON[_0x02c7('0x16')](_0x3c754e));if(_0x3c754e[_0x02c7('0x17')]){if(_0x3c754e[_0x02c7('0x17')][_0x02c7('0x18')]===0x1f4){logger[_0x02c7('0x17')](_0x02c7('0x12'),_0x571b37,_0x3c754e[_0x02c7('0x17')][_0x02c7('0x19')]);return _0x239577(_0x3c754e[_0x02c7('0x17')]['message']);}logger[_0x02c7('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x571b37,_0x3c754e[_0x02c7('0x17')]['message']);return _0x5117af(_0x3c754e['error'][_0x02c7('0x19')]);}else{logger[_0x02c7('0x11')](_0x02c7('0x12'),_0x571b37,'request\x20sent');_0x5117af(_0x3c754e[_0x02c7('0x1a')][_0x02c7('0x19')]);}})[_0x02c7('0x1b')](function(_0x102dfc){logger[_0x02c7('0x17')](_0x02c7('0x12'),_0x571b37,_0x102dfc);_0x239577(_0x102dfc);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index f5e15bd..6dc8ee7 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 _0x0230=['removeListener','register','openchannelAccount:','remove','update','emit'];(function(_0x38d960,_0x30d068){var _0x3ccad6=function(_0x4d8848){while(--_0x4d8848){_0x38d960['push'](_0x38d960['shift']());}};_0x3ccad6(++_0x30d068);}(_0x0230,0x141));var _0x0023=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x0230[_0x2e4e19];return _0x9ba20b;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x0023('0x0'),_0x0023('0x1')];function createListener(_0x519f88,_0x5a372c){return function(_0x150a76){_0x5a372c[_0x0023('0x2')](_0x519f88,_0x150a76);};}function removeListener(_0x5dd5cf,_0x5502ee){return function(){OpenchannelAccountEvents[_0x0023('0x3')](_0x5dd5cf,_0x5502ee);};}exports[_0x0023('0x4')]=function(_0x173d7a){for(var _0xe52f21=0x0,_0x3ca5f3=events['length'];_0xe52f21<_0x3ca5f3;_0xe52f21++){var _0x269438=events[_0xe52f21];var _0x4bdaaf=createListener(_0x0023('0x5')+_0x269438,_0x173d7a);OpenchannelAccountEvents['on'](_0x269438,_0x4bdaaf);}}; \ No newline at end of file +var _0x68f0=['register','length','openchannelAccount:','remove','update','removeListener'];(function(_0x3ab3a4,_0x3a015f){var _0x9c1628=function(_0x5a73f9){while(--_0x5a73f9){_0x3ab3a4['push'](_0x3ab3a4['shift']());}};_0x9c1628(++_0x3a015f);}(_0x68f0,0x17d));var _0x068f=function(_0x38b634,_0x4948a4){_0x38b634=_0x38b634-0x0;var _0x3b43dc=_0x68f0[_0x38b634];return _0x3b43dc;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x068f('0x0'),_0x068f('0x1')];function createListener(_0x3fd990,_0x14588a){return function(_0x2b1c91){_0x14588a['emit'](_0x3fd990,_0x2b1c91);};}function removeListener(_0x284c8a,_0x34de6c){return function(){OpenchannelAccountEvents[_0x068f('0x2')](_0x284c8a,_0x34de6c);};}exports[_0x068f('0x3')]=function(_0x244bb){for(var _0x3581d6=0x0,_0xfc3439=events[_0x068f('0x4')];_0x3581d6<_0xfc3439;_0x3581d6++){var _0x3075c8=events[_0x3581d6];var _0x1a916b=createListener(_0x068f('0x5')+_0x3075c8,_0x244bb);OpenchannelAccountEvents['on'](_0x3075c8,_0x1a916b);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 896a462..42f1c1d 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 _0x23ed=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x51674a,_0x77ccff){var _0x13fca6=function(_0x3d6c27){while(--_0x3d6c27){_0x51674a['push'](_0x51674a['shift']());}};_0x13fca6(++_0x77ccff);}(_0x23ed,0x145));var _0xd23e=function(_0x2034ed,_0x53681f){_0x2034ed=_0x2034ed-0x0;var _0x40e997=_0x23ed[_0x2034ed];return _0x40e997;};'use strict';var multer=require('multer');var util=require(_0xd23e('0x0'));var path=require(_0xd23e('0x1'));var timeout=require(_0xd23e('0x2'));var express=require(_0xd23e('0x3'));var router=express[_0xd23e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd23e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd23e('0x6'));var controller=require(_0xd23e('0x7'));router[_0xd23e('0x8')]('/',auth[_0xd23e('0x9')](),controller[_0xd23e('0xa')]);router[_0xd23e('0x8')](_0xd23e('0xb'),auth[_0xd23e('0x9')](),controller[_0xd23e('0xc')]);router[_0xd23e('0xd')]('/',auth[_0xd23e('0x9')](),controller[_0xd23e('0xe')]);router[_0xd23e('0xf')](_0xd23e('0xb'),auth[_0xd23e('0x9')](),controller[_0xd23e('0x10')]);router[_0xd23e('0x11')](_0xd23e('0xb'),auth[_0xd23e('0x9')](),controller[_0xd23e('0x12')]);module[_0xd23e('0x13')]=router; \ No newline at end of file +var _0xadab=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','exports','multer','util'];(function(_0x3db23e,_0x5b21f0){var _0x5b24b2=function(_0x191991){while(--_0x191991){_0x3db23e['push'](_0x3db23e['shift']());}};_0x5b24b2(++_0x5b21f0);}(_0xadab,0x1e2));var _0xbada=function(_0x28ab1a,_0x41638e){_0x28ab1a=_0x28ab1a-0x0;var _0x2db742=_0xadab[_0x28ab1a];return _0x2db742;};'use strict';var multer=require(_0xbada('0x0'));var util=require(_0xbada('0x1'));var path=require(_0xbada('0x2'));var timeout=require(_0xbada('0x3'));var express=require(_0xbada('0x4'));var router=express[_0xbada('0x5')]();var fs_extra=require(_0xbada('0x6'));var auth=require(_0xbada('0x7'));var interaction=require(_0xbada('0x8'));var config=require(_0xbada('0x9'));var controller=require(_0xbada('0xa'));router[_0xbada('0xb')]('/',auth[_0xbada('0xc')](),controller[_0xbada('0xd')]);router['get']('/:id',auth[_0xbada('0xc')](),controller[_0xbada('0xe')]);router[_0xbada('0xf')]('/',auth[_0xbada('0xc')](),controller[_0xbada('0x10')]);router['put'](_0xbada('0x11'),auth['isAuthenticated'](),controller[_0xbada('0x12')]);router[_0xbada('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xbada('0x14')]);module[_0xbada('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 7e76b59..ca0846f 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 _0x1bdd=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x2591a9,_0x46863a){var _0x2aba17=function(_0xd28b13){while(--_0xd28b13){_0x2591a9['push'](_0x2591a9['shift']());}};_0x2aba17(++_0x46863a);}(_0x1bdd,0x13d));var _0xd1bd=function(_0x319fc1,_0x29179b){_0x319fc1=_0x319fc1-0x0;var _0xb768af=_0x1bdd[_0x319fc1];return _0xb768af;};'use strict';var Sequelize=require('sequelize');module[_0xd1bd('0x0')]={'priority':{'type':Sequelize[_0xd1bd('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xd1bd('0x2')],'allowNull':![],'defaultValue':_0xd1bd('0x3')},'appdata':{'type':Sequelize[_0xd1bd('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd1bd('0x2')],'defaultValue':_0xd1bd('0x5')}}; \ No newline at end of file +var _0xfb1b=['STRING','TEXT','sequelize','exports'];(function(_0xcca6e4,_0x250b8d){var _0x13ef13=function(_0x2ad989){while(--_0x2ad989){_0xcca6e4['push'](_0xcca6e4['shift']());}};_0x13ef13(++_0x250b8d);}(_0xfb1b,0x6a));var _0xbfb1=function(_0x5adbfe,_0x420fed){_0x5adbfe=_0x5adbfe-0x0;var _0x4ad6d0=_0xfb1b[_0x5adbfe];return _0x4ad6d0;};'use strict';var Sequelize=require(_0xbfb1('0x0'));module[_0xbfb1('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xbfb1('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xbfb1('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 22f938c..05cc628 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 _0x430b=['papaparse','ioredis','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','reject','update','then','destroy','end','name','send','index','OpenchannelApplication','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','length','options','find','create','body','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x430b,0x1c7));var _0xb430=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0x430b[_0x3e69ae];return _0x3d7f42;};'use strict';var emlformat=require(_0xb430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb430('0x1'));var rp=require('request-promise');var moment=require(_0xb430('0x2'));var BPromise=require(_0xb430('0x3'));var Mustache=require(_0xb430('0x4'));var util=require('util');var path=require(_0xb430('0x5'));var sox=require(_0xb430('0x6'));var csv=require(_0xb430('0x7'));var ejs=require(_0xb430('0x8'));var fs=require('fs');var fs_extra=require(_0xb430('0x9'));var _=require('lodash');var squel=require(_0xb430('0xa'));var crypto=require(_0xb430('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb430('0xc'));var toCsv=require(_0xb430('0x7'));var querystring=require(_0xb430('0xd'));var Papa=require(_0xb430('0xe'));var Redis=require(_0xb430('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb430('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb430('0x11'));var licenseUtil=require(_0xb430('0x12'));var db=require(_0xb430('0x13'))['db'];function respondWithStatusCode(_0x263ce0,_0x5ab0dc){_0x5ab0dc=_0x5ab0dc||0xcc;return function(_0xf0a20b){if(_0xf0a20b){return _0x263ce0[_0xb430('0x14')](_0x5ab0dc);}return _0x263ce0[_0xb430('0x15')](_0x5ab0dc)['end']();};}function respondWithResult(_0x7109f2,_0x4ddedf){_0x4ddedf=_0x4ddedf||0xc8;return function(_0x1d2618){if(_0x1d2618){return _0x7109f2[_0xb430('0x15')](_0x4ddedf)[_0xb430('0x16')](_0x1d2618);}};}function respondWithFilteredResult(_0x4888bc,_0x5e9b87){return function(_0x173615){if(_0x173615){var _0x22335e=typeof _0x5e9b87['offset']===_0xb430('0x17')&&typeof _0x5e9b87['limit']===_0xb430('0x17');var _0x4a5019=_0x173615[_0xb430('0x18')];var _0x1ee3eb=_0x22335e?0x0:_0x5e9b87[_0xb430('0x19')];var _0x354497=_0x22335e?_0x173615[_0xb430('0x18')]:_0x5e9b87[_0xb430('0x19')]+_0x5e9b87[_0xb430('0x1a')];var _0x250c4b;if(_0x354497>=_0x4a5019){_0x354497=_0x4a5019;_0x250c4b=0xc8;}else{_0x250c4b=0xce;}_0x4888bc[_0xb430('0x15')](_0x250c4b);return _0x4888bc[_0xb430('0x1b')]('Content-Range',_0x1ee3eb+'-'+_0x354497+'/'+_0x4a5019)['json'](_0x173615);}return null;};}function patchUpdates(_0x8d7a2c){return function(_0x90b92){try{jsonpatch['apply'](_0x90b92,_0x8d7a2c,!![]);}catch(_0x24de11){return BPromise[_0xb430('0x1c')](_0x24de11);}return _0x90b92['save']();};}function saveUpdates(_0x3e4aad,_0x2ca858){return function(_0x8bc4c3){if(_0x8bc4c3){return _0x8bc4c3[_0xb430('0x1d')](_0x3e4aad)[_0xb430('0x1e')](function(_0x3ffd2e){return _0x3ffd2e;});}return null;};}function removeEntity(_0x26e1f5,_0x4a2b48){return function(_0x54c255){if(_0x54c255){return _0x54c255[_0xb430('0x1f')]()[_0xb430('0x1e')](function(){_0x26e1f5[_0xb430('0x15')](0xcc)[_0xb430('0x20')]();});}};}function handleEntityNotFound(_0x1c2023,_0x2eeb9c){return function(_0x359626){if(!_0x359626){_0x1c2023[_0xb430('0x14')](0x194);}return _0x359626;};}function handleError(_0x2444ac,_0x204821){_0x204821=_0x204821||0x1f4;return function(_0x372b19){logger['error'](_0x372b19['stack']);if(_0x372b19[_0xb430('0x21')]){delete _0x372b19['name'];}_0x2444ac['status'](_0x204821)[_0xb430('0x22')](_0x372b19);};}exports[_0xb430('0x23')]=function(_0x2062fd,_0x3d61d5){var _0x2bd0f0={},_0x13f396={},_0x1d0989={'count':0x0,'rows':[]};var _0x134e43=_['map'](db[_0xb430('0x24')]['rawAttributes'],function(_0x1e97f0){return{'name':_0x1e97f0[_0xb430('0x25')],'type':_0x1e97f0[_0xb430('0x26')][_0xb430('0x27')]};});_0x13f396[_0xb430('0x28')]=_['map'](_0x134e43,'name');_0x13f396[_0xb430('0x29')]=_[_0xb430('0x2a')](_0x2062fd[_0xb430('0x29')]);_0x13f396['filters']=_[_0xb430('0x2b')](_0x13f396[_0xb430('0x28')],_0x13f396[_0xb430('0x29')]);_0x2bd0f0['attributes']=_[_0xb430('0x2b')](_0x13f396['model'],qs['fields'](_0x2062fd[_0xb430('0x29')][_0xb430('0x2c')]));_0x2bd0f0[_0xb430('0x2d')]=_0x2bd0f0[_0xb430('0x2d')]['length']?_0x2bd0f0['attributes']:_0x13f396[_0xb430('0x28')];if(!_0x2062fd['query'][_0xb430('0x2e')](_0xb430('0x2f'))){_0x2bd0f0[_0xb430('0x1a')]=qs[_0xb430('0x1a')](_0x2062fd[_0xb430('0x29')]['limit']);_0x2bd0f0[_0xb430('0x19')]=qs['offset'](_0x2062fd[_0xb430('0x29')]['offset']);}_0x2bd0f0[_0xb430('0x30')]=qs[_0xb430('0x31')](_0x2062fd[_0xb430('0x29')][_0xb430('0x31')]);_0x2bd0f0[_0xb430('0x32')]=qs[_0xb430('0x33')](_[_0xb430('0x34')](_0x2062fd['query'],_0x13f396[_0xb430('0x33')]),_0x134e43);if(_0x2062fd['query'][_0xb430('0x35')]){_0x2bd0f0[_0xb430('0x32')]=_[_0xb430('0x36')](_0x2bd0f0[_0xb430('0x32')],{'$or':_['map'](_0x134e43,function(_0x239aba){if(_0x239aba[_0xb430('0x26')]!=='VIRTUAL'){var _0x235bd2={};_0x235bd2[_0x239aba[_0xb430('0x21')]]={'$like':'%'+_0x2062fd[_0xb430('0x29')][_0xb430('0x35')]+'%'};return _0x235bd2;}})});}_0x2bd0f0=_[_0xb430('0x36')]({},_0x2bd0f0,_0x2062fd['options']);var _0x50758e={'where':_0x2bd0f0[_0xb430('0x32')]};return db['OpenchannelApplication'][_0xb430('0x18')](_0x50758e)['then'](function(_0x5140de){_0x1d0989[_0xb430('0x18')]=_0x5140de;if(_0x2062fd[_0xb430('0x29')][_0xb430('0x37')]){_0x2bd0f0[_0xb430('0x38')]=[{'all':!![]}];}return db[_0xb430('0x24')][_0xb430('0x39')](_0x2bd0f0);})['then'](function(_0x5a1784){_0x1d0989[_0xb430('0x3a')]=_0x5a1784;return _0x1d0989;})[_0xb430('0x1e')](respondWithFilteredResult(_0x3d61d5,_0x2bd0f0))[_0xb430('0x3b')](handleError(_0x3d61d5,null));};exports['show']=function(_0x14429a,_0x2959ff){var _0x38d061={'raw':!![],'where':{'id':_0x14429a[_0xb430('0x3c')]['id']}},_0x45855a={};_0x45855a[_0xb430('0x28')]=_['keys'](db[_0xb430('0x24')][_0xb430('0x3d')]);_0x45855a[_0xb430('0x29')]=_[_0xb430('0x2a')](_0x14429a[_0xb430('0x29')]);_0x45855a[_0xb430('0x33')]=_[_0xb430('0x2b')](_0x45855a[_0xb430('0x28')],_0x45855a[_0xb430('0x29')]);_0x38d061[_0xb430('0x2d')]=_['intersection'](_0x45855a[_0xb430('0x28')],qs['fields'](_0x14429a[_0xb430('0x29')][_0xb430('0x2c')]));_0x38d061[_0xb430('0x2d')]=_0x38d061['attributes'][_0xb430('0x3e')]?_0x38d061[_0xb430('0x2d')]:_0x45855a[_0xb430('0x28')];if(_0x14429a[_0xb430('0x29')][_0xb430('0x37')]){_0x38d061['include']=[{'all':!![]}];}_0x38d061=_[_0xb430('0x36')]({},_0x38d061,_0x14429a[_0xb430('0x3f')]);return db[_0xb430('0x24')][_0xb430('0x40')](_0x38d061)[_0xb430('0x1e')](handleEntityNotFound(_0x2959ff,null))['then'](respondWithResult(_0x2959ff,null))[_0xb430('0x3b')](handleError(_0x2959ff,null));};exports[_0xb430('0x41')]=function(_0x506e75,_0x2af062){return db['OpenchannelApplication'][_0xb430('0x41')](_0x506e75['body'],{})[_0xb430('0x1e')](respondWithResult(_0x2af062,0xc9))['catch'](handleError(_0x2af062,null));};exports[_0xb430('0x1d')]=function(_0x43622b,_0x263b8c){if(_0x43622b['body']['id']){delete _0x43622b[_0xb430('0x42')]['id'];}return db[_0xb430('0x24')][_0xb430('0x40')]({'where':{'id':_0x43622b[_0xb430('0x3c')]['id']}})['then'](handleEntityNotFound(_0x263b8c,null))[_0xb430('0x1e')](saveUpdates(_0x43622b[_0xb430('0x42')],null))[_0xb430('0x1e')](respondWithResult(_0x263b8c,null))[_0xb430('0x3b')](handleError(_0x263b8c,null));};exports[_0xb430('0x1f')]=function(_0x1c070f,_0x2f00b){return db[_0xb430('0x24')][_0xb430('0x40')]({'where':{'id':_0x1c070f[_0xb430('0x3c')]['id']}})[_0xb430('0x1e')](handleEntityNotFound(_0x2f00b,null))[_0xb430('0x1e')](removeEntity(_0x2f00b,null))[_0xb430('0x3b')](handleError(_0x2f00b,null));}; \ No newline at end of file +var _0xb082=['../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','sendStatus','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','OpenchannelApplication','includeAll','include','findAll','catch','params','keys','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x4b784d,_0x5efb2f){var _0x2cdeaf=function(_0x106242){while(--_0x106242){_0x4b784d['push'](_0x4b784d['shift']());}};_0x2cdeaf(++_0x5efb2f);}(_0xb082,0x1b5));var _0x2b08=function(_0x2f8a69,_0x39cf08){_0x2f8a69=_0x2f8a69-0x0;var _0x21c719=_0xb082[_0x2f8a69];return _0x21c719;};'use strict';var emlformat=require(_0x2b08('0x0'));var rimraf=require(_0x2b08('0x1'));var zipdir=require(_0x2b08('0x2'));var jsonpatch=require(_0x2b08('0x3'));var rp=require(_0x2b08('0x4'));var moment=require(_0x2b08('0x5'));var BPromise=require(_0x2b08('0x6'));var Mustache=require(_0x2b08('0x7'));var util=require(_0x2b08('0x8'));var path=require(_0x2b08('0x9'));var sox=require(_0x2b08('0xa'));var csv=require(_0x2b08('0xb'));var ejs=require(_0x2b08('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b08('0xd'));var squel=require(_0x2b08('0xe'));var crypto=require('crypto');var jsforce=require(_0x2b08('0xf'));var deskjs=require(_0x2b08('0x10'));var toCsv=require(_0x2b08('0xb'));var querystring=require(_0x2b08('0x11'));var Papa=require(_0x2b08('0x12'));var Redis=require(_0x2b08('0x13'));var authService=require(_0x2b08('0x14'));var qs=require(_0x2b08('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b08('0x16'))(_0x2b08('0x17'));var utils=require(_0x2b08('0x18'));var config=require(_0x2b08('0x19'));var licenseUtil=require(_0x2b08('0x1a'));var db=require(_0x2b08('0x1b'))['db'];function respondWithStatusCode(_0x8760e0,_0xa19bc0){_0xa19bc0=_0xa19bc0||0xcc;return function(_0x49a322){if(_0x49a322){return _0x8760e0['sendStatus'](_0xa19bc0);}return _0x8760e0['status'](_0xa19bc0)[_0x2b08('0x1c')]();};}function respondWithResult(_0x7117a5,_0xd10156){_0xd10156=_0xd10156||0xc8;return function(_0x5b900f){if(_0x5b900f){return _0x7117a5[_0x2b08('0x1d')](_0xd10156)[_0x2b08('0x1e')](_0x5b900f);}};}function respondWithFilteredResult(_0x1b732f,_0x302bbf){return function(_0x47202d){if(_0x47202d){var _0x42952b=typeof _0x302bbf[_0x2b08('0x1f')]===_0x2b08('0x20')&&typeof _0x302bbf[_0x2b08('0x21')]===_0x2b08('0x20');var _0x2bcd4e=_0x47202d[_0x2b08('0x22')];var _0x1f4c6d=_0x42952b?0x0:_0x302bbf[_0x2b08('0x1f')];var _0x9a0a29=_0x42952b?_0x47202d['count']:_0x302bbf['offset']+_0x302bbf[_0x2b08('0x21')];var _0x36bf4b;if(_0x9a0a29>=_0x2bcd4e){_0x9a0a29=_0x2bcd4e;_0x36bf4b=0xc8;}else{_0x36bf4b=0xce;}_0x1b732f[_0x2b08('0x1d')](_0x36bf4b);return _0x1b732f[_0x2b08('0x23')](_0x2b08('0x24'),_0x1f4c6d+'-'+_0x9a0a29+'/'+_0x2bcd4e)[_0x2b08('0x1e')](_0x47202d);}return null;};}function patchUpdates(_0x7512b){return function(_0x4eb282){try{jsonpatch['apply'](_0x4eb282,_0x7512b,!![]);}catch(_0x276fc4){return BPromise[_0x2b08('0x25')](_0x276fc4);}return _0x4eb282[_0x2b08('0x26')]();};}function saveUpdates(_0x160f39,_0x2545cb){return function(_0x117178){if(_0x117178){return _0x117178['update'](_0x160f39)[_0x2b08('0x27')](function(_0x303212){return _0x303212;});}return null;};}function removeEntity(_0x3fb4c7,_0x55e524){return function(_0x35fcda){if(_0x35fcda){return _0x35fcda[_0x2b08('0x28')]()['then'](function(){_0x3fb4c7[_0x2b08('0x1d')](0xcc)[_0x2b08('0x1c')]();});}};}function handleEntityNotFound(_0x42e806,_0xcc4a59){return function(_0x43d06d){if(!_0x43d06d){_0x42e806[_0x2b08('0x29')](0x194);}return _0x43d06d;};}function handleError(_0x180471,_0x377208){_0x377208=_0x377208||0x1f4;return function(_0x1e73f0){logger['error'](_0x1e73f0[_0x2b08('0x2a')]);if(_0x1e73f0[_0x2b08('0x2b')]){delete _0x1e73f0[_0x2b08('0x2b')];}_0x180471[_0x2b08('0x1d')](_0x377208)[_0x2b08('0x2c')](_0x1e73f0);};}exports[_0x2b08('0x2d')]=function(_0x3b2656,_0x391a00){var _0x2518e3={},_0x337827={},_0x27c23c={'count':0x0,'rows':[]};var _0x2e8012=_[_0x2b08('0x2e')](db['OpenchannelApplication']['rawAttributes'],function(_0x2340ac){return{'name':_0x2340ac[_0x2b08('0x2f')],'type':_0x2340ac['type'][_0x2b08('0x30')]};});_0x337827[_0x2b08('0x31')]=_[_0x2b08('0x2e')](_0x2e8012,_0x2b08('0x2b'));_0x337827[_0x2b08('0x32')]=_['keys'](_0x3b2656[_0x2b08('0x32')]);_0x337827[_0x2b08('0x33')]=_[_0x2b08('0x34')](_0x337827['model'],_0x337827[_0x2b08('0x32')]);_0x2518e3[_0x2b08('0x35')]=_[_0x2b08('0x34')](_0x337827['model'],qs[_0x2b08('0x36')](_0x3b2656[_0x2b08('0x32')][_0x2b08('0x36')]));_0x2518e3[_0x2b08('0x35')]=_0x2518e3['attributes'][_0x2b08('0x37')]?_0x2518e3[_0x2b08('0x35')]:_0x337827['model'];if(!_0x3b2656[_0x2b08('0x32')][_0x2b08('0x38')](_0x2b08('0x39'))){_0x2518e3[_0x2b08('0x21')]=qs[_0x2b08('0x21')](_0x3b2656[_0x2b08('0x32')]['limit']);_0x2518e3[_0x2b08('0x1f')]=qs[_0x2b08('0x1f')](_0x3b2656[_0x2b08('0x32')][_0x2b08('0x1f')]);}_0x2518e3['order']=qs['sort'](_0x3b2656[_0x2b08('0x32')][_0x2b08('0x3a')]);_0x2518e3[_0x2b08('0x3b')]=qs[_0x2b08('0x33')](_[_0x2b08('0x3c')](_0x3b2656[_0x2b08('0x32')],_0x337827[_0x2b08('0x33')]),_0x2e8012);if(_0x3b2656[_0x2b08('0x32')][_0x2b08('0x3d')]){_0x2518e3[_0x2b08('0x3b')]=_[_0x2b08('0x3e')](_0x2518e3[_0x2b08('0x3b')],{'$or':_[_0x2b08('0x2e')](_0x2e8012,function(_0xe82288){if(_0xe82288[_0x2b08('0x3f')]!==_0x2b08('0x40')){var _0x30ea21={};_0x30ea21[_0xe82288['name']]={'$like':'%'+_0x3b2656[_0x2b08('0x32')]['filter']+'%'};return _0x30ea21;}})});}_0x2518e3=_[_0x2b08('0x3e')]({},_0x2518e3,_0x3b2656[_0x2b08('0x41')]);var _0x4ad85a={'where':_0x2518e3[_0x2b08('0x3b')]};return db[_0x2b08('0x42')][_0x2b08('0x22')](_0x4ad85a)['then'](function(_0x3f2fdb){_0x27c23c[_0x2b08('0x22')]=_0x3f2fdb;if(_0x3b2656[_0x2b08('0x32')][_0x2b08('0x43')]){_0x2518e3[_0x2b08('0x44')]=[{'all':!![]}];}return db[_0x2b08('0x42')][_0x2b08('0x45')](_0x2518e3);})[_0x2b08('0x27')](function(_0x4ee889){_0x27c23c['rows']=_0x4ee889;return _0x27c23c;})[_0x2b08('0x27')](respondWithFilteredResult(_0x391a00,_0x2518e3))[_0x2b08('0x46')](handleError(_0x391a00,null));};exports['show']=function(_0x51f894,_0x3c691b){var _0x100507={'raw':!![],'where':{'id':_0x51f894[_0x2b08('0x47')]['id']}},_0x52298f={};_0x52298f['model']=_[_0x2b08('0x48')](db[_0x2b08('0x42')]['rawAttributes']);_0x52298f[_0x2b08('0x32')]=_[_0x2b08('0x48')](_0x51f894[_0x2b08('0x32')]);_0x52298f[_0x2b08('0x33')]=_[_0x2b08('0x34')](_0x52298f[_0x2b08('0x31')],_0x52298f[_0x2b08('0x32')]);_0x100507[_0x2b08('0x35')]=_[_0x2b08('0x34')](_0x52298f['model'],qs[_0x2b08('0x36')](_0x51f894['query'][_0x2b08('0x36')]));_0x100507[_0x2b08('0x35')]=_0x100507['attributes']['length']?_0x100507['attributes']:_0x52298f['model'];if(_0x51f894['query'][_0x2b08('0x43')]){_0x100507[_0x2b08('0x44')]=[{'all':!![]}];}_0x100507=_[_0x2b08('0x3e')]({},_0x100507,_0x51f894[_0x2b08('0x41')]);return db[_0x2b08('0x42')][_0x2b08('0x49')](_0x100507)[_0x2b08('0x27')](handleEntityNotFound(_0x3c691b,null))['then'](respondWithResult(_0x3c691b,null))[_0x2b08('0x46')](handleError(_0x3c691b,null));};exports[_0x2b08('0x4a')]=function(_0x267299,_0x5e575f){return db[_0x2b08('0x42')]['create'](_0x267299[_0x2b08('0x4b')],{})['then'](respondWithResult(_0x5e575f,0xc9))[_0x2b08('0x46')](handleError(_0x5e575f,null));};exports[_0x2b08('0x4c')]=function(_0x371fd0,_0x5b0622){if(_0x371fd0[_0x2b08('0x4b')]['id']){delete _0x371fd0[_0x2b08('0x4b')]['id'];}return db[_0x2b08('0x42')][_0x2b08('0x49')]({'where':{'id':_0x371fd0['params']['id']}})[_0x2b08('0x27')](handleEntityNotFound(_0x5b0622,null))['then'](saveUpdates(_0x371fd0[_0x2b08('0x4b')],null))[_0x2b08('0x27')](respondWithResult(_0x5b0622,null))['catch'](handleError(_0x5b0622,null));};exports['destroy']=function(_0x1f74f7,_0x544e71){return db[_0x2b08('0x42')]['find']({'where':{'id':_0x1f74f7[_0x2b08('0x47')]['id']}})['then'](handleEntityNotFound(_0x544e71,null))['then'](removeEntity(_0x544e71,null))[_0x2b08('0x46')](handleError(_0x544e71,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 3a20397..984c3b7 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 _0xd6ed=['lodash','api','bluebird','path','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xd6ed,0xc6));var _0xdd6e=function(_0xb05fd2,_0x3b9374){_0xb05fd2=_0xb05fd2-0x0;var _0x443304=_0xd6ed[_0xb05fd2];return _0x443304;};'use strict';var _=require(_0xdd6e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdd6e('0x1'));var moment=require('moment');var BPromise=require(_0xdd6e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd6e('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0xdd6e('0x4')]=function(_0x8aaeb0,_0x5928a8){return _0x8aaeb0[_0xdd6e('0x5')](_0xdd6e('0x6'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdd6e('0x7'),'collate':_0xdd6e('0x8')});}; \ No newline at end of file +var _0x2a4c=['exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes'];(function(_0x27c7fc,_0x57482b){var _0x5ef296=function(_0x105018){while(--_0x105018){_0x27c7fc['push'](_0x27c7fc['shift']());}};_0x5ef296(++_0x57482b);}(_0x2a4c,0x122));var _0xc2a4=function(_0x56d9d7,_0x41a050){_0x56d9d7=_0x56d9d7-0x0;var _0x1ff945=_0x2a4c[_0x56d9d7];return _0x1ff945;};'use strict';var _=require(_0xc2a4('0x0'));var util=require(_0xc2a4('0x1'));var logger=require(_0xc2a4('0x2'))(_0xc2a4('0x3'));var moment=require(_0xc2a4('0x4'));var BPromise=require(_0xc2a4('0x5'));var rp=require(_0xc2a4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc2a4('0x7'));var config=require(_0xc2a4('0x8'));var attributes=require(_0xc2a4('0x9'));module[_0xc2a4('0xa')]=function(_0xf39a3f,_0x22c3cf){return _0xf39a3f[_0xc2a4('0xb')]('OpenchannelApplication',attributes,{'tableName':_0xc2a4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc2a4('0xd'),'collate':_0xc2a4('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 1fbcf9f..b9df7f6 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 _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x5b51d2,_0xd3846c){var _0x1ecc32=function(_0x26c8a1){while(--_0x26c8a1){_0x5b51d2['push'](_0x5b51d2['shift']());}};_0x1ecc32(++_0xd3846c);}(_0xb10b,0x12a));var _0xbb10=function(_0x45f4e9,_0x5246fd){_0x45f4e9=_0x45f4e9-0x0;var _0x559d8f=_0xb10b[_0x45f4e9];return _0x559d8f;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0x128bef,_0xc7a0af){var _0x1ba862=function(_0x4858e8){while(--_0x4858e8){_0x128bef['push'](_0x128bef['shift']());}};_0x1ba862(++_0xc7a0af);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var 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')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 201e39e..6b5cd98 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 _0xa9e0=['tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','show','/:id/messages','isAuthenticated','getMessages','create','post','addMessage','/:id/tags'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x10')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['post'](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x15')),controller[_0x0a9e('0x16')]);router['put'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')]('openchannel',_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router['delete'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x1a')),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1c')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);module[_0x0a9e('0x1e')]=router; \ No newline at end of file +var _0xa9e0=['tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','show','/:id/messages','isAuthenticated','getMessages','create','post','addMessage','/:id/tags'];(function(_0x335271,_0x5025f2){var _0xa9fff8=function(_0x28d0bd){while(--_0x28d0bd){_0x335271['push'](_0x335271['shift']());}};_0xa9fff8(++_0x5025f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x10')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['post'](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x15')),controller[_0x0a9e('0x16')]);router['put'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')]('openchannel',_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router['delete'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x1a')),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1c')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);module[_0x0a9e('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 838a934..f9dd508 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 _0x68c5=['sequelize','BOOLEAN','DATE','STRING','ENUM'];(function(_0x272706,_0x54e662){var _0x5d841a=function(_0x56f7c6){while(--_0x56f7c6){_0x272706['push'](_0x272706['shift']());}};_0x5d841a(++_0x54e662);}(_0x68c5,0x136));var _0x568c=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x68c5[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0x568c('0x0'));module['exports']={'closed':{'type':Sequelize[_0x568c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x568c('0x2')]},'disposition':{'type':Sequelize[_0x568c('0x3')]},'secondDisposition':{'type':Sequelize[_0x568c('0x3')]},'thirdDisposition':{'type':Sequelize[_0x568c('0x3')]},'note':{'type':Sequelize[_0x568c('0x3')]},'read1stAt':{'type':Sequelize[_0x568c('0x2')]},'threadId':{'type':Sequelize[_0x568c('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x568c('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x568c('0x3')]}}; \ No newline at end of file +var _0x2b2d=['ENUM','out','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0x5527b4,_0x4d9c93){var _0x2101da=function(_0x1b9067){while(--_0x1b9067){_0x5527b4['push'](_0x5527b4['shift']());}};_0x2101da(++_0x4d9c93);}(_0x2b2d,0x1ad));var _0xd2b2=function(_0x3b9bb7,_0x4e24df){_0x3b9bb7=_0x3b9bb7-0x0;var _0x4c0b9e=_0x2b2d[_0x3b9bb7];return _0x4c0b9e;};'use strict';var Sequelize=require(_0xd2b2('0x0'));module[_0xd2b2('0x1')]={'closed':{'type':Sequelize[_0xd2b2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xd2b2('0x3')]},'secondDisposition':{'type':Sequelize[_0xd2b2('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd2b2('0x3')]},'note':{'type':Sequelize[_0xd2b2('0x3')]},'read1stAt':{'type':Sequelize[_0xd2b2('0x4')]},'threadId':{'type':Sequelize[_0xd2b2('0x3')]},'externalUrl':{'type':Sequelize[_0xd2b2('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xd2b2('0x5')]('in',_0xd2b2('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xd2b2('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 3733179..ff81a03 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 _0x2ca9=['ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','start','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','user','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','rows','show','params','rawAttributes','includeAll','options','create','body','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','CmContact','Contact','lastName','Attachment','Messages','createdAt','direction','OpenchannelAccount','Account','Owner','get','closedAt','disposition','Public','Private','existsSync','pipe','createWriteStream','out','System','firstName','views','downloadInteraction.html','transcript-','Openchannel','createPdfFromHTML','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','push','catch','index','OpenchannelInteraction','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','having','`\x20=\x200','`\x20>\x200','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find'];(function(_0x37bcf9,_0x4d1a77){var _0x5049d3=function(_0x1a14c7){while(--_0x1a14c7){_0x37bcf9['push'](_0x37bcf9['shift']());}};_0x5049d3(++_0x4d1a77);}(_0x2ca9,0x179));var _0x92ca=function(_0x61d30c,_0x56ce4a){_0x61d30c=_0x61d30c-0x0;var _0x3e981d=_0x2ca9[_0x61d30c];return _0x3e981d;};'use strict';var emlformat=require(_0x92ca('0x0'));var rimraf=require(_0x92ca('0x1'));var zipdir=require(_0x92ca('0x2'));var jsonpatch=require(_0x92ca('0x3'));var rp=require(_0x92ca('0x4'));var moment=require('moment');var BPromise=require(_0x92ca('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x92ca('0x6'));var sox=require(_0x92ca('0x7'));var csv=require(_0x92ca('0x8'));var ejs=require(_0x92ca('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x92ca('0xa'));var squel=require(_0x92ca('0xb'));var crypto=require(_0x92ca('0xc'));var jsforce=require(_0x92ca('0xd'));var deskjs=require(_0x92ca('0xe'));var toCsv=require('to-csv');var querystring=require(_0x92ca('0xf'));var Papa=require(_0x92ca('0x10'));var Redis=require(_0x92ca('0x11'));var authService=require(_0x92ca('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x92ca('0x13'));var pdf=require(_0x92ca('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x92ca('0x15'))('api');var utils=require(_0x92ca('0x16'));var config=require(_0x92ca('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x92ca('0x18'))['db'];config[_0x92ca('0x19')]=_[_0x92ca('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x92ca('0x1b'))(new Redis(config['redis']));require(_0x92ca('0x1c'))['register'](socket);function respondWithStatusCode(_0x5e8b68,_0x1cb038){_0x1cb038=_0x1cb038||0xcc;return function(_0x4b8a64){if(_0x4b8a64){return _0x5e8b68['sendStatus'](_0x1cb038);}return _0x5e8b68[_0x92ca('0x1d')](_0x1cb038)[_0x92ca('0x1e')]();};}function respondWithResult(_0x3f05b4,_0x1cc6b5){_0x1cc6b5=_0x1cc6b5||0xc8;return function(_0x17b615){if(_0x17b615){return _0x3f05b4['status'](_0x1cc6b5)[_0x92ca('0x1f')](_0x17b615);}};}function respondWithFilteredResult(_0x40578f,_0xc502e5){return function(_0x478021){if(_0x478021){var _0x4819bc=typeof _0xc502e5[_0x92ca('0x20')]===_0x92ca('0x21')&&typeof _0xc502e5[_0x92ca('0x22')]===_0x92ca('0x21');var _0x5c57db=_0x478021[_0x92ca('0x23')];var _0x342888=_0x4819bc?0x0:_0xc502e5[_0x92ca('0x20')];var _0x5be053=_0x4819bc?_0x478021[_0x92ca('0x23')]:_0xc502e5[_0x92ca('0x20')]+_0xc502e5['limit'];var _0x3ee26f;if(_0x5be053>=_0x5c57db){_0x5be053=_0x5c57db;_0x3ee26f=0xc8;}else{_0x3ee26f=0xce;}_0x40578f['status'](_0x3ee26f);return _0x40578f[_0x92ca('0x24')](_0x92ca('0x25'),_0x342888+'-'+_0x5be053+'/'+_0x5c57db)[_0x92ca('0x1f')](_0x478021);}return null;};}function patchUpdates(_0xf3bc99){return function(_0x19fc98){try{jsonpatch[_0x92ca('0x26')](_0x19fc98,_0xf3bc99,!![]);}catch(_0xbfc7aa){return BPromise['reject'](_0xbfc7aa);}return _0x19fc98[_0x92ca('0x27')]();};}function saveUpdates(_0x340605,_0x316a5f){return function(_0x326d03){if(_0x326d03){return _0x326d03[_0x92ca('0x28')](_0x340605)[_0x92ca('0x29')](function(_0x2d1924){return _0x2d1924;});}return null;};}function removeEntity(_0xc73869,_0x5b7d52){return function(_0x5328a4){if(_0x5328a4){return _0x5328a4[_0x92ca('0x2a')]()['then'](function(){_0xc73869[_0x92ca('0x1d')](0xcc)[_0x92ca('0x1e')]();});}};}function handleEntityNotFound(_0x4fbbae,_0x53b1ec){return function(_0x3eeec9){if(!_0x3eeec9){_0x4fbbae[_0x92ca('0x2b')](0x194);}return _0x3eeec9;};}function handleError(_0x2f15a9,_0xd3ef52){_0xd3ef52=_0xd3ef52||0x1f4;return function(_0x3f3160){logger[_0x92ca('0x2c')](_0x3f3160[_0x92ca('0x2d')]);if(_0x3f3160[_0x92ca('0x2e')]){delete _0x3f3160[_0x92ca('0x2e')];}_0x2f15a9[_0x92ca('0x1d')](_0xd3ef52)[_0x92ca('0x2f')](_0x3f3160);};}function getInteractionUsers(_0x207148,_0x3f2b02){return new BPromise(function(_0x2954bd,_0x39c2f8){try{if(_0x3f2b02[_0x207148['id']]){_0x207148[_0x92ca('0x30')]=_[_0x92ca('0x31')](_0x3f2b02[_0x207148['id']],function(_0x3ad1e3){return{'id':_0x3ad1e3['id'],'fullname':_0x3ad1e3[_0x92ca('0x32')]};});}}catch(_0x4e0cf5){_0x39c2f8(_0x4e0cf5);}_0x2954bd(_0x207148);});}function getInteractionTags(_0x5aa557,_0x29bb55){return new BPromise(function(_0x190a08,_0x1bcfe4){try{if(_0x5aa557[_0x92ca('0x33')]){_0x5aa557['Tags']=[];_0x5aa557[_0x92ca('0x33')][_0x92ca('0x34')](',')[_0x92ca('0x35')](function(_0x149658){_0x5aa557['Tags'][_0x92ca('0x36')](_0x29bb55[_0x149658]);});}delete _0x5aa557[_0x92ca('0x33')];}catch(_0x51c5f0){_0x1bcfe4(_0x51c5f0);}_0x190a08(_0x5aa557);});}function updateOpenchannelInteraction(_0x246fa7,_0x33e20b,_0x4ca1e0){return new BPromise(function(_0x620ad6,_0x4b01d1){return getInteractionUsers(_0x246fa7,_0x4ca1e0)[_0x92ca('0x29')](function(_0x2be870){return getInteractionTags(_0x2be870,_0x33e20b);})[_0x92ca('0x29')](function(_0x3ecfbb){_0x620ad6(_0x3ecfbb);})[_0x92ca('0x37')](function(_0x45a151){_0x4b01d1(_0x45a151);});});}exports[_0x92ca('0x38')]=function(_0x4323f4,_0xdb6071){var _0x215b83={},_0x6cc336={},_0x540742={'count':0x0,'rows':[]};var _0x4c4dda=_[_0x92ca('0x31')](db[_0x92ca('0x39')]['rawAttributes'],function(_0x171336){return{'name':_0x171336[_0x92ca('0x3a')],'type':_0x171336[_0x92ca('0x3b')][_0x92ca('0x3c')]};});_0x6cc336[_0x92ca('0x3d')]=_[_0x92ca('0x31')](_0x4c4dda,'name');_0x6cc336[_0x92ca('0x3e')]=_[_0x92ca('0x3f')](_0x4323f4[_0x92ca('0x3e')]);_0x6cc336[_0x92ca('0x40')]=_['intersection'](_0x6cc336[_0x92ca('0x3d')],_0x6cc336[_0x92ca('0x3e')]);_0x215b83[_0x92ca('0x41')]=_[_0x92ca('0x42')](_0x6cc336['model'],qs[_0x92ca('0x43')](_0x4323f4[_0x92ca('0x3e')][_0x92ca('0x43')]));_0x215b83[_0x92ca('0x41')]=_0x215b83[_0x92ca('0x41')][_0x92ca('0x44')]?_0x215b83[_0x92ca('0x41')]:_0x6cc336[_0x92ca('0x3d')];if(!_0x4323f4['query'][_0x92ca('0x45')](_0x92ca('0x46'))){_0x215b83[_0x92ca('0x22')]=qs[_0x92ca('0x22')](_0x4323f4[_0x92ca('0x3e')][_0x92ca('0x22')]);_0x215b83[_0x92ca('0x20')]=qs[_0x92ca('0x20')](_0x4323f4[_0x92ca('0x3e')][_0x92ca('0x20')]);}_0x215b83[_0x92ca('0x47')]=qs[_0x92ca('0x48')](_0x4323f4[_0x92ca('0x3e')][_0x92ca('0x48')]);_0x215b83[_0x92ca('0x49')]=qs[_0x92ca('0x40')](_[_0x92ca('0x4a')](_0x4323f4['query'],_0x6cc336[_0x92ca('0x40')]),_0x4c4dda);var _0x4dbc22=[];var _0x1f2bd4=squel[_0x92ca('0x4b')]()['field']('id')[_0x92ca('0x4c')](_0x92ca('0x2e'))[_0x92ca('0x4c')](_0x92ca('0x4d'))[_0x92ca('0x4e')](_0x92ca('0x4f'));var _0x2e1ff1=squel[_0x92ca('0x4b')]()[_0x92ca('0x4c')]('u.id')['field'](_0x92ca('0x50'))[_0x92ca('0x4c')](_0x92ca('0x51'))['from'](_0x92ca('0x52'),'ui')[_0x92ca('0x53')](_0x92ca('0x54'),'u',_0x92ca('0x55'));var _0x810ffc=squel[_0x92ca('0x4b')]()['from'](_0x92ca('0x56'),'i')['left_join'](_0x92ca('0x57'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x92ca('0x54'),'o',_0x92ca('0x58'))[_0x92ca('0x53')](_0x92ca('0x59'),'a',_0x92ca('0x5a'))['left_join'](_0x92ca('0x5b'),'me',_0x92ca('0x5c'))[_0x92ca('0x53')](_0x92ca('0x5d'),'it',_0x92ca('0x5e'))[_0x92ca('0x53')]('tools_tags','t',_0x92ca('0x5f'));var _0x3f6be4=squel[_0x92ca('0x60')]();var _0x333bfe=[];var _0x7936b0=squel[_0x92ca('0x60')]();var _0x240e11;if(_0x4323f4[_0x92ca('0x3e')][_0x92ca('0x61')]){_0x240e11=as[_0x92ca('0x62')](_0x4323f4[_0x92ca('0x3e')][_0x92ca('0x61')]);var _0x286e44=_0x240e11[_0x92ca('0x63')];for(var _0x332da5=0x0;_0x332da5<_0x240e11[_0x92ca('0x64')][_0x92ca('0x44')];_0x332da5++){var _0x522f62=_0x240e11['conditions'][_0x332da5];var _0xb5798b='i';var _0x32d8ef=_['find'](_0x4c4dda,[_0x92ca('0x2e'),_0x522f62['field']]);if(!_0x32d8ef){switch(_0x522f62[_0x92ca('0x4c')]){case'unreadMessages':if(_0x522f62['value']==0x1){_0x810ffc[_0x92ca('0x65')]('`'+_0x522f62[_0x92ca('0x4c')]+_0x92ca('0x66'));}else{_0x810ffc[_0x92ca('0x65')]('`'+_0x522f62[_0x92ca('0x4c')]+_0x92ca('0x67'));}break;case'Contact':if(_0x522f62[_0x92ca('0x68')]===_0x92ca('0x69')){if(_0x522f62[_0x92ca('0x6a')][_0x92ca('0x34')]('\x20')[_0x92ca('0x44')]>0x1){_0x3f6be4[_0x286e44](_0x92ca('0x6b'),qs[_0x92ca('0x6c')](_0x522f62[_0x92ca('0x6a')]),null);}else{var _0x25edd8='%'+_0x522f62[_0x92ca('0x6a')]+'%';_0x3f6be4[_0x286e44](_0x92ca('0x6d'),_0x25edd8,_0x25edd8,_0x25edd8);}}else{_0x32d8ef=_[_0x92ca('0x6e')](_0x4c4dda,[_0x92ca('0x2e'),_0x92ca('0x6f')]);_0x522f62['field']=_0x92ca('0x6f');_0xd38f6a=as[_0x92ca('0x70')](_0xb5798b,_0x32d8ef[_0x92ca('0x3b')],_0x522f62);_0x3f6be4[_0x286e44](_0xd38f6a[_0x92ca('0x71')],_0xd38f6a[_0x92ca('0x6a')]['start'],_0xd38f6a[_0x92ca('0x6a')][_0x92ca('0x1e')]);}break;case _0x92ca('0x72'):var _0x1b1aab=_0x522f62[_0x92ca('0x6a')][_0x92ca('0x34')](',')[_0x92ca('0x31')](function(_0x579ee9){return Number(_0x579ee9);});_0x1b1aab[_0x92ca('0x35')](function(_0x5f2a04){_0x7936b0['or'](_0x92ca('0x73'),'%,'+_0x5f2a04+',%');});_0x333bfe=_[_0x92ca('0x74')](_0x333bfe,_0x1b1aab);break;case _0x92ca('0x75'):if(_0x522f62[_0x92ca('0x68')]==='$substring'){_0x3f6be4[_0x286e44]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x522f62[_0x92ca('0x6a')]+'%',null);}else{_0x32d8ef=_[_0x92ca('0x6e')](_0x4c4dda,['name',_0x92ca('0x76')]);_0x522f62[_0x92ca('0x4c')]=_0x92ca('0x76');_0xd38f6a=as[_0x92ca('0x70')](_0xb5798b,_0x32d8ef[_0x92ca('0x3b')],_0x522f62);_0x3f6be4[_0x286e44](_0xd38f6a[_0x92ca('0x71')],_0xd38f6a['value'][_0x92ca('0x77')],_0xd38f6a[_0x92ca('0x6a')][_0x92ca('0x1e')]);}break;case'body':_0xd38f6a=as[_0x92ca('0x70')]('me',null,_0x522f62);_0x3f6be4[_0x286e44](_0xd38f6a[_0x92ca('0x71')],_0xd38f6a[_0x92ca('0x6a')][_0x92ca('0x77')],_0xd38f6a['value'][_0x92ca('0x1e')]);break;}}else{var _0xd38f6a=as[_0x92ca('0x70')](_0xb5798b,_0x32d8ef[_0x92ca('0x3b')],_0x522f62);_0x3f6be4[_0x286e44](_0xd38f6a[_0x92ca('0x71')],_0xd38f6a[_0x92ca('0x6a')][_0x92ca('0x77')],_0xd38f6a[_0x92ca('0x6a')]['end']);}}}else{var _0x40b946=_(_0x4323f4['query'])[_0x92ca('0x3f')]()[_0x92ca('0x31')](function(_0x5c65d9){return _['some'](_0x4c4dda,[_0x92ca('0x2e'),_0x5c65d9])?_0x5c65d9:undefined;})['compact']()[_0x92ca('0x6a')]();if(!_[_0x92ca('0x78')](_0x40b946)){_0x40b946[_0x92ca('0x35')](function(_0x4d0d5d){if(_0x4d0d5d===_0x92ca('0x79')){_0x810ffc[_0x92ca('0x49')](_0x92ca('0x7a'),[]['concat'](_0x4323f4[_0x92ca('0x3e')][_0x4d0d5d]));}else if(_0x4d0d5d==='createdAt'){var _0x47c90c=JSON[_0x92ca('0x7b')](_0x4323f4[_0x92ca('0x3e')][_0x4d0d5d])[_0x92ca('0x7c')];var _0x10a81d=JSON[_0x92ca('0x7b')](_0x4323f4['query'][_0x4d0d5d])[_0x92ca('0x7d')];_0x810ffc[_0x92ca('0x49')](_0x92ca('0x7e'),_0x47c90c,_0x10a81d);}else{if(_0x4323f4[_0x92ca('0x3e')][_0x4d0d5d]===_0x92ca('0x7f')){_0x810ffc[_0x92ca('0x49')]('i.'+_0x4d0d5d+_0x92ca('0x80'));}else{_0x810ffc['where']('i.'+_0x4d0d5d+_0x92ca('0x81'),_0x4323f4[_0x92ca('0x3e')][_0x4d0d5d]);}}});}if(_0x4323f4[_0x92ca('0x3e')][_0x92ca('0x82')]){if(_0x4323f4[_0x92ca('0x3e')][_0x92ca('0x82')]==0x1){_0x810ffc['having']('`unreadMessages`\x20=\x200');}else{_0x810ffc[_0x92ca('0x65')](_0x92ca('0x83'));}}if(_0x4323f4[_0x92ca('0x3e')][_0x92ca('0x84')]){_0x333bfe=_[_0x92ca('0x85')](_0x4323f4[_0x92ca('0x3e')][_0x92ca('0x84')])?_0x4323f4[_0x92ca('0x3e')][_0x92ca('0x84')]:new Array(_0x4323f4[_0x92ca('0x3e')]['tag']);_0x333bfe[_0x92ca('0x35')](function(_0x2bc499){_0x7936b0['or'](_0x92ca('0x73'),'%,'+_0x2bc499+',%');});}if(_0x4323f4[_0x92ca('0x3e')][_0x92ca('0x86')]){var _0x25543f=_0x4323f4[_0x92ca('0x3e')]['filter'][_0x92ca('0x87')]('\x5c','\x5c\x5c')[_0x92ca('0x87')](/'/g,'\x27\x27');if(qs[_0x92ca('0x88')](_0x25543f)){_0x3f6be4['or'](_0x92ca('0x89'),_0x25543f+'%');}else{_0x3f6be4['or'](_0x92ca('0x8a'),qs[_0x92ca('0x6c')](_0x25543f))['or'](_0x92ca('0x8b'),_0x25543f+'%')['or'](_0x92ca('0x8c'),_0x25543f+'%');}}}_0x810ffc[_0x92ca('0x49')](_0x3f6be4);_0x810ffc['group'](_0x92ca('0x8d'));var _0x5762e7={'type':db[_0x92ca('0x8e')][_0x92ca('0x8f')][_0x92ca('0x90')],'raw':!![]};var _0x1e26be=_0x810ffc[_0x92ca('0x91')]();_0x1e26be[_0x92ca('0x4c')]('i.id');_0x1e26be[_0x92ca('0x4c')](_0x92ca('0x92'),_0x92ca('0x93'));if(_0x215b83['order']){_0x215b83[_0x92ca('0x47')]['forEach'](function(_0x13f617){var _0x1a35c8=_0x13f617[0x0]===_0x92ca('0x94')?_0x13f617[0x0]:'i.'+_0x13f617[0x0];_0x810ffc[_0x92ca('0x47')](_0x1a35c8,_0x13f617[0x1]==='DESC'?![]:!![]);});}if(!_[_0x92ca('0x78')](_0x333bfe)){_0x810ffc[_0x92ca('0x65')](_0x7936b0);_0x1e26be[_0x92ca('0x49')](_0x92ca('0x95'),_0x333bfe);}BPromise[_0x92ca('0x96')]()['then'](function(){if(!_0x240e11){if(_0x4323f4[_0x92ca('0x3e')][_0x92ca('0x79')])return;_0x1e26be[_0x92ca('0x49')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x810ffc[_0x92ca('0x49')](_0x92ca('0x97'));return;}if(_0x4323f4['user'][_0x92ca('0x98')]!==_0x92ca('0x99'))return;return _0x4323f4[_0x92ca('0x9a')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x92ca('0x29')](function(_0x1bc14a){if(_[_0x92ca('0x78')](_0x1bc14a)){_0x1e26be[_0x92ca('0x49')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x810ffc[_0x92ca('0x49')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x1e26be[_0x92ca('0x49')](_0x92ca('0x7a'),_[_0x92ca('0x31')](_0x1bc14a,'id'));_0x810ffc[_0x92ca('0x49')](_0x92ca('0x7a'),_[_0x92ca('0x31')](_0x1bc14a,'id'));}});})[_0x92ca('0x29')](function(){if(_0x4323f4[_0x92ca('0x9a')]['role']===_0x92ca('0x99')&&!_0x240e11&&!_0x4323f4[_0x92ca('0x3e')]['OpenchannelAccountId'])return[];return db[_0x92ca('0x9b')][_0x92ca('0x3e')](_0x1e26be[_0x92ca('0x9c')](),_0x5762e7);})[_0x92ca('0x29')](function(_0x2a6415){_0x540742[_0x92ca('0x23')]=_0x2a6415[_0x92ca('0x44')];if(_0x540742[_0x92ca('0x23')]===0x0)return[];return db[_0x92ca('0x9b')][_0x92ca('0x3e')](_0x1f2bd4['toString'](),_0x5762e7)['then'](function(_0x3a5898){_0x4dbc22=_[_0x92ca('0x9d')](_0x3a5898,'id');_0x5762e7=_[_0x92ca('0x9e')](_0x5762e7,{'model':db[_0x92ca('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4323f4[_0x92ca('0x3e')]['fields']){_0x215b83[_0x92ca('0x41')][_0x92ca('0x35')](function(_0x17b8a1){_0x810ffc['field']('i.'+_0x17b8a1);});}else{_0x810ffc[_0x92ca('0x4c')](_0x92ca('0x92'),'unreadMessages');_0x810ffc[_0x92ca('0x4c')](_0x92ca('0x9f'),_0x92ca('0xa0'));_0x810ffc[_0x92ca('0x4c')](_0x92ca('0xa1'),_0x92ca('0xa2'));_0x810ffc[_0x92ca('0x4c')](_0x92ca('0xa3'),_0x92ca('0x94'));_0x810ffc['field'](_0x92ca('0xa4'));_0x810ffc['field']('c.firstName','Contact.firstName');_0x810ffc[_0x92ca('0x4c')](_0x92ca('0xa5'),_0x92ca('0xa6'));_0x810ffc[_0x92ca('0x4c')](_0x92ca('0xa7'),_0x92ca('0xa8'));_0x810ffc[_0x92ca('0x4c')](_0x92ca('0xa9'),_0x92ca('0xaa'));_0x810ffc[_0x92ca('0x4c')](_0x92ca('0xab'),_0x92ca('0xac'));_0x810ffc[_0x92ca('0x4c')](_0x92ca('0xad'),'Contact.fax');_0x810ffc['field'](_0x92ca('0xae'),_0x92ca('0xaf'));_0x810ffc[_0x92ca('0x4c')](_0x92ca('0xb0'),_0x92ca('0xb1'));_0x810ffc[_0x92ca('0x4c')](_0x92ca('0xb2'),_0x92ca('0x33'));}if(_0x215b83[_0x92ca('0x22')])_0x810ffc[_0x92ca('0x22')](_0x215b83[_0x92ca('0x22')]);if(_0x215b83['offset'])_0x810ffc[_0x92ca('0x20')](_0x215b83['offset']);return db[_0x92ca('0x9b')][_0x92ca('0x3e')](_0x810ffc[_0x92ca('0x9c')](),_0x5762e7);})[_0x92ca('0x29')](function(_0x40263b){if(_0x40263b[_0x92ca('0x44')]>0x0)_0x2e1ff1['where'](_0x92ca('0xb3'),_['map'](_0x40263b,'id'));return db[_0x92ca('0x9b')][_0x92ca('0x3e')](_0x2e1ff1[_0x92ca('0x9c')](),_0x5762e7)[_0x92ca('0x29')](function(_0x31f9d8){var _0x25ef83=_['groupBy'](_0x31f9d8,_0x92ca('0xb4'));var _0xe5c373=[];_0x40263b[_0x92ca('0x35')](function(_0x2d8a56){_0xe5c373[_0x92ca('0x36')](updateOpenchannelInteraction(_0x2d8a56,_0x4dbc22,_0x25ef83));});return BPromise[_0x92ca('0xb5')](_0xe5c373);});});})[_0x92ca('0x29')](function(_0x344c69){_0x540742[_0x92ca('0xb6')]=_0x344c69;return _0x540742;})[_0x92ca('0x29')](respondWithFilteredResult(_0xdb6071,_0x215b83))['catch'](handleError(_0xdb6071,null));};exports[_0x92ca('0xb7')]=function(_0x43a1c4,_0x287f81){var _0x2920eb={};if(_0x43a1c4['query'][_0x92ca('0x3b')]&&_0x43a1c4[_0x92ca('0x3e')][_0x92ca('0x3b')]==='from'){_0x2920eb[_0x92ca('0x4e')]=_0x43a1c4[_0x92ca('0xb8')]['id'];}else{_0x2920eb['id']=_0x43a1c4[_0x92ca('0xb8')]['id'];}var _0x14b905={'raw':![],'where':_0x2920eb},_0x7053c3={};_0x7053c3[_0x92ca('0x3d')]=_[_0x92ca('0x3f')](db[_0x92ca('0x39')][_0x92ca('0xb9')]);_0x7053c3['query']=_[_0x92ca('0x3f')](_0x43a1c4[_0x92ca('0x3e')]);_0x7053c3[_0x92ca('0x40')]=_[_0x92ca('0x42')](_0x7053c3[_0x92ca('0x3d')],_0x7053c3[_0x92ca('0x3e')]);_0x14b905['attributes']=_[_0x92ca('0x42')](_0x7053c3[_0x92ca('0x3d')],qs[_0x92ca('0x43')](_0x43a1c4[_0x92ca('0x3e')][_0x92ca('0x43')]));_0x14b905[_0x92ca('0x41')]=_0x14b905[_0x92ca('0x41')][_0x92ca('0x44')]?_0x14b905[_0x92ca('0x41')]:_0x7053c3[_0x92ca('0x3d')];if(_0x43a1c4['query'][_0x92ca('0xba')]){_0x14b905['include']=[{'all':!![]}];}_0x14b905=_[_0x92ca('0x9e')]({},_0x14b905,_0x43a1c4[_0x92ca('0xbb')]);return db[_0x92ca('0x39')][_0x92ca('0x6e')](_0x14b905)['then'](handleEntityNotFound(_0x287f81,null))['then'](respondWithResult(_0x287f81,null))['catch'](handleError(_0x287f81,null));};exports[_0x92ca('0xbc')]=function(_0x3352e2,_0x5c2e71){return db['OpenchannelInteraction'][_0x92ca('0xbc')](_0x3352e2['body'],{})[_0x92ca('0x29')](respondWithResult(_0x5c2e71,0xc9))[_0x92ca('0x37')](handleError(_0x5c2e71,null));};exports[_0x92ca('0x28')]=function(_0x55647a,_0x5268c9){if(_0x55647a['body']['id']){delete _0x55647a[_0x92ca('0xbd')]['id'];}return db[_0x92ca('0x39')][_0x92ca('0x6e')]({'where':{'id':_0x55647a[_0x92ca('0xb8')]['id']}})[_0x92ca('0x29')](handleEntityNotFound(_0x5268c9,null))[_0x92ca('0x29')](saveUpdates(_0x55647a[_0x92ca('0xbd')],null))['then'](respondWithResult(_0x5268c9,null))[_0x92ca('0x37')](handleError(_0x5268c9,null));};exports['destroy']=function(_0x5d3524,_0x4e1778){return db[_0x92ca('0x39')][_0x92ca('0x6e')]({'where':{'id':_0x5d3524['params']['id']}})[_0x92ca('0x29')](handleEntityNotFound(_0x4e1778,null))[_0x92ca('0x29')](removeEntity(_0x4e1778,null))[_0x92ca('0x37')](handleError(_0x4e1778,null));};exports[_0x92ca('0xbe')]=function(_0x4d2e8e,_0x24068b){return db[_0x92ca('0x39')][_0x92ca('0xbe')]()['then'](respondWithResult(_0x24068b,null))[_0x92ca('0x37')](handleError(_0x24068b,null));};exports[_0x92ca('0xbf')]=function(_0x540329,_0x33ed2c,_0x20003c){return db[_0x92ca('0xc0')][_0x92ca('0x6e')]({'where':{'id':_0x540329[_0x92ca('0xb8')]['id']}})[_0x92ca('0x29')](handleEntityNotFound(_0x33ed2c,null))[_0x92ca('0x29')](function(_0x2a8211){if(_0x2a8211){return _0x2a8211[_0x92ca('0xbf')](_0x540329['body']['ids'],_[_0x92ca('0xc1')](_0x540329[_0x92ca('0xbd')],[_0x92ca('0xc2'),'id'])||{});}})[_0x92ca('0x29')](respondWithResult(_0x33ed2c,null))[_0x92ca('0x37')](handleError(_0x33ed2c,null));};exports[_0x92ca('0xc3')]=function(_0x3f7825,_0x5d25cf,_0x3e3aad){var _0x26aecf={'raw':![],'where':{}};var _0x3d7737={};var _0x47539c={'count':0x0,'rows':[]};return db[_0x92ca('0x39')][_0x92ca('0xc4')]({'where':{'id':_0x3f7825[_0x92ca('0xb8')]['id']}})['then'](handleEntityNotFound(_0x5d25cf,null))[_0x92ca('0x29')](function(_0x4ae480){if(_0x4ae480){_0x3d7737['model']=_[_0x92ca('0x3f')](db[_0x92ca('0xc0')][_0x92ca('0xb9')]);_0x3d7737['query']=_['keys'](_0x3f7825[_0x92ca('0x3e')]);_0x3d7737[_0x92ca('0x40')]=_['intersection'](_0x3d7737[_0x92ca('0x3d')],_0x3d7737[_0x92ca('0x3e')]);_0x26aecf['attributes']=_[_0x92ca('0x42')](_0x3d7737['model'],qs['fields'](_0x3f7825[_0x92ca('0x3e')][_0x92ca('0x43')]));_0x26aecf[_0x92ca('0x41')]=_0x26aecf[_0x92ca('0x41')][_0x92ca('0x44')]?_0x26aecf[_0x92ca('0x41')]:_0x3d7737[_0x92ca('0x3d')];if(!_0x3f7825[_0x92ca('0x3e')][_0x92ca('0x45')](_0x92ca('0x46'))){_0x26aecf[_0x92ca('0x22')]=qs[_0x92ca('0x22')](_0x3f7825[_0x92ca('0x3e')][_0x92ca('0x22')]);_0x26aecf[_0x92ca('0x20')]=qs[_0x92ca('0x20')](_0x3f7825['query'][_0x92ca('0x20')]);}_0x26aecf[_0x92ca('0x47')]=qs['sort'](_0x3f7825['query'][_0x92ca('0x48')]);_0x26aecf[_0x92ca('0x49')]=qs[_0x92ca('0x40')](_[_0x92ca('0x4a')](_0x3f7825['query'],_0x3d7737[_0x92ca('0x40')]));_0x26aecf[_0x92ca('0x49')]['OpenchannelInteractionId']=_0x4ae480['id'];if(_0x3f7825[_0x92ca('0x3e')][_0x92ca('0x86')]){_0x26aecf[_0x92ca('0x49')]=_[_0x92ca('0x9e')](_0x26aecf[_0x92ca('0x49')],{'$or':_['map'](_0x26aecf['attributes'],function(_0x13f355){var _0x41be7f={};_0x41be7f[_0x13f355]={'$like':'%'+_0x3f7825['query'][_0x92ca('0x86')]+'%'};return _0x41be7f;})});}if(_0x3f7825[_0x92ca('0x3e')]['$gte']){var _0x2ff230=_0x3f7825[_0x92ca('0x3e')][_0x92ca('0x7c')][_0x92ca('0x34')](',');var _0x2dfa9c={};_0x2dfa9c[_0x2ff230[0x0]]={'$gte':moment(_0x2ff230[0x1])[_0x92ca('0xc5')](_0x92ca('0xc6'))};_0x26aecf[_0x92ca('0x49')]=_[_0x92ca('0x9e')](_0x26aecf[_0x92ca('0x49')],_0x2dfa9c);}_0x26aecf=_[_0x92ca('0x9e')]({},_0x26aecf,_0x3f7825[_0x92ca('0xbb')]);return db[_0x92ca('0xc0')][_0x92ca('0x23')]({'where':_0x26aecf[_0x92ca('0x49')]})[_0x92ca('0x29')](function(_0x5e939c){_0x47539c[_0x92ca('0x23')]=_0x5e939c;if(_0x3f7825['query'][_0x92ca('0xba')]){_0x26aecf[_0x92ca('0xc7')]=[{'all':!![]}];}return db[_0x92ca('0xc0')][_0x92ca('0xc8')](_0x26aecf);})[_0x92ca('0x29')](function(_0x525db1){_0x47539c['rows']=_0x525db1;return _0x47539c;});}})[_0x92ca('0x29')](respondWithFilteredResult(_0x5d25cf,_0x26aecf))['catch'](handleError(_0x5d25cf,null));};exports[_0x92ca('0xc9')]=function(_0x3a7020,_0x32f098,_0x30bbbf){return db[_0x92ca('0x39')][_0x92ca('0x6e')]({'where':{'id':_0x3a7020['params']['id']}})[_0x92ca('0x29')](handleEntityNotFound(_0x32f098,null))['then'](function(_0x1f58ed){if(_0x1f58ed){return _0x1f58ed[_0x92ca('0xca')](_0x3a7020[_0x92ca('0xbd')]['ids'],_[_0x92ca('0xc1')](_0x3a7020['body'],[_0x92ca('0xc2'),'id'])||{})[_0x92ca('0xcb')](function(){return db['Tag'][_0x92ca('0xc8')]({'attributes':['id',_0x92ca('0x2e'),_0x92ca('0x4d')],'where':{'id':_0x3a7020[_0x92ca('0xbd')][_0x92ca('0xc2')]}});})[_0x92ca('0x29')](function(_0x532407){socket[_0x92ca('0xcc')](_0x92ca('0xcd'),{'id':Number(_0x3a7020[_0x92ca('0xb8')]['id']),'tags':_0x532407||[]});return{'id':Number(_0x3a7020[_0x92ca('0xb8')]['id']),'tags':_0x532407||[]};});}})[_0x92ca('0x29')](respondWithResult(_0x32f098,null))['catch'](handleError(_0x32f098,null));};exports['removeTags']=function(_0x4e9b3c,_0x5137c2,_0x1981a4){return db[_0x92ca('0x39')][_0x92ca('0x6e')]({'where':{'id':_0x4e9b3c[_0x92ca('0xb8')]['id']}})[_0x92ca('0x29')](handleEntityNotFound(_0x5137c2,null))[_0x92ca('0x29')](function(_0x1cda9c){if(_0x1cda9c){return _0x1cda9c[_0x92ca('0xce')](_0x4e9b3c[_0x92ca('0x3e')]['ids']);}})['then'](respondWithStatusCode(_0x5137c2,null))[_0x92ca('0x37')](handleError(_0x5137c2,null));};exports[_0x92ca('0xcf')]=function(_0x5bb9aa,_0x14b7f0){var _0x28a878=moment()[_0x92ca('0xd0')]()['toString']();var _0x17965d=path[_0x92ca('0xd1')](config[_0x92ca('0xd2')],_0x92ca('0xd3'),'files',_0x92ca('0xd4'));var _0x21c6b9=path[_0x92ca('0xd1')](config[_0x92ca('0xd2')],_0x92ca('0xd3'),_0x92ca('0xd5'),_0x92ca('0xd6'));var _0x105268=path[_0x92ca('0xd1')](_0x17965d,_0x28a878);var _0x3e2f28=util[_0x92ca('0xc5')](_0x92ca('0xd7'),_0x5bb9aa[_0x92ca('0xb8')]['id'],_0x28a878);var _0x249a9f=path[_0x92ca('0xd1')](_0x17965d,_0x3e2f28);var _0x265b59=[];_0x265b59[_0x92ca('0x36')]({'model':db['User'],'as':_0x92ca('0x75'),'attributes':['id',_0x92ca('0x32')],'raw':!![]});_0x265b59[_0x92ca('0x36')]({'model':db[_0x92ca('0xd8')],'as':_0x92ca('0xd9'),'attributes':['id','firstName',_0x92ca('0xda')],'raw':!![]});if(_0x5bb9aa[_0x92ca('0x3e')][_0x92ca('0xd6')]){_0x265b59['push']({'model':db[_0x92ca('0xdb')],'as':_0x92ca('0xdb'),'raw':!![]});}var _0x5fda91=[{'model':db['OpenchannelMessage'],'as':_0x92ca('0xdc'),'attributes':['id',_0x92ca('0xbd'),_0x92ca('0xdd'),_0x92ca('0xde'),'secret',_0x92ca('0x82')],'include':_0x265b59}];_0x5fda91[_0x92ca('0x36')]({'model':db[_0x92ca('0xdf')],'as':_0x92ca('0xe0'),'attributes':['id',_0x92ca('0x2e')]});_0x5fda91[_0x92ca('0x36')]({'model':db[_0x92ca('0x75')],'as':_0x92ca('0xe1'),'attributes':['id',_0x92ca('0x32')]});return db[_0x92ca('0x39')][_0x92ca('0x6e')]({'where':{'id':_0x5bb9aa[_0x92ca('0xb8')]['id']},'include':_0x5fda91})[_0x92ca('0x29')](handleEntityNotFound(_0x14b7f0,null))[_0x92ca('0x29')](function(_0x128b8c){if(_0x128b8c){var _0x5a3c1c=_0x128b8c[_0x92ca('0xe2')]({'plain':!![]});fs['mkdirSync'](_0x105268);var _0x330cbb={'channel':'Openchannel','account':_0x5a3c1c[_0x92ca('0xe0')]['name'],'agent':_0x5a3c1c[_0x92ca('0xe1')]?_0x5a3c1c[_0x92ca('0xe1')][_0x92ca('0x32')]:'N.A.','createdAt':moment(_0x5a3c1c[_0x92ca('0xdd')])[_0x92ca('0xc5')](_0x92ca('0xc6'))['toString'](),'closedAt':_0x5a3c1c['closed']?moment(_0x5a3c1c[_0x92ca('0xe3')])[_0x92ca('0xc5')](_0x92ca('0xc6'))[_0x92ca('0x9c')]():'','disposition':_0x5a3c1c[_0x92ca('0xe4')],'visibility':_0x5a3c1c['threadId']?_0x92ca('0xe5'):_0x92ca('0xe6'),'messages':_(_0x5a3c1c[_0x92ca('0xdc')])[_0x92ca('0x86')]({'secret':![]})['map'](function(_0x30fa9a){if(_0x30fa9a['Attachment']){var _0x4ad916=path['join'](_0x21c6b9,_0x30fa9a[_0x92ca('0xdb')]['basename']);if(fs[_0x92ca('0xe7')](_0x4ad916)){fs['createReadStream'](_0x4ad916)[_0x92ca('0xe8')](fs[_0x92ca('0xe9')](path[_0x92ca('0xd1')](_0x105268,_0x30fa9a['Attachment']['basename'])));}}return{'date':moment(_0x30fa9a[_0x92ca('0xdd')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x30fa9a[_0x92ca('0xde')]===_0x92ca('0xea')?_0x30fa9a['User']?_0x30fa9a[_0x92ca('0x75')][_0x92ca('0x32')]:_0x92ca('0xeb'):_0x30fa9a[_0x92ca('0xd9')][_0x92ca('0xec')]+(_0x30fa9a['Contact'][_0x92ca('0xda')]?'\x20'+_0x30fa9a[_0x92ca('0xd9')][_0x92ca('0xda')]:''),'body':_0x30fa9a[_0x92ca('0xdb')]?_0x30fa9a[_0x92ca('0xdb')]['basename']:_0x30fa9a[_0x92ca('0xbd')],'direction':_0x30fa9a['direction']===_0x92ca('0xea')?'A':'C','secret':_0x30fa9a['secret'],'read':_0x30fa9a[_0x92ca('0x82')],'attachment':_0x30fa9a[_0x92ca('0xdb')]};})[_0x92ca('0x6a')]()};return ejs['renderFile'](path[_0x92ca('0xd1')](config[_0x92ca('0xd2')],_0x92ca('0xd3'),_0x92ca('0xed'),_0x92ca('0xee')),{'interaction':_0x330cbb})[_0x92ca('0x29')](function(_0x2f49c7){var _0x146ec8=path[_0x92ca('0xd1')](_0x105268,_0x92ca('0xef')+_0x5a3c1c['id']+'-'+_0x28a878+'.pdf');var _0x11325f={'path':_0x146ec8,'channel':_0x92ca('0xf0'),'interactionId':_0x5a3c1c['id']};return pdf[_0x92ca('0xf1')](_0x2f49c7,_0x11325f);})[_0x92ca('0x29')](function(){return new BPromise(function(_0xf6477f,_0x499b49){zipdir(_0x105268,{'saveTo':_0x249a9f},function(_0x4ffae1,_0x1819b5){if(_0x4ffae1)return _0x499b49(_0x4ffae1);return _0xf6477f(_0x1819b5);});})[_0x92ca('0x29')](function(){return new BPromise(function(_0x239bfa,_0x21e2b4){rimraf(_0x105268,function(_0x14dba6){if(_0x14dba6)_0x21e2b4(_0x14dba6);return _0x239bfa();});});})[_0x92ca('0x29')](function(){return _0x14b7f0[_0x92ca('0xcf')](_0x249a9f,_0x3e2f28,function(_0x2f03c9){if(_0x2f03c9){console[_0x92ca('0xf2')](_0x92ca('0xf3'),_0x2f03c9);}else{fs['unlinkSync'](_0x249a9f);}});});});}else{return _0x14b7f0[_0x92ca('0x2b')](0xc8);}})[_0x92ca('0x37')](handleError(_0x14b7f0,null));}; \ No newline at end of file +var _0xba10=['read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','role','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','all','rows','catch','show','params','includeAll','include','merge','options','create','body','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','format','addTags','setTags','spread','Tag','findAll','emit','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','User','CmContact','lastName','attachments','Attachment','Messages','direction','secret','OpenchannelAccount','Account','get','Openchannel','Owner','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Public','Private','basename','createReadStream','pipe','createWriteStream','out','System','firstName','renderFile','downloadInteraction.html','createPdfFromHTML','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','end','offset','undefined','count','limit','status','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','Users','fullname','TagIds','Tags','split','forEach','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','u.id','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','having','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20=\x20?'];(function(_0x3998a7,_0x419600){var _0x447ae0=function(_0x72f283){while(--_0x72f283){_0x3998a7['push'](_0x3998a7['shift']());}};_0x447ae0(++_0x419600);}(_0xba10,0x70));var _0x0ba1=function(_0x10a556,_0x1997e5){_0x10a556=_0x10a556-0x0;var _0x4dea04=_0xba10[_0x10a556];return _0x4dea04;};'use strict';var emlformat=require(_0x0ba1('0x0'));var rimraf=require(_0x0ba1('0x1'));var zipdir=require(_0x0ba1('0x2'));var jsonpatch=require(_0x0ba1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0ba1('0x4'));var Mustache=require(_0x0ba1('0x5'));var util=require(_0x0ba1('0x6'));var path=require(_0x0ba1('0x7'));var sox=require(_0x0ba1('0x8'));var csv=require(_0x0ba1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0ba1('0xa'));var _=require(_0x0ba1('0xb'));var squel=require(_0x0ba1('0xc'));var crypto=require(_0x0ba1('0xd'));var jsforce=require(_0x0ba1('0xe'));var deskjs=require(_0x0ba1('0xf'));var toCsv=require(_0x0ba1('0x9'));var querystring=require(_0x0ba1('0x10'));var Papa=require(_0x0ba1('0x11'));var Redis=require('ioredis');var authService=require(_0x0ba1('0x12'));var qs=require(_0x0ba1('0x13'));var as=require(_0x0ba1('0x14'));var pdf=require(_0x0ba1('0x15'));var hardwareService=require(_0x0ba1('0x16'));var logger=require('../../config/logger')(_0x0ba1('0x17'));var utils=require(_0x0ba1('0x18'));var config=require(_0x0ba1('0x19'));var licenseUtil=require(_0x0ba1('0x1a'));var db=require(_0x0ba1('0x1b'))['db'];config[_0x0ba1('0x1c')]=_['defaults'](config['redis'],{'host':_0x0ba1('0x1d'),'port':0x18eb});var socket=require(_0x0ba1('0x1e'))(new Redis(config[_0x0ba1('0x1c')]));require('./openchannelInteraction.socket')[_0x0ba1('0x1f')](socket);function respondWithStatusCode(_0x5f37d5,_0xce6ed1){_0xce6ed1=_0xce6ed1||0xcc;return function(_0x359cc8){if(_0x359cc8){return _0x5f37d5['sendStatus'](_0xce6ed1);}return _0x5f37d5['status'](_0xce6ed1)[_0x0ba1('0x20')]();};}function respondWithResult(_0x2e8f6f,_0x2ea0f8){_0x2ea0f8=_0x2ea0f8||0xc8;return function(_0x1c8a57){if(_0x1c8a57){return _0x2e8f6f['status'](_0x2ea0f8)['json'](_0x1c8a57);}};}function respondWithFilteredResult(_0x52c55e,_0x4917a5){return function(_0x352a14){if(_0x352a14){var _0x120b49=typeof _0x4917a5[_0x0ba1('0x21')]===_0x0ba1('0x22')&&typeof _0x4917a5['limit']===_0x0ba1('0x22');var _0x9cfafb=_0x352a14[_0x0ba1('0x23')];var _0x17e9b2=_0x120b49?0x0:_0x4917a5['offset'];var _0x131cc5=_0x120b49?_0x352a14['count']:_0x4917a5[_0x0ba1('0x21')]+_0x4917a5[_0x0ba1('0x24')];var _0x3111bd;if(_0x131cc5>=_0x9cfafb){_0x131cc5=_0x9cfafb;_0x3111bd=0xc8;}else{_0x3111bd=0xce;}_0x52c55e[_0x0ba1('0x25')](_0x3111bd);return _0x52c55e['set'](_0x0ba1('0x26'),_0x17e9b2+'-'+_0x131cc5+'/'+_0x9cfafb)['json'](_0x352a14);}return null;};}function patchUpdates(_0x2b49fa){return function(_0x2268f9){try{jsonpatch[_0x0ba1('0x27')](_0x2268f9,_0x2b49fa,!![]);}catch(_0x17fb1e){return BPromise[_0x0ba1('0x28')](_0x17fb1e);}return _0x2268f9[_0x0ba1('0x29')]();};}function saveUpdates(_0x501aac,_0x235bca){return function(_0x20484c){if(_0x20484c){return _0x20484c[_0x0ba1('0x2a')](_0x501aac)[_0x0ba1('0x2b')](function(_0x531c92){return _0x531c92;});}return null;};}function removeEntity(_0x48a90d,_0x57d1d6){return function(_0x37b719){if(_0x37b719){return _0x37b719[_0x0ba1('0x2c')]()[_0x0ba1('0x2b')](function(){_0x48a90d[_0x0ba1('0x25')](0xcc)[_0x0ba1('0x20')]();});}};}function handleEntityNotFound(_0x2f0317,_0x807740){return function(_0x137a42){if(!_0x137a42){_0x2f0317[_0x0ba1('0x2d')](0x194);}return _0x137a42;};}function handleError(_0x471c31,_0x1d65fa){_0x1d65fa=_0x1d65fa||0x1f4;return function(_0x50ecd7){logger[_0x0ba1('0x2e')](_0x50ecd7[_0x0ba1('0x2f')]);if(_0x50ecd7[_0x0ba1('0x30')]){delete _0x50ecd7[_0x0ba1('0x30')];}_0x471c31[_0x0ba1('0x25')](_0x1d65fa)['send'](_0x50ecd7);};}function getInteractionUsers(_0x3b6e38,_0xb8bacf){return new BPromise(function(_0x1ea577,_0x522c83){try{if(_0xb8bacf[_0x3b6e38['id']]){_0x3b6e38[_0x0ba1('0x31')]=_['map'](_0xb8bacf[_0x3b6e38['id']],function(_0xb349fe){return{'id':_0xb349fe['id'],'fullname':_0xb349fe[_0x0ba1('0x32')]};});}}catch(_0x49a657){_0x522c83(_0x49a657);}_0x1ea577(_0x3b6e38);});}function getInteractionTags(_0x2a09e5,_0x1a0513){return new BPromise(function(_0x17b9b5,_0x51655e){try{if(_0x2a09e5[_0x0ba1('0x33')]){_0x2a09e5[_0x0ba1('0x34')]=[];_0x2a09e5['TagIds'][_0x0ba1('0x35')](',')[_0x0ba1('0x36')](function(_0x3eeea8){_0x2a09e5[_0x0ba1('0x34')]['push'](_0x1a0513[_0x3eeea8]);});}delete _0x2a09e5[_0x0ba1('0x33')];}catch(_0x42ade9){_0x51655e(_0x42ade9);}_0x17b9b5(_0x2a09e5);});}function updateOpenchannelInteraction(_0x42276b,_0x336ea6,_0x3702e7){return new BPromise(function(_0x5d0fd1,_0x5be6d4){return getInteractionUsers(_0x42276b,_0x3702e7)[_0x0ba1('0x2b')](function(_0x5c8ca7){return getInteractionTags(_0x5c8ca7,_0x336ea6);})[_0x0ba1('0x2b')](function(_0x415291){_0x5d0fd1(_0x415291);})['catch'](function(_0x47b14b){_0x5be6d4(_0x47b14b);});});}exports['index']=function(_0x3a97bc,_0x1b11a7){var _0x43afad={},_0x23d940={},_0x2fc89d={'count':0x0,'rows':[]};var _0x51f43e=_[_0x0ba1('0x37')](db[_0x0ba1('0x38')][_0x0ba1('0x39')],function(_0x25b5f3){return{'name':_0x25b5f3[_0x0ba1('0x3a')],'type':_0x25b5f3[_0x0ba1('0x3b')][_0x0ba1('0x3c')]};});_0x23d940[_0x0ba1('0x3d')]=_[_0x0ba1('0x37')](_0x51f43e,_0x0ba1('0x30'));_0x23d940[_0x0ba1('0x3e')]=_['keys'](_0x3a97bc[_0x0ba1('0x3e')]);_0x23d940[_0x0ba1('0x3f')]=_[_0x0ba1('0x40')](_0x23d940[_0x0ba1('0x3d')],_0x23d940['query']);_0x43afad[_0x0ba1('0x41')]=_[_0x0ba1('0x40')](_0x23d940[_0x0ba1('0x3d')],qs[_0x0ba1('0x42')](_0x3a97bc['query'][_0x0ba1('0x42')]));_0x43afad[_0x0ba1('0x41')]=_0x43afad['attributes']['length']?_0x43afad[_0x0ba1('0x41')]:_0x23d940[_0x0ba1('0x3d')];if(!_0x3a97bc[_0x0ba1('0x3e')][_0x0ba1('0x43')](_0x0ba1('0x44'))){_0x43afad['limit']=qs['limit'](_0x3a97bc[_0x0ba1('0x3e')][_0x0ba1('0x24')]);_0x43afad[_0x0ba1('0x21')]=qs[_0x0ba1('0x21')](_0x3a97bc[_0x0ba1('0x3e')][_0x0ba1('0x21')]);}_0x43afad[_0x0ba1('0x45')]=qs[_0x0ba1('0x46')](_0x3a97bc[_0x0ba1('0x3e')][_0x0ba1('0x46')]);_0x43afad[_0x0ba1('0x47')]=qs[_0x0ba1('0x3f')](_[_0x0ba1('0x48')](_0x3a97bc[_0x0ba1('0x3e')],_0x23d940[_0x0ba1('0x3f')]),_0x51f43e);var _0x1e0640=[];var _0x583d94=squel[_0x0ba1('0x49')]()[_0x0ba1('0x4a')]('id')[_0x0ba1('0x4a')](_0x0ba1('0x30'))[_0x0ba1('0x4a')](_0x0ba1('0x4b'))['from']('tools_tags');var _0x213bb6=squel[_0x0ba1('0x49')]()[_0x0ba1('0x4a')](_0x0ba1('0x4c'))[_0x0ba1('0x4a')](_0x0ba1('0x4d'))[_0x0ba1('0x4a')](_0x0ba1('0x4e'))[_0x0ba1('0x4f')](_0x0ba1('0x50'),'ui')[_0x0ba1('0x51')]('users','u',_0x0ba1('0x52'));var _0xb36c11=squel[_0x0ba1('0x49')]()[_0x0ba1('0x4f')](_0x0ba1('0x53'),'i')[_0x0ba1('0x51')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0x0ba1('0x54'))[_0x0ba1('0x51')](_0x0ba1('0x55'),'a',_0x0ba1('0x56'))['left_join'](_0x0ba1('0x57'),'me',_0x0ba1('0x58'))[_0x0ba1('0x51')](_0x0ba1('0x59'),'it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0x0ba1('0x5a'),'t',_0x0ba1('0x5b'));var _0x259db2=squel[_0x0ba1('0x5c')]();var _0x5a200d=[];var _0x52befb=squel['expr']();var _0x2053d8;if(_0x3a97bc[_0x0ba1('0x3e')][_0x0ba1('0x5d')]){_0x2053d8=as[_0x0ba1('0x5e')](_0x3a97bc[_0x0ba1('0x3e')][_0x0ba1('0x5d')]);var _0x4ecb65=_0x2053d8[_0x0ba1('0x5f')];for(var _0x2c6b27=0x0;_0x2c6b27<_0x2053d8[_0x0ba1('0x60')][_0x0ba1('0x61')];_0x2c6b27++){var _0x24800e=_0x2053d8[_0x0ba1('0x60')][_0x2c6b27];var _0x1741ef='i';var _0x123a64=_[_0x0ba1('0x62')](_0x51f43e,[_0x0ba1('0x30'),_0x24800e[_0x0ba1('0x4a')]]);if(!_0x123a64){switch(_0x24800e['field']){case _0x0ba1('0x63'):if(_0x24800e['value']==0x1){_0xb36c11[_0x0ba1('0x64')]('`'+_0x24800e[_0x0ba1('0x4a')]+'`\x20=\x200');}else{_0xb36c11['having']('`'+_0x24800e['field']+'`\x20>\x200');}break;case _0x0ba1('0x65'):if(_0x24800e[_0x0ba1('0x66')]===_0x0ba1('0x67')){if(_0x24800e[_0x0ba1('0x68')]['split']('\x20')[_0x0ba1('0x61')]>0x1){_0x259db2[_0x4ecb65](_0x0ba1('0x69'),qs[_0x0ba1('0x6a')](_0x24800e[_0x0ba1('0x68')]),null);}else{var _0x6433bd='%'+_0x24800e[_0x0ba1('0x68')]+'%';_0x259db2[_0x4ecb65](_0x0ba1('0x6b'),_0x6433bd,_0x6433bd,_0x6433bd);}}else{_0x123a64=_[_0x0ba1('0x62')](_0x51f43e,[_0x0ba1('0x30'),_0x0ba1('0x6c')]);_0x24800e[_0x0ba1('0x4a')]=_0x0ba1('0x6c');_0x1b71a4=as['buildExpression'](_0x1741ef,_0x123a64[_0x0ba1('0x3b')],_0x24800e);_0x259db2[_0x4ecb65](_0x1b71a4[_0x0ba1('0x6d')],_0x1b71a4['value'][_0x0ba1('0x6e')],_0x1b71a4['value'][_0x0ba1('0x20')]);}break;case'Tag':var _0x523d4d=_0x24800e[_0x0ba1('0x68')][_0x0ba1('0x35')](',')['map'](function(_0x34a619){return Number(_0x34a619);});_0x523d4d['forEach'](function(_0x3079a3){_0x52befb['or'](_0x0ba1('0x6f'),'%,'+_0x3079a3+',%');});_0x5a200d=_['union'](_0x5a200d,_0x523d4d);break;case'User':if(_0x24800e[_0x0ba1('0x66')]==='$substring'){_0x259db2[_0x4ecb65](_0x0ba1('0x70'),'%'+_0x24800e[_0x0ba1('0x68')]+'%',null);}else{_0x123a64=_[_0x0ba1('0x62')](_0x51f43e,[_0x0ba1('0x30'),'UserId']);_0x24800e['field']=_0x0ba1('0x71');_0x1b71a4=as['buildExpression'](_0x1741ef,_0x123a64[_0x0ba1('0x3b')],_0x24800e);_0x259db2[_0x4ecb65](_0x1b71a4[_0x0ba1('0x6d')],_0x1b71a4[_0x0ba1('0x68')]['start'],_0x1b71a4[_0x0ba1('0x68')][_0x0ba1('0x20')]);}break;case'body':_0x1b71a4=as[_0x0ba1('0x72')]('me',null,_0x24800e);_0x259db2[_0x4ecb65](_0x1b71a4[_0x0ba1('0x6d')],_0x1b71a4[_0x0ba1('0x68')][_0x0ba1('0x6e')],_0x1b71a4[_0x0ba1('0x68')]['end']);break;}}else{var _0x1b71a4=as[_0x0ba1('0x72')](_0x1741ef,_0x123a64[_0x0ba1('0x3b')],_0x24800e);_0x259db2[_0x4ecb65](_0x1b71a4[_0x0ba1('0x6d')],_0x1b71a4[_0x0ba1('0x68')][_0x0ba1('0x6e')],_0x1b71a4[_0x0ba1('0x68')][_0x0ba1('0x20')]);}}}else{var _0x30f2b4=_(_0x3a97bc[_0x0ba1('0x3e')])[_0x0ba1('0x73')]()[_0x0ba1('0x37')](function(_0x20dd1b){return _[_0x0ba1('0x74')](_0x51f43e,[_0x0ba1('0x30'),_0x20dd1b])?_0x20dd1b:undefined;})[_0x0ba1('0x75')]()[_0x0ba1('0x68')]();if(!_[_0x0ba1('0x76')](_0x30f2b4)){_0x30f2b4['forEach'](function(_0x27378a){if(_0x27378a===_0x0ba1('0x77')){_0xb36c11[_0x0ba1('0x47')](_0x0ba1('0x78'),[][_0x0ba1('0x79')](_0x3a97bc[_0x0ba1('0x3e')][_0x27378a]));}else if(_0x27378a===_0x0ba1('0x7a')){var _0x34b982=JSON[_0x0ba1('0x7b')](_0x3a97bc[_0x0ba1('0x3e')][_0x27378a])[_0x0ba1('0x7c')];var _0x236a7a=JSON['parse'](_0x3a97bc[_0x0ba1('0x3e')][_0x27378a])[_0x0ba1('0x7d')];_0xb36c11['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x34b982,_0x236a7a);}else{if(_0x3a97bc[_0x0ba1('0x3e')][_0x27378a]===_0x0ba1('0x7e')){_0xb36c11[_0x0ba1('0x47')]('i.'+_0x27378a+'\x20IS\x20NULL');}else{_0xb36c11[_0x0ba1('0x47')]('i.'+_0x27378a+_0x0ba1('0x7f'),_0x3a97bc[_0x0ba1('0x3e')][_0x27378a]);}}});}if(_0x3a97bc[_0x0ba1('0x3e')][_0x0ba1('0x80')]){if(_0x3a97bc[_0x0ba1('0x3e')][_0x0ba1('0x80')]==0x1){_0xb36c11[_0x0ba1('0x64')](_0x0ba1('0x81'));}else{_0xb36c11[_0x0ba1('0x64')]('`unreadMessages`\x20>\x200');}}if(_0x3a97bc['query'][_0x0ba1('0x82')]){_0x5a200d=_[_0x0ba1('0x83')](_0x3a97bc[_0x0ba1('0x3e')][_0x0ba1('0x82')])?_0x3a97bc['query']['tag']:new Array(_0x3a97bc[_0x0ba1('0x3e')][_0x0ba1('0x82')]);_0x5a200d[_0x0ba1('0x36')](function(_0x4885b0){_0x52befb['or'](_0x0ba1('0x6f'),'%,'+_0x4885b0+',%');});}if(_0x3a97bc[_0x0ba1('0x3e')][_0x0ba1('0x84')]){var _0x5c20bf=_0x3a97bc['query'][_0x0ba1('0x84')]['replace']('\x5c','\x5c\x5c')[_0x0ba1('0x85')](/'/g,'\x27\x27');if(qs[_0x0ba1('0x86')](_0x5c20bf)){_0x259db2['or'](_0x0ba1('0x87'),_0x5c20bf+'%');}else{_0x259db2['or'](_0x0ba1('0x88'),qs[_0x0ba1('0x6a')](_0x5c20bf))['or'](_0x0ba1('0x89'),_0x5c20bf+'%')['or'](_0x0ba1('0x8a'),_0x5c20bf+'%');}}}_0xb36c11['where'](_0x259db2);_0xb36c11[_0x0ba1('0x8b')](_0x0ba1('0x8c'));var _0x159ede={'type':db[_0x0ba1('0x8d')]['QueryTypes'][_0x0ba1('0x8e')],'raw':!![]};var _0xc7a9a0=_0xb36c11[_0x0ba1('0x8f')]();_0xc7a9a0[_0x0ba1('0x4a')]('i.id');_0xc7a9a0[_0x0ba1('0x4a')](_0x0ba1('0x90'),_0x0ba1('0x63'));if(_0x43afad[_0x0ba1('0x45')]){_0x43afad[_0x0ba1('0x45')][_0x0ba1('0x36')](function(_0x42034a){var _0x30c52d=_0x42034a[0x0]===_0x0ba1('0x91')?_0x42034a[0x0]:'i.'+_0x42034a[0x0];_0xb36c11[_0x0ba1('0x45')](_0x30c52d,_0x42034a[0x1]===_0x0ba1('0x92')?![]:!![]);});}if(!_[_0x0ba1('0x76')](_0x5a200d)){_0xb36c11['having'](_0x52befb);_0xc7a9a0[_0x0ba1('0x47')](_0x0ba1('0x93'),_0x5a200d);}BPromise['resolve']()['then'](function(){if(!_0x2053d8){if(_0x3a97bc['query'][_0x0ba1('0x77')])return;_0xc7a9a0[_0x0ba1('0x47')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0xb36c11[_0x0ba1('0x47')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x3a97bc['user'][_0x0ba1('0x94')]!==_0x0ba1('0x95'))return;return _0x3a97bc[_0x0ba1('0x96')][_0x0ba1('0x97')]({'attributes':['id'],'raw':!![]})[_0x0ba1('0x2b')](function(_0x3b4aa6){if(_[_0x0ba1('0x76')](_0x3b4aa6)){_0xc7a9a0[_0x0ba1('0x47')](_0x0ba1('0x98'));_0xb36c11[_0x0ba1('0x47')](_0x0ba1('0x98'));}else{_0xc7a9a0[_0x0ba1('0x47')](_0x0ba1('0x78'),_[_0x0ba1('0x37')](_0x3b4aa6,'id'));_0xb36c11[_0x0ba1('0x47')](_0x0ba1('0x78'),_[_0x0ba1('0x37')](_0x3b4aa6,'id'));}});})[_0x0ba1('0x2b')](function(){if(_0x3a97bc[_0x0ba1('0x96')][_0x0ba1('0x94')]===_0x0ba1('0x95')&&!_0x2053d8&&!_0x3a97bc[_0x0ba1('0x3e')][_0x0ba1('0x77')])return[];return db[_0x0ba1('0x99')]['query'](_0xc7a9a0[_0x0ba1('0x9a')](),_0x159ede);})['then'](function(_0x163ca3){_0x2fc89d['count']=_0x163ca3['length'];if(_0x2fc89d[_0x0ba1('0x23')]===0x0)return[];return db[_0x0ba1('0x99')][_0x0ba1('0x3e')](_0x583d94['toString'](),_0x159ede)[_0x0ba1('0x2b')](function(_0x2b0023){_0x1e0640=_[_0x0ba1('0x9b')](_0x2b0023,'id');_0x159ede=_['merge'](_0x159ede,{'model':db[_0x0ba1('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3a97bc['query'][_0x0ba1('0x42')]){_0x43afad['attributes'][_0x0ba1('0x36')](function(_0x60667b){_0xb36c11['field']('i.'+_0x60667b);});}else{_0xb36c11[_0x0ba1('0x4a')](_0x0ba1('0x90'),_0x0ba1('0x63'));_0xb36c11[_0x0ba1('0x4a')]('a.key',_0x0ba1('0x9c'));_0xb36c11['field']('a.mandatoryDisposition','Account.mandatoryDisposition');_0xb36c11[_0x0ba1('0x4a')](_0x0ba1('0x9d'),_0x0ba1('0x91'));_0xb36c11['field'](_0x0ba1('0x9e'));_0xb36c11[_0x0ba1('0x4a')](_0x0ba1('0x9f'),'Contact.firstName');_0xb36c11[_0x0ba1('0x4a')](_0x0ba1('0xa0'),_0x0ba1('0xa1'));_0xb36c11[_0x0ba1('0x4a')]('c.email',_0x0ba1('0xa2'));_0xb36c11[_0x0ba1('0x4a')](_0x0ba1('0xa3'),_0x0ba1('0xa4'));_0xb36c11[_0x0ba1('0x4a')]('c.mobile',_0x0ba1('0xa5'));_0xb36c11['field'](_0x0ba1('0xa6'),'Contact.fax');_0xb36c11[_0x0ba1('0x4a')](_0x0ba1('0xa7'),'Owner.fullname');_0xb36c11[_0x0ba1('0x4a')](_0x0ba1('0xa8'),'Owner.internal');_0xb36c11[_0x0ba1('0x4a')](_0x0ba1('0xa9'),_0x0ba1('0x33'));}if(_0x43afad[_0x0ba1('0x24')])_0xb36c11[_0x0ba1('0x24')](_0x43afad[_0x0ba1('0x24')]);if(_0x43afad['offset'])_0xb36c11[_0x0ba1('0x21')](_0x43afad[_0x0ba1('0x21')]);return db['sequelize']['query'](_0xb36c11['toString'](),_0x159ede);})['then'](function(_0x2497cc){if(_0x2497cc[_0x0ba1('0x61')]>0x0)_0x213bb6[_0x0ba1('0x47')](_0x0ba1('0xaa'),_[_0x0ba1('0x37')](_0x2497cc,'id'));return db[_0x0ba1('0x99')]['query'](_0x213bb6[_0x0ba1('0x9a')](),_0x159ede)[_0x0ba1('0x2b')](function(_0x3de7bb){var _0x3e15c3=_[_0x0ba1('0xab')](_0x3de7bb,_0x0ba1('0xac'));var _0x39ee86=[];_0x2497cc['forEach'](function(_0x2e0408){_0x39ee86[_0x0ba1('0xad')](updateOpenchannelInteraction(_0x2e0408,_0x1e0640,_0x3e15c3));});return BPromise[_0x0ba1('0xae')](_0x39ee86);});});})[_0x0ba1('0x2b')](function(_0x4072f6){_0x2fc89d[_0x0ba1('0xaf')]=_0x4072f6;return _0x2fc89d;})[_0x0ba1('0x2b')](respondWithFilteredResult(_0x1b11a7,_0x43afad))[_0x0ba1('0xb0')](handleError(_0x1b11a7,null));};exports[_0x0ba1('0xb1')]=function(_0x5e9ca8,_0x35b98d){var _0x3d5eb7={};if(_0x5e9ca8[_0x0ba1('0x3e')][_0x0ba1('0x3b')]&&_0x5e9ca8[_0x0ba1('0x3e')][_0x0ba1('0x3b')]==='from'){_0x3d5eb7[_0x0ba1('0x4f')]=_0x5e9ca8['params']['id'];}else{_0x3d5eb7['id']=_0x5e9ca8[_0x0ba1('0xb2')]['id'];}var _0xd9a33e={'raw':![],'where':_0x3d5eb7},_0x25b7ef={};_0x25b7ef['model']=_[_0x0ba1('0x73')](db[_0x0ba1('0x38')][_0x0ba1('0x39')]);_0x25b7ef[_0x0ba1('0x3e')]=_['keys'](_0x5e9ca8['query']);_0x25b7ef[_0x0ba1('0x3f')]=_[_0x0ba1('0x40')](_0x25b7ef[_0x0ba1('0x3d')],_0x25b7ef[_0x0ba1('0x3e')]);_0xd9a33e[_0x0ba1('0x41')]=_[_0x0ba1('0x40')](_0x25b7ef[_0x0ba1('0x3d')],qs[_0x0ba1('0x42')](_0x5e9ca8[_0x0ba1('0x3e')]['fields']));_0xd9a33e[_0x0ba1('0x41')]=_0xd9a33e[_0x0ba1('0x41')][_0x0ba1('0x61')]?_0xd9a33e[_0x0ba1('0x41')]:_0x25b7ef[_0x0ba1('0x3d')];if(_0x5e9ca8['query'][_0x0ba1('0xb3')]){_0xd9a33e[_0x0ba1('0xb4')]=[{'all':!![]}];}_0xd9a33e=_[_0x0ba1('0xb5')]({},_0xd9a33e,_0x5e9ca8[_0x0ba1('0xb6')]);return db[_0x0ba1('0x38')][_0x0ba1('0x62')](_0xd9a33e)[_0x0ba1('0x2b')](handleEntityNotFound(_0x35b98d,null))['then'](respondWithResult(_0x35b98d,null))['catch'](handleError(_0x35b98d,null));};exports[_0x0ba1('0xb7')]=function(_0x302913,_0xfe8eb1){return db[_0x0ba1('0x38')][_0x0ba1('0xb7')](_0x302913[_0x0ba1('0xb8')],{})[_0x0ba1('0x2b')](respondWithResult(_0xfe8eb1,0xc9))[_0x0ba1('0xb0')](handleError(_0xfe8eb1,null));};exports[_0x0ba1('0x2a')]=function(_0x90f7f7,_0x430845){if(_0x90f7f7[_0x0ba1('0xb8')]['id']){delete _0x90f7f7['body']['id'];}return db['OpenchannelInteraction'][_0x0ba1('0x62')]({'where':{'id':_0x90f7f7[_0x0ba1('0xb2')]['id']}})['then'](handleEntityNotFound(_0x430845,null))[_0x0ba1('0x2b')](saveUpdates(_0x90f7f7[_0x0ba1('0xb8')],null))[_0x0ba1('0x2b')](respondWithResult(_0x430845,null))['catch'](handleError(_0x430845,null));};exports['destroy']=function(_0x3cbecd,_0x289f53){return db[_0x0ba1('0x38')][_0x0ba1('0x62')]({'where':{'id':_0x3cbecd[_0x0ba1('0xb2')]['id']}})[_0x0ba1('0x2b')](handleEntityNotFound(_0x289f53,null))[_0x0ba1('0x2b')](removeEntity(_0x289f53,null))[_0x0ba1('0xb0')](handleError(_0x289f53,null));};exports[_0x0ba1('0xb9')]=function(_0x17d2dc,_0x1081c0){return db[_0x0ba1('0x38')][_0x0ba1('0xb9')]()[_0x0ba1('0x2b')](respondWithResult(_0x1081c0,null))[_0x0ba1('0xb0')](handleError(_0x1081c0,null));};exports[_0x0ba1('0xba')]=function(_0x2b436e,_0x756a56,_0x4b9d5e){return db['OpenchannelMessage'][_0x0ba1('0x62')]({'where':{'id':_0x2b436e['params']['id']}})['then'](handleEntityNotFound(_0x756a56,null))['then'](function(_0x4944af){if(_0x4944af){return _0x4944af['addMessage'](_0x2b436e['body'][_0x0ba1('0xbb')],_[_0x0ba1('0xbc')](_0x2b436e[_0x0ba1('0xb8')],[_0x0ba1('0xbb'),'id'])||{});}})['then'](respondWithResult(_0x756a56,null))['catch'](handleError(_0x756a56,null));};exports[_0x0ba1('0xbd')]=function(_0x511aa2,_0x51136d,_0x1d0477){var _0x302362={'raw':![],'where':{}};var _0x5d04df={};var _0xe94475={'count':0x0,'rows':[]};return db[_0x0ba1('0x38')][_0x0ba1('0xbe')]({'where':{'id':_0x511aa2[_0x0ba1('0xb2')]['id']}})[_0x0ba1('0x2b')](handleEntityNotFound(_0x51136d,null))[_0x0ba1('0x2b')](function(_0x49c5eb){if(_0x49c5eb){_0x5d04df[_0x0ba1('0x3d')]=_[_0x0ba1('0x73')](db[_0x0ba1('0xbf')]['rawAttributes']);_0x5d04df[_0x0ba1('0x3e')]=_['keys'](_0x511aa2[_0x0ba1('0x3e')]);_0x5d04df[_0x0ba1('0x3f')]=_[_0x0ba1('0x40')](_0x5d04df[_0x0ba1('0x3d')],_0x5d04df['query']);_0x302362[_0x0ba1('0x41')]=_['intersection'](_0x5d04df[_0x0ba1('0x3d')],qs[_0x0ba1('0x42')](_0x511aa2[_0x0ba1('0x3e')][_0x0ba1('0x42')]));_0x302362[_0x0ba1('0x41')]=_0x302362[_0x0ba1('0x41')][_0x0ba1('0x61')]?_0x302362['attributes']:_0x5d04df[_0x0ba1('0x3d')];if(!_0x511aa2[_0x0ba1('0x3e')][_0x0ba1('0x43')]('nolimit')){_0x302362['limit']=qs[_0x0ba1('0x24')](_0x511aa2[_0x0ba1('0x3e')][_0x0ba1('0x24')]);_0x302362[_0x0ba1('0x21')]=qs[_0x0ba1('0x21')](_0x511aa2[_0x0ba1('0x3e')][_0x0ba1('0x21')]);}_0x302362[_0x0ba1('0x45')]=qs['sort'](_0x511aa2[_0x0ba1('0x3e')][_0x0ba1('0x46')]);_0x302362[_0x0ba1('0x47')]=qs[_0x0ba1('0x3f')](_['pick'](_0x511aa2[_0x0ba1('0x3e')],_0x5d04df[_0x0ba1('0x3f')]));_0x302362[_0x0ba1('0x47')]['OpenchannelInteractionId']=_0x49c5eb['id'];if(_0x511aa2[_0x0ba1('0x3e')][_0x0ba1('0x84')]){_0x302362[_0x0ba1('0x47')]=_[_0x0ba1('0xb5')](_0x302362[_0x0ba1('0x47')],{'$or':_[_0x0ba1('0x37')](_0x302362[_0x0ba1('0x41')],function(_0x36f0f2){var _0x45ca77={};_0x45ca77[_0x36f0f2]={'$like':'%'+_0x511aa2['query'][_0x0ba1('0x84')]+'%'};return _0x45ca77;})});}if(_0x511aa2[_0x0ba1('0x3e')]['$gte']){var _0x234179=_0x511aa2['query'][_0x0ba1('0x7c')]['split'](',');var _0x248baa={};_0x248baa[_0x234179[0x0]]={'$gte':moment(_0x234179[0x1])[_0x0ba1('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x302362[_0x0ba1('0x47')]=_[_0x0ba1('0xb5')](_0x302362[_0x0ba1('0x47')],_0x248baa);}_0x302362=_[_0x0ba1('0xb5')]({},_0x302362,_0x511aa2['options']);return db[_0x0ba1('0xbf')][_0x0ba1('0x23')]({'where':_0x302362['where']})[_0x0ba1('0x2b')](function(_0x3047ea){_0xe94475[_0x0ba1('0x23')]=_0x3047ea;if(_0x511aa2[_0x0ba1('0x3e')][_0x0ba1('0xb3')]){_0x302362[_0x0ba1('0xb4')]=[{'all':!![]}];}return db[_0x0ba1('0xbf')]['findAll'](_0x302362);})[_0x0ba1('0x2b')](function(_0x3d804d){_0xe94475[_0x0ba1('0xaf')]=_0x3d804d;return _0xe94475;});}})[_0x0ba1('0x2b')](respondWithFilteredResult(_0x51136d,_0x302362))[_0x0ba1('0xb0')](handleError(_0x51136d,null));};exports[_0x0ba1('0xc1')]=function(_0x2dd4c8,_0xf9bc91,_0x3d37ef){return db[_0x0ba1('0x38')][_0x0ba1('0x62')]({'where':{'id':_0x2dd4c8[_0x0ba1('0xb2')]['id']}})[_0x0ba1('0x2b')](handleEntityNotFound(_0xf9bc91,null))[_0x0ba1('0x2b')](function(_0x313d81){if(_0x313d81){return _0x313d81[_0x0ba1('0xc2')](_0x2dd4c8[_0x0ba1('0xb8')][_0x0ba1('0xbb')],_['omit'](_0x2dd4c8['body'],['ids','id'])||{})[_0x0ba1('0xc3')](function(){return db[_0x0ba1('0xc4')][_0x0ba1('0xc5')]({'attributes':['id',_0x0ba1('0x30'),_0x0ba1('0x4b')],'where':{'id':_0x2dd4c8['body'][_0x0ba1('0xbb')]}});})['then'](function(_0x4c4135){socket[_0x0ba1('0xc6')]('openchannelInteractionTags:save',{'id':Number(_0x2dd4c8[_0x0ba1('0xb2')]['id']),'tags':_0x4c4135||[]});return{'id':Number(_0x2dd4c8['params']['id']),'tags':_0x4c4135||[]};});}})[_0x0ba1('0x2b')](respondWithResult(_0xf9bc91,null))[_0x0ba1('0xb0')](handleError(_0xf9bc91,null));};exports[_0x0ba1('0xc7')]=function(_0x724039,_0x575ec0,_0x432f05){return db[_0x0ba1('0x38')]['find']({'where':{'id':_0x724039[_0x0ba1('0xb2')]['id']}})[_0x0ba1('0x2b')](handleEntityNotFound(_0x575ec0,null))[_0x0ba1('0x2b')](function(_0x9bdabd){if(_0x9bdabd){return _0x9bdabd[_0x0ba1('0xc7')](_0x724039[_0x0ba1('0x3e')][_0x0ba1('0xbb')]);}})[_0x0ba1('0x2b')](respondWithStatusCode(_0x575ec0,null))[_0x0ba1('0xb0')](handleError(_0x575ec0,null));};exports[_0x0ba1('0xc8')]=function(_0x59e53d,_0x35d101){var _0x355ce4=moment()[_0x0ba1('0xc9')]()['toString']();var _0x2213d6=path[_0x0ba1('0xca')](config[_0x0ba1('0xcb')],_0x0ba1('0xcc'),_0x0ba1('0xcd'),_0x0ba1('0xce'));var _0x46df20=path[_0x0ba1('0xca')](config[_0x0ba1('0xcb')],_0x0ba1('0xcc'),_0x0ba1('0xcd'),'attachments');var _0x2e6b46=path[_0x0ba1('0xca')](_0x2213d6,_0x355ce4);var _0x1d912=util['format'](_0x0ba1('0xcf'),_0x59e53d[_0x0ba1('0xb2')]['id'],_0x355ce4);var _0x16c751=path[_0x0ba1('0xca')](_0x2213d6,_0x1d912);var _0xb0fef3=[];_0xb0fef3[_0x0ba1('0xad')]({'model':db['User'],'as':_0x0ba1('0xd0'),'attributes':['id','fullname'],'raw':!![]});_0xb0fef3[_0x0ba1('0xad')]({'model':db[_0x0ba1('0xd1')],'as':_0x0ba1('0x65'),'attributes':['id','firstName',_0x0ba1('0xd2')],'raw':!![]});if(_0x59e53d[_0x0ba1('0x3e')][_0x0ba1('0xd3')]){_0xb0fef3[_0x0ba1('0xad')]({'model':db[_0x0ba1('0xd4')],'as':'Attachment','raw':!![]});}var _0x14159b=[{'model':db['OpenchannelMessage'],'as':_0x0ba1('0xd5'),'attributes':['id',_0x0ba1('0xb8'),_0x0ba1('0x7a'),_0x0ba1('0xd6'),_0x0ba1('0xd7'),'read'],'include':_0xb0fef3}];_0x14159b['push']({'model':db[_0x0ba1('0xd8')],'as':_0x0ba1('0xd9'),'attributes':['id',_0x0ba1('0x30')]});_0x14159b[_0x0ba1('0xad')]({'model':db[_0x0ba1('0xd0')],'as':'Owner','attributes':['id',_0x0ba1('0x32')]});return db[_0x0ba1('0x38')][_0x0ba1('0x62')]({'where':{'id':_0x59e53d['params']['id']},'include':_0x14159b})[_0x0ba1('0x2b')](handleEntityNotFound(_0x35d101,null))[_0x0ba1('0x2b')](function(_0x546dc0){if(_0x546dc0){var _0x181917=_0x546dc0[_0x0ba1('0xda')]({'plain':!![]});fs['mkdirSync'](_0x2e6b46);var _0x17af6e={'channel':_0x0ba1('0xdb'),'account':_0x181917['Account'][_0x0ba1('0x30')],'agent':_0x181917[_0x0ba1('0xdc')]?_0x181917[_0x0ba1('0xdc')][_0x0ba1('0x32')]:'N.A.','createdAt':moment(_0x181917['createdAt'])[_0x0ba1('0xc0')](_0x0ba1('0xdd'))[_0x0ba1('0x9a')](),'closedAt':_0x181917[_0x0ba1('0xde')]?moment(_0x181917[_0x0ba1('0xdf')])['format'](_0x0ba1('0xdd'))[_0x0ba1('0x9a')]():'','disposition':_0x181917[_0x0ba1('0xe0')],'visibility':_0x181917[_0x0ba1('0xe1')]?_0x0ba1('0xe2'):_0x0ba1('0xe3'),'messages':_(_0x181917['Messages'])['filter']({'secret':![]})[_0x0ba1('0x37')](function(_0x21567f){if(_0x21567f[_0x0ba1('0xd4')]){var _0x170ea4=path['join'](_0x46df20,_0x21567f[_0x0ba1('0xd4')][_0x0ba1('0xe4')]);if(fs['existsSync'](_0x170ea4)){fs[_0x0ba1('0xe5')](_0x170ea4)[_0x0ba1('0xe6')](fs[_0x0ba1('0xe7')](path[_0x0ba1('0xca')](_0x2e6b46,_0x21567f[_0x0ba1('0xd4')][_0x0ba1('0xe4')])));}}return{'date':moment(_0x21567f[_0x0ba1('0x7a')])[_0x0ba1('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0ba1('0x9a')](),'sender':_0x21567f['direction']===_0x0ba1('0xe8')?_0x21567f['User']?_0x21567f[_0x0ba1('0xd0')][_0x0ba1('0x32')]:_0x0ba1('0xe9'):_0x21567f[_0x0ba1('0x65')][_0x0ba1('0xea')]+(_0x21567f[_0x0ba1('0x65')][_0x0ba1('0xd2')]?'\x20'+_0x21567f['Contact']['lastName']:''),'body':_0x21567f['Attachment']?_0x21567f[_0x0ba1('0xd4')]['basename']:_0x21567f[_0x0ba1('0xb8')],'direction':_0x21567f[_0x0ba1('0xd6')]===_0x0ba1('0xe8')?'A':'C','secret':_0x21567f[_0x0ba1('0xd7')],'read':_0x21567f[_0x0ba1('0x80')],'attachment':_0x21567f[_0x0ba1('0xd4')]};})[_0x0ba1('0x68')]()};return ejs[_0x0ba1('0xeb')](path['join'](config[_0x0ba1('0xcb')],_0x0ba1('0xcc'),'views',_0x0ba1('0xec')),{'interaction':_0x17af6e})[_0x0ba1('0x2b')](function(_0x3b9bfd){var _0x5c83e3=path[_0x0ba1('0xca')](_0x2e6b46,'transcript-'+_0x181917['id']+'-'+_0x355ce4+'.pdf');var _0x10c6d0={'path':_0x5c83e3,'channel':_0x0ba1('0xdb'),'interactionId':_0x181917['id']};return pdf[_0x0ba1('0xed')](_0x3b9bfd,_0x10c6d0);})[_0x0ba1('0x2b')](function(){return new BPromise(function(_0x553c48,_0x41e546){zipdir(_0x2e6b46,{'saveTo':_0x16c751},function(_0x21916d,_0x5a14fe){if(_0x21916d)return _0x41e546(_0x21916d);return _0x553c48(_0x5a14fe);});})['then'](function(){return new BPromise(function(_0xeca1b6,_0x3d3674){rimraf(_0x2e6b46,function(_0x1cc956){if(_0x1cc956)_0x3d3674(_0x1cc956);return _0xeca1b6();});});})[_0x0ba1('0x2b')](function(){return _0x35d101[_0x0ba1('0xc8')](_0x16c751,_0x1d912,function(_0x5f3b44){if(_0x5f3b44){console[_0x0ba1('0xee')]('err',_0x5f3b44);}else{fs[_0x0ba1('0xef')](_0x16c751);}});});});}else{return _0x35d101[_0x0ba1('0x2d')](0xc8);}})[_0x0ba1('0xb0')](handleError(_0x35d101,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 66d2168..8999b2a 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 _0xa25f=['length','emit','catch','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','getUsers','setDataValue','map','then'];(function(_0x18d50f,_0x124aff){var _0x8ce385=function(_0x321962){while(--_0x321962){_0x18d50f['push'](_0x18d50f['shift']());}};_0x8ce385(++_0x124aff);}(_0xa25f,0x113));var _0xfa25=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa25f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xfa25('0x0'));var OpenchannelInteraction=require(_0xfa25('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xfa25('0x1'))['db'][_0xfa25('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xfa25('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfa25('0x4'),'afterDestroy':_0xfa25('0x5')};function emitEvent(_0x2bc73d){return function(_0x1103e1,_0xa48510,_0x48d54f){_0x1103e1[_0xfa25('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x40a6aa){_0x1103e1[_0xfa25('0x7')]('Users',_0x40a6aa[_0xfa25('0x8')](function(_0x48686b){return{'id':_0x48686b['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x1103e1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfa25('0x9')](function(_0x28c6ed){_0x1103e1[_0xfa25('0x7')]('unreadMessages',_0x28c6ed[_0xfa25('0xa')]);OpenchannelInteractionEvents[_0xfa25('0xb')](_0x2bc73d+':'+_0x1103e1['id'],_0x1103e1);OpenchannelInteractionEvents[_0xfa25('0xb')](_0x2bc73d,_0x1103e1);_0x48d54f(null);})[_0xfa25('0xc')](_0x48d54f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xfa25('0xd')](e,emitEvent(event));}}module[_0xfa25('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x68f0=['OpenchannelMessage','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction'];(function(_0x8170f9,_0x5df0d3){var _0x5d4297=function(_0xe46a94){while(--_0xe46a94){_0x8170f9['push'](_0x8170f9['shift']());}};_0x5d4297(++_0x5df0d3);}(_0x68f0,0x1a6));var _0x068f=function(_0x5a7676,_0x1dd3b9){_0x5a7676=_0x5a7676-0x0;var _0x140d86=_0x68f0[_0x5a7676];return _0x140d86;};'use strict';var EventEmitter=require(_0x068f('0x0'));var OpenchannelInteraction=require(_0x068f('0x1'))['db'][_0x068f('0x2')];var OpenchannelMessage=require(_0x068f('0x1'))['db'][_0x068f('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x068f('0x4'),'afterDestroy':_0x068f('0x5')};function emitEvent(_0x24b735){return function(_0x5e5b76,_0x2d8b37,_0x1ff324){_0x5e5b76[_0x068f('0x6')]({'attributes':['id'],'raw':!![]})[_0x068f('0x7')](function(_0x4f70bd){_0x5e5b76[_0x068f('0x8')](_0x068f('0x9'),_0x4f70bd[_0x068f('0xa')](function(_0x2cc599){return{'id':_0x2cc599['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x5e5b76['id'],'direction':'in','read':![]},'raw':!![]});})[_0x068f('0x7')](function(_0x479f3e){_0x5e5b76[_0x068f('0x8')](_0x068f('0xb'),_0x479f3e[_0x068f('0xc')]);OpenchannelInteractionEvents[_0x068f('0xd')](_0x24b735+':'+_0x5e5b76['id'],_0x5e5b76);OpenchannelInteractionEvents['emit'](_0x24b735,_0x5e5b76);_0x1ff324(null);})[_0x068f('0xe')](_0x1ff324(null));};}for(var e in events){if(events[_0x068f('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x068f('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 39ce592..c1ca873 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 _0x4819=['request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','OpenchannelInteraction','openchannel_interactions','closed','format','util','../../config/logger','api','moment','bluebird'];(function(_0x476b5f,_0x1f9952){var _0x5a23d8=function(_0x50b464){while(--_0x50b464){_0x476b5f['push'](_0x476b5f['shift']());}};_0x5a23d8(++_0x1f9952);}(_0x4819,0xcd));var _0x9481=function(_0x54e3ab,_0x1c8fcc){_0x54e3ab=_0x54e3ab-0x0;var _0x5c2814=_0x4819[_0x54e3ab];return _0x5c2814;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x27c033,_0x3278ff,_0x15d895){if(_0x27c033['changed'](_0x9481('0xc'))){_0x27c033['closedAt']=moment()[_0x9481('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x15d895(null,_0x27c033);}}});}; \ No newline at end of file +var _0x8375=['closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelInteraction'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x8375,0xa8));var _0x5837=function(_0xee39bc,_0x3ec3e6){_0xee39bc=_0xee39bc-0x0;var _0x5f1b43=_0x8375[_0xee39bc];return _0x5f1b43;};'use strict';var _=require(_0x5837('0x0'));var util=require(_0x5837('0x1'));var logger=require(_0x5837('0x2'))('api');var moment=require(_0x5837('0x3'));var BPromise=require(_0x5837('0x4'));var rp=require(_0x5837('0x5'));var fs=require('fs');var path=require(_0x5837('0x6'));var rimraf=require(_0x5837('0x7'));var config=require(_0x5837('0x8'));var attributes=require('./openchannelInteraction.attributes');module[_0x5837('0x9')]=function(_0x19491e,_0x365da3){return _0x19491e[_0x5837('0xa')](_0x5837('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x508caf,_0x1e44c4,_0x6c5828){if(_0x508caf['changed'](_0x5837('0xc'))){_0x508caf['closedAt']=moment()[_0x5837('0xd')](_0x5837('0xe'));}_0x6c5828(null,_0x508caf);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index ad743c8..614445f 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 _0x44e7=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','request','then','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','limit','AddTagsToOpenchannelInteraction','find','addTags','ids','AddTags'];(function(_0x351fe0,_0x1e4da2){var _0x1ffb54=function(_0x15941e){while(--_0x15941e){_0x351fe0['push'](_0x351fe0['shift']());}};_0x1ffb54(++_0x1e4da2);}(_0x44e7,0xbe));var _0x744e=function(_0x817d9b,_0x3c37e3){_0x817d9b=_0x817d9b-0x0;var _0x2752e1=_0x44e7[_0x817d9b];return _0x2752e1;};'use strict';var _=require(_0x744e('0x0'));var util=require('util');var moment=require(_0x744e('0x1'));var BPromise=require(_0x744e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x744e('0x3'));var db=require(_0x744e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x744e('0x5'))(_0x744e('0x6'));var config=require(_0x744e('0x7'));var jayson=require(_0x744e('0x8'));var client=jayson[_0x744e('0x9')][_0x744e('0xa')]({'port':0x232a});config[_0x744e('0xb')]=_['defaults'](config[_0x744e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x744e('0xc'))(new Redis(config[_0x744e('0xb')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x273ece,_0x2beed6,_0x543956){return new BPromise(function(_0x58a57d,_0x50cda9){return client[_0x744e('0xd')](_0x273ece,_0x543956)[_0x744e('0xe')](function(_0x43d705){logger['info'](_0x744e('0xf'),_0x2beed6,'request\x20sent');logger[_0x744e('0x10')](_0x744e('0x11'),_0x2beed6,'request\x20sent',JSON[_0x744e('0x12')](_0x43d705));if(_0x43d705['error']){if(_0x43d705[_0x744e('0x13')][_0x744e('0x14')]===0x1f4){logger[_0x744e('0x13')](_0x744e('0xf'),_0x2beed6,_0x43d705['error']['message']);return _0x50cda9(_0x43d705['error'][_0x744e('0x15')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x2beed6,_0x43d705[_0x744e('0x13')]['message']);return _0x58a57d(_0x43d705[_0x744e('0x13')][_0x744e('0x15')]);}else{logger[_0x744e('0x16')](_0x744e('0xf'),_0x2beed6,_0x744e('0x17'));_0x58a57d(_0x43d705[_0x744e('0x18')][_0x744e('0x15')]);}})[_0x744e('0x19')](function(_0x179be0){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x2beed6,_0x179be0);_0x50cda9(_0x179be0);});});}exports[_0x744e('0x1a')]=function(_0x3c816d){var _0x4d08b4=this;return new Promise(function(_0x3d4419,_0x4404e3){return db[_0x744e('0x1b')][_0x744e('0x1c')](_0x3c816d[_0x744e('0x1d')],{'raw':_0x3c816d['options']?_0x3c816d[_0x744e('0x1e')][_0x744e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c816d[_0x744e('0x1e')]?_0x3c816d[_0x744e('0x1e')]['where']||null:null,'attributes':_0x3c816d[_0x744e('0x1e')]?_0x3c816d[_0x744e('0x1e')]['attributes']||null:null,'limit':_0x3c816d[_0x744e('0x1e')]?_0x3c816d[_0x744e('0x1e')][_0x744e('0x20')]||null:null})[_0x744e('0xe')](function(_0x40fe49){logger['info']('UpdateOpenchannelInteraction',_0x3c816d);logger[_0x744e('0x10')]('UpdateOpenchannelInteraction',_0x3c816d,JSON['stringify'](_0x40fe49));_0x3d4419(_0x40fe49);})[_0x744e('0x19')](function(_0x10cf93){logger[_0x744e('0x13')](_0x744e('0x1a'),_0x10cf93[_0x744e('0x15')],_0x3c816d);_0x4404e3(_0x4d08b4[_0x744e('0x13')](0x1f4,_0x10cf93[_0x744e('0x15')]));});});};exports[_0x744e('0x21')]=function(_0xb4f9de){return new Promise(function(_0x1e7ce0,_0x4f9fa6){return db['OpenchannelInteraction'][_0x744e('0x22')]({'where':_0xb4f9de['options']?_0xb4f9de[_0x744e('0x1e')]['where']||null:null})['then'](function(_0x3df349){if(_0x3df349){return _0x3df349[_0x744e('0x23')](_0xb4f9de['body'][_0x744e('0x24')],_['omit'](_0xb4f9de[_0x744e('0x1d')],[_0x744e('0x24'),'id'])||{});}})['spread'](function(_0x5d476e){logger[_0x744e('0x16')](_0x744e('0x25'),_0xb4f9de);logger[_0x744e('0x10')](_0x744e('0x25'),_0xb4f9de,JSON[_0x744e('0x12')](_0x5d476e));_0x1e7ce0(_0x5d476e);})[_0x744e('0x19')](function(_0x54c00a){logger[_0x744e('0x13')]('AddTags',_0x54c00a[_0x744e('0x15')],_0xb4f9de);_0x4f9fa6(_this[_0x744e('0x13')](0x1f4,_0x54c00a[_0x744e('0x15')]));});});}; \ No newline at end of file +var _0xf577=['socket.io-emitter','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','OpenchannelInteraction','update','body','options','raw','where','limit','UpdateOpenchannelInteraction','debug','stringify','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','AddTags','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf577,0x142));var _0x7f57=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xf577[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x7f57('0x0'));var util=require('util');var moment=require(_0x7f57('0x1'));var BPromise=require('bluebird');var rs=require(_0x7f57('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f57('0x3'))['db'];var utils=require(_0x7f57('0x4'));var logger=require(_0x7f57('0x5'))(_0x7f57('0x6'));var config=require(_0x7f57('0x7'));var jayson=require(_0x7f57('0x8'));var client=jayson[_0x7f57('0x9')][_0x7f57('0xa')]({'port':0x232a});config['redis']=_[_0x7f57('0xb')](config[_0x7f57('0xc')],{'host':_0x7f57('0xd'),'port':0x18eb});var socket=require(_0x7f57('0xe'))(new Redis(config[_0x7f57('0xc')]));require('./openchannelInteraction.socket')[_0x7f57('0xf')](socket);function respondWithRpcPromise(_0x2a5cf2,_0x3379d7,_0x146643){return new BPromise(function(_0x46efe7,_0x170170){return client[_0x7f57('0x10')](_0x2a5cf2,_0x146643)[_0x7f57('0x11')](function(_0x1e6e2f){logger['info'](_0x7f57('0x12'),_0x3379d7,_0x7f57('0x13'));logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x3379d7,'request\x20sent',JSON['stringify'](_0x1e6e2f));if(_0x1e6e2f['error']){if(_0x1e6e2f[_0x7f57('0x14')][_0x7f57('0x15')]===0x1f4){logger[_0x7f57('0x14')](_0x7f57('0x12'),_0x3379d7,_0x1e6e2f[_0x7f57('0x14')][_0x7f57('0x16')]);return _0x170170(_0x1e6e2f[_0x7f57('0x14')]['message']);}logger[_0x7f57('0x14')](_0x7f57('0x12'),_0x3379d7,_0x1e6e2f['error'][_0x7f57('0x16')]);return _0x46efe7(_0x1e6e2f[_0x7f57('0x14')]['message']);}else{logger[_0x7f57('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3379d7,_0x7f57('0x13'));_0x46efe7(_0x1e6e2f[_0x7f57('0x18')]['message']);}})[_0x7f57('0x19')](function(_0x168847){logger[_0x7f57('0x14')](_0x7f57('0x12'),_0x3379d7,_0x168847);_0x170170(_0x168847);});});}exports['UpdateOpenchannelInteraction']=function(_0x51e594){var _0x42d3ff=this;return new Promise(function(_0x2957e7,_0x95a1e2){return db[_0x7f57('0x1a')][_0x7f57('0x1b')](_0x51e594[_0x7f57('0x1c')],{'raw':_0x51e594['options']?_0x51e594[_0x7f57('0x1d')][_0x7f57('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51e594[_0x7f57('0x1d')]?_0x51e594['options'][_0x7f57('0x1f')]||null:null,'attributes':_0x51e594[_0x7f57('0x1d')]?_0x51e594[_0x7f57('0x1d')]['attributes']||null:null,'limit':_0x51e594[_0x7f57('0x1d')]?_0x51e594[_0x7f57('0x1d')][_0x7f57('0x20')]||null:null})[_0x7f57('0x11')](function(_0x37ff1b){logger[_0x7f57('0x17')](_0x7f57('0x21'),_0x51e594);logger[_0x7f57('0x22')](_0x7f57('0x21'),_0x51e594,JSON[_0x7f57('0x23')](_0x37ff1b));_0x2957e7(_0x37ff1b);})[_0x7f57('0x19')](function(_0x16376b){logger[_0x7f57('0x14')](_0x7f57('0x21'),_0x16376b['message'],_0x51e594);_0x95a1e2(_0x42d3ff[_0x7f57('0x14')](0x1f4,_0x16376b[_0x7f57('0x16')]));});});};exports[_0x7f57('0x24')]=function(_0x2bf2b0){return new Promise(function(_0x41cffc,_0x2d57a8){return db[_0x7f57('0x1a')][_0x7f57('0x25')]({'where':_0x2bf2b0[_0x7f57('0x1d')]?_0x2bf2b0[_0x7f57('0x1d')][_0x7f57('0x1f')]||null:null})[_0x7f57('0x11')](function(_0xa73712){if(_0xa73712){return _0xa73712[_0x7f57('0x26')](_0x2bf2b0[_0x7f57('0x1c')][_0x7f57('0x27')],_[_0x7f57('0x28')](_0x2bf2b0['body'],['ids','id'])||{});}})['spread'](function(_0x20502f){logger[_0x7f57('0x17')]('AddTags',_0x2bf2b0);logger[_0x7f57('0x22')](_0x7f57('0x29'),_0x2bf2b0,JSON[_0x7f57('0x23')](_0x20502f));_0x41cffc(_0x20502f);})[_0x7f57('0x19')](function(_0xc107ac){logger[_0x7f57('0x14')](_0x7f57('0x29'),_0xc107ac[_0x7f57('0x16')],_0x2bf2b0);_0x2d57a8(_this[_0x7f57('0x14')](0x1f4,_0xc107ac[_0x7f57('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 84ee73c..68a1115 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 _0x1728=['remove','update','removeListener','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0xbb5e97,_0x1311a3){var _0x42b932=function(_0x5adef1){while(--_0x5adef1){_0xbb5e97['push'](_0xbb5e97['shift']());}};_0x42b932(++_0x1311a3);}(_0x1728,0x160));var _0x8172=function(_0x451057,_0x185df4){_0x451057=_0x451057-0x0;var _0x5227ac=_0x1728[_0x451057];return _0x5227ac;};'use strict';var OpenchannelInteractionEvents=require(_0x8172('0x0'));var events=[_0x8172('0x1'),_0x8172('0x2'),_0x8172('0x3')];function createListener(_0x3c956c,_0x8cc50d){return function(_0x429b52){_0x8cc50d['emit'](_0x3c956c,_0x429b52);};}function removeListener(_0x522017,_0x4cb5f6){return function(){OpenchannelInteractionEvents[_0x8172('0x4')](_0x522017,_0x4cb5f6);};}exports['register']=function(_0x20b02c){for(var _0x4f48f3=0x0,_0xeddb15=events['length'];_0x4f48f3<_0xeddb15;_0x4f48f3++){var _0x52da7b=events[_0x4f48f3];var _0x1ed805=createListener(_0x8172('0x5')+_0x52da7b,_0x20b02c);OpenchannelInteractionEvents['on'](_0x52da7b,_0x1ed805);}}; \ No newline at end of file +var _0xd162=['update','emit','removeListener','register','length','openchannelInteraction:','save','remove'];(function(_0x460c04,_0x2ed2e2){var _0x51bd63=function(_0x4db764){while(--_0x4db764){_0x460c04['push'](_0x460c04['shift']());}};_0x51bd63(++_0x2ed2e2);}(_0xd162,0xd6));var _0x2d16=function(_0x1bf611,_0x5a169b){_0x1bf611=_0x1bf611-0x0;var _0x46c450=_0xd162[_0x1bf611];return _0x46c450;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x2d16('0x0'),_0x2d16('0x1'),_0x2d16('0x2')];function createListener(_0x1b591a,_0x3b4602){return function(_0x1a5ee4){_0x3b4602[_0x2d16('0x3')](_0x1b591a,_0x1a5ee4);};}function removeListener(_0x182355,_0x4718e4){return function(){OpenchannelInteractionEvents[_0x2d16('0x4')](_0x182355,_0x4718e4);};}exports[_0x2d16('0x5')]=function(_0x5552e8){for(var _0x117933=0x0,_0x4a594d=events[_0x2d16('0x6')];_0x117933<_0x4a594d;_0x117933++){var _0x41f083=events[_0x117933];var _0x2ce755=createListener(_0x2d16('0x7')+_0x41f083,_0x5552e8);OpenchannelInteractionEvents['on'](_0x41f083,_0x2ce755);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index e15df78..f26a1df 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 _0xd551=['isAuthenticated','index','/describe','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','delete','/:id','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x17e47c,_0x1485a6){var _0x3d2f=function(_0x53bcdf){while(--_0x53bcdf){_0x17e47c['push'](_0x17e47c['shift']());}};_0x3d2f(++_0x1485a6);}(_0xd551,0x1a7));var _0x1d55=function(_0x13164e,_0x25ebb9){_0x13164e=_0x13164e-0x0;var _0x562f24=_0xd551[_0x13164e];return _0x562f24;};'use strict';var multer=require(_0x1d55('0x0'));var util=require(_0x1d55('0x1'));var path=require('path');var timeout=require(_0x1d55('0x2'));var express=require(_0x1d55('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1d55('0x4'));var interaction=require(_0x1d55('0x5'));var config=require(_0x1d55('0x6'));var controller=require(_0x1d55('0x7'));router[_0x1d55('0x8')]('/',auth[_0x1d55('0x9')](),controller[_0x1d55('0xa')]);router[_0x1d55('0x8')](_0x1d55('0xb'),auth[_0x1d55('0x9')](),controller['describe']);router[_0x1d55('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1d55('0xc')]);router[_0x1d55('0xd')]('/',auth[_0x1d55('0x9')](),interaction[_0x1d55('0xe')](_0x1d55('0xf'),_0x1d55('0x10')),controller[_0x1d55('0x11')]);router['put']('/:id',auth[_0x1d55('0x9')](),controller[_0x1d55('0x12')]);router[_0x1d55('0x13')](_0x1d55('0x14'),auth[_0x1d55('0x9')](),controller[_0x1d55('0x15')]);router[_0x1d55('0x13')](_0x1d55('0x16'),auth[_0x1d55('0x9')](),controller['reject']);router[_0x1d55('0x17')](_0x1d55('0x18'),auth['isAuthenticated'](),controller[_0x1d55('0x19')]);module[_0x1d55('0x1a')]=router; \ No newline at end of file +var _0xfbd6=['connect-timeout','Router','../../components/auth/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','openchannelmessage:create','create','put','/:id/accept','accept','delete','exports','multer','util','path'];(function(_0x51e1bd,_0x351e1a){var _0x2e6401=function(_0x35fd1f){while(--_0x35fd1f){_0x51e1bd['push'](_0x51e1bd['shift']());}};_0x2e6401(++_0x351e1a);}(_0xfbd6,0x1b2));var _0x6fbd=function(_0x3f91a3,_0x1d07fc){_0x3f91a3=_0x3f91a3-0x0;var _0x534712=_0xfbd6[_0x3f91a3];return _0x534712;};'use strict';var multer=require(_0x6fbd('0x0'));var util=require(_0x6fbd('0x1'));var path=require(_0x6fbd('0x2'));var timeout=require(_0x6fbd('0x3'));var express=require('express');var router=express[_0x6fbd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6fbd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6fbd('0x6'));var controller=require(_0x6fbd('0x7'));router[_0x6fbd('0x8')]('/',auth[_0x6fbd('0x9')](),controller['index']);router[_0x6fbd('0x8')](_0x6fbd('0xa'),auth[_0x6fbd('0x9')](),controller[_0x6fbd('0xb')]);router[_0x6fbd('0x8')](_0x6fbd('0xc'),auth[_0x6fbd('0x9')](),controller[_0x6fbd('0xd')]);router[_0x6fbd('0xe')]('/',auth[_0x6fbd('0x9')](),interaction[_0x6fbd('0xf')]('openchannel',_0x6fbd('0x10')),controller[_0x6fbd('0x11')]);router[_0x6fbd('0x12')](_0x6fbd('0xc'),auth[_0x6fbd('0x9')](),controller['update']);router[_0x6fbd('0x12')](_0x6fbd('0x13'),auth[_0x6fbd('0x9')](),controller[_0x6fbd('0x14')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0x6fbd('0x15')](_0x6fbd('0xc'),auth[_0x6fbd('0x9')](),controller['destroy']);module[_0x6fbd('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 55de585..7c58174 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 _0x6696=['BOOLEAN','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x6696,0xb4));var _0x6669=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x6696[_0x16d10f];return _0x50c823;};'use strict';var Sequelize=require(_0x6669('0x0'));module[_0x6669('0x1')]={'body':{'type':Sequelize[_0x6669('0x2')](_0x6669('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x6669('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x6669('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x6669('0x6')]},'providerName':{'type':Sequelize[_0x6669('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x2c9f=['ENUM','out','STRING','TEXT','sequelize','medium','BOOLEAN'];(function(_0xd1f854,_0x532346){var _0x548294=function(_0x4be823){while(--_0x4be823){_0xd1f854['push'](_0xd1f854['shift']());}};_0x548294(++_0x532346);}(_0x2c9f,0x1ee));var _0xf2c9=function(_0x1d5292,_0x1d2c55){_0x1d5292=_0x1d5292-0x0;var _0xb24ca=_0x2c9f[_0x1d5292];return _0xb24ca;};'use strict';var Sequelize=require(_0xf2c9('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xf2c9('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xf2c9('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf2c9('0x3')]('in','out'),'defaultValue':_0xf2c9('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xf2c9('0x5')]},'providerResponse':{'type':Sequelize[_0xf2c9('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index e831e5d..46f98c2 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 _0xf4eb=['./openchannelMessage.socket','register','jayson/promise','client','http','request','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','OpenchannelMessage,\x20%s,\x20%s','message','info','result','status','offset','limit','undefined','count','set','json','apply','reject','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','where','pick','filter','merge','VIRTUAL','options','OpenchannelMessage','includeAll','include','findAll','rows','catch','show','filters','length','create','update','body','find','params','describe','../../config/logger','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','OpenchannelInteraction','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','acceptMessage','startsWith','push','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','manual','interface','format','channel','event','EventManager','acceptmessage','openchannel-interactions','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','cf_','Sequelize','contact','rejectmessage','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter'];(function(_0x3db464,_0x53fd4e){var _0x81faa2=function(_0x98fc91){while(--_0x98fc91){_0x3db464['push'](_0x3db464['shift']());}};_0x81faa2(++_0x53fd4e);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2caf8f,_0x1474e7){_0x2caf8f=_0x2caf8f-0x0;var _0x17597c=_0xf4eb[_0x2caf8f];return _0x17597c;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];config[_0xbf4e('0x13')]=_['defaults'](config['redis'],{'host':_0xbf4e('0x14'),'port':0x18eb});var socket=require(_0xbf4e('0x15'))(new Redis(config[_0xbf4e('0x13')]));require(_0xbf4e('0x16'))[_0xbf4e('0x17')](socket);var jayson=require(_0xbf4e('0x18'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xbf4e('0x19')][_0xbf4e('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x28fc6b,_0x542909,_0x14110b,_0x2c292c){return new BPromise(function(_0x912fc0,_0x320e7d){var _0x5a631e=_0x2c292c||client;return _0x5a631e[_0xbf4e('0x1b')](_0x28fc6b,_0x14110b)['then'](function(_0x5db03f){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x542909,_0xbf4e('0x1c'));logger[_0xbf4e('0x1d')](_0xbf4e('0x1e'),_0x542909,'request\x20sent',JSON['stringify'](_0x5db03f));if(_0x5db03f[_0xbf4e('0x1f')]){if(_0x5db03f[_0xbf4e('0x1f')][_0xbf4e('0x20')]===0x1f4){logger[_0xbf4e('0x1f')](_0xbf4e('0x21'),_0x542909,_0x5db03f[_0xbf4e('0x1f')][_0xbf4e('0x22')]);return _0x320e7d(_0x5db03f[_0xbf4e('0x1f')][_0xbf4e('0x22')]);}logger[_0xbf4e('0x1f')](_0xbf4e('0x21'),_0x542909,_0x5db03f['error'][_0xbf4e('0x22')]);return _0x912fc0(_0x5db03f[_0xbf4e('0x1f')]['message']);}else{logger[_0xbf4e('0x23')](_0xbf4e('0x21'),_0x542909,_0xbf4e('0x1c'));_0x912fc0(_0x5db03f[_0xbf4e('0x24')][_0xbf4e('0x22')]);}})['catch'](function(_0x90635e){logger[_0xbf4e('0x1f')](_0xbf4e('0x21'),_0x542909,_0x90635e);_0x320e7d(_0x90635e);});});}function respondWithStatusCode(_0x5766d4,_0x2fb490){_0x2fb490=_0x2fb490||0xcc;return function(_0x5e08b1){if(_0x5e08b1){return _0x5766d4['sendStatus'](_0x2fb490);}return _0x5766d4[_0xbf4e('0x25')](_0x2fb490)['end']();};}function respondWithResult(_0x38c923,_0x315df3){_0x315df3=_0x315df3||0xc8;return function(_0x4021a9){if(_0x4021a9){return _0x38c923[_0xbf4e('0x25')](_0x315df3)['json'](_0x4021a9);}};}function respondWithFilteredResult(_0x2d4686,_0x8e0ab5){return function(_0x43879d){if(_0x43879d){var _0x4cd4a1=typeof _0x8e0ab5[_0xbf4e('0x26')]==='undefined'&&typeof _0x8e0ab5[_0xbf4e('0x27')]===_0xbf4e('0x28');var _0xb8b58e=_0x43879d['count'];var _0x1d12e2=_0x4cd4a1?0x0:_0x8e0ab5[_0xbf4e('0x26')];var _0x2f3cf8=_0x4cd4a1?_0x43879d[_0xbf4e('0x29')]:_0x8e0ab5[_0xbf4e('0x26')]+_0x8e0ab5[_0xbf4e('0x27')];var _0x5a7c71;if(_0x2f3cf8>=_0xb8b58e){_0x2f3cf8=_0xb8b58e;_0x5a7c71=0xc8;}else{_0x5a7c71=0xce;}_0x2d4686[_0xbf4e('0x25')](_0x5a7c71);return _0x2d4686[_0xbf4e('0x2a')]('Content-Range',_0x1d12e2+'-'+_0x2f3cf8+'/'+_0xb8b58e)[_0xbf4e('0x2b')](_0x43879d);}return null;};}function patchUpdates(_0x26a375){return function(_0x5473ed){try{jsonpatch[_0xbf4e('0x2c')](_0x5473ed,_0x26a375,!![]);}catch(_0x5d8285){return BPromise[_0xbf4e('0x2d')](_0x5d8285);}return _0x5473ed['save']();};}function saveUpdates(_0x2f49d8,_0x2f5a2b){return function(_0x83e0ef){if(_0x83e0ef){return _0x83e0ef['update'](_0x2f49d8)[_0xbf4e('0x2e')](function(_0x32996d){return _0x32996d;});}return null;};}function removeEntity(_0x70c54f,_0x29d6aa){return function(_0xb93672){if(_0xb93672){return _0xb93672[_0xbf4e('0x2f')]()['then'](function(){_0x70c54f[_0xbf4e('0x25')](0xcc)[_0xbf4e('0x30')]();});}};}function handleEntityNotFound(_0x25b837,_0x3bba55){return function(_0x31d49a){if(!_0x31d49a){_0x25b837['sendStatus'](0x194);}return _0x31d49a;};}function handleError(_0x4864bd,_0x4b733d){_0x4b733d=_0x4b733d||0x1f4;return function(_0x4be59a){logger[_0xbf4e('0x1f')](_0x4be59a[_0xbf4e('0x31')]);if(_0x4be59a[_0xbf4e('0x32')]){delete _0x4be59a[_0xbf4e('0x32')];}_0x4864bd[_0xbf4e('0x25')](_0x4b733d)[_0xbf4e('0x33')](_0x4be59a);};}exports[_0xbf4e('0x34')]=function(_0x467b74,_0x1f36aa){var _0x54527d={},_0x4f6e93={},_0x303fd8={'count':0x0,'rows':[]};var _0x2b25d2=_[_0xbf4e('0x35')](db['OpenchannelMessage'][_0xbf4e('0x36')],function(_0x4e72a2){return{'name':_0x4e72a2[_0xbf4e('0x37')],'type':_0x4e72a2[_0xbf4e('0x38')][_0xbf4e('0x39')]};});_0x4f6e93[_0xbf4e('0x3a')]=_['map'](_0x2b25d2,_0xbf4e('0x32'));_0x4f6e93[_0xbf4e('0x3b')]=_[_0xbf4e('0x3c')](_0x467b74[_0xbf4e('0x3b')]);_0x4f6e93['filters']=_[_0xbf4e('0x3d')](_0x4f6e93[_0xbf4e('0x3a')],_0x4f6e93[_0xbf4e('0x3b')]);_0x54527d[_0xbf4e('0x3e')]=_[_0xbf4e('0x3d')](_0x4f6e93[_0xbf4e('0x3a')],qs[_0xbf4e('0x3f')](_0x467b74['query'][_0xbf4e('0x3f')]));_0x54527d[_0xbf4e('0x3e')]=_0x54527d['attributes']['length']?_0x54527d[_0xbf4e('0x3e')]:_0x4f6e93[_0xbf4e('0x3a')];if(!_0x467b74['query']['hasOwnProperty'](_0xbf4e('0x40'))){_0x54527d[_0xbf4e('0x27')]=qs[_0xbf4e('0x27')](_0x467b74[_0xbf4e('0x3b')][_0xbf4e('0x27')]);_0x54527d[_0xbf4e('0x26')]=qs['offset'](_0x467b74[_0xbf4e('0x3b')][_0xbf4e('0x26')]);}_0x54527d['order']=qs['sort'](_0x467b74['query']['sort']);_0x54527d[_0xbf4e('0x41')]=qs['filters'](_[_0xbf4e('0x42')](_0x467b74[_0xbf4e('0x3b')],_0x4f6e93['filters']),_0x2b25d2);if(_0x467b74['query'][_0xbf4e('0x43')]){_0x54527d[_0xbf4e('0x41')]=_[_0xbf4e('0x44')](_0x54527d[_0xbf4e('0x41')],{'$or':_[_0xbf4e('0x35')](_0x2b25d2,function(_0x52cf6a){if(_0x52cf6a[_0xbf4e('0x38')]!==_0xbf4e('0x45')){var _0xd3a88a={};_0xd3a88a[_0x52cf6a[_0xbf4e('0x32')]]={'$like':'%'+_0x467b74[_0xbf4e('0x3b')][_0xbf4e('0x43')]+'%'};return _0xd3a88a;}})});}_0x54527d=_[_0xbf4e('0x44')]({},_0x54527d,_0x467b74[_0xbf4e('0x46')]);var _0x47c0c9={'where':_0x54527d[_0xbf4e('0x41')]};return db[_0xbf4e('0x47')][_0xbf4e('0x29')](_0x47c0c9)[_0xbf4e('0x2e')](function(_0x9bc1fe){_0x303fd8[_0xbf4e('0x29')]=_0x9bc1fe;if(_0x467b74[_0xbf4e('0x3b')][_0xbf4e('0x48')]){_0x54527d[_0xbf4e('0x49')]=[{'all':!![]}];}return db[_0xbf4e('0x47')][_0xbf4e('0x4a')](_0x54527d);})[_0xbf4e('0x2e')](function(_0x370d4c){_0x303fd8[_0xbf4e('0x4b')]=_0x370d4c;return _0x303fd8;})[_0xbf4e('0x2e')](respondWithFilteredResult(_0x1f36aa,_0x54527d))[_0xbf4e('0x4c')](handleError(_0x1f36aa,null));};exports[_0xbf4e('0x4d')]=function(_0x5492bf,_0x22d8ef){var _0x17a7be={'raw':!![],'where':{'id':_0x5492bf['params']['id']}},_0x348fbd={};_0x348fbd[_0xbf4e('0x3a')]=_['keys'](db['OpenchannelMessage'][_0xbf4e('0x36')]);_0x348fbd[_0xbf4e('0x3b')]=_['keys'](_0x5492bf[_0xbf4e('0x3b')]);_0x348fbd[_0xbf4e('0x4e')]=_[_0xbf4e('0x3d')](_0x348fbd[_0xbf4e('0x3a')],_0x348fbd[_0xbf4e('0x3b')]);_0x17a7be[_0xbf4e('0x3e')]=_[_0xbf4e('0x3d')](_0x348fbd[_0xbf4e('0x3a')],qs[_0xbf4e('0x3f')](_0x5492bf[_0xbf4e('0x3b')][_0xbf4e('0x3f')]));_0x17a7be['attributes']=_0x17a7be['attributes'][_0xbf4e('0x4f')]?_0x17a7be[_0xbf4e('0x3e')]:_0x348fbd[_0xbf4e('0x3a')];if(_0x5492bf['query'][_0xbf4e('0x48')]){_0x17a7be[_0xbf4e('0x49')]=[{'all':!![]}];}_0x17a7be=_['merge']({},_0x17a7be,_0x5492bf['options']);return db[_0xbf4e('0x47')]['find'](_0x17a7be)['then'](handleEntityNotFound(_0x22d8ef,null))[_0xbf4e('0x2e')](respondWithResult(_0x22d8ef,null))[_0xbf4e('0x4c')](handleError(_0x22d8ef,null));};exports[_0xbf4e('0x50')]=function(_0x43cfd7,_0x6ff233){return db['OpenchannelMessage'][_0xbf4e('0x50')](_0x43cfd7['body'],{})[_0xbf4e('0x2e')](respondWithResult(_0x6ff233,0xc9))['catch'](handleError(_0x6ff233,null));};exports[_0xbf4e('0x51')]=function(_0x57a247,_0xab6991){if(_0x57a247[_0xbf4e('0x52')]['id']){delete _0x57a247[_0xbf4e('0x52')]['id'];}return db[_0xbf4e('0x47')][_0xbf4e('0x53')]({'where':{'id':_0x57a247['params']['id']}})['then'](handleEntityNotFound(_0xab6991,null))['then'](saveUpdates(_0x57a247['body'],null))[_0xbf4e('0x2e')](respondWithResult(_0xab6991,null))[_0xbf4e('0x4c')](handleError(_0xab6991,null));};exports['destroy']=function(_0x200096,_0x23c335){return db[_0xbf4e('0x47')][_0xbf4e('0x53')]({'where':{'id':_0x200096[_0xbf4e('0x54')]['id']}})[_0xbf4e('0x2e')](handleEntityNotFound(_0x23c335,null))[_0xbf4e('0x2e')](removeEntity(_0x23c335,null))['catch'](handleError(_0x23c335,null));};exports[_0xbf4e('0x55')]=function(_0x137df1,_0x42e117){return db['OpenchannelMessage']['describe']()[_0xbf4e('0x2e')](respondWithResult(_0x42e117,null))[_0xbf4e('0x4c')](handleError(_0x42e117,null));};var interaction_log=require(_0xbf4e('0x56'))('openchannel-interactions');exports[_0xbf4e('0x57')]=function(_0x3d0f2c,_0x1757e4,_0x4039a4){var _0x18920e={'agent':{},'channel':_0xbf4e('0x58')};if(_0x3d0f2c[_0xbf4e('0x52')]['id']){delete _0x3d0f2c[_0xbf4e('0x52')]['id'];}_0x3d0f2c[_0xbf4e('0x52')][_0xbf4e('0x59')]=!![];_0x3d0f2c[_0xbf4e('0x52')][_0xbf4e('0x5a')]=moment()['format'](_0xbf4e('0x5b'));_0x3d0f2c['body'][_0xbf4e('0x5c')]=_0x3d0f2c[_0xbf4e('0x52')][_0xbf4e('0x5c')]||_0x3d0f2c[_0xbf4e('0x5d')]['id'];_0x18920e[_0xbf4e('0x5e')]['id']=_0x3d0f2c[_0xbf4e('0x52')][_0xbf4e('0x5c')];return db[_0xbf4e('0x47')]['find']({'where':{'id':_0x3d0f2c[_0xbf4e('0x54')]['id'],'UserId':null},'include':[{'model':db[_0xbf4e('0x5f')],'as':_0xbf4e('0x60')}]})[_0xbf4e('0x2e')](handleEntityNotFound(_0x1757e4,null))[_0xbf4e('0x2e')](saveUpdates(_0x3d0f2c['body'],null))[_0xbf4e('0x2e')](function(_0x753f25){if(_0x753f25){_0x18920e[_0xbf4e('0x22')]=_0x753f25[_0xbf4e('0x61')]({'plain':!![]});return db[_0xbf4e('0x62')][_0xbf4e('0x53')]({'where':{'id':_0x753f25['OpenchannelInteractionId']}});}return null;})[_0xbf4e('0x2e')](handleEntityNotFound(_0x1757e4,null))['then'](function(_0x21d6e3){if(_0x21d6e3){return _0x21d6e3[_0xbf4e('0x51')]({'UserId':_0x3d0f2c[_0xbf4e('0x52')][_0xbf4e('0x5c')],'read1stAt':_['isNil'](_0x21d6e3[_0xbf4e('0x63')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xbf4e('0x2e')](function(_0x1213da){if(_0x1213da){_0x18920e[_0xbf4e('0x64')]=_0x1213da['get']({'plain':!![]});interaction_log[_0xbf4e('0x23')](_0xbf4e('0x65'),_0x3d0f2c['user']['id'],_0x3d0f2c[_0xbf4e('0x5d')][_0xbf4e('0x32')],_0x3d0f2c[_0xbf4e('0x5d')][_0xbf4e('0x66')],_0x18920e[_0xbf4e('0x64')]['id'],_0x3d0f2c[_0xbf4e('0x52')]?JSON[_0xbf4e('0x67')](_0x3d0f2c[_0xbf4e('0x52')]):_0xbf4e('0x68'));return respondWithRpcPromise('AcceptMessage',_0xbf4e('0x69'),_0x18920e);}return null;})[_0xbf4e('0x2e')](function(_0x2b2545){return db[_0xbf4e('0x5f')]['describe']()[_0xbf4e('0x2e')](function(_0x667836){var _0x40e566=[];for(var _0x25ce0d=0x0;_0x25ce0d=_0x24114a){_0x1b27d8=_0x24114a;_0xdd7cc1=0xc8;}else{_0xdd7cc1=0xce;}_0x5d772a[_0x6e70('0x30')](_0xdd7cc1);return _0x5d772a[_0x6e70('0x36')]('Content-Range',_0x3a5d30+'-'+_0x1b27d8+'/'+_0x24114a)[_0x6e70('0x31')](_0x406f29);}return null;};}function patchUpdates(_0x42b094){return function(_0x5780a1){try{jsonpatch[_0x6e70('0x37')](_0x5780a1,_0x42b094,!![]);}catch(_0x154925){return BPromise['reject'](_0x154925);}return _0x5780a1[_0x6e70('0x38')]();};}function saveUpdates(_0x3665a1,_0x2d52bd){return function(_0x2723d7){if(_0x2723d7){return _0x2723d7[_0x6e70('0x39')](_0x3665a1)[_0x6e70('0x3a')](function(_0x44b19d){return _0x44b19d;});}return null;};}function removeEntity(_0x3f42bd,_0xf146fd){return function(_0x419a41){if(_0x419a41){return _0x419a41['destroy']()[_0x6e70('0x3a')](function(){_0x3f42bd['status'](0xcc)[_0x6e70('0x3b')]();});}};}function handleEntityNotFound(_0x3222a2,_0x98c683){return function(_0x32d12d){if(!_0x32d12d){_0x3222a2[_0x6e70('0x2f')](0x194);}return _0x32d12d;};}function handleError(_0x989b80,_0x2440be){_0x2440be=_0x2440be||0x1f4;return function(_0xdd0bee){logger[_0x6e70('0x2a')](_0xdd0bee[_0x6e70('0x3c')]);if(_0xdd0bee[_0x6e70('0x3d')]){delete _0xdd0bee[_0x6e70('0x3d')];}_0x989b80[_0x6e70('0x30')](_0x2440be)['send'](_0xdd0bee);};}exports['index']=function(_0x5424eb,_0x155a46){var _0x3841a0={},_0x2cb5b0={},_0x1f6955={'count':0x0,'rows':[]};var _0x1872e9=_[_0x6e70('0x3e')](db['OpenchannelMessage'][_0x6e70('0x3f')],function(_0x9e7ad2){return{'name':_0x9e7ad2[_0x6e70('0x40')],'type':_0x9e7ad2[_0x6e70('0x41')][_0x6e70('0x42')]};});_0x2cb5b0[_0x6e70('0x43')]=_[_0x6e70('0x3e')](_0x1872e9,_0x6e70('0x3d'));_0x2cb5b0['query']=_[_0x6e70('0x44')](_0x5424eb[_0x6e70('0x45')]);_0x2cb5b0[_0x6e70('0x46')]=_[_0x6e70('0x47')](_0x2cb5b0[_0x6e70('0x43')],_0x2cb5b0[_0x6e70('0x45')]);_0x3841a0[_0x6e70('0x48')]=_['intersection'](_0x2cb5b0['model'],qs['fields'](_0x5424eb[_0x6e70('0x45')][_0x6e70('0x49')]));_0x3841a0[_0x6e70('0x48')]=_0x3841a0[_0x6e70('0x48')][_0x6e70('0x4a')]?_0x3841a0['attributes']:_0x2cb5b0[_0x6e70('0x43')];if(!_0x5424eb[_0x6e70('0x45')][_0x6e70('0x4b')]('nolimit')){_0x3841a0['limit']=qs['limit'](_0x5424eb[_0x6e70('0x45')]['limit']);_0x3841a0[_0x6e70('0x32')]=qs[_0x6e70('0x32')](_0x5424eb[_0x6e70('0x45')][_0x6e70('0x32')]);}_0x3841a0['order']=qs[_0x6e70('0x4c')](_0x5424eb['query'][_0x6e70('0x4c')]);_0x3841a0[_0x6e70('0x4d')]=qs[_0x6e70('0x46')](_[_0x6e70('0x4e')](_0x5424eb['query'],_0x2cb5b0[_0x6e70('0x46')]),_0x1872e9);if(_0x5424eb[_0x6e70('0x45')][_0x6e70('0x4f')]){_0x3841a0[_0x6e70('0x4d')]=_[_0x6e70('0x50')](_0x3841a0[_0x6e70('0x4d')],{'$or':_[_0x6e70('0x3e')](_0x1872e9,function(_0x552e7e){if(_0x552e7e[_0x6e70('0x41')]!==_0x6e70('0x51')){var _0x10de2a={};_0x10de2a[_0x552e7e[_0x6e70('0x3d')]]={'$like':'%'+_0x5424eb[_0x6e70('0x45')][_0x6e70('0x4f')]+'%'};return _0x10de2a;}})});}_0x3841a0=_[_0x6e70('0x50')]({},_0x3841a0,_0x5424eb['options']);var _0x3f5c89={'where':_0x3841a0['where']};return db[_0x6e70('0x52')][_0x6e70('0x35')](_0x3f5c89)['then'](function(_0x53efc3){_0x1f6955[_0x6e70('0x35')]=_0x53efc3;if(_0x5424eb[_0x6e70('0x45')][_0x6e70('0x53')]){_0x3841a0['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x6e70('0x54')](_0x3841a0);})[_0x6e70('0x3a')](function(_0x22abc1){_0x1f6955[_0x6e70('0x55')]=_0x22abc1;return _0x1f6955;})[_0x6e70('0x3a')](respondWithFilteredResult(_0x155a46,_0x3841a0))[_0x6e70('0x2e')](handleError(_0x155a46,null));};exports['show']=function(_0x756a5b,_0x3aa1a6){var _0x219f4={'raw':!![],'where':{'id':_0x756a5b[_0x6e70('0x56')]['id']}},_0x6ed023={};_0x6ed023['model']=_['keys'](db[_0x6e70('0x52')][_0x6e70('0x3f')]);_0x6ed023[_0x6e70('0x45')]=_[_0x6e70('0x44')](_0x756a5b[_0x6e70('0x45')]);_0x6ed023['filters']=_[_0x6e70('0x47')](_0x6ed023[_0x6e70('0x43')],_0x6ed023[_0x6e70('0x45')]);_0x219f4[_0x6e70('0x48')]=_[_0x6e70('0x47')](_0x6ed023['model'],qs[_0x6e70('0x49')](_0x756a5b[_0x6e70('0x45')][_0x6e70('0x49')]));_0x219f4[_0x6e70('0x48')]=_0x219f4[_0x6e70('0x48')][_0x6e70('0x4a')]?_0x219f4['attributes']:_0x6ed023[_0x6e70('0x43')];if(_0x756a5b[_0x6e70('0x45')]['includeAll']){_0x219f4[_0x6e70('0x57')]=[{'all':!![]}];}_0x219f4=_[_0x6e70('0x50')]({},_0x219f4,_0x756a5b['options']);return db[_0x6e70('0x52')][_0x6e70('0x58')](_0x219f4)[_0x6e70('0x3a')](handleEntityNotFound(_0x3aa1a6,null))[_0x6e70('0x3a')](respondWithResult(_0x3aa1a6,null))[_0x6e70('0x2e')](handleError(_0x3aa1a6,null));};exports['create']=function(_0x385825,_0x2d1336){return db[_0x6e70('0x52')][_0x6e70('0x59')](_0x385825[_0x6e70('0x5a')],{})[_0x6e70('0x3a')](respondWithResult(_0x2d1336,0xc9))[_0x6e70('0x2e')](handleError(_0x2d1336,null));};exports[_0x6e70('0x39')]=function(_0x6043cd,_0x344676){if(_0x6043cd[_0x6e70('0x5a')]['id']){delete _0x6043cd[_0x6e70('0x5a')]['id'];}return db[_0x6e70('0x52')][_0x6e70('0x58')]({'where':{'id':_0x6043cd[_0x6e70('0x56')]['id']}})[_0x6e70('0x3a')](handleEntityNotFound(_0x344676,null))[_0x6e70('0x3a')](saveUpdates(_0x6043cd[_0x6e70('0x5a')],null))[_0x6e70('0x3a')](respondWithResult(_0x344676,null))[_0x6e70('0x2e')](handleError(_0x344676,null));};exports['destroy']=function(_0x28898a,_0x4434dd){return db[_0x6e70('0x52')][_0x6e70('0x58')]({'where':{'id':_0x28898a[_0x6e70('0x56')]['id']}})[_0x6e70('0x3a')](handleEntityNotFound(_0x4434dd,null))['then'](removeEntity(_0x4434dd,null))[_0x6e70('0x2e')](handleError(_0x4434dd,null));};exports[_0x6e70('0x5b')]=function(_0x4f813a,_0x246ea2){return db[_0x6e70('0x52')][_0x6e70('0x5b')]()['then'](respondWithResult(_0x246ea2,null))['catch'](handleError(_0x246ea2,null));};var interaction_log=require(_0x6e70('0x19'))(_0x6e70('0x5c'));exports[_0x6e70('0x5d')]=function(_0x41a861,_0x10d299,_0x739946){var _0x30cd88={'agent':{},'channel':'openchannel'};if(_0x41a861['body']['id']){delete _0x41a861[_0x6e70('0x5a')]['id'];}_0x41a861[_0x6e70('0x5a')][_0x6e70('0x5e')]=!![];_0x41a861[_0x6e70('0x5a')]['readAt']=moment()['format'](_0x6e70('0x5f'));_0x41a861[_0x6e70('0x5a')]['UserId']=_0x41a861['body'][_0x6e70('0x60')]||_0x41a861['user']['id'];_0x30cd88[_0x6e70('0x61')]['id']=_0x41a861[_0x6e70('0x5a')][_0x6e70('0x60')];return db[_0x6e70('0x52')][_0x6e70('0x58')]({'where':{'id':_0x41a861[_0x6e70('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x6e70('0x62')],'as':_0x6e70('0x63')}]})['then'](handleEntityNotFound(_0x10d299,null))[_0x6e70('0x3a')](saveUpdates(_0x41a861[_0x6e70('0x5a')],null))[_0x6e70('0x3a')](function(_0x346c79){if(_0x346c79){_0x30cd88[_0x6e70('0x2d')]=_0x346c79['get']({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x346c79[_0x6e70('0x64')]}});}return null;})[_0x6e70('0x3a')](handleEntityNotFound(_0x10d299,null))[_0x6e70('0x3a')](function(_0x4ed5ad){if(_0x4ed5ad){return _0x4ed5ad['update']({'UserId':_0x41a861[_0x6e70('0x5a')][_0x6e70('0x60')],'read1stAt':_[_0x6e70('0x65')](_0x4ed5ad[_0x6e70('0x66')])?moment()[_0x6e70('0x67')](_0x6e70('0x5f')):undefined});}return null;})['then'](function(_0x2d2855){if(_0x2d2855){_0x30cd88[_0x6e70('0x68')]=_0x2d2855[_0x6e70('0x69')]({'plain':!![]});interaction_log[_0x6e70('0x25')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x41a861[_0x6e70('0x6a')]['id'],_0x41a861['user']['name'],_0x41a861[_0x6e70('0x6a')][_0x6e70('0x6b')],_0x30cd88[_0x6e70('0x68')]['id'],_0x41a861[_0x6e70('0x5a')]?JSON[_0x6e70('0x29')](_0x41a861[_0x6e70('0x5a')]):'null');return respondWithRpcPromise(_0x6e70('0x6c'),_0x6e70('0x6d'),_0x30cd88);}return null;})[_0x6e70('0x3a')](function(_0x18e64c){return db[_0x6e70('0x62')][_0x6e70('0x5b')]()[_0x6e70('0x3a')](function(_0xd9b4a9){var _0x2f1362=[];for(var _0x29621a=0x0;_0x29621a=_0x4a149d){_0xa49d22=_0x4a149d;_0xaa00a3=0xc8;}else{_0xaa00a3=0xce;}_0x31a199[_0xd133('0x1d')](_0xaa00a3);return _0x31a199[_0xd133('0x23')](_0xd133('0x24'),_0x2e9ae5+'-'+_0xa49d22+'/'+_0x4a149d)[_0xd133('0x25')](_0x479eab);}return null;};}function patchUpdates(_0x10246a){return function(_0x55b0c3){try{jsonpatch[_0xd133('0x26')](_0x55b0c3,_0x10246a,!![]);}catch(_0x5ecd3b){return BPromise[_0xd133('0x27')](_0x5ecd3b);}return _0x55b0c3[_0xd133('0x28')]();};}function saveUpdates(_0x1bd818,_0x4c55d7){return function(_0x149f08){if(_0x149f08){return _0x149f08['update'](_0x1bd818)['then'](function(_0x30a883){return _0x30a883;});}return null;};}function removeEntity(_0x5aa02b,_0x4a1e7b){return function(_0x54244d){if(_0x54244d){return _0x54244d[_0xd133('0x29')]()[_0xd133('0x2a')](function(){var _0x59770f=_0x54244d[_0xd133('0x2b')]({'plain':!![]});var _0x25d993='OpenchannelQueues';return db[_0xd133('0x2c')][_0xd133('0x29')]({'where':{'type':_0x25d993,'resourceId':_0x59770f['id']}})[_0xd133('0x2a')](function(){return _0x54244d;});})['then'](function(){_0x5aa02b[_0xd133('0x1d')](0xcc)[_0xd133('0x1e')]();});}};}function handleEntityNotFound(_0xfc882e,_0x13cdb7){return function(_0x80159c){if(!_0x80159c){_0xfc882e['sendStatus'](0x194);}return _0x80159c;};}function handleError(_0x4bc14e,_0x52e285){_0x52e285=_0x52e285||0x1f4;return function(_0x3157ba){logger[_0xd133('0x2d')](_0x3157ba['stack']);if(_0x3157ba['name']){delete _0x3157ba[_0xd133('0x2e')];}_0x4bc14e[_0xd133('0x1d')](_0x52e285)['send'](_0x3157ba);};}exports[_0xd133('0x2f')]=function(_0x1a21fa,_0x3b953c){var _0x45eab0={},_0x15aeff={},_0x4da741={'count':0x0,'rows':[]};var _0x5e8582=_[_0xd133('0x30')](db[_0xd133('0x31')][_0xd133('0x32')],function(_0x23ef99){return{'name':_0x23ef99['fieldName'],'type':_0x23ef99[_0xd133('0x33')][_0xd133('0x34')]};});_0x15aeff[_0xd133('0x35')]=_['map'](_0x5e8582,'name');_0x15aeff[_0xd133('0x36')]=_[_0xd133('0x37')](_0x1a21fa[_0xd133('0x36')]);_0x15aeff[_0xd133('0x38')]=_[_0xd133('0x39')](_0x15aeff[_0xd133('0x35')],_0x15aeff[_0xd133('0x36')]);_0x45eab0[_0xd133('0x3a')]=_[_0xd133('0x39')](_0x15aeff[_0xd133('0x35')],qs[_0xd133('0x3b')](_0x1a21fa[_0xd133('0x36')]['fields']));_0x45eab0[_0xd133('0x3a')]=_0x45eab0[_0xd133('0x3a')]['length']?_0x45eab0[_0xd133('0x3a')]:_0x15aeff[_0xd133('0x35')];if(!_0x1a21fa[_0xd133('0x36')][_0xd133('0x3c')]('nolimit')){_0x45eab0[_0xd133('0x21')]=qs[_0xd133('0x21')](_0x1a21fa[_0xd133('0x36')]['limit']);_0x45eab0['offset']=qs[_0xd133('0x1f')](_0x1a21fa[_0xd133('0x36')][_0xd133('0x1f')]);}_0x45eab0['order']=qs[_0xd133('0x3d')](_0x1a21fa[_0xd133('0x36')]['sort']);_0x45eab0[_0xd133('0x3e')]=qs['filters'](_[_0xd133('0x3f')](_0x1a21fa[_0xd133('0x36')],_0x15aeff[_0xd133('0x38')]),_0x5e8582);if(_0x1a21fa[_0xd133('0x36')][_0xd133('0x40')]){_0x45eab0['where']=_[_0xd133('0x41')](_0x45eab0[_0xd133('0x3e')],{'$or':_[_0xd133('0x30')](_0x5e8582,function(_0x2da75e){if(_0x2da75e[_0xd133('0x33')]!==_0xd133('0x42')){var _0x3dcfcc={};_0x3dcfcc[_0x2da75e['name']]={'$like':'%'+_0x1a21fa[_0xd133('0x36')][_0xd133('0x40')]+'%'};return _0x3dcfcc;}})});}_0x45eab0=_[_0xd133('0x41')]({},_0x45eab0,_0x1a21fa['options']);var _0x2a894d={'where':_0x45eab0[_0xd133('0x3e')]};return db[_0xd133('0x31')][_0xd133('0x22')](_0x2a894d)['then'](function(_0x45a373){_0x4da741[_0xd133('0x22')]=_0x45a373;if(_0x1a21fa[_0xd133('0x36')][_0xd133('0x43')]){_0x45eab0[_0xd133('0x44')]=[{'all':!![]}];}return db[_0xd133('0x31')][_0xd133('0x45')](_0x45eab0);})[_0xd133('0x2a')](function(_0x4ff151){_0x4da741['rows']=_0x4ff151;return _0x4da741;})[_0xd133('0x2a')](respondWithFilteredResult(_0x3b953c,_0x45eab0))[_0xd133('0x46')](handleError(_0x3b953c,null));};exports[_0xd133('0x47')]=function(_0x9b9023,_0xfc6bfb){var _0x5d8c43={'raw':!![],'where':{'id':_0x9b9023[_0xd133('0x48')]['id']}},_0x441507={};_0x441507['model']=_[_0xd133('0x37')](db[_0xd133('0x31')][_0xd133('0x32')]);_0x441507[_0xd133('0x36')]=_['keys'](_0x9b9023[_0xd133('0x36')]);_0x441507[_0xd133('0x38')]=_[_0xd133('0x39')](_0x441507[_0xd133('0x35')],_0x441507[_0xd133('0x36')]);_0x5d8c43['attributes']=_['intersection'](_0x441507[_0xd133('0x35')],qs[_0xd133('0x3b')](_0x9b9023['query'][_0xd133('0x3b')]));_0x5d8c43[_0xd133('0x3a')]=_0x5d8c43[_0xd133('0x3a')][_0xd133('0x49')]?_0x5d8c43['attributes']:_0x441507[_0xd133('0x35')];if(_0x9b9023['query'][_0xd133('0x43')]){_0x5d8c43['include']=[{'all':!![]}];}_0x5d8c43=_[_0xd133('0x41')]({},_0x5d8c43,_0x9b9023[_0xd133('0x4a')]);return db[_0xd133('0x31')]['find'](_0x5d8c43)[_0xd133('0x2a')](handleEntityNotFound(_0xfc6bfb,null))[_0xd133('0x2a')](respondWithResult(_0xfc6bfb,null))[_0xd133('0x46')](handleError(_0xfc6bfb,null));};exports[_0xd133('0x4b')]=function(_0x50f9b7,_0x2738a5){return db['OpenchannelQueue'][_0xd133('0x4b')](_0x50f9b7[_0xd133('0x4c')],{})[_0xd133('0x2a')](function(_0x3aaaa3){var _0x55448f=_0x50f9b7[_0xd133('0x4d')][_0xd133('0x2b')]({'plain':!![]});if(!_0x55448f)throw new Error(_0xd133('0x4e'));if(_0x55448f[_0xd133('0x4f')]===_0xd133('0x4d')){var _0x276b7b=_0x3aaaa3['get']({'plain':!![]});var _0x16c16a=_0xd133('0x50');return db[_0xd133('0x51')][_0xd133('0x52')]({'where':{'name':_0x16c16a,'userProfileId':_0x55448f['userProfileId']},'raw':!![]})[_0xd133('0x2a')](function(_0x4cb04f){if(_0x4cb04f&&_0x4cb04f[_0xd133('0x53')]===0x0){return db[_0xd133('0x2c')][_0xd133('0x4b')]({'name':_0x276b7b[_0xd133('0x2e')],'resourceId':_0x276b7b['id'],'type':_0x4cb04f[_0xd133('0x2e')],'sectionId':_0x4cb04f['id']},{})['then'](function(){return _0x3aaaa3;});}else{return _0x3aaaa3;}})[_0xd133('0x46')](function(_0x2133f7){logger[_0xd133('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2133f7);throw _0x2133f7;});}return _0x3aaaa3;})[_0xd133('0x2a')](respondWithResult(_0x2738a5,0xc9))[_0xd133('0x46')](handleError(_0x2738a5,null));};exports[_0xd133('0x54')]=function(_0x3ed8e1,_0x4be4cf){if(_0x3ed8e1[_0xd133('0x4c')]['id']){delete _0x3ed8e1[_0xd133('0x4c')]['id'];}return db[_0xd133('0x31')][_0xd133('0x52')]({'where':{'id':_0x3ed8e1['params']['id']}})[_0xd133('0x2a')](handleEntityNotFound(_0x4be4cf,null))[_0xd133('0x2a')](saveUpdates(_0x3ed8e1[_0xd133('0x4c')],null))[_0xd133('0x2a')](respondWithResult(_0x4be4cf,null))[_0xd133('0x46')](handleError(_0x4be4cf,null));};exports[_0xd133('0x29')]=function(_0x3b2405,_0x167ba2){return db[_0xd133('0x31')][_0xd133('0x52')]({'where':{'id':_0x3b2405[_0xd133('0x48')]['id']}})[_0xd133('0x2a')](handleEntityNotFound(_0x167ba2,null))['then'](removeEntity(_0x167ba2,null))['catch'](handleError(_0x167ba2,null));};exports[_0xd133('0x55')]=function(_0x499f3e,_0x32ccec){return db[_0xd133('0x31')]['describe']()[_0xd133('0x2a')](respondWithResult(_0x32ccec,null))[_0xd133('0x46')](handleError(_0x32ccec,null));};exports[_0xd133('0x56')]=function(_0x2f64d0,_0x35c5b6,_0x4ac416){var _0x538c83={'raw':!![],'where':{}},_0x414d21={},_0x588c33;return db[_0xd133('0x31')][_0xd133('0x57')]({'where':{'id':_0x2f64d0['params']['id']}})[_0xd133('0x2a')](handleEntityNotFound(_0x35c5b6,null))[_0xd133('0x2a')](function(_0x14a418){if(_0x14a418){_0x588c33=_0x14a418[_0xd133('0x2b')]({'plain':!![]});_0x414d21[_0xd133('0x35')]=_['keys'](db['UserOpenchannelQueue'][_0xd133('0x32')]);_0x414d21[_0xd133('0x36')]=_[_0xd133('0x37')](_0x2f64d0[_0xd133('0x36')]);_0x414d21[_0xd133('0x38')]=_['intersection'](_0x414d21[_0xd133('0x35')],_0x414d21[_0xd133('0x36')]);_0x538c83[_0xd133('0x3a')]=_['intersection'](_0x414d21[_0xd133('0x35')],qs[_0xd133('0x3b')](_0x2f64d0[_0xd133('0x36')][_0xd133('0x3b')]));_0x538c83[_0xd133('0x3a')]=_0x538c83[_0xd133('0x3a')][_0xd133('0x49')]?_0x538c83[_0xd133('0x3a')]:_0x414d21['model'];if(!_0x2f64d0[_0xd133('0x36')][_0xd133('0x3c')]('nolimit')){_0x538c83['limit']=qs[_0xd133('0x21')](_0x2f64d0['query'][_0xd133('0x21')]);_0x538c83[_0xd133('0x1f')]=qs[_0xd133('0x1f')](_0x2f64d0[_0xd133('0x36')][_0xd133('0x1f')]);}_0x538c83[_0xd133('0x58')]=qs[_0xd133('0x3d')](_0x2f64d0['query'][_0xd133('0x3d')]);_0x538c83['where']=qs[_0xd133('0x38')](_[_0xd133('0x3f')](_0x2f64d0['query'],_0x414d21[_0xd133('0x38')]));_0x538c83[_0xd133('0x3e')]['OpenchannelQueueId']=_0x14a418['id'];if(_0x2f64d0[_0xd133('0x36')][_0xd133('0x40')]){_0x538c83['where']=_[_0xd133('0x41')](_0x538c83[_0xd133('0x3e')],{'$or':_[_0xd133('0x30')](_0x538c83[_0xd133('0x3a')],function(_0x3d41bd){var _0x4c5387={};_0x4c5387[_0x3d41bd]={'$like':'%'+_0x2f64d0[_0xd133('0x36')][_0xd133('0x40')]+'%'};return _0x4c5387;})});}_0x538c83=_[_0xd133('0x41')]({},_0x538c83,_0x2f64d0['options']);return db[_0xd133('0x59')]['findAll'](_0x538c83);}})['then'](function(_0x563d1a){if(_0x563d1a){return db[_0xd133('0x5a')][_0xd133('0x5b')]({'where':{'id':_['map'](_0x563d1a,_0xd133('0x5c')),'role':_0xd133('0x5d')},'attributes':['id',_0xd133('0x2e'),_0xd133('0x5e'),_0xd133('0x5f'),_0xd133('0x60')]});}})[_0xd133('0x2a')](function(_0x407a18){if(_0x407a18){return{'count':_0x407a18[_0xd133('0x22')],'rows':_[_0xd133('0x30')](_0x407a18[_0xd133('0x61')],function(_0x11cd57){return{'membername':_0x11cd57['name'],'UserId':_0x11cd57['id'],'queue_name':_0x588c33[_0xd133('0x2e')],'OpenchannelQueueId':_0x588c33['id'],'interface':util[_0xd133('0x62')](_0xd133('0x63'),_0xd133('0x64'),_0x11cd57[_0xd133('0x2e')]),'penalty':0x0,'paused':_0x11cd57['openchannelPause'],'createdAt':_0x11cd57['createdAt'],'updatedAt':_0x11cd57['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd133('0x2a')](respondWithFilteredResult(_0x35c5b6,_0x538c83))['catch'](handleError(_0x35c5b6,null));};exports[_0xd133('0x65')]=function(_0x1b0876,_0x1e017c,_0x2d4c71){var _0x22a82b={};var _0x47c8f3={};var _0x511caf;var _0x1ebf9b;return db[_0xd133('0x31')]['findOne']({'where':{'id':_0x1b0876[_0xd133('0x48')]['id']}})[_0xd133('0x2a')](handleEntityNotFound(_0x1e017c,null))[_0xd133('0x2a')](function(_0x2d3c2e){if(_0x2d3c2e){_0x511caf=_0x2d3c2e;_0x47c8f3[_0xd133('0x35')]=_[_0xd133('0x37')](db[_0xd133('0x66')][_0xd133('0x32')]);_0x47c8f3[_0xd133('0x36')]=_[_0xd133('0x37')](_0x1b0876[_0xd133('0x36')]);_0x47c8f3[_0xd133('0x38')]=_[_0xd133('0x39')](_0x47c8f3['model'],_0x47c8f3[_0xd133('0x36')]);_0x22a82b[_0xd133('0x3a')]=_[_0xd133('0x39')](_0x47c8f3[_0xd133('0x35')],qs[_0xd133('0x3b')](_0x1b0876['query'][_0xd133('0x3b')]));_0x22a82b[_0xd133('0x3a')]=_0x22a82b['attributes']['length']?_0x22a82b['attributes']:_0x47c8f3[_0xd133('0x35')];_0x22a82b['order']=qs[_0xd133('0x3d')](_0x1b0876[_0xd133('0x36')][_0xd133('0x3d')]);_0x22a82b[_0xd133('0x3e')]=qs[_0xd133('0x38')](_['pick'](_0x1b0876[_0xd133('0x36')],_0x47c8f3[_0xd133('0x38')]));if(_0x1b0876['query']['filter']){_0x22a82b['where']=_[_0xd133('0x41')](_0x22a82b['where'],{'$or':_[_0xd133('0x30')](_0x22a82b['attributes'],function(_0x83d726){var _0x11e40b={};_0x11e40b[_0x83d726]={'$like':'%'+_0x1b0876[_0xd133('0x36')][_0xd133('0x40')]+'%'};return _0x11e40b;})});}_0x22a82b=_['merge']({},_0x22a82b,_0x1b0876['options']);return _0x511caf[_0xd133('0x65')](_0x22a82b);}})[_0xd133('0x2a')](function(_0x302dbc){if(_0x302dbc){_0x1ebf9b=_0x302dbc[_0xd133('0x49')];if(!_0x1b0876[_0xd133('0x36')][_0xd133('0x3c')]('nolimit')){_0x22a82b[_0xd133('0x21')]=qs[_0xd133('0x21')](_0x1b0876['query'][_0xd133('0x21')]);_0x22a82b[_0xd133('0x1f')]=qs[_0xd133('0x1f')](_0x1b0876[_0xd133('0x36')][_0xd133('0x1f')]);}return _0x511caf[_0xd133('0x65')](_0x22a82b);}})[_0xd133('0x2a')](function(_0x1ed088){if(_0x1ed088){return _0x1ed088?{'count':_0x1ebf9b,'rows':_0x1ed088}:null;}})[_0xd133('0x2a')](respondWithResult(_0x1e017c,null))[_0xd133('0x46')](handleError(_0x1e017c,null));};exports[_0xd133('0x67')]=function(_0x44565f,_0x2f4d7d,_0x3e98d6){var _0x5c29b1=_0x44565f['body'][_0xd133('0x68')];return db[_0xd133('0x66')][_0xd133('0x45')]({'where':{'id':_0x5c29b1},'attributes':['id'],'include':[{'model':db[_0xd133('0x5a')],'as':_0xd133('0x69'),'attributes':['id','name',_0xd133('0x6a'),_0xd133('0x6b'),'interface'],'raw':!![]}]})[_0xd133('0x2a')](function(_0x48d33d){if(_0x48d33d){var _0x585858=_[_0xd133('0x6c')](_0x48d33d,function(_0x1aaa11){var _0x38e625=_0x1aaa11[_0xd133('0x2b')]({'plain':!![]});return _0x38e625['Agents'];});return db[_0xd133('0x31')][_0xd133('0x52')]({'where':{'id':_0x44565f[_0xd133('0x48')]['id']}})[_0xd133('0x2a')](function(_0x4b92ff){return db[_0xd133('0x6d')][_0xd133('0x6e')](function(_0x420796){return _0x4b92ff['addTeams'](_0x5c29b1,{'transaction':_0x420796})[_0xd133('0x2a')](function(){return BPromise[_0xd133('0x6f')](_0x585858,function(_0xdb2aec){return db[_0xd133('0x59')][_0xd133('0x70')]({'where':{'UserId':_0xdb2aec['id'],'OpenchannelQueueId':_0x44565f['params']['id']},'transaction':_0x420796});});})[_0xd133('0x2a')](function(){_0x585858['forEach'](function(_0x1ed421){socket[_0xd133('0x71')](_0xd133('0x72'),{'UserId':_0x1ed421['id'],'OpenchannelQueueId':_0x4b92ff['id']});});});});});}})['then'](respondWithStatusCode(_0x2f4d7d,null))[_0xd133('0x46')](handleError(_0x2f4d7d,null));};exports[_0xd133('0x73')]=function(_0x1593ab,_0x319bae,_0x3c30f1){return db['Team'][_0xd133('0x45')]({'where':{'id':_0x1593ab[_0xd133('0x36')][_0xd133('0x68')]},'attributes':['id'],'include':[{'model':db[_0xd133('0x5a')],'as':_0xd133('0x69'),'attributes':['id'],'raw':!![]}]})[_0xd133('0x2a')](handleEntityNotFound(_0x319bae,null))[_0xd133('0x2a')](function(_0x48cb61){var _0x219419=_[_0xd133('0x30')](_0x48cb61,'id');var _0x14c36e=[];var _0x18076c=[];var _0x133805=squel[_0xd133('0x74')]();_0x133805[_0xd133('0x75')](_0xd133('0x76'))[_0xd133('0x77')](_0xd133('0x78'),'tq')[_0xd133('0x79')]('user_has_teams','ut',_0xd133('0x7a'))[_0xd133('0x3e')](_0xd133('0x7b'),_0x1593ab['params']['id']);for(var _0x2f3890=0x0;_0x2f3890<_0x48cb61['length'];_0x2f3890+=0x1){let _0x235b2c=_0x48cb61[_0x2f3890];for(var _0x5768f3=0x0;_0x5768f3<_0x235b2c['Agents']['length'];_0x5768f3+=0x1){let _0x112eaa=_0x235b2c['Agents'][_0x5768f3];var _0x888691=_0x133805[_0xd133('0x7c')]();_0x888691[_0xd133('0x3e')](_0xd133('0x7d'),_0x112eaa['id']);_0x18076c['push'](db[_0xd133('0x6d')][_0xd133('0x36')](_0x888691[_0xd133('0x7e')](),{'type':db['sequelize'][_0xd133('0x7f')][_0xd133('0x80')]})[_0xd133('0x2a')](function(_0x5e80bf){if(_0x5e80bf['length']===0x1){return _0x112eaa['id'];}else{var _0x4ec9ce=_[_0xd133('0x81')](_[_0xd133('0x30')](_0x5e80bf,_0xd133('0x82')),function(_0x35b7ef){return _[_0xd133('0x83')](_0x219419,_0x35b7ef);});if(_0x4ec9ce){return _0x112eaa['id'];}}}));}}return BPromise[_0xd133('0x84')](_0x18076c)[_0xd133('0x2a')](function(_0x23a6c5){_0x14c36e=_(_0x14c36e)[_0xd133('0x85')](_0x23a6c5)['compact']()[_0xd133('0x86')]();return db[_0xd133('0x31')][_0xd133('0x52')]({'where':{'id':_0x1593ab[_0xd133('0x48')]['id']}})[_0xd133('0x2a')](function(_0x1141fc){return db[_0xd133('0x6d')][_0xd133('0x6e')](function(_0x56af0d){return _0x1141fc[_0xd133('0x73')](_0x1593ab[_0xd133('0x36')][_0xd133('0x68')],{'transaction':_0x56af0d})[_0xd133('0x2a')](function(){if(!_[_0xd133('0x87')](_0x14c36e)){return _0x1141fc[_0xd133('0x88')](_0x14c36e,{'transaction':_0x56af0d});}})[_0xd133('0x2a')](function(){_0x14c36e[_0xd133('0x89')](function(_0x248296){socket['emit'](_0xd133('0x8a'),{'UserId':_0x248296,'OpenchannelQueueId':_0x1141fc['id']});});});});});});})['then'](respondWithStatusCode(_0x319bae,null))[_0xd133('0x46')](handleError(_0x319bae,null));};exports[_0xd133('0x8b')]=function(_0x53287c,_0xbc3f4f,_0x540464){return db[_0xd133('0x31')][_0xd133('0x52')]({'where':{'id':_0x53287c['params']['id']}})[_0xd133('0x2a')](handleEntityNotFound(_0xbc3f4f,null))[_0xd133('0x2a')](function(_0x3faed9){if(_0x3faed9){return _0x3faed9[_0xd133('0x8b')](_0x53287c['body'][_0xd133('0x68')],_[_0xd133('0x8c')](_0x53287c[_0xd133('0x4c')],[_0xd133('0x68'),'id'])||{})[_0xd133('0x8d')](function(_0x56d076){for(var _0xebc94=0x0;_0xebc94<_0x53287c[_0xd133('0x4c')][_0xd133('0x68')][_0xd133('0x49')];_0xebc94+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x53287c['body'][_0xd133('0x68')][_0xebc94],'OpenchannelQueueId':_0x53287c[_0xd133('0x48')]['id']});}return _0x56d076;});}})[_0xd133('0x2a')](respondWithResult(_0xbc3f4f,null))[_0xd133('0x46')](handleError(_0xbc3f4f,null));};exports['removeAgents']=function(_0x320102,_0x103665,_0x467ddf){return db[_0xd133('0x31')][_0xd133('0x52')]({'where':{'id':_0x320102['params']['id']}})[_0xd133('0x2a')](handleEntityNotFound(_0x103665,null))[_0xd133('0x2a')](function(_0x548e6b){if(_0x548e6b){return _0x548e6b[_0xd133('0x88')](_0x320102[_0xd133('0x36')][_0xd133('0x68')])[_0xd133('0x2a')](function(){if(_[_0xd133('0x8e')](_0x320102[_0xd133('0x36')][_0xd133('0x68')])){for(var _0x289f21=0x0;_0x289f21<_0x320102[_0xd133('0x36')][_0xd133('0x68')]['length'];_0x289f21+=0x1){socket[_0xd133('0x71')](_0xd133('0x8a'),{'UserId':Number(_0x320102[_0xd133('0x36')]['ids'][_0x289f21]),'OpenchannelQueueId':Number(_0x320102[_0xd133('0x48')]['id'])});}}else{socket[_0xd133('0x71')](_0xd133('0x8a'),{'UserId':Number(_0x320102[_0xd133('0x36')][_0xd133('0x68')]),'OpenchannelQueueId':Number(_0x320102[_0xd133('0x48')]['id'])});}});}})[_0xd133('0x2a')](respondWithStatusCode(_0x103665,null))[_0xd133('0x46')](handleError(_0x103665,null));};exports[_0xd133('0x8f')]=function(_0x362bae,_0xfc8eed,_0x3e7f2f){var _0x115b7d={};var _0x4da886={};var _0x153e34;var _0x11354b;return db[_0xd133('0x31')][_0xd133('0x57')]({'where':{'id':_0x362bae[_0xd133('0x48')]['id']}})[_0xd133('0x2a')](handleEntityNotFound(_0xfc8eed,null))[_0xd133('0x2a')](function(_0x1810b1){if(_0x1810b1){_0x153e34=_0x1810b1;_0x4da886[_0xd133('0x35')]=_[_0xd133('0x37')](db[_0xd133('0x5a')][_0xd133('0x32')]);_0x4da886[_0xd133('0x36')]=_['keys'](_0x362bae['query']);_0x4da886[_0xd133('0x38')]=_[_0xd133('0x39')](_0x4da886[_0xd133('0x35')],_0x4da886[_0xd133('0x36')]);_0x115b7d[_0xd133('0x3a')]=_[_0xd133('0x39')](_0x4da886[_0xd133('0x35')],qs[_0xd133('0x3b')](_0x362bae[_0xd133('0x36')][_0xd133('0x3b')]));_0x115b7d['attributes']=_0x115b7d['attributes']['length']?_0x115b7d[_0xd133('0x3a')]:_0x4da886[_0xd133('0x35')];_0x115b7d[_0xd133('0x58')]=qs[_0xd133('0x3d')](_0x362bae[_0xd133('0x36')]['sort']);_0x115b7d[_0xd133('0x3e')]=qs[_0xd133('0x38')](_[_0xd133('0x3f')](_0x362bae['query'],_0x4da886[_0xd133('0x38')]));if(_0x362bae[_0xd133('0x36')][_0xd133('0x40')]){_0x115b7d['where']=_[_0xd133('0x41')](_0x115b7d[_0xd133('0x3e')],{'$or':_['map'](_0x115b7d[_0xd133('0x3a')],function(_0x35fe39){var _0x20ad14={};_0x20ad14[_0x35fe39]={'$like':'%'+_0x362bae[_0xd133('0x36')][_0xd133('0x40')]+'%'};return _0x20ad14;})});}_0x115b7d=_[_0xd133('0x41')]({},_0x115b7d,_0x362bae['options']);return _0x153e34[_0xd133('0x8f')](_0x115b7d);}})[_0xd133('0x2a')](function(_0x1348de){if(_0x1348de){_0x11354b=_0x1348de[_0xd133('0x49')];if(!_0x362bae[_0xd133('0x36')][_0xd133('0x3c')](_0xd133('0x90'))){_0x115b7d['limit']=qs[_0xd133('0x21')](_0x362bae[_0xd133('0x36')]['limit']);_0x115b7d[_0xd133('0x1f')]=qs[_0xd133('0x1f')](_0x362bae[_0xd133('0x36')]['offset']);}return _0x153e34[_0xd133('0x8f')](_0x115b7d);}})[_0xd133('0x2a')](function(_0x4c36d1){if(_0x4c36d1){return _0x4c36d1?{'count':_0x11354b,'rows':_0x4c36d1}:null;}})[_0xd133('0x2a')](respondWithResult(_0xfc8eed,null))[_0xd133('0x46')](handleError(_0xfc8eed,null));}; \ No newline at end of file +var _0xb1b0=['compact','value','isEmpty','addAgents','spread','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','options','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','status','end','json','undefined','offset','count','set','Content-Range','apply','save','update','then','destroy','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','OpenchannelQueue','rawAttributes','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','filter','merge','where','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','order','UserOpenchannelQueue','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','ids','Team','User','Agents','online','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','includes','all','union'];(function(_0x3f68ed,_0x15ebf2){var _0x5dc3b2=function(_0x36530b){while(--_0x36530b){_0x3f68ed['push'](_0x3f68ed['shift']());}};_0x5dc3b2(++_0x15ebf2);}(_0xb1b0,0x126));var _0x0b1b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xb1b0[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b1b('0x0'));var zipdir=require(_0x0b1b('0x1'));var jsonpatch=require(_0x0b1b('0x2'));var rp=require('request-promise');var moment=require(_0x0b1b('0x3'));var BPromise=require(_0x0b1b('0x4'));var Mustache=require(_0x0b1b('0x5'));var util=require(_0x0b1b('0x6'));var path=require(_0x0b1b('0x7'));var sox=require(_0x0b1b('0x8'));var csv=require('to-csv');var ejs=require(_0x0b1b('0x9'));var fs=require('fs');var fs_extra=require(_0x0b1b('0xa'));var _=require(_0x0b1b('0xb'));var squel=require(_0x0b1b('0xc'));var crypto=require(_0x0b1b('0xd'));var jsforce=require(_0x0b1b('0xe'));var deskjs=require(_0x0b1b('0xf'));var toCsv=require(_0x0b1b('0x10'));var querystring=require(_0x0b1b('0x11'));var Papa=require(_0x0b1b('0x12'));var Redis=require(_0x0b1b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0b1b('0x14'));var as=require(_0x0b1b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0b1b('0x16'))(_0x0b1b('0x17'));var utils=require(_0x0b1b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0b1b('0x19'));var db=require(_0x0b1b('0x1a'))['db'];config[_0x0b1b('0x1b')]=_[_0x0b1b('0x1c')](config[_0x0b1b('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x0b1b('0x1d'))(new Redis(config[_0x0b1b('0x1b')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x2b6343,_0x2fbb39){_0x2fbb39=_0x2fbb39||0xcc;return function(_0x4f3e3b){if(_0x4f3e3b){return _0x2b6343['sendStatus'](_0x2fbb39);}return _0x2b6343[_0x0b1b('0x1e')](_0x2fbb39)[_0x0b1b('0x1f')]();};}function respondWithResult(_0x5cf416,_0x2d07f7){_0x2d07f7=_0x2d07f7||0xc8;return function(_0x5afa0d){if(_0x5afa0d){return _0x5cf416[_0x0b1b('0x1e')](_0x2d07f7)[_0x0b1b('0x20')](_0x5afa0d);}};}function respondWithFilteredResult(_0x2bb211,_0x35e3d7){return function(_0x217ee6){if(_0x217ee6){var _0x4ec2d1=typeof _0x35e3d7['offset']===_0x0b1b('0x21')&&typeof _0x35e3d7['limit']===_0x0b1b('0x21');var _0x3d1b4c=_0x217ee6['count'];var _0x1589a1=_0x4ec2d1?0x0:_0x35e3d7[_0x0b1b('0x22')];var _0x1cabb7=_0x4ec2d1?_0x217ee6[_0x0b1b('0x23')]:_0x35e3d7[_0x0b1b('0x22')]+_0x35e3d7['limit'];var _0x2c032d;if(_0x1cabb7>=_0x3d1b4c){_0x1cabb7=_0x3d1b4c;_0x2c032d=0xc8;}else{_0x2c032d=0xce;}_0x2bb211['status'](_0x2c032d);return _0x2bb211[_0x0b1b('0x24')](_0x0b1b('0x25'),_0x1589a1+'-'+_0x1cabb7+'/'+_0x3d1b4c)[_0x0b1b('0x20')](_0x217ee6);}return null;};}function patchUpdates(_0x1eb1c7){return function(_0x557619){try{jsonpatch[_0x0b1b('0x26')](_0x557619,_0x1eb1c7,!![]);}catch(_0xe4f1df){return BPromise['reject'](_0xe4f1df);}return _0x557619[_0x0b1b('0x27')]();};}function saveUpdates(_0x540973,_0x3e444d){return function(_0x337496){if(_0x337496){return _0x337496[_0x0b1b('0x28')](_0x540973)[_0x0b1b('0x29')](function(_0x3d1706){return _0x3d1706;});}return null;};}function removeEntity(_0x114f05,_0x318609){return function(_0x1ab322){if(_0x1ab322){return _0x1ab322[_0x0b1b('0x2a')]()[_0x0b1b('0x29')](function(){var _0x2601f4=_0x1ab322['get']({'plain':!![]});var _0x1fe2cf=_0x0b1b('0x2b');return db[_0x0b1b('0x2c')][_0x0b1b('0x2a')]({'where':{'type':_0x1fe2cf,'resourceId':_0x2601f4['id']}})['then'](function(){return _0x1ab322;});})[_0x0b1b('0x29')](function(){_0x114f05[_0x0b1b('0x1e')](0xcc)[_0x0b1b('0x1f')]();});}};}function handleEntityNotFound(_0x43c151,_0x4db4cb){return function(_0x5aea20){if(!_0x5aea20){_0x43c151['sendStatus'](0x194);}return _0x5aea20;};}function handleError(_0x47b7cb,_0x287b72){_0x287b72=_0x287b72||0x1f4;return function(_0x49d241){logger[_0x0b1b('0x2d')](_0x49d241[_0x0b1b('0x2e')]);if(_0x49d241[_0x0b1b('0x2f')]){delete _0x49d241[_0x0b1b('0x2f')];}_0x47b7cb[_0x0b1b('0x1e')](_0x287b72)[_0x0b1b('0x30')](_0x49d241);};}exports[_0x0b1b('0x31')]=function(_0x1a0770,_0x5e17bc){var _0x2d69a3={},_0x11bff7={},_0x13353c={'count':0x0,'rows':[]};var _0xfef1ea=_['map'](db[_0x0b1b('0x32')][_0x0b1b('0x33')],function(_0x41ca72){return{'name':_0x41ca72['fieldName'],'type':_0x41ca72['type'][_0x0b1b('0x34')]};});_0x11bff7[_0x0b1b('0x35')]=_[_0x0b1b('0x36')](_0xfef1ea,'name');_0x11bff7[_0x0b1b('0x37')]=_[_0x0b1b('0x38')](_0x1a0770['query']);_0x11bff7[_0x0b1b('0x39')]=_[_0x0b1b('0x3a')](_0x11bff7[_0x0b1b('0x35')],_0x11bff7['query']);_0x2d69a3['attributes']=_[_0x0b1b('0x3a')](_0x11bff7[_0x0b1b('0x35')],qs['fields'](_0x1a0770['query'][_0x0b1b('0x3b')]));_0x2d69a3[_0x0b1b('0x3c')]=_0x2d69a3[_0x0b1b('0x3c')][_0x0b1b('0x3d')]?_0x2d69a3[_0x0b1b('0x3c')]:_0x11bff7['model'];if(!_0x1a0770[_0x0b1b('0x37')][_0x0b1b('0x3e')](_0x0b1b('0x3f'))){_0x2d69a3[_0x0b1b('0x40')]=qs[_0x0b1b('0x40')](_0x1a0770[_0x0b1b('0x37')]['limit']);_0x2d69a3[_0x0b1b('0x22')]=qs[_0x0b1b('0x22')](_0x1a0770['query'][_0x0b1b('0x22')]);}_0x2d69a3['order']=qs['sort'](_0x1a0770['query'][_0x0b1b('0x41')]);_0x2d69a3['where']=qs[_0x0b1b('0x39')](_[_0x0b1b('0x42')](_0x1a0770[_0x0b1b('0x37')],_0x11bff7[_0x0b1b('0x39')]),_0xfef1ea);if(_0x1a0770[_0x0b1b('0x37')][_0x0b1b('0x43')]){_0x2d69a3['where']=_[_0x0b1b('0x44')](_0x2d69a3[_0x0b1b('0x45')],{'$or':_['map'](_0xfef1ea,function(_0x15b850){if(_0x15b850[_0x0b1b('0x46')]!==_0x0b1b('0x47')){var _0x257ce7={};_0x257ce7[_0x15b850[_0x0b1b('0x2f')]]={'$like':'%'+_0x1a0770[_0x0b1b('0x37')][_0x0b1b('0x43')]+'%'};return _0x257ce7;}})});}_0x2d69a3=_[_0x0b1b('0x44')]({},_0x2d69a3,_0x1a0770['options']);var _0x35b5f0={'where':_0x2d69a3['where']};return db['OpenchannelQueue'][_0x0b1b('0x23')](_0x35b5f0)[_0x0b1b('0x29')](function(_0x4accab){_0x13353c[_0x0b1b('0x23')]=_0x4accab;if(_0x1a0770['query'][_0x0b1b('0x48')]){_0x2d69a3[_0x0b1b('0x49')]=[{'all':!![]}];}return db[_0x0b1b('0x32')][_0x0b1b('0x4a')](_0x2d69a3);})[_0x0b1b('0x29')](function(_0x4ff4ea){_0x13353c[_0x0b1b('0x4b')]=_0x4ff4ea;return _0x13353c;})[_0x0b1b('0x29')](respondWithFilteredResult(_0x5e17bc,_0x2d69a3))[_0x0b1b('0x4c')](handleError(_0x5e17bc,null));};exports['show']=function(_0x288789,_0xedfbc3){var _0x2c88f5={'raw':!![],'where':{'id':_0x288789[_0x0b1b('0x4d')]['id']}},_0x113617={};_0x113617[_0x0b1b('0x35')]=_[_0x0b1b('0x38')](db[_0x0b1b('0x32')][_0x0b1b('0x33')]);_0x113617[_0x0b1b('0x37')]=_[_0x0b1b('0x38')](_0x288789['query']);_0x113617[_0x0b1b('0x39')]=_['intersection'](_0x113617[_0x0b1b('0x35')],_0x113617['query']);_0x2c88f5[_0x0b1b('0x3c')]=_['intersection'](_0x113617[_0x0b1b('0x35')],qs[_0x0b1b('0x3b')](_0x288789['query'][_0x0b1b('0x3b')]));_0x2c88f5[_0x0b1b('0x3c')]=_0x2c88f5[_0x0b1b('0x3c')][_0x0b1b('0x3d')]?_0x2c88f5[_0x0b1b('0x3c')]:_0x113617[_0x0b1b('0x35')];if(_0x288789['query']['includeAll']){_0x2c88f5[_0x0b1b('0x49')]=[{'all':!![]}];}_0x2c88f5=_[_0x0b1b('0x44')]({},_0x2c88f5,_0x288789['options']);return db[_0x0b1b('0x32')]['find'](_0x2c88f5)[_0x0b1b('0x29')](handleEntityNotFound(_0xedfbc3,null))['then'](respondWithResult(_0xedfbc3,null))[_0x0b1b('0x4c')](handleError(_0xedfbc3,null));};exports[_0x0b1b('0x4e')]=function(_0x13bdac,_0x7553fe){return db['OpenchannelQueue'][_0x0b1b('0x4e')](_0x13bdac[_0x0b1b('0x4f')],{})[_0x0b1b('0x29')](function(_0x156397){var _0x15c68d=_0x13bdac[_0x0b1b('0x50')][_0x0b1b('0x51')]({'plain':!![]});if(!_0x15c68d)throw new Error(_0x0b1b('0x52'));if(_0x15c68d[_0x0b1b('0x53')]===_0x0b1b('0x50')){var _0x233dd2=_0x156397[_0x0b1b('0x51')]({'plain':!![]});var _0x5d6d11=_0x0b1b('0x2b');return db['UserProfileSection'][_0x0b1b('0x54')]({'where':{'name':_0x5d6d11,'userProfileId':_0x15c68d[_0x0b1b('0x55')]},'raw':!![]})[_0x0b1b('0x29')](function(_0x564499){if(_0x564499&&_0x564499[_0x0b1b('0x56')]===0x0){return db[_0x0b1b('0x2c')][_0x0b1b('0x4e')]({'name':_0x233dd2[_0x0b1b('0x2f')],'resourceId':_0x233dd2['id'],'type':_0x564499[_0x0b1b('0x2f')],'sectionId':_0x564499['id']},{})['then'](function(){return _0x156397;});}else{return _0x156397;}})[_0x0b1b('0x4c')](function(_0x59e52d){logger[_0x0b1b('0x2d')](_0x0b1b('0x57'),_0x59e52d);throw _0x59e52d;});}return _0x156397;})[_0x0b1b('0x29')](respondWithResult(_0x7553fe,0xc9))['catch'](handleError(_0x7553fe,null));};exports[_0x0b1b('0x28')]=function(_0x4e3e13,_0x4cdeb2){if(_0x4e3e13[_0x0b1b('0x4f')]['id']){delete _0x4e3e13[_0x0b1b('0x4f')]['id'];}return db[_0x0b1b('0x32')][_0x0b1b('0x54')]({'where':{'id':_0x4e3e13[_0x0b1b('0x4d')]['id']}})[_0x0b1b('0x29')](handleEntityNotFound(_0x4cdeb2,null))['then'](saveUpdates(_0x4e3e13[_0x0b1b('0x4f')],null))[_0x0b1b('0x29')](respondWithResult(_0x4cdeb2,null))['catch'](handleError(_0x4cdeb2,null));};exports[_0x0b1b('0x2a')]=function(_0x3cff1d,_0x2a8092){return db[_0x0b1b('0x32')]['find']({'where':{'id':_0x3cff1d['params']['id']}})[_0x0b1b('0x29')](handleEntityNotFound(_0x2a8092,null))[_0x0b1b('0x29')](removeEntity(_0x2a8092,null))[_0x0b1b('0x4c')](handleError(_0x2a8092,null));};exports[_0x0b1b('0x58')]=function(_0x1a2570,_0x28e760){return db[_0x0b1b('0x32')][_0x0b1b('0x58')]()['then'](respondWithResult(_0x28e760,null))[_0x0b1b('0x4c')](handleError(_0x28e760,null));};exports['getMembers']=function(_0x40fc70,_0x392aee,_0x121404){var _0x4d35e5={'raw':!![],'where':{}},_0x28a9b6={},_0x238564;return db[_0x0b1b('0x32')][_0x0b1b('0x59')]({'where':{'id':_0x40fc70[_0x0b1b('0x4d')]['id']}})[_0x0b1b('0x29')](handleEntityNotFound(_0x392aee,null))[_0x0b1b('0x29')](function(_0x4b302b){if(_0x4b302b){_0x238564=_0x4b302b[_0x0b1b('0x51')]({'plain':!![]});_0x28a9b6['model']=_[_0x0b1b('0x38')](db['UserOpenchannelQueue']['rawAttributes']);_0x28a9b6[_0x0b1b('0x37')]=_['keys'](_0x40fc70['query']);_0x28a9b6[_0x0b1b('0x39')]=_[_0x0b1b('0x3a')](_0x28a9b6['model'],_0x28a9b6[_0x0b1b('0x37')]);_0x4d35e5[_0x0b1b('0x3c')]=_[_0x0b1b('0x3a')](_0x28a9b6[_0x0b1b('0x35')],qs[_0x0b1b('0x3b')](_0x40fc70[_0x0b1b('0x37')][_0x0b1b('0x3b')]));_0x4d35e5[_0x0b1b('0x3c')]=_0x4d35e5['attributes'][_0x0b1b('0x3d')]?_0x4d35e5[_0x0b1b('0x3c')]:_0x28a9b6['model'];if(!_0x40fc70[_0x0b1b('0x37')]['hasOwnProperty'](_0x0b1b('0x3f'))){_0x4d35e5[_0x0b1b('0x40')]=qs['limit'](_0x40fc70['query'][_0x0b1b('0x40')]);_0x4d35e5[_0x0b1b('0x22')]=qs[_0x0b1b('0x22')](_0x40fc70[_0x0b1b('0x37')]['offset']);}_0x4d35e5[_0x0b1b('0x5a')]=qs[_0x0b1b('0x41')](_0x40fc70[_0x0b1b('0x37')]['sort']);_0x4d35e5[_0x0b1b('0x45')]=qs[_0x0b1b('0x39')](_['pick'](_0x40fc70[_0x0b1b('0x37')],_0x28a9b6['filters']));_0x4d35e5[_0x0b1b('0x45')]['OpenchannelQueueId']=_0x4b302b['id'];if(_0x40fc70[_0x0b1b('0x37')][_0x0b1b('0x43')]){_0x4d35e5[_0x0b1b('0x45')]=_['merge'](_0x4d35e5[_0x0b1b('0x45')],{'$or':_['map'](_0x4d35e5[_0x0b1b('0x3c')],function(_0x524e0e){var _0x16ec0d={};_0x16ec0d[_0x524e0e]={'$like':'%'+_0x40fc70[_0x0b1b('0x37')][_0x0b1b('0x43')]+'%'};return _0x16ec0d;})});}_0x4d35e5=_[_0x0b1b('0x44')]({},_0x4d35e5,_0x40fc70['options']);return db[_0x0b1b('0x5b')][_0x0b1b('0x4a')](_0x4d35e5);}})[_0x0b1b('0x29')](function(_0x2ee86f){if(_0x2ee86f){return db['User'][_0x0b1b('0x5c')]({'where':{'id':_[_0x0b1b('0x36')](_0x2ee86f,_0x0b1b('0x5d')),'role':_0x0b1b('0x5e')},'attributes':['id',_0x0b1b('0x2f'),_0x0b1b('0x5f'),_0x0b1b('0x60'),_0x0b1b('0x61')]});}})[_0x0b1b('0x29')](function(_0x35518f){if(_0x35518f){return{'count':_0x35518f['count'],'rows':_[_0x0b1b('0x36')](_0x35518f['rows'],function(_0xe2e367){return{'membername':_0xe2e367[_0x0b1b('0x2f')],'UserId':_0xe2e367['id'],'queue_name':_0x238564[_0x0b1b('0x2f')],'OpenchannelQueueId':_0x238564['id'],'interface':util[_0x0b1b('0x62')](_0x0b1b('0x63'),_0x0b1b('0x64'),_0xe2e367[_0x0b1b('0x2f')]),'penalty':0x0,'paused':_0xe2e367[_0x0b1b('0x5f')],'createdAt':_0xe2e367['createdAt'],'updatedAt':_0xe2e367[_0x0b1b('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0b1b('0x29')](respondWithFilteredResult(_0x392aee,_0x4d35e5))[_0x0b1b('0x4c')](handleError(_0x392aee,null));};exports[_0x0b1b('0x65')]=function(_0xf44f17,_0x4a57f8,_0x2aff4a){var _0x4f9361={};var _0x3b591a={};var _0x2afd65;var _0x4144db;return db[_0x0b1b('0x32')][_0x0b1b('0x59')]({'where':{'id':_0xf44f17['params']['id']}})[_0x0b1b('0x29')](handleEntityNotFound(_0x4a57f8,null))[_0x0b1b('0x29')](function(_0x5247dc){if(_0x5247dc){_0x2afd65=_0x5247dc;_0x3b591a[_0x0b1b('0x35')]=_[_0x0b1b('0x38')](db['Team'][_0x0b1b('0x33')]);_0x3b591a['query']=_[_0x0b1b('0x38')](_0xf44f17[_0x0b1b('0x37')]);_0x3b591a[_0x0b1b('0x39')]=_[_0x0b1b('0x3a')](_0x3b591a['model'],_0x3b591a['query']);_0x4f9361[_0x0b1b('0x3c')]=_[_0x0b1b('0x3a')](_0x3b591a[_0x0b1b('0x35')],qs[_0x0b1b('0x3b')](_0xf44f17['query'][_0x0b1b('0x3b')]));_0x4f9361[_0x0b1b('0x3c')]=_0x4f9361[_0x0b1b('0x3c')][_0x0b1b('0x3d')]?_0x4f9361[_0x0b1b('0x3c')]:_0x3b591a[_0x0b1b('0x35')];_0x4f9361['order']=qs[_0x0b1b('0x41')](_0xf44f17['query'][_0x0b1b('0x41')]);_0x4f9361['where']=qs['filters'](_[_0x0b1b('0x42')](_0xf44f17[_0x0b1b('0x37')],_0x3b591a['filters']));if(_0xf44f17[_0x0b1b('0x37')][_0x0b1b('0x43')]){_0x4f9361[_0x0b1b('0x45')]=_['merge'](_0x4f9361[_0x0b1b('0x45')],{'$or':_['map'](_0x4f9361['attributes'],function(_0x169218){var _0x43c76e={};_0x43c76e[_0x169218]={'$like':'%'+_0xf44f17[_0x0b1b('0x37')][_0x0b1b('0x43')]+'%'};return _0x43c76e;})});}_0x4f9361=_['merge']({},_0x4f9361,_0xf44f17['options']);return _0x2afd65[_0x0b1b('0x65')](_0x4f9361);}})[_0x0b1b('0x29')](function(_0x1046ef){if(_0x1046ef){_0x4144db=_0x1046ef['length'];if(!_0xf44f17[_0x0b1b('0x37')]['hasOwnProperty'](_0x0b1b('0x3f'))){_0x4f9361[_0x0b1b('0x40')]=qs[_0x0b1b('0x40')](_0xf44f17[_0x0b1b('0x37')][_0x0b1b('0x40')]);_0x4f9361[_0x0b1b('0x22')]=qs[_0x0b1b('0x22')](_0xf44f17['query']['offset']);}return _0x2afd65[_0x0b1b('0x65')](_0x4f9361);}})[_0x0b1b('0x29')](function(_0x5ecc95){if(_0x5ecc95){return _0x5ecc95?{'count':_0x4144db,'rows':_0x5ecc95}:null;}})[_0x0b1b('0x29')](respondWithResult(_0x4a57f8,null))[_0x0b1b('0x4c')](handleError(_0x4a57f8,null));};exports['addTeams']=function(_0x2a1f01,_0x534300,_0x572a9f){var _0x366f8e=_0x2a1f01['body'][_0x0b1b('0x66')];return db[_0x0b1b('0x67')][_0x0b1b('0x4a')]({'where':{'id':_0x366f8e},'attributes':['id'],'include':[{'model':db[_0x0b1b('0x68')],'as':_0x0b1b('0x69'),'attributes':['id','name',_0x0b1b('0x6a'),'voicePause',_0x0b1b('0x6b')],'raw':!![]}]})['then'](function(_0x55c1e2){if(_0x55c1e2){var _0x42f556=_['flatMap'](_0x55c1e2,function(_0x3bc96f){var _0x5473cf=_0x3bc96f[_0x0b1b('0x51')]({'plain':!![]});return _0x5473cf[_0x0b1b('0x69')];});return db['OpenchannelQueue'][_0x0b1b('0x54')]({'where':{'id':_0x2a1f01[_0x0b1b('0x4d')]['id']}})['then'](function(_0xbd44eb){return db[_0x0b1b('0x6c')][_0x0b1b('0x6d')](function(_0x2920f7){return _0xbd44eb[_0x0b1b('0x6e')](_0x366f8e,{'transaction':_0x2920f7})[_0x0b1b('0x29')](function(){return BPromise[_0x0b1b('0x6f')](_0x42f556,function(_0x3be6bd){return db[_0x0b1b('0x5b')][_0x0b1b('0x70')]({'where':{'UserId':_0x3be6bd['id'],'OpenchannelQueueId':_0x2a1f01['params']['id']},'transaction':_0x2920f7});});})[_0x0b1b('0x29')](function(){_0x42f556[_0x0b1b('0x71')](function(_0x1f11a2){socket[_0x0b1b('0x72')](_0x0b1b('0x73'),{'UserId':_0x1f11a2['id'],'OpenchannelQueueId':_0xbd44eb['id']});});});});});}})[_0x0b1b('0x29')](respondWithStatusCode(_0x534300,null))['catch'](handleError(_0x534300,null));};exports[_0x0b1b('0x74')]=function(_0x3028f0,_0x525bcd,_0x4f7916){return db[_0x0b1b('0x67')][_0x0b1b('0x4a')]({'where':{'id':_0x3028f0['query'][_0x0b1b('0x66')]},'attributes':['id'],'include':[{'model':db[_0x0b1b('0x68')],'as':_0x0b1b('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x525bcd,null))[_0x0b1b('0x29')](function(_0x1c880e){var _0x37831b=_[_0x0b1b('0x36')](_0x1c880e,'id');var _0x397bc1=[];var _0x38d6f5=[];var _0x12f0a2=squel[_0x0b1b('0x75')]();_0x12f0a2[_0x0b1b('0x76')](_0x0b1b('0x77'))['from'](_0x0b1b('0x78'),'tq')[_0x0b1b('0x79')]('user_has_teams','ut',_0x0b1b('0x7a'))[_0x0b1b('0x45')](_0x0b1b('0x7b'),_0x3028f0['params']['id']);for(var _0x2d5b89=0x0;_0x2d5b89<_0x1c880e[_0x0b1b('0x3d')];_0x2d5b89+=0x1){let _0x563d80=_0x1c880e[_0x2d5b89];for(var _0x1595db=0x0;_0x1595db<_0x563d80['Agents']['length'];_0x1595db+=0x1){let _0x4e05d0=_0x563d80[_0x0b1b('0x69')][_0x1595db];var _0x109b9a=_0x12f0a2[_0x0b1b('0x7c')]();_0x109b9a[_0x0b1b('0x45')](_0x0b1b('0x7d'),_0x4e05d0['id']);_0x38d6f5[_0x0b1b('0x7e')](db['sequelize'][_0x0b1b('0x37')](_0x109b9a[_0x0b1b('0x7f')](),{'type':db['sequelize']['QueryTypes']['SELECT']})['then'](function(_0x415117){if(_0x415117[_0x0b1b('0x3d')]===0x1){return _0x4e05d0['id'];}else{var _0x3aecd8=_[_0x0b1b('0x80')](_[_0x0b1b('0x36')](_0x415117,'TeamId'),function(_0x475ade){return _[_0x0b1b('0x81')](_0x37831b,_0x475ade);});if(_0x3aecd8){return _0x4e05d0['id'];}}}));}}return BPromise[_0x0b1b('0x82')](_0x38d6f5)[_0x0b1b('0x29')](function(_0x240e0d){_0x397bc1=_(_0x397bc1)[_0x0b1b('0x83')](_0x240e0d)[_0x0b1b('0x84')]()[_0x0b1b('0x85')]();return db[_0x0b1b('0x32')][_0x0b1b('0x54')]({'where':{'id':_0x3028f0['params']['id']}})[_0x0b1b('0x29')](function(_0x6aa7ad){return db[_0x0b1b('0x6c')]['transaction'](function(_0x21a797){return _0x6aa7ad[_0x0b1b('0x74')](_0x3028f0[_0x0b1b('0x37')][_0x0b1b('0x66')],{'transaction':_0x21a797})[_0x0b1b('0x29')](function(){if(!_[_0x0b1b('0x86')](_0x397bc1)){return _0x6aa7ad['removeAgents'](_0x397bc1,{'transaction':_0x21a797});}})[_0x0b1b('0x29')](function(){_0x397bc1[_0x0b1b('0x71')](function(_0x5126c2){socket[_0x0b1b('0x72')]('userOpenchannelQueue:remove',{'UserId':_0x5126c2,'OpenchannelQueueId':_0x6aa7ad['id']});});});});});});})['then'](respondWithStatusCode(_0x525bcd,null))[_0x0b1b('0x4c')](handleError(_0x525bcd,null));};exports[_0x0b1b('0x87')]=function(_0x90cfa5,_0x42ef7a,_0x1b2434){return db[_0x0b1b('0x32')][_0x0b1b('0x54')]({'where':{'id':_0x90cfa5[_0x0b1b('0x4d')]['id']}})[_0x0b1b('0x29')](handleEntityNotFound(_0x42ef7a,null))['then'](function(_0x1d27db){if(_0x1d27db){return _0x1d27db[_0x0b1b('0x87')](_0x90cfa5['body'][_0x0b1b('0x66')],_['omit'](_0x90cfa5[_0x0b1b('0x4f')],[_0x0b1b('0x66'),'id'])||{})[_0x0b1b('0x88')](function(_0x55d529){for(var _0x9dbd3f=0x0;_0x9dbd3f<_0x90cfa5['body'][_0x0b1b('0x66')][_0x0b1b('0x3d')];_0x9dbd3f+=0x1){socket[_0x0b1b('0x72')]('userOpenchannelQueue:save',{'UserId':_0x90cfa5['body'][_0x0b1b('0x66')][_0x9dbd3f],'OpenchannelQueueId':_0x90cfa5['params']['id']});}return _0x55d529;});}})[_0x0b1b('0x29')](respondWithResult(_0x42ef7a,null))['catch'](handleError(_0x42ef7a,null));};exports['removeAgents']=function(_0x3f7952,_0x3082d8,_0xebe9d8){return db[_0x0b1b('0x32')][_0x0b1b('0x54')]({'where':{'id':_0x3f7952[_0x0b1b('0x4d')]['id']}})[_0x0b1b('0x29')](handleEntityNotFound(_0x3082d8,null))['then'](function(_0x2f1cd1){if(_0x2f1cd1){return _0x2f1cd1[_0x0b1b('0x89')](_0x3f7952['query']['ids'])[_0x0b1b('0x29')](function(){if(_[_0x0b1b('0x8a')](_0x3f7952['query'][_0x0b1b('0x66')])){for(var _0x1b9c0b=0x0;_0x1b9c0b<_0x3f7952[_0x0b1b('0x37')]['ids']['length'];_0x1b9c0b+=0x1){socket[_0x0b1b('0x72')](_0x0b1b('0x8b'),{'UserId':Number(_0x3f7952['query'][_0x0b1b('0x66')][_0x1b9c0b]),'OpenchannelQueueId':Number(_0x3f7952[_0x0b1b('0x4d')]['id'])});}}else{socket['emit'](_0x0b1b('0x8b'),{'UserId':Number(_0x3f7952[_0x0b1b('0x37')][_0x0b1b('0x66')]),'OpenchannelQueueId':Number(_0x3f7952[_0x0b1b('0x4d')]['id'])});}});}})[_0x0b1b('0x29')](respondWithStatusCode(_0x3082d8,null))[_0x0b1b('0x4c')](handleError(_0x3082d8,null));};exports[_0x0b1b('0x8c')]=function(_0x26cbab,_0x10a9e1,_0x187b7d){var _0x2c02c7={};var _0x1c6a4c={};var _0x2ef78c;var _0x193ddd;return db[_0x0b1b('0x32')][_0x0b1b('0x59')]({'where':{'id':_0x26cbab['params']['id']}})[_0x0b1b('0x29')](handleEntityNotFound(_0x10a9e1,null))[_0x0b1b('0x29')](function(_0x367e1b){if(_0x367e1b){_0x2ef78c=_0x367e1b;_0x1c6a4c[_0x0b1b('0x35')]=_['keys'](db[_0x0b1b('0x68')][_0x0b1b('0x33')]);_0x1c6a4c[_0x0b1b('0x37')]=_[_0x0b1b('0x38')](_0x26cbab['query']);_0x1c6a4c[_0x0b1b('0x39')]=_['intersection'](_0x1c6a4c['model'],_0x1c6a4c[_0x0b1b('0x37')]);_0x2c02c7['attributes']=_[_0x0b1b('0x3a')](_0x1c6a4c[_0x0b1b('0x35')],qs[_0x0b1b('0x3b')](_0x26cbab[_0x0b1b('0x37')]['fields']));_0x2c02c7[_0x0b1b('0x3c')]=_0x2c02c7[_0x0b1b('0x3c')]['length']?_0x2c02c7[_0x0b1b('0x3c')]:_0x1c6a4c[_0x0b1b('0x35')];_0x2c02c7[_0x0b1b('0x5a')]=qs['sort'](_0x26cbab[_0x0b1b('0x37')][_0x0b1b('0x41')]);_0x2c02c7[_0x0b1b('0x45')]=qs[_0x0b1b('0x39')](_[_0x0b1b('0x42')](_0x26cbab['query'],_0x1c6a4c[_0x0b1b('0x39')]));if(_0x26cbab[_0x0b1b('0x37')]['filter']){_0x2c02c7[_0x0b1b('0x45')]=_[_0x0b1b('0x44')](_0x2c02c7[_0x0b1b('0x45')],{'$or':_[_0x0b1b('0x36')](_0x2c02c7[_0x0b1b('0x3c')],function(_0x58ab52){var _0x2a4a70={};_0x2a4a70[_0x58ab52]={'$like':'%'+_0x26cbab[_0x0b1b('0x37')][_0x0b1b('0x43')]+'%'};return _0x2a4a70;})});}_0x2c02c7=_[_0x0b1b('0x44')]({},_0x2c02c7,_0x26cbab[_0x0b1b('0x8d')]);return _0x2ef78c[_0x0b1b('0x8c')](_0x2c02c7);}})[_0x0b1b('0x29')](function(_0x2473cd){if(_0x2473cd){_0x193ddd=_0x2473cd[_0x0b1b('0x3d')];if(!_0x26cbab[_0x0b1b('0x37')][_0x0b1b('0x3e')](_0x0b1b('0x3f'))){_0x2c02c7[_0x0b1b('0x40')]=qs[_0x0b1b('0x40')](_0x26cbab[_0x0b1b('0x37')][_0x0b1b('0x40')]);_0x2c02c7['offset']=qs['offset'](_0x26cbab[_0x0b1b('0x37')][_0x0b1b('0x22')]);}return _0x2ef78c['getAgents'](_0x2c02c7);}})[_0x0b1b('0x29')](function(_0x32b26b){if(_0x32b26b){return _0x32b26b?{'count':_0x193ddd,'rows':_0x32b26b}:null;}})[_0x0b1b('0x29')](respondWithResult(_0x10a9e1,null))[_0x0b1b('0x4c')](handleError(_0x10a9e1,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 79ce75f..4bc1fd4 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 _0x1382=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x386f06,_0x5ae926){var _0x952ee8=function(_0x4ec17c){while(--_0x4ec17c){_0x386f06['push'](_0x386f06['shift']());}};_0x952ee8(++_0x5ae926);}(_0x1382,0x16c));var _0x2138=function(_0xd7b08f,_0x5663d4){_0xd7b08f=_0xd7b08f-0x0;var _0x3c9028=_0x1382[_0xd7b08f];return _0x3c9028;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2138('0x0')](0x0);var events={'afterCreate':_0x2138('0x1'),'afterUpdate':_0x2138('0x2'),'afterDestroy':'remove'};function emitEvent(_0xe0faeb){return function(_0x110890,_0x529b2c,_0x42cdfd){OpenchannelQueueEvents['emit'](_0xe0faeb+':'+_0x110890['id'],_0x110890);OpenchannelQueueEvents[_0x2138('0x3')](_0xe0faeb,_0x110890);_0x42cdfd(null);};}for(var e in events){if(events[_0x2138('0x4')](e)){var event=events[e];OpenchannelQueue[_0x2138('0x5')](e,emitEvent(event));}}module[_0x2138('0x6')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x1e60=['OpenchannelQueue','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4ed4bf,_0x664e){var _0x26853f=function(_0x164078){while(--_0x164078){_0x4ed4bf['push'](_0x4ed4bf['shift']());}};_0x26853f(++_0x664e);}(_0x1e60,0xbc));var _0x01e6=function(_0x48188b,_0x1adcc5){_0x48188b=_0x48188b-0x0;var _0x24357c=_0x1e60[_0x48188b];return _0x24357c;};'use strict';var EventEmitter=require(_0x01e6('0x0'));var OpenchannelQueue=require(_0x01e6('0x1'))['db'][_0x01e6('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x01e6('0x3'),'afterUpdate':_0x01e6('0x4'),'afterDestroy':_0x01e6('0x5')};function emitEvent(_0x2a1cbc){return function(_0x17329a,_0x424f76,_0x5da506){OpenchannelQueueEvents[_0x01e6('0x6')](_0x2a1cbc+':'+_0x17329a['id'],_0x17329a);OpenchannelQueueEvents['emit'](_0x2a1cbc,_0x17329a);_0x5da506(null);};}for(var e in events){if(events[_0x01e6('0x7')](e)){var event=events[e];OpenchannelQueue[_0x01e6('0x8')](e,emitEvent(event));}}module[_0x01e6('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index c88bff6..0731076 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 _0xf7fb=['lodash','api','moment','bluebird','path','../../config/environment','exports','define','OpenchannelQueue','openchannel_queues'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf7fb,0x1cc));var _0xbf7f=function(_0xcad98c,_0x1d6d70){_0xcad98c=_0xcad98c-0x0;var _0x4f65b4=_0xf7fb[_0xcad98c];return _0x4f65b4;};'use strict';var _=require(_0xbf7f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbf7f('0x1'));var moment=require(_0xbf7f('0x2'));var BPromise=require(_0xbf7f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf7f('0x4'));var rimraf=require('rimraf');var config=require(_0xbf7f('0x5'));var attributes=require('./openchannelQueue.attributes');module[_0xbf7f('0x6')]=function(_0x1b00b5,_0x492c34){return _0x1b00b5[_0xbf7f('0x7')](_0xbf7f('0x8'),attributes,{'tableName':_0xbf7f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39cb=['openchannel_queues','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue'];(function(_0x169184,_0x389f12){var _0x34ae1a=function(_0x5f4fae){while(--_0x5f4fae){_0x169184['push'](_0x169184['shift']());}};_0x34ae1a(++_0x389f12);}(_0x39cb,0x1bd));var _0xb39c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x39cb[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xb39c('0x0'));var logger=require(_0xb39c('0x1'))('api');var moment=require(_0xb39c('0x2'));var BPromise=require(_0xb39c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb39c('0x4'));var rimraf=require(_0xb39c('0x5'));var config=require(_0xb39c('0x6'));var attributes=require(_0xb39c('0x7'));module[_0xb39c('0x8')]=function(_0x4ae4cf,_0x32cdcd){return _0x4ae4cf[_0xb39c('0x9')](_0xb39c('0xa'),attributes,{'tableName':_0xb39c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 293677a..4b806e0 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 _0x61e0=['defaults','redis','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','limit','include','map','model','debug','find','ShowOpenchannelQueue','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xc33ad2,_0xcc3046){var _0x2883f2=function(_0x57445b){while(--_0x57445b){_0xc33ad2['push'](_0xc33ad2['shift']());}};_0x2883f2(++_0xcc3046);}(_0x61e0,0x8f));var _0x061e=function(_0x25c2f8,_0x4d5d54){_0x25c2f8=_0x25c2f8-0x0;var _0x6141c6=_0x61e0[_0x25c2f8];return _0x6141c6;};'use strict';var _=require('lodash');var util=require(_0x061e('0x0'));var moment=require(_0x061e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x061e('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x061e('0x3'))(_0x061e('0x4'));var config=require(_0x061e('0x5'));var jayson=require(_0x061e('0x6'));var client=jayson[_0x061e('0x7')][_0x061e('0x8')]({'port':0x232a});config['redis']=_[_0x061e('0x9')](config[_0x061e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x061e('0xb'))(new Redis(config['redis']));require(_0x061e('0xc'))[_0x061e('0xd')](socket);function respondWithRpcPromise(_0x359bd9,_0x3f9efd,_0x29f85d){return new BPromise(function(_0xa3f2b9,_0x2f5eef){return client[_0x061e('0xe')](_0x359bd9,_0x29f85d)[_0x061e('0xf')](function(_0x5c7115){logger[_0x061e('0x10')](_0x061e('0x11'),_0x3f9efd,'request\x20sent');logger['debug'](_0x061e('0x12'),_0x3f9efd,'request\x20sent',JSON[_0x061e('0x13')](_0x5c7115));if(_0x5c7115[_0x061e('0x14')]){if(_0x5c7115[_0x061e('0x14')]['code']===0x1f4){logger['error'](_0x061e('0x11'),_0x3f9efd,_0x5c7115[_0x061e('0x14')][_0x061e('0x15')]);return _0x2f5eef(_0x5c7115[_0x061e('0x14')][_0x061e('0x15')]);}logger[_0x061e('0x14')](_0x061e('0x11'),_0x3f9efd,_0x5c7115[_0x061e('0x14')][_0x061e('0x15')]);return _0xa3f2b9(_0x5c7115[_0x061e('0x14')][_0x061e('0x15')]);}else{logger[_0x061e('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x3f9efd,_0x061e('0x16'));_0xa3f2b9(_0x5c7115[_0x061e('0x17')][_0x061e('0x15')]);}})[_0x061e('0x18')](function(_0x22a14){logger['error'](_0x061e('0x11'),_0x3f9efd,_0x22a14);_0x2f5eef(_0x22a14);});});}exports[_0x061e('0x19')]=function(_0x1c8891){var _0x3ac0af=this;return new Promise(function(_0x144166,_0x333809){return db[_0x061e('0x1a')]['findAll']({'raw':_0x1c8891['options']?_0x1c8891[_0x061e('0x1b')][_0x061e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1c8891[_0x061e('0x1b')]?_0x1c8891['options'][_0x061e('0x1d')]||null:null,'attributes':_0x1c8891[_0x061e('0x1b')]?_0x1c8891[_0x061e('0x1b')][_0x061e('0x1e')]||null:null,'limit':_0x1c8891['options']?_0x1c8891['options'][_0x061e('0x1f')]||null:null,'include':_0x1c8891['options']?_0x1c8891[_0x061e('0x1b')][_0x061e('0x20')]?_[_0x061e('0x21')](_0x1c8891[_0x061e('0x1b')][_0x061e('0x20')],function(_0x49e57f){return{'model':db[_0x49e57f[_0x061e('0x22')]],'as':_0x49e57f['as'],'attributes':_0x49e57f[_0x061e('0x1e')],'include':_0x49e57f[_0x061e('0x20')]?_[_0x061e('0x21')](_0x49e57f[_0x061e('0x20')],function(_0x2334e7){return{'model':db[_0x2334e7['model']],'as':_0x2334e7['as'],'attributes':_0x2334e7[_0x061e('0x1e')],'include':_0x2334e7[_0x061e('0x20')]?_[_0x061e('0x21')](_0x2334e7['include'],function(_0x55a7f1){return{'model':db[_0x55a7f1[_0x061e('0x22')]],'as':_0x55a7f1['as'],'attributes':_0x55a7f1[_0x061e('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51192e){logger[_0x061e('0x10')](_0x061e('0x19'),_0x1c8891);logger[_0x061e('0x23')](_0x061e('0x19'),_0x1c8891,JSON['stringify'](_0x51192e));_0x144166(_0x51192e);})[_0x061e('0x18')](function(_0x706145){logger[_0x061e('0x14')](_0x061e('0x19'),_0x706145['message'],_0x1c8891);_0x333809(_0x3ac0af[_0x061e('0x14')](0x1f4,_0x706145[_0x061e('0x15')]));});});};exports['ShowOpenchannelQueue']=function(_0x327ff4){var _0xb85371=this;return new Promise(function(_0x1be430,_0x345181){return db[_0x061e('0x1a')][_0x061e('0x24')]({'raw':_0x327ff4[_0x061e('0x1b')]?_0x327ff4[_0x061e('0x1b')][_0x061e('0x1c')]===undefined?!![]:![]:!![],'where':_0x327ff4[_0x061e('0x1b')]?_0x327ff4[_0x061e('0x1b')]['where']||null:null,'attributes':_0x327ff4[_0x061e('0x1b')]?_0x327ff4[_0x061e('0x1b')][_0x061e('0x1e')]||null:null,'include':_0x327ff4[_0x061e('0x1b')]?_0x327ff4[_0x061e('0x1b')][_0x061e('0x20')]?_['map'](_0x327ff4[_0x061e('0x1b')][_0x061e('0x20')],function(_0x5ce3d1){return{'model':db[_0x5ce3d1[_0x061e('0x22')]],'as':_0x5ce3d1['as'],'attributes':_0x5ce3d1[_0x061e('0x1e')],'include':_0x5ce3d1['include']?_[_0x061e('0x21')](_0x5ce3d1[_0x061e('0x20')],function(_0x1c4359){return{'model':db[_0x1c4359['model']],'as':_0x1c4359['as'],'attributes':_0x1c4359[_0x061e('0x1e')],'include':_0x1c4359['include']?_[_0x061e('0x21')](_0x1c4359['include'],function(_0x22f2f1){return{'model':db[_0x22f2f1[_0x061e('0x22')]],'as':_0x22f2f1['as'],'attributes':_0x22f2f1[_0x061e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x061e('0xf')](function(_0x4d75f5){logger[_0x061e('0x10')]('ShowOpenchannelQueue',_0x327ff4);logger[_0x061e('0x23')](_0x061e('0x25'),_0x327ff4,JSON[_0x061e('0x13')](_0x4d75f5));_0x1be430(_0x4d75f5);})[_0x061e('0x18')](function(_0x310536){logger[_0x061e('0x14')](_0x061e('0x25'),_0x310536[_0x061e('0x15')],_0x327ff4);_0x345181(_0xb85371[_0x061e('0x14')](0x1f4,_0x310536['message']));});});}; \ No newline at end of file +var _0xd947=['findAll','options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','stringify','ShowOpenchannelQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','request\x20sent','debug','error','code','OpenchannelQueue,\x20%s,\x20%s','message','info','catch','OpenchannelQueue'];(function(_0x5ce075,_0x20b649){var _0x595e7d=function(_0x4384dc){while(--_0x4384dc){_0x5ce075['push'](_0x5ce075['shift']());}};_0x595e7d(++_0x20b649);}(_0xd947,0xa9));var _0x7d94=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd947[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7d94('0x0'));var util=require('util');var moment=require(_0x7d94('0x1'));var BPromise=require(_0x7d94('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d94('0x3'));var db=require(_0x7d94('0x4'))['db'];var utils=require(_0x7d94('0x5'));var logger=require(_0x7d94('0x6'))(_0x7d94('0x7'));var config=require(_0x7d94('0x8'));var jayson=require(_0x7d94('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x7d94('0xa')](config['redis'],{'host':_0x7d94('0xb'),'port':0x18eb});var socket=require(_0x7d94('0xc'))(new Redis(config['redis']));require(_0x7d94('0xd'))[_0x7d94('0xe')](socket);function respondWithRpcPromise(_0x177b50,_0x4b984f,_0x539a03){return new BPromise(function(_0x33dde8,_0x18aa50){return client[_0x7d94('0xf')](_0x177b50,_0x539a03)[_0x7d94('0x10')](function(_0x21c1fa){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x4b984f,_0x7d94('0x11'));logger[_0x7d94('0x12')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4b984f,_0x7d94('0x11'),JSON['stringify'](_0x21c1fa));if(_0x21c1fa[_0x7d94('0x13')]){if(_0x21c1fa['error'][_0x7d94('0x14')]===0x1f4){logger['error'](_0x7d94('0x15'),_0x4b984f,_0x21c1fa[_0x7d94('0x13')]['message']);return _0x18aa50(_0x21c1fa[_0x7d94('0x13')]['message']);}logger[_0x7d94('0x13')](_0x7d94('0x15'),_0x4b984f,_0x21c1fa['error']['message']);return _0x33dde8(_0x21c1fa[_0x7d94('0x13')][_0x7d94('0x16')]);}else{logger[_0x7d94('0x17')](_0x7d94('0x15'),_0x4b984f,'request\x20sent');_0x33dde8(_0x21c1fa['result'][_0x7d94('0x16')]);}})[_0x7d94('0x18')](function(_0x1cad2f){logger[_0x7d94('0x13')](_0x7d94('0x15'),_0x4b984f,_0x1cad2f);_0x18aa50(_0x1cad2f);});});}exports['GetOpenchannelQueue']=function(_0xf389aa){var _0x378a63=this;return new Promise(function(_0x2c4d1c,_0x3f18ac){return db[_0x7d94('0x19')][_0x7d94('0x1a')]({'raw':_0xf389aa[_0x7d94('0x1b')]?_0xf389aa[_0x7d94('0x1b')][_0x7d94('0x1c')]===undefined?!![]:![]:!![],'where':_0xf389aa[_0x7d94('0x1b')]?_0xf389aa['options'][_0x7d94('0x1d')]||null:null,'attributes':_0xf389aa[_0x7d94('0x1b')]?_0xf389aa[_0x7d94('0x1b')][_0x7d94('0x1e')]||null:null,'limit':_0xf389aa['options']?_0xf389aa['options'][_0x7d94('0x1f')]||null:null,'include':_0xf389aa[_0x7d94('0x1b')]?_0xf389aa['options'][_0x7d94('0x20')]?_[_0x7d94('0x21')](_0xf389aa[_0x7d94('0x1b')][_0x7d94('0x20')],function(_0x1741d0){return{'model':db[_0x1741d0[_0x7d94('0x22')]],'as':_0x1741d0['as'],'attributes':_0x1741d0[_0x7d94('0x1e')],'include':_0x1741d0[_0x7d94('0x20')]?_[_0x7d94('0x21')](_0x1741d0[_0x7d94('0x20')],function(_0x1e70c2){return{'model':db[_0x1e70c2[_0x7d94('0x22')]],'as':_0x1e70c2['as'],'attributes':_0x1e70c2[_0x7d94('0x1e')],'include':_0x1e70c2[_0x7d94('0x20')]?_[_0x7d94('0x21')](_0x1e70c2[_0x7d94('0x20')],function(_0x8dfa9c){return{'model':db[_0x8dfa9c[_0x7d94('0x22')]],'as':_0x8dfa9c['as'],'attributes':_0x8dfa9c[_0x7d94('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x301ebe){logger['info'](_0x7d94('0x23'),_0xf389aa);logger[_0x7d94('0x12')](_0x7d94('0x23'),_0xf389aa,JSON[_0x7d94('0x24')](_0x301ebe));_0x2c4d1c(_0x301ebe);})[_0x7d94('0x18')](function(_0x3a0d28){logger[_0x7d94('0x13')]('GetOpenchannelQueue',_0x3a0d28[_0x7d94('0x16')],_0xf389aa);_0x3f18ac(_0x378a63[_0x7d94('0x13')](0x1f4,_0x3a0d28[_0x7d94('0x16')]));});});};exports[_0x7d94('0x25')]=function(_0x2030f5){var _0x138492=this;return new Promise(function(_0x5ee6fc,_0x4573fd){return db[_0x7d94('0x19')][_0x7d94('0x26')]({'raw':_0x2030f5[_0x7d94('0x1b')]?_0x2030f5[_0x7d94('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2030f5['options']?_0x2030f5[_0x7d94('0x1b')][_0x7d94('0x1d')]||null:null,'attributes':_0x2030f5[_0x7d94('0x1b')]?_0x2030f5[_0x7d94('0x1b')][_0x7d94('0x1e')]||null:null,'include':_0x2030f5[_0x7d94('0x1b')]?_0x2030f5['options'][_0x7d94('0x20')]?_['map'](_0x2030f5['options'][_0x7d94('0x20')],function(_0x5c2168){return{'model':db[_0x5c2168[_0x7d94('0x22')]],'as':_0x5c2168['as'],'attributes':_0x5c2168[_0x7d94('0x1e')],'include':_0x5c2168[_0x7d94('0x20')]?_[_0x7d94('0x21')](_0x5c2168[_0x7d94('0x20')],function(_0xd5b13f){return{'model':db[_0xd5b13f[_0x7d94('0x22')]],'as':_0xd5b13f['as'],'attributes':_0xd5b13f[_0x7d94('0x1e')],'include':_0xd5b13f[_0x7d94('0x20')]?_['map'](_0xd5b13f['include'],function(_0x422be3){return{'model':db[_0x422be3[_0x7d94('0x22')]],'as':_0x422be3['as'],'attributes':_0x422be3[_0x7d94('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7d94('0x10')](function(_0x3ad6d1){logger[_0x7d94('0x17')](_0x7d94('0x25'),_0x2030f5);logger[_0x7d94('0x12')](_0x7d94('0x25'),_0x2030f5,JSON[_0x7d94('0x24')](_0x3ad6d1));_0x5ee6fc(_0x3ad6d1);})['catch'](function(_0x413b54){logger[_0x7d94('0x13')]('ShowOpenchannelQueue',_0x413b54['message'],_0x2030f5);_0x4573fd(_0x138492['error'](0x1f4,_0x413b54[_0x7d94('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index a6476a7..59595a9 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 _0xc695=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit','removeListener'];(function(_0x3b3ccd,_0x51b102){var _0x38aab0=function(_0x1f1242){while(--_0x1f1242){_0x3b3ccd['push'](_0x3b3ccd['shift']());}};_0x38aab0(++_0x51b102);}(_0xc695,0x108));var _0x5c69=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0xc695[_0xbeb808];return _0x5d6909;};'use strict';var OpenchannelQueueEvents=require(_0x5c69('0x0'));var events=[_0x5c69('0x1'),_0x5c69('0x2'),_0x5c69('0x3')];function createListener(_0x39de16,_0x3a3822){return function(_0x39115a){_0x3a3822[_0x5c69('0x4')](_0x39de16,_0x39115a);};}function removeListener(_0x40c798,_0x1cae4c){return function(){OpenchannelQueueEvents[_0x5c69('0x5')](_0x40c798,_0x1cae4c);};}exports[_0x5c69('0x6')]=function(_0x3c74b3){for(var _0x5d4a69=0x0,_0x375282=events[_0x5c69('0x7')];_0x5d4a69<_0x375282;_0x5d4a69++){var _0x4b5006=events[_0x5d4a69];var _0x2daf75=createListener(_0x5c69('0x8')+_0x4b5006,_0x3c74b3);OpenchannelQueueEvents['on'](_0x4b5006,_0x2daf75);}}; \ No newline at end of file +var _0x3ca1=['emit','removeListener','openchannelQueue:'];(function(_0x2ee4ae,_0x48d3fc){var _0x19f30d=function(_0x55c2f8){while(--_0x55c2f8){_0x2ee4ae['push'](_0x2ee4ae['shift']());}};_0x19f30d(++_0x48d3fc);}(_0x3ca1,0xa5));var _0x13ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ca1[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save','remove','update'];function createListener(_0x35fd16,_0x535d12){return function(_0x65a448){_0x535d12[_0x13ca('0x0')](_0x35fd16,_0x65a448);};}function removeListener(_0x2ee37f,_0x36ad3f){return function(){OpenchannelQueueEvents[_0x13ca('0x1')](_0x2ee37f,_0x36ad3f);};}exports['register']=function(_0x4e69cd){for(var _0x24194c=0x0,_0x47ad14=events['length'];_0x24194c<_0x47ad14;_0x24194c++){var _0x43566b=events[_0x24194c];var _0x27f2f6=createListener(_0x13ca('0x2')+_0x43566b,_0x4e69cd);OpenchannelQueueEvents['on'](_0x43566b,_0x27f2f6);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 3071542..cbe55c5 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 _0x66cd=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','describe','show','post','update','delete','destroy','multer'];(function(_0x11ecf4,_0x3742dd){var _0x552b7c=function(_0x47952e){while(--_0x47952e){_0x11ecf4['push'](_0x11ecf4['shift']());}};_0x552b7c(++_0x3742dd);}(_0x66cd,0x18b));var _0xd66c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x66cd[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xd66c('0x0'));var util=require(_0xd66c('0x1'));var path=require(_0xd66c('0x2'));var timeout=require('connect-timeout');var express=require(_0xd66c('0x3'));var router=express[_0xd66c('0x4')]();var fs_extra=require(_0xd66c('0x5'));var auth=require(_0xd66c('0x6'));var interaction=require(_0xd66c('0x7'));var config=require(_0xd66c('0x8'));var controller=require(_0xd66c('0x9'));router[_0xd66c('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd66c('0xa')]('/describe',auth[_0xd66c('0xb')](),controller[_0xd66c('0xc')]);router[_0xd66c('0xa')]('/:id',auth[_0xd66c('0xb')](),controller[_0xd66c('0xd')]);router[_0xd66c('0xe')]('/',auth[_0xd66c('0xb')](),controller['create']);router['put']('/:id',auth[_0xd66c('0xb')](),controller[_0xd66c('0xf')]);router[_0xd66c('0x10')]('/:id',auth[_0xd66c('0xb')](),controller[_0xd66c('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb90b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x1b3f63,_0x5578c9){var _0x39005d=function(_0x3b99ff){while(--_0x3b99ff){_0x1b3f63['push'](_0x1b3f63['shift']());}};_0x39005d(++_0x5578c9);}(_0xb90b,0x14f));var _0xbb90=function(_0x4c1b08,_0x1bc47f){_0x4c1b08=_0x4c1b08-0x0;var _0x12e221=_0xb90b[_0x4c1b08];return _0x12e221;};'use strict';var multer=require(_0xbb90('0x0'));var util=require(_0xbb90('0x1'));var path=require(_0xbb90('0x2'));var timeout=require(_0xbb90('0x3'));var express=require(_0xbb90('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbb90('0x5'));var interaction=require(_0xbb90('0x6'));var config=require(_0xbb90('0x7'));var controller=require(_0xbb90('0x8'));router[_0xbb90('0x9')]('/',auth[_0xbb90('0xa')](),controller[_0xbb90('0xb')]);router[_0xbb90('0x9')](_0xbb90('0xc'),auth[_0xbb90('0xa')](),controller['describe']);router[_0xbb90('0x9')](_0xbb90('0xd'),auth[_0xbb90('0xa')](),controller[_0xbb90('0xe')]);router[_0xbb90('0xf')]('/',auth[_0xbb90('0xa')](),controller[_0xbb90('0x10')]);router['put']('/:id',auth[_0xbb90('0xa')](),controller[_0xbb90('0x11')]);router[_0xbb90('0x12')](_0xbb90('0xd'),auth[_0xbb90('0xa')](),controller[_0xbb90('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 5f5e6af..fc0d4cc 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 _0x1e5f=['sequelize','STRING','DATE'];(function(_0x207f36,_0x155944){var _0x584373=function(_0xb10786){while(--_0xb10786){_0x207f36['push'](_0x207f36['shift']());}};_0x584373(++_0x155944);}(_0x1e5f,0x15c));var _0xf1e5=function(_0x4573bd,_0x19b9b5){_0x4573bd=_0x4573bd-0x0;var _0xc07bb9=_0x1e5f[_0x4573bd];return _0xc07bb9;};'use strict';var moment=require('moment');var Sequelize=require(_0xf1e5('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xf1e5('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xf1e5('0x1')]},'joinAt':{'type':Sequelize[_0xf1e5('0x2')]},'leaveAt':{'type':Sequelize[_0xf1e5('0x2')]},'acceptAt':{'type':Sequelize[_0xf1e5('0x2')]},'exitAt':{'type':Sequelize[_0xf1e5('0x2')]},'reason':{'type':Sequelize[_0xf1e5('0x1')]}}; \ No newline at end of file +var _0x6428=['sequelize','exports','STRING','DATE'];(function(_0x4132de,_0x5ef197){var _0x1df0eb=function(_0x1a13cc){while(--_0x1a13cc){_0x4132de['push'](_0x4132de['shift']());}};_0x1df0eb(++_0x5ef197);}(_0x6428,0x150));var _0x8642=function(_0x28669c,_0x1f62c4){_0x28669c=_0x28669c-0x0;var _0x4a3af6=_0x6428[_0x28669c];return _0x4a3af6;};'use strict';var moment=require('moment');var Sequelize=require(_0x8642('0x0'));module[_0x8642('0x1')]={'uniqueid':{'type':Sequelize[_0x8642('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x8642('0x2')]},'joinAt':{'type':Sequelize[_0x8642('0x3')]},'leaveAt':{'type':Sequelize[_0x8642('0x3')]},'acceptAt':{'type':Sequelize[_0x8642('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8642('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 2a660a4..740a39d 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 _0x2675=['limit','count','Content-Range','json','apply','reject','destroy','then','error','name','send','index','map','OpenchannelQueueReport','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','rawAttributes','length','options','find','create','body','update','params','describe','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x594eb1,_0x59f028){var _0x161782=function(_0x1132c5){while(--_0x1132c5){_0x594eb1['push'](_0x594eb1['shift']());}};_0x161782(++_0x59f028);}(_0x2675,0x75));var _0x5267=function(_0x1481ec,_0x4d94dc){_0x1481ec=_0x1481ec-0x0;var _0x315c05=_0x2675[_0x1481ec];return _0x315c05;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];function respondWithStatusCode(_0x1f9be3,_0x1d7090){_0x1d7090=_0x1d7090||0xcc;return function(_0x1171b9){if(_0x1171b9){return _0x1f9be3[_0x5267('0x16')](_0x1d7090);}return _0x1f9be3[_0x5267('0x17')](_0x1d7090)[_0x5267('0x18')]();};}function respondWithResult(_0x1e2d3b,_0x16e5a7){_0x16e5a7=_0x16e5a7||0xc8;return function(_0x29349a){if(_0x29349a){return _0x1e2d3b[_0x5267('0x17')](_0x16e5a7)['json'](_0x29349a);}};}function respondWithFilteredResult(_0x52e24e,_0xa593fb){return function(_0x40d897){if(_0x40d897){var _0x38a147=typeof _0xa593fb[_0x5267('0x19')]===_0x5267('0x1a')&&typeof _0xa593fb[_0x5267('0x1b')]===_0x5267('0x1a');var _0x6831e0=_0x40d897[_0x5267('0x1c')];var _0xb1c97a=_0x38a147?0x0:_0xa593fb[_0x5267('0x19')];var _0x1ab03=_0x38a147?_0x40d897['count']:_0xa593fb[_0x5267('0x19')]+_0xa593fb[_0x5267('0x1b')];var _0x5069e8;if(_0x1ab03>=_0x6831e0){_0x1ab03=_0x6831e0;_0x5069e8=0xc8;}else{_0x5069e8=0xce;}_0x52e24e[_0x5267('0x17')](_0x5069e8);return _0x52e24e['set'](_0x5267('0x1d'),_0xb1c97a+'-'+_0x1ab03+'/'+_0x6831e0)[_0x5267('0x1e')](_0x40d897);}return null;};}function patchUpdates(_0x39c0c3){return function(_0x2a9f99){try{jsonpatch[_0x5267('0x1f')](_0x2a9f99,_0x39c0c3,!![]);}catch(_0x4dd637){return BPromise[_0x5267('0x20')](_0x4dd637);}return _0x2a9f99['save']();};}function saveUpdates(_0xa32663,_0x420fb8){return function(_0x3b53ac){if(_0x3b53ac){return _0x3b53ac['update'](_0xa32663)['then'](function(_0x5546e2){return _0x5546e2;});}return null;};}function removeEntity(_0x4a17c7,_0x5ea6a6){return function(_0x26c7f8){if(_0x26c7f8){return _0x26c7f8[_0x5267('0x21')]()[_0x5267('0x22')](function(){_0x4a17c7[_0x5267('0x17')](0xcc)[_0x5267('0x18')]();});}};}function handleEntityNotFound(_0x40d1be,_0x126a97){return function(_0x220e03){if(!_0x220e03){_0x40d1be[_0x5267('0x16')](0x194);}return _0x220e03;};}function handleError(_0x59f112,_0x5cb64f){_0x5cb64f=_0x5cb64f||0x1f4;return function(_0x354111){logger[_0x5267('0x23')](_0x354111['stack']);if(_0x354111[_0x5267('0x24')]){delete _0x354111['name'];}_0x59f112['status'](_0x5cb64f)[_0x5267('0x25')](_0x354111);};}exports[_0x5267('0x26')]=function(_0x1f33b7,_0x2d2ace){var _0x33c431={},_0x4f3d4d={},_0x5e87eb={'count':0x0,'rows':[]};var _0x18020c=_[_0x5267('0x27')](db[_0x5267('0x28')]['rawAttributes'],function(_0x58d685){return{'name':_0x58d685[_0x5267('0x29')],'type':_0x58d685[_0x5267('0x2a')][_0x5267('0x2b')]};});_0x4f3d4d['model']=_['map'](_0x18020c,_0x5267('0x24'));_0x4f3d4d[_0x5267('0x2c')]=_[_0x5267('0x2d')](_0x1f33b7[_0x5267('0x2c')]);_0x4f3d4d['filters']=_[_0x5267('0x2e')](_0x4f3d4d[_0x5267('0x2f')],_0x4f3d4d[_0x5267('0x2c')]);_0x33c431[_0x5267('0x30')]=_[_0x5267('0x2e')](_0x4f3d4d[_0x5267('0x2f')],qs[_0x5267('0x31')](_0x1f33b7[_0x5267('0x2c')]['fields']));_0x33c431['attributes']=_0x33c431[_0x5267('0x30')]['length']?_0x33c431[_0x5267('0x30')]:_0x4f3d4d[_0x5267('0x2f')];if(!_0x1f33b7[_0x5267('0x2c')][_0x5267('0x32')]('nolimit')){_0x33c431[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0x1f33b7[_0x5267('0x2c')][_0x5267('0x1b')]);_0x33c431[_0x5267('0x19')]=qs[_0x5267('0x19')](_0x1f33b7[_0x5267('0x2c')][_0x5267('0x19')]);}_0x33c431['order']=qs[_0x5267('0x33')](_0x1f33b7['query'][_0x5267('0x33')]);_0x33c431[_0x5267('0x34')]=qs[_0x5267('0x35')](_[_0x5267('0x36')](_0x1f33b7[_0x5267('0x2c')],_0x4f3d4d[_0x5267('0x35')]),_0x18020c);if(_0x1f33b7[_0x5267('0x2c')]['filter']){_0x33c431[_0x5267('0x34')]=_[_0x5267('0x37')](_0x33c431[_0x5267('0x34')],{'$or':_[_0x5267('0x27')](_0x18020c,function(_0x82cea7){if(_0x82cea7[_0x5267('0x2a')]!==_0x5267('0x38')){var _0x487dfc={};_0x487dfc[_0x82cea7[_0x5267('0x24')]]={'$like':'%'+_0x1f33b7['query'][_0x5267('0x39')]+'%'};return _0x487dfc;}})});}_0x33c431=_['merge']({},_0x33c431,_0x1f33b7['options']);var _0x51bddd={'where':_0x33c431[_0x5267('0x34')]};return db['OpenchannelQueueReport'][_0x5267('0x1c')](_0x51bddd)[_0x5267('0x22')](function(_0x3d4b19){_0x5e87eb[_0x5267('0x1c')]=_0x3d4b19;if(_0x1f33b7['query'][_0x5267('0x3a')]){_0x33c431[_0x5267('0x3b')]=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0x33c431);})[_0x5267('0x22')](function(_0x560cdf){_0x5e87eb[_0x5267('0x3c')]=_0x560cdf;return _0x5e87eb;})[_0x5267('0x22')](respondWithFilteredResult(_0x2d2ace,_0x33c431))[_0x5267('0x3d')](handleError(_0x2d2ace,null));};exports[_0x5267('0x3e')]=function(_0x36d0f1,_0x3012cb){var _0x27add5={'raw':!![],'where':{'id':_0x36d0f1['params']['id']}},_0x5697b3={};_0x5697b3[_0x5267('0x2f')]=_['keys'](db[_0x5267('0x28')][_0x5267('0x3f')]);_0x5697b3['query']=_[_0x5267('0x2d')](_0x36d0f1[_0x5267('0x2c')]);_0x5697b3[_0x5267('0x35')]=_[_0x5267('0x2e')](_0x5697b3[_0x5267('0x2f')],_0x5697b3[_0x5267('0x2c')]);_0x27add5[_0x5267('0x30')]=_[_0x5267('0x2e')](_0x5697b3[_0x5267('0x2f')],qs['fields'](_0x36d0f1[_0x5267('0x2c')][_0x5267('0x31')]));_0x27add5[_0x5267('0x30')]=_0x27add5[_0x5267('0x30')][_0x5267('0x40')]?_0x27add5['attributes']:_0x5697b3[_0x5267('0x2f')];if(_0x36d0f1['query'][_0x5267('0x3a')]){_0x27add5['include']=[{'all':!![]}];}_0x27add5=_['merge']({},_0x27add5,_0x36d0f1[_0x5267('0x41')]);return db['OpenchannelQueueReport'][_0x5267('0x42')](_0x27add5)[_0x5267('0x22')](handleEntityNotFound(_0x3012cb,null))[_0x5267('0x22')](respondWithResult(_0x3012cb,null))[_0x5267('0x3d')](handleError(_0x3012cb,null));};exports['create']=function(_0x12d6a8,_0x4ee826){return db['OpenchannelQueueReport'][_0x5267('0x43')](_0x12d6a8[_0x5267('0x44')],{})['then'](respondWithResult(_0x4ee826,0xc9))['catch'](handleError(_0x4ee826,null));};exports[_0x5267('0x45')]=function(_0xe0439e,_0x3d2436){if(_0xe0439e[_0x5267('0x44')]['id']){delete _0xe0439e[_0x5267('0x44')]['id'];}return db[_0x5267('0x28')][_0x5267('0x42')]({'where':{'id':_0xe0439e[_0x5267('0x46')]['id']}})[_0x5267('0x22')](handleEntityNotFound(_0x3d2436,null))[_0x5267('0x22')](saveUpdates(_0xe0439e[_0x5267('0x44')],null))[_0x5267('0x22')](respondWithResult(_0x3d2436,null))[_0x5267('0x3d')](handleError(_0x3d2436,null));};exports[_0x5267('0x21')]=function(_0x4f7f75,_0x8636d0){return db[_0x5267('0x28')][_0x5267('0x42')]({'where':{'id':_0x4f7f75['params']['id']}})[_0x5267('0x22')](handleEntityNotFound(_0x8636d0,null))[_0x5267('0x22')](removeEntity(_0x8636d0,null))[_0x5267('0x3d')](handleError(_0x8636d0,null));};exports[_0x5267('0x47')]=function(_0x119546,_0x1457cf){return db['OpenchannelQueueReport'][_0x5267('0x47')]()['then'](respondWithResult(_0x1457cf,null))[_0x5267('0x3d')](handleError(_0x1457cf,null));}; \ No newline at end of file +var _0xf494=['create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','length','find'];(function(_0x4fd4c9,_0x2ca01e){var _0x427aaf=function(_0x161759){while(--_0x161759){_0x4fd4c9['push'](_0x4fd4c9['shift']());}};_0x427aaf(++_0x2ca01e);}(_0xf494,0x1c6));var _0x4f49=function(_0x5e1ddd,_0xbb152c){_0x5e1ddd=_0x5e1ddd-0x0;var _0x3a68a1=_0xf494[_0x5e1ddd];return _0x3a68a1;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];function respondWithStatusCode(_0x12527d,_0x4bf89f){_0x4bf89f=_0x4bf89f||0xcc;return function(_0x1e1c37){if(_0x1e1c37){return _0x12527d[_0x4f49('0x19')](_0x4bf89f);}return _0x12527d[_0x4f49('0x1a')](_0x4bf89f)[_0x4f49('0x1b')]();};}function respondWithResult(_0x1a0f1e,_0x2f0131){_0x2f0131=_0x2f0131||0xc8;return function(_0xfdb477){if(_0xfdb477){return _0x1a0f1e['status'](_0x2f0131)[_0x4f49('0x1c')](_0xfdb477);}};}function respondWithFilteredResult(_0x1f2d0d,_0x415e83){return function(_0x5878f4){if(_0x5878f4){var _0x5bdfaf=typeof _0x415e83[_0x4f49('0x1d')]===_0x4f49('0x1e')&&typeof _0x415e83[_0x4f49('0x1f')]==='undefined';var _0x1dccfd=_0x5878f4[_0x4f49('0x20')];var _0x4e85df=_0x5bdfaf?0x0:_0x415e83['offset'];var _0x5bb23b=_0x5bdfaf?_0x5878f4['count']:_0x415e83['offset']+_0x415e83[_0x4f49('0x1f')];var _0x1834f4;if(_0x5bb23b>=_0x1dccfd){_0x5bb23b=_0x1dccfd;_0x1834f4=0xc8;}else{_0x1834f4=0xce;}_0x1f2d0d[_0x4f49('0x1a')](_0x1834f4);return _0x1f2d0d[_0x4f49('0x21')]('Content-Range',_0x4e85df+'-'+_0x5bb23b+'/'+_0x1dccfd)[_0x4f49('0x1c')](_0x5878f4);}return null;};}function patchUpdates(_0x2aed27){return function(_0x197a49){try{jsonpatch[_0x4f49('0x22')](_0x197a49,_0x2aed27,!![]);}catch(_0xea82f8){return BPromise['reject'](_0xea82f8);}return _0x197a49[_0x4f49('0x23')]();};}function saveUpdates(_0x357446,_0x3ae590){return function(_0x53b57d){if(_0x53b57d){return _0x53b57d[_0x4f49('0x24')](_0x357446)[_0x4f49('0x25')](function(_0x32ca7b){return _0x32ca7b;});}return null;};}function removeEntity(_0x43c458,_0x9d30aa){return function(_0x36187b){if(_0x36187b){return _0x36187b['destroy']()['then'](function(){_0x43c458[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x4fedbb,_0x408552){return function(_0x2c1519){if(!_0x2c1519){_0x4fedbb[_0x4f49('0x19')](0x194);}return _0x2c1519;};}function handleError(_0x525950,_0xc54070){_0xc54070=_0xc54070||0x1f4;return function(_0x2eed1c){logger[_0x4f49('0x26')](_0x2eed1c[_0x4f49('0x27')]);if(_0x2eed1c[_0x4f49('0x28')]){delete _0x2eed1c[_0x4f49('0x28')];}_0x525950['status'](_0xc54070)['send'](_0x2eed1c);};}exports[_0x4f49('0x29')]=function(_0x2c00ee,_0x605c91){var _0x560050={},_0x3cbfbd={},_0x206203={'count':0x0,'rows':[]};var _0x43d8e3=_['map'](db['OpenchannelQueueReport'][_0x4f49('0x2a')],function(_0x27d004){return{'name':_0x27d004[_0x4f49('0x2b')],'type':_0x27d004['type'][_0x4f49('0x2c')]};});_0x3cbfbd[_0x4f49('0x2d')]=_[_0x4f49('0x2e')](_0x43d8e3,_0x4f49('0x28'));_0x3cbfbd[_0x4f49('0x2f')]=_[_0x4f49('0x30')](_0x2c00ee[_0x4f49('0x2f')]);_0x3cbfbd[_0x4f49('0x31')]=_[_0x4f49('0x32')](_0x3cbfbd[_0x4f49('0x2d')],_0x3cbfbd[_0x4f49('0x2f')]);_0x560050[_0x4f49('0x33')]=_[_0x4f49('0x32')](_0x3cbfbd[_0x4f49('0x2d')],qs[_0x4f49('0x34')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x34')]));_0x560050[_0x4f49('0x33')]=_0x560050[_0x4f49('0x33')]['length']?_0x560050[_0x4f49('0x33')]:_0x3cbfbd[_0x4f49('0x2d')];if(!_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x35')](_0x4f49('0x36'))){_0x560050[_0x4f49('0x1f')]=qs[_0x4f49('0x1f')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x1f')]);_0x560050[_0x4f49('0x1d')]=qs[_0x4f49('0x1d')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x1d')]);}_0x560050['order']=qs[_0x4f49('0x37')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x37')]);_0x560050[_0x4f49('0x38')]=qs[_0x4f49('0x31')](_[_0x4f49('0x39')](_0x2c00ee[_0x4f49('0x2f')],_0x3cbfbd[_0x4f49('0x31')]),_0x43d8e3);if(_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x3a')]){_0x560050[_0x4f49('0x38')]=_[_0x4f49('0x3b')](_0x560050[_0x4f49('0x38')],{'$or':_[_0x4f49('0x2e')](_0x43d8e3,function(_0x4e3f72){if(_0x4e3f72[_0x4f49('0x3c')]!==_0x4f49('0x3d')){var _0x543605={};_0x543605[_0x4e3f72[_0x4f49('0x28')]]={'$like':'%'+_0x2c00ee[_0x4f49('0x2f')]['filter']+'%'};return _0x543605;}})});}_0x560050=_[_0x4f49('0x3b')]({},_0x560050,_0x2c00ee[_0x4f49('0x3e')]);var _0x2548ad={'where':_0x560050[_0x4f49('0x38')]};return db[_0x4f49('0x3f')][_0x4f49('0x20')](_0x2548ad)[_0x4f49('0x25')](function(_0x5d464e){_0x206203['count']=_0x5d464e;if(_0x2c00ee['query'][_0x4f49('0x40')]){_0x560050[_0x4f49('0x41')]=[{'all':!![]}];}return db[_0x4f49('0x3f')][_0x4f49('0x42')](_0x560050);})[_0x4f49('0x25')](function(_0x1ecf6c){_0x206203[_0x4f49('0x43')]=_0x1ecf6c;return _0x206203;})[_0x4f49('0x25')](respondWithFilteredResult(_0x605c91,_0x560050))[_0x4f49('0x44')](handleError(_0x605c91,null));};exports['show']=function(_0x5238a3,_0x412395){var _0x432b5d={'raw':!![],'where':{'id':_0x5238a3['params']['id']}},_0x159642={};_0x159642[_0x4f49('0x2d')]=_['keys'](db['OpenchannelQueueReport'][_0x4f49('0x2a')]);_0x159642[_0x4f49('0x2f')]=_[_0x4f49('0x30')](_0x5238a3['query']);_0x159642[_0x4f49('0x31')]=_[_0x4f49('0x32')](_0x159642['model'],_0x159642[_0x4f49('0x2f')]);_0x432b5d['attributes']=_[_0x4f49('0x32')](_0x159642[_0x4f49('0x2d')],qs[_0x4f49('0x34')](_0x5238a3['query'][_0x4f49('0x34')]));_0x432b5d[_0x4f49('0x33')]=_0x432b5d[_0x4f49('0x33')][_0x4f49('0x45')]?_0x432b5d[_0x4f49('0x33')]:_0x159642[_0x4f49('0x2d')];if(_0x5238a3[_0x4f49('0x2f')][_0x4f49('0x40')]){_0x432b5d[_0x4f49('0x41')]=[{'all':!![]}];}_0x432b5d=_[_0x4f49('0x3b')]({},_0x432b5d,_0x5238a3['options']);return db[_0x4f49('0x3f')][_0x4f49('0x46')](_0x432b5d)['then'](handleEntityNotFound(_0x412395,null))[_0x4f49('0x25')](respondWithResult(_0x412395,null))['catch'](handleError(_0x412395,null));};exports[_0x4f49('0x47')]=function(_0x41c580,_0x2d3dcd){return db[_0x4f49('0x3f')]['create'](_0x41c580[_0x4f49('0x48')],{})[_0x4f49('0x25')](respondWithResult(_0x2d3dcd,0xc9))[_0x4f49('0x44')](handleError(_0x2d3dcd,null));};exports[_0x4f49('0x24')]=function(_0x3ec266,_0x72ea05){if(_0x3ec266[_0x4f49('0x48')]['id']){delete _0x3ec266[_0x4f49('0x48')]['id'];}return db[_0x4f49('0x3f')][_0x4f49('0x46')]({'where':{'id':_0x3ec266[_0x4f49('0x49')]['id']}})[_0x4f49('0x25')](handleEntityNotFound(_0x72ea05,null))[_0x4f49('0x25')](saveUpdates(_0x3ec266[_0x4f49('0x48')],null))[_0x4f49('0x25')](respondWithResult(_0x72ea05,null))[_0x4f49('0x44')](handleError(_0x72ea05,null));};exports['destroy']=function(_0x4eadc2,_0xce5121){return db[_0x4f49('0x3f')][_0x4f49('0x46')]({'where':{'id':_0x4eadc2[_0x4f49('0x49')]['id']}})[_0x4f49('0x25')](handleEntityNotFound(_0xce5121,null))[_0x4f49('0x25')](removeEntity(_0xce5121,null))[_0x4f49('0x44')](handleError(_0xce5121,null));};exports['describe']=function(_0x6637f4,_0x4ff0a2){return db[_0x4f49('0x3f')][_0x4f49('0x4a')]()[_0x4f49('0x25')](respondWithResult(_0x4ff0a2,null))[_0x4f49('0x44')](handleError(_0x4ff0a2,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index e27e134..a2df35f 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 _0x4a9c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','OpenchannelQueueReport','uniqueid'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4a9c,0xcc));var _0xc4a9=function(_0x237de4,_0x28c340){_0x237de4=_0x237de4-0x0;var _0x33a51c=_0x4a9c[_0x237de4];return _0x33a51c;};'use strict';var _=require(_0xc4a9('0x0'));var util=require(_0xc4a9('0x1'));var logger=require(_0xc4a9('0x2'))(_0xc4a9('0x3'));var moment=require(_0xc4a9('0x4'));var BPromise=require(_0xc4a9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4a9('0x6'));var rimraf=require(_0xc4a9('0x7'));var config=require(_0xc4a9('0x8'));var attributes=require('./openchannelQueueReport.attributes');module['exports']=function(_0x95d3f6,_0x2f35e4){return _0x95d3f6[_0xc4a9('0x9')](_0xc4a9('0xa'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xc4a9('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9b83=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x117c2a,_0x466675){var _0x25e7ac=function(_0x13795a){while(--_0x13795a){_0x117c2a['push'](_0x117c2a['shift']());}};_0x25e7ac(++_0x466675);}(_0x9b83,0x84));var _0x39b8=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x9b83[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0x39b8('0x0'));var util=require(_0x39b8('0x1'));var logger=require(_0x39b8('0x2'))(_0x39b8('0x3'));var moment=require(_0x39b8('0x4'));var BPromise=require(_0x39b8('0x5'));var rp=require(_0x39b8('0x6'));var fs=require('fs');var path=require(_0x39b8('0x7'));var rimraf=require(_0x39b8('0x8'));var config=require(_0x39b8('0x9'));var attributes=require('./openchannelQueueReport.attributes');module[_0x39b8('0xa')]=function(_0x4a8ff8,_0x563fe1){return _0x4a8ff8[_0x39b8('0xb')](_0x39b8('0xc'),attributes,{'tableName':_0x39b8('0xd'),'paranoid':![],'indexes':[{'name':_0x39b8('0xe'),'fields':[_0x39b8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 8e95ce7..ea641b5 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 _0xb42e=['message','info','result','catch','create','body','options','CreateOpenchannelQueueReport','update','raw','where','attributes','limit','UpdateOpenchannelQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','then','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s'];(function(_0x181a00,_0x15bbfc){var _0x2886cc=function(_0x576549){while(--_0x576549){_0x181a00['push'](_0x181a00['shift']());}};_0x2886cc(++_0x15bbfc);}(_0xb42e,0x14e));var _0xeb42=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0xb42e[_0x277107];return _0x1da046;};'use strict';var _=require(_0xeb42('0x0'));var util=require(_0xeb42('0x1'));var moment=require(_0xeb42('0x2'));var BPromise=require('bluebird');var rs=require(_0xeb42('0x3'));var fs=require('fs');var Redis=require(_0xeb42('0x4'));var db=require(_0xeb42('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb42('0x6'))('rpc');var config=require(_0xeb42('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xeb42('0x8')][_0xeb42('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6216fa,_0x2cfc12,_0x11a828){return new BPromise(function(_0x104c6e,_0x56e03d){return client['request'](_0x6216fa,_0x11a828)[_0xeb42('0xa')](function(_0x174e18){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x2cfc12,_0xeb42('0xb'));logger[_0xeb42('0xc')](_0xeb42('0xd'),_0x2cfc12,_0xeb42('0xb'),JSON[_0xeb42('0xe')](_0x174e18));if(_0x174e18[_0xeb42('0xf')]){if(_0x174e18['error'][_0xeb42('0x10')]===0x1f4){logger[_0xeb42('0xf')](_0xeb42('0x11'),_0x2cfc12,_0x174e18[_0xeb42('0xf')][_0xeb42('0x12')]);return _0x56e03d(_0x174e18['error'][_0xeb42('0x12')]);}logger[_0xeb42('0xf')](_0xeb42('0x11'),_0x2cfc12,_0x174e18[_0xeb42('0xf')]['message']);return _0x104c6e(_0x174e18[_0xeb42('0xf')][_0xeb42('0x12')]);}else{logger[_0xeb42('0x13')](_0xeb42('0x11'),_0x2cfc12,_0xeb42('0xb'));_0x104c6e(_0x174e18[_0xeb42('0x14')][_0xeb42('0x12')]);}})[_0xeb42('0x15')](function(_0x1aa234){logger['error'](_0xeb42('0x11'),_0x2cfc12,_0x1aa234);_0x56e03d(_0x1aa234);});});}exports['CreateOpenchannelQueueReport']=function(_0x20fbe0){var _0x5cc87f=this;return new Promise(function(_0x537592,_0xcc504a){return db['OpenchannelQueueReport'][_0xeb42('0x16')](_0x20fbe0[_0xeb42('0x17')],{'raw':_0x20fbe0[_0xeb42('0x18')]?_0x20fbe0[_0xeb42('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xeb42('0xa')](function(_0x1c1de6){logger[_0xeb42('0x13')](_0xeb42('0x19'),_0x20fbe0);logger['debug']('CreateOpenchannelQueueReport',_0x20fbe0,JSON[_0xeb42('0xe')](_0x1c1de6));_0x537592(_0x1c1de6);})[_0xeb42('0x15')](function(_0xecfc1c){logger['error'](_0xeb42('0x19'),_0xecfc1c['message'],_0x20fbe0);_0xcc504a(_0x5cc87f[_0xeb42('0xf')](0x1f4,_0xecfc1c['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x421d16){var _0x5ba7cb=this;return new Promise(function(_0x2b62a3,_0x1ebd4a){return db['OpenchannelQueueReport'][_0xeb42('0x1a')](_0x421d16[_0xeb42('0x17')],{'raw':_0x421d16[_0xeb42('0x18')]?_0x421d16['options'][_0xeb42('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x421d16['options']?_0x421d16[_0xeb42('0x18')][_0xeb42('0x1c')]||null:null,'attributes':_0x421d16['options']?_0x421d16[_0xeb42('0x18')][_0xeb42('0x1d')]||null:null,'limit':_0x421d16[_0xeb42('0x18')]?_0x421d16[_0xeb42('0x18')][_0xeb42('0x1e')]||null:null})['then'](function(_0x4e6e9f){logger['info']('UpdateOpenchannelQueueReport',_0x421d16);logger[_0xeb42('0xc')](_0xeb42('0x1f'),_0x421d16,JSON[_0xeb42('0xe')](_0x4e6e9f));_0x2b62a3(_0x4e6e9f);})[_0xeb42('0x15')](function(_0x46fa9a){logger[_0xeb42('0xf')](_0xeb42('0x1f'),_0x46fa9a[_0xeb42('0x12')],_0x421d16);_0x1ebd4a(_0x5ba7cb['error'](0x1f4,_0x46fa9a[_0xeb42('0x12')]));});});}; \ No newline at end of file +var _0xe827=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','create','options','raw','then','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','body','where','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x45683e,_0x42eff4){var _0x5dbcfe=function(_0x189088){while(--_0x189088){_0x45683e['push'](_0x45683e['shift']());}};_0x5dbcfe(++_0x42eff4);}(_0xe827,0x13a));var _0x7e82=function(_0x32bba4,_0x2cd8cf){_0x32bba4=_0x32bba4-0x0;var _0x492240=_0xe827[_0x32bba4];return _0x492240;};'use strict';var _=require('lodash');var util=require(_0x7e82('0x0'));var moment=require(_0x7e82('0x1'));var BPromise=require(_0x7e82('0x2'));var rs=require(_0x7e82('0x3'));var fs=require('fs');var Redis=require(_0x7e82('0x4'));var db=require(_0x7e82('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7e82('0x6'))(_0x7e82('0x7'));var config=require(_0x7e82('0x8'));var jayson=require(_0x7e82('0x9'));var client=jayson[_0x7e82('0xa')][_0x7e82('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c295e,_0x533ec9,_0x1f191e){return new BPromise(function(_0x1be276,_0x110fa8){return client[_0x7e82('0xc')](_0x3c295e,_0x1f191e)['then'](function(_0x3ea2e0){logger[_0x7e82('0xd')](_0x7e82('0xe'),_0x533ec9,'request\x20sent');logger[_0x7e82('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x533ec9,'request\x20sent',JSON[_0x7e82('0x10')](_0x3ea2e0));if(_0x3ea2e0['error']){if(_0x3ea2e0[_0x7e82('0x11')][_0x7e82('0x12')]===0x1f4){logger[_0x7e82('0x11')](_0x7e82('0xe'),_0x533ec9,_0x3ea2e0[_0x7e82('0x11')][_0x7e82('0x13')]);return _0x110fa8(_0x3ea2e0[_0x7e82('0x11')][_0x7e82('0x13')]);}logger['error'](_0x7e82('0xe'),_0x533ec9,_0x3ea2e0[_0x7e82('0x11')][_0x7e82('0x13')]);return _0x1be276(_0x3ea2e0[_0x7e82('0x11')][_0x7e82('0x13')]);}else{logger[_0x7e82('0xd')](_0x7e82('0xe'),_0x533ec9,_0x7e82('0x14'));_0x1be276(_0x3ea2e0['result']['message']);}})[_0x7e82('0x15')](function(_0x283848){logger[_0x7e82('0x11')](_0x7e82('0xe'),_0x533ec9,_0x283848);_0x110fa8(_0x283848);});});}exports['CreateOpenchannelQueueReport']=function(_0x56379a){var _0x16abe3=this;return new Promise(function(_0x403cd1,_0x5964b2){return db['OpenchannelQueueReport'][_0x7e82('0x16')](_0x56379a['body'],{'raw':_0x56379a[_0x7e82('0x17')]?_0x56379a[_0x7e82('0x17')][_0x7e82('0x18')]===undefined?!![]:![]:!![]})[_0x7e82('0x19')](function(_0x4c23db){logger[_0x7e82('0xd')](_0x7e82('0x1a'),_0x56379a);logger['debug'](_0x7e82('0x1a'),_0x56379a,JSON[_0x7e82('0x10')](_0x4c23db));_0x403cd1(_0x4c23db);})['catch'](function(_0x4ce24d){logger['error'](_0x7e82('0x1a'),_0x4ce24d[_0x7e82('0x13')],_0x56379a);_0x5964b2(_0x16abe3['error'](0x1f4,_0x4ce24d[_0x7e82('0x13')]));});});};exports[_0x7e82('0x1b')]=function(_0x29964c){var _0x54c119=this;return new Promise(function(_0x356dc1,_0x4f36b1){return db[_0x7e82('0x1c')]['update'](_0x29964c[_0x7e82('0x1d')],{'raw':_0x29964c['options']?_0x29964c[_0x7e82('0x17')][_0x7e82('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29964c[_0x7e82('0x17')]?_0x29964c[_0x7e82('0x17')][_0x7e82('0x1e')]||null:null,'attributes':_0x29964c[_0x7e82('0x17')]?_0x29964c['options'][_0x7e82('0x1f')]||null:null,'limit':_0x29964c['options']?_0x29964c[_0x7e82('0x17')]['limit']||null:null})[_0x7e82('0x19')](function(_0x2ce995){logger[_0x7e82('0xd')](_0x7e82('0x1b'),_0x29964c);logger[_0x7e82('0xf')](_0x7e82('0x1b'),_0x29964c,JSON[_0x7e82('0x10')](_0x2ce995));_0x356dc1(_0x2ce995);})['catch'](function(_0x28a5ee){logger['error'](_0x7e82('0x1b'),_0x28a5ee[_0x7e82('0x13')],_0x29964c);_0x4f36b1(_0x54c119[_0x7e82('0x11')](0x1f4,_0x28a5ee['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 781b4e9..fae6398 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 _0x1715=['destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','create','/:id','update','delete'];(function(_0x73c7f6,_0x4d5a84){var _0x1f1c4e=function(_0x47f515){while(--_0x47f515){_0x73c7f6['push'](_0x73c7f6['shift']());}};_0x1f1c4e(++_0x4d5a84);}(_0x1715,0xde));var _0x5171=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1715[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x5171('0x0'));var util=require(_0x5171('0x1'));var path=require(_0x5171('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5171('0x3')]();var fs_extra=require(_0x5171('0x4'));var auth=require(_0x5171('0x5'));var interaction=require(_0x5171('0x6'));var config=require(_0x5171('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0x5171('0x8')]('/',auth[_0x5171('0x9')](),controller[_0x5171('0xa')]);router['get'](_0x5171('0xb'),auth[_0x5171('0x9')](),controller[_0x5171('0xc')]);router[_0x5171('0x8')]('/:id',auth[_0x5171('0x9')](),controller[_0x5171('0xd')]);router['post']('/',auth[_0x5171('0x9')](),controller[_0x5171('0xe')]);router['put'](_0x5171('0xf'),auth[_0x5171('0x9')](),controller[_0x5171('0x10')]);router[_0x5171('0x11')](_0x5171('0xf'),auth['isAuthenticated'](),controller[_0x5171('0x12')]);module[_0x5171('0x13')]=router; \ No newline at end of file +var _0x7f23=['get','isAuthenticated','/describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller'];(function(_0x2b562e,_0x4cf5d8){var _0x573a08=function(_0x47c3e9){while(--_0x47c3e9){_0x2b562e['push'](_0x2b562e['shift']());}};_0x573a08(++_0x4cf5d8);}(_0x7f23,0x83));var _0x37f2=function(_0x5eb406,_0x1b66c9){_0x5eb406=_0x5eb406-0x0;var _0x592b5d=_0x7f23[_0x5eb406];return _0x592b5d;};'use strict';var multer=require(_0x37f2('0x0'));var util=require(_0x37f2('0x1'));var path=require(_0x37f2('0x2'));var timeout=require(_0x37f2('0x3'));var express=require('express');var router=express[_0x37f2('0x4')]();var fs_extra=require(_0x37f2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x37f2('0x6'));var config=require(_0x37f2('0x7'));var controller=require(_0x37f2('0x8'));router[_0x37f2('0x9')]('/',auth[_0x37f2('0xa')](),controller['index']);router[_0x37f2('0x9')](_0x37f2('0xb'),auth[_0x37f2('0xa')](),controller['describe']);router[_0x37f2('0x9')](_0x37f2('0xc'),auth['isAuthenticated'](),controller[_0x37f2('0xd')]);router[_0x37f2('0xe')]('/',auth[_0x37f2('0xa')](),controller[_0x37f2('0xf')]);router[_0x37f2('0x10')](_0x37f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x37f2('0x11')](_0x37f2('0xc'),auth['isAuthenticated'](),controller[_0x37f2('0x12')]);module[_0x37f2('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 01838e1..6dc92d8 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 _0x696c=['NOW','moment','sequelize','STRING','agent','queue'];(function(_0x34e098,_0xd59d3e){var _0x5703a5=function(_0x10bbba){while(--_0x10bbba){_0x34e098['push'](_0x34e098['shift']());}};_0x5703a5(++_0xd59d3e);}(_0x696c,0x133));var _0xc696=function(_0x1d2ca4,_0x469af6){_0x1d2ca4=_0x1d2ca4-0x0;var _0x35398a=_0x696c[_0x1d2ca4];return _0x35398a;};'use strict';var moment=require(_0xc696('0x0'));var Sequelize=require(_0xc696('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xc696('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0xc696('0x3'),_0xc696('0x4')),'allowNull':![],'defaultValue':_0xc696('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xc696('0x5')]}}; \ No newline at end of file +var _0xc671=['account','agent','DATE','NOW','sequelize','exports','STRING','ENUM'];(function(_0x17ddb2,_0x385680){var _0x24f379=function(_0x2285c0){while(--_0x2285c0){_0x17ddb2['push'](_0x17ddb2['shift']());}};_0x24f379(++_0x385680);}(_0xc671,0x1b4));var _0x1c67=function(_0x46edee,_0x575adf){_0x46edee=_0x46edee-0x0;var _0x53954d=_0xc671[_0x46edee];return _0x53954d;};'use strict';var moment=require('moment');var Sequelize=require(_0x1c67('0x0'));module[_0x1c67('0x1')]={'uniqueid':{'type':Sequelize[_0x1c67('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1c67('0x3')](_0x1c67('0x4'),_0x1c67('0x5'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x1c67('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x1c67('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 9640f8e..2dd69b3 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 _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':!![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':!![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index da44c57..6e96178 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 _0xc938=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define'];(function(_0x5a9a68,_0x593abf){var _0xef63e3=function(_0x291790){while(--_0x291790){_0x5a9a68['push'](_0x5a9a68['shift']());}};_0xef63e3(++_0x593abf);}(_0xc938,0x121));var _0x8c93=function(_0x4f533a,_0x54155a){_0x4f533a=_0x4f533a-0x0;var _0x4b8f7b=_0xc938[_0x4f533a];return _0x4b8f7b;};'use strict';var _=require(_0x8c93('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8c93('0x1'));var moment=require('moment');var BPromise=require(_0x8c93('0x2'));var rp=require(_0x8c93('0x3'));var fs=require('fs');var path=require(_0x8c93('0x4'));var rimraf=require(_0x8c93('0x5'));var config=require(_0x8c93('0x6'));var attributes=require(_0x8c93('0x7'));module[_0x8c93('0x8')]=function(_0x4ef5be,_0x88c4c6){return _0x4ef5be[_0x8c93('0x9')](_0x8c93('0xa'),attributes,{'tableName':_0x8c93('0xb'),'paranoid':![],'indexes':[{'name':_0x8c93('0xc'),'fields':[_0x8c93('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1dc3=['define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports'];(function(_0x38c5bb,_0x153bdb){var _0x5cbd09=function(_0xe17565){while(--_0xe17565){_0x38c5bb['push'](_0x38c5bb['shift']());}};_0x5cbd09(++_0x153bdb);}(_0x1dc3,0x8b));var _0x31dc=function(_0x34e51c,_0x1f46b0){_0x34e51c=_0x34e51c-0x0;var _0x31643c=_0x1dc3[_0x34e51c];return _0x31643c;};'use strict';var _=require(_0x31dc('0x0'));var util=require(_0x31dc('0x1'));var logger=require(_0x31dc('0x2'))(_0x31dc('0x3'));var moment=require(_0x31dc('0x4'));var BPromise=require(_0x31dc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31dc('0x6'));var rimraf=require(_0x31dc('0x7'));var config=require(_0x31dc('0x8'));var attributes=require(_0x31dc('0x9'));module[_0x31dc('0xa')]=function(_0x11a128,_0x4231f4){return _0x11a128[_0x31dc('0xb')](_0x31dc('0xc'),attributes,{'tableName':_0x31dc('0xd'),'paranoid':![],'indexes':[{'name':_0x31dc('0xe'),'fields':[_0x31dc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 4a4b6bd..eb1024b 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 _0xa84f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x4d5e7e,_0x4353d1){var _0x57a3c3=function(_0xb2cd40){while(--_0xb2cd40){_0x4d5e7e['push'](_0x4d5e7e['shift']());}};_0x57a3c3(++_0x4353d1);}(_0xa84f,0x1dd));var _0xfa84=function(_0x16acb7,_0x23f034){_0x16acb7=_0x16acb7-0x0;var _0x39bf39=_0xa84f[_0x16acb7];return _0x39bf39;};'use strict';var _=require(_0xfa84('0x0'));var util=require(_0xfa84('0x1'));var moment=require(_0xfa84('0x2'));var BPromise=require(_0xfa84('0x3'));var rs=require(_0xfa84('0x4'));var fs=require('fs');var Redis=require(_0xfa84('0x5'));var db=require(_0xfa84('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfa84('0x7'))(_0xfa84('0x8'));var config=require(_0xfa84('0x9'));var jayson=require(_0xfa84('0xa'));var client=jayson[_0xfa84('0xb')][_0xfa84('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1efe6d,_0x1f99fd,_0x35577f){return new BPromise(function(_0x3c2e94,_0x822a41){return client[_0xfa84('0xd')](_0x1efe6d,_0x35577f)['then'](function(_0x2b732){logger[_0xfa84('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1f99fd,_0xfa84('0xf'));logger[_0xfa84('0x10')](_0xfa84('0x11'),_0x1f99fd,'request\x20sent',JSON['stringify'](_0x2b732));if(_0x2b732[_0xfa84('0x12')]){if(_0x2b732[_0xfa84('0x12')][_0xfa84('0x13')]===0x1f4){logger[_0xfa84('0x12')](_0xfa84('0x14'),_0x1f99fd,_0x2b732[_0xfa84('0x12')][_0xfa84('0x15')]);return _0x822a41(_0x2b732[_0xfa84('0x12')][_0xfa84('0x15')]);}logger[_0xfa84('0x12')](_0xfa84('0x14'),_0x1f99fd,_0x2b732[_0xfa84('0x12')][_0xfa84('0x15')]);return _0x3c2e94(_0x2b732[_0xfa84('0x12')][_0xfa84('0x15')]);}else{logger['info'](_0xfa84('0x14'),_0x1f99fd,'request\x20sent');_0x3c2e94(_0x2b732[_0xfa84('0x16')][_0xfa84('0x15')]);}})[_0xfa84('0x17')](function(_0x1d36b9){logger[_0xfa84('0x12')](_0xfa84('0x14'),_0x1f99fd,_0x1d36b9);_0x822a41(_0x1d36b9);});});} \ No newline at end of file +var _0x3435=['request','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x4ae66,_0x29dd16){var _0xe5156a=function(_0x1858ff){while(--_0x1858ff){_0x4ae66['push'](_0x4ae66['shift']());}};_0xe5156a(++_0x29dd16);}(_0x3435,0xfa));var _0x5343=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x3435[_0x5627e1];return _0x2f013f;};'use strict';var _=require(_0x5343('0x0'));var util=require(_0x5343('0x1'));var moment=require(_0x5343('0x2'));var BPromise=require(_0x5343('0x3'));var rs=require(_0x5343('0x4'));var fs=require('fs');var Redis=require(_0x5343('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5343('0x6'));var logger=require(_0x5343('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5343('0x8'));var client=jayson[_0x5343('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x544b29,_0x13641f,_0x1e1911){return new BPromise(function(_0x9ea9b6,_0x245034){return client[_0x5343('0xa')](_0x544b29,_0x1e1911)['then'](function(_0x44421c){logger['info'](_0x5343('0xb'),_0x13641f,_0x5343('0xc'));logger[_0x5343('0xd')](_0x5343('0xe'),_0x13641f,_0x5343('0xc'),JSON['stringify'](_0x44421c));if(_0x44421c[_0x5343('0xf')]){if(_0x44421c[_0x5343('0xf')][_0x5343('0x10')]===0x1f4){logger['error'](_0x5343('0xb'),_0x13641f,_0x44421c['error'][_0x5343('0x11')]);return _0x245034(_0x44421c[_0x5343('0xf')]['message']);}logger[_0x5343('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x13641f,_0x44421c[_0x5343('0xf')][_0x5343('0x11')]);return _0x9ea9b6(_0x44421c[_0x5343('0xf')][_0x5343('0x11')]);}else{logger['info'](_0x5343('0xb'),_0x13641f,_0x5343('0xc'));_0x9ea9b6(_0x44421c[_0x5343('0x12')][_0x5343('0x11')]);}})[_0x5343('0x13')](function(_0x2913e8){logger[_0x5343('0xf')](_0x5343('0xb'),_0x13641f,_0x2913e8);_0x245034(_0x2913e8);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index b41c209..4e44548 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 _0x4ce4=['../../config/environment','./pause.controller','get','index','/:id','isAuthenticated','show','post','create','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x3fa2b0,_0x45f8fb){var _0x11b3ab=function(_0x2a55ee){while(--_0x2a55ee){_0x3fa2b0['push'](_0x3fa2b0['shift']());}};_0x11b3ab(++_0x45f8fb);}(_0x4ce4,0xe4));var _0x44ce=function(_0x193d09,_0x2d5922){_0x193d09=_0x193d09-0x0;var _0x1ec751=_0x4ce4[_0x193d09];return _0x1ec751;};'use strict';var multer=require(_0x44ce('0x0'));var util=require(_0x44ce('0x1'));var path=require('path');var timeout=require(_0x44ce('0x2'));var express=require(_0x44ce('0x3'));var router=express[_0x44ce('0x4')]();var fs_extra=require(_0x44ce('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x44ce('0x6'));var controller=require(_0x44ce('0x7'));router[_0x44ce('0x8')]('/',auth['isAuthenticated'](),controller[_0x44ce('0x9')]);router['get'](_0x44ce('0xa'),auth[_0x44ce('0xb')](),controller[_0x44ce('0xc')]);router[_0x44ce('0xd')]('/',auth['isAuthenticated'](),controller[_0x44ce('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x44ce('0xf')]);router['delete'](_0x44ce('0xa'),auth[_0x44ce('0xb')](),controller[_0x44ce('0x10')]);module[_0x44ce('0x11')]=router; \ No newline at end of file +var _0xeea3=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy'];(function(_0x46b6f0,_0x5cb476){var _0x36a1aa=function(_0x4647b2){while(--_0x4647b2){_0x46b6f0['push'](_0x46b6f0['shift']());}};_0x36a1aa(++_0x5cb476);}(_0xeea3,0xc7));var _0x3eea=function(_0x367725,_0x1a55a0){_0x367725=_0x367725-0x0;var _0x3af19e=_0xeea3[_0x367725];return _0x3af19e;};'use strict';var multer=require(_0x3eea('0x0'));var util=require(_0x3eea('0x1'));var path=require(_0x3eea('0x2'));var timeout=require(_0x3eea('0x3'));var express=require(_0x3eea('0x4'));var router=express[_0x3eea('0x5')]();var fs_extra=require(_0x3eea('0x6'));var auth=require(_0x3eea('0x7'));var interaction=require(_0x3eea('0x8'));var config=require(_0x3eea('0x9'));var controller=require(_0x3eea('0xa'));router['get']('/',auth[_0x3eea('0xb')](),controller[_0x3eea('0xc')]);router[_0x3eea('0xd')](_0x3eea('0xe'),auth[_0x3eea('0xb')](),controller[_0x3eea('0xf')]);router[_0x3eea('0x10')]('/',auth['isAuthenticated'](),controller[_0x3eea('0x11')]);router['put']('/:id',auth[_0x3eea('0xb')](),controller[_0x3eea('0x12')]);router[_0x3eea('0x13')](_0x3eea('0xe'),auth[_0x3eea('0xb')](),controller[_0x3eea('0x14')]);module[_0x3eea('0x15')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 1e20633..2b821b7 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 _0xe5dd=['name','STRING'];(function(_0x194fd4,_0x5e7a2b){var _0x527909=function(_0xc83cbf){while(--_0xc83cbf){_0x194fd4['push'](_0x194fd4['shift']());}};_0x527909(++_0x5e7a2b);}(_0xe5dd,0x173));var _0xde5d=function(_0x4a8879,_0x2e4ccc){_0x4a8879=_0x4a8879-0x0;var _0x192baf=_0xe5dd[_0x4a8879];return _0x192baf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xde5d('0x0')],'unique':_0xde5d('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xde5d('0x0')]}}; \ No newline at end of file +var _0x4011=['name','STRING'];(function(_0x3e6a68,_0x577b80){var _0x3981aa=function(_0x5c264f){while(--_0x5c264f){_0x3e6a68['push'](_0x3e6a68['shift']());}};_0x3981aa(++_0x577b80);}(_0x4011,0x1bf));var _0x1401=function(_0x1d44ff,_0x13003f){_0x1d44ff=_0x1d44ff-0x0;var _0x42071b=_0x4011[_0x1d44ff];return _0x42071b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1401('0x0')],'unique':_0x1401('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 27ad0ac..d5e4887 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 _0xd32e=['util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','Pause','includeAll','include','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','fast-json-patch','request-promise','moment','mustache'];(function(_0x15a346,_0x46d825){var _0x275a0f=function(_0x3df115){while(--_0x3df115){_0x15a346['push'](_0x15a346['shift']());}};_0x275a0f(++_0x46d825);}(_0xd32e,0x1e7));var _0xed32=function(_0x333f47,_0x407ea6){_0x333f47=_0x333f47-0x0;var _0x4b444c=_0xd32e[_0x333f47];return _0x4b444c;};'use strict';var emlformat=require(_0xed32('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xed32('0x1'));var rp=require(_0xed32('0x2'));var moment=require(_0xed32('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xed32('0x4'));var util=require(_0xed32('0x5'));var path=require(_0xed32('0x6'));var sox=require('sox');var csv=require(_0xed32('0x7'));var ejs=require(_0xed32('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xed32('0x9'));var crypto=require(_0xed32('0xa'));var jsforce=require(_0xed32('0xb'));var deskjs=require(_0xed32('0xc'));var toCsv=require(_0xed32('0x7'));var querystring=require(_0xed32('0xd'));var Papa=require('papaparse');var Redis=require(_0xed32('0xe'));var authService=require(_0xed32('0xf'));var qs=require(_0xed32('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xed32('0x11'));var logger=require(_0xed32('0x12'))(_0xed32('0x13'));var utils=require(_0xed32('0x14'));var config=require(_0xed32('0x15'));var licenseUtil=require(_0xed32('0x16'));var db=require(_0xed32('0x17'))['db'];function respondWithStatusCode(_0x374618,_0x5a4077){_0x5a4077=_0x5a4077||0xcc;return function(_0x4cc251){if(_0x4cc251){return _0x374618[_0xed32('0x18')](_0x5a4077);}return _0x374618['status'](_0x5a4077)[_0xed32('0x19')]();};}function respondWithResult(_0x24b298,_0x259a16){_0x259a16=_0x259a16||0xc8;return function(_0x2fed88){if(_0x2fed88){return _0x24b298[_0xed32('0x1a')](_0x259a16)[_0xed32('0x1b')](_0x2fed88);}};}function respondWithFilteredResult(_0x12665c,_0x11a28c){return function(_0x22110d){if(_0x22110d){var _0x529553=typeof _0x11a28c[_0xed32('0x1c')]===_0xed32('0x1d')&&typeof _0x11a28c[_0xed32('0x1e')]===_0xed32('0x1d');var _0x35ff7c=_0x22110d[_0xed32('0x1f')];var _0xf4cf5c=_0x529553?0x0:_0x11a28c[_0xed32('0x1c')];var _0x2f4c53=_0x529553?_0x22110d[_0xed32('0x1f')]:_0x11a28c['offset']+_0x11a28c[_0xed32('0x1e')];var _0x2d041f;if(_0x2f4c53>=_0x35ff7c){_0x2f4c53=_0x35ff7c;_0x2d041f=0xc8;}else{_0x2d041f=0xce;}_0x12665c['status'](_0x2d041f);return _0x12665c[_0xed32('0x20')]('Content-Range',_0xf4cf5c+'-'+_0x2f4c53+'/'+_0x35ff7c)[_0xed32('0x1b')](_0x22110d);}return null;};}function patchUpdates(_0x3c5fc5){return function(_0x34fde2){try{jsonpatch['apply'](_0x34fde2,_0x3c5fc5,!![]);}catch(_0x31ec91){return BPromise[_0xed32('0x21')](_0x31ec91);}return _0x34fde2[_0xed32('0x22')]();};}function saveUpdates(_0x2a36f4,_0x4ee758){return function(_0x4761f9){if(_0x4761f9){return _0x4761f9['update'](_0x2a36f4)[_0xed32('0x23')](function(_0x2dafa9){return _0x2dafa9;});}return null;};}function removeEntity(_0x1c3102,_0x3fa716){return function(_0x34ab43){if(_0x34ab43){return _0x34ab43[_0xed32('0x24')]()['then'](function(){var _0x125084=_0x34ab43[_0xed32('0x25')]({'plain':!![]});var _0x387fe5=_0xed32('0x26');return db[_0xed32('0x27')]['destroy']({'where':{'type':_0x387fe5,'resourceId':_0x125084['id']}})['then'](function(){return _0x34ab43;});})[_0xed32('0x23')](function(){_0x1c3102['status'](0xcc)[_0xed32('0x19')]();});}};}function handleEntityNotFound(_0xd1be36,_0x1aafa1){return function(_0x245ea1){if(!_0x245ea1){_0xd1be36[_0xed32('0x18')](0x194);}return _0x245ea1;};}function handleError(_0xa91059,_0x494de4){_0x494de4=_0x494de4||0x1f4;return function(_0x20cf21){logger[_0xed32('0x28')](_0x20cf21[_0xed32('0x29')]);if(_0x20cf21[_0xed32('0x2a')]){delete _0x20cf21[_0xed32('0x2a')];}_0xa91059[_0xed32('0x1a')](_0x494de4)[_0xed32('0x2b')](_0x20cf21);};}exports[_0xed32('0x2c')]=function(_0x1df80f,_0x32933e){var _0x28e6db={},_0x3c3a06={},_0x420bd8={'count':0x0,'rows':[]};var _0x3f9b79=_['map'](db['Pause'][_0xed32('0x2d')],function(_0x7a2750){return{'name':_0x7a2750[_0xed32('0x2e')],'type':_0x7a2750[_0xed32('0x2f')][_0xed32('0x30')]};});_0x3c3a06[_0xed32('0x31')]=_[_0xed32('0x32')](_0x3f9b79,_0xed32('0x2a'));_0x3c3a06[_0xed32('0x33')]=_[_0xed32('0x34')](_0x1df80f[_0xed32('0x33')]);_0x3c3a06[_0xed32('0x35')]=_[_0xed32('0x36')](_0x3c3a06[_0xed32('0x31')],_0x3c3a06[_0xed32('0x33')]);_0x28e6db[_0xed32('0x37')]=_[_0xed32('0x36')](_0x3c3a06[_0xed32('0x31')],qs[_0xed32('0x38')](_0x1df80f[_0xed32('0x33')][_0xed32('0x38')]));_0x28e6db[_0xed32('0x37')]=_0x28e6db[_0xed32('0x37')]['length']?_0x28e6db[_0xed32('0x37')]:_0x3c3a06[_0xed32('0x31')];if(!_0x1df80f[_0xed32('0x33')]['hasOwnProperty'](_0xed32('0x39'))){_0x28e6db[_0xed32('0x1e')]=qs[_0xed32('0x1e')](_0x1df80f['query'][_0xed32('0x1e')]);_0x28e6db[_0xed32('0x1c')]=qs['offset'](_0x1df80f['query'][_0xed32('0x1c')]);}_0x28e6db[_0xed32('0x3a')]=qs[_0xed32('0x3b')](_0x1df80f[_0xed32('0x33')][_0xed32('0x3b')]);_0x28e6db['where']=qs[_0xed32('0x35')](_[_0xed32('0x3c')](_0x1df80f[_0xed32('0x33')],_0x3c3a06[_0xed32('0x35')]),_0x3f9b79);if(_0x1df80f[_0xed32('0x33')][_0xed32('0x3d')]){_0x28e6db[_0xed32('0x3e')]=_[_0xed32('0x3f')](_0x28e6db[_0xed32('0x3e')],{'$or':_[_0xed32('0x32')](_0x3f9b79,function(_0x443518){if(_0x443518[_0xed32('0x2f')]!=='VIRTUAL'){var _0x115d20={};_0x115d20[_0x443518[_0xed32('0x2a')]]={'$like':'%'+_0x1df80f[_0xed32('0x33')][_0xed32('0x3d')]+'%'};return _0x115d20;}})});}_0x28e6db=_[_0xed32('0x3f')]({},_0x28e6db,_0x1df80f[_0xed32('0x40')]);var _0x45cf4e={'where':_0x28e6db[_0xed32('0x3e')]};return db[_0xed32('0x41')][_0xed32('0x1f')](_0x45cf4e)[_0xed32('0x23')](function(_0x4298c8){_0x420bd8['count']=_0x4298c8;if(_0x1df80f[_0xed32('0x33')][_0xed32('0x42')]){_0x28e6db[_0xed32('0x43')]=[{'all':!![]}];}return db[_0xed32('0x41')]['findAll'](_0x28e6db);})[_0xed32('0x23')](function(_0x572b9e){_0x420bd8[_0xed32('0x44')]=_0x572b9e;return _0x420bd8;})[_0xed32('0x23')](respondWithFilteredResult(_0x32933e,_0x28e6db))[_0xed32('0x45')](handleError(_0x32933e,null));};exports[_0xed32('0x46')]=function(_0x59feb6,_0x4ffc1b){var _0x3923dc={'raw':!![],'where':{'id':_0x59feb6[_0xed32('0x47')]['id']}},_0x4df0e8={};_0x4df0e8['model']=_[_0xed32('0x34')](db[_0xed32('0x41')][_0xed32('0x2d')]);_0x4df0e8[_0xed32('0x33')]=_[_0xed32('0x34')](_0x59feb6['query']);_0x4df0e8[_0xed32('0x35')]=_[_0xed32('0x36')](_0x4df0e8[_0xed32('0x31')],_0x4df0e8['query']);_0x3923dc[_0xed32('0x37')]=_[_0xed32('0x36')](_0x4df0e8[_0xed32('0x31')],qs[_0xed32('0x38')](_0x59feb6[_0xed32('0x33')][_0xed32('0x38')]));_0x3923dc[_0xed32('0x37')]=_0x3923dc[_0xed32('0x37')]['length']?_0x3923dc[_0xed32('0x37')]:_0x4df0e8[_0xed32('0x31')];if(_0x59feb6[_0xed32('0x33')]['includeAll']){_0x3923dc[_0xed32('0x43')]=[{'all':!![]}];}_0x3923dc=_[_0xed32('0x3f')]({},_0x3923dc,_0x59feb6[_0xed32('0x40')]);return db[_0xed32('0x41')][_0xed32('0x48')](_0x3923dc)[_0xed32('0x23')](handleEntityNotFound(_0x4ffc1b,null))[_0xed32('0x23')](respondWithResult(_0x4ffc1b,null))[_0xed32('0x45')](handleError(_0x4ffc1b,null));};exports[_0xed32('0x49')]=function(_0x32878d,_0x8a112f){return db['Pause'][_0xed32('0x49')](_0x32878d[_0xed32('0x4a')],{})['then'](function(_0x3ecfbd){var _0x38246e=_0x32878d['user'][_0xed32('0x25')]({'plain':!![]});if(!_0x38246e)throw new Error(_0xed32('0x4b'));if(_0x38246e[_0xed32('0x4c')]===_0xed32('0x4d')){var _0xeeacb0=_0x3ecfbd[_0xed32('0x25')]({'plain':!![]});var _0x32e2b1='Pauses';return db[_0xed32('0x4e')]['find']({'where':{'name':_0x32e2b1,'userProfileId':_0x38246e[_0xed32('0x4f')]},'raw':!![]})[_0xed32('0x23')](function(_0x43f8b1){if(_0x43f8b1&&_0x43f8b1['autoAssociation']===0x0){return db[_0xed32('0x27')][_0xed32('0x49')]({'name':_0xeeacb0[_0xed32('0x2a')],'resourceId':_0xeeacb0['id'],'type':_0x43f8b1[_0xed32('0x2a')],'sectionId':_0x43f8b1['id']},{})['then'](function(){return _0x3ecfbd;});}else{return _0x3ecfbd;}})[_0xed32('0x45')](function(_0x4bf83e){logger['error'](_0xed32('0x50'),_0x4bf83e);throw _0x4bf83e;});}return _0x3ecfbd;})[_0xed32('0x23')](respondWithResult(_0x8a112f,0xc9))[_0xed32('0x45')](handleError(_0x8a112f,null));};exports[_0xed32('0x51')]=function(_0x3768cf,_0x28582d){if(_0x3768cf[_0xed32('0x4a')]['id']){delete _0x3768cf[_0xed32('0x4a')]['id'];}return db['Pause']['find']({'where':{'id':_0x3768cf['params']['id']}})['then'](handleEntityNotFound(_0x28582d,null))[_0xed32('0x23')](saveUpdates(_0x3768cf[_0xed32('0x4a')],null))[_0xed32('0x23')](respondWithResult(_0x28582d,null))[_0xed32('0x45')](handleError(_0x28582d,null));};exports['destroy']=function(_0x432a5e,_0x24bde4){return db[_0xed32('0x41')][_0xed32('0x48')]({'where':{'id':_0x432a5e[_0xed32('0x47')]['id']}})[_0xed32('0x23')](handleEntityNotFound(_0x24bde4,null))['then'](removeEntity(_0x24bde4,null))[_0xed32('0x45')](handleError(_0x24bde4,null));}; \ No newline at end of file +var _0x4247=['Pause','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','rawAttributes','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','find','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map'];(function(_0x3491b5,_0x48c0d6){var _0x39545d=function(_0x557aa9){while(--_0x557aa9){_0x3491b5['push'](_0x3491b5['shift']());}};_0x39545d(++_0x48c0d6);}(_0x4247,0x121));var _0x7424=function(_0x5e95c4,_0x4908dc){_0x5e95c4=_0x5e95c4-0x0;var _0x7a6c4c=_0x4247[_0x5e95c4];return _0x7a6c4c;};'use strict';var emlformat=require(_0x7424('0x0'));var rimraf=require(_0x7424('0x1'));var zipdir=require(_0x7424('0x2'));var jsonpatch=require(_0x7424('0x3'));var rp=require('request-promise');var moment=require(_0x7424('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7424('0x5'));var util=require(_0x7424('0x6'));var path=require(_0x7424('0x7'));var sox=require('sox');var csv=require(_0x7424('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7424('0x9'));var _=require(_0x7424('0xa'));var squel=require(_0x7424('0xb'));var crypto=require(_0x7424('0xc'));var jsforce=require(_0x7424('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7424('0x8'));var querystring=require(_0x7424('0xe'));var Papa=require('papaparse');var Redis=require(_0x7424('0xf'));var authService=require(_0x7424('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7424('0x11'))(_0x7424('0x12'));var utils=require(_0x7424('0x13'));var config=require(_0x7424('0x14'));var licenseUtil=require(_0x7424('0x15'));var db=require(_0x7424('0x16'))['db'];function respondWithStatusCode(_0x5a8637,_0x237dd5){_0x237dd5=_0x237dd5||0xcc;return function(_0xddbb9e){if(_0xddbb9e){return _0x5a8637[_0x7424('0x17')](_0x237dd5);}return _0x5a8637[_0x7424('0x18')](_0x237dd5)['end']();};}function respondWithResult(_0x1598fe,_0x3488af){_0x3488af=_0x3488af||0xc8;return function(_0x3acacc){if(_0x3acacc){return _0x1598fe[_0x7424('0x18')](_0x3488af)[_0x7424('0x19')](_0x3acacc);}};}function respondWithFilteredResult(_0x2ec2ff,_0x411d02){return function(_0x380c9b){if(_0x380c9b){var _0x3c8a0c=typeof _0x411d02['offset']===_0x7424('0x1a')&&typeof _0x411d02['limit']===_0x7424('0x1a');var _0x279ec4=_0x380c9b[_0x7424('0x1b')];var _0x12575b=_0x3c8a0c?0x0:_0x411d02[_0x7424('0x1c')];var _0x477c03=_0x3c8a0c?_0x380c9b[_0x7424('0x1b')]:_0x411d02[_0x7424('0x1c')]+_0x411d02[_0x7424('0x1d')];var _0xe58e63;if(_0x477c03>=_0x279ec4){_0x477c03=_0x279ec4;_0xe58e63=0xc8;}else{_0xe58e63=0xce;}_0x2ec2ff[_0x7424('0x18')](_0xe58e63);return _0x2ec2ff[_0x7424('0x1e')](_0x7424('0x1f'),_0x12575b+'-'+_0x477c03+'/'+_0x279ec4)[_0x7424('0x19')](_0x380c9b);}return null;};}function patchUpdates(_0x4bde53){return function(_0xe57a1d){try{jsonpatch[_0x7424('0x20')](_0xe57a1d,_0x4bde53,!![]);}catch(_0x7bea52){return BPromise[_0x7424('0x21')](_0x7bea52);}return _0xe57a1d[_0x7424('0x22')]();};}function saveUpdates(_0x32750b,_0x27c549){return function(_0x4f3db1){if(_0x4f3db1){return _0x4f3db1[_0x7424('0x23')](_0x32750b)[_0x7424('0x24')](function(_0x1d3632){return _0x1d3632;});}return null;};}function removeEntity(_0x1f79af,_0x556e9b){return function(_0x3bbf1e){if(_0x3bbf1e){return _0x3bbf1e[_0x7424('0x25')]()['then'](function(){var _0x43442a=_0x3bbf1e[_0x7424('0x26')]({'plain':!![]});var _0x1aacc3='Pauses';return db[_0x7424('0x27')][_0x7424('0x25')]({'where':{'type':_0x1aacc3,'resourceId':_0x43442a['id']}})[_0x7424('0x24')](function(){return _0x3bbf1e;});})['then'](function(){_0x1f79af['status'](0xcc)[_0x7424('0x28')]();});}};}function handleEntityNotFound(_0x628d13,_0x523561){return function(_0x5cec6d){if(!_0x5cec6d){_0x628d13['sendStatus'](0x194);}return _0x5cec6d;};}function handleError(_0x119f0d,_0x587e8e){_0x587e8e=_0x587e8e||0x1f4;return function(_0x47c55a){logger[_0x7424('0x29')](_0x47c55a[_0x7424('0x2a')]);if(_0x47c55a[_0x7424('0x2b')]){delete _0x47c55a[_0x7424('0x2b')];}_0x119f0d[_0x7424('0x18')](_0x587e8e)[_0x7424('0x2c')](_0x47c55a);};}exports[_0x7424('0x2d')]=function(_0xc3ffe5,_0x45b08b){var _0x24a43={},_0x1dd99f={},_0x3eb566={'count':0x0,'rows':[]};var _0xe47b2b=_[_0x7424('0x2e')](db[_0x7424('0x2f')]['rawAttributes'],function(_0x336ce0){return{'name':_0x336ce0[_0x7424('0x30')],'type':_0x336ce0[_0x7424('0x31')][_0x7424('0x32')]};});_0x1dd99f['model']=_[_0x7424('0x2e')](_0xe47b2b,'name');_0x1dd99f['query']=_[_0x7424('0x33')](_0xc3ffe5[_0x7424('0x34')]);_0x1dd99f[_0x7424('0x35')]=_[_0x7424('0x36')](_0x1dd99f[_0x7424('0x37')],_0x1dd99f['query']);_0x24a43[_0x7424('0x38')]=_[_0x7424('0x36')](_0x1dd99f[_0x7424('0x37')],qs[_0x7424('0x39')](_0xc3ffe5[_0x7424('0x34')][_0x7424('0x39')]));_0x24a43[_0x7424('0x38')]=_0x24a43[_0x7424('0x38')]['length']?_0x24a43[_0x7424('0x38')]:_0x1dd99f['model'];if(!_0xc3ffe5[_0x7424('0x34')]['hasOwnProperty'](_0x7424('0x3a'))){_0x24a43[_0x7424('0x1d')]=qs[_0x7424('0x1d')](_0xc3ffe5[_0x7424('0x34')][_0x7424('0x1d')]);_0x24a43['offset']=qs[_0x7424('0x1c')](_0xc3ffe5[_0x7424('0x34')]['offset']);}_0x24a43[_0x7424('0x3b')]=qs[_0x7424('0x3c')](_0xc3ffe5['query'][_0x7424('0x3c')]);_0x24a43['where']=qs[_0x7424('0x35')](_[_0x7424('0x3d')](_0xc3ffe5['query'],_0x1dd99f[_0x7424('0x35')]),_0xe47b2b);if(_0xc3ffe5[_0x7424('0x34')][_0x7424('0x3e')]){_0x24a43[_0x7424('0x3f')]=_[_0x7424('0x40')](_0x24a43[_0x7424('0x3f')],{'$or':_[_0x7424('0x2e')](_0xe47b2b,function(_0x43e24f){if(_0x43e24f['type']!==_0x7424('0x41')){var _0x52cfd3={};_0x52cfd3[_0x43e24f['name']]={'$like':'%'+_0xc3ffe5[_0x7424('0x34')]['filter']+'%'};return _0x52cfd3;}})});}_0x24a43=_[_0x7424('0x40')]({},_0x24a43,_0xc3ffe5['options']);var _0x788614={'where':_0x24a43[_0x7424('0x3f')]};return db[_0x7424('0x2f')][_0x7424('0x1b')](_0x788614)[_0x7424('0x24')](function(_0x1b5627){_0x3eb566['count']=_0x1b5627;if(_0xc3ffe5[_0x7424('0x34')][_0x7424('0x42')]){_0x24a43[_0x7424('0x43')]=[{'all':!![]}];}return db[_0x7424('0x2f')][_0x7424('0x44')](_0x24a43);})[_0x7424('0x24')](function(_0x49d6c1){_0x3eb566[_0x7424('0x45')]=_0x49d6c1;return _0x3eb566;})[_0x7424('0x24')](respondWithFilteredResult(_0x45b08b,_0x24a43))[_0x7424('0x46')](handleError(_0x45b08b,null));};exports['show']=function(_0x2ccf37,_0x3eeb86){var _0x526aeb={'raw':!![],'where':{'id':_0x2ccf37['params']['id']}},_0x2e9d2a={};_0x2e9d2a[_0x7424('0x37')]=_['keys'](db['Pause'][_0x7424('0x47')]);_0x2e9d2a['query']=_[_0x7424('0x33')](_0x2ccf37[_0x7424('0x34')]);_0x2e9d2a['filters']=_[_0x7424('0x36')](_0x2e9d2a[_0x7424('0x37')],_0x2e9d2a[_0x7424('0x34')]);_0x526aeb[_0x7424('0x38')]=_['intersection'](_0x2e9d2a[_0x7424('0x37')],qs[_0x7424('0x39')](_0x2ccf37[_0x7424('0x34')]['fields']));_0x526aeb[_0x7424('0x38')]=_0x526aeb['attributes'][_0x7424('0x48')]?_0x526aeb[_0x7424('0x38')]:_0x2e9d2a[_0x7424('0x37')];if(_0x2ccf37[_0x7424('0x34')]['includeAll']){_0x526aeb[_0x7424('0x43')]=[{'all':!![]}];}_0x526aeb=_[_0x7424('0x40')]({},_0x526aeb,_0x2ccf37['options']);return db[_0x7424('0x2f')]['find'](_0x526aeb)[_0x7424('0x24')](handleEntityNotFound(_0x3eeb86,null))[_0x7424('0x24')](respondWithResult(_0x3eeb86,null))[_0x7424('0x46')](handleError(_0x3eeb86,null));};exports['create']=function(_0x2e70ca,_0x210b3e){return db[_0x7424('0x2f')][_0x7424('0x49')](_0x2e70ca[_0x7424('0x4a')],{})[_0x7424('0x24')](function(_0x1249a5){var _0x39b3a0=_0x2e70ca[_0x7424('0x4b')][_0x7424('0x26')]({'plain':!![]});if(!_0x39b3a0)throw new Error(_0x7424('0x4c'));if(_0x39b3a0[_0x7424('0x4d')]===_0x7424('0x4b')){var _0x5ad8b4=_0x1249a5[_0x7424('0x26')]({'plain':!![]});var _0xfad334=_0x7424('0x4e');return db[_0x7424('0x4f')][_0x7424('0x50')]({'where':{'name':_0xfad334,'userProfileId':_0x39b3a0[_0x7424('0x51')]},'raw':!![]})['then'](function(_0x5d6ea8){if(_0x5d6ea8&&_0x5d6ea8[_0x7424('0x52')]===0x0){return db[_0x7424('0x27')][_0x7424('0x49')]({'name':_0x5ad8b4[_0x7424('0x2b')],'resourceId':_0x5ad8b4['id'],'type':_0x5d6ea8[_0x7424('0x2b')],'sectionId':_0x5d6ea8['id']},{})[_0x7424('0x24')](function(){return _0x1249a5;});}else{return _0x1249a5;}})[_0x7424('0x46')](function(_0x24b3bd){logger[_0x7424('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24b3bd);throw _0x24b3bd;});}return _0x1249a5;})[_0x7424('0x24')](respondWithResult(_0x210b3e,0xc9))[_0x7424('0x46')](handleError(_0x210b3e,null));};exports[_0x7424('0x23')]=function(_0x18fe68,_0x582493){if(_0x18fe68[_0x7424('0x4a')]['id']){delete _0x18fe68[_0x7424('0x4a')]['id'];}return db[_0x7424('0x2f')][_0x7424('0x50')]({'where':{'id':_0x18fe68[_0x7424('0x53')]['id']}})[_0x7424('0x24')](handleEntityNotFound(_0x582493,null))[_0x7424('0x24')](saveUpdates(_0x18fe68[_0x7424('0x4a')],null))[_0x7424('0x24')](respondWithResult(_0x582493,null))[_0x7424('0x46')](handleError(_0x582493,null));};exports['destroy']=function(_0x55931b,_0x7c7cde){return db[_0x7424('0x2f')][_0x7424('0x50')]({'where':{'id':_0x55931b[_0x7424('0x53')]['id']}})['then'](handleEntityNotFound(_0x7c7cde,null))[_0x7424('0x24')](removeEntity(_0x7c7cde,null))[_0x7424('0x46')](handleError(_0x7c7cde,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index deddde3..207762a 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 _0xcb9c=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','Pause','lodash'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xcb9c,0x110));var _0xccb9=function(_0x1dea16,_0x4c71a1){_0x1dea16=_0x1dea16-0x0;var _0x379c83=_0xcb9c[_0x1dea16];return _0x379c83;};'use strict';var _=require(_0xccb9('0x0'));var util=require(_0xccb9('0x1'));var logger=require(_0xccb9('0x2'))(_0xccb9('0x3'));var moment=require(_0xccb9('0x4'));var BPromise=require(_0xccb9('0x5'));var rp=require(_0xccb9('0x6'));var fs=require('fs');var path=require(_0xccb9('0x7'));var rimraf=require('rimraf');var config=require(_0xccb9('0x8'));var attributes=require(_0xccb9('0x9'));module[_0xccb9('0xa')]=function(_0x5bb0e5,_0x34a3da){return _0x5bb0e5[_0xccb9('0xb')](_0xccb9('0xc'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3e8=['request-promise','path','rimraf','define','tools_pauses','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4985fb,_0x93b134){var _0x410e68=function(_0x222f8a){while(--_0x222f8a){_0x4985fb['push'](_0x4985fb['shift']());}};_0x410e68(++_0x93b134);}(_0xa3e8,0x127));var _0x8a3e=function(_0x87db26,_0x5dbffb){_0x87db26=_0x87db26-0x0;var _0x20454f=_0xa3e8[_0x87db26];return _0x20454f;};'use strict';var _=require(_0x8a3e('0x0'));var util=require(_0x8a3e('0x1'));var logger=require(_0x8a3e('0x2'))('api');var moment=require(_0x8a3e('0x3'));var BPromise=require(_0x8a3e('0x4'));var rp=require(_0x8a3e('0x5'));var fs=require('fs');var path=require(_0x8a3e('0x6'));var rimraf=require(_0x8a3e('0x7'));var config=require('../../config/environment');var attributes=require('./pause.attributes');module['exports']=function(_0x920901,_0xe682f5){return _0x920901[_0x8a3e('0x8')]('Pause',attributes,{'tableName':_0x8a3e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 1ec0263..a18fa1e 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 _0xc52f=['map','model','stringify','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowPause','Pause','find','options','raw','where','attributes','include'];(function(_0x558aa1,_0x19a1c1){var _0x4ca4e0=function(_0x4cfe09){while(--_0x4cfe09){_0x558aa1['push'](_0x558aa1['shift']());}};_0x4ca4e0(++_0x19a1c1);}(_0xc52f,0x1e3));var _0xfc52=function(_0x146793,_0x47f86e){_0x146793=_0x146793-0x0;var _0x680e8b=_0xc52f[_0x146793];return _0x680e8b;};'use strict';var _=require(_0xfc52('0x0'));var util=require(_0xfc52('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc52('0x2'));var db=require(_0xfc52('0x3'))['db'];var utils=require(_0xfc52('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xfc52('0x5'));var jayson=require(_0xfc52('0x6'));var client=jayson[_0xfc52('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2854c4,_0xb7898,_0x896e9f){return new BPromise(function(_0x275905,_0x25f610){return client[_0xfc52('0x8')](_0x2854c4,_0x896e9f)[_0xfc52('0x9')](function(_0x286ca3){logger[_0xfc52('0xa')](_0xfc52('0xb'),_0xb7898,_0xfc52('0xc'));logger[_0xfc52('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0xb7898,_0xfc52('0xc'),JSON['stringify'](_0x286ca3));if(_0x286ca3[_0xfc52('0xe')]){if(_0x286ca3[_0xfc52('0xe')][_0xfc52('0xf')]===0x1f4){logger[_0xfc52('0xe')](_0xfc52('0xb'),_0xb7898,_0x286ca3[_0xfc52('0xe')]['message']);return _0x25f610(_0x286ca3[_0xfc52('0xe')][_0xfc52('0x10')]);}logger[_0xfc52('0xe')](_0xfc52('0xb'),_0xb7898,_0x286ca3['error'][_0xfc52('0x10')]);return _0x275905(_0x286ca3[_0xfc52('0xe')][_0xfc52('0x10')]);}else{logger[_0xfc52('0xa')](_0xfc52('0xb'),_0xb7898,_0xfc52('0xc'));_0x275905(_0x286ca3[_0xfc52('0x11')][_0xfc52('0x10')]);}})[_0xfc52('0x12')](function(_0x20cff5){logger[_0xfc52('0xe')](_0xfc52('0xb'),_0xb7898,_0x20cff5);_0x25f610(_0x20cff5);});});}exports[_0xfc52('0x13')]=function(_0x26f2cf){var _0x4d379d=this;return new Promise(function(_0x563966,_0x306fdf){return db[_0xfc52('0x14')][_0xfc52('0x15')]({'raw':_0x26f2cf[_0xfc52('0x16')]?_0x26f2cf[_0xfc52('0x16')][_0xfc52('0x17')]===undefined?!![]:![]:!![],'where':_0x26f2cf[_0xfc52('0x16')]?_0x26f2cf[_0xfc52('0x16')][_0xfc52('0x18')]||null:null,'attributes':_0x26f2cf[_0xfc52('0x16')]?_0x26f2cf['options'][_0xfc52('0x19')]||null:null,'include':_0x26f2cf[_0xfc52('0x16')]?_0x26f2cf[_0xfc52('0x16')][_0xfc52('0x1a')]?_[_0xfc52('0x1b')](_0x26f2cf['options']['include'],function(_0x41e145){return{'model':db[_0x41e145[_0xfc52('0x1c')]],'as':_0x41e145['as'],'attributes':_0x41e145['attributes'],'include':_0x41e145[_0xfc52('0x1a')]?_[_0xfc52('0x1b')](_0x41e145['include'],function(_0x5aa85c){return{'model':db[_0x5aa85c[_0xfc52('0x1c')]],'as':_0x5aa85c['as'],'attributes':_0x5aa85c[_0xfc52('0x19')],'include':_0x5aa85c[_0xfc52('0x1a')]?_[_0xfc52('0x1b')](_0x5aa85c[_0xfc52('0x1a')],function(_0xbde506){return{'model':db[_0xbde506[_0xfc52('0x1c')]],'as':_0xbde506['as'],'attributes':_0xbde506[_0xfc52('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfc52('0x9')](function(_0x2a3125){logger[_0xfc52('0xa')](_0xfc52('0x13'),_0x26f2cf);logger[_0xfc52('0xd')](_0xfc52('0x13'),_0x26f2cf,JSON[_0xfc52('0x1d')](_0x2a3125));_0x563966(_0x2a3125);})[_0xfc52('0x12')](function(_0x179b5c){logger[_0xfc52('0xe')](_0xfc52('0x13'),_0x179b5c[_0xfc52('0x10')],_0x26f2cf);_0x306fdf(_0x4d379d[_0xfc52('0xe')](0x1f4,_0x179b5c[_0xfc52('0x10')]));});});}; \ No newline at end of file +var _0x6e8a=['error','code','message','result','catch','ShowPause','Pause','options','raw','where','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','Pause,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xea1570,_0x2f7856){var _0x579e74=function(_0x236bcc){while(--_0x236bcc){_0xea1570['push'](_0xea1570['shift']());}};_0x579e74(++_0x2f7856);}(_0x6e8a,0x8a));var _0xa6e8=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x6e8a[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0xa6e8('0x0'));var util=require(_0xa6e8('0x1'));var moment=require(_0xa6e8('0x2'));var BPromise=require(_0xa6e8('0x3'));var rs=require(_0xa6e8('0x4'));var fs=require('fs');var Redis=require(_0xa6e8('0x5'));var db=require(_0xa6e8('0x6'))['db'];var utils=require(_0xa6e8('0x7'));var logger=require('../../config/logger')(_0xa6e8('0x8'));var config=require(_0xa6e8('0x9'));var jayson=require(_0xa6e8('0xa'));var client=jayson[_0xa6e8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x966c16,_0x57678e,_0x368c90){return new BPromise(function(_0x4b6f16,_0xf3e3bd){return client['request'](_0x966c16,_0x368c90)[_0xa6e8('0xc')](function(_0xba7235){logger[_0xa6e8('0xd')](_0xa6e8('0xe'),_0x57678e,_0xa6e8('0xf'));logger['debug']('Pause,\x20%s,\x20%s,\x20%s',_0x57678e,'request\x20sent',JSON[_0xa6e8('0x10')](_0xba7235));if(_0xba7235[_0xa6e8('0x11')]){if(_0xba7235[_0xa6e8('0x11')][_0xa6e8('0x12')]===0x1f4){logger[_0xa6e8('0x11')](_0xa6e8('0xe'),_0x57678e,_0xba7235['error'][_0xa6e8('0x13')]);return _0xf3e3bd(_0xba7235[_0xa6e8('0x11')][_0xa6e8('0x13')]);}logger[_0xa6e8('0x11')](_0xa6e8('0xe'),_0x57678e,_0xba7235[_0xa6e8('0x11')][_0xa6e8('0x13')]);return _0x4b6f16(_0xba7235[_0xa6e8('0x11')][_0xa6e8('0x13')]);}else{logger['info'](_0xa6e8('0xe'),_0x57678e,_0xa6e8('0xf'));_0x4b6f16(_0xba7235[_0xa6e8('0x14')][_0xa6e8('0x13')]);}})[_0xa6e8('0x15')](function(_0x5ce0b5){logger[_0xa6e8('0x11')](_0xa6e8('0xe'),_0x57678e,_0x5ce0b5);_0xf3e3bd(_0x5ce0b5);});});}exports[_0xa6e8('0x16')]=function(_0x3766be){var _0x2c9e5d=this;return new Promise(function(_0x58a560,_0x210a84){return db[_0xa6e8('0x17')]['find']({'raw':_0x3766be['options']?_0x3766be[_0xa6e8('0x18')][_0xa6e8('0x19')]===undefined?!![]:![]:!![],'where':_0x3766be[_0xa6e8('0x18')]?_0x3766be['options'][_0xa6e8('0x1a')]||null:null,'attributes':_0x3766be[_0xa6e8('0x18')]?_0x3766be[_0xa6e8('0x18')][_0xa6e8('0x1b')]||null:null,'include':_0x3766be['options']?_0x3766be['options']['include']?_[_0xa6e8('0x1c')](_0x3766be['options'][_0xa6e8('0x1d')],function(_0x18b3d5){return{'model':db[_0x18b3d5[_0xa6e8('0x1e')]],'as':_0x18b3d5['as'],'attributes':_0x18b3d5['attributes'],'include':_0x18b3d5[_0xa6e8('0x1d')]?_[_0xa6e8('0x1c')](_0x18b3d5[_0xa6e8('0x1d')],function(_0x405390){return{'model':db[_0x405390['model']],'as':_0x405390['as'],'attributes':_0x405390[_0xa6e8('0x1b')],'include':_0x405390['include']?_['map'](_0x405390[_0xa6e8('0x1d')],function(_0x22091d){return{'model':db[_0x22091d[_0xa6e8('0x1e')]],'as':_0x22091d['as'],'attributes':_0x22091d[_0xa6e8('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cf928){logger['info'](_0xa6e8('0x16'),_0x3766be);logger['debug'](_0xa6e8('0x16'),_0x3766be,JSON[_0xa6e8('0x10')](_0x5cf928));_0x58a560(_0x5cf928);})[_0xa6e8('0x15')](function(_0x46cc6c){logger[_0xa6e8('0x11')](_0xa6e8('0x16'),_0x46cc6c[_0xa6e8('0x13')],_0x3766be);_0x210a84(_0x2c9e5d[_0xa6e8('0x11')](0x1f4,_0x46cc6c[_0xa6e8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index aea2962..51c2ee6 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 _0x6f66=['get','isAuthenticated','index','/webhook','webhookGet','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','%s-%s%s','basename','post','single','webhookPost','put','update','/:id','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./plugin.controller'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x6f66,0x1d9));var _0x66f6=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0x6f66[_0x58547b];return _0x1d3fd2;};'use strict';var multer=require(_0x66f6('0x0'));var util=require(_0x66f6('0x1'));var path=require(_0x66f6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x66f6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x66f6('0x4'));var interaction=require(_0x66f6('0x5'));var config=require('../../config/environment');var controller=require(_0x66f6('0x6'));router[_0x66f6('0x7')]('/',auth[_0x66f6('0x8')](),controller[_0x66f6('0x9')]);router['get'](_0x66f6('0xa'),controller[_0x66f6('0xb')]);router[_0x66f6('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x66f6('0x7')](_0x66f6('0xc'),auth[_0x66f6('0x8')](),controller[_0x66f6('0xd')]);var upload=multer({'storage':multer[_0x66f6('0xe')]({'destination':function(_0xd6a0a4,_0x23b962,_0x289e27){_0x289e27(null,path[_0x66f6('0xf')](config[_0x66f6('0x10')],_0x66f6('0x11')));},'filename':function(_0x58c34b,_0x3b9069,_0x1fac72){_0x3b9069[_0x66f6('0x12')]=_0x3b9069[_0x66f6('0x12')][_0x66f6('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1fac72(null,util['format'](_0x66f6('0x14'),path[_0x66f6('0x15')](_0x3b9069[_0x66f6('0x12')],path['extname'](_0x3b9069['originalname'])),Date['now'](),path['extname'](_0x3b9069['originalname'])));}})});router[_0x66f6('0x16')]('/',upload[_0x66f6('0x17')]('file'),controller['upload']);router[_0x66f6('0x16')]('/webhook',controller[_0x66f6('0x18')]);router[_0x66f6('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x66f6('0x1a')]);router['delete'](_0x66f6('0x1b'),auth[_0x66f6('0x8')](),controller[_0x66f6('0x1c')]);module[_0x66f6('0x1d')]=router; \ No newline at end of file +var _0x43bd=['download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','/:id','delete','exports','multer','connect-timeout','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','show','/:id/download'];(function(_0x30cc1a,_0x162bbc){var _0xb3f18f=function(_0x26bdfe){while(--_0x26bdfe){_0x30cc1a['push'](_0x30cc1a['shift']());}};_0xb3f18f(++_0x162bbc);}(_0x43bd,0xf4));var _0xd43b=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x43bd[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0xd43b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd43b('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd43b('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xd43b('0x3'));var controller=require(_0xd43b('0x4'));router[_0xd43b('0x5')]('/',auth[_0xd43b('0x6')](),controller[_0xd43b('0x7')]);router[_0xd43b('0x5')](_0xd43b('0x8'),controller[_0xd43b('0x9')]);router[_0xd43b('0x5')]('/:id',auth[_0xd43b('0x6')](),controller[_0xd43b('0xa')]);router['get'](_0xd43b('0xb'),auth['isAuthenticated'](),controller[_0xd43b('0xc')]);var upload=multer({'storage':multer[_0xd43b('0xd')]({'destination':function(_0x378265,_0x2a5234,_0xed7239){_0xed7239(null,path[_0xd43b('0xe')](config[_0xd43b('0xf')],_0xd43b('0x10')));},'filename':function(_0x168b22,_0x38fb0a,_0x309318){_0x38fb0a[_0xd43b('0x11')]=_0x38fb0a['originalname'][_0xd43b('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x309318(null,util[_0xd43b('0x13')](_0xd43b('0x14'),path[_0xd43b('0x15')](_0x38fb0a[_0xd43b('0x11')],path[_0xd43b('0x16')](_0x38fb0a['originalname'])),Date[_0xd43b('0x17')](),path[_0xd43b('0x16')](_0x38fb0a[_0xd43b('0x11')])));}})});router[_0xd43b('0x18')]('/',upload[_0xd43b('0x19')](_0xd43b('0x1a')),controller[_0xd43b('0x1b')]);router[_0xd43b('0x18')](_0xd43b('0x8'),controller[_0xd43b('0x1c')]);router['put'](_0xd43b('0x1d'),auth[_0xd43b('0x6')](),controller['update']);router[_0xd43b('0x1e')](_0xd43b('0x1d'),auth['isAuthenticated'](),controller['delete']);module[_0xd43b('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 6cc482b..f4df358 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 _0xc900=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','sequelize','exports','ENUM','script','TEXT'];(function(_0x1dd0b6,_0x5c4f29){var _0x294238=function(_0x4a22fa){while(--_0x4a22fa){_0x1dd0b6['push'](_0x1dd0b6['shift']());}};_0x294238(++_0x5c4f29);}(_0xc900,0xc7));var _0x0c90=function(_0x1b37f8,_0x294d7f){_0x1b37f8=_0x1b37f8-0x0;var _0x7a266a=_0xc900[_0x1b37f8];return _0x7a266a;};'use strict';var Sequelize=require(_0x0c90('0x0'));module[_0x0c90('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0c90('0x2')]('html',_0x0c90('0x3'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x0c90('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0x0c90('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x0c90('0x6'),_0x0c90('0x7'),_0x0c90('0x8'),_0x0c90('0x9')),'defaultValue':'always','comment':_0x0c90('0xa')},'icon':{'type':Sequelize[_0x0c90('0xb')]},'adminUrl':{'type':Sequelize[_0x0c90('0xb')]},'agentUrl':{'type':Sequelize[_0x0c90('0xb')]},'scriptName':{'type':Sequelize[_0x0c90('0xb')]},'scriptPath':{'type':Sequelize[_0x0c90('0xb')]}}; \ No newline at end of file +var _0x78b3=['TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','script'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x78b3,0x1b3));var _0x378b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x78b3[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x378b('0x0'));module[_0x378b('0x1')]={'name':{'type':Sequelize[_0x378b('0x2')]},'type':{'type':Sequelize['ENUM'](_0x378b('0x3'),_0x378b('0x4'))},'description':{'type':Sequelize[_0x378b('0x5')]},'version':{'type':Sequelize[_0x378b('0x5')]},'path':{'type':Sequelize[_0x378b('0x2')],'comment':_0x378b('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x378b('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0x378b('0x8'),'agentOnly',_0x378b('0x9'),'never'),'defaultValue':_0x378b('0x9'),'comment':_0x378b('0xa')},'icon':{'type':Sequelize[_0x378b('0x2')]},'adminUrl':{'type':Sequelize[_0x378b('0x2')]},'agentUrl':{'type':Sequelize[_0x378b('0x2')]},'scriptName':{'type':Sequelize[_0x378b('0x2')]},'scriptPath':{'type':Sequelize[_0x378b('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 327ed72..565794d 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 _0x2c91=['readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','parse','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','plugins','test','Warning:\x20agent\x20view\x20not\x20specified','scriptName','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','dirname','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','format','%s%s','headers','content-length','content-type','endsWith','statusCode','send','webhookPost','http://localhost:','rimraf','fast-json-patch','request-promise','moment','mustache','path','fs-extra','lodash','squel','jsforce','to-csv','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./plugin.socket','register','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','name','index','map','Plugin','type','key','model','query','attributes','intersection','fields','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','count','includeAll','rows','catch','rawAttributes','keys','length','include','find','download','params','join','root','server/files/plugins','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory'];(function(_0x9101a5,_0x507375){var _0x585cce=function(_0x3598f7){while(--_0x3598f7){_0x9101a5['push'](_0x9101a5['shift']());}};_0x585cce(++_0x507375);}(_0x2c91,0xe0));var _0x12c9=function(_0xc07629,_0x5165ae){_0xc07629=_0xc07629-0x0;var _0x5362ab=_0x2c91[_0xc07629];return _0x5362ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x12c9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x12c9('0x1'));var rp=require(_0x12c9('0x2'));var moment=require(_0x12c9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x12c9('0x4'));var util=require('util');var path=require(_0x12c9('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x12c9('0x6'));var _=require(_0x12c9('0x7'));var squel=require(_0x12c9('0x8'));var crypto=require('crypto');var jsforce=require(_0x12c9('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x12c9('0xa'));var querystring=require(_0x12c9('0xb'));var Papa=require('papaparse');var extract=require(_0x12c9('0xc'));var rimraf=require(_0x12c9('0x0'));var archiver=require(_0x12c9('0xd'));var Redis=require(_0x12c9('0xe'));var authService=require(_0x12c9('0xf'));var qs=require(_0x12c9('0x10'));var as=require(_0x12c9('0x11'));var hardwareService=require(_0x12c9('0x12'));var logger=require(_0x12c9('0x13'))(_0x12c9('0x14'));var utils=require(_0x12c9('0x15'));var config=require(_0x12c9('0x16'));var licenseUtil=require(_0x12c9('0x17'));var db=require(_0x12c9('0x18'))['db'];config['redis']=_[_0x12c9('0x19')](config[_0x12c9('0x1a')],{'host':_0x12c9('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x12c9('0x1a')]));require(_0x12c9('0x1c'))[_0x12c9('0x1d')](socket);function respondWithStatusCode(_0x4ef497,_0x34a18b){_0x34a18b=_0x34a18b||0xcc;return function(_0x140dbd){if(_0x140dbd){return _0x4ef497[_0x12c9('0x1e')](_0x34a18b);}return _0x4ef497['status'](_0x34a18b)[_0x12c9('0x1f')]();};}function respondWithResult(_0x269cb3,_0xc440fc){_0xc440fc=_0xc440fc||0xc8;return function(_0x98a664){if(_0x98a664){return _0x269cb3[_0x12c9('0x20')](_0xc440fc)[_0x12c9('0x21')](_0x98a664);}};}function respondWithFilteredResult(_0x519d49,_0x1fd9bf){return function(_0x1a702e){if(_0x1a702e){var _0x3ae12f=typeof _0x1fd9bf[_0x12c9('0x22')]===_0x12c9('0x23')&&typeof _0x1fd9bf[_0x12c9('0x24')]==='undefined';var _0x5a747c=_0x1a702e['count'];var _0x260b85=_0x3ae12f?0x0:_0x1fd9bf[_0x12c9('0x22')];var _0x37a3a9=_0x3ae12f?_0x1a702e['count']:_0x1fd9bf[_0x12c9('0x22')]+_0x1fd9bf[_0x12c9('0x24')];var _0x16a2f5;if(_0x37a3a9>=_0x5a747c){_0x37a3a9=_0x5a747c;_0x16a2f5=0xc8;}else{_0x16a2f5=0xce;}_0x519d49['status'](_0x16a2f5);return _0x519d49[_0x12c9('0x25')](_0x12c9('0x26'),_0x260b85+'-'+_0x37a3a9+'/'+_0x5a747c)[_0x12c9('0x21')](_0x1a702e);}return null;};}function patchUpdates(_0x18ed27){return function(_0x4ac038){try{jsonpatch[_0x12c9('0x27')](_0x4ac038,_0x18ed27,!![]);}catch(_0x47cd3c){return BPromise[_0x12c9('0x28')](_0x47cd3c);}return _0x4ac038[_0x12c9('0x29')]();};}function saveUpdates(_0x30998f,_0x4735e5){return function(_0x4cb069){if(_0x4cb069){return _0x4cb069[_0x12c9('0x2a')](_0x30998f)[_0x12c9('0x2b')](function(_0x1deecf){return _0x1deecf;});}return null;};}function removeEntity(_0x5b1c93,_0x3fc97b){return function(_0x2e9a2c){if(_0x2e9a2c){return _0x2e9a2c[_0x12c9('0x2c')]()[_0x12c9('0x2b')](function(){var _0x15ce86=_0x2e9a2c[_0x12c9('0x2d')]({'plain':!![]});var _0x32af10=_0x12c9('0x2e');return db[_0x12c9('0x2f')][_0x12c9('0x2c')]({'where':{'type':_0x32af10,'resourceId':_0x15ce86['id']}})[_0x12c9('0x2b')](function(){return _0x2e9a2c;});})['then'](function(){_0x5b1c93[_0x12c9('0x20')](0xcc)[_0x12c9('0x1f')]();});}};}function handleEntityNotFound(_0x1ff218,_0x183ce7){return function(_0x3182f3){if(!_0x3182f3){_0x1ff218['sendStatus'](0x194);}return _0x3182f3;};}function handleError(_0xd363cf,_0x52e5a4){_0x52e5a4=_0x52e5a4||0x1f4;return function(_0x1906c3){logger[_0x12c9('0x30')](_0x1906c3['stack']);if(_0x1906c3[_0x12c9('0x31')]){delete _0x1906c3[_0x12c9('0x31')];}_0xd363cf[_0x12c9('0x20')](_0x52e5a4)['send'](_0x1906c3);};}exports[_0x12c9('0x32')]=function(_0x2b6caf,_0x197174){var _0x4387c0={},_0xc37ef9={},_0x5afa53={'count':0x0,'rows':[]};var _0x11ee3e=_[_0x12c9('0x33')](db[_0x12c9('0x34')]['rawAttributes'],function(_0x3f46b9){return{'name':_0x3f46b9['fieldName'],'type':_0x3f46b9[_0x12c9('0x35')][_0x12c9('0x36')]};});_0xc37ef9[_0x12c9('0x37')]=_[_0x12c9('0x33')](_0x11ee3e,_0x12c9('0x31'));_0xc37ef9['query']=_['keys'](_0x2b6caf[_0x12c9('0x38')]);_0xc37ef9['filters']=_['intersection'](_0xc37ef9[_0x12c9('0x37')],_0xc37ef9[_0x12c9('0x38')]);_0x4387c0[_0x12c9('0x39')]=_[_0x12c9('0x3a')](_0xc37ef9['model'],qs[_0x12c9('0x3b')](_0x2b6caf['query']['fields']));_0x4387c0[_0x12c9('0x39')]=_0x4387c0[_0x12c9('0x39')]['length']?_0x4387c0[_0x12c9('0x39')]:_0xc37ef9[_0x12c9('0x37')];if(!_0x2b6caf[_0x12c9('0x38')]['hasOwnProperty'](_0x12c9('0x3c'))){_0x4387c0['limit']=qs[_0x12c9('0x24')](_0x2b6caf[_0x12c9('0x38')][_0x12c9('0x24')]);_0x4387c0[_0x12c9('0x22')]=qs['offset'](_0x2b6caf['query']['offset']);}_0x4387c0[_0x12c9('0x3d')]=qs[_0x12c9('0x3e')](_0x2b6caf['query']['sort']);_0x4387c0['where']=qs[_0x12c9('0x3f')](_[_0x12c9('0x40')](_0x2b6caf[_0x12c9('0x38')],_0xc37ef9[_0x12c9('0x3f')]),_0x11ee3e);if(_0x2b6caf['query'][_0x12c9('0x41')]){_0x4387c0[_0x12c9('0x42')]=_['merge'](_0x4387c0['where'],{'$or':_[_0x12c9('0x33')](_0x11ee3e,function(_0x10a0ac){if(_0x10a0ac[_0x12c9('0x35')]!==_0x12c9('0x43')){var _0x10af4c={};_0x10af4c[_0x10a0ac[_0x12c9('0x31')]]={'$like':'%'+_0x2b6caf[_0x12c9('0x38')][_0x12c9('0x41')]+'%'};return _0x10af4c;}})});}_0x4387c0=_[_0x12c9('0x44')]({},_0x4387c0,_0x2b6caf[_0x12c9('0x45')]);var _0x19963c={'where':_0x4387c0['where']};return db['Plugin'][_0x12c9('0x46')](_0x19963c)[_0x12c9('0x2b')](function(_0xaa10f7){_0x5afa53[_0x12c9('0x46')]=_0xaa10f7;if(_0x2b6caf['query'][_0x12c9('0x47')]){_0x4387c0['include']=[{'all':!![]}];}return db[_0x12c9('0x34')]['findAll'](_0x4387c0);})[_0x12c9('0x2b')](function(_0x2546b3){_0x5afa53[_0x12c9('0x48')]=_0x2546b3;return _0x5afa53;})[_0x12c9('0x2b')](respondWithFilteredResult(_0x197174,_0x4387c0))[_0x12c9('0x49')](handleError(_0x197174,null));};exports['show']=function(_0x2e9803,_0x2b0e78){var _0x4428a1={'raw':!![],'where':{'id':_0x2e9803['params']['id']}},_0x5ce49d={};_0x5ce49d['model']=_['keys'](db[_0x12c9('0x34')][_0x12c9('0x4a')]);_0x5ce49d[_0x12c9('0x38')]=_[_0x12c9('0x4b')](_0x2e9803[_0x12c9('0x38')]);_0x5ce49d['filters']=_[_0x12c9('0x3a')](_0x5ce49d[_0x12c9('0x37')],_0x5ce49d[_0x12c9('0x38')]);_0x4428a1[_0x12c9('0x39')]=_[_0x12c9('0x3a')](_0x5ce49d[_0x12c9('0x37')],qs[_0x12c9('0x3b')](_0x2e9803[_0x12c9('0x38')]['fields']));_0x4428a1[_0x12c9('0x39')]=_0x4428a1['attributes'][_0x12c9('0x4c')]?_0x4428a1[_0x12c9('0x39')]:_0x5ce49d[_0x12c9('0x37')];if(_0x2e9803[_0x12c9('0x38')]['includeAll']){_0x4428a1[_0x12c9('0x4d')]=[{'all':!![]}];}_0x4428a1=_['merge']({},_0x4428a1,_0x2e9803['options']);return db[_0x12c9('0x34')][_0x12c9('0x4e')](_0x4428a1)[_0x12c9('0x2b')](handleEntityNotFound(_0x2b0e78,null))[_0x12c9('0x2b')](respondWithResult(_0x2b0e78,null))[_0x12c9('0x49')](handleError(_0x2b0e78,null));};exports[_0x12c9('0x4f')]=function(_0x32582b,_0x1d23d1,_0x1a36ad){return db['Plugin'][_0x12c9('0x4e')]({'where':{'id':_0x32582b[_0x12c9('0x50')]['id']},'attributes':['name',_0x12c9('0x5')],'raw':!![]})[_0x12c9('0x2b')](handleEntityNotFound(_0x1d23d1,null))[_0x12c9('0x2b')](function(_0x277fbf){if(_0x277fbf){var _0x2d8d0e=path[_0x12c9('0x51')](config[_0x12c9('0x52')],_0x12c9('0x53'),util['format']('%s.zip',path['basename'](_0x277fbf[_0x12c9('0x5')])));var _0x33509b=fs[_0x12c9('0x54')](_0x2d8d0e);var _0x572783=archiver(_0x12c9('0x55'),{'zlib':{'level':0x9}});_0x572783['on'](_0x12c9('0x56'),function(_0x154815){if(_0x154815[_0x12c9('0x57')]===_0x12c9('0x58')){logger[_0x12c9('0x30')](_0x154815);}else{throw new db[(_0x12c9('0x59'))][(_0x12c9('0x5a'))](_0x12c9('0x5b'));}});_0x572783['on'](_0x12c9('0x30'),function(_0x1d50a9){throw new db[(_0x12c9('0x59'))][(_0x12c9('0x5a'))](_0x12c9('0x5b'));});_0x572783[_0x12c9('0x5c')](_0x33509b);_0x572783[_0x12c9('0x5d')]('**/*',{'cwd':path[_0x12c9('0x51')](config[_0x12c9('0x52')],'server/files/plugins',path['dirname'](_0x277fbf[_0x12c9('0x5')])),'ignore':[path[_0x12c9('0x51')](path[_0x12c9('0x5e')](_0x277fbf[_0x12c9('0x5')]),_0x12c9('0x5f')),path['join'](path[_0x12c9('0x5e')](_0x277fbf[_0x12c9('0x5')]),_0x12c9('0x60'))],'nodir':!![]})[_0x12c9('0x61')]();_0x33509b['on'](_0x12c9('0x62'),function(){if(!fs[_0x12c9('0x63')](_0x2d8d0e)){throw new db[(_0x12c9('0x59'))][(_0x12c9('0x5a'))](_0x12c9('0x64'));}return _0x1d23d1['download'](_0x2d8d0e,util['format'](_0x12c9('0x65'),path[_0x12c9('0x5e')](_0x277fbf[_0x12c9('0x5')])),function(_0xce6dd3){if(_0xce6dd3){throw new db['Sequelize'][(_0x12c9('0x5a'))](_0x12c9('0x66'));}fs[_0x12c9('0x67')](_0x2d8d0e);logger[_0x12c9('0x68')](_0x12c9('0x69'));logger[_0x12c9('0x68')](_0x12c9('0x6a'));});});}return null;})[_0x12c9('0x49')](handleError(_0x1d23d1,null));};exports['upload']=function(_0x3ec611,_0x22634f,_0x4566d7){var _0x1bd43f=path[_0x12c9('0x5e')](_0x3ec611[_0x12c9('0x6b')][_0x12c9('0x6c')],path[_0x12c9('0x6d')](_0x3ec611['file'][_0x12c9('0x6c')]));var _0x156d37=path[_0x12c9('0x51')](config['root'],'server/files/plugins',_0x3ec611[_0x12c9('0x6b')][_0x12c9('0x6c')]);var _0x1c9549=path[_0x12c9('0x51')](config[_0x12c9('0x52')],'server/files/plugins',_0x1bd43f);logger['info'](_0x12c9('0x6e'),_0x156d37);logger[_0x12c9('0x68')](_0x12c9('0x6f'),_0x1c9549);try{fs[_0x12c9('0x70')](_0x156d37,parseInt(_0x12c9('0x71'),0x8));extract(_0x156d37,{'dir':_0x1c9549},function(_0x4f9b1e){if(_0x4f9b1e){logger[_0x12c9('0x30')](_0x4f9b1e);handleError(_0x4f9b1e,!![]);};var _0x16ab15=fs['readdirSync'](_0x1c9549);if(_0x16ab15[_0x12c9('0x4c')]>0x1){removeReferences(_0x156d37,_0x1c9549);logger[_0x12c9('0x30')]('Invalid\x20plugin\x20structure');return _0x4566d7(new Error(_0x12c9('0x72')));}var _0xc5901c=fs[_0x12c9('0x73')](path['join'](_0x1c9549,_0x16ab15[0x0]));if(_0xc5901c[_0x12c9('0x74')]()){removeReferences(_0x156d37,_0x1c9549);logger['error']('Invalid\x20plugin\x20structure');return _0x4566d7(new Error(_0x12c9('0x72')));}if(_0xc5901c[_0x12c9('0x75')]()){var _0x3d61f9=fs[_0x12c9('0x76')](path[_0x12c9('0x51')](_0x1c9549,_0x16ab15[0x0]));if(_0x3d61f9[_0x12c9('0x4c')]===0x0){removeReferences(_0x156d37,_0x1c9549);logger['error'](_0x12c9('0x72'));return _0x4566d7(new Error(_0x12c9('0x72')));}var _0x3d2338=_0x3d61f9[_0x12c9('0x77')](function(_0x46755f){return _0x46755f===_0x12c9('0x78');});if(!_0x3d2338){return _0x4566d7(new Error(_0x12c9('0x79')));}var _0x4830b1=fs['readFileSync'](path[_0x12c9('0x51')](_0x1c9549,_0x16ab15[0x0],_0x12c9('0x78')));var _0x295a17=JSON[_0x12c9('0x7a')](_0x4830b1);if('undefined'==typeof _0x295a17['name']){return _0x4566d7(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x12c9('0x23')==typeof _0x295a17['type']){return _0x4566d7(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x12c9('0x23')==typeof _0x295a17[_0x12c9('0x7b')]){return _0x4566d7(new Error(_0x12c9('0x7c')));}if(_0x12c9('0x23')==typeof _0x295a17[_0x12c9('0x7d')]){return _0x4566d7(new Error(_0x12c9('0x7e')));}if(_0x295a17[_0x12c9('0x35')]==='html'){if(_0x12c9('0x23')==typeof _0x295a17[_0x12c9('0x7d')]['views']){return _0x4566d7(new Error(_0x12c9('0x7f')));}if(_0x12c9('0x23')==typeof _0x295a17['parameters'][_0x12c9('0x80')][_0x12c9('0x81')]&&_0x12c9('0x23')==typeof _0x295a17[_0x12c9('0x7d')]['views'][_0x12c9('0x82')]){return _0x4566d7(new Error(_0x12c9('0x83')));}}else if(_0x295a17[_0x12c9('0x35')]===_0x12c9('0x84')){if('undefined'==typeof _0x295a17[_0x12c9('0x7d')]['scriptName']){return _0x4566d7(new Error(_0x12c9('0x85')));}if(_0x12c9('0x23')==typeof _0x295a17[_0x12c9('0x7d')][_0x12c9('0x86')]){return _0x4566d7(new Error(_0x12c9('0x87')));}}else{return _0x4566d7(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x513c21=_0x295a17[_0x12c9('0x31')];var _0x45911a=_0x295a17[_0x12c9('0x88')];var _0x3a6db7=_0x295a17[_0x12c9('0x35')];var _0x19d69d=_0x295a17['sidebar']?_0x295a17[_0x12c9('0x89')]:_0x12c9('0x8a');var _0x3f0f47=_0x295a17[_0x12c9('0x8b')]?_0x295a17[_0x12c9('0x8b')]:'icon-apps';var _0x13c36c='';var _0xa5dff9='';var _0x5e2e14='';var _0x3dff77='';var _0x2b590f=_0x295a17[_0x12c9('0x7b')];if(_0x3a6db7==='html'){if(_0x12c9('0x23')!=typeof _0x295a17['parameters'][_0x12c9('0x80')][_0x12c9('0x81')]){var _0x285008=_0x295a17[_0x12c9('0x7d')][_0x12c9('0x80')][_0x12c9('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x285008)){_0x13c36c=path['join'](_0x12c9('0x8c'),_0x1bd43f,_0x16ab15[0x0],_0x285008);}else{_0x13c36c=_0x285008;}}else{logger[_0x12c9('0x68')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x12c9('0x23')!=typeof _0x295a17[_0x12c9('0x7d')][_0x12c9('0x80')][_0x12c9('0x82')]){var _0x210cda=_0x295a17[_0x12c9('0x7d')]['views'][_0x12c9('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x12c9('0x8d')](_0x210cda)){_0xa5dff9=path[_0x12c9('0x51')](_0x12c9('0x8c'),_0x1bd43f,_0x16ab15[0x0],_0x210cda);}else{_0xa5dff9=_0x210cda;}}else{logger[_0x12c9('0x68')](_0x12c9('0x8e'));}}else if(_0x3a6db7===_0x12c9('0x84')){_0x5e2e14=_0x295a17['parameters'][_0x12c9('0x8f')];_0x3dff77=_0x295a17[_0x12c9('0x7d')][_0x12c9('0x86')];if(_0x12c9('0x23')!=typeof _0x295a17['parameters']['views']){if('undefined'!=typeof _0x295a17['parameters'][_0x12c9('0x80')][_0x12c9('0x81')]){var _0x285008=_0x295a17['parameters'][_0x12c9('0x80')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x12c9('0x8d')](_0x285008)){_0x13c36c=path['join'](_0x12c9('0x8c'),_0x1bd43f,_0x16ab15[0x0],_0x285008);}else{_0x13c36c=_0x285008;}}if('undefined'!=typeof _0x295a17[_0x12c9('0x7d')][_0x12c9('0x80')][_0x12c9('0x82')]){var _0x210cda=_0x295a17[_0x12c9('0x7d')]['views'][_0x12c9('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x12c9('0x8d')](_0x210cda)){_0xa5dff9=path['join'](_0x12c9('0x8c'),_0x1bd43f,_0x16ab15[0x0],_0x210cda);}else{_0xa5dff9=_0x210cda;}}}}var _0x12d97c={'name':_0x513c21,'description':_0x45911a,'path':path[_0x12c9('0x51')](_0x1bd43f,_0x16ab15[0x0]),'type':_0x3a6db7,'sidebar':_0x19d69d,'icon':_0x3f0f47,'adminUrl':_0x13c36c,'agentUrl':_0xa5dff9,'scriptName':_0x5e2e14,'scriptPath':_0x3dff77,'version':_0x2b590f};removeReferences(_0x156d37,null);return db[_0x12c9('0x34')]['create'](_0x12d97c)['then'](function(_0x371f3a){var _0x20ac3e={'role':_0x3ec611[_0x12c9('0x90')][_0x12c9('0x91')],'userProfileId':_0x3ec611[_0x12c9('0x90')][_0x12c9('0x92')]};if(!_0x20ac3e)throw new Error(_0x12c9('0x93'));if(_0x20ac3e['role']===_0x12c9('0x94')){var _0x38f932=_0x371f3a[_0x12c9('0x2d')]({'plain':!![]});return db[_0x12c9('0x95')]['find']({'where':{'name':'Plugins','userProfileId':_0x20ac3e[_0x12c9('0x92')]},'raw':!![]})[_0x12c9('0x2b')](function(_0x228afb){if(_0x228afb&&_0x228afb[_0x12c9('0x96')]===0x0){return db['UserProfileResource'][_0x12c9('0x97')]({'name':_0x38f932['name'],'resourceId':_0x38f932['id'],'type':_0x228afb[_0x12c9('0x31')],'sectionId':_0x228afb['id']},{})[_0x12c9('0x2b')](function(){return _0x371f3a;});}else{return _0x371f3a;}})[_0x12c9('0x49')](function(_0x139796){logger['error'](_0x12c9('0x98'),_0x139796);throw _0x139796;});}return _0x371f3a;})[_0x12c9('0x2b')](respondWithResult(_0x22634f,null))[_0x12c9('0x49')](handleError(_0x22634f,null));}});}catch(_0x5ac359){_0x22634f[_0x12c9('0x20')](0x1f4)['send'](_0x5ac359);}};function removeReferences(_0x352917,_0x9f25e8){try{if(_0x352917){fs[_0x12c9('0x67')](_0x352917);logger['info']('Zip\x20archive\x20removed');}if(_0x9f25e8){rimraf(_0x9f25e8,function(){});logger['info'](_0x12c9('0x99'));}}catch(_0x2786b4){logger[_0x12c9('0x30')](_0x2786b4);}}exports[_0x12c9('0x2a')]=function(_0x185962,_0x5126cd,_0x5c244b){return db[_0x12c9('0x34')][_0x12c9('0x4e')]({'where':{'id':_0x185962['params']['id']}})[_0x12c9('0x2b')](handleEntityNotFound(_0x5126cd,null))[_0x12c9('0x2b')](saveUpdates(_0x185962['body'],null))[_0x12c9('0x2b')](respondWithResult(_0x5126cd,null))[_0x12c9('0x49')](handleError(_0x5126cd,null));};exports[_0x12c9('0x9a')]=function(_0x2671c1,_0x5eb04b,_0x253576){return db['Plugin'][_0x12c9('0x4e')]({'where':{'id':_0x2671c1[_0x12c9('0x50')]['id']}})[_0x12c9('0x2b')](function(_0x28d8ba){if(_0x28d8ba){return _0x28d8ba[_0x12c9('0x2c')]();}})[_0x12c9('0x2b')](function(_0x6ab36d){rimraf(path[_0x12c9('0x51')](config[_0x12c9('0x52')],_0x12c9('0x53'),path[_0x12c9('0x9b')](_0x6ab36d['path'])),function(){});return _0x6ab36d;})[_0x12c9('0x2b')](handleEntityNotFound(_0x5eb04b,null))[_0x12c9('0x2b')](respondWithStatusCode(_0x5eb04b,null))['catch'](handleError(_0x5eb04b,null));};exports['webhookGet']=function(_0x5c9b67,_0x296b00,_0x1defbf){return BPromise[_0x12c9('0x9c')]()['then'](function(){if(!_0x5c9b67['query'][_0x12c9('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x5c9b67[_0x12c9('0x38')][_0x12c9('0x9d')]){throw new Error(_0x12c9('0x9e'));}var _0x38f224=_0x5c9b67[_0x12c9('0x38')][_0x12c9('0x9f')]?_0x5c9b67[_0x12c9('0x38')]['hostname']+':'+_0x5c9b67[_0x12c9('0x38')][_0x12c9('0x9d')]:'http://localhost:'+_0x5c9b67[_0x12c9('0x38')][_0x12c9('0x9d')];var _0x121c6a=_0x5c9b67[_0x12c9('0x38')][_0x12c9('0x21')]?_0x5c9b67[_0x12c9('0x38')][_0x12c9('0x21')]:!![];var _0x42dc29=_0x5c9b67['query'][_0x12c9('0xa0')]?_0x5c9b67[_0x12c9('0x38')][_0x12c9('0xa0')]:null;var _0x117544={'method':_0x5c9b67['method'],'uri':util[_0x12c9('0xa1')](_0x12c9('0xa2'),_0x38f224,_0x5c9b67['query'][_0x12c9('0x5')]),'json':_0x121c6a,'resolveWithFullResponse':!![],'encoding':_0x42dc29,'qs':_0x5c9b67['query']};if(_0x5c9b67[_0x12c9('0xa3')]){_0x117544['headers']=_0x5c9b67[_0x12c9('0xa3')];if(_0x117544[_0x12c9('0xa3')][_0x12c9('0xa4')]){delete _0x117544['headers'][_0x12c9('0xa4')];}}if(_0x117544['headers'][_0x12c9('0xa5')]){delete _0x117544[_0x12c9('0xa3')][_0x12c9('0xa5')];}return rp(_0x117544);})['then'](function(_0x594f40){if(_0x594f40){_0x296b00[_0x12c9('0x25')](_0x594f40[_0x12c9('0xa3')]);logger[_0x12c9('0x68')](_0x594f40[_0x12c9('0x90')]);if(_[_0x12c9('0xa6')](_0x5c9b67['query']['path'],_0x12c9('0x4f'))&&_0x594f40[_0x12c9('0xa7')]==0x1f4){return _0x296b00[_0x12c9('0x1e')](_0x594f40['statusCode']);}else{return _0x296b00[_0x12c9('0x20')](_0x594f40[_0x12c9('0xa7')])[_0x12c9('0xa8')](_0x594f40['body']);}}else{return _0x296b00[_0x12c9('0x1e')](0xc8);}})[_0x12c9('0x49')](handleError(_0x296b00,null));};exports[_0x12c9('0xa9')]=function(_0x441a7d,_0xa26f64,_0x3b6f84){return BPromise[_0x12c9('0x9c')]()[_0x12c9('0x2b')](function(){if(!_0x441a7d['query'][_0x12c9('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x441a7d[_0x12c9('0x38')][_0x12c9('0x9d')]){throw new Error(_0x12c9('0x9e'));}var _0x69429b=_0x441a7d['query'][_0x12c9('0x9f')]?_0x441a7d[_0x12c9('0x38')]['hostname']+':'+_0x441a7d[_0x12c9('0x38')][_0x12c9('0x9d')]:_0x12c9('0xaa')+_0x441a7d[_0x12c9('0x38')][_0x12c9('0x9d')];var _0x3aa905=_0x441a7d[_0x12c9('0x38')][_0x12c9('0x21')]?_0x441a7d['query'][_0x12c9('0x21')]:!![];var _0x3364b0=_0x441a7d[_0x12c9('0x38')]['encoding']?_0x441a7d['query'][_0x12c9('0xa0')]:null;var _0x291f59={'method':_0x441a7d['method'],'uri':util[_0x12c9('0xa1')](_0x12c9('0xa2'),_0x69429b,_0x441a7d[_0x12c9('0x38')][_0x12c9('0x5')]),'json':_0x3aa905,'resolveWithFullResponse':!![],'encoding':_0x3364b0,'body':_0x441a7d[_0x12c9('0x90')]};if(_0x441a7d[_0x12c9('0xa3')]){_0x291f59[_0x12c9('0xa3')]=_0x441a7d[_0x12c9('0xa3')];if(_0x291f59[_0x12c9('0xa3')][_0x12c9('0xa4')]){delete _0x291f59[_0x12c9('0xa3')][_0x12c9('0xa4')];}}if(_0x291f59[_0x12c9('0xa3')]['content-type']){delete _0x291f59[_0x12c9('0xa3')]['content-type'];}return rp(_0x291f59);})[_0x12c9('0x2b')](function(_0x259246){if(_0x259246){_0xa26f64[_0x12c9('0x25')](_0x259246[_0x12c9('0xa3')]);logger['info'](_0x259246[_0x12c9('0x90')]);return _0xa26f64[_0x12c9('0x20')](_0x259246['statusCode'])[_0x12c9('0xa8')](_0x259246[_0x12c9('0x90')]);}else{return _0xa26f64['sendStatus'](0xc8);}})[_0x12c9('0x49')](handleError(_0xa26f64,null));}; \ No newline at end of file +var _0xbd99=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','Plugins','UserProfileResource','end','error','stack','name','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','Plugin','include','findAll','rows','show','params','keys','includeAll','find','catch','download','format','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','join','dirname','basename','node_modules/**/*','close','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','root','server/files/plugins','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','readFileSync','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','admin','Warning:\x20admin\x20view\x20not\x20specified','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','script','scriptName','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','destroy','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','archiver','ioredis'];(function(_0x4b5d93,_0x59980a){var _0x1db431=function(_0x486268){while(--_0x486268){_0x4b5d93['push'](_0x4b5d93['shift']());}};_0x1db431(++_0x59980a);}(_0xbd99,0x1df));var _0x9bd9=function(_0x2abb8b,_0xf155e0){_0x2abb8b=_0x2abb8b-0x0;var _0x38fd98=_0xbd99[_0x2abb8b];return _0x38fd98;};'use strict';var emlformat=require(_0x9bd9('0x0'));var rimraf=require(_0x9bd9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9bd9('0x2'));var rp=require(_0x9bd9('0x3'));var moment=require('moment');var BPromise=require(_0x9bd9('0x4'));var Mustache=require(_0x9bd9('0x5'));var util=require(_0x9bd9('0x6'));var path=require(_0x9bd9('0x7'));var sox=require(_0x9bd9('0x8'));var csv=require(_0x9bd9('0x9'));var ejs=require(_0x9bd9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9bd9('0xb'));var squel=require(_0x9bd9('0xc'));var crypto=require(_0x9bd9('0xd'));var jsforce=require(_0x9bd9('0xe'));var deskjs=require(_0x9bd9('0xf'));var toCsv=require(_0x9bd9('0x9'));var querystring=require('querystring');var Papa=require(_0x9bd9('0x10'));var extract=require('extract-zip');var rimraf=require(_0x9bd9('0x1'));var archiver=require(_0x9bd9('0x11'));var Redis=require(_0x9bd9('0x12'));var authService=require(_0x9bd9('0x13'));var qs=require(_0x9bd9('0x14'));var as=require(_0x9bd9('0x15'));var hardwareService=require(_0x9bd9('0x16'));var logger=require('../../config/logger')(_0x9bd9('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9bd9('0x18'));var db=require('../../mysqldb')['db'];config[_0x9bd9('0x19')]=_[_0x9bd9('0x1a')](config[_0x9bd9('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x9bd9('0x1b'))(new Redis(config['redis']));require(_0x9bd9('0x1c'))[_0x9bd9('0x1d')](socket);function respondWithStatusCode(_0x4bab02,_0x197bcc){_0x197bcc=_0x197bcc||0xcc;return function(_0xf3949c){if(_0xf3949c){return _0x4bab02[_0x9bd9('0x1e')](_0x197bcc);}return _0x4bab02[_0x9bd9('0x1f')](_0x197bcc)['end']();};}function respondWithResult(_0x57ffcb,_0x334927){_0x334927=_0x334927||0xc8;return function(_0x221d94){if(_0x221d94){return _0x57ffcb[_0x9bd9('0x1f')](_0x334927)[_0x9bd9('0x20')](_0x221d94);}};}function respondWithFilteredResult(_0x3cba37,_0x3e52ae){return function(_0x4bb159){if(_0x4bb159){var _0x4296aa=typeof _0x3e52ae[_0x9bd9('0x21')]===_0x9bd9('0x22')&&typeof _0x3e52ae['limit']===_0x9bd9('0x22');var _0x3a6e76=_0x4bb159[_0x9bd9('0x23')];var _0x1820e3=_0x4296aa?0x0:_0x3e52ae[_0x9bd9('0x21')];var _0x2f762e=_0x4296aa?_0x4bb159['count']:_0x3e52ae['offset']+_0x3e52ae['limit'];var _0x4f05dc;if(_0x2f762e>=_0x3a6e76){_0x2f762e=_0x3a6e76;_0x4f05dc=0xc8;}else{_0x4f05dc=0xce;}_0x3cba37[_0x9bd9('0x1f')](_0x4f05dc);return _0x3cba37[_0x9bd9('0x24')](_0x9bd9('0x25'),_0x1820e3+'-'+_0x2f762e+'/'+_0x3a6e76)[_0x9bd9('0x20')](_0x4bb159);}return null;};}function patchUpdates(_0x4506d3){return function(_0x50fd9e){try{jsonpatch[_0x9bd9('0x26')](_0x50fd9e,_0x4506d3,!![]);}catch(_0x4b6bec){return BPromise[_0x9bd9('0x27')](_0x4b6bec);}return _0x50fd9e['save']();};}function saveUpdates(_0x2a06e9,_0x2a39ba){return function(_0x4896d8){if(_0x4896d8){return _0x4896d8[_0x9bd9('0x28')](_0x2a06e9)[_0x9bd9('0x29')](function(_0x46a234){return _0x46a234;});}return null;};}function removeEntity(_0x1fbb40,_0x2ff274){return function(_0x439cb8){if(_0x439cb8){return _0x439cb8['destroy']()[_0x9bd9('0x29')](function(){var _0x2dd667=_0x439cb8['get']({'plain':!![]});var _0x2d9a99=_0x9bd9('0x2a');return db[_0x9bd9('0x2b')]['destroy']({'where':{'type':_0x2d9a99,'resourceId':_0x2dd667['id']}})['then'](function(){return _0x439cb8;});})['then'](function(){_0x1fbb40[_0x9bd9('0x1f')](0xcc)[_0x9bd9('0x2c')]();});}};}function handleEntityNotFound(_0x159eac,_0x2e025f){return function(_0x3d3968){if(!_0x3d3968){_0x159eac[_0x9bd9('0x1e')](0x194);}return _0x3d3968;};}function handleError(_0x4f50bd,_0x1e9450){_0x1e9450=_0x1e9450||0x1f4;return function(_0x3e311c){logger[_0x9bd9('0x2d')](_0x3e311c[_0x9bd9('0x2e')]);if(_0x3e311c[_0x9bd9('0x2f')]){delete _0x3e311c[_0x9bd9('0x2f')];}_0x4f50bd[_0x9bd9('0x1f')](_0x1e9450)['send'](_0x3e311c);};}exports['index']=function(_0x30141f,_0x4ec29b){var _0x595558={},_0x4c9a5a={},_0x324da3={'count':0x0,'rows':[]};var _0x5846f2=_['map'](db['Plugin'][_0x9bd9('0x30')],function(_0x2a4094){return{'name':_0x2a4094['fieldName'],'type':_0x2a4094['type'][_0x9bd9('0x31')]};});_0x4c9a5a[_0x9bd9('0x32')]=_['map'](_0x5846f2,'name');_0x4c9a5a[_0x9bd9('0x33')]=_['keys'](_0x30141f['query']);_0x4c9a5a[_0x9bd9('0x34')]=_[_0x9bd9('0x35')](_0x4c9a5a[_0x9bd9('0x32')],_0x4c9a5a[_0x9bd9('0x33')]);_0x595558[_0x9bd9('0x36')]=_['intersection'](_0x4c9a5a['model'],qs[_0x9bd9('0x37')](_0x30141f[_0x9bd9('0x33')][_0x9bd9('0x37')]));_0x595558[_0x9bd9('0x36')]=_0x595558[_0x9bd9('0x36')][_0x9bd9('0x38')]?_0x595558[_0x9bd9('0x36')]:_0x4c9a5a[_0x9bd9('0x32')];if(!_0x30141f[_0x9bd9('0x33')][_0x9bd9('0x39')](_0x9bd9('0x3a'))){_0x595558[_0x9bd9('0x3b')]=qs[_0x9bd9('0x3b')](_0x30141f[_0x9bd9('0x33')][_0x9bd9('0x3b')]);_0x595558[_0x9bd9('0x21')]=qs['offset'](_0x30141f['query'][_0x9bd9('0x21')]);}_0x595558[_0x9bd9('0x3c')]=qs['sort'](_0x30141f[_0x9bd9('0x33')][_0x9bd9('0x3d')]);_0x595558[_0x9bd9('0x3e')]=qs[_0x9bd9('0x34')](_[_0x9bd9('0x3f')](_0x30141f[_0x9bd9('0x33')],_0x4c9a5a[_0x9bd9('0x34')]),_0x5846f2);if(_0x30141f[_0x9bd9('0x33')]['filter']){_0x595558[_0x9bd9('0x3e')]=_[_0x9bd9('0x40')](_0x595558[_0x9bd9('0x3e')],{'$or':_['map'](_0x5846f2,function(_0x4b72f1){if(_0x4b72f1[_0x9bd9('0x41')]!==_0x9bd9('0x42')){var _0x3ed8bb={};_0x3ed8bb[_0x4b72f1['name']]={'$like':'%'+_0x30141f['query'][_0x9bd9('0x43')]+'%'};return _0x3ed8bb;}})});}_0x595558=_[_0x9bd9('0x40')]({},_0x595558,_0x30141f[_0x9bd9('0x44')]);var _0x3dc7f6={'where':_0x595558[_0x9bd9('0x3e')]};return db[_0x9bd9('0x45')][_0x9bd9('0x23')](_0x3dc7f6)[_0x9bd9('0x29')](function(_0x419552){_0x324da3['count']=_0x419552;if(_0x30141f['query']['includeAll']){_0x595558[_0x9bd9('0x46')]=[{'all':!![]}];}return db[_0x9bd9('0x45')][_0x9bd9('0x47')](_0x595558);})[_0x9bd9('0x29')](function(_0x540c54){_0x324da3[_0x9bd9('0x48')]=_0x540c54;return _0x324da3;})[_0x9bd9('0x29')](respondWithFilteredResult(_0x4ec29b,_0x595558))['catch'](handleError(_0x4ec29b,null));};exports[_0x9bd9('0x49')]=function(_0x32812b,_0x5a1f1a){var _0x4556c2={'raw':!![],'where':{'id':_0x32812b[_0x9bd9('0x4a')]['id']}},_0x571ae9={};_0x571ae9[_0x9bd9('0x32')]=_[_0x9bd9('0x4b')](db[_0x9bd9('0x45')]['rawAttributes']);_0x571ae9[_0x9bd9('0x33')]=_['keys'](_0x32812b[_0x9bd9('0x33')]);_0x571ae9[_0x9bd9('0x34')]=_[_0x9bd9('0x35')](_0x571ae9[_0x9bd9('0x32')],_0x571ae9[_0x9bd9('0x33')]);_0x4556c2[_0x9bd9('0x36')]=_[_0x9bd9('0x35')](_0x571ae9[_0x9bd9('0x32')],qs[_0x9bd9('0x37')](_0x32812b[_0x9bd9('0x33')]['fields']));_0x4556c2['attributes']=_0x4556c2[_0x9bd9('0x36')][_0x9bd9('0x38')]?_0x4556c2['attributes']:_0x571ae9[_0x9bd9('0x32')];if(_0x32812b['query'][_0x9bd9('0x4c')]){_0x4556c2[_0x9bd9('0x46')]=[{'all':!![]}];}_0x4556c2=_[_0x9bd9('0x40')]({},_0x4556c2,_0x32812b[_0x9bd9('0x44')]);return db[_0x9bd9('0x45')][_0x9bd9('0x4d')](_0x4556c2)[_0x9bd9('0x29')](handleEntityNotFound(_0x5a1f1a,null))[_0x9bd9('0x29')](respondWithResult(_0x5a1f1a,null))[_0x9bd9('0x4e')](handleError(_0x5a1f1a,null));};exports[_0x9bd9('0x4f')]=function(_0x29ccb7,_0x4056ab,_0x1d3705){return db['Plugin'][_0x9bd9('0x4d')]({'where':{'id':_0x29ccb7['params']['id']},'attributes':[_0x9bd9('0x2f'),_0x9bd9('0x7')],'raw':!![]})[_0x9bd9('0x29')](handleEntityNotFound(_0x4056ab,null))[_0x9bd9('0x29')](function(_0x39f4d2){if(_0x39f4d2){var _0x4dda2e=path['join'](config['root'],'server/files/plugins',util[_0x9bd9('0x50')]('%s.zip',path['basename'](_0x39f4d2[_0x9bd9('0x7')])));var _0x4d4c46=fs[_0x9bd9('0x51')](_0x4dda2e);var _0x990a16=archiver(_0x9bd9('0x52'),{'zlib':{'level':0x9}});_0x990a16['on'](_0x9bd9('0x53'),function(_0x5144ae){if(_0x5144ae[_0x9bd9('0x54')]===_0x9bd9('0x55')){logger[_0x9bd9('0x2d')](_0x5144ae);}else{throw new db[(_0x9bd9('0x56'))][(_0x9bd9('0x57'))](_0x9bd9('0x58'));}});_0x990a16['on']('error',function(_0x1c9f8a){throw new db['Sequelize'][(_0x9bd9('0x57'))](_0x9bd9('0x58'));});_0x990a16['pipe'](_0x4d4c46);_0x990a16[_0x9bd9('0x59')](_0x9bd9('0x5a'),{'cwd':path[_0x9bd9('0x5b')](config['root'],'server/files/plugins',path[_0x9bd9('0x5c')](_0x39f4d2[_0x9bd9('0x7')])),'ignore':[path[_0x9bd9('0x5b')](path[_0x9bd9('0x5d')](_0x39f4d2[_0x9bd9('0x7')]),_0x9bd9('0x5e')),path[_0x9bd9('0x5b')](path['basename'](_0x39f4d2[_0x9bd9('0x7')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x4d4c46['on'](_0x9bd9('0x5f'),function(){if(!fs['existsSync'](_0x4dda2e)){throw new db['Sequelize'][(_0x9bd9('0x57'))](_0x9bd9('0x60'));}return _0x4056ab[_0x9bd9('0x4f')](_0x4dda2e,util[_0x9bd9('0x50')](_0x9bd9('0x61'),path[_0x9bd9('0x5d')](_0x39f4d2['path'])),function(_0x3be836){if(_0x3be836){throw new db[(_0x9bd9('0x56'))][(_0x9bd9('0x57'))](_0x9bd9('0x62'));}fs[_0x9bd9('0x63')](_0x4dda2e);logger[_0x9bd9('0x64')]('Download\x20completed');logger['info'](_0x9bd9('0x65'));});});}return null;})[_0x9bd9('0x4e')](handleError(_0x4056ab,null));};exports[_0x9bd9('0x66')]=function(_0x3d5afa,_0x2df3b0,_0x4e9ab7){var _0x1b4cc3=path[_0x9bd9('0x5d')](_0x3d5afa[_0x9bd9('0x67')][_0x9bd9('0x68')],path['extname'](_0x3d5afa[_0x9bd9('0x67')]['filename']));var _0x7a0908=path['join'](config[_0x9bd9('0x69')],_0x9bd9('0x6a'),_0x3d5afa[_0x9bd9('0x67')][_0x9bd9('0x68')]);var _0x59df1e=path[_0x9bd9('0x5b')](config[_0x9bd9('0x69')],_0x9bd9('0x6a'),_0x1b4cc3);logger[_0x9bd9('0x64')]('Plugin\x20upload\x20filepath:\x20%s',_0x7a0908);logger['info'](_0x9bd9('0x6b'),_0x59df1e);try{fs['chmodSync'](_0x7a0908,parseInt(_0x9bd9('0x6c'),0x8));extract(_0x7a0908,{'dir':_0x59df1e},function(_0x44a002){if(_0x44a002){logger[_0x9bd9('0x2d')](_0x44a002);handleError(_0x44a002,!![]);};var _0x5290d4=fs[_0x9bd9('0x6d')](_0x59df1e);if(_0x5290d4[_0x9bd9('0x38')]>0x1){removeReferences(_0x7a0908,_0x59df1e);logger['error']('Invalid\x20plugin\x20structure');return _0x4e9ab7(new Error(_0x9bd9('0x6e')));}var _0x3f3387=fs['lstatSync'](path[_0x9bd9('0x5b')](_0x59df1e,_0x5290d4[0x0]));if(_0x3f3387[_0x9bd9('0x6f')]()){removeReferences(_0x7a0908,_0x59df1e);logger['error'](_0x9bd9('0x6e'));return _0x4e9ab7(new Error(_0x9bd9('0x6e')));}if(_0x3f3387[_0x9bd9('0x70')]()){var _0x5b87dd=fs[_0x9bd9('0x6d')](path[_0x9bd9('0x5b')](_0x59df1e,_0x5290d4[0x0]));if(_0x5b87dd[_0x9bd9('0x38')]===0x0){removeReferences(_0x7a0908,_0x59df1e);logger[_0x9bd9('0x2d')](_0x9bd9('0x6e'));return _0x4e9ab7(new Error('Invalid\x20plugin\x20structure'));}var _0x35f1fa=_0x5b87dd[_0x9bd9('0x71')](function(_0x4a9baf){return _0x4a9baf===_0x9bd9('0x72');});if(!_0x35f1fa){return _0x4e9ab7(new Error('Plugin\x20manifest\x20missing'));}var _0x22c1a6=fs[_0x9bd9('0x73')](path[_0x9bd9('0x5b')](_0x59df1e,_0x5290d4[0x0],_0x9bd9('0x72')));var _0x2134e1=JSON['parse'](_0x22c1a6);if('undefined'==typeof _0x2134e1[_0x9bd9('0x2f')]){return _0x4e9ab7(new Error(_0x9bd9('0x74')));}if('undefined'==typeof _0x2134e1[_0x9bd9('0x41')]){return _0x4e9ab7(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x2134e1[_0x9bd9('0x75')]){return _0x4e9ab7(new Error(_0x9bd9('0x76')));}if(_0x9bd9('0x22')==typeof _0x2134e1[_0x9bd9('0x77')]){return _0x4e9ab7(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x2134e1['type']===_0x9bd9('0x78')){if(_0x9bd9('0x22')==typeof _0x2134e1[_0x9bd9('0x77')][_0x9bd9('0x79')]){return _0x4e9ab7(new Error(_0x9bd9('0x7a')));}if('undefined'==typeof _0x2134e1['parameters'][_0x9bd9('0x79')]['admin']&&_0x9bd9('0x22')==typeof _0x2134e1[_0x9bd9('0x77')][_0x9bd9('0x79')][_0x9bd9('0x7b')]){return _0x4e9ab7(new Error(_0x9bd9('0x7c')));}}else if(_0x2134e1[_0x9bd9('0x41')]==='script'){if(_0x9bd9('0x22')==typeof _0x2134e1[_0x9bd9('0x77')]['scriptName']){return _0x4e9ab7(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x2134e1[_0x9bd9('0x77')][_0x9bd9('0x7d')]){return _0x4e9ab7(new Error(_0x9bd9('0x7e')));}}else{return _0x4e9ab7(new Error(_0x9bd9('0x7f')));}var _0x49017a=_0x2134e1['name'];var _0x10df9a=_0x2134e1['description'];var _0x3219e3=_0x2134e1[_0x9bd9('0x41')];var _0x279b74=_0x2134e1[_0x9bd9('0x80')]?_0x2134e1[_0x9bd9('0x80')]:_0x9bd9('0x81');var _0x5ddae9=_0x2134e1[_0x9bd9('0x82')]?_0x2134e1[_0x9bd9('0x82')]:_0x9bd9('0x83');var _0x17fab0='';var _0x42e5a2='';var _0x2ab4ea='';var _0x34aa92='';var _0x358e4c=_0x2134e1['version'];if(_0x3219e3===_0x9bd9('0x78')){if('undefined'!=typeof _0x2134e1['parameters'][_0x9bd9('0x79')][_0x9bd9('0x84')]){var _0x362e88=_0x2134e1['parameters'][_0x9bd9('0x79')][_0x9bd9('0x84')];if(!/^(f|ht)tps?:\/\//i['test'](_0x362e88)){_0x17fab0=path['join']('plugins',_0x1b4cc3,_0x5290d4[0x0],_0x362e88);}else{_0x17fab0=_0x362e88;}}else{logger[_0x9bd9('0x64')](_0x9bd9('0x85'));}if('undefined'!=typeof _0x2134e1[_0x9bd9('0x77')][_0x9bd9('0x79')][_0x9bd9('0x7b')]){var _0xb687a2=_0x2134e1[_0x9bd9('0x77')]['views'][_0x9bd9('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x9bd9('0x86')](_0xb687a2)){_0x42e5a2=path[_0x9bd9('0x5b')](_0x9bd9('0x87'),_0x1b4cc3,_0x5290d4[0x0],_0xb687a2);}else{_0x42e5a2=_0xb687a2;}}else{logger[_0x9bd9('0x64')](_0x9bd9('0x88'));}}else if(_0x3219e3===_0x9bd9('0x89')){_0x2ab4ea=_0x2134e1[_0x9bd9('0x77')][_0x9bd9('0x8a')];_0x34aa92=_0x2134e1[_0x9bd9('0x77')]['scriptPath'];if(_0x9bd9('0x22')!=typeof _0x2134e1[_0x9bd9('0x77')]['views']){if(_0x9bd9('0x22')!=typeof _0x2134e1[_0x9bd9('0x77')][_0x9bd9('0x79')][_0x9bd9('0x84')]){var _0x362e88=_0x2134e1[_0x9bd9('0x77')]['views'][_0x9bd9('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x9bd9('0x86')](_0x362e88)){_0x17fab0=path[_0x9bd9('0x5b')](_0x9bd9('0x87'),_0x1b4cc3,_0x5290d4[0x0],_0x362e88);}else{_0x17fab0=_0x362e88;}}if('undefined'!=typeof _0x2134e1[_0x9bd9('0x77')][_0x9bd9('0x79')][_0x9bd9('0x7b')]){var _0xb687a2=_0x2134e1[_0x9bd9('0x77')][_0x9bd9('0x79')][_0x9bd9('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x9bd9('0x86')](_0xb687a2)){_0x42e5a2=path[_0x9bd9('0x5b')]('plugins',_0x1b4cc3,_0x5290d4[0x0],_0xb687a2);}else{_0x42e5a2=_0xb687a2;}}}}var _0x357ec9={'name':_0x49017a,'description':_0x10df9a,'path':path[_0x9bd9('0x5b')](_0x1b4cc3,_0x5290d4[0x0]),'type':_0x3219e3,'sidebar':_0x279b74,'icon':_0x5ddae9,'adminUrl':_0x17fab0,'agentUrl':_0x42e5a2,'scriptName':_0x2ab4ea,'scriptPath':_0x34aa92,'version':_0x358e4c};removeReferences(_0x7a0908,null);return db[_0x9bd9('0x45')][_0x9bd9('0x8b')](_0x357ec9)[_0x9bd9('0x29')](function(_0x555d51){var _0x5c73eb={'role':_0x3d5afa[_0x9bd9('0x8c')][_0x9bd9('0x8d')],'userProfileId':_0x3d5afa[_0x9bd9('0x8c')][_0x9bd9('0x8e')]};if(!_0x5c73eb)throw new Error(_0x9bd9('0x8f'));if(_0x5c73eb[_0x9bd9('0x8d')]===_0x9bd9('0x90')){var _0x55ad7a=_0x555d51['get']({'plain':!![]});return db[_0x9bd9('0x91')][_0x9bd9('0x4d')]({'where':{'name':_0x9bd9('0x2a'),'userProfileId':_0x5c73eb['userProfileId']},'raw':!![]})[_0x9bd9('0x29')](function(_0x6a8fbc){if(_0x6a8fbc&&_0x6a8fbc[_0x9bd9('0x92')]===0x0){return db[_0x9bd9('0x2b')][_0x9bd9('0x8b')]({'name':_0x55ad7a[_0x9bd9('0x2f')],'resourceId':_0x55ad7a['id'],'type':_0x6a8fbc[_0x9bd9('0x2f')],'sectionId':_0x6a8fbc['id']},{})[_0x9bd9('0x29')](function(){return _0x555d51;});}else{return _0x555d51;}})[_0x9bd9('0x4e')](function(_0x35bb91){logger[_0x9bd9('0x2d')](_0x9bd9('0x93'),_0x35bb91);throw _0x35bb91;});}return _0x555d51;})[_0x9bd9('0x29')](respondWithResult(_0x2df3b0,null))['catch'](handleError(_0x2df3b0,null));}});}catch(_0x324ef4){_0x2df3b0['status'](0x1f4)[_0x9bd9('0x94')](_0x324ef4);}};function removeReferences(_0x501c3f,_0x1ae361){try{if(_0x501c3f){fs[_0x9bd9('0x63')](_0x501c3f);logger[_0x9bd9('0x64')](_0x9bd9('0x95'));}if(_0x1ae361){rimraf(_0x1ae361,function(){});logger[_0x9bd9('0x64')](_0x9bd9('0x96'));}}catch(_0x568ef7){logger[_0x9bd9('0x2d')](_0x568ef7);}}exports[_0x9bd9('0x28')]=function(_0x4c86f4,_0x5baa3f,_0x397de3){return db[_0x9bd9('0x45')]['find']({'where':{'id':_0x4c86f4['params']['id']}})[_0x9bd9('0x29')](handleEntityNotFound(_0x5baa3f,null))[_0x9bd9('0x29')](saveUpdates(_0x4c86f4['body'],null))['then'](respondWithResult(_0x5baa3f,null))[_0x9bd9('0x4e')](handleError(_0x5baa3f,null));};exports['delete']=function(_0x3eff05,_0x3c49d2,_0x417f93){return db['Plugin'][_0x9bd9('0x4d')]({'where':{'id':_0x3eff05[_0x9bd9('0x4a')]['id']}})['then'](function(_0x13a54a){if(_0x13a54a){return _0x13a54a[_0x9bd9('0x97')]();}})[_0x9bd9('0x29')](function(_0x2e565e){rimraf(path[_0x9bd9('0x5b')](config[_0x9bd9('0x69')],_0x9bd9('0x6a'),path['dirname'](_0x2e565e['path'])),function(){});return _0x2e565e;})[_0x9bd9('0x29')](handleEntityNotFound(_0x3c49d2,null))[_0x9bd9('0x29')](respondWithStatusCode(_0x3c49d2,null))[_0x9bd9('0x4e')](handleError(_0x3c49d2,null));};exports['webhookGet']=function(_0x1b111b,_0x1fd8f2,_0x212183){return BPromise[_0x9bd9('0x98')]()[_0x9bd9('0x29')](function(){if(!_0x1b111b[_0x9bd9('0x33')][_0x9bd9('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1b111b['query'][_0x9bd9('0x99')]){throw new Error(_0x9bd9('0x9a'));}var _0x293779=_0x1b111b[_0x9bd9('0x33')]['hostname']?_0x1b111b[_0x9bd9('0x33')]['hostname']+':'+_0x1b111b[_0x9bd9('0x33')][_0x9bd9('0x99')]:'http://localhost:'+_0x1b111b[_0x9bd9('0x33')][_0x9bd9('0x99')];var _0x4bf631=_0x1b111b[_0x9bd9('0x33')]['json']?_0x1b111b[_0x9bd9('0x33')][_0x9bd9('0x20')]:!![];var _0x31e74a=_0x1b111b[_0x9bd9('0x33')]['encoding']?_0x1b111b[_0x9bd9('0x33')][_0x9bd9('0x9b')]:null;var _0x5b9ef0={'method':_0x1b111b[_0x9bd9('0x9c')],'uri':util[_0x9bd9('0x50')](_0x9bd9('0x9d'),_0x293779,_0x1b111b['query']['path']),'json':_0x4bf631,'resolveWithFullResponse':!![],'encoding':_0x31e74a,'qs':_0x1b111b[_0x9bd9('0x33')]};if(_0x1b111b[_0x9bd9('0x9e')]){_0x5b9ef0[_0x9bd9('0x9e')]=_0x1b111b[_0x9bd9('0x9e')];if(_0x5b9ef0['headers'][_0x9bd9('0x9f')]){delete _0x5b9ef0[_0x9bd9('0x9e')][_0x9bd9('0x9f')];}}if(_0x5b9ef0[_0x9bd9('0x9e')][_0x9bd9('0xa0')]){delete _0x5b9ef0['headers'][_0x9bd9('0xa0')];}return rp(_0x5b9ef0);})[_0x9bd9('0x29')](function(_0x568af2){if(_0x568af2){_0x1fd8f2[_0x9bd9('0x24')](_0x568af2[_0x9bd9('0x9e')]);logger[_0x9bd9('0x64')](_0x568af2[_0x9bd9('0x8c')]);if(_[_0x9bd9('0xa1')](_0x1b111b[_0x9bd9('0x33')]['path'],_0x9bd9('0x4f'))&&_0x568af2[_0x9bd9('0xa2')]==0x1f4){return _0x1fd8f2[_0x9bd9('0x1e')](_0x568af2[_0x9bd9('0xa2')]);}else{return _0x1fd8f2['status'](_0x568af2[_0x9bd9('0xa2')])[_0x9bd9('0x94')](_0x568af2[_0x9bd9('0x8c')]);}}else{return _0x1fd8f2[_0x9bd9('0x1e')](0xc8);}})[_0x9bd9('0x4e')](handleError(_0x1fd8f2,null));};exports['webhookPost']=function(_0x1f6676,_0x2a2b44,_0x3ae6c1){return BPromise[_0x9bd9('0x98')]()[_0x9bd9('0x29')](function(){if(!_0x1f6676['query'][_0x9bd9('0x7')]){throw new Error(_0x9bd9('0xa3'));}if(!_0x1f6676[_0x9bd9('0x33')][_0x9bd9('0x99')]){throw new Error(_0x9bd9('0x9a'));}var _0x32e923=_0x1f6676[_0x9bd9('0x33')][_0x9bd9('0xa4')]?_0x1f6676[_0x9bd9('0x33')][_0x9bd9('0xa4')]+':'+_0x1f6676['query'][_0x9bd9('0x99')]:_0x9bd9('0xa5')+_0x1f6676[_0x9bd9('0x33')][_0x9bd9('0x99')];var _0x3712f5=_0x1f6676[_0x9bd9('0x33')][_0x9bd9('0x20')]?_0x1f6676[_0x9bd9('0x33')][_0x9bd9('0x20')]:!![];var _0x46bd58=_0x1f6676[_0x9bd9('0x33')][_0x9bd9('0x9b')]?_0x1f6676[_0x9bd9('0x33')][_0x9bd9('0x9b')]:null;var _0x1da0e5={'method':_0x1f6676[_0x9bd9('0x9c')],'uri':util[_0x9bd9('0x50')](_0x9bd9('0x9d'),_0x32e923,_0x1f6676[_0x9bd9('0x33')][_0x9bd9('0x7')]),'json':_0x3712f5,'resolveWithFullResponse':!![],'encoding':_0x46bd58,'body':_0x1f6676[_0x9bd9('0x8c')]};if(_0x1f6676[_0x9bd9('0x9e')]){_0x1da0e5[_0x9bd9('0x9e')]=_0x1f6676[_0x9bd9('0x9e')];if(_0x1da0e5['headers'][_0x9bd9('0x9f')]){delete _0x1da0e5[_0x9bd9('0x9e')][_0x9bd9('0x9f')];}}if(_0x1da0e5[_0x9bd9('0x9e')][_0x9bd9('0xa0')]){delete _0x1da0e5[_0x9bd9('0x9e')][_0x9bd9('0xa0')];}return rp(_0x1da0e5);})[_0x9bd9('0x29')](function(_0x7906a9){if(_0x7906a9){_0x2a2b44['set'](_0x7906a9['headers']);logger[_0x9bd9('0x64')](_0x7906a9[_0x9bd9('0x8c')]);return _0x2a2b44[_0x9bd9('0x1f')](_0x7906a9[_0x9bd9('0xa2')])[_0x9bd9('0x94')](_0x7906a9[_0x9bd9('0x8c')]);}else{return _0x2a2b44[_0x9bd9('0x1e')](0xc8);}})[_0x9bd9('0x4e')](handleError(_0x2a2b44,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index d868bc4..2d3d43d 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 _0x25e7=['emit','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove'];(function(_0x27e3d0,_0x250e2d){var _0x7e4c58=function(_0x26a5d9){while(--_0x26a5d9){_0x27e3d0['push'](_0x27e3d0['shift']());}};_0x7e4c58(++_0x250e2d);}(_0x25e7,0x1d6));var _0x725e=function(_0x3421ac,_0x3228b5){_0x3421ac=_0x3421ac-0x0;var _0x16c2d2=_0x25e7[_0x3421ac];return _0x16c2d2;};'use strict';var EventEmitter=require(_0x725e('0x0'));var Plugin=require(_0x725e('0x1'))['db'][_0x725e('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x725e('0x3')](0x0);var events={'afterCreate':_0x725e('0x4'),'afterUpdate':_0x725e('0x5'),'afterDestroy':_0x725e('0x6')};function emitEvent(_0x339c77){return function(_0x3d7893,_0x3da706,_0x493364){PluginEvents['emit'](_0x339c77+':'+_0x3d7893['id'],_0x3d7893);PluginEvents[_0x725e('0x7')](_0x339c77,_0x3d7893);_0x493364(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x725e('0x8')]=PluginEvents; \ No newline at end of file +var _0x77e6=['../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x2c5d18,_0x2ad80e){var _0x3fe914=function(_0x17f67d){while(--_0x17f67d){_0x2c5d18['push'](_0x2c5d18['shift']());}};_0x3fe914(++_0x2ad80e);}(_0x77e6,0x1a6));var _0x677e=function(_0x288930,_0x20dbf4){_0x288930=_0x288930-0x0;var _0x3407a9=_0x77e6[_0x288930];return _0x3407a9;};'use strict';var EventEmitter=require(_0x677e('0x0'));var Plugin=require(_0x677e('0x1'))['db'][_0x677e('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x677e('0x3')](0x0);var events={'afterCreate':_0x677e('0x4'),'afterUpdate':_0x677e('0x5'),'afterDestroy':_0x677e('0x6')};function emitEvent(_0x186923){return function(_0x50231c,_0x2f0307,_0x2560a6){PluginEvents['emit'](_0x186923+':'+_0x50231c['id'],_0x50231c);PluginEvents[_0x677e('0x7')](_0x186923,_0x50231c);_0x2560a6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x677e('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 0a0e48d..0bde42e 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 _0x84ab=['request-promise','path','../../config/environment','./plugin.attributes','exports','Plugin','lodash','util','../../config/logger','api','moment'];(function(_0x71afe7,_0x324570){var _0x3eae4d=function(_0x4d4a80){while(--_0x4d4a80){_0x71afe7['push'](_0x71afe7['shift']());}};_0x3eae4d(++_0x324570);}(_0x84ab,0x12f));var _0xb84a=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x84ab[_0x24f31b];return _0x488401;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c5a=['define','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x2c6274,_0x3df7d8){var _0x4b2c24=function(_0x3a235c){while(--_0x3a235c){_0x2c6274['push'](_0x2c6274['shift']());}};_0x4b2c24(++_0x3df7d8);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x5eb388,_0x39738f){_0x5eb388=_0x5eb388-0x0;var _0x309b60=_0x9c5a[_0x5eb388];return _0x309b60;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./plugin.attributes');module[_0xa9c5('0x8')]=function(_0x4d9c7a,_0x394d84){return _0x4d9c7a[_0xa9c5('0x9')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 417a869..9e60fc2 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 _0xd595=['register','then','Plugin,\x20%s,\x20%s','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreatePlugin','Plugin','create','options','raw','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','http','localhost','./plugin.socket'];(function(_0x29e6dc,_0x3cd4b8){var _0x21c954=function(_0x466522){while(--_0x466522){_0x29e6dc['push'](_0x29e6dc['shift']());}};_0x21c954(++_0x3cd4b8);}(_0xd595,0x12e));var _0x5d59=function(_0x3d59c4,_0x3bf360){_0x3d59c4=_0x3d59c4-0x0;var _0x1b711f=_0xd595[_0x3d59c4];return _0x1b711f;};'use strict';var _=require(_0x5d59('0x0'));var util=require(_0x5d59('0x1'));var moment=require(_0x5d59('0x2'));var BPromise=require('bluebird');var rs=require(_0x5d59('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d59('0x4'))['db'];var utils=require(_0x5d59('0x5'));var logger=require(_0x5d59('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5d59('0x7')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x5d59('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5d59('0x9'))[_0x5d59('0xa')](socket);function respondWithRpcPromise(_0x30a88c,_0x550cc7,_0x448434){return new BPromise(function(_0xfa9234,_0x5a7751){return client['request'](_0x30a88c,_0x448434)[_0x5d59('0xb')](function(_0x3244ea){logger['info'](_0x5d59('0xc'),_0x550cc7,'request\x20sent');logger['debug'](_0x5d59('0xd'),_0x550cc7,_0x5d59('0xe'),JSON[_0x5d59('0xf')](_0x3244ea));if(_0x3244ea['error']){if(_0x3244ea[_0x5d59('0x10')][_0x5d59('0x11')]===0x1f4){logger[_0x5d59('0x10')]('Plugin,\x20%s,\x20%s',_0x550cc7,_0x3244ea['error'][_0x5d59('0x12')]);return _0x5a7751(_0x3244ea[_0x5d59('0x10')][_0x5d59('0x12')]);}logger[_0x5d59('0x10')]('Plugin,\x20%s,\x20%s',_0x550cc7,_0x3244ea[_0x5d59('0x10')][_0x5d59('0x12')]);return _0xfa9234(_0x3244ea[_0x5d59('0x10')]['message']);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x550cc7,'request\x20sent');_0xfa9234(_0x3244ea[_0x5d59('0x13')][_0x5d59('0x12')]);}})['catch'](function(_0x372127){logger[_0x5d59('0x10')](_0x5d59('0xc'),_0x550cc7,_0x372127);_0x5a7751(_0x372127);});});}exports[_0x5d59('0x14')]=function(_0x2a637b){var _0x2c8600=this;return new Promise(function(_0xc42a2b,_0x4e00fb){return db[_0x5d59('0x15')][_0x5d59('0x16')](_0x2a637b['body'],{'raw':_0x2a637b[_0x5d59('0x17')]?_0x2a637b['options'][_0x5d59('0x18')]===undefined?!![]:![]:!![]})[_0x5d59('0xb')](function(_0x1b8ff9){logger['info']('CreatePlugin',_0x2a637b);logger[_0x5d59('0x19')](_0x5d59('0x14'),_0x2a637b,JSON['stringify'](_0x1b8ff9));_0xc42a2b(_0x1b8ff9);})['catch'](function(_0x48bc0b){logger[_0x5d59('0x10')](_0x5d59('0x14'),_0x48bc0b[_0x5d59('0x12')],_0x2a637b);_0x4e00fb(_0x2c8600[_0x5d59('0x10')](0x1f4,_0x48bc0b['message']));});});}; \ No newline at end of file +var _0xe488=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreatePlugin','Plugin','create','body','options','then','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe488,0x93));var _0x8e48=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe488[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x8e48('0x0'));var util=require(_0x8e48('0x1'));var moment=require('moment');var BPromise=require(_0x8e48('0x2'));var rs=require(_0x8e48('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e48('0x4'))['db'];var utils=require(_0x8e48('0x5'));var logger=require('../../config/logger')(_0x8e48('0x6'));var config=require(_0x8e48('0x7'));var jayson=require(_0x8e48('0x8'));var client=jayson[_0x8e48('0x9')][_0x8e48('0xa')]({'port':0x232a});config[_0x8e48('0xb')]=_[_0x8e48('0xc')](config['redis'],{'host':_0x8e48('0xd'),'port':0x18eb});var socket=require(_0x8e48('0xe'))(new Redis(config[_0x8e48('0xb')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x48137e,_0x42b0e3,_0x9a505b){return new BPromise(function(_0xcaa980,_0x4606b6){return client[_0x8e48('0xf')](_0x48137e,_0x9a505b)['then'](function(_0x3e1384){logger[_0x8e48('0x10')](_0x8e48('0x11'),_0x42b0e3,_0x8e48('0x12'));logger['debug'](_0x8e48('0x13'),_0x42b0e3,_0x8e48('0x12'),JSON['stringify'](_0x3e1384));if(_0x3e1384[_0x8e48('0x14')]){if(_0x3e1384[_0x8e48('0x14')]['code']===0x1f4){logger[_0x8e48('0x14')](_0x8e48('0x11'),_0x42b0e3,_0x3e1384[_0x8e48('0x14')][_0x8e48('0x15')]);return _0x4606b6(_0x3e1384[_0x8e48('0x14')][_0x8e48('0x15')]);}logger[_0x8e48('0x14')](_0x8e48('0x11'),_0x42b0e3,_0x3e1384[_0x8e48('0x14')][_0x8e48('0x15')]);return _0xcaa980(_0x3e1384[_0x8e48('0x14')][_0x8e48('0x15')]);}else{logger[_0x8e48('0x10')](_0x8e48('0x11'),_0x42b0e3,_0x8e48('0x12'));_0xcaa980(_0x3e1384[_0x8e48('0x16')][_0x8e48('0x15')]);}})[_0x8e48('0x17')](function(_0x3d0bbf){logger[_0x8e48('0x14')](_0x8e48('0x11'),_0x42b0e3,_0x3d0bbf);_0x4606b6(_0x3d0bbf);});});}exports[_0x8e48('0x18')]=function(_0xcf86d8){var _0x2fa7da=this;return new Promise(function(_0x4372c0,_0x5502f0){return db[_0x8e48('0x19')][_0x8e48('0x1a')](_0xcf86d8[_0x8e48('0x1b')],{'raw':_0xcf86d8[_0x8e48('0x1c')]?_0xcf86d8[_0x8e48('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x8e48('0x1d')](function(_0x212247){logger[_0x8e48('0x10')](_0x8e48('0x18'),_0xcf86d8);logger['debug'](_0x8e48('0x18'),_0xcf86d8,JSON[_0x8e48('0x1e')](_0x212247));_0x4372c0(_0x212247);})['catch'](function(_0x13aba1){logger[_0x8e48('0x14')]('CreatePlugin',_0x13aba1[_0x8e48('0x15')],_0xcf86d8);_0x5502f0(_0x2fa7da['error'](0x1f4,_0x13aba1[_0x8e48('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 568a11e..0e41681 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 _0xbada=['register','length','./plugin.events','save','update','removeListener'];(function(_0x1082b2,_0x4eeff6){var _0x22d4c2=function(_0x2199c8){while(--_0x2199c8){_0x1082b2['push'](_0x1082b2['shift']());}};_0x22d4c2(++_0x4eeff6);}(_0xbada,0x18e));var _0xabad=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xbada[_0x565ed7];return _0x183ad7;};'use strict';var PluginEvents=require(_0xabad('0x0'));var events=[_0xabad('0x1'),'remove',_0xabad('0x2')];function createListener(_0x4ae65a,_0x5c1aa2){return function(_0x51223c){_0x5c1aa2['emit'](_0x4ae65a,_0x51223c);};}function removeListener(_0x218a4f,_0x58c961){return function(){PluginEvents[_0xabad('0x3')](_0x218a4f,_0x58c961);};}exports[_0xabad('0x4')]=function(_0x1aaf3){for(var _0x204186=0x0,_0x2d3002=events[_0xabad('0x5')];_0x204186<_0x2d3002;_0x204186++){var _0x4b2fab=events[_0x204186];var _0x4902b1=createListener('plugin:'+_0x4b2fab,_0x1aaf3);PluginEvents['on'](_0x4b2fab,_0x4902b1);}}; \ No newline at end of file +var _0x531a=['update','emit','register','length','./plugin.events','save','remove'];(function(_0x309afc,_0x440814){var _0x3081ef=function(_0x4b6033){while(--_0x4b6033){_0x309afc['push'](_0x309afc['shift']());}};_0x3081ef(++_0x440814);}(_0x531a,0x100));var _0xa531=function(_0x4caea4,_0x4f02e4){_0x4caea4=_0x4caea4-0x0;var _0x207c7c=_0x531a[_0x4caea4];return _0x207c7c;};'use strict';var PluginEvents=require(_0xa531('0x0'));var events=[_0xa531('0x1'),_0xa531('0x2'),_0xa531('0x3')];function createListener(_0x2a5348,_0x3ccd8f){return function(_0x3e8e4b){_0x3ccd8f[_0xa531('0x4')](_0x2a5348,_0x3e8e4b);};}function removeListener(_0x28af07,_0x27609d){return function(){PluginEvents['removeListener'](_0x28af07,_0x27609d);};}exports[_0xa531('0x5')]=function(_0x4ec419){for(var _0x266b43=0x0,_0x4446b9=events[_0xa531('0x6')];_0x266b43<_0x4446b9;_0x266b43++){var _0x286dc7=events[_0x266b43];var _0x3b68a7=createListener('plugin:'+_0x286dc7,_0x4ec419);PluginEvents['on'](_0x286dc7,_0x3b68a7);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index b5615bd..eb5a35c 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 _0x58e0=['index','/:id','show','post','create','put','update','delete','exports','express','../../components/auth/service','./pm2.controller','isAuthenticated'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0x58e0,0x14e));var _0x058e=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x58e0[_0x2aea9e];return _0x430b92;};'use strict';var express=require(_0x058e('0x0'));var router=express['Router']();var auth=require(_0x058e('0x1'));var controller=require(_0x058e('0x2'));router['get']('/',auth[_0x058e('0x3')](),controller[_0x058e('0x4')]);router['get'](_0x058e('0x5'),auth[_0x058e('0x3')](),controller[_0x058e('0x6')]);router[_0x058e('0x7')]('/',auth['isAuthenticated'](),controller[_0x058e('0x8')]);router[_0x058e('0x9')]('/:id',auth[_0x058e('0x3')](),controller[_0x058e('0xa')]);router[_0x058e('0xb')](_0x058e('0x5'),auth['isAuthenticated'](),controller['destroy']);module[_0x058e('0xc')]=router; \ No newline at end of file +var _0x0cee=['update','destroy','exports','express','Router','./pm2.controller','get','isAuthenticated','/:id','show','put'];(function(_0x4d1b29,_0x14b6f5){var _0x5f3431=function(_0xd785cc){while(--_0xd785cc){_0x4d1b29['push'](_0x4d1b29['shift']());}};_0x5f3431(++_0x14b6f5);}(_0x0cee,0x163));var _0xe0ce=function(_0x3b149c,_0x23c09b){_0x3b149c=_0x3b149c-0x0;var _0x514965=_0x0cee[_0x3b149c];return _0x514965;};'use strict';var express=require(_0xe0ce('0x0'));var router=express[_0xe0ce('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xe0ce('0x2'));router[_0xe0ce('0x3')]('/',auth[_0xe0ce('0x4')](),controller['index']);router[_0xe0ce('0x3')](_0xe0ce('0x5'),auth[_0xe0ce('0x4')](),controller[_0xe0ce('0x6')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe0ce('0x7')](_0xe0ce('0x5'),auth['isAuthenticated'](),controller[_0xe0ce('0x8')]);router['delete'](_0xe0ce('0x5'),auth[_0xe0ce('0x4')](),controller[_0xe0ce('0x9')]);module[_0xe0ce('0xa')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 5a1c5d2..ce796dc 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 _0xa7f3=['express','length','show','describe','params','catch','create','body','script','join','../../files/plugins','cwd','chdir','dirname','send','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/logger','api','path','exec','bluebird','status','json','error','stack','name','info','list','then','reject'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa7f3,0x89));var _0x3a7f=function(_0x132ff7,_0x40be61){_0x132ff7=_0x132ff7-0x0;var _0x167ba4=_0xa7f3[_0x132ff7];return _0x167ba4;};'use strict';var _=require(_0x3a7f('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x3a7f('0x1'))(_0x3a7f('0x2'));var path=require(_0x3a7f('0x3'));var exec=require('child_process')[_0x3a7f('0x4')];var BPromise=require(_0x3a7f('0x5'));function handleEntityNotFound(_0x3b2e7f,_0x2aa67a){return function(_0x1794fc){if(!_0x1794fc){_0x3b2e7f['sendStatus'](0x194);;}return _0x1794fc;};}function respondWithResult(_0x32bcdf,_0xafee33){_0xafee33=_0xafee33||0xc8;return function(_0x52ecac){if(_0x52ecac){return _0x32bcdf[_0x3a7f('0x6')](_0xafee33)[_0x3a7f('0x7')](_0x52ecac);}return null;};}function handleError(_0x23f126,_0x11e509){_0x11e509=_0x11e509||0x1f4;return function(_0x110b58){logger[_0x3a7f('0x8')](_0x110b58[_0x3a7f('0x9')]);if(_0x110b58[_0x3a7f('0xa')]){delete _0x110b58[_0x3a7f('0xa')];}_0x23f126[_0x3a7f('0x6')](_0x11e509)['send'](_0x110b58);};}function execChildProcess(){return new BPromise(function(_0x310f5f,_0x3ae94c){exec('npm\x20install',function(_0x507c64,_0x3883b8,_0x39e75d){logger['info'](_0x3883b8);logger[_0x3a7f('0xb')](_0x39e75d);if(_0x507c64){logger[_0x3a7f('0x8')](_0x507c64);return _0x3ae94c(_0x507c64);}return _0x310f5f(_0x3883b8);});});}exports['index']=function(_0x4abad9,_0x3bb601){return pm2[_0x3a7f('0xc')]()[_0x3a7f('0xd')](function(_0x1055ba){if(_0x1055ba){var _0x4807c5=_[_0x3a7f('0xe')](_0x1055ba,function(_0x5d61b9){return _0x5d61b9[_0x3a7f('0xa')]===_0x3a7f('0xf')||_0x5d61b9[_0x3a7f('0xa')]==='motion2';});return{'rows':_0x4807c5,'count':_0x4807c5[_0x3a7f('0x10')]};}return null;})[_0x3a7f('0xd')](respondWithResult(_0x3bb601,null))['catch'](handleError(_0x3bb601,null));};exports[_0x3a7f('0x11')]=function(_0x4c1bfc,_0x3d1be6){return pm2[_0x3a7f('0x12')](_0x4c1bfc[_0x3a7f('0x13')]['id'])['then'](respondWithResult(_0x3d1be6,null))[_0x3a7f('0xd')](handleEntityNotFound(_0x3d1be6,null))[_0x3a7f('0x14')](handleError(_0x3d1be6,null));};exports[_0x3a7f('0x15')]=function(_0x58f96f,_0x1d4caa){if(_0x58f96f[_0x3a7f('0x16')][_0x3a7f('0xa')]&&_0x58f96f['body'][_0x3a7f('0x17')]){var _0x4b2ef1=path[_0x3a7f('0x18')](__dirname,_0x3a7f('0x19'),_0x58f96f[_0x3a7f('0x16')][_0x3a7f('0x17')]);var _0x377ec8=process[_0x3a7f('0x1a')]();process[_0x3a7f('0x1b')](path[_0x3a7f('0x1c')](_0x4b2ef1));return execChildProcess()['then'](function(_0x1ce6a5){process[_0x3a7f('0x1b')](_0x377ec8);return pm2['start']({'name':_0x58f96f['body']['name'],'script':_0x4b2ef1});})[_0x3a7f('0xd')](function(_0x268de0){pm2['dump']();return _0x268de0[0x0];})['then'](respondWithResult(_0x1d4caa,0xc9))[_0x3a7f('0x14')](handleError(_0x1d4caa,null));}else{return _0x1d4caa[_0x3a7f('0x6')](0x1f4)[_0x3a7f('0x1d')]({'message':_0x3a7f('0x1e')});}};exports['update']=function(_0x9c38df,_0x5d931e){if(_0x9c38df[_0x3a7f('0x16')]['id']){delete _0x9c38df[_0x3a7f('0x16')]['id'];}var _0x1c3429={'online':_0x3a7f('0x1f'),'stopped':_0x3a7f('0x20')};if(_0x1c3429[_0x3a7f('0x21')](_0x9c38df[_0x3a7f('0x16')][_0x3a7f('0x6')])){return pm2[_0x1c3429[_0x9c38df[_0x3a7f('0x16')][_0x3a7f('0x6')]]](_0x9c38df[_0x3a7f('0x13')]['id'])[_0x3a7f('0xd')](respondWithResult(_0x5d931e,0xc8))[_0x3a7f('0x14')](handleError(_0x5d931e,null));}else{return _0x5d931e['status'](0x1f4)[_0x3a7f('0x1d')]({'message':_0x3a7f('0x22')});}};exports[_0x3a7f('0x23')]=function(_0x2c828b,_0x2ceb29){if(_0x2c828b[_0x3a7f('0x16')]['id']){delete _0x2c828b[_0x3a7f('0x16')]['id'];}if(_0x2c828b[_0x3a7f('0x13')]['id']){return pm2[_0x3a7f('0x24')](_0x2c828b[_0x3a7f('0x13')]['id'])[_0x3a7f('0xd')](function(_0x4b8360){pm2['dump']();return _0x4b8360[0x0];})['then'](respondWithResult(_0x2ceb29,null))[_0x3a7f('0x14')](handleError(_0x2ceb29,null));}else{return _0x2ceb29[_0x3a7f('0x6')](0x1f4)['send']({'message':_0x3a7f('0x25')});}}; \ No newline at end of file +var _0x8a40=['stack','name','send','npm\x20install','info','list','then','reject','express','length','params','catch','create','body','join','script','cwd','chdir','dirname','dump','restart','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','status','json','error'];(function(_0x1aa503,_0x2a9e5f){var _0x14cc25=function(_0x223ccf){while(--_0x223ccf){_0x1aa503['push'](_0x1aa503['shift']());}};_0x14cc25(++_0x2a9e5f);}(_0x8a40,0x1b1));var _0x08a4=function(_0x120ee1,_0x4db58e){_0x120ee1=_0x120ee1-0x0;var _0x38f462=_0x8a40[_0x120ee1];return _0x38f462;};'use strict';var _=require(_0x08a4('0x0'));var pm2=require(_0x08a4('0x1'));var logger=require(_0x08a4('0x2'))(_0x08a4('0x3'));var path=require(_0x08a4('0x4'));var exec=require(_0x08a4('0x5'))[_0x08a4('0x6')];var BPromise=require(_0x08a4('0x7'));function handleEntityNotFound(_0x56d342,_0x549202){return function(_0x417503){if(!_0x417503){_0x56d342['sendStatus'](0x194);;}return _0x417503;};}function respondWithResult(_0x206ea6,_0x17c773){_0x17c773=_0x17c773||0xc8;return function(_0x34443f){if(_0x34443f){return _0x206ea6[_0x08a4('0x8')](_0x17c773)[_0x08a4('0x9')](_0x34443f);}return null;};}function handleError(_0x397589,_0x20595b){_0x20595b=_0x20595b||0x1f4;return function(_0x3e0303){logger[_0x08a4('0xa')](_0x3e0303[_0x08a4('0xb')]);if(_0x3e0303[_0x08a4('0xc')]){delete _0x3e0303[_0x08a4('0xc')];}_0x397589[_0x08a4('0x8')](_0x20595b)[_0x08a4('0xd')](_0x3e0303);};}function execChildProcess(){return new BPromise(function(_0x377b08,_0x204070){exec(_0x08a4('0xe'),function(_0x1d153d,_0x121686,_0x76110e){logger[_0x08a4('0xf')](_0x121686);logger['info'](_0x76110e);if(_0x1d153d){logger[_0x08a4('0xa')](_0x1d153d);return _0x204070(_0x1d153d);}return _0x377b08(_0x121686);});});}exports['index']=function(_0x48d5db,_0x2dfd0e){return pm2[_0x08a4('0x10')]()[_0x08a4('0x11')](function(_0x31b414){if(_0x31b414){var _0xefbc5e=_[_0x08a4('0x12')](_0x31b414,function(_0x57da72){return _0x57da72['name']===_0x08a4('0x13')||_0x57da72['name']==='motion2';});return{'rows':_0xefbc5e,'count':_0xefbc5e[_0x08a4('0x14')]};}return null;})[_0x08a4('0x11')](respondWithResult(_0x2dfd0e,null))['catch'](handleError(_0x2dfd0e,null));};exports['show']=function(_0x232cf6,_0x128141){return pm2['describe'](_0x232cf6[_0x08a4('0x15')]['id'])[_0x08a4('0x11')](respondWithResult(_0x128141,null))[_0x08a4('0x11')](handleEntityNotFound(_0x128141,null))[_0x08a4('0x16')](handleError(_0x128141,null));};exports[_0x08a4('0x17')]=function(_0x567f1e,_0x1ca1f7){if(_0x567f1e[_0x08a4('0x18')][_0x08a4('0xc')]&&_0x567f1e[_0x08a4('0x18')]['script']){var _0x258837=path[_0x08a4('0x19')](__dirname,'../../files/plugins',_0x567f1e[_0x08a4('0x18')][_0x08a4('0x1a')]);var _0xc756c8=process[_0x08a4('0x1b')]();process[_0x08a4('0x1c')](path[_0x08a4('0x1d')](_0x258837));return execChildProcess()[_0x08a4('0x11')](function(_0x1da345){process[_0x08a4('0x1c')](_0xc756c8);return pm2['start']({'name':_0x567f1e['body'][_0x08a4('0xc')],'script':_0x258837});})[_0x08a4('0x11')](function(_0x536d46){pm2[_0x08a4('0x1e')]();return _0x536d46[0x0];})[_0x08a4('0x11')](respondWithResult(_0x1ca1f7,0xc9))[_0x08a4('0x16')](handleError(_0x1ca1f7,null));}else{return _0x1ca1f7[_0x08a4('0x8')](0x1f4)[_0x08a4('0xd')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x1a9d14,_0x5adf81){if(_0x1a9d14[_0x08a4('0x18')]['id']){delete _0x1a9d14[_0x08a4('0x18')]['id'];}var _0x543500={'online':_0x08a4('0x1f'),'stopped':_0x08a4('0x20')};if(_0x543500['hasOwnProperty'](_0x1a9d14['body']['status'])){return pm2[_0x543500[_0x1a9d14[_0x08a4('0x18')][_0x08a4('0x8')]]](_0x1a9d14['params']['id'])[_0x08a4('0x11')](respondWithResult(_0x5adf81,0xc8))[_0x08a4('0x16')](handleError(_0x5adf81,null));}else{return _0x5adf81[_0x08a4('0x8')](0x1f4)[_0x08a4('0xd')]({'message':_0x08a4('0x21')});}};exports[_0x08a4('0x22')]=function(_0x4900b0,_0x55bd45){if(_0x4900b0['body']['id']){delete _0x4900b0['body']['id'];}if(_0x4900b0[_0x08a4('0x15')]['id']){return pm2[_0x08a4('0x23')](_0x4900b0[_0x08a4('0x15')]['id'])['then'](function(_0x50ce04){pm2['dump']();return _0x50ce04[0x0];})['then'](respondWithResult(_0x55bd45,null))['catch'](handleError(_0x55bd45,null));}else{return _0x55bd45[_0x08a4('0x8')](0x1f4)[_0x08a4('0xd')]({'message':_0x08a4('0x24')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 62b97f4..5425846 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 _0x92d7=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x92d7,0x17b));var _0x792d=function(_0x42a2e8,_0x97cc26){_0x42a2e8=_0x42a2e8-0x0;var _0x30ec84=_0x92d7[_0x42a2e8];return _0x30ec84;};'use strict';var multer=require(_0x792d('0x0'));var util=require('util');var path=require(_0x792d('0x1'));var timeout=require(_0x792d('0x2'));var express=require(_0x792d('0x3'));var router=express[_0x792d('0x4')]();var fs_extra=require(_0x792d('0x5'));var auth=require(_0x792d('0x6'));var interaction=require(_0x792d('0x7'));var config=require(_0x792d('0x8'));module[_0x792d('0x9')]=router; \ No newline at end of file +var _0xa5dd=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4d7a70,_0x2d3bfa){var _0x3aafbb=function(_0x43fbf2){while(--_0x43fbf2){_0x4d7a70['push'](_0x4d7a70['shift']());}};_0x3aafbb(++_0x2d3bfa);}(_0xa5dd,0x101));var _0xda5d=function(_0x1bbd44,_0x28cdb0){_0x1bbd44=_0x1bbd44-0x0;var _0x464a9f=_0xa5dd[_0x1bbd44];return _0x464a9f;};'use strict';var multer=require(_0xda5d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xda5d('0x1'));var express=require(_0xda5d('0x2'));var router=express[_0xda5d('0x3')]();var fs_extra=require(_0xda5d('0x4'));var auth=require(_0xda5d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xda5d('0x6'));module[_0xda5d('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index a36cbc4..98e058e 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 _0x1603=['DATE','STRING','sequelize','exports'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x1603,0x136));var _0x3160=function(_0x4b1475,_0x2912a3){_0x4b1475=_0x4b1475-0x0;var _0x3457d0=_0x1603[_0x4b1475];return _0x3457d0;};'use strict';var Sequelize=require(_0x3160('0x0'));module[_0x3160('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x3160('0x2')]},'uniqueid':{'type':Sequelize[_0x3160('0x3')]},'starttime':{'type':Sequelize[_0x3160('0x2')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x3160('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x222b=['STRING','sequelize','exports','DATE'];(function(_0x555169,_0x154642){var _0x10c19e=function(_0x2174e3){while(--_0x2174e3){_0x555169['push'](_0x555169['shift']());}};_0x10c19e(++_0x154642);}(_0x222b,0x1c9));var _0xb222=function(_0x26a810,_0x247776){_0x26a810=_0x26a810-0x0;var _0x4758a3=_0x222b[_0x26a810];return _0x4758a3;};'use strict';var Sequelize=require(_0xb222('0x0'));module[_0xb222('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xb222('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xb222('0x2')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xb222('0x3')]},'campaigntype':{'type':Sequelize[_0xb222('0x3')]},'membername':{'type':Sequelize[_0xb222('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index fa8ce12..0b02ac8 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 _0x6efd=['../../config/environment','exports','report_agent_preview','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x6efd,0x19d));var _0xd6ef=function(_0x3c5ac1,_0x222b2c){_0x3c5ac1=_0x3c5ac1-0x0;var _0x3fb52=_0x6efd[_0x3c5ac1];return _0x3fb52;};'use strict';var _=require(_0xd6ef('0x0'));var util=require(_0xd6ef('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd6ef('0x2'));var BPromise=require(_0xd6ef('0x3'));var rp=require(_0xd6ef('0x4'));var fs=require('fs');var path=require(_0xd6ef('0x5'));var rimraf=require(_0xd6ef('0x6'));var config=require(_0xd6ef('0x7'));var attributes=require('./reportAgentPreview.attributes');module[_0xd6ef('0x8')]=function(_0x4105f0,_0x532e27){return _0x4105f0['define']('ReportAgentPreview',attributes,{'tableName':_0xd6ef('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3faa=['path','../../config/environment','./reportAgentPreview.attributes','define','lodash','util','api','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3faa,0x8b));var _0xa3fa=function(_0xd1fba4,_0xace9f8){_0xd1fba4=_0xd1fba4-0x0;var _0x51a08f=_0x3faa[_0xd1fba4];return _0x51a08f;};'use strict';var _=require(_0xa3fa('0x0'));var util=require(_0xa3fa('0x1'));var logger=require('../../config/logger')(_0xa3fa('0x2'));var moment=require(_0xa3fa('0x3'));var BPromise=require(_0xa3fa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa3fa('0x5'));var rimraf=require('rimraf');var config=require(_0xa3fa('0x6'));var attributes=require(_0xa3fa('0x7'));module['exports']=function(_0x1345f7,_0x302f74){return _0x1345f7[_0xa3fa('0x8')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index e47d247..4652201 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 _0xea25=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','options','stringify','util','randomstring','ioredis','../../mysqldb'];(function(_0x11fffa,_0x417d4d){var _0x3b78b1=function(_0x3a97b7){while(--_0x3a97b7){_0x11fffa['push'](_0x11fffa['shift']());}};_0x3b78b1(++_0x417d4d);}(_0xea25,0x11c));var _0x5ea2=function(_0x218fca,_0x53b645){_0x218fca=_0x218fca-0x0;var _0x1b1e1f=_0xea25[_0x218fca];return _0x1b1e1f;};'use strict';var _=require('lodash');var util=require(_0x5ea2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5ea2('0x1'));var fs=require('fs');var Redis=require(_0x5ea2('0x2'));var db=require(_0x5ea2('0x3'))['db'];var utils=require(_0x5ea2('0x4'));var logger=require(_0x5ea2('0x5'))(_0x5ea2('0x6'));var config=require('../../config/environment');var jayson=require(_0x5ea2('0x7'));var client=jayson['client'][_0x5ea2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6f211a,_0x52a7be,_0xab137f){return new BPromise(function(_0x348bee,_0x576959){return client[_0x5ea2('0x9')](_0x6f211a,_0xab137f)[_0x5ea2('0xa')](function(_0x23fe37){logger[_0x5ea2('0xb')](_0x5ea2('0xc'),_0x52a7be,_0x5ea2('0xd'));logger[_0x5ea2('0xe')](_0x5ea2('0xf'),_0x52a7be,_0x5ea2('0xd'),JSON['stringify'](_0x23fe37));if(_0x23fe37[_0x5ea2('0x10')]){if(_0x23fe37['error']['code']===0x1f4){logger[_0x5ea2('0x10')](_0x5ea2('0xc'),_0x52a7be,_0x23fe37['error']['message']);return _0x576959(_0x23fe37[_0x5ea2('0x10')][_0x5ea2('0x11')]);}logger[_0x5ea2('0x10')](_0x5ea2('0xc'),_0x52a7be,_0x23fe37['error']['message']);return _0x348bee(_0x23fe37['error']['message']);}else{logger[_0x5ea2('0xb')](_0x5ea2('0xc'),_0x52a7be,_0x5ea2('0xd'));_0x348bee(_0x23fe37[_0x5ea2('0x12')][_0x5ea2('0x11')]);}})[_0x5ea2('0x13')](function(_0x4bb472){logger[_0x5ea2('0x10')](_0x5ea2('0xc'),_0x52a7be,_0x4bb472);_0x576959(_0x4bb472);});});}exports[_0x5ea2('0x14')]=function(_0x498557){var _0x21b371=this;return new Promise(function(_0x1cb393,_0x277cbb){return db[_0x5ea2('0x15')]['create'](_0x498557['body'],{'raw':_0x498557[_0x5ea2('0x16')]?_0x498557[_0x5ea2('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x5ea2('0xa')](function(_0x1647ab){logger[_0x5ea2('0xb')](_0x5ea2('0x14'),_0x498557);logger['debug']('CreateReportAgentPreview',_0x498557,JSON[_0x5ea2('0x17')](_0x1647ab));_0x1cb393(_0x1647ab);})[_0x5ea2('0x13')](function(_0x49b061){logger[_0x5ea2('0x10')](_0x5ea2('0x14'),_0x49b061[_0x5ea2('0x11')],_0x498557);_0x277cbb(_0x21b371['error'](0x1f4,_0x49b061[_0x5ea2('0x11')]));});});}; \ No newline at end of file +var _0x8712=['CreateReportAgentPreview','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','catch','ReportAgentPreview','body','options','raw'];(function(_0x42cf37,_0x594712){var _0x1cd995=function(_0x21716c){while(--_0x21716c){_0x42cf37['push'](_0x42cf37['shift']());}};_0x1cd995(++_0x594712);}(_0x8712,0x191));var _0x2871=function(_0x205d25,_0x6a807c){_0x205d25=_0x205d25-0x0;var _0x3ae7a3=_0x8712[_0x205d25];return _0x3ae7a3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2871('0x0'));var BPromise=require(_0x2871('0x1'));var rs=require(_0x2871('0x2'));var fs=require('fs');var Redis=require(_0x2871('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2871('0x4'));var logger=require(_0x2871('0x5'))(_0x2871('0x6'));var config=require(_0x2871('0x7'));var jayson=require(_0x2871('0x8'));var client=jayson['client'][_0x2871('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e8cd4,_0x4bcd6e,_0x3c4552){return new BPromise(function(_0x1999b7,_0x2bfafc){return client['request'](_0x5e8cd4,_0x3c4552)['then'](function(_0x18da55){logger[_0x2871('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x4bcd6e,_0x2871('0xb'));logger[_0x2871('0xc')](_0x2871('0xd'),_0x4bcd6e,_0x2871('0xb'),JSON[_0x2871('0xe')](_0x18da55));if(_0x18da55[_0x2871('0xf')]){if(_0x18da55[_0x2871('0xf')][_0x2871('0x10')]===0x1f4){logger['error'](_0x2871('0x11'),_0x4bcd6e,_0x18da55['error'][_0x2871('0x12')]);return _0x2bfafc(_0x18da55['error'][_0x2871('0x12')]);}logger[_0x2871('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x4bcd6e,_0x18da55[_0x2871('0xf')][_0x2871('0x12')]);return _0x1999b7(_0x18da55[_0x2871('0xf')][_0x2871('0x12')]);}else{logger['info'](_0x2871('0x11'),_0x4bcd6e,_0x2871('0xb'));_0x1999b7(_0x18da55['result'][_0x2871('0x12')]);}})[_0x2871('0x13')](function(_0x5f3298){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x4bcd6e,_0x5f3298);_0x2bfafc(_0x5f3298);});});}exports['CreateReportAgentPreview']=function(_0x469f01){var _0x1c266e=this;return new Promise(function(_0x3418e2,_0x326279){return db[_0x2871('0x14')]['create'](_0x469f01[_0x2871('0x15')],{'raw':_0x469f01[_0x2871('0x16')]?_0x469f01[_0x2871('0x16')][_0x2871('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0xfc63cd){logger[_0x2871('0xa')](_0x2871('0x18'),_0x469f01);logger[_0x2871('0xc')](_0x2871('0x18'),_0x469f01,JSON[_0x2871('0xe')](_0xfc63cd));_0x3418e2(_0xfc63cd);})[_0x2871('0x13')](function(_0x1f28bb){logger[_0x2871('0xf')](_0x2871('0x18'),_0x1f28bb[_0x2871('0x12')],_0x469f01);_0x326279(_0x1c266e[_0x2871('0xf')](0x1f4,_0x1f28bb['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 15c8f17..05bc16b 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 _0x7a09=['/whatsapp/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','express','../../components/auth/service','get','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','outbound','/outbound/channels','/agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7a09,0xa3));var _0x97a0=function(_0x36e963,_0x61d1f9){_0x36e963=_0x36e963-0x0;var _0x5e4971=_0x7a09[_0x36e963];return _0x5e4971;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0x97a0('0x0'));var router=express['Router']();var auth=require(_0x97a0('0x1'));var controller=require('./rpc.controller');router[_0x97a0('0x2')]('/voice/channels',auth[_0x97a0('0x3')](),controller['voiceChannels']);router[_0x97a0('0x2')](_0x97a0('0x4'),auth[_0x97a0('0x3')](),controller[_0x97a0('0x5')]);router[_0x97a0('0x2')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x97a0('0x3')](),controller[_0x97a0('0x6')]);router[_0x97a0('0x2')]('/voice/queues',auth[_0x97a0('0x3')](),controller['voiceQueues']);router['get'](_0x97a0('0x7'),auth[_0x97a0('0x3')](),controller[_0x97a0('0x8')]);router['get']('/mail/queues',auth[_0x97a0('0x3')](),controller[_0x97a0('0x9')]);router[_0x97a0('0x2')](_0x97a0('0xa'),auth[_0x97a0('0x3')](),controller[_0x97a0('0xb')]);router[_0x97a0('0x2')]('/openchannel/queues',auth['isAuthenticated'](),controller[_0x97a0('0xc')]);router[_0x97a0('0x2')](_0x97a0('0xd'),auth['isAuthenticated'](),controller[_0x97a0('0xe')]);router[_0x97a0('0x2')]('/whatsapp/queues',auth[_0x97a0('0x3')](),controller[_0x97a0('0xf')]);router[_0x97a0('0x2')](_0x97a0('0x10'),auth['isAuthenticated'](),controller[_0x97a0('0x11')]);router[_0x97a0('0x2')](_0x97a0('0x12'),auth[_0x97a0('0x3')](),controller[_0x97a0('0x13')]);router['get'](_0x97a0('0x14'),auth['isAuthenticated'](),controller[_0x97a0('0x15')]);router[_0x97a0('0x2')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller['voiceQueuesChannel']);router['get'](_0x97a0('0x16'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0x97a0('0x2')](_0x97a0('0x17'),auth[_0x97a0('0x3')](),controller['voiceQueuesChannelRedirect']);router[_0x97a0('0x2')](_0x97a0('0x18'),auth[_0x97a0('0x3')](),controller[_0x97a0('0x19')]);router['put']('/voice/queues/:id',auth['isAuthenticated'](),controller['updateVoiceQueue']);router[_0x97a0('0x2')]('/outbound',auth['isAuthenticated'](),controller[_0x97a0('0x1a')]);router['get'](_0x97a0('0x1b'),auth[_0x97a0('0x3')](),controller['outboundChannels']);router[_0x97a0('0x2')](_0x97a0('0x1c'),auth[_0x97a0('0x3')](),controller['agents']);router['put'](_0x97a0('0x1d'),auth['isAuthenticated'](),controller[_0x97a0('0x1e')]);router[_0x97a0('0x2')](_0x97a0('0x1f'),auth[_0x97a0('0x3')](),controller[_0x97a0('0x20')]);router['get'](_0x97a0('0x21'),auth['isAuthenticated'](),controller[_0x97a0('0x22')]);router[_0x97a0('0x2')](_0x97a0('0x23'),auth[_0x97a0('0x3')](),controller[_0x97a0('0x24')]);router[_0x97a0('0x2')]('/fax/accounts',auth['isAuthenticated'](),controller[_0x97a0('0x25')]);router[_0x97a0('0x2')](_0x97a0('0x26'),auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0x97a0('0x2')](_0x97a0('0x27'),auth[_0x97a0('0x3')](),controller[_0x97a0('0x28')]);router['get'](_0x97a0('0x29'),auth[_0x97a0('0x3')](),controller[_0x97a0('0x2a')]);router[_0x97a0('0x2')](_0x97a0('0x2b'),auth[_0x97a0('0x3')](),controller[_0x97a0('0x2c')]);router['get'](_0x97a0('0x2d'),auth[_0x97a0('0x3')](),controller[_0x97a0('0x2e')]);router[_0x97a0('0x2')](_0x97a0('0x2f'),auth[_0x97a0('0x3')](),controller['whatsappQueuesWaitingInteractions']);router[_0x97a0('0x2')]('/fax/queues/waitinginteractions',auth[_0x97a0('0x3')](),controller[_0x97a0('0x30')]);router[_0x97a0('0x31')]('/mail/queues/:id/notify',auth[_0x97a0('0x3')](),controller[_0x97a0('0x32')](_0x97a0('0x33')));router[_0x97a0('0x2')](_0x97a0('0x34'),auth[_0x97a0('0x3')](),controller['showMailQueues']);router[_0x97a0('0x31')](_0x97a0('0x35'),auth[_0x97a0('0x3')](),controller[_0x97a0('0x32')](_0x97a0('0x36')));router[_0x97a0('0x2')]('/chat/queues/:id',auth[_0x97a0('0x3')](),controller['showChatQueues']);router[_0x97a0('0x31')](_0x97a0('0x37'),auth['isAuthenticated'](),controller[_0x97a0('0x32')](_0x97a0('0x38')));router[_0x97a0('0x2')]('/fax/queues/:id',auth[_0x97a0('0x3')](),controller[_0x97a0('0x39')]);router[_0x97a0('0x31')](_0x97a0('0x3a'),auth[_0x97a0('0x3')](),controller[_0x97a0('0x32')](_0x97a0('0x3b')));router[_0x97a0('0x2')](_0x97a0('0x3c'),auth[_0x97a0('0x3')](),controller[_0x97a0('0x3d')]);router[_0x97a0('0x31')](_0x97a0('0x3e'),auth[_0x97a0('0x3')](),controller[_0x97a0('0x32')](_0x97a0('0x3f')));router[_0x97a0('0x31')]('/whatsapp/queues/:id/notify',auth[_0x97a0('0x3')](),controller[_0x97a0('0x32')](_0x97a0('0x40')));router[_0x97a0('0x2')](_0x97a0('0x41'),auth['isAuthenticated'](),controller[_0x97a0('0x42')]);router[_0x97a0('0x2')](_0x97a0('0x43'),auth[_0x97a0('0x3')](),controller[_0x97a0('0x44')]);router[_0x97a0('0x31')](_0x97a0('0x45'),auth[_0x97a0('0x3')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0x4861=['/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','../../components/auth/service','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/fax/queues/waitinginteractions','post','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues'];(function(_0x26dc96,_0x10c6f5){var _0x30b7be=function(_0x47de22){while(--_0x47de22){_0x26dc96['push'](_0x26dc96['shift']());}};_0x30b7be(++_0x10c6f5);}(_0x4861,0x102));var _0x1486=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x4861[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0x1486('0x0'));var util=require(_0x1486('0x1'));var path=require(_0x1486('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x1486('0x3'));var controller=require('./rpc.controller');router[_0x1486('0x4')]('/voice/channels',auth[_0x1486('0x5')](),controller[_0x1486('0x6')]);router[_0x1486('0x4')](_0x1486('0x7'),auth['isAuthenticated'](),controller[_0x1486('0x8')]);router[_0x1486('0x4')](_0x1486('0x9'),auth[_0x1486('0x5')](),controller[_0x1486('0xa')]);router['get'](_0x1486('0xb'),auth[_0x1486('0x5')](),controller[_0x1486('0xc')]);router[_0x1486('0x4')](_0x1486('0xd'),auth[_0x1486('0x5')](),controller['chatQueues']);router[_0x1486('0x4')](_0x1486('0xe'),auth[_0x1486('0x5')](),controller[_0x1486('0xf')]);router[_0x1486('0x4')](_0x1486('0x10'),auth[_0x1486('0x5')](),controller['mailAccounts']);router[_0x1486('0x4')](_0x1486('0x11'),auth[_0x1486('0x5')](),controller[_0x1486('0x12')]);router['get'](_0x1486('0x13'),auth['isAuthenticated'](),controller[_0x1486('0x14')]);router[_0x1486('0x4')](_0x1486('0x15'),auth[_0x1486('0x5')](),controller[_0x1486('0x16')]);router[_0x1486('0x4')](_0x1486('0x17'),auth[_0x1486('0x5')](),controller[_0x1486('0x18')]);router[_0x1486('0x4')]('/voice/queues/preview/:id',auth[_0x1486('0x5')](),controller[_0x1486('0x19')]);router['get']('/voice/queues/channels',auth[_0x1486('0x5')](),controller[_0x1486('0x1a')]);router[_0x1486('0x4')](_0x1486('0x1b'),auth[_0x1486('0x5')](),controller[_0x1486('0x1c')]);router[_0x1486('0x4')](_0x1486('0x1d'),auth[_0x1486('0x5')](),controller[_0x1486('0x1e')]);router[_0x1486('0x4')](_0x1486('0x1f'),auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router['get']('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x1486('0x20')]);router[_0x1486('0x21')](_0x1486('0x22'),auth[_0x1486('0x5')](),controller[_0x1486('0x23')]);router[_0x1486('0x4')](_0x1486('0x24'),auth[_0x1486('0x5')](),controller[_0x1486('0x25')]);router['get'](_0x1486('0x26'),auth[_0x1486('0x5')](),controller[_0x1486('0x27')]);router['get'](_0x1486('0x28'),auth[_0x1486('0x5')](),controller[_0x1486('0x29')]);router[_0x1486('0x21')](_0x1486('0x2a'),auth['isAuthenticated'](),controller[_0x1486('0x2b')]);router['get']('/telephones',auth['isAuthenticated'](),controller['telephones']);router['get'](_0x1486('0x2c'),auth[_0x1486('0x5')](),controller[_0x1486('0x2d')]);router[_0x1486('0x4')](_0x1486('0x2e'),auth['isAuthenticated'](),controller[_0x1486('0x2f')]);router[_0x1486('0x4')](_0x1486('0x30'),auth['isAuthenticated'](),controller[_0x1486('0x31')]);router[_0x1486('0x4')](_0x1486('0x32'),auth[_0x1486('0x5')](),controller[_0x1486('0x33')]);router[_0x1486('0x4')](_0x1486('0x34'),auth[_0x1486('0x5')](),controller[_0x1486('0x35')]);router['get']('/openchannel/queues/waitinginteractions',auth[_0x1486('0x5')](),controller[_0x1486('0x36')]);router[_0x1486('0x4')](_0x1486('0x37'),auth[_0x1486('0x5')](),controller[_0x1486('0x38')]);router[_0x1486('0x4')](_0x1486('0x39'),auth[_0x1486('0x5')](),controller['smsQueuesWaitingInteractions']);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x1486('0x5')](),controller['whatsappQueuesWaitingInteractions']);router[_0x1486('0x4')](_0x1486('0x3a'),auth[_0x1486('0x5')](),controller['faxQueuesWaitingInteractions']);router[_0x1486('0x3b')]('/mail/queues/:id/notify',auth[_0x1486('0x5')](),controller[_0x1486('0x3c')](_0x1486('0x3d')));router[_0x1486('0x4')](_0x1486('0x3e'),auth[_0x1486('0x5')](),controller['showMailQueues']);router[_0x1486('0x3b')](_0x1486('0x3f'),auth[_0x1486('0x5')](),controller[_0x1486('0x3c')](_0x1486('0x40')));router[_0x1486('0x4')](_0x1486('0x41'),auth[_0x1486('0x5')](),controller[_0x1486('0x42')]);router['post']('/fax/queues/:id/notify',auth[_0x1486('0x5')](),controller[_0x1486('0x3c')](_0x1486('0x43')));router[_0x1486('0x4')](_0x1486('0x44'),auth[_0x1486('0x5')](),controller[_0x1486('0x45')]);router['post'](_0x1486('0x46'),auth[_0x1486('0x5')](),controller[_0x1486('0x3c')](_0x1486('0x47')));router['get'](_0x1486('0x48'),auth[_0x1486('0x5')](),controller['showOpenchannelQueues']);router['post'](_0x1486('0x49'),auth[_0x1486('0x5')](),controller[_0x1486('0x3c')](_0x1486('0x4a')));router['post'](_0x1486('0x4b'),auth[_0x1486('0x5')](),controller[_0x1486('0x3c')](_0x1486('0x4c')));router[_0x1486('0x4')]('/sms/queues/:id',auth[_0x1486('0x5')](),controller[_0x1486('0x4d')]);router[_0x1486('0x4')](_0x1486('0x4e'),auth[_0x1486('0x5')](),controller[_0x1486('0x4f')]);router[_0x1486('0x3b')](_0x1486('0x50'),auth['isAuthenticated'](),controller[_0x1486('0x51')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index cc05aa9..0188812 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 _0x6e23=['name','send','isNil','rows','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','format','SIP/%s','interface','internal','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','value','filter','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','\x20Message\x20not\x20found','queue','MessageId','QueueId','TransferReport','Start','queueTransferTimeout','channel','Channel\x20field\x20is\x20mandatory','capitalize','Website','User','agent','Agent\x20not\x20found','update','InteractionId','From','create','agentTransferTimeout','*,*,*,*','bluebird','moment','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack'];(function(_0x502542,_0x5c5b7a){var _0x17eab3=function(_0x5be1bb){while(--_0x5be1bb){_0x502542['push'](_0x502542['shift']());}};_0x17eab3(++_0x5c5b7a);}(_0x6e23,0x6a));var _0x36e2=function(_0x5a48d3,_0x3fc7b6){_0x5a48d3=_0x5a48d3-0x0;var _0xae6ae8=_0x6e23[_0x5a48d3];return _0xae6ae8;};'use strict';var BPromise=require(_0x36e2('0x0'));var moment=require(_0x36e2('0x1'));var _=require('lodash');var util=require(_0x36e2('0x2'));var db=require(_0x36e2('0x3'))['db'];var logger=require(_0x36e2('0x4'))(_0x36e2('0x5'));var jayson=require(_0x36e2('0x6'));var amiClient=jayson[_0x36e2('0x7')][_0x36e2('0x8')]({'port':0x232a});var mailClient=jayson['client'][_0x36e2('0x8')]({'port':0x232b});var routingClient=jayson['client'][_0x36e2('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x5dd216,_0x30132e,_0x532ccb){return new BPromise(function(_0x384fc0,_0x13181d){var _0x1682d1=_0x532ccb?_0x532ccb:amiClient;return _0x1682d1[_0x36e2('0x9')](_0x5dd216,_0x30132e)[_0x36e2('0xa')](function(_0x4d1048){if(_0x4d1048[_0x36e2('0xb')]){if(_0x4d1048[_0x36e2('0xb')][_0x36e2('0xc')]===0x1f4){return _0x13181d(_0x4d1048['error'][_0x36e2('0xd')]);}return _0x384fc0(_0x4d1048[_0x36e2('0xb')][_0x36e2('0xd')]);}else{_0x384fc0(_0x4d1048[_0x36e2('0xe')]);}})[_0x36e2('0xf')](function(_0x1e50c8){_0x13181d(_0x1e50c8);});});}function respondWithResult(_0x241473,_0x34e713){_0x34e713=_0x34e713||0xc8;return function(_0x3eb778){if(_0x3eb778){return _0x241473[_0x36e2('0x10')](_0x34e713)[_0x36e2('0x11')](_0x3eb778);}return _0x241473[_0x36e2('0x12')](0x194);};}function handleError(_0x16151f,_0x57f534){_0x57f534=_0x57f534||0x1f4;return function(_0x37c941){logger[_0x36e2('0xb')](_0x37c941[_0x36e2('0x13')]);if(_0x37c941[_0x36e2('0x14')]){delete _0x37c941['name'];}_0x16151f[_0x36e2('0x10')](_0x57f534)[_0x36e2('0x15')](_0x37c941);};}function findById(_0x4271ba){return function(_0x17dff2){if(!_['isNil'](_0x4271ba)&&!_[_0x36e2('0x16')](_0x17dff2)&&!_[_0x36e2('0x16')](_0x17dff2[_0x36e2('0x17')])){return _['find'](_0x17dff2['rows'],function(_0x2350b9){return _0x2350b9['id']==_0x4271ba;});}return null;};}exports['voiceChannels']=function(_0x3efdb9,_0x2836dc){return respondWithRpcPromise('VoiceChannels',_0x3efdb9['query'])[_0x36e2('0xa')](respondWithResult(_0x2836dc,null))['catch'](handleError(_0x2836dc,null));};exports[_0x36e2('0x18')]=function(_0x2d31f0,_0x2d459e){return respondWithRpcPromise(_0x36e2('0x19'),_[_0x36e2('0x1a')](_0x2d31f0[_0x36e2('0x1b')],_0x2d31f0[_0x36e2('0x1c')]))['then'](respondWithResult(_0x2d459e,null))[_0x36e2('0xf')](handleError(_0x2d459e,null));};exports[_0x36e2('0x1d')]=function(_0x4a49cd,_0x69eec){return respondWithRpcPromise(_0x36e2('0x1e'),_[_0x36e2('0x1a')](_0x4a49cd[_0x36e2('0x1b')],_0x4a49cd[_0x36e2('0x1c')]))[_0x36e2('0xa')](respondWithResult(_0x69eec,null))[_0x36e2('0xf')](handleError(_0x69eec,null));};exports[_0x36e2('0x1f')]=function(_0x3e8f6e,_0x742ed7){return respondWithRpcPromise(_0x36e2('0x20'),_0x3e8f6e['query'])[_0x36e2('0xa')](respondWithResult(_0x742ed7,null))[_0x36e2('0xf')](handleError(_0x742ed7,null));};exports[_0x36e2('0x21')]=function(_0x3ae54b,_0x747fbd){return respondWithRpcPromise(_0x36e2('0x20'),_0x3ae54b[_0x36e2('0x1b')])[_0x36e2('0xa')](findById(_0x3ae54b[_0x36e2('0x1c')]['id']))[_0x36e2('0xa')](respondWithResult(_0x747fbd,null))[_0x36e2('0xf')](handleError(_0x747fbd,null));};exports['updateVoiceQueue']=function(_0x4d58c7,_0x28eddd){return respondWithRpcPromise('UpdateVoiceQueue',_[_0x36e2('0x1a')](_0x4d58c7['body'],_0x4d58c7['params']))['then'](respondWithResult(_0x28eddd,null))['catch'](handleError(_0x28eddd,null));};exports['voiceQueuesPreview']=function(_0x1589c8,_0x98b716){return respondWithRpcPromise(_0x36e2('0x22'),_[_0x36e2('0x1a')](_0x1589c8['query'],_0x1589c8[_0x36e2('0x1c')]))['then'](respondWithResult(_0x98b716,null))[_0x36e2('0xf')](handleError(_0x98b716,null));};exports[_0x36e2('0x23')]=function(_0x2f39a3,_0x43b9c5){return respondWithRpcPromise('VoiceQueuesChannels',_0x2f39a3['query'])[_0x36e2('0xa')](respondWithResult(_0x43b9c5,null))[_0x36e2('0xf')](handleError(_0x43b9c5,null));};exports['voiceQueuesChannel']=function(_0x38c164,_0x281742){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x36e2('0x1a')](_0x38c164['query'],_0x38c164[_0x36e2('0x1c')]))[_0x36e2('0xa')](respondWithResult(_0x281742,null))['catch'](handleError(_0x281742,null));};exports['voiceQueuesChannelHangup']=function(_0x21cbdb,_0x319644){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x36e2('0x1a')](_0x21cbdb[_0x36e2('0x1b')],_0x21cbdb[_0x36e2('0x1c')]))[_0x36e2('0xa')](respondWithResult(_0x319644,null))[_0x36e2('0xf')](handleError(_0x319644,null));};exports[_0x36e2('0x24')]=function(_0x4581ca,_0x3231de){return respondWithRpcPromise(_0x36e2('0x25'),_['merge'](_0x4581ca['query'],_0x4581ca[_0x36e2('0x1c')]))[_0x36e2('0xa')](respondWithResult(_0x3231de,null))[_0x36e2('0xf')](handleError(_0x3231de,null));};exports[_0x36e2('0x26')]=function(_0x599b01,_0x2acdc1){return respondWithRpcPromise('Outbound',_0x599b01[_0x36e2('0x1b')])[_0x36e2('0xa')](respondWithResult(_0x2acdc1,null))[_0x36e2('0xf')](handleError(_0x2acdc1,null));};exports[_0x36e2('0x27')]=function(_0x262b8a,_0x56c611){return respondWithRpcPromise(_0x36e2('0x28'),_0x262b8a[_0x36e2('0x1b')])[_0x36e2('0xa')](respondWithResult(_0x56c611,null))[_0x36e2('0xf')](handleError(_0x56c611,null));};exports['agents']=function(_0x4cf340,_0x3e0dc2){var _0x49c0d6;return respondWithRpcPromise(_0x36e2('0x29'),_0x4cf340[_0x36e2('0x1b')])[_0x36e2('0xa')](function(_0x45ce0b){_0x49c0d6=_0x45ce0b;return respondWithRpcPromise(_0x36e2('0x29'),_0x4cf340[_0x36e2('0x1b')],routingClient);})[_0x36e2('0xa')](function(_0x4e5d1e){return _['merge']({},_0x4e5d1e,_0x49c0d6);})[_0x36e2('0xa')](respondWithResult(_0x3e0dc2,null))[_0x36e2('0xf')](handleError(_0x3e0dc2,null));};exports[_0x36e2('0x2a')]=function(_0x3f812d,_0xaf2e24){if(_0x3f812d[_0x36e2('0x2b')]&&_0x3f812d[_0x36e2('0x2b')]['interaction']&&_0x3f812d[_0x36e2('0x2c')]&&_0x3f812d[_0x36e2('0x2c')]['name']){for(var _0x1c3dd1 in _0x3f812d[_0x36e2('0x2b')][_0x36e2('0x2d')]){if(_0x3f812d[_0x36e2('0x2b')][_0x36e2('0x2d')][_0x36e2('0x2e')](_0x1c3dd1)){db[_0x36e2('0x2f')][_0x36e2('0x30')]({'where':{'channel':_0x1c3dd1,'membername':_0x3f812d['user'][_0x36e2('0x14')],'type':_0x36e2('0x31'),'exitAt':null,'uniqueid':_0x3f812d[_0x36e2('0x2b')][_0x36e2('0x2d')][_0x1c3dd1]&&_0x3f812d[_0x36e2('0x2b')][_0x36e2('0x2d')][_0x1c3dd1][_0x36e2('0x32')]?{'$notIn':_0x3f812d[_0x36e2('0x2b')][_0x36e2('0x2d')][_0x1c3dd1]}:{'$ne':null}}})[_0x36e2('0xa')](function(_0x25a79d){var _0x3171b7=moment()['format'](_0x36e2('0x33'));for(var _0xa38b27=0x0,_0xdad27=_0x25a79d[_0x36e2('0x32')];_0xa38b27<_0xdad27;_0xa38b27+=0x1){_0x25a79d[_0xa38b27][_0x36e2('0x34')]({'exitAt':_0x3171b7});}});for(var _0x5c65ae=0x0;_0x5c65ae<_0x3f812d[_0x36e2('0x2b')]['interaction'][_0x1c3dd1][_0x36e2('0x32')];_0x5c65ae+=0x1){db[_0x36e2('0x2f')][_0x36e2('0x35')]({'where':{'channel':_0x1c3dd1,'membername':_0x3f812d['user'][_0x36e2('0x14')],'type':_0x36e2('0x31'),'uniqueid':_0x3f812d[_0x36e2('0x2b')][_0x36e2('0x2d')][_0x1c3dd1][_0x5c65ae],'exitAt':null},'defaults':{'channel':_0x1c3dd1,'membername':_0x3f812d[_0x36e2('0x2c')]['name'],'interface':_['isNil'](_0x3f812d['user']['interface'])?util[_0x36e2('0x36')](_0x36e2('0x37'),_0x3f812d['user'][_0x36e2('0x14')]):_0x3f812d[_0x36e2('0x2c')][_0x36e2('0x38')],'type':_0x36e2('0x31'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3f812d[_0x36e2('0x2c')][_0x36e2('0x39')],'uniqueid':_0x3f812d[_0x36e2('0x2b')][_0x36e2('0x2d')][_0x1c3dd1][_0x5c65ae]}});}}}}return respondWithRpcPromise(_0x36e2('0x3a'),{'id':_0x3f812d[_0x36e2('0x1c')]['id'],'capacity':_0x3f812d[_0x36e2('0x2b')][_0x36e2('0x3b')]},routingClient)[_0x36e2('0xa')](respondWithResult(_0xaf2e24,null))[_0x36e2('0xf')](handleError(_0xaf2e24,null));};exports[_0x36e2('0x3c')]=function(_0x5a1f84,_0x7be77){return respondWithRpcPromise(_0x36e2('0x3d'),_0x5a1f84[_0x36e2('0x1b')])[_0x36e2('0xa')](respondWithResult(_0x7be77,null))[_0x36e2('0xf')](handleError(_0x7be77,null));};exports[_0x36e2('0x3e')]=function(_0x2417cc,_0x4314c6){return respondWithRpcPromise('Trunks',_0x2417cc[_0x36e2('0x1b')])[_0x36e2('0xa')](respondWithResult(_0x4314c6,null))[_0x36e2('0xf')](handleError(_0x4314c6,null));};exports[_0x36e2('0x3f')]=function(_0x34ddbd,_0x538230){return respondWithRpcPromise('Campaigns',_0x34ddbd[_0x36e2('0x1b')])[_0x36e2('0xa')](respondWithResult(_0x538230,null))[_0x36e2('0xf')](handleError(_0x538230,null));};exports['chatQueues']=function(_0x5cc6c1,_0x336c41){return respondWithRpcPromise(_0x36e2('0x40'),_0x5cc6c1['query'],routingClient)[_0x36e2('0xa')](respondWithResult(_0x336c41,null))[_0x36e2('0xf')](handleError(_0x336c41,null));};exports[_0x36e2('0x41')]=function(_0x212728,_0x4245ce){return respondWithRpcPromise(_0x36e2('0x40'),_0x212728[_0x36e2('0x1b')],routingClient)['then'](findById(_0x212728[_0x36e2('0x1c')]['id']))['then'](respondWithResult(_0x4245ce,null))[_0x36e2('0xf')](handleError(_0x4245ce,null));};exports[_0x36e2('0x42')]=function(_0x417ac4,_0x489be2){return respondWithRpcPromise(_0x36e2('0x43'),_0x417ac4[_0x36e2('0x1b')],routingClient)[_0x36e2('0xa')](respondWithResult(_0x489be2,null))[_0x36e2('0xf')](handleError(_0x489be2,null));};exports['showMailQueues']=function(_0x130d0d,_0x260868){return respondWithRpcPromise('MailQueues',_0x130d0d['query'],routingClient)['then'](findById(_0x130d0d[_0x36e2('0x1c')]['id']))[_0x36e2('0xa')](respondWithResult(_0x260868,null))[_0x36e2('0xf')](handleError(_0x260868,null));};exports[_0x36e2('0x44')]=function(_0x193906,_0x6eb9a8){return respondWithRpcPromise('MailAccounts',_0x193906[_0x36e2('0x1b')],mailClient)[_0x36e2('0xa')](respondWithResult(_0x6eb9a8,null))[_0x36e2('0xf')](handleError(_0x6eb9a8,null));};exports[_0x36e2('0x45')]=function(_0x568a09,_0x2145c6){return respondWithRpcPromise(_0x36e2('0x46'),_0x568a09[_0x36e2('0x1b')],routingClient)[_0x36e2('0xa')](respondWithResult(_0x2145c6,null))[_0x36e2('0xf')](handleError(_0x2145c6,null));};exports[_0x36e2('0x47')]=function(_0x1d3b3c,_0x5a3b96){return respondWithRpcPromise('OpenchannelQueues',_0x1d3b3c[_0x36e2('0x1b')],routingClient)['then'](findById(_0x1d3b3c[_0x36e2('0x1c')]['id']))[_0x36e2('0xa')](respondWithResult(_0x5a3b96,null))['catch'](handleError(_0x5a3b96,null));};exports[_0x36e2('0x48')]=function(_0xa4f7a6,_0xd532a0){return respondWithRpcPromise(_0x36e2('0x49'),_0xa4f7a6[_0x36e2('0x1b')],routingClient)['then'](respondWithResult(_0xd532a0,null))[_0x36e2('0xf')](handleError(_0xd532a0,null));};exports[_0x36e2('0x4a')]=function(_0x39fa7d,_0xf3d36){return respondWithRpcPromise(_0x36e2('0x49'),_0x39fa7d['query'],routingClient)[_0x36e2('0xa')](findById(_0x39fa7d[_0x36e2('0x1c')]['id']))[_0x36e2('0xa')](respondWithResult(_0xf3d36,null))['catch'](handleError(_0xf3d36,null));};exports[_0x36e2('0x4b')]=function(_0x1fa868,_0x4b2c66){return respondWithRpcPromise(_0x36e2('0x4c'),_0x1fa868[_0x36e2('0x1b')],routingClient)[_0x36e2('0xa')](respondWithResult(_0x4b2c66,null))[_0x36e2('0xf')](handleError(_0x4b2c66,null));};exports[_0x36e2('0x4d')]=function(_0x112ca4,_0x331d0d){return respondWithRpcPromise(_0x36e2('0x4c'),_0x112ca4[_0x36e2('0x1b')],routingClient)[_0x36e2('0xa')](findById(_0x112ca4['params']['id']))[_0x36e2('0xa')](respondWithResult(_0x331d0d,null))[_0x36e2('0xf')](handleError(_0x331d0d,null));};exports[_0x36e2('0x4e')]=function(_0x2d6627,_0x3232d8){return respondWithRpcPromise('FaxQueues',_0x2d6627['query'],routingClient)[_0x36e2('0xa')](respondWithResult(_0x3232d8,null))[_0x36e2('0xf')](handleError(_0x3232d8,null));};exports[_0x36e2('0x4f')]=function(_0x3b7ecb,_0x25b4c3){return respondWithRpcPromise(_0x36e2('0x50'),_0x3b7ecb['query'],routingClient)[_0x36e2('0xa')](findById(_0x3b7ecb['params']['id']))[_0x36e2('0xa')](respondWithResult(_0x25b4c3,null))[_0x36e2('0xf')](handleError(_0x25b4c3,null));};exports[_0x36e2('0x51')]=function(_0x342244,_0x567e15){return respondWithRpcPromise(_0x36e2('0x52'),_0x342244['query'])[_0x36e2('0xa')](respondWithResult(_0x567e15,null))[_0x36e2('0xf')](handleError(_0x567e15,null));};exports['chatQueuesWaitingInteractions']=function(_0x33cf5e,_0x3b1872){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x33cf5e['query'],routingClient)[_0x36e2('0xa')](respondWithResult(_0x3b1872,null))[_0x36e2('0xf')](handleError(_0x3b1872,null));};exports[_0x36e2('0x53')]=function(_0x3d9445,_0x2ff66a){return respondWithRpcPromise(_0x36e2('0x54'),_0x3d9445[_0x36e2('0x1b')],routingClient)['then'](respondWithResult(_0x2ff66a,null))[_0x36e2('0xf')](handleError(_0x2ff66a,null));};exports[_0x36e2('0x55')]=function(_0x58bc25,_0x26c883){return respondWithRpcPromise(_0x36e2('0x56'),_0x58bc25[_0x36e2('0x1b')],routingClient)[_0x36e2('0xa')](respondWithResult(_0x26c883,null))['catch'](handleError(_0x26c883,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x5bd1d2,_0x348173){return respondWithRpcPromise(_0x36e2('0x56'),_0x5bd1d2[_0x36e2('0x1b')],routingClient)[_0x36e2('0xa')](function(_0x2afcf8){if(_0x5bd1d2[_0x36e2('0x1b')][_0x36e2('0x57')]!==undefined){var _0x5c48c8=_(_0x2afcf8[_0x36e2('0x17')])['filter']([_0x5bd1d2[_0x36e2('0x1b')][_0x36e2('0x57')],_0x5bd1d2[_0x36e2('0x1c')]['id']])['map']('queue_id')['uniq']()[_0x36e2('0x58')]();return _0x2afcf8[_0x36e2('0x17')][_0x36e2('0x59')](function(_0x1ffc9b){return _0x5c48c8[_0x36e2('0x5a')](_0x1ffc9b[_0x36e2('0x5b')])>-0x1;});}else{return _0x2afcf8[_0x36e2('0x17')][_0x36e2('0x59')](function(_0x1e5501){return _0x1e5501[_0x36e2('0x5b')]===parseInt(_0x5bd1d2[_0x36e2('0x1c')]['id']);});}})[_0x36e2('0xa')](respondWithResult(_0x348173,null))[_0x36e2('0xf')](handleError(_0x348173,null));};exports[_0x36e2('0x5c')]=function(_0x360198,_0x30e825){return respondWithRpcPromise(_0x36e2('0x5d'),_0x360198['query'],routingClient)['then'](respondWithResult(_0x30e825,null))[_0x36e2('0xf')](handleError(_0x30e825,null));};exports[_0x36e2('0x5e')]=function(_0x3960c8,_0x1f05b0){return respondWithRpcPromise(_0x36e2('0x5f'),_0x3960c8[_0x36e2('0x1b')],routingClient)[_0x36e2('0xa')](respondWithResult(_0x1f05b0,null))[_0x36e2('0xf')](handleError(_0x1f05b0,null));};exports[_0x36e2('0x60')]=function(_0x510d15,_0x2afe9f){return respondWithRpcPromise(_0x36e2('0x61'),_0x510d15[_0x36e2('0x1b')],routingClient)['then'](respondWithResult(_0x2afe9f,null))[_0x36e2('0xf')](handleError(_0x2afe9f,null));};exports[_0x36e2('0x62')]=function(_0x2dc2ee){return function(_0x456f87,_0x217515){var _0x522360,_0x57e045;var _0x101158=_['capitalize'](_0x2dc2ee);var _0x4fd674=_0x2dc2ee===_0x36e2('0x63')?'Website':'Account';return db[_0x101158+_0x36e2('0x64')]['findOne']({'raw':!![],'where':{'id':_0x456f87[_0x36e2('0x1c')]['id']}})[_0x36e2('0xa')](function(_0x3cf256){if(_[_0x36e2('0x16')](_0x3cf256)){throw new Error(_0x101158+_0x36e2('0x65'));}_0x522360=_0x3cf256;return db[_0x101158+_0x36e2('0x66')][_0x36e2('0x67')]({'where':{'id':_0x456f87['body']['messageId']},'include':[{'model':db[_0x101158+_0x36e2('0x68')],'as':_0x36e2('0x68')},{'model':db[_0x101158+_0x4fd674],'as':_0x36e2('0x69')}]});})[_0x36e2('0xa')](function(_0x4392ca){if(_[_0x36e2('0x16')](_0x4392ca)){throw new Error(_0x101158+_0x36e2('0x6a'));}_0x57e045=_0x4392ca;return _0x4392ca['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x36e2('0xa')](function(){var _0x261c1e={'uniqueid':_0x2dc2ee+'.'+_0x57e045['id']+'.'+_0x57e045['Interaction']['id'],'FromUserId':_0x456f87[_0x36e2('0x2c')]['id'],'type':_0x36e2('0x6b')};_0x261c1e[_0x101158+_0x36e2('0x6c')]=_0x57e045['id'];_0x261c1e[_0x101158+'InteractionId']=_0x57e045['Interaction']['id'];_0x261c1e['From'+_0x101158+_0x4fd674+'Id']=_0x57e045[_0x36e2('0x69')]['id'];_0x261c1e['To'+_0x101158+_0x36e2('0x6d')]=_0x522360['id'];return db[_0x101158+_0x36e2('0x6e')]['create'](_0x261c1e);})[_0x36e2('0xa')](function(){return respondWithRpcPromise(_0x36e2('0x6f'),{'channel':_0x2dc2ee,'interaction':_0x57e045['Interaction'],'message':_0x57e045,'account':_0x57e045[_0x36e2('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x522360[_0x36e2('0x14')]+','+(_0x57e045[_0x36e2('0x69')][_0x36e2('0x70')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x36e2('0xa')](respondWithResult(_0x217515,null))['catch'](handleError(_0x217515,null));};};exports['agentNotify']=function(_0x5571bb,_0x48b7b2){var _0x1bcbf9,_0x416356;if(_[_0x36e2('0x16')](_0x5571bb[_0x36e2('0x2b')][_0x36e2('0x71')])){throw new Error(_0x36e2('0x72'));}var _0xfe518=_0x5571bb[_0x36e2('0x2b')][_0x36e2('0x71')];var _0x51d965=_[_0x36e2('0x73')](_0xfe518);var _0x406a28=_0xfe518===_0x36e2('0x63')?_0x36e2('0x74'):'Account';return db[_0x36e2('0x75')]['findOne']({'raw':!![],'where':{'id':_0x5571bb[_0x36e2('0x1c')]['id'],'role':_0x36e2('0x76')}})[_0x36e2('0xa')](function(_0x187047){if(_[_0x36e2('0x16')](_0x187047)){throw new Error(_0x36e2('0x77'));}_0x1bcbf9=_0x187047;return db[_0x51d965+_0x36e2('0x66')][_0x36e2('0x67')]({'where':{'id':_0x5571bb[_0x36e2('0x2b')]['messageId']},'include':[{'model':db[_0x51d965+_0x36e2('0x68')],'as':_0x36e2('0x68')},{'model':db[_0x51d965+_0x406a28],'as':_0x36e2('0x69')}]});})[_0x36e2('0xa')](function(_0x46cff4){if(_[_0x36e2('0x16')](_0x46cff4)){throw new Error(_0x51d965+_0x36e2('0x6a'));}_0x416356=_0x46cff4;return _0x46cff4[_0x36e2('0x78')]({'read':0x0,'readAt':null,'UserId':null});})[_0x36e2('0xa')](function(){var _0x16987d={'uniqueid':_0xfe518+'.'+_0x416356['id']+'.'+_0x416356[_0x36e2('0x68')]['id'],'FromUserId':_0x5571bb[_0x36e2('0x2c')]['id'],'type':_0x36e2('0x6b'),'ToUserId':_0x1bcbf9['id']};_0x16987d[_0x51d965+_0x36e2('0x6c')]=_0x416356['id'];_0x16987d[_0x51d965+_0x36e2('0x79')]=_0x416356[_0x36e2('0x68')]['id'];_0x16987d[_0x36e2('0x7a')+_0x51d965+_0x406a28+'Id']=_0x416356[_0x36e2('0x69')]['id'];return db[_0x51d965+_0x36e2('0x6e')][_0x36e2('0x7b')](_0x16987d);})['then'](function(){return respondWithRpcPromise(_0x36e2('0x6f'),{'channel':_0xfe518,'interaction':_0x416356[_0x36e2('0x68')],'message':_0x416356,'account':_0x416356[_0x36e2('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0x36e2('0x76'),'appdata':_0x1bcbf9[_0x36e2('0x14')]+','+(_0x416356[_0x36e2('0x69')][_0x36e2('0x7c')]||0x12c),'interval':_0x36e2('0x7d')}]},routingClient);})[_0x36e2('0xa')](respondWithResult(_0x48b7b2,null))['catch'](handleError(_0x48b7b2,null));}; \ No newline at end of file +var _0xb348=['http','request','error','code','message','catch','json','sendStatus','stack','name','status','send','isNil','rows','find','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','Agents','interaction','user','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','INTERACTION','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','OpenchannelQueues','showSmsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','type','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','update','queue','MessageId','InteractionId','From','QueueId','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','Website','User','Agent\x20not\x20found','TransferReport','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','jayson/promise','client'];(function(_0x606fe8,_0x10b084){var _0x28b517=function(_0x5e90f4){while(--_0x5e90f4){_0x606fe8['push'](_0x606fe8['shift']());}};_0x28b517(++_0x10b084);}(_0xb348,0x1d1));var _0x8b34=function(_0xc03b4a,_0x5d0e5d){_0xc03b4a=_0xc03b4a-0x0;var _0x5b1379=_0xb348[_0xc03b4a];return _0x5b1379;};'use strict';var BPromise=require(_0x8b34('0x0'));var moment=require(_0x8b34('0x1'));var _=require(_0x8b34('0x2'));var util=require(_0x8b34('0x3'));var db=require(_0x8b34('0x4'))['db'];var logger=require('../../config/logger')('api');var jayson=require(_0x8b34('0x5'));var amiClient=jayson[_0x8b34('0x6')][_0x8b34('0x7')]({'port':0x232a});var mailClient=jayson[_0x8b34('0x6')][_0x8b34('0x7')]({'port':0x232b});var routingClient=jayson[_0x8b34('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x140116,_0x3a3127,_0xcb1ff5){return new BPromise(function(_0x59a649,_0x41a129){var _0x59ca9f=_0xcb1ff5?_0xcb1ff5:amiClient;return _0x59ca9f[_0x8b34('0x8')](_0x140116,_0x3a3127)['then'](function(_0x5d13e5){if(_0x5d13e5[_0x8b34('0x9')]){if(_0x5d13e5['error'][_0x8b34('0xa')]===0x1f4){return _0x41a129(_0x5d13e5[_0x8b34('0x9')][_0x8b34('0xb')]);}return _0x59a649(_0x5d13e5['error']['message']);}else{_0x59a649(_0x5d13e5['result']);}})[_0x8b34('0xc')](function(_0x13e141){_0x41a129(_0x13e141);});});}function respondWithResult(_0x5ecd08,_0x28f459){_0x28f459=_0x28f459||0xc8;return function(_0x4a5f0c){if(_0x4a5f0c){return _0x5ecd08['status'](_0x28f459)[_0x8b34('0xd')](_0x4a5f0c);}return _0x5ecd08[_0x8b34('0xe')](0x194);};}function handleError(_0x499d6d,_0x4f3405){_0x4f3405=_0x4f3405||0x1f4;return function(_0x11599c){logger['error'](_0x11599c[_0x8b34('0xf')]);if(_0x11599c['name']){delete _0x11599c[_0x8b34('0x10')];}_0x499d6d[_0x8b34('0x11')](_0x4f3405)[_0x8b34('0x12')](_0x11599c);};}function findById(_0x5679a4){return function(_0x50988f){if(!_[_0x8b34('0x13')](_0x5679a4)&&!_['isNil'](_0x50988f)&&!_[_0x8b34('0x13')](_0x50988f[_0x8b34('0x14')])){return _[_0x8b34('0x15')](_0x50988f['rows'],function(_0x641c36){return _0x641c36['id']==_0x5679a4;});}return null;};}exports['voiceChannels']=function(_0x5d6333,_0x14045e){return respondWithRpcPromise('VoiceChannels',_0x5d6333[_0x8b34('0x16')])[_0x8b34('0x17')](respondWithResult(_0x14045e,null))[_0x8b34('0xc')](handleError(_0x14045e,null));};exports[_0x8b34('0x18')]=function(_0x428074,_0x2dbd8b){return respondWithRpcPromise(_0x8b34('0x19'),_['merge'](_0x428074[_0x8b34('0x16')],_0x428074[_0x8b34('0x1a')]))[_0x8b34('0x17')](respondWithResult(_0x2dbd8b,null))[_0x8b34('0xc')](handleError(_0x2dbd8b,null));};exports[_0x8b34('0x1b')]=function(_0x550961,_0xd56b33){return respondWithRpcPromise(_0x8b34('0x1c'),_[_0x8b34('0x1d')](_0x550961[_0x8b34('0x16')],_0x550961['params']))[_0x8b34('0x17')](respondWithResult(_0xd56b33,null))[_0x8b34('0xc')](handleError(_0xd56b33,null));};exports[_0x8b34('0x1e')]=function(_0xc19d87,_0x1fe75d){return respondWithRpcPromise('VoiceQueues',_0xc19d87[_0x8b34('0x16')])['then'](respondWithResult(_0x1fe75d,null))['catch'](handleError(_0x1fe75d,null));};exports['showVoiceQueues']=function(_0x397226,_0x2af39d){return respondWithRpcPromise(_0x8b34('0x1f'),_0x397226[_0x8b34('0x16')])[_0x8b34('0x17')](findById(_0x397226[_0x8b34('0x1a')]['id']))[_0x8b34('0x17')](respondWithResult(_0x2af39d,null))['catch'](handleError(_0x2af39d,null));};exports[_0x8b34('0x20')]=function(_0x247c0d,_0x13733e){return respondWithRpcPromise(_0x8b34('0x21'),_[_0x8b34('0x1d')](_0x247c0d[_0x8b34('0x22')],_0x247c0d['params']))[_0x8b34('0x17')](respondWithResult(_0x13733e,null))[_0x8b34('0xc')](handleError(_0x13733e,null));};exports[_0x8b34('0x23')]=function(_0x41c17d,_0x15739a){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x8b34('0x1d')](_0x41c17d[_0x8b34('0x16')],_0x41c17d['params']))[_0x8b34('0x17')](respondWithResult(_0x15739a,null))['catch'](handleError(_0x15739a,null));};exports[_0x8b34('0x24')]=function(_0x566539,_0x586b15){return respondWithRpcPromise('VoiceQueuesChannels',_0x566539['query'])[_0x8b34('0x17')](respondWithResult(_0x586b15,null))[_0x8b34('0xc')](handleError(_0x586b15,null));};exports[_0x8b34('0x25')]=function(_0x33b26f,_0x9eb88e){return respondWithRpcPromise(_0x8b34('0x26'),_[_0x8b34('0x1d')](_0x33b26f[_0x8b34('0x16')],_0x33b26f['params']))[_0x8b34('0x17')](respondWithResult(_0x9eb88e,null))[_0x8b34('0xc')](handleError(_0x9eb88e,null));};exports['voiceQueuesChannelHangup']=function(_0x175dcd,_0x1a46e2){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0x175dcd[_0x8b34('0x16')],_0x175dcd[_0x8b34('0x1a')]))[_0x8b34('0x17')](respondWithResult(_0x1a46e2,null))[_0x8b34('0xc')](handleError(_0x1a46e2,null));};exports[_0x8b34('0x27')]=function(_0x5bc113,_0x63fd77){return respondWithRpcPromise(_0x8b34('0x28'),_[_0x8b34('0x1d')](_0x5bc113[_0x8b34('0x16')],_0x5bc113[_0x8b34('0x1a')]))[_0x8b34('0x17')](respondWithResult(_0x63fd77,null))[_0x8b34('0xc')](handleError(_0x63fd77,null));};exports[_0x8b34('0x29')]=function(_0x330ca5,_0xe50c29){return respondWithRpcPromise('Outbound',_0x330ca5[_0x8b34('0x16')])[_0x8b34('0x17')](respondWithResult(_0xe50c29,null))[_0x8b34('0xc')](handleError(_0xe50c29,null));};exports[_0x8b34('0x2a')]=function(_0x140042,_0x4faabe){return respondWithRpcPromise('OutboundChannels',_0x140042[_0x8b34('0x16')])[_0x8b34('0x17')](respondWithResult(_0x4faabe,null))[_0x8b34('0xc')](handleError(_0x4faabe,null));};exports['agents']=function(_0x1880f2,_0x1ff5c6){var _0x313ef1;return respondWithRpcPromise('Agents',_0x1880f2[_0x8b34('0x16')])[_0x8b34('0x17')](function(_0xa5eff7){_0x313ef1=_0xa5eff7;return respondWithRpcPromise(_0x8b34('0x2b'),_0x1880f2[_0x8b34('0x16')],routingClient);})['then'](function(_0x56d9e5){return _['merge']({},_0x56d9e5,_0x313ef1);})[_0x8b34('0x17')](respondWithResult(_0x1ff5c6,null))[_0x8b34('0xc')](handleError(_0x1ff5c6,null));};exports['agentCapacity']=function(_0x4ad5ec,_0x100727){if(_0x4ad5ec[_0x8b34('0x22')]&&_0x4ad5ec['body'][_0x8b34('0x2c')]&&_0x4ad5ec[_0x8b34('0x2d')]&&_0x4ad5ec['user']['name']){for(var _0x3a405c in _0x4ad5ec[_0x8b34('0x22')][_0x8b34('0x2c')]){if(_0x4ad5ec[_0x8b34('0x22')][_0x8b34('0x2c')]['hasOwnProperty'](_0x3a405c)){db['MemberReport'][_0x8b34('0x2e')]({'where':{'channel':_0x3a405c,'membername':_0x4ad5ec['user'][_0x8b34('0x10')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x4ad5ec[_0x8b34('0x22')][_0x8b34('0x2c')][_0x3a405c]&&_0x4ad5ec[_0x8b34('0x22')][_0x8b34('0x2c')][_0x3a405c][_0x8b34('0x2f')]?{'$notIn':_0x4ad5ec[_0x8b34('0x22')]['interaction'][_0x3a405c]}:{'$ne':null}}})[_0x8b34('0x17')](function(_0x47899c){var _0xacde9=moment()[_0x8b34('0x30')](_0x8b34('0x31'));for(var _0x47a9eb=0x0,_0x41b8a5=_0x47899c[_0x8b34('0x2f')];_0x47a9eb<_0x41b8a5;_0x47a9eb+=0x1){_0x47899c[_0x47a9eb]['updateAttributes']({'exitAt':_0xacde9});}});for(var _0x5c0ad2=0x0;_0x5c0ad2<_0x4ad5ec[_0x8b34('0x22')]['interaction'][_0x3a405c][_0x8b34('0x2f')];_0x5c0ad2+=0x1){db['MemberReport'][_0x8b34('0x32')]({'where':{'channel':_0x3a405c,'membername':_0x4ad5ec[_0x8b34('0x2d')][_0x8b34('0x10')],'type':_0x8b34('0x33'),'uniqueid':_0x4ad5ec['body']['interaction'][_0x3a405c][_0x5c0ad2],'exitAt':null},'defaults':{'channel':_0x3a405c,'membername':_0x4ad5ec[_0x8b34('0x2d')][_0x8b34('0x10')],'interface':_[_0x8b34('0x13')](_0x4ad5ec['user']['interface'])?util[_0x8b34('0x30')]('SIP/%s',_0x4ad5ec[_0x8b34('0x2d')]['name']):_0x4ad5ec['user'][_0x8b34('0x34')],'type':_0x8b34('0x33'),'enterAt':moment()[_0x8b34('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x8b34('0x35'),'internal':_0x4ad5ec[_0x8b34('0x2d')][_0x8b34('0x36')],'uniqueid':_0x4ad5ec[_0x8b34('0x22')][_0x8b34('0x2c')][_0x3a405c][_0x5c0ad2]}});}}}}return respondWithRpcPromise(_0x8b34('0x37'),{'id':_0x4ad5ec[_0x8b34('0x1a')]['id'],'capacity':_0x4ad5ec[_0x8b34('0x22')][_0x8b34('0x38')]},routingClient)['then'](respondWithResult(_0x100727,null))[_0x8b34('0xc')](handleError(_0x100727,null));};exports[_0x8b34('0x39')]=function(_0x1d2a06,_0x4f619a){return respondWithRpcPromise(_0x8b34('0x3a'),_0x1d2a06[_0x8b34('0x16')])[_0x8b34('0x17')](respondWithResult(_0x4f619a,null))[_0x8b34('0xc')](handleError(_0x4f619a,null));};exports[_0x8b34('0x3b')]=function(_0x15d344,_0x1191bb){return respondWithRpcPromise('Trunks',_0x15d344[_0x8b34('0x16')])['then'](respondWithResult(_0x1191bb,null))[_0x8b34('0xc')](handleError(_0x1191bb,null));};exports[_0x8b34('0x3c')]=function(_0x54a137,_0x5993d0){return respondWithRpcPromise('Campaigns',_0x54a137[_0x8b34('0x16')])[_0x8b34('0x17')](respondWithResult(_0x5993d0,null))[_0x8b34('0xc')](handleError(_0x5993d0,null));};exports[_0x8b34('0x3d')]=function(_0x53c16d,_0x54f3dd){return respondWithRpcPromise(_0x8b34('0x3e'),_0x53c16d[_0x8b34('0x16')],routingClient)[_0x8b34('0x17')](respondWithResult(_0x54f3dd,null))['catch'](handleError(_0x54f3dd,null));};exports['showChatQueues']=function(_0xc6f509,_0x479959){return respondWithRpcPromise('ChatQueues',_0xc6f509[_0x8b34('0x16')],routingClient)[_0x8b34('0x17')](findById(_0xc6f509[_0x8b34('0x1a')]['id']))[_0x8b34('0x17')](respondWithResult(_0x479959,null))[_0x8b34('0xc')](handleError(_0x479959,null));};exports[_0x8b34('0x3f')]=function(_0x251f4a,_0x14c7ca){return respondWithRpcPromise(_0x8b34('0x40'),_0x251f4a['query'],routingClient)[_0x8b34('0x17')](respondWithResult(_0x14c7ca,null))[_0x8b34('0xc')](handleError(_0x14c7ca,null));};exports[_0x8b34('0x41')]=function(_0x5d15db,_0x24126a){return respondWithRpcPromise(_0x8b34('0x40'),_0x5d15db[_0x8b34('0x16')],routingClient)[_0x8b34('0x17')](findById(_0x5d15db[_0x8b34('0x1a')]['id']))[_0x8b34('0x17')](respondWithResult(_0x24126a,null))[_0x8b34('0xc')](handleError(_0x24126a,null));};exports[_0x8b34('0x42')]=function(_0x218343,_0x8fcf7a){return respondWithRpcPromise('MailAccounts',_0x218343[_0x8b34('0x16')],mailClient)[_0x8b34('0x17')](respondWithResult(_0x8fcf7a,null))['catch'](handleError(_0x8fcf7a,null));};exports['openchannelQueues']=function(_0xbe3335,_0x3de68f){return respondWithRpcPromise('OpenchannelQueues',_0xbe3335[_0x8b34('0x16')],routingClient)[_0x8b34('0x17')](respondWithResult(_0x3de68f,null))[_0x8b34('0xc')](handleError(_0x3de68f,null));};exports['showOpenchannelQueues']=function(_0x5c39e3,_0x8cb2b7){return respondWithRpcPromise(_0x8b34('0x43'),_0x5c39e3[_0x8b34('0x16')],routingClient)[_0x8b34('0x17')](findById(_0x5c39e3[_0x8b34('0x1a')]['id']))[_0x8b34('0x17')](respondWithResult(_0x8cb2b7,null))[_0x8b34('0xc')](handleError(_0x8cb2b7,null));};exports['smsQueues']=function(_0x246d89,_0x750136){return respondWithRpcPromise('SmsQueues',_0x246d89[_0x8b34('0x16')],routingClient)[_0x8b34('0x17')](respondWithResult(_0x750136,null))[_0x8b34('0xc')](handleError(_0x750136,null));};exports[_0x8b34('0x44')]=function(_0x3aaa60,_0x466e45){return respondWithRpcPromise(_0x8b34('0x45'),_0x3aaa60[_0x8b34('0x16')],routingClient)[_0x8b34('0x17')](findById(_0x3aaa60[_0x8b34('0x1a')]['id']))[_0x8b34('0x17')](respondWithResult(_0x466e45,null))[_0x8b34('0xc')](handleError(_0x466e45,null));};exports['whatsappQueues']=function(_0x5d8a05,_0x11f4a1){return respondWithRpcPromise(_0x8b34('0x46'),_0x5d8a05['query'],routingClient)[_0x8b34('0x17')](respondWithResult(_0x11f4a1,null))[_0x8b34('0xc')](handleError(_0x11f4a1,null));};exports[_0x8b34('0x47')]=function(_0xb89398,_0x706521){return respondWithRpcPromise(_0x8b34('0x46'),_0xb89398[_0x8b34('0x16')],routingClient)['then'](findById(_0xb89398[_0x8b34('0x1a')]['id']))[_0x8b34('0x17')](respondWithResult(_0x706521,null))['catch'](handleError(_0x706521,null));};exports[_0x8b34('0x48')]=function(_0x2a40fb,_0x33f744){return respondWithRpcPromise(_0x8b34('0x49'),_0x2a40fb[_0x8b34('0x16')],routingClient)['then'](respondWithResult(_0x33f744,null))[_0x8b34('0xc')](handleError(_0x33f744,null));};exports['showFaxQueues']=function(_0x50da99,_0xdb373c){return respondWithRpcPromise(_0x8b34('0x49'),_0x50da99['query'],routingClient)['then'](findById(_0x50da99[_0x8b34('0x1a')]['id']))[_0x8b34('0x17')](respondWithResult(_0xdb373c,null))['catch'](handleError(_0xdb373c,null));};exports['faxAccounts']=function(_0x13f5c6,_0x384b77){return respondWithRpcPromise(_0x8b34('0x4a'),_0x13f5c6[_0x8b34('0x16')])[_0x8b34('0x17')](respondWithResult(_0x384b77,null))[_0x8b34('0xc')](handleError(_0x384b77,null));};exports[_0x8b34('0x4b')]=function(_0x3030f1,_0x4cfc94){return respondWithRpcPromise(_0x8b34('0x4c'),_0x3030f1[_0x8b34('0x16')],routingClient)[_0x8b34('0x17')](respondWithResult(_0x4cfc94,null))[_0x8b34('0xc')](handleError(_0x4cfc94,null));};exports[_0x8b34('0x4d')]=function(_0x324a58,_0x34f961){return respondWithRpcPromise(_0x8b34('0x4e'),_0x324a58[_0x8b34('0x16')],routingClient)[_0x8b34('0x17')](respondWithResult(_0x34f961,null))[_0x8b34('0xc')](handleError(_0x34f961,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x287602,_0x16bf19){return respondWithRpcPromise(_0x8b34('0x4f'),_0x287602['query'],routingClient)[_0x8b34('0x17')](respondWithResult(_0x16bf19,null))[_0x8b34('0xc')](handleError(_0x16bf19,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4f2780,_0x38fa68){return respondWithRpcPromise(_0x8b34('0x4f'),_0x4f2780[_0x8b34('0x16')],routingClient)[_0x8b34('0x17')](function(_0x4c7b7a){if(_0x4f2780['query']['type']!==undefined){var _0x1e7de4=_(_0x4c7b7a[_0x8b34('0x14')])[_0x8b34('0x50')]([_0x4f2780['query'][_0x8b34('0x51')],_0x4f2780[_0x8b34('0x1a')]['id']])[_0x8b34('0x52')](_0x8b34('0x53'))[_0x8b34('0x54')]()[_0x8b34('0x55')]();return _0x4c7b7a['rows'][_0x8b34('0x50')](function(_0x1d5e83){return _0x1e7de4[_0x8b34('0x56')](_0x1d5e83[_0x8b34('0x53')])>-0x1;});}else{return _0x4c7b7a['rows'][_0x8b34('0x50')](function(_0x214347){return _0x214347[_0x8b34('0x53')]===parseInt(_0x4f2780[_0x8b34('0x1a')]['id']);});}})['then'](respondWithResult(_0x38fa68,null))[_0x8b34('0xc')](handleError(_0x38fa68,null));};exports[_0x8b34('0x57')]=function(_0x1669b2,_0x491e89){return respondWithRpcPromise(_0x8b34('0x58'),_0x1669b2[_0x8b34('0x16')],routingClient)[_0x8b34('0x17')](respondWithResult(_0x491e89,null))[_0x8b34('0xc')](handleError(_0x491e89,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3d7451,_0x208b82){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x3d7451[_0x8b34('0x16')],routingClient)['then'](respondWithResult(_0x208b82,null))[_0x8b34('0xc')](handleError(_0x208b82,null));};exports[_0x8b34('0x59')]=function(_0x5c1f74,_0x34885a){return respondWithRpcPromise(_0x8b34('0x5a'),_0x5c1f74[_0x8b34('0x16')],routingClient)[_0x8b34('0x17')](respondWithResult(_0x34885a,null))[_0x8b34('0xc')](handleError(_0x34885a,null));};exports[_0x8b34('0x5b')]=function(_0x73f189){return function(_0x14fbe0,_0x3b5781){var _0x3ac2f2,_0x1294b4;var _0x3f0622=_[_0x8b34('0x5c')](_0x73f189);var _0x3e24ae=_0x73f189==='chat'?'Website':'Account';return db[_0x3f0622+_0x8b34('0x5d')][_0x8b34('0x5e')]({'raw':!![],'where':{'id':_0x14fbe0[_0x8b34('0x1a')]['id']}})[_0x8b34('0x17')](function(_0x380597){if(_[_0x8b34('0x13')](_0x380597)){throw new Error(_0x3f0622+_0x8b34('0x5f'));}_0x3ac2f2=_0x380597;return db[_0x3f0622+_0x8b34('0x60')][_0x8b34('0x5e')]({'where':{'id':_0x14fbe0['body'][_0x8b34('0x61')]},'include':[{'model':db[_0x3f0622+_0x8b34('0x62')],'as':_0x8b34('0x62')},{'model':db[_0x3f0622+_0x3e24ae],'as':_0x8b34('0x63')}]});})['then'](function(_0x1e616b){if(_['isNil'](_0x1e616b)){throw new Error(_0x3f0622+'\x20Message\x20not\x20found');}_0x1294b4=_0x1e616b;return _0x1e616b[_0x8b34('0x64')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8b34('0x17')](function(){var _0xeb85d={'uniqueid':_0x73f189+'.'+_0x1294b4['id']+'.'+_0x1294b4[_0x8b34('0x62')]['id'],'FromUserId':_0x14fbe0[_0x8b34('0x2d')]['id'],'type':_0x8b34('0x65')};_0xeb85d[_0x3f0622+_0x8b34('0x66')]=_0x1294b4['id'];_0xeb85d[_0x3f0622+_0x8b34('0x67')]=_0x1294b4[_0x8b34('0x62')]['id'];_0xeb85d[_0x8b34('0x68')+_0x3f0622+_0x3e24ae+'Id']=_0x1294b4['Account']['id'];_0xeb85d['To'+_0x3f0622+_0x8b34('0x69')]=_0x3ac2f2['id'];return db[_0x3f0622+'TransferReport'][_0x8b34('0x6a')](_0xeb85d);})[_0x8b34('0x17')](function(){return respondWithRpcPromise('Start',{'channel':_0x73f189,'interaction':_0x1294b4[_0x8b34('0x62')],'message':_0x1294b4,'account':_0x1294b4[_0x8b34('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8b34('0x65'),'appdata':_0x3ac2f2['name']+','+(_0x1294b4['Account'][_0x8b34('0x6b')]||0x12c),'interval':_0x8b34('0x6c')}]},routingClient);})[_0x8b34('0x17')](respondWithResult(_0x3b5781,null))[_0x8b34('0xc')](handleError(_0x3b5781,null));};};exports[_0x8b34('0x6d')]=function(_0x2b8eb0,_0x2587ca){var _0x1a9da2,_0x34b2c4;if(_[_0x8b34('0x13')](_0x2b8eb0[_0x8b34('0x22')][_0x8b34('0x6e')])){throw new Error(_0x8b34('0x6f'));}var _0x4af150=_0x2b8eb0[_0x8b34('0x22')][_0x8b34('0x6e')];var _0x229a85=_[_0x8b34('0x5c')](_0x4af150);var _0x316597=_0x4af150===_0x8b34('0x70')?_0x8b34('0x71'):_0x8b34('0x63');return db[_0x8b34('0x72')]['findOne']({'raw':!![],'where':{'id':_0x2b8eb0['params']['id'],'role':'agent'}})[_0x8b34('0x17')](function(_0x15084b){if(_[_0x8b34('0x13')](_0x15084b)){throw new Error(_0x8b34('0x73'));}_0x1a9da2=_0x15084b;return db[_0x229a85+'Message']['findOne']({'where':{'id':_0x2b8eb0[_0x8b34('0x22')]['messageId']},'include':[{'model':db[_0x229a85+_0x8b34('0x62')],'as':_0x8b34('0x62')},{'model':db[_0x229a85+_0x316597],'as':'Account'}]});})[_0x8b34('0x17')](function(_0x1c9396){if(_['isNil'](_0x1c9396)){throw new Error(_0x229a85+'\x20Message\x20not\x20found');}_0x34b2c4=_0x1c9396;return _0x1c9396[_0x8b34('0x64')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x481048={'uniqueid':_0x4af150+'.'+_0x34b2c4['id']+'.'+_0x34b2c4['Interaction']['id'],'FromUserId':_0x2b8eb0['user']['id'],'type':_0x8b34('0x65'),'ToUserId':_0x1a9da2['id']};_0x481048[_0x229a85+_0x8b34('0x66')]=_0x34b2c4['id'];_0x481048[_0x229a85+_0x8b34('0x67')]=_0x34b2c4['Interaction']['id'];_0x481048[_0x8b34('0x68')+_0x229a85+_0x316597+'Id']=_0x34b2c4[_0x8b34('0x63')]['id'];return db[_0x229a85+_0x8b34('0x74')][_0x8b34('0x6a')](_0x481048);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x4af150,'interaction':_0x34b2c4['Interaction'],'message':_0x34b2c4,'account':_0x34b2c4[_0x8b34('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8b34('0x35'),'appdata':_0x1a9da2[_0x8b34('0x10')]+','+(_0x34b2c4[_0x8b34('0x63')][_0x8b34('0x75')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x8b34('0x17')](respondWithResult(_0x2587ca,null))[_0x8b34('0xc')](handleError(_0x2587ca,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 9b070aa..e85a378 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 _0xd27e=['create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','/:id/run','run','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd27e,0x1bd));var _0xed27=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd27e[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xed27('0x0'));var util=require(_0xed27('0x1'));var path=require('path');var timeout=require(_0xed27('0x2'));var express=require('express');var router=express[_0xed27('0x3')]();var fs_extra=require(_0xed27('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xed27('0x5'));var config=require(_0xed27('0x6'));var controller=require(_0xed27('0x7'));router[_0xed27('0x8')]('/',auth[_0xed27('0x9')](),controller[_0xed27('0xa')]);router[_0xed27('0x8')](_0xed27('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xed27('0x8')](_0xed27('0xc'),auth[_0xed27('0x9')](),controller[_0xed27('0xd')]);router[_0xed27('0xe')]('/',auth['isAuthenticated'](),controller[_0xed27('0xf')]);router['put']('/:id',auth[_0xed27('0x9')](),controller[_0xed27('0x10')]);router[_0xed27('0x11')]('/:id',auth[_0xed27('0x9')](),controller[_0xed27('0x12')]);module[_0xed27('0x13')]=router; \ No newline at end of file +var _0x2f1c=['multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','run','post','create','put','update','delete','destroy','exports'];(function(_0x288d33,_0x58ee36){var _0x1033bd=function(_0x2e22f1){while(--_0x2e22f1){_0x288d33['push'](_0x288d33['shift']());}};_0x1033bd(++_0x58ee36);}(_0x2f1c,0xf7));var _0xc2f1=function(_0x216d45,_0x4989fe){_0x216d45=_0x216d45-0x0;var _0xbaac0b=_0x2f1c[_0x216d45];return _0xbaac0b;};'use strict';var multer=require(_0xc2f1('0x0'));var util=require(_0xc2f1('0x1'));var path=require('path');var timeout=require(_0xc2f1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc2f1('0x3'));var auth=require(_0xc2f1('0x4'));var interaction=require(_0xc2f1('0x5'));var config=require(_0xc2f1('0x6'));var controller=require('./schedule.controller');router[_0xc2f1('0x7')]('/',auth[_0xc2f1('0x8')](),controller[_0xc2f1('0x9')]);router['get'](_0xc2f1('0xa'),auth[_0xc2f1('0x8')](),controller['show']);router[_0xc2f1('0x7')]('/:id/run',auth[_0xc2f1('0x8')](),controller[_0xc2f1('0xb')]);router[_0xc2f1('0xc')]('/',auth['isAuthenticated'](),controller[_0xc2f1('0xd')]);router[_0xc2f1('0xe')](_0xc2f1('0xa'),auth[_0xc2f1('0x8')](),controller[_0xc2f1('0xf')]);router[_0xc2f1('0x10')](_0xc2f1('0xa'),auth[_0xc2f1('0x8')](),controller[_0xc2f1('0x11')]);module[_0xc2f1('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 3b2e7f6..67f2a5a 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 _0x4074=['default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','days','minutes','csv','custom'];(function(_0x14f431,_0x23f764){var _0x23f73b=function(_0x48a1c5){while(--_0x48a1c5){_0x14f431['push'](_0x14f431['shift']());}};_0x23f73b(++_0x23f764);}(_0x4074,0xf0));var _0x4407=function(_0x56326a,_0xd2fa5f){_0x56326a=_0x56326a-0x0;var _0x41015f=_0x4074[_0x56326a];return _0x41015f;};'use strict';var Sequelize=require(_0x4407('0x0'));module[_0x4407('0x1')]={'name':{'type':Sequelize[_0x4407('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x4407('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x4407('0x2')],'allowNull':![],'defaultValue':_0x4407('0x4')},'startAt':{'type':Sequelize[_0x4407('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x4407('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x4407('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x4407('0x7')](_0x4407('0x8'),_0x4407('0x9'),_0x4407('0xa'),'weeks',_0x4407('0xb'),'hours',_0x4407('0xc')),'allowNull':![],'defaultValue':_0x4407('0xb')},'output':{'type':Sequelize[_0x4407('0x7')]('csv','pdf','xlsx'),'allowNull':![],'defaultValue':_0x4407('0xd')},'type':{'type':Sequelize[_0x4407('0x7')](_0x4407('0xe'),_0x4407('0xf')),'allowNull':![],'defaultValue':_0x4407('0xe')},'sendMail':{'type':Sequelize[_0x4407('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x4407('0x2')]},'cc':{'type':Sequelize[_0x4407('0x10')]},'bcc':{'type':Sequelize[_0x4407('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x4407('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2d2c=['DATE','INTEGER','ENUM','years','quarters','months','hours','minutes','days','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN'];(function(_0x3cb98d,_0x2dc480){var _0x155eb6=function(_0x10c207){while(--_0x10c207){_0x3cb98d['push'](_0x3cb98d['shift']());}};_0x155eb6(++_0x2dc480);}(_0x2d2c,0x1d7));var _0xc2d2=function(_0x39caaa,_0x1f37bc){_0x39caaa=_0x39caaa-0x0;var _0x9b9c7d=_0x2d2c[_0x39caaa];return _0x9b9c7d;};'use strict';var Sequelize=require(_0xc2d2('0x0'));module[_0xc2d2('0x1')]={'name':{'type':Sequelize[_0xc2d2('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc2d2('0x2')]},'active':{'type':Sequelize[_0xc2d2('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc2d2('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xc2d2('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xc2d2('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xc2d2('0x6')](_0xc2d2('0x7'),_0xc2d2('0x8'),_0xc2d2('0x9'),'weeks','days',_0xc2d2('0xa'),_0xc2d2('0xb')),'allowNull':![],'defaultValue':_0xc2d2('0xc')},'output':{'type':Sequelize[_0xc2d2('0x6')](_0xc2d2('0xd'),_0xc2d2('0xe'),_0xc2d2('0xf')),'allowNull':![],'defaultValue':_0xc2d2('0xd')},'type':{'type':Sequelize[_0xc2d2('0x6')](_0xc2d2('0x10'),_0xc2d2('0x11')),'allowNull':![],'defaultValue':_0xc2d2('0x10')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xc2d2('0x2')]},'cc':{'type':Sequelize[_0xc2d2('0x12')]},'bcc':{'type':Sequelize[_0xc2d2('0x12')]},'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 b2b3a21..60afd96 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 _0xdc97=['ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','get','destroy','sendStatus','error','stack','name','send','Schedule','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','catch','params','keys','fields','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','run','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv'];(function(_0x51bb38,_0x4e57a0){var _0x51c09b=function(_0x3321e2){while(--_0x3321e2){_0x51bb38['push'](_0x51bb38['shift']());}};_0x51c09b(++_0x4e57a0);}(_0xdc97,0x13b));var _0x7dc9=function(_0xf859fb,_0x1142d6){_0xf859fb=_0xf859fb-0x0;var _0x119ff5=_0xdc97[_0xf859fb];return _0x119ff5;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){var _0x1e3a8d=_0x41110a[_0x7dc9('0x22')]({'plain':!![]});var _0x55a482='Scheduler';return db['UserProfileResource'][_0x7dc9('0x23')]({'where':{'type':_0x55a482,'resourceId':_0x1e3a8d['id']}})[_0x7dc9('0x21')](function(){return _0x41110a;});})['then'](function(){_0xffc080['status'](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x5afb7d,_0x2d22eb){return function(_0x1c690b){if(!_0x1c690b){_0x5afb7d[_0x7dc9('0x24')](0x194);}return _0x1c690b;};}function handleError(_0x3e4102,_0xa2aaa9){_0xa2aaa9=_0xa2aaa9||0x1f4;return function(_0x450124){logger[_0x7dc9('0x25')](_0x450124[_0x7dc9('0x26')]);if(_0x450124[_0x7dc9('0x27')]){delete _0x450124[_0x7dc9('0x27')];}_0x3e4102[_0x7dc9('0x16')](_0xa2aaa9)[_0x7dc9('0x28')](_0x450124);};}exports['index']=function(_0x4e929c,_0x513dd6){var _0x49a4a5={},_0x4a68f0={},_0x553a03={'count':0x0,'rows':[]};var _0x58c4e8=_['map'](db[_0x7dc9('0x29')][_0x7dc9('0x2a')],function(_0x29dcef){return{'name':_0x29dcef[_0x7dc9('0x2b')],'type':_0x29dcef[_0x7dc9('0x2c')][_0x7dc9('0x2d')]};});_0x4a68f0['model']=_['map'](_0x58c4e8,'name');_0x4a68f0[_0x7dc9('0x2e')]=_['keys'](_0x4e929c[_0x7dc9('0x2e')]);_0x4a68f0[_0x7dc9('0x2f')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],_0x4a68f0[_0x7dc9('0x2e')]);_0x49a4a5[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],qs['fields'](_0x4e929c[_0x7dc9('0x2e')]['fields']));_0x49a4a5[_0x7dc9('0x32')]=_0x49a4a5[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x49a4a5[_0x7dc9('0x32')]:_0x4a68f0['model'];if(!_0x4e929c[_0x7dc9('0x2e')]['hasOwnProperty'](_0x7dc9('0x34'))){_0x49a4a5['limit']=qs['limit'](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x1a')]);_0x49a4a5[_0x7dc9('0x18')]=qs[_0x7dc9('0x18')](_0x4e929c['query'][_0x7dc9('0x18')]);}_0x49a4a5[_0x7dc9('0x35')]=qs[_0x7dc9('0x36')](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x36')]);_0x49a4a5[_0x7dc9('0x37')]=qs[_0x7dc9('0x2f')](_[_0x7dc9('0x38')](_0x4e929c[_0x7dc9('0x2e')],_0x4a68f0[_0x7dc9('0x2f')]),_0x58c4e8);if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]){_0x49a4a5['where']=_[_0x7dc9('0x3a')](_0x49a4a5[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x3b')](_0x58c4e8,function(_0xfd2612){if(_0xfd2612['type']!==_0x7dc9('0x3c')){var _0x89db0e={};_0x89db0e[_0xfd2612[_0x7dc9('0x27')]]={'$like':'%'+_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]+'%'};return _0x89db0e;}})});}_0x49a4a5=_[_0x7dc9('0x3a')]({},_0x49a4a5,_0x4e929c['options']);var _0x553230={'where':_0x49a4a5[_0x7dc9('0x37')]};return db[_0x7dc9('0x29')]['count'](_0x553230)[_0x7dc9('0x21')](function(_0x4a37ec){_0x553a03[_0x7dc9('0x1b')]=_0x4a37ec;if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x3d')]){_0x49a4a5['include']=[{'all':!![]}];}return db[_0x7dc9('0x29')][_0x7dc9('0x3e')](_0x49a4a5);})[_0x7dc9('0x21')](function(_0x95513c){_0x553a03[_0x7dc9('0x3f')]=_0x95513c;return _0x553a03;})[_0x7dc9('0x21')](respondWithFilteredResult(_0x513dd6,_0x49a4a5))[_0x7dc9('0x40')](handleError(_0x513dd6,null));};exports['show']=function(_0x187aa6,_0x4f29b2){var _0x52d883={'raw':![],'where':{'id':_0x187aa6[_0x7dc9('0x41')]['id']}},_0xcced6c={};_0xcced6c[_0x7dc9('0x31')]=_[_0x7dc9('0x42')](db[_0x7dc9('0x29')][_0x7dc9('0x2a')]);_0xcced6c[_0x7dc9('0x2e')]=_[_0x7dc9('0x42')](_0x187aa6[_0x7dc9('0x2e')]);_0xcced6c['filters']=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],_0xcced6c[_0x7dc9('0x2e')]);_0x52d883[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],qs['fields'](_0x187aa6[_0x7dc9('0x2e')][_0x7dc9('0x43')]));_0x52d883['attributes']=_0x52d883[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x52d883[_0x7dc9('0x32')]:_0xcced6c['model'];if(_0x187aa6[_0x7dc9('0x2e')]['includeAll']){_0x52d883['include']=[{'all':!![]}];}_0x52d883=_[_0x7dc9('0x3a')]({},_0x52d883,_0x187aa6[_0x7dc9('0x44')]);return db[_0x7dc9('0x29')]['find'](_0x52d883)['then'](handleEntityNotFound(_0x4f29b2,null))[_0x7dc9('0x21')](respondWithResult(_0x4f29b2,null))['catch'](handleError(_0x4f29b2,null));};exports[_0x7dc9('0x45')]=function(_0x4ab558,_0x5e2d59){return db[_0x7dc9('0x29')][_0x7dc9('0x45')](_0x4ab558[_0x7dc9('0x46')],{})[_0x7dc9('0x21')](function(_0x414bf4){var _0x113087=_0x4ab558[_0x7dc9('0x47')][_0x7dc9('0x22')]({'plain':!![]});if(!_0x113087)throw new Error(_0x7dc9('0x48'));if(_0x113087[_0x7dc9('0x49')]===_0x7dc9('0x47')){var _0x13580b=_0x414bf4[_0x7dc9('0x22')]({'plain':!![]});var _0x59be9b=_0x7dc9('0x4a');return db['UserProfileSection']['find']({'where':{'name':_0x59be9b,'userProfileId':_0x113087[_0x7dc9('0x4b')]},'raw':!![]})[_0x7dc9('0x21')](function(_0x40e382){if(_0x40e382&&_0x40e382[_0x7dc9('0x4c')]===0x0){return db[_0x7dc9('0x4d')]['create']({'name':_0x13580b[_0x7dc9('0x27')],'resourceId':_0x13580b['id'],'type':_0x40e382[_0x7dc9('0x27')],'sectionId':_0x40e382['id']},{})[_0x7dc9('0x21')](function(){return _0x414bf4;});}else{return _0x414bf4;}})['catch'](function(_0x341909){logger[_0x7dc9('0x25')](_0x7dc9('0x4e'),_0x341909);throw _0x341909;});}return _0x414bf4;})[_0x7dc9('0x21')](respondWithResult(_0x5e2d59,0xc9))[_0x7dc9('0x40')](handleError(_0x5e2d59,null));};exports[_0x7dc9('0x20')]=function(_0x593132,_0x366b8b){if(_0x593132[_0x7dc9('0x46')]['id']){delete _0x593132[_0x7dc9('0x46')]['id'];}return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x593132[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x366b8b,null))[_0x7dc9('0x21')](saveUpdates(_0x593132[_0x7dc9('0x46')],null))[_0x7dc9('0x21')](respondWithResult(_0x366b8b,null))[_0x7dc9('0x40')](handleError(_0x366b8b,null));};exports[_0x7dc9('0x23')]=function(_0x4fec6e,_0x1767b6){return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x4fec6e[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x1767b6,null))['then'](removeEntity(_0x1767b6,null))[_0x7dc9('0x40')](handleError(_0x1767b6,null));};exports[_0x7dc9('0x50')]=function(_0x2c1452,_0x17ed6c,_0x2a1db8){var _0x2f01a0=require('../../config/schedule');return db['Schedule']['find']({'where':{'id':_0x2c1452[_0x7dc9('0x41')]['id']},'raw':!![]})[_0x7dc9('0x21')](handleEntityNotFound(_0x17ed6c,null))[_0x7dc9('0x21')](function(){_0x2f01a0[_0x7dc9('0x50')](_0x2c1452['params']['id']);})['then'](respondWithStatusCode(_0x17ed6c,null))[_0x7dc9('0x40')](handleError(_0x17ed6c,null));}; \ No newline at end of file +var _0x53ec=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','Scheduler','UserProfileResource','destroy','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','Schedule','include','findAll','rows','show','params','includeAll','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce'];(function(_0x5abbea,_0x26c444){var _0xc80795=function(_0x5c5085){while(--_0x5c5085){_0x5abbea['push'](_0x5abbea['shift']());}};_0xc80795(++_0x26c444);}(_0x53ec,0x192));var _0xc53e=function(_0x37ff64,_0x37ebd9){_0x37ff64=_0x37ff64-0x0;var _0x1b4173=_0x53ec[_0x37ff64];return _0x1b4173;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];function respondWithStatusCode(_0x863fa,_0x4203aa){_0x4203aa=_0x4203aa||0xcc;return function(_0x56f0e5){if(_0x56f0e5){return _0x863fa['sendStatus'](_0x4203aa);}return _0x863fa[_0xc53e('0x18')](_0x4203aa)[_0xc53e('0x19')]();};}function respondWithResult(_0x7cd798,_0x3d2e17){_0x3d2e17=_0x3d2e17||0xc8;return function(_0x358ef3){if(_0x358ef3){return _0x7cd798[_0xc53e('0x18')](_0x3d2e17)[_0xc53e('0x1a')](_0x358ef3);}};}function respondWithFilteredResult(_0x19c0d1,_0x455e4d){return function(_0x2ad6eb){if(_0x2ad6eb){var _0x5b0a88=typeof _0x455e4d[_0xc53e('0x1b')]===_0xc53e('0x1c')&&typeof _0x455e4d[_0xc53e('0x1d')]===_0xc53e('0x1c');var _0x15333b=_0x2ad6eb[_0xc53e('0x1e')];var _0x164016=_0x5b0a88?0x0:_0x455e4d[_0xc53e('0x1b')];var _0x3b550e=_0x5b0a88?_0x2ad6eb['count']:_0x455e4d['offset']+_0x455e4d[_0xc53e('0x1d')];var _0x2a5bac;if(_0x3b550e>=_0x15333b){_0x3b550e=_0x15333b;_0x2a5bac=0xc8;}else{_0x2a5bac=0xce;}_0x19c0d1[_0xc53e('0x18')](_0x2a5bac);return _0x19c0d1[_0xc53e('0x1f')](_0xc53e('0x20'),_0x164016+'-'+_0x3b550e+'/'+_0x15333b)[_0xc53e('0x1a')](_0x2ad6eb);}return null;};}function patchUpdates(_0x15a015){return function(_0x25702b){try{jsonpatch[_0xc53e('0x21')](_0x25702b,_0x15a015,!![]);}catch(_0x401af6){return BPromise[_0xc53e('0x22')](_0x401af6);}return _0x25702b[_0xc53e('0x23')]();};}function saveUpdates(_0x426467,_0x4fb695){return function(_0x47cfdd){if(_0x47cfdd){return _0x47cfdd['update'](_0x426467)[_0xc53e('0x24')](function(_0x384218){return _0x384218;});}return null;};}function removeEntity(_0x7591c1,_0x4015c8){return function(_0x180811){if(_0x180811){return _0x180811['destroy']()['then'](function(){var _0xe06e42=_0x180811['get']({'plain':!![]});var _0x1ae55e=_0xc53e('0x25');return db[_0xc53e('0x26')][_0xc53e('0x27')]({'where':{'type':_0x1ae55e,'resourceId':_0xe06e42['id']}})[_0xc53e('0x24')](function(){return _0x180811;});})['then'](function(){_0x7591c1[_0xc53e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d9a68,_0x5c65d3){return function(_0x3c5056){if(!_0x3c5056){_0x4d9a68['sendStatus'](0x194);}return _0x3c5056;};}function handleError(_0x28240a,_0x4f203d){_0x4f203d=_0x4f203d||0x1f4;return function(_0x24a77e){logger['error'](_0x24a77e['stack']);if(_0x24a77e[_0xc53e('0x28')]){delete _0x24a77e[_0xc53e('0x28')];}_0x28240a[_0xc53e('0x18')](_0x4f203d)[_0xc53e('0x29')](_0x24a77e);};}exports[_0xc53e('0x2a')]=function(_0xf97d78,_0x3280fe){var _0x2a2ca9={},_0x4ace0b={},_0x437893={'count':0x0,'rows':[]};var _0x311835=_[_0xc53e('0x2b')](db['Schedule'][_0xc53e('0x2c')],function(_0x495756){return{'name':_0x495756[_0xc53e('0x2d')],'type':_0x495756[_0xc53e('0x2e')]['key']};});_0x4ace0b['model']=_[_0xc53e('0x2b')](_0x311835,_0xc53e('0x28'));_0x4ace0b[_0xc53e('0x2f')]=_[_0xc53e('0x30')](_0xf97d78[_0xc53e('0x2f')]);_0x4ace0b[_0xc53e('0x31')]=_[_0xc53e('0x32')](_0x4ace0b[_0xc53e('0x33')],_0x4ace0b['query']);_0x2a2ca9[_0xc53e('0x34')]=_[_0xc53e('0x32')](_0x4ace0b[_0xc53e('0x33')],qs[_0xc53e('0x35')](_0xf97d78[_0xc53e('0x2f')][_0xc53e('0x35')]));_0x2a2ca9[_0xc53e('0x34')]=_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x36')]?_0x2a2ca9['attributes']:_0x4ace0b[_0xc53e('0x33')];if(!_0xf97d78['query'][_0xc53e('0x37')](_0xc53e('0x38'))){_0x2a2ca9['limit']=qs[_0xc53e('0x1d')](_0xf97d78[_0xc53e('0x2f')][_0xc53e('0x1d')]);_0x2a2ca9['offset']=qs[_0xc53e('0x1b')](_0xf97d78[_0xc53e('0x2f')][_0xc53e('0x1b')]);}_0x2a2ca9[_0xc53e('0x39')]=qs[_0xc53e('0x3a')](_0xf97d78[_0xc53e('0x2f')][_0xc53e('0x3a')]);_0x2a2ca9['where']=qs[_0xc53e('0x31')](_[_0xc53e('0x3b')](_0xf97d78[_0xc53e('0x2f')],_0x4ace0b['filters']),_0x311835);if(_0xf97d78[_0xc53e('0x2f')]['filter']){_0x2a2ca9[_0xc53e('0x3c')]=_[_0xc53e('0x3d')](_0x2a2ca9[_0xc53e('0x3c')],{'$or':_[_0xc53e('0x2b')](_0x311835,function(_0x3036e7){if(_0x3036e7['type']!==_0xc53e('0x3e')){var _0x3c72b1={};_0x3c72b1[_0x3036e7['name']]={'$like':'%'+_0xf97d78['query']['filter']+'%'};return _0x3c72b1;}})});}_0x2a2ca9=_['merge']({},_0x2a2ca9,_0xf97d78[_0xc53e('0x3f')]);var _0x9c3816={'where':_0x2a2ca9['where']};return db[_0xc53e('0x40')]['count'](_0x9c3816)['then'](function(_0x53447e){_0x437893[_0xc53e('0x1e')]=_0x53447e;if(_0xf97d78['query']['includeAll']){_0x2a2ca9[_0xc53e('0x41')]=[{'all':!![]}];}return db['Schedule'][_0xc53e('0x42')](_0x2a2ca9);})[_0xc53e('0x24')](function(_0x49f204){_0x437893[_0xc53e('0x43')]=_0x49f204;return _0x437893;})[_0xc53e('0x24')](respondWithFilteredResult(_0x3280fe,_0x2a2ca9))['catch'](handleError(_0x3280fe,null));};exports[_0xc53e('0x44')]=function(_0x529254,_0x547be0){var _0x481e6d={'raw':![],'where':{'id':_0x529254[_0xc53e('0x45')]['id']}},_0x4efee5={};_0x4efee5[_0xc53e('0x33')]=_[_0xc53e('0x30')](db['Schedule'][_0xc53e('0x2c')]);_0x4efee5[_0xc53e('0x2f')]=_['keys'](_0x529254['query']);_0x4efee5[_0xc53e('0x31')]=_[_0xc53e('0x32')](_0x4efee5[_0xc53e('0x33')],_0x4efee5['query']);_0x481e6d[_0xc53e('0x34')]=_[_0xc53e('0x32')](_0x4efee5[_0xc53e('0x33')],qs[_0xc53e('0x35')](_0x529254[_0xc53e('0x2f')][_0xc53e('0x35')]));_0x481e6d[_0xc53e('0x34')]=_0x481e6d['attributes'][_0xc53e('0x36')]?_0x481e6d[_0xc53e('0x34')]:_0x4efee5[_0xc53e('0x33')];if(_0x529254['query'][_0xc53e('0x46')]){_0x481e6d[_0xc53e('0x41')]=[{'all':!![]}];}_0x481e6d=_[_0xc53e('0x3d')]({},_0x481e6d,_0x529254[_0xc53e('0x3f')]);return db[_0xc53e('0x40')][_0xc53e('0x47')](_0x481e6d)['then'](handleEntityNotFound(_0x547be0,null))[_0xc53e('0x24')](respondWithResult(_0x547be0,null))[_0xc53e('0x48')](handleError(_0x547be0,null));};exports[_0xc53e('0x49')]=function(_0x5a6e41,_0x33d45c){return db[_0xc53e('0x40')][_0xc53e('0x49')](_0x5a6e41[_0xc53e('0x4a')],{})[_0xc53e('0x24')](function(_0x1ac62e){var _0x1a5a8f=_0x5a6e41[_0xc53e('0x4b')][_0xc53e('0x4c')]({'plain':!![]});if(!_0x1a5a8f)throw new Error(_0xc53e('0x4d'));if(_0x1a5a8f['role']===_0xc53e('0x4b')){var _0x17cf13=_0x1ac62e[_0xc53e('0x4c')]({'plain':!![]});var _0x3d74ac=_0xc53e('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x3d74ac,'userProfileId':_0x1a5a8f[_0xc53e('0x4e')]},'raw':!![]})['then'](function(_0x15c91b){if(_0x15c91b&&_0x15c91b['autoAssociation']===0x0){return db[_0xc53e('0x26')][_0xc53e('0x49')]({'name':_0x17cf13[_0xc53e('0x28')],'resourceId':_0x17cf13['id'],'type':_0x15c91b['name'],'sectionId':_0x15c91b['id']},{})[_0xc53e('0x24')](function(){return _0x1ac62e;});}else{return _0x1ac62e;}})[_0xc53e('0x48')](function(_0x395913){logger['error'](_0xc53e('0x4f'),_0x395913);throw _0x395913;});}return _0x1ac62e;})['then'](respondWithResult(_0x33d45c,0xc9))[_0xc53e('0x48')](handleError(_0x33d45c,null));};exports[_0xc53e('0x50')]=function(_0x5ce90c,_0x15a96a){if(_0x5ce90c[_0xc53e('0x4a')]['id']){delete _0x5ce90c['body']['id'];}return db[_0xc53e('0x40')][_0xc53e('0x47')]({'where':{'id':_0x5ce90c[_0xc53e('0x45')]['id']}})[_0xc53e('0x24')](handleEntityNotFound(_0x15a96a,null))[_0xc53e('0x24')](saveUpdates(_0x5ce90c[_0xc53e('0x4a')],null))[_0xc53e('0x24')](respondWithResult(_0x15a96a,null))[_0xc53e('0x48')](handleError(_0x15a96a,null));};exports[_0xc53e('0x27')]=function(_0x219ed4,_0x3559eb){return db['Schedule'][_0xc53e('0x47')]({'where':{'id':_0x219ed4['params']['id']}})[_0xc53e('0x24')](handleEntityNotFound(_0x3559eb,null))['then'](removeEntity(_0x3559eb,null))[_0xc53e('0x48')](handleError(_0x3559eb,null));};exports[_0xc53e('0x51')]=function(_0x5228e7,_0xfc2fab,_0x7f0bc0){var _0x9c0112=require(_0xc53e('0x52'));return db['Schedule'][_0xc53e('0x47')]({'where':{'id':_0x5228e7[_0xc53e('0x45')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0xfc2fab,null))['then'](function(){_0x9c0112[_0xc53e('0x51')](_0x5228e7['params']['id']);})['then'](respondWithStatusCode(_0xfc2fab,null))['catch'](handleError(_0xfc2fab,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 7bbde9d..8f924f4 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 _0x6930=['../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3d9557,_0x5d09d2){var _0x359ff8=function(_0x784fa){while(--_0x784fa){_0x3d9557['push'](_0x3d9557['shift']());}};_0x359ff8(++_0x5d09d2);}(_0x6930,0x12c));var _0x0693=function(_0x279809,_0x373b74){_0x279809=_0x279809-0x0;var _0x27790f=_0x6930[_0x279809];return _0x27790f;};'use strict';var _=require(_0x0693('0x0'));var util=require(_0x0693('0x1'));var logger=require(_0x0693('0x2'))(_0x0693('0x3'));var moment=require(_0x0693('0x4'));var BPromise=require(_0x0693('0x5'));var rp=require(_0x0693('0x6'));var fs=require('fs');var path=require(_0x0693('0x7'));var rimraf=require('rimraf');var config=require(_0x0693('0x8'));var attributes=require(_0x0693('0x9'));module[_0x0693('0xa')]=function(_0x4f86d8,_0x421059){return _0x4f86d8[_0x0693('0xb')](_0x0693('0xc'),attributes,{'tableName':_0x0693('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15df=['./schedule.attributes','exports','tools_schedules','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x15df,0x93));var _0xf15d=function(_0x3c4fac,_0x43e2f2){_0x3c4fac=_0x3c4fac-0x0;var _0x1c1885=_0x15df[_0x3c4fac];return _0x1c1885;};'use strict';var _=require(_0xf15d('0x0'));var util=require(_0xf15d('0x1'));var logger=require(_0xf15d('0x2'))(_0xf15d('0x3'));var moment=require('moment');var BPromise=require(_0xf15d('0x4'));var rp=require(_0xf15d('0x5'));var fs=require('fs');var path=require(_0xf15d('0x6'));var rimraf=require(_0xf15d('0x7'));var config=require(_0xf15d('0x8'));var attributes=require(_0xf15d('0x9'));module[_0xf15d('0xa')]=function(_0x5db297,_0x1b8ff8){return _0x5db297['define']('Schedule',attributes,{'tableName':_0xf15d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 018095d..08028c6 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 _0xa321=['request\x20sent','stringify','error','code','message','Schedule,\x20%s,\x20%s','result','moment','bluebird','ioredis','rpc','request','then','info','debug','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0x36909d,_0x2795f1){var _0x1fd29d=function(_0x27d0fa){while(--_0x27d0fa){_0x36909d['push'](_0x36909d['shift']());}};_0x1fd29d(++_0x2795f1);}(_0xa321,0xa7));var _0x1a32=function(_0x39d39d,_0x5586bd){_0x39d39d=_0x39d39d-0x0;var _0x577ac3=_0xa321[_0x39d39d];return _0x577ac3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1a32('0x0'));var BPromise=require(_0x1a32('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a32('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a32('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b4001,_0x43547f,_0x44e8cd){return new BPromise(function(_0x342753,_0x4383ef){return client[_0x1a32('0x4')](_0x2b4001,_0x44e8cd)[_0x1a32('0x5')](function(_0xfb4037){logger[_0x1a32('0x6')]('Schedule,\x20%s,\x20%s',_0x43547f,'request\x20sent');logger[_0x1a32('0x7')](_0x1a32('0x8'),_0x43547f,_0x1a32('0x9'),JSON[_0x1a32('0xa')](_0xfb4037));if(_0xfb4037[_0x1a32('0xb')]){if(_0xfb4037[_0x1a32('0xb')][_0x1a32('0xc')]===0x1f4){logger[_0x1a32('0xb')]('Schedule,\x20%s,\x20%s',_0x43547f,_0xfb4037[_0x1a32('0xb')][_0x1a32('0xd')]);return _0x4383ef(_0xfb4037[_0x1a32('0xb')][_0x1a32('0xd')]);}logger[_0x1a32('0xb')](_0x1a32('0xe'),_0x43547f,_0xfb4037[_0x1a32('0xb')]['message']);return _0x342753(_0xfb4037[_0x1a32('0xb')][_0x1a32('0xd')]);}else{logger[_0x1a32('0x6')]('Schedule,\x20%s,\x20%s',_0x43547f,'request\x20sent');_0x342753(_0xfb4037[_0x1a32('0xf')][_0x1a32('0xd')]);}})['catch'](function(_0x52373d){logger[_0x1a32('0xb')](_0x1a32('0xe'),_0x43547f,_0x52373d);_0x4383ef(_0x52373d);});});} \ No newline at end of file +var _0xcc0e=['stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0x90bcb7,_0x95ca94){var _0x5a980d=function(_0x25b0c5){while(--_0x25b0c5){_0x90bcb7['push'](_0x90bcb7['shift']());}};_0x5a980d(++_0x95ca94);}(_0xcc0e,0x1bc));var _0xecc0=function(_0x437051,_0x1d79cf){_0x437051=_0x437051-0x0;var _0x29aaee=_0xcc0e[_0x437051];return _0x29aaee;};'use strict';var _=require(_0xecc0('0x0'));var util=require(_0xecc0('0x1'));var moment=require('moment');var BPromise=require(_0xecc0('0x2'));var rs=require(_0xecc0('0x3'));var fs=require('fs');var Redis=require(_0xecc0('0x4'));var db=require(_0xecc0('0x5'))['db'];var utils=require(_0xecc0('0x6'));var logger=require('../../config/logger')(_0xecc0('0x7'));var config=require(_0xecc0('0x8'));var jayson=require(_0xecc0('0x9'));var client=jayson['client'][_0xecc0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x449b73,_0x7bd603,_0x3d8602){return new BPromise(function(_0x2da686,_0x3713b1){return client['request'](_0x449b73,_0x3d8602)[_0xecc0('0xb')](function(_0x5f1804){logger['info'](_0xecc0('0xc'),_0x7bd603,_0xecc0('0xd'));logger[_0xecc0('0xe')](_0xecc0('0xf'),_0x7bd603,_0xecc0('0xd'),JSON[_0xecc0('0x10')](_0x5f1804));if(_0x5f1804['error']){if(_0x5f1804[_0xecc0('0x11')][_0xecc0('0x12')]===0x1f4){logger[_0xecc0('0x11')](_0xecc0('0xc'),_0x7bd603,_0x5f1804[_0xecc0('0x11')][_0xecc0('0x13')]);return _0x3713b1(_0x5f1804[_0xecc0('0x11')][_0xecc0('0x13')]);}logger[_0xecc0('0x11')](_0xecc0('0xc'),_0x7bd603,_0x5f1804[_0xecc0('0x11')][_0xecc0('0x13')]);return _0x2da686(_0x5f1804[_0xecc0('0x11')][_0xecc0('0x13')]);}else{logger[_0xecc0('0x14')](_0xecc0('0xc'),_0x7bd603,'request\x20sent');_0x2da686(_0x5f1804[_0xecc0('0x15')][_0xecc0('0x13')]);}})[_0xecc0('0x16')](function(_0x2712e0){logger[_0xecc0('0x11')](_0xecc0('0xc'),_0x7bd603,_0x2712e0);_0x3713b1(_0x2712e0);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 8100b1b..63d39d2 100644 --- a/server/api/screenRecording/index.js +++ b/server/api/screenRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x995b=['post','create','update','destroy','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','/:id','show','download'];(function(_0x1cd65a,_0x29fa8f){var _0xf93849=function(_0x29fbe1){while(--_0x29fbe1){_0x1cd65a['push'](_0x1cd65a['shift']());}};_0xf93849(++_0x29fa8f);}(_0x995b,0x10f));var _0xb995=function(_0x2e1bfc,_0x14c49c){_0x2e1bfc=_0x2e1bfc-0x0;var _0x35c05f=_0x995b[_0x2e1bfc];return _0x35c05f;};'use strict';var multer=require('multer');var util=require(_0xb995('0x0'));var path=require(_0xb995('0x1'));var timeout=require(_0xb995('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb995('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb995('0x4'));var config=require(_0xb995('0x5'));var controller=require(_0xb995('0x6'));router[_0xb995('0x7')]('/',auth[_0xb995('0x8')](),controller[_0xb995('0x9')]);router['get'](_0xb995('0xa'),auth[_0xb995('0x8')](),controller['describe']);router[_0xb995('0x7')](_0xb995('0xb'),auth['isAuthenticated'](),controller[_0xb995('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xb995('0xd')]);router[_0xb995('0xe')]('/',auth[_0xb995('0x8')](),controller[_0xb995('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb995('0x10')]);router['delete'](_0xb995('0xb'),auth[_0xb995('0x8')](),controller[_0xb995('0x11')]);module[_0xb995('0x12')]=router; \ No newline at end of file +var _0xc26e=['show','/:id/download','download','post','put','delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x3c126c,_0x22f353){var _0x3b89e4=function(_0x1472c0){while(--_0x1472c0){_0x3c126c['push'](_0x3c126c['shift']());}};_0x3b89e4(++_0x22f353);}(_0xc26e,0x1ab));var _0xec26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc26e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xec26('0x0'));var util=require(_0xec26('0x1'));var path=require(_0xec26('0x2'));var timeout=require('connect-timeout');var express=require(_0xec26('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xec26('0x4'));var interaction=require(_0xec26('0x5'));var config=require(_0xec26('0x6'));var controller=require(_0xec26('0x7'));router[_0xec26('0x8')]('/',auth[_0xec26('0x9')](),controller[_0xec26('0xa')]);router[_0xec26('0x8')](_0xec26('0xb'),auth[_0xec26('0x9')](),controller['describe']);router['get'](_0xec26('0xc'),auth[_0xec26('0x9')](),controller[_0xec26('0xd')]);router['get'](_0xec26('0xe'),auth[_0xec26('0x9')](),controller[_0xec26('0xf')]);router[_0xec26('0x10')]('/',auth[_0xec26('0x9')](),controller['create']);router[_0xec26('0x11')](_0xec26('0xc'),auth[_0xec26('0x9')](),controller['update']);router[_0xec26('0x12')](_0xec26('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xec26('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 0d6c63f..68047ce 100644 --- a/server/api/screenRecording/screenRecording.attributes.js +++ b/server/api/screenRecording/screenRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3eea=['../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER','startedAt','subtract','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','sequelize','path'];(function(_0x72015,_0x477f72){var _0x45a7cc=function(_0x88142e){while(--_0x88142e){_0x72015['push'](_0x72015['shift']());}};_0x45a7cc(++_0x477f72);}(_0x3eea,0x1ca));var _0xa3ee=function(_0xb1b70e,_0x564446){_0xb1b70e=_0xb1b70e-0x0;var _0x30eadd=_0x3eea[_0xb1b70e];return _0x30eadd;};'use strict';var Sequelize=require(_0xa3ee('0x0'));var moment=require('moment');var path=require(_0xa3ee('0x1'));var config=require(_0xa3ee('0x2'));module[_0xa3ee('0x3')]={'format':{'type':Sequelize[_0xa3ee('0x4')],'get':function(){return this[_0xa3ee('0x5')](_0xa3ee('0x6'))?path[_0xa3ee('0x7')](this[_0xa3ee('0x5')](_0xa3ee('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xa3ee('0x8')]},'channel':{'type':Sequelize[_0xa3ee('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x538bf9){var _0x4183ee=_0x538bf9['replace'](/\\/g,'/');this[_0xa3ee('0x9')]('value',_0x4183ee);}},'rating':{'type':Sequelize[_0xa3ee('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0xb1b96d){this['setDataValue'](_0xa3ee('0xb'),moment()[_0xa3ee('0xc')](_0xb1b96d,'ms'));this[_0xa3ee('0x9')]('closedAt',moment());this[_0xa3ee('0x9')](_0xa3ee('0xd'),_0xb1b96d);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xa3ee('0xb')))[_0xa3ee('0xe')](_0xa3ee('0xf'))[_0xa3ee('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa3ee('0x5')]('closedAt'))[_0xa3ee('0xe')](_0xa3ee('0xf'))[_0xa3ee('0x10')]();}},'createdAt':{'type':Sequelize[_0xa3ee('0x11')],'get':function(){return moment(this['getDataValue'](_0xa3ee('0x12')))[_0xa3ee('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa3ee('0x5')](_0xa3ee('0x13')))[_0xa3ee('0xe')](_0xa3ee('0xf'))['toString']();}}}; \ No newline at end of file +var _0x038b=['value','extname','STRING','replace','INTEGER','startedAt','subtract','closedAt','setDataValue','duration','DATE','getDataValue','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','moment','path','../../config/environment','VIRTUAL'];(function(_0x1cea3e,_0x384d0f){var _0x47154b=function(_0x4c7c7c){while(--_0x4c7c7c){_0x1cea3e['push'](_0x1cea3e['shift']());}};_0x47154b(++_0x384d0f);}(_0x038b,0x114));var _0xb038=function(_0x599999,_0x136f48){_0x599999=_0x599999-0x0;var _0x474277=_0x038b[_0x599999];return _0x474277;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var config=require(_0xb038('0x2'));module['exports']={'format':{'type':Sequelize[_0xb038('0x3')],'get':function(){return this['getDataValue'](_0xb038('0x4'))?path[_0xb038('0x5')](this['getDataValue'](_0xb038('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xb038('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x2e3e64){var _0x1b077a=_0x2e3e64[_0xb038('0x7')](/\\/g,'/');this['setDataValue']('value',_0x1b077a);}},'rating':{'type':Sequelize[_0xb038('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xb038('0x8')],'set':function(_0x4d85b4){this['setDataValue'](_0xb038('0x9'),moment()[_0xb038('0xa')](_0x4d85b4,'ms'));this['setDataValue'](_0xb038('0xb'),moment());this[_0xb038('0xc')](_0xb038('0xd'),_0x4d85b4);}},'startedAt':{'type':Sequelize[_0xb038('0xe')],'get':function(){return moment(this[_0xb038('0xf')](_0xb038('0x9')))[_0xb038('0x10')](_0xb038('0x11'))[_0xb038('0x12')]();}},'closedAt':{'type':Sequelize[_0xb038('0xe')],'get':function(){return moment(this[_0xb038('0xf')](_0xb038('0xb')))[_0xb038('0x10')](_0xb038('0x11'))[_0xb038('0x12')]();}},'createdAt':{'type':Sequelize[_0xb038('0xe')],'get':function(){return moment(this[_0xb038('0xf')]('createdAt'))[_0xb038('0x10')](_0xb038('0x11'))[_0xb038('0x12')]();}},'updatedAt':{'type':Sequelize[_0xb038('0xe')],'get':function(){return moment(this[_0xb038('0xf')](_0xb038('0x13')))['format'](_0xb038('0x11'))[_0xb038('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 1e81876..8de8e81 100644 --- a/server/api/screenRecording/screenRecording.controller.js +++ b/server/api/screenRecording/screenRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a3f=['filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','then','destroy','stack','send','map','ScreenRecording','rawAttributes','model','differenceBy','format','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','options','find','create','body','update','duration','createdAt','value','params','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError'];(function(_0x1558ab,_0x39d1de){var _0x53b64a=function(_0x4771ed){while(--_0x4771ed){_0x1558ab['push'](_0x1558ab['shift']());}};_0x53b64a(++_0x39d1de);}(_0x8a3f,0x1a8));var _0xf8a3=function(_0x3959ba,_0xe33b5b){_0x3959ba=_0x3959ba-0x0;var _0x55e72b=_0x8a3f[_0x3959ba];return _0x55e72b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf8a3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf8a3('0x1'));var moment=require(_0xf8a3('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf8a3('0x3'));var util=require(_0xf8a3('0x4'));var path=require(_0xf8a3('0x5'));var sox=require(_0xf8a3('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf8a3('0x7'));var _=require(_0xf8a3('0x8'));var squel=require(_0xf8a3('0x9'));var crypto=require('crypto');var jsforce=require(_0xf8a3('0xa'));var deskjs=require(_0xf8a3('0xb'));var toCsv=require(_0xf8a3('0xc'));var querystring=require(_0xf8a3('0xd'));var Papa=require(_0xf8a3('0xe'));var Redis=require(_0xf8a3('0xf'));var authService=require(_0xf8a3('0x10'));var qs=require(_0xf8a3('0x11'));var as=require(_0xf8a3('0x12'));var hardwareService=require(_0xf8a3('0x13'));var logger=require(_0xf8a3('0x14'))(_0xf8a3('0x15'));var utils=require(_0xf8a3('0x16'));var config=require(_0xf8a3('0x17'));var licenseUtil=require(_0xf8a3('0x18'));var db=require(_0xf8a3('0x19'))['db'];function respondWithStatusCode(_0x1750a8,_0x5c1c54){_0x5c1c54=_0x5c1c54||0xcc;return function(_0x258761){if(_0x258761){return _0x1750a8[_0xf8a3('0x1a')](_0x5c1c54);}return _0x1750a8[_0xf8a3('0x1b')](_0x5c1c54)[_0xf8a3('0x1c')]();};}function respondWithResult(_0x54d424,_0x1dfd81){_0x1dfd81=_0x1dfd81||0xc8;return function(_0x1bb390){if(_0x1bb390){return _0x54d424['status'](_0x1dfd81)['json'](_0x1bb390);}};}function respondWithFilteredResult(_0x18c38c,_0x28d6be){return function(_0x47dbde){if(_0x47dbde){var _0x476853=typeof _0x28d6be[_0xf8a3('0x1d')]===_0xf8a3('0x1e')&&typeof _0x28d6be[_0xf8a3('0x1f')]===_0xf8a3('0x1e');var _0x20753f=_0x47dbde['count'];var _0x4bf69c=_0x476853?0x0:_0x28d6be[_0xf8a3('0x1d')];var _0x13bd8b=_0x476853?_0x47dbde[_0xf8a3('0x20')]:_0x28d6be['offset']+_0x28d6be[_0xf8a3('0x1f')];var _0xe5fae3;if(_0x13bd8b>=_0x20753f){_0x13bd8b=_0x20753f;_0xe5fae3=0xc8;}else{_0xe5fae3=0xce;}_0x18c38c[_0xf8a3('0x1b')](_0xe5fae3);return _0x18c38c['set'](_0xf8a3('0x21'),_0x4bf69c+'-'+_0x13bd8b+'/'+_0x20753f)[_0xf8a3('0x22')](_0x47dbde);}return null;};}function patchUpdates(_0xb3701d){return function(_0x3a4a22){try{jsonpatch['apply'](_0x3a4a22,_0xb3701d,!![]);}catch(_0xed767){return BPromise[_0xf8a3('0x23')](_0xed767);}return _0x3a4a22[_0xf8a3('0x24')]();};}function saveUpdates(_0x18c7b2,_0x2d13f6){return function(_0x42195c){if(_0x42195c){return _0x42195c['update'](_0x18c7b2)[_0xf8a3('0x25')](function(_0x1c7436){return _0x1c7436;});}return null;};}function removeEntity(_0x515207,_0x51a2b1){return function(_0x583485){if(_0x583485){return _0x583485[_0xf8a3('0x26')]()[_0xf8a3('0x25')](function(){_0x515207[_0xf8a3('0x1b')](0xcc)[_0xf8a3('0x1c')]();});}};}function handleEntityNotFound(_0x334e0f,_0x228ee0){return function(_0x53faa5){if(!_0x53faa5){_0x334e0f[_0xf8a3('0x1a')](0x194);}return _0x53faa5;};}function handleError(_0x42b645,_0x31a04c){_0x31a04c=_0x31a04c||0x1f4;return function(_0x4df5ba){logger['error'](_0x4df5ba[_0xf8a3('0x27')]);if(_0x4df5ba['name']){delete _0x4df5ba['name'];}_0x42b645[_0xf8a3('0x1b')](_0x31a04c)[_0xf8a3('0x28')](_0x4df5ba);};}exports['index']=function(_0x4cbb6d,_0x582aed){var _0x2ba5ce={},_0xef2060={},_0x33cb6b={'count':0x0,'rows':[]};var _0x1b7090=_[_0xf8a3('0x29')](db[_0xf8a3('0x2a')][_0xf8a3('0x2b')],function(_0x37af8e){return{'name':_0x37af8e['fieldName'],'type':_0x37af8e['type']['key']};});_0xef2060[_0xf8a3('0x2c')]=_[_0xf8a3('0x2d')](_['map'](_0x1b7090,'name'),[_0xf8a3('0x2e')]);_0xef2060['query']=_[_0xf8a3('0x2f')](_0x4cbb6d['query']);_0xef2060[_0xf8a3('0x30')]=_[_0xf8a3('0x31')](_0xef2060[_0xf8a3('0x2c')],_0xef2060[_0xf8a3('0x32')]);_0x2ba5ce[_0xf8a3('0x33')]=_[_0xf8a3('0x31')](_0xef2060['model'],qs[_0xf8a3('0x34')](_0x4cbb6d[_0xf8a3('0x32')][_0xf8a3('0x34')]));_0x2ba5ce[_0xf8a3('0x33')]=_0x2ba5ce[_0xf8a3('0x33')][_0xf8a3('0x35')]?_0x2ba5ce[_0xf8a3('0x33')]:_0xef2060[_0xf8a3('0x2c')];if(!_0x4cbb6d[_0xf8a3('0x32')]['hasOwnProperty'](_0xf8a3('0x36'))){_0x2ba5ce['limit']=qs[_0xf8a3('0x1f')](_0x4cbb6d[_0xf8a3('0x32')][_0xf8a3('0x1f')]);_0x2ba5ce[_0xf8a3('0x1d')]=qs['offset'](_0x4cbb6d[_0xf8a3('0x32')][_0xf8a3('0x1d')]);}_0x2ba5ce[_0xf8a3('0x37')]=qs[_0xf8a3('0x38')](_0x4cbb6d['query'][_0xf8a3('0x38')]);_0x2ba5ce[_0xf8a3('0x39')]=qs[_0xf8a3('0x30')](_[_0xf8a3('0x3a')](_0x4cbb6d[_0xf8a3('0x32')],_0xef2060[_0xf8a3('0x30')]),_0x1b7090);if(_0x4cbb6d['query']['filter']){_0x2ba5ce[_0xf8a3('0x39')]=_[_0xf8a3('0x3b')](_0x2ba5ce[_0xf8a3('0x39')],{'$or':_[_0xf8a3('0x29')](_0x1b7090,function(_0x372dc1){if(_0x372dc1['type']!==_0xf8a3('0x3c')){var _0x464621={};_0x464621[_0x372dc1['name']]={'$like':'%'+_0x4cbb6d[_0xf8a3('0x32')][_0xf8a3('0x3d')]+'%'};return _0x464621;}})});}_0x2ba5ce=_[_0xf8a3('0x3b')]({},_0x2ba5ce,_0x4cbb6d['options']);var _0x3371da={'where':_0x2ba5ce['where']};return db[_0xf8a3('0x2a')]['count'](_0x3371da)[_0xf8a3('0x25')](function(_0x79094a){_0x33cb6b[_0xf8a3('0x20')]=_0x79094a;if(_0x4cbb6d[_0xf8a3('0x32')][_0xf8a3('0x3e')]){_0x2ba5ce[_0xf8a3('0x3f')]=[{'all':!![]}];}return db[_0xf8a3('0x2a')][_0xf8a3('0x40')](_0x2ba5ce);})['then'](function(_0xeba2b6){_0x33cb6b[_0xf8a3('0x41')]=_0xeba2b6;return _0x33cb6b;})['then'](respondWithFilteredResult(_0x582aed,_0x2ba5ce))[_0xf8a3('0x42')](handleError(_0x582aed,null));};exports[_0xf8a3('0x43')]=function(_0x29f1c3,_0x7a9ef9){var _0x26c755={'raw':![],'where':{'id':_0x29f1c3['params']['id']}},_0x1899f7={};_0x1899f7[_0xf8a3('0x2c')]=_[_0xf8a3('0x2f')](db[_0xf8a3('0x2a')][_0xf8a3('0x2b')]);_0x1899f7['query']=_[_0xf8a3('0x2f')](_0x29f1c3[_0xf8a3('0x32')]);_0x1899f7[_0xf8a3('0x30')]=_['intersection'](_0x1899f7[_0xf8a3('0x2c')],_0x1899f7[_0xf8a3('0x32')]);_0x26c755[_0xf8a3('0x33')]=_[_0xf8a3('0x31')](_0x1899f7[_0xf8a3('0x2c')],qs[_0xf8a3('0x34')](_0x29f1c3['query'][_0xf8a3('0x34')]));_0x26c755[_0xf8a3('0x33')]=_0x26c755[_0xf8a3('0x33')]['length']?_0x26c755[_0xf8a3('0x33')]:_0x1899f7[_0xf8a3('0x2c')];if(_0x29f1c3['query'][_0xf8a3('0x3e')]){_0x26c755['include']=[{'all':!![]}];}_0x26c755=_[_0xf8a3('0x3b')]({},_0x26c755,_0x29f1c3[_0xf8a3('0x44')]);return db[_0xf8a3('0x2a')][_0xf8a3('0x45')](_0x26c755)[_0xf8a3('0x25')](handleEntityNotFound(_0x7a9ef9,null))['then'](respondWithResult(_0x7a9ef9,null))[_0xf8a3('0x42')](handleError(_0x7a9ef9,null));};exports[_0xf8a3('0x46')]=function(_0x594867,_0x22a162){return db[_0xf8a3('0x2a')][_0xf8a3('0x46')](_0x594867[_0xf8a3('0x47')],{})['then'](respondWithResult(_0x22a162,0xc9))[_0xf8a3('0x42')](handleError(_0x22a162,null));};exports[_0xf8a3('0x48')]=function(_0x14968c,_0x443ef5){if(_0x14968c[_0xf8a3('0x47')]['id']){delete _0x14968c[_0xf8a3('0x47')]['id'];}delete _0x14968c[_0xf8a3('0x47')][_0xf8a3('0x49')];delete _0x14968c['body'][_0xf8a3('0x4a')];delete _0x14968c[_0xf8a3('0x47')]['closedAt'];delete _0x14968c[_0xf8a3('0x47')][_0xf8a3('0x4b')];return db[_0xf8a3('0x2a')][_0xf8a3('0x45')]({'where':{'id':_0x14968c[_0xf8a3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x443ef5,null))['then'](saveUpdates(_0x14968c[_0xf8a3('0x47')],null))[_0xf8a3('0x25')](respondWithResult(_0x443ef5,null))['catch'](handleError(_0x443ef5,null));};exports[_0xf8a3('0x4d')]=function(_0x1065af,_0x3359b7){return db['ScreenRecording']['describe']()[_0xf8a3('0x25')](respondWithResult(_0x3359b7,null))[_0xf8a3('0x42')](handleError(_0x3359b7,null));};exports[_0xf8a3('0x4e')]=function(_0x1ae712,_0x10d58d,_0x3f0cc8){var _0x31b541=require(_0xf8a3('0x4f'));var _0x17fd23=![];var _0x118ce1={};if(_0x1ae712[_0xf8a3('0x32')]['type']&&_0x1ae712[_0xf8a3('0x32')]['type']==='uniqueid'){_0x118ce1[_0xf8a3('0x50')]=_0x1ae712[_0xf8a3('0x4c')]['id'];}else{_0x118ce1['id']=_0x1ae712[_0xf8a3('0x4c')]['id'];}return db[_0xf8a3('0x2a')][_0xf8a3('0x45')]({'where':_0x118ce1,'attributes':['id',_0xf8a3('0x4b')],'raw':!![]})[_0xf8a3('0x25')](handleEntityNotFound(_0x10d58d,null))[_0xf8a3('0x25')](function(_0x231d26){if(_0x231d26){var _0x1eb7a2=path[_0xf8a3('0x51')](config[_0xf8a3('0x52')],_0xf8a3('0x53'),_0x231d26[_0xf8a3('0x4b')]);var _0x49d188=util[_0xf8a3('0x2e')](_0xf8a3('0x54'),_0x1eb7a2);if(fs[_0xf8a3('0x55')](_0x49d188)){_0x17fd23=!![];return _0x31b541[_0xf8a3('0x56')](_0x49d188,_0x1eb7a2,config[_0xf8a3('0x57')][_0xf8a3('0x58')])[_0xf8a3('0x25')](function(){return _0x231d26;});}return _0x231d26;}})['then'](function(_0x95778b){if(_0x95778b){var _0x5334ce=path[_0xf8a3('0x51')](config[_0xf8a3('0x52')],_0xf8a3('0x53'),_0x95778b[_0xf8a3('0x4b')]);if(!fs[_0xf8a3('0x55')](_0x5334ce)){throw new db[(_0xf8a3('0x59'))][(_0xf8a3('0x5a'))]('ScreenRecording\x20not\x20found');}if(_0x95778b[_0xf8a3('0x5b')]){return _0x10d58d[_0xf8a3('0x4e')](_0x5334ce,_0x95778b[_0xf8a3('0x5b')]+path[_0xf8a3('0x5c')](_0x5334ce),function(){if(_0x17fd23){fs['unlink'](_0x5334ce);}});}else{return _0x10d58d['download'](_0x5334ce,function(_0x482464){if(_0x17fd23){fs[_0xf8a3('0x5d')](_0x5334ce);}});}}})[_0xf8a3('0x42')](function(_0x34c935){if(_0x34c935[_0xf8a3('0x5e')]===_0xf8a3('0x5f')){_0x10d58d[_0xf8a3('0x1b')](0x194)[_0xf8a3('0x28')](_0xf8a3('0x60'));}else{return handleError(_0x10d58d,null);}});};exports[_0xf8a3('0x26')]=function(_0x1b30d5,_0x4922b8){return db[_0xf8a3('0x2a')][_0xf8a3('0x45')]({'where':{'id':_0x1b30d5[_0xf8a3('0x4c')]['id']}})[_0xf8a3('0x25')](function(_0x4c51a6){if(_['isNil'](_0x4c51a6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x4c51a6;})[_0xf8a3('0x25')](function(_0x49bd2f){var _0x419157=path[_0xf8a3('0x51')](config[_0xf8a3('0x52')],'server/files/screen_recordings',_0x49bd2f[_0xf8a3('0x4b')]);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x419157);if(!_[_0xf8a3('0x61')](_0x49bd2f[_0xf8a3('0x4b')])&&fs['existsSync'](_0x419157)){logger[_0xf8a3('0x62')](_0xf8a3('0x63')+_0x419157+_0xf8a3('0x64'));fs[_0xf8a3('0x65')](_0x419157);}_0x419157=_0x419157+_0xf8a3('0x66');if(!_[_0xf8a3('0x61')](_0x49bd2f[_0xf8a3('0x4b')])&&fs[_0xf8a3('0x55')](_0x419157)){logger[_0xf8a3('0x62')]('File:\x20\x22'+_0x419157+_0xf8a3('0x64'));fs[_0xf8a3('0x65')](_0x419157);}return _0x49bd2f;})[_0xf8a3('0x25')](function(_0x3cb5cb){if(!_0x3cb5cb)throw new InternalError();return _0x3cb5cb[_0xf8a3('0x26')]();})['then'](function(){_0x4922b8[_0xf8a3('0x1b')](0xcc)[_0xf8a3('0x1c')]();})[_0xf8a3('0x42')](handleError(_0x4922b8,null));}; \ No newline at end of file +var _0x5b44=['Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','length','include','create','body','duration','createdAt','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','find','root','server/files/screen_recordings','existsSync','decryptFile','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','isNil','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set'];(function(_0x2245d7,_0x92dad1){var _0x32459e=function(_0xb0ce3){while(--_0xb0ce3){_0x2245d7['push'](_0x2245d7['shift']());}};_0x32459e(++_0x92dad1);}(_0x5b44,0x116));var _0x45b4=function(_0x50ea97,_0x5e3fd2){_0x50ea97=_0x50ea97-0x0;var _0x5453f8=_0x5b44[_0x50ea97];return _0x5453f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x45b4('0x0'));var zipdir=require(_0x45b4('0x1'));var jsonpatch=require(_0x45b4('0x2'));var rp=require(_0x45b4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x45b4('0x4'));var util=require(_0x45b4('0x5'));var path=require('path');var sox=require(_0x45b4('0x6'));var csv=require(_0x45b4('0x7'));var ejs=require(_0x45b4('0x8'));var fs=require('fs');var fs_extra=require(_0x45b4('0x9'));var _=require(_0x45b4('0xa'));var squel=require(_0x45b4('0xb'));var crypto=require(_0x45b4('0xc'));var jsforce=require(_0x45b4('0xd'));var deskjs=require(_0x45b4('0xe'));var toCsv=require(_0x45b4('0x7'));var querystring=require(_0x45b4('0xf'));var Papa=require(_0x45b4('0x10'));var Redis=require(_0x45b4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x45b4('0x12'));var as=require(_0x45b4('0x13'));var hardwareService=require(_0x45b4('0x14'));var logger=require('../../config/logger')(_0x45b4('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x45b4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a2809,_0x469687){_0x469687=_0x469687||0xcc;return function(_0x2e94cd){if(_0x2e94cd){return _0x2a2809[_0x45b4('0x17')](_0x469687);}return _0x2a2809[_0x45b4('0x18')](_0x469687)[_0x45b4('0x19')]();};}function respondWithResult(_0x5be398,_0x76640e){_0x76640e=_0x76640e||0xc8;return function(_0xf0d021){if(_0xf0d021){return _0x5be398[_0x45b4('0x18')](_0x76640e)['json'](_0xf0d021);}};}function respondWithFilteredResult(_0x504e75,_0x27aa08){return function(_0xed8ab1){if(_0xed8ab1){var _0x3dbd6f=typeof _0x27aa08[_0x45b4('0x1a')]===_0x45b4('0x1b')&&typeof _0x27aa08[_0x45b4('0x1c')]===_0x45b4('0x1b');var _0x9fb24d=_0xed8ab1[_0x45b4('0x1d')];var _0x7a3edc=_0x3dbd6f?0x0:_0x27aa08[_0x45b4('0x1a')];var _0x5e8a84=_0x3dbd6f?_0xed8ab1[_0x45b4('0x1d')]:_0x27aa08[_0x45b4('0x1a')]+_0x27aa08[_0x45b4('0x1c')];var _0xad9b4d;if(_0x5e8a84>=_0x9fb24d){_0x5e8a84=_0x9fb24d;_0xad9b4d=0xc8;}else{_0xad9b4d=0xce;}_0x504e75[_0x45b4('0x18')](_0xad9b4d);return _0x504e75[_0x45b4('0x1e')](_0x45b4('0x1f'),_0x7a3edc+'-'+_0x5e8a84+'/'+_0x9fb24d)[_0x45b4('0x20')](_0xed8ab1);}return null;};}function patchUpdates(_0xd4129a){return function(_0x46eac){try{jsonpatch['apply'](_0x46eac,_0xd4129a,!![]);}catch(_0x1664b8){return BPromise[_0x45b4('0x21')](_0x1664b8);}return _0x46eac[_0x45b4('0x22')]();};}function saveUpdates(_0x33dd6c,_0x2fab51){return function(_0x5eda5e){if(_0x5eda5e){return _0x5eda5e['update'](_0x33dd6c)[_0x45b4('0x23')](function(_0x9150da){return _0x9150da;});}return null;};}function removeEntity(_0xc83448,_0x43a5c0){return function(_0x396e29){if(_0x396e29){return _0x396e29[_0x45b4('0x24')]()[_0x45b4('0x23')](function(){_0xc83448['status'](0xcc)[_0x45b4('0x19')]();});}};}function handleEntityNotFound(_0x1413c8,_0x5cdbf9){return function(_0x5a7d73){if(!_0x5a7d73){_0x1413c8[_0x45b4('0x17')](0x194);}return _0x5a7d73;};}function handleError(_0x15af91,_0x2be000){_0x2be000=_0x2be000||0x1f4;return function(_0x1c34e5){logger[_0x45b4('0x25')](_0x1c34e5[_0x45b4('0x26')]);if(_0x1c34e5['name']){delete _0x1c34e5[_0x45b4('0x27')];}_0x15af91[_0x45b4('0x18')](_0x2be000)[_0x45b4('0x28')](_0x1c34e5);};}exports[_0x45b4('0x29')]=function(_0x316b2a,_0x50c1db){var _0x3e4c40={},_0x5a7fe4={},_0x5e9a0b={'count':0x0,'rows':[]};var _0x42f6a6=_[_0x45b4('0x2a')](db[_0x45b4('0x2b')][_0x45b4('0x2c')],function(_0x4900b9){return{'name':_0x4900b9[_0x45b4('0x2d')],'type':_0x4900b9[_0x45b4('0x2e')][_0x45b4('0x2f')]};});_0x5a7fe4[_0x45b4('0x30')]=_[_0x45b4('0x31')](_['map'](_0x42f6a6,_0x45b4('0x27')),[_0x45b4('0x32')]);_0x5a7fe4[_0x45b4('0x33')]=_[_0x45b4('0x34')](_0x316b2a[_0x45b4('0x33')]);_0x5a7fe4[_0x45b4('0x35')]=_[_0x45b4('0x36')](_0x5a7fe4[_0x45b4('0x30')],_0x5a7fe4[_0x45b4('0x33')]);_0x3e4c40[_0x45b4('0x37')]=_[_0x45b4('0x36')](_0x5a7fe4[_0x45b4('0x30')],qs[_0x45b4('0x38')](_0x316b2a[_0x45b4('0x33')][_0x45b4('0x38')]));_0x3e4c40[_0x45b4('0x37')]=_0x3e4c40['attributes']['length']?_0x3e4c40['attributes']:_0x5a7fe4[_0x45b4('0x30')];if(!_0x316b2a[_0x45b4('0x33')][_0x45b4('0x39')]('nolimit')){_0x3e4c40[_0x45b4('0x1c')]=qs[_0x45b4('0x1c')](_0x316b2a['query']['limit']);_0x3e4c40[_0x45b4('0x1a')]=qs[_0x45b4('0x1a')](_0x316b2a[_0x45b4('0x33')]['offset']);}_0x3e4c40[_0x45b4('0x3a')]=qs[_0x45b4('0x3b')](_0x316b2a[_0x45b4('0x33')][_0x45b4('0x3b')]);_0x3e4c40[_0x45b4('0x3c')]=qs['filters'](_['pick'](_0x316b2a[_0x45b4('0x33')],_0x5a7fe4[_0x45b4('0x35')]),_0x42f6a6);if(_0x316b2a[_0x45b4('0x33')][_0x45b4('0x3d')]){_0x3e4c40[_0x45b4('0x3c')]=_[_0x45b4('0x3e')](_0x3e4c40['where'],{'$or':_[_0x45b4('0x2a')](_0x42f6a6,function(_0x37cb71){if(_0x37cb71['type']!==_0x45b4('0x3f')){var _0x5d0429={};_0x5d0429[_0x37cb71[_0x45b4('0x27')]]={'$like':'%'+_0x316b2a[_0x45b4('0x33')][_0x45b4('0x3d')]+'%'};return _0x5d0429;}})});}_0x3e4c40=_['merge']({},_0x3e4c40,_0x316b2a[_0x45b4('0x40')]);var _0x2039cc={'where':_0x3e4c40[_0x45b4('0x3c')]};return db[_0x45b4('0x2b')]['count'](_0x2039cc)[_0x45b4('0x23')](function(_0x58bc09){_0x5e9a0b[_0x45b4('0x1d')]=_0x58bc09;if(_0x316b2a[_0x45b4('0x33')][_0x45b4('0x41')]){_0x3e4c40['include']=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x3e4c40);})[_0x45b4('0x23')](function(_0x1c7887){_0x5e9a0b[_0x45b4('0x42')]=_0x1c7887;return _0x5e9a0b;})[_0x45b4('0x23')](respondWithFilteredResult(_0x50c1db,_0x3e4c40))[_0x45b4('0x43')](handleError(_0x50c1db,null));};exports[_0x45b4('0x44')]=function(_0xf402ca,_0x515d5f){var _0x1ac118={'raw':![],'where':{'id':_0xf402ca['params']['id']}},_0x166ca7={};_0x166ca7[_0x45b4('0x30')]=_[_0x45b4('0x34')](db[_0x45b4('0x2b')][_0x45b4('0x2c')]);_0x166ca7[_0x45b4('0x33')]=_[_0x45b4('0x34')](_0xf402ca[_0x45b4('0x33')]);_0x166ca7[_0x45b4('0x35')]=_[_0x45b4('0x36')](_0x166ca7[_0x45b4('0x30')],_0x166ca7[_0x45b4('0x33')]);_0x1ac118['attributes']=_[_0x45b4('0x36')](_0x166ca7[_0x45b4('0x30')],qs[_0x45b4('0x38')](_0xf402ca[_0x45b4('0x33')]['fields']));_0x1ac118[_0x45b4('0x37')]=_0x1ac118['attributes'][_0x45b4('0x45')]?_0x1ac118[_0x45b4('0x37')]:_0x166ca7['model'];if(_0xf402ca[_0x45b4('0x33')][_0x45b4('0x41')]){_0x1ac118[_0x45b4('0x46')]=[{'all':!![]}];}_0x1ac118=_['merge']({},_0x1ac118,_0xf402ca[_0x45b4('0x40')]);return db[_0x45b4('0x2b')]['find'](_0x1ac118)['then'](handleEntityNotFound(_0x515d5f,null))[_0x45b4('0x23')](respondWithResult(_0x515d5f,null))[_0x45b4('0x43')](handleError(_0x515d5f,null));};exports[_0x45b4('0x47')]=function(_0xdd2e97,_0x3ffc59){return db[_0x45b4('0x2b')][_0x45b4('0x47')](_0xdd2e97['body'],{})[_0x45b4('0x23')](respondWithResult(_0x3ffc59,0xc9))[_0x45b4('0x43')](handleError(_0x3ffc59,null));};exports['update']=function(_0x5102a5,_0x31a4d5){if(_0x5102a5[_0x45b4('0x48')]['id']){delete _0x5102a5['body']['id'];}delete _0x5102a5[_0x45b4('0x48')][_0x45b4('0x49')];delete _0x5102a5[_0x45b4('0x48')][_0x45b4('0x4a')];delete _0x5102a5[_0x45b4('0x48')][_0x45b4('0x4b')];delete _0x5102a5[_0x45b4('0x48')][_0x45b4('0x4c')];return db[_0x45b4('0x2b')]['find']({'where':{'id':_0x5102a5[_0x45b4('0x4d')]['id']}})[_0x45b4('0x23')](handleEntityNotFound(_0x31a4d5,null))[_0x45b4('0x23')](saveUpdates(_0x5102a5[_0x45b4('0x48')],null))['then'](respondWithResult(_0x31a4d5,null))['catch'](handleError(_0x31a4d5,null));};exports[_0x45b4('0x4e')]=function(_0x30e0e4,_0x1214fc){return db[_0x45b4('0x2b')][_0x45b4('0x4e')]()[_0x45b4('0x23')](respondWithResult(_0x1214fc,null))[_0x45b4('0x43')](handleError(_0x1214fc,null));};exports[_0x45b4('0x4f')]=function(_0x99d013,_0x4b3eb4,_0x2ba891){var _0x491f28=require(_0x45b4('0x50'));var _0x38c3be=![];var _0x5ba1de={};if(_0x99d013['query'][_0x45b4('0x2e')]&&_0x99d013['query']['type']===_0x45b4('0x51')){_0x5ba1de[_0x45b4('0x51')]=_0x99d013[_0x45b4('0x4d')]['id'];}else{_0x5ba1de['id']=_0x99d013['params']['id'];}return db[_0x45b4('0x2b')][_0x45b4('0x52')]({'where':_0x5ba1de,'attributes':['id',_0x45b4('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x4b3eb4,null))[_0x45b4('0x23')](function(_0x438994){if(_0x438994){var _0x257fd0=path['join'](config[_0x45b4('0x53')],_0x45b4('0x54'),_0x438994['value']);var _0x1456b3=util[_0x45b4('0x32')]('%s.cypher',_0x257fd0);if(fs[_0x45b4('0x55')](_0x1456b3)){_0x38c3be=!![];return _0x491f28[_0x45b4('0x56')](_0x1456b3,_0x257fd0,config['secrets'][_0x45b4('0x57')])[_0x45b4('0x23')](function(){return _0x438994;});}return _0x438994;}})['then'](function(_0x4e7710){if(_0x4e7710){var _0x5de485=path['join'](config[_0x45b4('0x53')],'server/files/screen_recordings',_0x4e7710['value']);if(!fs['existsSync'](_0x5de485)){throw new db[(_0x45b4('0x58'))][(_0x45b4('0x59'))](_0x45b4('0x5a'));}if(_0x4e7710['filename']){return _0x4b3eb4['download'](_0x5de485,_0x4e7710[_0x45b4('0x5b')]+path[_0x45b4('0x5c')](_0x5de485),function(){if(_0x38c3be){fs[_0x45b4('0x5d')](_0x5de485);}});}else{return _0x4b3eb4[_0x45b4('0x4f')](_0x5de485,function(_0x5b02cc){if(_0x38c3be){fs[_0x45b4('0x5d')](_0x5de485);}});}}})[_0x45b4('0x43')](function(_0x1c7ead){if(_0x1c7ead[_0x45b4('0x5e')]==='ScreenRecording\x20not\x20found'){_0x4b3eb4[_0x45b4('0x18')](0x194)[_0x45b4('0x28')]('Not\x20found');}else{return handleError(_0x4b3eb4,null);}});};exports[_0x45b4('0x24')]=function(_0x526d39,_0x1bfd42){return db[_0x45b4('0x2b')][_0x45b4('0x52')]({'where':{'id':_0x526d39[_0x45b4('0x4d')]['id']}})['then'](function(_0x100aaf){if(_['isNil'](_0x100aaf)){throw new ReferenceError(_0x45b4('0x5f'));}return _0x100aaf;})[_0x45b4('0x23')](function(_0xb5c64b){var _0x1728a1=path['join'](config['root'],_0x45b4('0x54'),_0xb5c64b[_0x45b4('0x4c')]);logger[_0x45b4('0x60')](_0x45b4('0x61'),_0x1728a1);if(!_['isNil'](_0xb5c64b[_0x45b4('0x4c')])&&fs[_0x45b4('0x55')](_0x1728a1)){logger[_0x45b4('0x60')](_0x45b4('0x62')+_0x1728a1+_0x45b4('0x63'));fs['unlinkSync'](_0x1728a1);}_0x1728a1=_0x1728a1+_0x45b4('0x64');if(!_[_0x45b4('0x65')](_0xb5c64b[_0x45b4('0x4c')])&&fs[_0x45b4('0x55')](_0x1728a1)){logger[_0x45b4('0x60')]('File:\x20\x22'+_0x1728a1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x45b4('0x66')](_0x1728a1);}return _0xb5c64b;})[_0x45b4('0x23')](function(_0x1cc950){if(!_0x1cc950)throw new InternalError();return _0x1cc950[_0x45b4('0x24')]();})[_0x45b4('0x23')](function(){_0x1bfd42[_0x45b4('0x18')](0xcc)[_0x45b4('0x19')]();})[_0x45b4('0x43')](handleError(_0x1bfd42,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 771cc28..5b48666 100644 --- a/server/api/screenRecording/screenRecording.model.js +++ b/server/api/screenRecording/screenRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae20=['rimraf','../../config/environment','./screenRecording.attributes','exports','ScreenRecording','interactionid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4965de,_0x29ec86){var _0x1b13d4=function(_0x55cd18){while(--_0x55cd18){_0x4965de['push'](_0x4965de['shift']());}};_0x1b13d4(++_0x29ec86);}(_0xae20,0x1f2));var _0x0ae2=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xae20[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x0ae2('0x0'));var util=require(_0x0ae2('0x1'));var logger=require('../../config/logger')(_0x0ae2('0x2'));var moment=require(_0x0ae2('0x3'));var BPromise=require(_0x0ae2('0x4'));var rp=require(_0x0ae2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ae2('0x6'));var config=require(_0x0ae2('0x7'));var attributes=require(_0x0ae2('0x8'));module[_0x0ae2('0x9')]=function(_0x37224d,_0x38ac4a){return _0x37224d['define'](_0x0ae2('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x0ae2('0xb'),'fields':[_0x0ae2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9859=['bluebird','request-promise','rimraf','../../config/environment','exports','screen_recordings','interactionid','lodash','../../config/logger','api','moment'];(function(_0x21db13,_0x2b2d48){var _0x57aa14=function(_0x53b54b){while(--_0x53b54b){_0x21db13['push'](_0x21db13['shift']());}};_0x57aa14(++_0x2b2d48);}(_0x9859,0x6a));var _0x9985=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x9859[_0xfa634c];return _0x73e478;};'use strict';var _=require(_0x9985('0x0'));var util=require('util');var logger=require(_0x9985('0x1'))(_0x9985('0x2'));var moment=require(_0x9985('0x3'));var BPromise=require(_0x9985('0x4'));var rp=require(_0x9985('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9985('0x6'));var config=require(_0x9985('0x7'));var attributes=require('./screenRecording.attributes');module[_0x9985('0x8')]=function(_0x19f427,_0x6c6a64){return _0x19f427['define']('ScreenRecording',attributes,{'tableName':_0x9985('0x9'),'paranoid':![],'indexes':[{'name':_0x9985('0xa'),'fields':[_0x9985('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 4638369..8e64021 100644 --- a/server/api/screenRecording/screenRecording.rpc.js +++ b/server/api/screenRecording/screenRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\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(_0x1c96d5,_0x525b1b){var _0x5c419d=function(_0x1ffdad){while(--_0x1ffdad){_0x1c96d5['push'](_0x1c96d5['shift']());}};_0x5c419d(++_0x525b1b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\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(_0x2e44d9,_0x5b8272){var _0x386c44=function(_0x18e9f0){while(--_0x18e9f0){_0x2e44d9['push'](_0x2e44d9['shift']());}};_0x386c44(++_0x5b8272);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 093880d..ed3ca86 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 _0xa9e0=['addFavicon','put','isAuthenticated','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','single','addLogo','logologin','extname','file','addLogoLogin','preferred','addPreferred','%s%s','favicon'];(function(_0x22d403,_0x2995a1){var _0x44178d=function(_0x389da8){while(--_0x389da8){_0x22d403['push'](_0x22d403['shift']());}};_0x44178d(++_0x2995a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),controller['getDate']);router['get'](_0x0a9e('0xb'),controller['show']);router['get'](_0x0a9e('0xc'),controller[_0x0a9e('0xd')]);router[_0x0a9e('0x8')](_0x0a9e('0xe'),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x8')]('/:id/gdpr',controller['gdpr']);router['get']('/:id/preferred',controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x69aeb7,_0x5db4b0,_0x4283ce){_0x4283ce(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x44dcfd,_0x4d5611,_0x52a03d){_0x52a03d(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x18'),path['extname'](_0x4d5611[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/logo',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x1c')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x106033,_0x205fd6,_0x31b1ca){_0x31b1ca(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x1314ae,_0x112016,_0x1c696a){_0x1c696a(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x1d'),path[_0x0a9e('0x1e')](_0x112016['originalname'])));}})});router[_0x0a9e('0x1a')]('/:id/logo_login',upload['single'](_0x0a9e('0x1f')),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x30bae6,_0x4abc77,_0xfb6e48){_0xfb6e48(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x370d86,_0x42ac8f,_0x16b1ca){_0x16b1ca(null,util['format']('%s%s',_0x0a9e('0x21'),path[_0x0a9e('0x1e')](_0x42ac8f[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/preferred',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1dc186,_0x34dc65,_0x25fba9){_0x25fba9(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x11c3b6,_0x14de77,_0x5a101a){_0x5a101a(null,util[_0x0a9e('0x17')](_0x0a9e('0x23'),_0x0a9e('0x24'),path[_0x0a9e('0x1e')](_0x14de77['originalname'])));}})});router[_0x0a9e('0x1a')](_0x0a9e('0x11'),upload[_0x0a9e('0x1b')](_0x0a9e('0x1f')),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x26')](_0x0a9e('0xb'),auth[_0x0a9e('0x27')](),controller[_0x0a9e('0x28')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['addFavicon','put','isAuthenticated','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','single','addLogo','logologin','extname','file','addLogoLogin','preferred','addPreferred','%s%s','favicon'];(function(_0x51ab83,_0x2721b9){var _0x14b6de=function(_0x243483){while(--_0x243483){_0x51ab83['push'](_0x51ab83['shift']());}};_0x14b6de(++_0x2721b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),controller['getDate']);router['get'](_0x0a9e('0xb'),controller['show']);router['get'](_0x0a9e('0xc'),controller[_0x0a9e('0xd')]);router[_0x0a9e('0x8')](_0x0a9e('0xe'),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x8')]('/:id/gdpr',controller['gdpr']);router['get']('/:id/preferred',controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x69aeb7,_0x5db4b0,_0x4283ce){_0x4283ce(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x44dcfd,_0x4d5611,_0x52a03d){_0x52a03d(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x18'),path['extname'](_0x4d5611[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/logo',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x1c')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x106033,_0x205fd6,_0x31b1ca){_0x31b1ca(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x1314ae,_0x112016,_0x1c696a){_0x1c696a(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x1d'),path[_0x0a9e('0x1e')](_0x112016['originalname'])));}})});router[_0x0a9e('0x1a')]('/:id/logo_login',upload['single'](_0x0a9e('0x1f')),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x30bae6,_0x4abc77,_0xfb6e48){_0xfb6e48(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x370d86,_0x42ac8f,_0x16b1ca){_0x16b1ca(null,util['format']('%s%s',_0x0a9e('0x21'),path[_0x0a9e('0x1e')](_0x42ac8f[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/preferred',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1dc186,_0x34dc65,_0x25fba9){_0x25fba9(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x11c3b6,_0x14de77,_0x5a101a){_0x5a101a(null,util[_0x0a9e('0x17')](_0x0a9e('0x23'),_0x0a9e('0x24'),path[_0x0a9e('0x1e')](_0x14de77['originalname'])));}})});router[_0x0a9e('0x1a')](_0x0a9e('0x11'),upload[_0x0a9e('0x1b')](_0x0a9e('0x1f')),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x26')](_0x0a9e('0xb'),auth[_0x0a9e('0x27')](),controller[_0x0a9e('0x28')]);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 77b5449..663bf7b 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 _0xe5a3=['alternate','UNSIGNED','sequelize','INTEGER','min_internal','min_mailbox','STRING','BOOLEAN'];(function(_0x4c9a69,_0x212a9d){var _0x46fd53=function(_0x54ab41){while(--_0x54ab41){_0x4c9a69['push'](_0x4c9a69['shift']());}};_0x46fd53(++_0x212a9d);}(_0xe5a3,0x1c2));var _0x3e5a=function(_0x3f9349,_0x5733b8){_0x3f9349=_0x3f9349-0x0;var _0x53a6e5=_0xe5a3[_0x3f9349];return _0x53a6e5;};'use strict';var Sequelize=require(_0x3e5a('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x3e5a('0x1')](0xb),'unique':_0x3e5a('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x3e5a('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x3e5a('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x3e5a('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x3e5a('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x3e5a('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x3e5a('0x4')]},'turnaddr':{'type':Sequelize[_0x3e5a('0x4')]},'turnusername':{'type':Sequelize[_0x3e5a('0x4')]},'turnpassword':{'type':Sequelize[_0x3e5a('0x4')]},'pageTitle':{'type':Sequelize[_0x3e5a('0x4')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x3e5a('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x3e5a('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x3e5a('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x3e5a('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x3e5a('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x3e5a('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x3e5a('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x3e5a('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x3e5a('0x4')],'defaultValue':_0x3e5a('0x6')},'chatTimeout':{'type':Sequelize[_0x3e5a('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x3e5a('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x3e5a('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x3e5a('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x3e5a('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x3e5a('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x3e5a('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x3e5a('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x3e5a('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x3e5a('0x1')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x3e5a('0x4')]},'language':{'type':Sequelize[_0x3e5a('0x4')]},'bucket':{'type':Sequelize[_0x3e5a('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x3e5a('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x3e5a('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x3e5a('0x1')](0x2)[_0x3e5a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x3e5a('0x1')](0x2)[_0x3e5a('0x7')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x3e5a('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x3e5a('0x1')](0x2)[_0x3e5a('0x7')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x3e5a('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x3e5a('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x3e5a('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x3e5a('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x3e5a('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x3e5a('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xe574=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED','exports','min_internal','INTEGER','min_mailbox','STRING'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0xe574,0x13f));var _0x4e57=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xe574[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require('sequelize');module[_0x4e57('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x4e57('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x4e57('0x2')](0xb),'unique':_0x4e57('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x4e57('0x4')],'defaultValue':_0x4e57('0x5')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x4e57('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x4e57('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x4e57('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x4e57('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x4e57('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x4e57('0x4')]},'turnaddr':{'type':Sequelize[_0x4e57('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x4e57('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x4e57('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x4e57('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x4e57('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x4e57('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x4e57('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x4e57('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x4e57('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x4e57('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x4e57('0x4')],'defaultValue':_0x4e57('0x7')},'chatTimeout':{'type':Sequelize[_0x4e57('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x4e57('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x4e57('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x4e57('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x4e57('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x4e57('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x4e57('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x4e57('0x4')]},'defaultFavicon':{'type':Sequelize[_0x4e57('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x4e57('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x4e57('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x4e57('0x2')]},'transcribeRegion':{'type':Sequelize[_0x4e57('0x4')]},'sentiment':{'type':Sequelize[_0x4e57('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x4e57('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4e57('0x4')]},'bucket':{'type':Sequelize[_0x4e57('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x4e57('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x4e57('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x4e57('0x2')](0x2)[_0x4e57('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x4e57('0x2')](0x2)[_0x4e57('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x4e57('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x4e57('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x4e57('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x4e57('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x4e57('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x4e57('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 1feb0a9..6096c85 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 _0xbfa1=['reject','save','update','end','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','body','find','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','preferred','favicon','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xbfa1,0x1cf));var _0x1bfa=function(_0x508986,_0x43d040){_0x508986=_0x508986-0x0;var _0x25d13a=_0xbfa1[_0x508986];return _0x25d13a;};'use strict';var emlformat=require(_0x1bfa('0x0'));var rimraf=require(_0x1bfa('0x1'));var zipdir=require(_0x1bfa('0x2'));var jsonpatch=require(_0x1bfa('0x3'));var rp=require(_0x1bfa('0x4'));var moment=require(_0x1bfa('0x5'));var BPromise=require(_0x1bfa('0x6'));var Mustache=require(_0x1bfa('0x7'));var util=require(_0x1bfa('0x8'));var path=require(_0x1bfa('0x9'));var sox=require(_0x1bfa('0xa'));var csv=require('to-csv');var ejs=require(_0x1bfa('0xb'));var fs=require('fs');var fs_extra=require(_0x1bfa('0xc'));var _=require('lodash');var squel=require(_0x1bfa('0xd'));var crypto=require(_0x1bfa('0xe'));var jsforce=require(_0x1bfa('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1bfa('0x10'));var querystring=require(_0x1bfa('0x11'));var Papa=require(_0x1bfa('0x12'));var Redis=require('ioredis');var authService=require(_0x1bfa('0x13'));var qs=require(_0x1bfa('0x14'));var as=require(_0x1bfa('0x15'));var hardwareService=require(_0x1bfa('0x16'));var logger=require(_0x1bfa('0x17'))('api');var utils=require(_0x1bfa('0x18'));var config=require(_0x1bfa('0x19'));var licenseUtil=require(_0x1bfa('0x1a'));var db=require(_0x1bfa('0x1b'))['db'];var jayson=require(_0x1bfa('0x1c'));var client=jayson[_0x1bfa('0x1d')][_0x1bfa('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1ff6bc,_0x4e32d3,_0x5d52cd,_0x8694d8){return new BPromise(function(_0x4f1c29,_0x7deac9){var _0x349f8d=_0x8694d8||client;return _0x349f8d[_0x1bfa('0x1f')](_0x1ff6bc,_0x5d52cd)[_0x1bfa('0x20')](function(_0x4cbcf3){logger[_0x1bfa('0x21')](_0x1bfa('0x22'),_0x4e32d3,_0x1bfa('0x23'));logger['debug'](_0x1bfa('0x24'),_0x4e32d3,_0x1bfa('0x23'),JSON[_0x1bfa('0x25')](_0x4cbcf3));if(_0x4cbcf3[_0x1bfa('0x26')]){if(_0x4cbcf3[_0x1bfa('0x26')]['code']===0x1f4){logger[_0x1bfa('0x26')](_0x1bfa('0x22'),_0x4e32d3,_0x4cbcf3[_0x1bfa('0x26')][_0x1bfa('0x27')]);return _0x7deac9(_0x4cbcf3[_0x1bfa('0x26')]['message']);}logger[_0x1bfa('0x26')](_0x1bfa('0x22'),_0x4e32d3,_0x4cbcf3[_0x1bfa('0x26')][_0x1bfa('0x27')]);return _0x4f1c29(_0x4cbcf3[_0x1bfa('0x26')]['message']);}else{logger[_0x1bfa('0x21')]('Setting,\x20%s,\x20%s',_0x4e32d3,_0x1bfa('0x23'));_0x4f1c29(_0x4cbcf3['result']['message']);}})['catch'](function(_0x5e0fd6){logger[_0x1bfa('0x26')](_0x1bfa('0x22'),_0x4e32d3,_0x5e0fd6);_0x7deac9(_0x5e0fd6);});});}function respondWithStatusCode(_0x579035,_0x409145){_0x409145=_0x409145||0xcc;return function(_0xa8ebb){if(_0xa8ebb){return _0x579035[_0x1bfa('0x28')](_0x409145);}return _0x579035[_0x1bfa('0x29')](_0x409145)['end']();};}function respondWithResult(_0x48f13f,_0x499333){_0x499333=_0x499333||0xc8;return function(_0x4f622e){if(_0x4f622e){return _0x48f13f[_0x1bfa('0x29')](_0x499333)[_0x1bfa('0x2a')](_0x4f622e);}};}function respondWithFilteredResult(_0x691912,_0x5ca245){return function(_0x353399){if(_0x353399){var _0xc7df1e=typeof _0x5ca245[_0x1bfa('0x2b')]===_0x1bfa('0x2c')&&typeof _0x5ca245[_0x1bfa('0x2d')]==='undefined';var _0x449d48=_0x353399[_0x1bfa('0x2e')];var _0x5d8e1e=_0xc7df1e?0x0:_0x5ca245[_0x1bfa('0x2b')];var _0xbfc54a=_0xc7df1e?_0x353399['count']:_0x5ca245[_0x1bfa('0x2b')]+_0x5ca245[_0x1bfa('0x2d')];var _0x5a2dec;if(_0xbfc54a>=_0x449d48){_0xbfc54a=_0x449d48;_0x5a2dec=0xc8;}else{_0x5a2dec=0xce;}_0x691912[_0x1bfa('0x29')](_0x5a2dec);return _0x691912[_0x1bfa('0x2f')](_0x1bfa('0x30'),_0x5d8e1e+'-'+_0xbfc54a+'/'+_0x449d48)[_0x1bfa('0x2a')](_0x353399);}return null;};}function patchUpdates(_0x2c81dd){return function(_0x4e41c2){try{jsonpatch['apply'](_0x4e41c2,_0x2c81dd,!![]);}catch(_0x577908){return BPromise[_0x1bfa('0x31')](_0x577908);}return _0x4e41c2[_0x1bfa('0x32')]();};}function saveUpdates(_0x2b35b3,_0x1b439b){return function(_0x531df0){if(_0x531df0){return _0x531df0[_0x1bfa('0x33')](_0x2b35b3)[_0x1bfa('0x20')](function(_0x50b8d8){return _0x50b8d8;});}return null;};}function removeEntity(_0x3d4b45,_0x5194a6){return function(_0x40fa2f){if(_0x40fa2f){return _0x40fa2f['destroy']()['then'](function(){_0x3d4b45[_0x1bfa('0x29')](0xcc)[_0x1bfa('0x34')]();});}};}function handleEntityNotFound(_0x6c54e2,_0xb49d4c){return function(_0x4f24dd){if(!_0x4f24dd){_0x6c54e2[_0x1bfa('0x28')](0x194);}return _0x4f24dd;};}function handleError(_0x504552,_0x443489){_0x443489=_0x443489||0x1f4;return function(_0x245c36){logger['error'](_0x245c36[_0x1bfa('0x35')]);if(_0x245c36[_0x1bfa('0x36')]){delete _0x245c36['name'];}_0x504552['status'](_0x443489)[_0x1bfa('0x37')](_0x245c36);};}exports[_0x1bfa('0x38')]=function(_0x745eda,_0x174c41){var _0xec8130={},_0x2fe39d={},_0x3a1b46={'count':0x0,'rows':[]};var _0x33cc67=_[_0x1bfa('0x39')](db[_0x1bfa('0x3a')][_0x1bfa('0x3b')],function(_0x3a0fbe){return{'name':_0x3a0fbe[_0x1bfa('0x3c')],'type':_0x3a0fbe[_0x1bfa('0x3d')][_0x1bfa('0x3e')]};});_0x2fe39d[_0x1bfa('0x3f')]=_[_0x1bfa('0x39')](_0x33cc67,'name');_0x2fe39d[_0x1bfa('0x40')]=_['keys'](_0x745eda['query']);_0x2fe39d[_0x1bfa('0x41')]=_[_0x1bfa('0x42')](_0x2fe39d[_0x1bfa('0x3f')],_0x2fe39d['query']);_0xec8130[_0x1bfa('0x43')]=_['intersection'](_0x2fe39d[_0x1bfa('0x3f')],qs[_0x1bfa('0x44')](_0x745eda['query'][_0x1bfa('0x44')]));_0xec8130[_0x1bfa('0x43')]=_0xec8130['attributes']['length']?_0xec8130[_0x1bfa('0x43')]:_0x2fe39d[_0x1bfa('0x3f')];if(!_0x745eda[_0x1bfa('0x40')]['hasOwnProperty'](_0x1bfa('0x45'))){_0xec8130[_0x1bfa('0x2d')]=qs[_0x1bfa('0x2d')](_0x745eda[_0x1bfa('0x40')][_0x1bfa('0x2d')]);_0xec8130[_0x1bfa('0x2b')]=qs['offset'](_0x745eda[_0x1bfa('0x40')]['offset']);}_0xec8130[_0x1bfa('0x46')]=qs['sort'](_0x745eda[_0x1bfa('0x40')][_0x1bfa('0x47')]);_0xec8130[_0x1bfa('0x48')]=qs[_0x1bfa('0x41')](_['pick'](_0x745eda['query'],_0x2fe39d['filters']),_0x33cc67);if(_0x745eda['query'][_0x1bfa('0x49')]){_0xec8130[_0x1bfa('0x48')]=_[_0x1bfa('0x4a')](_0xec8130[_0x1bfa('0x48')],{'$or':_[_0x1bfa('0x39')](_0x33cc67,function(_0x1b0bb5){if(_0x1b0bb5[_0x1bfa('0x3d')]!==_0x1bfa('0x4b')){var _0x2ff433={};_0x2ff433[_0x1b0bb5[_0x1bfa('0x36')]]={'$like':'%'+_0x745eda[_0x1bfa('0x40')][_0x1bfa('0x49')]+'%'};return _0x2ff433;}})});}_0xec8130=_[_0x1bfa('0x4a')]({},_0xec8130,_0x745eda[_0x1bfa('0x4c')]);var _0x4077ca={'where':_0xec8130['where']};return db[_0x1bfa('0x3a')][_0x1bfa('0x2e')](_0x4077ca)[_0x1bfa('0x20')](function(_0x2adc18){_0x3a1b46[_0x1bfa('0x2e')]=_0x2adc18;if(_0x745eda[_0x1bfa('0x40')][_0x1bfa('0x4d')]){_0xec8130[_0x1bfa('0x4e')]=[{'all':!![]}];}return db[_0x1bfa('0x3a')][_0x1bfa('0x4f')](_0xec8130);})['then'](function(_0x11a3dd){_0x3a1b46[_0x1bfa('0x50')]=_0x11a3dd;return _0x3a1b46;})[_0x1bfa('0x20')](respondWithFilteredResult(_0x174c41,_0xec8130))[_0x1bfa('0x51')](handleError(_0x174c41,null));};exports['show']=function(_0x51183f,_0xf674f2){var _0x5bf547={'raw':![],'where':{'id':_0x51183f[_0x1bfa('0x52')]['id']}},_0x5eee11={};_0x5eee11[_0x1bfa('0x3f')]=_[_0x1bfa('0x53')](db[_0x1bfa('0x3a')]['rawAttributes']);_0x5eee11[_0x1bfa('0x40')]=_[_0x1bfa('0x53')](_0x51183f[_0x1bfa('0x40')]);_0x5eee11['filters']=_[_0x1bfa('0x42')](_0x5eee11[_0x1bfa('0x3f')],_0x5eee11[_0x1bfa('0x40')]);_0x5bf547[_0x1bfa('0x43')]=_[_0x1bfa('0x42')](_0x5eee11[_0x1bfa('0x3f')],qs[_0x1bfa('0x44')](_0x51183f[_0x1bfa('0x40')][_0x1bfa('0x44')]));_0x5bf547['attributes']=_0x5bf547[_0x1bfa('0x43')][_0x1bfa('0x54')]?_0x5bf547['attributes']:_0x5eee11['model'];if(_0x51183f[_0x1bfa('0x40')]['includeAll']){_0x5bf547[_0x1bfa('0x4e')]=[{'all':!![]}];}_0x5bf547=_[_0x1bfa('0x4a')]({},_0x5bf547,_0x51183f[_0x1bfa('0x4c')]);return db['Setting']['find'](_0x5bf547)['then'](handleEntityNotFound(_0xf674f2,null))['then'](respondWithResult(_0xf674f2,null))[_0x1bfa('0x51')](handleError(_0xf674f2,null));};exports[_0x1bfa('0x33')]=function(_0x4cb20d,_0x42d460){if(_0x4cb20d[_0x1bfa('0x55')]['id']){delete _0x4cb20d[_0x1bfa('0x55')]['id'];}return db['Setting'][_0x1bfa('0x56')]({'where':{'id':_0x4cb20d[_0x1bfa('0x52')]['id']}})[_0x1bfa('0x20')](handleEntityNotFound(_0x42d460,null))[_0x1bfa('0x20')](saveUpdates(_0x4cb20d['body'],null))[_0x1bfa('0x20')](respondWithResult(_0x42d460,null))[_0x1bfa('0x51')](handleError(_0x42d460,null));};exports[_0x1bfa('0x57')]=function(_0x14f2c1,_0xbecab7,_0xa03ec6){if(_0x14f2c1[_0x1bfa('0x58')]&&_0x14f2c1[_0x1bfa('0x58')][_0x1bfa('0x59')]){_0x14f2c1[_0x1bfa('0x55')][_0x1bfa('0x5a')]=_0x14f2c1['file'][_0x1bfa('0x59')];}return db[_0x1bfa('0x3a')]['find']({'where':{'id':_0x14f2c1[_0x1bfa('0x52')]['id']}})[_0x1bfa('0x20')](handleEntityNotFound(_0xbecab7,null))[_0x1bfa('0x20')](saveUpdates(_0x14f2c1['body'],null))[_0x1bfa('0x20')](respondWithResult(_0xbecab7,null))[_0x1bfa('0x51')](handleError(_0xbecab7,null));};exports[_0x1bfa('0x5b')]=function(_0x4cb99c,_0x35eb3f,_0x34b98c){if(_0x4cb99c['file']&&_0x4cb99c[_0x1bfa('0x58')][_0x1bfa('0x59')]){_0x4cb99c[_0x1bfa('0x55')][_0x1bfa('0x5c')]=_0x4cb99c['file'][_0x1bfa('0x59')];}return db[_0x1bfa('0x3a')][_0x1bfa('0x56')]({'where':{'id':_0x4cb99c[_0x1bfa('0x52')]['id']}})[_0x1bfa('0x20')](handleEntityNotFound(_0x35eb3f,null))['then'](saveUpdates(_0x4cb99c[_0x1bfa('0x55')],null))[_0x1bfa('0x20')](respondWithResult(_0x35eb3f,null))[_0x1bfa('0x51')](handleError(_0x35eb3f,null));};var utilLicense=require(_0x1bfa('0x1a'));exports[_0x1bfa('0x5d')]=function(_0x1edbb3,_0x41fbcd,_0x776612){var _0x4b739b=_0x1bfa('0x5e');var _0x3a77ff={'custom':![]};return utilLicense[_0x1bfa('0x5f')]()[_0x1bfa('0x20')](function(_0x1fc8d9){if(_0x1fc8d9){_0x3a77ff=_0x1fc8d9;}return db['Setting']['find']({'where':{'id':_0x1edbb3['params']['id']},'attributes':[_0x1bfa('0x5a'),_0x1bfa('0x5c'),'preferred','favicon',_0x1bfa('0x60'),_0x1bfa('0x61'),_0x1bfa('0x62'),_0x1bfa('0x63')],'raw':!![]});})[_0x1bfa('0x20')](handleEntityNotFound(_0x41fbcd,null))[_0x1bfa('0x20')](function(_0x35e869){if(_0x35e869){var _0x379f6b=_0x35e869['logo']&&fs[_0x1bfa('0x64')](path[_0x1bfa('0x65')](config[_0x1bfa('0x66')],_0x4b739b,_[_0x1bfa('0x67')](_0x35e869[_0x1bfa('0x5a')])))?path['join'](config[_0x1bfa('0x66')],_0x4b739b,_[_0x1bfa('0x67')](_0x35e869[_0x1bfa('0x5a')])):path[_0x1bfa('0x65')](config[_0x1bfa('0x66')],_0x4b739b,_[_0x1bfa('0x67')](_0x1bfa('0x68')));var _0x335f24=_0x1bfa('0x69')+_[_0x1bfa('0x6a')](_0x1bfa('0x5a'));if(_0x35e869[_0x335f24]||!_0x3a77ff[_0x1bfa('0x6b')]){_0x379f6b=path[_0x1bfa('0x65')](config[_0x1bfa('0x66')],_0x4b739b,_[_0x1bfa('0x67')](_0x1bfa('0x68')));}if(!fs[_0x1bfa('0x64')](_0x379f6b)){throw new db[(_0x1bfa('0x6c'))][(_0x1bfa('0x6d'))](_[_0x1bfa('0x6a')]('logo')+_0x1bfa('0x6e'));}return _0x41fbcd[_0x1bfa('0x6f')](_0x379f6b);}})[_0x1bfa('0x51')](handleError(_0x41fbcd,null));};var utilLicense=require(_0x1bfa('0x1a'));exports[_0x1bfa('0x70')]=function(_0x522b7f,_0x98d889,_0x37999b){var _0x20a5c2=_0x1bfa('0x5e');var _0x13b561={'custom':![]};return utilLicense[_0x1bfa('0x5f')]()[_0x1bfa('0x20')](function(_0x2fb01a){if(_0x2fb01a){_0x13b561=_0x2fb01a;}return db[_0x1bfa('0x3a')][_0x1bfa('0x56')]({'where':{'id':_0x522b7f['params']['id']},'attributes':[_0x1bfa('0x5a'),'loginLogo',_0x1bfa('0x71'),_0x1bfa('0x72'),_0x1bfa('0x60'),_0x1bfa('0x61'),_0x1bfa('0x62'),_0x1bfa('0x63')],'raw':!![]});})[_0x1bfa('0x20')](handleEntityNotFound(_0x98d889,null))[_0x1bfa('0x20')](function(_0xa45492){if(_0xa45492){var _0x4e6970=_0xa45492[_0x1bfa('0x5c')]&&fs[_0x1bfa('0x64')](path[_0x1bfa('0x65')](config[_0x1bfa('0x66')],_0x20a5c2,_[_0x1bfa('0x67')](_0xa45492[_0x1bfa('0x5c')])))?path['join'](config[_0x1bfa('0x66')],_0x20a5c2,_[_0x1bfa('0x67')](_0xa45492[_0x1bfa('0x5c')])):path['join'](config['root'],_0x20a5c2,_[_0x1bfa('0x67')](_0x1bfa('0x73')));var _0x3e2338=_0x1bfa('0x69')+_[_0x1bfa('0x6a')]('loginLogo');if(_0xa45492[_0x3e2338]||!_0x13b561[_0x1bfa('0x6b')]){_0x4e6970=path[_0x1bfa('0x65')](config[_0x1bfa('0x66')],_0x20a5c2,_[_0x1bfa('0x67')](_0x1bfa('0x73')));}if(!fs[_0x1bfa('0x64')](_0x4e6970)){throw new db[(_0x1bfa('0x6c'))][(_0x1bfa('0x6d'))](_['upperFirst'](_0x1bfa('0x5c'))+_0x1bfa('0x6e'));}return _0x98d889['download'](_0x4e6970);}})[_0x1bfa('0x51')](handleError(_0x98d889,null));};exports[_0x1bfa('0x74')]=function(_0x3ac5b4,_0xc1f0c8){return db['Setting'][_0x1bfa('0x56')]({'where':{'id':_0x3ac5b4['params']['id']},'attributes':[_0x1bfa('0x75')]})[_0x1bfa('0x20')](respondWithResult(_0xc1f0c8,null))['catch'](handleError(_0xc1f0c8,null));};exports[_0x1bfa('0x76')]=function(_0x4c0466,_0x528aa7,_0x16edfc){if(_0x4c0466['file']&&_0x4c0466[_0x1bfa('0x58')]['filename']){_0x4c0466['body'][_0x1bfa('0x71')]=_0x4c0466[_0x1bfa('0x58')][_0x1bfa('0x59')];}return db[_0x1bfa('0x3a')][_0x1bfa('0x56')]({'where':{'id':_0x4c0466['params']['id']}})['then'](handleEntityNotFound(_0x528aa7,null))[_0x1bfa('0x20')](saveUpdates(_0x4c0466[_0x1bfa('0x55')],null))[_0x1bfa('0x20')](respondWithResult(_0x528aa7,null))['catch'](handleError(_0x528aa7,null));};var utilLicense=require(_0x1bfa('0x1a'));exports[_0x1bfa('0x77')]=function(_0x1bc7b2,_0xb94a62,_0x5623bf){var _0x984cbd=_0x1bfa('0x5e');var _0x2abc24={'custom':![]};return utilLicense[_0x1bfa('0x5f')]()['then'](function(_0x4612af){if(_0x4612af){_0x2abc24=_0x4612af;}return db[_0x1bfa('0x3a')]['find']({'where':{'id':_0x1bc7b2['params']['id']},'attributes':[_0x1bfa('0x5a'),'loginLogo',_0x1bfa('0x71'),'favicon',_0x1bfa('0x60'),_0x1bfa('0x61'),_0x1bfa('0x62'),_0x1bfa('0x63')],'raw':!![]});})['then'](handleEntityNotFound(_0xb94a62,null))[_0x1bfa('0x20')](function(_0x10cffd){if(_0x10cffd){var _0x3098a2=_0x10cffd[_0x1bfa('0x71')]&&fs[_0x1bfa('0x64')](path[_0x1bfa('0x65')](config['root'],_0x984cbd,_[_0x1bfa('0x67')](_0x10cffd[_0x1bfa('0x71')])))?path[_0x1bfa('0x65')](config[_0x1bfa('0x66')],_0x984cbd,_[_0x1bfa('0x67')](_0x10cffd['preferred'])):path[_0x1bfa('0x65')](config[_0x1bfa('0x66')],_0x984cbd,_[_0x1bfa('0x67')](_0x1bfa('0x78')));var _0x504abd='default'+_[_0x1bfa('0x6a')](_0x1bfa('0x71'));if(_0x10cffd[_0x504abd]||!_0x2abc24[_0x1bfa('0x6b')]||!_0x2abc24[_0x1bfa('0x71')]){_0x3098a2=path[_0x1bfa('0x65')](config[_0x1bfa('0x66')],_0x984cbd,_[_0x1bfa('0x67')](_0x1bfa('0x78')));}if(!fs[_0x1bfa('0x64')](_0x3098a2)){throw new db[(_0x1bfa('0x6c'))][(_0x1bfa('0x6d'))](_['upperFirst'](_0x1bfa('0x71'))+_0x1bfa('0x6e'));}return _0xb94a62['download'](_0x3098a2);}})['catch'](handleError(_0xb94a62,null));};exports[_0x1bfa('0x79')]=function(_0x578afe,_0x5c16cd,_0x41e830){if(_0x578afe[_0x1bfa('0x58')]&&_0x578afe[_0x1bfa('0x58')][_0x1bfa('0x59')]){_0x578afe['body'][_0x1bfa('0x72')]=_0x578afe[_0x1bfa('0x58')][_0x1bfa('0x59')];}return db[_0x1bfa('0x3a')][_0x1bfa('0x56')]({'where':{'id':_0x578afe[_0x1bfa('0x52')]['id']}})[_0x1bfa('0x20')](handleEntityNotFound(_0x5c16cd,null))[_0x1bfa('0x20')](saveUpdates(_0x578afe[_0x1bfa('0x55')],null))[_0x1bfa('0x20')](respondWithResult(_0x5c16cd,null))[_0x1bfa('0x51')](handleError(_0x5c16cd,null));};var utilLicense=require(_0x1bfa('0x1a'));exports[_0x1bfa('0x7a')]=function(_0x3c223f,_0x47c88c,_0x18b0ac){var _0x538018=_0x1bfa('0x5e');var _0x5c8f66={'custom':![]};return utilLicense[_0x1bfa('0x5f')]()['then'](function(_0x33824b){if(_0x33824b){_0x5c8f66=_0x33824b;}return db[_0x1bfa('0x3a')][_0x1bfa('0x56')]({'where':{'id':_0x3c223f[_0x1bfa('0x52')]['id']},'attributes':[_0x1bfa('0x5a'),_0x1bfa('0x5c'),_0x1bfa('0x71'),_0x1bfa('0x72'),'defaultLogo',_0x1bfa('0x61'),_0x1bfa('0x62'),_0x1bfa('0x63')],'raw':!![]});})[_0x1bfa('0x20')](handleEntityNotFound(_0x47c88c,null))[_0x1bfa('0x20')](function(_0x1d5083){if(_0x1d5083){var _0x41092c=_0x1d5083[_0x1bfa('0x72')]&&fs[_0x1bfa('0x64')](path[_0x1bfa('0x65')](config['root'],_0x538018,_[_0x1bfa('0x67')](_0x1d5083[_0x1bfa('0x72')])))?path[_0x1bfa('0x65')](config[_0x1bfa('0x66')],_0x538018,_[_0x1bfa('0x67')](_0x1d5083[_0x1bfa('0x72')])):path[_0x1bfa('0x65')](config[_0x1bfa('0x66')],_0x538018,_[_0x1bfa('0x67')](_0x1bfa('0x7b')));var _0x4eb9eb=_0x1bfa('0x69')+_['upperFirst']('favicon');if(_0x1d5083[_0x4eb9eb]||!_0x5c8f66[_0x1bfa('0x6b')]){_0x41092c=path[_0x1bfa('0x65')](config[_0x1bfa('0x66')],_0x538018,_[_0x1bfa('0x67')]('default_favicon.ico'));}if(!fs['existsSync'](_0x41092c)){throw new db[(_0x1bfa('0x6c'))]['ValidationError'](_['upperFirst'](_0x1bfa('0x72'))+_0x1bfa('0x6e'));}return _0x47c88c[_0x1bfa('0x6f')](_0x41092c);}})[_0x1bfa('0x51')](handleError(_0x47c88c,null));};exports[_0x1bfa('0x7c')]=function(_0x4277ae,_0x5aa6de){var _0x1b0ee3={'offset':moment()[_0x1bfa('0x7d')]()};_0x1b0ee3[_0x1bfa('0x7e')]=moment()[_0x1bfa('0x7d')](_0x1b0ee3[_0x1bfa('0x2b')])[_0x1bfa('0x7f')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x5aa6de['status'](0xc8)[_0x1bfa('0x37')](_0x1b0ee3);}; \ No newline at end of file +var _0xf775=['join','upperFirst','custom','default_logo.svg','Sequelize','ValidationError','\x20not\x20found','download','defaultLoginLogo','defaultFavicon','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','preferred','default_preferred.png','default','addFavicon','getFavicon','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','destroy','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','Setting','includeAll','include','rows','catch','show','params','options','find','body','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultPreferred','existsSync','root','toLower'];(function(_0x2db267,_0x4f43ff){var _0x194da3=function(_0x1d1728){while(--_0x1d1728){_0x2db267['push'](_0x2db267['shift']());}};_0x194da3(++_0x4f43ff);}(_0xf775,0x107));var _0x5f77=function(_0x3fcc8d,_0x1f0e71){_0x3fcc8d=_0x3fcc8d-0x0;var _0x238edb=_0xf775[_0x3fcc8d];return _0x238edb;};'use strict';var emlformat=require(_0x5f77('0x0'));var rimraf=require(_0x5f77('0x1'));var zipdir=require(_0x5f77('0x2'));var jsonpatch=require(_0x5f77('0x3'));var rp=require(_0x5f77('0x4'));var moment=require(_0x5f77('0x5'));var BPromise=require(_0x5f77('0x6'));var Mustache=require(_0x5f77('0x7'));var util=require(_0x5f77('0x8'));var path=require(_0x5f77('0x9'));var sox=require('sox');var csv=require(_0x5f77('0xa'));var ejs=require(_0x5f77('0xb'));var fs=require('fs');var fs_extra=require(_0x5f77('0xc'));var _=require(_0x5f77('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5f77('0xe'));var toCsv=require(_0x5f77('0xa'));var querystring=require(_0x5f77('0xf'));var Papa=require('papaparse');var Redis=require(_0x5f77('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5f77('0x11'));var as=require(_0x5f77('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5f77('0x13'));var utils=require(_0x5f77('0x14'));var config=require(_0x5f77('0x15'));var licenseUtil=require(_0x5f77('0x16'));var db=require(_0x5f77('0x17'))['db'];var jayson=require(_0x5f77('0x18'));var client=jayson['client'][_0x5f77('0x19')]({'port':0x232a});function respondWithRpcPromise(_0xbbda5,_0x2e557a,_0x5bf4be,_0x183a20){return new BPromise(function(_0xb1d759,_0x2ff04b){var _0x5d2edf=_0x183a20||client;return _0x5d2edf['request'](_0xbbda5,_0x5bf4be)[_0x5f77('0x1a')](function(_0x2f0920){logger[_0x5f77('0x1b')]('Setting,\x20%s,\x20%s',_0x2e557a,_0x5f77('0x1c'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x2e557a,_0x5f77('0x1c'),JSON[_0x5f77('0x1d')](_0x2f0920));if(_0x2f0920[_0x5f77('0x1e')]){if(_0x2f0920['error'][_0x5f77('0x1f')]===0x1f4){logger[_0x5f77('0x1e')](_0x5f77('0x20'),_0x2e557a,_0x2f0920['error'][_0x5f77('0x21')]);return _0x2ff04b(_0x2f0920[_0x5f77('0x1e')]['message']);}logger[_0x5f77('0x1e')]('Setting,\x20%s,\x20%s',_0x2e557a,_0x2f0920[_0x5f77('0x1e')]['message']);return _0xb1d759(_0x2f0920[_0x5f77('0x1e')][_0x5f77('0x21')]);}else{logger['info'](_0x5f77('0x20'),_0x2e557a,_0x5f77('0x1c'));_0xb1d759(_0x2f0920[_0x5f77('0x22')]['message']);}})['catch'](function(_0x1161c9){logger[_0x5f77('0x1e')]('Setting,\x20%s,\x20%s',_0x2e557a,_0x1161c9);_0x2ff04b(_0x1161c9);});});}function respondWithStatusCode(_0x3abc5f,_0xe81153){_0xe81153=_0xe81153||0xcc;return function(_0x29db37){if(_0x29db37){return _0x3abc5f[_0x5f77('0x23')](_0xe81153);}return _0x3abc5f[_0x5f77('0x24')](_0xe81153)[_0x5f77('0x25')]();};}function respondWithResult(_0x475ed2,_0x531b96){_0x531b96=_0x531b96||0xc8;return function(_0x43fb52){if(_0x43fb52){return _0x475ed2[_0x5f77('0x24')](_0x531b96)[_0x5f77('0x26')](_0x43fb52);}};}function respondWithFilteredResult(_0x101f0e,_0x3a10d5){return function(_0x391859){if(_0x391859){var _0x4a8fbb=typeof _0x3a10d5[_0x5f77('0x27')]===_0x5f77('0x28')&&typeof _0x3a10d5[_0x5f77('0x29')]===_0x5f77('0x28');var _0x568ddb=_0x391859['count'];var _0x49d75e=_0x4a8fbb?0x0:_0x3a10d5[_0x5f77('0x27')];var _0x27b39d=_0x4a8fbb?_0x391859[_0x5f77('0x2a')]:_0x3a10d5['offset']+_0x3a10d5[_0x5f77('0x29')];var _0x3e1f4b;if(_0x27b39d>=_0x568ddb){_0x27b39d=_0x568ddb;_0x3e1f4b=0xc8;}else{_0x3e1f4b=0xce;}_0x101f0e[_0x5f77('0x24')](_0x3e1f4b);return _0x101f0e['set']('Content-Range',_0x49d75e+'-'+_0x27b39d+'/'+_0x568ddb)['json'](_0x391859);}return null;};}function patchUpdates(_0x573bf9){return function(_0x25104a){try{jsonpatch[_0x5f77('0x2b')](_0x25104a,_0x573bf9,!![]);}catch(_0x2f6bfe){return BPromise[_0x5f77('0x2c')](_0x2f6bfe);}return _0x25104a['save']();};}function saveUpdates(_0x58b9d9,_0x4428f0){return function(_0x497995){if(_0x497995){return _0x497995[_0x5f77('0x2d')](_0x58b9d9)[_0x5f77('0x1a')](function(_0x5f084d){return _0x5f084d;});}return null;};}function removeEntity(_0x46a5d8,_0x4af49b){return function(_0x30197c){if(_0x30197c){return _0x30197c[_0x5f77('0x2e')]()[_0x5f77('0x1a')](function(){_0x46a5d8['status'](0xcc)[_0x5f77('0x25')]();});}};}function handleEntityNotFound(_0x2f8afb,_0x5697d7){return function(_0x3446a8){if(!_0x3446a8){_0x2f8afb['sendStatus'](0x194);}return _0x3446a8;};}function handleError(_0x46db09,_0x4a294e){_0x4a294e=_0x4a294e||0x1f4;return function(_0x4f54c6){logger[_0x5f77('0x1e')](_0x4f54c6[_0x5f77('0x2f')]);if(_0x4f54c6[_0x5f77('0x30')]){delete _0x4f54c6[_0x5f77('0x30')];}_0x46db09[_0x5f77('0x24')](_0x4a294e)[_0x5f77('0x31')](_0x4f54c6);};}exports['index']=function(_0xd753ad,_0x3d9b5a){var _0x5b72e5={},_0x1a4d7e={},_0x58c62b={'count':0x0,'rows':[]};var _0x33e24b=_[_0x5f77('0x32')](db['Setting'][_0x5f77('0x33')],function(_0x30f717){return{'name':_0x30f717[_0x5f77('0x34')],'type':_0x30f717['type'][_0x5f77('0x35')]};});_0x1a4d7e[_0x5f77('0x36')]=_[_0x5f77('0x32')](_0x33e24b,'name');_0x1a4d7e[_0x5f77('0x37')]=_[_0x5f77('0x38')](_0xd753ad[_0x5f77('0x37')]);_0x1a4d7e[_0x5f77('0x39')]=_[_0x5f77('0x3a')](_0x1a4d7e[_0x5f77('0x36')],_0x1a4d7e[_0x5f77('0x37')]);_0x5b72e5[_0x5f77('0x3b')]=_[_0x5f77('0x3a')](_0x1a4d7e[_0x5f77('0x36')],qs[_0x5f77('0x3c')](_0xd753ad[_0x5f77('0x37')][_0x5f77('0x3c')]));_0x5b72e5['attributes']=_0x5b72e5[_0x5f77('0x3b')][_0x5f77('0x3d')]?_0x5b72e5['attributes']:_0x1a4d7e['model'];if(!_0xd753ad['query'][_0x5f77('0x3e')](_0x5f77('0x3f'))){_0x5b72e5[_0x5f77('0x29')]=qs['limit'](_0xd753ad[_0x5f77('0x37')][_0x5f77('0x29')]);_0x5b72e5[_0x5f77('0x27')]=qs[_0x5f77('0x27')](_0xd753ad[_0x5f77('0x37')][_0x5f77('0x27')]);}_0x5b72e5[_0x5f77('0x40')]=qs[_0x5f77('0x41')](_0xd753ad[_0x5f77('0x37')][_0x5f77('0x41')]);_0x5b72e5[_0x5f77('0x42')]=qs['filters'](_[_0x5f77('0x43')](_0xd753ad[_0x5f77('0x37')],_0x1a4d7e[_0x5f77('0x39')]),_0x33e24b);if(_0xd753ad['query'][_0x5f77('0x44')]){_0x5b72e5[_0x5f77('0x42')]=_['merge'](_0x5b72e5['where'],{'$or':_[_0x5f77('0x32')](_0x33e24b,function(_0x2fcfae){if(_0x2fcfae['type']!=='VIRTUAL'){var _0x3149d3={};_0x3149d3[_0x2fcfae[_0x5f77('0x30')]]={'$like':'%'+_0xd753ad['query']['filter']+'%'};return _0x3149d3;}})});}_0x5b72e5=_[_0x5f77('0x45')]({},_0x5b72e5,_0xd753ad['options']);var _0x3d4344={'where':_0x5b72e5['where']};return db[_0x5f77('0x46')][_0x5f77('0x2a')](_0x3d4344)[_0x5f77('0x1a')](function(_0x3b8673){_0x58c62b['count']=_0x3b8673;if(_0xd753ad[_0x5f77('0x37')][_0x5f77('0x47')]){_0x5b72e5[_0x5f77('0x48')]=[{'all':!![]}];}return db[_0x5f77('0x46')]['findAll'](_0x5b72e5);})['then'](function(_0x420d51){_0x58c62b[_0x5f77('0x49')]=_0x420d51;return _0x58c62b;})[_0x5f77('0x1a')](respondWithFilteredResult(_0x3d9b5a,_0x5b72e5))[_0x5f77('0x4a')](handleError(_0x3d9b5a,null));};exports[_0x5f77('0x4b')]=function(_0x30acc1,_0x59c8bb){var _0x4b19a3={'raw':![],'where':{'id':_0x30acc1[_0x5f77('0x4c')]['id']}},_0x1515e8={};_0x1515e8[_0x5f77('0x36')]=_['keys'](db['Setting']['rawAttributes']);_0x1515e8[_0x5f77('0x37')]=_[_0x5f77('0x38')](_0x30acc1['query']);_0x1515e8[_0x5f77('0x39')]=_['intersection'](_0x1515e8[_0x5f77('0x36')],_0x1515e8[_0x5f77('0x37')]);_0x4b19a3[_0x5f77('0x3b')]=_[_0x5f77('0x3a')](_0x1515e8[_0x5f77('0x36')],qs['fields'](_0x30acc1[_0x5f77('0x37')][_0x5f77('0x3c')]));_0x4b19a3[_0x5f77('0x3b')]=_0x4b19a3[_0x5f77('0x3b')][_0x5f77('0x3d')]?_0x4b19a3[_0x5f77('0x3b')]:_0x1515e8[_0x5f77('0x36')];if(_0x30acc1['query'][_0x5f77('0x47')]){_0x4b19a3[_0x5f77('0x48')]=[{'all':!![]}];}_0x4b19a3=_[_0x5f77('0x45')]({},_0x4b19a3,_0x30acc1[_0x5f77('0x4d')]);return db[_0x5f77('0x46')][_0x5f77('0x4e')](_0x4b19a3)[_0x5f77('0x1a')](handleEntityNotFound(_0x59c8bb,null))['then'](respondWithResult(_0x59c8bb,null))['catch'](handleError(_0x59c8bb,null));};exports[_0x5f77('0x2d')]=function(_0x110b3c,_0x1d0075){if(_0x110b3c[_0x5f77('0x4f')]['id']){delete _0x110b3c['body']['id'];}return db[_0x5f77('0x46')][_0x5f77('0x4e')]({'where':{'id':_0x110b3c['params']['id']}})[_0x5f77('0x1a')](handleEntityNotFound(_0x1d0075,null))[_0x5f77('0x1a')](saveUpdates(_0x110b3c[_0x5f77('0x4f')],null))['then'](respondWithResult(_0x1d0075,null))[_0x5f77('0x4a')](handleError(_0x1d0075,null));};exports['addLogo']=function(_0x22c754,_0x1ace2c,_0x1b0cce){if(_0x22c754[_0x5f77('0x50')]&&_0x22c754[_0x5f77('0x50')][_0x5f77('0x51')]){_0x22c754[_0x5f77('0x4f')][_0x5f77('0x52')]=_0x22c754['file']['filename'];}return db[_0x5f77('0x46')][_0x5f77('0x4e')]({'where':{'id':_0x22c754['params']['id']}})['then'](handleEntityNotFound(_0x1ace2c,null))[_0x5f77('0x1a')](saveUpdates(_0x22c754[_0x5f77('0x4f')],null))[_0x5f77('0x1a')](respondWithResult(_0x1ace2c,null))['catch'](handleError(_0x1ace2c,null));};exports[_0x5f77('0x53')]=function(_0x38419f,_0x3061e1,_0x23426f){if(_0x38419f[_0x5f77('0x50')]&&_0x38419f[_0x5f77('0x50')][_0x5f77('0x51')]){_0x38419f['body'][_0x5f77('0x54')]=_0x38419f[_0x5f77('0x50')]['filename'];}return db[_0x5f77('0x46')]['find']({'where':{'id':_0x38419f[_0x5f77('0x4c')]['id']}})[_0x5f77('0x1a')](handleEntityNotFound(_0x3061e1,null))[_0x5f77('0x1a')](saveUpdates(_0x38419f['body'],null))[_0x5f77('0x1a')](respondWithResult(_0x3061e1,null))[_0x5f77('0x4a')](handleError(_0x3061e1,null));};var utilLicense=require(_0x5f77('0x16'));exports[_0x5f77('0x55')]=function(_0x4413d8,_0x2670b0,_0x58908b){var _0x11bebe=_0x5f77('0x56');var _0x507e30={'custom':![]};return utilLicense[_0x5f77('0x57')]()[_0x5f77('0x1a')](function(_0x28b3b0){if(_0x28b3b0){_0x507e30=_0x28b3b0;}return db[_0x5f77('0x46')][_0x5f77('0x4e')]({'where':{'id':_0x4413d8[_0x5f77('0x4c')]['id']},'attributes':[_0x5f77('0x52'),_0x5f77('0x54'),'preferred',_0x5f77('0x58'),_0x5f77('0x59'),'defaultLoginLogo',_0x5f77('0x5a'),'defaultFavicon'],'raw':!![]});})[_0x5f77('0x1a')](handleEntityNotFound(_0x2670b0,null))['then'](function(_0x309d24){if(_0x309d24){var _0x25b881=_0x309d24['logo']&&fs[_0x5f77('0x5b')](path['join'](config[_0x5f77('0x5c')],_0x11bebe,_[_0x5f77('0x5d')](_0x309d24[_0x5f77('0x52')])))?path[_0x5f77('0x5e')](config[_0x5f77('0x5c')],_0x11bebe,_[_0x5f77('0x5d')](_0x309d24[_0x5f77('0x52')])):path[_0x5f77('0x5e')](config[_0x5f77('0x5c')],_0x11bebe,_['toLower']('default_logo.svg'));var _0x102620='default'+_[_0x5f77('0x5f')]('logo');if(_0x309d24[_0x102620]||!_0x507e30[_0x5f77('0x60')]){_0x25b881=path[_0x5f77('0x5e')](config[_0x5f77('0x5c')],_0x11bebe,_[_0x5f77('0x5d')](_0x5f77('0x61')));}if(!fs[_0x5f77('0x5b')](_0x25b881)){throw new db[(_0x5f77('0x62'))][(_0x5f77('0x63'))](_[_0x5f77('0x5f')](_0x5f77('0x52'))+_0x5f77('0x64'));}return _0x2670b0[_0x5f77('0x65')](_0x25b881);}})['catch'](handleError(_0x2670b0,null));};var utilLicense=require(_0x5f77('0x16'));exports['getLogoLogin']=function(_0x4a3e1a,_0x5e18c1,_0x1263ef){var _0x3a50d2=_0x5f77('0x56');var _0x297650={'custom':![]};return utilLicense['getLicense']()[_0x5f77('0x1a')](function(_0x415b97){if(_0x415b97){_0x297650=_0x415b97;}return db[_0x5f77('0x46')][_0x5f77('0x4e')]({'where':{'id':_0x4a3e1a['params']['id']},'attributes':[_0x5f77('0x52'),_0x5f77('0x54'),'preferred','favicon','defaultLogo',_0x5f77('0x66'),_0x5f77('0x5a'),_0x5f77('0x67')],'raw':!![]});})[_0x5f77('0x1a')](handleEntityNotFound(_0x5e18c1,null))[_0x5f77('0x1a')](function(_0x1c6004){if(_0x1c6004){var _0x5436cd=_0x1c6004[_0x5f77('0x54')]&&fs['existsSync'](path[_0x5f77('0x5e')](config[_0x5f77('0x5c')],_0x3a50d2,_[_0x5f77('0x5d')](_0x1c6004['loginLogo'])))?path[_0x5f77('0x5e')](config[_0x5f77('0x5c')],_0x3a50d2,_[_0x5f77('0x5d')](_0x1c6004[_0x5f77('0x54')])):path[_0x5f77('0x5e')](config[_0x5f77('0x5c')],_0x3a50d2,_['toLower'](_0x5f77('0x68')));var _0x2e5bf5='default'+_['upperFirst'](_0x5f77('0x54'));if(_0x1c6004[_0x2e5bf5]||!_0x297650[_0x5f77('0x60')]){_0x5436cd=path[_0x5f77('0x5e')](config[_0x5f77('0x5c')],_0x3a50d2,_[_0x5f77('0x5d')](_0x5f77('0x68')));}if(!fs[_0x5f77('0x5b')](_0x5436cd)){throw new db[(_0x5f77('0x62'))][(_0x5f77('0x63'))](_[_0x5f77('0x5f')](_0x5f77('0x54'))+_0x5f77('0x64'));}return _0x5e18c1[_0x5f77('0x65')](_0x5436cd);}})[_0x5f77('0x4a')](handleError(_0x5e18c1,null));};exports[_0x5f77('0x69')]=function(_0x2edbc1,_0x4e64fd){return db['Setting'][_0x5f77('0x4e')]({'where':{'id':_0x2edbc1[_0x5f77('0x4c')]['id']},'attributes':[_0x5f77('0x6a')]})['then'](respondWithResult(_0x4e64fd,null))[_0x5f77('0x4a')](handleError(_0x4e64fd,null));};exports[_0x5f77('0x6b')]=function(_0x2628fd,_0xcdc405,_0x4e44dd){if(_0x2628fd[_0x5f77('0x50')]&&_0x2628fd['file'][_0x5f77('0x51')]){_0x2628fd[_0x5f77('0x4f')]['preferred']=_0x2628fd[_0x5f77('0x50')][_0x5f77('0x51')];}return db[_0x5f77('0x46')][_0x5f77('0x4e')]({'where':{'id':_0x2628fd['params']['id']}})[_0x5f77('0x1a')](handleEntityNotFound(_0xcdc405,null))[_0x5f77('0x1a')](saveUpdates(_0x2628fd['body'],null))[_0x5f77('0x1a')](respondWithResult(_0xcdc405,null))[_0x5f77('0x4a')](handleError(_0xcdc405,null));};var utilLicense=require(_0x5f77('0x16'));exports[_0x5f77('0x6c')]=function(_0x341ed0,_0x57cbbe,_0x2164d4){var _0x4994ac='server/files/images/logos';var _0x3b28b7={'custom':![]};return utilLicense['getLicense']()[_0x5f77('0x1a')](function(_0x21e7da){if(_0x21e7da){_0x3b28b7=_0x21e7da;}return db[_0x5f77('0x46')][_0x5f77('0x4e')]({'where':{'id':_0x341ed0[_0x5f77('0x4c')]['id']},'attributes':[_0x5f77('0x52'),_0x5f77('0x54'),_0x5f77('0x6d'),'favicon',_0x5f77('0x59'),_0x5f77('0x66'),_0x5f77('0x5a'),_0x5f77('0x67')],'raw':!![]});})[_0x5f77('0x1a')](handleEntityNotFound(_0x57cbbe,null))[_0x5f77('0x1a')](function(_0x19d556){if(_0x19d556){var _0x433bed=_0x19d556[_0x5f77('0x6d')]&&fs[_0x5f77('0x5b')](path[_0x5f77('0x5e')](config[_0x5f77('0x5c')],_0x4994ac,_['toLower'](_0x19d556[_0x5f77('0x6d')])))?path[_0x5f77('0x5e')](config[_0x5f77('0x5c')],_0x4994ac,_[_0x5f77('0x5d')](_0x19d556[_0x5f77('0x6d')])):path['join'](config[_0x5f77('0x5c')],_0x4994ac,_[_0x5f77('0x5d')](_0x5f77('0x6e')));var _0xc56f5d=_0x5f77('0x6f')+_[_0x5f77('0x5f')]('preferred');if(_0x19d556[_0xc56f5d]||!_0x3b28b7[_0x5f77('0x60')]||!_0x3b28b7['preferred']){_0x433bed=path[_0x5f77('0x5e')](config[_0x5f77('0x5c')],_0x4994ac,_['toLower'](_0x5f77('0x6e')));}if(!fs['existsSync'](_0x433bed)){throw new db[(_0x5f77('0x62'))][(_0x5f77('0x63'))](_['upperFirst'](_0x5f77('0x6d'))+_0x5f77('0x64'));}return _0x57cbbe[_0x5f77('0x65')](_0x433bed);}})[_0x5f77('0x4a')](handleError(_0x57cbbe,null));};exports[_0x5f77('0x70')]=function(_0x4b05a2,_0x5c5d5a,_0x24c23b){if(_0x4b05a2[_0x5f77('0x50')]&&_0x4b05a2['file']['filename']){_0x4b05a2[_0x5f77('0x4f')][_0x5f77('0x58')]=_0x4b05a2['file'][_0x5f77('0x51')];}return db[_0x5f77('0x46')]['find']({'where':{'id':_0x4b05a2[_0x5f77('0x4c')]['id']}})[_0x5f77('0x1a')](handleEntityNotFound(_0x5c5d5a,null))[_0x5f77('0x1a')](saveUpdates(_0x4b05a2[_0x5f77('0x4f')],null))['then'](respondWithResult(_0x5c5d5a,null))['catch'](handleError(_0x5c5d5a,null));};var utilLicense=require(_0x5f77('0x16'));exports[_0x5f77('0x71')]=function(_0x120e08,_0x307166,_0x39fca6){var _0x5c6355=_0x5f77('0x56');var _0x4ba062={'custom':![]};return utilLicense[_0x5f77('0x57')]()[_0x5f77('0x1a')](function(_0x2cff1a){if(_0x2cff1a){_0x4ba062=_0x2cff1a;}return db['Setting'][_0x5f77('0x4e')]({'where':{'id':_0x120e08[_0x5f77('0x4c')]['id']},'attributes':['logo','loginLogo',_0x5f77('0x6d'),'favicon',_0x5f77('0x59'),_0x5f77('0x66'),_0x5f77('0x5a'),_0x5f77('0x67')],'raw':!![]});})[_0x5f77('0x1a')](handleEntityNotFound(_0x307166,null))[_0x5f77('0x1a')](function(_0x5dc498){if(_0x5dc498){var _0x93c7c6=_0x5dc498[_0x5f77('0x58')]&&fs[_0x5f77('0x5b')](path[_0x5f77('0x5e')](config[_0x5f77('0x5c')],_0x5c6355,_[_0x5f77('0x5d')](_0x5dc498[_0x5f77('0x58')])))?path[_0x5f77('0x5e')](config[_0x5f77('0x5c')],_0x5c6355,_[_0x5f77('0x5d')](_0x5dc498['favicon'])):path[_0x5f77('0x5e')](config[_0x5f77('0x5c')],_0x5c6355,_['toLower']('default_favicon.ico'));var _0x5b425b=_0x5f77('0x6f')+_[_0x5f77('0x5f')](_0x5f77('0x58'));if(_0x5dc498[_0x5b425b]||!_0x4ba062[_0x5f77('0x60')]){_0x93c7c6=path['join'](config[_0x5f77('0x5c')],_0x5c6355,_['toLower']('default_favicon.ico'));}if(!fs[_0x5f77('0x5b')](_0x93c7c6)){throw new db[(_0x5f77('0x62'))][(_0x5f77('0x63'))](_['upperFirst'](_0x5f77('0x58'))+_0x5f77('0x64'));}return _0x307166[_0x5f77('0x65')](_0x93c7c6);}})['catch'](handleError(_0x307166,null));};exports[_0x5f77('0x72')]=function(_0x127fae,_0x244249){var _0x1c2791={'offset':moment()['utcOffset']()};_0x1c2791[_0x5f77('0x73')]=moment()[_0x5f77('0x74')](_0x1c2791[_0x5f77('0x27')])[_0x5f77('0x75')](_0x5f77('0x76'));return _0x244249[_0x5f77('0x24')](0xc8)['send'](_0x1c2791);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 11fba5c..cdd653b 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 _0xd629=['Setting','settings','lodash','util','api','request-promise','../../config/environment','define'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd629,0x1ca));var _0x9d62=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xd629[_0x45f951];return _0x24756c;};'use strict';var _=require(_0x9d62('0x0'));var util=require(_0x9d62('0x1'));var logger=require('../../config/logger')(_0x9d62('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9d62('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9d62('0x4'));var attributes=require('./setting.attributes');module['exports']=function(_0x2cad5c,_0x134af1){return _0x2cad5c[_0x9d62('0x5')](_0x9d62('0x6'),attributes,{'tableName':_0x9d62('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x592f=['define','settings','util','../../config/logger','api','moment','request-promise','../../config/environment','./setting.attributes','exports'];(function(_0x51070b,_0x39c85d){var _0x153240=function(_0x7c02f2){while(--_0x7c02f2){_0x51070b['push'](_0x51070b['shift']());}};_0x153240(++_0x39c85d);}(_0x592f,0x1a6));var _0xf592=function(_0x9e3610,_0x8f6c81){_0x9e3610=_0x9e3610-0x0;var _0x4e72ff=_0x592f[_0x9e3610];return _0x4e72ff;};'use strict';var _=require('lodash');var util=require(_0xf592('0x0'));var logger=require(_0xf592('0x1'))(_0xf592('0x2'));var moment=require(_0xf592('0x3'));var BPromise=require('bluebird');var rp=require(_0xf592('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf592('0x5'));var attributes=require(_0xf592('0x6'));module[_0xf592('0x7')]=function(_0x168aa8,_0x482ad6){return _0x168aa8[_0xf592('0x8')]('Setting',attributes,{'tableName':_0xf592('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 0e5c8b7..d310616 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 _0x6d6c=['then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSetting','Setting','find','options','raw','include','map','attributes','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3250fc,_0x526af6){var _0x114ef8=function(_0x5cec61){while(--_0x5cec61){_0x3250fc['push'](_0x3250fc['shift']());}};_0x114ef8(++_0x526af6);}(_0x6d6c,0x194));var _0xc6d6=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0x6d6c[_0x492535];return _0x256620;};'use strict';var _=require('lodash');var util=require(_0xc6d6('0x0'));var moment=require(_0xc6d6('0x1'));var BPromise=require(_0xc6d6('0x2'));var rs=require(_0xc6d6('0x3'));var fs=require('fs');var Redis=require(_0xc6d6('0x4'));var db=require(_0xc6d6('0x5'))['db'];var utils=require(_0xc6d6('0x6'));var logger=require('../../config/logger')(_0xc6d6('0x7'));var config=require(_0xc6d6('0x8'));var jayson=require(_0xc6d6('0x9'));var client=jayson[_0xc6d6('0xa')][_0xc6d6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27ca72,_0x334c9e,_0x86cd6){return new BPromise(function(_0xf5f075,_0x5e6d57){return client['request'](_0x27ca72,_0x86cd6)[_0xc6d6('0xc')](function(_0x142a83){logger[_0xc6d6('0xd')](_0xc6d6('0xe'),_0x334c9e,_0xc6d6('0xf'));logger[_0xc6d6('0x10')](_0xc6d6('0x11'),_0x334c9e,_0xc6d6('0xf'),JSON[_0xc6d6('0x12')](_0x142a83));if(_0x142a83[_0xc6d6('0x13')]){if(_0x142a83['error'][_0xc6d6('0x14')]===0x1f4){logger[_0xc6d6('0x13')](_0xc6d6('0xe'),_0x334c9e,_0x142a83[_0xc6d6('0x13')][_0xc6d6('0x15')]);return _0x5e6d57(_0x142a83[_0xc6d6('0x13')][_0xc6d6('0x15')]);}logger[_0xc6d6('0x13')](_0xc6d6('0xe'),_0x334c9e,_0x142a83[_0xc6d6('0x13')][_0xc6d6('0x15')]);return _0xf5f075(_0x142a83[_0xc6d6('0x13')][_0xc6d6('0x15')]);}else{logger[_0xc6d6('0xd')](_0xc6d6('0xe'),_0x334c9e,'request\x20sent');_0xf5f075(_0x142a83['result'][_0xc6d6('0x15')]);}})[_0xc6d6('0x16')](function(_0x2d1754){logger[_0xc6d6('0x13')](_0xc6d6('0xe'),_0x334c9e,_0x2d1754);_0x5e6d57(_0x2d1754);});});}exports[_0xc6d6('0x17')]=function(_0x44211e){var _0x10b581=this;return new Promise(function(_0x2450eb,_0x59cd91){return db[_0xc6d6('0x18')][_0xc6d6('0x19')]({'raw':_0x44211e[_0xc6d6('0x1a')]?_0x44211e[_0xc6d6('0x1a')][_0xc6d6('0x1b')]===undefined?!![]:![]:!![],'where':_0x44211e['options']?_0x44211e[_0xc6d6('0x1a')]['where']||null:null,'attributes':_0x44211e[_0xc6d6('0x1a')]?_0x44211e[_0xc6d6('0x1a')]['attributes']||null:null,'include':_0x44211e[_0xc6d6('0x1a')]?_0x44211e[_0xc6d6('0x1a')][_0xc6d6('0x1c')]?_[_0xc6d6('0x1d')](_0x44211e[_0xc6d6('0x1a')][_0xc6d6('0x1c')],function(_0x3963da){return{'model':db[_0x3963da['model']],'as':_0x3963da['as'],'attributes':_0x3963da[_0xc6d6('0x1e')],'include':_0x3963da[_0xc6d6('0x1c')]?_['map'](_0x3963da[_0xc6d6('0x1c')],function(_0x2821db){return{'model':db[_0x2821db['model']],'as':_0x2821db['as'],'attributes':_0x2821db[_0xc6d6('0x1e')],'include':_0x2821db[_0xc6d6('0x1c')]?_[_0xc6d6('0x1d')](_0x2821db[_0xc6d6('0x1c')],function(_0x28b657){return{'model':db[_0x28b657[_0xc6d6('0x1f')]],'as':_0x28b657['as'],'attributes':_0x28b657[_0xc6d6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc6d6('0xc')](function(_0x5163bf){logger['info'](_0xc6d6('0x17'),_0x44211e);logger[_0xc6d6('0x10')](_0xc6d6('0x17'),_0x44211e,JSON[_0xc6d6('0x12')](_0x5163bf));_0x2450eb(_0x5163bf);})[_0xc6d6('0x16')](function(_0x4d66b5){logger[_0xc6d6('0x13')](_0xc6d6('0x17'),_0x4d66b5['message'],_0x44211e);_0x59cd91(_0x10b581[_0xc6d6('0x13')](0x1f4,_0x4d66b5[_0xc6d6('0x15')]));});});}; \ No newline at end of file +var _0xf6b3=['error','code','message','result','catch','Setting','find','options','raw','where','include','map','model','attributes','ShowSetting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x795265,_0x41e6d5){var _0x13c33b=function(_0x15dabb){while(--_0x15dabb){_0x795265['push'](_0x795265['shift']());}};_0x13c33b(++_0x41e6d5);}(_0xf6b3,0x104));var _0x3f6b=function(_0x26013b,_0x23d44e){_0x26013b=_0x26013b-0x0;var _0x16a91f=_0xf6b3[_0x26013b];return _0x16a91f;};'use strict';var _=require('lodash');var util=require(_0x3f6b('0x0'));var moment=require(_0x3f6b('0x1'));var BPromise=require(_0x3f6b('0x2'));var rs=require(_0x3f6b('0x3'));var fs=require('fs');var Redis=require(_0x3f6b('0x4'));var db=require(_0x3f6b('0x5'))['db'];var utils=require(_0x3f6b('0x6'));var logger=require(_0x3f6b('0x7'))(_0x3f6b('0x8'));var config=require(_0x3f6b('0x9'));var jayson=require(_0x3f6b('0xa'));var client=jayson['client'][_0x3f6b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7177b,_0x257b0c,_0x532ca1){return new BPromise(function(_0x5d109a,_0x24c391){return client[_0x3f6b('0xc')](_0x7177b,_0x532ca1)[_0x3f6b('0xd')](function(_0x132904){logger[_0x3f6b('0xe')](_0x3f6b('0xf'),_0x257b0c,_0x3f6b('0x10'));logger[_0x3f6b('0x11')](_0x3f6b('0x12'),_0x257b0c,'request\x20sent',JSON[_0x3f6b('0x13')](_0x132904));if(_0x132904[_0x3f6b('0x14')]){if(_0x132904[_0x3f6b('0x14')][_0x3f6b('0x15')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x257b0c,_0x132904[_0x3f6b('0x14')][_0x3f6b('0x16')]);return _0x24c391(_0x132904[_0x3f6b('0x14')][_0x3f6b('0x16')]);}logger[_0x3f6b('0x14')](_0x3f6b('0xf'),_0x257b0c,_0x132904['error'][_0x3f6b('0x16')]);return _0x5d109a(_0x132904[_0x3f6b('0x14')][_0x3f6b('0x16')]);}else{logger[_0x3f6b('0xe')](_0x3f6b('0xf'),_0x257b0c,_0x3f6b('0x10'));_0x5d109a(_0x132904[_0x3f6b('0x17')][_0x3f6b('0x16')]);}})[_0x3f6b('0x18')](function(_0x249e37){logger['error']('Setting,\x20%s,\x20%s',_0x257b0c,_0x249e37);_0x24c391(_0x249e37);});});}exports['ShowSetting']=function(_0x1613f5){var _0x40c92b=this;return new Promise(function(_0x3d3c09,_0x5c796b){return db[_0x3f6b('0x19')][_0x3f6b('0x1a')]({'raw':_0x1613f5['options']?_0x1613f5[_0x3f6b('0x1b')][_0x3f6b('0x1c')]===undefined?!![]:![]:!![],'where':_0x1613f5[_0x3f6b('0x1b')]?_0x1613f5['options'][_0x3f6b('0x1d')]||null:null,'attributes':_0x1613f5['options']?_0x1613f5[_0x3f6b('0x1b')]['attributes']||null:null,'include':_0x1613f5['options']?_0x1613f5[_0x3f6b('0x1b')][_0x3f6b('0x1e')]?_[_0x3f6b('0x1f')](_0x1613f5['options']['include'],function(_0x524ea4){return{'model':db[_0x524ea4[_0x3f6b('0x20')]],'as':_0x524ea4['as'],'attributes':_0x524ea4['attributes'],'include':_0x524ea4['include']?_[_0x3f6b('0x1f')](_0x524ea4[_0x3f6b('0x1e')],function(_0x2bd2f6){return{'model':db[_0x2bd2f6[_0x3f6b('0x20')]],'as':_0x2bd2f6['as'],'attributes':_0x2bd2f6[_0x3f6b('0x21')],'include':_0x2bd2f6[_0x3f6b('0x1e')]?_['map'](_0x2bd2f6[_0x3f6b('0x1e')],function(_0x4e8715){return{'model':db[_0x4e8715['model']],'as':_0x4e8715['as'],'attributes':_0x4e8715[_0x3f6b('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3f6b('0xd')](function(_0x5467a5){logger[_0x3f6b('0xe')](_0x3f6b('0x22'),_0x1613f5);logger[_0x3f6b('0x11')](_0x3f6b('0x22'),_0x1613f5,JSON[_0x3f6b('0x13')](_0x5467a5));_0x3d3c09(_0x5467a5);})['catch'](function(_0x3f5a83){logger[_0x3f6b('0x14')](_0x3f6b('0x22'),_0x3f5a83['message'],_0x1613f5);_0x5c796b(_0x40c92b[_0x3f6b('0x14')](0x1f4,_0x3f5a83[_0x3f6b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 4534831..5bca5a8 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 _0xb972=['put','delete','destroy','removeDispositions','removeAnswers','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','index','get','isAuthenticated','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','statusGet','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','status','/:id/users','addAgents'];(function(_0x3f5842,_0x275c7a){var _0x39e75b=function(_0x38a43a){while(--_0x38a43a){_0x3f5842['push'](_0x3f5842['shift']());}};_0x39e75b(++_0x275c7a);}(_0xb972,0xfc));var _0x2b97=function(_0x4c9316,_0x5c7f6f){_0x4c9316=_0x4c9316-0x0;var _0x146aad=_0xb972[_0x4c9316];return _0x146aad;};'use strict';var multer=require(_0x2b97('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2b97('0x1'));var express=require(_0x2b97('0x2'));var router=express[_0x2b97('0x3')]();var fs_extra=require(_0x2b97('0x4'));var auth=require(_0x2b97('0x5'));var interaction=require(_0x2b97('0x6'));var config=require(_0x2b97('0x7'));var controller=require(_0x2b97('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2b97('0x9')]);router[_0x2b97('0xa')]('/describe',auth[_0x2b97('0xb')](),controller['describe']);router['get'](_0x2b97('0xc'),auth[_0x2b97('0xb')](),controller[_0x2b97('0xd')]);router[_0x2b97('0xa')]('/:id/dispositions',auth[_0x2b97('0xb')](),controller[_0x2b97('0xe')]);router[_0x2b97('0xa')](_0x2b97('0xf'),auth['isAuthenticated'](),controller[_0x2b97('0x10')]);router[_0x2b97('0xa')]('/:id/applications',auth[_0x2b97('0xb')](),controller[_0x2b97('0x11')]);router['get'](_0x2b97('0x12'),auth[_0x2b97('0xb')](),controller[_0x2b97('0x13')]);router['get']('/:id/status',controller[_0x2b97('0x14')]);router[_0x2b97('0xa')]('/:id/users',auth[_0x2b97('0xb')](),controller[_0x2b97('0x15')]);router[_0x2b97('0x16')]('/',auth[_0x2b97('0xb')](),controller[_0x2b97('0x17')]);router['post'](_0x2b97('0x18'),auth[_0x2b97('0xb')](),controller[_0x2b97('0x19')]);router[_0x2b97('0x16')]('/:id/canned_answers',auth[_0x2b97('0xb')](),controller[_0x2b97('0x1a')]);router['post'](_0x2b97('0x1b'),controller[_0x2b97('0x1c')]);router[_0x2b97('0x16')]('/:id/applications',auth[_0x2b97('0xb')](),controller[_0x2b97('0x1d')]);router[_0x2b97('0x16')](_0x2b97('0x1e'),auth[_0x2b97('0xb')](),controller[_0x2b97('0x1f')]);router['post']('/:id/status',controller[_0x2b97('0x20')]);router[_0x2b97('0x16')](_0x2b97('0x21'),auth[_0x2b97('0xb')](),controller[_0x2b97('0x22')]);router[_0x2b97('0x23')](_0x2b97('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x2b97('0x24')](_0x2b97('0xc'),auth[_0x2b97('0xb')](),controller[_0x2b97('0x25')]);router[_0x2b97('0x24')](_0x2b97('0x18'),auth[_0x2b97('0xb')](),controller[_0x2b97('0x26')]);router[_0x2b97('0x24')](_0x2b97('0xf'),auth[_0x2b97('0xb')](),controller[_0x2b97('0x27')]);router[_0x2b97('0x24')]('/:id/users',auth[_0x2b97('0xb')](),controller['removeAgents']);module[_0x2b97('0x28')]=router; \ No newline at end of file +var _0x9b2c=['send','status','update','destroy','delete','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/status','statusGet','/:id/users','getAgents','post','create','/:id/dispositions','addAnswer','notify','addApplications','/:id/send'];(function(_0x1589c5,_0x4c499b){var _0x2c85fd=function(_0x3ba55a){while(--_0x3ba55a){_0x1589c5['push'](_0x1589c5['shift']());}};_0x2c85fd(++_0x4c499b);}(_0x9b2c,0x1dc));var _0xc9b2=function(_0x5cb367,_0x27ec9d){_0x5cb367=_0x5cb367-0x0;var _0x279365=_0x9b2c[_0x5cb367];return _0x279365;};'use strict';var multer=require(_0xc9b2('0x0'));var util=require(_0xc9b2('0x1'));var path=require('path');var timeout=require(_0xc9b2('0x2'));var express=require(_0xc9b2('0x3'));var router=express[_0xc9b2('0x4')]();var fs_extra=require(_0xc9b2('0x5'));var auth=require(_0xc9b2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc9b2('0x7'));var controller=require(_0xc9b2('0x8'));router[_0xc9b2('0x9')]('/',auth[_0xc9b2('0xa')](),controller[_0xc9b2('0xb')]);router['get']('/describe',auth[_0xc9b2('0xa')](),controller[_0xc9b2('0xc')]);router[_0xc9b2('0x9')](_0xc9b2('0xd'),auth[_0xc9b2('0xa')](),controller[_0xc9b2('0xe')]);router['get']('/:id/dispositions',auth[_0xc9b2('0xa')](),controller[_0xc9b2('0xf')]);router[_0xc9b2('0x9')](_0xc9b2('0x10'),auth['isAuthenticated'](),controller[_0xc9b2('0x11')]);router[_0xc9b2('0x9')](_0xc9b2('0x12'),auth['isAuthenticated'](),controller[_0xc9b2('0x13')]);router[_0xc9b2('0x9')]('/:id/interactions',auth[_0xc9b2('0xa')](),controller['getInteractions']);router[_0xc9b2('0x9')](_0xc9b2('0x14'),controller[_0xc9b2('0x15')]);router['get'](_0xc9b2('0x16'),auth[_0xc9b2('0xa')](),controller[_0xc9b2('0x17')]);router[_0xc9b2('0x18')]('/',auth['isAuthenticated'](),controller[_0xc9b2('0x19')]);router[_0xc9b2('0x18')](_0xc9b2('0x1a'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xc9b2('0x18')](_0xc9b2('0x10'),auth[_0xc9b2('0xa')](),controller[_0xc9b2('0x1b')]);router[_0xc9b2('0x18')]('/:id/notify',controller[_0xc9b2('0x1c')]);router['post'](_0xc9b2('0x12'),auth['isAuthenticated'](),controller[_0xc9b2('0x1d')]);router[_0xc9b2('0x18')](_0xc9b2('0x1e'),auth[_0xc9b2('0xa')](),controller[_0xc9b2('0x1f')]);router[_0xc9b2('0x18')](_0xc9b2('0x14'),controller[_0xc9b2('0x20')]);router[_0xc9b2('0x18')](_0xc9b2('0x16'),auth[_0xc9b2('0xa')](),controller['addAgents']);router['put'](_0xc9b2('0xd'),auth[_0xc9b2('0xa')](),controller[_0xc9b2('0x21')]);router['delete'](_0xc9b2('0xd'),auth[_0xc9b2('0xa')](),controller[_0xc9b2('0x22')]);router[_0xc9b2('0x23')]('/:id/dispositions',auth[_0xc9b2('0xa')](),controller[_0xc9b2('0x24')]);router[_0xc9b2('0x23')](_0xc9b2('0x10'),auth[_0xc9b2('0xa')](),controller[_0xc9b2('0x25')]);router[_0xc9b2('0x23')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xc9b2('0x26')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 359f81a..a57b977 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 _0x8ce8=['clickatell','bandwidth','csc','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','name','generate','ENUM','twilio','clicksend','plivo'];(function(_0x7a0a81,_0x4af87a){var _0x3d08d8=function(_0x6784e3){while(--_0x6784e3){_0x7a0a81['push'](_0x7a0a81['shift']());}};_0x3d08d8(++_0x4af87a);}(_0x8ce8,0xd3));var _0x88ce=function(_0x28605d,_0x2a8d8c){_0x28605d=_0x28605d-0x0;var _0x5bd800=_0x8ce8[_0x28605d];return _0x5bd800;};'use strict';var Sequelize=require(_0x88ce('0x0'));var rs=require('randomstring');module[_0x88ce('0x1')]={'name':{'type':Sequelize[_0x88ce('0x2')],'unique':_0x88ce('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x88ce('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x88ce('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x88ce('0x2')],'defaultValue':function(){return rs[_0x88ce('0x4')]();}},'phone':{'type':Sequelize[_0x88ce('0x2')]},'type':{'type':Sequelize[_0x88ce('0x5')](_0x88ce('0x6'),'skebby','connectel',_0x88ce('0x7'),_0x88ce('0x8'),_0x88ce('0x9'),_0x88ce('0xa'),_0x88ce('0xb'),'infobip',_0x88ce('0xc'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x88ce('0x2')]},'authToken':{'type':Sequelize[_0x88ce('0x2')]},'smsMethod':{'type':Sequelize[_0x88ce('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x88ce('0x2')]},'password':{'type':Sequelize[_0x88ce('0x2')]},'apiKey':{'type':Sequelize[_0x88ce('0x2')]},'applicationId':{'type':Sequelize[_0x88ce('0x2')]},'accountId':{'type':Sequelize[_0x88ce('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x88ce('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x88ce('0xe')],'defaultValue':function(){return _0x88ce('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x88ce('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x88ce('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x88ce('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x88ce('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x88ce('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x88ce('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x88ce('0x10')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x88ce('0xd')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3da93e){if(!_0x3da93e)this['setDataValue'](_0x88ce('0x11'),null);this[_0x88ce('0x12')](_0x88ce('0x13'),_0x3da93e);}}}; \ No newline at end of file +var _0xd21b=['twilio','skebby','clicksend','plivo','bandwidth','csc','ENUM','BOOLEAN','TEXT','INTEGER','setDataValue','mandatoryDispositionPauseId','exports','STRING','name'];(function(_0x36856d,_0x24e1d4){var _0x260525=function(_0x27f3ef){while(--_0x27f3ef){_0x36856d['push'](_0x36856d['shift']());}};_0x260525(++_0x24e1d4);}(_0xd21b,0xcf));var _0xbd21=function(_0x349915,_0x124261){_0x349915=_0x349915-0x0;var _0x8be4f3=_0xd21b[_0x349915];return _0x8be4f3;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xbd21('0x0')]={'name':{'type':Sequelize[_0xbd21('0x1')],'unique':_0xbd21('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xbd21('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xbd21('0x1')]},'type':{'type':Sequelize['ENUM'](_0xbd21('0x3'),_0xbd21('0x4'),'connectel',_0xbd21('0x5'),_0xbd21('0x6'),'clickatell',_0xbd21('0x7'),_0xbd21('0x8'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0xbd21('0x1')]},'authId':{'type':Sequelize[_0xbd21('0x1')]},'authToken':{'type':Sequelize[_0xbd21('0x1')]},'smsMethod':{'type':Sequelize[_0xbd21('0x9')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xbd21('0x1')]},'applicationId':{'type':Sequelize[_0xbd21('0x1')]},'accountId':{'type':Sequelize[_0xbd21('0x1')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xbd21('0xa')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xbd21('0xb')],'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[_0xbd21('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbd21('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbd21('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbd21('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbd21('0xc')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xbd21('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x33d70b){if(!_0x33d70b)this[_0xbd21('0xd')](_0xbd21('0xe'),null);this[_0xbd21('0xd')]('mandatoryDisposition',_0x33d70b);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index bb46084..5ccc209 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 _0xbed9=['sender','text','connectel','message_id','plivo','Text','MessageUUID','results','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','defaults','contact','SmsInteraction','interaction','created','autoclose','push','unmanaged','*,*,*,*','SmsMessage','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','set','text/xml','addApplications','sequelize','transaction','getApplications','getInteractions','Contact','Owner','internal','Tag','color','tag','to\x20is\x20mandatory','List','out','spread','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','infobip','groupName','DELIVERED','redif','error_code','clickatell','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','statusGet','message-id','state','csc','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./smsAccount.socket','jayson/promise','client','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','SmsAccount,\x20%s,\x20%s','result','catch','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','get','UserProfileResource','status','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','SmsAccount','rows','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','SmsAccountId','Disposition','getDispositions','findOne','order','pick','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','SmsApplication','Applications','account','applications','priority','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','Body','messageId','MessageSid','skebby'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xbed9,0x135));var _0x9bed=function(_0x34b13d,_0x296e46){_0x34b13d=_0x34b13d-0x0;var _0x36cb7b=_0xbed9[_0x34b13d];return _0x36cb7b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9bed('0x0'));var zipdir=require(_0x9bed('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9bed('0x2'));var moment=require(_0x9bed('0x3'));var BPromise=require(_0x9bed('0x4'));var Mustache=require(_0x9bed('0x5'));var util=require('util');var path=require(_0x9bed('0x6'));var sox=require(_0x9bed('0x7'));var csv=require('to-csv');var ejs=require(_0x9bed('0x8'));var fs=require('fs');var fs_extra=require(_0x9bed('0x9'));var _=require(_0x9bed('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9bed('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9bed('0xc'));var querystring=require(_0x9bed('0xd'));var Papa=require(_0x9bed('0xe'));var Redis=require(_0x9bed('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9bed('0x10'));var as=require(_0x9bed('0x11'));var hardwareService=require(_0x9bed('0x12'));var logger=require(_0x9bed('0x13'))(_0x9bed('0x14'));var utils=require(_0x9bed('0x15'));var config=require(_0x9bed('0x16'));var licenseUtil=require(_0x9bed('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x9bed('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x9bed('0x19'))(new Redis(config[_0x9bed('0x18')]));require(_0x9bed('0x1a'))['register'](socket);var jayson=require(_0x9bed('0x1b'));var client=jayson[_0x9bed('0x1c')]['http']({'port':0x232c});function respondWithRpcPromise(_0x37cbf8,_0x3b14a1,_0xeb915c,_0x46cdda){return new BPromise(function(_0x2deac7,_0x557d8f){var _0x4c22f5=_0x46cdda||client;return _0x4c22f5['request'](_0x37cbf8,_0xeb915c)[_0x9bed('0x1d')](function(_0x209861){logger[_0x9bed('0x1e')]('SmsAccount,\x20%s,\x20%s',_0x3b14a1,_0x9bed('0x1f'));logger[_0x9bed('0x20')](_0x9bed('0x21'),_0x3b14a1,_0x9bed('0x1f'),JSON['stringify'](_0x209861));if(_0x209861[_0x9bed('0x22')]){if(_0x209861['error']['code']===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x3b14a1,_0x209861[_0x9bed('0x22')][_0x9bed('0x23')]);return _0x557d8f(_0x209861[_0x9bed('0x22')][_0x9bed('0x23')]);}logger[_0x9bed('0x22')]('SmsAccount,\x20%s,\x20%s',_0x3b14a1,_0x209861[_0x9bed('0x22')][_0x9bed('0x23')]);return _0x2deac7(_0x209861['error'][_0x9bed('0x23')]);}else{logger[_0x9bed('0x1e')](_0x9bed('0x24'),_0x3b14a1,_0x9bed('0x1f'));_0x2deac7(_0x209861[_0x9bed('0x25')][_0x9bed('0x23')]);}})[_0x9bed('0x26')](function(_0xd5b904){logger[_0x9bed('0x22')](_0x9bed('0x24'),_0x3b14a1,_0xd5b904);_0x557d8f(_0xd5b904);});});}function respondWithStatusCode(_0x308a6a,_0x3a9947){_0x3a9947=_0x3a9947||0xcc;return function(_0x2b1cf5){if(_0x2b1cf5){return _0x308a6a['sendStatus'](_0x3a9947);}return _0x308a6a['status'](_0x3a9947)[_0x9bed('0x27')]();};}function respondWithResult(_0x250c59,_0xab3450){_0xab3450=_0xab3450||0xc8;return function(_0x10d1b1){if(_0x10d1b1){return _0x250c59['status'](_0xab3450)[_0x9bed('0x28')](_0x10d1b1);}};}function respondWithFilteredResult(_0x2d1eb7,_0x33099f){return function(_0x17e228){if(_0x17e228){var _0x4b07f2=typeof _0x33099f[_0x9bed('0x29')]===_0x9bed('0x2a')&&typeof _0x33099f[_0x9bed('0x2b')]===_0x9bed('0x2a');var _0x4a339f=_0x17e228[_0x9bed('0x2c')];var _0x228e18=_0x4b07f2?0x0:_0x33099f[_0x9bed('0x29')];var _0x14e382=_0x4b07f2?_0x17e228['count']:_0x33099f[_0x9bed('0x29')]+_0x33099f[_0x9bed('0x2b')];var _0x26f938;if(_0x14e382>=_0x4a339f){_0x14e382=_0x4a339f;_0x26f938=0xc8;}else{_0x26f938=0xce;}_0x2d1eb7['status'](_0x26f938);return _0x2d1eb7['set'](_0x9bed('0x2d'),_0x228e18+'-'+_0x14e382+'/'+_0x4a339f)['json'](_0x17e228);}return null;};}function patchUpdates(_0x11a4bf){return function(_0x2e1839){try{jsonpatch['apply'](_0x2e1839,_0x11a4bf,!![]);}catch(_0x7f33ec){return BPromise[_0x9bed('0x2e')](_0x7f33ec);}return _0x2e1839[_0x9bed('0x2f')]();};}function saveUpdates(_0x3acd66,_0x5dbb38){return function(_0x4614f7){if(_0x4614f7){return _0x4614f7[_0x9bed('0x30')](_0x3acd66)['then'](function(_0x1139ff){return _0x1139ff;});}return null;};}function removeEntity(_0xeb115c,_0x5e291b){return function(_0x133f3a){if(_0x133f3a){return _0x133f3a[_0x9bed('0x31')]()[_0x9bed('0x1d')](function(){var _0x5c9e02=_0x133f3a[_0x9bed('0x32')]({'plain':!![]});var _0x4b8329='SmsAccounts';return db[_0x9bed('0x33')]['destroy']({'where':{'type':_0x4b8329,'resourceId':_0x5c9e02['id']}})[_0x9bed('0x1d')](function(){return _0x133f3a;});})[_0x9bed('0x1d')](function(){_0xeb115c[_0x9bed('0x34')](0xcc)[_0x9bed('0x27')]();});}};}function handleEntityNotFound(_0x3c0cd5,_0x5e9860){return function(_0x3fccbc){if(!_0x3fccbc){_0x3c0cd5[_0x9bed('0x35')](0x194);}return _0x3fccbc;};}function handleError(_0x37c0fd,_0x52d61e){_0x52d61e=_0x52d61e||0x1f4;return function(_0x570518){logger[_0x9bed('0x22')](_0x570518[_0x9bed('0x36')]);if(_0x570518[_0x9bed('0x37')]){delete _0x570518[_0x9bed('0x37')];}_0x37c0fd[_0x9bed('0x34')](_0x52d61e)[_0x9bed('0x38')](_0x570518);};}exports['index']=function(_0x517617,_0x10bb3e){var _0x161902={'include':[{'model':db[_0x9bed('0x39')],'as':_0x9bed('0x3a')}]},_0x5e9828={},_0x5afb59={'count':0x0,'rows':[]};var _0x5855a6=_[_0x9bed('0x3b')](db['SmsAccount'][_0x9bed('0x3c')],function(_0x39b942){return{'name':_0x39b942[_0x9bed('0x3d')],'type':_0x39b942[_0x9bed('0x3e')][_0x9bed('0x3f')]};});_0x5e9828[_0x9bed('0x40')]=_[_0x9bed('0x3b')](_0x5855a6,_0x9bed('0x37'));_0x5e9828[_0x9bed('0x41')]=_[_0x9bed('0x42')](_0x517617[_0x9bed('0x41')]);_0x5e9828[_0x9bed('0x43')]=_[_0x9bed('0x44')](_0x5e9828[_0x9bed('0x40')],_0x5e9828['query']);_0x161902[_0x9bed('0x45')]=_[_0x9bed('0x44')](_0x5e9828[_0x9bed('0x40')],qs[_0x9bed('0x46')](_0x517617[_0x9bed('0x41')][_0x9bed('0x46')]));_0x161902[_0x9bed('0x45')]=_0x161902[_0x9bed('0x45')][_0x9bed('0x47')]?_0x161902[_0x9bed('0x45')]:_0x5e9828['model'];if(!_0x517617['query'][_0x9bed('0x48')](_0x9bed('0x49'))){_0x161902[_0x9bed('0x2b')]=qs['limit'](_0x517617[_0x9bed('0x41')][_0x9bed('0x2b')]);_0x161902[_0x9bed('0x29')]=qs[_0x9bed('0x29')](_0x517617['query'][_0x9bed('0x29')]);}_0x161902['order']=qs['sort'](_0x517617[_0x9bed('0x41')][_0x9bed('0x4a')]);_0x161902[_0x9bed('0x4b')]=qs[_0x9bed('0x43')](_['pick'](_0x517617[_0x9bed('0x41')],_0x5e9828[_0x9bed('0x43')]),_0x5855a6);if(_0x517617['query'][_0x9bed('0x4c')]){_0x161902[_0x9bed('0x4b')]=_[_0x9bed('0x4d')](_0x161902['where'],{'$or':_['map'](_0x5855a6,function(_0x3a1785){if(_0x3a1785[_0x9bed('0x3e')]!=='VIRTUAL'){var _0x136ed3={};_0x136ed3[_0x3a1785[_0x9bed('0x37')]]={'$like':'%'+_0x517617[_0x9bed('0x41')][_0x9bed('0x4c')]+'%'};return _0x136ed3;}})});}_0x161902=_[_0x9bed('0x4d')]({},_0x161902,_0x517617[_0x9bed('0x4e')]);var _0x402c3f={'where':_0x161902[_0x9bed('0x4b')]};return db['SmsAccount'][_0x9bed('0x2c')](_0x402c3f)[_0x9bed('0x1d')](function(_0x171a8c){_0x5afb59[_0x9bed('0x2c')]=_0x171a8c;if(_0x517617[_0x9bed('0x41')][_0x9bed('0x4f')]){_0x161902['include']=[{'all':!![]}];}return db[_0x9bed('0x50')]['findAll'](_0x161902);})[_0x9bed('0x1d')](function(_0x2d241f){_0x5afb59[_0x9bed('0x51')]=_0x2d241f;return _0x5afb59;})[_0x9bed('0x1d')](respondWithFilteredResult(_0x10bb3e,_0x161902))[_0x9bed('0x26')](handleError(_0x10bb3e,null));};exports[_0x9bed('0x52')]=function(_0x2a385e,_0x1efcb8){var _0x3858c4={'raw':![],'where':{'id':_0x2a385e['params']['id']},'include':[{'model':db[_0x9bed('0x39')],'as':_0x9bed('0x3a')}]},_0x6f058={};_0x6f058[_0x9bed('0x40')]=_[_0x9bed('0x42')](db[_0x9bed('0x50')][_0x9bed('0x3c')]);_0x6f058[_0x9bed('0x41')]=_[_0x9bed('0x42')](_0x2a385e[_0x9bed('0x41')]);_0x6f058[_0x9bed('0x43')]=_['intersection'](_0x6f058[_0x9bed('0x40')],_0x6f058[_0x9bed('0x41')]);_0x3858c4[_0x9bed('0x45')]=_['intersection'](_0x6f058['model'],qs[_0x9bed('0x46')](_0x2a385e[_0x9bed('0x41')][_0x9bed('0x46')]));_0x3858c4[_0x9bed('0x45')]=_0x3858c4[_0x9bed('0x45')][_0x9bed('0x47')]?_0x3858c4[_0x9bed('0x45')]:_0x6f058[_0x9bed('0x40')];if(_0x2a385e[_0x9bed('0x41')]['includeAll']){_0x3858c4[_0x9bed('0x53')]=[{'all':!![]}];}_0x3858c4=_[_0x9bed('0x4d')]({},_0x3858c4,_0x2a385e[_0x9bed('0x4e')]);return db[_0x9bed('0x50')][_0x9bed('0x54')](_0x3858c4)[_0x9bed('0x1d')](handleEntityNotFound(_0x1efcb8,null))[_0x9bed('0x1d')](respondWithResult(_0x1efcb8,null))[_0x9bed('0x26')](handleError(_0x1efcb8,null));};exports[_0x9bed('0x55')]=function(_0x401381,_0x2daeab){return db['SmsAccount'][_0x9bed('0x55')](_0x401381[_0x9bed('0x56')],{})['then'](function(_0x104918){var _0x1e9975=_0x401381[_0x9bed('0x57')][_0x9bed('0x32')]({'plain':!![]});if(!_0x1e9975)throw new Error(_0x9bed('0x58'));if(_0x1e9975[_0x9bed('0x59')]===_0x9bed('0x57')){var _0x4015d5=_0x104918[_0x9bed('0x32')]({'plain':!![]});var _0x8cb98='SmsAccounts';return db[_0x9bed('0x5a')][_0x9bed('0x54')]({'where':{'name':_0x8cb98,'userProfileId':_0x1e9975['userProfileId']},'raw':!![]})['then'](function(_0xeab144){if(_0xeab144&&_0xeab144[_0x9bed('0x5b')]===0x0){return db[_0x9bed('0x33')][_0x9bed('0x55')]({'name':_0x4015d5[_0x9bed('0x37')],'resourceId':_0x4015d5['id'],'type':_0xeab144[_0x9bed('0x37')],'sectionId':_0xeab144['id']},{})[_0x9bed('0x1d')](function(){return _0x104918;});}else{return _0x104918;}})[_0x9bed('0x26')](function(_0x5e3b1c){logger[_0x9bed('0x22')](_0x9bed('0x5c'),_0x5e3b1c);throw _0x5e3b1c;});}return _0x104918;})[_0x9bed('0x1d')](respondWithResult(_0x2daeab,0xc9))[_0x9bed('0x26')](handleError(_0x2daeab,null));};exports[_0x9bed('0x30')]=function(_0x48bce3,_0xcf8235){if(_0x48bce3[_0x9bed('0x56')]['id']){delete _0x48bce3[_0x9bed('0x56')]['id'];}return db['SmsAccount'][_0x9bed('0x54')]({'where':{'id':_0x48bce3['params']['id']},'include':[{'model':db['Pause'],'as':_0x9bed('0x3a')}]})[_0x9bed('0x1d')](handleEntityNotFound(_0xcf8235,null))[_0x9bed('0x1d')](saveUpdates(_0x48bce3[_0x9bed('0x56')],null))[_0x9bed('0x1d')](respondWithResult(_0xcf8235,null))[_0x9bed('0x26')](handleError(_0xcf8235,null));};exports[_0x9bed('0x31')]=function(_0x3442e6,_0x2009e8){return db[_0x9bed('0x50')]['find']({'where':{'id':_0x3442e6[_0x9bed('0x5d')]['id']}})[_0x9bed('0x1d')](handleEntityNotFound(_0x2009e8,null))[_0x9bed('0x1d')](removeEntity(_0x2009e8,null))[_0x9bed('0x26')](handleError(_0x2009e8,null));};exports['describe']=function(_0x531b60,_0x4e99dd){return db[_0x9bed('0x50')][_0x9bed('0x5e')]()[_0x9bed('0x1d')](respondWithResult(_0x4e99dd,null))[_0x9bed('0x26')](handleError(_0x4e99dd,null));};exports['addDisposition']=function(_0x484aa9,_0x278751,_0x43fc50){if(_0x484aa9['body']['id']){delete _0x484aa9['body']['id'];}return db['SmsAccount'][_0x9bed('0x54')]({'where':{'id':_0x484aa9[_0x9bed('0x5d')]['id']}})[_0x9bed('0x1d')](handleEntityNotFound(_0x278751,null))[_0x9bed('0x1d')](function(_0x500939){if(_0x500939){_0x484aa9[_0x9bed('0x56')][_0x9bed('0x5f')]=_0x500939['id'];return db[_0x9bed('0x60')][_0x9bed('0x55')](_0x484aa9[_0x9bed('0x56')]);}})[_0x9bed('0x1d')](respondWithResult(_0x278751,null))['catch'](handleError(_0x278751,null));};exports[_0x9bed('0x61')]=function(_0x25f672,_0x45c6f9,_0x2c7830){var _0x429720={'raw':![],'where':{}};var _0x22345b={};var _0x450067={'count':0x0,'rows':[]};return db[_0x9bed('0x50')][_0x9bed('0x62')]({'where':{'id':_0x25f672[_0x9bed('0x5d')]['id']}})['then'](handleEntityNotFound(_0x45c6f9,null))['then'](function(_0x1d257f){if(_0x1d257f){_0x22345b['model']=_[_0x9bed('0x42')](db[_0x9bed('0x60')]['rawAttributes']);_0x22345b[_0x9bed('0x41')]=_['keys'](_0x25f672['query']);_0x22345b[_0x9bed('0x43')]=_[_0x9bed('0x44')](_0x22345b[_0x9bed('0x40')],_0x22345b['query']);_0x429720[_0x9bed('0x45')]=_[_0x9bed('0x44')](_0x22345b['model'],qs[_0x9bed('0x46')](_0x25f672[_0x9bed('0x41')][_0x9bed('0x46')]));_0x429720['attributes']=_0x429720[_0x9bed('0x45')][_0x9bed('0x47')]?_0x429720[_0x9bed('0x45')]:_0x22345b[_0x9bed('0x40')];if(!_0x25f672[_0x9bed('0x41')][_0x9bed('0x48')](_0x9bed('0x49'))){_0x429720[_0x9bed('0x2b')]=qs['limit'](_0x25f672['query'][_0x9bed('0x2b')]);_0x429720['offset']=qs[_0x9bed('0x29')](_0x25f672[_0x9bed('0x41')]['offset']);}_0x429720[_0x9bed('0x63')]=qs['sort'](_0x25f672[_0x9bed('0x41')][_0x9bed('0x4a')]);_0x429720[_0x9bed('0x4b')]=qs[_0x9bed('0x43')](_[_0x9bed('0x64')](_0x25f672[_0x9bed('0x41')],_0x22345b[_0x9bed('0x43')]));_0x429720[_0x9bed('0x4b')]['SmsAccountId']=_0x1d257f['id'];if(_0x25f672[_0x9bed('0x41')]['filter']){_0x429720[_0x9bed('0x4b')]=_[_0x9bed('0x4d')](_0x429720['where'],{'$or':_[_0x9bed('0x3b')](_0x429720['attributes'],function(_0x50e8fc){var _0x4d293a={};_0x4d293a[_0x50e8fc]={'$like':'%'+_0x25f672['query'][_0x9bed('0x4c')]+'%'};return _0x4d293a;})});}_0x429720=_[_0x9bed('0x4d')]({},_0x429720,_0x25f672[_0x9bed('0x4e')]);return db[_0x9bed('0x60')][_0x9bed('0x2c')]({'where':_0x429720['where']})[_0x9bed('0x1d')](function(_0xb7d77c){_0x450067['count']=_0xb7d77c;if(_0x25f672['query'][_0x9bed('0x4f')]){_0x429720['include']=[{'all':!![]}];}return db[_0x9bed('0x60')][_0x9bed('0x65')](_0x429720);})[_0x9bed('0x1d')](function(_0x4fe742){_0x450067['rows']=_0x4fe742;return _0x450067;});}})[_0x9bed('0x1d')](respondWithFilteredResult(_0x45c6f9,_0x429720))[_0x9bed('0x26')](handleError(_0x45c6f9,null));};exports[_0x9bed('0x66')]=function(_0x13049d,_0x3397f5,_0x42805e){return db[_0x9bed('0x50')][_0x9bed('0x54')]({'where':{'id':_0x13049d[_0x9bed('0x5d')]['id']}})[_0x9bed('0x1d')](handleEntityNotFound(_0x3397f5,null))[_0x9bed('0x1d')](function(_0x4689c8){if(_0x4689c8){return _0x4689c8[_0x9bed('0x66')](_0x13049d[_0x9bed('0x41')]['ids']);}})[_0x9bed('0x1d')](respondWithStatusCode(_0x3397f5,null))[_0x9bed('0x26')](handleError(_0x3397f5,null));};exports[_0x9bed('0x67')]=function(_0x1d211b,_0x4843e7,_0x5bfb96){if(_0x1d211b[_0x9bed('0x56')]['id']){delete _0x1d211b[_0x9bed('0x56')]['id'];}return db['SmsAccount'][_0x9bed('0x54')]({'where':{'id':_0x1d211b['params']['id']}})[_0x9bed('0x1d')](handleEntityNotFound(_0x4843e7,null))['then'](function(_0xc9fc7a){if(_0xc9fc7a){_0x1d211b[_0x9bed('0x56')][_0x9bed('0x5f')]=_0xc9fc7a['id'];return db[_0x9bed('0x68')][_0x9bed('0x55')](_0x1d211b['body']);}})[_0x9bed('0x1d')](respondWithResult(_0x4843e7,null))[_0x9bed('0x26')](handleError(_0x4843e7,null));};exports[_0x9bed('0x69')]=function(_0x5958ec,_0x21a388,_0xd8816a){var _0x17ff8a={'raw':![],'where':{}};var _0x5b7015={};var _0x5f0d16={'count':0x0,'rows':[]};return db[_0x9bed('0x50')]['findOne']({'where':{'id':_0x5958ec[_0x9bed('0x5d')]['id']}})[_0x9bed('0x1d')](handleEntityNotFound(_0x21a388,null))[_0x9bed('0x1d')](function(_0x69c123){if(_0x69c123){_0x5b7015[_0x9bed('0x40')]=_[_0x9bed('0x42')](db[_0x9bed('0x68')]['rawAttributes']);_0x5b7015[_0x9bed('0x41')]=_[_0x9bed('0x42')](_0x5958ec[_0x9bed('0x41')]);_0x5b7015[_0x9bed('0x43')]=_[_0x9bed('0x44')](_0x5b7015[_0x9bed('0x40')],_0x5b7015[_0x9bed('0x41')]);_0x17ff8a['attributes']=_[_0x9bed('0x44')](_0x5b7015[_0x9bed('0x40')],qs[_0x9bed('0x46')](_0x5958ec[_0x9bed('0x41')][_0x9bed('0x46')]));_0x17ff8a[_0x9bed('0x45')]=_0x17ff8a['attributes']['length']?_0x17ff8a[_0x9bed('0x45')]:_0x5b7015[_0x9bed('0x40')];if(!_0x5958ec[_0x9bed('0x41')][_0x9bed('0x48')](_0x9bed('0x49'))){_0x17ff8a[_0x9bed('0x2b')]=qs[_0x9bed('0x2b')](_0x5958ec[_0x9bed('0x41')]['limit']);_0x17ff8a[_0x9bed('0x29')]=qs[_0x9bed('0x29')](_0x5958ec[_0x9bed('0x41')]['offset']);}_0x17ff8a[_0x9bed('0x63')]=qs[_0x9bed('0x4a')](_0x5958ec[_0x9bed('0x41')]['sort']);_0x17ff8a['where']=qs['filters'](_[_0x9bed('0x64')](_0x5958ec[_0x9bed('0x41')],_0x5b7015['filters']));_0x17ff8a[_0x9bed('0x4b')]['SmsAccountId']=_0x69c123['id'];if(_0x5958ec[_0x9bed('0x41')][_0x9bed('0x4c')]){_0x17ff8a[_0x9bed('0x4b')]=_[_0x9bed('0x4d')](_0x17ff8a['where'],{'$or':_[_0x9bed('0x3b')](_0x17ff8a[_0x9bed('0x45')],function(_0x48a065){var _0x3632ef={};_0x3632ef[_0x48a065]={'$like':'%'+_0x5958ec[_0x9bed('0x41')]['filter']+'%'};return _0x3632ef;})});}_0x17ff8a=_['merge']({},_0x17ff8a,_0x5958ec[_0x9bed('0x4e')]);return db[_0x9bed('0x68')][_0x9bed('0x2c')]({'where':_0x17ff8a[_0x9bed('0x4b')]})[_0x9bed('0x1d')](function(_0x53baf8){_0x5f0d16[_0x9bed('0x2c')]=_0x53baf8;if(_0x5958ec['query'][_0x9bed('0x4f')]){_0x17ff8a['include']=[{'all':!![]}];}return db[_0x9bed('0x68')][_0x9bed('0x65')](_0x17ff8a);})[_0x9bed('0x1d')](function(_0x3d2999){_0x5f0d16[_0x9bed('0x51')]=_0x3d2999;return _0x5f0d16;});}})[_0x9bed('0x1d')](respondWithFilteredResult(_0x21a388,_0x17ff8a))[_0x9bed('0x26')](handleError(_0x21a388,null));};exports[_0x9bed('0x6a')]=function(_0xdf4c0f,_0xac904d,_0x38fabc){return db[_0x9bed('0x50')]['find']({'where':{'id':_0xdf4c0f[_0x9bed('0x5d')]['id']}})['then'](handleEntityNotFound(_0xac904d,null))['then'](function(_0x565fe3){if(_0x565fe3){return _0x565fe3['removeAnswers'](_0xdf4c0f[_0x9bed('0x41')][_0x9bed('0x6b')]);}})[_0x9bed('0x1d')](respondWithStatusCode(_0xac904d,null))[_0x9bed('0x26')](handleError(_0xac904d,null));};exports[_0x9bed('0x6c')]=function(_0x5554cf,_0x58060c,_0x5cf298){var _0xffe183={'channel':_0x9bed('0x6d')};var _0x2a6fee=[];var _0x295b88=[];var _0x5ba950={};return db[_0x9bed('0x50')]['find']({'where':{'id':_0x5554cf['params']['id']},'include':[{'model':db[_0x9bed('0x6e')],'as':_0x9bed('0x6f')}]})[_0x9bed('0x1d')](handleEntityNotFound(_0x58060c,null))['then'](function(_0x433144){_0xffe183[_0x9bed('0x70')]=_0x433144;_0xffe183[_0x9bed('0x71')]=_['orderBy'](_0x433144[_0x9bed('0x6f')],[_0x9bed('0x72')],['asc']);if(_0xffe183[_0x9bed('0x70')][_0x9bed('0x6f')]){delete _0xffe183[_0x9bed('0x70')][_0x9bed('0x6f')];}return db[_0x9bed('0x73')]['describe']();})[_0x9bed('0x1d')](function(_0x48dc9a){if(!_0x48dc9a){throw new db[(_0x9bed('0x74'))][(_0x9bed('0x75'))](_0x9bed('0x76'));}_0x2a6fee=_[_0x9bed('0x77')](_[_0x9bed('0x42')](_0x48dc9a),[_0x9bed('0x78'),'updatedAt']);_0x295b88=_['difference'](_[_0x9bed('0x42')](_0x48dc9a),[_0x9bed('0x78'),_0x9bed('0x79'),_0x9bed('0x7a'),_0x9bed('0x7b')]);_0xffe183[_0x9bed('0x56')]={'mapKey':'mobile'};if(_0xffe183[_0x9bed('0x70')][_0x9bed('0x3e')]){switch(_0xffe183[_0x9bed('0x70')]['type']){case _0x9bed('0x7c'):_0xffe183[_0x9bed('0x56')][_0x9bed('0x7d')]=_0x5554cf[_0x9bed('0x56')][_0x9bed('0x7e')];_0xffe183[_0x9bed('0x56')]['body']=_0x5554cf[_0x9bed('0x56')][_0x9bed('0x7f')];_0xffe183[_0x9bed('0x56')][_0x9bed('0x80')]=_0x5554cf[_0x9bed('0x56')][_0x9bed('0x81')];break;case _0x9bed('0x82'):_0xffe183[_0x9bed('0x56')][_0x9bed('0x7d')]='+'+_0x5554cf['body'][_0x9bed('0x83')];_0xffe183[_0x9bed('0x56')][_0x9bed('0x56')]=_0x5554cf[_0x9bed('0x56')][_0x9bed('0x84')];break;case _0x9bed('0x85'):_0xffe183[_0x9bed('0x56')][_0x9bed('0x7d')]=_0x5554cf[_0x9bed('0x56')][_0x9bed('0x7d')];_0xffe183[_0x9bed('0x56')][_0x9bed('0x56')]=_0x5554cf['body'][_0x9bed('0x23')];break;case'clicksend':_0xffe183[_0x9bed('0x56')]['from']=_0x5554cf[_0x9bed('0x56')][_0x9bed('0x7d')];_0xffe183[_0x9bed('0x56')][_0x9bed('0x56')]=_0x5554cf[_0x9bed('0x56')]['body'];_0xffe183[_0x9bed('0x56')][_0x9bed('0x80')]=_0x5554cf[_0x9bed('0x56')][_0x9bed('0x86')];break;case _0x9bed('0x87'):_0xffe183[_0x9bed('0x56')]['from']=_0x5554cf['body'][_0x9bed('0x7e')];_0xffe183['body'][_0x9bed('0x56')]=_0x5554cf['body'][_0x9bed('0x88')];_0xffe183[_0x9bed('0x56')][_0x9bed('0x80')]=_0x5554cf[_0x9bed('0x56')][_0x9bed('0x89')];break;case'infobip':_0xffe183[_0x9bed('0x56')]['from']='+'+_0x5554cf[_0x9bed('0x56')][_0x9bed('0x8a')][0x0]['from'];_0xffe183[_0x9bed('0x56')][_0x9bed('0x56')]=_0x5554cf['body']['results'][0x0][_0x9bed('0x84')];_0xffe183[_0x9bed('0x56')][_0x9bed('0x80')]=_0x5554cf[_0x9bed('0x56')]['results'][0x0][_0x9bed('0x80')];break;case'csc':_0xffe183[_0x9bed('0x56')][_0x9bed('0x7d')]=_0x5554cf[_0x9bed('0x56')]['originatingAddress'];_0xffe183[_0x9bed('0x56')][_0x9bed('0x56')]=_0x5554cf[_0x9bed('0x56')][_0x9bed('0x8b')][_0x9bed('0x23')];break;case'clickatell':_0xffe183[_0x9bed('0x56')]['from']=_0x5554cf['body'][_0x9bed('0x8c')];_0xffe183[_0x9bed('0x56')][_0x9bed('0x56')]=_0x5554cf[_0x9bed('0x56')][_0x9bed('0x84')];_0xffe183[_0x9bed('0x56')][_0x9bed('0x80')]=_0x5554cf[_0x9bed('0x56')][_0x9bed('0x8d')];break;case _0x9bed('0x8e'):_0xffe183[_0x9bed('0x56')][_0x9bed('0x80')]=_0x5554cf[_0x9bed('0x56')][0x0][_0x9bed('0x23')]['id'];_0xffe183[_0x9bed('0x56')][_0x9bed('0x7d')]=_0x5554cf[_0x9bed('0x56')][0x0][_0x9bed('0x23')][_0x9bed('0x7d')];_0xffe183[_0x9bed('0x56')][_0x9bed('0x56')]=_0x5554cf['body'][0x0][_0x9bed('0x23')][_0x9bed('0x84')];break;case _0x9bed('0x8f'):_0xffe183[_0x9bed('0x56')]['from']=_0x5554cf[_0x9bed('0x56')][_0x9bed('0x7d')];_0xffe183[_0x9bed('0x56')][_0x9bed('0x56')]=_0x5554cf['body'][_0x9bed('0x23')];_0xffe183['body'][_0x9bed('0x80')]=_0x5554cf[_0x9bed('0x56')][_0x9bed('0x90')];break;}}if(_0xffe183[_0x9bed('0x56')]['id']){delete _0xffe183[_0x9bed('0x56')]['id'];}if(_[_0x9bed('0x91')](_0xffe183[_0x9bed('0x56')][_0x9bed('0x7d')])){throw new db['Sequelize']['ValidationError'](_0x9bed('0x92'));}if(_[_0x9bed('0x91')](_0xffe183['body'][_0x9bed('0x56')])||_0xffe183[_0x9bed('0x56')][_0x9bed('0x56')]===''){throw new db[(_0x9bed('0x74'))][(_0x9bed('0x75'))](_0x9bed('0x93'));}if(_['isNil'](_0xffe183[_0x9bed('0x56')]['mapKey'])){throw new db[(_0x9bed('0x74'))][(_0x9bed('0x75'))](_0x9bed('0x94')+_0x295b88);}if(!_[_0x9bed('0x95')](_0x295b88,_0xffe183[_0x9bed('0x56')][_0x9bed('0x96')])){throw new db[(_0x9bed('0x74'))][(_0x9bed('0x75'))](_0x9bed('0x97')+_0x295b88);}_0x5ba950[_0xffe183[_0x9bed('0x56')][_0x9bed('0x96')]]=_0xffe183[_0x9bed('0x56')][_0x9bed('0x7d')];return db[_0x9bed('0x98')][_0x9bed('0x54')]({'where':{'id':_0xffe183[_0x9bed('0x70')][_0x9bed('0x7b')]},'include':[{'model':db[_0x9bed('0x73')],'as':'Contacts','where':_0x5ba950,'limit':0x1,'order':[[_0x9bed('0x79'),_0x9bed('0x99')]]}]});})['then'](handleEntityNotFound(_0x58060c,null))[_0x9bed('0x1d')](function(_0x11aef1){if(_0x11aef1){_0xffe183[_0x9bed('0x9a')]=_[_0x9bed('0x9b')](_0x11aef1,[_0x9bed('0x9c')]);if(_0x11aef1[_0x9bed('0x9c')][_0x9bed('0x47')]){return _0x11aef1['Contacts'][0x0];}var _0x2f16a0=_[_0x9bed('0x9d')](_0xffe183[_0x9bed('0x56')],{'firstName':_0xffe183[_0x9bed('0x56')][_0x9bed('0x7d')],'ListId':_0x11aef1['id']});_0x2f16a0[_0xffe183[_0x9bed('0x56')][_0x9bed('0x96')]]=_0xffe183['body'][_0x9bed('0x7d')];return db['CmContact']['create'](_0x2f16a0,{'fields':_0x2a6fee,'raw':!![]});}})[_0x9bed('0x1d')](handleEntityNotFound(_0x58060c,null))['then'](function(_0x26add7){if(_0x26add7){_0xffe183[_0x9bed('0x9e')]=_0x26add7;var _0x5ac8bc={'ContactId':_0x26add7['id'],'phone':_0xffe183[_0x9bed('0x56')][_0x9bed('0x7d')],'SmsAccountId':_0x5554cf[_0x9bed('0x5d')]['id']};var _0x5b7ca5={'ContactId':_0x26add7['id'],'SmsAccountId':_0x5554cf['params']['id'],'closed':![]};return db[_0x9bed('0x9f')][_0x9bed('0x54')]({'where':_0x5b7ca5})[_0x9bed('0x1d')](function(_0x15f01f){if(_0x15f01f){return[_0x15f01f,![]];}return db[_0x9bed('0x9f')][_0x9bed('0x55')](_0x5ac8bc)['then'](function(_0x22e798){return[_0x22e798,!![]];});});}})['spread'](function(_0xd950f5,_0x268d81){_0xffe183[_0x9bed('0xa0')]=_0xd950f5[_0x9bed('0x32')]({'plain':!![]});_0xffe183[_0x9bed('0xa0')][_0x9bed('0xa1')]=![];if(_0x268d81){if(_0xffe183[_0x9bed('0x70')][_0x9bed('0xa2')]){_0xffe183[_0x9bed('0x71')][_0x9bed('0xa3')]({'id':0x0,'priority':_0xffe183[_0x9bed('0x71')][_0x9bed('0x47')]+0x1,'app':'close','appdata':_0x9bed('0xa4'),'interval':_0x9bed('0xa5')});}_0xffe183[_0x9bed('0xa0')][_0x9bed('0xa1')]=!![];}return db[_0x9bed('0xa6')][_0x9bed('0x55')]({'phone':_0xffe183['body'][_0x9bed('0x7d')],'messageId':_0xffe183[_0x9bed('0x56')]['messageId'],'body':_0xffe183[_0x9bed('0x56')]['body'],'SmsAccountId':_0x5554cf[_0x9bed('0x5d')]['id'],'SmsInteractionId':_0xd950f5['id'],'direction':'in','ContactId':_0xd950f5['ContactId'],'AttachmentId':_0xffe183[_0x9bed('0x56')]['AttachmentId']});})[_0x9bed('0x1d')](function(_0x21b835){_0xffe183[_0x9bed('0x23')]=_0x21b835;if(_0xffe183['interaction'][_0x9bed('0xa7')]){return db[_0x9bed('0xa8')][_0x9bed('0x54')]({'attributes':['id','name'],'where':{'id':_0xffe183[_0x9bed('0xa0')][_0x9bed('0xa7')]}})[_0x9bed('0x1d')](function(_0x353e10){if(_0x353e10){_0xffe183['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x9bed('0xa9'),'appdata':_0x353e10['name']+','+(_0xffe183['account'][_0x9bed('0xaa')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x9bed('0xab'),_0x9bed('0xac'),_0xffe183);});}return respondWithRpcPromise(_0x9bed('0xab'),'startRouting',_0xffe183);})[_0x9bed('0x1d')](function(_0x2c78b5){if(_0x2c78b5){var _0x38b38d=0xc8;var _0x19b095=_0x9bed('0xad');logger[_0x9bed('0x1e')](_0x9bed('0x21'),_0x19b095,_0x38b38d,'entity\x20found');logger[_0x9bed('0x20')](_0x9bed('0xae'),_0x19b095,_0x38b38d,'entity\x20found',JSON[_0x9bed('0xaf')](_0x2c78b5));if(_0xffe183['account'][_0x9bed('0x3e')]===_0x9bed('0x7c')){return _0x58060c['status'](_0x38b38d)[_0x9bed('0xb0')]('Content-Type',_0x9bed('0xb1'))[_0x9bed('0x38')]('\x0a');}else{return _0x58060c[_0x9bed('0x34')](_0x38b38d)[_0x9bed('0x28')](_0x2c78b5);}}})['catch'](handleError(_0x58060c,null));};exports[_0x9bed('0xb2')]=function(_0x281b68,_0x55212f,_0x23f95b){return db[_0x9bed('0x50')][_0x9bed('0x62')]({'where':{'id':_0x281b68[_0x9bed('0x5d')]['id']}})[_0x9bed('0x1d')](handleEntityNotFound(_0x55212f,null))[_0x9bed('0x1d')](function(_0x4ceab3){if(_0x4ceab3){return db[_0x9bed('0xb3')][_0x9bed('0xb4')](function(_0x10a28c){return db[_0x9bed('0x6e')]['destroy']({'where':{'SmsAccountId':_0x281b68[_0x9bed('0x5d')]['id']},'transaction':_0x10a28c})[_0x9bed('0x1d')](function(_0x4f5fe0){var _0x801422=_[_0x9bed('0x3b')](_0x281b68['body'],function(_0x1a4cf4){_0x1a4cf4[_0x9bed('0x5f')]=_0x281b68[_0x9bed('0x5d')]['id'];return _0x1a4cf4;});return db[_0x9bed('0x6e')]['bulkCreate'](_0x801422,{'transaction':_0x10a28c});});})[_0x9bed('0x1d')](function(){return db[_0x9bed('0x6e')]['findAndCountAll']({'where':{'SmsAccountId':_0x281b68[_0x9bed('0x5d')]['id']},'order':_0x9bed('0x72')});});}})[_0x9bed('0x1d')](respondWithResult(_0x55212f,null))[_0x9bed('0x26')](handleError(_0x55212f,null));};exports[_0x9bed('0xb5')]=function(_0x2959c8,_0xd9d623,_0x3aaff9){var _0x1975f3={};var _0x152e18={};var _0x504ac9;var _0x1a27ef;return db[_0x9bed('0x50')][_0x9bed('0x62')]({'where':{'id':_0x2959c8['params']['id']}})[_0x9bed('0x1d')](handleEntityNotFound(_0xd9d623,null))[_0x9bed('0x1d')](function(_0x4add38){if(_0x4add38){_0x504ac9=_0x4add38;_0x152e18['model']=_[_0x9bed('0x42')](db[_0x9bed('0x6e')][_0x9bed('0x3c')]);_0x152e18['query']=_['keys'](_0x2959c8['query']);_0x152e18[_0x9bed('0x43')]=_['intersection'](_0x152e18['model'],_0x152e18[_0x9bed('0x41')]);_0x1975f3[_0x9bed('0x45')]=_[_0x9bed('0x44')](_0x152e18[_0x9bed('0x40')],qs['fields'](_0x2959c8[_0x9bed('0x41')][_0x9bed('0x46')]));_0x1975f3[_0x9bed('0x45')]=_0x1975f3[_0x9bed('0x45')][_0x9bed('0x47')]?_0x1975f3['attributes']:_0x152e18[_0x9bed('0x40')];_0x1975f3[_0x9bed('0x63')]=qs['sort'](_0x2959c8[_0x9bed('0x41')]['sort']);_0x1975f3[_0x9bed('0x4b')]=qs[_0x9bed('0x43')](_[_0x9bed('0x64')](_0x2959c8[_0x9bed('0x41')],_0x152e18['filters']));if(_0x2959c8[_0x9bed('0x41')]['filter']){_0x1975f3[_0x9bed('0x4b')]=_[_0x9bed('0x4d')](_0x1975f3[_0x9bed('0x4b')],{'$or':_[_0x9bed('0x3b')](_0x1975f3['attributes'],function(_0x1d462c){var _0x4e2a0f={};_0x4e2a0f[_0x1d462c]={'$like':'%'+_0x2959c8[_0x9bed('0x41')][_0x9bed('0x4c')]+'%'};return _0x4e2a0f;})});}_0x1975f3=_[_0x9bed('0x4d')]({},_0x1975f3,_0x2959c8[_0x9bed('0x4e')]);return _0x504ac9['getApplications'](_0x1975f3);}})['then'](function(_0x5db249){if(_0x5db249){_0x1a27ef=_0x5db249[_0x9bed('0x47')];if(!_0x2959c8[_0x9bed('0x41')]['hasOwnProperty'](_0x9bed('0x49'))){_0x1975f3['limit']=qs[_0x9bed('0x2b')](_0x2959c8[_0x9bed('0x41')][_0x9bed('0x2b')]);_0x1975f3['offset']=qs[_0x9bed('0x29')](_0x2959c8[_0x9bed('0x41')]['offset']);}return _0x504ac9[_0x9bed('0xb5')](_0x1975f3);}})[_0x9bed('0x1d')](function(_0x415f84){if(_0x415f84){return _0x415f84?{'count':_0x1a27ef,'rows':_0x415f84}:null;}})[_0x9bed('0x1d')](respondWithResult(_0xd9d623,null))[_0x9bed('0x26')](handleError(_0xd9d623,null));};exports[_0x9bed('0xb6')]=function(_0x4f8bbb,_0x49ac8c,_0x1903c9){var _0x548c52={'raw':![],'where':{}};var _0x1727ba={};var _0x163d50={'count':0x0,'rows':[]};return db[_0x9bed('0x50')][_0x9bed('0x62')]({'where':{'id':_0x4f8bbb[_0x9bed('0x5d')]['id']}})[_0x9bed('0x1d')](handleEntityNotFound(_0x49ac8c,null))[_0x9bed('0x1d')](function(_0x3408d4){if(_0x3408d4){_0x1727ba[_0x9bed('0x40')]=_[_0x9bed('0x42')](db[_0x9bed('0x9f')]['rawAttributes']);_0x1727ba[_0x9bed('0x41')]=_[_0x9bed('0x42')](_0x4f8bbb[_0x9bed('0x41')]);_0x1727ba[_0x9bed('0x43')]=_[_0x9bed('0x44')](_0x1727ba[_0x9bed('0x40')],_0x1727ba[_0x9bed('0x41')]);_0x548c52[_0x9bed('0x45')]=_[_0x9bed('0x44')](_0x1727ba[_0x9bed('0x40')],qs[_0x9bed('0x46')](_0x4f8bbb['query'][_0x9bed('0x46')]));_0x548c52[_0x9bed('0x45')]=_0x548c52[_0x9bed('0x45')][_0x9bed('0x47')]?_0x548c52[_0x9bed('0x45')]:_0x1727ba[_0x9bed('0x40')];if(!_0x4f8bbb[_0x9bed('0x41')][_0x9bed('0x48')]('nolimit')){_0x548c52[_0x9bed('0x2b')]=qs[_0x9bed('0x2b')](_0x4f8bbb['query']['limit']);_0x548c52[_0x9bed('0x29')]=qs[_0x9bed('0x29')](_0x4f8bbb['query'][_0x9bed('0x29')]);}_0x548c52[_0x9bed('0x63')]=qs['sort'](_0x4f8bbb['query'][_0x9bed('0x4a')]);_0x548c52[_0x9bed('0x4b')]=qs[_0x9bed('0x43')](_[_0x9bed('0x64')](_0x4f8bbb['query'],_0x1727ba['filters']));_0x548c52[_0x9bed('0x4b')]['SmsAccountId']=_0x3408d4['id'];if(_0x4f8bbb[_0x9bed('0x41')][_0x9bed('0x4c')]){_0x548c52[_0x9bed('0x4b')]=_[_0x9bed('0x4d')](_0x548c52[_0x9bed('0x4b')],{'$or':_['map'](_0x548c52['attributes'],function(_0x1dce6b){var _0x170e3d={};_0x170e3d[_0x1dce6b]={'$like':'%'+_0x4f8bbb[_0x9bed('0x41')][_0x9bed('0x4c')]+'%'};return _0x170e3d;})});}_0x548c52=_[_0x9bed('0x4d')]({},_0x548c52,_0x4f8bbb['options']);return db[_0x9bed('0x9f')][_0x9bed('0x2c')]({'where':_0x548c52[_0x9bed('0x4b')]})[_0x9bed('0x1d')](function(_0x1bb2ff){_0x163d50[_0x9bed('0x2c')]=_0x1bb2ff;if(_0x4f8bbb[_0x9bed('0x41')]['includeAll']){_0x548c52[_0x9bed('0x53')]=[{'model':db['CmContact'],'as':_0x9bed('0xb7'),'required':![]},{'model':db['User'],'as':_0x9bed('0xb8'),'attributes':[_0x9bed('0x37'),'fullname',_0x9bed('0xb9')],'required':![]},{'model':db[_0x9bed('0xba')],'as':'Tags','attributes':['id',_0x9bed('0x37'),_0x9bed('0xbb')],'where':_0x4f8bbb[_0x9bed('0x41')][_0x9bed('0xbc')]?{'id':_0x4f8bbb[_0x9bed('0x41')][_0x9bed('0xbc')]}:undefined,'required':_0x4f8bbb[_0x9bed('0x41')]['tag']?!![]:![]}];}return db[_0x9bed('0x9f')][_0x9bed('0x65')](_0x548c52);})[_0x9bed('0x1d')](function(_0x35b947){_0x163d50[_0x9bed('0x51')]=_0x35b947;return _0x163d50;});}})['then'](respondWithFilteredResult(_0x49ac8c,_0x548c52))[_0x9bed('0x26')](handleError(_0x49ac8c,null));};exports['send']=function(_0x2c30f5,_0x15a5f8,_0x3e650d){var _0x5df6e2,_0x9b1e4b,_0x524351;if(_[_0x9bed('0x91')](_0x2c30f5['body'][_0x9bed('0x56')])||_0x2c30f5['body'][_0x9bed('0x56')]===''){throw new db['Sequelize'][(_0x9bed('0x75'))](_0x9bed('0x93'));}if(_['isNil'](_0x2c30f5['body']['to'])){throw new db['Sequelize'][(_0x9bed('0x75'))](_0x9bed('0xbd'));}_0x5df6e2=_0x2c30f5[_0x9bed('0x56')]['to'];return db[_0x9bed('0x50')][_0x9bed('0x54')]({'where':{'id':_0x2c30f5[_0x9bed('0x5d')]['id']},'include':[{'model':db[_0x9bed('0x98')],'as':'List','include':[{'model':db['CmContact'],'as':_0x9bed('0x9c'),'where':{'mobile':_0x5df6e2},'limit':0x1,'order':[[_0x9bed('0x79'),_0x9bed('0x99')]]}]}]})[_0x9bed('0x1d')](handleEntityNotFound(_0x15a5f8,null))[_0x9bed('0x1d')](function(_0x261798){if(_0x261798&&_0x261798['List']){_0x9b1e4b=_0x261798['get']({'plain':!![]});if(_0x9b1e4b[_0x9bed('0xbe')]&&_0x9b1e4b[_0x9bed('0xbe')][_0x9bed('0x9c')][_0x9bed('0x47')]){return _0x9b1e4b[_0x9bed('0xbe')][_0x9bed('0x9c')][0x0];}return db['CmContact'][_0x9bed('0x55')](_[_0x9bed('0x9d')](_0x2c30f5[_0x9bed('0x56')],{'firstName':_0x5df6e2,'mobile':_0x5df6e2,'phone':_0x5df6e2,'ListId':_0x9b1e4b[_0x9bed('0x7b')]}));}})['then'](handleEntityNotFound(_0x15a5f8,null))['then'](function(_0x19ed3e){if(_0x19ed3e){_0x524351=_0x19ed3e;return db['SmsInteraction'][_0x9bed('0x54')]({'where':{'ContactId':_0x524351['id'],'closed':![],'SmsAccountId':_0x9b1e4b['id']}})['then'](function(_0x165e88){if(_0x165e88){return[_0x165e88,![]];}return db[_0x9bed('0x9f')][_0x9bed('0x55')]({'UserId':_0x2c30f5[_0x9bed('0x57')]['id'],'ContactId':_0x524351['id'],'SmsAccountId':_0x9b1e4b['id'],'phone':_0x5df6e2,'firstMsgDirection':_0x9bed('0xbf'),'Messages':[_[_0x9bed('0x4d')](_0x2c30f5[_0x9bed('0x56')],{'read':![],'body':_0x2c30f5['body'][_0x9bed('0x56')],'phone':_0x5df6e2,'SmsAccountId':_0x9b1e4b['id'],'UserId':_0x2c30f5[_0x9bed('0x57')]['id'],'ContactId':_0x524351['id']})]},{'include':[{'model':db[_0x9bed('0xa6')],'as':'Messages'}]})[_0x9bed('0x1d')](function(_0x3e900e){return[_0x3e900e,!![]];});});}})[_0x9bed('0xc0')](function(_0x325021,_0x5e40bf){if(_0x5e40bf){return _0x325021;}return db['SmsMessage'][_0x9bed('0x55')](_[_0x9bed('0x4d')](_0x2c30f5[_0x9bed('0x56')],{'read':![],'body':_0x2c30f5[_0x9bed('0x56')]['body'],'phone':_0x5df6e2,'SmsAccountId':_0x9b1e4b['id'],'SmsInteractionId':_0x325021['id'],'UserId':_0x2c30f5['user']['id'],'ContactId':_0x524351['id']}))[_0x9bed('0x1d')](function(_0x447b1e){_0x325021[_0x9bed('0xc1')]['Messages']=[];_0x325021[_0x9bed('0xc1')][_0x9bed('0xc2')]['push'](_0x447b1e[_0x9bed('0xc1')]);return _0x325021;});})['then'](respondWithResult(_0x15a5f8,null))['catch'](handleError(_0x15a5f8,null));};exports[_0x9bed('0x34')]=function(_0x167a86,_0x21a545,_0x30a0a2){if(_0x167a86[_0x9bed('0x56')]['id']){delete _0x167a86['body']['id'];}var _0x250575,_0x5131bd,_0xd664c2;return db[_0x9bed('0x50')][_0x9bed('0x54')]({'where':{'id':_0x167a86[_0x9bed('0x5d')]['id']}})[_0x9bed('0x1d')](handleEntityNotFound(_0x21a545,null))['then'](function(_0x5536de){if(_0x5536de){_0xd664c2=_0x5536de;logger[_0x9bed('0x20')](_0x9bed('0x21'),_0x9bed('0x34'),_0x9bed('0xc3'),_0x5536de[_0x9bed('0x3e')],util[_0x9bed('0xc4')](_0x167a86[_0x9bed('0x56')],{'showHidden':![],'depth':null}));switch(_0x5536de['type']){case _0x9bed('0x82'):if(_0x167a86['body'][_0x9bed('0xc5')]&&_0x167a86[_0x9bed('0x56')][_0x9bed('0x34')]){_0x5131bd=_0x167a86[_0x9bed('0x56')][_0x9bed('0x34')];return db['SmsMessage'][_0x9bed('0x54')]({'where':{'messageId':_0x167a86[_0x9bed('0x56')]['skebby_dispatch_id']}});}break;case _0x9bed('0x85'):if(_0x167a86[_0x9bed('0x56')][_0x9bed('0xc6')]&&_0x167a86[_0x9bed('0x56')][_0x9bed('0xc7')]){_0x5131bd=_0x167a86[_0x9bed('0x56')][_0x9bed('0xc7')];return db[_0x9bed('0xa6')][_0x9bed('0x54')]({'where':{'messageId':_0x167a86['body']['requestid']}});}break;case _0x9bed('0xc8'):if(_0x167a86['body'][_0x9bed('0x86')]&&_0x167a86[_0x9bed('0x56')][_0x9bed('0xc9')]){_0x5131bd=_0x167a86[_0x9bed('0x56')][_0x9bed('0xc9')];return db[_0x9bed('0xa6')][_0x9bed('0x54')]({'where':{'messageId':_0x167a86[_0x9bed('0x56')][_0x9bed('0x86')]}});}break;case _0x9bed('0xca'):var _0x49223f=_0x167a86[_0x9bed('0x56')]['results'][0x0];if(_0x49223f[_0x9bed('0x80')]&&_0x49223f['status'][_0x9bed('0xcb')]===_0x9bed('0xcc')){_0x5131bd=_0x49223f[_0x9bed('0x34')][_0x9bed('0xcb')];return db['SmsMessage'][_0x9bed('0x54')]({'where':{'messageId':_0x49223f[_0x9bed('0x80')]}});}break;case'clickatell':if(_0x167a86['body']['messageId']&&_0x167a86[_0x9bed('0x56')]['status']){_0x5131bd=_0x167a86['body'][_0x9bed('0x34')];return db[_0x9bed('0xa6')]['find']({'where':{'messageId':_0x167a86[_0x9bed('0x56')][_0x9bed('0x80')]}});}break;case _0x9bed('0x8e'):if(_0x167a86[_0x9bed('0x56')][0x0][_0x9bed('0x23')]['id']){_0x5131bd=_0x167a86[_0x9bed('0x56')][0x0][_0x9bed('0x3e')];return db[_0x9bed('0xa6')][_0x9bed('0x54')]({'where':{'messageId':_0x167a86[_0x9bed('0x56')][0x0][_0x9bed('0x23')]['id']}});}break;case'intelepeer':if(_0x167a86[_0x9bed('0x56')][_0x9bed('0xcd')]&&_0x167a86[_0x9bed('0x56')][_0x9bed('0x34')]){_0x5131bd=_0x167a86[_0x9bed('0x56')][_0x9bed('0x34')];return db[_0x9bed('0xa6')][_0x9bed('0x54')]({'where':{'messageId':_0x167a86[_0x9bed('0x56')][_0x9bed('0xcd')]}});}break;}}})[_0x9bed('0x1d')](handleEntityNotFound(_0x21a545,null))[_0x9bed('0x1d')](function(_0x7c2ff3){if(_0x7c2ff3){_0x250575=_0x7c2ff3;switch(_0xd664c2[_0x9bed('0x3e')]){case'skebby':if(_0x5131bd===_0x9bed('0xcc')){return _0x250575[_0x9bed('0x30')]({'read':!![]});}else{logger[_0x9bed('0x22')](_0x9bed('0x21'),_0x9bed('0x34'),_0x9bed('0x82'),util[_0x9bed('0xc4')](_0x167a86[_0x9bed('0x56')],{'showHidden':![],'depth':null}));}break;case _0x9bed('0x85'):if(_0x5131bd==='1'){return _0x250575['update']({'read':!![]});}else{logger[_0x9bed('0x22')](_0x9bed('0x21'),_0x9bed('0x34'),'skebby',util[_0x9bed('0xc4')](_0x167a86[_0x9bed('0x56')],{'showHidden':![],'depth':null}));}break;case _0x9bed('0xc8'):if(!_0x167a86[_0x9bed('0x56')][_0x9bed('0xce')]&&_0x5131bd>=0xc8&&_0x5131bd<=0xce){return _0x250575[_0x9bed('0x30')]({'read':!![]});}else{logger[_0x9bed('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9bed('0x34'),_0x9bed('0xc8'),util[_0x9bed('0xc4')](_0x167a86[_0x9bed('0x56')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xd06a57=_0x167a86['body']['results'][0x0];if(_0xd06a57[_0x9bed('0x34')][_0x9bed('0xcb')]===_0x9bed('0xcc')){return _0x250575[_0x9bed('0x30')]({'read':!![]});}else{logger[_0x9bed('0x22')](_0x9bed('0x21'),_0x9bed('0x34'),'infobip',util[_0x9bed('0xc4')](_0x167a86[_0x9bed('0x56')],{'showHidden':![],'depth':null}));}break;case _0x9bed('0xcf'):if(_0x5131bd==_0x9bed('0xd0')||_0x5131bd==_0x9bed('0xd1')){return _0x250575[_0x9bed('0x30')]({'read':!![]});}else{logger[_0x9bed('0x22')](_0x9bed('0x21'),'status',_0x9bed('0xcf'),util['inspect'](_0x167a86[_0x9bed('0x56')],{'showHidden':![],'depth':null}));}break;case _0x9bed('0x8e'):if(_0x5131bd=='message-delivered'){return _0x250575[_0x9bed('0x30')]({'read':!![]});}else{logger[_0x9bed('0x22')](_0x9bed('0x21'),_0x9bed('0x34'),_0x9bed('0x8e'),util[_0x9bed('0xc4')](_0x167a86['body'],{'showHidden':![],'depth':null}));}break;case _0x9bed('0x8f'):if(_0x5131bd==='DELIVRD'||_0x5131bd==='ACCEPTD'){return _0x250575[_0x9bed('0x30')]({'read':!![]});}else{logger[_0x9bed('0x22')](_0x9bed('0x21'),_0x9bed('0x34'),_0x9bed('0x8f'),util[_0x9bed('0xc4')](_0x167a86[_0x9bed('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x250575;}})['then'](respondWithResult(_0x21a545,null))[_0x9bed('0x26')](handleError(_0x21a545,null));};exports[_0x9bed('0xd2')]=function(_0x20edcc,_0xb245b,_0x5ced82){var _0x288cd2,_0x31eaa2,_0x32eef4;return db[_0x9bed('0x50')][_0x9bed('0x54')]({'where':{'id':_0x20edcc['params']['id']}})['then'](handleEntityNotFound(_0xb245b,null))[_0x9bed('0x1d')](function(_0x1d0a76){if(_0x1d0a76){_0x32eef4=_0x1d0a76;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9bed('0x34'),'received\x20delivery\x20report\x20from',_0x1d0a76[_0x9bed('0x3e')],util[_0x9bed('0xc4')](_0x20edcc[_0x9bed('0x41')],{'showHidden':![],'depth':null}));switch(_0x1d0a76['type']){case'csc':if(_0x20edcc[_0x9bed('0x41')][_0x9bed('0xd3')]&&_0x20edcc[_0x9bed('0x41')][_0x9bed('0xd4')]){_0x31eaa2=_0x20edcc['query'][_0x9bed('0xd4')];return db[_0x9bed('0xa6')][_0x9bed('0x54')]({'where':{'messageId':_0x20edcc[_0x9bed('0x41')][_0x9bed('0xd3')]}});}break;}}})['then'](handleEntityNotFound(_0xb245b,null))[_0x9bed('0x1d')](function(_0x4f4de0){if(_0x4f4de0){_0x288cd2=_0x4f4de0;switch(_0x32eef4[_0x9bed('0x3e')]){case'csc':if(_0x31eaa2==='2'||_0x31eaa2==='6'){return _0x288cd2[_0x9bed('0x30')]({'read':!![]});}else{logger['error'](_0x9bed('0x21'),_0x9bed('0x34'),_0x9bed('0xd5'),util['inspect'](_0x20edcc['query'],{'showHidden':![],'depth':null}));};break;}return _0x288cd2;}})[_0x9bed('0x1d')](respondWithResult(_0xb245b,null))['catch'](handleError(_0xb245b,null));};exports[_0x9bed('0xd6')]=function(_0x11d8c0,_0x56ca96,_0xb9437b){return db[_0x9bed('0x50')][_0x9bed('0x54')]({'where':{'id':_0x11d8c0['params']['id']}})['then'](handleEntityNotFound(_0x56ca96,null))[_0x9bed('0x1d')](function(_0x4dd64c){if(_0x4dd64c){return _0x4dd64c['addAgents'](_0x11d8c0[_0x9bed('0x56')][_0x9bed('0x6b')],_[_0x9bed('0x9b')](_0x11d8c0[_0x9bed('0x56')],[_0x9bed('0x6b'),'id'])||{})[_0x9bed('0xc0')](function(_0x4a301f){for(var _0x6fa645=0x0;_0x6fa645<_0x11d8c0[_0x9bed('0x56')][_0x9bed('0x6b')]['length'];_0x6fa645+=0x1){socket[_0x9bed('0xd7')]('userSmsAccount:save',{'UserId':_0x11d8c0['body']['ids'][_0x6fa645],'SmsAccountId':_0x11d8c0[_0x9bed('0x5d')]['id']});}return _0x4a301f;});}})['then'](respondWithResult(_0x56ca96,null))['catch'](handleError(_0x56ca96,null));};exports[_0x9bed('0xd8')]=function(_0x6ca5c0,_0x3e20da,_0x3e5f43){return db[_0x9bed('0x50')]['find']({'where':{'id':_0x6ca5c0['params']['id']}})[_0x9bed('0x1d')](handleEntityNotFound(_0x3e20da,null))[_0x9bed('0x1d')](function(_0x31b50d){if(_0x31b50d){return _0x31b50d[_0x9bed('0xd8')](_0x6ca5c0[_0x9bed('0x41')][_0x9bed('0x6b')])[_0x9bed('0x1d')](function(){if(_[_0x9bed('0xd9')](_0x6ca5c0[_0x9bed('0x41')][_0x9bed('0x6b')])){for(var _0x3eca2d=0x0;_0x3eca2d<_0x6ca5c0[_0x9bed('0x41')][_0x9bed('0x6b')][_0x9bed('0x47')];_0x3eca2d+=0x1){socket['emit'](_0x9bed('0xda'),{'UserId':Number(_0x6ca5c0[_0x9bed('0x41')][_0x9bed('0x6b')][_0x3eca2d]),'SmsAccountId':Number(_0x6ca5c0[_0x9bed('0x5d')]['id'])});}}else{socket[_0x9bed('0xd7')](_0x9bed('0xda'),{'UserId':Number(_0x6ca5c0[_0x9bed('0x41')][_0x9bed('0x6b')]),'SmsAccountId':Number(_0x6ca5c0[_0x9bed('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x3e20da,null))[_0x9bed('0x26')](handleError(_0x3e20da,null));};exports[_0x9bed('0xdb')]=function(_0xca111f,_0x1ee177,_0x29013a){var _0x3fcc45={};var _0x3fbbd6={};var _0xfb22f8;var _0x3d4b06;return db[_0x9bed('0x50')]['findOne']({'where':{'id':_0xca111f[_0x9bed('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1ee177,null))['then'](function(_0x50abd7){if(_0x50abd7){_0xfb22f8=_0x50abd7;_0x3fbbd6[_0x9bed('0x40')]=_[_0x9bed('0x42')](db[_0x9bed('0xa8')]['rawAttributes']);_0x3fbbd6['query']=_[_0x9bed('0x42')](_0xca111f[_0x9bed('0x41')]);_0x3fbbd6[_0x9bed('0x43')]=_[_0x9bed('0x44')](_0x3fbbd6[_0x9bed('0x40')],_0x3fbbd6[_0x9bed('0x41')]);_0x3fcc45[_0x9bed('0x45')]=_['intersection'](_0x3fbbd6[_0x9bed('0x40')],qs[_0x9bed('0x46')](_0xca111f[_0x9bed('0x41')][_0x9bed('0x46')]));_0x3fcc45['attributes']=_0x3fcc45[_0x9bed('0x45')]['length']?_0x3fcc45[_0x9bed('0x45')]:_0x3fbbd6[_0x9bed('0x40')];_0x3fcc45[_0x9bed('0x63')]=qs[_0x9bed('0x4a')](_0xca111f[_0x9bed('0x41')]['sort']);_0x3fcc45[_0x9bed('0x4b')]=qs[_0x9bed('0x43')](_[_0x9bed('0x64')](_0xca111f[_0x9bed('0x41')],_0x3fbbd6[_0x9bed('0x43')]));if(_0xca111f['query'][_0x9bed('0x4c')]){_0x3fcc45[_0x9bed('0x4b')]=_[_0x9bed('0x4d')](_0x3fcc45[_0x9bed('0x4b')],{'$or':_['map'](_0x3fcc45[_0x9bed('0x45')],function(_0x36837d){var _0x5907cd={};_0x5907cd[_0x36837d]={'$like':'%'+_0xca111f[_0x9bed('0x41')][_0x9bed('0x4c')]+'%'};return _0x5907cd;})});}_0x3fcc45=_[_0x9bed('0x4d')]({},_0x3fcc45,_0xca111f[_0x9bed('0x4e')]);return _0xfb22f8[_0x9bed('0xdb')](_0x3fcc45);}})[_0x9bed('0x1d')](function(_0x6a2d52){if(_0x6a2d52){_0x3d4b06=_0x6a2d52[_0x9bed('0x47')];if(!_0xca111f[_0x9bed('0x41')][_0x9bed('0x48')](_0x9bed('0x49'))){_0x3fcc45['limit']=qs[_0x9bed('0x2b')](_0xca111f['query'][_0x9bed('0x2b')]);_0x3fcc45[_0x9bed('0x29')]=qs[_0x9bed('0x29')](_0xca111f[_0x9bed('0x41')][_0x9bed('0x29')]);}return _0xfb22f8['getAgents'](_0x3fcc45);}})[_0x9bed('0x1d')](function(_0x1791e2){if(_0x1791e2){return _0x1791e2?{'count':_0x3d4b06,'rows':_0x1791e2}:null;}})['then'](respondWithResult(_0x1ee177,null))['catch'](handleError(_0x1ee177,null));}; \ No newline at end of file +var _0x1343=['length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','mandatoryDispositionPause','keys','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','SmsAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','Body','messageId','MessageSid','text','from','message_id','plivo','Text','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','created','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','send','addApplications','transaction','bulkCreate','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','List','dataValues','Messages','push','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','connectel','statusInt','clicksend','status_code','groupName','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','state','addAgents','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','name','index','Pause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','attributes','fields'];(function(_0x4e41c4,_0x4fa440){var _0x3c510d=function(_0x4ae3cb){while(--_0x4ae3cb){_0x4e41c4['push'](_0x4e41c4['shift']());}};_0x3c510d(++_0x4fa440);}(_0x1343,0x180));var _0x3134=function(_0x1739ec,_0x297362){_0x1739ec=_0x1739ec-0x0;var _0x5cf0ca=_0x1343[_0x1739ec];return _0x5cf0ca;};'use strict';var emlformat=require(_0x3134('0x0'));var rimraf=require(_0x3134('0x1'));var zipdir=require(_0x3134('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3134('0x3'));var moment=require(_0x3134('0x4'));var BPromise=require(_0x3134('0x5'));var Mustache=require('mustache');var util=require(_0x3134('0x6'));var path=require(_0x3134('0x7'));var sox=require('sox');var csv=require(_0x3134('0x8'));var ejs=require(_0x3134('0x9'));var fs=require('fs');var fs_extra=require(_0x3134('0xa'));var _=require(_0x3134('0xb'));var squel=require(_0x3134('0xc'));var crypto=require(_0x3134('0xd'));var jsforce=require(_0x3134('0xe'));var deskjs=require(_0x3134('0xf'));var toCsv=require(_0x3134('0x8'));var querystring=require(_0x3134('0x10'));var Papa=require(_0x3134('0x11'));var Redis=require(_0x3134('0x12'));var authService=require(_0x3134('0x13'));var qs=require(_0x3134('0x14'));var as=require(_0x3134('0x15'));var hardwareService=require(_0x3134('0x16'));var logger=require('../../config/logger')(_0x3134('0x17'));var utils=require(_0x3134('0x18'));var config=require(_0x3134('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x3134('0x1a'))['db'];config[_0x3134('0x1b')]=_[_0x3134('0x1c')](config[_0x3134('0x1b')],{'host':_0x3134('0x1d'),'port':0x18eb});var socket=require(_0x3134('0x1e'))(new Redis(config[_0x3134('0x1b')]));require(_0x3134('0x1f'))[_0x3134('0x20')](socket);var jayson=require(_0x3134('0x21'));var client=jayson[_0x3134('0x22')]['http']({'port':0x232c});function respondWithRpcPromise(_0x52e07f,_0x34fd89,_0x280ed7,_0x5d7bc0){return new BPromise(function(_0x426db4,_0x121332){var _0x37ad28=_0x5d7bc0||client;return _0x37ad28[_0x3134('0x23')](_0x52e07f,_0x280ed7)[_0x3134('0x24')](function(_0xb5afd){logger[_0x3134('0x25')](_0x3134('0x26'),_0x34fd89,_0x3134('0x27'));logger[_0x3134('0x28')](_0x3134('0x29'),_0x34fd89,_0x3134('0x27'),JSON[_0x3134('0x2a')](_0xb5afd));if(_0xb5afd['error']){if(_0xb5afd[_0x3134('0x2b')]['code']===0x1f4){logger[_0x3134('0x2b')](_0x3134('0x26'),_0x34fd89,_0xb5afd[_0x3134('0x2b')]['message']);return _0x121332(_0xb5afd[_0x3134('0x2b')][_0x3134('0x2c')]);}logger[_0x3134('0x2b')](_0x3134('0x26'),_0x34fd89,_0xb5afd['error'][_0x3134('0x2c')]);return _0x426db4(_0xb5afd[_0x3134('0x2b')][_0x3134('0x2c')]);}else{logger['info'](_0x3134('0x26'),_0x34fd89,_0x3134('0x27'));_0x426db4(_0xb5afd[_0x3134('0x2d')][_0x3134('0x2c')]);}})['catch'](function(_0x3586a6){logger[_0x3134('0x2b')]('SmsAccount,\x20%s,\x20%s',_0x34fd89,_0x3586a6);_0x121332(_0x3586a6);});});}function respondWithStatusCode(_0x2ea955,_0xfd3a5e){_0xfd3a5e=_0xfd3a5e||0xcc;return function(_0x2a0735){if(_0x2a0735){return _0x2ea955[_0x3134('0x2e')](_0xfd3a5e);}return _0x2ea955['status'](_0xfd3a5e)[_0x3134('0x2f')]();};}function respondWithResult(_0x4acf1a,_0x450137){_0x450137=_0x450137||0xc8;return function(_0x1dfe0d){if(_0x1dfe0d){return _0x4acf1a[_0x3134('0x30')](_0x450137)[_0x3134('0x31')](_0x1dfe0d);}};}function respondWithFilteredResult(_0x42f764,_0x329579){return function(_0x42d7de){if(_0x42d7de){var _0xcdbe95=typeof _0x329579[_0x3134('0x32')]===_0x3134('0x33')&&typeof _0x329579[_0x3134('0x34')]===_0x3134('0x33');var _0x2462fd=_0x42d7de['count'];var _0x20f75f=_0xcdbe95?0x0:_0x329579[_0x3134('0x32')];var _0x80cf5b=_0xcdbe95?_0x42d7de[_0x3134('0x35')]:_0x329579[_0x3134('0x32')]+_0x329579['limit'];var _0x565704;if(_0x80cf5b>=_0x2462fd){_0x80cf5b=_0x2462fd;_0x565704=0xc8;}else{_0x565704=0xce;}_0x42f764[_0x3134('0x30')](_0x565704);return _0x42f764[_0x3134('0x36')](_0x3134('0x37'),_0x20f75f+'-'+_0x80cf5b+'/'+_0x2462fd)['json'](_0x42d7de);}return null;};}function patchUpdates(_0x3828dd){return function(_0x4cd926){try{jsonpatch['apply'](_0x4cd926,_0x3828dd,!![]);}catch(_0x15ecf4){return BPromise[_0x3134('0x38')](_0x15ecf4);}return _0x4cd926[_0x3134('0x39')]();};}function saveUpdates(_0x5bc834,_0x1e8340){return function(_0x131b54){if(_0x131b54){return _0x131b54[_0x3134('0x3a')](_0x5bc834)[_0x3134('0x24')](function(_0x5c4f59){return _0x5c4f59;});}return null;};}function removeEntity(_0x25a21c,_0x1be100){return function(_0x3a632c){if(_0x3a632c){return _0x3a632c[_0x3134('0x3b')]()[_0x3134('0x24')](function(){var _0x1175b1=_0x3a632c[_0x3134('0x3c')]({'plain':!![]});var _0x2bf8cf=_0x3134('0x3d');return db[_0x3134('0x3e')][_0x3134('0x3b')]({'where':{'type':_0x2bf8cf,'resourceId':_0x1175b1['id']}})[_0x3134('0x24')](function(){return _0x3a632c;});})[_0x3134('0x24')](function(){_0x25a21c[_0x3134('0x30')](0xcc)[_0x3134('0x2f')]();});}};}function handleEntityNotFound(_0xdaf4c0,_0x4ec856){return function(_0x2e5c48){if(!_0x2e5c48){_0xdaf4c0[_0x3134('0x2e')](0x194);}return _0x2e5c48;};}function handleError(_0x4d67d1,_0x5258b9){_0x5258b9=_0x5258b9||0x1f4;return function(_0x25fb67){logger[_0x3134('0x2b')](_0x25fb67['stack']);if(_0x25fb67[_0x3134('0x3f')]){delete _0x25fb67[_0x3134('0x3f')];}_0x4d67d1[_0x3134('0x30')](_0x5258b9)['send'](_0x25fb67);};}exports[_0x3134('0x40')]=function(_0x3d4041,_0xd5bf0a){var _0x1e8317={'include':[{'model':db[_0x3134('0x41')],'as':'mandatoryDispositionPause'}]},_0x37249d={},_0x283d1a={'count':0x0,'rows':[]};var _0x2f4357=_[_0x3134('0x42')](db[_0x3134('0x43')][_0x3134('0x44')],function(_0x3dcda6){return{'name':_0x3dcda6[_0x3134('0x45')],'type':_0x3dcda6[_0x3134('0x46')][_0x3134('0x47')]};});_0x37249d[_0x3134('0x48')]=_['map'](_0x2f4357,_0x3134('0x3f'));_0x37249d[_0x3134('0x49')]=_['keys'](_0x3d4041[_0x3134('0x49')]);_0x37249d['filters']=_['intersection'](_0x37249d[_0x3134('0x48')],_0x37249d[_0x3134('0x49')]);_0x1e8317[_0x3134('0x4a')]=_['intersection'](_0x37249d[_0x3134('0x48')],qs[_0x3134('0x4b')](_0x3d4041[_0x3134('0x49')][_0x3134('0x4b')]));_0x1e8317[_0x3134('0x4a')]=_0x1e8317[_0x3134('0x4a')][_0x3134('0x4c')]?_0x1e8317[_0x3134('0x4a')]:_0x37249d[_0x3134('0x48')];if(!_0x3d4041[_0x3134('0x49')][_0x3134('0x4d')](_0x3134('0x4e'))){_0x1e8317[_0x3134('0x34')]=qs[_0x3134('0x34')](_0x3d4041['query'][_0x3134('0x34')]);_0x1e8317[_0x3134('0x32')]=qs['offset'](_0x3d4041['query'][_0x3134('0x32')]);}_0x1e8317[_0x3134('0x4f')]=qs['sort'](_0x3d4041['query'][_0x3134('0x50')]);_0x1e8317[_0x3134('0x51')]=qs['filters'](_[_0x3134('0x52')](_0x3d4041['query'],_0x37249d[_0x3134('0x53')]),_0x2f4357);if(_0x3d4041[_0x3134('0x49')][_0x3134('0x54')]){_0x1e8317[_0x3134('0x51')]=_[_0x3134('0x55')](_0x1e8317[_0x3134('0x51')],{'$or':_[_0x3134('0x42')](_0x2f4357,function(_0x1729d8){if(_0x1729d8[_0x3134('0x46')]!==_0x3134('0x56')){var _0x189087={};_0x189087[_0x1729d8[_0x3134('0x3f')]]={'$like':'%'+_0x3d4041['query'][_0x3134('0x54')]+'%'};return _0x189087;}})});}_0x1e8317=_[_0x3134('0x55')]({},_0x1e8317,_0x3d4041[_0x3134('0x57')]);var _0xce9930={'where':_0x1e8317[_0x3134('0x51')]};return db[_0x3134('0x43')][_0x3134('0x35')](_0xce9930)[_0x3134('0x24')](function(_0x166c38){_0x283d1a[_0x3134('0x35')]=_0x166c38;if(_0x3d4041[_0x3134('0x49')][_0x3134('0x58')]){_0x1e8317[_0x3134('0x59')]=[{'all':!![]}];}return db[_0x3134('0x43')]['findAll'](_0x1e8317);})[_0x3134('0x24')](function(_0x3eff52){_0x283d1a[_0x3134('0x5a')]=_0x3eff52;return _0x283d1a;})[_0x3134('0x24')](respondWithFilteredResult(_0xd5bf0a,_0x1e8317))[_0x3134('0x5b')](handleError(_0xd5bf0a,null));};exports[_0x3134('0x5c')]=function(_0x5e1b6a,_0xc4b2aa){var _0x515a88={'raw':![],'where':{'id':_0x5e1b6a[_0x3134('0x5d')]['id']},'include':[{'model':db[_0x3134('0x41')],'as':_0x3134('0x5e')}]},_0x56fa1c={};_0x56fa1c['model']=_[_0x3134('0x5f')](db[_0x3134('0x43')][_0x3134('0x44')]);_0x56fa1c[_0x3134('0x49')]=_[_0x3134('0x5f')](_0x5e1b6a[_0x3134('0x49')]);_0x56fa1c['filters']=_[_0x3134('0x60')](_0x56fa1c[_0x3134('0x48')],_0x56fa1c[_0x3134('0x49')]);_0x515a88[_0x3134('0x4a')]=_[_0x3134('0x60')](_0x56fa1c[_0x3134('0x48')],qs[_0x3134('0x4b')](_0x5e1b6a['query']['fields']));_0x515a88[_0x3134('0x4a')]=_0x515a88['attributes'][_0x3134('0x4c')]?_0x515a88[_0x3134('0x4a')]:_0x56fa1c[_0x3134('0x48')];if(_0x5e1b6a['query']['includeAll']){_0x515a88[_0x3134('0x59')]=[{'all':!![]}];}_0x515a88=_[_0x3134('0x55')]({},_0x515a88,_0x5e1b6a[_0x3134('0x57')]);return db[_0x3134('0x43')][_0x3134('0x61')](_0x515a88)[_0x3134('0x24')](handleEntityNotFound(_0xc4b2aa,null))[_0x3134('0x24')](respondWithResult(_0xc4b2aa,null))[_0x3134('0x5b')](handleError(_0xc4b2aa,null));};exports[_0x3134('0x62')]=function(_0x457aef,_0x5b2008){return db[_0x3134('0x43')]['create'](_0x457aef['body'],{})[_0x3134('0x24')](function(_0x2d30d1){var _0x327a5c=_0x457aef[_0x3134('0x63')]['get']({'plain':!![]});if(!_0x327a5c)throw new Error(_0x3134('0x64'));if(_0x327a5c[_0x3134('0x65')]===_0x3134('0x63')){var _0x57b580=_0x2d30d1[_0x3134('0x3c')]({'plain':!![]});var _0x538ded=_0x3134('0x3d');return db[_0x3134('0x66')][_0x3134('0x61')]({'where':{'name':_0x538ded,'userProfileId':_0x327a5c[_0x3134('0x67')]},'raw':!![]})[_0x3134('0x24')](function(_0x350bde){if(_0x350bde&&_0x350bde[_0x3134('0x68')]===0x0){return db[_0x3134('0x3e')][_0x3134('0x62')]({'name':_0x57b580['name'],'resourceId':_0x57b580['id'],'type':_0x350bde[_0x3134('0x3f')],'sectionId':_0x350bde['id']},{})[_0x3134('0x24')](function(){return _0x2d30d1;});}else{return _0x2d30d1;}})[_0x3134('0x5b')](function(_0x350ef7){logger['error'](_0x3134('0x69'),_0x350ef7);throw _0x350ef7;});}return _0x2d30d1;})[_0x3134('0x24')](respondWithResult(_0x5b2008,0xc9))['catch'](handleError(_0x5b2008,null));};exports[_0x3134('0x3a')]=function(_0x16bee8,_0x485488){if(_0x16bee8[_0x3134('0x6a')]['id']){delete _0x16bee8['body']['id'];}return db[_0x3134('0x43')][_0x3134('0x61')]({'where':{'id':_0x16bee8[_0x3134('0x5d')]['id']},'include':[{'model':db[_0x3134('0x41')],'as':_0x3134('0x5e')}]})['then'](handleEntityNotFound(_0x485488,null))[_0x3134('0x24')](saveUpdates(_0x16bee8['body'],null))[_0x3134('0x24')](respondWithResult(_0x485488,null))['catch'](handleError(_0x485488,null));};exports['destroy']=function(_0xdc35bb,_0x10a3eb){return db[_0x3134('0x43')][_0x3134('0x61')]({'where':{'id':_0xdc35bb['params']['id']}})[_0x3134('0x24')](handleEntityNotFound(_0x10a3eb,null))['then'](removeEntity(_0x10a3eb,null))['catch'](handleError(_0x10a3eb,null));};exports[_0x3134('0x6b')]=function(_0x47e5ea,_0x2f0d16){return db[_0x3134('0x43')][_0x3134('0x6b')]()[_0x3134('0x24')](respondWithResult(_0x2f0d16,null))['catch'](handleError(_0x2f0d16,null));};exports['addDisposition']=function(_0x5309ff,_0x43229a,_0x454972){if(_0x5309ff[_0x3134('0x6a')]['id']){delete _0x5309ff['body']['id'];}return db[_0x3134('0x43')]['find']({'where':{'id':_0x5309ff[_0x3134('0x5d')]['id']}})['then'](handleEntityNotFound(_0x43229a,null))[_0x3134('0x24')](function(_0x353b24){if(_0x353b24){_0x5309ff[_0x3134('0x6a')][_0x3134('0x6c')]=_0x353b24['id'];return db[_0x3134('0x6d')][_0x3134('0x62')](_0x5309ff[_0x3134('0x6a')]);}})[_0x3134('0x24')](respondWithResult(_0x43229a,null))['catch'](handleError(_0x43229a,null));};exports[_0x3134('0x6e')]=function(_0x2a5634,_0x56a9a9,_0x11ff05){var _0x15b14f={'raw':![],'where':{}};var _0x25a895={};var _0x422be7={'count':0x0,'rows':[]};return db[_0x3134('0x43')][_0x3134('0x6f')]({'where':{'id':_0x2a5634['params']['id']}})[_0x3134('0x24')](handleEntityNotFound(_0x56a9a9,null))[_0x3134('0x24')](function(_0x523387){if(_0x523387){_0x25a895[_0x3134('0x48')]=_['keys'](db[_0x3134('0x6d')][_0x3134('0x44')]);_0x25a895['query']=_[_0x3134('0x5f')](_0x2a5634['query']);_0x25a895[_0x3134('0x53')]=_[_0x3134('0x60')](_0x25a895[_0x3134('0x48')],_0x25a895[_0x3134('0x49')]);_0x15b14f['attributes']=_[_0x3134('0x60')](_0x25a895[_0x3134('0x48')],qs[_0x3134('0x4b')](_0x2a5634[_0x3134('0x49')][_0x3134('0x4b')]));_0x15b14f[_0x3134('0x4a')]=_0x15b14f[_0x3134('0x4a')][_0x3134('0x4c')]?_0x15b14f[_0x3134('0x4a')]:_0x25a895['model'];if(!_0x2a5634[_0x3134('0x49')][_0x3134('0x4d')](_0x3134('0x4e'))){_0x15b14f['limit']=qs[_0x3134('0x34')](_0x2a5634[_0x3134('0x49')][_0x3134('0x34')]);_0x15b14f[_0x3134('0x32')]=qs[_0x3134('0x32')](_0x2a5634['query']['offset']);}_0x15b14f[_0x3134('0x4f')]=qs[_0x3134('0x50')](_0x2a5634[_0x3134('0x49')][_0x3134('0x50')]);_0x15b14f[_0x3134('0x51')]=qs['filters'](_[_0x3134('0x52')](_0x2a5634['query'],_0x25a895[_0x3134('0x53')]));_0x15b14f['where'][_0x3134('0x6c')]=_0x523387['id'];if(_0x2a5634['query']['filter']){_0x15b14f[_0x3134('0x51')]=_[_0x3134('0x55')](_0x15b14f[_0x3134('0x51')],{'$or':_[_0x3134('0x42')](_0x15b14f[_0x3134('0x4a')],function(_0x3057d3){var _0x2aeb7c={};_0x2aeb7c[_0x3057d3]={'$like':'%'+_0x2a5634[_0x3134('0x49')][_0x3134('0x54')]+'%'};return _0x2aeb7c;})});}_0x15b14f=_[_0x3134('0x55')]({},_0x15b14f,_0x2a5634['options']);return db['Disposition']['count']({'where':_0x15b14f['where']})['then'](function(_0x35be8e){_0x422be7['count']=_0x35be8e;if(_0x2a5634['query'][_0x3134('0x58')]){_0x15b14f[_0x3134('0x59')]=[{'all':!![]}];}return db[_0x3134('0x6d')][_0x3134('0x70')](_0x15b14f);})[_0x3134('0x24')](function(_0x55c332){_0x422be7[_0x3134('0x5a')]=_0x55c332;return _0x422be7;});}})[_0x3134('0x24')](respondWithFilteredResult(_0x56a9a9,_0x15b14f))[_0x3134('0x5b')](handleError(_0x56a9a9,null));};exports[_0x3134('0x71')]=function(_0x1d6bcf,_0xfec4c8,_0x28497f){return db['SmsAccount'][_0x3134('0x61')]({'where':{'id':_0x1d6bcf[_0x3134('0x5d')]['id']}})[_0x3134('0x24')](handleEntityNotFound(_0xfec4c8,null))['then'](function(_0x534919){if(_0x534919){return _0x534919[_0x3134('0x71')](_0x1d6bcf[_0x3134('0x49')][_0x3134('0x72')]);}})[_0x3134('0x24')](respondWithStatusCode(_0xfec4c8,null))[_0x3134('0x5b')](handleError(_0xfec4c8,null));};exports[_0x3134('0x73')]=function(_0x3ddcfb,_0x27065c,_0x33ae3a){if(_0x3ddcfb[_0x3134('0x6a')]['id']){delete _0x3ddcfb['body']['id'];}return db[_0x3134('0x43')][_0x3134('0x61')]({'where':{'id':_0x3ddcfb[_0x3134('0x5d')]['id']}})[_0x3134('0x24')](handleEntityNotFound(_0x27065c,null))[_0x3134('0x24')](function(_0x25955d){if(_0x25955d){_0x3ddcfb[_0x3134('0x6a')]['SmsAccountId']=_0x25955d['id'];return db['CannedAnswer'][_0x3134('0x62')](_0x3ddcfb['body']);}})[_0x3134('0x24')](respondWithResult(_0x27065c,null))['catch'](handleError(_0x27065c,null));};exports[_0x3134('0x74')]=function(_0x19d0d3,_0x1c9cc7,_0x917c0d){var _0x511bf7={'raw':![],'where':{}};var _0x2f880e={};var _0x1cc60b={'count':0x0,'rows':[]};return db[_0x3134('0x43')][_0x3134('0x6f')]({'where':{'id':_0x19d0d3[_0x3134('0x5d')]['id']}})[_0x3134('0x24')](handleEntityNotFound(_0x1c9cc7,null))['then'](function(_0x4d4133){if(_0x4d4133){_0x2f880e[_0x3134('0x48')]=_[_0x3134('0x5f')](db['CannedAnswer'][_0x3134('0x44')]);_0x2f880e[_0x3134('0x49')]=_[_0x3134('0x5f')](_0x19d0d3[_0x3134('0x49')]);_0x2f880e[_0x3134('0x53')]=_['intersection'](_0x2f880e['model'],_0x2f880e['query']);_0x511bf7['attributes']=_['intersection'](_0x2f880e[_0x3134('0x48')],qs[_0x3134('0x4b')](_0x19d0d3[_0x3134('0x49')]['fields']));_0x511bf7['attributes']=_0x511bf7[_0x3134('0x4a')]['length']?_0x511bf7[_0x3134('0x4a')]:_0x2f880e[_0x3134('0x48')];if(!_0x19d0d3[_0x3134('0x49')]['hasOwnProperty'](_0x3134('0x4e'))){_0x511bf7[_0x3134('0x34')]=qs[_0x3134('0x34')](_0x19d0d3['query']['limit']);_0x511bf7['offset']=qs[_0x3134('0x32')](_0x19d0d3['query'][_0x3134('0x32')]);}_0x511bf7[_0x3134('0x4f')]=qs['sort'](_0x19d0d3[_0x3134('0x49')]['sort']);_0x511bf7[_0x3134('0x51')]=qs[_0x3134('0x53')](_[_0x3134('0x52')](_0x19d0d3[_0x3134('0x49')],_0x2f880e[_0x3134('0x53')]));_0x511bf7[_0x3134('0x51')][_0x3134('0x6c')]=_0x4d4133['id'];if(_0x19d0d3[_0x3134('0x49')]['filter']){_0x511bf7[_0x3134('0x51')]=_[_0x3134('0x55')](_0x511bf7[_0x3134('0x51')],{'$or':_[_0x3134('0x42')](_0x511bf7[_0x3134('0x4a')],function(_0x377b39){var _0x2215c2={};_0x2215c2[_0x377b39]={'$like':'%'+_0x19d0d3[_0x3134('0x49')][_0x3134('0x54')]+'%'};return _0x2215c2;})});}_0x511bf7=_['merge']({},_0x511bf7,_0x19d0d3[_0x3134('0x57')]);return db[_0x3134('0x75')][_0x3134('0x35')]({'where':_0x511bf7['where']})[_0x3134('0x24')](function(_0x269294){_0x1cc60b[_0x3134('0x35')]=_0x269294;if(_0x19d0d3[_0x3134('0x49')]['includeAll']){_0x511bf7['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x3134('0x70')](_0x511bf7);})['then'](function(_0x593ecf){_0x1cc60b[_0x3134('0x5a')]=_0x593ecf;return _0x1cc60b;});}})[_0x3134('0x24')](respondWithFilteredResult(_0x1c9cc7,_0x511bf7))['catch'](handleError(_0x1c9cc7,null));};exports[_0x3134('0x76')]=function(_0x57e5ae,_0x182844,_0x59a8ba){return db[_0x3134('0x43')][_0x3134('0x61')]({'where':{'id':_0x57e5ae['params']['id']}})[_0x3134('0x24')](handleEntityNotFound(_0x182844,null))[_0x3134('0x24')](function(_0x1f7323){if(_0x1f7323){return _0x1f7323[_0x3134('0x76')](_0x57e5ae[_0x3134('0x49')][_0x3134('0x72')]);}})[_0x3134('0x24')](respondWithStatusCode(_0x182844,null))[_0x3134('0x5b')](handleError(_0x182844,null));};exports[_0x3134('0x77')]=function(_0x5b8e87,_0x5f154d,_0xaead4e){var _0xfd9544={'channel':_0x3134('0x78')};var _0x99e302=[];var _0x2773c8=[];var _0x2a5690={};return db['SmsAccount'][_0x3134('0x61')]({'where':{'id':_0x5b8e87[_0x3134('0x5d')]['id']},'include':[{'model':db[_0x3134('0x79')],'as':_0x3134('0x7a')}]})[_0x3134('0x24')](handleEntityNotFound(_0x5f154d,null))[_0x3134('0x24')](function(_0x5720ea){_0xfd9544[_0x3134('0x7b')]=_0x5720ea;_0xfd9544[_0x3134('0x7c')]=_[_0x3134('0x7d')](_0x5720ea[_0x3134('0x7a')],[_0x3134('0x7e')],[_0x3134('0x7f')]);if(_0xfd9544[_0x3134('0x7b')][_0x3134('0x7a')]){delete _0xfd9544[_0x3134('0x7b')][_0x3134('0x7a')];}return db[_0x3134('0x80')][_0x3134('0x6b')]();})[_0x3134('0x24')](function(_0x255a56){if(!_0x255a56){throw new db[(_0x3134('0x81'))][(_0x3134('0x82'))]('no\x20available\x20attributes');}_0x99e302=_[_0x3134('0x83')](_[_0x3134('0x5f')](_0x255a56),[_0x3134('0x84'),_0x3134('0x85')]);_0x2773c8=_[_0x3134('0x83')](_['keys'](_0x255a56),[_0x3134('0x84'),'updatedAt',_0x3134('0x86'),_0x3134('0x87')]);_0xfd9544[_0x3134('0x6a')]={'mapKey':_0x3134('0x88')};if(_0xfd9544[_0x3134('0x7b')][_0x3134('0x46')]){switch(_0xfd9544[_0x3134('0x7b')][_0x3134('0x46')]){case _0x3134('0x89'):_0xfd9544[_0x3134('0x6a')]['from']=_0x5b8e87[_0x3134('0x6a')][_0x3134('0x8a')];_0xfd9544[_0x3134('0x6a')][_0x3134('0x6a')]=_0x5b8e87[_0x3134('0x6a')][_0x3134('0x8b')];_0xfd9544[_0x3134('0x6a')][_0x3134('0x8c')]=_0x5b8e87[_0x3134('0x6a')][_0x3134('0x8d')];break;case'skebby':_0xfd9544[_0x3134('0x6a')]['from']='+'+_0x5b8e87['body']['sender'];_0xfd9544['body'][_0x3134('0x6a')]=_0x5b8e87[_0x3134('0x6a')][_0x3134('0x8e')];break;case'connectel':_0xfd9544[_0x3134('0x6a')]['from']=_0x5b8e87[_0x3134('0x6a')]['from'];_0xfd9544[_0x3134('0x6a')]['body']=_0x5b8e87[_0x3134('0x6a')][_0x3134('0x2c')];break;case'clicksend':_0xfd9544['body']['from']=_0x5b8e87[_0x3134('0x6a')][_0x3134('0x8f')];_0xfd9544[_0x3134('0x6a')][_0x3134('0x6a')]=_0x5b8e87[_0x3134('0x6a')]['body'];_0xfd9544[_0x3134('0x6a')][_0x3134('0x8c')]=_0x5b8e87[_0x3134('0x6a')][_0x3134('0x90')];break;case _0x3134('0x91'):_0xfd9544[_0x3134('0x6a')][_0x3134('0x8f')]=_0x5b8e87[_0x3134('0x6a')][_0x3134('0x8a')];_0xfd9544[_0x3134('0x6a')]['body']=_0x5b8e87[_0x3134('0x6a')][_0x3134('0x92')];_0xfd9544[_0x3134('0x6a')][_0x3134('0x8c')]=_0x5b8e87[_0x3134('0x6a')][_0x3134('0x93')];break;case _0x3134('0x94'):_0xfd9544['body'][_0x3134('0x8f')]='+'+_0x5b8e87['body'][_0x3134('0x95')][0x0][_0x3134('0x8f')];_0xfd9544[_0x3134('0x6a')][_0x3134('0x6a')]=_0x5b8e87['body'][_0x3134('0x95')][0x0]['text'];_0xfd9544[_0x3134('0x6a')][_0x3134('0x8c')]=_0x5b8e87['body'][_0x3134('0x95')][0x0]['messageId'];break;case _0x3134('0x96'):_0xfd9544[_0x3134('0x6a')][_0x3134('0x8f')]=_0x5b8e87[_0x3134('0x6a')]['originatingAddress'];_0xfd9544[_0x3134('0x6a')][_0x3134('0x6a')]=_0x5b8e87[_0x3134('0x6a')][_0x3134('0x97')]['message'];break;case _0x3134('0x98'):_0xfd9544['body'][_0x3134('0x8f')]=_0x5b8e87[_0x3134('0x6a')][_0x3134('0x99')];_0xfd9544[_0x3134('0x6a')][_0x3134('0x6a')]=_0x5b8e87['body'][_0x3134('0x8e')];_0xfd9544[_0x3134('0x6a')][_0x3134('0x8c')]=_0x5b8e87[_0x3134('0x6a')][_0x3134('0x9a')];break;case _0x3134('0x9b'):_0xfd9544['body'][_0x3134('0x8c')]=_0x5b8e87[_0x3134('0x6a')][0x0][_0x3134('0x2c')]['id'];_0xfd9544[_0x3134('0x6a')]['from']=_0x5b8e87['body'][0x0][_0x3134('0x2c')]['from'];_0xfd9544[_0x3134('0x6a')]['body']=_0x5b8e87[_0x3134('0x6a')][0x0][_0x3134('0x2c')]['text'];break;case _0x3134('0x9c'):_0xfd9544[_0x3134('0x6a')][_0x3134('0x8f')]=_0x5b8e87[_0x3134('0x6a')][_0x3134('0x8f')];_0xfd9544[_0x3134('0x6a')][_0x3134('0x6a')]=_0x5b8e87[_0x3134('0x6a')]['message'];_0xfd9544['body']['messageId']=_0x5b8e87[_0x3134('0x6a')][_0x3134('0x9d')];break;}}if(_0xfd9544[_0x3134('0x6a')]['id']){delete _0xfd9544[_0x3134('0x6a')]['id'];}if(_[_0x3134('0x9e')](_0xfd9544[_0x3134('0x6a')]['from'])){throw new db[(_0x3134('0x81'))][(_0x3134('0x82'))](_0x3134('0x9f'));}if(_[_0x3134('0x9e')](_0xfd9544[_0x3134('0x6a')]['body'])||_0xfd9544['body'][_0x3134('0x6a')]===''){throw new db['Sequelize'][(_0x3134('0x82'))](_0x3134('0xa0'));}if(_[_0x3134('0x9e')](_0xfd9544[_0x3134('0x6a')]['mapKey'])){throw new db[(_0x3134('0x81'))]['ValidationError'](_0x3134('0xa1')+_0x2773c8);}if(!_[_0x3134('0xa2')](_0x2773c8,_0xfd9544[_0x3134('0x6a')]['mapKey'])){throw new db[(_0x3134('0x81'))][(_0x3134('0x82'))](_0x3134('0xa3')+_0x2773c8);}_0x2a5690[_0xfd9544[_0x3134('0x6a')][_0x3134('0xa4')]]=_0xfd9544['body'][_0x3134('0x8f')];return db['CmList'][_0x3134('0x61')]({'where':{'id':_0xfd9544[_0x3134('0x7b')][_0x3134('0x87')]},'include':[{'model':db[_0x3134('0x80')],'as':_0x3134('0xa5'),'where':_0x2a5690,'limit':0x1,'order':[['updatedAt',_0x3134('0xa6')]]}]});})[_0x3134('0x24')](handleEntityNotFound(_0x5f154d,null))[_0x3134('0x24')](function(_0x5ed52e){if(_0x5ed52e){_0xfd9544[_0x3134('0xa7')]=_[_0x3134('0xa8')](_0x5ed52e,[_0x3134('0xa5')]);if(_0x5ed52e[_0x3134('0xa5')][_0x3134('0x4c')]){return _0x5ed52e[_0x3134('0xa5')][0x0];}var _0x49005a=_['defaults'](_0xfd9544['body'],{'firstName':_0xfd9544[_0x3134('0x6a')][_0x3134('0x8f')],'ListId':_0x5ed52e['id']});_0x49005a[_0xfd9544[_0x3134('0x6a')][_0x3134('0xa4')]]=_0xfd9544[_0x3134('0x6a')][_0x3134('0x8f')];return db[_0x3134('0x80')][_0x3134('0x62')](_0x49005a,{'fields':_0x99e302,'raw':!![]});}})[_0x3134('0x24')](handleEntityNotFound(_0x5f154d,null))['then'](function(_0x5a96e1){if(_0x5a96e1){_0xfd9544['contact']=_0x5a96e1;var _0x64b228={'ContactId':_0x5a96e1['id'],'phone':_0xfd9544['body'][_0x3134('0x8f')],'SmsAccountId':_0x5b8e87[_0x3134('0x5d')]['id']};var _0x3959ce={'ContactId':_0x5a96e1['id'],'SmsAccountId':_0x5b8e87[_0x3134('0x5d')]['id'],'closed':![]};return db[_0x3134('0xa9')][_0x3134('0x61')]({'where':_0x3959ce})[_0x3134('0x24')](function(_0x56a891){if(_0x56a891){return[_0x56a891,![]];}return db[_0x3134('0xa9')][_0x3134('0x62')](_0x64b228)[_0x3134('0x24')](function(_0x54c263){return[_0x54c263,!![]];});});}})[_0x3134('0xaa')](function(_0x569413,_0x36fe73){_0xfd9544['interaction']=_0x569413[_0x3134('0x3c')]({'plain':!![]});_0xfd9544[_0x3134('0xab')][_0x3134('0xac')]=![];if(_0x36fe73){if(_0xfd9544[_0x3134('0x7b')]['autoclose']){_0xfd9544['applications']['push']({'id':0x0,'priority':_0xfd9544[_0x3134('0x7c')][_0x3134('0x4c')]+0x1,'app':_0x3134('0xad'),'appdata':_0x3134('0xae'),'interval':'*,*,*,*'});}_0xfd9544[_0x3134('0xab')][_0x3134('0xac')]=!![];}return db[_0x3134('0xaf')][_0x3134('0x62')]({'phone':_0xfd9544[_0x3134('0x6a')][_0x3134('0x8f')],'messageId':_0xfd9544[_0x3134('0x6a')][_0x3134('0x8c')],'body':_0xfd9544[_0x3134('0x6a')]['body'],'SmsAccountId':_0x5b8e87['params']['id'],'SmsInteractionId':_0x569413['id'],'direction':'in','ContactId':_0x569413[_0x3134('0xb0')],'AttachmentId':_0xfd9544[_0x3134('0x6a')][_0x3134('0xb1')]});})[_0x3134('0x24')](function(_0xc64d58){_0xfd9544[_0x3134('0x2c')]=_0xc64d58;if(_0xfd9544[_0x3134('0xab')]['UserId']){return db[_0x3134('0xb2')][_0x3134('0x61')]({'attributes':['id',_0x3134('0x3f')],'where':{'id':_0xfd9544[_0x3134('0xab')][_0x3134('0xb3')]}})[_0x3134('0x24')](function(_0x4009bc){if(_0x4009bc){_0xfd9544['applications'][_0x3134('0xb4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4009bc[_0x3134('0x3f')]+','+(_0xfd9544[_0x3134('0x7b')][_0x3134('0xb5')]||0xa),'interval':_0x3134('0xb6')});}return respondWithRpcPromise(_0x3134('0xb7'),_0x3134('0xb8'),_0xfd9544);});}return respondWithRpcPromise(_0x3134('0xb7'),'startRouting',_0xfd9544);})[_0x3134('0x24')](function(_0x3ac5d2){if(_0x3ac5d2){var _0x5a0a9f=0xc8;var _0x486a5f=_0x3134('0xb9');logger[_0x3134('0x25')](_0x3134('0x29'),_0x486a5f,_0x5a0a9f,_0x3134('0xba'));logger[_0x3134('0x28')](_0x3134('0xbb'),_0x486a5f,_0x5a0a9f,_0x3134('0xba'),JSON[_0x3134('0x2a')](_0x3ac5d2));if(_0xfd9544['account'][_0x3134('0x46')]===_0x3134('0x89')){return _0x5f154d['status'](_0x5a0a9f)[_0x3134('0x36')]('Content-Type',_0x3134('0xbc'))[_0x3134('0xbd')]('\x0a');}else{return _0x5f154d['status'](_0x5a0a9f)[_0x3134('0x31')](_0x3ac5d2);}}})['catch'](handleError(_0x5f154d,null));};exports[_0x3134('0xbe')]=function(_0xadf742,_0x27b05b,_0x758d79){return db[_0x3134('0x43')][_0x3134('0x6f')]({'where':{'id':_0xadf742[_0x3134('0x5d')]['id']}})['then'](handleEntityNotFound(_0x27b05b,null))[_0x3134('0x24')](function(_0x30151e){if(_0x30151e){return db['sequelize'][_0x3134('0xbf')](function(_0x4b38dd){return db[_0x3134('0x79')]['destroy']({'where':{'SmsAccountId':_0xadf742['params']['id']},'transaction':_0x4b38dd})[_0x3134('0x24')](function(_0x6ee744){var _0x270e1a=_['map'](_0xadf742[_0x3134('0x6a')],function(_0x2c273b){_0x2c273b['SmsAccountId']=_0xadf742[_0x3134('0x5d')]['id'];return _0x2c273b;});return db[_0x3134('0x79')][_0x3134('0xc0')](_0x270e1a,{'transaction':_0x4b38dd});});})[_0x3134('0x24')](function(){return db[_0x3134('0x79')]['findAndCountAll']({'where':{'SmsAccountId':_0xadf742['params']['id']},'order':'priority'});});}})[_0x3134('0x24')](respondWithResult(_0x27b05b,null))[_0x3134('0x5b')](handleError(_0x27b05b,null));};exports[_0x3134('0xc1')]=function(_0x52f5e7,_0x588c32,_0x14b474){var _0x46778f={};var _0xdf2018={};var _0x391aea;var _0x3cad48;return db[_0x3134('0x43')][_0x3134('0x6f')]({'where':{'id':_0x52f5e7[_0x3134('0x5d')]['id']}})[_0x3134('0x24')](handleEntityNotFound(_0x588c32,null))[_0x3134('0x24')](function(_0x2a1790){if(_0x2a1790){_0x391aea=_0x2a1790;_0xdf2018[_0x3134('0x48')]=_[_0x3134('0x5f')](db[_0x3134('0x79')]['rawAttributes']);_0xdf2018[_0x3134('0x49')]=_[_0x3134('0x5f')](_0x52f5e7[_0x3134('0x49')]);_0xdf2018[_0x3134('0x53')]=_[_0x3134('0x60')](_0xdf2018[_0x3134('0x48')],_0xdf2018[_0x3134('0x49')]);_0x46778f['attributes']=_[_0x3134('0x60')](_0xdf2018[_0x3134('0x48')],qs[_0x3134('0x4b')](_0x52f5e7[_0x3134('0x49')][_0x3134('0x4b')]));_0x46778f[_0x3134('0x4a')]=_0x46778f[_0x3134('0x4a')][_0x3134('0x4c')]?_0x46778f[_0x3134('0x4a')]:_0xdf2018['model'];_0x46778f[_0x3134('0x4f')]=qs['sort'](_0x52f5e7[_0x3134('0x49')][_0x3134('0x50')]);_0x46778f['where']=qs[_0x3134('0x53')](_[_0x3134('0x52')](_0x52f5e7[_0x3134('0x49')],_0xdf2018['filters']));if(_0x52f5e7[_0x3134('0x49')][_0x3134('0x54')]){_0x46778f[_0x3134('0x51')]=_[_0x3134('0x55')](_0x46778f[_0x3134('0x51')],{'$or':_[_0x3134('0x42')](_0x46778f['attributes'],function(_0x4a8dee){var _0x297b8d={};_0x297b8d[_0x4a8dee]={'$like':'%'+_0x52f5e7[_0x3134('0x49')]['filter']+'%'};return _0x297b8d;})});}_0x46778f=_[_0x3134('0x55')]({},_0x46778f,_0x52f5e7[_0x3134('0x57')]);return _0x391aea['getApplications'](_0x46778f);}})[_0x3134('0x24')](function(_0xabb6c){if(_0xabb6c){_0x3cad48=_0xabb6c[_0x3134('0x4c')];if(!_0x52f5e7[_0x3134('0x49')][_0x3134('0x4d')](_0x3134('0x4e'))){_0x46778f[_0x3134('0x34')]=qs[_0x3134('0x34')](_0x52f5e7[_0x3134('0x49')][_0x3134('0x34')]);_0x46778f[_0x3134('0x32')]=qs[_0x3134('0x32')](_0x52f5e7[_0x3134('0x49')]['offset']);}return _0x391aea[_0x3134('0xc1')](_0x46778f);}})[_0x3134('0x24')](function(_0xd4587f){if(_0xd4587f){return _0xd4587f?{'count':_0x3cad48,'rows':_0xd4587f}:null;}})[_0x3134('0x24')](respondWithResult(_0x588c32,null))[_0x3134('0x5b')](handleError(_0x588c32,null));};exports[_0x3134('0xc2')]=function(_0x46b0cb,_0x51bda9,_0x27bab8){var _0x2d1b7f={'raw':![],'where':{}};var _0x2ce037={};var _0x54a273={'count':0x0,'rows':[]};return db['SmsAccount'][_0x3134('0x6f')]({'where':{'id':_0x46b0cb[_0x3134('0x5d')]['id']}})[_0x3134('0x24')](handleEntityNotFound(_0x51bda9,null))[_0x3134('0x24')](function(_0x131121){if(_0x131121){_0x2ce037[_0x3134('0x48')]=_[_0x3134('0x5f')](db['SmsInteraction']['rawAttributes']);_0x2ce037[_0x3134('0x49')]=_['keys'](_0x46b0cb['query']);_0x2ce037[_0x3134('0x53')]=_[_0x3134('0x60')](_0x2ce037[_0x3134('0x48')],_0x2ce037[_0x3134('0x49')]);_0x2d1b7f[_0x3134('0x4a')]=_[_0x3134('0x60')](_0x2ce037[_0x3134('0x48')],qs[_0x3134('0x4b')](_0x46b0cb['query']['fields']));_0x2d1b7f[_0x3134('0x4a')]=_0x2d1b7f[_0x3134('0x4a')]['length']?_0x2d1b7f[_0x3134('0x4a')]:_0x2ce037['model'];if(!_0x46b0cb[_0x3134('0x49')][_0x3134('0x4d')](_0x3134('0x4e'))){_0x2d1b7f['limit']=qs[_0x3134('0x34')](_0x46b0cb['query'][_0x3134('0x34')]);_0x2d1b7f[_0x3134('0x32')]=qs[_0x3134('0x32')](_0x46b0cb[_0x3134('0x49')][_0x3134('0x32')]);}_0x2d1b7f[_0x3134('0x4f')]=qs['sort'](_0x46b0cb['query'][_0x3134('0x50')]);_0x2d1b7f[_0x3134('0x51')]=qs['filters'](_[_0x3134('0x52')](_0x46b0cb[_0x3134('0x49')],_0x2ce037[_0x3134('0x53')]));_0x2d1b7f[_0x3134('0x51')][_0x3134('0x6c')]=_0x131121['id'];if(_0x46b0cb['query'][_0x3134('0x54')]){_0x2d1b7f['where']=_[_0x3134('0x55')](_0x2d1b7f[_0x3134('0x51')],{'$or':_[_0x3134('0x42')](_0x2d1b7f[_0x3134('0x4a')],function(_0x4bc1db){var _0x57885c={};_0x57885c[_0x4bc1db]={'$like':'%'+_0x46b0cb[_0x3134('0x49')][_0x3134('0x54')]+'%'};return _0x57885c;})});}_0x2d1b7f=_[_0x3134('0x55')]({},_0x2d1b7f,_0x46b0cb[_0x3134('0x57')]);return db[_0x3134('0xa9')][_0x3134('0x35')]({'where':_0x2d1b7f['where']})[_0x3134('0x24')](function(_0x13086f){_0x54a273[_0x3134('0x35')]=_0x13086f;if(_0x46b0cb['query'][_0x3134('0x58')]){_0x2d1b7f[_0x3134('0x59')]=[{'model':db[_0x3134('0x80')],'as':_0x3134('0xc3'),'required':![]},{'model':db[_0x3134('0xb2')],'as':_0x3134('0xc4'),'attributes':[_0x3134('0x3f'),_0x3134('0xc5'),_0x3134('0xc6')],'required':![]},{'model':db[_0x3134('0xc7')],'as':_0x3134('0xc8'),'attributes':['id',_0x3134('0x3f'),'color'],'where':_0x46b0cb[_0x3134('0x49')][_0x3134('0xc9')]?{'id':_0x46b0cb[_0x3134('0x49')][_0x3134('0xc9')]}:undefined,'required':_0x46b0cb[_0x3134('0x49')][_0x3134('0xc9')]?!![]:![]}];}return db[_0x3134('0xa9')][_0x3134('0x70')](_0x2d1b7f);})[_0x3134('0x24')](function(_0x37e308){_0x54a273[_0x3134('0x5a')]=_0x37e308;return _0x54a273;});}})['then'](respondWithFilteredResult(_0x51bda9,_0x2d1b7f))[_0x3134('0x5b')](handleError(_0x51bda9,null));};exports['send']=function(_0x3f96d7,_0xc96edb,_0x3504ec){var _0x323e0a,_0x562021,_0x41df74;if(_['isNil'](_0x3f96d7[_0x3134('0x6a')]['body'])||_0x3f96d7[_0x3134('0x6a')][_0x3134('0x6a')]===''){throw new db[(_0x3134('0x81'))][(_0x3134('0x82'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3134('0x9e')](_0x3f96d7[_0x3134('0x6a')]['to'])){throw new db[(_0x3134('0x81'))][(_0x3134('0x82'))]('to\x20is\x20mandatory');}_0x323e0a=_0x3f96d7[_0x3134('0x6a')]['to'];return db['SmsAccount']['find']({'where':{'id':_0x3f96d7[_0x3134('0x5d')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x3134('0x80')],'as':_0x3134('0xa5'),'where':{'mobile':_0x323e0a},'limit':0x1,'order':[[_0x3134('0x85'),'DESC']]}]}]})[_0x3134('0x24')](handleEntityNotFound(_0xc96edb,null))[_0x3134('0x24')](function(_0x310a04){if(_0x310a04&&_0x310a04['List']){_0x562021=_0x310a04[_0x3134('0x3c')]({'plain':!![]});if(_0x562021[_0x3134('0xca')]&&_0x562021['List'][_0x3134('0xa5')][_0x3134('0x4c')]){return _0x562021[_0x3134('0xca')][_0x3134('0xa5')][0x0];}return db[_0x3134('0x80')][_0x3134('0x62')](_[_0x3134('0x1c')](_0x3f96d7[_0x3134('0x6a')],{'firstName':_0x323e0a,'mobile':_0x323e0a,'phone':_0x323e0a,'ListId':_0x562021[_0x3134('0x87')]}));}})['then'](handleEntityNotFound(_0xc96edb,null))[_0x3134('0x24')](function(_0x2a0051){if(_0x2a0051){_0x41df74=_0x2a0051;return db['SmsInteraction'][_0x3134('0x61')]({'where':{'ContactId':_0x41df74['id'],'closed':![],'SmsAccountId':_0x562021['id']}})[_0x3134('0x24')](function(_0x56a037){if(_0x56a037){return[_0x56a037,![]];}return db[_0x3134('0xa9')][_0x3134('0x62')]({'UserId':_0x3f96d7[_0x3134('0x63')]['id'],'ContactId':_0x41df74['id'],'SmsAccountId':_0x562021['id'],'phone':_0x323e0a,'firstMsgDirection':'out','Messages':[_['merge'](_0x3f96d7['body'],{'read':![],'body':_0x3f96d7[_0x3134('0x6a')][_0x3134('0x6a')],'phone':_0x323e0a,'SmsAccountId':_0x562021['id'],'UserId':_0x3f96d7['user']['id'],'ContactId':_0x41df74['id']})]},{'include':[{'model':db[_0x3134('0xaf')],'as':'Messages'}]})[_0x3134('0x24')](function(_0x2f6556){return[_0x2f6556,!![]];});});}})[_0x3134('0xaa')](function(_0x363891,_0x5a598b){if(_0x5a598b){return _0x363891;}return db[_0x3134('0xaf')][_0x3134('0x62')](_[_0x3134('0x55')](_0x3f96d7['body'],{'read':![],'body':_0x3f96d7['body'][_0x3134('0x6a')],'phone':_0x323e0a,'SmsAccountId':_0x562021['id'],'SmsInteractionId':_0x363891['id'],'UserId':_0x3f96d7[_0x3134('0x63')]['id'],'ContactId':_0x41df74['id']}))[_0x3134('0x24')](function(_0x2aa4c4){_0x363891[_0x3134('0xcb')][_0x3134('0xcc')]=[];_0x363891[_0x3134('0xcb')][_0x3134('0xcc')][_0x3134('0xcd')](_0x2aa4c4[_0x3134('0xcb')]);return _0x363891;});})[_0x3134('0x24')](respondWithResult(_0xc96edb,null))[_0x3134('0x5b')](handleError(_0xc96edb,null));};exports[_0x3134('0x30')]=function(_0x5ea4f3,_0x1d5fda,_0x39988c){if(_0x5ea4f3[_0x3134('0x6a')]['id']){delete _0x5ea4f3[_0x3134('0x6a')]['id'];}var _0x190c4f,_0x1221bd,_0x41d2a2;return db[_0x3134('0x43')][_0x3134('0x61')]({'where':{'id':_0x5ea4f3[_0x3134('0x5d')]['id']}})[_0x3134('0x24')](handleEntityNotFound(_0x1d5fda,null))['then'](function(_0x12ad67){if(_0x12ad67){_0x41d2a2=_0x12ad67;logger[_0x3134('0x28')](_0x3134('0x29'),'status',_0x3134('0xce'),_0x12ad67[_0x3134('0x46')],util[_0x3134('0xcf')](_0x5ea4f3[_0x3134('0x6a')],{'showHidden':![],'depth':null}));switch(_0x12ad67[_0x3134('0x46')]){case _0x3134('0xd0'):if(_0x5ea4f3[_0x3134('0x6a')]['skebby_dispatch_id']&&_0x5ea4f3[_0x3134('0x6a')][_0x3134('0x30')]){_0x1221bd=_0x5ea4f3[_0x3134('0x6a')]['status'];return db[_0x3134('0xaf')][_0x3134('0x61')]({'where':{'messageId':_0x5ea4f3[_0x3134('0x6a')][_0x3134('0xd1')]}});}break;case _0x3134('0xd2'):if(_0x5ea4f3[_0x3134('0x6a')]['requestid']&&_0x5ea4f3[_0x3134('0x6a')][_0x3134('0xd3')]){_0x1221bd=_0x5ea4f3[_0x3134('0x6a')][_0x3134('0xd3')];return db[_0x3134('0xaf')]['find']({'where':{'messageId':_0x5ea4f3[_0x3134('0x6a')]['requestid']}});}break;case _0x3134('0xd4'):if(_0x5ea4f3[_0x3134('0x6a')]['message_id']&&_0x5ea4f3['body'][_0x3134('0xd5')]){_0x1221bd=_0x5ea4f3[_0x3134('0x6a')][_0x3134('0xd5')];return db[_0x3134('0xaf')][_0x3134('0x61')]({'where':{'messageId':_0x5ea4f3[_0x3134('0x6a')][_0x3134('0x90')]}});}break;case _0x3134('0x94'):var _0x45987b=_0x5ea4f3[_0x3134('0x6a')][_0x3134('0x95')][0x0];if(_0x45987b[_0x3134('0x8c')]&&_0x45987b[_0x3134('0x30')][_0x3134('0xd6')]==='DELIVERED'){_0x1221bd=_0x45987b[_0x3134('0x30')]['groupName'];return db[_0x3134('0xaf')][_0x3134('0x61')]({'where':{'messageId':_0x45987b[_0x3134('0x8c')]}});}break;case'clickatell':if(_0x5ea4f3[_0x3134('0x6a')][_0x3134('0x8c')]&&_0x5ea4f3[_0x3134('0x6a')][_0x3134('0x30')]){_0x1221bd=_0x5ea4f3['body']['status'];return db[_0x3134('0xaf')]['find']({'where':{'messageId':_0x5ea4f3['body'][_0x3134('0x8c')]}});}break;case _0x3134('0x9b'):if(_0x5ea4f3[_0x3134('0x6a')][0x0][_0x3134('0x2c')]['id']){_0x1221bd=_0x5ea4f3[_0x3134('0x6a')][0x0]['type'];return db['SmsMessage'][_0x3134('0x61')]({'where':{'messageId':_0x5ea4f3[_0x3134('0x6a')][0x0][_0x3134('0x2c')]['id']}});}break;case _0x3134('0x9c'):if(_0x5ea4f3[_0x3134('0x6a')][_0x3134('0xd7')]&&_0x5ea4f3[_0x3134('0x6a')]['status']){_0x1221bd=_0x5ea4f3['body'][_0x3134('0x30')];return db[_0x3134('0xaf')][_0x3134('0x61')]({'where':{'messageId':_0x5ea4f3['body'][_0x3134('0xd7')]}});}break;}}})[_0x3134('0x24')](handleEntityNotFound(_0x1d5fda,null))[_0x3134('0x24')](function(_0x2f2fe1){if(_0x2f2fe1){_0x190c4f=_0x2f2fe1;switch(_0x41d2a2['type']){case _0x3134('0xd0'):if(_0x1221bd===_0x3134('0xd8')){return _0x190c4f[_0x3134('0x3a')]({'read':!![]});}else{logger[_0x3134('0x2b')](_0x3134('0x29'),_0x3134('0x30'),'skebby',util['inspect'](_0x5ea4f3[_0x3134('0x6a')],{'showHidden':![],'depth':null}));}break;case _0x3134('0xd2'):if(_0x1221bd==='1'){return _0x190c4f[_0x3134('0x3a')]({'read':!![]});}else{logger[_0x3134('0x2b')](_0x3134('0x29'),'status',_0x3134('0xd0'),util['inspect'](_0x5ea4f3['body'],{'showHidden':![],'depth':null}));}break;case _0x3134('0xd4'):if(!_0x5ea4f3['body'][_0x3134('0xd9')]&&_0x1221bd>=0xc8&&_0x1221bd<=0xce){return _0x190c4f[_0x3134('0x3a')]({'read':!![]});}else{logger[_0x3134('0x2b')](_0x3134('0x29'),'status',_0x3134('0xd4'),util[_0x3134('0xcf')](_0x5ea4f3['body'],{'showHidden':![],'depth':null}));}break;case _0x3134('0x94'):var _0x1270a5=_0x5ea4f3[_0x3134('0x6a')]['results'][0x0];if(_0x1270a5['status'][_0x3134('0xd6')]===_0x3134('0xd8')){return _0x190c4f['update']({'read':!![]});}else{logger[_0x3134('0x2b')](_0x3134('0x29'),_0x3134('0x30'),'infobip',util[_0x3134('0xcf')](_0x5ea4f3[_0x3134('0x6a')],{'showHidden':![],'depth':null}));}break;case _0x3134('0x98'):if(_0x1221bd==_0x3134('0xda')||_0x1221bd==_0x3134('0xdb')){return _0x190c4f[_0x3134('0x3a')]({'read':!![]});}else{logger[_0x3134('0x2b')](_0x3134('0x29'),_0x3134('0x30'),_0x3134('0x98'),util[_0x3134('0xcf')](_0x5ea4f3[_0x3134('0x6a')],{'showHidden':![],'depth':null}));}break;case _0x3134('0x9b'):if(_0x1221bd==_0x3134('0xdc')){return _0x190c4f['update']({'read':!![]});}else{logger[_0x3134('0x2b')](_0x3134('0x29'),'status',_0x3134('0x9b'),util[_0x3134('0xcf')](_0x5ea4f3['body'],{'showHidden':![],'depth':null}));}break;case _0x3134('0x9c'):if(_0x1221bd==='DELIVRD'||_0x1221bd===_0x3134('0xdd')){return _0x190c4f[_0x3134('0x3a')]({'read':!![]});}else{logger[_0x3134('0x2b')](_0x3134('0x29'),'status','intelepeer',util[_0x3134('0xcf')](_0x5ea4f3[_0x3134('0x6a')],{'showHidden':![],'depth':null}));}break;}return _0x190c4f;}})['then'](respondWithResult(_0x1d5fda,null))[_0x3134('0x5b')](handleError(_0x1d5fda,null));};exports[_0x3134('0xde')]=function(_0x30ac05,_0x1cd3ea,_0xb3b734){var _0x295256,_0x54374c,_0x14d579;return db['SmsAccount']['find']({'where':{'id':_0x30ac05[_0x3134('0x5d')]['id']}})[_0x3134('0x24')](handleEntityNotFound(_0x1cd3ea,null))[_0x3134('0x24')](function(_0x52f357){if(_0x52f357){_0x14d579=_0x52f357;logger[_0x3134('0x28')](_0x3134('0x29'),_0x3134('0x30'),'received\x20delivery\x20report\x20from',_0x52f357[_0x3134('0x46')],util[_0x3134('0xcf')](_0x30ac05[_0x3134('0x49')],{'showHidden':![],'depth':null}));switch(_0x52f357['type']){case _0x3134('0x96'):if(_0x30ac05[_0x3134('0x49')]['message-id']&&_0x30ac05[_0x3134('0x49')][_0x3134('0xdf')]){_0x54374c=_0x30ac05[_0x3134('0x49')]['state'];return db['SmsMessage'][_0x3134('0x61')]({'where':{'messageId':_0x30ac05[_0x3134('0x49')]['message-id']}});}break;}}})[_0x3134('0x24')](handleEntityNotFound(_0x1cd3ea,null))[_0x3134('0x24')](function(_0x34fd93){if(_0x34fd93){_0x295256=_0x34fd93;switch(_0x14d579[_0x3134('0x46')]){case _0x3134('0x96'):if(_0x54374c==='2'||_0x54374c==='6'){return _0x295256[_0x3134('0x3a')]({'read':!![]});}else{logger['error'](_0x3134('0x29'),_0x3134('0x30'),_0x3134('0x96'),util[_0x3134('0xcf')](_0x30ac05[_0x3134('0x49')],{'showHidden':![],'depth':null}));};break;}return _0x295256;}})[_0x3134('0x24')](respondWithResult(_0x1cd3ea,null))[_0x3134('0x5b')](handleError(_0x1cd3ea,null));};exports[_0x3134('0xe0')]=function(_0x3762c2,_0xfd0b57,_0x1d6389){return db[_0x3134('0x43')]['find']({'where':{'id':_0x3762c2[_0x3134('0x5d')]['id']}})[_0x3134('0x24')](handleEntityNotFound(_0xfd0b57,null))[_0x3134('0x24')](function(_0x2d5ba8){if(_0x2d5ba8){return _0x2d5ba8['addAgents'](_0x3762c2[_0x3134('0x6a')][_0x3134('0x72')],_[_0x3134('0xa8')](_0x3762c2[_0x3134('0x6a')],[_0x3134('0x72'),'id'])||{})[_0x3134('0xaa')](function(_0xa9ce28){for(var _0xb169a5=0x0;_0xb169a5<_0x3762c2['body'][_0x3134('0x72')][_0x3134('0x4c')];_0xb169a5+=0x1){socket['emit']('userSmsAccount:save',{'UserId':_0x3762c2[_0x3134('0x6a')][_0x3134('0x72')][_0xb169a5],'SmsAccountId':_0x3762c2[_0x3134('0x5d')]['id']});}return _0xa9ce28;});}})[_0x3134('0x24')](respondWithResult(_0xfd0b57,null))[_0x3134('0x5b')](handleError(_0xfd0b57,null));};exports[_0x3134('0xe1')]=function(_0x38f3aa,_0x25ea41,_0x531f54){return db[_0x3134('0x43')][_0x3134('0x61')]({'where':{'id':_0x38f3aa[_0x3134('0x5d')]['id']}})[_0x3134('0x24')](handleEntityNotFound(_0x25ea41,null))['then'](function(_0x7e1181){if(_0x7e1181){return _0x7e1181[_0x3134('0xe1')](_0x38f3aa[_0x3134('0x49')]['ids'])[_0x3134('0x24')](function(){if(_[_0x3134('0xe2')](_0x38f3aa[_0x3134('0x49')]['ids'])){for(var _0x41d884=0x0;_0x41d884<_0x38f3aa[_0x3134('0x49')][_0x3134('0x72')]['length'];_0x41d884+=0x1){socket[_0x3134('0xe3')](_0x3134('0xe4'),{'UserId':Number(_0x38f3aa[_0x3134('0x49')][_0x3134('0x72')][_0x41d884]),'SmsAccountId':Number(_0x38f3aa[_0x3134('0x5d')]['id'])});}}else{socket['emit'](_0x3134('0xe4'),{'UserId':Number(_0x38f3aa[_0x3134('0x49')][_0x3134('0x72')]),'SmsAccountId':Number(_0x38f3aa[_0x3134('0x5d')]['id'])});}});}})[_0x3134('0x24')](respondWithStatusCode(_0x25ea41,null))[_0x3134('0x5b')](handleError(_0x25ea41,null));};exports[_0x3134('0xe5')]=function(_0x23cba9,_0x4b979b,_0x237f62){var _0x3206fa={};var _0x2e87e4={};var _0x319a21;var _0x44a550;return db[_0x3134('0x43')]['findOne']({'where':{'id':_0x23cba9['params']['id']}})[_0x3134('0x24')](handleEntityNotFound(_0x4b979b,null))[_0x3134('0x24')](function(_0x5b5088){if(_0x5b5088){_0x319a21=_0x5b5088;_0x2e87e4[_0x3134('0x48')]=_[_0x3134('0x5f')](db['User'][_0x3134('0x44')]);_0x2e87e4[_0x3134('0x49')]=_[_0x3134('0x5f')](_0x23cba9[_0x3134('0x49')]);_0x2e87e4['filters']=_[_0x3134('0x60')](_0x2e87e4[_0x3134('0x48')],_0x2e87e4[_0x3134('0x49')]);_0x3206fa[_0x3134('0x4a')]=_[_0x3134('0x60')](_0x2e87e4[_0x3134('0x48')],qs[_0x3134('0x4b')](_0x23cba9[_0x3134('0x49')][_0x3134('0x4b')]));_0x3206fa['attributes']=_0x3206fa['attributes']['length']?_0x3206fa[_0x3134('0x4a')]:_0x2e87e4[_0x3134('0x48')];_0x3206fa[_0x3134('0x4f')]=qs[_0x3134('0x50')](_0x23cba9[_0x3134('0x49')]['sort']);_0x3206fa[_0x3134('0x51')]=qs['filters'](_['pick'](_0x23cba9[_0x3134('0x49')],_0x2e87e4[_0x3134('0x53')]));if(_0x23cba9[_0x3134('0x49')]['filter']){_0x3206fa[_0x3134('0x51')]=_['merge'](_0x3206fa[_0x3134('0x51')],{'$or':_[_0x3134('0x42')](_0x3206fa[_0x3134('0x4a')],function(_0x518fd0){var _0x3960dd={};_0x3960dd[_0x518fd0]={'$like':'%'+_0x23cba9[_0x3134('0x49')][_0x3134('0x54')]+'%'};return _0x3960dd;})});}_0x3206fa=_[_0x3134('0x55')]({},_0x3206fa,_0x23cba9[_0x3134('0x57')]);return _0x319a21['getAgents'](_0x3206fa);}})[_0x3134('0x24')](function(_0x667119){if(_0x667119){_0x44a550=_0x667119[_0x3134('0x4c')];if(!_0x23cba9[_0x3134('0x49')][_0x3134('0x4d')](_0x3134('0x4e'))){_0x3206fa['limit']=qs[_0x3134('0x34')](_0x23cba9['query'][_0x3134('0x34')]);_0x3206fa[_0x3134('0x32')]=qs[_0x3134('0x32')](_0x23cba9[_0x3134('0x49')][_0x3134('0x32')]);}return _0x319a21[_0x3134('0xe5')](_0x3206fa);}})[_0x3134('0x24')](function(_0x13848f){if(_0x13848f){return _0x13848f?{'count':_0x44a550,'rows':_0x13848f}:null;}})[_0x3134('0x24')](respondWithResult(_0x4b979b,null))[_0x3134('0x5b')](handleError(_0x4b979b,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 108dad9..f508628 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 _0x9b7c=['setMaxListeners','update','emit','hasOwnProperty','hook','events','../../mysqldb','SmsAccount'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9b7c,0xe5));var _0xc9b7=function(_0x4c9ad2,_0x3bb687){_0x4c9ad2=_0x4c9ad2-0x0;var _0x507886=_0x9b7c[_0x4c9ad2];return _0x507886;};'use strict';var EventEmitter=require(_0xc9b7('0x0'));var SmsAccount=require(_0xc9b7('0x1'))['db'][_0xc9b7('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xc9b7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc9b7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1770ae){return function(_0x248f7e,_0x3d9673,_0x41acec){SmsAccountEvents[_0xc9b7('0x5')](_0x1770ae+':'+_0x248f7e['id'],_0x248f7e);SmsAccountEvents[_0xc9b7('0x5')](_0x1770ae,_0x248f7e);_0x41acec(null);};}for(var e in events){if(events[_0xc9b7('0x6')](e)){var event=events[e];SmsAccount[_0xc9b7('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x64ad=['events','../../mysqldb','SmsAccount','save','emit','hook'];(function(_0x5445b5,_0xada1fc){var _0x496492=function(_0x1bba84){while(--_0x1bba84){_0x5445b5['push'](_0x5445b5['shift']());}};_0x496492(++_0xada1fc);}(_0x64ad,0x96));var _0xd64a=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x64ad[_0xc4001c];return _0x49f7bc;};'use strict';var EventEmitter=require(_0xd64a('0x0'));var SmsAccount=require(_0xd64a('0x1'))['db'][_0xd64a('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd64a('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1dcd10){return function(_0x4dad58,_0x2eb35b,_0x1b5612){SmsAccountEvents['emit'](_0x1dcd10+':'+_0x4dad58['id'],_0x4dad58);SmsAccountEvents[_0xd64a('0x4')](_0x1dcd10,_0x4dad58);_0x1b5612(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xd64a('0x5')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 3e51ef4..98ce25a 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 _0xc048=['moment','bluebird','request-promise','rimraf','../../config/environment','define','sms_accounts','lodash','util','../../config/logger','api'];(function(_0xd47ba0,_0x31ffbd){var _0xd985a8=function(_0x43c9d8){while(--_0x43c9d8){_0xd47ba0['push'](_0xd47ba0['shift']());}};_0xd985a8(++_0x31ffbd);}(_0xc048,0x1a9));var _0x8c04=function(_0x543346,_0x2f9c74){_0x543346=_0x543346-0x0;var _0x224e42=_0xc048[_0x543346];return _0x224e42;};'use strict';var _=require(_0x8c04('0x0'));var util=require(_0x8c04('0x1'));var logger=require(_0x8c04('0x2'))(_0x8c04('0x3'));var moment=require(_0x8c04('0x4'));var BPromise=require(_0x8c04('0x5'));var rp=require(_0x8c04('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c04('0x7'));var config=require(_0x8c04('0x8'));var attributes=require('./smsAccount.attributes');module['exports']=function(_0x1de425,_0x22fb8c){return _0x1de425[_0x8c04('0x9')]('SmsAccount',attributes,{'tableName':_0x8c04('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd521=['path','rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','sms_accounts','lodash','../../config/logger','moment','request-promise'];(function(_0x46f370,_0x3f1dd3){var _0x46147f=function(_0x58d771){while(--_0x58d771){_0x46f370['push'](_0x46f370['shift']());}};_0x46147f(++_0x3f1dd3);}(_0xd521,0xf9));var _0x1d52=function(_0x96f54d,_0x5e5d21){_0x96f54d=_0x96f54d-0x0;var _0xdb885c=_0xd521[_0x96f54d];return _0xdb885c;};'use strict';var _=require(_0x1d52('0x0'));var util=require('util');var logger=require(_0x1d52('0x1'))('api');var moment=require(_0x1d52('0x2'));var BPromise=require('bluebird');var rp=require(_0x1d52('0x3'));var fs=require('fs');var path=require(_0x1d52('0x4'));var rimraf=require(_0x1d52('0x5'));var config=require(_0x1d52('0x6'));var attributes=require(_0x1d52('0x7'));module[_0x1d52('0x8')]=function(_0x527e96,_0x35f276){return _0x527e96['define'](_0x1d52('0x9'),attributes,{'tableName':_0x1d52('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 4bbf756..e93f14d 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 _0x86a0=['client','redis','defaults','localhost','socket.io-emitter','request','then','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','catch','ShowSmsAccount','options','attributes','include','map','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x86a0,0x1d1));var _0x086a=function(_0x513b06,_0x506dde){_0x513b06=_0x513b06-0x0;var _0x1a3941=_0x86a0[_0x513b06];return _0x1a3941;};'use strict';var _=require(_0x086a('0x0'));var util=require(_0x086a('0x1'));var moment=require(_0x086a('0x2'));var BPromise=require(_0x086a('0x3'));var rs=require(_0x086a('0x4'));var fs=require('fs');var Redis=require(_0x086a('0x5'));var db=require(_0x086a('0x6'))['db'];var utils=require(_0x086a('0x7'));var logger=require(_0x086a('0x8'))(_0x086a('0x9'));var config=require(_0x086a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x086a('0xb')]['http']({'port':0x232a});config[_0x086a('0xc')]=_[_0x086a('0xd')](config[_0x086a('0xc')],{'host':_0x086a('0xe'),'port':0x18eb});var socket=require(_0x086a('0xf'))(new Redis(config[_0x086a('0xc')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x467a8e,_0x16db9d,_0x393846){return new BPromise(function(_0x57ba16,_0x303e1c){return client[_0x086a('0x10')](_0x467a8e,_0x393846)[_0x086a('0x11')](function(_0x16ad00){logger[_0x086a('0x12')]('SmsAccount,\x20%s,\x20%s',_0x16db9d,_0x086a('0x13'));logger['debug'](_0x086a('0x14'),_0x16db9d,_0x086a('0x13'),JSON[_0x086a('0x15')](_0x16ad00));if(_0x16ad00[_0x086a('0x16')]){if(_0x16ad00[_0x086a('0x16')][_0x086a('0x17')]===0x1f4){logger[_0x086a('0x16')](_0x086a('0x18'),_0x16db9d,_0x16ad00[_0x086a('0x16')][_0x086a('0x19')]);return _0x303e1c(_0x16ad00[_0x086a('0x16')][_0x086a('0x19')]);}logger['error'](_0x086a('0x18'),_0x16db9d,_0x16ad00['error'][_0x086a('0x19')]);return _0x57ba16(_0x16ad00[_0x086a('0x16')]['message']);}else{logger[_0x086a('0x12')](_0x086a('0x18'),_0x16db9d,'request\x20sent');_0x57ba16(_0x16ad00['result']['message']);}})[_0x086a('0x1a')](function(_0x2b1259){logger[_0x086a('0x16')](_0x086a('0x18'),_0x16db9d,_0x2b1259);_0x303e1c(_0x2b1259);});});}exports[_0x086a('0x1b')]=function(_0x5baca0){var _0x5bb08a=this;return new Promise(function(_0x2cb450,_0x155761){return db['SmsAccount']['find']({'raw':_0x5baca0['options']?_0x5baca0[_0x086a('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5baca0[_0x086a('0x1c')]?_0x5baca0[_0x086a('0x1c')]['where']||null:null,'attributes':_0x5baca0['options']?_0x5baca0[_0x086a('0x1c')][_0x086a('0x1d')]||null:null,'include':_0x5baca0[_0x086a('0x1c')]?_0x5baca0[_0x086a('0x1c')][_0x086a('0x1e')]?_[_0x086a('0x1f')](_0x5baca0['options'][_0x086a('0x1e')],function(_0x351312){return{'model':db[_0x351312[_0x086a('0x20')]],'as':_0x351312['as'],'attributes':_0x351312[_0x086a('0x1d')],'include':_0x351312[_0x086a('0x1e')]?_[_0x086a('0x1f')](_0x351312[_0x086a('0x1e')],function(_0x3cd9a8){return{'model':db[_0x3cd9a8[_0x086a('0x20')]],'as':_0x3cd9a8['as'],'attributes':_0x3cd9a8[_0x086a('0x1d')],'include':_0x3cd9a8['include']?_['map'](_0x3cd9a8[_0x086a('0x1e')],function(_0x15c4c3){return{'model':db[_0x15c4c3[_0x086a('0x20')]],'as':_0x15c4c3['as'],'attributes':_0x15c4c3[_0x086a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x086a('0x11')](function(_0x283097){logger[_0x086a('0x12')](_0x086a('0x1b'),_0x5baca0);logger[_0x086a('0x21')]('ShowSmsAccount',_0x5baca0,JSON[_0x086a('0x15')](_0x283097));_0x2cb450(_0x283097);})[_0x086a('0x1a')](function(_0xd1e54b){logger[_0x086a('0x16')]('ShowSmsAccount',_0xd1e54b[_0x086a('0x19')],_0x5baca0);_0x155761(_0x5bb08a[_0x086a('0x16')](0x1f4,_0xd1e54b['message']));});});}; \ No newline at end of file +var _0xe89f=['SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowSmsAccount','find','options','raw','where','attributes','model','include','map','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','socket.io-emitter','redis','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe89f,0x14e));var _0xfe89=function(_0x2ff4c3,_0x4ae43a){_0x2ff4c3=_0x2ff4c3-0x0;var _0x458e77=_0xe89f[_0x2ff4c3];return _0x458e77;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfe89('0x0'));var BPromise=require('bluebird');var rs=require(_0xfe89('0x1'));var fs=require('fs');var Redis=require(_0xfe89('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe89('0x3'));var logger=require(_0xfe89('0x4'))(_0xfe89('0x5'));var config=require(_0xfe89('0x6'));var jayson=require(_0xfe89('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xfe89('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfe89('0x9'))(new Redis(config[_0xfe89('0xa')]));require(_0xfe89('0xb'))[_0xfe89('0xc')](socket);function respondWithRpcPromise(_0x4ab596,_0x5137e0,_0x31c142){return new BPromise(function(_0x4efb9f,_0x95ee6c){return client['request'](_0x4ab596,_0x31c142)[_0xfe89('0xd')](function(_0x584294){logger[_0xfe89('0xe')](_0xfe89('0xf'),_0x5137e0,_0xfe89('0x10'));logger[_0xfe89('0x11')](_0xfe89('0x12'),_0x5137e0,_0xfe89('0x10'),JSON['stringify'](_0x584294));if(_0x584294[_0xfe89('0x13')]){if(_0x584294[_0xfe89('0x13')][_0xfe89('0x14')]===0x1f4){logger[_0xfe89('0x13')]('SmsAccount,\x20%s,\x20%s',_0x5137e0,_0x584294[_0xfe89('0x13')][_0xfe89('0x15')]);return _0x95ee6c(_0x584294['error'][_0xfe89('0x15')]);}logger[_0xfe89('0x13')](_0xfe89('0xf'),_0x5137e0,_0x584294[_0xfe89('0x13')]['message']);return _0x4efb9f(_0x584294[_0xfe89('0x13')][_0xfe89('0x15')]);}else{logger['info'](_0xfe89('0xf'),_0x5137e0,_0xfe89('0x10'));_0x4efb9f(_0x584294['result'][_0xfe89('0x15')]);}})[_0xfe89('0x16')](function(_0x50a48f){logger['error']('SmsAccount,\x20%s,\x20%s',_0x5137e0,_0x50a48f);_0x95ee6c(_0x50a48f);});});}exports[_0xfe89('0x17')]=function(_0x1e21b9){var _0x430b60=this;return new Promise(function(_0x13fc16,_0x20cd70){return db['SmsAccount'][_0xfe89('0x18')]({'raw':_0x1e21b9[_0xfe89('0x19')]?_0x1e21b9[_0xfe89('0x19')][_0xfe89('0x1a')]===undefined?!![]:![]:!![],'where':_0x1e21b9[_0xfe89('0x19')]?_0x1e21b9[_0xfe89('0x19')][_0xfe89('0x1b')]||null:null,'attributes':_0x1e21b9[_0xfe89('0x19')]?_0x1e21b9[_0xfe89('0x19')][_0xfe89('0x1c')]||null:null,'include':_0x1e21b9[_0xfe89('0x19')]?_0x1e21b9[_0xfe89('0x19')]['include']?_['map'](_0x1e21b9[_0xfe89('0x19')]['include'],function(_0x49ebd8){return{'model':db[_0x49ebd8[_0xfe89('0x1d')]],'as':_0x49ebd8['as'],'attributes':_0x49ebd8[_0xfe89('0x1c')],'include':_0x49ebd8[_0xfe89('0x1e')]?_['map'](_0x49ebd8['include'],function(_0x4cf419){return{'model':db[_0x4cf419[_0xfe89('0x1d')]],'as':_0x4cf419['as'],'attributes':_0x4cf419[_0xfe89('0x1c')],'include':_0x4cf419['include']?_[_0xfe89('0x1f')](_0x4cf419[_0xfe89('0x1e')],function(_0x9dcb18){return{'model':db[_0x9dcb18[_0xfe89('0x1d')]],'as':_0x9dcb18['as'],'attributes':_0x9dcb18[_0xfe89('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1fe400){logger[_0xfe89('0xe')]('ShowSmsAccount',_0x1e21b9);logger[_0xfe89('0x11')](_0xfe89('0x17'),_0x1e21b9,JSON['stringify'](_0x1fe400));_0x13fc16(_0x1fe400);})['catch'](function(_0x6a492d){logger[_0xfe89('0x13')]('ShowSmsAccount',_0x6a492d[_0xfe89('0x15')],_0x1e21b9);_0x20cd70(_0x430b60[_0xfe89('0x13')](0x1f4,_0x6a492d[_0xfe89('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 1e50d9b..a9151ee 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 _0x13b6=['length','./smsAccount.events','remove','update','emit','register'];(function(_0x243b10,_0x42eef9){var _0x2b1a8b=function(_0x20d203){while(--_0x20d203){_0x243b10['push'](_0x243b10['shift']());}};_0x2b1a8b(++_0x42eef9);}(_0x13b6,0x97));var _0x613b=function(_0x183031,_0x289adf){_0x183031=_0x183031-0x0;var _0x274ce3=_0x13b6[_0x183031];return _0x274ce3;};'use strict';var SmsAccountEvents=require(_0x613b('0x0'));var events=['save',_0x613b('0x1'),_0x613b('0x2')];function createListener(_0x45df0,_0x390318){return function(_0x5d0f72){_0x390318[_0x613b('0x3')](_0x45df0,_0x5d0f72);};}function removeListener(_0x1dc7f9,_0x451191){return function(){SmsAccountEvents['removeListener'](_0x1dc7f9,_0x451191);};}exports[_0x613b('0x4')]=function(_0x1c746e){for(var _0x312a27=0x0,_0x593a18=events[_0x613b('0x5')];_0x312a27<_0x593a18;_0x312a27++){var _0x4e576a=events[_0x312a27];var _0xf83c34=createListener('smsAccount:'+_0x4e576a,_0x1c746e);SmsAccountEvents['on'](_0x4e576a,_0xf83c34);}}; \ No newline at end of file +var _0x1850=['./smsAccount.events','save','remove','update','emit','removeListener','length'];(function(_0x1d955a,_0x18f200){var _0xff3b8=function(_0x47c2c3){while(--_0x47c2c3){_0x1d955a['push'](_0x1d955a['shift']());}};_0xff3b8(++_0x18f200);}(_0x1850,0xe7));var _0x0185=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1850[_0x3dd15e];return _0x231fd0;};'use strict';var SmsAccountEvents=require(_0x0185('0x0'));var events=[_0x0185('0x1'),_0x0185('0x2'),_0x0185('0x3')];function createListener(_0x27f4a8,_0x37b0ad){return function(_0x169e9e){_0x37b0ad[_0x0185('0x4')](_0x27f4a8,_0x169e9e);};}function removeListener(_0x29fc43,_0x3bfb59){return function(){SmsAccountEvents[_0x0185('0x5')](_0x29fc43,_0x3bfb59);};}exports['register']=function(_0x3da220){for(var _0x58a852=0x0,_0x26c6cf=events[_0x0185('0x6')];_0x58a852<_0x26c6cf;_0x58a852++){var _0x1f7ec6=events[_0x58a852];var _0x1ac477=createListener('smsAccount:'+_0x1f7ec6,_0x3da220);SmsAccountEvents['on'](_0x1f7ec6,_0x1ac477);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index d685b70..b25d36f 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 _0xa87e=['/:id','post','put','isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','index','get'];(function(_0x3ca86b,_0x472da5){var _0x438bc8=function(_0x36d22d){while(--_0x36d22d){_0x3ca86b['push'](_0x3ca86b['shift']());}};_0x438bc8(++_0x472da5);}(_0xa87e,0xb3));var _0xea87=function(_0x36fe33,_0x33d227){_0x36fe33=_0x36fe33-0x0;var _0x4d08f0=_0xa87e[_0x36fe33];return _0x4d08f0;};'use strict';var multer=require('multer');var util=require(_0xea87('0x0'));var path=require(_0xea87('0x1'));var timeout=require(_0xea87('0x2'));var express=require(_0xea87('0x3'));var router=express['Router']();var fs_extra=require(_0xea87('0x4'));var auth=require(_0xea87('0x5'));var interaction=require(_0xea87('0x6'));var config=require(_0xea87('0x7'));var controller=require(_0xea87('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xea87('0x9')]);router[_0xea87('0xa')](_0xea87('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xea87('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xea87('0xd')](_0xea87('0xb'),auth[_0xea87('0xe')](),controller[_0xea87('0xf')]);router[_0xea87('0x10')](_0xea87('0xb'),auth[_0xea87('0xe')](),controller[_0xea87('0x11')]);module[_0xea87('0x12')]=router; \ No newline at end of file +var _0xb218=['/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index'];(function(_0x5a3bae,_0x163f0e){var _0x1dd9c7=function(_0x28de5a){while(--_0x28de5a){_0x5a3bae['push'](_0x5a3bae['shift']());}};_0x1dd9c7(++_0x163f0e);}(_0xb218,0x7a));var _0x8b21=function(_0xc56d79,_0x1ad8d2){_0xc56d79=_0xc56d79-0x0;var _0x23c02=_0xb218[_0xc56d79];return _0x23c02;};'use strict';var multer=require(_0x8b21('0x0'));var util=require(_0x8b21('0x1'));var path=require(_0x8b21('0x2'));var timeout=require(_0x8b21('0x3'));var express=require(_0x8b21('0x4'));var router=express[_0x8b21('0x5')]();var fs_extra=require(_0x8b21('0x6'));var auth=require(_0x8b21('0x7'));var interaction=require(_0x8b21('0x8'));var config=require('../../config/environment');var controller=require('./smsApplication.controller');router['get']('/',auth[_0x8b21('0x9')](),controller[_0x8b21('0xa')]);router['get'](_0x8b21('0xb'),auth[_0x8b21('0x9')](),controller[_0x8b21('0xc')]);router[_0x8b21('0xd')]('/',auth[_0x8b21('0x9')](),controller['create']);router[_0x8b21('0xe')](_0x8b21('0xb'),auth['isAuthenticated'](),controller[_0x8b21('0xf')]);router[_0x8b21('0x10')]('/:id',auth[_0x8b21('0x9')](),controller[_0x8b21('0x11')]);module[_0x8b21('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 97176b4..37a2cf2 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 _0x3111=['STRING','*,*,*,*','exports','INTEGER','noop'];(function(_0x334ef1,_0x38031f){var _0x1f8210=function(_0x273694){while(--_0x273694){_0x334ef1['push'](_0x334ef1['shift']());}};_0x1f8210(++_0x38031f);}(_0x3111,0x179));var _0x1311=function(_0x4d210e,_0x236458){_0x4d210e=_0x4d210e-0x0;var _0x3f2409=_0x3111[_0x4d210e];return _0x3f2409;};'use strict';var Sequelize=require('sequelize');module[_0x1311('0x0')]={'priority':{'type':Sequelize[_0x1311('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1311('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x1311('0x3')]},'interval':{'type':Sequelize[_0x1311('0x3')],'defaultValue':_0x1311('0x4')}}; \ No newline at end of file +var _0x4538=['noop','TEXT','sequelize','INTEGER','STRING'];(function(_0x48cf09,_0x3b5f6c){var _0x203b57=function(_0x359da1){while(--_0x359da1){_0x48cf09['push'](_0x48cf09['shift']());}};_0x203b57(++_0x3b5f6c);}(_0x4538,0x1ba));var _0x8453=function(_0x27e1d1,_0x2c86ca){_0x27e1d1=_0x27e1d1-0x0;var _0x805710=_0x4538[_0x27e1d1];return _0x805710;};'use strict';var Sequelize=require(_0x8453('0x0'));module['exports']={'priority':{'type':Sequelize[_0x8453('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x8453('0x2')],'allowNull':![],'defaultValue':_0x8453('0x3')},'appdata':{'type':Sequelize[_0x8453('0x4')]()},'description':{'type':Sequelize[_0x8453('0x2')]},'interval':{'type':Sequelize[_0x8453('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index add82f4..6f68470 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 _0x61b1=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','SmsApplication','include','findAll','catch','show','params','includeAll','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service'];(function(_0xadbc05,_0x541dc2){var _0x95c35d=function(_0x515a64){while(--_0x515a64){_0xadbc05['push'](_0xadbc05['shift']());}};_0x95c35d(++_0x541dc2);}(_0x61b1,0x81));var _0x161b=function(_0x28a8ba,_0xbe5d8e){_0x28a8ba=_0x28a8ba-0x0;var _0x268731=_0x61b1[_0x28a8ba];return _0x268731;};'use strict';var emlformat=require(_0x161b('0x0'));var rimraf=require(_0x161b('0x1'));var zipdir=require(_0x161b('0x2'));var jsonpatch=require(_0x161b('0x3'));var rp=require(_0x161b('0x4'));var moment=require(_0x161b('0x5'));var BPromise=require(_0x161b('0x6'));var Mustache=require(_0x161b('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x161b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x161b('0x9'));var _=require(_0x161b('0xa'));var squel=require(_0x161b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x161b('0x8'));var querystring=require('querystring');var Papa=require(_0x161b('0xc'));var Redis=require(_0x161b('0xd'));var authService=require(_0x161b('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x161b('0xf'));var logger=require(_0x161b('0x10'))(_0x161b('0x11'));var utils=require(_0x161b('0x12'));var config=require(_0x161b('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5af643,_0x3d5af8){_0x3d5af8=_0x3d5af8||0xcc;return function(_0x585b53){if(_0x585b53){return _0x5af643[_0x161b('0x14')](_0x3d5af8);}return _0x5af643[_0x161b('0x15')](_0x3d5af8)[_0x161b('0x16')]();};}function respondWithResult(_0x15bcb7,_0x5b7b65){_0x5b7b65=_0x5b7b65||0xc8;return function(_0x3744da){if(_0x3744da){return _0x15bcb7[_0x161b('0x15')](_0x5b7b65)[_0x161b('0x17')](_0x3744da);}};}function respondWithFilteredResult(_0x441623,_0x58c5b1){return function(_0x47ae4c){if(_0x47ae4c){var _0x5a28f3=typeof _0x58c5b1[_0x161b('0x18')]===_0x161b('0x19')&&typeof _0x58c5b1[_0x161b('0x1a')]===_0x161b('0x19');var _0xf980d3=_0x47ae4c[_0x161b('0x1b')];var _0x3e1195=_0x5a28f3?0x0:_0x58c5b1[_0x161b('0x18')];var _0x1f6607=_0x5a28f3?_0x47ae4c[_0x161b('0x1b')]:_0x58c5b1[_0x161b('0x18')]+_0x58c5b1[_0x161b('0x1a')];var _0x1aaa2a;if(_0x1f6607>=_0xf980d3){_0x1f6607=_0xf980d3;_0x1aaa2a=0xc8;}else{_0x1aaa2a=0xce;}_0x441623[_0x161b('0x15')](_0x1aaa2a);return _0x441623[_0x161b('0x1c')](_0x161b('0x1d'),_0x3e1195+'-'+_0x1f6607+'/'+_0xf980d3)[_0x161b('0x17')](_0x47ae4c);}return null;};}function patchUpdates(_0x38a4ee){return function(_0x130e1a){try{jsonpatch[_0x161b('0x1e')](_0x130e1a,_0x38a4ee,!![]);}catch(_0x5939b5){return BPromise['reject'](_0x5939b5);}return _0x130e1a[_0x161b('0x1f')]();};}function saveUpdates(_0x52c2e8,_0x17ac3e){return function(_0x427566){if(_0x427566){return _0x427566[_0x161b('0x20')](_0x52c2e8)[_0x161b('0x21')](function(_0x1611bb){return _0x1611bb;});}return null;};}function removeEntity(_0x526f45,_0x3da62b){return function(_0x4357c2){if(_0x4357c2){return _0x4357c2['destroy']()[_0x161b('0x21')](function(){_0x526f45[_0x161b('0x15')](0xcc)[_0x161b('0x16')]();});}};}function handleEntityNotFound(_0x2f49a7,_0x23f50d){return function(_0x552270){if(!_0x552270){_0x2f49a7['sendStatus'](0x194);}return _0x552270;};}function handleError(_0x3615eb,_0x34d39e){_0x34d39e=_0x34d39e||0x1f4;return function(_0x20eddf){logger[_0x161b('0x22')](_0x20eddf[_0x161b('0x23')]);if(_0x20eddf[_0x161b('0x24')]){delete _0x20eddf[_0x161b('0x24')];}_0x3615eb[_0x161b('0x15')](_0x34d39e)[_0x161b('0x25')](_0x20eddf);};}exports[_0x161b('0x26')]=function(_0x2d81b5,_0x823e2f){var _0x22e768={},_0x11fdd4={},_0x152bf0={'count':0x0,'rows':[]};var _0x5b6f36=_[_0x161b('0x27')](db['SmsApplication'][_0x161b('0x28')],function(_0x36d75a){return{'name':_0x36d75a[_0x161b('0x29')],'type':_0x36d75a[_0x161b('0x2a')][_0x161b('0x2b')]};});_0x11fdd4[_0x161b('0x2c')]=_[_0x161b('0x27')](_0x5b6f36,_0x161b('0x24'));_0x11fdd4[_0x161b('0x2d')]=_[_0x161b('0x2e')](_0x2d81b5[_0x161b('0x2d')]);_0x11fdd4['filters']=_[_0x161b('0x2f')](_0x11fdd4[_0x161b('0x2c')],_0x11fdd4[_0x161b('0x2d')]);_0x22e768[_0x161b('0x30')]=_['intersection'](_0x11fdd4[_0x161b('0x2c')],qs['fields'](_0x2d81b5['query'][_0x161b('0x31')]));_0x22e768['attributes']=_0x22e768['attributes'][_0x161b('0x32')]?_0x22e768[_0x161b('0x30')]:_0x11fdd4[_0x161b('0x2c')];if(!_0x2d81b5[_0x161b('0x2d')][_0x161b('0x33')](_0x161b('0x34'))){_0x22e768[_0x161b('0x1a')]=qs[_0x161b('0x1a')](_0x2d81b5['query'][_0x161b('0x1a')]);_0x22e768[_0x161b('0x18')]=qs['offset'](_0x2d81b5['query'][_0x161b('0x18')]);}_0x22e768['order']=qs[_0x161b('0x35')](_0x2d81b5['query'][_0x161b('0x35')]);_0x22e768[_0x161b('0x36')]=qs[_0x161b('0x37')](_[_0x161b('0x38')](_0x2d81b5['query'],_0x11fdd4[_0x161b('0x37')]),_0x5b6f36);if(_0x2d81b5[_0x161b('0x2d')][_0x161b('0x39')]){_0x22e768[_0x161b('0x36')]=_[_0x161b('0x3a')](_0x22e768[_0x161b('0x36')],{'$or':_[_0x161b('0x27')](_0x5b6f36,function(_0x465ff6){if(_0x465ff6[_0x161b('0x2a')]!==_0x161b('0x3b')){var _0x4616fa={};_0x4616fa[_0x465ff6[_0x161b('0x24')]]={'$like':'%'+_0x2d81b5[_0x161b('0x2d')][_0x161b('0x39')]+'%'};return _0x4616fa;}})});}_0x22e768=_[_0x161b('0x3a')]({},_0x22e768,_0x2d81b5['options']);var _0x55124e={'where':_0x22e768[_0x161b('0x36')]};return db[_0x161b('0x3c')]['count'](_0x55124e)['then'](function(_0x527130){_0x152bf0[_0x161b('0x1b')]=_0x527130;if(_0x2d81b5['query']['includeAll']){_0x22e768[_0x161b('0x3d')]=[{'all':!![]}];}return db['SmsApplication'][_0x161b('0x3e')](_0x22e768);})[_0x161b('0x21')](function(_0x3b7b23){_0x152bf0['rows']=_0x3b7b23;return _0x152bf0;})[_0x161b('0x21')](respondWithFilteredResult(_0x823e2f,_0x22e768))[_0x161b('0x3f')](handleError(_0x823e2f,null));};exports[_0x161b('0x40')]=function(_0x19caab,_0x4adc29){var _0x1ebc9e={'raw':!![],'where':{'id':_0x19caab[_0x161b('0x41')]['id']}},_0x2bfbcd={};_0x2bfbcd[_0x161b('0x2c')]=_[_0x161b('0x2e')](db[_0x161b('0x3c')][_0x161b('0x28')]);_0x2bfbcd[_0x161b('0x2d')]=_[_0x161b('0x2e')](_0x19caab[_0x161b('0x2d')]);_0x2bfbcd['filters']=_['intersection'](_0x2bfbcd[_0x161b('0x2c')],_0x2bfbcd['query']);_0x1ebc9e[_0x161b('0x30')]=_[_0x161b('0x2f')](_0x2bfbcd[_0x161b('0x2c')],qs[_0x161b('0x31')](_0x19caab[_0x161b('0x2d')][_0x161b('0x31')]));_0x1ebc9e[_0x161b('0x30')]=_0x1ebc9e['attributes'][_0x161b('0x32')]?_0x1ebc9e[_0x161b('0x30')]:_0x2bfbcd['model'];if(_0x19caab[_0x161b('0x2d')][_0x161b('0x42')]){_0x1ebc9e['include']=[{'all':!![]}];}_0x1ebc9e=_[_0x161b('0x3a')]({},_0x1ebc9e,_0x19caab[_0x161b('0x43')]);return db['SmsApplication'][_0x161b('0x44')](_0x1ebc9e)[_0x161b('0x21')](handleEntityNotFound(_0x4adc29,null))[_0x161b('0x21')](respondWithResult(_0x4adc29,null))[_0x161b('0x3f')](handleError(_0x4adc29,null));};exports['create']=function(_0x3c0e7e,_0x34c8e8){return db[_0x161b('0x3c')][_0x161b('0x45')](_0x3c0e7e[_0x161b('0x46')],{})[_0x161b('0x21')](respondWithResult(_0x34c8e8,0xc9))[_0x161b('0x3f')](handleError(_0x34c8e8,null));};exports[_0x161b('0x20')]=function(_0x2b54b4,_0x495873){if(_0x2b54b4[_0x161b('0x46')]['id']){delete _0x2b54b4[_0x161b('0x46')]['id'];}return db[_0x161b('0x3c')][_0x161b('0x44')]({'where':{'id':_0x2b54b4[_0x161b('0x41')]['id']}})[_0x161b('0x21')](handleEntityNotFound(_0x495873,null))[_0x161b('0x21')](saveUpdates(_0x2b54b4[_0x161b('0x46')],null))['then'](respondWithResult(_0x495873,null))[_0x161b('0x3f')](handleError(_0x495873,null));};exports[_0x161b('0x47')]=function(_0x4ddef5,_0x4e026d){return db[_0x161b('0x3c')][_0x161b('0x44')]({'where':{'id':_0x4ddef5[_0x161b('0x41')]['id']}})['then'](handleEntityNotFound(_0x4e026d,null))[_0x161b('0x21')](removeEntity(_0x4e026d,null))['catch'](handleError(_0x4e026d,null));}; \ No newline at end of file +var _0xaa34=['merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xaa34,0xa6));var _0x4aa3=function(_0x3d3f70,_0x1f759e){_0x3d3f70=_0x3d3f70-0x0;var _0x448f82=_0xaa34[_0x3d3f70];return _0x448f82;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4aa3('0x0'));var zipdir=require(_0x4aa3('0x1'));var jsonpatch=require(_0x4aa3('0x2'));var rp=require(_0x4aa3('0x3'));var moment=require(_0x4aa3('0x4'));var BPromise=require(_0x4aa3('0x5'));var Mustache=require(_0x4aa3('0x6'));var util=require(_0x4aa3('0x7'));var path=require(_0x4aa3('0x8'));var sox=require(_0x4aa3('0x9'));var csv=require(_0x4aa3('0xa'));var ejs=require(_0x4aa3('0xb'));var fs=require('fs');var fs_extra=require(_0x4aa3('0xc'));var _=require(_0x4aa3('0xd'));var squel=require('squel');var crypto=require(_0x4aa3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4aa3('0xa'));var querystring=require(_0x4aa3('0xf'));var Papa=require(_0x4aa3('0x10'));var Redis=require(_0x4aa3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4aa3('0x12'));var as=require(_0x4aa3('0x13'));var hardwareService=require(_0x4aa3('0x14'));var logger=require(_0x4aa3('0x15'))(_0x4aa3('0x16'));var utils=require(_0x4aa3('0x17'));var config=require(_0x4aa3('0x18'));var licenseUtil=require(_0x4aa3('0x19'));var db=require(_0x4aa3('0x1a'))['db'];function respondWithStatusCode(_0x2456ee,_0x2e301a){_0x2e301a=_0x2e301a||0xcc;return function(_0x212f2b){if(_0x212f2b){return _0x2456ee[_0x4aa3('0x1b')](_0x2e301a);}return _0x2456ee['status'](_0x2e301a)[_0x4aa3('0x1c')]();};}function respondWithResult(_0x256f27,_0x24f3b3){_0x24f3b3=_0x24f3b3||0xc8;return function(_0x32b198){if(_0x32b198){return _0x256f27[_0x4aa3('0x1d')](_0x24f3b3)[_0x4aa3('0x1e')](_0x32b198);}};}function respondWithFilteredResult(_0x1120f4,_0x574247){return function(_0x4c5c58){if(_0x4c5c58){var _0x5b9f56=typeof _0x574247[_0x4aa3('0x1f')]==='undefined'&&typeof _0x574247[_0x4aa3('0x20')]===_0x4aa3('0x21');var _0x2b2a1e=_0x4c5c58[_0x4aa3('0x22')];var _0x1e5a02=_0x5b9f56?0x0:_0x574247[_0x4aa3('0x1f')];var _0x177cc8=_0x5b9f56?_0x4c5c58['count']:_0x574247[_0x4aa3('0x1f')]+_0x574247['limit'];var _0x758e93;if(_0x177cc8>=_0x2b2a1e){_0x177cc8=_0x2b2a1e;_0x758e93=0xc8;}else{_0x758e93=0xce;}_0x1120f4[_0x4aa3('0x1d')](_0x758e93);return _0x1120f4[_0x4aa3('0x23')]('Content-Range',_0x1e5a02+'-'+_0x177cc8+'/'+_0x2b2a1e)[_0x4aa3('0x1e')](_0x4c5c58);}return null;};}function patchUpdates(_0x39ddca){return function(_0x3b401b){try{jsonpatch[_0x4aa3('0x24')](_0x3b401b,_0x39ddca,!![]);}catch(_0x546196){return BPromise[_0x4aa3('0x25')](_0x546196);}return _0x3b401b[_0x4aa3('0x26')]();};}function saveUpdates(_0x3b25d2,_0x4e27fb){return function(_0x3bb196){if(_0x3bb196){return _0x3bb196[_0x4aa3('0x27')](_0x3b25d2)[_0x4aa3('0x28')](function(_0x1ac129){return _0x1ac129;});}return null;};}function removeEntity(_0x3ca7eb,_0x3e7634){return function(_0x4e4748){if(_0x4e4748){return _0x4e4748[_0x4aa3('0x29')]()[_0x4aa3('0x28')](function(){_0x3ca7eb[_0x4aa3('0x1d')](0xcc)[_0x4aa3('0x1c')]();});}};}function handleEntityNotFound(_0x246e8f,_0x44e50f){return function(_0x389b23){if(!_0x389b23){_0x246e8f['sendStatus'](0x194);}return _0x389b23;};}function handleError(_0x5e8efc,_0x2d064c){_0x2d064c=_0x2d064c||0x1f4;return function(_0x4558f2){logger[_0x4aa3('0x2a')](_0x4558f2['stack']);if(_0x4558f2[_0x4aa3('0x2b')]){delete _0x4558f2[_0x4aa3('0x2b')];}_0x5e8efc[_0x4aa3('0x1d')](_0x2d064c)[_0x4aa3('0x2c')](_0x4558f2);};}exports[_0x4aa3('0x2d')]=function(_0x4b33ed,_0x5b277c){var _0x46ecf5={},_0x162013={},_0x40b8f8={'count':0x0,'rows':[]};var _0x533ec4=_[_0x4aa3('0x2e')](db[_0x4aa3('0x2f')][_0x4aa3('0x30')],function(_0x3bcf1f){return{'name':_0x3bcf1f[_0x4aa3('0x31')],'type':_0x3bcf1f[_0x4aa3('0x32')][_0x4aa3('0x33')]};});_0x162013['model']=_[_0x4aa3('0x2e')](_0x533ec4,_0x4aa3('0x2b'));_0x162013[_0x4aa3('0x34')]=_[_0x4aa3('0x35')](_0x4b33ed[_0x4aa3('0x34')]);_0x162013[_0x4aa3('0x36')]=_[_0x4aa3('0x37')](_0x162013[_0x4aa3('0x38')],_0x162013[_0x4aa3('0x34')]);_0x46ecf5[_0x4aa3('0x39')]=_[_0x4aa3('0x37')](_0x162013[_0x4aa3('0x38')],qs[_0x4aa3('0x3a')](_0x4b33ed[_0x4aa3('0x34')][_0x4aa3('0x3a')]));_0x46ecf5['attributes']=_0x46ecf5[_0x4aa3('0x39')][_0x4aa3('0x3b')]?_0x46ecf5[_0x4aa3('0x39')]:_0x162013[_0x4aa3('0x38')];if(!_0x4b33ed[_0x4aa3('0x34')]['hasOwnProperty']('nolimit')){_0x46ecf5['limit']=qs[_0x4aa3('0x20')](_0x4b33ed[_0x4aa3('0x34')][_0x4aa3('0x20')]);_0x46ecf5[_0x4aa3('0x1f')]=qs[_0x4aa3('0x1f')](_0x4b33ed[_0x4aa3('0x34')][_0x4aa3('0x1f')]);}_0x46ecf5[_0x4aa3('0x3c')]=qs[_0x4aa3('0x3d')](_0x4b33ed['query']['sort']);_0x46ecf5[_0x4aa3('0x3e')]=qs[_0x4aa3('0x36')](_[_0x4aa3('0x3f')](_0x4b33ed[_0x4aa3('0x34')],_0x162013[_0x4aa3('0x36')]),_0x533ec4);if(_0x4b33ed[_0x4aa3('0x34')][_0x4aa3('0x40')]){_0x46ecf5[_0x4aa3('0x3e')]=_[_0x4aa3('0x41')](_0x46ecf5['where'],{'$or':_[_0x4aa3('0x2e')](_0x533ec4,function(_0x377e19){if(_0x377e19[_0x4aa3('0x32')]!==_0x4aa3('0x42')){var _0x442b85={};_0x442b85[_0x377e19[_0x4aa3('0x2b')]]={'$like':'%'+_0x4b33ed[_0x4aa3('0x34')][_0x4aa3('0x40')]+'%'};return _0x442b85;}})});}_0x46ecf5=_[_0x4aa3('0x41')]({},_0x46ecf5,_0x4b33ed['options']);var _0x1d76fa={'where':_0x46ecf5['where']};return db['SmsApplication']['count'](_0x1d76fa)[_0x4aa3('0x28')](function(_0x374a88){_0x40b8f8['count']=_0x374a88;if(_0x4b33ed[_0x4aa3('0x34')][_0x4aa3('0x43')]){_0x46ecf5[_0x4aa3('0x44')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x46ecf5);})[_0x4aa3('0x28')](function(_0x39d92e){_0x40b8f8[_0x4aa3('0x45')]=_0x39d92e;return _0x40b8f8;})[_0x4aa3('0x28')](respondWithFilteredResult(_0x5b277c,_0x46ecf5))[_0x4aa3('0x46')](handleError(_0x5b277c,null));};exports[_0x4aa3('0x47')]=function(_0x44a4b0,_0x5d9f72){var _0x3562a3={'raw':!![],'where':{'id':_0x44a4b0[_0x4aa3('0x48')]['id']}},_0x852287={};_0x852287['model']=_[_0x4aa3('0x35')](db[_0x4aa3('0x2f')]['rawAttributes']);_0x852287[_0x4aa3('0x34')]=_[_0x4aa3('0x35')](_0x44a4b0[_0x4aa3('0x34')]);_0x852287['filters']=_[_0x4aa3('0x37')](_0x852287['model'],_0x852287[_0x4aa3('0x34')]);_0x3562a3[_0x4aa3('0x39')]=_['intersection'](_0x852287[_0x4aa3('0x38')],qs[_0x4aa3('0x3a')](_0x44a4b0[_0x4aa3('0x34')][_0x4aa3('0x3a')]));_0x3562a3[_0x4aa3('0x39')]=_0x3562a3[_0x4aa3('0x39')][_0x4aa3('0x3b')]?_0x3562a3[_0x4aa3('0x39')]:_0x852287[_0x4aa3('0x38')];if(_0x44a4b0[_0x4aa3('0x34')][_0x4aa3('0x43')]){_0x3562a3[_0x4aa3('0x44')]=[{'all':!![]}];}_0x3562a3=_[_0x4aa3('0x41')]({},_0x3562a3,_0x44a4b0[_0x4aa3('0x49')]);return db['SmsApplication'][_0x4aa3('0x4a')](_0x3562a3)['then'](handleEntityNotFound(_0x5d9f72,null))[_0x4aa3('0x28')](respondWithResult(_0x5d9f72,null))[_0x4aa3('0x46')](handleError(_0x5d9f72,null));};exports[_0x4aa3('0x4b')]=function(_0xceb501,_0x52e2b3){return db['SmsApplication'][_0x4aa3('0x4b')](_0xceb501[_0x4aa3('0x4c')],{})[_0x4aa3('0x28')](respondWithResult(_0x52e2b3,0xc9))[_0x4aa3('0x46')](handleError(_0x52e2b3,null));};exports[_0x4aa3('0x27')]=function(_0xed72ea,_0xe07184){if(_0xed72ea[_0x4aa3('0x4c')]['id']){delete _0xed72ea[_0x4aa3('0x4c')]['id'];}return db['SmsApplication'][_0x4aa3('0x4a')]({'where':{'id':_0xed72ea['params']['id']}})[_0x4aa3('0x28')](handleEntityNotFound(_0xe07184,null))[_0x4aa3('0x28')](saveUpdates(_0xed72ea[_0x4aa3('0x4c')],null))[_0x4aa3('0x28')](respondWithResult(_0xe07184,null))['catch'](handleError(_0xe07184,null));};exports[_0x4aa3('0x29')]=function(_0x415a4a,_0x367357){return db[_0x4aa3('0x2f')]['find']({'where':{'id':_0x415a4a[_0x4aa3('0x48')]['id']}})['then'](handleEntityNotFound(_0x367357,null))[_0x4aa3('0x28')](removeEntity(_0x367357,null))[_0x4aa3('0x46')](handleError(_0x367357,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 3b3d740..8e773df 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 _0xf558=['api','moment','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x103db9,_0x3a938e){var _0x54c255=function(_0x28b4f8){while(--_0x28b4f8){_0x103db9['push'](_0x103db9['shift']());}};_0x54c255(++_0x3a938e);}(_0xf558,0x8a));var _0x8f55=function(_0x181b84,_0x42f8f1){_0x181b84=_0x181b84-0x0;var _0x3f773d=_0xf558[_0x181b84];return _0x3f773d;};'use strict';var _=require(_0x8f55('0x0'));var util=require('util');var logger=require(_0x8f55('0x1'))(_0x8f55('0x2'));var moment=require(_0x8f55('0x3'));var BPromise=require('bluebird');var rp=require(_0x8f55('0x4'));var fs=require('fs');var path=require(_0x8f55('0x5'));var rimraf=require(_0x8f55('0x6'));var config=require(_0x8f55('0x7'));var attributes=require(_0x8f55('0x8'));module[_0x8f55('0x9')]=function(_0x5173ee,_0x41f709){return _0x5173ee[_0x8f55('0xa')](_0x8f55('0xb'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8f55('0xc'),'collate':_0x8f55('0xd')});}; \ No newline at end of file +var _0x4acd=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x1b887c,_0x50005b){var _0x3d6210=function(_0x1797a1){while(--_0x1797a1){_0x1b887c['push'](_0x1b887c['shift']());}};_0x3d6210(++_0x50005b);}(_0x4acd,0x137));var _0xd4ac=function(_0xa8b370,_0x2b77db){_0xa8b370=_0xa8b370-0x0;var _0x643e37=_0x4acd[_0xa8b370];return _0x643e37;};'use strict';var _=require(_0xd4ac('0x0'));var util=require(_0xd4ac('0x1'));var logger=require(_0xd4ac('0x2'))(_0xd4ac('0x3'));var moment=require(_0xd4ac('0x4'));var BPromise=require(_0xd4ac('0x5'));var rp=require(_0xd4ac('0x6'));var fs=require('fs');var path=require(_0xd4ac('0x7'));var rimraf=require(_0xd4ac('0x8'));var config=require(_0xd4ac('0x9'));var attributes=require(_0xd4ac('0xa'));module[_0xd4ac('0xb')]=function(_0x1cefbf,_0x45fe5f){return _0x1cefbf['define']('SmsApplication',attributes,{'tableName':_0xd4ac('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd4ac('0xd'),'collate':_0xd4ac('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index bdc69b4..9d9e23d 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 _0x7f3f=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','bluebird','randomstring'];(function(_0x4d30ac,_0x112604){var _0x279f70=function(_0x38475f){while(--_0x38475f){_0x4d30ac['push'](_0x4d30ac['shift']());}};_0x279f70(++_0x112604);}(_0x7f3f,0x1c8));var _0xf7f3=function(_0x20cf8a,_0x44cd6b){_0x20cf8a=_0x20cf8a-0x0;var _0x54e165=_0x7f3f[_0x20cf8a];return _0x54e165;};'use strict';var _=require(_0xf7f3('0x0'));var util=require(_0xf7f3('0x1'));var moment=require('moment');var BPromise=require(_0xf7f3('0x2'));var rs=require(_0xf7f3('0x3'));var fs=require('fs');var Redis=require(_0xf7f3('0x4'));var db=require(_0xf7f3('0x5'))['db'];var utils=require(_0xf7f3('0x6'));var logger=require('../../config/logger')(_0xf7f3('0x7'));var config=require(_0xf7f3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf7f3('0x9')][_0xf7f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe75375,_0x32a035,_0x14b371){return new BPromise(function(_0x31beac,_0x464bf9){return client['request'](_0xe75375,_0x14b371)[_0xf7f3('0xb')](function(_0x468c0c){logger[_0xf7f3('0xc')](_0xf7f3('0xd'),_0x32a035,_0xf7f3('0xe'));logger[_0xf7f3('0xf')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x32a035,'request\x20sent',JSON[_0xf7f3('0x10')](_0x468c0c));if(_0x468c0c['error']){if(_0x468c0c['error']['code']===0x1f4){logger[_0xf7f3('0x11')](_0xf7f3('0xd'),_0x32a035,_0x468c0c[_0xf7f3('0x11')][_0xf7f3('0x12')]);return _0x464bf9(_0x468c0c[_0xf7f3('0x11')]['message']);}logger[_0xf7f3('0x11')](_0xf7f3('0xd'),_0x32a035,_0x468c0c['error']['message']);return _0x31beac(_0x468c0c['error']['message']);}else{logger['info'](_0xf7f3('0xd'),_0x32a035,_0xf7f3('0xe'));_0x31beac(_0x468c0c['result'][_0xf7f3('0x12')]);}})[_0xf7f3('0x13')](function(_0xd0d1b0){logger['error']('SmsApplication,\x20%s,\x20%s',_0x32a035,_0xd0d1b0);_0x464bf9(_0xd0d1b0);});});} \ No newline at end of file +var _0x5b20=['SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\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','client','http','request','then','info'];(function(_0x513597,_0x1641d2){var _0x46c6f9=function(_0x51187d){while(--_0x51187d){_0x513597['push'](_0x513597['shift']());}};_0x46c6f9(++_0x1641d2);}(_0x5b20,0x86));var _0x05b2=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x5b20[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x05b2('0x0'));var util=require(_0x05b2('0x1'));var moment=require(_0x05b2('0x2'));var BPromise=require(_0x05b2('0x3'));var rs=require(_0x05b2('0x4'));var fs=require('fs');var Redis=require(_0x05b2('0x5'));var db=require(_0x05b2('0x6'))['db'];var utils=require(_0x05b2('0x7'));var logger=require(_0x05b2('0x8'))(_0x05b2('0x9'));var config=require(_0x05b2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x05b2('0xb')][_0x05b2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x541855,_0x24f11f,_0x43cd94){return new BPromise(function(_0x3be69a,_0x1b66e4){return client[_0x05b2('0xd')](_0x541855,_0x43cd94)[_0x05b2('0xe')](function(_0xfe6680){logger[_0x05b2('0xf')](_0x05b2('0x10'),_0x24f11f,_0x05b2('0x11'));logger[_0x05b2('0x12')](_0x05b2('0x13'),_0x24f11f,_0x05b2('0x11'),JSON[_0x05b2('0x14')](_0xfe6680));if(_0xfe6680[_0x05b2('0x15')]){if(_0xfe6680[_0x05b2('0x15')]['code']===0x1f4){logger[_0x05b2('0x15')](_0x05b2('0x10'),_0x24f11f,_0xfe6680[_0x05b2('0x15')][_0x05b2('0x16')]);return _0x1b66e4(_0xfe6680['error'][_0x05b2('0x16')]);}logger[_0x05b2('0x15')](_0x05b2('0x10'),_0x24f11f,_0xfe6680['error']['message']);return _0x3be69a(_0xfe6680[_0x05b2('0x15')][_0x05b2('0x16')]);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x24f11f,_0x05b2('0x11'));_0x3be69a(_0xfe6680[_0x05b2('0x17')][_0x05b2('0x16')]);}})[_0x05b2('0x18')](function(_0x234843){logger[_0x05b2('0x15')](_0x05b2('0x10'),_0x24f11f,_0x234843);_0x1b66e4(_0x234843);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index d7d740e..ca866ae 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 _0x1bb4=['index','get','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','sms','smsinteraction:addtags','smsinteraction:update','delete','smsinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./smsInteraction.controller','isAuthenticated'];(function(_0x4c9381,_0x3df6e1){var _0x3e593a=function(_0x2ff57c){while(--_0x2ff57c){_0x4c9381['push'](_0x4c9381['shift']());}};_0x3e593a(++_0x3df6e1);}(_0x1bb4,0x1c7));var _0x41bb=function(_0x2f57c2,_0x378033){_0x2f57c2=_0x2f57c2-0x0;var _0x5f3548=_0x1bb4[_0x2f57c2];return _0x5f3548;};'use strict';var multer=require(_0x41bb('0x0'));var util=require(_0x41bb('0x1'));var path=require(_0x41bb('0x2'));var timeout=require(_0x41bb('0x3'));var express=require(_0x41bb('0x4'));var router=express['Router']();var fs_extra=require(_0x41bb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x41bb('0x6'));var config=require('../../config/environment');var controller=require(_0x41bb('0x7'));router['get']('/',auth[_0x41bb('0x8')](),controller[_0x41bb('0x9')]);router[_0x41bb('0xa')]('/describe',auth[_0x41bb('0x8')](),controller[_0x41bb('0xb')]);router['get'](_0x41bb('0xc'),auth[_0x41bb('0x8')](),controller[_0x41bb('0xd')]);router['get'](_0x41bb('0xe'),auth[_0x41bb('0x8')](),controller[_0x41bb('0xf')]);router[_0x41bb('0xa')](_0x41bb('0x10'),auth['isAuthenticated'](),controller[_0x41bb('0x11')]);router[_0x41bb('0x12')]('/',auth[_0x41bb('0x8')](),controller[_0x41bb('0x13')]);router[_0x41bb('0x12')](_0x41bb('0xe'),auth[_0x41bb('0x8')](),controller[_0x41bb('0x14')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x41bb('0x15')](_0x41bb('0x16'),_0x41bb('0x17')),controller['addTags']);router['put'](_0x41bb('0xc'),auth[_0x41bb('0x8')](),interaction[_0x41bb('0x15')](_0x41bb('0x16'),_0x41bb('0x18')),controller['update']);router[_0x41bb('0x19')]('/:id',auth[_0x41bb('0x8')](),interaction[_0x41bb('0x15')]('sms',_0x41bb('0x1a')),controller[_0x41bb('0x1b')]);router['delete']('/:id/tags',auth[_0x41bb('0x8')](),controller['removeTags']);module[_0x41bb('0x1c')]=router; \ No newline at end of file +var _0x3c8e=['smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete'];(function(_0x238736,_0x14b2f9){var _0x2ef382=function(_0x529441){while(--_0x529441){_0x238736['push'](_0x238736['shift']());}};_0x2ef382(++_0x14b2f9);}(_0x3c8e,0x89));var _0xe3c8=function(_0x55565e,_0x16eb3e){_0x55565e=_0x55565e-0x0;var _0x377d97=_0x3c8e[_0x55565e];return _0x377d97;};'use strict';var multer=require(_0xe3c8('0x0'));var util=require(_0xe3c8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe3c8('0x2'));var router=express[_0xe3c8('0x3')]();var fs_extra=require(_0xe3c8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe3c8('0x5'));var config=require(_0xe3c8('0x6'));var controller=require(_0xe3c8('0x7'));router[_0xe3c8('0x8')]('/',auth['isAuthenticated'](),controller[_0xe3c8('0x9')]);router[_0xe3c8('0x8')](_0xe3c8('0xa'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0xc')]);router['get'](_0xe3c8('0xd'),auth['isAuthenticated'](),controller[_0xe3c8('0xe')]);router[_0xe3c8('0x8')](_0xe3c8('0xf'),auth[_0xe3c8('0xb')](),controller['getMessages']);router[_0xe3c8('0x8')](_0xe3c8('0x10'),auth[_0xe3c8('0xb')](),controller['download']);router[_0xe3c8('0x11')]('/',auth['isAuthenticated'](),controller[_0xe3c8('0x12')]);router['post']('/:id/messages',auth[_0xe3c8('0xb')](),controller[_0xe3c8('0x13')]);router[_0xe3c8('0x11')]('/:id/tags',auth[_0xe3c8('0xb')](),interaction[_0xe3c8('0x14')](_0xe3c8('0x15'),_0xe3c8('0x16')),controller[_0xe3c8('0x17')]);router[_0xe3c8('0x18')]('/:id',auth[_0xe3c8('0xb')](),interaction[_0xe3c8('0x14')]('sms',_0xe3c8('0x19')),controller[_0xe3c8('0x1a')]);router[_0xe3c8('0x1b')]('/:id',auth[_0xe3c8('0xb')](),interaction[_0xe3c8('0x14')](_0xe3c8('0x15'),_0xe3c8('0x1c')),controller[_0xe3c8('0x1d')]);router[_0xe3c8('0x1b')](_0xe3c8('0x1e'),auth['isAuthenticated'](),controller[_0xe3c8('0x1f')]);module[_0xe3c8('0x20')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 53bcfab..6b63ae5 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 _0x57df=['exports','BOOLEAN','STRING','DATE','ENUM','out','moment'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x57df,0x109));var _0xf57d=function(_0x5669f2,_0x2cb7fd){_0x5669f2=_0x5669f2-0x0;var _0x50df77=_0x57df[_0x5669f2];return _0x50df77;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf57d('0x0'));module[_0xf57d('0x1')]={'closed':{'type':Sequelize[_0xf57d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xf57d('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf57d('0x3')]},'note':{'type':Sequelize[_0xf57d('0x3')]},'phone':{'type':Sequelize[_0xf57d('0x3')]},'read1stAt':{'type':Sequelize[_0xf57d('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xf57d('0x5')]('in',_0xf57d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf57d('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xf57d('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x56f9=['out','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x41f813,_0x730a37){var _0x223a5f=function(_0x310907){while(--_0x310907){_0x41f813['push'](_0x41f813['shift']());}};_0x223a5f(++_0x730a37);}(_0x56f9,0x109));var _0x956f=function(_0x52b1a7,_0x5b4f4f){_0x52b1a7=_0x52b1a7-0x0;var _0x2165d2=_0x56f9[_0x52b1a7];return _0x2165d2;};'use strict';var Sequelize=require(_0x956f('0x0'));var moment=require(_0x956f('0x1'));module[_0x956f('0x2')]={'closed':{'type':Sequelize[_0x956f('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x956f('0x4')]},'disposition':{'type':Sequelize[_0x956f('0x5')]},'secondDisposition':{'type':Sequelize[_0x956f('0x5')]},'thirdDisposition':{'type':Sequelize[_0x956f('0x5')]},'note':{'type':Sequelize[_0x956f('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x956f('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x956f('0x6')]('in',_0x956f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x956f('0x6')]('in',_0x956f('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 5e3219f..fff13cf 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 _0xc14a=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','tools_tags','u.id','u.fullname','ui.SmsInteractionId','from','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','start','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','i.SmsAccountId\x20IS\x20NOT\x20NULL','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','user','role','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','push','rows','keys','includeAll','include','options','create','body','params','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','SmsInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','Tag','emit','smsInteractionTags:save','removeTags','download','unix','server','files','tmp','join','root','attachments','format','transcript-%d-%s.zip','CmContact','lastName','direction','secret','SmsAccount','Account','Owner','get','Sms','fullname','N.A.','closed','disposition','Messages','System','firstName','out','renderFile','downloadInteraction.html','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsInteraction.socket','sendStatus','end','status','offset','undefined','limit','count','set','reject','save','then','destroy','error','Users','TagIds','Tags','split','forEach','catch','map','SmsInteraction','rawAttributes','fieldName','type','model','name','query','filters','intersection','fields'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc14a,0xa9));var _0xac14=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc14a[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xac14('0x0'));var rimraf=require(_0xac14('0x1'));var zipdir=require(_0xac14('0x2'));var jsonpatch=require(_0xac14('0x3'));var rp=require(_0xac14('0x4'));var moment=require('moment');var BPromise=require(_0xac14('0x5'));var Mustache=require(_0xac14('0x6'));var util=require('util');var path=require(_0xac14('0x7'));var sox=require('sox');var csv=require(_0xac14('0x8'));var ejs=require(_0xac14('0x9'));var fs=require('fs');var fs_extra=require(_0xac14('0xa'));var _=require('lodash');var squel=require(_0xac14('0xb'));var crypto=require(_0xac14('0xc'));var jsforce=require(_0xac14('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xac14('0x8'));var querystring=require(_0xac14('0xe'));var Papa=require(_0xac14('0xf'));var Redis=require(_0xac14('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xac14('0x11'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xac14('0x12'));var hardwareService=require(_0xac14('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xac14('0x14'));var config=require(_0xac14('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xac14('0x16'))['db'];config[_0xac14('0x17')]=_['defaults'](config[_0xac14('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xac14('0x18'))(new Redis(config[_0xac14('0x17')]));require(_0xac14('0x19'))['register'](socket);function respondWithStatusCode(_0x5365ad,_0xfcb961){_0xfcb961=_0xfcb961||0xcc;return function(_0x5c00df){if(_0x5c00df){return _0x5365ad[_0xac14('0x1a')](_0xfcb961);}return _0x5365ad['status'](_0xfcb961)[_0xac14('0x1b')]();};}function respondWithResult(_0x19edc6,_0x1023e2){_0x1023e2=_0x1023e2||0xc8;return function(_0x22cb60){if(_0x22cb60){return _0x19edc6[_0xac14('0x1c')](_0x1023e2)['json'](_0x22cb60);}};}function respondWithFilteredResult(_0xfc781a,_0x219ee6){return function(_0x39a6e8){if(_0x39a6e8){var _0x1682b1=typeof _0x219ee6[_0xac14('0x1d')]===_0xac14('0x1e')&&typeof _0x219ee6[_0xac14('0x1f')]==='undefined';var _0x429390=_0x39a6e8[_0xac14('0x20')];var _0x151ae8=_0x1682b1?0x0:_0x219ee6[_0xac14('0x1d')];var _0x14b2a0=_0x1682b1?_0x39a6e8['count']:_0x219ee6['offset']+_0x219ee6[_0xac14('0x1f')];var _0x2ff035;if(_0x14b2a0>=_0x429390){_0x14b2a0=_0x429390;_0x2ff035=0xc8;}else{_0x2ff035=0xce;}_0xfc781a['status'](_0x2ff035);return _0xfc781a[_0xac14('0x21')]('Content-Range',_0x151ae8+'-'+_0x14b2a0+'/'+_0x429390)['json'](_0x39a6e8);}return null;};}function patchUpdates(_0x5bb4f7){return function(_0x3b6615){try{jsonpatch['apply'](_0x3b6615,_0x5bb4f7,!![]);}catch(_0x1b863e){return BPromise[_0xac14('0x22')](_0x1b863e);}return _0x3b6615[_0xac14('0x23')]();};}function saveUpdates(_0x331edb,_0x4ce169){return function(_0x4313bb){if(_0x4313bb){return _0x4313bb['update'](_0x331edb)[_0xac14('0x24')](function(_0xa2c069){return _0xa2c069;});}return null;};}function removeEntity(_0x536eb3,_0xeb26c2){return function(_0x34f641){if(_0x34f641){return _0x34f641[_0xac14('0x25')]()[_0xac14('0x24')](function(){_0x536eb3[_0xac14('0x1c')](0xcc)[_0xac14('0x1b')]();});}};}function handleEntityNotFound(_0x5d033d,_0xc7dd39){return function(_0x5de6e5){if(!_0x5de6e5){_0x5d033d['sendStatus'](0x194);}return _0x5de6e5;};}function handleError(_0x52973f,_0x23a5b3){_0x23a5b3=_0x23a5b3||0x1f4;return function(_0x25b07e){logger[_0xac14('0x26')](_0x25b07e['stack']);if(_0x25b07e['name']){delete _0x25b07e['name'];}_0x52973f['status'](_0x23a5b3)['send'](_0x25b07e);};}function getInteractionUsers(_0x47621c,_0x568024){return new BPromise(function(_0x169066,_0x464ae9){try{if(_0x568024[_0x47621c['id']]){_0x47621c[_0xac14('0x27')]=_['map'](_0x568024[_0x47621c['id']],function(_0x120a8f){return{'id':_0x120a8f['id'],'fullname':_0x120a8f['fullname']};});}}catch(_0x30dc81){_0x464ae9(_0x30dc81);}_0x169066(_0x47621c);});}function getInteractionTags(_0x1495ab,_0x17389f){return new BPromise(function(_0x2b9891,_0x52adb5){try{if(_0x1495ab[_0xac14('0x28')]){_0x1495ab[_0xac14('0x29')]=[];_0x1495ab[_0xac14('0x28')][_0xac14('0x2a')](',')[_0xac14('0x2b')](function(_0x176915){_0x1495ab['Tags']['push'](_0x17389f[_0x176915]);});}delete _0x1495ab['TagIds'];}catch(_0x60c5a2){_0x52adb5(_0x60c5a2);}_0x2b9891(_0x1495ab);});}function updateSmsInteraction(_0xb7afdf,_0x12f601,_0x1335c3){return new BPromise(function(_0x58389f,_0x410731){return getInteractionUsers(_0xb7afdf,_0x1335c3)[_0xac14('0x24')](function(_0x3b6b64){return getInteractionTags(_0x3b6b64,_0x12f601);})['then'](function(_0xb25ee0){_0x58389f(_0xb25ee0);})[_0xac14('0x2c')](function(_0x52ac22){_0x410731(_0x52ac22);});});}exports['index']=function(_0x4a353d,_0x21756a){var _0x528588={},_0x372000={},_0x239f3d={'count':0x0,'rows':[]};var _0x3e7edb=_[_0xac14('0x2d')](db[_0xac14('0x2e')][_0xac14('0x2f')],function(_0x4ce01e){return{'name':_0x4ce01e[_0xac14('0x30')],'type':_0x4ce01e[_0xac14('0x31')]['key']};});_0x372000[_0xac14('0x32')]=_[_0xac14('0x2d')](_0x3e7edb,_0xac14('0x33'));_0x372000[_0xac14('0x34')]=_['keys'](_0x4a353d[_0xac14('0x34')]);_0x372000[_0xac14('0x35')]=_[_0xac14('0x36')](_0x372000[_0xac14('0x32')],_0x372000[_0xac14('0x34')]);_0x528588['attributes']=_[_0xac14('0x36')](_0x372000[_0xac14('0x32')],qs[_0xac14('0x37')](_0x4a353d[_0xac14('0x34')]['fields']));_0x528588[_0xac14('0x38')]=_0x528588['attributes'][_0xac14('0x39')]?_0x528588[_0xac14('0x38')]:_0x372000[_0xac14('0x32')];if(!_0x4a353d[_0xac14('0x34')][_0xac14('0x3a')](_0xac14('0x3b'))){_0x528588[_0xac14('0x1f')]=qs['limit'](_0x4a353d[_0xac14('0x34')][_0xac14('0x1f')]);_0x528588[_0xac14('0x1d')]=qs['offset'](_0x4a353d[_0xac14('0x34')][_0xac14('0x1d')]);}_0x528588[_0xac14('0x3c')]=qs[_0xac14('0x3d')](_0x4a353d[_0xac14('0x34')][_0xac14('0x3d')]);_0x528588[_0xac14('0x3e')]=qs['filters'](_[_0xac14('0x3f')](_0x4a353d[_0xac14('0x34')],_0x372000[_0xac14('0x35')]),_0x3e7edb);var _0x1ff74f=[];var _0x58ffb1=squel['select']()[_0xac14('0x40')]('id')[_0xac14('0x40')](_0xac14('0x33'))[_0xac14('0x40')](_0xac14('0x41'))['from'](_0xac14('0x42'));var _0xe45d2d=squel['select']()[_0xac14('0x40')](_0xac14('0x43'))['field'](_0xac14('0x44'))['field'](_0xac14('0x45'))[_0xac14('0x46')](_0xac14('0x47'),'ui')[_0xac14('0x48')](_0xac14('0x49'),'u',_0xac14('0x4a'));var _0x14cb32=squel[_0xac14('0x4b')]()[_0xac14('0x46')](_0xac14('0x4c'),'i')[_0xac14('0x48')](_0xac14('0x4d'),'c',_0xac14('0x4e'))['left_join'](_0xac14('0x49'),'o',_0xac14('0x4f'))[_0xac14('0x48')](_0xac14('0x50'),'a',_0xac14('0x51'))[_0xac14('0x48')](_0xac14('0x52'),'me',_0xac14('0x53'))[_0xac14('0x48')]('sms_interaction_has_tags','it','it.SmsInteractionId\x20=\x20i.id')[_0xac14('0x48')](_0xac14('0x42'),'t',_0xac14('0x54'));var _0x58205f=squel[_0xac14('0x55')]();var _0x7547f0=[];var _0x2bc850=squel['expr']();var _0x33b158;if(_0x4a353d[_0xac14('0x34')]['search']){_0x33b158=as[_0xac14('0x56')](_0x4a353d[_0xac14('0x34')][_0xac14('0x57')]);var _0x520d37=_0x33b158[_0xac14('0x58')];for(var _0xa6acb3=0x0;_0xa6acb3<_0x33b158[_0xac14('0x59')][_0xac14('0x39')];_0xa6acb3++){var _0x180c46=_0x33b158[_0xac14('0x59')][_0xa6acb3];var _0xd4e2da='i';var _0x44cf9d=_[_0xac14('0x5a')](_0x3e7edb,[_0xac14('0x33'),_0x180c46[_0xac14('0x40')]]);if(!_0x44cf9d){switch(_0x180c46[_0xac14('0x40')]){case _0xac14('0x5b'):if(_0x180c46[_0xac14('0x5c')]==0x1){_0x14cb32[_0xac14('0x5d')]('`'+_0x180c46[_0xac14('0x40')]+_0xac14('0x5e'));}else{_0x14cb32[_0xac14('0x5d')]('`'+_0x180c46[_0xac14('0x40')]+_0xac14('0x5f'));}break;case _0xac14('0x60'):if(_0x180c46[_0xac14('0x61')]===_0xac14('0x62')){if(_0x180c46[_0xac14('0x5c')][_0xac14('0x2a')]('\x20')[_0xac14('0x39')]>0x1){_0x58205f[_0x520d37](_0xac14('0x63'),qs[_0xac14('0x64')](_0x180c46[_0xac14('0x5c')]),null);}else{var _0x59fac0='%'+_0x180c46[_0xac14('0x5c')]+'%';_0x58205f[_0x520d37]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x59fac0,_0x59fac0,_0x59fac0);}}else{_0x44cf9d=_[_0xac14('0x5a')](_0x3e7edb,[_0xac14('0x33'),'ContactId']);_0x180c46[_0xac14('0x40')]=_0xac14('0x65');_0x48913f=as['buildExpression'](_0xd4e2da,_0x44cf9d[_0xac14('0x31')],_0x180c46);_0x58205f[_0x520d37](_0x48913f[_0xac14('0x66')],_0x48913f[_0xac14('0x5c')][_0xac14('0x67')],_0x48913f[_0xac14('0x5c')][_0xac14('0x1b')]);}break;case'Tag':var _0x4b8f23=_0x180c46[_0xac14('0x5c')][_0xac14('0x2a')](',')['map'](function(_0x51fd38){return Number(_0x51fd38);});_0x4b8f23[_0xac14('0x2b')](function(_0x3d93b0){_0x2bc850['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3d93b0+',%');});_0x7547f0=_[_0xac14('0x68')](_0x7547f0,_0x4b8f23);break;case _0xac14('0x69'):if(_0x180c46[_0xac14('0x61')]===_0xac14('0x62')){_0x58205f[_0x520d37](_0xac14('0x6a'),'%'+_0x180c46['value']+'%',null);}else{_0x44cf9d=_[_0xac14('0x5a')](_0x3e7edb,['name',_0xac14('0x6b')]);_0x180c46[_0xac14('0x40')]=_0xac14('0x6b');_0x48913f=as[_0xac14('0x6c')](_0xd4e2da,_0x44cf9d[_0xac14('0x31')],_0x180c46);_0x58205f[_0x520d37](_0x48913f[_0xac14('0x66')],_0x48913f[_0xac14('0x5c')][_0xac14('0x67')],_0x48913f['value'][_0xac14('0x1b')]);}break;case'body':_0x48913f=as[_0xac14('0x6c')]('me',null,_0x180c46);_0x58205f[_0x520d37](_0x48913f[_0xac14('0x66')],_0x48913f['value']['start'],_0x48913f[_0xac14('0x5c')][_0xac14('0x1b')]);break;}}else{var _0x48913f=as[_0xac14('0x6c')](_0xd4e2da,_0x44cf9d[_0xac14('0x31')],_0x180c46);_0x58205f[_0x520d37](_0x48913f[_0xac14('0x66')],_0x48913f['value'][_0xac14('0x67')],_0x48913f[_0xac14('0x5c')][_0xac14('0x1b')]);}}}else{var _0x347230=_(_0x4a353d['query'])['keys']()['map'](function(_0x3e04bb){return _[_0xac14('0x6d')](_0x3e7edb,[_0xac14('0x33'),_0x3e04bb])?_0x3e04bb:undefined;})[_0xac14('0x6e')]()[_0xac14('0x5c')]();if(!_[_0xac14('0x6f')](_0x347230)){_0x347230[_0xac14('0x2b')](function(_0x53b94a){if(_0x53b94a===_0xac14('0x70')){_0x14cb32[_0xac14('0x3e')](_0xac14('0x71'),[][_0xac14('0x72')](_0x4a353d['query'][_0x53b94a]));}else if(_0x53b94a===_0xac14('0x73')){var _0x4e20b5=JSON['parse'](_0x4a353d[_0xac14('0x34')][_0x53b94a])[_0xac14('0x74')];var _0x54929a=JSON[_0xac14('0x75')](_0x4a353d[_0xac14('0x34')][_0x53b94a])[_0xac14('0x76')];_0x14cb32['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4e20b5,_0x54929a);}else{if(_0x4a353d['query'][_0x53b94a]===_0xac14('0x77')){_0x14cb32[_0xac14('0x3e')]('i.'+_0x53b94a+_0xac14('0x78'));}else{_0x14cb32[_0xac14('0x3e')]('i.'+_0x53b94a+_0xac14('0x79'),_0x4a353d[_0xac14('0x34')][_0x53b94a]);}}});}if(_0x4a353d['query']['read']){if(_0x4a353d['query'][_0xac14('0x7a')]==0x1){_0x14cb32[_0xac14('0x5d')](_0xac14('0x7b'));}else{_0x14cb32[_0xac14('0x5d')](_0xac14('0x7c'));}}if(_0x4a353d[_0xac14('0x34')][_0xac14('0x7d')]){_0x7547f0=_[_0xac14('0x7e')](_0x4a353d[_0xac14('0x34')][_0xac14('0x7d')])?_0x4a353d[_0xac14('0x34')][_0xac14('0x7d')]:new Array(_0x4a353d[_0xac14('0x34')][_0xac14('0x7d')]);_0x7547f0['forEach'](function(_0x5b2fa0){_0x2bc850['or'](_0xac14('0x7f'),'%,'+_0x5b2fa0+',%');});}if(_0x4a353d['query'][_0xac14('0x80')]){var _0x280155=_0x4a353d[_0xac14('0x34')][_0xac14('0x80')]['replace']('\x5c','\x5c\x5c')[_0xac14('0x81')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x280155)){_0x58205f['or'](_0xac14('0x82'),_0x280155+'%')['or']('i.phone\x20LIKE\x20?',_0x280155+'%');}else{_0x58205f['or'](_0xac14('0x83'),qs[_0xac14('0x64')](_0x280155))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x280155+'%');}}}_0x14cb32[_0xac14('0x3e')](_0x58205f);_0x14cb32[_0xac14('0x84')](_0xac14('0x85'));var _0x36ef7b={'type':db['Sequelize'][_0xac14('0x86')]['SELECT'],'raw':!![]};var _0x181dd9=_0x14cb32[_0xac14('0x87')]();_0x181dd9[_0xac14('0x40')](_0xac14('0x85'));_0x181dd9[_0xac14('0x40')](_0xac14('0x88'),_0xac14('0x5b'));if(_0x528588[_0xac14('0x3c')]){_0x528588[_0xac14('0x3c')][_0xac14('0x2b')](function(_0x318f25){var _0x386cc4=_0x318f25[0x0]===_0xac14('0x89')?_0x318f25[0x0]:'i.'+_0x318f25[0x0];_0x14cb32[_0xac14('0x3c')](_0x386cc4,_0x318f25[0x1]===_0xac14('0x8a')?![]:!![]);});}if(!_[_0xac14('0x6f')](_0x7547f0)){_0x14cb32[_0xac14('0x5d')](_0x2bc850);_0x181dd9[_0xac14('0x3e')]('t.id\x20IN\x20?',_0x7547f0);}BPromise['resolve']()['then'](function(){if(!_0x33b158){if(_0x4a353d['query'][_0xac14('0x70')])return;_0x181dd9[_0xac14('0x3e')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x14cb32[_0xac14('0x3e')](_0xac14('0x8b'));return;}if(_0x4a353d['user']['role']!==_0xac14('0x8c'))return;return _0x4a353d['user'][_0xac14('0x8d')]({'attributes':['id'],'raw':!![]})[_0xac14('0x24')](function(_0xd27795){if(_[_0xac14('0x6f')](_0xd27795)){_0x181dd9['where']('i.SmsAccountId\x20IS\x20NULL');_0x14cb32['where'](_0xac14('0x8e'));}else{_0x181dd9[_0xac14('0x3e')]('i.SmsAccountId\x20IN\x20?',_[_0xac14('0x2d')](_0xd27795,'id'));_0x14cb32['where'](_0xac14('0x71'),_['map'](_0xd27795,'id'));}});})[_0xac14('0x24')](function(){if(_0x4a353d[_0xac14('0x8f')][_0xac14('0x90')]===_0xac14('0x8c')&&!_0x33b158&&!_0x4a353d[_0xac14('0x34')][_0xac14('0x70')])return[];return db['sequelize'][_0xac14('0x34')](_0x181dd9['toString'](),_0x36ef7b);})[_0xac14('0x24')](function(_0x468e88){_0x239f3d[_0xac14('0x20')]=_0x468e88[_0xac14('0x39')];if(_0x239f3d[_0xac14('0x20')]===0x0)return[];return db[_0xac14('0x91')][_0xac14('0x34')](_0x58ffb1[_0xac14('0x92')](),_0x36ef7b)[_0xac14('0x24')](function(_0x51972d){_0x1ff74f=_[_0xac14('0x93')](_0x51972d,'id');_0x36ef7b=_[_0xac14('0x94')](_0x36ef7b,{'model':db[_0xac14('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4a353d[_0xac14('0x34')][_0xac14('0x37')]){_0x528588[_0xac14('0x38')][_0xac14('0x2b')](function(_0x35701a){_0x14cb32[_0xac14('0x40')]('i.'+_0x35701a);});}else{_0x14cb32[_0xac14('0x40')](_0xac14('0x88'),_0xac14('0x5b'));_0x14cb32[_0xac14('0x40')]('a.key',_0xac14('0x95'));_0x14cb32[_0xac14('0x40')](_0xac14('0x96'),'Account.mandatoryDisposition');_0x14cb32[_0xac14('0x40')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xac14('0x89'));_0x14cb32[_0xac14('0x40')](_0xac14('0x97'));_0x14cb32[_0xac14('0x40')](_0xac14('0x98'),_0xac14('0x99'));_0x14cb32[_0xac14('0x40')](_0xac14('0x9a'),_0xac14('0x9b'));_0x14cb32[_0xac14('0x40')](_0xac14('0x9c'),'Contact.email');_0x14cb32[_0xac14('0x40')](_0xac14('0x9d'),'Contact.phone');_0x14cb32[_0xac14('0x40')](_0xac14('0x9e'),_0xac14('0x9f'));_0x14cb32[_0xac14('0x40')]('c.fax',_0xac14('0xa0'));_0x14cb32[_0xac14('0x40')](_0xac14('0xa1'),_0xac14('0xa2'));_0x14cb32[_0xac14('0x40')]('o.internal','Owner.internal');_0x14cb32[_0xac14('0x40')](_0xac14('0xa3'),_0xac14('0x28'));}if(_0x528588[_0xac14('0x1f')])_0x14cb32[_0xac14('0x1f')](_0x528588[_0xac14('0x1f')]);if(_0x528588['offset'])_0x14cb32['offset'](_0x528588[_0xac14('0x1d')]);return db[_0xac14('0x91')][_0xac14('0x34')](_0x14cb32[_0xac14('0x92')](),_0x36ef7b);})['then'](function(_0x241f33){if(_0x241f33[_0xac14('0x39')]>0x0)_0xe45d2d[_0xac14('0x3e')](_0xac14('0xa4'),_[_0xac14('0x2d')](_0x241f33,'id'));return db[_0xac14('0x91')][_0xac14('0x34')](_0xe45d2d[_0xac14('0x92')](),_0x36ef7b)[_0xac14('0x24')](function(_0x17a346){var _0x5eed4c=_[_0xac14('0xa5')](_0x17a346,'SmsInteractionId');var _0x39ea2c=[];_0x241f33['forEach'](function(_0x1659d9){_0x39ea2c[_0xac14('0xa6')](updateSmsInteraction(_0x1659d9,_0x1ff74f,_0x5eed4c));});return BPromise['all'](_0x39ea2c);});});})[_0xac14('0x24')](function(_0xdf608a){_0x239f3d[_0xac14('0xa7')]=_0xdf608a;return _0x239f3d;})['then'](respondWithFilteredResult(_0x21756a,_0x528588))[_0xac14('0x2c')](handleError(_0x21756a,null));};exports['show']=function(_0x5f1f78,_0x353bfe){var _0x72de82={'raw':![],'where':{'id':_0x5f1f78['params']['id']}},_0x3d74db={};_0x3d74db[_0xac14('0x32')]=_[_0xac14('0xa8')](db[_0xac14('0x2e')][_0xac14('0x2f')]);_0x3d74db[_0xac14('0x34')]=_[_0xac14('0xa8')](_0x5f1f78[_0xac14('0x34')]);_0x3d74db[_0xac14('0x35')]=_[_0xac14('0x36')](_0x3d74db[_0xac14('0x32')],_0x3d74db[_0xac14('0x34')]);_0x72de82[_0xac14('0x38')]=_[_0xac14('0x36')](_0x3d74db[_0xac14('0x32')],qs[_0xac14('0x37')](_0x5f1f78[_0xac14('0x34')][_0xac14('0x37')]));_0x72de82[_0xac14('0x38')]=_0x72de82[_0xac14('0x38')][_0xac14('0x39')]?_0x72de82[_0xac14('0x38')]:_0x3d74db[_0xac14('0x32')];if(_0x5f1f78['query'][_0xac14('0xa9')]){_0x72de82[_0xac14('0xaa')]=[{'all':!![]}];}_0x72de82=_['merge']({},_0x72de82,_0x5f1f78[_0xac14('0xab')]);return db[_0xac14('0x2e')][_0xac14('0x5a')](_0x72de82)[_0xac14('0x24')](handleEntityNotFound(_0x353bfe,null))[_0xac14('0x24')](respondWithResult(_0x353bfe,null))[_0xac14('0x2c')](handleError(_0x353bfe,null));};exports[_0xac14('0xac')]=function(_0xd7aac6,_0x1734db){return db[_0xac14('0x2e')]['create'](_0xd7aac6[_0xac14('0xad')],{})[_0xac14('0x24')](respondWithResult(_0x1734db,0xc9))[_0xac14('0x2c')](handleError(_0x1734db,null));};exports['update']=function(_0x5b9110,_0x40153d){if(_0x5b9110[_0xac14('0xad')]['id']){delete _0x5b9110[_0xac14('0xad')]['id'];}return db['SmsInteraction'][_0xac14('0x5a')]({'where':{'id':_0x5b9110[_0xac14('0xae')]['id']}})[_0xac14('0x24')](handleEntityNotFound(_0x40153d,null))[_0xac14('0x24')](saveUpdates(_0x5b9110[_0xac14('0xad')],null))['then'](respondWithResult(_0x40153d,null))[_0xac14('0x2c')](handleError(_0x40153d,null));};exports[_0xac14('0x25')]=function(_0x111f84,_0xb4afd3){return db[_0xac14('0x2e')][_0xac14('0x5a')]({'where':{'id':_0x111f84[_0xac14('0xae')]['id']}})[_0xac14('0x24')](handleEntityNotFound(_0xb4afd3,null))[_0xac14('0x24')](removeEntity(_0xb4afd3,null))[_0xac14('0x2c')](handleError(_0xb4afd3,null));};exports[_0xac14('0xaf')]=function(_0x260ab0,_0x2f84c7){return db[_0xac14('0x2e')][_0xac14('0xaf')]()[_0xac14('0x24')](respondWithResult(_0x2f84c7,null))[_0xac14('0x2c')](handleError(_0x2f84c7,null));};exports[_0xac14('0xb0')]=function(_0x327dc2,_0x428adc,_0x4c3e76){return db[_0xac14('0xb1')][_0xac14('0x5a')]({'where':{'id':_0x327dc2[_0xac14('0xae')]['id']}})[_0xac14('0x24')](handleEntityNotFound(_0x428adc,null))[_0xac14('0x24')](function(_0x1b34d5){if(_0x1b34d5){return _0x1b34d5['addMessage'](_0x327dc2['body'][_0xac14('0xb2')],_[_0xac14('0xb3')](_0x327dc2[_0xac14('0xad')],[_0xac14('0xb2'),'id'])||{});}})[_0xac14('0x24')](respondWithResult(_0x428adc,null))['catch'](handleError(_0x428adc,null));};exports[_0xac14('0xb4')]=function(_0x4beae8,_0x593c21,_0x48eb54){var _0x176292={'raw':![],'where':{}};var _0x1d8913={};var _0x31a363={'count':0x0,'rows':[]};return db[_0xac14('0x2e')][_0xac14('0xb5')]({'where':{'id':_0x4beae8[_0xac14('0xae')]['id']}})['then'](handleEntityNotFound(_0x593c21,null))[_0xac14('0x24')](function(_0x29019f){if(_0x29019f){_0x1d8913[_0xac14('0x32')]=_[_0xac14('0xa8')](db[_0xac14('0xb1')][_0xac14('0x2f')]);_0x1d8913[_0xac14('0x34')]=_[_0xac14('0xa8')](_0x4beae8[_0xac14('0x34')]);_0x1d8913[_0xac14('0x35')]=_[_0xac14('0x36')](_0x1d8913[_0xac14('0x32')],_0x1d8913[_0xac14('0x34')]);_0x176292[_0xac14('0x38')]=_[_0xac14('0x36')](_0x1d8913['model'],qs[_0xac14('0x37')](_0x4beae8['query']['fields']));_0x176292[_0xac14('0x38')]=_0x176292[_0xac14('0x38')][_0xac14('0x39')]?_0x176292[_0xac14('0x38')]:_0x1d8913[_0xac14('0x32')];if(!_0x4beae8['query'][_0xac14('0x3a')]('nolimit')){_0x176292[_0xac14('0x1f')]=qs[_0xac14('0x1f')](_0x4beae8['query'][_0xac14('0x1f')]);_0x176292['offset']=qs['offset'](_0x4beae8['query'][_0xac14('0x1d')]);}_0x176292['order']=qs[_0xac14('0x3d')](_0x4beae8[_0xac14('0x34')]['sort']);_0x176292['where']=qs[_0xac14('0x35')](_['pick'](_0x4beae8[_0xac14('0x34')],_0x1d8913['filters']));_0x176292[_0xac14('0x3e')][_0xac14('0xb6')]=_0x29019f['id'];if(_0x4beae8[_0xac14('0x34')][_0xac14('0x80')]){_0x176292[_0xac14('0x3e')]=_[_0xac14('0x94')](_0x176292[_0xac14('0x3e')],{'$or':_[_0xac14('0x2d')](_0x176292[_0xac14('0x38')],function(_0x4a4043){var _0x252c94={};_0x252c94[_0x4a4043]={'$like':'%'+_0x4beae8['query'][_0xac14('0x80')]+'%'};return _0x252c94;})});}if(_0x4beae8[_0xac14('0x34')][_0xac14('0x74')]){var _0x3e1d87=_0x4beae8[_0xac14('0x34')][_0xac14('0x74')][_0xac14('0x2a')](',');var _0x5d624a={};_0x5d624a[_0x3e1d87[0x0]]={'$gte':moment(_0x3e1d87[0x1])['format'](_0xac14('0xb7'))};_0x176292['where']=_['merge'](_0x176292['where'],_0x5d624a);}_0x176292=_[_0xac14('0x94')]({},_0x176292,_0x4beae8['options']);return db['SmsMessage'][_0xac14('0x20')]({'where':_0x176292[_0xac14('0x3e')]})[_0xac14('0x24')](function(_0x5d30f6){_0x31a363['count']=_0x5d30f6;if(_0x4beae8['query'][_0xac14('0xa9')]){_0x176292['include']=[{'all':!![]}];}return db[_0xac14('0xb1')][_0xac14('0xb8')](_0x176292);})['then'](function(_0x586c6f){_0x31a363[_0xac14('0xa7')]=_0x586c6f;return _0x31a363;});}})[_0xac14('0x24')](respondWithFilteredResult(_0x593c21,_0x176292))[_0xac14('0x2c')](handleError(_0x593c21,null));};exports[_0xac14('0xb9')]=function(_0x2bcc89,_0x54f983,_0x26b942){return db[_0xac14('0x2e')][_0xac14('0x5a')]({'where':{'id':_0x2bcc89[_0xac14('0xae')]['id']}})[_0xac14('0x24')](handleEntityNotFound(_0x54f983,null))[_0xac14('0x24')](function(_0x1de0b8){if(_0x1de0b8){return _0x1de0b8[_0xac14('0xba')](_0x2bcc89[_0xac14('0xad')][_0xac14('0xb2')],_['omit'](_0x2bcc89[_0xac14('0xad')],['ids','id'])||{})['spread'](function(){return db[_0xac14('0xbb')][_0xac14('0xb8')]({'attributes':['id','name','color'],'where':{'id':_0x2bcc89[_0xac14('0xad')][_0xac14('0xb2')]}});})['then'](function(_0x359267){socket[_0xac14('0xbc')](_0xac14('0xbd'),{'id':Number(_0x2bcc89['params']['id']),'tags':_0x359267||[]});return{'id':Number(_0x2bcc89[_0xac14('0xae')]['id']),'tags':_0x359267||[]};});}})[_0xac14('0x24')](respondWithResult(_0x54f983,null))[_0xac14('0x2c')](handleError(_0x54f983,null));};exports[_0xac14('0xbe')]=function(_0x524c6f,_0x1c9278,_0x596758){return db[_0xac14('0x2e')][_0xac14('0x5a')]({'where':{'id':_0x524c6f['params']['id']}})[_0xac14('0x24')](handleEntityNotFound(_0x1c9278,null))[_0xac14('0x24')](function(_0x11ea8a){if(_0x11ea8a){return _0x11ea8a[_0xac14('0xbe')](_0x524c6f[_0xac14('0x34')][_0xac14('0xb2')]);}})[_0xac14('0x24')](respondWithStatusCode(_0x1c9278,null))[_0xac14('0x2c')](handleError(_0x1c9278,null));};exports[_0xac14('0xbf')]=function(_0x1e2fb7,_0x35cd44){var _0x50a182=moment()[_0xac14('0xc0')]()[_0xac14('0x92')]();var _0x2f782e=path['join'](config['root'],_0xac14('0xc1'),_0xac14('0xc2'),_0xac14('0xc3'));var _0x3b74aa=path[_0xac14('0xc4')](config[_0xac14('0xc5')],_0xac14('0xc1'),_0xac14('0xc2'),_0xac14('0xc6'));var _0x3c9cad=path[_0xac14('0xc4')](_0x2f782e,_0x50a182);var _0x1f760c=util[_0xac14('0xc7')](_0xac14('0xc8'),_0x1e2fb7[_0xac14('0xae')]['id'],_0x50a182);var _0x59ef4f=path[_0xac14('0xc4')](_0x2f782e,_0x1f760c);var _0xc91fe0=[];_0xc91fe0[_0xac14('0xa6')]({'model':db['User'],'as':_0xac14('0x69'),'attributes':['id','fullname'],'raw':!![]});_0xc91fe0[_0xac14('0xa6')]({'model':db[_0xac14('0xc9')],'as':_0xac14('0x60'),'attributes':['id','firstName',_0xac14('0xca')],'raw':!![]});var _0x42477c=[{'model':db[_0xac14('0xb1')],'as':'Messages','attributes':['id',_0xac14('0xad'),_0xac14('0x73'),_0xac14('0xcb'),_0xac14('0xcc'),_0xac14('0x7a')],'include':_0xc91fe0}];_0x42477c[_0xac14('0xa6')]({'model':db[_0xac14('0xcd')],'as':_0xac14('0xce'),'attributes':['id','name']});_0x42477c['push']({'model':db[_0xac14('0x69')],'as':_0xac14('0xcf'),'attributes':['id','fullname']});return db[_0xac14('0x2e')][_0xac14('0x5a')]({'where':{'id':_0x1e2fb7['params']['id']},'include':_0x42477c})[_0xac14('0x24')](handleEntityNotFound(_0x35cd44,null))['then'](function(_0x127590){if(_0x127590){var _0x5f2078=_0x127590[_0xac14('0xd0')]({'plain':!![]});fs['mkdirSync'](_0x3c9cad);var _0x27cf63={'channel':_0xac14('0xd1'),'account':_0x5f2078[_0xac14('0xce')]['name'],'agent':_0x5f2078[_0xac14('0xcf')]?_0x5f2078[_0xac14('0xcf')][_0xac14('0xd2')]:_0xac14('0xd3'),'createdAt':moment(_0x5f2078[_0xac14('0x73')])['format'](_0xac14('0xb7'))[_0xac14('0x92')](),'closedAt':_0x5f2078[_0xac14('0xd4')]?moment(_0x5f2078['closedAt'])[_0xac14('0xc7')](_0xac14('0xb7'))[_0xac14('0x92')]():'','disposition':_0x5f2078[_0xac14('0xd5')],'messages':_(_0x5f2078[_0xac14('0xd6')])[_0xac14('0x80')]({'secret':![]})['map'](function(_0x39baf5){return{'date':moment(_0x39baf5[_0xac14('0x73')])[_0xac14('0xc7')](_0xac14('0xb7'))['toString'](),'sender':_0x39baf5[_0xac14('0xcb')]==='out'?_0x39baf5['User']?_0x39baf5['User']['fullname']:_0xac14('0xd7'):_0x39baf5[_0xac14('0x60')][_0xac14('0xd8')]+(_0x39baf5[_0xac14('0x60')][_0xac14('0xca')]?'\x20'+_0x39baf5[_0xac14('0x60')]['lastName']:''),'body':_0x39baf5[_0xac14('0xad')],'direction':_0x39baf5['direction']===_0xac14('0xd9')?'A':'C','secret':_0x39baf5[_0xac14('0xcc')],'read':_0x39baf5[_0xac14('0x7a')]};})[_0xac14('0x5c')]()};return ejs[_0xac14('0xda')](path[_0xac14('0xc4')](config['root'],'server','views',_0xac14('0xdb')),{'interaction':_0x27cf63})['then'](function(_0xf3a93){var _0x5bc3e6=path[_0xac14('0xc4')](_0x3c9cad,_0xac14('0xdc')+_0x5f2078['id']+'-'+_0x50a182+_0xac14('0xdd'));var _0x1c1df7={'path':_0x5bc3e6,'channel':_0xac14('0xd1'),'interactionId':_0x5f2078['id']};return pdf[_0xac14('0xde')](_0xf3a93,_0x1c1df7);})[_0xac14('0x24')](function(){return new BPromise(function(_0xea557d,_0x5d051f){zipdir(_0x3c9cad,{'saveTo':_0x59ef4f},function(_0x24f86d,_0x14eb46){if(_0x24f86d)return _0x5d051f(_0x24f86d);return _0xea557d(_0x14eb46);});})['then'](function(){return new BPromise(function(_0x5a73e2,_0x1c6654){rimraf(_0x3c9cad,function(_0x143402){if(_0x143402)_0x1c6654(_0x143402);return _0x5a73e2();});});})[_0xac14('0x24')](function(){return _0x35cd44[_0xac14('0xbf')](_0x59ef4f,_0x1f760c,function(_0x342013){if(_0x342013){console['log'](_0xac14('0xdf'),_0x342013);}else{fs[_0xac14('0xe0')](_0x59ef4f);}});});});}else{return _0x35cd44[_0xac14('0x1a')](0xc8);}})[_0xac14('0x2c')](handleError(_0x35cd44,null));}; \ No newline at end of file +var _0xb7ae=['Account','Owner','N.A.','closedAt','out','System','renderFile','views','downloadInteraction.html','transcript-','.pdf','Sms','createPdfFromHTML','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status','json','limit','undefined','count','offset','Content-Range','apply','reject','then','destroy','end','sendStatus','error','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','index','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','field','color','from','tools_tags','select','u.id','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','some','isEmpty','SmsAccountId','concat','createdAt','parse','$lte','where','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.mobile','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','catch','params','includeAll','options','create','body','describe','SmsMessage','addMessage','ids','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','addTags','omit','spread','emit','smsInteractionTags:save','removeTags','unix','join','root','server','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','secret'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xb7ae,0xf3));var _0xeb7a=function(_0x59426c,_0x24dd51){_0x59426c=_0x59426c-0x0;var _0x16d54f=_0xb7ae[_0x59426c];return _0x16d54f;};'use strict';var emlformat=require(_0xeb7a('0x0'));var rimraf=require(_0xeb7a('0x1'));var zipdir=require(_0xeb7a('0x2'));var jsonpatch=require(_0xeb7a('0x3'));var rp=require(_0xeb7a('0x4'));var moment=require('moment');var BPromise=require(_0xeb7a('0x5'));var Mustache=require(_0xeb7a('0x6'));var util=require(_0xeb7a('0x7'));var path=require('path');var sox=require(_0xeb7a('0x8'));var csv=require(_0xeb7a('0x9'));var ejs=require(_0xeb7a('0xa'));var fs=require('fs');var fs_extra=require(_0xeb7a('0xb'));var _=require(_0xeb7a('0xc'));var squel=require('squel');var crypto=require(_0xeb7a('0xd'));var jsforce=require(_0xeb7a('0xe'));var deskjs=require(_0xeb7a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xeb7a('0x10'));var Papa=require(_0xeb7a('0x11'));var Redis=require(_0xeb7a('0x12'));var authService=require(_0xeb7a('0x13'));var qs=require(_0xeb7a('0x14'));var as=require(_0xeb7a('0x15'));var pdf=require(_0xeb7a('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb7a('0x17'));var utils=require(_0xeb7a('0x18'));var config=require(_0xeb7a('0x19'));var licenseUtil=require(_0xeb7a('0x1a'));var db=require(_0xeb7a('0x1b'))['db'];config[_0xeb7a('0x1c')]=_[_0xeb7a('0x1d')](config['redis'],{'host':_0xeb7a('0x1e'),'port':0x18eb});var socket=require(_0xeb7a('0x1f'))(new Redis(config['redis']));require(_0xeb7a('0x20'))[_0xeb7a('0x21')](socket);function respondWithStatusCode(_0x5f41f4,_0x2bf77e){_0x2bf77e=_0x2bf77e||0xcc;return function(_0x5db84f){if(_0x5db84f){return _0x5f41f4['sendStatus'](_0x2bf77e);}return _0x5f41f4[_0xeb7a('0x22')](_0x2bf77e)['end']();};}function respondWithResult(_0x5782e6,_0x394208){_0x394208=_0x394208||0xc8;return function(_0x38f5cc){if(_0x38f5cc){return _0x5782e6[_0xeb7a('0x22')](_0x394208)[_0xeb7a('0x23')](_0x38f5cc);}};}function respondWithFilteredResult(_0x540b6c,_0x4be13e){return function(_0x34ade5){if(_0x34ade5){var _0x26bd85=typeof _0x4be13e['offset']==='undefined'&&typeof _0x4be13e[_0xeb7a('0x24')]===_0xeb7a('0x25');var _0x47b62c=_0x34ade5[_0xeb7a('0x26')];var _0x302e41=_0x26bd85?0x0:_0x4be13e[_0xeb7a('0x27')];var _0x29fa3f=_0x26bd85?_0x34ade5[_0xeb7a('0x26')]:_0x4be13e['offset']+_0x4be13e[_0xeb7a('0x24')];var _0x1c26f7;if(_0x29fa3f>=_0x47b62c){_0x29fa3f=_0x47b62c;_0x1c26f7=0xc8;}else{_0x1c26f7=0xce;}_0x540b6c['status'](_0x1c26f7);return _0x540b6c['set'](_0xeb7a('0x28'),_0x302e41+'-'+_0x29fa3f+'/'+_0x47b62c)[_0xeb7a('0x23')](_0x34ade5);}return null;};}function patchUpdates(_0x46a305){return function(_0x4023e2){try{jsonpatch[_0xeb7a('0x29')](_0x4023e2,_0x46a305,!![]);}catch(_0x44cefc){return BPromise[_0xeb7a('0x2a')](_0x44cefc);}return _0x4023e2['save']();};}function saveUpdates(_0x1f0135,_0xcf0f77){return function(_0xc240b3){if(_0xc240b3){return _0xc240b3['update'](_0x1f0135)[_0xeb7a('0x2b')](function(_0x1cf8f6){return _0x1cf8f6;});}return null;};}function removeEntity(_0x182335,_0x9b80f5){return function(_0x53ade4){if(_0x53ade4){return _0x53ade4[_0xeb7a('0x2c')]()['then'](function(){_0x182335[_0xeb7a('0x22')](0xcc)[_0xeb7a('0x2d')]();});}};}function handleEntityNotFound(_0x4d24bc,_0x189e2a){return function(_0x820418){if(!_0x820418){_0x4d24bc[_0xeb7a('0x2e')](0x194);}return _0x820418;};}function handleError(_0x39738e,_0x3917eb){_0x3917eb=_0x3917eb||0x1f4;return function(_0x2a492f){logger[_0xeb7a('0x2f')](_0x2a492f[_0xeb7a('0x30')]);if(_0x2a492f['name']){delete _0x2a492f[_0xeb7a('0x31')];}_0x39738e[_0xeb7a('0x22')](_0x3917eb)[_0xeb7a('0x32')](_0x2a492f);};}function getInteractionUsers(_0x203993,_0x14e2e1){return new BPromise(function(_0x202d22,_0x1662ee){try{if(_0x14e2e1[_0x203993['id']]){_0x203993[_0xeb7a('0x33')]=_[_0xeb7a('0x34')](_0x14e2e1[_0x203993['id']],function(_0x1c2238){return{'id':_0x1c2238['id'],'fullname':_0x1c2238[_0xeb7a('0x35')]};});}}catch(_0x4a72bc){_0x1662ee(_0x4a72bc);}_0x202d22(_0x203993);});}function getInteractionTags(_0x3b94f5,_0x2887c6){return new BPromise(function(_0x3e8490,_0x203e5f){try{if(_0x3b94f5['TagIds']){_0x3b94f5[_0xeb7a('0x36')]=[];_0x3b94f5[_0xeb7a('0x37')][_0xeb7a('0x38')](',')[_0xeb7a('0x39')](function(_0x3a67de){_0x3b94f5[_0xeb7a('0x36')]['push'](_0x2887c6[_0x3a67de]);});}delete _0x3b94f5[_0xeb7a('0x37')];}catch(_0xaad2bc){_0x203e5f(_0xaad2bc);}_0x3e8490(_0x3b94f5);});}function updateSmsInteraction(_0x39981b,_0x3d879c,_0x285943){return new BPromise(function(_0x37c26e,_0x47ba59){return getInteractionUsers(_0x39981b,_0x285943)[_0xeb7a('0x2b')](function(_0x4b226f){return getInteractionTags(_0x4b226f,_0x3d879c);})[_0xeb7a('0x2b')](function(_0x3ac6f4){_0x37c26e(_0x3ac6f4);})['catch'](function(_0x14705a){_0x47ba59(_0x14705a);});});}exports[_0xeb7a('0x3a')]=function(_0x7b5806,_0x226a7e){var _0x348be5={},_0x19bbf0={},_0x2aaf7f={'count':0x0,'rows':[]};var _0x3324e4=_['map'](db[_0xeb7a('0x3b')][_0xeb7a('0x3c')],function(_0x573370){return{'name':_0x573370[_0xeb7a('0x3d')],'type':_0x573370[_0xeb7a('0x3e')][_0xeb7a('0x3f')]};});_0x19bbf0[_0xeb7a('0x40')]=_[_0xeb7a('0x34')](_0x3324e4,_0xeb7a('0x31'));_0x19bbf0[_0xeb7a('0x41')]=_['keys'](_0x7b5806[_0xeb7a('0x41')]);_0x19bbf0[_0xeb7a('0x42')]=_[_0xeb7a('0x43')](_0x19bbf0[_0xeb7a('0x40')],_0x19bbf0[_0xeb7a('0x41')]);_0x348be5[_0xeb7a('0x44')]=_[_0xeb7a('0x43')](_0x19bbf0[_0xeb7a('0x40')],qs[_0xeb7a('0x45')](_0x7b5806[_0xeb7a('0x41')][_0xeb7a('0x45')]));_0x348be5[_0xeb7a('0x44')]=_0x348be5['attributes'][_0xeb7a('0x46')]?_0x348be5[_0xeb7a('0x44')]:_0x19bbf0[_0xeb7a('0x40')];if(!_0x7b5806[_0xeb7a('0x41')]['hasOwnProperty'](_0xeb7a('0x47'))){_0x348be5[_0xeb7a('0x24')]=qs[_0xeb7a('0x24')](_0x7b5806[_0xeb7a('0x41')][_0xeb7a('0x24')]);_0x348be5[_0xeb7a('0x27')]=qs['offset'](_0x7b5806[_0xeb7a('0x41')][_0xeb7a('0x27')]);}_0x348be5['order']=qs[_0xeb7a('0x48')](_0x7b5806['query']['sort']);_0x348be5['where']=qs[_0xeb7a('0x42')](_[_0xeb7a('0x49')](_0x7b5806[_0xeb7a('0x41')],_0x19bbf0[_0xeb7a('0x42')]),_0x3324e4);var _0x34177c=[];var _0x28621a=squel['select']()['field']('id')[_0xeb7a('0x4a')]('name')[_0xeb7a('0x4a')](_0xeb7a('0x4b'))[_0xeb7a('0x4c')](_0xeb7a('0x4d'));var _0x4d0302=squel[_0xeb7a('0x4e')]()[_0xeb7a('0x4a')](_0xeb7a('0x4f'))[_0xeb7a('0x4a')]('u.fullname')[_0xeb7a('0x4a')]('ui.SmsInteractionId')[_0xeb7a('0x4c')](_0xeb7a('0x50'),'ui')[_0xeb7a('0x51')](_0xeb7a('0x52'),'u',_0xeb7a('0x53'));var _0x248f29=squel[_0xeb7a('0x4e')]()['from']('sms_interactions','i')[_0xeb7a('0x51')](_0xeb7a('0x54'),'c',_0xeb7a('0x55'))[_0xeb7a('0x51')](_0xeb7a('0x52'),'o','o.id\x20=\x20i.UserId')['left_join'](_0xeb7a('0x56'),'a','a.id\x20=\x20i.SmsAccountId')[_0xeb7a('0x51')](_0xeb7a('0x57'),'me',_0xeb7a('0x58'))[_0xeb7a('0x51')](_0xeb7a('0x59'),'it',_0xeb7a('0x5a'))[_0xeb7a('0x51')](_0xeb7a('0x4d'),'t',_0xeb7a('0x5b'));var _0x36b645=squel[_0xeb7a('0x5c')]();var _0x2876bb=[];var _0x2af84b=squel[_0xeb7a('0x5c')]();var _0x55eb50;if(_0x7b5806[_0xeb7a('0x41')][_0xeb7a('0x5d')]){_0x55eb50=as[_0xeb7a('0x5e')](_0x7b5806[_0xeb7a('0x41')][_0xeb7a('0x5d')]);var _0x160f6c=_0x55eb50[_0xeb7a('0x5f')];for(var _0x2c1670=0x0;_0x2c1670<_0x55eb50[_0xeb7a('0x60')][_0xeb7a('0x46')];_0x2c1670++){var _0x1b5e4e=_0x55eb50[_0xeb7a('0x60')][_0x2c1670];var _0x3e4c00='i';var _0x34898f=_[_0xeb7a('0x61')](_0x3324e4,[_0xeb7a('0x31'),_0x1b5e4e[_0xeb7a('0x4a')]]);if(!_0x34898f){switch(_0x1b5e4e[_0xeb7a('0x4a')]){case _0xeb7a('0x62'):if(_0x1b5e4e[_0xeb7a('0x63')]==0x1){_0x248f29[_0xeb7a('0x64')]('`'+_0x1b5e4e[_0xeb7a('0x4a')]+_0xeb7a('0x65'));}else{_0x248f29['having']('`'+_0x1b5e4e[_0xeb7a('0x4a')]+'`\x20>\x200');}break;case _0xeb7a('0x66'):if(_0x1b5e4e['operator']===_0xeb7a('0x67')){if(_0x1b5e4e[_0xeb7a('0x63')][_0xeb7a('0x38')]('\x20')[_0xeb7a('0x46')]>0x1){_0x36b645[_0x160f6c](_0xeb7a('0x68'),qs[_0xeb7a('0x69')](_0x1b5e4e['value']),null);}else{var _0x31e96f='%'+_0x1b5e4e[_0xeb7a('0x63')]+'%';_0x36b645[_0x160f6c](_0xeb7a('0x6a'),_0x31e96f,_0x31e96f,_0x31e96f);}}else{_0x34898f=_[_0xeb7a('0x61')](_0x3324e4,['name',_0xeb7a('0x6b')]);_0x1b5e4e[_0xeb7a('0x4a')]=_0xeb7a('0x6b');_0x3aa4f2=as[_0xeb7a('0x6c')](_0x3e4c00,_0x34898f[_0xeb7a('0x3e')],_0x1b5e4e);_0x36b645[_0x160f6c](_0x3aa4f2[_0xeb7a('0x6d')],_0x3aa4f2[_0xeb7a('0x63')][_0xeb7a('0x6e')],_0x3aa4f2[_0xeb7a('0x63')][_0xeb7a('0x2d')]);}break;case _0xeb7a('0x6f'):var _0x32b162=_0x1b5e4e[_0xeb7a('0x63')]['split'](',')[_0xeb7a('0x34')](function(_0x1633ef){return Number(_0x1633ef);});_0x32b162[_0xeb7a('0x39')](function(_0x440502){_0x2af84b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x440502+',%');});_0x2876bb=_[_0xeb7a('0x70')](_0x2876bb,_0x32b162);break;case _0xeb7a('0x71'):if(_0x1b5e4e[_0xeb7a('0x72')]===_0xeb7a('0x67')){_0x36b645[_0x160f6c](_0xeb7a('0x73'),'%'+_0x1b5e4e[_0xeb7a('0x63')]+'%',null);}else{_0x34898f=_[_0xeb7a('0x61')](_0x3324e4,[_0xeb7a('0x31'),'UserId']);_0x1b5e4e[_0xeb7a('0x4a')]=_0xeb7a('0x74');_0x3aa4f2=as[_0xeb7a('0x6c')](_0x3e4c00,_0x34898f[_0xeb7a('0x3e')],_0x1b5e4e);_0x36b645[_0x160f6c](_0x3aa4f2['text'],_0x3aa4f2[_0xeb7a('0x63')][_0xeb7a('0x6e')],_0x3aa4f2[_0xeb7a('0x63')][_0xeb7a('0x2d')]);}break;case'body':_0x3aa4f2=as[_0xeb7a('0x6c')]('me',null,_0x1b5e4e);_0x36b645[_0x160f6c](_0x3aa4f2['text'],_0x3aa4f2['value'][_0xeb7a('0x6e')],_0x3aa4f2[_0xeb7a('0x63')][_0xeb7a('0x2d')]);break;}}else{var _0x3aa4f2=as[_0xeb7a('0x6c')](_0x3e4c00,_0x34898f[_0xeb7a('0x3e')],_0x1b5e4e);_0x36b645[_0x160f6c](_0x3aa4f2[_0xeb7a('0x6d')],_0x3aa4f2[_0xeb7a('0x63')][_0xeb7a('0x6e')],_0x3aa4f2[_0xeb7a('0x63')][_0xeb7a('0x2d')]);}}}else{var _0x2adcb9=_(_0x7b5806['query'])[_0xeb7a('0x75')]()[_0xeb7a('0x34')](function(_0x480bff){return _[_0xeb7a('0x76')](_0x3324e4,['name',_0x480bff])?_0x480bff:undefined;})['compact']()[_0xeb7a('0x63')]();if(!_[_0xeb7a('0x77')](_0x2adcb9)){_0x2adcb9[_0xeb7a('0x39')](function(_0x10a624){if(_0x10a624===_0xeb7a('0x78')){_0x248f29['where']('i.SmsAccountId\x20IN\x20?',[][_0xeb7a('0x79')](_0x7b5806[_0xeb7a('0x41')][_0x10a624]));}else if(_0x10a624===_0xeb7a('0x7a')){var _0x3e7618=JSON[_0xeb7a('0x7b')](_0x7b5806[_0xeb7a('0x41')][_0x10a624])['$gte'];var _0x5a30a4=JSON[_0xeb7a('0x7b')](_0x7b5806[_0xeb7a('0x41')][_0x10a624])[_0xeb7a('0x7c')];_0x248f29[_0xeb7a('0x7d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3e7618,_0x5a30a4);}else{if(_0x7b5806[_0xeb7a('0x41')][_0x10a624]===_0xeb7a('0x7e')){_0x248f29['where']('i.'+_0x10a624+'\x20IS\x20NULL');}else{_0x248f29['where']('i.'+_0x10a624+'\x20=\x20?',_0x7b5806[_0xeb7a('0x41')][_0x10a624]);}}});}if(_0x7b5806[_0xeb7a('0x41')]['read']){if(_0x7b5806[_0xeb7a('0x41')][_0xeb7a('0x7f')]==0x1){_0x248f29[_0xeb7a('0x64')](_0xeb7a('0x80'));}else{_0x248f29[_0xeb7a('0x64')](_0xeb7a('0x81'));}}if(_0x7b5806[_0xeb7a('0x41')][_0xeb7a('0x82')]){_0x2876bb=_[_0xeb7a('0x83')](_0x7b5806['query'][_0xeb7a('0x82')])?_0x7b5806[_0xeb7a('0x41')]['tag']:new Array(_0x7b5806[_0xeb7a('0x41')][_0xeb7a('0x82')]);_0x2876bb[_0xeb7a('0x39')](function(_0x2fe024){_0x2af84b['or'](_0xeb7a('0x84'),'%,'+_0x2fe024+',%');});}if(_0x7b5806['query'][_0xeb7a('0x85')]){var _0x6a72d0=_0x7b5806['query'][_0xeb7a('0x85')][_0xeb7a('0x86')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xeb7a('0x87')](_0x6a72d0)){_0x36b645['or']('i.id\x20LIKE\x20?',_0x6a72d0+'%')['or'](_0xeb7a('0x88'),_0x6a72d0+'%');}else{_0x36b645['or'](_0xeb7a('0x89'),qs[_0xeb7a('0x69')](_0x6a72d0))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x6a72d0+'%');}}}_0x248f29[_0xeb7a('0x7d')](_0x36b645);_0x248f29[_0xeb7a('0x8a')](_0xeb7a('0x8b'));var _0x487e8d={'type':db['Sequelize'][_0xeb7a('0x8c')]['SELECT'],'raw':!![]};var _0x1997bc=_0x248f29['clone']();_0x1997bc[_0xeb7a('0x4a')](_0xeb7a('0x8b'));_0x1997bc[_0xeb7a('0x4a')](_0xeb7a('0x8d'),_0xeb7a('0x62'));if(_0x348be5[_0xeb7a('0x8e')]){_0x348be5['order']['forEach'](function(_0x3e6247){var _0x21c538=_0x3e6247[0x0]==='contactName'?_0x3e6247[0x0]:'i.'+_0x3e6247[0x0];_0x248f29[_0xeb7a('0x8e')](_0x21c538,_0x3e6247[0x1]==='DESC'?![]:!![]);});}if(!_[_0xeb7a('0x77')](_0x2876bb)){_0x248f29[_0xeb7a('0x64')](_0x2af84b);_0x1997bc[_0xeb7a('0x7d')](_0xeb7a('0x8f'),_0x2876bb);}BPromise[_0xeb7a('0x90')]()[_0xeb7a('0x2b')](function(){if(!_0x55eb50){if(_0x7b5806[_0xeb7a('0x41')]['SmsAccountId'])return;_0x1997bc[_0xeb7a('0x7d')](_0xeb7a('0x91'));_0x248f29['where'](_0xeb7a('0x91'));return;}if(_0x7b5806[_0xeb7a('0x92')][_0xeb7a('0x93')]!==_0xeb7a('0x94'))return;return _0x7b5806[_0xeb7a('0x92')][_0xeb7a('0x95')]({'attributes':['id'],'raw':!![]})[_0xeb7a('0x2b')](function(_0x3ea1f5){if(_['isEmpty'](_0x3ea1f5)){_0x1997bc[_0xeb7a('0x7d')](_0xeb7a('0x96'));_0x248f29[_0xeb7a('0x7d')](_0xeb7a('0x96'));}else{_0x1997bc[_0xeb7a('0x7d')](_0xeb7a('0x97'),_['map'](_0x3ea1f5,'id'));_0x248f29['where'](_0xeb7a('0x97'),_[_0xeb7a('0x34')](_0x3ea1f5,'id'));}});})['then'](function(){if(_0x7b5806[_0xeb7a('0x92')][_0xeb7a('0x93')]===_0xeb7a('0x94')&&!_0x55eb50&&!_0x7b5806[_0xeb7a('0x41')][_0xeb7a('0x78')])return[];return db[_0xeb7a('0x98')][_0xeb7a('0x41')](_0x1997bc['toString'](),_0x487e8d);})[_0xeb7a('0x2b')](function(_0x404d8f){_0x2aaf7f['count']=_0x404d8f[_0xeb7a('0x46')];if(_0x2aaf7f[_0xeb7a('0x26')]===0x0)return[];return db[_0xeb7a('0x98')][_0xeb7a('0x41')](_0x28621a[_0xeb7a('0x99')](),_0x487e8d)[_0xeb7a('0x2b')](function(_0x34a7d6){_0x34177c=_[_0xeb7a('0x9a')](_0x34a7d6,'id');_0x487e8d=_[_0xeb7a('0x9b')](_0x487e8d,{'model':db[_0xeb7a('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x7b5806[_0xeb7a('0x41')]['fields']){_0x348be5[_0xeb7a('0x44')]['forEach'](function(_0x28299b){_0x248f29[_0xeb7a('0x4a')]('i.'+_0x28299b);});}else{_0x248f29['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xeb7a('0x62'));_0x248f29['field'](_0xeb7a('0x9c'),_0xeb7a('0x9d'));_0x248f29[_0xeb7a('0x4a')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x248f29[_0xeb7a('0x4a')](_0xeb7a('0x9e'),_0xeb7a('0x9f'));_0x248f29[_0xeb7a('0x4a')](_0xeb7a('0xa0'));_0x248f29[_0xeb7a('0x4a')]('c.firstName',_0xeb7a('0xa1'));_0x248f29['field'](_0xeb7a('0xa2'),_0xeb7a('0xa3'));_0x248f29[_0xeb7a('0x4a')](_0xeb7a('0xa4'),'Contact.email');_0x248f29['field'](_0xeb7a('0xa5'),'Contact.phone');_0x248f29['field']('c.mobile',_0xeb7a('0xa6'));_0x248f29['field']('c.fax','Contact.fax');_0x248f29['field']('o.fullname',_0xeb7a('0xa7'));_0x248f29[_0xeb7a('0x4a')](_0xeb7a('0xa8'),_0xeb7a('0xa9'));_0x248f29['field'](_0xeb7a('0xaa'),_0xeb7a('0x37'));}if(_0x348be5[_0xeb7a('0x24')])_0x248f29[_0xeb7a('0x24')](_0x348be5[_0xeb7a('0x24')]);if(_0x348be5[_0xeb7a('0x27')])_0x248f29[_0xeb7a('0x27')](_0x348be5[_0xeb7a('0x27')]);return db[_0xeb7a('0x98')][_0xeb7a('0x41')](_0x248f29[_0xeb7a('0x99')](),_0x487e8d);})[_0xeb7a('0x2b')](function(_0x3fa850){if(_0x3fa850[_0xeb7a('0x46')]>0x0)_0x4d0302['where'](_0xeb7a('0xab'),_['map'](_0x3fa850,'id'));return db[_0xeb7a('0x98')]['query'](_0x4d0302[_0xeb7a('0x99')](),_0x487e8d)[_0xeb7a('0x2b')](function(_0x4248b5){var _0x46887c=_[_0xeb7a('0xac')](_0x4248b5,_0xeb7a('0xad'));var _0x55f352=[];_0x3fa850[_0xeb7a('0x39')](function(_0x1dff0d){_0x55f352[_0xeb7a('0xae')](updateSmsInteraction(_0x1dff0d,_0x34177c,_0x46887c));});return BPromise[_0xeb7a('0xaf')](_0x55f352);});});})[_0xeb7a('0x2b')](function(_0x1ea217){_0x2aaf7f['rows']=_0x1ea217;return _0x2aaf7f;})[_0xeb7a('0x2b')](respondWithFilteredResult(_0x226a7e,_0x348be5))[_0xeb7a('0xb0')](handleError(_0x226a7e,null));};exports['show']=function(_0x1b22d6,_0x15c0a1){var _0x19b7f4={'raw':![],'where':{'id':_0x1b22d6[_0xeb7a('0xb1')]['id']}},_0x5736bc={};_0x5736bc['model']=_[_0xeb7a('0x75')](db['SmsInteraction'][_0xeb7a('0x3c')]);_0x5736bc[_0xeb7a('0x41')]=_['keys'](_0x1b22d6[_0xeb7a('0x41')]);_0x5736bc[_0xeb7a('0x42')]=_[_0xeb7a('0x43')](_0x5736bc[_0xeb7a('0x40')],_0x5736bc[_0xeb7a('0x41')]);_0x19b7f4[_0xeb7a('0x44')]=_['intersection'](_0x5736bc[_0xeb7a('0x40')],qs['fields'](_0x1b22d6[_0xeb7a('0x41')][_0xeb7a('0x45')]));_0x19b7f4['attributes']=_0x19b7f4[_0xeb7a('0x44')][_0xeb7a('0x46')]?_0x19b7f4[_0xeb7a('0x44')]:_0x5736bc['model'];if(_0x1b22d6[_0xeb7a('0x41')][_0xeb7a('0xb2')]){_0x19b7f4['include']=[{'all':!![]}];}_0x19b7f4=_[_0xeb7a('0x9b')]({},_0x19b7f4,_0x1b22d6[_0xeb7a('0xb3')]);return db[_0xeb7a('0x3b')][_0xeb7a('0x61')](_0x19b7f4)[_0xeb7a('0x2b')](handleEntityNotFound(_0x15c0a1,null))[_0xeb7a('0x2b')](respondWithResult(_0x15c0a1,null))[_0xeb7a('0xb0')](handleError(_0x15c0a1,null));};exports[_0xeb7a('0xb4')]=function(_0x452f33,_0x201a5e){return db['SmsInteraction'][_0xeb7a('0xb4')](_0x452f33['body'],{})[_0xeb7a('0x2b')](respondWithResult(_0x201a5e,0xc9))[_0xeb7a('0xb0')](handleError(_0x201a5e,null));};exports['update']=function(_0x443834,_0x2d819e){if(_0x443834['body']['id']){delete _0x443834['body']['id'];}return db[_0xeb7a('0x3b')]['find']({'where':{'id':_0x443834[_0xeb7a('0xb1')]['id']}})[_0xeb7a('0x2b')](handleEntityNotFound(_0x2d819e,null))[_0xeb7a('0x2b')](saveUpdates(_0x443834[_0xeb7a('0xb5')],null))[_0xeb7a('0x2b')](respondWithResult(_0x2d819e,null))[_0xeb7a('0xb0')](handleError(_0x2d819e,null));};exports['destroy']=function(_0xd56344,_0x3815eb){return db[_0xeb7a('0x3b')][_0xeb7a('0x61')]({'where':{'id':_0xd56344[_0xeb7a('0xb1')]['id']}})[_0xeb7a('0x2b')](handleEntityNotFound(_0x3815eb,null))[_0xeb7a('0x2b')](removeEntity(_0x3815eb,null))['catch'](handleError(_0x3815eb,null));};exports[_0xeb7a('0xb6')]=function(_0x38c20d,_0x156151){return db['SmsInteraction']['describe']()['then'](respondWithResult(_0x156151,null))[_0xeb7a('0xb0')](handleError(_0x156151,null));};exports['addMessage']=function(_0x21c8e5,_0x285c61,_0x3947f0){return db[_0xeb7a('0xb7')]['find']({'where':{'id':_0x21c8e5[_0xeb7a('0xb1')]['id']}})[_0xeb7a('0x2b')](handleEntityNotFound(_0x285c61,null))[_0xeb7a('0x2b')](function(_0x5390f6){if(_0x5390f6){return _0x5390f6[_0xeb7a('0xb8')](_0x21c8e5[_0xeb7a('0xb5')][_0xeb7a('0xb9')],_['omit'](_0x21c8e5['body'],[_0xeb7a('0xb9'),'id'])||{});}})['then'](respondWithResult(_0x285c61,null))[_0xeb7a('0xb0')](handleError(_0x285c61,null));};exports[_0xeb7a('0xba')]=function(_0x914cfe,_0x31d56a,_0x5e8ec0){var _0x2fae16={'raw':![],'where':{}};var _0x27f1dc={};var _0x4c8b3a={'count':0x0,'rows':[]};return db[_0xeb7a('0x3b')][_0xeb7a('0xbb')]({'where':{'id':_0x914cfe['params']['id']}})[_0xeb7a('0x2b')](handleEntityNotFound(_0x31d56a,null))[_0xeb7a('0x2b')](function(_0x5f3690){if(_0x5f3690){_0x27f1dc[_0xeb7a('0x40')]=_['keys'](db[_0xeb7a('0xb7')]['rawAttributes']);_0x27f1dc[_0xeb7a('0x41')]=_['keys'](_0x914cfe[_0xeb7a('0x41')]);_0x27f1dc[_0xeb7a('0x42')]=_['intersection'](_0x27f1dc['model'],_0x27f1dc['query']);_0x2fae16[_0xeb7a('0x44')]=_[_0xeb7a('0x43')](_0x27f1dc[_0xeb7a('0x40')],qs['fields'](_0x914cfe['query']['fields']));_0x2fae16[_0xeb7a('0x44')]=_0x2fae16['attributes']['length']?_0x2fae16['attributes']:_0x27f1dc['model'];if(!_0x914cfe[_0xeb7a('0x41')]['hasOwnProperty'](_0xeb7a('0x47'))){_0x2fae16[_0xeb7a('0x24')]=qs[_0xeb7a('0x24')](_0x914cfe[_0xeb7a('0x41')][_0xeb7a('0x24')]);_0x2fae16['offset']=qs[_0xeb7a('0x27')](_0x914cfe['query'][_0xeb7a('0x27')]);}_0x2fae16[_0xeb7a('0x8e')]=qs[_0xeb7a('0x48')](_0x914cfe[_0xeb7a('0x41')][_0xeb7a('0x48')]);_0x2fae16['where']=qs[_0xeb7a('0x42')](_[_0xeb7a('0x49')](_0x914cfe[_0xeb7a('0x41')],_0x27f1dc['filters']));_0x2fae16[_0xeb7a('0x7d')][_0xeb7a('0xad')]=_0x5f3690['id'];if(_0x914cfe['query'][_0xeb7a('0x85')]){_0x2fae16[_0xeb7a('0x7d')]=_[_0xeb7a('0x9b')](_0x2fae16[_0xeb7a('0x7d')],{'$or':_[_0xeb7a('0x34')](_0x2fae16[_0xeb7a('0x44')],function(_0x2de674){var _0x8931e4={};_0x8931e4[_0x2de674]={'$like':'%'+_0x914cfe[_0xeb7a('0x41')][_0xeb7a('0x85')]+'%'};return _0x8931e4;})});}if(_0x914cfe[_0xeb7a('0x41')]['$gte']){var _0x2390c5=_0x914cfe['query'][_0xeb7a('0xbc')][_0xeb7a('0x38')](',');var _0xd440be={};_0xd440be[_0x2390c5[0x0]]={'$gte':moment(_0x2390c5[0x1])[_0xeb7a('0xbd')](_0xeb7a('0xbe'))};_0x2fae16[_0xeb7a('0x7d')]=_[_0xeb7a('0x9b')](_0x2fae16['where'],_0xd440be);}_0x2fae16=_[_0xeb7a('0x9b')]({},_0x2fae16,_0x914cfe[_0xeb7a('0xb3')]);return db[_0xeb7a('0xb7')]['count']({'where':_0x2fae16['where']})[_0xeb7a('0x2b')](function(_0x3a82bc){_0x4c8b3a[_0xeb7a('0x26')]=_0x3a82bc;if(_0x914cfe[_0xeb7a('0x41')][_0xeb7a('0xb2')]){_0x2fae16[_0xeb7a('0xbf')]=[{'all':!![]}];}return db[_0xeb7a('0xb7')][_0xeb7a('0xc0')](_0x2fae16);})[_0xeb7a('0x2b')](function(_0x5b7c24){_0x4c8b3a[_0xeb7a('0xc1')]=_0x5b7c24;return _0x4c8b3a;});}})['then'](respondWithFilteredResult(_0x31d56a,_0x2fae16))[_0xeb7a('0xb0')](handleError(_0x31d56a,null));};exports[_0xeb7a('0xc2')]=function(_0x2a436a,_0x281502,_0x4c8f00){return db[_0xeb7a('0x3b')][_0xeb7a('0x61')]({'where':{'id':_0x2a436a['params']['id']}})[_0xeb7a('0x2b')](handleEntityNotFound(_0x281502,null))[_0xeb7a('0x2b')](function(_0x4993c5){if(_0x4993c5){return _0x4993c5['setTags'](_0x2a436a[_0xeb7a('0xb5')][_0xeb7a('0xb9')],_[_0xeb7a('0xc3')](_0x2a436a[_0xeb7a('0xb5')],['ids','id'])||{})[_0xeb7a('0xc4')](function(){return db[_0xeb7a('0x6f')][_0xeb7a('0xc0')]({'attributes':['id',_0xeb7a('0x31'),_0xeb7a('0x4b')],'where':{'id':_0x2a436a[_0xeb7a('0xb5')]['ids']}});})[_0xeb7a('0x2b')](function(_0x251aaf){socket[_0xeb7a('0xc5')](_0xeb7a('0xc6'),{'id':Number(_0x2a436a[_0xeb7a('0xb1')]['id']),'tags':_0x251aaf||[]});return{'id':Number(_0x2a436a[_0xeb7a('0xb1')]['id']),'tags':_0x251aaf||[]};});}})[_0xeb7a('0x2b')](respondWithResult(_0x281502,null))[_0xeb7a('0xb0')](handleError(_0x281502,null));};exports['removeTags']=function(_0x2f6ba9,_0x121461,_0x3c166a){return db[_0xeb7a('0x3b')][_0xeb7a('0x61')]({'where':{'id':_0x2f6ba9['params']['id']}})[_0xeb7a('0x2b')](handleEntityNotFound(_0x121461,null))['then'](function(_0xc45b79){if(_0xc45b79){return _0xc45b79[_0xeb7a('0xc7')](_0x2f6ba9[_0xeb7a('0x41')][_0xeb7a('0xb9')]);}})[_0xeb7a('0x2b')](respondWithStatusCode(_0x121461,null))[_0xeb7a('0xb0')](handleError(_0x121461,null));};exports['download']=function(_0x3ee99f,_0x3545e5){var _0x27a258=moment()[_0xeb7a('0xc8')]()[_0xeb7a('0x99')]();var _0x46ad6e=path[_0xeb7a('0xc9')](config[_0xeb7a('0xca')],_0xeb7a('0xcb'),_0xeb7a('0xcc'),'tmp');var _0x2bb626=path[_0xeb7a('0xc9')](config[_0xeb7a('0xca')],_0xeb7a('0xcb'),_0xeb7a('0xcc'),_0xeb7a('0xcd'));var _0x2c29a5=path[_0xeb7a('0xc9')](_0x46ad6e,_0x27a258);var _0x9efc73=util[_0xeb7a('0xbd')](_0xeb7a('0xce'),_0x3ee99f[_0xeb7a('0xb1')]['id'],_0x27a258);var _0x437b4c=path['join'](_0x46ad6e,_0x9efc73);var _0x3b17d4=[];_0x3b17d4[_0xeb7a('0xae')]({'model':db['User'],'as':_0xeb7a('0x71'),'attributes':['id','fullname'],'raw':!![]});_0x3b17d4['push']({'model':db[_0xeb7a('0xcf')],'as':'Contact','attributes':['id',_0xeb7a('0xd0'),_0xeb7a('0xd1')],'raw':!![]});var _0x1670df=[{'model':db['SmsMessage'],'as':_0xeb7a('0xd2'),'attributes':['id',_0xeb7a('0xb5'),_0xeb7a('0x7a'),_0xeb7a('0xd3'),_0xeb7a('0xd4'),_0xeb7a('0x7f')],'include':_0x3b17d4}];_0x1670df[_0xeb7a('0xae')]({'model':db['SmsAccount'],'as':_0xeb7a('0xd5'),'attributes':['id',_0xeb7a('0x31')]});_0x1670df[_0xeb7a('0xae')]({'model':db[_0xeb7a('0x71')],'as':_0xeb7a('0xd6'),'attributes':['id','fullname']});return db[_0xeb7a('0x3b')][_0xeb7a('0x61')]({'where':{'id':_0x3ee99f['params']['id']},'include':_0x1670df})[_0xeb7a('0x2b')](handleEntityNotFound(_0x3545e5,null))[_0xeb7a('0x2b')](function(_0x32f8a2){if(_0x32f8a2){var _0x1bfd1e=_0x32f8a2['get']({'plain':!![]});fs['mkdirSync'](_0x2c29a5);var _0x560293={'channel':'Sms','account':_0x1bfd1e[_0xeb7a('0xd5')][_0xeb7a('0x31')],'agent':_0x1bfd1e[_0xeb7a('0xd6')]?_0x1bfd1e[_0xeb7a('0xd6')][_0xeb7a('0x35')]:_0xeb7a('0xd7'),'createdAt':moment(_0x1bfd1e[_0xeb7a('0x7a')])[_0xeb7a('0xbd')](_0xeb7a('0xbe'))[_0xeb7a('0x99')](),'closedAt':_0x1bfd1e['closed']?moment(_0x1bfd1e[_0xeb7a('0xd8')])[_0xeb7a('0xbd')](_0xeb7a('0xbe'))[_0xeb7a('0x99')]():'','disposition':_0x1bfd1e['disposition'],'messages':_(_0x1bfd1e[_0xeb7a('0xd2')])[_0xeb7a('0x85')]({'secret':![]})[_0xeb7a('0x34')](function(_0x6c1642){return{'date':moment(_0x6c1642[_0xeb7a('0x7a')])[_0xeb7a('0xbd')](_0xeb7a('0xbe'))[_0xeb7a('0x99')](),'sender':_0x6c1642[_0xeb7a('0xd3')]===_0xeb7a('0xd9')?_0x6c1642[_0xeb7a('0x71')]?_0x6c1642[_0xeb7a('0x71')]['fullname']:_0xeb7a('0xda'):_0x6c1642['Contact'][_0xeb7a('0xd0')]+(_0x6c1642[_0xeb7a('0x66')][_0xeb7a('0xd1')]?'\x20'+_0x6c1642['Contact']['lastName']:''),'body':_0x6c1642[_0xeb7a('0xb5')],'direction':_0x6c1642[_0xeb7a('0xd3')]===_0xeb7a('0xd9')?'A':'C','secret':_0x6c1642[_0xeb7a('0xd4')],'read':_0x6c1642[_0xeb7a('0x7f')]};})[_0xeb7a('0x63')]()};return ejs[_0xeb7a('0xdb')](path[_0xeb7a('0xc9')](config[_0xeb7a('0xca')],'server',_0xeb7a('0xdc'),_0xeb7a('0xdd')),{'interaction':_0x560293})[_0xeb7a('0x2b')](function(_0x5e5bde){var _0x5d4a9c=path[_0xeb7a('0xc9')](_0x2c29a5,_0xeb7a('0xde')+_0x1bfd1e['id']+'-'+_0x27a258+_0xeb7a('0xdf'));var _0x2eefec={'path':_0x5d4a9c,'channel':_0xeb7a('0xe0'),'interactionId':_0x1bfd1e['id']};return pdf[_0xeb7a('0xe1')](_0x5e5bde,_0x2eefec);})[_0xeb7a('0x2b')](function(){return new BPromise(function(_0x7f3eec,_0x3c7083){zipdir(_0x2c29a5,{'saveTo':_0x437b4c},function(_0x5d1c24,_0x1060c7){if(_0x5d1c24)return _0x3c7083(_0x5d1c24);return _0x7f3eec(_0x1060c7);});})['then'](function(){return new BPromise(function(_0x3b9fc4,_0x45d9c1){rimraf(_0x2c29a5,function(_0x57ad5d){if(_0x57ad5d)_0x45d9c1(_0x57ad5d);return _0x3b9fc4();});});})[_0xeb7a('0x2b')](function(){return _0x3545e5['download'](_0x437b4c,_0x9efc73,function(_0x306ba6){if(_0x306ba6){console[_0xeb7a('0xe2')]('err',_0x306ba6);}else{fs[_0xeb7a('0xe3')](_0x437b4c);}});});});}else{return _0x3545e5[_0xeb7a('0x2e')](0xc8);}})[_0xeb7a('0xb0')](handleError(_0x3545e5,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 5c7257f..be62a26 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 _0x29d4=['then','Users','findAll','setDataValue','unreadMessages','emit','catch','hook','exports','events','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','remove','getUsers'];(function(_0x11364e,_0x344254){var _0x4ba9d4=function(_0x68f219){while(--_0x68f219){_0x11364e['push'](_0x11364e['shift']());}};_0x4ba9d4(++_0x344254);}(_0x29d4,0x1a1));var _0x429d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x29d4[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0x429d('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x429d('0x1')];var SmsMessage=require(_0x429d('0x2'))['db'][_0x429d('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x429d('0x4')](0x0);var events={'afterCreate':_0x429d('0x5'),'afterUpdate':'update','afterDestroy':_0x429d('0x6')};function emitEvent(_0x3f43f5){return function(_0x36a3d8,_0x5e2a9c,_0x1c55aa){_0x36a3d8[_0x429d('0x7')]({'attributes':['id'],'raw':!![]})[_0x429d('0x8')](function(_0x1ede3f){_0x36a3d8['setDataValue'](_0x429d('0x9'),_0x1ede3f['map'](function(_0x471129){return{'id':_0x471129['id']};}));return SmsMessage[_0x429d('0xa')]({'where':{'SmsInteractionId':_0x36a3d8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x429d('0x8')](function(_0x5e8430){_0x36a3d8[_0x429d('0xb')](_0x429d('0xc'),_0x5e8430['length']);SmsInteractionEvents[_0x429d('0xd')](_0x3f43f5+':'+_0x36a3d8['id'],_0x36a3d8);SmsInteractionEvents[_0x429d('0xd')](_0x3f43f5,_0x36a3d8);_0x1c55aa(null);})[_0x429d('0xe')](_0x1c55aa(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x429d('0xf')](e,emitEvent(event));}}module[_0x429d('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0xd13e=['catch','hook','exports','events','../../mysqldb','SmsInteraction','setMaxListeners','update','then','setDataValue','Users','map','findAll','unreadMessages','length','emit'];(function(_0x3b594b,_0x5835c3){var _0x1ea5f8=function(_0x191b3e){while(--_0x191b3e){_0x3b594b['push'](_0x3b594b['shift']());}};_0x1ea5f8(++_0x5835c3);}(_0xd13e,0x193));var _0xed13=function(_0x2d80b2,_0x574be8){_0x2d80b2=_0x2d80b2-0x0;var _0x2ffbea=_0xd13e[_0x2d80b2];return _0x2ffbea;};'use strict';var EventEmitter=require(_0xed13('0x0'));var SmsInteraction=require(_0xed13('0x1'))['db'][_0xed13('0x2')];var SmsMessage=require(_0xed13('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xed13('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xed13('0x4'),'afterDestroy':'remove'};function emitEvent(_0x46158d){return function(_0xcba1c4,_0x5e3571,_0x50de44){_0xcba1c4['getUsers']({'attributes':['id'],'raw':!![]})[_0xed13('0x5')](function(_0x134929){_0xcba1c4[_0xed13('0x6')](_0xed13('0x7'),_0x134929[_0xed13('0x8')](function(_0x2ba0d2){return{'id':_0x2ba0d2['id']};}));return SmsMessage[_0xed13('0x9')]({'where':{'SmsInteractionId':_0xcba1c4['id'],'direction':'in','read':![]},'raw':!![]});})[_0xed13('0x5')](function(_0x8543ad){_0xcba1c4['setDataValue'](_0xed13('0xa'),_0x8543ad[_0xed13('0xb')]);SmsInteractionEvents[_0xed13('0xc')](_0x46158d+':'+_0xcba1c4['id'],_0xcba1c4);SmsInteractionEvents[_0xed13('0xc')](_0x46158d,_0xcba1c4);_0x50de44(null);})[_0xed13('0xd')](_0x50de44(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xed13('0xe')](e,emitEvent(event));}}module[_0xed13('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 2973580..eda2a3e 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 _0xa104=['../../config/logger','api','moment','path','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','changed','closedAt','util'];(function(_0x6e2bcf,_0x464ce0){var _0x4f734f=function(_0x2c8f88){while(--_0x2c8f88){_0x6e2bcf['push'](_0x6e2bcf['shift']());}};_0x4f734f(++_0x464ce0);}(_0xa104,0xaf));var _0x4a10=function(_0x146d9a,_0x12ea7b){_0x146d9a=_0x146d9a-0x0;var _0x505dec=_0xa104[_0x146d9a];return _0x505dec;};'use strict';var _=require('lodash');var util=require(_0x4a10('0x0'));var logger=require(_0x4a10('0x1'))(_0x4a10('0x2'));var moment=require(_0x4a10('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a10('0x4'));var rimraf=require('rimraf');var config=require(_0x4a10('0x5'));var attributes=require(_0x4a10('0x6'));module['exports']=function(_0x16eb67,_0x299b04){return _0x16eb67[_0x4a10('0x7')](_0x4a10('0x8'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x45037a,_0x3d6780,_0x1562d4){if(_0x45037a[_0x4a10('0x9')]('closed')){_0x45037a[_0x4a10('0xa')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x1562d4(null,_0x45037a);}}});}; \ No newline at end of file +var _0xefa2=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed'];(function(_0x362ef9,_0x8b4a52){var _0x12d7de=function(_0x5f3c5d){while(--_0x5f3c5d){_0x362ef9['push'](_0x362ef9['shift']());}};_0x12d7de(++_0x8b4a52);}(_0xefa2,0x154));var _0x2efa=function(_0x4589a8,_0x187d4b){_0x4589a8=_0x4589a8-0x0;var _0x4f8dd9=_0xefa2[_0x4589a8];return _0x4f8dd9;};'use strict';var _=require(_0x2efa('0x0'));var util=require(_0x2efa('0x1'));var logger=require('../../config/logger')(_0x2efa('0x2'));var moment=require(_0x2efa('0x3'));var BPromise=require(_0x2efa('0x4'));var rp=require(_0x2efa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2efa('0x6'));module[_0x2efa('0x7')]=function(_0x288bfb,_0x49be13){return _0x288bfb[_0x2efa('0x8')](_0x2efa('0x9'),attributes,{'tableName':_0x2efa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xcbb94e,_0x3bf131,_0x4e178c){if(_0xcbb94e[_0x2efa('0xb')](_0x2efa('0xc'))){_0xcbb94e[_0x2efa('0xd')]=moment()[_0x2efa('0xe')](_0x2efa('0xf'));}_0x4e178c(null,_0xcbb94e);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index f3ecfc7..4da23ec 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 _0xd73d=['debug','stringify','error','code','message','result','SmsInteraction','update','options','raw','attributes','limit','then','UpdateSmsInteraction','catch','where','addTags','body','ids','omit','AddTags','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x345eac,_0x592d6f){var _0x459987=function(_0x4b4131){while(--_0x4b4131){_0x345eac['push'](_0x345eac['shift']());}};_0x459987(++_0x592d6f);}(_0xd73d,0x11f));var _0xdd73=function(_0x480455,_0x449bb4){_0x480455=_0x480455-0x0;var _0x9105e4=_0xd73d[_0x480455];return _0x9105e4;};'use strict';var _=require('lodash');var util=require(_0xdd73('0x0'));var moment=require('moment');var BPromise=require(_0xdd73('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd73('0x2'));var db=require(_0xdd73('0x3'))['db'];var utils=require(_0xdd73('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xdd73('0x5'));var jayson=require(_0xdd73('0x6'));var client=jayson[_0xdd73('0x7')][_0xdd73('0x8')]({'port':0x232a});config[_0xdd73('0x9')]=_[_0xdd73('0xa')](config['redis'],{'host':_0xdd73('0xb'),'port':0x18eb});var socket=require(_0xdd73('0xc'))(new Redis(config[_0xdd73('0x9')]));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x4d4c8e,_0x31d062,_0x27b615){return new BPromise(function(_0x31be19,_0x74fa69){return client[_0xdd73('0xd')](_0x4d4c8e,_0x27b615)['then'](function(_0x5747f1){logger[_0xdd73('0xe')](_0xdd73('0xf'),_0x31d062,_0xdd73('0x10'));logger[_0xdd73('0x11')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x31d062,_0xdd73('0x10'),JSON[_0xdd73('0x12')](_0x5747f1));if(_0x5747f1[_0xdd73('0x13')]){if(_0x5747f1['error'][_0xdd73('0x14')]===0x1f4){logger[_0xdd73('0x13')](_0xdd73('0xf'),_0x31d062,_0x5747f1[_0xdd73('0x13')]['message']);return _0x74fa69(_0x5747f1[_0xdd73('0x13')][_0xdd73('0x15')]);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x31d062,_0x5747f1[_0xdd73('0x13')][_0xdd73('0x15')]);return _0x31be19(_0x5747f1[_0xdd73('0x13')][_0xdd73('0x15')]);}else{logger[_0xdd73('0xe')]('SmsInteraction,\x20%s,\x20%s',_0x31d062,'request\x20sent');_0x31be19(_0x5747f1[_0xdd73('0x16')][_0xdd73('0x15')]);}})['catch'](function(_0x4217b1){logger[_0xdd73('0x13')](_0xdd73('0xf'),_0x31d062,_0x4217b1);_0x74fa69(_0x4217b1);});});}exports['UpdateSmsInteraction']=function(_0x58b68f){var _0x206b11=this;return new Promise(function(_0xd4f76f,_0x5e5ff2){return db[_0xdd73('0x17')][_0xdd73('0x18')](_0x58b68f['body'],{'raw':_0x58b68f['options']?_0x58b68f[_0xdd73('0x19')][_0xdd73('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58b68f[_0xdd73('0x19')]?_0x58b68f[_0xdd73('0x19')]['where']||null:null,'attributes':_0x58b68f[_0xdd73('0x19')]?_0x58b68f[_0xdd73('0x19')][_0xdd73('0x1b')]||null:null,'limit':_0x58b68f[_0xdd73('0x19')]?_0x58b68f[_0xdd73('0x19')][_0xdd73('0x1c')]||null:null})[_0xdd73('0x1d')](function(_0x2fd951){logger['info'](_0xdd73('0x1e'),_0x58b68f);logger[_0xdd73('0x11')](_0xdd73('0x1e'),_0x58b68f,JSON[_0xdd73('0x12')](_0x2fd951));_0xd4f76f(_0x2fd951);})[_0xdd73('0x1f')](function(_0x267b3c){logger['error'](_0xdd73('0x1e'),_0x267b3c['message'],_0x58b68f);_0x5e5ff2(_0x206b11[_0xdd73('0x13')](0x1f4,_0x267b3c[_0xdd73('0x15')]));});});};exports['AddTagsToSmsInteraction']=function(_0x2112f3){return new Promise(function(_0x3ae2a7,_0x6e41bc){return db[_0xdd73('0x17')]['find']({'where':_0x2112f3[_0xdd73('0x19')]?_0x2112f3[_0xdd73('0x19')][_0xdd73('0x20')]||null:null})[_0xdd73('0x1d')](function(_0x39d20a){if(_0x39d20a){return _0x39d20a[_0xdd73('0x21')](_0x2112f3[_0xdd73('0x22')][_0xdd73('0x23')],_[_0xdd73('0x24')](_0x2112f3[_0xdd73('0x22')],['ids','id'])||{});}})['spread'](function(_0x52c5d9){logger[_0xdd73('0xe')](_0xdd73('0x25'),_0x2112f3);logger[_0xdd73('0x11')]('AddTags',_0x2112f3,JSON[_0xdd73('0x12')](_0x52c5d9));_0x3ae2a7(_0x52c5d9);})[_0xdd73('0x1f')](function(_0x509703){logger[_0xdd73('0x13')](_0xdd73('0x25'),_0x509703[_0xdd73('0x15')],_0x2112f3);_0x6e41bc(_this[_0xdd73('0x13')](0x1f4,_0x509703[_0xdd73('0x15')]));});});}; \ No newline at end of file +var _0x9451=['debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','omit','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x3cb6dc,_0x120dd3){var _0x47ec89=function(_0x55150a){while(--_0x55150a){_0x3cb6dc['push'](_0x3cb6dc['shift']());}};_0x47ec89(++_0x120dd3);}(_0x9451,0x1cd));var _0x1945=function(_0x5aba6e,_0x3769bb){_0x5aba6e=_0x5aba6e-0x0;var _0x201933=_0x9451[_0x5aba6e];return _0x201933;};'use strict';var _=require(_0x1945('0x0'));var util=require(_0x1945('0x1'));var moment=require(_0x1945('0x2'));var BPromise=require(_0x1945('0x3'));var rs=require(_0x1945('0x4'));var fs=require('fs');var Redis=require(_0x1945('0x5'));var db=require(_0x1945('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1945('0x7'))(_0x1945('0x8'));var config=require(_0x1945('0x9'));var jayson=require(_0x1945('0xa'));var client=jayson[_0x1945('0xb')][_0x1945('0xc')]({'port':0x232a});config[_0x1945('0xd')]=_['defaults'](config[_0x1945('0xd')],{'host':_0x1945('0xe'),'port':0x18eb});var socket=require(_0x1945('0xf'))(new Redis(config['redis']));require(_0x1945('0x10'))[_0x1945('0x11')](socket);function respondWithRpcPromise(_0x3252e0,_0x525d87,_0x2fb3fd){return new BPromise(function(_0xc0cfdc,_0x4ad667){return client[_0x1945('0x12')](_0x3252e0,_0x2fb3fd)[_0x1945('0x13')](function(_0x5e3ceb){logger[_0x1945('0x14')](_0x1945('0x15'),_0x525d87,_0x1945('0x16'));logger[_0x1945('0x17')](_0x1945('0x18'),_0x525d87,'request\x20sent',JSON['stringify'](_0x5e3ceb));if(_0x5e3ceb['error']){if(_0x5e3ceb[_0x1945('0x19')][_0x1945('0x1a')]===0x1f4){logger[_0x1945('0x19')](_0x1945('0x15'),_0x525d87,_0x5e3ceb[_0x1945('0x19')][_0x1945('0x1b')]);return _0x4ad667(_0x5e3ceb[_0x1945('0x19')][_0x1945('0x1b')]);}logger[_0x1945('0x19')](_0x1945('0x15'),_0x525d87,_0x5e3ceb['error']['message']);return _0xc0cfdc(_0x5e3ceb['error'][_0x1945('0x1b')]);}else{logger['info'](_0x1945('0x15'),_0x525d87,'request\x20sent');_0xc0cfdc(_0x5e3ceb[_0x1945('0x1c')]['message']);}})[_0x1945('0x1d')](function(_0x30fc7c){logger[_0x1945('0x19')](_0x1945('0x15'),_0x525d87,_0x30fc7c);_0x4ad667(_0x30fc7c);});});}exports[_0x1945('0x1e')]=function(_0x502c30){var _0x28c320=this;return new Promise(function(_0x126310,_0xf0463d){return db[_0x1945('0x1f')]['update'](_0x502c30[_0x1945('0x20')],{'raw':_0x502c30[_0x1945('0x21')]?_0x502c30[_0x1945('0x21')][_0x1945('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x502c30[_0x1945('0x21')]?_0x502c30[_0x1945('0x21')][_0x1945('0x23')]||null:null,'attributes':_0x502c30[_0x1945('0x21')]?_0x502c30[_0x1945('0x21')][_0x1945('0x24')]||null:null,'limit':_0x502c30[_0x1945('0x21')]?_0x502c30[_0x1945('0x21')][_0x1945('0x25')]||null:null})[_0x1945('0x13')](function(_0x549f95){logger[_0x1945('0x14')]('UpdateSmsInteraction',_0x502c30);logger[_0x1945('0x17')](_0x1945('0x1e'),_0x502c30,JSON['stringify'](_0x549f95));_0x126310(_0x549f95);})[_0x1945('0x1d')](function(_0x49a870){logger[_0x1945('0x19')](_0x1945('0x1e'),_0x49a870[_0x1945('0x1b')],_0x502c30);_0xf0463d(_0x28c320[_0x1945('0x19')](0x1f4,_0x49a870[_0x1945('0x1b')]));});});};exports[_0x1945('0x26')]=function(_0x4d2723){return new Promise(function(_0x3e038c,_0x1b3fa6){return db[_0x1945('0x1f')][_0x1945('0x27')]({'where':_0x4d2723[_0x1945('0x21')]?_0x4d2723['options']['where']||null:null})['then'](function(_0x5e8dc2){if(_0x5e8dc2){return _0x5e8dc2[_0x1945('0x28')](_0x4d2723['body']['ids'],_[_0x1945('0x29')](_0x4d2723['body'],[_0x1945('0x2a'),'id'])||{});}})['spread'](function(_0x500ee5){logger['info'](_0x1945('0x2b'),_0x4d2723);logger['debug']('AddTags',_0x4d2723,JSON['stringify'](_0x500ee5));_0x3e038c(_0x500ee5);})[_0x1945('0x1d')](function(_0x29d90f){logger[_0x1945('0x19')](_0x1945('0x2b'),_0x29d90f[_0x1945('0x1b')],_0x4d2723);_0x1b3fa6(_this[_0x1945('0x19')](0x1f4,_0x29d90f[_0x1945('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 4ef3fa8..d7473de 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 _0xbaf0=['removeListener','register','length','smsInteraction:','save','remove','update'];(function(_0x15e3d3,_0x37f411){var _0x75db84=function(_0x6ea523){while(--_0x6ea523){_0x15e3d3['push'](_0x15e3d3['shift']());}};_0x75db84(++_0x37f411);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){SmsInteractionEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);SmsInteractionEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file +var _0xbaf0=['removeListener','register','length','smsInteraction:','save','remove','update'];(function(_0x371d7a,_0x499c1e){var _0x4d4024=function(_0x20d867){while(--_0x20d867){_0x371d7a['push'](_0x371d7a['shift']());}};_0x4d4024(++_0x499c1e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){SmsInteractionEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);SmsInteractionEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index b5b732e..70c4a3e 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 _0x25d2=['/:id/status','status','put','update','/:id/accept','accept','reject','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','index','isAuthenticated','describe','/:id','show','post','tracked','create'];(function(_0x50d1fe,_0x5deba7){var _0x4f0e4b=function(_0x35db3e){while(--_0x35db3e){_0x50d1fe['push'](_0x50d1fe['shift']());}};_0x4f0e4b(++_0x5deba7);}(_0x25d2,0x198));var _0x225d=function(_0x30fb1f,_0x3a5abf){_0x30fb1f=_0x30fb1f-0x0;var _0xd03d0=_0x25d2[_0x30fb1f];return _0xd03d0;};'use strict';var multer=require(_0x225d('0x0'));var util=require('util');var path=require(_0x225d('0x1'));var timeout=require(_0x225d('0x2'));var express=require(_0x225d('0x3'));var router=express['Router']();var fs_extra=require(_0x225d('0x4'));var auth=require(_0x225d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x225d('0x6'));var controller=require(_0x225d('0x7'));router[_0x225d('0x8')]('/',auth['isAuthenticated'](),controller[_0x225d('0x9')]);router[_0x225d('0x8')]('/describe',auth[_0x225d('0xa')](),controller[_0x225d('0xb')]);router['get'](_0x225d('0xc'),auth[_0x225d('0xa')](),controller[_0x225d('0xd')]);router[_0x225d('0xe')]('/',auth[_0x225d('0xa')](),interaction[_0x225d('0xf')]('sms','smsmessage:create'),controller[_0x225d('0x10')]);router[_0x225d('0xe')](_0x225d('0x11'),controller[_0x225d('0x12')]);router[_0x225d('0x13')]('/:id',auth[_0x225d('0xa')](),controller[_0x225d('0x14')]);router[_0x225d('0x13')](_0x225d('0x15'),auth[_0x225d('0xa')](),controller[_0x225d('0x16')]);router['put']('/:id/reject',auth[_0x225d('0xa')](),controller[_0x225d('0x17')]);router['delete']('/:id',auth[_0x225d('0xa')](),controller['destroy']);module[_0x225d('0x18')]=router; \ No newline at end of file +var _0x20c8=['update','accept','reject','delete','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','sms','create','post','/:id/status','status','put'];(function(_0x191918,_0x637515){var _0x431776=function(_0x21e250){while(--_0x21e250){_0x191918['push'](_0x191918['shift']());}};_0x431776(++_0x637515);}(_0x20c8,0x13d));var _0x820c=function(_0x2e2b6f,_0xeb0ef4){_0x2e2b6f=_0x2e2b6f-0x0;var _0x5e4be4=_0x20c8[_0x2e2b6f];return _0x5e4be4;};'use strict';var multer=require(_0x820c('0x0'));var util=require(_0x820c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x820c('0x2')]();var fs_extra=require(_0x820c('0x3'));var auth=require(_0x820c('0x4'));var interaction=require(_0x820c('0x5'));var config=require(_0x820c('0x6'));var controller=require(_0x820c('0x7'));router[_0x820c('0x8')]('/',auth[_0x820c('0x9')](),controller[_0x820c('0xa')]);router[_0x820c('0x8')](_0x820c('0xb'),auth['isAuthenticated'](),controller[_0x820c('0xc')]);router['get'](_0x820c('0xd'),auth[_0x820c('0x9')](),controller[_0x820c('0xe')]);router['post']('/',auth[_0x820c('0x9')](),interaction['tracked'](_0x820c('0xf'),'smsmessage:create'),controller[_0x820c('0x10')]);router[_0x820c('0x11')](_0x820c('0x12'),controller[_0x820c('0x13')]);router[_0x820c('0x14')](_0x820c('0xd'),auth[_0x820c('0x9')](),controller[_0x820c('0x15')]);router[_0x820c('0x14')]('/:id/accept',auth[_0x820c('0x9')](),controller[_0x820c('0x16')]);router[_0x820c('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0x820c('0x17')]);router[_0x820c('0x18')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x820c('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 4fb7c8f..2e70fde 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 _0x5a9e=['out','STRING','exports','TEXT','BOOLEAN'];(function(_0x5e0c1a,_0x396ed7){var _0x26ec6b=function(_0x4fecf2){while(--_0x4fecf2){_0x5e0c1a['push'](_0x5e0c1a['shift']());}};_0x26ec6b(++_0x396ed7);}(_0x5a9e,0x165));var _0xe5a9=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x5a9e[_0xe73080];return _0x12cbc4;};'use strict';var Sequelize=require('sequelize');module[_0xe5a9('0x0')]={'body':{'type':Sequelize[_0xe5a9('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe5a9('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe5a9('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xe5a9('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe5a9('0x4')]},'providerResponse':{'type':Sequelize[_0xe5a9('0x1')]}}; \ No newline at end of file +var _0xe89e=['STRING','DATE','TEXT','BOOLEAN','ENUM','out'];(function(_0x183682,_0x5caf5c){var _0x2258ba=function(_0x259cfc){while(--_0x259cfc){_0x183682['push'](_0x183682['shift']());}};_0x2258ba(++_0x5caf5c);}(_0xe89e,0xec));var _0xee89=function(_0x2e028c,_0x3ad050){_0x2e028c=_0x2e028c-0x0;var _0x218636=_0xe89e[_0x2e028c];return _0x218636;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xee89('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xee89('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xee89('0x2')]('in','out'),'defaultValue':_0xee89('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xee89('0x4')](0xbe)},'phone':{'type':Sequelize[_0xee89('0x4')]},'readAt':{'type':Sequelize[_0xee89('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xee89('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index a9160b3..207eed3 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 _0xdf17=['status','end','offset','undefined','count','limit','set','json','reject','update','destroy','stack','name','send','map','SmsMessage','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','show','rawAttributes','find','create','body','params','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','CmContact','startsWith','cf_','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','push','rejectmessage','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','MessageUUID','sent','delivered','Status','plivio','results','groupName','DELIVERED','infobip','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus'];(function(_0x16b14e,_0x320ba7){var _0x284c23=function(_0x1d5162){while(--_0x1d5162){_0x16b14e['push'](_0x16b14e['shift']());}};_0x284c23(++_0x320ba7);}(_0xdf17,0x66));var _0x7df1=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xdf17[_0x3b5250];return _0xc844a1;};'use strict';var emlformat=require(_0x7df1('0x0'));var rimraf=require(_0x7df1('0x1'));var zipdir=require(_0x7df1('0x2'));var jsonpatch=require(_0x7df1('0x3'));var rp=require(_0x7df1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7df1('0x5'));var util=require('util');var path=require(_0x7df1('0x6'));var sox=require(_0x7df1('0x7'));var csv=require(_0x7df1('0x8'));var ejs=require(_0x7df1('0x9'));var fs=require('fs');var fs_extra=require(_0x7df1('0xa'));var _=require('lodash');var squel=require(_0x7df1('0xb'));var crypto=require(_0x7df1('0xc'));var jsforce=require(_0x7df1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7df1('0xe'));var Papa=require(_0x7df1('0xf'));var Redis=require('ioredis');var authService=require(_0x7df1('0x10'));var qs=require(_0x7df1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7df1('0x12'));var logger=require(_0x7df1('0x13'))(_0x7df1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7df1('0x15'));var db=require(_0x7df1('0x16'))['db'];config[_0x7df1('0x17')]=_[_0x7df1('0x18')](config[_0x7df1('0x17')],{'host':_0x7df1('0x19'),'port':0x18eb});var socket=require(_0x7df1('0x1a'))(new Redis(config[_0x7df1('0x17')]));require(_0x7df1('0x1b'))[_0x7df1('0x1c')](socket);var jayson=require(_0x7df1('0x1d'));var client=jayson[_0x7df1('0x1e')][_0x7df1('0x1f')]({'port':0x232c});var client9002=jayson[_0x7df1('0x1e')][_0x7df1('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x504836,_0x1fa0d9,_0x3f0912,_0x2599c9){return new BPromise(function(_0x39e4ee,_0x55b30e){var _0x3c4c1f=_0x2599c9||client;return _0x3c4c1f[_0x7df1('0x20')](_0x504836,_0x3f0912)[_0x7df1('0x21')](function(_0x1bcf78){logger[_0x7df1('0x22')](_0x7df1('0x23'),_0x1fa0d9,_0x7df1('0x24'));logger[_0x7df1('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1fa0d9,_0x7df1('0x24'),JSON[_0x7df1('0x26')](_0x1bcf78));if(_0x1bcf78[_0x7df1('0x27')]){if(_0x1bcf78['error'][_0x7df1('0x28')]===0x1f4){logger[_0x7df1('0x27')]('SmsMessage,\x20%s,\x20%s',_0x1fa0d9,_0x1bcf78[_0x7df1('0x27')][_0x7df1('0x29')]);return _0x55b30e(_0x1bcf78[_0x7df1('0x27')][_0x7df1('0x29')]);}logger[_0x7df1('0x27')](_0x7df1('0x23'),_0x1fa0d9,_0x1bcf78[_0x7df1('0x27')]['message']);return _0x39e4ee(_0x1bcf78[_0x7df1('0x27')][_0x7df1('0x29')]);}else{logger[_0x7df1('0x22')](_0x7df1('0x23'),_0x1fa0d9,_0x7df1('0x24'));_0x39e4ee(_0x1bcf78[_0x7df1('0x2a')][_0x7df1('0x29')]);}})[_0x7df1('0x2b')](function(_0x534c7f){logger['error']('SmsMessage,\x20%s,\x20%s',_0x1fa0d9,_0x534c7f);_0x55b30e(_0x534c7f);});});}function respondWithStatusCode(_0x82f53a,_0x2a9492){_0x2a9492=_0x2a9492||0xcc;return function(_0x1d4b74){if(_0x1d4b74){return _0x82f53a[_0x7df1('0x2c')](_0x2a9492);}return _0x82f53a[_0x7df1('0x2d')](_0x2a9492)[_0x7df1('0x2e')]();};}function respondWithResult(_0x3f734b,_0x137d7d){_0x137d7d=_0x137d7d||0xc8;return function(_0x20f838){if(_0x20f838){return _0x3f734b[_0x7df1('0x2d')](_0x137d7d)['json'](_0x20f838);}};}function respondWithFilteredResult(_0x49e27b,_0x2a4c49){return function(_0x1e68ec){if(_0x1e68ec){var _0x1c8ec3=typeof _0x2a4c49[_0x7df1('0x2f')]===_0x7df1('0x30')&&typeof _0x2a4c49['limit']===_0x7df1('0x30');var _0x1990d1=_0x1e68ec['count'];var _0xd4174=_0x1c8ec3?0x0:_0x2a4c49[_0x7df1('0x2f')];var _0xea8748=_0x1c8ec3?_0x1e68ec[_0x7df1('0x31')]:_0x2a4c49[_0x7df1('0x2f')]+_0x2a4c49[_0x7df1('0x32')];var _0x224c36;if(_0xea8748>=_0x1990d1){_0xea8748=_0x1990d1;_0x224c36=0xc8;}else{_0x224c36=0xce;}_0x49e27b[_0x7df1('0x2d')](_0x224c36);return _0x49e27b[_0x7df1('0x33')]('Content-Range',_0xd4174+'-'+_0xea8748+'/'+_0x1990d1)[_0x7df1('0x34')](_0x1e68ec);}return null;};}function patchUpdates(_0xa31838){return function(_0x3ae382){try{jsonpatch['apply'](_0x3ae382,_0xa31838,!![]);}catch(_0x1cff5b){return BPromise[_0x7df1('0x35')](_0x1cff5b);}return _0x3ae382['save']();};}function saveUpdates(_0x5cb452,_0x56c36d){return function(_0x1f02e1){if(_0x1f02e1){return _0x1f02e1[_0x7df1('0x36')](_0x5cb452)[_0x7df1('0x21')](function(_0x5de6ae){return _0x5de6ae;});}return null;};}function removeEntity(_0x5c8dd7,_0x3b248f){return function(_0x5025ff){if(_0x5025ff){return _0x5025ff[_0x7df1('0x37')]()[_0x7df1('0x21')](function(){_0x5c8dd7['status'](0xcc)[_0x7df1('0x2e')]();});}};}function handleEntityNotFound(_0xd31888,_0x641ea2){return function(_0x55bc4d){if(!_0x55bc4d){_0xd31888[_0x7df1('0x2c')](0x194);}return _0x55bc4d;};}function handleError(_0xb3e321,_0x33246a){_0x33246a=_0x33246a||0x1f4;return function(_0x1635e2){logger[_0x7df1('0x27')](_0x1635e2[_0x7df1('0x38')]);if(_0x1635e2['name']){delete _0x1635e2[_0x7df1('0x39')];}_0xb3e321['status'](_0x33246a)[_0x7df1('0x3a')](_0x1635e2);};}exports['index']=function(_0x1975bc,_0xd76112){var _0x299866={},_0x371631={},_0x303693={'count':0x0,'rows':[]};var _0x1b2350=_[_0x7df1('0x3b')](db[_0x7df1('0x3c')]['rawAttributes'],function(_0x3e5894){return{'name':_0x3e5894['fieldName'],'type':_0x3e5894[_0x7df1('0x3d')][_0x7df1('0x3e')]};});_0x371631[_0x7df1('0x3f')]=_[_0x7df1('0x3b')](_0x1b2350,_0x7df1('0x39'));_0x371631[_0x7df1('0x40')]=_[_0x7df1('0x41')](_0x1975bc[_0x7df1('0x40')]);_0x371631[_0x7df1('0x42')]=_[_0x7df1('0x43')](_0x371631[_0x7df1('0x3f')],_0x371631[_0x7df1('0x40')]);_0x299866[_0x7df1('0x44')]=_[_0x7df1('0x43')](_0x371631['model'],qs[_0x7df1('0x45')](_0x1975bc['query']['fields']));_0x299866[_0x7df1('0x44')]=_0x299866[_0x7df1('0x44')][_0x7df1('0x46')]?_0x299866['attributes']:_0x371631[_0x7df1('0x3f')];if(!_0x1975bc['query']['hasOwnProperty'](_0x7df1('0x47'))){_0x299866['limit']=qs[_0x7df1('0x32')](_0x1975bc['query'][_0x7df1('0x32')]);_0x299866[_0x7df1('0x2f')]=qs['offset'](_0x1975bc['query']['offset']);}_0x299866[_0x7df1('0x48')]=qs[_0x7df1('0x49')](_0x1975bc[_0x7df1('0x40')][_0x7df1('0x49')]);_0x299866[_0x7df1('0x4a')]=qs['filters'](_[_0x7df1('0x4b')](_0x1975bc[_0x7df1('0x40')],_0x371631[_0x7df1('0x42')]),_0x1b2350);if(_0x1975bc[_0x7df1('0x40')][_0x7df1('0x4c')]){_0x299866[_0x7df1('0x4a')]=_['merge'](_0x299866[_0x7df1('0x4a')],{'$or':_[_0x7df1('0x3b')](_0x1b2350,function(_0xec4511){if(_0xec4511['type']!==_0x7df1('0x4d')){var _0x170767={};_0x170767[_0xec4511['name']]={'$like':'%'+_0x1975bc[_0x7df1('0x40')]['filter']+'%'};return _0x170767;}})});}_0x299866=_[_0x7df1('0x4e')]({},_0x299866,_0x1975bc[_0x7df1('0x4f')]);var _0x4ecaac={'where':_0x299866[_0x7df1('0x4a')]};return db['SmsMessage'][_0x7df1('0x31')](_0x4ecaac)[_0x7df1('0x21')](function(_0x5c5ee1){_0x303693[_0x7df1('0x31')]=_0x5c5ee1;if(_0x1975bc[_0x7df1('0x40')][_0x7df1('0x50')]){_0x299866[_0x7df1('0x51')]=[{'all':!![]}];}return db[_0x7df1('0x3c')]['findAll'](_0x299866);})['then'](function(_0x40328d){_0x303693[_0x7df1('0x52')]=_0x40328d;return _0x303693;})[_0x7df1('0x21')](respondWithFilteredResult(_0xd76112,_0x299866))[_0x7df1('0x2b')](handleError(_0xd76112,null));};exports[_0x7df1('0x53')]=function(_0x4e56c7,_0x4a4e99){var _0x562b12={'raw':!![],'where':{'id':_0x4e56c7['params']['id']}},_0x1faeb7={};_0x1faeb7[_0x7df1('0x3f')]=_[_0x7df1('0x41')](db[_0x7df1('0x3c')][_0x7df1('0x54')]);_0x1faeb7['query']=_[_0x7df1('0x41')](_0x4e56c7[_0x7df1('0x40')]);_0x1faeb7[_0x7df1('0x42')]=_[_0x7df1('0x43')](_0x1faeb7['model'],_0x1faeb7[_0x7df1('0x40')]);_0x562b12[_0x7df1('0x44')]=_[_0x7df1('0x43')](_0x1faeb7['model'],qs[_0x7df1('0x45')](_0x4e56c7[_0x7df1('0x40')][_0x7df1('0x45')]));_0x562b12[_0x7df1('0x44')]=_0x562b12[_0x7df1('0x44')][_0x7df1('0x46')]?_0x562b12['attributes']:_0x1faeb7[_0x7df1('0x3f')];if(_0x4e56c7[_0x7df1('0x40')][_0x7df1('0x50')]){_0x562b12['include']=[{'all':!![]}];}_0x562b12=_['merge']({},_0x562b12,_0x4e56c7[_0x7df1('0x4f')]);return db[_0x7df1('0x3c')][_0x7df1('0x55')](_0x562b12)[_0x7df1('0x21')](handleEntityNotFound(_0x4a4e99,null))[_0x7df1('0x21')](respondWithResult(_0x4a4e99,null))[_0x7df1('0x2b')](handleError(_0x4a4e99,null));};exports[_0x7df1('0x56')]=function(_0x3e11a6,_0x524457){return db[_0x7df1('0x3c')]['create'](_0x3e11a6[_0x7df1('0x57')],{})[_0x7df1('0x21')](respondWithResult(_0x524457,0xc9))[_0x7df1('0x2b')](handleError(_0x524457,null));};exports[_0x7df1('0x36')]=function(_0x1c0467,_0x205324){if(_0x1c0467[_0x7df1('0x57')]['id']){delete _0x1c0467['body']['id'];}return db[_0x7df1('0x3c')][_0x7df1('0x55')]({'where':{'id':_0x1c0467[_0x7df1('0x58')]['id']}})[_0x7df1('0x21')](handleEntityNotFound(_0x205324,null))['then'](saveUpdates(_0x1c0467[_0x7df1('0x57')],null))[_0x7df1('0x21')](respondWithResult(_0x205324,null))['catch'](handleError(_0x205324,null));};exports[_0x7df1('0x37')]=function(_0x47dfe5,_0x536ce5){return db['SmsMessage']['find']({'where':{'id':_0x47dfe5[_0x7df1('0x58')]['id']}})[_0x7df1('0x21')](handleEntityNotFound(_0x536ce5,null))[_0x7df1('0x21')](removeEntity(_0x536ce5,null))[_0x7df1('0x2b')](handleError(_0x536ce5,null));};exports[_0x7df1('0x59')]=function(_0x1e28a3,_0x47fc38){return db[_0x7df1('0x3c')][_0x7df1('0x59')]()[_0x7df1('0x21')](respondWithResult(_0x47fc38,null))[_0x7df1('0x2b')](handleError(_0x47fc38,null));};var interaction_log=require('../../config/logger')(_0x7df1('0x5a'));exports[_0x7df1('0x5b')]=function(_0x596a78,_0x2717ce,_0x5eaa0a){var _0x4ca1f6={'agent':{},'channel':_0x7df1('0x5c')};if(_0x596a78[_0x7df1('0x57')]['id']){delete _0x596a78[_0x7df1('0x57')]['id'];}_0x596a78[_0x7df1('0x57')][_0x7df1('0x5d')]=!![];_0x596a78['body'][_0x7df1('0x5e')]=moment()[_0x7df1('0x5f')](_0x7df1('0x60'));_0x596a78['body']['UserId']=_0x596a78[_0x7df1('0x57')][_0x7df1('0x61')]||_0x596a78[_0x7df1('0x62')]['id'];_0x4ca1f6['agent']['id']=_0x596a78[_0x7df1('0x57')][_0x7df1('0x61')];return db['SmsMessage'][_0x7df1('0x55')]({'where':{'id':_0x596a78[_0x7df1('0x58')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x7df1('0x63')}]})[_0x7df1('0x21')](handleEntityNotFound(_0x2717ce,null))[_0x7df1('0x21')](saveUpdates(_0x596a78['body'],null))[_0x7df1('0x21')](function(_0x51bca2){if(_0x51bca2){_0x4ca1f6[_0x7df1('0x29')]=_0x51bca2[_0x7df1('0x64')]({'plain':!![]});return db['SmsInteraction'][_0x7df1('0x55')]({'where':{'id':_0x51bca2[_0x7df1('0x65')]}});}return null;})[_0x7df1('0x21')](handleEntityNotFound(_0x2717ce,null))['then'](function(_0x31118d){if(_0x31118d){return _0x31118d[_0x7df1('0x36')]({'UserId':_0x596a78[_0x7df1('0x57')][_0x7df1('0x61')],'read1stAt':_[_0x7df1('0x66')](_0x31118d[_0x7df1('0x67')])?moment()[_0x7df1('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x7df1('0x21')](function(_0x15a1ce){if(_0x15a1ce){_0x4ca1f6[_0x7df1('0x68')]=_0x15a1ce['get']({'plain':!![]});interaction_log[_0x7df1('0x22')](_0x7df1('0x69'),_0x596a78['user']['id'],_0x596a78[_0x7df1('0x62')][_0x7df1('0x39')],_0x596a78[_0x7df1('0x62')][_0x7df1('0x6a')],_0x4ca1f6[_0x7df1('0x68')]['id'],_0x596a78[_0x7df1('0x57')]?JSON['stringify'](_0x596a78['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x7df1('0x6b'),_0x4ca1f6);}return null;})[_0x7df1('0x21')](function(_0xefb708){return db[_0x7df1('0x6c')]['describe']()[_0x7df1('0x21')](function(_0x4cb4f2){var _0x57add3=[];for(var _0x3fceaf=0x0;_0x3fceaf=0x0){return _0x4a8ff8[_0x7df1('0x36')]({'read':!![]});}else{logger[_0x7df1('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7df1('0x2d'),_0x7df1('0x8e'),util[_0x7df1('0x89')](_0x381efe[_0x7df1('0x57')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1f06c0=_0x381efe[_0x7df1('0x57')][_0x7df1('0x8f')][0x0];if(_0x1f06c0['status'][_0x7df1('0x90')]===_0x7df1('0x91')){return _0x4a8ff8[_0x7df1('0x36')]({'read':!![]});}else{logger[_0x7df1('0x27')](_0x7df1('0x88'),'status',_0x7df1('0x92'),util[_0x7df1('0x89')](_0x381efe[_0x7df1('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x4a8ff8;}})[_0x7df1('0x21')](respondWithResult(_0x5c9c6c,null))[_0x7df1('0x2b')](handleError(_0x5c9c6c,null));}; \ No newline at end of file +var _0x29d3=['body','update','find','params','describe','accept','sms','read','readAt','format','UserId','user','agent','SmsInteraction','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','get','role','AcceptMessage','acceptMessage','startsWith','cf_','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','SIP/%s','channel','event','EventManager','acceptmessage','sms-interactions','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','CmContact','push','SELECT','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','delivered','plivio','infobip','results','groupName','DELIVERED','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','set','reject','save','destroy','stack','send','index','SmsMessage','rawAttributes','fieldName','map','name','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create'];(function(_0x4be5df,_0x4834da){var _0x4006bc=function(_0x48e082){while(--_0x48e082){_0x4be5df['push'](_0x4be5df['shift']());}};_0x4006bc(++_0x4834da);}(_0x29d3,0x163));var _0x329d=function(_0x34b4d5,_0x55e994){_0x34b4d5=_0x34b4d5-0x0;var _0x483f5d=_0x29d3[_0x34b4d5];return _0x483f5d;};'use strict';var emlformat=require(_0x329d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x329d('0x1'));var rp=require(_0x329d('0x2'));var moment=require(_0x329d('0x3'));var BPromise=require(_0x329d('0x4'));var Mustache=require(_0x329d('0x5'));var util=require('util');var path=require(_0x329d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x329d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x329d('0x8'));var jsforce=require(_0x329d('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x329d('0xa'));var querystring=require(_0x329d('0xb'));var Papa=require(_0x329d('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x329d('0xd'));var hardwareService=require(_0x329d('0xe'));var logger=require(_0x329d('0xf'))(_0x329d('0x10'));var utils=require(_0x329d('0x11'));var config=require(_0x329d('0x12'));var licenseUtil=require(_0x329d('0x13'));var db=require(_0x329d('0x14'))['db'];config[_0x329d('0x15')]=_[_0x329d('0x16')](config['redis'],{'host':_0x329d('0x17'),'port':0x18eb});var socket=require(_0x329d('0x18'))(new Redis(config[_0x329d('0x15')]));require(_0x329d('0x19'))[_0x329d('0x1a')](socket);var jayson=require(_0x329d('0x1b'));var client=jayson[_0x329d('0x1c')][_0x329d('0x1d')]({'port':0x232c});var client9002=jayson[_0x329d('0x1c')][_0x329d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5bdaf2,_0x3f169f,_0x50c4ec,_0x48e039){return new BPromise(function(_0x269e85,_0x267cbf){var _0x44e1ef=_0x48e039||client;return _0x44e1ef[_0x329d('0x1e')](_0x5bdaf2,_0x50c4ec)[_0x329d('0x1f')](function(_0x58c351){logger[_0x329d('0x20')](_0x329d('0x21'),_0x3f169f,_0x329d('0x22'));logger[_0x329d('0x23')](_0x329d('0x24'),_0x3f169f,_0x329d('0x22'),JSON['stringify'](_0x58c351));if(_0x58c351[_0x329d('0x25')]){if(_0x58c351[_0x329d('0x25')][_0x329d('0x26')]===0x1f4){logger['error'](_0x329d('0x21'),_0x3f169f,_0x58c351['error'][_0x329d('0x27')]);return _0x267cbf(_0x58c351['error'][_0x329d('0x27')]);}logger[_0x329d('0x25')]('SmsMessage,\x20%s,\x20%s',_0x3f169f,_0x58c351[_0x329d('0x25')]['message']);return _0x269e85(_0x58c351[_0x329d('0x25')][_0x329d('0x27')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x3f169f,_0x329d('0x22'));_0x269e85(_0x58c351[_0x329d('0x28')][_0x329d('0x27')]);}})['catch'](function(_0x1ad9d3){logger['error'](_0x329d('0x21'),_0x3f169f,_0x1ad9d3);_0x267cbf(_0x1ad9d3);});});}function respondWithStatusCode(_0x487eb8,_0x1a6878){_0x1a6878=_0x1a6878||0xcc;return function(_0x2b83bf){if(_0x2b83bf){return _0x487eb8[_0x329d('0x29')](_0x1a6878);}return _0x487eb8[_0x329d('0x2a')](_0x1a6878)[_0x329d('0x2b')]();};}function respondWithResult(_0x5e8412,_0x3a8e5b){_0x3a8e5b=_0x3a8e5b||0xc8;return function(_0x1555b0){if(_0x1555b0){return _0x5e8412[_0x329d('0x2a')](_0x3a8e5b)['json'](_0x1555b0);}};}function respondWithFilteredResult(_0x58868b,_0xac4482){return function(_0xc39a96){if(_0xc39a96){var _0x44e429=typeof _0xac4482[_0x329d('0x2c')]===_0x329d('0x2d')&&typeof _0xac4482[_0x329d('0x2e')]==='undefined';var _0xfb0801=_0xc39a96[_0x329d('0x2f')];var _0x457ee7=_0x44e429?0x0:_0xac4482[_0x329d('0x2c')];var _0x16fb91=_0x44e429?_0xc39a96[_0x329d('0x2f')]:_0xac4482[_0x329d('0x2c')]+_0xac4482[_0x329d('0x2e')];var _0x200fe1;if(_0x16fb91>=_0xfb0801){_0x16fb91=_0xfb0801;_0x200fe1=0xc8;}else{_0x200fe1=0xce;}_0x58868b['status'](_0x200fe1);return _0x58868b[_0x329d('0x30')]('Content-Range',_0x457ee7+'-'+_0x16fb91+'/'+_0xfb0801)['json'](_0xc39a96);}return null;};}function patchUpdates(_0x53ed64){return function(_0xa0a461){try{jsonpatch['apply'](_0xa0a461,_0x53ed64,!![]);}catch(_0x20f36c){return BPromise[_0x329d('0x31')](_0x20f36c);}return _0xa0a461[_0x329d('0x32')]();};}function saveUpdates(_0x299e7a,_0x22b22f){return function(_0x4bf62d){if(_0x4bf62d){return _0x4bf62d['update'](_0x299e7a)[_0x329d('0x1f')](function(_0x5070a2){return _0x5070a2;});}return null;};}function removeEntity(_0x52cf4e,_0x4ee6e5){return function(_0x3fe26b){if(_0x3fe26b){return _0x3fe26b[_0x329d('0x33')]()[_0x329d('0x1f')](function(){_0x52cf4e[_0x329d('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b503,_0x7da73c){return function(_0x1baa64){if(!_0x1baa64){_0x16b503['sendStatus'](0x194);}return _0x1baa64;};}function handleError(_0x1fec94,_0x2d7d17){_0x2d7d17=_0x2d7d17||0x1f4;return function(_0x5a109b){logger[_0x329d('0x25')](_0x5a109b[_0x329d('0x34')]);if(_0x5a109b['name']){delete _0x5a109b['name'];}_0x1fec94['status'](_0x2d7d17)[_0x329d('0x35')](_0x5a109b);};}exports[_0x329d('0x36')]=function(_0xa4fa99,_0x4b7daa){var _0x46aa4f={},_0x3c6d86={},_0x5841b3={'count':0x0,'rows':[]};var _0x315e8f=_['map'](db[_0x329d('0x37')][_0x329d('0x38')],function(_0x51b25){return{'name':_0x51b25[_0x329d('0x39')],'type':_0x51b25['type']['key']};});_0x3c6d86['model']=_[_0x329d('0x3a')](_0x315e8f,_0x329d('0x3b'));_0x3c6d86['query']=_[_0x329d('0x3c')](_0xa4fa99[_0x329d('0x3d')]);_0x3c6d86['filters']=_[_0x329d('0x3e')](_0x3c6d86[_0x329d('0x3f')],_0x3c6d86['query']);_0x46aa4f[_0x329d('0x40')]=_[_0x329d('0x3e')](_0x3c6d86[_0x329d('0x3f')],qs[_0x329d('0x41')](_0xa4fa99[_0x329d('0x3d')][_0x329d('0x41')]));_0x46aa4f[_0x329d('0x40')]=_0x46aa4f[_0x329d('0x40')][_0x329d('0x42')]?_0x46aa4f['attributes']:_0x3c6d86['model'];if(!_0xa4fa99['query'][_0x329d('0x43')](_0x329d('0x44'))){_0x46aa4f['limit']=qs['limit'](_0xa4fa99[_0x329d('0x3d')][_0x329d('0x2e')]);_0x46aa4f[_0x329d('0x2c')]=qs['offset'](_0xa4fa99['query']['offset']);}_0x46aa4f[_0x329d('0x45')]=qs[_0x329d('0x46')](_0xa4fa99['query']['sort']);_0x46aa4f['where']=qs['filters'](_[_0x329d('0x47')](_0xa4fa99['query'],_0x3c6d86[_0x329d('0x48')]),_0x315e8f);if(_0xa4fa99[_0x329d('0x3d')][_0x329d('0x49')]){_0x46aa4f[_0x329d('0x4a')]=_[_0x329d('0x4b')](_0x46aa4f[_0x329d('0x4a')],{'$or':_['map'](_0x315e8f,function(_0x5a792e){if(_0x5a792e[_0x329d('0x4c')]!==_0x329d('0x4d')){var _0x6722dc={};_0x6722dc[_0x5a792e[_0x329d('0x3b')]]={'$like':'%'+_0xa4fa99['query'][_0x329d('0x49')]+'%'};return _0x6722dc;}})});}_0x46aa4f=_[_0x329d('0x4b')]({},_0x46aa4f,_0xa4fa99[_0x329d('0x4e')]);var _0x2b2141={'where':_0x46aa4f[_0x329d('0x4a')]};return db['SmsMessage'][_0x329d('0x2f')](_0x2b2141)[_0x329d('0x1f')](function(_0x54e7e1){_0x5841b3[_0x329d('0x2f')]=_0x54e7e1;if(_0xa4fa99['query'][_0x329d('0x4f')]){_0x46aa4f[_0x329d('0x50')]=[{'all':!![]}];}return db['SmsMessage'][_0x329d('0x51')](_0x46aa4f);})['then'](function(_0x4b2770){_0x5841b3[_0x329d('0x52')]=_0x4b2770;return _0x5841b3;})[_0x329d('0x1f')](respondWithFilteredResult(_0x4b7daa,_0x46aa4f))[_0x329d('0x53')](handleError(_0x4b7daa,null));};exports[_0x329d('0x54')]=function(_0x4da48c,_0x526a98){var _0x33f286={'raw':!![],'where':{'id':_0x4da48c['params']['id']}},_0xed0ac5={};_0xed0ac5['model']=_[_0x329d('0x3c')](db['SmsMessage'][_0x329d('0x38')]);_0xed0ac5[_0x329d('0x3d')]=_['keys'](_0x4da48c[_0x329d('0x3d')]);_0xed0ac5[_0x329d('0x48')]=_['intersection'](_0xed0ac5[_0x329d('0x3f')],_0xed0ac5[_0x329d('0x3d')]);_0x33f286[_0x329d('0x40')]=_[_0x329d('0x3e')](_0xed0ac5[_0x329d('0x3f')],qs[_0x329d('0x41')](_0x4da48c[_0x329d('0x3d')][_0x329d('0x41')]));_0x33f286[_0x329d('0x40')]=_0x33f286[_0x329d('0x40')][_0x329d('0x42')]?_0x33f286[_0x329d('0x40')]:_0xed0ac5['model'];if(_0x4da48c[_0x329d('0x3d')][_0x329d('0x4f')]){_0x33f286[_0x329d('0x50')]=[{'all':!![]}];}_0x33f286=_[_0x329d('0x4b')]({},_0x33f286,_0x4da48c[_0x329d('0x4e')]);return db[_0x329d('0x37')]['find'](_0x33f286)[_0x329d('0x1f')](handleEntityNotFound(_0x526a98,null))['then'](respondWithResult(_0x526a98,null))[_0x329d('0x53')](handleError(_0x526a98,null));};exports[_0x329d('0x55')]=function(_0x2c4122,_0x92b65f){return db[_0x329d('0x37')]['create'](_0x2c4122[_0x329d('0x56')],{})[_0x329d('0x1f')](respondWithResult(_0x92b65f,0xc9))[_0x329d('0x53')](handleError(_0x92b65f,null));};exports[_0x329d('0x57')]=function(_0x54990e,_0x2819f8){if(_0x54990e[_0x329d('0x56')]['id']){delete _0x54990e['body']['id'];}return db[_0x329d('0x37')][_0x329d('0x58')]({'where':{'id':_0x54990e[_0x329d('0x59')]['id']}})[_0x329d('0x1f')](handleEntityNotFound(_0x2819f8,null))['then'](saveUpdates(_0x54990e[_0x329d('0x56')],null))[_0x329d('0x1f')](respondWithResult(_0x2819f8,null))['catch'](handleError(_0x2819f8,null));};exports[_0x329d('0x33')]=function(_0x5ead24,_0x2d64fe){return db[_0x329d('0x37')][_0x329d('0x58')]({'where':{'id':_0x5ead24[_0x329d('0x59')]['id']}})[_0x329d('0x1f')](handleEntityNotFound(_0x2d64fe,null))[_0x329d('0x1f')](removeEntity(_0x2d64fe,null))[_0x329d('0x53')](handleError(_0x2d64fe,null));};exports['describe']=function(_0x345c8e,_0xaed9e0){return db['SmsMessage'][_0x329d('0x5a')]()[_0x329d('0x1f')](respondWithResult(_0xaed9e0,null))['catch'](handleError(_0xaed9e0,null));};var interaction_log=require(_0x329d('0xf'))('sms-interactions');exports[_0x329d('0x5b')]=function(_0x3584db,_0x109623,_0x3b79f2){var _0x2c5240={'agent':{},'channel':_0x329d('0x5c')};if(_0x3584db[_0x329d('0x56')]['id']){delete _0x3584db['body']['id'];}_0x3584db['body'][_0x329d('0x5d')]=!![];_0x3584db['body'][_0x329d('0x5e')]=moment()[_0x329d('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x3584db[_0x329d('0x56')][_0x329d('0x60')]=_0x3584db[_0x329d('0x56')]['UserId']||_0x3584db[_0x329d('0x61')]['id'];_0x2c5240[_0x329d('0x62')]['id']=_0x3584db[_0x329d('0x56')][_0x329d('0x60')];return db[_0x329d('0x37')][_0x329d('0x58')]({'where':{'id':_0x3584db[_0x329d('0x59')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x329d('0x1f')](handleEntityNotFound(_0x109623,null))['then'](saveUpdates(_0x3584db['body'],null))[_0x329d('0x1f')](function(_0x4fd499){if(_0x4fd499){_0x2c5240[_0x329d('0x27')]=_0x4fd499['get']({'plain':!![]});return db[_0x329d('0x63')][_0x329d('0x58')]({'where':{'id':_0x4fd499['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x109623,null))[_0x329d('0x1f')](function(_0x2a51d9){if(_0x2a51d9){return _0x2a51d9['update']({'UserId':_0x3584db[_0x329d('0x56')][_0x329d('0x60')],'read1stAt':_[_0x329d('0x64')](_0x2a51d9['read1stAt'])?moment()[_0x329d('0x5f')](_0x329d('0x65')):undefined});}return null;})[_0x329d('0x1f')](function(_0x1541fa){if(_0x1541fa){_0x2c5240[_0x329d('0x66')]=_0x1541fa[_0x329d('0x67')]({'plain':!![]});interaction_log[_0x329d('0x20')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3584db[_0x329d('0x61')]['id'],_0x3584db[_0x329d('0x61')][_0x329d('0x3b')],_0x3584db[_0x329d('0x61')][_0x329d('0x68')],_0x2c5240[_0x329d('0x66')]['id'],_0x3584db[_0x329d('0x56')]?JSON['stringify'](_0x3584db[_0x329d('0x56')]):'null');return respondWithRpcPromise(_0x329d('0x69'),_0x329d('0x6a'),_0x2c5240);}return null;})[_0x329d('0x1f')](function(_0x5f442f){return db['CmContact']['describe']()[_0x329d('0x1f')](function(_0x3b4f12){var _0x51fb77=[];for(var _0x483431=0x0;_0x483431=0x0){return _0x4484d4[_0x329d('0x57')]({'read':!![]});}else{logger[_0x329d('0x25')](_0x329d('0x87'),_0x329d('0x2a'),_0x329d('0x8e'),util[_0x329d('0x85')](_0x442778[_0x329d('0x56')],{'showHidden':![],'depth':null}));}break;case _0x329d('0x8f'):var _0x4ac045=_0x442778[_0x329d('0x56')][_0x329d('0x90')][0x0];if(_0x4ac045[_0x329d('0x2a')][_0x329d('0x91')]===_0x329d('0x92')){return _0x4484d4[_0x329d('0x57')]({'read':!![]});}else{logger[_0x329d('0x25')](_0x329d('0x87'),_0x329d('0x2a'),_0x329d('0x8f'),util[_0x329d('0x85')](_0x442778[_0x329d('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x4484d4;}})[_0x329d('0x1f')](respondWithResult(_0x560577,null))[_0x329d('0x53')](handleError(_0x560577,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index eae495f..faea2cb 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 _0xd9c2=['hasOwnProperty','hook','exports','events','SmsMessage','setMaxListeners','save','update','remove','emit'];(function(_0x9f199f,_0x54a362){var _0x4273b9=function(_0x305d11){while(--_0x305d11){_0x9f199f['push'](_0x9f199f['shift']());}};_0x4273b9(++_0x54a362);}(_0xd9c2,0xc1));var _0x2d9c=function(_0x155574,_0x4e0b0b){_0x155574=_0x155574-0x0;var _0x56b559=_0xd9c2[_0x155574];return _0x56b559;};'use strict';var EventEmitter=require(_0x2d9c('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x2d9c('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x2d9c('0x2')](0x0);var events={'afterCreate':_0x2d9c('0x3'),'afterUpdate':_0x2d9c('0x4'),'afterDestroy':_0x2d9c('0x5')};function emitEvent(_0x4954c1){return function(_0x217967,_0x5af7fd,_0x3a10ce){SmsMessageEvents[_0x2d9c('0x6')](_0x4954c1+':'+_0x217967['id'],_0x217967);SmsMessageEvents['emit'](_0x4954c1,_0x217967);_0x3a10ce(null);};}for(var e in events){if(events[_0x2d9c('0x7')](e)){var event=events[e];SmsMessage[_0x2d9c('0x8')](e,emitEvent(event));}}module[_0x2d9c('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x5155=['SmsMessage','update','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x11bda3,_0x2e9e0f){var _0x228f7f=function(_0x4c4093){while(--_0x4c4093){_0x11bda3['push'](_0x11bda3['shift']());}};_0x228f7f(++_0x2e9e0f);}(_0x5155,0x12a));var _0x5515=function(_0x4b94b9,_0x190691){_0x4b94b9=_0x4b94b9-0x0;var _0x4882f7=_0x5155[_0x4b94b9];return _0x4882f7;};'use strict';var EventEmitter=require(_0x5515('0x0'));var SmsMessage=require(_0x5515('0x1'))['db'][_0x5515('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5515('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4176ec){return function(_0x1cfb03,_0x4c7732,_0x5a05be){SmsMessageEvents[_0x5515('0x4')](_0x4176ec+':'+_0x1cfb03['id'],_0x1cfb03);SmsMessageEvents['emit'](_0x4176ec,_0x1cfb03);_0x5a05be(null);};}for(var e in events){if(events[_0x5515('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 4446661..f79e4eb 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 _0xc7cb=['apiMessageId','Missing\x20parameters:\x20apiKey','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','status','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','findOne','then','update','createdAt','catch','error','find','SmsAccountId','type','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','sid','afterCreate','twilio','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','skebby','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','read','Missing\x20parameters:\x20authToken','clicksend','password','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','http_code','data','head','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','toString','base64','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','token','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','csc','crypto','apiKey','login','timestamp','keys','sort','createHash','hex','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8'];(function(_0x324224,_0x281c7a){var _0x4e2d12=function(_0x38dcdb){while(--_0x38dcdb){_0x324224['push'](_0x324224['shift']());}};_0x4e2d12(++_0x281c7a);}(_0xc7cb,0x179));var _0xbc7c=function(_0x46f05c,_0x441def){_0x46f05c=_0x46f05c-0x0;var _0x505cb7=_0xc7cb[_0x46f05c];return _0x505cb7;};'use strict';var _=require(_0xbc7c('0x0'));var util=require(_0xbc7c('0x1'));var logger=require(_0xbc7c('0x2'))(_0xbc7c('0x3'));var moment=require(_0xbc7c('0x4'));var BPromise=require(_0xbc7c('0x5'));var rp=require(_0xbc7c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbc7c('0x7'));var config=require(_0xbc7c('0x8'));var attributes=require(_0xbc7c('0x9'));module[_0xbc7c('0xa')]=function(_0x455493,_0xf3f9b9){return _0x455493['define'](_0xbc7c('0xb'),attributes,{'tableName':_0xbc7c('0xc'),'paranoid':![],'indexes':[{'name':_0xbc7c('0xd'),'fields':[_0xbc7c('0xd')]},{'name':_0xbc7c('0xe'),'fields':[_0xbc7c('0xf')],'type':_0xbc7c('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x25db66,_0x3ca4ea,_0x33a7cd){var _0x38aa55=_0x455493['models'];var _0x3ba74b=_0x25db66[_0xbc7c('0x11')]({'plain':!![]});if(_0x3ba74b[_0xbc7c('0x12')][_0xbc7c('0x13')]()==='in'||_0x3ba74b[_0xbc7c('0x12')]['toLowerCase']()===_0xbc7c('0x14')&&!_0x3ba74b[_0xbc7c('0x15')]&&!_['isNil'](_0x3ba74b['UserId'])){_0x38aa55['SmsInteraction'][_0xbc7c('0x16')]({'where':{'id':_0x3ba74b['SmsInteractionId']}})[_0xbc7c('0x17')](function(_0x526375){if(_0x526375){_0x526375[_0xbc7c('0x18')]({'lastMsgAt':_0x3ba74b[_0xbc7c('0x19')],'lastMsgDirection':_0x3ba74b[_0xbc7c('0x12')][_0xbc7c('0x13')]()});}})[_0xbc7c('0x1a')](function(_0x124cda){console[_0xbc7c('0x1b')](_0x124cda);});}if(_0x3ba74b['direction']===_0xbc7c('0x14')&&!_0x3ba74b[_0xbc7c('0x15')]){var _0x28fd37;_0x38aa55['SmsAccount'][_0xbc7c('0x1c')]({'where':{'id':_0x3ba74b[_0xbc7c('0x1d')]},'raw':!![]})[_0xbc7c('0x17')](function(_0x54bb57){_0x28fd37=_0x54bb57;if(_0x28fd37&&_0x28fd37[_0xbc7c('0x1e')]){switch(_0x28fd37[_0xbc7c('0x1e')]){case'twilio':var _0x2d28cf=require('twilio');if(_0x28fd37[_0xbc7c('0x1f')]&&_0x28fd37[_0xbc7c('0x20')]&&_0x28fd37[_0xbc7c('0x21')]){var _0x4b8951=new _0x2d28cf(_0x28fd37[_0xbc7c('0x1f')],_0x28fd37[_0xbc7c('0x20')]);_0x4b8951[_0xbc7c('0x22')][_0xbc7c('0x23')]({'body':_0x3ba74b['body'],'to':_0x3ba74b[_0xbc7c('0x21')],'from':_0x28fd37['phone'],'statusCallback':_0x28fd37[_0xbc7c('0x24')]+_0xbc7c('0x25')+_0x3ba74b['id']+_0xbc7c('0x26')+_0x28fd37['token']})[_0xbc7c('0x17')](function(_0x460b87){if(_0x460b87[_0xbc7c('0x27')]){return _0x25db66['update']({'messageId':_0x460b87[_0xbc7c('0x27')]});}})['catch'](function(_0x31bd01){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbc7c('0x28'),_0xbc7c('0x29'),util[_0xbc7c('0x2a')](_0x31bd01,{'showHidden':![],'depth':null}));});}else{logger[_0xbc7c('0x1b')](_0xbc7c('0x2b'),_0xbc7c('0x28'),_0xbc7c('0x29'),_0xbc7c('0x2c'));}break;case'skebby':var _0x4af97a=_0xbc7c('0x2d');if(_0x28fd37[_0xbc7c('0x2e')]&&_0x28fd37['password']){var _0x95cfda={'recipient':[_0x3ba74b[_0xbc7c('0x21')]],'message':_0x3ba74b['body'],'message_type':_0x28fd37[_0xbc7c('0x2f')]};if(_0x28fd37['smsMethod']&&_0x28fd37['smsMethod']!=='SI'){_0x95cfda[_0xbc7c('0x30')]=_0x28fd37['phone'];}var _0x455b3f={'url':_0x4af97a+_0xbc7c('0x31')+_0x28fd37[_0xbc7c('0x2e')]+_0xbc7c('0x32')+_0x28fd37['password'],'method':_0xbc7c('0x33')};rp(_0x455b3f)[_0xbc7c('0x17')](function(_0x2ced3b){var _0x41f179=_0x2ced3b[_0xbc7c('0x34')](';');var _0x4c9554={'user_key':_0x41f179[0x0],'session_key':_0x41f179[0x1]};_0x455b3f={'url':_0x4af97a+_0xbc7c('0x35'),'method':_0xbc7c('0x36'),'headers':{'user_key':_0x4c9554[_0xbc7c('0x37')],'Session_key':_0x4c9554['session_key']},'json':!![],'body':_0x95cfda};return rp(_0x455b3f);})[_0xbc7c('0x17')](function(_0x17313d){if(_0x17313d[_0xbc7c('0x38')]>=0x1){var _0x27678c={'messageId':_0x17313d[_0xbc7c('0x39')]};if(_0x28fd37[_0xbc7c('0x2f')]!=='GP'||!_0x28fd37[_0xbc7c('0x3a')]){_0x27678c['read']=!![];}return _0x25db66[_0xbc7c('0x18')](_0x27678c);}else{return logger[_0xbc7c('0x1b')](_0xbc7c('0x2b'),_0xbc7c('0x28'),_0xbc7c('0x3b'),util['inspect'](_0x17313d,{'showHidden':![],'depth':null}));}})[_0xbc7c('0x1a')](function(_0x1cee33){return logger['error'](_0xbc7c('0x2b'),_0xbc7c('0x28'),_0xbc7c('0x3b'),util[_0xbc7c('0x2a')](_0x1cee33,{'showHidden':![],'depth':null}));});}else{logger[_0xbc7c('0x1b')](_0xbc7c('0x2b'),_0xbc7c('0x28'),_0xbc7c('0x3b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xbc7c('0x3c'):if(_0x28fd37['authToken']){var _0x51a613={'recipient':_0x3ba74b[_0xbc7c('0x21')],'message':_0x3ba74b[_0xbc7c('0xf')],'sender':_0x28fd37[_0xbc7c('0x3d')]||_0x28fd37[_0xbc7c('0x21')],'authorization':_0x28fd37['authToken']};var _0x3ca4ea={'method':_0xbc7c('0x36'),'uri':_0xbc7c('0x3e'),'body':_0x51a613,'json':!![]};rp(_0x3ca4ea)[_0xbc7c('0x17')](function(_0x16669f){var _0x58463f={'messageId':_0x16669f['requestid']};if(!_0x28fd37[_0xbc7c('0x3a')]){_0x58463f[_0xbc7c('0x3f')]=!![];}return _0x25db66[_0xbc7c('0x18')](_0x58463f);})[_0xbc7c('0x1a')](function(_0x467850){logger[_0xbc7c('0x1b')](_0xbc7c('0x2b'),_0xbc7c('0x28'),_0xbc7c('0x3c'),util['inspect'](_0x467850,{'showHidden':![],'depth':null}));});}else{logger[_0xbc7c('0x1b')](_0xbc7c('0x2b'),_0xbc7c('0x28'),'connectel',_0xbc7c('0x40'));}break;case _0xbc7c('0x41'):if(_0x28fd37[_0xbc7c('0x2e')]&&_0x28fd37[_0xbc7c('0x42')]){var _0x51a613={'messages':[{'source':_0xbc7c('0x43'),'to':_0x3ba74b['phone'],'body':_0x3ba74b[_0xbc7c('0xf')],'from':_0x28fd37[_0xbc7c('0x3d')]||_0x28fd37['phone']}]};var _0x10bb29=util[_0xbc7c('0x44')](_0xbc7c('0x45'),_0x28fd37[_0xbc7c('0x2e')],_0x28fd37[_0xbc7c('0x42')]);var _0x3ca4ea={'method':'POST','uri':_0xbc7c('0x46'),'body':_0x51a613,'headers':{'Authorization':util[_0xbc7c('0x44')]('Basic\x20%s',new Buffer(_0x10bb29)['toString']('base64'))},'json':!![]};rp(_0x3ca4ea)[_0xbc7c('0x17')](function(_0x3cbacb){if(_0x3cbacb[_0xbc7c('0x47')]>=0xc8&&_0x3cbacb[_0xbc7c('0x47')]<=0xce){if(_0x3cbacb[_0xbc7c('0x48')]&&_0x3cbacb[_0xbc7c('0x48')]['queued_count']>0x0){var _0xe3677b=_[_0xbc7c('0x49')](_0x3cbacb['data'][_0xbc7c('0x22')]);var _0x2a43d3={'messageId':_0xe3677b['message_id']};if(!_0x28fd37[_0xbc7c('0x3a')]){_0x2a43d3['read']=!![];}return _0x25db66[_0xbc7c('0x18')](_0x2a43d3);}else{logger[_0xbc7c('0x1b')](_0xbc7c('0x2b'),'afterCreate','clickSend',util[_0xbc7c('0x2a')](_0x3cbacb,{'showHidden':![],'depth':null}));}}else{logger[_0xbc7c('0x1b')](_0xbc7c('0x2b'),_0xbc7c('0x28'),_0xbc7c('0x4a'),util[_0xbc7c('0x2a')](_0x3cbacb,{'showHidden':![],'depth':null}));}})[_0xbc7c('0x1a')](function(_0xa231f4){logger[_0xbc7c('0x1b')](_0xbc7c('0x2b'),_0xbc7c('0x28'),_0xbc7c('0x4a'),util['inspect'](_0xa231f4,{'showHidden':![],'depth':null}));});}else{logger[_0xbc7c('0x1b')](_0xbc7c('0x2b'),_0xbc7c('0x28'),_0xbc7c('0x4a'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x28fd37['authId']&&_0x28fd37['authToken']){var _0x51a613={'dst':_0x3ba74b['phone'],'text':_0x3ba74b[_0xbc7c('0xf')],'src':_0x28fd37['senderString']||_0x28fd37[_0xbc7c('0x21')],'url':_0x28fd37[_0xbc7c('0x24')]+_0xbc7c('0x25')+_0x3ba74b['id']+_0xbc7c('0x26')+_0x28fd37['token']};var _0x10bb29=util['format'](_0xbc7c('0x45'),_0x28fd37[_0xbc7c('0x4b')],_0x28fd37[_0xbc7c('0x20')]);var _0x3ca4ea={'method':_0xbc7c('0x36'),'uri':util[_0xbc7c('0x44')](_0xbc7c('0x4c'),_0x28fd37['authId']),'body':_0x51a613,'headers':{'Authorization':util[_0xbc7c('0x44')](_0xbc7c('0x4d'),new Buffer(_0x10bb29)[_0xbc7c('0x4e')](_0xbc7c('0x4f')))},'json':!![]};rp(_0x3ca4ea)['then'](function(_0x1f790f){var _0x1dc989={'messageId':_0x1f790f[_0xbc7c('0x50')][0x0]};return _0x25db66[_0xbc7c('0x18')](_0x1dc989);})[_0xbc7c('0x1a')](function(_0x799b0a){logger[_0xbc7c('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbc7c('0x28'),_0xbc7c('0x51'),util[_0xbc7c('0x2a')](_0x799b0a,{'showHidden':![],'depth':null}));});}else{logger[_0xbc7c('0x1b')](_0xbc7c('0x2b'),_0xbc7c('0x28'),'plivo',_0xbc7c('0x52'));}break;case _0xbc7c('0x53'):if(_0x28fd37[_0xbc7c('0x2e')]&&_0x28fd37[_0xbc7c('0x42')]){if(_0x28fd37[_0xbc7c('0x54')]){var _0x231ea7={'method':_0xbc7c('0x36'),'uri':_0x28fd37['baseUrl']+_0xbc7c('0x55'),'body':{'username':_0x28fd37['username'],'password':_0x28fd37['password']},'json':!![]};return rp(_0x231ea7)[_0xbc7c('0x17')](function(_0x164ae6){var _0x387b5b={'method':_0xbc7c('0x36'),'uri':_0x28fd37[_0xbc7c('0x54')]+_0xbc7c('0x56'),'body':{'messages':[{'from':_0x28fd37[_0xbc7c('0x21')],'destinations':[{'to':_0x3ba74b[_0xbc7c('0x21')]}],'text':_0x3ba74b[_0xbc7c('0xf')],'notifyUrl':_0x28fd37[_0xbc7c('0x24')]+_0xbc7c('0x25')+_0x3ba74b['id']+_0xbc7c('0x26')+_0x28fd37[_0xbc7c('0x57')],'notifyContentType':_0xbc7c('0x58'),'callbackData':_0x28fd37[_0xbc7c('0x21')]+';'+_0x3ba74b[_0xbc7c('0xf')]}]},'headers':{'Authorization':_0xbc7c('0x59')+_0x164ae6[_0xbc7c('0x57')]},'json':!![]};return rp(_0x387b5b)[_0xbc7c('0x17')](function(_0xc46f74){if(_0xc46f74[_0xbc7c('0x22')]){var _0x41feb2={'messageId':_0xc46f74[_0xbc7c('0x22')][0x0][_0xbc7c('0xd')]};if(!_0x28fd37['deliveryReport']){_0x41feb2['read']=!![];}return _0x25db66[_0xbc7c('0x18')](_0x41feb2);}else{return logger[_0xbc7c('0x1b')](_0xbc7c('0x2b'),_0xbc7c('0x28'),_0xbc7c('0x53'),util['inspect'](_0xc46f74,{'showHidden':![],'depth':null}));}});})[_0xbc7c('0x1a')](function(_0x803b82){return logger[_0xbc7c('0x1b')](_0xbc7c('0x2b'),_0xbc7c('0x28'),_0xbc7c('0x53'),util['inspect'](_0x803b82,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbc7c('0x2b'),_0xbc7c('0x28'),'infobip',_0xbc7c('0x5a'));}}else{logger[_0xbc7c('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbc7c('0x28'),_0xbc7c('0x53'),_0xbc7c('0x5b'));}break;case _0xbc7c('0x5c'):var _0x3583c1=require(_0xbc7c('0x5d'));if(_0x28fd37[_0xbc7c('0x5e')]){var _0x7e173={};_0x7e173[_0xbc7c('0x5f')]=_0x28fd37[_0xbc7c('0x2e')];_0x7e173[_0xbc7c('0x21')]=_0x3ba74b[_0xbc7c('0x21')];_0x7e173[_0xbc7c('0x30')]=_0x28fd37[_0xbc7c('0x21')];_0x7e173['text']=_0x3ba74b[_0xbc7c('0xf')];_0x7e173[_0xbc7c('0x60')]=+new Date();var _0x3febe7='';var _0x2f5b7c='';var _0x420d0d=Object[_0xbc7c('0x61')](_0x7e173);_0x420d0d[_0xbc7c('0x62')]();for(var _0x3d637d=0x0;_0x3d637d<_0x420d0d['length'];_0x3d637d++){if(_0x3febe7!=''){_0x3febe7+='&';}_0x3febe7+=_0x420d0d[_0x3d637d]+'='+encodeURIComponent(_0x7e173[_0x420d0d[_0x3d637d]]);_0x2f5b7c+=_0x7e173[_0x420d0d[_0x3d637d]];}_0x2f5b7c+=_0x28fd37['apiKey'];_0x2f5b7c=_0x3583c1[_0xbc7c('0x63')]('md5')[_0xbc7c('0x18')](_0x2f5b7c)['digest'](_0xbc7c('0x64'));if(_0x3febe7!==''){_0x3febe7+='&';}_0x3febe7+='signature='+_0x2f5b7c;var _0x455b3f={'method':'GET','uri':_0x28fd37[_0xbc7c('0x54')]+_0xbc7c('0x65')+_0x3febe7,'json':!![]};return rp(_0x455b3f)[_0xbc7c('0x17')](function(_0x3b05ed){var _0x52e074=Object[_0xbc7c('0x61')](_0x3b05ed);if(_0x3b05ed[_0x52e074[0x0]][_0xbc7c('0x1b')]&&parseInt(_0x3b05ed[_0x52e074[0x0]]['error'])===0x0){var _0x4eae05={'messageId':_0x3b05ed[_0x52e074[0x0]][_0xbc7c('0x66')]};if(!_0x28fd37['deliveryReport']){_0x4eae05[_0xbc7c('0x3f')]=!![];}return _0x25db66['update'](_0x4eae05);}else{return logger['error'](_0xbc7c('0x2b'),_0xbc7c('0x28'),_0xbc7c('0x5c'),util[_0xbc7c('0x2a')](_0x3b05ed[_0xbc7c('0x1b')],{'showHidden':![],'depth':null}));}})[_0xbc7c('0x1a')](function(_0x3c8c5a){return logger['error'](_0xbc7c('0x2b'),_0xbc7c('0x28'),_0xbc7c('0x5c'),util[_0xbc7c('0x2a')](_0x3c8c5a,{'showHidden':![],'depth':null}));});}else{logger[_0xbc7c('0x1b')](_0xbc7c('0x2b'),_0xbc7c('0x28'),_0xbc7c('0x5c'),'Missing\x20parameters:\x20apiKey');}break;case _0xbc7c('0x67'):if(_0x28fd37[_0xbc7c('0x5e')]){var _0x3be74d={'method':_0xbc7c('0x36'),'uri':_0xbc7c('0x68'),'headers':{'Authorization':_0x28fd37['apiKey']},'body':{'content':_0x3ba74b[_0xbc7c('0xf')],'to':[_0x3ba74b['phone']],'from':_0x28fd37[_0xbc7c('0x21')],'binary':![],'clientMessageId':_0xbc7c('0x69'),'charset':_0xbc7c('0x6a')},'json':!![]};rp(_0x3be74d)['then'](function(_0x3d072b){if(!_0x3d072b[_0xbc7c('0x1b')]){var _0x5b2285={'messageId':_0x3d072b[_0xbc7c('0x22')][0x0][_0xbc7c('0x6b')]};if(!_0x28fd37[_0xbc7c('0x3a')]){_0x5b2285[_0xbc7c('0x3f')]=!![];}return _0x25db66[_0xbc7c('0x18')](_0x5b2285);}else{return logger[_0xbc7c('0x1b')](_0xbc7c('0x2b'),_0xbc7c('0x28'),'clickatell',util[_0xbc7c('0x2a')](_0x3d072b[_0xbc7c('0x1b')],{'showHidden':![],'depth':null}));}})[_0xbc7c('0x1a')](function(_0x4b9fbd){return logger[_0xbc7c('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbc7c('0x28'),_0xbc7c('0x67'),util[_0xbc7c('0x2a')](_0x4b9fbd,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbc7c('0x2b'),_0xbc7c('0x28'),_0xbc7c('0x67'),_0xbc7c('0x6c'));}break;case'bandwidth':if(_0x28fd37['username']&&_0x28fd37[_0xbc7c('0x42')]){var _0x10bb29=util[_0xbc7c('0x44')]('%s:%s',_0x28fd37[_0xbc7c('0x2e')],_0x28fd37[_0xbc7c('0x42')]);var _0x3ca4ea={'method':'POST','uri':_0xbc7c('0x6d')+_0x28fd37[_0xbc7c('0x6e')]+_0xbc7c('0x6f'),'body':{'to':[_0x3ba74b[_0xbc7c('0x21')]],'text':_0x3ba74b[_0xbc7c('0xf')],'from':_0x28fd37[_0xbc7c('0x21')],'applicationId':_0x28fd37['applicationId']},'headers':{'Authorization':util['format'](_0xbc7c('0x4d'),new Buffer(_0x10bb29)[_0xbc7c('0x4e')]('base64'))},'json':!![]};rp(_0x3ca4ea)[_0xbc7c('0x17')](function(_0x4aca01){if(_0x4aca01['id']){var _0x12f224={'messageId':_0x4aca01['id']};return _0x25db66[_0xbc7c('0x18')](_0x12f224);}else{logger['error'](_0xbc7c('0x2b'),'afterCreate',_0xbc7c('0x70'),util[_0xbc7c('0x2a')](_0x4aca01,{'showHidden':![],'depth':null}));}})[_0xbc7c('0x1a')](function(_0x528e68){logger[_0xbc7c('0x1b')](_0xbc7c('0x2b'),_0xbc7c('0x28'),_0xbc7c('0x70'),util[_0xbc7c('0x2a')](_0x528e68,{'showHidden':![],'depth':null}));});}else{logger[_0xbc7c('0x1b')](_0xbc7c('0x2b'),'afterCreate',_0xbc7c('0x70'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xbc7c('0x71'):if(_0x28fd37[_0xbc7c('0x5e')]){var _0x2aa96b={};var _0x455b3f={'method':_0xbc7c('0x36'),'uri':_0xbc7c('0x72'),'headers':{'Authorization':_0xbc7c('0x73')+_0x28fd37['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x28fd37['phone'],'to':_0x3ba74b['phone'],'text':_0x3ba74b['body']},'json':!![]};return rp(_0x455b3f)['then'](function(_0x24cda8){if(_0x24cda8[_0xbc7c('0x74')]==0xca){_0x2aa96b['message']=_0x24cda8;var _0x2a88a7={'method':_0xbc7c('0x36'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x28fd37[_0xbc7c('0x5e')],'Content-Type':_0xbc7c('0x58')},'body':{'refid':_0x2aa96b[_0xbc7c('0x75')]['refid']},'json':!![]};return rp(_0x2a88a7)['then'](function(_0x28f816){_0x2aa96b[_0xbc7c('0x76')]=_0x28f816;var _0x4a0854={'messageId':_0x2aa96b['message']['refid'],'read':!![]};return _0x25db66['update'](_0x4a0854);});}else{return logger[_0xbc7c('0x1b')](_0xbc7c('0x2b'),_0xbc7c('0x28'),_0xbc7c('0x71'),util[_0xbc7c('0x2a')](_0x24cda8,{'showHidden':![],'depth':null}));}})[_0xbc7c('0x1a')](function(_0xcd81d3){return logger[_0xbc7c('0x1b')](_0xbc7c('0x2b'),_0xbc7c('0x28'),_0xbc7c('0x71'),util[_0xbc7c('0x2a')](_0xcd81d3,{'showHidden':![],'depth':null}));});}else{return logger[_0xbc7c('0x1b')](_0xbc7c('0x2b'),_0xbc7c('0x28'),_0xbc7c('0x71'),'Token\x20not\x20received');}break;}}})['finally'](function(){_0x33a7cd();});}else{_0x33a7cd();}}},'charset':_0xbc7c('0x77'),'collate':_0xbc7c('0x78')});}; \ No newline at end of file +var _0x6999=['path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','toLowerCase','direction','secret','isNil','UserId','SmsInteraction','SmsInteractionId','then','update','catch','error','out','find','SmsAccountId','type','twilio','authToken','phone','accountSid','create','body','/api/sms/messages/','/status?token=','token','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','login?username=','&password=','GET','user_key','session_key','internal_order_id','deliveryReport','read','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','head','messages','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','remote','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','sender','text','timestamp','keys','sort','length','createHash','md5','digest','signature=','id_sms','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','bandwidth','https://api.intelepeer.com/_rest/v4/app/sms/send','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','status','refid','intelepeer','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird'];(function(_0x208419,_0x399c3f){var _0x345021=function(_0x54ee1e){while(--_0x54ee1e){_0x208419['push'](_0x208419['shift']());}};_0x345021(++_0x399c3f);}(_0x6999,0x16b));var _0x9699=function(_0x5e3bfd,_0x498d53){_0x5e3bfd=_0x5e3bfd-0x0;var _0x39bdd8=_0x6999[_0x5e3bfd];return _0x39bdd8;};'use strict';var _=require('lodash');var util=require(_0x9699('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9699('0x1'));var BPromise=require(_0x9699('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9699('0x3'));var rimraf=require(_0x9699('0x4'));var config=require(_0x9699('0x5'));var attributes=require(_0x9699('0x6'));module[_0x9699('0x7')]=function(_0x17ebc5,_0x3c642f){return _0x17ebc5[_0x9699('0x8')]('SmsMessage',attributes,{'tableName':_0x9699('0x9'),'paranoid':![],'indexes':[{'name':_0x9699('0xa'),'fields':[_0x9699('0xa')]},{'name':_0x9699('0xb'),'fields':['body'],'type':_0x9699('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x838ae,_0x3d2b90,_0x4a480f){var _0x37d779=_0x17ebc5[_0x9699('0xd')];var _0xc0737f=_0x838ae['get']({'plain':!![]});if(_0xc0737f['direction'][_0x9699('0xe')]()==='in'||_0xc0737f[_0x9699('0xf')]['toLowerCase']()==='out'&&!_0xc0737f[_0x9699('0x10')]&&!_[_0x9699('0x11')](_0xc0737f[_0x9699('0x12')])){_0x37d779[_0x9699('0x13')]['findOne']({'where':{'id':_0xc0737f[_0x9699('0x14')]}})[_0x9699('0x15')](function(_0x43b7a8){if(_0x43b7a8){_0x43b7a8[_0x9699('0x16')]({'lastMsgAt':_0xc0737f['createdAt'],'lastMsgDirection':_0xc0737f[_0x9699('0xf')]['toLowerCase']()});}})[_0x9699('0x17')](function(_0x52be6b){console[_0x9699('0x18')](_0x52be6b);});}if(_0xc0737f[_0x9699('0xf')]===_0x9699('0x19')&&!_0xc0737f['secret']){var _0x4a9da6;_0x37d779['SmsAccount'][_0x9699('0x1a')]({'where':{'id':_0xc0737f[_0x9699('0x1b')]},'raw':!![]})[_0x9699('0x15')](function(_0x1d9f1a){_0x4a9da6=_0x1d9f1a;if(_0x4a9da6&&_0x4a9da6['type']){switch(_0x4a9da6[_0x9699('0x1c')]){case _0x9699('0x1d'):var _0x3180fe=require('twilio');if(_0x4a9da6['accountSid']&&_0x4a9da6[_0x9699('0x1e')]&&_0x4a9da6[_0x9699('0x1f')]){var _0x3dad29=new _0x3180fe(_0x4a9da6[_0x9699('0x20')],_0x4a9da6[_0x9699('0x1e')]);_0x3dad29['messages'][_0x9699('0x21')]({'body':_0xc0737f[_0x9699('0x22')],'to':_0xc0737f['phone'],'from':_0x4a9da6[_0x9699('0x1f')],'statusCallback':_0x4a9da6['remote']+_0x9699('0x23')+_0xc0737f['id']+_0x9699('0x24')+_0x4a9da6[_0x9699('0x25')]})[_0x9699('0x15')](function(_0x16266d){if(_0x16266d['sid']){return _0x838ae['update']({'messageId':_0x16266d[_0x9699('0x26')]});}})[_0x9699('0x17')](function(_0x21ee9d){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9699('0x27'),_0x9699('0x1d'),util[_0x9699('0x28')](_0x21ee9d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9699('0x29'),_0x9699('0x27'),_0x9699('0x1d'),_0x9699('0x2a'));}break;case _0x9699('0x2b'):var _0x35eafc='https://api.skebby.it/API/v1.0/REST/';if(_0x4a9da6[_0x9699('0x2c')]&&_0x4a9da6[_0x9699('0x2d')]){var _0x3ec2b5={'recipient':[_0xc0737f[_0x9699('0x1f')]],'message':_0xc0737f[_0x9699('0x22')],'message_type':_0x4a9da6['smsMethod']};if(_0x4a9da6[_0x9699('0x2e')]&&_0x4a9da6[_0x9699('0x2e')]!=='SI'){_0x3ec2b5['sender']=_0x4a9da6[_0x9699('0x1f')];}var _0x4bc7c8={'url':_0x35eafc+_0x9699('0x2f')+_0x4a9da6['username']+_0x9699('0x30')+_0x4a9da6[_0x9699('0x2d')],'method':_0x9699('0x31')};rp(_0x4bc7c8)['then'](function(_0x2ca062){var _0x1c63b0=_0x2ca062['split'](';');var _0x207fa6={'user_key':_0x1c63b0[0x0],'session_key':_0x1c63b0[0x1]};_0x4bc7c8={'url':_0x35eafc+'sms','method':'POST','headers':{'user_key':_0x207fa6[_0x9699('0x32')],'Session_key':_0x207fa6[_0x9699('0x33')]},'json':!![],'body':_0x3ec2b5};return rp(_0x4bc7c8);})['then'](function(_0x439eff){if(_0x439eff['total_sent']>=0x1){var _0x501d47={'messageId':_0x439eff[_0x9699('0x34')]};if(_0x4a9da6['smsMethod']!=='GP'||!_0x4a9da6[_0x9699('0x35')]){_0x501d47[_0x9699('0x36')]=!![];}return _0x838ae[_0x9699('0x16')](_0x501d47);}else{return logger[_0x9699('0x18')](_0x9699('0x29'),_0x9699('0x27'),_0x9699('0x2b'),util['inspect'](_0x439eff,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4bd4d7){return logger[_0x9699('0x18')](_0x9699('0x29'),_0x9699('0x27'),_0x9699('0x2b'),util[_0x9699('0x28')](_0x4bd4d7,{'showHidden':![],'depth':null}));});}else{logger[_0x9699('0x18')](_0x9699('0x29'),_0x9699('0x27'),_0x9699('0x2b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x9699('0x37'):if(_0x4a9da6[_0x9699('0x1e')]){var _0x264f1d={'recipient':_0xc0737f[_0x9699('0x1f')],'message':_0xc0737f[_0x9699('0x22')],'sender':_0x4a9da6[_0x9699('0x38')]||_0x4a9da6['phone'],'authorization':_0x4a9da6[_0x9699('0x1e')]};var _0x3d2b90={'method':_0x9699('0x39'),'uri':_0x9699('0x3a'),'body':_0x264f1d,'json':!![]};rp(_0x3d2b90)[_0x9699('0x15')](function(_0xe20e12){var _0xf217c4={'messageId':_0xe20e12[_0x9699('0x3b')]};if(!_0x4a9da6[_0x9699('0x35')]){_0xf217c4['read']=!![];}return _0x838ae[_0x9699('0x16')](_0xf217c4);})[_0x9699('0x17')](function(_0x271ca9){logger[_0x9699('0x18')](_0x9699('0x29'),_0x9699('0x27'),_0x9699('0x37'),util[_0x9699('0x28')](_0x271ca9,{'showHidden':![],'depth':null}));});}else{logger[_0x9699('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9699('0x27'),_0x9699('0x37'),'Missing\x20parameters:\x20authToken');}break;case _0x9699('0x3c'):if(_0x4a9da6['username']&&_0x4a9da6[_0x9699('0x2d')]){var _0x264f1d={'messages':[{'source':_0x9699('0x3d'),'to':_0xc0737f['phone'],'body':_0xc0737f[_0x9699('0x22')],'from':_0x4a9da6[_0x9699('0x38')]||_0x4a9da6[_0x9699('0x1f')]}]};var _0x4198c0=util[_0x9699('0x3e')](_0x9699('0x3f'),_0x4a9da6[_0x9699('0x2c')],_0x4a9da6[_0x9699('0x2d')]);var _0x3d2b90={'method':'POST','uri':_0x9699('0x40'),'body':_0x264f1d,'headers':{'Authorization':util[_0x9699('0x3e')](_0x9699('0x41'),new Buffer(_0x4198c0)[_0x9699('0x42')](_0x9699('0x43')))},'json':!![]};rp(_0x3d2b90)[_0x9699('0x15')](function(_0x35f221){if(_0x35f221[_0x9699('0x44')]>=0xc8&&_0x35f221['http_code']<=0xce){if(_0x35f221['data']&&_0x35f221[_0x9699('0x45')]['queued_count']>0x0){var _0x8557cf=_[_0x9699('0x46')](_0x35f221[_0x9699('0x45')][_0x9699('0x47')]);var _0x21dad9={'messageId':_0x8557cf['message_id']};if(!_0x4a9da6[_0x9699('0x35')]){_0x21dad9['read']=!![];}return _0x838ae[_0x9699('0x16')](_0x21dad9);}else{logger[_0x9699('0x18')](_0x9699('0x29'),_0x9699('0x27'),_0x9699('0x48'),util['inspect'](_0x35f221,{'showHidden':![],'depth':null}));}}else{logger[_0x9699('0x18')](_0x9699('0x29'),'afterCreate','clickSend',util[_0x9699('0x28')](_0x35f221,{'showHidden':![],'depth':null}));}})['catch'](function(_0x64a0dd){logger[_0x9699('0x18')](_0x9699('0x29'),_0x9699('0x27'),_0x9699('0x48'),util['inspect'](_0x64a0dd,{'showHidden':![],'depth':null}));});}else{logger[_0x9699('0x18')](_0x9699('0x29'),_0x9699('0x27'),_0x9699('0x48'),_0x9699('0x49'));}break;case _0x9699('0x4a'):if(_0x4a9da6[_0x9699('0x4b')]&&_0x4a9da6['authToken']){var _0x264f1d={'dst':_0xc0737f[_0x9699('0x1f')],'text':_0xc0737f[_0x9699('0x22')],'src':_0x4a9da6['senderString']||_0x4a9da6[_0x9699('0x1f')],'url':_0x4a9da6[_0x9699('0x4c')]+'/api/sms/messages/'+_0xc0737f['id']+_0x9699('0x24')+_0x4a9da6[_0x9699('0x25')]};var _0x4198c0=util[_0x9699('0x3e')](_0x9699('0x3f'),_0x4a9da6[_0x9699('0x4b')],_0x4a9da6[_0x9699('0x1e')]);var _0x3d2b90={'method':'POST','uri':util['format'](_0x9699('0x4d'),_0x4a9da6[_0x9699('0x4b')]),'body':_0x264f1d,'headers':{'Authorization':util['format'](_0x9699('0x41'),new Buffer(_0x4198c0)[_0x9699('0x42')]('base64'))},'json':!![]};rp(_0x3d2b90)[_0x9699('0x15')](function(_0x4dec43){var _0x44ff00={'messageId':_0x4dec43[_0x9699('0x4e')][0x0]};return _0x838ae[_0x9699('0x16')](_0x44ff00);})[_0x9699('0x17')](function(_0x3f35cd){logger['error'](_0x9699('0x29'),_0x9699('0x27'),_0x9699('0x4a'),util[_0x9699('0x28')](_0x3f35cd,{'showHidden':![],'depth':null}));});}else{logger[_0x9699('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9699('0x27'),_0x9699('0x4a'),_0x9699('0x4f'));}break;case _0x9699('0x50'):if(_0x4a9da6[_0x9699('0x2c')]&&_0x4a9da6[_0x9699('0x2d')]){if(_0x4a9da6[_0x9699('0x51')]){var _0x80f8c1={'method':_0x9699('0x39'),'uri':_0x4a9da6[_0x9699('0x51')]+_0x9699('0x52'),'body':{'username':_0x4a9da6[_0x9699('0x2c')],'password':_0x4a9da6[_0x9699('0x2d')]},'json':!![]};return rp(_0x80f8c1)['then'](function(_0x1f6294){var _0x13ddb4={'method':_0x9699('0x39'),'uri':_0x4a9da6['baseUrl']+_0x9699('0x53'),'body':{'messages':[{'from':_0x4a9da6[_0x9699('0x1f')],'destinations':[{'to':_0xc0737f[_0x9699('0x1f')]}],'text':_0xc0737f[_0x9699('0x22')],'notifyUrl':_0x4a9da6[_0x9699('0x4c')]+'/api/sms/messages/'+_0xc0737f['id']+'/status?token='+_0x4a9da6['token'],'notifyContentType':'application/json','callbackData':_0x4a9da6[_0x9699('0x1f')]+';'+_0xc0737f[_0x9699('0x22')]}]},'headers':{'Authorization':_0x9699('0x54')+_0x1f6294[_0x9699('0x25')]},'json':!![]};return rp(_0x13ddb4)['then'](function(_0x31f9f2){if(_0x31f9f2[_0x9699('0x47')]){var _0x4a702a={'messageId':_0x31f9f2[_0x9699('0x47')][0x0][_0x9699('0xa')]};if(!_0x4a9da6['deliveryReport']){_0x4a702a[_0x9699('0x36')]=!![];}return _0x838ae[_0x9699('0x16')](_0x4a702a);}else{return logger[_0x9699('0x18')](_0x9699('0x29'),_0x9699('0x27'),_0x9699('0x50'),util[_0x9699('0x28')](_0x31f9f2,{'showHidden':![],'depth':null}));}});})[_0x9699('0x17')](function(_0xbe0647){return logger[_0x9699('0x18')](_0x9699('0x29'),_0x9699('0x27'),_0x9699('0x50'),util[_0x9699('0x28')](_0xbe0647,{'showHidden':![],'depth':null}));});}else{logger[_0x9699('0x18')](_0x9699('0x29'),_0x9699('0x27'),_0x9699('0x50'),_0x9699('0x55'));}}else{logger['error'](_0x9699('0x29'),_0x9699('0x27'),_0x9699('0x50'),_0x9699('0x49'));}break;case _0x9699('0x56'):var _0x19849d=require(_0x9699('0x57'));if(_0x4a9da6[_0x9699('0x58')]){var _0xbf4fbc={};_0xbf4fbc[_0x9699('0x59')]=_0x4a9da6[_0x9699('0x2c')];_0xbf4fbc[_0x9699('0x1f')]=_0xc0737f[_0x9699('0x1f')];_0xbf4fbc[_0x9699('0x5a')]=_0x4a9da6['phone'];_0xbf4fbc[_0x9699('0x5b')]=_0xc0737f['body'];_0xbf4fbc[_0x9699('0x5c')]=+new Date();var _0x442b54='';var _0x4fb44a='';var _0x31a422=Object[_0x9699('0x5d')](_0xbf4fbc);_0x31a422[_0x9699('0x5e')]();for(var _0x1f0bb4=0x0;_0x1f0bb4<_0x31a422[_0x9699('0x5f')];_0x1f0bb4++){if(_0x442b54!=''){_0x442b54+='&';}_0x442b54+=_0x31a422[_0x1f0bb4]+'='+encodeURIComponent(_0xbf4fbc[_0x31a422[_0x1f0bb4]]);_0x4fb44a+=_0xbf4fbc[_0x31a422[_0x1f0bb4]];}_0x4fb44a+=_0x4a9da6[_0x9699('0x58')];_0x4fb44a=_0x19849d[_0x9699('0x60')](_0x9699('0x61'))[_0x9699('0x16')](_0x4fb44a)[_0x9699('0x62')]('hex');if(_0x442b54!==''){_0x442b54+='&';}_0x442b54+=_0x9699('0x63')+_0x4fb44a;var _0x4bc7c8={'method':_0x9699('0x31'),'uri':_0x4a9da6[_0x9699('0x51')]+'/external/get/send.php?'+_0x442b54,'json':!![]};return rp(_0x4bc7c8)[_0x9699('0x15')](function(_0x2add61){var _0x5fdf9e=Object['keys'](_0x2add61);if(_0x2add61[_0x5fdf9e[0x0]][_0x9699('0x18')]&&parseInt(_0x2add61[_0x5fdf9e[0x0]][_0x9699('0x18')])===0x0){var _0x3e8a6f={'messageId':_0x2add61[_0x5fdf9e[0x0]][_0x9699('0x64')]};if(!_0x4a9da6[_0x9699('0x35')]){_0x3e8a6f[_0x9699('0x36')]=!![];}return _0x838ae['update'](_0x3e8a6f);}else{return logger[_0x9699('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9699('0x27'),_0x9699('0x56'),util['inspect'](_0x2add61[_0x9699('0x18')],{'showHidden':![],'depth':null}));}})[_0x9699('0x17')](function(_0xa0555e){return logger['error'](_0x9699('0x29'),_0x9699('0x27'),_0x9699('0x56'),util['inspect'](_0xa0555e,{'showHidden':![],'depth':null}));});}else{logger[_0x9699('0x18')](_0x9699('0x29'),_0x9699('0x27'),_0x9699('0x56'),'Missing\x20parameters:\x20apiKey');}break;case _0x9699('0x65'):if(_0x4a9da6[_0x9699('0x58')]){var _0x6498bc={'method':'POST','uri':_0x9699('0x66'),'headers':{'Authorization':_0x4a9da6[_0x9699('0x58')]},'body':{'content':_0xc0737f[_0x9699('0x22')],'to':[_0xc0737f['phone']],'from':_0x4a9da6[_0x9699('0x1f')],'binary':![],'clientMessageId':'uuid','charset':_0x9699('0x67')},'json':!![]};rp(_0x6498bc)[_0x9699('0x15')](function(_0x442aa0){if(!_0x442aa0[_0x9699('0x18')]){var _0x13f457={'messageId':_0x442aa0[_0x9699('0x47')][0x0][_0x9699('0x68')]};if(!_0x4a9da6[_0x9699('0x35')]){_0x13f457[_0x9699('0x36')]=!![];}return _0x838ae[_0x9699('0x16')](_0x13f457);}else{return logger[_0x9699('0x18')](_0x9699('0x29'),_0x9699('0x27'),'clickatell',util[_0x9699('0x28')](_0x442aa0[_0x9699('0x18')],{'showHidden':![],'depth':null}));}})[_0x9699('0x17')](function(_0x2a332f){return logger[_0x9699('0x18')](_0x9699('0x29'),'afterCreate',_0x9699('0x65'),util[_0x9699('0x28')](_0x2a332f,{'showHidden':![],'depth':null}));});}else{logger[_0x9699('0x18')](_0x9699('0x29'),'afterCreate',_0x9699('0x65'),_0x9699('0x69'));}break;case'bandwidth':if(_0x4a9da6['username']&&_0x4a9da6['password']){var _0x4198c0=util[_0x9699('0x3e')](_0x9699('0x3f'),_0x4a9da6['username'],_0x4a9da6['password']);var _0x3d2b90={'method':_0x9699('0x39'),'uri':_0x9699('0x6a')+_0x4a9da6['accountId']+_0x9699('0x6b'),'body':{'to':[_0xc0737f[_0x9699('0x1f')]],'text':_0xc0737f[_0x9699('0x22')],'from':_0x4a9da6[_0x9699('0x1f')],'applicationId':_0x4a9da6[_0x9699('0x6c')]},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x4198c0)[_0x9699('0x42')](_0x9699('0x43')))},'json':!![]};rp(_0x3d2b90)[_0x9699('0x15')](function(_0x25b784){if(_0x25b784['id']){var _0x3a1de3={'messageId':_0x25b784['id']};return _0x838ae[_0x9699('0x16')](_0x3a1de3);}else{logger['error'](_0x9699('0x29'),'afterCreate',_0x9699('0x6d'),util[_0x9699('0x28')](_0x25b784,{'showHidden':![],'depth':null}));}})['catch'](function(_0x26a730){logger['error'](_0x9699('0x29'),'afterCreate','bandwidth',util[_0x9699('0x28')](_0x26a730,{'showHidden':![],'depth':null}));});}else{logger[_0x9699('0x18')](_0x9699('0x29'),_0x9699('0x27'),_0x9699('0x6d'),_0x9699('0x49'));}break;case'intelepeer':if(_0x4a9da6[_0x9699('0x58')]){var _0x4739c0={};var _0x4bc7c8={'method':'POST','uri':_0x9699('0x6e'),'headers':{'Authorization':'Bearer\x20'+_0x4a9da6[_0x9699('0x58')],'Content-Type':_0x9699('0x6f')},'body':{'from':_0x4a9da6[_0x9699('0x1f')],'to':_0xc0737f[_0x9699('0x1f')],'text':_0xc0737f[_0x9699('0x22')]},'json':!![]};return rp(_0x4bc7c8)[_0x9699('0x15')](function(_0x2d65a5){if(_0x2d65a5[_0x9699('0x70')]==0xca){_0x4739c0[_0x9699('0x71')]=_0x2d65a5;var _0x5633b8={'method':_0x9699('0x39'),'uri':_0x9699('0x72'),'headers':{'Authorization':_0x9699('0x73')+_0x4a9da6[_0x9699('0x58')],'Content-Type':_0x9699('0x6f')},'body':{'refid':_0x4739c0['message']['refid']},'json':!![]};return rp(_0x5633b8)[_0x9699('0x15')](function(_0x192062){_0x4739c0[_0x9699('0x74')]=_0x192062;var _0x4fddf9={'messageId':_0x4739c0[_0x9699('0x71')][_0x9699('0x75')],'read':!![]};return _0x838ae[_0x9699('0x16')](_0x4fddf9);});}else{return logger[_0x9699('0x18')](_0x9699('0x29'),_0x9699('0x27'),_0x9699('0x76'),util['inspect'](_0x2d65a5,{'showHidden':![],'depth':null}));}})[_0x9699('0x17')](function(_0x589b06){return logger[_0x9699('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9699('0x76'),util[_0x9699('0x28')](_0x589b06,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x9699('0x29'),_0x9699('0x27'),_0x9699('0x76'),_0x9699('0x77'));}break;}}})['finally'](function(){_0x4a480f();});}else{_0x4a480f();}}},'charset':_0x9699('0x78'),'collate':_0x9699('0x79')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 196bff0..6ad2449 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 _0x5f76=['create','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','./smsMessage.socket','register','request','then','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsMessage,\x20%s,\x20%s','message','info','result','CreateSmsMessage','SmsMessage'];(function(_0x47c79a,_0x2769ef){var _0x29bf50=function(_0x33da6d){while(--_0x33da6d){_0x47c79a['push'](_0x47c79a['shift']());}};_0x29bf50(++_0x2769ef);}(_0x5f76,0x1b1));var _0x65f7=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0x5f76[_0x2053ea];return _0x2232c4;};'use strict';var _=require(_0x65f7('0x0'));var util=require(_0x65f7('0x1'));var moment=require(_0x65f7('0x2'));var BPromise=require(_0x65f7('0x3'));var rs=require(_0x65f7('0x4'));var fs=require('fs');var Redis=require(_0x65f7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x65f7('0x6'));var logger=require(_0x65f7('0x7'))('rpc');var config=require(_0x65f7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x65f7('0x9')][_0x65f7('0xa')]({'port':0x232a});config[_0x65f7('0xb')]=_[_0x65f7('0xc')](config[_0x65f7('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65f7('0xb')]));require(_0x65f7('0xd'))[_0x65f7('0xe')](socket);function respondWithRpcPromise(_0x19e944,_0x55c0bd,_0x18e2a8){return new BPromise(function(_0x1c9f18,_0x376549){return client[_0x65f7('0xf')](_0x19e944,_0x18e2a8)[_0x65f7('0x10')](function(_0x230bcb){logger['info']('SmsMessage,\x20%s,\x20%s',_0x55c0bd,_0x65f7('0x11'));logger[_0x65f7('0x12')](_0x65f7('0x13'),_0x55c0bd,_0x65f7('0x11'),JSON[_0x65f7('0x14')](_0x230bcb));if(_0x230bcb['error']){if(_0x230bcb['error'][_0x65f7('0x15')]===0x1f4){logger[_0x65f7('0x16')](_0x65f7('0x17'),_0x55c0bd,_0x230bcb[_0x65f7('0x16')][_0x65f7('0x18')]);return _0x376549(_0x230bcb[_0x65f7('0x16')][_0x65f7('0x18')]);}logger[_0x65f7('0x16')](_0x65f7('0x17'),_0x55c0bd,_0x230bcb[_0x65f7('0x16')]['message']);return _0x1c9f18(_0x230bcb[_0x65f7('0x16')][_0x65f7('0x18')]);}else{logger[_0x65f7('0x19')](_0x65f7('0x17'),_0x55c0bd,_0x65f7('0x11'));_0x1c9f18(_0x230bcb[_0x65f7('0x1a')]['message']);}})['catch'](function(_0x222928){logger[_0x65f7('0x16')]('SmsMessage,\x20%s,\x20%s',_0x55c0bd,_0x222928);_0x376549(_0x222928);});});}exports[_0x65f7('0x1b')]=function(_0x3b4368){var _0x2a750b=this;return new Promise(function(_0x43123f,_0x15bde0){return db[_0x65f7('0x1c')][_0x65f7('0x1d')](_0x3b4368['body'],{'raw':_0x3b4368[_0x65f7('0x1e')]?_0x3b4368['options'][_0x65f7('0x1f')]===undefined?!![]:![]:!![]})[_0x65f7('0x10')](function(_0x48af26){logger[_0x65f7('0x19')]('CreateSmsMessage',_0x3b4368);logger['debug'](_0x65f7('0x1b'),_0x3b4368,JSON[_0x65f7('0x14')](_0x48af26));_0x43123f(_0x48af26);})[_0x65f7('0x20')](function(_0x36152d){logger[_0x65f7('0x16')](_0x65f7('0x1b'),_0x36152d[_0x65f7('0x18')],_0x3b4368);_0x15bde0(_0x2a750b[_0x65f7('0x16')](0x1f4,_0x36152d[_0x65f7('0x18')]));});});}; \ No newline at end of file +var _0x5736=['http','redis','defaults','localhost','./smsMessage.socket','register','then','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','info','result','CreateSmsMessage','create','options','raw','debug','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5736,0x11e));var _0x6573=function(_0x96dae7,_0x48ccdb){_0x96dae7=_0x96dae7-0x0;var _0x45b23f=_0x5736[_0x96dae7];return _0x45b23f;};'use strict';var _=require('lodash');var util=require(_0x6573('0x0'));var moment=require(_0x6573('0x1'));var BPromise=require(_0x6573('0x2'));var rs=require(_0x6573('0x3'));var fs=require('fs');var Redis=require(_0x6573('0x4'));var db=require(_0x6573('0x5'))['db'];var utils=require(_0x6573('0x6'));var logger=require(_0x6573('0x7'))('rpc');var config=require(_0x6573('0x8'));var jayson=require(_0x6573('0x9'));var client=jayson[_0x6573('0xa')][_0x6573('0xb')]({'port':0x232a});config[_0x6573('0xc')]=_[_0x6573('0xd')](config[_0x6573('0xc')],{'host':_0x6573('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6573('0xc')]));require(_0x6573('0xf'))[_0x6573('0x10')](socket);function respondWithRpcPromise(_0x1f433e,_0x7a8999,_0x55da75){return new BPromise(function(_0x641e11,_0x2c9694){return client['request'](_0x1f433e,_0x55da75)[_0x6573('0x11')](function(_0x3bc036){logger['info']('SmsMessage,\x20%s,\x20%s',_0x7a8999,'request\x20sent');logger['debug'](_0x6573('0x12'),_0x7a8999,_0x6573('0x13'),JSON[_0x6573('0x14')](_0x3bc036));if(_0x3bc036[_0x6573('0x15')]){if(_0x3bc036[_0x6573('0x15')][_0x6573('0x16')]===0x1f4){logger[_0x6573('0x15')](_0x6573('0x17'),_0x7a8999,_0x3bc036['error'][_0x6573('0x18')]);return _0x2c9694(_0x3bc036[_0x6573('0x15')][_0x6573('0x18')]);}logger['error'](_0x6573('0x17'),_0x7a8999,_0x3bc036[_0x6573('0x15')][_0x6573('0x18')]);return _0x641e11(_0x3bc036[_0x6573('0x15')][_0x6573('0x18')]);}else{logger[_0x6573('0x19')](_0x6573('0x17'),_0x7a8999,'request\x20sent');_0x641e11(_0x3bc036[_0x6573('0x1a')][_0x6573('0x18')]);}})['catch'](function(_0x502c9b){logger[_0x6573('0x15')](_0x6573('0x17'),_0x7a8999,_0x502c9b);_0x2c9694(_0x502c9b);});});}exports[_0x6573('0x1b')]=function(_0x47d1ff){var _0xff4034=this;return new Promise(function(_0x6d7adc,_0x2ca61a){return db['SmsMessage'][_0x6573('0x1c')](_0x47d1ff['body'],{'raw':_0x47d1ff[_0x6573('0x1d')]?_0x47d1ff[_0x6573('0x1d')][_0x6573('0x1e')]===undefined?!![]:![]:!![]})[_0x6573('0x11')](function(_0x15a0a0){logger['info'](_0x6573('0x1b'),_0x47d1ff);logger[_0x6573('0x1f')]('CreateSmsMessage',_0x47d1ff,JSON['stringify'](_0x15a0a0));_0x6d7adc(_0x15a0a0);})[_0x6573('0x20')](function(_0x468003){logger[_0x6573('0x15')](_0x6573('0x1b'),_0x468003[_0x6573('0x18')],_0x47d1ff);_0x2ca61a(_0xff4034['error'](0x1f4,_0x468003[_0x6573('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index e8f553f..d9aaa57 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 _0x787e=['save','update','removeListener','register','length','smsMessage:','./smsMessage.events'];(function(_0x370208,_0x30908f){var _0x258075=function(_0x15f7a3){while(--_0x15f7a3){_0x370208['push'](_0x370208['shift']());}};_0x258075(++_0x30908f);}(_0x787e,0xc3));var _0xe787=function(_0x3a0535,_0x3c3a95){_0x3a0535=_0x3a0535-0x0;var _0x5885a6=_0x787e[_0x3a0535];return _0x5885a6;};'use strict';var SmsMessageEvents=require(_0xe787('0x0'));var events=[_0xe787('0x1'),'remove',_0xe787('0x2')];function createListener(_0x3405d1,_0x242157){return function(_0x54ff91){_0x242157['emit'](_0x3405d1,_0x54ff91);};}function removeListener(_0x10e4cf,_0x4d776d){return function(){SmsMessageEvents[_0xe787('0x3')](_0x10e4cf,_0x4d776d);};}exports[_0xe787('0x4')]=function(_0xf4f7ff){for(var _0x1f6c6b=0x0,_0x81462e=events[_0xe787('0x5')];_0x1f6c6b<_0x81462e;_0x1f6c6b++){var _0x418323=events[_0x1f6c6b];var _0x4a74f6=createListener(_0xe787('0x6')+_0x418323,_0xf4f7ff);SmsMessageEvents['on'](_0x418323,_0x4a74f6);}}; \ No newline at end of file +var _0x8a23=['remove','removeListener','register','length','save'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0x8a23,0x1b2));var _0x38a2=function(_0x2ef8c1,_0x2f72f4){_0x2ef8c1=_0x2ef8c1-0x0;var _0x288305=_0x8a23[_0x2ef8c1];return _0x288305;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x38a2('0x0'),_0x38a2('0x1'),'update'];function createListener(_0x368eab,_0x528aea){return function(_0x19a0b5){_0x528aea['emit'](_0x368eab,_0x19a0b5);};}function removeListener(_0x5995d3,_0x2730ee){return function(){SmsMessageEvents[_0x38a2('0x2')](_0x5995d3,_0x2730ee);};}exports[_0x38a2('0x3')]=function(_0x2f9740){for(var _0x3283e8=0x0,_0x571127=events[_0x38a2('0x4')];_0x3283e8<_0x571127;_0x3283e8++){var _0x6ef221=events[_0x3283e8];var _0x3d0505=createListener('smsMessage:'+_0x6ef221,_0x2f9740);SmsMessageEvents['on'](_0x6ef221,_0x3d0505);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 1384350..4568070 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 _0x21e6=['removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','getMembers','/:id/users','getAgents','create','/:id/teams','addAgents','put','/:id','destroy','delete'];(function(_0x5b059a,_0x3659ff){var _0x424586=function(_0xa8c777){while(--_0xa8c777){_0x5b059a['push'](_0x5b059a['shift']());}};_0x424586(++_0x3659ff);}(_0x21e6,0x19a));var _0x621e=function(_0x1d04b5,_0x30792c){_0x1d04b5=_0x1d04b5-0x0;var _0x161342=_0x21e6[_0x1d04b5];return _0x161342;};'use strict';var multer=require(_0x621e('0x0'));var util=require(_0x621e('0x1'));var path=require(_0x621e('0x2'));var timeout=require(_0x621e('0x3'));var express=require(_0x621e('0x4'));var router=express[_0x621e('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x621e('0x6'));var config=require(_0x621e('0x7'));var controller=require('./smsQueue.controller');router[_0x621e('0x8')]('/',auth[_0x621e('0x9')](),controller[_0x621e('0xa')]);router[_0x621e('0x8')]('/describe',auth[_0x621e('0x9')](),controller[_0x621e('0xb')]);router[_0x621e('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x621e('0x8')]('/:id/members',auth[_0x621e('0x9')](),controller[_0x621e('0xc')]);router['get']('/:id/teams',auth[_0x621e('0x9')](),controller['getTeams']);router[_0x621e('0x8')](_0x621e('0xd'),auth[_0x621e('0x9')](),controller[_0x621e('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x621e('0xf')]);router['post'](_0x621e('0x10'),auth[_0x621e('0x9')](),controller['addTeams']);router['post'](_0x621e('0xd'),auth[_0x621e('0x9')](),controller[_0x621e('0x11')]);router[_0x621e('0x12')]('/:id',auth[_0x621e('0x9')](),controller['update']);router['delete'](_0x621e('0x13'),auth['isAuthenticated'](),controller[_0x621e('0x14')]);router[_0x621e('0x15')](_0x621e('0x10'),auth[_0x621e('0x9')](),controller[_0x621e('0x16')]);router[_0x621e('0x15')](_0x621e('0xd'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x621e('0x17')]=router; \ No newline at end of file +var _0x6f9a=['isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','destroy','removeTeams','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./smsQueue.controller','get','index'];(function(_0x3e208a,_0x324b09){var _0x33a065=function(_0x499018){while(--_0x499018){_0x3e208a['push'](_0x3e208a['shift']());}};_0x33a065(++_0x324b09);}(_0x6f9a,0x147));var _0xa6f9=function(_0x4e15f8,_0x3044d6){_0x4e15f8=_0x4e15f8-0x0;var _0x18db20=_0x6f9a[_0x4e15f8];return _0x18db20;};'use strict';var multer=require('multer');var util=require(_0xa6f9('0x0'));var path=require(_0xa6f9('0x1'));var timeout=require(_0xa6f9('0x2'));var express=require(_0xa6f9('0x3'));var router=express[_0xa6f9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa6f9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa6f9('0x6'));router[_0xa6f9('0x7')]('/',auth['isAuthenticated'](),controller[_0xa6f9('0x8')]);router[_0xa6f9('0x7')]('/describe',auth[_0xa6f9('0x9')](),controller[_0xa6f9('0xa')]);router[_0xa6f9('0x7')](_0xa6f9('0xb'),auth[_0xa6f9('0x9')](),controller[_0xa6f9('0xc')]);router[_0xa6f9('0x7')](_0xa6f9('0xd'),auth[_0xa6f9('0x9')](),controller[_0xa6f9('0xe')]);router[_0xa6f9('0x7')](_0xa6f9('0xf'),auth[_0xa6f9('0x9')](),controller[_0xa6f9('0x10')]);router[_0xa6f9('0x7')](_0xa6f9('0x11'),auth[_0xa6f9('0x9')](),controller[_0xa6f9('0x12')]);router[_0xa6f9('0x13')]('/',auth[_0xa6f9('0x9')](),controller[_0xa6f9('0x14')]);router[_0xa6f9('0x13')](_0xa6f9('0xf'),auth['isAuthenticated'](),controller[_0xa6f9('0x15')]);router[_0xa6f9('0x13')](_0xa6f9('0x11'),auth[_0xa6f9('0x9')](),controller['addAgents']);router[_0xa6f9('0x16')](_0xa6f9('0xb'),auth[_0xa6f9('0x9')](),controller[_0xa6f9('0x17')]);router[_0xa6f9('0x18')](_0xa6f9('0xb'),auth[_0xa6f9('0x9')](),controller[_0xa6f9('0x19')]);router['delete'](_0xa6f9('0xf'),auth[_0xa6f9('0x9')](),controller[_0xa6f9('0x1a')]);router['delete'](_0xa6f9('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xa6f9('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 71ba248..85a608a 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 _0x3f16=['name','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x4af40d,_0xce281f){var _0x7fbbda=function(_0x5dbd1b){while(--_0x5dbd1b){_0x4af40d['push'](_0x4af40d['shift']());}};_0x7fbbda(++_0xce281f);}(_0x3f16,0x107));var _0x63f1=function(_0x4679c4,_0x133cc8){_0x4679c4=_0x4679c4-0x0;var _0x2de6e8=_0x3f16[_0x4679c4];return _0x2de6e8;};'use strict';var Sequelize=require(_0x63f1('0x0'));module[_0x63f1('0x1')]={'name':{'type':Sequelize[_0x63f1('0x2')],'unique':_0x63f1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x63f1('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x63f1('0x4'),_0x63f1('0x5'),_0x63f1('0x6'))}}; \ No newline at end of file +var _0xee4d=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x17fe05,_0x527c52){var _0x2a0b42=function(_0xf000ed){while(--_0xf000ed){_0x17fe05['push'](_0x17fe05['shift']());}};_0x2a0b42(++_0x527c52);}(_0xee4d,0x110));var _0xdee4=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0xee4d[_0x5a79e2];return _0x266c45;};'use strict';var Sequelize=require(_0xdee4('0x0'));module[_0xdee4('0x1')]={'name':{'type':Sequelize[_0xdee4('0x2')],'unique':_0xdee4('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xdee4('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdee4('0x5')](_0xdee4('0x6'),_0xdee4('0x7'),_0xdee4('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index d43d233..d16c2f0 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 _0x8df3=['user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','value','ids','isEmpty','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','removeAgents','isArray','getAgents','findOne','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./smsQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','SmsQueues','error','stack','name','send','SmsQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserSmsQueue','SmsQueueId','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','smsPause','Team','getTeams','Agents','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','team_has_sms_queues','join'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0x8df3,0xa6));var _0x38df=function(_0x5b1370,_0x5beac4){_0x5b1370=_0x5b1370-0x0;var _0xf5075d=_0x8df3[_0x5b1370];return _0xf5075d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x38df('0x0'));var zipdir=require(_0x38df('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x38df('0x2'));var moment=require(_0x38df('0x3'));var BPromise=require(_0x38df('0x4'));var Mustache=require(_0x38df('0x5'));var util=require('util');var path=require(_0x38df('0x6'));var sox=require(_0x38df('0x7'));var csv=require('to-csv');var ejs=require(_0x38df('0x8'));var fs=require('fs');var fs_extra=require(_0x38df('0x9'));var _=require(_0x38df('0xa'));var squel=require(_0x38df('0xb'));var crypto=require(_0x38df('0xc'));var jsforce=require(_0x38df('0xd'));var deskjs=require(_0x38df('0xe'));var toCsv=require(_0x38df('0xf'));var querystring=require('querystring');var Papa=require(_0x38df('0x10'));var Redis=require(_0x38df('0x11'));var authService=require(_0x38df('0x12'));var qs=require(_0x38df('0x13'));var as=require(_0x38df('0x14'));var hardwareService=require(_0x38df('0x15'));var logger=require('../../config/logger')(_0x38df('0x16'));var utils=require(_0x38df('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x38df('0x18'));var db=require(_0x38df('0x19'))['db'];config[_0x38df('0x1a')]=_['defaults'](config['redis'],{'host':_0x38df('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x38df('0x1a')]));require(_0x38df('0x1c'))[_0x38df('0x1d')](socket);function respondWithStatusCode(_0x252002,_0x39ec74){_0x39ec74=_0x39ec74||0xcc;return function(_0x2ed229){if(_0x2ed229){return _0x252002[_0x38df('0x1e')](_0x39ec74);}return _0x252002[_0x38df('0x1f')](_0x39ec74)[_0x38df('0x20')]();};}function respondWithResult(_0x3adb24,_0x1ad4dd){_0x1ad4dd=_0x1ad4dd||0xc8;return function(_0x16593b){if(_0x16593b){return _0x3adb24[_0x38df('0x1f')](_0x1ad4dd)[_0x38df('0x21')](_0x16593b);}};}function respondWithFilteredResult(_0x461087,_0x35d709){return function(_0x319068){if(_0x319068){var _0x418100=typeof _0x35d709[_0x38df('0x22')]===_0x38df('0x23')&&typeof _0x35d709[_0x38df('0x24')]===_0x38df('0x23');var _0x3a2744=_0x319068[_0x38df('0x25')];var _0x3d9b7b=_0x418100?0x0:_0x35d709['offset'];var _0x233eeb=_0x418100?_0x319068[_0x38df('0x25')]:_0x35d709[_0x38df('0x22')]+_0x35d709['limit'];var _0x78ea2b;if(_0x233eeb>=_0x3a2744){_0x233eeb=_0x3a2744;_0x78ea2b=0xc8;}else{_0x78ea2b=0xce;}_0x461087['status'](_0x78ea2b);return _0x461087['set'](_0x38df('0x26'),_0x3d9b7b+'-'+_0x233eeb+'/'+_0x3a2744)[_0x38df('0x21')](_0x319068);}return null;};}function patchUpdates(_0x426114){return function(_0x5f14f9){try{jsonpatch['apply'](_0x5f14f9,_0x426114,!![]);}catch(_0xdb5d45){return BPromise[_0x38df('0x27')](_0xdb5d45);}return _0x5f14f9[_0x38df('0x28')]();};}function saveUpdates(_0x1513bd,_0x1436ab){return function(_0x4253bd){if(_0x4253bd){return _0x4253bd[_0x38df('0x29')](_0x1513bd)[_0x38df('0x2a')](function(_0x2b22de){return _0x2b22de;});}return null;};}function removeEntity(_0x42a0c0,_0x2c5e68){return function(_0x1b39e6){if(_0x1b39e6){return _0x1b39e6[_0x38df('0x2b')]()[_0x38df('0x2a')](function(){var _0x2cd187=_0x1b39e6[_0x38df('0x2c')]({'plain':!![]});var _0x1648cc=_0x38df('0x2d');return db['UserProfileResource'][_0x38df('0x2b')]({'where':{'type':_0x1648cc,'resourceId':_0x2cd187['id']}})[_0x38df('0x2a')](function(){return _0x1b39e6;});})[_0x38df('0x2a')](function(){_0x42a0c0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6b5541,_0xa5db5c){return function(_0x176482){if(!_0x176482){_0x6b5541['sendStatus'](0x194);}return _0x176482;};}function handleError(_0xc5dfa4,_0x3a5f92){_0x3a5f92=_0x3a5f92||0x1f4;return function(_0x34da73){logger[_0x38df('0x2e')](_0x34da73[_0x38df('0x2f')]);if(_0x34da73[_0x38df('0x30')]){delete _0x34da73[_0x38df('0x30')];}_0xc5dfa4[_0x38df('0x1f')](_0x3a5f92)[_0x38df('0x31')](_0x34da73);};}exports['index']=function(_0x1fda20,_0x64c068){var _0x4e960d={},_0x3077a1={},_0x3ee944={'count':0x0,'rows':[]};var _0x15b834=_['map'](db[_0x38df('0x32')][_0x38df('0x33')],function(_0x3e4e11){return{'name':_0x3e4e11[_0x38df('0x34')],'type':_0x3e4e11[_0x38df('0x35')][_0x38df('0x36')]};});_0x3077a1[_0x38df('0x37')]=_[_0x38df('0x38')](_0x15b834,_0x38df('0x30'));_0x3077a1[_0x38df('0x39')]=_[_0x38df('0x3a')](_0x1fda20[_0x38df('0x39')]);_0x3077a1[_0x38df('0x3b')]=_[_0x38df('0x3c')](_0x3077a1[_0x38df('0x37')],_0x3077a1[_0x38df('0x39')]);_0x4e960d[_0x38df('0x3d')]=_['intersection'](_0x3077a1[_0x38df('0x37')],qs['fields'](_0x1fda20[_0x38df('0x39')][_0x38df('0x3e')]));_0x4e960d[_0x38df('0x3d')]=_0x4e960d[_0x38df('0x3d')][_0x38df('0x3f')]?_0x4e960d[_0x38df('0x3d')]:_0x3077a1['model'];if(!_0x1fda20['query'][_0x38df('0x40')]('nolimit')){_0x4e960d[_0x38df('0x24')]=qs[_0x38df('0x24')](_0x1fda20[_0x38df('0x39')][_0x38df('0x24')]);_0x4e960d[_0x38df('0x22')]=qs[_0x38df('0x22')](_0x1fda20['query'][_0x38df('0x22')]);}_0x4e960d[_0x38df('0x41')]=qs[_0x38df('0x42')](_0x1fda20['query']['sort']);_0x4e960d[_0x38df('0x43')]=qs[_0x38df('0x3b')](_[_0x38df('0x44')](_0x1fda20[_0x38df('0x39')],_0x3077a1[_0x38df('0x3b')]),_0x15b834);if(_0x1fda20[_0x38df('0x39')][_0x38df('0x45')]){_0x4e960d['where']=_[_0x38df('0x46')](_0x4e960d[_0x38df('0x43')],{'$or':_[_0x38df('0x38')](_0x15b834,function(_0x3af989){if(_0x3af989[_0x38df('0x35')]!==_0x38df('0x47')){var _0xd54beb={};_0xd54beb[_0x3af989['name']]={'$like':'%'+_0x1fda20['query'][_0x38df('0x45')]+'%'};return _0xd54beb;}})});}_0x4e960d=_[_0x38df('0x46')]({},_0x4e960d,_0x1fda20[_0x38df('0x48')]);var _0x54cd8d={'where':_0x4e960d[_0x38df('0x43')]};return db['SmsQueue'][_0x38df('0x25')](_0x54cd8d)[_0x38df('0x2a')](function(_0x100d0c){_0x3ee944['count']=_0x100d0c;if(_0x1fda20['query'][_0x38df('0x49')]){_0x4e960d[_0x38df('0x4a')]=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x4e960d);})['then'](function(_0x37ce23){_0x3ee944[_0x38df('0x4b')]=_0x37ce23;return _0x3ee944;})[_0x38df('0x2a')](respondWithFilteredResult(_0x64c068,_0x4e960d))[_0x38df('0x4c')](handleError(_0x64c068,null));};exports[_0x38df('0x4d')]=function(_0x161475,_0x25afa5){var _0xaaae0c={'raw':!![],'where':{'id':_0x161475[_0x38df('0x4e')]['id']}},_0x316489={};_0x316489['model']=_['keys'](db[_0x38df('0x32')][_0x38df('0x33')]);_0x316489['query']=_['keys'](_0x161475['query']);_0x316489[_0x38df('0x3b')]=_['intersection'](_0x316489[_0x38df('0x37')],_0x316489['query']);_0xaaae0c[_0x38df('0x3d')]=_['intersection'](_0x316489[_0x38df('0x37')],qs[_0x38df('0x3e')](_0x161475[_0x38df('0x39')]['fields']));_0xaaae0c[_0x38df('0x3d')]=_0xaaae0c[_0x38df('0x3d')][_0x38df('0x3f')]?_0xaaae0c[_0x38df('0x3d')]:_0x316489[_0x38df('0x37')];if(_0x161475[_0x38df('0x39')][_0x38df('0x49')]){_0xaaae0c[_0x38df('0x4a')]=[{'all':!![]}];}_0xaaae0c=_[_0x38df('0x46')]({},_0xaaae0c,_0x161475[_0x38df('0x48')]);return db[_0x38df('0x32')]['find'](_0xaaae0c)[_0x38df('0x2a')](handleEntityNotFound(_0x25afa5,null))[_0x38df('0x2a')](respondWithResult(_0x25afa5,null))[_0x38df('0x4c')](handleError(_0x25afa5,null));};exports[_0x38df('0x4f')]=function(_0x1c18af,_0x56e61f){return db[_0x38df('0x32')]['create'](_0x1c18af['body'],{})[_0x38df('0x2a')](function(_0x199d89){var _0x3473a9=_0x1c18af[_0x38df('0x50')][_0x38df('0x2c')]({'plain':!![]});if(!_0x3473a9)throw new Error(_0x38df('0x51'));if(_0x3473a9['role']===_0x38df('0x50')){var _0x40de55=_0x199d89['get']({'plain':!![]});var _0x5a91da='SmsQueues';return db['UserProfileSection'][_0x38df('0x52')]({'where':{'name':_0x5a91da,'userProfileId':_0x3473a9[_0x38df('0x53')]},'raw':!![]})['then'](function(_0x586d2c){if(_0x586d2c&&_0x586d2c['autoAssociation']===0x0){return db[_0x38df('0x54')]['create']({'name':_0x40de55[_0x38df('0x30')],'resourceId':_0x40de55['id'],'type':_0x586d2c[_0x38df('0x30')],'sectionId':_0x586d2c['id']},{})[_0x38df('0x2a')](function(){return _0x199d89;});}else{return _0x199d89;}})[_0x38df('0x4c')](function(_0x7b1bdd){logger[_0x38df('0x2e')](_0x38df('0x55'),_0x7b1bdd);throw _0x7b1bdd;});}return _0x199d89;})[_0x38df('0x2a')](respondWithResult(_0x56e61f,0xc9))[_0x38df('0x4c')](handleError(_0x56e61f,null));};exports[_0x38df('0x29')]=function(_0x54abba,_0x4eddcf){if(_0x54abba[_0x38df('0x56')]['id']){delete _0x54abba[_0x38df('0x56')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x54abba[_0x38df('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4eddcf,null))[_0x38df('0x2a')](saveUpdates(_0x54abba[_0x38df('0x56')],null))[_0x38df('0x2a')](respondWithResult(_0x4eddcf,null))['catch'](handleError(_0x4eddcf,null));};exports['destroy']=function(_0x39a18c,_0x344524){return db['SmsQueue']['find']({'where':{'id':_0x39a18c['params']['id']}})[_0x38df('0x2a')](handleEntityNotFound(_0x344524,null))['then'](removeEntity(_0x344524,null))[_0x38df('0x4c')](handleError(_0x344524,null));};exports[_0x38df('0x57')]=function(_0x24c3dc,_0x154a57){return db['SmsQueue'][_0x38df('0x57')]()[_0x38df('0x2a')](respondWithResult(_0x154a57,null))[_0x38df('0x4c')](handleError(_0x154a57,null));};exports[_0x38df('0x58')]=function(_0x40f70d,_0x42cea8,_0x1a9970){var _0x431d18={'raw':!![],'where':{}},_0x246120={},_0x8d870;return db[_0x38df('0x32')]['findOne']({'where':{'id':_0x40f70d[_0x38df('0x4e')]['id']}})[_0x38df('0x2a')](handleEntityNotFound(_0x42cea8,null))[_0x38df('0x2a')](function(_0x5e0a29){if(_0x5e0a29){_0x8d870=_0x5e0a29[_0x38df('0x2c')]({'plain':!![]});_0x246120[_0x38df('0x37')]=_[_0x38df('0x3a')](db[_0x38df('0x59')]['rawAttributes']);_0x246120[_0x38df('0x39')]=_['keys'](_0x40f70d[_0x38df('0x39')]);_0x246120['filters']=_['intersection'](_0x246120[_0x38df('0x37')],_0x246120[_0x38df('0x39')]);_0x431d18[_0x38df('0x3d')]=_[_0x38df('0x3c')](_0x246120['model'],qs[_0x38df('0x3e')](_0x40f70d[_0x38df('0x39')]['fields']));_0x431d18[_0x38df('0x3d')]=_0x431d18[_0x38df('0x3d')][_0x38df('0x3f')]?_0x431d18[_0x38df('0x3d')]:_0x246120[_0x38df('0x37')];if(!_0x40f70d[_0x38df('0x39')][_0x38df('0x40')]('nolimit')){_0x431d18[_0x38df('0x24')]=qs[_0x38df('0x24')](_0x40f70d[_0x38df('0x39')][_0x38df('0x24')]);_0x431d18[_0x38df('0x22')]=qs[_0x38df('0x22')](_0x40f70d[_0x38df('0x39')][_0x38df('0x22')]);}_0x431d18[_0x38df('0x41')]=qs[_0x38df('0x42')](_0x40f70d[_0x38df('0x39')]['sort']);_0x431d18[_0x38df('0x43')]=qs[_0x38df('0x3b')](_[_0x38df('0x44')](_0x40f70d[_0x38df('0x39')],_0x246120['filters']));_0x431d18[_0x38df('0x43')][_0x38df('0x5a')]=_0x5e0a29['id'];if(_0x40f70d['query'][_0x38df('0x45')]){_0x431d18['where']=_['merge'](_0x431d18[_0x38df('0x43')],{'$or':_[_0x38df('0x38')](_0x431d18[_0x38df('0x3d')],function(_0x25a6f5){var _0x261c12={};_0x261c12[_0x25a6f5]={'$like':'%'+_0x40f70d['query'][_0x38df('0x45')]+'%'};return _0x261c12;})});}_0x431d18=_[_0x38df('0x46')]({},_0x431d18,_0x40f70d[_0x38df('0x48')]);return db[_0x38df('0x59')][_0x38df('0x5b')](_0x431d18);}})[_0x38df('0x2a')](function(_0x19a0f4){if(_0x19a0f4){return db[_0x38df('0x5c')][_0x38df('0x5d')]({'where':{'id':_[_0x38df('0x38')](_0x19a0f4,_0x38df('0x5e')),'role':_0x38df('0x5f')},'attributes':['id',_0x38df('0x30'),'smsPause',_0x38df('0x60'),_0x38df('0x61')]});}})['then'](function(_0x2ce769){if(_0x2ce769){return{'count':_0x2ce769[_0x38df('0x25')],'rows':_['map'](_0x2ce769[_0x38df('0x4b')],function(_0x1e9aa3){return{'membername':_0x1e9aa3[_0x38df('0x30')],'UserId':_0x1e9aa3['id'],'queue_name':_0x8d870[_0x38df('0x30')],'SmsQueueId':_0x8d870['id'],'interface':util[_0x38df('0x62')](_0x38df('0x63'),'SIP',_0x1e9aa3['name']),'penalty':0x0,'paused':_0x1e9aa3[_0x38df('0x64')],'createdAt':_0x1e9aa3[_0x38df('0x61')],'updatedAt':_0x1e9aa3[_0x38df('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x38df('0x2a')](respondWithFilteredResult(_0x42cea8,_0x431d18))['catch'](handleError(_0x42cea8,null));};exports['getTeams']=function(_0x4738c5,_0x5dceb0,_0x3c62d8){var _0x4975ba={};var _0xe91a8b={};var _0x1d8bd8;var _0xdd3d52;return db['SmsQueue']['findOne']({'where':{'id':_0x4738c5[_0x38df('0x4e')]['id']}})[_0x38df('0x2a')](handleEntityNotFound(_0x5dceb0,null))[_0x38df('0x2a')](function(_0x2842ce){if(_0x2842ce){_0x1d8bd8=_0x2842ce;_0xe91a8b[_0x38df('0x37')]=_[_0x38df('0x3a')](db[_0x38df('0x65')][_0x38df('0x33')]);_0xe91a8b[_0x38df('0x39')]=_[_0x38df('0x3a')](_0x4738c5[_0x38df('0x39')]);_0xe91a8b[_0x38df('0x3b')]=_['intersection'](_0xe91a8b[_0x38df('0x37')],_0xe91a8b[_0x38df('0x39')]);_0x4975ba[_0x38df('0x3d')]=_[_0x38df('0x3c')](_0xe91a8b[_0x38df('0x37')],qs[_0x38df('0x3e')](_0x4738c5['query'][_0x38df('0x3e')]));_0x4975ba[_0x38df('0x3d')]=_0x4975ba[_0x38df('0x3d')][_0x38df('0x3f')]?_0x4975ba[_0x38df('0x3d')]:_0xe91a8b[_0x38df('0x37')];_0x4975ba['order']=qs['sort'](_0x4738c5[_0x38df('0x39')][_0x38df('0x42')]);_0x4975ba['where']=qs[_0x38df('0x3b')](_[_0x38df('0x44')](_0x4738c5[_0x38df('0x39')],_0xe91a8b[_0x38df('0x3b')]));if(_0x4738c5[_0x38df('0x39')][_0x38df('0x45')]){_0x4975ba['where']=_[_0x38df('0x46')](_0x4975ba['where'],{'$or':_[_0x38df('0x38')](_0x4975ba[_0x38df('0x3d')],function(_0x415f8c){var _0x4f6133={};_0x4f6133[_0x415f8c]={'$like':'%'+_0x4738c5['query'][_0x38df('0x45')]+'%'};return _0x4f6133;})});}_0x4975ba=_[_0x38df('0x46')]({},_0x4975ba,_0x4738c5[_0x38df('0x48')]);return _0x1d8bd8['getTeams'](_0x4975ba);}})[_0x38df('0x2a')](function(_0x43a5f2){if(_0x43a5f2){_0xdd3d52=_0x43a5f2[_0x38df('0x3f')];if(!_0x4738c5[_0x38df('0x39')][_0x38df('0x40')]('nolimit')){_0x4975ba[_0x38df('0x24')]=qs[_0x38df('0x24')](_0x4738c5[_0x38df('0x39')][_0x38df('0x24')]);_0x4975ba[_0x38df('0x22')]=qs[_0x38df('0x22')](_0x4738c5[_0x38df('0x39')]['offset']);}return _0x1d8bd8[_0x38df('0x66')](_0x4975ba);}})[_0x38df('0x2a')](function(_0x10d349){if(_0x10d349){return _0x10d349?{'count':_0xdd3d52,'rows':_0x10d349}:null;}})[_0x38df('0x2a')](respondWithResult(_0x5dceb0,null))[_0x38df('0x4c')](handleError(_0x5dceb0,null));};exports['addTeams']=function(_0x48dbb7,_0x10b957,_0x9bfb7){var _0x2e6074=_0x48dbb7[_0x38df('0x56')]['ids'];return db[_0x38df('0x65')][_0x38df('0x5b')]({'where':{'id':_0x2e6074},'attributes':['id'],'include':[{'model':db['User'],'as':_0x38df('0x67'),'attributes':['id',_0x38df('0x30'),'online','voicePause',_0x38df('0x68')],'raw':!![]}]})[_0x38df('0x2a')](function(_0x4f7059){if(_0x4f7059){var _0x3eb21d=_['flatMap'](_0x4f7059,function(_0x247df1){var _0x3d7f54=_0x247df1[_0x38df('0x2c')]({'plain':!![]});return _0x3d7f54[_0x38df('0x67')];});return db[_0x38df('0x32')][_0x38df('0x52')]({'where':{'id':_0x48dbb7['params']['id']}})['then'](function(_0x430e8e){return db[_0x38df('0x69')][_0x38df('0x6a')](function(_0x2c90fc){return _0x430e8e[_0x38df('0x6b')](_0x2e6074,{'transaction':_0x2c90fc})['then'](function(){return BPromise[_0x38df('0x6c')](_0x3eb21d,function(_0x317370){return db[_0x38df('0x59')][_0x38df('0x6d')]({'where':{'UserId':_0x317370['id'],'SmsQueueId':_0x48dbb7[_0x38df('0x4e')]['id']},'transaction':_0x2c90fc});});})[_0x38df('0x2a')](function(){_0x3eb21d[_0x38df('0x6e')](function(_0x40425c){socket[_0x38df('0x6f')]('userSmsQueue:save',{'UserId':_0x40425c['id'],'SmsQueueId':_0x430e8e['id']});});});});});}})[_0x38df('0x2a')](respondWithStatusCode(_0x10b957,null))[_0x38df('0x4c')](handleError(_0x10b957,null));};exports[_0x38df('0x70')]=function(_0x160a56,_0x5d2828,_0x59b15d){return db[_0x38df('0x65')][_0x38df('0x5b')]({'where':{'id':_0x160a56[_0x38df('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x38df('0x5c')],'as':_0x38df('0x67'),'attributes':['id'],'raw':!![]}]})[_0x38df('0x2a')](handleEntityNotFound(_0x5d2828,null))[_0x38df('0x2a')](function(_0x5b8e32){var _0x87615c=_[_0x38df('0x38')](_0x5b8e32,'id');var _0x15c48e=[];var _0x1c9627=[];var _0x492193=squel[_0x38df('0x71')]();_0x492193[_0x38df('0x72')](_0x38df('0x73'))['from'](_0x38df('0x74'),'tq')[_0x38df('0x75')](_0x38df('0x76'),'ut',_0x38df('0x77'))[_0x38df('0x43')](_0x38df('0x78'),_0x160a56[_0x38df('0x4e')]['id']);for(var _0x9a38af=0x0;_0x9a38af<_0x5b8e32[_0x38df('0x3f')];_0x9a38af+=0x1){let _0x11b5ef=_0x5b8e32[_0x9a38af];for(var _0x54c3eb=0x0;_0x54c3eb<_0x11b5ef[_0x38df('0x67')][_0x38df('0x3f')];_0x54c3eb+=0x1){let _0x523ae8=_0x11b5ef[_0x38df('0x67')][_0x54c3eb];var _0x4e3c5d=_0x492193[_0x38df('0x79')]();_0x4e3c5d['where'](_0x38df('0x7a'),_0x523ae8['id']);_0x1c9627[_0x38df('0x7b')](db['sequelize'][_0x38df('0x39')](_0x4e3c5d[_0x38df('0x7c')](),{'type':db[_0x38df('0x69')][_0x38df('0x7d')][_0x38df('0x7e')]})[_0x38df('0x2a')](function(_0x49f5b3){if(_0x49f5b3[_0x38df('0x3f')]===0x1){return _0x523ae8['id'];}else{var _0x5f1cf9=_['every'](_[_0x38df('0x38')](_0x49f5b3,_0x38df('0x7f')),function(_0x24c69e){return _['includes'](_0x87615c,_0x24c69e);});if(_0x5f1cf9){return _0x523ae8['id'];}}}));}}return BPromise[_0x38df('0x80')](_0x1c9627)['then'](function(_0x1468ab){_0x15c48e=_(_0x15c48e)[_0x38df('0x81')](_0x1468ab)['compact']()[_0x38df('0x82')]();return db['SmsQueue'][_0x38df('0x52')]({'where':{'id':_0x160a56[_0x38df('0x4e')]['id']}})[_0x38df('0x2a')](function(_0x51fc73){return db[_0x38df('0x69')][_0x38df('0x6a')](function(_0x24cd12){return _0x51fc73[_0x38df('0x70')](_0x160a56[_0x38df('0x39')][_0x38df('0x83')],{'transaction':_0x24cd12})[_0x38df('0x2a')](function(){if(!_[_0x38df('0x84')](_0x15c48e)){return _0x51fc73['removeAgents'](_0x15c48e,{'transaction':_0x24cd12});}})[_0x38df('0x2a')](function(){_0x15c48e[_0x38df('0x6e')](function(_0x27e692){socket['emit'](_0x38df('0x85'),{'UserId':_0x27e692,'SmsQueueId':_0x51fc73['id']});});});});});});})[_0x38df('0x2a')](respondWithStatusCode(_0x5d2828,null))[_0x38df('0x4c')](handleError(_0x5d2828,null));};exports['addAgents']=function(_0x459d12,_0x1d861b,_0xf15bf8){return db[_0x38df('0x32')][_0x38df('0x52')]({'where':{'id':_0x459d12[_0x38df('0x4e')]['id']}})[_0x38df('0x2a')](handleEntityNotFound(_0x1d861b,null))[_0x38df('0x2a')](function(_0x466266){if(_0x466266){return _0x466266[_0x38df('0x86')](_0x459d12[_0x38df('0x56')][_0x38df('0x83')],_[_0x38df('0x87')](_0x459d12[_0x38df('0x56')],[_0x38df('0x83'),'id'])||{})[_0x38df('0x88')](function(_0x213f62){for(var _0x2a71c2=0x0;_0x2a71c2<_0x459d12[_0x38df('0x56')][_0x38df('0x83')]['length'];_0x2a71c2+=0x1){socket[_0x38df('0x6f')](_0x38df('0x89'),{'UserId':_0x459d12['body'][_0x38df('0x83')][_0x2a71c2],'SmsQueueId':_0x459d12[_0x38df('0x4e')]['id']});}return _0x213f62;});}})[_0x38df('0x2a')](respondWithResult(_0x1d861b,null))[_0x38df('0x4c')](handleError(_0x1d861b,null));};exports[_0x38df('0x8a')]=function(_0x484825,_0x4cbb81,_0x128739){return db[_0x38df('0x32')][_0x38df('0x52')]({'where':{'id':_0x484825[_0x38df('0x4e')]['id']}})[_0x38df('0x2a')](handleEntityNotFound(_0x4cbb81,null))['then'](function(_0x1ecd2a){if(_0x1ecd2a){return _0x1ecd2a[_0x38df('0x8a')](_0x484825[_0x38df('0x39')][_0x38df('0x83')])[_0x38df('0x2a')](function(){if(_[_0x38df('0x8b')](_0x484825[_0x38df('0x39')][_0x38df('0x83')])){for(var _0x4a335c=0x0;_0x4a335c<_0x484825[_0x38df('0x39')][_0x38df('0x83')][_0x38df('0x3f')];_0x4a335c+=0x1){socket[_0x38df('0x6f')](_0x38df('0x85'),{'UserId':Number(_0x484825['query'][_0x38df('0x83')][_0x4a335c]),'SmsQueueId':Number(_0x484825[_0x38df('0x4e')]['id'])});}}else{socket[_0x38df('0x6f')](_0x38df('0x85'),{'UserId':Number(_0x484825[_0x38df('0x39')][_0x38df('0x83')]),'SmsQueueId':Number(_0x484825[_0x38df('0x4e')]['id'])});}});}})[_0x38df('0x2a')](respondWithStatusCode(_0x4cbb81,null))[_0x38df('0x4c')](handleError(_0x4cbb81,null));};exports[_0x38df('0x8c')]=function(_0x32bd6c,_0x2f7a9a,_0x24befb){var _0x12fc23={};var _0x4dff09={};var _0xf2226e;var _0x160a67;return db[_0x38df('0x32')][_0x38df('0x8d')]({'where':{'id':_0x32bd6c[_0x38df('0x4e')]['id']}})[_0x38df('0x2a')](handleEntityNotFound(_0x2f7a9a,null))[_0x38df('0x2a')](function(_0x553fa2){if(_0x553fa2){_0xf2226e=_0x553fa2;_0x4dff09[_0x38df('0x37')]=_[_0x38df('0x3a')](db[_0x38df('0x5c')]['rawAttributes']);_0x4dff09[_0x38df('0x39')]=_[_0x38df('0x3a')](_0x32bd6c[_0x38df('0x39')]);_0x4dff09['filters']=_[_0x38df('0x3c')](_0x4dff09[_0x38df('0x37')],_0x4dff09[_0x38df('0x39')]);_0x12fc23[_0x38df('0x3d')]=_[_0x38df('0x3c')](_0x4dff09[_0x38df('0x37')],qs[_0x38df('0x3e')](_0x32bd6c[_0x38df('0x39')][_0x38df('0x3e')]));_0x12fc23[_0x38df('0x3d')]=_0x12fc23[_0x38df('0x3d')][_0x38df('0x3f')]?_0x12fc23[_0x38df('0x3d')]:_0x4dff09[_0x38df('0x37')];_0x12fc23[_0x38df('0x41')]=qs[_0x38df('0x42')](_0x32bd6c[_0x38df('0x39')][_0x38df('0x42')]);_0x12fc23['where']=qs[_0x38df('0x3b')](_[_0x38df('0x44')](_0x32bd6c[_0x38df('0x39')],_0x4dff09[_0x38df('0x3b')]));if(_0x32bd6c[_0x38df('0x39')][_0x38df('0x45')]){_0x12fc23[_0x38df('0x43')]=_['merge'](_0x12fc23[_0x38df('0x43')],{'$or':_[_0x38df('0x38')](_0x12fc23[_0x38df('0x3d')],function(_0x3b15b0){var _0x5096ab={};_0x5096ab[_0x3b15b0]={'$like':'%'+_0x32bd6c[_0x38df('0x39')][_0x38df('0x45')]+'%'};return _0x5096ab;})});}_0x12fc23=_['merge']({},_0x12fc23,_0x32bd6c['options']);return _0xf2226e[_0x38df('0x8c')](_0x12fc23);}})[_0x38df('0x2a')](function(_0x2d134d){if(_0x2d134d){_0x160a67=_0x2d134d['length'];if(!_0x32bd6c[_0x38df('0x39')][_0x38df('0x40')]('nolimit')){_0x12fc23[_0x38df('0x24')]=qs[_0x38df('0x24')](_0x32bd6c['query'][_0x38df('0x24')]);_0x12fc23[_0x38df('0x22')]=qs[_0x38df('0x22')](_0x32bd6c[_0x38df('0x39')][_0x38df('0x22')]);}return _0xf2226e[_0x38df('0x8c')](_0x12fc23);}})[_0x38df('0x2a')](function(_0x50ae8a){if(_0x50ae8a){return _0x50ae8a?{'count':_0x160a67,'rows':_0x50ae8a}:null;}})[_0x38df('0x2a')](respondWithResult(_0x2f7a9a,null))[_0x38df('0x4c')](handleError(_0x2f7a9a,null));}; \ No newline at end of file +var _0x454d=['SmsQueue','rawAttributes','fieldName','type','model','name','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','merge','User','findAndCountAll','smsPause','updatedAt','createdAt','format','%s/%s','SIP','Team','pick','getTeams','addTeams','ids','interface','Agents','transaction','findOrCreate','forEach','emit','userSmsQueue:save','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./smsQueue.socket','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','apply','save','update','then','get','SmsQueues','UserProfileResource','destroy','error','stack','send','index','map'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x454d,0xe2));var _0xd454=function(_0x571852,_0x34ae1f){_0x571852=_0x571852-0x0;var _0x1ec365=_0x454d[_0x571852];return _0x1ec365;};'use strict';var emlformat=require(_0xd454('0x0'));var rimraf=require(_0xd454('0x1'));var zipdir=require(_0xd454('0x2'));var jsonpatch=require(_0xd454('0x3'));var rp=require('request-promise');var moment=require(_0xd454('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd454('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xd454('0x6'));var ejs=require(_0xd454('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd454('0x8'));var squel=require(_0xd454('0x9'));var crypto=require(_0xd454('0xa'));var jsforce=require(_0xd454('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd454('0xc'));var authService=require(_0xd454('0xd'));var qs=require(_0xd454('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd454('0xf'))(_0xd454('0x10'));var utils=require(_0xd454('0x11'));var config=require(_0xd454('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xd454('0x13'))['db'];config['redis']=_[_0xd454('0x14')](config[_0xd454('0x15')],{'host':_0xd454('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd454('0x15')]));require(_0xd454('0x17'))[_0xd454('0x18')](socket);function respondWithStatusCode(_0xcee377,_0x5eca44){_0x5eca44=_0x5eca44||0xcc;return function(_0x26ff6e){if(_0x26ff6e){return _0xcee377[_0xd454('0x19')](_0x5eca44);}return _0xcee377[_0xd454('0x1a')](_0x5eca44)[_0xd454('0x1b')]();};}function respondWithResult(_0x1dd487,_0x512c31){_0x512c31=_0x512c31||0xc8;return function(_0x4e380d){if(_0x4e380d){return _0x1dd487[_0xd454('0x1a')](_0x512c31)['json'](_0x4e380d);}};}function respondWithFilteredResult(_0x2fd27f,_0x1fd9d5){return function(_0x1dbc9d){if(_0x1dbc9d){var _0x252df4=typeof _0x1fd9d5[_0xd454('0x1c')]==='undefined'&&typeof _0x1fd9d5['limit']===_0xd454('0x1d');var _0x1a519d=_0x1dbc9d[_0xd454('0x1e')];var _0x4889dd=_0x252df4?0x0:_0x1fd9d5['offset'];var _0x595bd4=_0x252df4?_0x1dbc9d[_0xd454('0x1e')]:_0x1fd9d5['offset']+_0x1fd9d5['limit'];var _0x5b0ea3;if(_0x595bd4>=_0x1a519d){_0x595bd4=_0x1a519d;_0x5b0ea3=0xc8;}else{_0x5b0ea3=0xce;}_0x2fd27f[_0xd454('0x1a')](_0x5b0ea3);return _0x2fd27f[_0xd454('0x1f')](_0xd454('0x20'),_0x4889dd+'-'+_0x595bd4+'/'+_0x1a519d)['json'](_0x1dbc9d);}return null;};}function patchUpdates(_0x12ce55){return function(_0x123454){try{jsonpatch[_0xd454('0x21')](_0x123454,_0x12ce55,!![]);}catch(_0x5a19c8){return BPromise['reject'](_0x5a19c8);}return _0x123454[_0xd454('0x22')]();};}function saveUpdates(_0x50e653,_0x555ac0){return function(_0x368e47){if(_0x368e47){return _0x368e47[_0xd454('0x23')](_0x50e653)[_0xd454('0x24')](function(_0x3f59ae){return _0x3f59ae;});}return null;};}function removeEntity(_0x5c7108,_0x11d521){return function(_0x37c7cd){if(_0x37c7cd){return _0x37c7cd['destroy']()[_0xd454('0x24')](function(){var _0x530888=_0x37c7cd[_0xd454('0x25')]({'plain':!![]});var _0x245294=_0xd454('0x26');return db[_0xd454('0x27')][_0xd454('0x28')]({'where':{'type':_0x245294,'resourceId':_0x530888['id']}})['then'](function(){return _0x37c7cd;});})[_0xd454('0x24')](function(){_0x5c7108[_0xd454('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c62e6,_0x27f435){return function(_0xbc4b8e){if(!_0xbc4b8e){_0x4c62e6['sendStatus'](0x194);}return _0xbc4b8e;};}function handleError(_0x3ed788,_0x39e16d){_0x39e16d=_0x39e16d||0x1f4;return function(_0x585bbc){logger[_0xd454('0x29')](_0x585bbc[_0xd454('0x2a')]);if(_0x585bbc['name']){delete _0x585bbc['name'];}_0x3ed788[_0xd454('0x1a')](_0x39e16d)[_0xd454('0x2b')](_0x585bbc);};}exports[_0xd454('0x2c')]=function(_0x1d5fae,_0x3c0215){var _0x866297={},_0x130a35={},_0x27afb6={'count':0x0,'rows':[]};var _0x446f1b=_[_0xd454('0x2d')](db[_0xd454('0x2e')][_0xd454('0x2f')],function(_0x2cbda9){return{'name':_0x2cbda9[_0xd454('0x30')],'type':_0x2cbda9[_0xd454('0x31')]['key']};});_0x130a35[_0xd454('0x32')]=_['map'](_0x446f1b,_0xd454('0x33'));_0x130a35['query']=_['keys'](_0x1d5fae['query']);_0x130a35['filters']=_[_0xd454('0x34')](_0x130a35[_0xd454('0x32')],_0x130a35['query']);_0x866297[_0xd454('0x35')]=_[_0xd454('0x34')](_0x130a35[_0xd454('0x32')],qs[_0xd454('0x36')](_0x1d5fae[_0xd454('0x37')][_0xd454('0x36')]));_0x866297['attributes']=_0x866297[_0xd454('0x35')][_0xd454('0x38')]?_0x866297[_0xd454('0x35')]:_0x130a35['model'];if(!_0x1d5fae[_0xd454('0x37')][_0xd454('0x39')](_0xd454('0x3a'))){_0x866297[_0xd454('0x3b')]=qs[_0xd454('0x3b')](_0x1d5fae[_0xd454('0x37')][_0xd454('0x3b')]);_0x866297[_0xd454('0x1c')]=qs['offset'](_0x1d5fae[_0xd454('0x37')][_0xd454('0x1c')]);}_0x866297[_0xd454('0x3c')]=qs[_0xd454('0x3d')](_0x1d5fae[_0xd454('0x37')][_0xd454('0x3d')]);_0x866297[_0xd454('0x3e')]=qs[_0xd454('0x3f')](_['pick'](_0x1d5fae[_0xd454('0x37')],_0x130a35[_0xd454('0x3f')]),_0x446f1b);if(_0x1d5fae[_0xd454('0x37')][_0xd454('0x40')]){_0x866297[_0xd454('0x3e')]=_['merge'](_0x866297[_0xd454('0x3e')],{'$or':_['map'](_0x446f1b,function(_0x3dac02){if(_0x3dac02[_0xd454('0x31')]!=='VIRTUAL'){var _0x5e318b={};_0x5e318b[_0x3dac02[_0xd454('0x33')]]={'$like':'%'+_0x1d5fae[_0xd454('0x37')][_0xd454('0x40')]+'%'};return _0x5e318b;}})});}_0x866297=_['merge']({},_0x866297,_0x1d5fae['options']);var _0x92d6a1={'where':_0x866297['where']};return db['SmsQueue'][_0xd454('0x1e')](_0x92d6a1)['then'](function(_0x3efccf){_0x27afb6[_0xd454('0x1e')]=_0x3efccf;if(_0x1d5fae[_0xd454('0x37')][_0xd454('0x41')]){_0x866297[_0xd454('0x42')]=[{'all':!![]}];}return db[_0xd454('0x2e')][_0xd454('0x43')](_0x866297);})[_0xd454('0x24')](function(_0x22f90b){_0x27afb6[_0xd454('0x44')]=_0x22f90b;return _0x27afb6;})[_0xd454('0x24')](respondWithFilteredResult(_0x3c0215,_0x866297))[_0xd454('0x45')](handleError(_0x3c0215,null));};exports[_0xd454('0x46')]=function(_0x487b9b,_0x4c3c6c){var _0x5f448f={'raw':!![],'where':{'id':_0x487b9b[_0xd454('0x47')]['id']}},_0xa24f79={};_0xa24f79[_0xd454('0x32')]=_[_0xd454('0x48')](db[_0xd454('0x2e')][_0xd454('0x2f')]);_0xa24f79[_0xd454('0x37')]=_['keys'](_0x487b9b[_0xd454('0x37')]);_0xa24f79[_0xd454('0x3f')]=_[_0xd454('0x34')](_0xa24f79[_0xd454('0x32')],_0xa24f79[_0xd454('0x37')]);_0x5f448f[_0xd454('0x35')]=_[_0xd454('0x34')](_0xa24f79['model'],qs[_0xd454('0x36')](_0x487b9b[_0xd454('0x37')][_0xd454('0x36')]));_0x5f448f[_0xd454('0x35')]=_0x5f448f[_0xd454('0x35')]['length']?_0x5f448f[_0xd454('0x35')]:_0xa24f79[_0xd454('0x32')];if(_0x487b9b[_0xd454('0x37')][_0xd454('0x41')]){_0x5f448f[_0xd454('0x42')]=[{'all':!![]}];}_0x5f448f=_['merge']({},_0x5f448f,_0x487b9b[_0xd454('0x49')]);return db[_0xd454('0x2e')][_0xd454('0x4a')](_0x5f448f)[_0xd454('0x24')](handleEntityNotFound(_0x4c3c6c,null))[_0xd454('0x24')](respondWithResult(_0x4c3c6c,null))[_0xd454('0x45')](handleError(_0x4c3c6c,null));};exports[_0xd454('0x4b')]=function(_0x53a47e,_0x5aa328){return db[_0xd454('0x2e')][_0xd454('0x4b')](_0x53a47e[_0xd454('0x4c')],{})[_0xd454('0x24')](function(_0x48ab76){var _0x4b84a1=_0x53a47e[_0xd454('0x4d')][_0xd454('0x25')]({'plain':!![]});if(!_0x4b84a1)throw new Error(_0xd454('0x4e'));if(_0x4b84a1[_0xd454('0x4f')]===_0xd454('0x4d')){var _0x586f0e=_0x48ab76[_0xd454('0x25')]({'plain':!![]});var _0x1310cc='SmsQueues';return db['UserProfileSection'][_0xd454('0x4a')]({'where':{'name':_0x1310cc,'userProfileId':_0x4b84a1[_0xd454('0x50')]},'raw':!![]})[_0xd454('0x24')](function(_0x3b4c34){if(_0x3b4c34&&_0x3b4c34[_0xd454('0x51')]===0x0){return db[_0xd454('0x27')][_0xd454('0x4b')]({'name':_0x586f0e['name'],'resourceId':_0x586f0e['id'],'type':_0x3b4c34['name'],'sectionId':_0x3b4c34['id']},{})['then'](function(){return _0x48ab76;});}else{return _0x48ab76;}})['catch'](function(_0x541b73){logger[_0xd454('0x29')](_0xd454('0x52'),_0x541b73);throw _0x541b73;});}return _0x48ab76;})[_0xd454('0x24')](respondWithResult(_0x5aa328,0xc9))[_0xd454('0x45')](handleError(_0x5aa328,null));};exports['update']=function(_0x1fad6b,_0x30de48){if(_0x1fad6b[_0xd454('0x4c')]['id']){delete _0x1fad6b[_0xd454('0x4c')]['id'];}return db['SmsQueue'][_0xd454('0x4a')]({'where':{'id':_0x1fad6b[_0xd454('0x47')]['id']}})[_0xd454('0x24')](handleEntityNotFound(_0x30de48,null))[_0xd454('0x24')](saveUpdates(_0x1fad6b['body'],null))['then'](respondWithResult(_0x30de48,null))[_0xd454('0x45')](handleError(_0x30de48,null));};exports[_0xd454('0x28')]=function(_0x48eb92,_0x23dbca){return db[_0xd454('0x2e')]['find']({'where':{'id':_0x48eb92[_0xd454('0x47')]['id']}})[_0xd454('0x24')](handleEntityNotFound(_0x23dbca,null))[_0xd454('0x24')](removeEntity(_0x23dbca,null))[_0xd454('0x45')](handleError(_0x23dbca,null));};exports[_0xd454('0x53')]=function(_0x4504b5,_0x1fadf4){return db[_0xd454('0x2e')][_0xd454('0x53')]()[_0xd454('0x24')](respondWithResult(_0x1fadf4,null))[_0xd454('0x45')](handleError(_0x1fadf4,null));};exports[_0xd454('0x54')]=function(_0x149ba2,_0x32e3bc,_0x4278dd){var _0x2ea1ce={'raw':!![],'where':{}},_0x51870a={},_0x57ac57;return db[_0xd454('0x2e')][_0xd454('0x55')]({'where':{'id':_0x149ba2[_0xd454('0x47')]['id']}})[_0xd454('0x24')](handleEntityNotFound(_0x32e3bc,null))['then'](function(_0x21152a){if(_0x21152a){_0x57ac57=_0x21152a[_0xd454('0x25')]({'plain':!![]});_0x51870a[_0xd454('0x32')]=_[_0xd454('0x48')](db[_0xd454('0x56')][_0xd454('0x2f')]);_0x51870a['query']=_[_0xd454('0x48')](_0x149ba2['query']);_0x51870a[_0xd454('0x3f')]=_[_0xd454('0x34')](_0x51870a[_0xd454('0x32')],_0x51870a[_0xd454('0x37')]);_0x2ea1ce['attributes']=_[_0xd454('0x34')](_0x51870a[_0xd454('0x32')],qs[_0xd454('0x36')](_0x149ba2[_0xd454('0x37')]['fields']));_0x2ea1ce['attributes']=_0x2ea1ce['attributes'][_0xd454('0x38')]?_0x2ea1ce[_0xd454('0x35')]:_0x51870a['model'];if(!_0x149ba2[_0xd454('0x37')][_0xd454('0x39')](_0xd454('0x3a'))){_0x2ea1ce['limit']=qs[_0xd454('0x3b')](_0x149ba2[_0xd454('0x37')]['limit']);_0x2ea1ce['offset']=qs['offset'](_0x149ba2[_0xd454('0x37')]['offset']);}_0x2ea1ce[_0xd454('0x3c')]=qs[_0xd454('0x3d')](_0x149ba2[_0xd454('0x37')][_0xd454('0x3d')]);_0x2ea1ce[_0xd454('0x3e')]=qs['filters'](_['pick'](_0x149ba2[_0xd454('0x37')],_0x51870a[_0xd454('0x3f')]));_0x2ea1ce[_0xd454('0x3e')][_0xd454('0x57')]=_0x21152a['id'];if(_0x149ba2[_0xd454('0x37')][_0xd454('0x40')]){_0x2ea1ce[_0xd454('0x3e')]=_[_0xd454('0x58')](_0x2ea1ce['where'],{'$or':_[_0xd454('0x2d')](_0x2ea1ce['attributes'],function(_0x7d5be4){var _0x40d500={};_0x40d500[_0x7d5be4]={'$like':'%'+_0x149ba2['query']['filter']+'%'};return _0x40d500;})});}_0x2ea1ce=_[_0xd454('0x58')]({},_0x2ea1ce,_0x149ba2[_0xd454('0x49')]);return db[_0xd454('0x56')][_0xd454('0x43')](_0x2ea1ce);}})[_0xd454('0x24')](function(_0x4a52b1){if(_0x4a52b1){return db[_0xd454('0x59')][_0xd454('0x5a')]({'where':{'id':_[_0xd454('0x2d')](_0x4a52b1,'UserId'),'role':'agent'},'attributes':['id',_0xd454('0x33'),_0xd454('0x5b'),_0xd454('0x5c'),_0xd454('0x5d')]});}})['then'](function(_0x3170db){if(_0x3170db){return{'count':_0x3170db['count'],'rows':_['map'](_0x3170db[_0xd454('0x44')],function(_0x274d54){return{'membername':_0x274d54[_0xd454('0x33')],'UserId':_0x274d54['id'],'queue_name':_0x57ac57[_0xd454('0x33')],'SmsQueueId':_0x57ac57['id'],'interface':util[_0xd454('0x5e')](_0xd454('0x5f'),_0xd454('0x60'),_0x274d54[_0xd454('0x33')]),'penalty':0x0,'paused':_0x274d54['smsPause'],'createdAt':_0x274d54[_0xd454('0x5d')],'updatedAt':_0x274d54[_0xd454('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd454('0x24')](respondWithFilteredResult(_0x32e3bc,_0x2ea1ce))[_0xd454('0x45')](handleError(_0x32e3bc,null));};exports['getTeams']=function(_0x1f46e7,_0x506162,_0x1a6f3a){var _0x435910={};var _0xec0cb1={};var _0x24a857;var _0x383634;return db[_0xd454('0x2e')][_0xd454('0x55')]({'where':{'id':_0x1f46e7[_0xd454('0x47')]['id']}})[_0xd454('0x24')](handleEntityNotFound(_0x506162,null))[_0xd454('0x24')](function(_0x2809f5){if(_0x2809f5){_0x24a857=_0x2809f5;_0xec0cb1[_0xd454('0x32')]=_[_0xd454('0x48')](db[_0xd454('0x61')][_0xd454('0x2f')]);_0xec0cb1[_0xd454('0x37')]=_['keys'](_0x1f46e7[_0xd454('0x37')]);_0xec0cb1[_0xd454('0x3f')]=_[_0xd454('0x34')](_0xec0cb1[_0xd454('0x32')],_0xec0cb1[_0xd454('0x37')]);_0x435910[_0xd454('0x35')]=_[_0xd454('0x34')](_0xec0cb1[_0xd454('0x32')],qs[_0xd454('0x36')](_0x1f46e7[_0xd454('0x37')]['fields']));_0x435910['attributes']=_0x435910[_0xd454('0x35')]['length']?_0x435910[_0xd454('0x35')]:_0xec0cb1['model'];_0x435910[_0xd454('0x3c')]=qs[_0xd454('0x3d')](_0x1f46e7[_0xd454('0x37')]['sort']);_0x435910[_0xd454('0x3e')]=qs['filters'](_[_0xd454('0x62')](_0x1f46e7[_0xd454('0x37')],_0xec0cb1['filters']));if(_0x1f46e7['query'][_0xd454('0x40')]){_0x435910[_0xd454('0x3e')]=_['merge'](_0x435910[_0xd454('0x3e')],{'$or':_[_0xd454('0x2d')](_0x435910[_0xd454('0x35')],function(_0x4e1047){var _0x2c9e2b={};_0x2c9e2b[_0x4e1047]={'$like':'%'+_0x1f46e7[_0xd454('0x37')][_0xd454('0x40')]+'%'};return _0x2c9e2b;})});}_0x435910=_[_0xd454('0x58')]({},_0x435910,_0x1f46e7[_0xd454('0x49')]);return _0x24a857[_0xd454('0x63')](_0x435910);}})[_0xd454('0x24')](function(_0x501654){if(_0x501654){_0x383634=_0x501654[_0xd454('0x38')];if(!_0x1f46e7[_0xd454('0x37')]['hasOwnProperty']('nolimit')){_0x435910[_0xd454('0x3b')]=qs[_0xd454('0x3b')](_0x1f46e7[_0xd454('0x37')]['limit']);_0x435910[_0xd454('0x1c')]=qs['offset'](_0x1f46e7['query'][_0xd454('0x1c')]);}return _0x24a857[_0xd454('0x63')](_0x435910);}})[_0xd454('0x24')](function(_0x3747eb){if(_0x3747eb){return _0x3747eb?{'count':_0x383634,'rows':_0x3747eb}:null;}})[_0xd454('0x24')](respondWithResult(_0x506162,null))['catch'](handleError(_0x506162,null));};exports[_0xd454('0x64')]=function(_0x15dd4b,_0x38f6ae,_0x4e80b5){var _0x3021dd=_0x15dd4b[_0xd454('0x4c')][_0xd454('0x65')];return db[_0xd454('0x61')][_0xd454('0x43')]({'where':{'id':_0x3021dd},'attributes':['id'],'include':[{'model':db[_0xd454('0x59')],'as':'Agents','attributes':['id',_0xd454('0x33'),'online','voicePause',_0xd454('0x66')],'raw':!![]}]})[_0xd454('0x24')](function(_0x20eb13){if(_0x20eb13){var _0x145333=_['flatMap'](_0x20eb13,function(_0x28e041){var _0x39b3ef=_0x28e041['get']({'plain':!![]});return _0x39b3ef[_0xd454('0x67')];});return db[_0xd454('0x2e')][_0xd454('0x4a')]({'where':{'id':_0x15dd4b['params']['id']}})[_0xd454('0x24')](function(_0x30c2ba){return db['sequelize'][_0xd454('0x68')](function(_0x2cc7d9){return _0x30c2ba[_0xd454('0x64')](_0x3021dd,{'transaction':_0x2cc7d9})['then'](function(){return BPromise['each'](_0x145333,function(_0x3d2ba1){return db[_0xd454('0x56')][_0xd454('0x69')]({'where':{'UserId':_0x3d2ba1['id'],'SmsQueueId':_0x15dd4b[_0xd454('0x47')]['id']},'transaction':_0x2cc7d9});});})['then'](function(){_0x145333[_0xd454('0x6a')](function(_0x25b382){socket[_0xd454('0x6b')](_0xd454('0x6c'),{'UserId':_0x25b382['id'],'SmsQueueId':_0x30c2ba['id']});});});});});}})[_0xd454('0x24')](respondWithStatusCode(_0x38f6ae,null))[_0xd454('0x45')](handleError(_0x38f6ae,null));};exports['removeTeams']=function(_0x22b261,_0x2276a9,_0x5d7ba2){return db['Team'][_0xd454('0x43')]({'where':{'id':_0x22b261[_0xd454('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd454('0x59')],'as':_0xd454('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2276a9,null))[_0xd454('0x24')](function(_0x18cb9d){var _0x15eae8=_[_0xd454('0x2d')](_0x18cb9d,'id');var _0x37f7fa=[];var _0x2f2bc5=[];var _0x482178=squel[_0xd454('0x6d')]();_0x482178[_0xd454('0x6e')](_0xd454('0x6f'))[_0xd454('0x70')](_0xd454('0x71'),'tq')[_0xd454('0x72')](_0xd454('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xd454('0x74'),_0x22b261[_0xd454('0x47')]['id']);for(var _0x270259=0x0;_0x270259<_0x18cb9d['length'];_0x270259+=0x1){let _0x49f066=_0x18cb9d[_0x270259];for(var _0xdff3f8=0x0;_0xdff3f8<_0x49f066[_0xd454('0x67')][_0xd454('0x38')];_0xdff3f8+=0x1){let _0xe9aa0a=_0x49f066[_0xd454('0x67')][_0xdff3f8];var _0x4e9f7e=_0x482178[_0xd454('0x75')]();_0x4e9f7e[_0xd454('0x3e')]('ut.UserId\x20=\x20?',_0xe9aa0a['id']);_0x2f2bc5[_0xd454('0x76')](db[_0xd454('0x77')][_0xd454('0x37')](_0x4e9f7e[_0xd454('0x78')](),{'type':db[_0xd454('0x77')][_0xd454('0x79')]['SELECT']})[_0xd454('0x24')](function(_0x15e64c){if(_0x15e64c[_0xd454('0x38')]===0x1){return _0xe9aa0a['id'];}else{var _0x854011=_[_0xd454('0x7a')](_['map'](_0x15e64c,_0xd454('0x7b')),function(_0x4e7482){return _[_0xd454('0x7c')](_0x15eae8,_0x4e7482);});if(_0x854011){return _0xe9aa0a['id'];}}}));}}return BPromise[_0xd454('0x7d')](_0x2f2bc5)[_0xd454('0x24')](function(_0x5d6e61){_0x37f7fa=_(_0x37f7fa)[_0xd454('0x7e')](_0x5d6e61)[_0xd454('0x7f')]()[_0xd454('0x80')]();return db[_0xd454('0x2e')][_0xd454('0x4a')]({'where':{'id':_0x22b261[_0xd454('0x47')]['id']}})[_0xd454('0x24')](function(_0xc96f82){return db[_0xd454('0x77')][_0xd454('0x68')](function(_0x488b80){return _0xc96f82[_0xd454('0x81')](_0x22b261[_0xd454('0x37')][_0xd454('0x65')],{'transaction':_0x488b80})[_0xd454('0x24')](function(){if(!_[_0xd454('0x82')](_0x37f7fa)){return _0xc96f82[_0xd454('0x83')](_0x37f7fa,{'transaction':_0x488b80});}})[_0xd454('0x24')](function(){_0x37f7fa[_0xd454('0x6a')](function(_0x98bbb5){socket['emit'](_0xd454('0x84'),{'UserId':_0x98bbb5,'SmsQueueId':_0xc96f82['id']});});});});});});})[_0xd454('0x24')](respondWithStatusCode(_0x2276a9,null))[_0xd454('0x45')](handleError(_0x2276a9,null));};exports[_0xd454('0x85')]=function(_0xcfc97f,_0x544313,_0x77870c){return db['SmsQueue'][_0xd454('0x4a')]({'where':{'id':_0xcfc97f['params']['id']}})[_0xd454('0x24')](handleEntityNotFound(_0x544313,null))[_0xd454('0x24')](function(_0x3e3cc2){if(_0x3e3cc2){return _0x3e3cc2[_0xd454('0x85')](_0xcfc97f[_0xd454('0x4c')][_0xd454('0x65')],_['omit'](_0xcfc97f['body'],['ids','id'])||{})['spread'](function(_0x556d3e){for(var _0x34430f=0x0;_0x34430f<_0xcfc97f[_0xd454('0x4c')][_0xd454('0x65')][_0xd454('0x38')];_0x34430f+=0x1){socket[_0xd454('0x6b')](_0xd454('0x6c'),{'UserId':_0xcfc97f[_0xd454('0x4c')][_0xd454('0x65')][_0x34430f],'SmsQueueId':_0xcfc97f[_0xd454('0x47')]['id']});}return _0x556d3e;});}})[_0xd454('0x24')](respondWithResult(_0x544313,null))['catch'](handleError(_0x544313,null));};exports[_0xd454('0x83')]=function(_0x343f63,_0x4d7a39,_0xedb37a){return db[_0xd454('0x2e')]['find']({'where':{'id':_0x343f63['params']['id']}})[_0xd454('0x24')](handleEntityNotFound(_0x4d7a39,null))[_0xd454('0x24')](function(_0x119ade){if(_0x119ade){return _0x119ade['removeAgents'](_0x343f63['query']['ids'])[_0xd454('0x24')](function(){if(_[_0xd454('0x86')](_0x343f63[_0xd454('0x37')][_0xd454('0x65')])){for(var _0x5f3239=0x0;_0x5f3239<_0x343f63[_0xd454('0x37')]['ids'][_0xd454('0x38')];_0x5f3239+=0x1){socket[_0xd454('0x6b')](_0xd454('0x84'),{'UserId':Number(_0x343f63[_0xd454('0x37')][_0xd454('0x65')][_0x5f3239]),'SmsQueueId':Number(_0x343f63['params']['id'])});}}else{socket['emit'](_0xd454('0x84'),{'UserId':Number(_0x343f63['query'][_0xd454('0x65')]),'SmsQueueId':Number(_0x343f63[_0xd454('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x4d7a39,null))[_0xd454('0x45')](handleError(_0x4d7a39,null));};exports[_0xd454('0x87')]=function(_0x5c85ea,_0x3cb545,_0x5dcf61){var _0x34cb05={};var _0x3e4093={};var _0x275b23;var _0x57627c;return db[_0xd454('0x2e')]['findOne']({'where':{'id':_0x5c85ea[_0xd454('0x47')]['id']}})[_0xd454('0x24')](handleEntityNotFound(_0x3cb545,null))[_0xd454('0x24')](function(_0x496aa1){if(_0x496aa1){_0x275b23=_0x496aa1;_0x3e4093[_0xd454('0x32')]=_[_0xd454('0x48')](db[_0xd454('0x59')][_0xd454('0x2f')]);_0x3e4093[_0xd454('0x37')]=_[_0xd454('0x48')](_0x5c85ea[_0xd454('0x37')]);_0x3e4093[_0xd454('0x3f')]=_['intersection'](_0x3e4093[_0xd454('0x32')],_0x3e4093['query']);_0x34cb05['attributes']=_[_0xd454('0x34')](_0x3e4093[_0xd454('0x32')],qs[_0xd454('0x36')](_0x5c85ea[_0xd454('0x37')]['fields']));_0x34cb05[_0xd454('0x35')]=_0x34cb05['attributes'][_0xd454('0x38')]?_0x34cb05[_0xd454('0x35')]:_0x3e4093[_0xd454('0x32')];_0x34cb05['order']=qs[_0xd454('0x3d')](_0x5c85ea[_0xd454('0x37')][_0xd454('0x3d')]);_0x34cb05['where']=qs['filters'](_[_0xd454('0x62')](_0x5c85ea[_0xd454('0x37')],_0x3e4093[_0xd454('0x3f')]));if(_0x5c85ea['query']['filter']){_0x34cb05[_0xd454('0x3e')]=_[_0xd454('0x58')](_0x34cb05['where'],{'$or':_['map'](_0x34cb05[_0xd454('0x35')],function(_0xb0494f){var _0x232a21={};_0x232a21[_0xb0494f]={'$like':'%'+_0x5c85ea[_0xd454('0x37')][_0xd454('0x40')]+'%'};return _0x232a21;})});}_0x34cb05=_[_0xd454('0x58')]({},_0x34cb05,_0x5c85ea[_0xd454('0x49')]);return _0x275b23[_0xd454('0x87')](_0x34cb05);}})[_0xd454('0x24')](function(_0x2abb81){if(_0x2abb81){_0x57627c=_0x2abb81['length'];if(!_0x5c85ea['query'][_0xd454('0x39')](_0xd454('0x3a'))){_0x34cb05[_0xd454('0x3b')]=qs[_0xd454('0x3b')](_0x5c85ea[_0xd454('0x37')][_0xd454('0x3b')]);_0x34cb05[_0xd454('0x1c')]=qs['offset'](_0x5c85ea[_0xd454('0x37')][_0xd454('0x1c')]);}return _0x275b23['getAgents'](_0x34cb05);}})[_0xd454('0x24')](function(_0x1a4652){if(_0x1a4652){return _0x1a4652?{'count':_0x57627c,'rows':_0x1a4652}:null;}})[_0xd454('0x24')](respondWithResult(_0x3cb545,null))[_0xd454('0x45')](handleError(_0x3cb545,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index d715f21..7f7a944 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 _0xde55=['../../mysqldb','SmsQueue','setMaxListeners','remove','hasOwnProperty','hook','events'];(function(_0x22ef12,_0x3901dc){var _0x254edc=function(_0x191bc4){while(--_0x191bc4){_0x22ef12['push'](_0x22ef12['shift']());}};_0x254edc(++_0x3901dc);}(_0xde55,0xd1));var _0x5de5=function(_0x2dda76,_0xfa00c){_0x2dda76=_0x2dda76-0x0;var _0x4b25e9=_0xde55[_0x2dda76];return _0x4b25e9;};'use strict';var EventEmitter=require(_0x5de5('0x0'));var SmsQueue=require(_0x5de5('0x1'))['db'][_0x5de5('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x5de5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5de5('0x4')};function emitEvent(_0x5a36c1){return function(_0x2168f2,_0x1e896c,_0x26b9ec){SmsQueueEvents['emit'](_0x5a36c1+':'+_0x2168f2['id'],_0x2168f2);SmsQueueEvents['emit'](_0x5a36c1,_0x2168f2);_0x26b9ec(null);};}for(var e in events){if(events[_0x5de5('0x5')](e)){var event=events[e];SmsQueue[_0x5de5('0x6')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x3713=['hasOwnProperty','hook','exports','events','../../mysqldb','update','remove','emit'];(function(_0x46a40b,_0x13feab){var _0x18a262=function(_0x3134e7){while(--_0x3134e7){_0x46a40b['push'](_0x46a40b['shift']());}};_0x18a262(++_0x13feab);}(_0x3713,0xb3));var _0x3371=function(_0x1a76e3,_0x1a8858){_0x1a76e3=_0x1a76e3-0x0;var _0x42cee6=_0x3713[_0x1a76e3];return _0x42cee6;};'use strict';var EventEmitter=require(_0x3371('0x0'));var SmsQueue=require(_0x3371('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3371('0x2'),'afterDestroy':_0x3371('0x3')};function emitEvent(_0x4de86e){return function(_0xb42003,_0x4a3458,_0x9f729e){SmsQueueEvents[_0x3371('0x4')](_0x4de86e+':'+_0xb42003['id'],_0xb42003);SmsQueueEvents[_0x3371('0x4')](_0x4de86e,_0xb42003);_0x9f729e(null);};}for(var e in events){if(events[_0x3371('0x5')](e)){var event=events[e];SmsQueue[_0x3371('0x6')](e,emitEvent(event));}}module[_0x3371('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 0fb738f..06014df 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 _0x8163=['./smsQueue.attributes','exports','sms_queues','lodash','util','../../config/logger','api','moment','path','../../config/environment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8163,0x11b));var _0x3816=function(_0x6bf058,_0x249865){_0x6bf058=_0x6bf058-0x0;var _0x26e2ed=_0x8163[_0x6bf058];return _0x26e2ed;};'use strict';var _=require(_0x3816('0x0'));var util=require(_0x3816('0x1'));var logger=require(_0x3816('0x2'))(_0x3816('0x3'));var moment=require(_0x3816('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3816('0x5'));var rimraf=require('rimraf');var config=require(_0x3816('0x6'));var attributes=require(_0x3816('0x7'));module[_0x3816('0x8')]=function(_0x58dc01,_0x2696e4){return _0x58dc01['define']('SmsQueue',attributes,{'tableName':_0x3816('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3ba=['exports','define','SmsQueue','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x3fa518,_0x431cbe){var _0x269c91=function(_0x26d242){while(--_0x26d242){_0x3fa518['push'](_0x3fa518['shift']());}};_0x269c91(++_0x431cbe);}(_0xf3ba,0x7b));var _0xaf3b=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0xf3ba[_0x1d1d09];return _0x8827e;};'use strict';var _=require('lodash');var util=require(_0xaf3b('0x0'));var logger=require('../../config/logger')(_0xaf3b('0x1'));var moment=require(_0xaf3b('0x2'));var BPromise=require(_0xaf3b('0x3'));var rp=require(_0xaf3b('0x4'));var fs=require('fs');var path=require(_0xaf3b('0x5'));var rimraf=require(_0xaf3b('0x6'));var config=require(_0xaf3b('0x7'));var attributes=require(_0xaf3b('0x8'));module[_0xaf3b('0x9')]=function(_0xcaba5c,_0x5eac4f){return _0xcaba5c[_0xaf3b('0xa')](_0xaf3b('0xb'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 0901e84..b91ed10 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 _0x8767=['find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SmsQueue','findAll','options','raw','where','limit','include','attributes','map','model','GetSmsQueue','catch','ShowSmsQueue'];(function(_0x5cc301,_0x5d6c64){var _0x101322=function(_0x43720c){while(--_0x43720c){_0x5cc301['push'](_0x5cc301['shift']());}};_0x101322(++_0x5d6c64);}(_0x8767,0x1af));var _0x7876=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8767[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7876('0x0'));var util=require(_0x7876('0x1'));var moment=require(_0x7876('0x2'));var BPromise=require('bluebird');var rs=require(_0x7876('0x3'));var fs=require('fs');var Redis=require(_0x7876('0x4'));var db=require(_0x7876('0x5'))['db'];var utils=require(_0x7876('0x6'));var logger=require(_0x7876('0x7'))(_0x7876('0x8'));var config=require(_0x7876('0x9'));var jayson=require(_0x7876('0xa'));var client=jayson[_0x7876('0xb')][_0x7876('0xc')]({'port':0x232a});config[_0x7876('0xd')]=_[_0x7876('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7876('0xf'))(new Redis(config[_0x7876('0xd')]));require('./smsQueue.socket')[_0x7876('0x10')](socket);function respondWithRpcPromise(_0x39357c,_0x3cc074,_0x159b7f){return new BPromise(function(_0x33a4fe,_0x3db78f){return client[_0x7876('0x11')](_0x39357c,_0x159b7f)[_0x7876('0x12')](function(_0x20482f){logger[_0x7876('0x13')](_0x7876('0x14'),_0x3cc074,_0x7876('0x15'));logger[_0x7876('0x16')](_0x7876('0x17'),_0x3cc074,_0x7876('0x15'),JSON[_0x7876('0x18')](_0x20482f));if(_0x20482f[_0x7876('0x19')]){if(_0x20482f[_0x7876('0x19')][_0x7876('0x1a')]===0x1f4){logger['error'](_0x7876('0x14'),_0x3cc074,_0x20482f[_0x7876('0x19')][_0x7876('0x1b')]);return _0x3db78f(_0x20482f[_0x7876('0x19')][_0x7876('0x1b')]);}logger[_0x7876('0x19')](_0x7876('0x14'),_0x3cc074,_0x20482f[_0x7876('0x19')]['message']);return _0x33a4fe(_0x20482f[_0x7876('0x19')][_0x7876('0x1b')]);}else{logger[_0x7876('0x13')](_0x7876('0x14'),_0x3cc074,_0x7876('0x15'));_0x33a4fe(_0x20482f[_0x7876('0x1c')][_0x7876('0x1b')]);}})['catch'](function(_0x494230){logger[_0x7876('0x19')]('SmsQueue,\x20%s,\x20%s',_0x3cc074,_0x494230);_0x3db78f(_0x494230);});});}exports['GetSmsQueue']=function(_0x278ff5){var _0x5314d7=this;return new Promise(function(_0x6c1ff3,_0x116824){return db[_0x7876('0x1d')][_0x7876('0x1e')]({'raw':_0x278ff5[_0x7876('0x1f')]?_0x278ff5['options'][_0x7876('0x20')]===undefined?!![]:![]:!![],'where':_0x278ff5[_0x7876('0x1f')]?_0x278ff5[_0x7876('0x1f')][_0x7876('0x21')]||null:null,'attributes':_0x278ff5[_0x7876('0x1f')]?_0x278ff5[_0x7876('0x1f')]['attributes']||null:null,'limit':_0x278ff5[_0x7876('0x1f')]?_0x278ff5[_0x7876('0x1f')][_0x7876('0x22')]||null:null,'include':_0x278ff5[_0x7876('0x1f')]?_0x278ff5[_0x7876('0x1f')][_0x7876('0x23')]?_['map'](_0x278ff5['options'][_0x7876('0x23')],function(_0x5e5dec){return{'model':db[_0x5e5dec['model']],'as':_0x5e5dec['as'],'attributes':_0x5e5dec[_0x7876('0x24')],'include':_0x5e5dec['include']?_[_0x7876('0x25')](_0x5e5dec[_0x7876('0x23')],function(_0x38ac31){return{'model':db[_0x38ac31[_0x7876('0x26')]],'as':_0x38ac31['as'],'attributes':_0x38ac31[_0x7876('0x24')],'include':_0x38ac31[_0x7876('0x23')]?_[_0x7876('0x25')](_0x38ac31['include'],function(_0x56e339){return{'model':db[_0x56e339[_0x7876('0x26')]],'as':_0x56e339['as'],'attributes':_0x56e339[_0x7876('0x24')]};}):[]};}):[]};}):[]:[]})[_0x7876('0x12')](function(_0x339b5a){logger[_0x7876('0x13')](_0x7876('0x27'),_0x278ff5);logger[_0x7876('0x16')](_0x7876('0x27'),_0x278ff5,JSON['stringify'](_0x339b5a));_0x6c1ff3(_0x339b5a);})[_0x7876('0x28')](function(_0x463d67){logger[_0x7876('0x19')](_0x7876('0x27'),_0x463d67['message'],_0x278ff5);_0x116824(_0x5314d7[_0x7876('0x19')](0x1f4,_0x463d67[_0x7876('0x1b')]));});});};exports[_0x7876('0x29')]=function(_0x485b68){var _0x35441d=this;return new Promise(function(_0x813fb2,_0x289ee9){return db[_0x7876('0x1d')][_0x7876('0x2a')]({'raw':_0x485b68[_0x7876('0x1f')]?_0x485b68[_0x7876('0x1f')][_0x7876('0x20')]===undefined?!![]:![]:!![],'where':_0x485b68[_0x7876('0x1f')]?_0x485b68['options'][_0x7876('0x21')]||null:null,'attributes':_0x485b68[_0x7876('0x1f')]?_0x485b68[_0x7876('0x1f')][_0x7876('0x24')]||null:null,'include':_0x485b68[_0x7876('0x1f')]?_0x485b68[_0x7876('0x1f')][_0x7876('0x23')]?_[_0x7876('0x25')](_0x485b68[_0x7876('0x1f')][_0x7876('0x23')],function(_0x3852ba){return{'model':db[_0x3852ba['model']],'as':_0x3852ba['as'],'attributes':_0x3852ba['attributes'],'include':_0x3852ba[_0x7876('0x23')]?_[_0x7876('0x25')](_0x3852ba['include'],function(_0x220c55){return{'model':db[_0x220c55[_0x7876('0x26')]],'as':_0x220c55['as'],'attributes':_0x220c55[_0x7876('0x24')],'include':_0x220c55['include']?_['map'](_0x220c55['include'],function(_0x57765d){return{'model':db[_0x57765d[_0x7876('0x26')]],'as':_0x57765d['as'],'attributes':_0x57765d[_0x7876('0x24')]};}):[]};}):[]};}):[]:[]})[_0x7876('0x12')](function(_0x2c1a63){logger[_0x7876('0x13')]('ShowSmsQueue',_0x485b68);logger['debug'](_0x7876('0x29'),_0x485b68,JSON[_0x7876('0x18')](_0x2c1a63));_0x813fb2(_0x2c1a63);})['catch'](function(_0x13a299){logger[_0x7876('0x19')](_0x7876('0x29'),_0x13a299[_0x7876('0x1b')],_0x485b68);_0x289ee9(_0x35441d[_0x7876('0x19')](0x1f4,_0x13a299[_0x7876('0x1b')]));});});}; \ No newline at end of file +var _0x4f26=['attributes','include','map','model','ShowSmsQueue','find','raw','lodash','util','moment','ioredis','../../config/logger','jayson/promise','http','redis','defaults','localhost','./smsQueue.socket','register','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueue,\x20%s,\x20%s','message','catch','GetSmsQueue','SmsQueue','findAll','options'];(function(_0x370d43,_0x13e04d){var _0x4f552f=function(_0x2be8d0){while(--_0x2be8d0){_0x370d43['push'](_0x370d43['shift']());}};_0x4f552f(++_0x13e04d);}(_0x4f26,0x139));var _0x64f2=function(_0x5bdb19,_0x30372e){_0x5bdb19=_0x5bdb19-0x0;var _0x5f23d7=_0x4f26[_0x5bdb19];return _0x5f23d7;};'use strict';var _=require(_0x64f2('0x0'));var util=require(_0x64f2('0x1'));var moment=require(_0x64f2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x64f2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x64f2('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x64f2('0x5'));var client=jayson['client'][_0x64f2('0x6')]({'port':0x232a});config[_0x64f2('0x7')]=_[_0x64f2('0x8')](config['redis'],{'host':_0x64f2('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x64f2('0x7')]));require(_0x64f2('0xa'))[_0x64f2('0xb')](socket);function respondWithRpcPromise(_0x214187,_0x254844,_0x7d6ee7){return new BPromise(function(_0x59ecd2,_0x2dc01b){return client[_0x64f2('0xc')](_0x214187,_0x7d6ee7)[_0x64f2('0xd')](function(_0x3f25ec){logger[_0x64f2('0xe')]('SmsQueue,\x20%s,\x20%s',_0x254844,_0x64f2('0xf'));logger[_0x64f2('0x10')](_0x64f2('0x11'),_0x254844,_0x64f2('0xf'),JSON[_0x64f2('0x12')](_0x3f25ec));if(_0x3f25ec[_0x64f2('0x13')]){if(_0x3f25ec['error']['code']===0x1f4){logger['error'](_0x64f2('0x14'),_0x254844,_0x3f25ec[_0x64f2('0x13')][_0x64f2('0x15')]);return _0x2dc01b(_0x3f25ec['error'][_0x64f2('0x15')]);}logger[_0x64f2('0x13')](_0x64f2('0x14'),_0x254844,_0x3f25ec[_0x64f2('0x13')][_0x64f2('0x15')]);return _0x59ecd2(_0x3f25ec[_0x64f2('0x13')]['message']);}else{logger[_0x64f2('0xe')](_0x64f2('0x14'),_0x254844,'request\x20sent');_0x59ecd2(_0x3f25ec['result']['message']);}})[_0x64f2('0x16')](function(_0x4e3b25){logger[_0x64f2('0x13')]('SmsQueue,\x20%s,\x20%s',_0x254844,_0x4e3b25);_0x2dc01b(_0x4e3b25);});});}exports[_0x64f2('0x17')]=function(_0x422974){var _0x3e8e5b=this;return new Promise(function(_0x419cf3,_0x537695){return db[_0x64f2('0x18')][_0x64f2('0x19')]({'raw':_0x422974[_0x64f2('0x1a')]?_0x422974['options']['raw']===undefined?!![]:![]:!![],'where':_0x422974[_0x64f2('0x1a')]?_0x422974['options']['where']||null:null,'attributes':_0x422974[_0x64f2('0x1a')]?_0x422974[_0x64f2('0x1a')][_0x64f2('0x1b')]||null:null,'limit':_0x422974[_0x64f2('0x1a')]?_0x422974[_0x64f2('0x1a')]['limit']||null:null,'include':_0x422974[_0x64f2('0x1a')]?_0x422974['options']['include']?_['map'](_0x422974['options'][_0x64f2('0x1c')],function(_0xe29cad){return{'model':db[_0xe29cad['model']],'as':_0xe29cad['as'],'attributes':_0xe29cad[_0x64f2('0x1b')],'include':_0xe29cad[_0x64f2('0x1c')]?_[_0x64f2('0x1d')](_0xe29cad[_0x64f2('0x1c')],function(_0x43991b){return{'model':db[_0x43991b[_0x64f2('0x1e')]],'as':_0x43991b['as'],'attributes':_0x43991b[_0x64f2('0x1b')],'include':_0x43991b[_0x64f2('0x1c')]?_[_0x64f2('0x1d')](_0x43991b[_0x64f2('0x1c')],function(_0x44a951){return{'model':db[_0x44a951['model']],'as':_0x44a951['as'],'attributes':_0x44a951[_0x64f2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x64f2('0xd')](function(_0x3f2f52){logger[_0x64f2('0xe')]('GetSmsQueue',_0x422974);logger[_0x64f2('0x10')](_0x64f2('0x17'),_0x422974,JSON['stringify'](_0x3f2f52));_0x419cf3(_0x3f2f52);})[_0x64f2('0x16')](function(_0x2c42fd){logger[_0x64f2('0x13')](_0x64f2('0x17'),_0x2c42fd[_0x64f2('0x15')],_0x422974);_0x537695(_0x3e8e5b[_0x64f2('0x13')](0x1f4,_0x2c42fd[_0x64f2('0x15')]));});});};exports[_0x64f2('0x1f')]=function(_0x52fc48){var _0x347152=this;return new Promise(function(_0x1b6c71,_0x3f36f9){return db[_0x64f2('0x18')][_0x64f2('0x20')]({'raw':_0x52fc48['options']?_0x52fc48[_0x64f2('0x1a')][_0x64f2('0x21')]===undefined?!![]:![]:!![],'where':_0x52fc48['options']?_0x52fc48[_0x64f2('0x1a')]['where']||null:null,'attributes':_0x52fc48[_0x64f2('0x1a')]?_0x52fc48['options'][_0x64f2('0x1b')]||null:null,'include':_0x52fc48[_0x64f2('0x1a')]?_0x52fc48[_0x64f2('0x1a')][_0x64f2('0x1c')]?_[_0x64f2('0x1d')](_0x52fc48['options'][_0x64f2('0x1c')],function(_0x1c09cf){return{'model':db[_0x1c09cf['model']],'as':_0x1c09cf['as'],'attributes':_0x1c09cf[_0x64f2('0x1b')],'include':_0x1c09cf['include']?_['map'](_0x1c09cf[_0x64f2('0x1c')],function(_0x3da234){return{'model':db[_0x3da234[_0x64f2('0x1e')]],'as':_0x3da234['as'],'attributes':_0x3da234[_0x64f2('0x1b')],'include':_0x3da234[_0x64f2('0x1c')]?_[_0x64f2('0x1d')](_0x3da234[_0x64f2('0x1c')],function(_0x3e8011){return{'model':db[_0x3e8011[_0x64f2('0x1e')]],'as':_0x3e8011['as'],'attributes':_0x3e8011[_0x64f2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x64f2('0xd')](function(_0x497830){logger[_0x64f2('0xe')](_0x64f2('0x1f'),_0x52fc48);logger[_0x64f2('0x10')](_0x64f2('0x1f'),_0x52fc48,JSON['stringify'](_0x497830));_0x1b6c71(_0x497830);})[_0x64f2('0x16')](function(_0x43fae6){logger[_0x64f2('0x13')](_0x64f2('0x1f'),_0x43fae6[_0x64f2('0x15')],_0x52fc48);_0x3f36f9(_0x347152[_0x64f2('0x13')](0x1f4,_0x43fae6[_0x64f2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 40c32ce..78895ff 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 _0xa143=['./smsQueue.events','save','remove','update','removeListener','register','length','smsQueue:'];(function(_0x12ab9c,_0x1ad557){var _0x2a3e39=function(_0x5f0653){while(--_0x5f0653){_0x12ab9c['push'](_0x12ab9c['shift']());}};_0x2a3e39(++_0x1ad557);}(_0xa143,0x158));var _0x3a14=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa143[_0x321bb2];return _0x9c12ed;};'use strict';var SmsQueueEvents=require(_0x3a14('0x0'));var events=[_0x3a14('0x1'),_0x3a14('0x2'),_0x3a14('0x3')];function createListener(_0x347bf0,_0x1341ab){return function(_0x3a6596){_0x1341ab['emit'](_0x347bf0,_0x3a6596);};}function removeListener(_0x5b5046,_0x202596){return function(){SmsQueueEvents[_0x3a14('0x4')](_0x5b5046,_0x202596);};}exports[_0x3a14('0x5')]=function(_0x3fa7f7){for(var _0x235ed7=0x0,_0x197e83=events[_0x3a14('0x6')];_0x235ed7<_0x197e83;_0x235ed7++){var _0x434eb1=events[_0x235ed7];var _0x516e8c=createListener(_0x3a14('0x7')+_0x434eb1,_0x3fa7f7);SmsQueueEvents['on'](_0x434eb1,_0x516e8c);}}; \ No newline at end of file +var _0xa38b=['register','length','smsQueue:','./smsQueue.events','save','remove','update','emit'];(function(_0x371549,_0x2eb3f7){var _0x3df89a=function(_0x6d30f7){while(--_0x6d30f7){_0x371549['push'](_0x371549['shift']());}};_0x3df89a(++_0x2eb3f7);}(_0xa38b,0xbb));var _0xba38=function(_0x49b9f2,_0x14f2e4){_0x49b9f2=_0x49b9f2-0x0;var _0x1de0f1=_0xa38b[_0x49b9f2];return _0x1de0f1;};'use strict';var SmsQueueEvents=require(_0xba38('0x0'));var events=[_0xba38('0x1'),_0xba38('0x2'),_0xba38('0x3')];function createListener(_0x57bc37,_0x3db103){return function(_0x11b5dd){_0x3db103[_0xba38('0x4')](_0x57bc37,_0x11b5dd);};}function removeListener(_0x4473e5,_0xcd3f00){return function(){SmsQueueEvents['removeListener'](_0x4473e5,_0xcd3f00);};}exports[_0xba38('0x5')]=function(_0x1e41f6){for(var _0x17ff5a=0x0,_0x232a96=events[_0xba38('0x6')];_0x17ff5a<_0x232a96;_0x17ff5a++){var _0x53ad78=events[_0x17ff5a];var _0xb1abb7=createListener(_0xba38('0x7')+_0x53ad78,_0x1e41f6);SmsQueueEvents['on'](_0x53ad78,_0xb1abb7);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index bc46c3c..225fd73 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 _0x483f=['create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x395beb,_0x39cd94){var _0x11231c=function(_0x537c6d){while(--_0x537c6d){_0x395beb['push'](_0x395beb['shift']());}};_0x11231c(++_0x39cd94);}(_0x483f,0x11c));var _0xf483=function(_0x72ef94,_0x5126fd){_0x72ef94=_0x72ef94-0x0;var _0x2f0028=_0x483f[_0x72ef94];return _0x2f0028;};'use strict';var multer=require(_0xf483('0x0'));var util=require(_0xf483('0x1'));var path=require(_0xf483('0x2'));var timeout=require(_0xf483('0x3'));var express=require(_0xf483('0x4'));var router=express[_0xf483('0x5')]();var fs_extra=require(_0xf483('0x6'));var auth=require(_0xf483('0x7'));var interaction=require(_0xf483('0x8'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0xf483('0x9')](),controller[_0xf483('0xa')]);router[_0xf483('0xb')](_0xf483('0xc'),auth[_0xf483('0x9')](),controller[_0xf483('0xd')]);router[_0xf483('0xb')](_0xf483('0xe'),auth['isAuthenticated'](),controller[_0xf483('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf483('0x10')]);router[_0xf483('0x11')](_0xf483('0xe'),auth[_0xf483('0x9')](),controller['update']);router[_0xf483('0x12')]('/:id',auth[_0xf483('0x9')](),controller[_0xf483('0x13')]);module['exports']=router; \ No newline at end of file +var _0x61d9=['update','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x61d9,0x193));var _0x961d=function(_0x317034,_0x192fa8){_0x317034=_0x317034-0x0;var _0x4e331a=_0x61d9[_0x317034];return _0x4e331a;};'use strict';var multer=require('multer');var util=require(_0x961d('0x0'));var path=require(_0x961d('0x1'));var timeout=require(_0x961d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x961d('0x3'));var auth=require(_0x961d('0x4'));var interaction=require(_0x961d('0x5'));var config=require(_0x961d('0x6'));var controller=require(_0x961d('0x7'));router['get']('/',auth[_0x961d('0x8')](),controller[_0x961d('0x9')]);router[_0x961d('0xa')](_0x961d('0xb'),auth[_0x961d('0x8')](),controller[_0x961d('0xc')]);router['get'](_0x961d('0xd'),auth[_0x961d('0x8')](),controller[_0x961d('0xe')]);router[_0x961d('0xf')]('/',auth[_0x961d('0x8')](),controller[_0x961d('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x961d('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x961d('0x12')]);module[_0x961d('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 1d01acb..2adcb39 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 _0x67c5=['DATE','moment','sequelize','exports'];(function(_0x337118,_0x1b0817){var _0x2b0860=function(_0x2084fb){while(--_0x2084fb){_0x337118['push'](_0x337118['shift']());}};_0x2b0860(++_0x1b0817);}(_0x67c5,0x99));var _0x567c=function(_0x4b5668,_0x11db5d){_0x4b5668=_0x4b5668-0x0;var _0x1c866f=_0x67c5[_0x4b5668];return _0x1c866f;};'use strict';var moment=require(_0x567c('0x0'));var Sequelize=require(_0x567c('0x1'));module[_0x567c('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x567c('0x3')]},'leaveAt':{'type':Sequelize[_0x567c('0x3')]},'acceptAt':{'type':Sequelize[_0x567c('0x3')]},'exitAt':{'type':Sequelize[_0x567c('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7be0=['sequelize','exports','STRING','DATE','moment'];(function(_0x2c3ff2,_0x49c652){var _0x2dbf25=function(_0x1ec583){while(--_0x1ec583){_0x2c3ff2['push'](_0x2c3ff2['shift']());}};_0x2dbf25(++_0x49c652);}(_0x7be0,0x77));var _0x07be=function(_0x3eb19a,_0x50c488){_0x3eb19a=_0x3eb19a-0x0;var _0x47510c=_0x7be0[_0x3eb19a];return _0x47510c;};'use strict';var moment=require(_0x07be('0x0'));var Sequelize=require(_0x07be('0x1'));module[_0x07be('0x2')]={'uniqueid':{'type':Sequelize[_0x07be('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x07be('0x3')]},'joinAt':{'type':Sequelize[_0x07be('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x07be('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x07be('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index d04b22f..628627b 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 _0xf0ec=['create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','end','status','json','offset','undefined','count','Content-Range','save','update','destroy','error','name','send','index','fieldName','type','key','query','keys','intersection','model','attributes','fields','nolimit','limit','order','where','filters','merge','map','filter','options','SmsQueueReport','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find'];(function(_0x21d31f,_0x27f755){var _0x2e0e3d=function(_0x2bef84){while(--_0x2bef84){_0x21d31f['push'](_0x21d31f['shift']());}};_0x2e0e3d(++_0x27f755);}(_0xf0ec,0x95));var _0xcf0e=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0xf0ec[_0x17406e];return _0x2bfc5a;};'use strict';var emlformat=require(_0xcf0e('0x0'));var rimraf=require(_0xcf0e('0x1'));var zipdir=require(_0xcf0e('0x2'));var jsonpatch=require(_0xcf0e('0x3'));var rp=require(_0xcf0e('0x4'));var moment=require(_0xcf0e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcf0e('0x6'));var util=require(_0xcf0e('0x7'));var path=require(_0xcf0e('0x8'));var sox=require(_0xcf0e('0x9'));var csv=require(_0xcf0e('0xa'));var ejs=require(_0xcf0e('0xb'));var fs=require('fs');var fs_extra=require(_0xcf0e('0xc'));var _=require(_0xcf0e('0xd'));var squel=require(_0xcf0e('0xe'));var crypto=require(_0xcf0e('0xf'));var jsforce=require(_0xcf0e('0x10'));var deskjs=require(_0xcf0e('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcf0e('0x12'));var Redis=require(_0xcf0e('0x13'));var authService=require(_0xcf0e('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcf0e('0x15'));var hardwareService=require(_0xcf0e('0x16'));var logger=require(_0xcf0e('0x17'))('api');var utils=require(_0xcf0e('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x869942,_0xd255f1){_0xd255f1=_0xd255f1||0xcc;return function(_0x5f3409){if(_0x5f3409){return _0x869942[_0xcf0e('0x19')](_0xd255f1);}return _0x869942['status'](_0xd255f1)[_0xcf0e('0x1a')]();};}function respondWithResult(_0x222bbd,_0x3ad8a2){_0x3ad8a2=_0x3ad8a2||0xc8;return function(_0x357368){if(_0x357368){return _0x222bbd[_0xcf0e('0x1b')](_0x3ad8a2)[_0xcf0e('0x1c')](_0x357368);}};}function respondWithFilteredResult(_0x4054cd,_0x11ccc4){return function(_0x374018){if(_0x374018){var _0x20c53b=typeof _0x11ccc4[_0xcf0e('0x1d')]==='undefined'&&typeof _0x11ccc4['limit']===_0xcf0e('0x1e');var _0x12d73b=_0x374018[_0xcf0e('0x1f')];var _0x2bcab8=_0x20c53b?0x0:_0x11ccc4['offset'];var _0x142f88=_0x20c53b?_0x374018[_0xcf0e('0x1f')]:_0x11ccc4[_0xcf0e('0x1d')]+_0x11ccc4['limit'];var _0x29c25a;if(_0x142f88>=_0x12d73b){_0x142f88=_0x12d73b;_0x29c25a=0xc8;}else{_0x29c25a=0xce;}_0x4054cd['status'](_0x29c25a);return _0x4054cd['set'](_0xcf0e('0x20'),_0x2bcab8+'-'+_0x142f88+'/'+_0x12d73b)['json'](_0x374018);}return null;};}function patchUpdates(_0x156d39){return function(_0x528873){try{jsonpatch['apply'](_0x528873,_0x156d39,!![]);}catch(_0x1c8366){return BPromise['reject'](_0x1c8366);}return _0x528873[_0xcf0e('0x21')]();};}function saveUpdates(_0x411cdc,_0x5e51a2){return function(_0x4a73df){if(_0x4a73df){return _0x4a73df[_0xcf0e('0x22')](_0x411cdc)['then'](function(_0x1f6fb1){return _0x1f6fb1;});}return null;};}function removeEntity(_0x172382,_0x141826){return function(_0x2be0c7){if(_0x2be0c7){return _0x2be0c7[_0xcf0e('0x23')]()['then'](function(){_0x172382[_0xcf0e('0x1b')](0xcc)[_0xcf0e('0x1a')]();});}};}function handleEntityNotFound(_0xfad6ef,_0x4c4921){return function(_0x218fe3){if(!_0x218fe3){_0xfad6ef[_0xcf0e('0x19')](0x194);}return _0x218fe3;};}function handleError(_0x3e5a3f,_0x2fa7ad){_0x2fa7ad=_0x2fa7ad||0x1f4;return function(_0x157dfa){logger[_0xcf0e('0x24')](_0x157dfa['stack']);if(_0x157dfa[_0xcf0e('0x25')]){delete _0x157dfa[_0xcf0e('0x25')];}_0x3e5a3f[_0xcf0e('0x1b')](_0x2fa7ad)[_0xcf0e('0x26')](_0x157dfa);};}exports[_0xcf0e('0x27')]=function(_0x2b8918,_0x37582b){var _0x2b9242={},_0x32af0f={},_0x33d7dc={'count':0x0,'rows':[]};var _0x507536=_['map'](db['SmsQueueReport']['rawAttributes'],function(_0x437c96){return{'name':_0x437c96[_0xcf0e('0x28')],'type':_0x437c96[_0xcf0e('0x29')][_0xcf0e('0x2a')]};});_0x32af0f['model']=_['map'](_0x507536,_0xcf0e('0x25'));_0x32af0f[_0xcf0e('0x2b')]=_[_0xcf0e('0x2c')](_0x2b8918[_0xcf0e('0x2b')]);_0x32af0f['filters']=_[_0xcf0e('0x2d')](_0x32af0f[_0xcf0e('0x2e')],_0x32af0f['query']);_0x2b9242[_0xcf0e('0x2f')]=_['intersection'](_0x32af0f[_0xcf0e('0x2e')],qs['fields'](_0x2b8918[_0xcf0e('0x2b')][_0xcf0e('0x30')]));_0x2b9242[_0xcf0e('0x2f')]=_0x2b9242['attributes']['length']?_0x2b9242[_0xcf0e('0x2f')]:_0x32af0f['model'];if(!_0x2b8918['query']['hasOwnProperty'](_0xcf0e('0x31'))){_0x2b9242[_0xcf0e('0x32')]=qs['limit'](_0x2b8918[_0xcf0e('0x2b')][_0xcf0e('0x32')]);_0x2b9242[_0xcf0e('0x1d')]=qs[_0xcf0e('0x1d')](_0x2b8918['query'][_0xcf0e('0x1d')]);}_0x2b9242[_0xcf0e('0x33')]=qs['sort'](_0x2b8918[_0xcf0e('0x2b')]['sort']);_0x2b9242[_0xcf0e('0x34')]=qs['filters'](_['pick'](_0x2b8918[_0xcf0e('0x2b')],_0x32af0f[_0xcf0e('0x35')]),_0x507536);if(_0x2b8918['query']['filter']){_0x2b9242[_0xcf0e('0x34')]=_[_0xcf0e('0x36')](_0x2b9242[_0xcf0e('0x34')],{'$or':_[_0xcf0e('0x37')](_0x507536,function(_0x4ad33e){if(_0x4ad33e[_0xcf0e('0x29')]!=='VIRTUAL'){var _0xc81eed={};_0xc81eed[_0x4ad33e[_0xcf0e('0x25')]]={'$like':'%'+_0x2b8918[_0xcf0e('0x2b')][_0xcf0e('0x38')]+'%'};return _0xc81eed;}})});}_0x2b9242=_[_0xcf0e('0x36')]({},_0x2b9242,_0x2b8918[_0xcf0e('0x39')]);var _0x5d5d57={'where':_0x2b9242[_0xcf0e('0x34')]};return db[_0xcf0e('0x3a')][_0xcf0e('0x1f')](_0x5d5d57)[_0xcf0e('0x3b')](function(_0x79a544){_0x33d7dc[_0xcf0e('0x1f')]=_0x79a544;if(_0x2b8918[_0xcf0e('0x2b')][_0xcf0e('0x3c')]){_0x2b9242[_0xcf0e('0x3d')]=[{'all':!![]}];}return db[_0xcf0e('0x3a')][_0xcf0e('0x3e')](_0x2b9242);})[_0xcf0e('0x3b')](function(_0x4f6246){_0x33d7dc[_0xcf0e('0x3f')]=_0x4f6246;return _0x33d7dc;})[_0xcf0e('0x3b')](respondWithFilteredResult(_0x37582b,_0x2b9242))[_0xcf0e('0x40')](handleError(_0x37582b,null));};exports[_0xcf0e('0x41')]=function(_0x275895,_0x32d5c8){var _0x4829a5={'raw':!![],'where':{'id':_0x275895[_0xcf0e('0x42')]['id']}},_0x29ef89={};_0x29ef89[_0xcf0e('0x2e')]=_[_0xcf0e('0x2c')](db[_0xcf0e('0x3a')][_0xcf0e('0x43')]);_0x29ef89[_0xcf0e('0x2b')]=_[_0xcf0e('0x2c')](_0x275895['query']);_0x29ef89[_0xcf0e('0x35')]=_[_0xcf0e('0x2d')](_0x29ef89['model'],_0x29ef89[_0xcf0e('0x2b')]);_0x4829a5[_0xcf0e('0x2f')]=_['intersection'](_0x29ef89[_0xcf0e('0x2e')],qs[_0xcf0e('0x30')](_0x275895[_0xcf0e('0x2b')][_0xcf0e('0x30')]));_0x4829a5[_0xcf0e('0x2f')]=_0x4829a5['attributes'][_0xcf0e('0x44')]?_0x4829a5[_0xcf0e('0x2f')]:_0x29ef89['model'];if(_0x275895[_0xcf0e('0x2b')][_0xcf0e('0x3c')]){_0x4829a5['include']=[{'all':!![]}];}_0x4829a5=_['merge']({},_0x4829a5,_0x275895[_0xcf0e('0x39')]);return db['SmsQueueReport'][_0xcf0e('0x45')](_0x4829a5)['then'](handleEntityNotFound(_0x32d5c8,null))[_0xcf0e('0x3b')](respondWithResult(_0x32d5c8,null))['catch'](handleError(_0x32d5c8,null));};exports[_0xcf0e('0x46')]=function(_0x4fc0ec,_0x2c83b2){return db[_0xcf0e('0x3a')][_0xcf0e('0x46')](_0x4fc0ec['body'],{})[_0xcf0e('0x3b')](respondWithResult(_0x2c83b2,0xc9))[_0xcf0e('0x40')](handleError(_0x2c83b2,null));};exports[_0xcf0e('0x22')]=function(_0x4a87e4,_0x307b24){if(_0x4a87e4[_0xcf0e('0x47')]['id']){delete _0x4a87e4[_0xcf0e('0x47')]['id'];}return db['SmsQueueReport'][_0xcf0e('0x45')]({'where':{'id':_0x4a87e4['params']['id']}})[_0xcf0e('0x3b')](handleEntityNotFound(_0x307b24,null))[_0xcf0e('0x3b')](saveUpdates(_0x4a87e4[_0xcf0e('0x47')],null))[_0xcf0e('0x3b')](respondWithResult(_0x307b24,null))[_0xcf0e('0x40')](handleError(_0x307b24,null));};exports[_0xcf0e('0x23')]=function(_0x50eb46,_0x2e7b59){return db[_0xcf0e('0x3a')][_0xcf0e('0x45')]({'where':{'id':_0x50eb46[_0xcf0e('0x42')]['id']}})[_0xcf0e('0x3b')](handleEntityNotFound(_0x2e7b59,null))[_0xcf0e('0x3b')](removeEntity(_0x2e7b59,null))[_0xcf0e('0x40')](handleError(_0x2e7b59,null));};exports[_0xcf0e('0x48')]=function(_0x1fda93,_0x4280da){return db['SmsQueueReport']['describe']()[_0xcf0e('0x3b')](respondWithResult(_0x4280da,null))[_0xcf0e('0x40')](handleError(_0x4280da,null));}; \ No newline at end of file +var _0x49f1=['undefined','limit','set','Content-Range','apply','save','update','destroy','end','stack','name','send','SmsQueueReport','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','type','count','includeAll','rows','then','catch','show','params','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x63ce6d,_0x329e70){var _0x3d2b1a=function(_0x129ae6){while(--_0x129ae6){_0x63ce6d['push'](_0x63ce6d['shift']());}};_0x3d2b1a(++_0x329e70);}(_0x49f1,0x153));var _0x149f=function(_0x211397,_0x52b103){_0x211397=_0x211397-0x0;var _0x3df56c=_0x49f1[_0x211397];return _0x3df56c;};'use strict';var emlformat=require(_0x149f('0x0'));var rimraf=require(_0x149f('0x1'));var zipdir=require(_0x149f('0x2'));var jsonpatch=require(_0x149f('0x3'));var rp=require(_0x149f('0x4'));var moment=require(_0x149f('0x5'));var BPromise=require(_0x149f('0x6'));var Mustache=require('mustache');var util=require(_0x149f('0x7'));var path=require('path');var sox=require(_0x149f('0x8'));var csv=require('to-csv');var ejs=require(_0x149f('0x9'));var fs=require('fs');var fs_extra=require(_0x149f('0xa'));var _=require(_0x149f('0xb'));var squel=require(_0x149f('0xc'));var crypto=require(_0x149f('0xd'));var jsforce=require(_0x149f('0xe'));var deskjs=require(_0x149f('0xf'));var toCsv=require(_0x149f('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x149f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x149f('0x12'));var as=require(_0x149f('0x13'));var hardwareService=require(_0x149f('0x14'));var logger=require(_0x149f('0x15'))(_0x149f('0x16'));var utils=require(_0x149f('0x17'));var config=require(_0x149f('0x18'));var licenseUtil=require(_0x149f('0x19'));var db=require(_0x149f('0x1a'))['db'];function respondWithStatusCode(_0x52487d,_0x70d2a9){_0x70d2a9=_0x70d2a9||0xcc;return function(_0x134c4d){if(_0x134c4d){return _0x52487d[_0x149f('0x1b')](_0x70d2a9);}return _0x52487d['status'](_0x70d2a9)['end']();};}function respondWithResult(_0x550aa2,_0x3a8cf0){_0x3a8cf0=_0x3a8cf0||0xc8;return function(_0x365946){if(_0x365946){return _0x550aa2[_0x149f('0x1c')](_0x3a8cf0)[_0x149f('0x1d')](_0x365946);}};}function respondWithFilteredResult(_0x4546d7,_0x23d6f9){return function(_0x55d256){if(_0x55d256){var _0x5cb101=typeof _0x23d6f9[_0x149f('0x1e')]===_0x149f('0x1f')&&typeof _0x23d6f9[_0x149f('0x20')]===_0x149f('0x1f');var _0x419083=_0x55d256['count'];var _0x909fc0=_0x5cb101?0x0:_0x23d6f9[_0x149f('0x1e')];var _0x5ce63e=_0x5cb101?_0x55d256['count']:_0x23d6f9['offset']+_0x23d6f9[_0x149f('0x20')];var _0x50d107;if(_0x5ce63e>=_0x419083){_0x5ce63e=_0x419083;_0x50d107=0xc8;}else{_0x50d107=0xce;}_0x4546d7[_0x149f('0x1c')](_0x50d107);return _0x4546d7[_0x149f('0x21')](_0x149f('0x22'),_0x909fc0+'-'+_0x5ce63e+'/'+_0x419083)[_0x149f('0x1d')](_0x55d256);}return null;};}function patchUpdates(_0x18e450){return function(_0xdc966e){try{jsonpatch[_0x149f('0x23')](_0xdc966e,_0x18e450,!![]);}catch(_0x5a48e2){return BPromise['reject'](_0x5a48e2);}return _0xdc966e[_0x149f('0x24')]();};}function saveUpdates(_0x44bab1,_0x2793f9){return function(_0x3b60da){if(_0x3b60da){return _0x3b60da[_0x149f('0x25')](_0x44bab1)['then'](function(_0x2ecb81){return _0x2ecb81;});}return null;};}function removeEntity(_0xc96f43,_0x25307a){return function(_0x362f46){if(_0x362f46){return _0x362f46[_0x149f('0x26')]()['then'](function(){_0xc96f43['status'](0xcc)[_0x149f('0x27')]();});}};}function handleEntityNotFound(_0x9d84b5,_0x564701){return function(_0x491274){if(!_0x491274){_0x9d84b5[_0x149f('0x1b')](0x194);}return _0x491274;};}function handleError(_0x406cb2,_0x2d286f){_0x2d286f=_0x2d286f||0x1f4;return function(_0x191698){logger['error'](_0x191698[_0x149f('0x28')]);if(_0x191698[_0x149f('0x29')]){delete _0x191698['name'];}_0x406cb2[_0x149f('0x1c')](_0x2d286f)[_0x149f('0x2a')](_0x191698);};}exports['index']=function(_0xb30924,_0x10534b){var _0x33b519={},_0x4fb7eb={},_0xaf82f2={'count':0x0,'rows':[]};var _0x1219df=_['map'](db[_0x149f('0x2b')][_0x149f('0x2c')],function(_0x144899){return{'name':_0x144899[_0x149f('0x2d')],'type':_0x144899['type']['key']};});_0x4fb7eb[_0x149f('0x2e')]=_[_0x149f('0x2f')](_0x1219df,_0x149f('0x29'));_0x4fb7eb[_0x149f('0x30')]=_[_0x149f('0x31')](_0xb30924[_0x149f('0x30')]);_0x4fb7eb[_0x149f('0x32')]=_[_0x149f('0x33')](_0x4fb7eb[_0x149f('0x2e')],_0x4fb7eb[_0x149f('0x30')]);_0x33b519[_0x149f('0x34')]=_[_0x149f('0x33')](_0x4fb7eb[_0x149f('0x2e')],qs[_0x149f('0x35')](_0xb30924[_0x149f('0x30')][_0x149f('0x35')]));_0x33b519[_0x149f('0x34')]=_0x33b519[_0x149f('0x34')]['length']?_0x33b519[_0x149f('0x34')]:_0x4fb7eb[_0x149f('0x2e')];if(!_0xb30924['query'][_0x149f('0x36')]('nolimit')){_0x33b519[_0x149f('0x20')]=qs[_0x149f('0x20')](_0xb30924[_0x149f('0x30')][_0x149f('0x20')]);_0x33b519[_0x149f('0x1e')]=qs[_0x149f('0x1e')](_0xb30924[_0x149f('0x30')][_0x149f('0x1e')]);}_0x33b519[_0x149f('0x37')]=qs[_0x149f('0x38')](_0xb30924['query'][_0x149f('0x38')]);_0x33b519[_0x149f('0x39')]=qs[_0x149f('0x32')](_['pick'](_0xb30924[_0x149f('0x30')],_0x4fb7eb[_0x149f('0x32')]),_0x1219df);if(_0xb30924['query'][_0x149f('0x3a')]){_0x33b519['where']=_[_0x149f('0x3b')](_0x33b519[_0x149f('0x39')],{'$or':_[_0x149f('0x2f')](_0x1219df,function(_0x4c7864){if(_0x4c7864[_0x149f('0x3c')]!=='VIRTUAL'){var _0x28fbfd={};_0x28fbfd[_0x4c7864['name']]={'$like':'%'+_0xb30924[_0x149f('0x30')][_0x149f('0x3a')]+'%'};return _0x28fbfd;}})});}_0x33b519=_[_0x149f('0x3b')]({},_0x33b519,_0xb30924['options']);var _0x3c4c47={'where':_0x33b519[_0x149f('0x39')]};return db[_0x149f('0x2b')][_0x149f('0x3d')](_0x3c4c47)['then'](function(_0x4af994){_0xaf82f2[_0x149f('0x3d')]=_0x4af994;if(_0xb30924[_0x149f('0x30')][_0x149f('0x3e')]){_0x33b519['include']=[{'all':!![]}];}return db[_0x149f('0x2b')]['findAll'](_0x33b519);})['then'](function(_0xf64290){_0xaf82f2[_0x149f('0x3f')]=_0xf64290;return _0xaf82f2;})[_0x149f('0x40')](respondWithFilteredResult(_0x10534b,_0x33b519))[_0x149f('0x41')](handleError(_0x10534b,null));};exports[_0x149f('0x42')]=function(_0x45a6ec,_0x904985){var _0x3906fa={'raw':!![],'where':{'id':_0x45a6ec[_0x149f('0x43')]['id']}},_0x59a7cc={};_0x59a7cc[_0x149f('0x2e')]=_[_0x149f('0x31')](db[_0x149f('0x2b')]['rawAttributes']);_0x59a7cc[_0x149f('0x30')]=_[_0x149f('0x31')](_0x45a6ec['query']);_0x59a7cc[_0x149f('0x32')]=_[_0x149f('0x33')](_0x59a7cc[_0x149f('0x2e')],_0x59a7cc[_0x149f('0x30')]);_0x3906fa[_0x149f('0x34')]=_[_0x149f('0x33')](_0x59a7cc[_0x149f('0x2e')],qs['fields'](_0x45a6ec[_0x149f('0x30')][_0x149f('0x35')]));_0x3906fa[_0x149f('0x34')]=_0x3906fa[_0x149f('0x34')]['length']?_0x3906fa[_0x149f('0x34')]:_0x59a7cc[_0x149f('0x2e')];if(_0x45a6ec[_0x149f('0x30')]['includeAll']){_0x3906fa[_0x149f('0x44')]=[{'all':!![]}];}_0x3906fa=_[_0x149f('0x3b')]({},_0x3906fa,_0x45a6ec[_0x149f('0x45')]);return db[_0x149f('0x2b')][_0x149f('0x46')](_0x3906fa)[_0x149f('0x40')](handleEntityNotFound(_0x904985,null))['then'](respondWithResult(_0x904985,null))['catch'](handleError(_0x904985,null));};exports['create']=function(_0x48bbe3,_0x271656){return db['SmsQueueReport'][_0x149f('0x47')](_0x48bbe3[_0x149f('0x48')],{})[_0x149f('0x40')](respondWithResult(_0x271656,0xc9))['catch'](handleError(_0x271656,null));};exports[_0x149f('0x25')]=function(_0x45b80c,_0x3e4170){if(_0x45b80c[_0x149f('0x48')]['id']){delete _0x45b80c[_0x149f('0x48')]['id'];}return db[_0x149f('0x2b')]['find']({'where':{'id':_0x45b80c[_0x149f('0x43')]['id']}})[_0x149f('0x40')](handleEntityNotFound(_0x3e4170,null))['then'](saveUpdates(_0x45b80c['body'],null))[_0x149f('0x40')](respondWithResult(_0x3e4170,null))[_0x149f('0x41')](handleError(_0x3e4170,null));};exports[_0x149f('0x26')]=function(_0x3b0cca,_0x291352){return db['SmsQueueReport'][_0x149f('0x46')]({'where':{'id':_0x3b0cca[_0x149f('0x43')]['id']}})['then'](handleEntityNotFound(_0x291352,null))[_0x149f('0x40')](removeEntity(_0x291352,null))[_0x149f('0x41')](handleError(_0x291352,null));};exports[_0x149f('0x49')]=function(_0x133f1c,_0x494799){return db[_0x149f('0x2b')][_0x149f('0x49')]()[_0x149f('0x40')](respondWithResult(_0x494799,null))[_0x149f('0x41')](handleError(_0x494799,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 9dc4b8f..a272d1c 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 _0x9634=['report_sms_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','exports','define','SmsQueueReport'];(function(_0x3d5d40,_0x143d30){var _0x5ddfa8=function(_0x257915){while(--_0x257915){_0x3d5d40['push'](_0x3d5d40['shift']());}};_0x5ddfa8(++_0x143d30);}(_0x9634,0x146));var _0x4963=function(_0x2f8260,_0x2d3723){_0x2f8260=_0x2f8260-0x0;var _0x5d8b77=_0x9634[_0x2f8260];return _0x5d8b77;};'use strict';var _=require(_0x4963('0x0'));var util=require(_0x4963('0x1'));var logger=require(_0x4963('0x2'))(_0x4963('0x3'));var moment=require('moment');var BPromise=require(_0x4963('0x4'));var rp=require(_0x4963('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4963('0x6'));var config=require('../../config/environment');var attributes=require('./smsQueueReport.attributes');module[_0x4963('0x7')]=function(_0x58db09,_0x55ba97){return _0x58db09[_0x4963('0x8')](_0x4963('0x9'),attributes,{'tableName':_0x4963('0xa'),'paranoid':![],'indexes':[{'name':_0x4963('0xb'),'fields':[_0x4963('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaa0c=['api','moment','request-promise','path','rimraf','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','../../config/logger'];(function(_0x28dc10,_0x1ed705){var _0x5c1fd6=function(_0x1d1ee1){while(--_0x1d1ee1){_0x28dc10['push'](_0x28dc10['shift']());}};_0x5c1fd6(++_0x1ed705);}(_0xaa0c,0xfa));var _0xcaa0=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xaa0c[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0xcaa0('0x0'));var util=require('util');var logger=require(_0xcaa0('0x1'))(_0xcaa0('0x2'));var moment=require(_0xcaa0('0x3'));var BPromise=require('bluebird');var rp=require(_0xcaa0('0x4'));var fs=require('fs');var path=require(_0xcaa0('0x5'));var rimraf=require(_0xcaa0('0x6'));var config=require('../../config/environment');var attributes=require('./smsQueueReport.attributes');module[_0xcaa0('0x7')]=function(_0x1cf755,_0x1ef798){return _0x1cf755[_0xcaa0('0x8')](_0xcaa0('0x9'),attributes,{'tableName':_0xcaa0('0xa'),'paranoid':![],'indexes':[{'name':_0xcaa0('0xb'),'fields':[_0xcaa0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 8a5c5c1..5871a5d 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 _0xdc85=['code','message','SmsQueueReport,\x20%s,\x20%s','result','catch','create','body','CreateSmsQueueReport','SmsQueueReport','update','options','where','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3c77cb,_0x55974d){var _0x5c57de=function(_0x4f3641){while(--_0x4f3641){_0x3c77cb['push'](_0x3c77cb['shift']());}};_0x5c57de(++_0x55974d);}(_0xdc85,0xaf));var _0x5dc8=function(_0x4dbbfd,_0x379c75){_0x4dbbfd=_0x4dbbfd-0x0;var _0x14da99=_0xdc85[_0x4dbbfd];return _0x14da99;};'use strict';var _=require(_0x5dc8('0x0'));var util=require(_0x5dc8('0x1'));var moment=require(_0x5dc8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5dc8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5dc8('0x4'))(_0x5dc8('0x5'));var config=require(_0x5dc8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5dc8('0x7')][_0x5dc8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x383a15,_0x270507,_0xb949d2){return new BPromise(function(_0x108aca,_0x386f48){return client[_0x5dc8('0x9')](_0x383a15,_0xb949d2)[_0x5dc8('0xa')](function(_0x53bcc9){logger[_0x5dc8('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x270507,_0x5dc8('0xc'));logger[_0x5dc8('0xd')](_0x5dc8('0xe'),_0x270507,_0x5dc8('0xc'),JSON[_0x5dc8('0xf')](_0x53bcc9));if(_0x53bcc9[_0x5dc8('0x10')]){if(_0x53bcc9[_0x5dc8('0x10')][_0x5dc8('0x11')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x270507,_0x53bcc9[_0x5dc8('0x10')][_0x5dc8('0x12')]);return _0x386f48(_0x53bcc9[_0x5dc8('0x10')]['message']);}logger['error'](_0x5dc8('0x13'),_0x270507,_0x53bcc9['error'][_0x5dc8('0x12')]);return _0x108aca(_0x53bcc9[_0x5dc8('0x10')][_0x5dc8('0x12')]);}else{logger[_0x5dc8('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x270507,_0x5dc8('0xc'));_0x108aca(_0x53bcc9[_0x5dc8('0x14')][_0x5dc8('0x12')]);}})[_0x5dc8('0x15')](function(_0x1eb34c){logger[_0x5dc8('0x10')](_0x5dc8('0x13'),_0x270507,_0x1eb34c);_0x386f48(_0x1eb34c);});});}exports['CreateSmsQueueReport']=function(_0x5bf5dc){var _0x26f896=this;return new Promise(function(_0x49375b,_0x356503){return db['SmsQueueReport'][_0x5dc8('0x16')](_0x5bf5dc[_0x5dc8('0x17')],{'raw':_0x5bf5dc['options']?_0x5bf5dc['options']['raw']===undefined?!![]:![]:!![]})[_0x5dc8('0xa')](function(_0x511429){logger[_0x5dc8('0xb')](_0x5dc8('0x18'),_0x5bf5dc);logger[_0x5dc8('0xd')]('CreateSmsQueueReport',_0x5bf5dc,JSON[_0x5dc8('0xf')](_0x511429));_0x49375b(_0x511429);})[_0x5dc8('0x15')](function(_0x5332f4){logger[_0x5dc8('0x10')](_0x5dc8('0x18'),_0x5332f4['message'],_0x5bf5dc);_0x356503(_0x26f896[_0x5dc8('0x10')](0x1f4,_0x5332f4[_0x5dc8('0x12')]));});});};exports['UpdateSmsQueueReport']=function(_0x2e7c91){var _0x2b64e3=this;return new Promise(function(_0x557f5d,_0x29d2f4){return db[_0x5dc8('0x19')][_0x5dc8('0x1a')](_0x2e7c91[_0x5dc8('0x17')],{'raw':_0x2e7c91[_0x5dc8('0x1b')]?_0x2e7c91[_0x5dc8('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e7c91[_0x5dc8('0x1b')]?_0x2e7c91['options'][_0x5dc8('0x1c')]||null:null,'attributes':_0x2e7c91[_0x5dc8('0x1b')]?_0x2e7c91[_0x5dc8('0x1b')][_0x5dc8('0x1d')]||null:null,'limit':_0x2e7c91[_0x5dc8('0x1b')]?_0x2e7c91[_0x5dc8('0x1b')][_0x5dc8('0x1e')]||null:null})['then'](function(_0x58f367){logger['info'](_0x5dc8('0x1f'),_0x2e7c91);logger['debug'](_0x5dc8('0x1f'),_0x2e7c91,JSON[_0x5dc8('0xf')](_0x58f367));_0x557f5d(_0x58f367);})[_0x5dc8('0x15')](function(_0x346166){logger[_0x5dc8('0x10')](_0x5dc8('0x1f'),_0x346166['message'],_0x2e7c91);_0x29d2f4(_0x2b64e3[_0x5dc8('0x10')](0x1f4,_0x346166['message']));});});}; \ No newline at end of file +var _0x4ef7=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','update','attributes','limit','catch','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4ef7,0x11b));var _0x74ef=function(_0x2b600c,_0x5ea350){_0x2b600c=_0x2b600c-0x0;var _0xc016b5=_0x4ef7[_0x2b600c];return _0xc016b5;};'use strict';var _=require(_0x74ef('0x0'));var util=require(_0x74ef('0x1'));var moment=require('moment');var BPromise=require(_0x74ef('0x2'));var rs=require(_0x74ef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74ef('0x4'))['db'];var utils=require(_0x74ef('0x5'));var logger=require(_0x74ef('0x6'))(_0x74ef('0x7'));var config=require('../../config/environment');var jayson=require(_0x74ef('0x8'));var client=jayson[_0x74ef('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8ed50b,_0x55af06,_0x5eb589){return new BPromise(function(_0xaff0de,_0xc95975){return client[_0x74ef('0xa')](_0x8ed50b,_0x5eb589)[_0x74ef('0xb')](function(_0xac97c7){logger['info'](_0x74ef('0xc'),_0x55af06,_0x74ef('0xd'));logger[_0x74ef('0xe')](_0x74ef('0xf'),_0x55af06,_0x74ef('0xd'),JSON[_0x74ef('0x10')](_0xac97c7));if(_0xac97c7[_0x74ef('0x11')]){if(_0xac97c7[_0x74ef('0x11')][_0x74ef('0x12')]===0x1f4){logger[_0x74ef('0x11')](_0x74ef('0xc'),_0x55af06,_0xac97c7['error'][_0x74ef('0x13')]);return _0xc95975(_0xac97c7[_0x74ef('0x11')]['message']);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x55af06,_0xac97c7[_0x74ef('0x11')][_0x74ef('0x13')]);return _0xaff0de(_0xac97c7[_0x74ef('0x11')][_0x74ef('0x13')]);}else{logger[_0x74ef('0x14')](_0x74ef('0xc'),_0x55af06,_0x74ef('0xd'));_0xaff0de(_0xac97c7['result']['message']);}})['catch'](function(_0x490d58){logger[_0x74ef('0x11')](_0x74ef('0xc'),_0x55af06,_0x490d58);_0xc95975(_0x490d58);});});}exports[_0x74ef('0x15')]=function(_0x2a24df){var _0x48e2de=this;return new Promise(function(_0x2afbce,_0x367e42){return db[_0x74ef('0x16')][_0x74ef('0x17')](_0x2a24df[_0x74ef('0x18')],{'raw':_0x2a24df[_0x74ef('0x19')]?_0x2a24df[_0x74ef('0x19')][_0x74ef('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0xb709ea){logger[_0x74ef('0x14')]('CreateSmsQueueReport',_0x2a24df);logger[_0x74ef('0xe')](_0x74ef('0x15'),_0x2a24df,JSON['stringify'](_0xb709ea));_0x2afbce(_0xb709ea);})['catch'](function(_0x42d886){logger['error'](_0x74ef('0x15'),_0x42d886[_0x74ef('0x13')],_0x2a24df);_0x367e42(_0x48e2de[_0x74ef('0x11')](0x1f4,_0x42d886[_0x74ef('0x13')]));});});};exports[_0x74ef('0x1b')]=function(_0x4c616f){var _0x26b51f=this;return new Promise(function(_0x1a5a9c,_0xd369ff){return db[_0x74ef('0x16')][_0x74ef('0x1c')](_0x4c616f[_0x74ef('0x18')],{'raw':_0x4c616f[_0x74ef('0x19')]?_0x4c616f[_0x74ef('0x19')][_0x74ef('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c616f[_0x74ef('0x19')]?_0x4c616f['options']['where']||null:null,'attributes':_0x4c616f['options']?_0x4c616f[_0x74ef('0x19')][_0x74ef('0x1d')]||null:null,'limit':_0x4c616f[_0x74ef('0x19')]?_0x4c616f[_0x74ef('0x19')][_0x74ef('0x1e')]||null:null})['then'](function(_0x1e0639){logger[_0x74ef('0x14')](_0x74ef('0x1b'),_0x4c616f);logger['debug'](_0x74ef('0x1b'),_0x4c616f,JSON['stringify'](_0x1e0639));_0x1a5a9c(_0x1e0639);})[_0x74ef('0x1f')](function(_0x4c3e0c){logger[_0x74ef('0x11')](_0x74ef('0x1b'),_0x4c3e0c[_0x74ef('0x13')],_0x4c616f);_0xd369ff(_0x26b51f[_0x74ef('0x11')](0x1f4,_0x4c3e0c[_0x74ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 1ba09da..a48c93b 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 _0xe92a=['describe','/:id','create','put','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xe92a,0x16e));var _0xae92=function(_0x25d879,_0xa88561){_0x25d879=_0x25d879-0x0;var _0x5d55a4=_0xe92a[_0x25d879];return _0x5d55a4;};'use strict';var multer=require(_0xae92('0x0'));var util=require(_0xae92('0x1'));var path=require('path');var timeout=require(_0xae92('0x2'));var express=require('express');var router=express[_0xae92('0x3')]();var fs_extra=require(_0xae92('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xae92('0x5'));var config=require(_0xae92('0x6'));var controller=require(_0xae92('0x7'));router[_0xae92('0x8')]('/',auth[_0xae92('0x9')](),controller[_0xae92('0xa')]);router['get'](_0xae92('0xb'),auth[_0xae92('0x9')](),controller[_0xae92('0xc')]);router['get'](_0xae92('0xd'),auth[_0xae92('0x9')](),controller['show']);router['post']('/',auth[_0xae92('0x9')](),controller[_0xae92('0xe')]);router[_0xae92('0xf')](_0xae92('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xae92('0xd'),auth['isAuthenticated'](),controller[_0xae92('0x10')]);module[_0xae92('0x11')]=router; \ No newline at end of file +var _0x1e5c=['isAuthenticated','index','get','/:id','post','put','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller'];(function(_0x1dd82f,_0x52acb7){var _0x353ca4=function(_0x5ee4c9){while(--_0x5ee4c9){_0x1dd82f['push'](_0x1dd82f['shift']());}};_0x353ca4(++_0x52acb7);}(_0x1e5c,0x191));var _0xc1e5=function(_0x47750d,_0x1101ef){_0x47750d=_0x47750d-0x0;var _0x5d8e7c=_0x1e5c[_0x47750d];return _0x5d8e7c;};'use strict';var multer=require(_0xc1e5('0x0'));var util=require(_0xc1e5('0x1'));var path=require('path');var timeout=require(_0xc1e5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc1e5('0x3'));var auth=require(_0xc1e5('0x4'));var interaction=require(_0xc1e5('0x5'));var config=require('../../config/environment');var controller=require(_0xc1e5('0x6'));router['get']('/',auth[_0xc1e5('0x7')](),controller[_0xc1e5('0x8')]);router[_0xc1e5('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc1e5('0x9')](_0xc1e5('0xa'),auth[_0xc1e5('0x7')](),controller['show']);router[_0xc1e5('0xb')]('/',auth[_0xc1e5('0x7')](),controller['create']);router[_0xc1e5('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xc1e5('0xd')]);router[_0xc1e5('0xe')](_0xc1e5('0xa'),auth[_0xc1e5('0x7')](),controller[_0xc1e5('0xf')]);module[_0xc1e5('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 ece00bd..6f88611 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 _0x2360=['queue','moment','exports','STRING','account'];(function(_0x1e1b18,_0x5d471b){var _0x3da8f2=function(_0x51fe71){while(--_0x51fe71){_0x1e1b18['push'](_0x1e1b18['shift']());}};_0x3da8f2(++_0x5d471b);}(_0x2360,0x100));var _0x0236=function(_0x27289f,_0x26cc6c){_0x27289f=_0x27289f-0x0;var _0x53a5ab=_0x2360[_0x27289f];return _0x53a5ab;};'use strict';var moment=require(_0x0236('0x0'));var Sequelize=require('sequelize');module[_0x0236('0x1')]={'uniqueid':{'type':Sequelize[_0x0236('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0236('0x3'),'agent','queue'),'allowNull':![],'defaultValue':_0x0236('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xa31c=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x17e54a,_0x15c0d1){var _0x321cfc=function(_0x303b69){while(--_0x303b69){_0x17e54a['push'](_0x17e54a['shift']());}};_0x321cfc(++_0x15c0d1);}(_0xa31c,0x8d));var _0xca31=function(_0x320626,_0x3cc862){_0x320626=_0x320626-0x0;var _0x757d40=_0xa31c[_0x320626];return _0x757d40;};'use strict';var moment=require(_0xca31('0x0'));var Sequelize=require(_0xca31('0x1'));module[_0xca31('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xca31('0x3'),_0xca31('0x4'),_0xca31('0x5')),'allowNull':![],'defaultValue':_0xca31('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xca31('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 475a92c..7cbb354 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 _0x34f8=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','then','destroy','error','stack','name','send','index','SmsTransferReport','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','rows','show','params','includeAll','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x44e487,_0x457420){var _0x347512=function(_0x1f6c38){while(--_0x1f6c38){_0x44e487['push'](_0x44e487['shift']());}};_0x347512(++_0x457420);}(_0x34f8,0x80));var _0x834f=function(_0x48c012,_0xd7fde9){_0x48c012=_0x48c012-0x0;var _0x48b571=_0x34f8[_0x48c012];return _0x48b571;};'use strict';var emlformat=require(_0x834f('0x0'));var rimraf=require(_0x834f('0x1'));var zipdir=require(_0x834f('0x2'));var jsonpatch=require(_0x834f('0x3'));var rp=require(_0x834f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x834f('0x5'));var util=require(_0x834f('0x6'));var path=require('path');var sox=require(_0x834f('0x7'));var csv=require(_0x834f('0x8'));var ejs=require(_0x834f('0x9'));var fs=require('fs');var fs_extra=require(_0x834f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x834f('0xb'));var jsforce=require(_0x834f('0xc'));var deskjs=require(_0x834f('0xd'));var toCsv=require(_0x834f('0x8'));var querystring=require('querystring');var Papa=require(_0x834f('0xe'));var Redis=require(_0x834f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x834f('0x10'));var as=require(_0x834f('0x11'));var hardwareService=require(_0x834f('0x12'));var logger=require(_0x834f('0x13'))(_0x834f('0x14'));var utils=require(_0x834f('0x15'));var config=require(_0x834f('0x16'));var licenseUtil=require(_0x834f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bed55,_0x46b91b){_0x46b91b=_0x46b91b||0xcc;return function(_0x456e59){if(_0x456e59){return _0x2bed55[_0x834f('0x18')](_0x46b91b);}return _0x2bed55[_0x834f('0x19')](_0x46b91b)['end']();};}function respondWithResult(_0x1757ae,_0x2f8592){_0x2f8592=_0x2f8592||0xc8;return function(_0x5bfea4){if(_0x5bfea4){return _0x1757ae[_0x834f('0x19')](_0x2f8592)[_0x834f('0x1a')](_0x5bfea4);}};}function respondWithFilteredResult(_0x55bc81,_0x2b9a0c){return function(_0x4bb979){if(_0x4bb979){var _0x342382=typeof _0x2b9a0c[_0x834f('0x1b')]===_0x834f('0x1c')&&typeof _0x2b9a0c[_0x834f('0x1d')]==='undefined';var _0x58154d=_0x4bb979[_0x834f('0x1e')];var _0x440b9b=_0x342382?0x0:_0x2b9a0c[_0x834f('0x1b')];var _0x320ee2=_0x342382?_0x4bb979['count']:_0x2b9a0c[_0x834f('0x1b')]+_0x2b9a0c[_0x834f('0x1d')];var _0x29cccd;if(_0x320ee2>=_0x58154d){_0x320ee2=_0x58154d;_0x29cccd=0xc8;}else{_0x29cccd=0xce;}_0x55bc81['status'](_0x29cccd);return _0x55bc81['set'](_0x834f('0x1f'),_0x440b9b+'-'+_0x320ee2+'/'+_0x58154d)['json'](_0x4bb979);}return null;};}function patchUpdates(_0x268e34){return function(_0x148839){try{jsonpatch['apply'](_0x148839,_0x268e34,!![]);}catch(_0x1fe653){return BPromise['reject'](_0x1fe653);}return _0x148839[_0x834f('0x20')]();};}function saveUpdates(_0x1157e2,_0x31044a){return function(_0x24cf5d){if(_0x24cf5d){return _0x24cf5d['update'](_0x1157e2)[_0x834f('0x21')](function(_0x4f62c8){return _0x4f62c8;});}return null;};}function removeEntity(_0x3ec8dc,_0x59af4e){return function(_0x536907){if(_0x536907){return _0x536907[_0x834f('0x22')]()['then'](function(){_0x3ec8dc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45e1ef,_0x2268a1){return function(_0xf54a26){if(!_0xf54a26){_0x45e1ef[_0x834f('0x18')](0x194);}return _0xf54a26;};}function handleError(_0x44355b,_0x2d852b){_0x2d852b=_0x2d852b||0x1f4;return function(_0x2cace0){logger[_0x834f('0x23')](_0x2cace0[_0x834f('0x24')]);if(_0x2cace0[_0x834f('0x25')]){delete _0x2cace0[_0x834f('0x25')];}_0x44355b['status'](_0x2d852b)[_0x834f('0x26')](_0x2cace0);};}exports[_0x834f('0x27')]=function(_0xcd12fe,_0x586324){var _0x1136b9={},_0x37e1d8={},_0x20da2d={'count':0x0,'rows':[]};var _0x2854e4=_['map'](db[_0x834f('0x28')][_0x834f('0x29')],function(_0xd411e){return{'name':_0xd411e[_0x834f('0x2a')],'type':_0xd411e['type'][_0x834f('0x2b')]};});_0x37e1d8[_0x834f('0x2c')]=_[_0x834f('0x2d')](_0x2854e4,_0x834f('0x25'));_0x37e1d8['query']=_[_0x834f('0x2e')](_0xcd12fe[_0x834f('0x2f')]);_0x37e1d8['filters']=_[_0x834f('0x30')](_0x37e1d8[_0x834f('0x2c')],_0x37e1d8['query']);_0x1136b9[_0x834f('0x31')]=_[_0x834f('0x30')](_0x37e1d8[_0x834f('0x2c')],qs[_0x834f('0x32')](_0xcd12fe[_0x834f('0x2f')]['fields']));_0x1136b9[_0x834f('0x31')]=_0x1136b9['attributes']['length']?_0x1136b9[_0x834f('0x31')]:_0x37e1d8['model'];if(!_0xcd12fe[_0x834f('0x2f')][_0x834f('0x33')](_0x834f('0x34'))){_0x1136b9[_0x834f('0x1d')]=qs['limit'](_0xcd12fe['query']['limit']);_0x1136b9[_0x834f('0x1b')]=qs[_0x834f('0x1b')](_0xcd12fe[_0x834f('0x2f')][_0x834f('0x1b')]);}_0x1136b9[_0x834f('0x35')]=qs['sort'](_0xcd12fe[_0x834f('0x2f')][_0x834f('0x36')]);_0x1136b9[_0x834f('0x37')]=qs[_0x834f('0x38')](_[_0x834f('0x39')](_0xcd12fe[_0x834f('0x2f')],_0x37e1d8[_0x834f('0x38')]),_0x2854e4);if(_0xcd12fe[_0x834f('0x2f')][_0x834f('0x3a')]){_0x1136b9[_0x834f('0x37')]=_[_0x834f('0x3b')](_0x1136b9[_0x834f('0x37')],{'$or':_[_0x834f('0x2d')](_0x2854e4,function(_0x4b4709){if(_0x4b4709['type']!=='VIRTUAL'){var _0x2cc5f7={};_0x2cc5f7[_0x4b4709['name']]={'$like':'%'+_0xcd12fe['query'][_0x834f('0x3a')]+'%'};return _0x2cc5f7;}})});}_0x1136b9=_[_0x834f('0x3b')]({},_0x1136b9,_0xcd12fe[_0x834f('0x3c')]);var _0x236711={'where':_0x1136b9[_0x834f('0x37')]};return db['SmsTransferReport'][_0x834f('0x1e')](_0x236711)[_0x834f('0x21')](function(_0xa9d502){_0x20da2d[_0x834f('0x1e')]=_0xa9d502;if(_0xcd12fe[_0x834f('0x2f')]['includeAll']){_0x1136b9[_0x834f('0x3d')]=[{'all':!![]}];}return db[_0x834f('0x28')]['findAll'](_0x1136b9);})[_0x834f('0x21')](function(_0x59869){_0x20da2d[_0x834f('0x3e')]=_0x59869;return _0x20da2d;})['then'](respondWithFilteredResult(_0x586324,_0x1136b9))['catch'](handleError(_0x586324,null));};exports[_0x834f('0x3f')]=function(_0x5616ca,_0x49f627){var _0x1b2744={'raw':!![],'where':{'id':_0x5616ca[_0x834f('0x40')]['id']}},_0x214549={};_0x214549['model']=_['keys'](db['SmsTransferReport']['rawAttributes']);_0x214549[_0x834f('0x2f')]=_['keys'](_0x5616ca[_0x834f('0x2f')]);_0x214549[_0x834f('0x38')]=_[_0x834f('0x30')](_0x214549['model'],_0x214549[_0x834f('0x2f')]);_0x1b2744[_0x834f('0x31')]=_[_0x834f('0x30')](_0x214549[_0x834f('0x2c')],qs[_0x834f('0x32')](_0x5616ca[_0x834f('0x2f')][_0x834f('0x32')]));_0x1b2744[_0x834f('0x31')]=_0x1b2744['attributes']['length']?_0x1b2744[_0x834f('0x31')]:_0x214549[_0x834f('0x2c')];if(_0x5616ca[_0x834f('0x2f')][_0x834f('0x41')]){_0x1b2744['include']=[{'all':!![]}];}_0x1b2744=_['merge']({},_0x1b2744,_0x5616ca['options']);return db['SmsTransferReport'][_0x834f('0x42')](_0x1b2744)[_0x834f('0x21')](handleEntityNotFound(_0x49f627,null))[_0x834f('0x21')](respondWithResult(_0x49f627,null))[_0x834f('0x43')](handleError(_0x49f627,null));};exports[_0x834f('0x44')]=function(_0x2076e2,_0x5db5d5){return db[_0x834f('0x28')][_0x834f('0x44')](_0x2076e2[_0x834f('0x45')],{})[_0x834f('0x21')](respondWithResult(_0x5db5d5,0xc9))[_0x834f('0x43')](handleError(_0x5db5d5,null));};exports[_0x834f('0x46')]=function(_0x2203af,_0x28a8eb){if(_0x2203af[_0x834f('0x45')]['id']){delete _0x2203af['body']['id'];}return db[_0x834f('0x28')][_0x834f('0x42')]({'where':{'id':_0x2203af[_0x834f('0x40')]['id']}})['then'](handleEntityNotFound(_0x28a8eb,null))[_0x834f('0x21')](saveUpdates(_0x2203af[_0x834f('0x45')],null))[_0x834f('0x21')](respondWithResult(_0x28a8eb,null))[_0x834f('0x43')](handleError(_0x28a8eb,null));};exports['destroy']=function(_0x3320e3,_0x1617da){return db[_0x834f('0x28')][_0x834f('0x42')]({'where':{'id':_0x3320e3['params']['id']}})[_0x834f('0x21')](handleEntityNotFound(_0x1617da,null))[_0x834f('0x21')](removeEntity(_0x1617da,null))['catch'](handleError(_0x1617da,null));};exports[_0x834f('0x47')]=function(_0x5b8c59,_0x2224ef){return db['SmsTransferReport'][_0x834f('0x47')]()['then'](respondWithResult(_0x2224ef,null))[_0x834f('0x43')](handleError(_0x2224ef,null));}; \ No newline at end of file +var _0xb848=['limit','count','offset','set','apply','reject','save','update','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','SmsTransferReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined'];(function(_0x24a9a0,_0x5c3122){var _0x601aab=function(_0x3de2cb){while(--_0x3de2cb){_0x24a9a0['push'](_0x24a9a0['shift']());}};_0x601aab(++_0x5c3122);}(_0xb848,0x1ad));var _0x8b84=function(_0x599914,_0x26e295){_0x599914=_0x599914-0x0;var _0xa197ab=_0xb848[_0x599914];return _0xa197ab;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8b84('0x0'));var jsonpatch=require(_0x8b84('0x1'));var rp=require(_0x8b84('0x2'));var moment=require('moment');var BPromise=require(_0x8b84('0x3'));var Mustache=require('mustache');var util=require(_0x8b84('0x4'));var path=require(_0x8b84('0x5'));var sox=require(_0x8b84('0x6'));var csv=require('to-csv');var ejs=require(_0x8b84('0x7'));var fs=require('fs');var fs_extra=require(_0x8b84('0x8'));var _=require(_0x8b84('0x9'));var squel=require(_0x8b84('0xa'));var crypto=require(_0x8b84('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8b84('0xc'));var toCsv=require(_0x8b84('0xd'));var querystring=require(_0x8b84('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b84('0xf'));var qs=require(_0x8b84('0x10'));var as=require(_0x8b84('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b84('0x12'))(_0x8b84('0x13'));var utils=require(_0x8b84('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8b84('0x15'));var db=require(_0x8b84('0x16'))['db'];function respondWithStatusCode(_0x1ef114,_0x5d44a4){_0x5d44a4=_0x5d44a4||0xcc;return function(_0x185da8){if(_0x185da8){return _0x1ef114['sendStatus'](_0x5d44a4);}return _0x1ef114[_0x8b84('0x17')](_0x5d44a4)[_0x8b84('0x18')]();};}function respondWithResult(_0x1d6f5e,_0x3167eb){_0x3167eb=_0x3167eb||0xc8;return function(_0x48cdca){if(_0x48cdca){return _0x1d6f5e['status'](_0x3167eb)[_0x8b84('0x19')](_0x48cdca);}};}function respondWithFilteredResult(_0x232f7d,_0x2cd853){return function(_0x102c8b){if(_0x102c8b){var _0x11c78f=typeof _0x2cd853['offset']===_0x8b84('0x1a')&&typeof _0x2cd853[_0x8b84('0x1b')]===_0x8b84('0x1a');var _0x46edaa=_0x102c8b[_0x8b84('0x1c')];var _0x540498=_0x11c78f?0x0:_0x2cd853[_0x8b84('0x1d')];var _0x1f8f64=_0x11c78f?_0x102c8b[_0x8b84('0x1c')]:_0x2cd853[_0x8b84('0x1d')]+_0x2cd853[_0x8b84('0x1b')];var _0xf2f5b1;if(_0x1f8f64>=_0x46edaa){_0x1f8f64=_0x46edaa;_0xf2f5b1=0xc8;}else{_0xf2f5b1=0xce;}_0x232f7d[_0x8b84('0x17')](_0xf2f5b1);return _0x232f7d[_0x8b84('0x1e')]('Content-Range',_0x540498+'-'+_0x1f8f64+'/'+_0x46edaa)[_0x8b84('0x19')](_0x102c8b);}return null;};}function patchUpdates(_0x4a7c40){return function(_0x2b9347){try{jsonpatch[_0x8b84('0x1f')](_0x2b9347,_0x4a7c40,!![]);}catch(_0x4585ce){return BPromise[_0x8b84('0x20')](_0x4585ce);}return _0x2b9347[_0x8b84('0x21')]();};}function saveUpdates(_0x562c6e,_0x274dda){return function(_0x3a5e03){if(_0x3a5e03){return _0x3a5e03[_0x8b84('0x22')](_0x562c6e)[_0x8b84('0x23')](function(_0x2ddc58){return _0x2ddc58;});}return null;};}function removeEntity(_0x23adfd,_0x117f70){return function(_0x134921){if(_0x134921){return _0x134921['destroy']()['then'](function(){_0x23adfd[_0x8b84('0x17')](0xcc)[_0x8b84('0x18')]();});}};}function handleEntityNotFound(_0x1b23d3,_0x4d86fc){return function(_0x369341){if(!_0x369341){_0x1b23d3[_0x8b84('0x24')](0x194);}return _0x369341;};}function handleError(_0x614feb,_0xa2f3e0){_0xa2f3e0=_0xa2f3e0||0x1f4;return function(_0x4c82eb){logger[_0x8b84('0x25')](_0x4c82eb['stack']);if(_0x4c82eb[_0x8b84('0x26')]){delete _0x4c82eb[_0x8b84('0x26')];}_0x614feb[_0x8b84('0x17')](_0xa2f3e0)[_0x8b84('0x27')](_0x4c82eb);};}exports[_0x8b84('0x28')]=function(_0x2c1b17,_0x5951bc){var _0xb3c68e={},_0x50979a={},_0x29f613={'count':0x0,'rows':[]};var _0x1603b5=_[_0x8b84('0x29')](db['SmsTransferReport'][_0x8b84('0x2a')],function(_0x4f89fe){return{'name':_0x4f89fe[_0x8b84('0x2b')],'type':_0x4f89fe['type'][_0x8b84('0x2c')]};});_0x50979a[_0x8b84('0x2d')]=_['map'](_0x1603b5,_0x8b84('0x26'));_0x50979a[_0x8b84('0x2e')]=_[_0x8b84('0x2f')](_0x2c1b17[_0x8b84('0x2e')]);_0x50979a['filters']=_[_0x8b84('0x30')](_0x50979a[_0x8b84('0x2d')],_0x50979a[_0x8b84('0x2e')]);_0xb3c68e['attributes']=_[_0x8b84('0x30')](_0x50979a['model'],qs[_0x8b84('0x31')](_0x2c1b17[_0x8b84('0x2e')]['fields']));_0xb3c68e['attributes']=_0xb3c68e[_0x8b84('0x32')][_0x8b84('0x33')]?_0xb3c68e[_0x8b84('0x32')]:_0x50979a[_0x8b84('0x2d')];if(!_0x2c1b17[_0x8b84('0x2e')]['hasOwnProperty'](_0x8b84('0x34'))){_0xb3c68e[_0x8b84('0x1b')]=qs[_0x8b84('0x1b')](_0x2c1b17[_0x8b84('0x2e')][_0x8b84('0x1b')]);_0xb3c68e['offset']=qs[_0x8b84('0x1d')](_0x2c1b17[_0x8b84('0x2e')][_0x8b84('0x1d')]);}_0xb3c68e[_0x8b84('0x35')]=qs[_0x8b84('0x36')](_0x2c1b17[_0x8b84('0x2e')][_0x8b84('0x36')]);_0xb3c68e[_0x8b84('0x37')]=qs['filters'](_[_0x8b84('0x38')](_0x2c1b17[_0x8b84('0x2e')],_0x50979a[_0x8b84('0x39')]),_0x1603b5);if(_0x2c1b17[_0x8b84('0x2e')]['filter']){_0xb3c68e[_0x8b84('0x37')]=_[_0x8b84('0x3a')](_0xb3c68e[_0x8b84('0x37')],{'$or':_[_0x8b84('0x29')](_0x1603b5,function(_0xbef2eb){if(_0xbef2eb[_0x8b84('0x3b')]!==_0x8b84('0x3c')){var _0x4b4dcc={};_0x4b4dcc[_0xbef2eb[_0x8b84('0x26')]]={'$like':'%'+_0x2c1b17[_0x8b84('0x2e')][_0x8b84('0x3d')]+'%'};return _0x4b4dcc;}})});}_0xb3c68e=_[_0x8b84('0x3a')]({},_0xb3c68e,_0x2c1b17[_0x8b84('0x3e')]);var _0x55b2ec={'where':_0xb3c68e[_0x8b84('0x37')]};return db[_0x8b84('0x3f')][_0x8b84('0x1c')](_0x55b2ec)[_0x8b84('0x23')](function(_0x1a4be6){_0x29f613[_0x8b84('0x1c')]=_0x1a4be6;if(_0x2c1b17[_0x8b84('0x2e')][_0x8b84('0x40')]){_0xb3c68e[_0x8b84('0x41')]=[{'all':!![]}];}return db[_0x8b84('0x3f')][_0x8b84('0x42')](_0xb3c68e);})[_0x8b84('0x23')](function(_0x3d8271){_0x29f613[_0x8b84('0x43')]=_0x3d8271;return _0x29f613;})[_0x8b84('0x23')](respondWithFilteredResult(_0x5951bc,_0xb3c68e))[_0x8b84('0x44')](handleError(_0x5951bc,null));};exports[_0x8b84('0x45')]=function(_0x5a28ce,_0x294af0){var _0x310eb5={'raw':!![],'where':{'id':_0x5a28ce[_0x8b84('0x46')]['id']}},_0x4aabfc={};_0x4aabfc[_0x8b84('0x2d')]=_[_0x8b84('0x2f')](db['SmsTransferReport'][_0x8b84('0x2a')]);_0x4aabfc[_0x8b84('0x2e')]=_[_0x8b84('0x2f')](_0x5a28ce[_0x8b84('0x2e')]);_0x4aabfc[_0x8b84('0x39')]=_[_0x8b84('0x30')](_0x4aabfc[_0x8b84('0x2d')],_0x4aabfc[_0x8b84('0x2e')]);_0x310eb5[_0x8b84('0x32')]=_[_0x8b84('0x30')](_0x4aabfc['model'],qs[_0x8b84('0x31')](_0x5a28ce['query'][_0x8b84('0x31')]));_0x310eb5[_0x8b84('0x32')]=_0x310eb5[_0x8b84('0x32')][_0x8b84('0x33')]?_0x310eb5['attributes']:_0x4aabfc[_0x8b84('0x2d')];if(_0x5a28ce[_0x8b84('0x2e')][_0x8b84('0x40')]){_0x310eb5['include']=[{'all':!![]}];}_0x310eb5=_[_0x8b84('0x3a')]({},_0x310eb5,_0x5a28ce[_0x8b84('0x3e')]);return db[_0x8b84('0x3f')][_0x8b84('0x47')](_0x310eb5)[_0x8b84('0x23')](handleEntityNotFound(_0x294af0,null))['then'](respondWithResult(_0x294af0,null))[_0x8b84('0x44')](handleError(_0x294af0,null));};exports[_0x8b84('0x48')]=function(_0x38eda5,_0x16f1e4){return db['SmsTransferReport'][_0x8b84('0x48')](_0x38eda5[_0x8b84('0x49')],{})[_0x8b84('0x23')](respondWithResult(_0x16f1e4,0xc9))[_0x8b84('0x44')](handleError(_0x16f1e4,null));};exports[_0x8b84('0x22')]=function(_0x57dafb,_0x3eca0c){if(_0x57dafb[_0x8b84('0x49')]['id']){delete _0x57dafb[_0x8b84('0x49')]['id'];}return db[_0x8b84('0x3f')]['find']({'where':{'id':_0x57dafb['params']['id']}})[_0x8b84('0x23')](handleEntityNotFound(_0x3eca0c,null))[_0x8b84('0x23')](saveUpdates(_0x57dafb[_0x8b84('0x49')],null))[_0x8b84('0x23')](respondWithResult(_0x3eca0c,null))['catch'](handleError(_0x3eca0c,null));};exports[_0x8b84('0x4a')]=function(_0xd824ec,_0x4bccf8){return db[_0x8b84('0x3f')][_0x8b84('0x47')]({'where':{'id':_0xd824ec['params']['id']}})[_0x8b84('0x23')](handleEntityNotFound(_0x4bccf8,null))[_0x8b84('0x23')](removeEntity(_0x4bccf8,null))[_0x8b84('0x44')](handleError(_0x4bccf8,null));};exports[_0x8b84('0x4b')]=function(_0x53c65d,_0x4b0d1e){return db[_0x8b84('0x3f')]['describe']()['then'](respondWithResult(_0x4b0d1e,null))[_0x8b84('0x44')](handleError(_0x4b0d1e,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index fb00db1..97c6e00 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 _0x01d9=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define'];(function(_0x411e47,_0xa2126b){var _0x3aeecb=function(_0x381ebd){while(--_0x381ebd){_0x411e47['push'](_0x411e47['shift']());}};_0x3aeecb(++_0xa2126b);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7278=['rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0x7278,0x161));var _0x8727=function(_0x105cf1,_0x2a09dc){_0x105cf1=_0x105cf1-0x0;var _0x46f092=_0x7278[_0x105cf1];return _0x46f092;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var logger=require(_0x8727('0x2'))(_0x8727('0x3'));var moment=require(_0x8727('0x4'));var BPromise=require('bluebird');var rp=require(_0x8727('0x5'));var fs=require('fs');var path=require(_0x8727('0x6'));var rimraf=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var attributes=require(_0x8727('0x9'));module[_0x8727('0xa')]=function(_0x180b71,_0x5549d5){return _0x180b71[_0x8727('0xb')](_0x8727('0xc'),attributes,{'tableName':_0x8727('0xd'),'paranoid':![],'indexes':[{'name':_0x8727('0xe'),'fields':[_0x8727('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index e05a3a3..38c4143 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 _0x98a6=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','randomstring'];(function(_0x924dae,_0x27c4e0){var _0xbb7c90=function(_0x41d0ed){while(--_0x41d0ed){_0x924dae['push'](_0x924dae['shift']());}};_0xbb7c90(++_0x27c4e0);}(_0x98a6,0x1a2));var _0x698a=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x98a6[_0x51fe5f];return _0x4abce9;};'use strict';var _=require(_0x698a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x698a('0x1'));var fs=require('fs');var Redis=require(_0x698a('0x2'));var db=require(_0x698a('0x3'))['db'];var utils=require(_0x698a('0x4'));var logger=require(_0x698a('0x5'))('rpc');var config=require(_0x698a('0x6'));var jayson=require(_0x698a('0x7'));var client=jayson[_0x698a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x221694,_0x5d397a,_0x3ed5fe){return new BPromise(function(_0x21e6f2,_0x2977fe){return client[_0x698a('0x9')](_0x221694,_0x3ed5fe)[_0x698a('0xa')](function(_0x17e5e8){logger[_0x698a('0xb')](_0x698a('0xc'),_0x5d397a,'request\x20sent');logger[_0x698a('0xd')](_0x698a('0xe'),_0x5d397a,_0x698a('0xf'),JSON[_0x698a('0x10')](_0x17e5e8));if(_0x17e5e8[_0x698a('0x11')]){if(_0x17e5e8[_0x698a('0x11')][_0x698a('0x12')]===0x1f4){logger['error'](_0x698a('0xc'),_0x5d397a,_0x17e5e8[_0x698a('0x11')]['message']);return _0x2977fe(_0x17e5e8[_0x698a('0x11')][_0x698a('0x13')]);}logger[_0x698a('0x11')](_0x698a('0xc'),_0x5d397a,_0x17e5e8['error'][_0x698a('0x13')]);return _0x21e6f2(_0x17e5e8['error']['message']);}else{logger[_0x698a('0xb')](_0x698a('0xc'),_0x5d397a,_0x698a('0xf'));_0x21e6f2(_0x17e5e8['result'][_0x698a('0x13')]);}})[_0x698a('0x14')](function(_0x545182){logger[_0x698a('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x5d397a,_0x545182);_0x2977fe(_0x545182);});});} \ No newline at end of file +var _0x560c=['message','info','result','catch','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1b09e8,_0x5c9627){var _0x158835=function(_0x5017ba){while(--_0x5017ba){_0x1b09e8['push'](_0x1b09e8['shift']());}};_0x158835(++_0x5c9627);}(_0x560c,0x121));var _0xc560=function(_0xc02cd2,_0x4d87c6){_0xc02cd2=_0xc02cd2-0x0;var _0xf16a5d=_0x560c[_0xc02cd2];return _0xf16a5d;};'use strict';var _=require(_0xc560('0x0'));var util=require(_0xc560('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc560('0x2'));var fs=require('fs');var Redis=require(_0xc560('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc560('0x4'));var logger=require('../../config/logger')(_0xc560('0x5'));var config=require(_0xc560('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc560('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x121337,_0x484521,_0x39b3dd){return new BPromise(function(_0x28828d,_0x41e804){return client[_0xc560('0x8')](_0x121337,_0x39b3dd)[_0xc560('0x9')](function(_0xafb06){logger['info'](_0xc560('0xa'),_0x484521,_0xc560('0xb'));logger['debug'](_0xc560('0xc'),_0x484521,_0xc560('0xb'),JSON[_0xc560('0xd')](_0xafb06));if(_0xafb06[_0xc560('0xe')]){if(_0xafb06[_0xc560('0xe')]['code']===0x1f4){logger['error'](_0xc560('0xa'),_0x484521,_0xafb06[_0xc560('0xe')][_0xc560('0xf')]);return _0x41e804(_0xafb06['error'][_0xc560('0xf')]);}logger[_0xc560('0xe')](_0xc560('0xa'),_0x484521,_0xafb06[_0xc560('0xe')][_0xc560('0xf')]);return _0x28828d(_0xafb06[_0xc560('0xe')]['message']);}else{logger[_0xc560('0x10')](_0xc560('0xa'),_0x484521,_0xc560('0xb'));_0x28828d(_0xafb06[_0xc560('0x11')]['message']);}})[_0xc560('0x12')](function(_0xacc01a){logger[_0xc560('0xe')](_0xc560('0xa'),_0x484521,_0xacc01a);_0x41e804(_0xacc01a);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 9380c05..73cbc91 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 _0x862e=['join','root','server/files/sounds/original/','originalname','replace','format','basename','extname','post','create','put','update','delete','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage'];(function(_0x55f2fb,_0x1c8a82){var _0x32b0e2=function(_0x53aab5){while(--_0x53aab5){_0x55f2fb['push'](_0x55f2fb['shift']());}};_0x32b0e2(++_0x1c8a82);}(_0x862e,0x1c1));var _0xe862=function(_0x3246b4,_0x401153){_0x3246b4=_0x3246b4-0x0;var _0x34b3d7=_0x862e[_0x3246b4];return _0x34b3d7;};'use strict';var multer=require(_0xe862('0x0'));var util=require(_0xe862('0x1'));var path=require('path');var timeout=require(_0xe862('0x2'));var express=require('express');var router=express[_0xe862('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe862('0x4'));var interaction=require(_0xe862('0x5'));var config=require('../../config/environment');var controller=require(_0xe862('0x6'));router[_0xe862('0x7')]('/',auth[_0xe862('0x8')](),controller[_0xe862('0x9')]);router[_0xe862('0x7')](_0xe862('0xa'),auth['isAuthenticated'](),controller[_0xe862('0xb')]);router['get'](_0xe862('0xc'),auth[_0xe862('0x8')](),controller[_0xe862('0xd')]);var upload=multer({'storage':multer[_0xe862('0xe')]({'destination':function(_0x27febb,_0x4aed59,_0x180fde){_0x180fde(null,path[_0xe862('0xf')](config[_0xe862('0x10')],_0xe862('0x11')));},'filename':function(_0x24a2cf,_0x1853a8,_0x5f2516){_0x1853a8[_0xe862('0x12')]=_0x1853a8[_0xe862('0x12')][_0xe862('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5f2516(null,util[_0xe862('0x14')]('%s-%s%s',path[_0xe862('0x15')](_0x1853a8[_0xe862('0x12')],path[_0xe862('0x16')](_0x1853a8[_0xe862('0x12')])),Date['now'](),path['extname'](_0x1853a8[_0xe862('0x12')])));}})});router[_0xe862('0x17')]('/',upload['single']('file'),controller[_0xe862('0x18')]);router[_0xe862('0x19')](_0xe862('0xa'),auth['isAuthenticated'](),controller[_0xe862('0x1a')]);router[_0xe862('0x1b')](_0xe862('0xa'),auth[_0xe862('0x8')](),controller[_0xe862('0x1b')]);module[_0xe862('0x1c')]=router; \ No newline at end of file +var _0x4ede=['get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','now','file','create','put','update','delete','multer','util','connect-timeout','fs-extra','../../components/interaction/service'];(function(_0x4c0a16,_0x101fe2){var _0x121724=function(_0x28507d){while(--_0x28507d){_0x4c0a16['push'](_0x4c0a16['shift']());}};_0x121724(++_0x101fe2);}(_0x4ede,0x14d));var _0xe4ed=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4ede[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xe4ed('0x0'));var util=require(_0xe4ed('0x1'));var path=require('path');var timeout=require(_0xe4ed('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe4ed('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe4ed('0x4'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0xe4ed('0x5')]('/',auth[_0xe4ed('0x6')](),controller[_0xe4ed('0x7')]);router[_0xe4ed('0x5')](_0xe4ed('0x8'),auth[_0xe4ed('0x6')](),controller[_0xe4ed('0x9')]);router[_0xe4ed('0x5')](_0xe4ed('0xa'),auth[_0xe4ed('0x6')](),controller[_0xe4ed('0xb')]);var upload=multer({'storage':multer[_0xe4ed('0xc')]({'destination':function(_0xfcd2b4,_0x5c8af5,_0x2e4b54){_0x2e4b54(null,path[_0xe4ed('0xd')](config['root'],_0xe4ed('0xe')));},'filename':function(_0x13d551,_0x2b78f5,_0x7da897){_0x2b78f5[_0xe4ed('0xf')]=_0x2b78f5['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x7da897(null,util[_0xe4ed('0x10')](_0xe4ed('0x11'),path[_0xe4ed('0x12')](_0x2b78f5[_0xe4ed('0xf')],path[_0xe4ed('0x13')](_0x2b78f5[_0xe4ed('0xf')])),Date[_0xe4ed('0x14')](),path[_0xe4ed('0x13')](_0x2b78f5[_0xe4ed('0xf')])));}})});router['post']('/',upload['single'](_0xe4ed('0x15')),controller[_0xe4ed('0x16')]);router[_0xe4ed('0x17')](_0xe4ed('0x8'),auth[_0xe4ed('0x6')](),controller[_0xe4ed('0x18')]);router[_0xe4ed('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xe4ed('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 8f2dc0c..1bc304e 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 _0xceba=['name','INTEGER','BIGINT','STRING'];(function(_0x4a8525,_0x319b21){var _0x2c8f11=function(_0x32dd73){while(--_0x32dd73){_0x4a8525['push'](_0x4a8525['shift']());}};_0x2c8f11(++_0x319b21);}(_0xceba,0x8b));var _0xaceb=function(_0x18832e,_0x3caa91){_0x18832e=_0x18832e-0x0;var _0x436e0a=_0xceba[_0x18832e];return _0x436e0a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xaceb('0x0')],'unique':_0xaceb('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0xaceb('0x0')]},'display_name':{'type':Sequelize[_0xaceb('0x0')],'defaultValue':''},'description':{'type':Sequelize[_0xaceb('0x0')]},'original_format':{'type':Sequelize[_0xaceb('0x0')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xaceb('0x2')]},'original_bitRate':{'type':Sequelize[_0xaceb('0x3')]},'original_sampleRate':{'type':Sequelize[_0xaceb('0x2')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xaceb('0x3')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xaceb('0x3')]},'converted_sampleRate':{'type':Sequelize[_0xaceb('0x2')]}}; \ No newline at end of file +var _0x8831=['exports','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x4d1408,_0x340e4b){var _0x3a3f58=function(_0x7c5584){while(--_0x7c5584){_0x4d1408['push'](_0x4d1408['shift']());}};_0x3a3f58(++_0x340e4b);}(_0x8831,0x126));var _0x1883=function(_0x2197bb,_0x2d7033){_0x2197bb=_0x2197bb-0x0;var _0x255158=_0x8831[_0x2197bb];return _0x255158;};'use strict';var Sequelize=require('sequelize');module[_0x1883('0x0')]={'name':{'type':Sequelize[_0x1883('0x1')],'unique':_0x1883('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x1883('0x1')]},'display_name':{'type':Sequelize[_0x1883('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x1883('0x1')]},'original_format':{'type':Sequelize[_0x1883('0x1')]},'original_duration':{'type':Sequelize[_0x1883('0x3')]},'original_sampleCount':{'type':Sequelize[_0x1883('0x4')]},'original_channelCount':{'type':Sequelize[_0x1883('0x5')]},'original_bitRate':{'type':Sequelize[_0x1883('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x1883('0x1')]},'converted_duration':{'type':Sequelize[_0x1883('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x1883('0x4')]},'converted_channelCount':{'type':Sequelize[_0x1883('0x5')]},'converted_bitRate':{'type':Sequelize[_0x1883('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x1883('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index b48c0e5..6a877d8 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 _0x3bc8=['include','findAll','rows','show','params','intersection','length','catch','download','save_name','root','converted_format','Sequelize','ValidationError','join','format','%s.%s','create','basename','file','originalname','extname','filename','wav','server/files/sounds/original','server/files/sounds/converted','info','Sound\x20upload\x20filepath:\x20%s','transcode','unlinkSync','send','src','original_duration','duration','original_sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','0777','body','role','userProfileId','user','find','UserProfileResource','start','update','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','destroy','then','get','Sounds','error','name','index','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll'];(function(_0x44570a,_0x2eda8b){var _0x5158f5=function(_0x229b1e){while(--_0x229b1e){_0x44570a['push'](_0x44570a['shift']());}};_0x5158f5(++_0x2eda8b);}(_0x3bc8,0x12d));var _0x83bc=function(_0x27125a,_0x252d0d){_0x27125a=_0x27125a-0x0;var _0x391f7a=_0x3bc8[_0x27125a];return _0x391f7a;};'use strict';var emlformat=require(_0x83bc('0x0'));var rimraf=require(_0x83bc('0x1'));var zipdir=require(_0x83bc('0x2'));var jsonpatch=require(_0x83bc('0x3'));var rp=require(_0x83bc('0x4'));var moment=require(_0x83bc('0x5'));var BPromise=require(_0x83bc('0x6'));var Mustache=require(_0x83bc('0x7'));var util=require('util');var path=require(_0x83bc('0x8'));var sox=require(_0x83bc('0x9'));var csv=require('to-csv');var ejs=require(_0x83bc('0xa'));var fs=require('fs');var fs_extra=require(_0x83bc('0xb'));var _=require(_0x83bc('0xc'));var squel=require(_0x83bc('0xd'));var crypto=require(_0x83bc('0xe'));var jsforce=require(_0x83bc('0xf'));var deskjs=require(_0x83bc('0x10'));var toCsv=require('to-csv');var querystring=require(_0x83bc('0x11'));var Papa=require(_0x83bc('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x83bc('0x13'));var as=require(_0x83bc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x83bc('0x15'))(_0x83bc('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x83bc('0x17'));var db=require(_0x83bc('0x18'))['db'];function respondWithStatusCode(_0x216ca2,_0x3e31f1){_0x3e31f1=_0x3e31f1||0xcc;return function(_0x12b652){if(_0x12b652){return _0x216ca2[_0x83bc('0x19')](_0x3e31f1);}return _0x216ca2[_0x83bc('0x1a')](_0x3e31f1)[_0x83bc('0x1b')]();};}function respondWithResult(_0x29c409,_0x4715af){_0x4715af=_0x4715af||0xc8;return function(_0x56af76){if(_0x56af76){return _0x29c409[_0x83bc('0x1a')](_0x4715af)[_0x83bc('0x1c')](_0x56af76);}};}function respondWithFilteredResult(_0x3ebb03,_0x175396){return function(_0x2c3521){if(_0x2c3521){var _0x284a8a=typeof _0x175396['offset']===_0x83bc('0x1d')&&typeof _0x175396[_0x83bc('0x1e')]==='undefined';var _0x2fbe85=_0x2c3521['count'];var _0xe4258c=_0x284a8a?0x0:_0x175396['offset'];var _0xe384fa=_0x284a8a?_0x2c3521[_0x83bc('0x1f')]:_0x175396[_0x83bc('0x20')]+_0x175396['limit'];var _0x536c07;if(_0xe384fa>=_0x2fbe85){_0xe384fa=_0x2fbe85;_0x536c07=0xc8;}else{_0x536c07=0xce;}_0x3ebb03['status'](_0x536c07);return _0x3ebb03[_0x83bc('0x21')]('Content-Range',_0xe4258c+'-'+_0xe384fa+'/'+_0x2fbe85)[_0x83bc('0x1c')](_0x2c3521);}return null;};}function patchUpdates(_0x2cb1dd){return function(_0x31b085){try{jsonpatch[_0x83bc('0x22')](_0x31b085,_0x2cb1dd,!![]);}catch(_0x14c667){return BPromise['reject'](_0x14c667);}return _0x31b085[_0x83bc('0x23')]();};}function saveUpdates(_0xac7a42,_0x34a44c){return function(_0x2c3f3f){if(_0x2c3f3f){return _0x2c3f3f['update'](_0xac7a42)['then'](function(_0x6a2c2a){return _0x6a2c2a;});}return null;};}function removeEntity(_0x90dae1,_0x35875f){return function(_0x9ebeb4){if(_0x9ebeb4){return _0x9ebeb4[_0x83bc('0x24')]()[_0x83bc('0x25')](function(){var _0x223931=_0x9ebeb4[_0x83bc('0x26')]({'plain':!![]});var _0x65a0e8=_0x83bc('0x27');return db['UserProfileResource'][_0x83bc('0x24')]({'where':{'type':_0x65a0e8,'resourceId':_0x223931['id']}})[_0x83bc('0x25')](function(){return _0x9ebeb4;});})['then'](function(){_0x90dae1['status'](0xcc)[_0x83bc('0x1b')]();});}};}function handleEntityNotFound(_0x23d6ed,_0x4a1be9){return function(_0xaa5964){if(!_0xaa5964){_0x23d6ed[_0x83bc('0x19')](0x194);}return _0xaa5964;};}function handleError(_0x58f528,_0x46f60e){_0x46f60e=_0x46f60e||0x1f4;return function(_0x371550){logger[_0x83bc('0x28')](_0x371550['stack']);if(_0x371550[_0x83bc('0x29')]){delete _0x371550[_0x83bc('0x29')];}_0x58f528[_0x83bc('0x1a')](_0x46f60e)['send'](_0x371550);};}exports[_0x83bc('0x2a')]=function(_0x47c6ac,_0xd98f42){var _0x13b7e1={},_0x3f135d={},_0x2272d0={'count':0x0,'rows':[]};var _0x2e31ed=_[_0x83bc('0x2b')](db[_0x83bc('0x2c')][_0x83bc('0x2d')],function(_0x393124){return{'name':_0x393124[_0x83bc('0x2e')],'type':_0x393124[_0x83bc('0x2f')][_0x83bc('0x30')]};});_0x3f135d[_0x83bc('0x31')]=_[_0x83bc('0x2b')](_0x2e31ed,'name');_0x3f135d[_0x83bc('0x32')]=_[_0x83bc('0x33')](_0x47c6ac[_0x83bc('0x32')]);_0x3f135d[_0x83bc('0x34')]=_['intersection'](_0x3f135d[_0x83bc('0x31')],_0x3f135d[_0x83bc('0x32')]);_0x13b7e1[_0x83bc('0x35')]=_['intersection'](_0x3f135d['model'],qs[_0x83bc('0x36')](_0x47c6ac[_0x83bc('0x32')]['fields']));_0x13b7e1[_0x83bc('0x35')]=_0x13b7e1['attributes']['length']?_0x13b7e1[_0x83bc('0x35')]:_0x3f135d[_0x83bc('0x31')];if(!_0x47c6ac[_0x83bc('0x32')][_0x83bc('0x37')](_0x83bc('0x38'))){_0x13b7e1[_0x83bc('0x1e')]=qs[_0x83bc('0x1e')](_0x47c6ac['query']['limit']);_0x13b7e1[_0x83bc('0x20')]=qs['offset'](_0x47c6ac[_0x83bc('0x32')][_0x83bc('0x20')]);}_0x13b7e1[_0x83bc('0x39')]=qs['sort'](_0x47c6ac['query'][_0x83bc('0x3a')]);_0x13b7e1[_0x83bc('0x3b')]=qs['filters'](_[_0x83bc('0x3c')](_0x47c6ac[_0x83bc('0x32')],_0x3f135d['filters']),_0x2e31ed);if(_0x47c6ac['query'][_0x83bc('0x3d')]){_0x13b7e1[_0x83bc('0x3b')]=_[_0x83bc('0x3e')](_0x13b7e1[_0x83bc('0x3b')],{'$or':_[_0x83bc('0x2b')](_0x2e31ed,function(_0x50bc76){if(_0x50bc76[_0x83bc('0x2f')]!=='VIRTUAL'){var _0x575aa8={};_0x575aa8[_0x50bc76[_0x83bc('0x29')]]={'$like':'%'+_0x47c6ac[_0x83bc('0x32')][_0x83bc('0x3d')]+'%'};return _0x575aa8;}})});}_0x13b7e1=_[_0x83bc('0x3e')]({},_0x13b7e1,_0x47c6ac[_0x83bc('0x3f')]);var _0x337b30={'where':_0x13b7e1[_0x83bc('0x3b')]};return db['Sound'][_0x83bc('0x1f')](_0x337b30)[_0x83bc('0x25')](function(_0x176647){_0x2272d0[_0x83bc('0x1f')]=_0x176647;if(_0x47c6ac[_0x83bc('0x32')][_0x83bc('0x40')]){_0x13b7e1[_0x83bc('0x41')]=[{'all':!![]}];}return db[_0x83bc('0x2c')][_0x83bc('0x42')](_0x13b7e1);})[_0x83bc('0x25')](function(_0x63a38c){_0x2272d0[_0x83bc('0x43')]=_0x63a38c;return _0x2272d0;})[_0x83bc('0x25')](respondWithFilteredResult(_0xd98f42,_0x13b7e1))['catch'](handleError(_0xd98f42,null));};exports[_0x83bc('0x44')]=function(_0xcde033,_0x20a914){var _0x3fdcf1={'raw':!![],'where':{'id':_0xcde033[_0x83bc('0x45')]['id']}},_0x114f59={};_0x114f59[_0x83bc('0x31')]=_[_0x83bc('0x33')](db[_0x83bc('0x2c')][_0x83bc('0x2d')]);_0x114f59[_0x83bc('0x32')]=_['keys'](_0xcde033[_0x83bc('0x32')]);_0x114f59[_0x83bc('0x34')]=_['intersection'](_0x114f59[_0x83bc('0x31')],_0x114f59[_0x83bc('0x32')]);_0x3fdcf1[_0x83bc('0x35')]=_[_0x83bc('0x46')](_0x114f59['model'],qs[_0x83bc('0x36')](_0xcde033[_0x83bc('0x32')][_0x83bc('0x36')]));_0x3fdcf1[_0x83bc('0x35')]=_0x3fdcf1[_0x83bc('0x35')][_0x83bc('0x47')]?_0x3fdcf1[_0x83bc('0x35')]:_0x114f59[_0x83bc('0x31')];if(_0xcde033['query'][_0x83bc('0x40')]){_0x3fdcf1[_0x83bc('0x41')]=[{'all':!![]}];}_0x3fdcf1=_[_0x83bc('0x3e')]({},_0x3fdcf1,_0xcde033['options']);return db[_0x83bc('0x2c')]['find'](_0x3fdcf1)[_0x83bc('0x25')](handleEntityNotFound(_0x20a914,null))[_0x83bc('0x25')](respondWithResult(_0x20a914,null))[_0x83bc('0x48')](handleError(_0x20a914,null));};exports[_0x83bc('0x49')]=function(_0x3bc67d,_0xd61bfa,_0x4b8309){return db[_0x83bc('0x2c')]['find']({'where':{'id':_0x3bc67d[_0x83bc('0x45')]['id']},'attributes':[_0x83bc('0x29'),_0x83bc('0x4a'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0xd61bfa,null))[_0x83bc('0x25')](function(_0x3a4199){if(_0x3a4199){if(!fs['existsSync'](path['join'](config[_0x83bc('0x4b')],'server/files/sounds/converted',_0x3a4199[_0x83bc('0x4a')]+'.'+_0x3a4199[_0x83bc('0x4c')]))){throw new db[(_0x83bc('0x4d'))][(_0x83bc('0x4e'))]('Sound\x20not\x20found');}return _0xd61bfa['download'](path[_0x83bc('0x4f')](config[_0x83bc('0x4b')],'server/files/sounds/converted',util[_0x83bc('0x50')](_0x83bc('0x51'),_0x3a4199[_0x83bc('0x4a')],_0x3a4199[_0x83bc('0x4c')])),util[_0x83bc('0x50')](_0x83bc('0x51'),_0x3a4199[_0x83bc('0x29')],_0x3a4199['converted_format']));}return null;})[_0x83bc('0x48')](handleError(_0xd61bfa,null));};exports[_0x83bc('0x52')]=function(_0x22ee5a,_0x3dc61d,_0x38d314){var _0x375f74={'name':path[_0x83bc('0x53')](_0x22ee5a[_0x83bc('0x54')][_0x83bc('0x55')],path[_0x83bc('0x56')](_0x22ee5a[_0x83bc('0x54')][_0x83bc('0x55')])),'save_name':path[_0x83bc('0x53')](_0x22ee5a[_0x83bc('0x54')][_0x83bc('0x57')],path[_0x83bc('0x56')](_0x22ee5a[_0x83bc('0x54')][_0x83bc('0x57')])),'original_format':path['extname'](_0x22ee5a[_0x83bc('0x54')]['originalname'])['substring'](0x1),'converted_format':_0x83bc('0x58')};var _0x224239=path[_0x83bc('0x4f')](config[_0x83bc('0x4b')],_0x83bc('0x59'),_0x22ee5a['file'][_0x83bc('0x57')]);var _0x60f190=path[_0x83bc('0x4f')](config[_0x83bc('0x4b')],_0x83bc('0x5a'),util[_0x83bc('0x50')]('%s.%s',path[_0x83bc('0x53')](_0x22ee5a[_0x83bc('0x54')][_0x83bc('0x57')],path[_0x83bc('0x56')](_0x22ee5a[_0x83bc('0x54')][_0x83bc('0x57')])),_0x375f74[_0x83bc('0x4c')]));logger[_0x83bc('0x5b')](_0x83bc('0x5c'),_0x224239);logger[_0x83bc('0x5b')]('Sound\x20upload\x20destination:\x20%s',_0x60f190);try{fs['chmodSync'](_0x224239,parseInt('0777',0x8));var _0x16fbea=sox[_0x83bc('0x5d')](_0x224239,_0x60f190,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x16fbea['on'](_0x83bc('0x28'),function(_0x1907ef){fs[_0x83bc('0x5e')](_0x224239);_0x3dc61d[_0x83bc('0x1a')](0x1f4)[_0x83bc('0x5f')](_0x1907ef);});_0x16fbea['on'](_0x83bc('0x60'),function(_0x265aff){_0x375f74[_0x83bc('0x61')]=isNaN(_0x265aff[_0x83bc('0x62')])?null:_0x265aff[_0x83bc('0x62')]*0x3e8;_0x375f74[_0x83bc('0x63')]=isNaN(_0x265aff['sampleCount'])?null:_0x265aff['sampleCount'];_0x375f74['original_channelCount']=isNaN(_0x265aff[_0x83bc('0x64')])?null:_0x265aff['channelCount'];_0x375f74[_0x83bc('0x65')]=isNaN(_0x265aff[_0x83bc('0x66')])?null:_0x265aff[_0x83bc('0x66')];_0x375f74[_0x83bc('0x67')]=isNaN(_0x265aff[_0x83bc('0x68')])?null:_0x265aff[_0x83bc('0x68')];});_0x16fbea['on'](_0x83bc('0x69'),function(_0xd90da){_0x375f74['converted_duration']=isNaN(_0xd90da['duration'])?null:_0xd90da[_0x83bc('0x62')]*0x3e8;_0x375f74[_0x83bc('0x6a')]=isNaN(_0xd90da[_0x83bc('0x6b')])?null:_0xd90da[_0x83bc('0x6b')];_0x375f74[_0x83bc('0x6c')]=isNaN(_0xd90da[_0x83bc('0x64')])?null:_0xd90da[_0x83bc('0x64')];_0x375f74[_0x83bc('0x6d')]=isNaN(_0xd90da[_0x83bc('0x66')])?null:_0xd90da[_0x83bc('0x66')];_0x375f74[_0x83bc('0x6e')]=isNaN(_0xd90da[_0x83bc('0x68')])?null:_0xd90da['sampleRate'];});_0x16fbea['on']('end',function(){fs[_0x83bc('0x6f')](_0x60f190,parseInt(_0x83bc('0x70'),0x8));return db[_0x83bc('0x2c')]['create'](_0x375f74)['then'](function(_0x637e92){var _0x192423={'role':_0x22ee5a[_0x83bc('0x71')][_0x83bc('0x72')],'userProfileId':_0x22ee5a[_0x83bc('0x71')][_0x83bc('0x73')]};if(!_0x192423)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x192423[_0x83bc('0x72')]===_0x83bc('0x74')){var _0x5a8fd4=_0x637e92[_0x83bc('0x26')]({'plain':!![]});return db['UserProfileSection'][_0x83bc('0x75')]({'where':{'name':'Sounds','userProfileId':_0x192423['userProfileId']},'raw':!![]})[_0x83bc('0x25')](function(_0x254e01){if(_0x254e01&&_0x254e01['autoAssociation']===0x0){return db[_0x83bc('0x76')]['create']({'name':_0x5a8fd4[_0x83bc('0x29')],'resourceId':_0x5a8fd4['id'],'type':_0x254e01[_0x83bc('0x29')],'sectionId':_0x254e01['id']},{})[_0x83bc('0x25')](function(){return _0x637e92;});}else{return _0x637e92;}})[_0x83bc('0x48')](function(_0x449c1d){logger[_0x83bc('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x449c1d);throw _0x449c1d;});}return _0x637e92;})['then'](respondWithResult(_0x3dc61d,null))['catch'](handleError(_0x3dc61d,null));});_0x16fbea[_0x83bc('0x77')]();}catch(_0x2b280d){_0x3dc61d[_0x83bc('0x1a')](0x1f4)[_0x83bc('0x5f')](_0x2b280d);}};exports[_0x83bc('0x78')]=function(_0xff70f7,_0x190822,_0x1477ce){return db[_0x83bc('0x2c')]['find']({'where':{'id':_0xff70f7[_0x83bc('0x45')]['id']}})[_0x83bc('0x25')](handleEntityNotFound(_0x190822,null))[_0x83bc('0x25')](saveUpdates(_[_0x83bc('0x3c')](_0xff70f7[_0x83bc('0x71')],[_0x83bc('0x29'),'description']),null))[_0x83bc('0x25')](respondWithResult(_0x190822,null))['catch'](handleError(_0x190822,null));};exports['delete']=function(_0x5adfd3,_0x334c06,_0x1d9ef5){return db[_0x83bc('0x2c')][_0x83bc('0x75')]({'where':{'id':_0x5adfd3['params']['id']}})[_0x83bc('0x25')](function(_0x50b7ec){if(_0x50b7ec){return _0x50b7ec['destroy']();}})[_0x83bc('0x25')](function(_0x1af575){var _0x121468=path[_0x83bc('0x4f')](config[_0x83bc('0x4b')],_0x83bc('0x59'),util[_0x83bc('0x50')](_0x83bc('0x51'),_0x1af575['save_name'],_0x1af575[_0x83bc('0x79')]));var _0x29b270=path['join'](config[_0x83bc('0x4b')],'server/files/sounds/converted',util[_0x83bc('0x50')](_0x83bc('0x51'),_0x1af575[_0x83bc('0x4a')],_0x1af575[_0x83bc('0x4c')]));fs[_0x83bc('0x5e')](_0x121468);fs[_0x83bc('0x5e')](_0x29b270);return _0x1af575;})['then'](function(_0x109524){if(_0x109524){return _0x334c06[_0x83bc('0x1a')](0xcc)[_0x83bc('0x1b')]();}})['then'](handleEntityNotFound(_0x334c06,null))[_0x83bc('0x48')](handleError(_0x334c06,null));}; \ No newline at end of file +var _0xfbbd=['sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','create','body','userProfileId','role','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','server/files/sounds/original','original_format','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','Sounds','UserProfileResource','error','name','send','Sound','rawAttributes','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','pick','filter','where','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','include','find','download','save_name','converted_format','existsSync','join','root','ValidationError','Sound\x20not\x20found','format','%s.%s','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/converted','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate'];(function(_0x4278b4,_0x440117){var _0x3bed4c=function(_0x50a2ef){while(--_0x50a2ef){_0x4278b4['push'](_0x4278b4['shift']());}};_0x3bed4c(++_0x440117);}(_0xfbbd,0x10b));var _0xdfbb=function(_0x1e421a,_0x240544){_0x1e421a=_0x1e421a-0x0;var _0x4292c4=_0xfbbd[_0x1e421a];return _0x4292c4;};'use strict';var emlformat=require(_0xdfbb('0x0'));var rimraf=require(_0xdfbb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdfbb('0x2'));var moment=require(_0xdfbb('0x3'));var BPromise=require(_0xdfbb('0x4'));var Mustache=require(_0xdfbb('0x5'));var util=require(_0xdfbb('0x6'));var path=require(_0xdfbb('0x7'));var sox=require(_0xdfbb('0x8'));var csv=require(_0xdfbb('0x9'));var ejs=require(_0xdfbb('0xa'));var fs=require('fs');var fs_extra=require(_0xdfbb('0xb'));var _=require(_0xdfbb('0xc'));var squel=require(_0xdfbb('0xd'));var crypto=require(_0xdfbb('0xe'));var jsforce=require(_0xdfbb('0xf'));var deskjs=require(_0xdfbb('0x10'));var toCsv=require(_0xdfbb('0x9'));var querystring=require('querystring');var Papa=require(_0xdfbb('0x11'));var Redis=require(_0xdfbb('0x12'));var authService=require(_0xdfbb('0x13'));var qs=require(_0xdfbb('0x14'));var as=require(_0xdfbb('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdfbb('0x16'))('api');var utils=require(_0xdfbb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xdfbb('0x18'));var db=require(_0xdfbb('0x19'))['db'];function respondWithStatusCode(_0x1ac2a6,_0x50226f){_0x50226f=_0x50226f||0xcc;return function(_0x1cbbef){if(_0x1cbbef){return _0x1ac2a6[_0xdfbb('0x1a')](_0x50226f);}return _0x1ac2a6[_0xdfbb('0x1b')](_0x50226f)[_0xdfbb('0x1c')]();};}function respondWithResult(_0x5b0596,_0x1a7531){_0x1a7531=_0x1a7531||0xc8;return function(_0x44b7d3){if(_0x44b7d3){return _0x5b0596[_0xdfbb('0x1b')](_0x1a7531)[_0xdfbb('0x1d')](_0x44b7d3);}};}function respondWithFilteredResult(_0x5da002,_0x97db39){return function(_0x140628){if(_0x140628){var _0x4db8b0=typeof _0x97db39['offset']===_0xdfbb('0x1e')&&typeof _0x97db39['limit']===_0xdfbb('0x1e');var _0x1febce=_0x140628[_0xdfbb('0x1f')];var _0x3fea04=_0x4db8b0?0x0:_0x97db39['offset'];var _0x9279bb=_0x4db8b0?_0x140628['count']:_0x97db39[_0xdfbb('0x20')]+_0x97db39['limit'];var _0x2f0f1d;if(_0x9279bb>=_0x1febce){_0x9279bb=_0x1febce;_0x2f0f1d=0xc8;}else{_0x2f0f1d=0xce;}_0x5da002[_0xdfbb('0x1b')](_0x2f0f1d);return _0x5da002[_0xdfbb('0x21')](_0xdfbb('0x22'),_0x3fea04+'-'+_0x9279bb+'/'+_0x1febce)[_0xdfbb('0x1d')](_0x140628);}return null;};}function patchUpdates(_0x179d1d){return function(_0x37d0ef){try{jsonpatch[_0xdfbb('0x23')](_0x37d0ef,_0x179d1d,!![]);}catch(_0x4b3e0a){return BPromise[_0xdfbb('0x24')](_0x4b3e0a);}return _0x37d0ef[_0xdfbb('0x25')]();};}function saveUpdates(_0x4fd684,_0x285185){return function(_0x4c8008){if(_0x4c8008){return _0x4c8008[_0xdfbb('0x26')](_0x4fd684)[_0xdfbb('0x27')](function(_0xadde41){return _0xadde41;});}return null;};}function removeEntity(_0x33343c,_0x4b4ccd){return function(_0x1993ca){if(_0x1993ca){return _0x1993ca['destroy']()['then'](function(){var _0x53facb=_0x1993ca['get']({'plain':!![]});var _0xd60fec=_0xdfbb('0x28');return db[_0xdfbb('0x29')]['destroy']({'where':{'type':_0xd60fec,'resourceId':_0x53facb['id']}})[_0xdfbb('0x27')](function(){return _0x1993ca;});})[_0xdfbb('0x27')](function(){_0x33343c[_0xdfbb('0x1b')](0xcc)[_0xdfbb('0x1c')]();});}};}function handleEntityNotFound(_0x37994d,_0x517f1b){return function(_0x38635f){if(!_0x38635f){_0x37994d[_0xdfbb('0x1a')](0x194);}return _0x38635f;};}function handleError(_0x27c096,_0x4576de){_0x4576de=_0x4576de||0x1f4;return function(_0x8aa7d3){logger[_0xdfbb('0x2a')](_0x8aa7d3['stack']);if(_0x8aa7d3[_0xdfbb('0x2b')]){delete _0x8aa7d3['name'];}_0x27c096['status'](_0x4576de)[_0xdfbb('0x2c')](_0x8aa7d3);};}exports['index']=function(_0x4c8209,_0x161a98){var _0x47949e={},_0x5b8f7b={},_0x5ef737={'count':0x0,'rows':[]};var _0x5c8068=_['map'](db[_0xdfbb('0x2d')][_0xdfbb('0x2e')],function(_0x3bccca){return{'name':_0x3bccca['fieldName'],'type':_0x3bccca['type'][_0xdfbb('0x2f')]};});_0x5b8f7b[_0xdfbb('0x30')]=_[_0xdfbb('0x31')](_0x5c8068,_0xdfbb('0x2b'));_0x5b8f7b[_0xdfbb('0x32')]=_[_0xdfbb('0x33')](_0x4c8209[_0xdfbb('0x32')]);_0x5b8f7b[_0xdfbb('0x34')]=_[_0xdfbb('0x35')](_0x5b8f7b[_0xdfbb('0x30')],_0x5b8f7b[_0xdfbb('0x32')]);_0x47949e['attributes']=_['intersection'](_0x5b8f7b[_0xdfbb('0x30')],qs['fields'](_0x4c8209[_0xdfbb('0x32')][_0xdfbb('0x36')]));_0x47949e[_0xdfbb('0x37')]=_0x47949e[_0xdfbb('0x37')][_0xdfbb('0x38')]?_0x47949e[_0xdfbb('0x37')]:_0x5b8f7b[_0xdfbb('0x30')];if(!_0x4c8209[_0xdfbb('0x32')][_0xdfbb('0x39')](_0xdfbb('0x3a'))){_0x47949e['limit']=qs[_0xdfbb('0x3b')](_0x4c8209[_0xdfbb('0x32')][_0xdfbb('0x3b')]);_0x47949e[_0xdfbb('0x20')]=qs['offset'](_0x4c8209[_0xdfbb('0x32')][_0xdfbb('0x20')]);}_0x47949e['order']=qs['sort'](_0x4c8209[_0xdfbb('0x32')]['sort']);_0x47949e['where']=qs[_0xdfbb('0x34')](_[_0xdfbb('0x3c')](_0x4c8209[_0xdfbb('0x32')],_0x5b8f7b[_0xdfbb('0x34')]),_0x5c8068);if(_0x4c8209[_0xdfbb('0x32')][_0xdfbb('0x3d')]){_0x47949e[_0xdfbb('0x3e')]=_[_0xdfbb('0x3f')](_0x47949e[_0xdfbb('0x3e')],{'$or':_['map'](_0x5c8068,function(_0x25a09b){if(_0x25a09b[_0xdfbb('0x40')]!==_0xdfbb('0x41')){var _0x2e4925={};_0x2e4925[_0x25a09b[_0xdfbb('0x2b')]]={'$like':'%'+_0x4c8209['query'][_0xdfbb('0x3d')]+'%'};return _0x2e4925;}})});}_0x47949e=_['merge']({},_0x47949e,_0x4c8209[_0xdfbb('0x42')]);var _0x3eb63b={'where':_0x47949e[_0xdfbb('0x3e')]};return db[_0xdfbb('0x2d')][_0xdfbb('0x1f')](_0x3eb63b)[_0xdfbb('0x27')](function(_0x483d57){_0x5ef737[_0xdfbb('0x1f')]=_0x483d57;if(_0x4c8209['query']['includeAll']){_0x47949e['include']=[{'all':!![]}];}return db['Sound'][_0xdfbb('0x43')](_0x47949e);})[_0xdfbb('0x27')](function(_0x1fac86){_0x5ef737[_0xdfbb('0x44')]=_0x1fac86;return _0x5ef737;})[_0xdfbb('0x27')](respondWithFilteredResult(_0x161a98,_0x47949e))[_0xdfbb('0x45')](handleError(_0x161a98,null));};exports[_0xdfbb('0x46')]=function(_0x26bf87,_0x29ca05){var _0x3d83cf={'raw':!![],'where':{'id':_0x26bf87[_0xdfbb('0x47')]['id']}},_0x336ae3={};_0x336ae3[_0xdfbb('0x30')]=_[_0xdfbb('0x33')](db['Sound']['rawAttributes']);_0x336ae3[_0xdfbb('0x32')]=_[_0xdfbb('0x33')](_0x26bf87[_0xdfbb('0x32')]);_0x336ae3[_0xdfbb('0x34')]=_['intersection'](_0x336ae3[_0xdfbb('0x30')],_0x336ae3[_0xdfbb('0x32')]);_0x3d83cf[_0xdfbb('0x37')]=_[_0xdfbb('0x35')](_0x336ae3[_0xdfbb('0x30')],qs[_0xdfbb('0x36')](_0x26bf87['query'][_0xdfbb('0x36')]));_0x3d83cf['attributes']=_0x3d83cf['attributes'][_0xdfbb('0x38')]?_0x3d83cf[_0xdfbb('0x37')]:_0x336ae3[_0xdfbb('0x30')];if(_0x26bf87[_0xdfbb('0x32')]['includeAll']){_0x3d83cf[_0xdfbb('0x48')]=[{'all':!![]}];}_0x3d83cf=_[_0xdfbb('0x3f')]({},_0x3d83cf,_0x26bf87[_0xdfbb('0x42')]);return db[_0xdfbb('0x2d')][_0xdfbb('0x49')](_0x3d83cf)['then'](handleEntityNotFound(_0x29ca05,null))['then'](respondWithResult(_0x29ca05,null))[_0xdfbb('0x45')](handleError(_0x29ca05,null));};exports[_0xdfbb('0x4a')]=function(_0x4307d9,_0x3b65e8,_0x9bd8a9){return db['Sound'][_0xdfbb('0x49')]({'where':{'id':_0x4307d9[_0xdfbb('0x47')]['id']},'attributes':[_0xdfbb('0x2b'),_0xdfbb('0x4b'),_0xdfbb('0x4c')],'raw':!![]})[_0xdfbb('0x27')](handleEntityNotFound(_0x3b65e8,null))[_0xdfbb('0x27')](function(_0x4f79d9){if(_0x4f79d9){if(!fs[_0xdfbb('0x4d')](path[_0xdfbb('0x4e')](config[_0xdfbb('0x4f')],'server/files/sounds/converted',_0x4f79d9['save_name']+'.'+_0x4f79d9[_0xdfbb('0x4c')]))){throw new db['Sequelize'][(_0xdfbb('0x50'))](_0xdfbb('0x51'));}return _0x3b65e8[_0xdfbb('0x4a')](path[_0xdfbb('0x4e')](config[_0xdfbb('0x4f')],'server/files/sounds/converted',util[_0xdfbb('0x52')](_0xdfbb('0x53'),_0x4f79d9['save_name'],_0x4f79d9[_0xdfbb('0x4c')])),util[_0xdfbb('0x52')]('%s.%s',_0x4f79d9[_0xdfbb('0x2b')],_0x4f79d9['converted_format']));}return null;})[_0xdfbb('0x45')](handleError(_0x3b65e8,null));};exports['create']=function(_0x2fbcdb,_0x3e1648,_0x40d5c8){var _0x4d3519={'name':path[_0xdfbb('0x54')](_0x2fbcdb[_0xdfbb('0x55')][_0xdfbb('0x56')],path[_0xdfbb('0x57')](_0x2fbcdb[_0xdfbb('0x55')][_0xdfbb('0x56')])),'save_name':path[_0xdfbb('0x54')](_0x2fbcdb[_0xdfbb('0x55')][_0xdfbb('0x58')],path[_0xdfbb('0x57')](_0x2fbcdb[_0xdfbb('0x55')][_0xdfbb('0x58')])),'original_format':path['extname'](_0x2fbcdb[_0xdfbb('0x55')][_0xdfbb('0x56')])[_0xdfbb('0x59')](0x1),'converted_format':_0xdfbb('0x5a')};var _0x412436=path[_0xdfbb('0x4e')](config[_0xdfbb('0x4f')],'server/files/sounds/original',_0x2fbcdb[_0xdfbb('0x55')]['filename']);var _0x36bc37=path[_0xdfbb('0x4e')](config[_0xdfbb('0x4f')],_0xdfbb('0x5b'),util[_0xdfbb('0x52')]('%s.%s',path[_0xdfbb('0x54')](_0x2fbcdb[_0xdfbb('0x55')][_0xdfbb('0x58')],path[_0xdfbb('0x57')](_0x2fbcdb[_0xdfbb('0x55')][_0xdfbb('0x58')])),_0x4d3519[_0xdfbb('0x4c')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x412436);logger[_0xdfbb('0x5c')](_0xdfbb('0x5d'),_0x36bc37);try{fs[_0xdfbb('0x5e')](_0x412436,parseInt(_0xdfbb('0x5f'),0x8));var _0x51b052=sox[_0xdfbb('0x60')](_0x412436,_0x36bc37,{'sampleRate':0x1f40,'format':_0xdfbb('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x51b052['on'](_0xdfbb('0x2a'),function(_0x54e021){fs[_0xdfbb('0x61')](_0x412436);_0x3e1648[_0xdfbb('0x1b')](0x1f4)['send'](_0x54e021);});_0x51b052['on'](_0xdfbb('0x62'),function(_0x3ccbc2){_0x4d3519[_0xdfbb('0x63')]=isNaN(_0x3ccbc2[_0xdfbb('0x64')])?null:_0x3ccbc2[_0xdfbb('0x64')]*0x3e8;_0x4d3519[_0xdfbb('0x65')]=isNaN(_0x3ccbc2['sampleCount'])?null:_0x3ccbc2[_0xdfbb('0x66')];_0x4d3519[_0xdfbb('0x67')]=isNaN(_0x3ccbc2[_0xdfbb('0x68')])?null:_0x3ccbc2[_0xdfbb('0x68')];_0x4d3519[_0xdfbb('0x69')]=isNaN(_0x3ccbc2[_0xdfbb('0x6a')])?null:_0x3ccbc2['bitRate'];_0x4d3519[_0xdfbb('0x6b')]=isNaN(_0x3ccbc2['sampleRate'])?null:_0x3ccbc2[_0xdfbb('0x6c')];});_0x51b052['on'](_0xdfbb('0x6d'),function(_0x2d3aec){_0x4d3519[_0xdfbb('0x6e')]=isNaN(_0x2d3aec[_0xdfbb('0x64')])?null:_0x2d3aec[_0xdfbb('0x64')]*0x3e8;_0x4d3519[_0xdfbb('0x6f')]=isNaN(_0x2d3aec[_0xdfbb('0x66')])?null:_0x2d3aec[_0xdfbb('0x66')];_0x4d3519['converted_channelCount']=isNaN(_0x2d3aec[_0xdfbb('0x68')])?null:_0x2d3aec['channelCount'];_0x4d3519[_0xdfbb('0x70')]=isNaN(_0x2d3aec[_0xdfbb('0x6a')])?null:_0x2d3aec[_0xdfbb('0x6a')];_0x4d3519['converted_sampleRate']=isNaN(_0x2d3aec[_0xdfbb('0x6c')])?null:_0x2d3aec['sampleRate'];});_0x51b052['on']('end',function(){fs[_0xdfbb('0x5e')](_0x36bc37,parseInt('0777',0x8));return db[_0xdfbb('0x2d')][_0xdfbb('0x71')](_0x4d3519)[_0xdfbb('0x27')](function(_0x4e0da2){var _0xd9cfce={'role':_0x2fbcdb['body']['role'],'userProfileId':_0x2fbcdb[_0xdfbb('0x72')][_0xdfbb('0x73')]};if(!_0xd9cfce)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd9cfce[_0xdfbb('0x74')]===_0xdfbb('0x75')){var _0x2de7b1=_0x4e0da2[_0xdfbb('0x76')]({'plain':!![]});return db[_0xdfbb('0x77')]['find']({'where':{'name':_0xdfbb('0x28'),'userProfileId':_0xd9cfce[_0xdfbb('0x73')]},'raw':!![]})[_0xdfbb('0x27')](function(_0x6f06a7){if(_0x6f06a7&&_0x6f06a7[_0xdfbb('0x78')]===0x0){return db[_0xdfbb('0x29')]['create']({'name':_0x2de7b1[_0xdfbb('0x2b')],'resourceId':_0x2de7b1['id'],'type':_0x6f06a7['name'],'sectionId':_0x6f06a7['id']},{})['then'](function(){return _0x4e0da2;});}else{return _0x4e0da2;}})[_0xdfbb('0x45')](function(_0x310274){logger[_0xdfbb('0x2a')](_0xdfbb('0x79'),_0x310274);throw _0x310274;});}return _0x4e0da2;})[_0xdfbb('0x27')](respondWithResult(_0x3e1648,null))[_0xdfbb('0x45')](handleError(_0x3e1648,null));});_0x51b052[_0xdfbb('0x7a')]();}catch(_0x97013b){_0x3e1648['status'](0x1f4)[_0xdfbb('0x2c')](_0x97013b);}};exports[_0xdfbb('0x26')]=function(_0x5c1416,_0x203249,_0x357b09){return db['Sound'][_0xdfbb('0x49')]({'where':{'id':_0x5c1416[_0xdfbb('0x47')]['id']}})[_0xdfbb('0x27')](handleEntityNotFound(_0x203249,null))[_0xdfbb('0x27')](saveUpdates(_[_0xdfbb('0x3c')](_0x5c1416[_0xdfbb('0x72')],[_0xdfbb('0x2b'),'description']),null))['then'](respondWithResult(_0x203249,null))[_0xdfbb('0x45')](handleError(_0x203249,null));};exports['delete']=function(_0x1c3f3d,_0x3c4daf,_0x276c7f){return db[_0xdfbb('0x2d')][_0xdfbb('0x49')]({'where':{'id':_0x1c3f3d[_0xdfbb('0x47')]['id']}})[_0xdfbb('0x27')](function(_0x32a6cf){if(_0x32a6cf){return _0x32a6cf['destroy']();}})[_0xdfbb('0x27')](function(_0x24aecf){var _0x37c863=path['join'](config[_0xdfbb('0x4f')],_0xdfbb('0x7b'),util[_0xdfbb('0x52')](_0xdfbb('0x53'),_0x24aecf['save_name'],_0x24aecf[_0xdfbb('0x7c')]));var _0x31edce=path[_0xdfbb('0x4e')](config['root'],_0xdfbb('0x5b'),util['format'](_0xdfbb('0x53'),_0x24aecf[_0xdfbb('0x4b')],_0x24aecf[_0xdfbb('0x4c')]));fs[_0xdfbb('0x61')](_0x37c863);fs[_0xdfbb('0x61')](_0x31edce);return _0x24aecf;})['then'](function(_0x22b523){if(_0x22b523){return _0x3c4daf[_0xdfbb('0x1b')](0xcc)[_0xdfbb('0x1c')]();}})['then'](handleEntityNotFound(_0x3c4daf,null))[_0xdfbb('0x45')](handleError(_0x3c4daf,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 70f6c9c..1449825 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 _0x00a8=['request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','api','moment','bluebird'];(function(_0x135430,_0x3543c2){var _0x169e22=function(_0x151843){while(--_0x151843){_0x135430['push'](_0x135430['shift']());}};_0x169e22(++_0x3543c2);}(_0x00a8,0x159));var _0x800a=function(_0x3b5d9b,_0x414ac2){_0x3b5d9b=_0x3b5d9b-0x0;var _0x49d031=_0x00a8[_0x3b5d9b];return _0x49d031;};'use strict';var _=require(_0x800a('0x0'));var util=require(_0x800a('0x1'));var logger=require('../../config/logger')(_0x800a('0x2'));var moment=require(_0x800a('0x3'));var BPromise=require(_0x800a('0x4'));var rp=require(_0x800a('0x5'));var fs=require('fs');var path=require(_0x800a('0x6'));var rimraf=require(_0x800a('0x7'));var config=require(_0x800a('0x8'));var attributes=require(_0x800a('0x9'));module[_0x800a('0xa')]=function(_0x34408e,_0x1fde48){return _0x34408e[_0x800a('0xb')](_0x800a('0xc'),attributes,{'tableName':_0x800a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4ef=['api','moment','path','define','util','../../config/logger'];(function(_0x59ba4e,_0x4369b1){var _0x6a0fd6=function(_0x2c3734){while(--_0x2c3734){_0x59ba4e['push'](_0x59ba4e['shift']());}};_0x6a0fd6(++_0x4369b1);}(_0xd4ef,0x1d2));var _0xfd4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4ef[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xfd4e('0x0'));var logger=require(_0xfd4e('0x1'))(_0xfd4e('0x2'));var moment=require(_0xfd4e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd4e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./sound.attributes');module['exports']=function(_0x4ef2c3,_0x412096){return _0x4ef2c3[_0xfd4e('0x5')]('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 967a56e..079979c 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 _0x8a00=['raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSound','Sound','options'];(function(_0x4bf3a7,_0x5d756b){var _0x58c9cc=function(_0x13c6c9){while(--_0x13c6c9){_0x4bf3a7['push'](_0x4bf3a7['shift']());}};_0x58c9cc(++_0x5d756b);}(_0x8a00,0xa6));var _0x08a0=function(_0x34b2d5,_0x56ddf5){_0x34b2d5=_0x34b2d5-0x0;var _0x264c1a=_0x8a00[_0x34b2d5];return _0x264c1a;};'use strict';var _=require(_0x08a0('0x0'));var util=require(_0x08a0('0x1'));var moment=require(_0x08a0('0x2'));var BPromise=require(_0x08a0('0x3'));var rs=require(_0x08a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x08a0('0x5'));var logger=require(_0x08a0('0x6'))(_0x08a0('0x7'));var config=require(_0x08a0('0x8'));var jayson=require(_0x08a0('0x9'));var client=jayson[_0x08a0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x485830,_0x11f049,_0x4868c9){return new BPromise(function(_0x2f4d3f,_0x16835b){return client[_0x08a0('0xb')](_0x485830,_0x4868c9)[_0x08a0('0xc')](function(_0x29bd25){logger[_0x08a0('0xd')](_0x08a0('0xe'),_0x11f049,_0x08a0('0xf'));logger[_0x08a0('0x10')]('Sound,\x20%s,\x20%s,\x20%s',_0x11f049,_0x08a0('0xf'),JSON[_0x08a0('0x11')](_0x29bd25));if(_0x29bd25[_0x08a0('0x12')]){if(_0x29bd25[_0x08a0('0x12')][_0x08a0('0x13')]===0x1f4){logger[_0x08a0('0x12')](_0x08a0('0xe'),_0x11f049,_0x29bd25['error'][_0x08a0('0x14')]);return _0x16835b(_0x29bd25[_0x08a0('0x12')][_0x08a0('0x14')]);}logger[_0x08a0('0x12')]('Sound,\x20%s,\x20%s',_0x11f049,_0x29bd25[_0x08a0('0x12')]['message']);return _0x2f4d3f(_0x29bd25[_0x08a0('0x12')][_0x08a0('0x14')]);}else{logger[_0x08a0('0xd')]('Sound,\x20%s,\x20%s',_0x11f049,_0x08a0('0xf'));_0x2f4d3f(_0x29bd25[_0x08a0('0x15')][_0x08a0('0x14')]);}})[_0x08a0('0x16')](function(_0x33875f){logger['error']('Sound,\x20%s,\x20%s',_0x11f049,_0x33875f);_0x16835b(_0x33875f);});});}exports[_0x08a0('0x17')]=function(_0xa6c8e){var _0x56bde5=this;return new Promise(function(_0x40e576,_0x2f1d3b){return db[_0x08a0('0x18')]['find']({'raw':_0xa6c8e[_0x08a0('0x19')]?_0xa6c8e['options'][_0x08a0('0x1a')]===undefined?!![]:![]:!![],'where':_0xa6c8e[_0x08a0('0x19')]?_0xa6c8e[_0x08a0('0x19')][_0x08a0('0x1b')]||null:null,'attributes':_0xa6c8e['options']?_0xa6c8e[_0x08a0('0x19')][_0x08a0('0x1c')]||null:null,'include':_0xa6c8e[_0x08a0('0x19')]?_0xa6c8e[_0x08a0('0x19')][_0x08a0('0x1d')]?_[_0x08a0('0x1e')](_0xa6c8e[_0x08a0('0x19')][_0x08a0('0x1d')],function(_0x4924e0){return{'model':db[_0x4924e0[_0x08a0('0x1f')]],'as':_0x4924e0['as'],'attributes':_0x4924e0['attributes'],'include':_0x4924e0['include']?_[_0x08a0('0x1e')](_0x4924e0[_0x08a0('0x1d')],function(_0x5683e7){return{'model':db[_0x5683e7['model']],'as':_0x5683e7['as'],'attributes':_0x5683e7[_0x08a0('0x1c')],'include':_0x5683e7[_0x08a0('0x1d')]?_[_0x08a0('0x1e')](_0x5683e7[_0x08a0('0x1d')],function(_0x5c61f7){return{'model':db[_0x5c61f7[_0x08a0('0x1f')]],'as':_0x5c61f7['as'],'attributes':_0x5c61f7[_0x08a0('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c238f){logger[_0x08a0('0xd')]('ShowSound',_0xa6c8e);logger[_0x08a0('0x10')](_0x08a0('0x17'),_0xa6c8e,JSON['stringify'](_0x3c238f));_0x40e576(_0x3c238f);})[_0x08a0('0x16')](function(_0x2d4ac5){logger[_0x08a0('0x12')](_0x08a0('0x17'),_0x2d4ac5['message'],_0xa6c8e);_0x2f1d3b(_0x56bde5[_0x08a0('0x12')](0x1f4,_0x2d4ac5[_0x08a0('0x14')]));});});}; \ No newline at end of file +var _0x98be=['options','where','attributes','include','map','model','ShowSound','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','find','raw'];(function(_0x73a6b3,_0x8afc2b){var _0x5b6290=function(_0x40e2d9){while(--_0x40e2d9){_0x73a6b3['push'](_0x73a6b3['shift']());}};_0x5b6290(++_0x8afc2b);}(_0x98be,0x15c));var _0xe98b=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x98be[_0x166742];return _0xb7814a;};'use strict';var _=require('lodash');var util=require(_0xe98b('0x0'));var moment=require(_0xe98b('0x1'));var BPromise=require('bluebird');var rs=require(_0xe98b('0x2'));var fs=require('fs');var Redis=require(_0xe98b('0x3'));var db=require(_0xe98b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe98b('0x5'))(_0xe98b('0x6'));var config=require(_0xe98b('0x7'));var jayson=require(_0xe98b('0x8'));var client=jayson[_0xe98b('0x9')][_0xe98b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e9a7e,_0x45ebdf,_0x4a5aae){return new BPromise(function(_0x24098f,_0x520626){return client[_0xe98b('0xb')](_0x4e9a7e,_0x4a5aae)[_0xe98b('0xc')](function(_0x5465f6){logger[_0xe98b('0xd')]('Sound,\x20%s,\x20%s',_0x45ebdf,_0xe98b('0xe'));logger[_0xe98b('0xf')](_0xe98b('0x10'),_0x45ebdf,_0xe98b('0xe'),JSON[_0xe98b('0x11')](_0x5465f6));if(_0x5465f6[_0xe98b('0x12')]){if(_0x5465f6[_0xe98b('0x12')][_0xe98b('0x13')]===0x1f4){logger[_0xe98b('0x12')](_0xe98b('0x14'),_0x45ebdf,_0x5465f6[_0xe98b('0x12')][_0xe98b('0x15')]);return _0x520626(_0x5465f6[_0xe98b('0x12')][_0xe98b('0x15')]);}logger['error'](_0xe98b('0x14'),_0x45ebdf,_0x5465f6['error'][_0xe98b('0x15')]);return _0x24098f(_0x5465f6[_0xe98b('0x12')][_0xe98b('0x15')]);}else{logger[_0xe98b('0xd')](_0xe98b('0x14'),_0x45ebdf,'request\x20sent');_0x24098f(_0x5465f6['result'][_0xe98b('0x15')]);}})['catch'](function(_0x135cf9){logger['error'](_0xe98b('0x14'),_0x45ebdf,_0x135cf9);_0x520626(_0x135cf9);});});}exports['ShowSound']=function(_0x4e3df9){var _0x54a72b=this;return new Promise(function(_0x3977dd,_0x56800f){return db['Sound'][_0xe98b('0x16')]({'raw':_0x4e3df9['options']?_0x4e3df9['options'][_0xe98b('0x17')]===undefined?!![]:![]:!![],'where':_0x4e3df9[_0xe98b('0x18')]?_0x4e3df9[_0xe98b('0x18')][_0xe98b('0x19')]||null:null,'attributes':_0x4e3df9[_0xe98b('0x18')]?_0x4e3df9['options'][_0xe98b('0x1a')]||null:null,'include':_0x4e3df9[_0xe98b('0x18')]?_0x4e3df9[_0xe98b('0x18')][_0xe98b('0x1b')]?_[_0xe98b('0x1c')](_0x4e3df9[_0xe98b('0x18')][_0xe98b('0x1b')],function(_0x4a387f){return{'model':db[_0x4a387f['model']],'as':_0x4a387f['as'],'attributes':_0x4a387f[_0xe98b('0x1a')],'include':_0x4a387f['include']?_['map'](_0x4a387f[_0xe98b('0x1b')],function(_0x39d489){return{'model':db[_0x39d489[_0xe98b('0x1d')]],'as':_0x39d489['as'],'attributes':_0x39d489[_0xe98b('0x1a')],'include':_0x39d489[_0xe98b('0x1b')]?_[_0xe98b('0x1c')](_0x39d489[_0xe98b('0x1b')],function(_0x5b66b5){return{'model':db[_0x5b66b5[_0xe98b('0x1d')]],'as':_0x5b66b5['as'],'attributes':_0x5b66b5['attributes']};}):[]};}):[]};}):[]:[]})[_0xe98b('0xc')](function(_0xbda2da){logger[_0xe98b('0xd')](_0xe98b('0x1e'),_0x4e3df9);logger[_0xe98b('0xf')](_0xe98b('0x1e'),_0x4e3df9,JSON[_0xe98b('0x11')](_0xbda2da));_0x3977dd(_0xbda2da);})['catch'](function(_0x538110){logger['error']('ShowSound',_0x538110[_0xe98b('0x15')],_0x4e3df9);_0x56800f(_0x54a72b[_0xe98b('0x12')](0x1f4,_0x538110[_0xe98b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index ddfebf5..2f27d70 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 _0x921d=['index','/:id','show','post','create','put','update','delete','destroy','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','get','isAuthenticated'];(function(_0x4ab7c7,_0x421ccd){var _0x5b619d=function(_0x23f8c4){while(--_0x23f8c4){_0x4ab7c7['push'](_0x4ab7c7['shift']());}};_0x5b619d(++_0x421ccd);}(_0x921d,0xf3));var _0xd921=function(_0x537a5b,_0x209343){_0x537a5b=_0x537a5b-0x0;var _0x5e575b=_0x921d[_0x537a5b];return _0x5e575b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd921('0x0'));var express=require(_0xd921('0x1'));var router=express[_0xd921('0x2')]();var fs_extra=require(_0xd921('0x3'));var auth=require(_0xd921('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd921('0x5'));var controller=require(_0xd921('0x6'));router[_0xd921('0x7')]('/',auth[_0xd921('0x8')](),controller[_0xd921('0x9')]);router[_0xd921('0x7')](_0xd921('0xa'),auth[_0xd921('0x8')](),controller[_0xd921('0xb')]);router[_0xd921('0xc')]('/',auth[_0xd921('0x8')](),controller[_0xd921('0xd')]);router[_0xd921('0xe')](_0xd921('0xa'),auth[_0xd921('0x8')](),controller[_0xd921('0xf')]);router[_0xd921('0x10')](_0xd921('0xa'),auth[_0xd921('0x8')](),controller[_0xd921('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6383=['create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x6453b,_0xd44754){var _0x2fd18c=function(_0x2ad7e6){while(--_0x2ad7e6){_0x6453b['push'](_0x6453b['shift']());}};_0x2fd18c(++_0xd44754);}(_0x6383,0xa8));var _0x3638=function(_0x24d8fc,_0x18b3f8){_0x24d8fc=_0x24d8fc-0x0;var _0x2dd4fb=_0x6383[_0x24d8fc];return _0x2dd4fb;};'use strict';var multer=require('multer');var util=require(_0x3638('0x0'));var path=require(_0x3638('0x1'));var timeout=require('connect-timeout');var express=require(_0x3638('0x2'));var router=express[_0x3638('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3638('0x4'));var interaction=require(_0x3638('0x5'));var config=require(_0x3638('0x6'));var controller=require('./squareMessage.controller');router[_0x3638('0x7')]('/',auth[_0x3638('0x8')](),controller[_0x3638('0x9')]);router[_0x3638('0x7')](_0x3638('0xa'),auth[_0x3638('0x8')](),controller[_0x3638('0xb')]);router['post']('/',auth[_0x3638('0x8')](),controller[_0x3638('0xc')]);router[_0x3638('0xd')](_0x3638('0xa'),auth[_0x3638('0x8')](),controller[_0x3638('0xe')]);router[_0x3638('0xf')](_0x3638('0xa'),auth['isAuthenticated'](),controller[_0x3638('0x10')]);module[_0x3638('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 58d2304..31c60be 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 _0xb4c7=['STRING','TEXT','medium','out','sequelize','exports'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x5863c1,_0x55ae6d){_0x5863c1=_0x5863c1-0x0;var _0x5c7e11=_0xb4c7[_0x5863c1];return _0x5c7e11;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'uniqueid':{'type':Sequelize[_0x7b4c('0x2')]},'body':{'type':Sequelize[_0x7b4c('0x3')](_0x7b4c('0x4')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7b4c('0x5')),'defaultValue':_0x7b4c('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x7b4c('0x2')]},'providerResponse':{'type':Sequelize[_0x7b4c('0x3')]}}; \ No newline at end of file +var _0xa41a=['out','STRING','sequelize','exports','TEXT','medium','ENUM'];(function(_0x47fa4f,_0x313dea){var _0x2227cf=function(_0x540734){while(--_0x540734){_0x47fa4f['push'](_0x47fa4f['shift']());}};_0x2227cf(++_0x313dea);}(_0xa41a,0x6b));var _0xaa41=function(_0x36b65f,_0x9e2994){_0x36b65f=_0x36b65f-0x0;var _0x42c1c0=_0xa41a[_0x36b65f];return _0x42c1c0;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xaa41('0x2')](_0xaa41('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xaa41('0x4')]('in',_0xaa41('0x5')),'defaultValue':_0xaa41('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xaa41('0x6')]},'providerResponse':{'type':Sequelize[_0xaa41('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 7c16a3f..b36b70e 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 _0xeed8=['create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SquareMessage','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','find'];(function(_0x12558f,_0x7c0572){var _0x10a21b=function(_0x295d04){while(--_0x295d04){_0x12558f['push'](_0x12558f['shift']());}};_0x10a21b(++_0x7c0572);}(_0xeed8,0x1b8));var _0x8eed=function(_0x16bc1b,_0x33a54e){_0x16bc1b=_0x16bc1b-0x0;var _0x5cd224=_0xeed8[_0x16bc1b];return _0x5cd224;};'use strict';var emlformat=require(_0x8eed('0x0'));var rimraf=require(_0x8eed('0x1'));var zipdir=require(_0x8eed('0x2'));var jsonpatch=require(_0x8eed('0x3'));var rp=require(_0x8eed('0x4'));var moment=require(_0x8eed('0x5'));var BPromise=require(_0x8eed('0x6'));var Mustache=require(_0x8eed('0x7'));var util=require(_0x8eed('0x8'));var path=require(_0x8eed('0x9'));var sox=require(_0x8eed('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8eed('0xb'));var _=require(_0x8eed('0xc'));var squel=require(_0x8eed('0xd'));var crypto=require(_0x8eed('0xe'));var jsforce=require(_0x8eed('0xf'));var deskjs=require(_0x8eed('0x10'));var toCsv=require(_0x8eed('0x11'));var querystring=require(_0x8eed('0x12'));var Papa=require('papaparse');var Redis=require(_0x8eed('0x13'));var authService=require(_0x8eed('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8eed('0x15'));var logger=require(_0x8eed('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8eed('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23ffbc,_0x4ed446){_0x4ed446=_0x4ed446||0xcc;return function(_0x3a0dd2){if(_0x3a0dd2){return _0x23ffbc[_0x8eed('0x18')](_0x4ed446);}return _0x23ffbc[_0x8eed('0x19')](_0x4ed446)[_0x8eed('0x1a')]();};}function respondWithResult(_0x5a9e52,_0x1c0ca4){_0x1c0ca4=_0x1c0ca4||0xc8;return function(_0x3507af){if(_0x3507af){return _0x5a9e52[_0x8eed('0x19')](_0x1c0ca4)[_0x8eed('0x1b')](_0x3507af);}};}function respondWithFilteredResult(_0x2c9d17,_0x828c0d){return function(_0x378dbc){if(_0x378dbc){var _0x2ec6e4=typeof _0x828c0d[_0x8eed('0x1c')]===_0x8eed('0x1d')&&typeof _0x828c0d['limit']===_0x8eed('0x1d');var _0x171696=_0x378dbc[_0x8eed('0x1e')];var _0x143f26=_0x2ec6e4?0x0:_0x828c0d['offset'];var _0x5071fb=_0x2ec6e4?_0x378dbc['count']:_0x828c0d['offset']+_0x828c0d[_0x8eed('0x1f')];var _0xeb4383;if(_0x5071fb>=_0x171696){_0x5071fb=_0x171696;_0xeb4383=0xc8;}else{_0xeb4383=0xce;}_0x2c9d17[_0x8eed('0x19')](_0xeb4383);return _0x2c9d17[_0x8eed('0x20')](_0x8eed('0x21'),_0x143f26+'-'+_0x5071fb+'/'+_0x171696)[_0x8eed('0x1b')](_0x378dbc);}return null;};}function patchUpdates(_0x2b7bdb){return function(_0x4fa289){try{jsonpatch[_0x8eed('0x22')](_0x4fa289,_0x2b7bdb,!![]);}catch(_0x59e6a2){return BPromise[_0x8eed('0x23')](_0x59e6a2);}return _0x4fa289[_0x8eed('0x24')]();};}function saveUpdates(_0x128784,_0x57da15){return function(_0x567e9b){if(_0x567e9b){return _0x567e9b[_0x8eed('0x25')](_0x128784)['then'](function(_0xac2ab2){return _0xac2ab2;});}return null;};}function removeEntity(_0x1ed186,_0x204171){return function(_0x372f7d){if(_0x372f7d){return _0x372f7d['destroy']()[_0x8eed('0x26')](function(){_0x1ed186[_0x8eed('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b7cf1,_0x45f5e0){return function(_0xce3c16){if(!_0xce3c16){_0x3b7cf1[_0x8eed('0x18')](0x194);}return _0xce3c16;};}function handleError(_0x19f698,_0x2049dd){_0x2049dd=_0x2049dd||0x1f4;return function(_0x45d719){logger[_0x8eed('0x27')](_0x45d719[_0x8eed('0x28')]);if(_0x45d719[_0x8eed('0x29')]){delete _0x45d719[_0x8eed('0x29')];}_0x19f698[_0x8eed('0x19')](_0x2049dd)[_0x8eed('0x2a')](_0x45d719);};}exports[_0x8eed('0x2b')]=function(_0x327456,_0x278b40){var _0x217306={},_0x382391={},_0x15fcf9={'count':0x0,'rows':[]};var _0x9bb0c2=_[_0x8eed('0x2c')](db[_0x8eed('0x2d')][_0x8eed('0x2e')],function(_0x177f02){return{'name':_0x177f02['fieldName'],'type':_0x177f02[_0x8eed('0x2f')][_0x8eed('0x30')]};});_0x382391[_0x8eed('0x31')]=_[_0x8eed('0x2c')](_0x9bb0c2,_0x8eed('0x29'));_0x382391['query']=_['keys'](_0x327456[_0x8eed('0x32')]);_0x382391[_0x8eed('0x33')]=_[_0x8eed('0x34')](_0x382391['model'],_0x382391[_0x8eed('0x32')]);_0x217306['attributes']=_[_0x8eed('0x34')](_0x382391[_0x8eed('0x31')],qs[_0x8eed('0x35')](_0x327456['query'][_0x8eed('0x35')]));_0x217306[_0x8eed('0x36')]=_0x217306[_0x8eed('0x36')][_0x8eed('0x37')]?_0x217306[_0x8eed('0x36')]:_0x382391[_0x8eed('0x31')];if(!_0x327456[_0x8eed('0x32')][_0x8eed('0x38')](_0x8eed('0x39'))){_0x217306[_0x8eed('0x1f')]=qs[_0x8eed('0x1f')](_0x327456[_0x8eed('0x32')][_0x8eed('0x1f')]);_0x217306[_0x8eed('0x1c')]=qs[_0x8eed('0x1c')](_0x327456[_0x8eed('0x32')][_0x8eed('0x1c')]);}_0x217306[_0x8eed('0x3a')]=qs[_0x8eed('0x3b')](_0x327456[_0x8eed('0x32')]['sort']);_0x217306['where']=qs[_0x8eed('0x33')](_['pick'](_0x327456[_0x8eed('0x32')],_0x382391[_0x8eed('0x33')]),_0x9bb0c2);if(_0x327456[_0x8eed('0x32')][_0x8eed('0x3c')]){_0x217306['where']=_[_0x8eed('0x3d')](_0x217306['where'],{'$or':_[_0x8eed('0x2c')](_0x9bb0c2,function(_0x4fa5dc){if(_0x4fa5dc[_0x8eed('0x2f')]!=='VIRTUAL'){var _0x34f892={};_0x34f892[_0x4fa5dc['name']]={'$like':'%'+_0x327456[_0x8eed('0x32')][_0x8eed('0x3c')]+'%'};return _0x34f892;}})});}_0x217306=_[_0x8eed('0x3d')]({},_0x217306,_0x327456['options']);var _0x194d3f={'where':_0x217306['where']};return db[_0x8eed('0x2d')]['count'](_0x194d3f)[_0x8eed('0x26')](function(_0x5a4ccd){_0x15fcf9[_0x8eed('0x1e')]=_0x5a4ccd;if(_0x327456['query']['includeAll']){_0x217306[_0x8eed('0x3e')]=[{'all':!![]}];}return db[_0x8eed('0x2d')][_0x8eed('0x3f')](_0x217306);})[_0x8eed('0x26')](function(_0x5248b9){_0x15fcf9[_0x8eed('0x40')]=_0x5248b9;return _0x15fcf9;})[_0x8eed('0x26')](respondWithFilteredResult(_0x278b40,_0x217306))[_0x8eed('0x41')](handleError(_0x278b40,null));};exports[_0x8eed('0x42')]=function(_0x3b8f82,_0x1ab147){var _0x443e51={'raw':!![],'where':{'id':_0x3b8f82[_0x8eed('0x43')]['id']}},_0x3a2c9d={};_0x3a2c9d[_0x8eed('0x31')]=_['keys'](db[_0x8eed('0x2d')]['rawAttributes']);_0x3a2c9d[_0x8eed('0x32')]=_['keys'](_0x3b8f82[_0x8eed('0x32')]);_0x3a2c9d[_0x8eed('0x33')]=_[_0x8eed('0x34')](_0x3a2c9d[_0x8eed('0x31')],_0x3a2c9d[_0x8eed('0x32')]);_0x443e51[_0x8eed('0x36')]=_[_0x8eed('0x34')](_0x3a2c9d[_0x8eed('0x31')],qs[_0x8eed('0x35')](_0x3b8f82[_0x8eed('0x32')][_0x8eed('0x35')]));_0x443e51['attributes']=_0x443e51[_0x8eed('0x36')][_0x8eed('0x37')]?_0x443e51['attributes']:_0x3a2c9d['model'];if(_0x3b8f82['query'][_0x8eed('0x44')]){_0x443e51[_0x8eed('0x3e')]=[{'all':!![]}];}_0x443e51=_[_0x8eed('0x3d')]({},_0x443e51,_0x3b8f82[_0x8eed('0x45')]);return db[_0x8eed('0x2d')][_0x8eed('0x46')](_0x443e51)[_0x8eed('0x26')](handleEntityNotFound(_0x1ab147,null))[_0x8eed('0x26')](respondWithResult(_0x1ab147,null))['catch'](handleError(_0x1ab147,null));};exports[_0x8eed('0x47')]=function(_0x3402b2,_0x2a7449){return db['SquareMessage']['create'](_0x3402b2[_0x8eed('0x48')],{})['then'](respondWithResult(_0x2a7449,0xc9))[_0x8eed('0x41')](handleError(_0x2a7449,null));};exports[_0x8eed('0x25')]=function(_0x5452d4,_0x14495b){if(_0x5452d4['body']['id']){delete _0x5452d4[_0x8eed('0x48')]['id'];}return db[_0x8eed('0x2d')][_0x8eed('0x46')]({'where':{'id':_0x5452d4[_0x8eed('0x43')]['id']}})['then'](handleEntityNotFound(_0x14495b,null))[_0x8eed('0x26')](saveUpdates(_0x5452d4[_0x8eed('0x48')],null))[_0x8eed('0x26')](respondWithResult(_0x14495b,null))[_0x8eed('0x41')](handleError(_0x14495b,null));};exports['destroy']=function(_0x1b9b0c,_0x5b0ff3){return db['SquareMessage'][_0x8eed('0x46')]({'where':{'id':_0x1b9b0c[_0x8eed('0x43')]['id']}})['then'](handleEntityNotFound(_0x5b0ff3,null))[_0x8eed('0x26')](removeEntity(_0x5b0ff3,null))[_0x8eed('0x41')](handleError(_0x5b0ff3,null));}; \ No newline at end of file +var _0x33fc=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','send','index','SquareMessage','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','catch','create','body','update','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x2383cc,_0xd5a4a7){var _0x43faeb=function(_0x507f13){while(--_0x507f13){_0x2383cc['push'](_0x2383cc['shift']());}};_0x43faeb(++_0xd5a4a7);}(_0x33fc,0x1ad));var _0xc33f=function(_0x56278e,_0x5083c5){_0x56278e=_0x56278e-0x0;var _0x46d37e=_0x33fc[_0x56278e];return _0x46d37e;};'use strict';var emlformat=require(_0xc33f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc33f('0x1'));var jsonpatch=require(_0xc33f('0x2'));var rp=require(_0xc33f('0x3'));var moment=require(_0xc33f('0x4'));var BPromise=require(_0xc33f('0x5'));var Mustache=require(_0xc33f('0x6'));var util=require(_0xc33f('0x7'));var path=require(_0xc33f('0x8'));var sox=require(_0xc33f('0x9'));var csv=require(_0xc33f('0xa'));var ejs=require(_0xc33f('0xb'));var fs=require('fs');var fs_extra=require(_0xc33f('0xc'));var _=require(_0xc33f('0xd'));var squel=require('squel');var crypto=require(_0xc33f('0xe'));var jsforce=require(_0xc33f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc33f('0xa'));var querystring=require(_0xc33f('0x10'));var Papa=require(_0xc33f('0x11'));var Redis=require('ioredis');var authService=require(_0xc33f('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc33f('0x13'));var logger=require(_0xc33f('0x14'))(_0xc33f('0x15'));var utils=require('../../config/utils');var config=require(_0xc33f('0x16'));var licenseUtil=require(_0xc33f('0x17'));var db=require(_0xc33f('0x18'))['db'];function respondWithStatusCode(_0x5758b0,_0x2c4796){_0x2c4796=_0x2c4796||0xcc;return function(_0x2946e5){if(_0x2946e5){return _0x5758b0[_0xc33f('0x19')](_0x2c4796);}return _0x5758b0['status'](_0x2c4796)[_0xc33f('0x1a')]();};}function respondWithResult(_0x5653b1,_0x2f599f){_0x2f599f=_0x2f599f||0xc8;return function(_0x1126e1){if(_0x1126e1){return _0x5653b1[_0xc33f('0x1b')](_0x2f599f)[_0xc33f('0x1c')](_0x1126e1);}};}function respondWithFilteredResult(_0x249ace,_0x22b19c){return function(_0x3fcceb){if(_0x3fcceb){var _0x30c8e3=typeof _0x22b19c[_0xc33f('0x1d')]===_0xc33f('0x1e')&&typeof _0x22b19c[_0xc33f('0x1f')]===_0xc33f('0x1e');var _0x509f4d=_0x3fcceb[_0xc33f('0x20')];var _0x5808ad=_0x30c8e3?0x0:_0x22b19c[_0xc33f('0x1d')];var _0x49910c=_0x30c8e3?_0x3fcceb[_0xc33f('0x20')]:_0x22b19c[_0xc33f('0x1d')]+_0x22b19c[_0xc33f('0x1f')];var _0x3e94af;if(_0x49910c>=_0x509f4d){_0x49910c=_0x509f4d;_0x3e94af=0xc8;}else{_0x3e94af=0xce;}_0x249ace[_0xc33f('0x1b')](_0x3e94af);return _0x249ace[_0xc33f('0x21')](_0xc33f('0x22'),_0x5808ad+'-'+_0x49910c+'/'+_0x509f4d)[_0xc33f('0x1c')](_0x3fcceb);}return null;};}function patchUpdates(_0x5db46e){return function(_0x598a67){try{jsonpatch['apply'](_0x598a67,_0x5db46e,!![]);}catch(_0x26e37f){return BPromise['reject'](_0x26e37f);}return _0x598a67[_0xc33f('0x23')]();};}function saveUpdates(_0x2d82bd,_0x128311){return function(_0x29ad6e){if(_0x29ad6e){return _0x29ad6e['update'](_0x2d82bd)[_0xc33f('0x24')](function(_0x10f448){return _0x10f448;});}return null;};}function removeEntity(_0x1be448,_0x1810ca){return function(_0x43a223){if(_0x43a223){return _0x43a223[_0xc33f('0x25')]()[_0xc33f('0x24')](function(){_0x1be448[_0xc33f('0x1b')](0xcc)[_0xc33f('0x1a')]();});}};}function handleEntityNotFound(_0x496cff,_0x316a27){return function(_0x5c390f){if(!_0x5c390f){_0x496cff[_0xc33f('0x19')](0x194);}return _0x5c390f;};}function handleError(_0x1e2f1a,_0x2daa5f){_0x2daa5f=_0x2daa5f||0x1f4;return function(_0x32b43f){logger[_0xc33f('0x26')](_0x32b43f[_0xc33f('0x27')]);if(_0x32b43f[_0xc33f('0x28')]){delete _0x32b43f[_0xc33f('0x28')];}_0x1e2f1a[_0xc33f('0x1b')](_0x2daa5f)[_0xc33f('0x29')](_0x32b43f);};}exports[_0xc33f('0x2a')]=function(_0x5e8e8c,_0x583c98){var _0x476b54={},_0x4e4e68={},_0x5e0a88={'count':0x0,'rows':[]};var _0x1d2d64=_['map'](db[_0xc33f('0x2b')][_0xc33f('0x2c')],function(_0x19e2e){return{'name':_0x19e2e[_0xc33f('0x2d')],'type':_0x19e2e[_0xc33f('0x2e')]['key']};});_0x4e4e68[_0xc33f('0x2f')]=_[_0xc33f('0x30')](_0x1d2d64,'name');_0x4e4e68['query']=_['keys'](_0x5e8e8c[_0xc33f('0x31')]);_0x4e4e68[_0xc33f('0x32')]=_[_0xc33f('0x33')](_0x4e4e68['model'],_0x4e4e68[_0xc33f('0x31')]);_0x476b54['attributes']=_[_0xc33f('0x33')](_0x4e4e68['model'],qs['fields'](_0x5e8e8c[_0xc33f('0x31')][_0xc33f('0x34')]));_0x476b54[_0xc33f('0x35')]=_0x476b54[_0xc33f('0x35')][_0xc33f('0x36')]?_0x476b54[_0xc33f('0x35')]:_0x4e4e68['model'];if(!_0x5e8e8c[_0xc33f('0x31')]['hasOwnProperty'](_0xc33f('0x37'))){_0x476b54[_0xc33f('0x1f')]=qs[_0xc33f('0x1f')](_0x5e8e8c[_0xc33f('0x31')]['limit']);_0x476b54[_0xc33f('0x1d')]=qs[_0xc33f('0x1d')](_0x5e8e8c[_0xc33f('0x31')][_0xc33f('0x1d')]);}_0x476b54[_0xc33f('0x38')]=qs['sort'](_0x5e8e8c[_0xc33f('0x31')][_0xc33f('0x39')]);_0x476b54[_0xc33f('0x3a')]=qs[_0xc33f('0x32')](_[_0xc33f('0x3b')](_0x5e8e8c[_0xc33f('0x31')],_0x4e4e68['filters']),_0x1d2d64);if(_0x5e8e8c[_0xc33f('0x31')][_0xc33f('0x3c')]){_0x476b54[_0xc33f('0x3a')]=_[_0xc33f('0x3d')](_0x476b54['where'],{'$or':_['map'](_0x1d2d64,function(_0x1b03d9){if(_0x1b03d9[_0xc33f('0x2e')]!==_0xc33f('0x3e')){var _0x319208={};_0x319208[_0x1b03d9[_0xc33f('0x28')]]={'$like':'%'+_0x5e8e8c[_0xc33f('0x31')][_0xc33f('0x3c')]+'%'};return _0x319208;}})});}_0x476b54=_[_0xc33f('0x3d')]({},_0x476b54,_0x5e8e8c[_0xc33f('0x3f')]);var _0x4feb49={'where':_0x476b54[_0xc33f('0x3a')]};return db[_0xc33f('0x2b')][_0xc33f('0x20')](_0x4feb49)[_0xc33f('0x24')](function(_0xb99222){_0x5e0a88[_0xc33f('0x20')]=_0xb99222;if(_0x5e8e8c['query'][_0xc33f('0x40')]){_0x476b54[_0xc33f('0x41')]=[{'all':!![]}];}return db[_0xc33f('0x2b')][_0xc33f('0x42')](_0x476b54);})[_0xc33f('0x24')](function(_0x574770){_0x5e0a88[_0xc33f('0x43')]=_0x574770;return _0x5e0a88;})[_0xc33f('0x24')](respondWithFilteredResult(_0x583c98,_0x476b54))['catch'](handleError(_0x583c98,null));};exports[_0xc33f('0x44')]=function(_0x3f9848,_0x152552){var _0x5480fa={'raw':!![],'where':{'id':_0x3f9848['params']['id']}},_0x54ff3e={};_0x54ff3e[_0xc33f('0x2f')]=_[_0xc33f('0x45')](db['SquareMessage'][_0xc33f('0x2c')]);_0x54ff3e[_0xc33f('0x31')]=_['keys'](_0x3f9848[_0xc33f('0x31')]);_0x54ff3e[_0xc33f('0x32')]=_['intersection'](_0x54ff3e[_0xc33f('0x2f')],_0x54ff3e[_0xc33f('0x31')]);_0x5480fa[_0xc33f('0x35')]=_[_0xc33f('0x33')](_0x54ff3e[_0xc33f('0x2f')],qs[_0xc33f('0x34')](_0x3f9848['query'][_0xc33f('0x34')]));_0x5480fa[_0xc33f('0x35')]=_0x5480fa[_0xc33f('0x35')]['length']?_0x5480fa[_0xc33f('0x35')]:_0x54ff3e['model'];if(_0x3f9848[_0xc33f('0x31')][_0xc33f('0x40')]){_0x5480fa[_0xc33f('0x41')]=[{'all':!![]}];}_0x5480fa=_[_0xc33f('0x3d')]({},_0x5480fa,_0x3f9848[_0xc33f('0x3f')]);return db['SquareMessage']['find'](_0x5480fa)[_0xc33f('0x24')](handleEntityNotFound(_0x152552,null))['then'](respondWithResult(_0x152552,null))[_0xc33f('0x46')](handleError(_0x152552,null));};exports[_0xc33f('0x47')]=function(_0x3158c7,_0x1401c9){return db[_0xc33f('0x2b')][_0xc33f('0x47')](_0x3158c7[_0xc33f('0x48')],{})['then'](respondWithResult(_0x1401c9,0xc9))[_0xc33f('0x46')](handleError(_0x1401c9,null));};exports[_0xc33f('0x49')]=function(_0x161efb,_0x153e4c){if(_0x161efb[_0xc33f('0x48')]['id']){delete _0x161efb[_0xc33f('0x48')]['id'];}return db[_0xc33f('0x2b')][_0xc33f('0x4a')]({'where':{'id':_0x161efb['params']['id']}})[_0xc33f('0x24')](handleEntityNotFound(_0x153e4c,null))[_0xc33f('0x24')](saveUpdates(_0x161efb[_0xc33f('0x48')],null))[_0xc33f('0x24')](respondWithResult(_0x153e4c,null))['catch'](handleError(_0x153e4c,null));};exports[_0xc33f('0x25')]=function(_0x52a6e2,_0x5318b0){return db[_0xc33f('0x2b')][_0xc33f('0x4a')]({'where':{'id':_0x52a6e2['params']['id']}})[_0xc33f('0x24')](handleEntityNotFound(_0x5318b0,null))['then'](removeEntity(_0x5318b0,null))[_0xc33f('0x46')](handleError(_0x5318b0,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 24331e2..1d1790f 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 _0xd309=['rimraf','../../config/environment','./squareMessage.attributes','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3a3a27,_0x3790b3){var _0x3bd08a=function(_0x157eed){while(--_0x157eed){_0x3a3a27['push'](_0x3a3a27['shift']());}};_0x3bd08a(++_0x3790b3);}(_0xd309,0x19c));var _0x9d30=function(_0x1fc1b5,_0x1f3b67){_0x1fc1b5=_0x1fc1b5-0x0;var _0x985cf2=_0xd309[_0x1fc1b5];return _0x985cf2;};'use strict';var _=require(_0x9d30('0x0'));var util=require(_0x9d30('0x1'));var logger=require(_0x9d30('0x2'))(_0x9d30('0x3'));var moment=require(_0x9d30('0x4'));var BPromise=require(_0x9d30('0x5'));var rp=require(_0x9d30('0x6'));var fs=require('fs');var path=require(_0x9d30('0x7'));var rimraf=require(_0x9d30('0x8'));var config=require(_0x9d30('0x9'));var attributes=require(_0x9d30('0xa'));module['exports']=function(_0x26dcd3,_0x188418){return _0x26dcd3[_0x9d30('0xb')](_0x9d30('0xc'),attributes,{'tableName':_0x9d30('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42c3=['exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird','path','./squareMessage.attributes'];(function(_0x23e544,_0x44b5d8){var _0x141be7=function(_0x1c3af6){while(--_0x1c3af6){_0x23e544['push'](_0x23e544['shift']());}};_0x141be7(++_0x44b5d8);}(_0x42c3,0x1e4));var _0x342c=function(_0x18a412,_0x38f607){_0x18a412=_0x18a412-0x0;var _0x50b676=_0x42c3[_0x18a412];return _0x50b676;};'use strict';var _=require(_0x342c('0x0'));var util=require(_0x342c('0x1'));var logger=require(_0x342c('0x2'))(_0x342c('0x3'));var moment=require(_0x342c('0x4'));var BPromise=require(_0x342c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x342c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x342c('0x7'));module[_0x342c('0x8')]=function(_0x3d2bc8,_0x156f09){return _0x3d2bc8[_0x342c('0x9')](_0x342c('0xa'),attributes,{'tableName':_0x342c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 6024a70..bddcded 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 _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x4d236c,_0x5c20ee){var _0x8b2518=function(_0x3daed4){while(--_0x3daed4){_0x4d236c['push'](_0x4d236c['shift']());}};_0x8b2518(++_0x5c20ee);}(_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 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['CreateSquareMessage']=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')]('CreateSquareMessage',_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 _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x410b05,_0x257a4c){var _0x343ced=function(_0x41cda6){while(--_0x41cda6){_0x410b05['push'](_0x410b05['shift']());}};_0x343ced(++_0x257a4c);}(_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 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['CreateSquareMessage']=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')]('CreateSquareMessage',_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 diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index fbfc21e..4971c3e 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 _0x805d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','isAuthenticated','index','get','/:id','show','/:id/test','15s','test','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x7763d2,_0x534690){var _0x2164ca=function(_0x7050c6){while(--_0x7050c6){_0x7763d2['push'](_0x7763d2['shift']());}};_0x2164ca(++_0x534690);}(_0x805d,0x1a4));var _0xd805=function(_0x279acb,_0x3f1407){_0x279acb=_0x279acb-0x0;var _0x542e38=_0x805d[_0x279acb];return _0x542e38;};'use strict';var multer=require(_0xd805('0x0'));var util=require(_0xd805('0x1'));var path=require(_0xd805('0x2'));var timeout=require(_0xd805('0x3'));var express=require(_0xd805('0x4'));var router=express[_0xd805('0x5')]();var fs_extra=require(_0xd805('0x6'));var auth=require(_0xd805('0x7'));var interaction=require(_0xd805('0x8'));var config=require('../../config/environment');var controller=require(_0xd805('0x9'));router['get']('/',auth[_0xd805('0xa')](),controller[_0xd805('0xb')]);router[_0xd805('0xc')](_0xd805('0xd'),auth['isAuthenticated'](),controller[_0xd805('0xe')]);router['get'](_0xd805('0xf'),auth[_0xd805('0xa')](),timeout(_0xd805('0x10')),controller[_0xd805('0x11')]);router[_0xd805('0x12')]('/',auth[_0xd805('0xa')](),controller[_0xd805('0x13')]);router[_0xd805('0x14')](_0xd805('0xd'),auth[_0xd805('0xa')](),controller[_0xd805('0x15')]);router[_0xd805('0x16')]('/:id',auth[_0xd805('0xa')](),controller[_0xd805('0x17')]);module[_0xd805('0x18')]=router; \ No newline at end of file +var _0xe58e=['put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','15s','test','post'];(function(_0x47e8ec,_0x403570){var _0x58410b=function(_0x682907){while(--_0x682907){_0x47e8ec['push'](_0x47e8ec['shift']());}};_0x58410b(++_0x403570);}(_0xe58e,0x131));var _0xee58=function(_0x15eee8,_0x597fd2){_0x15eee8=_0x15eee8-0x0;var _0x54ebed=_0xe58e[_0x15eee8];return _0x54ebed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee58('0x0'));var timeout=require(_0xee58('0x1'));var express=require(_0xee58('0x2'));var router=express[_0xee58('0x3')]();var fs_extra=require(_0xee58('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xee58('0x5'));var controller=require(_0xee58('0x6'));router[_0xee58('0x7')]('/',auth[_0xee58('0x8')](),controller[_0xee58('0x9')]);router[_0xee58('0x7')](_0xee58('0xa'),auth[_0xee58('0x8')](),controller['show']);router[_0xee58('0x7')](_0xee58('0xb'),auth[_0xee58('0x8')](),timeout(_0xee58('0xc')),controller[_0xee58('0xd')]);router[_0xee58('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xee58('0xf')](_0xee58('0xa'),auth['isAuthenticated'](),controller[_0xee58('0x10')]);router[_0xee58('0x11')]('/:id',auth[_0xee58('0x8')](),controller[_0xee58('0x12')]);module[_0xee58('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 4d95438..be370fb 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 _0xc4e0=['name','exports','STRING'];(function(_0xd77fa2,_0x489a23){var _0x101679=function(_0xebb241){while(--_0xebb241){_0xd77fa2['push'](_0xd77fa2['shift']());}};_0x101679(++_0x489a23);}(_0xc4e0,0x17e));var _0x0c4e=function(_0x482845,_0x4b7551){_0x482845=_0x482845-0x0;var _0x55d43f=_0xc4e0[_0x482845];return _0x55d43f;};'use strict';var Sequelize=require('sequelize');module[_0x0c4e('0x0')]={'name':{'type':Sequelize[_0x0c4e('0x1')],'unique':_0x0c4e('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x0c4e('0x1')]},'description':{'type':Sequelize[_0x0c4e('0x1')]}}; \ No newline at end of file +var _0x7b54=['exports','STRING','name'];(function(_0x571e5c,_0x5e7639){var _0x2bd76e=function(_0x2ddda4){while(--_0x2ddda4){_0x571e5c['push'](_0x571e5c['shift']());}};_0x2bd76e(++_0x5e7639);}(_0x7b54,0x84));var _0x47b5=function(_0x29af39,_0x343c56){_0x29af39=_0x29af39-0x0;var _0x3ab715=_0x7b54[_0x29af39];return _0x3ab715;};'use strict';var Sequelize=require('sequelize');module[_0x47b5('0x0')]={'name':{'type':Sequelize[_0x47b5('0x1')],'unique':_0x47b5('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x47b5('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index ac88edb..41ee8c3 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 _0x7682=['../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','ODBC','UserProfileResource','end','error','name','send','map','SquareOdbc','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','odbc','openSync','dsn','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0xf47dfe,_0x4dd0aa){var _0x5e2daa=function(_0x122b1a){while(--_0x122b1a){_0xf47dfe['push'](_0xf47dfe['shift']());}};_0x5e2daa(++_0x4dd0aa);}(_0x7682,0x8e));var _0x2768=function(_0xab2562,_0x1040ef){_0xab2562=_0xab2562-0x0;var _0x7e8a9a=_0x7682[_0xab2562];return _0x7e8a9a;};'use strict';var emlformat=require(_0x2768('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2768('0x1'));var jsonpatch=require(_0x2768('0x2'));var rp=require(_0x2768('0x3'));var moment=require(_0x2768('0x4'));var BPromise=require(_0x2768('0x5'));var Mustache=require(_0x2768('0x6'));var util=require(_0x2768('0x7'));var path=require(_0x2768('0x8'));var sox=require(_0x2768('0x9'));var csv=require(_0x2768('0xa'));var ejs=require(_0x2768('0xb'));var fs=require('fs');var fs_extra=require(_0x2768('0xc'));var _=require(_0x2768('0xd'));var squel=require(_0x2768('0xe'));var crypto=require('crypto');var jsforce=require(_0x2768('0xf'));var deskjs=require(_0x2768('0x10'));var toCsv=require(_0x2768('0xa'));var querystring=require('querystring');var Papa=require(_0x2768('0x11'));var Redis=require('ioredis');var authService=require(_0x2768('0x12'));var qs=require(_0x2768('0x13'));var as=require(_0x2768('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2768('0x15'))(_0x2768('0x16'));var utils=require(_0x2768('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2768('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5180ae,_0x455bc0){_0x455bc0=_0x455bc0||0xcc;return function(_0x1e6d37){if(_0x1e6d37){return _0x5180ae[_0x2768('0x19')](_0x455bc0);}return _0x5180ae[_0x2768('0x1a')](_0x455bc0)['end']();};}function respondWithResult(_0x2d03a8,_0x1b6233){_0x1b6233=_0x1b6233||0xc8;return function(_0x35339d){if(_0x35339d){return _0x2d03a8[_0x2768('0x1a')](_0x1b6233)[_0x2768('0x1b')](_0x35339d);}};}function respondWithFilteredResult(_0x3ad628,_0x3dbafb){return function(_0x88ae42){if(_0x88ae42){var _0x48c356=typeof _0x3dbafb[_0x2768('0x1c')]===_0x2768('0x1d')&&typeof _0x3dbafb[_0x2768('0x1e')]===_0x2768('0x1d');var _0x56923d=_0x88ae42[_0x2768('0x1f')];var _0x48f3d8=_0x48c356?0x0:_0x3dbafb['offset'];var _0x2b64ec=_0x48c356?_0x88ae42[_0x2768('0x1f')]:_0x3dbafb[_0x2768('0x1c')]+_0x3dbafb[_0x2768('0x1e')];var _0x4f3ec0;if(_0x2b64ec>=_0x56923d){_0x2b64ec=_0x56923d;_0x4f3ec0=0xc8;}else{_0x4f3ec0=0xce;}_0x3ad628[_0x2768('0x1a')](_0x4f3ec0);return _0x3ad628['set'](_0x2768('0x20'),_0x48f3d8+'-'+_0x2b64ec+'/'+_0x56923d)[_0x2768('0x1b')](_0x88ae42);}return null;};}function patchUpdates(_0xf4ed0b){return function(_0x2821ff){try{jsonpatch['apply'](_0x2821ff,_0xf4ed0b,!![]);}catch(_0x4af71e){return BPromise[_0x2768('0x21')](_0x4af71e);}return _0x2821ff[_0x2768('0x22')]();};}function saveUpdates(_0x422b81,_0x24bf48){return function(_0x532369){if(_0x532369){return _0x532369[_0x2768('0x23')](_0x422b81)[_0x2768('0x24')](function(_0x375472){return _0x375472;});}return null;};}function removeEntity(_0x14522d,_0x30ac86){return function(_0xe873c7){if(_0xe873c7){return _0xe873c7[_0x2768('0x25')]()['then'](function(){var _0x34642a=_0xe873c7[_0x2768('0x26')]({'plain':!![]});var _0x3f489d=_0x2768('0x27');return db[_0x2768('0x28')][_0x2768('0x25')]({'where':{'type':_0x3f489d,'resourceId':_0x34642a['id']}})[_0x2768('0x24')](function(){return _0xe873c7;});})[_0x2768('0x24')](function(){_0x14522d[_0x2768('0x1a')](0xcc)[_0x2768('0x29')]();});}};}function handleEntityNotFound(_0x58e1ad,_0x1f0d30){return function(_0x46ff49){if(!_0x46ff49){_0x58e1ad[_0x2768('0x19')](0x194);}return _0x46ff49;};}function handleError(_0x54d260,_0x4a70e5){_0x4a70e5=_0x4a70e5||0x1f4;return function(_0x1be447){logger[_0x2768('0x2a')](_0x1be447['stack']);if(_0x1be447[_0x2768('0x2b')]){delete _0x1be447[_0x2768('0x2b')];}_0x54d260[_0x2768('0x1a')](_0x4a70e5)[_0x2768('0x2c')](_0x1be447);};}exports['index']=function(_0x187b39,_0xf088a9){var _0xa1d1dd={},_0x38900e={},_0x32cb7a={'count':0x0,'rows':[]};var _0x5973cf=_[_0x2768('0x2d')](db[_0x2768('0x2e')][_0x2768('0x2f')],function(_0x37c98d){return{'name':_0x37c98d[_0x2768('0x30')],'type':_0x37c98d[_0x2768('0x31')]['key']};});_0x38900e[_0x2768('0x32')]=_[_0x2768('0x2d')](_0x5973cf,_0x2768('0x2b'));_0x38900e[_0x2768('0x33')]=_['keys'](_0x187b39['query']);_0x38900e[_0x2768('0x34')]=_[_0x2768('0x35')](_0x38900e[_0x2768('0x32')],_0x38900e[_0x2768('0x33')]);_0xa1d1dd[_0x2768('0x36')]=_[_0x2768('0x35')](_0x38900e[_0x2768('0x32')],qs[_0x2768('0x37')](_0x187b39[_0x2768('0x33')]['fields']));_0xa1d1dd[_0x2768('0x36')]=_0xa1d1dd[_0x2768('0x36')][_0x2768('0x38')]?_0xa1d1dd[_0x2768('0x36')]:_0x38900e[_0x2768('0x32')];if(!_0x187b39['query'][_0x2768('0x39')](_0x2768('0x3a'))){_0xa1d1dd['limit']=qs['limit'](_0x187b39[_0x2768('0x33')][_0x2768('0x1e')]);_0xa1d1dd['offset']=qs['offset'](_0x187b39[_0x2768('0x33')][_0x2768('0x1c')]);}_0xa1d1dd['order']=qs['sort'](_0x187b39[_0x2768('0x33')]['sort']);_0xa1d1dd[_0x2768('0x3b')]=qs[_0x2768('0x34')](_[_0x2768('0x3c')](_0x187b39[_0x2768('0x33')],_0x38900e[_0x2768('0x34')]),_0x5973cf);if(_0x187b39[_0x2768('0x33')][_0x2768('0x3d')]){_0xa1d1dd['where']=_[_0x2768('0x3e')](_0xa1d1dd[_0x2768('0x3b')],{'$or':_[_0x2768('0x2d')](_0x5973cf,function(_0x1776d5){if(_0x1776d5[_0x2768('0x31')]!==_0x2768('0x3f')){var _0xd9e245={};_0xd9e245[_0x1776d5['name']]={'$like':'%'+_0x187b39[_0x2768('0x33')][_0x2768('0x3d')]+'%'};return _0xd9e245;}})});}_0xa1d1dd=_[_0x2768('0x3e')]({},_0xa1d1dd,_0x187b39[_0x2768('0x40')]);var _0x13f228={'where':_0xa1d1dd[_0x2768('0x3b')]};return db[_0x2768('0x2e')]['count'](_0x13f228)['then'](function(_0x3ee9ae){_0x32cb7a['count']=_0x3ee9ae;if(_0x187b39['query']['includeAll']){_0xa1d1dd[_0x2768('0x41')]=[{'all':!![]}];}return db[_0x2768('0x2e')][_0x2768('0x42')](_0xa1d1dd);})[_0x2768('0x24')](function(_0x513392){_0x32cb7a[_0x2768('0x43')]=_0x513392;return _0x32cb7a;})['then'](respondWithFilteredResult(_0xf088a9,_0xa1d1dd))['catch'](handleError(_0xf088a9,null));};exports[_0x2768('0x44')]=function(_0x2d7031,_0x46822e){var _0x56869e={'raw':!![],'where':{'id':_0x2d7031[_0x2768('0x45')]['id']}},_0x3828ba={};_0x3828ba[_0x2768('0x32')]=_[_0x2768('0x46')](db[_0x2768('0x2e')]['rawAttributes']);_0x3828ba[_0x2768('0x33')]=_['keys'](_0x2d7031[_0x2768('0x33')]);_0x3828ba['filters']=_['intersection'](_0x3828ba[_0x2768('0x32')],_0x3828ba['query']);_0x56869e[_0x2768('0x36')]=_['intersection'](_0x3828ba['model'],qs[_0x2768('0x37')](_0x2d7031[_0x2768('0x33')][_0x2768('0x37')]));_0x56869e[_0x2768('0x36')]=_0x56869e[_0x2768('0x36')][_0x2768('0x38')]?_0x56869e['attributes']:_0x3828ba[_0x2768('0x32')];if(_0x2d7031[_0x2768('0x33')]['includeAll']){_0x56869e['include']=[{'all':!![]}];}_0x56869e=_[_0x2768('0x3e')]({},_0x56869e,_0x2d7031[_0x2768('0x40')]);return db[_0x2768('0x2e')][_0x2768('0x47')](_0x56869e)[_0x2768('0x24')](handleEntityNotFound(_0x46822e,null))[_0x2768('0x24')](respondWithResult(_0x46822e,null))[_0x2768('0x48')](handleError(_0x46822e,null));};exports['create']=function(_0x3dbdb0,_0x5d77ff){return db['SquareOdbc'][_0x2768('0x49')](_0x3dbdb0[_0x2768('0x4a')],{})[_0x2768('0x24')](function(_0x4b95bd){var _0x3a256f=_0x3dbdb0[_0x2768('0x4b')][_0x2768('0x26')]({'plain':!![]});if(!_0x3a256f)throw new Error(_0x2768('0x4c'));if(_0x3a256f['role']==='user'){var _0x3dec1f=_0x4b95bd[_0x2768('0x26')]({'plain':!![]});var _0x23887e=_0x2768('0x27');return db['UserProfileSection'][_0x2768('0x47')]({'where':{'name':_0x23887e,'userProfileId':_0x3a256f[_0x2768('0x4d')]},'raw':!![]})[_0x2768('0x24')](function(_0x21bc01){if(_0x21bc01&&_0x21bc01['autoAssociation']===0x0){return db[_0x2768('0x28')][_0x2768('0x49')]({'name':_0x3dec1f[_0x2768('0x2b')],'resourceId':_0x3dec1f['id'],'type':_0x21bc01[_0x2768('0x2b')],'sectionId':_0x21bc01['id']},{})[_0x2768('0x24')](function(){return _0x4b95bd;});}else{return _0x4b95bd;}})[_0x2768('0x48')](function(_0x367759){logger[_0x2768('0x2a')](_0x2768('0x4e'),_0x367759);throw _0x367759;});}return _0x4b95bd;})[_0x2768('0x24')](respondWithResult(_0x5d77ff,0xc9))[_0x2768('0x48')](handleError(_0x5d77ff,null));};exports['update']=function(_0x3268a3,_0x236ae6){if(_0x3268a3[_0x2768('0x4a')]['id']){delete _0x3268a3['body']['id'];}return db[_0x2768('0x2e')][_0x2768('0x47')]({'where':{'id':_0x3268a3[_0x2768('0x45')]['id']}})[_0x2768('0x24')](handleEntityNotFound(_0x236ae6,null))[_0x2768('0x24')](saveUpdates(_0x3268a3['body'],null))[_0x2768('0x24')](respondWithResult(_0x236ae6,null))[_0x2768('0x48')](handleError(_0x236ae6,null));};exports['destroy']=function(_0x6a43d,_0x45fb86){return db[_0x2768('0x2e')][_0x2768('0x47')]({'where':{'id':_0x6a43d['params']['id']}})[_0x2768('0x24')](handleEntityNotFound(_0x45fb86,null))[_0x2768('0x24')](removeEntity(_0x45fb86,null))[_0x2768('0x48')](handleError(_0x45fb86,null));};exports['test']=function(_0x385399,_0x3623f6,_0x241eb5){var _0x2ae66c;return db[_0x2768('0x2e')][_0x2768('0x47')]({'where':{'id':_0x385399[_0x2768('0x45')]['id']},'attributes':['id','dsn']})[_0x2768('0x24')](handleEntityNotFound(_0x3623f6,null))[_0x2768('0x24')](function(_0x4dac4e){if(_0x4dac4e){var _0x3bb5d6=require(_0x2768('0x4f'))();_0x3bb5d6[_0x2768('0x50')](_0x4dac4e[_0x2768('0x51')]);_0x3bb5d6[_0x2768('0x52')]();return _0x4dac4e;}})[_0x2768('0x24')](respondWithResult(_0x3623f6,null))['catch'](handleError(_0x3623f6,null));}; \ No newline at end of file +var _0xfaca=['util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','SquareOdbc','findAll','catch','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','test','odbc','openSync','dsn','closeSync','eml-format','rimraf','request-promise','moment','bluebird','mustache'];(function(_0x54d3a3,_0x35b2d7){var _0x456ba7=function(_0x80f5f7){while(--_0x80f5f7){_0x54d3a3['push'](_0x54d3a3['shift']());}};_0x456ba7(++_0x35b2d7);}(_0xfaca,0x152));var _0xafac=function(_0xf81fcf,_0x4cfe28){_0xf81fcf=_0xf81fcf-0x0;var _0x5eae31=_0xfaca[_0xf81fcf];return _0x5eae31;};'use strict';var emlformat=require(_0xafac('0x0'));var rimraf=require(_0xafac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xafac('0x2'));var moment=require(_0xafac('0x3'));var BPromise=require(_0xafac('0x4'));var Mustache=require(_0xafac('0x5'));var util=require(_0xafac('0x6'));var path=require(_0xafac('0x7'));var sox=require(_0xafac('0x8'));var csv=require(_0xafac('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xafac('0xa'));var _=require(_0xafac('0xb'));var squel=require(_0xafac('0xc'));var crypto=require('crypto');var jsforce=require(_0xafac('0xd'));var deskjs=require(_0xafac('0xe'));var toCsv=require('to-csv');var querystring=require(_0xafac('0xf'));var Papa=require(_0xafac('0x10'));var Redis=require(_0xafac('0x11'));var authService=require(_0xafac('0x12'));var qs=require(_0xafac('0x13'));var as=require(_0xafac('0x14'));var hardwareService=require(_0xafac('0x15'));var logger=require('../../config/logger')(_0xafac('0x16'));var utils=require('../../config/utils');var config=require(_0xafac('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xafac('0x18'))['db'];function respondWithStatusCode(_0x285341,_0x1343bd){_0x1343bd=_0x1343bd||0xcc;return function(_0xe54898){if(_0xe54898){return _0x285341[_0xafac('0x19')](_0x1343bd);}return _0x285341[_0xafac('0x1a')](_0x1343bd)[_0xafac('0x1b')]();};}function respondWithResult(_0x1ba5c1,_0x425c8b){_0x425c8b=_0x425c8b||0xc8;return function(_0xba0e43){if(_0xba0e43){return _0x1ba5c1[_0xafac('0x1a')](_0x425c8b)[_0xafac('0x1c')](_0xba0e43);}};}function respondWithFilteredResult(_0x1070ed,_0x59026f){return function(_0x134ebd){if(_0x134ebd){var _0x142265=typeof _0x59026f[_0xafac('0x1d')]===_0xafac('0x1e')&&typeof _0x59026f[_0xafac('0x1f')]==='undefined';var _0x30198c=_0x134ebd[_0xafac('0x20')];var _0x4797b1=_0x142265?0x0:_0x59026f[_0xafac('0x1d')];var _0x1bc85a=_0x142265?_0x134ebd[_0xafac('0x20')]:_0x59026f['offset']+_0x59026f['limit'];var _0x212da8;if(_0x1bc85a>=_0x30198c){_0x1bc85a=_0x30198c;_0x212da8=0xc8;}else{_0x212da8=0xce;}_0x1070ed[_0xafac('0x1a')](_0x212da8);return _0x1070ed[_0xafac('0x21')](_0xafac('0x22'),_0x4797b1+'-'+_0x1bc85a+'/'+_0x30198c)[_0xafac('0x1c')](_0x134ebd);}return null;};}function patchUpdates(_0x5127cd){return function(_0xacf40e){try{jsonpatch[_0xafac('0x23')](_0xacf40e,_0x5127cd,!![]);}catch(_0x50e743){return BPromise['reject'](_0x50e743);}return _0xacf40e[_0xafac('0x24')]();};}function saveUpdates(_0x132e23,_0xd881ef){return function(_0x9d005d){if(_0x9d005d){return _0x9d005d[_0xafac('0x25')](_0x132e23)[_0xafac('0x26')](function(_0x236d75){return _0x236d75;});}return null;};}function removeEntity(_0x16352e,_0x55b0ab){return function(_0x1c57f8){if(_0x1c57f8){return _0x1c57f8[_0xafac('0x27')]()['then'](function(){var _0x3bcbdd=_0x1c57f8[_0xafac('0x28')]({'plain':!![]});var _0x15f95f=_0xafac('0x29');return db[_0xafac('0x2a')][_0xafac('0x27')]({'where':{'type':_0x15f95f,'resourceId':_0x3bcbdd['id']}})[_0xafac('0x26')](function(){return _0x1c57f8;});})[_0xafac('0x26')](function(){_0x16352e[_0xafac('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x304c90,_0x5a5ef0){return function(_0x524edb){if(!_0x524edb){_0x304c90[_0xafac('0x19')](0x194);}return _0x524edb;};}function handleError(_0x5248b5,_0x30b1d5){_0x30b1d5=_0x30b1d5||0x1f4;return function(_0x3056c9){logger[_0xafac('0x2b')](_0x3056c9[_0xafac('0x2c')]);if(_0x3056c9[_0xafac('0x2d')]){delete _0x3056c9['name'];}_0x5248b5[_0xafac('0x1a')](_0x30b1d5)[_0xafac('0x2e')](_0x3056c9);};}exports['index']=function(_0x599fba,_0x18b00a){var _0xbade1={},_0xbeb190={},_0x3a1157={'count':0x0,'rows':[]};var _0x166478=_[_0xafac('0x2f')](db['SquareOdbc'][_0xafac('0x30')],function(_0x2be897){return{'name':_0x2be897[_0xafac('0x31')],'type':_0x2be897['type'][_0xafac('0x32')]};});_0xbeb190['model']=_[_0xafac('0x2f')](_0x166478,'name');_0xbeb190[_0xafac('0x33')]=_[_0xafac('0x34')](_0x599fba['query']);_0xbeb190[_0xafac('0x35')]=_[_0xafac('0x36')](_0xbeb190[_0xafac('0x37')],_0xbeb190['query']);_0xbade1[_0xafac('0x38')]=_[_0xafac('0x36')](_0xbeb190[_0xafac('0x37')],qs[_0xafac('0x39')](_0x599fba[_0xafac('0x33')]['fields']));_0xbade1[_0xafac('0x38')]=_0xbade1[_0xafac('0x38')][_0xafac('0x3a')]?_0xbade1[_0xafac('0x38')]:_0xbeb190['model'];if(!_0x599fba[_0xafac('0x33')][_0xafac('0x3b')](_0xafac('0x3c'))){_0xbade1[_0xafac('0x1f')]=qs[_0xafac('0x1f')](_0x599fba[_0xafac('0x33')]['limit']);_0xbade1[_0xafac('0x1d')]=qs['offset'](_0x599fba['query'][_0xafac('0x1d')]);}_0xbade1['order']=qs[_0xafac('0x3d')](_0x599fba[_0xafac('0x33')][_0xafac('0x3d')]);_0xbade1[_0xafac('0x3e')]=qs[_0xafac('0x35')](_[_0xafac('0x3f')](_0x599fba[_0xafac('0x33')],_0xbeb190[_0xafac('0x35')]),_0x166478);if(_0x599fba[_0xafac('0x33')][_0xafac('0x40')]){_0xbade1['where']=_[_0xafac('0x41')](_0xbade1[_0xafac('0x3e')],{'$or':_['map'](_0x166478,function(_0x536d6d){if(_0x536d6d[_0xafac('0x42')]!=='VIRTUAL'){var _0x45ab11={};_0x45ab11[_0x536d6d[_0xafac('0x2d')]]={'$like':'%'+_0x599fba['query'][_0xafac('0x40')]+'%'};return _0x45ab11;}})});}_0xbade1=_[_0xafac('0x41')]({},_0xbade1,_0x599fba[_0xafac('0x43')]);var _0x561033={'where':_0xbade1[_0xafac('0x3e')]};return db[_0xafac('0x44')][_0xafac('0x20')](_0x561033)[_0xafac('0x26')](function(_0x30f846){_0x3a1157['count']=_0x30f846;if(_0x599fba[_0xafac('0x33')]['includeAll']){_0xbade1['include']=[{'all':!![]}];}return db[_0xafac('0x44')][_0xafac('0x45')](_0xbade1);})[_0xafac('0x26')](function(_0x356fe7){_0x3a1157['rows']=_0x356fe7;return _0x3a1157;})[_0xafac('0x26')](respondWithFilteredResult(_0x18b00a,_0xbade1))[_0xafac('0x46')](handleError(_0x18b00a,null));};exports['show']=function(_0x4c7415,_0x3ad299){var _0x557cf7={'raw':!![],'where':{'id':_0x4c7415['params']['id']}},_0x15ff20={};_0x15ff20[_0xafac('0x37')]=_[_0xafac('0x34')](db[_0xafac('0x44')]['rawAttributes']);_0x15ff20['query']=_[_0xafac('0x34')](_0x4c7415[_0xafac('0x33')]);_0x15ff20[_0xafac('0x35')]=_[_0xafac('0x36')](_0x15ff20[_0xafac('0x37')],_0x15ff20[_0xafac('0x33')]);_0x557cf7[_0xafac('0x38')]=_[_0xafac('0x36')](_0x15ff20[_0xafac('0x37')],qs[_0xafac('0x39')](_0x4c7415[_0xafac('0x33')][_0xafac('0x39')]));_0x557cf7[_0xafac('0x38')]=_0x557cf7[_0xafac('0x38')][_0xafac('0x3a')]?_0x557cf7[_0xafac('0x38')]:_0x15ff20['model'];if(_0x4c7415[_0xafac('0x33')][_0xafac('0x47')]){_0x557cf7['include']=[{'all':!![]}];}_0x557cf7=_['merge']({},_0x557cf7,_0x4c7415[_0xafac('0x43')]);return db[_0xafac('0x44')]['find'](_0x557cf7)[_0xafac('0x26')](handleEntityNotFound(_0x3ad299,null))[_0xafac('0x26')](respondWithResult(_0x3ad299,null))[_0xafac('0x46')](handleError(_0x3ad299,null));};exports[_0xafac('0x48')]=function(_0x31a426,_0x4e8abd){return db['SquareOdbc'][_0xafac('0x48')](_0x31a426['body'],{})[_0xafac('0x26')](function(_0x476625){var _0x15df26=_0x31a426[_0xafac('0x49')][_0xafac('0x28')]({'plain':!![]});if(!_0x15df26)throw new Error(_0xafac('0x4a'));if(_0x15df26['role']==='user'){var _0x14466b=_0x476625[_0xafac('0x28')]({'plain':!![]});var _0x40a8aa=_0xafac('0x29');return db['UserProfileSection'][_0xafac('0x4b')]({'where':{'name':_0x40a8aa,'userProfileId':_0x15df26[_0xafac('0x4c')]},'raw':!![]})[_0xafac('0x26')](function(_0x474897){if(_0x474897&&_0x474897[_0xafac('0x4d')]===0x0){return db[_0xafac('0x2a')][_0xafac('0x48')]({'name':_0x14466b[_0xafac('0x2d')],'resourceId':_0x14466b['id'],'type':_0x474897[_0xafac('0x2d')],'sectionId':_0x474897['id']},{})[_0xafac('0x26')](function(){return _0x476625;});}else{return _0x476625;}})['catch'](function(_0x3940b5){logger[_0xafac('0x2b')](_0xafac('0x4e'),_0x3940b5);throw _0x3940b5;});}return _0x476625;})['then'](respondWithResult(_0x4e8abd,0xc9))[_0xafac('0x46')](handleError(_0x4e8abd,null));};exports[_0xafac('0x25')]=function(_0x7b703d,_0x21da00){if(_0x7b703d[_0xafac('0x4f')]['id']){delete _0x7b703d[_0xafac('0x4f')]['id'];}return db[_0xafac('0x44')][_0xafac('0x4b')]({'where':{'id':_0x7b703d[_0xafac('0x50')]['id']}})['then'](handleEntityNotFound(_0x21da00,null))[_0xafac('0x26')](saveUpdates(_0x7b703d['body'],null))[_0xafac('0x26')](respondWithResult(_0x21da00,null))['catch'](handleError(_0x21da00,null));};exports[_0xafac('0x27')]=function(_0x563684,_0x3a8bfe){return db[_0xafac('0x44')][_0xafac('0x4b')]({'where':{'id':_0x563684[_0xafac('0x50')]['id']}})[_0xafac('0x26')](handleEntityNotFound(_0x3a8bfe,null))[_0xafac('0x26')](removeEntity(_0x3a8bfe,null))[_0xafac('0x46')](handleError(_0x3a8bfe,null));};exports[_0xafac('0x51')]=function(_0xf37927,_0x57a03e,_0x5ca0f2){var _0x39a72a;return db[_0xafac('0x44')][_0xafac('0x4b')]({'where':{'id':_0xf37927[_0xafac('0x50')]['id']},'attributes':['id','dsn']})[_0xafac('0x26')](handleEntityNotFound(_0x57a03e,null))['then'](function(_0x42b96c){if(_0x42b96c){var _0x579994=require(_0xafac('0x52'))();_0x579994[_0xafac('0x53')](_0x42b96c[_0xafac('0x54')]);_0x579994[_0xafac('0x55')]();return _0x42b96c;}})[_0xafac('0x26')](respondWithResult(_0x57a03e,null))['catch'](handleError(_0x57a03e,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 9568e43..58e1630 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 _0x9421=['./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x34880c,_0x4533fe){var _0x3ee14b=function(_0x4893e2){while(--_0x4893e2){_0x34880c['push'](_0x34880c['shift']());}};_0x3ee14b(++_0x4533fe);}(_0x9421,0x155));var _0x1942=function(_0x2f9e6c,_0x2d85db){_0x2f9e6c=_0x2f9e6c-0x0;var _0xc246e6=_0x9421[_0x2f9e6c];return _0xc246e6;};'use strict';var _=require(_0x1942('0x0'));var util=require(_0x1942('0x1'));var logger=require(_0x1942('0x2'))(_0x1942('0x3'));var moment=require(_0x1942('0x4'));var BPromise=require('bluebird');var rp=require(_0x1942('0x5'));var fs=require('fs');var path=require(_0x1942('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1942('0x7'));module[_0x1942('0x8')]=function(_0x2db4b5,_0x5c4801){return _0x2db4b5[_0x1942('0x9')](_0x1942('0xa'),attributes,{'tableName':_0x1942('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8469=['request-promise','path','rimraf','../../config/environment','exports','define','SquareOdbc','square_odbc','util','moment','bluebird'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x8469,0xd9));var _0x9846=function(_0x13ff53,_0x5e1424){_0x13ff53=_0x13ff53-0x0;var _0x290228=_0x8469[_0x13ff53];return _0x290228;};'use strict';var _=require('lodash');var util=require(_0x9846('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9846('0x1'));var BPromise=require(_0x9846('0x2'));var rp=require(_0x9846('0x3'));var fs=require('fs');var path=require(_0x9846('0x4'));var rimraf=require(_0x9846('0x5'));var config=require(_0x9846('0x6'));var attributes=require('./squareOdbc.attributes');module[_0x9846('0x7')]=function(_0x38e089,_0x5c4557){return _0x38e089[_0x9846('0x8')](_0x9846('0x9'),attributes,{'tableName':_0x9846('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 4fafd0e..adb82e5 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 _0x7217=['where','attributes','map','include','model','ShowSquareOdbc','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw'];(function(_0x388010,_0xd689a8){var _0x48aaff=function(_0x1417c9){while(--_0x1417c9){_0x388010['push'](_0x388010['shift']());}};_0x48aaff(++_0xd689a8);}(_0x7217,0x19e));var _0x7721=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x7217[_0x5447fd];return _0x15b28a;};'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')]('SquareOdbc,\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']('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowSquareOdbc']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowSquareOdbc',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file +var _0x008c=['stringify','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','find','options','include','map','attributes','model','then'];(function(_0x515640,_0x27b10e){var _0x5328b=function(_0x25bb4a){while(--_0x25bb4a){_0x515640['push'](_0x515640['shift']());}};_0x5328b(++_0x27b10e);}(_0x008c,0x188));var _0xc008=function(_0x161ac3,_0x142e49){_0x161ac3=_0x161ac3-0x0;var _0x3bb837=_0x008c[_0x161ac3];return _0x3bb837;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['ShowSquareOdbc']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareOdbc'][_0xc008('0x15')]({'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![],'where':_0x540e45['options']?_0x540e45[_0xc008('0x16')]['where']||null:null,'attributes':_0x540e45['options']?_0x540e45['options']['attributes']||null:null,'include':_0x540e45['options']?_0x540e45[_0xc008('0x16')][_0xc008('0x17')]?_[_0xc008('0x18')](_0x540e45[_0xc008('0x16')][_0xc008('0x17')],function(_0x110128){return{'model':db[_0x110128['model']],'as':_0x110128['as'],'attributes':_0x110128[_0xc008('0x19')],'include':_0x110128['include']?_['map'](_0x110128[_0xc008('0x17')],function(_0x36f358){return{'model':db[_0x36f358[_0xc008('0x1a')]],'as':_0x36f358['as'],'attributes':_0x36f358[_0xc008('0x19')],'include':_0x36f358['include']?_['map'](_0x36f358['include'],function(_0x3f7b07){return{'model':db[_0x3f7b07[_0xc008('0x1a')]],'as':_0x3f7b07['as'],'attributes':_0x3f7b07[_0xc008('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc008('0x1b')](function(_0x5bebd9){logger['info']('ShowSquareOdbc',_0x540e45);logger['debug']('ShowSquareOdbc',_0x540e45,JSON[_0xc008('0x1c')](_0x5bebd9));_0x46042b(_0x5bebd9);})[_0xc008('0x14')](function(_0x25eae4){logger['error'](_0xc008('0x1d'),_0x25eae4[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668[_0xc008('0x10')](0x1f4,_0x25eae4[_0xc008('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 9e95f34..334e26b 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 _0x8848=['delete','destroy','removeUsers','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','index','/:id','isAuthenticated','show','/:id/users','getUsers','post','addUsers','put','update'];(function(_0x329664,_0x130748){var _0x4e346e=function(_0x172b0d){while(--_0x172b0d){_0x329664['push'](_0x329664['shift']());}};_0x4e346e(++_0x130748);}(_0x8848,0x94));var _0x8884=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x8848[_0x1203f];return _0x365f0a;};'use strict';var multer=require('multer');var util=require(_0x8884('0x0'));var path=require(_0x8884('0x1'));var timeout=require(_0x8884('0x2'));var express=require(_0x8884('0x3'));var router=express['Router']();var fs_extra=require(_0x8884('0x4'));var auth=require(_0x8884('0x5'));var interaction=require(_0x8884('0x6'));var config=require(_0x8884('0x7'));var controller=require(_0x8884('0x8'));router[_0x8884('0x9')]('/',auth['isAuthenticated'](),controller[_0x8884('0xa')]);router['get'](_0x8884('0xb'),auth[_0x8884('0xc')](),controller[_0x8884('0xd')]);router['get'](_0x8884('0xe'),auth[_0x8884('0xc')](),controller[_0x8884('0xf')]);router[_0x8884('0x10')]('/',auth[_0x8884('0xc')](),controller['create']);router[_0x8884('0x10')](_0x8884('0xe'),auth[_0x8884('0xc')](),controller[_0x8884('0x11')]);router[_0x8884('0x12')](_0x8884('0xb'),auth[_0x8884('0xc')](),controller[_0x8884('0x13')]);router[_0x8884('0x14')]('/:id',auth[_0x8884('0xc')](),controller[_0x8884('0x15')]);router[_0x8884('0x14')](_0x8884('0xe'),auth['isAuthenticated'](),controller[_0x8884('0x16')]);module[_0x8884('0x17')]=router; \ No newline at end of file +var _0x3fe2=['getUsers','post','create','/:id/users','addUsers','put','update','delete','destroy','removeUsers','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','get','index','/:id','isAuthenticated'];(function(_0x3211b7,_0x4b7e04){var _0xd4fea2=function(_0x4e9e05){while(--_0x4e9e05){_0x3211b7['push'](_0x3211b7['shift']());}};_0xd4fea2(++_0x4b7e04);}(_0x3fe2,0x173));var _0x23fe=function(_0x3b8fc3,_0x2ae5ff){_0x3b8fc3=_0x3b8fc3-0x0;var _0x4d7512=_0x3fe2[_0x3b8fc3];return _0x4d7512;};'use strict';var multer=require(_0x23fe('0x0'));var util=require('util');var path=require(_0x23fe('0x1'));var timeout=require(_0x23fe('0x2'));var express=require(_0x23fe('0x3'));var router=express[_0x23fe('0x4')]();var fs_extra=require(_0x23fe('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x23fe('0x6'));var config=require(_0x23fe('0x7'));var controller=require(_0x23fe('0x8'));router[_0x23fe('0x9')]('/',auth['isAuthenticated'](),controller[_0x23fe('0xa')]);router[_0x23fe('0x9')](_0x23fe('0xb'),auth[_0x23fe('0xc')](),controller['show']);router[_0x23fe('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x23fe('0xd')]);router[_0x23fe('0xe')]('/',auth['isAuthenticated'](),controller[_0x23fe('0xf')]);router[_0x23fe('0xe')](_0x23fe('0x10'),auth[_0x23fe('0xc')](),controller[_0x23fe('0x11')]);router[_0x23fe('0x12')](_0x23fe('0xb'),auth['isAuthenticated'](),controller[_0x23fe('0x13')]);router[_0x23fe('0x14')]('/:id',auth[_0x23fe('0xc')](),controller[_0x23fe('0x15')]);router[_0x23fe('0x14')](_0x23fe('0x10'),auth[_0x23fe('0xc')](),controller[_0x23fe('0x16')]);module[_0x23fe('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 3d5ec76..a4461bf 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 _0x3c29=['preproduction','toString','utf8','production','DATE','sequelize','exports','STRING','TEXT','BLOB','long','getDataValue'];(function(_0x5d9867,_0x5e9030){var _0x7d2118=function(_0x2e5149){while(--_0x2e5149){_0x5d9867['push'](_0x5d9867['shift']());}};_0x7d2118(++_0x5e9030);}(_0x3c29,0x16d));var _0x93c2=function(_0xb9062f,_0x5b4b7f){_0xb9062f=_0xb9062f-0x0;var _0x4ca05e=_0x3c29[_0xb9062f];return _0x4ca05e;};'use strict';var Sequelize=require(_0x93c2('0x0'));module[_0x93c2('0x1')]={'name':{'type':Sequelize[_0x93c2('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x93c2('0x2')]},'notes':{'type':Sequelize[_0x93c2('0x3')]},'preproduction':{'type':Sequelize[_0x93c2('0x4')](_0x93c2('0x5')),'get':function(){if(this[_0x93c2('0x6')](_0x93c2('0x7'))){return this[_0x93c2('0x6')]('preproduction')[_0x93c2('0x8')](_0x93c2('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x93c2('0x5')),'get':function(){if(this[_0x93c2('0x6')](_0x93c2('0xa'))){return this['getDataValue']('production')[_0x93c2('0x8')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x93c2('0xb')]}}; \ No newline at end of file +var _0xa25d=['DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production'];(function(_0x4cbfbb,_0x12dccf){var _0x1d0435=function(_0x61d82f){while(--_0x61d82f){_0x4cbfbb['push'](_0x4cbfbb['shift']());}};_0x1d0435(++_0x12dccf);}(_0xa25d,0x194));var _0xda25=function(_0x6b23f3,_0x4189c9){_0x6b23f3=_0x6b23f3-0x0;var _0x473e8f=_0xa25d[_0x6b23f3];return _0x473e8f;};'use strict';var Sequelize=require(_0xda25('0x0'));module[_0xda25('0x1')]={'name':{'type':Sequelize[_0xda25('0x2')],'unique':_0xda25('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xda25('0x2')]},'notes':{'type':Sequelize[_0xda25('0x4')]},'preproduction':{'type':Sequelize[_0xda25('0x5')](_0xda25('0x6')),'get':function(){if(this[_0xda25('0x7')](_0xda25('0x8'))){return this[_0xda25('0x7')](_0xda25('0x8'))[_0xda25('0x9')](_0xda25('0xa'));}}},'production':{'type':Sequelize[_0xda25('0x5')](_0xda25('0x6')),'get':function(){if(this[_0xda25('0x7')](_0xda25('0xb'))){return this[_0xda25('0x7')]('production')['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0xda25('0xc')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 23caf3d..2529f40 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 _0xac66=['findAll','rows','catch','show','rawAttributes','length','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addUsers','ids','omit','isArray','emit','userSquareProject:remove','getUsers','findOne','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','./squareProject.socket','sendStatus','status','json','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','end','name','index','map','SquareProject','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include'];(function(_0x512f81,_0x4a7986){var _0xa15099=function(_0x1f7371){while(--_0x1f7371){_0x512f81['push'](_0x512f81['shift']());}};_0xa15099(++_0x4a7986);}(_0xac66,0x13f));var _0x6ac6=function(_0x136f80,_0x2fed66){_0x136f80=_0x136f80-0x0;var _0x5e5f5e=_0xac66[_0x136f80];return _0x5e5f5e;};'use strict';var emlformat=require(_0x6ac6('0x0'));var rimraf=require(_0x6ac6('0x1'));var zipdir=require(_0x6ac6('0x2'));var jsonpatch=require(_0x6ac6('0x3'));var rp=require(_0x6ac6('0x4'));var moment=require(_0x6ac6('0x5'));var BPromise=require(_0x6ac6('0x6'));var Mustache=require(_0x6ac6('0x7'));var util=require(_0x6ac6('0x8'));var path=require('path');var sox=require(_0x6ac6('0x9'));var csv=require(_0x6ac6('0xa'));var ejs=require(_0x6ac6('0xb'));var fs=require('fs');var fs_extra=require(_0x6ac6('0xc'));var _=require(_0x6ac6('0xd'));var squel=require(_0x6ac6('0xe'));var crypto=require(_0x6ac6('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x6ac6('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6ac6('0x11'));var Papa=require(_0x6ac6('0x12'));var Redis=require('ioredis');var authService=require(_0x6ac6('0x13'));var qs=require(_0x6ac6('0x14'));var as=require(_0x6ac6('0x15'));var hardwareService=require(_0x6ac6('0x16'));var logger=require(_0x6ac6('0x17'))(_0x6ac6('0x18'));var utils=require('../../config/utils');var config=require(_0x6ac6('0x19'));var licenseUtil=require(_0x6ac6('0x1a'));var db=require('../../mysqldb')['db'];config[_0x6ac6('0x1b')]=_[_0x6ac6('0x1c')](config[_0x6ac6('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6ac6('0x1d'))['register'](socket);function respondWithStatusCode(_0x1e7357,_0x58fd12){_0x58fd12=_0x58fd12||0xcc;return function(_0x2f3f9e){if(_0x2f3f9e){return _0x1e7357[_0x6ac6('0x1e')](_0x58fd12);}return _0x1e7357[_0x6ac6('0x1f')](_0x58fd12)['end']();};}function respondWithResult(_0x22bcc1,_0x599cec){_0x599cec=_0x599cec||0xc8;return function(_0x32dd74){if(_0x32dd74){return _0x22bcc1[_0x6ac6('0x1f')](_0x599cec)[_0x6ac6('0x20')](_0x32dd74);}};}function respondWithFilteredResult(_0x268deb,_0x2221c9){return function(_0x139c5d){if(_0x139c5d){var _0x3a338c=typeof _0x2221c9['offset']===_0x6ac6('0x21')&&typeof _0x2221c9['limit']==='undefined';var _0x4a134b=_0x139c5d['count'];var _0x54dfe4=_0x3a338c?0x0:_0x2221c9[_0x6ac6('0x22')];var _0x1b68d4=_0x3a338c?_0x139c5d[_0x6ac6('0x23')]:_0x2221c9[_0x6ac6('0x22')]+_0x2221c9['limit'];var _0x348341;if(_0x1b68d4>=_0x4a134b){_0x1b68d4=_0x4a134b;_0x348341=0xc8;}else{_0x348341=0xce;}_0x268deb['status'](_0x348341);return _0x268deb[_0x6ac6('0x24')](_0x6ac6('0x25'),_0x54dfe4+'-'+_0x1b68d4+'/'+_0x4a134b)['json'](_0x139c5d);}return null;};}function patchUpdates(_0x5d1b3b){return function(_0x547f40){try{jsonpatch[_0x6ac6('0x26')](_0x547f40,_0x5d1b3b,!![]);}catch(_0x53def3){return BPromise[_0x6ac6('0x27')](_0x53def3);}return _0x547f40[_0x6ac6('0x28')]();};}function saveUpdates(_0x3653fb,_0x36a7f8){return function(_0x3da7c9){if(_0x3da7c9){return _0x3da7c9[_0x6ac6('0x29')](_0x3653fb)[_0x6ac6('0x2a')](function(_0x5c31e2){return _0x5c31e2;});}return null;};}function removeEntity(_0x353afb,_0x832f70){return function(_0x30f252){if(_0x30f252){return _0x30f252[_0x6ac6('0x2b')]()[_0x6ac6('0x2a')](function(){var _0x56d70f=_0x30f252[_0x6ac6('0x2c')]({'plain':!![]});var _0x553a53=_0x6ac6('0x2d');return db[_0x6ac6('0x2e')][_0x6ac6('0x2b')]({'where':{'type':_0x553a53,'resourceId':_0x56d70f['id']}})[_0x6ac6('0x2a')](function(){return _0x30f252;});})[_0x6ac6('0x2a')](function(){_0x353afb[_0x6ac6('0x1f')](0xcc)[_0x6ac6('0x2f')]();});}};}function handleEntityNotFound(_0xe7b9e3,_0x386355){return function(_0x55dbd8){if(!_0x55dbd8){_0xe7b9e3[_0x6ac6('0x1e')](0x194);}return _0x55dbd8;};}function handleError(_0x2cfa14,_0x8153ca){_0x8153ca=_0x8153ca||0x1f4;return function(_0x4faa54){logger['error'](_0x4faa54['stack']);if(_0x4faa54['name']){delete _0x4faa54[_0x6ac6('0x30')];}_0x2cfa14[_0x6ac6('0x1f')](_0x8153ca)['send'](_0x4faa54);};}exports[_0x6ac6('0x31')]=function(_0x320922,_0x1f06c1){var _0x8fedb9={},_0x473875={},_0xb12d32={'count':0x0,'rows':[]};var _0x2fdf08=_[_0x6ac6('0x32')](db[_0x6ac6('0x33')]['rawAttributes'],function(_0x2cb341){return{'name':_0x2cb341[_0x6ac6('0x34')],'type':_0x2cb341['type']['key']};});_0x473875[_0x6ac6('0x35')]=_['map'](_0x2fdf08,_0x6ac6('0x30'));_0x473875[_0x6ac6('0x36')]=_[_0x6ac6('0x37')](_0x320922[_0x6ac6('0x36')]);_0x473875[_0x6ac6('0x38')]=_[_0x6ac6('0x39')](_0x473875[_0x6ac6('0x35')],_0x473875['query']);_0x8fedb9['attributes']=_[_0x6ac6('0x39')](_0x473875[_0x6ac6('0x35')],qs['fields'](_0x320922['query'][_0x6ac6('0x3a')]));_0x8fedb9[_0x6ac6('0x3b')]=_0x8fedb9[_0x6ac6('0x3b')]['length']?_0x8fedb9[_0x6ac6('0x3b')]:_0x473875[_0x6ac6('0x35')];if(!_0x320922[_0x6ac6('0x36')][_0x6ac6('0x3c')]('nolimit')){_0x8fedb9[_0x6ac6('0x3d')]=qs[_0x6ac6('0x3d')](_0x320922[_0x6ac6('0x36')][_0x6ac6('0x3d')]);_0x8fedb9[_0x6ac6('0x22')]=qs[_0x6ac6('0x22')](_0x320922[_0x6ac6('0x36')][_0x6ac6('0x22')]);}_0x8fedb9[_0x6ac6('0x3e')]=qs[_0x6ac6('0x3f')](_0x320922[_0x6ac6('0x36')][_0x6ac6('0x3f')]);_0x8fedb9[_0x6ac6('0x40')]=qs[_0x6ac6('0x38')](_[_0x6ac6('0x41')](_0x320922['query'],_0x473875[_0x6ac6('0x38')]),_0x2fdf08);if(_0x320922['query'][_0x6ac6('0x42')]){_0x8fedb9[_0x6ac6('0x40')]=_['merge'](_0x8fedb9[_0x6ac6('0x40')],{'$or':_['map'](_0x2fdf08,function(_0x5e25de){if(_0x5e25de[_0x6ac6('0x43')]!==_0x6ac6('0x44')){var _0xfef1f4={};_0xfef1f4[_0x5e25de[_0x6ac6('0x30')]]={'$like':'%'+_0x320922['query'][_0x6ac6('0x42')]+'%'};return _0xfef1f4;}})});}_0x8fedb9=_[_0x6ac6('0x45')]({},_0x8fedb9,_0x320922[_0x6ac6('0x46')]);var _0x4489b8={'where':_0x8fedb9[_0x6ac6('0x40')]};return db['SquareProject'][_0x6ac6('0x23')](_0x4489b8)['then'](function(_0x5af8c3){_0xb12d32['count']=_0x5af8c3;if(_0x320922[_0x6ac6('0x36')][_0x6ac6('0x47')]){_0x8fedb9[_0x6ac6('0x48')]=[{'all':!![]}];}return db[_0x6ac6('0x33')][_0x6ac6('0x49')](_0x8fedb9);})[_0x6ac6('0x2a')](function(_0x26c655){_0xb12d32[_0x6ac6('0x4a')]=_0x26c655;return _0xb12d32;})[_0x6ac6('0x2a')](respondWithFilteredResult(_0x1f06c1,_0x8fedb9))[_0x6ac6('0x4b')](handleError(_0x1f06c1,null));};exports[_0x6ac6('0x4c')]=function(_0x3b3944,_0x403289){var _0x50df20={'raw':![],'where':{'id':_0x3b3944['params']['id']}},_0x4da5af={};_0x4da5af[_0x6ac6('0x35')]=_[_0x6ac6('0x37')](db[_0x6ac6('0x33')][_0x6ac6('0x4d')]);_0x4da5af[_0x6ac6('0x36')]=_[_0x6ac6('0x37')](_0x3b3944[_0x6ac6('0x36')]);_0x4da5af[_0x6ac6('0x38')]=_[_0x6ac6('0x39')](_0x4da5af['model'],_0x4da5af[_0x6ac6('0x36')]);_0x50df20[_0x6ac6('0x3b')]=_['intersection'](_0x4da5af[_0x6ac6('0x35')],qs[_0x6ac6('0x3a')](_0x3b3944['query'][_0x6ac6('0x3a')]));_0x50df20[_0x6ac6('0x3b')]=_0x50df20[_0x6ac6('0x3b')][_0x6ac6('0x4e')]?_0x50df20[_0x6ac6('0x3b')]:_0x4da5af[_0x6ac6('0x35')];if(_0x3b3944[_0x6ac6('0x36')][_0x6ac6('0x47')]){_0x50df20[_0x6ac6('0x48')]=[{'all':!![]}];}_0x50df20=_[_0x6ac6('0x45')]({},_0x50df20,_0x3b3944['options']);return db[_0x6ac6('0x33')][_0x6ac6('0x4f')](_0x50df20)[_0x6ac6('0x2a')](handleEntityNotFound(_0x403289,null))[_0x6ac6('0x2a')](respondWithResult(_0x403289,null))[_0x6ac6('0x4b')](handleError(_0x403289,null));};exports[_0x6ac6('0x50')]=function(_0x2335b7,_0xddd090){return db[_0x6ac6('0x33')][_0x6ac6('0x50')](_0x2335b7['body'],{})[_0x6ac6('0x2a')](function(_0x485a63){var _0x23e77a=_0x2335b7[_0x6ac6('0x51')][_0x6ac6('0x2c')]({'plain':!![]});if(!_0x23e77a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23e77a[_0x6ac6('0x52')]===_0x6ac6('0x51')){var _0x841e47=_0x485a63[_0x6ac6('0x2c')]({'plain':!![]});var _0x318de9=_0x6ac6('0x2d');return db[_0x6ac6('0x53')]['find']({'where':{'name':_0x318de9,'userProfileId':_0x23e77a[_0x6ac6('0x54')]},'raw':!![]})['then'](function(_0x3334c5){if(_0x3334c5&&_0x3334c5[_0x6ac6('0x55')]===0x0){return db[_0x6ac6('0x2e')][_0x6ac6('0x50')]({'name':_0x841e47[_0x6ac6('0x30')],'resourceId':_0x841e47['id'],'type':_0x3334c5['name'],'sectionId':_0x3334c5['id']},{})['then'](function(){return _0x485a63;});}else{return _0x485a63;}})[_0x6ac6('0x4b')](function(_0x1f4cb9){logger['error'](_0x6ac6('0x56'),_0x1f4cb9);throw _0x1f4cb9;});}return _0x485a63;})['then'](respondWithResult(_0xddd090,0xc9))[_0x6ac6('0x4b')](handleError(_0xddd090,null));};exports[_0x6ac6('0x29')]=function(_0x35eec6,_0x3d9389){if(_0x35eec6[_0x6ac6('0x57')]['id']){delete _0x35eec6[_0x6ac6('0x57')]['id'];}return db[_0x6ac6('0x33')][_0x6ac6('0x4f')]({'where':{'id':_0x35eec6[_0x6ac6('0x58')]['id']}})[_0x6ac6('0x2a')](handleEntityNotFound(_0x3d9389,null))[_0x6ac6('0x2a')](saveUpdates(_0x35eec6[_0x6ac6('0x57')],null))['then'](respondWithResult(_0x3d9389,null))[_0x6ac6('0x4b')](handleError(_0x3d9389,null));};exports[_0x6ac6('0x2b')]=function(_0x3744ea,_0x42ecc0){return db[_0x6ac6('0x33')][_0x6ac6('0x4f')]({'where':{'id':_0x3744ea[_0x6ac6('0x58')]['id']}})[_0x6ac6('0x2a')](handleEntityNotFound(_0x42ecc0,null))['then'](removeEntity(_0x42ecc0,null))['catch'](handleError(_0x42ecc0,null));};exports['addUsers']=function(_0x14f939,_0x106e7f,_0x1375ad){return db['SquareProject'][_0x6ac6('0x4f')]({'where':{'id':_0x14f939[_0x6ac6('0x58')]['id']}})[_0x6ac6('0x2a')](handleEntityNotFound(_0x106e7f,null))[_0x6ac6('0x2a')](function(_0x17a562){if(_0x17a562){return _0x17a562[_0x6ac6('0x59')](_0x14f939['body'][_0x6ac6('0x5a')],_[_0x6ac6('0x5b')](_0x14f939[_0x6ac6('0x57')],[_0x6ac6('0x5a'),'id'])||{});}})[_0x6ac6('0x2a')](respondWithResult(_0x106e7f,null))[_0x6ac6('0x4b')](handleError(_0x106e7f,null));};exports['removeUsers']=function(_0x57fca7,_0x35fdac,_0x4bb02f){return db['SquareProject'][_0x6ac6('0x4f')]({'where':{'id':_0x57fca7[_0x6ac6('0x58')]['id']}})[_0x6ac6('0x2a')](handleEntityNotFound(_0x35fdac,null))[_0x6ac6('0x2a')](function(_0x5b2e54){if(_0x5b2e54){return _0x5b2e54['removeUsers'](_0x57fca7[_0x6ac6('0x36')][_0x6ac6('0x5a')])['then'](function(){if(_[_0x6ac6('0x5c')](_0x57fca7[_0x6ac6('0x36')]['ids'])){for(var _0x29454f=0x0;_0x29454f<_0x57fca7[_0x6ac6('0x36')][_0x6ac6('0x5a')]['length'];_0x29454f+=0x1){socket[_0x6ac6('0x5d')]('userSquareProject:remove',{'UserId':Number(_0x57fca7[_0x6ac6('0x36')][_0x6ac6('0x5a')][_0x29454f]),'SquareProjectId':Number(_0x57fca7[_0x6ac6('0x58')]['id'])});}}else{socket[_0x6ac6('0x5d')](_0x6ac6('0x5e'),{'UserId':Number(_0x57fca7['query'][_0x6ac6('0x5a')]),'SquareProjectId':Number(_0x57fca7['params']['id'])});}});}})[_0x6ac6('0x2a')](respondWithStatusCode(_0x35fdac,null))[_0x6ac6('0x4b')](handleError(_0x35fdac,null));};exports[_0x6ac6('0x5f')]=function(_0x13268a,_0x42db04,_0x46f524){var _0x51ffdf={};var _0x24c349={};var _0x14fc91;var _0xc86b9a;return db[_0x6ac6('0x33')][_0x6ac6('0x60')]({'where':{'id':_0x13268a[_0x6ac6('0x58')]['id']}})[_0x6ac6('0x2a')](handleEntityNotFound(_0x42db04,null))[_0x6ac6('0x2a')](function(_0x4dd00c){if(_0x4dd00c){_0x14fc91=_0x4dd00c;_0x24c349[_0x6ac6('0x35')]=_[_0x6ac6('0x37')](db['User'][_0x6ac6('0x4d')]);_0x24c349[_0x6ac6('0x36')]=_[_0x6ac6('0x37')](_0x13268a[_0x6ac6('0x36')]);_0x24c349[_0x6ac6('0x38')]=_[_0x6ac6('0x39')](_0x24c349[_0x6ac6('0x35')],_0x24c349[_0x6ac6('0x36')]);_0x51ffdf[_0x6ac6('0x3b')]=_[_0x6ac6('0x39')](_0x24c349[_0x6ac6('0x35')],qs[_0x6ac6('0x3a')](_0x13268a[_0x6ac6('0x36')][_0x6ac6('0x3a')]));_0x51ffdf[_0x6ac6('0x3b')]=_0x51ffdf['attributes'][_0x6ac6('0x4e')]?_0x51ffdf[_0x6ac6('0x3b')]:_0x24c349[_0x6ac6('0x35')];_0x51ffdf[_0x6ac6('0x3e')]=qs[_0x6ac6('0x3f')](_0x13268a['query'][_0x6ac6('0x3f')]);_0x51ffdf[_0x6ac6('0x40')]=qs[_0x6ac6('0x38')](_[_0x6ac6('0x41')](_0x13268a[_0x6ac6('0x36')],_0x24c349['filters']));if(_0x13268a[_0x6ac6('0x36')]['filter']){_0x51ffdf['where']=_[_0x6ac6('0x45')](_0x51ffdf['where'],{'$or':_[_0x6ac6('0x32')](_0x51ffdf[_0x6ac6('0x3b')],function(_0x2ce83b){var _0x21ea07={};_0x21ea07[_0x2ce83b]={'$like':'%'+_0x13268a[_0x6ac6('0x36')]['filter']+'%'};return _0x21ea07;})});}_0x51ffdf=_[_0x6ac6('0x45')]({},_0x51ffdf,_0x13268a['options']);return _0x14fc91[_0x6ac6('0x5f')](_0x51ffdf);}})[_0x6ac6('0x2a')](function(_0x49dfb4){if(_0x49dfb4){_0xc86b9a=_0x49dfb4['length'];if(!_0x13268a[_0x6ac6('0x36')][_0x6ac6('0x3c')](_0x6ac6('0x61'))){_0x51ffdf[_0x6ac6('0x3d')]=qs[_0x6ac6('0x3d')](_0x13268a[_0x6ac6('0x36')][_0x6ac6('0x3d')]);_0x51ffdf[_0x6ac6('0x22')]=qs[_0x6ac6('0x22')](_0x13268a['query'][_0x6ac6('0x22')]);}return _0x14fc91[_0x6ac6('0x5f')](_0x51ffdf);}})['then'](function(_0x26a995){if(_0x26a995){return _0x26a995?{'count':_0xc86b9a,'rows':_0x26a995}:null;}})[_0x6ac6('0x2a')](respondWithResult(_0x42db04,null))['catch'](handleError(_0x42db04,null));}; \ No newline at end of file +var _0x509f=['squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','SquareProjects','UserProfileResource','destroy','error','stack','name','send','index','rawAttributes','fieldName','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','SquareProject','includeAll','findAll','show','params','keys','include','find','catch','create','body','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','pick','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x4f50cc,_0xb95ef4){var _0xb188b1=function(_0x1addd4){while(--_0x1addd4){_0x4f50cc['push'](_0x4f50cc['shift']());}};_0xb188b1(++_0xb95ef4);}(_0x509f,0xb8));var _0xf509=function(_0x506803,_0x5dd8d2){_0x506803=_0x506803-0x0;var _0x32f805=_0x509f[_0x506803];return _0x32f805;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf509('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf509('0x1'));var rp=require('request-promise');var moment=require(_0xf509('0x2'));var BPromise=require(_0xf509('0x3'));var Mustache=require(_0xf509('0x4'));var util=require(_0xf509('0x5'));var path=require(_0xf509('0x6'));var sox=require(_0xf509('0x7'));var csv=require(_0xf509('0x8'));var ejs=require(_0xf509('0x9'));var fs=require('fs');var fs_extra=require(_0xf509('0xa'));var _=require(_0xf509('0xb'));var squel=require(_0xf509('0xc'));var crypto=require(_0xf509('0xd'));var jsforce=require(_0xf509('0xe'));var deskjs=require(_0xf509('0xf'));var toCsv=require(_0xf509('0x8'));var querystring=require(_0xf509('0x10'));var Papa=require(_0xf509('0x11'));var Redis=require('ioredis');var authService=require(_0xf509('0x12'));var qs=require(_0xf509('0x13'));var as=require(_0xf509('0x14'));var hardwareService=require(_0xf509('0x15'));var logger=require(_0xf509('0x16'))('api');var utils=require(_0xf509('0x17'));var config=require(_0xf509('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf509('0x19'))['db'];config[_0xf509('0x1a')]=_['defaults'](config['redis'],{'host':_0xf509('0x1b'),'port':0x18eb});var socket=require(_0xf509('0x1c'))(new Redis(config[_0xf509('0x1a')]));require(_0xf509('0x1d'))[_0xf509('0x1e')](socket);function respondWithStatusCode(_0x35d5bd,_0xc9ff18){_0xc9ff18=_0xc9ff18||0xcc;return function(_0x5ef5fa){if(_0x5ef5fa){return _0x35d5bd[_0xf509('0x1f')](_0xc9ff18);}return _0x35d5bd[_0xf509('0x20')](_0xc9ff18)[_0xf509('0x21')]();};}function respondWithResult(_0x476f79,_0x2d91d7){_0x2d91d7=_0x2d91d7||0xc8;return function(_0x548404){if(_0x548404){return _0x476f79[_0xf509('0x20')](_0x2d91d7)[_0xf509('0x22')](_0x548404);}};}function respondWithFilteredResult(_0x4f2d11,_0x58990f){return function(_0x498d8d){if(_0x498d8d){var _0xc53010=typeof _0x58990f[_0xf509('0x23')]===_0xf509('0x24')&&typeof _0x58990f[_0xf509('0x25')]===_0xf509('0x24');var _0x2cf849=_0x498d8d[_0xf509('0x26')];var _0xde2c8f=_0xc53010?0x0:_0x58990f[_0xf509('0x23')];var _0x15b194=_0xc53010?_0x498d8d[_0xf509('0x26')]:_0x58990f['offset']+_0x58990f[_0xf509('0x25')];var _0x5b1b4b;if(_0x15b194>=_0x2cf849){_0x15b194=_0x2cf849;_0x5b1b4b=0xc8;}else{_0x5b1b4b=0xce;}_0x4f2d11[_0xf509('0x20')](_0x5b1b4b);return _0x4f2d11[_0xf509('0x27')](_0xf509('0x28'),_0xde2c8f+'-'+_0x15b194+'/'+_0x2cf849)['json'](_0x498d8d);}return null;};}function patchUpdates(_0x29c7c8){return function(_0x2243c4){try{jsonpatch[_0xf509('0x29')](_0x2243c4,_0x29c7c8,!![]);}catch(_0x419c7f){return BPromise[_0xf509('0x2a')](_0x419c7f);}return _0x2243c4['save']();};}function saveUpdates(_0x556c12,_0x499e75){return function(_0x3cdfec){if(_0x3cdfec){return _0x3cdfec['update'](_0x556c12)['then'](function(_0x296f5f){return _0x296f5f;});}return null;};}function removeEntity(_0x5c4ceb,_0x3f0552){return function(_0x2d13d7){if(_0x2d13d7){return _0x2d13d7['destroy']()[_0xf509('0x2b')](function(){var _0x5db789=_0x2d13d7['get']({'plain':!![]});var _0xcffde6=_0xf509('0x2c');return db[_0xf509('0x2d')][_0xf509('0x2e')]({'where':{'type':_0xcffde6,'resourceId':_0x5db789['id']}})[_0xf509('0x2b')](function(){return _0x2d13d7;});})[_0xf509('0x2b')](function(){_0x5c4ceb[_0xf509('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2416f6,_0x1489fb){return function(_0x162047){if(!_0x162047){_0x2416f6[_0xf509('0x1f')](0x194);}return _0x162047;};}function handleError(_0x29b5d5,_0x4c3be1){_0x4c3be1=_0x4c3be1||0x1f4;return function(_0x3dbc61){logger[_0xf509('0x2f')](_0x3dbc61[_0xf509('0x30')]);if(_0x3dbc61['name']){delete _0x3dbc61[_0xf509('0x31')];}_0x29b5d5[_0xf509('0x20')](_0x4c3be1)[_0xf509('0x32')](_0x3dbc61);};}exports[_0xf509('0x33')]=function(_0x1cbaa7,_0x9b0f96){var _0x534b91={},_0x18d7a1={},_0x426f1c={'count':0x0,'rows':[]};var _0xb49ed4=_['map'](db['SquareProject'][_0xf509('0x34')],function(_0x5b629f){return{'name':_0x5b629f[_0xf509('0x35')],'type':_0x5b629f['type']['key']};});_0x18d7a1[_0xf509('0x36')]=_[_0xf509('0x37')](_0xb49ed4,_0xf509('0x31'));_0x18d7a1[_0xf509('0x38')]=_['keys'](_0x1cbaa7[_0xf509('0x38')]);_0x18d7a1[_0xf509('0x39')]=_[_0xf509('0x3a')](_0x18d7a1[_0xf509('0x36')],_0x18d7a1[_0xf509('0x38')]);_0x534b91['attributes']=_[_0xf509('0x3a')](_0x18d7a1['model'],qs[_0xf509('0x3b')](_0x1cbaa7[_0xf509('0x38')][_0xf509('0x3b')]));_0x534b91[_0xf509('0x3c')]=_0x534b91['attributes'][_0xf509('0x3d')]?_0x534b91[_0xf509('0x3c')]:_0x18d7a1[_0xf509('0x36')];if(!_0x1cbaa7[_0xf509('0x38')][_0xf509('0x3e')](_0xf509('0x3f'))){_0x534b91[_0xf509('0x25')]=qs[_0xf509('0x25')](_0x1cbaa7[_0xf509('0x38')]['limit']);_0x534b91['offset']=qs[_0xf509('0x23')](_0x1cbaa7['query'][_0xf509('0x23')]);}_0x534b91[_0xf509('0x40')]=qs['sort'](_0x1cbaa7['query'][_0xf509('0x41')]);_0x534b91['where']=qs[_0xf509('0x39')](_['pick'](_0x1cbaa7[_0xf509('0x38')],_0x18d7a1[_0xf509('0x39')]),_0xb49ed4);if(_0x1cbaa7[_0xf509('0x38')]['filter']){_0x534b91[_0xf509('0x42')]=_[_0xf509('0x43')](_0x534b91[_0xf509('0x42')],{'$or':_[_0xf509('0x37')](_0xb49ed4,function(_0x10e495){if(_0x10e495[_0xf509('0x44')]!=='VIRTUAL'){var _0x982274={};_0x982274[_0x10e495['name']]={'$like':'%'+_0x1cbaa7[_0xf509('0x38')][_0xf509('0x45')]+'%'};return _0x982274;}})});}_0x534b91=_[_0xf509('0x43')]({},_0x534b91,_0x1cbaa7[_0xf509('0x46')]);var _0x28a846={'where':_0x534b91[_0xf509('0x42')]};return db[_0xf509('0x47')][_0xf509('0x26')](_0x28a846)[_0xf509('0x2b')](function(_0x58be36){_0x426f1c[_0xf509('0x26')]=_0x58be36;if(_0x1cbaa7[_0xf509('0x38')][_0xf509('0x48')]){_0x534b91['include']=[{'all':!![]}];}return db[_0xf509('0x47')][_0xf509('0x49')](_0x534b91);})[_0xf509('0x2b')](function(_0x2b00c4){_0x426f1c['rows']=_0x2b00c4;return _0x426f1c;})[_0xf509('0x2b')](respondWithFilteredResult(_0x9b0f96,_0x534b91))['catch'](handleError(_0x9b0f96,null));};exports[_0xf509('0x4a')]=function(_0x536268,_0xb9320e){var _0x277c4b={'raw':![],'where':{'id':_0x536268[_0xf509('0x4b')]['id']}},_0x45de8b={};_0x45de8b['model']=_[_0xf509('0x4c')](db[_0xf509('0x47')][_0xf509('0x34')]);_0x45de8b[_0xf509('0x38')]=_[_0xf509('0x4c')](_0x536268[_0xf509('0x38')]);_0x45de8b['filters']=_[_0xf509('0x3a')](_0x45de8b[_0xf509('0x36')],_0x45de8b[_0xf509('0x38')]);_0x277c4b['attributes']=_['intersection'](_0x45de8b[_0xf509('0x36')],qs[_0xf509('0x3b')](_0x536268[_0xf509('0x38')]['fields']));_0x277c4b[_0xf509('0x3c')]=_0x277c4b[_0xf509('0x3c')][_0xf509('0x3d')]?_0x277c4b['attributes']:_0x45de8b['model'];if(_0x536268[_0xf509('0x38')][_0xf509('0x48')]){_0x277c4b[_0xf509('0x4d')]=[{'all':!![]}];}_0x277c4b=_[_0xf509('0x43')]({},_0x277c4b,_0x536268[_0xf509('0x46')]);return db[_0xf509('0x47')][_0xf509('0x4e')](_0x277c4b)[_0xf509('0x2b')](handleEntityNotFound(_0xb9320e,null))['then'](respondWithResult(_0xb9320e,null))[_0xf509('0x4f')](handleError(_0xb9320e,null));};exports[_0xf509('0x50')]=function(_0x2e2761,_0x32feb3){return db[_0xf509('0x47')][_0xf509('0x50')](_0x2e2761[_0xf509('0x51')],{})[_0xf509('0x2b')](function(_0x3a0cc5){var _0x2d9128=_0x2e2761[_0xf509('0x52')][_0xf509('0x53')]({'plain':!![]});if(!_0x2d9128)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d9128[_0xf509('0x54')]===_0xf509('0x52')){var _0x2751e2=_0x3a0cc5[_0xf509('0x53')]({'plain':!![]});var _0x1fa9a8=_0xf509('0x2c');return db[_0xf509('0x55')]['find']({'where':{'name':_0x1fa9a8,'userProfileId':_0x2d9128[_0xf509('0x56')]},'raw':!![]})[_0xf509('0x2b')](function(_0x538f0b){if(_0x538f0b&&_0x538f0b['autoAssociation']===0x0){return db[_0xf509('0x2d')][_0xf509('0x50')]({'name':_0x2751e2[_0xf509('0x31')],'resourceId':_0x2751e2['id'],'type':_0x538f0b[_0xf509('0x31')],'sectionId':_0x538f0b['id']},{})[_0xf509('0x2b')](function(){return _0x3a0cc5;});}else{return _0x3a0cc5;}})[_0xf509('0x4f')](function(_0x1f40a0){logger[_0xf509('0x2f')](_0xf509('0x57'),_0x1f40a0);throw _0x1f40a0;});}return _0x3a0cc5;})[_0xf509('0x2b')](respondWithResult(_0x32feb3,0xc9))['catch'](handleError(_0x32feb3,null));};exports[_0xf509('0x58')]=function(_0x166cb4,_0x24e435){if(_0x166cb4['body']['id']){delete _0x166cb4[_0xf509('0x51')]['id'];}return db[_0xf509('0x47')][_0xf509('0x4e')]({'where':{'id':_0x166cb4[_0xf509('0x4b')]['id']}})[_0xf509('0x2b')](handleEntityNotFound(_0x24e435,null))['then'](saveUpdates(_0x166cb4[_0xf509('0x51')],null))[_0xf509('0x2b')](respondWithResult(_0x24e435,null))[_0xf509('0x4f')](handleError(_0x24e435,null));};exports[_0xf509('0x2e')]=function(_0x4c9e3e,_0x4dfb38){return db['SquareProject'][_0xf509('0x4e')]({'where':{'id':_0x4c9e3e['params']['id']}})[_0xf509('0x2b')](handleEntityNotFound(_0x4dfb38,null))[_0xf509('0x2b')](removeEntity(_0x4dfb38,null))[_0xf509('0x4f')](handleError(_0x4dfb38,null));};exports[_0xf509('0x59')]=function(_0x1675d7,_0x1a31f0,_0x1ec08c){return db[_0xf509('0x47')][_0xf509('0x4e')]({'where':{'id':_0x1675d7['params']['id']}})[_0xf509('0x2b')](handleEntityNotFound(_0x1a31f0,null))[_0xf509('0x2b')](function(_0xe5090b){if(_0xe5090b){return _0xe5090b[_0xf509('0x59')](_0x1675d7[_0xf509('0x51')]['ids'],_['omit'](_0x1675d7[_0xf509('0x51')],[_0xf509('0x5a'),'id'])||{});}})[_0xf509('0x2b')](respondWithResult(_0x1a31f0,null))[_0xf509('0x4f')](handleError(_0x1a31f0,null));};exports[_0xf509('0x5b')]=function(_0x20842f,_0x13ebe5,_0x4e100c){return db[_0xf509('0x47')]['find']({'where':{'id':_0x20842f[_0xf509('0x4b')]['id']}})['then'](handleEntityNotFound(_0x13ebe5,null))[_0xf509('0x2b')](function(_0x457a43){if(_0x457a43){return _0x457a43[_0xf509('0x5b')](_0x20842f[_0xf509('0x38')][_0xf509('0x5a')])['then'](function(){if(_[_0xf509('0x5c')](_0x20842f['query'][_0xf509('0x5a')])){for(var _0x24b59e=0x0;_0x24b59e<_0x20842f[_0xf509('0x38')][_0xf509('0x5a')][_0xf509('0x3d')];_0x24b59e+=0x1){socket[_0xf509('0x5d')](_0xf509('0x5e'),{'UserId':Number(_0x20842f[_0xf509('0x38')][_0xf509('0x5a')][_0x24b59e]),'SquareProjectId':Number(_0x20842f[_0xf509('0x4b')]['id'])});}}else{socket[_0xf509('0x5d')]('userSquareProject:remove',{'UserId':Number(_0x20842f['query'][_0xf509('0x5a')]),'SquareProjectId':Number(_0x20842f[_0xf509('0x4b')]['id'])});}});}})[_0xf509('0x2b')](respondWithStatusCode(_0x13ebe5,null))['catch'](handleError(_0x13ebe5,null));};exports[_0xf509('0x5f')]=function(_0x174c10,_0x3062e2,_0x428c32){var _0x61bbde={};var _0x2e7ed3={};var _0x40338c;var _0x329f9e;return db[_0xf509('0x47')]['findOne']({'where':{'id':_0x174c10[_0xf509('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3062e2,null))[_0xf509('0x2b')](function(_0xe80f2d){if(_0xe80f2d){_0x40338c=_0xe80f2d;_0x2e7ed3['model']=_[_0xf509('0x4c')](db[_0xf509('0x60')]['rawAttributes']);_0x2e7ed3[_0xf509('0x38')]=_[_0xf509('0x4c')](_0x174c10[_0xf509('0x38')]);_0x2e7ed3['filters']=_['intersection'](_0x2e7ed3[_0xf509('0x36')],_0x2e7ed3[_0xf509('0x38')]);_0x61bbde['attributes']=_['intersection'](_0x2e7ed3[_0xf509('0x36')],qs[_0xf509('0x3b')](_0x174c10[_0xf509('0x38')]['fields']));_0x61bbde[_0xf509('0x3c')]=_0x61bbde[_0xf509('0x3c')][_0xf509('0x3d')]?_0x61bbde[_0xf509('0x3c')]:_0x2e7ed3[_0xf509('0x36')];_0x61bbde[_0xf509('0x40')]=qs['sort'](_0x174c10['query']['sort']);_0x61bbde[_0xf509('0x42')]=qs[_0xf509('0x39')](_[_0xf509('0x61')](_0x174c10[_0xf509('0x38')],_0x2e7ed3[_0xf509('0x39')]));if(_0x174c10['query'][_0xf509('0x45')]){_0x61bbde['where']=_['merge'](_0x61bbde['where'],{'$or':_[_0xf509('0x37')](_0x61bbde['attributes'],function(_0x4c35b3){var _0x1bf52a={};_0x1bf52a[_0x4c35b3]={'$like':'%'+_0x174c10[_0xf509('0x38')][_0xf509('0x45')]+'%'};return _0x1bf52a;})});}_0x61bbde=_[_0xf509('0x43')]({},_0x61bbde,_0x174c10['options']);return _0x40338c[_0xf509('0x5f')](_0x61bbde);}})[_0xf509('0x2b')](function(_0x4ae6d9){if(_0x4ae6d9){_0x329f9e=_0x4ae6d9[_0xf509('0x3d')];if(!_0x174c10['query'][_0xf509('0x3e')](_0xf509('0x3f'))){_0x61bbde['limit']=qs['limit'](_0x174c10[_0xf509('0x38')]['limit']);_0x61bbde[_0xf509('0x23')]=qs[_0xf509('0x23')](_0x174c10['query']['offset']);}return _0x40338c['getUsers'](_0x61bbde);}})[_0xf509('0x2b')](function(_0x12b567){if(_0x12b567){return _0x12b567?{'count':_0x329f9e,'rows':_0x12b567}:null;}})[_0xf509('0x2b')](respondWithResult(_0x3062e2,null))[_0xf509('0x4f')](handleError(_0x3062e2,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index c734347..1e0b503 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 _0xdc39=['hook','../../mysqldb','SquareProject','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x408e8d,_0x3ac363){var _0x80939b=function(_0x5bd2fa){while(--_0x5bd2fa){_0x408e8d['push'](_0x408e8d['shift']());}};_0x80939b(++_0x3ac363);}(_0xdc39,0x169));var _0x9dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc39[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x9dc3('0x0'))['db'][_0x9dc3('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x9dc3('0x2')](0x0);var events={'afterCreate':_0x9dc3('0x3'),'afterUpdate':_0x9dc3('0x4'),'afterDestroy':'remove'};function emitEvent(_0x46a184){return function(_0x2082b0,_0xdb4c94,_0x45428c){SquareProjectEvents['emit'](_0x46a184+':'+_0x2082b0['id'],_0x2082b0);SquareProjectEvents[_0x9dc3('0x5')](_0x46a184,_0x2082b0);_0x45428c(null);};}for(var e in events){if(events[_0x9dc3('0x6')](e)){var event=events[e];SquareProject[_0x9dc3('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0xd4cc=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','SquareProject','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd4cc,0x114));var _0xcd4c=function(_0x141772,_0x896a5e){_0x141772=_0x141772-0x0;var _0x398925=_0xd4cc[_0x141772];return _0x398925;};'use strict';var EventEmitter=require(_0xcd4c('0x0'));var SquareProject=require(_0xcd4c('0x1'))['db'][_0xcd4c('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcd4c('0x3'),'afterUpdate':'update','afterDestroy':_0xcd4c('0x4')};function emitEvent(_0x8bb6d8){return function(_0x115f6c,_0x2c95e5,_0x1aa948){SquareProjectEvents[_0xcd4c('0x5')](_0x8bb6d8+':'+_0x115f6c['id'],_0x115f6c);SquareProjectEvents[_0xcd4c('0x5')](_0x8bb6d8,_0x115f6c);_0x1aa948(null);};}for(var e in events){if(events[_0xcd4c('0x6')](e)){var event=events[e];SquareProject[_0xcd4c('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 9520d8c..4f1d46e 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 _0x0f3c=['YYYY-MM-DD\x20HH:mm:ss','production','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','changed','preproduction','savedAt','format'];(function(_0x4935a5,_0x308a0b){var _0x2e2d8f=function(_0x9c583f){while(--_0x9c583f){_0x4935a5['push'](_0x4935a5['shift']());}};_0x2e2d8f(++_0x308a0b);}(_0x0f3c,0x189));var _0xc0f3=function(_0x1cc62b,_0x1e0080){_0x1cc62b=_0x1cc62b-0x0;var _0x408a4c=_0x0f3c[_0x1cc62b];return _0x408a4c;};'use strict';var _=require(_0xc0f3('0x0'));var util=require(_0xc0f3('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc0f3('0x2'));var rp=require(_0xc0f3('0x3'));var fs=require('fs');var path=require(_0xc0f3('0x4'));var rimraf=require(_0xc0f3('0x5'));var config=require(_0xc0f3('0x6'));var attributes=require(_0xc0f3('0x7'));module[_0xc0f3('0x8')]=function(_0x256643,_0x4b76a0){return _0x256643[_0xc0f3('0x9')](_0xc0f3('0xa'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x435864,_0x399c29,_0x5dd244){if(_0x435864[_0xc0f3('0xb')](_0xc0f3('0xc'))){_0x435864[_0xc0f3('0xd')]=moment()[_0xc0f3('0xe')](_0xc0f3('0xf'));}if(_0x435864[_0xc0f3('0xb')](_0xc0f3('0x10'))){_0x435864['publishedAt']=moment()[_0xc0f3('0xe')](_0xc0f3('0xf'));}_0x5dd244(null,_0x435864);}}});}; \ No newline at end of file +var _0xf0cc=['production','publishedAt','lodash','api','request-promise','path','./squareProject.attributes','exports','define','SquareProject','square_projects','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','changed'];(function(_0x387784,_0x29fcee){var _0x5010cc=function(_0x2956e4){while(--_0x2956e4){_0x387784['push'](_0x387784['shift']());}};_0x5010cc(++_0x29fcee);}(_0xf0cc,0xa7));var _0xcf0c=function(_0x38d2ba,_0xa38905){_0x38d2ba=_0x38d2ba-0x0;var _0x1189c3=_0xf0cc[_0x38d2ba];return _0x1189c3;};'use strict';var _=require(_0xcf0c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcf0c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcf0c('0x2'));var fs=require('fs');var path=require(_0xcf0c('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcf0c('0x4'));module[_0xcf0c('0x5')]=function(_0x1a6003,_0x497363){return _0x1a6003[_0xcf0c('0x6')](_0xcf0c('0x7'),attributes,{'tableName':_0xcf0c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5d4cdb,_0x54cef0,_0x3cf3cb){if(_0x5d4cdb['changed'](_0xcf0c('0x9'))){_0x5d4cdb['savedAt']=moment()[_0xcf0c('0xa')](_0xcf0c('0xb'));}if(_0x5d4cdb[_0xcf0c('0xc')](_0xcf0c('0xd'))){_0x5d4cdb[_0xcf0c('0xe')]=moment()[_0xcf0c('0xa')](_0xcf0c('0xb'));}_0x3cf3cb(null,_0x5d4cdb);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 7578a3b..eab0cd0 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 _0x0134=['../../mysqldb','../../config/utils','../../config/logger','rpc','http','defaults','redis','socket.io-emitter','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','ShowSquareProject','SquareProject','options','raw','include','map','model','attributes','stringify','catch','moment','randomstring','ioredis'];(function(_0x1f9290,_0x5e66cf){var _0x19a400=function(_0x5c98dc){while(--_0x5c98dc){_0x1f9290['push'](_0x1f9290['shift']());}};_0x19a400(++_0x5e66cf);}(_0x0134,0x1b7));var _0x4013=function(_0x3621c8,_0x269f7b){_0x3621c8=_0x3621c8-0x0;var _0x3c05e2=_0x0134[_0x3621c8];return _0x3c05e2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4013('0x0'));var BPromise=require('bluebird');var rs=require(_0x4013('0x1'));var fs=require('fs');var Redis=require(_0x4013('0x2'));var db=require(_0x4013('0x3'))['db'];var utils=require(_0x4013('0x4'));var logger=require(_0x4013('0x5'))(_0x4013('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4013('0x7')]({'port':0x232a});config['redis']=_[_0x4013('0x8')](config[_0x4013('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4013('0xa'))(new Redis(config[_0x4013('0x9')]));require(_0x4013('0xb'))[_0x4013('0xc')](socket);function respondWithRpcPromise(_0x249e2c,_0x26207a,_0xb890d7){return new BPromise(function(_0x175c05,_0x4566ab){return client[_0x4013('0xd')](_0x249e2c,_0xb890d7)[_0x4013('0xe')](function(_0x335798){logger[_0x4013('0xf')](_0x4013('0x10'),_0x26207a,'request\x20sent');logger[_0x4013('0x11')](_0x4013('0x12'),_0x26207a,_0x4013('0x13'),JSON['stringify'](_0x335798));if(_0x335798[_0x4013('0x14')]){if(_0x335798[_0x4013('0x14')][_0x4013('0x15')]===0x1f4){logger[_0x4013('0x14')]('SquareProject,\x20%s,\x20%s',_0x26207a,_0x335798[_0x4013('0x14')][_0x4013('0x16')]);return _0x4566ab(_0x335798[_0x4013('0x14')][_0x4013('0x16')]);}logger[_0x4013('0x14')](_0x4013('0x10'),_0x26207a,_0x335798[_0x4013('0x14')][_0x4013('0x16')]);return _0x175c05(_0x335798['error'][_0x4013('0x16')]);}else{logger['info'](_0x4013('0x10'),_0x26207a,'request\x20sent');_0x175c05(_0x335798[_0x4013('0x17')][_0x4013('0x16')]);}})['catch'](function(_0x1c39c4){logger[_0x4013('0x14')](_0x4013('0x10'),_0x26207a,_0x1c39c4);_0x4566ab(_0x1c39c4);});});}exports[_0x4013('0x18')]=function(_0x582859){var _0x5cd93f=this;return new Promise(function(_0x5b206d,_0xb073cb){return db[_0x4013('0x19')]['find']({'raw':_0x582859['options']?_0x582859[_0x4013('0x1a')][_0x4013('0x1b')]===undefined?!![]:![]:!![],'where':_0x582859[_0x4013('0x1a')]?_0x582859[_0x4013('0x1a')]['where']||null:null,'attributes':_0x582859[_0x4013('0x1a')]?_0x582859[_0x4013('0x1a')]['attributes']||null:null,'include':_0x582859[_0x4013('0x1a')]?_0x582859[_0x4013('0x1a')][_0x4013('0x1c')]?_['map'](_0x582859[_0x4013('0x1a')][_0x4013('0x1c')],function(_0x12dd97){return{'model':db[_0x12dd97['model']],'as':_0x12dd97['as'],'attributes':_0x12dd97['attributes'],'include':_0x12dd97['include']?_[_0x4013('0x1d')](_0x12dd97[_0x4013('0x1c')],function(_0xad5894){return{'model':db[_0xad5894[_0x4013('0x1e')]],'as':_0xad5894['as'],'attributes':_0xad5894[_0x4013('0x1f')],'include':_0xad5894['include']?_[_0x4013('0x1d')](_0xad5894[_0x4013('0x1c')],function(_0x35b89f){return{'model':db[_0x35b89f[_0x4013('0x1e')]],'as':_0x35b89f['as'],'attributes':_0x35b89f[_0x4013('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4013('0xe')](function(_0x3daf0d){logger['info'](_0x4013('0x18'),_0x582859);logger[_0x4013('0x11')](_0x4013('0x18'),_0x582859,JSON[_0x4013('0x20')](_0x3daf0d));_0x5b206d(_0x3daf0d);})[_0x4013('0x21')](function(_0x2fd604){logger[_0x4013('0x14')](_0x4013('0x18'),_0x2fd604['message'],_0x582859);_0xb073cb(_0x5cd93f['error'](0x1f4,_0x2fd604[_0x4013('0x16')]));});});}; \ No newline at end of file +var _0xc77b=['http','redis','localhost','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSquareProject','SquareProject','find','options','where','include','map','attributes','model','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xc216fb,_0x9b517a){var _0x1442cc=function(_0x301f1f){while(--_0x301f1f){_0xc216fb['push'](_0xc216fb['shift']());}};_0x1442cc(++_0x9b517a);}(_0xc77b,0x89));var _0xbc77=function(_0x588a49,_0x55c74e){_0x588a49=_0x588a49-0x0;var _0x48cd50=_0xc77b[_0x588a49];return _0x48cd50;};'use strict';var _=require(_0xbc77('0x0'));var util=require(_0xbc77('0x1'));var moment=require(_0xbc77('0x2'));var BPromise=require(_0xbc77('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbc77('0x4'));var db=require(_0xbc77('0x5'))['db'];var utils=require(_0xbc77('0x6'));var logger=require(_0xbc77('0x7'))(_0xbc77('0x8'));var config=require(_0xbc77('0x9'));var jayson=require(_0xbc77('0xa'));var client=jayson['client'][_0xbc77('0xb')]({'port':0x232a});config[_0xbc77('0xc')]=_['defaults'](config[_0xbc77('0xc')],{'host':_0xbc77('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbc77('0xc')]));require(_0xbc77('0xe'))[_0xbc77('0xf')](socket);function respondWithRpcPromise(_0x5b19f3,_0x30066b,_0x271614){return new BPromise(function(_0x4ddd68,_0x7a3a02){return client[_0xbc77('0x10')](_0x5b19f3,_0x271614)[_0xbc77('0x11')](function(_0xe88a30){logger[_0xbc77('0x12')](_0xbc77('0x13'),_0x30066b,_0xbc77('0x14'));logger['debug'](_0xbc77('0x15'),_0x30066b,_0xbc77('0x14'),JSON[_0xbc77('0x16')](_0xe88a30));if(_0xe88a30[_0xbc77('0x17')]){if(_0xe88a30['error']['code']===0x1f4){logger['error'](_0xbc77('0x13'),_0x30066b,_0xe88a30[_0xbc77('0x17')]['message']);return _0x7a3a02(_0xe88a30[_0xbc77('0x17')]['message']);}logger['error'](_0xbc77('0x13'),_0x30066b,_0xe88a30[_0xbc77('0x17')][_0xbc77('0x18')]);return _0x4ddd68(_0xe88a30[_0xbc77('0x17')][_0xbc77('0x18')]);}else{logger['info'](_0xbc77('0x13'),_0x30066b,_0xbc77('0x14'));_0x4ddd68(_0xe88a30[_0xbc77('0x19')]['message']);}})['catch'](function(_0x1755c5){logger[_0xbc77('0x17')](_0xbc77('0x13'),_0x30066b,_0x1755c5);_0x7a3a02(_0x1755c5);});});}exports[_0xbc77('0x1a')]=function(_0x10ff0d){var _0x4ba85c=this;return new Promise(function(_0x349084,_0x4af58f){return db[_0xbc77('0x1b')][_0xbc77('0x1c')]({'raw':_0x10ff0d[_0xbc77('0x1d')]?_0x10ff0d[_0xbc77('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x10ff0d[_0xbc77('0x1d')]?_0x10ff0d['options'][_0xbc77('0x1e')]||null:null,'attributes':_0x10ff0d[_0xbc77('0x1d')]?_0x10ff0d[_0xbc77('0x1d')]['attributes']||null:null,'include':_0x10ff0d['options']?_0x10ff0d[_0xbc77('0x1d')][_0xbc77('0x1f')]?_[_0xbc77('0x20')](_0x10ff0d[_0xbc77('0x1d')][_0xbc77('0x1f')],function(_0x2ba3d8){return{'model':db[_0x2ba3d8['model']],'as':_0x2ba3d8['as'],'attributes':_0x2ba3d8[_0xbc77('0x21')],'include':_0x2ba3d8[_0xbc77('0x1f')]?_['map'](_0x2ba3d8[_0xbc77('0x1f')],function(_0x545255){return{'model':db[_0x545255[_0xbc77('0x22')]],'as':_0x545255['as'],'attributes':_0x545255[_0xbc77('0x21')],'include':_0x545255[_0xbc77('0x1f')]?_[_0xbc77('0x20')](_0x545255[_0xbc77('0x1f')],function(_0x118287){return{'model':db[_0x118287[_0xbc77('0x22')]],'as':_0x118287['as'],'attributes':_0x118287[_0xbc77('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x580b26){logger['info']('ShowSquareProject',_0x10ff0d);logger[_0xbc77('0x23')]('ShowSquareProject',_0x10ff0d,JSON[_0xbc77('0x16')](_0x580b26));_0x349084(_0x580b26);})[_0xbc77('0x24')](function(_0x16202e){logger[_0xbc77('0x17')]('ShowSquareProject',_0x16202e[_0xbc77('0x18')],_0x10ff0d);_0x4af58f(_0x4ba85c['error'](0x1f4,_0x16202e[_0xbc77('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index d37b1bf..63b968e 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 _0x4137=['emit','removeListener','register','length','squareProject:','./squareProject.events','save','remove','update'];(function(_0x47e6e4,_0xb3bb94){var _0x31ba87=function(_0x21de79){while(--_0x21de79){_0x47e6e4['push'](_0x47e6e4['shift']());}};_0x31ba87(++_0xb3bb94);}(_0x4137,0xf8));var _0x7413=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4137[_0x413feb];return _0x40ee88;};'use strict';var SquareProjectEvents=require(_0x7413('0x0'));var events=[_0x7413('0x1'),_0x7413('0x2'),_0x7413('0x3')];function createListener(_0x392ebc,_0x410971){return function(_0x2e6df7){_0x410971[_0x7413('0x4')](_0x392ebc,_0x2e6df7);};}function removeListener(_0x258255,_0x3dc48a){return function(){SquareProjectEvents[_0x7413('0x5')](_0x258255,_0x3dc48a);};}exports[_0x7413('0x6')]=function(_0x4fbade){for(var _0xc808cd=0x0,_0x188d89=events[_0x7413('0x7')];_0xc808cd<_0x188d89;_0xc808cd++){var _0x15af0d=events[_0xc808cd];var _0x5f4cd0=createListener(_0x7413('0x8')+_0x15af0d,_0x4fbade);SquareProjectEvents['on'](_0x15af0d,_0x5f4cd0);}}; \ No newline at end of file +var _0xfcf0=['removeListener','register','length','squareProject:','./squareProject.events','save','update'];(function(_0x368c42,_0x903dc4){var _0x11fd4c=function(_0x223a8a){while(--_0x223a8a){_0x368c42['push'](_0x368c42['shift']());}};_0x11fd4c(++_0x903dc4);}(_0xfcf0,0x138));var _0x0fcf=function(_0x1fc1f9,_0x454fb2){_0x1fc1f9=_0x1fc1f9-0x0;var _0x4987ca=_0xfcf0[_0x1fc1f9];return _0x4987ca;};'use strict';var SquareProjectEvents=require(_0x0fcf('0x0'));var events=[_0x0fcf('0x1'),'remove',_0x0fcf('0x2')];function createListener(_0x3d8e0f,_0x366cfa){return function(_0xd744d1){_0x366cfa['emit'](_0x3d8e0f,_0xd744d1);};}function removeListener(_0x2fe6d8,_0x265968){return function(){SquareProjectEvents[_0x0fcf('0x3')](_0x2fe6d8,_0x265968);};}exports[_0x0fcf('0x4')]=function(_0x1bace8){for(var _0x1a7b03=0x0,_0x61bbb9=events[_0x0fcf('0x5')];_0x1a7b03<_0x61bbb9;_0x1a7b03++){var _0x50c575=events[_0x1a7b03];var _0x1388d1=createListener(_0x0fcf('0x6')+_0x50c575,_0x1bace8);SquareProjectEvents['on'](_0x50c575,_0x1388d1);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index ad05559..bddf171 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 _0xb44a=['show','/:id/download','download','put','update','delete','destroy','exports','path','express','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id'];(function(_0x27d22e,_0xee9205){var _0xb82f86=function(_0x2c766c){while(--_0x2c766c){_0x27d22e['push'](_0x27d22e['shift']());}};_0xb82f86(++_0xee9205);}(_0xb44a,0x1c2));var _0xab44=function(_0x404cde,_0x27b51c){_0x404cde=_0x404cde-0x0;var _0x139882=_0xb44a[_0x404cde];return _0x139882;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab44('0x0'));var timeout=require('connect-timeout');var express=require(_0xab44('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xab44('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xab44('0x3'));var controller=require(_0xab44('0x4'));router[_0xab44('0x5')]('/',auth[_0xab44('0x6')](),controller[_0xab44('0x7')]);router[_0xab44('0x5')](_0xab44('0x8'),auth[_0xab44('0x6')](),controller[_0xab44('0x9')]);router[_0xab44('0x5')](_0xab44('0xa'),auth[_0xab44('0x6')](),controller[_0xab44('0xb')]);router['post']('/',auth[_0xab44('0x6')](),controller['create']);router[_0xab44('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xab44('0xd')]);router[_0xab44('0xe')](_0xab44('0x8'),auth[_0xab44('0x6')](),controller[_0xab44('0xf')]);module[_0xab44('0x10')]=router; \ No newline at end of file +var _0x531a=['create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/download','post'];(function(_0x276446,_0x580ed8){var _0x28ebee=function(_0x25824c){while(--_0x25824c){_0x276446['push'](_0x276446['shift']());}};_0x28ebee(++_0x580ed8);}(_0x531a,0x100));var _0xa531=function(_0x30e0f5,_0x5e4826){_0x30e0f5=_0x30e0f5-0x0;var _0x3b5800=_0x531a[_0x30e0f5];return _0x3b5800;};'use strict';var multer=require(_0xa531('0x0'));var util=require(_0xa531('0x1'));var path=require(_0xa531('0x2'));var timeout=require(_0xa531('0x3'));var express=require(_0xa531('0x4'));var router=express[_0xa531('0x5')]();var fs_extra=require(_0xa531('0x6'));var auth=require(_0xa531('0x7'));var interaction=require(_0xa531('0x8'));var config=require(_0xa531('0x9'));var controller=require('./squareRecording.controller');router[_0xa531('0xa')]('/',auth['isAuthenticated'](),controller[_0xa531('0xb')]);router[_0xa531('0xa')](_0xa531('0xc'),auth[_0xa531('0xd')](),controller[_0xa531('0xe')]);router['get'](_0xa531('0xf'),auth[_0xa531('0xd')](),controller['download']);router[_0xa531('0x10')]('/',auth[_0xa531('0xd')](),controller[_0xa531('0x11')]);router[_0xa531('0x12')](_0xa531('0xc'),auth['isAuthenticated'](),controller[_0xa531('0x13')]);router['delete'](_0xa531('0xc'),auth[_0xa531('0xd')](),controller[_0xa531('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 3434a36..301b3e5 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 _0xce2f=['STRING','VIRTUAL','getDataValue','savePath','substring','sequelize','exports'];(function(_0x23101c,_0xb416de){var _0x30e9af=function(_0xb32fd8){while(--_0xb32fd8){_0x23101c['push'](_0x23101c['shift']());}};_0x30e9af(++_0xb416de);}(_0xce2f,0x1ef));var _0xfce2=function(_0x50fab0,_0x4a458e){_0x50fab0=_0x50fab0-0x0;var _0x1b3c47=_0xce2f[_0x50fab0];return _0x1b3c47;};'use strict';var Sequelize=require(_0xfce2('0x0'));module[_0xfce2('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xfce2('0x2')]},'calleridname':{'type':Sequelize[_0xfce2('0x2')]},'context':{'type':Sequelize[_0xfce2('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xfce2('0x2')]},'accountcode':{'type':Sequelize[_0xfce2('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xfce2('0x2')]},'saveName':{'type':Sequelize[_0xfce2('0x2')]},'filename':{'type':Sequelize[_0xfce2('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xfce2('0x3')],'get':function(){var _0x11689b='';var _0x1114b0=this[_0xfce2('0x4')](_0xfce2('0x5'));if(_0x1114b0){_0x11689b=_0x1114b0[_0xfce2('0x6')](_0x1114b0['lastIndexOf']('.'));}return _0x11689b;}}}; \ No newline at end of file +var _0xa0c1=['exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize'];(function(_0x23a627,_0x5e79b6){var _0x2914d1=function(_0x5e027f){while(--_0x5e027f){_0x23a627['push'](_0x23a627['shift']());}};_0x2914d1(++_0x5e79b6);}(_0xa0c1,0x8f));var _0x1a0c=function(_0x579942,_0x52aa4b){_0x579942=_0x579942-0x0;var _0xc30e5=_0xa0c1[_0x579942];return _0xc30e5;};'use strict';var Sequelize=require(_0x1a0c('0x0'));module[_0x1a0c('0x1')]={'uniqueid':{'type':Sequelize[_0x1a0c('0x2')]},'callerid':{'type':Sequelize[_0x1a0c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x1a0c('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x1a0c('0x2')]},'filename':{'type':Sequelize[_0x1a0c('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x1a0c('0x3')],'get':function(){var _0x5430ac='';var _0x1943e6=this[_0x1a0c('0x4')](_0x1a0c('0x5'));if(_0x1943e6){_0x5430ac=_0x1943e6[_0x1a0c('0x6')](_0x1943e6[_0x1a0c('0x7')]('.'));}return _0x5430ac;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index db605c4..c9e3400 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 _0x2106=['fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','SquareRecording','include','findAll','rows','catch','show','length','includeAll','find','create','body','params','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','SquareRecording\x20not\x20found','filename','extname','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','unlinkSync','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','index','fieldName','model','keys','filters','intersection','query'];(function(_0x4d3784,_0x5c9c27){var _0x188438=function(_0x1cf7de){while(--_0x1cf7de){_0x4d3784['push'](_0x4d3784['shift']());}};_0x188438(++_0x5c9c27);}(_0x2106,0x159));var _0x6210=function(_0x54b1a3,_0x26f7aa){_0x54b1a3=_0x54b1a3-0x0;var _0x49dba6=_0x2106[_0x54b1a3];return _0x49dba6;};'use strict';var emlformat=require(_0x6210('0x0'));var rimraf=require(_0x6210('0x1'));var zipdir=require(_0x6210('0x2'));var jsonpatch=require(_0x6210('0x3'));var rp=require(_0x6210('0x4'));var moment=require(_0x6210('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6210('0x6'));var path=require(_0x6210('0x7'));var sox=require(_0x6210('0x8'));var csv=require(_0x6210('0x9'));var ejs=require(_0x6210('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6210('0xb'));var crypto=require(_0x6210('0xc'));var jsforce=require(_0x6210('0xd'));var deskjs=require(_0x6210('0xe'));var toCsv=require(_0x6210('0x9'));var querystring=require(_0x6210('0xf'));var Papa=require(_0x6210('0x10'));var Redis=require(_0x6210('0x11'));var authService=require(_0x6210('0x12'));var qs=require(_0x6210('0x13'));var as=require(_0x6210('0x14'));var hardwareService=require(_0x6210('0x15'));var logger=require(_0x6210('0x16'))(_0x6210('0x17'));var utils=require(_0x6210('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x6210('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14734e,_0x3d2023){_0x3d2023=_0x3d2023||0xcc;return function(_0x24c42e){if(_0x24c42e){return _0x14734e['sendStatus'](_0x3d2023);}return _0x14734e['status'](_0x3d2023)[_0x6210('0x1a')]();};}function respondWithResult(_0x48d735,_0x40b8b7){_0x40b8b7=_0x40b8b7||0xc8;return function(_0x166d11){if(_0x166d11){return _0x48d735[_0x6210('0x1b')](_0x40b8b7)[_0x6210('0x1c')](_0x166d11);}};}function respondWithFilteredResult(_0x27ac54,_0x5d52f9){return function(_0x238be2){if(_0x238be2){var _0x29ae10=typeof _0x5d52f9[_0x6210('0x1d')]===_0x6210('0x1e')&&typeof _0x5d52f9[_0x6210('0x1f')]==='undefined';var _0x27c97c=_0x238be2[_0x6210('0x20')];var _0x49703e=_0x29ae10?0x0:_0x5d52f9[_0x6210('0x1d')];var _0x48e59a=_0x29ae10?_0x238be2['count']:_0x5d52f9[_0x6210('0x1d')]+_0x5d52f9['limit'];var _0x38e57e;if(_0x48e59a>=_0x27c97c){_0x48e59a=_0x27c97c;_0x38e57e=0xc8;}else{_0x38e57e=0xce;}_0x27ac54[_0x6210('0x1b')](_0x38e57e);return _0x27ac54[_0x6210('0x21')](_0x6210('0x22'),_0x49703e+'-'+_0x48e59a+'/'+_0x27c97c)['json'](_0x238be2);}return null;};}function patchUpdates(_0x42085f){return function(_0x4180f0){try{jsonpatch['apply'](_0x4180f0,_0x42085f,!![]);}catch(_0x383f32){return BPromise['reject'](_0x383f32);}return _0x4180f0[_0x6210('0x23')]();};}function saveUpdates(_0xe9aa48,_0x2af857){return function(_0x3bb0b4){if(_0x3bb0b4){return _0x3bb0b4[_0x6210('0x24')](_0xe9aa48)[_0x6210('0x25')](function(_0x369f0e){return _0x369f0e;});}return null;};}function removeEntity(_0x568f79,_0x233718){return function(_0x1a88bd){if(_0x1a88bd){return _0x1a88bd[_0x6210('0x26')]()[_0x6210('0x25')](function(){_0x568f79[_0x6210('0x1b')](0xcc)[_0x6210('0x1a')]();});}};}function handleEntityNotFound(_0x4b3662,_0x205c7e){return function(_0x3a07fa){if(!_0x3a07fa){_0x4b3662[_0x6210('0x27')](0x194);}return _0x3a07fa;};}function handleError(_0xf349c0,_0x1d9528){_0x1d9528=_0x1d9528||0x1f4;return function(_0x2bc23b){logger[_0x6210('0x28')](_0x2bc23b[_0x6210('0x29')]);if(_0x2bc23b[_0x6210('0x2a')]){delete _0x2bc23b['name'];}_0xf349c0[_0x6210('0x1b')](_0x1d9528)[_0x6210('0x2b')](_0x2bc23b);};}exports[_0x6210('0x2c')]=function(_0x45bb48,_0x2ebc78){var _0x14a7c4={},_0x246627={},_0x2a3cdd={'count':0x0,'rows':[]};var _0x283869=_['map'](db['SquareRecording']['rawAttributes'],function(_0x901821){return{'name':_0x901821[_0x6210('0x2d')],'type':_0x901821['type']['key']};});_0x246627[_0x6210('0x2e')]=_['map'](_0x283869,_0x6210('0x2a'));_0x246627['query']=_[_0x6210('0x2f')](_0x45bb48['query']);_0x246627[_0x6210('0x30')]=_[_0x6210('0x31')](_0x246627[_0x6210('0x2e')],_0x246627[_0x6210('0x32')]);_0x14a7c4['attributes']=_[_0x6210('0x31')](_0x246627['model'],qs[_0x6210('0x33')](_0x45bb48[_0x6210('0x32')][_0x6210('0x33')]));_0x14a7c4[_0x6210('0x34')]=_0x14a7c4['attributes']['length']?_0x14a7c4[_0x6210('0x34')]:_0x246627[_0x6210('0x2e')];if(!_0x45bb48['query'][_0x6210('0x35')](_0x6210('0x36'))){_0x14a7c4['limit']=qs[_0x6210('0x1f')](_0x45bb48[_0x6210('0x32')][_0x6210('0x1f')]);_0x14a7c4[_0x6210('0x1d')]=qs[_0x6210('0x1d')](_0x45bb48[_0x6210('0x32')][_0x6210('0x1d')]);}_0x14a7c4[_0x6210('0x37')]=qs[_0x6210('0x38')](_0x45bb48[_0x6210('0x32')][_0x6210('0x38')]);_0x14a7c4[_0x6210('0x39')]=qs[_0x6210('0x30')](_[_0x6210('0x3a')](_0x45bb48['query'],_0x246627['filters']),_0x283869);if(_0x45bb48['query'][_0x6210('0x3b')]){_0x14a7c4[_0x6210('0x39')]=_[_0x6210('0x3c')](_0x14a7c4[_0x6210('0x39')],{'$or':_[_0x6210('0x3d')](_0x283869,function(_0x37b10e){if(_0x37b10e[_0x6210('0x3e')]!==_0x6210('0x3f')){var _0xf229b9={};_0xf229b9[_0x37b10e['name']]={'$like':'%'+_0x45bb48[_0x6210('0x32')][_0x6210('0x3b')]+'%'};return _0xf229b9;}})});}_0x14a7c4=_[_0x6210('0x3c')]({},_0x14a7c4,_0x45bb48[_0x6210('0x40')]);var _0x4c2b21={'where':_0x14a7c4[_0x6210('0x39')]};return db[_0x6210('0x41')][_0x6210('0x20')](_0x4c2b21)[_0x6210('0x25')](function(_0x488441){_0x2a3cdd['count']=_0x488441;if(_0x45bb48[_0x6210('0x32')]['includeAll']){_0x14a7c4[_0x6210('0x42')]=[{'all':!![]}];}return db[_0x6210('0x41')][_0x6210('0x43')](_0x14a7c4);})[_0x6210('0x25')](function(_0x91cf2f){_0x2a3cdd[_0x6210('0x44')]=_0x91cf2f;return _0x2a3cdd;})[_0x6210('0x25')](respondWithFilteredResult(_0x2ebc78,_0x14a7c4))[_0x6210('0x45')](handleError(_0x2ebc78,null));};exports[_0x6210('0x46')]=function(_0x54e62a,_0x2bcffc){var _0x3b4f45={'raw':!![],'where':{'id':_0x54e62a['params']['id']}},_0x17d481={};_0x17d481[_0x6210('0x2e')]=_['keys'](db[_0x6210('0x41')]['rawAttributes']);_0x17d481[_0x6210('0x32')]=_[_0x6210('0x2f')](_0x54e62a[_0x6210('0x32')]);_0x17d481['filters']=_[_0x6210('0x31')](_0x17d481[_0x6210('0x2e')],_0x17d481[_0x6210('0x32')]);_0x3b4f45[_0x6210('0x34')]=_['intersection'](_0x17d481[_0x6210('0x2e')],qs[_0x6210('0x33')](_0x54e62a['query'][_0x6210('0x33')]));_0x3b4f45[_0x6210('0x34')]=_0x3b4f45[_0x6210('0x34')][_0x6210('0x47')]?_0x3b4f45[_0x6210('0x34')]:_0x17d481[_0x6210('0x2e')];if(_0x54e62a['query'][_0x6210('0x48')]){_0x3b4f45[_0x6210('0x42')]=[{'all':!![]}];}_0x3b4f45=_[_0x6210('0x3c')]({},_0x3b4f45,_0x54e62a[_0x6210('0x40')]);return db[_0x6210('0x41')][_0x6210('0x49')](_0x3b4f45)[_0x6210('0x25')](handleEntityNotFound(_0x2bcffc,null))['then'](respondWithResult(_0x2bcffc,null))['catch'](handleError(_0x2bcffc,null));};exports[_0x6210('0x4a')]=function(_0x5806ef,_0x27f4ea){return db[_0x6210('0x41')][_0x6210('0x4a')](_0x5806ef['body'],{})[_0x6210('0x25')](respondWithResult(_0x27f4ea,0xc9))[_0x6210('0x45')](handleError(_0x27f4ea,null));};exports['update']=function(_0x24b255,_0x4f6574){if(_0x24b255['body']['id']){delete _0x24b255[_0x6210('0x4b')]['id'];}return db[_0x6210('0x41')][_0x6210('0x49')]({'where':{'id':_0x24b255[_0x6210('0x4c')]['id']}})[_0x6210('0x25')](handleEntityNotFound(_0x4f6574,null))['then'](saveUpdates(_0x24b255[_0x6210('0x4b')],null))[_0x6210('0x25')](respondWithResult(_0x4f6574,null))['catch'](handleError(_0x4f6574,null));};exports[_0x6210('0x4d')]=function(_0x506add,_0x460bf4,_0x37e5fe){var _0xf38d31=require(_0x6210('0x4e'));var _0x3fda34=![];var _0xa9c396={};if(_0x506add[_0x6210('0x32')][_0x6210('0x3e')]&&_0x506add[_0x6210('0x32')][_0x6210('0x3e')]===_0x6210('0x4f')){_0xa9c396[_0x6210('0x4f')]=_0x506add[_0x6210('0x4c')]['id'];}else{_0xa9c396['id']=_0x506add['params']['id'];}return db[_0x6210('0x41')][_0x6210('0x49')]({'where':_0xa9c396,'attributes':['id',_0x6210('0x50'),'filename'],'raw':!![]})[_0x6210('0x25')](handleEntityNotFound(_0x460bf4,null))[_0x6210('0x25')](function(_0x316680){if(_0x316680){var _0x9091b8=_0x316680['savePath'];var _0x2710f3=util[_0x6210('0x51')](_0x6210('0x52'),_0x9091b8);if(fs['existsSync'](_0x2710f3)){_0x3fda34=!![];return _0xf38d31[_0x6210('0x53')](_0x2710f3,_0x9091b8,config[_0x6210('0x54')][_0x6210('0x55')])[_0x6210('0x25')](function(){return _0x316680;});}return _0x316680;}})[_0x6210('0x25')](function(_0x34137a){if(_0x34137a){var _0x48c096=_0x34137a[_0x6210('0x50')];if(!fs[_0x6210('0x56')](_0x48c096)){throw new db[(_0x6210('0x57'))]['ValidationError'](_0x6210('0x58'));}if(_0x34137a[_0x6210('0x59')]){return _0x460bf4[_0x6210('0x4d')](_0x48c096,_0x34137a[_0x6210('0x59')]+path[_0x6210('0x5a')](_0x48c096),function(){if(_0x3fda34){fs[_0x6210('0x5b')](_0x48c096);}});}else{return _0x460bf4[_0x6210('0x4d')](_0x48c096,function(_0x88ed05){if(_0x3fda34){fs[_0x6210('0x5b')](_0x48c096);}});}}})[_0x6210('0x45')](function(_0x492a50){if(_0x492a50['message']==='SquareRecording\x20not\x20found'){_0x460bf4['status'](0x194)['send'](_0x6210('0x5c'));}else{return handleError(_0x460bf4,null);}});};exports[_0x6210('0x26')]=function(_0x2338fe,_0x10a868){return db[_0x6210('0x41')]['find']({'where':{'id':_0x2338fe[_0x6210('0x4c')]['id']}})[_0x6210('0x25')](function(_0x485b30){if(_[_0x6210('0x5d')](_0x485b30)){throw new ReferenceError(_0x6210('0x5e'));}return _0x485b30;})['then'](function(_0x14a205){var _0xe1959a=_0x14a205['savePath'];logger[_0x6210('0x5f')](_0x6210('0x60'),_0xe1959a);if(!_['isNil'](_0x14a205[_0x6210('0x50')])&&fs[_0x6210('0x56')](_0xe1959a)){logger['info']('File:\x20\x22'+_0xe1959a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6210('0x61')](_0xe1959a);}_0xe1959a=_0xe1959a+'.cypher';if(!_[_0x6210('0x5d')](_0x14a205[_0x6210('0x50')])&&fs[_0x6210('0x56')](_0xe1959a)){logger[_0x6210('0x5f')](_0x6210('0x62')+_0xe1959a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6210('0x61')](_0xe1959a);}return _0x14a205;})['then'](function(_0x363ef4){if(!_0x363ef4)throw new InternalError();return _0x363ef4[_0x6210('0x26')]();})[_0x6210('0x25')](function(){_0x10a868[_0x6210('0x1b')](0xcc)[_0x6210('0x1a')]();})[_0x6210('0x45')](handleError(_0x10a868,null));}; \ No newline at end of file +var _0xfbf5=['send','index','map','SquareRecording','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','find','create','body','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','recording','Sequelize','ValidationError','download','extname','unlink','message','SquareRecording\x20not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','end','eml-format','rimraf','fast-json-patch','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name'];(function(_0x598b6f,_0x55690f){var _0x40959f=function(_0x5b23af){while(--_0x5b23af){_0x598b6f['push'](_0x598b6f['shift']());}};_0x40959f(++_0x55690f);}(_0xfbf5,0x149));var _0x5fbf=function(_0x36958a,_0x632cfa){_0x36958a=_0x36958a-0x0;var _0x4427ea=_0xfbf5[_0x36958a];return _0x4427ea;};'use strict';var emlformat=require(_0x5fbf('0x0'));var rimraf=require(_0x5fbf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5fbf('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5fbf('0x3'));var util=require('util');var path=require(_0x5fbf('0x4'));var sox=require(_0x5fbf('0x5'));var csv=require(_0x5fbf('0x6'));var ejs=require(_0x5fbf('0x7'));var fs=require('fs');var fs_extra=require(_0x5fbf('0x8'));var _=require(_0x5fbf('0x9'));var squel=require(_0x5fbf('0xa'));var crypto=require('crypto');var jsforce=require(_0x5fbf('0xb'));var deskjs=require(_0x5fbf('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5fbf('0xd'));var Papa=require(_0x5fbf('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5fbf('0xf'));var hardwareService=require(_0x5fbf('0x10'));var logger=require(_0x5fbf('0x11'))('api');var utils=require(_0x5fbf('0x12'));var config=require(_0x5fbf('0x13'));var licenseUtil=require(_0x5fbf('0x14'));var db=require(_0x5fbf('0x15'))['db'];function respondWithStatusCode(_0xcda3b,_0xf902cc){_0xf902cc=_0xf902cc||0xcc;return function(_0x3df72a){if(_0x3df72a){return _0xcda3b['sendStatus'](_0xf902cc);}return _0xcda3b[_0x5fbf('0x16')](_0xf902cc)['end']();};}function respondWithResult(_0x673e10,_0x1acad4){_0x1acad4=_0x1acad4||0xc8;return function(_0x2e31b7){if(_0x2e31b7){return _0x673e10[_0x5fbf('0x16')](_0x1acad4)[_0x5fbf('0x17')](_0x2e31b7);}};}function respondWithFilteredResult(_0x2027bf,_0x349f77){return function(_0x563bb5){if(_0x563bb5){var _0x495df1=typeof _0x349f77['offset']===_0x5fbf('0x18')&&typeof _0x349f77[_0x5fbf('0x19')]==='undefined';var _0x261f70=_0x563bb5[_0x5fbf('0x1a')];var _0x47a139=_0x495df1?0x0:_0x349f77[_0x5fbf('0x1b')];var _0x5bc217=_0x495df1?_0x563bb5[_0x5fbf('0x1a')]:_0x349f77[_0x5fbf('0x1b')]+_0x349f77['limit'];var _0x3a05bd;if(_0x5bc217>=_0x261f70){_0x5bc217=_0x261f70;_0x3a05bd=0xc8;}else{_0x3a05bd=0xce;}_0x2027bf[_0x5fbf('0x16')](_0x3a05bd);return _0x2027bf[_0x5fbf('0x1c')](_0x5fbf('0x1d'),_0x47a139+'-'+_0x5bc217+'/'+_0x261f70)[_0x5fbf('0x17')](_0x563bb5);}return null;};}function patchUpdates(_0x301816){return function(_0x31c639){try{jsonpatch['apply'](_0x31c639,_0x301816,!![]);}catch(_0x2cdc8c){return BPromise[_0x5fbf('0x1e')](_0x2cdc8c);}return _0x31c639[_0x5fbf('0x1f')]();};}function saveUpdates(_0x6b61ca,_0x341bcc){return function(_0x5e3ec6){if(_0x5e3ec6){return _0x5e3ec6[_0x5fbf('0x20')](_0x6b61ca)['then'](function(_0x317c4a){return _0x317c4a;});}return null;};}function removeEntity(_0x1b685a,_0x83f53a){return function(_0x5befea){if(_0x5befea){return _0x5befea[_0x5fbf('0x21')]()[_0x5fbf('0x22')](function(){_0x1b685a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1daea9,_0x3610ba){return function(_0x42820a){if(!_0x42820a){_0x1daea9[_0x5fbf('0x23')](0x194);}return _0x42820a;};}function handleError(_0x630f67,_0x3b120d){_0x3b120d=_0x3b120d||0x1f4;return function(_0x3c6b9f){logger[_0x5fbf('0x24')](_0x3c6b9f[_0x5fbf('0x25')]);if(_0x3c6b9f[_0x5fbf('0x26')]){delete _0x3c6b9f[_0x5fbf('0x26')];}_0x630f67['status'](_0x3b120d)[_0x5fbf('0x27')](_0x3c6b9f);};}exports[_0x5fbf('0x28')]=function(_0x9ad46d,_0xedc230){var _0x3f120={},_0x4eea1b={},_0x303b4c={'count':0x0,'rows':[]};var _0x1602c8=_[_0x5fbf('0x29')](db[_0x5fbf('0x2a')]['rawAttributes'],function(_0x10a32d){return{'name':_0x10a32d[_0x5fbf('0x2b')],'type':_0x10a32d[_0x5fbf('0x2c')][_0x5fbf('0x2d')]};});_0x4eea1b[_0x5fbf('0x2e')]=_[_0x5fbf('0x29')](_0x1602c8,_0x5fbf('0x26'));_0x4eea1b['query']=_[_0x5fbf('0x2f')](_0x9ad46d[_0x5fbf('0x30')]);_0x4eea1b[_0x5fbf('0x31')]=_['intersection'](_0x4eea1b[_0x5fbf('0x2e')],_0x4eea1b[_0x5fbf('0x30')]);_0x3f120[_0x5fbf('0x32')]=_[_0x5fbf('0x33')](_0x4eea1b[_0x5fbf('0x2e')],qs['fields'](_0x9ad46d[_0x5fbf('0x30')][_0x5fbf('0x34')]));_0x3f120[_0x5fbf('0x32')]=_0x3f120[_0x5fbf('0x32')][_0x5fbf('0x35')]?_0x3f120[_0x5fbf('0x32')]:_0x4eea1b[_0x5fbf('0x2e')];if(!_0x9ad46d[_0x5fbf('0x30')][_0x5fbf('0x36')](_0x5fbf('0x37'))){_0x3f120[_0x5fbf('0x19')]=qs[_0x5fbf('0x19')](_0x9ad46d[_0x5fbf('0x30')]['limit']);_0x3f120[_0x5fbf('0x1b')]=qs[_0x5fbf('0x1b')](_0x9ad46d[_0x5fbf('0x30')][_0x5fbf('0x1b')]);}_0x3f120['order']=qs[_0x5fbf('0x38')](_0x9ad46d[_0x5fbf('0x30')][_0x5fbf('0x38')]);_0x3f120[_0x5fbf('0x39')]=qs[_0x5fbf('0x31')](_[_0x5fbf('0x3a')](_0x9ad46d['query'],_0x4eea1b['filters']),_0x1602c8);if(_0x9ad46d[_0x5fbf('0x30')][_0x5fbf('0x3b')]){_0x3f120[_0x5fbf('0x39')]=_[_0x5fbf('0x3c')](_0x3f120[_0x5fbf('0x39')],{'$or':_[_0x5fbf('0x29')](_0x1602c8,function(_0x13457d){if(_0x13457d['type']!==_0x5fbf('0x3d')){var _0xdc0e31={};_0xdc0e31[_0x13457d[_0x5fbf('0x26')]]={'$like':'%'+_0x9ad46d[_0x5fbf('0x30')][_0x5fbf('0x3b')]+'%'};return _0xdc0e31;}})});}_0x3f120=_[_0x5fbf('0x3c')]({},_0x3f120,_0x9ad46d['options']);var _0x5cc7dc={'where':_0x3f120[_0x5fbf('0x39')]};return db[_0x5fbf('0x2a')][_0x5fbf('0x1a')](_0x5cc7dc)[_0x5fbf('0x22')](function(_0x2f3b05){_0x303b4c[_0x5fbf('0x1a')]=_0x2f3b05;if(_0x9ad46d[_0x5fbf('0x30')][_0x5fbf('0x3e')]){_0x3f120[_0x5fbf('0x3f')]=[{'all':!![]}];}return db[_0x5fbf('0x2a')][_0x5fbf('0x40')](_0x3f120);})[_0x5fbf('0x22')](function(_0x20cc9b){_0x303b4c[_0x5fbf('0x41')]=_0x20cc9b;return _0x303b4c;})[_0x5fbf('0x22')](respondWithFilteredResult(_0xedc230,_0x3f120))[_0x5fbf('0x42')](handleError(_0xedc230,null));};exports['show']=function(_0x5a674a,_0x3a9487){var _0x2c8e66={'raw':!![],'where':{'id':_0x5a674a['params']['id']}},_0x1a036b={};_0x1a036b[_0x5fbf('0x2e')]=_[_0x5fbf('0x2f')](db[_0x5fbf('0x2a')]['rawAttributes']);_0x1a036b[_0x5fbf('0x30')]=_[_0x5fbf('0x2f')](_0x5a674a[_0x5fbf('0x30')]);_0x1a036b[_0x5fbf('0x31')]=_[_0x5fbf('0x33')](_0x1a036b[_0x5fbf('0x2e')],_0x1a036b[_0x5fbf('0x30')]);_0x2c8e66[_0x5fbf('0x32')]=_[_0x5fbf('0x33')](_0x1a036b[_0x5fbf('0x2e')],qs[_0x5fbf('0x34')](_0x5a674a[_0x5fbf('0x30')]['fields']));_0x2c8e66['attributes']=_0x2c8e66[_0x5fbf('0x32')]['length']?_0x2c8e66[_0x5fbf('0x32')]:_0x1a036b[_0x5fbf('0x2e')];if(_0x5a674a[_0x5fbf('0x30')]['includeAll']){_0x2c8e66[_0x5fbf('0x3f')]=[{'all':!![]}];}_0x2c8e66=_[_0x5fbf('0x3c')]({},_0x2c8e66,_0x5a674a['options']);return db['SquareRecording'][_0x5fbf('0x43')](_0x2c8e66)['then'](handleEntityNotFound(_0x3a9487,null))[_0x5fbf('0x22')](respondWithResult(_0x3a9487,null))[_0x5fbf('0x42')](handleError(_0x3a9487,null));};exports[_0x5fbf('0x44')]=function(_0x440246,_0x8415e3){return db[_0x5fbf('0x2a')][_0x5fbf('0x44')](_0x440246[_0x5fbf('0x45')],{})[_0x5fbf('0x22')](respondWithResult(_0x8415e3,0xc9))['catch'](handleError(_0x8415e3,null));};exports[_0x5fbf('0x20')]=function(_0x5064ff,_0x1ed57a){if(_0x5064ff[_0x5fbf('0x45')]['id']){delete _0x5064ff[_0x5fbf('0x45')]['id'];}return db[_0x5fbf('0x2a')]['find']({'where':{'id':_0x5064ff['params']['id']}})['then'](handleEntityNotFound(_0x1ed57a,null))[_0x5fbf('0x22')](saveUpdates(_0x5064ff[_0x5fbf('0x45')],null))[_0x5fbf('0x22')](respondWithResult(_0x1ed57a,null))['catch'](handleError(_0x1ed57a,null));};exports['download']=function(_0x10ec47,_0x425521,_0xb10d73){var _0x4def88=require(_0x5fbf('0x46'));var _0x212756=![];var _0x559291={};if(_0x10ec47[_0x5fbf('0x30')][_0x5fbf('0x2c')]&&_0x10ec47[_0x5fbf('0x30')][_0x5fbf('0x2c')]===_0x5fbf('0x47')){_0x559291[_0x5fbf('0x47')]=_0x10ec47['params']['id'];}else{_0x559291['id']=_0x10ec47['params']['id'];}return db[_0x5fbf('0x2a')][_0x5fbf('0x43')]({'where':_0x559291,'attributes':['id',_0x5fbf('0x48'),_0x5fbf('0x49')],'raw':!![]})[_0x5fbf('0x22')](handleEntityNotFound(_0x425521,null))[_0x5fbf('0x22')](function(_0x2eb304){if(_0x2eb304){var _0x31d3e3=_0x2eb304[_0x5fbf('0x48')];var _0x1b5fe7=util[_0x5fbf('0x4a')]('%s.cypher',_0x31d3e3);if(fs[_0x5fbf('0x4b')](_0x1b5fe7)){_0x212756=!![];return _0x4def88['decryptFile'](_0x1b5fe7,_0x31d3e3,config['secrets'][_0x5fbf('0x4c')])[_0x5fbf('0x22')](function(){return _0x2eb304;});}return _0x2eb304;}})[_0x5fbf('0x22')](function(_0x38fc10){if(_0x38fc10){var _0x584e9f=_0x38fc10[_0x5fbf('0x48')];if(!fs[_0x5fbf('0x4b')](_0x584e9f)){throw new db[(_0x5fbf('0x4d'))][(_0x5fbf('0x4e'))]('SquareRecording\x20not\x20found');}if(_0x38fc10[_0x5fbf('0x49')]){return _0x425521[_0x5fbf('0x4f')](_0x584e9f,_0x38fc10[_0x5fbf('0x49')]+path[_0x5fbf('0x50')](_0x584e9f),function(){if(_0x212756){fs[_0x5fbf('0x51')](_0x584e9f);}});}else{return _0x425521[_0x5fbf('0x4f')](_0x584e9f,function(_0x4f56a8){if(_0x212756){fs[_0x5fbf('0x51')](_0x584e9f);}});}}})[_0x5fbf('0x42')](function(_0x2546a1){if(_0x2546a1[_0x5fbf('0x52')]===_0x5fbf('0x53')){_0x425521['status'](0x194)[_0x5fbf('0x27')]('Not\x20found');}else{return handleError(_0x425521,null);}});};exports[_0x5fbf('0x21')]=function(_0x4331e1,_0x1940e9){return db['SquareRecording'][_0x5fbf('0x43')]({'where':{'id':_0x4331e1['params']['id']}})[_0x5fbf('0x22')](function(_0x2d3023){if(_[_0x5fbf('0x54')](_0x2d3023)){throw new ReferenceError(_0x5fbf('0x55'));}return _0x2d3023;})[_0x5fbf('0x22')](function(_0xa2d150){var _0x1b1748=_0xa2d150['savePath'];logger[_0x5fbf('0x56')]('cancellazione\x20fisica\x20documento\x20%s',_0x1b1748);if(!_['isNil'](_0xa2d150['savePath'])&&fs[_0x5fbf('0x4b')](_0x1b1748)){logger['info'](_0x5fbf('0x57')+_0x1b1748+_0x5fbf('0x58'));fs[_0x5fbf('0x59')](_0x1b1748);}_0x1b1748=_0x1b1748+_0x5fbf('0x5a');if(!_[_0x5fbf('0x54')](_0xa2d150[_0x5fbf('0x48')])&&fs[_0x5fbf('0x4b')](_0x1b1748)){logger[_0x5fbf('0x56')]('File:\x20\x22'+_0x1b1748+_0x5fbf('0x58'));fs[_0x5fbf('0x59')](_0x1b1748);}return _0xa2d150;})['then'](function(_0x4bb781){if(!_0x4bb781)throw new InternalError();return _0x4bb781[_0x5fbf('0x21')]();})[_0x5fbf('0x22')](function(){_0x1940e9['status'](0xcc)[_0x5fbf('0x5b')]();})['catch'](handleError(_0x1940e9,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 250c0a3..eccb3b0 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 _0x55f1=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','SquareRecording','square_recordings','lodash'];(function(_0x2c0bf4,_0xeffab){var _0x7e0598=function(_0x829b9e){while(--_0x829b9e){_0x2c0bf4['push'](_0x2c0bf4['shift']());}};_0x7e0598(++_0xeffab);}(_0x55f1,0x9b));var _0x155f=function(_0x595115,_0x1410e1){_0x595115=_0x595115-0x0;var _0x10d2a9=_0x55f1[_0x595115];return _0x10d2a9;};'use strict';var _=require(_0x155f('0x0'));var util=require('util');var logger=require(_0x155f('0x1'))(_0x155f('0x2'));var moment=require(_0x155f('0x3'));var BPromise=require(_0x155f('0x4'));var rp=require(_0x155f('0x5'));var fs=require('fs');var path=require(_0x155f('0x6'));var rimraf=require(_0x155f('0x7'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0x155f('0x8')]=function(_0x4bf0f6,_0x8565ec){return _0x4bf0f6[_0x155f('0x9')](_0x155f('0xa'),attributes,{'tableName':_0x155f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8227=['request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','util','api','moment','bluebird'];(function(_0x9eb367,_0x31ae6d){var _0x26f71f=function(_0x49f27f){while(--_0x49f27f){_0x9eb367['push'](_0x9eb367['shift']());}};_0x26f71f(++_0x31ae6d);}(_0x8227,0x146));var _0x7822=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8227[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7822('0x0'));var logger=require('../../config/logger')(_0x7822('0x1'));var moment=require(_0x7822('0x2'));var BPromise=require(_0x7822('0x3'));var rp=require(_0x7822('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7822('0x5'));var config=require(_0x7822('0x6'));var attributes=require(_0x7822('0x7'));module[_0x7822('0x8')]=function(_0x38f333,_0x1ae126){return _0x38f333[_0x7822('0x9')](_0x7822('0xa'),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 1ac424e..f9367b8 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 _0xf6c6=['stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','options','raw','debug','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent'];(function(_0x41807a,_0x15ab0a){var _0x44d0f1=function(_0x58d405){while(--_0x58d405){_0x41807a['push'](_0x41807a['shift']());}};_0x44d0f1(++_0x15ab0a);}(_0xf6c6,0x144));var _0x6f6c=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xf6c6[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x6f6c('0x0'));var util=require(_0x6f6c('0x1'));var moment=require(_0x6f6c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6f6c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6f6c('0x4'));var logger=require(_0x6f6c('0x5'))(_0x6f6c('0x6'));var config=require(_0x6f6c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6f6c('0x8')][_0x6f6c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28ea24,_0x59d9be,_0x4022df){return new BPromise(function(_0x5b57fd,_0x548e14){return client['request'](_0x28ea24,_0x4022df)[_0x6f6c('0xa')](function(_0x507795){logger[_0x6f6c('0xb')](_0x6f6c('0xc'),_0x59d9be,_0x6f6c('0xd'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x59d9be,'request\x20sent',JSON[_0x6f6c('0xe')](_0x507795));if(_0x507795[_0x6f6c('0xf')]){if(_0x507795['error'][_0x6f6c('0x10')]===0x1f4){logger[_0x6f6c('0xf')](_0x6f6c('0xc'),_0x59d9be,_0x507795['error'][_0x6f6c('0x11')]);return _0x548e14(_0x507795[_0x6f6c('0xf')]['message']);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x59d9be,_0x507795['error']['message']);return _0x5b57fd(_0x507795[_0x6f6c('0xf')]['message']);}else{logger[_0x6f6c('0xb')](_0x6f6c('0xc'),_0x59d9be,'request\x20sent');_0x5b57fd(_0x507795[_0x6f6c('0x12')]['message']);}})[_0x6f6c('0x13')](function(_0x49c1d5){logger['error'](_0x6f6c('0xc'),_0x59d9be,_0x49c1d5);_0x548e14(_0x49c1d5);});});}exports[_0x6f6c('0x14')]=function(_0x1bc15b){var _0x142c42=this;return new Promise(function(_0x7bad5,_0x403c17){return db[_0x6f6c('0x15')][_0x6f6c('0x16')](_0x1bc15b['body'],{'raw':_0x1bc15b[_0x6f6c('0x17')]?_0x1bc15b['options'][_0x6f6c('0x18')]===undefined?!![]:![]:!![]})[_0x6f6c('0xa')](function(_0x344b28){logger['info'](_0x6f6c('0x14'),_0x1bc15b);logger[_0x6f6c('0x19')]('CreateSquareRecording',_0x1bc15b,JSON['stringify'](_0x344b28));_0x7bad5(_0x344b28);})[_0x6f6c('0x13')](function(_0xbdecc7){logger['error'](_0x6f6c('0x14'),_0xbdecc7[_0x6f6c('0x11')],_0x1bc15b);_0x403c17(_0x142c42[_0x6f6c('0xf')](0x1f4,_0xbdecc7[_0x6f6c('0x11')]));});});}; \ No newline at end of file +var _0x80cd=['http','request','then','info','request\x20sent','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','catch','SquareRecording','create','body','options','CreateSquareRecording','debug','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x2bb1bd,_0x4a7df1){var _0x216550=function(_0x2f1e03){while(--_0x2f1e03){_0x2bb1bd['push'](_0x2bb1bd['shift']());}};_0x216550(++_0x4a7df1);}(_0x80cd,0xf3));var _0xd80c=function(_0x3048ea,_0x3838c2){_0x3048ea=_0x3048ea-0x0;var _0x1a13c4=_0x80cd[_0x3048ea];return _0x1a13c4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd80c('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd80c('0x1'));var db=require(_0xd80c('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd80c('0x3'));var config=require(_0xd80c('0x4'));var jayson=require(_0xd80c('0x5'));var client=jayson[_0xd80c('0x6')][_0xd80c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x203ae3,_0x380d23,_0x49bec9){return new BPromise(function(_0x4c0443,_0x942841){return client[_0xd80c('0x8')](_0x203ae3,_0x49bec9)[_0xd80c('0x9')](function(_0x2b7464){logger[_0xd80c('0xa')]('SquareRecording,\x20%s,\x20%s',_0x380d23,_0xd80c('0xb'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x380d23,_0xd80c('0xb'),JSON[_0xd80c('0xc')](_0x2b7464));if(_0x2b7464[_0xd80c('0xd')]){if(_0x2b7464[_0xd80c('0xd')][_0xd80c('0xe')]===0x1f4){logger[_0xd80c('0xd')](_0xd80c('0xf'),_0x380d23,_0x2b7464['error'][_0xd80c('0x10')]);return _0x942841(_0x2b7464['error'][_0xd80c('0x10')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x380d23,_0x2b7464[_0xd80c('0xd')]['message']);return _0x4c0443(_0x2b7464[_0xd80c('0xd')][_0xd80c('0x10')]);}else{logger[_0xd80c('0xa')]('SquareRecording,\x20%s,\x20%s',_0x380d23,_0xd80c('0xb'));_0x4c0443(_0x2b7464[_0xd80c('0x11')][_0xd80c('0x10')]);}})[_0xd80c('0x12')](function(_0x482837){logger[_0xd80c('0xd')](_0xd80c('0xf'),_0x380d23,_0x482837);_0x942841(_0x482837);});});}exports['CreateSquareRecording']=function(_0x1a79f3){var _0x5009c9=this;return new Promise(function(_0x5306cd,_0x20685b){return db[_0xd80c('0x13')][_0xd80c('0x14')](_0x1a79f3[_0xd80c('0x15')],{'raw':_0x1a79f3[_0xd80c('0x16')]?_0x1a79f3['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x352ff0){logger[_0xd80c('0xa')](_0xd80c('0x17'),_0x1a79f3);logger[_0xd80c('0x18')]('CreateSquareRecording',_0x1a79f3,JSON[_0xd80c('0xc')](_0x352ff0));_0x5306cd(_0x352ff0);})['catch'](function(_0x4d3ef5){logger[_0xd80c('0xd')](_0xd80c('0x17'),_0x4d3ef5[_0xd80c('0x10')],_0x1a79f3);_0x20685b(_0x5009c9[_0xd80c('0xd')](0x1f4,_0x4d3ef5[_0xd80c('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 94ad8e4..12bdcef 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 _0xef12=['../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x424ec9,_0x3d9134){var _0xeb690c=function(_0x2bf5c1){while(--_0x2bf5c1){_0x424ec9['push'](_0x424ec9['shift']());}};_0xeb690c(++_0x3d9134);}(_0xef12,0xcc));var _0x2ef1=function(_0x206b4b,_0x47a1c0){_0x206b4b=_0x206b4b-0x0;var _0x33f24a=_0xef12[_0x206b4b];return _0x33f24a;};'use strict';var multer=require('multer');var util=require(_0x2ef1('0x0'));var path=require(_0x2ef1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x2ef1('0x2'));var auth=require(_0x2ef1('0x3'));var interaction=require(_0x2ef1('0x4'));var config=require(_0x2ef1('0x5'));var controller=require(_0x2ef1('0x6'));router[_0x2ef1('0x7')]('/',auth[_0x2ef1('0x8')](),controller[_0x2ef1('0x9')]);router[_0x2ef1('0x7')](_0x2ef1('0xa'),auth[_0x2ef1('0x8')](),controller[_0x2ef1('0xb')]);router['get'](_0x2ef1('0xc'),auth[_0x2ef1('0x8')](),controller[_0x2ef1('0xd')]);router[_0x2ef1('0xe')]('/',auth[_0x2ef1('0x8')](),controller['create']);router[_0x2ef1('0xf')](_0x2ef1('0xc'),auth[_0x2ef1('0x8')](),controller[_0x2ef1('0x10')]);router[_0x2ef1('0x11')](_0x2ef1('0xc'),auth[_0x2ef1('0x8')](),controller['destroy']);module[_0x2ef1('0x12')]=router; \ No newline at end of file +var _0x29a5=['exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareReport.controller','get','index','/describe','isAuthenticated','describe','show','post','/:id','update'];(function(_0x1ddc20,_0x344515){var _0x273539=function(_0x3c3770){while(--_0x3c3770){_0x1ddc20['push'](_0x1ddc20['shift']());}};_0x273539(++_0x344515);}(_0x29a5,0x6d));var _0x529a=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x29a5[_0x4a7631];return _0x1a5a6f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x529a('0x0'));var timeout=require(_0x529a('0x1'));var express=require(_0x529a('0x2'));var router=express[_0x529a('0x3')]();var fs_extra=require(_0x529a('0x4'));var auth=require(_0x529a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x529a('0x6'));var controller=require(_0x529a('0x7'));router[_0x529a('0x8')]('/',auth['isAuthenticated'](),controller[_0x529a('0x9')]);router[_0x529a('0x8')](_0x529a('0xa'),auth[_0x529a('0xb')](),controller[_0x529a('0xc')]);router[_0x529a('0x8')]('/:id',auth[_0x529a('0xb')](),controller[_0x529a('0xd')]);router[_0x529a('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x529a('0xf'),auth[_0x529a('0xb')](),controller[_0x529a('0x10')]);router['delete']('/:id',auth[_0x529a('0xb')](),controller['destroy']);module[_0x529a('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index c60ee2f..e4318db 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 _0x4a70=['STRING','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a70,0xb0));var _0x04a7=function(_0x33155c,_0x3fdde1){_0x33155c=_0x33155c-0x0;var _0x5becf7=_0x4a70[_0x33155c];return _0x5becf7;};'use strict';var Sequelize=require(_0x04a7('0x0'));module['exports']={'network':{'type':Sequelize[_0x04a7('0x1')]},'network_script':{'type':Sequelize[_0x04a7('0x1')]},'request':{'type':Sequelize[_0x04a7('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x04a7('0x1')]},'uniqueid':{'type':Sequelize[_0x04a7('0x1')]},'version':{'type':Sequelize[_0x04a7('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x04a7('0x1')]},'callingpres':{'type':Sequelize[_0x04a7('0x1')]},'callingani2':{'type':Sequelize[_0x04a7('0x1')]},'callington':{'type':Sequelize[_0x04a7('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x04a7('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x04a7('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x04a7('0x1')]},'accountcode':{'type':Sequelize[_0x04a7('0x1')]},'threadid':{'type':Sequelize[_0x04a7('0x1')]},'project_name':{'type':Sequelize[_0x04a7('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x04a7('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x5c51=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x5c51,0x1cb));var _0x15c5=function(_0x448f8,_0x2aa1d7){_0x448f8=_0x448f8-0x0;var _0xa73126=_0x5c51[_0x448f8];return _0xa73126;};'use strict';var Sequelize=require(_0x15c5('0x0'));module[_0x15c5('0x1')]={'network':{'type':Sequelize[_0x15c5('0x2')]},'network_script':{'type':Sequelize[_0x15c5('0x2')]},'request':{'type':Sequelize[_0x15c5('0x2')]},'channel':{'type':Sequelize[_0x15c5('0x2')]},'language':{'type':Sequelize[_0x15c5('0x2')]},'type':{'type':Sequelize[_0x15c5('0x2')]},'uniqueid':{'type':Sequelize[_0x15c5('0x2')]},'version':{'type':Sequelize[_0x15c5('0x2')]},'callerid':{'type':Sequelize[_0x15c5('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x15c5('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x15c5('0x2')]},'rdnis':{'type':Sequelize[_0x15c5('0x2')]},'context':{'type':Sequelize[_0x15c5('0x2')]},'extension':{'type':Sequelize[_0x15c5('0x2')]},'priority':{'type':Sequelize[_0x15c5('0x2')]},'enhanced':{'type':Sequelize[_0x15c5('0x2')]},'accountcode':{'type':Sequelize[_0x15c5('0x2')]},'threadid':{'type':Sequelize[_0x15c5('0x2')]},'project_name':{'type':Sequelize[_0x15c5('0x2')]},'joinAt':{'type':Sequelize[_0x15c5('0x3')]},'leaveAt':{'type':Sequelize[_0x15c5('0x3')]},'bot':{'type':Sequelize[_0x15c5('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 30105a7..bfa8ad2 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 _0xfb11=['create','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','SquareReport','rawAttributes','type','key','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','rows','params','find','catch'];(function(_0x2f70ce,_0x13df00){var _0x26f263=function(_0xbc419){while(--_0xbc419){_0x2f70ce['push'](_0x2f70ce['shift']());}};_0x26f263(++_0x13df00);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xfb11[_0x2df507];return _0x1f7167;};'use strict';var emlformat=require(_0x1fb1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1fb1('0x1'));var jsonpatch=require(_0x1fb1('0x2'));var rp=require('request-promise');var moment=require(_0x1fb1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1fb1('0x4'));var util=require('util');var path=require(_0x1fb1('0x5'));var sox=require(_0x1fb1('0x6'));var csv=require('to-csv');var ejs=require(_0x1fb1('0x7'));var fs=require('fs');var fs_extra=require(_0x1fb1('0x8'));var _=require('lodash');var squel=require(_0x1fb1('0x9'));var crypto=require(_0x1fb1('0xa'));var jsforce=require(_0x1fb1('0xb'));var deskjs=require(_0x1fb1('0xc'));var toCsv=require(_0x1fb1('0xd'));var querystring=require(_0x1fb1('0xe'));var Papa=require(_0x1fb1('0xf'));var Redis=require(_0x1fb1('0x10'));var authService=require(_0x1fb1('0x11'));var qs=require(_0x1fb1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1fb1('0x13'));var logger=require('../../config/logger')(_0x1fb1('0x14'));var utils=require('../../config/utils');var config=require(_0x1fb1('0x15'));var licenseUtil=require(_0x1fb1('0x16'));var db=require(_0x1fb1('0x17'))['db'];function respondWithStatusCode(_0x10bcac,_0x333229){_0x333229=_0x333229||0xcc;return function(_0x14f290){if(_0x14f290){return _0x10bcac['sendStatus'](_0x333229);}return _0x10bcac[_0x1fb1('0x18')](_0x333229)[_0x1fb1('0x19')]();};}function respondWithResult(_0x2c5be1,_0x44f24c){_0x44f24c=_0x44f24c||0xc8;return function(_0xd83038){if(_0xd83038){return _0x2c5be1[_0x1fb1('0x18')](_0x44f24c)[_0x1fb1('0x1a')](_0xd83038);}};}function respondWithFilteredResult(_0x316fe5,_0x358b58){return function(_0x4cbe42){if(_0x4cbe42){var _0x5c8d23=typeof _0x358b58[_0x1fb1('0x1b')]===_0x1fb1('0x1c')&&typeof _0x358b58[_0x1fb1('0x1d')]==='undefined';var _0x161ca3=_0x4cbe42[_0x1fb1('0x1e')];var _0x24d4df=_0x5c8d23?0x0:_0x358b58[_0x1fb1('0x1b')];var _0x33c6b6=_0x5c8d23?_0x4cbe42[_0x1fb1('0x1e')]:_0x358b58[_0x1fb1('0x1b')]+_0x358b58[_0x1fb1('0x1d')];var _0x4041ea;if(_0x33c6b6>=_0x161ca3){_0x33c6b6=_0x161ca3;_0x4041ea=0xc8;}else{_0x4041ea=0xce;}_0x316fe5['status'](_0x4041ea);return _0x316fe5[_0x1fb1('0x1f')]('Content-Range',_0x24d4df+'-'+_0x33c6b6+'/'+_0x161ca3)['json'](_0x4cbe42);}return null;};}function patchUpdates(_0xdf9c1b){return function(_0x313d9a){try{jsonpatch[_0x1fb1('0x20')](_0x313d9a,_0xdf9c1b,!![]);}catch(_0x54ad97){return BPromise[_0x1fb1('0x21')](_0x54ad97);}return _0x313d9a['save']();};}function saveUpdates(_0x5c76f5,_0x532c63){return function(_0x31178c){if(_0x31178c){return _0x31178c[_0x1fb1('0x22')](_0x5c76f5)[_0x1fb1('0x23')](function(_0x10924f){return _0x10924f;});}return null;};}function removeEntity(_0x303a06,_0x53b8af){return function(_0x4272c7){if(_0x4272c7){return _0x4272c7[_0x1fb1('0x24')]()[_0x1fb1('0x23')](function(){_0x303a06[_0x1fb1('0x18')](0xcc)[_0x1fb1('0x19')]();});}};}function handleEntityNotFound(_0x1353a4,_0x3680b5){return function(_0x2de1d4){if(!_0x2de1d4){_0x1353a4['sendStatus'](0x194);}return _0x2de1d4;};}function handleError(_0x1b25b3,_0x1aac7d){_0x1aac7d=_0x1aac7d||0x1f4;return function(_0x46ff60){logger[_0x1fb1('0x25')](_0x46ff60[_0x1fb1('0x26')]);if(_0x46ff60[_0x1fb1('0x27')]){delete _0x46ff60[_0x1fb1('0x27')];}_0x1b25b3[_0x1fb1('0x18')](_0x1aac7d)[_0x1fb1('0x28')](_0x46ff60);};}exports[_0x1fb1('0x29')]=function(_0x5e99e7,_0x497017){var _0x39fc43={},_0xe8ec0a={},_0x2f6c88={'count':0x0,'rows':[]};var _0x520ee2=_[_0x1fb1('0x2a')](db[_0x1fb1('0x2b')][_0x1fb1('0x2c')],function(_0x1b71cb){return{'name':_0x1b71cb['fieldName'],'type':_0x1b71cb[_0x1fb1('0x2d')][_0x1fb1('0x2e')]};});_0xe8ec0a['model']=_[_0x1fb1('0x2a')](_0x520ee2,'name');_0xe8ec0a['query']=_[_0x1fb1('0x2f')](_0x5e99e7[_0x1fb1('0x30')]);_0xe8ec0a['filters']=_[_0x1fb1('0x31')](_0xe8ec0a[_0x1fb1('0x32')],_0xe8ec0a[_0x1fb1('0x30')]);_0x39fc43[_0x1fb1('0x33')]=_[_0x1fb1('0x31')](_0xe8ec0a['model'],qs[_0x1fb1('0x34')](_0x5e99e7[_0x1fb1('0x30')][_0x1fb1('0x34')]));_0x39fc43[_0x1fb1('0x33')]=_0x39fc43[_0x1fb1('0x33')][_0x1fb1('0x35')]?_0x39fc43[_0x1fb1('0x33')]:_0xe8ec0a[_0x1fb1('0x32')];if(!_0x5e99e7[_0x1fb1('0x30')]['hasOwnProperty'](_0x1fb1('0x36'))){_0x39fc43['limit']=qs[_0x1fb1('0x1d')](_0x5e99e7['query'][_0x1fb1('0x1d')]);_0x39fc43['offset']=qs['offset'](_0x5e99e7[_0x1fb1('0x30')][_0x1fb1('0x1b')]);}_0x39fc43[_0x1fb1('0x37')]=qs[_0x1fb1('0x38')](_0x5e99e7['query'][_0x1fb1('0x38')]);_0x39fc43[_0x1fb1('0x39')]=qs[_0x1fb1('0x3a')](_['pick'](_0x5e99e7[_0x1fb1('0x30')],_0xe8ec0a[_0x1fb1('0x3a')]),_0x520ee2);if(_0x5e99e7[_0x1fb1('0x30')][_0x1fb1('0x3b')]){_0x39fc43[_0x1fb1('0x39')]=_[_0x1fb1('0x3c')](_0x39fc43[_0x1fb1('0x39')],{'$or':_['map'](_0x520ee2,function(_0x3a8a63){if(_0x3a8a63[_0x1fb1('0x2d')]!=='VIRTUAL'){var _0x473894={};_0x473894[_0x3a8a63['name']]={'$like':'%'+_0x5e99e7[_0x1fb1('0x30')][_0x1fb1('0x3b')]+'%'};return _0x473894;}})});}_0x39fc43=_[_0x1fb1('0x3c')]({},_0x39fc43,_0x5e99e7[_0x1fb1('0x3d')]);var _0x1a0b32={'where':_0x39fc43[_0x1fb1('0x39')]};return db[_0x1fb1('0x2b')][_0x1fb1('0x1e')](_0x1a0b32)[_0x1fb1('0x23')](function(_0x2c023e){_0x2f6c88[_0x1fb1('0x1e')]=_0x2c023e;if(_0x5e99e7[_0x1fb1('0x30')][_0x1fb1('0x3e')]){_0x39fc43[_0x1fb1('0x3f')]=[{'all':!![]}];}return db[_0x1fb1('0x2b')]['findAll'](_0x39fc43);})[_0x1fb1('0x23')](function(_0xca1fd3){_0x2f6c88[_0x1fb1('0x40')]=_0xca1fd3;return _0x2f6c88;})[_0x1fb1('0x23')](respondWithFilteredResult(_0x497017,_0x39fc43))['catch'](handleError(_0x497017,null));};exports['show']=function(_0xf6f17d,_0xef42e0){var _0x307faf={'raw':!![],'where':{'id':_0xf6f17d[_0x1fb1('0x41')]['id']}},_0x3edc8a={};_0x3edc8a[_0x1fb1('0x32')]=_[_0x1fb1('0x2f')](db[_0x1fb1('0x2b')][_0x1fb1('0x2c')]);_0x3edc8a[_0x1fb1('0x30')]=_['keys'](_0xf6f17d[_0x1fb1('0x30')]);_0x3edc8a['filters']=_['intersection'](_0x3edc8a[_0x1fb1('0x32')],_0x3edc8a[_0x1fb1('0x30')]);_0x307faf[_0x1fb1('0x33')]=_[_0x1fb1('0x31')](_0x3edc8a['model'],qs['fields'](_0xf6f17d[_0x1fb1('0x30')][_0x1fb1('0x34')]));_0x307faf[_0x1fb1('0x33')]=_0x307faf[_0x1fb1('0x33')][_0x1fb1('0x35')]?_0x307faf[_0x1fb1('0x33')]:_0x3edc8a[_0x1fb1('0x32')];if(_0xf6f17d[_0x1fb1('0x30')][_0x1fb1('0x3e')]){_0x307faf['include']=[{'all':!![]}];}_0x307faf=_['merge']({},_0x307faf,_0xf6f17d[_0x1fb1('0x3d')]);return db['SquareReport'][_0x1fb1('0x42')](_0x307faf)[_0x1fb1('0x23')](handleEntityNotFound(_0xef42e0,null))[_0x1fb1('0x23')](respondWithResult(_0xef42e0,null))[_0x1fb1('0x43')](handleError(_0xef42e0,null));};exports[_0x1fb1('0x44')]=function(_0x3c3fbf,_0x5af135){return db[_0x1fb1('0x2b')][_0x1fb1('0x44')](_0x3c3fbf[_0x1fb1('0x45')],{})['then'](respondWithResult(_0x5af135,0xc9))[_0x1fb1('0x43')](handleError(_0x5af135,null));};exports['update']=function(_0x6e105b,_0xba4fa7){if(_0x6e105b[_0x1fb1('0x45')]['id']){delete _0x6e105b['body']['id'];}return db[_0x1fb1('0x2b')][_0x1fb1('0x42')]({'where':{'id':_0x6e105b['params']['id']}})[_0x1fb1('0x23')](handleEntityNotFound(_0xba4fa7,null))[_0x1fb1('0x23')](saveUpdates(_0x6e105b[_0x1fb1('0x45')],null))['then'](respondWithResult(_0xba4fa7,null))['catch'](handleError(_0xba4fa7,null));};exports['destroy']=function(_0x31a85a,_0x2365b5){return db[_0x1fb1('0x2b')][_0x1fb1('0x42')]({'where':{'id':_0x31a85a[_0x1fb1('0x41')]['id']}})[_0x1fb1('0x23')](handleEntityNotFound(_0x2365b5,null))['then'](removeEntity(_0x2365b5,null))['catch'](handleError(_0x2365b5,null));};exports[_0x1fb1('0x46')]=function(_0x2a6898,_0x2d03d2){return db[_0x1fb1('0x2b')]['describe']()['then'](respondWithResult(_0x2d03d2,null))[_0x1fb1('0x43')](handleError(_0x2d03d2,null));}; \ No newline at end of file +var _0x7bd0=['model','name','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','SquareReport','findAll','rows','show','keys','length','includeAll','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x5b94aa,_0x8bf6c0){var _0x1fd610=function(_0x3d2bb7){while(--_0x3d2bb7){_0x5b94aa['push'](_0x5b94aa['shift']());}};_0x1fd610(++_0x8bf6c0);}(_0x7bd0,0x111));var _0x07bd=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x7bd0[_0x3fba9f];return _0x192cf1;};'use strict';var emlformat=require(_0x07bd('0x0'));var rimraf=require(_0x07bd('0x1'));var zipdir=require(_0x07bd('0x2'));var jsonpatch=require(_0x07bd('0x3'));var rp=require(_0x07bd('0x4'));var moment=require(_0x07bd('0x5'));var BPromise=require(_0x07bd('0x6'));var Mustache=require(_0x07bd('0x7'));var util=require('util');var path=require(_0x07bd('0x8'));var sox=require(_0x07bd('0x9'));var csv=require(_0x07bd('0xa'));var ejs=require(_0x07bd('0xb'));var fs=require('fs');var fs_extra=require(_0x07bd('0xc'));var _=require(_0x07bd('0xd'));var squel=require(_0x07bd('0xe'));var crypto=require('crypto');var jsforce=require(_0x07bd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x07bd('0xa'));var querystring=require(_0x07bd('0x10'));var Papa=require(_0x07bd('0x11'));var Redis=require('ioredis');var authService=require(_0x07bd('0x12'));var qs=require(_0x07bd('0x13'));var as=require(_0x07bd('0x14'));var hardwareService=require(_0x07bd('0x15'));var logger=require('../../config/logger')(_0x07bd('0x16'));var utils=require(_0x07bd('0x17'));var config=require(_0x07bd('0x18'));var licenseUtil=require(_0x07bd('0x19'));var db=require(_0x07bd('0x1a'))['db'];function respondWithStatusCode(_0x1eff6c,_0x10aa2e){_0x10aa2e=_0x10aa2e||0xcc;return function(_0x2b8409){if(_0x2b8409){return _0x1eff6c['sendStatus'](_0x10aa2e);}return _0x1eff6c['status'](_0x10aa2e)[_0x07bd('0x1b')]();};}function respondWithResult(_0x3fe523,_0x1c59c2){_0x1c59c2=_0x1c59c2||0xc8;return function(_0x247f3f){if(_0x247f3f){return _0x3fe523[_0x07bd('0x1c')](_0x1c59c2)[_0x07bd('0x1d')](_0x247f3f);}};}function respondWithFilteredResult(_0x2c9166,_0x49d962){return function(_0x418444){if(_0x418444){var _0x505839=typeof _0x49d962[_0x07bd('0x1e')]===_0x07bd('0x1f')&&typeof _0x49d962[_0x07bd('0x20')]===_0x07bd('0x1f');var _0x8aa645=_0x418444['count'];var _0x3f9f0b=_0x505839?0x0:_0x49d962[_0x07bd('0x1e')];var _0x4948f4=_0x505839?_0x418444[_0x07bd('0x21')]:_0x49d962[_0x07bd('0x1e')]+_0x49d962[_0x07bd('0x20')];var _0x2fcc59;if(_0x4948f4>=_0x8aa645){_0x4948f4=_0x8aa645;_0x2fcc59=0xc8;}else{_0x2fcc59=0xce;}_0x2c9166[_0x07bd('0x1c')](_0x2fcc59);return _0x2c9166[_0x07bd('0x22')](_0x07bd('0x23'),_0x3f9f0b+'-'+_0x4948f4+'/'+_0x8aa645)[_0x07bd('0x1d')](_0x418444);}return null;};}function patchUpdates(_0x29a52e){return function(_0x50109f){try{jsonpatch[_0x07bd('0x24')](_0x50109f,_0x29a52e,!![]);}catch(_0x227807){return BPromise[_0x07bd('0x25')](_0x227807);}return _0x50109f[_0x07bd('0x26')]();};}function saveUpdates(_0x16d0e6,_0x47bd50){return function(_0x4c673a){if(_0x4c673a){return _0x4c673a[_0x07bd('0x27')](_0x16d0e6)['then'](function(_0x2b0dee){return _0x2b0dee;});}return null;};}function removeEntity(_0x480c9c,_0x50bd12){return function(_0x4165bc){if(_0x4165bc){return _0x4165bc[_0x07bd('0x28')]()[_0x07bd('0x29')](function(){_0x480c9c[_0x07bd('0x1c')](0xcc)[_0x07bd('0x1b')]();});}};}function handleEntityNotFound(_0x43cbc8,_0x557042){return function(_0x180b43){if(!_0x180b43){_0x43cbc8[_0x07bd('0x2a')](0x194);}return _0x180b43;};}function handleError(_0x3db9d0,_0x2a7202){_0x2a7202=_0x2a7202||0x1f4;return function(_0x12ce26){logger[_0x07bd('0x2b')](_0x12ce26['stack']);if(_0x12ce26['name']){delete _0x12ce26['name'];}_0x3db9d0[_0x07bd('0x1c')](_0x2a7202)[_0x07bd('0x2c')](_0x12ce26);};}exports[_0x07bd('0x2d')]=function(_0x51efa8,_0x1a3aa9){var _0x400cc0={},_0x253dc0={},_0x46ed12={'count':0x0,'rows':[]};var _0x3f9424=_[_0x07bd('0x2e')](db['SquareReport'][_0x07bd('0x2f')],function(_0x20cc94){return{'name':_0x20cc94[_0x07bd('0x30')],'type':_0x20cc94[_0x07bd('0x31')][_0x07bd('0x32')]};});_0x253dc0[_0x07bd('0x33')]=_[_0x07bd('0x2e')](_0x3f9424,_0x07bd('0x34'));_0x253dc0['query']=_['keys'](_0x51efa8[_0x07bd('0x35')]);_0x253dc0[_0x07bd('0x36')]=_[_0x07bd('0x37')](_0x253dc0['model'],_0x253dc0[_0x07bd('0x35')]);_0x400cc0[_0x07bd('0x38')]=_[_0x07bd('0x37')](_0x253dc0['model'],qs['fields'](_0x51efa8[_0x07bd('0x35')][_0x07bd('0x39')]));_0x400cc0[_0x07bd('0x38')]=_0x400cc0[_0x07bd('0x38')]['length']?_0x400cc0[_0x07bd('0x38')]:_0x253dc0[_0x07bd('0x33')];if(!_0x51efa8[_0x07bd('0x35')]['hasOwnProperty'](_0x07bd('0x3a'))){_0x400cc0[_0x07bd('0x20')]=qs['limit'](_0x51efa8[_0x07bd('0x35')][_0x07bd('0x20')]);_0x400cc0[_0x07bd('0x1e')]=qs[_0x07bd('0x1e')](_0x51efa8['query']['offset']);}_0x400cc0[_0x07bd('0x3b')]=qs['sort'](_0x51efa8[_0x07bd('0x35')][_0x07bd('0x3c')]);_0x400cc0[_0x07bd('0x3d')]=qs[_0x07bd('0x36')](_[_0x07bd('0x3e')](_0x51efa8[_0x07bd('0x35')],_0x253dc0[_0x07bd('0x36')]),_0x3f9424);if(_0x51efa8[_0x07bd('0x35')][_0x07bd('0x3f')]){_0x400cc0[_0x07bd('0x3d')]=_[_0x07bd('0x40')](_0x400cc0[_0x07bd('0x3d')],{'$or':_[_0x07bd('0x2e')](_0x3f9424,function(_0x51e8e2){if(_0x51e8e2[_0x07bd('0x31')]!==_0x07bd('0x41')){var _0x220a8e={};_0x220a8e[_0x51e8e2[_0x07bd('0x34')]]={'$like':'%'+_0x51efa8['query'][_0x07bd('0x3f')]+'%'};return _0x220a8e;}})});}_0x400cc0=_[_0x07bd('0x40')]({},_0x400cc0,_0x51efa8[_0x07bd('0x42')]);var _0x408a0a={'where':_0x400cc0[_0x07bd('0x3d')]};return db['SquareReport']['count'](_0x408a0a)[_0x07bd('0x29')](function(_0x88e174){_0x46ed12[_0x07bd('0x21')]=_0x88e174;if(_0x51efa8[_0x07bd('0x35')]['includeAll']){_0x400cc0[_0x07bd('0x43')]=[{'all':!![]}];}return db[_0x07bd('0x44')][_0x07bd('0x45')](_0x400cc0);})[_0x07bd('0x29')](function(_0x318b7c){_0x46ed12[_0x07bd('0x46')]=_0x318b7c;return _0x46ed12;})[_0x07bd('0x29')](respondWithFilteredResult(_0x1a3aa9,_0x400cc0))['catch'](handleError(_0x1a3aa9,null));};exports[_0x07bd('0x47')]=function(_0x7b1042,_0x33389b){var _0x3a5827={'raw':!![],'where':{'id':_0x7b1042['params']['id']}},_0x418f26={};_0x418f26[_0x07bd('0x33')]=_[_0x07bd('0x48')](db[_0x07bd('0x44')][_0x07bd('0x2f')]);_0x418f26[_0x07bd('0x35')]=_['keys'](_0x7b1042[_0x07bd('0x35')]);_0x418f26[_0x07bd('0x36')]=_[_0x07bd('0x37')](_0x418f26[_0x07bd('0x33')],_0x418f26['query']);_0x3a5827['attributes']=_[_0x07bd('0x37')](_0x418f26[_0x07bd('0x33')],qs[_0x07bd('0x39')](_0x7b1042[_0x07bd('0x35')][_0x07bd('0x39')]));_0x3a5827[_0x07bd('0x38')]=_0x3a5827[_0x07bd('0x38')][_0x07bd('0x49')]?_0x3a5827[_0x07bd('0x38')]:_0x418f26['model'];if(_0x7b1042['query'][_0x07bd('0x4a')]){_0x3a5827[_0x07bd('0x43')]=[{'all':!![]}];}_0x3a5827=_[_0x07bd('0x40')]({},_0x3a5827,_0x7b1042[_0x07bd('0x42')]);return db[_0x07bd('0x44')][_0x07bd('0x4b')](_0x3a5827)['then'](handleEntityNotFound(_0x33389b,null))[_0x07bd('0x29')](respondWithResult(_0x33389b,null))[_0x07bd('0x4c')](handleError(_0x33389b,null));};exports[_0x07bd('0x4d')]=function(_0x39823e,_0x7755e2){return db[_0x07bd('0x44')]['create'](_0x39823e[_0x07bd('0x4e')],{})[_0x07bd('0x29')](respondWithResult(_0x7755e2,0xc9))[_0x07bd('0x4c')](handleError(_0x7755e2,null));};exports[_0x07bd('0x27')]=function(_0x1d05ad,_0xc96a7d){if(_0x1d05ad[_0x07bd('0x4e')]['id']){delete _0x1d05ad[_0x07bd('0x4e')]['id'];}return db[_0x07bd('0x44')][_0x07bd('0x4b')]({'where':{'id':_0x1d05ad[_0x07bd('0x4f')]['id']}})[_0x07bd('0x29')](handleEntityNotFound(_0xc96a7d,null))['then'](saveUpdates(_0x1d05ad[_0x07bd('0x4e')],null))[_0x07bd('0x29')](respondWithResult(_0xc96a7d,null))[_0x07bd('0x4c')](handleError(_0xc96a7d,null));};exports['destroy']=function(_0x51c9f4,_0x1e7a6e){return db['SquareReport'][_0x07bd('0x4b')]({'where':{'id':_0x51c9f4[_0x07bd('0x4f')]['id']}})[_0x07bd('0x29')](handleEntityNotFound(_0x1e7a6e,null))[_0x07bd('0x29')](removeEntity(_0x1e7a6e,null))[_0x07bd('0x4c')](handleError(_0x1e7a6e,null));};exports[_0x07bd('0x50')]=function(_0x2cadbb,_0x157eb4){return db['SquareReport'][_0x07bd('0x50')]()[_0x07bd('0x29')](respondWithResult(_0x157eb4,null))[_0x07bd('0x4c')](handleError(_0x157eb4,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 16533f7..aa5a4ba 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 _0xaea9=['report_square','project_name','leaveAt','util','../../config/logger','api','moment','request-promise','path','rimraf','./squareReport.attributes','define','SquareReport'];(function(_0xe9575c,_0x393b1d){var _0x311b6f=function(_0x3e8bec){while(--_0x3e8bec){_0xe9575c['push'](_0xe9575c['shift']());}};_0x311b6f(++_0x393b1d);}(_0xaea9,0xc6));var _0x9aea=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xaea9[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require('lodash');var util=require(_0x9aea('0x0'));var logger=require(_0x9aea('0x1'))(_0x9aea('0x2'));var moment=require(_0x9aea('0x3'));var BPromise=require('bluebird');var rp=require(_0x9aea('0x4'));var fs=require('fs');var path=require(_0x9aea('0x5'));var rimraf=require(_0x9aea('0x6'));var config=require('../../config/environment');var attributes=require(_0x9aea('0x7'));module['exports']=function(_0x57f21b,_0x4527ff){return _0x57f21b[_0x9aea('0x8')](_0x9aea('0x9'),attributes,{'tableName':_0x9aea('0xa'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid',_0x9aea('0xb')]},{'name':_0x9aea('0xc'),'fields':[_0x9aea('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa467=['uid_pname','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareReport','report_square'];(function(_0x48e0e4,_0x112c32){var _0x1658e3=function(_0x50da2f){while(--_0x50da2f){_0x48e0e4['push'](_0x48e0e4['shift']());}};_0x1658e3(++_0x112c32);}(_0xa467,0x19b));var _0x7a46=function(_0x11bccb,_0xe4e019){_0x11bccb=_0x11bccb-0x0;var _0x1e36e2=_0xa467[_0x11bccb];return _0x1e36e2;};'use strict';var _=require(_0x7a46('0x0'));var util=require(_0x7a46('0x1'));var logger=require(_0x7a46('0x2'))(_0x7a46('0x3'));var moment=require(_0x7a46('0x4'));var BPromise=require(_0x7a46('0x5'));var rp=require(_0x7a46('0x6'));var fs=require('fs');var path=require(_0x7a46('0x7'));var rimraf=require(_0x7a46('0x8'));var config=require(_0x7a46('0x9'));var attributes=require('./squareReport.attributes');module[_0x7a46('0xa')]=function(_0x253812,_0x164ff9){return _0x253812[_0x7a46('0xb')](_0x7a46('0xc'),attributes,{'tableName':_0x7a46('0xd'),'paranoid':![],'indexes':[{'name':_0x7a46('0xe'),'fields':['uniqueid',_0x7a46('0xf')]},{'name':_0x7a46('0x10'),'fields':[_0x7a46('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 95d4215..1783d54 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 _0x7fbe=['stringify','error','code','message','result','catch','SquareReport','create','options','raw','CreateSquareReport','update','where','limit','info','UpdateSquareReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5da875,_0x475a8b){_0x5da875=_0x5da875-0x0;var _0x25d687=_0x7fbe[_0x5da875];return _0x25d687;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['CreateSquareReport']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')](_0x293a47['body'],{'raw':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x15f7a4){logger['info'](_0xe7fb('0x1c'),_0x293a47);logger[_0xe7fb('0x10')]('CreateSquareReport',_0x293a47,JSON[_0xe7fb('0x12')](_0x15f7a4));_0x1e77fd(_0x15f7a4);})[_0xe7fb('0x17')](function(_0x3ae8f1){logger['error'](_0xe7fb('0x1c'),_0x3ae8f1[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463['error'](0x1f4,_0x3ae8f1['message']));});});};exports['UpdateSquareReport']=function(_0x35e4db){var _0x53c43a=this;return new Promise(function(_0x49b219,_0x4026b1){return db[_0xe7fb('0x18')][_0xe7fb('0x1d')](_0x35e4db['body'],{'raw':_0x35e4db[_0xe7fb('0x1a')]?_0x35e4db[_0xe7fb('0x1a')][_0xe7fb('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35e4db[_0xe7fb('0x1a')]?_0x35e4db[_0xe7fb('0x1a')][_0xe7fb('0x1e')]||null:null,'attributes':_0x35e4db[_0xe7fb('0x1a')]?_0x35e4db['options']['attributes']||null:null,'limit':_0x35e4db[_0xe7fb('0x1a')]?_0x35e4db[_0xe7fb('0x1a')][_0xe7fb('0x1f')]||null:null})['then'](function(_0xb1f2f4){logger[_0xe7fb('0x20')](_0xe7fb('0x21'),_0x35e4db);logger[_0xe7fb('0x10')](_0xe7fb('0x21'),_0x35e4db,JSON[_0xe7fb('0x12')](_0xb1f2f4));_0x49b219(_0xb1f2f4);})[_0xe7fb('0x17')](function(_0x3dd0be){logger['error'](_0xe7fb('0x21'),_0x3dd0be[_0xe7fb('0x15')],_0x35e4db);_0x4026b1(_0x53c43a[_0xe7fb('0x13')](0x1f4,_0x3dd0be['message']));});});}; \ No newline at end of file +var _0x55ca=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareReport','SquareReport','create','body','options','update','raw','where','limit','UpdateSquareReport','lodash','util','ioredis'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x55ca,0x126));var _0xa55c=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x55ca[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('SquareReport,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('SquareReport,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')](_0x24783b[_0xa55c('0x1a')],{'raw':_0x24783b[_0xa55c('0x1b')]?_0x24783b['options']['raw']===undefined?!![]:![]:!![]})[_0xa55c('0xb')](function(_0x3776ac){logger[_0xa55c('0x14')]('CreateSquareReport',_0x24783b);logger[_0xa55c('0xe')](_0xa55c('0x17'),_0x24783b,JSON['stringify'](_0x3776ac));_0x3d4c9e(_0x3776ac);})[_0xa55c('0x16')](function(_0x133096){logger[_0xa55c('0x11')](_0xa55c('0x17'),_0x133096[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c['error'](0x1f4,_0x133096[_0xa55c('0x13')]));});});};exports['UpdateSquareReport']=function(_0x5ba836){var _0x59d89a=this;return new Promise(function(_0x19ae88,_0x54b038){return db[_0xa55c('0x18')][_0xa55c('0x1c')](_0x5ba836[_0xa55c('0x1a')],{'raw':_0x5ba836[_0xa55c('0x1b')]?_0x5ba836[_0xa55c('0x1b')][_0xa55c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ba836[_0xa55c('0x1b')]?_0x5ba836[_0xa55c('0x1b')][_0xa55c('0x1e')]||null:null,'attributes':_0x5ba836[_0xa55c('0x1b')]?_0x5ba836[_0xa55c('0x1b')]['attributes']||null:null,'limit':_0x5ba836[_0xa55c('0x1b')]?_0x5ba836[_0xa55c('0x1b')][_0xa55c('0x1f')]||null:null})[_0xa55c('0xb')](function(_0x5d940d){logger[_0xa55c('0x14')](_0xa55c('0x20'),_0x5ba836);logger[_0xa55c('0xe')](_0xa55c('0x20'),_0x5ba836,JSON[_0xa55c('0x10')](_0x5d940d));_0x19ae88(_0x5d940d);})[_0xa55c('0x16')](function(_0x52d37f){logger[_0xa55c('0x11')]('UpdateSquareReport',_0x52d37f[_0xa55c('0x13')],_0x5ba836);_0x54b038(_0x59d89a[_0xa55c('0x11')](0x1f4,_0x52d37f[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index bef85bc..ad2ab8d 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 _0xd026=['create','/:id','update','delete','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','describe','show'];(function(_0x1c45e7,_0x5f76be){var _0x453a3f=function(_0x8823e0){while(--_0x8823e0){_0x1c45e7['push'](_0x1c45e7['shift']());}};_0x453a3f(++_0x5f76be);}(_0xd026,0x1f3));var _0x6d02=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xd026[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x6d02('0x0'));var util=require(_0x6d02('0x1'));var path=require('path');var timeout=require(_0x6d02('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6d02('0x3'));var interaction=require(_0x6d02('0x4'));var config=require(_0x6d02('0x5'));var controller=require(_0x6d02('0x6'));router[_0x6d02('0x7')]('/',auth[_0x6d02('0x8')](),controller['index']);router['get']('/describe',auth[_0x6d02('0x8')](),controller[_0x6d02('0x9')]);router[_0x6d02('0x7')]('/:id',auth[_0x6d02('0x8')](),controller[_0x6d02('0xa')]);router['post']('/',auth[_0x6d02('0x8')](),controller[_0x6d02('0xb')]);router['put'](_0x6d02('0xc'),auth[_0x6d02('0x8')](),controller[_0x6d02('0xd')]);router[_0x6d02('0xe')]('/:id',auth[_0x6d02('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfc22=['fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','path','connect-timeout','Router'];(function(_0x469850,_0x3357a1){var _0x326907=function(_0x2e0cde){while(--_0x2e0cde){_0x469850['push'](_0x469850['shift']());}};_0x326907(++_0x3357a1);}(_0xfc22,0x13d));var _0x2fc2=function(_0x3e33b5,_0x55b234){_0x3e33b5=_0x3e33b5-0x0;var _0x5787f7=_0xfc22[_0x3e33b5];return _0x5787f7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2fc2('0x0'));var timeout=require(_0x2fc2('0x1'));var express=require('express');var router=express[_0x2fc2('0x2')]();var fs_extra=require(_0x2fc2('0x3'));var auth=require(_0x2fc2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2fc2('0x5'));var controller=require(_0x2fc2('0x6'));router[_0x2fc2('0x7')]('/',auth[_0x2fc2('0x8')](),controller[_0x2fc2('0x9')]);router[_0x2fc2('0x7')](_0x2fc2('0xa'),auth[_0x2fc2('0x8')](),controller[_0x2fc2('0xb')]);router['get'](_0x2fc2('0xc'),auth[_0x2fc2('0x8')](),controller[_0x2fc2('0xd')]);router[_0x2fc2('0xe')]('/',auth[_0x2fc2('0x8')](),controller[_0x2fc2('0xf')]);router['put'](_0x2fc2('0xc'),auth[_0x2fc2('0x8')](),controller[_0x2fc2('0x10')]);router[_0x2fc2('0x11')](_0x2fc2('0xc'),auth[_0x2fc2('0x8')](),controller[_0x2fc2('0x12')]);module[_0x2fc2('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index f47873a..cd3d21e 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 _0x7d43=['exports','STRING','TEXT','sequelize'];(function(_0x6013f1,_0x431fcf){var _0x47fe5e=function(_0x164f0f){while(--_0x164f0f){_0x6013f1['push'](_0x6013f1['shift']());}};_0x47fe5e(++_0x431fcf);}(_0x7d43,0xaf));var _0x37d4=function(_0x19d3c1,_0x1c3828){_0x19d3c1=_0x19d3c1-0x0;var _0x3315d5=_0x7d43[_0x19d3c1];return _0x3315d5;};'use strict';var Sequelize=require(_0x37d4('0x0'));module[_0x37d4('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x37d4('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x37d4('0x3')]},'project_name':{'type':Sequelize[_0x37d4('0x2')]},'callerid':{'type':Sequelize[_0x37d4('0x2')]}}; \ No newline at end of file +var _0x1bdf=['sequelize','exports','STRING','TEXT'];(function(_0x3b1efb,_0x505b7e){var _0x56db82=function(_0x18123e){while(--_0x18123e){_0x3b1efb['push'](_0x3b1efb['shift']());}};_0x56db82(++_0x505b7e);}(_0x1bdf,0x90));var _0xf1bd=function(_0x58f7d5,_0x589856){_0x58f7d5=_0x58f7d5-0x0;var _0x4df35b=_0x1bdf[_0x58f7d5];return _0x4df35b;};'use strict';var Sequelize=require(_0xf1bd('0x0'));module[_0xf1bd('0x1')]={'uniqueid':{'type':Sequelize[_0xf1bd('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xf1bd('0x3')]},'project_name':{'type':Sequelize[_0xf1bd('0x2')]},'callerid':{'type':Sequelize[_0xf1bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 66979ad..ae8962c 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 _0x150f=['ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','set','Content-Range','json','reject','update','then','destroy','end','sendStatus','error','stack','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse'];(function(_0x37d86c,_0xad957){var _0x65e2b4=function(_0x1e230c){while(--_0x1e230c){_0x37d86c['push'](_0x37d86c['shift']());}};_0x65e2b4(++_0xad957);}(_0x150f,0x1c2));var _0xf150=function(_0x1a4c04,_0x49f2cf){_0x1a4c04=_0x1a4c04-0x0;var _0x237ae5=_0x150f[_0x1a4c04];return _0x237ae5;};'use strict';var emlformat=require(_0xf150('0x0'));var rimraf=require(_0xf150('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf150('0x2'));var rp=require(_0xf150('0x3'));var moment=require('moment');var BPromise=require(_0xf150('0x4'));var Mustache=require(_0xf150('0x5'));var util=require(_0xf150('0x6'));var path=require(_0xf150('0x7'));var sox=require(_0xf150('0x8'));var csv=require(_0xf150('0x9'));var ejs=require(_0xf150('0xa'));var fs=require('fs');var fs_extra=require(_0xf150('0xb'));var _=require(_0xf150('0xc'));var squel=require(_0xf150('0xd'));var crypto=require(_0xf150('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf150('0xf'));var toCsv=require(_0xf150('0x9'));var querystring=require(_0xf150('0x10'));var Papa=require(_0xf150('0x11'));var Redis=require(_0xf150('0x12'));var authService=require(_0xf150('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf150('0x14'));var logger=require(_0xf150('0x15'))(_0xf150('0x16'));var utils=require(_0xf150('0x17'));var config=require(_0xf150('0x18'));var licenseUtil=require(_0xf150('0x19'));var db=require(_0xf150('0x1a'))['db'];function respondWithStatusCode(_0x3b076d,_0x3256b3){_0x3256b3=_0x3256b3||0xcc;return function(_0x1da376){if(_0x1da376){return _0x3b076d['sendStatus'](_0x3256b3);}return _0x3b076d[_0xf150('0x1b')](_0x3256b3)['end']();};}function respondWithResult(_0x3134c9,_0x231ee7){_0x231ee7=_0x231ee7||0xc8;return function(_0x4003f2){if(_0x4003f2){return _0x3134c9[_0xf150('0x1b')](_0x231ee7)['json'](_0x4003f2);}};}function respondWithFilteredResult(_0x5dfb98,_0x2838d9){return function(_0x34b95e){if(_0x34b95e){var _0x3a8371=typeof _0x2838d9['offset']===_0xf150('0x1c')&&typeof _0x2838d9[_0xf150('0x1d')]===_0xf150('0x1c');var _0x4886ee=_0x34b95e[_0xf150('0x1e')];var _0x36a420=_0x3a8371?0x0:_0x2838d9['offset'];var _0x5394b3=_0x3a8371?_0x34b95e[_0xf150('0x1e')]:_0x2838d9[_0xf150('0x1f')]+_0x2838d9[_0xf150('0x1d')];var _0x16b3a9;if(_0x5394b3>=_0x4886ee){_0x5394b3=_0x4886ee;_0x16b3a9=0xc8;}else{_0x16b3a9=0xce;}_0x5dfb98[_0xf150('0x1b')](_0x16b3a9);return _0x5dfb98[_0xf150('0x20')](_0xf150('0x21'),_0x36a420+'-'+_0x5394b3+'/'+_0x4886ee)[_0xf150('0x22')](_0x34b95e);}return null;};}function patchUpdates(_0x1f2c63){return function(_0x1d5c3a){try{jsonpatch['apply'](_0x1d5c3a,_0x1f2c63,!![]);}catch(_0x329a74){return BPromise[_0xf150('0x23')](_0x329a74);}return _0x1d5c3a['save']();};}function saveUpdates(_0x318252,_0x2bf1a3){return function(_0x41a8a8){if(_0x41a8a8){return _0x41a8a8[_0xf150('0x24')](_0x318252)[_0xf150('0x25')](function(_0x5da72b){return _0x5da72b;});}return null;};}function removeEntity(_0x28c6ec,_0x1e8967){return function(_0x4ba229){if(_0x4ba229){return _0x4ba229[_0xf150('0x26')]()[_0xf150('0x25')](function(){_0x28c6ec[_0xf150('0x1b')](0xcc)[_0xf150('0x27')]();});}};}function handleEntityNotFound(_0x1fd9ad,_0x58a904){return function(_0x310ab7){if(!_0x310ab7){_0x1fd9ad[_0xf150('0x28')](0x194);}return _0x310ab7;};}function handleError(_0x398dce,_0x2ed80d){_0x2ed80d=_0x2ed80d||0x1f4;return function(_0x4267e7){logger[_0xf150('0x29')](_0x4267e7[_0xf150('0x2a')]);if(_0x4267e7['name']){delete _0x4267e7['name'];}_0x398dce[_0xf150('0x1b')](_0x2ed80d)[_0xf150('0x2b')](_0x4267e7);};}exports[_0xf150('0x2c')]=function(_0x418925,_0x47fc92){var _0x5485ee={},_0x1b6e2a={},_0x3f3ded={'count':0x0,'rows':[]};var _0x32863f=_[_0xf150('0x2d')](db[_0xf150('0x2e')][_0xf150('0x2f')],function(_0x4f3e85){return{'name':_0x4f3e85[_0xf150('0x30')],'type':_0x4f3e85[_0xf150('0x31')][_0xf150('0x32')]};});_0x1b6e2a[_0xf150('0x33')]=_[_0xf150('0x2d')](_0x32863f,_0xf150('0x34'));_0x1b6e2a[_0xf150('0x35')]=_[_0xf150('0x36')](_0x418925[_0xf150('0x35')]);_0x1b6e2a[_0xf150('0x37')]=_[_0xf150('0x38')](_0x1b6e2a[_0xf150('0x33')],_0x1b6e2a[_0xf150('0x35')]);_0x5485ee[_0xf150('0x39')]=_[_0xf150('0x38')](_0x1b6e2a[_0xf150('0x33')],qs[_0xf150('0x3a')](_0x418925[_0xf150('0x35')][_0xf150('0x3a')]));_0x5485ee['attributes']=_0x5485ee[_0xf150('0x39')][_0xf150('0x3b')]?_0x5485ee[_0xf150('0x39')]:_0x1b6e2a[_0xf150('0x33')];if(!_0x418925[_0xf150('0x35')][_0xf150('0x3c')](_0xf150('0x3d'))){_0x5485ee[_0xf150('0x1d')]=qs[_0xf150('0x1d')](_0x418925['query'][_0xf150('0x1d')]);_0x5485ee['offset']=qs[_0xf150('0x1f')](_0x418925[_0xf150('0x35')][_0xf150('0x1f')]);}_0x5485ee['order']=qs[_0xf150('0x3e')](_0x418925[_0xf150('0x35')][_0xf150('0x3e')]);_0x5485ee[_0xf150('0x3f')]=qs['filters'](_[_0xf150('0x40')](_0x418925['query'],_0x1b6e2a[_0xf150('0x37')]),_0x32863f);if(_0x418925['query'][_0xf150('0x41')]){_0x5485ee[_0xf150('0x3f')]=_[_0xf150('0x42')](_0x5485ee[_0xf150('0x3f')],{'$or':_[_0xf150('0x2d')](_0x32863f,function(_0x3290ae){if(_0x3290ae[_0xf150('0x31')]!=='VIRTUAL'){var _0x2199c4={};_0x2199c4[_0x3290ae[_0xf150('0x34')]]={'$like':'%'+_0x418925[_0xf150('0x35')]['filter']+'%'};return _0x2199c4;}})});}_0x5485ee=_[_0xf150('0x42')]({},_0x5485ee,_0x418925[_0xf150('0x43')]);var _0x15653c={'where':_0x5485ee[_0xf150('0x3f')]};return db['SquareDetailsReport'][_0xf150('0x1e')](_0x15653c)[_0xf150('0x25')](function(_0x560895){_0x3f3ded[_0xf150('0x1e')]=_0x560895;if(_0x418925[_0xf150('0x35')][_0xf150('0x44')]){_0x5485ee[_0xf150('0x45')]=[{'all':!![]}];}return db[_0xf150('0x2e')][_0xf150('0x46')](_0x5485ee);})['then'](function(_0x165936){_0x3f3ded['rows']=_0x165936;return _0x3f3ded;})[_0xf150('0x25')](respondWithFilteredResult(_0x47fc92,_0x5485ee))[_0xf150('0x47')](handleError(_0x47fc92,null));};exports[_0xf150('0x48')]=function(_0x19bcfa,_0x159d87){var _0x530c25={'raw':!![],'where':{'id':_0x19bcfa[_0xf150('0x49')]['id']}},_0x3b593a={};_0x3b593a[_0xf150('0x33')]=_[_0xf150('0x36')](db[_0xf150('0x2e')][_0xf150('0x2f')]);_0x3b593a[_0xf150('0x35')]=_['keys'](_0x19bcfa[_0xf150('0x35')]);_0x3b593a[_0xf150('0x37')]=_[_0xf150('0x38')](_0x3b593a[_0xf150('0x33')],_0x3b593a['query']);_0x530c25[_0xf150('0x39')]=_[_0xf150('0x38')](_0x3b593a[_0xf150('0x33')],qs[_0xf150('0x3a')](_0x19bcfa[_0xf150('0x35')]['fields']));_0x530c25[_0xf150('0x39')]=_0x530c25[_0xf150('0x39')][_0xf150('0x3b')]?_0x530c25['attributes']:_0x3b593a[_0xf150('0x33')];if(_0x19bcfa['query']['includeAll']){_0x530c25['include']=[{'all':!![]}];}_0x530c25=_[_0xf150('0x42')]({},_0x530c25,_0x19bcfa[_0xf150('0x43')]);return db[_0xf150('0x2e')][_0xf150('0x4a')](_0x530c25)['then'](handleEntityNotFound(_0x159d87,null))[_0xf150('0x25')](respondWithResult(_0x159d87,null))[_0xf150('0x47')](handleError(_0x159d87,null));};exports[_0xf150('0x4b')]=function(_0x2af8c0,_0x1d6fc0){return db[_0xf150('0x2e')][_0xf150('0x4b')](_0x2af8c0[_0xf150('0x4c')],{})[_0xf150('0x25')](respondWithResult(_0x1d6fc0,0xc9))[_0xf150('0x47')](handleError(_0x1d6fc0,null));};exports[_0xf150('0x24')]=function(_0x52e0b3,_0x5823d4){if(_0x52e0b3[_0xf150('0x4c')]['id']){delete _0x52e0b3[_0xf150('0x4c')]['id'];}return db[_0xf150('0x2e')][_0xf150('0x4a')]({'where':{'id':_0x52e0b3['params']['id']}})['then'](handleEntityNotFound(_0x5823d4,null))[_0xf150('0x25')](saveUpdates(_0x52e0b3[_0xf150('0x4c')],null))[_0xf150('0x25')](respondWithResult(_0x5823d4,null))['catch'](handleError(_0x5823d4,null));};exports['destroy']=function(_0x8384c9,_0x142996){return db[_0xf150('0x2e')][_0xf150('0x4a')]({'where':{'id':_0x8384c9[_0xf150('0x49')]['id']}})[_0xf150('0x25')](handleEntityNotFound(_0x142996,null))[_0xf150('0x25')](removeEntity(_0x142996,null))[_0xf150('0x47')](handleError(_0x142996,null));};exports[_0xf150('0x4d')]=function(_0x4f7db1,_0xb0576d){return db['SquareDetailsReport'][_0xf150('0x4d')]()[_0xf150('0x25')](respondWithResult(_0xb0576d,null))[_0xf150('0x47')](handleError(_0xb0576d,null));}; \ No newline at end of file +var _0x7d4d=['index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','findAll','show','keys','includeAll','options','catch','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','name','send'];(function(_0x37785e,_0x114d42){var _0x27aa58=function(_0x5b61b0){while(--_0x5b61b0){_0x37785e['push'](_0x37785e['shift']());}};_0x27aa58(++_0x114d42);}(_0x7d4d,0x188));var _0xd7d4=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0x7d4d[_0x8b8564];return _0x360c61;};'use strict';var emlformat=require(_0xd7d4('0x0'));var rimraf=require(_0xd7d4('0x1'));var zipdir=require(_0xd7d4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd7d4('0x3'));var BPromise=require(_0xd7d4('0x4'));var Mustache=require(_0xd7d4('0x5'));var util=require('util');var path=require(_0xd7d4('0x6'));var sox=require(_0xd7d4('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd7d4('0x8'));var crypto=require(_0xd7d4('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd7d4('0xa'));var toCsv=require(_0xd7d4('0xb'));var querystring=require(_0xd7d4('0xc'));var Papa=require(_0xd7d4('0xd'));var Redis=require(_0xd7d4('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd7d4('0xf'));var as=require(_0xd7d4('0x10'));var hardwareService=require(_0xd7d4('0x11'));var logger=require(_0xd7d4('0x12'))('api');var utils=require(_0xd7d4('0x13'));var config=require(_0xd7d4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd7d4('0x15'))['db'];function respondWithStatusCode(_0x3f2938,_0x14167f){_0x14167f=_0x14167f||0xcc;return function(_0x4d482c){if(_0x4d482c){return _0x3f2938[_0xd7d4('0x16')](_0x14167f);}return _0x3f2938[_0xd7d4('0x17')](_0x14167f)[_0xd7d4('0x18')]();};}function respondWithResult(_0x265f83,_0x152236){_0x152236=_0x152236||0xc8;return function(_0x409e4b){if(_0x409e4b){return _0x265f83['status'](_0x152236)['json'](_0x409e4b);}};}function respondWithFilteredResult(_0x28d288,_0xd6a0a7){return function(_0x2652dd){if(_0x2652dd){var _0x5b4390=typeof _0xd6a0a7[_0xd7d4('0x19')]===_0xd7d4('0x1a')&&typeof _0xd6a0a7[_0xd7d4('0x1b')]==='undefined';var _0x52814b=_0x2652dd[_0xd7d4('0x1c')];var _0x223d96=_0x5b4390?0x0:_0xd6a0a7['offset'];var _0x143ba7=_0x5b4390?_0x2652dd[_0xd7d4('0x1c')]:_0xd6a0a7['offset']+_0xd6a0a7[_0xd7d4('0x1b')];var _0x4f216b;if(_0x143ba7>=_0x52814b){_0x143ba7=_0x52814b;_0x4f216b=0xc8;}else{_0x4f216b=0xce;}_0x28d288[_0xd7d4('0x17')](_0x4f216b);return _0x28d288[_0xd7d4('0x1d')](_0xd7d4('0x1e'),_0x223d96+'-'+_0x143ba7+'/'+_0x52814b)[_0xd7d4('0x1f')](_0x2652dd);}return null;};}function patchUpdates(_0x489154){return function(_0x10b9b5){try{jsonpatch[_0xd7d4('0x20')](_0x10b9b5,_0x489154,!![]);}catch(_0x1cc441){return BPromise[_0xd7d4('0x21')](_0x1cc441);}return _0x10b9b5[_0xd7d4('0x22')]();};}function saveUpdates(_0x3fc267,_0x2c7ab0){return function(_0x3004e4){if(_0x3004e4){return _0x3004e4[_0xd7d4('0x23')](_0x3fc267)['then'](function(_0x20d5e4){return _0x20d5e4;});}return null;};}function removeEntity(_0x13abf5,_0x299863){return function(_0x55a7b2){if(_0x55a7b2){return _0x55a7b2['destroy']()[_0xd7d4('0x24')](function(){_0x13abf5[_0xd7d4('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1863a0,_0x4cb990){return function(_0x1b9160){if(!_0x1b9160){_0x1863a0[_0xd7d4('0x16')](0x194);}return _0x1b9160;};}function handleError(_0x2f5d05,_0x450448){_0x450448=_0x450448||0x1f4;return function(_0x5dcfc8){logger[_0xd7d4('0x25')](_0x5dcfc8['stack']);if(_0x5dcfc8[_0xd7d4('0x26')]){delete _0x5dcfc8[_0xd7d4('0x26')];}_0x2f5d05[_0xd7d4('0x17')](_0x450448)[_0xd7d4('0x27')](_0x5dcfc8);};}exports[_0xd7d4('0x28')]=function(_0x1d818f,_0x4c64af){var _0x4f96db={},_0x347274={},_0x231f10={'count':0x0,'rows':[]};var _0x4a778c=_[_0xd7d4('0x29')](db[_0xd7d4('0x2a')][_0xd7d4('0x2b')],function(_0x245b48){return{'name':_0x245b48[_0xd7d4('0x2c')],'type':_0x245b48[_0xd7d4('0x2d')][_0xd7d4('0x2e')]};});_0x347274[_0xd7d4('0x2f')]=_['map'](_0x4a778c,_0xd7d4('0x26'));_0x347274[_0xd7d4('0x30')]=_['keys'](_0x1d818f[_0xd7d4('0x30')]);_0x347274['filters']=_[_0xd7d4('0x31')](_0x347274[_0xd7d4('0x2f')],_0x347274[_0xd7d4('0x30')]);_0x4f96db[_0xd7d4('0x32')]=_[_0xd7d4('0x31')](_0x347274[_0xd7d4('0x2f')],qs['fields'](_0x1d818f[_0xd7d4('0x30')][_0xd7d4('0x33')]));_0x4f96db['attributes']=_0x4f96db[_0xd7d4('0x32')]['length']?_0x4f96db['attributes']:_0x347274[_0xd7d4('0x2f')];if(!_0x1d818f[_0xd7d4('0x30')][_0xd7d4('0x34')](_0xd7d4('0x35'))){_0x4f96db['limit']=qs[_0xd7d4('0x1b')](_0x1d818f[_0xd7d4('0x30')][_0xd7d4('0x1b')]);_0x4f96db[_0xd7d4('0x19')]=qs[_0xd7d4('0x19')](_0x1d818f[_0xd7d4('0x30')][_0xd7d4('0x19')]);}_0x4f96db['order']=qs['sort'](_0x1d818f['query'][_0xd7d4('0x36')]);_0x4f96db['where']=qs[_0xd7d4('0x37')](_[_0xd7d4('0x38')](_0x1d818f['query'],_0x347274[_0xd7d4('0x37')]),_0x4a778c);if(_0x1d818f[_0xd7d4('0x30')][_0xd7d4('0x39')]){_0x4f96db[_0xd7d4('0x3a')]=_[_0xd7d4('0x3b')](_0x4f96db[_0xd7d4('0x3a')],{'$or':_['map'](_0x4a778c,function(_0x39b4f9){if(_0x39b4f9[_0xd7d4('0x2d')]!==_0xd7d4('0x3c')){var _0x3c3d6e={};_0x3c3d6e[_0x39b4f9[_0xd7d4('0x26')]]={'$like':'%'+_0x1d818f[_0xd7d4('0x30')]['filter']+'%'};return _0x3c3d6e;}})});}_0x4f96db=_[_0xd7d4('0x3b')]({},_0x4f96db,_0x1d818f['options']);var _0x508289={'where':_0x4f96db[_0xd7d4('0x3a')]};return db[_0xd7d4('0x2a')][_0xd7d4('0x1c')](_0x508289)[_0xd7d4('0x24')](function(_0x1dc789){_0x231f10[_0xd7d4('0x1c')]=_0x1dc789;if(_0x1d818f[_0xd7d4('0x30')]['includeAll']){_0x4f96db['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0xd7d4('0x3d')](_0x4f96db);})['then'](function(_0x1766be){_0x231f10['rows']=_0x1766be;return _0x231f10;})[_0xd7d4('0x24')](respondWithFilteredResult(_0x4c64af,_0x4f96db))['catch'](handleError(_0x4c64af,null));};exports[_0xd7d4('0x3e')]=function(_0x33ac03,_0x1657b0){var _0x204995={'raw':!![],'where':{'id':_0x33ac03['params']['id']}},_0x1e40fb={};_0x1e40fb[_0xd7d4('0x2f')]=_[_0xd7d4('0x3f')](db[_0xd7d4('0x2a')][_0xd7d4('0x2b')]);_0x1e40fb[_0xd7d4('0x30')]=_[_0xd7d4('0x3f')](_0x33ac03[_0xd7d4('0x30')]);_0x1e40fb['filters']=_[_0xd7d4('0x31')](_0x1e40fb[_0xd7d4('0x2f')],_0x1e40fb['query']);_0x204995['attributes']=_[_0xd7d4('0x31')](_0x1e40fb['model'],qs[_0xd7d4('0x33')](_0x33ac03[_0xd7d4('0x30')]['fields']));_0x204995['attributes']=_0x204995[_0xd7d4('0x32')]['length']?_0x204995['attributes']:_0x1e40fb[_0xd7d4('0x2f')];if(_0x33ac03[_0xd7d4('0x30')][_0xd7d4('0x40')]){_0x204995['include']=[{'all':!![]}];}_0x204995=_[_0xd7d4('0x3b')]({},_0x204995,_0x33ac03[_0xd7d4('0x41')]);return db['SquareDetailsReport']['find'](_0x204995)['then'](handleEntityNotFound(_0x1657b0,null))['then'](respondWithResult(_0x1657b0,null))[_0xd7d4('0x42')](handleError(_0x1657b0,null));};exports[_0xd7d4('0x43')]=function(_0x13ce63,_0x31d21f){return db[_0xd7d4('0x2a')][_0xd7d4('0x43')](_0x13ce63['body'],{})[_0xd7d4('0x24')](respondWithResult(_0x31d21f,0xc9))[_0xd7d4('0x42')](handleError(_0x31d21f,null));};exports[_0xd7d4('0x23')]=function(_0x3cbbad,_0x370e35){if(_0x3cbbad[_0xd7d4('0x44')]['id']){delete _0x3cbbad[_0xd7d4('0x44')]['id'];}return db[_0xd7d4('0x2a')]['find']({'where':{'id':_0x3cbbad[_0xd7d4('0x45')]['id']}})[_0xd7d4('0x24')](handleEntityNotFound(_0x370e35,null))[_0xd7d4('0x24')](saveUpdates(_0x3cbbad[_0xd7d4('0x44')],null))[_0xd7d4('0x24')](respondWithResult(_0x370e35,null))[_0xd7d4('0x42')](handleError(_0x370e35,null));};exports[_0xd7d4('0x46')]=function(_0x2b5b40,_0x471b8c){return db[_0xd7d4('0x2a')]['find']({'where':{'id':_0x2b5b40[_0xd7d4('0x45')]['id']}})[_0xd7d4('0x24')](handleEntityNotFound(_0x471b8c,null))[_0xd7d4('0x24')](removeEntity(_0x471b8c,null))[_0xd7d4('0x42')](handleError(_0x471b8c,null));};exports[_0xd7d4('0x47')]=function(_0x334de2,_0x33ba7b){return db[_0xd7d4('0x2a')]['describe']()['then'](respondWithResult(_0x33ba7b,null))[_0xd7d4('0x42')](handleError(_0x33ba7b,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index d2ebf1d..0b6da95 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 _0x5ce5=['bluebird','request-promise','path','./squareReportDetail.attributes','define','report_square_details','lodash','util','../../config/logger','api','moment'];(function(_0x272f46,_0x20df5c){var _0x488a3f=function(_0x1edbf1){while(--_0x1edbf1){_0x272f46['push'](_0x272f46['shift']());}};_0x488a3f(++_0x20df5c);}(_0x5ce5,0xa0));var _0x55ce=function(_0x807192,_0x490f22){_0x807192=_0x807192-0x0;var _0x4a75f8=_0x5ce5[_0x807192];return _0x4a75f8;};'use strict';var _=require(_0x55ce('0x0'));var util=require(_0x55ce('0x1'));var logger=require(_0x55ce('0x2'))(_0x55ce('0x3'));var moment=require(_0x55ce('0x4'));var BPromise=require(_0x55ce('0x5'));var rp=require(_0x55ce('0x6'));var fs=require('fs');var path=require(_0x55ce('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x55ce('0x8'));module['exports']=function(_0x2eec37,_0x22b891){return _0x2eec37[_0x55ce('0x9')]('SquareDetailsReport',attributes,{'tableName':_0x55ce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2ae=['SquareDetailsReport','report_square_details','util','../../config/logger','moment','request-promise','path','rimraf','./squareReportDetail.attributes','exports','define'];(function(_0x5e58b2,_0x1b7ed4){var _0x4facd0=function(_0x58d136){while(--_0x58d136){_0x5e58b2['push'](_0x5e58b2['shift']());}};_0x4facd0(++_0x1b7ed4);}(_0xd2ae,0x91));var _0xed2a=function(_0x90a2a2,_0x535804){_0x90a2a2=_0x90a2a2-0x0;var _0x2b848b=_0xd2ae[_0x90a2a2];return _0x2b848b;};'use strict';var _=require('lodash');var util=require(_0xed2a('0x0'));var logger=require(_0xed2a('0x1'))('api');var moment=require(_0xed2a('0x2'));var BPromise=require('bluebird');var rp=require(_0xed2a('0x3'));var fs=require('fs');var path=require(_0xed2a('0x4'));var rimraf=require(_0xed2a('0x5'));var config=require('../../config/environment');var attributes=require(_0xed2a('0x6'));module[_0xed2a('0x7')]=function(_0xbcc416,_0xb1d3a4){return _0xbcc416[_0xed2a('0x8')](_0xed2a('0x9'),attributes,{'tableName':_0xed2a('0xa'),'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 9264a23..1618ae6 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 _0x3b58=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','body','options','raw','info','util','moment','randomstring'];(function(_0x4d01c7,_0x5187dd){var _0x8ab042=function(_0x206f06){while(--_0x206f06){_0x4d01c7['push'](_0x4d01c7['shift']());}};_0x8ab042(++_0x5187dd);}(_0x3b58,0x1cd));var _0x83b5=function(_0xfa8991,_0x230f75){_0xfa8991=_0xfa8991-0x0;var _0x4ef549=_0x3b58[_0xfa8991];return _0x4ef549;};'use strict';var _=require('lodash');var util=require(_0x83b5('0x0'));var moment=require(_0x83b5('0x1'));var BPromise=require('bluebird');var rs=require(_0x83b5('0x2'));var fs=require('fs');var Redis=require(_0x83b5('0x3'));var db=require(_0x83b5('0x4'))['db'];var utils=require(_0x83b5('0x5'));var logger=require(_0x83b5('0x6'))(_0x83b5('0x7'));var config=require(_0x83b5('0x8'));var jayson=require(_0x83b5('0x9'));var client=jayson[_0x83b5('0xa')][_0x83b5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b0e1c,_0x4824ea,_0x44bf0d){return new BPromise(function(_0x1581ec,_0x3ed174){return client[_0x83b5('0xc')](_0x5b0e1c,_0x44bf0d)[_0x83b5('0xd')](function(_0x58485f){logger['info'](_0x83b5('0xe'),_0x4824ea,_0x83b5('0xf'));logger[_0x83b5('0x10')](_0x83b5('0x11'),_0x4824ea,_0x83b5('0xf'),JSON[_0x83b5('0x12')](_0x58485f));if(_0x58485f[_0x83b5('0x13')]){if(_0x58485f['error'][_0x83b5('0x14')]===0x1f4){logger[_0x83b5('0x13')](_0x83b5('0xe'),_0x4824ea,_0x58485f['error'][_0x83b5('0x15')]);return _0x3ed174(_0x58485f[_0x83b5('0x13')][_0x83b5('0x15')]);}logger['error'](_0x83b5('0xe'),_0x4824ea,_0x58485f[_0x83b5('0x13')][_0x83b5('0x15')]);return _0x1581ec(_0x58485f[_0x83b5('0x13')][_0x83b5('0x15')]);}else{logger['info'](_0x83b5('0xe'),_0x4824ea,_0x83b5('0xf'));_0x1581ec(_0x58485f[_0x83b5('0x16')]['message']);}})[_0x83b5('0x17')](function(_0xa85e8e){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x4824ea,_0xa85e8e);_0x3ed174(_0xa85e8e);});});}exports[_0x83b5('0x18')]=function(_0x3f244){var _0x50b6ae=this;return new Promise(function(_0x3f1589,_0x52bf10){return db['SquareDetailsReport']['create'](_0x3f244[_0x83b5('0x19')],{'raw':_0x3f244[_0x83b5('0x1a')]?_0x3f244[_0x83b5('0x1a')][_0x83b5('0x1b')]===undefined?!![]:![]:!![]})[_0x83b5('0xd')](function(_0x248caf){logger[_0x83b5('0x1c')](_0x83b5('0x18'),_0x3f244);logger[_0x83b5('0x10')](_0x83b5('0x18'),_0x3f244,JSON[_0x83b5('0x12')](_0x248caf));_0x3f1589(_0x248caf);})[_0x83b5('0x17')](function(_0x3bcd24){logger['error']('CreateSquareDetailsReport',_0x3bcd24[_0x83b5('0x15')],_0x3f244);_0x52bf10(_0x50b6ae['error'](0x1f4,_0x3bcd24[_0x83b5('0x15')]));});});}; \ No newline at end of file +var _0x8d1d=['info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8d1d,0x14e));var _0xd8d1=function(_0x4b99f5,_0x28a598){_0x4b99f5=_0x4b99f5-0x0;var _0x5ce432=_0x8d1d[_0x4b99f5];return _0x5ce432;};'use strict';var _=require(_0xd8d1('0x0'));var util=require(_0xd8d1('0x1'));var moment=require(_0xd8d1('0x2'));var BPromise=require(_0xd8d1('0x3'));var rs=require(_0xd8d1('0x4'));var fs=require('fs');var Redis=require(_0xd8d1('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd8d1('0x6'))(_0xd8d1('0x7'));var config=require(_0xd8d1('0x8'));var jayson=require(_0xd8d1('0x9'));var client=jayson[_0xd8d1('0xa')][_0xd8d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11d936,_0x7405fe,_0x2b705e){return new BPromise(function(_0xd06478,_0x2a0b16){return client[_0xd8d1('0xc')](_0x11d936,_0x2b705e)[_0xd8d1('0xd')](function(_0x4be814){logger[_0xd8d1('0xe')](_0xd8d1('0xf'),_0x7405fe,_0xd8d1('0x10'));logger['debug'](_0xd8d1('0x11'),_0x7405fe,_0xd8d1('0x10'),JSON[_0xd8d1('0x12')](_0x4be814));if(_0x4be814[_0xd8d1('0x13')]){if(_0x4be814[_0xd8d1('0x13')][_0xd8d1('0x14')]===0x1f4){logger[_0xd8d1('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x7405fe,_0x4be814['error']['message']);return _0x2a0b16(_0x4be814[_0xd8d1('0x13')][_0xd8d1('0x15')]);}logger[_0xd8d1('0x13')](_0xd8d1('0xf'),_0x7405fe,_0x4be814['error'][_0xd8d1('0x15')]);return _0xd06478(_0x4be814['error']['message']);}else{logger[_0xd8d1('0xe')](_0xd8d1('0xf'),_0x7405fe,_0xd8d1('0x10'));_0xd06478(_0x4be814[_0xd8d1('0x16')][_0xd8d1('0x15')]);}})[_0xd8d1('0x17')](function(_0x3cc1cd){logger[_0xd8d1('0x13')](_0xd8d1('0xf'),_0x7405fe,_0x3cc1cd);_0x2a0b16(_0x3cc1cd);});});}exports[_0xd8d1('0x18')]=function(_0x59ba83){var _0x329cc7=this;return new Promise(function(_0x2b254a,_0x4a00ae){return db[_0xd8d1('0x19')][_0xd8d1('0x1a')](_0x59ba83['body'],{'raw':_0x59ba83[_0xd8d1('0x1b')]?_0x59ba83[_0xd8d1('0x1b')][_0xd8d1('0x1c')]===undefined?!![]:![]:!![]})[_0xd8d1('0xd')](function(_0x13c739){logger[_0xd8d1('0xe')]('CreateSquareDetailsReport',_0x59ba83);logger['debug'](_0xd8d1('0x18'),_0x59ba83,JSON[_0xd8d1('0x12')](_0x13c739));_0x2b254a(_0x13c739);})[_0xd8d1('0x17')](function(_0x4fcd02){logger[_0xd8d1('0x13')]('CreateSquareDetailsReport',_0x4fcd02[_0xd8d1('0x15')],_0x59ba83);_0x4a00ae(_0x329cc7[_0xd8d1('0x13')](0x1f4,_0x4fcd02[_0xd8d1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 862ee22..b2ca2f5 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 _0xe6e4=['isAuthenticated','index','/process/:pid/kill','killProcess','express','Router','../../components/auth/service','./system.controller','get'];(function(_0x413cae,_0x10b9f2){var _0x25a149=function(_0x2d29a6){while(--_0x2d29a6){_0x413cae['push'](_0x413cae['shift']());}};_0x25a149(++_0x10b9f2);}(_0xe6e4,0xc1));var _0x4e6e=function(_0x49c653,_0x390195){_0x49c653=_0x49c653-0x0;var _0x31e169=_0xe6e4[_0x49c653];return _0x31e169;};'use strict';var express=require(_0x4e6e('0x0'));var router=express[_0x4e6e('0x1')]();var auth=require(_0x4e6e('0x2'));var controller=require(_0x4e6e('0x3'));router[_0x4e6e('0x4')]('/',auth[_0x4e6e('0x5')](),controller[_0x4e6e('0x6')]);router[_0x4e6e('0x4')](_0x4e6e('0x7'),auth['isAuthenticated'](),controller[_0x4e6e('0x8')]);module['exports']=router; \ No newline at end of file +var _0x822f=['/process/:pid/kill','killProcess','express','../../components/auth/service','get','isAuthenticated','index'];(function(_0x5ee3d3,_0x537c30){var _0x4b272f=function(_0x3dc277){while(--_0x3dc277){_0x5ee3d3['push'](_0x5ee3d3['shift']());}};_0x4b272f(++_0x537c30);}(_0x822f,0x79));var _0xf822=function(_0xf6a4f3,_0x4c5796){_0xf6a4f3=_0xf6a4f3-0x0;var _0x30d969=_0x822f[_0xf6a4f3];return _0x30d969;};'use strict';var express=require(_0xf822('0x0'));var router=express['Router']();var auth=require(_0xf822('0x1'));var controller=require('./system.controller');router[_0xf822('0x2')]('/',auth[_0xf822('0x3')](),controller[_0xf822('0x4')]);router[_0xf822('0x2')](_0xf822('0x5'),auth[_0xf822('0x3')](),controller[_0xf822('0x6')]);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 10a1a65..8ff91ad 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 _0xe86b=['catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','getAllData','then','json'];(function(_0x156ba8,_0x5de53e){var _0x4007c3=function(_0x3bb903){while(--_0x3bb903){_0x156ba8['push'](_0x156ba8['shift']());}};_0x4007c3(++_0x5de53e);}(_0xe86b,0x182));var _0xbe86=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xe86b[_0x4a9fb1];return _0x348672;};'use strict';var info=require(_0xbe86('0x0'));var exec=require(_0xbe86('0x1'))['exec'];var logger=require(_0xbe86('0x2'))('api');var util=require(_0xbe86('0x3'));var BPromise=require(_0xbe86('0x4'));var _=require(_0xbe86('0x5'));function handleError(_0x2a1ef5,_0x2890d1,_0xaf5c50){_0x2890d1=_0x2890d1||0x1f4;return function(_0x5e837b){logger['error'](_0xbe86('0x6'),_0xaf5c50,_0x2890d1,util['inspect'](_0x5e837b,{'showHidden':![],'depth':null}));delete _0x5e837b[_0xbe86('0x7')];_0x2a1ef5[_0xbe86('0x8')](_0x2890d1)[_0xbe86('0x9')](_0x5e837b);};}exports[_0xbe86('0xa')]=function(_0x1c5be6,_0x43cce0){return info[_0xbe86('0xb')]()[_0xbe86('0xc')](function(_0x5bb316){return _0x43cce0[_0xbe86('0x8')](0xc8)[_0xbe86('0xd')](_0x5bb316);})[_0xbe86('0xe')](function(_0x365045){return _0x43cce0['status'](0x1f4)[_0xbe86('0xd')](_0x365045);});};exports[_0xbe86('0xf')]=function(_0x1431b2,_0x3006c0){var _0x387f59=['components/import/cm'];return new BPromise(function(_0xec6fd0,_0x4a535e){return exec(util[_0xbe86('0x10')](_0xbe86('0x11'),_0x1431b2[_0xbe86('0x12')][_0xbe86('0x13')]),function(_0x4855d3,_0x2ca975,_0x57086f){if(_0x4855d3){return _0x4a535e(_0x4855d3);}return _0xec6fd0(_0x2ca975);});})[_0xbe86('0xc')](function(_0x456ee0){var _0x3fdf8e=![];var _0x18ac59=_0x456ee0[_0xbe86('0x14')](/\n/);for(var _0x1f1082=0x0,_0x1b937b=_0x387f59['length'];_0x1f1082<_0x1b937b,_0x3fdf8e===![];_0x1f1082+=0x1){if(_0x456ee0[_0xbe86('0x15')](_0x387f59[_0x1f1082])>=0x0){_0x3fdf8e=!![];}}if(!_0x3fdf8e){throw new Error(util[_0xbe86('0x10')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x1431b2[_0xbe86('0x12')][_0xbe86('0x13')]));}process[_0xbe86('0x16')](_0x1431b2[_0xbe86('0x12')][_0xbe86('0x13')],_0xbe86('0x17'));return _0x3006c0[_0xbe86('0x8')](0xc8)[_0xbe86('0xd')]({'message':util['format'](_0xbe86('0x18'),_0x1431b2[_0xbe86('0x12')][_0xbe86('0x13')])});})[_0xbe86('0xe')](handleError(_0x3006c0,null,_0xbe86('0xf')));}; \ No newline at end of file +var _0xd68c=['systeminformation','../../config/logger','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','getAllData','then','json','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','catch'];(function(_0x300e96,_0x329b01){var _0x3a4fe6=function(_0x558e83){while(--_0x558e83){_0x300e96['push'](_0x300e96['shift']());}};_0x3a4fe6(++_0x329b01);}(_0xd68c,0x113));var _0xcd68=function(_0x10d07b,_0xa771c5){_0x10d07b=_0x10d07b-0x0;var _0x2c880e=_0xd68c[_0x10d07b];return _0x2c880e;};'use strict';var info=require(_0xcd68('0x0'));var exec=require('child_process')['exec'];var logger=require(_0xcd68('0x1'))(_0xcd68('0x2'));var util=require(_0xcd68('0x3'));var BPromise=require(_0xcd68('0x4'));var _=require('lodash');function handleError(_0x25f7db,_0x3d8727,_0x30e2aa){_0x3d8727=_0x3d8727||0x1f4;return function(_0x34d1ad){logger[_0xcd68('0x5')](_0xcd68('0x6'),_0x30e2aa,_0x3d8727,util[_0xcd68('0x7')](_0x34d1ad,{'showHidden':![],'depth':null}));delete _0x34d1ad[_0xcd68('0x8')];_0x25f7db[_0xcd68('0x9')](_0x3d8727)['send'](_0x34d1ad);};}exports[_0xcd68('0xa')]=function(_0x20c9d7,_0x2ae41d){return info[_0xcd68('0xb')]()[_0xcd68('0xc')](function(_0x5d9622){return _0x2ae41d[_0xcd68('0x9')](0xc8)[_0xcd68('0xd')](_0x5d9622);})['catch'](function(_0x3a639d){return _0x2ae41d['status'](0x1f4)[_0xcd68('0xd')](_0x3a639d);});};exports[_0xcd68('0xe')]=function(_0x4b3015,_0x112219){var _0x28f35a=['components/import/cm'];return new BPromise(function(_0x591c2d,_0x320d21){return exec(util[_0xcd68('0xf')](_0xcd68('0x10'),_0x4b3015[_0xcd68('0x11')]['pid']),function(_0x419f7a,_0x4f3fd0,_0x374071){if(_0x419f7a){return _0x320d21(_0x419f7a);}return _0x591c2d(_0x4f3fd0);});})[_0xcd68('0xc')](function(_0x197da1){var _0x43053a=![];var _0x20c156=_0x197da1[_0xcd68('0x12')](/\n/);for(var _0x4f21a2=0x0,_0x23bac4=_0x28f35a[_0xcd68('0x13')];_0x4f21a2<_0x23bac4,_0x43053a===![];_0x4f21a2+=0x1){if(_0x197da1[_0xcd68('0x14')](_0x28f35a[_0x4f21a2])>=0x0){_0x43053a=!![];}}if(!_0x43053a){throw new Error(util[_0xcd68('0xf')](_0xcd68('0x15'),_0x4b3015['params'][_0xcd68('0x16')]));}process[_0xcd68('0x17')](_0x4b3015['params']['pid'],'SIGINT');return _0x112219['status'](0xc8)[_0xcd68('0xd')]({'message':util[_0xcd68('0xf')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x4b3015[_0xcd68('0x11')]['pid'])});})[_0xcd68('0x18')](handleError(_0x112219,null,_0xcd68('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 856918c..edb8777 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 _0xe07c=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer'];(function(_0x34f1fd,_0x481e4f){var _0x3fdf39=function(_0x41a2a1){while(--_0x41a2a1){_0x34f1fd['push'](_0x34f1fd['shift']());}};_0x3fdf39(++_0x481e4f);}(_0xe07c,0x1f3));var _0xce07=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xe07c[_0x500419];return _0x241c1a;};'use strict';var multer=require(_0xce07('0x0'));var util=require(_0xce07('0x1'));var path=require(_0xce07('0x2'));var timeout=require(_0xce07('0x3'));var express=require(_0xce07('0x4'));var router=express[_0xce07('0x5')]();var fs_extra=require(_0xce07('0x6'));var auth=require(_0xce07('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xce07('0x8'));var controller=require(_0xce07('0x9'));router[_0xce07('0xa')]('/',auth[_0xce07('0xb')](),controller[_0xce07('0xc')]);router[_0xce07('0xa')](_0xce07('0xd'),auth[_0xce07('0xb')](),controller[_0xce07('0xe')]);router[_0xce07('0xf')]('/',auth[_0xce07('0xb')](),controller[_0xce07('0x10')]);router[_0xce07('0x11')](_0xce07('0xd'),auth[_0xce07('0xb')](),controller[_0xce07('0x12')]);router['delete'](_0xce07('0xd'),auth[_0xce07('0xb')](),controller[_0xce07('0x13')]);module['exports']=router; \ No newline at end of file +var _0xdc39=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','index','get','show','post','create','update','delete','destroy','exports'];(function(_0x25914e,_0x41030e){var _0xbc0de9=function(_0x5abcf3){while(--_0x5abcf3){_0x25914e['push'](_0x25914e['shift']());}};_0xbc0de9(++_0x41030e);}(_0xdc39,0x169));var _0x9dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc39[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x9dc3('0x0'));var path=require(_0x9dc3('0x1'));var timeout=require(_0x9dc3('0x2'));var express=require(_0x9dc3('0x3'));var router=express[_0x9dc3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9dc3('0x5'));var interaction=require(_0x9dc3('0x6'));var config=require(_0x9dc3('0x7'));var controller=require(_0x9dc3('0x8'));router['get']('/',auth[_0x9dc3('0x9')](),controller[_0x9dc3('0xa')]);router[_0x9dc3('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x9dc3('0xc')]);router[_0x9dc3('0xd')]('/',auth[_0x9dc3('0x9')](),controller[_0x9dc3('0xe')]);router['put']('/:id',auth[_0x9dc3('0x9')](),controller[_0x9dc3('0xf')]);router[_0x9dc3('0x10')]('/:id',auth[_0x9dc3('0x9')](),controller[_0x9dc3('0x11')]);module[_0x9dc3('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index e199554..5931ee8 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 _0x5c00=['STRING','sequelize','exports'];(function(_0x38924a,_0x5923c6){var _0x2c85db=function(_0xe7ce60){while(--_0xe7ce60){_0x38924a['push'](_0x38924a['shift']());}};_0x2c85db(++_0x5923c6);}(_0x5c00,0x17e));var _0x05c0=function(_0x3ba748,_0x4b8fb9){_0x3ba748=_0x3ba748-0x0;var _0x5b04e2=_0x5c00[_0x3ba748];return _0x5b04e2;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'name':{'type':Sequelize[_0x05c0('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x05c0('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x05c0('0x2')]}}; \ No newline at end of file +var _0x4483=['exports','STRING','#0091EA','sequelize'];(function(_0x4b6f63,_0x4c2790){var _0x265b16=function(_0x278f19){while(--_0x278f19){_0x4b6f63['push'](_0x4b6f63['shift']());}};_0x265b16(++_0x4c2790);}(_0x4483,0x1a3));var _0x3448=function(_0x5c98b6,_0x1a4b3a){_0x5c98b6=_0x5c98b6-0x0;var _0xfdd6ed=_0x4483[_0x5c98b6];return _0xfdd6ed;};'use strict';var Sequelize=require(_0x3448('0x0'));module[_0x3448('0x1')]={'name':{'type':Sequelize[_0x3448('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3448('0x2')],'defaultValue':_0x3448('0x3')},'description':{'type':Sequelize[_0x3448('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 1bbe9f4..59b77cf 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 _0xb1d2=['order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Tags','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','index','map','Tag','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x3edc6f,_0x30dc72){var _0xa77a67=function(_0x3e7a9c){while(--_0x3e7a9c){_0x3edc6f['push'](_0x3edc6f['shift']());}};_0xa77a67(++_0x30dc72);}(_0xb1d2,0xbf));var _0x2b1d=function(_0x292f01,_0x423f2b){_0x292f01=_0x292f01-0x0;var _0x28f1e9=_0xb1d2[_0x292f01];return _0x28f1e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b1d('0x0'));var zipdir=require(_0x2b1d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b1d('0x2'));var moment=require(_0x2b1d('0x3'));var BPromise=require(_0x2b1d('0x4'));var Mustache=require(_0x2b1d('0x5'));var util=require(_0x2b1d('0x6'));var path=require('path');var sox=require(_0x2b1d('0x7'));var csv=require(_0x2b1d('0x8'));var ejs=require(_0x2b1d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b1d('0xa'));var squel=require(_0x2b1d('0xb'));var crypto=require(_0x2b1d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2b1d('0xd'));var toCsv=require(_0x2b1d('0x8'));var querystring=require(_0x2b1d('0xe'));var Papa=require(_0x2b1d('0xf'));var Redis=require(_0x2b1d('0x10'));var authService=require(_0x2b1d('0x11'));var qs=require(_0x2b1d('0x12'));var as=require(_0x2b1d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b1d('0x14'))(_0x2b1d('0x15'));var utils=require(_0x2b1d('0x16'));var config=require(_0x2b1d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2b1d('0x18'))['db'];function respondWithStatusCode(_0xb704ea,_0x34a5c8){_0x34a5c8=_0x34a5c8||0xcc;return function(_0xc2cf33){if(_0xc2cf33){return _0xb704ea[_0x2b1d('0x19')](_0x34a5c8);}return _0xb704ea[_0x2b1d('0x1a')](_0x34a5c8)['end']();};}function respondWithResult(_0x47ec00,_0x130f48){_0x130f48=_0x130f48||0xc8;return function(_0x4696a4){if(_0x4696a4){return _0x47ec00['status'](_0x130f48)[_0x2b1d('0x1b')](_0x4696a4);}};}function respondWithFilteredResult(_0x5399c5,_0x1019c2){return function(_0x3f73e4){if(_0x3f73e4){var _0x7c1b0d=typeof _0x1019c2[_0x2b1d('0x1c')]===_0x2b1d('0x1d')&&typeof _0x1019c2[_0x2b1d('0x1e')]===_0x2b1d('0x1d');var _0x51b7ad=_0x3f73e4[_0x2b1d('0x1f')];var _0x2f269a=_0x7c1b0d?0x0:_0x1019c2[_0x2b1d('0x1c')];var _0x592778=_0x7c1b0d?_0x3f73e4['count']:_0x1019c2[_0x2b1d('0x1c')]+_0x1019c2[_0x2b1d('0x1e')];var _0x2c575f;if(_0x592778>=_0x51b7ad){_0x592778=_0x51b7ad;_0x2c575f=0xc8;}else{_0x2c575f=0xce;}_0x5399c5['status'](_0x2c575f);return _0x5399c5['set'](_0x2b1d('0x20'),_0x2f269a+'-'+_0x592778+'/'+_0x51b7ad)['json'](_0x3f73e4);}return null;};}function patchUpdates(_0x35700a){return function(_0x479ec4){try{jsonpatch[_0x2b1d('0x21')](_0x479ec4,_0x35700a,!![]);}catch(_0x50cd73){return BPromise[_0x2b1d('0x22')](_0x50cd73);}return _0x479ec4[_0x2b1d('0x23')]();};}function saveUpdates(_0x575ce7,_0x212f20){return function(_0x3722da){if(_0x3722da){return _0x3722da[_0x2b1d('0x24')](_0x575ce7)[_0x2b1d('0x25')](function(_0x14203f){return _0x14203f;});}return null;};}function removeEntity(_0x1c1281,_0x30f8d5){return function(_0x2faab0){if(_0x2faab0){return _0x2faab0[_0x2b1d('0x26')]()['then'](function(){var _0x211ee3=_0x2faab0[_0x2b1d('0x27')]({'plain':!![]});var _0x318606='Tags';return db[_0x2b1d('0x28')]['destroy']({'where':{'type':_0x318606,'resourceId':_0x211ee3['id']}})[_0x2b1d('0x25')](function(){return _0x2faab0;});})[_0x2b1d('0x25')](function(){_0x1c1281[_0x2b1d('0x1a')](0xcc)[_0x2b1d('0x29')]();});}};}function handleEntityNotFound(_0x44b1a0,_0x21ace4){return function(_0x5a2c69){if(!_0x5a2c69){_0x44b1a0[_0x2b1d('0x19')](0x194);}return _0x5a2c69;};}function handleError(_0x567cec,_0x2f542f){_0x2f542f=_0x2f542f||0x1f4;return function(_0x5dfd33){logger[_0x2b1d('0x2a')](_0x5dfd33['stack']);if(_0x5dfd33['name']){delete _0x5dfd33[_0x2b1d('0x2b')];}_0x567cec[_0x2b1d('0x1a')](_0x2f542f)[_0x2b1d('0x2c')](_0x5dfd33);};}exports[_0x2b1d('0x2d')]=function(_0x2d830c,_0x4b2246){var _0x5978be={},_0x3517b4={},_0xa1ddfb={'count':0x0,'rows':[]};var _0x46a410=_[_0x2b1d('0x2e')](db[_0x2b1d('0x2f')]['rawAttributes'],function(_0x9f7c6e){return{'name':_0x9f7c6e[_0x2b1d('0x30')],'type':_0x9f7c6e[_0x2b1d('0x31')][_0x2b1d('0x32')]};});_0x3517b4[_0x2b1d('0x33')]=_['map'](_0x46a410,_0x2b1d('0x2b'));_0x3517b4[_0x2b1d('0x34')]=_[_0x2b1d('0x35')](_0x2d830c[_0x2b1d('0x34')]);_0x3517b4[_0x2b1d('0x36')]=_[_0x2b1d('0x37')](_0x3517b4['model'],_0x3517b4[_0x2b1d('0x34')]);_0x5978be['attributes']=_[_0x2b1d('0x37')](_0x3517b4[_0x2b1d('0x33')],qs['fields'](_0x2d830c[_0x2b1d('0x34')][_0x2b1d('0x38')]));_0x5978be['attributes']=_0x5978be[_0x2b1d('0x39')][_0x2b1d('0x3a')]?_0x5978be[_0x2b1d('0x39')]:_0x3517b4['model'];if(!_0x2d830c[_0x2b1d('0x34')][_0x2b1d('0x3b')](_0x2b1d('0x3c'))){_0x5978be['limit']=qs['limit'](_0x2d830c[_0x2b1d('0x34')][_0x2b1d('0x1e')]);_0x5978be[_0x2b1d('0x1c')]=qs[_0x2b1d('0x1c')](_0x2d830c[_0x2b1d('0x34')][_0x2b1d('0x1c')]);}_0x5978be[_0x2b1d('0x3d')]=qs['sort'](_0x2d830c[_0x2b1d('0x34')]['sort']);_0x5978be[_0x2b1d('0x3e')]=qs['filters'](_[_0x2b1d('0x3f')](_0x2d830c[_0x2b1d('0x34')],_0x3517b4[_0x2b1d('0x36')]),_0x46a410);if(_0x2d830c[_0x2b1d('0x34')][_0x2b1d('0x40')]){_0x5978be[_0x2b1d('0x3e')]=_[_0x2b1d('0x41')](_0x5978be[_0x2b1d('0x3e')],{'$or':_[_0x2b1d('0x2e')](_0x46a410,function(_0x25cff7){if(_0x25cff7['type']!==_0x2b1d('0x42')){var _0x13301b={};_0x13301b[_0x25cff7['name']]={'$like':'%'+_0x2d830c['query'][_0x2b1d('0x40')]+'%'};return _0x13301b;}})});}_0x5978be=_[_0x2b1d('0x41')]({},_0x5978be,_0x2d830c[_0x2b1d('0x43')]);var _0x5673b6={'where':_0x5978be['where']};return db[_0x2b1d('0x2f')]['count'](_0x5673b6)[_0x2b1d('0x25')](function(_0xbce943){_0xa1ddfb['count']=_0xbce943;if(_0x2d830c[_0x2b1d('0x34')][_0x2b1d('0x44')]){_0x5978be[_0x2b1d('0x45')]=[{'all':!![]}];}return db[_0x2b1d('0x2f')][_0x2b1d('0x46')](_0x5978be);})[_0x2b1d('0x25')](function(_0x343b56){_0xa1ddfb[_0x2b1d('0x47')]=_0x343b56;return _0xa1ddfb;})[_0x2b1d('0x25')](respondWithFilteredResult(_0x4b2246,_0x5978be))[_0x2b1d('0x48')](handleError(_0x4b2246,null));};exports['show']=function(_0x5cb06b,_0x52ee31){var _0x563139={'raw':!![],'where':{'id':_0x5cb06b[_0x2b1d('0x49')]['id']}},_0x144813={};_0x144813['model']=_[_0x2b1d('0x35')](db[_0x2b1d('0x2f')][_0x2b1d('0x4a')]);_0x144813[_0x2b1d('0x34')]=_['keys'](_0x5cb06b[_0x2b1d('0x34')]);_0x144813[_0x2b1d('0x36')]=_[_0x2b1d('0x37')](_0x144813[_0x2b1d('0x33')],_0x144813[_0x2b1d('0x34')]);_0x563139[_0x2b1d('0x39')]=_[_0x2b1d('0x37')](_0x144813['model'],qs[_0x2b1d('0x38')](_0x5cb06b['query'][_0x2b1d('0x38')]));_0x563139[_0x2b1d('0x39')]=_0x563139[_0x2b1d('0x39')][_0x2b1d('0x3a')]?_0x563139[_0x2b1d('0x39')]:_0x144813[_0x2b1d('0x33')];if(_0x5cb06b[_0x2b1d('0x34')][_0x2b1d('0x44')]){_0x563139[_0x2b1d('0x45')]=[{'all':!![]}];}_0x563139=_[_0x2b1d('0x41')]({},_0x563139,_0x5cb06b[_0x2b1d('0x43')]);return db[_0x2b1d('0x2f')]['find'](_0x563139)[_0x2b1d('0x25')](handleEntityNotFound(_0x52ee31,null))[_0x2b1d('0x25')](respondWithResult(_0x52ee31,null))[_0x2b1d('0x48')](handleError(_0x52ee31,null));};exports[_0x2b1d('0x4b')]=function(_0x4a94ab,_0x54db0c){return db[_0x2b1d('0x2f')][_0x2b1d('0x4b')](_0x4a94ab[_0x2b1d('0x4c')],{})['then'](function(_0x3677e4){var _0x5ac9ec=_0x4a94ab[_0x2b1d('0x4d')][_0x2b1d('0x27')]({'plain':!![]});if(!_0x5ac9ec)throw new Error(_0x2b1d('0x4e'));if(_0x5ac9ec['role']===_0x2b1d('0x4d')){var _0x1529eb=_0x3677e4[_0x2b1d('0x27')]({'plain':!![]});var _0xb848d4=_0x2b1d('0x4f');return db[_0x2b1d('0x50')]['find']({'where':{'name':_0xb848d4,'userProfileId':_0x5ac9ec[_0x2b1d('0x51')]},'raw':!![]})[_0x2b1d('0x25')](function(_0x50e1c5){if(_0x50e1c5&&_0x50e1c5['autoAssociation']===0x0){return db[_0x2b1d('0x28')][_0x2b1d('0x4b')]({'name':_0x1529eb['name'],'resourceId':_0x1529eb['id'],'type':_0x50e1c5[_0x2b1d('0x2b')],'sectionId':_0x50e1c5['id']},{})[_0x2b1d('0x25')](function(){return _0x3677e4;});}else{return _0x3677e4;}})[_0x2b1d('0x48')](function(_0x354827){logger[_0x2b1d('0x2a')](_0x2b1d('0x52'),_0x354827);throw _0x354827;});}return _0x3677e4;})['then'](respondWithResult(_0x54db0c,0xc9))[_0x2b1d('0x48')](handleError(_0x54db0c,null));};exports[_0x2b1d('0x24')]=function(_0x335acf,_0x2502f5){if(_0x335acf[_0x2b1d('0x4c')]['id']){delete _0x335acf[_0x2b1d('0x4c')]['id'];}return db['Tag'][_0x2b1d('0x53')]({'where':{'id':_0x335acf[_0x2b1d('0x49')]['id']}})['then'](handleEntityNotFound(_0x2502f5,null))[_0x2b1d('0x25')](saveUpdates(_0x335acf[_0x2b1d('0x4c')],null))[_0x2b1d('0x25')](respondWithResult(_0x2502f5,null))[_0x2b1d('0x48')](handleError(_0x2502f5,null));};exports[_0x2b1d('0x26')]=function(_0x5d12d2,_0x2a38c9){return db[_0x2b1d('0x2f')][_0x2b1d('0x53')]({'where':{'id':_0x5d12d2[_0x2b1d('0x49')]['id']}})[_0x2b1d('0x25')](handleEntityNotFound(_0x2a38c9,null))[_0x2b1d('0x25')](removeEntity(_0x2a38c9,null))['catch'](handleError(_0x2a38c9,null));}; \ No newline at end of file +var _0xf9a2=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','get','Tags','destroy','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','Tag','include','findAll','rows','catch','params','keys','length','includeAll','options','create','body','user'];(function(_0x1bc508,_0x136af6){var _0x34554c=function(_0x3ea65){while(--_0x3ea65){_0x1bc508['push'](_0x1bc508['shift']());}};_0x34554c(++_0x136af6);}(_0xf9a2,0x10b));var _0x2f9a=function(_0x53fc51,_0x1eebc4){_0x53fc51=_0x53fc51-0x0;var _0x1d8c4c=_0xf9a2[_0x53fc51];return _0x1d8c4c;};'use strict';var emlformat=require(_0x2f9a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2f9a('0x1'));var rp=require(_0x2f9a('0x2'));var moment=require(_0x2f9a('0x3'));var BPromise=require(_0x2f9a('0x4'));var Mustache=require(_0x2f9a('0x5'));var util=require(_0x2f9a('0x6'));var path=require(_0x2f9a('0x7'));var sox=require(_0x2f9a('0x8'));var csv=require(_0x2f9a('0x9'));var ejs=require(_0x2f9a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f9a('0xb'));var squel=require(_0x2f9a('0xc'));var crypto=require('crypto');var jsforce=require(_0x2f9a('0xd'));var deskjs=require(_0x2f9a('0xe'));var toCsv=require(_0x2f9a('0x9'));var querystring=require(_0x2f9a('0xf'));var Papa=require(_0x2f9a('0x10'));var Redis=require(_0x2f9a('0x11'));var authService=require(_0x2f9a('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f9a('0x13'));var logger=require(_0x2f9a('0x14'))(_0x2f9a('0x15'));var utils=require('../../config/utils');var config=require(_0x2f9a('0x16'));var licenseUtil=require(_0x2f9a('0x17'));var db=require(_0x2f9a('0x18'))['db'];function respondWithStatusCode(_0x81e632,_0x51171b){_0x51171b=_0x51171b||0xcc;return function(_0x5415c9){if(_0x5415c9){return _0x81e632[_0x2f9a('0x19')](_0x51171b);}return _0x81e632['status'](_0x51171b)[_0x2f9a('0x1a')]();};}function respondWithResult(_0x321db0,_0x379dff){_0x379dff=_0x379dff||0xc8;return function(_0x3454f2){if(_0x3454f2){return _0x321db0[_0x2f9a('0x1b')](_0x379dff)[_0x2f9a('0x1c')](_0x3454f2);}};}function respondWithFilteredResult(_0xa9fcef,_0xab1212){return function(_0x4a5c23){if(_0x4a5c23){var _0x1ae590=typeof _0xab1212['offset']==='undefined'&&typeof _0xab1212[_0x2f9a('0x1d')]===_0x2f9a('0x1e');var _0x462057=_0x4a5c23[_0x2f9a('0x1f')];var _0x171eee=_0x1ae590?0x0:_0xab1212[_0x2f9a('0x20')];var _0x2fedf8=_0x1ae590?_0x4a5c23[_0x2f9a('0x1f')]:_0xab1212['offset']+_0xab1212[_0x2f9a('0x1d')];var _0x3b07f2;if(_0x2fedf8>=_0x462057){_0x2fedf8=_0x462057;_0x3b07f2=0xc8;}else{_0x3b07f2=0xce;}_0xa9fcef[_0x2f9a('0x1b')](_0x3b07f2);return _0xa9fcef['set'](_0x2f9a('0x21'),_0x171eee+'-'+_0x2fedf8+'/'+_0x462057)[_0x2f9a('0x1c')](_0x4a5c23);}return null;};}function patchUpdates(_0x190032){return function(_0x3ba5ad){try{jsonpatch[_0x2f9a('0x22')](_0x3ba5ad,_0x190032,!![]);}catch(_0x327902){return BPromise[_0x2f9a('0x23')](_0x327902);}return _0x3ba5ad[_0x2f9a('0x24')]();};}function saveUpdates(_0xa0d627,_0x265063){return function(_0x36c666){if(_0x36c666){return _0x36c666[_0x2f9a('0x25')](_0xa0d627)['then'](function(_0x277859){return _0x277859;});}return null;};}function removeEntity(_0x503d23,_0x2a8df1){return function(_0x39958f){if(_0x39958f){return _0x39958f['destroy']()[_0x2f9a('0x26')](function(){var _0x23717a=_0x39958f[_0x2f9a('0x27')]({'plain':!![]});var _0x35b019=_0x2f9a('0x28');return db['UserProfileResource'][_0x2f9a('0x29')]({'where':{'type':_0x35b019,'resourceId':_0x23717a['id']}})[_0x2f9a('0x26')](function(){return _0x39958f;});})['then'](function(){_0x503d23[_0x2f9a('0x1b')](0xcc)[_0x2f9a('0x1a')]();});}};}function handleEntityNotFound(_0x5edbdb,_0x485245){return function(_0x3130b9){if(!_0x3130b9){_0x5edbdb['sendStatus'](0x194);}return _0x3130b9;};}function handleError(_0x36e2a0,_0x4d0db8){_0x4d0db8=_0x4d0db8||0x1f4;return function(_0x5f317e){logger['error'](_0x5f317e['stack']);if(_0x5f317e[_0x2f9a('0x2a')]){delete _0x5f317e[_0x2f9a('0x2a')];}_0x36e2a0[_0x2f9a('0x1b')](_0x4d0db8)[_0x2f9a('0x2b')](_0x5f317e);};}exports[_0x2f9a('0x2c')]=function(_0x1cfdba,_0x12edf3){var _0x6d9542={},_0x2f30b8={},_0x5e4ebc={'count':0x0,'rows':[]};var _0x3f8e1e=_[_0x2f9a('0x2d')](db['Tag'][_0x2f9a('0x2e')],function(_0x125491){return{'name':_0x125491[_0x2f9a('0x2f')],'type':_0x125491['type'][_0x2f9a('0x30')]};});_0x2f30b8[_0x2f9a('0x31')]=_[_0x2f9a('0x2d')](_0x3f8e1e,_0x2f9a('0x2a'));_0x2f30b8[_0x2f9a('0x32')]=_['keys'](_0x1cfdba[_0x2f9a('0x32')]);_0x2f30b8[_0x2f9a('0x33')]=_[_0x2f9a('0x34')](_0x2f30b8[_0x2f9a('0x31')],_0x2f30b8[_0x2f9a('0x32')]);_0x6d9542[_0x2f9a('0x35')]=_[_0x2f9a('0x34')](_0x2f30b8[_0x2f9a('0x31')],qs[_0x2f9a('0x36')](_0x1cfdba[_0x2f9a('0x32')][_0x2f9a('0x36')]));_0x6d9542['attributes']=_0x6d9542[_0x2f9a('0x35')]['length']?_0x6d9542[_0x2f9a('0x35')]:_0x2f30b8[_0x2f9a('0x31')];if(!_0x1cfdba['query'][_0x2f9a('0x37')](_0x2f9a('0x38'))){_0x6d9542[_0x2f9a('0x1d')]=qs[_0x2f9a('0x1d')](_0x1cfdba[_0x2f9a('0x32')]['limit']);_0x6d9542[_0x2f9a('0x20')]=qs[_0x2f9a('0x20')](_0x1cfdba[_0x2f9a('0x32')][_0x2f9a('0x20')]);}_0x6d9542['order']=qs['sort'](_0x1cfdba['query'][_0x2f9a('0x39')]);_0x6d9542['where']=qs[_0x2f9a('0x33')](_[_0x2f9a('0x3a')](_0x1cfdba['query'],_0x2f30b8[_0x2f9a('0x33')]),_0x3f8e1e);if(_0x1cfdba[_0x2f9a('0x32')][_0x2f9a('0x3b')]){_0x6d9542[_0x2f9a('0x3c')]=_[_0x2f9a('0x3d')](_0x6d9542[_0x2f9a('0x3c')],{'$or':_['map'](_0x3f8e1e,function(_0x3349a9){if(_0x3349a9[_0x2f9a('0x3e')]!==_0x2f9a('0x3f')){var _0x1b3238={};_0x1b3238[_0x3349a9['name']]={'$like':'%'+_0x1cfdba[_0x2f9a('0x32')][_0x2f9a('0x3b')]+'%'};return _0x1b3238;}})});}_0x6d9542=_['merge']({},_0x6d9542,_0x1cfdba['options']);var _0x4df8ad={'where':_0x6d9542[_0x2f9a('0x3c')]};return db[_0x2f9a('0x40')][_0x2f9a('0x1f')](_0x4df8ad)['then'](function(_0x122050){_0x5e4ebc['count']=_0x122050;if(_0x1cfdba['query']['includeAll']){_0x6d9542[_0x2f9a('0x41')]=[{'all':!![]}];}return db[_0x2f9a('0x40')][_0x2f9a('0x42')](_0x6d9542);})['then'](function(_0x94b302){_0x5e4ebc[_0x2f9a('0x43')]=_0x94b302;return _0x5e4ebc;})[_0x2f9a('0x26')](respondWithFilteredResult(_0x12edf3,_0x6d9542))[_0x2f9a('0x44')](handleError(_0x12edf3,null));};exports['show']=function(_0x39f1e0,_0x1239b7){var _0x5c1c58={'raw':!![],'where':{'id':_0x39f1e0[_0x2f9a('0x45')]['id']}},_0x372710={};_0x372710[_0x2f9a('0x31')]=_[_0x2f9a('0x46')](db[_0x2f9a('0x40')][_0x2f9a('0x2e')]);_0x372710['query']=_['keys'](_0x39f1e0[_0x2f9a('0x32')]);_0x372710[_0x2f9a('0x33')]=_[_0x2f9a('0x34')](_0x372710[_0x2f9a('0x31')],_0x372710[_0x2f9a('0x32')]);_0x5c1c58[_0x2f9a('0x35')]=_[_0x2f9a('0x34')](_0x372710['model'],qs[_0x2f9a('0x36')](_0x39f1e0[_0x2f9a('0x32')][_0x2f9a('0x36')]));_0x5c1c58['attributes']=_0x5c1c58[_0x2f9a('0x35')][_0x2f9a('0x47')]?_0x5c1c58[_0x2f9a('0x35')]:_0x372710[_0x2f9a('0x31')];if(_0x39f1e0[_0x2f9a('0x32')][_0x2f9a('0x48')]){_0x5c1c58[_0x2f9a('0x41')]=[{'all':!![]}];}_0x5c1c58=_[_0x2f9a('0x3d')]({},_0x5c1c58,_0x39f1e0[_0x2f9a('0x49')]);return db[_0x2f9a('0x40')]['find'](_0x5c1c58)[_0x2f9a('0x26')](handleEntityNotFound(_0x1239b7,null))[_0x2f9a('0x26')](respondWithResult(_0x1239b7,null))[_0x2f9a('0x44')](handleError(_0x1239b7,null));};exports[_0x2f9a('0x4a')]=function(_0xd5204a,_0x36695d){return db[_0x2f9a('0x40')]['create'](_0xd5204a[_0x2f9a('0x4b')],{})[_0x2f9a('0x26')](function(_0x31cf6b){var _0x3051d3=_0xd5204a[_0x2f9a('0x4c')][_0x2f9a('0x27')]({'plain':!![]});if(!_0x3051d3)throw new Error(_0x2f9a('0x4d'));if(_0x3051d3[_0x2f9a('0x4e')]===_0x2f9a('0x4c')){var _0x5b7e80=_0x31cf6b['get']({'plain':!![]});var _0x51c514=_0x2f9a('0x28');return db[_0x2f9a('0x4f')]['find']({'where':{'name':_0x51c514,'userProfileId':_0x3051d3[_0x2f9a('0x50')]},'raw':!![]})[_0x2f9a('0x26')](function(_0x103401){if(_0x103401&&_0x103401[_0x2f9a('0x51')]===0x0){return db[_0x2f9a('0x52')][_0x2f9a('0x4a')]({'name':_0x5b7e80['name'],'resourceId':_0x5b7e80['id'],'type':_0x103401['name'],'sectionId':_0x103401['id']},{})[_0x2f9a('0x26')](function(){return _0x31cf6b;});}else{return _0x31cf6b;}})[_0x2f9a('0x44')](function(_0x1bf7b6){logger[_0x2f9a('0x53')](_0x2f9a('0x54'),_0x1bf7b6);throw _0x1bf7b6;});}return _0x31cf6b;})[_0x2f9a('0x26')](respondWithResult(_0x36695d,0xc9))[_0x2f9a('0x44')](handleError(_0x36695d,null));};exports[_0x2f9a('0x25')]=function(_0x1f4b06,_0x4e314a){if(_0x1f4b06[_0x2f9a('0x4b')]['id']){delete _0x1f4b06[_0x2f9a('0x4b')]['id'];}return db[_0x2f9a('0x40')][_0x2f9a('0x55')]({'where':{'id':_0x1f4b06[_0x2f9a('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e314a,null))[_0x2f9a('0x26')](saveUpdates(_0x1f4b06['body'],null))[_0x2f9a('0x26')](respondWithResult(_0x4e314a,null))['catch'](handleError(_0x4e314a,null));};exports['destroy']=function(_0x34399b,_0x3d4085){return db['Tag']['find']({'where':{'id':_0x34399b[_0x2f9a('0x45')]['id']}})[_0x2f9a('0x26')](handleEntityNotFound(_0x3d4085,null))[_0x2f9a('0x26')](removeEntity(_0x3d4085,null))[_0x2f9a('0x44')](handleError(_0x3d4085,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 84fdb13..b5d5392 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 _0xc3af=['exports','define','Tag','tools_tags','lodash','util','api','bluebird','rimraf','./tag.attributes'];(function(_0x44a0f6,_0x2eb642){var _0x283178=function(_0x3f7419){while(--_0x3f7419){_0x44a0f6['push'](_0x44a0f6['shift']());}};_0x283178(++_0x2eb642);}(_0xc3af,0x112));var _0xfc3a=function(_0x474c66,_0xbce925){_0x474c66=_0x474c66-0x0;var _0xcbd9bf=_0xc3af[_0x474c66];return _0xcbd9bf;};'use strict';var _=require(_0xfc3a('0x0'));var util=require(_0xfc3a('0x1'));var logger=require('../../config/logger')(_0xfc3a('0x2'));var moment=require('moment');var BPromise=require(_0xfc3a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfc3a('0x4'));var config=require('../../config/environment');var attributes=require(_0xfc3a('0x5'));module[_0xfc3a('0x6')]=function(_0x20c214,_0x5dedef){return _0x20c214[_0xfc3a('0x7')](_0xfc3a('0x8'),attributes,{'tableName':_0xfc3a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcaab=['exports','Tag','tools_tags','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x1e2556,_0xf14698){var _0x2d4f35=function(_0x270d70){while(--_0x270d70){_0x1e2556['push'](_0x1e2556['shift']());}};_0x2d4f35(++_0xf14698);}(_0xcaab,0x1a7));var _0xbcaa=function(_0x5234e2,_0x310c1e){_0x5234e2=_0x5234e2-0x0;var _0xd1c743=_0xcaab[_0x5234e2];return _0xd1c743;};'use strict';var _=require(_0xbcaa('0x0'));var util=require(_0xbcaa('0x1'));var logger=require(_0xbcaa('0x2'))(_0xbcaa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbcaa('0x4'));var fs=require('fs');var path=require(_0xbcaa('0x5'));var rimraf=require(_0xbcaa('0x6'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0xbcaa('0x7')]=function(_0x3837e2,_0x3c1408){return _0x3837e2['define'](_0xbcaa('0x8'),attributes,{'tableName':_0xbcaa('0x9'),'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 9ba80e2..01e7c91 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 _0xe5b5=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','Tag,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x58ae8a,_0x3c619e){var _0x2f0b6b=function(_0x6db940){while(--_0x6db940){_0x58ae8a['push'](_0x58ae8a['shift']());}};_0x2f0b6b(++_0x3c619e);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x38987f,_0xc79720){_0x38987f=_0x38987f-0x0;var _0x4cb697=_0xe5b5[_0x38987f];return _0x4cb697;};'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});function respondWithRpcPromise(_0x545eb3,_0x29db2c,_0xe089b1){return new BPromise(function(_0xcbd478,_0x258414){return client[_0x5e5b('0xe')](_0x545eb3,_0xe089b1)[_0x5e5b('0xf')](function(_0x3a37db){logger[_0x5e5b('0x10')]('Tag,\x20%s,\x20%s',_0x29db2c,_0x5e5b('0x11'));logger['debug'](_0x5e5b('0x12'),_0x29db2c,_0x5e5b('0x11'),JSON[_0x5e5b('0x13')](_0x3a37db));if(_0x3a37db[_0x5e5b('0x14')]){if(_0x3a37db['error']['code']===0x1f4){logger['error'](_0x5e5b('0x15'),_0x29db2c,_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);return _0x258414(_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);}logger[_0x5e5b('0x14')](_0x5e5b('0x15'),_0x29db2c,_0x3a37db['error'][_0x5e5b('0x16')]);return _0xcbd478(_0x3a37db[_0x5e5b('0x14')]['message']);}else{logger[_0x5e5b('0x10')]('Tag,\x20%s,\x20%s',_0x29db2c,'request\x20sent');_0xcbd478(_0x3a37db[_0x5e5b('0x17')][_0x5e5b('0x16')]);}})[_0x5e5b('0x18')](function(_0x5c7148){logger[_0x5e5b('0x14')]('Tag,\x20%s,\x20%s',_0x29db2c,_0x5c7148);_0x258414(_0x5c7148);});});} \ No newline at end of file +var _0xe13a=['code','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xeb13b2,_0x12cafd){var _0x999066=function(_0x796acc){while(--_0x796acc){_0xeb13b2['push'](_0xeb13b2['shift']());}};_0x999066(++_0x12cafd);}(_0xe13a,0x178));var _0xae13=function(_0x519d1a,_0x16970a){_0x519d1a=_0x519d1a-0x0;var _0x281001=_0xe13a[_0x519d1a];return _0x281001;};'use strict';var _=require('lodash');var util=require(_0xae13('0x0'));var moment=require(_0xae13('0x1'));var BPromise=require(_0xae13('0x2'));var rs=require(_0xae13('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae13('0x4'))['db'];var utils=require(_0xae13('0x5'));var logger=require(_0xae13('0x6'))(_0xae13('0x7'));var config=require(_0xae13('0x8'));var jayson=require(_0xae13('0x9'));var client=jayson[_0xae13('0xa')][_0xae13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x341ba4,_0x4ae51f,_0x2f6d10){return new BPromise(function(_0x2b2e1f,_0x27fefd){return client[_0xae13('0xc')](_0x341ba4,_0x2f6d10)[_0xae13('0xd')](function(_0x41bf44){logger[_0xae13('0xe')](_0xae13('0xf'),_0x4ae51f,_0xae13('0x10'));logger['debug'](_0xae13('0x11'),_0x4ae51f,_0xae13('0x10'),JSON[_0xae13('0x12')](_0x41bf44));if(_0x41bf44[_0xae13('0x13')]){if(_0x41bf44[_0xae13('0x13')][_0xae13('0x14')]===0x1f4){logger[_0xae13('0x13')]('Tag,\x20%s,\x20%s',_0x4ae51f,_0x41bf44[_0xae13('0x13')][_0xae13('0x15')]);return _0x27fefd(_0x41bf44['error']['message']);}logger['error']('Tag,\x20%s,\x20%s',_0x4ae51f,_0x41bf44['error'][_0xae13('0x15')]);return _0x2b2e1f(_0x41bf44[_0xae13('0x13')][_0xae13('0x15')]);}else{logger[_0xae13('0xe')](_0xae13('0xf'),_0x4ae51f,_0xae13('0x10'));_0x2b2e1f(_0x41bf44['result'][_0xae13('0x15')]);}})['catch'](function(_0xe10aab){logger[_0xae13('0x13')](_0xae13('0xf'),_0x4ae51f,_0xe10aab);_0x27fefd(_0xe10aab);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 8dcd8f4..70b6e98 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 _0xad50=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','show','/:id/queues','post','create','addQueues','addAgents','put','/:id','update','delete','destroy','removeQueues','/:id/users','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad50,0x168));var _0x0ad5=function(_0x32b122,_0x1ad490){_0x32b122=_0x32b122-0x0;var _0x4ad25a=_0xad50[_0x32b122];return _0x4ad25a;};'use strict';var multer=require(_0x0ad5('0x0'));var util=require(_0x0ad5('0x1'));var path=require(_0x0ad5('0x2'));var timeout=require(_0x0ad5('0x3'));var express=require('express');var router=express[_0x0ad5('0x4')]();var fs_extra=require(_0x0ad5('0x5'));var auth=require(_0x0ad5('0x6'));var interaction=require(_0x0ad5('0x7'));var config=require(_0x0ad5('0x8'));var controller=require(_0x0ad5('0x9'));router[_0x0ad5('0xa')]('/',auth[_0x0ad5('0xb')](),controller[_0x0ad5('0xc')]);router[_0x0ad5('0xa')]('/:id',auth[_0x0ad5('0xb')](),controller[_0x0ad5('0xd')]);router[_0x0ad5('0xa')](_0x0ad5('0xe'),auth[_0x0ad5('0xb')](),controller['getQueues']);router['get']('/:id/users',auth[_0x0ad5('0xb')](),controller['getAgents']);router[_0x0ad5('0xf')]('/',auth[_0x0ad5('0xb')](),controller[_0x0ad5('0x10')]);router[_0x0ad5('0xf')](_0x0ad5('0xe'),auth['isAuthenticated'](),controller[_0x0ad5('0x11')]);router['post']('/:id/users',auth[_0x0ad5('0xb')](),controller[_0x0ad5('0x12')]);router[_0x0ad5('0x13')](_0x0ad5('0x14'),auth[_0x0ad5('0xb')](),controller[_0x0ad5('0x15')]);router[_0x0ad5('0x16')]('/:id',auth[_0x0ad5('0xb')](),controller[_0x0ad5('0x17')]);router[_0x0ad5('0x16')](_0x0ad5('0xe'),auth['isAuthenticated'](),controller[_0x0ad5('0x18')]);router[_0x0ad5('0x16')](_0x0ad5('0x19'),auth[_0x0ad5('0xb')](),controller[_0x0ad5('0x1a')]);module[_0x0ad5('0x1b')]=router; \ No newline at end of file +var _0x7d90=['addQueues','/:id/users','addAgents','delete','destroy','removeQueues','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/queues','getAgents','post','create'];(function(_0x41f3c9,_0x322ad9){var _0x3fd476=function(_0x2d8648){while(--_0x2d8648){_0x41f3c9['push'](_0x41f3c9['shift']());}};_0x3fd476(++_0x322ad9);}(_0x7d90,0x104));var _0x07d9=function(_0xc16558,_0x26c021){_0xc16558=_0xc16558-0x0;var _0x2bf902=_0x7d90[_0xc16558];return _0x2bf902;};'use strict';var multer=require(_0x07d9('0x0'));var util=require(_0x07d9('0x1'));var path=require('path');var timeout=require(_0x07d9('0x2'));var express=require(_0x07d9('0x3'));var router=express['Router']();var fs_extra=require(_0x07d9('0x4'));var auth=require(_0x07d9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x07d9('0x6'));var controller=require('./team.controller');router[_0x07d9('0x7')]('/',auth[_0x07d9('0x8')](),controller[_0x07d9('0x9')]);router[_0x07d9('0x7')](_0x07d9('0xa'),auth['isAuthenticated'](),controller[_0x07d9('0xb')]);router[_0x07d9('0x7')](_0x07d9('0xc'),auth[_0x07d9('0x8')](),controller['getQueues']);router['get']('/:id/users',auth[_0x07d9('0x8')](),controller[_0x07d9('0xd')]);router[_0x07d9('0xe')]('/',auth[_0x07d9('0x8')](),controller[_0x07d9('0xf')]);router[_0x07d9('0xe')](_0x07d9('0xc'),auth[_0x07d9('0x8')](),controller[_0x07d9('0x10')]);router[_0x07d9('0xe')](_0x07d9('0x11'),auth[_0x07d9('0x8')](),controller[_0x07d9('0x12')]);router['put'](_0x07d9('0xa'),auth[_0x07d9('0x8')](),controller['update']);router[_0x07d9('0x13')]('/:id',auth[_0x07d9('0x8')](),controller[_0x07d9('0x14')]);router[_0x07d9('0x13')]('/:id/queues',auth[_0x07d9('0x8')](),controller[_0x07d9('0x15')]);router[_0x07d9('0x13')](_0x07d9('0x11'),auth[_0x07d9('0x8')](),controller['removeAgents']);module[_0x07d9('0x16')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 154cb91..30f857e 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 _0x29bc=['exports','name','STRING'];(function(_0xcce5c3,_0x582e8c){var _0x51e66a=function(_0x4db0c5){while(--_0x4db0c5){_0xcce5c3['push'](_0xcce5c3['shift']());}};_0x51e66a(++_0x582e8c);}(_0x29bc,0xbd));var _0xc29b=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x29bc[_0x138f59];return _0x3d114d;};'use strict';var Sequelize=require('sequelize');module[_0xc29b('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc29b('0x1')},'description':{'type':Sequelize[_0xc29b('0x2')]}}; \ No newline at end of file +var _0xabeb=['exports','name','STRING','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xabeb,0x15b));var _0xbabe=function(_0xf7224d,_0x2b8c21){_0xf7224d=_0xf7224d-0x0;var _0x525740=_0xabeb[_0xf7224d];return _0x525740;};'use strict';var Sequelize=require(_0xbabe('0x0'));module[_0xbabe('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbabe('0x2')},'description':{'type':Sequelize[_0xbabe('0x3')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index c57235f..56e0863 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 _0x1a85=['squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','Teams','UserProfileResource','sendStatus','error','stack','name','index','map','Team','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','channel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','Queues','addQueues','isValidChannel','add','removeQueues','findOne','remove','ids','addAgents','Mail','Sms','Fax','Whatsapp','sequelize','transaction','Voice','through','penalty','TeamVoiceQueue','findOrCreate','emit','Queue:save','QueueId','online','interface','isNil','format','SIP/%s','voicePause','all','spread','removeAgents','Openchannel','parse','Queue:remove','UserVoiceQueueRt','getAgents','User','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra'];(function(_0x4bbfd0,_0x3fd88c){var _0x1145c4=function(_0x770e8e){while(--_0x770e8e){_0x4bbfd0['push'](_0x4bbfd0['shift']());}};_0x1145c4(++_0x3fd88c);}(_0x1a85,0x178));var _0x51a8=function(_0x51e136,_0x4eecfd){_0x51e136=_0x51e136-0x0;var _0x52b4f3=_0x1a85[_0x51e136];return _0x52b4f3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51a8('0x0'));var jsonpatch=require(_0x51a8('0x1'));var rp=require(_0x51a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51a8('0x3'));var util=require(_0x51a8('0x4'));var path=require(_0x51a8('0x5'));var sox=require('sox');var csv=require(_0x51a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a8('0x7'));var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];config[_0x51a8('0x17')]=_[_0x51a8('0x18')](config[_0x51a8('0x17')],{'host':_0x51a8('0x19'),'port':0x18eb});var socket=require(_0x51a8('0x1a'))(new Redis(config['redis']));require(_0x51a8('0x1b'))[_0x51a8('0x1c')](socket);function respondWithStatusCode(_0xaec066,_0x50d992){_0x50d992=_0x50d992||0xcc;return function(_0xf4eb6e){if(_0xf4eb6e){return _0xaec066['sendStatus'](_0x50d992);}return _0xaec066[_0x51a8('0x1d')](_0x50d992)[_0x51a8('0x1e')]();};}function respondWithResult(_0x39cd45,_0x2b0521){_0x2b0521=_0x2b0521||0xc8;return function(_0x3fbd02){if(_0x3fbd02){return _0x39cd45[_0x51a8('0x1d')](_0x2b0521)[_0x51a8('0x1f')](_0x3fbd02);}};}function respondWithFilteredResult(_0x516abc,_0x1c2f25){return function(_0x45a433){if(_0x45a433){var _0xd52230=typeof _0x1c2f25[_0x51a8('0x20')]===_0x51a8('0x21')&&typeof _0x1c2f25[_0x51a8('0x22')]==='undefined';var _0x1df8c2=_0x45a433[_0x51a8('0x23')];var _0x2217ce=_0xd52230?0x0:_0x1c2f25[_0x51a8('0x20')];var _0x2a4c4c=_0xd52230?_0x45a433[_0x51a8('0x23')]:_0x1c2f25[_0x51a8('0x20')]+_0x1c2f25[_0x51a8('0x22')];var _0x5ac1c0;if(_0x2a4c4c>=_0x1df8c2){_0x2a4c4c=_0x1df8c2;_0x5ac1c0=0xc8;}else{_0x5ac1c0=0xce;}_0x516abc[_0x51a8('0x1d')](_0x5ac1c0);return _0x516abc['set'](_0x51a8('0x24'),_0x2217ce+'-'+_0x2a4c4c+'/'+_0x1df8c2)[_0x51a8('0x1f')](_0x45a433);}return null;};}function patchUpdates(_0x8bda40){return function(_0x3759d6){try{jsonpatch['apply'](_0x3759d6,_0x8bda40,!![]);}catch(_0xae3588){return BPromise['reject'](_0xae3588);}return _0x3759d6['save']();};}function saveUpdates(_0x23d26a,_0x52e503){return function(_0x384d25){if(_0x384d25){return _0x384d25[_0x51a8('0x25')](_0x23d26a)[_0x51a8('0x26')](function(_0x18e2f3){return _0x18e2f3;});}return null;};}function removeEntity(_0x157554,_0x2f2f05){return function(_0x291ed6){if(_0x291ed6){return _0x291ed6[_0x51a8('0x27')]()['then'](function(){var _0x273ce2=_0x291ed6[_0x51a8('0x28')]({'plain':!![]});var _0xca5746=_0x51a8('0x29');return db[_0x51a8('0x2a')][_0x51a8('0x27')]({'where':{'type':_0xca5746,'resourceId':_0x273ce2['id']}})[_0x51a8('0x26')](function(){return _0x291ed6;});})[_0x51a8('0x26')](function(){_0x157554[_0x51a8('0x1d')](0xcc)[_0x51a8('0x1e')]();});}};}function handleEntityNotFound(_0x20c6b5,_0x347a02){return function(_0x4a1548){if(!_0x4a1548){_0x20c6b5[_0x51a8('0x2b')](0x194);}return _0x4a1548;};}function handleError(_0x58cba0,_0x276424){_0x276424=_0x276424||0x1f4;return function(_0x3bc19a){logger[_0x51a8('0x2c')](_0x3bc19a[_0x51a8('0x2d')]);if(_0x3bc19a[_0x51a8('0x2e')]){delete _0x3bc19a['name'];}_0x58cba0[_0x51a8('0x1d')](_0x276424)['send'](_0x3bc19a);};}exports[_0x51a8('0x2f')]=function(_0x24b39a,_0x253a59){var _0x4b19c8={},_0x2080a1={},_0x499a43={'count':0x0,'rows':[]};var _0x25a858=_[_0x51a8('0x30')](db[_0x51a8('0x31')][_0x51a8('0x32')],function(_0x193e0f){return{'name':_0x193e0f['fieldName'],'type':_0x193e0f[_0x51a8('0x33')]['key']};});_0x2080a1[_0x51a8('0x34')]=_[_0x51a8('0x30')](_0x25a858,_0x51a8('0x2e'));_0x2080a1['query']=_[_0x51a8('0x35')](_0x24b39a[_0x51a8('0x36')]);_0x2080a1[_0x51a8('0x37')]=_[_0x51a8('0x38')](_0x2080a1[_0x51a8('0x34')],_0x2080a1['query']);_0x4b19c8['attributes']=_['intersection'](_0x2080a1[_0x51a8('0x34')],qs[_0x51a8('0x39')](_0x24b39a['query'][_0x51a8('0x39')]));_0x4b19c8['attributes']=_0x4b19c8[_0x51a8('0x3a')][_0x51a8('0x3b')]?_0x4b19c8[_0x51a8('0x3a')]:_0x2080a1[_0x51a8('0x34')];if(!_0x24b39a[_0x51a8('0x36')][_0x51a8('0x3c')]('nolimit')){_0x4b19c8['limit']=qs[_0x51a8('0x22')](_0x24b39a['query']['limit']);_0x4b19c8['offset']=qs[_0x51a8('0x20')](_0x24b39a[_0x51a8('0x36')][_0x51a8('0x20')]);}_0x4b19c8['order']=qs[_0x51a8('0x3d')](_0x24b39a[_0x51a8('0x36')][_0x51a8('0x3d')]);_0x4b19c8[_0x51a8('0x3e')]=qs['filters'](_[_0x51a8('0x3f')](_0x24b39a[_0x51a8('0x36')],_0x2080a1[_0x51a8('0x37')]),_0x25a858);if(_0x24b39a['query'][_0x51a8('0x40')]){_0x4b19c8['where']=_[_0x51a8('0x41')](_0x4b19c8[_0x51a8('0x3e')],{'$or':_[_0x51a8('0x30')](_0x25a858,function(_0x37d50b){if(_0x37d50b['type']!==_0x51a8('0x42')){var _0x3da2cf={};_0x3da2cf[_0x37d50b[_0x51a8('0x2e')]]={'$like':'%'+_0x24b39a[_0x51a8('0x36')][_0x51a8('0x40')]+'%'};return _0x3da2cf;}})});}_0x4b19c8=_[_0x51a8('0x41')]({},_0x4b19c8,_0x24b39a[_0x51a8('0x43')]);var _0x1cdec6={'where':_0x4b19c8[_0x51a8('0x3e')]};return db['Team'][_0x51a8('0x23')](_0x1cdec6)[_0x51a8('0x26')](function(_0x4c7c67){_0x499a43['count']=_0x4c7c67;if(_0x24b39a[_0x51a8('0x36')][_0x51a8('0x44')]){_0x4b19c8[_0x51a8('0x45')]=[{'all':!![]}];}return db[_0x51a8('0x31')][_0x51a8('0x46')](_0x4b19c8);})[_0x51a8('0x26')](function(_0x28f5b3){_0x499a43[_0x51a8('0x47')]=_0x28f5b3;return _0x499a43;})[_0x51a8('0x26')](respondWithFilteredResult(_0x253a59,_0x4b19c8))[_0x51a8('0x48')](handleError(_0x253a59,null));};exports['show']=function(_0x416988,_0x218ae0){var _0x190d52={'raw':![],'where':{'id':_0x416988[_0x51a8('0x49')]['id']}},_0x444b0b={};_0x444b0b[_0x51a8('0x34')]=_['keys'](db[_0x51a8('0x31')]['rawAttributes']);_0x444b0b[_0x51a8('0x36')]=_[_0x51a8('0x35')](_0x416988[_0x51a8('0x36')]);_0x444b0b[_0x51a8('0x37')]=_[_0x51a8('0x38')](_0x444b0b['model'],_0x444b0b['query']);_0x190d52[_0x51a8('0x3a')]=_[_0x51a8('0x38')](_0x444b0b[_0x51a8('0x34')],qs[_0x51a8('0x39')](_0x416988[_0x51a8('0x36')]['fields']));_0x190d52['attributes']=_0x190d52[_0x51a8('0x3a')][_0x51a8('0x3b')]?_0x190d52[_0x51a8('0x3a')]:_0x444b0b[_0x51a8('0x34')];if(_0x416988[_0x51a8('0x36')][_0x51a8('0x44')]){_0x190d52[_0x51a8('0x45')]=[{'all':!![]}];}_0x190d52=_[_0x51a8('0x41')]({},_0x190d52,_0x416988[_0x51a8('0x43')]);return db['Team']['find'](_0x190d52)['then'](handleEntityNotFound(_0x218ae0,null))[_0x51a8('0x26')](respondWithResult(_0x218ae0,null))[_0x51a8('0x48')](handleError(_0x218ae0,null));};exports[_0x51a8('0x4a')]=function(_0x5259f3,_0x3bd492){return db[_0x51a8('0x31')]['create'](_0x5259f3[_0x51a8('0x4b')],{})['then'](function(_0x50a2f8){var _0xbf828b=_0x5259f3[_0x51a8('0x4c')][_0x51a8('0x28')]({'plain':!![]});if(!_0xbf828b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xbf828b['role']===_0x51a8('0x4c')){var _0x5b0398=_0x50a2f8[_0x51a8('0x28')]({'plain':!![]});var _0xc89617=_0x51a8('0x29');return db[_0x51a8('0x4d')][_0x51a8('0x4e')]({'where':{'name':_0xc89617,'userProfileId':_0xbf828b[_0x51a8('0x4f')]},'raw':!![]})[_0x51a8('0x26')](function(_0x406a87){if(_0x406a87&&_0x406a87[_0x51a8('0x50')]===0x0){return db['UserProfileResource'][_0x51a8('0x4a')]({'name':_0x5b0398[_0x51a8('0x2e')],'resourceId':_0x5b0398['id'],'type':_0x406a87[_0x51a8('0x2e')],'sectionId':_0x406a87['id']},{})[_0x51a8('0x26')](function(){return _0x50a2f8;});}else{return _0x50a2f8;}})['catch'](function(_0x13b7ba){logger['error'](_0x51a8('0x51'),_0x13b7ba);throw _0x13b7ba;});}return _0x50a2f8;})[_0x51a8('0x26')](respondWithResult(_0x3bd492,0xc9))['catch'](handleError(_0x3bd492,null));};exports['update']=function(_0x2628d4,_0x16f124){if(_0x2628d4[_0x51a8('0x4b')]['id']){delete _0x2628d4[_0x51a8('0x4b')]['id'];}return db[_0x51a8('0x31')]['find']({'where':{'id':_0x2628d4[_0x51a8('0x49')]['id']}})[_0x51a8('0x26')](handleEntityNotFound(_0x16f124,null))[_0x51a8('0x26')](saveUpdates(_0x2628d4[_0x51a8('0x4b')],null))[_0x51a8('0x26')](respondWithResult(_0x16f124,null))['catch'](handleError(_0x16f124,null));};exports[_0x51a8('0x27')]=function(_0x3f37f9,_0x3656ac){return db[_0x51a8('0x31')][_0x51a8('0x4e')]({'where':{'id':_0x3f37f9[_0x51a8('0x49')]['id']}})['then'](handleEntityNotFound(_0x3656ac,null))['then'](removeEntity(_0x3656ac,null))['catch'](handleError(_0x3656ac,null));};exports['getQueues']=function(_0x2048c6,_0x1df9cc,_0x51f9f7){return db[_0x51a8('0x31')]['findOne']({'where':{'id':_0x2048c6[_0x51a8('0x49')]['id']}})['then'](handleEntityNotFound(_0x1df9cc,null))[_0x51a8('0x26')](function(_0x472fdb){if(!_0x2048c6['query']['channel']||!utils['isValidChannel'](_0x2048c6[_0x51a8('0x36')][_0x51a8('0x52')])){throw new db[(_0x51a8('0x53'))][(_0x51a8('0x54'))](_0x51a8('0x55'));}var _0x21c8e0={};var _0x3fd347={};_0x3fd347[_0x51a8('0x34')]=_['keys'](db[_[_0x51a8('0x56')](_0x2048c6[_0x51a8('0x36')]['channel'][_0x51a8('0x57')]())+_0x51a8('0x58')][_0x51a8('0x32')]);_0x3fd347[_0x51a8('0x36')]=_[_0x51a8('0x35')](_0x2048c6[_0x51a8('0x36')]);_0x3fd347['filters']=_['intersection'](_0x3fd347[_0x51a8('0x34')],_0x3fd347['query']);_0x21c8e0['attributes']=_['intersection'](_0x3fd347['model'],qs['fields'](_0x2048c6[_0x51a8('0x36')]['fields']));_0x21c8e0[_0x51a8('0x3a')]=_0x21c8e0[_0x51a8('0x3a')][_0x51a8('0x3b')]?_0x21c8e0[_0x51a8('0x3a')]:_0x3fd347[_0x51a8('0x34')];_0x21c8e0[_0x51a8('0x22')]=qs[_0x51a8('0x22')](_0x2048c6[_0x51a8('0x36')][_0x51a8('0x22')]);_0x21c8e0[_0x51a8('0x20')]=qs['offset'](_0x2048c6[_0x51a8('0x36')][_0x51a8('0x20')]);_0x21c8e0[_0x51a8('0x59')]=qs['sort'](_0x2048c6['query']['sort']);_0x21c8e0[_0x51a8('0x3e')]=qs[_0x51a8('0x37')](_[_0x51a8('0x3f')](_0x2048c6[_0x51a8('0x36')],_0x3fd347[_0x51a8('0x37')]));_0x21c8e0=_[_0x51a8('0x41')]({},_0x21c8e0,_0x2048c6[_0x51a8('0x43')]);return _0x472fdb[_0x51a8('0x28')+_[_0x51a8('0x56')](_0x2048c6[_0x51a8('0x36')][_0x51a8('0x52')][_0x51a8('0x57')]())+_0x51a8('0x5a')](_0x21c8e0);})['then'](respondWithResult(_0x1df9cc,null))[_0x51a8('0x48')](handleError(_0x1df9cc,null));};exports[_0x51a8('0x5b')]=function(_0x52077e,_0x2dc9cb,_0x5140b8){return db['Team']['findOne']({'where':{'id':_0x52077e[_0x51a8('0x49')]['id']}})[_0x51a8('0x26')](function(_0xb480ec){if(_0xb480ec){if(!_0x52077e[_0x51a8('0x4b')][_0x51a8('0x52')]||!utils[_0x51a8('0x5c')](_0x52077e[_0x51a8('0x4b')]['channel'])){throw new db['Sequelize']['ValidationError'](_0x51a8('0x55'));}return _0xb480ec[_0x51a8('0x5d')+_[_0x51a8('0x56')](_0x52077e[_0x51a8('0x4b')][_0x51a8('0x52')][_0x51a8('0x57')]())+'Queues'](_0x52077e[_0x51a8('0x4b')]['ids']);}return null;})[_0x51a8('0x26')](handleEntityNotFound(_0x2dc9cb,null))[_0x51a8('0x26')](respondWithStatusCode(_0x2dc9cb,null))[_0x51a8('0x48')](handleError(_0x2dc9cb,null));};exports[_0x51a8('0x5e')]=function(_0x149a40,_0x3aca4a,_0x895b42){return db[_0x51a8('0x31')][_0x51a8('0x5f')]({'where':{'id':_0x149a40[_0x51a8('0x49')]['id']}})[_0x51a8('0x26')](function(_0x55b9a0){if(_0x55b9a0){if(!_0x149a40['query'][_0x51a8('0x52')]||!utils[_0x51a8('0x5c')](_0x149a40[_0x51a8('0x36')][_0x51a8('0x52')])){throw new db['Sequelize'][(_0x51a8('0x54'))]('Unknown\x20channel');}return _0x55b9a0[_0x51a8('0x60')+_[_0x51a8('0x56')](_0x149a40[_0x51a8('0x36')][_0x51a8('0x52')][_0x51a8('0x57')]())+_0x51a8('0x5a')](_0x149a40[_0x51a8('0x36')][_0x51a8('0x61')]);}return null;})[_0x51a8('0x26')](handleEntityNotFound(_0x3aca4a,null))['then'](respondWithStatusCode(_0x3aca4a,null))[_0x51a8('0x48')](handleError(_0x3aca4a,null));};exports[_0x51a8('0x62')]=function(_0x3e80db,_0x353e90){return db['Team']['find']({'where':{'id':_0x3e80db[_0x51a8('0x49')]['id']}})['then'](handleEntityNotFound(_0x353e90,null))['then'](function(_0x58acce){if(_0x58acce){var _0xeb5d67=['Voice','Chat',_0x51a8('0x63'),_0x51a8('0x64'),_0x51a8('0x65'),'Openchannel',_0x51a8('0x66')];return db[_0x51a8('0x67')][_0x51a8('0x68')](function(_0x5f20f7){var _0x3ac9c8=_[_0x51a8('0x30')](_0xeb5d67,function(_0x24838b){var _0x16e90a={'attributes':['id',_0x51a8('0x2e')]};if(_0x24838b===_0x51a8('0x69')){_0x16e90a[_0x51a8('0x6a')]={'attributes':[_0x51a8('0x6b')]};}return _0x58acce[_0x51a8('0x28')+_0x24838b+'Queues'](_0x16e90a)[_0x51a8('0x26')](function(_0x3be132){var _0x4e2c5d=_[_0x51a8('0x30')](_0x3be132,function(_0x43112c){var _0x5d9e3b=_[_0x51a8('0x30')](_0x3e80db[_0x51a8('0x4b')][_0x51a8('0x61')],function(_0x17fd0a){var _0x398fb2={'where':{'UserId':_0x17fd0a,[_0x24838b+'QueueId']:_0x43112c['id']},'transaction':_0x5f20f7};if(_0x24838b===_0x51a8('0x69')){_0x398fb2[_0x51a8('0x18')]={'penalty':_0x43112c[_0x51a8('0x6c')][_0x51a8('0x6b')]};}return db['User'+_0x24838b+_0x51a8('0x58')][_0x51a8('0x6d')](_0x398fb2)[_0x51a8('0x26')](function(){socket[_0x51a8('0x6e')](_0x51a8('0x4c')+_0x24838b+_0x51a8('0x6f'),{'UserId':_0x17fd0a,[_0x24838b+_0x51a8('0x70')]:_0x43112c['id']});if(_0x24838b!==_0x51a8('0x69'))return;return db['User'][_0x51a8('0x46')]({'where':{'id':_0x3e80db[_0x51a8('0x4b')]['ids'],'online':0x1},'attributes':['id',_0x51a8('0x2e'),_0x51a8('0x71'),'voicePause',_0x51a8('0x72')],'raw':!![]})['then'](function(_0x48ad09){var _0x337ab2=_[_0x51a8('0x30')](_0x48ad09,function(_0x41e0b9){return db['UserVoiceQueueRt']['upsert']({'membername':_0x41e0b9[_0x51a8('0x2e')],'UserId':_0x41e0b9['id'],'queue_name':_0x43112c['name'],'VoiceQueueId':_0x43112c['id'],'interface':_[_0x51a8('0x73')](_0x41e0b9[_0x51a8('0x72')])?util[_0x51a8('0x74')](_0x51a8('0x75'),_0x41e0b9[_0x51a8('0x2e')]):_0x41e0b9[_0x51a8('0x72')],'paused':_0x41e0b9[_0x51a8('0x76')]||![],'penalty':_0x43112c[_0x51a8('0x6c')][_0x51a8('0x6b')]},{'transaction':_0x5f20f7});});return Promise[_0x51a8('0x77')](_0x337ab2);});});});return Promise[_0x51a8('0x77')](_0x5d9e3b);});return Promise[_0x51a8('0x77')](_0x4e2c5d);});});return Promise[_0x51a8('0x77')](_0x3ac9c8)[_0x51a8('0x26')](function(){return _0x58acce[_0x51a8('0x62')](_0x3e80db['body']['ids'],{'transaction':_0x5f20f7})[_0x51a8('0x78')](function(_0x4e25d7){return _0x4e25d7;});});});}})['then'](respondWithResult(_0x353e90,null))['catch'](handleError(_0x353e90,null));};exports[_0x51a8('0x79')]=function(_0x4cac59,_0xbc0075){return db[_0x51a8('0x31')]['find']({'where':{'id':_0x4cac59[_0x51a8('0x49')]['id']}})[_0x51a8('0x26')](handleEntityNotFound(_0xbc0075,null))['then'](function(_0x41819c){if(_0x41819c){var _0x37a542=['Voice','Chat',_0x51a8('0x63'),_0x51a8('0x64'),_0x51a8('0x65'),_0x51a8('0x7a'),_0x51a8('0x66')];return db[_0x51a8('0x67')]['transaction'](function(_0x13dab3){var _0x1c6e75=_[_0x51a8('0x30')](_0x37a542,function(_0x566d62){var _0x315802={'attributes':['id',_0x51a8('0x2e')]};return _0x41819c[_0x51a8('0x28')+_0x566d62+'Queues'](_0x315802)[_0x51a8('0x26')](function(_0x1821a8){var _0x5cf149=_[_0x51a8('0x30')](_0x1821a8,function(_0x529916){return _0x529916[_0x51a8('0x79')](_0x4cac59[_0x51a8('0x36')][_0x51a8('0x61')],{'transaction':_0x13dab3})[_0x51a8('0x26')](function(){var _0x41621c=JSON[_0x51a8('0x7b')]('['+_0x4cac59[_0x51a8('0x36')][_0x51a8('0x61')]+']');var _0x59561f=_[_0x51a8('0x30')](_0x41621c,function(_0x2c9723){socket[_0x51a8('0x6e')](_0x51a8('0x4c')+_0x566d62+_0x51a8('0x7c'),{'UserId':Number(_0x2c9723),[_0x566d62+'QueueId']:_0x529916['id']});if(_0x566d62!=='Voice')return;return db[_0x51a8('0x7d')][_0x51a8('0x27')]({'where':{'VoiceQueueId':_0x529916['id'],'UserId':_0x2c9723},'transaction':_0x13dab3});});return Promise[_0x51a8('0x77')](_0x59561f);});});return Promise[_0x51a8('0x77')](_0x5cf149);});});return Promise[_0x51a8('0x77')](_0x1c6e75)['then'](function(){return _0x41819c[_0x51a8('0x79')](_0x4cac59['query'][_0x51a8('0x61')],{'transaction':_0x13dab3});});});}})[_0x51a8('0x26')](respondWithStatusCode(_0xbc0075,null))['catch'](handleError(_0xbc0075,null));};exports[_0x51a8('0x7e')]=function(_0x5ca2b6,_0x3b7e30,_0x3cf33c){var _0x149091={};var _0x29563a={};var _0x35b703;var _0x5243fd;return db[_0x51a8('0x31')][_0x51a8('0x5f')]({'where':{'id':_0x5ca2b6['params']['id']}})[_0x51a8('0x26')](handleEntityNotFound(_0x3b7e30,null))[_0x51a8('0x26')](function(_0x54e006){if(_0x54e006){_0x35b703=_0x54e006;_0x29563a['model']=_[_0x51a8('0x35')](db[_0x51a8('0x7f')][_0x51a8('0x32')]);_0x29563a['query']=_[_0x51a8('0x35')](_0x5ca2b6[_0x51a8('0x36')]);_0x29563a[_0x51a8('0x37')]=_[_0x51a8('0x38')](_0x29563a[_0x51a8('0x34')],_0x29563a[_0x51a8('0x36')]);_0x149091[_0x51a8('0x3a')]=_['intersection'](_0x29563a[_0x51a8('0x34')],qs[_0x51a8('0x39')](_0x5ca2b6[_0x51a8('0x36')][_0x51a8('0x39')]));_0x149091['attributes']=_0x149091['attributes'][_0x51a8('0x3b')]?_0x149091[_0x51a8('0x3a')]:_0x29563a['model'];_0x149091['order']=qs['sort'](_0x5ca2b6[_0x51a8('0x36')]['sort']);_0x149091['where']=qs['filters'](_[_0x51a8('0x3f')](_0x5ca2b6['query'],_0x29563a[_0x51a8('0x37')]));if(_0x5ca2b6[_0x51a8('0x36')]['filter']){_0x149091['where']=_[_0x51a8('0x41')](_0x149091['where'],{'$or':_[_0x51a8('0x30')](_0x149091[_0x51a8('0x3a')],function(_0x4bf480){var _0x39938f={};_0x39938f[_0x4bf480]={'$like':'%'+_0x5ca2b6[_0x51a8('0x36')]['filter']+'%'};return _0x39938f;})});}_0x149091=_[_0x51a8('0x41')]({},_0x149091,_0x5ca2b6[_0x51a8('0x43')]);return _0x35b703[_0x51a8('0x7e')](_0x149091);}})['then'](function(_0x2af315){if(_0x2af315){_0x5243fd=_0x2af315[_0x51a8('0x3b')];if(!_0x5ca2b6[_0x51a8('0x36')]['hasOwnProperty']('nolimit')){_0x149091[_0x51a8('0x22')]=qs[_0x51a8('0x22')](_0x5ca2b6[_0x51a8('0x36')][_0x51a8('0x22')]);_0x149091[_0x51a8('0x20')]=qs[_0x51a8('0x20')](_0x5ca2b6[_0x51a8('0x36')][_0x51a8('0x20')]);}return _0x35b703[_0x51a8('0x7e')](_0x149091);}})[_0x51a8('0x26')](function(_0x2a8aa1){if(_0x2a8aa1){return _0x2a8aa1?{'count':_0x5243fd,'rows':_0x2a8aa1}:null;}})[_0x51a8('0x26')](respondWithResult(_0x3b7e30,null))[_0x51a8('0x48')](handleError(_0x3b7e30,null));}; \ No newline at end of file +var _0x57ca=['sequelize','transaction','through','ids','QueueId','Voice','emit','User','voicePause','interface','upsert','isNil','format','SIP/%s','penalty','all','removeAgents','UserVoiceQueueRt','getAgents','hasOwnProperty','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Teams','UserProfileResource','error','name','index','map','Team','type','key','model','keys','filters','query','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','options','findAll','rows','catch','params','rawAttributes','merge','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','Queues','add','removeQueues','remove','addAgents','Chat','Mail','Sms','Openchannel','Whatsapp'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x57ca,0x108));var _0xa57c=function(_0x14fce6,_0x3232b0){_0x14fce6=_0x14fce6-0x0;var _0x5697d5=_0x57ca[_0x14fce6];return _0x5697d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));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('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];config[_0xa57c('0x17')]=_[_0xa57c('0x18')](config[_0xa57c('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xa57c('0x19'))(new Redis(config['redis']));require(_0xa57c('0x1a'))[_0xa57c('0x1b')](socket);function respondWithStatusCode(_0x30940d,_0x3821d2){_0x3821d2=_0x3821d2||0xcc;return function(_0x3238ff){if(_0x3238ff){return _0x30940d[_0xa57c('0x1c')](_0x3821d2);}return _0x30940d[_0xa57c('0x1d')](_0x3821d2)['end']();};}function respondWithResult(_0x26607a,_0xdf7ff6){_0xdf7ff6=_0xdf7ff6||0xc8;return function(_0x261725){if(_0x261725){return _0x26607a['status'](_0xdf7ff6)[_0xa57c('0x1e')](_0x261725);}};}function respondWithFilteredResult(_0x5f33f1,_0x3e7afa){return function(_0x3d781d){if(_0x3d781d){var _0x93462c=typeof _0x3e7afa[_0xa57c('0x1f')]===_0xa57c('0x20')&&typeof _0x3e7afa[_0xa57c('0x21')]===_0xa57c('0x20');var _0x595c7a=_0x3d781d['count'];var _0x8a8856=_0x93462c?0x0:_0x3e7afa['offset'];var _0x4a35bb=_0x93462c?_0x3d781d[_0xa57c('0x22')]:_0x3e7afa[_0xa57c('0x1f')]+_0x3e7afa[_0xa57c('0x21')];var _0x23bec0;if(_0x4a35bb>=_0x595c7a){_0x4a35bb=_0x595c7a;_0x23bec0=0xc8;}else{_0x23bec0=0xce;}_0x5f33f1['status'](_0x23bec0);return _0x5f33f1[_0xa57c('0x23')](_0xa57c('0x24'),_0x8a8856+'-'+_0x4a35bb+'/'+_0x595c7a)[_0xa57c('0x1e')](_0x3d781d);}return null;};}function patchUpdates(_0x2213b2){return function(_0x3bb969){try{jsonpatch[_0xa57c('0x25')](_0x3bb969,_0x2213b2,!![]);}catch(_0x1e0192){return BPromise[_0xa57c('0x26')](_0x1e0192);}return _0x3bb969[_0xa57c('0x27')]();};}function saveUpdates(_0xdf65dd,_0x382a26){return function(_0x1e7f7a){if(_0x1e7f7a){return _0x1e7f7a[_0xa57c('0x28')](_0xdf65dd)[_0xa57c('0x29')](function(_0x431bec){return _0x431bec;});}return null;};}function removeEntity(_0x511a26,_0x2db443){return function(_0x5226d0){if(_0x5226d0){return _0x5226d0[_0xa57c('0x2a')]()[_0xa57c('0x29')](function(){var _0x315ad7=_0x5226d0[_0xa57c('0x2b')]({'plain':!![]});var _0x8ee1c0=_0xa57c('0x2c');return db[_0xa57c('0x2d')][_0xa57c('0x2a')]({'where':{'type':_0x8ee1c0,'resourceId':_0x315ad7['id']}})['then'](function(){return _0x5226d0;});})[_0xa57c('0x29')](function(){_0x511a26['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x257661,_0x7d10ec){return function(_0x5a3e03){if(!_0x5a3e03){_0x257661[_0xa57c('0x1c')](0x194);}return _0x5a3e03;};}function handleError(_0x1ef331,_0x3eb9e9){_0x3eb9e9=_0x3eb9e9||0x1f4;return function(_0x57565b){logger[_0xa57c('0x2e')](_0x57565b['stack']);if(_0x57565b[_0xa57c('0x2f')]){delete _0x57565b['name'];}_0x1ef331[_0xa57c('0x1d')](_0x3eb9e9)['send'](_0x57565b);};}exports[_0xa57c('0x30')]=function(_0x532164,_0x9e02bb){var _0x1d82d9={},_0x43c8f3={},_0x304f56={'count':0x0,'rows':[]};var _0xfd0f66=_[_0xa57c('0x31')](db[_0xa57c('0x32')]['rawAttributes'],function(_0x10cc39){return{'name':_0x10cc39['fieldName'],'type':_0x10cc39[_0xa57c('0x33')][_0xa57c('0x34')]};});_0x43c8f3[_0xa57c('0x35')]=_['map'](_0xfd0f66,_0xa57c('0x2f'));_0x43c8f3['query']=_[_0xa57c('0x36')](_0x532164['query']);_0x43c8f3[_0xa57c('0x37')]=_['intersection'](_0x43c8f3[_0xa57c('0x35')],_0x43c8f3[_0xa57c('0x38')]);_0x1d82d9['attributes']=_[_0xa57c('0x39')](_0x43c8f3['model'],qs[_0xa57c('0x3a')](_0x532164['query'][_0xa57c('0x3a')]));_0x1d82d9[_0xa57c('0x3b')]=_0x1d82d9[_0xa57c('0x3b')][_0xa57c('0x3c')]?_0x1d82d9[_0xa57c('0x3b')]:_0x43c8f3[_0xa57c('0x35')];if(!_0x532164['query']['hasOwnProperty'](_0xa57c('0x3d'))){_0x1d82d9[_0xa57c('0x21')]=qs[_0xa57c('0x21')](_0x532164['query'][_0xa57c('0x21')]);_0x1d82d9['offset']=qs[_0xa57c('0x1f')](_0x532164[_0xa57c('0x38')]['offset']);}_0x1d82d9['order']=qs['sort'](_0x532164[_0xa57c('0x38')][_0xa57c('0x3e')]);_0x1d82d9[_0xa57c('0x3f')]=qs[_0xa57c('0x37')](_[_0xa57c('0x40')](_0x532164[_0xa57c('0x38')],_0x43c8f3['filters']),_0xfd0f66);if(_0x532164[_0xa57c('0x38')][_0xa57c('0x41')]){_0x1d82d9['where']=_['merge'](_0x1d82d9[_0xa57c('0x3f')],{'$or':_[_0xa57c('0x31')](_0xfd0f66,function(_0x5af5e9){if(_0x5af5e9[_0xa57c('0x33')]!==_0xa57c('0x42')){var _0x2112b7={};_0x2112b7[_0x5af5e9[_0xa57c('0x2f')]]={'$like':'%'+_0x532164[_0xa57c('0x38')][_0xa57c('0x41')]+'%'};return _0x2112b7;}})});}_0x1d82d9=_['merge']({},_0x1d82d9,_0x532164[_0xa57c('0x43')]);var _0x527c0f={'where':_0x1d82d9['where']};return db['Team']['count'](_0x527c0f)['then'](function(_0x39b20f){_0x304f56[_0xa57c('0x22')]=_0x39b20f;if(_0x532164[_0xa57c('0x38')]['includeAll']){_0x1d82d9['include']=[{'all':!![]}];}return db['Team'][_0xa57c('0x44')](_0x1d82d9);})[_0xa57c('0x29')](function(_0x44e38f){_0x304f56[_0xa57c('0x45')]=_0x44e38f;return _0x304f56;})[_0xa57c('0x29')](respondWithFilteredResult(_0x9e02bb,_0x1d82d9))[_0xa57c('0x46')](handleError(_0x9e02bb,null));};exports['show']=function(_0xaf0402,_0x22ea97){var _0x34e8f2={'raw':![],'where':{'id':_0xaf0402[_0xa57c('0x47')]['id']}},_0x3a3a4a={};_0x3a3a4a[_0xa57c('0x35')]=_['keys'](db[_0xa57c('0x32')][_0xa57c('0x48')]);_0x3a3a4a[_0xa57c('0x38')]=_[_0xa57c('0x36')](_0xaf0402[_0xa57c('0x38')]);_0x3a3a4a['filters']=_[_0xa57c('0x39')](_0x3a3a4a[_0xa57c('0x35')],_0x3a3a4a[_0xa57c('0x38')]);_0x34e8f2[_0xa57c('0x3b')]=_[_0xa57c('0x39')](_0x3a3a4a[_0xa57c('0x35')],qs['fields'](_0xaf0402[_0xa57c('0x38')][_0xa57c('0x3a')]));_0x34e8f2[_0xa57c('0x3b')]=_0x34e8f2[_0xa57c('0x3b')][_0xa57c('0x3c')]?_0x34e8f2[_0xa57c('0x3b')]:_0x3a3a4a['model'];if(_0xaf0402['query']['includeAll']){_0x34e8f2['include']=[{'all':!![]}];}_0x34e8f2=_[_0xa57c('0x49')]({},_0x34e8f2,_0xaf0402['options']);return db[_0xa57c('0x32')][_0xa57c('0x4a')](_0x34e8f2)['then'](handleEntityNotFound(_0x22ea97,null))[_0xa57c('0x29')](respondWithResult(_0x22ea97,null))[_0xa57c('0x46')](handleError(_0x22ea97,null));};exports[_0xa57c('0x4b')]=function(_0x128ea2,_0x3ef77c){return db['Team'][_0xa57c('0x4b')](_0x128ea2[_0xa57c('0x4c')],{})[_0xa57c('0x29')](function(_0xd57bac){var _0x2e4b84=_0x128ea2['user'][_0xa57c('0x2b')]({'plain':!![]});if(!_0x2e4b84)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e4b84['role']===_0xa57c('0x4d')){var _0x2c706f=_0xd57bac[_0xa57c('0x2b')]({'plain':!![]});var _0x5bf336='Teams';return db[_0xa57c('0x4e')][_0xa57c('0x4a')]({'where':{'name':_0x5bf336,'userProfileId':_0x2e4b84[_0xa57c('0x4f')]},'raw':!![]})[_0xa57c('0x29')](function(_0x4d2899){if(_0x4d2899&&_0x4d2899[_0xa57c('0x50')]===0x0){return db[_0xa57c('0x2d')][_0xa57c('0x4b')]({'name':_0x2c706f['name'],'resourceId':_0x2c706f['id'],'type':_0x4d2899['name'],'sectionId':_0x4d2899['id']},{})[_0xa57c('0x29')](function(){return _0xd57bac;});}else{return _0xd57bac;}})[_0xa57c('0x46')](function(_0x4d5d46){logger[_0xa57c('0x2e')](_0xa57c('0x51'),_0x4d5d46);throw _0x4d5d46;});}return _0xd57bac;})[_0xa57c('0x29')](respondWithResult(_0x3ef77c,0xc9))[_0xa57c('0x46')](handleError(_0x3ef77c,null));};exports[_0xa57c('0x28')]=function(_0xe0572f,_0x4fc413){if(_0xe0572f['body']['id']){delete _0xe0572f['body']['id'];}return db[_0xa57c('0x32')][_0xa57c('0x4a')]({'where':{'id':_0xe0572f[_0xa57c('0x47')]['id']}})[_0xa57c('0x29')](handleEntityNotFound(_0x4fc413,null))[_0xa57c('0x29')](saveUpdates(_0xe0572f[_0xa57c('0x4c')],null))[_0xa57c('0x29')](respondWithResult(_0x4fc413,null))[_0xa57c('0x46')](handleError(_0x4fc413,null));};exports['destroy']=function(_0x4da028,_0x28997e){return db['Team'][_0xa57c('0x4a')]({'where':{'id':_0x4da028[_0xa57c('0x47')]['id']}})[_0xa57c('0x29')](handleEntityNotFound(_0x28997e,null))['then'](removeEntity(_0x28997e,null))[_0xa57c('0x46')](handleError(_0x28997e,null));};exports['getQueues']=function(_0x21b00a,_0x4b3416,_0x39484d){return db[_0xa57c('0x32')][_0xa57c('0x52')]({'where':{'id':_0x21b00a[_0xa57c('0x47')]['id']}})['then'](handleEntityNotFound(_0x4b3416,null))[_0xa57c('0x29')](function(_0x2f8d23){if(!_0x21b00a[_0xa57c('0x38')][_0xa57c('0x53')]||!utils[_0xa57c('0x54')](_0x21b00a['query'][_0xa57c('0x53')])){throw new db[(_0xa57c('0x55'))][(_0xa57c('0x56'))](_0xa57c('0x57'));}var _0x2adcf6={};var _0xe5e63={};_0xe5e63[_0xa57c('0x35')]=_[_0xa57c('0x36')](db[_[_0xa57c('0x58')](_0x21b00a[_0xa57c('0x38')]['channel'][_0xa57c('0x59')]())+_0xa57c('0x5a')][_0xa57c('0x48')]);_0xe5e63[_0xa57c('0x38')]=_[_0xa57c('0x36')](_0x21b00a[_0xa57c('0x38')]);_0xe5e63['filters']=_[_0xa57c('0x39')](_0xe5e63[_0xa57c('0x35')],_0xe5e63['query']);_0x2adcf6[_0xa57c('0x3b')]=_[_0xa57c('0x39')](_0xe5e63[_0xa57c('0x35')],qs[_0xa57c('0x3a')](_0x21b00a[_0xa57c('0x38')][_0xa57c('0x3a')]));_0x2adcf6[_0xa57c('0x3b')]=_0x2adcf6['attributes'][_0xa57c('0x3c')]?_0x2adcf6['attributes']:_0xe5e63[_0xa57c('0x35')];_0x2adcf6['limit']=qs[_0xa57c('0x21')](_0x21b00a['query'][_0xa57c('0x21')]);_0x2adcf6[_0xa57c('0x1f')]=qs['offset'](_0x21b00a[_0xa57c('0x38')][_0xa57c('0x1f')]);_0x2adcf6[_0xa57c('0x5b')]=qs[_0xa57c('0x3e')](_0x21b00a['query'][_0xa57c('0x3e')]);_0x2adcf6[_0xa57c('0x3f')]=qs[_0xa57c('0x37')](_[_0xa57c('0x40')](_0x21b00a[_0xa57c('0x38')],_0xe5e63[_0xa57c('0x37')]));_0x2adcf6=_[_0xa57c('0x49')]({},_0x2adcf6,_0x21b00a[_0xa57c('0x43')]);return _0x2f8d23[_0xa57c('0x2b')+_[_0xa57c('0x58')](_0x21b00a[_0xa57c('0x38')][_0xa57c('0x53')][_0xa57c('0x59')]())+_0xa57c('0x5c')](_0x2adcf6);})[_0xa57c('0x29')](respondWithResult(_0x4b3416,null))[_0xa57c('0x46')](handleError(_0x4b3416,null));};exports['addQueues']=function(_0x393119,_0x521503,_0xd6762d){return db[_0xa57c('0x32')][_0xa57c('0x52')]({'where':{'id':_0x393119['params']['id']}})[_0xa57c('0x29')](function(_0x2ccc4d){if(_0x2ccc4d){if(!_0x393119[_0xa57c('0x4c')]['channel']||!utils['isValidChannel'](_0x393119[_0xa57c('0x4c')][_0xa57c('0x53')])){throw new db[(_0xa57c('0x55'))][(_0xa57c('0x56'))](_0xa57c('0x57'));}return _0x2ccc4d[_0xa57c('0x5d')+_[_0xa57c('0x58')](_0x393119[_0xa57c('0x4c')][_0xa57c('0x53')]['toLowerCase']())+_0xa57c('0x5c')](_0x393119[_0xa57c('0x4c')]['ids']);}return null;})[_0xa57c('0x29')](handleEntityNotFound(_0x521503,null))[_0xa57c('0x29')](respondWithStatusCode(_0x521503,null))[_0xa57c('0x46')](handleError(_0x521503,null));};exports[_0xa57c('0x5e')]=function(_0x1bb561,_0x28ec46,_0x42763b){return db[_0xa57c('0x32')]['findOne']({'where':{'id':_0x1bb561[_0xa57c('0x47')]['id']}})[_0xa57c('0x29')](function(_0x4da5bf){if(_0x4da5bf){if(!_0x1bb561[_0xa57c('0x38')][_0xa57c('0x53')]||!utils['isValidChannel'](_0x1bb561['query'][_0xa57c('0x53')])){throw new db[(_0xa57c('0x55'))][(_0xa57c('0x56'))](_0xa57c('0x57'));}return _0x4da5bf[_0xa57c('0x5f')+_['capitalize'](_0x1bb561[_0xa57c('0x38')][_0xa57c('0x53')][_0xa57c('0x59')]())+'Queues'](_0x1bb561[_0xa57c('0x38')]['ids']);}return null;})[_0xa57c('0x29')](handleEntityNotFound(_0x28ec46,null))[_0xa57c('0x29')](respondWithStatusCode(_0x28ec46,null))[_0xa57c('0x46')](handleError(_0x28ec46,null));};exports[_0xa57c('0x60')]=function(_0x4cf28c,_0x3740e9){return db[_0xa57c('0x32')][_0xa57c('0x4a')]({'where':{'id':_0x4cf28c[_0xa57c('0x47')]['id']}})['then'](handleEntityNotFound(_0x3740e9,null))[_0xa57c('0x29')](function(_0x1807ee){if(_0x1807ee){var _0x44e547=['Voice',_0xa57c('0x61'),_0xa57c('0x62'),_0xa57c('0x63'),'Fax',_0xa57c('0x64'),_0xa57c('0x65')];return db[_0xa57c('0x66')][_0xa57c('0x67')](function(_0x59227d){var _0x2a58b5=_[_0xa57c('0x31')](_0x44e547,function(_0x5c92ec){var _0x2dac12={'attributes':['id',_0xa57c('0x2f')]};if(_0x5c92ec==='Voice'){_0x2dac12[_0xa57c('0x68')]={'attributes':['penalty']};}return _0x1807ee[_0xa57c('0x2b')+_0x5c92ec+_0xa57c('0x5c')](_0x2dac12)[_0xa57c('0x29')](function(_0x37c00d){var _0x599408=_[_0xa57c('0x31')](_0x37c00d,function(_0x2288c2){var _0x224a5d=_[_0xa57c('0x31')](_0x4cf28c[_0xa57c('0x4c')][_0xa57c('0x69')],function(_0x18b36e){var _0x390710={'where':{'UserId':_0x18b36e,[_0x5c92ec+_0xa57c('0x6a')]:_0x2288c2['id']},'transaction':_0x59227d};if(_0x5c92ec===_0xa57c('0x6b')){_0x390710[_0xa57c('0x18')]={'penalty':_0x2288c2['TeamVoiceQueue']['penalty']};}return db['User'+_0x5c92ec+_0xa57c('0x5a')]['findOrCreate'](_0x390710)[_0xa57c('0x29')](function(){socket[_0xa57c('0x6c')](_0xa57c('0x4d')+_0x5c92ec+'Queue:save',{'UserId':_0x18b36e,[_0x5c92ec+_0xa57c('0x6a')]:_0x2288c2['id']});if(_0x5c92ec!==_0xa57c('0x6b'))return;return db[_0xa57c('0x6d')][_0xa57c('0x44')]({'where':{'id':_0x4cf28c[_0xa57c('0x4c')][_0xa57c('0x69')],'online':0x1},'attributes':['id',_0xa57c('0x2f'),'online',_0xa57c('0x6e'),_0xa57c('0x6f')],'raw':!![]})['then'](function(_0x4e5292){var _0x1d0d13=_[_0xa57c('0x31')](_0x4e5292,function(_0x4fc97e){return db['UserVoiceQueueRt'][_0xa57c('0x70')]({'membername':_0x4fc97e['name'],'UserId':_0x4fc97e['id'],'queue_name':_0x2288c2[_0xa57c('0x2f')],'VoiceQueueId':_0x2288c2['id'],'interface':_[_0xa57c('0x71')](_0x4fc97e['interface'])?util[_0xa57c('0x72')](_0xa57c('0x73'),_0x4fc97e[_0xa57c('0x2f')]):_0x4fc97e[_0xa57c('0x6f')],'paused':_0x4fc97e[_0xa57c('0x6e')]||![],'penalty':_0x2288c2['TeamVoiceQueue'][_0xa57c('0x74')]},{'transaction':_0x59227d});});return Promise['all'](_0x1d0d13);});});});return Promise[_0xa57c('0x75')](_0x224a5d);});return Promise[_0xa57c('0x75')](_0x599408);});});return Promise['all'](_0x2a58b5)['then'](function(){return _0x1807ee['addAgents'](_0x4cf28c[_0xa57c('0x4c')]['ids'],{'transaction':_0x59227d})['spread'](function(_0x175253){return _0x175253;});});});}})[_0xa57c('0x29')](respondWithResult(_0x3740e9,null))[_0xa57c('0x46')](handleError(_0x3740e9,null));};exports['removeAgents']=function(_0x3d360a,_0x1f28e9){return db[_0xa57c('0x32')]['find']({'where':{'id':_0x3d360a['params']['id']}})[_0xa57c('0x29')](handleEntityNotFound(_0x1f28e9,null))['then'](function(_0x377a8b){if(_0x377a8b){var _0x41d535=['Voice',_0xa57c('0x61'),'Mail','Sms','Fax',_0xa57c('0x64'),'Whatsapp'];return db['sequelize']['transaction'](function(_0x3e12e5){var _0x23c39b=_['map'](_0x41d535,function(_0x3d80ba){var _0x22b4ef={'attributes':['id',_0xa57c('0x2f')]};return _0x377a8b['get'+_0x3d80ba+_0xa57c('0x5c')](_0x22b4ef)[_0xa57c('0x29')](function(_0x997b84){var _0x16b727=_['map'](_0x997b84,function(_0x5e0db8){return _0x5e0db8[_0xa57c('0x76')](_0x3d360a['query'][_0xa57c('0x69')],{'transaction':_0x3e12e5})[_0xa57c('0x29')](function(){var _0x2cc12b=JSON['parse']('['+_0x3d360a[_0xa57c('0x38')]['ids']+']');var _0x521e63=_[_0xa57c('0x31')](_0x2cc12b,function(_0x58b935){socket[_0xa57c('0x6c')](_0xa57c('0x4d')+_0x3d80ba+'Queue:remove',{'UserId':Number(_0x58b935),[_0x3d80ba+'QueueId']:_0x5e0db8['id']});if(_0x3d80ba!==_0xa57c('0x6b'))return;return db[_0xa57c('0x77')]['destroy']({'where':{'VoiceQueueId':_0x5e0db8['id'],'UserId':_0x58b935},'transaction':_0x3e12e5});});return Promise['all'](_0x521e63);});});return Promise[_0xa57c('0x75')](_0x16b727);});});return Promise[_0xa57c('0x75')](_0x23c39b)[_0xa57c('0x29')](function(){return _0x377a8b['removeAgents'](_0x3d360a[_0xa57c('0x38')][_0xa57c('0x69')],{'transaction':_0x3e12e5});});});}})[_0xa57c('0x29')](respondWithStatusCode(_0x1f28e9,null))[_0xa57c('0x46')](handleError(_0x1f28e9,null));};exports[_0xa57c('0x78')]=function(_0x1f0c78,_0x10f1b5,_0x4133f7){var _0x39e5d6={};var _0x75888e={};var _0x46b223;var _0x2fa5fe;return db[_0xa57c('0x32')]['findOne']({'where':{'id':_0x1f0c78[_0xa57c('0x47')]['id']}})[_0xa57c('0x29')](handleEntityNotFound(_0x10f1b5,null))[_0xa57c('0x29')](function(_0x107ebd){if(_0x107ebd){_0x46b223=_0x107ebd;_0x75888e[_0xa57c('0x35')]=_[_0xa57c('0x36')](db['User']['rawAttributes']);_0x75888e[_0xa57c('0x38')]=_['keys'](_0x1f0c78['query']);_0x75888e[_0xa57c('0x37')]=_[_0xa57c('0x39')](_0x75888e[_0xa57c('0x35')],_0x75888e['query']);_0x39e5d6[_0xa57c('0x3b')]=_[_0xa57c('0x39')](_0x75888e[_0xa57c('0x35')],qs[_0xa57c('0x3a')](_0x1f0c78[_0xa57c('0x38')]['fields']));_0x39e5d6['attributes']=_0x39e5d6[_0xa57c('0x3b')][_0xa57c('0x3c')]?_0x39e5d6[_0xa57c('0x3b')]:_0x75888e['model'];_0x39e5d6[_0xa57c('0x5b')]=qs['sort'](_0x1f0c78[_0xa57c('0x38')][_0xa57c('0x3e')]);_0x39e5d6[_0xa57c('0x3f')]=qs[_0xa57c('0x37')](_[_0xa57c('0x40')](_0x1f0c78[_0xa57c('0x38')],_0x75888e[_0xa57c('0x37')]));if(_0x1f0c78['query']['filter']){_0x39e5d6[_0xa57c('0x3f')]=_[_0xa57c('0x49')](_0x39e5d6[_0xa57c('0x3f')],{'$or':_['map'](_0x39e5d6['attributes'],function(_0x137489){var _0xfff76a={};_0xfff76a[_0x137489]={'$like':'%'+_0x1f0c78[_0xa57c('0x38')][_0xa57c('0x41')]+'%'};return _0xfff76a;})});}_0x39e5d6=_[_0xa57c('0x49')]({},_0x39e5d6,_0x1f0c78['options']);return _0x46b223[_0xa57c('0x78')](_0x39e5d6);}})[_0xa57c('0x29')](function(_0x79f5f8){if(_0x79f5f8){_0x2fa5fe=_0x79f5f8['length'];if(!_0x1f0c78[_0xa57c('0x38')][_0xa57c('0x79')]('nolimit')){_0x39e5d6[_0xa57c('0x21')]=qs[_0xa57c('0x21')](_0x1f0c78[_0xa57c('0x38')][_0xa57c('0x21')]);_0x39e5d6[_0xa57c('0x1f')]=qs[_0xa57c('0x1f')](_0x1f0c78[_0xa57c('0x38')][_0xa57c('0x1f')]);}return _0x46b223[_0xa57c('0x78')](_0x39e5d6);}})['then'](function(_0x347814){if(_0x347814){return _0x347814?{'count':_0x2fa5fe,'rows':_0x347814}:null;}})[_0xa57c('0x29')](respondWithResult(_0x10f1b5,null))[_0xa57c('0x46')](handleError(_0x10f1b5,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index d4e5e91..152b0f3 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 _0xee11=['exports','events','Team','setMaxListeners','update','remove','emit','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee11,0x1c1));var _0x1ee1=function(_0x1cb783,_0x197145){_0x1cb783=_0x1cb783-0x0;var _0x4fae14=_0xee11[_0x1cb783];return _0x4fae14;};'use strict';var EventEmitter=require(_0x1ee1('0x0'));var Team=require('../../mysqldb')['db'][_0x1ee1('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x1ee1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1ee1('0x3'),'afterDestroy':_0x1ee1('0x4')};function emitEvent(_0x2fd4ef){return function(_0x4f0bf8,_0x3363cc,_0x1e59a2){TeamEvents[_0x1ee1('0x5')](_0x2fd4ef+':'+_0x4f0bf8['id'],_0x4f0bf8);TeamEvents[_0x1ee1('0x5')](_0x2fd4ef,_0x4f0bf8);_0x1e59a2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x1ee1('0x6')](e,emitEvent(event));}}module[_0x1ee1('0x7')]=TeamEvents; \ No newline at end of file +var _0xcbee=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x44d3d3,_0x30dbe6){var _0x5c828e=function(_0x3b4cf1){while(--_0x3b4cf1){_0x44d3d3['push'](_0x44d3d3['shift']());}};_0x5c828e(++_0x30dbe6);}(_0xcbee,0xcd));var _0xecbe=function(_0x5d9e80,_0x2defaa){_0x5d9e80=_0x5d9e80-0x0;var _0x5635dd=_0xcbee[_0x5d9e80];return _0x5635dd;};'use strict';var EventEmitter=require(_0xecbe('0x0'));var Team=require(_0xecbe('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xecbe('0x2')](0x0);var events={'afterCreate':_0xecbe('0x3'),'afterUpdate':_0xecbe('0x4'),'afterDestroy':_0xecbe('0x5')};function emitEvent(_0x10710d){return function(_0x5a9317,_0x16c130,_0x53c857){TeamEvents[_0xecbe('0x6')](_0x10710d+':'+_0x5a9317['id'],_0x5a9317);TeamEvents[_0xecbe('0x6')](_0x10710d,_0x5a9317);_0x53c857(null);};}for(var e in events){if(events[_0xecbe('0x7')](e)){var event=events[e];Team[_0xecbe('0x8')](e,emitEvent(event));}}module[_0xecbe('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index fcd6a13..6dc4b28 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 _0x0599=['../../config/environment','./team.attributes','exports','Team','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x0599,0x185));var _0x9059=function(_0x515a1c,_0x248281){_0x515a1c=_0x515a1c-0x0;var _0x3d32c1=_0x0599[_0x515a1c];return _0x3d32c1;};'use strict';var _=require(_0x9059('0x0'));var util=require(_0x9059('0x1'));var logger=require(_0x9059('0x2'))('api');var moment=require(_0x9059('0x3'));var BPromise=require('bluebird');var rp=require(_0x9059('0x4'));var fs=require('fs');var path=require(_0x9059('0x5'));var rimraf=require(_0x9059('0x6'));var config=require(_0x9059('0x7'));var attributes=require(_0x9059('0x8'));module[_0x9059('0x9')]=function(_0x3f7df0,_0x1f9d8d){return _0x3f7df0['define'](_0x9059('0xa'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13bf=['teams','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports','define','Team'];(function(_0x2c23b4,_0x3266c3){var _0x513817=function(_0x30d160){while(--_0x30d160){_0x2c23b4['push'](_0x2c23b4['shift']());}};_0x513817(++_0x3266c3);}(_0x13bf,0x189));var _0xf13b=function(_0x33a84f,_0x436c88){_0x33a84f=_0x33a84f-0x0;var _0x351ecb=_0x13bf[_0x33a84f];return _0x351ecb;};'use strict';var _=require(_0xf13b('0x0'));var util=require(_0xf13b('0x1'));var logger=require('../../config/logger')(_0xf13b('0x2'));var moment=require(_0xf13b('0x3'));var BPromise=require(_0xf13b('0x4'));var rp=require(_0xf13b('0x5'));var fs=require('fs');var path=require(_0xf13b('0x6'));var rimraf=require(_0xf13b('0x7'));var config=require(_0xf13b('0x8'));var attributes=require(_0xf13b('0x9'));module[_0xf13b('0xa')]=function(_0x4405f4,_0x26dec){return _0x4405f4[_0xf13b('0xb')](_0xf13b('0xc'),attributes,{'tableName':_0xf13b('0xd'),'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 d54b7e0..166f462 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 _0x6e40=['socket.io-emitter','./team.socket','register','request\x20sent','debug','stringify','error','code','Team,\x20%s,\x20%s','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6e40,0x9c));var _0x06e4=function(_0x4b84e8,_0x2b1f82){_0x4b84e8=_0x4b84e8-0x0;var _0x505794=_0x6e40[_0x4b84e8];return _0x505794;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x06e4('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06e4('0x1'));var db=require(_0x06e4('0x2'))['db'];var utils=require(_0x06e4('0x3'));var logger=require(_0x06e4('0x4'))(_0x06e4('0x5'));var config=require(_0x06e4('0x6'));var jayson=require(_0x06e4('0x7'));var client=jayson[_0x06e4('0x8')]['http']({'port':0x232a});config[_0x06e4('0x9')]=_[_0x06e4('0xa')](config['redis'],{'host':_0x06e4('0xb'),'port':0x18eb});var socket=require(_0x06e4('0xc'))(new Redis(config['redis']));require(_0x06e4('0xd'))[_0x06e4('0xe')](socket);function respondWithRpcPromise(_0x586f11,_0x5c9816,_0x269718){return new BPromise(function(_0x16007a,_0x5de365){return client['request'](_0x586f11,_0x269718)['then'](function(_0x5158a5){logger['info']('Team,\x20%s,\x20%s',_0x5c9816,_0x06e4('0xf'));logger[_0x06e4('0x10')]('Team,\x20%s,\x20%s,\x20%s',_0x5c9816,_0x06e4('0xf'),JSON[_0x06e4('0x11')](_0x5158a5));if(_0x5158a5['error']){if(_0x5158a5[_0x06e4('0x12')][_0x06e4('0x13')]===0x1f4){logger['error'](_0x06e4('0x14'),_0x5c9816,_0x5158a5[_0x06e4('0x12')]['message']);return _0x5de365(_0x5158a5[_0x06e4('0x12')][_0x06e4('0x15')]);}logger[_0x06e4('0x12')](_0x06e4('0x14'),_0x5c9816,_0x5158a5[_0x06e4('0x12')]['message']);return _0x16007a(_0x5158a5['error'][_0x06e4('0x15')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x5c9816,_0x06e4('0xf'));_0x16007a(_0x5158a5[_0x06e4('0x16')][_0x06e4('0x15')]);}})[_0x06e4('0x17')](function(_0x4d514a){logger['error']('Team,\x20%s,\x20%s',_0x5c9816,_0x4d514a);_0x5de365(_0x4d514a);});});} \ No newline at end of file +var _0x1ccf=['./team.socket','register','then','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x53f28e,_0x4d290f){var _0x26d65a=function(_0x57de83){while(--_0x57de83){_0x53f28e['push'](_0x53f28e['shift']());}};_0x26d65a(++_0x4d290f);}(_0x1ccf,0x187));var _0xf1cc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x1ccf[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0xf1cc('0x0'));var moment=require(_0xf1cc('0x1'));var BPromise=require(_0xf1cc('0x2'));var rs=require(_0xf1cc('0x3'));var fs=require('fs');var Redis=require(_0xf1cc('0x4'));var db=require(_0xf1cc('0x5'))['db'];var utils=require(_0xf1cc('0x6'));var logger=require(_0xf1cc('0x7'))('rpc');var config=require(_0xf1cc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf1cc('0x9')][_0xf1cc('0xa')]({'port':0x232a});config[_0xf1cc('0xb')]=_[_0xf1cc('0xc')](config['redis'],{'host':_0xf1cc('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf1cc('0xe'))[_0xf1cc('0xf')](socket);function respondWithRpcPromise(_0x2a1f72,_0x3b28b7,_0x4eee50){return new BPromise(function(_0x1baae5,_0x376d05){return client['request'](_0x2a1f72,_0x4eee50)[_0xf1cc('0x10')](function(_0x1f7925){logger['info'](_0xf1cc('0x11'),_0x3b28b7,_0xf1cc('0x12'));logger['debug'](_0xf1cc('0x13'),_0x3b28b7,_0xf1cc('0x12'),JSON[_0xf1cc('0x14')](_0x1f7925));if(_0x1f7925['error']){if(_0x1f7925['error'][_0xf1cc('0x15')]===0x1f4){logger['error'](_0xf1cc('0x11'),_0x3b28b7,_0x1f7925['error'][_0xf1cc('0x16')]);return _0x376d05(_0x1f7925[_0xf1cc('0x17')]['message']);}logger[_0xf1cc('0x17')](_0xf1cc('0x11'),_0x3b28b7,_0x1f7925['error'][_0xf1cc('0x16')]);return _0x1baae5(_0x1f7925[_0xf1cc('0x17')][_0xf1cc('0x16')]);}else{logger[_0xf1cc('0x18')](_0xf1cc('0x11'),_0x3b28b7,_0xf1cc('0x12'));_0x1baae5(_0x1f7925[_0xf1cc('0x19')][_0xf1cc('0x16')]);}})[_0xf1cc('0x1a')](function(_0xcde376){logger[_0xf1cc('0x17')](_0xf1cc('0x11'),_0x3b28b7,_0xcde376);_0x376d05(_0xcde376);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 558f156..acd3821 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 _0x644f=['emit','removeListener','register','length','team:','./team.events','save'];(function(_0x516044,_0x3677f7){var _0x31684b=function(_0x80be21){while(--_0x80be21){_0x516044['push'](_0x516044['shift']());}};_0x31684b(++_0x3677f7);}(_0x644f,0xc2));var _0xf644=function(_0x22ffbf,_0x16f31e){_0x22ffbf=_0x22ffbf-0x0;var _0x360c17=_0x644f[_0x22ffbf];return _0x360c17;};'use strict';var TeamEvents=require(_0xf644('0x0'));var events=[_0xf644('0x1'),'remove','update'];function createListener(_0x19242f,_0xc5044c){return function(_0x240500){_0xc5044c[_0xf644('0x2')](_0x19242f,_0x240500);};}function removeListener(_0x372b63,_0x3759da){return function(){TeamEvents[_0xf644('0x3')](_0x372b63,_0x3759da);};}exports[_0xf644('0x4')]=function(_0x9938ed){for(var _0x1a6cbb=0x0,_0x2c7aaf=events[_0xf644('0x5')];_0x1a6cbb<_0x2c7aaf;_0x1a6cbb++){var _0x50362e=events[_0x1a6cbb];var _0x2c2868=createListener(_0xf644('0x6')+_0x50362e,_0x9938ed);TeamEvents['on'](_0x50362e,_0x2c2868);}}; \ No newline at end of file +var _0x13f5=['register','length','team:','./team.events','save','remove','update','removeListener'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x13f5,0xc3));var _0x513f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x13f5[_0x122ef9];return _0x42fba0;};'use strict';var TeamEvents=require(_0x513f('0x0'));var events=[_0x513f('0x1'),_0x513f('0x2'),_0x513f('0x3')];function createListener(_0x55acec,_0x22a388){return function(_0x5795eb){_0x22a388['emit'](_0x55acec,_0x5795eb);};}function removeListener(_0xd61dcf,_0x10ae9e){return function(){TeamEvents[_0x513f('0x4')](_0xd61dcf,_0x10ae9e);};}exports[_0x513f('0x5')]=function(_0x8d019b){for(var _0x579681=0x0,_0x2be368=events[_0x513f('0x6')];_0x579681<_0x2be368;_0x579681++){var _0x2c75a3=events[_0x579681];var _0x42951f=createListener(_0x513f('0x7')+_0x2c75a3,_0x8d019b);TeamEvents['on'](_0x2c75a3,_0x42951f);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index d88e28a..957bbaf 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab75=['util','path','Router','fs-extra','../../components/auth/service','../../config/environment','exports','multer'];(function(_0x1fd838,_0x584cc8){var _0x313172=function(_0x5becd8){while(--_0x5becd8){_0x1fd838['push'](_0x1fd838['shift']());}};_0x313172(++_0x584cc8);}(_0xab75,0x11f));var _0x5ab7=function(_0x3e7c82,_0x20d276){_0x3e7c82=_0x3e7c82-0x0;var _0x4daa07=_0xab75[_0x3e7c82];return _0x4daa07;};'use strict';var multer=require(_0x5ab7('0x0'));var util=require(_0x5ab7('0x1'));var path=require(_0x5ab7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5ab7('0x3')]();var fs_extra=require(_0x5ab7('0x4'));var auth=require(_0x5ab7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5ab7('0x6'));module[_0x5ab7('0x7')]=router; \ No newline at end of file +var _0x9c1d=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x37e92e,_0x483639){var _0x22a6a8=function(_0x5c7e3d){while(--_0x5c7e3d){_0x37e92e['push'](_0x37e92e['shift']());}};_0x22a6a8(++_0x483639);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x233fcc,_0x5359d5){_0x233fcc=_0x233fcc-0x0;var _0x4233f9=_0x9c1d[_0x233fcc];return _0x4233f9;};'use strict';var multer=require(_0xd9c1('0x0'));var util=require(_0xd9c1('0x1'));var path=require(_0xd9c1('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9c1('0x3'));var router=express[_0xd9c1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd9c1('0x5'));var interaction=require(_0xd9c1('0x6'));var config=require('../../config/environment');module[_0xd9c1('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 3fbdd40..c6dd24e 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x5bf691,_0x5d34c9){var _0x1be7ab=function(_0x4b5d01){while(--_0x4b5d01){_0x5bf691['push'](_0x5bf691['shift']());}};_0x1be7ab(++_0x5d34c9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x13cb3d,_0x398f09){var _0x2f58e2=function(_0x43b603){while(--_0x43b603){_0x13cb3d['push'](_0x13cb3d['shift']());}};_0x2f58e2(++_0x398f09);}(_0xe706,0xa3));var _0x6e70=function(_0x582d0b,_0x28f609){_0x582d0b=_0x582d0b-0x0;var _0x2e93e1=_0xe706[_0x582d0b];return _0x2e93e1;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 94cc1a2..42067ad 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.model.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ca2=['bluebird','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','util','../../config/logger','api','moment'];(function(_0x4aa32e,_0x46f4c5){var _0x38f80a=function(_0x41ba4c){while(--_0x41ba4c){_0x4aa32e['push'](_0x4aa32e['shift']());}};_0x38f80a(++_0x46f4c5);}(_0x8ca2,0xcd));var _0x28ca=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x8ca2[_0x5783f4];return _0x28e380;};'use strict';var _=require('lodash');var util=require(_0x28ca('0x0'));var logger=require(_0x28ca('0x1'))(_0x28ca('0x2'));var moment=require(_0x28ca('0x3'));var BPromise=require(_0x28ca('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x28ca('0x5'));var config=require(_0x28ca('0x6'));var attributes=require(_0x28ca('0x7'));module['exports']=function(_0x2518ca,_0x11691d){return _0x2518ca[_0x28ca('0x8')](_0x28ca('0x9'),attributes,{'tableName':_0x28ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9aab=['util','api','moment','bluebird','request-promise','path','../../config/environment','define','lodash'];(function(_0x96691d,_0x544a9d){var _0x5a79ca=function(_0x48421a){while(--_0x48421a){_0x96691d['push'](_0x96691d['shift']());}};_0x5a79ca(++_0x544a9d);}(_0x9aab,0x131));var _0xb9aa=function(_0x50b704,_0x1b37de){_0x50b704=_0x50b704-0x0;var _0x3687ca=_0x9aab[_0x50b704];return _0x3687ca;};'use strict';var _=require(_0xb9aa('0x0'));var util=require(_0xb9aa('0x1'));var logger=require('../../config/logger')(_0xb9aa('0x2'));var moment=require(_0xb9aa('0x3'));var BPromise=require(_0xb9aa('0x4'));var rp=require(_0xb9aa('0x5'));var fs=require('fs');var path=require(_0xb9aa('0x6'));var rimraf=require('rimraf');var config=require(_0xb9aa('0x7'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x2b0743,_0x362b19){return _0x2b0743[_0xb9aa('0x8')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index fdb5a51..8dcc8d3 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0519=['../../config/utils','rpc','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4d8876,_0x4883f4){var _0x4cc98c=function(_0x316ec1){while(--_0x316ec1){_0x4d8876['push'](_0x4d8876['shift']());}};_0x4cc98c(++_0x4883f4);}(_0x0519,0x69));var _0x9051=function(_0x211fef,_0x4ab716){_0x211fef=_0x211fef-0x0;var _0x5447bf=_0x0519[_0x211fef];return _0x5447bf;};'use strict';var _=require('lodash');var util=require(_0x9051('0x0'));var moment=require(_0x9051('0x1'));var BPromise=require('bluebird');var rs=require(_0x9051('0x2'));var fs=require('fs');var Redis=require(_0x9051('0x3'));var db=require(_0x9051('0x4'))['db'];var utils=require(_0x9051('0x5'));var logger=require('../../config/logger')(_0x9051('0x6'));var config=require('../../config/environment');var jayson=require(_0x9051('0x7'));var client=jayson[_0x9051('0x8')][_0x9051('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fbe4b,_0x1f7fc9,_0x1861b6){return new BPromise(function(_0x113434,_0x1c80f9){return client[_0x9051('0xa')](_0x2fbe4b,_0x1861b6)[_0x9051('0xb')](function(_0x5047f1){logger[_0x9051('0xc')](_0x9051('0xd'),_0x1f7fc9,_0x9051('0xe'));logger[_0x9051('0xf')](_0x9051('0x10'),_0x1f7fc9,'request\x20sent',JSON[_0x9051('0x11')](_0x5047f1));if(_0x5047f1[_0x9051('0x12')]){if(_0x5047f1['error'][_0x9051('0x13')]===0x1f4){logger[_0x9051('0x12')](_0x9051('0xd'),_0x1f7fc9,_0x5047f1[_0x9051('0x12')]['message']);return _0x1c80f9(_0x5047f1['error'][_0x9051('0x14')]);}logger[_0x9051('0x12')](_0x9051('0xd'),_0x1f7fc9,_0x5047f1[_0x9051('0x12')][_0x9051('0x14')]);return _0x113434(_0x5047f1[_0x9051('0x12')][_0x9051('0x14')]);}else{logger[_0x9051('0xc')](_0x9051('0xd'),_0x1f7fc9,_0x9051('0xe'));_0x113434(_0x5047f1[_0x9051('0x15')][_0x9051('0x14')]);}})['catch'](function(_0x3fda27){logger[_0x9051('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1f7fc9,_0x3fda27);_0x1c80f9(_0x3fda27);});});} \ No newline at end of file +var _0x4b15=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','TeamVoiceQueue,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x2edc88,_0x5f4bb5){var _0x192365=function(_0x573915){while(--_0x573915){_0x2edc88['push'](_0x2edc88['shift']());}};_0x192365(++_0x5f4bb5);}(_0x4b15,0x83));var _0x54b1=function(_0x3b0335,_0x5e8c77){_0x3b0335=_0x3b0335-0x0;var _0x112555=_0x4b15[_0x3b0335];return _0x112555;};'use strict';var _=require(_0x54b1('0x0'));var util=require(_0x54b1('0x1'));var moment=require(_0x54b1('0x2'));var BPromise=require('bluebird');var rs=require(_0x54b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x54b1('0x4'))['db'];var utils=require(_0x54b1('0x5'));var logger=require(_0x54b1('0x6'))(_0x54b1('0x7'));var config=require(_0x54b1('0x8'));var jayson=require(_0x54b1('0x9'));var client=jayson[_0x54b1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e0e53,_0x453bd2,_0x32db6e){return new BPromise(function(_0xc65d4a,_0x1d8fe7){return client[_0x54b1('0xb')](_0x2e0e53,_0x32db6e)['then'](function(_0x10806a){logger[_0x54b1('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x453bd2,_0x54b1('0xd'));logger['debug'](_0x54b1('0xe'),_0x453bd2,_0x54b1('0xd'),JSON['stringify'](_0x10806a));if(_0x10806a['error']){if(_0x10806a[_0x54b1('0xf')]['code']===0x1f4){logger['error'](_0x54b1('0x10'),_0x453bd2,_0x10806a[_0x54b1('0xf')]['message']);return _0x1d8fe7(_0x10806a[_0x54b1('0xf')][_0x54b1('0x11')]);}logger[_0x54b1('0xf')](_0x54b1('0x10'),_0x453bd2,_0x10806a[_0x54b1('0xf')][_0x54b1('0x11')]);return _0xc65d4a(_0x10806a[_0x54b1('0xf')][_0x54b1('0x11')]);}else{logger['info'](_0x54b1('0x10'),_0x453bd2,_0x54b1('0xd'));_0xc65d4a(_0x10806a[_0x54b1('0x12')]['message']);}})['catch'](function(_0x4ea7d2){logger[_0x54b1('0xf')](_0x54b1('0x10'),_0x453bd2,_0x4ea7d2);_0x1d8fe7(_0x4ea7d2);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index eeda003..e544ac8 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 _0x3f8a=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1b2763,_0x49e0b5){var _0x5a02a5=function(_0x4d13a9){while(--_0x4d13a9){_0x1b2763['push'](_0x1b2763['shift']());}};_0x5a02a5(++_0x49e0b5);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x3bad98,_0x265549){_0x3bad98=_0x3bad98-0x0;var _0x4b3aa6=_0x3f8a[_0x3bad98];return _0x4b3aa6;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var fs_extra=require(_0xa3f8('0x5'));var auth=require(_0xa3f8('0x6'));var interaction=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var controller=require(_0xa3f8('0x9'));router[_0xa3f8('0xa')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xc')]);router[_0xa3f8('0xa')](_0xa3f8('0xd'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xe')]);router[_0xa3f8('0xf')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x10')]);router[_0xa3f8('0x11')]('/:id',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x12')]);router[_0xa3f8('0x13')](_0xa3f8('0xd'),auth['isAuthenticated'](),controller[_0xa3f8('0x14')]);module[_0xa3f8('0x15')]=router; \ No newline at end of file +var _0xee14=['get','/:id','show','post','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated'];(function(_0x5618c4,_0x4e8f57){var _0xdf390f=function(_0x1406cb){while(--_0x1406cb){_0x5618c4['push'](_0x5618c4['shift']());}};_0xdf390f(++_0x4e8f57);}(_0xee14,0x13a));var _0x4ee1=function(_0x3d948f,_0x2ceab5){_0x3d948f=_0x3d948f-0x0;var _0x4d5a21=_0xee14[_0x3d948f];return _0x4d5a21;};'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 fs_extra=require(_0x4ee1('0x4'));var auth=require(_0x4ee1('0x5'));var interaction=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var controller=require(_0x4ee1('0x8'));router['get']('/',auth[_0x4ee1('0x9')](),controller['index']);router[_0x4ee1('0xa')](_0x4ee1('0xb'),auth[_0x4ee1('0x9')](),controller[_0x4ee1('0xc')]);router[_0x4ee1('0xd')]('/',auth[_0x4ee1('0x9')](),controller['create']);router[_0x4ee1('0xe')](_0x4ee1('0xb'),auth['isAuthenticated'](),controller[_0x4ee1('0xf')]);router[_0x4ee1('0x10')](_0x4ee1('0xb'),auth[_0x4ee1('0x9')](),controller['destroy']);module[_0x4ee1('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 9088844..1beb158 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 _0x516b=['sequelize','exports','STRING','TEXT'];(function(_0xf9141,_0xb9f901){var _0x4b5761=function(_0x3ce757){while(--_0x3ce757){_0xf9141['push'](_0xf9141['shift']());}};_0x4b5761(++_0xb9f901);}(_0x516b,0xe8));var _0xb516=function(_0x510940,_0x3eacec){_0x510940=_0x510940-0x0;var _0x205cea=_0x516b[_0x510940];return _0x205cea;};'use strict';var Sequelize=require(_0xb516('0x0'));module[_0xb516('0x1')]={'name':{'type':Sequelize[_0xb516('0x2')]},'description':{'type':Sequelize[_0xb516('0x2')]},'html':{'type':Sequelize[_0xb516('0x3')]}}; \ No newline at end of file +var _0x4729=['STRING','sequelize'];(function(_0x3cbb59,_0x4168ca){var _0x4f09fc=function(_0xea219c){while(--_0xea219c){_0x3cbb59['push'](_0x3cbb59['shift']());}};_0x4f09fc(++_0x4168ca);}(_0x4729,0x123));var _0x9472=function(_0x3551d2,_0x16d66c){_0x3551d2=_0x3551d2-0x0;var _0x51c099=_0x4729[_0x3551d2];return _0x51c099;};'use strict';var Sequelize=require(_0x9472('0x0'));module['exports']={'name':{'type':Sequelize[_0x9472('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 79e81de..cfcd53d 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 _0xff3f=['attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','update','then','destroy','Templates','error','name','send','Template','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection'];(function(_0x1ebce2,_0x10e903){var _0x4a330c=function(_0x4fd810){while(--_0x4fd810){_0x1ebce2['push'](_0x1ebce2['shift']());}};_0x4a330c(++_0x10e903);}(_0xff3f,0x1e7));var _0xfff3=function(_0x51bb38,_0x4e57a0){_0x51bb38=_0x51bb38-0x0;var _0x51c09b=_0xff3f[_0x51bb38];return _0x51c09b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfff3('0x0'));var jsonpatch=require(_0xfff3('0x1'));var rp=require(_0xfff3('0x2'));var moment=require(_0xfff3('0x3'));var BPromise=require(_0xfff3('0x4'));var Mustache=require('mustache');var util=require(_0xfff3('0x5'));var path=require(_0xfff3('0x6'));var sox=require(_0xfff3('0x7'));var csv=require(_0xfff3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfff3('0x9'));var squel=require('squel');var crypto=require(_0xfff3('0xa'));var jsforce=require(_0xfff3('0xb'));var deskjs=require(_0xfff3('0xc'));var toCsv=require(_0xfff3('0x8'));var querystring=require(_0xfff3('0xd'));var Papa=require(_0xfff3('0xe'));var Redis=require(_0xfff3('0xf'));var authService=require(_0xfff3('0x10'));var qs=require(_0xfff3('0x11'));var as=require(_0xfff3('0x12'));var hardwareService=require(_0xfff3('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xfff3('0x14'));var config=require(_0xfff3('0x15'));var licenseUtil=require(_0xfff3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x296e7f,_0x177b1b){_0x177b1b=_0x177b1b||0xcc;return function(_0x1cb6a8){if(_0x1cb6a8){return _0x296e7f[_0xfff3('0x17')](_0x177b1b);}return _0x296e7f[_0xfff3('0x18')](_0x177b1b)[_0xfff3('0x19')]();};}function respondWithResult(_0x2a305c,_0x3f0fd9){_0x3f0fd9=_0x3f0fd9||0xc8;return function(_0x37d9f5){if(_0x37d9f5){return _0x2a305c['status'](_0x3f0fd9)[_0xfff3('0x1a')](_0x37d9f5);}};}function respondWithFilteredResult(_0x3a1aba,_0x2c9a18){return function(_0x532002){if(_0x532002){var _0x2181e0=typeof _0x2c9a18['offset']==='undefined'&&typeof _0x2c9a18[_0xfff3('0x1b')]===_0xfff3('0x1c');var _0x42c2ec=_0x532002[_0xfff3('0x1d')];var _0x282947=_0x2181e0?0x0:_0x2c9a18[_0xfff3('0x1e')];var _0x3def23=_0x2181e0?_0x532002[_0xfff3('0x1d')]:_0x2c9a18[_0xfff3('0x1e')]+_0x2c9a18['limit'];var _0x595a16;if(_0x3def23>=_0x42c2ec){_0x3def23=_0x42c2ec;_0x595a16=0xc8;}else{_0x595a16=0xce;}_0x3a1aba[_0xfff3('0x18')](_0x595a16);return _0x3a1aba[_0xfff3('0x1f')](_0xfff3('0x20'),_0x282947+'-'+_0x3def23+'/'+_0x42c2ec)[_0xfff3('0x1a')](_0x532002);}return null;};}function patchUpdates(_0x3abdb4){return function(_0x14a09c){try{jsonpatch[_0xfff3('0x21')](_0x14a09c,_0x3abdb4,!![]);}catch(_0x5562e9){return BPromise['reject'](_0x5562e9);}return _0x14a09c['save']();};}function saveUpdates(_0x16b94b,_0x28a5ee){return function(_0x39e6e0){if(_0x39e6e0){return _0x39e6e0[_0xfff3('0x22')](_0x16b94b)[_0xfff3('0x23')](function(_0x3ee3b9){return _0x3ee3b9;});}return null;};}function removeEntity(_0x3a48c1,_0x3709fa){return function(_0x2a7256){if(_0x2a7256){return _0x2a7256[_0xfff3('0x24')]()[_0xfff3('0x23')](function(){var _0x95b121=_0x2a7256['get']({'plain':!![]});var _0x1cc943=_0xfff3('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x1cc943,'resourceId':_0x95b121['id']}})['then'](function(){return _0x2a7256;});})[_0xfff3('0x23')](function(){_0x3a48c1[_0xfff3('0x18')](0xcc)[_0xfff3('0x19')]();});}};}function handleEntityNotFound(_0x412a3d,_0x48cebc){return function(_0x120b52){if(!_0x120b52){_0x412a3d[_0xfff3('0x17')](0x194);}return _0x120b52;};}function handleError(_0x97460d,_0x27a6d6){_0x27a6d6=_0x27a6d6||0x1f4;return function(_0xe117f5){logger[_0xfff3('0x26')](_0xe117f5['stack']);if(_0xe117f5['name']){delete _0xe117f5[_0xfff3('0x27')];}_0x97460d['status'](_0x27a6d6)[_0xfff3('0x28')](_0xe117f5);};}exports['index']=function(_0x3839d6,_0x1a5a0d){var _0x4e6357={},_0x52c04c={},_0x1a3fc3={'count':0x0,'rows':[]};var _0xa74d37=_['map'](db[_0xfff3('0x29')][_0xfff3('0x2a')],function(_0x471d24){return{'name':_0x471d24[_0xfff3('0x2b')],'type':_0x471d24[_0xfff3('0x2c')][_0xfff3('0x2d')]};});_0x52c04c[_0xfff3('0x2e')]=_[_0xfff3('0x2f')](_0xa74d37,_0xfff3('0x27'));_0x52c04c[_0xfff3('0x30')]=_[_0xfff3('0x31')](_0x3839d6[_0xfff3('0x30')]);_0x52c04c[_0xfff3('0x32')]=_[_0xfff3('0x33')](_0x52c04c['model'],_0x52c04c[_0xfff3('0x30')]);_0x4e6357[_0xfff3('0x34')]=_[_0xfff3('0x33')](_0x52c04c['model'],qs[_0xfff3('0x35')](_0x3839d6[_0xfff3('0x30')][_0xfff3('0x35')]));_0x4e6357[_0xfff3('0x34')]=_0x4e6357['attributes'][_0xfff3('0x36')]?_0x4e6357[_0xfff3('0x34')]:_0x52c04c[_0xfff3('0x2e')];if(!_0x3839d6[_0xfff3('0x30')]['hasOwnProperty'](_0xfff3('0x37'))){_0x4e6357[_0xfff3('0x1b')]=qs[_0xfff3('0x1b')](_0x3839d6['query'][_0xfff3('0x1b')]);_0x4e6357[_0xfff3('0x1e')]=qs[_0xfff3('0x1e')](_0x3839d6[_0xfff3('0x30')]['offset']);}_0x4e6357[_0xfff3('0x38')]=qs[_0xfff3('0x39')](_0x3839d6[_0xfff3('0x30')]['sort']);_0x4e6357[_0xfff3('0x3a')]=qs[_0xfff3('0x32')](_[_0xfff3('0x3b')](_0x3839d6[_0xfff3('0x30')],_0x52c04c[_0xfff3('0x32')]),_0xa74d37);if(_0x3839d6['query'][_0xfff3('0x3c')]){_0x4e6357[_0xfff3('0x3a')]=_['merge'](_0x4e6357[_0xfff3('0x3a')],{'$or':_['map'](_0xa74d37,function(_0x4b29bb){if(_0x4b29bb[_0xfff3('0x2c')]!==_0xfff3('0x3d')){var _0xc21038={};_0xc21038[_0x4b29bb[_0xfff3('0x27')]]={'$like':'%'+_0x3839d6['query'][_0xfff3('0x3c')]+'%'};return _0xc21038;}})});}_0x4e6357=_[_0xfff3('0x3e')]({},_0x4e6357,_0x3839d6[_0xfff3('0x3f')]);var _0x2a3109={'where':_0x4e6357['where']};return db[_0xfff3('0x29')][_0xfff3('0x1d')](_0x2a3109)[_0xfff3('0x23')](function(_0x16e00f){_0x1a3fc3[_0xfff3('0x1d')]=_0x16e00f;if(_0x3839d6['query'][_0xfff3('0x40')]){_0x4e6357[_0xfff3('0x41')]=[{'all':!![]}];}return db[_0xfff3('0x29')]['findAll'](_0x4e6357);})['then'](function(_0x217f9f){_0x1a3fc3['rows']=_0x217f9f;return _0x1a3fc3;})[_0xfff3('0x23')](respondWithFilteredResult(_0x1a5a0d,_0x4e6357))[_0xfff3('0x42')](handleError(_0x1a5a0d,null));};exports['show']=function(_0x1c86c0,_0x140c1a){var _0x251f72={'raw':!![],'where':{'id':_0x1c86c0['params']['id']}},_0x210eaa={};_0x210eaa['model']=_['keys'](db[_0xfff3('0x29')][_0xfff3('0x2a')]);_0x210eaa['query']=_[_0xfff3('0x31')](_0x1c86c0['query']);_0x210eaa[_0xfff3('0x32')]=_[_0xfff3('0x33')](_0x210eaa[_0xfff3('0x2e')],_0x210eaa[_0xfff3('0x30')]);_0x251f72['attributes']=_[_0xfff3('0x33')](_0x210eaa['model'],qs[_0xfff3('0x35')](_0x1c86c0[_0xfff3('0x30')][_0xfff3('0x35')]));_0x251f72[_0xfff3('0x34')]=_0x251f72[_0xfff3('0x34')][_0xfff3('0x36')]?_0x251f72['attributes']:_0x210eaa[_0xfff3('0x2e')];if(_0x1c86c0[_0xfff3('0x30')][_0xfff3('0x40')]){_0x251f72[_0xfff3('0x41')]=[{'all':!![]}];}_0x251f72=_[_0xfff3('0x3e')]({},_0x251f72,_0x1c86c0[_0xfff3('0x3f')]);return db[_0xfff3('0x29')][_0xfff3('0x43')](_0x251f72)[_0xfff3('0x23')](handleEntityNotFound(_0x140c1a,null))[_0xfff3('0x23')](respondWithResult(_0x140c1a,null))[_0xfff3('0x42')](handleError(_0x140c1a,null));};exports[_0xfff3('0x44')]=function(_0x133230,_0x3c3d57){return db[_0xfff3('0x29')][_0xfff3('0x44')](_0x133230['body'],{})['then'](function(_0x53fa55){var _0x584c3e=_0x133230['user']['get']({'plain':!![]});if(!_0x584c3e)throw new Error(_0xfff3('0x45'));if(_0x584c3e['role']==='user'){var _0x42c547=_0x53fa55[_0xfff3('0x46')]({'plain':!![]});var _0x416746=_0xfff3('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x416746,'userProfileId':_0x584c3e[_0xfff3('0x47')]},'raw':!![]})['then'](function(_0x34e5e2){if(_0x34e5e2&&_0x34e5e2[_0xfff3('0x48')]===0x0){return db[_0xfff3('0x49')][_0xfff3('0x44')]({'name':_0x42c547[_0xfff3('0x27')],'resourceId':_0x42c547['id'],'type':_0x34e5e2[_0xfff3('0x27')],'sectionId':_0x34e5e2['id']},{})['then'](function(){return _0x53fa55;});}else{return _0x53fa55;}})[_0xfff3('0x42')](function(_0xdb7668){logger['error'](_0xfff3('0x4a'),_0xdb7668);throw _0xdb7668;});}return _0x53fa55;})['then'](respondWithResult(_0x3c3d57,0xc9))[_0xfff3('0x42')](handleError(_0x3c3d57,null));};exports[_0xfff3('0x22')]=function(_0x507c7f,_0x118573){if(_0x507c7f[_0xfff3('0x4b')]['id']){delete _0x507c7f[_0xfff3('0x4b')]['id'];}return db[_0xfff3('0x29')][_0xfff3('0x43')]({'where':{'id':_0x507c7f[_0xfff3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x118573,null))[_0xfff3('0x23')](saveUpdates(_0x507c7f['body'],null))[_0xfff3('0x23')](respondWithResult(_0x118573,null))[_0xfff3('0x42')](handleError(_0x118573,null));};exports[_0xfff3('0x24')]=function(_0x4d5188,_0x593855){return db[_0xfff3('0x29')][_0xfff3('0x43')]({'where':{'id':_0x4d5188[_0xfff3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x593855,null))['then'](removeEntity(_0x593855,null))[_0xfff3('0x42')](handleError(_0x593855,null));}; \ No newline at end of file +var _0x1ac8=['type','query','filters','intersection','attributes','model','fields','length','nolimit','limit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','Content-Range','json','reject','update','then','destroy','get','Templates','UserProfileResource','sendStatus','error','name','send','index','Template','rawAttributes','fieldName'];(function(_0x46b0ba,_0x5a767c){var _0x2e53e0=function(_0x124fb2){while(--_0x124fb2){_0x46b0ba['push'](_0x46b0ba['shift']());}};_0x2e53e0(++_0x5a767c);}(_0x1ac8,0xc2));var _0x81ac=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1ac8[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x81ac('0x0'));var rimraf=require(_0x81ac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x81ac('0x2'));var rp=require(_0x81ac('0x3'));var moment=require(_0x81ac('0x4'));var BPromise=require(_0x81ac('0x5'));var Mustache=require('mustache');var util=require(_0x81ac('0x6'));var path=require(_0x81ac('0x7'));var sox=require(_0x81ac('0x8'));var csv=require(_0x81ac('0x9'));var ejs=require(_0x81ac('0xa'));var fs=require('fs');var fs_extra=require(_0x81ac('0xb'));var _=require(_0x81ac('0xc'));var squel=require(_0x81ac('0xd'));var crypto=require('crypto');var jsforce=require(_0x81ac('0xe'));var deskjs=require(_0x81ac('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x81ac('0x10'));var Redis=require(_0x81ac('0x11'));var authService=require(_0x81ac('0x12'));var qs=require(_0x81ac('0x13'));var as=require(_0x81ac('0x14'));var hardwareService=require(_0x81ac('0x15'));var logger=require(_0x81ac('0x16'))('api');var utils=require(_0x81ac('0x17'));var config=require(_0x81ac('0x18'));var licenseUtil=require(_0x81ac('0x19'));var db=require(_0x81ac('0x1a'))['db'];function respondWithStatusCode(_0x2d1651,_0x2cc8a9){_0x2cc8a9=_0x2cc8a9||0xcc;return function(_0x50f6e2){if(_0x50f6e2){return _0x2d1651['sendStatus'](_0x2cc8a9);}return _0x2d1651[_0x81ac('0x1b')](_0x2cc8a9)[_0x81ac('0x1c')]();};}function respondWithResult(_0xf2d6b3,_0x96f498){_0x96f498=_0x96f498||0xc8;return function(_0x3c60e0){if(_0x3c60e0){return _0xf2d6b3[_0x81ac('0x1b')](_0x96f498)['json'](_0x3c60e0);}};}function respondWithFilteredResult(_0x210784,_0x16a355){return function(_0x54ef74){if(_0x54ef74){var _0x32e7dc=typeof _0x16a355[_0x81ac('0x1d')]===_0x81ac('0x1e')&&typeof _0x16a355['limit']===_0x81ac('0x1e');var _0x6a8ca6=_0x54ef74[_0x81ac('0x1f')];var _0x1ea8f4=_0x32e7dc?0x0:_0x16a355[_0x81ac('0x1d')];var _0x51c1c1=_0x32e7dc?_0x54ef74['count']:_0x16a355[_0x81ac('0x1d')]+_0x16a355['limit'];var _0x4e2b1b;if(_0x51c1c1>=_0x6a8ca6){_0x51c1c1=_0x6a8ca6;_0x4e2b1b=0xc8;}else{_0x4e2b1b=0xce;}_0x210784['status'](_0x4e2b1b);return _0x210784['set'](_0x81ac('0x20'),_0x1ea8f4+'-'+_0x51c1c1+'/'+_0x6a8ca6)[_0x81ac('0x21')](_0x54ef74);}return null;};}function patchUpdates(_0x26c366){return function(_0x678734){try{jsonpatch['apply'](_0x678734,_0x26c366,!![]);}catch(_0x4de27e){return BPromise[_0x81ac('0x22')](_0x4de27e);}return _0x678734['save']();};}function saveUpdates(_0x515614,_0x1efd30){return function(_0x57d2eb){if(_0x57d2eb){return _0x57d2eb[_0x81ac('0x23')](_0x515614)[_0x81ac('0x24')](function(_0x331e8b){return _0x331e8b;});}return null;};}function removeEntity(_0x202e31,_0x204733){return function(_0xfbe6da){if(_0xfbe6da){return _0xfbe6da[_0x81ac('0x25')]()[_0x81ac('0x24')](function(){var _0x41f9f1=_0xfbe6da[_0x81ac('0x26')]({'plain':!![]});var _0x513500=_0x81ac('0x27');return db[_0x81ac('0x28')][_0x81ac('0x25')]({'where':{'type':_0x513500,'resourceId':_0x41f9f1['id']}})[_0x81ac('0x24')](function(){return _0xfbe6da;});})['then'](function(){_0x202e31[_0x81ac('0x1b')](0xcc)[_0x81ac('0x1c')]();});}};}function handleEntityNotFound(_0x5bfa68,_0xb8d5af){return function(_0xd7b9ef){if(!_0xd7b9ef){_0x5bfa68[_0x81ac('0x29')](0x194);}return _0xd7b9ef;};}function handleError(_0xe456df,_0x6a0f25){_0x6a0f25=_0x6a0f25||0x1f4;return function(_0x51d581){logger[_0x81ac('0x2a')](_0x51d581['stack']);if(_0x51d581[_0x81ac('0x2b')]){delete _0x51d581[_0x81ac('0x2b')];}_0xe456df[_0x81ac('0x1b')](_0x6a0f25)[_0x81ac('0x2c')](_0x51d581);};}exports[_0x81ac('0x2d')]=function(_0x499936,_0x479fab){var _0x17a467={},_0x11c614={},_0x10dbfd={'count':0x0,'rows':[]};var _0x6bc317=_['map'](db[_0x81ac('0x2e')][_0x81ac('0x2f')],function(_0x576262){return{'name':_0x576262[_0x81ac('0x30')],'type':_0x576262[_0x81ac('0x31')]['key']};});_0x11c614['model']=_['map'](_0x6bc317,_0x81ac('0x2b'));_0x11c614[_0x81ac('0x32')]=_['keys'](_0x499936['query']);_0x11c614[_0x81ac('0x33')]=_[_0x81ac('0x34')](_0x11c614['model'],_0x11c614[_0x81ac('0x32')]);_0x17a467[_0x81ac('0x35')]=_['intersection'](_0x11c614[_0x81ac('0x36')],qs[_0x81ac('0x37')](_0x499936[_0x81ac('0x32')][_0x81ac('0x37')]));_0x17a467[_0x81ac('0x35')]=_0x17a467['attributes'][_0x81ac('0x38')]?_0x17a467[_0x81ac('0x35')]:_0x11c614[_0x81ac('0x36')];if(!_0x499936[_0x81ac('0x32')]['hasOwnProperty'](_0x81ac('0x39'))){_0x17a467[_0x81ac('0x3a')]=qs[_0x81ac('0x3a')](_0x499936['query']['limit']);_0x17a467[_0x81ac('0x1d')]=qs[_0x81ac('0x1d')](_0x499936[_0x81ac('0x32')][_0x81ac('0x1d')]);}_0x17a467['order']=qs[_0x81ac('0x3b')](_0x499936[_0x81ac('0x32')][_0x81ac('0x3b')]);_0x17a467[_0x81ac('0x3c')]=qs[_0x81ac('0x33')](_['pick'](_0x499936[_0x81ac('0x32')],_0x11c614['filters']),_0x6bc317);if(_0x499936[_0x81ac('0x32')][_0x81ac('0x3d')]){_0x17a467[_0x81ac('0x3c')]=_[_0x81ac('0x3e')](_0x17a467[_0x81ac('0x3c')],{'$or':_['map'](_0x6bc317,function(_0x5dcffb){if(_0x5dcffb[_0x81ac('0x31')]!==_0x81ac('0x3f')){var _0x4cdee8={};_0x4cdee8[_0x5dcffb[_0x81ac('0x2b')]]={'$like':'%'+_0x499936[_0x81ac('0x32')][_0x81ac('0x3d')]+'%'};return _0x4cdee8;}})});}_0x17a467=_[_0x81ac('0x3e')]({},_0x17a467,_0x499936['options']);var _0x5ee383={'where':_0x17a467[_0x81ac('0x3c')]};return db[_0x81ac('0x2e')][_0x81ac('0x1f')](_0x5ee383)[_0x81ac('0x24')](function(_0x5c720f){_0x10dbfd[_0x81ac('0x1f')]=_0x5c720f;if(_0x499936[_0x81ac('0x32')][_0x81ac('0x40')]){_0x17a467[_0x81ac('0x41')]=[{'all':!![]}];}return db['Template'][_0x81ac('0x42')](_0x17a467);})['then'](function(_0x4f33b2){_0x10dbfd[_0x81ac('0x43')]=_0x4f33b2;return _0x10dbfd;})[_0x81ac('0x24')](respondWithFilteredResult(_0x479fab,_0x17a467))[_0x81ac('0x44')](handleError(_0x479fab,null));};exports[_0x81ac('0x45')]=function(_0x594bfc,_0x1fb990){var _0x430780={'raw':!![],'where':{'id':_0x594bfc[_0x81ac('0x46')]['id']}},_0x298b6f={};_0x298b6f['model']=_[_0x81ac('0x47')](db[_0x81ac('0x2e')][_0x81ac('0x2f')]);_0x298b6f[_0x81ac('0x32')]=_[_0x81ac('0x47')](_0x594bfc[_0x81ac('0x32')]);_0x298b6f['filters']=_[_0x81ac('0x34')](_0x298b6f[_0x81ac('0x36')],_0x298b6f['query']);_0x430780[_0x81ac('0x35')]=_[_0x81ac('0x34')](_0x298b6f['model'],qs[_0x81ac('0x37')](_0x594bfc[_0x81ac('0x32')][_0x81ac('0x37')]));_0x430780['attributes']=_0x430780[_0x81ac('0x35')][_0x81ac('0x38')]?_0x430780[_0x81ac('0x35')]:_0x298b6f[_0x81ac('0x36')];if(_0x594bfc[_0x81ac('0x32')]['includeAll']){_0x430780[_0x81ac('0x41')]=[{'all':!![]}];}_0x430780=_['merge']({},_0x430780,_0x594bfc['options']);return db[_0x81ac('0x2e')][_0x81ac('0x48')](_0x430780)[_0x81ac('0x24')](handleEntityNotFound(_0x1fb990,null))[_0x81ac('0x24')](respondWithResult(_0x1fb990,null))[_0x81ac('0x44')](handleError(_0x1fb990,null));};exports['create']=function(_0x25aac0,_0x1a4f12){return db[_0x81ac('0x2e')][_0x81ac('0x49')](_0x25aac0['body'],{})['then'](function(_0xcf7e9d){var _0xd88b80=_0x25aac0['user']['get']({'plain':!![]});if(!_0xd88b80)throw new Error(_0x81ac('0x4a'));if(_0xd88b80['role']===_0x81ac('0x4b')){var _0x2ef18c=_0xcf7e9d['get']({'plain':!![]});var _0x54921b=_0x81ac('0x27');return db[_0x81ac('0x4c')][_0x81ac('0x48')]({'where':{'name':_0x54921b,'userProfileId':_0xd88b80[_0x81ac('0x4d')]},'raw':!![]})[_0x81ac('0x24')](function(_0x585e97){if(_0x585e97&&_0x585e97[_0x81ac('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x2ef18c['name'],'resourceId':_0x2ef18c['id'],'type':_0x585e97[_0x81ac('0x2b')],'sectionId':_0x585e97['id']},{})[_0x81ac('0x24')](function(){return _0xcf7e9d;});}else{return _0xcf7e9d;}})['catch'](function(_0x447826){logger[_0x81ac('0x2a')](_0x81ac('0x4f'),_0x447826);throw _0x447826;});}return _0xcf7e9d;})['then'](respondWithResult(_0x1a4f12,0xc9))[_0x81ac('0x44')](handleError(_0x1a4f12,null));};exports['update']=function(_0x45a3bb,_0x5d421b){if(_0x45a3bb[_0x81ac('0x50')]['id']){delete _0x45a3bb['body']['id'];}return db[_0x81ac('0x2e')]['find']({'where':{'id':_0x45a3bb[_0x81ac('0x46')]['id']}})[_0x81ac('0x24')](handleEntityNotFound(_0x5d421b,null))['then'](saveUpdates(_0x45a3bb['body'],null))[_0x81ac('0x24')](respondWithResult(_0x5d421b,null))[_0x81ac('0x44')](handleError(_0x5d421b,null));};exports['destroy']=function(_0x574283,_0x289851){return db['Template'][_0x81ac('0x48')]({'where':{'id':_0x574283[_0x81ac('0x46')]['id']}})[_0x81ac('0x24')](handleEntityNotFound(_0x289851,null))[_0x81ac('0x24')](removeEntity(_0x289851,null))[_0x81ac('0x44')](handleError(_0x289851,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index f216d4b..1af954c 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 _0x21cd=['path','rimraf','exports','Template','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x6cb107,_0x2631bb){var _0x6c5c00=function(_0x324774){while(--_0x324774){_0x6cb107['push'](_0x6cb107['shift']());}};_0x6c5c00(++_0x2631bb);}(_0x21cd,0x7d));var _0xd21c=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x21cd[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0xd21c('0x0'));var util=require(_0xd21c('0x1'));var logger=require(_0xd21c('0x2'))(_0xd21c('0x3'));var moment=require(_0xd21c('0x4'));var BPromise=require(_0xd21c('0x5'));var rp=require(_0xd21c('0x6'));var fs=require('fs');var path=require(_0xd21c('0x7'));var rimraf=require(_0xd21c('0x8'));var config=require('../../config/environment');var attributes=require('./template.attributes');module[_0xd21c('0x9')]=function(_0x18c643,_0x3e1912){return _0x18c643['define'](_0xd21c('0xa'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd89b=['exports','Template','tools_templates','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./template.attributes'];(function(_0x370b19,_0x123cdc){var _0x4f1d70=function(_0x10509c){while(--_0x10509c){_0x370b19['push'](_0x370b19['shift']());}};_0x4f1d70(++_0x123cdc);}(_0xd89b,0x1f2));var _0xbd89=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xd89b[_0x363ef8];return _0x148822;};'use strict';var _=require(_0xbd89('0x0'));var util=require(_0xbd89('0x1'));var logger=require(_0xbd89('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbd89('0x3'));var rp=require(_0xbd89('0x4'));var fs=require('fs');var path=require(_0xbd89('0x5'));var rimraf=require('rimraf');var config=require(_0xbd89('0x6'));var attributes=require(_0xbd89('0x7'));module[_0xbd89('0x8')]=function(_0x45845b,_0x5dd94b){return _0x45845b['define'](_0xbd89('0x9'),attributes,{'tableName':_0xbd89('0xa'),'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 baa7c96..6779667 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 _0xe41d=['GetTemplate','Template','findAll','options','limit','map','include','model','attributes','then','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Template,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x24ffc9,_0x1b5bf5){var _0x30ac58=function(_0xb403eb){while(--_0xb403eb){_0x24ffc9['push'](_0x24ffc9['shift']());}};_0x30ac58(++_0x1b5bf5);}(_0xe41d,0x154));var _0xde41=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe41d[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xde41('0x0'));var util=require(_0xde41('0x1'));var moment=require(_0xde41('0x2'));var BPromise=require('bluebird');var rs=require(_0xde41('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xde41('0x4'))['db'];var utils=require(_0xde41('0x5'));var logger=require(_0xde41('0x6'))(_0xde41('0x7'));var config=require(_0xde41('0x8'));var jayson=require(_0xde41('0x9'));var client=jayson[_0xde41('0xa')][_0xde41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51a1b9,_0x4dfaf5,_0x3dd689){return new BPromise(function(_0x376f7b,_0xb0778){return client[_0xde41('0xc')](_0x51a1b9,_0x3dd689)['then'](function(_0x95dfc9){logger['info'](_0xde41('0xd'),_0x4dfaf5,'request\x20sent');logger[_0xde41('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x4dfaf5,_0xde41('0xf'),JSON[_0xde41('0x10')](_0x95dfc9));if(_0x95dfc9[_0xde41('0x11')]){if(_0x95dfc9['error'][_0xde41('0x12')]===0x1f4){logger[_0xde41('0x11')](_0xde41('0xd'),_0x4dfaf5,_0x95dfc9[_0xde41('0x11')][_0xde41('0x13')]);return _0xb0778(_0x95dfc9[_0xde41('0x11')]['message']);}logger[_0xde41('0x11')]('Template,\x20%s,\x20%s',_0x4dfaf5,_0x95dfc9[_0xde41('0x11')][_0xde41('0x13')]);return _0x376f7b(_0x95dfc9['error'][_0xde41('0x13')]);}else{logger[_0xde41('0x14')](_0xde41('0xd'),_0x4dfaf5,_0xde41('0xf'));_0x376f7b(_0x95dfc9[_0xde41('0x15')]['message']);}})[_0xde41('0x16')](function(_0x348060){logger[_0xde41('0x11')](_0xde41('0xd'),_0x4dfaf5,_0x348060);_0xb0778(_0x348060);});});}exports[_0xde41('0x17')]=function(_0x1371d0){var _0x5df25d=this;return new Promise(function(_0x116124,_0x20520f){return db[_0xde41('0x18')][_0xde41('0x19')]({'raw':_0x1371d0['options']?_0x1371d0[_0xde41('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1371d0[_0xde41('0x1a')]?_0x1371d0[_0xde41('0x1a')]['where']||null:null,'attributes':_0x1371d0[_0xde41('0x1a')]?_0x1371d0[_0xde41('0x1a')]['attributes']||null:null,'limit':_0x1371d0['options']?_0x1371d0[_0xde41('0x1a')][_0xde41('0x1b')]||null:null,'include':_0x1371d0[_0xde41('0x1a')]?_0x1371d0[_0xde41('0x1a')]['include']?_[_0xde41('0x1c')](_0x1371d0['options'][_0xde41('0x1d')],function(_0x4f4248){return{'model':db[_0x4f4248[_0xde41('0x1e')]],'as':_0x4f4248['as'],'attributes':_0x4f4248[_0xde41('0x1f')],'include':_0x4f4248[_0xde41('0x1d')]?_[_0xde41('0x1c')](_0x4f4248['include'],function(_0x394d4a){return{'model':db[_0x394d4a['model']],'as':_0x394d4a['as'],'attributes':_0x394d4a['attributes'],'include':_0x394d4a[_0xde41('0x1d')]?_[_0xde41('0x1c')](_0x394d4a[_0xde41('0x1d')],function(_0x2399b4){return{'model':db[_0x2399b4[_0xde41('0x1e')]],'as':_0x2399b4['as'],'attributes':_0x2399b4[_0xde41('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xde41('0x20')](function(_0x52bbfb){logger[_0xde41('0x14')](_0xde41('0x17'),_0x1371d0);logger[_0xde41('0xe')](_0xde41('0x17'),_0x1371d0,JSON['stringify'](_0x52bbfb));_0x116124(_0x52bbfb);})['catch'](function(_0x455e16){logger[_0xde41('0x11')](_0xde41('0x17'),_0x455e16[_0xde41('0x13')],_0x1371d0);_0x20520f(_0x5df25d[_0xde41('0x11')](0x1f4,_0x455e16[_0xde41('0x13')]));});});}; \ No newline at end of file +var _0xf65b=['info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Template','findAll','options','raw','where','limit','include','map','model','attributes','GetTemplate','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x4f4126,_0x3ab2de){var _0xf5693=function(_0x5bdb6b){while(--_0x5bdb6b){_0x4f4126['push'](_0x4f4126['shift']());}};_0xf5693(++_0x3ab2de);}(_0xf65b,0x1d5));var _0xbf65=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf65b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xbf65('0x0'));var moment=require(_0xbf65('0x1'));var BPromise=require(_0xbf65('0x2'));var rs=require(_0xbf65('0x3'));var fs=require('fs');var Redis=require(_0xbf65('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbf65('0x5'));var config=require(_0xbf65('0x6'));var jayson=require(_0xbf65('0x7'));var client=jayson[_0xbf65('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cc2f0,_0x56b976,_0x8dd860){return new BPromise(function(_0x18a0cc,_0x1a92aa){return client[_0xbf65('0x9')](_0x3cc2f0,_0x8dd860)[_0xbf65('0xa')](function(_0x2008a2){logger[_0xbf65('0xb')](_0xbf65('0xc'),_0x56b976,_0xbf65('0xd'));logger[_0xbf65('0xe')](_0xbf65('0xf'),_0x56b976,_0xbf65('0xd'),JSON[_0xbf65('0x10')](_0x2008a2));if(_0x2008a2[_0xbf65('0x11')]){if(_0x2008a2['error'][_0xbf65('0x12')]===0x1f4){logger[_0xbf65('0x11')](_0xbf65('0xc'),_0x56b976,_0x2008a2[_0xbf65('0x11')][_0xbf65('0x13')]);return _0x1a92aa(_0x2008a2[_0xbf65('0x11')][_0xbf65('0x13')]);}logger[_0xbf65('0x11')]('Template,\x20%s,\x20%s',_0x56b976,_0x2008a2[_0xbf65('0x11')][_0xbf65('0x13')]);return _0x18a0cc(_0x2008a2[_0xbf65('0x11')]['message']);}else{logger[_0xbf65('0xb')]('Template,\x20%s,\x20%s',_0x56b976,'request\x20sent');_0x18a0cc(_0x2008a2['result']['message']);}})[_0xbf65('0x14')](function(_0x13e2e6){logger[_0xbf65('0x11')](_0xbf65('0xc'),_0x56b976,_0x13e2e6);_0x1a92aa(_0x13e2e6);});});}exports['GetTemplate']=function(_0x573c7d){var _0x33c92b=this;return new Promise(function(_0x266c61,_0xf0a63a){return db[_0xbf65('0x15')][_0xbf65('0x16')]({'raw':_0x573c7d[_0xbf65('0x17')]?_0x573c7d['options'][_0xbf65('0x18')]===undefined?!![]:![]:!![],'where':_0x573c7d[_0xbf65('0x17')]?_0x573c7d[_0xbf65('0x17')][_0xbf65('0x19')]||null:null,'attributes':_0x573c7d[_0xbf65('0x17')]?_0x573c7d[_0xbf65('0x17')]['attributes']||null:null,'limit':_0x573c7d[_0xbf65('0x17')]?_0x573c7d['options'][_0xbf65('0x1a')]||null:null,'include':_0x573c7d[_0xbf65('0x17')]?_0x573c7d[_0xbf65('0x17')][_0xbf65('0x1b')]?_[_0xbf65('0x1c')](_0x573c7d[_0xbf65('0x17')]['include'],function(_0x3c7c92){return{'model':db[_0x3c7c92[_0xbf65('0x1d')]],'as':_0x3c7c92['as'],'attributes':_0x3c7c92[_0xbf65('0x1e')],'include':_0x3c7c92[_0xbf65('0x1b')]?_[_0xbf65('0x1c')](_0x3c7c92['include'],function(_0x40096f){return{'model':db[_0x40096f[_0xbf65('0x1d')]],'as':_0x40096f['as'],'attributes':_0x40096f[_0xbf65('0x1e')],'include':_0x40096f[_0xbf65('0x1b')]?_[_0xbf65('0x1c')](_0x40096f['include'],function(_0x50fea0){return{'model':db[_0x50fea0[_0xbf65('0x1d')]],'as':_0x50fea0['as'],'attributes':_0x50fea0[_0xbf65('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbf65('0xa')](function(_0x14d3eb){logger[_0xbf65('0xb')](_0xbf65('0x1f'),_0x573c7d);logger[_0xbf65('0xe')](_0xbf65('0x1f'),_0x573c7d,JSON[_0xbf65('0x10')](_0x14d3eb));_0x266c61(_0x14d3eb);})['catch'](function(_0x49077e){logger[_0xbf65('0x11')]('GetTemplate',_0x49077e[_0xbf65('0x13')],_0x573c7d);_0xf0a63a(_0x33c92b[_0xbf65('0x11')](0x1f4,_0x49077e[_0xbf65('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 4ba56cb..00a26f2 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 _0x46e9=['getActions','post','create','/:id/any_conditions','addAction','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions'];(function(_0x5353ea,_0x3230b7){var _0x5e1763=function(_0x37cdde){while(--_0x37cdde){_0x5353ea['push'](_0x5353ea['shift']());}};_0x5e1763(++_0x3230b7);}(_0x46e9,0x176));var _0x946e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x46e9[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x946e('0x0'));var util=require(_0x946e('0x1'));var path=require('path');var timeout=require(_0x946e('0x2'));var express=require(_0x946e('0x3'));var router=express['Router']();var fs_extra=require(_0x946e('0x4'));var auth=require(_0x946e('0x5'));var interaction=require(_0x946e('0x6'));var config=require('../../config/environment');var controller=require(_0x946e('0x7'));router[_0x946e('0x8')]('/',auth[_0x946e('0x9')](),controller[_0x946e('0xa')]);router[_0x946e('0x8')](_0x946e('0xb'),auth[_0x946e('0x9')](),controller['show']);router[_0x946e('0x8')](_0x946e('0xc'),auth[_0x946e('0x9')](),controller[_0x946e('0xd')]);router[_0x946e('0x8')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x946e('0xe')]);router['get'](_0x946e('0xf'),auth[_0x946e('0x9')](),controller[_0x946e('0x10')]);router[_0x946e('0x11')]('/',auth[_0x946e('0x9')](),controller[_0x946e('0x12')]);router['post'](_0x946e('0xc'),auth[_0x946e('0x9')](),controller['addAllCondition']);router[_0x946e('0x11')](_0x946e('0x13'),auth[_0x946e('0x9')](),controller['addAnyCondition']);router[_0x946e('0x11')](_0x946e('0xf'),auth[_0x946e('0x9')](),controller[_0x946e('0x14')]);router[_0x946e('0x15')](_0x946e('0xb'),auth[_0x946e('0x9')](),controller[_0x946e('0x16')]);router[_0x946e('0x17')](_0x946e('0xb'),auth[_0x946e('0x9')](),controller[_0x946e('0x18')]);module[_0x946e('0x19')]=router; \ No newline at end of file +var _0x3033=['../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','show','/:id/all_conditions','getAllConditions','getAnyConditions','getActions','post','/:id/any_conditions','addAnyCondition','/:id/actions','addAction','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x3033,0x9c));var _0x3303=function(_0x47f06c,_0x520352){_0x47f06c=_0x47f06c-0x0;var _0xe7376=_0x3033[_0x47f06c];return _0xe7376;};'use strict';var multer=require(_0x3303('0x0'));var util=require('util');var path=require(_0x3303('0x1'));var timeout=require(_0x3303('0x2'));var express=require(_0x3303('0x3'));var router=express[_0x3303('0x4')]();var fs_extra=require(_0x3303('0x5'));var auth=require(_0x3303('0x6'));var interaction=require(_0x3303('0x7'));var config=require(_0x3303('0x8'));var controller=require(_0x3303('0x9'));router[_0x3303('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x3303('0xb')](),controller[_0x3303('0xc')]);router[_0x3303('0xa')](_0x3303('0xd'),auth['isAuthenticated'](),controller[_0x3303('0xe')]);router[_0x3303('0xa')]('/:id/any_conditions',auth[_0x3303('0xb')](),controller[_0x3303('0xf')]);router[_0x3303('0xa')]('/:id/actions',auth[_0x3303('0xb')](),controller[_0x3303('0x10')]);router[_0x3303('0x11')]('/',auth[_0x3303('0xb')](),controller['create']);router[_0x3303('0x11')](_0x3303('0xd'),auth[_0x3303('0xb')](),controller['addAllCondition']);router[_0x3303('0x11')](_0x3303('0x12'),auth['isAuthenticated'](),controller[_0x3303('0x13')]);router[_0x3303('0x11')](_0x3303('0x14'),auth[_0x3303('0xb')](),controller[_0x3303('0x15')]);router[_0x3303('0x16')](_0x3303('0x17'),auth[_0x3303('0xb')](),controller[_0x3303('0x18')]);router[_0x3303('0x19')](_0x3303('0x17'),auth['isAuthenticated'](),controller['destroy']);module[_0x3303('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 2c4a0e3..ea436b6 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 _0x81b9=['sequelize','exports','STRING','BOOLEAN'];(function(_0x1a3dd9,_0x433327){var _0x3b7b2a=function(_0x2e5dfd){while(--_0x2e5dfd){_0x1a3dd9['push'](_0x1a3dd9['shift']());}};_0x3b7b2a(++_0x433327);}(_0x81b9,0x80));var _0x981b=function(_0x57bc48,_0x878aac){_0x57bc48=_0x57bc48-0x0;var _0x2b958f=_0x81b9[_0x57bc48];return _0x2b958f;};'use strict';var Sequelize=require(_0x981b('0x0'));module[_0x981b('0x1')]={'name':{'type':Sequelize[_0x981b('0x2')]},'channel':{'type':Sequelize[_0x981b('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x981b('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4df2=['sequelize','STRING'];(function(_0x409c15,_0x11b3ac){var _0x241a33=function(_0x52c5ab){while(--_0x52c5ab){_0x409c15['push'](_0x409c15['shift']());}};_0x241a33(++_0x11b3ac);}(_0x4df2,0x190));var _0x24df=function(_0x42f4db,_0x560a6f){_0x42f4db=_0x42f4db-0x0;var _0x1f8949=_0x4df2[_0x42f4db];return _0x1f8949;};'use strict';var Sequelize=require(_0x24df('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x24df('0x1')]},'description':{'type':Sequelize[_0x24df('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 87d8e3b..cffd26b 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 _0xd1c4=['Trigger','rawAttributes','type','key','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','fields','options','get','role','UserProfileSection','find','userProfileId','autoAssociation','body','addAllCondition','TriggerAllId','Condition','create','addAnyCondition','TriggerAnyId','findOne','length','pick','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','Triggers','UserProfileResource','destroy','name','send','index','map'];(function(_0x586272,_0x3c6850){var _0x581a76=function(_0x491793){while(--_0x491793){_0x586272['push'](_0x586272['shift']());}};_0x581a76(++_0x3c6850);}(_0xd1c4,0x149));var _0x4d1c=function(_0x3db5e2,_0x1b1d67){_0x3db5e2=_0x3db5e2-0x0;var _0x5e1578=_0xd1c4[_0x3db5e2];return _0x5e1578;};'use strict';var emlformat=require(_0x4d1c('0x0'));var rimraf=require(_0x4d1c('0x1'));var zipdir=require(_0x4d1c('0x2'));var jsonpatch=require(_0x4d1c('0x3'));var rp=require(_0x4d1c('0x4'));var moment=require(_0x4d1c('0x5'));var BPromise=require(_0x4d1c('0x6'));var Mustache=require('mustache');var util=require(_0x4d1c('0x7'));var path=require('path');var sox=require(_0x4d1c('0x8'));var csv=require(_0x4d1c('0x9'));var ejs=require(_0x4d1c('0xa'));var fs=require('fs');var fs_extra=require(_0x4d1c('0xb'));var _=require(_0x4d1c('0xc'));var squel=require(_0x4d1c('0xd'));var crypto=require(_0x4d1c('0xe'));var jsforce=require(_0x4d1c('0xf'));var deskjs=require(_0x4d1c('0x10'));var toCsv=require(_0x4d1c('0x9'));var querystring=require('querystring');var Papa=require(_0x4d1c('0x11'));var Redis=require(_0x4d1c('0x12'));var authService=require(_0x4d1c('0x13'));var qs=require(_0x4d1c('0x14'));var as=require(_0x4d1c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d1c('0x16'))('api');var utils=require(_0x4d1c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4d1c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c2e88,_0x39ff0e){_0x39ff0e=_0x39ff0e||0xcc;return function(_0x22778c){if(_0x22778c){return _0x5c2e88[_0x4d1c('0x19')](_0x39ff0e);}return _0x5c2e88[_0x4d1c('0x1a')](_0x39ff0e)[_0x4d1c('0x1b')]();};}function respondWithResult(_0x36508d,_0x655428){_0x655428=_0x655428||0xc8;return function(_0x31bb85){if(_0x31bb85){return _0x36508d[_0x4d1c('0x1a')](_0x655428)[_0x4d1c('0x1c')](_0x31bb85);}};}function respondWithFilteredResult(_0x4ca3a6,_0x4c0cd4){return function(_0x3a0dbc){if(_0x3a0dbc){var _0x5a0d9f=typeof _0x4c0cd4[_0x4d1c('0x1d')]==='undefined'&&typeof _0x4c0cd4[_0x4d1c('0x1e')]===_0x4d1c('0x1f');var _0x23b2a7=_0x3a0dbc[_0x4d1c('0x20')];var _0x3df2dc=_0x5a0d9f?0x0:_0x4c0cd4[_0x4d1c('0x1d')];var _0x2dfd0c=_0x5a0d9f?_0x3a0dbc[_0x4d1c('0x20')]:_0x4c0cd4[_0x4d1c('0x1d')]+_0x4c0cd4[_0x4d1c('0x1e')];var _0x442310;if(_0x2dfd0c>=_0x23b2a7){_0x2dfd0c=_0x23b2a7;_0x442310=0xc8;}else{_0x442310=0xce;}_0x4ca3a6[_0x4d1c('0x1a')](_0x442310);return _0x4ca3a6[_0x4d1c('0x21')](_0x4d1c('0x22'),_0x3df2dc+'-'+_0x2dfd0c+'/'+_0x23b2a7)[_0x4d1c('0x1c')](_0x3a0dbc);}return null;};}function patchUpdates(_0x319edb){return function(_0x27ebfb){try{jsonpatch[_0x4d1c('0x23')](_0x27ebfb,_0x319edb,!![]);}catch(_0x1da0cd){return BPromise[_0x4d1c('0x24')](_0x1da0cd);}return _0x27ebfb[_0x4d1c('0x25')]();};}function saveUpdates(_0x412548,_0x2978e6){return function(_0x3741d8){if(_0x3741d8){return _0x3741d8[_0x4d1c('0x26')](_0x412548)[_0x4d1c('0x27')](function(_0x2bbe8b){return _0x2bbe8b;});}return null;};}function removeEntity(_0x1e41d8,_0x550138){return function(_0x3afc5c){if(_0x3afc5c){return _0x3afc5c['destroy']()[_0x4d1c('0x27')](function(){var _0x30207e=_0x3afc5c['get']({'plain':!![]});var _0xa8fa42=_0x4d1c('0x28');return db[_0x4d1c('0x29')][_0x4d1c('0x2a')]({'where':{'type':_0xa8fa42,'resourceId':_0x30207e['id']}})[_0x4d1c('0x27')](function(){return _0x3afc5c;});})[_0x4d1c('0x27')](function(){_0x1e41d8['status'](0xcc)[_0x4d1c('0x1b')]();});}};}function handleEntityNotFound(_0x2a19bd,_0xfb0a62){return function(_0x48df32){if(!_0x48df32){_0x2a19bd[_0x4d1c('0x19')](0x194);}return _0x48df32;};}function handleError(_0x5225ee,_0x4c00cf){_0x4c00cf=_0x4c00cf||0x1f4;return function(_0x4e7964){logger['error'](_0x4e7964['stack']);if(_0x4e7964[_0x4d1c('0x2b')]){delete _0x4e7964[_0x4d1c('0x2b')];}_0x5225ee[_0x4d1c('0x1a')](_0x4c00cf)[_0x4d1c('0x2c')](_0x4e7964);};}exports[_0x4d1c('0x2d')]=function(_0x15f7ae,_0x47c813){var _0x2df3ea={},_0x546342={},_0x3b3857={'count':0x0,'rows':[]};var _0x157e6e=_[_0x4d1c('0x2e')](db[_0x4d1c('0x2f')][_0x4d1c('0x30')],function(_0x258fb2){return{'name':_0x258fb2['fieldName'],'type':_0x258fb2[_0x4d1c('0x31')][_0x4d1c('0x32')]};});_0x546342[_0x4d1c('0x33')]=_[_0x4d1c('0x2e')](_0x157e6e,'name');_0x546342[_0x4d1c('0x34')]=_[_0x4d1c('0x35')](_0x15f7ae['query']);_0x546342['filters']=_[_0x4d1c('0x36')](_0x546342[_0x4d1c('0x33')],_0x546342['query']);_0x2df3ea['attributes']=_[_0x4d1c('0x36')](_0x546342['model'],qs['fields'](_0x15f7ae[_0x4d1c('0x34')]['fields']));_0x2df3ea[_0x4d1c('0x37')]=_0x2df3ea['attributes']['length']?_0x2df3ea[_0x4d1c('0x37')]:_0x546342[_0x4d1c('0x33')];if(!_0x15f7ae[_0x4d1c('0x34')][_0x4d1c('0x38')](_0x4d1c('0x39'))){_0x2df3ea[_0x4d1c('0x1e')]=qs[_0x4d1c('0x1e')](_0x15f7ae[_0x4d1c('0x34')][_0x4d1c('0x1e')]);_0x2df3ea['offset']=qs['offset'](_0x15f7ae[_0x4d1c('0x34')]['offset']);}_0x2df3ea[_0x4d1c('0x3a')]=qs[_0x4d1c('0x3b')](_0x15f7ae[_0x4d1c('0x34')][_0x4d1c('0x3b')]);_0x2df3ea[_0x4d1c('0x3c')]=qs['filters'](_['pick'](_0x15f7ae['query'],_0x546342[_0x4d1c('0x3d')]),_0x157e6e);if(_0x15f7ae[_0x4d1c('0x34')][_0x4d1c('0x3e')]){_0x2df3ea[_0x4d1c('0x3c')]=_[_0x4d1c('0x3f')](_0x2df3ea['where'],{'$or':_[_0x4d1c('0x2e')](_0x157e6e,function(_0x3a96e6){if(_0x3a96e6[_0x4d1c('0x31')]!==_0x4d1c('0x40')){var _0x39f580={};_0x39f580[_0x3a96e6[_0x4d1c('0x2b')]]={'$like':'%'+_0x15f7ae[_0x4d1c('0x34')]['filter']+'%'};return _0x39f580;}})});}_0x2df3ea=_['merge']({},_0x2df3ea,_0x15f7ae['options']);var _0x1f2303={'where':_0x2df3ea['where']};return db['Trigger']['count'](_0x1f2303)['then'](function(_0x3dc050){_0x3b3857[_0x4d1c('0x20')]=_0x3dc050;if(_0x15f7ae[_0x4d1c('0x34')][_0x4d1c('0x41')]){_0x2df3ea['include']=[{'all':!![]}];}return db['Trigger'][_0x4d1c('0x42')](_0x2df3ea);})['then'](function(_0x5af49e){_0x3b3857['rows']=_0x5af49e;return _0x3b3857;})[_0x4d1c('0x27')](respondWithFilteredResult(_0x47c813,_0x2df3ea))[_0x4d1c('0x43')](handleError(_0x47c813,null));};exports[_0x4d1c('0x44')]=function(_0x47667e,_0x2c73e4){var _0x102da5={'raw':![],'where':{'id':_0x47667e[_0x4d1c('0x45')]['id']}},_0x355ef9={};_0x355ef9['model']=_['keys'](db[_0x4d1c('0x2f')][_0x4d1c('0x30')]);_0x355ef9[_0x4d1c('0x34')]=_['keys'](_0x47667e[_0x4d1c('0x34')]);_0x355ef9['filters']=_[_0x4d1c('0x36')](_0x355ef9[_0x4d1c('0x33')],_0x355ef9[_0x4d1c('0x34')]);_0x102da5[_0x4d1c('0x37')]=_[_0x4d1c('0x36')](_0x355ef9[_0x4d1c('0x33')],qs[_0x4d1c('0x46')](_0x47667e['query'][_0x4d1c('0x46')]));_0x102da5['attributes']=_0x102da5['attributes']['length']?_0x102da5['attributes']:_0x355ef9[_0x4d1c('0x33')];if(_0x47667e[_0x4d1c('0x34')]['includeAll']){_0x102da5['include']=[{'all':!![]}];}_0x102da5=_[_0x4d1c('0x3f')]({},_0x102da5,_0x47667e[_0x4d1c('0x47')]);return db[_0x4d1c('0x2f')]['find'](_0x102da5)['then'](handleEntityNotFound(_0x2c73e4,null))[_0x4d1c('0x27')](respondWithResult(_0x2c73e4,null))[_0x4d1c('0x43')](handleError(_0x2c73e4,null));};exports['create']=function(_0xed0c76,_0x679560){return db[_0x4d1c('0x2f')]['create'](_0xed0c76['body'],{})[_0x4d1c('0x27')](function(_0x13d9c1){var _0x35cb73=_0xed0c76['user'][_0x4d1c('0x48')]({'plain':!![]});if(!_0x35cb73)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35cb73[_0x4d1c('0x49')]==='user'){var _0x3110ba=_0x13d9c1['get']({'plain':!![]});var _0x4c71e3=_0x4d1c('0x28');return db[_0x4d1c('0x4a')][_0x4d1c('0x4b')]({'where':{'name':_0x4c71e3,'userProfileId':_0x35cb73[_0x4d1c('0x4c')]},'raw':!![]})[_0x4d1c('0x27')](function(_0x1c020b){if(_0x1c020b&&_0x1c020b[_0x4d1c('0x4d')]===0x0){return db[_0x4d1c('0x29')]['create']({'name':_0x3110ba[_0x4d1c('0x2b')],'resourceId':_0x3110ba['id'],'type':_0x1c020b['name'],'sectionId':_0x1c020b['id']},{})[_0x4d1c('0x27')](function(){return _0x13d9c1;});}else{return _0x13d9c1;}})['catch'](function(_0x1b9a91){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b9a91);throw _0x1b9a91;});}return _0x13d9c1;})['then'](respondWithResult(_0x679560,0xc9))[_0x4d1c('0x43')](handleError(_0x679560,null));};exports[_0x4d1c('0x26')]=function(_0x5e7d79,_0x2783d3){if(_0x5e7d79[_0x4d1c('0x4e')]['id']){delete _0x5e7d79[_0x4d1c('0x4e')]['id'];}return db[_0x4d1c('0x2f')]['find']({'where':{'id':_0x5e7d79[_0x4d1c('0x45')]['id']}})[_0x4d1c('0x27')](handleEntityNotFound(_0x2783d3,null))[_0x4d1c('0x27')](saveUpdates(_0x5e7d79['body'],null))['then'](respondWithResult(_0x2783d3,null))[_0x4d1c('0x43')](handleError(_0x2783d3,null));};exports[_0x4d1c('0x2a')]=function(_0x291547,_0x8a0611){return db[_0x4d1c('0x2f')][_0x4d1c('0x4b')]({'where':{'id':_0x291547[_0x4d1c('0x45')]['id']}})['then'](handleEntityNotFound(_0x8a0611,null))[_0x4d1c('0x27')](removeEntity(_0x8a0611,null))['catch'](handleError(_0x8a0611,null));};exports[_0x4d1c('0x4f')]=function(_0x5aa71e,_0x43d14e,_0x15b79d){if(_0x5aa71e[_0x4d1c('0x4e')]['id']){delete _0x5aa71e[_0x4d1c('0x4e')]['id'];}return db[_0x4d1c('0x2f')][_0x4d1c('0x4b')]({'where':{'id':_0x5aa71e[_0x4d1c('0x45')]['id']}})[_0x4d1c('0x27')](handleEntityNotFound(_0x43d14e,null))[_0x4d1c('0x27')](function(_0x2185f0){if(_0x2185f0){_0x5aa71e[_0x4d1c('0x4e')][_0x4d1c('0x50')]=_0x2185f0['id'];return db[_0x4d1c('0x51')][_0x4d1c('0x52')](_0x5aa71e[_0x4d1c('0x4e')]);}})[_0x4d1c('0x27')](respondWithResult(_0x43d14e,null))[_0x4d1c('0x43')](handleError(_0x43d14e,null));};exports[_0x4d1c('0x53')]=function(_0x555cb3,_0x35b283,_0x5bdbd0){if(_0x555cb3[_0x4d1c('0x4e')]['id']){delete _0x555cb3[_0x4d1c('0x4e')]['id'];}return db['Trigger'][_0x4d1c('0x4b')]({'where':{'id':_0x555cb3[_0x4d1c('0x45')]['id']}})['then'](handleEntityNotFound(_0x35b283,null))[_0x4d1c('0x27')](function(_0x3757c7){if(_0x3757c7){_0x555cb3['body'][_0x4d1c('0x54')]=_0x3757c7['id'];return db['Condition'][_0x4d1c('0x52')](_0x555cb3[_0x4d1c('0x4e')]);}})[_0x4d1c('0x27')](respondWithResult(_0x35b283,null))[_0x4d1c('0x43')](handleError(_0x35b283,null));};exports['getAllConditions']=function(_0x3939fc,_0x29d97a,_0x4c9d75){var _0x359368={};var _0x5914d7={};var _0x57b8d5;var _0x415216;return db['Trigger'][_0x4d1c('0x55')]({'where':{'id':_0x3939fc['params']['id']}})[_0x4d1c('0x27')](handleEntityNotFound(_0x29d97a,null))[_0x4d1c('0x27')](function(_0x50fc49){if(_0x50fc49){_0x57b8d5=_0x50fc49;_0x5914d7[_0x4d1c('0x33')]=_[_0x4d1c('0x35')](db[_0x4d1c('0x51')]['rawAttributes']);_0x5914d7[_0x4d1c('0x34')]=_['keys'](_0x3939fc[_0x4d1c('0x34')]);_0x5914d7[_0x4d1c('0x3d')]=_['intersection'](_0x5914d7['model'],_0x5914d7['query']);_0x359368[_0x4d1c('0x37')]=_[_0x4d1c('0x36')](_0x5914d7[_0x4d1c('0x33')],qs[_0x4d1c('0x46')](_0x3939fc['query']['fields']));_0x359368[_0x4d1c('0x37')]=_0x359368['attributes'][_0x4d1c('0x56')]?_0x359368['attributes']:_0x5914d7[_0x4d1c('0x33')];_0x359368[_0x4d1c('0x3a')]=qs[_0x4d1c('0x3b')](_0x3939fc[_0x4d1c('0x34')]['sort']);_0x359368[_0x4d1c('0x3c')]=qs[_0x4d1c('0x3d')](_[_0x4d1c('0x57')](_0x3939fc[_0x4d1c('0x34')],_0x5914d7[_0x4d1c('0x3d')]));if(_0x3939fc['query'][_0x4d1c('0x3e')]){_0x359368[_0x4d1c('0x3c')]=_[_0x4d1c('0x3f')](_0x359368['where'],{'$or':_['map'](_0x359368[_0x4d1c('0x37')],function(_0x5d687a){var _0x49b2b0={};_0x49b2b0[_0x5d687a]={'$like':'%'+_0x3939fc[_0x4d1c('0x34')]['filter']+'%'};return _0x49b2b0;})});}_0x359368=_[_0x4d1c('0x3f')]({},_0x359368,_0x3939fc[_0x4d1c('0x47')]);return _0x57b8d5[_0x4d1c('0x58')](_0x359368);}})[_0x4d1c('0x27')](function(_0x3e900c){if(_0x3e900c){_0x415216=_0x3e900c[_0x4d1c('0x56')];if(!_0x3939fc[_0x4d1c('0x34')]['hasOwnProperty'](_0x4d1c('0x39'))){_0x359368[_0x4d1c('0x1e')]=qs['limit'](_0x3939fc[_0x4d1c('0x34')][_0x4d1c('0x1e')]);_0x359368['offset']=qs[_0x4d1c('0x1d')](_0x3939fc[_0x4d1c('0x34')][_0x4d1c('0x1d')]);}return _0x57b8d5[_0x4d1c('0x58')](_0x359368);}})[_0x4d1c('0x27')](function(_0x5df2aa){if(_0x5df2aa){return _0x5df2aa?{'count':_0x415216,'rows':_0x5df2aa}:null;}})['then'](respondWithResult(_0x29d97a,null))[_0x4d1c('0x43')](handleError(_0x29d97a,null));};exports[_0x4d1c('0x59')]=function(_0x237b32,_0x300926,_0x61dba0){var _0x7cf4ff={};var _0x4f3d24={};var _0x2344bd;var _0x5530d2;return db['Trigger']['findOne']({'where':{'id':_0x237b32['params']['id']}})[_0x4d1c('0x27')](handleEntityNotFound(_0x300926,null))[_0x4d1c('0x27')](function(_0x3a8e3d){if(_0x3a8e3d){_0x2344bd=_0x3a8e3d;_0x4f3d24['model']=_[_0x4d1c('0x35')](db[_0x4d1c('0x51')][_0x4d1c('0x30')]);_0x4f3d24['query']=_[_0x4d1c('0x35')](_0x237b32[_0x4d1c('0x34')]);_0x4f3d24[_0x4d1c('0x3d')]=_[_0x4d1c('0x36')](_0x4f3d24[_0x4d1c('0x33')],_0x4f3d24[_0x4d1c('0x34')]);_0x7cf4ff[_0x4d1c('0x37')]=_[_0x4d1c('0x36')](_0x4f3d24['model'],qs[_0x4d1c('0x46')](_0x237b32[_0x4d1c('0x34')]['fields']));_0x7cf4ff['attributes']=_0x7cf4ff[_0x4d1c('0x37')]['length']?_0x7cf4ff[_0x4d1c('0x37')]:_0x4f3d24[_0x4d1c('0x33')];_0x7cf4ff[_0x4d1c('0x3a')]=qs[_0x4d1c('0x3b')](_0x237b32[_0x4d1c('0x34')][_0x4d1c('0x3b')]);_0x7cf4ff['where']=qs[_0x4d1c('0x3d')](_[_0x4d1c('0x57')](_0x237b32[_0x4d1c('0x34')],_0x4f3d24[_0x4d1c('0x3d')]));if(_0x237b32[_0x4d1c('0x34')]['filter']){_0x7cf4ff[_0x4d1c('0x3c')]=_[_0x4d1c('0x3f')](_0x7cf4ff[_0x4d1c('0x3c')],{'$or':_['map'](_0x7cf4ff[_0x4d1c('0x37')],function(_0x406603){var _0x5063b6={};_0x5063b6[_0x406603]={'$like':'%'+_0x237b32[_0x4d1c('0x34')][_0x4d1c('0x3e')]+'%'};return _0x5063b6;})});}_0x7cf4ff=_[_0x4d1c('0x3f')]({},_0x7cf4ff,_0x237b32[_0x4d1c('0x47')]);return _0x2344bd[_0x4d1c('0x59')](_0x7cf4ff);}})[_0x4d1c('0x27')](function(_0x1dc5dd){if(_0x1dc5dd){_0x5530d2=_0x1dc5dd[_0x4d1c('0x56')];if(!_0x237b32[_0x4d1c('0x34')][_0x4d1c('0x38')]('nolimit')){_0x7cf4ff[_0x4d1c('0x1e')]=qs[_0x4d1c('0x1e')](_0x237b32[_0x4d1c('0x34')][_0x4d1c('0x1e')]);_0x7cf4ff[_0x4d1c('0x1d')]=qs[_0x4d1c('0x1d')](_0x237b32['query'][_0x4d1c('0x1d')]);}return _0x2344bd[_0x4d1c('0x59')](_0x7cf4ff);}})[_0x4d1c('0x27')](function(_0x435908){if(_0x435908){return _0x435908?{'count':_0x5530d2,'rows':_0x435908}:null;}})[_0x4d1c('0x27')](respondWithResult(_0x300926,null))[_0x4d1c('0x43')](handleError(_0x300926,null));};exports[_0x4d1c('0x5a')]=function(_0x5877d8,_0x2444e4,_0x4ed6d6){if(_0x5877d8[_0x4d1c('0x4e')]['id']){delete _0x5877d8[_0x4d1c('0x4e')]['id'];}return db[_0x4d1c('0x2f')][_0x4d1c('0x4b')]({'where':{'id':_0x5877d8[_0x4d1c('0x45')]['id']}})[_0x4d1c('0x27')](handleEntityNotFound(_0x2444e4,null))[_0x4d1c('0x27')](function(_0x2a92cb){if(_0x2a92cb){_0x5877d8[_0x4d1c('0x4e')][_0x4d1c('0x5b')]=_0x2a92cb['id'];return db[_0x4d1c('0x5c')][_0x4d1c('0x52')](_0x5877d8[_0x4d1c('0x4e')]);}})[_0x4d1c('0x27')](respondWithResult(_0x2444e4,null))['catch'](handleError(_0x2444e4,null));};exports[_0x4d1c('0x5d')]=function(_0x2e169f,_0x3fde8c,_0x936461){var _0x4afa06={};var _0xafd5a9={};var _0x3d428d;var _0x4b3c11;return db['Trigger'][_0x4d1c('0x55')]({'where':{'id':_0x2e169f[_0x4d1c('0x45')]['id']}})[_0x4d1c('0x27')](handleEntityNotFound(_0x3fde8c,null))[_0x4d1c('0x27')](function(_0x5166a5){if(_0x5166a5){_0x3d428d=_0x5166a5;_0xafd5a9[_0x4d1c('0x33')]=_[_0x4d1c('0x35')](db[_0x4d1c('0x5c')][_0x4d1c('0x30')]);_0xafd5a9[_0x4d1c('0x34')]=_[_0x4d1c('0x35')](_0x2e169f[_0x4d1c('0x34')]);_0xafd5a9[_0x4d1c('0x3d')]=_[_0x4d1c('0x36')](_0xafd5a9[_0x4d1c('0x33')],_0xafd5a9['query']);_0x4afa06[_0x4d1c('0x37')]=_[_0x4d1c('0x36')](_0xafd5a9[_0x4d1c('0x33')],qs[_0x4d1c('0x46')](_0x2e169f[_0x4d1c('0x34')][_0x4d1c('0x46')]));_0x4afa06['attributes']=_0x4afa06[_0x4d1c('0x37')]['length']?_0x4afa06['attributes']:_0xafd5a9[_0x4d1c('0x33')];_0x4afa06[_0x4d1c('0x3a')]=qs['sort'](_0x2e169f[_0x4d1c('0x34')][_0x4d1c('0x3b')]);_0x4afa06['where']=qs[_0x4d1c('0x3d')](_[_0x4d1c('0x57')](_0x2e169f[_0x4d1c('0x34')],_0xafd5a9[_0x4d1c('0x3d')]));if(_0x2e169f[_0x4d1c('0x34')][_0x4d1c('0x3e')]){_0x4afa06[_0x4d1c('0x3c')]=_[_0x4d1c('0x3f')](_0x4afa06[_0x4d1c('0x3c')],{'$or':_['map'](_0x4afa06[_0x4d1c('0x37')],function(_0x198308){var _0x40cb86={};_0x40cb86[_0x198308]={'$like':'%'+_0x2e169f[_0x4d1c('0x34')]['filter']+'%'};return _0x40cb86;})});}_0x4afa06=_[_0x4d1c('0x3f')]({},_0x4afa06,_0x2e169f[_0x4d1c('0x47')]);return _0x3d428d['getActions'](_0x4afa06);}})[_0x4d1c('0x27')](function(_0x494a54){if(_0x494a54){_0x4b3c11=_0x494a54[_0x4d1c('0x56')];if(!_0x2e169f[_0x4d1c('0x34')]['hasOwnProperty'](_0x4d1c('0x39'))){_0x4afa06[_0x4d1c('0x1e')]=qs[_0x4d1c('0x1e')](_0x2e169f[_0x4d1c('0x34')][_0x4d1c('0x1e')]);_0x4afa06[_0x4d1c('0x1d')]=qs[_0x4d1c('0x1d')](_0x2e169f['query'][_0x4d1c('0x1d')]);}return _0x3d428d[_0x4d1c('0x5d')](_0x4afa06);}})[_0x4d1c('0x27')](function(_0x85c4ea){if(_0x85c4ea){return _0x85c4ea?{'count':_0x4b3c11,'rows':_0x85c4ea}:null;}})['then'](respondWithResult(_0x3fde8c,null))[_0x4d1c('0x43')](handleError(_0x3fde8c,null));}; \ No newline at end of file +var _0x1f81=['TriggerAnyId','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','Triggers','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','includeAll','findAll','rows','catch','show','params','keys','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition'];(function(_0x3accbf,_0x521148){var _0x5ae57f=function(_0x5e3082){while(--_0x5e3082){_0x3accbf['push'](_0x3accbf['shift']());}};_0x5ae57f(++_0x521148);}(_0x1f81,0x65));var _0x11f8=function(_0x5959c9,_0x2ed153){_0x5959c9=_0x5959c9-0x0;var _0x4ffcbc=_0x1f81[_0x5959c9];return _0x4ffcbc;};'use strict';var emlformat=require(_0x11f8('0x0'));var rimraf=require(_0x11f8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x11f8('0x2'));var rp=require(_0x11f8('0x3'));var moment=require(_0x11f8('0x4'));var BPromise=require(_0x11f8('0x5'));var Mustache=require('mustache');var util=require(_0x11f8('0x6'));var path=require(_0x11f8('0x7'));var sox=require(_0x11f8('0x8'));var csv=require(_0x11f8('0x9'));var ejs=require(_0x11f8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11f8('0xb'));var squel=require(_0x11f8('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x11f8('0xd'));var toCsv=require(_0x11f8('0x9'));var querystring=require(_0x11f8('0xe'));var Papa=require('papaparse');var Redis=require(_0x11f8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x11f8('0x10'));var as=require(_0x11f8('0x11'));var hardwareService=require(_0x11f8('0x12'));var logger=require('../../config/logger')(_0x11f8('0x13'));var utils=require(_0x11f8('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x11f8('0x15'))['db'];function respondWithStatusCode(_0x352141,_0x36b69f){_0x36b69f=_0x36b69f||0xcc;return function(_0x2c23e2){if(_0x2c23e2){return _0x352141[_0x11f8('0x16')](_0x36b69f);}return _0x352141[_0x11f8('0x17')](_0x36b69f)[_0x11f8('0x18')]();};}function respondWithResult(_0x5388ee,_0xbeb7f2){_0xbeb7f2=_0xbeb7f2||0xc8;return function(_0x266df2){if(_0x266df2){return _0x5388ee[_0x11f8('0x17')](_0xbeb7f2)[_0x11f8('0x19')](_0x266df2);}};}function respondWithFilteredResult(_0xec778,_0x2a5645){return function(_0x42f795){if(_0x42f795){var _0x3d8cc8=typeof _0x2a5645[_0x11f8('0x1a')]===_0x11f8('0x1b')&&typeof _0x2a5645[_0x11f8('0x1c')]===_0x11f8('0x1b');var _0x4fd513=_0x42f795[_0x11f8('0x1d')];var _0x375a89=_0x3d8cc8?0x0:_0x2a5645[_0x11f8('0x1a')];var _0x30273f=_0x3d8cc8?_0x42f795[_0x11f8('0x1d')]:_0x2a5645[_0x11f8('0x1a')]+_0x2a5645[_0x11f8('0x1c')];var _0x3403bf;if(_0x30273f>=_0x4fd513){_0x30273f=_0x4fd513;_0x3403bf=0xc8;}else{_0x3403bf=0xce;}_0xec778[_0x11f8('0x17')](_0x3403bf);return _0xec778['set'](_0x11f8('0x1e'),_0x375a89+'-'+_0x30273f+'/'+_0x4fd513)['json'](_0x42f795);}return null;};}function patchUpdates(_0xedd819){return function(_0x5f5596){try{jsonpatch[_0x11f8('0x1f')](_0x5f5596,_0xedd819,!![]);}catch(_0x545b97){return BPromise[_0x11f8('0x20')](_0x545b97);}return _0x5f5596[_0x11f8('0x21')]();};}function saveUpdates(_0x4d0321,_0x2be49d){return function(_0x3005cb){if(_0x3005cb){return _0x3005cb[_0x11f8('0x22')](_0x4d0321)['then'](function(_0x4ec8dd){return _0x4ec8dd;});}return null;};}function removeEntity(_0x5ed290,_0x29813f){return function(_0x4c4cbb){if(_0x4c4cbb){return _0x4c4cbb[_0x11f8('0x23')]()[_0x11f8('0x24')](function(){var _0x42f7d9=_0x4c4cbb[_0x11f8('0x25')]({'plain':!![]});var _0x428a27=_0x11f8('0x26');return db[_0x11f8('0x27')]['destroy']({'where':{'type':_0x428a27,'resourceId':_0x42f7d9['id']}})[_0x11f8('0x24')](function(){return _0x4c4cbb;});})[_0x11f8('0x24')](function(){_0x5ed290['status'](0xcc)[_0x11f8('0x18')]();});}};}function handleEntityNotFound(_0x20de1a,_0x11a560){return function(_0x399a71){if(!_0x399a71){_0x20de1a[_0x11f8('0x16')](0x194);}return _0x399a71;};}function handleError(_0x3aad90,_0x2a66b3){_0x2a66b3=_0x2a66b3||0x1f4;return function(_0x6c2be0){logger[_0x11f8('0x28')](_0x6c2be0[_0x11f8('0x29')]);if(_0x6c2be0[_0x11f8('0x2a')]){delete _0x6c2be0['name'];}_0x3aad90[_0x11f8('0x17')](_0x2a66b3)[_0x11f8('0x2b')](_0x6c2be0);};}exports[_0x11f8('0x2c')]=function(_0x44370e,_0x31b3a4){var _0x144aa2={},_0x154f97={},_0x32cb13={'count':0x0,'rows':[]};var _0x2e1a61=_[_0x11f8('0x2d')](db[_0x11f8('0x2e')][_0x11f8('0x2f')],function(_0x584af2){return{'name':_0x584af2['fieldName'],'type':_0x584af2[_0x11f8('0x30')][_0x11f8('0x31')]};});_0x154f97[_0x11f8('0x32')]=_[_0x11f8('0x2d')](_0x2e1a61,_0x11f8('0x2a'));_0x154f97['query']=_['keys'](_0x44370e[_0x11f8('0x33')]);_0x154f97[_0x11f8('0x34')]=_['intersection'](_0x154f97['model'],_0x154f97[_0x11f8('0x33')]);_0x144aa2[_0x11f8('0x35')]=_[_0x11f8('0x36')](_0x154f97[_0x11f8('0x32')],qs[_0x11f8('0x37')](_0x44370e['query'][_0x11f8('0x37')]));_0x144aa2['attributes']=_0x144aa2['attributes'][_0x11f8('0x38')]?_0x144aa2[_0x11f8('0x35')]:_0x154f97['model'];if(!_0x44370e[_0x11f8('0x33')][_0x11f8('0x39')](_0x11f8('0x3a'))){_0x144aa2[_0x11f8('0x1c')]=qs[_0x11f8('0x1c')](_0x44370e[_0x11f8('0x33')][_0x11f8('0x1c')]);_0x144aa2[_0x11f8('0x1a')]=qs['offset'](_0x44370e[_0x11f8('0x33')][_0x11f8('0x1a')]);}_0x144aa2[_0x11f8('0x3b')]=qs[_0x11f8('0x3c')](_0x44370e['query'][_0x11f8('0x3c')]);_0x144aa2['where']=qs[_0x11f8('0x34')](_[_0x11f8('0x3d')](_0x44370e[_0x11f8('0x33')],_0x154f97[_0x11f8('0x34')]),_0x2e1a61);if(_0x44370e['query']['filter']){_0x144aa2[_0x11f8('0x3e')]=_[_0x11f8('0x3f')](_0x144aa2['where'],{'$or':_['map'](_0x2e1a61,function(_0x28eab8){if(_0x28eab8[_0x11f8('0x30')]!=='VIRTUAL'){var _0x8263ff={};_0x8263ff[_0x28eab8[_0x11f8('0x2a')]]={'$like':'%'+_0x44370e[_0x11f8('0x33')][_0x11f8('0x40')]+'%'};return _0x8263ff;}})});}_0x144aa2=_['merge']({},_0x144aa2,_0x44370e['options']);var _0x425e04={'where':_0x144aa2[_0x11f8('0x3e')]};return db['Trigger'][_0x11f8('0x1d')](_0x425e04)[_0x11f8('0x24')](function(_0x5a201d){_0x32cb13['count']=_0x5a201d;if(_0x44370e[_0x11f8('0x33')][_0x11f8('0x41')]){_0x144aa2['include']=[{'all':!![]}];}return db['Trigger'][_0x11f8('0x42')](_0x144aa2);})[_0x11f8('0x24')](function(_0x1fe706){_0x32cb13[_0x11f8('0x43')]=_0x1fe706;return _0x32cb13;})[_0x11f8('0x24')](respondWithFilteredResult(_0x31b3a4,_0x144aa2))[_0x11f8('0x44')](handleError(_0x31b3a4,null));};exports[_0x11f8('0x45')]=function(_0x2924be,_0x2939c1){var _0x46914f={'raw':![],'where':{'id':_0x2924be[_0x11f8('0x46')]['id']}},_0x332522={};_0x332522['model']=_[_0x11f8('0x47')](db[_0x11f8('0x2e')][_0x11f8('0x2f')]);_0x332522['query']=_[_0x11f8('0x47')](_0x2924be[_0x11f8('0x33')]);_0x332522[_0x11f8('0x34')]=_[_0x11f8('0x36')](_0x332522[_0x11f8('0x32')],_0x332522[_0x11f8('0x33')]);_0x46914f['attributes']=_[_0x11f8('0x36')](_0x332522[_0x11f8('0x32')],qs[_0x11f8('0x37')](_0x2924be[_0x11f8('0x33')]['fields']));_0x46914f[_0x11f8('0x35')]=_0x46914f[_0x11f8('0x35')]['length']?_0x46914f['attributes']:_0x332522[_0x11f8('0x32')];if(_0x2924be[_0x11f8('0x33')][_0x11f8('0x41')]){_0x46914f[_0x11f8('0x48')]=[{'all':!![]}];}_0x46914f=_[_0x11f8('0x3f')]({},_0x46914f,_0x2924be[_0x11f8('0x49')]);return db['Trigger'][_0x11f8('0x4a')](_0x46914f)[_0x11f8('0x24')](handleEntityNotFound(_0x2939c1,null))[_0x11f8('0x24')](respondWithResult(_0x2939c1,null))[_0x11f8('0x44')](handleError(_0x2939c1,null));};exports[_0x11f8('0x4b')]=function(_0x4e18b5,_0x77603e){return db[_0x11f8('0x2e')][_0x11f8('0x4b')](_0x4e18b5[_0x11f8('0x4c')],{})['then'](function(_0x657541){var _0x140add=_0x4e18b5['user'][_0x11f8('0x25')]({'plain':!![]});if(!_0x140add)throw new Error(_0x11f8('0x4d'));if(_0x140add['role']===_0x11f8('0x4e')){var _0x16a0a7=_0x657541[_0x11f8('0x25')]({'plain':!![]});var _0xeb10d1=_0x11f8('0x26');return db['UserProfileSection'][_0x11f8('0x4a')]({'where':{'name':_0xeb10d1,'userProfileId':_0x140add[_0x11f8('0x4f')]},'raw':!![]})[_0x11f8('0x24')](function(_0xc47a12){if(_0xc47a12&&_0xc47a12[_0x11f8('0x50')]===0x0){return db['UserProfileResource'][_0x11f8('0x4b')]({'name':_0x16a0a7['name'],'resourceId':_0x16a0a7['id'],'type':_0xc47a12[_0x11f8('0x2a')],'sectionId':_0xc47a12['id']},{})[_0x11f8('0x24')](function(){return _0x657541;});}else{return _0x657541;}})['catch'](function(_0x265afa){logger[_0x11f8('0x28')](_0x11f8('0x51'),_0x265afa);throw _0x265afa;});}return _0x657541;})[_0x11f8('0x24')](respondWithResult(_0x77603e,0xc9))[_0x11f8('0x44')](handleError(_0x77603e,null));};exports[_0x11f8('0x22')]=function(_0x14aad1,_0x5a3887){if(_0x14aad1[_0x11f8('0x4c')]['id']){delete _0x14aad1[_0x11f8('0x4c')]['id'];}return db[_0x11f8('0x2e')][_0x11f8('0x4a')]({'where':{'id':_0x14aad1[_0x11f8('0x46')]['id']}})[_0x11f8('0x24')](handleEntityNotFound(_0x5a3887,null))[_0x11f8('0x24')](saveUpdates(_0x14aad1[_0x11f8('0x4c')],null))['then'](respondWithResult(_0x5a3887,null))[_0x11f8('0x44')](handleError(_0x5a3887,null));};exports[_0x11f8('0x23')]=function(_0x4320ae,_0xe6c409){return db['Trigger']['find']({'where':{'id':_0x4320ae[_0x11f8('0x46')]['id']}})[_0x11f8('0x24')](handleEntityNotFound(_0xe6c409,null))[_0x11f8('0x24')](removeEntity(_0xe6c409,null))[_0x11f8('0x44')](handleError(_0xe6c409,null));};exports[_0x11f8('0x52')]=function(_0xc4a09d,_0x10e70b,_0x4c0286){if(_0xc4a09d[_0x11f8('0x4c')]['id']){delete _0xc4a09d[_0x11f8('0x4c')]['id'];}return db[_0x11f8('0x2e')]['find']({'where':{'id':_0xc4a09d[_0x11f8('0x46')]['id']}})[_0x11f8('0x24')](handleEntityNotFound(_0x10e70b,null))[_0x11f8('0x24')](function(_0x51da74){if(_0x51da74){_0xc4a09d[_0x11f8('0x4c')][_0x11f8('0x53')]=_0x51da74['id'];return db[_0x11f8('0x54')][_0x11f8('0x4b')](_0xc4a09d[_0x11f8('0x4c')]);}})[_0x11f8('0x24')](respondWithResult(_0x10e70b,null))[_0x11f8('0x44')](handleError(_0x10e70b,null));};exports['addAnyCondition']=function(_0x4811c5,_0x59bc29,_0x508a63){if(_0x4811c5[_0x11f8('0x4c')]['id']){delete _0x4811c5[_0x11f8('0x4c')]['id'];}return db[_0x11f8('0x2e')][_0x11f8('0x4a')]({'where':{'id':_0x4811c5['params']['id']}})['then'](handleEntityNotFound(_0x59bc29,null))[_0x11f8('0x24')](function(_0x50ba0c){if(_0x50ba0c){_0x4811c5[_0x11f8('0x4c')][_0x11f8('0x55')]=_0x50ba0c['id'];return db[_0x11f8('0x54')][_0x11f8('0x4b')](_0x4811c5[_0x11f8('0x4c')]);}})[_0x11f8('0x24')](respondWithResult(_0x59bc29,null))['catch'](handleError(_0x59bc29,null));};exports[_0x11f8('0x56')]=function(_0x52ce8d,_0x47689c,_0x16d9a1){var _0x2960c0={};var _0x304892={};var _0x2e0192;var _0x596ea3;return db[_0x11f8('0x2e')]['findOne']({'where':{'id':_0x52ce8d[_0x11f8('0x46')]['id']}})[_0x11f8('0x24')](handleEntityNotFound(_0x47689c,null))[_0x11f8('0x24')](function(_0x2f1ca7){if(_0x2f1ca7){_0x2e0192=_0x2f1ca7;_0x304892[_0x11f8('0x32')]=_[_0x11f8('0x47')](db[_0x11f8('0x54')][_0x11f8('0x2f')]);_0x304892[_0x11f8('0x33')]=_[_0x11f8('0x47')](_0x52ce8d['query']);_0x304892[_0x11f8('0x34')]=_[_0x11f8('0x36')](_0x304892[_0x11f8('0x32')],_0x304892[_0x11f8('0x33')]);_0x2960c0[_0x11f8('0x35')]=_['intersection'](_0x304892[_0x11f8('0x32')],qs['fields'](_0x52ce8d[_0x11f8('0x33')][_0x11f8('0x37')]));_0x2960c0[_0x11f8('0x35')]=_0x2960c0[_0x11f8('0x35')][_0x11f8('0x38')]?_0x2960c0['attributes']:_0x304892[_0x11f8('0x32')];_0x2960c0['order']=qs['sort'](_0x52ce8d[_0x11f8('0x33')][_0x11f8('0x3c')]);_0x2960c0['where']=qs[_0x11f8('0x34')](_[_0x11f8('0x3d')](_0x52ce8d['query'],_0x304892[_0x11f8('0x34')]));if(_0x52ce8d[_0x11f8('0x33')][_0x11f8('0x40')]){_0x2960c0[_0x11f8('0x3e')]=_['merge'](_0x2960c0[_0x11f8('0x3e')],{'$or':_[_0x11f8('0x2d')](_0x2960c0[_0x11f8('0x35')],function(_0x38c55e){var _0x385ddc={};_0x385ddc[_0x38c55e]={'$like':'%'+_0x52ce8d['query'][_0x11f8('0x40')]+'%'};return _0x385ddc;})});}_0x2960c0=_[_0x11f8('0x3f')]({},_0x2960c0,_0x52ce8d[_0x11f8('0x49')]);return _0x2e0192[_0x11f8('0x56')](_0x2960c0);}})['then'](function(_0x13c0ca){if(_0x13c0ca){_0x596ea3=_0x13c0ca[_0x11f8('0x38')];if(!_0x52ce8d['query'][_0x11f8('0x39')](_0x11f8('0x3a'))){_0x2960c0[_0x11f8('0x1c')]=qs[_0x11f8('0x1c')](_0x52ce8d[_0x11f8('0x33')][_0x11f8('0x1c')]);_0x2960c0[_0x11f8('0x1a')]=qs[_0x11f8('0x1a')](_0x52ce8d[_0x11f8('0x33')][_0x11f8('0x1a')]);}return _0x2e0192[_0x11f8('0x56')](_0x2960c0);}})[_0x11f8('0x24')](function(_0x1039dd){if(_0x1039dd){return _0x1039dd?{'count':_0x596ea3,'rows':_0x1039dd}:null;}})[_0x11f8('0x24')](respondWithResult(_0x47689c,null))['catch'](handleError(_0x47689c,null));};exports['getAnyConditions']=function(_0x19b950,_0x569b67,_0x4ebdea){var _0x38738f={};var _0x5ad753={};var _0x1e6725;var _0x5ab5cc;return db[_0x11f8('0x2e')]['findOne']({'where':{'id':_0x19b950[_0x11f8('0x46')]['id']}})['then'](handleEntityNotFound(_0x569b67,null))[_0x11f8('0x24')](function(_0x33c43e){if(_0x33c43e){_0x1e6725=_0x33c43e;_0x5ad753[_0x11f8('0x32')]=_['keys'](db[_0x11f8('0x54')][_0x11f8('0x2f')]);_0x5ad753[_0x11f8('0x33')]=_[_0x11f8('0x47')](_0x19b950['query']);_0x5ad753[_0x11f8('0x34')]=_['intersection'](_0x5ad753['model'],_0x5ad753[_0x11f8('0x33')]);_0x38738f[_0x11f8('0x35')]=_['intersection'](_0x5ad753[_0x11f8('0x32')],qs[_0x11f8('0x37')](_0x19b950[_0x11f8('0x33')]['fields']));_0x38738f[_0x11f8('0x35')]=_0x38738f['attributes'][_0x11f8('0x38')]?_0x38738f['attributes']:_0x5ad753[_0x11f8('0x32')];_0x38738f[_0x11f8('0x3b')]=qs['sort'](_0x19b950[_0x11f8('0x33')][_0x11f8('0x3c')]);_0x38738f[_0x11f8('0x3e')]=qs[_0x11f8('0x34')](_[_0x11f8('0x3d')](_0x19b950['query'],_0x5ad753[_0x11f8('0x34')]));if(_0x19b950[_0x11f8('0x33')][_0x11f8('0x40')]){_0x38738f[_0x11f8('0x3e')]=_[_0x11f8('0x3f')](_0x38738f[_0x11f8('0x3e')],{'$or':_[_0x11f8('0x2d')](_0x38738f[_0x11f8('0x35')],function(_0x5f7d6){var _0x21940e={};_0x21940e[_0x5f7d6]={'$like':'%'+_0x19b950[_0x11f8('0x33')][_0x11f8('0x40')]+'%'};return _0x21940e;})});}_0x38738f=_[_0x11f8('0x3f')]({},_0x38738f,_0x19b950[_0x11f8('0x49')]);return _0x1e6725['getAnyConditions'](_0x38738f);}})[_0x11f8('0x24')](function(_0x968aaf){if(_0x968aaf){_0x5ab5cc=_0x968aaf[_0x11f8('0x38')];if(!_0x19b950[_0x11f8('0x33')]['hasOwnProperty'](_0x11f8('0x3a'))){_0x38738f[_0x11f8('0x1c')]=qs[_0x11f8('0x1c')](_0x19b950[_0x11f8('0x33')][_0x11f8('0x1c')]);_0x38738f[_0x11f8('0x1a')]=qs[_0x11f8('0x1a')](_0x19b950[_0x11f8('0x33')]['offset']);}return _0x1e6725[_0x11f8('0x57')](_0x38738f);}})[_0x11f8('0x24')](function(_0x5bb910){if(_0x5bb910){return _0x5bb910?{'count':_0x5ab5cc,'rows':_0x5bb910}:null;}})['then'](respondWithResult(_0x569b67,null))['catch'](handleError(_0x569b67,null));};exports[_0x11f8('0x58')]=function(_0x3cc321,_0xb4c7c5,_0x327512){if(_0x3cc321[_0x11f8('0x4c')]['id']){delete _0x3cc321[_0x11f8('0x4c')]['id'];}return db['Trigger'][_0x11f8('0x4a')]({'where':{'id':_0x3cc321[_0x11f8('0x46')]['id']}})[_0x11f8('0x24')](handleEntityNotFound(_0xb4c7c5,null))['then'](function(_0x12486d){if(_0x12486d){_0x3cc321[_0x11f8('0x4c')][_0x11f8('0x59')]=_0x12486d['id'];return db[_0x11f8('0x5a')][_0x11f8('0x4b')](_0x3cc321[_0x11f8('0x4c')]);}})[_0x11f8('0x24')](respondWithResult(_0xb4c7c5,null))[_0x11f8('0x44')](handleError(_0xb4c7c5,null));};exports[_0x11f8('0x5b')]=function(_0xc992d7,_0x2adc44,_0x1d3ea7){var _0xce91d8={};var _0x1769db={};var _0x5f05f0;var _0xa6417c;return db[_0x11f8('0x2e')][_0x11f8('0x5c')]({'where':{'id':_0xc992d7[_0x11f8('0x46')]['id']}})[_0x11f8('0x24')](handleEntityNotFound(_0x2adc44,null))['then'](function(_0x312e17){if(_0x312e17){_0x5f05f0=_0x312e17;_0x1769db['model']=_['keys'](db[_0x11f8('0x5a')]['rawAttributes']);_0x1769db[_0x11f8('0x33')]=_['keys'](_0xc992d7['query']);_0x1769db[_0x11f8('0x34')]=_[_0x11f8('0x36')](_0x1769db[_0x11f8('0x32')],_0x1769db[_0x11f8('0x33')]);_0xce91d8[_0x11f8('0x35')]=_[_0x11f8('0x36')](_0x1769db[_0x11f8('0x32')],qs[_0x11f8('0x37')](_0xc992d7[_0x11f8('0x33')]['fields']));_0xce91d8['attributes']=_0xce91d8[_0x11f8('0x35')]['length']?_0xce91d8[_0x11f8('0x35')]:_0x1769db[_0x11f8('0x32')];_0xce91d8[_0x11f8('0x3b')]=qs[_0x11f8('0x3c')](_0xc992d7[_0x11f8('0x33')][_0x11f8('0x3c')]);_0xce91d8[_0x11f8('0x3e')]=qs[_0x11f8('0x34')](_[_0x11f8('0x3d')](_0xc992d7[_0x11f8('0x33')],_0x1769db['filters']));if(_0xc992d7[_0x11f8('0x33')][_0x11f8('0x40')]){_0xce91d8[_0x11f8('0x3e')]=_[_0x11f8('0x3f')](_0xce91d8[_0x11f8('0x3e')],{'$or':_['map'](_0xce91d8[_0x11f8('0x35')],function(_0x593288){var _0x25beef={};_0x25beef[_0x593288]={'$like':'%'+_0xc992d7[_0x11f8('0x33')][_0x11f8('0x40')]+'%'};return _0x25beef;})});}_0xce91d8=_['merge']({},_0xce91d8,_0xc992d7[_0x11f8('0x49')]);return _0x5f05f0[_0x11f8('0x5b')](_0xce91d8);}})['then'](function(_0x447680){if(_0x447680){_0xa6417c=_0x447680[_0x11f8('0x38')];if(!_0xc992d7[_0x11f8('0x33')][_0x11f8('0x39')](_0x11f8('0x3a'))){_0xce91d8[_0x11f8('0x1c')]=qs['limit'](_0xc992d7['query'][_0x11f8('0x1c')]);_0xce91d8[_0x11f8('0x1a')]=qs[_0x11f8('0x1a')](_0xc992d7['query']['offset']);}return _0x5f05f0['getActions'](_0xce91d8);}})[_0x11f8('0x24')](function(_0x4f3e34){if(_0x4f3e34){return _0x4f3e34?{'count':_0xa6417c,'rows':_0x4f3e34}:null;}})['then'](respondWithResult(_0x2adc44,null))['catch'](handleError(_0x2adc44,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 42bb627..0e4eddb 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 _0x1323=['Trigger','tools_triggers','lodash','util','../../config/logger','api','request-promise','path','rimraf','./trigger.attributes','exports','define'];(function(_0xb42569,_0x50cb19){var _0x1326d6=function(_0x484c33){while(--_0x484c33){_0xb42569['push'](_0xb42569['shift']());}};_0x1326d6(++_0x50cb19);}(_0x1323,0x146));var _0x3132=function(_0x570a5c,_0x3a0a93){_0x570a5c=_0x570a5c-0x0;var _0x1cb670=_0x1323[_0x570a5c];return _0x1cb670;};'use strict';var _=require(_0x3132('0x0'));var util=require(_0x3132('0x1'));var logger=require(_0x3132('0x2'))(_0x3132('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3132('0x4'));var fs=require('fs');var path=require(_0x3132('0x5'));var rimraf=require(_0x3132('0x6'));var config=require('../../config/environment');var attributes=require(_0x3132('0x7'));module[_0x3132('0x8')]=function(_0x2186fe,_0x795d2){return _0x2186fe[_0x3132('0x9')](_0x3132('0xa'),attributes,{'tableName':_0x3132('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1405=['./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1e09ef,_0x17e23f){var _0x2d1254=function(_0x5935f1){while(--_0x5935f1){_0x1e09ef['push'](_0x1e09ef['shift']());}};_0x2d1254(++_0x17e23f);}(_0x1405,0x1ef));var _0x5140=function(_0x182f46,_0x87fef4){_0x182f46=_0x182f46-0x0;var _0xe95cf4=_0x1405[_0x182f46];return _0xe95cf4;};'use strict';var _=require(_0x5140('0x0'));var util=require(_0x5140('0x1'));var logger=require(_0x5140('0x2'))(_0x5140('0x3'));var moment=require(_0x5140('0x4'));var BPromise=require('bluebird');var rp=require(_0x5140('0x5'));var fs=require('fs');var path=require(_0x5140('0x6'));var rimraf=require(_0x5140('0x7'));var config=require(_0x5140('0x8'));var attributes=require(_0x5140('0x9'));module[_0x5140('0xa')]=function(_0xbbf607,_0x1c6467){return _0xbbf607[_0x5140('0xb')](_0x5140('0xc'),attributes,{'tableName':_0x5140('0xd'),'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 251f2e1..3b08399 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 _0xcf66=['raw','where','attributes','limit','include','map','model','info','ShowTrigger','find','debug','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','options'];(function(_0x10eb01,_0x4bd577){var _0x58fd76=function(_0x1ebc2c){while(--_0x1ebc2c){_0x10eb01['push'](_0x10eb01['shift']());}};_0x58fd76(++_0x4bd577);}(_0xcf66,0x71));var _0x6cf6=function(_0x252890,_0x372852){_0x252890=_0x252890-0x0;var _0x19376b=_0xcf66[_0x252890];return _0x19376b;};'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']('Trigger,\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')]('Trigger,\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);});});}exports[_0x6cf6('0x14')]=function(_0x2ca2b1){var _0x5e8b11=this;return new Promise(function(_0x11d994,_0x22915c){return db[_0x6cf6('0x15')]['findAll']({'raw':_0x2ca2b1[_0x6cf6('0x16')]?_0x2ca2b1[_0x6cf6('0x16')][_0x6cf6('0x17')]===undefined?!![]:![]:!![],'where':_0x2ca2b1[_0x6cf6('0x16')]?_0x2ca2b1[_0x6cf6('0x16')][_0x6cf6('0x18')]||null:null,'attributes':_0x2ca2b1[_0x6cf6('0x16')]?_0x2ca2b1['options'][_0x6cf6('0x19')]||null:null,'limit':_0x2ca2b1[_0x6cf6('0x16')]?_0x2ca2b1[_0x6cf6('0x16')][_0x6cf6('0x1a')]||null:null,'include':_0x2ca2b1[_0x6cf6('0x16')]?_0x2ca2b1[_0x6cf6('0x16')][_0x6cf6('0x1b')]?_[_0x6cf6('0x1c')](_0x2ca2b1['options']['include'],function(_0x276225){return{'model':db[_0x276225['model']],'as':_0x276225['as'],'attributes':_0x276225[_0x6cf6('0x19')],'include':_0x276225[_0x6cf6('0x1b')]?_[_0x6cf6('0x1c')](_0x276225[_0x6cf6('0x1b')],function(_0x3f9871){return{'model':db[_0x3f9871[_0x6cf6('0x1d')]],'as':_0x3f9871['as'],'attributes':_0x3f9871[_0x6cf6('0x19')],'include':_0x3f9871['include']?_[_0x6cf6('0x1c')](_0x3f9871[_0x6cf6('0x1b')],function(_0x3eaa31){return{'model':db[_0x3eaa31['model']],'as':_0x3eaa31['as'],'attributes':_0x3eaa31[_0x6cf6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6cf6('0xb')](function(_0x2224db){logger[_0x6cf6('0x1e')]('GetTrigger',_0x2ca2b1);logger['debug'](_0x6cf6('0x14'),_0x2ca2b1,JSON[_0x6cf6('0xe')](_0x2224db));_0x11d994(_0x2224db);})[_0x6cf6('0x13')](function(_0x5869e9){logger['error'](_0x6cf6('0x14'),_0x5869e9['message'],_0x2ca2b1);_0x22915c(_0x5e8b11['error'](0x1f4,_0x5869e9['message']));});});};exports[_0x6cf6('0x1f')]=function(_0x65433){var _0x33d308=this;return new Promise(function(_0x42f488,_0x11c848){return db['Trigger'][_0x6cf6('0x20')]({'raw':_0x65433[_0x6cf6('0x16')]?_0x65433[_0x6cf6('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x65433[_0x6cf6('0x16')]?_0x65433[_0x6cf6('0x16')][_0x6cf6('0x18')]||null:null,'attributes':_0x65433[_0x6cf6('0x16')]?_0x65433[_0x6cf6('0x16')][_0x6cf6('0x19')]||null:null,'include':_0x65433[_0x6cf6('0x16')]?_0x65433[_0x6cf6('0x16')][_0x6cf6('0x1b')]?_[_0x6cf6('0x1c')](_0x65433[_0x6cf6('0x16')][_0x6cf6('0x1b')],function(_0x4620b6){return{'model':db[_0x4620b6[_0x6cf6('0x1d')]],'as':_0x4620b6['as'],'attributes':_0x4620b6[_0x6cf6('0x19')],'include':_0x4620b6[_0x6cf6('0x1b')]?_[_0x6cf6('0x1c')](_0x4620b6[_0x6cf6('0x1b')],function(_0x5cc6cd){return{'model':db[_0x5cc6cd[_0x6cf6('0x1d')]],'as':_0x5cc6cd['as'],'attributes':_0x5cc6cd[_0x6cf6('0x19')],'include':_0x5cc6cd[_0x6cf6('0x1b')]?_[_0x6cf6('0x1c')](_0x5cc6cd[_0x6cf6('0x1b')],function(_0x2cf3a3){return{'model':db[_0x2cf3a3[_0x6cf6('0x1d')]],'as':_0x2cf3a3['as'],'attributes':_0x2cf3a3[_0x6cf6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6cf6('0xb')](function(_0x3718a1){logger[_0x6cf6('0x1e')]('ShowTrigger',_0x65433);logger[_0x6cf6('0x21')](_0x6cf6('0x1f'),_0x65433,JSON[_0x6cf6('0xe')](_0x3718a1));_0x42f488(_0x3718a1);})[_0x6cf6('0x13')](function(_0x31c822){logger[_0x6cf6('0xf')](_0x6cf6('0x1f'),_0x31c822[_0x6cf6('0x11')],_0x65433);_0x11c848(_0x33d308[_0x6cf6('0xf')](0x1f4,_0x31c822['message']));});});}; \ No newline at end of file +var _0x5423=['options','raw','where','limit','include','attributes','map','model','then','ShowTrigger','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll'];(function(_0x438625,_0x2238ef){var _0x2c1ab2=function(_0x40b819){while(--_0x40b819){_0x438625['push'](_0x438625['shift']());}};_0x2c1ab2(++_0x2238ef);}(_0x5423,0xe3));var _0x3542=function(_0x48b9bf,_0x4fdbda){_0x48b9bf=_0x48b9bf-0x0;var _0xa2fe0d=_0x5423[_0x48b9bf];return _0xa2fe0d;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var moment=require('moment');var BPromise=require(_0x3542('0x2'));var rs=require(_0x3542('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3542('0x4'))['db'];var utils=require(_0x3542('0x5'));var logger=require(_0x3542('0x6'))(_0x3542('0x7'));var config=require('../../config/environment');var jayson=require(_0x3542('0x8'));var client=jayson[_0x3542('0x9')][_0x3542('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29c3fa,_0x2e1a62,_0x55413c){return new BPromise(function(_0x4cdc86,_0xbc51ab){return client[_0x3542('0xb')](_0x29c3fa,_0x55413c)['then'](function(_0x681195){logger[_0x3542('0xc')]('Trigger,\x20%s,\x20%s',_0x2e1a62,_0x3542('0xd'));logger[_0x3542('0xe')]('Trigger,\x20%s,\x20%s,\x20%s',_0x2e1a62,_0x3542('0xd'),JSON[_0x3542('0xf')](_0x681195));if(_0x681195[_0x3542('0x10')]){if(_0x681195[_0x3542('0x10')][_0x3542('0x11')]===0x1f4){logger[_0x3542('0x10')](_0x3542('0x12'),_0x2e1a62,_0x681195[_0x3542('0x10')][_0x3542('0x13')]);return _0xbc51ab(_0x681195[_0x3542('0x10')][_0x3542('0x13')]);}logger[_0x3542('0x10')](_0x3542('0x12'),_0x2e1a62,_0x681195['error'][_0x3542('0x13')]);return _0x4cdc86(_0x681195['error'][_0x3542('0x13')]);}else{logger[_0x3542('0xc')](_0x3542('0x12'),_0x2e1a62,'request\x20sent');_0x4cdc86(_0x681195[_0x3542('0x14')][_0x3542('0x13')]);}})[_0x3542('0x15')](function(_0x5726af){logger[_0x3542('0x10')](_0x3542('0x12'),_0x2e1a62,_0x5726af);_0xbc51ab(_0x5726af);});});}exports[_0x3542('0x16')]=function(_0x3d5199){var _0x493d95=this;return new Promise(function(_0x32df3f,_0x53d4aa){return db[_0x3542('0x17')][_0x3542('0x18')]({'raw':_0x3d5199['options']?_0x3d5199[_0x3542('0x19')][_0x3542('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d5199[_0x3542('0x19')]?_0x3d5199[_0x3542('0x19')][_0x3542('0x1b')]||null:null,'attributes':_0x3d5199['options']?_0x3d5199['options']['attributes']||null:null,'limit':_0x3d5199[_0x3542('0x19')]?_0x3d5199['options'][_0x3542('0x1c')]||null:null,'include':_0x3d5199['options']?_0x3d5199[_0x3542('0x19')]['include']?_['map'](_0x3d5199[_0x3542('0x19')][_0x3542('0x1d')],function(_0x5ae097){return{'model':db[_0x5ae097['model']],'as':_0x5ae097['as'],'attributes':_0x5ae097[_0x3542('0x1e')],'include':_0x5ae097['include']?_[_0x3542('0x1f')](_0x5ae097[_0x3542('0x1d')],function(_0x1e0723){return{'model':db[_0x1e0723[_0x3542('0x20')]],'as':_0x1e0723['as'],'attributes':_0x1e0723[_0x3542('0x1e')],'include':_0x1e0723[_0x3542('0x1d')]?_[_0x3542('0x1f')](_0x1e0723[_0x3542('0x1d')],function(_0x18dc6c){return{'model':db[_0x18dc6c[_0x3542('0x20')]],'as':_0x18dc6c['as'],'attributes':_0x18dc6c[_0x3542('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3542('0x21')](function(_0x220021){logger[_0x3542('0xc')](_0x3542('0x16'),_0x3d5199);logger[_0x3542('0xe')](_0x3542('0x16'),_0x3d5199,JSON[_0x3542('0xf')](_0x220021));_0x32df3f(_0x220021);})[_0x3542('0x15')](function(_0x5590a2){logger[_0x3542('0x10')](_0x3542('0x16'),_0x5590a2[_0x3542('0x13')],_0x3d5199);_0x53d4aa(_0x493d95['error'](0x1f4,_0x5590a2[_0x3542('0x13')]));});});};exports[_0x3542('0x22')]=function(_0x2e883a){var _0x30b5e8=this;return new Promise(function(_0x5c882f,_0x5a274b){return db[_0x3542('0x17')][_0x3542('0x23')]({'raw':_0x2e883a[_0x3542('0x19')]?_0x2e883a[_0x3542('0x19')][_0x3542('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e883a[_0x3542('0x19')]?_0x2e883a[_0x3542('0x19')]['where']||null:null,'attributes':_0x2e883a['options']?_0x2e883a[_0x3542('0x19')]['attributes']||null:null,'include':_0x2e883a['options']?_0x2e883a[_0x3542('0x19')]['include']?_['map'](_0x2e883a[_0x3542('0x19')][_0x3542('0x1d')],function(_0x1bf178){return{'model':db[_0x1bf178['model']],'as':_0x1bf178['as'],'attributes':_0x1bf178[_0x3542('0x1e')],'include':_0x1bf178['include']?_[_0x3542('0x1f')](_0x1bf178[_0x3542('0x1d')],function(_0x561fd0){return{'model':db[_0x561fd0[_0x3542('0x20')]],'as':_0x561fd0['as'],'attributes':_0x561fd0['attributes'],'include':_0x561fd0[_0x3542('0x1d')]?_[_0x3542('0x1f')](_0x561fd0[_0x3542('0x1d')],function(_0x4cfb8f){return{'model':db[_0x4cfb8f[_0x3542('0x20')]],'as':_0x4cfb8f['as'],'attributes':_0x4cfb8f['attributes']};}):[]};}):[]};}):[]:[]})[_0x3542('0x21')](function(_0x1fe5c6){logger[_0x3542('0xc')](_0x3542('0x22'),_0x2e883a);logger[_0x3542('0xe')](_0x3542('0x22'),_0x2e883a,JSON[_0x3542('0xf')](_0x1fe5c6));_0x5c882f(_0x1fe5c6);})[_0x3542('0x15')](function(_0x110aa8){logger[_0x3542('0x10')](_0x3542('0x22'),_0x110aa8[_0x3542('0x13')],_0x2e883a);_0x5a274b(_0x30b5e8[_0x3542('0x10')](0x1f4,_0x110aa8['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 8072b56..fa874de 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 _0x8dce=['isAuthenticated','index','/:id','post','clone','create','put','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get'];(function(_0x1c1f3e,_0x665593){var _0x325903=function(_0x198216){while(--_0x198216){_0x1c1f3e['push'](_0x1c1f3e['shift']());}};_0x325903(++_0x665593);}(_0x8dce,0x1d0));var _0xe8dc=function(_0x575d62,_0x47881c){_0x575d62=_0x575d62-0x0;var _0x448cac=_0x8dce[_0x575d62];return _0x448cac;};'use strict';var multer=require(_0xe8dc('0x0'));var util=require(_0xe8dc('0x1'));var path=require(_0xe8dc('0x2'));var timeout=require('connect-timeout');var express=require(_0xe8dc('0x3'));var router=express[_0xe8dc('0x4')]();var fs_extra=require(_0xe8dc('0x5'));var auth=require(_0xe8dc('0x6'));var interaction=require(_0xe8dc('0x7'));var config=require(_0xe8dc('0x8'));var controller=require(_0xe8dc('0x9'));router[_0xe8dc('0xa')]('/',auth[_0xe8dc('0xb')](),controller[_0xe8dc('0xc')]);router[_0xe8dc('0xa')](_0xe8dc('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe8dc('0xe')]('/:id/clone',auth[_0xe8dc('0xb')](),controller[_0xe8dc('0xf')]);router[_0xe8dc('0xe')]('/',auth[_0xe8dc('0xb')](),controller[_0xe8dc('0x10')]);router[_0xe8dc('0x11')](_0xe8dc('0xd'),auth[_0xe8dc('0xb')](),controller['update']);router['delete']('/:id',auth[_0xe8dc('0xb')](),controller[_0xe8dc('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7393=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','post','clone','create','put','update','/:id','destroy'];(function(_0x59ae66,_0xd77e84){var _0x27202e=function(_0x5908bf){while(--_0x5908bf){_0x59ae66['push'](_0x59ae66['shift']());}};_0x27202e(++_0xd77e84);}(_0x7393,0x1dc));var _0x3739=function(_0x4ba9bc,_0x20ac9a){_0x4ba9bc=_0x4ba9bc-0x0;var _0xee218a=_0x7393[_0x4ba9bc];return _0xee218a;};'use strict';var multer=require(_0x3739('0x0'));var util=require(_0x3739('0x1'));var path=require(_0x3739('0x2'));var timeout=require(_0x3739('0x3'));var express=require(_0x3739('0x4'));var router=express['Router']();var fs_extra=require(_0x3739('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3739('0x6'));var config=require('../../config/environment');var controller=require(_0x3739('0x7'));router[_0x3739('0x8')]('/',auth[_0x3739('0x9')](),controller[_0x3739('0xa')]);router[_0x3739('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3739('0xb')]('/:id/clone',auth[_0x3739('0x9')](),controller[_0x3739('0xc')]);router[_0x3739('0xb')]('/',auth[_0x3739('0x9')](),controller[_0x3739('0xd')]);router[_0x3739('0xe')]('/:id',auth[_0x3739('0x9')](),controller[_0x3739('0xf')]);router['delete'](_0x3739('0x10'),auth[_0x3739('0x9')](),controller[_0x3739('0x11')]);module[_0x3739('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 2c2c3fc..1a3d677 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 _0x9f19=['port,invite','insecure','never','INTEGER','always','accept','refuse','originate','uas','pai','fingerprint','certificate','passive','update,nonat','STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f19,0xa1));var _0x99f1=function(_0x248ba3,_0x1d17bb){_0x248ba3=_0x248ba3-0x0;var _0x3627ae=_0x9f19[_0x248ba3];return _0x3627ae;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x99f1('0x0')],'allowNull':![],'unique':_0x99f1('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x99f1('0x2')](_0x99f1('0x3'),'user',_0x99f1('0x4')),'allowNull':![],'defaultValue':_0x99f1('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x99f1('0x5')},'callingpres':{'type':Sequelize[_0x99f1('0x2')](_0x99f1('0x6'),_0x99f1('0x7'),_0x99f1('0x8'),_0x99f1('0x9'),_0x99f1('0xa'),'PROHIB_PASSED_SCREEN',_0x99f1('0xb'),_0x99f1('0xc'))},'deny':{'type':Sequelize[_0x99f1('0x0')]},'permit':{'type':Sequelize[_0x99f1('0x0')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x99f1('0x0')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x99f1('0x0')],'defaultValue':_0x99f1('0xd'),'set':function(_0x4ab4fd){this[_0x99f1('0xe')](_0x99f1('0xf'),_0x4ab4fd?_0x4ab4fd[_0x99f1('0x10')](','):null);},'get':function(){return this[_0x99f1('0x11')](_0x99f1('0xf'))?this[_0x99f1('0x11')](_0x99f1('0xf'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x99f1('0x12'),_0x99f1('0x13'),_0x99f1('0x14'),_0x99f1('0x15'),_0x99f1('0x16')),'defaultValue':_0x99f1('0x12')},'directmedia':{'type':Sequelize[_0x99f1('0x2')](_0x99f1('0x17'),'no',_0x99f1('0x18'),_0x99f1('0x19'),_0x99f1('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x99f1('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x99f1('0x0')]},'directmediadeny':{'type':Sequelize[_0x99f1('0x0')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x99f1('0x1b'),'set':function(_0x3e319f){this[_0x99f1('0xe')](_0x99f1('0x1c'),_0x3e319f?_0x3e319f['join'](','):null);},'get':function(){return this[_0x99f1('0x11')](_0x99f1('0x1c'))?this[_0x99f1('0x11')]('nat')[_0x99f1('0x1d')](','):null;},'comment':_0x99f1('0x1e')},'callgroup':{'type':Sequelize[_0x99f1('0x0')]},'namedcallgroup':{'type':Sequelize[_0x99f1('0x0')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x99f1('0x0')]},'language':{'type':Sequelize[_0x99f1('0x0')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x99f1('0x0')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x99f1('0x0')],'defaultValue':_0x99f1('0x1f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x498bf){this[_0x99f1('0xe')](_0x99f1('0x20'),_0x498bf?_0x498bf[_0x99f1('0x10')](';'):_0x99f1('0x21'));},'get':function(){return this['getDataValue']('allow')?this['getDataValue'](_0x99f1('0x20'))[_0x99f1('0x1d')](';'):null;},'comment':_0x99f1('0x22')},'autoframing':{'type':Sequelize[_0x99f1('0x2')](_0x99f1('0x17'),'no')},'insecure':{'type':Sequelize[_0x99f1('0x0')],'defaultValue':_0x99f1('0x23'),'set':function(_0x4a5238){this[_0x99f1('0xe')](_0x99f1('0x24'),_0x4a5238?_0x4a5238['join'](','):null);},'get':function(){return this[_0x99f1('0x11')](_0x99f1('0x24'))?this[_0x99f1('0x11')](_0x99f1('0x24'))[_0x99f1('0x1d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x99f1('0x2')](_0x99f1('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x99f1('0x2')](_0x99f1('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x99f1('0x2')]('yes','no',_0x99f1('0x25'))},'promiscredir':{'type':Sequelize[_0x99f1('0x2')](_0x99f1('0x17'),'no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize[_0x99f1('0x26')](0xb)},'setvar':{'type':Sequelize[_0x99f1('0x0')]},'callerid':{'type':Sequelize[_0x99f1('0x0')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x99f1('0x0')]},'callcounter':{'type':Sequelize[_0x99f1('0x2')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x99f1('0x2')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x99f1('0x2')](_0x99f1('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x99f1('0x2')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x99f1('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x99f1('0x0')]},'template':{'type':Sequelize[_0x99f1('0x0')]},'videosupport':{'type':Sequelize[_0x99f1('0x2')](_0x99f1('0x17'),'no',_0x99f1('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x99f1('0x2')](_0x99f1('0x17'),'no')},'mailbox':{'type':Sequelize[_0x99f1('0x0')]},'session_timers':{'type':Sequelize[_0x99f1('0x2')](_0x99f1('0x28'),_0x99f1('0x29'),_0x99f1('0x2a'))},'session_expires':{'type':Sequelize[_0x99f1('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x99f1('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x99f1('0x2')]('uac','uas'),'defaultValue':_0x99f1('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x99f1('0x0')]},'regexten':{'type':Sequelize[_0x99f1('0x0')]},'fromdomain':{'type':Sequelize[_0x99f1('0x0')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x99f1('0x26')](0x5)},'qualify':{'type':Sequelize[_0x99f1('0x2')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x99f1('0x26')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x99f1('0x0')]},'rtptimeout':{'type':Sequelize[_0x99f1('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x99f1('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x99f1('0x2')]('yes','no',_0x99f1('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x99f1('0x0')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x99f1('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x99f1('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x99f1('0x0')]},'contactdeny':{'type':Sequelize[_0x99f1('0x0')]},'contactacl':{'type':Sequelize[_0x99f1('0x0')]},'unsolicited_mailbox':{'type':Sequelize[_0x99f1('0x0')]},'use_q850_reason':{'type':Sequelize[_0x99f1('0x0')]},'maxforwards':{'type':Sequelize[_0x99f1('0x26')](0xb)},'encryption':{'type':Sequelize[_0x99f1('0x2')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x99f1('0x2')](_0x99f1('0x17'),'no')},'force_avp':{'type':Sequelize[_0x99f1('0x2')](_0x99f1('0x17'),'no')},'icesupport':{'type':Sequelize[_0x99f1('0x2')](_0x99f1('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x99f1('0x2')](_0x99f1('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x99f1('0x2')](_0x99f1('0x17'),'no',_0x99f1('0x2d'),_0x99f1('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x99f1('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x99f1('0x0')]},'dtlsprivatekey':{'type':Sequelize[_0x99f1('0x0')]},'dtlscipher':{'type':Sequelize[_0x99f1('0x0')]},'dtlscafile':{'type':Sequelize[_0x99f1('0x0')]},'dtlscapath':{'type':Sequelize[_0x99f1('0x0')]},'dtlssetup':{'type':Sequelize[_0x99f1('0x2')]('active',_0x99f1('0x2f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x99f1('0x0')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x99f1('0x0')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x99f1('0x2')](_0x99f1('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x99f1('0x2')](_0x99f1('0x17'),'no')},'vmexten':{'type':Sequelize[_0x99f1('0x0')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x99f1('0x0')]},'parkinglot':{'type':Sequelize[_0x99f1('0x0')]},'description':{'type':Sequelize[_0x99f1('0x0')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0x99f1('0x17'),'no','nonat',_0x99f1('0x19'),_0x99f1('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x99f1('0x0')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x3f0f=['BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','always','INTEGER','accept','originate','pai','fingerprint','certificate','active','actpass','dynamic','update,nonat'];(function(_0x80fed2,_0x5e02e4){var _0x3c1a70=function(_0x4621a9){while(--_0x4621a9){_0x80fed2['push'](_0x80fed2['shift']());}};_0x3c1a70(++_0x5e02e4);}(_0x3f0f,0x67));var _0xf3f0=function(_0x3c58e8,_0x901ef1){_0x3c58e8=_0x3c58e8-0x0;var _0x43eed8=_0x3f0f[_0x3c58e8];return _0x43eed8;};'use strict';var Sequelize=require(_0xf3f0('0x0'));module[_0xf3f0('0x1')]={'name':{'type':Sequelize[_0xf3f0('0x2')],'allowNull':![],'unique':_0xf3f0('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf3f0('0x4')](_0xf3f0('0x5'),_0xf3f0('0x6'),_0xf3f0('0x7')),'allowNull':![],'defaultValue':_0xf3f0('0x5')},'context':{'type':Sequelize[_0xf3f0('0x2')],'allowNull':![],'defaultValue':_0xf3f0('0x8')},'callingpres':{'type':Sequelize['ENUM'](_0xf3f0('0x9'),_0xf3f0('0xa'),_0xf3f0('0xb'),_0xf3f0('0xc'),_0xf3f0('0xd'),_0xf3f0('0xe'),_0xf3f0('0xf'),'PROHIB')},'deny':{'type':Sequelize[_0xf3f0('0x2')]},'permit':{'type':Sequelize[_0xf3f0('0x2')]},'secret':{'type':Sequelize[_0xf3f0('0x2')]},'md5secret':{'type':Sequelize[_0xf3f0('0x2')]},'remotesecret':{'type':Sequelize[_0xf3f0('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xf3f0('0x10'),'set':function(_0x2c37b6){this[_0xf3f0('0x11')](_0xf3f0('0x12'),_0x2c37b6?_0x2c37b6[_0xf3f0('0x13')](','):null);},'get':function(){return this[_0xf3f0('0x14')](_0xf3f0('0x12'))?this[_0xf3f0('0x14')](_0xf3f0('0x12'))[_0xf3f0('0x15')](','):null;},'comment':_0xf3f0('0x16')},'dtmfmode':{'type':Sequelize[_0xf3f0('0x4')](_0xf3f0('0x17'),_0xf3f0('0x18'),_0xf3f0('0x19'),'inband',_0xf3f0('0x1a')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xf3f0('0x4')](_0xf3f0('0x1b'),'no',_0xf3f0('0x1c'),_0xf3f0('0x1d'),_0xf3f0('0x1e')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf3f0('0x4')](_0xf3f0('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xf3f0('0x2')],'defaultValue':_0xf3f0('0x1f'),'set':function(_0x26b71d){this[_0xf3f0('0x11')](_0xf3f0('0x20'),_0x26b71d?_0x26b71d[_0xf3f0('0x13')](','):null);},'get':function(){return this[_0xf3f0('0x14')](_0xf3f0('0x20'))?this[_0xf3f0('0x14')](_0xf3f0('0x20'))[_0xf3f0('0x15')](','):null;},'comment':_0xf3f0('0x21')},'callgroup':{'type':Sequelize[_0xf3f0('0x2')]},'namedcallgroup':{'type':Sequelize[_0xf3f0('0x2')]},'pickupgroup':{'type':Sequelize[_0xf3f0('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xf3f0('0x2')]},'language':{'type':Sequelize[_0xf3f0('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0xf3f0('0x2')],'allowNull':![],'defaultValue':_0xf3f0('0x22'),'set':function(_0xd9c896){this[_0xf3f0('0x11')](_0xf3f0('0x23'),_0xd9c896?_0xd9c896[_0xf3f0('0x13')](';'):_0xf3f0('0x22'));},'get':function(){return this[_0xf3f0('0x14')](_0xf3f0('0x23'))?this[_0xf3f0('0x14')](_0xf3f0('0x23'))[_0xf3f0('0x15')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xf3f0('0x4')](_0xf3f0('0x1b'),'no')},'insecure':{'type':Sequelize[_0xf3f0('0x2')],'defaultValue':_0xf3f0('0x24'),'set':function(_0x575606){this['setDataValue']('insecure',_0x575606?_0x575606[_0xf3f0('0x13')](','):null);},'get':function(){return this[_0xf3f0('0x14')](_0xf3f0('0x25'))?this[_0xf3f0('0x14')](_0xf3f0('0x25'))[_0xf3f0('0x15')](','):null;},'comment':_0xf3f0('0x26')},'trustrpid':{'type':Sequelize[_0xf3f0('0x4')](_0xf3f0('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf3f0('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xf3f0('0x1b'),'no','never')},'promiscredir':{'type':Sequelize[_0xf3f0('0x4')](_0xf3f0('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0xf3f0('0x4')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xf3f0('0x2')]},'callcounter':{'type':Sequelize[_0xf3f0('0x4')](_0xf3f0('0x1b'),'no'),'defaultValue':_0xf3f0('0x1b')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xf3f0('0x4')](_0xf3f0('0x1b'),'no')},'allowsubscribe':{'type':Sequelize[_0xf3f0('0x4')](_0xf3f0('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0xf3f0('0x4')](_0xf3f0('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xf3f0('0x1b'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xf3f0('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0xf3f0('0x1b'),'no',_0xf3f0('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf3f0('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0xf3f0('0x2')]},'session_timers':{'type':Sequelize[_0xf3f0('0x4')](_0xf3f0('0x29'),'refuse',_0xf3f0('0x2a'))},'session_expires':{'type':Sequelize[_0xf3f0('0x28')](0xb)},'session_minse':{'type':Sequelize[_0xf3f0('0x28')](0xb)},'session_refresher':{'type':Sequelize[_0xf3f0('0x4')]('uac','uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xf3f0('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xf3f0('0x2')]},'port':{'type':Sequelize[_0xf3f0('0x28')](0x5)},'qualify':{'type':Sequelize[_0xf3f0('0x4')](_0xf3f0('0x1b'),'no'),'defaultValue':_0xf3f0('0x1b')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xf3f0('0x2')]},'defaultuser':{'type':Sequelize[_0xf3f0('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xf3f0('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xf3f0('0x28')](0xb)},'sendrpid':{'type':Sequelize[_0xf3f0('0x4')](_0xf3f0('0x1b'),'no',_0xf3f0('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xf3f0('0x28')](0xb)},'timerb':{'type':Sequelize[_0xf3f0('0x28')](0xb)},'qualifyfreq':{'type':Sequelize[_0xf3f0('0x28')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xf3f0('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xf3f0('0x2')]},'use_q850_reason':{'type':Sequelize[_0xf3f0('0x2')]},'maxforwards':{'type':Sequelize[_0xf3f0('0x28')](0xb)},'encryption':{'type':Sequelize[_0xf3f0('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf3f0('0x4')](_0xf3f0('0x1b'),'no')},'force_avp':{'type':Sequelize[_0xf3f0('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0xf3f0('0x4')](_0xf3f0('0x1b'),'no')},'dtlsenable':{'type':Sequelize[_0xf3f0('0x4')](_0xf3f0('0x1b'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xf3f0('0x1b'),'no',_0xf3f0('0x2c'),_0xf3f0('0x2d'))},'dtlsrekey':{'type':Sequelize[_0xf3f0('0x28')](0xb)},'dtlscertfile':{'type':Sequelize[_0xf3f0('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xf3f0('0x2')]},'dtlscipher':{'type':Sequelize[_0xf3f0('0x2')]},'dtlscafile':{'type':Sequelize[_0xf3f0('0x2')]},'dtlscapath':{'type':Sequelize[_0xf3f0('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xf3f0('0x2e'),'passive',_0xf3f0('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf3f0('0x2')]},'usereqphone':{'type':Sequelize[_0xf3f0('0x4')](_0xf3f0('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf3f0('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xf3f0('0x4')](_0xf3f0('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0xf3f0('0x4')](_0xf3f0('0x1b'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xf3f0('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf3f0('0x2')]},'host':{'type':Sequelize[_0xf3f0('0x2')],'defaultValue':_0xf3f0('0x30')},'canreinvite':{'type':Sequelize[_0xf3f0('0x4')](_0xf3f0('0x1b'),'no','nonat','update',_0xf3f0('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xf3f0('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xf3f0('0x32')],'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 f25b26f..77b181a 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 _0xd381=['user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','server/files/templates/trunk.ejs','utf8','readFileSync','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','get','Trunks','stack','name','send','index','map','Trunk','rawAttributes','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','clone','omit','updatedAt','body','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0xd381,0x84));var _0x1d38=function(_0x47408e,_0x481428){_0x47408e=_0x47408e-0x0;var _0x1636bc=_0xd381[_0x47408e];return _0x1636bc;};'use strict';var emlformat=require(_0x1d38('0x0'));var rimraf=require(_0x1d38('0x1'));var zipdir=require(_0x1d38('0x2'));var jsonpatch=require(_0x1d38('0x3'));var rp=require(_0x1d38('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1d38('0x5'));var util=require('util');var path=require(_0x1d38('0x6'));var sox=require(_0x1d38('0x7'));var csv=require(_0x1d38('0x8'));var ejs=require(_0x1d38('0x9'));var fs=require('fs');var fs_extra=require(_0x1d38('0xa'));var _=require(_0x1d38('0xb'));var squel=require(_0x1d38('0xc'));var crypto=require(_0x1d38('0xd'));var jsforce=require(_0x1d38('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1d38('0x8'));var querystring=require(_0x1d38('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1d38('0x10'));var as=require(_0x1d38('0x11'));var hardwareService=require(_0x1d38('0x12'));var logger=require(_0x1d38('0x13'))(_0x1d38('0x14'));var utils=require(_0x1d38('0x15'));var config=require(_0x1d38('0x16'));var licenseUtil=require(_0x1d38('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x1d38('0x18')][_0x1d38('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4fdcd0,_0x5c5017,_0x34fe6d,_0x2693c2){return new BPromise(function(_0x343ed0,_0x180aa1){var _0x5cd870=_0x2693c2||client;return _0x5cd870[_0x1d38('0x1a')](_0x4fdcd0,_0x34fe6d)[_0x1d38('0x1b')](function(_0x17680a){logger[_0x1d38('0x1c')](_0x1d38('0x1d'),_0x5c5017,'request\x20sent');logger[_0x1d38('0x1e')](_0x1d38('0x1f'),_0x5c5017,'request\x20sent',JSON[_0x1d38('0x20')](_0x17680a));if(_0x17680a[_0x1d38('0x21')]){if(_0x17680a['error'][_0x1d38('0x22')]===0x1f4){logger[_0x1d38('0x21')](_0x1d38('0x1d'),_0x5c5017,_0x17680a['error'][_0x1d38('0x23')]);return _0x180aa1(_0x17680a[_0x1d38('0x21')][_0x1d38('0x23')]);}logger[_0x1d38('0x21')](_0x1d38('0x1d'),_0x5c5017,_0x17680a['error']['message']);return _0x343ed0(_0x17680a[_0x1d38('0x21')]['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x5c5017,_0x1d38('0x24'));_0x343ed0(_0x17680a['result']['message']);}})[_0x1d38('0x25')](function(_0x18dd2f){logger[_0x1d38('0x21')](_0x1d38('0x1d'),_0x5c5017,_0x18dd2f);_0x180aa1(_0x18dd2f);});});}function respondWithStatusCode(_0x49f049,_0x288d93){_0x288d93=_0x288d93||0xcc;return function(_0x339449){if(_0x339449){return _0x49f049[_0x1d38('0x26')](_0x288d93);}return _0x49f049['status'](_0x288d93)[_0x1d38('0x27')]();};}function respondWithResult(_0x1773cd,_0x39fd7d){_0x39fd7d=_0x39fd7d||0xc8;return function(_0x25f377){if(_0x25f377){return _0x1773cd[_0x1d38('0x28')](_0x39fd7d)[_0x1d38('0x29')](_0x25f377);}};}function respondWithFilteredResult(_0x564967,_0x3d358b){return function(_0x325d5b){if(_0x325d5b){var _0x24607a=typeof _0x3d358b[_0x1d38('0x2a')]===_0x1d38('0x2b')&&typeof _0x3d358b[_0x1d38('0x2c')]===_0x1d38('0x2b');var _0x2d9224=_0x325d5b[_0x1d38('0x2d')];var _0x3326df=_0x24607a?0x0:_0x3d358b[_0x1d38('0x2a')];var _0x4e2206=_0x24607a?_0x325d5b[_0x1d38('0x2d')]:_0x3d358b['offset']+_0x3d358b[_0x1d38('0x2c')];var _0x31b481;if(_0x4e2206>=_0x2d9224){_0x4e2206=_0x2d9224;_0x31b481=0xc8;}else{_0x31b481=0xce;}_0x564967[_0x1d38('0x28')](_0x31b481);return _0x564967['set'](_0x1d38('0x2e'),_0x3326df+'-'+_0x4e2206+'/'+_0x2d9224)['json'](_0x325d5b);}return null;};}function patchUpdates(_0x13743b){return function(_0x4419d6){try{jsonpatch['apply'](_0x4419d6,_0x13743b,!![]);}catch(_0x3f20e5){return BPromise[_0x1d38('0x2f')](_0x3f20e5);}return _0x4419d6[_0x1d38('0x30')]();};}function saveUpdates(_0x669f7f,_0x124096){return function(_0x1bcf05){if(_0x1bcf05){return _0x1bcf05[_0x1d38('0x31')](_0x669f7f)['then'](function(_0x494628){return _0x494628;});}return null;};}function removeEntity(_0x4e056e,_0x1a8f0a){return function(_0x281460){if(_0x281460){return _0x281460[_0x1d38('0x32')]()['then'](function(){var _0x129a43=_0x281460[_0x1d38('0x33')]({'plain':!![]});var _0x461ec0=_0x1d38('0x34');return db['UserProfileResource'][_0x1d38('0x32')]({'where':{'type':_0x461ec0,'resourceId':_0x129a43['id']}})[_0x1d38('0x1b')](function(){return _0x281460;});})[_0x1d38('0x1b')](function(){_0x4e056e[_0x1d38('0x28')](0xcc)[_0x1d38('0x27')]();});}};}function handleEntityNotFound(_0x9cb807,_0x2ba267){return function(_0xe84a48){if(!_0xe84a48){_0x9cb807[_0x1d38('0x26')](0x194);}return _0xe84a48;};}function handleError(_0x5ad700,_0x59396f){_0x59396f=_0x59396f||0x1f4;return function(_0x5c1c44){logger[_0x1d38('0x21')](_0x5c1c44[_0x1d38('0x35')]);if(_0x5c1c44[_0x1d38('0x36')]){delete _0x5c1c44[_0x1d38('0x36')];}_0x5ad700[_0x1d38('0x28')](_0x59396f)[_0x1d38('0x37')](_0x5c1c44);};}exports[_0x1d38('0x38')]=function(_0x7c08b9,_0x5d49f4){var _0x561cc7={},_0x2fd3c7={},_0x474379={'count':0x0,'rows':[]};var _0x4d08d9=_[_0x1d38('0x39')](db[_0x1d38('0x3a')][_0x1d38('0x3b')],function(_0x323a5d){return{'name':_0x323a5d['fieldName'],'type':_0x323a5d['type'][_0x1d38('0x3c')]};});_0x2fd3c7['model']=_[_0x1d38('0x39')](_0x4d08d9,_0x1d38('0x36'));_0x2fd3c7['query']=_[_0x1d38('0x3d')](_0x7c08b9[_0x1d38('0x3e')]);_0x2fd3c7[_0x1d38('0x3f')]=_[_0x1d38('0x40')](_0x2fd3c7[_0x1d38('0x41')],_0x2fd3c7[_0x1d38('0x3e')]);_0x561cc7[_0x1d38('0x42')]=_[_0x1d38('0x40')](_0x2fd3c7['model'],qs[_0x1d38('0x43')](_0x7c08b9[_0x1d38('0x3e')][_0x1d38('0x43')]));_0x561cc7[_0x1d38('0x42')]=_0x561cc7[_0x1d38('0x42')][_0x1d38('0x44')]?_0x561cc7[_0x1d38('0x42')]:_0x2fd3c7[_0x1d38('0x41')];if(!_0x7c08b9['query'][_0x1d38('0x45')](_0x1d38('0x46'))){_0x561cc7['limit']=qs[_0x1d38('0x2c')](_0x7c08b9[_0x1d38('0x3e')][_0x1d38('0x2c')]);_0x561cc7[_0x1d38('0x2a')]=qs[_0x1d38('0x2a')](_0x7c08b9[_0x1d38('0x3e')][_0x1d38('0x2a')]);}_0x561cc7[_0x1d38('0x47')]=qs['sort'](_0x7c08b9['query'][_0x1d38('0x48')]);_0x561cc7['where']=qs[_0x1d38('0x3f')](_[_0x1d38('0x49')](_0x7c08b9[_0x1d38('0x3e')],_0x2fd3c7['filters']),_0x4d08d9);if(_0x7c08b9['query'][_0x1d38('0x4a')]){_0x561cc7[_0x1d38('0x4b')]=_[_0x1d38('0x4c')](_0x561cc7[_0x1d38('0x4b')],{'$or':_[_0x1d38('0x39')](_0x4d08d9,function(_0x421824){if(_0x421824[_0x1d38('0x4d')]!==_0x1d38('0x4e')){var _0x494a1c={};_0x494a1c[_0x421824[_0x1d38('0x36')]]={'$like':'%'+_0x7c08b9[_0x1d38('0x3e')][_0x1d38('0x4a')]+'%'};return _0x494a1c;}})});}_0x561cc7=_[_0x1d38('0x4c')]({},_0x561cc7,_0x7c08b9[_0x1d38('0x4f')]);var _0x1560dd={'where':_0x561cc7['where']};return db['Trunk'][_0x1d38('0x2d')](_0x1560dd)[_0x1d38('0x1b')](function(_0x2dd52f){_0x474379[_0x1d38('0x2d')]=_0x2dd52f;if(_0x7c08b9[_0x1d38('0x3e')][_0x1d38('0x50')]){_0x561cc7[_0x1d38('0x51')]=[{'all':!![]}];}return db[_0x1d38('0x3a')][_0x1d38('0x52')](_0x561cc7);})[_0x1d38('0x1b')](function(_0x47ce69){_0x474379['rows']=_0x47ce69;return _0x474379;})['then'](respondWithFilteredResult(_0x5d49f4,_0x561cc7))[_0x1d38('0x25')](handleError(_0x5d49f4,null));};exports[_0x1d38('0x53')]=function(_0x383255,_0x37aa){var _0x55c22d={'raw':![],'where':{'id':_0x383255[_0x1d38('0x54')]['id']}},_0x38766a={};_0x38766a[_0x1d38('0x41')]=_[_0x1d38('0x3d')](db[_0x1d38('0x3a')]['rawAttributes']);_0x38766a[_0x1d38('0x3e')]=_[_0x1d38('0x3d')](_0x383255[_0x1d38('0x3e')]);_0x38766a[_0x1d38('0x3f')]=_[_0x1d38('0x40')](_0x38766a['model'],_0x38766a[_0x1d38('0x3e')]);_0x55c22d['attributes']=_[_0x1d38('0x40')](_0x38766a['model'],qs['fields'](_0x383255['query'][_0x1d38('0x43')]));_0x55c22d['attributes']=_0x55c22d[_0x1d38('0x42')][_0x1d38('0x44')]?_0x55c22d[_0x1d38('0x42')]:_0x38766a[_0x1d38('0x41')];if(_0x383255[_0x1d38('0x3e')][_0x1d38('0x50')]){_0x55c22d[_0x1d38('0x51')]=[{'all':!![]}];}_0x55c22d=_['merge']({},_0x55c22d,_0x383255['options']);return db[_0x1d38('0x3a')]['find'](_0x55c22d)['then'](handleEntityNotFound(_0x37aa,null))['then'](respondWithResult(_0x37aa,null))['catch'](handleError(_0x37aa,null));};exports[_0x1d38('0x55')]=function(_0x220868,_0x56700a){var _0x5d9048={'where':{'id':_0x220868[_0x1d38('0x54')]['id']}},_0x15a44b={};_0x15a44b[_0x1d38('0x41')]=_[_0x1d38('0x3d')](db[_0x1d38('0x3a')][_0x1d38('0x3b')]);_0x5d9048['attributes']=_[_0x1d38('0x40')](_0x15a44b[_0x1d38('0x41')],qs[_0x1d38('0x43')](_0x220868[_0x1d38('0x3e')]['fields']));_0x5d9048[_0x1d38('0x42')]=_0x5d9048[_0x1d38('0x42')]['length']?_0x5d9048[_0x1d38('0x42')]:_0x15a44b[_0x1d38('0x41')];if(_0x220868[_0x1d38('0x3e')][_0x1d38('0x50')]){_0x5d9048[_0x1d38('0x51')]=[{'all':!![]}];}_0x5d9048=_[_0x1d38('0x4c')]({},_0x5d9048,_0x220868[_0x1d38('0x4f')]);return db[_0x1d38('0x3a')]['find'](_0x5d9048)[_0x1d38('0x1b')](handleEntityNotFound(_0x56700a,null))[_0x1d38('0x1b')](function(_0x4bd89e){if(_0x4bd89e){var _0x4865e8=_0x4bd89e['get']({'plain':!![]});_0x4865e8=qs[_0x1d38('0x56')](_0x4865e8,['id','createdAt',_0x1d38('0x57')]);_0x220868[_0x1d38('0x58')]=_[_0x1d38('0x56')](_0x220868['body'],['id','createdAt',_0x1d38('0x57')]);return db[_0x1d38('0x3a')][_0x1d38('0x59')](_[_0x1d38('0x4c')](_0x4865e8,_0x220868['body']),{'include':_0x220868[_0x1d38('0x3e')][_0x1d38('0x50')]?[{'all':!![]}]:undefined})[_0x1d38('0x1b')](function(_0x15093f){var _0x1361b8=_0x220868['user']['get']({'plain':!![]});if(!_0x1361b8)throw new Error(_0x1d38('0x5a'));if(_0x1361b8[_0x1d38('0x5b')]===_0x1d38('0x5c')){var _0x237773=_0x15093f[_0x1d38('0x33')]({'plain':!![]});var _0x3dcea1=_0x1d38('0x34');return db[_0x1d38('0x5d')]['find']({'where':{'name':_0x3dcea1,'userProfileId':_0x1361b8[_0x1d38('0x5e')]},'raw':!![]})['then'](function(_0x4bcf19){if(_0x4bcf19&&_0x4bcf19[_0x1d38('0x5f')]===0x0){return db[_0x1d38('0x60')][_0x1d38('0x59')]({'name':_0x237773['name'],'resourceId':_0x237773['id'],'type':_0x4bcf19[_0x1d38('0x36')],'sectionId':_0x4bcf19['id']},{})[_0x1d38('0x1b')](function(){return _0x15093f;});}else{return _0x15093f;}})[_0x1d38('0x25')](function(_0x1ea130){logger['error'](_0x1d38('0x61'),_0x1ea130);throw _0x1ea130;});}return _0x15093f;});}})[_0x1d38('0x1b')](respondWithResult(_0x56700a,0xc9))[_0x1d38('0x25')](handleError(_0x56700a,null));};exports['create']=function(_0x1b4577,_0x47a2c6,_0x5f41f6){var _0x2e16f6;return db['Trunk'][_0x1d38('0x59')](_0x1b4577[_0x1d38('0x58')],{'raw':!![]})[_0x1d38('0x1b')](function(_0x1deb3d){_0x2e16f6=_0x1deb3d;return db[_0x1d38('0x3a')][_0x1d38('0x52')]({'raw':!![]});})[_0x1d38('0x1b')](function(_0x9b6a9d){var _0x5f4364=fs['readFileSync'](path['join'](config[_0x1d38('0x62')],_0x1d38('0x63')),_0x1d38('0x64'));var _0x21b7b5=fs[_0x1d38('0x65')](path[_0x1d38('0x66')](config[_0x1d38('0x62')],_0x1d38('0x67')),'utf8');var _0x58b3dc=ejs[_0x1d38('0x68')](_0x5f4364,{'trunks':_0x9b6a9d||[]});fs[_0x1d38('0x69')](_0x1d38('0x6a'),_0x58b3dc);if(_0x2e16f6[_0x1d38('0x6b')]){var _0x3080c6=ejs[_0x1d38('0x68')](_0x21b7b5,{'trunks':_0x9b6a9d||[]});fs[_0x1d38('0x69')](_0x1d38('0x6c'),_0x3080c6);}})['then'](function(){return respondWithRpcPromise(_0x1d38('0x6d'),_0x1d38('0x59'),{'module':_0x1d38('0x6e')});})[_0x1d38('0x1b')](function(){var _0xe4fabc=_0x1b4577[_0x1d38('0x5c')][_0x1d38('0x33')]({'plain':!![]});if(!_0xe4fabc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe4fabc['role']==='user'){var _0x4fdeeb=_0x2e16f6[_0x1d38('0x33')]({'plain':!![]});return db[_0x1d38('0x5d')][_0x1d38('0x6f')]({'where':{'name':'Trunks','userProfileId':_0xe4fabc[_0x1d38('0x5e')]},'raw':!![]})[_0x1d38('0x1b')](function(_0x4d9d0b){if(_0x4d9d0b&&_0x4d9d0b[_0x1d38('0x5f')]===0x0){return db['UserProfileResource'][_0x1d38('0x59')]({'name':_0x4fdeeb[_0x1d38('0x36')],'resourceId':_0x4fdeeb['id'],'type':_0x4d9d0b[_0x1d38('0x36')],'sectionId':_0x4d9d0b['id']},{})[_0x1d38('0x1b')](function(){return _0x2e16f6;});}else{return _0x2e16f6;}})[_0x1d38('0x25')](function(_0x194c41){logger[_0x1d38('0x21')](_0x1d38('0x61'),_0x194c41);throw _0x194c41;});}return _0x2e16f6;})[_0x1d38('0x1b')](respondWithResult(_0x47a2c6,0xc9))[_0x1d38('0x25')](handleError(_0x47a2c6,null));};exports[_0x1d38('0x31')]=function(_0x358096,_0x5dc9e4,_0x2cb6ba){var _0x53586c;return db[_0x1d38('0x3a')]['find']({'where':{'id':_0x358096[_0x1d38('0x54')]['id']}})[_0x1d38('0x1b')](handleEntityNotFound(_0x5dc9e4,null))[_0x1d38('0x1b')](saveUpdates(_0x358096[_0x1d38('0x58')],null))[_0x1d38('0x1b')](function(_0x380c3f){if(_0x380c3f){_0x53586c=_0x380c3f;return db[_0x1d38('0x3a')][_0x1d38('0x52')]({'raw':!![]});}})[_0x1d38('0x1b')](function(_0x79b337){if(_0x79b337){var _0x41ab2c=fs[_0x1d38('0x65')](path['join'](config[_0x1d38('0x62')],'server/files/templates/trunk.ejs'),_0x1d38('0x64'));var _0xa9a539=fs['readFileSync'](path[_0x1d38('0x66')](config[_0x1d38('0x62')],_0x1d38('0x67')),'utf8');var _0x2ed832=ejs[_0x1d38('0x68')](_0x41ab2c,{'trunks':_0x79b337||[]});fs[_0x1d38('0x69')]('/etc/asterisk/sip_xcally_trunks.conf',_0x2ed832);var _0x559c69=ejs[_0x1d38('0x68')](_0xa9a539,{'trunks':_0x79b337||[]});fs['writeFileSync'](_0x1d38('0x6c'),_0x559c69);return respondWithRpcPromise('Reload',_0x1d38('0x31'),{'module':_0x1d38('0x6e')});}return null;})[_0x1d38('0x1b')](function(_0x3a4b4a){if(_0x3a4b4a){return _0x53586c;}})[_0x1d38('0x1b')](respondWithResult(_0x5dc9e4,null))[_0x1d38('0x25')](handleError(_0x5dc9e4,null));};exports[_0x1d38('0x32')]=function(_0x34e923,_0x2cdf1a,_0x1628f6){var _0x3b2db0;return db[_0x1d38('0x3a')][_0x1d38('0x6f')]({'where':{'id':_0x34e923[_0x1d38('0x54')]['id']}})['then'](handleEntityNotFound(_0x2cdf1a,null))[_0x1d38('0x1b')](removeEntity(_0x2cdf1a,null))[_0x1d38('0x1b')](function(){return db[_0x1d38('0x3a')][_0x1d38('0x52')]({'raw':!![]});})['then'](function(_0x3ec20f){var _0x33c682=fs[_0x1d38('0x65')](path[_0x1d38('0x66')](config['root'],_0x1d38('0x63')),_0x1d38('0x64'));var _0x2f3c3b=fs[_0x1d38('0x65')](path['join'](config['root'],_0x1d38('0x67')),_0x1d38('0x64'));var _0x3fcdf6=ejs['render'](_0x33c682,{'trunks':_0x3ec20f});var _0x1271ff=ejs[_0x1d38('0x68')](_0x2f3c3b,{'trunks':_0x3ec20f});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x3fcdf6);fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x1271ff);return respondWithRpcPromise(_0x1d38('0x6d'),_0x1d38('0x32'),{'module':'chan_sip.so'});})[_0x1d38('0x25')](handleError(_0x2cdf1a,null));}; \ No newline at end of file +var _0x3d2d=['fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','params','include','find','clone','omit','createdAt','body','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','request','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','type','model','keys','query','filters','intersection','attributes'];(function(_0x20399d,_0x419e2a){var _0xc1510e=function(_0x58fd09){while(--_0x58fd09){_0x20399d['push'](_0x20399d['shift']());}};_0xc1510e(++_0x419e2a);}(_0x3d2d,0x9f));var _0xd3d2=function(_0x5a7112,_0x1f9492){_0x5a7112=_0x5a7112-0x0;var _0x3147f7=_0x3d2d[_0x5a7112];return _0x3147f7;};'use strict';var emlformat=require(_0xd3d2('0x0'));var rimraf=require(_0xd3d2('0x1'));var zipdir=require(_0xd3d2('0x2'));var jsonpatch=require(_0xd3d2('0x3'));var rp=require(_0xd3d2('0x4'));var moment=require(_0xd3d2('0x5'));var BPromise=require(_0xd3d2('0x6'));var Mustache=require(_0xd3d2('0x7'));var util=require(_0xd3d2('0x8'));var path=require('path');var sox=require(_0xd3d2('0x9'));var csv=require(_0xd3d2('0xa'));var ejs=require(_0xd3d2('0xb'));var fs=require('fs');var fs_extra=require(_0xd3d2('0xc'));var _=require('lodash');var squel=require(_0xd3d2('0xd'));var crypto=require(_0xd3d2('0xe'));var jsforce=require(_0xd3d2('0xf'));var deskjs=require(_0xd3d2('0x10'));var toCsv=require(_0xd3d2('0xa'));var querystring=require('querystring');var Papa=require(_0xd3d2('0x11'));var Redis=require(_0xd3d2('0x12'));var authService=require(_0xd3d2('0x13'));var qs=require(_0xd3d2('0x14'));var as=require(_0xd3d2('0x15'));var hardwareService=require(_0xd3d2('0x16'));var logger=require(_0xd3d2('0x17'))(_0xd3d2('0x18'));var utils=require('../../config/utils');var config=require(_0xd3d2('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd3d2('0x1a'))['db'];var jayson=require(_0xd3d2('0x1b'));var client=jayson[_0xd3d2('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x582506,_0x5a8359,_0x84861,_0x2e6575){return new BPromise(function(_0x46bea1,_0x9c169e){var _0x1e22a9=_0x2e6575||client;return _0x1e22a9[_0xd3d2('0x1d')](_0x582506,_0x84861)['then'](function(_0xc6d827){logger[_0xd3d2('0x1e')]('Trunk,\x20%s,\x20%s',_0x5a8359,_0xd3d2('0x1f'));logger[_0xd3d2('0x20')](_0xd3d2('0x21'),_0x5a8359,_0xd3d2('0x1f'),JSON[_0xd3d2('0x22')](_0xc6d827));if(_0xc6d827[_0xd3d2('0x23')]){if(_0xc6d827[_0xd3d2('0x23')][_0xd3d2('0x24')]===0x1f4){logger[_0xd3d2('0x23')](_0xd3d2('0x25'),_0x5a8359,_0xc6d827[_0xd3d2('0x23')][_0xd3d2('0x26')]);return _0x9c169e(_0xc6d827[_0xd3d2('0x23')][_0xd3d2('0x26')]);}logger[_0xd3d2('0x23')](_0xd3d2('0x25'),_0x5a8359,_0xc6d827[_0xd3d2('0x23')][_0xd3d2('0x26')]);return _0x46bea1(_0xc6d827['error'][_0xd3d2('0x26')]);}else{logger[_0xd3d2('0x1e')](_0xd3d2('0x25'),_0x5a8359,'request\x20sent');_0x46bea1(_0xc6d827[_0xd3d2('0x27')][_0xd3d2('0x26')]);}})[_0xd3d2('0x28')](function(_0x59029e){logger[_0xd3d2('0x23')]('Trunk,\x20%s,\x20%s',_0x5a8359,_0x59029e);_0x9c169e(_0x59029e);});});}function respondWithStatusCode(_0x303e63,_0x1cbc30){_0x1cbc30=_0x1cbc30||0xcc;return function(_0xcc1639){if(_0xcc1639){return _0x303e63[_0xd3d2('0x29')](_0x1cbc30);}return _0x303e63[_0xd3d2('0x2a')](_0x1cbc30)[_0xd3d2('0x2b')]();};}function respondWithResult(_0x124eda,_0x8dcb6){_0x8dcb6=_0x8dcb6||0xc8;return function(_0x44b02b){if(_0x44b02b){return _0x124eda[_0xd3d2('0x2a')](_0x8dcb6)[_0xd3d2('0x2c')](_0x44b02b);}};}function respondWithFilteredResult(_0x24b368,_0x43b5c6){return function(_0x441653){if(_0x441653){var _0x2959eb=typeof _0x43b5c6[_0xd3d2('0x2d')]===_0xd3d2('0x2e')&&typeof _0x43b5c6[_0xd3d2('0x2f')]===_0xd3d2('0x2e');var _0x1114b5=_0x441653[_0xd3d2('0x30')];var _0x26c33a=_0x2959eb?0x0:_0x43b5c6[_0xd3d2('0x2d')];var _0x484dd6=_0x2959eb?_0x441653[_0xd3d2('0x30')]:_0x43b5c6[_0xd3d2('0x2d')]+_0x43b5c6[_0xd3d2('0x2f')];var _0x3afb86;if(_0x484dd6>=_0x1114b5){_0x484dd6=_0x1114b5;_0x3afb86=0xc8;}else{_0x3afb86=0xce;}_0x24b368[_0xd3d2('0x2a')](_0x3afb86);return _0x24b368[_0xd3d2('0x31')](_0xd3d2('0x32'),_0x26c33a+'-'+_0x484dd6+'/'+_0x1114b5)[_0xd3d2('0x2c')](_0x441653);}return null;};}function patchUpdates(_0x3bb47c){return function(_0xd7fe17){try{jsonpatch[_0xd3d2('0x33')](_0xd7fe17,_0x3bb47c,!![]);}catch(_0x747eec){return BPromise[_0xd3d2('0x34')](_0x747eec);}return _0xd7fe17[_0xd3d2('0x35')]();};}function saveUpdates(_0xb043fb,_0x25e54f){return function(_0x589a08){if(_0x589a08){return _0x589a08[_0xd3d2('0x36')](_0xb043fb)['then'](function(_0x585947){return _0x585947;});}return null;};}function removeEntity(_0x37f7b7,_0x2f1824){return function(_0x503b37){if(_0x503b37){return _0x503b37[_0xd3d2('0x37')]()[_0xd3d2('0x38')](function(){var _0x1a95e2=_0x503b37[_0xd3d2('0x39')]({'plain':!![]});var _0x388c63=_0xd3d2('0x3a');return db[_0xd3d2('0x3b')][_0xd3d2('0x37')]({'where':{'type':_0x388c63,'resourceId':_0x1a95e2['id']}})[_0xd3d2('0x38')](function(){return _0x503b37;});})[_0xd3d2('0x38')](function(){_0x37f7b7[_0xd3d2('0x2a')](0xcc)[_0xd3d2('0x2b')]();});}};}function handleEntityNotFound(_0x38b216,_0x2017cf){return function(_0x153b63){if(!_0x153b63){_0x38b216['sendStatus'](0x194);}return _0x153b63;};}function handleError(_0x37bf07,_0x4f0c8d){_0x4f0c8d=_0x4f0c8d||0x1f4;return function(_0xc5b2a3){logger[_0xd3d2('0x23')](_0xc5b2a3[_0xd3d2('0x3c')]);if(_0xc5b2a3['name']){delete _0xc5b2a3[_0xd3d2('0x3d')];}_0x37bf07[_0xd3d2('0x2a')](_0x4f0c8d)['send'](_0xc5b2a3);};}exports[_0xd3d2('0x3e')]=function(_0x18fd19,_0x37b4d1){var _0x4db4a2={},_0x4bd11f={},_0x445195={'count':0x0,'rows':[]};var _0x142a01=_[_0xd3d2('0x3f')](db[_0xd3d2('0x40')][_0xd3d2('0x41')],function(_0x22590c){return{'name':_0x22590c['fieldName'],'type':_0x22590c[_0xd3d2('0x42')]['key']};});_0x4bd11f[_0xd3d2('0x43')]=_['map'](_0x142a01,_0xd3d2('0x3d'));_0x4bd11f['query']=_[_0xd3d2('0x44')](_0x18fd19[_0xd3d2('0x45')]);_0x4bd11f[_0xd3d2('0x46')]=_[_0xd3d2('0x47')](_0x4bd11f['model'],_0x4bd11f[_0xd3d2('0x45')]);_0x4db4a2[_0xd3d2('0x48')]=_[_0xd3d2('0x47')](_0x4bd11f[_0xd3d2('0x43')],qs[_0xd3d2('0x49')](_0x18fd19[_0xd3d2('0x45')][_0xd3d2('0x49')]));_0x4db4a2[_0xd3d2('0x48')]=_0x4db4a2[_0xd3d2('0x48')][_0xd3d2('0x4a')]?_0x4db4a2[_0xd3d2('0x48')]:_0x4bd11f['model'];if(!_0x18fd19[_0xd3d2('0x45')]['hasOwnProperty'](_0xd3d2('0x4b'))){_0x4db4a2['limit']=qs[_0xd3d2('0x2f')](_0x18fd19['query'][_0xd3d2('0x2f')]);_0x4db4a2[_0xd3d2('0x2d')]=qs['offset'](_0x18fd19[_0xd3d2('0x45')][_0xd3d2('0x2d')]);}_0x4db4a2[_0xd3d2('0x4c')]=qs['sort'](_0x18fd19[_0xd3d2('0x45')][_0xd3d2('0x4d')]);_0x4db4a2[_0xd3d2('0x4e')]=qs[_0xd3d2('0x46')](_[_0xd3d2('0x4f')](_0x18fd19[_0xd3d2('0x45')],_0x4bd11f[_0xd3d2('0x46')]),_0x142a01);if(_0x18fd19['query'][_0xd3d2('0x50')]){_0x4db4a2[_0xd3d2('0x4e')]=_['merge'](_0x4db4a2[_0xd3d2('0x4e')],{'$or':_[_0xd3d2('0x3f')](_0x142a01,function(_0x31becf){if(_0x31becf[_0xd3d2('0x42')]!==_0xd3d2('0x51')){var _0x21e417={};_0x21e417[_0x31becf[_0xd3d2('0x3d')]]={'$like':'%'+_0x18fd19['query']['filter']+'%'};return _0x21e417;}})});}_0x4db4a2=_[_0xd3d2('0x52')]({},_0x4db4a2,_0x18fd19[_0xd3d2('0x53')]);var _0x13e700={'where':_0x4db4a2[_0xd3d2('0x4e')]};return db[_0xd3d2('0x40')]['count'](_0x13e700)['then'](function(_0x1e55e4){_0x445195[_0xd3d2('0x30')]=_0x1e55e4;if(_0x18fd19['query'][_0xd3d2('0x54')]){_0x4db4a2['include']=[{'all':!![]}];}return db[_0xd3d2('0x40')]['findAll'](_0x4db4a2);})[_0xd3d2('0x38')](function(_0x21139b){_0x445195[_0xd3d2('0x55')]=_0x21139b;return _0x445195;})[_0xd3d2('0x38')](respondWithFilteredResult(_0x37b4d1,_0x4db4a2))['catch'](handleError(_0x37b4d1,null));};exports['show']=function(_0xa36f9b,_0x14698c){var _0xdb51a7={'raw':![],'where':{'id':_0xa36f9b[_0xd3d2('0x56')]['id']}},_0x5a8eb8={};_0x5a8eb8[_0xd3d2('0x43')]=_[_0xd3d2('0x44')](db['Trunk'][_0xd3d2('0x41')]);_0x5a8eb8['query']=_[_0xd3d2('0x44')](_0xa36f9b[_0xd3d2('0x45')]);_0x5a8eb8[_0xd3d2('0x46')]=_[_0xd3d2('0x47')](_0x5a8eb8[_0xd3d2('0x43')],_0x5a8eb8[_0xd3d2('0x45')]);_0xdb51a7[_0xd3d2('0x48')]=_[_0xd3d2('0x47')](_0x5a8eb8['model'],qs[_0xd3d2('0x49')](_0xa36f9b[_0xd3d2('0x45')][_0xd3d2('0x49')]));_0xdb51a7[_0xd3d2('0x48')]=_0xdb51a7[_0xd3d2('0x48')][_0xd3d2('0x4a')]?_0xdb51a7[_0xd3d2('0x48')]:_0x5a8eb8[_0xd3d2('0x43')];if(_0xa36f9b[_0xd3d2('0x45')][_0xd3d2('0x54')]){_0xdb51a7[_0xd3d2('0x57')]=[{'all':!![]}];}_0xdb51a7=_[_0xd3d2('0x52')]({},_0xdb51a7,_0xa36f9b['options']);return db[_0xd3d2('0x40')][_0xd3d2('0x58')](_0xdb51a7)[_0xd3d2('0x38')](handleEntityNotFound(_0x14698c,null))[_0xd3d2('0x38')](respondWithResult(_0x14698c,null))['catch'](handleError(_0x14698c,null));};exports[_0xd3d2('0x59')]=function(_0x3b8f31,_0x551904){var _0x18d9fd={'where':{'id':_0x3b8f31[_0xd3d2('0x56')]['id']}},_0x49f54c={};_0x49f54c[_0xd3d2('0x43')]=_['keys'](db[_0xd3d2('0x40')][_0xd3d2('0x41')]);_0x18d9fd[_0xd3d2('0x48')]=_['intersection'](_0x49f54c[_0xd3d2('0x43')],qs['fields'](_0x3b8f31[_0xd3d2('0x45')][_0xd3d2('0x49')]));_0x18d9fd['attributes']=_0x18d9fd[_0xd3d2('0x48')][_0xd3d2('0x4a')]?_0x18d9fd[_0xd3d2('0x48')]:_0x49f54c[_0xd3d2('0x43')];if(_0x3b8f31[_0xd3d2('0x45')][_0xd3d2('0x54')]){_0x18d9fd[_0xd3d2('0x57')]=[{'all':!![]}];}_0x18d9fd=_['merge']({},_0x18d9fd,_0x3b8f31[_0xd3d2('0x53')]);return db[_0xd3d2('0x40')][_0xd3d2('0x58')](_0x18d9fd)['then'](handleEntityNotFound(_0x551904,null))[_0xd3d2('0x38')](function(_0x16db0b){if(_0x16db0b){var _0x349773=_0x16db0b['get']({'plain':!![]});_0x349773=qs[_0xd3d2('0x5a')](_0x349773,['id',_0xd3d2('0x5b'),'updatedAt']);_0x3b8f31[_0xd3d2('0x5c')]=_['omit'](_0x3b8f31[_0xd3d2('0x5c')],['id',_0xd3d2('0x5b'),_0xd3d2('0x5d')]);return db[_0xd3d2('0x40')][_0xd3d2('0x5e')](_['merge'](_0x349773,_0x3b8f31['body']),{'include':_0x3b8f31[_0xd3d2('0x45')]['includeAll']?[{'all':!![]}]:undefined})[_0xd3d2('0x38')](function(_0x5a91dd){var _0x1958c8=_0x3b8f31[_0xd3d2('0x5f')][_0xd3d2('0x39')]({'plain':!![]});if(!_0x1958c8)throw new Error(_0xd3d2('0x60'));if(_0x1958c8[_0xd3d2('0x61')]===_0xd3d2('0x5f')){var _0x1154a5=_0x5a91dd[_0xd3d2('0x39')]({'plain':!![]});var _0x3800df=_0xd3d2('0x3a');return db[_0xd3d2('0x62')][_0xd3d2('0x58')]({'where':{'name':_0x3800df,'userProfileId':_0x1958c8[_0xd3d2('0x63')]},'raw':!![]})[_0xd3d2('0x38')](function(_0x36b38c){if(_0x36b38c&&_0x36b38c[_0xd3d2('0x64')]===0x0){return db[_0xd3d2('0x3b')]['create']({'name':_0x1154a5[_0xd3d2('0x3d')],'resourceId':_0x1154a5['id'],'type':_0x36b38c[_0xd3d2('0x3d')],'sectionId':_0x36b38c['id']},{})['then'](function(){return _0x5a91dd;});}else{return _0x5a91dd;}})[_0xd3d2('0x28')](function(_0x5ae800){logger[_0xd3d2('0x23')](_0xd3d2('0x65'),_0x5ae800);throw _0x5ae800;});}return _0x5a91dd;});}})[_0xd3d2('0x38')](respondWithResult(_0x551904,0xc9))[_0xd3d2('0x28')](handleError(_0x551904,null));};exports[_0xd3d2('0x5e')]=function(_0x2f947a,_0x30a20a,_0x4f05aa){var _0x52f223;return db[_0xd3d2('0x40')]['create'](_0x2f947a[_0xd3d2('0x5c')],{'raw':!![]})[_0xd3d2('0x38')](function(_0x375f8b){_0x52f223=_0x375f8b;return db[_0xd3d2('0x40')][_0xd3d2('0x66')]({'raw':!![]});})['then'](function(_0x29a32b){var _0x4fc7f6=fs[_0xd3d2('0x67')](path[_0xd3d2('0x68')](config[_0xd3d2('0x69')],_0xd3d2('0x6a')),_0xd3d2('0x6b'));var _0x4319c8=fs[_0xd3d2('0x67')](path[_0xd3d2('0x68')](config[_0xd3d2('0x69')],_0xd3d2('0x6c')),_0xd3d2('0x6b'));var _0x3a1f6e=ejs[_0xd3d2('0x6d')](_0x4fc7f6,{'trunks':_0x29a32b||[]});fs[_0xd3d2('0x6e')](_0xd3d2('0x6f'),_0x3a1f6e);if(_0x52f223[_0xd3d2('0x70')]){var _0x5d2fe5=ejs[_0xd3d2('0x6d')](_0x4319c8,{'trunks':_0x29a32b||[]});fs[_0xd3d2('0x6e')](_0xd3d2('0x71'),_0x5d2fe5);}})[_0xd3d2('0x38')](function(){return respondWithRpcPromise(_0xd3d2('0x72'),'create',{'module':_0xd3d2('0x73')});})[_0xd3d2('0x38')](function(){var _0x2f6518=_0x2f947a[_0xd3d2('0x5f')][_0xd3d2('0x39')]({'plain':!![]});if(!_0x2f6518)throw new Error(_0xd3d2('0x60'));if(_0x2f6518[_0xd3d2('0x61')]==='user'){var _0x41f464=_0x52f223[_0xd3d2('0x39')]({'plain':!![]});return db[_0xd3d2('0x62')]['find']({'where':{'name':_0xd3d2('0x3a'),'userProfileId':_0x2f6518[_0xd3d2('0x63')]},'raw':!![]})[_0xd3d2('0x38')](function(_0x576e3d){if(_0x576e3d&&_0x576e3d[_0xd3d2('0x64')]===0x0){return db[_0xd3d2('0x3b')][_0xd3d2('0x5e')]({'name':_0x41f464[_0xd3d2('0x3d')],'resourceId':_0x41f464['id'],'type':_0x576e3d[_0xd3d2('0x3d')],'sectionId':_0x576e3d['id']},{})[_0xd3d2('0x38')](function(){return _0x52f223;});}else{return _0x52f223;}})[_0xd3d2('0x28')](function(_0x5f4bfe){logger[_0xd3d2('0x23')](_0xd3d2('0x65'),_0x5f4bfe);throw _0x5f4bfe;});}return _0x52f223;})[_0xd3d2('0x38')](respondWithResult(_0x30a20a,0xc9))[_0xd3d2('0x28')](handleError(_0x30a20a,null));};exports[_0xd3d2('0x36')]=function(_0x3cb44b,_0x596473,_0x90678f){var _0xcac54d;return db['Trunk']['find']({'where':{'id':_0x3cb44b[_0xd3d2('0x56')]['id']}})[_0xd3d2('0x38')](handleEntityNotFound(_0x596473,null))[_0xd3d2('0x38')](saveUpdates(_0x3cb44b[_0xd3d2('0x5c')],null))[_0xd3d2('0x38')](function(_0x54a9ed){if(_0x54a9ed){_0xcac54d=_0x54a9ed;return db['Trunk'][_0xd3d2('0x66')]({'raw':!![]});}})['then'](function(_0x5b5810){if(_0x5b5810){var _0x266038=fs[_0xd3d2('0x67')](path['join'](config[_0xd3d2('0x69')],'server/files/templates/trunk.ejs'),'utf8');var _0x5ad8e0=fs[_0xd3d2('0x67')](path[_0xd3d2('0x68')](config[_0xd3d2('0x69')],_0xd3d2('0x6c')),_0xd3d2('0x6b'));var _0xbaf177=ejs['render'](_0x266038,{'trunks':_0x5b5810||[]});fs[_0xd3d2('0x6e')](_0xd3d2('0x6f'),_0xbaf177);var _0x4f8604=ejs['render'](_0x5ad8e0,{'trunks':_0x5b5810||[]});fs[_0xd3d2('0x6e')]('/etc/asterisk/sip_xcally_registers.conf',_0x4f8604);return respondWithRpcPromise('Reload',_0xd3d2('0x36'),{'module':'chan_sip.so'});}return null;})[_0xd3d2('0x38')](function(_0x475f01){if(_0x475f01){return _0xcac54d;}})[_0xd3d2('0x38')](respondWithResult(_0x596473,null))[_0xd3d2('0x28')](handleError(_0x596473,null));};exports[_0xd3d2('0x37')]=function(_0x32755a,_0x52603f,_0x2f80c5){var _0x382bd0;return db[_0xd3d2('0x40')][_0xd3d2('0x58')]({'where':{'id':_0x32755a[_0xd3d2('0x56')]['id']}})[_0xd3d2('0x38')](handleEntityNotFound(_0x52603f,null))['then'](removeEntity(_0x52603f,null))[_0xd3d2('0x38')](function(){return db[_0xd3d2('0x40')]['findAll']({'raw':!![]});})[_0xd3d2('0x38')](function(_0x3aadda){var _0x4f223b=fs[_0xd3d2('0x67')](path[_0xd3d2('0x68')](config[_0xd3d2('0x69')],_0xd3d2('0x6a')),'utf8');var _0x6b03ac=fs[_0xd3d2('0x67')](path[_0xd3d2('0x68')](config[_0xd3d2('0x69')],_0xd3d2('0x6c')),'utf8');var _0x52dc06=ejs[_0xd3d2('0x6d')](_0x4f223b,{'trunks':_0x3aadda});var _0x61850c=ejs['render'](_0x6b03ac,{'trunks':_0x3aadda});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x52dc06);fs['writeFileSync'](_0xd3d2('0x71'),_0x61850c);return respondWithRpcPromise('Reload',_0xd3d2('0x37'),{'module':'chan_sip.so'});})[_0xd3d2('0x28')](handleError(_0x52603f,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 18ad66b..d1af597 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 _0xdaeb=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./trunk.attributes','Trunk','tools_trunks','lodash'];(function(_0x3f758f,_0x34d779){var _0x19f92f=function(_0x44ddee){while(--_0x44ddee){_0x3f758f['push'](_0x3f758f['shift']());}};_0x19f92f(++_0x34d779);}(_0xdaeb,0x1ac));var _0xbdae=function(_0x5bbdae,_0x474f05){_0x5bbdae=_0x5bbdae-0x0;var _0x6d5e29=_0xdaeb[_0x5bbdae];return _0x6d5e29;};'use strict';var _=require(_0xbdae('0x0'));var util=require(_0xbdae('0x1'));var logger=require(_0xbdae('0x2'))(_0xbdae('0x3'));var moment=require(_0xbdae('0x4'));var BPromise=require(_0xbdae('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbdae('0x6'));var rimraf=require('rimraf');var config=require(_0xbdae('0x7'));var attributes=require(_0xbdae('0x8'));module['exports']=function(_0x570c27,_0x51531a){return _0x570c27['define'](_0xbdae('0x9'),attributes,{'tableName':_0xbdae('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6cb=['path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1f535b,_0xc42523){var _0x5bb329=function(_0xcaa78d){while(--_0xcaa78d){_0x1f535b['push'](_0x1f535b['shift']());}};_0x5bb329(++_0xc42523);}(_0xe6cb,0x158));var _0xbe6c=function(_0xc754da,_0x33c76c){_0xc754da=_0xc754da-0x0;var _0x46c9f6=_0xe6cb[_0xc754da];return _0x46c9f6;};'use strict';var _=require(_0xbe6c('0x0'));var util=require('util');var logger=require(_0xbe6c('0x1'))(_0xbe6c('0x2'));var moment=require(_0xbe6c('0x3'));var BPromise=require(_0xbe6c('0x4'));var rp=require(_0xbe6c('0x5'));var fs=require('fs');var path=require(_0xbe6c('0x6'));var rimraf=require(_0xbe6c('0x7'));var config=require(_0xbe6c('0x8'));var attributes=require(_0xbe6c('0x9'));module[_0xbe6c('0xa')]=function(_0x21cb16,_0x5e7e86){return _0x21cb16[_0xbe6c('0xb')](_0xbe6c('0xc'),attributes,{'tableName':_0xbe6c('0xd'),'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 db8bc07..5235322 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 _0x9ffd=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Trunk,\x20%s,\x20%s','info','catch','GetTrunk','Trunk','findAll','options','raw','include','map','model','attributes','where','ShowTrunk'];(function(_0x36d6f3,_0x5366e1){var _0x29e502=function(_0x192238){while(--_0x192238){_0x36d6f3['push'](_0x36d6f3['shift']());}};_0x29e502(++_0x5366e1);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4e9393,_0x538474){_0x4e9393=_0x4e9393-0x0;var _0x18d437=_0x9ffd[_0x4e9393];return _0x18d437;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('Trunk,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('Trunk,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('Trunk,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});}exports[_0xd9ff('0x17')]=function(_0x3afd19){var _0x5f45c4=this;return new Promise(function(_0x2d4df1,_0x3ccf15){return db[_0xd9ff('0x18')][_0xd9ff('0x19')]({'raw':_0x3afd19[_0xd9ff('0x1a')]?_0x3afd19[_0xd9ff('0x1a')][_0xd9ff('0x1b')]===undefined?!![]:![]:!![],'where':_0x3afd19[_0xd9ff('0x1a')]?_0x3afd19['options']['where']||null:null,'attributes':_0x3afd19[_0xd9ff('0x1a')]?_0x3afd19[_0xd9ff('0x1a')]['attributes']||null:null,'limit':_0x3afd19['options']?_0x3afd19['options']['limit']||null:null,'include':_0x3afd19[_0xd9ff('0x1a')]?_0x3afd19['options'][_0xd9ff('0x1c')]?_[_0xd9ff('0x1d')](_0x3afd19[_0xd9ff('0x1a')][_0xd9ff('0x1c')],function(_0x278b66){return{'model':db[_0x278b66[_0xd9ff('0x1e')]],'as':_0x278b66['as'],'attributes':_0x278b66['attributes'],'include':_0x278b66['include']?_[_0xd9ff('0x1d')](_0x278b66['include'],function(_0x3ca906){return{'model':db[_0x3ca906['model']],'as':_0x3ca906['as'],'attributes':_0x3ca906[_0xd9ff('0x1f')],'include':_0x3ca906['include']?_[_0xd9ff('0x1d')](_0x3ca906[_0xd9ff('0x1c')],function(_0x2138b4){return{'model':db[_0x2138b4[_0xd9ff('0x1e')]],'as':_0x2138b4['as'],'attributes':_0x2138b4['attributes']};}):[]};}):[]};}):[]:[]})[_0xd9ff('0xc')](function(_0xe11f88){logger[_0xd9ff('0x15')](_0xd9ff('0x17'),_0x3afd19);logger['debug'](_0xd9ff('0x17'),_0x3afd19,JSON[_0xd9ff('0x10')](_0xe11f88));_0x2d4df1(_0xe11f88);})[_0xd9ff('0x16')](function(_0x45fb63){logger[_0xd9ff('0x11')](_0xd9ff('0x17'),_0x45fb63[_0xd9ff('0x13')],_0x3afd19);_0x3ccf15(_0x5f45c4[_0xd9ff('0x11')](0x1f4,_0x45fb63[_0xd9ff('0x13')]));});});};exports['ShowTrunk']=function(_0xcea5db){var _0x4ba2be=this;return new Promise(function(_0x1d55fd,_0x29c532){return db[_0xd9ff('0x18')]['find']({'raw':_0xcea5db[_0xd9ff('0x1a')]?_0xcea5db[_0xd9ff('0x1a')][_0xd9ff('0x1b')]===undefined?!![]:![]:!![],'where':_0xcea5db[_0xd9ff('0x1a')]?_0xcea5db['options'][_0xd9ff('0x20')]||null:null,'attributes':_0xcea5db['options']?_0xcea5db[_0xd9ff('0x1a')][_0xd9ff('0x1f')]||null:null,'include':_0xcea5db[_0xd9ff('0x1a')]?_0xcea5db[_0xd9ff('0x1a')][_0xd9ff('0x1c')]?_[_0xd9ff('0x1d')](_0xcea5db[_0xd9ff('0x1a')][_0xd9ff('0x1c')],function(_0x36749c){return{'model':db[_0x36749c[_0xd9ff('0x1e')]],'as':_0x36749c['as'],'attributes':_0x36749c[_0xd9ff('0x1f')],'include':_0x36749c[_0xd9ff('0x1c')]?_[_0xd9ff('0x1d')](_0x36749c[_0xd9ff('0x1c')],function(_0x498025){return{'model':db[_0x498025[_0xd9ff('0x1e')]],'as':_0x498025['as'],'attributes':_0x498025[_0xd9ff('0x1f')],'include':_0x498025[_0xd9ff('0x1c')]?_['map'](_0x498025[_0xd9ff('0x1c')],function(_0x5e3ff9){return{'model':db[_0x5e3ff9[_0xd9ff('0x1e')]],'as':_0x5e3ff9['as'],'attributes':_0x5e3ff9['attributes']};}):[]};}):[]};}):[]:[]})[_0xd9ff('0xc')](function(_0x5db498){logger[_0xd9ff('0x15')](_0xd9ff('0x21'),_0xcea5db);logger[_0xd9ff('0xd')]('ShowTrunk',_0xcea5db,JSON['stringify'](_0x5db498));_0x1d55fd(_0x5db498);})['catch'](function(_0x7ac3d1){logger[_0xd9ff('0x11')](_0xd9ff('0x21'),_0x7ac3d1[_0xd9ff('0x13')],_0xcea5db);_0x29c532(_0x4ba2be[_0xd9ff('0x11')](0x1f4,_0x7ac3d1[_0xd9ff('0x13')]));});});}; \ No newline at end of file +var _0x5eb8=['where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','message','catch','Trunk','findAll','options','raw','limit','include','model','attributes','map','then','GetTrunk','stringify','ShowTrunk'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5eb8,0xb0));var _0x85eb=function(_0x139b85,_0x5e0691){_0x139b85=_0x139b85-0x0;var _0x1e833f=_0x5eb8[_0x139b85];return _0x1e833f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('Trunk,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('Trunk,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('Trunk,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});}exports['GetTrunk']=function(_0x50d2a8){var _0xe198ca=this;return new Promise(function(_0x39ca96,_0x10cf2f){return db[_0x85eb('0x15')][_0x85eb('0x16')]({'raw':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8['options'][_0x85eb('0x18')]===undefined?!![]:![]:!![],'where':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')]['where']||null:null,'attributes':_0x50d2a8['options']?_0x50d2a8['options']['attributes']||null:null,'limit':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x19')]||null:null,'include':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x1a')]?_['map'](_0x50d2a8['options']['include'],function(_0x298e84){return{'model':db[_0x298e84[_0x85eb('0x1b')]],'as':_0x298e84['as'],'attributes':_0x298e84[_0x85eb('0x1c')],'include':_0x298e84[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x298e84[_0x85eb('0x1a')],function(_0x5dfc96){return{'model':db[_0x5dfc96[_0x85eb('0x1b')]],'as':_0x5dfc96['as'],'attributes':_0x5dfc96[_0x85eb('0x1c')],'include':_0x5dfc96[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x5dfc96[_0x85eb('0x1a')],function(_0x57a03c){return{'model':db[_0x57a03c[_0x85eb('0x1b')]],'as':_0x57a03c['as'],'attributes':_0x57a03c[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x3e7eb9){logger[_0x85eb('0xd')](_0x85eb('0x1f'),_0x50d2a8);logger['debug']('GetTrunk',_0x50d2a8,JSON[_0x85eb('0x20')](_0x3e7eb9));_0x39ca96(_0x3e7eb9);})['catch'](function(_0xa9b14f){logger['error'](_0x85eb('0x1f'),_0xa9b14f[_0x85eb('0x13')],_0x50d2a8);_0x10cf2f(_0xe198ca[_0x85eb('0x12')](0x1f4,_0xa9b14f[_0x85eb('0x13')]));});});};exports[_0x85eb('0x21')]=function(_0xf4ac13){var _0x41ed76=this;return new Promise(function(_0x5decd5,_0x237f19){return db[_0x85eb('0x15')]['find']({'raw':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13['options']['raw']===undefined?!![]:![]:!![],'where':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x22')]||null:null,'attributes':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1c')]||null:null,'include':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0xf4ac13['options'][_0x85eb('0x1a')],function(_0x3a5b87){return{'model':db[_0x3a5b87['model']],'as':_0x3a5b87['as'],'attributes':_0x3a5b87['attributes'],'include':_0x3a5b87[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x3a5b87[_0x85eb('0x1a')],function(_0x12cb4c){return{'model':db[_0x12cb4c[_0x85eb('0x1b')]],'as':_0x12cb4c['as'],'attributes':_0x12cb4c[_0x85eb('0x1c')],'include':_0x12cb4c[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x12cb4c[_0x85eb('0x1a')],function(_0x373e5f){return{'model':db[_0x373e5f[_0x85eb('0x1b')]],'as':_0x373e5f['as'],'attributes':_0x373e5f[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x33605a){logger['info'](_0x85eb('0x21'),_0xf4ac13);logger[_0x85eb('0x10')]('ShowTrunk',_0xf4ac13,JSON['stringify'](_0x33605a));_0x5decd5(_0x33605a);})[_0x85eb('0x14')](function(_0xe22d16){logger['error'](_0x85eb('0x21'),_0xe22d16['message'],_0xf4ac13);_0x237f19(_0x41ed76[_0x85eb('0x12')](0x1f4,_0xe22d16['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 9ca575d..f34445f 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 _0xb492=['destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','index','get','/describe','isAuthenticated','describe','/whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','/:id/queues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','addContacts','post','/create_many','bulkCreate','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','update','/:id/password','changePassword','delete','removeQueues','removeTeams'];(function(_0x400fa2,_0x1304b4){var _0x4fe88b=function(_0x4dafc5){while(--_0x4dafc5){_0x400fa2['push'](_0x400fa2['shift']());}};_0x4fe88b(++_0x1304b4);}(_0xb492,0x172));var _0x2b49=function(_0x9d712e,_0x3d0c18){_0x9d712e=_0x9d712e-0x0;var _0x2f230d=_0xb492[_0x9d712e];return _0x2f230d;};'use strict';var multer=require('multer');var util=require(_0x2b49('0x0'));var path=require(_0x2b49('0x1'));var timeout=require(_0x2b49('0x2'));var express=require(_0x2b49('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2b49('0x4'));var interaction=require(_0x2b49('0x5'));var config=require(_0x2b49('0x6'));var controller=require(_0x2b49('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2b49('0x8')]);router[_0x2b49('0x9')](_0x2b49('0xa'),auth[_0x2b49('0xb')](),controller[_0x2b49('0xc')]);router[_0x2b49('0x9')](_0x2b49('0xd'),auth[_0x2b49('0xb')](),controller['whoami']);router[_0x2b49('0x9')](_0x2b49('0xe'),auth['isAuthenticated'](),controller[_0x2b49('0xf')]);router[_0x2b49('0x9')](_0x2b49('0x10'),auth['isAuthenticated'](),controller[_0x2b49('0x11')]);router[_0x2b49('0x9')](_0x2b49('0x12'),controller[_0x2b49('0x13')]);router[_0x2b49('0x9')](_0x2b49('0x14'),auth['isAuthenticated'](),controller['getOpenTabs']);router[_0x2b49('0x9')](_0x2b49('0x15'),auth['isAuthenticated'](),controller['getContacts']);router[_0x2b49('0x9')](_0x2b49('0x16'),auth[_0x2b49('0xb')](),controller['getQueues']);router[_0x2b49('0x9')](_0x2b49('0x17'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0x2b49('0x9')](_0x2b49('0x18'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x19')]);router[_0x2b49('0x9')](_0x2b49('0x1a'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x1b')]);router[_0x2b49('0x9')](_0x2b49('0x1c'),auth['isAuthenticated'](),controller[_0x2b49('0x1d')]);router['get'](_0x2b49('0x1e'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x1f')]);router[_0x2b49('0x9')](_0x2b49('0x20'),auth[_0x2b49('0xb')](),controller['getOpenchannelInteractions']);router[_0x2b49('0x9')](_0x2b49('0x21'),auth[_0x2b49('0xb')](),controller['getMailInteractions']);router[_0x2b49('0x9')]('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0x2b49('0x22')]);router[_0x2b49('0x9')](_0x2b49('0x23'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x24')]);router['get'](_0x2b49('0x25'),auth['isAuthenticated'](),controller[_0x2b49('0x26')]);router[_0x2b49('0x9')](_0x2b49('0x27'),auth[_0x2b49('0xb')](),controller['getTeams']);router[_0x2b49('0x9')](_0x2b49('0x28'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x29')]);router[_0x2b49('0x9')](_0x2b49('0x2a'),auth['isAuthenticated'](),controller[_0x2b49('0x2b')]);router[_0x2b49('0x9')](_0x2b49('0x2c'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x2d')]);router[_0x2b49('0x9')](_0x2b49('0x2e'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x2f')]);router['get'](_0x2b49('0x30'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x31')]);router['get']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x2b49('0x32')]);router[_0x2b49('0x9')](_0x2b49('0x33'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x34')]);router[_0x2b49('0x9')](_0x2b49('0x35'),auth['isAuthenticated'](),controller[_0x2b49('0x36')]);router[_0x2b49('0x9')](_0x2b49('0x37'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x38')]);router[_0x2b49('0x9')](_0x2b49('0x39'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x3a')]);router[_0x2b49('0x9')](_0x2b49('0x3b'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x3c')]);router[_0x2b49('0x9')]('/:id/api_key',auth[_0x2b49('0xb')](),controller['getApiKey']);router['post']('/:id/contacts',auth[_0x2b49('0xb')](),controller[_0x2b49('0x3d')]);router[_0x2b49('0x3e')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x2b49('0x3f'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x40')]);router['post'](_0x2b49('0x16'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x18dad5,_0x2859fe,_0x5ccead){_0x5ccead(null,path['join'](config[_0x2b49('0x41')],_0x2b49('0x42')));},'filename':function(_0x340a45,_0x299ce2,_0x51d9f8){_0x51d9f8(null,util[_0x2b49('0x43')](_0x2b49('0x44'),Date[_0x2b49('0x45')](),_0x299ce2[_0x2b49('0x46')]));}})});router[_0x2b49('0x3e')]('/:id/avatar',upload[_0x2b49('0x47')](_0x2b49('0x48')),controller[_0x2b49('0x49')]);router[_0x2b49('0x3e')](_0x2b49('0x4a'),auth['isAuthenticated'](),controller['login']);router[_0x2b49('0x3e')](_0x2b49('0x4b'),auth['isAuthenticated'](),controller[_0x2b49('0x4c')]);router['post'](_0x2b49('0x4d'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x4e')]);router[_0x2b49('0x3e')]('/:id/unpause',auth['isAuthenticated'](),controller[_0x2b49('0x4f')]);router[_0x2b49('0x3e')]('/:id/teams',auth[_0x2b49('0xb')](),controller[_0x2b49('0x50')]);router[_0x2b49('0x3e')](_0x2b49('0x51'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x52')]);router[_0x2b49('0x3e')](_0x2b49('0x53'),auth[_0x2b49('0xb')](),controller['addMailInteractions']);router['post']('/:id/fax_interactions',auth[_0x2b49('0xb')](),controller[_0x2b49('0x54')]);router[_0x2b49('0x3e')](_0x2b49('0x55'),auth['isAuthenticated'](),controller[_0x2b49('0x56')]);router[_0x2b49('0x3e')](_0x2b49('0x57'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x58')]);router[_0x2b49('0x3e')](_0x2b49('0x59'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x5a')]);router[_0x2b49('0x3e')]('/:id/fax_accounts',auth[_0x2b49('0xb')](),controller['addFaxAccounts']);router[_0x2b49('0x3e')](_0x2b49('0x30'),auth['isAuthenticated'](),controller[_0x2b49('0x5b')]);router[_0x2b49('0x3e')](_0x2b49('0x5c'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x5d')]);router['post'](_0x2b49('0x33'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x5e')]);router['post']('/:id/chat_websites',auth[_0x2b49('0xb')](),controller[_0x2b49('0x5f')]);router['post']('/:id/whatsapp_accounts',auth[_0x2b49('0xb')](),controller[_0x2b49('0x60')]);router[_0x2b49('0x3e')]('/:id/square_projects',auth[_0x2b49('0xb')](),controller[_0x2b49('0x61')]);router[_0x2b49('0x3e')](_0x2b49('0x62'),auth['isAuthenticated'](),controller[_0x2b49('0x63')]);router['put'](_0x2b49('0x10'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x64')]);router['put'](_0x2b49('0x65'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x66')]);router[_0x2b49('0x67')](_0x2b49('0x16'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x68')]);router[_0x2b49('0x67')](_0x2b49('0x27'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x69')]);router[_0x2b49('0x67')](_0x2b49('0x10'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x6a')]);router[_0x2b49('0x67')](_0x2b49('0x51'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x6b')]);router[_0x2b49('0x67')](_0x2b49('0x53'),auth['isAuthenticated'](),controller[_0x2b49('0x6c')]);router['delete']('/:id/fax_interactions',auth[_0x2b49('0xb')](),controller[_0x2b49('0x6d')]);router[_0x2b49('0x67')](_0x2b49('0x55'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x6e')]);router[_0x2b49('0x67')]('/:id/openchannel_interactions',auth[_0x2b49('0xb')](),controller[_0x2b49('0x6f')]);router['delete']('/:id/whatsapp_interactions',auth[_0x2b49('0xb')](),controller[_0x2b49('0x70')]);router[_0x2b49('0x67')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x2b49('0x71')]);router[_0x2b49('0x67')](_0x2b49('0x30'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x2b49('0x67')](_0x2b49('0x5c'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x72')]);router['delete'](_0x2b49('0x33'),auth['isAuthenticated'](),controller[_0x2b49('0x73')]);router[_0x2b49('0x67')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x2b49('0x74')]);router[_0x2b49('0x67')](_0x2b49('0x37'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x75')]);router[_0x2b49('0x67')](_0x2b49('0x39'),auth[_0x2b49('0xb')](),controller['removeSquareProjects']);router[_0x2b49('0x67')](_0x2b49('0x62'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x76')]);module['exports']=router; \ No newline at end of file +var _0x7d55=['removeChatWebsites','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','isAuthenticated','index','/describe','whoami','/:id','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues_rt','getVoiceQueuesRt','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','post','addContacts','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','root','server/files/images/','format','%s-%s','now','originalname','file','/:id/login','login','logout','/:id/pause','/:id/unpause','unpause','addTeams','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','update','put','/:id/password','changePassword','delete','removeQueues','destroy','/:id/chat_interactions','removeChatInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeSmsAccounts'];(function(_0x1bcc0d,_0x159cea){var _0x4adde9=function(_0x260d34){while(--_0x260d34){_0x1bcc0d['push'](_0x1bcc0d['shift']());}};_0x4adde9(++_0x159cea);}(_0x7d55,0x1bc));var _0x57d5=function(_0x252221,_0x2e5dbf){_0x252221=_0x252221-0x0;var _0x4ce7c6=_0x7d55[_0x252221];return _0x4ce7c6;};'use strict';var multer=require(_0x57d5('0x0'));var util=require(_0x57d5('0x1'));var path=require(_0x57d5('0x2'));var timeout=require(_0x57d5('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x57d5('0x4'));var auth=require(_0x57d5('0x5'));var interaction=require(_0x57d5('0x6'));var config=require('../../config/environment');var controller=require(_0x57d5('0x7'));router[_0x57d5('0x8')]('/',auth[_0x57d5('0x9')](),controller[_0x57d5('0xa')]);router[_0x57d5('0x8')](_0x57d5('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/whoami',auth[_0x57d5('0x9')](),controller[_0x57d5('0xc')]);router['get']('/presence',auth[_0x57d5('0x9')](),controller['getPresence']);router[_0x57d5('0x8')](_0x57d5('0xd'),auth[_0x57d5('0x9')](),controller['show']);router['get'](_0x57d5('0xe'),controller['getAvatar']);router[_0x57d5('0x8')](_0x57d5('0xf'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x10')]);router[_0x57d5('0x8')](_0x57d5('0x11'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x12')]);router['get']('/:id/queues',auth[_0x57d5('0x9')](),controller['getQueues']);router[_0x57d5('0x8')](_0x57d5('0x13'),auth['isAuthenticated'](),controller[_0x57d5('0x14')]);router['get']('/:id/groups',auth[_0x57d5('0x9')](),controller[_0x57d5('0x15')]);router['get']('/:id/recordings',auth[_0x57d5('0x9')](),controller[_0x57d5('0x16')]);router[_0x57d5('0x8')](_0x57d5('0x17'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x18')]);router['get'](_0x57d5('0x19'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x1a')]);router[_0x57d5('0x8')](_0x57d5('0x1b'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x1c')]);router['get']('/:id/mail/interactions',auth[_0x57d5('0x9')](),controller['getMailInteractions']);router[_0x57d5('0x8')](_0x57d5('0x1d'),auth['isAuthenticated'](),controller[_0x57d5('0x1e')]);router['get'](_0x57d5('0x1f'),auth['isAuthenticated'](),controller[_0x57d5('0x20')]);router[_0x57d5('0x8')](_0x57d5('0x21'),auth['isAuthenticated'](),controller['getWhatsappInteractions']);router['get'](_0x57d5('0x22'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x23')]);router[_0x57d5('0x8')](_0x57d5('0x24'),auth[_0x57d5('0x9')](),controller['getLists']);router[_0x57d5('0x8')](_0x57d5('0x25'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x26')]);router[_0x57d5('0x8')](_0x57d5('0x27'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x28')]);router['get'](_0x57d5('0x29'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x2a')]);router[_0x57d5('0x8')](_0x57d5('0x2b'),auth['isAuthenticated'](),controller[_0x57d5('0x2c')]);router[_0x57d5('0x8')]('/:id/openchannel_accounts',auth[_0x57d5('0x9')](),controller[_0x57d5('0x2d')]);router['get'](_0x57d5('0x2e'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x2f')]);router[_0x57d5('0x8')](_0x57d5('0x30'),auth['isAuthenticated'](),controller['getChatWebsites']);router[_0x57d5('0x8')](_0x57d5('0x31'),auth['isAuthenticated'](),controller[_0x57d5('0x32')]);router[_0x57d5('0x8')](_0x57d5('0x33'),auth['isAuthenticated'](),controller[_0x57d5('0x34')]);router[_0x57d5('0x8')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0x57d5('0x35')]);router[_0x57d5('0x8')](_0x57d5('0x36'),auth[_0x57d5('0x9')](),controller['getApiKey']);router[_0x57d5('0x37')]('/:id/contacts',auth[_0x57d5('0x9')](),controller[_0x57d5('0x38')]);router[_0x57d5('0x37')]('/',auth[_0x57d5('0x9')](),controller['create']);router[_0x57d5('0x37')](_0x57d5('0x39'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x3a')]);router[_0x57d5('0x37')](_0x57d5('0x3b'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x3c')]);var upload=multer({'storage':multer[_0x57d5('0x3d')]({'destination':function(_0x530958,_0x373421,_0xbaebba){_0xbaebba(null,path['join'](config[_0x57d5('0x3e')],_0x57d5('0x3f')));},'filename':function(_0x201992,_0xeba720,_0x208ec3){_0x208ec3(null,util[_0x57d5('0x40')](_0x57d5('0x41'),Date[_0x57d5('0x42')](),_0xeba720[_0x57d5('0x43')]));}})});router[_0x57d5('0x37')](_0x57d5('0xe'),upload['single'](_0x57d5('0x44')),controller['addAvatar']);router[_0x57d5('0x37')](_0x57d5('0x45'),auth['isAuthenticated'](),controller[_0x57d5('0x46')]);router[_0x57d5('0x37')]('/:id/logout',auth[_0x57d5('0x9')](),controller[_0x57d5('0x47')]);router[_0x57d5('0x37')](_0x57d5('0x48'),auth[_0x57d5('0x9')](),controller['pause']);router[_0x57d5('0x37')](_0x57d5('0x49'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x4a')]);router['post'](_0x57d5('0x22'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x4b')]);router[_0x57d5('0x37')]('/:id/chat_interactions',auth[_0x57d5('0x9')](),controller['addChatInteractions']);router[_0x57d5('0x37')](_0x57d5('0x4c'),auth[_0x57d5('0x9')](),controller['addMailInteractions']);router['post'](_0x57d5('0x4d'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x4e')]);router['post'](_0x57d5('0x4f'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x50')]);router[_0x57d5('0x37')](_0x57d5('0x51'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x52')]);router[_0x57d5('0x37')](_0x57d5('0x53'),auth['isAuthenticated'](),controller[_0x57d5('0x54')]);router[_0x57d5('0x37')](_0x57d5('0x29'),auth[_0x57d5('0x9')](),controller['addFaxAccounts']);router[_0x57d5('0x37')]('/:id/mail_accounts',auth[_0x57d5('0x9')](),controller[_0x57d5('0x55')]);router[_0x57d5('0x37')](_0x57d5('0x56'),auth['isAuthenticated'](),controller[_0x57d5('0x57')]);router[_0x57d5('0x37')](_0x57d5('0x2e'),auth['isAuthenticated'](),controller[_0x57d5('0x58')]);router['post'](_0x57d5('0x30'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x59')]);router[_0x57d5('0x37')](_0x57d5('0x31'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x5a')]);router[_0x57d5('0x37')](_0x57d5('0x33'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x5b')]);router[_0x57d5('0x37')](_0x57d5('0x36'),auth['isAuthenticated'](),controller['createApiKey']);router['put']('/:id',auth[_0x57d5('0x9')](),controller[_0x57d5('0x5c')]);router[_0x57d5('0x5d')](_0x57d5('0x5e'),auth['isAuthenticated'](),controller[_0x57d5('0x5f')]);router[_0x57d5('0x60')](_0x57d5('0x3b'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x61')]);router[_0x57d5('0x60')]('/:id/teams',auth[_0x57d5('0x9')](),controller['removeTeams']);router['delete'](_0x57d5('0xd'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x62')]);router[_0x57d5('0x60')](_0x57d5('0x63'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x64')]);router['delete'](_0x57d5('0x4c'),auth[_0x57d5('0x9')](),controller['removeMailInteractions']);router[_0x57d5('0x60')](_0x57d5('0x4d'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x65')]);router['delete'](_0x57d5('0x4f'),auth[_0x57d5('0x9')](),controller['removeSmsInteractions']);router['delete'](_0x57d5('0x51'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x66')]);router[_0x57d5('0x60')](_0x57d5('0x53'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x67')]);router[_0x57d5('0x60')](_0x57d5('0x29'),auth['isAuthenticated'](),controller[_0x57d5('0x68')]);router[_0x57d5('0x60')](_0x57d5('0x2b'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x57d5('0x60')](_0x57d5('0x56'),auth[_0x57d5('0x9')](),controller['removeOpenchannelAccounts']);router[_0x57d5('0x60')](_0x57d5('0x2e'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x69')]);router[_0x57d5('0x60')](_0x57d5('0x30'),auth['isAuthenticated'](),controller[_0x57d5('0x6a')]);router['delete'](_0x57d5('0x31'),auth[_0x57d5('0x9')](),controller['removeWhatsappAccounts']);router[_0x57d5('0x60')](_0x57d5('0x33'),auth[_0x57d5('0x9')](),controller[_0x57d5('0x6b')]);router[_0x57d5('0x60')](_0x57d5('0x36'),auth['isAuthenticated'](),controller[_0x57d5('0x6c')]);module[_0x57d5('0x6d')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 779d831..ab052b9 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 _0x9513=['passive','actpass','update','update,nonat','TEXT','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlssetup','/etc/pki/tls/private/motion.key','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','moment','util','lodash','exports','STRING','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','callerid','\x22%s\x22\x20<%s>','email','toLowerCase','ENUM','admin','user','telephone','local','INTEGER','internal','format','getDataValue','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','accept','refuse','originate','uas','certificate'];(function(_0x3b71df,_0x274450){var _0x47cd2e=function(_0x4aec76){while(--_0x4aec76){_0x3b71df['push'](_0x3b71df['shift']());}};_0x47cd2e(++_0x274450);}(_0x9513,0x1ee));var _0x3951=function(_0x47adc0,_0x495c81){_0x47adc0=_0x47adc0-0x0;var _0x5e0cd5=_0x9513[_0x47adc0];return _0x5e0cd5;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3951('0x0'));var util=require(_0x3951('0x1'));var _=require(_0x3951('0x2'));module[_0x3951('0x3')]={'name':{'type':Sequelize[_0x3951('0x4')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2ee96c){this[_0x3951('0x5')](_0x3951('0x6'),_0x2ee96c);this['setDataValue'](_0x3951('0x7'),_0x2ee96c);},'comment':_0x3951('0x8')},'fullname':{'type':Sequelize[_0x3951('0x4')],'allowNull':![],'set':function(_0x240af8){this[_0x3951('0x5')]('fullname',_0x240af8);this[_0x3951('0x5')](_0x3951('0x9'),util['format'](_0x3951('0xa'),_0x240af8,this['getDataValue']('internal')));}},'alias':{'type':Sequelize[_0x3951('0x4')]},'email':{'type':Sequelize[_0x3951('0x4')],'allowNull':![],'unique':_0x3951('0xb'),'validate':{'isEmail':!![]},'set':function(_0x458dce){if(_0x458dce){this[_0x3951('0x5')](_0x3951('0xb'),_0x458dce[_0x3951('0xc')]());}}},'role':{'type':Sequelize[_0x3951('0xd')](_0x3951('0xe'),_0x3951('0xf'),'agent',_0x3951('0x10')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x3951('0x4')],'defaultValue':_0x3951('0x11')},'internal':{'type':Sequelize[_0x3951('0x12')](0xb),'allowNull':![],'unique':_0x3951('0x13'),'set':function(_0x2a1452){this['setDataValue'](_0x3951('0x13'),_0x2a1452);this[_0x3951('0x5')]('accountcode',_0x2a1452);this[_0x3951('0x5')](_0x3951('0x9'),util[_0x3951('0x14')](_0x3951('0xa'),this[_0x3951('0x15')](_0x3951('0x16')),_0x2a1452));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x3951('0x4')]},'mobile':{'type':Sequelize[_0x3951('0x4')]},'address':{'type':Sequelize[_0x3951('0x4')]},'zipcode':{'type':Sequelize[_0x3951('0x4')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x3951('0x4')]},'country':{'type':Sequelize[_0x3951('0x4')]},'online':{'type':Sequelize[_0x3951('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x3951('0x18')]},'voicePause':{'type':Sequelize[_0x3951('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x3951('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x3951('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x3951('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x3951('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x3951('0x4')],'defaultValue':_0x3951('0x19')},'lastPauseAt':{'type':Sequelize[_0x3951('0x18')]},'chatCapacity':{'type':Sequelize[_0x3951('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x3951('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x3951('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x3951('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x3951('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x3951('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x3951('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x3951('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x3951('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x3951('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x3951('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x3951('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x3951('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x1a'),'user',_0x3951('0x1b')),'allowNull':!![],'defaultValue':_0x3951('0x1a')},'context':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![],'defaultValue':_0x3951('0x1c')},'callingpres':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x1d'),_0x3951('0x1e'),_0x3951('0x1f'),_0x3951('0x20'),_0x3951('0x21'),'PROHIB_PASSED_SCREEN',_0x3951('0x22'),_0x3951('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![],'defaultValue':_0x3951('0x24'),'set':function(_0x18fd00){this[_0x3951('0x5')](_0x3951('0x25'),_0x18fd00?_0x18fd00['join'](','):null);},'get':function(){return this[_0x3951('0x15')](_0x3951('0x25'))?this[_0x3951('0x15')]('transport')[_0x3951('0x26')](','):null;},'comment':_0x3951('0x27')},'dtmfmode':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x28'),_0x3951('0x29'),_0x3951('0x2a'),_0x3951('0x2b'),_0x3951('0x2c')),'allowNull':!![],'defaultValue':_0x3951('0x28')},'directmedia':{'type':Sequelize['ENUM'](_0x3951('0x2d'),'no',_0x3951('0x2e'),'update',_0x3951('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![],'defaultValue':_0x3951('0x30'),'set':function(_0x4e9817){this[_0x3951('0x5')](_0x3951('0x31'),_0x4e9817?_0x4e9817[_0x3951('0x32')](','):null);},'get':function(){return this['getDataValue'](_0x3951('0x31'))?this[_0x3951('0x15')](_0x3951('0x31'))[_0x3951('0x26')](','):null;},'comment':_0x3951('0x33')},'callgroup':{'type':Sequelize[_0x3951('0x4')]},'namedcallgroup':{'type':Sequelize[_0x3951('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x3951('0x4')]},'language':{'type':Sequelize[_0x3951('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3951('0x4')]},'disallow':{'type':Sequelize[_0x3951('0x4')],'allowNull':![],'defaultValue':_0x3951('0x34')},'allow':{'type':Sequelize[_0x3951('0x4')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x17ea5f){this[_0x3951('0x5')](_0x3951('0x35'),_0x17ea5f?_0x17ea5f[_0x3951('0x32')](';'):_0x3951('0x36'));},'get':function(){return this['getDataValue'](_0x3951('0x35'))?this['getDataValue']('allow')[_0x3951('0x26')](';'):null;},'comment':_0x3951('0x37')},'autoframing':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![],'set':function(_0x16152e){this[_0x3951('0x5')]('insecure',_0x16152e?_0x16152e[_0x3951('0x32')](','):null);},'get':function(){return this[_0x3951('0x15')]('insecure')?this['getDataValue'](_0x3951('0x38'))[_0x3951('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x3951('0x2d'),'no',_0x3951('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x3951('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x3951('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![],'defaultValue':_0x3951('0x3a')},'amaflags':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x3951('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x3951('0xd')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x3951('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x2d'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3951('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x3b'),_0x3951('0x3c'),_0x3951('0x3d')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x3951('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x3951('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac',_0x3951('0x3e')),'allowNull':!![],'defaultValue':_0x3951('0x3e')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x3951('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x3951('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x3951('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x3951('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x3951('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x3951('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x3951('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x3951('0xd')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x2d'),'no','fingerprint',_0x3951('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x3951('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x3951('0x40'),_0x3951('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x3951('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x3951('0xd')]('yes','no',_0x3951('0x2e'),_0x3951('0x42'),_0x3951('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x3951('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x3951('0x18')]},'passwordResetAt':{'type':Sequelize[_0x3951('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x3951('0x44')]},'showWebBar':{'type':Sequelize[_0x3951('0x12')],'defaultValue':0x0,'set':function(_0x4ee3df){this[_0x3951('0x5')](_0x3951('0x45'),_0x4ee3df);var _0x3612c4=this[_0x3951('0x46')]({'plain':!![]});switch(_0x4ee3df){case 0x0:case 0x1:var _0x31d084=_0x3612c4[_0x3951('0x25')]?_[_0x3951('0x47')](_0x3612c4['transport'])?_0x3612c4[_0x3951('0x25')][_0x3951('0x32')]():_0x3612c4[_0x3951('0x25')]:_0x3951('0x24');if(_0x31d084===_0x3951('0x48')){_0x31d084=_0x3951('0x24');}this[_0x3951('0x5')](_0x3951('0x25'),_0x31d084);this[_0x3951('0x5')](_0x3951('0x49'),'no');this[_0x3951('0x5')](_0x3951('0x4a'),null);this[_0x3951('0x5')](_0x3951('0x4b'),null);this[_0x3951('0x5')](_0x3951('0x4c'),null);this['setDataValue'](_0x3951('0x4d'),null);this[_0x3951('0x5')](_0x3951('0x4e'),null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x3951('0x4f'),null);this['setDataValue'](_0x3951('0x50'),null);this['setDataValue'](_0x3951('0x51'),'no');break;case 0x2:this[_0x3951('0x5')]('transport',_0x3951('0x48'));this[_0x3951('0x5')](_0x3951('0x49'),'yes');this[_0x3951('0x5')](_0x3951('0x4a'),_0x3951('0x2d'));this[_0x3951('0x5')](_0x3951('0x4b'),'yes');this[_0x3951('0x5')](_0x3951('0x4c'),'yes');this['setDataValue'](_0x3951('0x4d'),'yes');this[_0x3951('0x5')](_0x3951('0x4e'),'no');this[_0x3951('0x5')](_0x3951('0x52'),_0x3951('0x41'));this[_0x3951('0x5')](_0x3951('0x4f'),_0x3612c4[_0x3951('0x4f')]||'/etc/pki/tls/certs/motion.crt');this[_0x3951('0x5')](_0x3951('0x50'),_0x3612c4[_0x3951('0x50')]||_0x3951('0x53'));this[_0x3951('0x5')](_0x3951('0x51'),_0x3951('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0x3951('0x44')],'set':function(_0x3eaa96){this[_0x3951('0x5')](_0x3951('0x54'),_0x3eaa96?_0x3eaa96['join'](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0x3951('0x15')]('permissions')[_0x3951('0x26')](','),function(_0x7d485a){return parseInt(_0x7d485a,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x3951('0x4')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x3951('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x3951('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x3951('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x3951('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x3951('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x3951('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x3951('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x3951('0xd')](_0x3951('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x3951('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x3951('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x3951('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x3951('0x55')],'get':function(){return this[_0x3951('0x15')](_0x3951('0x56'))?this[_0x3951('0x15')](_0x3951('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x3951('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x3951('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x3951('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x3951('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x3951('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x3951('0x17')],'defaultValue':![],'set':function(_0x590ada){if(typeof _0x590ada==='string'){var _0x497672=_0x590ada==='1'?!![]:_0x590ada==='0'?![]:_0x590ada===_0x3951('0x57')?!![]:_0x590ada===_0x3951('0x58')?![]:![];this[_0x3951('0x5')]('screenrecording',_0x497672);}else{this[_0x3951('0x5')](_0x3951('0x59'),_0x590ada);}}},'blocked':{'type':Sequelize[_0x3951('0x17')],'defaultValue':![],'set':function(_0x66de3e){this[_0x3951('0x5')](_0x3951('0x5a'),_0x66de3e);if(_0x66de3e===!![]){this[_0x3951('0x5')](_0x3951('0x5b'),moment());this['setDataValue'](_0x3951('0x5c'),0x0);}else{this[_0x3951('0x5')](_0x3951('0x5b'),null);}}},'blockedAt':{'type':Sequelize[_0x3951('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x3951('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x3951('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x3951('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x3951('0x12')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x3951('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x3951('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x61e1=['ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','update','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','always','accept','refuse','uac','uas','fingerprint','active','actpass','update,nonat','TEXT','showWebBar','get','wss','avpf','force_avp','icesupport','dtlssetup','dtlscertfile','encryption','dtlsenable','dtlsverify','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','name','setDataValue','The\x20name\x20of\x20the\x20user','STRING','fullname','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','admin','user','telephone','local','INTEGER','accountcode','format','BOOLEAN','DATE','dynamic','ENUM','peer','friend','from-sip','ALLOWED_FAILED_SCREEN'];(function(_0x1fcf1b,_0x214549){var _0x5d2952=function(_0x3331b7){while(--_0x3331b7){_0x1fcf1b['push'](_0x1fcf1b['shift']());}};_0x5d2952(++_0x214549);}(_0x61e1,0x19b));var _0x161e=function(_0x3f7177,_0x3c7b79){_0x3f7177=_0x3f7177-0x0;var _0x5889ff=_0x61e1[_0x3f7177];return _0x5889ff;};'use strict';var Sequelize=require(_0x161e('0x0'));var moment=require(_0x161e('0x1'));var util=require(_0x161e('0x2'));var _=require(_0x161e('0x3'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x161e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x133dc2){this[_0x161e('0x5')](_0x161e('0x4'),_0x133dc2);this[_0x161e('0x5')]('defaultuser',_0x133dc2);},'comment':_0x161e('0x6')},'fullname':{'type':Sequelize[_0x161e('0x7')],'allowNull':![],'set':function(_0x4ca962){this[_0x161e('0x5')](_0x161e('0x8'),_0x4ca962);this[_0x161e('0x5')]('callerid',util['format'](_0x161e('0x9'),_0x4ca962,this[_0x161e('0xa')](_0x161e('0xb'))));}},'alias':{'type':Sequelize[_0x161e('0x7')]},'email':{'type':Sequelize[_0x161e('0x7')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x5a4af9){if(_0x5a4af9){this[_0x161e('0x5')](_0x161e('0xc'),_0x5a4af9[_0x161e('0xd')]());}}},'role':{'type':Sequelize['ENUM'](_0x161e('0xe'),_0x161e('0xf'),'agent',_0x161e('0x10')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x161e('0x7')],'defaultValue':_0x161e('0x11')},'internal':{'type':Sequelize[_0x161e('0x12')](0xb),'allowNull':![],'unique':_0x161e('0xb'),'set':function(_0x47d7f0){this['setDataValue'](_0x161e('0xb'),_0x47d7f0);this[_0x161e('0x5')](_0x161e('0x13'),_0x47d7f0);this[_0x161e('0x5')]('callerid',util[_0x161e('0x14')](_0x161e('0x9'),this[_0x161e('0xa')](_0x161e('0x8')),_0x47d7f0));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x161e('0x7')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x161e('0x7')]},'zipcode':{'type':Sequelize[_0x161e('0x7')]},'userpic':{'type':Sequelize[_0x161e('0x7')]},'city':{'type':Sequelize[_0x161e('0x7')]},'country':{'type':Sequelize[_0x161e('0x7')]},'online':{'type':Sequelize[_0x161e('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x161e('0x16')]},'voicePause':{'type':Sequelize[_0x161e('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x161e('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x161e('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x161e('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x161e('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x161e('0x7')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x161e('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x161e('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x161e('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x161e('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x161e('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x161e('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x161e('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x161e('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x161e('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x161e('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x161e('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x161e('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x161e('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x161e('0x17')},'ipaddr':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'port':{'type':Sequelize[_0x161e('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x161e('0x18')]('friend',_0x161e('0xf'),_0x161e('0x19')),'allowNull':!![],'defaultValue':_0x161e('0x1a')},'context':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![],'defaultValue':_0x161e('0x1b')},'callingpres':{'type':Sequelize[_0x161e('0x18')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x161e('0x1c'),_0x161e('0x1d'),'PROHIB_NOT_SCREENED',_0x161e('0x1e'),_0x161e('0x1f'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'permit':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'secret':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'transport':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![],'defaultValue':_0x161e('0x20'),'set':function(_0x330a88){this[_0x161e('0x5')]('transport',_0x330a88?_0x330a88[_0x161e('0x21')](','):null);},'get':function(){return this['getDataValue'](_0x161e('0x22'))?this['getDataValue'](_0x161e('0x22'))['split'](','):null;},'comment':_0x161e('0x23')},'dtmfmode':{'type':Sequelize[_0x161e('0x18')](_0x161e('0x24'),_0x161e('0x25'),_0x161e('0x26'),'inband',_0x161e('0x27')),'allowNull':!![],'defaultValue':_0x161e('0x24')},'directmedia':{'type':Sequelize[_0x161e('0x18')](_0x161e('0x28'),'no',_0x161e('0x29'),_0x161e('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x161e('0x18')](_0x161e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'nat':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![],'defaultValue':_0x161e('0x2b'),'set':function(_0x3aca07){this[_0x161e('0x5')](_0x161e('0x2c'),_0x3aca07?_0x3aca07[_0x161e('0x21')](','):null);},'get':function(){return this[_0x161e('0xa')]('nat')?this[_0x161e('0xa')](_0x161e('0x2c'))[_0x161e('0x2d')](','):null;},'comment':_0x161e('0x2e')},'callgroup':{'type':Sequelize[_0x161e('0x7')]},'namedcallgroup':{'type':Sequelize[_0x161e('0x7')]},'pickupgroup':{'type':Sequelize[_0x161e('0x7')]},'namedpickupgroup':{'type':Sequelize[_0x161e('0x7')]},'language':{'type':Sequelize[_0x161e('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x161e('0x7')]},'disallow':{'type':Sequelize[_0x161e('0x7')],'allowNull':![],'defaultValue':_0x161e('0x2f')},'allow':{'type':Sequelize[_0x161e('0x7')],'allowNull':![],'defaultValue':_0x161e('0x30'),'set':function(_0x59e4fa){this[_0x161e('0x5')](_0x161e('0x31'),_0x59e4fa?_0x59e4fa[_0x161e('0x21')](';'):_0x161e('0x30'));},'get':function(){return this[_0x161e('0xa')](_0x161e('0x31'))?this[_0x161e('0xa')]('allow')[_0x161e('0x2d')](';'):null;},'comment':_0x161e('0x32')},'autoframing':{'type':Sequelize[_0x161e('0x18')](_0x161e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![],'set':function(_0x45cd75){this[_0x161e('0x5')]('insecure',_0x45cd75?_0x45cd75[_0x161e('0x21')](','):null);},'get':function(){return this[_0x161e('0xa')](_0x161e('0x33'))?this['getDataValue'](_0x161e('0x33'))[_0x161e('0x2d')](','):null;},'comment':_0x161e('0x34')},'trustrpid':{'type':Sequelize[_0x161e('0x18')](_0x161e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x161e('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x161e('0x18')](_0x161e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x161e('0x18')](_0x161e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x161e('0x18')](_0x161e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x161e('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x161e('0x28')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x161e('0x18')](_0x161e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x161e('0x18')](_0x161e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x161e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x161e('0x18')](_0x161e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'template':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x161e('0x28'),'no',_0x161e('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x161e('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x161e('0x18')](_0x161e('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x161e('0x18')](_0x161e('0x36'),_0x161e('0x37'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x161e('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x161e('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x161e('0x18')](_0x161e('0x38'),_0x161e('0x39')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x161e('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x161e('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x161e('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x161e('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x161e('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x161e('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x161e('0x18')](_0x161e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x161e('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x161e('0x18')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x161e('0x18')](_0x161e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x161e('0x18')](_0x161e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x161e('0x28'),'no',_0x161e('0x3a'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x161e('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x161e('0x18')](_0x161e('0x3b'),'passive',_0x161e('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x161e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x161e('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x161e('0x18')](_0x161e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x161e('0x18')](_0x161e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x161e('0x29'),'update',_0x161e('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x161e('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x161e('0x7')]},'resetPasswordExpires':{'type':Sequelize[_0x161e('0x16')]},'passwordResetAt':{'type':Sequelize[_0x161e('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x161e('0x3e')]},'showWebBar':{'type':Sequelize[_0x161e('0x12')],'defaultValue':0x0,'set':function(_0x436fa8){this['setDataValue'](_0x161e('0x3f'),_0x436fa8);var _0x1aaff5=this[_0x161e('0x40')]({'plain':!![]});switch(_0x436fa8){case 0x0:case 0x1:var _0x4f8cd3=_0x1aaff5[_0x161e('0x22')]?_['isArray'](_0x1aaff5[_0x161e('0x22')])?_0x1aaff5[_0x161e('0x22')][_0x161e('0x21')]():_0x1aaff5[_0x161e('0x22')]:_0x161e('0x20');if(_0x4f8cd3===_0x161e('0x41')){_0x4f8cd3=_0x161e('0x20');}this[_0x161e('0x5')](_0x161e('0x22'),_0x4f8cd3);this[_0x161e('0x5')]('encryption','no');this['setDataValue'](_0x161e('0x42'),null);this['setDataValue'](_0x161e('0x43'),null);this[_0x161e('0x5')](_0x161e('0x44'),null);this[_0x161e('0x5')]('dtlsenable',null);this[_0x161e('0x5')]('dtlsverify',null);this['setDataValue'](_0x161e('0x45'),null);this[_0x161e('0x5')](_0x161e('0x46'),null);this[_0x161e('0x5')]('dtlsprivatekey',null);this[_0x161e('0x5')]('rtcp_mux','no');break;case 0x2:this[_0x161e('0x5')](_0x161e('0x22'),_0x161e('0x41'));this[_0x161e('0x5')](_0x161e('0x47'),_0x161e('0x28'));this['setDataValue'](_0x161e('0x42'),_0x161e('0x28'));this['setDataValue'](_0x161e('0x43'),_0x161e('0x28'));this['setDataValue']('icesupport','yes');this[_0x161e('0x5')](_0x161e('0x48'),'yes');this[_0x161e('0x5')](_0x161e('0x49'),'no');this[_0x161e('0x5')](_0x161e('0x45'),_0x161e('0x3c'));this['setDataValue']('dtlscertfile',_0x1aaff5[_0x161e('0x46')]||_0x161e('0x4a'));this[_0x161e('0x5')]('dtlsprivatekey',_0x1aaff5[_0x161e('0x4b')]||_0x161e('0x4c'));this['setDataValue'](_0x161e('0x4d'),_0x161e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x161e('0x3e')],'set':function(_0x2d87d1){this[_0x161e('0x5')](_0x161e('0x4e'),_0x2d87d1?_0x2d87d1[_0x161e('0x21')](','):[]);},'get':function(){return this['getDataValue'](_0x161e('0x4e'))?_[_0x161e('0x4f')](this[_0x161e('0xa')](_0x161e('0x4e'))[_0x161e('0x2d')](','),function(_0x313a41){return parseInt(_0x313a41,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x161e('0x7')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x161e('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x161e('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x161e('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x161e('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x161e('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x161e('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x161e('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x161e('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x161e('0x18')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x161e('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x161e('0x7')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x161e('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x161e('0x50')],'get':function(){return this[_0x161e('0xa')](_0x161e('0x51'))?this[_0x161e('0xa')](_0x161e('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x161e('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x161e('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x161e('0x7')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x161e('0x7')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x161e('0x15')],'defaultValue':![],'set':function(_0x4b3958){if(typeof _0x4b3958==='string'){var _0xef4fcb=_0x4b3958==='1'?!![]:_0x4b3958==='0'?![]:_0x4b3958===_0x161e('0x52')?!![]:_0x4b3958===_0x161e('0x53')?![]:![];this[_0x161e('0x5')](_0x161e('0x54'),_0xef4fcb);}else{this['setDataValue'](_0x161e('0x54'),_0x4b3958);}}},'blocked':{'type':Sequelize[_0x161e('0x15')],'defaultValue':![],'set':function(_0x5f5b88){this['setDataValue'](_0x161e('0x55'),_0x5f5b88);if(_0x5f5b88===!![]){this['setDataValue'](_0x161e('0x56'),moment());this[_0x161e('0x5')](_0x161e('0x57'),0x0);}else{this[_0x161e('0x5')](_0x161e('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0x161e('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x161e('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x161e('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x161e('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x161e('0x12')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x161e('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x161e('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x161e('0x15')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 5fca446..aa3d715 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 _0x467c=['110','104','105','106','108','109','100','115','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','create','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','isEmpty','compact','changePassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','oldPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','securePassword','enforcePasswordHistory','validatePasswordHistory','previousPasswords','updatePasswordsHistory','addQueues','channel','online','voicePause','interface','Unknown\x20channel','add','Queues','penalty','spread','capitalize','toLowerCase','QueueId','emit','Queue:save','voice','VoiceQueue','format','UserVoiceQueueRt','upsert','removeQueues','remove','Queue:remove','addAvatar','userpic','file','filename','getAvatar','root','server/files/images/logos/default_profile.png','download','existsSync','join','server/files/images/','getOpenTabs','whatsapp','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','order','CmList','List','Tags','color','tag','getQueues','isValidChannel','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','phone','loginInPause','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','x-forwarded-for','connection','remoteAddress','socket','getVoiceQueues','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','device','PAUSE','LOGININPAUSE','concat','isMiddleware','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','chatPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','%s%s','Pause','getTeams','Team','addTeams','omit','Voice','getChatQueues','setDataValue','Chat','getMailQueues','Mail','getSmsQueues','getWhatsappQueues','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','removeTeams','Whatsapp','removeAgent','getLists','getAgents','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','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','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','CmHopper','$and','$or','$lte','$ne','$eq','$between','$in','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','firstName','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','nonce','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','resolve','queues','teams','inbound','toString','desc','asc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','voiceStatus','slice','charAt','toUpperCase','QueryTypes','select','field','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','eml-format','rimraf','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','client','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','role','user','Agents','agent','Telephones','telephone','filter','ignore','map','value','find','name','UserProfileResource','send','index','User','fieldName','type','differenceBy','password','salt','query','keys','filters','intersection','fields','attributes','model','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','sequelize','lower','options','includeAll','include','includes','push','findAll','rows','true','length','chat','dataValues','fax','mail','openchannel','all','show','params','rawAttributes','openTabs','sms','update','body','addContacts','ids','Setting','validatePasswordPattern','max','internal','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','SELECT','isNil','from','voicemail','mailbox','VoiceMail','fullname','email','101','102','103'];(function(_0x53f7f3,_0x178008){var _0x977d22=function(_0x1dd28d){while(--_0x1dd28d){_0x53f7f3['push'](_0x53f7f3['shift']());}};_0x977d22(++_0x178008);}(_0x467c,0x123));var _0xc467=function(_0x24990f,_0x562b64){_0x24990f=_0x24990f-0x0;var _0x24436d=_0x467c[_0x24990f];return _0x24436d;};'use strict';var emlformat=require(_0xc467('0x0'));var rimraf=require(_0xc467('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc467('0x2'));var BPromise=require(_0xc467('0x3'));var Mustache=require(_0xc467('0x4'));var util=require(_0xc467('0x5'));var path=require(_0xc467('0x6'));var sox=require('sox');var csv=require(_0xc467('0x7'));var ejs=require(_0xc467('0x8'));var fs=require('fs');var fs_extra=require(_0xc467('0x9'));var _=require(_0xc467('0xa'));var squel=require(_0xc467('0xb'));var crypto=require(_0xc467('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc467('0xd'));var toCsv=require(_0xc467('0x7'));var querystring=require(_0xc467('0xe'));var Papa=require(_0xc467('0xf'));var Redis=require(_0xc467('0x10'));var values;var authService=require('../../components/auth/service');var qs=require(_0xc467('0x11'));var as=require(_0xc467('0x12'));var hardwareService=require(_0xc467('0x13'));var logger=require(_0xc467('0x14'))(_0xc467('0x15'));var utils=require(_0xc467('0x16'));var config=require(_0xc467('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc467('0x18'))['db'];config[_0xc467('0x19')]=_[_0xc467('0x1a')](config[_0xc467('0x19')],{'host':_0xc467('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc467('0x19')]));require('./user.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xc467('0x1c')][_0xc467('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x306fef,_0x550d67,_0x44c402,_0x3f6c4a){return new BPromise(function(_0x37adce,_0x151c41){var _0x77884a=_0x3f6c4a||client;return _0x77884a[_0xc467('0x1e')](_0x306fef,_0x44c402)[_0xc467('0x1f')](function(_0x5172a0){logger[_0xc467('0x20')](_0xc467('0x21'),_0x550d67,_0xc467('0x22'));logger[_0xc467('0x23')](_0xc467('0x24'),_0x550d67,_0xc467('0x22'),JSON[_0xc467('0x25')](_0x5172a0));if(_0x5172a0['error']){if(_0x5172a0[_0xc467('0x26')][_0xc467('0x27')]===0x1f4){logger['error'](_0xc467('0x21'),_0x550d67,_0x5172a0[_0xc467('0x26')]['message']);return _0x151c41(_0x5172a0[_0xc467('0x26')][_0xc467('0x28')]);}logger['error'](_0xc467('0x21'),_0x550d67,_0x5172a0[_0xc467('0x26')][_0xc467('0x28')]);return _0x37adce(_0x5172a0[_0xc467('0x26')][_0xc467('0x28')]);}else{logger[_0xc467('0x20')](_0xc467('0x21'),_0x550d67,'request\x20sent');_0x37adce(_0x5172a0[_0xc467('0x29')][_0xc467('0x28')]);}})[_0xc467('0x2a')](function(_0x255b02){logger[_0xc467('0x26')](_0xc467('0x21'),_0x550d67,_0x255b02);_0x151c41(_0x255b02);});});}function respondWithStatusCode(_0x3ef6e9,_0x166699){_0x166699=_0x166699||0xcc;return function(_0x110183){if(_0x110183){return _0x3ef6e9[_0xc467('0x2b')](_0x166699);}return _0x3ef6e9[_0xc467('0x2c')](_0x166699)[_0xc467('0x2d')]();};}function respondWithResult(_0x235286,_0x59b282){_0x59b282=_0x59b282||0xc8;return function(_0x138628){if(_0x138628){return _0x235286[_0xc467('0x2c')](_0x59b282)[_0xc467('0x2e')](_0x138628);}};}function respondWithFilteredResult(_0x5ed81b,_0x3cf1a4){return function(_0x214f12){if(_0x214f12){var _0x21c53e=typeof _0x3cf1a4[_0xc467('0x2f')]===_0xc467('0x30')&&typeof _0x3cf1a4[_0xc467('0x31')]===_0xc467('0x30');var _0x445db3=_0x214f12[_0xc467('0x32')];var _0x25813d=_0x21c53e?0x0:_0x3cf1a4[_0xc467('0x2f')];var _0x2f918b=_0x21c53e?_0x214f12[_0xc467('0x32')]:_0x3cf1a4['offset']+_0x3cf1a4[_0xc467('0x31')];var _0x41f42b;if(_0x2f918b>=_0x445db3){_0x2f918b=_0x445db3;_0x41f42b=0xc8;}else{_0x41f42b=0xce;}_0x5ed81b['status'](_0x41f42b);return _0x5ed81b[_0xc467('0x33')](_0xc467('0x34'),_0x25813d+'-'+_0x2f918b+'/'+_0x445db3)['json'](_0x214f12);}return null;};}function patchUpdates(_0x4c0a52){return function(_0x2b8e14){try{jsonpatch['apply'](_0x2b8e14,_0x4c0a52,!![]);}catch(_0x51a310){return BPromise['reject'](_0x51a310);}return _0x2b8e14['save']();};}function saveUpdates(_0x1765c0,_0x22c643){return function(_0xa34fdd){if(_0xa34fdd){return _0xa34fdd['update'](_0x1765c0)[_0xc467('0x1f')](function(_0xb6d769){return _0xb6d769;});}return null;};}function removeEntity(_0x3c9698,_0x23a418){return function(_0x2248c5){if(_0x2248c5){return _0x2248c5[_0xc467('0x35')]()[_0xc467('0x1f')](function(){var _0x31d8b4=_0x2248c5[_0xc467('0x36')]({'plain':!![]});if(_0x31d8b4[_0xc467('0x37')]==='admin')return;var _0x34c07f=[{'name':'Users','value':_0xc467('0x38'),'ignore':!![]},{'name':_0xc467('0x39'),'value':_0xc467('0x3a'),'ignore':![]},{'name':_0xc467('0x3b'),'value':_0xc467('0x3c'),'ignore':![]}];var _0x3a4cdd=_(_0x34c07f)[_0xc467('0x3d')](_0xc467('0x3e'))[_0xc467('0x3f')]('value')[_0xc467('0x40')]();if(_['includes'](_0x3a4cdd,_0x31d8b4[_0xc467('0x37')])){return;}var _0x1a3757=_[_0xc467('0x41')](_0x34c07f,['value',_0x31d8b4[_0xc467('0x37')]])[_0xc467('0x42')];return db[_0xc467('0x43')][_0xc467('0x35')]({'where':{'type':_0x1a3757,'resourceId':_0x31d8b4['id']}})[_0xc467('0x1f')](function(){return _0x2248c5;});})[_0xc467('0x1f')](function(){_0x3c9698[_0xc467('0x2c')](0xcc)[_0xc467('0x2d')]();});}};}function handleEntityNotFound(_0x1cc0ad,_0x534d1c){return function(_0x37d5c9){if(!_0x37d5c9){_0x1cc0ad[_0xc467('0x2b')](0x194);}return _0x37d5c9;};}function handleError(_0x5e8be3,_0x3621d6){_0x3621d6=_0x3621d6||0x1f4;return function(_0x290324){logger[_0xc467('0x26')](_0x290324['stack']);if(_0x290324['name']){delete _0x290324[_0xc467('0x42')];}_0x5e8be3[_0xc467('0x2c')](_0x3621d6)[_0xc467('0x44')](_0x290324);};}exports[_0xc467('0x45')]=function(_0x5edec0,_0x58d226){var _0x1cc72d={},_0xf84bf5={},_0x5ec215={'count':0x0,'rows':[]};var _0x19c0ca=_['map'](db[_0xc467('0x46')]['rawAttributes'],function(_0x4b23c){return{'name':_0x4b23c[_0xc467('0x47')],'type':_0x4b23c[_0xc467('0x48')]['key']};});_0xf84bf5['model']=_[_0xc467('0x49')](_[_0xc467('0x3f')](_0x19c0ca,_0xc467('0x42')),[_0xc467('0x4a'),_0xc467('0x4b')]);_0xf84bf5[_0xc467('0x4c')]=_[_0xc467('0x4d')](_0x5edec0[_0xc467('0x4c')]);_0xf84bf5[_0xc467('0x4e')]=_[_0xc467('0x4f')](_0xf84bf5['model'],_0xf84bf5[_0xc467('0x4c')]);_0x1cc72d['attributes']=_[_0xc467('0x4f')](_0xf84bf5['model'],qs[_0xc467('0x50')](_0x5edec0['query'][_0xc467('0x50')]));_0x1cc72d[_0xc467('0x51')]=_0x1cc72d[_0xc467('0x51')]['length']?_0x1cc72d[_0xc467('0x51')]:_0xf84bf5[_0xc467('0x52')];if(!_0x5edec0['query'][_0xc467('0x53')](_0xc467('0x54'))){_0x1cc72d['limit']=qs[_0xc467('0x31')](_0x5edec0[_0xc467('0x4c')][_0xc467('0x31')]);_0x1cc72d[_0xc467('0x2f')]=qs[_0xc467('0x2f')](_0x5edec0[_0xc467('0x4c')][_0xc467('0x2f')]);}_0x1cc72d['order']=qs[_0xc467('0x55')](_0x5edec0['query']['sort']);_0x1cc72d[_0xc467('0x56')]=qs[_0xc467('0x4e')](_[_0xc467('0x57')](_0x5edec0[_0xc467('0x4c')],_0xf84bf5[_0xc467('0x4e')]),_0x19c0ca);if(_0x5edec0['query'][_0xc467('0x3d')]){_0x1cc72d[_0xc467('0x56')]=_[_0xc467('0x58')](_0x1cc72d[_0xc467('0x56')],{'$or':_[_0xc467('0x3f')](_0x19c0ca,function(_0x4a19c1){if(_0x4a19c1['type']!==_0xc467('0x59')){return db[_0xc467('0x5a')][_0xc467('0x56')](db['sequelize']['fn']('lower',db['sequelize']['col'](_0x4a19c1['name'])),{'$like':db[_0xc467('0x5a')]['fn'](_0xc467('0x5b'),'%'+_0x5edec0[_0xc467('0x4c')]['filter']+'%')});}})});}_0x1cc72d=_[_0xc467('0x58')]({},_0x1cc72d,_0x5edec0[_0xc467('0x5c')]);var _0x301e89={'where':_0x1cc72d['where']};return db['User'][_0xc467('0x32')](_0x301e89)[_0xc467('0x1f')](function(_0x472032){_0x5ec215[_0xc467('0x32')]=_0x472032;if(_0x5edec0[_0xc467('0x4c')][_0xc467('0x5d')]){_0x1cc72d[_0xc467('0x5e')]=[{'all':!![]}];}if(!_[_0xc467('0x5f')](_0x1cc72d[_0xc467('0x51')],'id')){_0x1cc72d['attributes'][_0xc467('0x60')]('id');}return db[_0xc467('0x46')][_0xc467('0x61')](_0x1cc72d);})['then'](function(_0x41babe){_0x5ec215[_0xc467('0x62')]=_0x41babe;if(_0x5edec0[_0xc467('0x4c')]['openTabs']===_0xc467('0x63')){var _0x3637ae=[];for(var _0x5eee24=0x0;_0x5eee24<_0x5ec215[_0xc467('0x62')][_0xc467('0x64')];_0x5eee24++){_0x3637ae[_0xc467('0x60')](get_open_tabs(_0xc467('0x65'),_0x5ec215[_0xc467('0x62')][_0x5eee24][_0xc467('0x66')]));_0x3637ae['push'](get_open_tabs('sms',_0x5ec215['rows'][_0x5eee24][_0xc467('0x66')]));_0x3637ae[_0xc467('0x60')](get_open_tabs(_0xc467('0x67'),_0x5ec215[_0xc467('0x62')][_0x5eee24][_0xc467('0x66')]));_0x3637ae[_0xc467('0x60')](get_open_tabs(_0xc467('0x68'),_0x5ec215['rows'][_0x5eee24][_0xc467('0x66')]));_0x3637ae[_0xc467('0x60')](get_open_tabs(_0xc467('0x69'),_0x5ec215[_0xc467('0x62')][_0x5eee24][_0xc467('0x66')]));_0x3637ae[_0xc467('0x60')](get_open_tabs('whatsapp',_0x5ec215[_0xc467('0x62')][_0x5eee24]['dataValues']));}return BPromise[_0xc467('0x6a')](_0x3637ae)[_0xc467('0x1f')](function(_0x20fe1b){return _0x5ec215;});}else{return _0x5ec215;}})[_0xc467('0x1f')](respondWithFilteredResult(_0x58d226,_0x1cc72d))['catch'](handleError(_0x58d226,null));};exports[_0xc467('0x6b')]=function(_0x22f364,_0x5dad25){var _0x37195c={'raw':![],'where':{'id':_0x22f364[_0xc467('0x6c')]['id']}},_0x30fcd1={};_0x30fcd1[_0xc467('0x52')]=_['differenceBy'](_[_0xc467('0x4d')](db[_0xc467('0x46')][_0xc467('0x6d')]),['password',_0xc467('0x4b')]);_0x30fcd1['query']=_[_0xc467('0x4d')](_0x22f364[_0xc467('0x4c')]);_0x30fcd1[_0xc467('0x4e')]=_[_0xc467('0x4f')](_0x30fcd1[_0xc467('0x52')],_0x30fcd1[_0xc467('0x4c')]);_0x37195c[_0xc467('0x51')]=_[_0xc467('0x4f')](_0x30fcd1[_0xc467('0x52')],qs['fields'](_0x22f364[_0xc467('0x4c')][_0xc467('0x50')]));_0x37195c['attributes']=_0x37195c['attributes']['length']?_0x37195c[_0xc467('0x51')]:_0x30fcd1[_0xc467('0x52')];if(_0x22f364[_0xc467('0x4c')][_0xc467('0x5d')]){_0x37195c[_0xc467('0x5e')]=[{'all':!![]}];}_0x37195c=_[_0xc467('0x58')]({},_0x37195c,_0x22f364['options']);if(!_[_0xc467('0x5f')](_0x37195c[_0xc467('0x51')],'id')){_0x37195c['attributes']['push']('id');}return db[_0xc467('0x46')][_0xc467('0x41')](_0x37195c)[_0xc467('0x1f')](handleEntityNotFound(_0x5dad25,null))['then'](function(_0x52d1d6){var _0x5d07e0=[];values=_0x52d1d6;if(_0x22f364[_0xc467('0x4c')][_0xc467('0x6e')]===_0xc467('0x63')){_0x5d07e0[_0xc467('0x60')](get_open_tabs('chat',_0x52d1d6['dataValues']));_0x5d07e0[_0xc467('0x60')](get_open_tabs(_0xc467('0x6f'),_0x52d1d6['dataValues']));_0x5d07e0[_0xc467('0x60')](get_open_tabs(_0xc467('0x69'),_0x52d1d6[_0xc467('0x66')]));_0x5d07e0[_0xc467('0x60')](get_open_tabs('whatsapp',_0x52d1d6[_0xc467('0x66')]));_0x5d07e0['push'](get_open_tabs(_0xc467('0x67'),_0x52d1d6[_0xc467('0x66')]));_0x5d07e0[_0xc467('0x60')](get_open_tabs(_0xc467('0x68'),_0x52d1d6[_0xc467('0x66')]));return BPromise[_0xc467('0x6a')](_0x5d07e0);}else{return values;}})[_0xc467('0x1f')](function(_0x119e96){return values;})[_0xc467('0x1f')](respondWithResult(_0x5dad25,null))[_0xc467('0x2a')](handleError(_0x5dad25,null));};exports[_0xc467('0x70')]=function(_0x4260ec,_0x498d96){if(_0x4260ec[_0xc467('0x71')]['id']){delete _0x4260ec['body']['id'];}delete _0x4260ec[_0xc467('0x71')]['role'];return db['User'][_0xc467('0x41')]({'where':{'id':_0x4260ec[_0xc467('0x6c')]['id']}})[_0xc467('0x1f')](handleEntityNotFound(_0x498d96,null))[_0xc467('0x1f')](saveUpdates(_0x4260ec[_0xc467('0x71')],null))['then'](respondWithResult(_0x498d96,null))['catch'](handleError(_0x498d96,null));};exports['describe']=function(_0x28f3e3,_0x5a6b5a){return db[_0xc467('0x46')]['describe']()['then'](respondWithResult(_0x5a6b5a,null))[_0xc467('0x2a')](handleError(_0x5a6b5a,null));};exports['addContacts']=function(_0x456147,_0x2a590e,_0x292e07){return db['User'][_0xc467('0x41')]({'where':{'id':_0x456147[_0xc467('0x6c')]['id']}})['then'](handleEntityNotFound(_0x2a590e,null))[_0xc467('0x1f')](function(_0x389446){if(_0x389446){return _0x389446[_0xc467('0x72')](_0x456147[_0xc467('0x71')][_0xc467('0x73')],_['omit'](_0x456147[_0xc467('0x71')],['ids','id'])||{});}})[_0xc467('0x1f')](respondWithResult(_0x2a590e,null))[_0xc467('0x2a')](handleError(_0x2a590e,null));};function validateUser(_0x52960e){return new BPromise(function(_0x1408f2,_0x52a92c){if(_0x52960e['internal'])return _0x1408f2(_0x52960e);return db[_0xc467('0x74')]['findById'](0x1)[_0xc467('0x1f')](function(_0x5ae5ee){if(_0x5ae5ee['securePassword'])authService[_0xc467('0x75')](_0x52960e[_0xc467('0x4a')]);db[_0xc467('0x46')][_0xc467('0x76')](_0xc467('0x77'))[_0xc467('0x1f')](function(_0x34fb61){if(_['isNil'](_0x34fb61)){_0x52960e[_0xc467('0x77')]=_0x5ae5ee[_0xc467('0x78')]||0x1;return;}if(_['isNil'](_0x5ae5ee['min_internal'])||_0x5ae5ee[_0xc467('0x78')]===_0x34fb61){_0x52960e[_0xc467('0x77')]=_0x34fb61+0x1;return;}if(_0x5ae5ee[_0xc467('0x78')]>_0x34fb61){_0x52960e[_0xc467('0x77')]=_0x5ae5ee[_0xc467('0x78')];return;}return db[_0xc467('0x5a')][_0xc467('0x4c')](_0xc467('0x79'),{'type':db[_0xc467('0x5a')]['QueryTypes'][_0xc467('0x7a')]})[_0xc467('0x1f')](function(_0x2b8a71){if(_0x2b8a71&&_0x2b8a71[_0xc467('0x64')]){for(var _0xb28b3c=0x0,_0x4767c8=_0x2b8a71[_0xc467('0x64')];_0xb28b3c<_0x4767c8&&_[_0xc467('0x7b')](_0x52960e['internal']);_0xb28b3c++){if(_0x5ae5ee['min_internal']<=_0x2b8a71[_0xb28b3c][_0xc467('0x7c')]){_0x52960e[_0xc467('0x77')]=_0x2b8a71[_0xb28b3c]['from'];}else if(_0x5ae5ee['min_internal']>_0x2b8a71[_0xb28b3c][_0xc467('0x7c')]&&_0x5ae5ee[_0xc467('0x78')]<=_0x2b8a71[_0xb28b3c]['to']){_0x52960e[_0xc467('0x77')]=_0x5ae5ee[_0xc467('0x78')];}}}if(_[_0xc467('0x7b')](_0x52960e[_0xc467('0x77')])){_0x52960e[_0xc467('0x77')]=_0x34fb61+0x1;}return _0x1408f2(_0x52960e);});});})['catch'](function(_0x3f8937){_0x52a92c(_0x3f8937);});});}function updateUser(_0x518ed2){return new BPromise(function(_0x3fb58e,_0x36d620){try{if(_0x518ed2[_0xc467('0x7d')]){_0x518ed2[_0xc467('0x7e')]=_0x518ed2[_0xc467('0x77')];_0x518ed2[_0xc467('0x7f')]={'mailbox':_0x518ed2[_0xc467('0x77')],'password':_0x518ed2['password'],'fullname':_0x518ed2[_0xc467('0x80')],'email':_0x518ed2[_0xc467('0x81')]};}if(_0x518ed2[_0xc467('0x37')]===_0xc467('0x3a')){if(!_0x518ed2['permissions'])_0x518ed2['permissions']=[_0xc467('0x82'),_0xc467('0x83'),_0xc467('0x84'),'113',_0xc467('0x85'),_0xc467('0x86'),_0xc467('0x87'),_0xc467('0x88'),'107',_0xc467('0x89'),_0xc467('0x8a'),_0xc467('0x8b'),'111','114',_0xc467('0x8c')];}_0x3fb58e(_0x518ed2);}catch(_0x158e21){_0x36d620(_0x158e21);}});}exports['create']=function(_0x16b207,_0x71216){if(_0x16b207[_0xc467('0x38')][_0xc467('0x37')]===_0xc467('0x3a'))throw new Error(_0xc467('0x8d'));if(_0x16b207['body'][_0xc467('0x37')]===_0xc467('0x38')&&_0x16b207[_0xc467('0x38')]['role']!==_0xc467('0x8e')){throw new Error(_0xc467('0x8f'));}if(_0x16b207[_0xc467('0x71')]['role']==='admin'&&_0x16b207[_0xc467('0x38')]['role']!==_0xc467('0x8e')){throw new Error(_0xc467('0x90'));}return licenseUtil[_0xc467('0x91')]([_0x16b207['body']])[_0xc467('0x1f')](function(){return validateUser(_0x16b207['body']);})['then'](function(_0x45a043){return updateUser(_0x45a043)[_0xc467('0x1f')](function(_0x5c4833){if(_0x5c4833[_0xc467('0x37')]===_0xc467('0x8e')){_0x5c4833[_0xc467('0x92')]=_0x16b207['user']['settingsEnabled'];delete _0x5c4833['userProfileId'];}return _0x5c4833;});})[_0xc467('0x1f')](function(_0x56a9a5){return db[_0xc467('0x46')][_0xc467('0x93')](_0x56a9a5,{'include':[{'model':db[_0xc467('0x7f')],'as':'VoiceMail'}]});})[_0xc467('0x1f')](function(_0x4e572e){if(_0x16b207[_0xc467('0x71')][_0xc467('0x37')]===_0xc467('0x38'))return _0x4e572e;if(_0x16b207[_0xc467('0x38')][_0xc467('0x37')]!=='user')return _0x4e572e;return db[_0xc467('0x94')]['find']({'where':{'name':_0x4e572e[_0xc467('0x37')]===_0xc467('0x3a')?_0xc467('0x39'):'Telephones','userProfileId':_0x16b207[_0xc467('0x38')][_0xc467('0x95')]},'raw':!![]})[_0xc467('0x1f')](function(_0x299a4c){if(!_0x299a4c||_0x299a4c[_0xc467('0x96')]!=0x0)return _0x4e572e;return db[_0xc467('0x43')][_0xc467('0x93')]({'name':_0x4e572e[_0xc467('0x42')],'resourceId':_0x4e572e['id'],'type':_0x299a4c['name'],'sectionId':_0x299a4c['id']},{})[_0xc467('0x1f')](function(){return _0x4e572e;});})[_0xc467('0x2a')](function(_0x190340){logger['error'](_0xc467('0x97'),_0x190340);throw _0x190340;});})['then'](respondWithResult(_0x71216,0xc9))[_0xc467('0x2a')](handleError(_0x71216,null));};exports[_0xc467('0x98')]=function(_0x22c807,_0x28f7b9){var _0x4281b9=_0x22c807[_0xc467('0x71')];var _0x2a0cdb=[];if(_0x22c807['user'][_0xc467('0x37')]===_0xc467('0x3a'))throw new Error(_0xc467('0x8d'));if(_[_0xc467('0x99')](_0x4281b9,['role',_0xc467('0x38')])&&_0x22c807[_0xc467('0x38')][_0xc467('0x37')]!==_0xc467('0x8e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x4281b9,[_0xc467('0x37'),_0xc467('0x8e')])&&_0x22c807['user'][_0xc467('0x37')]!==_0xc467('0x8e')){throw new Error(_0xc467('0x9a'));}return licenseUtil['checkUserLimits'](_0x4281b9)['then'](function(){return validateUser(_0x4281b9[0x0]);})['then'](function(){for(var _0x1791aa=0x1;_0x1791aa<_0x4281b9[_0xc467('0x64')];_0x1791aa++){var _0x28e702=_0x4281b9[_0x1791aa-0x1]['internal'];if(!_0x4281b9[_0x1791aa][_0xc467('0x77')])_0x4281b9[_0x1791aa][_0xc467('0x77')]=_0x28e702+0x1;_0x2a0cdb['push'](validateUser(_0x4281b9[_0x1791aa]));}return BPromise['all'](_0x2a0cdb);})[_0xc467('0x1f')](function(){_0x2a0cdb=[];for(var _0x4c67bb=0x0;_0x4c67bb<_0x4281b9[_0xc467('0x64')];_0x4c67bb++){_0x2a0cdb['push'](updateUser(_0x4281b9[_0x4c67bb]));}return BPromise[_0xc467('0x6a')](_0x2a0cdb);})[_0xc467('0x1f')](function(){return BPromise[_0xc467('0x9b')](_0x4281b9,function(_0x36f85f){return db[_0xc467('0x46')][_0xc467('0x93')](_0x36f85f,{'include':[{'model':db[_0xc467('0x7f')],'as':_0xc467('0x7f')}]})[_0xc467('0x1f')](function(_0x1fcbdc){_0x36f85f['id']=_0x1fcbdc['id'];return _0x36f85f;});});})[_0xc467('0x1f')](function(_0x989439){if(_0x22c807[_0xc467('0x71')][_0xc467('0x37')]===_0xc467('0x38'))return _0x989439;if(_0x22c807[_0xc467('0x38')][_0xc467('0x37')]!=='user')return _0x989439;var _0xea170f=_[_0xc467('0x99')](_0x989439,function(_0x433a1e){return _0x433a1e[_0xc467('0x37')]===_0xc467('0x3a')||_0x433a1e[_0xc467('0x37')]===_0xc467('0x3c');});if(!_0xea170f)return _0x989439;return db['UserProfileSection'][_0xc467('0x61')]({'where':{'name':{'$or':['Agents',_0xc467('0x3b')]},'userProfileId':_0x22c807['user'][_0xc467('0x95')]},'raw':!![]})['then'](function(_0x249e55){if(_[_0xc467('0x9c')](_0x249e55)||!_['some'](_0x249e55,[_0xc467('0x96'),0x0]))return _0x989439;_0x2a0cdb=[];var _0x29cee2=_(_0x249e55)[_0xc467('0x3f')](function(_0x3c5e1f){if(_0x3c5e1f[_0xc467('0x96')]===0x1)return;return _0x3c5e1f[_0xc467('0x42')]==='Agents'?_0xc467('0x3a'):_0xc467('0x3c');})[_0xc467('0x9d')]()[_0xc467('0x40')]();for(var _0x1abe64=0x0;_0x1abe64<_0x989439['length'];_0x1abe64++){if(!_[_0xc467('0x5f')](_0x29cee2,_0x989439[_0x1abe64]['role']))return;var _0x3ef187=_0x989439[_0x1abe64][_0xc467('0x37')]===_0xc467('0x3a')?_0xc467('0x39'):_0xc467('0x3b');_0x2a0cdb['push'](db[_0xc467('0x43')][_0xc467('0x93')]({'name':_0x989439[_0x1abe64]['name'],'resourceId':_0x989439[_0x1abe64]['id'],'type':_0x3ef187,'sectionId':_[_0xc467('0x41')](_0x249e55,['name',_0x3ef187])['id']},{}));}return BPromise[_0xc467('0x6a')](_0x2a0cdb);});})[_0xc467('0x1f')](respondWithResult(_0x28f7b9,0xc9))[_0xc467('0x2a')](handleError(_0x28f7b9,null));};exports[_0xc467('0x9e')]=function(_0x132810,_0x528647,_0x596423){if(_0x132810[_0xc467('0x71')]['id']){delete _0x132810[_0xc467('0x71')]['id'];}return db[_0xc467('0x46')]['find']({'where':{'id':_0x132810[_0xc467('0x6c')]['id']}})[_0xc467('0x1f')](function(_0x184a12){if(!_0x184a12)return null;if(_0x184a12['id']===_0x132810[_0xc467('0x38')]['id']){if(!_0x132810['body']['oldPassword']||!_0x132810[_0xc467('0x71')][_0xc467('0x9f')]){throw new db[(_0xc467('0xa0'))][(_0xc467('0xa1'))](_0xc467('0xa2'));}if(!_0x184a12[_0xc467('0xa3')](_0x132810[_0xc467('0x71')][_0xc467('0xa4')])){throw new db[(_0xc467('0xa0'))]['ValidationError'](_0xc467('0xa5'));}if(_0x132810[_0xc467('0x71')][_0xc467('0xa4')]===_0x132810[_0xc467('0x71')][_0xc467('0x9f')]){throw new db[(_0xc467('0xa0'))][(_0xc467('0xa1'))](_0xc467('0xa6'));}}else if(_0x132810[_0xc467('0x38')][_0xc467('0x37')]===_0xc467('0x8e')){if(!_0x132810[_0xc467('0x71')]['newPassword']){throw new db['Sequelize']['ValidationError'](_0xc467('0xa7'));}}else if(_0x132810[_0xc467('0x38')][_0xc467('0x37')]===_0xc467('0x38')){if(!_0x132810[_0xc467('0x71')]['newPassword']){throw new db[(_0xc467('0xa0'))][(_0xc467('0xa1'))](_0xc467('0xa7'));}if(_0x184a12['role']!==_0xc467('0x3a')){throw new db[(_0xc467('0xa0'))][(_0xc467('0xa1'))](_0xc467('0x8d'));}}else{throw new db[(_0xc467('0xa0'))]['ValidationError'](_0xc467('0x8d'));}return _0x184a12;})['then'](handleEntityNotFound(_0x528647,null))[_0xc467('0x1f')](function(_0x392253){return db['Setting'][_0xc467('0xa8')]({'attributes':['id',_0xc467('0xa9'),_0xc467('0xaa'),'passwordHistoryLimit']})[_0xc467('0x1f')](function(_0x547731){if(_0x547731[_0xc467('0xa9')])authService[_0xc467('0x75')](_0x132810[_0xc467('0x71')][_0xc467('0x9f')]);if(!_0x547731[_0xc467('0xaa')]||!_0x392253['previousPasswords'])return _0x392253;authService[_0xc467('0xab')](_0x132810['body'][_0xc467('0x9f')],_0x392253[_0xc467('0xac')],_0x547731['passwordHistoryLimit']);return _0x392253;})[_0xc467('0x1f')](saveUpdates({'password':_0x132810['body'][_0xc467('0x9f')],'passwordResetAt':_0x132810[_0xc467('0x38')]['id']==_0x132810[_0xc467('0x6c')]['id']?moment():null,'previousPasswords':authService[_0xc467('0xad')](_0x132810[_0xc467('0x71')][_0xc467('0x9f')],_0x392253[_0xc467('0xac')])},null));})[_0xc467('0x1f')](respondWithResult(_0x528647,null))[_0xc467('0x2a')](handleError(_0x528647,null));};exports[_0xc467('0xae')]=function(_0x43356b,_0x40720c,_0x1285ed){var _0x17bdd8=_0x43356b[_0xc467('0x71')][_0xc467('0xaf')];return db['User']['find']({'where':{'id':_0x43356b[_0xc467('0x6c')]['id']},'attributes':['id','name',_0xc467('0x37'),_0xc467('0xb0'),'loginInPause',_0xc467('0xb1'),_0xc467('0xb2')]})[_0xc467('0x1f')](handleEntityNotFound(_0x40720c,null))['then'](function(_0x1d66e7){if(_0x1d66e7){if(!utils['isValidChannel'](_0x17bdd8)){throw new db[(_0xc467('0xa0'))][(_0xc467('0xa1'))](_0xc467('0xb3'));}return _0x1d66e7[_0xc467('0xb4')+_['capitalize'](_0x17bdd8['toLowerCase']())+_0xc467('0xb5')](_0x43356b[_0xc467('0x71')][_0xc467('0x73')],{'penalty':_0x43356b[_0xc467('0x71')][_0xc467('0xb6')]||0x0})[_0xc467('0xb7')](function(_0x103fdb){for(var _0x34c335=0x0;_0x34c335<_0x43356b[_0xc467('0x71')][_0xc467('0x73')][_0xc467('0x64')];_0x34c335+=0x1){var _0x5597a2={'UserId':_0x43356b[_0xc467('0x6c')]['id']};_0x5597a2[_[_0xc467('0xb8')](_0x17bdd8[_0xc467('0xb9')]())+_0xc467('0xba')]=_0x43356b['body'][_0xc467('0x73')][_0x34c335];socket[_0xc467('0xbb')]('user'+_[_0xc467('0xb8')](_0x17bdd8[_0xc467('0xb9')]())+_0xc467('0xbc'),_0x5597a2);}return _0x103fdb;})[_0xc467('0x1f')](function(){if(_0x17bdd8===_0xc467('0xbd')){return db[_0xc467('0xbe')][_0xc467('0x61')]({'where':{'id':_0x43356b[_0xc467('0x71')]['ids']||[]},'raw':!![],'attributes':['id',_0xc467('0x42')]});}})[_0xc467('0x1f')](function(_0x2d98e7){var _0x389781=_0x1d66e7[_0xc467('0x36')]({'plain':!![]});var _0x274b56=[];if(_0x17bdd8==='voice'&&_0x389781[_0xc467('0x37')]===_0xc467('0x3a')&&_0x389781[_0xc467('0xb0')]){for(var _0x3d0706=0x0;_0x3d0706<_0x2d98e7[_0xc467('0x64')];_0x3d0706+=0x1){_0x274b56[_0xc467('0x60')]({'membername':_0x389781[_0xc467('0x42')],'UserId':_0x389781['id'],'queue_name':_0x2d98e7[_0x3d0706]['name'],'VoiceQueueId':_0x2d98e7[_0x3d0706]['id'],'interface':_[_0xc467('0x7b')](_0x389781[_0xc467('0xb2')])?util[_0xc467('0xbf')]('SIP/%s',_0x389781[_0xc467('0x42')]):_0x389781['interface'],'paused':_0x389781[_0xc467('0xb1')]||![],'penalty':_0x43356b['body'][_0xc467('0xb6')]||0x0});}return BPromise[_0xc467('0x9b')](_0x274b56,function(_0x53888c){return db[_0xc467('0xc0')][_0xc467('0xc1')](_0x53888c);});}return _0x1d66e7;});}})['then'](respondWithStatusCode(_0x40720c,null))[_0xc467('0x2a')](handleError(_0x40720c,null));};exports[_0xc467('0xc2')]=function(_0x331f38,_0x3cd296,_0x389856){var _0x35788c;return db['User']['find']({'where':{'id':_0x331f38[_0xc467('0x6c')]['id']},'attributes':['id','name','role']})['then'](handleEntityNotFound(_0x3cd296,null))[_0xc467('0x1f')](function(_0xb18eb3){if(_0xb18eb3){_0x35788c=_0xb18eb3;if(!_0x331f38[_0xc467('0x4c')][_0xc467('0xaf')]||!utils['isValidChannel'](_0x331f38['query']['channel'])){throw new db[(_0xc467('0xa0'))][(_0xc467('0xa1'))](_0xc467('0xb3'));}return _0xb18eb3[_0xc467('0xc3')+_[_0xc467('0xb8')](_0x331f38[_0xc467('0x4c')][_0xc467('0xaf')][_0xc467('0xb9')]())+_0xc467('0xb5')](_0x331f38[_0xc467('0x4c')][_0xc467('0x73')]);}})[_0xc467('0x1f')](function(_0xfeafb5){for(var _0x43c1f6=0x0;_0x43c1f6<_0x331f38['query'][_0xc467('0x73')][_0xc467('0x64')];_0x43c1f6+=0x1){var _0x581ec3={'UserId':_0x331f38['params']['id']};_0x581ec3[_[_0xc467('0xb8')](_0x331f38[_0xc467('0x4c')][_0xc467('0xaf')][_0xc467('0xb9')]())+'QueueId']=_0x331f38['query']['ids'][_0x43c1f6];socket[_0xc467('0xbb')]('user'+_['capitalize'](_0x331f38[_0xc467('0x4c')]['channel'][_0xc467('0xb9')]())+_0xc467('0xc4'),_0x581ec3);}return _0xfeafb5;})['then'](function(){if(_0x331f38[_0xc467('0x4c')]['channel']==='voice'){return db[_0xc467('0xc0')]['destroy']({'where':{'UserId':_0x331f38['params']['id'],'VoiceQueueId':_0x331f38[_0xc467('0x4c')]['ids']},'individualHooks':!![]})[_0xc467('0x1f')](function(){return _0x35788c;});}return _0x35788c;})[_0xc467('0x1f')](respondWithStatusCode(_0x3cd296,null))[_0xc467('0x2a')](handleError(_0x3cd296,null));};exports[_0xc467('0xc5')]=function(_0x37b06a,_0x4d0542,_0x54d573){_0x37b06a['body'][_0xc467('0xc6')]=_0x37b06a[_0xc467('0xc7')][_0xc467('0xc8')];return db['User'][_0xc467('0x41')]({'where':{'id':_0x37b06a['params']['id']}})[_0xc467('0x1f')](handleEntityNotFound(_0x4d0542,null))[_0xc467('0x1f')](saveUpdates(_0x37b06a[_0xc467('0x71')],null))[_0xc467('0x1f')](respondWithResult(_0x4d0542,null))['catch'](handleError(_0x4d0542,null));};exports[_0xc467('0xc9')]=function(_0x143310,_0x5ab87a,_0x16da63){var _0x88e2a5=path['join'](config[_0xc467('0xca')],_0xc467('0xcb'));return db[_0xc467('0x46')]['find']({'where':{'id':_0x143310[_0xc467('0x6c')]['id']},'attributes':['id',_0xc467('0xc6')],'raw':!![]})[_0xc467('0x1f')](handleEntityNotFound(_0x5ab87a,null))['then'](function(_0x2cc2eb){if(_0x2cc2eb){if(_[_0xc467('0x7b')](_0x2cc2eb[_0xc467('0xc6')])){return _0x5ab87a[_0xc467('0xcc')](_0x88e2a5);}else{if(!fs[_0xc467('0xcd')](path[_0xc467('0xce')](config[_0xc467('0xca')],_0xc467('0xcf'),_0x2cc2eb['userpic']))){return _0x5ab87a[_0xc467('0xcc')](_0x88e2a5);}return _0x5ab87a[_0xc467('0xcc')](path[_0xc467('0xce')](config['root'],_0xc467('0xcf'),_0x2cc2eb[_0xc467('0xc6')]));}}})[_0xc467('0x2a')](handleError(_0x5ab87a,null));};exports[_0xc467('0xd0')]=function(_0x4bf418,_0x34b74e,_0x27f555){return db['User'][_0xc467('0x41')]({'where':{'id':_0x4bf418[_0xc467('0x6c')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x34b74e,null))[_0xc467('0x1f')](function(_0x108714){var _0x484382=[];values=_0x108714[_0xc467('0x66')];_0x484382[_0xc467('0x60')](get_open_tabs('chat',_0x108714[_0xc467('0x66')]));_0x484382[_0xc467('0x60')](get_open_tabs(_0xc467('0x6f'),_0x108714[_0xc467('0x66')]));_0x484382[_0xc467('0x60')](get_open_tabs(_0xc467('0x69'),_0x108714[_0xc467('0x66')]));_0x484382[_0xc467('0x60')](get_open_tabs(_0xc467('0xd1'),_0x108714[_0xc467('0x66')]));_0x484382[_0xc467('0x60')](get_open_tabs(_0xc467('0x67'),_0x108714[_0xc467('0x66')]));_0x484382[_0xc467('0x60')](get_open_tabs('mail',_0x108714[_0xc467('0x66')]));return BPromise[_0xc467('0x6a')](_0x484382);})[_0xc467('0x1f')](function(_0x445fda){var _0x4b6d9e=[];if(_0x445fda){for(var _0x57224c=0x0;_0x57224c=_0x4612f7){_0x5232ae=_0x4612f7;_0x2cdb30=0xc8;}else{_0x2cdb30=0xce;}_0x48e0bd[_0xf81f('0x29')](_0x2cdb30);return _0x48e0bd[_0xf81f('0x30')]('Content-Range',_0x27ee15+'-'+_0x5232ae+'/'+_0x4612f7)[_0xf81f('0x2b')](_0x4f7acc);}return null;};}function patchUpdates(_0x12d485){return function(_0x57600e){try{jsonpatch[_0xf81f('0x31')](_0x57600e,_0x12d485,!![]);}catch(_0x253f95){return BPromise['reject'](_0x253f95);}return _0x57600e[_0xf81f('0x32')]();};}function saveUpdates(_0x3e58c6,_0x177520){return function(_0x1d2ddd){if(_0x1d2ddd){return _0x1d2ddd[_0xf81f('0x33')](_0x3e58c6)['then'](function(_0x1ebba1){return _0x1ebba1;});}return null;};}function removeEntity(_0x4481ac,_0x5174b4){return function(_0x14194c){if(_0x14194c){return _0x14194c[_0xf81f('0x34')]()[_0xf81f('0x35')](function(){var _0x483bb4=_0x14194c['get']({'plain':!![]});if(_0x483bb4[_0xf81f('0x36')]===_0xf81f('0x37'))return;var _0x32dd54=[{'name':'Users','value':_0xf81f('0x38'),'ignore':!![]},{'name':'Agents','value':_0xf81f('0x39'),'ignore':![]},{'name':'Telephones','value':_0xf81f('0x3a'),'ignore':![]}];var _0x3574c2=_(_0x32dd54)[_0xf81f('0x3b')](_0xf81f('0x3c'))[_0xf81f('0x3d')]('value')['value']();if(_[_0xf81f('0x3e')](_0x3574c2,_0x483bb4[_0xf81f('0x36')])){return;}var _0x4c5598=_[_0xf81f('0x3f')](_0x32dd54,[_0xf81f('0x40'),_0x483bb4[_0xf81f('0x36')]])[_0xf81f('0x41')];return db[_0xf81f('0x42')]['destroy']({'where':{'type':_0x4c5598,'resourceId':_0x483bb4['id']}})['then'](function(){return _0x14194c;});})[_0xf81f('0x35')](function(){_0x4481ac[_0xf81f('0x29')](0xcc)[_0xf81f('0x2a')]();});}};}function handleEntityNotFound(_0x5afe29,_0x3c8e21){return function(_0x3e5d4a){if(!_0x3e5d4a){_0x5afe29[_0xf81f('0x43')](0x194);}return _0x3e5d4a;};}function handleError(_0x34b85a,_0x19068b){_0x19068b=_0x19068b||0x1f4;return function(_0x4ae1c8){logger['error'](_0x4ae1c8[_0xf81f('0x44')]);if(_0x4ae1c8['name']){delete _0x4ae1c8[_0xf81f('0x41')];}_0x34b85a['status'](_0x19068b)[_0xf81f('0x45')](_0x4ae1c8);};}exports[_0xf81f('0x46')]=function(_0x2ba49f,_0x37febb){var _0x322dcd={},_0x4dcece={},_0x2efd2f={'count':0x0,'rows':[]};var _0x1c47be=_[_0xf81f('0x3d')](db['User'][_0xf81f('0x47')],function(_0x2689ba){return{'name':_0x2689ba[_0xf81f('0x48')],'type':_0x2689ba[_0xf81f('0x49')]['key']};});_0x4dcece['model']=_[_0xf81f('0x4a')](_[_0xf81f('0x3d')](_0x1c47be,_0xf81f('0x41')),['password',_0xf81f('0x4b')]);_0x4dcece[_0xf81f('0x4c')]=_[_0xf81f('0x4d')](_0x2ba49f[_0xf81f('0x4c')]);_0x4dcece['filters']=_[_0xf81f('0x4e')](_0x4dcece[_0xf81f('0x4f')],_0x4dcece[_0xf81f('0x4c')]);_0x322dcd['attributes']=_[_0xf81f('0x4e')](_0x4dcece['model'],qs[_0xf81f('0x50')](_0x2ba49f[_0xf81f('0x4c')][_0xf81f('0x50')]));_0x322dcd[_0xf81f('0x51')]=_0x322dcd[_0xf81f('0x51')]['length']?_0x322dcd[_0xf81f('0x51')]:_0x4dcece[_0xf81f('0x4f')];if(!_0x2ba49f[_0xf81f('0x4c')][_0xf81f('0x52')](_0xf81f('0x53'))){_0x322dcd[_0xf81f('0x2e')]=qs[_0xf81f('0x2e')](_0x2ba49f['query'][_0xf81f('0x2e')]);_0x322dcd[_0xf81f('0x2c')]=qs['offset'](_0x2ba49f[_0xf81f('0x4c')]['offset']);}_0x322dcd[_0xf81f('0x54')]=qs['sort'](_0x2ba49f[_0xf81f('0x4c')][_0xf81f('0x55')]);_0x322dcd[_0xf81f('0x56')]=qs[_0xf81f('0x57')](_[_0xf81f('0x58')](_0x2ba49f[_0xf81f('0x4c')],_0x4dcece['filters']),_0x1c47be);if(_0x2ba49f[_0xf81f('0x4c')]['filter']){_0x322dcd[_0xf81f('0x56')]=_[_0xf81f('0x59')](_0x322dcd['where'],{'$or':_[_0xf81f('0x3d')](_0x1c47be,function(_0x3c4bb9){if(_0x3c4bb9[_0xf81f('0x49')]!=='VIRTUAL'){return db['sequelize'][_0xf81f('0x56')](db['sequelize']['fn']('lower',db[_0xf81f('0x5a')][_0xf81f('0x5b')](_0x3c4bb9[_0xf81f('0x41')])),{'$like':db['sequelize']['fn'](_0xf81f('0x5c'),'%'+_0x2ba49f[_0xf81f('0x4c')][_0xf81f('0x3b')]+'%')});}})});}_0x322dcd=_[_0xf81f('0x59')]({},_0x322dcd,_0x2ba49f[_0xf81f('0x5d')]);var _0x10430c={'where':_0x322dcd[_0xf81f('0x56')]};return db['User'][_0xf81f('0x2f')](_0x10430c)[_0xf81f('0x35')](function(_0x30d9f7){_0x2efd2f[_0xf81f('0x2f')]=_0x30d9f7;if(_0x2ba49f[_0xf81f('0x4c')][_0xf81f('0x5e')]){_0x322dcd['include']=[{'all':!![]}];}if(!_[_0xf81f('0x3e')](_0x322dcd['attributes'],'id')){_0x322dcd[_0xf81f('0x51')][_0xf81f('0x5f')]('id');}return db['User'][_0xf81f('0x60')](_0x322dcd);})[_0xf81f('0x35')](function(_0x46f6f9){_0x2efd2f[_0xf81f('0x61')]=_0x46f6f9;if(_0x2ba49f['query']['openTabs']===_0xf81f('0x62')){var _0x4ef748=[];for(var _0x8c42f3=0x0;_0x8c42f3<_0x2efd2f[_0xf81f('0x61')][_0xf81f('0x63')];_0x8c42f3++){_0x4ef748['push'](get_open_tabs(_0xf81f('0x64'),_0x2efd2f[_0xf81f('0x61')][_0x8c42f3][_0xf81f('0x65')]));_0x4ef748[_0xf81f('0x5f')](get_open_tabs(_0xf81f('0x66'),_0x2efd2f['rows'][_0x8c42f3]['dataValues']));_0x4ef748[_0xf81f('0x5f')](get_open_tabs(_0xf81f('0x67'),_0x2efd2f[_0xf81f('0x61')][_0x8c42f3][_0xf81f('0x65')]));_0x4ef748[_0xf81f('0x5f')](get_open_tabs(_0xf81f('0x68'),_0x2efd2f[_0xf81f('0x61')][_0x8c42f3][_0xf81f('0x65')]));_0x4ef748[_0xf81f('0x5f')](get_open_tabs('openchannel',_0x2efd2f['rows'][_0x8c42f3]['dataValues']));_0x4ef748[_0xf81f('0x5f')](get_open_tabs(_0xf81f('0x69'),_0x2efd2f[_0xf81f('0x61')][_0x8c42f3][_0xf81f('0x65')]));}return BPromise[_0xf81f('0x6a')](_0x4ef748)[_0xf81f('0x35')](function(_0x42e5fc){return _0x2efd2f;});}else{return _0x2efd2f;}})[_0xf81f('0x35')](respondWithFilteredResult(_0x37febb,_0x322dcd))[_0xf81f('0x28')](handleError(_0x37febb,null));};exports['show']=function(_0x43f840,_0x574451){var _0x4986dc={'raw':![],'where':{'id':_0x43f840['params']['id']}},_0x5ea292={};_0x5ea292['model']=_[_0xf81f('0x4a')](_['keys'](db[_0xf81f('0x6b')][_0xf81f('0x47')]),['password',_0xf81f('0x4b')]);_0x5ea292[_0xf81f('0x4c')]=_[_0xf81f('0x4d')](_0x43f840[_0xf81f('0x4c')]);_0x5ea292[_0xf81f('0x57')]=_[_0xf81f('0x4e')](_0x5ea292[_0xf81f('0x4f')],_0x5ea292[_0xf81f('0x4c')]);_0x4986dc[_0xf81f('0x51')]=_[_0xf81f('0x4e')](_0x5ea292[_0xf81f('0x4f')],qs[_0xf81f('0x50')](_0x43f840[_0xf81f('0x4c')]['fields']));_0x4986dc['attributes']=_0x4986dc['attributes']['length']?_0x4986dc[_0xf81f('0x51')]:_0x5ea292[_0xf81f('0x4f')];if(_0x43f840[_0xf81f('0x4c')][_0xf81f('0x5e')]){_0x4986dc[_0xf81f('0x6c')]=[{'all':!![]}];}_0x4986dc=_[_0xf81f('0x59')]({},_0x4986dc,_0x43f840[_0xf81f('0x5d')]);if(!_[_0xf81f('0x3e')](_0x4986dc[_0xf81f('0x51')],'id')){_0x4986dc['attributes'][_0xf81f('0x5f')]('id');}return db['User'][_0xf81f('0x3f')](_0x4986dc)[_0xf81f('0x35')](handleEntityNotFound(_0x574451,null))[_0xf81f('0x35')](function(_0x57fe6f){var _0x58a129=[];values=_0x57fe6f;if(_0x43f840[_0xf81f('0x4c')]['openTabs']==='true'){_0x58a129[_0xf81f('0x5f')](get_open_tabs('chat',_0x57fe6f['dataValues']));_0x58a129[_0xf81f('0x5f')](get_open_tabs(_0xf81f('0x66'),_0x57fe6f[_0xf81f('0x65')]));_0x58a129[_0xf81f('0x5f')](get_open_tabs(_0xf81f('0x6d'),_0x57fe6f['dataValues']));_0x58a129[_0xf81f('0x5f')](get_open_tabs(_0xf81f('0x69'),_0x57fe6f[_0xf81f('0x65')]));_0x58a129[_0xf81f('0x5f')](get_open_tabs(_0xf81f('0x67'),_0x57fe6f[_0xf81f('0x65')]));_0x58a129[_0xf81f('0x5f')](get_open_tabs(_0xf81f('0x68'),_0x57fe6f[_0xf81f('0x65')]));return BPromise[_0xf81f('0x6a')](_0x58a129);}else{return values;}})['then'](function(_0x15c461){return values;})[_0xf81f('0x35')](respondWithResult(_0x574451,null))[_0xf81f('0x28')](handleError(_0x574451,null));};exports[_0xf81f('0x33')]=function(_0x2612cd,_0x380e3f){if(_0x2612cd['body']['id']){delete _0x2612cd[_0xf81f('0x6e')]['id'];}delete _0x2612cd[_0xf81f('0x6e')][_0xf81f('0x36')];return db[_0xf81f('0x6b')][_0xf81f('0x3f')]({'where':{'id':_0x2612cd[_0xf81f('0x6f')]['id']}})[_0xf81f('0x35')](handleEntityNotFound(_0x380e3f,null))[_0xf81f('0x35')](saveUpdates(_0x2612cd[_0xf81f('0x6e')],null))['then'](respondWithResult(_0x380e3f,null))[_0xf81f('0x28')](handleError(_0x380e3f,null));};exports[_0xf81f('0x70')]=function(_0x37ce3e,_0x492cc8){return db[_0xf81f('0x6b')][_0xf81f('0x70')]()[_0xf81f('0x35')](respondWithResult(_0x492cc8,null))[_0xf81f('0x28')](handleError(_0x492cc8,null));};exports[_0xf81f('0x71')]=function(_0x596e91,_0xead667,_0x3efc88){return db[_0xf81f('0x6b')][_0xf81f('0x3f')]({'where':{'id':_0x596e91[_0xf81f('0x6f')]['id']}})['then'](handleEntityNotFound(_0xead667,null))[_0xf81f('0x35')](function(_0x4284dc){if(_0x4284dc){return _0x4284dc[_0xf81f('0x71')](_0x596e91[_0xf81f('0x6e')]['ids'],_['omit'](_0x596e91[_0xf81f('0x6e')],[_0xf81f('0x72'),'id'])||{});}})[_0xf81f('0x35')](respondWithResult(_0xead667,null))['catch'](handleError(_0xead667,null));};function validateUser(_0x41a55d){return new BPromise(function(_0x25dcd1,_0x7ca784){if(_0x41a55d[_0xf81f('0x73')])return _0x25dcd1(_0x41a55d);return db['Setting'][_0xf81f('0x74')](0x1)[_0xf81f('0x35')](function(_0x85a790){if(_0x85a790[_0xf81f('0x75')])authService[_0xf81f('0x76')](_0x41a55d[_0xf81f('0x77')]);db['User'][_0xf81f('0x78')](_0xf81f('0x73'))[_0xf81f('0x35')](function(_0x921e42){if(_[_0xf81f('0x79')](_0x921e42)){_0x41a55d[_0xf81f('0x73')]=_0x85a790[_0xf81f('0x7a')]||0x1;return;}if(_[_0xf81f('0x79')](_0x85a790[_0xf81f('0x7a')])||_0x85a790[_0xf81f('0x7a')]===_0x921e42){_0x41a55d['internal']=_0x921e42+0x1;return;}if(_0x85a790[_0xf81f('0x7a')]>_0x921e42){_0x41a55d[_0xf81f('0x73')]=_0x85a790[_0xf81f('0x7a')];return;}return db[_0xf81f('0x5a')]['query'](_0xf81f('0x7b'),{'type':db['sequelize'][_0xf81f('0x7c')][_0xf81f('0x7d')]})[_0xf81f('0x35')](function(_0x259362){if(_0x259362&&_0x259362[_0xf81f('0x63')]){for(var _0x499aac=0x0,_0x5e8c15=_0x259362[_0xf81f('0x63')];_0x499aac<_0x5e8c15&&_[_0xf81f('0x79')](_0x41a55d[_0xf81f('0x73')]);_0x499aac++){if(_0x85a790[_0xf81f('0x7a')]<=_0x259362[_0x499aac][_0xf81f('0x7e')]){_0x41a55d[_0xf81f('0x73')]=_0x259362[_0x499aac][_0xf81f('0x7e')];}else if(_0x85a790['min_internal']>_0x259362[_0x499aac][_0xf81f('0x7e')]&&_0x85a790[_0xf81f('0x7a')]<=_0x259362[_0x499aac]['to']){_0x41a55d[_0xf81f('0x73')]=_0x85a790[_0xf81f('0x7a')];}}}if(_[_0xf81f('0x79')](_0x41a55d[_0xf81f('0x73')])){_0x41a55d[_0xf81f('0x73')]=_0x921e42+0x1;}return _0x25dcd1(_0x41a55d);});});})[_0xf81f('0x28')](function(_0x1ff805){_0x7ca784(_0x1ff805);});});}function updateUser(_0x2c278a){return new BPromise(function(_0x1b3750,_0x353a17){try{if(_0x2c278a[_0xf81f('0x7f')]){_0x2c278a[_0xf81f('0x80')]=_0x2c278a[_0xf81f('0x73')];_0x2c278a[_0xf81f('0x81')]={'mailbox':_0x2c278a['internal'],'password':_0x2c278a[_0xf81f('0x77')],'fullname':_0x2c278a['fullname'],'email':_0x2c278a[_0xf81f('0x82')]};}if(_0x2c278a[_0xf81f('0x36')]===_0xf81f('0x39')){if(!_0x2c278a[_0xf81f('0x83')])_0x2c278a[_0xf81f('0x83')]=['101',_0xf81f('0x84'),_0xf81f('0x85'),'113',_0xf81f('0x86'),_0xf81f('0x87'),_0xf81f('0x88'),'106',_0xf81f('0x89'),_0xf81f('0x8a'),_0xf81f('0x8b'),_0xf81f('0x8c'),_0xf81f('0x8d'),_0xf81f('0x8e'),'115'];}_0x1b3750(_0x2c278a);}catch(_0x3495cf){_0x353a17(_0x3495cf);}});}exports[_0xf81f('0x8f')]=function(_0x28759d,_0x2a29aa){if(_0x28759d[_0xf81f('0x38')][_0xf81f('0x36')]==='agent')throw new Error('Unauthorized');if(_0x28759d[_0xf81f('0x6e')][_0xf81f('0x36')]===_0xf81f('0x38')&&_0x28759d['user'][_0xf81f('0x36')]!=='admin'){throw new Error(_0xf81f('0x90'));}if(_0x28759d[_0xf81f('0x6e')][_0xf81f('0x36')]===_0xf81f('0x37')&&_0x28759d[_0xf81f('0x38')][_0xf81f('0x36')]!=='admin'){throw new Error(_0xf81f('0x91'));}return licenseUtil[_0xf81f('0x92')]([_0x28759d[_0xf81f('0x6e')]])[_0xf81f('0x35')](function(){return validateUser(_0x28759d[_0xf81f('0x6e')]);})[_0xf81f('0x35')](function(_0xa29f1a){return updateUser(_0xa29f1a)[_0xf81f('0x35')](function(_0x5ab917){if(_0x5ab917[_0xf81f('0x36')]==='admin'){_0x5ab917[_0xf81f('0x93')]=_0x28759d[_0xf81f('0x38')]['settingsEnabled'];delete _0x5ab917[_0xf81f('0x94')];}return _0x5ab917;});})[_0xf81f('0x35')](function(_0x4abb68){return db[_0xf81f('0x6b')][_0xf81f('0x8f')](_0x4abb68,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0xf81f('0x35')](function(_0x45f3b3){if(_0x28759d['body']['role']===_0xf81f('0x38'))return _0x45f3b3;if(_0x28759d[_0xf81f('0x38')][_0xf81f('0x36')]!=='user')return _0x45f3b3;return db['UserProfileSection'][_0xf81f('0x3f')]({'where':{'name':_0x45f3b3['role']===_0xf81f('0x39')?'Agents':_0xf81f('0x95'),'userProfileId':_0x28759d[_0xf81f('0x38')][_0xf81f('0x94')]},'raw':!![]})[_0xf81f('0x35')](function(_0x1e0cf3){if(!_0x1e0cf3||_0x1e0cf3[_0xf81f('0x96')]!=0x0)return _0x45f3b3;return db[_0xf81f('0x42')][_0xf81f('0x8f')]({'name':_0x45f3b3[_0xf81f('0x41')],'resourceId':_0x45f3b3['id'],'type':_0x1e0cf3[_0xf81f('0x41')],'sectionId':_0x1e0cf3['id']},{})[_0xf81f('0x35')](function(){return _0x45f3b3;});})[_0xf81f('0x28')](function(_0x3f04b5){logger[_0xf81f('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f04b5);throw _0x3f04b5;});})[_0xf81f('0x35')](respondWithResult(_0x2a29aa,0xc9))['catch'](handleError(_0x2a29aa,null));};exports[_0xf81f('0x97')]=function(_0x1c6bcb,_0x4605f3){var _0x1faf01=_0x1c6bcb[_0xf81f('0x6e')];var _0x8ba4bc=[];if(_0x1c6bcb[_0xf81f('0x38')]['role']===_0xf81f('0x39'))throw new Error(_0xf81f('0x98'));if(_[_0xf81f('0x99')](_0x1faf01,['role',_0xf81f('0x38')])&&_0x1c6bcb[_0xf81f('0x38')][_0xf81f('0x36')]!==_0xf81f('0x37')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xf81f('0x99')](_0x1faf01,[_0xf81f('0x36'),_0xf81f('0x37')])&&_0x1c6bcb[_0xf81f('0x38')]['role']!==_0xf81f('0x37')){throw new Error(_0xf81f('0x9a'));}return licenseUtil[_0xf81f('0x92')](_0x1faf01)[_0xf81f('0x35')](function(){return validateUser(_0x1faf01[0x0]);})[_0xf81f('0x35')](function(){for(var _0x30a1dc=0x1;_0x30a1dc<_0x1faf01['length'];_0x30a1dc++){var _0x2cb314=_0x1faf01[_0x30a1dc-0x1][_0xf81f('0x73')];if(!_0x1faf01[_0x30a1dc][_0xf81f('0x73')])_0x1faf01[_0x30a1dc][_0xf81f('0x73')]=_0x2cb314+0x1;_0x8ba4bc[_0xf81f('0x5f')](validateUser(_0x1faf01[_0x30a1dc]));}return BPromise[_0xf81f('0x6a')](_0x8ba4bc);})[_0xf81f('0x35')](function(){_0x8ba4bc=[];for(var _0x10599a=0x0;_0x10599a<_0x1faf01[_0xf81f('0x63')];_0x10599a++){_0x8ba4bc[_0xf81f('0x5f')](updateUser(_0x1faf01[_0x10599a]));}return BPromise[_0xf81f('0x6a')](_0x8ba4bc);})[_0xf81f('0x35')](function(){return BPromise['each'](_0x1faf01,function(_0x166909){return db[_0xf81f('0x6b')][_0xf81f('0x8f')](_0x166909,{'include':[{'model':db[_0xf81f('0x81')],'as':'VoiceMail'}]})['then'](function(_0x25faba){_0x166909['id']=_0x25faba['id'];return _0x166909;});});})[_0xf81f('0x35')](function(_0x5029dd){if(_0x1c6bcb[_0xf81f('0x6e')][_0xf81f('0x36')]===_0xf81f('0x38'))return _0x5029dd;if(_0x1c6bcb[_0xf81f('0x38')][_0xf81f('0x36')]!=='user')return _0x5029dd;var _0x1f8189=_[_0xf81f('0x99')](_0x5029dd,function(_0x31c5db){return _0x31c5db[_0xf81f('0x36')]===_0xf81f('0x39')||_0x31c5db[_0xf81f('0x36')]===_0xf81f('0x3a');});if(!_0x1f8189)return _0x5029dd;return db[_0xf81f('0x9b')][_0xf81f('0x60')]({'where':{'name':{'$or':[_0xf81f('0x9c'),_0xf81f('0x95')]},'userProfileId':_0x1c6bcb[_0xf81f('0x38')]['userProfileId']},'raw':!![]})[_0xf81f('0x35')](function(_0x4563c6){if(_[_0xf81f('0x9d')](_0x4563c6)||!_[_0xf81f('0x99')](_0x4563c6,[_0xf81f('0x96'),0x0]))return _0x5029dd;_0x8ba4bc=[];var _0x407b27=_(_0x4563c6)[_0xf81f('0x3d')](function(_0x349da7){if(_0x349da7[_0xf81f('0x96')]===0x1)return;return _0x349da7[_0xf81f('0x41')]===_0xf81f('0x9c')?_0xf81f('0x39'):_0xf81f('0x3a');})[_0xf81f('0x9e')]()[_0xf81f('0x40')]();for(var _0x42ebac=0x0;_0x42ebac<_0x5029dd['length'];_0x42ebac++){if(!_[_0xf81f('0x3e')](_0x407b27,_0x5029dd[_0x42ebac][_0xf81f('0x36')]))return;var _0x52f2c7=_0x5029dd[_0x42ebac][_0xf81f('0x36')]==='agent'?_0xf81f('0x9c'):'Telephones';_0x8ba4bc[_0xf81f('0x5f')](db['UserProfileResource'][_0xf81f('0x8f')]({'name':_0x5029dd[_0x42ebac]['name'],'resourceId':_0x5029dd[_0x42ebac]['id'],'type':_0x52f2c7,'sectionId':_[_0xf81f('0x3f')](_0x4563c6,['name',_0x52f2c7])['id']},{}));}return BPromise['all'](_0x8ba4bc);});})[_0xf81f('0x35')](respondWithResult(_0x4605f3,0xc9))[_0xf81f('0x28')](handleError(_0x4605f3,null));};exports[_0xf81f('0x9f')]=function(_0x3d94d9,_0xc4137f,_0x51a031){if(_0x3d94d9['body']['id']){delete _0x3d94d9['body']['id'];}return db[_0xf81f('0x6b')]['find']({'where':{'id':_0x3d94d9[_0xf81f('0x6f')]['id']}})[_0xf81f('0x35')](function(_0x147e74){if(!_0x147e74)return null;if(_0x147e74['id']===_0x3d94d9[_0xf81f('0x38')]['id']){if(!_0x3d94d9['body']['oldPassword']||!_0x3d94d9['body'][_0xf81f('0xa0')]){throw new db['Sequelize'][(_0xf81f('0xa1'))](_0xf81f('0xa2'));}if(!_0x147e74[_0xf81f('0xa3')](_0x3d94d9['body'][_0xf81f('0xa4')])){throw new db[(_0xf81f('0xa5'))][(_0xf81f('0xa1'))]('Wrong\x20credentials');}if(_0x3d94d9['body'][_0xf81f('0xa4')]===_0x3d94d9['body'][_0xf81f('0xa0')]){throw new db[(_0xf81f('0xa5'))]['ValidationError'](_0xf81f('0xa6'));}}else if(_0x3d94d9[_0xf81f('0x38')][_0xf81f('0x36')]==='admin'){if(!_0x3d94d9[_0xf81f('0x6e')][_0xf81f('0xa0')]){throw new db[(_0xf81f('0xa5'))]['ValidationError'](_0xf81f('0xa7'));}}else if(_0x3d94d9[_0xf81f('0x38')][_0xf81f('0x36')]===_0xf81f('0x38')){if(!_0x3d94d9[_0xf81f('0x6e')][_0xf81f('0xa0')]){throw new db['Sequelize'][(_0xf81f('0xa1'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x147e74[_0xf81f('0x36')]!=='agent'){throw new db[(_0xf81f('0xa5'))][(_0xf81f('0xa1'))]('Unauthorized');}}else{throw new db[(_0xf81f('0xa5'))]['ValidationError']('Unauthorized');}return _0x147e74;})[_0xf81f('0x35')](handleEntityNotFound(_0xc4137f,null))['then'](function(_0x47cd6a){return db[_0xf81f('0xa8')][_0xf81f('0xa9')]({'attributes':['id',_0xf81f('0x75'),'enforcePasswordHistory',_0xf81f('0xaa')]})['then'](function(_0x70b7e1){if(_0x70b7e1[_0xf81f('0x75')])authService[_0xf81f('0x76')](_0x3d94d9[_0xf81f('0x6e')][_0xf81f('0xa0')]);if(!_0x70b7e1[_0xf81f('0xab')]||!_0x47cd6a[_0xf81f('0xac')])return _0x47cd6a;authService[_0xf81f('0xad')](_0x3d94d9[_0xf81f('0x6e')]['newPassword'],_0x47cd6a[_0xf81f('0xac')],_0x70b7e1['passwordHistoryLimit']);return _0x47cd6a;})['then'](saveUpdates({'password':_0x3d94d9[_0xf81f('0x6e')][_0xf81f('0xa0')],'passwordResetAt':_0x3d94d9[_0xf81f('0x38')]['id']==_0x3d94d9[_0xf81f('0x6f')]['id']?moment():null,'previousPasswords':authService[_0xf81f('0xae')](_0x3d94d9[_0xf81f('0x6e')]['newPassword'],_0x47cd6a[_0xf81f('0xac')])},null));})[_0xf81f('0x35')](respondWithResult(_0xc4137f,null))[_0xf81f('0x28')](handleError(_0xc4137f,null));};exports[_0xf81f('0xaf')]=function(_0x39b441,_0x48dc0b,_0x3567ec){var _0x15b1dd=_0x39b441['body'][_0xf81f('0xb0')];return db['User'][_0xf81f('0x3f')]({'where':{'id':_0x39b441[_0xf81f('0x6f')]['id']},'attributes':['id',_0xf81f('0x41'),_0xf81f('0x36'),'online',_0xf81f('0xb1'),_0xf81f('0xb2'),'interface']})[_0xf81f('0x35')](handleEntityNotFound(_0x48dc0b,null))[_0xf81f('0x35')](function(_0x1d6c2f){if(_0x1d6c2f){if(!utils[_0xf81f('0xb3')](_0x15b1dd)){throw new db['Sequelize'][(_0xf81f('0xa1'))]('Unknown\x20channel');}return _0x1d6c2f['add'+_[_0xf81f('0xb4')](_0x15b1dd[_0xf81f('0xb5')]())+_0xf81f('0xb6')](_0x39b441[_0xf81f('0x6e')]['ids'],{'penalty':_0x39b441['body']['penalty']||0x0})[_0xf81f('0xb7')](function(_0x4605ac){for(var _0xb1f7b2=0x0;_0xb1f7b2<_0x39b441['body']['ids'][_0xf81f('0x63')];_0xb1f7b2+=0x1){var _0x535943={'UserId':_0x39b441[_0xf81f('0x6f')]['id']};_0x535943[_['capitalize'](_0x15b1dd[_0xf81f('0xb5')]())+'QueueId']=_0x39b441[_0xf81f('0x6e')][_0xf81f('0x72')][_0xb1f7b2];socket[_0xf81f('0xb8')]('user'+_[_0xf81f('0xb4')](_0x15b1dd[_0xf81f('0xb5')]())+_0xf81f('0xb9'),_0x535943);}return _0x4605ac;})[_0xf81f('0x35')](function(){if(_0x15b1dd===_0xf81f('0xba')){return db['VoiceQueue'][_0xf81f('0x60')]({'where':{'id':_0x39b441[_0xf81f('0x6e')][_0xf81f('0x72')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xf81f('0x35')](function(_0x3bdd8a){var _0x26546d=_0x1d6c2f['get']({'plain':!![]});var _0x1276e4=[];if(_0x15b1dd==='voice'&&_0x26546d[_0xf81f('0x36')]===_0xf81f('0x39')&&_0x26546d[_0xf81f('0xbb')]){for(var _0x45403b=0x0;_0x45403b<_0x3bdd8a[_0xf81f('0x63')];_0x45403b+=0x1){_0x1276e4['push']({'membername':_0x26546d[_0xf81f('0x41')],'UserId':_0x26546d['id'],'queue_name':_0x3bdd8a[_0x45403b][_0xf81f('0x41')],'VoiceQueueId':_0x3bdd8a[_0x45403b]['id'],'interface':_[_0xf81f('0x79')](_0x26546d[_0xf81f('0xbc')])?util['format'](_0xf81f('0xbd'),_0x26546d[_0xf81f('0x41')]):_0x26546d[_0xf81f('0xbc')],'paused':_0x26546d['voicePause']||![],'penalty':_0x39b441[_0xf81f('0x6e')][_0xf81f('0xbe')]||0x0});}return BPromise[_0xf81f('0xbf')](_0x1276e4,function(_0x417006){return db[_0xf81f('0xc0')][_0xf81f('0xc1')](_0x417006);});}return _0x1d6c2f;});}})[_0xf81f('0x35')](respondWithStatusCode(_0x48dc0b,null))[_0xf81f('0x28')](handleError(_0x48dc0b,null));};exports[_0xf81f('0xc2')]=function(_0xc2fa71,_0x7e4659,_0x44dc5e){var _0x904503;return db['User'][_0xf81f('0x3f')]({'where':{'id':_0xc2fa71[_0xf81f('0x6f')]['id']},'attributes':['id',_0xf81f('0x41'),_0xf81f('0x36')]})[_0xf81f('0x35')](handleEntityNotFound(_0x7e4659,null))[_0xf81f('0x35')](function(_0x324213){if(_0x324213){_0x904503=_0x324213;if(!_0xc2fa71['query'][_0xf81f('0xb0')]||!utils[_0xf81f('0xb3')](_0xc2fa71['query']['channel'])){throw new db[(_0xf81f('0xa5'))][(_0xf81f('0xa1'))](_0xf81f('0xc3'));}return _0x324213[_0xf81f('0xc4')+_[_0xf81f('0xb4')](_0xc2fa71['query'][_0xf81f('0xb0')][_0xf81f('0xb5')]())+_0xf81f('0xb6')](_0xc2fa71[_0xf81f('0x4c')][_0xf81f('0x72')]);}})[_0xf81f('0x35')](function(_0x14895a){for(var _0x144b23=0x0;_0x144b23<_0xc2fa71[_0xf81f('0x4c')][_0xf81f('0x72')]['length'];_0x144b23+=0x1){var _0x32e0c0={'UserId':_0xc2fa71[_0xf81f('0x6f')]['id']};_0x32e0c0[_[_0xf81f('0xb4')](_0xc2fa71[_0xf81f('0x4c')][_0xf81f('0xb0')][_0xf81f('0xb5')]())+'QueueId']=_0xc2fa71[_0xf81f('0x4c')][_0xf81f('0x72')][_0x144b23];socket[_0xf81f('0xb8')](_0xf81f('0x38')+_[_0xf81f('0xb4')](_0xc2fa71[_0xf81f('0x4c')][_0xf81f('0xb0')]['toLowerCase']())+_0xf81f('0xc5'),_0x32e0c0);}return _0x14895a;})['then'](function(){if(_0xc2fa71[_0xf81f('0x4c')]['channel']===_0xf81f('0xba')){return db[_0xf81f('0xc0')][_0xf81f('0x34')]({'where':{'UserId':_0xc2fa71[_0xf81f('0x6f')]['id'],'VoiceQueueId':_0xc2fa71[_0xf81f('0x4c')][_0xf81f('0x72')]},'individualHooks':!![]})[_0xf81f('0x35')](function(){return _0x904503;});}return _0x904503;})[_0xf81f('0x35')](respondWithStatusCode(_0x7e4659,null))[_0xf81f('0x28')](handleError(_0x7e4659,null));};exports[_0xf81f('0xc6')]=function(_0x13ca89,_0x5c761c,_0x5f2fae){_0x13ca89[_0xf81f('0x6e')]['userpic']=_0x13ca89[_0xf81f('0xc7')]['filename'];return db['User'][_0xf81f('0x3f')]({'where':{'id':_0x13ca89[_0xf81f('0x6f')]['id']}})['then'](handleEntityNotFound(_0x5c761c,null))['then'](saveUpdates(_0x13ca89[_0xf81f('0x6e')],null))[_0xf81f('0x35')](respondWithResult(_0x5c761c,null))[_0xf81f('0x28')](handleError(_0x5c761c,null));};exports[_0xf81f('0xc8')]=function(_0x240202,_0x292f79,_0x5f407e){var _0x523a0a=path[_0xf81f('0xc9')](config[_0xf81f('0xca')],'server/files/images/logos/default_profile.png');return db[_0xf81f('0x6b')][_0xf81f('0x3f')]({'where':{'id':_0x240202[_0xf81f('0x6f')]['id']},'attributes':['id',_0xf81f('0xcb')],'raw':!![]})[_0xf81f('0x35')](handleEntityNotFound(_0x292f79,null))[_0xf81f('0x35')](function(_0xfbdf4b){if(_0xfbdf4b){if(_[_0xf81f('0x79')](_0xfbdf4b[_0xf81f('0xcb')])){return _0x292f79[_0xf81f('0xcc')](_0x523a0a);}else{if(!fs[_0xf81f('0xcd')](path[_0xf81f('0xc9')](config['root'],_0xf81f('0xce'),_0xfbdf4b['userpic']))){return _0x292f79[_0xf81f('0xcc')](_0x523a0a);}return _0x292f79[_0xf81f('0xcc')](path['join'](config['root'],_0xf81f('0xce'),_0xfbdf4b[_0xf81f('0xcb')]));}}})[_0xf81f('0x28')](handleError(_0x292f79,null));};exports['getOpenTabs']=function(_0x3b06af,_0x4de326,_0x1a118c){return db[_0xf81f('0x6b')][_0xf81f('0x3f')]({'where':{'id':_0x3b06af['params']['id']},'attributes':['id']})[_0xf81f('0x35')](handleEntityNotFound(_0x4de326,null))[_0xf81f('0x35')](function(_0x3b75be){var _0x6b2e25=[];values=_0x3b75be[_0xf81f('0x65')];_0x6b2e25[_0xf81f('0x5f')](get_open_tabs(_0xf81f('0x64'),_0x3b75be[_0xf81f('0x65')]));_0x6b2e25['push'](get_open_tabs('sms',_0x3b75be[_0xf81f('0x65')]));_0x6b2e25[_0xf81f('0x5f')](get_open_tabs(_0xf81f('0x6d'),_0x3b75be[_0xf81f('0x65')]));_0x6b2e25[_0xf81f('0x5f')](get_open_tabs(_0xf81f('0x69'),_0x3b75be[_0xf81f('0x65')]));_0x6b2e25[_0xf81f('0x5f')](get_open_tabs('fax',_0x3b75be[_0xf81f('0x65')]));_0x6b2e25[_0xf81f('0x5f')](get_open_tabs(_0xf81f('0x68'),_0x3b75be[_0xf81f('0x65')]));return BPromise[_0xf81f('0x6a')](_0x6b2e25);})[_0xf81f('0x35')](function(_0x574900){var _0x41b44b=[];if(_0x574900){for(var _0x412d93=0x0;_0x412d93=_0x5db0bd[_0xae45('0x56')]){throw new Error(_0xae45('0x57'));}})[_0xae45('0x14')](function(){if(_0xb3929a){return db['UserVoiceQueueRt'][_0xae45('0x4d')]({'where':{'membername':_0xb3929a[_0xae45('0x2b')]},'individualHooks':!![]});}})[_0xae45('0x14')](function(){if(_0xb3929a){return _0xb3929a[_0xae45('0x58')]({'raw':!![]});}})[_0xae45('0x14')](function(_0x53f00f){if(_0xb3929a){if(_0x53f00f){var _0x327958=[];_0x5a7db9=_0x53f00f;if(_0x5a7db9[_0xae45('0x33')]){for(var _0x7ce71=0x0;_0x7ce71<_0x5a7db9[_0xae45('0x33')];_0x7ce71++){_0x327958['push'](db[_0xae45('0x42')][_0xae45('0x59')]({'membername':_0xb3929a['name'],'UserId':_0xb3929a['id'],'queue_name':_0x5a7db9[_0x7ce71][_0xae45('0x2b')],'VoiceQueueId':_0x5a7db9[_0x7ce71]['id'],'interface':_0x9becb5,'paused':_0xb3929a[_0xae45('0x51')]||![],'penalty':_0x5a7db9[_0x7ce71]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xae45('0x4b')](_0x327958);}}}})['then'](function(){if(_0xb3929a){return db[_0xae45('0x30')][_0xae45('0x31')]({'where':{'membername':_0xb3929a[_0xae45('0x2b')],'exitAt':null}});}})[_0xae45('0x14')](function(_0x5cec65){if(_0xb3929a){if(_0x5cec65&&_0x5cec65[_0xae45('0x33')]){var _0x2a8f85=[];_0x5cec65[_0xae45('0x37')](function(_0x43d0a3){_0x2a8f85[_0xae45('0x38')](_0x43d0a3['update']({'exitAt':moment()[_0xae45('0x34')](_0xae45('0x3a'))}));});return BPromise[_0xae45('0x4b')](_0x2a8f85);}}})['then'](function(_0x2d29a8){if(_0xb3929a){var _0x27ce14=[];var _0x9b0c91=[];var _0x2ed9b1=utils[_0xae45('0x36')]();var _0x5bf782={'membername':_0xb3929a[_0xae45('0x2b')],'interface':_0x9becb5,'enterAt':moment()['format'](_0xae45('0x3a')),'role':_0xb3929a['role'],'internal':_0xb3929a[_0xae45('0x2d')]};_0x2ed9b1['forEach'](function(_0x1c16aa){_0x27ce14[_0xae45('0x38')](_['merge']({'channel':_0x1c16aa,'type':_0xae45('0x5a'),'data1':_0xae45('0x5b'),'data2':_0x9becb5},_0x5bf782));if(_0xb3929a[_0xae45('0x51')]){_0x9b0c91['push'](_['merge']({'channel':_0x1c16aa,'type':_0xae45('0x32'),'data1':'LOGININPAUSE'},_0x5bf782));}});return db[_0xae45('0x30')][_0xae45('0x3d')](_0x27ce14[_0xae45('0x5c')](_0x9b0c91),{'individualHooks':!![]});}})[_0xae45('0x14')](function(){if(_0xb3929a){return _0xb3929a[_0xae45('0x2f')]({'online':!![],'lastLoginAt':moment()['format'](_0xae45('0x3a')),'voicePause':_0xb3929a[_0xae45('0x51')]||![],'mailPause':_0xb3929a[_0xae45('0x51')]||![],'chatPause':_0xb3929a['loginInPause']||![],'faxPause':_0xb3929a[_0xae45('0x51')]||![],'smsPause':_0xb3929a['loginInPause']||![],'openchannelPause':_0xb3929a['loginInPause']||![],'pauseType':_0xb3929a[_0xae45('0x51')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x9becb5});}})[_0xae45('0x14')](function(_0x25f2ae){_0x1363c0(_0x25f2ae);})[_0xae45('0x1d')](function(_0x2b25b4){_0x986e5(_0x1bcd12[_0xae45('0x1a')](0x1f4,_0x2b25b4['message']));});});}; \ No newline at end of file +var _0x4652=['internal','interface','UserVoiceQueueRt','update','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','SIP/%s','DEFAULT\x20PAUSE','body','uniqueid','bulkCreate','type','UnpauseUser','findOne','channel','Unknown\x20channel','voice','MemberReport','mail','chat','fax','sms','openchannel','whatsapp','set','Pause','push','all','LogoutUser','destroy','LoginUser','mobile','phone','loginInPause','count','../../config/license/util','getLicense','agents','upsert','role','LOGIN','callysquare','merge','LOGININPAUSE','concat','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./user.socket','register','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetUser','User','findAll','options','where','limit','include','map','attributes','model','catch','ShowUser','raw','PauseUser','find','name'];(function(_0x3d9bfe,_0x2f64e2){var _0x4c0f42=function(_0x42f8b2){while(--_0x42f8b2){_0x3d9bfe['push'](_0x3d9bfe['shift']());}};_0x4c0f42(++_0x2f64e2);}(_0x4652,0x1b6));var _0x2465=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4652[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x2465('0x0'));var util=require(_0x2465('0x1'));var moment=require(_0x2465('0x2'));var BPromise=require(_0x2465('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2465('0x4'));var db=require(_0x2465('0x5'))['db'];var utils=require(_0x2465('0x6'));var logger=require(_0x2465('0x7'))(_0x2465('0x8'));var config=require(_0x2465('0x9'));var jayson=require(_0x2465('0xa'));var client=jayson[_0x2465('0xb')][_0x2465('0xc')]({'port':0x232a});config[_0x2465('0xd')]=_[_0x2465('0xe')](config[_0x2465('0xd')],{'host':_0x2465('0xf'),'port':0x18eb});var socket=require(_0x2465('0x10'))(new Redis(config[_0x2465('0xd')]));require(_0x2465('0x11'))[_0x2465('0x12')](socket);function respondWithRpcPromise(_0x5bb14f,_0x3da3a1,_0x817988){return new BPromise(function(_0x112aef,_0x2824fb){return client[_0x2465('0x13')](_0x5bb14f,_0x817988)[_0x2465('0x14')](function(_0x31adac){logger[_0x2465('0x15')](_0x2465('0x16'),_0x3da3a1,_0x2465('0x17'));logger[_0x2465('0x18')](_0x2465('0x19'),_0x3da3a1,'request\x20sent',JSON[_0x2465('0x1a')](_0x31adac));if(_0x31adac[_0x2465('0x1b')]){if(_0x31adac[_0x2465('0x1b')][_0x2465('0x1c')]===0x1f4){logger[_0x2465('0x1b')]('User,\x20%s,\x20%s',_0x3da3a1,_0x31adac[_0x2465('0x1b')][_0x2465('0x1d')]);return _0x2824fb(_0x31adac[_0x2465('0x1b')][_0x2465('0x1d')]);}logger[_0x2465('0x1b')](_0x2465('0x16'),_0x3da3a1,_0x31adac['error'][_0x2465('0x1d')]);return _0x112aef(_0x31adac['error'][_0x2465('0x1d')]);}else{logger[_0x2465('0x15')]('User,\x20%s,\x20%s',_0x3da3a1,_0x2465('0x17'));_0x112aef(_0x31adac[_0x2465('0x1e')][_0x2465('0x1d')]);}})['catch'](function(_0x18c229){logger['error'](_0x2465('0x16'),_0x3da3a1,_0x18c229);_0x2824fb(_0x18c229);});});}exports[_0x2465('0x1f')]=function(_0x3162e1){var _0x5d7e9a=this;return new Promise(function(_0x340927,_0x56fcc8){return db[_0x2465('0x20')][_0x2465('0x21')]({'raw':_0x3162e1[_0x2465('0x22')]?_0x3162e1['options']['raw']===undefined?!![]:![]:!![],'where':_0x3162e1[_0x2465('0x22')]?_0x3162e1[_0x2465('0x22')][_0x2465('0x23')]||null:null,'attributes':_0x3162e1[_0x2465('0x22')]?_0x3162e1['options']['attributes']||null:null,'limit':_0x3162e1[_0x2465('0x22')]?_0x3162e1[_0x2465('0x22')][_0x2465('0x24')]||null:null,'include':_0x3162e1[_0x2465('0x22')]?_0x3162e1[_0x2465('0x22')][_0x2465('0x25')]?_[_0x2465('0x26')](_0x3162e1['options']['include'],function(_0x242bf8){return{'model':db[_0x242bf8['model']],'as':_0x242bf8['as'],'attributes':_0x242bf8[_0x2465('0x27')],'include':_0x242bf8[_0x2465('0x25')]?_[_0x2465('0x26')](_0x242bf8['include'],function(_0x1b1676){return{'model':db[_0x1b1676[_0x2465('0x28')]],'as':_0x1b1676['as'],'attributes':_0x1b1676[_0x2465('0x27')],'include':_0x1b1676[_0x2465('0x25')]?_[_0x2465('0x26')](_0x1b1676[_0x2465('0x25')],function(_0x3945d1){return{'model':db[_0x3945d1['model']],'as':_0x3945d1['as'],'attributes':_0x3945d1[_0x2465('0x27')]};}):[]};}):[]};}):[]:[]})[_0x2465('0x14')](function(_0xa2114a){logger[_0x2465('0x15')](_0x2465('0x1f'),_0x3162e1);logger[_0x2465('0x18')](_0x2465('0x1f'),_0x3162e1,JSON[_0x2465('0x1a')](_0xa2114a));_0x340927(_0xa2114a);})[_0x2465('0x29')](function(_0x5ed505){logger[_0x2465('0x1b')](_0x2465('0x1f'),_0x5ed505[_0x2465('0x1d')],_0x3162e1);_0x56fcc8(_0x5d7e9a[_0x2465('0x1b')](0x1f4,_0x5ed505[_0x2465('0x1d')]));});});};exports[_0x2465('0x2a')]=function(_0x5438d8){var _0x524bfb=this;return new Promise(function(_0x5d2563,_0x4fc799){return db['User']['find']({'raw':_0x5438d8[_0x2465('0x22')]?_0x5438d8['options'][_0x2465('0x2b')]===undefined?!![]:![]:!![],'where':_0x5438d8[_0x2465('0x22')]?_0x5438d8[_0x2465('0x22')][_0x2465('0x23')]||null:null,'attributes':_0x5438d8['options']?_0x5438d8[_0x2465('0x22')][_0x2465('0x27')]||null:null,'include':_0x5438d8[_0x2465('0x22')]?_0x5438d8['options'][_0x2465('0x25')]?_[_0x2465('0x26')](_0x5438d8[_0x2465('0x22')][_0x2465('0x25')],function(_0x4cc55a){return{'model':db[_0x4cc55a[_0x2465('0x28')]],'as':_0x4cc55a['as'],'attributes':_0x4cc55a[_0x2465('0x27')],'include':_0x4cc55a['include']?_[_0x2465('0x26')](_0x4cc55a['include'],function(_0x1374eb){return{'model':db[_0x1374eb['model']],'as':_0x1374eb['as'],'attributes':_0x1374eb[_0x2465('0x27')],'include':_0x1374eb[_0x2465('0x25')]?_[_0x2465('0x26')](_0x1374eb['include'],function(_0x1aa074){return{'model':db[_0x1aa074['model']],'as':_0x1aa074['as'],'attributes':_0x1aa074[_0x2465('0x27')]};}):[]};}):[]};}):[]:[]})[_0x2465('0x14')](function(_0x3095ea){logger[_0x2465('0x15')]('ShowUser',_0x5438d8);logger[_0x2465('0x18')](_0x2465('0x2a'),_0x5438d8,JSON[_0x2465('0x1a')](_0x3095ea));_0x5d2563(_0x3095ea);})[_0x2465('0x29')](function(_0x5e55a4){logger['error']('ShowUser',_0x5e55a4[_0x2465('0x1d')],_0x5438d8);_0x4fc799(_0x524bfb[_0x2465('0x1b')](0x1f4,_0x5e55a4[_0x2465('0x1d')]));});});};exports[_0x2465('0x2c')]=function(_0x2e9387){var _0x48deb1=this;return new Promise(function(_0x5039dc,_0x440814){var _0x58a328;return db[_0x2465('0x20')][_0x2465('0x2d')]({'where':_0x2e9387[_0x2465('0x22')][_0x2465('0x23')]||{},'attributes':['id',_0x2465('0x2e'),'role',_0x2465('0x2f'),_0x2465('0x30')]})['then'](function(_0x2bb172){if(_0x2bb172){_0x58a328=_0x2bb172;return db[_0x2465('0x31')][_0x2465('0x32')]({'paused':0x1},{'where':{'UserId':_0x58a328['id']},'individualHooks':!![]});}})['then'](function(){if(_0x58a328){return db['MemberReport'][_0x2465('0x21')]({'where':{'membername':_0x58a328[_0x2465('0x2e')],'type':_0x2465('0x33'),'exitAt':null}});}})[_0x2465('0x14')](function(_0x5e2fca){if(_0x58a328){if(_0x5e2fca&&_0x5e2fca[_0x2465('0x34')]){var _0x424f78=moment()[_0x2465('0x35')](_0x2465('0x36'));for(var _0x1063c6=0x0,_0x8861f9=_0x5e2fca[_0x2465('0x34')];_0x1063c6<_0x8861f9;_0x1063c6++){_0x5e2fca[_0x1063c6][_0x2465('0x37')]({'exitAt':_0x424f78});}}}})[_0x2465('0x14')](function(){if(_0x58a328){var _0x450222=[];var _0xe51535=utils[_0x2465('0x38')]();_0xe51535[_0x2465('0x39')](function(_0xb361e0){_0x450222['push']({'channel':_0xb361e0,'membername':_0x58a328[_0x2465('0x2e')],'interface':_['isNil'](_0x58a328[_0x2465('0x30')])?util['format'](_0x2465('0x3a'),_0x58a328[_0x2465('0x2e')]):_0x58a328[_0x2465('0x30')],'type':_0x2465('0x33'),'enterAt':moment()[_0x2465('0x35')](_0x2465('0x36')),'data1':_0x2e9387['body']['type']||_0x2465('0x3b'),'role':_0x58a328['role'],'internal':_0x58a328[_0x2465('0x2f')],'uniqueid':_0x2e9387[_0x2465('0x3c')][_0x2465('0x3d')]||null});});return db['MemberReport'][_0x2465('0x3e')](_0x450222,{'individualHooks':!![]});}})[_0x2465('0x14')](function(){if(_0x58a328){return _0x58a328[_0x2465('0x32')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x2e9387['body'][_0x2465('0x3f')]||_0x2465('0x3b'),'lastPauseAt':moment()[_0x2465('0x35')](_0x2465('0x36'))});}})[_0x2465('0x14')](function(_0x2dd035){_0x5039dc(_0x2dd035);})[_0x2465('0x29')](function(_0x3c49de){_0x440814(_0x48deb1[_0x2465('0x1b')](0x1f4,_0x3c49de[_0x2465('0x1d')]));});});};exports[_0x2465('0x40')]=function(_0x5628ad){var _0x15b7f5=this;return new Promise(function(_0x4b9053,_0x3f9c82){var _0x3f08ff;return db[_0x2465('0x20')][_0x2465('0x41')]({'where':_0x5628ad[_0x2465('0x22')]['where']||{},'attributes':['id',_0x2465('0x2e')]})['then'](function(_0x2a9921){if(_0x2a9921){_0x3f08ff=_0x2a9921;if(_0x5628ad['body'][_0x2465('0x42')]&&!utils['isValidChannel'](_0x5628ad['body'][_0x2465('0x42')])){throw new Error(_0x2465('0x43'));}switch(_0x5628ad[_0x2465('0x3c')][_0x2465('0x42')]){case _0x2465('0x44'):return db[_0x2465('0x31')][_0x2465('0x32')]({'paused':0x0},{'where':{'UserId':_0x3f08ff['id']}})[_0x2465('0x14')](function(){return db[_0x2465('0x45')][_0x2465('0x2d')]({'where':{'channel':_0x5628ad[_0x2465('0x3c')]['channel'],'membername':_0x3f08ff[_0x2465('0x2e')],'type':_0x2465('0x33'),'exitAt':null}});})[_0x2465('0x14')](function(_0x7fb347){if(_0x7fb347){return _0x7fb347[_0x2465('0x32')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x2465('0x14')](function(){return _0x3f08ff[_0x2465('0x32')]({'voicePause':![]});});case _0x2465('0x46'):case _0x2465('0x47'):case _0x2465('0x48'):case _0x2465('0x49'):case _0x2465('0x4a'):case _0x2465('0x4b'):return db[_0x2465('0x45')][_0x2465('0x2d')]({'where':{'channel':_0x5628ad[_0x2465('0x3c')][_0x2465('0x42')],'membername':_0x3f08ff[_0x2465('0x2e')],'type':_0x2465('0x33'),'exitAt':null}})[_0x2465('0x14')](function(_0x1bf17a){return _0x1bf17a[_0x2465('0x32')]({'exitAt':moment()[_0x2465('0x35')](_0x2465('0x36')),'data2':'system'},{'individualHooks':!![]});})[_0x2465('0x14')](function(){var _0x28a65f={};_[_0x2465('0x4c')](_0x28a65f,util[_0x2465('0x35')]('%s%s',_0x5628ad[_0x2465('0x3c')][_0x2465('0x42')],_0x2465('0x4d')),![]);return _0x3f08ff[_0x2465('0x32')](_0x28a65f);});default:return db[_0x2465('0x31')][_0x2465('0x32')]({'paused':0x0},{'where':{'UserId':_0x3f08ff['id']}})[_0x2465('0x14')](function(){return db['MemberReport'][_0x2465('0x21')]({'where':{'membername':_0x3f08ff[_0x2465('0x2e')],'type':_0x2465('0x33'),'exitAt':null}});})[_0x2465('0x14')](function(_0x5b8982){var _0x5eedbb=[];_0x5b8982[_0x2465('0x39')](function(_0x1eb323){_0x5eedbb[_0x2465('0x4e')](_0x1eb323['update']({'exitAt':moment()[_0x2465('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'}));});return BPromise[_0x2465('0x4f')](_0x5eedbb);})[_0x2465('0x14')](function(){return _0x3f08ff['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x2465('0x14')](function(_0x30998e){_0x4b9053(_0x30998e);})[_0x2465('0x29')](function(_0x3c3757){_0x3f9c82(_0x15b7f5[_0x2465('0x1b')](0x1f4,_0x3c3757[_0x2465('0x1d')]));});});};exports[_0x2465('0x50')]=function(_0x200121){var _0x364575=this;return new Promise(function(_0x442b3d,_0x4368e5){var _0x21e5cd;return db[_0x2465('0x20')][_0x2465('0x41')]({'where':_0x200121[_0x2465('0x22')][_0x2465('0x23')]||{},'attributes':['id','name']})[_0x2465('0x14')](function(_0x49a9e0){if(_0x49a9e0){_0x21e5cd=_0x49a9e0;return db[_0x2465('0x31')][_0x2465('0x51')]({'where':{'membername':_0x21e5cd[_0x2465('0x2e')]},'individualHooks':!![]});}})[_0x2465('0x14')](function(){if(_0x21e5cd){return db[_0x2465('0x45')][_0x2465('0x21')]({'where':{'membername':_0x21e5cd[_0x2465('0x2e')],'exitAt':null}});}})[_0x2465('0x14')](function(_0x26bb20){if(_0x21e5cd){if(_0x26bb20&&_0x26bb20['length']){var _0x245c74=[];_0x26bb20[_0x2465('0x39')](function(_0x48b4e9){_0x245c74[_0x2465('0x4e')](_0x48b4e9[_0x2465('0x32')]({'exitAt':moment()[_0x2465('0x35')](_0x2465('0x36'))}));});return BPromise['all'](_0x245c74);}}})[_0x2465('0x14')](function(){if(_0x21e5cd){return _0x21e5cd[_0x2465('0x32')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x2465('0x14')](function(_0x2f33ac){_0x442b3d(_0x2f33ac);})['catch'](function(_0x31f832){_0x4368e5(_0x364575[_0x2465('0x1b')](0x1f4,_0x31f832['message']));});});};exports[_0x2465('0x52')]=function(_0x32b2e6){var _0x431ed8=this;return new Promise(function(_0x55a2d3,_0x251636){var _0x5da235;var _0x445ea3;var _0x156f59;var _0x12a62c;return db[_0x2465('0x20')]['findOne']({'where':_0x32b2e6[_0x2465('0x22')][_0x2465('0x23')]||{},'attributes':['id',_0x2465('0x2e'),'role',_0x2465('0x53'),_0x2465('0x54'),_0x2465('0x2f'),_0x2465('0x55'),_0x2465('0x30')]})[_0x2465('0x14')](function(_0x7d663d){if(_0x7d663d){_0x5da235=_0x7d663d;_0x12a62c=_0x32b2e6[_0x2465('0x3c')][_0x2465('0x30')]?_0x32b2e6[_0x2465('0x3c')]['interface']:util[_0x2465('0x35')](_0x2465('0x3a'),_0x5da235[_0x2465('0x2e')]);return db['User'][_0x2465('0x56')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x5da235['id']}}});}})[_0x2465('0x14')](function(_0x1ac8f3){if(_0x1ac8f3){_0x156f59=_0x1ac8f3;return require(_0x2465('0x57'))[_0x2465('0x58')]();}})[_0x2465('0x14')](function(_0x10f13b){if(_0x10f13b&&_0x10f13b[_0x2465('0x59')]&&_0x156f59>=_0x10f13b[_0x2465('0x59')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x2465('0x14')](function(){if(_0x5da235){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x5da235[_0x2465('0x2e')]},'individualHooks':!![]});}})['then'](function(){if(_0x5da235){return _0x5da235['getVoiceQueues']({'raw':!![]});}})[_0x2465('0x14')](function(_0xc3fff4){if(_0x5da235){if(_0xc3fff4){var _0x48dc88=[];_0x445ea3=_0xc3fff4;if(_0x445ea3['length']){for(var _0x1c1cbc=0x0;_0x1c1cbc<_0x445ea3[_0x2465('0x34')];_0x1c1cbc++){_0x48dc88[_0x2465('0x4e')](db['UserVoiceQueueRt'][_0x2465('0x5a')]({'membername':_0x5da235[_0x2465('0x2e')],'UserId':_0x5da235['id'],'queue_name':_0x445ea3[_0x1c1cbc]['name'],'VoiceQueueId':_0x445ea3[_0x1c1cbc]['id'],'interface':_0x12a62c,'paused':_0x5da235[_0x2465('0x55')]||![],'penalty':_0x445ea3[_0x1c1cbc]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x2465('0x4f')](_0x48dc88);}}}})[_0x2465('0x14')](function(){if(_0x5da235){return db[_0x2465('0x45')][_0x2465('0x21')]({'where':{'membername':_0x5da235[_0x2465('0x2e')],'exitAt':null}});}})['then'](function(_0x47a422){if(_0x5da235){if(_0x47a422&&_0x47a422[_0x2465('0x34')]){var _0x3df8c9=[];_0x47a422['forEach'](function(_0x27c103){_0x3df8c9['push'](_0x27c103[_0x2465('0x32')]({'exitAt':moment()['format'](_0x2465('0x36'))}));});return BPromise[_0x2465('0x4f')](_0x3df8c9);}}})[_0x2465('0x14')](function(_0x303360){if(_0x5da235){var _0x2a4b90=[];var _0x433a21=[];var _0x5dd984=utils[_0x2465('0x38')]();var _0x54dd02={'membername':_0x5da235[_0x2465('0x2e')],'interface':_0x12a62c,'enterAt':moment()[_0x2465('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x5da235[_0x2465('0x5b')],'internal':_0x5da235['internal']};_0x5dd984['forEach'](function(_0x5a9361){_0x2a4b90[_0x2465('0x4e')](_['merge']({'channel':_0x5a9361,'type':_0x2465('0x5c'),'data1':_0x2465('0x5d'),'data2':_0x12a62c},_0x54dd02));if(_0x5da235[_0x2465('0x55')]){_0x433a21[_0x2465('0x4e')](_[_0x2465('0x5e')]({'channel':_0x5a9361,'type':_0x2465('0x33'),'data1':_0x2465('0x5f')},_0x54dd02));}});return db[_0x2465('0x45')][_0x2465('0x3e')](_0x2a4b90[_0x2465('0x60')](_0x433a21),{'individualHooks':!![]});}})[_0x2465('0x14')](function(){if(_0x5da235){return _0x5da235[_0x2465('0x32')]({'online':!![],'lastLoginAt':moment()[_0x2465('0x35')](_0x2465('0x36')),'voicePause':_0x5da235[_0x2465('0x55')]||![],'mailPause':_0x5da235[_0x2465('0x55')]||![],'chatPause':_0x5da235[_0x2465('0x55')]||![],'faxPause':_0x5da235['loginInPause']||![],'smsPause':_0x5da235[_0x2465('0x55')]||![],'openchannelPause':_0x5da235['loginInPause']||![],'pauseType':_0x5da235[_0x2465('0x55')]?_0x2465('0x5f'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x12a62c});}})['then'](function(_0x384098){_0x55a2d3(_0x384098);})[_0x2465('0x29')](function(_0x6a060f){_0x251636(_0x431ed8[_0x2465('0x1b')](0x1f4,_0x6a060f[_0x2465('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index b36a9ff..9cbc98b 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 _0x97b2=['remove','update','emit','removeListener','register','length','user:','./user.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x97b2,0x97));var _0x297b=function(_0x21ecc8,_0x2bdead){_0x21ecc8=_0x21ecc8-0x0;var _0x510c1d=_0x97b2[_0x21ecc8];return _0x510c1d;};'use strict';var UserEvents=require(_0x297b('0x0'));var events=[_0x297b('0x1'),_0x297b('0x2'),_0x297b('0x3')];function createListener(_0x47f658,_0x4e98fc){return function(_0x5a1552){_0x4e98fc[_0x297b('0x4')](_0x47f658,_0x5a1552);};}function removeListener(_0x38f4ec,_0x43e0c8){return function(){UserEvents[_0x297b('0x5')](_0x38f4ec,_0x43e0c8);};}exports[_0x297b('0x6')]=function(_0x20d9ae){for(var _0x3ea646=0x0,_0x1bad09=events[_0x297b('0x7')];_0x3ea646<_0x1bad09;_0x3ea646++){var _0x553e50=events[_0x3ea646];var _0x1ca9c0=createListener(_0x297b('0x8')+_0x553e50,_0x20d9ae);UserEvents['on'](_0x553e50,_0x1ca9c0);}}; \ No newline at end of file +var _0xaf98=['./user.events','save','remove','update','emit','register','length','user:'];(function(_0x15d452,_0xf01b1d){var _0x2d226b=function(_0x47e1d4){while(--_0x47e1d4){_0x15d452['push'](_0x15d452['shift']());}};_0x2d226b(++_0xf01b1d);}(_0xaf98,0xa8));var _0x8af9=function(_0x5aa7df,_0x5d1e4c){_0x5aa7df=_0x5aa7df-0x0;var _0x2287be=_0xaf98[_0x5aa7df];return _0x2287be;};'use strict';var UserEvents=require(_0x8af9('0x0'));var events=[_0x8af9('0x1'),_0x8af9('0x2'),_0x8af9('0x3')];function createListener(_0x391d2a,_0x54c6fe){return function(_0x5656fb){_0x54c6fe[_0x8af9('0x4')](_0x391d2a,_0x5656fb);};}function removeListener(_0x2a5ba1,_0x4b91ed){return function(){UserEvents['removeListener'](_0x2a5ba1,_0x4b91ed);};}exports[_0x8af9('0x5')]=function(_0x157f9f){for(var _0x4e34d2=0x0,_0x30aaa2=events[_0x8af9('0x6')];_0x4e34d2<_0x30aaa2;_0x4e34d2++){var _0x215be5=events[_0x4e34d2];var _0x5ebf83=createListener(_0x8af9('0x7')+_0x215be5,_0x157f9f);UserEvents['on'](_0x215be5,_0x5ebf83);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 72a7e5b..182a15f 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 _0x9000=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x5c6ad7,_0x5da5c8){var _0x56c477=function(_0x4439b8){while(--_0x4439b8){_0x5c6ad7['push'](_0x5c6ad7['shift']());}};_0x56c477(++_0x5da5c8);}(_0x9000,0x19e));var _0x0900=function(_0x17cb63,_0x4c0e90){_0x17cb63=_0x17cb63-0x0;var _0x4340bc=_0x9000[_0x17cb63];return _0x4340bc;};'use strict';var multer=require(_0x0900('0x0'));var util=require(_0x0900('0x1'));var path=require('path');var timeout=require(_0x0900('0x2'));var express=require(_0x0900('0x3'));var router=express[_0x0900('0x4')]();var fs_extra=require(_0x0900('0x5'));var auth=require(_0x0900('0x6'));var interaction=require(_0x0900('0x7'));var config=require(_0x0900('0x8'));module[_0x0900('0x9')]=router; \ No newline at end of file +var _0xd983=['../../config/environment','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x425a74,_0x205822){var _0x191e87=function(_0x307bb5){while(--_0x307bb5){_0x425a74['push'](_0x425a74['shift']());}};_0x191e87(++_0x205822);}(_0xd983,0x1df));var _0x3d98=function(_0xd508cf,_0x308f24){_0xd508cf=_0xd508cf-0x0;var _0x1fd7f8=_0xd983[_0xd508cf];return _0x1fd7f8;};'use strict';var multer=require(_0x3d98('0x0'));var util=require(_0x3d98('0x1'));var path=require(_0x3d98('0x2'));var timeout=require(_0x3d98('0x3'));var express=require(_0x3d98('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3d98('0x5'));var interaction=require(_0x3d98('0x6'));var config=require(_0x3d98('0x7'));module[_0x3d98('0x8')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 6714ee5..c26ddc4 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 _0xbaf0=['exports','INTEGER'];(function(_0x5093e9,_0x5154d0){var _0x4c9a22=function(_0x15176d){while(--_0x15176d){_0x5093e9['push'](_0x5093e9['shift']());}};_0x4c9a22(++_0x5154d0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x3df1e9,_0x3cd30e){var _0xd6b371=function(_0x4b5457){while(--_0x4b5457){_0x3df1e9['push'](_0x3df1e9['shift']());}};_0xd6b371(++_0x3cd30e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index c8bd223..0651af9 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 _0xa962=['rimraf','../../config/environment','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xa962,0xea));var _0x2a96=function(_0x26a2bd,_0x26eba2){_0x26a2bd=_0x26a2bd-0x0;var _0x40410e=_0xa962[_0x26a2bd];return _0x40410e;};'use strict';var _=require(_0x2a96('0x0'));var util=require(_0x2a96('0x1'));var logger=require('../../config/logger')(_0x2a96('0x2'));var moment=require(_0x2a96('0x3'));var BPromise=require(_0x2a96('0x4'));var rp=require(_0x2a96('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a96('0x6'));var config=require(_0x2a96('0x7'));var attributes=require(_0x2a96('0x8'));module['exports']=function(_0x38445b,_0x3de653){return _0x38445b[_0x2a96('0x9')](_0x2a96('0xa'),attributes,{'tableName':_0x2a96('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9960=['exports','define','user_has_chat_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x3acee8,_0x5f3924){var _0x5046cc=function(_0x338def){while(--_0x338def){_0x3acee8['push'](_0x3acee8['shift']());}};_0x5046cc(++_0x5f3924);}(_0x9960,0x147));var _0x0996=function(_0x12bd33,_0x5c1cf8){_0x12bd33=_0x12bd33-0x0;var _0x4f294b=_0x9960[_0x12bd33];return _0x4f294b;};'use strict';var _=require(_0x0996('0x0'));var util=require(_0x0996('0x1'));var logger=require(_0x0996('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0996('0x3'));var rp=require(_0x0996('0x4'));var fs=require('fs');var path=require(_0x0996('0x5'));var rimraf=require(_0x0996('0x6'));var config=require(_0x0996('0x7'));var attributes=require(_0x0996('0x8'));module[_0x0996('0x9')]=function(_0x499b2f,_0x5718e4){return _0x499b2f[_0x0996('0xa')]('UserChatQueue',attributes,{'tableName':_0x0996('0xb'),'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 63b15e7..d86a0a0 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 _0xa1d9=['UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x59befa,_0x4af99b){var _0x1dd63d=function(_0x4c1df4){while(--_0x4c1df4){_0x59befa['push'](_0x59befa['shift']());}};_0x1dd63d(++_0x4af99b);}(_0xa1d9,0x84));var _0x9a1d=function(_0x107b74,_0x13ff6e){_0x107b74=_0x107b74-0x0;var _0x898f19=_0xa1d9[_0x107b74];return _0x898f19;};'use strict';var _=require(_0x9a1d('0x0'));var util=require(_0x9a1d('0x1'));var moment=require(_0x9a1d('0x2'));var BPromise=require(_0x9a1d('0x3'));var rs=require(_0x9a1d('0x4'));var fs=require('fs');var Redis=require(_0x9a1d('0x5'));var db=require(_0x9a1d('0x6'))['db'];var utils=require(_0x9a1d('0x7'));var logger=require('../../config/logger')(_0x9a1d('0x8'));var config=require(_0x9a1d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9a1d('0xa')][_0x9a1d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d26c8,_0xd8c2c2,_0xd4be93){return new BPromise(function(_0x8e998d,_0x58a0b1){return client[_0x9a1d('0xc')](_0x3d26c8,_0xd4be93)[_0x9a1d('0xd')](function(_0x484b60){logger[_0x9a1d('0xe')](_0x9a1d('0xf'),_0xd8c2c2,_0x9a1d('0x10'));logger[_0x9a1d('0x11')](_0x9a1d('0x12'),_0xd8c2c2,'request\x20sent',JSON[_0x9a1d('0x13')](_0x484b60));if(_0x484b60[_0x9a1d('0x14')]){if(_0x484b60[_0x9a1d('0x14')][_0x9a1d('0x15')]===0x1f4){logger[_0x9a1d('0x14')](_0x9a1d('0xf'),_0xd8c2c2,_0x484b60['error'][_0x9a1d('0x16')]);return _0x58a0b1(_0x484b60[_0x9a1d('0x14')]['message']);}logger['error'](_0x9a1d('0xf'),_0xd8c2c2,_0x484b60[_0x9a1d('0x14')][_0x9a1d('0x16')]);return _0x8e998d(_0x484b60['error'][_0x9a1d('0x16')]);}else{logger[_0x9a1d('0xe')](_0x9a1d('0xf'),_0xd8c2c2,_0x9a1d('0x10'));_0x8e998d(_0x484b60[_0x9a1d('0x17')][_0x9a1d('0x16')]);}})[_0x9a1d('0x18')](function(_0x6f835){logger['error'](_0x9a1d('0xf'),_0xd8c2c2,_0x6f835);_0x58a0b1(_0x6f835);});});} \ No newline at end of file +var _0xd265=['UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd265,0x9b));var _0x5d26=function(_0x29b96f,_0x54b5ed){_0x29b96f=_0x29b96f-0x0;var _0x9e7496=_0xd265[_0x29b96f];return _0x9e7496;};'use strict';var _=require(_0x5d26('0x0'));var util=require(_0x5d26('0x1'));var moment=require('moment');var BPromise=require(_0x5d26('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d26('0x3'));var db=require(_0x5d26('0x4'))['db'];var utils=require(_0x5d26('0x5'));var logger=require('../../config/logger')(_0x5d26('0x6'));var config=require(_0x5d26('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5d26('0x8')][_0x5d26('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20d245,_0x3bcbd0,_0x24ca7f){return new BPromise(function(_0x8577c2,_0x2e363b){return client[_0x5d26('0xa')](_0x20d245,_0x24ca7f)[_0x5d26('0xb')](function(_0x1a187b){logger[_0x5d26('0xc')](_0x5d26('0xd'),_0x3bcbd0,_0x5d26('0xe'));logger['debug'](_0x5d26('0xf'),_0x3bcbd0,'request\x20sent',JSON[_0x5d26('0x10')](_0x1a187b));if(_0x1a187b[_0x5d26('0x11')]){if(_0x1a187b[_0x5d26('0x11')]['code']===0x1f4){logger[_0x5d26('0x11')](_0x5d26('0xd'),_0x3bcbd0,_0x1a187b[_0x5d26('0x11')][_0x5d26('0x12')]);return _0x2e363b(_0x1a187b['error'][_0x5d26('0x12')]);}logger[_0x5d26('0x11')](_0x5d26('0xd'),_0x3bcbd0,_0x1a187b['error'][_0x5d26('0x12')]);return _0x8577c2(_0x1a187b[_0x5d26('0x11')][_0x5d26('0x12')]);}else{logger[_0x5d26('0xc')](_0x5d26('0xd'),_0x3bcbd0,_0x5d26('0xe'));_0x8577c2(_0x1a187b[_0x5d26('0x13')][_0x5d26('0x12')]);}})[_0x5d26('0x14')](function(_0x508267){logger[_0x5d26('0x11')](_0x5d26('0xd'),_0x3bcbd0,_0x508267);_0x2e363b(_0x508267);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 4c48b1d..c2c561b 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 _0x5987=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x5c3834,_0x2f4bcc){var _0x415f97=function(_0x1a76ed){while(--_0x1a76ed){_0x5c3834['push'](_0x5c3834['shift']());}};_0x415f97(++_0x2f4bcc);}(_0x5987,0x128));var _0x7598=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5987[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x7598('0x0'));var util=require(_0x7598('0x1'));var path=require(_0x7598('0x2'));var timeout=require(_0x7598('0x3'));var express=require('express');var router=express[_0x7598('0x4')]();var fs_extra=require(_0x7598('0x5'));var auth=require(_0x7598('0x6'));var interaction=require(_0x7598('0x7'));var config=require(_0x7598('0x8'));module[_0x7598('0x9')]=router; \ No newline at end of file +var _0x74fd=['../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x368585,_0x14a760){var _0x2fc865=function(_0x58d12c){while(--_0x58d12c){_0x368585['push'](_0x368585['shift']());}};_0x2fc865(++_0x14a760);}(_0x74fd,0x8f));var _0xd74f=function(_0x2bcb75,_0x5789a7){_0x2bcb75=_0x2bcb75-0x0;var _0x175345=_0x74fd[_0x2bcb75];return _0x175345;};'use strict';var multer=require(_0xd74f('0x0'));var util=require('util');var path=require(_0xd74f('0x1'));var timeout=require(_0xd74f('0x2'));var express=require(_0xd74f('0x3'));var router=express[_0xd74f('0x4')]();var fs_extra=require(_0xd74f('0x5'));var auth=require(_0xd74f('0x6'));var interaction=require(_0xd74f('0x7'));var config=require(_0xd74f('0x8'));module[_0xd74f('0x9')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 972f731..46b2ad6 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 _0x0598=['exports','INTEGER','sequelize'];(function(_0x25a42a,_0x3d489b){var _0x1129b1=function(_0x4ae61b){while(--_0x4ae61b){_0x25a42a['push'](_0x25a42a['shift']());}};_0x1129b1(++_0x3d489b);}(_0x0598,0x92));var _0x8059=function(_0x65e9af,_0x39b11f){_0x65e9af=_0x65e9af-0x0;var _0x470ad8=_0x0598[_0x65e9af];return _0x470ad8;};'use strict';var Sequelize=require(_0x8059('0x0'));module[_0x8059('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8059('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7916=['sequelize','INTEGER'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x7916,0x128));var _0x6791=function(_0x2be8ef,_0x329f58){_0x2be8ef=_0x2be8ef-0x0;var _0x3e6c53=_0x7916[_0x2be8ef];return _0x3e6c53;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6791('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6791('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 8bad395..efa1a1e 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 _0xdb3a=['request-promise','path','rimraf','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2e1a2,_0x81aa1c){var _0x3df6c8=function(_0x54d755){while(--_0x54d755){_0x2e1a2['push'](_0x2e1a2['shift']());}};_0x3df6c8(++_0x81aa1c);}(_0xdb3a,0x163));var _0xadb3=function(_0x42e9c2,_0xf71604){_0x42e9c2=_0x42e9c2-0x0;var _0x1e7c80=_0xdb3a[_0x42e9c2];return _0x1e7c80;};'use strict';var _=require(_0xadb3('0x0'));var util=require('util');var logger=require(_0xadb3('0x1'))(_0xadb3('0x2'));var moment=require(_0xadb3('0x3'));var BPromise=require(_0xadb3('0x4'));var rp=require(_0xadb3('0x5'));var fs=require('fs');var path=require(_0xadb3('0x6'));var rimraf=require(_0xadb3('0x7'));var config=require('../../config/environment');var attributes=require(_0xadb3('0x8'));module[_0xadb3('0x9')]=function(_0x591f3e,_0x49cef0){return _0x591f3e[_0xadb3('0xa')](_0xadb3('0xb'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2dca=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util'];(function(_0x11b0e9,_0x3af9bd){var _0x56de6a=function(_0x12bfa7){while(--_0x12bfa7){_0x11b0e9['push'](_0x11b0e9['shift']());}};_0x56de6a(++_0x3af9bd);}(_0x2dca,0xdb));var _0xa2dc=function(_0x493a51,_0x45128c){_0x493a51=_0x493a51-0x0;var _0xc85756=_0x2dca[_0x493a51];return _0xc85756;};'use strict';var _=require(_0xa2dc('0x0'));var util=require(_0xa2dc('0x1'));var logger=require(_0xa2dc('0x2'))('api');var moment=require(_0xa2dc('0x3'));var BPromise=require(_0xa2dc('0x4'));var rp=require(_0xa2dc('0x5'));var fs=require('fs');var path=require(_0xa2dc('0x6'));var rimraf=require('rimraf');var config=require(_0xa2dc('0x7'));var attributes=require(_0xa2dc('0x8'));module[_0xa2dc('0x9')]=function(_0x50c3b5,_0x37ba2a){return _0x50c3b5[_0xa2dc('0xa')](_0xa2dc('0xb'),attributes,{'tableName':_0xa2dc('0xc'),'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 cef9672..7987d37 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 _0x2dd8=['rpc','../../config/environment','client','http','request','then','info','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x58075d,_0x440cbf){var _0x467347=function(_0x3642b6){while(--_0x3642b6){_0x58075d['push'](_0x58075d['shift']());}};_0x467347(++_0x440cbf);}(_0x2dd8,0xbe));var _0x82dd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2dd8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x82dd('0x0'));var util=require(_0x82dd('0x1'));var moment=require(_0x82dd('0x2'));var BPromise=require(_0x82dd('0x3'));var rs=require(_0x82dd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82dd('0x5'))['db'];var utils=require(_0x82dd('0x6'));var logger=require(_0x82dd('0x7'))(_0x82dd('0x8'));var config=require(_0x82dd('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x82dd('0xa')][_0x82dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x344399,_0x508b1f,_0x2dd070){return new BPromise(function(_0x97ffff,_0x5db48c){return client[_0x82dd('0xc')](_0x344399,_0x2dd070)[_0x82dd('0xd')](function(_0x4418dd){logger[_0x82dd('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x508b1f,_0x82dd('0xf'));logger['debug'](_0x82dd('0x10'),_0x508b1f,'request\x20sent',JSON[_0x82dd('0x11')](_0x4418dd));if(_0x4418dd[_0x82dd('0x12')]){if(_0x4418dd[_0x82dd('0x12')][_0x82dd('0x13')]===0x1f4){logger[_0x82dd('0x12')](_0x82dd('0x14'),_0x508b1f,_0x4418dd[_0x82dd('0x12')]['message']);return _0x5db48c(_0x4418dd[_0x82dd('0x12')]['message']);}logger[_0x82dd('0x12')](_0x82dd('0x14'),_0x508b1f,_0x4418dd[_0x82dd('0x12')][_0x82dd('0x15')]);return _0x97ffff(_0x4418dd[_0x82dd('0x12')][_0x82dd('0x15')]);}else{logger[_0x82dd('0xe')](_0x82dd('0x14'),_0x508b1f,_0x82dd('0xf'));_0x97ffff(_0x4418dd['result'][_0x82dd('0x15')]);}})['catch'](function(_0x2c7d1b){logger[_0x82dd('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x508b1f,_0x2c7d1b);_0x5db48c(_0x2c7d1b);});});} \ No newline at end of file +var _0xd7f6=['ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserFaxQueue,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x2a6ba5,_0x265fcd){var _0x22b1c5=function(_0xbcbbaf){while(--_0xbcbbaf){_0x2a6ba5['push'](_0x2a6ba5['shift']());}};_0x22b1c5(++_0x265fcd);}(_0xd7f6,0x154));var _0x6d7f=function(_0x13a0c6,_0x39f6c0){_0x13a0c6=_0x13a0c6-0x0;var _0x424ed8=_0xd7f6[_0x13a0c6];return _0x424ed8;};'use strict';var _=require(_0x6d7f('0x0'));var util=require(_0x6d7f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d7f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d7f('0x3'));var logger=require(_0x6d7f('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6d7f('0x5'));var client=jayson['client'][_0x6d7f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2c3c60,_0x791713,_0x24cd09){return new BPromise(function(_0xab05bf,_0x564832){return client[_0x6d7f('0x7')](_0x2c3c60,_0x24cd09)[_0x6d7f('0x8')](function(_0x2c57c5){logger[_0x6d7f('0x9')]('UserFaxQueue,\x20%s,\x20%s',_0x791713,'request\x20sent');logger['debug'](_0x6d7f('0xa'),_0x791713,_0x6d7f('0xb'),JSON[_0x6d7f('0xc')](_0x2c57c5));if(_0x2c57c5[_0x6d7f('0xd')]){if(_0x2c57c5[_0x6d7f('0xd')]['code']===0x1f4){logger[_0x6d7f('0xd')](_0x6d7f('0xe'),_0x791713,_0x2c57c5['error'][_0x6d7f('0xf')]);return _0x564832(_0x2c57c5[_0x6d7f('0xd')]['message']);}logger[_0x6d7f('0xd')](_0x6d7f('0xe'),_0x791713,_0x2c57c5[_0x6d7f('0xd')][_0x6d7f('0xf')]);return _0xab05bf(_0x2c57c5[_0x6d7f('0xd')][_0x6d7f('0xf')]);}else{logger[_0x6d7f('0x9')](_0x6d7f('0xe'),_0x791713,'request\x20sent');_0xab05bf(_0x2c57c5[_0x6d7f('0x10')]['message']);}})[_0x6d7f('0x11')](function(_0x4439be){logger[_0x6d7f('0xd')](_0x6d7f('0xe'),_0x791713,_0x4439be);_0x564832(_0x4439be);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 7c3599f..7a35ded 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 _0x13cc=['exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x32def4,_0x205a07){var _0x143c35=function(_0x3eeb52){while(--_0x3eeb52){_0x32def4['push'](_0x32def4['shift']());}};_0x143c35(++_0x205a07);}(_0x13cc,0x161));var _0xc13c=function(_0x19b677,_0x39f86d){_0x19b677=_0x19b677-0x0;var _0x324f65=_0x13cc[_0x19b677];return _0x324f65;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc13c('0x0'));var timeout=require(_0xc13c('0x1'));var express=require('express');var router=express[_0xc13c('0x2')]();var fs_extra=require(_0xc13c('0x3'));var auth=require(_0xc13c('0x4'));var interaction=require(_0xc13c('0x5'));var config=require(_0xc13c('0x6'));module[_0xc13c('0x7')]=router; \ No newline at end of file +var _0xdb94=['fs-extra','../../components/auth/service','exports','multer','util','path','connect-timeout','express'];(function(_0x2dbce1,_0x1fb9c6){var _0x477017=function(_0x447baf){while(--_0x447baf){_0x2dbce1['push'](_0x2dbce1['shift']());}};_0x477017(++_0x1fb9c6);}(_0xdb94,0xab));var _0x4db9=function(_0x24a01c,_0x1f84fc){_0x24a01c=_0x24a01c-0x0;var _0x2920a8=_0xdb94[_0x24a01c];return _0x2920a8;};'use strict';var multer=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var path=require(_0x4db9('0x2'));var timeout=require(_0x4db9('0x3'));var express=require(_0x4db9('0x4'));var router=express['Router']();var fs_extra=require(_0x4db9('0x5'));var auth=require(_0x4db9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x4db9('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index bf4bb4f..805f244 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 _0xb10b=['sequelize','INTEGER'];(function(_0x57b939,_0x139c8c){var _0x1c4262=function(_0x2bc329){while(--_0x2bc329){_0x57b939['push'](_0x57b939['shift']());}};_0x1c4262(++_0x139c8c);}(_0xb10b,0x12a));var _0xbb10=function(_0x1f1cc7,_0x26f365){_0x1f1cc7=_0x1f1cc7-0x0;var _0x5f49e9=_0xb10b[_0x1f1cc7];return _0x5f49e9;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x23535e,_0x4de969){var _0x50f005=function(_0x161077){while(--_0x161077){_0x23535e['push'](_0x23535e['shift']());}};_0x50f005(++_0x4de969);}(_0xe706,0xa3));var _0x6e70=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xe706[_0x58afd5];return _0x3e503b;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 8723bbf..9efe991 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 _0x757a=['define','user_has_mail_queues','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x5a7521,_0x2d1d5e){var _0x3d6e6a=function(_0x1ea2b8){while(--_0x1ea2b8){_0x5a7521['push'](_0x5a7521['shift']());}};_0x3d6e6a(++_0x2d1d5e);}(_0x757a,0xde));var _0xa757=function(_0x473a42,_0x3331a5){_0x473a42=_0x473a42-0x0;var _0x42ca57=_0x757a[_0x473a42];return _0x42ca57;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('UserMailQueue',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','../../config/logger'];(function(_0x4c3ece,_0x57053e){var _0x409c1d=function(_0x411a3b){while(--_0x411a3b){_0x4c3ece['push'](_0x4c3ece['shift']());}};_0x409c1d(++_0x57053e);}(_0xb10b,0x12a));var _0xbb10=function(_0x1de4b8,_0x529b41){_0x1de4b8=_0x1de4b8-0x0;var _0x557699=_0xb10b[_0x1de4b8];return _0x557699;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserMailQueue',attributes,{'tableName':_0xbb10('0xb'),'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 4e04851..5589d5e 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 _0x01db=['UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x557f85,_0xb69179){var _0x5ce426=function(_0xa85e9d){while(--_0xa85e9d){_0x557f85['push'](_0x557f85['shift']());}};_0x5ce426(++_0xb69179);}(_0x01db,0x171));var _0xb01d=function(_0x2db7ab,_0x4fa371){_0x2db7ab=_0x2db7ab-0x0;var _0x486c71=_0x01db[_0x2db7ab];return _0x486c71;};'use strict';var _=require(_0xb01d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb01d('0x1'));var rs=require(_0xb01d('0x2'));var fs=require('fs');var Redis=require(_0xb01d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb01d('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb01d('0x5'));var jayson=require(_0xb01d('0x6'));var client=jayson[_0xb01d('0x7')][_0xb01d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2622e9,_0x37720d,_0x3c45a3){return new BPromise(function(_0x4429dd,_0x518609){return client['request'](_0x2622e9,_0x3c45a3)[_0xb01d('0x9')](function(_0x28f028){logger[_0xb01d('0xa')](_0xb01d('0xb'),_0x37720d,_0xb01d('0xc'));logger[_0xb01d('0xd')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x37720d,'request\x20sent',JSON[_0xb01d('0xe')](_0x28f028));if(_0x28f028[_0xb01d('0xf')]){if(_0x28f028[_0xb01d('0xf')][_0xb01d('0x10')]===0x1f4){logger[_0xb01d('0xf')](_0xb01d('0xb'),_0x37720d,_0x28f028[_0xb01d('0xf')]['message']);return _0x518609(_0x28f028['error'][_0xb01d('0x11')]);}logger['error'](_0xb01d('0xb'),_0x37720d,_0x28f028[_0xb01d('0xf')]['message']);return _0x4429dd(_0x28f028[_0xb01d('0xf')][_0xb01d('0x11')]);}else{logger[_0xb01d('0xa')](_0xb01d('0xb'),_0x37720d,'request\x20sent');_0x4429dd(_0x28f028[_0xb01d('0x12')]['message']);}})[_0xb01d('0x13')](function(_0x9a96e){logger[_0xb01d('0xf')](_0xb01d('0xb'),_0x37720d,_0x9a96e);_0x518609(_0x9a96e);});});} \ No newline at end of file +var _0xee87=['message','result','catch','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xee87,0x193));var _0x7ee8=function(_0x437fc4,_0x46ac1e){_0x437fc4=_0x437fc4-0x0;var _0x5ef891=_0xee87[_0x437fc4];return _0x5ef891;};'use strict';var _=require('lodash');var util=require(_0x7ee8('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ee8('0x1'));var db=require(_0x7ee8('0x2'))['db'];var utils=require(_0x7ee8('0x3'));var logger=require('../../config/logger')(_0x7ee8('0x4'));var config=require(_0x7ee8('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x7ee8('0x6')][_0x7ee8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2fe0fb,_0x3ac05f,_0x43df79){return new BPromise(function(_0x346771,_0x2d26bd){return client[_0x7ee8('0x8')](_0x2fe0fb,_0x43df79)[_0x7ee8('0x9')](function(_0x4d193a){logger[_0x7ee8('0xa')](_0x7ee8('0xb'),_0x3ac05f,_0x7ee8('0xc'));logger['debug'](_0x7ee8('0xd'),_0x3ac05f,_0x7ee8('0xc'),JSON[_0x7ee8('0xe')](_0x4d193a));if(_0x4d193a[_0x7ee8('0xf')]){if(_0x4d193a['error'][_0x7ee8('0x10')]===0x1f4){logger[_0x7ee8('0xf')](_0x7ee8('0xb'),_0x3ac05f,_0x4d193a[_0x7ee8('0xf')][_0x7ee8('0x11')]);return _0x2d26bd(_0x4d193a[_0x7ee8('0xf')][_0x7ee8('0x11')]);}logger[_0x7ee8('0xf')](_0x7ee8('0xb'),_0x3ac05f,_0x4d193a[_0x7ee8('0xf')][_0x7ee8('0x11')]);return _0x346771(_0x4d193a[_0x7ee8('0xf')][_0x7ee8('0x11')]);}else{logger[_0x7ee8('0xa')](_0x7ee8('0xb'),_0x3ac05f,_0x7ee8('0xc'));_0x346771(_0x4d193a[_0x7ee8('0x12')][_0x7ee8('0x11')]);}})[_0x7ee8('0x13')](function(_0x3b2c7e){logger['error'](_0x7ee8('0xb'),_0x3ac05f,_0x3b2c7e);_0x2d26bd(_0x3b2c7e);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index bb6a69c..b450fd4 100644 --- a/server/api/userNotification/index.js +++ b/server/api/userNotification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf874=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','exports','multer'];(function(_0x17a64a,_0x37cdc4){var _0x198bb5=function(_0x322c45){while(--_0x322c45){_0x17a64a['push'](_0x17a64a['shift']());}};_0x198bb5(++_0x37cdc4);}(_0xf874,0x1ac));var _0x4f87=function(_0x301831,_0x19ef62){_0x301831=_0x301831-0x0;var _0x318c37=_0xf874[_0x301831];return _0x318c37;};'use strict';var multer=require(_0x4f87('0x0'));var util=require(_0x4f87('0x1'));var path=require(_0x4f87('0x2'));var timeout=require(_0x4f87('0x3'));var express=require(_0x4f87('0x4'));var router=express[_0x4f87('0x5')]();var fs_extra=require(_0x4f87('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4f87('0x7'));var config=require(_0x4f87('0x8'));var controller=require(_0x4f87('0x9'));router[_0x4f87('0xa')]('/',auth[_0x4f87('0xb')](),controller['sendUserNotification']);module[_0x4f87('0xc')]=router; \ No newline at end of file +var _0x9350=['../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2782c1,_0xcd0398){var _0x43c822=function(_0x23e452){while(--_0x23e452){_0x2782c1['push'](_0x2782c1['shift']());}};_0x43c822(++_0xcd0398);}(_0x9350,0x199));var _0x0935=function(_0x1e48d3,_0x5d8c43){_0x1e48d3=_0x1e48d3-0x0;var _0x2852b1=_0x9350[_0x1e48d3];return _0x2852b1;};'use strict';var multer=require('multer');var util=require(_0x0935('0x0'));var path=require('path');var timeout=require(_0x0935('0x1'));var express=require(_0x0935('0x2'));var router=express[_0x0935('0x3')]();var fs_extra=require(_0x0935('0x4'));var auth=require(_0x0935('0x5'));var interaction=require(_0x0935('0x6'));var config=require(_0x0935('0x7'));var controller=require(_0x0935('0x8'));router[_0x0935('0x9')]('/',auth[_0x0935('0xa')](),controller[_0x0935('0xb')]);module[_0x0935('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index fc6579c..cca9b52 100644 --- a/server/api/userNotification/userNotification.attributes.js +++ b/server/api/userNotification/userNotification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x833a=['BOOLEAN','sequelize','TEXT','STRING'];(function(_0x4f83ca,_0x46f67a){var _0x1fbac3=function(_0x19e401){while(--_0x19e401){_0x4f83ca['push'](_0x4f83ca['shift']());}};_0x1fbac3(++_0x46f67a);}(_0x833a,0x145));var _0xa833=function(_0x4b9c8b,_0x43a786){_0x4b9c8b=_0x4b9c8b-0x0;var _0x548bea=_0x833a[_0x4b9c8b];return _0x548bea;};'use strict';var Sequelize=require(_0xa833('0x0'));module['exports']={'body':{'type':Sequelize[_0xa833('0x1')]},'senderName':{'type':Sequelize[_0xa833('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xa833('0x2')]},'beep':{'type':Sequelize[_0xa833('0x3')]}}; \ No newline at end of file +var _0xcdd2=['TEXT','STRING','BOOLEAN','exports'];(function(_0xda8188,_0x1729aa){var _0x14815c=function(_0x296496){while(--_0x296496){_0xda8188['push'](_0xda8188['shift']());}};_0x14815c(++_0x1729aa);}(_0xcdd2,0xef));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x2cdd('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x2cdd('0x1')]},'recipientsDescription':{'type':Sequelize[_0x2cdd('0x2')]},'beep':{'type':Sequelize[_0x2cdd('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 5c59842..5b27a7d 100644 --- a/server/api/userNotification/userNotification.controller.js +++ b/server/api/userNotification/userNotification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f05=['recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','toLowerCase','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','join','transaction','UserNotification','create','recipient','Template','html','render','forEach','startCase','model','User','union','ids','includes','queue','replace','Queue','push','map','catch','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','limit','undefined','Content-Range','json','reject','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view'];(function(_0x51ee66,_0x599700){var _0x5d1c6e=function(_0x3c6121){while(--_0x3c6121){_0x51ee66['push'](_0x51ee66['shift']());}};_0x5d1c6e(++_0x599700);}(_0x7f05,0xdc));var _0x57f0=function(_0x4a4cf5,_0x2d7051){_0x4a4cf5=_0x4a4cf5-0x0;var _0x364650=_0x7f05[_0x4a4cf5];return _0x364650;};'use strict';var emlformat=require(_0x57f0('0x0'));var rimraf=require(_0x57f0('0x1'));var zipdir=require(_0x57f0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57f0('0x3'));var moment=require('moment');var BPromise=require(_0x57f0('0x4'));var Mustache=require(_0x57f0('0x5'));var util=require('util');var path=require(_0x57f0('0x6'));var sox=require(_0x57f0('0x7'));var csv=require('to-csv');var ejs=require(_0x57f0('0x8'));var fs=require('fs');var fs_extra=require(_0x57f0('0x9'));var _=require('lodash');var squel=require(_0x57f0('0xa'));var crypto=require(_0x57f0('0xb'));var jsforce=require(_0x57f0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x57f0('0xd'));var Papa=require('papaparse');var Redis=require(_0x57f0('0xe'));var authService=require(_0x57f0('0xf'));var qs=require(_0x57f0('0x10'));var as=require(_0x57f0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x57f0('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x57f0('0x13')],{'host':_0x57f0('0x14'),'port':0x18eb});var socket=require(_0x57f0('0x15'))(new Redis(config[_0x57f0('0x13')]));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0x471f97,_0x380859){_0x380859=_0x380859||0xcc;return function(_0x22bb0d){if(_0x22bb0d){return _0x471f97[_0x57f0('0x16')](_0x380859);}return _0x471f97[_0x57f0('0x17')](_0x380859)[_0x57f0('0x18')]();};}function respondWithResult(_0x555e18,_0x51dac4){_0x51dac4=_0x51dac4||0xc8;return function(_0x40a925){if(_0x40a925){return _0x555e18['status'](_0x51dac4)['json'](_0x40a925);}};}function respondWithFilteredResult(_0x48eadd,_0x593fd7){return function(_0x20d0ba){if(_0x20d0ba){var _0x2a382e=typeof _0x593fd7[_0x57f0('0x19')]==='undefined'&&typeof _0x593fd7[_0x57f0('0x1a')]===_0x57f0('0x1b');var _0x3d0cf6=_0x20d0ba['count'];var _0x2e3d15=_0x2a382e?0x0:_0x593fd7[_0x57f0('0x19')];var _0x5ab625=_0x2a382e?_0x20d0ba['count']:_0x593fd7[_0x57f0('0x19')]+_0x593fd7[_0x57f0('0x1a')];var _0x599aa2;if(_0x5ab625>=_0x3d0cf6){_0x5ab625=_0x3d0cf6;_0x599aa2=0xc8;}else{_0x599aa2=0xce;}_0x48eadd[_0x57f0('0x17')](_0x599aa2);return _0x48eadd['set'](_0x57f0('0x1c'),_0x2e3d15+'-'+_0x5ab625+'/'+_0x3d0cf6)[_0x57f0('0x1d')](_0x20d0ba);}return null;};}function patchUpdates(_0x426a09){return function(_0x202dcb){try{jsonpatch['apply'](_0x202dcb,_0x426a09,!![]);}catch(_0x5d16a6){return BPromise[_0x57f0('0x1e')](_0x5d16a6);}return _0x202dcb['save']();};}function saveUpdates(_0x1279ae,_0x3a01ea){return function(_0x4156c4){if(_0x4156c4){return _0x4156c4[_0x57f0('0x1f')](_0x1279ae)[_0x57f0('0x20')](function(_0x1c2cae){return _0x1c2cae;});}return null;};}function removeEntity(_0x4de0f5,_0x941a03){return function(_0x5a079e){if(_0x5a079e){return _0x5a079e[_0x57f0('0x21')]()['then'](function(){_0x4de0f5['status'](0xcc)[_0x57f0('0x18')]();});}};}function handleEntityNotFound(_0x58a529,_0x407829){return function(_0x50347e){if(!_0x50347e){_0x58a529['sendStatus'](0x194);}return _0x50347e;};}function handleError(_0x23564f,_0x1fd10){_0x1fd10=_0x1fd10||0x1f4;return function(_0x16c711){logger[_0x57f0('0x22')](_0x16c711[_0x57f0('0x23')]);if(_0x16c711[_0x57f0('0x24')]){delete _0x16c711[_0x57f0('0x24')];}_0x23564f[_0x57f0('0x17')](_0x1fd10)[_0x57f0('0x25')](_0x16c711);};}exports[_0x57f0('0x26')]=function(_0x5c7095,_0x2c61af,_0x390400){if(!_0x5c7095[_0x57f0('0x27')][_0x57f0('0x28')](_0x57f0('0x29'))&&!_0x5c7095[_0x57f0('0x27')][_0x57f0('0x28')](_0x57f0('0x2a'))){throw new db[(_0x57f0('0x2b'))][(_0x57f0('0x2c'))](_0x57f0('0x2d'));}else{if(_0x5c7095[_0x57f0('0x27')][_0x57f0('0x28')](_0x57f0('0x2a'))&&!_0x5c7095['body'][_0x57f0('0x28')](_0x57f0('0x2e'))){throw new db[(_0x57f0('0x2b'))][(_0x57f0('0x2c'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x5c7095['body']['hasOwnProperty'](_0x57f0('0x2f'))){throw new db['Sequelize'][(_0x57f0('0x2c'))](_0x57f0('0x30'));}else{try{var _0x2f3f1b=JSON['parse'](_0x5c7095[_0x57f0('0x27')][_0x57f0('0x2f')]);}catch(_0x266fe2){logger[_0x57f0('0x22')](_0x266fe2);throw new db[(_0x57f0('0x2b'))][(_0x57f0('0x2c'))](_0x57f0('0x31'));}var _0x7fc021=[_0x57f0('0x32'),_0x57f0('0x33'),_0x57f0('0x34'),_0x57f0('0x35'),_0x57f0('0x36'),_0x57f0('0x37'),_0x57f0('0x38'),_0x57f0('0x39'),_0x57f0('0x3a')];if(_[_0x57f0('0x3b')](_0x2f3f1b,function(_0x3330ab){return!_['includes'](_0x7fc021,_0x3330ab['model'][_0x57f0('0x3c')]());})){throw new db[(_0x57f0('0x2b'))][(_0x57f0('0x2c'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x23d181={};_0x23d181[_0x57f0('0x3d')]=_0x5c7095[_0x57f0('0x27')][_0x57f0('0x28')](_0x57f0('0x3d'))?_0x5c7095[_0x57f0('0x27')][_0x57f0('0x3d')]:_0x5c7095[_0x57f0('0x3a')][_0x57f0('0x3e')];_0x23d181['recipientsDescription']=_[_0x57f0('0x3f')](_0x5c7095[_0x57f0('0x27')][_0x57f0('0x40')])?null:_0x5c7095[_0x57f0('0x27')]['recipientsDescription'];_0x23d181[_0x57f0('0x41')]=_0x5c7095[_0x57f0('0x27')]['beep']||![];_0x23d181[_0x57f0('0x42')]=_0x5c7095[_0x57f0('0x3a')]['id'];return getContent(_0x5c7095[_0x57f0('0x27')])[_0x57f0('0x20')](function(_0x4225a1){_0x23d181[_0x57f0('0x27')]=_0x4225a1;return getRecipients(_0x2f3f1b);})[_0x57f0('0x20')](function(_0x4f3271){_0x23d181[_0x57f0('0x43')]=_['sortBy'](_0x4f3271)[_0x57f0('0x44')](',');return db['sequelize'][_0x57f0('0x45')](function(_0x379c4f){return db[_0x57f0('0x46')][_0x57f0('0x47')](_0x23d181,{'raw':!![],'transaction':_0x379c4f})[_0x57f0('0x20')](function(_0x294649){var _0x33d5e5={'sender':_0x23d181[_0x57f0('0x3d')],'description':_0x23d181[_0x57f0('0x40')],'content':_0x23d181[_0x57f0('0x27')],'beep':_0x23d181[_0x57f0('0x41')]};_0x4f3271['forEach'](function(_0x16cb8d){_0x33d5e5[_0x57f0('0x48')]=_0x16cb8d;socket['emit']('userNotification:send',_0x33d5e5);});return _0x294649;});});})[_0x57f0('0x20')](respondWithResult(_0x2c61af,0xc9))['catch'](handleError(_0x2c61af,null));};function getContent(_0x2ca275){return new BPromise(function(_0x12ef42,_0x18c946){if(_0x2ca275['text']){_0x12ef42(_0x2ca275[_0x57f0('0x29')]);return;}return db[_0x57f0('0x49')]['findOne']({'attributes':[_0x57f0('0x4a')],'where':{'id':_0x2ca275[_0x57f0('0x2a')]},'raw':!![]})[_0x57f0('0x20')](function(_0x350556){if(!_0x350556)throw new db[(_0x57f0('0x2b'))][(_0x57f0('0x2c'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x262199=Mustache[_0x57f0('0x4b')](_0x350556['html'],_0x2ca275[_0x57f0('0x2e')]);_0x12ef42(_0x262199);})['catch'](function(_0x33b90f){_0x18c946(_0x33b90f);});});}function getRecipients(_0x5a9157){return new BPromise(function(_0x242189,_0x5d9e48){var _0x4c6eb1=[];var _0x22abb2=[];_0x5a9157[_0x57f0('0x4c')](function(_0x39849d){var _0x4bff12=_[_0x57f0('0x4d')](_0x39849d[_0x57f0('0x4e')][_0x57f0('0x3c')]());if(_0x4bff12===_0x57f0('0x4f')){_0x4c6eb1=_[_0x57f0('0x50')](_0x4c6eb1,_0x39849d[_0x57f0('0x51')]);}else{if(_[_0x57f0('0x52')](_0x4bff12,_0x57f0('0x53')))_0x4bff12=_0x4bff12[_0x57f0('0x54')]('queue',_0x57f0('0x55'));_0x39849d[_0x57f0('0x51')]['forEach'](function(_0x3c60de){_0x22abb2[_0x57f0('0x56')](getAgents(_0x4bff12,_0x3c60de));});}});return BPromise['all'](_0x22abb2)['then'](function(_0x440fd8){_0x4c6eb1=_[_0x57f0('0x50')](_0x4c6eb1,_['flatten'](_0x440fd8));_0x242189(_0x4c6eb1);})['catch'](function(_0x507d28){_0x5d9e48(_0x507d28);});});}function getAgents(_0xadd3a3,_0x98c789){return new BPromise(function(_0x570739,_0x2dbc89){return db[_0xadd3a3]['findOne']({'where':{'id':_0x98c789}})[_0x57f0('0x20')](function(_0x1b6c4b){return _0x1b6c4b['getAgents']({'attributes':['id'],'raw':!![]})[_0x57f0('0x20')](function(_0x3a9720){var _0x48f7b3=_[_0x57f0('0x57')](_0x3a9720,'id');_0x570739(_0x48f7b3);});})[_0x57f0('0x58')](function(_0x4e67a2){_0x2dbc89(_0x4e67a2);});});} \ No newline at end of file +var _0xa7f4=['./userNotification.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','name','send','sendUserNotification','body','hasOwnProperty','text','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','faxqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','startCase','User','union','queue','replace','Queue','push','all','map','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter'];(function(_0x6caa3e,_0x14cafc){var _0x58176d=function(_0xd61861){while(--_0xd61861){_0x6caa3e['push'](_0x6caa3e['shift']());}};_0x58176d(++_0x14cafc);}(_0xa7f4,0xa7));var _0x4a7f=function(_0x562817,_0x399b2e){_0x562817=_0x562817-0x0;var _0x2fa3e8=_0xa7f4[_0x562817];return _0x2fa3e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a7f('0x0'));var zipdir=require(_0x4a7f('0x1'));var jsonpatch=require(_0x4a7f('0x2'));var rp=require(_0x4a7f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4a7f('0x4'));var util=require(_0x4a7f('0x5'));var path=require(_0x4a7f('0x6'));var sox=require(_0x4a7f('0x7'));var csv=require(_0x4a7f('0x8'));var ejs=require(_0x4a7f('0x9'));var fs=require('fs');var fs_extra=require(_0x4a7f('0xa'));var _=require(_0x4a7f('0xb'));var squel=require(_0x4a7f('0xc'));var crypto=require(_0x4a7f('0xd'));var jsforce=require(_0x4a7f('0xe'));var deskjs=require(_0x4a7f('0xf'));var toCsv=require(_0x4a7f('0x8'));var querystring=require(_0x4a7f('0x10'));var Papa=require(_0x4a7f('0x11'));var Redis=require(_0x4a7f('0x12'));var authService=require(_0x4a7f('0x13'));var qs=require(_0x4a7f('0x14'));var as=require(_0x4a7f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a7f('0x16'))(_0x4a7f('0x17'));var utils=require(_0x4a7f('0x18'));var config=require(_0x4a7f('0x19'));var licenseUtil=require(_0x4a7f('0x1a'));var db=require(_0x4a7f('0x1b'))['db'];config[_0x4a7f('0x1c')]=_['defaults'](config[_0x4a7f('0x1c')],{'host':_0x4a7f('0x1d'),'port':0x18eb});var socket=require(_0x4a7f('0x1e'))(new Redis(config[_0x4a7f('0x1c')]));require(_0x4a7f('0x1f'))['register'](socket);function respondWithStatusCode(_0x13d210,_0x4fdc84){_0x4fdc84=_0x4fdc84||0xcc;return function(_0x48d086){if(_0x48d086){return _0x13d210[_0x4a7f('0x20')](_0x4fdc84);}return _0x13d210[_0x4a7f('0x21')](_0x4fdc84)[_0x4a7f('0x22')]();};}function respondWithResult(_0x21022f,_0x5f2054){_0x5f2054=_0x5f2054||0xc8;return function(_0x19404a){if(_0x19404a){return _0x21022f[_0x4a7f('0x21')](_0x5f2054)[_0x4a7f('0x23')](_0x19404a);}};}function respondWithFilteredResult(_0x330c04,_0x512298){return function(_0x215c2f){if(_0x215c2f){var _0x186cfb=typeof _0x512298[_0x4a7f('0x24')]===_0x4a7f('0x25')&&typeof _0x512298[_0x4a7f('0x26')]===_0x4a7f('0x25');var _0x228a1f=_0x215c2f[_0x4a7f('0x27')];var _0x432cf4=_0x186cfb?0x0:_0x512298['offset'];var _0x49d9e7=_0x186cfb?_0x215c2f[_0x4a7f('0x27')]:_0x512298[_0x4a7f('0x24')]+_0x512298['limit'];var _0x3175a7;if(_0x49d9e7>=_0x228a1f){_0x49d9e7=_0x228a1f;_0x3175a7=0xc8;}else{_0x3175a7=0xce;}_0x330c04['status'](_0x3175a7);return _0x330c04['set'](_0x4a7f('0x28'),_0x432cf4+'-'+_0x49d9e7+'/'+_0x228a1f)['json'](_0x215c2f);}return null;};}function patchUpdates(_0x1031b4){return function(_0x4f3a7c){try{jsonpatch['apply'](_0x4f3a7c,_0x1031b4,!![]);}catch(_0x462e70){return BPromise['reject'](_0x462e70);}return _0x4f3a7c['save']();};}function saveUpdates(_0x22cf47,_0x45ecf1){return function(_0x48f59d){if(_0x48f59d){return _0x48f59d[_0x4a7f('0x29')](_0x22cf47)[_0x4a7f('0x2a')](function(_0x533ddf){return _0x533ddf;});}return null;};}function removeEntity(_0x5daa69,_0x1f5f49){return function(_0x153042){if(_0x153042){return _0x153042[_0x4a7f('0x2b')]()[_0x4a7f('0x2a')](function(){_0x5daa69[_0x4a7f('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b4944,_0x8dcfbd){return function(_0xcc037e){if(!_0xcc037e){_0x2b4944['sendStatus'](0x194);}return _0xcc037e;};}function handleError(_0xc5af92,_0x2ed9ea){_0x2ed9ea=_0x2ed9ea||0x1f4;return function(_0x458c6b){logger[_0x4a7f('0x2c')](_0x458c6b['stack']);if(_0x458c6b['name']){delete _0x458c6b[_0x4a7f('0x2d')];}_0xc5af92['status'](_0x2ed9ea)[_0x4a7f('0x2e')](_0x458c6b);};}exports[_0x4a7f('0x2f')]=function(_0x29e563,_0x411c28,_0x3fc859){if(!_0x29e563[_0x4a7f('0x30')][_0x4a7f('0x31')](_0x4a7f('0x32'))&&!_0x29e563[_0x4a7f('0x30')][_0x4a7f('0x31')]('TemplateId')){throw new db['Sequelize']['ValidationError'](_0x4a7f('0x33'));}else{if(_0x29e563[_0x4a7f('0x30')][_0x4a7f('0x31')](_0x4a7f('0x34'))&&!_0x29e563['body'][_0x4a7f('0x31')](_0x4a7f('0x35'))){throw new db[(_0x4a7f('0x36'))][(_0x4a7f('0x37'))](_0x4a7f('0x38'));}if(!_0x29e563[_0x4a7f('0x30')][_0x4a7f('0x31')]('recipients')){throw new db['Sequelize'][(_0x4a7f('0x37'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x11e604=JSON[_0x4a7f('0x39')](_0x29e563[_0x4a7f('0x30')][_0x4a7f('0x3a')]);}catch(_0x5a15e6){logger[_0x4a7f('0x2c')](_0x5a15e6);throw new db[(_0x4a7f('0x36'))]['ValidationError'](_0x4a7f('0x3b'));}var _0x2b3c4a=['chatqueue',_0x4a7f('0x3c'),'mailqueue','openchannelqueue',_0x4a7f('0x3d'),_0x4a7f('0x3e'),_0x4a7f('0x3f'),_0x4a7f('0x40'),'user'];if(_[_0x4a7f('0x41')](_0x11e604,function(_0x302378){return!_[_0x4a7f('0x42')](_0x2b3c4a,_0x302378['model'][_0x4a7f('0x43')]());})){throw new db[(_0x4a7f('0x36'))]['ValidationError'](_0x4a7f('0x44'));}}}var _0x160720={};_0x160720[_0x4a7f('0x45')]=_0x29e563[_0x4a7f('0x30')][_0x4a7f('0x31')](_0x4a7f('0x45'))?_0x29e563['body'][_0x4a7f('0x45')]:_0x29e563['user'][_0x4a7f('0x46')];_0x160720[_0x4a7f('0x47')]=_[_0x4a7f('0x48')](_0x29e563[_0x4a7f('0x30')]['recipientsDescription'])?null:_0x29e563[_0x4a7f('0x30')][_0x4a7f('0x47')];_0x160720[_0x4a7f('0x49')]=_0x29e563['body'][_0x4a7f('0x49')]||![];_0x160720['SenderId']=_0x29e563['user']['id'];return getContent(_0x29e563[_0x4a7f('0x30')])[_0x4a7f('0x2a')](function(_0x4c901a){_0x160720[_0x4a7f('0x30')]=_0x4c901a;return getRecipients(_0x11e604);})['then'](function(_0x18353e){_0x160720[_0x4a7f('0x4a')]=_[_0x4a7f('0x4b')](_0x18353e)[_0x4a7f('0x4c')](',');return db[_0x4a7f('0x4d')][_0x4a7f('0x4e')](function(_0x1da2b5){return db[_0x4a7f('0x4f')][_0x4a7f('0x50')](_0x160720,{'raw':!![],'transaction':_0x1da2b5})[_0x4a7f('0x2a')](function(_0x361b64){var _0x4ea521={'sender':_0x160720[_0x4a7f('0x45')],'description':_0x160720['recipientsDescription'],'content':_0x160720['body'],'beep':_0x160720[_0x4a7f('0x49')]};_0x18353e['forEach'](function(_0x392636){_0x4ea521['recipient']=_0x392636;socket[_0x4a7f('0x51')](_0x4a7f('0x52'),_0x4ea521);});return _0x361b64;});});})[_0x4a7f('0x2a')](respondWithResult(_0x411c28,0xc9))[_0x4a7f('0x53')](handleError(_0x411c28,null));};function getContent(_0x22bd53){return new BPromise(function(_0x21285d,_0x3ec446){if(_0x22bd53['text']){_0x21285d(_0x22bd53[_0x4a7f('0x32')]);return;}return db[_0x4a7f('0x54')][_0x4a7f('0x55')]({'attributes':[_0x4a7f('0x56')],'where':{'id':_0x22bd53[_0x4a7f('0x34')]},'raw':!![]})[_0x4a7f('0x2a')](function(_0xab1bd){if(!_0xab1bd)throw new db[(_0x4a7f('0x36'))]['ValidationError'](_0x4a7f('0x57'));var _0x124419=Mustache[_0x4a7f('0x58')](_0xab1bd[_0x4a7f('0x56')],_0x22bd53[_0x4a7f('0x35')]);_0x21285d(_0x124419);})['catch'](function(_0x3fb22c){_0x3ec446(_0x3fb22c);});});}function getRecipients(_0x526150){return new BPromise(function(_0x754899,_0x3c5aac){var _0x2317d1=[];var _0x22893e=[];_0x526150[_0x4a7f('0x59')](function(_0x545262){var _0x12d5bf=_[_0x4a7f('0x5a')](_0x545262['model'][_0x4a7f('0x43')]());if(_0x12d5bf===_0x4a7f('0x5b')){_0x2317d1=_[_0x4a7f('0x5c')](_0x2317d1,_0x545262['ids']);}else{if(_[_0x4a7f('0x42')](_0x12d5bf,_0x4a7f('0x5d')))_0x12d5bf=_0x12d5bf[_0x4a7f('0x5e')]('queue',_0x4a7f('0x5f'));_0x545262['ids'][_0x4a7f('0x59')](function(_0x4fe353){_0x22893e[_0x4a7f('0x60')](getAgents(_0x12d5bf,_0x4fe353));});}});return BPromise[_0x4a7f('0x61')](_0x22893e)[_0x4a7f('0x2a')](function(_0x2a591f){_0x2317d1=_[_0x4a7f('0x5c')](_0x2317d1,_['flatten'](_0x2a591f));_0x754899(_0x2317d1);})[_0x4a7f('0x53')](function(_0x4f34e8){_0x3c5aac(_0x4f34e8);});});}function getAgents(_0xd97e9f,_0x4542d1){return new BPromise(function(_0x409c2c,_0x3f69f4){return db[_0xd97e9f][_0x4a7f('0x55')]({'where':{'id':_0x4542d1}})[_0x4a7f('0x2a')](function(_0xd9a6a6){return _0xd9a6a6['getAgents']({'attributes':['id'],'raw':!![]})[_0x4a7f('0x2a')](function(_0x1bf8fa){var _0x49e2b0=_[_0x4a7f('0x62')](_0x1bf8fa,'id');_0x409c2c(_0x49e2b0);});})[_0x4a7f('0x53')](function(_0x3e3961){_0x3f69f4(_0x3e3961);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 75d5073..1007cd4 100644 --- a/server/api/userNotification/userNotification.events.js +++ b/server/api/userNotification/userNotification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c6d=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','remove'];(function(_0x3a6f6b,_0x158c56){var _0xb29b92=function(_0x39ec45){while(--_0x39ec45){_0x3a6f6b['push'](_0x3a6f6b['shift']());}};_0xb29b92(++_0x158c56);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x2538ca,_0xb651c1){_0x2538ca=_0x2538ca-0x0;var _0x5b4cee=_0x4c6d[_0x2538ca];return _0x5b4cee;};'use strict';var EventEmitter=require(_0xd4c6('0x0'));var UserNotification=require(_0xd4c6('0x1'))['db'][_0xd4c6('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xd4c6('0x3')](0x0);var events={'afterCreate':_0xd4c6('0x4'),'afterUpdate':'update','afterDestroy':_0xd4c6('0x5')};function emitEvent(_0x60355c){return function(_0x306766,_0x4b2d75,_0x1b5bd1){UserNotificationEvents[_0xd4c6('0x6')](_0x60355c+':'+_0x306766['id'],_0x306766);UserNotificationEvents['emit'](_0x60355c,_0x306766);_0x1b5bd1(null);};}for(var e in events){if(events[_0xd4c6('0x7')](e)){var event=events[e];UserNotification[_0xd4c6('0x8')](e,emitEvent(event));}}module[_0xd4c6('0x9')]=UserNotificationEvents; \ No newline at end of file +var _0x3937=['UserNotification','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x2112fd,_0x2d6ea5){var _0x47ed92=function(_0x1fc0bf){while(--_0x1fc0bf){_0x2112fd['push'](_0x2112fd['shift']());}};_0x47ed92(++_0x2d6ea5);}(_0x3937,0xbf));var _0x7393=function(_0x290a5c,_0x32b3d0){_0x290a5c=_0x290a5c-0x0;var _0x1e0bf6=_0x3937[_0x290a5c];return _0x1e0bf6;};'use strict';var EventEmitter=require(_0x7393('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x7393('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x7393('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7393('0x3'),'afterDestroy':'remove'};function emitEvent(_0x224468){return function(_0x4c9c71,_0x992b15,_0x2790e6){UserNotificationEvents[_0x7393('0x4')](_0x224468+':'+_0x4c9c71['id'],_0x4c9c71);UserNotificationEvents[_0x7393('0x4')](_0x224468,_0x4c9c71);_0x2790e6(null);};}for(var e in events){if(events[_0x7393('0x5')](e)){var event=events[e];UserNotification[_0x7393('0x6')](e,emitEvent(event));}}module[_0x7393('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 759b4a2..d1b6b2d 100644 --- a/server/api/userNotification/userNotification.model.js +++ b/server/api/userNotification/userNotification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe6d7=['moment','bluebird','request-promise','rimraf','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','util','api'];(function(_0x5c50c5,_0x3b83c2){var _0x3e305e=function(_0x20cb96){while(--_0x20cb96){_0x5c50c5['push'](_0x5c50c5['shift']());}};_0x3e305e(++_0x3b83c2);}(_0xe6d7,0x1ae));var _0x7e6d=function(_0x5e9383,_0x268888){_0x5e9383=_0x5e9383-0x0;var _0x4e830a=_0xe6d7[_0x5e9383];return _0x4e830a;};'use strict';var _=require('lodash');var util=require(_0x7e6d('0x0'));var logger=require('../../config/logger')(_0x7e6d('0x1'));var moment=require(_0x7e6d('0x2'));var BPromise=require(_0x7e6d('0x3'));var rp=require(_0x7e6d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e6d('0x5'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module[_0x7e6d('0x6')]=function(_0x23c09e,_0x4faafe){return _0x23c09e[_0x7e6d('0x7')](_0x7e6d('0x8'),attributes,{'tableName':_0x7e6d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7e6d('0xa'),'collate':_0x7e6d('0xb')});}; \ No newline at end of file +var _0x58d6=['./userNotification.attributes','define','UserNotification','userNotifications','utf8mb4_unicode_ci','util','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0xb6ed9e,_0x50b747){var _0xd2b30f=function(_0x3bd02b){while(--_0x3bd02b){_0xb6ed9e['push'](_0xb6ed9e['shift']());}};_0xd2b30f(++_0x50b747);}(_0x58d6,0x1d3));var _0x658d=function(_0x22dd2b,_0x3b116a){_0x22dd2b=_0x22dd2b-0x0;var _0x2c816c=_0x58d6[_0x22dd2b];return _0x2c816c;};'use strict';var _=require('lodash');var util=require(_0x658d('0x0'));var logger=require(_0x658d('0x1'))('api');var moment=require(_0x658d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x658d('0x3'));var rimraf=require(_0x658d('0x4'));var config=require(_0x658d('0x5'));var attributes=require(_0x658d('0x6'));module['exports']=function(_0x513562,_0x48f5e3){return _0x513562[_0x658d('0x7')](_0x658d('0x8'),attributes,{'tableName':_0x658d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x658d('0xa')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 8c5450e..97d3922 100644 --- a/server/api/userNotification/userNotification.rpc.js +++ b/server/api/userNotification/userNotification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d1b=['redis','localhost','socket.io-emitter','register','info','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UserNotification,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x2d7aa1,_0x2a479a){var _0x15b38f=function(_0x56fdbd){while(--_0x56fdbd){_0x2d7aa1['push'](_0x2d7aa1['shift']());}};_0x15b38f(++_0x2a479a);}(_0x4d1b,0x1c8));var _0xb4d1=function(_0x18f82b,_0x3ea7a0){_0x18f82b=_0x18f82b-0x0;var _0x5d8128=_0x4d1b[_0x18f82b];return _0x5d8128;};'use strict';var _=require(_0xb4d1('0x0'));var util=require('util');var moment=require(_0xb4d1('0x1'));var BPromise=require(_0xb4d1('0x2'));var rs=require(_0xb4d1('0x3'));var fs=require('fs');var Redis=require(_0xb4d1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb4d1('0x5'));var logger=require('../../config/logger')(_0xb4d1('0x6'));var config=require(_0xb4d1('0x7'));var jayson=require(_0xb4d1('0x8'));var client=jayson[_0xb4d1('0x9')][_0xb4d1('0xa')]({'port':0x232a});config['redis']=_[_0xb4d1('0xb')](config[_0xb4d1('0xc')],{'host':_0xb4d1('0xd'),'port':0x18eb});var socket=require(_0xb4d1('0xe'))(new Redis(config[_0xb4d1('0xc')]));require('./userNotification.socket')[_0xb4d1('0xf')](socket);function respondWithRpcPromise(_0x528666,_0x13d5e2,_0x116112){return new BPromise(function(_0x13ea9c,_0x358ba4){return client['request'](_0x528666,_0x116112)['then'](function(_0x98516d){logger[_0xb4d1('0x10')]('UserNotification,\x20%s,\x20%s',_0x13d5e2,'request\x20sent');logger['debug'](_0xb4d1('0x11'),_0x13d5e2,_0xb4d1('0x12'),JSON[_0xb4d1('0x13')](_0x98516d));if(_0x98516d[_0xb4d1('0x14')]){if(_0x98516d[_0xb4d1('0x14')][_0xb4d1('0x15')]===0x1f4){logger[_0xb4d1('0x14')]('UserNotification,\x20%s,\x20%s',_0x13d5e2,_0x98516d['error'][_0xb4d1('0x16')]);return _0x358ba4(_0x98516d[_0xb4d1('0x14')][_0xb4d1('0x16')]);}logger[_0xb4d1('0x14')]('UserNotification,\x20%s,\x20%s',_0x13d5e2,_0x98516d['error'][_0xb4d1('0x16')]);return _0x13ea9c(_0x98516d[_0xb4d1('0x14')][_0xb4d1('0x16')]);}else{logger['info'](_0xb4d1('0x17'),_0x13d5e2,_0xb4d1('0x12'));_0x13ea9c(_0x98516d[_0xb4d1('0x18')]['message']);}})[_0xb4d1('0x19')](function(_0x32a2d3){logger[_0xb4d1('0x14')](_0xb4d1('0x17'),_0x13d5e2,_0x32a2d3);_0x358ba4(_0x32a2d3);});});} \ No newline at end of file +var _0x0cb0=['then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','request'];(function(_0x5ea364,_0x5cab78){var _0x191e57=function(_0x39a0ca){while(--_0x39a0ca){_0x5ea364['push'](_0x5ea364['shift']());}};_0x191e57(++_0x5cab78);}(_0x0cb0,0x107));var _0x00cb=function(_0xdc5a31,_0x119706){_0xdc5a31=_0xdc5a31-0x0;var _0x309f7e=_0x0cb0[_0xdc5a31];return _0x309f7e;};'use strict';var _=require(_0x00cb('0x0'));var util=require(_0x00cb('0x1'));var moment=require(_0x00cb('0x2'));var BPromise=require(_0x00cb('0x3'));var rs=require(_0x00cb('0x4'));var fs=require('fs');var Redis=require(_0x00cb('0x5'));var db=require(_0x00cb('0x6'))['db'];var utils=require(_0x00cb('0x7'));var logger=require(_0x00cb('0x8'))(_0x00cb('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x00cb('0xa')][_0x00cb('0xb')]({'port':0x232a});config[_0x00cb('0xc')]=_[_0x00cb('0xd')](config[_0x00cb('0xc')],{'host':_0x00cb('0xe'),'port':0x18eb});var socket=require(_0x00cb('0xf'))(new Redis(config[_0x00cb('0xc')]));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x4cc560,_0x257cc4,_0x444cc8){return new BPromise(function(_0x23408e,_0x107ca3){return client[_0x00cb('0x10')](_0x4cc560,_0x444cc8)[_0x00cb('0x11')](function(_0x2cddae){logger[_0x00cb('0x12')](_0x00cb('0x13'),_0x257cc4,_0x00cb('0x14'));logger[_0x00cb('0x15')](_0x00cb('0x16'),_0x257cc4,'request\x20sent',JSON['stringify'](_0x2cddae));if(_0x2cddae[_0x00cb('0x17')]){if(_0x2cddae[_0x00cb('0x17')][_0x00cb('0x18')]===0x1f4){logger[_0x00cb('0x17')]('UserNotification,\x20%s,\x20%s',_0x257cc4,_0x2cddae[_0x00cb('0x17')][_0x00cb('0x19')]);return _0x107ca3(_0x2cddae[_0x00cb('0x17')]['message']);}logger[_0x00cb('0x17')](_0x00cb('0x13'),_0x257cc4,_0x2cddae['error'][_0x00cb('0x19')]);return _0x23408e(_0x2cddae['error'][_0x00cb('0x19')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x257cc4,_0x00cb('0x14'));_0x23408e(_0x2cddae[_0x00cb('0x1a')]['message']);}})[_0x00cb('0x1b')](function(_0x5253a5){logger[_0x00cb('0x17')]('UserNotification,\x20%s,\x20%s',_0x257cc4,_0x5253a5);_0x107ca3(_0x5253a5);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index e72f044..279315c 100644 --- a/server/api/userNotification/userNotification.socket.js +++ b/server/api/userNotification/userNotification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6bac=['./userNotification.events','remove','update','removeListener','length'];(function(_0x3539d1,_0x2c1cb2){var _0x3ad7b7=function(_0x67178c){while(--_0x67178c){_0x3539d1['push'](_0x3539d1['shift']());}};_0x3ad7b7(++_0x2c1cb2);}(_0x6bac,0xa5));var _0xc6ba=function(_0x547ad4,_0x1b4a79){_0x547ad4=_0x547ad4-0x0;var _0x41930f=_0x6bac[_0x547ad4];return _0x41930f;};'use strict';var UserNotificationEvents=require(_0xc6ba('0x0'));var events=['save',_0xc6ba('0x1'),_0xc6ba('0x2')];function createListener(_0xf479c,_0x1869a3){return function(_0x489037){_0x1869a3['emit'](_0xf479c,_0x489037);};}function removeListener(_0x487ef1,_0x378f3d){return function(){UserNotificationEvents[_0xc6ba('0x3')](_0x487ef1,_0x378f3d);};}exports['register']=function(_0x222f20){for(var _0x2a16af=0x0,_0x33167e=events[_0xc6ba('0x4')];_0x2a16af<_0x33167e;_0x2a16af++){var _0x12d6e9=events[_0x2a16af];var _0x1fa2a8=createListener('userNotification:'+_0x12d6e9,_0x222f20);UserNotificationEvents['on'](_0x12d6e9,_0x1fa2a8);}}; \ No newline at end of file +var _0xdb8b=['removeListener','register','length','userNotification:','save','remove','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x5ee2d0,_0x50acd3){_0x5ee2d0=_0x5ee2d0-0x0;var _0x1d71cb=_0xdb8b[_0x5ee2d0];return _0x1d71cb;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xbdb8('0x0'),_0xbdb8('0x1'),_0xbdb8('0x2')];function createListener(_0x553ab3,_0x4ece48){return function(_0x1cc1b9){_0x4ece48['emit'](_0x553ab3,_0x1cc1b9);};}function removeListener(_0x3149c6,_0x2ec8cc){return function(){UserNotificationEvents[_0xbdb8('0x3')](_0x3149c6,_0x2ec8cc);};}exports[_0xbdb8('0x4')]=function(_0x4c6bdb){for(var _0x7affe8=0x0,_0x482c12=events[_0xbdb8('0x5')];_0x7affe8<_0x482c12;_0x7affe8++){var _0x2f2825=events[_0x7affe8];var _0x444d6=createListener(_0xbdb8('0x6')+_0x2f2825,_0x4c6bdb);UserNotificationEvents['on'](_0x2f2825,_0x444d6);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 8c8dbd4..ef41bc0 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 _0x6f18=['../../components/interaction/service','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x329e3c,_0x392235){var _0x145fa0=function(_0x45bd83){while(--_0x45bd83){_0x329e3c['push'](_0x329e3c['shift']());}};_0x145fa0(++_0x392235);}(_0x6f18,0x1b4));var _0x86f1=function(_0x514c61,_0x90f7b5){_0x514c61=_0x514c61-0x0;var _0x450d43=_0x6f18[_0x514c61];return _0x450d43;};'use strict';var multer=require(_0x86f1('0x0'));var util=require('util');var path=require(_0x86f1('0x1'));var timeout=require('connect-timeout');var express=require(_0x86f1('0x2'));var router=express[_0x86f1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x86f1('0x4'));var interaction=require(_0x86f1('0x5'));var config=require('../../config/environment');module[_0x86f1('0x6')]=router; \ No newline at end of file +var _0xafcd=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x31fcb9,_0x350d71){var _0xb1eee9=function(_0x47226f){while(--_0x47226f){_0x31fcb9['push'](_0x31fcb9['shift']());}};_0xb1eee9(++_0x350d71);}(_0xafcd,0x157));var _0xdafc=function(_0x36284b,_0x2b7436){_0x36284b=_0x36284b-0x0;var _0x23c34a=_0xafcd[_0x36284b];return _0x23c34a;};'use strict';var multer=require(_0xdafc('0x0'));var util=require(_0xdafc('0x1'));var path=require(_0xdafc('0x2'));var timeout=require(_0xdafc('0x3'));var express=require(_0xdafc('0x4'));var router=express[_0xdafc('0x5')]();var fs_extra=require(_0xdafc('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdafc('0x7'));var config=require(_0xdafc('0x8'));module[_0xdafc('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 25762a3..2cf9b3a 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 _0xbaf0=['exports','INTEGER'];(function(_0x1e0846,_0x4aea1b){var _0x57e5d7=function(_0x2f9fb3){while(--_0x2f9fb3){_0x1e0846['push'](_0x1e0846['shift']());}};_0x57e5d7(++_0x4aea1b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x5482f4,_0x150cac){var _0x42d1ec=function(_0x2d3af5){while(--_0x2d3af5){_0x5482f4['push'](_0x5482f4['shift']());}};_0x42d1ec(++_0x150cac);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'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 810068a..25ca8d8 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 _0x698d=['../../config/environment','./userOpenchannelQueue.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x698d,0x9a));var _0xd698=function(_0x44894c,_0x27072b){_0x44894c=_0x44894c-0x0;var _0x16d566=_0x698d[_0x44894c];return _0x16d566;};'use strict';var _=require(_0xd698('0x0'));var util=require(_0xd698('0x1'));var logger=require(_0xd698('0x2'))(_0xd698('0x3'));var moment=require(_0xd698('0x4'));var BPromise=require(_0xd698('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd698('0x6'));var attributes=require(_0xd698('0x7'));module[_0xd698('0x8')]=function(_0x4060e7,_0x4d5716){return _0x4060e7[_0xd698('0x9')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb526=['util','../../config/logger','api','moment','bluebird','path','rimraf','./userOpenchannelQueue.attributes','user_has_openchannel_queues'];(function(_0x2c42a5,_0x2d1b8f){var _0x50ef99=function(_0x1415f4){while(--_0x1415f4){_0x2c42a5['push'](_0x2c42a5['shift']());}};_0x50ef99(++_0x2d1b8f);}(_0xb526,0x1e6));var _0x6b52=function(_0x5756c6,_0x58290a){_0x5756c6=_0x5756c6-0x0;var _0x4b5806=_0xb526[_0x5756c6];return _0x4b5806;};'use strict';var _=require('lodash');var util=require(_0x6b52('0x0'));var logger=require(_0x6b52('0x1'))(_0x6b52('0x2'));var moment=require(_0x6b52('0x3'));var BPromise=require(_0x6b52('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b52('0x5'));var rimraf=require(_0x6b52('0x6'));var config=require('../../config/environment');var attributes=require(_0x6b52('0x7'));module['exports']=function(_0x4a8ae0,_0x1ed722){return _0x4a8ae0['define']('UserOpenchannelQueue',attributes,{'tableName':_0x6b52('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 5f84984..af11458 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 _0xb910=['../../config/environment','jayson/promise','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x267d8d,_0xe90f65){var _0x11a98f=function(_0x5703c9){while(--_0x5703c9){_0x267d8d['push'](_0x267d8d['shift']());}};_0x11a98f(++_0xe90f65);}(_0xb910,0x172));var _0x0b91=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xb910[_0x68ee8b];return _0x5148f7;};'use strict';var _=require('lodash');var util=require(_0x0b91('0x0'));var moment=require(_0x0b91('0x1'));var BPromise=require(_0x0b91('0x2'));var rs=require(_0x0b91('0x3'));var fs=require('fs');var Redis=require(_0x0b91('0x4'));var db=require(_0x0b91('0x5'))['db'];var utils=require(_0x0b91('0x6'));var logger=require('../../config/logger')(_0x0b91('0x7'));var config=require(_0x0b91('0x8'));var jayson=require(_0x0b91('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ec8e9,_0x58c027,_0x106247){return new BPromise(function(_0x244652,_0x1a3a21){return client[_0x0b91('0xa')](_0x1ec8e9,_0x106247)[_0x0b91('0xb')](function(_0x275d4b){logger[_0x0b91('0xc')](_0x0b91('0xd'),_0x58c027,'request\x20sent');logger[_0x0b91('0xe')](_0x0b91('0xf'),_0x58c027,_0x0b91('0x10'),JSON[_0x0b91('0x11')](_0x275d4b));if(_0x275d4b[_0x0b91('0x12')]){if(_0x275d4b[_0x0b91('0x12')]['code']===0x1f4){logger[_0x0b91('0x12')](_0x0b91('0xd'),_0x58c027,_0x275d4b[_0x0b91('0x12')][_0x0b91('0x13')]);return _0x1a3a21(_0x275d4b['error'][_0x0b91('0x13')]);}logger[_0x0b91('0x12')](_0x0b91('0xd'),_0x58c027,_0x275d4b[_0x0b91('0x12')][_0x0b91('0x13')]);return _0x244652(_0x275d4b[_0x0b91('0x12')][_0x0b91('0x13')]);}else{logger[_0x0b91('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x58c027,_0x0b91('0x10'));_0x244652(_0x275d4b[_0x0b91('0x14')][_0x0b91('0x13')]);}})['catch'](function(_0x3a936e){logger[_0x0b91('0x12')](_0x0b91('0xd'),_0x58c027,_0x3a936e);_0x1a3a21(_0x3a936e);});});} \ No newline at end of file +var _0x12c4=['client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0xca877,_0x1ad358){var _0x3d7691=function(_0x57bc76){while(--_0x57bc76){_0xca877['push'](_0xca877['shift']());}};_0x3d7691(++_0x1ad358);}(_0x12c4,0xea));var _0x412c=function(_0xbef0b5,_0x148a0e){_0xbef0b5=_0xbef0b5-0x0;var _0x4be9f2=_0x12c4[_0xbef0b5];return _0x4be9f2;};'use strict';var _=require('lodash');var util=require(_0x412c('0x0'));var moment=require(_0x412c('0x1'));var BPromise=require(_0x412c('0x2'));var rs=require(_0x412c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x412c('0x4'))['db'];var utils=require(_0x412c('0x5'));var logger=require('../../config/logger')(_0x412c('0x6'));var config=require(_0x412c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x412c('0x8')][_0x412c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47287d,_0x6564f2,_0x1c465a){return new BPromise(function(_0x2bc635,_0x1df331){return client[_0x412c('0xa')](_0x47287d,_0x1c465a)[_0x412c('0xb')](function(_0x385420){logger[_0x412c('0xc')](_0x412c('0xd'),_0x6564f2,'request\x20sent');logger[_0x412c('0xe')](_0x412c('0xf'),_0x6564f2,_0x412c('0x10'),JSON[_0x412c('0x11')](_0x385420));if(_0x385420['error']){if(_0x385420[_0x412c('0x12')][_0x412c('0x13')]===0x1f4){logger['error'](_0x412c('0xd'),_0x6564f2,_0x385420[_0x412c('0x12')][_0x412c('0x14')]);return _0x1df331(_0x385420[_0x412c('0x12')][_0x412c('0x14')]);}logger[_0x412c('0x12')](_0x412c('0xd'),_0x6564f2,_0x385420[_0x412c('0x12')]['message']);return _0x2bc635(_0x385420[_0x412c('0x12')][_0x412c('0x14')]);}else{logger[_0x412c('0xc')](_0x412c('0xd'),_0x6564f2,'request\x20sent');_0x2bc635(_0x385420[_0x412c('0x15')]['message']);}})['catch'](function(_0x364078){logger[_0x412c('0x12')](_0x412c('0xd'),_0x6564f2,_0x364078);_0x1df331(_0x364078);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 8ad5140..d53b29e 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 _0x0911=['put','delete','destroy','removeSections','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','/:id/resources','post','create','/:id/clone','clone','addSections'];(function(_0x3a5648,_0x58054e){var _0x34126d=function(_0x3a6476){while(--_0x3a6476){_0x3a5648['push'](_0x3a5648['shift']());}};_0x34126d(++_0x58054e);}(_0x0911,0x1a9));var _0x1091=function(_0x3ee9b2,_0xa090bb){_0x3ee9b2=_0x3ee9b2-0x0;var _0x51ac3e=_0x0911[_0x3ee9b2];return _0x51ac3e;};'use strict';var multer=require(_0x1091('0x0'));var util=require(_0x1091('0x1'));var path=require(_0x1091('0x2'));var timeout=require(_0x1091('0x3'));var express=require(_0x1091('0x4'));var router=express['Router']();var fs_extra=require(_0x1091('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1091('0x6'));var config=require(_0x1091('0x7'));var controller=require(_0x1091('0x8'));router[_0x1091('0x9')]('/',auth[_0x1091('0xa')](),controller[_0x1091('0xb')]);router[_0x1091('0x9')](_0x1091('0xc'),auth[_0x1091('0xa')](),controller[_0x1091('0xd')]);router['get'](_0x1091('0xe'),auth[_0x1091('0xa')](),controller[_0x1091('0xf')]);router[_0x1091('0x9')](_0x1091('0x10'),auth[_0x1091('0xa')](),controller['getSections']);router[_0x1091('0x9')](_0x1091('0x11'),auth['isAuthenticated'](),controller['getResources']);router[_0x1091('0x12')]('/',auth['isAuthenticated'](),controller[_0x1091('0x13')]);router['post'](_0x1091('0x14'),auth[_0x1091('0xa')](),controller[_0x1091('0x15')]);router[_0x1091('0x12')]('/:id/sections',auth[_0x1091('0xa')](),controller[_0x1091('0x16')]);router['post']('/:id/resources',auth['isAuthenticated'](),controller['addResources']);router[_0x1091('0x17')](_0x1091('0xe'),auth[_0x1091('0xa')](),controller['update']);router[_0x1091('0x18')](_0x1091('0xe'),auth[_0x1091('0xa')](),controller[_0x1091('0x19')]);router[_0x1091('0x18')]('/:id/sections',auth[_0x1091('0xa')](),controller[_0x1091('0x1a')]);router[_0x1091('0x18')](_0x1091('0x11'),auth[_0x1091('0xa')](),controller['removeResources']);module[_0x1091('0x1b')]=router; \ No newline at end of file +var _0xcd4e=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','getSections','getResources','post','/:id/clone','clone','addSections','/:id/resources','addResources','put','delete','destroy','/:id/sections','removeSections','removeResources','exports','multer'];(function(_0x33c195,_0xf8e46d){var _0x4c6b24=function(_0x420d01){while(--_0x420d01){_0x33c195['push'](_0x33c195['shift']());}};_0x4c6b24(++_0xf8e46d);}(_0xcd4e,0x187));var _0xecd4=function(_0x3f6a7b,_0x1a537b){_0x3f6a7b=_0x3f6a7b-0x0;var _0x4f3967=_0xcd4e[_0x3f6a7b];return _0x4f3967;};'use strict';var multer=require(_0xecd4('0x0'));var util=require(_0xecd4('0x1'));var path=require(_0xecd4('0x2'));var timeout=require(_0xecd4('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xecd4('0x4'));var auth=require(_0xecd4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xecd4('0x6'));var controller=require('./userProfile.controller');router[_0xecd4('0x7')]('/',auth['isAuthenticated'](),controller[_0xecd4('0x8')]);router[_0xecd4('0x7')](_0xecd4('0x9'),auth[_0xecd4('0xa')](),controller[_0xecd4('0xb')]);router['get'](_0xecd4('0xc'),auth[_0xecd4('0xa')](),controller['show']);router[_0xecd4('0x7')]('/:id/sections',auth[_0xecd4('0xa')](),controller[_0xecd4('0xd')]);router[_0xecd4('0x7')]('/:id/resources',auth[_0xecd4('0xa')](),controller[_0xecd4('0xe')]);router['post']('/',auth[_0xecd4('0xa')](),controller['create']);router[_0xecd4('0xf')](_0xecd4('0x10'),auth[_0xecd4('0xa')](),controller[_0xecd4('0x11')]);router[_0xecd4('0xf')]('/:id/sections',auth[_0xecd4('0xa')](),controller[_0xecd4('0x12')]);router[_0xecd4('0xf')](_0xecd4('0x13'),auth[_0xecd4('0xa')](),controller[_0xecd4('0x14')]);router[_0xecd4('0x15')](_0xecd4('0xc'),auth[_0xecd4('0xa')](),controller['update']);router[_0xecd4('0x16')](_0xecd4('0xc'),auth[_0xecd4('0xa')](),controller[_0xecd4('0x17')]);router[_0xecd4('0x16')](_0xecd4('0x18'),auth['isAuthenticated'](),controller[_0xecd4('0x19')]);router['delete'](_0xecd4('0x13'),auth[_0xecd4('0xa')](),controller[_0xecd4('0x1a')]);module[_0xecd4('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 5baf484..d11b384 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 _0x0db9=['BOOLEAN','sequelize','STRING','crudPermissions','getDataValue','split'];(function(_0x1cfa0a,_0x507bdf){var _0x15a00c=function(_0x7aaf24){while(--_0x7aaf24){_0x1cfa0a['push'](_0x1cfa0a['shift']());}};_0x15a00c(++_0x507bdf);}(_0x0db9,0xa3));var _0x90db=function(_0x81e39d,_0x4c3934){_0x81e39d=_0x81e39d-0x0;var _0x548fbb=_0x0db9[_0x81e39d];return _0x548fbb;};'use strict';var Sequelize=require(_0x90db('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x90db('0x1')],'set':function(_0x405229){this['setDataValue'](_0x90db('0x2'),_0x405229?_0x405229['join'](''):[]);},'get':function(){return this[_0x90db('0x3')](_0x90db('0x2'))?this['getDataValue'](_0x90db('0x2'))[_0x90db('0x4')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x90db('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x90db('0x5')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x90db('0x5')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x90db('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x90db('0x5')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x90db('0x5')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x90db('0x5')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x90db('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0xae87=['split','BOOLEAN','STRING','crudPermissions','getDataValue'];(function(_0x4d8331,_0x1b852a){var _0x2c0c78=function(_0x1100c6){while(--_0x1100c6){_0x4d8331['push'](_0x4d8331['shift']());}};_0x2c0c78(++_0x1b852a);}(_0xae87,0x1ce));var _0x7ae8=function(_0x3042c5,_0x36cb88){_0x3042c5=_0x3042c5-0x0;var _0x7cd140=_0xae87[_0x3042c5];return _0x7cd140;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x7ae8('0x0')],'set':function(_0x27b5e6){this['setDataValue'](_0x7ae8('0x1'),_0x27b5e6?_0x27b5e6['join'](''):[]);},'get':function(){return this['getDataValue'](_0x7ae8('0x1'))?this[_0x7ae8('0x2')](_0x7ae8('0x1'))[_0x7ae8('0x3')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x7ae8('0x4')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x7ae8('0x4')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x7ae8('0x4')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x7ae8('0x4')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x7ae8('0x4')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7ae8('0x4')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x7ae8('0x4')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index a45ac4c..451fe44 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 _0xa8c8=['smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','voicequeues','VoiceQueues','users','agents','telephones','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','triggers','Trigger','trunks','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','whatsappaccounts','WhatsappAccount','screenrecordings','ScreenRecording','UserId','role','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','map','UserProfile','rawAttributes','fieldName','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','sort','where','type','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','get','createdAt','updatedAt','crudPermissions','body','omit','sequelize','UserProfileSection','autoAssociation','sectionId','Resources','UserProfileResource','update','describe','addSections','transaction','userProfileId','each','push','isEmpty','includes','subsections','enabled','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','ids','getResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','Invalid\x20section\x20\x27','parentSections','ignore','union','childModel','all','nolimit','order','pick','key','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','custom','CustomReports','CmContact','Tag','ThroughTags','color','tag','Agents','openTabs','true','chat','dataValues','sms','mail','openchannel','charAt','toUpperCase','slice','select','ui.','InteractionId','from','user_has_','ui.UserId\x20=\x20?','toString','OpenTabs','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicerecordings','VoiceRecording','membername','User','agent','Telephones','telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','mailqueues','mailsubstatuses','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues'];(function(_0x2d6473,_0x501a9f){var _0x1d4d7e=function(_0x2d6a07){while(--_0x2d6a07){_0x2d6473['push'](_0x2d6473['shift']());}};_0x1d4d7e(++_0x501a9f);}(_0xa8c8,0x139));var _0x8a8c=function(_0x687c80,_0x56405f){_0x687c80=_0x687c80-0x0;var _0xdc638b=_0xa8c8[_0x687c80];return _0xdc638b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a8c('0x0'));var zipdir=require(_0x8a8c('0x1'));var jsonpatch=require(_0x8a8c('0x2'));var rp=require('request-promise');var moment=require(_0x8a8c('0x3'));var BPromise=require(_0x8a8c('0x4'));var Mustache=require(_0x8a8c('0x5'));var util=require(_0x8a8c('0x6'));var path=require(_0x8a8c('0x7'));var sox=require(_0x8a8c('0x8'));var csv=require(_0x8a8c('0x9'));var ejs=require(_0x8a8c('0xa'));var fs=require('fs');var fs_extra=require(_0x8a8c('0xb'));var _=require(_0x8a8c('0xc'));var squel=require(_0x8a8c('0xd'));var crypto=require(_0x8a8c('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8a8c('0x9'));var querystring=require(_0x8a8c('0xf'));var Papa=require(_0x8a8c('0x10'));var Redis=require(_0x8a8c('0x11'));var authService=require(_0x8a8c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8a8c('0x13'));var hardwareService=require(_0x8a8c('0x14'));var logger=require(_0x8a8c('0x15'))(_0x8a8c('0x16'));var utils=require('../../config/utils');var config=require(_0x8a8c('0x17'));var licenseUtil=require(_0x8a8c('0x18'));var db=require(_0x8a8c('0x19'))['db'];config[_0x8a8c('0x1a')]=_['defaults'](config[_0x8a8c('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x8a8c('0x1b'))(new Redis(config[_0x8a8c('0x1a')]));require(_0x8a8c('0x1c'))[_0x8a8c('0x1d')](socket);function respondWithStatusCode(_0x274e07,_0x12d8c1){_0x12d8c1=_0x12d8c1||0xcc;return function(_0x36c3a1){if(_0x36c3a1){return _0x274e07[_0x8a8c('0x1e')](_0x12d8c1);}return _0x274e07[_0x8a8c('0x1f')](_0x12d8c1)[_0x8a8c('0x20')]();};}function respondWithResult(_0x355fa9,_0x1095d9){_0x1095d9=_0x1095d9||0xc8;return function(_0x3ab66a){if(_0x3ab66a){return _0x355fa9['status'](_0x1095d9)[_0x8a8c('0x21')](_0x3ab66a);}};}function respondWithFilteredResult(_0x1931c1,_0x5ee827){return function(_0x52b455){if(_0x52b455){var _0x59b594=typeof _0x5ee827[_0x8a8c('0x22')]==='undefined'&&typeof _0x5ee827[_0x8a8c('0x23')]==='undefined';var _0x11ae5a=_0x52b455[_0x8a8c('0x24')];var _0x1bd6c9=_0x59b594?0x0:_0x5ee827[_0x8a8c('0x22')];var _0x4ef141=_0x59b594?_0x52b455[_0x8a8c('0x24')]:_0x5ee827[_0x8a8c('0x22')]+_0x5ee827[_0x8a8c('0x23')];var _0x324016;if(_0x4ef141>=_0x11ae5a){_0x4ef141=_0x11ae5a;_0x324016=0xc8;}else{_0x324016=0xce;}_0x1931c1['status'](_0x324016);return _0x1931c1[_0x8a8c('0x25')](_0x8a8c('0x26'),_0x1bd6c9+'-'+_0x4ef141+'/'+_0x11ae5a)[_0x8a8c('0x21')](_0x52b455);}return null;};}function patchUpdates(_0x3fc116){return function(_0x56526d){try{jsonpatch[_0x8a8c('0x27')](_0x56526d,_0x3fc116,!![]);}catch(_0x10c4cc){return BPromise[_0x8a8c('0x28')](_0x10c4cc);}return _0x56526d[_0x8a8c('0x29')]();};}function saveUpdates(_0x331e86,_0xc28e18){return function(_0x245092){if(_0x245092){return _0x245092['update'](_0x331e86)[_0x8a8c('0x2a')](function(_0x52b320){return _0x52b320;});}return null;};}function removeEntity(_0x2159d6,_0x2bded5){return function(_0x42e594){if(_0x42e594){return _0x42e594[_0x8a8c('0x2b')]()[_0x8a8c('0x2a')](function(){_0x2159d6[_0x8a8c('0x1f')](0xcc)[_0x8a8c('0x20')]();});}};}function handleEntityNotFound(_0x5a9280,_0x3f1208){return function(_0x317fb6){if(!_0x317fb6){_0x5a9280[_0x8a8c('0x1e')](0x194);}return _0x317fb6;};}function handleError(_0x2a3389,_0xdad6d6){_0xdad6d6=_0xdad6d6||0x1f4;return function(_0x650131){logger[_0x8a8c('0x2c')](_0x650131['stack']);if(_0x650131[_0x8a8c('0x2d')]){delete _0x650131['name'];}_0x2a3389[_0x8a8c('0x1f')](_0xdad6d6)[_0x8a8c('0x2e')](_0x650131);};}exports['index']=function(_0x4f7dbc,_0x5f9421){var _0x92d816={},_0x279826={},_0x480819={'count':0x0,'rows':[]};var _0x4c8b16=_[_0x8a8c('0x2f')](db[_0x8a8c('0x30')][_0x8a8c('0x31')],function(_0x47976c){return{'name':_0x47976c[_0x8a8c('0x32')],'type':_0x47976c['type']['key']};});_0x279826['model']=_['map'](_0x4c8b16,'name');_0x279826[_0x8a8c('0x33')]=_[_0x8a8c('0x34')](_0x4f7dbc[_0x8a8c('0x33')]);_0x279826[_0x8a8c('0x35')]=_['intersection'](_0x279826['model'],_0x279826[_0x8a8c('0x33')]);_0x92d816[_0x8a8c('0x36')]=_[_0x8a8c('0x37')](_0x279826['model'],qs[_0x8a8c('0x38')](_0x4f7dbc[_0x8a8c('0x33')][_0x8a8c('0x38')]));_0x92d816['attributes']=_0x92d816['attributes'][_0x8a8c('0x39')]?_0x92d816[_0x8a8c('0x36')]:_0x279826[_0x8a8c('0x3a')];if(!_0x4f7dbc[_0x8a8c('0x33')][_0x8a8c('0x3b')]('nolimit')){_0x92d816['limit']=qs[_0x8a8c('0x23')](_0x4f7dbc['query'][_0x8a8c('0x23')]);_0x92d816[_0x8a8c('0x22')]=qs[_0x8a8c('0x22')](_0x4f7dbc['query'][_0x8a8c('0x22')]);}_0x92d816['order']=qs[_0x8a8c('0x3c')](_0x4f7dbc[_0x8a8c('0x33')]['sort']);_0x92d816[_0x8a8c('0x3d')]=qs[_0x8a8c('0x35')](_['pick'](_0x4f7dbc[_0x8a8c('0x33')],_0x279826['filters']),_0x4c8b16);if(_0x4f7dbc[_0x8a8c('0x33')]['filter']){_0x92d816['where']=_['merge'](_0x92d816['where'],{'$or':_[_0x8a8c('0x2f')](_0x4c8b16,function(_0x3c67c8){if(_0x3c67c8[_0x8a8c('0x3e')]!==_0x8a8c('0x3f')){var _0x4ae06f={};_0x4ae06f[_0x3c67c8['name']]={'$like':'%'+_0x4f7dbc['query'][_0x8a8c('0x40')]+'%'};return _0x4ae06f;}})});}_0x92d816=_[_0x8a8c('0x41')]({},_0x92d816,_0x4f7dbc[_0x8a8c('0x42')]);var _0x3d7af6={'where':_0x92d816[_0x8a8c('0x3d')]};return db['UserProfile'][_0x8a8c('0x24')](_0x3d7af6)[_0x8a8c('0x2a')](function(_0x21c6df){_0x480819[_0x8a8c('0x24')]=_0x21c6df;if(_0x4f7dbc[_0x8a8c('0x33')]['includeAll']){_0x92d816[_0x8a8c('0x43')]=[{'all':!![]}];}return db['UserProfile'][_0x8a8c('0x44')](_0x92d816);})['then'](function(_0x1644f9){_0x480819[_0x8a8c('0x45')]=_0x1644f9;return _0x480819;})[_0x8a8c('0x2a')](respondWithFilteredResult(_0x5f9421,_0x92d816))[_0x8a8c('0x46')](handleError(_0x5f9421,null));};exports[_0x8a8c('0x47')]=function(_0x9414f9,_0x45b929){var _0xd84fe0={'raw':![],'where':{'id':_0x9414f9[_0x8a8c('0x48')]['id']}},_0x3d3d2b={};_0x3d3d2b[_0x8a8c('0x3a')]=_['keys'](db[_0x8a8c('0x30')][_0x8a8c('0x31')]);_0x3d3d2b[_0x8a8c('0x33')]=_[_0x8a8c('0x34')](_0x9414f9[_0x8a8c('0x33')]);_0x3d3d2b[_0x8a8c('0x35')]=_[_0x8a8c('0x37')](_0x3d3d2b[_0x8a8c('0x3a')],_0x3d3d2b[_0x8a8c('0x33')]);_0xd84fe0['attributes']=_[_0x8a8c('0x37')](_0x3d3d2b[_0x8a8c('0x3a')],qs[_0x8a8c('0x38')](_0x9414f9[_0x8a8c('0x33')][_0x8a8c('0x38')]));_0xd84fe0[_0x8a8c('0x36')]=_0xd84fe0[_0x8a8c('0x36')][_0x8a8c('0x39')]?_0xd84fe0['attributes']:_0x3d3d2b[_0x8a8c('0x3a')];if(_0x9414f9[_0x8a8c('0x33')][_0x8a8c('0x49')]){_0xd84fe0['include']=[{'all':!![]}];}_0xd84fe0=_[_0x8a8c('0x41')]({},_0xd84fe0,_0x9414f9[_0x8a8c('0x42')]);return db[_0x8a8c('0x30')][_0x8a8c('0x4a')](_0xd84fe0)['then'](handleEntityNotFound(_0x45b929,null))['then'](respondWithResult(_0x45b929,null))[_0x8a8c('0x46')](handleError(_0x45b929,null));};exports[_0x8a8c('0x4b')]=function(_0x4d9bfc,_0x1f309b){return db[_0x8a8c('0x30')][_0x8a8c('0x4b')](_0x4d9bfc['body'],{})[_0x8a8c('0x2a')](respondWithResult(_0x1f309b,0xc9))[_0x8a8c('0x46')](handleError(_0x1f309b,null));};exports['clone']=function(_0x4276c1,_0x45f511){var _0x3f2064={'where':{'id':_0x4276c1[_0x8a8c('0x48')]['id']}},_0x17584f={};_0x17584f[_0x8a8c('0x3a')]=_[_0x8a8c('0x34')](db[_0x8a8c('0x30')][_0x8a8c('0x31')]);_0x3f2064[_0x8a8c('0x36')]=_[_0x8a8c('0x37')](_0x17584f['model'],qs[_0x8a8c('0x38')](_0x4276c1[_0x8a8c('0x33')][_0x8a8c('0x38')]));_0x3f2064[_0x8a8c('0x36')]=_0x3f2064[_0x8a8c('0x36')][_0x8a8c('0x39')]?_0x3f2064['attributes']:_0x17584f[_0x8a8c('0x3a')];if(_0x4276c1[_0x8a8c('0x33')][_0x8a8c('0x49')]){_0x3f2064[_0x8a8c('0x43')]=[{'all':!![]}];}_0x3f2064=_[_0x8a8c('0x41')]({},_0x3f2064,_0x4276c1[_0x8a8c('0x42')]);return db[_0x8a8c('0x30')][_0x8a8c('0x4a')](_0x3f2064)['then'](handleEntityNotFound(_0x45f511,null))[_0x8a8c('0x2a')](function(_0x206a19){if(_0x206a19){var _0x8163fa=_0x206a19[_0x8a8c('0x4c')]({'plain':!![]});_0x8163fa=qs['omit'](_0x8163fa,['id',_0x8a8c('0x4d'),_0x8a8c('0x4e'),_0x8a8c('0x4f')]);_0x4276c1[_0x8a8c('0x50')]=_[_0x8a8c('0x51')](_0x4276c1[_0x8a8c('0x50')],['id',_0x8a8c('0x4d'),'updatedAt']);return db[_0x8a8c('0x52')]['transaction'](function(_0x4014b6){return db[_0x8a8c('0x30')][_0x8a8c('0x4b')](_[_0x8a8c('0x41')](_0x8163fa,_0x4276c1[_0x8a8c('0x50')]),{'include':_0x4276c1['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x4014b6})[_0x8a8c('0x2a')](function(_0x4a7111){var _0x55c7f8=_0x4a7111[_0x8a8c('0x4c')]({'plain':!![]});return db[_0x8a8c('0x53')][_0x8a8c('0x44')]({'where':{'userProfileId':_0x4276c1[_0x8a8c('0x48')]['id']},'raw':!![]})[_0x8a8c('0x2a')](function(_0xdc1f74){if(_0xdc1f74){return BPromise['each'](_0xdc1f74,function(_0x3d95a8){return new BPromise(function(_0x92b7db,_0x402a27){if(_0x3d95a8[_0x8a8c('0x54')]===null||_0x3d95a8['autoAssociation']===0x1)_0x92b7db(null);return db['UserProfileResource'][_0x8a8c('0x44')]({'where':{'sectionId':_0x3d95a8['id']},'raw':!![]})[_0x8a8c('0x2a')](function(_0x3ac243){var _0x106ed5=_['map'](_0x3ac243,function(_0x3b2802){return qs[_0x8a8c('0x51')](_0x3b2802,['id','createdAt',_0x8a8c('0x4e'),_0x8a8c('0x55')]);});_0x92b7db(_0x106ed5);})['catch'](function(_0x140823){_0x402a27(_0x140823);});})[_0x8a8c('0x2a')](function(_0x1b08c3){var _0x2e8a26=qs[_0x8a8c('0x51')](_0x3d95a8,['id',_0x8a8c('0x4d'),'updatedAt']);_0x2e8a26['userProfileId']=_0x55c7f8['id'];if(_0x1b08c3)_0x2e8a26[_0x8a8c('0x56')]=_0x1b08c3;return _0x2e8a26;})[_0x8a8c('0x2a')](function(_0x2c83e7){return db[_0x8a8c('0x53')][_0x8a8c('0x4b')](_0x2c83e7,{'include':[{'model':db[_0x8a8c('0x57')],'as':_0x8a8c('0x56')}],'raw':!![],'transaction':_0x4014b6});});})[_0x8a8c('0x2a')](function(){return _0x55c7f8;});}});});});}})[_0x8a8c('0x2a')](respondWithResult(_0x45f511,0xc9))[_0x8a8c('0x46')](handleError(_0x45f511,null));};exports[_0x8a8c('0x58')]=function(_0x29c085,_0x2d6820){if(_0x29c085[_0x8a8c('0x50')]['id']){delete _0x29c085[_0x8a8c('0x50')]['id'];}return db[_0x8a8c('0x30')]['find']({'where':{'id':_0x29c085[_0x8a8c('0x48')]['id']}})[_0x8a8c('0x2a')](handleEntityNotFound(_0x2d6820,null))['then'](saveUpdates(_0x29c085[_0x8a8c('0x50')],null))[_0x8a8c('0x2a')](respondWithResult(_0x2d6820,null))[_0x8a8c('0x46')](handleError(_0x2d6820,null));};exports[_0x8a8c('0x2b')]=function(_0x5af0ad,_0x32d7bc){return db[_0x8a8c('0x30')]['find']({'where':{'id':_0x5af0ad[_0x8a8c('0x48')]['id']}})[_0x8a8c('0x2a')](handleEntityNotFound(_0x32d7bc,null))['then'](removeEntity(_0x32d7bc,null))[_0x8a8c('0x46')](handleError(_0x32d7bc,null));};exports[_0x8a8c('0x59')]=function(_0x5b5bc1,_0x6a0b0){return db['UserProfile'][_0x8a8c('0x59')]()[_0x8a8c('0x2a')](respondWithResult(_0x6a0b0,null))[_0x8a8c('0x46')](handleError(_0x6a0b0,null));};exports[_0x8a8c('0x5a')]=function(_0xe70492,_0x3b675e){var _0x4004f1=_0xe70492['body'];return db[_0x8a8c('0x30')][_0x8a8c('0x4a')]({'where':{'id':_0xe70492[_0x8a8c('0x48')]['id']}})['then'](handleEntityNotFound(_0x3b675e,null))[_0x8a8c('0x2a')](function(_0x4818b7){if(_0x4818b7){return db[_0x8a8c('0x52')][_0x8a8c('0x5b')](function(_0x49dd7d){return db[_0x8a8c('0x53')][_0x8a8c('0x2b')]({'where':{'userProfileId':_0xe70492[_0x8a8c('0x48')]['id'],'sectionId':_[_0x8a8c('0x2f')](_0x4004f1,function(_0x454375){return _0x454375[_0x8a8c('0x55')];})},'transaction':_0x49dd7d})[_0x8a8c('0x2a')](function(){var _0x5009d3=_[_0x8a8c('0x2f')](_0x4004f1,function(_0x50b96b){_0x50b96b[_0x8a8c('0x5c')]=_0xe70492['params']['id'];return _0x50b96b;});var _0x3084fc=[];return BPromise[_0x8a8c('0x5d')](_0x5009d3,function(_0x1469f3){return db[_0x8a8c('0x53')][_0x8a8c('0x4b')](_0x1469f3,{'include':[{'model':db[_0x8a8c('0x57')],'as':_0x8a8c('0x56')}],'raw':!![],'transaction':_0x49dd7d})[_0x8a8c('0x2a')](function(_0xa92b30){_0x3084fc[_0x8a8c('0x5e')](_0xa92b30[_0x8a8c('0x4c')]({'plain':!![]}));});})[_0x8a8c('0x2a')](function(){return _0x3084fc;});});});}})['then'](function(_0x26f197){return _0x26f197;})[_0x8a8c('0x2a')](respondWithResult(_0x3b675e,null))[_0x8a8c('0x46')](handleError(_0x3b675e,null));};exports['removeSections']=function(_0x324c29,_0x567c2f){var _0x4aca68;return db['UserProfile'][_0x8a8c('0x4a')]({'where':{'id':_0x324c29['params']['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x567c2f,null))[_0x8a8c('0x2a')](function(_0x7fcba){if(_0x7fcba){_0x4aca68=_0x7fcba;return db[_0x8a8c('0x53')][_0x8a8c('0x2b')]({'where':{'userProfileId':_0x324c29[_0x8a8c('0x48')]['id'],'sectionId':_0x324c29['query']['ids']}});}})[_0x8a8c('0x2a')](function(){return _0x4aca68;})[_0x8a8c('0x2a')](respondWithStatusCode(_0x567c2f,null))[_0x8a8c('0x46')](handleError(_0x567c2f,null));};exports['getSections']=function(_0x4300fb,_0x5a83cc){var _0x216e2a=[];var _0x2984fc=[];return db['UserProfileSection'][_0x8a8c('0x44')]({'where':{'userProfileId':_0x4300fb[_0x8a8c('0x48')]['id']},'raw':!![]})[_0x8a8c('0x2a')](function(_0x2bab1a){_0x216e2a=_[_0x8a8c('0x40')](_0x2bab1a,function(_0x42ef17){return _0x42ef17['enabled']===0x1||_['includes']([0x3eb,0x709],_0x42ef17['sectionId']);});if(!_[_0x8a8c('0x5f')](_0x216e2a)){return _[_0x8a8c('0x2f')](_0x216e2a,function(_0x4af530){return _0x4af530[_0x8a8c('0x55')];});}else{return;}})[_0x8a8c('0x2a')](function(_0x21b3b2){if(_0x21b3b2)_0x2984fc=_0x21b3b2;if(_[_0x8a8c('0x60')](_0x2984fc,0x64)){var _0x1d56ee=_[_0x8a8c('0x4a')](_0x216e2a,{'sectionId':0x64});return hasDefaultDashboard(_0x1d56ee)['then'](function(_0x29b7f3){return _[_0x8a8c('0x2f')](_0x216e2a,function(_0xb79b6f){if(_0xb79b6f[_0x8a8c('0x55')]===0x64){_0xb79b6f[_0x8a8c('0x61')]=_0x29b7f3;}return _0xb79b6f;});});}else{return;}})['then'](function(_0xd1ae3b){if(_0xd1ae3b)_0x216e2a=_0xd1ae3b;if(_['includes'](_0x2984fc,0x3eb)){var _0x47e364=_['find'](_0x216e2a,{'sectionId':0x3eb});return getCustomDashboards(_0x47e364)['then'](function(_0x14e62e){return _[_0x8a8c('0x2f')](_0x216e2a,function(_0x8f22d){if(_0x47e364[_0x8a8c('0x62')]){if(_0x8f22d[_0x8a8c('0x55')]===0x3eb){_0x8f22d[_0x8a8c('0x61')]=_0x14e62e;}}else{if(_0x8f22d[_0x8a8c('0x55')]===0x64){_0x8f22d[_0x8a8c('0x61')]=_0x14e62e;}}return _0x8f22d;});});}else{return;}})['then'](function(_0x190c19){if(_0x190c19)_0x216e2a=_0x190c19;if(_[_0x8a8c('0x60')](_0x2984fc,0x709)){var _0x318984=_[_0x8a8c('0x4a')](_0x216e2a,{'sectionId':0x709});return getPlugins(_0x318984)[_0x8a8c('0x2a')](function(_0x4da9f3){if(_0x318984['enabled']){return _[_0x8a8c('0x2f')](_0x216e2a,function(_0x5cc0c6){if(_0x5cc0c6[_0x8a8c('0x55')]===0x709){_0x5cc0c6[_0x8a8c('0x61')]=_0x4da9f3;}return _0x5cc0c6;});}else{var _0x5f3296={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4da9f3};var _0x145e06=_['map'](_0x216e2a);_0x145e06[_0x8a8c('0x5e')](_0x5f3296);return _0x145e06;}});}else{return;}})[_0x8a8c('0x2a')](function(_0x14ee3d){if(_0x14ee3d)_0x216e2a=_0x14ee3d;return _['filter'](_0x216e2a,[_0x8a8c('0x62'),0x1]);})[_0x8a8c('0x2a')](respondWithResult(_0x5a83cc,null))[_0x8a8c('0x46')](handleError(_0x5a83cc,null));};function hasDefaultDashboard(_0x326395){var _0x8fb1b4=[0x65];return new BPromise(function(_0x5d31ce,_0x1f2cc5){try{if(_0x326395['autoAssociation']){_0x5d31ce(_0x8fb1b4);}else{return db[_0x8a8c('0x57')][_0x8a8c('0x63')]({'where':{'sectionId':_0x326395['id']},'raw':!![]})[_0x8a8c('0x2a')](function(_0x31f046){_0x31f046?_0x5d31ce(_0x8fb1b4):_0x5d31ce();});}}catch(_0x1e9a46){_0x1f2cc5(_0x1e9a46);}});}function getCustomDashboards(_0x50d854){var _0x26152c=[];return new BPromise(function(_0x25b629,_0x369127){try{if(_0x50d854['autoAssociation']){return db[_0x8a8c('0x64')][_0x8a8c('0x44')]({'raw':!![]})[_0x8a8c('0x2a')](function(_0x1e927f){_0x1e927f[_0x8a8c('0x65')](function(_0x5435d2){_0x26152c[_0x8a8c('0x5e')](_0x5435d2['id']+0x1869f);});_0x25b629(_0x26152c);});}else{return db['UserProfileResource'][_0x8a8c('0x44')]({'where':{'sectionId':_0x50d854['id']},'raw':!![]})['then'](function(_0x485c2d){_0x485c2d['forEach'](function(_0x1bdc04){_0x26152c['push'](_0x1bdc04[_0x8a8c('0x66')]+0x1869f);});_0x25b629(_0x26152c);});}}catch(_0x33d190){_0x369127(_0x33d190);}});}function getPlugins(_0x126b0e){var _0x5de8c7=[];return new BPromise(function(_0x4266da,_0x2b4fbe){try{if(_0x126b0e[_0x8a8c('0x54')]){return db[_0x8a8c('0x67')][_0x8a8c('0x44')]({'raw':!![]})[_0x8a8c('0x2a')](function(_0x32e863){_0x32e863[_0x8a8c('0x65')](function(_0x407ad5){_0x5de8c7['push'](_0x407ad5['id']+0x15b38);});_0x4266da(_0x5de8c7);});}else{return db[_0x8a8c('0x57')][_0x8a8c('0x44')]({'where':{'sectionId':_0x126b0e['id']},'raw':!![]})[_0x8a8c('0x2a')](function(_0x2f9df2){_0x2f9df2['forEach'](function(_0x3d6a0f){_0x5de8c7['push'](_0x3d6a0f['resourceId']+0x15b38);});_0x4266da(_0x5de8c7);});}}catch(_0x532982){_0x2b4fbe(_0x532982);}});}exports[_0x8a8c('0x68')]=function(_0xf8f2bd,_0x412703){return db['UserProfile']['find']({'where':{'id':_0xf8f2bd[_0x8a8c('0x48')]['id']}})[_0x8a8c('0x2a')](handleEntityNotFound(_0x412703,null))[_0x8a8c('0x2a')](function(_0x508db4){if(_0x508db4){return db[_0x8a8c('0x52')][_0x8a8c('0x5b')](function(_0x4ac453){return db[_0x8a8c('0x53')][_0x8a8c('0x44')]({'where':{'userProfileId':_0xf8f2bd['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x575798){if(_0x575798){return db[_0x8a8c('0x53')][_0x8a8c('0x2b')]({'where':{'userProfileId':_0xf8f2bd[_0x8a8c('0x48')]['id'],'id':_[_0x8a8c('0x2f')](_0x575798,function(_0x4cd57c){return _0x4cd57c['id'];})},'transaction':_0x4ac453});}})[_0x8a8c('0x2a')](function(_0x1e7c65){var _0x4c94fd=_['map'](_0xf8f2bd[_0x8a8c('0x50')],function(_0x4f789b){_0x4f789b[_0x8a8c('0x5c')]=_0xf8f2bd[_0x8a8c('0x48')]['id'];return _0x4f789b;});return db[_0x8a8c('0x53')]['bulkCreate'](_0x4c94fd,{'raw':!![],'transaction':_0x4ac453});})['then'](function(_0x538d14){var _0x130b02=_['filter'](_[_0x8a8c('0x2f')](_0x538d14,function(_0x30fa7f){return _0x30fa7f[_0x8a8c('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x130b02){return db[_0x8a8c('0x53')][_0x8a8c('0x44')]({'where':{'userProfileId':_0xf8f2bd[_0x8a8c('0x48')]['id'],'sectionId':_[_0x8a8c('0x2f')](_0x130b02,function(_0x1e6c74){return _0x1e6c74[_0x8a8c('0x55')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x8a8c('0x2a')](function(_0x1e9b39){var _0x461415=_['map'](_0xf8f2bd['body'],function(_0x101a25){_0x101a25[_0x8a8c('0x5c')]=_0xf8f2bd[_0x8a8c('0x48')]['id'];return _0x101a25;});return db[_0x8a8c('0x57')][_0x8a8c('0x69')](_0x461415,{'raw':!![],'transaction':_0x4ac453});});}})['catch'](handleError(_0x412703,null));});}})[_0x8a8c('0x2a')](function(_0x54e34a){var _0x27230c=_[_0x8a8c('0x2f')](_0x54e34a,function(_0x347cbe){return _0x347cbe[_0x8a8c('0x4c')]({'plain':!![]});});})[_0x8a8c('0x2a')](respondWithResult(_0x412703,null))[_0x8a8c('0x46')](handleError(_0x412703,null));};exports['removeResources']=function(_0x539fe1,_0x2f1557,_0x273c0b){return db[_0x8a8c('0x30')][_0x8a8c('0x4a')]({'where':{'id':_0x539fe1['params']['id']}})['then'](handleEntityNotFound(_0x2f1557,null))[_0x8a8c('0x2a')](function(_0x24c1ce){if(_0x24c1ce){return _0x24c1ce['removeResources'](_0x539fe1[_0x8a8c('0x33')][_0x8a8c('0x6a')]);}})['then'](respondWithStatusCode(_0x2f1557,null))[_0x8a8c('0x46')](handleError(_0x2f1557,null));};exports[_0x8a8c('0x6b')]=function(_0x210285,_0x2c9de8){var _0x40f838={'raw':![],'where':{}};var _0xc535b1={};var _0x10c23d={'count':0x0,'rows':[]};var _0x5db22d=_0x210285[_0x8a8c('0x33')][_0x8a8c('0x6c')];if(typeof _0x5db22d==='undefined'){throw new db[(_0x8a8c('0x6d'))][(_0x8a8c('0x6e'))](_0x8a8c('0x6f'));}var _0x3f1e8e=_0x210285[_0x8a8c('0x33')][_0x8a8c('0x70')]||![];var _0x45598c=getQueryModels(_0x5db22d,_0x3f1e8e);if(typeof _0x45598c['childModel']==='undefined'){throw new db[(_0x8a8c('0x6d'))][(_0x8a8c('0x6e'))](_0x8a8c('0x71')+_0x5db22d+'\x27');}var _0x1bb45a=[];if(!_['isEmpty'](_0x45598c['parentSections'])){_0x1bb45a=_0x45598c[_0x8a8c('0x72')];}else{_0x1bb45a=[{'name':_0x5db22d}];}return db['UserProfile'][_0x8a8c('0x63')]({'where':{'id':_0x210285[_0x8a8c('0x48')]['id']}})[_0x8a8c('0x2a')](handleEntityNotFound(_0x2c9de8,null))['then'](function(_0x4f8105){if(_0x4f8105){var _0x493fcf=[];for(var _0x2cb401=0x0;_0x2cb401<_0x1bb45a[_0x8a8c('0x39')];_0x2cb401++){_0x493fcf[_0x8a8c('0x5e')](db[_0x8a8c('0x53')][_0x8a8c('0x63')]({'where':{'userProfileId':_0x4f8105['id'],'name':_0x1bb45a[_0x2cb401][_0x8a8c('0x2d')]},'raw':!![]}));}return BPromise['all'](_0x493fcf);}})[_0x8a8c('0x2a')](function(_0xa64e2f){var _0xcf22f6=_[_0x8a8c('0x40')](_0xa64e2f,function(_0x5d2c8a){return _0x5d2c8a?_0x5d2c8a:undefined;});var _0x5dfa1e=_['filter'](_0x1bb45a,[_0x8a8c('0x73'),!![]]);var _0x4502fb=_[_0x8a8c('0x5f')](_0xcf22f6)&&_[_0x8a8c('0x5f')](_0x5dfa1e)?null:_[_0x8a8c('0x74')](_0x5dfa1e,_0xcf22f6);if(_0x4502fb){var _0x188609=[];for(var _0x5a7ff3=0x0;_0x5a7ff3<_0x4502fb[_0x8a8c('0x39')];_0x5a7ff3++){var _0x53bddb=_['find'](_0x1bb45a,function(_0x3408fd){return _0x4502fb[_0x5a7ff3]?_0x3408fd[_0x8a8c('0x2d')]===_0x4502fb[_0x5a7ff3][_0x8a8c('0x2d')]:null;});if(_0x53bddb){if(_0x4502fb[_0x5a7ff3][_0x8a8c('0x73')]){_0x188609[_0x8a8c('0x5e')](getAllResources(_0x45598c[_0x8a8c('0x75')],_0x4502fb[_0x5a7ff3]));}else{if(!_0x4502fb[_0x5a7ff3]['autoAssociation']){_0x188609['push'](getAllowedResources(_0x53bddb,_0x4502fb[_0x5a7ff3],_0x45598c[_0x8a8c('0x75')]));}else{if(_0x53bddb[_0x8a8c('0x3a')]){_0x188609[_0x8a8c('0x5e')](getAllFilteredResources(_0x53bddb,_0x4502fb[_0x5a7ff3]));}}}}}return BPromise[_0x8a8c('0x76')](_0x188609);}else{return null;}})[_0x8a8c('0x2a')](function(_0x2f8038){var _0x3a38bd=_0x2f8038;var _0x7bedb9=null;if(_0x3a38bd){_0x7bedb9=_0x3a38bd[_0x8a8c('0x39')]===0x1?_0x3a38bd[0x0]:null;}if(_0x7bedb9||_0x3a38bd){var _0x24ddce=db[_0x45598c[_0x8a8c('0x75')]][_0x8a8c('0x31')];_0xc535b1['model']=_[_0x8a8c('0x34')](_0x24ddce);_0xc535b1[_0x8a8c('0x33')]=_[_0x8a8c('0x34')](_0x210285[_0x8a8c('0x33')]);_0xc535b1[_0x8a8c('0x35')]=_[_0x8a8c('0x37')](_0xc535b1['model'],_0xc535b1['query']);_0x40f838['attributes']=_[_0x8a8c('0x37')](_0xc535b1['model'],qs[_0x8a8c('0x38')](_0x210285['query'][_0x8a8c('0x38')]));_0x40f838[_0x8a8c('0x36')]=_0x40f838[_0x8a8c('0x36')]['length']?_0x40f838['attributes']:_0xc535b1[_0x8a8c('0x3a')];if(!_0x210285['query'][_0x8a8c('0x3b')](_0x8a8c('0x77'))){_0x40f838['limit']=qs[_0x8a8c('0x23')](_0x210285[_0x8a8c('0x33')][_0x8a8c('0x23')]);_0x40f838[_0x8a8c('0x22')]=qs[_0x8a8c('0x22')](_0x210285[_0x8a8c('0x33')]['offset']);}_0x40f838[_0x8a8c('0x78')]=qs[_0x8a8c('0x3c')](_0x210285[_0x8a8c('0x33')][_0x8a8c('0x3c')]);_0x40f838[_0x8a8c('0x3d')]=qs[_0x8a8c('0x35')](_[_0x8a8c('0x79')](_0x210285[_0x8a8c('0x33')],_0xc535b1['filters']));if(_0x210285['query'][_0x8a8c('0x40')]){_0x40f838[_0x8a8c('0x3d')]=_[_0x8a8c('0x41')](_0x40f838[_0x8a8c('0x3d')],{'$or':_['map'](_0x24ddce,function(_0x21dc46){if(_0x21dc46['type'][_0x8a8c('0x7a')]!==_0x8a8c('0x3f')){var _0x364ad0={};_0x364ad0[_0x21dc46[_0x8a8c('0x7b')]]={'$like':'%'+_0x210285[_0x8a8c('0x33')][_0x8a8c('0x40')]+'%'};return _0x364ad0;}})});}var _0x33ff52=[];if(_0x7bedb9){var _0x16e347=_['find'](_0x1bb45a,[_0x8a8c('0x2d'),_0x7bedb9['name']]);if(_0x16e347[_0x8a8c('0x7b')]){var _0x18320c={};if(_0x45598c['childModel']===_0x8a8c('0x7c')){_0x18320c[_0x16e347[_0x8a8c('0x7d')]]=_[_0x8a8c('0x2f')](_0x7bedb9['associatedResources'],'id');}else{_0x18320c[_0x16e347['foreignKey']]=_0x7bedb9[_0x8a8c('0x7e')];}_0x33ff52['push'](_0x18320c);}else{_0x40f838['where']['id']=_0x7bedb9[_0x8a8c('0x7e')];}}else{for(var _0x4537fb=0x0;_0x4537fb<_0x3a38bd[_0x8a8c('0x39')];_0x4537fb++){var _0x16e347=_[_0x8a8c('0x4a')](_0x1bb45a,[_0x8a8c('0x2d'),_0x3a38bd[_0x4537fb][_0x8a8c('0x2d')]]);if(_0x16e347[_0x8a8c('0x7b')]){var _0x18320c={};_0x18320c[_0x16e347[_0x8a8c('0x7d')]]=_0x3a38bd[_0x4537fb][_0x8a8c('0x7e')];_0x33ff52[_0x8a8c('0x5e')](_0x18320c);}else{if(!_0x40f838[_0x8a8c('0x3d')]['id'])_0x40f838[_0x8a8c('0x3d')]['id']=[];_0x3a38bd[_0x4537fb][_0x8a8c('0x7e')][_0x8a8c('0x65')](function(_0x2ce90b){_0x40f838[_0x8a8c('0x3d')]['id'][_0x8a8c('0x5e')](_0x2ce90b);});}}}if(!_['isEmpty'](_0x33ff52)){_0x40f838[_0x8a8c('0x3d')]=_[_0x8a8c('0x41')](_0x40f838['where'],{'$and':{'$or':_0x33ff52}});}_0x40f838=_['merge']({},_0x40f838,_0x210285['options']);if(_0x7bedb9&&!_0x7bedb9[_0x8a8c('0x54')]&&_0x45598c['childModel']===_0x8a8c('0x7c')){if(_0x210285['query'][_0x8a8c('0x49')]){_0x40f838['include']=[{'all':!![]}];}return db[_0x45598c[_0x8a8c('0x75')]][_0x8a8c('0x44')](_0x40f838)[_0x8a8c('0x2a')](function(_0x224665){var _0x3cfd45=[];_0x224665[_0x8a8c('0x65')](function(_0x32a43e){var _0x221f7d;switch(_0x32a43e[_0x8a8c('0x7f')]){case _0x8a8c('0x80'):_0x221f7d=_[_0x8a8c('0x4a')](_0x7bedb9[_0x8a8c('0x7e')],function(_0x1b4332){return _0x1b4332['id']===_0x32a43e[_0x8a8c('0x81')]&&_0x1b4332[_0x8a8c('0x3e')]==='DefaultReports';});break;case _0x8a8c('0x82'):_0x221f7d=_[_0x8a8c('0x4a')](_0x7bedb9['associatedResources'],function(_0x3cb15d){return _0x3cb15d['id']===_0x32a43e[_0x8a8c('0x81')]&&_0x3cb15d[_0x8a8c('0x3e')]===_0x8a8c('0x83');});break;}if(_0x221f7d)_0x3cfd45[_0x8a8c('0x5e')](_0x32a43e);});_0x10c23d[_0x8a8c('0x24')]=_0x3cfd45[_0x8a8c('0x39')];_0x10c23d[_0x8a8c('0x45')]=_0x3cfd45;return _0x10c23d;});}else{return db[_0x45598c[_0x8a8c('0x75')]][_0x8a8c('0x24')]({'where':_0x40f838['where']})[_0x8a8c('0x2a')](function(_0x2b735a){_0x10c23d[_0x8a8c('0x24')]=_0x2b735a;if(_0x210285['query'][_0x8a8c('0x49')]){if(_0x45598c['childModel']===_0x8a8c('0x84')){_0x40f838[_0x8a8c('0x43')]=[{'model':db[_0x8a8c('0x85')],'as':'Tags','attributes':['id',_0x8a8c('0x2d'),'color'],'required':_0x210285['query']['tag']?!![]:![]},{'model':db['Tag'],'as':_0x8a8c('0x86'),'attributes':['id','name',_0x8a8c('0x87')],'through':_0x210285[_0x8a8c('0x33')]['tag']?{'attributes':[],'where':{'TagId':_0x210285['query'][_0x8a8c('0x88')]||undefined}}:{},'required':_0x210285['query'][_0x8a8c('0x88')]?!![]:![]}];}else{_0x40f838[_0x8a8c('0x43')]=[{'all':!![]}];}}return db[_0x45598c[_0x8a8c('0x75')]]['findAll'](_0x40f838);})['then'](function(_0x4c9022){_0x10c23d[_0x8a8c('0x45')]=_0x4c9022;if(_0x5db22d===_0x8a8c('0x89')&&_0x210285['query'][_0x8a8c('0x8a')]===_0x8a8c('0x8b')){var _0x3797e3=[];for(var _0x1b7414=0x0;_0x1b7414<_0x10c23d[_0x8a8c('0x45')][_0x8a8c('0x39')];_0x1b7414++){_0x3797e3[_0x8a8c('0x5e')](getOpenTabs(_0x8a8c('0x8c'),_0x10c23d[_0x8a8c('0x45')][_0x1b7414][_0x8a8c('0x8d')]));_0x3797e3[_0x8a8c('0x5e')](getOpenTabs(_0x8a8c('0x8e'),_0x10c23d[_0x8a8c('0x45')][_0x1b7414][_0x8a8c('0x8d')]));_0x3797e3[_0x8a8c('0x5e')](getOpenTabs('fax',_0x10c23d[_0x8a8c('0x45')][_0x1b7414][_0x8a8c('0x8d')]));_0x3797e3['push'](getOpenTabs(_0x8a8c('0x8f'),_0x10c23d[_0x8a8c('0x45')][_0x1b7414][_0x8a8c('0x8d')]));_0x3797e3[_0x8a8c('0x5e')](getOpenTabs(_0x8a8c('0x90'),_0x10c23d[_0x8a8c('0x45')][_0x1b7414]['dataValues']));_0x3797e3[_0x8a8c('0x5e')](getOpenTabs('whatsapp',_0x10c23d[_0x8a8c('0x45')][_0x1b7414][_0x8a8c('0x8d')]));}return Promise[_0x8a8c('0x76')](_0x3797e3)['then'](function(){return _0x10c23d;});}return _0x10c23d;});}}else{return _0x10c23d;}})[_0x8a8c('0x2a')](respondWithFilteredResult(_0x2c9de8,_0x40f838))[_0x8a8c('0x46')](handleError(_0x2c9de8,null));};function getOpenTabs(_0x304859,_0x4bac1e){var _0x1d3931=_0x304859[_0x8a8c('0x91')](0x0)[_0x8a8c('0x92')]()+_0x304859[_0x8a8c('0x93')](0x1);var _0x37bb68={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};return new BPromise(function(_0x48bbef,_0x219f86){var _0x3c9729=squel[_0x8a8c('0x94')]()[_0x8a8c('0x7b')](_0x8a8c('0x95')+_0x1d3931+_0x8a8c('0x96'),'id')['field']('ui.createdAt')[_0x8a8c('0x97')](_0x8a8c('0x98')+_0x304859+'_interactions','ui')[_0x8a8c('0x3d')](_0x8a8c('0x99'),_0x4bac1e['id']);return db[_0x8a8c('0x52')]['query'](_0x3c9729[_0x8a8c('0x9a')](),_0x37bb68)[_0x8a8c('0x2a')](function(_0x234e68){_0x4bac1e[_0x1d3931+_0x8a8c('0x9b')]=_0x234e68;_0x48bbef(_0x234e68);})['catch'](function(_0x20967a){_0x219f86(_0x20967a);});});}function getAllResources(_0x17fd44,_0x5d11cc){return new BPromise(function(_0x5af528,_0x3dd1d3){if(_0x5d11cc){var _0x1c2195=_0x5d11cc[_0x8a8c('0x40')]?{[_0x5d11cc[_0x8a8c('0x40')][_0x8a8c('0x7b')]]:_0x5d11cc[_0x8a8c('0x40')][_0x8a8c('0x9c')]}:undefined;return db[_0x17fd44]['findAll']({'where':_0x1c2195,'raw':!![]})[_0x8a8c('0x2a')](function(_0xef03e6){_0x5d11cc[_0x8a8c('0x7e')]=_[_0x8a8c('0x2f')](_0xef03e6,'id');_0x5af528(_0x5d11cc);})[_0x8a8c('0x46')](function(_0x3d3bce){_0x3dd1d3(_0x3d3bce);});}else{_0x5af528(null);}});}function getAllFilteredResources(_0xa098e9,_0x27d0ae){return new BPromise(function(_0x36b226,_0x5b3ff8){var _0xa249d7=_0xa098e9['filter']?{[_0xa098e9['filter'][_0x8a8c('0x7b')]]:_0xa098e9[_0x8a8c('0x40')][_0x8a8c('0x9c')]}:undefined;return db[_0xa098e9[_0x8a8c('0x3a')]][_0x8a8c('0x44')]({'where':_0xa249d7,'raw':!![]})[_0x8a8c('0x2a')](function(_0x1d2b80){_0x27d0ae[_0x8a8c('0x7e')]=_[_0x8a8c('0x2f')](_0x1d2b80,function(_0x2707fb){return _0xa098e9[_0x8a8c('0x7b')]?_0x2707fb[_0xa098e9[_0x8a8c('0x7b')]]:_0x2707fb[_0x8a8c('0x2d')];});_0x36b226(_0x27d0ae);})[_0x8a8c('0x46')](function(_0x1659f6){_0x5b3ff8(_0x1659f6);});});}function getAllowedResources(_0x47f26b,_0x2b5975,_0x52af37){return new BPromise(function(_0xc2e73d,_0x20c7f1){if(_0x2b5975){return db[_0x8a8c('0x57')][_0x8a8c('0x44')]({'where':{'sectionId':_0x2b5975['id']},'raw':!![]})[_0x8a8c('0x2a')](function(_0x46083){if(_0x47f26b['field']&&_0x47f26b[_0x8a8c('0x7b')]!=='id'){_0x2b5975[_0x8a8c('0x7e')]=_[_0x8a8c('0x2f')](_0x46083,function(_0x2bfa13){return _0x2bfa13[_0x47f26b[_0x8a8c('0x7b')]];});}else{if(_0x52af37===_0x8a8c('0x7c')){_0x2b5975['associatedResources']=_[_0x8a8c('0x2f')](_0x46083,function(_0x2f18ce){return{'id':_0x2f18ce[_0x8a8c('0x66')],'type':_0x2f18ce[_0x8a8c('0x3e')]};});}else{_0x2b5975[_0x8a8c('0x7e')]=_[_0x8a8c('0x2f')](_0x46083,function(_0x1c4b8d){return _0x1c4b8d['resourceId'];});}}_0xc2e73d(_0x2b5975);})[_0x8a8c('0x46')](function(_0x333848){_0x20c7f1(_0x333848);});}else{_0xc2e73d(null);}});}function getQueryModels(_0x3dad95,_0x2fef61){var _0x5a6c47=_0x3dad95[_0x8a8c('0x9d')]();var _0x4871c2={'childModel':undefined,'parentSections':[]};switch(_0x5a6c47){case _0x8a8c('0x9e'):_0x4871c2['childModel']=_0x8a8c('0x9f');break;case _0x8a8c('0xa0'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0xa1');break;case _0x8a8c('0xa2'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0xa3');_0x4871c2[_0x8a8c('0x72')]=[{'name':_0x8a8c('0xa4'),'field':'name','foreignKey':_0x8a8c('0xa5')}];break;case _0x8a8c('0xa6'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0xa7');break;case _0x8a8c('0xa8'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0x84');_0x4871c2[_0x8a8c('0x72')]=[{'name':_0x8a8c('0xa9'),'field':'id','foreignKey':_0x8a8c('0xaa')}];break;case _0x8a8c('0xab'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0xac');break;case _0x8a8c('0xad'):_0x4871c2['childModel']='CmCompany';break;case _0x8a8c('0xae'):_0x4871c2['childModel']=_0x8a8c('0xaf');break;case _0x8a8c('0xb0'):_0x4871c2['childModel']=_0x8a8c('0xb1');break;case _0x8a8c('0xb2'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0xb3');break;case _0x8a8c('0xb4'):_0x4871c2[_0x8a8c('0x75')]='FaxQueue';break;case _0x8a8c('0xb5'):_0x4871c2[_0x8a8c('0x75')]='FaxAccount';break;case _0x8a8c('0xb6'):case _0x8a8c('0xb7'):case _0x8a8c('0xb8'):_0x4871c2[_0x8a8c('0x75')]='VoiceExtension';break;case _0x8a8c('0xb9'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0xba');break;case'voicemails':_0x4871c2[_0x8a8c('0x75')]='VoiceMail';break;case _0x8a8c('0xbb'):_0x4871c2['childModel']=_0x8a8c('0xbc');_0x4871c2[_0x8a8c('0x72')]=[{'name':_0x8a8c('0x89'),'field':'name','foreignKey':_0x8a8c('0xbd'),'model':_0x8a8c('0xbe'),'filter':{'field':'role','value':[_0x8a8c('0xbf')]}},{'name':_0x8a8c('0xc0'),'field':_0x8a8c('0x2d'),'foreignKey':_0x8a8c('0xbd'),'model':_0x8a8c('0xbe'),'filter':{'field':'role','value':[_0x8a8c('0xc1')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0x8a8c('0xc2'),'model':_0x8a8c('0xc3'),'filter':{'field':_0x8a8c('0x3e'),'value':[_0x8a8c('0xc4')]}},{'name':_0x8a8c('0xc5'),'field':_0x8a8c('0x2d'),'foreignKey':_0x8a8c('0xc2'),'model':_0x8a8c('0xc3'),'filter':{'field':_0x8a8c('0x3e'),'value':[_0x8a8c('0xc6')]}}];break;case _0x8a8c('0xc7'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0xc8');break;case _0x8a8c('0xc9'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0xca');break;case _0x8a8c('0xcb'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0xcc');break;case'ivrcampaigns':_0x4871c2['childModel']='Campaign';break;case _0x8a8c('0xcd'):_0x4871c2[_0x8a8c('0x75')]='MailQueue';break;case'mailaccounts':_0x4871c2[_0x8a8c('0x75')]='MailAccount';break;case _0x8a8c('0xce'):_0x4871c2['childModel']='MailSubstatus';break;case'openchannelqueues':_0x4871c2['childModel']=_0x8a8c('0xcf');break;case _0x8a8c('0xd0'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0xd1');break;case _0x8a8c('0xd2'):_0x4871c2[_0x8a8c('0x75')]='SmsQueue';break;case _0x8a8c('0xd3'):_0x4871c2['childModel']=_0x8a8c('0xd4');break;case _0x8a8c('0xd5'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0xd6');break;case'teams':_0x4871c2[_0x8a8c('0x75')]='Team';break;case _0x8a8c('0xd7'):case'queuecampaigns':_0x4871c2['childModel']='VoiceQueue';if(_0x2fef61){_0x4871c2['parentSections']=[{'name':_0x8a8c('0xd8')},{'name':_0x8a8c('0xc5')}];}break;case _0x8a8c('0xd9'):case _0x8a8c('0xda'):case _0x8a8c('0xdb'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0xbe');if(_0x2fef61){_0x4871c2[_0x8a8c('0x72')]=[{'name':'Users','filter':{'field':'role','value':[_0x8a8c('0xdc'),_0x8a8c('0xdd')]},'ignore':!![]},{'name':_0x8a8c('0x89')},{'name':_0x8a8c('0xc0')}];}break;case _0x8a8c('0xde'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0xdf');break;case _0x8a8c('0xe0'):_0x4871c2['childModel']=_0x8a8c('0xe1');break;case _0x8a8c('0xe2'):_0x4871c2['childModel']=_0x8a8c('0xe3');break;case'sugarcrmaccounts':_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0xe4');break;case _0x8a8c('0xe5'):_0x4871c2[_0x8a8c('0x75')]='DeskAccount';break;case _0x8a8c('0xe6'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0xe7');break;case _0x8a8c('0xe8'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0xbe');break;case _0x8a8c('0xe9'):_0x4871c2['childModel']=_0x8a8c('0xea');break;case _0x8a8c('0xeb'):_0x4871c2[_0x8a8c('0x75')]='Disposition';break;case _0x8a8c('0xec'):_0x4871c2['childModel']='Dashboard';break;case _0x8a8c('0xed'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0xee');break;case _0x8a8c('0xef'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0xf0');break;case _0x8a8c('0xf1'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0xf2');break;case _0x8a8c('0xf3'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0xf4');break;case _0x8a8c('0xf5'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0x85');break;case _0x8a8c('0xf6'):_0x4871c2[_0x8a8c('0x75')]='Template';break;case _0x8a8c('0xf7'):_0x4871c2['childModel']=_0x8a8c('0xf8');break;case _0x8a8c('0xf9'):_0x4871c2[_0x8a8c('0x75')]='Trunk';break;case'variables':_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0xfa');break;case _0x8a8c('0xfb'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0x67');break;case _0x8a8c('0xfc'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0x7c');_0x4871c2['parentSections']=[{'name':_0x8a8c('0xfd'),'field':'id','foreignKey':_0x8a8c('0x81')}];break;case _0x8a8c('0xfe'):_0x4871c2['childModel']=_0x8a8c('0xff');break;case _0x8a8c('0x100'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0x101');break;case _0x8a8c('0x102'):_0x4871c2[_0x8a8c('0x75')]=_0x8a8c('0x103');_0x4871c2[_0x8a8c('0x72')]=[{'name':_0x8a8c('0x89'),'field':'id','foreignKey':_0x8a8c('0x104'),'model':'User','filter':{'field':_0x8a8c('0x105'),'value':['agent']}},{'name':_0x8a8c('0xc0'),'field':'id','foreignKey':_0x8a8c('0x104'),'model':_0x8a8c('0xbe'),'filter':{'field':'role','value':[_0x8a8c('0xc1')]}}];break;default:return _0x4871c2;}return _0x4871c2;} \ No newline at end of file +var _0x8013=['SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','Team','voicequeues','queuecampaigns','VoiceQueue','agents','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','Disposition','customdashboards','intervals','Interval','Pause','scheduler','Schedule','sounds','Sound','tags','templates','Template','triggers','trunks','Trunk','Variable','plugins','extractedreports','Reports','metrics','whatsappaccounts','WhatsappAccount','screenrecordings','UserId','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','UserProfile','includeAll','rows','catch','create','body','clone','params','include','find','omit','updatedAt','crudPermissions','createdAt','transaction','UserProfileSection','findAll','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','describe','addSections','sequelize','push','get','getSections','enabled','includes','subsections','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','ids','getResources','Sequelize','mergeResources','ValidationError','all','ignore','isEmpty','union','childModel','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','Agents','openTabs','true','chat','sms','dataValues','fax','mail','toUpperCase','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','toString','OpenTabs','value','SquareProject','odbc','SquareRecording','parentSections','SquareProjects','projectName','contacts','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues'];(function(_0x56196c,_0x55bf95){var _0x33d519=function(_0x377501){while(--_0x377501){_0x56196c['push'](_0x56196c['shift']());}};_0x33d519(++_0x55bf95);}(_0x8013,0x12e));var _0x3801=function(_0x1c9f10,_0x4b3783){_0x1c9f10=_0x1c9f10-0x0;var _0x4e2c1e=_0x8013[_0x1c9f10];return _0x4e2c1e;};'use strict';var emlformat=require(_0x3801('0x0'));var rimraf=require(_0x3801('0x1'));var zipdir=require(_0x3801('0x2'));var jsonpatch=require(_0x3801('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3801('0x4'));var Mustache=require(_0x3801('0x5'));var util=require('util');var path=require(_0x3801('0x6'));var sox=require(_0x3801('0x7'));var csv=require(_0x3801('0x8'));var ejs=require(_0x3801('0x9'));var fs=require('fs');var fs_extra=require(_0x3801('0xa'));var _=require(_0x3801('0xb'));var squel=require(_0x3801('0xc'));var crypto=require('crypto');var jsforce=require(_0x3801('0xd'));var deskjs=require(_0x3801('0xe'));var toCsv=require(_0x3801('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3801('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3801('0x10'));var logger=require(_0x3801('0x11'))('api');var utils=require(_0x3801('0x12'));var config=require(_0x3801('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3801('0x14'))['db'];config[_0x3801('0x15')]=_[_0x3801('0x16')](config['redis'],{'host':_0x3801('0x17'),'port':0x18eb});var socket=require(_0x3801('0x18'))(new Redis(config[_0x3801('0x15')]));require(_0x3801('0x19'))[_0x3801('0x1a')](socket);function respondWithStatusCode(_0x4ad5c3,_0x13cabe){_0x13cabe=_0x13cabe||0xcc;return function(_0x2749dd){if(_0x2749dd){return _0x4ad5c3[_0x3801('0x1b')](_0x13cabe);}return _0x4ad5c3[_0x3801('0x1c')](_0x13cabe)[_0x3801('0x1d')]();};}function respondWithResult(_0x2cc143,_0x150552){_0x150552=_0x150552||0xc8;return function(_0x297c20){if(_0x297c20){return _0x2cc143[_0x3801('0x1c')](_0x150552)[_0x3801('0x1e')](_0x297c20);}};}function respondWithFilteredResult(_0x28ca07,_0x5d82e7){return function(_0x323dce){if(_0x323dce){var _0x32b63b=typeof _0x5d82e7[_0x3801('0x1f')]==='undefined'&&typeof _0x5d82e7[_0x3801('0x20')]===_0x3801('0x21');var _0x74a53b=_0x323dce['count'];var _0x494bc7=_0x32b63b?0x0:_0x5d82e7[_0x3801('0x1f')];var _0x5bf645=_0x32b63b?_0x323dce[_0x3801('0x22')]:_0x5d82e7['offset']+_0x5d82e7[_0x3801('0x20')];var _0x416ed0;if(_0x5bf645>=_0x74a53b){_0x5bf645=_0x74a53b;_0x416ed0=0xc8;}else{_0x416ed0=0xce;}_0x28ca07['status'](_0x416ed0);return _0x28ca07[_0x3801('0x23')](_0x3801('0x24'),_0x494bc7+'-'+_0x5bf645+'/'+_0x74a53b)[_0x3801('0x1e')](_0x323dce);}return null;};}function patchUpdates(_0x17a921){return function(_0x29fecf){try{jsonpatch['apply'](_0x29fecf,_0x17a921,!![]);}catch(_0x4b5b2d){return BPromise[_0x3801('0x25')](_0x4b5b2d);}return _0x29fecf[_0x3801('0x26')]();};}function saveUpdates(_0x4b338a,_0x83c478){return function(_0x5b972f){if(_0x5b972f){return _0x5b972f[_0x3801('0x27')](_0x4b338a)[_0x3801('0x28')](function(_0x10c015){return _0x10c015;});}return null;};}function removeEntity(_0x477e45,_0x46417a){return function(_0x59660c){if(_0x59660c){return _0x59660c[_0x3801('0x29')]()[_0x3801('0x28')](function(){_0x477e45[_0x3801('0x1c')](0xcc)[_0x3801('0x1d')]();});}};}function handleEntityNotFound(_0x568d1b,_0x1eba5f){return function(_0x50c010){if(!_0x50c010){_0x568d1b[_0x3801('0x1b')](0x194);}return _0x50c010;};}function handleError(_0x43ad73,_0x22aa00){_0x22aa00=_0x22aa00||0x1f4;return function(_0x5750ad){logger[_0x3801('0x2a')](_0x5750ad[_0x3801('0x2b')]);if(_0x5750ad[_0x3801('0x2c')]){delete _0x5750ad[_0x3801('0x2c')];}_0x43ad73[_0x3801('0x1c')](_0x22aa00)['send'](_0x5750ad);};}exports[_0x3801('0x2d')]=function(_0x58533a,_0xca4f57){var _0x828e14={},_0x590e47={},_0xf569a3={'count':0x0,'rows':[]};var _0xc1be93=_[_0x3801('0x2e')](db['UserProfile'][_0x3801('0x2f')],function(_0x42128c){return{'name':_0x42128c[_0x3801('0x30')],'type':_0x42128c['type'][_0x3801('0x31')]};});_0x590e47[_0x3801('0x32')]=_['map'](_0xc1be93,_0x3801('0x2c'));_0x590e47[_0x3801('0x33')]=_[_0x3801('0x34')](_0x58533a[_0x3801('0x33')]);_0x590e47[_0x3801('0x35')]=_['intersection'](_0x590e47[_0x3801('0x32')],_0x590e47[_0x3801('0x33')]);_0x828e14[_0x3801('0x36')]=_[_0x3801('0x37')](_0x590e47['model'],qs[_0x3801('0x38')](_0x58533a[_0x3801('0x33')][_0x3801('0x38')]));_0x828e14[_0x3801('0x36')]=_0x828e14[_0x3801('0x36')][_0x3801('0x39')]?_0x828e14[_0x3801('0x36')]:_0x590e47[_0x3801('0x32')];if(!_0x58533a[_0x3801('0x33')][_0x3801('0x3a')](_0x3801('0x3b'))){_0x828e14['limit']=qs[_0x3801('0x20')](_0x58533a['query'][_0x3801('0x20')]);_0x828e14[_0x3801('0x1f')]=qs['offset'](_0x58533a[_0x3801('0x33')][_0x3801('0x1f')]);}_0x828e14[_0x3801('0x3c')]=qs[_0x3801('0x3d')](_0x58533a['query'][_0x3801('0x3d')]);_0x828e14[_0x3801('0x3e')]=qs[_0x3801('0x35')](_[_0x3801('0x3f')](_0x58533a[_0x3801('0x33')],_0x590e47[_0x3801('0x35')]),_0xc1be93);if(_0x58533a[_0x3801('0x33')]['filter']){_0x828e14[_0x3801('0x3e')]=_[_0x3801('0x40')](_0x828e14[_0x3801('0x3e')],{'$or':_[_0x3801('0x2e')](_0xc1be93,function(_0x3cb339){if(_0x3cb339[_0x3801('0x41')]!==_0x3801('0x42')){var _0x56b080={};_0x56b080[_0x3cb339[_0x3801('0x2c')]]={'$like':'%'+_0x58533a[_0x3801('0x33')][_0x3801('0x43')]+'%'};return _0x56b080;}})});}_0x828e14=_[_0x3801('0x40')]({},_0x828e14,_0x58533a[_0x3801('0x44')]);var _0x3f085d={'where':_0x828e14[_0x3801('0x3e')]};return db[_0x3801('0x45')][_0x3801('0x22')](_0x3f085d)[_0x3801('0x28')](function(_0x14efe3){_0xf569a3[_0x3801('0x22')]=_0x14efe3;if(_0x58533a[_0x3801('0x33')][_0x3801('0x46')]){_0x828e14['include']=[{'all':!![]}];}return db[_0x3801('0x45')]['findAll'](_0x828e14);})['then'](function(_0x38ddeb){_0xf569a3[_0x3801('0x47')]=_0x38ddeb;return _0xf569a3;})['then'](respondWithFilteredResult(_0xca4f57,_0x828e14))[_0x3801('0x48')](handleError(_0xca4f57,null));};exports['show']=function(_0x536f8a,_0x5abdb2){var _0x42fe7c={'raw':![],'where':{'id':_0x536f8a['params']['id']}},_0x40e798={};_0x40e798[_0x3801('0x32')]=_[_0x3801('0x34')](db[_0x3801('0x45')][_0x3801('0x2f')]);_0x40e798[_0x3801('0x33')]=_[_0x3801('0x34')](_0x536f8a[_0x3801('0x33')]);_0x40e798['filters']=_[_0x3801('0x37')](_0x40e798[_0x3801('0x32')],_0x40e798[_0x3801('0x33')]);_0x42fe7c[_0x3801('0x36')]=_['intersection'](_0x40e798[_0x3801('0x32')],qs[_0x3801('0x38')](_0x536f8a[_0x3801('0x33')][_0x3801('0x38')]));_0x42fe7c['attributes']=_0x42fe7c[_0x3801('0x36')]['length']?_0x42fe7c[_0x3801('0x36')]:_0x40e798[_0x3801('0x32')];if(_0x536f8a[_0x3801('0x33')][_0x3801('0x46')]){_0x42fe7c['include']=[{'all':!![]}];}_0x42fe7c=_[_0x3801('0x40')]({},_0x42fe7c,_0x536f8a[_0x3801('0x44')]);return db[_0x3801('0x45')]['find'](_0x42fe7c)['then'](handleEntityNotFound(_0x5abdb2,null))[_0x3801('0x28')](respondWithResult(_0x5abdb2,null))[_0x3801('0x48')](handleError(_0x5abdb2,null));};exports['create']=function(_0x388b6a,_0x2e058d){return db[_0x3801('0x45')][_0x3801('0x49')](_0x388b6a[_0x3801('0x4a')],{})[_0x3801('0x28')](respondWithResult(_0x2e058d,0xc9))[_0x3801('0x48')](handleError(_0x2e058d,null));};exports[_0x3801('0x4b')]=function(_0xcc047c,_0x34402b){var _0x2bb0fc={'where':{'id':_0xcc047c[_0x3801('0x4c')]['id']}},_0x2e355b={};_0x2e355b[_0x3801('0x32')]=_['keys'](db[_0x3801('0x45')][_0x3801('0x2f')]);_0x2bb0fc[_0x3801('0x36')]=_[_0x3801('0x37')](_0x2e355b['model'],qs[_0x3801('0x38')](_0xcc047c[_0x3801('0x33')][_0x3801('0x38')]));_0x2bb0fc[_0x3801('0x36')]=_0x2bb0fc[_0x3801('0x36')][_0x3801('0x39')]?_0x2bb0fc[_0x3801('0x36')]:_0x2e355b['model'];if(_0xcc047c['query']['includeAll']){_0x2bb0fc[_0x3801('0x4d')]=[{'all':!![]}];}_0x2bb0fc=_[_0x3801('0x40')]({},_0x2bb0fc,_0xcc047c[_0x3801('0x44')]);return db[_0x3801('0x45')][_0x3801('0x4e')](_0x2bb0fc)[_0x3801('0x28')](handleEntityNotFound(_0x34402b,null))[_0x3801('0x28')](function(_0x316f3e){if(_0x316f3e){var _0xa8cb9=_0x316f3e['get']({'plain':!![]});_0xa8cb9=qs[_0x3801('0x4f')](_0xa8cb9,['id','createdAt',_0x3801('0x50'),_0x3801('0x51')]);_0xcc047c[_0x3801('0x4a')]=_[_0x3801('0x4f')](_0xcc047c[_0x3801('0x4a')],['id',_0x3801('0x52'),_0x3801('0x50')]);return db['sequelize'][_0x3801('0x53')](function(_0x1e8340){return db[_0x3801('0x45')]['create'](_[_0x3801('0x40')](_0xa8cb9,_0xcc047c[_0x3801('0x4a')]),{'include':_0xcc047c['query'][_0x3801('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x1e8340})[_0x3801('0x28')](function(_0x2d1d81){var _0x1a79d3=_0x2d1d81['get']({'plain':!![]});return db[_0x3801('0x54')][_0x3801('0x55')]({'where':{'userProfileId':_0xcc047c[_0x3801('0x4c')]['id']},'raw':!![]})[_0x3801('0x28')](function(_0x3618ea){if(_0x3618ea){return BPromise[_0x3801('0x56')](_0x3618ea,function(_0x47d339){return new BPromise(function(_0x34a9da,_0x3fb1a0){if(_0x47d339['autoAssociation']===null||_0x47d339[_0x3801('0x57')]===0x1)_0x34a9da(null);return db['UserProfileResource'][_0x3801('0x55')]({'where':{'sectionId':_0x47d339['id']},'raw':!![]})[_0x3801('0x28')](function(_0x5343da){var _0x54954a=_[_0x3801('0x2e')](_0x5343da,function(_0x5158be){return qs[_0x3801('0x4f')](_0x5158be,['id',_0x3801('0x52'),_0x3801('0x50'),_0x3801('0x58')]);});_0x34a9da(_0x54954a);})[_0x3801('0x48')](function(_0xb8f412){_0x3fb1a0(_0xb8f412);});})[_0x3801('0x28')](function(_0x5b0154){var _0x1c9e6b=qs[_0x3801('0x4f')](_0x47d339,['id',_0x3801('0x52'),_0x3801('0x50')]);_0x1c9e6b[_0x3801('0x59')]=_0x1a79d3['id'];if(_0x5b0154)_0x1c9e6b[_0x3801('0x5a')]=_0x5b0154;return _0x1c9e6b;})[_0x3801('0x28')](function(_0x1819dc){return db[_0x3801('0x54')][_0x3801('0x49')](_0x1819dc,{'include':[{'model':db[_0x3801('0x5b')],'as':'Resources'}],'raw':!![],'transaction':_0x1e8340});});})['then'](function(){return _0x1a79d3;});}});});});}})['then'](respondWithResult(_0x34402b,0xc9))[_0x3801('0x48')](handleError(_0x34402b,null));};exports['update']=function(_0xa8d65a,_0x401ddc){if(_0xa8d65a[_0x3801('0x4a')]['id']){delete _0xa8d65a[_0x3801('0x4a')]['id'];}return db[_0x3801('0x45')]['find']({'where':{'id':_0xa8d65a['params']['id']}})[_0x3801('0x28')](handleEntityNotFound(_0x401ddc,null))[_0x3801('0x28')](saveUpdates(_0xa8d65a['body'],null))[_0x3801('0x28')](respondWithResult(_0x401ddc,null))[_0x3801('0x48')](handleError(_0x401ddc,null));};exports['destroy']=function(_0x196602,_0x26ba9b){return db[_0x3801('0x45')][_0x3801('0x4e')]({'where':{'id':_0x196602[_0x3801('0x4c')]['id']}})[_0x3801('0x28')](handleEntityNotFound(_0x26ba9b,null))[_0x3801('0x28')](removeEntity(_0x26ba9b,null))[_0x3801('0x48')](handleError(_0x26ba9b,null));};exports[_0x3801('0x5c')]=function(_0x287384,_0x535028){return db['UserProfile'][_0x3801('0x5c')]()[_0x3801('0x28')](respondWithResult(_0x535028,null))[_0x3801('0x48')](handleError(_0x535028,null));};exports[_0x3801('0x5d')]=function(_0x3c7916,_0x3d6ce3){var _0x22c2c6=_0x3c7916[_0x3801('0x4a')];return db[_0x3801('0x45')]['find']({'where':{'id':_0x3c7916['params']['id']}})[_0x3801('0x28')](handleEntityNotFound(_0x3d6ce3,null))[_0x3801('0x28')](function(_0x2ecbab){if(_0x2ecbab){return db[_0x3801('0x5e')]['transaction'](function(_0x2403d6){return db[_0x3801('0x54')][_0x3801('0x29')]({'where':{'userProfileId':_0x3c7916['params']['id'],'sectionId':_[_0x3801('0x2e')](_0x22c2c6,function(_0x30ac99){return _0x30ac99['sectionId'];})},'transaction':_0x2403d6})['then'](function(){var _0x1e393c=_[_0x3801('0x2e')](_0x22c2c6,function(_0x18fbc6){_0x18fbc6['userProfileId']=_0x3c7916[_0x3801('0x4c')]['id'];return _0x18fbc6;});var _0x1edb61=[];return BPromise[_0x3801('0x56')](_0x1e393c,function(_0x4744aa){return db[_0x3801('0x54')][_0x3801('0x49')](_0x4744aa,{'include':[{'model':db[_0x3801('0x5b')],'as':_0x3801('0x5a')}],'raw':!![],'transaction':_0x2403d6})[_0x3801('0x28')](function(_0x31f678){_0x1edb61[_0x3801('0x5f')](_0x31f678[_0x3801('0x60')]({'plain':!![]}));});})[_0x3801('0x28')](function(){return _0x1edb61;});});});}})[_0x3801('0x28')](function(_0x463a60){return _0x463a60;})['then'](respondWithResult(_0x3d6ce3,null))[_0x3801('0x48')](handleError(_0x3d6ce3,null));};exports['removeSections']=function(_0x795418,_0x510f17){var _0x3b7eed;return db[_0x3801('0x45')][_0x3801('0x4e')]({'where':{'id':_0x795418[_0x3801('0x4c')]['id']},'attributes':['id',_0x3801('0x2c')]})[_0x3801('0x28')](handleEntityNotFound(_0x510f17,null))[_0x3801('0x28')](function(_0x12629b){if(_0x12629b){_0x3b7eed=_0x12629b;return db['UserProfileSection'][_0x3801('0x29')]({'where':{'userProfileId':_0x795418['params']['id'],'sectionId':_0x795418['query']['ids']}});}})[_0x3801('0x28')](function(){return _0x3b7eed;})[_0x3801('0x28')](respondWithStatusCode(_0x510f17,null))[_0x3801('0x48')](handleError(_0x510f17,null));};exports[_0x3801('0x61')]=function(_0x5c9c35,_0x44ba3b){var _0x19eb48=[];var _0x4d93ce=[];return db[_0x3801('0x54')][_0x3801('0x55')]({'where':{'userProfileId':_0x5c9c35[_0x3801('0x4c')]['id']},'raw':!![]})[_0x3801('0x28')](function(_0x4ec947){_0x19eb48=_[_0x3801('0x43')](_0x4ec947,function(_0x20dce6){return _0x20dce6[_0x3801('0x62')]===0x1||_[_0x3801('0x63')]([0x3eb,0x709],_0x20dce6[_0x3801('0x58')]);});if(!_['isEmpty'](_0x19eb48)){return _[_0x3801('0x2e')](_0x19eb48,function(_0x4fd277){return _0x4fd277[_0x3801('0x58')];});}else{return;}})['then'](function(_0x20e7dd){if(_0x20e7dd)_0x4d93ce=_0x20e7dd;if(_[_0x3801('0x63')](_0x4d93ce,0x64)){var _0x576c44=_[_0x3801('0x4e')](_0x19eb48,{'sectionId':0x64});return hasDefaultDashboard(_0x576c44)[_0x3801('0x28')](function(_0x29d2f9){return _[_0x3801('0x2e')](_0x19eb48,function(_0x593e87){if(_0x593e87[_0x3801('0x58')]===0x64){_0x593e87[_0x3801('0x64')]=_0x29d2f9;}return _0x593e87;});});}else{return;}})[_0x3801('0x28')](function(_0x52b14a){if(_0x52b14a)_0x19eb48=_0x52b14a;if(_[_0x3801('0x63')](_0x4d93ce,0x3eb)){var _0x5e76d3=_[_0x3801('0x4e')](_0x19eb48,{'sectionId':0x3eb});return getCustomDashboards(_0x5e76d3)['then'](function(_0x11e575){return _[_0x3801('0x2e')](_0x19eb48,function(_0x4f1df0){if(_0x5e76d3[_0x3801('0x62')]){if(_0x4f1df0[_0x3801('0x58')]===0x3eb){_0x4f1df0[_0x3801('0x64')]=_0x11e575;}}else{if(_0x4f1df0['sectionId']===0x64){_0x4f1df0[_0x3801('0x64')]=_0x11e575;}}return _0x4f1df0;});});}else{return;}})[_0x3801('0x28')](function(_0x2d10db){if(_0x2d10db)_0x19eb48=_0x2d10db;if(_[_0x3801('0x63')](_0x4d93ce,0x709)){var _0x37a383=_['find'](_0x19eb48,{'sectionId':0x709});return getPlugins(_0x37a383)[_0x3801('0x28')](function(_0x573309){if(_0x37a383[_0x3801('0x62')]){return _[_0x3801('0x2e')](_0x19eb48,function(_0x19af5f){if(_0x19af5f[_0x3801('0x58')]===0x709){_0x19af5f[_0x3801('0x64')]=_0x573309;}return _0x19af5f;});}else{var _0x2a1a46={'sectionId':0x76c,'enabled':0x1,'subsections':_0x573309};var _0x580b97=_[_0x3801('0x2e')](_0x19eb48);_0x580b97[_0x3801('0x5f')](_0x2a1a46);return _0x580b97;}});}else{return;}})[_0x3801('0x28')](function(_0x2db815){if(_0x2db815)_0x19eb48=_0x2db815;return _[_0x3801('0x43')](_0x19eb48,[_0x3801('0x62'),0x1]);})[_0x3801('0x28')](respondWithResult(_0x44ba3b,null))['catch'](handleError(_0x44ba3b,null));};function hasDefaultDashboard(_0x39afaf){var _0x850269=[0x65];return new BPromise(function(_0x4b5660,_0x4b459a){try{if(_0x39afaf[_0x3801('0x57')]){_0x4b5660(_0x850269);}else{return db['UserProfileResource'][_0x3801('0x65')]({'where':{'sectionId':_0x39afaf['id']},'raw':!![]})[_0x3801('0x28')](function(_0x9d920c){_0x9d920c?_0x4b5660(_0x850269):_0x4b5660();});}}catch(_0x297a61){_0x4b459a(_0x297a61);}});}function getCustomDashboards(_0x1b7745){var _0x5269d3=[];return new BPromise(function(_0x45511c,_0xf5b816){try{if(_0x1b7745[_0x3801('0x57')]){return db[_0x3801('0x66')]['findAll']({'raw':!![]})[_0x3801('0x28')](function(_0x1f6c2c){_0x1f6c2c[_0x3801('0x67')](function(_0x26b5aa){_0x5269d3[_0x3801('0x5f')](_0x26b5aa['id']+0x1869f);});_0x45511c(_0x5269d3);});}else{return db['UserProfileResource'][_0x3801('0x55')]({'where':{'sectionId':_0x1b7745['id']},'raw':!![]})[_0x3801('0x28')](function(_0x359e24){_0x359e24[_0x3801('0x67')](function(_0x545c36){_0x5269d3[_0x3801('0x5f')](_0x545c36[_0x3801('0x68')]+0x1869f);});_0x45511c(_0x5269d3);});}}catch(_0x2047fd){_0xf5b816(_0x2047fd);}});}function getPlugins(_0x36f0d0){var _0x213054=[];return new BPromise(function(_0x286552,_0x1a5125){try{if(_0x36f0d0[_0x3801('0x57')]){return db['Plugin'][_0x3801('0x55')]({'raw':!![]})['then'](function(_0x2ce2bf){_0x2ce2bf[_0x3801('0x67')](function(_0x4119b0){_0x213054['push'](_0x4119b0['id']+0x15b38);});_0x286552(_0x213054);});}else{return db[_0x3801('0x5b')]['findAll']({'where':{'sectionId':_0x36f0d0['id']},'raw':!![]})['then'](function(_0x3f757a){_0x3f757a[_0x3801('0x67')](function(_0x3b6ad0){_0x213054[_0x3801('0x5f')](_0x3b6ad0[_0x3801('0x68')]+0x15b38);});_0x286552(_0x213054);});}}catch(_0x19f3a4){_0x1a5125(_0x19f3a4);}});}exports[_0x3801('0x69')]=function(_0x1a381c,_0x3590ab){return db[_0x3801('0x45')][_0x3801('0x4e')]({'where':{'id':_0x1a381c[_0x3801('0x4c')]['id']}})[_0x3801('0x28')](handleEntityNotFound(_0x3590ab,null))[_0x3801('0x28')](function(_0x5c1eeb){if(_0x5c1eeb){return db[_0x3801('0x5e')][_0x3801('0x53')](function(_0x407fd8){return db[_0x3801('0x54')][_0x3801('0x55')]({'where':{'userProfileId':_0x1a381c[_0x3801('0x4c')]['id']},'attributes':['id'],'raw':!![]})[_0x3801('0x28')](function(_0xe9b586){if(_0xe9b586){return db[_0x3801('0x54')]['destroy']({'where':{'userProfileId':_0x1a381c[_0x3801('0x4c')]['id'],'id':_[_0x3801('0x2e')](_0xe9b586,function(_0x2b45f7){return _0x2b45f7['id'];})},'transaction':_0x407fd8});}})[_0x3801('0x28')](function(_0x48f49c){var _0x16b614=_['map'](_0x1a381c[_0x3801('0x4a')],function(_0x38d5f4){_0x38d5f4[_0x3801('0x59')]=_0x1a381c[_0x3801('0x4c')]['id'];return _0x38d5f4;});return db[_0x3801('0x54')]['bulkCreate'](_0x16b614,{'raw':!![],'transaction':_0x407fd8});})[_0x3801('0x28')](function(_0x4b6fea){var _0x377604=_[_0x3801('0x43')](_[_0x3801('0x2e')](_0x4b6fea,function(_0x12137c){return _0x12137c[_0x3801('0x60')]({'plain':!![]});}),{'includeAll':![]});if(_0x377604){return db[_0x3801('0x54')][_0x3801('0x55')]({'where':{'userProfileId':_0x1a381c[_0x3801('0x4c')]['id'],'sectionId':_[_0x3801('0x2e')](_0x377604,function(_0x328314){return _0x328314[_0x3801('0x58')];})},'attributes':['id',_0x3801('0x58')],'raw':!![]})[_0x3801('0x28')](function(_0x4b3063){var _0x5375fa=_[_0x3801('0x2e')](_0x1a381c['body'],function(_0x3625f6){_0x3625f6['userProfileId']=_0x1a381c[_0x3801('0x4c')]['id'];return _0x3625f6;});return db['UserProfileResource'][_0x3801('0x6a')](_0x5375fa,{'raw':!![],'transaction':_0x407fd8});});}})['catch'](handleError(_0x3590ab,null));});}})[_0x3801('0x28')](function(_0x565504){var _0x19e085=_[_0x3801('0x2e')](_0x565504,function(_0x119239){return _0x119239['get']({'plain':!![]});});})['then'](respondWithResult(_0x3590ab,null))[_0x3801('0x48')](handleError(_0x3590ab,null));};exports[_0x3801('0x6b')]=function(_0x37f526,_0x47223a,_0x4263fa){return db[_0x3801('0x45')][_0x3801('0x4e')]({'where':{'id':_0x37f526['params']['id']}})[_0x3801('0x28')](handleEntityNotFound(_0x47223a,null))[_0x3801('0x28')](function(_0x10d95b){if(_0x10d95b){return _0x10d95b[_0x3801('0x6b')](_0x37f526[_0x3801('0x33')][_0x3801('0x6c')]);}})['then'](respondWithStatusCode(_0x47223a,null))['catch'](handleError(_0x47223a,null));};exports[_0x3801('0x6d')]=function(_0x114e52,_0x525c0c){var _0x25dc6a={'raw':![],'where':{}};var _0xef3634={};var _0x201317={'count':0x0,'rows':[]};var _0x2eceb8=_0x114e52[_0x3801('0x33')]['section'];if(typeof _0x2eceb8===_0x3801('0x21')){throw new db[(_0x3801('0x6e'))]['ValidationError']('Unknown\x20section');}var _0x6d0554=_0x114e52['query'][_0x3801('0x6f')]||![];var _0x3b1fa6=getQueryModels(_0x2eceb8,_0x6d0554);if(typeof _0x3b1fa6['childModel']==='undefined'){throw new db[(_0x3801('0x6e'))][(_0x3801('0x70'))]('Invalid\x20section\x20\x27'+_0x2eceb8+'\x27');}var _0x1a5316=[];if(!_['isEmpty'](_0x3b1fa6['parentSections'])){_0x1a5316=_0x3b1fa6['parentSections'];}else{_0x1a5316=[{'name':_0x2eceb8}];}return db[_0x3801('0x45')][_0x3801('0x65')]({'where':{'id':_0x114e52['params']['id']}})[_0x3801('0x28')](handleEntityNotFound(_0x525c0c,null))[_0x3801('0x28')](function(_0x28d9b6){if(_0x28d9b6){var _0x5a448a=[];for(var _0x1e26ac=0x0;_0x1e26ac<_0x1a5316[_0x3801('0x39')];_0x1e26ac++){_0x5a448a['push'](db[_0x3801('0x54')][_0x3801('0x65')]({'where':{'userProfileId':_0x28d9b6['id'],'name':_0x1a5316[_0x1e26ac][_0x3801('0x2c')]},'raw':!![]}));}return BPromise[_0x3801('0x71')](_0x5a448a);}})[_0x3801('0x28')](function(_0x87bd9){var _0x30455b=_['filter'](_0x87bd9,function(_0x398e2b){return _0x398e2b?_0x398e2b:undefined;});var _0x4fa8ff=_['filter'](_0x1a5316,[_0x3801('0x72'),!![]]);var _0x1d11a7=_[_0x3801('0x73')](_0x30455b)&&_[_0x3801('0x73')](_0x4fa8ff)?null:_[_0x3801('0x74')](_0x4fa8ff,_0x30455b);if(_0x1d11a7){var _0x374f70=[];for(var _0x4765d3=0x0;_0x4765d3<_0x1d11a7[_0x3801('0x39')];_0x4765d3++){var _0x16a6b5=_[_0x3801('0x4e')](_0x1a5316,function(_0x6425e4){return _0x1d11a7[_0x4765d3]?_0x6425e4['name']===_0x1d11a7[_0x4765d3]['name']:null;});if(_0x16a6b5){if(_0x1d11a7[_0x4765d3][_0x3801('0x72')]){_0x374f70['push'](getAllResources(_0x3b1fa6[_0x3801('0x75')],_0x1d11a7[_0x4765d3]));}else{if(!_0x1d11a7[_0x4765d3][_0x3801('0x57')]){_0x374f70[_0x3801('0x5f')](getAllowedResources(_0x16a6b5,_0x1d11a7[_0x4765d3],_0x3b1fa6['childModel']));}else{if(_0x16a6b5['model']){_0x374f70[_0x3801('0x5f')](getAllFilteredResources(_0x16a6b5,_0x1d11a7[_0x4765d3]));}}}}}return BPromise['all'](_0x374f70);}else{return null;}})[_0x3801('0x28')](function(_0x278563){var _0x3cc65e=_0x278563;var _0x481fd7=null;if(_0x3cc65e){_0x481fd7=_0x3cc65e[_0x3801('0x39')]===0x1?_0x3cc65e[0x0]:null;}if(_0x481fd7||_0x3cc65e){var _0xb71bc5=db[_0x3b1fa6[_0x3801('0x75')]][_0x3801('0x2f')];_0xef3634[_0x3801('0x32')]=_['keys'](_0xb71bc5);_0xef3634[_0x3801('0x33')]=_[_0x3801('0x34')](_0x114e52['query']);_0xef3634[_0x3801('0x35')]=_[_0x3801('0x37')](_0xef3634[_0x3801('0x32')],_0xef3634[_0x3801('0x33')]);_0x25dc6a['attributes']=_[_0x3801('0x37')](_0xef3634[_0x3801('0x32')],qs[_0x3801('0x38')](_0x114e52[_0x3801('0x33')][_0x3801('0x38')]));_0x25dc6a[_0x3801('0x36')]=_0x25dc6a['attributes'][_0x3801('0x39')]?_0x25dc6a['attributes']:_0xef3634['model'];if(!_0x114e52[_0x3801('0x33')][_0x3801('0x3a')](_0x3801('0x3b'))){_0x25dc6a['limit']=qs[_0x3801('0x20')](_0x114e52[_0x3801('0x33')][_0x3801('0x20')]);_0x25dc6a[_0x3801('0x1f')]=qs[_0x3801('0x1f')](_0x114e52['query']['offset']);}_0x25dc6a[_0x3801('0x3c')]=qs[_0x3801('0x3d')](_0x114e52[_0x3801('0x33')]['sort']);_0x25dc6a[_0x3801('0x3e')]=qs[_0x3801('0x35')](_['pick'](_0x114e52['query'],_0xef3634[_0x3801('0x35')]));if(_0x114e52[_0x3801('0x33')][_0x3801('0x43')]){_0x25dc6a[_0x3801('0x3e')]=_['merge'](_0x25dc6a[_0x3801('0x3e')],{'$or':_[_0x3801('0x2e')](_0xb71bc5,function(_0x21c635){if(_0x21c635[_0x3801('0x41')][_0x3801('0x31')]!=='VIRTUAL'){var _0x2f3baa={};_0x2f3baa[_0x21c635[_0x3801('0x76')]]={'$like':'%'+_0x114e52[_0x3801('0x33')][_0x3801('0x43')]+'%'};return _0x2f3baa;}})});}var _0x29a47b=[];if(_0x481fd7){var _0x3ccf54=_[_0x3801('0x4e')](_0x1a5316,[_0x3801('0x2c'),_0x481fd7[_0x3801('0x2c')]]);if(_0x3ccf54[_0x3801('0x76')]){var _0x460b9e={};if(_0x3b1fa6['childModel']===_0x3801('0x77')){_0x460b9e[_0x3ccf54[_0x3801('0x78')]]=_[_0x3801('0x2e')](_0x481fd7[_0x3801('0x79')],'id');}else{_0x460b9e[_0x3ccf54[_0x3801('0x78')]]=_0x481fd7[_0x3801('0x79')];}_0x29a47b[_0x3801('0x5f')](_0x460b9e);}else{_0x25dc6a[_0x3801('0x3e')]['id']=_0x481fd7[_0x3801('0x79')];}}else{for(var _0x5da06e=0x0;_0x5da06e<_0x3cc65e[_0x3801('0x39')];_0x5da06e++){var _0x3ccf54=_[_0x3801('0x4e')](_0x1a5316,['name',_0x3cc65e[_0x5da06e][_0x3801('0x2c')]]);if(_0x3ccf54[_0x3801('0x76')]){var _0x460b9e={};_0x460b9e[_0x3ccf54['foreignKey']]=_0x3cc65e[_0x5da06e]['associatedResources'];_0x29a47b[_0x3801('0x5f')](_0x460b9e);}else{if(!_0x25dc6a[_0x3801('0x3e')]['id'])_0x25dc6a['where']['id']=[];_0x3cc65e[_0x5da06e][_0x3801('0x79')][_0x3801('0x67')](function(_0x3ad815){_0x25dc6a[_0x3801('0x3e')]['id']['push'](_0x3ad815);});}}}if(!_['isEmpty'](_0x29a47b)){_0x25dc6a[_0x3801('0x3e')]=_[_0x3801('0x40')](_0x25dc6a['where'],{'$and':{'$or':_0x29a47b}});}_0x25dc6a=_[_0x3801('0x40')]({},_0x25dc6a,_0x114e52[_0x3801('0x44')]);if(_0x481fd7&&!_0x481fd7[_0x3801('0x57')]&&_0x3b1fa6[_0x3801('0x75')]===_0x3801('0x77')){if(_0x114e52[_0x3801('0x33')][_0x3801('0x46')]){_0x25dc6a['include']=[{'all':!![]}];}return db[_0x3b1fa6[_0x3801('0x75')]][_0x3801('0x55')](_0x25dc6a)['then'](function(_0x137d58){var _0x1edd7d=[];_0x137d58[_0x3801('0x67')](function(_0x455068){var _0x59d11a;switch(_0x455068[_0x3801('0x7a')]){case _0x3801('0x7b'):_0x59d11a=_[_0x3801('0x4e')](_0x481fd7[_0x3801('0x79')],function(_0x199e8f){return _0x199e8f['id']===_0x455068[_0x3801('0x7c')]&&_0x199e8f[_0x3801('0x41')]===_0x3801('0x7d');});break;case _0x3801('0x7e'):_0x59d11a=_['find'](_0x481fd7['associatedResources'],function(_0x30c52e){return _0x30c52e['id']===_0x455068[_0x3801('0x7c')]&&_0x30c52e[_0x3801('0x41')]===_0x3801('0x7f');});break;}if(_0x59d11a)_0x1edd7d['push'](_0x455068);});_0x201317['count']=_0x1edd7d['length'];_0x201317[_0x3801('0x47')]=_0x1edd7d;return _0x201317;});}else{return db[_0x3b1fa6[_0x3801('0x75')]][_0x3801('0x22')]({'where':_0x25dc6a[_0x3801('0x3e')]})[_0x3801('0x28')](function(_0x526b57){_0x201317[_0x3801('0x22')]=_0x526b57;if(_0x114e52['query'][_0x3801('0x46')]){if(_0x3b1fa6[_0x3801('0x75')]===_0x3801('0x80')){_0x25dc6a[_0x3801('0x4d')]=[{'model':db[_0x3801('0x81')],'as':_0x3801('0x82'),'attributes':['id',_0x3801('0x2c'),_0x3801('0x83')],'required':_0x114e52[_0x3801('0x33')][_0x3801('0x84')]?!![]:![]},{'model':db['Tag'],'as':_0x3801('0x85'),'attributes':['id',_0x3801('0x2c'),_0x3801('0x83')],'through':_0x114e52[_0x3801('0x33')][_0x3801('0x84')]?{'attributes':[],'where':{'TagId':_0x114e52['query'][_0x3801('0x84')]||undefined}}:{},'required':_0x114e52[_0x3801('0x33')][_0x3801('0x84')]?!![]:![]}];}else{_0x25dc6a[_0x3801('0x4d')]=[{'all':!![]}];}}return db[_0x3b1fa6[_0x3801('0x75')]][_0x3801('0x55')](_0x25dc6a);})[_0x3801('0x28')](function(_0x10120c){_0x201317['rows']=_0x10120c;if(_0x2eceb8===_0x3801('0x86')&&_0x114e52[_0x3801('0x33')][_0x3801('0x87')]===_0x3801('0x88')){var _0x2484fe=[];for(var _0x11dfd4=0x0;_0x11dfd4<_0x201317['rows'][_0x3801('0x39')];_0x11dfd4++){_0x2484fe['push'](getOpenTabs(_0x3801('0x89'),_0x201317[_0x3801('0x47')][_0x11dfd4]['dataValues']));_0x2484fe[_0x3801('0x5f')](getOpenTabs(_0x3801('0x8a'),_0x201317['rows'][_0x11dfd4][_0x3801('0x8b')]));_0x2484fe[_0x3801('0x5f')](getOpenTabs(_0x3801('0x8c'),_0x201317['rows'][_0x11dfd4][_0x3801('0x8b')]));_0x2484fe[_0x3801('0x5f')](getOpenTabs(_0x3801('0x8d'),_0x201317[_0x3801('0x47')][_0x11dfd4][_0x3801('0x8b')]));_0x2484fe[_0x3801('0x5f')](getOpenTabs('openchannel',_0x201317[_0x3801('0x47')][_0x11dfd4][_0x3801('0x8b')]));_0x2484fe[_0x3801('0x5f')](getOpenTabs('whatsapp',_0x201317[_0x3801('0x47')][_0x11dfd4][_0x3801('0x8b')]));}return Promise['all'](_0x2484fe)[_0x3801('0x28')](function(){return _0x201317;});}return _0x201317;});}}else{return _0x201317;}})[_0x3801('0x28')](respondWithFilteredResult(_0x525c0c,_0x25dc6a))[_0x3801('0x48')](handleError(_0x525c0c,null));};function getOpenTabs(_0x21cf0b,_0xeff1eb){var _0x41ac75=_0x21cf0b['charAt'](0x0)[_0x3801('0x8e')]()+_0x21cf0b['slice'](0x1);var _0x4e27b2={'type':db[_0x3801('0x6e')][_0x3801('0x8f')][_0x3801('0x90')],'raw':!![]};return new BPromise(function(_0x2b9ab8,_0x58e691){var _0x4355a6=squel[_0x3801('0x91')]()[_0x3801('0x76')](_0x3801('0x92')+_0x41ac75+_0x3801('0x93'),'id')[_0x3801('0x76')](_0x3801('0x94'))[_0x3801('0x95')](_0x3801('0x96')+_0x21cf0b+_0x3801('0x97'),'ui')[_0x3801('0x3e')]('ui.UserId\x20=\x20?',_0xeff1eb['id']);return db[_0x3801('0x5e')][_0x3801('0x33')](_0x4355a6[_0x3801('0x98')](),_0x4e27b2)[_0x3801('0x28')](function(_0xddf13c){_0xeff1eb[_0x41ac75+_0x3801('0x99')]=_0xddf13c;_0x2b9ab8(_0xddf13c);})[_0x3801('0x48')](function(_0x3464e5){_0x58e691(_0x3464e5);});});}function getAllResources(_0x590ddb,_0x4f7927){return new BPromise(function(_0xdee7d2,_0x473d75){if(_0x4f7927){var _0x2ae49b=_0x4f7927[_0x3801('0x43')]?{[_0x4f7927[_0x3801('0x43')]['field']]:_0x4f7927[_0x3801('0x43')][_0x3801('0x9a')]}:undefined;return db[_0x590ddb][_0x3801('0x55')]({'where':_0x2ae49b,'raw':!![]})['then'](function(_0x4f16a0){_0x4f7927[_0x3801('0x79')]=_[_0x3801('0x2e')](_0x4f16a0,'id');_0xdee7d2(_0x4f7927);})[_0x3801('0x48')](function(_0x3ed777){_0x473d75(_0x3ed777);});}else{_0xdee7d2(null);}});}function getAllFilteredResources(_0x584020,_0x54a0e4){return new BPromise(function(_0x175b8e,_0x5e0acc){var _0x2040f8=_0x584020[_0x3801('0x43')]?{[_0x584020[_0x3801('0x43')]['field']]:_0x584020[_0x3801('0x43')][_0x3801('0x9a')]}:undefined;return db[_0x584020[_0x3801('0x32')]][_0x3801('0x55')]({'where':_0x2040f8,'raw':!![]})[_0x3801('0x28')](function(_0x554039){_0x54a0e4['associatedResources']=_[_0x3801('0x2e')](_0x554039,function(_0x32b31c){return _0x584020['field']?_0x32b31c[_0x584020[_0x3801('0x76')]]:_0x32b31c[_0x3801('0x2c')];});_0x175b8e(_0x54a0e4);})['catch'](function(_0x118176){_0x5e0acc(_0x118176);});});}function getAllowedResources(_0x1b001e,_0x3e6402,_0x48ea51){return new BPromise(function(_0x57382f,_0x30e4dd){if(_0x3e6402){return db[_0x3801('0x5b')][_0x3801('0x55')]({'where':{'sectionId':_0x3e6402['id']},'raw':!![]})['then'](function(_0x108484){if(_0x1b001e[_0x3801('0x76')]&&_0x1b001e[_0x3801('0x76')]!=='id'){_0x3e6402[_0x3801('0x79')]=_[_0x3801('0x2e')](_0x108484,function(_0x451687){return _0x451687[_0x1b001e[_0x3801('0x76')]];});}else{if(_0x48ea51===_0x3801('0x77')){_0x3e6402['associatedResources']=_[_0x3801('0x2e')](_0x108484,function(_0x9221d1){return{'id':_0x9221d1['resourceId'],'type':_0x9221d1[_0x3801('0x41')]};});}else{_0x3e6402[_0x3801('0x79')]=_[_0x3801('0x2e')](_0x108484,function(_0x498490){return _0x498490[_0x3801('0x68')];});}}_0x57382f(_0x3e6402);})[_0x3801('0x48')](function(_0x2bdb8f){_0x30e4dd(_0x2bdb8f);});}else{_0x57382f(null);}});}function getQueryModels(_0x200fc8,_0x3dd684){var _0x2ee79a=_0x200fc8['toLowerCase']();var _0x3490d5={'childModel':undefined,'parentSections':[]};switch(_0x2ee79a){case'squareprojects':_0x3490d5[_0x3801('0x75')]=_0x3801('0x9b');break;case _0x3801('0x9c'):_0x3490d5[_0x3801('0x75')]='SquareOdbc';break;case'squarerecordings':_0x3490d5[_0x3801('0x75')]=_0x3801('0x9d');_0x3490d5[_0x3801('0x9e')]=[{'name':_0x3801('0x9f'),'field':_0x3801('0x2c'),'foreignKey':_0x3801('0xa0')}];break;case'projects':_0x3490d5[_0x3801('0x75')]='JscriptyProject';break;case _0x3801('0xa1'):_0x3490d5[_0x3801('0x75')]=_0x3801('0x80');_0x3490d5[_0x3801('0x9e')]=[{'name':_0x3801('0xa2'),'field':'id','foreignKey':'ListId'}];break;case _0x3801('0xa3'):_0x3490d5[_0x3801('0x75')]=_0x3801('0xa4');break;case _0x3801('0xa5'):_0x3490d5[_0x3801('0x75')]=_0x3801('0xa6');break;case _0x3801('0xa7'):_0x3490d5[_0x3801('0x75')]=_0x3801('0xa8');break;case _0x3801('0xa9'):_0x3490d5['childModel']=_0x3801('0xaa');break;case'chatwebsites':_0x3490d5[_0x3801('0x75')]='ChatWebsite';break;case'faxqueues':_0x3490d5[_0x3801('0x75')]=_0x3801('0xab');break;case _0x3801('0xac'):_0x3490d5[_0x3801('0x75')]=_0x3801('0xad');break;case'inboundroutes':case _0x3801('0xae'):case _0x3801('0xaf'):_0x3490d5['childModel']=_0x3801('0xb0');break;case _0x3801('0xb1'):_0x3490d5[_0x3801('0x75')]='VoiceContext';break;case _0x3801('0xb2'):_0x3490d5[_0x3801('0x75')]=_0x3801('0xb3');break;case _0x3801('0xb4'):_0x3490d5[_0x3801('0x75')]=_0x3801('0xb5');_0x3490d5[_0x3801('0x9e')]=[{'name':_0x3801('0x86'),'field':_0x3801('0x2c'),'foreignKey':_0x3801('0xb6'),'model':_0x3801('0xb7'),'filter':{'field':_0x3801('0xb8'),'value':[_0x3801('0xb9')]}},{'name':_0x3801('0xba'),'field':_0x3801('0x2c'),'foreignKey':_0x3801('0xb6'),'model':'User','filter':{'field':'role','value':[_0x3801('0xbb')]}},{'name':_0x3801('0xbc'),'field':'name','foreignKey':_0x3801('0xbd'),'model':'VoiceQueue','filter':{'field':'type','value':[_0x3801('0xbe')]}},{'name':_0x3801('0xbf'),'field':_0x3801('0x2c'),'foreignKey':_0x3801('0xbd'),'model':'VoiceQueue','filter':{'field':_0x3801('0x41'),'value':['outbound']}}];break;case _0x3801('0xc0'):_0x3490d5['childModel']=_0x3801('0xc1');break;case'chanspies':_0x3490d5[_0x3801('0x75')]=_0x3801('0xc2');break;case _0x3801('0xc3'):_0x3490d5[_0x3801('0x75')]=_0x3801('0xc4');break;case'ivrcampaigns':_0x3490d5['childModel']=_0x3801('0xc5');break;case _0x3801('0xc6'):_0x3490d5[_0x3801('0x75')]=_0x3801('0xc7');break;case'mailaccounts':_0x3490d5[_0x3801('0x75')]=_0x3801('0xc8');break;case _0x3801('0xc9'):_0x3490d5[_0x3801('0x75')]='MailSubstatus';break;case _0x3801('0xca'):_0x3490d5[_0x3801('0x75')]=_0x3801('0xcb');break;case _0x3801('0xcc'):_0x3490d5[_0x3801('0x75')]='OpenchannelAccount';break;case _0x3801('0xcd'):_0x3490d5[_0x3801('0x75')]=_0x3801('0xce');break;case _0x3801('0xcf'):_0x3490d5['childModel']=_0x3801('0xd0');break;case'whatsappqueues':_0x3490d5[_0x3801('0x75')]=_0x3801('0xd1');break;case'teams':_0x3490d5[_0x3801('0x75')]=_0x3801('0xd2');break;case _0x3801('0xd3'):case _0x3801('0xd4'):_0x3490d5[_0x3801('0x75')]=_0x3801('0xd5');if(_0x3dd684){_0x3490d5[_0x3801('0x9e')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case'users':case _0x3801('0xd6'):case'telephones':_0x3490d5['childModel']='User';if(_0x3dd684){_0x3490d5[_0x3801('0x9e')]=[{'name':_0x3801('0xd7'),'filter':{'field':_0x3801('0xb8'),'value':[_0x3801('0xd8'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0x3801('0xba')}];}break;case _0x3801('0xd9'):_0x3490d5[_0x3801('0x75')]=_0x3801('0xda');break;case _0x3801('0xdb'):_0x3490d5[_0x3801('0x75')]=_0x3801('0xdc');break;case _0x3801('0xdd'):_0x3490d5[_0x3801('0x75')]=_0x3801('0xde');break;case _0x3801('0xdf'):_0x3490d5['childModel']=_0x3801('0xe0');break;case _0x3801('0xe1'):_0x3490d5[_0x3801('0x75')]=_0x3801('0xe2');break;case'zohoaccounts':_0x3490d5[_0x3801('0x75')]=_0x3801('0xe3');break;case _0x3801('0xe4'):_0x3490d5['childModel']=_0x3801('0xb7');break;case _0x3801('0xe5'):_0x3490d5['childModel']='CannedAnswer';break;case'dispositions':_0x3490d5['childModel']=_0x3801('0xe6');break;case _0x3801('0xe7'):_0x3490d5['childModel']='Dashboard';break;case _0x3801('0xe8'):_0x3490d5[_0x3801('0x75')]=_0x3801('0xe9');break;case'pauses':_0x3490d5['childModel']=_0x3801('0xea');break;case _0x3801('0xeb'):_0x3490d5['childModel']=_0x3801('0xec');break;case _0x3801('0xed'):_0x3490d5[_0x3801('0x75')]=_0x3801('0xee');break;case _0x3801('0xef'):_0x3490d5[_0x3801('0x75')]=_0x3801('0x81');break;case _0x3801('0xf0'):_0x3490d5['childModel']=_0x3801('0xf1');break;case _0x3801('0xf2'):_0x3490d5[_0x3801('0x75')]='Trigger';break;case _0x3801('0xf3'):_0x3490d5[_0x3801('0x75')]=_0x3801('0xf4');break;case'variables':_0x3490d5['childModel']=_0x3801('0xf5');break;case _0x3801('0xf6'):_0x3490d5[_0x3801('0x75')]='Plugin';break;case _0x3801('0xf7'):_0x3490d5['childModel']=_0x3801('0x77');_0x3490d5['parentSections']=[{'name':_0x3801('0xf8'),'field':'id','foreignKey':'reportId'}];break;case _0x3801('0xf9'):_0x3490d5[_0x3801('0x75')]='AnalyticMetric';break;case _0x3801('0xfa'):_0x3490d5[_0x3801('0x75')]=_0x3801('0xfb');break;case _0x3801('0xfc'):_0x3490d5['childModel']='ScreenRecording';_0x3490d5['parentSections']=[{'name':_0x3801('0x86'),'field':'id','foreignKey':'UserId','model':_0x3801('0xb7'),'filter':{'field':_0x3801('0xb8'),'value':[_0x3801('0xb9')]}},{'name':_0x3801('0xba'),'field':'id','foreignKey':_0x3801('0xfd'),'model':_0x3801('0xb7'),'filter':{'field':_0x3801('0xb8'),'value':[_0x3801('0xbb')]}}];break;default:return _0x3490d5;}return _0x3490d5;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 9c146b6..f7a66ed 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 _0x2891=['events','../../mysqldb','UserProfile','save','remove','emit','hasOwnProperty','exports'];(function(_0x18ae02,_0x5dcb50){var _0x5c2405=function(_0x48c8bb){while(--_0x48c8bb){_0x18ae02['push'](_0x18ae02['shift']());}};_0x5c2405(++_0x5dcb50);}(_0x2891,0xf8));var _0x1289=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x2891[_0x46aff0];return _0x9d78cf;};'use strict';var EventEmitter=require(_0x1289('0x0'));var UserProfile=require(_0x1289('0x1'))['db'][_0x1289('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1289('0x3'),'afterUpdate':'update','afterDestroy':_0x1289('0x4')};function emitEvent(_0x2b3507){return function(_0x51eba7,_0x4b472a,_0x573ac5){UserProfileEvents['emit'](_0x2b3507+':'+_0x51eba7['id'],_0x51eba7);UserProfileEvents[_0x1289('0x5')](_0x2b3507,_0x51eba7);_0x573ac5(null);};}for(var e in events){if(events[_0x1289('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x1289('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x5a6e=['hasOwnProperty','hook','exports','../../mysqldb','UserProfile','save','update','remove','emit'];(function(_0x35f1e7,_0x50f26e){var _0xefc085=function(_0x359cd5){while(--_0x359cd5){_0x35f1e7['push'](_0x35f1e7['shift']());}};_0xefc085(++_0x50f26e);}(_0x5a6e,0x17d));var _0xe5a6=function(_0x215393,_0x4c406d){_0x215393=_0x215393-0x0;var _0x595198=_0x5a6e[_0x215393];return _0x595198;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xe5a6('0x0'))['db'][_0xe5a6('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe5a6('0x2'),'afterUpdate':_0xe5a6('0x3'),'afterDestroy':_0xe5a6('0x4')};function emitEvent(_0x1653de){return function(_0x1adfb7,_0x113b1f,_0x38bbe6){UserProfileEvents[_0xe5a6('0x5')](_0x1653de+':'+_0x1adfb7['id'],_0x1adfb7);UserProfileEvents[_0xe5a6('0x5')](_0x1653de,_0x1adfb7);_0x38bbe6(null);};}for(var e in events){if(events[_0xe5a6('0x6')](e)){var event=events[e];UserProfile[_0xe5a6('0x7')](e,emitEvent(event));}}module[_0xe5a6('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 313ae9d..aaeb026 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 _0x915a=['../../config/logger','api','moment','request-promise','../../config/environment','./userProfile.attributes','exports','define','update','then','lodash','util'];(function(_0x3b6648,_0x2d723a){var _0x5a0a0d=function(_0x133dea){while(--_0x133dea){_0x3b6648['push'](_0x3b6648['shift']());}};_0x5a0a0d(++_0x2d723a);}(_0x915a,0x1d2));var _0xa915=function(_0x55da18,_0x53433f){_0x55da18=_0x55da18-0x0;var _0x3a5deb=_0x915a[_0x55da18];return _0x3a5deb;};'use strict';var _=require(_0xa915('0x0'));var util=require(_0xa915('0x1'));var logger=require(_0xa915('0x2'))(_0xa915('0x3'));var moment=require(_0xa915('0x4'));var BPromise=require('bluebird');var rp=require(_0xa915('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa915('0x6'));var attributes=require(_0xa915('0x7'));module[_0xa915('0x8')]=function(_0xb6900c,_0x1ed01d){return _0xb6900c[_0xa915('0x9')]('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3f5b1b,_0x43bfc9,_0x173267){var _0x450ff2=_0xb6900c['models'];_0x450ff2['User'][_0xa915('0xa')]({'privacyEnabled':_0x3f5b1b['privacyEnabled']},{'where':{'UserProfileId':_0x3f5b1b['id']}})[_0xa915('0xb')](function(){_0x173267();})['catch'](function(_0x1bee9a){_0x173267(_0x1bee9a);});}}});}; \ No newline at end of file +var _0x8aa7=['./userProfile.attributes','exports','define','UserProfile','user_profiles','models','User','update','privacyEnabled','then','catch','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x216d9d,_0x4e9708){var _0x3fbfb6=function(_0x5e88d6){while(--_0x5e88d6){_0x216d9d['push'](_0x216d9d['shift']());}};_0x3fbfb6(++_0x4e9708);}(_0x8aa7,0xb6));var _0x78aa=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x8aa7[_0x1992f1];return _0x413dfe;};'use strict';var _=require('lodash');var util=require(_0x78aa('0x0'));var logger=require(_0x78aa('0x1'))(_0x78aa('0x2'));var moment=require(_0x78aa('0x3'));var BPromise=require(_0x78aa('0x4'));var rp=require(_0x78aa('0x5'));var fs=require('fs');var path=require(_0x78aa('0x6'));var rimraf=require('rimraf');var config=require(_0x78aa('0x7'));var attributes=require(_0x78aa('0x8'));module[_0x78aa('0x9')]=function(_0x229075,_0x2d17c2){return _0x229075[_0x78aa('0xa')](_0x78aa('0xb'),attributes,{'tableName':_0x78aa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2368ac,_0x460488,_0x1da0ad){var _0x116a77=_0x229075[_0x78aa('0xd')];_0x116a77[_0x78aa('0xe')][_0x78aa('0xf')]({'privacyEnabled':_0x2368ac[_0x78aa('0x10')]},{'where':{'UserProfileId':_0x2368ac['id']}})[_0x78aa('0x11')](function(){_0x1da0ad();})[_0x78aa('0x12')](function(_0x4168a2){_0x1da0ad(_0x4168a2);});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 0b5a08b..a8fb85a 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 _0x2bd8=['../../config/environment','jayson/promise','client','redis','defaults','localhost','info','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x56631b,_0x61aeea){var _0x54443e=function(_0x4f83d4){while(--_0x4f83d4){_0x56631b['push'](_0x56631b['shift']());}};_0x54443e(++_0x61aeea);}(_0x2bd8,0x130));var _0x82bd=function(_0x5a8146,_0x335b1a){_0x5a8146=_0x5a8146-0x0;var _0x30b580=_0x2bd8[_0x5a8146];return _0x30b580;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var moment=require(_0x82bd('0x1'));var BPromise=require(_0x82bd('0x2'));var rs=require(_0x82bd('0x3'));var fs=require('fs');var Redis=require(_0x82bd('0x4'));var db=require(_0x82bd('0x5'))['db'];var utils=require(_0x82bd('0x6'));var logger=require(_0x82bd('0x7'))('rpc');var config=require(_0x82bd('0x8'));var jayson=require(_0x82bd('0x9'));var client=jayson[_0x82bd('0xa')]['http']({'port':0x232a});config[_0x82bd('0xb')]=_[_0x82bd('0xc')](config[_0x82bd('0xb')],{'host':_0x82bd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x82bd('0xb')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x51c6ea,_0x5bb22c,_0x5f0434){return new BPromise(function(_0x4c9430,_0x36abe3){return client['request'](_0x51c6ea,_0x5f0434)['then'](function(_0x32821a){logger[_0x82bd('0xe')]('UserProfile,\x20%s,\x20%s',_0x5bb22c,_0x82bd('0xf'));logger['debug'](_0x82bd('0x10'),_0x5bb22c,'request\x20sent',JSON[_0x82bd('0x11')](_0x32821a));if(_0x32821a[_0x82bd('0x12')]){if(_0x32821a[_0x82bd('0x12')][_0x82bd('0x13')]===0x1f4){logger['error'](_0x82bd('0x14'),_0x5bb22c,_0x32821a[_0x82bd('0x12')]['message']);return _0x36abe3(_0x32821a[_0x82bd('0x12')]['message']);}logger[_0x82bd('0x12')](_0x82bd('0x14'),_0x5bb22c,_0x32821a[_0x82bd('0x12')][_0x82bd('0x15')]);return _0x4c9430(_0x32821a[_0x82bd('0x12')][_0x82bd('0x15')]);}else{logger[_0x82bd('0xe')](_0x82bd('0x14'),_0x5bb22c,_0x82bd('0xf'));_0x4c9430(_0x32821a[_0x82bd('0x16')][_0x82bd('0x15')]);}})[_0x82bd('0x17')](function(_0x1c3779){logger[_0x82bd('0x12')]('UserProfile,\x20%s,\x20%s',_0x5bb22c,_0x1c3779);_0x36abe3(_0x1c3779);});});} \ No newline at end of file +var _0x98a8=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./userProfile.socket','register','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','UserProfile,\x20%s,\x20%s'];(function(_0x3e7213,_0xac260){var _0x3f1315=function(_0x44a38a){while(--_0x44a38a){_0x3e7213['push'](_0x3e7213['shift']());}};_0x3f1315(++_0xac260);}(_0x98a8,0x12c));var _0x898a=function(_0x5aa0a3,_0x197bf9){_0x5aa0a3=_0x5aa0a3-0x0;var _0x4d15f=_0x98a8[_0x5aa0a3];return _0x4d15f;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});config[_0x898a('0xc')]=_['defaults'](config[_0x898a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x898a('0xd'))(new Redis(config[_0x898a('0xc')]));require(_0x898a('0xe'))[_0x898a('0xf')](socket);function respondWithRpcPromise(_0x3150df,_0x388a47,_0x42faa4){return new BPromise(function(_0x1a92de,_0x3806cb){return client['request'](_0x3150df,_0x42faa4)[_0x898a('0x10')](function(_0x502e95){logger[_0x898a('0x11')]('UserProfile,\x20%s,\x20%s',_0x388a47,_0x898a('0x12'));logger[_0x898a('0x13')](_0x898a('0x14'),_0x388a47,'request\x20sent',JSON['stringify'](_0x502e95));if(_0x502e95['error']){if(_0x502e95[_0x898a('0x15')][_0x898a('0x16')]===0x1f4){logger[_0x898a('0x15')](_0x898a('0x17'),_0x388a47,_0x502e95[_0x898a('0x15')][_0x898a('0x18')]);return _0x3806cb(_0x502e95['error'][_0x898a('0x18')]);}logger['error'](_0x898a('0x17'),_0x388a47,_0x502e95['error'][_0x898a('0x18')]);return _0x1a92de(_0x502e95['error'][_0x898a('0x18')]);}else{logger['info'](_0x898a('0x17'),_0x388a47,_0x898a('0x12'));_0x1a92de(_0x502e95[_0x898a('0x19')]['message']);}})[_0x898a('0x1a')](function(_0x5960e0){logger['error'](_0x898a('0x17'),_0x388a47,_0x5960e0);_0x3806cb(_0x5960e0);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index fc895f8..2f2cb46 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 _0xfd54=['userProfile:','./userProfile.events','save','remove','emit','removeListener','register'];(function(_0x424357,_0x9ebe3e){var _0x29c68e=function(_0x663b5d){while(--_0x663b5d){_0x424357['push'](_0x424357['shift']());}};_0x29c68e(++_0x9ebe3e);}(_0xfd54,0x197));var _0x4fd5=function(_0x499f42,_0x47a05c){_0x499f42=_0x499f42-0x0;var _0x285e92=_0xfd54[_0x499f42];return _0x285e92;};'use strict';var UserProfileEvents=require(_0x4fd5('0x0'));var events=[_0x4fd5('0x1'),_0x4fd5('0x2'),'update'];function createListener(_0x56929d,_0x440eb8){return function(_0x3bbb30){_0x440eb8[_0x4fd5('0x3')](_0x56929d,_0x3bbb30);};}function removeListener(_0x607dcb,_0x289e32){return function(){UserProfileEvents[_0x4fd5('0x4')](_0x607dcb,_0x289e32);};}exports[_0x4fd5('0x5')]=function(_0x389192){for(var _0x2b0efc=0x0,_0x307a8f=events['length'];_0x2b0efc<_0x307a8f;_0x2b0efc++){var _0x8b20c2=events[_0x2b0efc];var _0x550957=createListener(_0x4fd5('0x6')+_0x8b20c2,_0x389192);UserProfileEvents['on'](_0x8b20c2,_0x550957);}}; \ No newline at end of file +var _0x34bf=['removeListener','register','length','save','remove','update'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x34bf,0xdb));var _0xf34b=function(_0x2e04b6,_0xd8ff75){_0x2e04b6=_0x2e04b6-0x0;var _0x3ef5cc=_0x34bf[_0x2e04b6];return _0x3ef5cc;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xf34b('0x0'),_0xf34b('0x1'),_0xf34b('0x2')];function createListener(_0x547832,_0x5139da){return function(_0x1aeb04){_0x5139da['emit'](_0x547832,_0x1aeb04);};}function removeListener(_0x39dfeb,_0x3d4886){return function(){UserProfileEvents[_0xf34b('0x3')](_0x39dfeb,_0x3d4886);};}exports[_0xf34b('0x4')]=function(_0x48b1ce){for(var _0x407f82=0x0,_0x32693d=events[_0xf34b('0x5')];_0x407f82<_0x32693d;_0x407f82++){var _0x2f7e22=events[_0x407f82];var _0x5af06e=createListener('userProfile:'+_0x2f7e22,_0x48b1ce);UserProfileEvents['on'](_0x2f7e22,_0x5af06e);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index abf77a2..5fd988d 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 _0xe623=['../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4766fd,_0x968500){var _0x43c99f=function(_0x527e87){while(--_0x527e87){_0x4766fd['push'](_0x4766fd['shift']());}};_0x43c99f(++_0x968500);}(_0xe623,0x8c));var _0x3e62=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xe623[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require(_0x3e62('0x0'));var util=require(_0x3e62('0x1'));var path=require('path');var timeout=require(_0x3e62('0x2'));var express=require(_0x3e62('0x3'));var router=express[_0x3e62('0x4')]();var fs_extra=require(_0x3e62('0x5'));var auth=require(_0x3e62('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3e62('0x7'));var controller=require(_0x3e62('0x8'));router[_0x3e62('0x9')]('/',auth[_0x3e62('0xa')](),controller[_0x3e62('0xb')]);router[_0x3e62('0x9')](_0x3e62('0xc'),auth[_0x3e62('0xa')](),controller[_0x3e62('0xd')]);router[_0x3e62('0x9')](_0x3e62('0xe'),auth[_0x3e62('0xa')](),controller['show']);router['post']('/',auth[_0x3e62('0xa')](),controller[_0x3e62('0xf')]);router[_0x3e62('0x10')](_0x3e62('0xe'),auth[_0x3e62('0xa')](),controller[_0x3e62('0x11')]);router[_0x3e62('0x12')](_0x3e62('0xe'),auth[_0x3e62('0xa')](),controller[_0x3e62('0x13')]);module[_0x3e62('0x14')]=router; \ No newline at end of file +var _0x426a=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','/describe','describe','/:id','create','put','update','destroy','exports','multer'];(function(_0x24a78a,_0x162cf4){var _0x46d95a=function(_0x1193be){while(--_0x1193be){_0x24a78a['push'](_0x24a78a['shift']());}};_0x46d95a(++_0x162cf4);}(_0x426a,0xdb));var _0xa426=function(_0x5d3545,_0x2746b5){_0x5d3545=_0x5d3545-0x0;var _0x50fe9c=_0x426a[_0x5d3545];return _0x50fe9c;};'use strict';var multer=require(_0xa426('0x0'));var util=require(_0xa426('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa426('0x2'));var router=express[_0xa426('0x3')]();var fs_extra=require(_0xa426('0x4'));var auth=require(_0xa426('0x5'));var interaction=require(_0xa426('0x6'));var config=require(_0xa426('0x7'));var controller=require(_0xa426('0x8'));router['get']('/',auth[_0xa426('0x9')](),controller[_0xa426('0xa')]);router[_0xa426('0xb')](_0xa426('0xc'),auth['isAuthenticated'](),controller[_0xa426('0xd')]);router[_0xa426('0xb')](_0xa426('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa426('0x9')](),controller[_0xa426('0xf')]);router[_0xa426('0x10')](_0xa426('0xe'),auth[_0xa426('0x9')](),controller[_0xa426('0x11')]);router['delete'](_0xa426('0xe'),auth[_0xa426('0x9')](),controller[_0xa426('0x12')]);module[_0xa426('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 7c1d180..449c4c9 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 _0xc162=['sequelize','exports','STRING','INTEGER'];(function(_0x29caf3,_0x88a317){var _0x3dc931=function(_0x228469){while(--_0x228469){_0x29caf3['push'](_0x29caf3['shift']());}};_0x3dc931(++_0x88a317);}(_0xc162,0xf0));var _0x2c16=function(_0x41d291,_0x35c72a){_0x41d291=_0x41d291-0x0;var _0x724632=_0xc162[_0x41d291];return _0x724632;};'use strict';var Sequelize=require(_0x2c16('0x0'));module[_0x2c16('0x1')]={'name':{'type':Sequelize[_0x2c16('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x2c16('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x730c=['INTEGER','sequelize','exports','STRING'];(function(_0x5153ca,_0x4b3b43){var _0x5e5f47=function(_0xbfc0b5){while(--_0xbfc0b5){_0x5153ca['push'](_0x5153ca['shift']());}};_0x5e5f47(++_0x4b3b43);}(_0x730c,0x13d));var _0xc730=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x730c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc730('0x0'));module[_0xc730('0x1')]={'name':{'type':Sequelize[_0xc730('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xc730('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 3e371e3..93d0fe4 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 _0x6017=['length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','show','keys','find','catch','create','body','destroy','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','error','stack','name','index','map','UserProfileResource','rawAttributes','type','key','model','query','filters','intersection','fields','attributes'];(function(_0x594da2,_0x243cc5){var _0x3d0535=function(_0x106c0c){while(--_0x106c0c){_0x594da2['push'](_0x594da2['shift']());}};_0x3d0535(++_0x243cc5);}(_0x6017,0xae));var _0x7601=function(_0x55a06a,_0x4c30dc){_0x55a06a=_0x55a06a-0x0;var _0x425907=_0x6017[_0x55a06a];return _0x425907;};'use strict';var emlformat=require(_0x7601('0x0'));var rimraf=require(_0x7601('0x1'));var zipdir=require(_0x7601('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7601('0x3'));var moment=require(_0x7601('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7601('0x5'));var util=require('util');var path=require(_0x7601('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7601('0x7'));var fs=require('fs');var fs_extra=require(_0x7601('0x8'));var _=require(_0x7601('0x9'));var squel=require(_0x7601('0xa'));var crypto=require(_0x7601('0xb'));var jsforce=require(_0x7601('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7601('0xd'));var querystring=require(_0x7601('0xe'));var Papa=require(_0x7601('0xf'));var Redis=require('ioredis');var authService=require(_0x7601('0x10'));var qs=require(_0x7601('0x11'));var as=require(_0x7601('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7601('0x13'))(_0x7601('0x14'));var utils=require(_0x7601('0x15'));var config=require(_0x7601('0x16'));var licenseUtil=require(_0x7601('0x17'));var db=require(_0x7601('0x18'))['db'];function respondWithStatusCode(_0x4001af,_0x1e2027){_0x1e2027=_0x1e2027||0xcc;return function(_0x2f5dbf){if(_0x2f5dbf){return _0x4001af[_0x7601('0x19')](_0x1e2027);}return _0x4001af['status'](_0x1e2027)[_0x7601('0x1a')]();};}function respondWithResult(_0x5ee63a,_0x4be36a){_0x4be36a=_0x4be36a||0xc8;return function(_0x2b8cbc){if(_0x2b8cbc){return _0x5ee63a[_0x7601('0x1b')](_0x4be36a)[_0x7601('0x1c')](_0x2b8cbc);}};}function respondWithFilteredResult(_0x33452d,_0x30b86d){return function(_0x3a1706){if(_0x3a1706){var _0xdd9b16=typeof _0x30b86d[_0x7601('0x1d')]==='undefined'&&typeof _0x30b86d[_0x7601('0x1e')]===_0x7601('0x1f');var _0x5329e6=_0x3a1706[_0x7601('0x20')];var _0x5c3fb7=_0xdd9b16?0x0:_0x30b86d['offset'];var _0x22520e=_0xdd9b16?_0x3a1706[_0x7601('0x20')]:_0x30b86d[_0x7601('0x1d')]+_0x30b86d[_0x7601('0x1e')];var _0x26f1b8;if(_0x22520e>=_0x5329e6){_0x22520e=_0x5329e6;_0x26f1b8=0xc8;}else{_0x26f1b8=0xce;}_0x33452d[_0x7601('0x1b')](_0x26f1b8);return _0x33452d[_0x7601('0x21')]('Content-Range',_0x5c3fb7+'-'+_0x22520e+'/'+_0x5329e6)[_0x7601('0x1c')](_0x3a1706);}return null;};}function patchUpdates(_0x1d58c0){return function(_0x4ed321){try{jsonpatch[_0x7601('0x22')](_0x4ed321,_0x1d58c0,!![]);}catch(_0x5169c9){return BPromise[_0x7601('0x23')](_0x5169c9);}return _0x4ed321[_0x7601('0x24')]();};}function saveUpdates(_0x99ab5b,_0x12f3f6){return function(_0x4cbf1e){if(_0x4cbf1e){return _0x4cbf1e[_0x7601('0x25')](_0x99ab5b)[_0x7601('0x26')](function(_0x140547){return _0x140547;});}return null;};}function removeEntity(_0x3a3629,_0x57e7a6){return function(_0x2b9bd){if(_0x2b9bd){return _0x2b9bd['destroy']()[_0x7601('0x26')](function(){_0x3a3629['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x326f8f,_0x1eb68c){return function(_0x5277d0){if(!_0x5277d0){_0x326f8f['sendStatus'](0x194);}return _0x5277d0;};}function handleError(_0x47644a,_0x519e47){_0x519e47=_0x519e47||0x1f4;return function(_0x57f6e9){logger[_0x7601('0x27')](_0x57f6e9[_0x7601('0x28')]);if(_0x57f6e9[_0x7601('0x29')]){delete _0x57f6e9['name'];}_0x47644a[_0x7601('0x1b')](_0x519e47)['send'](_0x57f6e9);};}exports[_0x7601('0x2a')]=function(_0xa05dda,_0x58fd92){var _0x4ab32d={},_0x44d765={},_0x13e8a7={'count':0x0,'rows':[]};var _0x1a2b2f=_[_0x7601('0x2b')](db[_0x7601('0x2c')][_0x7601('0x2d')],function(_0x5b961c){return{'name':_0x5b961c['fieldName'],'type':_0x5b961c[_0x7601('0x2e')][_0x7601('0x2f')]};});_0x44d765[_0x7601('0x30')]=_[_0x7601('0x2b')](_0x1a2b2f,_0x7601('0x29'));_0x44d765['query']=_['keys'](_0xa05dda[_0x7601('0x31')]);_0x44d765[_0x7601('0x32')]=_[_0x7601('0x33')](_0x44d765[_0x7601('0x30')],_0x44d765[_0x7601('0x31')]);_0x4ab32d['attributes']=_[_0x7601('0x33')](_0x44d765[_0x7601('0x30')],qs['fields'](_0xa05dda[_0x7601('0x31')][_0x7601('0x34')]));_0x4ab32d[_0x7601('0x35')]=_0x4ab32d[_0x7601('0x35')][_0x7601('0x36')]?_0x4ab32d['attributes']:_0x44d765[_0x7601('0x30')];if(!_0xa05dda[_0x7601('0x31')][_0x7601('0x37')](_0x7601('0x38'))){_0x4ab32d['limit']=qs[_0x7601('0x1e')](_0xa05dda['query']['limit']);_0x4ab32d[_0x7601('0x1d')]=qs[_0x7601('0x1d')](_0xa05dda[_0x7601('0x31')][_0x7601('0x1d')]);}_0x4ab32d[_0x7601('0x39')]=qs[_0x7601('0x3a')](_0xa05dda[_0x7601('0x31')][_0x7601('0x3a')]);_0x4ab32d[_0x7601('0x3b')]=qs[_0x7601('0x32')](_[_0x7601('0x3c')](_0xa05dda[_0x7601('0x31')],_0x44d765[_0x7601('0x32')]),_0x1a2b2f);if(_0xa05dda[_0x7601('0x31')]['filter']){_0x4ab32d[_0x7601('0x3b')]=_[_0x7601('0x3d')](_0x4ab32d[_0x7601('0x3b')],{'$or':_[_0x7601('0x2b')](_0x1a2b2f,function(_0x1bc502){if(_0x1bc502[_0x7601('0x2e')]!=='VIRTUAL'){var _0x3f32a2={};_0x3f32a2[_0x1bc502[_0x7601('0x29')]]={'$like':'%'+_0xa05dda['query'][_0x7601('0x3e')]+'%'};return _0x3f32a2;}})});}_0x4ab32d=_['merge']({},_0x4ab32d,_0xa05dda[_0x7601('0x3f')]);var _0x56e78b={'where':_0x4ab32d['where']};return db['UserProfileResource'][_0x7601('0x20')](_0x56e78b)[_0x7601('0x26')](function(_0x434b90){_0x13e8a7[_0x7601('0x20')]=_0x434b90;if(_0xa05dda['query'][_0x7601('0x40')]){_0x4ab32d['include']=[{'all':!![]}];}return db[_0x7601('0x2c')][_0x7601('0x41')](_0x4ab32d);})[_0x7601('0x26')](function(_0xdf4ed){_0x13e8a7[_0x7601('0x42')]=_0xdf4ed;return _0x13e8a7;})[_0x7601('0x26')](respondWithFilteredResult(_0x58fd92,_0x4ab32d))['catch'](handleError(_0x58fd92,null));};exports[_0x7601('0x43')]=function(_0x5c2f8e,_0x81b852){var _0xa5fa08={'raw':![],'where':{'id':_0x5c2f8e['params']['id']}},_0x58fd23={};_0x58fd23['model']=_['keys'](db[_0x7601('0x2c')][_0x7601('0x2d')]);_0x58fd23[_0x7601('0x31')]=_[_0x7601('0x44')](_0x5c2f8e[_0x7601('0x31')]);_0x58fd23[_0x7601('0x32')]=_[_0x7601('0x33')](_0x58fd23[_0x7601('0x30')],_0x58fd23[_0x7601('0x31')]);_0xa5fa08[_0x7601('0x35')]=_[_0x7601('0x33')](_0x58fd23[_0x7601('0x30')],qs[_0x7601('0x34')](_0x5c2f8e[_0x7601('0x31')][_0x7601('0x34')]));_0xa5fa08[_0x7601('0x35')]=_0xa5fa08['attributes'][_0x7601('0x36')]?_0xa5fa08[_0x7601('0x35')]:_0x58fd23[_0x7601('0x30')];if(_0x5c2f8e[_0x7601('0x31')][_0x7601('0x40')]){_0xa5fa08['include']=[{'all':!![]}];}_0xa5fa08=_[_0x7601('0x3d')]({},_0xa5fa08,_0x5c2f8e['options']);return db[_0x7601('0x2c')][_0x7601('0x45')](_0xa5fa08)['then'](handleEntityNotFound(_0x81b852,null))['then'](respondWithResult(_0x81b852,null))[_0x7601('0x46')](handleError(_0x81b852,null));};exports[_0x7601('0x47')]=function(_0x29aafa,_0x2b8ec1){return db[_0x7601('0x2c')][_0x7601('0x47')](_0x29aafa['body'],{})[_0x7601('0x26')](respondWithResult(_0x2b8ec1,0xc9))['catch'](handleError(_0x2b8ec1,null));};exports['update']=function(_0x2c3b10,_0x16c01c){if(_0x2c3b10[_0x7601('0x48')]['id']){delete _0x2c3b10['body']['id'];}return db[_0x7601('0x2c')][_0x7601('0x45')]({'where':{'id':_0x2c3b10['params']['id']}})[_0x7601('0x26')](handleEntityNotFound(_0x16c01c,null))[_0x7601('0x26')](saveUpdates(_0x2c3b10[_0x7601('0x48')],null))[_0x7601('0x26')](respondWithResult(_0x16c01c,null))[_0x7601('0x46')](handleError(_0x16c01c,null));};exports[_0x7601('0x49')]=function(_0x25582b,_0x5e6f25){return db[_0x7601('0x2c')][_0x7601('0x45')]({'where':{'id':_0x25582b[_0x7601('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5e6f25,null))[_0x7601('0x26')](removeEntity(_0x5e6f25,null))[_0x7601('0x46')](handleError(_0x5e6f25,null));};exports[_0x7601('0x4b')]=function(_0x8a5747,_0x3df2c2){return db['UserProfileResource'][_0x7601('0x4b')]()[_0x7601('0x26')](respondWithResult(_0x3df2c2,null))[_0x7601('0x46')](handleError(_0x3df2c2,null));}; \ No newline at end of file +var _0xc224=['options','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','send','map','UserProfileResource','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0xc224,0x1af));var _0x4c22=function(_0x20566e,_0x3a922e){_0x20566e=_0x20566e-0x0;var _0x453391=_0xc224[_0x20566e];return _0x453391;};'use strict';var emlformat=require(_0x4c22('0x0'));var rimraf=require(_0x4c22('0x1'));var zipdir=require(_0x4c22('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c22('0x3'));var moment=require(_0x4c22('0x4'));var BPromise=require(_0x4c22('0x5'));var Mustache=require(_0x4c22('0x6'));var util=require(_0x4c22('0x7'));var path=require(_0x4c22('0x8'));var sox=require(_0x4c22('0x9'));var csv=require(_0x4c22('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4c22('0xb'));var crypto=require(_0x4c22('0xc'));var jsforce=require(_0x4c22('0xd'));var deskjs=require(_0x4c22('0xe'));var toCsv=require(_0x4c22('0xa'));var querystring=require(_0x4c22('0xf'));var Papa=require(_0x4c22('0x10'));var Redis=require('ioredis');var authService=require(_0x4c22('0x11'));var qs=require(_0x4c22('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c22('0x13'))(_0x4c22('0x14'));var utils=require(_0x4c22('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4c22('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x578baf,_0x503b18){_0x503b18=_0x503b18||0xcc;return function(_0x535c47){if(_0x535c47){return _0x578baf[_0x4c22('0x17')](_0x503b18);}return _0x578baf[_0x4c22('0x18')](_0x503b18)[_0x4c22('0x19')]();};}function respondWithResult(_0x4196ce,_0x480d97){_0x480d97=_0x480d97||0xc8;return function(_0x284441){if(_0x284441){return _0x4196ce[_0x4c22('0x18')](_0x480d97)[_0x4c22('0x1a')](_0x284441);}};}function respondWithFilteredResult(_0x31bbd0,_0x401089){return function(_0x5affbb){if(_0x5affbb){var _0x517d9a=typeof _0x401089[_0x4c22('0x1b')]===_0x4c22('0x1c')&&typeof _0x401089[_0x4c22('0x1d')]===_0x4c22('0x1c');var _0x32a9c4=_0x5affbb[_0x4c22('0x1e')];var _0x408f6f=_0x517d9a?0x0:_0x401089[_0x4c22('0x1b')];var _0x629d81=_0x517d9a?_0x5affbb['count']:_0x401089[_0x4c22('0x1b')]+_0x401089['limit'];var _0x5bce40;if(_0x629d81>=_0x32a9c4){_0x629d81=_0x32a9c4;_0x5bce40=0xc8;}else{_0x5bce40=0xce;}_0x31bbd0[_0x4c22('0x18')](_0x5bce40);return _0x31bbd0[_0x4c22('0x1f')](_0x4c22('0x20'),_0x408f6f+'-'+_0x629d81+'/'+_0x32a9c4)[_0x4c22('0x1a')](_0x5affbb);}return null;};}function patchUpdates(_0x373a46){return function(_0x28422d){try{jsonpatch['apply'](_0x28422d,_0x373a46,!![]);}catch(_0x152923){return BPromise['reject'](_0x152923);}return _0x28422d['save']();};}function saveUpdates(_0x3c5819,_0x335317){return function(_0x3eda16){if(_0x3eda16){return _0x3eda16[_0x4c22('0x21')](_0x3c5819)[_0x4c22('0x22')](function(_0x45cba2){return _0x45cba2;});}return null;};}function removeEntity(_0x351824,_0x38e6d5){return function(_0x29aedf){if(_0x29aedf){return _0x29aedf[_0x4c22('0x23')]()[_0x4c22('0x22')](function(){_0x351824[_0x4c22('0x18')](0xcc)[_0x4c22('0x19')]();});}};}function handleEntityNotFound(_0x2fa3d8,_0x365856){return function(_0x47ec7f){if(!_0x47ec7f){_0x2fa3d8[_0x4c22('0x17')](0x194);}return _0x47ec7f;};}function handleError(_0x17c6bc,_0x563336){_0x563336=_0x563336||0x1f4;return function(_0x3d15b9){logger[_0x4c22('0x24')](_0x3d15b9['stack']);if(_0x3d15b9[_0x4c22('0x25')]){delete _0x3d15b9[_0x4c22('0x25')];}_0x17c6bc[_0x4c22('0x18')](_0x563336)[_0x4c22('0x26')](_0x3d15b9);};}exports['index']=function(_0x2de117,_0x10e36a){var _0x254de7={},_0x55ca00={},_0x4ca3f4={'count':0x0,'rows':[]};var _0x24f42e=_[_0x4c22('0x27')](db[_0x4c22('0x28')][_0x4c22('0x29')],function(_0x875822){return{'name':_0x875822['fieldName'],'type':_0x875822[_0x4c22('0x2a')]['key']};});_0x55ca00['model']=_['map'](_0x24f42e,_0x4c22('0x25'));_0x55ca00[_0x4c22('0x2b')]=_[_0x4c22('0x2c')](_0x2de117[_0x4c22('0x2b')]);_0x55ca00[_0x4c22('0x2d')]=_[_0x4c22('0x2e')](_0x55ca00[_0x4c22('0x2f')],_0x55ca00[_0x4c22('0x2b')]);_0x254de7[_0x4c22('0x30')]=_[_0x4c22('0x2e')](_0x55ca00[_0x4c22('0x2f')],qs[_0x4c22('0x31')](_0x2de117['query']['fields']));_0x254de7[_0x4c22('0x30')]=_0x254de7[_0x4c22('0x30')][_0x4c22('0x32')]?_0x254de7[_0x4c22('0x30')]:_0x55ca00[_0x4c22('0x2f')];if(!_0x2de117[_0x4c22('0x2b')][_0x4c22('0x33')](_0x4c22('0x34'))){_0x254de7['limit']=qs['limit'](_0x2de117['query']['limit']);_0x254de7[_0x4c22('0x1b')]=qs[_0x4c22('0x1b')](_0x2de117[_0x4c22('0x2b')][_0x4c22('0x1b')]);}_0x254de7[_0x4c22('0x35')]=qs['sort'](_0x2de117[_0x4c22('0x2b')]['sort']);_0x254de7[_0x4c22('0x36')]=qs[_0x4c22('0x2d')](_[_0x4c22('0x37')](_0x2de117[_0x4c22('0x2b')],_0x55ca00[_0x4c22('0x2d')]),_0x24f42e);if(_0x2de117[_0x4c22('0x2b')][_0x4c22('0x38')]){_0x254de7[_0x4c22('0x36')]=_[_0x4c22('0x39')](_0x254de7[_0x4c22('0x36')],{'$or':_['map'](_0x24f42e,function(_0x4685f9){if(_0x4685f9[_0x4c22('0x2a')]!==_0x4c22('0x3a')){var _0x260879={};_0x260879[_0x4685f9[_0x4c22('0x25')]]={'$like':'%'+_0x2de117[_0x4c22('0x2b')][_0x4c22('0x38')]+'%'};return _0x260879;}})});}_0x254de7=_[_0x4c22('0x39')]({},_0x254de7,_0x2de117[_0x4c22('0x3b')]);var _0x5122e0={'where':_0x254de7[_0x4c22('0x36')]};return db[_0x4c22('0x28')][_0x4c22('0x1e')](_0x5122e0)[_0x4c22('0x22')](function(_0x499d41){_0x4ca3f4[_0x4c22('0x1e')]=_0x499d41;if(_0x2de117['query']['includeAll']){_0x254de7[_0x4c22('0x3c')]=[{'all':!![]}];}return db[_0x4c22('0x28')][_0x4c22('0x3d')](_0x254de7);})[_0x4c22('0x22')](function(_0x1afb4b){_0x4ca3f4[_0x4c22('0x3e')]=_0x1afb4b;return _0x4ca3f4;})['then'](respondWithFilteredResult(_0x10e36a,_0x254de7))[_0x4c22('0x3f')](handleError(_0x10e36a,null));};exports[_0x4c22('0x40')]=function(_0x8869b9,_0x18bb1f){var _0x572086={'raw':![],'where':{'id':_0x8869b9[_0x4c22('0x41')]['id']}},_0x575bbb={};_0x575bbb['model']=_[_0x4c22('0x2c')](db[_0x4c22('0x28')]['rawAttributes']);_0x575bbb['query']=_[_0x4c22('0x2c')](_0x8869b9['query']);_0x575bbb[_0x4c22('0x2d')]=_[_0x4c22('0x2e')](_0x575bbb['model'],_0x575bbb[_0x4c22('0x2b')]);_0x572086[_0x4c22('0x30')]=_[_0x4c22('0x2e')](_0x575bbb[_0x4c22('0x2f')],qs['fields'](_0x8869b9[_0x4c22('0x2b')]['fields']));_0x572086[_0x4c22('0x30')]=_0x572086[_0x4c22('0x30')][_0x4c22('0x32')]?_0x572086['attributes']:_0x575bbb[_0x4c22('0x2f')];if(_0x8869b9[_0x4c22('0x2b')]['includeAll']){_0x572086[_0x4c22('0x3c')]=[{'all':!![]}];}_0x572086=_['merge']({},_0x572086,_0x8869b9[_0x4c22('0x3b')]);return db[_0x4c22('0x28')][_0x4c22('0x42')](_0x572086)[_0x4c22('0x22')](handleEntityNotFound(_0x18bb1f,null))[_0x4c22('0x22')](respondWithResult(_0x18bb1f,null))['catch'](handleError(_0x18bb1f,null));};exports[_0x4c22('0x43')]=function(_0x44703a,_0x2c24cf){return db['UserProfileResource']['create'](_0x44703a[_0x4c22('0x44')],{})['then'](respondWithResult(_0x2c24cf,0xc9))[_0x4c22('0x3f')](handleError(_0x2c24cf,null));};exports[_0x4c22('0x21')]=function(_0xcd0034,_0x5e4802){if(_0xcd0034[_0x4c22('0x44')]['id']){delete _0xcd0034['body']['id'];}return db['UserProfileResource'][_0x4c22('0x42')]({'where':{'id':_0xcd0034[_0x4c22('0x41')]['id']}})['then'](handleEntityNotFound(_0x5e4802,null))[_0x4c22('0x22')](saveUpdates(_0xcd0034[_0x4c22('0x44')],null))[_0x4c22('0x22')](respondWithResult(_0x5e4802,null))[_0x4c22('0x3f')](handleError(_0x5e4802,null));};exports['destroy']=function(_0x1c4f9f,_0x8102d7){return db[_0x4c22('0x28')][_0x4c22('0x42')]({'where':{'id':_0x1c4f9f[_0x4c22('0x41')]['id']}})[_0x4c22('0x22')](handleEntityNotFound(_0x8102d7,null))[_0x4c22('0x22')](removeEntity(_0x8102d7,null))['catch'](handleError(_0x8102d7,null));};exports[_0x4c22('0x45')]=function(_0x143dad,_0x25a9a5){return db[_0x4c22('0x28')][_0x4c22('0x45')]()['then'](respondWithResult(_0x25a9a5,null))[_0x4c22('0x3f')](handleError(_0x25a9a5,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index b4fb073..300cbb0 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 _0x457b=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId'];(function(_0x2bd8a6,_0x5b9211){var _0x1e037a=function(_0x486e4b){while(--_0x486e4b){_0x2bd8a6['push'](_0x2bd8a6['shift']());}};_0x1e037a(++_0x5b9211);}(_0x457b,0x78));var _0xb457=function(_0x85c547,_0x3f565b){_0x85c547=_0x85c547-0x0;var _0x3a5b1f=_0x457b[_0x85c547];return _0x3a5b1f;};'use strict';var _=require(_0xb457('0x0'));var util=require(_0xb457('0x1'));var logger=require(_0xb457('0x2'))(_0xb457('0x3'));var moment=require('moment');var BPromise=require(_0xb457('0x4'));var rp=require(_0xb457('0x5'));var fs=require('fs');var path=require(_0xb457('0x6'));var rimraf=require(_0xb457('0x7'));var config=require(_0xb457('0x8'));var attributes=require('./userProfileResource.attributes');module[_0xb457('0x9')]=function(_0x55f67e,_0x3be09e){return _0x55f67e[_0xb457('0xa')](_0xb457('0xb'),attributes,{'tableName':_0xb457('0xc'),'paranoid':![],'indexes':[{'name':_0xb457('0xd'),'fields':[_0xb457('0xe'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f1e=['resourceId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex'];(function(_0x14f75f,_0x51d74d){var _0x55074a=function(_0x37df6b){while(--_0x37df6b){_0x14f75f['push'](_0x14f75f['shift']());}};_0x55074a(++_0x51d74d);}(_0x4f1e,0x1a5));var _0xe4f1=function(_0x2526b6,_0x5272bd){_0x2526b6=_0x2526b6-0x0;var _0x168b4e=_0x4f1e[_0x2526b6];return _0x168b4e;};'use strict';var _=require(_0xe4f1('0x0'));var util=require(_0xe4f1('0x1'));var logger=require('../../config/logger')(_0xe4f1('0x2'));var moment=require(_0xe4f1('0x3'));var BPromise=require(_0xe4f1('0x4'));var rp=require(_0xe4f1('0x5'));var fs=require('fs');var path=require(_0xe4f1('0x6'));var rimraf=require(_0xe4f1('0x7'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0xe4f1('0x8')]=function(_0x28573d,_0x7b58f8){return _0x28573d[_0xe4f1('0x9')](_0xe4f1('0xa'),attributes,{'tableName':_0xe4f1('0xb'),'paranoid':![],'indexes':[{'name':_0xe4f1('0xc'),'fields':[_0xe4f1('0xd'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index fa298bb..0299dc7 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 _0x3fcb=['http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x54f978,_0x3a6b7e){var _0x5d40b3=function(_0x44b545){while(--_0x44b545){_0x54f978['push'](_0x54f978['shift']());}};_0x5d40b3(++_0x3a6b7e);}(_0x3fcb,0x12b));var _0xb3fc=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x3fcb[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xb3fc('0x0'));var util=require(_0xb3fc('0x1'));var moment=require(_0xb3fc('0x2'));var BPromise=require(_0xb3fc('0x3'));var rs=require(_0xb3fc('0x4'));var fs=require('fs');var Redis=require(_0xb3fc('0x5'));var db=require(_0xb3fc('0x6'))['db'];var utils=require(_0xb3fc('0x7'));var logger=require(_0xb3fc('0x8'))(_0xb3fc('0x9'));var config=require(_0xb3fc('0xa'));var jayson=require(_0xb3fc('0xb'));var client=jayson[_0xb3fc('0xc')][_0xb3fc('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x309f86,_0x5d326f,_0x155127){return new BPromise(function(_0x12973f,_0x3e2fb6){return client['request'](_0x309f86,_0x155127)[_0xb3fc('0xe')](function(_0x2aa631){logger[_0xb3fc('0xf')](_0xb3fc('0x10'),_0x5d326f,_0xb3fc('0x11'));logger[_0xb3fc('0x12')](_0xb3fc('0x13'),_0x5d326f,_0xb3fc('0x11'),JSON[_0xb3fc('0x14')](_0x2aa631));if(_0x2aa631[_0xb3fc('0x15')]){if(_0x2aa631[_0xb3fc('0x15')][_0xb3fc('0x16')]===0x1f4){logger[_0xb3fc('0x15')](_0xb3fc('0x10'),_0x5d326f,_0x2aa631['error'][_0xb3fc('0x17')]);return _0x3e2fb6(_0x2aa631['error'][_0xb3fc('0x17')]);}logger[_0xb3fc('0x15')](_0xb3fc('0x10'),_0x5d326f,_0x2aa631['error']['message']);return _0x12973f(_0x2aa631[_0xb3fc('0x15')][_0xb3fc('0x17')]);}else{logger[_0xb3fc('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x5d326f,_0xb3fc('0x11'));_0x12973f(_0x2aa631[_0xb3fc('0x18')]['message']);}})[_0xb3fc('0x19')](function(_0x5757b4){logger[_0xb3fc('0x15')]('UserProfileResource,\x20%s,\x20%s',_0x5d326f,_0x5757b4);_0x3e2fb6(_0x5757b4);});});} \ No newline at end of file +var _0x7c3d=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x59e050,_0x18f598){var _0x42da63=function(_0x4ab386){while(--_0x4ab386){_0x59e050['push'](_0x59e050['shift']());}};_0x42da63(++_0x18f598);}(_0x7c3d,0x13d));var _0xd7c3=function(_0x3b2c6f,_0xa9f35c){_0x3b2c6f=_0x3b2c6f-0x0;var _0x22e219=_0x7c3d[_0x3b2c6f];return _0x22e219;};'use strict';var _=require(_0xd7c3('0x0'));var util=require('util');var moment=require(_0xd7c3('0x1'));var BPromise=require(_0xd7c3('0x2'));var rs=require(_0xd7c3('0x3'));var fs=require('fs');var Redis=require(_0xd7c3('0x4'));var db=require(_0xd7c3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd7c3('0x6'))(_0xd7c3('0x7'));var config=require(_0xd7c3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd7c3('0x9')][_0xd7c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x420144,_0x1807a0,_0x1c0c9e){return new BPromise(function(_0x1b5051,_0x316de6){return client[_0xd7c3('0xb')](_0x420144,_0x1c0c9e)[_0xd7c3('0xc')](function(_0x5c862a){logger[_0xd7c3('0xd')](_0xd7c3('0xe'),_0x1807a0,_0xd7c3('0xf'));logger[_0xd7c3('0x10')](_0xd7c3('0x11'),_0x1807a0,'request\x20sent',JSON[_0xd7c3('0x12')](_0x5c862a));if(_0x5c862a[_0xd7c3('0x13')]){if(_0x5c862a[_0xd7c3('0x13')][_0xd7c3('0x14')]===0x1f4){logger[_0xd7c3('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x1807a0,_0x5c862a[_0xd7c3('0x13')][_0xd7c3('0x15')]);return _0x316de6(_0x5c862a['error'][_0xd7c3('0x15')]);}logger['error'](_0xd7c3('0xe'),_0x1807a0,_0x5c862a['error'][_0xd7c3('0x15')]);return _0x1b5051(_0x5c862a[_0xd7c3('0x13')][_0xd7c3('0x15')]);}else{logger['info'](_0xd7c3('0xe'),_0x1807a0,_0xd7c3('0xf'));_0x1b5051(_0x5c862a[_0xd7c3('0x16')][_0xd7c3('0x15')]);}})['catch'](function(_0x578625){logger[_0xd7c3('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x1807a0,_0x578625);_0x316de6(_0x578625);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 983d577..a12e954 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 _0xd55d=['../../components/auth/service','./userProfileSection.controller','index','get','/describe','describe','/:id','show','post','isAuthenticated','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x13f64,_0x5272be){var _0x4a6961=function(_0x34c051){while(--_0x34c051){_0x13f64['push'](_0x13f64['shift']());}};_0x4a6961(++_0x5272be);}(_0xd55d,0xa1));var _0xdd55=function(_0x56f0c6,_0x2de7ab){_0x56f0c6=_0x56f0c6-0x0;var _0x4a4a8d=_0xd55d[_0x56f0c6];return _0x4a4a8d;};'use strict';var multer=require(_0xdd55('0x0'));var util=require(_0xdd55('0x1'));var path=require(_0xdd55('0x2'));var timeout=require(_0xdd55('0x3'));var express=require(_0xdd55('0x4'));var router=express[_0xdd55('0x5')]();var fs_extra=require(_0xdd55('0x6'));var auth=require(_0xdd55('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdd55('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xdd55('0x9')]);router[_0xdd55('0xa')](_0xdd55('0xb'),auth['isAuthenticated'](),controller[_0xdd55('0xc')]);router[_0xdd55('0xa')](_0xdd55('0xd'),auth['isAuthenticated'](),controller[_0xdd55('0xe')]);router[_0xdd55('0xf')]('/',auth[_0xdd55('0x10')](),controller[_0xdd55('0x11')]);router[_0xdd55('0x12')](_0xdd55('0xd'),auth[_0xdd55('0x10')](),controller[_0xdd55('0x13')]);router['delete'](_0xdd55('0xd'),auth['isAuthenticated'](),controller[_0xdd55('0x14')]);module['exports']=router; \ No newline at end of file +var _0x316e=['describe','/:id','isAuthenticated','show','post','create','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','/describe'];(function(_0xb84195,_0x4d2bb5){var _0x42e759=function(_0x1e28a6){while(--_0x1e28a6){_0xb84195['push'](_0xb84195['shift']());}};_0x42e759(++_0x4d2bb5);}(_0x316e,0xcd));var _0xe316=function(_0x6c24e6,_0x4b4f7c){_0x6c24e6=_0x6c24e6-0x0;var _0x231b02=_0x316e[_0x6c24e6];return _0x231b02;};'use strict';var multer=require(_0xe316('0x0'));var util=require(_0xe316('0x1'));var path=require(_0xe316('0x2'));var timeout=require(_0xe316('0x3'));var express=require(_0xe316('0x4'));var router=express[_0xe316('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe316('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe316('0x7'));var controller=require(_0xe316('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe316('0x9')](_0xe316('0xa'),auth['isAuthenticated'](),controller[_0xe316('0xb')]);router[_0xe316('0x9')](_0xe316('0xc'),auth[_0xe316('0xd')](),controller[_0xe316('0xe')]);router[_0xe316('0xf')]('/',auth[_0xe316('0xd')](),controller[_0xe316('0x10')]);router['put'](_0xe316('0xc'),auth[_0xe316('0xd')](),controller[_0xe316('0x11')]);router['delete']('/:id',auth[_0xe316('0xd')](),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 e8503d3..c7afb84 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 _0xb6f1=['sequelize','STRING','INTEGER','BOOLEAN','crudPermissions','join','getDataValue','split'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xb6f1,0x118));var _0x1b6f=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0xb6f1[_0x2307fa];return _0x496486;};'use strict';var Sequelize=require(_0x1b6f('0x0'));module['exports']={'name':{'type':Sequelize[_0x1b6f('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x1b6f('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x1b6f('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x1b6f('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2cd276){this['setDataValue'](_0x1b6f('0x4'),_0x2cd276?_0x2cd276[_0x1b6f('0x5')](''):[]);},'get':function(){return this[_0x1b6f('0x6')]('crudPermissions')?this['getDataValue'](_0x1b6f('0x4'))[_0x1b6f('0x7')](''):[];}}}; \ No newline at end of file +var _0x833b=['split','exports','STRING','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x4dd747,_0x2c1d03){var _0x36890e=function(_0x569e66){while(--_0x569e66){_0x4dd747['push'](_0x4dd747['shift']());}};_0x36890e(++_0x2c1d03);}(_0x833b,0x131));var _0xb833=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x833b[_0x486f4a];return _0x135d99;};'use strict';var Sequelize=require('sequelize');module[_0xb833('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xb833('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xb833('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xb833('0x1')],'set':function(_0x37ea87){this[_0xb833('0x3')](_0xb833('0x4'),_0x37ea87?_0x37ea87[_0xb833('0x5')](''):[]);},'get':function(){return this[_0xb833('0x6')](_0xb833('0x4'))?this['getDataValue'](_0xb833('0x4'))[_0xb833('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 62ffabf..a3a514e 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 _0x8c3d=['UserProfileSection','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','map'];(function(_0x5c9499,_0x221b1){var _0x1370d4=function(_0x2a077a){while(--_0x2a077a){_0x5c9499['push'](_0x5c9499['shift']());}};_0x1370d4(++_0x221b1);}(_0x8c3d,0x1f0));var _0xd8c3=function(_0x4ea6ae,_0x2644d0){_0x4ea6ae=_0x4ea6ae-0x0;var _0x17704b=_0x8c3d[_0x4ea6ae];return _0x17704b;};'use strict';var emlformat=require(_0xd8c3('0x0'));var rimraf=require(_0xd8c3('0x1'));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(_0xd8c3('0x7'));var util=require(_0xd8c3('0x8'));var path=require(_0xd8c3('0x9'));var sox=require('sox');var csv=require(_0xd8c3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd8c3('0xb'));var _=require(_0xd8c3('0xc'));var squel=require(_0xd8c3('0xd'));var crypto=require(_0xd8c3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd8c3('0xa'));var querystring=require(_0xd8c3('0xf'));var Papa=require(_0xd8c3('0x10'));var Redis=require(_0xd8c3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd8c3('0x12'));var as=require(_0xd8c3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd8c3('0x14'))(_0xd8c3('0x15'));var utils=require(_0xd8c3('0x16'));var config=require(_0xd8c3('0x17'));var licenseUtil=require(_0xd8c3('0x18'));var db=require(_0xd8c3('0x19'))['db'];function respondWithStatusCode(_0x5257c5,_0x39b0bc){_0x39b0bc=_0x39b0bc||0xcc;return function(_0x26b0e5){if(_0x26b0e5){return _0x5257c5[_0xd8c3('0x1a')](_0x39b0bc);}return _0x5257c5[_0xd8c3('0x1b')](_0x39b0bc)[_0xd8c3('0x1c')]();};}function respondWithResult(_0x8fe8df,_0x498cf8){_0x498cf8=_0x498cf8||0xc8;return function(_0x56b75a){if(_0x56b75a){return _0x8fe8df['status'](_0x498cf8)[_0xd8c3('0x1d')](_0x56b75a);}};}function respondWithFilteredResult(_0x33ef6d,_0x1adc6a){return function(_0x3fa32d){if(_0x3fa32d){var _0x374fe5=typeof _0x1adc6a[_0xd8c3('0x1e')]===_0xd8c3('0x1f')&&typeof _0x1adc6a['limit']===_0xd8c3('0x1f');var _0x15c441=_0x3fa32d['count'];var _0x163fd1=_0x374fe5?0x0:_0x1adc6a[_0xd8c3('0x1e')];var _0x3c1553=_0x374fe5?_0x3fa32d['count']:_0x1adc6a['offset']+_0x1adc6a[_0xd8c3('0x20')];var _0x56c296;if(_0x3c1553>=_0x15c441){_0x3c1553=_0x15c441;_0x56c296=0xc8;}else{_0x56c296=0xce;}_0x33ef6d[_0xd8c3('0x1b')](_0x56c296);return _0x33ef6d[_0xd8c3('0x21')](_0xd8c3('0x22'),_0x163fd1+'-'+_0x3c1553+'/'+_0x15c441)[_0xd8c3('0x1d')](_0x3fa32d);}return null;};}function patchUpdates(_0x2b2658){return function(_0x2b8932){try{jsonpatch['apply'](_0x2b8932,_0x2b2658,!![]);}catch(_0x52b780){return BPromise[_0xd8c3('0x23')](_0x52b780);}return _0x2b8932[_0xd8c3('0x24')]();};}function saveUpdates(_0x5664d8,_0x34217c){return function(_0x1e0af6){if(_0x1e0af6){return _0x1e0af6[_0xd8c3('0x25')](_0x5664d8)[_0xd8c3('0x26')](function(_0x38adea){return _0x38adea;});}return null;};}function removeEntity(_0x3465d3,_0x201993){return function(_0x3ea237){if(_0x3ea237){return _0x3ea237[_0xd8c3('0x27')]()[_0xd8c3('0x26')](function(){_0x3465d3[_0xd8c3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b4e7c,_0xe24e45){return function(_0x22b302){if(!_0x22b302){_0x4b4e7c[_0xd8c3('0x1a')](0x194);}return _0x22b302;};}function handleError(_0x27601b,_0x279494){_0x279494=_0x279494||0x1f4;return function(_0x502edf){logger['error'](_0x502edf[_0xd8c3('0x28')]);if(_0x502edf['name']){delete _0x502edf[_0xd8c3('0x29')];}_0x27601b[_0xd8c3('0x1b')](_0x279494)['send'](_0x502edf);};}exports['index']=function(_0x521e0a,_0x255894){var _0x5aaa7f={},_0x539c4d={},_0x5486e3={'count':0x0,'rows':[]};var _0x2e8f89=_[_0xd8c3('0x2a')](db[_0xd8c3('0x2b')]['rawAttributes'],function(_0x2d63da){return{'name':_0x2d63da[_0xd8c3('0x2c')],'type':_0x2d63da[_0xd8c3('0x2d')][_0xd8c3('0x2e')]};});_0x539c4d['model']=_['map'](_0x2e8f89,_0xd8c3('0x29'));_0x539c4d['query']=_[_0xd8c3('0x2f')](_0x521e0a[_0xd8c3('0x30')]);_0x539c4d[_0xd8c3('0x31')]=_[_0xd8c3('0x32')](_0x539c4d[_0xd8c3('0x33')],_0x539c4d[_0xd8c3('0x30')]);_0x5aaa7f[_0xd8c3('0x34')]=_[_0xd8c3('0x32')](_0x539c4d[_0xd8c3('0x33')],qs[_0xd8c3('0x35')](_0x521e0a['query'][_0xd8c3('0x35')]));_0x5aaa7f[_0xd8c3('0x34')]=_0x5aaa7f[_0xd8c3('0x34')][_0xd8c3('0x36')]?_0x5aaa7f[_0xd8c3('0x34')]:_0x539c4d[_0xd8c3('0x33')];if(!_0x521e0a[_0xd8c3('0x30')][_0xd8c3('0x37')](_0xd8c3('0x38'))){_0x5aaa7f[_0xd8c3('0x20')]=qs[_0xd8c3('0x20')](_0x521e0a[_0xd8c3('0x30')][_0xd8c3('0x20')]);_0x5aaa7f[_0xd8c3('0x1e')]=qs[_0xd8c3('0x1e')](_0x521e0a[_0xd8c3('0x30')][_0xd8c3('0x1e')]);}_0x5aaa7f['order']=qs[_0xd8c3('0x39')](_0x521e0a[_0xd8c3('0x30')][_0xd8c3('0x39')]);_0x5aaa7f[_0xd8c3('0x3a')]=qs['filters'](_[_0xd8c3('0x3b')](_0x521e0a[_0xd8c3('0x30')],_0x539c4d[_0xd8c3('0x31')]),_0x2e8f89);if(_0x521e0a['query'][_0xd8c3('0x3c')]){_0x5aaa7f[_0xd8c3('0x3a')]=_['merge'](_0x5aaa7f[_0xd8c3('0x3a')],{'$or':_[_0xd8c3('0x2a')](_0x2e8f89,function(_0x3415e5){if(_0x3415e5[_0xd8c3('0x2d')]!==_0xd8c3('0x3d')){var _0x200832={};_0x200832[_0x3415e5[_0xd8c3('0x29')]]={'$like':'%'+_0x521e0a['query']['filter']+'%'};return _0x200832;}})});}_0x5aaa7f=_[_0xd8c3('0x3e')]({},_0x5aaa7f,_0x521e0a[_0xd8c3('0x3f')]);var _0xc7f04c={'where':_0x5aaa7f[_0xd8c3('0x3a')]};return db['UserProfileSection'][_0xd8c3('0x40')](_0xc7f04c)[_0xd8c3('0x26')](function(_0x53b6f6){_0x5486e3[_0xd8c3('0x40')]=_0x53b6f6;if(_0x521e0a[_0xd8c3('0x30')][_0xd8c3('0x41')]){_0x5aaa7f['include']=[{'all':!![]}];}return db[_0xd8c3('0x2b')][_0xd8c3('0x42')](_0x5aaa7f);})['then'](function(_0x4774c7){_0x5486e3[_0xd8c3('0x43')]=_0x4774c7;return _0x5486e3;})[_0xd8c3('0x26')](respondWithFilteredResult(_0x255894,_0x5aaa7f))[_0xd8c3('0x44')](handleError(_0x255894,null));};exports[_0xd8c3('0x45')]=function(_0x2d0d42,_0x54f3d8){var _0x2068e8={'raw':![],'where':{'id':_0x2d0d42[_0xd8c3('0x46')]['id']}},_0x2f553c={};_0x2f553c['model']=_[_0xd8c3('0x2f')](db[_0xd8c3('0x2b')][_0xd8c3('0x47')]);_0x2f553c['query']=_[_0xd8c3('0x2f')](_0x2d0d42[_0xd8c3('0x30')]);_0x2f553c[_0xd8c3('0x31')]=_['intersection'](_0x2f553c[_0xd8c3('0x33')],_0x2f553c[_0xd8c3('0x30')]);_0x2068e8[_0xd8c3('0x34')]=_[_0xd8c3('0x32')](_0x2f553c[_0xd8c3('0x33')],qs['fields'](_0x2d0d42[_0xd8c3('0x30')][_0xd8c3('0x35')]));_0x2068e8['attributes']=_0x2068e8[_0xd8c3('0x34')][_0xd8c3('0x36')]?_0x2068e8[_0xd8c3('0x34')]:_0x2f553c['model'];if(_0x2d0d42[_0xd8c3('0x30')][_0xd8c3('0x41')]){_0x2068e8[_0xd8c3('0x48')]=[{'all':!![]}];}_0x2068e8=_[_0xd8c3('0x3e')]({},_0x2068e8,_0x2d0d42[_0xd8c3('0x3f')]);return db[_0xd8c3('0x2b')][_0xd8c3('0x49')](_0x2068e8)[_0xd8c3('0x26')](handleEntityNotFound(_0x54f3d8,null))[_0xd8c3('0x26')](respondWithResult(_0x54f3d8,null))[_0xd8c3('0x44')](handleError(_0x54f3d8,null));};exports[_0xd8c3('0x4a')]=function(_0x1f9b4c,_0x1470db){return db['UserProfileSection'][_0xd8c3('0x4a')](_0x1f9b4c[_0xd8c3('0x4b')],{})[_0xd8c3('0x26')](respondWithResult(_0x1470db,0xc9))[_0xd8c3('0x44')](handleError(_0x1470db,null));};exports[_0xd8c3('0x25')]=function(_0x5212e0,_0x4eb171){if(_0x5212e0[_0xd8c3('0x4b')]['id']){delete _0x5212e0[_0xd8c3('0x4b')]['id'];}return db[_0xd8c3('0x2b')][_0xd8c3('0x49')]({'where':{'id':_0x5212e0['params']['id']}})[_0xd8c3('0x26')](handleEntityNotFound(_0x4eb171,null))[_0xd8c3('0x26')](saveUpdates(_0x5212e0[_0xd8c3('0x4b')],null))[_0xd8c3('0x26')](respondWithResult(_0x4eb171,null))[_0xd8c3('0x44')](handleError(_0x4eb171,null));};exports[_0xd8c3('0x27')]=function(_0x21f20a,_0x1177cb){return db[_0xd8c3('0x2b')][_0xd8c3('0x49')]({'where':{'id':_0x21f20a[_0xd8c3('0x46')]['id']}})['then'](handleEntityNotFound(_0x1177cb,null))[_0xd8c3('0x26')](removeEntity(_0x1177cb,null))['catch'](handleError(_0x1177cb,null));};exports[_0xd8c3('0x4c')]=function(_0x45b8cc,_0x202f6f){return db[_0xd8c3('0x2b')][_0xd8c3('0x4c')]()[_0xd8c3('0x26')](respondWithResult(_0x202f6f,null))[_0xd8c3('0x44')](handleError(_0x202f6f,null));}; \ No newline at end of file +var _0x0d93=['query','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','describe','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','save','update','then','destroy','error','stack','send','index','map','UserProfileSection','rawAttributes','fieldName','type','name'];(function(_0x3ef36b,_0x577f59){var _0x45b5e1=function(_0x3db5e2){while(--_0x3db5e2){_0x3ef36b['push'](_0x3ef36b['shift']());}};_0x45b5e1(++_0x577f59);}(_0x0d93,0x67));var _0x30d9=function(_0x4dd479,_0x26d87a){_0x4dd479=_0x4dd479-0x0;var _0x1b6807=_0x0d93[_0x4dd479];return _0x1b6807;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x30d9('0x0'));var zipdir=require(_0x30d9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x30d9('0x2'));var moment=require(_0x30d9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x30d9('0x4'));var util=require(_0x30d9('0x5'));var path=require(_0x30d9('0x6'));var sox=require(_0x30d9('0x7'));var csv=require(_0x30d9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x30d9('0x9'));var _=require('lodash');var squel=require(_0x30d9('0xa'));var crypto=require(_0x30d9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x30d9('0xc'));var toCsv=require(_0x30d9('0x8'));var querystring=require(_0x30d9('0xd'));var Papa=require(_0x30d9('0xe'));var Redis=require(_0x30d9('0xf'));var authService=require(_0x30d9('0x10'));var qs=require(_0x30d9('0x11'));var as=require(_0x30d9('0x12'));var hardwareService=require(_0x30d9('0x13'));var logger=require(_0x30d9('0x14'))(_0x30d9('0x15'));var utils=require('../../config/utils');var config=require(_0x30d9('0x16'));var licenseUtil=require(_0x30d9('0x17'));var db=require(_0x30d9('0x18'))['db'];function respondWithStatusCode(_0xedd99d,_0x3c5873){_0x3c5873=_0x3c5873||0xcc;return function(_0x5ed680){if(_0x5ed680){return _0xedd99d[_0x30d9('0x19')](_0x3c5873);}return _0xedd99d[_0x30d9('0x1a')](_0x3c5873)[_0x30d9('0x1b')]();};}function respondWithResult(_0x16cb7e,_0x5e0909){_0x5e0909=_0x5e0909||0xc8;return function(_0x5b32ed){if(_0x5b32ed){return _0x16cb7e[_0x30d9('0x1a')](_0x5e0909)['json'](_0x5b32ed);}};}function respondWithFilteredResult(_0x4ce497,_0x31793d){return function(_0x127aad){if(_0x127aad){var _0x6df11e=typeof _0x31793d['offset']===_0x30d9('0x1c')&&typeof _0x31793d[_0x30d9('0x1d')]==='undefined';var _0x58442c=_0x127aad[_0x30d9('0x1e')];var _0x2d6a3d=_0x6df11e?0x0:_0x31793d[_0x30d9('0x1f')];var _0x22cca1=_0x6df11e?_0x127aad[_0x30d9('0x1e')]:_0x31793d[_0x30d9('0x1f')]+_0x31793d[_0x30d9('0x1d')];var _0x43317c;if(_0x22cca1>=_0x58442c){_0x22cca1=_0x58442c;_0x43317c=0xc8;}else{_0x43317c=0xce;}_0x4ce497[_0x30d9('0x1a')](_0x43317c);return _0x4ce497[_0x30d9('0x20')](_0x30d9('0x21'),_0x2d6a3d+'-'+_0x22cca1+'/'+_0x58442c)[_0x30d9('0x22')](_0x127aad);}return null;};}function patchUpdates(_0x428998){return function(_0xe0852){try{jsonpatch['apply'](_0xe0852,_0x428998,!![]);}catch(_0x356f5b){return BPromise['reject'](_0x356f5b);}return _0xe0852[_0x30d9('0x23')]();};}function saveUpdates(_0x577cbe,_0x3f942f){return function(_0x4fdd5e){if(_0x4fdd5e){return _0x4fdd5e[_0x30d9('0x24')](_0x577cbe)[_0x30d9('0x25')](function(_0x320636){return _0x320636;});}return null;};}function removeEntity(_0x78cc6,_0x553c6d){return function(_0x2dd8dc){if(_0x2dd8dc){return _0x2dd8dc[_0x30d9('0x26')]()[_0x30d9('0x25')](function(){_0x78cc6[_0x30d9('0x1a')](0xcc)[_0x30d9('0x1b')]();});}};}function handleEntityNotFound(_0x361dc4,_0x8cde3d){return function(_0x3d3534){if(!_0x3d3534){_0x361dc4[_0x30d9('0x19')](0x194);}return _0x3d3534;};}function handleError(_0x1eaca6,_0x5995e7){_0x5995e7=_0x5995e7||0x1f4;return function(_0x4cd073){logger[_0x30d9('0x27')](_0x4cd073[_0x30d9('0x28')]);if(_0x4cd073['name']){delete _0x4cd073['name'];}_0x1eaca6[_0x30d9('0x1a')](_0x5995e7)[_0x30d9('0x29')](_0x4cd073);};}exports[_0x30d9('0x2a')]=function(_0x45ed06,_0x4510e8){var _0x4ef96c={},_0x1a6943={},_0x1e4725={'count':0x0,'rows':[]};var _0x428b50=_[_0x30d9('0x2b')](db[_0x30d9('0x2c')][_0x30d9('0x2d')],function(_0x3756d4){return{'name':_0x3756d4[_0x30d9('0x2e')],'type':_0x3756d4[_0x30d9('0x2f')]['key']};});_0x1a6943['model']=_['map'](_0x428b50,_0x30d9('0x30'));_0x1a6943[_0x30d9('0x31')]=_['keys'](_0x45ed06[_0x30d9('0x31')]);_0x1a6943['filters']=_['intersection'](_0x1a6943[_0x30d9('0x32')],_0x1a6943[_0x30d9('0x31')]);_0x4ef96c[_0x30d9('0x33')]=_[_0x30d9('0x34')](_0x1a6943[_0x30d9('0x32')],qs[_0x30d9('0x35')](_0x45ed06[_0x30d9('0x31')][_0x30d9('0x35')]));_0x4ef96c[_0x30d9('0x33')]=_0x4ef96c['attributes'][_0x30d9('0x36')]?_0x4ef96c[_0x30d9('0x33')]:_0x1a6943[_0x30d9('0x32')];if(!_0x45ed06[_0x30d9('0x31')][_0x30d9('0x37')]('nolimit')){_0x4ef96c['limit']=qs[_0x30d9('0x1d')](_0x45ed06[_0x30d9('0x31')][_0x30d9('0x1d')]);_0x4ef96c[_0x30d9('0x1f')]=qs[_0x30d9('0x1f')](_0x45ed06['query'][_0x30d9('0x1f')]);}_0x4ef96c[_0x30d9('0x38')]=qs[_0x30d9('0x39')](_0x45ed06[_0x30d9('0x31')][_0x30d9('0x39')]);_0x4ef96c[_0x30d9('0x3a')]=qs[_0x30d9('0x3b')](_['pick'](_0x45ed06[_0x30d9('0x31')],_0x1a6943[_0x30d9('0x3b')]),_0x428b50);if(_0x45ed06[_0x30d9('0x31')][_0x30d9('0x3c')]){_0x4ef96c[_0x30d9('0x3a')]=_[_0x30d9('0x3d')](_0x4ef96c[_0x30d9('0x3a')],{'$or':_[_0x30d9('0x2b')](_0x428b50,function(_0x5c1ca){if(_0x5c1ca[_0x30d9('0x2f')]!==_0x30d9('0x3e')){var _0x4d6b86={};_0x4d6b86[_0x5c1ca[_0x30d9('0x30')]]={'$like':'%'+_0x45ed06[_0x30d9('0x31')][_0x30d9('0x3c')]+'%'};return _0x4d6b86;}})});}_0x4ef96c=_[_0x30d9('0x3d')]({},_0x4ef96c,_0x45ed06[_0x30d9('0x3f')]);var _0xad7988={'where':_0x4ef96c[_0x30d9('0x3a')]};return db[_0x30d9('0x2c')][_0x30d9('0x1e')](_0xad7988)['then'](function(_0x37cb55){_0x1e4725[_0x30d9('0x1e')]=_0x37cb55;if(_0x45ed06[_0x30d9('0x31')]['includeAll']){_0x4ef96c[_0x30d9('0x40')]=[{'all':!![]}];}return db['UserProfileSection'][_0x30d9('0x41')](_0x4ef96c);})['then'](function(_0x1b166f){_0x1e4725[_0x30d9('0x42')]=_0x1b166f;return _0x1e4725;})[_0x30d9('0x25')](respondWithFilteredResult(_0x4510e8,_0x4ef96c))[_0x30d9('0x43')](handleError(_0x4510e8,null));};exports[_0x30d9('0x44')]=function(_0x5226bd,_0x1df6a9){var _0x235c28={'raw':![],'where':{'id':_0x5226bd[_0x30d9('0x45')]['id']}},_0x557aa2={};_0x557aa2['model']=_['keys'](db[_0x30d9('0x2c')][_0x30d9('0x2d')]);_0x557aa2['query']=_[_0x30d9('0x46')](_0x5226bd[_0x30d9('0x31')]);_0x557aa2['filters']=_[_0x30d9('0x34')](_0x557aa2['model'],_0x557aa2[_0x30d9('0x31')]);_0x235c28[_0x30d9('0x33')]=_['intersection'](_0x557aa2['model'],qs[_0x30d9('0x35')](_0x5226bd[_0x30d9('0x31')][_0x30d9('0x35')]));_0x235c28[_0x30d9('0x33')]=_0x235c28[_0x30d9('0x33')][_0x30d9('0x36')]?_0x235c28[_0x30d9('0x33')]:_0x557aa2['model'];if(_0x5226bd[_0x30d9('0x31')][_0x30d9('0x47')]){_0x235c28[_0x30d9('0x40')]=[{'all':!![]}];}_0x235c28=_[_0x30d9('0x3d')]({},_0x235c28,_0x5226bd[_0x30d9('0x3f')]);return db[_0x30d9('0x2c')][_0x30d9('0x48')](_0x235c28)[_0x30d9('0x25')](handleEntityNotFound(_0x1df6a9,null))['then'](respondWithResult(_0x1df6a9,null))[_0x30d9('0x43')](handleError(_0x1df6a9,null));};exports[_0x30d9('0x49')]=function(_0x346af6,_0x1c60bd){return db[_0x30d9('0x2c')]['create'](_0x346af6[_0x30d9('0x4a')],{})['then'](respondWithResult(_0x1c60bd,0xc9))[_0x30d9('0x43')](handleError(_0x1c60bd,null));};exports[_0x30d9('0x24')]=function(_0x36f699,_0x3bf36e){if(_0x36f699[_0x30d9('0x4a')]['id']){delete _0x36f699[_0x30d9('0x4a')]['id'];}return db['UserProfileSection'][_0x30d9('0x48')]({'where':{'id':_0x36f699['params']['id']}})[_0x30d9('0x25')](handleEntityNotFound(_0x3bf36e,null))[_0x30d9('0x25')](saveUpdates(_0x36f699[_0x30d9('0x4a')],null))[_0x30d9('0x25')](respondWithResult(_0x3bf36e,null))[_0x30d9('0x43')](handleError(_0x3bf36e,null));};exports['destroy']=function(_0x1e860d,_0x55dfe9){return db[_0x30d9('0x2c')][_0x30d9('0x48')]({'where':{'id':_0x1e860d[_0x30d9('0x45')]['id']}})[_0x30d9('0x25')](handleEntityNotFound(_0x55dfe9,null))[_0x30d9('0x25')](removeEntity(_0x55dfe9,null))[_0x30d9('0x43')](handleError(_0x55dfe9,null));};exports[_0x30d9('0x4b')]=function(_0x10fe63,_0x1de10f){return db[_0x30d9('0x2c')][_0x30d9('0x4b')]()[_0x30d9('0x25')](respondWithResult(_0x1de10f,null))[_0x30d9('0x43')](handleError(_0x1de10f,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index a0ec1c5..5eee4f2 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 _0x2cb5=['path','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','../../config/logger','api','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2cb5,0x176));var _0x52cb=function(_0x408d22,_0x53eef9){_0x408d22=_0x408d22-0x0;var _0x58effd=_0x2cb5[_0x408d22];return _0x58effd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x52cb('0x0'))(_0x52cb('0x1'));var moment=require('moment');var BPromise=require(_0x52cb('0x2'));var rp=require(_0x52cb('0x3'));var fs=require('fs');var path=require(_0x52cb('0x4'));var rimraf=require('rimraf');var config=require(_0x52cb('0x5'));var attributes=require(_0x52cb('0x6'));module[_0x52cb('0x7')]=function(_0x397ff0,_0x55f25c){return _0x397ff0[_0x52cb('0x8')](_0x52cb('0x9'),attributes,{'tableName':_0x52cb('0xa'),'paranoid':![],'indexes':[{'name':_0x52cb('0xb'),'fields':[_0x52cb('0xc'),_0x52cb('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7f91=['moment','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7f91,0x172));var _0x17f9=function(_0x499ca5,_0x4986cf){_0x499ca5=_0x499ca5-0x0;var _0x7bfd9c=_0x7f91[_0x499ca5];return _0x7bfd9c;};'use strict';var _=require(_0x17f9('0x0'));var util=require(_0x17f9('0x1'));var logger=require(_0x17f9('0x2'))(_0x17f9('0x3'));var moment=require(_0x17f9('0x4'));var BPromise=require('bluebird');var rp=require(_0x17f9('0x5'));var fs=require('fs');var path=require(_0x17f9('0x6'));var rimraf=require(_0x17f9('0x7'));var config=require(_0x17f9('0x8'));var attributes=require(_0x17f9('0x9'));module[_0x17f9('0xa')]=function(_0x40fa3e,_0x59e5d3){return _0x40fa3e[_0x17f9('0xb')](_0x17f9('0xc'),attributes,{'tableName':_0x17f9('0xd'),'paranoid':![],'indexes':[{'name':_0x17f9('0xe'),'fields':[_0x17f9('0xf'),_0x17f9('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 5247012..fd6707b 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 _0x8917=['info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x8917,0x1d7));var _0x7891=function(_0x530d09,_0x271064){_0x530d09=_0x530d09-0x0;var _0x5f0ff4=_0x8917[_0x530d09];return _0x5f0ff4;};'use strict';var _=require(_0x7891('0x0'));var util=require('util');var moment=require(_0x7891('0x1'));var BPromise=require(_0x7891('0x2'));var rs=require(_0x7891('0x3'));var fs=require('fs');var Redis=require(_0x7891('0x4'));var db=require(_0x7891('0x5'))['db'];var utils=require(_0x7891('0x6'));var logger=require(_0x7891('0x7'))(_0x7891('0x8'));var config=require(_0x7891('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7891('0xa')][_0x7891('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x442944,_0x381e20,_0x4722b7){return new BPromise(function(_0x452a6d,_0x51b08e){return client[_0x7891('0xc')](_0x442944,_0x4722b7)['then'](function(_0x137169){logger[_0x7891('0xd')](_0x7891('0xe'),_0x381e20,_0x7891('0xf'));logger[_0x7891('0x10')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x381e20,_0x7891('0xf'),JSON[_0x7891('0x11')](_0x137169));if(_0x137169[_0x7891('0x12')]){if(_0x137169['error'][_0x7891('0x13')]===0x1f4){logger[_0x7891('0x12')](_0x7891('0xe'),_0x381e20,_0x137169[_0x7891('0x12')][_0x7891('0x14')]);return _0x51b08e(_0x137169['error'][_0x7891('0x14')]);}logger[_0x7891('0x12')](_0x7891('0xe'),_0x381e20,_0x137169[_0x7891('0x12')][_0x7891('0x14')]);return _0x452a6d(_0x137169[_0x7891('0x12')]['message']);}else{logger[_0x7891('0xd')](_0x7891('0xe'),_0x381e20,'request\x20sent');_0x452a6d(_0x137169[_0x7891('0x15')][_0x7891('0x14')]);}})['catch'](function(_0x44e17b){logger[_0x7891('0x12')](_0x7891('0xe'),_0x381e20,_0x44e17b);_0x51b08e(_0x44e17b);});});} \ No newline at end of file +var _0xac20=['../../config/logger','rpc','../../config/environment','http','request','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xac20,0x9a));var _0x0ac2=function(_0x4c6e2b,_0x381bb3){_0x4c6e2b=_0x4c6e2b-0x0;var _0x318b02=_0xac20[_0x4c6e2b];return _0x318b02;};'use strict';var _=require(_0x0ac2('0x0'));var util=require(_0x0ac2('0x1'));var moment=require(_0x0ac2('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ac2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ac2('0x4'))['db'];var utils=require(_0x0ac2('0x5'));var logger=require(_0x0ac2('0x6'))(_0x0ac2('0x7'));var config=require(_0x0ac2('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0ac2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x84bdac,_0x259717,_0x16a9b6){return new BPromise(function(_0x14c023,_0x3a1c71){return client[_0x0ac2('0xa')](_0x84bdac,_0x16a9b6)['then'](function(_0xd64c79){logger[_0x0ac2('0xb')](_0x0ac2('0xc'),_0x259717,'request\x20sent');logger[_0x0ac2('0xd')](_0x0ac2('0xe'),_0x259717,_0x0ac2('0xf'),JSON[_0x0ac2('0x10')](_0xd64c79));if(_0xd64c79[_0x0ac2('0x11')]){if(_0xd64c79[_0x0ac2('0x11')]['code']===0x1f4){logger[_0x0ac2('0x11')](_0x0ac2('0xc'),_0x259717,_0xd64c79[_0x0ac2('0x11')][_0x0ac2('0x12')]);return _0x3a1c71(_0xd64c79[_0x0ac2('0x11')][_0x0ac2('0x12')]);}logger[_0x0ac2('0x11')](_0x0ac2('0xc'),_0x259717,_0xd64c79[_0x0ac2('0x11')][_0x0ac2('0x12')]);return _0x14c023(_0xd64c79[_0x0ac2('0x11')][_0x0ac2('0x12')]);}else{logger['info'](_0x0ac2('0xc'),_0x259717,_0x0ac2('0xf'));_0x14c023(_0xd64c79['result'][_0x0ac2('0x12')]);}})[_0x0ac2('0x13')](function(_0x20b23f){logger[_0x0ac2('0x11')](_0x0ac2('0xc'),_0x259717,_0x20b23f);_0x3a1c71(_0x20b23f);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 06008f8..c9303b4 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 _0xab95=['multer','util','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x4e5860,_0x1f8a4a){var _0xc8484d=function(_0x1b54f5){while(--_0x1b54f5){_0x4e5860['push'](_0x4e5860['shift']());}};_0xc8484d(++_0x1f8a4a);}(_0xab95,0x1d5));var _0x5ab9=function(_0x1c1e84,_0x1558b1){_0x1c1e84=_0x1c1e84-0x0;var _0x1b3d2e=_0xab95[_0x1c1e84];return _0x1b3d2e;};'use strict';var multer=require(_0x5ab9('0x0'));var util=require(_0x5ab9('0x1'));var path=require(_0x5ab9('0x2'));var timeout=require('connect-timeout');var express=require(_0x5ab9('0x3'));var router=express[_0x5ab9('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5ab9('0x5'));var config=require(_0x5ab9('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c1d=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1bc155,_0xb1dbdd){var _0x45ca88=function(_0x16d218){while(--_0x16d218){_0x1bc155['push'](_0x1bc155['shift']());}};_0x45ca88(++_0xb1dbdd);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x3a3e93,_0x2c1de2){_0x3a3e93=_0x3a3e93-0x0;var _0x2e9436=_0x9c1d[_0x3a3e93];return _0x2e9436;};'use strict';var multer=require(_0xd9c1('0x0'));var util=require(_0xd9c1('0x1'));var path=require(_0xd9c1('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9c1('0x3'));var router=express[_0xd9c1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd9c1('0x5'));var interaction=require(_0xd9c1('0x6'));var config=require('../../config/environment');module[_0xd9c1('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index b29b54b..f4be045 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 _0xbaf0=['exports','INTEGER'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x43ab3c,_0x4d003a){var _0x3580b1=function(_0x5cba61){while(--_0x5cba61){_0x43ab3c['push'](_0x43ab3c['shift']());}};_0x3580b1(++_0x4d003a);}(_0xe706,0xa3));var _0x6e70=function(_0x3bf957,_0x168c65){_0x3bf957=_0x3bf957-0x0;var _0x551cc=_0xe706[_0x3bf957];return _0x551cc;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('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 9fc00f2..633f1fa 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 _0x39e5=['UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x21e805,_0x5abf82){var _0x172ba8=function(_0x983207){while(--_0x983207){_0x21e805['push'](_0x21e805['shift']());}};_0x172ba8(++_0x5abf82);}(_0x39e5,0xe6));var _0x539e=function(_0x5209a9,_0x10d0b4){_0x5209a9=_0x5209a9-0x0;var _0x273ff0=_0x39e5[_0x5209a9];return _0x273ff0;};'use strict';var _=require(_0x539e('0x0'));var util=require(_0x539e('0x1'));var logger=require(_0x539e('0x2'))(_0x539e('0x3'));var moment=require('moment');var BPromise=require(_0x539e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x539e('0x5'));var rimraf=require(_0x539e('0x6'));var config=require(_0x539e('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0x539e('0x8')]=function(_0x33943d,_0x3c5e79){return _0x33943d[_0x539e('0x9')](_0x539e('0xa'),attributes,{'tableName':_0x539e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0815=['user_has_sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','define'];(function(_0x16c1c9,_0x3e2b7f){var _0x5801be=function(_0x5bc0f3){while(--_0x5bc0f3){_0x16c1c9['push'](_0x16c1c9['shift']());}};_0x5801be(++_0x3e2b7f);}(_0x0815,0x177));var _0x5081=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0815[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5081('0x0'));var util=require(_0x5081('0x1'));var logger=require(_0x5081('0x2'))('api');var moment=require(_0x5081('0x3'));var BPromise=require(_0x5081('0x4'));var rp=require(_0x5081('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5081('0x6'));var config=require(_0x5081('0x7'));var attributes=require(_0x5081('0x8'));module['exports']=function(_0x44c402,_0x535b20){return _0x44c402[_0x5081('0x9')]('UserSmsQueue',attributes,{'tableName':_0x5081('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index eb43cfe..682644c 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 _0xa2a8=['client','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5811fc,_0xfc875b){var _0x334c01=function(_0x4bc155){while(--_0x4bc155){_0x5811fc['push'](_0x5811fc['shift']());}};_0x334c01(++_0xfc875b);}(_0xa2a8,0xd3));var _0x8a2a=function(_0x2e9b0f,_0xcf4e1c){_0x2e9b0f=_0x2e9b0f-0x0;var _0x7f6ea6=_0xa2a8[_0x2e9b0f];return _0x7f6ea6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8a2a('0x0'));var BPromise=require(_0x8a2a('0x1'));var rs=require(_0x8a2a('0x2'));var fs=require('fs');var Redis=require(_0x8a2a('0x3'));var db=require(_0x8a2a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a2a('0x5'))(_0x8a2a('0x6'));var config=require(_0x8a2a('0x7'));var jayson=require(_0x8a2a('0x8'));var client=jayson[_0x8a2a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32d864,_0x5c8ee0,_0x24c494){return new BPromise(function(_0x5def83,_0x1e2558){return client[_0x8a2a('0xa')](_0x32d864,_0x24c494)[_0x8a2a('0xb')](function(_0x378398){logger[_0x8a2a('0xc')](_0x8a2a('0xd'),_0x5c8ee0,_0x8a2a('0xe'));logger[_0x8a2a('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x5c8ee0,_0x8a2a('0xe'),JSON[_0x8a2a('0x10')](_0x378398));if(_0x378398[_0x8a2a('0x11')]){if(_0x378398[_0x8a2a('0x11')][_0x8a2a('0x12')]===0x1f4){logger[_0x8a2a('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x5c8ee0,_0x378398['error']['message']);return _0x1e2558(_0x378398['error'][_0x8a2a('0x13')]);}logger[_0x8a2a('0x11')](_0x8a2a('0xd'),_0x5c8ee0,_0x378398[_0x8a2a('0x11')][_0x8a2a('0x13')]);return _0x5def83(_0x378398[_0x8a2a('0x11')]['message']);}else{logger['info'](_0x8a2a('0xd'),_0x5c8ee0,'request\x20sent');_0x5def83(_0x378398[_0x8a2a('0x14')][_0x8a2a('0x13')]);}})[_0x8a2a('0x15')](function(_0x2bdf40){logger[_0x8a2a('0x11')](_0x8a2a('0xd'),_0x5c8ee0,_0x2bdf40);_0x1e2558(_0x2bdf40);});});} \ No newline at end of file +var _0xd480=['UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x263721,_0x10ce8e){var _0x5d503b=function(_0x10972a){while(--_0x10972a){_0x263721['push'](_0x263721['shift']());}};_0x5d503b(++_0x10ce8e);}(_0xd480,0x125));var _0x0d48=function(_0x51fa5a,_0x27091a){_0x51fa5a=_0x51fa5a-0x0;var _0x356211=_0xd480[_0x51fa5a];return _0x356211;};'use strict';var _=require(_0x0d48('0x0'));var util=require(_0x0d48('0x1'));var moment=require(_0x0d48('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d48('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d48('0x4'));var logger=require(_0x0d48('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0d48('0x6'));var client=jayson[_0x0d48('0x7')][_0x0d48('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d93c5,_0x3570bf,_0x14a069){return new BPromise(function(_0x1c6a7d,_0x433554){return client[_0x0d48('0x9')](_0x5d93c5,_0x14a069)[_0x0d48('0xa')](function(_0x1758ef){logger[_0x0d48('0xb')](_0x0d48('0xc'),_0x3570bf,_0x0d48('0xd'));logger[_0x0d48('0xe')](_0x0d48('0xf'),_0x3570bf,'request\x20sent',JSON[_0x0d48('0x10')](_0x1758ef));if(_0x1758ef[_0x0d48('0x11')]){if(_0x1758ef[_0x0d48('0x11')][_0x0d48('0x12')]===0x1f4){logger[_0x0d48('0x11')](_0x0d48('0xc'),_0x3570bf,_0x1758ef[_0x0d48('0x11')][_0x0d48('0x13')]);return _0x433554(_0x1758ef[_0x0d48('0x11')][_0x0d48('0x13')]);}logger['error'](_0x0d48('0xc'),_0x3570bf,_0x1758ef[_0x0d48('0x11')][_0x0d48('0x13')]);return _0x1c6a7d(_0x1758ef[_0x0d48('0x11')][_0x0d48('0x13')]);}else{logger[_0x0d48('0xb')](_0x0d48('0xc'),_0x3570bf,_0x0d48('0xd'));_0x1c6a7d(_0x1758ef[_0x0d48('0x14')][_0x0d48('0x13')]);}})[_0x0d48('0x15')](function(_0x43812b){logger[_0x0d48('0x11')](_0x0d48('0xc'),_0x3570bf,_0x43812b);_0x433554(_0x43812b);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 1a6a228..43fdf4b 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 _0xc224=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x8409e1,_0x52a92b){var _0x1e15e0=function(_0x2b6363){while(--_0x2b6363){_0x8409e1['push'](_0x8409e1['shift']());}};_0x1e15e0(++_0x52a92b);}(_0xc224,0x1af));var _0x4c22=function(_0x10b05f,_0x52d831){_0x10b05f=_0x10b05f-0x0;var _0x4607cf=_0xc224[_0x10b05f];return _0x4607cf;};'use strict';var multer=require(_0x4c22('0x0'));var util=require(_0x4c22('0x1'));var path=require(_0x4c22('0x2'));var timeout=require('connect-timeout');var express=require(_0x4c22('0x3'));var router=express[_0x4c22('0x4')]();var fs_extra=require(_0x4c22('0x5'));var auth=require(_0x4c22('0x6'));var interaction=require(_0x4c22('0x7'));var config=require(_0x4c22('0x8'));module[_0x4c22('0x9')]=router; \ No newline at end of file +var _0xd3f5=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout'];(function(_0x528736,_0x209104){var _0x26f3b3=function(_0x307922){while(--_0x307922){_0x528736['push'](_0x528736['shift']());}};_0x26f3b3(++_0x209104);}(_0xd3f5,0x147));var _0x5d3f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd3f5[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x5d3f('0x0'));var util=require(_0x5d3f('0x1'));var path=require('path');var timeout=require(_0x5d3f('0x2'));var express=require(_0x5d3f('0x3'));var router=express[_0x5d3f('0x4')]();var fs_extra=require(_0x5d3f('0x5'));var auth=require(_0x5d3f('0x6'));var interaction=require(_0x5d3f('0x7'));var config=require(_0x5d3f('0x8'));module[_0x5d3f('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index b1be1cb..4457cbe 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x3a678d,_0x573e43){var _0x47a148=function(_0x2f7b9d){while(--_0x2f7b9d){_0x3a678d['push'](_0x3a678d['shift']());}};_0x47a148(++_0x573e43);}(_0xe706,0xa3));var _0x6e70=function(_0x34c553,_0x3e7dfc){_0x34c553=_0x34c553-0x0;var _0x1357d2=_0xe706[_0x34c553];return _0x1357d2;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0xcb21d2,_0x509f98){var _0x3cccd5=function(_0x144608){while(--_0x144608){_0xcb21d2['push'](_0xcb21d2['shift']());}};_0x3cccd5(++_0x509f98);}(_0xe706,0xa3));var _0x6e70=function(_0x6287b6,_0x5682e7){_0x6287b6=_0x6287b6-0x0;var _0x5d6be4=_0xe706[_0x6287b6];return _0x5d6be4;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('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 b26be5c..1160732 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 _0x5089=['exports','UserVoiceQueue','user_has_voice_queues','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x549a81,_0x28f9c7){var _0x514df1=function(_0x1ed41c){while(--_0x1ed41c){_0x549a81['push'](_0x549a81['shift']());}};_0x514df1(++_0x28f9c7);}(_0x5089,0x1bb));var _0x9508=function(_0x4cefbc,_0x3ffa6c){_0x4cefbc=_0x4cefbc-0x0;var _0x423c86=_0x5089[_0x4cefbc];return _0x423c86;};'use strict';var _=require(_0x9508('0x0'));var util=require(_0x9508('0x1'));var logger=require('../../config/logger')(_0x9508('0x2'));var moment=require(_0x9508('0x3'));var BPromise=require(_0x9508('0x4'));var rp=require(_0x9508('0x5'));var fs=require('fs');var path=require(_0x9508('0x6'));var rimraf=require('rimraf');var config=require(_0x9508('0x7'));var attributes=require('./userVoiceQueue.attributes');module[_0x9508('0x8')]=function(_0x4538dd,_0x257318){return _0x4538dd['define'](_0x9508('0x9'),attributes,{'tableName':_0x9508('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2123=['request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x12fe9b,_0x2ce346){var _0x176236=function(_0x181cd6){while(--_0x181cd6){_0x12fe9b['push'](_0x12fe9b['shift']());}};_0x176236(++_0x2ce346);}(_0x2123,0x190));var _0x3212=function(_0x2f4173,_0x1f5d89){_0x2f4173=_0x2f4173-0x0;var _0x1f9f8d=_0x2123[_0x2f4173];return _0x1f9f8d;};'use strict';var _=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var logger=require(_0x3212('0x2'))(_0x3212('0x3'));var moment=require(_0x3212('0x4'));var BPromise=require(_0x3212('0x5'));var rp=require(_0x3212('0x6'));var fs=require('fs');var path=require(_0x3212('0x7'));var rimraf=require(_0x3212('0x8'));var config=require(_0x3212('0x9'));var attributes=require(_0x3212('0xa'));module[_0x3212('0xb')]=function(_0x5d9d36,_0x3859e4){return _0x5d9d36[_0x3212('0xc')](_0x3212('0xd'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index aeecb5b..36b968f 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 _0x72cb=['error','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x72cb,0xc1));var _0xb72c=function(_0x25b65e,_0x4d0a81){_0x25b65e=_0x25b65e-0x0;var _0x4fffb0=_0x72cb[_0x25b65e];return _0x4fffb0;};'use strict';var _=require(_0xb72c('0x0'));var util=require(_0xb72c('0x1'));var moment=require(_0xb72c('0x2'));var BPromise=require(_0xb72c('0x3'));var rs=require(_0xb72c('0x4'));var fs=require('fs');var Redis=require(_0xb72c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb72c('0x6'));var config=require('../../config/environment');var jayson=require(_0xb72c('0x7'));var client=jayson[_0xb72c('0x8')][_0xb72c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10df15,_0x8ac394,_0x5a6db8){return new BPromise(function(_0x5a19f0,_0x50e949){return client[_0xb72c('0xa')](_0x10df15,_0x5a6db8)[_0xb72c('0xb')](function(_0xe7ee2e){logger[_0xb72c('0xc')](_0xb72c('0xd'),_0x8ac394,'request\x20sent');logger[_0xb72c('0xe')](_0xb72c('0xf'),_0x8ac394,'request\x20sent',JSON[_0xb72c('0x10')](_0xe7ee2e));if(_0xe7ee2e[_0xb72c('0x11')]){if(_0xe7ee2e[_0xb72c('0x11')]['code']===0x1f4){logger[_0xb72c('0x11')](_0xb72c('0xd'),_0x8ac394,_0xe7ee2e[_0xb72c('0x11')][_0xb72c('0x12')]);return _0x50e949(_0xe7ee2e[_0xb72c('0x11')][_0xb72c('0x12')]);}logger[_0xb72c('0x11')](_0xb72c('0xd'),_0x8ac394,_0xe7ee2e[_0xb72c('0x11')]['message']);return _0x5a19f0(_0xe7ee2e[_0xb72c('0x11')]['message']);}else{logger[_0xb72c('0xc')](_0xb72c('0xd'),_0x8ac394,_0xb72c('0x13'));_0x5a19f0(_0xe7ee2e[_0xb72c('0x14')]['message']);}})['catch'](function(_0xf99e9b){logger[_0xb72c('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x8ac394,_0xf99e9b);_0x50e949(_0xf99e9b);});});} \ No newline at end of file +var _0xc388=['randomstring','ioredis','../../config/utils','../../config/environment','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x1b63bd,_0x347ec0){var _0x109ce1=function(_0x525978){while(--_0x525978){_0x1b63bd['push'](_0x1b63bd['shift']());}};_0x109ce1(++_0x347ec0);}(_0xc388,0xe4));var _0x8c38=function(_0x5d0a40,_0x3dcb66){_0x5d0a40=_0x5d0a40-0x0;var _0x368fd2=_0xc388[_0x5d0a40];return _0x368fd2;};'use strict';var _=require(_0x8c38('0x0'));var util=require(_0x8c38('0x1'));var moment=require(_0x8c38('0x2'));var BPromise=require('bluebird');var rs=require(_0x8c38('0x3'));var fs=require('fs');var Redis=require(_0x8c38('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c38('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8c38('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8c38('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x319cf2,_0xcc4434,_0x31605e){return new BPromise(function(_0xfe9fc0,_0x4253d6){return client[_0x8c38('0x8')](_0x319cf2,_0x31605e)[_0x8c38('0x9')](function(_0x11c204){logger[_0x8c38('0xa')](_0x8c38('0xb'),_0xcc4434,_0x8c38('0xc'));logger[_0x8c38('0xd')](_0x8c38('0xe'),_0xcc4434,_0x8c38('0xc'),JSON[_0x8c38('0xf')](_0x11c204));if(_0x11c204[_0x8c38('0x10')]){if(_0x11c204[_0x8c38('0x10')][_0x8c38('0x11')]===0x1f4){logger[_0x8c38('0x10')](_0x8c38('0xb'),_0xcc4434,_0x11c204['error'][_0x8c38('0x12')]);return _0x4253d6(_0x11c204[_0x8c38('0x10')][_0x8c38('0x12')]);}logger[_0x8c38('0x10')](_0x8c38('0xb'),_0xcc4434,_0x11c204[_0x8c38('0x10')][_0x8c38('0x12')]);return _0xfe9fc0(_0x11c204[_0x8c38('0x10')][_0x8c38('0x12')]);}else{logger[_0x8c38('0xa')]('UserVoiceQueue,\x20%s,\x20%s',_0xcc4434,_0x8c38('0xc'));_0xfe9fc0(_0x11c204[_0x8c38('0x13')][_0x8c38('0x12')]);}})[_0x8c38('0x14')](function(_0x395d41){logger['error'](_0x8c38('0xb'),_0xcc4434,_0x395d41);_0x4253d6(_0x395d41);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 21fcad7..2582f53 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 _0x7a52=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout','express','Router'];(function(_0x3d09ea,_0x44b02d){var _0x46a443=function(_0x2204e4){while(--_0x2204e4){_0x3d09ea['push'](_0x3d09ea['shift']());}};_0x46a443(++_0x44b02d);}(_0x7a52,0x1bd));var _0x27a5=function(_0x72f334,_0x59d3f9){_0x72f334=_0x72f334-0x0;var _0x5eaaee=_0x7a52[_0x72f334];return _0x5eaaee;};'use strict';var multer=require(_0x27a5('0x0'));var util=require('util');var path=require(_0x27a5('0x1'));var timeout=require(_0x27a5('0x2'));var express=require(_0x27a5('0x3'));var router=express[_0x27a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x27a5('0x5'));var interaction=require(_0x27a5('0x6'));var config=require(_0x27a5('0x7'));module[_0x27a5('0x8')]=router; \ No newline at end of file +var _0x0e21=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4e61cd,_0x5e544b){var _0x404157=function(_0x9f6ca8){while(--_0x9f6ca8){_0x4e61cd['push'](_0x4e61cd['shift']());}};_0x404157(++_0x5e544b);}(_0x0e21,0xe8));var _0x10e2=function(_0x418796,_0x52de9c){_0x418796=_0x418796-0x0;var _0x2cf200=_0x0e21[_0x418796];return _0x2cf200;};'use strict';var multer=require('multer');var util=require(_0x10e2('0x0'));var path=require(_0x10e2('0x1'));var timeout=require(_0x10e2('0x2'));var express=require('express');var router=express[_0x10e2('0x3')]();var fs_extra=require(_0x10e2('0x4'));var auth=require(_0x10e2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x10e2('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index af05da1..49c7dd9 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 _0x7ddf=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x903228,_0x42c429){var _0xcec81d=function(_0x4da97a){while(--_0x4da97a){_0x903228['push'](_0x903228['shift']());}};_0xcec81d(++_0x42c429);}(_0x7ddf,0x16a));var _0xf7dd=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x7ddf[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0xf7dd('0x0'));module[_0xf7dd('0x1')]={'uniqueid':{'type':Sequelize[_0xf7dd('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xf7dd('0x3')},'membername':{'type':Sequelize[_0xf7dd('0x4')],'allowNull':![],'comment':_0xf7dd('0x3')},'UserId':{'type':Sequelize[_0xf7dd('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xf7dd('0x4')],'allowNull':![],'unique':_0xf7dd('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xf7dd('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xf7dd('0x4')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xf7dd('0x3')},'paused':{'type':Sequelize[_0xf7dd('0x2')](0xb),'defaultValue':0x0,'comment':_0xf7dd('0x3')}}; \ No newline at end of file +var _0x78e8=['queue_interface','sequelize','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x14c2df,_0x3d010f){var _0x579fcd=function(_0xf5c929){while(--_0xf5c929){_0x14c2df['push'](_0x14c2df['shift']());}};_0x579fcd(++_0x3d010f);}(_0x78e8,0x92));var _0x878e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x78e8[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x878e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x878e('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x878e('0x2')},'membername':{'type':Sequelize[_0x878e('0x3')],'allowNull':![],'comment':_0x878e('0x2')},'UserId':{'type':Sequelize[_0x878e('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x878e('0x3')],'allowNull':![],'unique':_0x878e('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x878e('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x878e('0x3')],'allowNull':![],'unique':_0x878e('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x878e('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x878e('0x1')](0xb),'defaultValue':0x0,'comment':_0x878e('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 1b1f539..38676ad 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 _0x2edc=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x199e73,_0x591c68){var _0x5ef5f4=function(_0x31fd62){while(--_0x31fd62){_0x199e73['push'](_0x199e73['shift']());}};_0x5ef5f4(++_0x591c68);}(_0x2edc,0x124));var _0xc2ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2edc[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xc2ed('0x0'));var UserVoiceQueueRt=require(_0xc2ed('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc2ed('0x2')](0x0);var events={'afterCreate':_0xc2ed('0x3'),'afterUpdate':_0xc2ed('0x4'),'afterDestroy':_0xc2ed('0x5')};function emitEvent(_0x14db22){return function(_0x20a65c,_0x4ed783,_0x13028e){UserVoiceQueueRtEvents[_0xc2ed('0x6')](_0x14db22+':'+_0x20a65c['id'],_0x20a65c);UserVoiceQueueRtEvents[_0xc2ed('0x6')](_0x14db22,_0x20a65c);_0x13028e(null);};}for(var e in events){if(events[_0xc2ed('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xc2ed('0x8')](e,emitEvent(event));}}module[_0xc2ed('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x3734=['UserVoiceQueueRt','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x1c64f0,_0x571699){var _0x27a137=function(_0x32ffab){while(--_0x32ffab){_0x1c64f0['push'](_0x1c64f0['shift']());}};_0x27a137(++_0x571699);}(_0x3734,0x15e));var _0x4373=function(_0x2e4008,_0x450740){_0x2e4008=_0x2e4008-0x0;var _0x3a611b=_0x3734[_0x2e4008];return _0x3a611b;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x4373('0x0'))['db'][_0x4373('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x4373('0x2')](0x0);var events={'afterCreate':_0x4373('0x3'),'afterUpdate':_0x4373('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4a0ee8){return function(_0x582277,_0x40f792,_0x511020){UserVoiceQueueRtEvents['emit'](_0x4a0ee8+':'+_0x582277['id'],_0x582277);UserVoiceQueueRtEvents[_0x4373('0x5')](_0x4a0ee8,_0x582277);_0x511020(null);};}for(var e in events){if(events[_0x4373('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x4373('0x7')](e,emitEvent(event));}}module[_0x4373('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 62a75d2..963886d 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 _0x5a65=['moment','request-promise','../../config/environment','exports','define','UserVoiceQueueRt','../../config/logger','api'];(function(_0x5a28e6,_0x2bd763){var _0x2314e9=function(_0x45883a){while(--_0x45883a){_0x5a28e6['push'](_0x5a28e6['shift']());}};_0x2314e9(++_0x2bd763);}(_0x5a65,0xb6));var _0x55a6=function(_0x2c43c8,_0x56232b){_0x2c43c8=_0x2c43c8-0x0;var _0x36fb34=_0x5a65[_0x2c43c8];return _0x36fb34;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x55a6('0x0'))(_0x55a6('0x1'));var moment=require(_0x55a6('0x2'));var BPromise=require('bluebird');var rp=require(_0x55a6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x55a6('0x4'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x55a6('0x5')]=function(_0x264213,_0x1b5a09){return _0x264213[_0x55a6('0x6')](_0x55a6('0x7'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfd3=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','lodash','util','../../config/logger'];(function(_0x5090a1,_0x98150f){var _0x2c0cdd=function(_0x167df3){while(--_0x167df3){_0x5090a1['push'](_0x5090a1['shift']());}};_0x2c0cdd(++_0x98150f);}(_0xcfd3,0x13f));var _0x3cfd=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0xcfd3[_0x14a862];return _0x245eb5;};'use strict';var _=require(_0x3cfd('0x0'));var util=require(_0x3cfd('0x1'));var logger=require(_0x3cfd('0x2'))(_0x3cfd('0x3'));var moment=require(_0x3cfd('0x4'));var BPromise=require(_0x3cfd('0x5'));var rp=require(_0x3cfd('0x6'));var fs=require('fs');var path=require(_0x3cfd('0x7'));var rimraf=require(_0x3cfd('0x8'));var config=require(_0x3cfd('0x9'));var attributes=require(_0x3cfd('0xa'));module[_0x3cfd('0xb')]=function(_0xa4c6d6,_0x311888){return _0xa4c6d6[_0x3cfd('0xc')]('UserVoiceQueueRt',attributes,{'tableName':_0x3cfd('0xd'),'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 1177862..9dcacad 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 _0x1c7a=['../../config/environment','jayson/promise','http','redis','defaults','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','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','literal','outboundQueuePauses','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1e8678,_0x488e6b){var _0x356e14=function(_0x5c5018){while(--_0x5c5018){_0x1e8678['push'](_0x1e8678['shift']());}};_0x356e14(++_0x488e6b);}(_0x1c7a,0x6c));var _0xa1c7=function(_0x15a5a8,_0x220c4d){_0x15a5a8=_0x15a5a8-0x0;var _0xe5cb8=_0x1c7a[_0x15a5a8];return _0xe5cb8;};'use strict';var _=require(_0xa1c7('0x0'));var util=require(_0xa1c7('0x1'));var moment=require(_0xa1c7('0x2'));var BPromise=require(_0xa1c7('0x3'));var rs=require(_0xa1c7('0x4'));var fs=require('fs');var Redis=require(_0xa1c7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa1c7('0x6'));var logger=require(_0xa1c7('0x7'))(_0xa1c7('0x8'));var config=require(_0xa1c7('0x9'));var jayson=require(_0xa1c7('0xa'));var client=jayson['client'][_0xa1c7('0xb')]({'port':0x232a});config[_0xa1c7('0xc')]=_[_0xa1c7('0xd')](config[_0xa1c7('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa1c7('0xe'))(new Redis(config[_0xa1c7('0xc')]));require(_0xa1c7('0xf'))[_0xa1c7('0x10')](socket);function respondWithRpcPromise(_0x290ec4,_0x51bbd5,_0x5c11a0){return new BPromise(function(_0x26ac0c,_0x4cd5b5){return client[_0xa1c7('0x11')](_0x290ec4,_0x5c11a0)[_0xa1c7('0x12')](function(_0x577707){logger[_0xa1c7('0x13')](_0xa1c7('0x14'),_0x51bbd5,_0xa1c7('0x15'));logger[_0xa1c7('0x16')](_0xa1c7('0x17'),_0x51bbd5,_0xa1c7('0x15'),JSON[_0xa1c7('0x18')](_0x577707));if(_0x577707[_0xa1c7('0x19')]){if(_0x577707['error'][_0xa1c7('0x1a')]===0x1f4){logger[_0xa1c7('0x19')](_0xa1c7('0x14'),_0x51bbd5,_0x577707[_0xa1c7('0x19')][_0xa1c7('0x1b')]);return _0x4cd5b5(_0x577707['error'][_0xa1c7('0x1b')]);}logger[_0xa1c7('0x19')](_0xa1c7('0x14'),_0x51bbd5,_0x577707[_0xa1c7('0x19')]['message']);return _0x26ac0c(_0x577707[_0xa1c7('0x19')][_0xa1c7('0x1b')]);}else{logger[_0xa1c7('0x13')](_0xa1c7('0x14'),_0x51bbd5,_0xa1c7('0x15'));_0x26ac0c(_0x577707[_0xa1c7('0x1c')]['message']);}})['catch'](function(_0x2c585d){logger['error'](_0xa1c7('0x14'),_0x51bbd5,_0x2c585d);_0x4cd5b5(_0x2c585d);});});}exports[_0xa1c7('0x1d')]=function(_0x7c57a2){var _0x52df2e=this;return new Promise(function(_0x53e7aa,_0xe668a0){return db[_0xa1c7('0x1e')][_0xa1c7('0x1f')]({'raw':_0x7c57a2[_0xa1c7('0x20')]?_0x7c57a2[_0xa1c7('0x20')][_0xa1c7('0x21')]===undefined?!![]:![]:!![],'where':_0x7c57a2[_0xa1c7('0x20')]?_0x7c57a2[_0xa1c7('0x20')][_0xa1c7('0x22')]||null:null,'attributes':[[db[_0xa1c7('0x23')]['fn']('COUNT',db[_0xa1c7('0x23')]['fn']('IF',db[_0xa1c7('0x23')][_0xa1c7('0x24')]('`paused`\x20=\x201,\x201,\x20null'))),_0xa1c7('0x25')]]})[_0xa1c7('0x12')](function(_0x5769e3){logger[_0xa1c7('0x13')](_0xa1c7('0x1d'),_0x7c57a2);logger[_0xa1c7('0x16')]('GetVoiceQueueRtPauses',_0x7c57a2,JSON[_0xa1c7('0x18')](_0x5769e3));_0x53e7aa(_0x5769e3);})[_0xa1c7('0x26')](function(_0x12e341){logger[_0xa1c7('0x19')](_0xa1c7('0x1d'),_0x12e341[_0xa1c7('0x1b')],_0x7c57a2);_0xe668a0(_0x52df2e[_0xa1c7('0x19')](0x1f4,_0x12e341[_0xa1c7('0x1b')]));});});}; \ No newline at end of file +var _0x699f=['where','sequelize','COUNT','outboundQueuePauses','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw'];(function(_0x1c55f1,_0x3669ca){var _0x44dd27=function(_0x531d3e){while(--_0x531d3e){_0x1c55f1['push'](_0x1c55f1['shift']());}};_0x44dd27(++_0x3669ca);}(_0x699f,0x80));var _0xf699=function(_0x5cbd7b,_0x207439){_0x5cbd7b=_0x5cbd7b-0x0;var _0x3fdfb8=_0x699f[_0x5cbd7b];return _0x3fdfb8;};'use strict';var _=require(_0xf699('0x0'));var util=require(_0xf699('0x1'));var moment=require(_0xf699('0x2'));var BPromise=require(_0xf699('0x3'));var rs=require(_0xf699('0x4'));var fs=require('fs');var Redis=require(_0xf699('0x5'));var db=require(_0xf699('0x6'))['db'];var utils=require(_0xf699('0x7'));var logger=require(_0xf699('0x8'))(_0xf699('0x9'));var config=require(_0xf699('0xa'));var jayson=require(_0xf699('0xb'));var client=jayson[_0xf699('0xc')][_0xf699('0xd')]({'port':0x232a});config[_0xf699('0xe')]=_[_0xf699('0xf')](config[_0xf699('0xe')],{'host':_0xf699('0x10'),'port':0x18eb});var socket=require(_0xf699('0x11'))(new Redis(config['redis']));require(_0xf699('0x12'))[_0xf699('0x13')](socket);function respondWithRpcPromise(_0x3e3232,_0x1c7725,_0x33a3d2){return new BPromise(function(_0x5f15a3,_0x2a6800){return client[_0xf699('0x14')](_0x3e3232,_0x33a3d2)[_0xf699('0x15')](function(_0x4a2784){logger[_0xf699('0x16')](_0xf699('0x17'),_0x1c7725,_0xf699('0x18'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x1c7725,'request\x20sent',JSON[_0xf699('0x19')](_0x4a2784));if(_0x4a2784[_0xf699('0x1a')]){if(_0x4a2784[_0xf699('0x1a')][_0xf699('0x1b')]===0x1f4){logger['error'](_0xf699('0x17'),_0x1c7725,_0x4a2784[_0xf699('0x1a')][_0xf699('0x1c')]);return _0x2a6800(_0x4a2784[_0xf699('0x1a')]['message']);}logger['error'](_0xf699('0x17'),_0x1c7725,_0x4a2784[_0xf699('0x1a')]['message']);return _0x5f15a3(_0x4a2784[_0xf699('0x1a')][_0xf699('0x1c')]);}else{logger[_0xf699('0x16')](_0xf699('0x17'),_0x1c7725,_0xf699('0x18'));_0x5f15a3(_0x4a2784[_0xf699('0x1d')]['message']);}})[_0xf699('0x1e')](function(_0x258e7c){logger[_0xf699('0x1a')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1c7725,_0x258e7c);_0x2a6800(_0x258e7c);});});}exports[_0xf699('0x1f')]=function(_0x389aa3){var _0x49d43f=this;return new Promise(function(_0xf42726,_0xc05449){return db[_0xf699('0x20')][_0xf699('0x21')]({'raw':_0x389aa3['options']?_0x389aa3[_0xf699('0x22')][_0xf699('0x23')]===undefined?!![]:![]:!![],'where':_0x389aa3[_0xf699('0x22')]?_0x389aa3['options'][_0xf699('0x24')]||null:null,'attributes':[[db[_0xf699('0x25')]['fn'](_0xf699('0x26'),db[_0xf699('0x25')]['fn']('IF',db[_0xf699('0x25')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0xf699('0x27')]]})['then'](function(_0x1bf948){logger[_0xf699('0x16')](_0xf699('0x1f'),_0x389aa3);logger[_0xf699('0x28')]('GetVoiceQueueRtPauses',_0x389aa3,JSON[_0xf699('0x19')](_0x1bf948));_0xf42726(_0x1bf948);})[_0xf699('0x1e')](function(_0x89076c){logger[_0xf699('0x1a')](_0xf699('0x1f'),_0x89076c[_0xf699('0x1c')],_0x389aa3);_0xc05449(_0x49d43f[_0xf699('0x1a')](0x1f4,_0x89076c[_0xf699('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 43795ff..558f6b2 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 _0x3b95=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update','emit','removeListener','register'];(function(_0x52ce3e,_0x25abc7){var _0x49f0ef=function(_0x108653){while(--_0x108653){_0x52ce3e['push'](_0x52ce3e['shift']());}};_0x49f0ef(++_0x25abc7);}(_0x3b95,0x1ca));var _0x53b9=function(_0x53051b,_0x2cc73f){_0x53051b=_0x53051b-0x0;var _0x285e4d=_0x3b95[_0x53051b];return _0x285e4d;};'use strict';var UserVoiceQueueRtEvents=require(_0x53b9('0x0'));var events=['save',_0x53b9('0x1'),_0x53b9('0x2')];function createListener(_0x1db5ea,_0x394dba){return function(_0x3de833){_0x394dba[_0x53b9('0x3')](_0x1db5ea,_0x3de833);};}function removeListener(_0x5b15cd,_0x579008){return function(){UserVoiceQueueRtEvents[_0x53b9('0x4')](_0x5b15cd,_0x579008);};}exports[_0x53b9('0x5')]=function(_0x4bc786){for(var _0x15987b=0x0,_0x8be8ab=events[_0x53b9('0x6')];_0x15987b<_0x8be8ab;_0x15987b++){var _0x485971=events[_0x15987b];var _0x48c8f6=createListener(_0x53b9('0x7')+_0x485971,_0x4bc786);UserVoiceQueueRtEvents['on'](_0x485971,_0x48c8f6);}}; \ No newline at end of file +var _0x55a2=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','register','length'];(function(_0x33276d,_0x46ad0a){var _0x17d78d=function(_0x561da6){while(--_0x561da6){_0x33276d['push'](_0x33276d['shift']());}};_0x17d78d(++_0x46ad0a);}(_0x55a2,0x109));var _0x255a=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0x55a2[_0x4226d6];return _0x19655b;};'use strict';var UserVoiceQueueRtEvents=require(_0x255a('0x0'));var events=[_0x255a('0x1'),_0x255a('0x2'),_0x255a('0x3')];function createListener(_0x20bf3b,_0x2cbc25){return function(_0x1e6bba){_0x2cbc25[_0x255a('0x4')](_0x20bf3b,_0x1e6bba);};}function removeListener(_0x6a73b8,_0x43ffee){return function(){UserVoiceQueueRtEvents['removeListener'](_0x6a73b8,_0x43ffee);};}exports[_0x255a('0x5')]=function(_0x4d4aa5){for(var _0xe31717=0x0,_0x305dd9=events[_0x255a('0x6')];_0xe31717<_0x305dd9;_0xe31717++){var _0x80f262=events[_0xe31717];var _0x1e6fd8=createListener(_0x255a('0x7')+_0x80f262,_0x4d4aa5);UserVoiceQueueRtEvents['on'](_0x80f262,_0x1e6fd8);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 0e152ad..3071613 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c7a=['../../components/auth/service','exports','multer','connect-timeout','Router','fs-extra'];(function(_0x45b380,_0x478cbd){var _0x4cdb76=function(_0x1b6a75){while(--_0x1b6a75){_0x45b380['push'](_0x45b380['shift']());}};_0x4cdb76(++_0x478cbd);}(_0x8c7a,0x8c));var _0xa8c7=function(_0x45dd92,_0x32a27c){_0x45dd92=_0x45dd92-0x0;var _0x2fbf24=_0x8c7a[_0x45dd92];return _0x2fbf24;};'use strict';var multer=require(_0xa8c7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa8c7('0x1'));var express=require('express');var router=express[_0xa8c7('0x2')]();var fs_extra=require(_0xa8c7('0x3'));var auth=require(_0xa8c7('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xa8c7('0x5')]=router; \ No newline at end of file +var _0x39c4=['util','express','Router','../../components/interaction/service','../../config/environment','exports'];(function(_0xb79080,_0x324ba4){var _0x5a611e=function(_0x2f15a9){while(--_0x2f15a9){_0xb79080['push'](_0xb79080['shift']());}};_0x5a611e(++_0x324ba4);}(_0x39c4,0x174));var _0x439c=function(_0x48c5f4,_0x2a7f17){_0x48c5f4=_0x48c5f4-0x0;var _0x4f5c05=_0x39c4[_0x48c5f4];return _0x4f5c05;};'use strict';var multer=require('multer');var util=require(_0x439c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x439c('0x1'));var router=express[_0x439c('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x439c('0x3'));var config=require(_0x439c('0x4'));module[_0x439c('0x5')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index fc4b55f..bac3a34 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x40d5cc,_0xf9d2c7){var _0x6950af=function(_0x295221){while(--_0x295221){_0x40d5cc['push'](_0x40d5cc['shift']());}};_0x6950af(++_0xf9d2c7);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x30fd67,_0x52521d){var _0xed6b3c=function(_0x437096){while(--_0x437096){_0x30fd67['push'](_0x30fd67['shift']());}};_0xed6b3c(++_0x52521d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 58e277d..43cf681 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.model.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a85=['moment','path','rimraf','../../config/environment','exports','UserWhatsappQueue','user_has_whatsapp_queues','../../config/logger','api'];(function(_0x2353ff,_0x4af5cf){var _0x225402=function(_0x2ce5f9){while(--_0x2ce5f9){_0x2353ff['push'](_0x2353ff['shift']());}};_0x225402(++_0x4af5cf);}(_0x1a85,0x178));var _0x51a8=function(_0x4745d9,_0x411b00){_0x4745d9=_0x4745d9-0x0;var _0x38f2ac=_0x1a85[_0x4745d9];return _0x38f2ac;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./userWhatsappQueue.attributes');module[_0x51a8('0x6')]=function(_0x4b76a8,_0x2c1180){return _0x4b76a8['define'](_0x51a8('0x7'),attributes,{'tableName':_0x51a8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4024=['define','user_has_whatsapp_queues','lodash','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x297e13,_0xa2a279){var _0x37cd19=function(_0x26200b){while(--_0x26200b){_0x297e13['push'](_0x297e13['shift']());}};_0x37cd19(++_0xa2a279);}(_0x4024,0x89));var _0x4402=function(_0x34ee96,_0x425584){_0x34ee96=_0x34ee96-0x0;var _0x343899=_0x4024[_0x34ee96];return _0x343899;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var logger=require('../../config/logger')(_0x4402('0x2'));var moment=require(_0x4402('0x3'));var BPromise=require('bluebird');var rp=require(_0x4402('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x17699b,_0x346ddc){return _0x17699b[_0x4402('0x7')]('UserWhatsappQueue',attributes,{'tableName':_0x4402('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 1265324..cbc1b3c 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\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(_0x177b78,_0x4ab6a9){var _0x482961=function(_0x350776){while(--_0x350776){_0x177b78['push'](_0x177b78['shift']());}};_0x482961(++_0x4ab6a9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\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(_0x2e9211,_0x565cd0){var _0x2886f9=function(_0x24e568){while(--_0x24e568){_0x2e9211['push'](_0x2e9211['shift']());}};_0x2886f9(++_0x565cd0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index a4fc093..e6862be 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 _0x8c12=['show','post','create','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated'];(function(_0x3f7941,_0x453732){var _0x205a78=function(_0x1a0c31){while(--_0x1a0c31){_0x3f7941['push'](_0x3f7941['shift']());}};_0x205a78(++_0x453732);}(_0x8c12,0x80));var _0x28c1=function(_0x4e5526,_0x4b08db){_0x4e5526=_0x4e5526-0x0;var _0x1def31=_0x8c12[_0x4e5526];return _0x1def31;};'use strict';var multer=require(_0x28c1('0x0'));var util=require(_0x28c1('0x1'));var path=require(_0x28c1('0x2'));var timeout=require(_0x28c1('0x3'));var express=require(_0x28c1('0x4'));var router=express[_0x28c1('0x5')]();var fs_extra=require(_0x28c1('0x6'));var auth=require(_0x28c1('0x7'));var interaction=require(_0x28c1('0x8'));var config=require('../../config/environment');var controller=require(_0x28c1('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x28c1('0xa')]('/:id',auth[_0x28c1('0xb')](),controller[_0x28c1('0xc')]);router[_0x28c1('0xd')]('/',auth['isAuthenticated'](),controller[_0x28c1('0xe')]);router[_0x28c1('0xf')]('/:id',auth[_0x28c1('0xb')](),controller[_0x28c1('0x10')]);router['delete'](_0x28c1('0x11'),auth[_0x28c1('0xb')](),controller[_0x28c1('0x12')]);module[_0x28c1('0x13')]=router; \ No newline at end of file +var _0xb44d=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x3005ed,_0x4a5340){var _0x9429e=function(_0x498c79){while(--_0x498c79){_0x3005ed['push'](_0x3005ed['shift']());}};_0x9429e(++_0x4a5340);}(_0xb44d,0x1eb));var _0xdb44=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb44d[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0xdb44('0x0'));var path=require(_0xdb44('0x1'));var timeout=require(_0xdb44('0x2'));var express=require(_0xdb44('0x3'));var router=express[_0xdb44('0x4')]();var fs_extra=require(_0xdb44('0x5'));var auth=require(_0xdb44('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdb44('0x7'));var controller=require(_0xdb44('0x8'));router[_0xdb44('0x9')]('/',auth[_0xdb44('0xa')](),controller['index']);router[_0xdb44('0x9')](_0xdb44('0xb'),auth[_0xdb44('0xa')](),controller[_0xdb44('0xc')]);router[_0xdb44('0xd')]('/',auth[_0xdb44('0xa')](),controller['create']);router[_0xdb44('0xe')](_0xdb44('0xb'),auth[_0xdb44('0xa')](),controller[_0xdb44('0xf')]);router[_0xdb44('0x10')](_0xdb44('0xb'),auth['isAuthenticated'](),controller[_0xdb44('0x11')]);module[_0xdb44('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index fd8dd7d..ca72cce 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 _0x8592=['STRING','sequelize','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8592,0x136));var _0x2859=function(_0x1de43c,_0xaa29de){_0x1de43c=_0x1de43c-0x0;var _0x296d3e=_0x8592[_0x1de43c];return _0x296d3e;};'use strict';var Sequelize=require(_0x2859('0x0'));module[_0x2859('0x1')]={'name':{'type':Sequelize[_0x2859('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2859('0x2')]}}; \ No newline at end of file +var _0x3c77=['sequelize','exports','STRING','name'];(function(_0x3c57fe,_0x17b067){var _0x500f79=function(_0x503806){while(--_0x503806){_0x3c57fe['push'](_0x3c57fe['shift']());}};_0x500f79(++_0x17b067);}(_0x3c77,0xc8));var _0x73c7=function(_0x5f4618,_0x488d5b){_0x5f4618=_0x5f4618-0x0;var _0x2a500c=_0x3c77[_0x5f4618];return _0x2a500c;};'use strict';var Sequelize=require(_0x73c7('0x0'));module[_0x73c7('0x1')]={'name':{'type':Sequelize[_0x73c7('0x2')],'unique':_0x73c7('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x73c7('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index dcbe8a6..0086b4a 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 _0x26b2=['keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','Variables','sendStatus','stack','name','index','Variable','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x432ec7,_0x5635a0){var _0x342608=function(_0x4c23db){while(--_0x4c23db){_0x432ec7['push'](_0x432ec7['shift']());}};_0x342608(++_0x5635a0);}(_0x26b2,0xc5));var _0x226b=function(_0x3fd26e,_0x142b4c){_0x3fd26e=_0x3fd26e-0x0;var _0x98d48c=_0x26b2[_0x3fd26e];return _0x98d48c;};'use strict';var emlformat=require(_0x226b('0x0'));var rimraf=require(_0x226b('0x1'));var zipdir=require(_0x226b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x226b('0x3'));var moment=require(_0x226b('0x4'));var BPromise=require(_0x226b('0x5'));var Mustache=require(_0x226b('0x6'));var util=require(_0x226b('0x7'));var path=require(_0x226b('0x8'));var sox=require(_0x226b('0x9'));var csv=require(_0x226b('0xa'));var ejs=require(_0x226b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x226b('0xc'));var squel=require('squel');var crypto=require(_0x226b('0xd'));var jsforce=require(_0x226b('0xe'));var deskjs=require(_0x226b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x226b('0x10'));var Redis=require(_0x226b('0x11'));var authService=require(_0x226b('0x12'));var qs=require(_0x226b('0x13'));var as=require(_0x226b('0x14'));var hardwareService=require(_0x226b('0x15'));var logger=require('../../config/logger')(_0x226b('0x16'));var utils=require('../../config/utils');var config=require(_0x226b('0x17'));var licenseUtil=require(_0x226b('0x18'));var db=require(_0x226b('0x19'))['db'];function respondWithStatusCode(_0x13e225,_0x21b041){_0x21b041=_0x21b041||0xcc;return function(_0x3781a8){if(_0x3781a8){return _0x13e225['sendStatus'](_0x21b041);}return _0x13e225[_0x226b('0x1a')](_0x21b041)[_0x226b('0x1b')]();};}function respondWithResult(_0x3a5fa6,_0x3a69b9){_0x3a69b9=_0x3a69b9||0xc8;return function(_0x4f86e8){if(_0x4f86e8){return _0x3a5fa6[_0x226b('0x1a')](_0x3a69b9)[_0x226b('0x1c')](_0x4f86e8);}};}function respondWithFilteredResult(_0x1e83f8,_0x41cdf4){return function(_0x2a93f){if(_0x2a93f){var _0x322c56=typeof _0x41cdf4['offset']===_0x226b('0x1d')&&typeof _0x41cdf4[_0x226b('0x1e')]===_0x226b('0x1d');var _0x1d8f56=_0x2a93f[_0x226b('0x1f')];var _0x407c9c=_0x322c56?0x0:_0x41cdf4[_0x226b('0x20')];var _0x5e49a6=_0x322c56?_0x2a93f[_0x226b('0x1f')]:_0x41cdf4[_0x226b('0x20')]+_0x41cdf4[_0x226b('0x1e')];var _0x48e978;if(_0x5e49a6>=_0x1d8f56){_0x5e49a6=_0x1d8f56;_0x48e978=0xc8;}else{_0x48e978=0xce;}_0x1e83f8[_0x226b('0x1a')](_0x48e978);return _0x1e83f8['set'](_0x226b('0x21'),_0x407c9c+'-'+_0x5e49a6+'/'+_0x1d8f56)['json'](_0x2a93f);}return null;};}function patchUpdates(_0xd97c4b){return function(_0x3b4d21){try{jsonpatch['apply'](_0x3b4d21,_0xd97c4b,!![]);}catch(_0x985b6a){return BPromise[_0x226b('0x22')](_0x985b6a);}return _0x3b4d21[_0x226b('0x23')]();};}function saveUpdates(_0x229e4d,_0x1cdba9){return function(_0x14ab81){if(_0x14ab81){return _0x14ab81[_0x226b('0x24')](_0x229e4d)[_0x226b('0x25')](function(_0x46bdbc){return _0x46bdbc;});}return null;};}function removeEntity(_0x18cf97,_0x8fbd85){return function(_0x43193d){if(_0x43193d){return _0x43193d[_0x226b('0x26')]()[_0x226b('0x25')](function(){var _0x286a38=_0x43193d['get']({'plain':!![]});var _0x36ab95=_0x226b('0x27');return db['UserProfileResource'][_0x226b('0x26')]({'where':{'type':_0x36ab95,'resourceId':_0x286a38['id']}})['then'](function(){return _0x43193d;});})[_0x226b('0x25')](function(){_0x18cf97[_0x226b('0x1a')](0xcc)[_0x226b('0x1b')]();});}};}function handleEntityNotFound(_0x370d72,_0x2bc294){return function(_0x5b51e0){if(!_0x5b51e0){_0x370d72[_0x226b('0x28')](0x194);}return _0x5b51e0;};}function handleError(_0xb9c059,_0x3799d9){_0x3799d9=_0x3799d9||0x1f4;return function(_0x37c0dd){logger['error'](_0x37c0dd[_0x226b('0x29')]);if(_0x37c0dd[_0x226b('0x2a')]){delete _0x37c0dd[_0x226b('0x2a')];}_0xb9c059[_0x226b('0x1a')](_0x3799d9)['send'](_0x37c0dd);};}exports[_0x226b('0x2b')]=function(_0x21f276,_0xfabd15){var _0x586c93={},_0x46c647={},_0x353e8e={'count':0x0,'rows':[]};var _0x46ed3d=_['map'](db[_0x226b('0x2c')][_0x226b('0x2d')],function(_0x392efd){return{'name':_0x392efd[_0x226b('0x2e')],'type':_0x392efd[_0x226b('0x2f')][_0x226b('0x30')]};});_0x46c647[_0x226b('0x31')]=_[_0x226b('0x32')](_0x46ed3d,_0x226b('0x2a'));_0x46c647[_0x226b('0x33')]=_[_0x226b('0x34')](_0x21f276[_0x226b('0x33')]);_0x46c647[_0x226b('0x35')]=_[_0x226b('0x36')](_0x46c647[_0x226b('0x31')],_0x46c647[_0x226b('0x33')]);_0x586c93[_0x226b('0x37')]=_[_0x226b('0x36')](_0x46c647['model'],qs[_0x226b('0x38')](_0x21f276[_0x226b('0x33')]['fields']));_0x586c93[_0x226b('0x37')]=_0x586c93[_0x226b('0x37')][_0x226b('0x39')]?_0x586c93[_0x226b('0x37')]:_0x46c647[_0x226b('0x31')];if(!_0x21f276[_0x226b('0x33')]['hasOwnProperty'](_0x226b('0x3a'))){_0x586c93[_0x226b('0x1e')]=qs['limit'](_0x21f276[_0x226b('0x33')]['limit']);_0x586c93[_0x226b('0x20')]=qs[_0x226b('0x20')](_0x21f276[_0x226b('0x33')][_0x226b('0x20')]);}_0x586c93['order']=qs[_0x226b('0x3b')](_0x21f276['query'][_0x226b('0x3b')]);_0x586c93[_0x226b('0x3c')]=qs[_0x226b('0x35')](_['pick'](_0x21f276[_0x226b('0x33')],_0x46c647[_0x226b('0x35')]),_0x46ed3d);if(_0x21f276['query'][_0x226b('0x3d')]){_0x586c93['where']=_[_0x226b('0x3e')](_0x586c93['where'],{'$or':_[_0x226b('0x32')](_0x46ed3d,function(_0x12a68d){if(_0x12a68d[_0x226b('0x2f')]!==_0x226b('0x3f')){var _0x2b9974={};_0x2b9974[_0x12a68d[_0x226b('0x2a')]]={'$like':'%'+_0x21f276[_0x226b('0x33')][_0x226b('0x3d')]+'%'};return _0x2b9974;}})});}_0x586c93=_['merge']({},_0x586c93,_0x21f276[_0x226b('0x40')]);var _0xd481f0={'where':_0x586c93[_0x226b('0x3c')]};return db[_0x226b('0x2c')][_0x226b('0x1f')](_0xd481f0)[_0x226b('0x25')](function(_0x270ccb){_0x353e8e['count']=_0x270ccb;if(_0x21f276['query'][_0x226b('0x41')]){_0x586c93[_0x226b('0x42')]=[{'all':!![]}];}return db[_0x226b('0x2c')][_0x226b('0x43')](_0x586c93);})[_0x226b('0x25')](function(_0x890578){_0x353e8e[_0x226b('0x44')]=_0x890578;return _0x353e8e;})['then'](respondWithFilteredResult(_0xfabd15,_0x586c93))['catch'](handleError(_0xfabd15,null));};exports[_0x226b('0x45')]=function(_0x1035e8,_0x18097b){var _0x126131={'raw':!![],'where':{'id':_0x1035e8['params']['id']}},_0x471592={};_0x471592[_0x226b('0x31')]=_[_0x226b('0x34')](db[_0x226b('0x2c')][_0x226b('0x2d')]);_0x471592['query']=_[_0x226b('0x34')](_0x1035e8['query']);_0x471592['filters']=_['intersection'](_0x471592[_0x226b('0x31')],_0x471592[_0x226b('0x33')]);_0x126131['attributes']=_['intersection'](_0x471592[_0x226b('0x31')],qs[_0x226b('0x38')](_0x1035e8['query'][_0x226b('0x38')]));_0x126131[_0x226b('0x37')]=_0x126131[_0x226b('0x37')][_0x226b('0x39')]?_0x126131[_0x226b('0x37')]:_0x471592['model'];if(_0x1035e8[_0x226b('0x33')]['includeAll']){_0x126131[_0x226b('0x42')]=[{'all':!![]}];}_0x126131=_['merge']({},_0x126131,_0x1035e8[_0x226b('0x40')]);return db[_0x226b('0x2c')][_0x226b('0x46')](_0x126131)[_0x226b('0x25')](handleEntityNotFound(_0x18097b,null))[_0x226b('0x25')](respondWithResult(_0x18097b,null))[_0x226b('0x47')](handleError(_0x18097b,null));};exports[_0x226b('0x48')]=function(_0x16a817,_0x4675b9){return db[_0x226b('0x2c')][_0x226b('0x48')](_0x16a817[_0x226b('0x49')],{})['then'](function(_0x3e7e4c){var _0x33fcc7=_0x16a817[_0x226b('0x4a')][_0x226b('0x4b')]({'plain':!![]});if(!_0x33fcc7)throw new Error(_0x226b('0x4c'));if(_0x33fcc7['role']===_0x226b('0x4a')){var _0x4634ea=_0x3e7e4c[_0x226b('0x4b')]({'plain':!![]});var _0x3025cc=_0x226b('0x27');return db[_0x226b('0x4d')][_0x226b('0x46')]({'where':{'name':_0x3025cc,'userProfileId':_0x33fcc7[_0x226b('0x4e')]},'raw':!![]})['then'](function(_0x229e01){if(_0x229e01&&_0x229e01[_0x226b('0x4f')]===0x0){return db[_0x226b('0x50')]['create']({'name':_0x4634ea[_0x226b('0x2a')],'resourceId':_0x4634ea['id'],'type':_0x229e01[_0x226b('0x2a')],'sectionId':_0x229e01['id']},{})[_0x226b('0x25')](function(){return _0x3e7e4c;});}else{return _0x3e7e4c;}})['catch'](function(_0x3946a5){logger[_0x226b('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3946a5);throw _0x3946a5;});}return _0x3e7e4c;})['then'](respondWithResult(_0x4675b9,0xc9))[_0x226b('0x47')](handleError(_0x4675b9,null));};exports[_0x226b('0x24')]=function(_0x290628,_0x1045c5){if(_0x290628[_0x226b('0x49')]['id']){delete _0x290628[_0x226b('0x49')]['id'];}return db[_0x226b('0x2c')][_0x226b('0x46')]({'where':{'id':_0x290628['params']['id']}})[_0x226b('0x25')](handleEntityNotFound(_0x1045c5,null))['then'](saveUpdates(_0x290628[_0x226b('0x49')],null))[_0x226b('0x25')](respondWithResult(_0x1045c5,null))[_0x226b('0x47')](handleError(_0x1045c5,null));};exports[_0x226b('0x26')]=function(_0x3639f9,_0x3f6cea){return db[_0x226b('0x2c')]['find']({'where':{'id':_0x3639f9[_0x226b('0x52')]['id']}})[_0x226b('0x25')](handleEntityNotFound(_0x3f6cea,null))[_0x226b('0x25')](removeEntity(_0x3f6cea,null))[_0x226b('0x47')](handleError(_0x3f6cea,null));}; \ No newline at end of file +var _0x297f=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','save','update','then','get','Variables','error','stack','name','index','map','Variable','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','include','create','body','user'];(function(_0x31e175,_0x4dbb72){var _0x4b8a11=function(_0x3e95ee){while(--_0x3e95ee){_0x31e175['push'](_0x31e175['shift']());}};_0x4b8a11(++_0x4dbb72);}(_0x297f,0x1f0));var _0xf297=function(_0x4b420d,_0x172f49){_0x4b420d=_0x4b420d-0x0;var _0x52ee0a=_0x297f[_0x4b420d];return _0x52ee0a;};'use strict';var emlformat=require(_0xf297('0x0'));var rimraf=require(_0xf297('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf297('0x2'));var moment=require(_0xf297('0x3'));var BPromise=require(_0xf297('0x4'));var Mustache=require(_0xf297('0x5'));var util=require('util');var path=require(_0xf297('0x6'));var sox=require('sox');var csv=require(_0xf297('0x7'));var ejs=require(_0xf297('0x8'));var fs=require('fs');var fs_extra=require(_0xf297('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf297('0xa'));var jsforce=require(_0xf297('0xb'));var deskjs=require(_0xf297('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf297('0xd'));var Papa=require(_0xf297('0xe'));var Redis=require('ioredis');var authService=require(_0xf297('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf297('0x10'));var hardwareService=require(_0xf297('0x11'));var logger=require(_0xf297('0x12'))('api');var utils=require(_0xf297('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf297('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5534f1,_0x395101){_0x395101=_0x395101||0xcc;return function(_0x3554b1){if(_0x3554b1){return _0x5534f1[_0xf297('0x15')](_0x395101);}return _0x5534f1[_0xf297('0x16')](_0x395101)[_0xf297('0x17')]();};}function respondWithResult(_0x3b7941,_0x5c5e7c){_0x5c5e7c=_0x5c5e7c||0xc8;return function(_0xb7647b){if(_0xb7647b){return _0x3b7941[_0xf297('0x16')](_0x5c5e7c)['json'](_0xb7647b);}};}function respondWithFilteredResult(_0x42fd50,_0x5eed15){return function(_0x2dd842){if(_0x2dd842){var _0x12c499=typeof _0x5eed15[_0xf297('0x18')]==='undefined'&&typeof _0x5eed15['limit']===_0xf297('0x19');var _0x1e2a77=_0x2dd842['count'];var _0x47d584=_0x12c499?0x0:_0x5eed15[_0xf297('0x18')];var _0x1932df=_0x12c499?_0x2dd842['count']:_0x5eed15[_0xf297('0x18')]+_0x5eed15[_0xf297('0x1a')];var _0x3ccb7;if(_0x1932df>=_0x1e2a77){_0x1932df=_0x1e2a77;_0x3ccb7=0xc8;}else{_0x3ccb7=0xce;}_0x42fd50['status'](_0x3ccb7);return _0x42fd50[_0xf297('0x1b')](_0xf297('0x1c'),_0x47d584+'-'+_0x1932df+'/'+_0x1e2a77)[_0xf297('0x1d')](_0x2dd842);}return null;};}function patchUpdates(_0x556c15){return function(_0x5f96ba){try{jsonpatch[_0xf297('0x1e')](_0x5f96ba,_0x556c15,!![]);}catch(_0x13ec1d){return BPromise['reject'](_0x13ec1d);}return _0x5f96ba[_0xf297('0x1f')]();};}function saveUpdates(_0x10830f,_0x4023a3){return function(_0x4cf7f7){if(_0x4cf7f7){return _0x4cf7f7[_0xf297('0x20')](_0x10830f)[_0xf297('0x21')](function(_0x6721c2){return _0x6721c2;});}return null;};}function removeEntity(_0x18d62b,_0x5335ca){return function(_0x27265c){if(_0x27265c){return _0x27265c['destroy']()[_0xf297('0x21')](function(){var _0x2ad8fe=_0x27265c[_0xf297('0x22')]({'plain':!![]});var _0x3064dc=_0xf297('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x3064dc,'resourceId':_0x2ad8fe['id']}})[_0xf297('0x21')](function(){return _0x27265c;});})[_0xf297('0x21')](function(){_0x18d62b[_0xf297('0x16')](0xcc)[_0xf297('0x17')]();});}};}function handleEntityNotFound(_0x1b9bcd,_0x456573){return function(_0x55db2a){if(!_0x55db2a){_0x1b9bcd[_0xf297('0x15')](0x194);}return _0x55db2a;};}function handleError(_0x5cf2c9,_0x572c86){_0x572c86=_0x572c86||0x1f4;return function(_0x58f5f3){logger[_0xf297('0x24')](_0x58f5f3[_0xf297('0x25')]);if(_0x58f5f3[_0xf297('0x26')]){delete _0x58f5f3[_0xf297('0x26')];}_0x5cf2c9[_0xf297('0x16')](_0x572c86)['send'](_0x58f5f3);};}exports[_0xf297('0x27')]=function(_0x1f0eef,_0x566743){var _0x41a427={},_0x38a4f6={},_0x47044f={'count':0x0,'rows':[]};var _0x4e7c69=_[_0xf297('0x28')](db[_0xf297('0x29')][_0xf297('0x2a')],function(_0x4d320b){return{'name':_0x4d320b[_0xf297('0x2b')],'type':_0x4d320b[_0xf297('0x2c')]['key']};});_0x38a4f6[_0xf297('0x2d')]=_[_0xf297('0x28')](_0x4e7c69,_0xf297('0x26'));_0x38a4f6[_0xf297('0x2e')]=_[_0xf297('0x2f')](_0x1f0eef[_0xf297('0x2e')]);_0x38a4f6['filters']=_[_0xf297('0x30')](_0x38a4f6[_0xf297('0x2d')],_0x38a4f6['query']);_0x41a427[_0xf297('0x31')]=_[_0xf297('0x30')](_0x38a4f6[_0xf297('0x2d')],qs[_0xf297('0x32')](_0x1f0eef['query'][_0xf297('0x32')]));_0x41a427[_0xf297('0x31')]=_0x41a427[_0xf297('0x31')]['length']?_0x41a427[_0xf297('0x31')]:_0x38a4f6[_0xf297('0x2d')];if(!_0x1f0eef[_0xf297('0x2e')][_0xf297('0x33')](_0xf297('0x34'))){_0x41a427[_0xf297('0x1a')]=qs[_0xf297('0x1a')](_0x1f0eef[_0xf297('0x2e')]['limit']);_0x41a427[_0xf297('0x18')]=qs[_0xf297('0x18')](_0x1f0eef[_0xf297('0x2e')][_0xf297('0x18')]);}_0x41a427[_0xf297('0x35')]=qs[_0xf297('0x36')](_0x1f0eef[_0xf297('0x2e')][_0xf297('0x36')]);_0x41a427[_0xf297('0x37')]=qs[_0xf297('0x38')](_[_0xf297('0x39')](_0x1f0eef[_0xf297('0x2e')],_0x38a4f6[_0xf297('0x38')]),_0x4e7c69);if(_0x1f0eef[_0xf297('0x2e')][_0xf297('0x3a')]){_0x41a427['where']=_[_0xf297('0x3b')](_0x41a427[_0xf297('0x37')],{'$or':_['map'](_0x4e7c69,function(_0x3bb0a7){if(_0x3bb0a7[_0xf297('0x2c')]!==_0xf297('0x3c')){var _0x2106d4={};_0x2106d4[_0x3bb0a7[_0xf297('0x26')]]={'$like':'%'+_0x1f0eef[_0xf297('0x2e')]['filter']+'%'};return _0x2106d4;}})});}_0x41a427=_['merge']({},_0x41a427,_0x1f0eef[_0xf297('0x3d')]);var _0x1d8f65={'where':_0x41a427[_0xf297('0x37')]};return db[_0xf297('0x29')][_0xf297('0x3e')](_0x1d8f65)['then'](function(_0x53be11){_0x47044f['count']=_0x53be11;if(_0x1f0eef[_0xf297('0x2e')][_0xf297('0x3f')]){_0x41a427['include']=[{'all':!![]}];}return db[_0xf297('0x29')]['findAll'](_0x41a427);})[_0xf297('0x21')](function(_0x1503cd){_0x47044f[_0xf297('0x40')]=_0x1503cd;return _0x47044f;})['then'](respondWithFilteredResult(_0x566743,_0x41a427))[_0xf297('0x41')](handleError(_0x566743,null));};exports[_0xf297('0x42')]=function(_0x124c53,_0x41ddb8){var _0x294650={'raw':!![],'where':{'id':_0x124c53['params']['id']}},_0x3817de={};_0x3817de[_0xf297('0x2d')]=_[_0xf297('0x2f')](db[_0xf297('0x29')]['rawAttributes']);_0x3817de['query']=_[_0xf297('0x2f')](_0x124c53['query']);_0x3817de[_0xf297('0x38')]=_[_0xf297('0x30')](_0x3817de[_0xf297('0x2d')],_0x3817de['query']);_0x294650['attributes']=_['intersection'](_0x3817de[_0xf297('0x2d')],qs[_0xf297('0x32')](_0x124c53['query'][_0xf297('0x32')]));_0x294650['attributes']=_0x294650[_0xf297('0x31')]['length']?_0x294650[_0xf297('0x31')]:_0x3817de['model'];if(_0x124c53[_0xf297('0x2e')]['includeAll']){_0x294650[_0xf297('0x43')]=[{'all':!![]}];}_0x294650=_[_0xf297('0x3b')]({},_0x294650,_0x124c53['options']);return db['Variable']['find'](_0x294650)[_0xf297('0x21')](handleEntityNotFound(_0x41ddb8,null))[_0xf297('0x21')](respondWithResult(_0x41ddb8,null))[_0xf297('0x41')](handleError(_0x41ddb8,null));};exports[_0xf297('0x44')]=function(_0x528887,_0x4d1215){return db[_0xf297('0x29')][_0xf297('0x44')](_0x528887[_0xf297('0x45')],{})[_0xf297('0x21')](function(_0xe72d68){var _0x545e19=_0x528887[_0xf297('0x46')][_0xf297('0x22')]({'plain':!![]});if(!_0x545e19)throw new Error(_0xf297('0x47'));if(_0x545e19[_0xf297('0x48')]==='user'){var _0x23efc6=_0xe72d68[_0xf297('0x22')]({'plain':!![]});var _0x18c01b='Variables';return db[_0xf297('0x49')][_0xf297('0x4a')]({'where':{'name':_0x18c01b,'userProfileId':_0x545e19[_0xf297('0x4b')]},'raw':!![]})[_0xf297('0x21')](function(_0x41f400){if(_0x41f400&&_0x41f400[_0xf297('0x4c')]===0x0){return db[_0xf297('0x4d')][_0xf297('0x44')]({'name':_0x23efc6[_0xf297('0x26')],'resourceId':_0x23efc6['id'],'type':_0x41f400['name'],'sectionId':_0x41f400['id']},{})['then'](function(){return _0xe72d68;});}else{return _0xe72d68;}})[_0xf297('0x41')](function(_0xaf4b7){logger[_0xf297('0x24')](_0xf297('0x4e'),_0xaf4b7);throw _0xaf4b7;});}return _0xe72d68;})[_0xf297('0x21')](respondWithResult(_0x4d1215,0xc9))[_0xf297('0x41')](handleError(_0x4d1215,null));};exports[_0xf297('0x20')]=function(_0xa233ab,_0x3416ff){if(_0xa233ab['body']['id']){delete _0xa233ab[_0xf297('0x45')]['id'];}return db[_0xf297('0x29')][_0xf297('0x4a')]({'where':{'id':_0xa233ab[_0xf297('0x4f')]['id']}})[_0xf297('0x21')](handleEntityNotFound(_0x3416ff,null))[_0xf297('0x21')](saveUpdates(_0xa233ab[_0xf297('0x45')],null))['then'](respondWithResult(_0x3416ff,null))[_0xf297('0x41')](handleError(_0x3416ff,null));};exports[_0xf297('0x50')]=function(_0x56a6f3,_0x5d54c9){return db[_0xf297('0x29')][_0xf297('0x4a')]({'where':{'id':_0x56a6f3[_0xf297('0x4f')]['id']}})[_0xf297('0x21')](handleEntityNotFound(_0x5d54c9,null))[_0xf297('0x21')](removeEntity(_0x5d54c9,null))[_0xf297('0x41')](handleError(_0x5d54c9,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 4953812..4f110a6 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 _0x95c5=['tools_variables','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','Variable'];(function(_0x28df2b,_0x479e38){var _0x287b43=function(_0x5783ee){while(--_0x5783ee){_0x28df2b['push'](_0x28df2b['shift']());}};_0x287b43(++_0x479e38);}(_0x95c5,0x153));var _0x595c=function(_0x2850c0,_0x1363a7){_0x2850c0=_0x2850c0-0x0;var _0x21e830=_0x95c5[_0x2850c0];return _0x21e830;};'use strict';var _=require(_0x595c('0x0'));var util=require(_0x595c('0x1'));var logger=require('../../config/logger')(_0x595c('0x2'));var moment=require(_0x595c('0x3'));var BPromise=require(_0x595c('0x4'));var rp=require(_0x595c('0x5'));var fs=require('fs');var path=require(_0x595c('0x6'));var rimraf=require(_0x595c('0x7'));var config=require(_0x595c('0x8'));var attributes=require(_0x595c('0x9'));module[_0x595c('0xa')]=function(_0x46be42,_0x4ff80b){return _0x46be42['define'](_0x595c('0xb'),attributes,{'tableName':_0x595c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa20=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','Variable','tools_variables','lodash','util','../../config/logger','api'];(function(_0xc94ae4,_0x32d2aa){var _0x547636=function(_0x1fe9e9){while(--_0x1fe9e9){_0xc94ae4['push'](_0xc94ae4['shift']());}};_0x547636(++_0x32d2aa);}(_0xfa20,0x141));var _0x0fa2=function(_0x3590a4,_0x2eea94){_0x3590a4=_0x3590a4-0x0;var _0x17a579=_0xfa20[_0x3590a4];return _0x17a579;};'use strict';var _=require(_0x0fa2('0x0'));var util=require(_0x0fa2('0x1'));var logger=require(_0x0fa2('0x2'))(_0x0fa2('0x3'));var moment=require(_0x0fa2('0x4'));var BPromise=require(_0x0fa2('0x5'));var rp=require(_0x0fa2('0x6'));var fs=require('fs');var path=require(_0x0fa2('0x7'));var rimraf=require(_0x0fa2('0x8'));var config=require(_0x0fa2('0x9'));var attributes=require(_0x0fa2('0xa'));module['exports']=function(_0x19387c,_0x2247e9){return _0x19387c['define'](_0x0fa2('0xb'),attributes,{'tableName':_0x0fa2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 1e86a8a..61ab689 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 _0x4741=['Variable','find','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','Variable,\x20%s,\x20%s','message','catch','ShowVariable'];(function(_0x33466d,_0x4d7e8c){var _0x401b25=function(_0x13a18d){while(--_0x13a18d){_0x33466d['push'](_0x33466d['shift']());}};_0x401b25(++_0x4d7e8c);}(_0x4741,0x88));var _0x1474=function(_0x53150d,_0x55665c){_0x53150d=_0x53150d-0x0;var _0x44eadc=_0x4741[_0x53150d];return _0x44eadc;};'use strict';var _=require(_0x1474('0x0'));var util=require(_0x1474('0x1'));var moment=require(_0x1474('0x2'));var BPromise=require(_0x1474('0x3'));var rs=require(_0x1474('0x4'));var fs=require('fs');var Redis=require(_0x1474('0x5'));var db=require(_0x1474('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1474('0x7'))('rpc');var config=require(_0x1474('0x8'));var jayson=require(_0x1474('0x9'));var client=jayson[_0x1474('0xa')][_0x1474('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x153566,_0x1481fd,_0x132c61){return new BPromise(function(_0x40207a,_0x5a395f){return client['request'](_0x153566,_0x132c61)[_0x1474('0xc')](function(_0x12c2e0){logger[_0x1474('0xd')]('Variable,\x20%s,\x20%s',_0x1481fd,_0x1474('0xe'));logger[_0x1474('0xf')](_0x1474('0x10'),_0x1481fd,_0x1474('0xe'),JSON[_0x1474('0x11')](_0x12c2e0));if(_0x12c2e0[_0x1474('0x12')]){if(_0x12c2e0[_0x1474('0x12')][_0x1474('0x13')]===0x1f4){logger['error'](_0x1474('0x14'),_0x1481fd,_0x12c2e0[_0x1474('0x12')][_0x1474('0x15')]);return _0x5a395f(_0x12c2e0[_0x1474('0x12')]['message']);}logger[_0x1474('0x12')]('Variable,\x20%s,\x20%s',_0x1481fd,_0x12c2e0['error']['message']);return _0x40207a(_0x12c2e0[_0x1474('0x12')][_0x1474('0x15')]);}else{logger[_0x1474('0xd')](_0x1474('0x14'),_0x1481fd,_0x1474('0xe'));_0x40207a(_0x12c2e0['result'][_0x1474('0x15')]);}})[_0x1474('0x16')](function(_0x500743){logger['error']('Variable,\x20%s,\x20%s',_0x1481fd,_0x500743);_0x5a395f(_0x500743);});});}exports[_0x1474('0x17')]=function(_0x278661){var _0x375c6a=this;return new Promise(function(_0x59304b,_0x49b7c5){return db[_0x1474('0x18')][_0x1474('0x19')]({'raw':_0x278661[_0x1474('0x1a')]?_0x278661[_0x1474('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x278661[_0x1474('0x1a')]?_0x278661[_0x1474('0x1a')][_0x1474('0x1b')]||null:null,'attributes':_0x278661[_0x1474('0x1a')]?_0x278661['options'][_0x1474('0x1c')]||null:null,'include':_0x278661[_0x1474('0x1a')]?_0x278661[_0x1474('0x1a')]['include']?_['map'](_0x278661[_0x1474('0x1a')][_0x1474('0x1d')],function(_0xabf6bc){return{'model':db[_0xabf6bc['model']],'as':_0xabf6bc['as'],'attributes':_0xabf6bc[_0x1474('0x1c')],'include':_0xabf6bc[_0x1474('0x1d')]?_[_0x1474('0x1e')](_0xabf6bc['include'],function(_0xf8f12c){return{'model':db[_0xf8f12c[_0x1474('0x1f')]],'as':_0xf8f12c['as'],'attributes':_0xf8f12c[_0x1474('0x1c')],'include':_0xf8f12c[_0x1474('0x1d')]?_[_0x1474('0x1e')](_0xf8f12c[_0x1474('0x1d')],function(_0x346879){return{'model':db[_0x346879[_0x1474('0x1f')]],'as':_0x346879['as'],'attributes':_0x346879[_0x1474('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5be04a){logger[_0x1474('0xd')](_0x1474('0x17'),_0x278661);logger['debug']('ShowVariable',_0x278661,JSON[_0x1474('0x11')](_0x5be04a));_0x59304b(_0x5be04a);})['catch'](function(_0x2b7a0a){logger[_0x1474('0x12')](_0x1474('0x17'),_0x2b7a0a[_0x1474('0x15')],_0x278661);_0x49b7c5(_0x375c6a[_0x1474('0x12')](0x1f4,_0x2b7a0a['message']));});});}; \ No newline at end of file +var _0x071a=['ShowVariable','Variable','find','options','raw','where','include','map','model','attributes','debug','stringify','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','info','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','code','Variable,\x20%s,\x20%s','message','result','catch'];(function(_0x5096d7,_0x41e360){var _0x454438=function(_0x3f9a7d){while(--_0x3f9a7d){_0x5096d7['push'](_0x5096d7['shift']());}};_0x454438(++_0x41e360);}(_0x071a,0xc0));var _0xa071=function(_0x3b0515,_0x1fa41d){_0x3b0515=_0x3b0515-0x0;var _0x198d7a=_0x071a[_0x3b0515];return _0x198d7a;};'use strict';var _=require(_0xa071('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa071('0x1'));var fs=require('fs');var Redis=require(_0xa071('0x2'));var db=require(_0xa071('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa071('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa071('0x5'));var client=jayson[_0xa071('0x6')][_0xa071('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f9f7d,_0x267d34,_0x3d5d6b){return new BPromise(function(_0x10302c,_0xc6c2be){return client[_0xa071('0x8')](_0x3f9f7d,_0x3d5d6b)['then'](function(_0x223595){logger[_0xa071('0x9')]('Variable,\x20%s,\x20%s',_0x267d34,_0xa071('0xa'));logger['debug'](_0xa071('0xb'),_0x267d34,_0xa071('0xa'),JSON['stringify'](_0x223595));if(_0x223595[_0xa071('0xc')]){if(_0x223595[_0xa071('0xc')][_0xa071('0xd')]===0x1f4){logger[_0xa071('0xc')](_0xa071('0xe'),_0x267d34,_0x223595['error'][_0xa071('0xf')]);return _0xc6c2be(_0x223595['error'][_0xa071('0xf')]);}logger[_0xa071('0xc')]('Variable,\x20%s,\x20%s',_0x267d34,_0x223595[_0xa071('0xc')][_0xa071('0xf')]);return _0x10302c(_0x223595['error'][_0xa071('0xf')]);}else{logger[_0xa071('0x9')](_0xa071('0xe'),_0x267d34,_0xa071('0xa'));_0x10302c(_0x223595[_0xa071('0x10')]['message']);}})[_0xa071('0x11')](function(_0xd0dcad){logger['error'](_0xa071('0xe'),_0x267d34,_0xd0dcad);_0xc6c2be(_0xd0dcad);});});}exports[_0xa071('0x12')]=function(_0x399f08){var _0x4f4799=this;return new Promise(function(_0x3161fd,_0xef5bdf){return db[_0xa071('0x13')][_0xa071('0x14')]({'raw':_0x399f08[_0xa071('0x15')]?_0x399f08['options'][_0xa071('0x16')]===undefined?!![]:![]:!![],'where':_0x399f08[_0xa071('0x15')]?_0x399f08[_0xa071('0x15')][_0xa071('0x17')]||null:null,'attributes':_0x399f08[_0xa071('0x15')]?_0x399f08['options']['attributes']||null:null,'include':_0x399f08[_0xa071('0x15')]?_0x399f08[_0xa071('0x15')][_0xa071('0x18')]?_[_0xa071('0x19')](_0x399f08[_0xa071('0x15')]['include'],function(_0x4ce5e5){return{'model':db[_0x4ce5e5[_0xa071('0x1a')]],'as':_0x4ce5e5['as'],'attributes':_0x4ce5e5[_0xa071('0x1b')],'include':_0x4ce5e5[_0xa071('0x18')]?_[_0xa071('0x19')](_0x4ce5e5[_0xa071('0x18')],function(_0x152f5a){return{'model':db[_0x152f5a[_0xa071('0x1a')]],'as':_0x152f5a['as'],'attributes':_0x152f5a[_0xa071('0x1b')],'include':_0x152f5a[_0xa071('0x18')]?_[_0xa071('0x19')](_0x152f5a[_0xa071('0x18')],function(_0x2f1865){return{'model':db[_0x2f1865[_0xa071('0x1a')]],'as':_0x2f1865['as'],'attributes':_0x2f1865[_0xa071('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x321aad){logger['info'](_0xa071('0x12'),_0x399f08);logger[_0xa071('0x1c')]('ShowVariable',_0x399f08,JSON[_0xa071('0x1d')](_0x321aad));_0x3161fd(_0x321aad);})[_0xa071('0x11')](function(_0xdd5b55){logger[_0xa071('0xc')]('ShowVariable',_0xdd5b55[_0xa071('0xf')],_0x399f08);_0xef5bdf(_0x4f4799[_0xa071('0xc')](0x1f4,_0xdd5b55['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 1156a11..ab1d9e5 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 _0xb2f4=['index','/fetch','isAuthenticated','canUpdate','fetch','/reset','/pull','pull','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get'];(function(_0x335866,_0x394eb2){var _0x392116=function(_0x125e81){while(--_0x125e81){_0x335866['push'](_0x335866['shift']());}};_0x392116(++_0x394eb2);}(_0xb2f4,0x14f));var _0x4b2f=function(_0x2bcf5e,_0x5d9059){_0x2bcf5e=_0x2bcf5e-0x0;var _0x94e486=_0xb2f4[_0x2bcf5e];return _0x94e486;};'use strict';var express=require(_0x4b2f('0x0'));var router=express[_0x4b2f('0x1')]();var auth=require(_0x4b2f('0x2'));var controller=require(_0x4b2f('0x3'));router[_0x4b2f('0x4')]('/',controller[_0x4b2f('0x5')]);router[_0x4b2f('0x4')](_0x4b2f('0x6'),auth[_0x4b2f('0x7')](),auth[_0x4b2f('0x8')](),controller[_0x4b2f('0x9')]);router[_0x4b2f('0x4')](_0x4b2f('0xa'),auth[_0x4b2f('0x7')](),auth[_0x4b2f('0x8')](),controller['reset']);router[_0x4b2f('0x4')](_0x4b2f('0xb'),auth[_0x4b2f('0x7')](),auth[_0x4b2f('0x8')](),controller[_0x4b2f('0xc')]);router['get']('/restart',auth['isAuthenticated'](),controller[_0x4b2f('0xd')]);router[_0x4b2f('0x4')](_0x4b2f('0xe'),controller[_0x4b2f('0xf')]);module[_0x4b2f('0x10')]=router; \ No newline at end of file +var _0xcae6=['/migrations','migrations','exports','express','Router','./version.controller','/fetch','isAuthenticated','canUpdate','fetch','get','/reset','reset','/pull','pull','/restart','restart'];(function(_0x38b6fc,_0x59aaeb){var _0x11780b=function(_0x3e9c86){while(--_0x3e9c86){_0x38b6fc['push'](_0x38b6fc['shift']());}};_0x11780b(++_0x59aaeb);}(_0xcae6,0x146));var _0x6cae=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0xcae6[_0x487496];return _0x539dc8;};'use strict';var express=require(_0x6cae('0x0'));var router=express[_0x6cae('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x6cae('0x2'));router['get']('/',controller['index']);router['get'](_0x6cae('0x3'),auth[_0x6cae('0x4')](),auth[_0x6cae('0x5')](),controller[_0x6cae('0x6')]);router[_0x6cae('0x7')](_0x6cae('0x8'),auth[_0x6cae('0x4')](),auth[_0x6cae('0x5')](),controller[_0x6cae('0x9')]);router[_0x6cae('0x7')](_0x6cae('0xa'),auth[_0x6cae('0x4')](),auth[_0x6cae('0x5')](),controller[_0x6cae('0xb')]);router[_0x6cae('0x7')](_0x6cae('0xc'),auth['isAuthenticated'](),controller[_0x6cae('0xd')]);router[_0x6cae('0x7')](_0x6cae('0xe'),controller[_0x6cae('0xf')]);module[_0x6cae('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 0a1d2ba..af411ea 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 _0xdc86=['reset','--hard','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','readdirSync','join','server','migrations','length','replace','push','Migration','sequelize','constructor','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','path','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','root','index','version','query','latest','fetch','tags','exports','2.0.0','json','origin','master','error','status','info','git\x20fetch'];(function(_0xaefc89,_0x4e2ce2){var _0x4850ee=function(_0x7c0e48){while(--_0x7c0e48){_0xaefc89['push'](_0xaefc89['shift']());}};_0x4850ee(++_0x4e2ce2);}(_0xdc86,0x118));var _0x6dc8=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xdc86[_0x88cd7b];return _0x56fcc8;};'use strict';var Umzug=require('umzug');var path=require(_0x6dc8('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x6dc8('0x1'))(module,'version');var compareVersions=require(_0x6dc8('0x2'));var exec=require(_0x6dc8('0x3'))[_0x6dc8('0x4')];var db=require(_0x6dc8('0x5'))['db'];var config=require(_0x6dc8('0x6'));var pm2=require('../../config/pm2');var logger=require(_0x6dc8('0x7'))(_0x6dc8('0x8'));var git=require(_0x6dc8('0x9'))(config[_0x6dc8('0xa')]);exports[_0x6dc8('0xb')]=function(_0x1f41c7,_0x41bdf5){var _0x235de4={'current':module['exports'][_0x6dc8('0xc')],'phonebar':0x2};if(_0x1f41c7['query']&&_0x1f41c7[_0x6dc8('0xd')][_0x6dc8('0xe')]){return git[_0x6dc8('0xf')]()[_0x6dc8('0x10')](function(_0x504a47,_0x246653){_0x235de4[_0x6dc8('0xe')]=(_0x504a47?module[_0x6dc8('0x11')][_0x6dc8('0xc')]:_0x246653[_0x6dc8('0xe')])||_0x6dc8('0x12');return _0x41bdf5['status'](0xc8)[_0x6dc8('0x13')](_0x235de4);});}else{return _0x41bdf5['status'](0xc8)['json'](_0x235de4);}};exports[_0x6dc8('0xf')]=function(_0x527f66,_0x21be3d){return git['fetch']([_0x6dc8('0x14'),_0x6dc8('0x15')],function(_0xa4d1cf){if(_0xa4d1cf){logger[_0x6dc8('0x16')](_0xa4d1cf);return _0x21be3d[_0x6dc8('0x17')](0x1f4)[_0x6dc8('0x13')](_0xa4d1cf);}logger[_0x6dc8('0x18')](_0x6dc8('0x19'));return _0x21be3d[_0x6dc8('0x17')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x6dc8('0x1a')]=function(_0x396efc,_0x209ae4){return git[_0x6dc8('0x1a')]([_0x6dc8('0x1b'),'FETCH_HEAD'],function(_0x4cdd1c){if(_0x4cdd1c){logger['error'](_0x4cdd1c);return _0x209ae4[_0x6dc8('0x17')](0x1f4)['json'](_0x4cdd1c);}logger[_0x6dc8('0x18')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x209ae4[_0x6dc8('0x17')](0xc8)[_0x6dc8('0x13')]({'output':_0x6dc8('0x1c')});});};exports[_0x6dc8('0x1d')]=function(_0x1949be,_0x8b7f4c){exec(_0x6dc8('0x1e'),function(_0x38ce80,_0x1436d1,_0x5526cd){logger[_0x6dc8('0x18')](_0x1436d1);logger[_0x6dc8('0x18')](_0x5526cd);if(_0x38ce80){logger[_0x6dc8('0x16')](_0x38ce80);return _0x8b7f4c['status'](0x1f4)[_0x6dc8('0x13')](_0x38ce80);}return _0x8b7f4c['status'](0xc8)[_0x6dc8('0x13')]({'output':_0x1436d1});});};exports[_0x6dc8('0x1f')]=function(_0x3529fb,_0x590f04){return pm2[_0x6dc8('0x1f')](_0x6dc8('0x20'))[_0x6dc8('0x21')](function(_0x57ce0a){logger[_0x6dc8('0x18')](_0x6dc8('0x22'),_0x57ce0a);return _0x590f04[_0x6dc8('0x17')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x6dc8('0x23')](function(_0x15d815){logger['error'](_0x15d815);return _0x590f04[_0x6dc8('0x17')](0x1f4)['json'](_0x15d815);});};exports['migrations']=function(_0x4e9f46,_0x63da34){var _0x283a42=fs[_0x6dc8('0x24')](path[_0x6dc8('0x25')](config[_0x6dc8('0xa')],_0x6dc8('0x26'),_0x6dc8('0x27')));var _0x437671=[];for(var _0x38b4ff=0x0;_0x38b4ff<_0x283a42[_0x6dc8('0x28')];_0x38b4ff++){var _0x48a512=_0x283a42[_0x38b4ff][_0x6dc8('0x29')]('.js','');if(compareVersions(module['exports'][_0x6dc8('0xc')],_0x48a512)===-0x1){_0x437671[_0x6dc8('0x2a')](_0x48a512);}}if(_0x437671[_0x6dc8('0x28')]){var _0x312944=_0x437671['sort'](compareVersions);var _0x3f1f07=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x6dc8('0x2b')],'modelName':'Migration','columnName':_0x6dc8('0xc')},'migrations':{'params':[db[_0x6dc8('0x2c')]['getQueryInterface'](),db[_0x6dc8('0x2c')][_0x6dc8('0x2d')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x6dc8('0x25')](config[_0x6dc8('0xa')],_0x6dc8('0x26'),_0x6dc8('0x27')),'pattern':/\.js$/}});_0x3f1f07['up']({'migrations':_[_0x6dc8('0x2e')](_0x312944,function(_0x4a1c73){return _0x4a1c73+'.js';})})[_0x6dc8('0x21')](function(){return _0x63da34['status'](0xc8)[_0x6dc8('0x13')]({'output':_0x6dc8('0x2f')+module['exports']['version']+_0x6dc8('0x30')+_['last'](_0x312944),'migrations':_[_0x6dc8('0x25')](_0x312944)});})[_0x6dc8('0x23')](function(_0x13023f){if(_0x13023f instanceof db[_0x6dc8('0x2c')][_0x6dc8('0x31')]){return _0x63da34[_0x6dc8('0x17')](0xc8)[_0x6dc8('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x63da34[_0x6dc8('0x17')](0x1f4)[_0x6dc8('0x13')](_0x13023f);}});}else{return _0x63da34[_0x6dc8('0x17')](0xc8)[_0x6dc8('0x13')]({'output':_0x6dc8('0x32')});}}; \ No newline at end of file +var _0xb6a6=['git\x20reset\x20--hard\x20FETCH_HEAD','error','restart','then','pm2\x20restart\x20motion\x20%s','readdirSync','join','server','migrations','length','exports','push','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','root','index','query','latest','fetch','2.0.0','json','status','origin','master','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','info'];(function(_0x6e803d,_0x2a323b){var _0x40415e=function(_0x162c27){while(--_0x162c27){_0x6e803d['push'](_0x6e803d['shift']());}};_0x40415e(++_0x2a323b);}(_0xb6a6,0x1a0));var _0x6b6a=function(_0x19637f,_0x4b2d87){_0x19637f=_0x19637f-0x0;var _0x2fcf0b=_0xb6a6[_0x19637f];return _0x2fcf0b;};'use strict';var Umzug=require(_0x6b6a('0x0'));var path=require(_0x6b6a('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0x6b6a('0x2'));var compareVersions=require(_0x6b6a('0x3'));var exec=require(_0x6b6a('0x4'))[_0x6b6a('0x5')];var db=require(_0x6b6a('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0x6b6a('0x7'));var logger=require(_0x6b6a('0x8'))(_0x6b6a('0x9'));var git=require('simple-git')(config[_0x6b6a('0xa')]);exports[_0x6b6a('0xb')]=function(_0x59e90c,_0x43f878){var _0x15ccc9={'current':module['exports'][_0x6b6a('0x2')],'phonebar':0x2};if(_0x59e90c['query']&&_0x59e90c[_0x6b6a('0xc')][_0x6b6a('0xd')]){return git[_0x6b6a('0xe')]()['tags'](function(_0x519b68,_0x1d3ce3){_0x15ccc9[_0x6b6a('0xd')]=(_0x519b68?module['exports']['version']:_0x1d3ce3[_0x6b6a('0xd')])||_0x6b6a('0xf');return _0x43f878['status'](0xc8)[_0x6b6a('0x10')](_0x15ccc9);});}else{return _0x43f878[_0x6b6a('0x11')](0xc8)['json'](_0x15ccc9);}};exports[_0x6b6a('0xe')]=function(_0x3d74e7,_0x57ac41){return git[_0x6b6a('0xe')]([_0x6b6a('0x12'),_0x6b6a('0x13')],function(_0x3739bb){if(_0x3739bb){logger['error'](_0x3739bb);return _0x57ac41[_0x6b6a('0x11')](0x1f4)[_0x6b6a('0x10')](_0x3739bb);}logger['info'](_0x6b6a('0x14'));return _0x57ac41[_0x6b6a('0x11')](0xc8)[_0x6b6a('0x10')]({'output':_0x6b6a('0x15')});});};exports[_0x6b6a('0x16')]=function(_0x4dbcee,_0x36c02e){return git[_0x6b6a('0x16')]([_0x6b6a('0x17'),'FETCH_HEAD'],function(_0x2a577c){if(_0x2a577c){logger['error'](_0x2a577c);return _0x36c02e[_0x6b6a('0x11')](0x1f4)[_0x6b6a('0x10')](_0x2a577c);}logger[_0x6b6a('0x18')](_0x6b6a('0x19'));return _0x36c02e[_0x6b6a('0x11')](0xc8)[_0x6b6a('0x10')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x3a7e48,_0x53bc97){exec('npm\x20install\x20--production',function(_0x1edaf0,_0x4c29eb,_0x7f44b1){logger[_0x6b6a('0x18')](_0x4c29eb);logger[_0x6b6a('0x18')](_0x7f44b1);if(_0x1edaf0){logger[_0x6b6a('0x1a')](_0x1edaf0);return _0x53bc97[_0x6b6a('0x11')](0x1f4)[_0x6b6a('0x10')](_0x1edaf0);}return _0x53bc97[_0x6b6a('0x11')](0xc8)[_0x6b6a('0x10')]({'output':_0x4c29eb});});};exports['restart']=function(_0x565a9c,_0x4d0f5d){return pm2[_0x6b6a('0x1b')]('motion2')[_0x6b6a('0x1c')](function(_0x4c4ca5){logger['info'](_0x6b6a('0x1d'),_0x4c4ca5);return _0x4d0f5d['status'](0xc8)[_0x6b6a('0x10')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x5ce125){logger[_0x6b6a('0x1a')](_0x5ce125);return _0x4d0f5d[_0x6b6a('0x11')](0x1f4)[_0x6b6a('0x10')](_0x5ce125);});};exports['migrations']=function(_0xa6ce4b,_0x5170a5){var _0x12a4d2=fs[_0x6b6a('0x1e')](path[_0x6b6a('0x1f')](config[_0x6b6a('0xa')],_0x6b6a('0x20'),_0x6b6a('0x21')));var _0x56a89e=[];for(var _0x484f6d=0x0;_0x484f6d<_0x12a4d2[_0x6b6a('0x22')];_0x484f6d++){var _0x5edac0=_0x12a4d2[_0x484f6d]['replace']('.js','');if(compareVersions(module[_0x6b6a('0x23')][_0x6b6a('0x2')],_0x5edac0)===-0x1){_0x56a89e[_0x6b6a('0x24')](_0x5edac0);}}if(_0x56a89e[_0x6b6a('0x22')]){var _0x31384d=_0x56a89e[_0x6b6a('0x25')](compareVersions);var _0x274158=new Umzug({'storage':_0x6b6a('0x26'),'storageOptions':{'model':db[_0x6b6a('0x27')],'modelName':_0x6b6a('0x27'),'columnName':_0x6b6a('0x2')},'migrations':{'params':[db[_0x6b6a('0x26')]['getQueryInterface'](),db[_0x6b6a('0x26')][_0x6b6a('0x28')],function(){throw new Error(_0x6b6a('0x29'));}],'path':path[_0x6b6a('0x1f')](config[_0x6b6a('0xa')],_0x6b6a('0x20'),'migrations'),'pattern':/\.js$/}});_0x274158['up']({'migrations':_[_0x6b6a('0x2a')](_0x31384d,function(_0x134c77){return _0x134c77+_0x6b6a('0x2b');})})['then'](function(){return _0x5170a5[_0x6b6a('0x11')](0xc8)[_0x6b6a('0x10')]({'output':_0x6b6a('0x2c')+module[_0x6b6a('0x23')][_0x6b6a('0x2')]+'\x20to\x20'+_[_0x6b6a('0x2d')](_0x31384d),'migrations':_['join'](_0x31384d)});})[_0x6b6a('0x2e')](function(_0x392da1){if(_0x392da1 instanceof db[_0x6b6a('0x26')][_0x6b6a('0x2f')]){return _0x5170a5[_0x6b6a('0x11')](0xc8)[_0x6b6a('0x10')]({'output':_0x6b6a('0x30')});}else{return _0x5170a5[_0x6b6a('0x11')](0x1f4)[_0x6b6a('0x10')](_0x392da1);}});}else{return _0x5170a5['status'](0xc8)[_0x6b6a('0x10')]({'output':_0x6b6a('0x30')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 1685336..f71857d 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 _0x2032=['destroy','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','delete'];(function(_0x5afc49,_0x232a9e){var _0x58d6f0=function(_0x5d8531){while(--_0x5d8531){_0x5afc49['push'](_0x5afc49['shift']());}};_0x58d6f0(++_0x232a9e);}(_0x2032,0xd9));var _0x2203=function(_0x3bdfb8,_0x2f3e77){_0x3bdfb8=_0x3bdfb8-0x0;var _0x4f912f=_0x2032[_0x3bdfb8];return _0x4f912f;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0xe')]);router[_0x2203('0xf')]('/:id',auth[_0x2203('0x9')](),controller['update']);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0x11')]);module['exports']=router; \ No newline at end of file +var _0x757a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','index','isAuthenticated','describe','/:id','post','create','put','update','util','path'];(function(_0x2f2ba2,_0x1fe227){var _0x3e265c=function(_0x40c87d){while(--_0x40c87d){_0x2f2ba2['push'](_0x2f2ba2['shift']());}};_0x3e265c(++_0x1fe227);}(_0x757a,0xde));var _0xa757=function(_0x2e4afb,_0x515a54){_0x2e4afb=_0x2e4afb-0x0;var _0x5f0ed0=_0x757a[_0x2e4afb];return _0x5f0ed0;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/describe',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['show']);router[_0xa757('0xc')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0xe')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller[_0xa757('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 3c9831a..35b07ae 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 _0xfdbd=['sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x2e377f,_0x22ed19){var _0x186e5d=function(_0x1d3b7d){while(--_0x1d3b7d){_0x2e377f['push'](_0x2e377f['shift']());}};_0x186e5d(++_0x22ed19);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x3dc68d,_0x1c1951){_0x3dc68d=_0x3dc68d-0x0;var _0xdf7f94=_0xfdbd[_0x3dc68d];return _0xdf7f94;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'type':{'type':Sequelize[_0xdfdb('0x2')]},'uniqueid':{'type':Sequelize[_0xdfdb('0x2')]},'calleridnum':{'type':Sequelize[_0xdfdb('0x2')]},'calleridname':{'type':Sequelize[_0xdfdb('0x2')]},'queue':{'type':Sequelize[_0xdfdb('0x2')]},'interface':{'type':Sequelize[_0xdfdb('0x2')]},'membername':{'type':Sequelize[_0xdfdb('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xdfdb('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xdfdb('0x3')]},'agentdumpAt':{'type':Sequelize[_0xdfdb('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xdfdb('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xdfdb('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xdfdb('0x5')]},'reason':{'type':Sequelize[_0xdfdb('0x2')]},'lastevent':{'type':Sequelize[_0xdfdb('0x2')]},'channel':{'type':Sequelize[_0xdfdb('0x2')]},'channelstate':{'type':Sequelize[_0xdfdb('0x5')]},'channelstatedesc':{'type':Sequelize[_0xdfdb('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdfdb('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xdfdb('0x2')]},'accountcode':{'type':Sequelize[_0xdfdb('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xdfdb('0x2')]},'priority':{'type':Sequelize[_0xdfdb('0x2')]},'destchannel':{'type':Sequelize[_0xdfdb('0x2')]},'destchannelstate':{'type':Sequelize[_0xdfdb('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xdfdb('0x2')]},'destcalleridnum':{'type':Sequelize[_0xdfdb('0x2')]},'destcalleridname':{'type':Sequelize[_0xdfdb('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xdfdb('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xdfdb('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xdfdb('0x2')]},'destpriority':{'type':Sequelize[_0xdfdb('0x2')]},'destuniqueid':{'type':Sequelize[_0xdfdb('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xdfdb('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xdfdb('0x2')]},'transfer':{'type':Sequelize[_0xdfdb('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xdfdb('0x2')]},'transferuniqueid':{'type':Sequelize[_0xdfdb('0x2')]},'agententerreason':{'type':Sequelize[_0xdfdb('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xda19=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE'];(function(_0x3d4e31,_0x40d41d){var _0x454daf=function(_0x505836){while(--_0x505836){_0x3d4e31['push'](_0x3d4e31['shift']());}};_0x454daf(++_0x40d41d);}(_0xda19,0xd5));var _0x9da1=function(_0x573822,_0x32b38d){_0x573822=_0x573822-0x0;var _0x1318f3=_0xda19[_0x573822];return _0x1318f3;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'type':{'type':Sequelize[_0x9da1('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x9da1('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x9da1('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9da1('0x1')]},'agentcalledAt':{'type':Sequelize[_0x9da1('0x2')]},'agentconnectAt':{'type':Sequelize[_0x9da1('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x9da1('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x9da1('0x2')]},'agentdumpAt':{'type':Sequelize[_0x9da1('0x2')]},'holdtime':{'type':Sequelize[_0x9da1('0x3')]},'agentcomplete':{'type':Sequelize[_0x9da1('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x9da1('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x9da1('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x9da1('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9da1('0x1')]},'channelstate':{'type':Sequelize[_0x9da1('0x3')]},'channelstatedesc':{'type':Sequelize[_0x9da1('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9da1('0x1')]},'connectedlinename':{'type':Sequelize[_0x9da1('0x1')]},'language':{'type':Sequelize[_0x9da1('0x1')]},'accountcode':{'type':Sequelize[_0x9da1('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x9da1('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x9da1('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x9da1('0x1')]},'destcalleridnum':{'type':Sequelize[_0x9da1('0x1')]},'destcalleridname':{'type':Sequelize[_0x9da1('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x9da1('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x9da1('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x9da1('0x1')]},'destuniqueid':{'type':Sequelize[_0x9da1('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x9da1('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x9da1('0x1')]},'transfer':{'type':Sequelize[_0x9da1('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x9da1('0x5')},'transferexten':{'type':Sequelize[_0x9da1('0x1')]},'transferuniqueid':{'type':Sequelize[_0x9da1('0x1')]},'agententerreason':{'type':Sequelize[_0x9da1('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 69894d9..83e3124 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 _0x2c19=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','index','map','VoiceAgentReport','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x52793e,_0x1e7bb4){var _0x5357bb=function(_0x44e880){while(--_0x44e880){_0x52793e['push'](_0x52793e['shift']());}};_0x5357bb(++_0x1e7bb4);}(_0x2c19,0x17a));var _0x92c1=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x2c19[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0x92c1('0x0'));var rimraf=require(_0x92c1('0x1'));var zipdir=require(_0x92c1('0x2'));var jsonpatch=require(_0x92c1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x92c1('0x4'));var Mustache=require(_0x92c1('0x5'));var util=require(_0x92c1('0x6'));var path=require('path');var sox=require(_0x92c1('0x7'));var csv=require(_0x92c1('0x8'));var ejs=require(_0x92c1('0x9'));var fs=require('fs');var fs_extra=require(_0x92c1('0xa'));var _=require(_0x92c1('0xb'));var squel=require(_0x92c1('0xc'));var crypto=require(_0x92c1('0xd'));var jsforce=require(_0x92c1('0xe'));var deskjs=require(_0x92c1('0xf'));var toCsv=require(_0x92c1('0x8'));var querystring=require(_0x92c1('0x10'));var Papa=require(_0x92c1('0x11'));var Redis=require(_0x92c1('0x12'));var authService=require(_0x92c1('0x13'));var qs=require(_0x92c1('0x14'));var as=require(_0x92c1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x92c1('0x16'))(_0x92c1('0x17'));var utils=require(_0x92c1('0x18'));var config=require(_0x92c1('0x19'));var licenseUtil=require(_0x92c1('0x1a'));var db=require(_0x92c1('0x1b'))['db'];function respondWithStatusCode(_0xb50869,_0x48da27){_0x48da27=_0x48da27||0xcc;return function(_0x1d3a16){if(_0x1d3a16){return _0xb50869['sendStatus'](_0x48da27);}return _0xb50869[_0x92c1('0x1c')](_0x48da27)[_0x92c1('0x1d')]();};}function respondWithResult(_0x27b7e8,_0x55ed03){_0x55ed03=_0x55ed03||0xc8;return function(_0x9a5f91){if(_0x9a5f91){return _0x27b7e8[_0x92c1('0x1c')](_0x55ed03)['json'](_0x9a5f91);}};}function respondWithFilteredResult(_0x1cc0c8,_0x184437){return function(_0x39d350){if(_0x39d350){var _0x585199=typeof _0x184437[_0x92c1('0x1e')]===_0x92c1('0x1f')&&typeof _0x184437[_0x92c1('0x20')]===_0x92c1('0x1f');var _0x3f9a54=_0x39d350['count'];var _0xa9a3d8=_0x585199?0x0:_0x184437[_0x92c1('0x1e')];var _0x24bae5=_0x585199?_0x39d350[_0x92c1('0x21')]:_0x184437[_0x92c1('0x1e')]+_0x184437['limit'];var _0x477c66;if(_0x24bae5>=_0x3f9a54){_0x24bae5=_0x3f9a54;_0x477c66=0xc8;}else{_0x477c66=0xce;}_0x1cc0c8[_0x92c1('0x1c')](_0x477c66);return _0x1cc0c8[_0x92c1('0x22')](_0x92c1('0x23'),_0xa9a3d8+'-'+_0x24bae5+'/'+_0x3f9a54)[_0x92c1('0x24')](_0x39d350);}return null;};}function patchUpdates(_0x24c23d){return function(_0x3344ed){try{jsonpatch[_0x92c1('0x25')](_0x3344ed,_0x24c23d,!![]);}catch(_0xb00334){return BPromise[_0x92c1('0x26')](_0xb00334);}return _0x3344ed['save']();};}function saveUpdates(_0x52601b,_0x5ae49){return function(_0xc1a5d7){if(_0xc1a5d7){return _0xc1a5d7[_0x92c1('0x27')](_0x52601b)[_0x92c1('0x28')](function(_0x262651){return _0x262651;});}return null;};}function removeEntity(_0x2ac7ff,_0x725dba){return function(_0x1606ea){if(_0x1606ea){return _0x1606ea[_0x92c1('0x29')]()['then'](function(){_0x2ac7ff[_0x92c1('0x1c')](0xcc)[_0x92c1('0x1d')]();});}};}function handleEntityNotFound(_0x25ebdb,_0x53d78c){return function(_0x3f8acd){if(!_0x3f8acd){_0x25ebdb['sendStatus'](0x194);}return _0x3f8acd;};}function handleError(_0xcf4909,_0x3b8027){_0x3b8027=_0x3b8027||0x1f4;return function(_0x15ee4){logger['error'](_0x15ee4[_0x92c1('0x2a')]);if(_0x15ee4['name']){delete _0x15ee4['name'];}_0xcf4909[_0x92c1('0x1c')](_0x3b8027)['send'](_0x15ee4);};}exports[_0x92c1('0x2b')]=function(_0x2dbb5e,_0x445082){var _0x117dcd={},_0x4a3b54={},_0x4ef842={'count':0x0,'rows':[]};var _0x447179=_[_0x92c1('0x2c')](db[_0x92c1('0x2d')][_0x92c1('0x2e')],function(_0x38907b){return{'name':_0x38907b[_0x92c1('0x2f')],'type':_0x38907b[_0x92c1('0x30')][_0x92c1('0x31')]};});_0x4a3b54[_0x92c1('0x32')]=_[_0x92c1('0x2c')](_0x447179,_0x92c1('0x33'));_0x4a3b54['query']=_['keys'](_0x2dbb5e[_0x92c1('0x34')]);_0x4a3b54[_0x92c1('0x35')]=_[_0x92c1('0x36')](_0x4a3b54[_0x92c1('0x32')],_0x4a3b54[_0x92c1('0x34')]);_0x117dcd['attributes']=_[_0x92c1('0x36')](_0x4a3b54['model'],qs['fields'](_0x2dbb5e[_0x92c1('0x34')][_0x92c1('0x37')]));_0x117dcd['attributes']=_0x117dcd[_0x92c1('0x38')][_0x92c1('0x39')]?_0x117dcd['attributes']:_0x4a3b54[_0x92c1('0x32')];if(!_0x2dbb5e[_0x92c1('0x34')][_0x92c1('0x3a')](_0x92c1('0x3b'))){_0x117dcd[_0x92c1('0x20')]=qs[_0x92c1('0x20')](_0x2dbb5e[_0x92c1('0x34')][_0x92c1('0x20')]);_0x117dcd[_0x92c1('0x1e')]=qs[_0x92c1('0x1e')](_0x2dbb5e['query']['offset']);}_0x117dcd['order']=qs[_0x92c1('0x3c')](_0x2dbb5e[_0x92c1('0x34')][_0x92c1('0x3c')]);_0x117dcd['where']=qs[_0x92c1('0x35')](_[_0x92c1('0x3d')](_0x2dbb5e[_0x92c1('0x34')],_0x4a3b54[_0x92c1('0x35')]),_0x447179);if(_0x2dbb5e[_0x92c1('0x34')]['filter']){_0x117dcd[_0x92c1('0x3e')]=_[_0x92c1('0x3f')](_0x117dcd[_0x92c1('0x3e')],{'$or':_['map'](_0x447179,function(_0x55100e){if(_0x55100e[_0x92c1('0x30')]!==_0x92c1('0x40')){var _0x4fa4a6={};_0x4fa4a6[_0x55100e[_0x92c1('0x33')]]={'$like':'%'+_0x2dbb5e['query'][_0x92c1('0x41')]+'%'};return _0x4fa4a6;}})});}_0x117dcd=_[_0x92c1('0x3f')]({},_0x117dcd,_0x2dbb5e[_0x92c1('0x42')]);var _0x25392c={'where':_0x117dcd['where']};return db[_0x92c1('0x2d')][_0x92c1('0x21')](_0x25392c)['then'](function(_0x57103a){_0x4ef842[_0x92c1('0x21')]=_0x57103a;if(_0x2dbb5e[_0x92c1('0x34')][_0x92c1('0x43')]){_0x117dcd[_0x92c1('0x44')]=[{'all':!![]}];}return db[_0x92c1('0x2d')][_0x92c1('0x45')](_0x117dcd);})['then'](function(_0x46d458){_0x4ef842[_0x92c1('0x46')]=_0x46d458;return _0x4ef842;})[_0x92c1('0x28')](respondWithFilteredResult(_0x445082,_0x117dcd))[_0x92c1('0x47')](handleError(_0x445082,null));};exports[_0x92c1('0x48')]=function(_0x14fc69,_0x3f3fd7){var _0x34637c={'raw':![],'where':{'id':_0x14fc69[_0x92c1('0x49')]['id']}},_0x3bfd54={};_0x3bfd54[_0x92c1('0x32')]=_[_0x92c1('0x4a')](db[_0x92c1('0x2d')][_0x92c1('0x2e')]);_0x3bfd54[_0x92c1('0x34')]=_[_0x92c1('0x4a')](_0x14fc69[_0x92c1('0x34')]);_0x3bfd54['filters']=_[_0x92c1('0x36')](_0x3bfd54[_0x92c1('0x32')],_0x3bfd54[_0x92c1('0x34')]);_0x34637c['attributes']=_['intersection'](_0x3bfd54[_0x92c1('0x32')],qs[_0x92c1('0x37')](_0x14fc69['query']['fields']));_0x34637c[_0x92c1('0x38')]=_0x34637c[_0x92c1('0x38')]['length']?_0x34637c[_0x92c1('0x38')]:_0x3bfd54[_0x92c1('0x32')];if(_0x14fc69[_0x92c1('0x34')][_0x92c1('0x43')]){_0x34637c[_0x92c1('0x44')]=[{'all':!![]}];}_0x34637c=_[_0x92c1('0x3f')]({},_0x34637c,_0x14fc69[_0x92c1('0x42')]);return db[_0x92c1('0x2d')][_0x92c1('0x4b')](_0x34637c)[_0x92c1('0x28')](handleEntityNotFound(_0x3f3fd7,null))[_0x92c1('0x28')](respondWithResult(_0x3f3fd7,null))['catch'](handleError(_0x3f3fd7,null));};exports[_0x92c1('0x4c')]=function(_0x19c9bd,_0x1e0dd0){return db[_0x92c1('0x2d')][_0x92c1('0x4c')](_0x19c9bd['body'],{})['then'](respondWithResult(_0x1e0dd0,0xc9))['catch'](handleError(_0x1e0dd0,null));};exports[_0x92c1('0x27')]=function(_0x429ae3,_0x5f3e13){if(_0x429ae3['body']['id']){delete _0x429ae3[_0x92c1('0x4d')]['id'];}return db[_0x92c1('0x2d')][_0x92c1('0x4b')]({'where':{'id':_0x429ae3[_0x92c1('0x49')]['id']}})['then'](handleEntityNotFound(_0x5f3e13,null))['then'](saveUpdates(_0x429ae3['body'],null))[_0x92c1('0x28')](respondWithResult(_0x5f3e13,null))[_0x92c1('0x47')](handleError(_0x5f3e13,null));};exports[_0x92c1('0x29')]=function(_0x2d2899,_0x271f4e){return db[_0x92c1('0x2d')][_0x92c1('0x4b')]({'where':{'id':_0x2d2899[_0x92c1('0x49')]['id']}})[_0x92c1('0x28')](handleEntityNotFound(_0x271f4e,null))[_0x92c1('0x28')](removeEntity(_0x271f4e,null))['catch'](handleError(_0x271f4e,null));};exports[_0x92c1('0x4e')]=function(_0x37b21a,_0x402a40){return db['VoiceAgentReport'][_0x92c1('0x4e')]()[_0x92c1('0x28')](respondWithResult(_0x402a40,null))[_0x92c1('0x47')](handleError(_0x402a40,null));}; \ No newline at end of file +var _0x3379=['../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','limit','status','set','json','save','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','count','VoiceAgentReport','findAll','rows','catch','params','includeAll','options','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x32005b,_0x24b894){var _0x1dc31f=function(_0xade624){while(--_0xade624){_0x32005b['push'](_0x32005b['shift']());}};_0x1dc31f(++_0x24b894);}(_0x3379,0x115));var _0x9337=function(_0x28b2da,_0x540b55){_0x28b2da=_0x28b2da-0x0;var _0x27026a=_0x3379[_0x28b2da];return _0x27026a;};'use strict';var emlformat=require(_0x9337('0x0'));var rimraf=require(_0x9337('0x1'));var zipdir=require(_0x9337('0x2'));var jsonpatch=require(_0x9337('0x3'));var rp=require('request-promise');var moment=require(_0x9337('0x4'));var BPromise=require(_0x9337('0x5'));var Mustache=require(_0x9337('0x6'));var util=require(_0x9337('0x7'));var path=require('path');var sox=require(_0x9337('0x8'));var csv=require(_0x9337('0x9'));var ejs=require(_0x9337('0xa'));var fs=require('fs');var fs_extra=require(_0x9337('0xb'));var _=require('lodash');var squel=require(_0x9337('0xc'));var crypto=require('crypto');var jsforce=require(_0x9337('0xd'));var deskjs=require(_0x9337('0xe'));var toCsv=require(_0x9337('0x9'));var querystring=require(_0x9337('0xf'));var Papa=require(_0x9337('0x10'));var Redis=require('ioredis');var authService=require(_0x9337('0x11'));var qs=require(_0x9337('0x12'));var as=require(_0x9337('0x13'));var hardwareService=require(_0x9337('0x14'));var logger=require(_0x9337('0x15'))('api');var utils=require(_0x9337('0x16'));var config=require(_0x9337('0x17'));var licenseUtil=require(_0x9337('0x18'));var db=require(_0x9337('0x19'))['db'];function respondWithStatusCode(_0x3303f6,_0x32c1f6){_0x32c1f6=_0x32c1f6||0xcc;return function(_0x324e54){if(_0x324e54){return _0x3303f6['sendStatus'](_0x32c1f6);}return _0x3303f6['status'](_0x32c1f6)[_0x9337('0x1a')]();};}function respondWithResult(_0xedb2b6,_0x12f1f1){_0x12f1f1=_0x12f1f1||0xc8;return function(_0x14e7a0){if(_0x14e7a0){return _0xedb2b6['status'](_0x12f1f1)['json'](_0x14e7a0);}};}function respondWithFilteredResult(_0x13515e,_0x594b51){return function(_0x513263){if(_0x513263){var _0x35e805=typeof _0x594b51[_0x9337('0x1b')]===_0x9337('0x1c')&&typeof _0x594b51['limit']===_0x9337('0x1c');var _0x25633f=_0x513263['count'];var _0x5e49e7=_0x35e805?0x0:_0x594b51[_0x9337('0x1b')];var _0x462196=_0x35e805?_0x513263['count']:_0x594b51[_0x9337('0x1b')]+_0x594b51[_0x9337('0x1d')];var _0x4e9802;if(_0x462196>=_0x25633f){_0x462196=_0x25633f;_0x4e9802=0xc8;}else{_0x4e9802=0xce;}_0x13515e[_0x9337('0x1e')](_0x4e9802);return _0x13515e[_0x9337('0x1f')]('Content-Range',_0x5e49e7+'-'+_0x462196+'/'+_0x25633f)[_0x9337('0x20')](_0x513263);}return null;};}function patchUpdates(_0x7c334f){return function(_0x55e225){try{jsonpatch['apply'](_0x55e225,_0x7c334f,!![]);}catch(_0x28a237){return BPromise['reject'](_0x28a237);}return _0x55e225[_0x9337('0x21')]();};}function saveUpdates(_0x55601a,_0x29e989){return function(_0x5768d5){if(_0x5768d5){return _0x5768d5['update'](_0x55601a)[_0x9337('0x22')](function(_0x4fd485){return _0x4fd485;});}return null;};}function removeEntity(_0xe4b053,_0x543cfc){return function(_0x1e8d80){if(_0x1e8d80){return _0x1e8d80[_0x9337('0x23')]()[_0x9337('0x22')](function(){_0xe4b053[_0x9337('0x1e')](0xcc)[_0x9337('0x1a')]();});}};}function handleEntityNotFound(_0xb49ff1,_0x523b64){return function(_0x55cdd6){if(!_0x55cdd6){_0xb49ff1[_0x9337('0x24')](0x194);}return _0x55cdd6;};}function handleError(_0x3eb4c4,_0x2a87e7){_0x2a87e7=_0x2a87e7||0x1f4;return function(_0x178ed5){logger['error'](_0x178ed5[_0x9337('0x25')]);if(_0x178ed5['name']){delete _0x178ed5[_0x9337('0x26')];}_0x3eb4c4[_0x9337('0x1e')](_0x2a87e7)[_0x9337('0x27')](_0x178ed5);};}exports[_0x9337('0x28')]=function(_0x4da717,_0x5bca1e){var _0x33dc88={},_0x1bcb04={},_0x118972={'count':0x0,'rows':[]};var _0x263ff1=_[_0x9337('0x29')](db['VoiceAgentReport'][_0x9337('0x2a')],function(_0x590b04){return{'name':_0x590b04[_0x9337('0x2b')],'type':_0x590b04['type']['key']};});_0x1bcb04['model']=_['map'](_0x263ff1,_0x9337('0x26'));_0x1bcb04[_0x9337('0x2c')]=_[_0x9337('0x2d')](_0x4da717[_0x9337('0x2c')]);_0x1bcb04[_0x9337('0x2e')]=_['intersection'](_0x1bcb04['model'],_0x1bcb04[_0x9337('0x2c')]);_0x33dc88[_0x9337('0x2f')]=_[_0x9337('0x30')](_0x1bcb04[_0x9337('0x31')],qs[_0x9337('0x32')](_0x4da717[_0x9337('0x2c')]['fields']));_0x33dc88[_0x9337('0x2f')]=_0x33dc88[_0x9337('0x2f')][_0x9337('0x33')]?_0x33dc88['attributes']:_0x1bcb04[_0x9337('0x31')];if(!_0x4da717['query'][_0x9337('0x34')](_0x9337('0x35'))){_0x33dc88[_0x9337('0x1d')]=qs[_0x9337('0x1d')](_0x4da717[_0x9337('0x2c')][_0x9337('0x1d')]);_0x33dc88[_0x9337('0x1b')]=qs[_0x9337('0x1b')](_0x4da717[_0x9337('0x2c')][_0x9337('0x1b')]);}_0x33dc88[_0x9337('0x36')]=qs[_0x9337('0x37')](_0x4da717[_0x9337('0x2c')][_0x9337('0x37')]);_0x33dc88['where']=qs[_0x9337('0x2e')](_[_0x9337('0x38')](_0x4da717['query'],_0x1bcb04[_0x9337('0x2e')]),_0x263ff1);if(_0x4da717[_0x9337('0x2c')][_0x9337('0x39')]){_0x33dc88[_0x9337('0x3a')]=_['merge'](_0x33dc88[_0x9337('0x3a')],{'$or':_['map'](_0x263ff1,function(_0x20cbd1){if(_0x20cbd1[_0x9337('0x3b')]!==_0x9337('0x3c')){var _0x59f06f={};_0x59f06f[_0x20cbd1[_0x9337('0x26')]]={'$like':'%'+_0x4da717['query']['filter']+'%'};return _0x59f06f;}})});}_0x33dc88=_[_0x9337('0x3d')]({},_0x33dc88,_0x4da717['options']);var _0x58c033={'where':_0x33dc88[_0x9337('0x3a')]};return db['VoiceAgentReport'][_0x9337('0x3e')](_0x58c033)['then'](function(_0x5b9ee8){_0x118972[_0x9337('0x3e')]=_0x5b9ee8;if(_0x4da717['query']['includeAll']){_0x33dc88['include']=[{'all':!![]}];}return db[_0x9337('0x3f')][_0x9337('0x40')](_0x33dc88);})['then'](function(_0x2f266e){_0x118972[_0x9337('0x41')]=_0x2f266e;return _0x118972;})[_0x9337('0x22')](respondWithFilteredResult(_0x5bca1e,_0x33dc88))[_0x9337('0x42')](handleError(_0x5bca1e,null));};exports['show']=function(_0x39d4b0,_0x2f457d){var _0x36f3bc={'raw':![],'where':{'id':_0x39d4b0[_0x9337('0x43')]['id']}},_0xd7e495={};_0xd7e495[_0x9337('0x31')]=_[_0x9337('0x2d')](db[_0x9337('0x3f')]['rawAttributes']);_0xd7e495[_0x9337('0x2c')]=_[_0x9337('0x2d')](_0x39d4b0[_0x9337('0x2c')]);_0xd7e495[_0x9337('0x2e')]=_[_0x9337('0x30')](_0xd7e495[_0x9337('0x31')],_0xd7e495[_0x9337('0x2c')]);_0x36f3bc[_0x9337('0x2f')]=_['intersection'](_0xd7e495['model'],qs[_0x9337('0x32')](_0x39d4b0[_0x9337('0x2c')][_0x9337('0x32')]));_0x36f3bc['attributes']=_0x36f3bc[_0x9337('0x2f')][_0x9337('0x33')]?_0x36f3bc[_0x9337('0x2f')]:_0xd7e495[_0x9337('0x31')];if(_0x39d4b0[_0x9337('0x2c')][_0x9337('0x44')]){_0x36f3bc['include']=[{'all':!![]}];}_0x36f3bc=_[_0x9337('0x3d')]({},_0x36f3bc,_0x39d4b0[_0x9337('0x45')]);return db['VoiceAgentReport']['find'](_0x36f3bc)[_0x9337('0x22')](handleEntityNotFound(_0x2f457d,null))[_0x9337('0x22')](respondWithResult(_0x2f457d,null))[_0x9337('0x42')](handleError(_0x2f457d,null));};exports[_0x9337('0x46')]=function(_0x23f319,_0x56bfe7){return db[_0x9337('0x3f')][_0x9337('0x46')](_0x23f319[_0x9337('0x47')],{})[_0x9337('0x22')](respondWithResult(_0x56bfe7,0xc9))[_0x9337('0x42')](handleError(_0x56bfe7,null));};exports[_0x9337('0x48')]=function(_0x9f57ab,_0x32efcd){if(_0x9f57ab[_0x9337('0x47')]['id']){delete _0x9f57ab[_0x9337('0x47')]['id'];}return db[_0x9337('0x3f')][_0x9337('0x49')]({'where':{'id':_0x9f57ab[_0x9337('0x43')]['id']}})[_0x9337('0x22')](handleEntityNotFound(_0x32efcd,null))[_0x9337('0x22')](saveUpdates(_0x9f57ab['body'],null))['then'](respondWithResult(_0x32efcd,null))[_0x9337('0x42')](handleError(_0x32efcd,null));};exports[_0x9337('0x23')]=function(_0x56a23a,_0x2b094b){return db[_0x9337('0x3f')]['find']({'where':{'id':_0x56a23a[_0x9337('0x43')]['id']}})[_0x9337('0x22')](handleEntityNotFound(_0x2b094b,null))[_0x9337('0x22')](removeEntity(_0x2b094b,null))[_0x9337('0x42')](handleError(_0x2b094b,null));};exports[_0x9337('0x4a')]=function(_0x2e2c84,_0x3686dc){return db[_0x9337('0x3f')][_0x9337('0x4a')]()['then'](respondWithResult(_0x3686dc,null))[_0x9337('0x42')](handleError(_0x3686dc,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 614d1f6..b8b3fe7 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 _0x331b=['exports','define','uniqueid','destuniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0x5b853c,_0x253ac7){var _0x111829=function(_0x1dc674){while(--_0x1dc674){_0x5b853c['push'](_0x5b853c['shift']());}};_0x111829(++_0x253ac7);}(_0x331b,0x149));var _0xb331=function(_0x304633,_0x261b26){_0x304633=_0x304633-0x0;var _0x1ca9f9=_0x331b[_0x304633];return _0x1ca9f9;};'use strict';var _=require(_0xb331('0x0'));var util=require('util');var logger=require(_0xb331('0x1'))(_0xb331('0x2'));var moment=require(_0xb331('0x3'));var BPromise=require('bluebird');var rp=require(_0xb331('0x4'));var fs=require('fs');var path=require(_0xb331('0x5'));var rimraf=require(_0xb331('0x6'));var config=require(_0xb331('0x7'));var attributes=require(_0xb331('0x8'));module[_0xb331('0x9')]=function(_0x3b8f79,_0xc53650){return _0x3b8f79[_0xb331('0xa')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xb331('0xb'),_0xb331('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6546=['uniqueid','destuniqueid','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent'];(function(_0x54059d,_0x7776f3){var _0x1bc9f0=function(_0x32a325){while(--_0x32a325){_0x54059d['push'](_0x54059d['shift']());}};_0x1bc9f0(++_0x7776f3);}(_0x6546,0x1e2));var _0x6654=function(_0x21381a,_0x3dce0d){_0x21381a=_0x21381a-0x0;var _0x399bb3=_0x6546[_0x21381a];return _0x399bb3;};'use strict';var _=require(_0x6654('0x0'));var util=require(_0x6654('0x1'));var logger=require('../../config/logger')(_0x6654('0x2'));var moment=require(_0x6654('0x3'));var BPromise=require(_0x6654('0x4'));var rp=require(_0x6654('0x5'));var fs=require('fs');var path=require(_0x6654('0x6'));var rimraf=require('rimraf');var config=require(_0x6654('0x7'));var attributes=require(_0x6654('0x8'));module[_0x6654('0x9')]=function(_0x9dcfde,_0x2b84c0){return _0x9dcfde[_0x6654('0xa')](_0x6654('0xb'),attributes,{'tableName':_0x6654('0xc'),'paranoid':![],'indexes':[{'fields':[_0x6654('0xd'),_0x6654('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 097b11e..2de1163 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 _0xc376=['stringify','error','code','message','result','catch','CreateVoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','update','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x25e7ee,_0x4d8966){var _0x1251f2=function(_0x165472){while(--_0x165472){_0x25e7ee['push'](_0x25e7ee['shift']());}};_0x1251f2(++_0x4d8966);}(_0xc376,0x1bc));var _0x6c37=function(_0x3cb30b,_0x504b3e){_0x3cb30b=_0x3cb30b-0x0;var _0x2ca717=_0xc376[_0x3cb30b];return _0x2ca717;};'use strict';var _=require('lodash');var util=require(_0x6c37('0x0'));var moment=require(_0x6c37('0x1'));var BPromise=require(_0x6c37('0x2'));var rs=require(_0x6c37('0x3'));var fs=require('fs');var Redis=require(_0x6c37('0x4'));var db=require(_0x6c37('0x5'))['db'];var utils=require(_0x6c37('0x6'));var logger=require(_0x6c37('0x7'))(_0x6c37('0x8'));var config=require(_0x6c37('0x9'));var jayson=require(_0x6c37('0xa'));var client=jayson[_0x6c37('0xb')][_0x6c37('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ef307,_0x52a6b3,_0x2b6d43){return new BPromise(function(_0x20e57a,_0x5795c5){return client['request'](_0x1ef307,_0x2b6d43)[_0x6c37('0xd')](function(_0x319e6e){logger[_0x6c37('0xe')](_0x6c37('0xf'),_0x52a6b3,_0x6c37('0x10'));logger[_0x6c37('0x11')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x52a6b3,'request\x20sent',JSON[_0x6c37('0x12')](_0x319e6e));if(_0x319e6e[_0x6c37('0x13')]){if(_0x319e6e[_0x6c37('0x13')][_0x6c37('0x14')]===0x1f4){logger['error'](_0x6c37('0xf'),_0x52a6b3,_0x319e6e['error']['message']);return _0x5795c5(_0x319e6e[_0x6c37('0x13')][_0x6c37('0x15')]);}logger['error'](_0x6c37('0xf'),_0x52a6b3,_0x319e6e['error']['message']);return _0x20e57a(_0x319e6e[_0x6c37('0x13')][_0x6c37('0x15')]);}else{logger[_0x6c37('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x52a6b3,'request\x20sent');_0x20e57a(_0x319e6e[_0x6c37('0x16')][_0x6c37('0x15')]);}})[_0x6c37('0x17')](function(_0x30060a){logger[_0x6c37('0x13')](_0x6c37('0xf'),_0x52a6b3,_0x30060a);_0x5795c5(_0x30060a);});});}exports[_0x6c37('0x18')]=function(_0x3a86b4){var _0x34581e=this;return new Promise(function(_0x14bef2,_0xcc42ab){return db['VoiceAgentReport'][_0x6c37('0x19')](_0x3a86b4[_0x6c37('0x1a')],{'raw':_0x3a86b4[_0x6c37('0x1b')]?_0x3a86b4[_0x6c37('0x1b')][_0x6c37('0x1c')]===undefined?!![]:![]:!![]})[_0x6c37('0xd')](function(_0x8c8b4a){logger[_0x6c37('0xe')](_0x6c37('0x18'),_0x3a86b4);logger[_0x6c37('0x11')]('CreateVoiceAgentReport',_0x3a86b4,JSON[_0x6c37('0x12')](_0x8c8b4a));_0x14bef2(_0x8c8b4a);})['catch'](function(_0xbca4ff){logger[_0x6c37('0x13')](_0x6c37('0x18'),_0xbca4ff[_0x6c37('0x15')],_0x3a86b4);_0xcc42ab(_0x34581e['error'](0x1f4,_0xbca4ff['message']));});});};exports[_0x6c37('0x1d')]=function(_0x3d6426){var _0x3ec8a0=this;return new Promise(function(_0x5d529f,_0x20322f){return db['VoiceAgentReport'][_0x6c37('0x1e')](_0x3d6426['body'],{'raw':_0x3d6426['options']?_0x3d6426[_0x6c37('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d6426[_0x6c37('0x1b')]?_0x3d6426[_0x6c37('0x1b')]['where']||null:null,'attributes':_0x3d6426[_0x6c37('0x1b')]?_0x3d6426[_0x6c37('0x1b')][_0x6c37('0x1f')]||null:null,'limit':_0x3d6426[_0x6c37('0x1b')]?_0x3d6426[_0x6c37('0x1b')][_0x6c37('0x20')]||null:null})[_0x6c37('0xd')](function(_0x11b095){logger[_0x6c37('0xe')](_0x6c37('0x1d'),_0x3d6426);logger[_0x6c37('0x11')](_0x6c37('0x1d'),_0x3d6426,JSON['stringify'](_0x11b095));_0x5d529f(_0x11b095);})[_0x6c37('0x17')](function(_0x8faa7){logger[_0x6c37('0x13')]('UpdateVoiceAgentReport',_0x8faa7['message'],_0x3d6426);_0x20322f(_0x3ec8a0['error'](0x1f4,_0x8faa7[_0x6c37('0x15')]));});});}; \ No newline at end of file +var _0x978a=['options','raw','UpdateVoiceAgentReport','VoiceAgentReport','update','where','limit','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateVoiceAgentReport','create','body'];(function(_0x7a6aed,_0x335e68){var _0x9dbabf=function(_0x453c9c){while(--_0x453c9c){_0x7a6aed['push'](_0x7a6aed['shift']());}};_0x9dbabf(++_0x335e68);}(_0x978a,0x16f));var _0xa978=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x978a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa978('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa978('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa978('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa978('0x3'));var logger=require(_0xa978('0x4'))(_0xa978('0x5'));var config=require(_0xa978('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa978('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c603e,_0x128111,_0x2bd711){return new BPromise(function(_0x510522,_0x3b657d){return client[_0xa978('0x8')](_0x2c603e,_0x2bd711)[_0xa978('0x9')](function(_0x3d6116){logger[_0xa978('0xa')](_0xa978('0xb'),_0x128111,'request\x20sent');logger[_0xa978('0xc')](_0xa978('0xd'),_0x128111,_0xa978('0xe'),JSON[_0xa978('0xf')](_0x3d6116));if(_0x3d6116[_0xa978('0x10')]){if(_0x3d6116['error']['code']===0x1f4){logger[_0xa978('0x10')](_0xa978('0xb'),_0x128111,_0x3d6116[_0xa978('0x10')][_0xa978('0x11')]);return _0x3b657d(_0x3d6116[_0xa978('0x10')][_0xa978('0x11')]);}logger['error'](_0xa978('0xb'),_0x128111,_0x3d6116[_0xa978('0x10')][_0xa978('0x11')]);return _0x510522(_0x3d6116['error'][_0xa978('0x11')]);}else{logger['info'](_0xa978('0xb'),_0x128111,_0xa978('0xe'));_0x510522(_0x3d6116[_0xa978('0x12')][_0xa978('0x11')]);}})[_0xa978('0x13')](function(_0x16c9d6){logger[_0xa978('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x128111,_0x16c9d6);_0x3b657d(_0x16c9d6);});});}exports[_0xa978('0x14')]=function(_0x400d3e){var _0x1cfd4c=this;return new Promise(function(_0x46bc8b,_0x31e8e0){return db['VoiceAgentReport'][_0xa978('0x15')](_0x400d3e[_0xa978('0x16')],{'raw':_0x400d3e[_0xa978('0x17')]?_0x400d3e[_0xa978('0x17')][_0xa978('0x18')]===undefined?!![]:![]:!![]})[_0xa978('0x9')](function(_0x741468){logger[_0xa978('0xa')]('CreateVoiceAgentReport',_0x400d3e);logger[_0xa978('0xc')](_0xa978('0x14'),_0x400d3e,JSON[_0xa978('0xf')](_0x741468));_0x46bc8b(_0x741468);})[_0xa978('0x13')](function(_0x2bf3e3){logger[_0xa978('0x10')](_0xa978('0x14'),_0x2bf3e3['message'],_0x400d3e);_0x31e8e0(_0x1cfd4c[_0xa978('0x10')](0x1f4,_0x2bf3e3[_0xa978('0x11')]));});});};exports[_0xa978('0x19')]=function(_0x22afd2){var _0x1cad38=this;return new Promise(function(_0x28a334,_0x56e126){return db[_0xa978('0x1a')][_0xa978('0x1b')](_0x22afd2[_0xa978('0x16')],{'raw':_0x22afd2['options']?_0x22afd2['options'][_0xa978('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22afd2[_0xa978('0x17')]?_0x22afd2[_0xa978('0x17')][_0xa978('0x1c')]||null:null,'attributes':_0x22afd2[_0xa978('0x17')]?_0x22afd2[_0xa978('0x17')]['attributes']||null:null,'limit':_0x22afd2[_0xa978('0x17')]?_0x22afd2[_0xa978('0x17')][_0xa978('0x1d')]||null:null})[_0xa978('0x9')](function(_0x49287f){logger[_0xa978('0xa')](_0xa978('0x19'),_0x22afd2);logger[_0xa978('0xc')]('UpdateVoiceAgentReport',_0x22afd2,JSON['stringify'](_0x49287f));_0x28a334(_0x49287f);})[_0xa978('0x13')](function(_0x53569d){logger['error'](_0xa978('0x19'),_0x53569d[_0xa978('0x11')],_0x22afd2);_0x56e126(_0x1cad38[_0xa978('0x10')](0x1f4,_0x53569d['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 59f969b..c5ce6d8 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','show','post'];(function(_0x31172e,_0xa59e5){var _0x414ada=function(_0x37ede4){while(--_0x37ede4){_0x31172e['push'](_0x31172e['shift']());}};_0x414ada(++_0xa59e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','show','post'];(function(_0x2718c7,_0x5a1636){var _0x59d89c=function(_0x4d4f49){while(--_0x4d4f49){_0x2718c7['push'](_0x2718c7['shift']());}};_0x59d89c(++_0x5a1636);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 1ba5a4a..24e11b8 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 _0x3c6c=['TEXT','DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer'];(function(_0x4ceaa8,_0x452176){var _0x94bff6=function(_0x2b24b3){while(--_0x2b24b3){_0x4ceaa8['push'](_0x4ceaa8['shift']());}};_0x94bff6(++_0x452176);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x11c52b,_0x5ad399){_0x11c52b=_0x11c52b-0x0;var _0xc7aed8=_0x3c6c[_0x11c52b];return _0xc7aed8;};'use strict';var Sequelize=require(_0xc3c6('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xc3c6('0x1')]},'type':{'type':Sequelize[_0xc3c6('0x2')](_0xc3c6('0x3'),_0xc3c6('0x4'),_0xc3c6('0x5'),_0xc3c6('0x6'),_0xc3c6('0x7'),_0xc3c6('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc3c6('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xc3c6('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xc3c6('0x9')]},'starttime':{'type':Sequelize[_0xc3c6('0xa')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xc3c6('0xa')]},'endtime':{'type':Sequelize[_0xc3c6('0xa')]},'duration':{'type':Sequelize[_0xc3c6('0xb')]},'billableseconds':{'type':Sequelize[_0xc3c6('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc3c6('0x1')]},'amaflags':{'type':Sequelize[_0xc3c6('0x1')]},'userfield':{'type':Sequelize[_0xc3c6('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xc3c6('0x1')]},'note':{'type':Sequelize[_0xc3c6('0x1')]},'prefix':{'type':Sequelize[_0xc3c6('0x1')]},'routeid':{'type':Sequelize[_0xc3c6('0xb')]},'sipcallid':{'type':Sequelize[_0xc3c6('0x1')]}}; \ No newline at end of file +var _0xdb94=['STRING','inbound','internal','outbound','inbound-fax','outbound-fax','TEXT','DATE','INTEGER','exports'];(function(_0x253694,_0x1177cf){var _0x39d218=function(_0x22c086){while(--_0x22c086){_0x253694['push'](_0x253694['shift']());}};_0x39d218(++_0x1177cf);}(_0xdb94,0xe5));var _0x4db9=function(_0x562094,_0x1a40a8){_0x562094=_0x562094-0x0;var _0x2119ee=_0xdb94[_0x562094];return _0x2119ee;};'use strict';var Sequelize=require('sequelize');module[_0x4db9('0x0')]={'uniqueid':{'type':Sequelize[_0x4db9('0x1')]},'type':{'type':Sequelize['ENUM'](_0x4db9('0x2'),_0x4db9('0x3'),_0x4db9('0x4'),_0x4db9('0x5'),_0x4db9('0x6'),'dialer')},'tag':{'type':Sequelize[_0x4db9('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x4db9('0x1')]},'destination':{'type':Sequelize[_0x4db9('0x1')]},'destinationcontext':{'type':Sequelize[_0x4db9('0x1')]},'callerid':{'type':Sequelize[_0x4db9('0x1')]},'channel':{'type':Sequelize[_0x4db9('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x4db9('0x1')]},'lastdata':{'type':Sequelize[_0x4db9('0x7')]},'starttime':{'type':Sequelize[_0x4db9('0x8')]},'systemanswertime':{'type':Sequelize[_0x4db9('0x8')]},'answertime':{'type':Sequelize[_0x4db9('0x8')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x4db9('0x9')]},'billableseconds':{'type':Sequelize[_0x4db9('0x9')]},'mohtime':{'type':Sequelize[_0x4db9('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4db9('0x1')]},'amaflags':{'type':Sequelize[_0x4db9('0x1')]},'userfield':{'type':Sequelize[_0x4db9('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x4db9('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x4db9('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x4db9('0x9')]},'sipcallid':{'type':Sequelize[_0x4db9('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index b99e4ad..f0a080f 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 _0xedd9=['filter','merge','VIRTUAL','options','includeAll','include','fullname','User','findAll','catch','show','params','find','create','describe','uniqueid','user','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','VoiceCallReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x260f87,_0x551ce2){var _0x3fd8d2=function(_0x1c4637){while(--_0x1c4637){_0x260f87['push'](_0x260f87['shift']());}};_0x3fd8d2(++_0x551ce2);}(_0xedd9,0xfc));var _0x9edd=function(_0x289c0d,_0x2bdc41){_0x289c0d=_0x289c0d-0x0;var _0x57099c=_0xedd9[_0x289c0d];return _0x57099c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['VoiceCallReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'attributes':['id',_0x9edd('0x2e'),_0x9edd('0x42'),'alias'],'model':db[_0x9edd('0x43')],'as':'User'}];}return db[_0x9edd('0x28')][_0x9edd('0x44')](_0x28cfae);})['then'](function(_0x318757){_0x41af53['rows']=_0x318757;return _0x41af53;})['then'](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x45')](handleError(_0x238b22,null));};exports[_0x9edd('0x46')]=function(_0x1f276b,_0x3cf92c){var _0x25e6ec={'raw':!![],'where':{'id':_0x1f276b[_0x9edd('0x47')]['id']}},_0x4737ae={};_0x4737ae[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x4737ae[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x1f276b[_0x9edd('0x2f')]);_0x4737ae[_0x9edd('0x31')]=_['intersection'](_0x4737ae[_0x9edd('0x2d')],_0x4737ae[_0x9edd('0x2f')]);_0x25e6ec[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x4737ae[_0x9edd('0x2d')],qs[_0x9edd('0x34')](_0x1f276b[_0x9edd('0x2f')]['fields']));_0x25e6ec['attributes']=_0x25e6ec['attributes'][_0x9edd('0x35')]?_0x25e6ec['attributes']:_0x4737ae[_0x9edd('0x2d')];if(_0x1f276b[_0x9edd('0x2f')][_0x9edd('0x40')]){_0x25e6ec[_0x9edd('0x41')]=[{'all':!![]}];}_0x25e6ec=_[_0x9edd('0x3d')]({},_0x25e6ec,_0x1f276b['options']);return db[_0x9edd('0x28')][_0x9edd('0x48')](_0x25e6ec)[_0x9edd('0x21')](handleEntityNotFound(_0x3cf92c,null))['then'](respondWithResult(_0x3cf92c,null))[_0x9edd('0x45')](handleError(_0x3cf92c,null));};exports[_0x9edd('0x49')]=function(_0x2159aa,_0x293b03){return db[_0x9edd('0x28')][_0x9edd('0x49')](_0x2159aa['body'],{})[_0x9edd('0x21')](respondWithResult(_0x293b03,0xc9))[_0x9edd('0x45')](handleError(_0x293b03,null));};exports['destroy']=function(_0xb93816,_0x8d8701){return db['VoiceCallReport'][_0x9edd('0x48')]({'where':{'id':_0xb93816[_0x9edd('0x47')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x8d8701,null))['then'](removeEntity(_0x8d8701,null))[_0x9edd('0x45')](handleError(_0x8d8701,null));};exports[_0x9edd('0x4a')]=function(_0x317a60,_0x28c7bd){return db['VoiceCallReport'][_0x9edd('0x4a')]()[_0x9edd('0x21')](respondWithResult(_0x28c7bd,null))[_0x9edd('0x45')](handleError(_0x28c7bd,null));};exports['update']=function(_0x16951a,_0x21f6ce){if(_0x16951a['body'][_0x9edd('0x4b')]){delete _0x16951a['body'][_0x9edd('0x4b')];}return db[_0x9edd('0x28')][_0x9edd('0x48')]({'where':{'uniqueid':_0x16951a[_0x9edd('0x47')]['id'],'UserId':{'$or':[null,_0x16951a[_0x9edd('0x4c')]['id']]}}})[_0x9edd('0x21')](handleEntityNotFound(_0x21f6ce,null))[_0x9edd('0x21')](saveUpdates(_0x16951a[_0x9edd('0x4d')],null))[_0x9edd('0x21')](respondWithResult(_0x21f6ce,null))[_0x9edd('0x45')](handleError(_0x21f6ce,null));}; \ No newline at end of file +var _0x70e0=['rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','include','alias','User','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','destroy','describe','uniqueid','eml-format'];(function(_0x593cbd,_0x141c5b){var _0x1ea4aa=function(_0x5d42ba){while(--_0x5d42ba){_0x593cbd['push'](_0x593cbd['shift']());}};_0x1ea4aa(++_0x141c5b);}(_0x70e0,0x17b));var _0x070e=function(_0x31b2d8,_0x585992){_0x31b2d8=_0x31b2d8-0x0;var _0x4cea83=_0x70e0[_0x31b2d8];return _0x4cea83;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');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('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={},_0x26373b={},_0x5e8326={'count':0x0,'rows':[]};var _0x282344=_[_0x070e('0x29')](db[_0x070e('0x2a')]['rawAttributes'],function(_0x5c5f0d){return{'name':_0x5c5f0d[_0x070e('0x2b')],'type':_0x5c5f0d[_0x070e('0x2c')][_0x070e('0x2d')]};});_0x26373b['model']=_[_0x070e('0x29')](_0x282344,_0x070e('0x26'));_0x26373b[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x43dd96['query']);_0x26373b['filters']=_['intersection'](_0x26373b['model'],_0x26373b[_0x070e('0x2e')]);_0x1a1892['attributes']=_[_0x070e('0x30')](_0x26373b[_0x070e('0x31')],qs['fields'](_0x43dd96['query'][_0x070e('0x32')]));_0x1a1892[_0x070e('0x33')]=_0x1a1892['attributes']['length']?_0x1a1892[_0x070e('0x33')]:_0x26373b[_0x070e('0x31')];if(!_0x43dd96[_0x070e('0x2e')][_0x070e('0x34')](_0x070e('0x35'))){_0x1a1892['limit']=qs['limit'](_0x43dd96[_0x070e('0x2e')][_0x070e('0x1e')]);_0x1a1892[_0x070e('0x1b')]=qs[_0x070e('0x1b')](_0x43dd96[_0x070e('0x2e')]['offset']);}_0x1a1892[_0x070e('0x36')]=qs[_0x070e('0x37')](_0x43dd96['query'][_0x070e('0x37')]);_0x1a1892[_0x070e('0x38')]=qs['filters'](_['pick'](_0x43dd96['query'],_0x26373b[_0x070e('0x39')]),_0x282344);if(_0x43dd96[_0x070e('0x2e')][_0x070e('0x3a')]){_0x1a1892[_0x070e('0x38')]=_[_0x070e('0x3b')](_0x1a1892['where'],{'$or':_[_0x070e('0x29')](_0x282344,function(_0xa1bb20){if(_0xa1bb20[_0x070e('0x2c')]!=='VIRTUAL'){var _0x268c5d={};_0x268c5d[_0xa1bb20[_0x070e('0x26')]]={'$like':'%'+_0x43dd96[_0x070e('0x2e')]['filter']+'%'};return _0x268c5d;}})});}_0x1a1892=_[_0x070e('0x3b')]({},_0x1a1892,_0x43dd96[_0x070e('0x3c')]);var _0x4800a9={'where':_0x1a1892[_0x070e('0x38')]};return db['VoiceCallReport'][_0x070e('0x1d')](_0x4800a9)[_0x070e('0x23')](function(_0x3462d3){_0x5e8326[_0x070e('0x1d')]=_0x3462d3;if(_0x43dd96[_0x070e('0x2e')]['includeAll']){_0x1a1892[_0x070e('0x3d')]=[{'attributes':['id','name','fullname',_0x070e('0x3e')],'model':db[_0x070e('0x3f')],'as':_0x070e('0x3f')}];}return db['VoiceCallReport'][_0x070e('0x40')](_0x1a1892);})[_0x070e('0x23')](function(_0x556bf3){_0x5e8326[_0x070e('0x41')]=_0x556bf3;return _0x5e8326;})['then'](respondWithFilteredResult(_0x28d7f2,_0x1a1892))[_0x070e('0x42')](handleError(_0x28d7f2,null));};exports['show']=function(_0x544b53,_0x5d77d9){var _0x3feb83={'raw':!![],'where':{'id':_0x544b53[_0x070e('0x43')]['id']}},_0x926533={};_0x926533[_0x070e('0x31')]=_[_0x070e('0x2f')](db['VoiceCallReport'][_0x070e('0x44')]);_0x926533['query']=_[_0x070e('0x2f')](_0x544b53[_0x070e('0x2e')]);_0x926533[_0x070e('0x39')]=_['intersection'](_0x926533['model'],_0x926533[_0x070e('0x2e')]);_0x3feb83['attributes']=_[_0x070e('0x30')](_0x926533[_0x070e('0x31')],qs[_0x070e('0x32')](_0x544b53['query'][_0x070e('0x32')]));_0x3feb83[_0x070e('0x33')]=_0x3feb83['attributes']['length']?_0x3feb83[_0x070e('0x33')]:_0x926533[_0x070e('0x31')];if(_0x544b53[_0x070e('0x2e')][_0x070e('0x45')]){_0x3feb83[_0x070e('0x3d')]=[{'all':!![]}];}_0x3feb83=_['merge']({},_0x3feb83,_0x544b53[_0x070e('0x3c')]);return db[_0x070e('0x2a')][_0x070e('0x46')](_0x3feb83)[_0x070e('0x23')](handleEntityNotFound(_0x5d77d9,null))[_0x070e('0x23')](respondWithResult(_0x5d77d9,null))[_0x070e('0x42')](handleError(_0x5d77d9,null));};exports[_0x070e('0x47')]=function(_0x1b5374,_0xd67987){return db[_0x070e('0x2a')][_0x070e('0x47')](_0x1b5374[_0x070e('0x48')],{})[_0x070e('0x23')](respondWithResult(_0xd67987,0xc9))[_0x070e('0x42')](handleError(_0xd67987,null));};exports[_0x070e('0x49')]=function(_0x5e051a,_0x171621){return db[_0x070e('0x2a')][_0x070e('0x46')]({'where':{'id':_0x5e051a[_0x070e('0x43')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x171621,null))[_0x070e('0x23')](removeEntity(_0x171621,null))[_0x070e('0x42')](handleError(_0x171621,null));};exports[_0x070e('0x4a')]=function(_0x1c64d2,_0x5744c5){return db[_0x070e('0x2a')]['describe']()[_0x070e('0x23')](respondWithResult(_0x5744c5,null))[_0x070e('0x42')](handleError(_0x5744c5,null));};exports['update']=function(_0x991d23,_0x130a50){if(_0x991d23[_0x070e('0x48')][_0x070e('0x4b')]){delete _0x991d23[_0x070e('0x48')][_0x070e('0x4b')];}return db[_0x070e('0x2a')]['find']({'where':{'uniqueid':_0x991d23[_0x070e('0x43')]['id'],'UserId':{'$or':[null,_0x991d23['user']['id']]}}})['then'](handleEntityNotFound(_0x130a50,null))[_0x070e('0x23')](saveUpdates(_0x991d23[_0x070e('0x48')],null))[_0x070e('0x23')](respondWithResult(_0x130a50,null))[_0x070e('0x42')](handleError(_0x130a50,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 69d10d6..3643071 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 _0xc542=['exports','define','report_call','uniqueid','lodash','util','../../config/logger','api','request-promise','path','./voiceCallReport.attributes'];(function(_0x2fabb5,_0x1cfb9a){var _0x2a8c2a=function(_0x4756cd){while(--_0x4756cd){_0x2fabb5['push'](_0x2fabb5['shift']());}};_0x2a8c2a(++_0x1cfb9a);}(_0xc542,0x9e));var _0x2c54=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc542[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x2c54('0x0'));var util=require(_0x2c54('0x1'));var logger=require(_0x2c54('0x2'))(_0x2c54('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2c54('0x4'));var fs=require('fs');var path=require(_0x2c54('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2c54('0x6'));module[_0x2c54('0x7')]=function(_0x59fc14,_0xceca3b){return _0x59fc14[_0x2c54('0x8')]('VoiceCallReport',attributes,{'tableName':_0x2c54('0x9'),'paranoid':![],'indexes':[{'fields':[_0x2c54('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcaa6=['define','VoiceCallReport','report_call','uniqueid','util','../../config/logger','api','moment','rimraf','../../config/environment','./voiceCallReport.attributes','exports'];(function(_0x5ae8f7,_0x330d91){var _0x54c636=function(_0x173188){while(--_0x173188){_0x5ae8f7['push'](_0x5ae8f7['shift']());}};_0x54c636(++_0x330d91);}(_0xcaa6,0x10c));var _0x6caa=function(_0x47506e,_0x4bc003){_0x47506e=_0x47506e-0x0;var _0x29061c=_0xcaa6[_0x47506e];return _0x29061c;};'use strict';var _=require('lodash');var util=require(_0x6caa('0x0'));var logger=require(_0x6caa('0x1'))(_0x6caa('0x2'));var moment=require(_0x6caa('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6caa('0x4'));var config=require(_0x6caa('0x5'));var attributes=require(_0x6caa('0x6'));module[_0x6caa('0x7')]=function(_0x2da03a,_0x3d25f3){return _0x2da03a[_0x6caa('0x8')](_0x6caa('0x9'),attributes,{'tableName':_0x6caa('0xa'),'paranoid':![],'indexes':[{'fields':[_0x6caa('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 0fc5774..944ff1b 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 _0x31a5=['info','VoiceCallReport,\x20%s,\x20%s','result','GetVoiceCallReport','VoiceCallReport','options','raw','limit','map','include','attributes','model','CreateVoiceCallReport','create','body','catch','update','UpdateVoiceCallReport','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x1eeb7b,_0x1aa65f){var _0x39d505=function(_0x3a2369){while(--_0x3a2369){_0x1eeb7b['push'](_0x1eeb7b['shift']());}};_0x39d505(++_0x1aa65f);}(_0x31a5,0xb7));var _0x531a=function(_0x1b3f68,_0x87b81d){_0x1b3f68=_0x1b3f68-0x0;var _0x4341e9=_0x31a5[_0x1b3f68];return _0x4341e9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x531a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x531a('0x1'));var db=require(_0x531a('0x2'))['db'];var utils=require(_0x531a('0x3'));var logger=require(_0x531a('0x4'))('rpc');var config=require(_0x531a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x531a('0x6')][_0x531a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x425ffd,_0x4b561f,_0x1e6c5e){return new BPromise(function(_0x546f6e,_0x10ef8e){return client['request'](_0x425ffd,_0x1e6c5e)[_0x531a('0x8')](function(_0x5a7fde){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x4b561f,_0x531a('0x9'));logger[_0x531a('0xa')](_0x531a('0xb'),_0x4b561f,_0x531a('0x9'),JSON[_0x531a('0xc')](_0x5a7fde));if(_0x5a7fde[_0x531a('0xd')]){if(_0x5a7fde[_0x531a('0xd')]['code']===0x1f4){logger[_0x531a('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x4b561f,_0x5a7fde[_0x531a('0xd')][_0x531a('0xe')]);return _0x10ef8e(_0x5a7fde[_0x531a('0xd')][_0x531a('0xe')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x4b561f,_0x5a7fde[_0x531a('0xd')][_0x531a('0xe')]);return _0x546f6e(_0x5a7fde[_0x531a('0xd')][_0x531a('0xe')]);}else{logger[_0x531a('0xf')](_0x531a('0x10'),_0x4b561f,_0x531a('0x9'));_0x546f6e(_0x5a7fde[_0x531a('0x11')]['message']);}})['catch'](function(_0xb538b5){logger[_0x531a('0xd')](_0x531a('0x10'),_0x4b561f,_0xb538b5);_0x10ef8e(_0xb538b5);});});}exports[_0x531a('0x12')]=function(_0x32d13d){var _0x15aa10=this;return new Promise(function(_0x14ac20,_0x1fdb99){return db[_0x531a('0x13')]['findAll']({'raw':_0x32d13d[_0x531a('0x14')]?_0x32d13d[_0x531a('0x14')][_0x531a('0x15')]===undefined?!![]:![]:!![],'where':_0x32d13d[_0x531a('0x14')]?_0x32d13d['options']['where']||null:null,'attributes':_0x32d13d[_0x531a('0x14')]?_0x32d13d[_0x531a('0x14')]['attributes']||null:null,'limit':_0x32d13d[_0x531a('0x14')]?_0x32d13d[_0x531a('0x14')][_0x531a('0x16')]||null:null,'include':_0x32d13d[_0x531a('0x14')]?_0x32d13d[_0x531a('0x14')]['include']?_[_0x531a('0x17')](_0x32d13d[_0x531a('0x14')][_0x531a('0x18')],function(_0x28b96b){return{'model':db[_0x28b96b['model']],'as':_0x28b96b['as'],'attributes':_0x28b96b[_0x531a('0x19')],'include':_0x28b96b[_0x531a('0x18')]?_[_0x531a('0x17')](_0x28b96b['include'],function(_0x1c72d8){return{'model':db[_0x1c72d8[_0x531a('0x1a')]],'as':_0x1c72d8['as'],'attributes':_0x1c72d8['attributes'],'include':_0x1c72d8[_0x531a('0x18')]?_[_0x531a('0x17')](_0x1c72d8[_0x531a('0x18')],function(_0x19209e){return{'model':db[_0x19209e[_0x531a('0x1a')]],'as':_0x19209e['as'],'attributes':_0x19209e[_0x531a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x531a('0x8')](function(_0x226bda){logger['info']('GetVoiceCallReport',_0x32d13d);logger[_0x531a('0xa')](_0x531a('0x12'),_0x32d13d,JSON['stringify'](_0x226bda));_0x14ac20(_0x226bda);})['catch'](function(_0x397751){logger['error'](_0x531a('0x12'),_0x397751[_0x531a('0xe')],_0x32d13d);_0x1fdb99(_0x15aa10[_0x531a('0xd')](0x1f4,_0x397751[_0x531a('0xe')]));});});};exports[_0x531a('0x1b')]=function(_0x340930){var _0x593b62=this;return new Promise(function(_0x3533ee,_0x247123){return db['VoiceCallReport'][_0x531a('0x1c')](_0x340930[_0x531a('0x1d')],{'raw':_0x340930[_0x531a('0x14')]?_0x340930[_0x531a('0x14')][_0x531a('0x15')]===undefined?!![]:![]:!![]})[_0x531a('0x8')](function(_0x5d6f61){logger[_0x531a('0xf')](_0x531a('0x1b'),_0x340930);logger['debug'](_0x531a('0x1b'),_0x340930,JSON[_0x531a('0xc')](_0x5d6f61));_0x3533ee(_0x5d6f61);})[_0x531a('0x1e')](function(_0x1011cc){logger[_0x531a('0xd')](_0x531a('0x1b'),_0x1011cc[_0x531a('0xe')],_0x340930);_0x247123(_0x593b62[_0x531a('0xd')](0x1f4,_0x1011cc[_0x531a('0xe')]));});});};exports['UpdateVoiceCallReport']=function(_0x1c2523){var _0x2b8b6d=this;return new Promise(function(_0x2d36b5,_0x93b81d){return db[_0x531a('0x13')][_0x531a('0x1f')](_0x1c2523['body'],{'raw':_0x1c2523[_0x531a('0x14')]?_0x1c2523[_0x531a('0x14')][_0x531a('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c2523[_0x531a('0x14')]?_0x1c2523[_0x531a('0x14')]['where']||null:null,'attributes':_0x1c2523['options']?_0x1c2523[_0x531a('0x14')]['attributes']||null:null,'limit':_0x1c2523[_0x531a('0x14')]?_0x1c2523[_0x531a('0x14')][_0x531a('0x16')]||null:null})[_0x531a('0x8')](function(_0x28ce66){logger['info'](_0x531a('0x20'),_0x1c2523);logger[_0x531a('0xa')]('UpdateVoiceCallReport',_0x1c2523,JSON[_0x531a('0xc')](_0x28ce66));_0x2d36b5(_0x28ce66);})['catch'](function(_0x1d185a){logger['error'](_0x531a('0x20'),_0x1d185a['message'],_0x1c2523);_0x93b81d(_0x2b8b6d[_0x531a('0xd')](0x1f4,_0x1d185a[_0x531a('0xe')]));});});}; \ No newline at end of file +var _0xc305=['debug','GetVoiceCallReport','CreateVoiceCallReport','create','UpdateVoiceCallReport','body','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','VoiceCallReport','findAll','options','where','attributes','limit','include','model','map'];(function(_0x5e8559,_0x38eea9){var _0x42506f=function(_0x2d3bcc){while(--_0x2d3bcc){_0x5e8559['push'](_0x5e8559['shift']());}};_0x42506f(++_0x38eea9);}(_0xc305,0x7c));var _0x5c30=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0xc305[_0x5e8eae];return _0xdd09cd;};'use strict';var _=require(_0x5c30('0x0'));var util=require(_0x5c30('0x1'));var moment=require(_0x5c30('0x2'));var BPromise=require(_0x5c30('0x3'));var rs=require(_0x5c30('0x4'));var fs=require('fs');var Redis=require(_0x5c30('0x5'));var db=require(_0x5c30('0x6'))['db'];var utils=require(_0x5c30('0x7'));var logger=require(_0x5c30('0x8'))(_0x5c30('0x9'));var config=require(_0x5c30('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5c30('0xb')][_0x5c30('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x193d18,_0x431490,_0x54f159){return new BPromise(function(_0x1d99a3,_0x19062a){return client['request'](_0x193d18,_0x54f159)[_0x5c30('0xd')](function(_0x2d48b3){logger[_0x5c30('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x431490,_0x5c30('0xf'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x431490,_0x5c30('0xf'),JSON[_0x5c30('0x10')](_0x2d48b3));if(_0x2d48b3['error']){if(_0x2d48b3[_0x5c30('0x11')][_0x5c30('0x12')]===0x1f4){logger[_0x5c30('0x11')](_0x5c30('0x13'),_0x431490,_0x2d48b3[_0x5c30('0x11')][_0x5c30('0x14')]);return _0x19062a(_0x2d48b3['error']['message']);}logger['error'](_0x5c30('0x13'),_0x431490,_0x2d48b3['error']['message']);return _0x1d99a3(_0x2d48b3['error'][_0x5c30('0x14')]);}else{logger[_0x5c30('0xe')](_0x5c30('0x13'),_0x431490,_0x5c30('0xf'));_0x1d99a3(_0x2d48b3[_0x5c30('0x15')][_0x5c30('0x14')]);}})[_0x5c30('0x16')](function(_0x4fdc11){logger[_0x5c30('0x11')](_0x5c30('0x13'),_0x431490,_0x4fdc11);_0x19062a(_0x4fdc11);});});}exports['GetVoiceCallReport']=function(_0x35beb3){var _0x351380=this;return new Promise(function(_0x2f61a1,_0x2b3430){return db[_0x5c30('0x17')][_0x5c30('0x18')]({'raw':_0x35beb3[_0x5c30('0x19')]?_0x35beb3[_0x5c30('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x35beb3['options']?_0x35beb3[_0x5c30('0x19')][_0x5c30('0x1a')]||null:null,'attributes':_0x35beb3[_0x5c30('0x19')]?_0x35beb3[_0x5c30('0x19')][_0x5c30('0x1b')]||null:null,'limit':_0x35beb3[_0x5c30('0x19')]?_0x35beb3[_0x5c30('0x19')][_0x5c30('0x1c')]||null:null,'include':_0x35beb3[_0x5c30('0x19')]?_0x35beb3[_0x5c30('0x19')][_0x5c30('0x1d')]?_['map'](_0x35beb3['options'][_0x5c30('0x1d')],function(_0x2de776){return{'model':db[_0x2de776[_0x5c30('0x1e')]],'as':_0x2de776['as'],'attributes':_0x2de776[_0x5c30('0x1b')],'include':_0x2de776['include']?_[_0x5c30('0x1f')](_0x2de776[_0x5c30('0x1d')],function(_0x2cf3b5){return{'model':db[_0x2cf3b5[_0x5c30('0x1e')]],'as':_0x2cf3b5['as'],'attributes':_0x2cf3b5[_0x5c30('0x1b')],'include':_0x2cf3b5['include']?_[_0x5c30('0x1f')](_0x2cf3b5[_0x5c30('0x1d')],function(_0x257475){return{'model':db[_0x257475['model']],'as':_0x257475['as'],'attributes':_0x257475[_0x5c30('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16d00a){logger[_0x5c30('0xe')]('GetVoiceCallReport',_0x35beb3);logger[_0x5c30('0x20')](_0x5c30('0x21'),_0x35beb3,JSON[_0x5c30('0x10')](_0x16d00a));_0x2f61a1(_0x16d00a);})[_0x5c30('0x16')](function(_0x2865ab){logger[_0x5c30('0x11')](_0x5c30('0x21'),_0x2865ab[_0x5c30('0x14')],_0x35beb3);_0x2b3430(_0x351380[_0x5c30('0x11')](0x1f4,_0x2865ab[_0x5c30('0x14')]));});});};exports[_0x5c30('0x22')]=function(_0x2da1f9){var _0x2c0c51=this;return new Promise(function(_0x145275,_0x4e26f8){return db['VoiceCallReport'][_0x5c30('0x23')](_0x2da1f9['body'],{'raw':_0x2da1f9[_0x5c30('0x19')]?_0x2da1f9[_0x5c30('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x5c30('0xd')](function(_0x347412){logger[_0x5c30('0xe')](_0x5c30('0x22'),_0x2da1f9);logger[_0x5c30('0x20')](_0x5c30('0x22'),_0x2da1f9,JSON[_0x5c30('0x10')](_0x347412));_0x145275(_0x347412);})[_0x5c30('0x16')](function(_0x1885b3){logger[_0x5c30('0x11')](_0x5c30('0x22'),_0x1885b3[_0x5c30('0x14')],_0x2da1f9);_0x4e26f8(_0x2c0c51[_0x5c30('0x11')](0x1f4,_0x1885b3[_0x5c30('0x14')]));});});};exports[_0x5c30('0x24')]=function(_0x41f268){var _0x12a780=this;return new Promise(function(_0x2a7d5f,_0x35f498){return db['VoiceCallReport']['update'](_0x41f268[_0x5c30('0x25')],{'raw':_0x41f268[_0x5c30('0x19')]?_0x41f268[_0x5c30('0x19')][_0x5c30('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41f268[_0x5c30('0x19')]?_0x41f268[_0x5c30('0x19')][_0x5c30('0x1a')]||null:null,'attributes':_0x41f268[_0x5c30('0x19')]?_0x41f268[_0x5c30('0x19')]['attributes']||null:null,'limit':_0x41f268['options']?_0x41f268[_0x5c30('0x19')][_0x5c30('0x1c')]||null:null})[_0x5c30('0xd')](function(_0x175117){logger[_0x5c30('0xe')]('UpdateVoiceCallReport',_0x41f268);logger[_0x5c30('0x20')](_0x5c30('0x24'),_0x41f268,JSON[_0x5c30('0x10')](_0x175117));_0x2a7d5f(_0x175117);})[_0x5c30('0x16')](function(_0x2638f6){logger[_0x5c30('0x11')](_0x5c30('0x24'),_0x2638f6['message'],_0x41f268);_0x35f498(_0x12a780[_0x5c30('0x11')](0x1f4,_0x2638f6[_0x5c30('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index d2b332c..560aa15 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 _0x2e23=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','show','create','put','/:id','update','destroy'];(function(_0x6b2ed7,_0xbe1ba0){var _0x116c76=function(_0x4f376e){while(--_0x4f376e){_0x6b2ed7['push'](_0x6b2ed7['shift']());}};_0x116c76(++_0xbe1ba0);}(_0x2e23,0xb5));var _0x32e2=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2e23[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x32e2('0x0'));var util=require(_0x32e2('0x1'));var path=require(_0x32e2('0x2'));var timeout=require(_0x32e2('0x3'));var express=require(_0x32e2('0x4'));var router=express[_0x32e2('0x5')]();var fs_extra=require(_0x32e2('0x6'));var auth=require(_0x32e2('0x7'));var interaction=require(_0x32e2('0x8'));var config=require(_0x32e2('0x9'));var controller=require(_0x32e2('0xa'));router[_0x32e2('0xb')]('/',auth[_0x32e2('0xc')](),controller['index']);router['get']('/:id',auth[_0x32e2('0xc')](),controller[_0x32e2('0xd')]);router['post']('/',auth[_0x32e2('0xc')](),controller[_0x32e2('0xe')]);router[_0x32e2('0xf')](_0x32e2('0x10'),auth[_0x32e2('0xc')](),controller[_0x32e2('0x11')]);router['delete'](_0x32e2('0x10'),auth[_0x32e2('0xc')](),controller[_0x32e2('0x12')]);module[_0x32e2('0x13')]=router; \ No newline at end of file +var _0x4843=['isAuthenticated','create','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','index','/:id','show','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4843,0x138));var _0x3484=function(_0x29f641,_0x1fa806){_0x29f641=_0x29f641-0x0;var _0x7130a1=_0x4843[_0x29f641];return _0x7130a1;};'use strict';var multer=require(_0x3484('0x0'));var util=require('util');var path=require(_0x3484('0x1'));var timeout=require(_0x3484('0x2'));var express=require(_0x3484('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3484('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3484('0x5'));var controller=require(_0x3484('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x3484('0x7')]);router['get'](_0x3484('0x8'),auth['isAuthenticated'](),controller[_0x3484('0x9')]);router[_0x3484('0xa')]('/',auth[_0x3484('0xb')](),controller[_0x3484('0xc')]);router[_0x3484('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x3484('0xe')]);router['delete'](_0x3484('0x8'),auth[_0x3484('0xb')](),controller[_0x3484('0xf')]);module[_0x3484('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index fe8b1ca..3bbe6d4 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 _0x20f7=['options','join','getDataValue','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x9afcac,_0x1e3493){var _0xe73216=function(_0x16410c){while(--_0x16410c){_0x9afcac['push'](_0x9afcac['shift']());}};_0xe73216(++_0x1e3493);}(_0x20f7,0x19c));var _0x720f=function(_0x8c318b,_0x309481){_0x8c318b=_0x8c318b-0x0;var _0x3c000a=_0x20f7[_0x8c318b];return _0x3c000a;};'use strict';var Sequelize=require(_0x720f('0x0'));module[_0x720f('0x1')]={'name':{'type':Sequelize[_0x720f('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x720f('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x720f('0x2')],'set':function(_0x1aac5b){this['setDataValue'](_0x720f('0x4'),_0x1aac5b?_0x1aac5b[_0x720f('0x5')](''):[]);},'get':function(){return this[_0x720f('0x6')](_0x720f('0x4'))?this[_0x720f('0x6')](_0x720f('0x4'))['split'](''):[];}},'auth':{'type':Sequelize[_0x720f('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x720f('0x2')]},'record':{'type':Sequelize[_0x720f('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x720f('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd417=['BOOLEAN','exports','STRING','setDataValue','options','join','getDataValue','split'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd417,0x91));var _0x7d41=function(_0x1d5c7f,_0x103ea4){_0x1d5c7f=_0x1d5c7f-0x0;var _0x446be7=_0xd417[_0x1d5c7f];return _0x446be7;};'use strict';var Sequelize=require('sequelize');module[_0x7d41('0x0')]={'name':{'type':Sequelize[_0x7d41('0x1')]},'prefix':{'type':Sequelize[_0x7d41('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x7d41('0x1')],'set':function(_0xe204f6){this[_0x7d41('0x2')](_0x7d41('0x3'),_0xe204f6?_0xe204f6[_0x7d41('0x4')](''):[]);},'get':function(){return this[_0x7d41('0x5')]('options')?this[_0x7d41('0x5')](_0x7d41('0x3'))[_0x7d41('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x7d41('0x1')]},'record':{'type':Sequelize[_0x7d41('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x7d41('0x1')]},'description':{'type':Sequelize[_0x7d41('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 1955447..3ae99d8 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 _0x74a2=['offset','set','Content-Range','apply','reject','save','update','then','get','destroy','error','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count'];(function(_0x1f41bc,_0x1e5d00){var _0x492c61=function(_0x5e506e){while(--_0x5e506e){_0x1f41bc['push'](_0x1f41bc['shift']());}};_0x492c61(++_0x1e5d00);}(_0x74a2,0x1d8));var _0x274a=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x74a2[_0xdd2bfa];return _0x55397e;};'use strict';var emlformat=require(_0x274a('0x0'));var rimraf=require(_0x274a('0x1'));var zipdir=require(_0x274a('0x2'));var jsonpatch=require(_0x274a('0x3'));var rp=require('request-promise');var moment=require(_0x274a('0x4'));var BPromise=require(_0x274a('0x5'));var Mustache=require(_0x274a('0x6'));var util=require(_0x274a('0x7'));var path=require(_0x274a('0x8'));var sox=require(_0x274a('0x9'));var csv=require(_0x274a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x274a('0xb'));var _=require('lodash');var squel=require(_0x274a('0xc'));var crypto=require(_0x274a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x274a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x274a('0xf'));var Papa=require('papaparse');var Redis=require(_0x274a('0x10'));var authService=require(_0x274a('0x11'));var qs=require(_0x274a('0x12'));var as=require(_0x274a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x274a('0x14'));var utils=require(_0x274a('0x15'));var config=require(_0x274a('0x16'));var licenseUtil=require(_0x274a('0x17'));var db=require(_0x274a('0x18'))['db'];function respondWithStatusCode(_0x287bee,_0x3b0eda){_0x3b0eda=_0x3b0eda||0xcc;return function(_0x1f1a5a){if(_0x1f1a5a){return _0x287bee[_0x274a('0x19')](_0x3b0eda);}return _0x287bee['status'](_0x3b0eda)[_0x274a('0x1a')]();};}function respondWithResult(_0x10e2aa,_0x426267){_0x426267=_0x426267||0xc8;return function(_0x545789){if(_0x545789){return _0x10e2aa[_0x274a('0x1b')](_0x426267)[_0x274a('0x1c')](_0x545789);}};}function respondWithFilteredResult(_0x5544fc,_0x2bee2d){return function(_0x44eea5){if(_0x44eea5){var _0x5e5630=typeof _0x2bee2d['offset']===_0x274a('0x1d')&&typeof _0x2bee2d[_0x274a('0x1e')]===_0x274a('0x1d');var _0x5519bf=_0x44eea5[_0x274a('0x1f')];var _0x4cf3fc=_0x5e5630?0x0:_0x2bee2d[_0x274a('0x20')];var _0x10201a=_0x5e5630?_0x44eea5['count']:_0x2bee2d[_0x274a('0x20')]+_0x2bee2d[_0x274a('0x1e')];var _0x2c9589;if(_0x10201a>=_0x5519bf){_0x10201a=_0x5519bf;_0x2c9589=0xc8;}else{_0x2c9589=0xce;}_0x5544fc['status'](_0x2c9589);return _0x5544fc[_0x274a('0x21')](_0x274a('0x22'),_0x4cf3fc+'-'+_0x10201a+'/'+_0x5519bf)[_0x274a('0x1c')](_0x44eea5);}return null;};}function patchUpdates(_0x4ca7bb){return function(_0x5e7d4b){try{jsonpatch[_0x274a('0x23')](_0x5e7d4b,_0x4ca7bb,!![]);}catch(_0x2e8b48){return BPromise[_0x274a('0x24')](_0x2e8b48);}return _0x5e7d4b[_0x274a('0x25')]();};}function saveUpdates(_0x3e97c8,_0xf982bc){return function(_0x5efa66){if(_0x5efa66){return _0x5efa66[_0x274a('0x26')](_0x3e97c8)[_0x274a('0x27')](function(_0xbe6c30){return _0xbe6c30;});}return null;};}function removeEntity(_0x3250ba,_0x152491){return function(_0x11f822){if(_0x11f822){return _0x11f822['destroy']()[_0x274a('0x27')](function(){var _0x417dba=_0x11f822[_0x274a('0x28')]({'plain':!![]});var _0x23f40f='ChanSpies';return db['UserProfileResource'][_0x274a('0x29')]({'where':{'type':_0x23f40f,'resourceId':_0x417dba['id']}})['then'](function(){return _0x11f822;});})[_0x274a('0x27')](function(){_0x3250ba[_0x274a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28c3d1,_0x2e0597){return function(_0x4aca98){if(!_0x4aca98){_0x28c3d1[_0x274a('0x19')](0x194);}return _0x4aca98;};}function handleError(_0x70bfb,_0x50ae42){_0x50ae42=_0x50ae42||0x1f4;return function(_0x575abe){logger[_0x274a('0x2a')](_0x575abe['stack']);if(_0x575abe[_0x274a('0x2b')]){delete _0x575abe[_0x274a('0x2b')];}_0x70bfb[_0x274a('0x1b')](_0x50ae42)[_0x274a('0x2c')](_0x575abe);};}exports['index']=function(_0x4b6adf,_0x404165){var _0x5673cf={},_0x369a0d={},_0x34b165={'count':0x0,'rows':[]};var _0x370b3e=_[_0x274a('0x2d')](db[_0x274a('0x2e')][_0x274a('0x2f')],function(_0x193aec){return{'name':_0x193aec[_0x274a('0x30')],'type':_0x193aec[_0x274a('0x31')]['key']};});_0x369a0d[_0x274a('0x32')]=_[_0x274a('0x2d')](_0x370b3e,'name');_0x369a0d['query']=_[_0x274a('0x33')](_0x4b6adf[_0x274a('0x34')]);_0x369a0d[_0x274a('0x35')]=_['intersection'](_0x369a0d[_0x274a('0x32')],_0x369a0d[_0x274a('0x34')]);_0x5673cf['attributes']=_['intersection'](_0x369a0d[_0x274a('0x32')],qs[_0x274a('0x36')](_0x4b6adf[_0x274a('0x34')]['fields']));_0x5673cf[_0x274a('0x37')]=_0x5673cf[_0x274a('0x37')][_0x274a('0x38')]?_0x5673cf[_0x274a('0x37')]:_0x369a0d[_0x274a('0x32')];if(!_0x4b6adf[_0x274a('0x34')][_0x274a('0x39')](_0x274a('0x3a'))){_0x5673cf['limit']=qs[_0x274a('0x1e')](_0x4b6adf[_0x274a('0x34')]['limit']);_0x5673cf[_0x274a('0x20')]=qs[_0x274a('0x20')](_0x4b6adf[_0x274a('0x34')]['offset']);}_0x5673cf[_0x274a('0x3b')]=qs[_0x274a('0x3c')](_0x4b6adf[_0x274a('0x34')][_0x274a('0x3c')]);_0x5673cf[_0x274a('0x3d')]=qs['filters'](_['pick'](_0x4b6adf[_0x274a('0x34')],_0x369a0d[_0x274a('0x35')]),_0x370b3e);if(_0x4b6adf[_0x274a('0x34')][_0x274a('0x3e')]){_0x5673cf[_0x274a('0x3d')]=_[_0x274a('0x3f')](_0x5673cf[_0x274a('0x3d')],{'$or':_[_0x274a('0x2d')](_0x370b3e,function(_0x265396){if(_0x265396['type']!=='VIRTUAL'){var _0xff1679={};_0xff1679[_0x265396[_0x274a('0x2b')]]={'$like':'%'+_0x4b6adf[_0x274a('0x34')][_0x274a('0x3e')]+'%'};return _0xff1679;}})});}_0x5673cf=_[_0x274a('0x3f')]({},_0x5673cf,_0x4b6adf[_0x274a('0x40')]);var _0xff92d2={'where':_0x5673cf[_0x274a('0x3d')]};return db[_0x274a('0x2e')][_0x274a('0x1f')](_0xff92d2)[_0x274a('0x27')](function(_0x8e88d5){_0x34b165[_0x274a('0x1f')]=_0x8e88d5;if(_0x4b6adf['query'][_0x274a('0x41')]){_0x5673cf['include']=[{'all':!![]}];}return db[_0x274a('0x2e')][_0x274a('0x42')](_0x5673cf);})[_0x274a('0x27')](function(_0x1846f0){_0x34b165[_0x274a('0x43')]=_0x1846f0;return _0x34b165;})[_0x274a('0x27')](respondWithFilteredResult(_0x404165,_0x5673cf))[_0x274a('0x44')](handleError(_0x404165,null));};exports[_0x274a('0x45')]=function(_0x39156d,_0x52b0f5){var _0x55a32f={'raw':![],'where':{'id':_0x39156d[_0x274a('0x46')]['id']}},_0x4c05f2={};_0x4c05f2['model']=_[_0x274a('0x33')](db[_0x274a('0x2e')][_0x274a('0x2f')]);_0x4c05f2[_0x274a('0x34')]=_[_0x274a('0x33')](_0x39156d[_0x274a('0x34')]);_0x4c05f2[_0x274a('0x35')]=_['intersection'](_0x4c05f2['model'],_0x4c05f2['query']);_0x55a32f[_0x274a('0x37')]=_[_0x274a('0x47')](_0x4c05f2[_0x274a('0x32')],qs[_0x274a('0x36')](_0x39156d[_0x274a('0x34')]['fields']));_0x55a32f[_0x274a('0x37')]=_0x55a32f[_0x274a('0x37')][_0x274a('0x38')]?_0x55a32f[_0x274a('0x37')]:_0x4c05f2[_0x274a('0x32')];if(_0x39156d[_0x274a('0x34')]['includeAll']){_0x55a32f[_0x274a('0x48')]=[{'all':!![]}];}_0x55a32f=_[_0x274a('0x3f')]({},_0x55a32f,_0x39156d[_0x274a('0x40')]);return db[_0x274a('0x2e')][_0x274a('0x49')](_0x55a32f)['then'](handleEntityNotFound(_0x52b0f5,null))[_0x274a('0x27')](respondWithResult(_0x52b0f5,null))['catch'](handleError(_0x52b0f5,null));};exports[_0x274a('0x4a')]=function(_0x11f6ae,_0x163489){return db[_0x274a('0x2e')][_0x274a('0x4a')](_0x11f6ae[_0x274a('0x4b')],{})[_0x274a('0x27')](function(_0x494049){var _0x4e846e=_0x11f6ae[_0x274a('0x4c')]['get']({'plain':!![]});if(!_0x4e846e)throw new Error(_0x274a('0x4d'));if(_0x4e846e['role']==='user'){var _0x455d7b=_0x494049['get']({'plain':!![]});var _0x10a1c9=_0x274a('0x4e');return db[_0x274a('0x4f')][_0x274a('0x49')]({'where':{'name':_0x10a1c9,'userProfileId':_0x4e846e[_0x274a('0x50')]},'raw':!![]})[_0x274a('0x27')](function(_0x218f1d){if(_0x218f1d&&_0x218f1d[_0x274a('0x51')]===0x0){return db[_0x274a('0x52')][_0x274a('0x4a')]({'name':_0x455d7b[_0x274a('0x2b')],'resourceId':_0x455d7b['id'],'type':_0x218f1d[_0x274a('0x2b')],'sectionId':_0x218f1d['id']},{})[_0x274a('0x27')](function(){return _0x494049;});}else{return _0x494049;}})['catch'](function(_0x106fb4){logger[_0x274a('0x2a')](_0x274a('0x53'),_0x106fb4);throw _0x106fb4;});}return _0x494049;})[_0x274a('0x27')](respondWithResult(_0x163489,0xc9))[_0x274a('0x44')](handleError(_0x163489,null));};exports[_0x274a('0x26')]=function(_0x1f9baf,_0x5062aa){if(_0x1f9baf[_0x274a('0x4b')]['id']){delete _0x1f9baf[_0x274a('0x4b')]['id'];}return db['VoiceChanSpy'][_0x274a('0x49')]({'where':{'id':_0x1f9baf[_0x274a('0x46')]['id']}})[_0x274a('0x27')](handleEntityNotFound(_0x5062aa,null))[_0x274a('0x27')](saveUpdates(_0x1f9baf[_0x274a('0x4b')],null))['then'](respondWithResult(_0x5062aa,null))[_0x274a('0x44')](handleError(_0x5062aa,null));};exports[_0x274a('0x29')]=function(_0x5e9ff7,_0x273afd){return db[_0x274a('0x2e')][_0x274a('0x49')]({'where':{'id':_0x5e9ff7[_0x274a('0x46')]['id']}})[_0x274a('0x27')](handleEntityNotFound(_0x273afd,null))[_0x274a('0x27')](removeEntity(_0x273afd,null))[_0x274a('0x44')](handleError(_0x273afd,null));}; \ No newline at end of file +var _0xa92a=['apply','reject','save','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','params','fields','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit'];(function(_0x13e79a,_0x305aaa){var _0x24f0ec=function(_0x2bd331){while(--_0x2bd331){_0x13e79a['push'](_0x13e79a['shift']());}};_0x24f0ec(++_0x305aaa);}(_0xa92a,0x1da));var _0xaa92=function(_0x36909d,_0x2795f1){_0x36909d=_0x36909d-0x0;var _0x1fd29d=_0xa92a[_0x36909d];return _0x1fd29d;};'use strict';var emlformat=require(_0xaa92('0x0'));var rimraf=require(_0xaa92('0x1'));var zipdir=require(_0xaa92('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa92('0x3'));var moment=require(_0xaa92('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaa92('0x5'));var util=require(_0xaa92('0x6'));var path=require(_0xaa92('0x7'));var sox=require(_0xaa92('0x8'));var csv=require('to-csv');var ejs=require(_0xaa92('0x9'));var fs=require('fs');var fs_extra=require(_0xaa92('0xa'));var _=require('lodash');var squel=require(_0xaa92('0xb'));var crypto=require(_0xaa92('0xc'));var jsforce=require(_0xaa92('0xd'));var deskjs=require(_0xaa92('0xe'));var toCsv=require(_0xaa92('0xf'));var querystring=require(_0xaa92('0x10'));var Papa=require(_0xaa92('0x11'));var Redis=require(_0xaa92('0x12'));var authService=require(_0xaa92('0x13'));var qs=require(_0xaa92('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa92('0x15'));var logger=require(_0xaa92('0x16'))(_0xaa92('0x17'));var utils=require(_0xaa92('0x18'));var config=require(_0xaa92('0x19'));var licenseUtil=require(_0xaa92('0x1a'));var db=require(_0xaa92('0x1b'))['db'];function respondWithStatusCode(_0x575064,_0x553045){_0x553045=_0x553045||0xcc;return function(_0x11c200){if(_0x11c200){return _0x575064[_0xaa92('0x1c')](_0x553045);}return _0x575064['status'](_0x553045)[_0xaa92('0x1d')]();};}function respondWithResult(_0x2bbee5,_0x5d0046){_0x5d0046=_0x5d0046||0xc8;return function(_0x41df73){if(_0x41df73){return _0x2bbee5[_0xaa92('0x1e')](_0x5d0046)[_0xaa92('0x1f')](_0x41df73);}};}function respondWithFilteredResult(_0x50ba24,_0x2b487e){return function(_0xf61e5a){if(_0xf61e5a){var _0x5bd459=typeof _0x2b487e[_0xaa92('0x20')]==='undefined'&&typeof _0x2b487e['limit']===_0xaa92('0x21');var _0xc00c81=_0xf61e5a[_0xaa92('0x22')];var _0x433887=_0x5bd459?0x0:_0x2b487e[_0xaa92('0x20')];var _0x37c663=_0x5bd459?_0xf61e5a[_0xaa92('0x22')]:_0x2b487e[_0xaa92('0x20')]+_0x2b487e[_0xaa92('0x23')];var _0x26075b;if(_0x37c663>=_0xc00c81){_0x37c663=_0xc00c81;_0x26075b=0xc8;}else{_0x26075b=0xce;}_0x50ba24[_0xaa92('0x1e')](_0x26075b);return _0x50ba24['set']('Content-Range',_0x433887+'-'+_0x37c663+'/'+_0xc00c81)[_0xaa92('0x1f')](_0xf61e5a);}return null;};}function patchUpdates(_0x204229){return function(_0x36994a){try{jsonpatch[_0xaa92('0x24')](_0x36994a,_0x204229,!![]);}catch(_0x24d4a0){return BPromise[_0xaa92('0x25')](_0x24d4a0);}return _0x36994a[_0xaa92('0x26')]();};}function saveUpdates(_0x100d53,_0x40b124){return function(_0x220518){if(_0x220518){return _0x220518['update'](_0x100d53)[_0xaa92('0x27')](function(_0x355534){return _0x355534;});}return null;};}function removeEntity(_0x5b0aca,_0x3d047b){return function(_0x3dcb12){if(_0x3dcb12){return _0x3dcb12[_0xaa92('0x28')]()[_0xaa92('0x27')](function(){var _0x16c518=_0x3dcb12[_0xaa92('0x29')]({'plain':!![]});var _0x11bd4f=_0xaa92('0x2a');return db[_0xaa92('0x2b')]['destroy']({'where':{'type':_0x11bd4f,'resourceId':_0x16c518['id']}})[_0xaa92('0x27')](function(){return _0x3dcb12;});})[_0xaa92('0x27')](function(){_0x5b0aca['status'](0xcc)[_0xaa92('0x1d')]();});}};}function handleEntityNotFound(_0x2c0b2d,_0x4e8362){return function(_0x461040){if(!_0x461040){_0x2c0b2d['sendStatus'](0x194);}return _0x461040;};}function handleError(_0x1c9c51,_0x44d5df){_0x44d5df=_0x44d5df||0x1f4;return function(_0x1b3ec6){logger[_0xaa92('0x2c')](_0x1b3ec6[_0xaa92('0x2d')]);if(_0x1b3ec6[_0xaa92('0x2e')]){delete _0x1b3ec6['name'];}_0x1c9c51[_0xaa92('0x1e')](_0x44d5df)[_0xaa92('0x2f')](_0x1b3ec6);};}exports[_0xaa92('0x30')]=function(_0x36b8e3,_0xfdccf9){var _0xb57b9a={},_0x2c4a8e={},_0x52aa5c={'count':0x0,'rows':[]};var _0x47efee=_[_0xaa92('0x31')](db[_0xaa92('0x32')][_0xaa92('0x33')],function(_0x715332){return{'name':_0x715332[_0xaa92('0x34')],'type':_0x715332['type']['key']};});_0x2c4a8e[_0xaa92('0x35')]=_[_0xaa92('0x31')](_0x47efee,_0xaa92('0x2e'));_0x2c4a8e[_0xaa92('0x36')]=_[_0xaa92('0x37')](_0x36b8e3[_0xaa92('0x36')]);_0x2c4a8e[_0xaa92('0x38')]=_[_0xaa92('0x39')](_0x2c4a8e[_0xaa92('0x35')],_0x2c4a8e[_0xaa92('0x36')]);_0xb57b9a['attributes']=_[_0xaa92('0x39')](_0x2c4a8e[_0xaa92('0x35')],qs['fields'](_0x36b8e3[_0xaa92('0x36')]['fields']));_0xb57b9a['attributes']=_0xb57b9a[_0xaa92('0x3a')][_0xaa92('0x3b')]?_0xb57b9a['attributes']:_0x2c4a8e[_0xaa92('0x35')];if(!_0x36b8e3[_0xaa92('0x36')][_0xaa92('0x3c')](_0xaa92('0x3d'))){_0xb57b9a[_0xaa92('0x23')]=qs['limit'](_0x36b8e3['query'][_0xaa92('0x23')]);_0xb57b9a[_0xaa92('0x20')]=qs[_0xaa92('0x20')](_0x36b8e3[_0xaa92('0x36')]['offset']);}_0xb57b9a[_0xaa92('0x3e')]=qs[_0xaa92('0x3f')](_0x36b8e3[_0xaa92('0x36')][_0xaa92('0x3f')]);_0xb57b9a['where']=qs[_0xaa92('0x38')](_['pick'](_0x36b8e3['query'],_0x2c4a8e[_0xaa92('0x38')]),_0x47efee);if(_0x36b8e3[_0xaa92('0x36')][_0xaa92('0x40')]){_0xb57b9a['where']=_[_0xaa92('0x41')](_0xb57b9a[_0xaa92('0x42')],{'$or':_[_0xaa92('0x31')](_0x47efee,function(_0x5a9cbe){if(_0x5a9cbe['type']!==_0xaa92('0x43')){var _0x3ac993={};_0x3ac993[_0x5a9cbe[_0xaa92('0x2e')]]={'$like':'%'+_0x36b8e3[_0xaa92('0x36')]['filter']+'%'};return _0x3ac993;}})});}_0xb57b9a=_[_0xaa92('0x41')]({},_0xb57b9a,_0x36b8e3[_0xaa92('0x44')]);var _0x3d2428={'where':_0xb57b9a['where']};return db[_0xaa92('0x32')][_0xaa92('0x22')](_0x3d2428)[_0xaa92('0x27')](function(_0x4f2bb8){_0x52aa5c[_0xaa92('0x22')]=_0x4f2bb8;if(_0x36b8e3[_0xaa92('0x36')][_0xaa92('0x45')]){_0xb57b9a[_0xaa92('0x46')]=[{'all':!![]}];}return db[_0xaa92('0x32')]['findAll'](_0xb57b9a);})[_0xaa92('0x27')](function(_0x825ec8){_0x52aa5c[_0xaa92('0x47')]=_0x825ec8;return _0x52aa5c;})[_0xaa92('0x27')](respondWithFilteredResult(_0xfdccf9,_0xb57b9a))[_0xaa92('0x48')](handleError(_0xfdccf9,null));};exports['show']=function(_0xad233a,_0x33be0e){var _0x451372={'raw':![],'where':{'id':_0xad233a[_0xaa92('0x49')]['id']}},_0x442d0f={};_0x442d0f[_0xaa92('0x35')]=_[_0xaa92('0x37')](db[_0xaa92('0x32')][_0xaa92('0x33')]);_0x442d0f[_0xaa92('0x36')]=_[_0xaa92('0x37')](_0xad233a[_0xaa92('0x36')]);_0x442d0f[_0xaa92('0x38')]=_['intersection'](_0x442d0f['model'],_0x442d0f[_0xaa92('0x36')]);_0x451372[_0xaa92('0x3a')]=_[_0xaa92('0x39')](_0x442d0f['model'],qs[_0xaa92('0x4a')](_0xad233a[_0xaa92('0x36')][_0xaa92('0x4a')]));_0x451372[_0xaa92('0x3a')]=_0x451372['attributes'][_0xaa92('0x3b')]?_0x451372[_0xaa92('0x3a')]:_0x442d0f[_0xaa92('0x35')];if(_0xad233a[_0xaa92('0x36')][_0xaa92('0x45')]){_0x451372['include']=[{'all':!![]}];}_0x451372=_[_0xaa92('0x41')]({},_0x451372,_0xad233a[_0xaa92('0x44')]);return db['VoiceChanSpy'][_0xaa92('0x4b')](_0x451372)['then'](handleEntityNotFound(_0x33be0e,null))[_0xaa92('0x27')](respondWithResult(_0x33be0e,null))['catch'](handleError(_0x33be0e,null));};exports['create']=function(_0x46fa57,_0x301ad3){return db[_0xaa92('0x32')][_0xaa92('0x4c')](_0x46fa57['body'],{})[_0xaa92('0x27')](function(_0x765ad8){var _0x33e3d0=_0x46fa57['user']['get']({'plain':!![]});if(!_0x33e3d0)throw new Error(_0xaa92('0x4d'));if(_0x33e3d0[_0xaa92('0x4e')]==='user'){var _0x2f5a32=_0x765ad8['get']({'plain':!![]});var _0x5ddc29='ChanSpies';return db[_0xaa92('0x4f')]['find']({'where':{'name':_0x5ddc29,'userProfileId':_0x33e3d0[_0xaa92('0x50')]},'raw':!![]})[_0xaa92('0x27')](function(_0x47dae5){if(_0x47dae5&&_0x47dae5[_0xaa92('0x51')]===0x0){return db[_0xaa92('0x2b')][_0xaa92('0x4c')]({'name':_0x2f5a32[_0xaa92('0x2e')],'resourceId':_0x2f5a32['id'],'type':_0x47dae5[_0xaa92('0x2e')],'sectionId':_0x47dae5['id']},{})['then'](function(){return _0x765ad8;});}else{return _0x765ad8;}})[_0xaa92('0x48')](function(_0x1b61ba){logger[_0xaa92('0x2c')](_0xaa92('0x52'),_0x1b61ba);throw _0x1b61ba;});}return _0x765ad8;})['then'](respondWithResult(_0x301ad3,0xc9))[_0xaa92('0x48')](handleError(_0x301ad3,null));};exports[_0xaa92('0x53')]=function(_0x503847,_0x32632b){if(_0x503847[_0xaa92('0x54')]['id']){delete _0x503847['body']['id'];}return db[_0xaa92('0x32')]['find']({'where':{'id':_0x503847[_0xaa92('0x49')]['id']}})['then'](handleEntityNotFound(_0x32632b,null))[_0xaa92('0x27')](saveUpdates(_0x503847[_0xaa92('0x54')],null))[_0xaa92('0x27')](respondWithResult(_0x32632b,null))[_0xaa92('0x48')](handleError(_0x32632b,null));};exports['destroy']=function(_0x15828a,_0xacefe1){return db[_0xaa92('0x32')]['find']({'where':{'id':_0x15828a[_0xaa92('0x49')]['id']}})[_0xaa92('0x27')](handleEntityNotFound(_0xacefe1,null))[_0xaa92('0x27')](removeEntity(_0xacefe1,null))[_0xaa92('0x48')](handleError(_0xacefe1,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index bba1c6a..59b0d14 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 _0xe130=['StopMixMonitor','length','concat','User','findAll','then','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','lodash','util','./voiceChanSpy.attributes','context','from-sip','format','prefix','Set','record','push','merge','MixMonitor','recordingFormat','auth','password','ChanSpy','SIP/%s,%s','name','options','join'];(function(_0x3a2f90,_0x21b273){var _0xa178c4=function(_0x18539){while(--_0x18539){_0x3a2f90['push'](_0x3a2f90['shift']());}};_0xa178c4(++_0x21b273);}(_0xe130,0x127));var _0x0e13=function(_0x404130,_0x592c28){_0x404130=_0x404130-0x0;var _0x14fe61=_0xe130[_0x404130];return _0x14fe61;};'use strict';var _=require(_0x0e13('0x0'));var util=require(_0x0e13('0x1'));var BPromise=require('bluebird');var attributes=require(_0x0e13('0x2'));var getUserApplications=function(_0x3cbccc,_0x1dd4fa,_0x360489){var _0x449ddd=0x1;var _0x504f15=[];var _0x1489a9={'context':_0x1dd4fa[_0x0e13('0x3')]||_0x0e13('0x4'),'exten':util[_0x0e13('0x5')]('%s%s',_0x3cbccc[_0x0e13('0x6')],_0x360489),'type':'system','isApp':![],'ChanSpyId':_0x3cbccc['id'],'UserId':_0x1dd4fa['id']};_0x504f15['push'](_['merge']({'app':_0x0e13('0x7'),'appdata':util[_0x0e13('0x5')]('CDR(type)=%s','chanspy'),'priority':_0x449ddd++},_0x1489a9));if(_0x3cbccc[_0x0e13('0x8')]){_0x504f15[_0x0e13('0x9')](_[_0x0e13('0xa')]({'app':_0x0e13('0xb'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x3cbccc[_0x0e13('0xc')]),'priority':_0x449ddd++},_0x1489a9));}if(_0x3cbccc[_0x0e13('0xd')]){_0x504f15[_0x0e13('0x9')](_[_0x0e13('0xa')]({'app':'Authenticate','appdata':_0x3cbccc[_0x0e13('0xe')],'priority':_0x449ddd++},_0x1489a9));}_0x504f15['push'](_[_0x0e13('0xa')]({'app':_0x0e13('0xf'),'appdata':util[_0x0e13('0x5')](_0x0e13('0x10'),_0x1dd4fa[_0x0e13('0x11')],_0x3cbccc[_0x0e13('0x12')]?_0x3cbccc[_0x0e13('0x12')][_0x0e13('0x13')](''):''),'priority':_0x449ddd++},_0x1489a9));if(_0x3cbccc[_0x0e13('0x8')]){_0x504f15['push'](_[_0x0e13('0xa')]({'app':_0x0e13('0x14'),'priority':_0x449ddd++},_0x1489a9));}return _0x504f15;};var getChanSpyApplications=function(_0x2057fe,_0x433965){var _0x38bfb3=[];for(var _0x32f76a=0x0,_0x527461=0x1;_0x32f76a<_0x433965[_0x0e13('0x15')];_0x32f76a++,_0x527461=0x1){_0x38bfb3=_0x38bfb3[_0x0e13('0x16')](getUserApplications(_0x2057fe,_0x433965[_0x32f76a],_0x433965[_0x32f76a]['internal']));if(_0x433965[_0x32f76a]['internal']!=_0x433965[_0x32f76a][_0x0e13('0x11')]){_0x38bfb3=_0x38bfb3['concat'](getUserApplications(_0x2057fe,_0x433965[_0x32f76a],_0x433965[_0x32f76a][_0x0e13('0x11')]));}}return _0x38bfb3;};var getChanSpyPromise=function(_0x4e1ffa,_0x294aea){return new BPromise(function(_0x2763be,_0x559c3f){return _0x4e1ffa[_0x0e13('0x17')][_0x0e13('0x18')]({'attributes':['id','name','internal'],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x0e13('0x19')](function(_0x141c84){if(_0x141c84){return _0x2763be(getChanSpyApplications(_0x294aea,_0x141c84));}return _0x2763be([]);})['catch'](function(_0x515222){_0x559c3f(_0x515222);});});};module[_0x0e13('0x1a')]=function(_0x296ed3,_0x120f08){var _0x5318f5=_0x296ed3[_0x0e13('0x1b')];return _0x296ed3[_0x0e13('0x1c')](_0x0e13('0x1d'),attributes,{'tableName':_0x0e13('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x402e9b,_0x4117e5,_0x4240e7){return getChanSpyPromise(_0x5318f5,_0x402e9b)[_0x0e13('0x19')](function(_0x3d6abf){if(_0x3d6abf&&_0x3d6abf[_0x0e13('0x15')]){return _0x5318f5[_0x0e13('0x1f')][_0x0e13('0x20')](_0x3d6abf);}})[_0x0e13('0x19')](function(){_0x4240e7();})[_0x0e13('0x21')](function(_0xfd19ed){_0x4240e7(_0xfd19ed);});},'afterUpdate':function(_0x22daca,_0x1edc48,_0x59ae33){return _0x5318f5[_0x0e13('0x1f')][_0x0e13('0x22')]({'where':{'ChanSpyId':_0x22daca['id']}})[_0x0e13('0x19')](function(){return getChanSpyPromise(_0x5318f5,_0x22daca);})['then'](function(_0x2182ae){if(_0x2182ae&&_0x2182ae[_0x0e13('0x15')]){return _0x5318f5[_0x0e13('0x1f')][_0x0e13('0x20')](_0x2182ae);}})['then'](function(){_0x59ae33();})[_0x0e13('0x21')](function(_0x3867d5){_0x59ae33(_0x3867d5);});},'afterDestroy':function(_0x3b99ce,_0x269a66,_0x2e65e2){return _0x5318f5[_0x0e13('0x1f')][_0x0e13('0x22')]({'where':{'ChanSpyId':_0x3b99ce['id']}})[_0x0e13('0x19')](function(){_0x2e65e2();})['catch'](function(_0x36d25f){_0x2e65e2(_0x36d25f);});}}});}; \ No newline at end of file +var _0x8d97=['password','ChanSpy','SIP/%s,%s','name','options','join','record','StopMixMonitor','concat','internal','User','findAll','agent','then','catch','exports','models','define','length','VoiceExtension','bulkCreate','destroy','util','bluebird','context','from-sip','format','push','merge','Set','CDR(type)=%s','chanspy','MixMonitor','recordingFormat','auth','Authenticate'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8d97,0x82));var _0x78d9=function(_0x765824,_0x26a2f8){_0x765824=_0x765824-0x0;var _0xcb9e18=_0x8d97[_0x765824];return _0xcb9e18;};'use strict';var _=require('lodash');var util=require(_0x78d9('0x0'));var BPromise=require(_0x78d9('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x323f54,_0x1cbdd1,_0x17bfab){var _0xba5b3=0x1;var _0x1b690f=[];var _0x5f4582={'context':_0x1cbdd1[_0x78d9('0x2')]||_0x78d9('0x3'),'exten':util[_0x78d9('0x4')]('%s%s',_0x323f54['prefix'],_0x17bfab),'type':'system','isApp':![],'ChanSpyId':_0x323f54['id'],'UserId':_0x1cbdd1['id']};_0x1b690f[_0x78d9('0x5')](_[_0x78d9('0x6')]({'app':_0x78d9('0x7'),'appdata':util[_0x78d9('0x4')](_0x78d9('0x8'),_0x78d9('0x9')),'priority':_0xba5b3++},_0x5f4582));if(_0x323f54['record']){_0x1b690f[_0x78d9('0x5')](_[_0x78d9('0x6')]({'app':_0x78d9('0xa'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x323f54[_0x78d9('0xb')]),'priority':_0xba5b3++},_0x5f4582));}if(_0x323f54[_0x78d9('0xc')]){_0x1b690f[_0x78d9('0x5')](_[_0x78d9('0x6')]({'app':_0x78d9('0xd'),'appdata':_0x323f54[_0x78d9('0xe')],'priority':_0xba5b3++},_0x5f4582));}_0x1b690f['push'](_[_0x78d9('0x6')]({'app':_0x78d9('0xf'),'appdata':util[_0x78d9('0x4')](_0x78d9('0x10'),_0x1cbdd1[_0x78d9('0x11')],_0x323f54[_0x78d9('0x12')]?_0x323f54[_0x78d9('0x12')][_0x78d9('0x13')](''):''),'priority':_0xba5b3++},_0x5f4582));if(_0x323f54[_0x78d9('0x14')]){_0x1b690f[_0x78d9('0x5')](_[_0x78d9('0x6')]({'app':_0x78d9('0x15'),'priority':_0xba5b3++},_0x5f4582));}return _0x1b690f;};var getChanSpyApplications=function(_0x45934d,_0x3501b5){var _0xf2a81c=[];for(var _0x156981=0x0,_0x1b2f6c=0x1;_0x156981<_0x3501b5['length'];_0x156981++,_0x1b2f6c=0x1){_0xf2a81c=_0xf2a81c[_0x78d9('0x16')](getUserApplications(_0x45934d,_0x3501b5[_0x156981],_0x3501b5[_0x156981][_0x78d9('0x17')]));if(_0x3501b5[_0x156981][_0x78d9('0x17')]!=_0x3501b5[_0x156981][_0x78d9('0x11')]){_0xf2a81c=_0xf2a81c[_0x78d9('0x16')](getUserApplications(_0x45934d,_0x3501b5[_0x156981],_0x3501b5[_0x156981][_0x78d9('0x11')]));}}return _0xf2a81c;};var getChanSpyPromise=function(_0x2d1db8,_0x2969fa){return new BPromise(function(_0x3fc3c2,_0x1e6791){return _0x2d1db8[_0x78d9('0x18')][_0x78d9('0x19')]({'attributes':['id',_0x78d9('0x11'),_0x78d9('0x17')],'where':{'role':_0x78d9('0x1a'),'chanspy':!![]},'raw':!![]})[_0x78d9('0x1b')](function(_0x4df145){if(_0x4df145){return _0x3fc3c2(getChanSpyApplications(_0x2969fa,_0x4df145));}return _0x3fc3c2([]);})[_0x78d9('0x1c')](function(_0x4285d4){_0x1e6791(_0x4285d4);});});};module[_0x78d9('0x1d')]=function(_0x18bb18,_0x4d571f){var _0x34e581=_0x18bb18[_0x78d9('0x1e')];return _0x18bb18[_0x78d9('0x1f')]('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x30e434,_0x4946a5,_0x47a331){return getChanSpyPromise(_0x34e581,_0x30e434)['then'](function(_0x28b7e1){if(_0x28b7e1&&_0x28b7e1[_0x78d9('0x20')]){return _0x34e581[_0x78d9('0x21')][_0x78d9('0x22')](_0x28b7e1);}})[_0x78d9('0x1b')](function(){_0x47a331();})[_0x78d9('0x1c')](function(_0x4e87cf){_0x47a331(_0x4e87cf);});},'afterUpdate':function(_0x17b928,_0x53a0ab,_0x145c0c){return _0x34e581[_0x78d9('0x21')][_0x78d9('0x23')]({'where':{'ChanSpyId':_0x17b928['id']}})['then'](function(){return getChanSpyPromise(_0x34e581,_0x17b928);})[_0x78d9('0x1b')](function(_0x337816){if(_0x337816&&_0x337816['length']){return _0x34e581['VoiceExtension']['bulkCreate'](_0x337816);}})['then'](function(){_0x145c0c();})[_0x78d9('0x1c')](function(_0xcbb803){_0x145c0c(_0xcbb803);});},'afterDestroy':function(_0x146396,_0x45002a,_0x40a789){return _0x34e581[_0x78d9('0x21')][_0x78d9('0x23')]({'where':{'ChanSpyId':_0x146396['id']}})[_0x78d9('0x1b')](function(){_0x40a789();})[_0x78d9('0x1c')](function(_0x3cb9a9){_0x40a789(_0x3cb9a9);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 8668507..101f754 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 _0xe5e8=['result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','error','code','VoiceChanSpy,\x20%s,\x20%s','message'];(function(_0x26188b,_0x543e3a){var _0x4374ae=function(_0x37e529){while(--_0x37e529){_0x26188b['push'](_0x26188b['shift']());}};_0x4374ae(++_0x543e3a);}(_0xe5e8,0xe9));var _0x8e5e=function(_0x317fcc,_0x2da919){_0x317fcc=_0x317fcc-0x0;var _0x4b453f=_0xe5e8[_0x317fcc];return _0x4b453f;};'use strict';var _=require(_0x8e5e('0x0'));var util=require(_0x8e5e('0x1'));var moment=require(_0x8e5e('0x2'));var BPromise=require(_0x8e5e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e5e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e5e('0x5'));var logger=require(_0x8e5e('0x6'))(_0x8e5e('0x7'));var config=require('../../config/environment');var jayson=require(_0x8e5e('0x8'));var client=jayson[_0x8e5e('0x9')][_0x8e5e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16c97e,_0x5d437d,_0x4f9677){return new BPromise(function(_0x5aaaa0,_0x24839c){return client[_0x8e5e('0xb')](_0x16c97e,_0x4f9677)[_0x8e5e('0xc')](function(_0x3267b7){logger[_0x8e5e('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x5d437d,_0x8e5e('0xe'));logger['debug']('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x5d437d,_0x8e5e('0xe'),JSON['stringify'](_0x3267b7));if(_0x3267b7['error']){if(_0x3267b7[_0x8e5e('0xf')][_0x8e5e('0x10')]===0x1f4){logger[_0x8e5e('0xf')](_0x8e5e('0x11'),_0x5d437d,_0x3267b7['error'][_0x8e5e('0x12')]);return _0x24839c(_0x3267b7['error'][_0x8e5e('0x12')]);}logger[_0x8e5e('0xf')](_0x8e5e('0x11'),_0x5d437d,_0x3267b7[_0x8e5e('0xf')][_0x8e5e('0x12')]);return _0x5aaaa0(_0x3267b7[_0x8e5e('0xf')][_0x8e5e('0x12')]);}else{logger['info'](_0x8e5e('0x11'),_0x5d437d,_0x8e5e('0xe'));_0x5aaaa0(_0x3267b7[_0x8e5e('0x13')][_0x8e5e('0x12')]);}})[_0x8e5e('0x14')](function(_0x1c3d7a){logger[_0x8e5e('0xf')](_0x8e5e('0x11'),_0x5d437d,_0x1c3d7a);_0x24839c(_0x1c3d7a);});});} \ No newline at end of file +var _0xcb14=['then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x11fa8c,_0x7b21af){var _0x59b5d7=function(_0xe0337f){while(--_0xe0337f){_0x11fa8c['push'](_0x11fa8c['shift']());}};_0x59b5d7(++_0x7b21af);}(_0xcb14,0x68));var _0x4cb1=function(_0x722103,_0x5732f3){_0x722103=_0x722103-0x0;var _0x3e2435=_0xcb14[_0x722103];return _0x3e2435;};'use strict';var _=require(_0x4cb1('0x0'));var util=require(_0x4cb1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cb1('0x2'));var db=require(_0x4cb1('0x3'))['db'];var utils=require(_0x4cb1('0x4'));var logger=require(_0x4cb1('0x5'))(_0x4cb1('0x6'));var config=require('../../config/environment');var jayson=require(_0x4cb1('0x7'));var client=jayson[_0x4cb1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53a5fa,_0x558be6,_0x4dac8d){return new BPromise(function(_0x28f970,_0x3cb0ea){return client[_0x4cb1('0x9')](_0x53a5fa,_0x4dac8d)[_0x4cb1('0xa')](function(_0x466daa){logger[_0x4cb1('0xb')](_0x4cb1('0xc'),_0x558be6,'request\x20sent');logger[_0x4cb1('0xd')](_0x4cb1('0xe'),_0x558be6,_0x4cb1('0xf'),JSON['stringify'](_0x466daa));if(_0x466daa[_0x4cb1('0x10')]){if(_0x466daa[_0x4cb1('0x10')]['code']===0x1f4){logger[_0x4cb1('0x10')](_0x4cb1('0xc'),_0x558be6,_0x466daa['error']['message']);return _0x3cb0ea(_0x466daa['error'][_0x4cb1('0x11')]);}logger[_0x4cb1('0x10')](_0x4cb1('0xc'),_0x558be6,_0x466daa[_0x4cb1('0x10')][_0x4cb1('0x11')]);return _0x28f970(_0x466daa[_0x4cb1('0x10')][_0x4cb1('0x11')]);}else{logger[_0x4cb1('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x558be6,_0x4cb1('0xf'));_0x28f970(_0x466daa[_0x4cb1('0x12')][_0x4cb1('0x11')]);}})['catch'](function(_0x236a24){logger[_0x4cb1('0x10')](_0x4cb1('0xc'),_0x558be6,_0x236a24);_0x3cb0ea(_0x236a24);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 35fd936..72170b6 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 _0x4f88=['create','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x4f88,0xf3));var _0x84f8=function(_0x48f7cf,_0x4baa04){_0x48f7cf=_0x48f7cf-0x0;var _0xc201c0=_0x4f88[_0x48f7cf];return _0xc201c0;};'use strict';var multer=require(_0x84f8('0x0'));var util=require(_0x84f8('0x1'));var path=require('path');var timeout=require(_0x84f8('0x2'));var express=require(_0x84f8('0x3'));var router=express[_0x84f8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x84f8('0x5'));var config=require(_0x84f8('0x6'));var controller=require(_0x84f8('0x7'));router[_0x84f8('0x8')]('/',auth[_0x84f8('0x9')](),controller[_0x84f8('0xa')]);router['get'](_0x84f8('0xb'),auth[_0x84f8('0x9')](),controller['show']);router['post']('/',auth[_0x84f8('0x9')](),controller[_0x84f8('0xc')]);router[_0x84f8('0xd')](_0x84f8('0xb'),auth[_0x84f8('0x9')](),controller[_0x84f8('0xe')]);router[_0x84f8('0xf')](_0x84f8('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x84f8('0x10')]=router; \ No newline at end of file +var _0x0fc8=['create','put','update','destroy','exports','multer','util','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x407a24,_0x2b13ce){var _0x5651bb=function(_0x559186){while(--_0x559186){_0x407a24['push'](_0x407a24['shift']());}};_0x5651bb(++_0x2b13ce);}(_0x0fc8,0x145));var _0x80fc=function(_0x3f5010,_0x1c0d58){_0x3f5010=_0x3f5010-0x0;var _0xb9c239=_0x0fc8[_0x3f5010];return _0xb9c239;};'use strict';var multer=require(_0x80fc('0x0'));var util=require(_0x80fc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x80fc('0x2')]();var fs_extra=require(_0x80fc('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x80fc('0x4'));var controller=require('./voiceContext.controller');router[_0x80fc('0x5')]('/',auth[_0x80fc('0x6')](),controller[_0x80fc('0x7')]);router[_0x80fc('0x5')](_0x80fc('0x8'),auth['isAuthenticated'](),controller[_0x80fc('0x9')]);router[_0x80fc('0xa')]('/',auth['isAuthenticated'](),controller[_0x80fc('0xb')]);router[_0x80fc('0xc')](_0x80fc('0x8'),auth['isAuthenticated'](),controller[_0x80fc('0xd')]);router['delete']('/:id',auth[_0x80fc('0x6')](),controller[_0x80fc('0xe')]);module[_0x80fc('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 9365eeb..7558a6d 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 _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x22f34f,_0x28a52b){var _0x413943=function(_0x506d78){while(--_0x506d78){_0x22f34f['push'](_0x22f34f['shift']());}};_0x413943(++_0x28a52b);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe14b=['exports','STRING','BOOLEAN','sequelize'];(function(_0xda4682,_0x361238){var _0x109241=function(_0x5ecba6){while(--_0x5ecba6){_0xda4682['push'](_0xda4682['shift']());}};_0x109241(++_0x361238);}(_0xe14b,0x93));var _0xbe14=function(_0x25e9de,_0x4a1674){_0x25e9de=_0x25e9de-0x0;var _0x797945=_0xe14b[_0x25e9de];return _0x797945;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xbe14('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbe14('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 84258a2..e244f07 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 _0x13ef=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','get','UserProfileResource','destroy','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','find','create','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','role','user','Contexts','autoAssociation','params','body','root','readFileSync','join','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x1eac9b,_0x24bf2f){var _0x33dfd6=function(_0x5ba3bc){while(--_0x5ba3bc){_0x1eac9b['push'](_0x1eac9b['shift']());}};_0x33dfd6(++_0x24bf2f);}(_0x13ef,0x12b));var _0xf13e=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x13ef[_0x32b542];return _0x554d54;};'use strict';var emlformat=require(_0xf13e('0x0'));var rimraf=require(_0xf13e('0x1'));var zipdir=require(_0xf13e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf13e('0x3'));var moment=require(_0xf13e('0x4'));var BPromise=require(_0xf13e('0x5'));var Mustache=require(_0xf13e('0x6'));var util=require('util');var path=require(_0xf13e('0x7'));var sox=require('sox');var csv=require(_0xf13e('0x8'));var ejs=require(_0xf13e('0x9'));var fs=require('fs');var fs_extra=require(_0xf13e('0xa'));var _=require(_0xf13e('0xb'));var squel=require(_0xf13e('0xc'));var crypto=require(_0xf13e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf13e('0xe'));var toCsv=require(_0xf13e('0x8'));var querystring=require(_0xf13e('0xf'));var Papa=require(_0xf13e('0x10'));var Redis=require(_0xf13e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf13e('0x12'));var as=require(_0xf13e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf13e('0x14'))(_0xf13e('0x15'));var utils=require(_0xf13e('0x16'));var config=require(_0xf13e('0x17'));var licenseUtil=require(_0xf13e('0x18'));var db=require(_0xf13e('0x19'))['db'];var jayson=require(_0xf13e('0x1a'));var client=jayson[_0xf13e('0x1b')][_0xf13e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1d0d3b,_0x50392,_0x3a626d,_0x36b551){return new BPromise(function(_0x2d2659,_0x1e40ff){var _0x3d5d15=_0x36b551||client;return _0x3d5d15[_0xf13e('0x1d')](_0x1d0d3b,_0x3a626d)[_0xf13e('0x1e')](function(_0x1c8d9a){logger['info'](_0xf13e('0x1f'),_0x50392,_0xf13e('0x20'));logger[_0xf13e('0x21')](_0xf13e('0x22'),_0x50392,_0xf13e('0x20'),JSON[_0xf13e('0x23')](_0x1c8d9a));if(_0x1c8d9a[_0xf13e('0x24')]){if(_0x1c8d9a[_0xf13e('0x24')][_0xf13e('0x25')]===0x1f4){logger[_0xf13e('0x24')](_0xf13e('0x1f'),_0x50392,_0x1c8d9a[_0xf13e('0x24')][_0xf13e('0x26')]);return _0x1e40ff(_0x1c8d9a[_0xf13e('0x24')][_0xf13e('0x26')]);}logger[_0xf13e('0x24')]('VoiceContext,\x20%s,\x20%s',_0x50392,_0x1c8d9a[_0xf13e('0x24')][_0xf13e('0x26')]);return _0x2d2659(_0x1c8d9a['error'][_0xf13e('0x26')]);}else{logger[_0xf13e('0x27')]('VoiceContext,\x20%s,\x20%s',_0x50392,'request\x20sent');_0x2d2659(_0x1c8d9a[_0xf13e('0x28')][_0xf13e('0x26')]);}})[_0xf13e('0x29')](function(_0x5143aa){logger[_0xf13e('0x24')](_0xf13e('0x1f'),_0x50392,_0x5143aa);_0x1e40ff(_0x5143aa);});});}function respondWithStatusCode(_0x468511,_0x60eb0e){_0x60eb0e=_0x60eb0e||0xcc;return function(_0x5276c8){if(_0x5276c8){return _0x468511[_0xf13e('0x2a')](_0x60eb0e);}return _0x468511[_0xf13e('0x2b')](_0x60eb0e)[_0xf13e('0x2c')]();};}function respondWithResult(_0x3fe1b2,_0x5ea92c){_0x5ea92c=_0x5ea92c||0xc8;return function(_0x24a8c9){if(_0x24a8c9){return _0x3fe1b2[_0xf13e('0x2b')](_0x5ea92c)[_0xf13e('0x2d')](_0x24a8c9);}};}function respondWithFilteredResult(_0x19b166,_0x5cd6b6){return function(_0x3b4ada){if(_0x3b4ada){var _0x16b534=typeof _0x5cd6b6['offset']===_0xf13e('0x2e')&&typeof _0x5cd6b6[_0xf13e('0x2f')]===_0xf13e('0x2e');var _0x54e1a7=_0x3b4ada[_0xf13e('0x30')];var _0x2ebc1f=_0x16b534?0x0:_0x5cd6b6[_0xf13e('0x31')];var _0x21f984=_0x16b534?_0x3b4ada[_0xf13e('0x30')]:_0x5cd6b6['offset']+_0x5cd6b6[_0xf13e('0x2f')];var _0xe33938;if(_0x21f984>=_0x54e1a7){_0x21f984=_0x54e1a7;_0xe33938=0xc8;}else{_0xe33938=0xce;}_0x19b166['status'](_0xe33938);return _0x19b166[_0xf13e('0x32')]('Content-Range',_0x2ebc1f+'-'+_0x21f984+'/'+_0x54e1a7)[_0xf13e('0x2d')](_0x3b4ada);}return null;};}function patchUpdates(_0xa843c3){return function(_0x16fbc3){try{jsonpatch[_0xf13e('0x33')](_0x16fbc3,_0xa843c3,!![]);}catch(_0x458564){return BPromise[_0xf13e('0x34')](_0x458564);}return _0x16fbc3['save']();};}function saveUpdates(_0x59f600,_0x5c7c92){return function(_0x25d84a){if(_0x25d84a){return _0x25d84a[_0xf13e('0x35')](_0x59f600)['then'](function(_0xc4b1f2){return _0xc4b1f2;});}return null;};}function removeEntity(_0x425300,_0x4a436f){return function(_0x292710){if(_0x292710){return _0x292710['destroy']()[_0xf13e('0x1e')](function(){var _0x12f1ac=_0x292710[_0xf13e('0x36')]({'plain':!![]});var _0x47891c='Contexts';return db[_0xf13e('0x37')][_0xf13e('0x38')]({'where':{'type':_0x47891c,'resourceId':_0x12f1ac['id']}})[_0xf13e('0x1e')](function(){return _0x292710;});})[_0xf13e('0x1e')](function(){_0x425300[_0xf13e('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6aab88,_0x5022cd){return function(_0x2dc18d){if(!_0x2dc18d){_0x6aab88[_0xf13e('0x2a')](0x194);}return _0x2dc18d;};}function handleError(_0xdf5c4b,_0x5e07b6){_0x5e07b6=_0x5e07b6||0x1f4;return function(_0xfa2e8a){logger[_0xf13e('0x24')](_0xfa2e8a[_0xf13e('0x39')]);if(_0xfa2e8a[_0xf13e('0x3a')]){delete _0xfa2e8a['name'];}_0xdf5c4b[_0xf13e('0x2b')](_0x5e07b6)[_0xf13e('0x3b')](_0xfa2e8a);};}exports[_0xf13e('0x3c')]=function(_0x571cd8,_0x23669b){var _0x42a0af={},_0x2a059b={},_0x5b2b85={'count':0x0,'rows':[]};var _0x1968a2=_[_0xf13e('0x3d')](db[_0xf13e('0x3e')][_0xf13e('0x3f')],function(_0x43f0c1){return{'name':_0x43f0c1[_0xf13e('0x40')],'type':_0x43f0c1[_0xf13e('0x41')][_0xf13e('0x42')]};});_0x2a059b['model']=_[_0xf13e('0x3d')](_0x1968a2,_0xf13e('0x3a'));_0x2a059b['query']=_[_0xf13e('0x43')](_0x571cd8[_0xf13e('0x44')]);_0x2a059b[_0xf13e('0x45')]=_[_0xf13e('0x46')](_0x2a059b[_0xf13e('0x47')],_0x2a059b[_0xf13e('0x44')]);_0x42a0af[_0xf13e('0x48')]=_[_0xf13e('0x46')](_0x2a059b[_0xf13e('0x47')],qs[_0xf13e('0x49')](_0x571cd8['query'][_0xf13e('0x49')]));_0x42a0af[_0xf13e('0x48')]=_0x42a0af['attributes'][_0xf13e('0x4a')]?_0x42a0af['attributes']:_0x2a059b[_0xf13e('0x47')];if(!_0x571cd8[_0xf13e('0x44')]['hasOwnProperty']('nolimit')){_0x42a0af[_0xf13e('0x2f')]=qs['limit'](_0x571cd8[_0xf13e('0x44')]['limit']);_0x42a0af[_0xf13e('0x31')]=qs[_0xf13e('0x31')](_0x571cd8[_0xf13e('0x44')][_0xf13e('0x31')]);}_0x42a0af[_0xf13e('0x4b')]=qs[_0xf13e('0x4c')](_0x571cd8['query'][_0xf13e('0x4c')]);_0x42a0af[_0xf13e('0x4d')]=qs['filters'](_[_0xf13e('0x4e')](_0x571cd8[_0xf13e('0x44')],_0x2a059b[_0xf13e('0x45')]),_0x1968a2);if(_0x571cd8['query'][_0xf13e('0x4f')]){_0x42a0af[_0xf13e('0x4d')]=_[_0xf13e('0x50')](_0x42a0af[_0xf13e('0x4d')],{'$or':_['map'](_0x1968a2,function(_0x20c120){if(_0x20c120[_0xf13e('0x41')]!==_0xf13e('0x51')){var _0x5980e2={};_0x5980e2[_0x20c120['name']]={'$like':'%'+_0x571cd8[_0xf13e('0x44')][_0xf13e('0x4f')]+'%'};return _0x5980e2;}})});}_0x42a0af=_['merge']({},_0x42a0af,_0x571cd8[_0xf13e('0x52')]);var _0x4478f7={'where':_0x42a0af[_0xf13e('0x4d')]};return db['VoiceContext'][_0xf13e('0x30')](_0x4478f7)[_0xf13e('0x1e')](function(_0x326c16){_0x5b2b85[_0xf13e('0x30')]=_0x326c16;if(_0x571cd8[_0xf13e('0x44')][_0xf13e('0x53')]){_0x42a0af[_0xf13e('0x54')]=[{'all':!![]}];}return db[_0xf13e('0x3e')][_0xf13e('0x55')](_0x42a0af);})[_0xf13e('0x1e')](function(_0x3c50fe){_0x5b2b85['rows']=_0x3c50fe;return _0x5b2b85;})[_0xf13e('0x1e')](respondWithFilteredResult(_0x23669b,_0x42a0af))[_0xf13e('0x29')](handleError(_0x23669b,null));};exports[_0xf13e('0x56')]=function(_0x48e6c5,_0x1a90a6){var _0xba80c5={'raw':![],'where':{'id':_0x48e6c5['params']['id']}},_0x11684b={};_0x11684b['model']=_[_0xf13e('0x43')](db[_0xf13e('0x3e')][_0xf13e('0x3f')]);_0x11684b['query']=_['keys'](_0x48e6c5[_0xf13e('0x44')]);_0x11684b['filters']=_[_0xf13e('0x46')](_0x11684b['model'],_0x11684b[_0xf13e('0x44')]);_0xba80c5['attributes']=_['intersection'](_0x11684b['model'],qs[_0xf13e('0x49')](_0x48e6c5[_0xf13e('0x44')]['fields']));_0xba80c5[_0xf13e('0x48')]=_0xba80c5['attributes'][_0xf13e('0x4a')]?_0xba80c5[_0xf13e('0x48')]:_0x11684b[_0xf13e('0x47')];if(_0x48e6c5[_0xf13e('0x44')][_0xf13e('0x53')]){_0xba80c5['include']=[{'all':!![]}];}_0xba80c5=_[_0xf13e('0x50')]({},_0xba80c5,_0x48e6c5[_0xf13e('0x52')]);return db['VoiceContext'][_0xf13e('0x57')](_0xba80c5)['then'](handleEntityNotFound(_0x1a90a6,null))['then'](respondWithResult(_0x1a90a6,null))[_0xf13e('0x29')](handleError(_0x1a90a6,null));};exports[_0xf13e('0x58')]=function(_0x47d014,_0x1fd76e,_0xdd2163){var _0x21902c;return db[_0xf13e('0x3e')][_0xf13e('0x58')](_0x47d014['body'],{'raw':!![]})[_0xf13e('0x1e')](function(_0x3dc620){_0x21902c=_0x3dc620;return db['VoiceContext']['findAll']({'raw':!![]});})[_0xf13e('0x1e')](function(_0x13dbd8){var _0x2df3d4=fs['readFileSync'](path['join'](config['root'],_0xf13e('0x59')),_0xf13e('0x5a'));var _0x2bdddd=ejs[_0xf13e('0x5b')](_0x2df3d4,{'contexts':_0x13dbd8||[]});fs[_0xf13e('0x5c')](_0xf13e('0x5d'),_0x2bdddd);})[_0xf13e('0x1e')](function(){return respondWithRpcPromise(_0xf13e('0x5e'),_0xf13e('0x58'),{'module':_0xf13e('0x5f')});})['then'](function(){var _0x32df47=_0x47d014['user']['get']({'plain':!![]});if(!_0x32df47)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x32df47[_0xf13e('0x60')]===_0xf13e('0x61')){var _0x1a35dc=_0x21902c[_0xf13e('0x36')]({'plain':!![]});return db['UserProfileSection'][_0xf13e('0x57')]({'where':{'name':_0xf13e('0x62'),'userProfileId':_0x32df47['userProfileId']},'raw':!![]})['then'](function(_0x5486d2){if(_0x5486d2&&_0x5486d2[_0xf13e('0x63')]===0x0){return db[_0xf13e('0x37')][_0xf13e('0x58')]({'name':_0x1a35dc['name'],'resourceId':_0x1a35dc['id'],'type':_0x5486d2[_0xf13e('0x3a')],'sectionId':_0x5486d2['id']},{})[_0xf13e('0x1e')](function(){return _0x21902c;});}else{return _0x21902c;}})[_0xf13e('0x29')](function(_0x5c7eff){logger[_0xf13e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c7eff);throw _0x5c7eff;});}return _0x21902c;})['then'](respondWithResult(_0x1fd76e,0xc9))['catch'](handleError(_0x1fd76e,null));};exports[_0xf13e('0x35')]=function(_0x1fff19,_0x3a9eb2,_0x225b7e){var _0x1b32c8;return db[_0xf13e('0x3e')][_0xf13e('0x57')]({'where':{'id':_0x1fff19[_0xf13e('0x64')]['id']}})[_0xf13e('0x1e')](handleEntityNotFound(_0x3a9eb2,null))[_0xf13e('0x1e')](saveUpdates(_0x1fff19[_0xf13e('0x65')],null))[_0xf13e('0x1e')](function(_0x5e64ca){if(_0x5e64ca){_0x1b32c8=_0x5e64ca;return db[_0xf13e('0x3e')][_0xf13e('0x55')]({'raw':!![]});}})['then'](function(_0x434e31){var _0x173186=fs['readFileSync'](path['join'](config[_0xf13e('0x66')],'server/files/templates/context.ejs'),_0xf13e('0x5a'));var _0x141828=ejs[_0xf13e('0x5b')](_0x173186,{'contexts':_0x434e31||[]});fs[_0xf13e('0x5c')](_0xf13e('0x5d'),_0x141828);})[_0xf13e('0x1e')](function(){return respondWithRpcPromise(_0xf13e('0x5e'),_0xf13e('0x35'),{'module':_0xf13e('0x5f')});})[_0xf13e('0x1e')](function(){return _0x1b32c8;})['then'](respondWithResult(_0x3a9eb2,null))[_0xf13e('0x29')](handleError(_0x3a9eb2,null));};exports[_0xf13e('0x38')]=function(_0x440b77,_0x3c0426,_0xb4dfba){var _0x1fd081;return db[_0xf13e('0x3e')][_0xf13e('0x57')]({'where':{'id':_0x440b77[_0xf13e('0x64')]['id']}})['then'](handleEntityNotFound(_0x3c0426,null))['then'](removeEntity(_0x3c0426,null))['then'](function(){return db[_0xf13e('0x3e')][_0xf13e('0x55')]({'raw':!![]});})[_0xf13e('0x1e')](function(_0x3d11d3){var _0x2ccbd1=fs[_0xf13e('0x67')](path[_0xf13e('0x68')](config[_0xf13e('0x66')],_0xf13e('0x59')),'utf8');var _0x432ce4=ejs[_0xf13e('0x5b')](_0x2ccbd1,{'contexts':_0x3d11d3});fs[_0xf13e('0x5c')](_0xf13e('0x5d'),_0x432ce4);return respondWithRpcPromise(_0xf13e('0x5e'),_0xf13e('0x38'),{'module':'chan_sip.so'});})[_0xf13e('0x29')](handleError(_0x3c0426,null));}; \ No newline at end of file +var _0xa5c1=['eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','get','Contexts','UserProfileResource','destroy','stack','name','index','map','VoiceContext','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so'];(function(_0x51d276,_0x518cb6){var _0x1c1e5b=function(_0x38f909){while(--_0x38f909){_0x51d276['push'](_0x51d276['shift']());}};_0x1c1e5b(++_0x518cb6);}(_0xa5c1,0x188));var _0x1a5c=function(_0x450368,_0x2fe2d3){_0x450368=_0x450368-0x0;var _0x4fce06=_0xa5c1[_0x450368];return _0x4fce06;};'use strict';var emlformat=require(_0x1a5c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a5c('0x1'));var jsonpatch=require(_0x1a5c('0x2'));var rp=require(_0x1a5c('0x3'));var moment=require(_0x1a5c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1a5c('0x5'));var util=require(_0x1a5c('0x6'));var path=require('path');var sox=require(_0x1a5c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1a5c('0x8'));var squel=require(_0x1a5c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1a5c('0xa'));var toCsv=require(_0x1a5c('0xb'));var querystring=require(_0x1a5c('0xc'));var Papa=require(_0x1a5c('0xd'));var Redis=require(_0x1a5c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1a5c('0xf'));var as=require(_0x1a5c('0x10'));var hardwareService=require(_0x1a5c('0x11'));var logger=require(_0x1a5c('0x12'))(_0x1a5c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a5c('0x14'))['db'];var jayson=require(_0x1a5c('0x15'));var client=jayson[_0x1a5c('0x16')][_0x1a5c('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x184aec,_0x41e838,_0x3c551c,_0x57c747){return new BPromise(function(_0x5c5c71,_0x3ca87b){var _0x5cb334=_0x57c747||client;return _0x5cb334[_0x1a5c('0x18')](_0x184aec,_0x3c551c)[_0x1a5c('0x19')](function(_0x59bb9b){logger['info'](_0x1a5c('0x1a'),_0x41e838,'request\x20sent');logger[_0x1a5c('0x1b')](_0x1a5c('0x1c'),_0x41e838,'request\x20sent',JSON[_0x1a5c('0x1d')](_0x59bb9b));if(_0x59bb9b[_0x1a5c('0x1e')]){if(_0x59bb9b[_0x1a5c('0x1e')][_0x1a5c('0x1f')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x41e838,_0x59bb9b[_0x1a5c('0x1e')][_0x1a5c('0x20')]);return _0x3ca87b(_0x59bb9b[_0x1a5c('0x1e')][_0x1a5c('0x20')]);}logger[_0x1a5c('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x41e838,_0x59bb9b[_0x1a5c('0x1e')]['message']);return _0x5c5c71(_0x59bb9b['error'][_0x1a5c('0x20')]);}else{logger['info'](_0x1a5c('0x1a'),_0x41e838,'request\x20sent');_0x5c5c71(_0x59bb9b['result']['message']);}})['catch'](function(_0x4fc4ed){logger[_0x1a5c('0x1e')](_0x1a5c('0x1a'),_0x41e838,_0x4fc4ed);_0x3ca87b(_0x4fc4ed);});});}function respondWithStatusCode(_0x4e93cb,_0x16b03b){_0x16b03b=_0x16b03b||0xcc;return function(_0x4e0727){if(_0x4e0727){return _0x4e93cb[_0x1a5c('0x21')](_0x16b03b);}return _0x4e93cb[_0x1a5c('0x22')](_0x16b03b)[_0x1a5c('0x23')]();};}function respondWithResult(_0x2570db,_0x4c4271){_0x4c4271=_0x4c4271||0xc8;return function(_0x22726f){if(_0x22726f){return _0x2570db[_0x1a5c('0x22')](_0x4c4271)[_0x1a5c('0x24')](_0x22726f);}};}function respondWithFilteredResult(_0x18b637,_0x159bd8){return function(_0x10bd10){if(_0x10bd10){var _0x2675bc=typeof _0x159bd8[_0x1a5c('0x25')]===_0x1a5c('0x26')&&typeof _0x159bd8['limit']==='undefined';var _0x5e5618=_0x10bd10['count'];var _0xd3a6f3=_0x2675bc?0x0:_0x159bd8[_0x1a5c('0x25')];var _0x541eb9=_0x2675bc?_0x10bd10[_0x1a5c('0x27')]:_0x159bd8['offset']+_0x159bd8[_0x1a5c('0x28')];var _0x2047a0;if(_0x541eb9>=_0x5e5618){_0x541eb9=_0x5e5618;_0x2047a0=0xc8;}else{_0x2047a0=0xce;}_0x18b637[_0x1a5c('0x22')](_0x2047a0);return _0x18b637['set'](_0x1a5c('0x29'),_0xd3a6f3+'-'+_0x541eb9+'/'+_0x5e5618)[_0x1a5c('0x24')](_0x10bd10);}return null;};}function patchUpdates(_0x554630){return function(_0x300297){try{jsonpatch['apply'](_0x300297,_0x554630,!![]);}catch(_0x31e3ab){return BPromise[_0x1a5c('0x2a')](_0x31e3ab);}return _0x300297[_0x1a5c('0x2b')]();};}function saveUpdates(_0x331007,_0x13bba5){return function(_0x3e4a97){if(_0x3e4a97){return _0x3e4a97['update'](_0x331007)[_0x1a5c('0x19')](function(_0x302860){return _0x302860;});}return null;};}function removeEntity(_0x19a8ba,_0x4e4ad8){return function(_0x470a6a){if(_0x470a6a){return _0x470a6a['destroy']()[_0x1a5c('0x19')](function(){var _0x306847=_0x470a6a[_0x1a5c('0x2c')]({'plain':!![]});var _0x44a4b0=_0x1a5c('0x2d');return db[_0x1a5c('0x2e')][_0x1a5c('0x2f')]({'where':{'type':_0x44a4b0,'resourceId':_0x306847['id']}})[_0x1a5c('0x19')](function(){return _0x470a6a;});})[_0x1a5c('0x19')](function(){_0x19a8ba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x249350,_0x356b76){return function(_0x5d1529){if(!_0x5d1529){_0x249350['sendStatus'](0x194);}return _0x5d1529;};}function handleError(_0x578852,_0x1e35b2){_0x1e35b2=_0x1e35b2||0x1f4;return function(_0x4bb8c6){logger[_0x1a5c('0x1e')](_0x4bb8c6[_0x1a5c('0x30')]);if(_0x4bb8c6[_0x1a5c('0x31')]){delete _0x4bb8c6['name'];}_0x578852['status'](_0x1e35b2)['send'](_0x4bb8c6);};}exports[_0x1a5c('0x32')]=function(_0x511ba6,_0x309608){var _0x52bdaa={},_0xdee818={},_0x5e2541={'count':0x0,'rows':[]};var _0x4495d3=_[_0x1a5c('0x33')](db[_0x1a5c('0x34')][_0x1a5c('0x35')],function(_0x5d18a9){return{'name':_0x5d18a9[_0x1a5c('0x36')],'type':_0x5d18a9[_0x1a5c('0x37')]['key']};});_0xdee818[_0x1a5c('0x38')]=_[_0x1a5c('0x33')](_0x4495d3,'name');_0xdee818['query']=_[_0x1a5c('0x39')](_0x511ba6[_0x1a5c('0x3a')]);_0xdee818[_0x1a5c('0x3b')]=_[_0x1a5c('0x3c')](_0xdee818[_0x1a5c('0x38')],_0xdee818[_0x1a5c('0x3a')]);_0x52bdaa[_0x1a5c('0x3d')]=_[_0x1a5c('0x3c')](_0xdee818['model'],qs[_0x1a5c('0x3e')](_0x511ba6[_0x1a5c('0x3a')][_0x1a5c('0x3e')]));_0x52bdaa[_0x1a5c('0x3d')]=_0x52bdaa['attributes'][_0x1a5c('0x3f')]?_0x52bdaa[_0x1a5c('0x3d')]:_0xdee818[_0x1a5c('0x38')];if(!_0x511ba6[_0x1a5c('0x3a')][_0x1a5c('0x40')]('nolimit')){_0x52bdaa[_0x1a5c('0x28')]=qs[_0x1a5c('0x28')](_0x511ba6[_0x1a5c('0x3a')][_0x1a5c('0x28')]);_0x52bdaa['offset']=qs[_0x1a5c('0x25')](_0x511ba6[_0x1a5c('0x3a')][_0x1a5c('0x25')]);}_0x52bdaa[_0x1a5c('0x41')]=qs[_0x1a5c('0x42')](_0x511ba6[_0x1a5c('0x3a')][_0x1a5c('0x42')]);_0x52bdaa[_0x1a5c('0x43')]=qs['filters'](_['pick'](_0x511ba6[_0x1a5c('0x3a')],_0xdee818['filters']),_0x4495d3);if(_0x511ba6['query'][_0x1a5c('0x44')]){_0x52bdaa['where']=_[_0x1a5c('0x45')](_0x52bdaa[_0x1a5c('0x43')],{'$or':_[_0x1a5c('0x33')](_0x4495d3,function(_0x137966){if(_0x137966[_0x1a5c('0x37')]!==_0x1a5c('0x46')){var _0x3c5191={};_0x3c5191[_0x137966[_0x1a5c('0x31')]]={'$like':'%'+_0x511ba6[_0x1a5c('0x3a')][_0x1a5c('0x44')]+'%'};return _0x3c5191;}})});}_0x52bdaa=_[_0x1a5c('0x45')]({},_0x52bdaa,_0x511ba6[_0x1a5c('0x47')]);var _0x4cb95b={'where':_0x52bdaa[_0x1a5c('0x43')]};return db[_0x1a5c('0x34')][_0x1a5c('0x27')](_0x4cb95b)['then'](function(_0x35864a){_0x5e2541[_0x1a5c('0x27')]=_0x35864a;if(_0x511ba6[_0x1a5c('0x3a')][_0x1a5c('0x48')]){_0x52bdaa[_0x1a5c('0x49')]=[{'all':!![]}];}return db[_0x1a5c('0x34')][_0x1a5c('0x4a')](_0x52bdaa);})['then'](function(_0xfbe84a){_0x5e2541['rows']=_0xfbe84a;return _0x5e2541;})['then'](respondWithFilteredResult(_0x309608,_0x52bdaa))[_0x1a5c('0x4b')](handleError(_0x309608,null));};exports[_0x1a5c('0x4c')]=function(_0x5bf285,_0x5557cc){var _0x46ac5e={'raw':![],'where':{'id':_0x5bf285[_0x1a5c('0x4d')]['id']}},_0x164818={};_0x164818['model']=_['keys'](db['VoiceContext'][_0x1a5c('0x35')]);_0x164818[_0x1a5c('0x3a')]=_['keys'](_0x5bf285[_0x1a5c('0x3a')]);_0x164818[_0x1a5c('0x3b')]=_['intersection'](_0x164818[_0x1a5c('0x38')],_0x164818[_0x1a5c('0x3a')]);_0x46ac5e[_0x1a5c('0x3d')]=_[_0x1a5c('0x3c')](_0x164818['model'],qs['fields'](_0x5bf285['query']['fields']));_0x46ac5e[_0x1a5c('0x3d')]=_0x46ac5e[_0x1a5c('0x3d')][_0x1a5c('0x3f')]?_0x46ac5e[_0x1a5c('0x3d')]:_0x164818['model'];if(_0x5bf285[_0x1a5c('0x3a')]['includeAll']){_0x46ac5e[_0x1a5c('0x49')]=[{'all':!![]}];}_0x46ac5e=_[_0x1a5c('0x45')]({},_0x46ac5e,_0x5bf285[_0x1a5c('0x47')]);return db['VoiceContext'][_0x1a5c('0x4e')](_0x46ac5e)['then'](handleEntityNotFound(_0x5557cc,null))[_0x1a5c('0x19')](respondWithResult(_0x5557cc,null))[_0x1a5c('0x4b')](handleError(_0x5557cc,null));};exports['create']=function(_0x15e0a2,_0x271c30,_0x750718){var _0x1cc1c7;return db[_0x1a5c('0x34')][_0x1a5c('0x4f')](_0x15e0a2[_0x1a5c('0x50')],{'raw':!![]})[_0x1a5c('0x19')](function(_0x2acf16){_0x1cc1c7=_0x2acf16;return db[_0x1a5c('0x34')][_0x1a5c('0x4a')]({'raw':!![]});})['then'](function(_0x21bbd3){var _0x447582=fs[_0x1a5c('0x51')](path[_0x1a5c('0x52')](config[_0x1a5c('0x53')],_0x1a5c('0x54')),_0x1a5c('0x55'));var _0x598b8f=ejs[_0x1a5c('0x56')](_0x447582,{'contexts':_0x21bbd3||[]});fs[_0x1a5c('0x57')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x598b8f);})[_0x1a5c('0x19')](function(){return respondWithRpcPromise(_0x1a5c('0x58'),_0x1a5c('0x4f'),{'module':'chan_sip.so'});})[_0x1a5c('0x19')](function(){var _0x436cc8=_0x15e0a2[_0x1a5c('0x59')][_0x1a5c('0x2c')]({'plain':!![]});if(!_0x436cc8)throw new Error(_0x1a5c('0x5a'));if(_0x436cc8[_0x1a5c('0x5b')]===_0x1a5c('0x59')){var _0x585d66=_0x1cc1c7[_0x1a5c('0x2c')]({'plain':!![]});return db[_0x1a5c('0x5c')][_0x1a5c('0x4e')]({'where':{'name':_0x1a5c('0x2d'),'userProfileId':_0x436cc8[_0x1a5c('0x5d')]},'raw':!![]})[_0x1a5c('0x19')](function(_0x505e0d){if(_0x505e0d&&_0x505e0d[_0x1a5c('0x5e')]===0x0){return db[_0x1a5c('0x2e')]['create']({'name':_0x585d66['name'],'resourceId':_0x585d66['id'],'type':_0x505e0d[_0x1a5c('0x31')],'sectionId':_0x505e0d['id']},{})[_0x1a5c('0x19')](function(){return _0x1cc1c7;});}else{return _0x1cc1c7;}})[_0x1a5c('0x4b')](function(_0xb6a9a9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb6a9a9);throw _0xb6a9a9;});}return _0x1cc1c7;})['then'](respondWithResult(_0x271c30,0xc9))[_0x1a5c('0x4b')](handleError(_0x271c30,null));};exports[_0x1a5c('0x5f')]=function(_0x3fa7e5,_0x1e12cc,_0x32e03a){var _0x2242e0;return db[_0x1a5c('0x34')][_0x1a5c('0x4e')]({'where':{'id':_0x3fa7e5[_0x1a5c('0x4d')]['id']}})[_0x1a5c('0x19')](handleEntityNotFound(_0x1e12cc,null))[_0x1a5c('0x19')](saveUpdates(_0x3fa7e5[_0x1a5c('0x50')],null))['then'](function(_0x310f0a){if(_0x310f0a){_0x2242e0=_0x310f0a;return db[_0x1a5c('0x34')][_0x1a5c('0x4a')]({'raw':!![]});}})[_0x1a5c('0x19')](function(_0x52efca){var _0x24e650=fs[_0x1a5c('0x51')](path[_0x1a5c('0x52')](config['root'],_0x1a5c('0x54')),_0x1a5c('0x55'));var _0x5af2aa=ejs[_0x1a5c('0x56')](_0x24e650,{'contexts':_0x52efca||[]});fs[_0x1a5c('0x57')](_0x1a5c('0x60'),_0x5af2aa);})[_0x1a5c('0x19')](function(){return respondWithRpcPromise(_0x1a5c('0x58'),_0x1a5c('0x5f'),{'module':'chan_sip.so'});})[_0x1a5c('0x19')](function(){return _0x2242e0;})[_0x1a5c('0x19')](respondWithResult(_0x1e12cc,null))[_0x1a5c('0x4b')](handleError(_0x1e12cc,null));};exports[_0x1a5c('0x2f')]=function(_0x215fa4,_0x1bc42f,_0x27bb0d){var _0x17513c;return db['VoiceContext']['find']({'where':{'id':_0x215fa4[_0x1a5c('0x4d')]['id']}})[_0x1a5c('0x19')](handleEntityNotFound(_0x1bc42f,null))[_0x1a5c('0x19')](removeEntity(_0x1bc42f,null))[_0x1a5c('0x19')](function(){return db['VoiceContext'][_0x1a5c('0x4a')]({'raw':!![]});})[_0x1a5c('0x19')](function(_0x5167b1){var _0x5b9e1b=fs['readFileSync'](path[_0x1a5c('0x52')](config[_0x1a5c('0x53')],'server/files/templates/context.ejs'),'utf8');var _0x356b69=ejs[_0x1a5c('0x56')](_0x5b9e1b,{'contexts':_0x5167b1});fs[_0x1a5c('0x57')](_0x1a5c('0x60'),_0x356b69);return respondWithRpcPromise('Reload','destroy',{'module':_0x1a5c('0x61')});})[_0x1a5c('0x4b')](handleError(_0x1bc42f,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 3c05815..82e8ed2 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 _0x5413=['api','bluebird','request-promise','path','rimraf','./voiceContext.attributes','define','voice_contexts','util','../../config/logger'];(function(_0x17c286,_0x584afc){var _0x4b155e=function(_0x2a864b){while(--_0x2a864b){_0x17c286['push'](_0x17c286['shift']());}};_0x4b155e(++_0x584afc);}(_0x5413,0x1c0));var _0x3541=function(_0x5ab900,_0x25fedf){_0x5ab900=_0x5ab900-0x0;var _0x28ac29=_0x5413[_0x5ab900];return _0x28ac29;};'use strict';var _=require('lodash');var util=require(_0x3541('0x0'));var logger=require(_0x3541('0x1'))(_0x3541('0x2'));var moment=require('moment');var BPromise=require(_0x3541('0x3'));var rp=require(_0x3541('0x4'));var fs=require('fs');var path=require(_0x3541('0x5'));var rimraf=require(_0x3541('0x6'));var config=require('../../config/environment');var attributes=require(_0x3541('0x7'));module['exports']=function(_0x26bdbc,_0x31e6e7){return _0x26bdbc[_0x3541('0x8')]('VoiceContext',attributes,{'tableName':_0x3541('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacfe=['rimraf','../../config/environment','exports','define','VoiceContext','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xacfe,0x123));var _0xeacf=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xacfe[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xeacf('0x0'));var util=require(_0xeacf('0x1'));var logger=require(_0xeacf('0x2'))(_0xeacf('0x3'));var moment=require(_0xeacf('0x4'));var BPromise=require('bluebird');var rp=require(_0xeacf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeacf('0x6'));var config=require(_0xeacf('0x7'));var attributes=require('./voiceContext.attributes');module[_0xeacf('0x8')]=function(_0x3a3f44,_0x414b9d){return _0x3a3f44[_0xeacf('0x9')](_0xeacf('0xa'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 44db0d5..15fa659 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 _0x93ec=['lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4a144c,_0x5c847c){var _0x17f0fc=function(_0x45b166){while(--_0x45b166){_0x4a144c['push'](_0x4a144c['shift']());}};_0x17f0fc(++_0x5c847c);}(_0x93ec,0x78));var _0xc93e=function(_0x314079,_0x2b98a0){_0x314079=_0x314079-0x0;var _0x423351=_0x93ec[_0x314079];return _0x423351;};'use strict';var _=require(_0xc93e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc93e('0x1'));var db=require(_0xc93e('0x2'))['db'];var utils=require(_0xc93e('0x3'));var logger=require(_0xc93e('0x4'))('rpc');var config=require(_0xc93e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xc93e('0x6')][_0xc93e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e35f9,_0xc0bccf,_0x5a41c1){return new BPromise(function(_0x51a44a,_0x476e14){return client[_0xc93e('0x8')](_0x4e35f9,_0x5a41c1)['then'](function(_0x5cc447){logger[_0xc93e('0x9')](_0xc93e('0xa'),_0xc0bccf,_0xc93e('0xb'));logger[_0xc93e('0xc')](_0xc93e('0xd'),_0xc0bccf,_0xc93e('0xb'),JSON[_0xc93e('0xe')](_0x5cc447));if(_0x5cc447[_0xc93e('0xf')]){if(_0x5cc447[_0xc93e('0xf')][_0xc93e('0x10')]===0x1f4){logger[_0xc93e('0xf')](_0xc93e('0xa'),_0xc0bccf,_0x5cc447['error'][_0xc93e('0x11')]);return _0x476e14(_0x5cc447[_0xc93e('0xf')][_0xc93e('0x11')]);}logger[_0xc93e('0xf')](_0xc93e('0xa'),_0xc0bccf,_0x5cc447[_0xc93e('0xf')][_0xc93e('0x11')]);return _0x51a44a(_0x5cc447[_0xc93e('0xf')][_0xc93e('0x11')]);}else{logger[_0xc93e('0x9')](_0xc93e('0xa'),_0xc0bccf,_0xc93e('0xb'));_0x51a44a(_0x5cc447[_0xc93e('0x12')][_0xc93e('0x11')]);}})[_0xc93e('0x13')](function(_0x236d8e){logger['error'](_0xc93e('0xa'),_0xc0bccf,_0x236d8e);_0x476e14(_0x236d8e);});});} \ No newline at end of file +var _0x9910=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util'];(function(_0x311825,_0x40d25f){var _0x178115=function(_0x42b995){while(--_0x42b995){_0x311825['push'](_0x311825['shift']());}};_0x178115(++_0x40d25f);}(_0x9910,0xfa));var _0x0991=function(_0x1f446d,_0x8a6599){_0x1f446d=_0x1f446d-0x0;var _0x4bd3e9=_0x9910[_0x1f446d];return _0x4bd3e9;};'use strict';var _=require(_0x0991('0x0'));var util=require(_0x0991('0x1'));var moment=require(_0x0991('0x2'));var BPromise=require(_0x0991('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0991('0x4'));var db=require(_0x0991('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0991('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0991('0x7'));var client=jayson[_0x0991('0x8')][_0x0991('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d0545,_0x24a994,_0x52177d){return new BPromise(function(_0x31d70f,_0x3910e2){return client['request'](_0x5d0545,_0x52177d)[_0x0991('0xa')](function(_0x25d041){logger['info'](_0x0991('0xb'),_0x24a994,'request\x20sent');logger[_0x0991('0xc')](_0x0991('0xd'),_0x24a994,_0x0991('0xe'),JSON[_0x0991('0xf')](_0x25d041));if(_0x25d041[_0x0991('0x10')]){if(_0x25d041[_0x0991('0x10')][_0x0991('0x11')]===0x1f4){logger[_0x0991('0x10')]('VoiceContext,\x20%s,\x20%s',_0x24a994,_0x25d041[_0x0991('0x10')]['message']);return _0x3910e2(_0x25d041['error'][_0x0991('0x12')]);}logger[_0x0991('0x10')](_0x0991('0xb'),_0x24a994,_0x25d041['error']['message']);return _0x31d70f(_0x25d041[_0x0991('0x10')][_0x0991('0x12')]);}else{logger[_0x0991('0x13')](_0x0991('0xb'),_0x24a994,_0x0991('0xe'));_0x31d70f(_0x25d041['result'][_0x0991('0x12')]);}})[_0x0991('0x14')](function(_0x5178db){logger[_0x0991('0x10')](_0x0991('0xb'),_0x24a994,_0x5178db);_0x3910e2(_0x5178db);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index f08ac18..989baf4 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 _0xc6d8=['path','express','fs-extra','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','exports','multer'];(function(_0x21f027,_0x5d77ff){var _0x15f215=function(_0x182edf){while(--_0x182edf){_0x21f027['push'](_0x21f027['shift']());}};_0x15f215(++_0x5d77ff);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x20dda3,_0xfcb775){_0x20dda3=_0x20dda3-0x0;var _0x547b71=_0xc6d8[_0x20dda3];return _0x547b71;};'use strict';var multer=require(_0x8c6d('0x0'));var util=require('util');var path=require(_0x8c6d('0x1'));var timeout=require('connect-timeout');var express=require(_0x8c6d('0x2'));var router=express['Router']();var fs_extra=require(_0x8c6d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8c6d('0x4'));var controller=require(_0x8c6d('0x5'));router[_0x8c6d('0x6')]('/',auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x8')]);router[_0x8c6d('0x6')](_0x8c6d('0x9'),auth['isAuthenticated'](),controller[_0x8c6d('0xa')]);router[_0x8c6d('0x6')](_0x8c6d('0xb'),auth['isAuthenticated'](),controller[_0x8c6d('0xc')]);router[_0x8c6d('0xd')]('/',auth[_0x8c6d('0x7')](),controller[_0x8c6d('0xe')]);router[_0x8c6d('0xf')](_0x8c6d('0xb'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x10')]);router['delete'](_0x8c6d('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x8c6d('0x11')]=router; \ No newline at end of file +var _0xb458=['./voiceDialReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','put','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x23945f,_0x9d3e4e){var _0xa38592=function(_0x406b83){while(--_0x406b83){_0x23945f['push'](_0x23945f['shift']());}};_0xa38592(++_0x9d3e4e);}(_0xb458,0x103));var _0x8b45=function(_0x3c9c06,_0x4e0395){_0x3c9c06=_0x3c9c06-0x0;var _0x32cd7d=_0xb458[_0x3c9c06];return _0x32cd7d;};'use strict';var multer=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8b45('0x3')]();var fs_extra=require(_0x8b45('0x4'));var auth=require(_0x8b45('0x5'));var interaction=require(_0x8b45('0x6'));var config=require('../../config/environment');var controller=require(_0x8b45('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x8b45('0x8')]);router[_0x8b45('0x9')](_0x8b45('0xa'),auth[_0x8b45('0xb')](),controller[_0x8b45('0xc')]);router['get'](_0x8b45('0xd'),auth[_0x8b45('0xb')](),controller[_0x8b45('0xe')]);router[_0x8b45('0xf')]('/',auth[_0x8b45('0xb')](),controller['create']);router[_0x8b45('0x10')](_0x8b45('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8b45('0xb')](),controller[_0x8b45('0x11')]);module[_0x8b45('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index c899acf..e4abf6b 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 _0xccd4=['exports','STRING','INTEGER','DATE'];(function(_0x952f37,_0x420274){var _0x3294cf=function(_0x5c93c2){while(--_0x5c93c2){_0x952f37['push'](_0x952f37['shift']());}};_0x3294cf(++_0x420274);}(_0xccd4,0xbc));var _0x4ccd=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xccd4[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require('sequelize');module[_0x4ccd('0x0')]={'privilege':{'type':Sequelize[_0x4ccd('0x1')]},'channel':{'type':Sequelize[_0x4ccd('0x1')]},'channelstate':{'type':Sequelize[_0x4ccd('0x2')]},'channelstatedesc':{'type':Sequelize[_0x4ccd('0x1')]},'calleridnum':{'type':Sequelize[_0x4ccd('0x1')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4ccd('0x1')]},'connectedlinename':{'type':Sequelize[_0x4ccd('0x1')]},'language':{'type':Sequelize[_0x4ccd('0x1')]},'accountcode':{'type':Sequelize[_0x4ccd('0x1')]},'context':{'type':Sequelize[_0x4ccd('0x1')]},'exten':{'type':Sequelize[_0x4ccd('0x1')]},'priority':{'type':Sequelize[_0x4ccd('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x4ccd('0x1')]},'destchannel':{'type':Sequelize[_0x4ccd('0x1')]},'destchannelstate':{'type':Sequelize[_0x4ccd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x4ccd('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x4ccd('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x4ccd('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x4ccd('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x4ccd('0x1')]},'destcontext':{'type':Sequelize[_0x4ccd('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x4ccd('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x4ccd('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x4ccd('0x1')]},'starttime':{'type':Sequelize[_0x4ccd('0x3')]},'answertime':{'type':Sequelize[_0x4ccd('0x3')]},'endtime':{'type':Sequelize[_0x4ccd('0x3')]},'lastevent':{'type':Sequelize[_0x4ccd('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x4ccd('0x2')]},'holdtime':{'type':Sequelize[_0x4ccd('0x2')]},'billableseconds':{'type':Sequelize[_0x4ccd('0x2')]}}; \ No newline at end of file +var _0x8331=['exports','STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x11c24c,_0x6514){var _0x398ccc=function(_0x46d538){while(--_0x46d538){_0x11c24c['push'](_0x11c24c['shift']());}};_0x398ccc(++_0x6514);}(_0x8331,0xe9));var _0x1833=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0x8331[_0x3aaf0a];return _0x33e6bc;};'use strict';var Sequelize=require(_0x1833('0x0'));module[_0x1833('0x1')]={'privilege':{'type':Sequelize[_0x1833('0x2')]},'channel':{'type':Sequelize[_0x1833('0x2')]},'channelstate':{'type':Sequelize[_0x1833('0x3')]},'channelstatedesc':{'type':Sequelize[_0x1833('0x2')]},'calleridnum':{'type':Sequelize[_0x1833('0x2')]},'calleridname':{'type':Sequelize[_0x1833('0x2')]},'connectedlinenum':{'type':Sequelize[_0x1833('0x2')]},'connectedlinename':{'type':Sequelize[_0x1833('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1833('0x2')]},'exten':{'type':Sequelize[_0x1833('0x2')]},'priority':{'type':Sequelize[_0x1833('0x3')]},'uniqueid':{'type':Sequelize[_0x1833('0x2')]},'linkedid':{'type':Sequelize[_0x1833('0x2')]},'destchannel':{'type':Sequelize[_0x1833('0x2')]},'destchannelstate':{'type':Sequelize[_0x1833('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x1833('0x2')]},'destcalleridname':{'type':Sequelize[_0x1833('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x1833('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x1833('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x1833('0x2')]},'destexten':{'type':Sequelize[_0x1833('0x2')]},'destpriority':{'type':Sequelize[_0x1833('0x3')]},'destuniqueid':{'type':Sequelize[_0x1833('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x1833('0x2')]},'dialstatus':{'type':Sequelize[_0x1833('0x2')]},'starttime':{'type':Sequelize[_0x1833('0x4')]},'answertime':{'type':Sequelize[_0x1833('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x1833('0x2')],'comment':_0x1833('0x5')},'routeId':{'type':Sequelize[_0x1833('0x3')]},'duration':{'type':Sequelize[_0x1833('0x3')]},'holdtime':{'type':Sequelize[_0x1833('0x3')]},'billableseconds':{'type':Sequelize[_0x1833('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index cf3f900..add60f5 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 _0x0e3c=['order','sort','filter','where','merge','options','VoiceDialReport','rows','show','keys','intersection','includeAll','include','find','catch','body','params','describe','zip-dir','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x11a796,_0x11a8f2){var _0x5a1439=function(_0x348778){while(--_0x348778){_0x11a796['push'](_0x11a796['shift']());}};_0x5a1439(++_0x11a8f2);}(_0x0e3c,0x175));var _0xc0e3=function(_0x4dda6b,_0x369e5f){_0x4dda6b=_0x4dda6b-0x0;var _0x1310e0=_0x0e3c[_0x4dda6b];return _0x1310e0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc0e3('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc0e3('0x1'));var moment=require('moment');var BPromise=require(_0xc0e3('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc0e3('0x3'));var sox=require(_0xc0e3('0x4'));var csv=require('to-csv');var ejs=require(_0xc0e3('0x5'));var fs=require('fs');var fs_extra=require(_0xc0e3('0x6'));var _=require(_0xc0e3('0x7'));var squel=require(_0xc0e3('0x8'));var crypto=require('crypto');var jsforce=require(_0xc0e3('0x9'));var deskjs=require(_0xc0e3('0xa'));var toCsv=require(_0xc0e3('0xb'));var querystring=require(_0xc0e3('0xc'));var Papa=require(_0xc0e3('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc0e3('0xe'));var as=require(_0xc0e3('0xf'));var hardwareService=require(_0xc0e3('0x10'));var logger=require(_0xc0e3('0x11'))(_0xc0e3('0x12'));var utils=require(_0xc0e3('0x13'));var config=require(_0xc0e3('0x14'));var licenseUtil=require(_0xc0e3('0x15'));var db=require(_0xc0e3('0x16'))['db'];function respondWithStatusCode(_0xfa095d,_0x29a5de){_0x29a5de=_0x29a5de||0xcc;return function(_0x25f155){if(_0x25f155){return _0xfa095d['sendStatus'](_0x29a5de);}return _0xfa095d[_0xc0e3('0x17')](_0x29a5de)[_0xc0e3('0x18')]();};}function respondWithResult(_0xd1e8bc,_0x500d70){_0x500d70=_0x500d70||0xc8;return function(_0x3a3813){if(_0x3a3813){return _0xd1e8bc['status'](_0x500d70)['json'](_0x3a3813);}};}function respondWithFilteredResult(_0x53ed98,_0x12e7a0){return function(_0x2bd312){if(_0x2bd312){var _0x59e8ef=typeof _0x12e7a0[_0xc0e3('0x19')]===_0xc0e3('0x1a')&&typeof _0x12e7a0[_0xc0e3('0x1b')]==='undefined';var _0x5aad90=_0x2bd312[_0xc0e3('0x1c')];var _0x17f99a=_0x59e8ef?0x0:_0x12e7a0[_0xc0e3('0x19')];var _0x8d45b5=_0x59e8ef?_0x2bd312[_0xc0e3('0x1c')]:_0x12e7a0['offset']+_0x12e7a0[_0xc0e3('0x1b')];var _0x61ffc8;if(_0x8d45b5>=_0x5aad90){_0x8d45b5=_0x5aad90;_0x61ffc8=0xc8;}else{_0x61ffc8=0xce;}_0x53ed98['status'](_0x61ffc8);return _0x53ed98['set']('Content-Range',_0x17f99a+'-'+_0x8d45b5+'/'+_0x5aad90)[_0xc0e3('0x1d')](_0x2bd312);}return null;};}function patchUpdates(_0x22ef51){return function(_0x4c5392){try{jsonpatch[_0xc0e3('0x1e')](_0x4c5392,_0x22ef51,!![]);}catch(_0x21d295){return BPromise[_0xc0e3('0x1f')](_0x21d295);}return _0x4c5392[_0xc0e3('0x20')]();};}function saveUpdates(_0x63aa3b,_0x22991a){return function(_0x272f89){if(_0x272f89){return _0x272f89[_0xc0e3('0x21')](_0x63aa3b)[_0xc0e3('0x22')](function(_0x1e2c14){return _0x1e2c14;});}return null;};}function removeEntity(_0x4c41c2,_0x2d7bd5){return function(_0x3da469){if(_0x3da469){return _0x3da469[_0xc0e3('0x23')]()[_0xc0e3('0x22')](function(){_0x4c41c2[_0xc0e3('0x17')](0xcc)[_0xc0e3('0x18')]();});}};}function handleEntityNotFound(_0x164152,_0x230ef7){return function(_0x149916){if(!_0x149916){_0x164152['sendStatus'](0x194);}return _0x149916;};}function handleError(_0x2ba7df,_0x3229bf){_0x3229bf=_0x3229bf||0x1f4;return function(_0xac2c7a){logger['error'](_0xac2c7a[_0xc0e3('0x24')]);if(_0xac2c7a[_0xc0e3('0x25')]){delete _0xac2c7a[_0xc0e3('0x25')];}_0x2ba7df[_0xc0e3('0x17')](_0x3229bf)[_0xc0e3('0x26')](_0xac2c7a);};}exports[_0xc0e3('0x27')]=function(_0x807a5,_0x23b96a){var _0x236871={},_0x26281b={},_0x15ced9={'count':0x0,'rows':[]};var _0x1c99fd=_[_0xc0e3('0x28')](db['VoiceDialReport'][_0xc0e3('0x29')],function(_0x26e5cb){return{'name':_0x26e5cb[_0xc0e3('0x2a')],'type':_0x26e5cb[_0xc0e3('0x2b')][_0xc0e3('0x2c')]};});_0x26281b[_0xc0e3('0x2d')]=_[_0xc0e3('0x28')](_0x1c99fd,_0xc0e3('0x25'));_0x26281b[_0xc0e3('0x2e')]=_['keys'](_0x807a5['query']);_0x26281b[_0xc0e3('0x2f')]=_['intersection'](_0x26281b[_0xc0e3('0x2d')],_0x26281b[_0xc0e3('0x2e')]);_0x236871[_0xc0e3('0x30')]=_['intersection'](_0x26281b[_0xc0e3('0x2d')],qs[_0xc0e3('0x31')](_0x807a5[_0xc0e3('0x2e')][_0xc0e3('0x31')]));_0x236871[_0xc0e3('0x30')]=_0x236871['attributes'][_0xc0e3('0x32')]?_0x236871[_0xc0e3('0x30')]:_0x26281b['model'];if(!_0x807a5[_0xc0e3('0x2e')][_0xc0e3('0x33')](_0xc0e3('0x34'))){_0x236871[_0xc0e3('0x1b')]=qs['limit'](_0x807a5[_0xc0e3('0x2e')][_0xc0e3('0x1b')]);_0x236871[_0xc0e3('0x19')]=qs[_0xc0e3('0x19')](_0x807a5['query'][_0xc0e3('0x19')]);}_0x236871[_0xc0e3('0x35')]=qs[_0xc0e3('0x36')](_0x807a5[_0xc0e3('0x2e')]['sort']);_0x236871['where']=qs[_0xc0e3('0x2f')](_['pick'](_0x807a5[_0xc0e3('0x2e')],_0x26281b['filters']),_0x1c99fd);if(_0x807a5[_0xc0e3('0x2e')][_0xc0e3('0x37')]){_0x236871[_0xc0e3('0x38')]=_[_0xc0e3('0x39')](_0x236871[_0xc0e3('0x38')],{'$or':_[_0xc0e3('0x28')](_0x1c99fd,function(_0x224eb1){if(_0x224eb1[_0xc0e3('0x2b')]!=='VIRTUAL'){var _0x2c6e75={};_0x2c6e75[_0x224eb1[_0xc0e3('0x25')]]={'$like':'%'+_0x807a5[_0xc0e3('0x2e')][_0xc0e3('0x37')]+'%'};return _0x2c6e75;}})});}_0x236871=_[_0xc0e3('0x39')]({},_0x236871,_0x807a5[_0xc0e3('0x3a')]);var _0x40c4cf={'where':_0x236871[_0xc0e3('0x38')]};return db[_0xc0e3('0x3b')][_0xc0e3('0x1c')](_0x40c4cf)['then'](function(_0x43f5e9){_0x15ced9['count']=_0x43f5e9;if(_0x807a5[_0xc0e3('0x2e')]['includeAll']){_0x236871['include']=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x236871);})[_0xc0e3('0x22')](function(_0x17690e){_0x15ced9[_0xc0e3('0x3c')]=_0x17690e;return _0x15ced9;})[_0xc0e3('0x22')](respondWithFilteredResult(_0x23b96a,_0x236871))['catch'](handleError(_0x23b96a,null));};exports[_0xc0e3('0x3d')]=function(_0x4bb3e3,_0x242f6f){var _0x807f18={'raw':!![],'where':{'id':_0x4bb3e3['params']['id']}},_0x2bbe8b={};_0x2bbe8b['model']=_['keys'](db['VoiceDialReport'][_0xc0e3('0x29')]);_0x2bbe8b[_0xc0e3('0x2e')]=_[_0xc0e3('0x3e')](_0x4bb3e3[_0xc0e3('0x2e')]);_0x2bbe8b[_0xc0e3('0x2f')]=_[_0xc0e3('0x3f')](_0x2bbe8b[_0xc0e3('0x2d')],_0x2bbe8b[_0xc0e3('0x2e')]);_0x807f18[_0xc0e3('0x30')]=_[_0xc0e3('0x3f')](_0x2bbe8b[_0xc0e3('0x2d')],qs[_0xc0e3('0x31')](_0x4bb3e3[_0xc0e3('0x2e')][_0xc0e3('0x31')]));_0x807f18[_0xc0e3('0x30')]=_0x807f18[_0xc0e3('0x30')][_0xc0e3('0x32')]?_0x807f18[_0xc0e3('0x30')]:_0x2bbe8b[_0xc0e3('0x2d')];if(_0x4bb3e3[_0xc0e3('0x2e')][_0xc0e3('0x40')]){_0x807f18[_0xc0e3('0x41')]=[{'all':!![]}];}_0x807f18=_['merge']({},_0x807f18,_0x4bb3e3[_0xc0e3('0x3a')]);return db[_0xc0e3('0x3b')][_0xc0e3('0x42')](_0x807f18)['then'](handleEntityNotFound(_0x242f6f,null))[_0xc0e3('0x22')](respondWithResult(_0x242f6f,null))[_0xc0e3('0x43')](handleError(_0x242f6f,null));};exports['create']=function(_0x49ce17,_0x2a5c07){return db[_0xc0e3('0x3b')]['create'](_0x49ce17['body'],{})[_0xc0e3('0x22')](respondWithResult(_0x2a5c07,0xc9))[_0xc0e3('0x43')](handleError(_0x2a5c07,null));};exports[_0xc0e3('0x21')]=function(_0x5cbb29,_0x5efa82){if(_0x5cbb29[_0xc0e3('0x44')]['id']){delete _0x5cbb29[_0xc0e3('0x44')]['id'];}return db[_0xc0e3('0x3b')]['find']({'where':{'id':_0x5cbb29[_0xc0e3('0x45')]['id']}})[_0xc0e3('0x22')](handleEntityNotFound(_0x5efa82,null))[_0xc0e3('0x22')](saveUpdates(_0x5cbb29['body'],null))[_0xc0e3('0x22')](respondWithResult(_0x5efa82,null))[_0xc0e3('0x43')](handleError(_0x5efa82,null));};exports[_0xc0e3('0x23')]=function(_0x413521,_0x33870d){return db[_0xc0e3('0x3b')]['find']({'where':{'id':_0x413521[_0xc0e3('0x45')]['id']}})[_0xc0e3('0x22')](handleEntityNotFound(_0x33870d,null))['then'](removeEntity(_0x33870d,null))[_0xc0e3('0x43')](handleError(_0x33870d,null));};exports[_0xc0e3('0x46')]=function(_0xbf69ef,_0x3c9df4){return db[_0xc0e3('0x3b')]['describe']()[_0xc0e3('0x22')](respondWithResult(_0x3c9df4,null))[_0xc0e3('0x43')](handleError(_0x3c9df4,null));}; \ No newline at end of file +var _0xbbe0=['merge','VIRTUAL','includeAll','include','findAll','then','show','params','keys','rawAttributes','options','find','create','body','catch','update','describe','eml-format','rimraf','fast-json-patch','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','destroy','sendStatus','stack','name','send','index','VoiceDialReport','type','key','model','map','filters','query','attributes','intersection','fields','length','nolimit','order','sort','filter','where'];(function(_0x1da572,_0x215d8f){var _0x2a94bc=function(_0x2e03fc){while(--_0x2e03fc){_0x1da572['push'](_0x1da572['shift']());}};_0x2a94bc(++_0x215d8f);}(_0xbbe0,0x1b5));var _0x0bbe=function(_0x7fe816,_0x38b3d8){_0x7fe816=_0x7fe816-0x0;var _0x1a27d8=_0xbbe0[_0x7fe816];return _0x1a27d8;};'use strict';var emlformat=require(_0x0bbe('0x0'));var rimraf=require(_0x0bbe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0bbe('0x2'));var rp=require('request-promise');var moment=require(_0x0bbe('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0bbe('0x4'));var util=require(_0x0bbe('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x0bbe('0x6'));var ejs=require(_0x0bbe('0x7'));var fs=require('fs');var fs_extra=require(_0x0bbe('0x8'));var _=require(_0x0bbe('0x9'));var squel=require(_0x0bbe('0xa'));var crypto=require(_0x0bbe('0xb'));var jsforce=require(_0x0bbe('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0bbe('0x6'));var querystring=require('querystring');var Papa=require(_0x0bbe('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0bbe('0xe'));var as=require(_0x0bbe('0xf'));var hardwareService=require(_0x0bbe('0x10'));var logger=require(_0x0bbe('0x11'))(_0x0bbe('0x12'));var utils=require(_0x0bbe('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0bbe('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x410b52,_0x453202){_0x453202=_0x453202||0xcc;return function(_0x1dc3c5){if(_0x1dc3c5){return _0x410b52['sendStatus'](_0x453202);}return _0x410b52[_0x0bbe('0x15')](_0x453202)[_0x0bbe('0x16')]();};}function respondWithResult(_0x3627e4,_0x54af67){_0x54af67=_0x54af67||0xc8;return function(_0x2f4449){if(_0x2f4449){return _0x3627e4[_0x0bbe('0x15')](_0x54af67)['json'](_0x2f4449);}};}function respondWithFilteredResult(_0x514f92,_0x1fa031){return function(_0x147d4f){if(_0x147d4f){var _0x1a223d=typeof _0x1fa031[_0x0bbe('0x17')]===_0x0bbe('0x18')&&typeof _0x1fa031[_0x0bbe('0x19')]==='undefined';var _0x418945=_0x147d4f[_0x0bbe('0x1a')];var _0x376364=_0x1a223d?0x0:_0x1fa031[_0x0bbe('0x17')];var _0x38a045=_0x1a223d?_0x147d4f['count']:_0x1fa031[_0x0bbe('0x17')]+_0x1fa031[_0x0bbe('0x19')];var _0x3ab56f;if(_0x38a045>=_0x418945){_0x38a045=_0x418945;_0x3ab56f=0xc8;}else{_0x3ab56f=0xce;}_0x514f92[_0x0bbe('0x15')](_0x3ab56f);return _0x514f92[_0x0bbe('0x1b')](_0x0bbe('0x1c'),_0x376364+'-'+_0x38a045+'/'+_0x418945)[_0x0bbe('0x1d')](_0x147d4f);}return null;};}function patchUpdates(_0x5135c1){return function(_0x498ce9){try{jsonpatch['apply'](_0x498ce9,_0x5135c1,!![]);}catch(_0x458061){return BPromise[_0x0bbe('0x1e')](_0x458061);}return _0x498ce9['save']();};}function saveUpdates(_0x2975fb,_0x437adc){return function(_0x3fccfd){if(_0x3fccfd){return _0x3fccfd['update'](_0x2975fb)['then'](function(_0x116b3f){return _0x116b3f;});}return null;};}function removeEntity(_0x4836aa,_0x2dd872){return function(_0x154231){if(_0x154231){return _0x154231[_0x0bbe('0x1f')]()['then'](function(){_0x4836aa[_0x0bbe('0x15')](0xcc)[_0x0bbe('0x16')]();});}};}function handleEntityNotFound(_0x3fc17b,_0x525e16){return function(_0x2cfd3c){if(!_0x2cfd3c){_0x3fc17b[_0x0bbe('0x20')](0x194);}return _0x2cfd3c;};}function handleError(_0x771cc7,_0xe879e){_0xe879e=_0xe879e||0x1f4;return function(_0x22e0c3){logger['error'](_0x22e0c3[_0x0bbe('0x21')]);if(_0x22e0c3[_0x0bbe('0x22')]){delete _0x22e0c3[_0x0bbe('0x22')];}_0x771cc7[_0x0bbe('0x15')](_0xe879e)[_0x0bbe('0x23')](_0x22e0c3);};}exports[_0x0bbe('0x24')]=function(_0xf19aa8,_0x293343){var _0x5e1294={},_0x30357f={},_0x72784f={'count':0x0,'rows':[]};var _0x211095=_['map'](db[_0x0bbe('0x25')]['rawAttributes'],function(_0x27e9e5){return{'name':_0x27e9e5['fieldName'],'type':_0x27e9e5[_0x0bbe('0x26')][_0x0bbe('0x27')]};});_0x30357f[_0x0bbe('0x28')]=_[_0x0bbe('0x29')](_0x211095,_0x0bbe('0x22'));_0x30357f['query']=_['keys'](_0xf19aa8['query']);_0x30357f[_0x0bbe('0x2a')]=_['intersection'](_0x30357f['model'],_0x30357f[_0x0bbe('0x2b')]);_0x5e1294[_0x0bbe('0x2c')]=_[_0x0bbe('0x2d')](_0x30357f[_0x0bbe('0x28')],qs[_0x0bbe('0x2e')](_0xf19aa8[_0x0bbe('0x2b')][_0x0bbe('0x2e')]));_0x5e1294[_0x0bbe('0x2c')]=_0x5e1294[_0x0bbe('0x2c')][_0x0bbe('0x2f')]?_0x5e1294[_0x0bbe('0x2c')]:_0x30357f[_0x0bbe('0x28')];if(!_0xf19aa8[_0x0bbe('0x2b')]['hasOwnProperty'](_0x0bbe('0x30'))){_0x5e1294[_0x0bbe('0x19')]=qs[_0x0bbe('0x19')](_0xf19aa8[_0x0bbe('0x2b')]['limit']);_0x5e1294[_0x0bbe('0x17')]=qs[_0x0bbe('0x17')](_0xf19aa8[_0x0bbe('0x2b')][_0x0bbe('0x17')]);}_0x5e1294[_0x0bbe('0x31')]=qs[_0x0bbe('0x32')](_0xf19aa8[_0x0bbe('0x2b')][_0x0bbe('0x32')]);_0x5e1294['where']=qs[_0x0bbe('0x2a')](_['pick'](_0xf19aa8[_0x0bbe('0x2b')],_0x30357f[_0x0bbe('0x2a')]),_0x211095);if(_0xf19aa8[_0x0bbe('0x2b')][_0x0bbe('0x33')]){_0x5e1294[_0x0bbe('0x34')]=_[_0x0bbe('0x35')](_0x5e1294[_0x0bbe('0x34')],{'$or':_[_0x0bbe('0x29')](_0x211095,function(_0x45105e){if(_0x45105e['type']!==_0x0bbe('0x36')){var _0x231d10={};_0x231d10[_0x45105e['name']]={'$like':'%'+_0xf19aa8['query'][_0x0bbe('0x33')]+'%'};return _0x231d10;}})});}_0x5e1294=_[_0x0bbe('0x35')]({},_0x5e1294,_0xf19aa8['options']);var _0x2d50f3={'where':_0x5e1294[_0x0bbe('0x34')]};return db['VoiceDialReport']['count'](_0x2d50f3)['then'](function(_0xa64a94){_0x72784f[_0x0bbe('0x1a')]=_0xa64a94;if(_0xf19aa8['query'][_0x0bbe('0x37')]){_0x5e1294[_0x0bbe('0x38')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x0bbe('0x39')](_0x5e1294);})[_0x0bbe('0x3a')](function(_0x597e1e){_0x72784f['rows']=_0x597e1e;return _0x72784f;})['then'](respondWithFilteredResult(_0x293343,_0x5e1294))['catch'](handleError(_0x293343,null));};exports[_0x0bbe('0x3b')]=function(_0x3af3cf,_0x189d01){var _0x575a44={'raw':!![],'where':{'id':_0x3af3cf[_0x0bbe('0x3c')]['id']}},_0x32f311={};_0x32f311[_0x0bbe('0x28')]=_[_0x0bbe('0x3d')](db[_0x0bbe('0x25')][_0x0bbe('0x3e')]);_0x32f311[_0x0bbe('0x2b')]=_[_0x0bbe('0x3d')](_0x3af3cf[_0x0bbe('0x2b')]);_0x32f311[_0x0bbe('0x2a')]=_[_0x0bbe('0x2d')](_0x32f311[_0x0bbe('0x28')],_0x32f311[_0x0bbe('0x2b')]);_0x575a44[_0x0bbe('0x2c')]=_[_0x0bbe('0x2d')](_0x32f311['model'],qs['fields'](_0x3af3cf['query'][_0x0bbe('0x2e')]));_0x575a44[_0x0bbe('0x2c')]=_0x575a44['attributes'][_0x0bbe('0x2f')]?_0x575a44[_0x0bbe('0x2c')]:_0x32f311[_0x0bbe('0x28')];if(_0x3af3cf[_0x0bbe('0x2b')]['includeAll']){_0x575a44[_0x0bbe('0x38')]=[{'all':!![]}];}_0x575a44=_[_0x0bbe('0x35')]({},_0x575a44,_0x3af3cf[_0x0bbe('0x3f')]);return db[_0x0bbe('0x25')][_0x0bbe('0x40')](_0x575a44)[_0x0bbe('0x3a')](handleEntityNotFound(_0x189d01,null))['then'](respondWithResult(_0x189d01,null))['catch'](handleError(_0x189d01,null));};exports[_0x0bbe('0x41')]=function(_0x424355,_0x57e3e8){return db[_0x0bbe('0x25')]['create'](_0x424355[_0x0bbe('0x42')],{})[_0x0bbe('0x3a')](respondWithResult(_0x57e3e8,0xc9))[_0x0bbe('0x43')](handleError(_0x57e3e8,null));};exports[_0x0bbe('0x44')]=function(_0x2224b0,_0x38c80c){if(_0x2224b0['body']['id']){delete _0x2224b0[_0x0bbe('0x42')]['id'];}return db[_0x0bbe('0x25')][_0x0bbe('0x40')]({'where':{'id':_0x2224b0['params']['id']}})[_0x0bbe('0x3a')](handleEntityNotFound(_0x38c80c,null))[_0x0bbe('0x3a')](saveUpdates(_0x2224b0[_0x0bbe('0x42')],null))['then'](respondWithResult(_0x38c80c,null))[_0x0bbe('0x43')](handleError(_0x38c80c,null));};exports[_0x0bbe('0x1f')]=function(_0x1991ad,_0x40db6b){return db['VoiceDialReport'][_0x0bbe('0x40')]({'where':{'id':_0x1991ad[_0x0bbe('0x3c')]['id']}})[_0x0bbe('0x3a')](handleEntityNotFound(_0x40db6b,null))[_0x0bbe('0x3a')](removeEntity(_0x40db6b,null))[_0x0bbe('0x43')](handleError(_0x40db6b,null));};exports['describe']=function(_0x4d4c2b,_0x2b5c50){return db[_0x0bbe('0x25')][_0x0bbe('0x45')]()[_0x0bbe('0x3a')](respondWithResult(_0x2b5c50,null))[_0x0bbe('0x43')](handleError(_0x2b5c50,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index de84769..6a28bb7 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 _0xcceb=['../../config/environment','exports','uniqueid','../../config/logger','path','rimraf'];(function(_0x32c447,_0x5c718f){var _0x5f4d3d=function(_0xb65b3f){while(--_0xb65b3f){_0x32c447['push'](_0x32c447['shift']());}};_0x5f4d3d(++_0x5c718f);}(_0xcceb,0x1c5));var _0xbcce=function(_0x35a393,_0x4e2072){_0x35a393=_0x35a393-0x0;var _0x22cea8=_0xcceb[_0x35a393];return _0x22cea8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbcce('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbcce('0x1'));var rimraf=require(_0xbcce('0x2'));var config=require(_0xbcce('0x3'));var attributes=require('./voiceDialReport.attributes');module[_0xbcce('0x4')]=function(_0x1a6526,_0xfcf21a){return _0x1a6526['define']('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xbcce('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x105e=['bluebird','path','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','../../config/logger','api'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x105e,0x1dd));var _0xe105=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x105e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe105('0x0'));var util=require('util');var logger=require(_0xe105('0x1'))(_0xe105('0x2'));var moment=require('moment');var BPromise=require(_0xe105('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe105('0x4'));var rimraf=require('rimraf');var config=require(_0xe105('0x5'));var attributes=require(_0xe105('0x6'));module[_0xe105('0x7')]=function(_0xb9601c,_0x4cbc83){return _0xb9601c[_0xe105('0x8')](_0xe105('0x9'),attributes,{'tableName':_0xe105('0xa'),'paranoid':![],'indexes':[{'fields':[_0xe105('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index b4618f5..5964335 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 _0x6a22=['update','raw','where','attributes','UpdateVoiceDialReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a22,0x137));var _0x26a2=function(_0x5f5cce,_0x138cc5){_0x5f5cce=_0x5f5cce-0x0;var _0x705ecf=_0x6a22[_0x5f5cce];return _0x705ecf;};'use strict';var _=require(_0x26a2('0x0'));var util=require(_0x26a2('0x1'));var moment=require(_0x26a2('0x2'));var BPromise=require('bluebird');var rs=require(_0x26a2('0x3'));var fs=require('fs');var Redis=require(_0x26a2('0x4'));var db=require(_0x26a2('0x5'))['db'];var utils=require(_0x26a2('0x6'));var logger=require(_0x26a2('0x7'))(_0x26a2('0x8'));var config=require('../../config/environment');var jayson=require(_0x26a2('0x9'));var client=jayson['client'][_0x26a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cd063,_0x1764e8,_0x568644){return new BPromise(function(_0x1050d9,_0x3592b5){return client[_0x26a2('0xb')](_0x2cd063,_0x568644)[_0x26a2('0xc')](function(_0x42b5e5){logger[_0x26a2('0xd')](_0x26a2('0xe'),_0x1764e8,'request\x20sent');logger[_0x26a2('0xf')](_0x26a2('0x10'),_0x1764e8,_0x26a2('0x11'),JSON[_0x26a2('0x12')](_0x42b5e5));if(_0x42b5e5[_0x26a2('0x13')]){if(_0x42b5e5[_0x26a2('0x13')][_0x26a2('0x14')]===0x1f4){logger['error'](_0x26a2('0xe'),_0x1764e8,_0x42b5e5[_0x26a2('0x13')][_0x26a2('0x15')]);return _0x3592b5(_0x42b5e5[_0x26a2('0x13')][_0x26a2('0x15')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x1764e8,_0x42b5e5[_0x26a2('0x13')][_0x26a2('0x15')]);return _0x1050d9(_0x42b5e5[_0x26a2('0x13')][_0x26a2('0x15')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x1764e8,_0x26a2('0x11'));_0x1050d9(_0x42b5e5[_0x26a2('0x16')][_0x26a2('0x15')]);}})[_0x26a2('0x17')](function(_0x5e76f7){logger[_0x26a2('0x13')](_0x26a2('0xe'),_0x1764e8,_0x5e76f7);_0x3592b5(_0x5e76f7);});});}exports[_0x26a2('0x18')]=function(_0xe0d281){var _0x1d164b=this;return new Promise(function(_0x4b6f35,_0x5b0035){return db[_0x26a2('0x19')][_0x26a2('0x1a')](_0xe0d281[_0x26a2('0x1b')],{'raw':_0xe0d281[_0x26a2('0x1c')]?_0xe0d281[_0x26a2('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x26a2('0xc')](function(_0x183a7e){logger[_0x26a2('0xd')](_0x26a2('0x18'),_0xe0d281);logger[_0x26a2('0xf')](_0x26a2('0x18'),_0xe0d281,JSON[_0x26a2('0x12')](_0x183a7e));_0x4b6f35(_0x183a7e);})[_0x26a2('0x17')](function(_0xcc4517){logger[_0x26a2('0x13')](_0x26a2('0x18'),_0xcc4517['message'],_0xe0d281);_0x5b0035(_0x1d164b['error'](0x1f4,_0xcc4517[_0x26a2('0x15')]));});});};exports['UpdateVoiceDialReport']=function(_0x3b6317){var _0x1fc1ad=this;return new Promise(function(_0x79a96b,_0x32e368){return db[_0x26a2('0x19')][_0x26a2('0x1d')](_0x3b6317['body'],{'raw':_0x3b6317[_0x26a2('0x1c')]?_0x3b6317[_0x26a2('0x1c')][_0x26a2('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b6317['options']?_0x3b6317[_0x26a2('0x1c')][_0x26a2('0x1f')]||null:null,'attributes':_0x3b6317[_0x26a2('0x1c')]?_0x3b6317[_0x26a2('0x1c')][_0x26a2('0x20')]||null:null,'limit':_0x3b6317[_0x26a2('0x1c')]?_0x3b6317['options']['limit']||null:null})['then'](function(_0x1ea3e4){logger[_0x26a2('0xd')](_0x26a2('0x21'),_0x3b6317);logger[_0x26a2('0xf')](_0x26a2('0x21'),_0x3b6317,JSON['stringify'](_0x1ea3e4));_0x79a96b(_0x1ea3e4);})[_0x26a2('0x17')](function(_0x28e152){logger[_0x26a2('0x13')](_0x26a2('0x21'),_0x28e152[_0x26a2('0x15')],_0x3b6317);_0x32e368(_0x1fc1ad[_0x26a2('0x13')](0x1f4,_0x28e152[_0x26a2('0x15')]));});});}; \ No newline at end of file +var _0x07f0=['error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','create','options','UpdateVoiceDialReport','update','body','raw','where','attributes','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4f9d3c,_0x23d6e0){var _0x3ab489=function(_0x1d8f3e){while(--_0x1d8f3e){_0x4f9d3c['push'](_0x4f9d3c['shift']());}};_0x3ab489(++_0x23d6e0);}(_0x07f0,0xfd));var _0x007f=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x07f0[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0x007f('0x0'));var util=require(_0x007f('0x1'));var moment=require(_0x007f('0x2'));var BPromise=require(_0x007f('0x3'));var rs=require(_0x007f('0x4'));var fs=require('fs');var Redis=require(_0x007f('0x5'));var db=require(_0x007f('0x6'))['db'];var utils=require(_0x007f('0x7'));var logger=require(_0x007f('0x8'))(_0x007f('0x9'));var config=require('../../config/environment');var jayson=require(_0x007f('0xa'));var client=jayson[_0x007f('0xb')][_0x007f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x260ce3,_0x2d7dcd,_0xca7e57){return new BPromise(function(_0xccc612,_0x3539f0){return client[_0x007f('0xd')](_0x260ce3,_0xca7e57)[_0x007f('0xe')](function(_0x47e23a){logger[_0x007f('0xf')](_0x007f('0x10'),_0x2d7dcd,_0x007f('0x11'));logger[_0x007f('0x12')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x2d7dcd,_0x007f('0x11'),JSON['stringify'](_0x47e23a));if(_0x47e23a[_0x007f('0x13')]){if(_0x47e23a[_0x007f('0x13')][_0x007f('0x14')]===0x1f4){logger[_0x007f('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x2d7dcd,_0x47e23a[_0x007f('0x13')][_0x007f('0x15')]);return _0x3539f0(_0x47e23a[_0x007f('0x13')][_0x007f('0x15')]);}logger[_0x007f('0x13')](_0x007f('0x10'),_0x2d7dcd,_0x47e23a[_0x007f('0x13')][_0x007f('0x15')]);return _0xccc612(_0x47e23a[_0x007f('0x13')]['message']);}else{logger['info'](_0x007f('0x10'),_0x2d7dcd,_0x007f('0x11'));_0xccc612(_0x47e23a['result'][_0x007f('0x15')]);}})[_0x007f('0x16')](function(_0x11cfd8){logger[_0x007f('0x13')](_0x007f('0x10'),_0x2d7dcd,_0x11cfd8);_0x3539f0(_0x11cfd8);});});}exports[_0x007f('0x17')]=function(_0x53e40b){var _0x6966ad=this;return new Promise(function(_0x10cc86,_0x4b30fa){return db[_0x007f('0x18')][_0x007f('0x19')](_0x53e40b['body'],{'raw':_0x53e40b[_0x007f('0x1a')]?_0x53e40b[_0x007f('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x007f('0xe')](function(_0x54da2c){logger[_0x007f('0xf')]('CreateVoiceDialReport',_0x53e40b);logger[_0x007f('0x12')](_0x007f('0x17'),_0x53e40b,JSON['stringify'](_0x54da2c));_0x10cc86(_0x54da2c);})['catch'](function(_0x3aef30){logger['error'](_0x007f('0x17'),_0x3aef30[_0x007f('0x15')],_0x53e40b);_0x4b30fa(_0x6966ad[_0x007f('0x13')](0x1f4,_0x3aef30['message']));});});};exports[_0x007f('0x1b')]=function(_0x143fca){var _0x4c0ead=this;return new Promise(function(_0x27682a,_0x2901cd){return db['VoiceDialReport'][_0x007f('0x1c')](_0x143fca[_0x007f('0x1d')],{'raw':_0x143fca[_0x007f('0x1a')]?_0x143fca[_0x007f('0x1a')][_0x007f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x143fca[_0x007f('0x1a')]?_0x143fca['options'][_0x007f('0x1f')]||null:null,'attributes':_0x143fca[_0x007f('0x1a')]?_0x143fca[_0x007f('0x1a')][_0x007f('0x20')]||null:null,'limit':_0x143fca['options']?_0x143fca[_0x007f('0x1a')]['limit']||null:null})[_0x007f('0xe')](function(_0x5c270a){logger['info'](_0x007f('0x1b'),_0x143fca);logger['debug'](_0x007f('0x1b'),_0x143fca,JSON[_0x007f('0x21')](_0x5c270a));_0x27682a(_0x5c270a);})[_0x007f('0x16')](function(_0x1853b4){logger[_0x007f('0x13')](_0x007f('0x1b'),_0x1853b4['message'],_0x143fca);_0x2901cd(_0x4c0ead['error'](0x1f4,_0x1853b4[_0x007f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index b95c667..f829d04 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 _0xcec6=['delete','/:id','destroy','path','connect-timeout','Router','./voiceExtension.controller','get','index','post','isAuthenticated','create','/:id/applications','addApplications','put','update'];(function(_0x5cb0e6,_0x27b219){var _0x58289e=function(_0x27cd30){while(--_0x27cd30){_0x5cb0e6['push'](_0x5cb0e6['shift']());}};_0x58289e(++_0x27b219);}(_0xcec6,0x1d3));var _0x6cec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcec6[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6cec('0x0'));var timeout=require(_0x6cec('0x1'));var express=require('express');var router=express[_0x6cec('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6cec('0x3'));router[_0x6cec('0x4')]('/',auth['isAuthenticated'](),controller[_0x6cec('0x5')]);router[_0x6cec('0x4')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6cec('0x6')]('/',auth[_0x6cec('0x7')](),controller[_0x6cec('0x8')]);router[_0x6cec('0x6')](_0x6cec('0x9'),auth[_0x6cec('0x7')](),controller[_0x6cec('0xa')]);router[_0x6cec('0xb')]('/:id',auth[_0x6cec('0x7')](),controller[_0x6cec('0xc')]);router[_0x6cec('0xd')](_0x6cec('0xe'),auth['isAuthenticated'](),controller[_0x6cec('0xf')]);module['exports']=router; \ No newline at end of file +var _0xe0bd=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','update','destroy','exports','multer','util'];(function(_0x199b1f,_0x4ed849){var _0x267ac9=function(_0x184ac6){while(--_0x184ac6){_0x199b1f['push'](_0x199b1f['shift']());}};_0x267ac9(++_0x4ed849);}(_0xe0bd,0x17a));var _0xde0b=function(_0x5a4400,_0xfae3b6){_0x5a4400=_0x5a4400-0x0;var _0xf9b532=_0xe0bd[_0x5a4400];return _0xf9b532;};'use strict';var multer=require(_0xde0b('0x0'));var util=require(_0xde0b('0x1'));var path=require(_0xde0b('0x2'));var timeout=require(_0xde0b('0x3'));var express=require(_0xde0b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xde0b('0x5'));var interaction=require(_0xde0b('0x6'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0xde0b('0x7')]('/',auth[_0xde0b('0x8')](),controller[_0xde0b('0x9')]);router[_0xde0b('0x7')](_0xde0b('0xa'),auth[_0xde0b('0x8')](),controller[_0xde0b('0xb')]);router[_0xde0b('0xc')]('/',auth[_0xde0b('0x8')](),controller[_0xde0b('0xd')]);router[_0xde0b('0xc')](_0xde0b('0xe'),auth[_0xde0b('0x8')](),controller[_0xde0b('0xf')]);router['put'](_0xde0b('0xa'),auth[_0xde0b('0x8')](),controller[_0xde0b('0x10')]);router['delete'](_0xde0b('0xa'),auth[_0xde0b('0x8')](),controller[_0xde0b('0x11')]);module[_0xde0b('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 f36743c..65aea50 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 _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x4549e6,_0x18c5c6){var _0x555ad1=function(_0x1e36b6){while(--_0x1e36b6){_0x4549e6['push'](_0x4549e6['shift']());}};_0x555ad1(++_0x18c5c6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x34d71a,_0x4a0328){var _0xf7a535=function(_0x1b5a1e){while(--_0x1b5a1e){_0x34d71a['push'](_0x34d71a['shift']());}};_0xf7a535(++_0x4a0328);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 9135578..b5fab4d 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 _0x6337=['../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','find','name','destroy','stack','send','index','VoiceExtension','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','sort','pick','where','merge','VIRTUAL','options','findAll','rows','includeAll','include','catch','params','create','body','outbound','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','context','addApplications','findOne','sequelize','transaction','VoiceExtensionId','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x181121,_0x42cefa){var _0x1abe74=function(_0x3a8b45){while(--_0x3a8b45){_0x181121['push'](_0x181121['shift']());}};_0x1abe74(++_0x42cefa);}(_0x6337,0x18a));var _0x7633=function(_0xed292,_0x591de1){_0xed292=_0xed292-0x0;var _0xc3a84b=_0x6337[_0xed292];return _0xc3a84b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7633('0x0'));var zipdir=require(_0x7633('0x1'));var jsonpatch=require(_0x7633('0x2'));var rp=require(_0x7633('0x3'));var moment=require(_0x7633('0x4'));var BPromise=require(_0x7633('0x5'));var Mustache=require(_0x7633('0x6'));var util=require(_0x7633('0x7'));var path=require(_0x7633('0x8'));var sox=require('sox');var csv=require(_0x7633('0x9'));var ejs=require(_0x7633('0xa'));var fs=require('fs');var fs_extra=require(_0x7633('0xb'));var _=require('lodash');var squel=require(_0x7633('0xc'));var crypto=require('crypto');var jsforce=require(_0x7633('0xd'));var deskjs=require(_0x7633('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7633('0xf'));var Papa=require('papaparse');var Redis=require(_0x7633('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7633('0x11'));var as=require(_0x7633('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7633('0x13'))(_0x7633('0x14'));var utils=require(_0x7633('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7633('0x16'));var db=require(_0x7633('0x17'))['db'];config[_0x7633('0x18')]=_['defaults'](config[_0x7633('0x18')],{'host':_0x7633('0x19'),'port':0x18eb});var socket=require(_0x7633('0x1a'))(new Redis(config['redis']));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x18abe4,_0x1be0ab){_0x1be0ab=_0x1be0ab||0xcc;return function(_0x352798){if(_0x352798){return _0x18abe4[_0x7633('0x1b')](_0x1be0ab);}return _0x18abe4[_0x7633('0x1c')](_0x1be0ab)[_0x7633('0x1d')]();};}function respondWithResult(_0x47e212,_0x45ded1){_0x45ded1=_0x45ded1||0xc8;return function(_0x1528b4){if(_0x1528b4){return _0x47e212['status'](_0x45ded1)[_0x7633('0x1e')](_0x1528b4);}};}function respondWithFilteredResult(_0x4c4e1,_0x42a7a3){return function(_0x321043){if(_0x321043){var _0x261028=typeof _0x42a7a3['offset']===_0x7633('0x1f')&&typeof _0x42a7a3[_0x7633('0x20')]===_0x7633('0x1f');var _0x5988d4=_0x321043[_0x7633('0x21')];var _0x23d80c=_0x261028?0x0:_0x42a7a3[_0x7633('0x22')];var _0x340d6a=_0x261028?_0x321043[_0x7633('0x21')]:_0x42a7a3['offset']+_0x42a7a3[_0x7633('0x20')];var _0x1140cd;if(_0x340d6a>=_0x5988d4){_0x340d6a=_0x5988d4;_0x1140cd=0xc8;}else{_0x1140cd=0xce;}_0x4c4e1[_0x7633('0x1c')](_0x1140cd);return _0x4c4e1[_0x7633('0x23')](_0x7633('0x24'),_0x23d80c+'-'+_0x340d6a+'/'+_0x5988d4)['json'](_0x321043);}return null;};}function patchUpdates(_0x38a915){return function(_0x4590cc){try{jsonpatch[_0x7633('0x25')](_0x4590cc,_0x38a915,!![]);}catch(_0x2471b7){return BPromise['reject'](_0x2471b7);}return _0x4590cc[_0x7633('0x26')]();};}function saveUpdates(_0x9152df,_0x29177d){return function(_0x9ce7ff){if(_0x9ce7ff){return _0x9ce7ff['update'](_0x9152df)[_0x7633('0x27')](function(_0x34aa76){return _0x34aa76;});}return null;};}function removeEntity(_0x555923,_0x1eb275){return function(_0x4e73c4){if(_0x4e73c4){return _0x4e73c4['destroy']()[_0x7633('0x27')](function(){var _0x1b2920=_0x4e73c4[_0x7633('0x28')]({'plain':!![]});var _0x407053=[{'name':_0x7633('0x29'),'value':_0x7633('0x2a'),'ignore':![]},{'name':_0x7633('0x2b'),'value':'outbound','ignore':![]},{'name':_0x7633('0x2c'),'value':_0x7633('0x2d'),'ignore':![]}];var _0x266944=_(_0x407053)[_0x7633('0x2e')](_0x7633('0x2f'))[_0x7633('0x30')]('value')[_0x7633('0x31')]();if(_[_0x7633('0x32')](_0x266944,_0x1b2920['type'])){return;}var _0x8fcf83=_[_0x7633('0x33')](_0x407053,['value',_0x1b2920['type']])[_0x7633('0x34')];return db['UserProfileResource'][_0x7633('0x35')]({'where':{'type':_0x8fcf83,'resourceId':_0x1b2920['id']}})[_0x7633('0x27')](function(){return _0x4e73c4;});})[_0x7633('0x27')](function(){_0x555923[_0x7633('0x1c')](0xcc)[_0x7633('0x1d')]();});}};}function handleEntityNotFound(_0xd3fa4,_0x48a68e){return function(_0x29da7d){if(!_0x29da7d){_0xd3fa4[_0x7633('0x1b')](0x194);}return _0x29da7d;};}function handleError(_0x5758ae,_0x4d23a4){_0x4d23a4=_0x4d23a4||0x1f4;return function(_0x365e6d){logger['error'](_0x365e6d[_0x7633('0x36')]);if(_0x365e6d['name']){delete _0x365e6d['name'];}_0x5758ae[_0x7633('0x1c')](_0x4d23a4)[_0x7633('0x37')](_0x365e6d);};}exports[_0x7633('0x38')]=function(_0x857bb2,_0x1d96a4){var _0x2258ee={},_0x4a2738={},_0x1df27d={'count':0x0,'rows':[]};var _0x51c9d9=_[_0x7633('0x30')](db[_0x7633('0x39')][_0x7633('0x3a')],function(_0x285309){return{'name':_0x285309[_0x7633('0x3b')],'type':_0x285309[_0x7633('0x3c')]['key']};});_0x4a2738[_0x7633('0x3d')]=_[_0x7633('0x30')](_0x51c9d9,'name');_0x4a2738[_0x7633('0x3e')]=_[_0x7633('0x3f')](_0x857bb2[_0x7633('0x3e')]);_0x4a2738[_0x7633('0x40')]=_['intersection'](_0x4a2738[_0x7633('0x3d')],_0x4a2738[_0x7633('0x3e')]);_0x2258ee[_0x7633('0x41')]=_[_0x7633('0x42')](_0x4a2738[_0x7633('0x3d')],qs['fields'](_0x857bb2[_0x7633('0x3e')][_0x7633('0x43')]));_0x2258ee[_0x7633('0x41')]=_0x2258ee['attributes'][_0x7633('0x44')]?_0x2258ee[_0x7633('0x41')]:_0x4a2738[_0x7633('0x3d')];if(!_0x857bb2[_0x7633('0x3e')]['hasOwnProperty']('nolimit')){_0x2258ee[_0x7633('0x20')]=qs[_0x7633('0x20')](_0x857bb2[_0x7633('0x3e')]['limit']);_0x2258ee[_0x7633('0x22')]=qs[_0x7633('0x22')](_0x857bb2[_0x7633('0x3e')][_0x7633('0x22')]);}_0x2258ee['order']=qs[_0x7633('0x45')](_0x857bb2['query'][_0x7633('0x45')]);_0x2258ee['where']=qs[_0x7633('0x40')](_[_0x7633('0x46')](_0x857bb2['query'],_0x4a2738[_0x7633('0x40')]),_0x51c9d9);if(_0x857bb2[_0x7633('0x3e')][_0x7633('0x2e')]){_0x2258ee[_0x7633('0x47')]=_[_0x7633('0x48')](_0x2258ee[_0x7633('0x47')],{'$or':_[_0x7633('0x30')](_0x51c9d9,function(_0x4c1534){if(_0x4c1534['type']!==_0x7633('0x49')){var _0x4d3bcc={};_0x4d3bcc[_0x4c1534[_0x7633('0x34')]]={'$like':'%'+_0x857bb2[_0x7633('0x3e')][_0x7633('0x2e')]+'%'};return _0x4d3bcc;}})});}_0x2258ee=_[_0x7633('0x48')]({},_0x2258ee,_0x857bb2[_0x7633('0x4a')]);var _0xe216f7={'where':_0x2258ee[_0x7633('0x47')]};return db[_0x7633('0x39')][_0x7633('0x21')](_0xe216f7)[_0x7633('0x27')](function(_0x806350){_0x1df27d[_0x7633('0x21')]=_0x806350;if(_0x857bb2[_0x7633('0x3e')]['includeAll']){_0x2258ee['include']=[{'all':!![]}];}return db[_0x7633('0x39')][_0x7633('0x4b')](_0x2258ee);})[_0x7633('0x27')](function(_0x2cb3ad){_0x1df27d[_0x7633('0x4c')]=_0x2cb3ad;return _0x1df27d;})[_0x7633('0x27')](respondWithFilteredResult(_0x1d96a4,_0x2258ee))['catch'](handleError(_0x1d96a4,null));};exports['show']=function(_0x3a0201,_0x3e09c5){var _0x4385dd={'raw':![],'where':{'id':_0x3a0201['params']['id']}},_0x1c1474={};_0x1c1474[_0x7633('0x3d')]=_[_0x7633('0x3f')](db[_0x7633('0x39')][_0x7633('0x3a')]);_0x1c1474['query']=_[_0x7633('0x3f')](_0x3a0201[_0x7633('0x3e')]);_0x1c1474[_0x7633('0x40')]=_[_0x7633('0x42')](_0x1c1474[_0x7633('0x3d')],_0x1c1474[_0x7633('0x3e')]);_0x4385dd['attributes']=_[_0x7633('0x42')](_0x1c1474[_0x7633('0x3d')],qs[_0x7633('0x43')](_0x3a0201['query'][_0x7633('0x43')]));_0x4385dd[_0x7633('0x41')]=_0x4385dd[_0x7633('0x41')]['length']?_0x4385dd['attributes']:_0x1c1474[_0x7633('0x3d')];if(_0x3a0201[_0x7633('0x3e')][_0x7633('0x4d')]){_0x4385dd[_0x7633('0x4e')]=[{'all':!![]}];}_0x4385dd=_['merge']({},_0x4385dd,_0x3a0201[_0x7633('0x4a')]);return db[_0x7633('0x39')][_0x7633('0x33')](_0x4385dd)[_0x7633('0x27')](handleEntityNotFound(_0x3e09c5,null))[_0x7633('0x27')](respondWithResult(_0x3e09c5,null))[_0x7633('0x4f')](handleError(_0x3e09c5,null));};exports[_0x7633('0x35')]=function(_0x42f6e0,_0x3e6594){return db[_0x7633('0x39')][_0x7633('0x33')]({'where':{'id':_0x42f6e0[_0x7633('0x50')]['id']}})['then'](handleEntityNotFound(_0x3e6594,null))['then'](removeEntity(_0x3e6594,null))[_0x7633('0x4f')](handleError(_0x3e6594,null));};exports[_0x7633('0x51')]=function(_0x3eeff9,_0x16c536){if(_0x3eeff9[_0x7633('0x52')][_0x7633('0x3c')]===_0x7633('0x53')&&!_[_0x7633('0x54')](_0x3eeff9[_0x7633('0x52')][_0x7633('0x55')],'_')){_0x3eeff9[_0x7633('0x52')][_0x7633('0x55')]='_'[_0x7633('0x56')](_0x3eeff9[_0x7633('0x52')][_0x7633('0x55')]);}return db[_0x7633('0x39')]['create'](_0x3eeff9[_0x7633('0x52')],{'raw':![]})[_0x7633('0x27')](function(_0x1b06e9){var _0x4d5d43=_0x3eeff9[_0x7633('0x57')][_0x7633('0x28')]({'plain':!![]});if(!_0x4d5d43)throw new Error(_0x7633('0x58'));if(_0x4d5d43['role']===_0x7633('0x57')){var _0x4e2b82=_0x1b06e9[_0x7633('0x28')]({'plain':!![]});var _0x3f1ea0=[{'name':_0x7633('0x29'),'value':_0x7633('0x2a')},{'name':_0x7633('0x2b'),'value':'outbound'},{'name':_0x7633('0x2c'),'value':_0x7633('0x2d')}];var _0x4ddcf1=_['find'](_0x3f1ea0,['value',_0x4e2b82[_0x7633('0x3c')]])[_0x7633('0x34')];return db['UserProfileSection'][_0x7633('0x33')]({'where':{'name':_0x4ddcf1,'userProfileId':_0x4d5d43[_0x7633('0x59')]},'raw':!![]})['then'](function(_0x446221){if(_0x446221&&_0x446221[_0x7633('0x5a')]===0x0){return db['UserProfileResource'][_0x7633('0x51')]({'name':_0x4e2b82['name'],'resourceId':_0x4e2b82['id'],'type':_0x446221[_0x7633('0x34')],'sectionId':_0x446221['id']},{})['then'](function(){return _0x1b06e9;});}else{return _0x1b06e9;}})[_0x7633('0x4f')](function(_0x439bfb){logger['error'](_0x7633('0x5b'),_0x439bfb);throw _0x439bfb;});}return _0x1b06e9;})[_0x7633('0x27')](respondWithResult(_0x16c536,0xc9))[_0x7633('0x4f')](handleError(_0x16c536,null));};exports[_0x7633('0x5c')]=function(_0x20a403,_0x450c37){if(_0x20a403[_0x7633('0x52')]['id']){delete _0x20a403[_0x7633('0x52')]['id'];}return db['VoiceExtension'][_0x7633('0x33')]({'where':{'id':_0x20a403[_0x7633('0x50')]['id']}})[_0x7633('0x27')](handleEntityNotFound(_0x450c37,null))[_0x7633('0x27')](function(_0x54ed6c){if(_0x54ed6c){return db[_0x7633('0x39')][_0x7633('0x5c')](_[_0x7633('0x46')](_0x20a403['body'],['exten','context',_0x7633('0x5d'),_0x7633('0x5e'),_0x7633('0x5f'),_0x7633('0x60')]),{'where':{'context':_0x54ed6c[_0x7633('0x61')],'exten':_0x54ed6c[_0x7633('0x55')]},'individualHooks':!![]})[_0x7633('0x27')](function(_0x3b143d){return _0x3b143d;});}return null;})[_0x7633('0x27')](respondWithStatusCode(_0x450c37,null))[_0x7633('0x4f')](handleError(_0x450c37,null));};exports[_0x7633('0x62')]=function(_0x16e224,_0x50b5f8,_0x278345){return db[_0x7633('0x39')][_0x7633('0x63')]({'where':{'id':_0x16e224[_0x7633('0x50')]['id']}})['then'](handleEntityNotFound(_0x50b5f8,null))[_0x7633('0x27')](function(_0x211601){if(_0x211601){return db[_0x7633('0x64')][_0x7633('0x65')](function(_0x84a6b1){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x16e224[_0x7633('0x50')]['id']},'transaction':_0x84a6b1})[_0x7633('0x27')](function(_0x14660f){var _0x28b043=_[_0x7633('0x30')](_0x16e224['body'],function(_0x3adb3e){_0x3adb3e[_0x7633('0x66')]=_0x16e224[_0x7633('0x50')]['id'];return _0x3adb3e;});return db[_0x7633('0x39')]['bulkCreate'](_0x28b043,{'transaction':_0x84a6b1});});})[_0x7633('0x27')](function(){return db[_0x7633('0x39')][_0x7633('0x67')]({'where':{'isApp':!![],'VoiceExtensionId':_0x16e224['params']['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})['then'](respondWithResult(_0x50b5f8,null))[_0x7633('0x4f')](handleError(_0x50b5f8,null));}; \ No newline at end of file +var _0x084d=['recordingFormat','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','./voiceExtension.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','get','inbound','OutboundRoutes','outbound','internal','filter','ignore','map','value','includes','type','name','destroy','error','stack','send','index','VoiceExtension','rawAttributes','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','params','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','InternalRoutes','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description'];(function(_0x431c0a,_0x477641){var _0x388514=function(_0x32bdc1){while(--_0x32bdc1){_0x431c0a['push'](_0x431c0a['shift']());}};_0x388514(++_0x477641);}(_0x084d,0x147));var _0xd084=function(_0x3b24f3,_0x236a66){_0x3b24f3=_0x3b24f3-0x0;var _0x4828af=_0x084d[_0x3b24f3];return _0x4828af;};'use strict';var emlformat=require(_0xd084('0x0'));var rimraf=require(_0xd084('0x1'));var zipdir=require(_0xd084('0x2'));var jsonpatch=require(_0xd084('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd084('0x4'));var Mustache=require(_0xd084('0x5'));var util=require(_0xd084('0x6'));var path=require(_0xd084('0x7'));var sox=require(_0xd084('0x8'));var csv=require(_0xd084('0x9'));var ejs=require(_0xd084('0xa'));var fs=require('fs');var fs_extra=require(_0xd084('0xb'));var _=require(_0xd084('0xc'));var squel=require(_0xd084('0xd'));var crypto=require(_0xd084('0xe'));var jsforce=require(_0xd084('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd084('0x9'));var querystring=require(_0xd084('0x10'));var Papa=require('papaparse');var Redis=require(_0xd084('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd084('0x12'));var as=require(_0xd084('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd084('0x14'))(_0xd084('0x15'));var utils=require(_0xd084('0x16'));var config=require(_0xd084('0x17'));var licenseUtil=require(_0xd084('0x18'));var db=require(_0xd084('0x19'))['db'];config['redis']=_[_0xd084('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd084('0x1b'))[_0xd084('0x1c')](socket);function respondWithStatusCode(_0x5bef50,_0x4aebfe){_0x4aebfe=_0x4aebfe||0xcc;return function(_0x2ee62d){if(_0x2ee62d){return _0x5bef50['sendStatus'](_0x4aebfe);}return _0x5bef50[_0xd084('0x1d')](_0x4aebfe)[_0xd084('0x1e')]();};}function respondWithResult(_0x54e748,_0x380843){_0x380843=_0x380843||0xc8;return function(_0x44a705){if(_0x44a705){return _0x54e748[_0xd084('0x1d')](_0x380843)[_0xd084('0x1f')](_0x44a705);}};}function respondWithFilteredResult(_0x2c2447,_0x4218a0){return function(_0x477a14){if(_0x477a14){var _0x415a04=typeof _0x4218a0['offset']===_0xd084('0x20')&&typeof _0x4218a0[_0xd084('0x21')]==='undefined';var _0x333ba3=_0x477a14[_0xd084('0x22')];var _0x1f82fc=_0x415a04?0x0:_0x4218a0[_0xd084('0x23')];var _0x2860fb=_0x415a04?_0x477a14[_0xd084('0x22')]:_0x4218a0[_0xd084('0x23')]+_0x4218a0['limit'];var _0x4c4cb5;if(_0x2860fb>=_0x333ba3){_0x2860fb=_0x333ba3;_0x4c4cb5=0xc8;}else{_0x4c4cb5=0xce;}_0x2c2447[_0xd084('0x1d')](_0x4c4cb5);return _0x2c2447[_0xd084('0x24')](_0xd084('0x25'),_0x1f82fc+'-'+_0x2860fb+'/'+_0x333ba3)[_0xd084('0x1f')](_0x477a14);}return null;};}function patchUpdates(_0x501b49){return function(_0x210a16){try{jsonpatch['apply'](_0x210a16,_0x501b49,!![]);}catch(_0x2f4c65){return BPromise['reject'](_0x2f4c65);}return _0x210a16[_0xd084('0x26')]();};}function saveUpdates(_0x16bc12,_0x51c4cd){return function(_0x5e2a3f){if(_0x5e2a3f){return _0x5e2a3f[_0xd084('0x27')](_0x16bc12)[_0xd084('0x28')](function(_0xf7f500){return _0xf7f500;});}return null;};}function removeEntity(_0xeb48cc,_0x58a7cf){return function(_0x1f8f6b){if(_0x1f8f6b){return _0x1f8f6b['destroy']()[_0xd084('0x28')](function(){var _0x1204cc=_0x1f8f6b[_0xd084('0x29')]({'plain':!![]});var _0x148397=[{'name':'InboundRoutes','value':_0xd084('0x2a'),'ignore':![]},{'name':_0xd084('0x2b'),'value':_0xd084('0x2c'),'ignore':![]},{'name':'InternalRoutes','value':_0xd084('0x2d'),'ignore':![]}];var _0x3800e1=_(_0x148397)[_0xd084('0x2e')](_0xd084('0x2f'))[_0xd084('0x30')](_0xd084('0x31'))[_0xd084('0x31')]();if(_[_0xd084('0x32')](_0x3800e1,_0x1204cc['type'])){return;}var _0x371efc=_['find'](_0x148397,[_0xd084('0x31'),_0x1204cc[_0xd084('0x33')]])[_0xd084('0x34')];return db['UserProfileResource'][_0xd084('0x35')]({'where':{'type':_0x371efc,'resourceId':_0x1204cc['id']}})[_0xd084('0x28')](function(){return _0x1f8f6b;});})[_0xd084('0x28')](function(){_0xeb48cc['status'](0xcc)[_0xd084('0x1e')]();});}};}function handleEntityNotFound(_0x5d5252,_0x25386a){return function(_0x39c739){if(!_0x39c739){_0x5d5252['sendStatus'](0x194);}return _0x39c739;};}function handleError(_0x238d96,_0x1a8ca4){_0x1a8ca4=_0x1a8ca4||0x1f4;return function(_0x11d5b5){logger[_0xd084('0x36')](_0x11d5b5[_0xd084('0x37')]);if(_0x11d5b5[_0xd084('0x34')]){delete _0x11d5b5['name'];}_0x238d96[_0xd084('0x1d')](_0x1a8ca4)[_0xd084('0x38')](_0x11d5b5);};}exports[_0xd084('0x39')]=function(_0x2812c3,_0x29855b){var _0x5445ee={},_0x5d28e3={},_0x42a29a={'count':0x0,'rows':[]};var _0x286cd7=_[_0xd084('0x30')](db[_0xd084('0x3a')][_0xd084('0x3b')],function(_0x42fc1e){return{'name':_0x42fc1e['fieldName'],'type':_0x42fc1e[_0xd084('0x33')]['key']};});_0x5d28e3['model']=_[_0xd084('0x30')](_0x286cd7,_0xd084('0x34'));_0x5d28e3[_0xd084('0x3c')]=_['keys'](_0x2812c3[_0xd084('0x3c')]);_0x5d28e3[_0xd084('0x3d')]=_[_0xd084('0x3e')](_0x5d28e3[_0xd084('0x3f')],_0x5d28e3[_0xd084('0x3c')]);_0x5445ee[_0xd084('0x40')]=_[_0xd084('0x3e')](_0x5d28e3[_0xd084('0x3f')],qs[_0xd084('0x41')](_0x2812c3['query'][_0xd084('0x41')]));_0x5445ee['attributes']=_0x5445ee[_0xd084('0x40')]['length']?_0x5445ee['attributes']:_0x5d28e3[_0xd084('0x3f')];if(!_0x2812c3[_0xd084('0x3c')][_0xd084('0x42')]('nolimit')){_0x5445ee[_0xd084('0x21')]=qs[_0xd084('0x21')](_0x2812c3[_0xd084('0x3c')]['limit']);_0x5445ee['offset']=qs[_0xd084('0x23')](_0x2812c3[_0xd084('0x3c')][_0xd084('0x23')]);}_0x5445ee[_0xd084('0x43')]=qs['sort'](_0x2812c3['query'][_0xd084('0x44')]);_0x5445ee['where']=qs[_0xd084('0x3d')](_[_0xd084('0x45')](_0x2812c3[_0xd084('0x3c')],_0x5d28e3[_0xd084('0x3d')]),_0x286cd7);if(_0x2812c3[_0xd084('0x3c')][_0xd084('0x2e')]){_0x5445ee['where']=_[_0xd084('0x46')](_0x5445ee[_0xd084('0x47')],{'$or':_['map'](_0x286cd7,function(_0x3c07a3){if(_0x3c07a3[_0xd084('0x33')]!==_0xd084('0x48')){var _0xb89919={};_0xb89919[_0x3c07a3[_0xd084('0x34')]]={'$like':'%'+_0x2812c3[_0xd084('0x3c')][_0xd084('0x2e')]+'%'};return _0xb89919;}})});}_0x5445ee=_['merge']({},_0x5445ee,_0x2812c3[_0xd084('0x49')]);var _0x2f9f66={'where':_0x5445ee[_0xd084('0x47')]};return db[_0xd084('0x3a')][_0xd084('0x22')](_0x2f9f66)[_0xd084('0x28')](function(_0xc6fc3){_0x42a29a[_0xd084('0x22')]=_0xc6fc3;if(_0x2812c3[_0xd084('0x3c')][_0xd084('0x4a')]){_0x5445ee[_0xd084('0x4b')]=[{'all':!![]}];}return db[_0xd084('0x3a')][_0xd084('0x4c')](_0x5445ee);})[_0xd084('0x28')](function(_0x39bbad){_0x42a29a[_0xd084('0x4d')]=_0x39bbad;return _0x42a29a;})[_0xd084('0x28')](respondWithFilteredResult(_0x29855b,_0x5445ee))[_0xd084('0x4e')](handleError(_0x29855b,null));};exports['show']=function(_0x265288,_0x29ba0b){var _0xc1b983={'raw':![],'where':{'id':_0x265288['params']['id']}},_0xf7606e={};_0xf7606e[_0xd084('0x3f')]=_['keys'](db[_0xd084('0x3a')][_0xd084('0x3b')]);_0xf7606e[_0xd084('0x3c')]=_[_0xd084('0x4f')](_0x265288[_0xd084('0x3c')]);_0xf7606e[_0xd084('0x3d')]=_['intersection'](_0xf7606e['model'],_0xf7606e[_0xd084('0x3c')]);_0xc1b983[_0xd084('0x40')]=_[_0xd084('0x3e')](_0xf7606e[_0xd084('0x3f')],qs[_0xd084('0x41')](_0x265288[_0xd084('0x3c')][_0xd084('0x41')]));_0xc1b983[_0xd084('0x40')]=_0xc1b983['attributes']['length']?_0xc1b983[_0xd084('0x40')]:_0xf7606e[_0xd084('0x3f')];if(_0x265288[_0xd084('0x3c')][_0xd084('0x4a')]){_0xc1b983[_0xd084('0x4b')]=[{'all':!![]}];}_0xc1b983=_[_0xd084('0x46')]({},_0xc1b983,_0x265288[_0xd084('0x49')]);return db[_0xd084('0x3a')][_0xd084('0x50')](_0xc1b983)[_0xd084('0x28')](handleEntityNotFound(_0x29ba0b,null))[_0xd084('0x28')](respondWithResult(_0x29ba0b,null))[_0xd084('0x4e')](handleError(_0x29ba0b,null));};exports[_0xd084('0x35')]=function(_0xbbb03c,_0x3c5d62){return db['VoiceExtension'][_0xd084('0x50')]({'where':{'id':_0xbbb03c[_0xd084('0x51')]['id']}})[_0xd084('0x28')](handleEntityNotFound(_0x3c5d62,null))[_0xd084('0x28')](removeEntity(_0x3c5d62,null))[_0xd084('0x4e')](handleError(_0x3c5d62,null));};exports[_0xd084('0x52')]=function(_0x2aab19,_0x3690de){if(_0x2aab19[_0xd084('0x53')]['type']===_0xd084('0x2c')&&!_[_0xd084('0x54')](_0x2aab19['body'][_0xd084('0x55')],'_')){_0x2aab19[_0xd084('0x53')][_0xd084('0x55')]='_'[_0xd084('0x56')](_0x2aab19[_0xd084('0x53')][_0xd084('0x55')]);}return db['VoiceExtension'][_0xd084('0x52')](_0x2aab19[_0xd084('0x53')],{'raw':![]})['then'](function(_0x3e854e){var _0x5af9df=_0x2aab19[_0xd084('0x57')][_0xd084('0x29')]({'plain':!![]});if(!_0x5af9df)throw new Error(_0xd084('0x58'));if(_0x5af9df['role']===_0xd084('0x57')){var _0x54d99e=_0x3e854e['get']({'plain':!![]});var _0x3f7534=[{'name':_0xd084('0x59'),'value':'inbound'},{'name':'OutboundRoutes','value':_0xd084('0x2c')},{'name':_0xd084('0x5a'),'value':_0xd084('0x2d')}];var _0x52cbf3=_[_0xd084('0x50')](_0x3f7534,['value',_0x54d99e[_0xd084('0x33')]])[_0xd084('0x34')];return db[_0xd084('0x5b')][_0xd084('0x50')]({'where':{'name':_0x52cbf3,'userProfileId':_0x5af9df['userProfileId']},'raw':!![]})[_0xd084('0x28')](function(_0x5a952b){if(_0x5a952b&&_0x5a952b[_0xd084('0x5c')]===0x0){return db[_0xd084('0x5d')]['create']({'name':_0x54d99e['name'],'resourceId':_0x54d99e['id'],'type':_0x5a952b[_0xd084('0x34')],'sectionId':_0x5a952b['id']},{})[_0xd084('0x28')](function(){return _0x3e854e;});}else{return _0x3e854e;}})['catch'](function(_0x38473e){logger['error'](_0xd084('0x5e'),_0x38473e);throw _0x38473e;});}return _0x3e854e;})[_0xd084('0x28')](respondWithResult(_0x3690de,0xc9))[_0xd084('0x4e')](handleError(_0x3690de,null));};exports[_0xd084('0x27')]=function(_0x205fa6,_0x3b8b98){if(_0x205fa6[_0xd084('0x53')]['id']){delete _0x205fa6[_0xd084('0x53')]['id'];}return db['VoiceExtension'][_0xd084('0x50')]({'where':{'id':_0x205fa6[_0xd084('0x51')]['id']}})[_0xd084('0x28')](handleEntityNotFound(_0x3b8b98,null))['then'](function(_0x1222be){if(_0x1222be){return db[_0xd084('0x3a')][_0xd084('0x27')](_[_0xd084('0x45')](_0x205fa6[_0xd084('0x53')],[_0xd084('0x55'),_0xd084('0x5f'),_0xd084('0x60'),_0xd084('0x61'),'cutdigits',_0xd084('0x62')]),{'where':{'context':_0x1222be[_0xd084('0x5f')],'exten':_0x1222be[_0xd084('0x55')]},'individualHooks':!![]})[_0xd084('0x28')](function(_0x524f60){return _0x524f60;});}return null;})[_0xd084('0x28')](respondWithStatusCode(_0x3b8b98,null))[_0xd084('0x4e')](handleError(_0x3b8b98,null));};exports[_0xd084('0x63')]=function(_0x189b2f,_0x41b53d,_0x888240){return db[_0xd084('0x3a')][_0xd084('0x64')]({'where':{'id':_0x189b2f[_0xd084('0x51')]['id']}})[_0xd084('0x28')](handleEntityNotFound(_0x41b53d,null))['then'](function(_0x56c229){if(_0x56c229){return db[_0xd084('0x65')][_0xd084('0x66')](function(_0xeed999){return db[_0xd084('0x3a')]['destroy']({'where':{'VoiceExtensionId':_0x189b2f['params']['id']},'transaction':_0xeed999})[_0xd084('0x28')](function(_0x1db089){var _0x2fe161=_[_0xd084('0x30')](_0x189b2f[_0xd084('0x53')],function(_0xc2fdce){_0xc2fdce[_0xd084('0x67')]=_0x189b2f[_0xd084('0x51')]['id'];return _0xc2fdce;});return db[_0xd084('0x3a')][_0xd084('0x68')](_0x2fe161,{'transaction':_0xeed999});});})[_0xd084('0x28')](function(){return db[_0xd084('0x3a')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x189b2f[_0xd084('0x51')]['id']},'order':_0xd084('0x69')});});}})[_0xd084('0x28')](respondWithResult(_0x41b53d,null))[_0xd084('0x4e')](handleError(_0x41b53d,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 22a7345..e3a2b89 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 _0x0424=['exports','VoiceExtension','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x5dbd80,_0x3e6717){var _0x133599=function(_0x3fc71a){while(--_0x3fc71a){_0x5dbd80['push'](_0x5dbd80['shift']());}};_0x133599(++_0x3e6717);}(_0x0424,0x159));var _0x4042=function(_0x36d703,_0x55b354){_0x36d703=_0x36d703-0x0;var _0x12c909=_0x0424[_0x36d703];return _0x12c909;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0x4042('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x4042('0x1')](0x0);var events={'afterCreate':_0x4042('0x2'),'afterUpdate':_0x4042('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3cd879){return function(_0x519987,_0x491eae,_0x20d8df){VoiceExtensionEvents[_0x4042('0x4')](_0x3cd879+':'+_0x519987['id'],_0x519987);VoiceExtensionEvents[_0x4042('0x4')](_0x3cd879,_0x519987);_0x20d8df(null);};}for(var e in events){if(events[_0x4042('0x5')](e)){var event=events[e];VoiceExtension[_0x4042('0x6')](e,emitEvent(event));}}module[_0x4042('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x96fd=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x29f10f,_0x59cb8a){var _0x2e4928=function(_0x23ad54){while(--_0x23ad54){_0x29f10f['push'](_0x29f10f['shift']());}};_0x2e4928(++_0x59cb8a);}(_0x96fd,0x147));var _0xd96f=function(_0x2c5ee9,_0x3e7989){_0x2c5ee9=_0x2c5ee9-0x0;var _0x4566af=_0x96fd[_0x2c5ee9];return _0x4566af;};'use strict';var EventEmitter=require(_0xd96f('0x0'));var VoiceExtension=require(_0xd96f('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xd96f('0x2')](0x0);var events={'afterCreate':_0xd96f('0x3'),'afterUpdate':_0xd96f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x330969){return function(_0x3f64f5,_0xc424c3,_0x1ec8d6){VoiceExtensionEvents['emit'](_0x330969+':'+_0x3f64f5['id'],_0x3f64f5);VoiceExtensionEvents[_0xd96f('0x5')](_0x330969,_0x3f64f5);_0x1ec8d6(null);};}for(var e in events){if(events[_0xd96f('0x6')](e)){var event=events[e];VoiceExtension[_0xd96f('0x7')](e,emitEvent(event));}}module[_0xd96f('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 605af55..d6c0a63 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 _0x6ceb=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceExtension.attributes','define','VoiceExtension','util','../../config/logger'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0x6ceb,0x1ea));var _0xb6ce=function(_0x3f477e,_0x192651){_0x3f477e=_0x3f477e-0x0;var _0x1412a8=_0x6ceb[_0x3f477e];return _0x1412a8;};'use strict';var _=require('lodash');var util=require(_0xb6ce('0x0'));var logger=require(_0xb6ce('0x1'))(_0xb6ce('0x2'));var moment=require(_0xb6ce('0x3'));var BPromise=require(_0xb6ce('0x4'));var rp=require(_0xb6ce('0x5'));var fs=require('fs');var path=require(_0xb6ce('0x6'));var rimraf=require(_0xb6ce('0x7'));var config=require(_0xb6ce('0x8'));var attributes=require(_0xb6ce('0x9'));module['exports']=function(_0x136cef,_0x5d7662){return _0x136cef[_0xb6ce('0xa')](_0xb6ce('0xb'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2693=['./voiceExtension.attributes','exports','define','VoiceExtension','voice_extensions','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x117b18,_0x41ce7a){var _0x574ac0=function(_0x265080){while(--_0x265080){_0x117b18['push'](_0x117b18['shift']());}};_0x574ac0(++_0x41ce7a);}(_0x2693,0xf7));var _0x3269=function(_0x8a5df2,_0x43ab1b){_0x8a5df2=_0x8a5df2-0x0;var _0x2ee2b1=_0x2693[_0x8a5df2];return _0x2ee2b1;};'use strict';var _=require('lodash');var util=require(_0x3269('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3269('0x1'));var BPromise=require('bluebird');var rp=require(_0x3269('0x2'));var fs=require('fs');var path=require(_0x3269('0x3'));var rimraf=require(_0x3269('0x4'));var config=require(_0x3269('0x5'));var attributes=require(_0x3269('0x6'));module[_0x3269('0x7')]=function(_0x50256a,_0x4fa4d7){return _0x50256a[_0x3269('0x8')](_0x3269('0x9'),attributes,{'tableName':_0x3269('0xa'),'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 7211760..22ce0fd 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 _0x011b=['include','model','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','map','attributes'];(function(_0x737879,_0x291513){var _0x61c4e9=function(_0x295263){while(--_0x295263){_0x737879['push'](_0x737879['shift']());}};_0x61c4e9(++_0x291513);}(_0x011b,0x1a5));var _0xb011=function(_0x578e7f,_0x51b4cd){_0x578e7f=_0x578e7f-0x0;var _0x3007cd=_0x011b[_0x578e7f];return _0x3007cd;};'use strict';var _=require(_0xb011('0x0'));var util=require('util');var moment=require(_0xb011('0x1'));var BPromise=require(_0xb011('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb011('0x3'));var db=require(_0xb011('0x4'))['db'];var utils=require(_0xb011('0x5'));var logger=require(_0xb011('0x6'))(_0xb011('0x7'));var config=require('../../config/environment');var jayson=require(_0xb011('0x8'));var client=jayson[_0xb011('0x9')][_0xb011('0xa')]({'port':0x232a});config['redis']=_[_0xb011('0xb')](config[_0xb011('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb011('0xd'))(new Redis(config[_0xb011('0xc')]));require(_0xb011('0xe'))['register'](socket);function respondWithRpcPromise(_0x2604f2,_0x36cdcd,_0x47378d){return new BPromise(function(_0x103527,_0x3fc101){return client[_0xb011('0xf')](_0x2604f2,_0x47378d)[_0xb011('0x10')](function(_0x42e71b){logger[_0xb011('0x11')](_0xb011('0x12'),_0x36cdcd,_0xb011('0x13'));logger['debug'](_0xb011('0x14'),_0x36cdcd,_0xb011('0x13'),JSON[_0xb011('0x15')](_0x42e71b));if(_0x42e71b[_0xb011('0x16')]){if(_0x42e71b['error'][_0xb011('0x17')]===0x1f4){logger[_0xb011('0x16')](_0xb011('0x12'),_0x36cdcd,_0x42e71b[_0xb011('0x16')]['message']);return _0x3fc101(_0x42e71b[_0xb011('0x16')][_0xb011('0x18')]);}logger['error'](_0xb011('0x12'),_0x36cdcd,_0x42e71b[_0xb011('0x16')][_0xb011('0x18')]);return _0x103527(_0x42e71b[_0xb011('0x16')][_0xb011('0x18')]);}else{logger[_0xb011('0x11')](_0xb011('0x12'),_0x36cdcd,_0xb011('0x13'));_0x103527(_0x42e71b['result'][_0xb011('0x18')]);}})[_0xb011('0x19')](function(_0x10f758){logger[_0xb011('0x16')](_0xb011('0x12'),_0x36cdcd,_0x10f758);_0x3fc101(_0x10f758);});});}exports[_0xb011('0x1a')]=function(_0x48a752){var _0x54f8fa=this;return new Promise(function(_0x429a6a,_0x5ecae1){return db[_0xb011('0x1b')][_0xb011('0x1c')]({'raw':_0x48a752[_0xb011('0x1d')]?_0x48a752['options'][_0xb011('0x1e')]===undefined?!![]:![]:!![],'where':_0x48a752[_0xb011('0x1d')]?_0x48a752['options'][_0xb011('0x1f')]||null:null,'attributes':_0x48a752[_0xb011('0x1d')]?_0x48a752[_0xb011('0x1d')]['attributes']||null:null,'limit':_0x48a752[_0xb011('0x1d')]?_0x48a752['options'][_0xb011('0x20')]||null:null,'include':_0x48a752[_0xb011('0x1d')]?_0x48a752[_0xb011('0x1d')]['include']?_[_0xb011('0x21')](_0x48a752[_0xb011('0x1d')]['include'],function(_0x13b142){return{'model':db[_0x13b142['model']],'as':_0x13b142['as'],'attributes':_0x13b142[_0xb011('0x22')],'include':_0x13b142[_0xb011('0x23')]?_[_0xb011('0x21')](_0x13b142['include'],function(_0x639c7e){return{'model':db[_0x639c7e[_0xb011('0x24')]],'as':_0x639c7e['as'],'attributes':_0x639c7e[_0xb011('0x22')],'include':_0x639c7e['include']?_[_0xb011('0x21')](_0x639c7e[_0xb011('0x23')],function(_0x4185ec){return{'model':db[_0x4185ec[_0xb011('0x24')]],'as':_0x4185ec['as'],'attributes':_0x4185ec[_0xb011('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb011('0x10')](function(_0x50fd70){logger[_0xb011('0x11')](_0xb011('0x1a'),_0x48a752);logger[_0xb011('0x25')]('GetVoiceExtension',_0x48a752,JSON[_0xb011('0x15')](_0x50fd70));_0x429a6a(_0x50fd70);})[_0xb011('0x19')](function(_0x3c8db0){logger[_0xb011('0x16')](_0xb011('0x1a'),_0x3c8db0['message'],_0x48a752);_0x5ecae1(_0x54f8fa[_0xb011('0x16')](0x1f4,_0x3c8db0['message']));});});}; \ No newline at end of file +var _0x231a=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','limit','include','model','map','attributes','moment'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x231a,0x6e));var _0xa231=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x231a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa231('0x0'));var BPromise=require(_0xa231('0x1'));var rs=require(_0xa231('0x2'));var fs=require('fs');var Redis=require(_0xa231('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa231('0x4'));var logger=require(_0xa231('0x5'))(_0xa231('0x6'));var config=require(_0xa231('0x7'));var jayson=require(_0xa231('0x8'));var client=jayson[_0xa231('0x9')][_0xa231('0xa')]({'port':0x232a});config[_0xa231('0xb')]=_['defaults'](config[_0xa231('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa231('0xc'))(new Redis(config[_0xa231('0xb')]));require(_0xa231('0xd'))[_0xa231('0xe')](socket);function respondWithRpcPromise(_0x3d56d2,_0x2ace99,_0x1f9565){return new BPromise(function(_0x4e210f,_0x554362){return client[_0xa231('0xf')](_0x3d56d2,_0x1f9565)[_0xa231('0x10')](function(_0x2a32d9){logger['info'](_0xa231('0x11'),_0x2ace99,_0xa231('0x12'));logger['debug'](_0xa231('0x13'),_0x2ace99,_0xa231('0x12'),JSON[_0xa231('0x14')](_0x2a32d9));if(_0x2a32d9[_0xa231('0x15')]){if(_0x2a32d9[_0xa231('0x15')][_0xa231('0x16')]===0x1f4){logger['error'](_0xa231('0x11'),_0x2ace99,_0x2a32d9[_0xa231('0x15')]['message']);return _0x554362(_0x2a32d9[_0xa231('0x15')][_0xa231('0x17')]);}logger[_0xa231('0x15')](_0xa231('0x11'),_0x2ace99,_0x2a32d9[_0xa231('0x15')]['message']);return _0x4e210f(_0x2a32d9[_0xa231('0x15')][_0xa231('0x17')]);}else{logger[_0xa231('0x18')](_0xa231('0x11'),_0x2ace99,_0xa231('0x12'));_0x4e210f(_0x2a32d9[_0xa231('0x19')]['message']);}})[_0xa231('0x1a')](function(_0x38896a){logger[_0xa231('0x15')](_0xa231('0x11'),_0x2ace99,_0x38896a);_0x554362(_0x38896a);});});}exports[_0xa231('0x1b')]=function(_0x336345){var _0x208060=this;return new Promise(function(_0x7a4dd3,_0x5571a5){return db[_0xa231('0x1c')][_0xa231('0x1d')]({'raw':_0x336345['options']?_0x336345[_0xa231('0x1e')][_0xa231('0x1f')]===undefined?!![]:![]:!![],'where':_0x336345[_0xa231('0x1e')]?_0x336345['options']['where']||null:null,'attributes':_0x336345[_0xa231('0x1e')]?_0x336345[_0xa231('0x1e')]['attributes']||null:null,'limit':_0x336345['options']?_0x336345[_0xa231('0x1e')][_0xa231('0x20')]||null:null,'include':_0x336345[_0xa231('0x1e')]?_0x336345[_0xa231('0x1e')]['include']?_['map'](_0x336345[_0xa231('0x1e')][_0xa231('0x21')],function(_0x1daaa1){return{'model':db[_0x1daaa1[_0xa231('0x22')]],'as':_0x1daaa1['as'],'attributes':_0x1daaa1['attributes'],'include':_0x1daaa1['include']?_[_0xa231('0x23')](_0x1daaa1[_0xa231('0x21')],function(_0x5baf9f){return{'model':db[_0x5baf9f[_0xa231('0x22')]],'as':_0x5baf9f['as'],'attributes':_0x5baf9f[_0xa231('0x24')],'include':_0x5baf9f[_0xa231('0x21')]?_[_0xa231('0x23')](_0x5baf9f[_0xa231('0x21')],function(_0x5ad205){return{'model':db[_0x5ad205['model']],'as':_0x5ad205['as'],'attributes':_0x5ad205[_0xa231('0x24')]};}):[]};}):[]};}):[]:[]})[_0xa231('0x10')](function(_0x9320ed){logger[_0xa231('0x18')](_0xa231('0x1b'),_0x336345);logger['debug'](_0xa231('0x1b'),_0x336345,JSON[_0xa231('0x14')](_0x9320ed));_0x7a4dd3(_0x9320ed);})[_0xa231('0x1a')](function(_0x1ed8e0){logger[_0xa231('0x15')](_0xa231('0x1b'),_0x1ed8e0[_0xa231('0x17')],_0x336345);_0x5571a5(_0x208060[_0xa231('0x15')](0x1f4,_0x1ed8e0[_0xa231('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 31342a6..03022d3 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 _0x6025=['register','length','voiceExtension:','./voiceExtension.events','save','remove','emit','removeListener'];(function(_0x3211ac,_0x490976){var _0x5380f0=function(_0x28bf60){while(--_0x28bf60){_0x3211ac['push'](_0x3211ac['shift']());}};_0x5380f0(++_0x490976);}(_0x6025,0xe3));var _0x5602=function(_0x1b885e,_0x12252d){_0x1b885e=_0x1b885e-0x0;var _0x23080e=_0x6025[_0x1b885e];return _0x23080e;};'use strict';var VoiceExtensionEvents=require(_0x5602('0x0'));var events=[_0x5602('0x1'),_0x5602('0x2'),'update'];function createListener(_0xe1a935,_0x2c0e5d){return function(_0x5e4bcb){_0x2c0e5d[_0x5602('0x3')](_0xe1a935,_0x5e4bcb);};}function removeListener(_0x40cae8,_0x4715a4){return function(){VoiceExtensionEvents[_0x5602('0x4')](_0x40cae8,_0x4715a4);};}exports[_0x5602('0x5')]=function(_0x2cb3ad){for(var _0x4add10=0x0,_0x599994=events[_0x5602('0x6')];_0x4add10<_0x599994;_0x4add10++){var _0x25a776=events[_0x4add10];var _0x506585=createListener(_0x5602('0x7')+_0x25a776,_0x2cb3ad);VoiceExtensionEvents['on'](_0x25a776,_0x506585);}}; \ No newline at end of file +var _0xd372=['save','remove','update','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events'];(function(_0x21cb7f,_0x48cd16){var _0x5a079a=function(_0x569a4f){while(--_0x569a4f){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x5a079a(++_0x48cd16);}(_0xd372,0xfb));var _0x2d37=function(_0x31a83b,_0x5e3243){_0x31a83b=_0x31a83b-0x0;var _0x14710a=_0xd372[_0x31a83b];return _0x14710a;};'use strict';var VoiceExtensionEvents=require(_0x2d37('0x0'));var events=[_0x2d37('0x1'),_0x2d37('0x2'),_0x2d37('0x3')];function createListener(_0xba49e5,_0x2ca8ae){return function(_0x21f832){_0x2ca8ae[_0x2d37('0x4')](_0xba49e5,_0x21f832);};}function removeListener(_0x3509fb,_0x7342c7){return function(){VoiceExtensionEvents[_0x2d37('0x5')](_0x3509fb,_0x7342c7);};}exports[_0x2d37('0x6')]=function(_0x1f0808){for(var _0x1e1fa3=0x0,_0x4c6114=events[_0x2d37('0x7')];_0x1e1fa3<_0x4c6114;_0x1e1fa3++){var _0x254cef=events[_0x1e1fa3];var _0x54ae34=createListener(_0x2d37('0x8')+_0x254cef,_0x1f0808);VoiceExtensionEvents['on'](_0x254cef,_0x54ae34);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 0a0e3a1..14e9ba1 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 _0x9158=['getMessages','post','create','update','delete','destroy','multer','util','path','express','fs-extra','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages'];(function(_0x4cedd3,_0x1db030){var _0x5349e8=function(_0x3ccd3e){while(--_0x3ccd3e){_0x4cedd3['push'](_0x4cedd3['shift']());}};_0x5349e8(++_0x1db030);}(_0x9158,0x16e));var _0x8915=function(_0x222ae9,_0x12d6a1){_0x222ae9=_0x222ae9-0x0;var _0x5edf9b=_0x9158[_0x222ae9];return _0x5edf9b;};'use strict';var multer=require(_0x8915('0x0'));var util=require(_0x8915('0x1'));var path=require(_0x8915('0x2'));var timeout=require('connect-timeout');var express=require(_0x8915('0x3'));var router=express['Router']();var fs_extra=require(_0x8915('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8915('0x5'));var controller=require(_0x8915('0x6'));router[_0x8915('0x7')]('/',auth[_0x8915('0x8')](),controller[_0x8915('0x9')]);router[_0x8915('0x7')](_0x8915('0xa'),auth[_0x8915('0x8')](),controller['show']);router[_0x8915('0x7')](_0x8915('0xb'),auth[_0x8915('0x8')](),controller[_0x8915('0xc')]);router[_0x8915('0xd')]('/',auth[_0x8915('0x8')](),controller[_0x8915('0xe')]);router['put']('/:id',auth[_0x8915('0x8')](),controller[_0x8915('0xf')]);router[_0x8915('0x10')](_0x8915('0xa'),auth[_0x8915('0x8')](),controller[_0x8915('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9efc=['getMessages','post','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/messages'];(function(_0x31ab0c,_0x86235b){var _0x23130c=function(_0x49aa3b){while(--_0x49aa3b){_0x31ab0c['push'](_0x31ab0c['shift']());}};_0x23130c(++_0x86235b);}(_0x9efc,0x19c));var _0xc9ef=function(_0x10edeb,_0x1b93b8){_0x10edeb=_0x10edeb-0x0;var _0x1c5fea=_0x9efc[_0x10edeb];return _0x1c5fea;};'use strict';var multer=require(_0xc9ef('0x0'));var util=require(_0xc9ef('0x1'));var path=require(_0xc9ef('0x2'));var timeout=require(_0xc9ef('0x3'));var express=require(_0xc9ef('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc9ef('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc9ef('0x6'));var controller=require('./voiceMail.controller');router[_0xc9ef('0x7')]('/',auth['isAuthenticated'](),controller[_0xc9ef('0x8')]);router[_0xc9ef('0x7')](_0xc9ef('0x9'),auth[_0xc9ef('0xa')](),controller[_0xc9ef('0xb')]);router[_0xc9ef('0x7')](_0xc9ef('0xc'),auth[_0xc9ef('0xa')](),controller[_0xc9ef('0xd')]);router[_0xc9ef('0xe')]('/',auth[_0xc9ef('0xa')](),controller['create']);router['put'](_0xc9ef('0x9'),auth['isAuthenticated'](),controller[_0xc9ef('0xf')]);router['delete'](_0xc9ef('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xc9ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 2d11c9f..fd7dfe6 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 _0x0713=['trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0x1551bc,_0x334b59){var _0x228deb=function(_0x15551d){while(--_0x15551d){_0x1551bc['push'](_0x1551bc['shift']());}};_0x228deb(++_0x334b59);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x3071('0x0')]},'context':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x1'),'unique':_0x3071('0x2')},'mailbox':{'type':Sequelize[_0x3071('0x0')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x3071('0x0')]},'fullname':{'type':Sequelize[_0x3071('0x0')]},'email':{'type':Sequelize[_0x3071('0x0')],'validate':{'isEmail':!![]},'set':function(_0x3137c8){this[_0x3071('0x3')](_0x3071('0x4'),typeof _0x3137c8===_0x3071('0x5')&&_0x3137c8[_0x3071('0x6')]()?_0x3137c8[_0x3071('0x6')]():null);}},'pager':{'type':Sequelize[_0x3071('0x0')]},'tz':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x7')},'attach':{'type':Sequelize[_0x3071('0x8')]('yes','no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x3071('0x0')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3071('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'stamp':{'type':_0x3071('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x3071('0x0')]},'maxsecs':{'type':Sequelize[_0x3071('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3071('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x3071('0xc')],'get':function(){return this[_0x3071('0xd')](_0x3071('0xe'))+_0x3071('0xf')+this[_0x3071('0xd')]('mailbox');}}}; \ No newline at end of file +var _0x34b7=['TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','yes','ENUM','TINYINT(4)'];(function(_0x18a2ab,_0x1f1a6f){var _0x47b3be=function(_0x5ef450){while(--_0x5ef450){_0x18a2ab['push'](_0x18a2ab['shift']());}};_0x47b3be(++_0x1f1a6f);}(_0x34b7,0x196));var _0x734b=function(_0x863840,_0x2387fe){_0x863840=_0x863840-0x0;var _0x5183b0=_0x34b7[_0x863840];return _0x5183b0;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x734b('0x0')]},'context':{'type':Sequelize[_0x734b('0x0')],'defaultValue':_0x734b('0x1'),'unique':_0x734b('0x2')},'mailbox':{'type':Sequelize[_0x734b('0x0')],'defaultValue':'','allowNull':![],'unique':_0x734b('0x2')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x734b('0x0')],'validate':{'isEmail':!![]},'set':function(_0x2fde69){this[_0x734b('0x3')](_0x734b('0x4'),typeof _0x2fde69===_0x734b('0x5')&&_0x2fde69[_0x734b('0x6')]()?_0x2fde69['trim']():null);}},'pager':{'type':Sequelize[_0x734b('0x0')]},'tz':{'type':Sequelize[_0x734b('0x0')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x734b('0x7'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x734b('0x7'),'no'),'defaultValue':_0x734b('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x734b('0x0')]},'callback':{'type':Sequelize[_0x734b('0x0')]},'review':{'type':Sequelize[_0x734b('0x8')](_0x734b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x734b('0x8')](_0x734b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x734b('0x8')](_0x734b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x734b('0x8')](_0x734b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x734b('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x734b('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x734b('0x8')](_0x734b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x734b('0x8')](_0x734b('0x7'),'no'),'defaultValue':_0x734b('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x734b('0x8')](_0x734b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x734b('0x8')](_0x734b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x734b('0x8')](_0x734b('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x734b('0xa')},'emailsubject':{'type':Sequelize[_0x734b('0x0')]},'emailbody':{'type':Sequelize[_0x734b('0x0')]},'maxsecs':{'type':Sequelize[_0x734b('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x734b('0xc')](_0x734b('0xd'))+_0x734b('0xe')+this[_0x734b('0xc')](_0x734b('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 58dc93a..6e27ffd 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 _0x1d9f=['Content-Range','json','apply','save','update','destroy','then','Voicemails','UserProfileResource','error','stack','name','index','map','VoiceMail','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','VoiceMailMessage','nolimit','mailbox','findAndCountAll','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set'];(function(_0x4fe38b,_0x7de59c){var _0x7599e2=function(_0x5e5196){while(--_0x5e5196){_0x4fe38b['push'](_0x4fe38b['shift']());}};_0x7599e2(++_0x7de59c);}(_0x1d9f,0x1a6));var _0xf1d9=function(_0x3511c8,_0x1574cf){_0x3511c8=_0x3511c8-0x0;var _0x1e0826=_0x1d9f[_0x3511c8];return _0x1e0826;};'use strict';var emlformat=require(_0xf1d9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf1d9('0x1'));var rp=require(_0xf1d9('0x2'));var moment=require(_0xf1d9('0x3'));var BPromise=require(_0xf1d9('0x4'));var Mustache=require(_0xf1d9('0x5'));var util=require(_0xf1d9('0x6'));var path=require(_0xf1d9('0x7'));var sox=require(_0xf1d9('0x8'));var csv=require(_0xf1d9('0x9'));var ejs=require(_0xf1d9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf1d9('0xb'));var squel=require(_0xf1d9('0xc'));var crypto=require(_0xf1d9('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf1d9('0x9'));var querystring=require('querystring');var Papa=require(_0xf1d9('0xe'));var Redis=require(_0xf1d9('0xf'));var authService=require(_0xf1d9('0x10'));var qs=require(_0xf1d9('0x11'));var as=require(_0xf1d9('0x12'));var hardwareService=require(_0xf1d9('0x13'));var logger=require(_0xf1d9('0x14'))(_0xf1d9('0x15'));var utils=require(_0xf1d9('0x16'));var config=require(_0xf1d9('0x17'));var licenseUtil=require(_0xf1d9('0x18'));var db=require(_0xf1d9('0x19'))['db'];function respondWithStatusCode(_0x43c47a,_0x539a84){_0x539a84=_0x539a84||0xcc;return function(_0x40e20d){if(_0x40e20d){return _0x43c47a[_0xf1d9('0x1a')](_0x539a84);}return _0x43c47a[_0xf1d9('0x1b')](_0x539a84)[_0xf1d9('0x1c')]();};}function respondWithResult(_0x900198,_0x1d5ac6){_0x1d5ac6=_0x1d5ac6||0xc8;return function(_0x186591){if(_0x186591){return _0x900198['status'](_0x1d5ac6)['json'](_0x186591);}};}function respondWithFilteredResult(_0x11c47f,_0x36c51){return function(_0x6880dc){if(_0x6880dc){var _0x463168=typeof _0x36c51[_0xf1d9('0x1d')]==='undefined'&&typeof _0x36c51[_0xf1d9('0x1e')]==='undefined';var _0x379475=_0x6880dc[_0xf1d9('0x1f')];var _0x1d4199=_0x463168?0x0:_0x36c51[_0xf1d9('0x1d')];var _0x661e3a=_0x463168?_0x6880dc['count']:_0x36c51[_0xf1d9('0x1d')]+_0x36c51[_0xf1d9('0x1e')];var _0x5a6932;if(_0x661e3a>=_0x379475){_0x661e3a=_0x379475;_0x5a6932=0xc8;}else{_0x5a6932=0xce;}_0x11c47f[_0xf1d9('0x1b')](_0x5a6932);return _0x11c47f[_0xf1d9('0x20')](_0xf1d9('0x21'),_0x1d4199+'-'+_0x661e3a+'/'+_0x379475)[_0xf1d9('0x22')](_0x6880dc);}return null;};}function patchUpdates(_0x3350c9){return function(_0x148b69){try{jsonpatch[_0xf1d9('0x23')](_0x148b69,_0x3350c9,!![]);}catch(_0x104aff){return BPromise['reject'](_0x104aff);}return _0x148b69[_0xf1d9('0x24')]();};}function saveUpdates(_0x438b9f,_0xa0de09){return function(_0x268872){if(_0x268872){return _0x268872[_0xf1d9('0x25')](_0x438b9f)['then'](function(_0x470f9a){return _0x470f9a;});}return null;};}function removeEntity(_0x14d042,_0x25baa5){return function(_0x1e93c0){if(_0x1e93c0){return _0x1e93c0[_0xf1d9('0x26')]()[_0xf1d9('0x27')](function(){var _0x2d41e9=_0x1e93c0['get']({'plain':!![]});var _0x3e69a5=_0xf1d9('0x28');return db[_0xf1d9('0x29')][_0xf1d9('0x26')]({'where':{'type':_0x3e69a5,'resourceId':_0x2d41e9['id']}})[_0xf1d9('0x27')](function(){return _0x1e93c0;});})[_0xf1d9('0x27')](function(){_0x14d042[_0xf1d9('0x1b')](0xcc)[_0xf1d9('0x1c')]();});}};}function handleEntityNotFound(_0x5a85e5,_0x532fd2){return function(_0x5ab247){if(!_0x5ab247){_0x5a85e5['sendStatus'](0x194);}return _0x5ab247;};}function handleError(_0x3d67e1,_0x405d73){_0x405d73=_0x405d73||0x1f4;return function(_0x20ac99){logger[_0xf1d9('0x2a')](_0x20ac99[_0xf1d9('0x2b')]);if(_0x20ac99[_0xf1d9('0x2c')]){delete _0x20ac99[_0xf1d9('0x2c')];}_0x3d67e1[_0xf1d9('0x1b')](_0x405d73)['send'](_0x20ac99);};}exports[_0xf1d9('0x2d')]=function(_0xa8f758,_0x53a19b){var _0x17ebbd={},_0x5cc073={},_0x526864={'count':0x0,'rows':[]};var _0x2b52fb=_[_0xf1d9('0x2e')](db[_0xf1d9('0x2f')]['rawAttributes'],function(_0x4d8828){return{'name':_0x4d8828[_0xf1d9('0x30')],'type':_0x4d8828[_0xf1d9('0x31')][_0xf1d9('0x32')]};});_0x5cc073[_0xf1d9('0x33')]=_[_0xf1d9('0x2e')](_0x2b52fb,_0xf1d9('0x2c'));_0x5cc073[_0xf1d9('0x34')]=_[_0xf1d9('0x35')](_0xa8f758[_0xf1d9('0x34')]);_0x5cc073[_0xf1d9('0x36')]=_[_0xf1d9('0x37')](_0x5cc073[_0xf1d9('0x33')],_0x5cc073['query']);_0x17ebbd[_0xf1d9('0x38')]=_[_0xf1d9('0x37')](_0x5cc073['model'],qs[_0xf1d9('0x39')](_0xa8f758[_0xf1d9('0x34')][_0xf1d9('0x39')]));_0x17ebbd[_0xf1d9('0x38')]=_0x17ebbd['attributes'][_0xf1d9('0x3a')]?_0x17ebbd[_0xf1d9('0x38')]:_0x5cc073[_0xf1d9('0x33')];if(!_0xa8f758[_0xf1d9('0x34')][_0xf1d9('0x3b')]('nolimit')){_0x17ebbd[_0xf1d9('0x1e')]=qs[_0xf1d9('0x1e')](_0xa8f758[_0xf1d9('0x34')]['limit']);_0x17ebbd[_0xf1d9('0x1d')]=qs[_0xf1d9('0x1d')](_0xa8f758[_0xf1d9('0x34')]['offset']);}_0x17ebbd[_0xf1d9('0x3c')]=qs[_0xf1d9('0x3d')](_0xa8f758[_0xf1d9('0x34')][_0xf1d9('0x3d')]);_0x17ebbd[_0xf1d9('0x3e')]=qs[_0xf1d9('0x36')](_[_0xf1d9('0x3f')](_0xa8f758[_0xf1d9('0x34')],_0x5cc073[_0xf1d9('0x36')]),_0x2b52fb);if(_0xa8f758[_0xf1d9('0x34')][_0xf1d9('0x40')]){_0x17ebbd[_0xf1d9('0x3e')]=_[_0xf1d9('0x41')](_0x17ebbd[_0xf1d9('0x3e')],{'$or':_[_0xf1d9('0x2e')](_0x2b52fb,function(_0xcb9ca4){if(_0xcb9ca4[_0xf1d9('0x31')]!==_0xf1d9('0x42')){var _0x4ef79c={};_0x4ef79c[_0xcb9ca4[_0xf1d9('0x2c')]]={'$like':'%'+_0xa8f758['query'][_0xf1d9('0x40')]+'%'};return _0x4ef79c;}})});}_0x17ebbd=_[_0xf1d9('0x41')]({},_0x17ebbd,_0xa8f758[_0xf1d9('0x43')]);var _0x800252={'where':_0x17ebbd[_0xf1d9('0x3e')]};return db[_0xf1d9('0x2f')]['count'](_0x800252)['then'](function(_0x416ab8){_0x526864[_0xf1d9('0x1f')]=_0x416ab8;if(_0xa8f758[_0xf1d9('0x34')][_0xf1d9('0x44')]){_0x17ebbd[_0xf1d9('0x45')]=[{'all':!![]}];}return db[_0xf1d9('0x2f')][_0xf1d9('0x46')](_0x17ebbd);})[_0xf1d9('0x27')](function(_0x3564dc){_0x526864[_0xf1d9('0x47')]=_0x3564dc;return _0x526864;})[_0xf1d9('0x27')](respondWithFilteredResult(_0x53a19b,_0x17ebbd))[_0xf1d9('0x48')](handleError(_0x53a19b,null));};exports[_0xf1d9('0x49')]=function(_0x1cb414,_0x5cf5ea){var _0xc4a8f1={'raw':!![],'where':{'id':_0x1cb414[_0xf1d9('0x4a')]['id']}},_0x51431e={};_0x51431e[_0xf1d9('0x33')]=_[_0xf1d9('0x35')](db['VoiceMail'][_0xf1d9('0x4b')]);_0x51431e[_0xf1d9('0x34')]=_[_0xf1d9('0x35')](_0x1cb414[_0xf1d9('0x34')]);_0x51431e[_0xf1d9('0x36')]=_[_0xf1d9('0x37')](_0x51431e[_0xf1d9('0x33')],_0x51431e[_0xf1d9('0x34')]);_0xc4a8f1[_0xf1d9('0x38')]=_[_0xf1d9('0x37')](_0x51431e['model'],qs[_0xf1d9('0x39')](_0x1cb414[_0xf1d9('0x34')][_0xf1d9('0x39')]));_0xc4a8f1[_0xf1d9('0x38')]=_0xc4a8f1[_0xf1d9('0x38')][_0xf1d9('0x3a')]?_0xc4a8f1[_0xf1d9('0x38')]:_0x51431e[_0xf1d9('0x33')];if(_0x1cb414[_0xf1d9('0x34')][_0xf1d9('0x44')]){_0xc4a8f1[_0xf1d9('0x45')]=[{'all':!![]}];}_0xc4a8f1=_['merge']({},_0xc4a8f1,_0x1cb414[_0xf1d9('0x43')]);return db[_0xf1d9('0x2f')][_0xf1d9('0x4c')](_0xc4a8f1)[_0xf1d9('0x27')](handleEntityNotFound(_0x5cf5ea,null))[_0xf1d9('0x27')](respondWithResult(_0x5cf5ea,null))[_0xf1d9('0x48')](handleError(_0x5cf5ea,null));};exports[_0xf1d9('0x4d')]=function(_0x284ae3,_0x19aa99){return db[_0xf1d9('0x2f')][_0xf1d9('0x4d')](_0x284ae3[_0xf1d9('0x4e')],{})[_0xf1d9('0x27')](function(_0x5c0418){var _0x3e7843=_0x284ae3['user']['get']({'plain':!![]});if(!_0x3e7843)throw new Error(_0xf1d9('0x4f'));if(_0x3e7843[_0xf1d9('0x50')]===_0xf1d9('0x51')){var _0x4ced74=_0x5c0418[_0xf1d9('0x52')]({'plain':!![]});var _0x44cf2d=_0xf1d9('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x44cf2d,'userProfileId':_0x3e7843[_0xf1d9('0x53')]},'raw':!![]})['then'](function(_0x434d59){if(_0x434d59&&_0x434d59[_0xf1d9('0x54')]===0x0){return db[_0xf1d9('0x29')]['create']({'name':_0x4ced74[_0xf1d9('0x2c')],'resourceId':_0x4ced74['id'],'type':_0x434d59[_0xf1d9('0x2c')],'sectionId':_0x434d59['id']},{})[_0xf1d9('0x27')](function(){return _0x5c0418;});}else{return _0x5c0418;}})[_0xf1d9('0x48')](function(_0x30a009){logger['error'](_0xf1d9('0x55'),_0x30a009);throw _0x30a009;});}return _0x5c0418;})[_0xf1d9('0x27')](respondWithResult(_0x19aa99,0xc9))['catch'](handleError(_0x19aa99,null));};exports[_0xf1d9('0x25')]=function(_0x5d2541,_0x2c8f57){if(_0x5d2541[_0xf1d9('0x4e')]['id']){delete _0x5d2541[_0xf1d9('0x4e')]['id'];}return db[_0xf1d9('0x2f')][_0xf1d9('0x4c')]({'where':{'id':_0x5d2541[_0xf1d9('0x4a')]['id']}})[_0xf1d9('0x27')](handleEntityNotFound(_0x2c8f57,null))['then'](saveUpdates(_0x5d2541[_0xf1d9('0x4e')],null))[_0xf1d9('0x27')](respondWithResult(_0x2c8f57,null))['catch'](handleError(_0x2c8f57,null));};exports['destroy']=function(_0x72c012,_0x907a15){return db[_0xf1d9('0x2f')][_0xf1d9('0x4c')]({'where':{'id':_0x72c012['params']['id']}})[_0xf1d9('0x27')](handleEntityNotFound(_0x907a15,null))[_0xf1d9('0x27')](removeEntity(_0x907a15,null))[_0xf1d9('0x48')](handleError(_0x907a15,null));};exports[_0xf1d9('0x56')]=function(_0x163e6a,_0x181414,_0x1b0d96){return db[_0xf1d9('0x2f')]['findOne']({'where':{'id':_0x163e6a[_0xf1d9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x181414,null))[_0xf1d9('0x27')](function(_0x5c7b5e){var _0x50fe8f;var _0x44d4c2={},_0x53efc7={};_0x53efc7[_0xf1d9('0x33')]=_['keys'](db[_0xf1d9('0x57')]['rawAttributes']);_0x53efc7[_0xf1d9('0x34')]=_[_0xf1d9('0x35')](_0x163e6a[_0xf1d9('0x34')]);_0x53efc7['filters']=_['intersection'](_0x53efc7['model'],_0x53efc7[_0xf1d9('0x34')]);_0x44d4c2[_0xf1d9('0x38')]=_[_0xf1d9('0x37')](_0x53efc7['model'],qs['fields'](_0x163e6a[_0xf1d9('0x34')]['fields']));_0x44d4c2[_0xf1d9('0x38')]=_0x44d4c2[_0xf1d9('0x38')][_0xf1d9('0x3a')]?_0x44d4c2['attributes']:_0x53efc7[_0xf1d9('0x33')];if(!_0x163e6a['query'][_0xf1d9('0x3b')](_0xf1d9('0x58'))){_0x44d4c2[_0xf1d9('0x1e')]=qs[_0xf1d9('0x1e')](_0x163e6a[_0xf1d9('0x34')]['limit']);_0x44d4c2['offset']=qs[_0xf1d9('0x1d')](_0x163e6a[_0xf1d9('0x34')][_0xf1d9('0x1d')]);}_0x44d4c2[_0xf1d9('0x3c')]=qs[_0xf1d9('0x3d')](_0x163e6a['query']['sort']);_0x44d4c2[_0xf1d9('0x3e')]=qs[_0xf1d9('0x36')](_[_0xf1d9('0x3f')](_0x163e6a[_0xf1d9('0x34')],_0x53efc7[_0xf1d9('0x36')]));if(_0x163e6a['query'][_0xf1d9('0x40')]){_0x44d4c2[_0xf1d9('0x3e')]=_[_0xf1d9('0x41')](_0x44d4c2[_0xf1d9('0x3e')],{'$or':_[_0xf1d9('0x2e')](_0x44d4c2['attributes'],function(_0x309e6e){var _0x8cf9e6={};_0x8cf9e6[_0x309e6e]={'$like':'%'+_0x163e6a['query'][_0xf1d9('0x40')]+'%'};return _0x8cf9e6;})});}_0x44d4c2[_0xf1d9('0x3e')]=_['merge'](_0x44d4c2[_0xf1d9('0x3e')],{'mailboxuser':_0x5c7b5e[_0xf1d9('0x59')]});_0x44d4c2=_['merge']({},_0x44d4c2,_0x163e6a['options']);return db[_0xf1d9('0x57')][_0xf1d9('0x5a')](_0x44d4c2)[_0xf1d9('0x27')](respondWithFilteredResult(_0x181414,_0x44d4c2));})[_0xf1d9('0x48')](handleError(_0x181414,null));}; \ No newline at end of file +var _0xc0c4=['util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','error','stack','name','send','index','VoiceMail','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','map','type','VIRTUAL','filter','then','includeAll','include','rows','catch','show','params','find','create','body','get','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','findOne','VoiceMailMessage','length','options','findAndCountAll','eml-format','rimraf','request-promise','moment','mustache'];(function(_0x3c706f,_0x24b2b6){var _0x914b=function(_0x372ccc){while(--_0x372ccc){_0x3c706f['push'](_0x3c706f['shift']());}};_0x914b(++_0x24b2b6);}(_0xc0c4,0x1b3));var _0x4c0c=function(_0x2c7c69,_0x3079ee){_0x2c7c69=_0x2c7c69-0x0;var _0x55fdaf=_0xc0c4[_0x2c7c69];return _0x55fdaf;};'use strict';var emlformat=require(_0x4c0c('0x0'));var rimraf=require(_0x4c0c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4c0c('0x2'));var moment=require(_0x4c0c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4c0c('0x4'));var util=require(_0x4c0c('0x5'));var path=require(_0x4c0c('0x6'));var sox=require(_0x4c0c('0x7'));var csv=require(_0x4c0c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c0c('0x9'));var _=require(_0x4c0c('0xa'));var squel=require(_0x4c0c('0xb'));var crypto=require(_0x4c0c('0xc'));var jsforce=require(_0x4c0c('0xd'));var deskjs=require(_0x4c0c('0xe'));var toCsv=require(_0x4c0c('0x8'));var querystring=require('querystring');var Papa=require(_0x4c0c('0xf'));var Redis=require(_0x4c0c('0x10'));var authService=require(_0x4c0c('0x11'));var qs=require(_0x4c0c('0x12'));var as=require(_0x4c0c('0x13'));var hardwareService=require(_0x4c0c('0x14'));var logger=require(_0x4c0c('0x15'))('api');var utils=require(_0x4c0c('0x16'));var config=require(_0x4c0c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4c0c('0x18'))['db'];function respondWithStatusCode(_0x46e79e,_0x1ad9e2){_0x1ad9e2=_0x1ad9e2||0xcc;return function(_0x1a5dde){if(_0x1a5dde){return _0x46e79e[_0x4c0c('0x19')](_0x1ad9e2);}return _0x46e79e[_0x4c0c('0x1a')](_0x1ad9e2)[_0x4c0c('0x1b')]();};}function respondWithResult(_0x1cb8a6,_0x4ec70a){_0x4ec70a=_0x4ec70a||0xc8;return function(_0x56bd51){if(_0x56bd51){return _0x1cb8a6['status'](_0x4ec70a)[_0x4c0c('0x1c')](_0x56bd51);}};}function respondWithFilteredResult(_0x2dac69,_0x3a6542){return function(_0x148bb){if(_0x148bb){var _0x33a216=typeof _0x3a6542[_0x4c0c('0x1d')]===_0x4c0c('0x1e')&&typeof _0x3a6542[_0x4c0c('0x1f')]===_0x4c0c('0x1e');var _0x40c5ba=_0x148bb[_0x4c0c('0x20')];var _0x38d864=_0x33a216?0x0:_0x3a6542[_0x4c0c('0x1d')];var _0x313e5f=_0x33a216?_0x148bb['count']:_0x3a6542[_0x4c0c('0x1d')]+_0x3a6542[_0x4c0c('0x1f')];var _0x302e19;if(_0x313e5f>=_0x40c5ba){_0x313e5f=_0x40c5ba;_0x302e19=0xc8;}else{_0x302e19=0xce;}_0x2dac69['status'](_0x302e19);return _0x2dac69[_0x4c0c('0x21')](_0x4c0c('0x22'),_0x38d864+'-'+_0x313e5f+'/'+_0x40c5ba)[_0x4c0c('0x1c')](_0x148bb);}return null;};}function patchUpdates(_0x414da4){return function(_0x37646c){try{jsonpatch[_0x4c0c('0x23')](_0x37646c,_0x414da4,!![]);}catch(_0x1b6e9f){return BPromise['reject'](_0x1b6e9f);}return _0x37646c[_0x4c0c('0x24')]();};}function saveUpdates(_0x5f11ab,_0x2e731b){return function(_0x461f56){if(_0x461f56){return _0x461f56['update'](_0x5f11ab)['then'](function(_0x2f7e3d){return _0x2f7e3d;});}return null;};}function removeEntity(_0x461c73,_0x5d1716){return function(_0x4b3d08){if(_0x4b3d08){return _0x4b3d08['destroy']()['then'](function(){var _0x2f9d8b=_0x4b3d08['get']({'plain':!![]});var _0x261ece='Voicemails';return db['UserProfileResource'][_0x4c0c('0x25')]({'where':{'type':_0x261ece,'resourceId':_0x2f9d8b['id']}})['then'](function(){return _0x4b3d08;});})['then'](function(){_0x461c73[_0x4c0c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f481d,_0xd02e74){return function(_0x1062c7){if(!_0x1062c7){_0x4f481d[_0x4c0c('0x19')](0x194);}return _0x1062c7;};}function handleError(_0x3c9f46,_0x18a473){_0x18a473=_0x18a473||0x1f4;return function(_0x250fe1){logger[_0x4c0c('0x26')](_0x250fe1[_0x4c0c('0x27')]);if(_0x250fe1[_0x4c0c('0x28')]){delete _0x250fe1['name'];}_0x3c9f46[_0x4c0c('0x1a')](_0x18a473)[_0x4c0c('0x29')](_0x250fe1);};}exports[_0x4c0c('0x2a')]=function(_0x317fa4,_0x43d9c8){var _0x2ea7a5={},_0x4e95a5={},_0x44fb3d={'count':0x0,'rows':[]};var _0x48aa93=_['map'](db[_0x4c0c('0x2b')][_0x4c0c('0x2c')],function(_0x7ff3cd){return{'name':_0x7ff3cd['fieldName'],'type':_0x7ff3cd['type'][_0x4c0c('0x2d')]};});_0x4e95a5[_0x4c0c('0x2e')]=_['map'](_0x48aa93,_0x4c0c('0x28'));_0x4e95a5[_0x4c0c('0x2f')]=_[_0x4c0c('0x30')](_0x317fa4['query']);_0x4e95a5[_0x4c0c('0x31')]=_[_0x4c0c('0x32')](_0x4e95a5[_0x4c0c('0x2e')],_0x4e95a5[_0x4c0c('0x2f')]);_0x2ea7a5['attributes']=_[_0x4c0c('0x32')](_0x4e95a5['model'],qs['fields'](_0x317fa4[_0x4c0c('0x2f')][_0x4c0c('0x33')]));_0x2ea7a5[_0x4c0c('0x34')]=_0x2ea7a5[_0x4c0c('0x34')]['length']?_0x2ea7a5['attributes']:_0x4e95a5[_0x4c0c('0x2e')];if(!_0x317fa4[_0x4c0c('0x2f')][_0x4c0c('0x35')]('nolimit')){_0x2ea7a5[_0x4c0c('0x1f')]=qs[_0x4c0c('0x1f')](_0x317fa4[_0x4c0c('0x2f')][_0x4c0c('0x1f')]);_0x2ea7a5[_0x4c0c('0x1d')]=qs[_0x4c0c('0x1d')](_0x317fa4['query']['offset']);}_0x2ea7a5[_0x4c0c('0x36')]=qs[_0x4c0c('0x37')](_0x317fa4[_0x4c0c('0x2f')][_0x4c0c('0x37')]);_0x2ea7a5[_0x4c0c('0x38')]=qs[_0x4c0c('0x31')](_[_0x4c0c('0x39')](_0x317fa4[_0x4c0c('0x2f')],_0x4e95a5['filters']),_0x48aa93);if(_0x317fa4[_0x4c0c('0x2f')]['filter']){_0x2ea7a5[_0x4c0c('0x38')]=_[_0x4c0c('0x3a')](_0x2ea7a5[_0x4c0c('0x38')],{'$or':_[_0x4c0c('0x3b')](_0x48aa93,function(_0x33778f){if(_0x33778f[_0x4c0c('0x3c')]!==_0x4c0c('0x3d')){var _0x1b39de={};_0x1b39de[_0x33778f[_0x4c0c('0x28')]]={'$like':'%'+_0x317fa4[_0x4c0c('0x2f')][_0x4c0c('0x3e')]+'%'};return _0x1b39de;}})});}_0x2ea7a5=_[_0x4c0c('0x3a')]({},_0x2ea7a5,_0x317fa4['options']);var _0x2081c8={'where':_0x2ea7a5[_0x4c0c('0x38')]};return db[_0x4c0c('0x2b')]['count'](_0x2081c8)[_0x4c0c('0x3f')](function(_0x525236){_0x44fb3d[_0x4c0c('0x20')]=_0x525236;if(_0x317fa4['query'][_0x4c0c('0x40')]){_0x2ea7a5[_0x4c0c('0x41')]=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x2ea7a5);})['then'](function(_0x4caaa0){_0x44fb3d[_0x4c0c('0x42')]=_0x4caaa0;return _0x44fb3d;})['then'](respondWithFilteredResult(_0x43d9c8,_0x2ea7a5))[_0x4c0c('0x43')](handleError(_0x43d9c8,null));};exports[_0x4c0c('0x44')]=function(_0x38d991,_0x48498b){var _0x55c62f={'raw':!![],'where':{'id':_0x38d991[_0x4c0c('0x45')]['id']}},_0x59751c={};_0x59751c['model']=_[_0x4c0c('0x30')](db['VoiceMail'][_0x4c0c('0x2c')]);_0x59751c[_0x4c0c('0x2f')]=_['keys'](_0x38d991['query']);_0x59751c[_0x4c0c('0x31')]=_[_0x4c0c('0x32')](_0x59751c[_0x4c0c('0x2e')],_0x59751c['query']);_0x55c62f[_0x4c0c('0x34')]=_[_0x4c0c('0x32')](_0x59751c[_0x4c0c('0x2e')],qs['fields'](_0x38d991[_0x4c0c('0x2f')]['fields']));_0x55c62f[_0x4c0c('0x34')]=_0x55c62f[_0x4c0c('0x34')]['length']?_0x55c62f[_0x4c0c('0x34')]:_0x59751c[_0x4c0c('0x2e')];if(_0x38d991[_0x4c0c('0x2f')][_0x4c0c('0x40')]){_0x55c62f[_0x4c0c('0x41')]=[{'all':!![]}];}_0x55c62f=_['merge']({},_0x55c62f,_0x38d991['options']);return db[_0x4c0c('0x2b')][_0x4c0c('0x46')](_0x55c62f)[_0x4c0c('0x3f')](handleEntityNotFound(_0x48498b,null))[_0x4c0c('0x3f')](respondWithResult(_0x48498b,null))[_0x4c0c('0x43')](handleError(_0x48498b,null));};exports[_0x4c0c('0x47')]=function(_0x1689d3,_0x1cb5bb){return db[_0x4c0c('0x2b')][_0x4c0c('0x47')](_0x1689d3[_0x4c0c('0x48')],{})[_0x4c0c('0x3f')](function(_0x5dc3dd){var _0x4e46d8=_0x1689d3['user'][_0x4c0c('0x49')]({'plain':!![]});if(!_0x4e46d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e46d8[_0x4c0c('0x4a')]==='user'){var _0x4ef3f5=_0x5dc3dd[_0x4c0c('0x49')]({'plain':!![]});var _0x41092d=_0x4c0c('0x4b');return db[_0x4c0c('0x4c')][_0x4c0c('0x46')]({'where':{'name':_0x41092d,'userProfileId':_0x4e46d8[_0x4c0c('0x4d')]},'raw':!![]})[_0x4c0c('0x3f')](function(_0x5d1e68){if(_0x5d1e68&&_0x5d1e68[_0x4c0c('0x4e')]===0x0){return db[_0x4c0c('0x4f')][_0x4c0c('0x47')]({'name':_0x4ef3f5[_0x4c0c('0x28')],'resourceId':_0x4ef3f5['id'],'type':_0x5d1e68[_0x4c0c('0x28')],'sectionId':_0x5d1e68['id']},{})['then'](function(){return _0x5dc3dd;});}else{return _0x5dc3dd;}})[_0x4c0c('0x43')](function(_0x2476b7){logger['error'](_0x4c0c('0x50'),_0x2476b7);throw _0x2476b7;});}return _0x5dc3dd;})[_0x4c0c('0x3f')](respondWithResult(_0x1cb5bb,0xc9))['catch'](handleError(_0x1cb5bb,null));};exports[_0x4c0c('0x51')]=function(_0x156973,_0x406690){if(_0x156973[_0x4c0c('0x48')]['id']){delete _0x156973[_0x4c0c('0x48')]['id'];}return db[_0x4c0c('0x2b')]['find']({'where':{'id':_0x156973[_0x4c0c('0x45')]['id']}})[_0x4c0c('0x3f')](handleEntityNotFound(_0x406690,null))[_0x4c0c('0x3f')](saveUpdates(_0x156973[_0x4c0c('0x48')],null))['then'](respondWithResult(_0x406690,null))[_0x4c0c('0x43')](handleError(_0x406690,null));};exports[_0x4c0c('0x25')]=function(_0x329a8e,_0x2c232a){return db[_0x4c0c('0x2b')][_0x4c0c('0x46')]({'where':{'id':_0x329a8e[_0x4c0c('0x45')]['id']}})[_0x4c0c('0x3f')](handleEntityNotFound(_0x2c232a,null))[_0x4c0c('0x3f')](removeEntity(_0x2c232a,null))[_0x4c0c('0x43')](handleError(_0x2c232a,null));};exports[_0x4c0c('0x52')]=function(_0x191385,_0x394e7c,_0x13faf0){return db[_0x4c0c('0x2b')][_0x4c0c('0x53')]({'where':{'id':_0x191385['params']['id']}})[_0x4c0c('0x3f')](handleEntityNotFound(_0x394e7c,null))[_0x4c0c('0x3f')](function(_0x305087){var _0x19fe7d;var _0xfbe24={},_0x523401={};_0x523401[_0x4c0c('0x2e')]=_[_0x4c0c('0x30')](db[_0x4c0c('0x54')][_0x4c0c('0x2c')]);_0x523401[_0x4c0c('0x2f')]=_[_0x4c0c('0x30')](_0x191385['query']);_0x523401[_0x4c0c('0x31')]=_[_0x4c0c('0x32')](_0x523401['model'],_0x523401[_0x4c0c('0x2f')]);_0xfbe24[_0x4c0c('0x34')]=_['intersection'](_0x523401[_0x4c0c('0x2e')],qs[_0x4c0c('0x33')](_0x191385['query'][_0x4c0c('0x33')]));_0xfbe24[_0x4c0c('0x34')]=_0xfbe24['attributes'][_0x4c0c('0x55')]?_0xfbe24[_0x4c0c('0x34')]:_0x523401[_0x4c0c('0x2e')];if(!_0x191385['query'][_0x4c0c('0x35')]('nolimit')){_0xfbe24[_0x4c0c('0x1f')]=qs[_0x4c0c('0x1f')](_0x191385[_0x4c0c('0x2f')][_0x4c0c('0x1f')]);_0xfbe24['offset']=qs['offset'](_0x191385[_0x4c0c('0x2f')][_0x4c0c('0x1d')]);}_0xfbe24['order']=qs[_0x4c0c('0x37')](_0x191385[_0x4c0c('0x2f')][_0x4c0c('0x37')]);_0xfbe24[_0x4c0c('0x38')]=qs[_0x4c0c('0x31')](_[_0x4c0c('0x39')](_0x191385[_0x4c0c('0x2f')],_0x523401['filters']));if(_0x191385[_0x4c0c('0x2f')][_0x4c0c('0x3e')]){_0xfbe24[_0x4c0c('0x38')]=_['merge'](_0xfbe24['where'],{'$or':_[_0x4c0c('0x3b')](_0xfbe24[_0x4c0c('0x34')],function(_0x101680){var _0x5b9d33={};_0x5b9d33[_0x101680]={'$like':'%'+_0x191385['query'][_0x4c0c('0x3e')]+'%'};return _0x5b9d33;})});}_0xfbe24[_0x4c0c('0x38')]=_[_0x4c0c('0x3a')](_0xfbe24['where'],{'mailboxuser':_0x305087['mailbox']});_0xfbe24=_['merge']({},_0xfbe24,_0x191385[_0x4c0c('0x56')]);return db[_0x4c0c('0x54')][_0x4c0c('0x57')](_0xfbe24)['then'](respondWithFilteredResult(_0x394e7c,_0xfbe24));})['catch'](handleError(_0x394e7c,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 7800bee..af04136 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 _0x9bc1=['../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox','context','lodash','util','moment','bluebird','request-promise','rimraf'];(function(_0x1de164,_0x1ccf5f){var _0x5613b4=function(_0x22dca9){while(--_0x22dca9){_0x1de164['push'](_0x1de164['shift']());}};_0x5613b4(++_0x1ccf5f);}(_0x9bc1,0x1c1));var _0x19bc=function(_0xd43e1d,_0x26a204){_0xd43e1d=_0xd43e1d-0x0;var _0x5c7332=_0x9bc1[_0xd43e1d];return _0x5c7332;};'use strict';var _=require(_0x19bc('0x0'));var util=require(_0x19bc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x19bc('0x2'));var BPromise=require(_0x19bc('0x3'));var rp=require(_0x19bc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x19bc('0x5'));var config=require(_0x19bc('0x6'));var attributes=require(_0x19bc('0x7'));module[_0x19bc('0x8')]=function(_0x2e44a5,_0x481f2c){return _0x2e44a5['define'](_0x19bc('0x9'),attributes,{'tableName':_0x19bc('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x19bc('0xb'),_0x19bc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1437=['moment','request-promise','path','rimraf','./voiceMail.attributes','exports','voice_voicemail','mailbox_context','mailbox','lodash','util','api'];(function(_0xb0bbc1,_0x3f67f4){var _0x3aede9=function(_0xcca029){while(--_0xcca029){_0xb0bbc1['push'](_0xb0bbc1['shift']());}};_0x3aede9(++_0x3f67f4);}(_0x1437,0x1c5));var _0x7143=function(_0x453eb6,_0x4cbdbb){_0x453eb6=_0x453eb6-0x0;var _0x5c4c0a=_0x1437[_0x453eb6];return _0x5c4c0a;};'use strict';var _=require(_0x7143('0x0'));var util=require(_0x7143('0x1'));var logger=require('../../config/logger')(_0x7143('0x2'));var moment=require(_0x7143('0x3'));var BPromise=require('bluebird');var rp=require(_0x7143('0x4'));var fs=require('fs');var path=require(_0x7143('0x5'));var rimraf=require(_0x7143('0x6'));var config=require('../../config/environment');var attributes=require(_0x7143('0x7'));module[_0x7143('0x8')]=function(_0x2ab1c7,_0x24b4f6){return _0x2ab1c7['define']('VoiceMail',attributes,{'tableName':_0x7143('0x9'),'paranoid':![],'indexes':[{'name':_0x7143('0xa'),'fields':[_0x7143('0xb'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index a9b0b25..e4df234 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 _0x5492=['stringify','error','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s'];(function(_0x4cdbe9,_0x1440e2){var _0x1dafff=function(_0x131b29){while(--_0x131b29){_0x4cdbe9['push'](_0x4cdbe9['shift']());}};_0x1dafff(++_0x1440e2);}(_0x5492,0xff));var _0x2549=function(_0x3c5b0f,_0x4c9e2){_0x3c5b0f=_0x3c5b0f-0x0;var _0x49567a=_0x5492[_0x3c5b0f];return _0x49567a;};'use strict';var _=require(_0x2549('0x0'));var util=require(_0x2549('0x1'));var moment=require(_0x2549('0x2'));var BPromise=require(_0x2549('0x3'));var rs=require(_0x2549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2549('0x6'))(_0x2549('0x7'));var config=require(_0x2549('0x8'));var jayson=require(_0x2549('0x9'));var client=jayson[_0x2549('0xa')][_0x2549('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x472770,_0x521943,_0x4cd0f9){return new BPromise(function(_0x820889,_0x372bba){return client['request'](_0x472770,_0x4cd0f9)[_0x2549('0xc')](function(_0x3b4896){logger[_0x2549('0xd')](_0x2549('0xe'),_0x521943,_0x2549('0xf'));logger[_0x2549('0x10')](_0x2549('0x11'),_0x521943,_0x2549('0xf'),JSON[_0x2549('0x12')](_0x3b4896));if(_0x3b4896['error']){if(_0x3b4896[_0x2549('0x13')]['code']===0x1f4){logger[_0x2549('0x13')](_0x2549('0xe'),_0x521943,_0x3b4896[_0x2549('0x13')]['message']);return _0x372bba(_0x3b4896['error']['message']);}logger[_0x2549('0x13')](_0x2549('0xe'),_0x521943,_0x3b4896[_0x2549('0x13')]['message']);return _0x820889(_0x3b4896[_0x2549('0x13')]['message']);}else{logger[_0x2549('0xd')](_0x2549('0xe'),_0x521943,_0x2549('0xf'));_0x820889(_0x3b4896[_0x2549('0x14')]['message']);}})['catch'](function(_0x4f9187){logger[_0x2549('0x13')](_0x2549('0xe'),_0x521943,_0x4f9187);_0x372bba(_0x4f9187);});});} \ No newline at end of file +var _0x8c12=['message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error'];(function(_0x75e338,_0x5dbfe9){var _0x367cb2=function(_0xb116d3){while(--_0xb116d3){_0x75e338['push'](_0x75e338['shift']());}};_0x367cb2(++_0x5dbfe9);}(_0x8c12,0xd5));var _0x28c1=function(_0x2a069a,_0x217880){_0x2a069a=_0x2a069a-0x0;var _0x53ed38=_0x8c12[_0x2a069a];return _0x53ed38;};'use strict';var _=require(_0x28c1('0x0'));var util=require(_0x28c1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x28c1('0x2'));var fs=require('fs');var Redis=require(_0x28c1('0x3'));var db=require(_0x28c1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x28c1('0x5'))(_0x28c1('0x6'));var config=require(_0x28c1('0x7'));var jayson=require(_0x28c1('0x8'));var client=jayson[_0x28c1('0x9')][_0x28c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26882f,_0x2f3308,_0x523e8a){return new BPromise(function(_0x4232ec,_0x3b12fb){return client['request'](_0x26882f,_0x523e8a)[_0x28c1('0xb')](function(_0xc3d3c3){logger[_0x28c1('0xc')](_0x28c1('0xd'),_0x2f3308,_0x28c1('0xe'));logger[_0x28c1('0xf')](_0x28c1('0x10'),_0x2f3308,_0x28c1('0xe'),JSON['stringify'](_0xc3d3c3));if(_0xc3d3c3['error']){if(_0xc3d3c3['error']['code']===0x1f4){logger[_0x28c1('0x11')](_0x28c1('0xd'),_0x2f3308,_0xc3d3c3[_0x28c1('0x11')]['message']);return _0x3b12fb(_0xc3d3c3[_0x28c1('0x11')]['message']);}logger[_0x28c1('0x11')](_0x28c1('0xd'),_0x2f3308,_0xc3d3c3[_0x28c1('0x11')][_0x28c1('0x12')]);return _0x4232ec(_0xc3d3c3[_0x28c1('0x11')]['message']);}else{logger[_0x28c1('0xc')]('VoiceMail,\x20%s,\x20%s',_0x2f3308,_0x28c1('0xe'));_0x4232ec(_0xc3d3c3[_0x28c1('0x13')][_0x28c1('0x12')]);}})[_0x28c1('0x14')](function(_0x36113d){logger[_0x28c1('0x11')](_0x28c1('0xd'),_0x2f3308,_0x36113d);_0x3b12fb(_0x36113d);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 00033ae..6b93009 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 _0x89b1=['index','/:id','/:id/download','download','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated'];(function(_0x67181f,_0x5a1b55){var _0x58b0ee=function(_0x553da7){while(--_0x553da7){_0x67181f['push'](_0x67181f['shift']());}};_0x58b0ee(++_0x5a1b55);}(_0x89b1,0x122));var _0x189b=function(_0x57101c,_0x1ab2d3){_0x57101c=_0x57101c-0x0;var _0x525315=_0x89b1[_0x57101c];return _0x525315;};'use strict';var multer=require(_0x189b('0x0'));var util=require(_0x189b('0x1'));var path=require('path');var timeout=require(_0x189b('0x2'));var express=require(_0x189b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x189b('0x4'));var interaction=require(_0x189b('0x5'));var config=require(_0x189b('0x6'));var controller=require(_0x189b('0x7'));router[_0x189b('0x8')]('/',auth[_0x189b('0x9')](),controller[_0x189b('0xa')]);router['get'](_0x189b('0xb'),auth[_0x189b('0x9')](),controller['show']);router[_0x189b('0x8')](_0x189b('0xc'),auth[_0x189b('0x9')](),controller[_0x189b('0xd')]);router[_0x189b('0xe')]('/',auth[_0x189b('0x9')](),controller['create']);router[_0x189b('0xf')](_0x189b('0xb'),auth[_0x189b('0x9')](),controller[_0x189b('0x10')]);router[_0x189b('0x11')](_0x189b('0xb'),auth[_0x189b('0x9')](),controller[_0x189b('0x12')]);module[_0x189b('0x13')]=router; \ No newline at end of file +var _0xc8b0=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id/download','create','put','update','delete','/:id','exports','multer','util'];(function(_0x3a83fc,_0x2e8cda){var _0x5c8bd2=function(_0x31a9b7){while(--_0x31a9b7){_0x3a83fc['push'](_0x3a83fc['shift']());}};_0x5c8bd2(++_0x2e8cda);}(_0xc8b0,0x1cc));var _0x0c8b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc8b0[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x0c8b('0x0'));var util=require(_0x0c8b('0x1'));var path=require(_0x0c8b('0x2'));var timeout=require(_0x0c8b('0x3'));var express=require(_0x0c8b('0x4'));var router=express[_0x0c8b('0x5')]();var fs_extra=require(_0x0c8b('0x6'));var auth=require(_0x0c8b('0x7'));var interaction=require(_0x0c8b('0x8'));var config=require(_0x0c8b('0x9'));var controller=require(_0x0c8b('0xa'));router[_0x0c8b('0xb')]('/',auth[_0x0c8b('0xc')](),controller[_0x0c8b('0xd')]);router[_0x0c8b('0xb')]('/:id',auth[_0x0c8b('0xc')](),controller['show']);router[_0x0c8b('0xb')](_0x0c8b('0xe'),auth[_0x0c8b('0xc')](),controller['download']);router['post']('/',auth[_0x0c8b('0xc')](),controller[_0x0c8b('0xf')]);router[_0x0c8b('0x10')]('/:id',auth[_0x0c8b('0xc')](),controller[_0x0c8b('0x11')]);router[_0x0c8b('0x12')](_0x0c8b('0x13'),auth[_0x0c8b('0xc')](),controller['destroy']);module[_0x0c8b('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 772eb20..e92e41c 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 _0x31d2=['INTEGER','STRING','BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x31d2,0x10a));var _0x231d=function(_0x40760e,_0x17537f){_0x40760e=_0x40760e-0x0;var _0x5ad42e=_0x31d2[_0x40760e];return _0x5ad42e;};'use strict';var Sequelize=require(_0x231d('0x0'));module[_0x231d('0x1')]={'name':{'type':Sequelize[_0x231d('0x2')],'get':function(_0x3a43d0){return this[_0x231d('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x231d('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x231d('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x231d('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x231d('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x231d('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x231d('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x231d('0x6')](_0x231d('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x231d('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x231d('0x5')],'defaultValue':''},'stamp':{'type':_0x231d('0x8'),'defaultValue':Sequelize['literal'](_0x231d('0x9'))}}; \ No newline at end of file +var _0x64d9=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','STRING','BLOB','long','TIMESTAMP'];(function(_0x4b6c5d,_0x3cbbdf){var _0x4e4d47=function(_0x311028){while(--_0x311028){_0x4b6c5d['push'](_0x4b6c5d['shift']());}};_0x4e4d47(++_0x3cbbdf);}(_0x64d9,0x12e));var _0x964d=function(_0x532c95,_0x54bae9){_0x532c95=_0x532c95-0x0;var _0x1e8ea8=_0x64d9[_0x532c95];return _0x1e8ea8;};'use strict';var Sequelize=require(_0x964d('0x0'));module[_0x964d('0x1')]={'name':{'type':Sequelize[_0x964d('0x2')],'get':function(_0x282d85){return this[_0x964d('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x964d('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x964d('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x964d('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x964d('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x964d('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x964d('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x964d('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x964d('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x964d('0x5')](_0x964d('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x964d('0x4')],'defaultValue':''},'stamp':{'type':_0x964d('0x7'),'defaultValue':Sequelize[_0x964d('0x8')](_0x964d('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index c9dc937..b38d42d 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 _0x64d3=['moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','download','recording','msg_id','Sequelize','audio/wav','attachment','eml-format','fast-json-patch','request-promise'];(function(_0x47222d,_0x2b0c50){var _0x21c2ef=function(_0x50dede){while(--_0x50dede){_0x47222d['push'](_0x47222d['shift']());}};_0x21c2ef(++_0x2b0c50);}(_0x64d3,0x188));var _0x364d=function(_0x2f7312,_0x42e073){_0x2f7312=_0x2f7312-0x0;var _0x1c562b=_0x64d3[_0x2f7312];return _0x1c562b;};'use strict';var emlformat=require(_0x364d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x364d('0x1'));var rp=require(_0x364d('0x2'));var moment=require(_0x364d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x364d('0x4'));var util=require(_0x364d('0x5'));var path=require(_0x364d('0x6'));var sox=require(_0x364d('0x7'));var csv=require(_0x364d('0x8'));var ejs=require(_0x364d('0x9'));var fs=require('fs');var fs_extra=require(_0x364d('0xa'));var _=require(_0x364d('0xb'));var squel=require(_0x364d('0xc'));var crypto=require(_0x364d('0xd'));var jsforce=require(_0x364d('0xe'));var deskjs=require(_0x364d('0xf'));var toCsv=require(_0x364d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x364d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x364d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x364d('0x12'))(_0x364d('0x13'));var utils=require('../../config/utils');var config=require(_0x364d('0x14'));var licenseUtil=require(_0x364d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x556d8d,_0x2ba4dc){_0x2ba4dc=_0x2ba4dc||0xcc;return function(_0x2e2f65){if(_0x2e2f65){return _0x556d8d[_0x364d('0x16')](_0x2ba4dc);}return _0x556d8d[_0x364d('0x17')](_0x2ba4dc)[_0x364d('0x18')]();};}function respondWithResult(_0x4d40c6,_0xf2cce2){_0xf2cce2=_0xf2cce2||0xc8;return function(_0x15f02c){if(_0x15f02c){return _0x4d40c6[_0x364d('0x17')](_0xf2cce2)['json'](_0x15f02c);}};}function respondWithFilteredResult(_0x48cabf,_0x4c9f8e){return function(_0x5b99ce){if(_0x5b99ce){var _0x7dee9e=typeof _0x4c9f8e[_0x364d('0x19')]==='undefined'&&typeof _0x4c9f8e[_0x364d('0x1a')]===_0x364d('0x1b');var _0x2802fc=_0x5b99ce[_0x364d('0x1c')];var _0x23a4f2=_0x7dee9e?0x0:_0x4c9f8e[_0x364d('0x19')];var _0x460c92=_0x7dee9e?_0x5b99ce['count']:_0x4c9f8e['offset']+_0x4c9f8e['limit'];var _0x5c12a1;if(_0x460c92>=_0x2802fc){_0x460c92=_0x2802fc;_0x5c12a1=0xc8;}else{_0x5c12a1=0xce;}_0x48cabf[_0x364d('0x17')](_0x5c12a1);return _0x48cabf[_0x364d('0x1d')](_0x364d('0x1e'),_0x23a4f2+'-'+_0x460c92+'/'+_0x2802fc)[_0x364d('0x1f')](_0x5b99ce);}return null;};}function patchUpdates(_0x55c7c9){return function(_0x2e92c4){try{jsonpatch['apply'](_0x2e92c4,_0x55c7c9,!![]);}catch(_0x5917fc){return BPromise[_0x364d('0x20')](_0x5917fc);}return _0x2e92c4[_0x364d('0x21')]();};}function saveUpdates(_0x1f9226,_0x5c0c00){return function(_0x29d1e0){if(_0x29d1e0){return _0x29d1e0[_0x364d('0x22')](_0x1f9226)[_0x364d('0x23')](function(_0xf45a98){return _0xf45a98;});}return null;};}function removeEntity(_0x3de065,_0x36f406){return function(_0xb62ac8){if(_0xb62ac8){return _0xb62ac8[_0x364d('0x24')]()[_0x364d('0x23')](function(){_0x3de065[_0x364d('0x17')](0xcc)[_0x364d('0x18')]();});}};}function handleEntityNotFound(_0x5b1ef3,_0x2c5f2a){return function(_0x860015){if(!_0x860015){_0x5b1ef3[_0x364d('0x16')](0x194);}return _0x860015;};}function handleError(_0x13b7c1,_0x107cd2){_0x107cd2=_0x107cd2||0x1f4;return function(_0x140c49){logger['error'](_0x140c49[_0x364d('0x25')]);if(_0x140c49[_0x364d('0x26')]){delete _0x140c49[_0x364d('0x26')];}_0x13b7c1[_0x364d('0x17')](_0x107cd2)[_0x364d('0x27')](_0x140c49);};}exports['index']=function(_0x1866bd,_0x1d079f){var _0x352d62={},_0x46a33e={},_0x2d589a={'count':0x0,'rows':[]};var _0x504515=_[_0x364d('0x28')](db[_0x364d('0x29')][_0x364d('0x2a')],function(_0x4cc809){return{'name':_0x4cc809[_0x364d('0x2b')],'type':_0x4cc809[_0x364d('0x2c')]['key']};});_0x46a33e[_0x364d('0x2d')]=_[_0x364d('0x2e')](_[_0x364d('0x28')](_0x504515,_0x364d('0x26')),[_0x364d('0x26')]);_0x46a33e['query']=_[_0x364d('0x2f')](_0x1866bd['query']);_0x46a33e[_0x364d('0x30')]=_[_0x364d('0x31')](_0x46a33e['model'],_0x46a33e[_0x364d('0x32')]);_0x352d62[_0x364d('0x33')]=_[_0x364d('0x31')](_0x46a33e['model'],qs['fields'](_0x1866bd[_0x364d('0x32')][_0x364d('0x34')]));_0x352d62[_0x364d('0x33')]=_0x352d62['attributes'][_0x364d('0x35')]?_0x352d62[_0x364d('0x33')]:_0x46a33e[_0x364d('0x2d')];if(!_0x1866bd[_0x364d('0x32')][_0x364d('0x36')](_0x364d('0x37'))){_0x352d62[_0x364d('0x1a')]=qs['limit'](_0x1866bd['query'][_0x364d('0x1a')]);_0x352d62[_0x364d('0x19')]=qs[_0x364d('0x19')](_0x1866bd[_0x364d('0x32')]['offset']);}_0x352d62[_0x364d('0x38')]=qs[_0x364d('0x39')](_0x1866bd[_0x364d('0x32')][_0x364d('0x39')]);_0x352d62[_0x364d('0x3a')]=qs[_0x364d('0x30')](_[_0x364d('0x3b')](_0x1866bd[_0x364d('0x32')],_0x46a33e['filters']),_0x504515);if(_0x1866bd[_0x364d('0x32')][_0x364d('0x3c')]){_0x352d62[_0x364d('0x3a')]=_[_0x364d('0x3d')](_0x352d62[_0x364d('0x3a')],{'$or':_['map'](_0x504515,function(_0x3862cb){if(_0x3862cb['type']!=='VIRTUAL'){var _0x5ab527={};_0x5ab527[_0x3862cb[_0x364d('0x26')]]={'$like':'%'+_0x1866bd[_0x364d('0x32')]['filter']+'%'};return _0x5ab527;}})});}_0x352d62=_[_0x364d('0x3d')]({},_0x352d62,_0x1866bd['options']);var _0x91e711={'where':_0x352d62['where']};return db[_0x364d('0x29')][_0x364d('0x1c')](_0x91e711)[_0x364d('0x23')](function(_0x245c20){_0x2d589a[_0x364d('0x1c')]=_0x245c20;if(_0x1866bd[_0x364d('0x32')][_0x364d('0x3e')]){_0x352d62[_0x364d('0x3f')]=[{'all':!![]}];}return db[_0x364d('0x29')][_0x364d('0x40')](_0x352d62);})[_0x364d('0x23')](function(_0x440b3f){_0x2d589a[_0x364d('0x41')]=_0x440b3f;return _0x2d589a;})[_0x364d('0x23')](respondWithFilteredResult(_0x1d079f,_0x352d62))[_0x364d('0x42')](handleError(_0x1d079f,null));};exports[_0x364d('0x43')]=function(_0x3aab43,_0x44fa46){var _0x164b58={'raw':!![],'where':{'id':_0x3aab43[_0x364d('0x44')]['id']}},_0x14f2dc={};_0x14f2dc[_0x364d('0x2d')]=_[_0x364d('0x2f')](db['VoiceMailMessage'][_0x364d('0x2a')]);_0x14f2dc['query']=_['keys'](_0x3aab43[_0x364d('0x32')]);_0x14f2dc['filters']=_[_0x364d('0x31')](_0x14f2dc[_0x364d('0x2d')],_0x14f2dc[_0x364d('0x32')]);_0x164b58['attributes']=_[_0x364d('0x31')](_0x14f2dc[_0x364d('0x2d')],qs[_0x364d('0x34')](_0x3aab43[_0x364d('0x32')]['fields']));_0x164b58[_0x364d('0x33')]=_0x164b58[_0x364d('0x33')]['length']?_0x164b58[_0x364d('0x33')]:_0x14f2dc['model'];if(_0x3aab43['query'][_0x364d('0x3e')]){_0x164b58[_0x364d('0x3f')]=[{'all':!![]}];}_0x164b58=_['merge']({},_0x164b58,_0x3aab43[_0x364d('0x45')]);return db[_0x364d('0x29')][_0x364d('0x46')](_0x164b58)[_0x364d('0x23')](handleEntityNotFound(_0x44fa46,null))[_0x364d('0x23')](respondWithResult(_0x44fa46,null))[_0x364d('0x42')](handleError(_0x44fa46,null));};exports[_0x364d('0x47')]=function(_0x1598f7,_0x159891){return db[_0x364d('0x29')][_0x364d('0x47')](_0x1598f7[_0x364d('0x48')],{})['then'](respondWithResult(_0x159891,0xc9))[_0x364d('0x42')](handleError(_0x159891,null));};exports['update']=function(_0x353733,_0xa131ee){if(_0x353733[_0x364d('0x48')]['id']){delete _0x353733[_0x364d('0x48')]['id'];}return db[_0x364d('0x29')][_0x364d('0x46')]({'where':{'id':_0x353733['params']['id']}})[_0x364d('0x23')](handleEntityNotFound(_0xa131ee,null))['then'](saveUpdates(_0x353733[_0x364d('0x48')],null))[_0x364d('0x23')](respondWithResult(_0xa131ee,null))[_0x364d('0x42')](handleError(_0xa131ee,null));};exports['destroy']=function(_0x4e3453,_0xf01d7){return db['VoiceMailMessage']['find']({'where':{'id':_0x4e3453[_0x364d('0x44')]['id']}})[_0x364d('0x23')](handleEntityNotFound(_0xf01d7,null))[_0x364d('0x23')](removeEntity(_0xf01d7,null))[_0x364d('0x42')](handleError(_0xf01d7,null));};exports[_0x364d('0x49')]=function(_0x520a2f,_0x48bf23,_0x5046e6){return db[_0x364d('0x29')][_0x364d('0x46')]({'where':{'id':_0x520a2f['params']['id']},'attributes':['id',_0x364d('0x4a'),_0x364d('0x4b')]})[_0x364d('0x23')](handleEntityNotFound(_0x48bf23,null))['then'](function(_0x5cef21){if(_0x5cef21){if(!_0x5cef21[_0x364d('0x4a')]){throw new db[(_0x364d('0x4c'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x1fa205={'Content-Type':_0x364d('0x4d'),'Content-Disposition':_0x364d('0x4e')};if(_0x5cef21[_0x364d('0x4b')]){_0x1fa205['Content-Disposition']='attachment;\x20filename=\x22'+_0x5cef21[_0x364d('0x4b')]+'.wav\x22';}_0x48bf23['set'](_0x1fa205);return _0x48bf23[_0x364d('0x27')](new Buffer(_0x5cef21[_0x364d('0x4a')]));}})[_0x364d('0x42')](handleError(_0x48bf23,null));}; \ No newline at end of file +var _0x0ef2=['fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceMailMessage','fieldName','type','key','differenceBy','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','find','download','recording','msg_id','Sequelize','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x0ef2,0x1ea));var _0x20ef=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x0ef2[_0x16629d];return _0x56ccee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x20ef('0x0'));var zipdir=require(_0x20ef('0x1'));var jsonpatch=require(_0x20ef('0x2'));var rp=require('request-promise');var moment=require(_0x20ef('0x3'));var BPromise=require(_0x20ef('0x4'));var Mustache=require(_0x20ef('0x5'));var util=require('util');var path=require(_0x20ef('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x20ef('0x7'));var fs=require('fs');var fs_extra=require(_0x20ef('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x20ef('0x9'));var jsforce=require(_0x20ef('0xa'));var deskjs=require(_0x20ef('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x20ef('0xc'));var Redis=require(_0x20ef('0xd'));var authService=require(_0x20ef('0xe'));var qs=require(_0x20ef('0xf'));var as=require(_0x20ef('0x10'));var hardwareService=require(_0x20ef('0x11'));var logger=require(_0x20ef('0x12'))(_0x20ef('0x13'));var utils=require(_0x20ef('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x20ef('0x15'));var db=require(_0x20ef('0x16'))['db'];function respondWithStatusCode(_0x1f6559,_0x1c6e58){_0x1c6e58=_0x1c6e58||0xcc;return function(_0x19893b){if(_0x19893b){return _0x1f6559['sendStatus'](_0x1c6e58);}return _0x1f6559[_0x20ef('0x17')](_0x1c6e58)['end']();};}function respondWithResult(_0x362234,_0x3cf837){_0x3cf837=_0x3cf837||0xc8;return function(_0x14ef54){if(_0x14ef54){return _0x362234[_0x20ef('0x17')](_0x3cf837)[_0x20ef('0x18')](_0x14ef54);}};}function respondWithFilteredResult(_0x4b024b,_0xc8b2e){return function(_0x241822){if(_0x241822){var _0x52919a=typeof _0xc8b2e[_0x20ef('0x19')]===_0x20ef('0x1a')&&typeof _0xc8b2e[_0x20ef('0x1b')]===_0x20ef('0x1a');var _0x5f4ce3=_0x241822[_0x20ef('0x1c')];var _0x3d1d78=_0x52919a?0x0:_0xc8b2e[_0x20ef('0x19')];var _0x9246d9=_0x52919a?_0x241822[_0x20ef('0x1c')]:_0xc8b2e[_0x20ef('0x19')]+_0xc8b2e[_0x20ef('0x1b')];var _0x4af7e1;if(_0x9246d9>=_0x5f4ce3){_0x9246d9=_0x5f4ce3;_0x4af7e1=0xc8;}else{_0x4af7e1=0xce;}_0x4b024b[_0x20ef('0x17')](_0x4af7e1);return _0x4b024b[_0x20ef('0x1d')](_0x20ef('0x1e'),_0x3d1d78+'-'+_0x9246d9+'/'+_0x5f4ce3)[_0x20ef('0x18')](_0x241822);}return null;};}function patchUpdates(_0x70d581){return function(_0x15ebe3){try{jsonpatch[_0x20ef('0x1f')](_0x15ebe3,_0x70d581,!![]);}catch(_0x53c001){return BPromise[_0x20ef('0x20')](_0x53c001);}return _0x15ebe3['save']();};}function saveUpdates(_0x3a1ca8,_0x9a95f8){return function(_0x146578){if(_0x146578){return _0x146578[_0x20ef('0x21')](_0x3a1ca8)[_0x20ef('0x22')](function(_0x51f13e){return _0x51f13e;});}return null;};}function removeEntity(_0x31f333,_0x35c433){return function(_0x57a969){if(_0x57a969){return _0x57a969[_0x20ef('0x23')]()[_0x20ef('0x22')](function(){_0x31f333[_0x20ef('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ae059,_0x5dc8ed){return function(_0xf2f32c){if(!_0xf2f32c){_0x2ae059[_0x20ef('0x24')](0x194);}return _0xf2f32c;};}function handleError(_0x376e75,_0x3849fe){_0x3849fe=_0x3849fe||0x1f4;return function(_0x313494){logger[_0x20ef('0x25')](_0x313494[_0x20ef('0x26')]);if(_0x313494[_0x20ef('0x27')]){delete _0x313494[_0x20ef('0x27')];}_0x376e75[_0x20ef('0x17')](_0x3849fe)[_0x20ef('0x28')](_0x313494);};}exports[_0x20ef('0x29')]=function(_0x46472d,_0x72ba1b){var _0x2d5c13={},_0x32c1c2={},_0x5c731c={'count':0x0,'rows':[]};var _0x5ab814=_[_0x20ef('0x2a')](db[_0x20ef('0x2b')]['rawAttributes'],function(_0x107870){return{'name':_0x107870[_0x20ef('0x2c')],'type':_0x107870[_0x20ef('0x2d')][_0x20ef('0x2e')]};});_0x32c1c2['model']=_[_0x20ef('0x2f')](_['map'](_0x5ab814,_0x20ef('0x27')),[_0x20ef('0x27')]);_0x32c1c2[_0x20ef('0x30')]=_[_0x20ef('0x31')](_0x46472d[_0x20ef('0x30')]);_0x32c1c2[_0x20ef('0x32')]=_[_0x20ef('0x33')](_0x32c1c2['model'],_0x32c1c2[_0x20ef('0x30')]);_0x2d5c13[_0x20ef('0x34')]=_[_0x20ef('0x33')](_0x32c1c2[_0x20ef('0x35')],qs[_0x20ef('0x36')](_0x46472d[_0x20ef('0x30')][_0x20ef('0x36')]));_0x2d5c13[_0x20ef('0x34')]=_0x2d5c13[_0x20ef('0x34')][_0x20ef('0x37')]?_0x2d5c13[_0x20ef('0x34')]:_0x32c1c2['model'];if(!_0x46472d[_0x20ef('0x30')]['hasOwnProperty'](_0x20ef('0x38'))){_0x2d5c13[_0x20ef('0x1b')]=qs['limit'](_0x46472d[_0x20ef('0x30')][_0x20ef('0x1b')]);_0x2d5c13[_0x20ef('0x19')]=qs[_0x20ef('0x19')](_0x46472d[_0x20ef('0x30')][_0x20ef('0x19')]);}_0x2d5c13[_0x20ef('0x39')]=qs['sort'](_0x46472d[_0x20ef('0x30')][_0x20ef('0x3a')]);_0x2d5c13[_0x20ef('0x3b')]=qs[_0x20ef('0x32')](_[_0x20ef('0x3c')](_0x46472d[_0x20ef('0x30')],_0x32c1c2['filters']),_0x5ab814);if(_0x46472d[_0x20ef('0x30')][_0x20ef('0x3d')]){_0x2d5c13[_0x20ef('0x3b')]=_[_0x20ef('0x3e')](_0x2d5c13[_0x20ef('0x3b')],{'$or':_[_0x20ef('0x2a')](_0x5ab814,function(_0x598f16){if(_0x598f16['type']!==_0x20ef('0x3f')){var _0x2da889={};_0x2da889[_0x598f16[_0x20ef('0x27')]]={'$like':'%'+_0x46472d['query'][_0x20ef('0x3d')]+'%'};return _0x2da889;}})});}_0x2d5c13=_['merge']({},_0x2d5c13,_0x46472d[_0x20ef('0x40')]);var _0x3b3be1={'where':_0x2d5c13[_0x20ef('0x3b')]};return db[_0x20ef('0x2b')]['count'](_0x3b3be1)[_0x20ef('0x22')](function(_0x4f273c){_0x5c731c['count']=_0x4f273c;if(_0x46472d['query'][_0x20ef('0x41')]){_0x2d5c13['include']=[{'all':!![]}];}return db[_0x20ef('0x2b')][_0x20ef('0x42')](_0x2d5c13);})[_0x20ef('0x22')](function(_0x2c189f){_0x5c731c[_0x20ef('0x43')]=_0x2c189f;return _0x5c731c;})[_0x20ef('0x22')](respondWithFilteredResult(_0x72ba1b,_0x2d5c13))[_0x20ef('0x44')](handleError(_0x72ba1b,null));};exports[_0x20ef('0x45')]=function(_0x122833,_0xdbdeb){var _0xc523eb={'raw':!![],'where':{'id':_0x122833[_0x20ef('0x46')]['id']}},_0x29d4ab={};_0x29d4ab[_0x20ef('0x35')]=_[_0x20ef('0x31')](db[_0x20ef('0x2b')][_0x20ef('0x47')]);_0x29d4ab[_0x20ef('0x30')]=_[_0x20ef('0x31')](_0x122833[_0x20ef('0x30')]);_0x29d4ab[_0x20ef('0x32')]=_[_0x20ef('0x33')](_0x29d4ab[_0x20ef('0x35')],_0x29d4ab['query']);_0xc523eb['attributes']=_['intersection'](_0x29d4ab[_0x20ef('0x35')],qs[_0x20ef('0x36')](_0x122833[_0x20ef('0x30')][_0x20ef('0x36')]));_0xc523eb[_0x20ef('0x34')]=_0xc523eb[_0x20ef('0x34')][_0x20ef('0x37')]?_0xc523eb[_0x20ef('0x34')]:_0x29d4ab[_0x20ef('0x35')];if(_0x122833[_0x20ef('0x30')][_0x20ef('0x41')]){_0xc523eb[_0x20ef('0x48')]=[{'all':!![]}];}_0xc523eb=_[_0x20ef('0x3e')]({},_0xc523eb,_0x122833[_0x20ef('0x40')]);return db[_0x20ef('0x2b')]['find'](_0xc523eb)[_0x20ef('0x22')](handleEntityNotFound(_0xdbdeb,null))[_0x20ef('0x22')](respondWithResult(_0xdbdeb,null))[_0x20ef('0x44')](handleError(_0xdbdeb,null));};exports[_0x20ef('0x49')]=function(_0x540944,_0x4e921b){return db[_0x20ef('0x2b')][_0x20ef('0x49')](_0x540944[_0x20ef('0x4a')],{})['then'](respondWithResult(_0x4e921b,0xc9))[_0x20ef('0x44')](handleError(_0x4e921b,null));};exports[_0x20ef('0x21')]=function(_0x54edf8,_0x5a8a97){if(_0x54edf8['body']['id']){delete _0x54edf8[_0x20ef('0x4a')]['id'];}return db['VoiceMailMessage'][_0x20ef('0x4b')]({'where':{'id':_0x54edf8[_0x20ef('0x46')]['id']}})['then'](handleEntityNotFound(_0x5a8a97,null))['then'](saveUpdates(_0x54edf8[_0x20ef('0x4a')],null))['then'](respondWithResult(_0x5a8a97,null))['catch'](handleError(_0x5a8a97,null));};exports[_0x20ef('0x23')]=function(_0x519b1f,_0x268e8a){return db['VoiceMailMessage']['find']({'where':{'id':_0x519b1f[_0x20ef('0x46')]['id']}})[_0x20ef('0x22')](handleEntityNotFound(_0x268e8a,null))[_0x20ef('0x22')](removeEntity(_0x268e8a,null))[_0x20ef('0x44')](handleError(_0x268e8a,null));};exports[_0x20ef('0x4c')]=function(_0xac71bf,_0x5363ee,_0x3c430c){return db[_0x20ef('0x2b')]['find']({'where':{'id':_0xac71bf['params']['id']},'attributes':['id',_0x20ef('0x4d'),_0x20ef('0x4e')]})[_0x20ef('0x22')](handleEntityNotFound(_0x5363ee,null))[_0x20ef('0x22')](function(_0x250644){if(_0x250644){if(!_0x250644['recording']){throw new db[(_0x20ef('0x4f'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x4fc2f3={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x250644['msg_id']){_0x4fc2f3['Content-Disposition']=_0x20ef('0x50')+_0x250644[_0x20ef('0x4e')]+_0x20ef('0x51');}_0x5363ee['set'](_0x4fc2f3);return _0x5363ee[_0x20ef('0x28')](new Buffer(_0x250644[_0x20ef('0x4d')]));}})['catch'](handleError(_0x5363ee,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 6d6857c..40985f9 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 _0x664b=['rimraf','../../config/environment','./voiceMailMessage.attributes','define','voice_voicemail_messages','dir','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x4121b2,_0x449428){var _0x1686ca=function(_0x267935){while(--_0x267935){_0x4121b2['push'](_0x4121b2['shift']());}};_0x1686ca(++_0x449428);}(_0x664b,0x132));var _0xb664=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x664b[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xb664('0x0'));var util=require('util');var logger=require(_0xb664('0x1'))(_0xb664('0x2'));var moment=require('moment');var BPromise=require(_0xb664('0x3'));var rp=require(_0xb664('0x4'));var fs=require('fs');var path=require(_0xb664('0x5'));var rimraf=require(_0xb664('0x6'));var config=require(_0xb664('0x7'));var attributes=require(_0xb664('0x8'));module['exports']=function(_0x450543,_0x286745){return _0x450543[_0xb664('0x9')]('VoiceMailMessage',attributes,{'tableName':_0xb664('0xa'),'paranoid':![],'indexes':[{'name':_0xb664('0xb'),'fields':[_0xb664('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0xcf53=['../../config/logger','api','moment','path','rimraf','./voiceMailMessage.attributes','exports','VoiceMailMessage','dir','lodash','util'];(function(_0x521293,_0x5500d3){var _0x4ac782=function(_0x33aedf){while(--_0x33aedf){_0x521293['push'](_0x521293['shift']());}};_0x4ac782(++_0x5500d3);}(_0xcf53,0xa3));var _0x3cf5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcf53[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3cf5('0x0'));var util=require(_0x3cf5('0x1'));var logger=require(_0x3cf5('0x2'))(_0x3cf5('0x3'));var moment=require(_0x3cf5('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3cf5('0x5'));var rimraf=require(_0x3cf5('0x6'));var config=require('../../config/environment');var attributes=require(_0x3cf5('0x7'));module[_0x3cf5('0x8')]=function(_0xe1534c,_0x3668f2){return _0xe1534c['define'](_0x3cf5('0x9'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x3cf5('0xa'),'fields':[_0x3cf5('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 6d72dea..4e0d9b4 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xa1e030,_0x579969){var _0x1619bb=function(_0x108f53){while(--_0x108f53){_0xa1e030['push'](_0xa1e030['shift']());}};_0x1619bb(++_0x579969);}(_0xadb5,0xad));var _0x5adb=function(_0x54ed33,_0x111b0c){_0x54ed33=_0x54ed33-0x0;var _0x117970=_0xadb5[_0x54ed33];return _0x117970;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x154003,_0x4672a9){var _0x11172c=function(_0x2d1cd1){while(--_0x2d1cd1){_0x154003['push'](_0x154003['shift']());}};_0x11172c(++_0x4672a9);}(_0xdb28,0x106));var _0x8db2=function(_0x2b672c,_0x34b98f){_0x2b672c=_0x2b672c-0x0;var _0x46d96c=_0xdb28[_0x2b672c];return _0x46d96c;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index fbae9f9..7e5a4e3 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 _0xfb58=['../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','put','update','delete','destroy','/:id/sounds/:id2','removeSound','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0xfb58,0x71));var _0x8fb5=function(_0x22fdb9,_0x314566){_0x22fdb9=_0x22fdb9-0x0;var _0x1f7392=_0xfb58[_0x22fdb9];return _0x1f7392;};'use strict';var multer=require(_0x8fb5('0x0'));var util=require(_0x8fb5('0x1'));var path=require(_0x8fb5('0x2'));var timeout=require('connect-timeout');var express=require(_0x8fb5('0x3'));var router=express[_0x8fb5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8fb5('0x5'));var interaction=require(_0x8fb5('0x6'));var config=require(_0x8fb5('0x7'));var controller=require(_0x8fb5('0x8'));router[_0x8fb5('0x9')]('/',auth[_0x8fb5('0xa')](),controller[_0x8fb5('0xb')]);router[_0x8fb5('0x9')](_0x8fb5('0xc'),auth[_0x8fb5('0xa')](),controller[_0x8fb5('0xd')]);router['get'](_0x8fb5('0xe'),auth['isAuthenticated'](),controller[_0x8fb5('0xf')]);router[_0x8fb5('0x10')]('/',auth['isAuthenticated'](),controller[_0x8fb5('0x11')]);router['post'](_0x8fb5('0xe'),auth[_0x8fb5('0xa')](),controller['addSound']);router[_0x8fb5('0x12')]('/:id',auth[_0x8fb5('0xa')](),controller[_0x8fb5('0x13')]);router[_0x8fb5('0x14')]('/:id',auth[_0x8fb5('0xa')](),controller[_0x8fb5('0x15')]);router['delete'](_0x8fb5('0x16'),auth[_0x8fb5('0xa')](),controller[_0x8fb5('0x17')]);module['exports']=router; \ No newline at end of file +var _0x8830=['post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','/:id','/:id/sounds','isAuthenticated'];(function(_0xa2485c,_0x12158b){var _0x313b49=function(_0x195618){while(--_0x195618){_0xa2485c['push'](_0xa2485c['shift']());}};_0x313b49(++_0x12158b);}(_0x8830,0x16e));var _0x0883=function(_0x197c10,_0x38b2d2){_0x197c10=_0x197c10-0x0;var _0x30f785=_0x8830[_0x197c10];return _0x30f785;};'use strict';var multer=require(_0x0883('0x0'));var util=require(_0x0883('0x1'));var path=require('path');var timeout=require(_0x0883('0x2'));var express=require(_0x0883('0x3'));var router=express[_0x0883('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0883('0x5'));var interaction=require(_0x0883('0x6'));var config=require('../../config/environment');var controller=require(_0x0883('0x7'));router[_0x0883('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0883('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x0883('0x8')](_0x0883('0xa'),auth[_0x0883('0xb')](),controller['getSounds']);router[_0x0883('0xc')]('/',auth[_0x0883('0xb')](),controller[_0x0883('0xd')]);router['post'](_0x0883('0xa'),auth['isAuthenticated'](),controller[_0x0883('0xe')]);router[_0x0883('0xf')](_0x0883('0x9'),auth[_0x0883('0xb')](),controller[_0x0883('0x10')]);router[_0x0883('0x11')]('/:id',auth[_0x0883('0xb')](),controller[_0x0883('0x12')]);router[_0x0883('0x11')](_0x0883('0x13'),auth[_0x0883('0xb')](),controller[_0x0883('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index d55d3ac..5e16eef 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 _0x7c98=['name','ENUM','custom','files','quietmp3nb','quietmp3','sequelize','exports','STRING'];(function(_0x19f085,_0x322f9e){var _0x13410e=function(_0xd66d0d){while(--_0xd66d0d){_0x19f085['push'](_0x19f085['shift']());}};_0x13410e(++_0x322f9e);}(_0x7c98,0xb1));var _0x87c9=function(_0x27ad07,_0x2d3d47){_0x27ad07=_0x27ad07-0x0;var _0x3148b4=_0x7c98[_0x27ad07];return _0x3148b4;};'use strict';var Sequelize=require(_0x87c9('0x0'));module[_0x87c9('0x1')]={'name':{'type':Sequelize[_0x87c9('0x2')],'allowNull':![],'unique':_0x87c9('0x3')},'mode':{'type':Sequelize[_0x87c9('0x4')](_0x87c9('0x5'),_0x87c9('0x6'),'mp3nb',_0x87c9('0x7'),_0x87c9('0x8'),'mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x87c9('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x87c9('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x87c9('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x87c9('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x33a6=['custom','mp3nb','quietmp3nb','quietmp3','files','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','ENUM'];(function(_0x1843b3,_0x10995a){var _0x3c7de0=function(_0xe28643){while(--_0xe28643){_0x1843b3['push'](_0x1843b3['shift']());}};_0x3c7de0(++_0x10995a);}(_0x33a6,0x1c5));var _0x633a=function(_0x7b470b,_0x142f59){_0x7b470b=_0x7b470b-0x0;var _0x5e5a6c=_0x33a6[_0x7b470b];return _0x5e5a6c;};'use strict';var Sequelize=require(_0x633a('0x0'));module[_0x633a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x633a('0x2')](_0x633a('0x3'),'files',_0x633a('0x4'),_0x633a('0x5'),_0x633a('0x6'),'mp3'),'allowNull':!![],'defaultValue':_0x633a('0x7')},'directory':{'type':Sequelize[_0x633a('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0x633a('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0x633a('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0x633a('0x8')],'allowNull':!![],'defaultValue':_0x633a('0x9')},'format':{'type':Sequelize[_0x633a('0x8')],'allowNull':!![]},'stamp':{'type':_0x633a('0xa')},'defaultEntry':{'type':Sequelize[_0x633a('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index aed81c0..30ca43d 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 _0x6520=['includeAll','options','find','body','create','transaction','mode','files','directory','join','server/files/moh','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','findOne','converted_format','createdAt','server/files/sounds/converted','format','extname','save_name','root','%s.%s','message','removeSound','id2','Sound','getSounds','order','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','MusicOnHolds','error','stack','name','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','catch','show','params','length'];(function(_0x2bd264,_0x53a5d4){var _0x3cd2e3=function(_0x125cd0){while(--_0x125cd0){_0x2bd264['push'](_0x2bd264['shift']());}};_0x3cd2e3(++_0x53a5d4);}(_0x6520,0x1da));var _0x0652=function(_0xc65eda,_0x47ec5c){_0xc65eda=_0xc65eda-0x0;var _0x384c0f=_0x6520[_0xc65eda];return _0x384c0f;};'use strict';var emlformat=require(_0x0652('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0652('0x1'));var jsonpatch=require(_0x0652('0x2'));var rp=require(_0x0652('0x3'));var moment=require(_0x0652('0x4'));var BPromise=require(_0x0652('0x5'));var Mustache=require(_0x0652('0x6'));var util=require(_0x0652('0x7'));var path=require(_0x0652('0x8'));var sox=require('sox');var csv=require(_0x0652('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0652('0xa'));var crypto=require('crypto');var jsforce=require(_0x0652('0xb'));var deskjs=require(_0x0652('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0652('0xd'));var Papa=require(_0x0652('0xe'));var Redis=require('ioredis');var authService=require(_0x0652('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0652('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x0652('0x11'));var config=require(_0x0652('0x12'));var licenseUtil=require(_0x0652('0x13'));var db=require(_0x0652('0x14'))['db'];function respondWithStatusCode(_0x387245,_0x8e977d){_0x8e977d=_0x8e977d||0xcc;return function(_0x1b0c55){if(_0x1b0c55){return _0x387245[_0x0652('0x15')](_0x8e977d);}return _0x387245['status'](_0x8e977d)[_0x0652('0x16')]();};}function respondWithResult(_0x5df160,_0x2e677c){_0x2e677c=_0x2e677c||0xc8;return function(_0x2d28c3){if(_0x2d28c3){return _0x5df160[_0x0652('0x17')](_0x2e677c)[_0x0652('0x18')](_0x2d28c3);}};}function respondWithFilteredResult(_0x500971,_0x147a36){return function(_0x30b3de){if(_0x30b3de){var _0x248821=typeof _0x147a36[_0x0652('0x19')]===_0x0652('0x1a')&&typeof _0x147a36[_0x0652('0x1b')]===_0x0652('0x1a');var _0x22c22f=_0x30b3de['count'];var _0x2bac11=_0x248821?0x0:_0x147a36[_0x0652('0x19')];var _0xa13e18=_0x248821?_0x30b3de['count']:_0x147a36[_0x0652('0x19')]+_0x147a36[_0x0652('0x1b')];var _0xbeb6b3;if(_0xa13e18>=_0x22c22f){_0xa13e18=_0x22c22f;_0xbeb6b3=0xc8;}else{_0xbeb6b3=0xce;}_0x500971['status'](_0xbeb6b3);return _0x500971[_0x0652('0x1c')](_0x0652('0x1d'),_0x2bac11+'-'+_0xa13e18+'/'+_0x22c22f)['json'](_0x30b3de);}return null;};}function patchUpdates(_0x1f97e4){return function(_0x4eb965){try{jsonpatch[_0x0652('0x1e')](_0x4eb965,_0x1f97e4,!![]);}catch(_0x4fdeb1){return BPromise[_0x0652('0x1f')](_0x4fdeb1);}return _0x4eb965[_0x0652('0x20')]();};}function saveUpdates(_0x37cefa,_0x5a4ca2){return function(_0x23486e){if(_0x23486e){return _0x23486e[_0x0652('0x21')](_0x37cefa)['then'](function(_0x46efc8){return _0x46efc8;});}return null;};}function removeEntity(_0x1d6827,_0x10d45e){return function(_0xd5db9a){if(_0xd5db9a){return _0xd5db9a[_0x0652('0x22')]()[_0x0652('0x23')](function(){var _0x2548a4=_0xd5db9a[_0x0652('0x24')]({'plain':!![]});var _0x58431c=_0x0652('0x25');return db['UserProfileResource'][_0x0652('0x22')]({'where':{'type':_0x58431c,'resourceId':_0x2548a4['id']}})['then'](function(){return _0xd5db9a;});})[_0x0652('0x23')](function(){_0x1d6827[_0x0652('0x17')](0xcc)[_0x0652('0x16')]();});}};}function handleEntityNotFound(_0x225121,_0x2b34c2){return function(_0x1e6226){if(!_0x1e6226){_0x225121['sendStatus'](0x194);}return _0x1e6226;};}function handleError(_0x142fe0,_0x5e0be7){_0x5e0be7=_0x5e0be7||0x1f4;return function(_0x25bd08){logger[_0x0652('0x26')](_0x25bd08[_0x0652('0x27')]);if(_0x25bd08[_0x0652('0x28')]){delete _0x25bd08[_0x0652('0x28')];}_0x142fe0[_0x0652('0x17')](_0x5e0be7)['send'](_0x25bd08);};}exports[_0x0652('0x29')]=function(_0xb538fb,_0x45d1ff){var _0x1e36ed={},_0x221336={},_0x4d683e={'count':0x0,'rows':[]};var _0x3face5=_['map'](db[_0x0652('0x2a')][_0x0652('0x2b')],function(_0x24d65e){return{'name':_0x24d65e[_0x0652('0x2c')],'type':_0x24d65e[_0x0652('0x2d')][_0x0652('0x2e')]};});_0x221336[_0x0652('0x2f')]=_[_0x0652('0x30')](_0x3face5,_0x0652('0x28'));_0x221336[_0x0652('0x31')]=_[_0x0652('0x32')](_0xb538fb[_0x0652('0x31')]);_0x221336[_0x0652('0x33')]=_['intersection'](_0x221336[_0x0652('0x2f')],_0x221336[_0x0652('0x31')]);_0x1e36ed[_0x0652('0x34')]=_[_0x0652('0x35')](_0x221336[_0x0652('0x2f')],qs[_0x0652('0x36')](_0xb538fb['query'][_0x0652('0x36')]));_0x1e36ed['attributes']=_0x1e36ed[_0x0652('0x34')]['length']?_0x1e36ed[_0x0652('0x34')]:_0x221336[_0x0652('0x2f')];if(!_0xb538fb[_0x0652('0x31')][_0x0652('0x37')](_0x0652('0x38'))){_0x1e36ed[_0x0652('0x1b')]=qs[_0x0652('0x1b')](_0xb538fb[_0x0652('0x31')]['limit']);_0x1e36ed[_0x0652('0x19')]=qs[_0x0652('0x19')](_0xb538fb['query'][_0x0652('0x19')]);}_0x1e36ed['order']=qs[_0x0652('0x39')](_0xb538fb[_0x0652('0x31')][_0x0652('0x39')]);delete _0xb538fb['query'][_0x0652('0x39')];_0x1e36ed[_0x0652('0x3a')]=qs[_0x0652('0x33')](_[_0x0652('0x3b')](_0xb538fb[_0x0652('0x31')],_0x221336[_0x0652('0x33')]),_0x3face5);if(_0xb538fb[_0x0652('0x31')][_0x0652('0x3c')]){_0x1e36ed[_0x0652('0x3a')]=_[_0x0652('0x3d')](_0x1e36ed[_0x0652('0x3a')],{'$or':_['map'](_0x3face5,function(_0x294bec){if(_0x294bec[_0x0652('0x2d')]!==_0x0652('0x3e')){var _0x138934={};_0x138934[_0x294bec[_0x0652('0x28')]]={'$like':'%'+_0xb538fb[_0x0652('0x31')][_0x0652('0x3c')]+'%'};return _0x138934;}})});}_0x1e36ed=_['merge']({},_0x1e36ed,_0xb538fb['options']);var _0x5bb74b={'where':_0x1e36ed[_0x0652('0x3a')]};return db['VoiceMusicOnHold'][_0x0652('0x3f')](_0x5bb74b)[_0x0652('0x23')](function(_0x10352e){_0x4d683e['count']=_0x10352e;if(_0xb538fb[_0x0652('0x31')]['includeAll']){_0x1e36ed[_0x0652('0x40')]=[{'all':!![]}];}return db[_0x0652('0x2a')][_0x0652('0x41')](_0x1e36ed);})[_0x0652('0x23')](function(_0x272741){_0x4d683e[_0x0652('0x42')]=_0x272741;return _0x4d683e;})[_0x0652('0x23')](respondWithFilteredResult(_0x45d1ff,_0x1e36ed))[_0x0652('0x43')](handleError(_0x45d1ff,null));};exports[_0x0652('0x44')]=function(_0x46a994,_0x5f3a05){var _0x44b43f={'raw':![],'where':{'id':_0x46a994[_0x0652('0x45')]['id']}},_0x39911a={};_0x39911a[_0x0652('0x2f')]=_[_0x0652('0x32')](db[_0x0652('0x2a')][_0x0652('0x2b')]);_0x39911a[_0x0652('0x31')]=_['keys'](_0x46a994['query']);_0x39911a[_0x0652('0x33')]=_['intersection'](_0x39911a['model'],_0x39911a[_0x0652('0x31')]);_0x44b43f['attributes']=_[_0x0652('0x35')](_0x39911a[_0x0652('0x2f')],qs[_0x0652('0x36')](_0x46a994[_0x0652('0x31')][_0x0652('0x36')]));_0x44b43f['attributes']=_0x44b43f[_0x0652('0x34')][_0x0652('0x46')]?_0x44b43f[_0x0652('0x34')]:_0x39911a[_0x0652('0x2f')];if(_0x46a994['query'][_0x0652('0x47')]){_0x44b43f[_0x0652('0x40')]=[{'all':!![]}];}_0x44b43f=_[_0x0652('0x3d')]({},_0x44b43f,_0x46a994[_0x0652('0x48')]);return db[_0x0652('0x2a')][_0x0652('0x49')](_0x44b43f)[_0x0652('0x23')](handleEntityNotFound(_0x5f3a05,null))['then'](respondWithResult(_0x5f3a05,null))[_0x0652('0x43')](handleError(_0x5f3a05,null));};exports[_0x0652('0x21')]=function(_0x288771,_0x1f9f1b){if(_0x288771[_0x0652('0x4a')]['id']){delete _0x288771['body']['id'];}return db[_0x0652('0x2a')]['find']({'where':{'id':_0x288771['params']['id']}})[_0x0652('0x23')](handleEntityNotFound(_0x1f9f1b,null))['then'](saveUpdates(_0x288771[_0x0652('0x4a')],null))[_0x0652('0x23')](respondWithResult(_0x1f9f1b,null))['catch'](handleError(_0x1f9f1b,null));};exports[_0x0652('0x4b')]=function(_0x25bf25,_0x3fbf60,_0x48e554){return db['sequelize'][_0x0652('0x4c')](function(_0x2c747d){if(_0x25bf25[_0x0652('0x4a')][_0x0652('0x4d')]===_0x0652('0x4e')){_0x25bf25[_0x0652('0x4a')][_0x0652('0x4f')]=path[_0x0652('0x50')](config['root'],_0x0652('0x51'),_0x25bf25['body'][_0x0652('0x28')]);}return db[_0x0652('0x2a')][_0x0652('0x4b')](_0x25bf25['body'],{'transaction':_0x2c747d})['then'](function(_0x1c74f8){if(_0x25bf25[_0x0652('0x4a')]['mode']===_0x0652('0x4e')){fs[_0x0652('0x52')](_0x1c74f8[_0x0652('0x4f')],parseInt('0777',0x8));}var _0x37e4de=_0x25bf25[_0x0652('0x53')][_0x0652('0x24')]({'plain':!![]});if(!_0x37e4de)throw new Error(_0x0652('0x54'));if(_0x37e4de['role']==='user'){var _0x3a3bf5=_0x1c74f8['get']({'plain':!![]});return db['UserProfileSection'][_0x0652('0x49')]({'where':{'name':'MusicOnHolds','userProfileId':_0x37e4de['userProfileId']},'raw':!![]})['then'](function(_0x22a8ce){if(_0x22a8ce&&_0x22a8ce[_0x0652('0x55')]===0x0){return db[_0x0652('0x56')]['create']({'name':_0x3a3bf5[_0x0652('0x28')],'resourceId':_0x3a3bf5['id'],'type':_0x22a8ce[_0x0652('0x28')],'sectionId':_0x22a8ce['id']},{})[_0x0652('0x23')](function(){return _0x1c74f8;});}else{return _0x1c74f8;}})['catch'](function(_0x272c38){logger[_0x0652('0x26')](_0x0652('0x57'),_0x272c38);});}return _0x1c74f8;});})[_0x0652('0x23')](respondWithResult(_0x3fbf60,0xc9))[_0x0652('0x43')](handleError(_0x3fbf60,null));};exports['destroy']=function(_0x114c7c,_0x5bed92,_0x321044){var _0x5dc98f;return db[_0x0652('0x2a')]['find']({'where':{'id':_0x114c7c['params']['id']}})[_0x0652('0x23')](function(_0x1addad){if(_0x1addad){return db[_0x0652('0x58')][_0x0652('0x4c')](function(_0x31efbc){return _0x1addad[_0x0652('0x22')]({'transaction':_0x31efbc,'raw':!![]})['then'](function(_0x4bced5){if(_0x4bced5[_0x0652('0x4f')]){fs[_0x0652('0x59')](_0x4bced5['directory'])[_0x0652('0x5a')](function(_0x33d9b0){fs[_0x0652('0x5b')](path['join'](_0x4bced5[_0x0652('0x4f')],_0x33d9b0));});fs['rmdirSync'](_0x4bced5['directory']);}return _0x4bced5;});})[_0x0652('0x43')](function(_0x58d6c7){throw new db[(_0x0652('0x5c'))][(_0x0652('0x5d'))](_0x58d6c7['message']);});}})[_0x0652('0x23')](handleEntityNotFound(_0x5bed92,null))[_0x0652('0x23')](removeEntity(_0x5bed92,null))['catch'](handleError(_0x5bed92,null));};exports['addSound']=function(_0xf339a,_0x252b0e,_0x96cb40){return db[_0x0652('0x58')]['transaction'](function(_0x4a1b81){var _0x1abbaa;return db[_0x0652('0x2a')][_0x0652('0x49')]({'where':{'id':_0xf339a[_0x0652('0x45')]['id']}})[_0x0652('0x23')](function(_0xc7ee4a){if(_0xc7ee4a){_0x1abbaa=_0xc7ee4a;return _0xc7ee4a['addSound'](_0xf339a[_0x0652('0x4a')]['id'],{'transaction':_0x4a1b81});}})[_0x0652('0x23')](function(_0x46f94a){if(_0x46f94a){return db['Sound'][_0x0652('0x5e')]({'where':{'id':_0xf339a[_0x0652('0x4a')]['id']},'attributes':['id',_0x0652('0x28'),'save_name',_0x0652('0x5f'),_0x0652('0x60')],'raw':!![]});}})[_0x0652('0x23')](function(_0x5f27e6){if(_0x5f27e6){var _0x51045e=path['join'](config['root'],_0x0652('0x61'),util[_0x0652('0x62')]('%s.%s',path['basename'](_0x5f27e6['save_name'],path[_0x0652('0x63')](_0x5f27e6[_0x0652('0x64')])),_0x5f27e6[_0x0652('0x5f')]));var _0x447c7b=path['join'](config[_0x0652('0x65')],_0x0652('0x51'),_0x1abbaa[_0x0652('0x28')],util[_0x0652('0x62')](_0x0652('0x66'),_0x5f27e6[_0x0652('0x28')],_0x5f27e6[_0x0652('0x5f')]));fs['symlinkSync'](_0x51045e,_0x447c7b);return _0x5f27e6;}})[_0x0652('0x43')](function(_0x30c736){throw new db['Sequelize'][(_0x0652('0x5d'))](_0x30c736[_0x0652('0x67')]);});})[_0x0652('0x23')](handleEntityNotFound(_0x252b0e,null))[_0x0652('0x23')](respondWithResult(_0x252b0e,0xc9))['catch'](handleError(_0x252b0e,null));};exports[_0x0652('0x68')]=function(_0x44b545,_0x38d02c,_0x18078c){return db[_0x0652('0x58')]['transaction'](function(_0x37ff2c){var _0x57c390;return db[_0x0652('0x2a')]['findOne']({'where':{'id':_0x44b545[_0x0652('0x45')]['id']}})[_0x0652('0x23')](handleEntityNotFound(_0x38d02c,null))[_0x0652('0x23')](function(_0xb676cd){if(_0xb676cd){_0x57c390=_0xb676cd;return _0xb676cd['removeSound'](_0x44b545[_0x0652('0x45')][_0x0652('0x69')]);}})['then'](function(_0x3e8d0a){if(_0x3e8d0a){return db[_0x0652('0x6a')]['findOne']({'where':{'id':_0x44b545[_0x0652('0x45')]['id2']},'attributes':['id',_0x0652('0x28'),_0x0652('0x64'),_0x0652('0x5f'),_0x0652('0x60')],'raw':!![]});}})[_0x0652('0x23')](function(_0x3ac15a){if(_0x3ac15a){fs[_0x0652('0x5b')](path['join'](_0x57c390[_0x0652('0x4f')],util['format']('%s.%s',_0x3ac15a['name'],_0x3ac15a[_0x0652('0x5f')])));return _0x3ac15a;}})[_0x0652('0x43')](function(_0x1b1c33){throw new db['Sequelize'][(_0x0652('0x5d'))](_0x1b1c33['message']);});})[_0x0652('0x23')](handleEntityNotFound(_0x38d02c,null))[_0x0652('0x23')](respondWithStatusCode(_0x38d02c,0xcc))['catch'](handleError(_0x38d02c,null));};exports[_0x0652('0x6b')]=function(_0x37a06d,_0x435fae,_0x8d46a8){var _0x469383={};var _0x315503={};var _0x155555;var _0x445998;return db[_0x0652('0x2a')][_0x0652('0x5e')]({'where':{'id':_0x37a06d[_0x0652('0x45')]['id']}})[_0x0652('0x23')](handleEntityNotFound(_0x435fae,null))[_0x0652('0x23')](function(_0x4ff1c7){if(_0x4ff1c7){_0x155555=_0x4ff1c7;_0x315503[_0x0652('0x2f')]=_[_0x0652('0x32')](db[_0x0652('0x6a')][_0x0652('0x2b')]);_0x315503[_0x0652('0x31')]=_[_0x0652('0x32')](_0x37a06d[_0x0652('0x31')]);_0x315503['filters']=_[_0x0652('0x35')](_0x315503[_0x0652('0x2f')],_0x315503[_0x0652('0x31')]);_0x469383[_0x0652('0x34')]=_[_0x0652('0x35')](_0x315503[_0x0652('0x2f')],qs[_0x0652('0x36')](_0x37a06d['query'][_0x0652('0x36')]));_0x469383['attributes']=_0x469383[_0x0652('0x34')][_0x0652('0x46')]?_0x469383['attributes']:_0x315503['model'];_0x469383[_0x0652('0x6c')]=qs[_0x0652('0x39')](_0x37a06d[_0x0652('0x31')][_0x0652('0x39')]);_0x469383[_0x0652('0x3a')]=qs[_0x0652('0x33')](_[_0x0652('0x3b')](_0x37a06d[_0x0652('0x31')],_0x315503[_0x0652('0x33')]));if(_0x37a06d['query']['filter']){_0x469383[_0x0652('0x3a')]=_[_0x0652('0x3d')](_0x469383[_0x0652('0x3a')],{'$or':_[_0x0652('0x30')](_0x469383[_0x0652('0x34')],function(_0x2c667b){var _0x1dbbaf={};_0x1dbbaf[_0x2c667b]={'$like':'%'+_0x37a06d[_0x0652('0x31')][_0x0652('0x3c')]+'%'};return _0x1dbbaf;})});}_0x469383=_[_0x0652('0x3d')]({},_0x469383,_0x37a06d[_0x0652('0x48')]);return _0x155555[_0x0652('0x6b')](_0x469383);}})[_0x0652('0x23')](function(_0x48964f){if(_0x48964f){_0x445998=_0x48964f[_0x0652('0x46')];if(!_0x37a06d[_0x0652('0x31')]['hasOwnProperty'](_0x0652('0x38'))){_0x469383[_0x0652('0x1b')]=qs['limit'](_0x37a06d[_0x0652('0x31')][_0x0652('0x1b')]);_0x469383[_0x0652('0x19')]=qs['offset'](_0x37a06d[_0x0652('0x31')][_0x0652('0x19')]);}return _0x155555[_0x0652('0x6b')](_0x469383);}})[_0x0652('0x23')](function(_0x49a78e){if(_0x49a78e){return _0x49a78e?{'count':_0x445998,'rows':_0x49a78e}:null;}})[_0x0652('0x23')](respondWithResult(_0x435fae,null))[_0x0652('0x43')](handleError(_0x435fae,null));}; \ No newline at end of file +var _0xd0ff=['rmdirSync','Sequelize','ValidationError','message','addSound','Sound','converted_format','createdAt','server/files/sounds/converted','format','save_name','server/files/moh','symlinkSync','removeSound','findOne','id2','%s.%s','length','getSounds','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','then','destroy','error','name','send','map','VoiceMusicOnHold','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','findAll','rows','catch','show','rawAttributes','includeAll','update','body','find','params','create','sequelize','transaction','files','directory','join','root','mode','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','autoAssociation','UserProfileResource','forEach','unlinkSync'];(function(_0xf20b59,_0x4202fc){var _0xca4ecd=function(_0x4af0e2){while(--_0x4af0e2){_0xf20b59['push'](_0xf20b59['shift']());}};_0xca4ecd(++_0x4202fc);}(_0xd0ff,0x160));var _0xfd0f=function(_0x2096b2,_0x53c8bd){_0x2096b2=_0x2096b2-0x0;var _0x540b16=_0xd0ff[_0x2096b2];return _0x540b16;};'use strict';var emlformat=require(_0xfd0f('0x0'));var rimraf=require(_0xfd0f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd0f('0x2'));var rp=require(_0xfd0f('0x3'));var moment=require('moment');var BPromise=require(_0xfd0f('0x4'));var Mustache=require(_0xfd0f('0x5'));var util=require(_0xfd0f('0x6'));var path=require(_0xfd0f('0x7'));var sox=require(_0xfd0f('0x8'));var csv=require(_0xfd0f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfd0f('0xa'));var _=require(_0xfd0f('0xb'));var squel=require(_0xfd0f('0xc'));var crypto=require(_0xfd0f('0xd'));var jsforce=require(_0xfd0f('0xe'));var deskjs=require(_0xfd0f('0xf'));var toCsv=require(_0xfd0f('0x9'));var querystring=require(_0xfd0f('0x10'));var Papa=require('papaparse');var Redis=require(_0xfd0f('0x11'));var authService=require(_0xfd0f('0x12'));var qs=require(_0xfd0f('0x13'));var as=require(_0xfd0f('0x14'));var hardwareService=require(_0xfd0f('0x15'));var logger=require('../../config/logger')(_0xfd0f('0x16'));var utils=require('../../config/utils');var config=require(_0xfd0f('0x17'));var licenseUtil=require(_0xfd0f('0x18'));var db=require(_0xfd0f('0x19'))['db'];function respondWithStatusCode(_0x227b0c,_0x595d25){_0x595d25=_0x595d25||0xcc;return function(_0x4e9914){if(_0x4e9914){return _0x227b0c[_0xfd0f('0x1a')](_0x595d25);}return _0x227b0c[_0xfd0f('0x1b')](_0x595d25)[_0xfd0f('0x1c')]();};}function respondWithResult(_0x596d86,_0x3e8e8e){_0x3e8e8e=_0x3e8e8e||0xc8;return function(_0x4732da){if(_0x4732da){return _0x596d86[_0xfd0f('0x1b')](_0x3e8e8e)[_0xfd0f('0x1d')](_0x4732da);}};}function respondWithFilteredResult(_0x4e0b55,_0x1b02fe){return function(_0x35c6f4){if(_0x35c6f4){var _0x4c66de=typeof _0x1b02fe[_0xfd0f('0x1e')]==='undefined'&&typeof _0x1b02fe[_0xfd0f('0x1f')]===_0xfd0f('0x20');var _0x469dec=_0x35c6f4[_0xfd0f('0x21')];var _0xec8972=_0x4c66de?0x0:_0x1b02fe[_0xfd0f('0x1e')];var _0x597909=_0x4c66de?_0x35c6f4[_0xfd0f('0x21')]:_0x1b02fe[_0xfd0f('0x1e')]+_0x1b02fe[_0xfd0f('0x1f')];var _0x3b5d70;if(_0x597909>=_0x469dec){_0x597909=_0x469dec;_0x3b5d70=0xc8;}else{_0x3b5d70=0xce;}_0x4e0b55['status'](_0x3b5d70);return _0x4e0b55[_0xfd0f('0x22')]('Content-Range',_0xec8972+'-'+_0x597909+'/'+_0x469dec)['json'](_0x35c6f4);}return null;};}function patchUpdates(_0x31a793){return function(_0x33c984){try{jsonpatch[_0xfd0f('0x23')](_0x33c984,_0x31a793,!![]);}catch(_0x2431d3){return BPromise['reject'](_0x2431d3);}return _0x33c984[_0xfd0f('0x24')]();};}function saveUpdates(_0x2b9644,_0x1e0a1e){return function(_0x4fbe15){if(_0x4fbe15){return _0x4fbe15['update'](_0x2b9644)[_0xfd0f('0x25')](function(_0x48bcde){return _0x48bcde;});}return null;};}function removeEntity(_0x22989d,_0x48dd81){return function(_0x37f1e7){if(_0x37f1e7){return _0x37f1e7['destroy']()[_0xfd0f('0x25')](function(){var _0x5f0607=_0x37f1e7['get']({'plain':!![]});var _0x4346b3='MusicOnHolds';return db['UserProfileResource'][_0xfd0f('0x26')]({'where':{'type':_0x4346b3,'resourceId':_0x5f0607['id']}})[_0xfd0f('0x25')](function(){return _0x37f1e7;});})['then'](function(){_0x22989d['status'](0xcc)[_0xfd0f('0x1c')]();});}};}function handleEntityNotFound(_0x1427e0,_0x34bf6b){return function(_0x3ecc7f){if(!_0x3ecc7f){_0x1427e0[_0xfd0f('0x1a')](0x194);}return _0x3ecc7f;};}function handleError(_0x56a331,_0x249c67){_0x249c67=_0x249c67||0x1f4;return function(_0x2f6995){logger[_0xfd0f('0x27')](_0x2f6995['stack']);if(_0x2f6995[_0xfd0f('0x28')]){delete _0x2f6995[_0xfd0f('0x28')];}_0x56a331[_0xfd0f('0x1b')](_0x249c67)[_0xfd0f('0x29')](_0x2f6995);};}exports['index']=function(_0x3fabcd,_0x4b47f5){var _0x4d6872={},_0x48365e={},_0x23c4ab={'count':0x0,'rows':[]};var _0x17c0ca=_[_0xfd0f('0x2a')](db[_0xfd0f('0x2b')]['rawAttributes'],function(_0x31565a){return{'name':_0x31565a['fieldName'],'type':_0x31565a['type'][_0xfd0f('0x2c')]};});_0x48365e['model']=_[_0xfd0f('0x2a')](_0x17c0ca,_0xfd0f('0x28'));_0x48365e[_0xfd0f('0x2d')]=_[_0xfd0f('0x2e')](_0x3fabcd[_0xfd0f('0x2d')]);_0x48365e[_0xfd0f('0x2f')]=_[_0xfd0f('0x30')](_0x48365e[_0xfd0f('0x31')],_0x48365e[_0xfd0f('0x2d')]);_0x4d6872[_0xfd0f('0x32')]=_[_0xfd0f('0x30')](_0x48365e[_0xfd0f('0x31')],qs['fields'](_0x3fabcd[_0xfd0f('0x2d')][_0xfd0f('0x33')]));_0x4d6872[_0xfd0f('0x32')]=_0x4d6872[_0xfd0f('0x32')]['length']?_0x4d6872[_0xfd0f('0x32')]:_0x48365e['model'];if(!_0x3fabcd[_0xfd0f('0x2d')][_0xfd0f('0x34')](_0xfd0f('0x35'))){_0x4d6872[_0xfd0f('0x1f')]=qs[_0xfd0f('0x1f')](_0x3fabcd[_0xfd0f('0x2d')][_0xfd0f('0x1f')]);_0x4d6872['offset']=qs['offset'](_0x3fabcd[_0xfd0f('0x2d')][_0xfd0f('0x1e')]);}_0x4d6872[_0xfd0f('0x36')]=qs['sort'](_0x3fabcd[_0xfd0f('0x2d')][_0xfd0f('0x37')]);delete _0x3fabcd[_0xfd0f('0x2d')][_0xfd0f('0x37')];_0x4d6872[_0xfd0f('0x38')]=qs[_0xfd0f('0x2f')](_[_0xfd0f('0x39')](_0x3fabcd[_0xfd0f('0x2d')],_0x48365e[_0xfd0f('0x2f')]),_0x17c0ca);if(_0x3fabcd[_0xfd0f('0x2d')][_0xfd0f('0x3a')]){_0x4d6872['where']=_[_0xfd0f('0x3b')](_0x4d6872['where'],{'$or':_['map'](_0x17c0ca,function(_0x599353){if(_0x599353[_0xfd0f('0x3c')]!=='VIRTUAL'){var _0x5f2740={};_0x5f2740[_0x599353['name']]={'$like':'%'+_0x3fabcd[_0xfd0f('0x2d')][_0xfd0f('0x3a')]+'%'};return _0x5f2740;}})});}_0x4d6872=_[_0xfd0f('0x3b')]({},_0x4d6872,_0x3fabcd[_0xfd0f('0x3d')]);var _0x180a8e={'where':_0x4d6872[_0xfd0f('0x38')]};return db['VoiceMusicOnHold'][_0xfd0f('0x21')](_0x180a8e)['then'](function(_0x9e4449){_0x23c4ab['count']=_0x9e4449;if(_0x3fabcd[_0xfd0f('0x2d')]['includeAll']){_0x4d6872['include']=[{'all':!![]}];}return db[_0xfd0f('0x2b')][_0xfd0f('0x3e')](_0x4d6872);})[_0xfd0f('0x25')](function(_0x1733fc){_0x23c4ab[_0xfd0f('0x3f')]=_0x1733fc;return _0x23c4ab;})['then'](respondWithFilteredResult(_0x4b47f5,_0x4d6872))[_0xfd0f('0x40')](handleError(_0x4b47f5,null));};exports[_0xfd0f('0x41')]=function(_0x1e4e9a,_0x572526){var _0x4649b1={'raw':![],'where':{'id':_0x1e4e9a['params']['id']}},_0x41b581={};_0x41b581[_0xfd0f('0x31')]=_[_0xfd0f('0x2e')](db['VoiceMusicOnHold'][_0xfd0f('0x42')]);_0x41b581[_0xfd0f('0x2d')]=_['keys'](_0x1e4e9a[_0xfd0f('0x2d')]);_0x41b581[_0xfd0f('0x2f')]=_[_0xfd0f('0x30')](_0x41b581[_0xfd0f('0x31')],_0x41b581['query']);_0x4649b1[_0xfd0f('0x32')]=_['intersection'](_0x41b581['model'],qs[_0xfd0f('0x33')](_0x1e4e9a[_0xfd0f('0x2d')][_0xfd0f('0x33')]));_0x4649b1[_0xfd0f('0x32')]=_0x4649b1[_0xfd0f('0x32')]['length']?_0x4649b1[_0xfd0f('0x32')]:_0x41b581[_0xfd0f('0x31')];if(_0x1e4e9a['query'][_0xfd0f('0x43')]){_0x4649b1['include']=[{'all':!![]}];}_0x4649b1=_['merge']({},_0x4649b1,_0x1e4e9a[_0xfd0f('0x3d')]);return db[_0xfd0f('0x2b')]['find'](_0x4649b1)[_0xfd0f('0x25')](handleEntityNotFound(_0x572526,null))[_0xfd0f('0x25')](respondWithResult(_0x572526,null))[_0xfd0f('0x40')](handleError(_0x572526,null));};exports[_0xfd0f('0x44')]=function(_0x4b33e0,_0x31a08b){if(_0x4b33e0['body']['id']){delete _0x4b33e0[_0xfd0f('0x45')]['id'];}return db[_0xfd0f('0x2b')][_0xfd0f('0x46')]({'where':{'id':_0x4b33e0[_0xfd0f('0x47')]['id']}})[_0xfd0f('0x25')](handleEntityNotFound(_0x31a08b,null))[_0xfd0f('0x25')](saveUpdates(_0x4b33e0[_0xfd0f('0x45')],null))[_0xfd0f('0x25')](respondWithResult(_0x31a08b,null))[_0xfd0f('0x40')](handleError(_0x31a08b,null));};exports[_0xfd0f('0x48')]=function(_0x198d15,_0x5f07a2,_0x26bd99){return db[_0xfd0f('0x49')][_0xfd0f('0x4a')](function(_0x1029ec){if(_0x198d15[_0xfd0f('0x45')]['mode']===_0xfd0f('0x4b')){_0x198d15[_0xfd0f('0x45')][_0xfd0f('0x4c')]=path[_0xfd0f('0x4d')](config[_0xfd0f('0x4e')],'server/files/moh',_0x198d15[_0xfd0f('0x45')][_0xfd0f('0x28')]);}return db[_0xfd0f('0x2b')][_0xfd0f('0x48')](_0x198d15[_0xfd0f('0x45')],{'transaction':_0x1029ec})[_0xfd0f('0x25')](function(_0x5b6cdf){if(_0x198d15['body'][_0xfd0f('0x4f')]===_0xfd0f('0x4b')){fs[_0xfd0f('0x50')](_0x5b6cdf[_0xfd0f('0x4c')],parseInt(_0xfd0f('0x51'),0x8));}var _0x3b75bc=_0x198d15[_0xfd0f('0x52')][_0xfd0f('0x53')]({'plain':!![]});if(!_0x3b75bc)throw new Error(_0xfd0f('0x54'));if(_0x3b75bc[_0xfd0f('0x55')]===_0xfd0f('0x52')){var _0x679a72=_0x5b6cdf[_0xfd0f('0x53')]({'plain':!![]});return db[_0xfd0f('0x56')][_0xfd0f('0x46')]({'where':{'name':_0xfd0f('0x57'),'userProfileId':_0x3b75bc['userProfileId']},'raw':!![]})['then'](function(_0x13272e){if(_0x13272e&&_0x13272e[_0xfd0f('0x58')]===0x0){return db[_0xfd0f('0x59')]['create']({'name':_0x679a72[_0xfd0f('0x28')],'resourceId':_0x679a72['id'],'type':_0x13272e[_0xfd0f('0x28')],'sectionId':_0x13272e['id']},{})[_0xfd0f('0x25')](function(){return _0x5b6cdf;});}else{return _0x5b6cdf;}})[_0xfd0f('0x40')](function(_0xe63493){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe63493);});}return _0x5b6cdf;});})[_0xfd0f('0x25')](respondWithResult(_0x5f07a2,0xc9))['catch'](handleError(_0x5f07a2,null));};exports[_0xfd0f('0x26')]=function(_0x7cf022,_0x3aabcb,_0x3737aa){var _0x9e6823;return db[_0xfd0f('0x2b')][_0xfd0f('0x46')]({'where':{'id':_0x7cf022['params']['id']}})[_0xfd0f('0x25')](function(_0x35a072){if(_0x35a072){return db[_0xfd0f('0x49')][_0xfd0f('0x4a')](function(_0x2c212f){return _0x35a072[_0xfd0f('0x26')]({'transaction':_0x2c212f,'raw':!![]})[_0xfd0f('0x25')](function(_0x4e09cf){if(_0x4e09cf[_0xfd0f('0x4c')]){fs['readdirSync'](_0x4e09cf['directory'])[_0xfd0f('0x5a')](function(_0x486b0d){fs[_0xfd0f('0x5b')](path['join'](_0x4e09cf[_0xfd0f('0x4c')],_0x486b0d));});fs[_0xfd0f('0x5c')](_0x4e09cf[_0xfd0f('0x4c')]);}return _0x4e09cf;});})['catch'](function(_0x2f4b38){throw new db[(_0xfd0f('0x5d'))][(_0xfd0f('0x5e'))](_0x2f4b38[_0xfd0f('0x5f')]);});}})[_0xfd0f('0x25')](handleEntityNotFound(_0x3aabcb,null))[_0xfd0f('0x25')](removeEntity(_0x3aabcb,null))[_0xfd0f('0x40')](handleError(_0x3aabcb,null));};exports['addSound']=function(_0x27c22d,_0x28b9d3,_0x28e43a){return db[_0xfd0f('0x49')][_0xfd0f('0x4a')](function(_0x25940e){var _0x5ba275;return db['VoiceMusicOnHold'][_0xfd0f('0x46')]({'where':{'id':_0x27c22d['params']['id']}})[_0xfd0f('0x25')](function(_0x2a27ca){if(_0x2a27ca){_0x5ba275=_0x2a27ca;return _0x2a27ca[_0xfd0f('0x60')](_0x27c22d[_0xfd0f('0x45')]['id'],{'transaction':_0x25940e});}})[_0xfd0f('0x25')](function(_0x1cdd38){if(_0x1cdd38){return db[_0xfd0f('0x61')]['findOne']({'where':{'id':_0x27c22d[_0xfd0f('0x45')]['id']},'attributes':['id',_0xfd0f('0x28'),'save_name',_0xfd0f('0x62'),_0xfd0f('0x63')],'raw':!![]});}})[_0xfd0f('0x25')](function(_0x401b0a){if(_0x401b0a){var _0x3e13be=path[_0xfd0f('0x4d')](config['root'],_0xfd0f('0x64'),util[_0xfd0f('0x65')]('%s.%s',path['basename'](_0x401b0a[_0xfd0f('0x66')],path['extname'](_0x401b0a[_0xfd0f('0x66')])),_0x401b0a[_0xfd0f('0x62')]));var _0x479c4a=path[_0xfd0f('0x4d')](config['root'],_0xfd0f('0x67'),_0x5ba275[_0xfd0f('0x28')],util['format']('%s.%s',_0x401b0a[_0xfd0f('0x28')],_0x401b0a[_0xfd0f('0x62')]));fs[_0xfd0f('0x68')](_0x3e13be,_0x479c4a);return _0x401b0a;}})['catch'](function(_0x4dd17a){throw new db['Sequelize']['ValidationError'](_0x4dd17a[_0xfd0f('0x5f')]);});})[_0xfd0f('0x25')](handleEntityNotFound(_0x28b9d3,null))[_0xfd0f('0x25')](respondWithResult(_0x28b9d3,0xc9))[_0xfd0f('0x40')](handleError(_0x28b9d3,null));};exports[_0xfd0f('0x69')]=function(_0xc4f4f7,_0x401f6e,_0x2811b2){return db[_0xfd0f('0x49')][_0xfd0f('0x4a')](function(_0x464932){var _0x3c15bd;return db['VoiceMusicOnHold'][_0xfd0f('0x6a')]({'where':{'id':_0xc4f4f7[_0xfd0f('0x47')]['id']}})[_0xfd0f('0x25')](handleEntityNotFound(_0x401f6e,null))[_0xfd0f('0x25')](function(_0x110df0){if(_0x110df0){_0x3c15bd=_0x110df0;return _0x110df0[_0xfd0f('0x69')](_0xc4f4f7[_0xfd0f('0x47')]['id2']);}})[_0xfd0f('0x25')](function(_0x2c1cf6){if(_0x2c1cf6){return db[_0xfd0f('0x61')][_0xfd0f('0x6a')]({'where':{'id':_0xc4f4f7[_0xfd0f('0x47')][_0xfd0f('0x6b')]},'attributes':['id',_0xfd0f('0x28'),'save_name',_0xfd0f('0x62'),'createdAt'],'raw':!![]});}})[_0xfd0f('0x25')](function(_0x3c5e27){if(_0x3c5e27){fs[_0xfd0f('0x5b')](path[_0xfd0f('0x4d')](_0x3c15bd[_0xfd0f('0x4c')],util[_0xfd0f('0x65')](_0xfd0f('0x6c'),_0x3c5e27[_0xfd0f('0x28')],_0x3c5e27[_0xfd0f('0x62')])));return _0x3c5e27;}})[_0xfd0f('0x40')](function(_0x1ff0f6){throw new db['Sequelize'][(_0xfd0f('0x5e'))](_0x1ff0f6['message']);});})[_0xfd0f('0x25')](handleEntityNotFound(_0x401f6e,null))[_0xfd0f('0x25')](respondWithStatusCode(_0x401f6e,0xcc))[_0xfd0f('0x40')](handleError(_0x401f6e,null));};exports['getSounds']=function(_0x2d1ff7,_0x4730a3,_0xf52c7b){var _0xc9a76f={};var _0x38a1ce={};var _0x2c2805;var _0x16b2ff;return db[_0xfd0f('0x2b')][_0xfd0f('0x6a')]({'where':{'id':_0x2d1ff7[_0xfd0f('0x47')]['id']}})['then'](handleEntityNotFound(_0x4730a3,null))[_0xfd0f('0x25')](function(_0x1a8e8b){if(_0x1a8e8b){_0x2c2805=_0x1a8e8b;_0x38a1ce[_0xfd0f('0x31')]=_[_0xfd0f('0x2e')](db['Sound']['rawAttributes']);_0x38a1ce[_0xfd0f('0x2d')]=_[_0xfd0f('0x2e')](_0x2d1ff7[_0xfd0f('0x2d')]);_0x38a1ce[_0xfd0f('0x2f')]=_[_0xfd0f('0x30')](_0x38a1ce['model'],_0x38a1ce[_0xfd0f('0x2d')]);_0xc9a76f[_0xfd0f('0x32')]=_[_0xfd0f('0x30')](_0x38a1ce['model'],qs[_0xfd0f('0x33')](_0x2d1ff7[_0xfd0f('0x2d')][_0xfd0f('0x33')]));_0xc9a76f[_0xfd0f('0x32')]=_0xc9a76f[_0xfd0f('0x32')]['length']?_0xc9a76f[_0xfd0f('0x32')]:_0x38a1ce[_0xfd0f('0x31')];_0xc9a76f[_0xfd0f('0x36')]=qs[_0xfd0f('0x37')](_0x2d1ff7['query']['sort']);_0xc9a76f[_0xfd0f('0x38')]=qs[_0xfd0f('0x2f')](_[_0xfd0f('0x39')](_0x2d1ff7[_0xfd0f('0x2d')],_0x38a1ce[_0xfd0f('0x2f')]));if(_0x2d1ff7[_0xfd0f('0x2d')]['filter']){_0xc9a76f[_0xfd0f('0x38')]=_[_0xfd0f('0x3b')](_0xc9a76f[_0xfd0f('0x38')],{'$or':_[_0xfd0f('0x2a')](_0xc9a76f['attributes'],function(_0x13da3f){var _0x15f44a={};_0x15f44a[_0x13da3f]={'$like':'%'+_0x2d1ff7['query'][_0xfd0f('0x3a')]+'%'};return _0x15f44a;})});}_0xc9a76f=_['merge']({},_0xc9a76f,_0x2d1ff7[_0xfd0f('0x3d')]);return _0x2c2805['getSounds'](_0xc9a76f);}})[_0xfd0f('0x25')](function(_0x4ebf76){if(_0x4ebf76){_0x16b2ff=_0x4ebf76[_0xfd0f('0x6d')];if(!_0x2d1ff7[_0xfd0f('0x2d')][_0xfd0f('0x34')]('nolimit')){_0xc9a76f['limit']=qs[_0xfd0f('0x1f')](_0x2d1ff7['query'][_0xfd0f('0x1f')]);_0xc9a76f[_0xfd0f('0x1e')]=qs[_0xfd0f('0x1e')](_0x2d1ff7[_0xfd0f('0x2d')]['offset']);}return _0x2c2805[_0xfd0f('0x6e')](_0xc9a76f);}})[_0xfd0f('0x25')](function(_0xa4266a){if(_0xa4266a){return _0xa4266a?{'count':_0x16b2ff,'rows':_0xa4266a}:null;}})[_0xfd0f('0x25')](respondWithResult(_0x4730a3,null))[_0xfd0f('0x40')](handleError(_0x4730a3,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 3845760..c55e301 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 _0xa69e=['voice_musiconhold','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold'];(function(_0x368fde,_0x28a695){var _0x3dc7eb=function(_0x3cabd7){while(--_0x3cabd7){_0x368fde['push'](_0x368fde['shift']());}};_0x3dc7eb(++_0x28a695);}(_0xa69e,0x12a));var _0xea69=function(_0x3b7785,_0x432897){_0x3b7785=_0x3b7785-0x0;var _0x2ede21=_0xa69e[_0x3b7785];return _0x2ede21;};'use strict';var _=require(_0xea69('0x0'));var util=require(_0xea69('0x1'));var logger=require(_0xea69('0x2'))('api');var moment=require(_0xea69('0x3'));var BPromise=require(_0xea69('0x4'));var rp=require(_0xea69('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xea69('0x6'));var attributes=require(_0xea69('0x7'));module['exports']=function(_0x33d86f,_0x19d9eb){return _0x33d86f[_0xea69('0x8')](_0xea69('0x9'),attributes,{'tableName':_0xea69('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e67=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','VoiceMusicOnHold','lodash','util'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x3e67,0x169));var _0x73e6=function(_0x4629ee,_0x5802d8){_0x4629ee=_0x4629ee-0x0;var _0x47fb5b=_0x3e67[_0x4629ee];return _0x47fb5b;};'use strict';var _=require(_0x73e6('0x0'));var util=require(_0x73e6('0x1'));var logger=require(_0x73e6('0x2'))(_0x73e6('0x3'));var moment=require(_0x73e6('0x4'));var BPromise=require(_0x73e6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x73e6('0x6'));var config=require(_0x73e6('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x73e6('0x8')]=function(_0x34b53a,_0x550718){return _0x34b53a[_0x73e6('0x9')](_0x73e6('0xa'),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 4bc71c5..006299c 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 _0x43d8=['moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','http','info','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x7b5cdd,_0x8c88d8){var _0x3a29ae=function(_0x17859a){while(--_0x17859a){_0x7b5cdd['push'](_0x7b5cdd['shift']());}};_0x3a29ae(++_0x8c88d8);}(_0x43d8,0x12a));var _0x843d=function(_0x528342,_0x17a981){_0x528342=_0x528342-0x0;var _0x27dd91=_0x43d8[_0x528342];return _0x27dd91;};'use strict';var _=require(_0x843d('0x0'));var util=require(_0x843d('0x1'));var moment=require(_0x843d('0x2'));var BPromise=require(_0x843d('0x3'));var rs=require(_0x843d('0x4'));var fs=require('fs');var Redis=require(_0x843d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x843d('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x843d('0x7'));var client=jayson['client'][_0x843d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9cb2,_0x5b0595,_0x2c150b){return new BPromise(function(_0xb76a3a,_0x7a095f){return client['request'](_0x1d9cb2,_0x2c150b)['then'](function(_0x448c0c){logger[_0x843d('0x9')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5b0595,_0x843d('0xa'));logger[_0x843d('0xb')](_0x843d('0xc'),_0x5b0595,'request\x20sent',JSON[_0x843d('0xd')](_0x448c0c));if(_0x448c0c[_0x843d('0xe')]){if(_0x448c0c[_0x843d('0xe')][_0x843d('0xf')]===0x1f4){logger['error'](_0x843d('0x10'),_0x5b0595,_0x448c0c[_0x843d('0xe')][_0x843d('0x11')]);return _0x7a095f(_0x448c0c[_0x843d('0xe')][_0x843d('0x11')]);}logger[_0x843d('0xe')](_0x843d('0x10'),_0x5b0595,_0x448c0c[_0x843d('0xe')][_0x843d('0x11')]);return _0xb76a3a(_0x448c0c[_0x843d('0xe')]['message']);}else{logger[_0x843d('0x9')](_0x843d('0x10'),_0x5b0595,_0x843d('0xa'));_0xb76a3a(_0x448c0c[_0x843d('0x12')][_0x843d('0x11')]);}})[_0x843d('0x13')](function(_0x21d9f0){logger['error'](_0x843d('0x10'),_0x5b0595,_0x21d9f0);_0x7a095f(_0x21d9f0);});});} \ No newline at end of file +var _0x018d=['stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x3f288e,_0x8cdada){var _0x271e04=function(_0x28621a){while(--_0x28621a){_0x3f288e['push'](_0x3f288e['shift']());}};_0x271e04(++_0x8cdada);}(_0x018d,0xe1));var _0xd018=function(_0x1f1170,_0x3b5783){_0x1f1170=_0x1f1170-0x0;var _0x127b7b=_0x018d[_0x1f1170];return _0x127b7b;};'use strict';var _=require(_0xd018('0x0'));var util=require(_0xd018('0x1'));var moment=require(_0xd018('0x2'));var BPromise=require('bluebird');var rs=require(_0xd018('0x3'));var fs=require('fs');var Redis=require(_0xd018('0x4'));var db=require(_0xd018('0x5'))['db'];var utils=require(_0xd018('0x6'));var logger=require('../../config/logger')(_0xd018('0x7'));var config=require(_0xd018('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd018('0x9')][_0xd018('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44564e,_0x35e41e,_0x95540){return new BPromise(function(_0x3b9330,_0x231028){return client[_0xd018('0xb')](_0x44564e,_0x95540)[_0xd018('0xc')](function(_0x59771d){logger[_0xd018('0xd')](_0xd018('0xe'),_0x35e41e,'request\x20sent');logger[_0xd018('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x35e41e,_0xd018('0x10'),JSON[_0xd018('0x11')](_0x59771d));if(_0x59771d[_0xd018('0x12')]){if(_0x59771d[_0xd018('0x12')][_0xd018('0x13')]===0x1f4){logger['error'](_0xd018('0xe'),_0x35e41e,_0x59771d[_0xd018('0x12')][_0xd018('0x14')]);return _0x231028(_0x59771d[_0xd018('0x12')][_0xd018('0x14')]);}logger[_0xd018('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x35e41e,_0x59771d[_0xd018('0x12')][_0xd018('0x14')]);return _0x3b9330(_0x59771d[_0xd018('0x12')][_0xd018('0x14')]);}else{logger[_0xd018('0xd')](_0xd018('0xe'),_0x35e41e,_0xd018('0x10'));_0x3b9330(_0x59771d[_0xd018('0x15')]['message']);}})['catch'](function(_0x15867c){logger[_0xd018('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x35e41e,_0x15867c);_0x231028(_0x15867c);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index e03cf60..e081e5f 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 _0x687b=['./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','show','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x536f15,_0xf85e8f){var _0x5ea6a5=function(_0xfdb0b5){while(--_0xfdb0b5){_0x536f15['push'](_0x536f15['shift']());}};_0x5ea6a5(++_0xf85e8f);}(_0x687b,0x14a));var _0xb687=function(_0x5d1ae8,_0x1cfb7b){_0x5d1ae8=_0x5d1ae8-0x0;var _0x2e3995=_0x687b[_0x5d1ae8];return _0x2e3995;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb687('0x4'));var auth=require(_0xb687('0x5'));var interaction=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var controller=require(_0xb687('0x8'));router[_0xb687('0x9')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0xb')]);router[_0xb687('0x9')](_0xb687('0xc'),auth['isAuthenticated'](),controller[_0xb687('0xd')]);router[_0xb687('0x9')]('/:id',auth[_0xb687('0xa')](),controller[_0xb687('0xe')]);router[_0xb687('0x9')](_0xb687('0xf'),auth[_0xb687('0xa')](),controller[_0xb687('0x10')]);router[_0xb687('0x11')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0x12')]);router['post'](_0xb687('0xf'),auth[_0xb687('0xa')](),controller[_0xb687('0x13')]);router[_0xb687('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xb687('0x15')]);router[_0xb687('0x16')]('/:id',auth[_0xb687('0xa')](),controller[_0xb687('0x17')]);router[_0xb687('0x16')](_0xb687('0xf'),auth[_0xb687('0xa')](),controller[_0xb687('0x18')]);module[_0xb687('0x19')]=router; \ No newline at end of file +var _0x7046=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','show','/:id/users','getAgents','post','create','put','/:id','update','delete','destroy','removeAgents','exports','multer'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x7046,0x144));var _0x6704=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7046[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var path=require(_0x6704('0x2'));var timeout=require(_0x6704('0x3'));var express=require('express');var router=express[_0x6704('0x4')]();var fs_extra=require(_0x6704('0x5'));var auth=require(_0x6704('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6704('0x7'));var controller=require(_0x6704('0x8'));router[_0x6704('0x9')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0xb')]);router['get'](_0x6704('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x6704('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6704('0xd')]);router[_0x6704('0x9')](_0x6704('0xe'),auth[_0x6704('0xa')](),controller[_0x6704('0xf')]);router[_0x6704('0x10')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0x11')]);router['post'](_0x6704('0xe'),auth[_0x6704('0xa')](),controller['addAgents']);router[_0x6704('0x12')](_0x6704('0x13'),auth[_0x6704('0xa')](),controller[_0x6704('0x14')]);router[_0x6704('0x15')](_0x6704('0x13'),auth[_0x6704('0xa')](),controller[_0x6704('0x16')]);router[_0x6704('0x15')]('/:id/users',auth[_0x6704('0xa')](),controller[_0x6704('0x17')]);module[_0x6704('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index bcb560c..05b4730 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 _0xb5f8=['VIRTUAL','system-','getDataValue','sequelize','exports','STRING','name'];(function(_0x38ee65,_0x302c0c){var _0x56e9db=function(_0x501b53){while(--_0x501b53){_0x38ee65['push'](_0x38ee65['shift']());}};_0x56e9db(++_0x302c0c);}(_0xb5f8,0x88));var _0x8b5f=function(_0x399e8e,_0x26ac40){_0x399e8e=_0x399e8e-0x0;var _0x379c4b=_0xb5f8[_0x399e8e];return _0x379c4b;};'use strict';var Sequelize=require(_0x8b5f('0x0'));module[_0x8b5f('0x1')]={'name':{'type':Sequelize[_0x8b5f('0x2')],'allowNull':![],'unique':_0x8b5f('0x3')},'prefix':{'type':Sequelize[_0x8b5f('0x4')],'get':function(_0x5ad302){return _0x8b5f('0x5')+this[_0x8b5f('0x6')]('name')+'-';}},'description':{'type':Sequelize[_0x8b5f('0x2')]},'callerIdAll':{'type':Sequelize[_0x8b5f('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xca66=['INTEGER','sequelize','name','VIRTUAL','getDataValue','STRING'];(function(_0x45b0d8,_0x4bb477){var _0x8cb514=function(_0x5020c9){while(--_0x5020c9){_0x45b0d8['push'](_0x45b0d8['shift']());}};_0x8cb514(++_0x4bb477);}(_0xca66,0x8b));var _0x6ca6=function(_0x53630d,_0x11ca08){_0x53630d=_0x53630d-0x0;var _0x4f63c4=_0xca66[_0x53630d];return _0x4f63c4;};'use strict';var Sequelize=require(_0x6ca6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6ca6('0x1')},'prefix':{'type':Sequelize[_0x6ca6('0x2')],'get':function(_0x44d1de){return'system-'+this[_0x6ca6('0x3')]('name')+'-';}},'description':{'type':Sequelize[_0x6ca6('0x4')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x6ca6('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 14d10fc..76093e7 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 _0xbbb5=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','VoicePrefixes','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','VoicePrefix','includeAll','include','findAll','rows','catch','show','params','find','describe','create','transaction','body','get','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','appdata','prefix','NoOp','Voice\x20Prefix','VoiceExtension','VoicePrefixId','bulkCreate','push','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','sequelize','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','filters','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js'];(function(_0x5c89ef,_0x296c7e){var _0x517710=function(_0x4fd0e7){while(--_0x4fd0e7){_0x5c89ef['push'](_0x5c89ef['shift']());}};_0x517710(++_0x296c7e);}(_0xbbb5,0x1d7));var _0x5bbb=function(_0x26d0c1,_0x5bd85d){_0x26d0c1=_0x26d0c1-0x0;var _0xb40d71=_0xbbb5[_0x26d0c1];return _0xb40d71;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5bbb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5bbb('0x1'));var moment=require(_0x5bbb('0x2'));var BPromise=require(_0x5bbb('0x3'));var Mustache=require(_0x5bbb('0x4'));var util=require(_0x5bbb('0x5'));var path=require(_0x5bbb('0x6'));var sox=require('sox');var csv=require(_0x5bbb('0x7'));var ejs=require(_0x5bbb('0x8'));var fs=require('fs');var fs_extra=require(_0x5bbb('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5bbb('0xa'));var jsforce=require(_0x5bbb('0xb'));var deskjs=require(_0x5bbb('0xc'));var toCsv=require(_0x5bbb('0x7'));var querystring=require(_0x5bbb('0xd'));var Papa=require(_0x5bbb('0xe'));var Redis=require(_0x5bbb('0xf'));var authService=require(_0x5bbb('0x10'));var qs=require(_0x5bbb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5bbb('0x12'))(_0x5bbb('0x13'));var utils=require(_0x5bbb('0x14'));var config=require(_0x5bbb('0x15'));var licenseUtil=require(_0x5bbb('0x16'));var db=require(_0x5bbb('0x17'))['db'];config[_0x5bbb('0x18')]=_[_0x5bbb('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5bbb('0x18')]));require(_0x5bbb('0x1a'))['register'](socket);function respondWithStatusCode(_0x1233a0,_0x15e332){_0x15e332=_0x15e332||0xcc;return function(_0x2b6078){if(_0x2b6078){return _0x1233a0[_0x5bbb('0x1b')](_0x15e332);}return _0x1233a0[_0x5bbb('0x1c')](_0x15e332)[_0x5bbb('0x1d')]();};}function respondWithResult(_0xed42e4,_0x3fe2d2){_0x3fe2d2=_0x3fe2d2||0xc8;return function(_0x156c7a){if(_0x156c7a){return _0xed42e4[_0x5bbb('0x1c')](_0x3fe2d2)[_0x5bbb('0x1e')](_0x156c7a);}};}function respondWithFilteredResult(_0x4398f8,_0x1bd211){return function(_0x112b65){if(_0x112b65){var _0x1d2d53=typeof _0x1bd211[_0x5bbb('0x1f')]===_0x5bbb('0x20')&&typeof _0x1bd211['limit']===_0x5bbb('0x20');var _0x17f9cc=_0x112b65[_0x5bbb('0x21')];var _0x21e267=_0x1d2d53?0x0:_0x1bd211[_0x5bbb('0x1f')];var _0x3af7c0=_0x1d2d53?_0x112b65[_0x5bbb('0x21')]:_0x1bd211[_0x5bbb('0x1f')]+_0x1bd211[_0x5bbb('0x22')];var _0x10fe5d;if(_0x3af7c0>=_0x17f9cc){_0x3af7c0=_0x17f9cc;_0x10fe5d=0xc8;}else{_0x10fe5d=0xce;}_0x4398f8[_0x5bbb('0x1c')](_0x10fe5d);return _0x4398f8[_0x5bbb('0x23')]('Content-Range',_0x21e267+'-'+_0x3af7c0+'/'+_0x17f9cc)['json'](_0x112b65);}return null;};}function patchUpdates(_0x66aca3){return function(_0x845e0a){try{jsonpatch[_0x5bbb('0x24')](_0x845e0a,_0x66aca3,!![]);}catch(_0x57e933){return BPromise['reject'](_0x57e933);}return _0x845e0a[_0x5bbb('0x25')]();};}function saveUpdates(_0x154b2c,_0x532ba1){return function(_0x4710ef){if(_0x4710ef){return _0x4710ef[_0x5bbb('0x26')](_0x154b2c)[_0x5bbb('0x27')](function(_0x43e35f){return _0x43e35f;});}return null;};}function removeEntity(_0x8acc1d,_0x4fbb7b){return function(_0x1808c2){if(_0x1808c2){return _0x1808c2[_0x5bbb('0x28')]()['then'](function(){var _0x3ed2e1=_0x1808c2['get']({'plain':!![]});var _0x29dd2e=_0x5bbb('0x29');return db[_0x5bbb('0x2a')][_0x5bbb('0x28')]({'where':{'type':_0x29dd2e,'resourceId':_0x3ed2e1['id']}})[_0x5bbb('0x27')](function(){return _0x1808c2;});})[_0x5bbb('0x27')](function(){_0x8acc1d[_0x5bbb('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x235c83,_0xff8a1f){return function(_0x4678bc){if(!_0x4678bc){_0x235c83[_0x5bbb('0x1b')](0x194);}return _0x4678bc;};}function handleError(_0x4a72ac,_0x39ed1f){_0x39ed1f=_0x39ed1f||0x1f4;return function(_0x1c6d9b){logger[_0x5bbb('0x2b')](_0x1c6d9b[_0x5bbb('0x2c')]);if(_0x1c6d9b[_0x5bbb('0x2d')]){delete _0x1c6d9b['name'];}_0x4a72ac[_0x5bbb('0x1c')](_0x39ed1f)['send'](_0x1c6d9b);};}exports[_0x5bbb('0x2e')]=function(_0x5f1e4b,_0x16516d){var _0x213537={},_0x53a438={},_0x41dd2b={'count':0x0,'rows':[]};var _0x31fb7b=_['map'](db['VoicePrefix'][_0x5bbb('0x2f')],function(_0x5d6566){return{'name':_0x5d6566[_0x5bbb('0x30')],'type':_0x5d6566[_0x5bbb('0x31')][_0x5bbb('0x32')]};});_0x53a438[_0x5bbb('0x33')]=_[_0x5bbb('0x34')](_0x31fb7b,_0x5bbb('0x2d'));_0x53a438[_0x5bbb('0x35')]=_[_0x5bbb('0x36')](_0x5f1e4b[_0x5bbb('0x35')]);_0x53a438['filters']=_[_0x5bbb('0x37')](_0x53a438[_0x5bbb('0x33')],_0x53a438['query']);_0x213537[_0x5bbb('0x38')]=_[_0x5bbb('0x37')](_0x53a438[_0x5bbb('0x33')],qs[_0x5bbb('0x39')](_0x5f1e4b['query']['fields']));_0x213537[_0x5bbb('0x38')]=_0x213537[_0x5bbb('0x38')][_0x5bbb('0x3a')]?_0x213537[_0x5bbb('0x38')]:_0x53a438['model'];if(!_0x5f1e4b[_0x5bbb('0x35')][_0x5bbb('0x3b')](_0x5bbb('0x3c'))){_0x213537['limit']=qs[_0x5bbb('0x22')](_0x5f1e4b[_0x5bbb('0x35')][_0x5bbb('0x22')]);_0x213537[_0x5bbb('0x1f')]=qs['offset'](_0x5f1e4b[_0x5bbb('0x35')]['offset']);}_0x213537[_0x5bbb('0x3d')]=qs[_0x5bbb('0x3e')](_0x5f1e4b['query']['sort']);_0x213537[_0x5bbb('0x3f')]=qs['filters'](_['pick'](_0x5f1e4b['query'],_0x53a438['filters']),_0x31fb7b);if(_0x5f1e4b['query'][_0x5bbb('0x40')]){_0x213537[_0x5bbb('0x3f')]=_[_0x5bbb('0x41')](_0x213537[_0x5bbb('0x3f')],{'$or':_[_0x5bbb('0x34')](_0x31fb7b,function(_0x507066){if(_0x507066[_0x5bbb('0x31')]!==_0x5bbb('0x42')){var _0x15058e={};_0x15058e[_0x507066['name']]={'$like':'%'+_0x5f1e4b[_0x5bbb('0x35')][_0x5bbb('0x40')]+'%'};return _0x15058e;}})});}_0x213537=_[_0x5bbb('0x41')]({},_0x213537,_0x5f1e4b[_0x5bbb('0x43')]);var _0x57006b={'where':_0x213537[_0x5bbb('0x3f')]};return db[_0x5bbb('0x44')]['count'](_0x57006b)[_0x5bbb('0x27')](function(_0x410201){_0x41dd2b[_0x5bbb('0x21')]=_0x410201;if(_0x5f1e4b[_0x5bbb('0x35')][_0x5bbb('0x45')]){_0x213537[_0x5bbb('0x46')]=[{'all':!![]}];}return db[_0x5bbb('0x44')][_0x5bbb('0x47')](_0x213537);})[_0x5bbb('0x27')](function(_0xa43fd){_0x41dd2b[_0x5bbb('0x48')]=_0xa43fd;return _0x41dd2b;})['then'](respondWithFilteredResult(_0x16516d,_0x213537))[_0x5bbb('0x49')](handleError(_0x16516d,null));};exports[_0x5bbb('0x4a')]=function(_0x1fd909,_0x4692d8){var _0x24bd6f={'raw':![],'where':{'id':_0x1fd909[_0x5bbb('0x4b')]['id']}},_0x6b86f={};_0x6b86f['model']=_[_0x5bbb('0x36')](db['VoicePrefix'][_0x5bbb('0x2f')]);_0x6b86f[_0x5bbb('0x35')]=_[_0x5bbb('0x36')](_0x1fd909['query']);_0x6b86f['filters']=_[_0x5bbb('0x37')](_0x6b86f[_0x5bbb('0x33')],_0x6b86f['query']);_0x24bd6f[_0x5bbb('0x38')]=_[_0x5bbb('0x37')](_0x6b86f['model'],qs['fields'](_0x1fd909[_0x5bbb('0x35')]['fields']));_0x24bd6f[_0x5bbb('0x38')]=_0x24bd6f[_0x5bbb('0x38')][_0x5bbb('0x3a')]?_0x24bd6f[_0x5bbb('0x38')]:_0x6b86f['model'];if(_0x1fd909[_0x5bbb('0x35')][_0x5bbb('0x45')]){_0x24bd6f['include']=[{'all':!![]}];}_0x24bd6f=_[_0x5bbb('0x41')]({},_0x24bd6f,_0x1fd909[_0x5bbb('0x43')]);return db[_0x5bbb('0x44')][_0x5bbb('0x4c')](_0x24bd6f)[_0x5bbb('0x27')](handleEntityNotFound(_0x4692d8,null))[_0x5bbb('0x27')](respondWithResult(_0x4692d8,null))[_0x5bbb('0x49')](handleError(_0x4692d8,null));};exports[_0x5bbb('0x28')]=function(_0x210c38,_0x15e0e8){return db[_0x5bbb('0x44')][_0x5bbb('0x4c')]({'where':{'id':_0x210c38[_0x5bbb('0x4b')]['id']}})[_0x5bbb('0x27')](handleEntityNotFound(_0x15e0e8,null))['then'](removeEntity(_0x15e0e8,null))['catch'](handleError(_0x15e0e8,null));};exports[_0x5bbb('0x4d')]=function(_0x3bb13a,_0x230c9d){return db['VoicePrefix'][_0x5bbb('0x4d')]()[_0x5bbb('0x27')](respondWithResult(_0x230c9d,null))['catch'](handleError(_0x230c9d,null));};exports[_0x5bbb('0x4e')]=function(_0x14847e,_0x1527d6){var _0x267bb8;return db['sequelize'][_0x5bbb('0x4f')](function(_0x195012){return db[_0x5bbb('0x44')][_0x5bbb('0x4e')](_0x14847e[_0x5bbb('0x50')],{'transaction':_0x195012})[_0x5bbb('0x27')](function(_0x4cab5d){_0x267bb8=_0x4cab5d[_0x5bbb('0x51')]({'plain':!![]});return db['VoiceExtension'][_0x5bbb('0x4c')]({'where':{'id':_0x267bb8[_0x5bbb('0x52')]},'raw':!![]})[_0x5bbb('0x27')](function(_0xbf389b){return createVoicePrefixExtensions(_0x267bb8,_0xbf389b,_0x195012);});});})[_0x5bbb('0x27')](function(){var _0x1ee7c3=_0x14847e[_0x5bbb('0x53')][_0x5bbb('0x51')]({'plain':!![]});if(!_0x1ee7c3)throw new Error(_0x5bbb('0x54'));if(_0x1ee7c3[_0x5bbb('0x55')]==='user'){var _0x304645=_0x267bb8;return db['UserProfileSection'][_0x5bbb('0x4c')]({'where':{'name':_0x5bbb('0x29'),'userProfileId':_0x1ee7c3[_0x5bbb('0x56')]},'raw':!![]})[_0x5bbb('0x27')](function(_0x35c75f){if(_0x35c75f&&_0x35c75f[_0x5bbb('0x57')]===0x0){return db[_0x5bbb('0x2a')][_0x5bbb('0x4e')]({'name':_0x304645[_0x5bbb('0x2d')],'resourceId':_0x304645['id'],'type':_0x35c75f[_0x5bbb('0x2d')],'sectionId':_0x35c75f['id']},{})[_0x5bbb('0x27')](function(){return _0x267bb8;});}else{return _0x267bb8;}})[_0x5bbb('0x49')](function(_0x1cf3de){logger['error'](_0x5bbb('0x58'),_0x1cf3de);throw _0x1cf3de;});}return _0x267bb8;})[_0x5bbb('0x27')](respondWithResult(_0x1527d6,null))[_0x5bbb('0x49')](handleError(_0x1527d6,null));};function Extension(_0x73fdb0,_0x2319b3,_0x36b8c4,_0x5f28bc){this[_0x5bbb('0x59')]=_0x5bbb('0x5a');this[_0x5bbb('0x5b')]=_0x73fdb0;this[_0x5bbb('0x5c')]=_0x36b8c4;this[_0x5bbb('0x31')]=_0x5bbb('0x5d');this[_0x5bbb('0x5e')]='Voice\x20Prefix\x20Extension';this['priority']=_0x2319b3;this[_0x5bbb('0x5f')]=_0x5f28bc;}function createVoicePrefixExtensions(_0x2f4ef2,_0x348d29,_0xb5aeb){return new BPromise(function(_0x151c3c,_0x4ac7b1){var _0x4f925e=new Extension(formatPrefixName(_0x2f4ef2[_0x5bbb('0x60')]),0x1,_0x5bbb('0x61'),_0x5bbb('0x62'));_0x4f925e['VoicePrefixId']=_0x2f4ef2['id'];return db[_0x5bbb('0x63')][_0x5bbb('0x4e')](_0x4f925e,{'transaction':_0xb5aeb})['then'](function(_0x2d79e0){var _0x1caf75=_0x2d79e0[_0x5bbb('0x51')]({'plain':!![]});var _0x722590=_[_0x5bbb('0x34')](addVoicePrefixExtensions(_0x2f4ef2,_0x348d29),function(_0x479918){_0x479918[_0x5bbb('0x52')]=_0x1caf75['id'];_0x479918[_0x5bbb('0x64')]=_0x2f4ef2['id'];return _0x479918;});return db[_0x5bbb('0x63')][_0x5bbb('0x65')](_0x722590,{'transaction':_0xb5aeb})[_0x5bbb('0x27')](function(_0x4a8100){if(!_0x4a8100){return _0x4ac7b1('Extensions\x20creation\x20failed');}else{return _0x151c3c(_0x4a8100);}})['catch'](function(_0x1bd1f9){return _0x4ac7b1(_0x1bd1f9);});});;});};function addVoicePrefixExtensions(_0x205fba,_0x420857){var _0x37830c=[];var _0x429b67=formatPrefixName(_0x205fba['prefix']);_0x37830c[_0x5bbb('0x66')](new Extension(_0x429b67,0x2,'Set',_0x5bbb('0x67')+_0x205fba[_0x5bbb('0x2d')]));if(_0x205fba[_0x5bbb('0x68')]){_0x37830c[_0x5bbb('0x66')](new Extension(_0x429b67,0x3,'Set',_0x5bbb('0x69')+_0x205fba[_0x5bbb('0x68')]));}else{_0x37830c['push'](new Extension(_0x429b67,0x3,_0x5bbb('0x61'),_0x5bbb('0x6a')));}_0x37830c[_0x5bbb('0x66')](new Extension(_0x429b67,0x4,'goto',_0x420857['context']+','+_0x5bbb('0x6b')+(0x8+_0x205fba[_0x5bbb('0x2d')][_0x5bbb('0x3a')])+'}'+','+0x1));return _0x37830c;}function formatPrefixName(_0x44a453){var _0x143d3f='_';for(var _0x4644e9=0x0;_0x4644e9<_0x44a453[_0x5bbb('0x3a')];_0x4644e9++){if(_0x44a453[_0x5bbb('0x6c')](_0x4644e9)=='-'){_0x143d3f+=_0x44a453[_0x5bbb('0x6c')](_0x4644e9);}else{_0x143d3f+='['+_0x44a453[_0x5bbb('0x6c')](_0x4644e9)+']';}}_0x143d3f+='.';return _0x143d3f;}exports[_0x5bbb('0x26')]=function(_0x4de443,_0x2f2465,_0x5c664d){var _0x28cf64=_0x4de443[_0x5bbb('0x50')];_0x28cf64[_0x5bbb('0x60')]=_0x5bbb('0x6d')+_0x28cf64[_0x5bbb('0x2d')]+'-';return db[_0x5bbb('0x6e')][_0x5bbb('0x4f')](function(_0x46e439){return db[_0x5bbb('0x44')][_0x5bbb('0x26')](_0x28cf64,{'where':{'id':_0x28cf64['id']},'transaction':_0x46e439})[_0x5bbb('0x27')](function(){return db[_0x5bbb('0x63')][_0x5bbb('0x28')]({'where':{'VoicePrefixId':_0x28cf64['id']},'transaction':_0x46e439})['then'](function(){return db['VoiceExtension'][_0x5bbb('0x4c')]({'where':{'id':_0x28cf64[_0x5bbb('0x52')]},'raw':!![]})[_0x5bbb('0x27')](function(_0x3eee12){return createVoicePrefixExtensions(_0x28cf64,_0x3eee12,_0x46e439);});});});})['then'](function(){return db[_0x5bbb('0x44')][_0x5bbb('0x6f')](_0x28cf64['id']);})[_0x5bbb('0x27')](respondWithResult(_0x2f2465,null))['catch'](handleError(_0x2f2465,null));};exports['addAgents']=function(_0x44b574,_0x2022cf,_0x2bfd65){return db[_0x5bbb('0x44')]['find']({'where':{'id':_0x44b574[_0x5bbb('0x4b')]['id']}})[_0x5bbb('0x27')](handleEntityNotFound(_0x2022cf,null))[_0x5bbb('0x27')](function(_0x198fd8){if(_0x198fd8){return _0x198fd8[_0x5bbb('0x70')](_0x44b574['body'][_0x5bbb('0x71')],_['omit'](_0x44b574[_0x5bbb('0x50')],[_0x5bbb('0x71'),'id'])||{})[_0x5bbb('0x72')](function(_0x4babe3){for(var _0x1c3a8f=0x0;_0x1c3a8f<_0x44b574[_0x5bbb('0x50')][_0x5bbb('0x71')]['length'];_0x1c3a8f+=0x1){socket[_0x5bbb('0x73')](_0x5bbb('0x74'),{'UserId':_0x44b574[_0x5bbb('0x50')][_0x5bbb('0x71')][_0x1c3a8f],'VoicePrefixId':_0x44b574[_0x5bbb('0x4b')]['id']});}return _0x4babe3;});}})['then'](respondWithResult(_0x2022cf,null))[_0x5bbb('0x49')](handleError(_0x2022cf,null));};exports[_0x5bbb('0x75')]=function(_0x24e72a,_0x3047db,_0x2d407f){return db[_0x5bbb('0x44')][_0x5bbb('0x4c')]({'where':{'id':_0x24e72a[_0x5bbb('0x4b')]['id']}})[_0x5bbb('0x27')](handleEntityNotFound(_0x3047db,null))[_0x5bbb('0x27')](function(_0x1de209){if(_0x1de209){return _0x1de209[_0x5bbb('0x75')](_0x24e72a[_0x5bbb('0x35')][_0x5bbb('0x71')])[_0x5bbb('0x27')](function(){if(_['isArray'](_0x24e72a[_0x5bbb('0x35')][_0x5bbb('0x71')])){for(var _0x1c97a7=0x0;_0x1c97a7<_0x24e72a[_0x5bbb('0x35')]['ids']['length'];_0x1c97a7+=0x1){socket[_0x5bbb('0x73')](_0x5bbb('0x76'),{'UserId':Number(_0x24e72a[_0x5bbb('0x35')][_0x5bbb('0x71')][_0x1c97a7]),'VoicePrefixId':Number(_0x24e72a['params']['id'])});}}else{socket[_0x5bbb('0x73')](_0x5bbb('0x76'),{'UserId':Number(_0x24e72a['query'][_0x5bbb('0x71')]),'VoicePrefixId':Number(_0x24e72a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3047db,null))[_0x5bbb('0x49')](handleError(_0x3047db,null));};exports[_0x5bbb('0x77')]=function(_0x1ff21b,_0x45b5b8,_0xfe8559){var _0x4d0fd8={};var _0x1a2480={};var _0x4adc30;var _0x4a3f43;return db['VoicePrefix']['findOne']({'where':{'id':_0x1ff21b[_0x5bbb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x45b5b8,null))[_0x5bbb('0x27')](function(_0x6acb4){if(_0x6acb4){_0x4adc30=_0x6acb4;_0x1a2480[_0x5bbb('0x33')]=_[_0x5bbb('0x36')](db['User']['rawAttributes']);_0x1a2480[_0x5bbb('0x35')]=_[_0x5bbb('0x36')](_0x1ff21b[_0x5bbb('0x35')]);_0x1a2480[_0x5bbb('0x78')]=_['intersection'](_0x1a2480[_0x5bbb('0x33')],_0x1a2480['query']);_0x4d0fd8[_0x5bbb('0x38')]=_[_0x5bbb('0x37')](_0x1a2480['model'],qs[_0x5bbb('0x39')](_0x1ff21b[_0x5bbb('0x35')]['fields']));_0x4d0fd8['attributes']=_0x4d0fd8['attributes'][_0x5bbb('0x3a')]?_0x4d0fd8[_0x5bbb('0x38')]:_0x1a2480[_0x5bbb('0x33')];_0x4d0fd8['order']=qs[_0x5bbb('0x3e')](_0x1ff21b[_0x5bbb('0x35')][_0x5bbb('0x3e')]);_0x4d0fd8[_0x5bbb('0x3f')]=qs['filters'](_['pick'](_0x1ff21b[_0x5bbb('0x35')],_0x1a2480[_0x5bbb('0x78')]));if(_0x1ff21b[_0x5bbb('0x35')]['filter']){_0x4d0fd8[_0x5bbb('0x3f')]=_['merge'](_0x4d0fd8['where'],{'$or':_[_0x5bbb('0x34')](_0x4d0fd8[_0x5bbb('0x38')],function(_0xacc811){var _0x50a44f={};_0x50a44f[_0xacc811]={'$like':'%'+_0x1ff21b['query']['filter']+'%'};return _0x50a44f;})});}_0x4d0fd8=_[_0x5bbb('0x41')]({},_0x4d0fd8,_0x1ff21b[_0x5bbb('0x43')]);return _0x4adc30[_0x5bbb('0x77')](_0x4d0fd8);}})[_0x5bbb('0x27')](function(_0x3bcb36){if(_0x3bcb36){_0x4a3f43=_0x3bcb36[_0x5bbb('0x3a')];if(!_0x1ff21b['query'][_0x5bbb('0x3b')](_0x5bbb('0x3c'))){_0x4d0fd8[_0x5bbb('0x22')]=qs['limit'](_0x1ff21b[_0x5bbb('0x35')][_0x5bbb('0x22')]);_0x4d0fd8[_0x5bbb('0x1f')]=qs[_0x5bbb('0x1f')](_0x1ff21b[_0x5bbb('0x35')][_0x5bbb('0x1f')]);}return _0x4adc30[_0x5bbb('0x77')](_0x4d0fd8);}})[_0x5bbb('0x27')](function(_0x317d16){if(_0x317d16){return _0x317d16?{'count':_0x4a3f43,'rows':_0x317d16}:null;}})[_0x5bbb('0x27')](respondWithResult(_0x45b5b8,null))[_0x5bbb('0x49')](handleError(_0x45b5b8,null));}; \ No newline at end of file +var _0x5d40=['userVoicePrefix:save','removeAgents','getAgents','findOne','User','pick','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','status','offset','undefined','count','json','apply','reject','save','update','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','type','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','describe','sequelize','transaction','create','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','spread','emit'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x5d40,0x192));var _0x05d4=function(_0x12bfb8,_0x3ebcac){_0x12bfb8=_0x12bfb8-0x0;var _0x42b1cf=_0x5d40[_0x12bfb8];return _0x42b1cf;};'use strict';var emlformat=require(_0x05d4('0x0'));var rimraf=require(_0x05d4('0x1'));var zipdir=require(_0x05d4('0x2'));var jsonpatch=require(_0x05d4('0x3'));var rp=require('request-promise');var moment=require(_0x05d4('0x4'));var BPromise=require(_0x05d4('0x5'));var Mustache=require(_0x05d4('0x6'));var util=require(_0x05d4('0x7'));var path=require(_0x05d4('0x8'));var sox=require(_0x05d4('0x9'));var csv=require(_0x05d4('0xa'));var ejs=require(_0x05d4('0xb'));var fs=require('fs');var fs_extra=require(_0x05d4('0xc'));var _=require(_0x05d4('0xd'));var squel=require(_0x05d4('0xe'));var crypto=require(_0x05d4('0xf'));var jsforce=require(_0x05d4('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x05d4('0xa'));var querystring=require(_0x05d4('0x11'));var Papa=require(_0x05d4('0x12'));var Redis=require(_0x05d4('0x13'));var authService=require(_0x05d4('0x14'));var qs=require(_0x05d4('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05d4('0x16'));var logger=require(_0x05d4('0x17'))(_0x05d4('0x18'));var utils=require(_0x05d4('0x19'));var config=require(_0x05d4('0x1a'));var licenseUtil=require(_0x05d4('0x1b'));var db=require(_0x05d4('0x1c'))['db'];config[_0x05d4('0x1d')]=_[_0x05d4('0x1e')](config['redis'],{'host':_0x05d4('0x1f'),'port':0x18eb});var socket=require(_0x05d4('0x20'))(new Redis(config['redis']));require(_0x05d4('0x21'))['register'](socket);function respondWithStatusCode(_0x4e1395,_0x313516){_0x313516=_0x313516||0xcc;return function(_0x5f1477){if(_0x5f1477){return _0x4e1395['sendStatus'](_0x313516);}return _0x4e1395[_0x05d4('0x22')](_0x313516)['end']();};}function respondWithResult(_0x781b17,_0x1316a7){_0x1316a7=_0x1316a7||0xc8;return function(_0x47188c){if(_0x47188c){return _0x781b17[_0x05d4('0x22')](_0x1316a7)['json'](_0x47188c);}};}function respondWithFilteredResult(_0x127e56,_0x350cb2){return function(_0x6c652b){if(_0x6c652b){var _0x2dcddb=typeof _0x350cb2[_0x05d4('0x23')]===_0x05d4('0x24')&&typeof _0x350cb2['limit']===_0x05d4('0x24');var _0x5635ee=_0x6c652b['count'];var _0x507b15=_0x2dcddb?0x0:_0x350cb2['offset'];var _0x4a5fb6=_0x2dcddb?_0x6c652b[_0x05d4('0x25')]:_0x350cb2[_0x05d4('0x23')]+_0x350cb2['limit'];var _0x2fbdc9;if(_0x4a5fb6>=_0x5635ee){_0x4a5fb6=_0x5635ee;_0x2fbdc9=0xc8;}else{_0x2fbdc9=0xce;}_0x127e56[_0x05d4('0x22')](_0x2fbdc9);return _0x127e56['set']('Content-Range',_0x507b15+'-'+_0x4a5fb6+'/'+_0x5635ee)[_0x05d4('0x26')](_0x6c652b);}return null;};}function patchUpdates(_0x4f44a8){return function(_0x403d13){try{jsonpatch[_0x05d4('0x27')](_0x403d13,_0x4f44a8,!![]);}catch(_0x25bc46){return BPromise[_0x05d4('0x28')](_0x25bc46);}return _0x403d13[_0x05d4('0x29')]();};}function saveUpdates(_0xc414ad,_0x17b283){return function(_0x2e20e9){if(_0x2e20e9){return _0x2e20e9[_0x05d4('0x2a')](_0xc414ad)['then'](function(_0x456c7d){return _0x456c7d;});}return null;};}function removeEntity(_0x232ed8,_0x4f1555){return function(_0x5ed280){if(_0x5ed280){return _0x5ed280[_0x05d4('0x2b')]()[_0x05d4('0x2c')](function(){var _0x2a605e=_0x5ed280[_0x05d4('0x2d')]({'plain':!![]});var _0x530193='VoicePrefixes';return db[_0x05d4('0x2e')][_0x05d4('0x2b')]({'where':{'type':_0x530193,'resourceId':_0x2a605e['id']}})['then'](function(){return _0x5ed280;});})[_0x05d4('0x2c')](function(){_0x232ed8[_0x05d4('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e0a23,_0x5371c6){return function(_0x471709){if(!_0x471709){_0x3e0a23[_0x05d4('0x2f')](0x194);}return _0x471709;};}function handleError(_0x3dfb8b,_0x346f5a){_0x346f5a=_0x346f5a||0x1f4;return function(_0x2dbd92){logger[_0x05d4('0x30')](_0x2dbd92[_0x05d4('0x31')]);if(_0x2dbd92['name']){delete _0x2dbd92[_0x05d4('0x32')];}_0x3dfb8b[_0x05d4('0x22')](_0x346f5a)[_0x05d4('0x33')](_0x2dbd92);};}exports[_0x05d4('0x34')]=function(_0x80ce55,_0x4c0b53){var _0x5b583d={},_0xfbe2a9={},_0x26b599={'count':0x0,'rows':[]};var _0x326012=_[_0x05d4('0x35')](db[_0x05d4('0x36')][_0x05d4('0x37')],function(_0x5eb0e5){return{'name':_0x5eb0e5[_0x05d4('0x38')],'type':_0x5eb0e5['type']['key']};});_0xfbe2a9[_0x05d4('0x39')]=_['map'](_0x326012,_0x05d4('0x32'));_0xfbe2a9[_0x05d4('0x3a')]=_['keys'](_0x80ce55[_0x05d4('0x3a')]);_0xfbe2a9[_0x05d4('0x3b')]=_[_0x05d4('0x3c')](_0xfbe2a9[_0x05d4('0x39')],_0xfbe2a9[_0x05d4('0x3a')]);_0x5b583d[_0x05d4('0x3d')]=_['intersection'](_0xfbe2a9['model'],qs[_0x05d4('0x3e')](_0x80ce55['query'][_0x05d4('0x3e')]));_0x5b583d[_0x05d4('0x3d')]=_0x5b583d[_0x05d4('0x3d')][_0x05d4('0x3f')]?_0x5b583d[_0x05d4('0x3d')]:_0xfbe2a9[_0x05d4('0x39')];if(!_0x80ce55['query'][_0x05d4('0x40')](_0x05d4('0x41'))){_0x5b583d['limit']=qs[_0x05d4('0x42')](_0x80ce55[_0x05d4('0x3a')][_0x05d4('0x42')]);_0x5b583d[_0x05d4('0x23')]=qs[_0x05d4('0x23')](_0x80ce55['query'][_0x05d4('0x23')]);}_0x5b583d[_0x05d4('0x43')]=qs[_0x05d4('0x44')](_0x80ce55[_0x05d4('0x3a')]['sort']);_0x5b583d[_0x05d4('0x45')]=qs[_0x05d4('0x3b')](_['pick'](_0x80ce55['query'],_0xfbe2a9[_0x05d4('0x3b')]),_0x326012);if(_0x80ce55[_0x05d4('0x3a')][_0x05d4('0x46')]){_0x5b583d['where']=_['merge'](_0x5b583d['where'],{'$or':_[_0x05d4('0x35')](_0x326012,function(_0x268a1a){if(_0x268a1a[_0x05d4('0x47')]!=='VIRTUAL'){var _0x20b2b0={};_0x20b2b0[_0x268a1a[_0x05d4('0x32')]]={'$like':'%'+_0x80ce55[_0x05d4('0x3a')][_0x05d4('0x46')]+'%'};return _0x20b2b0;}})});}_0x5b583d=_[_0x05d4('0x48')]({},_0x5b583d,_0x80ce55[_0x05d4('0x49')]);var _0xc58aa1={'where':_0x5b583d[_0x05d4('0x45')]};return db[_0x05d4('0x36')][_0x05d4('0x25')](_0xc58aa1)[_0x05d4('0x2c')](function(_0x1278c4){_0x26b599[_0x05d4('0x25')]=_0x1278c4;if(_0x80ce55['query'][_0x05d4('0x4a')]){_0x5b583d[_0x05d4('0x4b')]=[{'all':!![]}];}return db[_0x05d4('0x36')][_0x05d4('0x4c')](_0x5b583d);})['then'](function(_0x508a55){_0x26b599[_0x05d4('0x4d')]=_0x508a55;return _0x26b599;})['then'](respondWithFilteredResult(_0x4c0b53,_0x5b583d))['catch'](handleError(_0x4c0b53,null));};exports[_0x05d4('0x4e')]=function(_0x2a82d0,_0x3a9ea6){var _0x2cfb88={'raw':![],'where':{'id':_0x2a82d0[_0x05d4('0x4f')]['id']}},_0x164c36={};_0x164c36[_0x05d4('0x39')]=_[_0x05d4('0x50')](db[_0x05d4('0x36')][_0x05d4('0x37')]);_0x164c36[_0x05d4('0x3a')]=_[_0x05d4('0x50')](_0x2a82d0[_0x05d4('0x3a')]);_0x164c36['filters']=_[_0x05d4('0x3c')](_0x164c36['model'],_0x164c36[_0x05d4('0x3a')]);_0x2cfb88['attributes']=_['intersection'](_0x164c36[_0x05d4('0x39')],qs[_0x05d4('0x3e')](_0x2a82d0[_0x05d4('0x3a')][_0x05d4('0x3e')]));_0x2cfb88[_0x05d4('0x3d')]=_0x2cfb88[_0x05d4('0x3d')][_0x05d4('0x3f')]?_0x2cfb88[_0x05d4('0x3d')]:_0x164c36['model'];if(_0x2a82d0['query'][_0x05d4('0x4a')]){_0x2cfb88[_0x05d4('0x4b')]=[{'all':!![]}];}_0x2cfb88=_[_0x05d4('0x48')]({},_0x2cfb88,_0x2a82d0[_0x05d4('0x49')]);return db[_0x05d4('0x36')][_0x05d4('0x51')](_0x2cfb88)[_0x05d4('0x2c')](handleEntityNotFound(_0x3a9ea6,null))[_0x05d4('0x2c')](respondWithResult(_0x3a9ea6,null))['catch'](handleError(_0x3a9ea6,null));};exports[_0x05d4('0x2b')]=function(_0x1dc688,_0x4b62d2){return db['VoicePrefix']['find']({'where':{'id':_0x1dc688[_0x05d4('0x4f')]['id']}})[_0x05d4('0x2c')](handleEntityNotFound(_0x4b62d2,null))['then'](removeEntity(_0x4b62d2,null))[_0x05d4('0x52')](handleError(_0x4b62d2,null));};exports[_0x05d4('0x53')]=function(_0x6d4c84,_0x482cda){return db[_0x05d4('0x36')]['describe']()['then'](respondWithResult(_0x482cda,null))['catch'](handleError(_0x482cda,null));};exports['create']=function(_0x1a23a8,_0x1050e0){var _0x4c38d4;return db[_0x05d4('0x54')][_0x05d4('0x55')](function(_0x446ffb){return db['VoicePrefix'][_0x05d4('0x56')](_0x1a23a8[_0x05d4('0x57')],{'transaction':_0x446ffb})[_0x05d4('0x2c')](function(_0x436ed5){_0x4c38d4=_0x436ed5[_0x05d4('0x2d')]({'plain':!![]});return db[_0x05d4('0x58')][_0x05d4('0x51')]({'where':{'id':_0x4c38d4[_0x05d4('0x59')]},'raw':!![]})[_0x05d4('0x2c')](function(_0x23f725){return createVoicePrefixExtensions(_0x4c38d4,_0x23f725,_0x446ffb);});});})[_0x05d4('0x2c')](function(){var _0x2ec891=_0x1a23a8[_0x05d4('0x5a')][_0x05d4('0x2d')]({'plain':!![]});if(!_0x2ec891)throw new Error(_0x05d4('0x5b'));if(_0x2ec891[_0x05d4('0x5c')]===_0x05d4('0x5a')){var _0x4ef8ae=_0x4c38d4;return db[_0x05d4('0x5d')][_0x05d4('0x51')]({'where':{'name':_0x05d4('0x5e'),'userProfileId':_0x2ec891[_0x05d4('0x5f')]},'raw':!![]})[_0x05d4('0x2c')](function(_0x5e0528){if(_0x5e0528&&_0x5e0528['autoAssociation']===0x0){return db[_0x05d4('0x2e')][_0x05d4('0x56')]({'name':_0x4ef8ae[_0x05d4('0x32')],'resourceId':_0x4ef8ae['id'],'type':_0x5e0528[_0x05d4('0x32')],'sectionId':_0x5e0528['id']},{})['then'](function(){return _0x4c38d4;});}else{return _0x4c38d4;}})['catch'](function(_0x796fdb){logger['error'](_0x05d4('0x60'),_0x796fdb);throw _0x796fdb;});}return _0x4c38d4;})[_0x05d4('0x2c')](respondWithResult(_0x1050e0,null))[_0x05d4('0x52')](handleError(_0x1050e0,null));};function Extension(_0x87e996,_0x451309,_0x4e608d,_0x31dedb){this[_0x05d4('0x61')]=_0x05d4('0x62');this[_0x05d4('0x63')]=_0x87e996;this[_0x05d4('0x64')]=_0x4e608d;this[_0x05d4('0x47')]=_0x05d4('0x65');this['description']=_0x05d4('0x66');this[_0x05d4('0x67')]=_0x451309;this[_0x05d4('0x68')]=_0x31dedb;}function createVoicePrefixExtensions(_0x2c0367,_0x6ce2d5,_0x37c38f){return new BPromise(function(_0x39c6ae,_0x4d1d81){var _0xf5cc83=new Extension(formatPrefixName(_0x2c0367[_0x05d4('0x69')]),0x1,_0x05d4('0x6a'),_0x05d4('0x6b'));_0xf5cc83[_0x05d4('0x6c')]=_0x2c0367['id'];return db[_0x05d4('0x58')]['create'](_0xf5cc83,{'transaction':_0x37c38f})[_0x05d4('0x2c')](function(_0x5344f6){var _0x5dd58c=_0x5344f6[_0x05d4('0x2d')]({'plain':!![]});var _0x2b06ae=_[_0x05d4('0x35')](addVoicePrefixExtensions(_0x2c0367,_0x6ce2d5),function(_0x26370c){_0x26370c['VoiceExtensionId']=_0x5dd58c['id'];_0x26370c[_0x05d4('0x6c')]=_0x2c0367['id'];return _0x26370c;});return db['VoiceExtension'][_0x05d4('0x6d')](_0x2b06ae,{'transaction':_0x37c38f})[_0x05d4('0x2c')](function(_0x2225ba){if(!_0x2225ba){return _0x4d1d81(_0x05d4('0x6e'));}else{return _0x39c6ae(_0x2225ba);}})['catch'](function(_0x4f964a){return _0x4d1d81(_0x4f964a);});});;});};function addVoicePrefixExtensions(_0x3358db,_0x2dd659){var _0xb75625=[];var _0x1b480f=formatPrefixName(_0x3358db['prefix']);_0xb75625[_0x05d4('0x6f')](new Extension(_0x1b480f,0x2,_0x05d4('0x70'),_0x05d4('0x71')+_0x3358db[_0x05d4('0x32')]));if(_0x3358db['callerIdAll']){_0xb75625[_0x05d4('0x6f')](new Extension(_0x1b480f,0x3,_0x05d4('0x70'),_0x05d4('0x72')+_0x3358db[_0x05d4('0x73')]));}else{_0xb75625['push'](new Extension(_0x1b480f,0x3,_0x05d4('0x6a'),'No\x20callerid\x20available'));}_0xb75625[_0x05d4('0x6f')](new Extension(_0x1b480f,0x4,_0x05d4('0x74'),_0x2dd659[_0x05d4('0x61')]+','+_0x05d4('0x75')+(0x8+_0x3358db['name'][_0x05d4('0x3f')])+'}'+','+0x1));return _0xb75625;}function formatPrefixName(_0x2f0581){var _0x32f87f='_';for(var _0x13b323=0x0;_0x13b323<_0x2f0581['length'];_0x13b323++){if(_0x2f0581[_0x05d4('0x76')](_0x13b323)=='-'){_0x32f87f+=_0x2f0581[_0x05d4('0x76')](_0x13b323);}else{_0x32f87f+='['+_0x2f0581[_0x05d4('0x76')](_0x13b323)+']';}}_0x32f87f+='.';return _0x32f87f;}exports['update']=function(_0x4e3ff4,_0x3ab1be,_0x34e36b){var _0x4b22d0=_0x4e3ff4[_0x05d4('0x57')];_0x4b22d0[_0x05d4('0x69')]=_0x05d4('0x77')+_0x4b22d0['name']+'-';return db[_0x05d4('0x54')][_0x05d4('0x55')](function(_0x2a0018){return db[_0x05d4('0x36')][_0x05d4('0x2a')](_0x4b22d0,{'where':{'id':_0x4b22d0['id']},'transaction':_0x2a0018})[_0x05d4('0x2c')](function(){return db['VoiceExtension'][_0x05d4('0x2b')]({'where':{'VoicePrefixId':_0x4b22d0['id']},'transaction':_0x2a0018})['then'](function(){return db['VoiceExtension']['find']({'where':{'id':_0x4b22d0[_0x05d4('0x59')]},'raw':!![]})[_0x05d4('0x2c')](function(_0xf1ebcd){return createVoicePrefixExtensions(_0x4b22d0,_0xf1ebcd,_0x2a0018);});});});})['then'](function(){return db[_0x05d4('0x36')][_0x05d4('0x78')](_0x4b22d0['id']);})[_0x05d4('0x2c')](respondWithResult(_0x3ab1be,null))[_0x05d4('0x52')](handleError(_0x3ab1be,null));};exports[_0x05d4('0x79')]=function(_0x2b972b,_0x3a9a1e,_0x6b0707){return db[_0x05d4('0x36')][_0x05d4('0x51')]({'where':{'id':_0x2b972b['params']['id']}})[_0x05d4('0x2c')](handleEntityNotFound(_0x3a9a1e,null))[_0x05d4('0x2c')](function(_0x1bc8b9){if(_0x1bc8b9){return _0x1bc8b9[_0x05d4('0x79')](_0x2b972b[_0x05d4('0x57')][_0x05d4('0x7a')],_[_0x05d4('0x7b')](_0x2b972b[_0x05d4('0x57')],[_0x05d4('0x7a'),'id'])||{})[_0x05d4('0x7c')](function(_0x3a4a52){for(var _0x5e3b9d=0x0;_0x5e3b9d<_0x2b972b['body'][_0x05d4('0x7a')]['length'];_0x5e3b9d+=0x1){socket[_0x05d4('0x7d')](_0x05d4('0x7e'),{'UserId':_0x2b972b[_0x05d4('0x57')]['ids'][_0x5e3b9d],'VoicePrefixId':_0x2b972b[_0x05d4('0x4f')]['id']});}return _0x3a4a52;});}})[_0x05d4('0x2c')](respondWithResult(_0x3a9a1e,null))[_0x05d4('0x52')](handleError(_0x3a9a1e,null));};exports['removeAgents']=function(_0x22a872,_0x1a6d1b,_0x6d2739){return db[_0x05d4('0x36')][_0x05d4('0x51')]({'where':{'id':_0x22a872[_0x05d4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1a6d1b,null))['then'](function(_0x3aaca3){if(_0x3aaca3){return _0x3aaca3[_0x05d4('0x7f')](_0x22a872[_0x05d4('0x3a')][_0x05d4('0x7a')])[_0x05d4('0x2c')](function(){if(_['isArray'](_0x22a872['query'][_0x05d4('0x7a')])){for(var _0xea4639=0x0;_0xea4639<_0x22a872[_0x05d4('0x3a')][_0x05d4('0x7a')][_0x05d4('0x3f')];_0xea4639+=0x1){socket[_0x05d4('0x7d')]('userVoicePrefix:remove',{'UserId':Number(_0x22a872[_0x05d4('0x3a')][_0x05d4('0x7a')][_0xea4639]),'VoicePrefixId':Number(_0x22a872[_0x05d4('0x4f')]['id'])});}}else{socket[_0x05d4('0x7d')]('userVoicePrefix:remove',{'UserId':Number(_0x22a872['query'][_0x05d4('0x7a')]),'VoicePrefixId':Number(_0x22a872[_0x05d4('0x4f')]['id'])});}});}})[_0x05d4('0x2c')](respondWithStatusCode(_0x1a6d1b,null))[_0x05d4('0x52')](handleError(_0x1a6d1b,null));};exports[_0x05d4('0x80')]=function(_0x344f71,_0x122542,_0x4f3c93){var _0x29999={};var _0x2755f1={};var _0x13f1f1;var _0x3999d7;return db[_0x05d4('0x36')][_0x05d4('0x81')]({'where':{'id':_0x344f71['params']['id']}})['then'](handleEntityNotFound(_0x122542,null))['then'](function(_0x1e8822){if(_0x1e8822){_0x13f1f1=_0x1e8822;_0x2755f1[_0x05d4('0x39')]=_[_0x05d4('0x50')](db[_0x05d4('0x82')]['rawAttributes']);_0x2755f1[_0x05d4('0x3a')]=_[_0x05d4('0x50')](_0x344f71[_0x05d4('0x3a')]);_0x2755f1['filters']=_[_0x05d4('0x3c')](_0x2755f1['model'],_0x2755f1[_0x05d4('0x3a')]);_0x29999[_0x05d4('0x3d')]=_[_0x05d4('0x3c')](_0x2755f1[_0x05d4('0x39')],qs['fields'](_0x344f71[_0x05d4('0x3a')][_0x05d4('0x3e')]));_0x29999[_0x05d4('0x3d')]=_0x29999[_0x05d4('0x3d')][_0x05d4('0x3f')]?_0x29999['attributes']:_0x2755f1[_0x05d4('0x39')];_0x29999[_0x05d4('0x43')]=qs['sort'](_0x344f71['query']['sort']);_0x29999[_0x05d4('0x45')]=qs[_0x05d4('0x3b')](_[_0x05d4('0x83')](_0x344f71[_0x05d4('0x3a')],_0x2755f1['filters']));if(_0x344f71['query']['filter']){_0x29999[_0x05d4('0x45')]=_[_0x05d4('0x48')](_0x29999[_0x05d4('0x45')],{'$or':_[_0x05d4('0x35')](_0x29999[_0x05d4('0x3d')],function(_0x1a51a3){var _0x233c47={};_0x233c47[_0x1a51a3]={'$like':'%'+_0x344f71[_0x05d4('0x3a')][_0x05d4('0x46')]+'%'};return _0x233c47;})});}_0x29999=_[_0x05d4('0x48')]({},_0x29999,_0x344f71[_0x05d4('0x49')]);return _0x13f1f1[_0x05d4('0x80')](_0x29999);}})[_0x05d4('0x2c')](function(_0x857bcf){if(_0x857bcf){_0x3999d7=_0x857bcf[_0x05d4('0x3f')];if(!_0x344f71[_0x05d4('0x3a')][_0x05d4('0x40')](_0x05d4('0x41'))){_0x29999[_0x05d4('0x42')]=qs[_0x05d4('0x42')](_0x344f71[_0x05d4('0x3a')]['limit']);_0x29999[_0x05d4('0x23')]=qs['offset'](_0x344f71['query'][_0x05d4('0x23')]);}return _0x13f1f1[_0x05d4('0x80')](_0x29999);}})[_0x05d4('0x2c')](function(_0x5ed189){if(_0x5ed189){return _0x5ed189?{'count':_0x3999d7,'rows':_0x5ed189}:null;}})[_0x05d4('0x2c')](respondWithResult(_0x122542,null))['catch'](handleError(_0x122542,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 495a3e8..857e683 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 _0xedd9=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xedd9,0xfc));var _0x9edd=function(_0x261318,_0x47ca22){_0x261318=_0x261318-0x0;var _0x3a479b=_0xedd9[_0x261318];return _0x3a479b;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x9edd('0x0'))['db'][_0x9edd('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9edd('0x2')](0x0);var events={'afterCreate':_0x9edd('0x3'),'afterUpdate':_0x9edd('0x4'),'afterDestroy':_0x9edd('0x5')};function emitEvent(_0x3e6d3a){return function(_0x36b53f,_0x5943b3,_0x33679f){VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a+':'+_0x36b53f['id'],_0x36b53f);VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a,_0x36b53f);_0x33679f(null);};}for(var e in events){if(events[_0x9edd('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x9edd('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','update','emit'];(function(_0x175e89,_0x20835f){var _0x2ed996=function(_0x56239f){while(--_0x56239f){_0x175e89['push'](_0x175e89['shift']());}};_0x2ed996(++_0x20835f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var VoicePrefix=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){VoicePrefixEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);VoicePrefixEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];VoicePrefix[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 31b7acc..af90bfc 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 _0x6036=['./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6036,0x1b4));var _0x6603=function(_0x3bc369,_0x5f1552){_0x3bc369=_0x3bc369-0x0;var _0x237222=_0x6036[_0x3bc369];return _0x237222;};'use strict';var _=require(_0x6603('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6603('0x1'));var moment=require(_0x6603('0x2'));var BPromise=require(_0x6603('0x3'));var rp=require(_0x6603('0x4'));var fs=require('fs');var path=require(_0x6603('0x5'));var rimraf=require(_0x6603('0x6'));var config=require(_0x6603('0x7'));var attributes=require(_0x6603('0x8'));module[_0x6603('0x9')]=function(_0x556777,_0x5af506){return _0x556777['define'](_0x6603('0xa'),attributes,{'tableName':_0x6603('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a01=['rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','../../config/logger','api','moment','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9a01,0x1cf));var _0x19a0=function(_0x14d810,_0x299c09){_0x14d810=_0x14d810-0x0;var _0x3a4d77=_0x9a01[_0x14d810];return _0x3a4d77;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x19a0('0x0'))(_0x19a0('0x1'));var moment=require(_0x19a0('0x2'));var BPromise=require('bluebird');var rp=require(_0x19a0('0x3'));var fs=require('fs');var path=require(_0x19a0('0x4'));var rimraf=require(_0x19a0('0x5'));var config=require(_0x19a0('0x6'));var attributes=require(_0x19a0('0x7'));module[_0x19a0('0x8')]=function(_0x2cbbe1,_0x40af90){return _0x2cbbe1[_0x19a0('0x9')](_0x19a0('0xa'),attributes,{'tableName':_0x19a0('0xb'),'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 f0fb269..ff461a9 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 _0xe41f=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','./voicePrefix.socket','register','request','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe41f,0xb7));var _0xfe41=function(_0xa02cac,_0x1d021e){_0xa02cac=_0xa02cac-0x0;var _0x48ba56=_0xe41f[_0xa02cac];return _0x48ba56;};'use strict';var _=require(_0xfe41('0x0'));var util=require(_0xfe41('0x1'));var moment=require(_0xfe41('0x2'));var BPromise=require(_0xfe41('0x3'));var rs=require(_0xfe41('0x4'));var fs=require('fs');var Redis=require(_0xfe41('0x5'));var db=require(_0xfe41('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe41('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfe41('0x8'));var client=jayson[_0xfe41('0x9')][_0xfe41('0xa')]({'port':0x232a});config[_0xfe41('0xb')]=_[_0xfe41('0xc')](config[_0xfe41('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfe41('0xb')]));require(_0xfe41('0xd'))[_0xfe41('0xe')](socket);function respondWithRpcPromise(_0x1a14f6,_0x17cc33,_0x17d39a){return new BPromise(function(_0x3bbf18,_0x269c31){return client[_0xfe41('0xf')](_0x1a14f6,_0x17d39a)['then'](function(_0xc3727c){logger['info'](_0xfe41('0x10'),_0x17cc33,_0xfe41('0x11'));logger[_0xfe41('0x12')](_0xfe41('0x13'),_0x17cc33,_0xfe41('0x11'),JSON[_0xfe41('0x14')](_0xc3727c));if(_0xc3727c[_0xfe41('0x15')]){if(_0xc3727c[_0xfe41('0x15')][_0xfe41('0x16')]===0x1f4){logger[_0xfe41('0x15')](_0xfe41('0x10'),_0x17cc33,_0xc3727c[_0xfe41('0x15')][_0xfe41('0x17')]);return _0x269c31(_0xc3727c[_0xfe41('0x15')][_0xfe41('0x17')]);}logger[_0xfe41('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x17cc33,_0xc3727c[_0xfe41('0x15')][_0xfe41('0x17')]);return _0x3bbf18(_0xc3727c[_0xfe41('0x15')]['message']);}else{logger[_0xfe41('0x18')](_0xfe41('0x10'),_0x17cc33,_0xfe41('0x11'));_0x3bbf18(_0xc3727c[_0xfe41('0x19')][_0xfe41('0x17')]);}})['catch'](function(_0x25c9fa){logger[_0xfe41('0x15')](_0xfe41('0x10'),_0x17cc33,_0x25c9fa);_0x269c31(_0x25c9fa);});});} \ No newline at end of file +var _0x4bac=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x59671a,_0x13aef6){var _0x4a8989=function(_0x32b2a3){while(--_0x32b2a3){_0x59671a['push'](_0x59671a['shift']());}};_0x4a8989(++_0x13aef6);}(_0x4bac,0xb9));var _0xc4ba=function(_0x358dc1,_0x1c08a3){_0x358dc1=_0x358dc1-0x0;var _0xb3f349=_0x4bac[_0x358dc1];return _0xb3f349;};'use strict';var _=require(_0xc4ba('0x0'));var util=require('util');var moment=require(_0xc4ba('0x1'));var BPromise=require(_0xc4ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4ba('0x3'));var db=require(_0xc4ba('0x4'))['db'];var utils=require(_0xc4ba('0x5'));var logger=require(_0xc4ba('0x6'))('rpc');var config=require(_0xc4ba('0x7'));var jayson=require(_0xc4ba('0x8'));var client=jayson[_0xc4ba('0x9')][_0xc4ba('0xa')]({'port':0x232a});config[_0xc4ba('0xb')]=_['defaults'](config['redis'],{'host':_0xc4ba('0xc'),'port':0x18eb});var socket=require(_0xc4ba('0xd'))(new Redis(config[_0xc4ba('0xb')]));require('./voicePrefix.socket')[_0xc4ba('0xe')](socket);function respondWithRpcPromise(_0x30e375,_0x135bea,_0x319efb){return new BPromise(function(_0xc680ff,_0x44655d){return client[_0xc4ba('0xf')](_0x30e375,_0x319efb)[_0xc4ba('0x10')](function(_0x549616){logger[_0xc4ba('0x11')](_0xc4ba('0x12'),_0x135bea,'request\x20sent');logger[_0xc4ba('0x13')](_0xc4ba('0x14'),_0x135bea,_0xc4ba('0x15'),JSON['stringify'](_0x549616));if(_0x549616[_0xc4ba('0x16')]){if(_0x549616['error'][_0xc4ba('0x17')]===0x1f4){logger['error'](_0xc4ba('0x12'),_0x135bea,_0x549616[_0xc4ba('0x16')][_0xc4ba('0x18')]);return _0x44655d(_0x549616[_0xc4ba('0x16')]['message']);}logger[_0xc4ba('0x16')](_0xc4ba('0x12'),_0x135bea,_0x549616[_0xc4ba('0x16')]['message']);return _0xc680ff(_0x549616[_0xc4ba('0x16')]['message']);}else{logger[_0xc4ba('0x11')](_0xc4ba('0x12'),_0x135bea,_0xc4ba('0x15'));_0xc680ff(_0x549616[_0xc4ba('0x19')][_0xc4ba('0x18')]);}})[_0xc4ba('0x1a')](function(_0x3d4366){logger[_0xc4ba('0x16')](_0xc4ba('0x12'),_0x135bea,_0x3d4366);_0x44655d(_0x3d4366);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index bd86406..dd7cadd 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 _0xa3c6=['save','update','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xa3c6,0x1cf));var _0x6a3c=function(_0xce1bba,_0x22f3c4){_0xce1bba=_0xce1bba-0x0;var _0x44f562=_0xa3c6[_0xce1bba];return _0x44f562;};'use strict';var VoicePrefixEvents=require(_0x6a3c('0x0'));var events=[_0x6a3c('0x1'),'remove',_0x6a3c('0x2')];function createListener(_0x57ce08,_0x335c2e){return function(_0x367589){_0x335c2e[_0x6a3c('0x3')](_0x57ce08,_0x367589);};}function removeListener(_0x4e3c32,_0x3aec18){return function(){VoicePrefixEvents[_0x6a3c('0x4')](_0x4e3c32,_0x3aec18);};}exports[_0x6a3c('0x5')]=function(_0x1f74b8){for(var _0x166cab=0x0,_0x46728e=events[_0x6a3c('0x6')];_0x166cab<_0x46728e;_0x166cab++){var _0x273b22=events[_0x166cab];var _0x2ae74c=createListener(_0x6a3c('0x7')+_0x273b22,_0x1f74b8);VoicePrefixEvents['on'](_0x273b22,_0x2ae74c);}}; \ No newline at end of file +var _0x4954=['./voicePrefix.events','save','remove','update','emit','removeListener','register','voicePrefix:'];(function(_0xc7c78d,_0x1dd9fb){var _0x175f3d=function(_0x1966cf){while(--_0x1966cf){_0xc7c78d['push'](_0xc7c78d['shift']());}};_0x175f3d(++_0x1dd9fb);}(_0x4954,0x1c8));var _0x4495=function(_0x314882,_0x1809d6){_0x314882=_0x314882-0x0;var _0x4d02ac=_0x4954[_0x314882];return _0x4d02ac;};'use strict';var VoicePrefixEvents=require(_0x4495('0x0'));var events=[_0x4495('0x1'),_0x4495('0x2'),_0x4495('0x3')];function createListener(_0xee4129,_0x37e434){return function(_0x4a851c){_0x37e434[_0x4495('0x4')](_0xee4129,_0x4a851c);};}function removeListener(_0x1d3e09,_0xf93b70){return function(){VoicePrefixEvents[_0x4495('0x5')](_0x1d3e09,_0xf93b70);};}exports[_0x4495('0x6')]=function(_0x5445d2){for(var _0x472814=0x0,_0x3a7650=events['length'];_0x472814<_0x3a7650;_0x472814++){var _0x4c798b=events[_0x472814];var _0x353f1b=createListener(_0x4495('0x7')+_0x4c798b,_0x5445d2);VoicePrefixEvents['on'](_0x4c798b,_0x353f1b);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index e9b69c6..78726ef 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 _0xefda=['/:id','isAuthenticated','/:id/hoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','getBlackLists','post','create','clone','/:id/teams','addTeams','addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index'];(function(_0x51805b,_0x458e9a){var _0x37a72d=function(_0x450eb0){while(--_0x450eb0){_0x51805b['push'](_0x51805b['shift']());}};_0x37a72d(++_0x458e9a);}(_0xefda,0x96));var _0xaefd=function(_0x953b57,_0x11dd4e){_0x953b57=_0x953b57-0x0;var _0x258479=_0xefda[_0x953b57];return _0x258479;};'use strict';var multer=require(_0xaefd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaefd('0x1'));var express=require(_0xaefd('0x2'));var router=express['Router']();var fs_extra=require(_0xaefd('0x3'));var auth=require(_0xaefd('0x4'));var interaction=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var controller=require(_0xaefd('0x7'));router[_0xaefd('0x8')]('/',auth['isAuthenticated'](),controller[_0xaefd('0x9')]);router[_0xaefd('0x8')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller['show']);router[_0xaefd('0x8')](_0xaefd('0xc'),auth[_0xaefd('0xb')](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth[_0xaefd('0xb')](),controller[_0xaefd('0xd')]);router[_0xaefd('0x8')](_0xaefd('0xe'),auth[_0xaefd('0xb')](),controller[_0xaefd('0xf')]);router[_0xaefd('0x8')](_0xaefd('0x10'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x11')]);router[_0xaefd('0x8')]('/:id/teams',auth[_0xaefd('0xb')](),controller['getTeams']);router[_0xaefd('0x8')](_0xaefd('0x12'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x13')]);router['get'](_0xaefd('0x14'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x15')]);router[_0xaefd('0x8')](_0xaefd('0x16'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x17')]);router[_0xaefd('0x8')]('/:id/blacklists',auth[_0xaefd('0xb')](),controller[_0xaefd('0x18')]);router[_0xaefd('0x19')]('/',auth[_0xaefd('0xb')](),controller[_0xaefd('0x1a')]);router[_0xaefd('0x19')]('/:id/clone',auth[_0xaefd('0xb')](),controller[_0xaefd('0x1b')]);router[_0xaefd('0x19')](_0xaefd('0x1c'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x1d')]);router['post'](_0xaefd('0x12'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x1e')]);router[_0xaefd('0x19')](_0xaefd('0x16'),auth['isAuthenticated'](),controller['addLists']);router['post'](_0xaefd('0x1f'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x20')]);router['put'](_0xaefd('0xa'),auth['isAuthenticated'](),controller[_0xaefd('0x21')]);router[_0xaefd('0x22')](_0xaefd('0xa'),auth['isAuthenticated'](),controller[_0xaefd('0x23')]);router[_0xaefd('0x22')](_0xaefd('0x1c'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x24')]);router['delete'](_0xaefd('0x12'),auth['isAuthenticated'](),controller[_0xaefd('0x25')]);router[_0xaefd('0x22')]('/:id/lists',auth[_0xaefd('0xb')](),controller[_0xaefd('0x26')]);router['delete'](_0xaefd('0x1f'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x27')]);module['exports']=router; \ No newline at end of file +var _0x4888=['/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getTeams','/:id/users','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/teams','addAgents','addLists','addBlackLists','put','/:id','destroy','removeTeams','delete','removeLists','removeBlackLists','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x4888,0x198));var _0x8488=function(_0xd746ed,_0x81920c){_0xd746ed=_0xd746ed-0x0;var _0x5ef2a6=_0x4888[_0xd746ed];return _0x5ef2a6;};'use strict';var multer=require('multer');var util=require(_0x8488('0x0'));var path=require(_0x8488('0x1'));var timeout=require(_0x8488('0x2'));var express=require(_0x8488('0x3'));var router=express[_0x8488('0x4')]();var fs_extra=require(_0x8488('0x5'));var auth=require(_0x8488('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8488('0x7'));var controller=require(_0x8488('0x8'));router[_0x8488('0x9')]('/',auth[_0x8488('0xa')](),controller[_0x8488('0xb')]);router[_0x8488('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x8488('0xc'),auth[_0x8488('0xa')](),controller['getHoppers']);router[_0x8488('0x9')](_0x8488('0xd'),auth[_0x8488('0xa')](),controller[_0x8488('0xe')]);router['get'](_0x8488('0xf'),auth[_0x8488('0xa')](),controller[_0x8488('0x10')]);router[_0x8488('0x9')](_0x8488('0x11'),auth['isAuthenticated'](),controller[_0x8488('0x12')]);router[_0x8488('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0x8488('0x13')]);router['get'](_0x8488('0x14'),auth['isAuthenticated'](),controller['getAgents']);router[_0x8488('0x9')](_0x8488('0x15'),auth[_0x8488('0xa')](),controller[_0x8488('0x16')]);router[_0x8488('0x9')](_0x8488('0x17'),auth[_0x8488('0xa')](),controller['getLists']);router[_0x8488('0x9')](_0x8488('0x18'),auth[_0x8488('0xa')](),controller[_0x8488('0x19')]);router[_0x8488('0x1a')]('/',auth[_0x8488('0xa')](),controller[_0x8488('0x1b')]);router[_0x8488('0x1a')](_0x8488('0x1c'),auth[_0x8488('0xa')](),controller[_0x8488('0x1d')]);router[_0x8488('0x1a')](_0x8488('0x1e'),auth['isAuthenticated'](),controller['addTeams']);router[_0x8488('0x1a')](_0x8488('0x14'),auth[_0x8488('0xa')](),controller[_0x8488('0x1f')]);router[_0x8488('0x1a')](_0x8488('0x17'),auth[_0x8488('0xa')](),controller[_0x8488('0x20')]);router[_0x8488('0x1a')]('/:id/blacklists',auth[_0x8488('0xa')](),controller[_0x8488('0x21')]);router[_0x8488('0x22')](_0x8488('0x23'),auth[_0x8488('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8488('0x24')]);router['delete']('/:id/teams',auth[_0x8488('0xa')](),controller[_0x8488('0x25')]);router[_0x8488('0x26')](_0x8488('0x14'),auth[_0x8488('0xa')](),controller['removeAgents']);router[_0x8488('0x26')](_0x8488('0x17'),auth[_0x8488('0xa')](),controller[_0x8488('0x27')]);router[_0x8488('0x26')](_0x8488('0x18'),auth[_0x8488('0xa')](),controller[_0x8488('0x28')]);module[_0x8488('0x29')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index d39c3db..a67b42d 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 _0x805c=['inbound','default','leastrecent','random','linear','wrandom','rrordered','ringall','rrmemory','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','TEXT','setDataValue','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\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)','07:00-22:00,*,*,*','never','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Minutes\x20to\x20wait\x20to\x20call\x20next\x20additional\x20phone\x20number\x20','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','exports','STRING','name','ENUM'];(function(_0x4d3e87,_0x565f40){var _0x20c80b=function(_0xf5ee05){while(--_0xf5ee05){_0x4d3e87['push'](_0x4d3e87['shift']());}};_0x20c80b(++_0x565f40);}(_0x805c,0x19a));var _0xc805=function(_0x3b6fe0,_0x255365){_0x3b6fe0=_0x3b6fe0-0x0;var _0x24460d=_0x805c[_0x3b6fe0];return _0x24460d;};'use strict';var Sequelize=require(_0xc805('0x0'));module[_0xc805('0x1')]={'name':{'type':Sequelize[_0xc805('0x2')],'allowNull':![],'unique':_0xc805('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc805('0x4')]('inbound','outbound'),'allowNull':![],'defaultValue':_0xc805('0x5')},'musiconhold':{'type':Sequelize[_0xc805('0x2')],'defaultValue':_0xc805('0x6')},'announce':{'type':Sequelize[_0xc805('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xc805('0x4')]('rr','ringall',_0xc805('0x7'),'fewestcalls',_0xc805('0x8'),'rrmemory',_0xc805('0x9'),_0xc805('0xa'),_0xc805('0xb')),'allowNull':![],'defaultValue':_0xc805('0xc'),'set':function(_0xd12971){this['setDataValue']('strategy',_0xd12971?_0xd12971:_0xc805('0xd'));},'get':function(){var _0x1b2616=this[_0xc805('0xe')](_0xc805('0xf'));var _0x120f14=this[_0xc805('0xe')](_0xc805('0x10'));var _0x45c311=this['getDataValue']('strategy');if(_0x1b2616===_0xc805('0x5')){return _0x45c311;}if(_0x120f14===_0xc805('0x11')&&_0x45c311===_0xc805('0xd')||_0x120f14===_0xc805('0x11')&&_0x45c311===_0xc805('0x12')){return _0x45c311;}if(_0x120f14===_0xc805('0x13')||_0x120f14===_0xc805('0x14')||_0x120f14===_0xc805('0x15')){return _0x45c311;}return null;}},'servicelevel':{'type':Sequelize[_0xc805('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xc805('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xc805('0x16')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xc805('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xc805('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xc805('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xc805('0x4')]('yes','no'),'defaultValue':_0xc805('0x17')},'autopause':{'type':Sequelize[_0xc805('0x4')](_0xc805('0x17'),'no',_0xc805('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xc805('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0xc805('0x4')](_0xc805('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xc805('0x4')](_0xc805('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xc805('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xc805('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xc805('0x4')](_0xc805('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xc805('0x4')](_0xc805('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xc805('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xc805('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xc805('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xc805('0x4')](_0xc805('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xc805('0x4')](_0xc805('0x17'),'no'),'defaultValue':_0xc805('0x17')},'announce_holdtime':{'type':Sequelize[_0xc805('0x4')](_0xc805('0x17'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xc805('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xc805('0x17'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xc805('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xc805('0x2')]},'queue_youarenext':{'type':Sequelize[_0xc805('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xc805('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xc805('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xc805('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xc805('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xc805('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xc805('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xc805('0x19')],'set':function(_0x245dca){this[_0xc805('0x1a')]('periodic_announce',_0x245dca?_0x245dca[_0xc805('0x1b')](','):[]);},'get':function(){return this[_0xc805('0xe')](_0xc805('0x1c'))?this['getDataValue'](_0xc805('0x1c'))[_0xc805('0x1d')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xc805('0x17'),'set':function(_0x52a606){this[_0xc805('0x1a')](_0xc805('0x1e'),_0x52a606?_0x52a606['join'](','):undefined);},'get':function(){return this[_0xc805('0xe')](_0xc805('0x1e'))?this['getDataValue'](_0xc805('0x1e'))[_0xc805('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xc805('0x2')],'defaultValue':'no','set':function(_0xff830d){this[_0xc805('0x1a')](_0xc805('0x1f'),_0xff830d?_0xff830d['join'](','):undefined);},'get':function(){return this[_0xc805('0xe')](_0xc805('0x1f'))?this[_0xc805('0xe')](_0xc805('0x1f'))[_0xc805('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xc805('0x4')](_0xc805('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xc805('0x4')](_0xc805('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xc805('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xc805('0x4')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xc805('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xc805('0x20')],'defaultValue':0x0,'set':function(_0x3e65d3){this['setDataValue'](_0xc805('0x21'),_0x3e65d3);if(_0x3e65d3){if(this['getDataValue']('wrapuptime')<0x2){this[_0xc805('0x1a')](_0xc805('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xc805('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xc805('0x20')],'defaultValue':0x0,'comment':_0xc805('0x23')},'dialMethod':{'type':Sequelize['ENUM'](_0xc805('0x24'),_0xc805('0x13'),_0xc805('0x15'),_0xc805('0x14'),'booked'),'defaultValue':_0xc805('0x13'),'comment':_0xc805('0x25')},'dialLimitChannel':{'type':Sequelize[_0xc805('0x16')](0x4)[_0xc805('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc805('0x27')},'dialLimitQueue':{'type':Sequelize[_0xc805('0x16')](0x4)[_0xc805('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc805('0x28')},'dialPowerLevel':{'type':Sequelize[_0xc805('0x29')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xc805('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0xc805('0x4')](_0xc805('0x2b'),_0xc805('0x2c')),'defaultValue':'dropRate','comment':_0xc805('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xc805('0x29')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xc805('0x2e')},'dialPredictiveInterval':{'type':Sequelize[_0xc805('0x16')](0x3)[_0xc805('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xc805('0x2f')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc805('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc805('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xc805('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc805('0x30')},'dialQueueOptions':{'type':Sequelize[_0xc805('0x2')],'defaultValue':_0xc805('0x31'),'comment':_0xc805('0x32')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc805('0x33')},'dialQueueProject':{'type':Sequelize[_0xc805('0x2')],'comment':_0xc805('0x34')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc805('0x16')](0x3)[_0xc805('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc805('0x16')](0x5)[_0xc805('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc805('0x35')},'dialBusyMaxRetry':{'type':Sequelize[_0xc805('0x16')](0x3)[_0xc805('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc805('0x36')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc805('0x16')](0x5)[_0xc805('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc805('0x37')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc805('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xc805('0x38')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc805('0x16')](0x5)[_0xc805('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc805('0x39')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc805('0x16')](0x3)[_0xc805('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xc805('0x3a')},'dialPrefix':{'type':Sequelize[_0xc805('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xc805('0x4')]('always',_0xc805('0x3b'),'onlyIfOpen'),'defaultValue':_0xc805('0x3c')},'dialAMDActive':{'type':Sequelize[_0xc805('0x20')],'defaultValue':0x0,'comment':_0xc805('0x3d')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc805('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc805('0x3e')},'dialAMDGreeting':{'type':Sequelize[_0xc805('0x16')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc805('0x3f')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc805('0x16')](0x9)[_0xc805('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc805('0x40')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc805('0x16')](0x9)[_0xc805('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xc805('0x16')](0x9)[_0xc805('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc805('0x41')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc805('0x16')](0x9)[_0xc805('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc805('0x42')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc805('0x16')](0x9)[_0xc805('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc805('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc805('0x43')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc805('0x16')](0x9)[_0xc805('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xc805('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xc805('0x44')},'dialRecallInQueue':{'type':Sequelize[_0xc805('0x20')],'defaultValue':0x0,'comment':_0xc805('0x45')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc805('0x4')](_0xc805('0x46'),_0xc805('0x47')),'defaultValue':_0xc805('0x46')},'dialQueueProject2':{'type':Sequelize[_0xc805('0x2')],'comment':_0xc805('0x34')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xc805('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc805('0x16')](0x3)[_0xc805('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc805('0x48')},'dialCutDigit':{'type':Sequelize[_0xc805('0x16')](0x3)[_0xc805('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc805('0x49')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc805('0x16')](0x3)[_0xc805('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc805('0x4a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc805('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc805('0x4b')},'dialDropMaxRetry':{'type':Sequelize[_0xc805('0x16')](0x3)[_0xc805('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc805('0x4c')},'dialDropRetryFrequency':{'type':Sequelize[_0xc805('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc805('0x16')](0x3)[_0xc805('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc805('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc805('0x4d')},'dialMachineMaxRetry':{'type':Sequelize[_0xc805('0x16')](0x3)[_0xc805('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc805('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc805('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc805('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc805('0x4f')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xc805('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x3,'comment':_0xc805('0x50')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc805('0x16')],'allowNull':!![],'comment':_0xc805('0x51')},'mandatoryDisposition':{'type':Sequelize[_0xc805('0x20')],'defaultValue':![],'comment':_0xc805('0x52'),'set':function(_0x112a69){if(!_0x112a69)this[_0xc805('0x1a')]('mandatoryDispositionPauseId',null);this[_0xc805('0x1a')]('mandatoryDisposition',_0x112a69);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xc805('0x16')](0x3)[_0xc805('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xc805('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xb566=['Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','inbound','outbound','default','ENUM','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','type','getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','joinempty','leavewhenempty','split','BOOLEAN','acw','wrapuptime','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\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)','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)'];(function(_0x246a9c,_0x4df087){var _0x4bd0b3=function(_0x4558c6){while(--_0x4558c6){_0x246a9c['push'](_0x246a9c['shift']());}};_0x4bd0b3(++_0x4df087);}(_0xb566,0x1f1));var _0x6b56=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0xb566[_0x18a436];return _0x5c2cf8;};'use strict';var Sequelize=require(_0x6b56('0x0'));module[_0x6b56('0x1')]={'name':{'type':Sequelize[_0x6b56('0x2')],'allowNull':![],'unique':_0x6b56('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x6b56('0x4'),_0x6b56('0x5')),'allowNull':![],'defaultValue':_0x6b56('0x4')},'musiconhold':{'type':Sequelize[_0x6b56('0x2')],'defaultValue':_0x6b56('0x6')},'announce':{'type':Sequelize[_0x6b56('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x6b56('0x7')]('rr','ringall',_0x6b56('0x8'),_0x6b56('0x9'),_0x6b56('0xa'),_0x6b56('0xb'),_0x6b56('0xc'),_0x6b56('0xd'),_0x6b56('0xe')),'allowNull':![],'defaultValue':_0x6b56('0xf'),'set':function(_0x58ddcd){this[_0x6b56('0x10')](_0x6b56('0x11'),_0x58ddcd?_0x58ddcd:_0x6b56('0xb'));},'get':function(){var _0x5d79fd=this['getDataValue'](_0x6b56('0x12'));var _0x549d41=this[_0x6b56('0x13')]('dialMethod');var _0xa9932e=this[_0x6b56('0x13')](_0x6b56('0x11'));if(_0x5d79fd===_0x6b56('0x4')){return _0xa9932e;}if(_0x549d41==='booked'&&_0xa9932e==='rrmemory'||_0x549d41===_0x6b56('0x14')&&_0xa9932e===_0x6b56('0x15')){return _0xa9932e;}if(_0x549d41===_0x6b56('0x16')||_0x549d41===_0x6b56('0x17')||_0x549d41===_0x6b56('0x18')){return _0xa9932e;}return null;}},'servicelevel':{'type':Sequelize[_0x6b56('0x19')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x6b56('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x6b56('0x19')](0xb)},'timeout':{'type':Sequelize[_0x6b56('0x19')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x6b56('0x2')]},'weight':{'type':Sequelize[_0x6b56('0x19')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x6b56('0x1a'),'no'),'defaultValue':_0x6b56('0x1a')},'autopause':{'type':Sequelize[_0x6b56('0x7')](_0x6b56('0x1a'),'no',_0x6b56('0x1b')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x6b56('0x7')](_0x6b56('0x1a'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x6b56('0x1a'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x6b56('0x19')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x6b56('0x1a'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x6b56('0x7')](_0x6b56('0x1a'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x6b56('0x7')](_0x6b56('0x1a'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x6b56('0x1a'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x6b56('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x6b56('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x6b56('0x19')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x6b56('0x19')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x6b56('0x7')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x6b56('0x1a'),'no'),'defaultValue':_0x6b56('0x1a')},'announce_holdtime':{'type':Sequelize[_0x6b56('0x7')](_0x6b56('0x1a'),'no',_0x6b56('0x1c')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x6b56('0x1a'),'no')},'announce_position_limit':{'type':Sequelize[_0x6b56('0x19')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x6b56('0x7')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x6b56('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x6b56('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x6b56('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x6b56('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x6b56('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x6b56('0x2')]},'queue_quantity1':{'type':Sequelize[_0x6b56('0x2')]},'queue_quantity2':{'type':Sequelize[_0x6b56('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x6b56('0x2')]},'queue_less_than':{'type':Sequelize[_0x6b56('0x2')]},'periodic_announce':{'type':Sequelize[_0x6b56('0x1d')],'set':function(_0x42c913){this[_0x6b56('0x10')](_0x6b56('0x1e'),_0x42c913?_0x42c913['join'](','):[]);},'get':function(){return this[_0x6b56('0x13')](_0x6b56('0x1e'))?this[_0x6b56('0x13')](_0x6b56('0x1e'))['split'](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x6b56('0x1a'),'set':function(_0x476c3a){this[_0x6b56('0x10')]('joinempty',_0x476c3a?_0x476c3a[_0x6b56('0x1f')](','):undefined);},'get':function(){return this[_0x6b56('0x13')](_0x6b56('0x20'))?this[_0x6b56('0x13')]('joinempty')['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x6b56('0x2')],'defaultValue':'no','set':function(_0x7af623){this[_0x6b56('0x10')](_0x6b56('0x21'),_0x7af623?_0x7af623['join'](','):undefined);},'get':function(){return this[_0x6b56('0x13')](_0x6b56('0x21'))?this['getDataValue'](_0x6b56('0x21'))[_0x6b56('0x22')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x6b56('0x7')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x6b56('0x7')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x6b56('0x19')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x6b56('0x7')](_0x6b56('0x1a'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x6b56('0x2')]},'description':{'type':Sequelize[_0x6b56('0x2')]},'acw':{'type':Sequelize[_0x6b56('0x23')],'defaultValue':0x0,'set':function(_0x558502){this[_0x6b56('0x10')](_0x6b56('0x24'),_0x558502);if(_0x558502){if(this[_0x6b56('0x13')](_0x6b56('0x25'))<0x2){this[_0x6b56('0x10')](_0x6b56('0x25'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x6b56('0x19')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x6b56('0x23')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x6b56('0x7')](_0x6b56('0x26'),_0x6b56('0x16'),_0x6b56('0x18'),_0x6b56('0x17'),_0x6b56('0x14')),'defaultValue':_0x6b56('0x16'),'comment':_0x6b56('0x27')},'dialLimitChannel':{'type':Sequelize[_0x6b56('0x19')](0x4)[_0x6b56('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x6b56('0x29')},'dialLimitQueue':{'type':Sequelize[_0x6b56('0x19')](0x4)[_0x6b56('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x6b56('0x2a')},'dialPowerLevel':{'type':Sequelize[_0x6b56('0x2b')](0x2)[_0x6b56('0x28')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x6b56('0x2c')},'dialPredictiveOptimization':{'type':Sequelize[_0x6b56('0x7')]('agentBusyFactor',_0x6b56('0x2d')),'defaultValue':_0x6b56('0x2d'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x6b56('0x2b')](0x2)[_0x6b56('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x6b56('0x19')](0x3)[_0x6b56('0x28')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x6b56('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0x6b56('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x6b56('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x6b56('0x19')](0x3)[_0x6b56('0x28')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x6b56('0x2')],'defaultValue':_0x6b56('0x2f'),'comment':_0x6b56('0x30')},'dialQueueTimeout':{'type':Sequelize[_0x6b56('0x19')](0x3)[_0x6b56('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6b56('0x31')},'dialQueueProject':{'type':Sequelize[_0x6b56('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6b56('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x6b56('0x19')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6b56('0x33')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6b56('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6b56('0x34')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6b56('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6b56('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6b56('0x19')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x6b56('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x6b56('0x19')](0x5)[_0x6b56('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6b56('0x37')},'dialGlobalMaxRetry':{'type':Sequelize[_0x6b56('0x19')](0x3)[_0x6b56('0x28')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x6b56('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x6b56('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x6b56('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x6b56('0x7')](_0x6b56('0x38'),'never',_0x6b56('0x39')),'defaultValue':_0x6b56('0x38')},'dialAMDActive':{'type':Sequelize[_0x6b56('0x23')],'defaultValue':0x0,'comment':_0x6b56('0x3a')},'dialAMDInitialSilence':{'type':Sequelize[_0x6b56('0x19')](0x9)[_0x6b56('0x28')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x6b56('0x19')](0x9)[_0x6b56('0x28')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6b56('0x19')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x6b56('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x6b56('0x19')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6b56('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6b56('0x19')](0x9)[_0x6b56('0x28')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x6b56('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x6b56('0x28')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6b56('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x6b56('0x19')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6b56('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x6b56('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6b56('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0x6b56('0x19')](0x5)[_0x6b56('0x28')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x6b56('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x6b56('0x23')],'defaultValue':0x0,'comment':_0x6b56('0x42')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x6b56('0x43'),_0x6b56('0x44')),'defaultValue':_0x6b56('0x43')},'dialQueueProject2':{'type':Sequelize[_0x6b56('0x2')],'comment':_0x6b56('0x45')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x6b56('0x23')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6b56('0x19')](0x3)[_0x6b56('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6b56('0x46')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x6b56('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6b56('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6b56('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6b56('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x6b56('0x19')](0x5)[_0x6b56('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6b56('0x49')},'dialDropMaxRetry':{'type':Sequelize[_0x6b56('0x19')](0x3)[_0x6b56('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6b56('0x4a')},'dialDropRetryFrequency':{'type':Sequelize[_0x6b56('0x19')](0x5)[_0x6b56('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6b56('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6b56('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0x6b56('0x19')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6b56('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6b56('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6b56('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x6b56('0x19')](0x3)[_0x6b56('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6b56('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x6b56('0x19')](0x5)[_0x6b56('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6b56('0x4f')},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x6b56('0x19')](0x5)[_0x6b56('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x3,'comment':'Minutes\x20to\x20wait\x20to\x20call\x20next\x20additional\x20phone\x20number\x20'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6b56('0x19')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x6b56('0x23')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4d321c){if(!_0x4d321c)this[_0x6b56('0x10')](_0x6b56('0x50'),null);this[_0x6b56('0x10')](_0x6b56('0x51'),_0x4d321c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x6b56('0x19')](0x3)[_0x6b56('0x28')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 2eb9999..465be85 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 _0x1526=['select','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','into','cm_hopper_additional_phones','cmHopperId','OrderBy','ci.item','cm_contact_has_items','h.ListId\x20=\x20?','h.VoiceQueueId=?','h.createdAt\x20=\x20?','push','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','index','fieldName','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','VoiceQueue','findAll','rows','catch','show','params','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rawAttributes','length','createdAt','updatedAt','omit','VoiceQueues','autoAssociation','findOne','CmHopper','getHopperHistories','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','Agents','online','interface','flatMap','forEach','penalty','sequelize','transaction','TeamVoiceQueue','upsert','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','userVoiceQueue:save','removeTeams','ids','User','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','toString','SELECT','every','TeamId','all','isEmpty','removeAgents','addAgents','spread','emit','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','fromQuery','phone','scheduledAt','ContactId','ListId'];(function(_0x5d008b,_0x12b7b2){var _0x381807=function(_0x270f75){while(--_0x270f75){_0x5d008b['push'](_0x5d008b['shift']());}};_0x381807(++_0x12b7b2);}(_0x1526,0xd8));var _0x6152=function(_0x22e344,_0x5386ef){_0x22e344=_0x22e344-0x0;var _0x502fd3=_0x1526[_0x22e344];return _0x502fd3;};'use strict';var emlformat=require(_0x6152('0x0'));var rimraf=require(_0x6152('0x1'));var zipdir=require(_0x6152('0x2'));var jsonpatch=require(_0x6152('0x3'));var rp=require('request-promise');var moment=require(_0x6152('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6152('0x5'));var util=require(_0x6152('0x6'));var path=require(_0x6152('0x7'));var sox=require(_0x6152('0x8'));var csv=require(_0x6152('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6152('0xa'));var _=require(_0x6152('0xb'));var squel=require(_0x6152('0xc'));var crypto=require(_0x6152('0xd'));var jsforce=require(_0x6152('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6152('0xf'));var Papa=require(_0x6152('0x10'));var Redis=require('ioredis');var authService=require(_0x6152('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6152('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6152('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6152('0x14'));var db=require(_0x6152('0x15'))['db'];config['redis']=_[_0x6152('0x16')](config[_0x6152('0x17')],{'host':_0x6152('0x18'),'port':0x18eb});var socket=require(_0x6152('0x19'))(new Redis(config[_0x6152('0x17')]));require(_0x6152('0x1a'))[_0x6152('0x1b')](socket);function respondWithStatusCode(_0x4aa3e7,_0x27ce9d){_0x27ce9d=_0x27ce9d||0xcc;return function(_0xa80e4e){if(_0xa80e4e){return _0x4aa3e7[_0x6152('0x1c')](_0x27ce9d);}return _0x4aa3e7[_0x6152('0x1d')](_0x27ce9d)['end']();};}function respondWithResult(_0x122bc2,_0x595107){_0x595107=_0x595107||0xc8;return function(_0x42e8d2){if(_0x42e8d2){return _0x122bc2[_0x6152('0x1d')](_0x595107)[_0x6152('0x1e')](_0x42e8d2);}};}function respondWithFilteredResult(_0x418ada,_0x220fbd){return function(_0x163a2b){if(_0x163a2b){var _0x58bb75=typeof _0x220fbd[_0x6152('0x1f')]===_0x6152('0x20')&&typeof _0x220fbd[_0x6152('0x21')]==='undefined';var _0x558479=_0x163a2b[_0x6152('0x22')];var _0x4daf5b=_0x58bb75?0x0:_0x220fbd['offset'];var _0x421cf4=_0x58bb75?_0x163a2b[_0x6152('0x22')]:_0x220fbd[_0x6152('0x1f')]+_0x220fbd[_0x6152('0x21')];var _0x3e179a;if(_0x421cf4>=_0x558479){_0x421cf4=_0x558479;_0x3e179a=0xc8;}else{_0x3e179a=0xce;}_0x418ada[_0x6152('0x1d')](_0x3e179a);return _0x418ada['set'](_0x6152('0x23'),_0x4daf5b+'-'+_0x421cf4+'/'+_0x558479)[_0x6152('0x1e')](_0x163a2b);}return null;};}function patchUpdates(_0x51be0f){return function(_0x2ab916){try{jsonpatch[_0x6152('0x24')](_0x2ab916,_0x51be0f,!![]);}catch(_0x360944){return BPromise[_0x6152('0x25')](_0x360944);}return _0x2ab916[_0x6152('0x26')]();};}function saveUpdates(_0x166df9,_0x58273d){return function(_0x2ea62e){if(_0x2ea62e){return _0x2ea62e[_0x6152('0x27')](_0x166df9)[_0x6152('0x28')](function(_0x4ba45f){return _0x4ba45f;});}return null;};}function removeEntity(_0x8f3a36,_0x69f80f){return function(_0x352814){if(_0x352814){return _0x352814[_0x6152('0x29')]()[_0x6152('0x28')](function(){var _0x11c8e4=_0x352814[_0x6152('0x2a')]({'plain':!![]});var _0x1e814c=[{'name':'VoiceQueues','value':_0x6152('0x2b'),'ignore':![]},{'name':_0x6152('0x2c'),'value':_0x6152('0x2d'),'ignore':![]}];var _0x2a0c8f=_(_0x1e814c)[_0x6152('0x2e')](_0x6152('0x2f'))[_0x6152('0x30')]('value')[_0x6152('0x31')]();if(_[_0x6152('0x32')](_0x2a0c8f,_0x11c8e4[_0x6152('0x33')])){return;}var _0x2b21f5=_[_0x6152('0x34')](_0x1e814c,[_0x6152('0x31'),_0x11c8e4['type']])[_0x6152('0x35')];return db[_0x6152('0x36')][_0x6152('0x29')]({'where':{'type':_0x2b21f5,'resourceId':_0x11c8e4['id']}})[_0x6152('0x28')](function(){return _0x352814;});})[_0x6152('0x28')](function(){_0x8f3a36[_0x6152('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b1a73,_0x448581){return function(_0x7a652){if(!_0x7a652){_0x1b1a73[_0x6152('0x1c')](0x194);}return _0x7a652;};}function handleError(_0x116fe3,_0x257588){_0x257588=_0x257588||0x1f4;return function(_0x1b8157){logger['error'](_0x1b8157['stack']);if(_0x1b8157[_0x6152('0x35')]){delete _0x1b8157['name'];}_0x116fe3['status'](_0x257588)['send'](_0x1b8157);};}exports[_0x6152('0x37')]=function(_0x14b72b,_0x1bfce0){var _0x30b15b={},_0x3bc73d={},_0x41fc5c={'count':0x0,'rows':[]};var _0x10d8b8=_[_0x6152('0x30')](db['VoiceQueue']['rawAttributes'],function(_0x22bc93){return{'name':_0x22bc93[_0x6152('0x38')],'type':_0x22bc93[_0x6152('0x33')]['key']};});_0x3bc73d[_0x6152('0x39')]=_[_0x6152('0x30')](_0x10d8b8,_0x6152('0x35'));_0x3bc73d['query']=_[_0x6152('0x3a')](_0x14b72b[_0x6152('0x3b')]);_0x3bc73d[_0x6152('0x3c')]=_[_0x6152('0x3d')](_0x3bc73d[_0x6152('0x39')],_0x3bc73d[_0x6152('0x3b')]);_0x30b15b['attributes']=_[_0x6152('0x3d')](_0x3bc73d['model'],qs['fields'](_0x14b72b[_0x6152('0x3b')]['fields']));_0x30b15b[_0x6152('0x3e')]=_0x30b15b[_0x6152('0x3e')]['length']?_0x30b15b['attributes']:_0x3bc73d[_0x6152('0x39')];if(!_0x14b72b['query'][_0x6152('0x3f')](_0x6152('0x40'))){_0x30b15b[_0x6152('0x21')]=qs[_0x6152('0x21')](_0x14b72b[_0x6152('0x3b')][_0x6152('0x21')]);_0x30b15b[_0x6152('0x1f')]=qs[_0x6152('0x1f')](_0x14b72b[_0x6152('0x3b')][_0x6152('0x1f')]);}_0x30b15b[_0x6152('0x41')]=qs[_0x6152('0x42')](_0x14b72b[_0x6152('0x3b')][_0x6152('0x42')]);_0x30b15b[_0x6152('0x43')]=qs[_0x6152('0x3c')](_[_0x6152('0x44')](_0x14b72b[_0x6152('0x3b')],_0x3bc73d[_0x6152('0x3c')]),_0x10d8b8);if(_0x14b72b['query'][_0x6152('0x2e')]){_0x30b15b[_0x6152('0x43')]=_[_0x6152('0x45')](_0x30b15b[_0x6152('0x43')],{'$or':_['map'](_0x10d8b8,function(_0xfe5475){if(_0xfe5475[_0x6152('0x33')]!==_0x6152('0x46')){var _0x200447={};_0x200447[_0xfe5475['name']]={'$like':'%'+_0x14b72b[_0x6152('0x3b')]['filter']+'%'};return _0x200447;}})});}_0x30b15b=_[_0x6152('0x45')]({},_0x30b15b,_0x14b72b[_0x6152('0x47')]);var _0x31a763={'where':_0x30b15b[_0x6152('0x43')]};return db['VoiceQueue'][_0x6152('0x22')](_0x31a763)[_0x6152('0x28')](function(_0x470533){_0x41fc5c[_0x6152('0x22')]=_0x470533;if(_0x14b72b[_0x6152('0x3b')][_0x6152('0x48')]){_0x30b15b[_0x6152('0x49')]=[{'all':!![]}];}return db[_0x6152('0x4a')][_0x6152('0x4b')](_0x30b15b);})[_0x6152('0x28')](function(_0x3e03bb){_0x41fc5c[_0x6152('0x4c')]=_0x3e03bb;return _0x41fc5c;})[_0x6152('0x28')](respondWithFilteredResult(_0x1bfce0,_0x30b15b))[_0x6152('0x4d')](handleError(_0x1bfce0,null));};exports[_0x6152('0x4e')]=function(_0x5b2a93,_0x227619){var _0x524fc0={'raw':![],'where':{'id':_0x5b2a93[_0x6152('0x4f')]['id']}},_0x1d3059={};_0x1d3059[_0x6152('0x39')]=_[_0x6152('0x3a')](db[_0x6152('0x4a')]['rawAttributes']);_0x1d3059[_0x6152('0x3b')]=_[_0x6152('0x3a')](_0x5b2a93[_0x6152('0x3b')]);_0x1d3059[_0x6152('0x3c')]=_[_0x6152('0x3d')](_0x1d3059[_0x6152('0x39')],_0x1d3059['query']);_0x524fc0[_0x6152('0x3e')]=_['intersection'](_0x1d3059['model'],qs['fields'](_0x5b2a93[_0x6152('0x3b')][_0x6152('0x50')]));_0x524fc0[_0x6152('0x3e')]=_0x524fc0[_0x6152('0x3e')]['length']?_0x524fc0[_0x6152('0x3e')]:_0x1d3059[_0x6152('0x39')];if(_0x5b2a93[_0x6152('0x3b')][_0x6152('0x48')]){_0x524fc0[_0x6152('0x49')]=[{'all':!![]}];}_0x524fc0=_[_0x6152('0x45')]({},_0x524fc0,_0x5b2a93[_0x6152('0x47')]);return db[_0x6152('0x4a')]['find'](_0x524fc0)['then'](handleEntityNotFound(_0x227619,null))['then'](respondWithResult(_0x227619,null))[_0x6152('0x4d')](handleError(_0x227619,null));};exports[_0x6152('0x51')]=function(_0x4bbfc1,_0x5d0ad0){return db['VoiceQueue'][_0x6152('0x51')](_0x4bbfc1[_0x6152('0x52')],{})[_0x6152('0x28')](function(_0x3da350){var _0xcb39cc=_0x4bbfc1[_0x6152('0x53')][_0x6152('0x2a')]({'plain':!![]});if(!_0xcb39cc)throw new Error(_0x6152('0x54'));if(_0xcb39cc[_0x6152('0x55')]===_0x6152('0x53')){var _0x6d24c2=_0x3da350[_0x6152('0x2a')]({'plain':!![]});var _0x23ff08=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x6152('0x2c'),'value':_0x6152('0x2d')}];var _0x2bc061=_[_0x6152('0x34')](_0x23ff08,[_0x6152('0x31'),_0x6d24c2['type']])[_0x6152('0x35')];return db[_0x6152('0x56')][_0x6152('0x34')]({'where':{'name':_0x2bc061,'userProfileId':_0xcb39cc[_0x6152('0x57')]},'raw':!![]})[_0x6152('0x28')](function(_0x159df6){if(_0x159df6&&_0x159df6['autoAssociation']===0x0){return db[_0x6152('0x36')][_0x6152('0x51')]({'name':_0x6d24c2[_0x6152('0x35')],'resourceId':_0x6d24c2['id'],'type':_0x159df6[_0x6152('0x35')],'sectionId':_0x159df6['id']},{})[_0x6152('0x28')](function(){return _0x3da350;});}else{return _0x3da350;}})[_0x6152('0x4d')](function(_0xdd35fc){logger[_0x6152('0x58')](_0x6152('0x59'),_0xdd35fc);throw _0xdd35fc;});}return _0x3da350;})['then'](respondWithResult(_0x5d0ad0,0xc9))[_0x6152('0x4d')](handleError(_0x5d0ad0,null));};exports['clone']=function(_0x521aef,_0x39663a){var _0x58399d={'where':{'id':_0x521aef[_0x6152('0x4f')]['id']}},_0x35fd27={};_0x35fd27['model']=_['keys'](db[_0x6152('0x4a')][_0x6152('0x5a')]);_0x58399d['attributes']=_[_0x6152('0x3d')](_0x35fd27[_0x6152('0x39')],qs[_0x6152('0x50')](_0x521aef[_0x6152('0x3b')]['fields']));_0x58399d[_0x6152('0x3e')]=_0x58399d[_0x6152('0x3e')][_0x6152('0x5b')]?_0x58399d[_0x6152('0x3e')]:_0x35fd27[_0x6152('0x39')];if(_0x521aef[_0x6152('0x3b')]['includeAll']){_0x58399d['include']=[{'all':!![]}];}_0x58399d=_[_0x6152('0x45')]({},_0x58399d,_0x521aef[_0x6152('0x47')]);return db[_0x6152('0x4a')]['find'](_0x58399d)[_0x6152('0x28')](handleEntityNotFound(_0x39663a,null))['then'](function(_0x422fef){if(_0x422fef){var _0x3d3682=_0x422fef['get']({'plain':!![]});_0x3d3682=qs['omit'](_0x3d3682,['id',_0x6152('0x5c'),_0x6152('0x5d')]);_0x521aef[_0x6152('0x52')]=_[_0x6152('0x5e')](_0x521aef['body'],['id',_0x6152('0x5c'),_0x6152('0x5d')]);return db[_0x6152('0x4a')][_0x6152('0x51')](_[_0x6152('0x45')](_0x3d3682,_0x521aef[_0x6152('0x52')]),{'include':_0x521aef[_0x6152('0x3b')]['includeAll']?[{'all':!![]}]:undefined})[_0x6152('0x28')](function(_0x2d3b37){var _0x7ab5c=_0x521aef['user'][_0x6152('0x2a')]({'plain':!![]});if(!_0x7ab5c)throw new Error(_0x6152('0x54'));if(_0x7ab5c[_0x6152('0x55')]===_0x6152('0x53')){var _0x9b901a=_0x2d3b37[_0x6152('0x2a')]({'plain':!![]});var _0xed3ccb=[{'name':_0x6152('0x5f'),'value':_0x6152('0x2b')},{'name':_0x6152('0x2c'),'value':'outbound'}];var _0xfe8f47=_[_0x6152('0x34')](_0xed3ccb,[_0x6152('0x31'),_0x9b901a[_0x6152('0x33')]])['name'];return db[_0x6152('0x56')][_0x6152('0x34')]({'where':{'name':_0xfe8f47,'userProfileId':_0x7ab5c[_0x6152('0x57')]},'raw':!![]})['then'](function(_0x2235bf){if(_0x2235bf&&_0x2235bf[_0x6152('0x60')]===0x0){return db[_0x6152('0x36')]['create']({'name':_0x9b901a[_0x6152('0x35')],'resourceId':_0x9b901a['id'],'type':_0x2235bf[_0x6152('0x35')],'sectionId':_0x2235bf['id']},{})[_0x6152('0x28')](function(){return _0x2d3b37;});}else{return _0x2d3b37;}})[_0x6152('0x4d')](function(_0x497a03){logger[_0x6152('0x58')](_0x6152('0x59'),_0x497a03);throw _0x497a03;});}return _0x2d3b37;});}})['then'](respondWithResult(_0x39663a,0xc9))[_0x6152('0x4d')](handleError(_0x39663a,null));};exports[_0x6152('0x27')]=function(_0x31c94a,_0x2a2840){if(_0x31c94a[_0x6152('0x52')]['id']){delete _0x31c94a[_0x6152('0x52')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x31c94a[_0x6152('0x4f')]['id']}})[_0x6152('0x28')](handleEntityNotFound(_0x2a2840,null))['then'](saveUpdates(_0x31c94a[_0x6152('0x52')],null))[_0x6152('0x28')](respondWithResult(_0x2a2840,null))['catch'](handleError(_0x2a2840,null));};exports['destroy']=function(_0x12b459,_0x31fc5d){return db[_0x6152('0x4a')]['find']({'where':{'id':_0x12b459['params']['id']}})[_0x6152('0x28')](handleEntityNotFound(_0x31fc5d,null))[_0x6152('0x28')](removeEntity(_0x31fc5d,null))[_0x6152('0x4d')](handleError(_0x31fc5d,null));};exports['getHoppers']=function(_0x3c800d,_0x55b416,_0x45ecd0){var _0x253a3b={'raw':![],'where':{}};var _0x46f3af={};var _0x149c09={'count':0x0,'rows':[]};return db[_0x6152('0x4a')][_0x6152('0x61')]({'where':{'id':_0x3c800d[_0x6152('0x4f')]['id']}})[_0x6152('0x28')](handleEntityNotFound(_0x55b416,null))[_0x6152('0x28')](function(_0xab2e9e){if(_0xab2e9e){_0x46f3af[_0x6152('0x39')]=_['keys'](db[_0x6152('0x62')][_0x6152('0x5a')]);_0x46f3af['query']=_[_0x6152('0x3a')](_0x3c800d[_0x6152('0x3b')]);_0x46f3af[_0x6152('0x3c')]=_[_0x6152('0x3d')](_0x46f3af[_0x6152('0x39')],_0x46f3af['query']);_0x253a3b['attributes']=_[_0x6152('0x3d')](_0x46f3af['model'],qs[_0x6152('0x50')](_0x3c800d[_0x6152('0x3b')]['fields']));_0x253a3b[_0x6152('0x3e')]=_0x253a3b[_0x6152('0x3e')]['length']?_0x253a3b[_0x6152('0x3e')]:_0x46f3af[_0x6152('0x39')];if(!_0x3c800d[_0x6152('0x3b')][_0x6152('0x3f')](_0x6152('0x40'))){_0x253a3b[_0x6152('0x21')]=qs[_0x6152('0x21')](_0x3c800d[_0x6152('0x3b')][_0x6152('0x21')]);_0x253a3b['offset']=qs[_0x6152('0x1f')](_0x3c800d[_0x6152('0x3b')]['offset']);}_0x253a3b[_0x6152('0x41')]=qs['sort'](_0x3c800d[_0x6152('0x3b')][_0x6152('0x42')]);_0x253a3b['where']=qs[_0x6152('0x3c')](_['pick'](_0x3c800d[_0x6152('0x3b')],_0x46f3af[_0x6152('0x3c')]));_0x253a3b[_0x6152('0x43')]['VoiceQueueId']=_0xab2e9e['id'];if(_0x3c800d[_0x6152('0x3b')][_0x6152('0x2e')]){_0x253a3b[_0x6152('0x43')]=_[_0x6152('0x45')](_0x253a3b[_0x6152('0x43')],{'$or':_[_0x6152('0x30')](_0x253a3b['attributes'],function(_0x3dd633){var _0x1e42e4={};_0x1e42e4[_0x3dd633]={'$like':'%'+_0x3c800d[_0x6152('0x3b')][_0x6152('0x2e')]+'%'};return _0x1e42e4;})});}_0x253a3b=_[_0x6152('0x45')]({},_0x253a3b,_0x3c800d[_0x6152('0x47')]);return db[_0x6152('0x62')][_0x6152('0x22')]({'where':_0x253a3b['where']})[_0x6152('0x28')](function(_0x4c633f){_0x149c09['count']=_0x4c633f;if(_0x3c800d['query']['includeAll']){_0x253a3b[_0x6152('0x49')]=[{'all':!![]}];}return db[_0x6152('0x62')]['findAll'](_0x253a3b);})[_0x6152('0x28')](function(_0x1c5a2b){_0x149c09['rows']=_0x1c5a2b;return _0x149c09;});}})[_0x6152('0x28')](respondWithFilteredResult(_0x55b416,_0x253a3b))[_0x6152('0x4d')](handleError(_0x55b416,null));};exports[_0x6152('0x63')]=function(_0x16196a,_0x2b6aa8,_0x4d2f75){var _0x747a94={'raw':!![],'where':{}};var _0x3822b4={};var _0x1afc7e={'count':0x0,'rows':[]};return db[_0x6152('0x4a')]['findOne']({'where':{'id':_0x16196a[_0x6152('0x4f')]['id']}})[_0x6152('0x28')](handleEntityNotFound(_0x2b6aa8,null))[_0x6152('0x28')](function(_0x339c82){if(_0x339c82){_0x3822b4[_0x6152('0x39')]=_[_0x6152('0x3a')](db['CmHopperHistory'][_0x6152('0x5a')]);_0x3822b4[_0x6152('0x3b')]=_['keys'](_0x16196a['query']);_0x3822b4[_0x6152('0x3c')]=_[_0x6152('0x3d')](_0x3822b4[_0x6152('0x39')],_0x3822b4[_0x6152('0x3b')]);_0x747a94[_0x6152('0x3e')]=_[_0x6152('0x3d')](_0x3822b4[_0x6152('0x39')],qs[_0x6152('0x50')](_0x16196a[_0x6152('0x3b')]['fields']));_0x747a94[_0x6152('0x3e')]=_0x747a94[_0x6152('0x3e')][_0x6152('0x5b')]?_0x747a94[_0x6152('0x3e')]:_0x3822b4[_0x6152('0x39')];if(!_0x16196a[_0x6152('0x3b')][_0x6152('0x3f')]('nolimit')){_0x747a94['limit']=qs[_0x6152('0x21')](_0x16196a[_0x6152('0x3b')][_0x6152('0x21')]);_0x747a94[_0x6152('0x1f')]=qs['offset'](_0x16196a[_0x6152('0x3b')]['offset']);}_0x747a94[_0x6152('0x41')]=qs[_0x6152('0x42')](_0x16196a[_0x6152('0x3b')][_0x6152('0x42')]);_0x747a94[_0x6152('0x43')]=qs[_0x6152('0x3c')](_[_0x6152('0x44')](_0x16196a['query'],_0x3822b4[_0x6152('0x3c')]));_0x747a94[_0x6152('0x43')][_0x6152('0x64')]=_0x339c82['id'];if(_0x16196a['query'][_0x6152('0x2e')]){_0x747a94[_0x6152('0x43')]=_[_0x6152('0x45')](_0x747a94['where'],{'$or':_[_0x6152('0x30')](_0x747a94['attributes'],function(_0x399721){var _0x183734={};_0x183734[_0x399721]={'$like':'%'+_0x16196a['query'][_0x6152('0x2e')]+'%'};return _0x183734;})});}_0x747a94=_[_0x6152('0x45')]({},_0x747a94,_0x16196a['options']);return db[_0x6152('0x65')]['count']({'where':_0x747a94[_0x6152('0x43')]})[_0x6152('0x28')](function(_0x10c228){_0x1afc7e[_0x6152('0x22')]=_0x10c228;if(_0x16196a[_0x6152('0x3b')][_0x6152('0x48')]){_0x747a94[_0x6152('0x49')]=[{'all':!![]}];}return db[_0x6152('0x65')][_0x6152('0x4b')](_0x747a94);})['then'](function(_0x3e4bed){_0x1afc7e[_0x6152('0x4c')]=_0x3e4bed;return _0x1afc7e;});}})['then'](respondWithFilteredResult(_0x2b6aa8,_0x747a94))[_0x6152('0x4d')](handleError(_0x2b6aa8,null));};exports[_0x6152('0x66')]=function(_0x23b36e,_0x4b1b3a,_0x4851ba){var _0xe6ed85={'raw':!![],'where':{}};var _0x1c701e={};var _0x95c9fe={'count':0x0,'rows':[]};return db[_0x6152('0x4a')][_0x6152('0x61')]({'where':{'id':_0x23b36e['params']['id']}})['then'](handleEntityNotFound(_0x4b1b3a,null))[_0x6152('0x28')](function(_0x523f98){if(_0x523f98){_0x1c701e[_0x6152('0x39')]=_[_0x6152('0x3a')](db[_0x6152('0x67')]['rawAttributes']);_0x1c701e[_0x6152('0x3b')]=_[_0x6152('0x3a')](_0x23b36e[_0x6152('0x3b')]);_0x1c701e[_0x6152('0x3c')]=_[_0x6152('0x3d')](_0x1c701e['model'],_0x1c701e[_0x6152('0x3b')]);_0xe6ed85[_0x6152('0x3e')]=_[_0x6152('0x3d')](_0x1c701e[_0x6152('0x39')],qs['fields'](_0x23b36e[_0x6152('0x3b')]['fields']));_0xe6ed85[_0x6152('0x3e')]=_0xe6ed85[_0x6152('0x3e')][_0x6152('0x5b')]?_0xe6ed85[_0x6152('0x3e')]:_0x1c701e['model'];if(!_0x23b36e[_0x6152('0x3b')][_0x6152('0x3f')]('nolimit')){_0xe6ed85[_0x6152('0x21')]=qs['limit'](_0x23b36e[_0x6152('0x3b')][_0x6152('0x21')]);_0xe6ed85[_0x6152('0x1f')]=qs[_0x6152('0x1f')](_0x23b36e[_0x6152('0x3b')][_0x6152('0x1f')]);}_0xe6ed85[_0x6152('0x41')]=qs[_0x6152('0x42')](_0x23b36e[_0x6152('0x3b')][_0x6152('0x42')]);_0xe6ed85['where']=qs[_0x6152('0x3c')](_[_0x6152('0x44')](_0x23b36e[_0x6152('0x3b')],_0x1c701e[_0x6152('0x3c')]));_0xe6ed85[_0x6152('0x43')][_0x6152('0x64')]=_0x523f98['id'];if(_0x23b36e[_0x6152('0x3b')][_0x6152('0x2e')]){_0xe6ed85[_0x6152('0x43')]=_['merge'](_0xe6ed85['where'],{'$or':_['map'](_0xe6ed85[_0x6152('0x3e')],function(_0x2ef5ab){var _0x245b39={};_0x245b39[_0x2ef5ab]={'$like':'%'+_0x23b36e[_0x6152('0x3b')][_0x6152('0x2e')]+'%'};return _0x245b39;})});}_0xe6ed85=_[_0x6152('0x45')]({},_0xe6ed85,_0x23b36e['options']);return db[_0x6152('0x67')]['count']({'where':_0xe6ed85['where']})[_0x6152('0x28')](function(_0xb1a37a){_0x95c9fe[_0x6152('0x22')]=_0xb1a37a;if(_0x23b36e[_0x6152('0x3b')]['includeAll']){_0xe6ed85['include']=[{'all':!![]}];}return db[_0x6152('0x67')]['findAll'](_0xe6ed85);})[_0x6152('0x28')](function(_0x34a706){_0x95c9fe['rows']=_0x34a706;return _0x95c9fe;});}})[_0x6152('0x28')](respondWithFilteredResult(_0x4b1b3a,_0xe6ed85))[_0x6152('0x4d')](handleError(_0x4b1b3a,null));};exports[_0x6152('0x68')]=function(_0x3fd1c9,_0x4002e9,_0x13821a){var _0x1fdc8a={'raw':!![],'where':{}};var _0x200c48={};var _0x53c898={'count':0x0,'rows':[]};return db[_0x6152('0x4a')][_0x6152('0x61')]({'where':{'id':_0x3fd1c9[_0x6152('0x4f')]['id']}})[_0x6152('0x28')](handleEntityNotFound(_0x4002e9,null))[_0x6152('0x28')](function(_0x25772b){if(_0x25772b){_0x200c48[_0x6152('0x39')]=_[_0x6152('0x3a')](db[_0x6152('0x69')]['rawAttributes']);_0x200c48[_0x6152('0x3b')]=_[_0x6152('0x3a')](_0x3fd1c9[_0x6152('0x3b')]);_0x200c48['filters']=_['intersection'](_0x200c48[_0x6152('0x39')],_0x200c48['query']);_0x1fdc8a[_0x6152('0x3e')]=_[_0x6152('0x3d')](_0x200c48[_0x6152('0x39')],qs[_0x6152('0x50')](_0x3fd1c9[_0x6152('0x3b')]['fields']));_0x1fdc8a['attributes']=_0x1fdc8a[_0x6152('0x3e')][_0x6152('0x5b')]?_0x1fdc8a[_0x6152('0x3e')]:_0x200c48[_0x6152('0x39')];if(!_0x3fd1c9['query']['hasOwnProperty'](_0x6152('0x40'))){_0x1fdc8a['limit']=qs['limit'](_0x3fd1c9[_0x6152('0x3b')][_0x6152('0x21')]);_0x1fdc8a[_0x6152('0x1f')]=qs['offset'](_0x3fd1c9[_0x6152('0x3b')]['offset']);}_0x1fdc8a[_0x6152('0x41')]=qs['sort'](_0x3fd1c9[_0x6152('0x3b')][_0x6152('0x42')]);_0x1fdc8a[_0x6152('0x43')]=qs[_0x6152('0x3c')](_[_0x6152('0x44')](_0x3fd1c9[_0x6152('0x3b')],_0x200c48['filters']));_0x1fdc8a[_0x6152('0x43')]['VoiceQueueId']=_0x25772b['id'];if(_0x3fd1c9[_0x6152('0x3b')][_0x6152('0x2e')]){_0x1fdc8a[_0x6152('0x43')]=_[_0x6152('0x45')](_0x1fdc8a[_0x6152('0x43')],{'$or':_[_0x6152('0x30')](_0x1fdc8a['attributes'],function(_0x57ef2f){var _0x46ef39={};_0x46ef39[_0x57ef2f]={'$like':'%'+_0x3fd1c9['query'][_0x6152('0x2e')]+'%'};return _0x46ef39;})});}_0x1fdc8a=_[_0x6152('0x45')]({},_0x1fdc8a,_0x3fd1c9[_0x6152('0x47')]);return db[_0x6152('0x69')][_0x6152('0x22')]({'where':_0x1fdc8a[_0x6152('0x43')]})[_0x6152('0x28')](function(_0x14a646){_0x53c898['count']=_0x14a646;if(_0x3fd1c9['query'][_0x6152('0x48')]){_0x1fdc8a[_0x6152('0x49')]=[{'all':!![]}];}return db[_0x6152('0x69')][_0x6152('0x4b')](_0x1fdc8a);})[_0x6152('0x28')](function(_0x6826ca){_0x53c898[_0x6152('0x4c')]=_0x6826ca;return _0x53c898;});}})[_0x6152('0x28')](respondWithFilteredResult(_0x4002e9,_0x1fdc8a))[_0x6152('0x4d')](handleError(_0x4002e9,null));};exports[_0x6152('0x6a')]=function(_0x447443,_0x1e7af9,_0x2220df){var _0x3a3d90={};var _0x51094c={};var _0x2d88b5;var _0x4d9407;return db[_0x6152('0x4a')]['findOne']({'where':{'id':_0x447443['params']['id']}})[_0x6152('0x28')](handleEntityNotFound(_0x1e7af9,null))['then'](function(_0x2c5a5e){if(_0x2c5a5e){_0x2d88b5=_0x2c5a5e;_0x51094c[_0x6152('0x39')]=_['keys'](db[_0x6152('0x6b')][_0x6152('0x5a')]);_0x51094c[_0x6152('0x3b')]=_[_0x6152('0x3a')](_0x447443[_0x6152('0x3b')]);_0x51094c[_0x6152('0x3c')]=_['intersection'](_0x51094c[_0x6152('0x39')],_0x51094c[_0x6152('0x3b')]);_0x3a3d90[_0x6152('0x3e')]=_[_0x6152('0x3d')](_0x51094c[_0x6152('0x39')],qs[_0x6152('0x50')](_0x447443['query'][_0x6152('0x50')]));_0x3a3d90[_0x6152('0x3e')]=_0x3a3d90['attributes'][_0x6152('0x5b')]?_0x3a3d90['attributes']:_0x51094c['model'];_0x3a3d90['order']=qs[_0x6152('0x42')](_0x447443[_0x6152('0x3b')]['sort']);_0x3a3d90[_0x6152('0x43')]=qs[_0x6152('0x3c')](_[_0x6152('0x44')](_0x447443[_0x6152('0x3b')],_0x51094c['filters']));if(_0x447443['query']['filter']){_0x3a3d90[_0x6152('0x43')]=_[_0x6152('0x45')](_0x3a3d90[_0x6152('0x43')],{'$or':_[_0x6152('0x30')](_0x3a3d90['attributes'],function(_0xacc9ee){var _0x4d8a9c={};_0x4d8a9c[_0xacc9ee]={'$like':'%'+_0x447443[_0x6152('0x3b')][_0x6152('0x2e')]+'%'};return _0x4d8a9c;})});}_0x3a3d90=_[_0x6152('0x45')]({},_0x3a3d90,_0x447443[_0x6152('0x47')]);return _0x2d88b5[_0x6152('0x6a')](_0x3a3d90);}})[_0x6152('0x28')](function(_0x4c4364){if(_0x4c4364){_0x4d9407=_0x4c4364[_0x6152('0x5b')];if(!_0x447443[_0x6152('0x3b')][_0x6152('0x3f')](_0x6152('0x40'))){_0x3a3d90[_0x6152('0x21')]=qs[_0x6152('0x21')](_0x447443['query'][_0x6152('0x21')]);_0x3a3d90['offset']=qs[_0x6152('0x1f')](_0x447443['query'][_0x6152('0x1f')]);}return _0x2d88b5['getTeams'](_0x3a3d90);}})[_0x6152('0x28')](function(_0x372e48){if(_0x372e48){return _0x372e48?{'count':_0x4d9407,'rows':_0x372e48}:null;}})['then'](respondWithResult(_0x1e7af9,null))[_0x6152('0x4d')](handleError(_0x1e7af9,null));};exports[_0x6152('0x6c')]=function(_0x10928e,_0x4276b5,_0x218979){var _0x117c1d=_0x10928e[_0x6152('0x52')]['teams'];var _0x495ae3=_['map'](_0x117c1d,'id');return db[_0x6152('0x6b')][_0x6152('0x4b')]({'where':{'id':_0x495ae3},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6152('0x6d'),'attributes':['id',_0x6152('0x35'),_0x6152('0x6e'),'voicePause',_0x6152('0x6f')],'raw':!![]}]})[_0x6152('0x28')](function(_0x3e6600){if(_0x3e6600){var _0x7faaad=_[_0x6152('0x70')](_0x3e6600,function(_0x55feb1){var _0x2ba69b=_0x55feb1[_0x6152('0x2a')]({'plain':!![]});_0x2ba69b[_0x6152('0x6d')][_0x6152('0x71')](function(_0x223bc7){_0x223bc7[_0x6152('0x72')]=_[_0x6152('0x34')](_0x117c1d,{'id':_0x2ba69b['id']})['penalty'];});return _0x2ba69b[_0x6152('0x6d')];});return db[_0x6152('0x4a')][_0x6152('0x34')]({'where':{'id':_0x10928e[_0x6152('0x4f')]['id']}})[_0x6152('0x28')](function(_0x159beb){return db[_0x6152('0x73')][_0x6152('0x74')](function(_0x115391){return _0x159beb['addTeams'](_0x495ae3,{'transaction':_0x115391})[_0x6152('0x28')](function(){return BPromise['each'](_0x117c1d,function(_0x566b2b){return db[_0x6152('0x75')][_0x6152('0x76')]({'TeamId':_0x566b2b['id'],'VoiceQueueId':_0x10928e['params']['id'],'penalty':_0x566b2b[_0x6152('0x72')]},{'transaction':_0x115391});});})['then'](function(){return BPromise[_0x6152('0x77')](_0x7faaad,function(_0x294447){return db[_0x6152('0x78')][_0x6152('0x79')]({'where':{'UserId':_0x294447['id'],'VoiceQueueId':_0x10928e['params']['id']},'defaults':{'penalty':_0x294447[_0x6152('0x72')]},'transaction':_0x115391});});})['then'](function(){return BPromise[_0x6152('0x77')](_[_0x6152('0x2e')](_0x7faaad,{'online':!![]}),function(_0x3aa53b){return db[_0x6152('0x7a')][_0x6152('0x76')]({'membername':_0x3aa53b[_0x6152('0x35')],'UserId':_0x3aa53b['id'],'queue_name':_0x159beb[_0x6152('0x35')],'VoiceQueueId':_0x159beb['id'],'interface':_[_0x6152('0x7b')](_0x3aa53b[_0x6152('0x6f')])?util[_0x6152('0x7c')](_0x6152('0x7d'),_0x3aa53b[_0x6152('0x35')]):_0x3aa53b[_0x6152('0x6f')],'paused':_0x3aa53b[_0x6152('0x7e')]||![],'penalty':_0x3aa53b[_0x6152('0x72')]},{'transaction':_0x115391});});})[_0x6152('0x28')](function(){_0x7faaad[_0x6152('0x71')](function(_0x2405ec){socket['emit'](_0x6152('0x7f'),{'UserId':_0x2405ec['id'],'VoiceQueueId':_0x159beb['id']});});});});});}})['then'](respondWithStatusCode(_0x4276b5,null))[_0x6152('0x4d')](handleError(_0x4276b5,null));};exports[_0x6152('0x80')]=function(_0x5b0ffb,_0xf5f0f6,_0x1e619b){return db[_0x6152('0x6b')][_0x6152('0x4b')]({'where':{'id':_0x5b0ffb['query'][_0x6152('0x81')]},'attributes':['id'],'include':[{'model':db[_0x6152('0x82')],'as':_0x6152('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x6152('0x28')](handleEntityNotFound(_0xf5f0f6,null))['then'](function(_0x57a1e9){var _0x4032d6=_[_0x6152('0x30')](_0x57a1e9,'id');var _0x1078a4=[];var _0x84ac5a=[];var _0x275b8f=squel['select']();_0x275b8f[_0x6152('0x83')]('tq.TeamId')[_0x6152('0x84')]('team_has_voice_queues','tq')[_0x6152('0x85')](_0x6152('0x86'),'ut',_0x6152('0x87'))[_0x6152('0x43')](_0x6152('0x88'),_0x5b0ffb['params']['id']);for(var _0xa5f4c9=0x0;_0xa5f4c9<_0x57a1e9[_0x6152('0x5b')];_0xa5f4c9+=0x1){let _0x5bae5f=_0x57a1e9[_0xa5f4c9];for(var _0x592b82=0x0;_0x592b82<_0x5bae5f['Agents'][_0x6152('0x5b')];_0x592b82+=0x1){let _0x3a7791=_0x5bae5f['Agents'][_0x592b82];var _0xa948e9=_0x275b8f[_0x6152('0x89')]();_0xa948e9['where']('ut.UserId\x20=\x20?',_0x3a7791['id']);_0x84ac5a['push'](db[_0x6152('0x73')]['query'](_0xa948e9[_0x6152('0x8a')](),{'type':db[_0x6152('0x73')]['QueryTypes'][_0x6152('0x8b')]})[_0x6152('0x28')](function(_0x117fad){if(_0x117fad[_0x6152('0x5b')]===0x1){return _0x3a7791['id'];}else{var _0x166d36=_[_0x6152('0x8c')](_[_0x6152('0x30')](_0x117fad,_0x6152('0x8d')),function(_0x2ce629){return _[_0x6152('0x32')](_0x4032d6,_0x2ce629);});if(_0x166d36){return _0x3a7791['id'];}}}));}}return BPromise[_0x6152('0x8e')](_0x84ac5a)['then'](function(_0x59fd76){_0x1078a4=_(_0x1078a4)['union'](_0x59fd76)['compact']()[_0x6152('0x31')]();return db['VoiceQueue'][_0x6152('0x34')]({'where':{'id':_0x5b0ffb[_0x6152('0x4f')]['id']}})['then'](function(_0x40f5fe){return db[_0x6152('0x73')][_0x6152('0x74')](function(_0x36a937){return _0x40f5fe[_0x6152('0x80')](_0x5b0ffb['query'][_0x6152('0x81')],{'transaction':_0x36a937})['then'](function(){if(!_[_0x6152('0x8f')](_0x1078a4)){return _0x40f5fe[_0x6152('0x90')](_0x1078a4,{'transaction':_0x36a937})[_0x6152('0x28')](function(){return db[_0x6152('0x7a')][_0x6152('0x29')]({'where':{'VoiceQueueId':_0x5b0ffb['params']['id'],'UserId':_0x1078a4},'transaction':_0x36a937});});}})[_0x6152('0x28')](function(){_0x1078a4[_0x6152('0x71')](function(_0x47752b){socket['emit']('userVoiceQueue:remove',{'UserId':_0x47752b,'VoiceQueueId':_0x40f5fe['id']});});});});});});})[_0x6152('0x28')](respondWithStatusCode(_0xf5f0f6,null))[_0x6152('0x4d')](handleError(_0xf5f0f6,null));};exports[_0x6152('0x91')]=function(_0x361359,_0x388b24,_0x196170){var _0x4e3c71,_0x42b949;return db[_0x6152('0x4a')][_0x6152('0x34')]({'where':{'id':_0x361359[_0x6152('0x4f')]['id']}})[_0x6152('0x28')](handleEntityNotFound(_0x388b24,null))[_0x6152('0x28')](function(_0x3eda2a){if(_0x3eda2a){_0x42b949=_0x3eda2a;return _0x3eda2a[_0x6152('0x91')](_0x361359[_0x6152('0x52')][_0x6152('0x81')],_['omit'](_0x361359[_0x6152('0x52')],['ids','id'])||{})[_0x6152('0x92')](function(_0x1049b9){for(var _0x4a115e=0x0;_0x4a115e<_0x361359[_0x6152('0x52')]['ids'][_0x6152('0x5b')];_0x4a115e+=0x1){socket[_0x6152('0x93')](_0x6152('0x7f'),{'UserId':_0x361359[_0x6152('0x52')][_0x6152('0x81')][_0x4a115e],'VoiceQueueId':_0x361359['params']['id']});}return _0x1049b9;});}})[_0x6152('0x28')](function(_0x3474f2){_0x4e3c71=_0x3474f2||[];if(_0x42b949){return db[_0x6152('0x82')][_0x6152('0x4b')]({'where':{'id':_0x361359['body'][_0x6152('0x81')]},'attributes':['id',_0x6152('0x35'),'online',_0x6152('0x7e'),_0x6152('0x6f')],'raw':!![]});}})[_0x6152('0x28')](function(_0x40f2c5){if(!_[_0x6152('0x8f')](_0x40f2c5)){var _0x168d92=[];for(var _0x432912=0x0;_0x432912<_0x40f2c5[_0x6152('0x5b')];_0x432912++){if(_0x40f2c5[_0x432912][_0x6152('0x6e')]){_0x168d92['push'](db[_0x6152('0x7a')][_0x6152('0x76')]({'membername':_0x40f2c5[_0x432912]['name'],'UserId':_0x40f2c5[_0x432912]['id'],'queue_name':_0x42b949[_0x6152('0x35')],'VoiceQueueId':_0x42b949['id'],'interface':_[_0x6152('0x7b')](_0x40f2c5[_0x432912][_0x6152('0x6f')])?util[_0x6152('0x7c')]('SIP/%s',_0x40f2c5[_0x432912]['name']):_0x40f2c5[_0x432912]['interface'],'paused':_0x40f2c5[_0x432912][_0x6152('0x7e')]||![],'penalty':_0x361359[_0x6152('0x52')][_0x6152('0x72')]||0x0}));}}return BPromise[_0x6152('0x8e')](_0x168d92);}})[_0x6152('0x28')](function(){return _0x4e3c71;})[_0x6152('0x28')](respondWithResult(_0x388b24,null))['catch'](handleError(_0x388b24,null));};exports[_0x6152('0x90')]=function(_0x5be5bd,_0x237350,_0x5d6665){return db['VoiceQueue'][_0x6152('0x34')]({'where':{'id':_0x5be5bd['params']['id']}})['then'](handleEntityNotFound(_0x237350,null))[_0x6152('0x28')](function(_0x27a53c){if(_0x27a53c){return _0x27a53c[_0x6152('0x90')](_0x5be5bd[_0x6152('0x3b')][_0x6152('0x81')])[_0x6152('0x28')](function(){if(_[_0x6152('0x94')](_0x5be5bd[_0x6152('0x3b')][_0x6152('0x81')])){for(var _0x2481e8=0x0;_0x2481e8<_0x5be5bd[_0x6152('0x3b')][_0x6152('0x81')][_0x6152('0x5b')];_0x2481e8+=0x1){socket[_0x6152('0x93')]('userVoiceQueue:remove',{'UserId':Number(_0x5be5bd[_0x6152('0x3b')]['ids'][_0x2481e8]),'VoiceQueueId':Number(_0x5be5bd[_0x6152('0x4f')]['id'])});}}else{socket[_0x6152('0x93')]('userVoiceQueue:remove',{'UserId':Number(_0x5be5bd[_0x6152('0x3b')][_0x6152('0x81')]),'VoiceQueueId':Number(_0x5be5bd['params']['id'])});}});}})[_0x6152('0x28')](function(_0x36ae2f){return db['UserVoiceQueueRt'][_0x6152('0x29')]({'where':{'VoiceQueueId':_0x5be5bd[_0x6152('0x4f')]['id'],'UserId':_0x5be5bd['query']['ids']}})['then'](function(){return _0x36ae2f;});})[_0x6152('0x28')](respondWithStatusCode(_0x237350,null))['catch'](handleError(_0x237350,null));};exports['getAgents']=function(_0x3d838f,_0x459d37,_0x2db5db){var _0x4097c7={};var _0xf5ccef={};var _0xc28c27;var _0x11009d;return db[_0x6152('0x4a')][_0x6152('0x61')]({'where':{'id':_0x3d838f[_0x6152('0x4f')]['id']}})[_0x6152('0x28')](handleEntityNotFound(_0x459d37,null))[_0x6152('0x28')](function(_0x19137a){if(_0x19137a){_0xc28c27=_0x19137a;_0xf5ccef['model']=_['keys'](db['User']['rawAttributes']);_0xf5ccef[_0x6152('0x3b')]=_['keys'](_0x3d838f[_0x6152('0x3b')]);_0xf5ccef[_0x6152('0x3c')]=_[_0x6152('0x3d')](_0xf5ccef[_0x6152('0x39')],_0xf5ccef['query']);_0x4097c7[_0x6152('0x3e')]=_[_0x6152('0x3d')](_0xf5ccef[_0x6152('0x39')],qs[_0x6152('0x50')](_0x3d838f[_0x6152('0x3b')][_0x6152('0x50')]));_0x4097c7[_0x6152('0x3e')]=_0x4097c7[_0x6152('0x3e')][_0x6152('0x5b')]?_0x4097c7[_0x6152('0x3e')]:_0xf5ccef[_0x6152('0x39')];_0x4097c7['order']=qs[_0x6152('0x42')](_0x3d838f['query']['sort']);_0x4097c7[_0x6152('0x43')]=qs[_0x6152('0x3c')](_['pick'](_0x3d838f['query'],_0xf5ccef[_0x6152('0x3c')]));if(_0x3d838f[_0x6152('0x3b')][_0x6152('0x2e')]){_0x4097c7[_0x6152('0x43')]=_[_0x6152('0x45')](_0x4097c7[_0x6152('0x43')],{'$or':_[_0x6152('0x30')](_0x4097c7[_0x6152('0x3e')],function(_0xdb6f16){var _0x58b8ef={};_0x58b8ef[_0xdb6f16]={'$like':'%'+_0x3d838f['query'][_0x6152('0x2e')]+'%'};return _0x58b8ef;})});}_0x4097c7=_[_0x6152('0x45')]({},_0x4097c7,_0x3d838f[_0x6152('0x47')]);return _0xc28c27[_0x6152('0x95')](_0x4097c7);}})['then'](function(_0x2467e8){if(_0x2467e8){_0x11009d=_0x2467e8[_0x6152('0x5b')];if(!_0x3d838f[_0x6152('0x3b')]['hasOwnProperty']('nolimit')){_0x4097c7[_0x6152('0x21')]=qs[_0x6152('0x21')](_0x3d838f['query'][_0x6152('0x21')]);_0x4097c7[_0x6152('0x1f')]=qs[_0x6152('0x1f')](_0x3d838f['query'][_0x6152('0x1f')]);}return _0xc28c27[_0x6152('0x95')](_0x4097c7);}})[_0x6152('0x28')](function(_0x2889b9){if(_0x2889b9){return _0x2889b9?{'count':_0x11009d,'rows':_0x2889b9}:null;}})[_0x6152('0x28')](respondWithResult(_0x459d37,null))[_0x6152('0x4d')](handleError(_0x459d37,null));};exports['getMembers']=function(_0x49913d,_0x41667f,_0x18d0a2){var _0x189a03={};var _0x456157={};var _0x3a9a56;var _0x1a7214;return db[_0x6152('0x4a')][_0x6152('0x61')]({'where':{'id':_0x49913d[_0x6152('0x4f')]['id']}})[_0x6152('0x28')](handleEntityNotFound(_0x41667f,null))[_0x6152('0x28')](function(_0xc9afa7){if(_0xc9afa7){_0x3a9a56=_0xc9afa7;_0x456157['model']=_[_0x6152('0x3a')](db[_0x6152('0x7a')][_0x6152('0x5a')]);_0x456157[_0x6152('0x3b')]=_[_0x6152('0x3a')](_0x49913d[_0x6152('0x3b')]);_0x456157['filters']=_[_0x6152('0x3d')](_0x456157[_0x6152('0x39')],_0x456157[_0x6152('0x3b')]);_0x189a03['attributes']=_['intersection'](_0x456157[_0x6152('0x39')],qs[_0x6152('0x50')](_0x49913d['query'][_0x6152('0x50')]));_0x189a03[_0x6152('0x3e')]=_0x189a03[_0x6152('0x3e')][_0x6152('0x5b')]?_0x189a03[_0x6152('0x3e')]:_0x456157[_0x6152('0x39')];_0x189a03[_0x6152('0x41')]=qs[_0x6152('0x42')](_0x49913d[_0x6152('0x3b')][_0x6152('0x42')]);_0x189a03[_0x6152('0x43')]=qs[_0x6152('0x3c')](_[_0x6152('0x44')](_0x49913d[_0x6152('0x3b')],_0x456157[_0x6152('0x3c')]));if(_0x49913d[_0x6152('0x3b')][_0x6152('0x2e')]){_0x189a03[_0x6152('0x43')]=_[_0x6152('0x45')](_0x189a03[_0x6152('0x43')],{'$or':_[_0x6152('0x30')](_0x189a03[_0x6152('0x3e')],function(_0x59f6d4){var _0x3be43d={};_0x3be43d[_0x59f6d4]={'$like':'%'+_0x49913d[_0x6152('0x3b')][_0x6152('0x2e')]+'%'};return _0x3be43d;})});}_0x189a03=_['merge']({},_0x189a03,_0x49913d[_0x6152('0x47')]);return _0x3a9a56[_0x6152('0x96')](_0x189a03);}})[_0x6152('0x28')](function(_0x557bfe){if(_0x557bfe){_0x1a7214=_0x557bfe[_0x6152('0x5b')];if(!_0x49913d[_0x6152('0x3b')][_0x6152('0x3f')]('nolimit')){_0x189a03[_0x6152('0x21')]=qs[_0x6152('0x21')](_0x49913d[_0x6152('0x3b')]['limit']);_0x189a03['offset']=qs[_0x6152('0x1f')](_0x49913d[_0x6152('0x3b')][_0x6152('0x1f')]);}return _0x3a9a56[_0x6152('0x96')](_0x189a03);}})[_0x6152('0x28')](function(_0x136368){return _0x136368?{'count':_0x1a7214,'rows':_0x136368}:null;})['then'](respondWithResult(_0x41667f,null))['catch'](handleError(_0x41667f,null));};exports[_0x6152('0x97')]=function(_0x34618d,_0x38a976,_0x281821){var _0x2fdeaa={};var _0x162abb={};var _0x2702b4;var _0x152c5c;return db[_0x6152('0x4a')][_0x6152('0x61')]({'where':{'id':_0x34618d['params']['id']}})['then'](handleEntityNotFound(_0x38a976,null))[_0x6152('0x28')](function(_0x578bf7){if(_0x578bf7){_0x2702b4=_0x578bf7;_0x162abb[_0x6152('0x39')]=_[_0x6152('0x3a')](db[_0x6152('0x98')][_0x6152('0x5a')]);_0x162abb['query']=_[_0x6152('0x3a')](_0x34618d[_0x6152('0x3b')]);_0x162abb[_0x6152('0x3c')]=_[_0x6152('0x3d')](_0x162abb[_0x6152('0x39')],_0x162abb['query']);_0x2fdeaa['attributes']=_[_0x6152('0x3d')](_0x162abb[_0x6152('0x39')],qs['fields'](_0x34618d[_0x6152('0x3b')]['fields']));_0x2fdeaa[_0x6152('0x3e')]=_0x2fdeaa[_0x6152('0x3e')][_0x6152('0x5b')]?_0x2fdeaa[_0x6152('0x3e')]:_0x162abb[_0x6152('0x39')];_0x2fdeaa[_0x6152('0x41')]=qs[_0x6152('0x42')](_0x34618d[_0x6152('0x3b')]['sort']);_0x2fdeaa[_0x6152('0x43')]=qs[_0x6152('0x3c')](_[_0x6152('0x44')](_0x34618d[_0x6152('0x3b')],_0x162abb[_0x6152('0x3c')]));if(_0x34618d['query'][_0x6152('0x2e')]){_0x2fdeaa[_0x6152('0x43')]=_[_0x6152('0x45')](_0x2fdeaa[_0x6152('0x43')],{'$or':_[_0x6152('0x30')](_0x2fdeaa[_0x6152('0x3e')],function(_0x26dd09){var _0x158951={};_0x158951[_0x26dd09]={'$like':'%'+_0x34618d[_0x6152('0x3b')][_0x6152('0x2e')]+'%'};return _0x158951;})});}_0x2fdeaa=_[_0x6152('0x45')]({},_0x2fdeaa,_0x34618d[_0x6152('0x47')]);return _0x2702b4[_0x6152('0x97')](_0x2fdeaa);}})['then'](function(_0x27b0ac){if(_0x27b0ac){_0x152c5c=_0x27b0ac[_0x6152('0x5b')];if(!_0x34618d[_0x6152('0x3b')][_0x6152('0x3f')](_0x6152('0x40'))){_0x2fdeaa[_0x6152('0x21')]=qs[_0x6152('0x21')](_0x34618d[_0x6152('0x3b')][_0x6152('0x21')]);_0x2fdeaa['offset']=qs['offset'](_0x34618d[_0x6152('0x3b')]['offset']);}return _0x2702b4[_0x6152('0x97')](_0x2fdeaa);}})['then'](function(_0x138ba1){if(_0x138ba1){return _0x138ba1?{'count':_0x152c5c,'rows':_0x138ba1}:null;}})['then'](respondWithResult(_0x38a976,null))[_0x6152('0x4d')](handleError(_0x38a976,null));};exports['addLists']=function(_0x993733,_0x4bfa7b,_0x2232d1){var _0x5ed06c,_0x21c175;var _0xa28c12=[];var _0x15527b=moment()[_0x6152('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x6152('0x4a')][_0x6152('0x34')]({'where':{'id':_0x993733[_0x6152('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4bfa7b,null))[_0x6152('0x28')](function(_0x32b19d){if(_0x32b19d){_0x21c175=_0x32b19d;return _0x32b19d[_0x6152('0x99')](_0x993733[_0x6152('0x52')][_0x6152('0x81')],_[_0x6152('0x5e')](_0x993733['body'],[_0x6152('0x81'),'id'])||{});}return null;})[_0x6152('0x92')](function(_0x3326ed){var _0x19a417;var _0x43a5d1;_0x5ed06c=_0x3326ed||[];var _0x318e89=[];if(_0x3326ed){for(var _0x673c59=0x0;_0x673c59<_0x3326ed[_0x6152('0x5b')];_0x673c59+=0x1){var _0x496f11=_0x3326ed[_0x673c59][_0x6152('0x2a')]({'plain':!![]});_0x21c175['dialCheckDuplicateType']=_0x993733[_0x6152('0x52')]['dialCheckDuplicateType']?_0x993733['body'][_0x6152('0x9a')]:_0x21c175[_0x6152('0x9a')];switch(_0x21c175['dialCheckDuplicateType']){case _0x6152('0x9b'):_0x19a417=squel[_0x6152('0x9c')]()['into']('cm_hopper')[_0x6152('0x9d')]([_0x6152('0x9e'),_0x6152('0x9f'),_0x6152('0xa0'),_0x6152('0xa1'),_0x6152('0x64'),'createdAt',_0x6152('0x5d')],squel[_0x6152('0xa2')]()[_0x6152('0x83')](_0x6152('0x9e'),_0x6152('0x9e'))[_0x6152('0x83')](_0x6152('0xa3'),'scheduledAt')['field']('id',_0x6152('0xa0'))['field'](_0x496f11[_0x6152('0xa4')][_0x6152('0x8a')](),_0x6152('0xa1'))[_0x6152('0x83')](_0x993733['params']['id'][_0x6152('0x8a')](),_0x6152('0x64'))['field']('\x27'+_0x15527b+'\x27',_0x6152('0x5c'))[_0x6152('0x83')]('\x27'+_0x15527b+'\x27','updatedAt')[_0x6152('0x84')](_0x6152('0xa5'))['where'](_0x6152('0xa6'))['where'](_0x6152('0xa7'),_0x496f11[_0x6152('0xa4')][_0x6152('0x8a')]())[_0x6152('0x43')](_0x6152('0xa8'))[_0x6152('0x43')](_0x6152('0xa9'),squel[_0x6152('0xa2')]()[_0x6152('0x83')]('COALESCE(calleridnum,\x27\x27)')['from'](_0x6152('0xaa'))['where'](_0x6152('0x88'),_0x993733[_0x6152('0x4f')]['id']['toString']()))[_0x6152('0x43')](_0x6152('0xa9'),squel[_0x6152('0xa2')]()[_0x6152('0x83')](_0x6152('0xab'))[_0x6152('0x84')](_0x6152('0xac'))[_0x6152('0x43')](_0x6152('0x88'),_0x993733[_0x6152('0x4f')]['id'][_0x6152('0x8a')]())))['toString']();break;case _0x6152('0xad'):_0x19a417=squel[_0x6152('0x9c')]()[_0x6152('0xae')](_0x6152('0xac'))[_0x6152('0x9d')]([_0x6152('0x9e'),'scheduledAt',_0x6152('0xa0'),_0x6152('0xa1'),_0x6152('0x64'),_0x6152('0x5c'),_0x6152('0x5d')],squel[_0x6152('0xa2')]()[_0x6152('0x83')](_0x6152('0x9e'),'phone')[_0x6152('0x83')](_0x6152('0xa3'),'scheduledAt')[_0x6152('0x83')]('id','ContactId')[_0x6152('0x83')](_0x496f11[_0x6152('0xa4')][_0x6152('0x8a')](),_0x6152('0xa1'))[_0x6152('0x83')](_0x993733[_0x6152('0x4f')]['id'][_0x6152('0x8a')](),_0x6152('0x64'))[_0x6152('0x83')]('\x27'+_0x15527b+'\x27',_0x6152('0x5c'))['field']('\x27'+_0x15527b+'\x27',_0x6152('0x5d'))[_0x6152('0x84')](_0x6152('0xa5'))[_0x6152('0x43')](_0x6152('0xa6'))[_0x6152('0x43')](_0x6152('0xa7'),_0x496f11['CmListId'][_0x6152('0x8a')]())[_0x6152('0x43')]('phone\x20IS\x20NOT\x20NULL')[_0x6152('0x43')](_0x6152('0xa9'),squel[_0x6152('0xa2')]()['field'](_0x6152('0xab'))['from'](_0x6152('0xac'))['where']('VoiceQueueId\x20=\x20?',_0x993733[_0x6152('0x4f')]['id']['toString']())))[_0x6152('0x8a')]();break;default:_0x19a417=squel[_0x6152('0x9c')]()[_0x6152('0xae')](_0x6152('0xac'))[_0x6152('0x9d')](['phone',_0x6152('0x9f'),_0x6152('0xa0'),_0x6152('0xa1'),_0x6152('0x64'),_0x6152('0x5c'),'updatedAt'],squel[_0x6152('0xa2')]()[_0x6152('0x83')](_0x6152('0x9e'),_0x6152('0x9e'))[_0x6152('0x83')](_0x6152('0xa3'),_0x6152('0x9f'))[_0x6152('0x83')]('id',_0x6152('0xa0'))['field'](_0x496f11['CmListId'][_0x6152('0x8a')](),_0x6152('0xa1'))[_0x6152('0x83')](_0x993733[_0x6152('0x4f')]['id'][_0x6152('0x8a')](),_0x6152('0x64'))[_0x6152('0x83')]('\x27'+_0x15527b+'\x27',_0x6152('0x5c'))[_0x6152('0x83')]('\x27'+_0x15527b+'\x27',_0x6152('0x5d'))['from'](_0x6152('0xa5'))['where']('deletedAt\x20IS\x20NULL')[_0x6152('0x43')](_0x6152('0xa7'),_0x496f11[_0x6152('0xa4')][_0x6152('0x8a')]())[_0x6152('0x43')](_0x6152('0xa8')))['toString']();}_0x43a5d1=squel[_0x6152('0x9c')]()[_0x6152('0xae')](_0x6152('0xaf'))[_0x6152('0x9d')]([_0x6152('0xb0'),'scheduledAt',_0x6152('0x9e'),_0x6152('0xb1'),_0x6152('0x5c'),_0x6152('0x5d')],squel[_0x6152('0xa2')]()[_0x6152('0x83')]('h.id','id')['field']('NOW()','scheduledAt')[_0x6152('0x83')](_0x6152('0xb2'),_0x6152('0x9e'))[_0x6152('0x83')]('ci.OrderBY',_0x6152('0xb1'))[_0x6152('0x83')]('\x27'+_0x15527b+'\x27',_0x6152('0x5c'))['field']('\x27'+_0x15527b+'\x27',_0x6152('0x5d'))[_0x6152('0x84')](_0x6152('0xb3'),'ci')[_0x6152('0x85')]('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')[_0x6152('0x43')](_0x6152('0xb4'),_0x496f11['CmListId']['toString']())[_0x6152('0x43')](_0x6152('0xb5'),_0x993733[_0x6152('0x4f')]['id'][_0x6152('0x8a')]())['where'](_0x6152('0xb6'),_0x15527b))[_0x6152('0x8a')]();_0x318e89[_0x6152('0xb7')](db['sequelize'][_0x6152('0x3b')](_0x19a417));_0xa28c12[_0x6152('0xb7')](db[_0x6152('0x73')][_0x6152('0x3b')](_0x43a5d1));}return BPromise[_0x6152('0x8e')](_0x318e89);}})[_0x6152('0x28')](function(){return BPromise[_0x6152('0x8e')](_0xa28c12);})['then'](function(){return _0x5ed06c;})[_0x6152('0x28')](respondWithResult(_0x4bfa7b,null))[_0x6152('0x4d')](handleError(_0x4bfa7b,null));};exports[_0x6152('0xb8')]=function(_0x36efc3,_0x3748d4,_0x33fe28){return db[_0x6152('0x4a')][_0x6152('0x34')]({'where':{'id':_0x36efc3[_0x6152('0x4f')]['id']}})[_0x6152('0x28')](handleEntityNotFound(_0x3748d4,null))[_0x6152('0x28')](function(_0xff4662){if(_0xff4662){return _0xff4662[_0x6152('0xb8')](_0x36efc3[_0x6152('0x3b')][_0x6152('0x81')]);}})[_0x6152('0x28')](function(_0xc911b2){if(_0xc911b2){return db[_0x6152('0x62')][_0x6152('0x29')]({'where':{'ListId':_0x36efc3[_0x6152('0x3b')]['ids'],'VoiceQueueId':_0x36efc3[_0x6152('0x4f')]['id']}})[_0x6152('0x28')](function(){return _0xc911b2;});}})[_0x6152('0x28')](respondWithStatusCode(_0x3748d4,null))[_0x6152('0x4d')](handleError(_0x3748d4,null));};exports[_0x6152('0xb9')]=function(_0x4237a6,_0x1d12d7,_0x59e7a6){var _0x14560a={};var _0x5e8bd4={};var _0xb65375;var _0x3bacee;return db[_0x6152('0x4a')][_0x6152('0x61')]({'where':{'id':_0x4237a6[_0x6152('0x4f')]['id']}})[_0x6152('0x28')](handleEntityNotFound(_0x1d12d7,null))['then'](function(_0x25af4a){if(_0x25af4a){_0xb65375=_0x25af4a;_0x5e8bd4[_0x6152('0x39')]=_['keys'](db[_0x6152('0x98')][_0x6152('0x5a')]);_0x5e8bd4[_0x6152('0x3b')]=_['keys'](_0x4237a6[_0x6152('0x3b')]);_0x5e8bd4['filters']=_[_0x6152('0x3d')](_0x5e8bd4[_0x6152('0x39')],_0x5e8bd4['query']);_0x14560a[_0x6152('0x3e')]=_['intersection'](_0x5e8bd4[_0x6152('0x39')],qs[_0x6152('0x50')](_0x4237a6[_0x6152('0x3b')][_0x6152('0x50')]));_0x14560a['attributes']=_0x14560a['attributes'][_0x6152('0x5b')]?_0x14560a[_0x6152('0x3e')]:_0x5e8bd4[_0x6152('0x39')];_0x14560a['order']=qs['sort'](_0x4237a6[_0x6152('0x3b')][_0x6152('0x42')]);_0x14560a[_0x6152('0x43')]=qs[_0x6152('0x3c')](_[_0x6152('0x44')](_0x4237a6[_0x6152('0x3b')],_0x5e8bd4['filters']));if(_0x4237a6[_0x6152('0x3b')][_0x6152('0x2e')]){_0x14560a[_0x6152('0x43')]=_[_0x6152('0x45')](_0x14560a['where'],{'$or':_['map'](_0x14560a['attributes'],function(_0x3ad9b9){var _0xf6de90={};_0xf6de90[_0x3ad9b9]={'$like':'%'+_0x4237a6[_0x6152('0x3b')][_0x6152('0x2e')]+'%'};return _0xf6de90;})});}_0x14560a=_[_0x6152('0x45')]({},_0x14560a,_0x4237a6[_0x6152('0x47')]);return _0xb65375[_0x6152('0xb9')](_0x14560a);}})['then'](function(_0x19905a){if(_0x19905a){_0x3bacee=_0x19905a['length'];if(!_0x4237a6[_0x6152('0x3b')][_0x6152('0x3f')](_0x6152('0x40'))){_0x14560a[_0x6152('0x21')]=qs[_0x6152('0x21')](_0x4237a6[_0x6152('0x3b')]['limit']);_0x14560a['offset']=qs[_0x6152('0x1f')](_0x4237a6[_0x6152('0x3b')][_0x6152('0x1f')]);}return _0xb65375['getBlackLists'](_0x14560a);}})[_0x6152('0x28')](function(_0x31c0c4){if(_0x31c0c4){return _0x31c0c4?{'count':_0x3bacee,'rows':_0x31c0c4}:null;}})[_0x6152('0x28')](respondWithResult(_0x1d12d7,null))[_0x6152('0x4d')](handleError(_0x1d12d7,null));};exports[_0x6152('0xba')]=function(_0x1f1040,_0x37832d,_0x1151da){var _0x5985a8,_0x5be45d;var _0x1c638a=[];var _0x2fa651=moment()[_0x6152('0x7c')](_0x6152('0xbb'));return db[_0x6152('0x4a')][_0x6152('0x34')]({'where':{'id':_0x1f1040[_0x6152('0x4f')]['id']}})[_0x6152('0x28')](handleEntityNotFound(_0x37832d,null))[_0x6152('0x28')](function(_0x1f4904){if(_0x1f4904){_0x5be45d=_0x1f4904;return _0x1f4904[_0x6152('0xba')](_0x1f1040[_0x6152('0x52')][_0x6152('0x81')],_['omit'](_0x1f1040['body'],[_0x6152('0x81'),'id'])||{});}return null;})[_0x6152('0x92')](function(_0x4555b6){var _0xec4be4;var _0xc5fb09;_0x5985a8=_0x4555b6||[];var _0x127164=[];if(_0x4555b6){for(var _0x53bb08=0x0;_0x53bb08<_0x4555b6[_0x6152('0x5b')];_0x53bb08+=0x1){var _0x84314d=_0x4555b6[_0x53bb08][_0x6152('0x2a')]({'plain':!![]});_0xec4be4=squel[_0x6152('0x9c')]()[_0x6152('0xae')](_0x6152('0xbc'))[_0x6152('0x9d')](['phone',_0x6152('0xa0'),'ListId',_0x6152('0x64'),_0x6152('0x5c'),'updatedAt'],squel[_0x6152('0xa2')]()[_0x6152('0x83')]('phone',_0x6152('0x9e'))[_0x6152('0x83')]('id',_0x6152('0xa0'))[_0x6152('0x83')](_0x84314d[_0x6152('0xa4')][_0x6152('0x8a')](),_0x6152('0xa1'))[_0x6152('0x83')](_0x1f1040[_0x6152('0x4f')]['id'][_0x6152('0x8a')](),_0x6152('0x64'))[_0x6152('0x83')](_0x6152('0xa3'),'createdAt')[_0x6152('0x83')](_0x6152('0xa3'),'updatedAt')[_0x6152('0x84')](_0x6152('0xa5'))[_0x6152('0x43')](_0x6152('0xa6'))[_0x6152('0x43')](_0x6152('0xa7'),_0x84314d[_0x6152('0xa4')][_0x6152('0x8a')]())[_0x6152('0x43')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x127164[_0x6152('0xb7')](db['sequelize'][_0x6152('0x3b')](_0xec4be4));}return BPromise[_0x6152('0x8e')](_0x127164);}})[_0x6152('0x28')](function(){return _0x5985a8;})[_0x6152('0x28')](respondWithResult(_0x37832d,null))[_0x6152('0x4d')](handleError(_0x37832d,null));};exports['removeBlackLists']=function(_0x3fde3d,_0x4bce97,_0x13453e){return db[_0x6152('0x4a')][_0x6152('0x34')]({'where':{'id':_0x3fde3d['params']['id']}})[_0x6152('0x28')](handleEntityNotFound(_0x4bce97,null))['then'](function(_0x4db5a7){if(_0x4db5a7){return _0x4db5a7['removeBlackLists'](_0x3fde3d[_0x6152('0x3b')][_0x6152('0x81')]);}})['then'](function(_0x1a6c66){if(_0x1a6c66){return db[_0x6152('0x69')][_0x6152('0x29')]({'where':{'ListId':_0x3fde3d[_0x6152('0x3b')]['ids'],'VoiceQueueId':_0x3fde3d[_0x6152('0x4f')]['id']}})[_0x6152('0x28')](function(){return _0x1a6c66;});}})[_0x6152('0x28')](respondWithStatusCode(_0x4bce97,null))[_0x6152('0x4d')](handleError(_0x4bce97,null));}; \ No newline at end of file +var _0xf9e6=['CmListId','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','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper_additional_phones','OrderBy','h.id','ci.item','h.ContactId\x20=\x20ci.CmContactId','h.VoiceQueueId=?','h.createdAt\x20=\x20?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','then','get','VoiceQueues','outbound','filter','value','includes','type','find','destroy','end','name','send','index','VoiceQueue','fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','merge','map','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','length','catch','create','body','user','role','inbound','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','QueueCampaigns','userProfileId','UserProfileResource','getHoppers','findOne','CmHopper','pick','include','hasOwnProperty','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','Team','getTeams','addTeams','User','Agents','online','voicePause','flatMap','forEach','penalty','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','interface','emit','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','union','compact','ids','removeAgents','userVoiceQueue:remove','addAgents','spread','isEmpty','all','isArray','getAgents','getMembers','getLists','CmList','YYYY-MM-DD\x20HH:mm:ss','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','NOW()','scheduledAt'];(function(_0x281d6b,_0xcdc3cf){var _0x5942ed=function(_0xdd98e6){while(--_0xdd98e6){_0x281d6b['push'](_0x281d6b['shift']());}};_0x5942ed(++_0xcdc3cf);}(_0xf9e6,0xd5));var _0x6f9e=function(_0x22ba58,_0x5ef46b){_0x22ba58=_0x22ba58-0x0;var _0x2948c1=_0xf9e6[_0x22ba58];return _0x2948c1;};'use strict';var emlformat=require(_0x6f9e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6f9e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f9e('0x2'));var moment=require(_0x6f9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6f9e('0x4'));var util=require(_0x6f9e('0x5'));var path=require(_0x6f9e('0x6'));var sox=require(_0x6f9e('0x7'));var csv=require(_0x6f9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6f9e('0x9'));var _=require(_0x6f9e('0xa'));var squel=require('squel');var crypto=require(_0x6f9e('0xb'));var jsforce=require(_0x6f9e('0xc'));var deskjs=require(_0x6f9e('0xd'));var toCsv=require(_0x6f9e('0x8'));var querystring=require(_0x6f9e('0xe'));var Papa=require(_0x6f9e('0xf'));var Redis=require(_0x6f9e('0x10'));var authService=require(_0x6f9e('0x11'));var qs=require(_0x6f9e('0x12'));var as=require(_0x6f9e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f9e('0x14'))(_0x6f9e('0x15'));var utils=require(_0x6f9e('0x16'));var config=require(_0x6f9e('0x17'));var licenseUtil=require(_0x6f9e('0x18'));var db=require('../../mysqldb')['db'];config[_0x6f9e('0x19')]=_['defaults'](config[_0x6f9e('0x19')],{'host':_0x6f9e('0x1a'),'port':0x18eb});var socket=require(_0x6f9e('0x1b'))(new Redis(config[_0x6f9e('0x19')]));require(_0x6f9e('0x1c'))['register'](socket);function respondWithStatusCode(_0x14f751,_0x5c76b8){_0x5c76b8=_0x5c76b8||0xcc;return function(_0x2db44){if(_0x2db44){return _0x14f751[_0x6f9e('0x1d')](_0x5c76b8);}return _0x14f751[_0x6f9e('0x1e')](_0x5c76b8)['end']();};}function respondWithResult(_0x53c9d7,_0x2fb9ef){_0x2fb9ef=_0x2fb9ef||0xc8;return function(_0x1c5a16){if(_0x1c5a16){return _0x53c9d7[_0x6f9e('0x1e')](_0x2fb9ef)[_0x6f9e('0x1f')](_0x1c5a16);}};}function respondWithFilteredResult(_0xfff24f,_0x5d65a9){return function(_0x517d19){if(_0x517d19){var _0xf436d8=typeof _0x5d65a9[_0x6f9e('0x20')]===_0x6f9e('0x21')&&typeof _0x5d65a9[_0x6f9e('0x22')]===_0x6f9e('0x21');var _0x2b99c0=_0x517d19[_0x6f9e('0x23')];var _0xd62f6c=_0xf436d8?0x0:_0x5d65a9[_0x6f9e('0x20')];var _0x2de566=_0xf436d8?_0x517d19[_0x6f9e('0x23')]:_0x5d65a9[_0x6f9e('0x20')]+_0x5d65a9[_0x6f9e('0x22')];var _0x364e21;if(_0x2de566>=_0x2b99c0){_0x2de566=_0x2b99c0;_0x364e21=0xc8;}else{_0x364e21=0xce;}_0xfff24f[_0x6f9e('0x1e')](_0x364e21);return _0xfff24f['set'](_0x6f9e('0x24'),_0xd62f6c+'-'+_0x2de566+'/'+_0x2b99c0)[_0x6f9e('0x1f')](_0x517d19);}return null;};}function patchUpdates(_0x21d2a8){return function(_0x4b5a16){try{jsonpatch[_0x6f9e('0x25')](_0x4b5a16,_0x21d2a8,!![]);}catch(_0x2ea6d2){return BPromise['reject'](_0x2ea6d2);}return _0x4b5a16['save']();};}function saveUpdates(_0x3237e3,_0x1e058e){return function(_0x146afe){if(_0x146afe){return _0x146afe['update'](_0x3237e3)[_0x6f9e('0x26')](function(_0x1de350){return _0x1de350;});}return null;};}function removeEntity(_0x2c190d,_0x2612a1){return function(_0x46737d){if(_0x46737d){return _0x46737d['destroy']()['then'](function(){var _0x12fc37=_0x46737d[_0x6f9e('0x27')]({'plain':!![]});var _0x7be87e=[{'name':_0x6f9e('0x28'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0x6f9e('0x29'),'ignore':![]}];var _0x18974e=_(_0x7be87e)[_0x6f9e('0x2a')]('ignore')['map'](_0x6f9e('0x2b'))[_0x6f9e('0x2b')]();if(_[_0x6f9e('0x2c')](_0x18974e,_0x12fc37[_0x6f9e('0x2d')])){return;}var _0x5819d5=_[_0x6f9e('0x2e')](_0x7be87e,[_0x6f9e('0x2b'),_0x12fc37['type']])['name'];return db['UserProfileResource'][_0x6f9e('0x2f')]({'where':{'type':_0x5819d5,'resourceId':_0x12fc37['id']}})[_0x6f9e('0x26')](function(){return _0x46737d;});})[_0x6f9e('0x26')](function(){_0x2c190d[_0x6f9e('0x1e')](0xcc)[_0x6f9e('0x30')]();});}};}function handleEntityNotFound(_0x47da06,_0x19014b){return function(_0x5dbaae){if(!_0x5dbaae){_0x47da06['sendStatus'](0x194);}return _0x5dbaae;};}function handleError(_0x1cb1cc,_0x41f0e6){_0x41f0e6=_0x41f0e6||0x1f4;return function(_0x1c08a3){logger['error'](_0x1c08a3['stack']);if(_0x1c08a3[_0x6f9e('0x31')]){delete _0x1c08a3[_0x6f9e('0x31')];}_0x1cb1cc['status'](_0x41f0e6)[_0x6f9e('0x32')](_0x1c08a3);};}exports[_0x6f9e('0x33')]=function(_0x2977a6,_0x2d7def){var _0x449a3b={},_0x54f62a={},_0xc79e93={'count':0x0,'rows':[]};var _0x35e81c=_['map'](db[_0x6f9e('0x34')]['rawAttributes'],function(_0x4c83a9){return{'name':_0x4c83a9[_0x6f9e('0x35')],'type':_0x4c83a9[_0x6f9e('0x2d')][_0x6f9e('0x36')]};});_0x54f62a[_0x6f9e('0x37')]=_['map'](_0x35e81c,_0x6f9e('0x31'));_0x54f62a[_0x6f9e('0x38')]=_[_0x6f9e('0x39')](_0x2977a6[_0x6f9e('0x38')]);_0x54f62a[_0x6f9e('0x3a')]=_[_0x6f9e('0x3b')](_0x54f62a[_0x6f9e('0x37')],_0x54f62a[_0x6f9e('0x38')]);_0x449a3b['attributes']=_[_0x6f9e('0x3b')](_0x54f62a[_0x6f9e('0x37')],qs['fields'](_0x2977a6[_0x6f9e('0x38')][_0x6f9e('0x3c')]));_0x449a3b[_0x6f9e('0x3d')]=_0x449a3b[_0x6f9e('0x3d')]['length']?_0x449a3b[_0x6f9e('0x3d')]:_0x54f62a[_0x6f9e('0x37')];if(!_0x2977a6[_0x6f9e('0x38')]['hasOwnProperty'](_0x6f9e('0x3e'))){_0x449a3b[_0x6f9e('0x22')]=qs[_0x6f9e('0x22')](_0x2977a6[_0x6f9e('0x38')]['limit']);_0x449a3b[_0x6f9e('0x20')]=qs[_0x6f9e('0x20')](_0x2977a6['query'][_0x6f9e('0x20')]);}_0x449a3b[_0x6f9e('0x3f')]=qs[_0x6f9e('0x40')](_0x2977a6[_0x6f9e('0x38')][_0x6f9e('0x40')]);_0x449a3b[_0x6f9e('0x41')]=qs['filters'](_['pick'](_0x2977a6[_0x6f9e('0x38')],_0x54f62a['filters']),_0x35e81c);if(_0x2977a6[_0x6f9e('0x38')]['filter']){_0x449a3b[_0x6f9e('0x41')]=_[_0x6f9e('0x42')](_0x449a3b[_0x6f9e('0x41')],{'$or':_[_0x6f9e('0x43')](_0x35e81c,function(_0x1744ea){if(_0x1744ea['type']!==_0x6f9e('0x44')){var _0x1a5a37={};_0x1a5a37[_0x1744ea[_0x6f9e('0x31')]]={'$like':'%'+_0x2977a6['query'][_0x6f9e('0x2a')]+'%'};return _0x1a5a37;}})});}_0x449a3b=_[_0x6f9e('0x42')]({},_0x449a3b,_0x2977a6[_0x6f9e('0x45')]);var _0x5c0d88={'where':_0x449a3b[_0x6f9e('0x41')]};return db['VoiceQueue'][_0x6f9e('0x23')](_0x5c0d88)['then'](function(_0x24692d){_0xc79e93['count']=_0x24692d;if(_0x2977a6[_0x6f9e('0x38')][_0x6f9e('0x46')]){_0x449a3b['include']=[{'all':!![]}];}return db[_0x6f9e('0x34')][_0x6f9e('0x47')](_0x449a3b);})['then'](function(_0x781777){_0xc79e93[_0x6f9e('0x48')]=_0x781777;return _0xc79e93;})['then'](respondWithFilteredResult(_0x2d7def,_0x449a3b))['catch'](handleError(_0x2d7def,null));};exports[_0x6f9e('0x49')]=function(_0x48b0af,_0xb978c){var _0x2b193d={'raw':![],'where':{'id':_0x48b0af[_0x6f9e('0x4a')]['id']}},_0x160c5f={};_0x160c5f[_0x6f9e('0x37')]=_[_0x6f9e('0x39')](db['VoiceQueue'][_0x6f9e('0x4b')]);_0x160c5f[_0x6f9e('0x38')]=_[_0x6f9e('0x39')](_0x48b0af[_0x6f9e('0x38')]);_0x160c5f[_0x6f9e('0x3a')]=_[_0x6f9e('0x3b')](_0x160c5f['model'],_0x160c5f[_0x6f9e('0x38')]);_0x2b193d[_0x6f9e('0x3d')]=_['intersection'](_0x160c5f[_0x6f9e('0x37')],qs[_0x6f9e('0x3c')](_0x48b0af[_0x6f9e('0x38')][_0x6f9e('0x3c')]));_0x2b193d[_0x6f9e('0x3d')]=_0x2b193d['attributes'][_0x6f9e('0x4c')]?_0x2b193d[_0x6f9e('0x3d')]:_0x160c5f[_0x6f9e('0x37')];if(_0x48b0af[_0x6f9e('0x38')]['includeAll']){_0x2b193d['include']=[{'all':!![]}];}_0x2b193d=_[_0x6f9e('0x42')]({},_0x2b193d,_0x48b0af['options']);return db['VoiceQueue'][_0x6f9e('0x2e')](_0x2b193d)[_0x6f9e('0x26')](handleEntityNotFound(_0xb978c,null))[_0x6f9e('0x26')](respondWithResult(_0xb978c,null))[_0x6f9e('0x4d')](handleError(_0xb978c,null));};exports[_0x6f9e('0x4e')]=function(_0x3d2aba,_0x754561){return db[_0x6f9e('0x34')][_0x6f9e('0x4e')](_0x3d2aba[_0x6f9e('0x4f')],{})['then'](function(_0x40a690){var _0x25c9a0=_0x3d2aba[_0x6f9e('0x50')]['get']({'plain':!![]});if(!_0x25c9a0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25c9a0[_0x6f9e('0x51')]==='user'){var _0x402fee=_0x40a690[_0x6f9e('0x27')]({'plain':!![]});var _0x20cf44=[{'name':_0x6f9e('0x28'),'value':_0x6f9e('0x52')},{'name':'QueueCampaigns','value':'outbound'}];var _0x298041=_['find'](_0x20cf44,['value',_0x402fee['type']])[_0x6f9e('0x31')];return db[_0x6f9e('0x53')]['find']({'where':{'name':_0x298041,'userProfileId':_0x25c9a0['userProfileId']},'raw':!![]})['then'](function(_0xe69bac){if(_0xe69bac&&_0xe69bac[_0x6f9e('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x402fee[_0x6f9e('0x31')],'resourceId':_0x402fee['id'],'type':_0xe69bac[_0x6f9e('0x31')],'sectionId':_0xe69bac['id']},{})['then'](function(){return _0x40a690;});}else{return _0x40a690;}})[_0x6f9e('0x4d')](function(_0x1d140c){logger[_0x6f9e('0x55')](_0x6f9e('0x56'),_0x1d140c);throw _0x1d140c;});}return _0x40a690;})[_0x6f9e('0x26')](respondWithResult(_0x754561,0xc9))[_0x6f9e('0x4d')](handleError(_0x754561,null));};exports[_0x6f9e('0x57')]=function(_0x530d4e,_0x2ea2f2){var _0x2a12f1={'where':{'id':_0x530d4e[_0x6f9e('0x4a')]['id']}},_0x6fdb83={};_0x6fdb83[_0x6f9e('0x37')]=_[_0x6f9e('0x39')](db[_0x6f9e('0x34')][_0x6f9e('0x4b')]);_0x2a12f1[_0x6f9e('0x3d')]=_[_0x6f9e('0x3b')](_0x6fdb83[_0x6f9e('0x37')],qs['fields'](_0x530d4e[_0x6f9e('0x38')]['fields']));_0x2a12f1[_0x6f9e('0x3d')]=_0x2a12f1[_0x6f9e('0x3d')][_0x6f9e('0x4c')]?_0x2a12f1['attributes']:_0x6fdb83['model'];if(_0x530d4e[_0x6f9e('0x38')][_0x6f9e('0x46')]){_0x2a12f1['include']=[{'all':!![]}];}_0x2a12f1=_[_0x6f9e('0x42')]({},_0x2a12f1,_0x530d4e['options']);return db[_0x6f9e('0x34')]['find'](_0x2a12f1)[_0x6f9e('0x26')](handleEntityNotFound(_0x2ea2f2,null))[_0x6f9e('0x26')](function(_0x27764a){if(_0x27764a){var _0x7cdd33=_0x27764a[_0x6f9e('0x27')]({'plain':!![]});_0x7cdd33=qs['omit'](_0x7cdd33,['id',_0x6f9e('0x58'),_0x6f9e('0x59')]);_0x530d4e['body']=_[_0x6f9e('0x5a')](_0x530d4e['body'],['id',_0x6f9e('0x58'),'updatedAt']);return db[_0x6f9e('0x34')][_0x6f9e('0x4e')](_[_0x6f9e('0x42')](_0x7cdd33,_0x530d4e['body']),{'include':_0x530d4e[_0x6f9e('0x38')][_0x6f9e('0x46')]?[{'all':!![]}]:undefined})[_0x6f9e('0x26')](function(_0x4d327c){var _0x4d757f=_0x530d4e['user'][_0x6f9e('0x27')]({'plain':!![]});if(!_0x4d757f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d757f[_0x6f9e('0x51')]==='user'){var _0x18f369=_0x4d327c[_0x6f9e('0x27')]({'plain':!![]});var _0x51537a=[{'name':_0x6f9e('0x28'),'value':_0x6f9e('0x52')},{'name':_0x6f9e('0x5b'),'value':_0x6f9e('0x29')}];var _0x35092c=_['find'](_0x51537a,['value',_0x18f369[_0x6f9e('0x2d')]])[_0x6f9e('0x31')];return db['UserProfileSection'][_0x6f9e('0x2e')]({'where':{'name':_0x35092c,'userProfileId':_0x4d757f[_0x6f9e('0x5c')]},'raw':!![]})[_0x6f9e('0x26')](function(_0x7322ba){if(_0x7322ba&&_0x7322ba[_0x6f9e('0x54')]===0x0){return db[_0x6f9e('0x5d')][_0x6f9e('0x4e')]({'name':_0x18f369['name'],'resourceId':_0x18f369['id'],'type':_0x7322ba['name'],'sectionId':_0x7322ba['id']},{})[_0x6f9e('0x26')](function(){return _0x4d327c;});}else{return _0x4d327c;}})[_0x6f9e('0x4d')](function(_0x53e4fa){logger[_0x6f9e('0x55')](_0x6f9e('0x56'),_0x53e4fa);throw _0x53e4fa;});}return _0x4d327c;});}})[_0x6f9e('0x26')](respondWithResult(_0x2ea2f2,0xc9))[_0x6f9e('0x4d')](handleError(_0x2ea2f2,null));};exports['update']=function(_0x4f9872,_0x5c2c16){if(_0x4f9872[_0x6f9e('0x4f')]['id']){delete _0x4f9872[_0x6f9e('0x4f')]['id'];}return db['VoiceQueue'][_0x6f9e('0x2e')]({'where':{'id':_0x4f9872[_0x6f9e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5c2c16,null))['then'](saveUpdates(_0x4f9872[_0x6f9e('0x4f')],null))[_0x6f9e('0x26')](respondWithResult(_0x5c2c16,null))[_0x6f9e('0x4d')](handleError(_0x5c2c16,null));};exports[_0x6f9e('0x2f')]=function(_0x34f3f6,_0x418526){return db[_0x6f9e('0x34')]['find']({'where':{'id':_0x34f3f6[_0x6f9e('0x4a')]['id']}})[_0x6f9e('0x26')](handleEntityNotFound(_0x418526,null))[_0x6f9e('0x26')](removeEntity(_0x418526,null))[_0x6f9e('0x4d')](handleError(_0x418526,null));};exports[_0x6f9e('0x5e')]=function(_0x1c0772,_0x113893,_0x5ac089){var _0x4a4f37={'raw':![],'where':{}};var _0x3532fb={};var _0x18e672={'count':0x0,'rows':[]};return db[_0x6f9e('0x34')][_0x6f9e('0x5f')]({'where':{'id':_0x1c0772[_0x6f9e('0x4a')]['id']}})[_0x6f9e('0x26')](handleEntityNotFound(_0x113893,null))[_0x6f9e('0x26')](function(_0x340744){if(_0x340744){_0x3532fb[_0x6f9e('0x37')]=_[_0x6f9e('0x39')](db[_0x6f9e('0x60')]['rawAttributes']);_0x3532fb['query']=_[_0x6f9e('0x39')](_0x1c0772[_0x6f9e('0x38')]);_0x3532fb[_0x6f9e('0x3a')]=_[_0x6f9e('0x3b')](_0x3532fb['model'],_0x3532fb[_0x6f9e('0x38')]);_0x4a4f37['attributes']=_[_0x6f9e('0x3b')](_0x3532fb[_0x6f9e('0x37')],qs['fields'](_0x1c0772[_0x6f9e('0x38')][_0x6f9e('0x3c')]));_0x4a4f37[_0x6f9e('0x3d')]=_0x4a4f37[_0x6f9e('0x3d')][_0x6f9e('0x4c')]?_0x4a4f37[_0x6f9e('0x3d')]:_0x3532fb[_0x6f9e('0x37')];if(!_0x1c0772['query']['hasOwnProperty'](_0x6f9e('0x3e'))){_0x4a4f37[_0x6f9e('0x22')]=qs[_0x6f9e('0x22')](_0x1c0772[_0x6f9e('0x38')][_0x6f9e('0x22')]);_0x4a4f37['offset']=qs[_0x6f9e('0x20')](_0x1c0772[_0x6f9e('0x38')]['offset']);}_0x4a4f37[_0x6f9e('0x3f')]=qs[_0x6f9e('0x40')](_0x1c0772['query'][_0x6f9e('0x40')]);_0x4a4f37[_0x6f9e('0x41')]=qs[_0x6f9e('0x3a')](_[_0x6f9e('0x61')](_0x1c0772[_0x6f9e('0x38')],_0x3532fb[_0x6f9e('0x3a')]));_0x4a4f37[_0x6f9e('0x41')]['VoiceQueueId']=_0x340744['id'];if(_0x1c0772[_0x6f9e('0x38')][_0x6f9e('0x2a')]){_0x4a4f37[_0x6f9e('0x41')]=_[_0x6f9e('0x42')](_0x4a4f37['where'],{'$or':_[_0x6f9e('0x43')](_0x4a4f37[_0x6f9e('0x3d')],function(_0x551a62){var _0x3280d1={};_0x3280d1[_0x551a62]={'$like':'%'+_0x1c0772[_0x6f9e('0x38')][_0x6f9e('0x2a')]+'%'};return _0x3280d1;})});}_0x4a4f37=_[_0x6f9e('0x42')]({},_0x4a4f37,_0x1c0772['options']);return db[_0x6f9e('0x60')][_0x6f9e('0x23')]({'where':_0x4a4f37[_0x6f9e('0x41')]})['then'](function(_0x3e3c22){_0x18e672[_0x6f9e('0x23')]=_0x3e3c22;if(_0x1c0772['query'][_0x6f9e('0x46')]){_0x4a4f37[_0x6f9e('0x62')]=[{'all':!![]}];}return db['CmHopper'][_0x6f9e('0x47')](_0x4a4f37);})[_0x6f9e('0x26')](function(_0x8b11e6){_0x18e672[_0x6f9e('0x48')]=_0x8b11e6;return _0x18e672;});}})[_0x6f9e('0x26')](respondWithFilteredResult(_0x113893,_0x4a4f37))[_0x6f9e('0x4d')](handleError(_0x113893,null));};exports['getHopperHistories']=function(_0x402cfd,_0x27f166,_0xbd7b79){var _0xcde894={'raw':!![],'where':{}};var _0x3348ab={};var _0x31109a={'count':0x0,'rows':[]};return db[_0x6f9e('0x34')][_0x6f9e('0x5f')]({'where':{'id':_0x402cfd[_0x6f9e('0x4a')]['id']}})[_0x6f9e('0x26')](handleEntityNotFound(_0x27f166,null))['then'](function(_0x40cb68){if(_0x40cb68){_0x3348ab['model']=_[_0x6f9e('0x39')](db['CmHopperHistory'][_0x6f9e('0x4b')]);_0x3348ab['query']=_[_0x6f9e('0x39')](_0x402cfd[_0x6f9e('0x38')]);_0x3348ab['filters']=_['intersection'](_0x3348ab['model'],_0x3348ab[_0x6f9e('0x38')]);_0xcde894['attributes']=_[_0x6f9e('0x3b')](_0x3348ab[_0x6f9e('0x37')],qs[_0x6f9e('0x3c')](_0x402cfd[_0x6f9e('0x38')]['fields']));_0xcde894[_0x6f9e('0x3d')]=_0xcde894[_0x6f9e('0x3d')]['length']?_0xcde894[_0x6f9e('0x3d')]:_0x3348ab[_0x6f9e('0x37')];if(!_0x402cfd['query'][_0x6f9e('0x63')](_0x6f9e('0x3e'))){_0xcde894['limit']=qs[_0x6f9e('0x22')](_0x402cfd['query'][_0x6f9e('0x22')]);_0xcde894[_0x6f9e('0x20')]=qs[_0x6f9e('0x20')](_0x402cfd[_0x6f9e('0x38')][_0x6f9e('0x20')]);}_0xcde894[_0x6f9e('0x3f')]=qs[_0x6f9e('0x40')](_0x402cfd[_0x6f9e('0x38')][_0x6f9e('0x40')]);_0xcde894[_0x6f9e('0x41')]=qs[_0x6f9e('0x3a')](_[_0x6f9e('0x61')](_0x402cfd[_0x6f9e('0x38')],_0x3348ab['filters']));_0xcde894['where'][_0x6f9e('0x64')]=_0x40cb68['id'];if(_0x402cfd[_0x6f9e('0x38')][_0x6f9e('0x2a')]){_0xcde894[_0x6f9e('0x41')]=_[_0x6f9e('0x42')](_0xcde894[_0x6f9e('0x41')],{'$or':_[_0x6f9e('0x43')](_0xcde894[_0x6f9e('0x3d')],function(_0x46d981){var _0x202029={};_0x202029[_0x46d981]={'$like':'%'+_0x402cfd[_0x6f9e('0x38')][_0x6f9e('0x2a')]+'%'};return _0x202029;})});}_0xcde894=_[_0x6f9e('0x42')]({},_0xcde894,_0x402cfd['options']);return db[_0x6f9e('0x65')][_0x6f9e('0x23')]({'where':_0xcde894['where']})['then'](function(_0x54493c){_0x31109a[_0x6f9e('0x23')]=_0x54493c;if(_0x402cfd['query'][_0x6f9e('0x46')]){_0xcde894['include']=[{'all':!![]}];}return db[_0x6f9e('0x65')][_0x6f9e('0x47')](_0xcde894);})[_0x6f9e('0x26')](function(_0x211938){_0x31109a[_0x6f9e('0x48')]=_0x211938;return _0x31109a;});}})[_0x6f9e('0x26')](respondWithFilteredResult(_0x27f166,_0xcde894))['catch'](handleError(_0x27f166,null));};exports[_0x6f9e('0x66')]=function(_0x3d920a,_0x107d00,_0xeceb9a){var _0xed1a9d={'raw':!![],'where':{}};var _0x9f6f6a={};var _0x4f9a0f={'count':0x0,'rows':[]};return db[_0x6f9e('0x34')][_0x6f9e('0x5f')]({'where':{'id':_0x3d920a[_0x6f9e('0x4a')]['id']}})[_0x6f9e('0x26')](handleEntityNotFound(_0x107d00,null))[_0x6f9e('0x26')](function(_0x2b3250){if(_0x2b3250){_0x9f6f6a[_0x6f9e('0x37')]=_[_0x6f9e('0x39')](db[_0x6f9e('0x67')]['rawAttributes']);_0x9f6f6a[_0x6f9e('0x38')]=_[_0x6f9e('0x39')](_0x3d920a[_0x6f9e('0x38')]);_0x9f6f6a[_0x6f9e('0x3a')]=_[_0x6f9e('0x3b')](_0x9f6f6a[_0x6f9e('0x37')],_0x9f6f6a[_0x6f9e('0x38')]);_0xed1a9d[_0x6f9e('0x3d')]=_[_0x6f9e('0x3b')](_0x9f6f6a[_0x6f9e('0x37')],qs[_0x6f9e('0x3c')](_0x3d920a[_0x6f9e('0x38')]['fields']));_0xed1a9d[_0x6f9e('0x3d')]=_0xed1a9d['attributes'][_0x6f9e('0x4c')]?_0xed1a9d[_0x6f9e('0x3d')]:_0x9f6f6a['model'];if(!_0x3d920a[_0x6f9e('0x38')]['hasOwnProperty'](_0x6f9e('0x3e'))){_0xed1a9d[_0x6f9e('0x22')]=qs[_0x6f9e('0x22')](_0x3d920a[_0x6f9e('0x38')][_0x6f9e('0x22')]);_0xed1a9d[_0x6f9e('0x20')]=qs[_0x6f9e('0x20')](_0x3d920a[_0x6f9e('0x38')][_0x6f9e('0x20')]);}_0xed1a9d[_0x6f9e('0x3f')]=qs[_0x6f9e('0x40')](_0x3d920a['query']['sort']);_0xed1a9d[_0x6f9e('0x41')]=qs[_0x6f9e('0x3a')](_[_0x6f9e('0x61')](_0x3d920a[_0x6f9e('0x38')],_0x9f6f6a['filters']));_0xed1a9d[_0x6f9e('0x41')][_0x6f9e('0x64')]=_0x2b3250['id'];if(_0x3d920a[_0x6f9e('0x38')][_0x6f9e('0x2a')]){_0xed1a9d[_0x6f9e('0x41')]=_[_0x6f9e('0x42')](_0xed1a9d[_0x6f9e('0x41')],{'$or':_[_0x6f9e('0x43')](_0xed1a9d[_0x6f9e('0x3d')],function(_0x1cc3f0){var _0x5ba264={};_0x5ba264[_0x1cc3f0]={'$like':'%'+_0x3d920a[_0x6f9e('0x38')][_0x6f9e('0x2a')]+'%'};return _0x5ba264;})});}_0xed1a9d=_['merge']({},_0xed1a9d,_0x3d920a[_0x6f9e('0x45')]);return db[_0x6f9e('0x67')][_0x6f9e('0x23')]({'where':_0xed1a9d['where']})[_0x6f9e('0x26')](function(_0x2131f8){_0x4f9a0f[_0x6f9e('0x23')]=_0x2131f8;if(_0x3d920a[_0x6f9e('0x38')][_0x6f9e('0x46')]){_0xed1a9d[_0x6f9e('0x62')]=[{'all':!![]}];}return db[_0x6f9e('0x67')][_0x6f9e('0x47')](_0xed1a9d);})[_0x6f9e('0x26')](function(_0x58ac9b){_0x4f9a0f[_0x6f9e('0x48')]=_0x58ac9b;return _0x4f9a0f;});}})[_0x6f9e('0x26')](respondWithFilteredResult(_0x107d00,_0xed1a9d))[_0x6f9e('0x4d')](handleError(_0x107d00,null));};exports['getHopperBlacks']=function(_0x54df08,_0x25ed33,_0x4e0ebe){var _0x55aa39={'raw':!![],'where':{}};var _0x296e51={};var _0xa22bf3={'count':0x0,'rows':[]};return db[_0x6f9e('0x34')][_0x6f9e('0x5f')]({'where':{'id':_0x54df08[_0x6f9e('0x4a')]['id']}})[_0x6f9e('0x26')](handleEntityNotFound(_0x25ed33,null))[_0x6f9e('0x26')](function(_0x18272){if(_0x18272){_0x296e51[_0x6f9e('0x37')]=_[_0x6f9e('0x39')](db['CmHopperBlack'][_0x6f9e('0x4b')]);_0x296e51[_0x6f9e('0x38')]=_[_0x6f9e('0x39')](_0x54df08[_0x6f9e('0x38')]);_0x296e51[_0x6f9e('0x3a')]=_[_0x6f9e('0x3b')](_0x296e51[_0x6f9e('0x37')],_0x296e51['query']);_0x55aa39[_0x6f9e('0x3d')]=_[_0x6f9e('0x3b')](_0x296e51['model'],qs[_0x6f9e('0x3c')](_0x54df08[_0x6f9e('0x38')][_0x6f9e('0x3c')]));_0x55aa39[_0x6f9e('0x3d')]=_0x55aa39[_0x6f9e('0x3d')][_0x6f9e('0x4c')]?_0x55aa39[_0x6f9e('0x3d')]:_0x296e51[_0x6f9e('0x37')];if(!_0x54df08[_0x6f9e('0x38')][_0x6f9e('0x63')](_0x6f9e('0x3e'))){_0x55aa39[_0x6f9e('0x22')]=qs[_0x6f9e('0x22')](_0x54df08[_0x6f9e('0x38')][_0x6f9e('0x22')]);_0x55aa39[_0x6f9e('0x20')]=qs[_0x6f9e('0x20')](_0x54df08[_0x6f9e('0x38')][_0x6f9e('0x20')]);}_0x55aa39['order']=qs[_0x6f9e('0x40')](_0x54df08[_0x6f9e('0x38')][_0x6f9e('0x40')]);_0x55aa39[_0x6f9e('0x41')]=qs[_0x6f9e('0x3a')](_[_0x6f9e('0x61')](_0x54df08[_0x6f9e('0x38')],_0x296e51[_0x6f9e('0x3a')]));_0x55aa39[_0x6f9e('0x41')][_0x6f9e('0x64')]=_0x18272['id'];if(_0x54df08[_0x6f9e('0x38')][_0x6f9e('0x2a')]){_0x55aa39[_0x6f9e('0x41')]=_[_0x6f9e('0x42')](_0x55aa39[_0x6f9e('0x41')],{'$or':_[_0x6f9e('0x43')](_0x55aa39[_0x6f9e('0x3d')],function(_0x530b95){var _0x4b67e6={};_0x4b67e6[_0x530b95]={'$like':'%'+_0x54df08[_0x6f9e('0x38')][_0x6f9e('0x2a')]+'%'};return _0x4b67e6;})});}_0x55aa39=_['merge']({},_0x55aa39,_0x54df08[_0x6f9e('0x45')]);return db['CmHopperBlack'][_0x6f9e('0x23')]({'where':_0x55aa39[_0x6f9e('0x41')]})[_0x6f9e('0x26')](function(_0x3f6f5d){_0xa22bf3[_0x6f9e('0x23')]=_0x3f6f5d;if(_0x54df08[_0x6f9e('0x38')][_0x6f9e('0x46')]){_0x55aa39['include']=[{'all':!![]}];}return db[_0x6f9e('0x68')][_0x6f9e('0x47')](_0x55aa39);})[_0x6f9e('0x26')](function(_0x53705c){_0xa22bf3[_0x6f9e('0x48')]=_0x53705c;return _0xa22bf3;});}})[_0x6f9e('0x26')](respondWithFilteredResult(_0x25ed33,_0x55aa39))['catch'](handleError(_0x25ed33,null));};exports['getTeams']=function(_0x275ae5,_0x4df434,_0x4512fe){var _0x1427a9={};var _0x2e0a17={};var _0xaca40a;var _0x2160fe;return db[_0x6f9e('0x34')][_0x6f9e('0x5f')]({'where':{'id':_0x275ae5[_0x6f9e('0x4a')]['id']}})[_0x6f9e('0x26')](handleEntityNotFound(_0x4df434,null))[_0x6f9e('0x26')](function(_0xf8e1f0){if(_0xf8e1f0){_0xaca40a=_0xf8e1f0;_0x2e0a17[_0x6f9e('0x37')]=_[_0x6f9e('0x39')](db[_0x6f9e('0x69')][_0x6f9e('0x4b')]);_0x2e0a17[_0x6f9e('0x38')]=_[_0x6f9e('0x39')](_0x275ae5[_0x6f9e('0x38')]);_0x2e0a17['filters']=_[_0x6f9e('0x3b')](_0x2e0a17[_0x6f9e('0x37')],_0x2e0a17[_0x6f9e('0x38')]);_0x1427a9[_0x6f9e('0x3d')]=_[_0x6f9e('0x3b')](_0x2e0a17['model'],qs[_0x6f9e('0x3c')](_0x275ae5[_0x6f9e('0x38')][_0x6f9e('0x3c')]));_0x1427a9['attributes']=_0x1427a9[_0x6f9e('0x3d')][_0x6f9e('0x4c')]?_0x1427a9[_0x6f9e('0x3d')]:_0x2e0a17[_0x6f9e('0x37')];_0x1427a9['order']=qs[_0x6f9e('0x40')](_0x275ae5[_0x6f9e('0x38')][_0x6f9e('0x40')]);_0x1427a9['where']=qs[_0x6f9e('0x3a')](_['pick'](_0x275ae5[_0x6f9e('0x38')],_0x2e0a17[_0x6f9e('0x3a')]));if(_0x275ae5['query'][_0x6f9e('0x2a')]){_0x1427a9[_0x6f9e('0x41')]=_[_0x6f9e('0x42')](_0x1427a9[_0x6f9e('0x41')],{'$or':_['map'](_0x1427a9[_0x6f9e('0x3d')],function(_0x55564c){var _0x2134e4={};_0x2134e4[_0x55564c]={'$like':'%'+_0x275ae5[_0x6f9e('0x38')]['filter']+'%'};return _0x2134e4;})});}_0x1427a9=_[_0x6f9e('0x42')]({},_0x1427a9,_0x275ae5[_0x6f9e('0x45')]);return _0xaca40a[_0x6f9e('0x6a')](_0x1427a9);}})[_0x6f9e('0x26')](function(_0x3a4869){if(_0x3a4869){_0x2160fe=_0x3a4869[_0x6f9e('0x4c')];if(!_0x275ae5['query'][_0x6f9e('0x63')](_0x6f9e('0x3e'))){_0x1427a9[_0x6f9e('0x22')]=qs[_0x6f9e('0x22')](_0x275ae5['query'][_0x6f9e('0x22')]);_0x1427a9[_0x6f9e('0x20')]=qs[_0x6f9e('0x20')](_0x275ae5['query'][_0x6f9e('0x20')]);}return _0xaca40a[_0x6f9e('0x6a')](_0x1427a9);}})[_0x6f9e('0x26')](function(_0x4d5563){if(_0x4d5563){return _0x4d5563?{'count':_0x2160fe,'rows':_0x4d5563}:null;}})[_0x6f9e('0x26')](respondWithResult(_0x4df434,null))[_0x6f9e('0x4d')](handleError(_0x4df434,null));};exports[_0x6f9e('0x6b')]=function(_0x58519a,_0x1e76cd,_0x240c41){var _0x2f4e4f=_0x58519a['body']['teams'];var _0xf90969=_[_0x6f9e('0x43')](_0x2f4e4f,'id');return db[_0x6f9e('0x69')][_0x6f9e('0x47')]({'where':{'id':_0xf90969},'attributes':['id'],'include':[{'model':db[_0x6f9e('0x6c')],'as':_0x6f9e('0x6d'),'attributes':['id',_0x6f9e('0x31'),_0x6f9e('0x6e'),_0x6f9e('0x6f'),'interface'],'raw':!![]}]})[_0x6f9e('0x26')](function(_0x2805e1){if(_0x2805e1){var _0x3074da=_[_0x6f9e('0x70')](_0x2805e1,function(_0x2ce80a){var _0x1c109f=_0x2ce80a[_0x6f9e('0x27')]({'plain':!![]});_0x1c109f[_0x6f9e('0x6d')][_0x6f9e('0x71')](function(_0x8f7309){_0x8f7309['penalty']=_['find'](_0x2f4e4f,{'id':_0x1c109f['id']})[_0x6f9e('0x72')];});return _0x1c109f[_0x6f9e('0x6d')];});return db[_0x6f9e('0x34')][_0x6f9e('0x2e')]({'where':{'id':_0x58519a[_0x6f9e('0x4a')]['id']}})['then'](function(_0x164654){return db['sequelize']['transaction'](function(_0x1ac999){return _0x164654[_0x6f9e('0x6b')](_0xf90969,{'transaction':_0x1ac999})[_0x6f9e('0x26')](function(){return BPromise['each'](_0x2f4e4f,function(_0x37bfe7){return db['TeamVoiceQueue']['upsert']({'TeamId':_0x37bfe7['id'],'VoiceQueueId':_0x58519a[_0x6f9e('0x4a')]['id'],'penalty':_0x37bfe7['penalty']},{'transaction':_0x1ac999});});})[_0x6f9e('0x26')](function(){return BPromise[_0x6f9e('0x73')](_0x3074da,function(_0x2348f3){return db[_0x6f9e('0x74')][_0x6f9e('0x75')]({'where':{'UserId':_0x2348f3['id'],'VoiceQueueId':_0x58519a['params']['id']},'defaults':{'penalty':_0x2348f3[_0x6f9e('0x72')]},'transaction':_0x1ac999});});})['then'](function(){return BPromise[_0x6f9e('0x73')](_['filter'](_0x3074da,{'online':!![]}),function(_0x168a86){return db[_0x6f9e('0x76')][_0x6f9e('0x77')]({'membername':_0x168a86[_0x6f9e('0x31')],'UserId':_0x168a86['id'],'queue_name':_0x164654[_0x6f9e('0x31')],'VoiceQueueId':_0x164654['id'],'interface':_[_0x6f9e('0x78')](_0x168a86['interface'])?util[_0x6f9e('0x79')](_0x6f9e('0x7a'),_0x168a86[_0x6f9e('0x31')]):_0x168a86[_0x6f9e('0x7b')],'paused':_0x168a86[_0x6f9e('0x6f')]||![],'penalty':_0x168a86[_0x6f9e('0x72')]},{'transaction':_0x1ac999});});})[_0x6f9e('0x26')](function(){_0x3074da['forEach'](function(_0x24c3d8){socket[_0x6f9e('0x7c')](_0x6f9e('0x7d'),{'UserId':_0x24c3d8['id'],'VoiceQueueId':_0x164654['id']});});});});});}})[_0x6f9e('0x26')](respondWithStatusCode(_0x1e76cd,null))[_0x6f9e('0x4d')](handleError(_0x1e76cd,null));};exports[_0x6f9e('0x7e')]=function(_0x4ab915,_0x2423ae,_0x5bb5ef){return db['Team']['findAll']({'where':{'id':_0x4ab915[_0x6f9e('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x6f9e('0x6c')],'as':_0x6f9e('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x6f9e('0x26')](handleEntityNotFound(_0x2423ae,null))['then'](function(_0x1b7091){var _0x1ed4c6=_['map'](_0x1b7091,'id');var _0x1b9d54=[];var _0x15d8fd=[];var _0x449a0d=squel[_0x6f9e('0x7f')]();_0x449a0d[_0x6f9e('0x80')](_0x6f9e('0x81'))['from']('team_has_voice_queues','tq')[_0x6f9e('0x82')](_0x6f9e('0x83'),'ut',_0x6f9e('0x84'))['where'](_0x6f9e('0x85'),_0x4ab915[_0x6f9e('0x4a')]['id']);for(var _0x438501=0x0;_0x438501<_0x1b7091[_0x6f9e('0x4c')];_0x438501+=0x1){let _0x13b578=_0x1b7091[_0x438501];for(var _0x247cf5=0x0;_0x247cf5<_0x13b578[_0x6f9e('0x6d')][_0x6f9e('0x4c')];_0x247cf5+=0x1){let _0x3a8622=_0x13b578[_0x6f9e('0x6d')][_0x247cf5];var _0x16755c=_0x449a0d[_0x6f9e('0x57')]();_0x16755c[_0x6f9e('0x41')](_0x6f9e('0x86'),_0x3a8622['id']);_0x15d8fd[_0x6f9e('0x87')](db[_0x6f9e('0x88')][_0x6f9e('0x38')](_0x16755c[_0x6f9e('0x89')](),{'type':db[_0x6f9e('0x88')]['QueryTypes'][_0x6f9e('0x8a')]})[_0x6f9e('0x26')](function(_0x1fc0e1){if(_0x1fc0e1[_0x6f9e('0x4c')]===0x1){return _0x3a8622['id'];}else{var _0x497809=_['every'](_['map'](_0x1fc0e1,'TeamId'),function(_0x484ded){return _[_0x6f9e('0x2c')](_0x1ed4c6,_0x484ded);});if(_0x497809){return _0x3a8622['id'];}}}));}}return BPromise['all'](_0x15d8fd)[_0x6f9e('0x26')](function(_0x1853f6){_0x1b9d54=_(_0x1b9d54)[_0x6f9e('0x8b')](_0x1853f6)[_0x6f9e('0x8c')]()['value']();return db[_0x6f9e('0x34')][_0x6f9e('0x2e')]({'where':{'id':_0x4ab915['params']['id']}})[_0x6f9e('0x26')](function(_0x4fc801){return db[_0x6f9e('0x88')]['transaction'](function(_0x1caa9a){return _0x4fc801['removeTeams'](_0x4ab915[_0x6f9e('0x38')][_0x6f9e('0x8d')],{'transaction':_0x1caa9a})[_0x6f9e('0x26')](function(){if(!_['isEmpty'](_0x1b9d54)){return _0x4fc801[_0x6f9e('0x8e')](_0x1b9d54,{'transaction':_0x1caa9a})['then'](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x4ab915[_0x6f9e('0x4a')]['id'],'UserId':_0x1b9d54},'transaction':_0x1caa9a});});}})[_0x6f9e('0x26')](function(){_0x1b9d54[_0x6f9e('0x71')](function(_0x358bc5){socket['emit'](_0x6f9e('0x8f'),{'UserId':_0x358bc5,'VoiceQueueId':_0x4fc801['id']});});});});});});})['then'](respondWithStatusCode(_0x2423ae,null))[_0x6f9e('0x4d')](handleError(_0x2423ae,null));};exports['addAgents']=function(_0x489be2,_0x1b9dbe,_0x41c7ff){var _0x30f4af,_0x1c5f76;return db[_0x6f9e('0x34')][_0x6f9e('0x2e')]({'where':{'id':_0x489be2['params']['id']}})[_0x6f9e('0x26')](handleEntityNotFound(_0x1b9dbe,null))[_0x6f9e('0x26')](function(_0x55bd0e){if(_0x55bd0e){_0x1c5f76=_0x55bd0e;return _0x55bd0e[_0x6f9e('0x90')](_0x489be2['body'][_0x6f9e('0x8d')],_[_0x6f9e('0x5a')](_0x489be2[_0x6f9e('0x4f')],[_0x6f9e('0x8d'),'id'])||{})[_0x6f9e('0x91')](function(_0x27aa21){for(var _0x4884a2=0x0;_0x4884a2<_0x489be2['body'][_0x6f9e('0x8d')][_0x6f9e('0x4c')];_0x4884a2+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':_0x489be2[_0x6f9e('0x4f')][_0x6f9e('0x8d')][_0x4884a2],'VoiceQueueId':_0x489be2[_0x6f9e('0x4a')]['id']});}return _0x27aa21;});}})[_0x6f9e('0x26')](function(_0x1a8179){_0x30f4af=_0x1a8179||[];if(_0x1c5f76){return db[_0x6f9e('0x6c')][_0x6f9e('0x47')]({'where':{'id':_0x489be2['body']['ids']},'attributes':['id','name',_0x6f9e('0x6e'),'voicePause',_0x6f9e('0x7b')],'raw':!![]});}})['then'](function(_0x454e31){if(!_[_0x6f9e('0x92')](_0x454e31)){var _0x45f6e0=[];for(var _0x5b10a0=0x0;_0x5b10a0<_0x454e31[_0x6f9e('0x4c')];_0x5b10a0++){if(_0x454e31[_0x5b10a0][_0x6f9e('0x6e')]){_0x45f6e0[_0x6f9e('0x87')](db[_0x6f9e('0x76')][_0x6f9e('0x77')]({'membername':_0x454e31[_0x5b10a0][_0x6f9e('0x31')],'UserId':_0x454e31[_0x5b10a0]['id'],'queue_name':_0x1c5f76[_0x6f9e('0x31')],'VoiceQueueId':_0x1c5f76['id'],'interface':_[_0x6f9e('0x78')](_0x454e31[_0x5b10a0][_0x6f9e('0x7b')])?util[_0x6f9e('0x79')]('SIP/%s',_0x454e31[_0x5b10a0]['name']):_0x454e31[_0x5b10a0][_0x6f9e('0x7b')],'paused':_0x454e31[_0x5b10a0][_0x6f9e('0x6f')]||![],'penalty':_0x489be2['body'][_0x6f9e('0x72')]||0x0}));}}return BPromise[_0x6f9e('0x93')](_0x45f6e0);}})[_0x6f9e('0x26')](function(){return _0x30f4af;})[_0x6f9e('0x26')](respondWithResult(_0x1b9dbe,null))[_0x6f9e('0x4d')](handleError(_0x1b9dbe,null));};exports[_0x6f9e('0x8e')]=function(_0x9ecf97,_0x50e84f,_0x5d477f){return db[_0x6f9e('0x34')][_0x6f9e('0x2e')]({'where':{'id':_0x9ecf97['params']['id']}})[_0x6f9e('0x26')](handleEntityNotFound(_0x50e84f,null))['then'](function(_0x346470){if(_0x346470){return _0x346470[_0x6f9e('0x8e')](_0x9ecf97[_0x6f9e('0x38')][_0x6f9e('0x8d')])[_0x6f9e('0x26')](function(){if(_[_0x6f9e('0x94')](_0x9ecf97[_0x6f9e('0x38')]['ids'])){for(var _0x4a404c=0x0;_0x4a404c<_0x9ecf97[_0x6f9e('0x38')]['ids'][_0x6f9e('0x4c')];_0x4a404c+=0x1){socket[_0x6f9e('0x7c')](_0x6f9e('0x8f'),{'UserId':Number(_0x9ecf97[_0x6f9e('0x38')][_0x6f9e('0x8d')][_0x4a404c]),'VoiceQueueId':Number(_0x9ecf97['params']['id'])});}}else{socket[_0x6f9e('0x7c')](_0x6f9e('0x8f'),{'UserId':Number(_0x9ecf97[_0x6f9e('0x38')][_0x6f9e('0x8d')]),'VoiceQueueId':Number(_0x9ecf97['params']['id'])});}});}})[_0x6f9e('0x26')](function(_0x420c4c){return db[_0x6f9e('0x76')]['destroy']({'where':{'VoiceQueueId':_0x9ecf97[_0x6f9e('0x4a')]['id'],'UserId':_0x9ecf97[_0x6f9e('0x38')][_0x6f9e('0x8d')]}})[_0x6f9e('0x26')](function(){return _0x420c4c;});})['then'](respondWithStatusCode(_0x50e84f,null))[_0x6f9e('0x4d')](handleError(_0x50e84f,null));};exports[_0x6f9e('0x95')]=function(_0x51e594,_0xe8b88b,_0x2dd248){var _0x1b3870={};var _0x312a82={};var _0x4fd8db;var _0x177c9c;return db['VoiceQueue']['findOne']({'where':{'id':_0x51e594['params']['id']}})[_0x6f9e('0x26')](handleEntityNotFound(_0xe8b88b,null))['then'](function(_0xb71f98){if(_0xb71f98){_0x4fd8db=_0xb71f98;_0x312a82[_0x6f9e('0x37')]=_[_0x6f9e('0x39')](db[_0x6f9e('0x6c')][_0x6f9e('0x4b')]);_0x312a82['query']=_[_0x6f9e('0x39')](_0x51e594[_0x6f9e('0x38')]);_0x312a82[_0x6f9e('0x3a')]=_[_0x6f9e('0x3b')](_0x312a82['model'],_0x312a82[_0x6f9e('0x38')]);_0x1b3870['attributes']=_[_0x6f9e('0x3b')](_0x312a82[_0x6f9e('0x37')],qs[_0x6f9e('0x3c')](_0x51e594[_0x6f9e('0x38')][_0x6f9e('0x3c')]));_0x1b3870[_0x6f9e('0x3d')]=_0x1b3870[_0x6f9e('0x3d')][_0x6f9e('0x4c')]?_0x1b3870[_0x6f9e('0x3d')]:_0x312a82[_0x6f9e('0x37')];_0x1b3870[_0x6f9e('0x3f')]=qs[_0x6f9e('0x40')](_0x51e594['query']['sort']);_0x1b3870['where']=qs['filters'](_[_0x6f9e('0x61')](_0x51e594[_0x6f9e('0x38')],_0x312a82['filters']));if(_0x51e594[_0x6f9e('0x38')]['filter']){_0x1b3870[_0x6f9e('0x41')]=_[_0x6f9e('0x42')](_0x1b3870[_0x6f9e('0x41')],{'$or':_['map'](_0x1b3870[_0x6f9e('0x3d')],function(_0x3dcb80){var _0x2a5914={};_0x2a5914[_0x3dcb80]={'$like':'%'+_0x51e594[_0x6f9e('0x38')]['filter']+'%'};return _0x2a5914;})});}_0x1b3870=_[_0x6f9e('0x42')]({},_0x1b3870,_0x51e594['options']);return _0x4fd8db[_0x6f9e('0x95')](_0x1b3870);}})[_0x6f9e('0x26')](function(_0x593fed){if(_0x593fed){_0x177c9c=_0x593fed['length'];if(!_0x51e594[_0x6f9e('0x38')][_0x6f9e('0x63')]('nolimit')){_0x1b3870[_0x6f9e('0x22')]=qs[_0x6f9e('0x22')](_0x51e594[_0x6f9e('0x38')][_0x6f9e('0x22')]);_0x1b3870[_0x6f9e('0x20')]=qs[_0x6f9e('0x20')](_0x51e594[_0x6f9e('0x38')][_0x6f9e('0x20')]);}return _0x4fd8db['getAgents'](_0x1b3870);}})['then'](function(_0x51ffee){if(_0x51ffee){return _0x51ffee?{'count':_0x177c9c,'rows':_0x51ffee}:null;}})[_0x6f9e('0x26')](respondWithResult(_0xe8b88b,null))[_0x6f9e('0x4d')](handleError(_0xe8b88b,null));};exports['getMembers']=function(_0x501694,_0x5449a2,_0x4c51da){var _0x1cc5e8={};var _0x5d9cf8={};var _0x1d6b45;var _0xf2d9ec;return db[_0x6f9e('0x34')]['findOne']({'where':{'id':_0x501694[_0x6f9e('0x4a')]['id']}})[_0x6f9e('0x26')](handleEntityNotFound(_0x5449a2,null))[_0x6f9e('0x26')](function(_0x57e888){if(_0x57e888){_0x1d6b45=_0x57e888;_0x5d9cf8[_0x6f9e('0x37')]=_[_0x6f9e('0x39')](db['UserVoiceQueueRt']['rawAttributes']);_0x5d9cf8[_0x6f9e('0x38')]=_[_0x6f9e('0x39')](_0x501694[_0x6f9e('0x38')]);_0x5d9cf8[_0x6f9e('0x3a')]=_['intersection'](_0x5d9cf8['model'],_0x5d9cf8[_0x6f9e('0x38')]);_0x1cc5e8[_0x6f9e('0x3d')]=_[_0x6f9e('0x3b')](_0x5d9cf8[_0x6f9e('0x37')],qs[_0x6f9e('0x3c')](_0x501694[_0x6f9e('0x38')][_0x6f9e('0x3c')]));_0x1cc5e8[_0x6f9e('0x3d')]=_0x1cc5e8[_0x6f9e('0x3d')][_0x6f9e('0x4c')]?_0x1cc5e8['attributes']:_0x5d9cf8[_0x6f9e('0x37')];_0x1cc5e8[_0x6f9e('0x3f')]=qs[_0x6f9e('0x40')](_0x501694[_0x6f9e('0x38')]['sort']);_0x1cc5e8[_0x6f9e('0x41')]=qs[_0x6f9e('0x3a')](_[_0x6f9e('0x61')](_0x501694['query'],_0x5d9cf8[_0x6f9e('0x3a')]));if(_0x501694[_0x6f9e('0x38')][_0x6f9e('0x2a')]){_0x1cc5e8[_0x6f9e('0x41')]=_[_0x6f9e('0x42')](_0x1cc5e8['where'],{'$or':_[_0x6f9e('0x43')](_0x1cc5e8['attributes'],function(_0x3451a3){var _0xc8c878={};_0xc8c878[_0x3451a3]={'$like':'%'+_0x501694[_0x6f9e('0x38')]['filter']+'%'};return _0xc8c878;})});}_0x1cc5e8=_[_0x6f9e('0x42')]({},_0x1cc5e8,_0x501694['options']);return _0x1d6b45[_0x6f9e('0x96')](_0x1cc5e8);}})[_0x6f9e('0x26')](function(_0x440a80){if(_0x440a80){_0xf2d9ec=_0x440a80[_0x6f9e('0x4c')];if(!_0x501694['query'][_0x6f9e('0x63')]('nolimit')){_0x1cc5e8['limit']=qs[_0x6f9e('0x22')](_0x501694['query'][_0x6f9e('0x22')]);_0x1cc5e8['offset']=qs['offset'](_0x501694[_0x6f9e('0x38')][_0x6f9e('0x20')]);}return _0x1d6b45['getMembers'](_0x1cc5e8);}})[_0x6f9e('0x26')](function(_0x4859f3){return _0x4859f3?{'count':_0xf2d9ec,'rows':_0x4859f3}:null;})[_0x6f9e('0x26')](respondWithResult(_0x5449a2,null))[_0x6f9e('0x4d')](handleError(_0x5449a2,null));};exports[_0x6f9e('0x97')]=function(_0x51e4c0,_0x555ef2,_0x4328a4){var _0x3dd36f={};var _0x43129d={};var _0x5bc40e;var _0x4ee2cb;return db[_0x6f9e('0x34')][_0x6f9e('0x5f')]({'where':{'id':_0x51e4c0['params']['id']}})[_0x6f9e('0x26')](handleEntityNotFound(_0x555ef2,null))[_0x6f9e('0x26')](function(_0x9b59c5){if(_0x9b59c5){_0x5bc40e=_0x9b59c5;_0x43129d[_0x6f9e('0x37')]=_['keys'](db[_0x6f9e('0x98')][_0x6f9e('0x4b')]);_0x43129d[_0x6f9e('0x38')]=_[_0x6f9e('0x39')](_0x51e4c0[_0x6f9e('0x38')]);_0x43129d[_0x6f9e('0x3a')]=_[_0x6f9e('0x3b')](_0x43129d[_0x6f9e('0x37')],_0x43129d[_0x6f9e('0x38')]);_0x3dd36f[_0x6f9e('0x3d')]=_[_0x6f9e('0x3b')](_0x43129d['model'],qs['fields'](_0x51e4c0[_0x6f9e('0x38')][_0x6f9e('0x3c')]));_0x3dd36f[_0x6f9e('0x3d')]=_0x3dd36f[_0x6f9e('0x3d')][_0x6f9e('0x4c')]?_0x3dd36f[_0x6f9e('0x3d')]:_0x43129d['model'];_0x3dd36f[_0x6f9e('0x3f')]=qs['sort'](_0x51e4c0['query']['sort']);_0x3dd36f['where']=qs['filters'](_[_0x6f9e('0x61')](_0x51e4c0[_0x6f9e('0x38')],_0x43129d[_0x6f9e('0x3a')]));if(_0x51e4c0['query']['filter']){_0x3dd36f[_0x6f9e('0x41')]=_['merge'](_0x3dd36f[_0x6f9e('0x41')],{'$or':_[_0x6f9e('0x43')](_0x3dd36f[_0x6f9e('0x3d')],function(_0x125854){var _0xd9a60a={};_0xd9a60a[_0x125854]={'$like':'%'+_0x51e4c0[_0x6f9e('0x38')][_0x6f9e('0x2a')]+'%'};return _0xd9a60a;})});}_0x3dd36f=_['merge']({},_0x3dd36f,_0x51e4c0['options']);return _0x5bc40e[_0x6f9e('0x97')](_0x3dd36f);}})[_0x6f9e('0x26')](function(_0x4e810c){if(_0x4e810c){_0x4ee2cb=_0x4e810c['length'];if(!_0x51e4c0[_0x6f9e('0x38')]['hasOwnProperty']('nolimit')){_0x3dd36f[_0x6f9e('0x22')]=qs[_0x6f9e('0x22')](_0x51e4c0[_0x6f9e('0x38')][_0x6f9e('0x22')]);_0x3dd36f[_0x6f9e('0x20')]=qs[_0x6f9e('0x20')](_0x51e4c0[_0x6f9e('0x38')][_0x6f9e('0x20')]);}return _0x5bc40e[_0x6f9e('0x97')](_0x3dd36f);}})[_0x6f9e('0x26')](function(_0x719407){if(_0x719407){return _0x719407?{'count':_0x4ee2cb,'rows':_0x719407}:null;}})[_0x6f9e('0x26')](respondWithResult(_0x555ef2,null))[_0x6f9e('0x4d')](handleError(_0x555ef2,null));};exports['addLists']=function(_0x449a09,_0x3dbf04,_0x5b366a){var _0x32911e,_0x320bdb;var _0x1910b4=[];var _0x80ca11=moment()[_0x6f9e('0x79')](_0x6f9e('0x99'));return db[_0x6f9e('0x34')][_0x6f9e('0x2e')]({'where':{'id':_0x449a09[_0x6f9e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3dbf04,null))['then'](function(_0x1770b1){if(_0x1770b1){_0x320bdb=_0x1770b1;return _0x1770b1[_0x6f9e('0x9a')](_0x449a09['body']['ids'],_[_0x6f9e('0x5a')](_0x449a09[_0x6f9e('0x4f')],[_0x6f9e('0x8d'),'id'])||{});}return null;})['spread'](function(_0x1a4b7e){var _0x1eb338;var _0x13c513;_0x32911e=_0x1a4b7e||[];var _0x2bb252=[];if(_0x1a4b7e){for(var _0x631ec=0x0;_0x631ec<_0x1a4b7e[_0x6f9e('0x4c')];_0x631ec+=0x1){var _0x1e135f=_0x1a4b7e[_0x631ec][_0x6f9e('0x27')]({'plain':!![]});_0x320bdb[_0x6f9e('0x9b')]=_0x449a09[_0x6f9e('0x4f')][_0x6f9e('0x9b')]?_0x449a09[_0x6f9e('0x4f')][_0x6f9e('0x9b')]:_0x320bdb['dialCheckDuplicateType'];switch(_0x320bdb[_0x6f9e('0x9b')]){case _0x6f9e('0x9c'):_0x1eb338=squel[_0x6f9e('0x9d')]()[_0x6f9e('0x9e')](_0x6f9e('0x9f'))[_0x6f9e('0xa0')]([_0x6f9e('0xa1'),'scheduledAt',_0x6f9e('0xa2'),'ListId',_0x6f9e('0x64'),_0x6f9e('0x58'),_0x6f9e('0x59')],squel['select']()[_0x6f9e('0x80')](_0x6f9e('0xa1'),'phone')[_0x6f9e('0x80')](_0x6f9e('0xa3'),_0x6f9e('0xa4'))['field']('id',_0x6f9e('0xa2'))[_0x6f9e('0x80')](_0x1e135f[_0x6f9e('0xa5')]['toString'](),_0x6f9e('0xa6'))[_0x6f9e('0x80')](_0x449a09['params']['id'][_0x6f9e('0x89')](),_0x6f9e('0x64'))[_0x6f9e('0x80')]('\x27'+_0x80ca11+'\x27','createdAt')['field']('\x27'+_0x80ca11+'\x27',_0x6f9e('0x59'))[_0x6f9e('0xa7')](_0x6f9e('0xa8'))[_0x6f9e('0x41')](_0x6f9e('0xa9'))[_0x6f9e('0x41')](_0x6f9e('0xaa'),_0x1e135f[_0x6f9e('0xa5')]['toString']())[_0x6f9e('0x41')](_0x6f9e('0xab'))[_0x6f9e('0x41')](_0x6f9e('0xac'),squel[_0x6f9e('0x7f')]()[_0x6f9e('0x80')](_0x6f9e('0xad'))[_0x6f9e('0xa7')](_0x6f9e('0xae'))['where'](_0x6f9e('0x85'),_0x449a09[_0x6f9e('0x4a')]['id'][_0x6f9e('0x89')]()))[_0x6f9e('0x41')](_0x6f9e('0xac'),squel[_0x6f9e('0x7f')]()[_0x6f9e('0x80')](_0x6f9e('0xaf'))['from'](_0x6f9e('0x9f'))[_0x6f9e('0x41')](_0x6f9e('0x85'),_0x449a09[_0x6f9e('0x4a')]['id'][_0x6f9e('0x89')]())))[_0x6f9e('0x89')]();break;case _0x6f9e('0xb0'):_0x1eb338=squel[_0x6f9e('0x9d')]()[_0x6f9e('0x9e')](_0x6f9e('0x9f'))[_0x6f9e('0xa0')](['phone','scheduledAt','ContactId',_0x6f9e('0xa6'),_0x6f9e('0x64'),_0x6f9e('0x58'),_0x6f9e('0x59')],squel['select']()[_0x6f9e('0x80')]('phone','phone')[_0x6f9e('0x80')](_0x6f9e('0xa3'),_0x6f9e('0xa4'))[_0x6f9e('0x80')]('id','ContactId')[_0x6f9e('0x80')](_0x1e135f[_0x6f9e('0xa5')][_0x6f9e('0x89')](),_0x6f9e('0xa6'))[_0x6f9e('0x80')](_0x449a09[_0x6f9e('0x4a')]['id'][_0x6f9e('0x89')](),_0x6f9e('0x64'))[_0x6f9e('0x80')]('\x27'+_0x80ca11+'\x27',_0x6f9e('0x58'))[_0x6f9e('0x80')]('\x27'+_0x80ca11+'\x27',_0x6f9e('0x59'))[_0x6f9e('0xa7')](_0x6f9e('0xa8'))[_0x6f9e('0x41')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x1e135f[_0x6f9e('0xa5')]['toString']())[_0x6f9e('0x41')](_0x6f9e('0xab'))[_0x6f9e('0x41')](_0x6f9e('0xac'),squel['select']()[_0x6f9e('0x80')](_0x6f9e('0xaf'))[_0x6f9e('0xa7')](_0x6f9e('0x9f'))[_0x6f9e('0x41')](_0x6f9e('0x85'),_0x449a09[_0x6f9e('0x4a')]['id']['toString']())))[_0x6f9e('0x89')]();break;default:_0x1eb338=squel[_0x6f9e('0x9d')]()[_0x6f9e('0x9e')](_0x6f9e('0x9f'))['fromQuery']([_0x6f9e('0xa1'),'scheduledAt',_0x6f9e('0xa2'),_0x6f9e('0xa6'),_0x6f9e('0x64'),_0x6f9e('0x58'),_0x6f9e('0x59')],squel[_0x6f9e('0x7f')]()[_0x6f9e('0x80')](_0x6f9e('0xa1'),_0x6f9e('0xa1'))['field'](_0x6f9e('0xa3'),_0x6f9e('0xa4'))[_0x6f9e('0x80')]('id',_0x6f9e('0xa2'))[_0x6f9e('0x80')](_0x1e135f[_0x6f9e('0xa5')][_0x6f9e('0x89')](),_0x6f9e('0xa6'))[_0x6f9e('0x80')](_0x449a09[_0x6f9e('0x4a')]['id'][_0x6f9e('0x89')](),_0x6f9e('0x64'))['field']('\x27'+_0x80ca11+'\x27','createdAt')['field']('\x27'+_0x80ca11+'\x27',_0x6f9e('0x59'))[_0x6f9e('0xa7')]('cm_contacts')[_0x6f9e('0x41')](_0x6f9e('0xa9'))[_0x6f9e('0x41')](_0x6f9e('0xaa'),_0x1e135f[_0x6f9e('0xa5')]['toString']())[_0x6f9e('0x41')](_0x6f9e('0xab')))[_0x6f9e('0x89')]();}_0x13c513=squel['insert']()['into'](_0x6f9e('0xb1'))['fromQuery'](['cmHopperId',_0x6f9e('0xa4'),'phone',_0x6f9e('0xb2'),'createdAt','updatedAt'],squel[_0x6f9e('0x7f')]()[_0x6f9e('0x80')](_0x6f9e('0xb3'),'id')[_0x6f9e('0x80')](_0x6f9e('0xa3'),'scheduledAt')[_0x6f9e('0x80')](_0x6f9e('0xb4'),'phone')[_0x6f9e('0x80')]('ci.OrderBY',_0x6f9e('0xb2'))[_0x6f9e('0x80')]('\x27'+_0x80ca11+'\x27',_0x6f9e('0x58'))[_0x6f9e('0x80')]('\x27'+_0x80ca11+'\x27',_0x6f9e('0x59'))[_0x6f9e('0xa7')]('cm_contact_has_items','ci')['join']('cm_hopper','h',_0x6f9e('0xb5'))[_0x6f9e('0x41')]('h.ListId\x20=\x20?',_0x1e135f['CmListId'][_0x6f9e('0x89')]())[_0x6f9e('0x41')](_0x6f9e('0xb6'),_0x449a09[_0x6f9e('0x4a')]['id'][_0x6f9e('0x89')]())[_0x6f9e('0x41')](_0x6f9e('0xb7'),_0x80ca11))[_0x6f9e('0x89')]();_0x2bb252[_0x6f9e('0x87')](db['sequelize'][_0x6f9e('0x38')](_0x1eb338));_0x1910b4[_0x6f9e('0x87')](db[_0x6f9e('0x88')]['query'](_0x13c513));}return BPromise[_0x6f9e('0x93')](_0x2bb252);}})[_0x6f9e('0x26')](function(){return BPromise[_0x6f9e('0x93')](_0x1910b4);})[_0x6f9e('0x26')](function(){return _0x32911e;})[_0x6f9e('0x26')](respondWithResult(_0x3dbf04,null))[_0x6f9e('0x4d')](handleError(_0x3dbf04,null));};exports[_0x6f9e('0xb8')]=function(_0xbc0227,_0x507d2a,_0x194dd0){return db[_0x6f9e('0x34')][_0x6f9e('0x2e')]({'where':{'id':_0xbc0227[_0x6f9e('0x4a')]['id']}})[_0x6f9e('0x26')](handleEntityNotFound(_0x507d2a,null))[_0x6f9e('0x26')](function(_0x19d2cd){if(_0x19d2cd){return _0x19d2cd['removeLists'](_0xbc0227[_0x6f9e('0x38')]['ids']);}})[_0x6f9e('0x26')](function(_0x426949){if(_0x426949){return db[_0x6f9e('0x60')][_0x6f9e('0x2f')]({'where':{'ListId':_0xbc0227['query'][_0x6f9e('0x8d')],'VoiceQueueId':_0xbc0227[_0x6f9e('0x4a')]['id']}})[_0x6f9e('0x26')](function(){return _0x426949;});}})[_0x6f9e('0x26')](respondWithStatusCode(_0x507d2a,null))['catch'](handleError(_0x507d2a,null));};exports[_0x6f9e('0xb9')]=function(_0x27da6d,_0x22f28e,_0x3eb71c){var _0x3344e4={};var _0x384653={};var _0x2ed26f;var _0x493960;return db[_0x6f9e('0x34')][_0x6f9e('0x5f')]({'where':{'id':_0x27da6d[_0x6f9e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x22f28e,null))[_0x6f9e('0x26')](function(_0x5a9877){if(_0x5a9877){_0x2ed26f=_0x5a9877;_0x384653[_0x6f9e('0x37')]=_[_0x6f9e('0x39')](db[_0x6f9e('0x98')]['rawAttributes']);_0x384653[_0x6f9e('0x38')]=_[_0x6f9e('0x39')](_0x27da6d[_0x6f9e('0x38')]);_0x384653[_0x6f9e('0x3a')]=_[_0x6f9e('0x3b')](_0x384653['model'],_0x384653[_0x6f9e('0x38')]);_0x3344e4[_0x6f9e('0x3d')]=_[_0x6f9e('0x3b')](_0x384653[_0x6f9e('0x37')],qs[_0x6f9e('0x3c')](_0x27da6d['query'][_0x6f9e('0x3c')]));_0x3344e4[_0x6f9e('0x3d')]=_0x3344e4[_0x6f9e('0x3d')][_0x6f9e('0x4c')]?_0x3344e4['attributes']:_0x384653[_0x6f9e('0x37')];_0x3344e4['order']=qs[_0x6f9e('0x40')](_0x27da6d[_0x6f9e('0x38')]['sort']);_0x3344e4['where']=qs[_0x6f9e('0x3a')](_[_0x6f9e('0x61')](_0x27da6d[_0x6f9e('0x38')],_0x384653[_0x6f9e('0x3a')]));if(_0x27da6d[_0x6f9e('0x38')][_0x6f9e('0x2a')]){_0x3344e4[_0x6f9e('0x41')]=_[_0x6f9e('0x42')](_0x3344e4[_0x6f9e('0x41')],{'$or':_[_0x6f9e('0x43')](_0x3344e4[_0x6f9e('0x3d')],function(_0x5f8649){var _0x465d8d={};_0x465d8d[_0x5f8649]={'$like':'%'+_0x27da6d[_0x6f9e('0x38')][_0x6f9e('0x2a')]+'%'};return _0x465d8d;})});}_0x3344e4=_['merge']({},_0x3344e4,_0x27da6d[_0x6f9e('0x45')]);return _0x2ed26f[_0x6f9e('0xb9')](_0x3344e4);}})[_0x6f9e('0x26')](function(_0x82b899){if(_0x82b899){_0x493960=_0x82b899['length'];if(!_0x27da6d[_0x6f9e('0x38')]['hasOwnProperty'](_0x6f9e('0x3e'))){_0x3344e4[_0x6f9e('0x22')]=qs[_0x6f9e('0x22')](_0x27da6d[_0x6f9e('0x38')]['limit']);_0x3344e4['offset']=qs[_0x6f9e('0x20')](_0x27da6d[_0x6f9e('0x38')][_0x6f9e('0x20')]);}return _0x2ed26f[_0x6f9e('0xb9')](_0x3344e4);}})['then'](function(_0x40506d){if(_0x40506d){return _0x40506d?{'count':_0x493960,'rows':_0x40506d}:null;}})['then'](respondWithResult(_0x22f28e,null))[_0x6f9e('0x4d')](handleError(_0x22f28e,null));};exports['addBlackLists']=function(_0xaf824d,_0x9eb8c3,_0x378358){var _0x5c23c3,_0x375478;var _0x39361b=[];var _0x13f43c=moment()[_0x6f9e('0x79')](_0x6f9e('0x99'));return db[_0x6f9e('0x34')][_0x6f9e('0x2e')]({'where':{'id':_0xaf824d[_0x6f9e('0x4a')]['id']}})[_0x6f9e('0x26')](handleEntityNotFound(_0x9eb8c3,null))[_0x6f9e('0x26')](function(_0x2649ef){if(_0x2649ef){_0x375478=_0x2649ef;return _0x2649ef[_0x6f9e('0xba')](_0xaf824d[_0x6f9e('0x4f')]['ids'],_[_0x6f9e('0x5a')](_0xaf824d[_0x6f9e('0x4f')],[_0x6f9e('0x8d'),'id'])||{});}return null;})['spread'](function(_0x46a40a){var _0x4dbc72;var _0x26895d;_0x5c23c3=_0x46a40a||[];var _0x22bb92=[];if(_0x46a40a){for(var _0x3dab53=0x0;_0x3dab53<_0x46a40a[_0x6f9e('0x4c')];_0x3dab53+=0x1){var _0x3717bc=_0x46a40a[_0x3dab53]['get']({'plain':!![]});_0x4dbc72=squel['insert']()[_0x6f9e('0x9e')](_0x6f9e('0xbb'))[_0x6f9e('0xa0')]([_0x6f9e('0xa1'),_0x6f9e('0xa2'),_0x6f9e('0xa6'),_0x6f9e('0x64'),'createdAt',_0x6f9e('0x59')],squel[_0x6f9e('0x7f')]()[_0x6f9e('0x80')](_0x6f9e('0xa1'),_0x6f9e('0xa1'))[_0x6f9e('0x80')]('id','ContactId')[_0x6f9e('0x80')](_0x3717bc['CmListId']['toString'](),_0x6f9e('0xa6'))[_0x6f9e('0x80')](_0xaf824d[_0x6f9e('0x4a')]['id'][_0x6f9e('0x89')](),_0x6f9e('0x64'))[_0x6f9e('0x80')](_0x6f9e('0xa3'),'createdAt')['field'](_0x6f9e('0xa3'),_0x6f9e('0x59'))[_0x6f9e('0xa7')](_0x6f9e('0xa8'))[_0x6f9e('0x41')](_0x6f9e('0xa9'))[_0x6f9e('0x41')](_0x6f9e('0xaa'),_0x3717bc['CmListId'][_0x6f9e('0x89')]())[_0x6f9e('0x41')](_0x6f9e('0xab')))['toString']();_0x22bb92[_0x6f9e('0x87')](db[_0x6f9e('0x88')][_0x6f9e('0x38')](_0x4dbc72));}return BPromise[_0x6f9e('0x93')](_0x22bb92);}})[_0x6f9e('0x26')](function(){return _0x5c23c3;})['then'](respondWithResult(_0x9eb8c3,null))[_0x6f9e('0x4d')](handleError(_0x9eb8c3,null));};exports['removeBlackLists']=function(_0xafa5e9,_0xcec288,_0x177bc0){return db[_0x6f9e('0x34')][_0x6f9e('0x2e')]({'where':{'id':_0xafa5e9[_0x6f9e('0x4a')]['id']}})[_0x6f9e('0x26')](handleEntityNotFound(_0xcec288,null))['then'](function(_0x1be1d8){if(_0x1be1d8){return _0x1be1d8[_0x6f9e('0xbc')](_0xafa5e9[_0x6f9e('0x38')]['ids']);}})[_0x6f9e('0x26')](function(_0x45baa2){if(_0x45baa2){return db[_0x6f9e('0x68')][_0x6f9e('0x2f')]({'where':{'ListId':_0xafa5e9['query'][_0x6f9e('0x8d')],'VoiceQueueId':_0xafa5e9[_0x6f9e('0x4a')]['id']}})[_0x6f9e('0x26')](function(){return _0x45baa2;});}})[_0x6f9e('0x26')](respondWithStatusCode(_0xcec288,null))[_0x6f9e('0x4d')](handleError(_0xcec288,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index e035609..e18554e 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 _0xcfab=['exports','../../mysqldb','VoiceQueue','setMaxListeners','update','emit','hook'];(function(_0x382f81,_0xfbf8de){var _0x473931=function(_0x3e2861){while(--_0x3e2861){_0x382f81['push'](_0x382f81['shift']());}};_0x473931(++_0xfbf8de);}(_0xcfab,0x119));var _0xbcfa=function(_0x49fc5b,_0x2dc37a){_0x49fc5b=_0x49fc5b-0x0;var _0x31e931=_0xcfab[_0x49fc5b];return _0x31e931;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xbcfa('0x0'))['db'][_0xbcfa('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xbcfa('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbcfa('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1cc2bf){return function(_0x2046b6,_0x25f16f,_0x58f444){VoiceQueueEvents[_0xbcfa('0x4')](_0x1cc2bf+':'+_0x2046b6['id'],_0x2046b6);VoiceQueueEvents[_0xbcfa('0x4')](_0x1cc2bf,_0x2046b6);_0x58f444(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xbcfa('0x5')](e,emitEvent(event));}}module[_0xbcfa('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0x0774=['emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueue','setMaxListeners','save','remove'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0774,0x9d));var _0x4077=function(_0x157de8,_0x4b9f93){_0x157de8=_0x157de8-0x0;var _0x2057eb=_0x0774[_0x157de8];return _0x2057eb;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x4077('0x0'))['db'][_0x4077('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x4077('0x2')](0x0);var events={'afterCreate':_0x4077('0x3'),'afterUpdate':'update','afterDestroy':_0x4077('0x4')};function emitEvent(_0x274d1a){return function(_0xf186c,_0x1f131c,_0x37eac6){VoiceQueueEvents[_0x4077('0x5')](_0x274d1a+':'+_0xf186c['id'],_0xf186c);VoiceQueueEvents[_0x4077('0x5')](_0x274d1a,_0xf186c);_0x37eac6(null);};}for(var e in events){if(events[_0x4077('0x6')](e)){var event=events[e];VoiceQueue[_0x4077('0x7')](e,emitEvent(event));}}module[_0x4077('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index b7c8740..a378498 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 _0xeb26=['path','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue','lodash','util','../../config/logger','request-promise'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0xeb26,0xb9));var _0x6eb2=function(_0x58ea6a,_0x5542fd){_0x58ea6a=_0x58ea6a-0x0;var _0x55a608=_0xeb26[_0x58ea6a];return _0x55a608;};'use strict';var _=require(_0x6eb2('0x0'));var util=require(_0x6eb2('0x1'));var logger=require(_0x6eb2('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6eb2('0x3'));var fs=require('fs');var path=require(_0x6eb2('0x4'));var rimraf=require('rimraf');var config=require(_0x6eb2('0x5'));var attributes=require(_0x6eb2('0x6'));module[_0x6eb2('0x7')]=function(_0x177d34,_0x21891b){return _0x177d34['define'](_0x6eb2('0x8'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7380=['util','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue'];(function(_0x498ccf,_0x4bc99a){var _0x3a9199=function(_0x2aae8a){while(--_0x2aae8a){_0x498ccf['push'](_0x498ccf['shift']());}};_0x3a9199(++_0x4bc99a);}(_0x7380,0x10e));var _0x0738=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x7380[_0xf51c06];return _0x1d5420;};'use strict';var _=require('lodash');var util=require(_0x0738('0x0'));var logger=require(_0x0738('0x1'))(_0x0738('0x2'));var moment=require(_0x0738('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0738('0x4'));var rimraf=require('rimraf');var config=require(_0x0738('0x5'));var attributes=require(_0x0738('0x6'));module[_0x0738('0x7')]=function(_0x155cdf,_0x186263){return _0x155cdf[_0x0738('0x8')](_0x0738('0x9'),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 b4fb652..f54be46 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 _0x43f9=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','register','request','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowVoiceQueue','find','util','moment'];(function(_0x5a2924,_0x278e22){var _0x41f12c=function(_0x270682){while(--_0x270682){_0x5a2924['push'](_0x5a2924['shift']());}};_0x41f12c(++_0x278e22);}(_0x43f9,0x6a));var _0x943f=function(_0x142c5c,_0x3734fd){_0x142c5c=_0x142c5c-0x0;var _0x46a9c6=_0x43f9[_0x142c5c];return _0x46a9c6;};'use strict';var _=require('lodash');var util=require(_0x943f('0x0'));var moment=require(_0x943f('0x1'));var BPromise=require(_0x943f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x943f('0x3'))['db'];var utils=require(_0x943f('0x4'));var logger=require(_0x943f('0x5'))(_0x943f('0x6'));var config=require(_0x943f('0x7'));var jayson=require(_0x943f('0x8'));var client=jayson[_0x943f('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x943f('0xa')],{'host':_0x943f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueue.socket')[_0x943f('0xc')](socket);function respondWithRpcPromise(_0xc4ce13,_0x5ae8f1,_0x56c68a){return new BPromise(function(_0x432243,_0x5cf69f){return client[_0x943f('0xd')](_0xc4ce13,_0x56c68a)['then'](function(_0x43a5bc){logger['info'](_0x943f('0xe'),_0x5ae8f1,_0x943f('0xf'));logger[_0x943f('0x10')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x5ae8f1,_0x943f('0xf'),JSON[_0x943f('0x11')](_0x43a5bc));if(_0x43a5bc[_0x943f('0x12')]){if(_0x43a5bc['error'][_0x943f('0x13')]===0x1f4){logger[_0x943f('0x12')](_0x943f('0xe'),_0x5ae8f1,_0x43a5bc[_0x943f('0x12')][_0x943f('0x14')]);return _0x5cf69f(_0x43a5bc['error'][_0x943f('0x14')]);}logger['error'](_0x943f('0xe'),_0x5ae8f1,_0x43a5bc[_0x943f('0x12')][_0x943f('0x14')]);return _0x432243(_0x43a5bc[_0x943f('0x12')][_0x943f('0x14')]);}else{logger[_0x943f('0x15')](_0x943f('0xe'),_0x5ae8f1,'request\x20sent');_0x432243(_0x43a5bc['result']['message']);}})[_0x943f('0x16')](function(_0x497dd8){logger[_0x943f('0x12')](_0x943f('0xe'),_0x5ae8f1,_0x497dd8);_0x5cf69f(_0x497dd8);});});}exports[_0x943f('0x17')]=function(_0x2eb907){var _0x318805=this;return new Promise(function(_0x123d3b,_0x1b5186){return db[_0x943f('0x18')][_0x943f('0x19')]({'raw':_0x2eb907[_0x943f('0x1a')]?_0x2eb907[_0x943f('0x1a')][_0x943f('0x1b')]===undefined?!![]:![]:!![],'where':_0x2eb907[_0x943f('0x1a')]?_0x2eb907[_0x943f('0x1a')][_0x943f('0x1c')]||null:null,'attributes':_0x2eb907['options']?_0x2eb907[_0x943f('0x1a')][_0x943f('0x1d')]||null:null,'limit':_0x2eb907[_0x943f('0x1a')]?_0x2eb907['options'][_0x943f('0x1e')]||null:null,'include':_0x2eb907[_0x943f('0x1a')]?_0x2eb907[_0x943f('0x1a')][_0x943f('0x1f')]?_[_0x943f('0x20')](_0x2eb907[_0x943f('0x1a')]['include'],function(_0x325fdc){return{'model':db[_0x325fdc[_0x943f('0x21')]],'as':_0x325fdc['as'],'attributes':_0x325fdc['attributes'],'include':_0x325fdc[_0x943f('0x1f')]?_[_0x943f('0x20')](_0x325fdc['include'],function(_0xcf436c){return{'model':db[_0xcf436c[_0x943f('0x21')]],'as':_0xcf436c['as'],'attributes':_0xcf436c[_0x943f('0x1d')],'include':_0xcf436c[_0x943f('0x1f')]?_[_0x943f('0x20')](_0xcf436c['include'],function(_0x4e0394){return{'model':db[_0x4e0394[_0x943f('0x21')]],'as':_0x4e0394['as'],'attributes':_0x4e0394[_0x943f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x361638){logger[_0x943f('0x15')](_0x943f('0x17'),_0x2eb907);logger[_0x943f('0x10')](_0x943f('0x17'),_0x2eb907,JSON['stringify'](_0x361638));_0x123d3b(_0x361638);})[_0x943f('0x16')](function(_0x4736c2){logger['error'](_0x943f('0x17'),_0x4736c2[_0x943f('0x14')],_0x2eb907);_0x1b5186(_0x318805[_0x943f('0x12')](0x1f4,_0x4736c2[_0x943f('0x14')]));});});};exports[_0x943f('0x22')]=function(_0x1ca1be){var _0x219fc9=this;return new Promise(function(_0x5d0ee3,_0x228241){return db['VoiceQueue'][_0x943f('0x23')]({'raw':_0x1ca1be[_0x943f('0x1a')]?_0x1ca1be[_0x943f('0x1a')][_0x943f('0x1b')]===undefined?!![]:![]:!![],'where':_0x1ca1be[_0x943f('0x1a')]?_0x1ca1be[_0x943f('0x1a')][_0x943f('0x1c')]||null:null,'attributes':_0x1ca1be[_0x943f('0x1a')]?_0x1ca1be['options'][_0x943f('0x1d')]||null:null,'include':_0x1ca1be[_0x943f('0x1a')]?_0x1ca1be[_0x943f('0x1a')][_0x943f('0x1f')]?_['map'](_0x1ca1be['options'][_0x943f('0x1f')],function(_0x3bac48){return{'model':db[_0x3bac48[_0x943f('0x21')]],'as':_0x3bac48['as'],'attributes':_0x3bac48[_0x943f('0x1d')],'include':_0x3bac48[_0x943f('0x1f')]?_[_0x943f('0x20')](_0x3bac48['include'],function(_0x24752e){return{'model':db[_0x24752e[_0x943f('0x21')]],'as':_0x24752e['as'],'attributes':_0x24752e[_0x943f('0x1d')],'include':_0x24752e['include']?_[_0x943f('0x20')](_0x24752e[_0x943f('0x1f')],function(_0x15ef10){return{'model':db[_0x15ef10[_0x943f('0x21')]],'as':_0x15ef10['as'],'attributes':_0x15ef10[_0x943f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5272bc){logger[_0x943f('0x15')]('ShowVoiceQueue',_0x1ca1be);logger[_0x943f('0x10')](_0x943f('0x22'),_0x1ca1be,JSON[_0x943f('0x11')](_0x5272bc));_0x5d0ee3(_0x5272bc);})[_0x943f('0x16')](function(_0x5c7d40){logger['error'](_0x943f('0x22'),_0x5c7d40[_0x943f('0x14')],_0x1ca1be);_0x228241(_0x219fc9[_0x943f('0x12')](0x1f4,_0x5c7d40[_0x943f('0x14')]));});});}; \ No newline at end of file +var _0x3d06=['message','result','findAll','options','raw','where','include','model','attributes','map','then','GetVoiceQueue','debug','catch','ShowVoiceQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','info','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x57494e,_0x2c4d3d){var _0x4099da=function(_0x38c521){while(--_0x38c521){_0x57494e['push'](_0x57494e['shift']());}};_0x4099da(++_0x2c4d3d);}(_0x3d06,0x19f));var _0x63d0=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x3d06[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0x63d0('0x0'));var util=require(_0x63d0('0x1'));var moment=require(_0x63d0('0x2'));var BPromise=require('bluebird');var rs=require(_0x63d0('0x3'));var fs=require('fs');var Redis=require(_0x63d0('0x4'));var db=require(_0x63d0('0x5'))['db'];var utils=require(_0x63d0('0x6'));var logger=require(_0x63d0('0x7'))(_0x63d0('0x8'));var config=require(_0x63d0('0x9'));var jayson=require(_0x63d0('0xa'));var client=jayson['client'][_0x63d0('0xb')]({'port':0x232a});config[_0x63d0('0xc')]=_[_0x63d0('0xd')](config['redis'],{'host':_0x63d0('0xe'),'port':0x18eb});var socket=require(_0x63d0('0xf'))(new Redis(config['redis']));require(_0x63d0('0x10'))[_0x63d0('0x11')](socket);function respondWithRpcPromise(_0x1c4bde,_0x5069d9,_0xe84af3){return new BPromise(function(_0x4144a6,_0x306c39){return client['request'](_0x1c4bde,_0xe84af3)['then'](function(_0x5e2f92){logger[_0x63d0('0x12')](_0x63d0('0x13'),_0x5069d9,'request\x20sent');logger['debug'](_0x63d0('0x14'),_0x5069d9,_0x63d0('0x15'),JSON[_0x63d0('0x16')](_0x5e2f92));if(_0x5e2f92[_0x63d0('0x17')]){if(_0x5e2f92[_0x63d0('0x17')][_0x63d0('0x18')]===0x1f4){logger['error'](_0x63d0('0x13'),_0x5069d9,_0x5e2f92[_0x63d0('0x17')][_0x63d0('0x19')]);return _0x306c39(_0x5e2f92['error'][_0x63d0('0x19')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x5069d9,_0x5e2f92['error']['message']);return _0x4144a6(_0x5e2f92[_0x63d0('0x17')][_0x63d0('0x19')]);}else{logger[_0x63d0('0x12')](_0x63d0('0x13'),_0x5069d9,_0x63d0('0x15'));_0x4144a6(_0x5e2f92[_0x63d0('0x1a')]['message']);}})['catch'](function(_0x3518be){logger[_0x63d0('0x17')](_0x63d0('0x13'),_0x5069d9,_0x3518be);_0x306c39(_0x3518be);});});}exports['GetVoiceQueue']=function(_0x27eee8){var _0x3a5c59=this;return new Promise(function(_0xd26aef,_0x4127a7){return db['VoiceQueue'][_0x63d0('0x1b')]({'raw':_0x27eee8[_0x63d0('0x1c')]?_0x27eee8[_0x63d0('0x1c')][_0x63d0('0x1d')]===undefined?!![]:![]:!![],'where':_0x27eee8[_0x63d0('0x1c')]?_0x27eee8[_0x63d0('0x1c')][_0x63d0('0x1e')]||null:null,'attributes':_0x27eee8[_0x63d0('0x1c')]?_0x27eee8['options']['attributes']||null:null,'limit':_0x27eee8[_0x63d0('0x1c')]?_0x27eee8[_0x63d0('0x1c')]['limit']||null:null,'include':_0x27eee8[_0x63d0('0x1c')]?_0x27eee8['options'][_0x63d0('0x1f')]?_['map'](_0x27eee8[_0x63d0('0x1c')][_0x63d0('0x1f')],function(_0x137bf6){return{'model':db[_0x137bf6[_0x63d0('0x20')]],'as':_0x137bf6['as'],'attributes':_0x137bf6[_0x63d0('0x21')],'include':_0x137bf6[_0x63d0('0x1f')]?_[_0x63d0('0x22')](_0x137bf6[_0x63d0('0x1f')],function(_0x4d4a2e){return{'model':db[_0x4d4a2e[_0x63d0('0x20')]],'as':_0x4d4a2e['as'],'attributes':_0x4d4a2e[_0x63d0('0x21')],'include':_0x4d4a2e['include']?_[_0x63d0('0x22')](_0x4d4a2e['include'],function(_0x99fce9){return{'model':db[_0x99fce9[_0x63d0('0x20')]],'as':_0x99fce9['as'],'attributes':_0x99fce9[_0x63d0('0x21')]};}):[]};}):[]};}):[]:[]})[_0x63d0('0x23')](function(_0x3781cb){logger['info'](_0x63d0('0x24'),_0x27eee8);logger[_0x63d0('0x25')]('GetVoiceQueue',_0x27eee8,JSON[_0x63d0('0x16')](_0x3781cb));_0xd26aef(_0x3781cb);})[_0x63d0('0x26')](function(_0x4e25db){logger[_0x63d0('0x17')](_0x63d0('0x24'),_0x4e25db['message'],_0x27eee8);_0x4127a7(_0x3a5c59[_0x63d0('0x17')](0x1f4,_0x4e25db[_0x63d0('0x19')]));});});};exports[_0x63d0('0x27')]=function(_0x18405c){var _0x4b5848=this;return new Promise(function(_0x3a5179,_0x4715e5){return db['VoiceQueue']['find']({'raw':_0x18405c[_0x63d0('0x1c')]?_0x18405c[_0x63d0('0x1c')][_0x63d0('0x1d')]===undefined?!![]:![]:!![],'where':_0x18405c['options']?_0x18405c[_0x63d0('0x1c')][_0x63d0('0x1e')]||null:null,'attributes':_0x18405c[_0x63d0('0x1c')]?_0x18405c['options']['attributes']||null:null,'include':_0x18405c[_0x63d0('0x1c')]?_0x18405c[_0x63d0('0x1c')][_0x63d0('0x1f')]?_[_0x63d0('0x22')](_0x18405c[_0x63d0('0x1c')]['include'],function(_0x483474){return{'model':db[_0x483474[_0x63d0('0x20')]],'as':_0x483474['as'],'attributes':_0x483474[_0x63d0('0x21')],'include':_0x483474[_0x63d0('0x1f')]?_[_0x63d0('0x22')](_0x483474[_0x63d0('0x1f')],function(_0x3c0c93){return{'model':db[_0x3c0c93[_0x63d0('0x20')]],'as':_0x3c0c93['as'],'attributes':_0x3c0c93['attributes'],'include':_0x3c0c93['include']?_[_0x63d0('0x22')](_0x3c0c93['include'],function(_0xf4d936){return{'model':db[_0xf4d936['model']],'as':_0xf4d936['as'],'attributes':_0xf4d936[_0x63d0('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x857112){logger[_0x63d0('0x12')](_0x63d0('0x27'),_0x18405c);logger['debug']('ShowVoiceQueue',_0x18405c,JSON[_0x63d0('0x16')](_0x857112));_0x3a5179(_0x857112);})['catch'](function(_0x2c6000){logger[_0x63d0('0x17')](_0x63d0('0x27'),_0x2c6000['message'],_0x18405c);_0x4715e5(_0x4b5848[_0x63d0('0x17')](0x1f4,_0x2c6000[_0x63d0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 5426223..6039f67 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 _0x0aab=['removeListener','./voiceQueue.events','update','emit'];(function(_0x400322,_0x4353a8){var _0xfdd597=function(_0xd914b6){while(--_0xd914b6){_0x400322['push'](_0x400322['shift']());}};_0xfdd597(++_0x4353a8);}(_0x0aab,0x169));var _0xb0aa=function(_0x282ccc,_0x5d66a1){_0x282ccc=_0x282ccc-0x0;var _0x27c2dd=_0x0aab[_0x282ccc];return _0x27c2dd;};'use strict';var VoiceQueueEvents=require(_0xb0aa('0x0'));var events=['save','remove',_0xb0aa('0x1')];function createListener(_0x46545b,_0x12f2cf){return function(_0x432882){_0x12f2cf[_0xb0aa('0x2')](_0x46545b,_0x432882);};}function removeListener(_0x265d59,_0x485475){return function(){VoiceQueueEvents[_0xb0aa('0x3')](_0x265d59,_0x485475);};}exports['register']=function(_0xe6f6bf){for(var _0x21a353=0x0,_0x58bcfd=events['length'];_0x21a353<_0x58bcfd;_0x21a353++){var _0x1e180e=events[_0x21a353];var _0x388a53=createListener('voiceQueue:'+_0x1e180e,_0xe6f6bf);VoiceQueueEvents['on'](_0x1e180e,_0x388a53);}}; \ No newline at end of file +var _0x65ef=['update','emit','removeListener','register','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x65ef,0x7d));var _0xf65e=function(_0x1223ea,_0x1de811){_0x1223ea=_0x1223ea-0x0;var _0x4d233d=_0x65ef[_0x1223ea];return _0x4d233d;};'use strict';var VoiceQueueEvents=require(_0xf65e('0x0'));var events=[_0xf65e('0x1'),_0xf65e('0x2'),_0xf65e('0x3')];function createListener(_0x3fc930,_0x4b861c){return function(_0x3058dd){_0x4b861c[_0xf65e('0x4')](_0x3fc930,_0x3058dd);};}function removeListener(_0xd92cce,_0x484345){return function(){VoiceQueueEvents[_0xf65e('0x5')](_0xd92cce,_0x484345);};}exports[_0xf65e('0x6')]=function(_0x11fcca){for(var _0x406987=0x0,_0x2731b9=events['length'];_0x406987<_0x2731b9;_0x406987++){var _0x4a131e=events[_0x406987];var _0xb3d243=createListener(_0xf65e('0x7')+_0x4a131e,_0x11fcca);VoiceQueueEvents['on'](_0x4a131e,_0xb3d243);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 7e392f2..99e27a7 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 _0x2ea1=['/index','getVoiceQueuesReport','/:id','show','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','describe','get'];(function(_0x1abda8,_0x385d2f){var _0x4f66c7=function(_0xf67883){while(--_0xf67883){_0x1abda8['push'](_0x1abda8['shift']());}};_0x4f66c7(++_0x385d2f);}(_0x2ea1,0x8d));var _0x12ea=function(_0x25f498,_0x570118){_0x25f498=_0x25f498-0x0;var _0xdeb2e6=_0x2ea1[_0x25f498];return _0xdeb2e6;};'use strict';var multer=require(_0x12ea('0x0'));var util=require(_0x12ea('0x1'));var path=require(_0x12ea('0x2'));var timeout=require('connect-timeout');var express=require(_0x12ea('0x3'));var router=express[_0x12ea('0x4')]();var fs_extra=require(_0x12ea('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x12ea('0x6'));var config=require(_0x12ea('0x7'));var controller=require(_0x12ea('0x8'));router['get']('/',auth[_0x12ea('0x9')](),controller[_0x12ea('0xa')]);router['get']('/describe',auth[_0x12ea('0x9')](),controller[_0x12ea('0xb')]);router[_0x12ea('0xc')](_0x12ea('0xd'),auth[_0x12ea('0x9')](),controller[_0x12ea('0xe')]);router[_0x12ea('0xc')](_0x12ea('0xf'),auth[_0x12ea('0x9')](),controller[_0x12ea('0x10')]);router['post']('/',auth[_0x12ea('0x9')](),controller[_0x12ea('0x11')]);router['put'](_0x12ea('0xf'),auth[_0x12ea('0x9')](),controller[_0x12ea('0x12')]);router[_0x12ea('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x12ea('0x14')]);module[_0x12ea('0x15')]=router; \ No newline at end of file +var _0xeb3b=['post','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','/index','getVoiceQueuesReport','/:id'];(function(_0x58f901,_0x25eed7){var _0x53e257=function(_0xcf28ab){while(--_0xcf28ab){_0x58f901['push'](_0x58f901['shift']());}};_0x53e257(++_0x25eed7);}(_0xeb3b,0xad));var _0xbeb3=function(_0x3d34f0,_0x4a5dc0){_0x3d34f0=_0x3d34f0-0x0;var _0x135ecd=_0xeb3b[_0x3d34f0];return _0x135ecd;};'use strict';var multer=require(_0xbeb3('0x0'));var util=require(_0xbeb3('0x1'));var path=require('path');var timeout=require(_0xbeb3('0x2'));var express=require(_0xbeb3('0x3'));var router=express[_0xbeb3('0x4')]();var fs_extra=require(_0xbeb3('0x5'));var auth=require(_0xbeb3('0x6'));var interaction=require(_0xbeb3('0x7'));var config=require(_0xbeb3('0x8'));var controller=require(_0xbeb3('0x9'));router[_0xbeb3('0xa')]('/',auth[_0xbeb3('0xb')](),controller['index']);router['get'](_0xbeb3('0xc'),auth[_0xbeb3('0xb')](),controller['describe']);router['get'](_0xbeb3('0xd'),auth[_0xbeb3('0xb')](),controller[_0xbeb3('0xe')]);router[_0xbeb3('0xa')](_0xbeb3('0xf'),auth[_0xbeb3('0xb')](),controller['show']);router[_0xbeb3('0x10')]('/',auth['isAuthenticated'](),controller[_0xbeb3('0x11')]);router[_0xbeb3('0x12')](_0xbeb3('0xf'),auth[_0xbeb3('0xb')](),controller['update']);router['delete']('/:id',auth[_0xbeb3('0xb')](),controller[_0xbeb3('0x13')]);module[_0xbeb3('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 49c49b6..85b9927 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 _0xb7e7=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x972699,_0x477434){var _0x218567=function(_0xc98e2e){while(--_0xc98e2e){_0x972699['push'](_0x972699['shift']());}};_0x218567(++_0x477434);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xb7e7[_0x1abb09];return _0xea1c07;};'use strict';var Sequelize=require(_0x7b7e('0x0'));var moment=require('moment');module[_0x7b7e('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7b7e('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x7b7e('0x3')],'set':function(_0x1d9384){var _0x52047f=moment(_0x1d9384);var _0x53ed64=moment(this[_0x7b7e('0x4')](_0x7b7e('0x5')))[_0x7b7e('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x42b871=_0x52047f[_0x7b7e('0x7')](_0x53ed64,_0x7b7e('0x8'));this[_0x7b7e('0x9')](_0x7b7e('0xa'),_0x1d9384);this[_0x7b7e('0x9')](_0x7b7e('0xb'),_0x42b871||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x7b7e('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexit':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x7b7e('0x2')],'comment':_0x7b7e('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7b7e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7b7e('0x2')]},'holdtime':{'type':Sequelize[_0x7b7e('0xc')]},'mohtime':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7b7e('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x7b7e('0xf')},'transferexten':{'type':Sequelize[_0x7b7e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'disposition':{'type':Sequelize[_0x7b7e('0x2')]},'secondDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb7e7=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x184623,_0x10c27f){var _0xf82018=function(_0x526351){while(--_0x526351){_0x184623['push'](_0x184623['shift']());}};_0xf82018(++_0x10c27f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xb7e7[_0x45f951];return _0x24756c;};'use strict';var Sequelize=require(_0x7b7e('0x0'));var moment=require('moment');module[_0x7b7e('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7b7e('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x7b7e('0x3')],'set':function(_0x1d9384){var _0x52047f=moment(_0x1d9384);var _0x53ed64=moment(this[_0x7b7e('0x4')](_0x7b7e('0x5')))[_0x7b7e('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x42b871=_0x52047f[_0x7b7e('0x7')](_0x53ed64,_0x7b7e('0x8'));this[_0x7b7e('0x9')](_0x7b7e('0xa'),_0x1d9384);this[_0x7b7e('0x9')](_0x7b7e('0xb'),_0x42b871||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x7b7e('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexit':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x7b7e('0x2')],'comment':_0x7b7e('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7b7e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7b7e('0x2')]},'holdtime':{'type':Sequelize[_0x7b7e('0xc')]},'mohtime':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7b7e('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x7b7e('0xf')},'transferexten':{'type':Sequelize[_0x7b7e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'disposition':{'type':Sequelize[_0x7b7e('0x2')]},'secondDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x7b7e('0xc')],'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 2189db5..8247636 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 _0x3dc5=['catch','show','params','keys','find','create','body','destroy','describe','order','getVoiceQueuesReport','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','type','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x5c9207,_0x4737ef){var _0x587913=function(_0x5df589){while(--_0x5df589){_0x5c9207['push'](_0x5c9207['shift']());}};_0x587913(++_0x4737ef);}(_0x3dc5,0x107));var _0x53dc=function(_0x1167d1,_0x269ddd){_0x1167d1=_0x1167d1-0x0;var _0x59fbad=_0x3dc5[_0x1167d1];return _0x59fbad;};'use strict';var emlformat=require(_0x53dc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x53dc('0x1'));var rp=require(_0x53dc('0x2'));var moment=require(_0x53dc('0x3'));var BPromise=require(_0x53dc('0x4'));var Mustache=require(_0x53dc('0x5'));var util=require(_0x53dc('0x6'));var path=require('path');var sox=require(_0x53dc('0x7'));var csv=require(_0x53dc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x53dc('0x9'));var _=require('lodash');var squel=require(_0x53dc('0xa'));var crypto=require('crypto');var jsforce=require(_0x53dc('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x53dc('0xc'));var Papa=require(_0x53dc('0xd'));var Redis=require(_0x53dc('0xe'));var authService=require(_0x53dc('0xf'));var qs=require(_0x53dc('0x10'));var as=require(_0x53dc('0x11'));var hardwareService=require(_0x53dc('0x12'));var logger=require(_0x53dc('0x13'))(_0x53dc('0x14'));var utils=require('../../config/utils');var config=require(_0x53dc('0x15'));var licenseUtil=require(_0x53dc('0x16'));var db=require(_0x53dc('0x17'))['db'];config[_0x53dc('0x18')]=_['defaults'](config[_0x53dc('0x18')],{'host':_0x53dc('0x19'),'port':0x18eb});var socket=require(_0x53dc('0x1a'))(new Redis(config[_0x53dc('0x18')]));require(_0x53dc('0x1b'))[_0x53dc('0x1c')](socket);function respondWithStatusCode(_0x43de56,_0x26df00){_0x26df00=_0x26df00||0xcc;return function(_0x220c64){if(_0x220c64){return _0x43de56['sendStatus'](_0x26df00);}return _0x43de56[_0x53dc('0x1d')](_0x26df00)[_0x53dc('0x1e')]();};}function respondWithResult(_0x3825d5,_0x5b57ca){_0x5b57ca=_0x5b57ca||0xc8;return function(_0x453aaf){if(_0x453aaf){return _0x3825d5['status'](_0x5b57ca)[_0x53dc('0x1f')](_0x453aaf);}};}function respondWithFilteredResult(_0x32b334,_0x3a858c){return function(_0x3b663b){if(_0x3b663b){var _0x1114d7=typeof _0x3a858c['offset']===_0x53dc('0x20')&&typeof _0x3a858c['limit']===_0x53dc('0x20');var _0xd3497a=_0x3b663b['count'];var _0xfb1e8f=_0x1114d7?0x0:_0x3a858c[_0x53dc('0x21')];var _0x230062=_0x1114d7?_0x3b663b[_0x53dc('0x22')]:_0x3a858c[_0x53dc('0x21')]+_0x3a858c[_0x53dc('0x23')];var _0x35c363;if(_0x230062>=_0xd3497a){_0x230062=_0xd3497a;_0x35c363=0xc8;}else{_0x35c363=0xce;}_0x32b334[_0x53dc('0x1d')](_0x35c363);return _0x32b334[_0x53dc('0x24')](_0x53dc('0x25'),_0xfb1e8f+'-'+_0x230062+'/'+_0xd3497a)['json'](_0x3b663b);}return null;};}function patchUpdates(_0x19ceac){return function(_0x36fccd){try{jsonpatch[_0x53dc('0x26')](_0x36fccd,_0x19ceac,!![]);}catch(_0x30f6ad){return BPromise[_0x53dc('0x27')](_0x30f6ad);}return _0x36fccd[_0x53dc('0x28')]();};}function saveUpdates(_0x248a46,_0x2e834e){return function(_0x345804){if(_0x345804){return _0x345804[_0x53dc('0x29')](_0x248a46)[_0x53dc('0x2a')](function(_0x190803){return _0x190803;});}return null;};}function removeEntity(_0x1d19cf,_0x3cef58){return function(_0x3d8b59){if(_0x3d8b59){return _0x3d8b59['destroy']()['then'](function(){_0x1d19cf[_0x53dc('0x1d')](0xcc)[_0x53dc('0x1e')]();});}};}function handleEntityNotFound(_0x531448,_0xc86ca8){return function(_0x114c87){if(!_0x114c87){_0x531448[_0x53dc('0x2b')](0x194);}return _0x114c87;};}function handleError(_0x39f1dc,_0x4e3d0d){_0x4e3d0d=_0x4e3d0d||0x1f4;return function(_0x40835f){logger[_0x53dc('0x2c')](_0x40835f[_0x53dc('0x2d')]);if(_0x40835f[_0x53dc('0x2e')]){delete _0x40835f['name'];}_0x39f1dc[_0x53dc('0x1d')](_0x4e3d0d)[_0x53dc('0x2f')](_0x40835f);};}exports[_0x53dc('0x30')]=function(_0x4e7f70,_0x225330){var _0x17506e={},_0x2a1bc1={},_0x1c4d63={'count':0x0,'rows':[]};var _0x3c6dea=_[_0x53dc('0x31')](db[_0x53dc('0x32')][_0x53dc('0x33')],function(_0x42273b){return{'name':_0x42273b['fieldName'],'type':_0x42273b[_0x53dc('0x34')]['key']};});_0x2a1bc1['model']=_[_0x53dc('0x31')](_0x3c6dea,'name');_0x2a1bc1[_0x53dc('0x35')]=_['keys'](_0x4e7f70[_0x53dc('0x35')]);_0x2a1bc1['filters']=_[_0x53dc('0x36')](_0x2a1bc1['model'],_0x2a1bc1['query']);_0x17506e[_0x53dc('0x37')]=_[_0x53dc('0x36')](_0x2a1bc1[_0x53dc('0x38')],qs[_0x53dc('0x39')](_0x4e7f70['query'][_0x53dc('0x39')]));_0x17506e[_0x53dc('0x37')]=_0x17506e[_0x53dc('0x37')][_0x53dc('0x3a')]?_0x17506e[_0x53dc('0x37')]:_0x2a1bc1['model'];if(!_0x4e7f70[_0x53dc('0x35')][_0x53dc('0x3b')](_0x53dc('0x3c'))){_0x17506e['limit']=qs[_0x53dc('0x23')](_0x4e7f70[_0x53dc('0x35')][_0x53dc('0x23')]);_0x17506e[_0x53dc('0x21')]=qs[_0x53dc('0x21')](_0x4e7f70[_0x53dc('0x35')]['offset']);}_0x17506e['order']=qs[_0x53dc('0x3d')](_0x4e7f70[_0x53dc('0x35')]['sort']);_0x17506e['where']=qs[_0x53dc('0x3e')](_[_0x53dc('0x3f')](_0x4e7f70[_0x53dc('0x35')],_0x2a1bc1[_0x53dc('0x3e')]),_0x3c6dea);if(_0x4e7f70[_0x53dc('0x35')][_0x53dc('0x40')]){_0x17506e['where']=_[_0x53dc('0x41')](_0x17506e[_0x53dc('0x42')],{'$or':_[_0x53dc('0x31')](_0x3c6dea,function(_0x1a3dca){if(_0x1a3dca[_0x53dc('0x34')]!==_0x53dc('0x43')){var _0x2ee8ed={};_0x2ee8ed[_0x1a3dca[_0x53dc('0x2e')]]={'$like':'%'+_0x4e7f70['query'][_0x53dc('0x40')]+'%'};return _0x2ee8ed;}})});}_0x17506e=_[_0x53dc('0x41')]({},_0x17506e,_0x4e7f70[_0x53dc('0x44')]);var _0x3056bb={'where':_0x17506e['where']};return db[_0x53dc('0x32')][_0x53dc('0x22')](_0x3056bb)['then'](function(_0x17113c){_0x1c4d63[_0x53dc('0x22')]=_0x17113c;if(_0x4e7f70[_0x53dc('0x35')][_0x53dc('0x45')]){_0x17506e[_0x53dc('0x46')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x53dc('0x47')](_0x17506e);})['then'](function(_0x52b00a){_0x1c4d63[_0x53dc('0x48')]=_0x52b00a;return _0x1c4d63;})[_0x53dc('0x2a')](respondWithFilteredResult(_0x225330,_0x17506e))[_0x53dc('0x49')](handleError(_0x225330,null));};exports[_0x53dc('0x4a')]=function(_0x27fd52,_0x49c7a6){var _0x601c47={'raw':![],'where':{'id':_0x27fd52[_0x53dc('0x4b')]['id']}},_0x1b93dc={};_0x1b93dc['model']=_[_0x53dc('0x4c')](db[_0x53dc('0x32')][_0x53dc('0x33')]);_0x1b93dc[_0x53dc('0x35')]=_[_0x53dc('0x4c')](_0x27fd52[_0x53dc('0x35')]);_0x1b93dc[_0x53dc('0x3e')]=_[_0x53dc('0x36')](_0x1b93dc['model'],_0x1b93dc[_0x53dc('0x35')]);_0x601c47[_0x53dc('0x37')]=_[_0x53dc('0x36')](_0x1b93dc[_0x53dc('0x38')],qs[_0x53dc('0x39')](_0x27fd52[_0x53dc('0x35')][_0x53dc('0x39')]));_0x601c47['attributes']=_0x601c47['attributes']['length']?_0x601c47[_0x53dc('0x37')]:_0x1b93dc['model'];if(_0x27fd52[_0x53dc('0x35')][_0x53dc('0x45')]){_0x601c47[_0x53dc('0x46')]=[{'all':!![]}];}_0x601c47=_['merge']({},_0x601c47,_0x27fd52[_0x53dc('0x44')]);return db[_0x53dc('0x32')][_0x53dc('0x4d')](_0x601c47)[_0x53dc('0x2a')](handleEntityNotFound(_0x49c7a6,null))[_0x53dc('0x2a')](respondWithResult(_0x49c7a6,null))[_0x53dc('0x49')](handleError(_0x49c7a6,null));};exports[_0x53dc('0x4e')]=function(_0x2fe6c6,_0x3a511a){return db['VoiceQueueReport'][_0x53dc('0x4e')](_0x2fe6c6['body'],{})['then'](respondWithResult(_0x3a511a,0xc9))['catch'](handleError(_0x3a511a,null));};exports[_0x53dc('0x29')]=function(_0x465b4b,_0x302498){if(_0x465b4b[_0x53dc('0x4f')]['id']){delete _0x465b4b[_0x53dc('0x4f')]['id'];}return db[_0x53dc('0x32')][_0x53dc('0x4d')]({'where':{'id':_0x465b4b['params']['id']}})[_0x53dc('0x2a')](handleEntityNotFound(_0x302498,null))['then'](saveUpdates(_0x465b4b[_0x53dc('0x4f')],null))['then'](respondWithResult(_0x302498,null))[_0x53dc('0x49')](handleError(_0x302498,null));};exports[_0x53dc('0x50')]=function(_0x13b9ae,_0x536acf){return db[_0x53dc('0x32')]['find']({'where':{'id':_0x13b9ae[_0x53dc('0x4b')]['id']}})['then'](handleEntityNotFound(_0x536acf,null))[_0x53dc('0x2a')](removeEntity(_0x536acf,null))[_0x53dc('0x49')](handleError(_0x536acf,null));};exports[_0x53dc('0x51')]=function(_0x1bc6a6,_0x98f1aa){return db['VoiceQueueReport'][_0x53dc('0x51')]()[_0x53dc('0x2a')](respondWithResult(_0x98f1aa,null))[_0x53dc('0x49')](handleError(_0x98f1aa,null));};exports['getVoiceQueuesReport']=function(_0x5692f3,_0x5c94a9){var _0x584a7d={},_0x533a18={},_0x5f19a1={'count':0x0,'rows':[]};_0x533a18[_0x53dc('0x38')]=_[_0x53dc('0x4c')](db[_0x53dc('0x32')][_0x53dc('0x33')]);_0x533a18[_0x53dc('0x35')]=_[_0x53dc('0x4c')](_0x5692f3[_0x53dc('0x35')]);_0x533a18['filters']=_[_0x53dc('0x36')](_0x533a18[_0x53dc('0x38')],_0x533a18[_0x53dc('0x35')]);_0x584a7d['attributes']=_[_0x53dc('0x36')](_0x533a18[_0x53dc('0x38')],qs['fields'](_0x5692f3[_0x53dc('0x35')][_0x53dc('0x39')]));_0x584a7d[_0x53dc('0x37')]=_0x584a7d[_0x53dc('0x37')][_0x53dc('0x3a')]?_0x584a7d['attributes']:_0x533a18[_0x53dc('0x38')];if(!_0x5692f3[_0x53dc('0x35')][_0x53dc('0x3b')]('nolimit')){_0x584a7d[_0x53dc('0x23')]=qs['limit'](_0x5692f3[_0x53dc('0x35')][_0x53dc('0x23')]);_0x584a7d['offset']=qs[_0x53dc('0x21')](_0x5692f3[_0x53dc('0x35')]['offset']);}_0x584a7d[_0x53dc('0x52')]=qs[_0x53dc('0x3d')](_0x5692f3[_0x53dc('0x35')][_0x53dc('0x3d')]);_0x584a7d[_0x53dc('0x42')]=qs['filters'](_[_0x53dc('0x3f')](_0x5692f3[_0x53dc('0x35')],_0x533a18['filters']));if(_0x5692f3[_0x53dc('0x35')][_0x53dc('0x40')]){_0x584a7d[_0x53dc('0x42')]=_[_0x53dc('0x41')](_0x584a7d[_0x53dc('0x42')],{'$or':_[_0x53dc('0x31')](_0x584a7d[_0x53dc('0x37')],function(_0x5151a7){var _0x4772a2={};_0x4772a2[_0x5151a7]={'$like':'%'+_0x5692f3[_0x53dc('0x35')]['filter']+'%'};return _0x4772a2;})});}_0x584a7d=_['merge']({},_0x584a7d,_0x5692f3[_0x53dc('0x44')]);var _0x56db32={'where':_0x584a7d[_0x53dc('0x42')]};return db['VoiceQueueReport'][_0x53dc('0x22')](_0x56db32)['then'](function(_0x129dc5){_0x5f19a1[_0x53dc('0x22')]=_0x129dc5;if(_0x5692f3[_0x53dc('0x35')]['includeAll']){_0x584a7d[_0x53dc('0x46')]=[{'all':!![]}];}return db[_0x53dc('0x32')][_0x53dc('0x47')](_0x584a7d);})[_0x53dc('0x2a')](function(_0x2c841a){_0x5f19a1[_0x53dc('0x48')]=_0x2c841a;return _0x5f19a1;})['then'](respondWithFilteredResult(_0x5c94a9,_0x584a7d,_0x53dc('0x53')))[_0x53dc('0x49')](handleError(_0x5c94a9,null,_0x53dc('0x53')));}; \ No newline at end of file +var _0x7ee4=['where','merge','VIRTUAL','filter','then','includeAll','include','rows','catch','rawAttributes','options','find','create','body','params','describe','getVoiceQueuesReport','findAll','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./voiceQueueReport.socket','register','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','update','destroy','end','error','stack','name','send','index','map','VoiceQueueReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x2625b8,_0x428b39){var _0x3f2b84=function(_0x4baab5){while(--_0x4baab5){_0x2625b8['push'](_0x2625b8['shift']());}};_0x3f2b84(++_0x428b39);}(_0x7ee4,0x10b));var _0x47ee=function(_0x332d5c,_0x4a2336){_0x332d5c=_0x332d5c-0x0;var _0x47448d=_0x7ee4[_0x332d5c];return _0x47448d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x47ee('0x0'));var jsonpatch=require(_0x47ee('0x1'));var rp=require(_0x47ee('0x2'));var moment=require(_0x47ee('0x3'));var BPromise=require(_0x47ee('0x4'));var Mustache=require(_0x47ee('0x5'));var util=require(_0x47ee('0x6'));var path=require(_0x47ee('0x7'));var sox=require('sox');var csv=require(_0x47ee('0x8'));var ejs=require(_0x47ee('0x9'));var fs=require('fs');var fs_extra=require(_0x47ee('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x47ee('0xb'));var jsforce=require(_0x47ee('0xc'));var deskjs=require(_0x47ee('0xd'));var toCsv=require(_0x47ee('0x8'));var querystring=require(_0x47ee('0xe'));var Papa=require('papaparse');var Redis=require(_0x47ee('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x47ee('0x10'));var as=require(_0x47ee('0x11'));var hardwareService=require(_0x47ee('0x12'));var logger=require(_0x47ee('0x13'))(_0x47ee('0x14'));var utils=require(_0x47ee('0x15'));var config=require(_0x47ee('0x16'));var licenseUtil=require(_0x47ee('0x17'));var db=require(_0x47ee('0x18'))['db'];config['redis']=_[_0x47ee('0x19')](config['redis'],{'host':_0x47ee('0x1a'),'port':0x18eb});var socket=require(_0x47ee('0x1b'))(new Redis(config[_0x47ee('0x1c')]));require(_0x47ee('0x1d'))[_0x47ee('0x1e')](socket);function respondWithStatusCode(_0x39b84b,_0x49faf2){_0x49faf2=_0x49faf2||0xcc;return function(_0x20dc1f){if(_0x20dc1f){return _0x39b84b[_0x47ee('0x1f')](_0x49faf2);}return _0x39b84b[_0x47ee('0x20')](_0x49faf2)['end']();};}function respondWithResult(_0xc1cf5b,_0x3f8d28){_0x3f8d28=_0x3f8d28||0xc8;return function(_0x1c0d22){if(_0x1c0d22){return _0xc1cf5b[_0x47ee('0x20')](_0x3f8d28)[_0x47ee('0x21')](_0x1c0d22);}};}function respondWithFilteredResult(_0x28fbbf,_0x48c8e3){return function(_0x2b13fb){if(_0x2b13fb){var _0x4b2e96=typeof _0x48c8e3[_0x47ee('0x22')]==='undefined'&&typeof _0x48c8e3[_0x47ee('0x23')]==='undefined';var _0x164a9e=_0x2b13fb[_0x47ee('0x24')];var _0x1b758e=_0x4b2e96?0x0:_0x48c8e3[_0x47ee('0x22')];var _0x5dfe90=_0x4b2e96?_0x2b13fb[_0x47ee('0x24')]:_0x48c8e3[_0x47ee('0x22')]+_0x48c8e3[_0x47ee('0x23')];var _0x18f7da;if(_0x5dfe90>=_0x164a9e){_0x5dfe90=_0x164a9e;_0x18f7da=0xc8;}else{_0x18f7da=0xce;}_0x28fbbf[_0x47ee('0x20')](_0x18f7da);return _0x28fbbf['set'](_0x47ee('0x25'),_0x1b758e+'-'+_0x5dfe90+'/'+_0x164a9e)[_0x47ee('0x21')](_0x2b13fb);}return null;};}function patchUpdates(_0x540b31){return function(_0x269baa){try{jsonpatch[_0x47ee('0x26')](_0x269baa,_0x540b31,!![]);}catch(_0x5d3eb3){return BPromise[_0x47ee('0x27')](_0x5d3eb3);}return _0x269baa['save']();};}function saveUpdates(_0x519a87,_0x3cb0d9){return function(_0xc88dd7){if(_0xc88dd7){return _0xc88dd7[_0x47ee('0x28')](_0x519a87)['then'](function(_0x19be08){return _0x19be08;});}return null;};}function removeEntity(_0x5f49b0,_0x5d3988){return function(_0x56dbeb){if(_0x56dbeb){return _0x56dbeb[_0x47ee('0x29')]()['then'](function(){_0x5f49b0[_0x47ee('0x20')](0xcc)[_0x47ee('0x2a')]();});}};}function handleEntityNotFound(_0x59b9db,_0x5db8d9){return function(_0x1dc37b){if(!_0x1dc37b){_0x59b9db['sendStatus'](0x194);}return _0x1dc37b;};}function handleError(_0x13521d,_0x153adb){_0x153adb=_0x153adb||0x1f4;return function(_0x3b9bf4){logger[_0x47ee('0x2b')](_0x3b9bf4[_0x47ee('0x2c')]);if(_0x3b9bf4[_0x47ee('0x2d')]){delete _0x3b9bf4[_0x47ee('0x2d')];}_0x13521d['status'](_0x153adb)[_0x47ee('0x2e')](_0x3b9bf4);};}exports[_0x47ee('0x2f')]=function(_0x3e8d52,_0x49e3af){var _0x2e8560={},_0x2c71ed={},_0x2eff69={'count':0x0,'rows':[]};var _0x202180=_[_0x47ee('0x30')](db[_0x47ee('0x31')]['rawAttributes'],function(_0x13a291){return{'name':_0x13a291['fieldName'],'type':_0x13a291[_0x47ee('0x32')][_0x47ee('0x33')]};});_0x2c71ed[_0x47ee('0x34')]=_[_0x47ee('0x30')](_0x202180,'name');_0x2c71ed[_0x47ee('0x35')]=_[_0x47ee('0x36')](_0x3e8d52['query']);_0x2c71ed[_0x47ee('0x37')]=_[_0x47ee('0x38')](_0x2c71ed[_0x47ee('0x34')],_0x2c71ed['query']);_0x2e8560[_0x47ee('0x39')]=_[_0x47ee('0x38')](_0x2c71ed[_0x47ee('0x34')],qs[_0x47ee('0x3a')](_0x3e8d52[_0x47ee('0x35')]['fields']));_0x2e8560[_0x47ee('0x39')]=_0x2e8560['attributes'][_0x47ee('0x3b')]?_0x2e8560[_0x47ee('0x39')]:_0x2c71ed[_0x47ee('0x34')];if(!_0x3e8d52[_0x47ee('0x35')][_0x47ee('0x3c')](_0x47ee('0x3d'))){_0x2e8560[_0x47ee('0x23')]=qs['limit'](_0x3e8d52[_0x47ee('0x35')][_0x47ee('0x23')]);_0x2e8560['offset']=qs['offset'](_0x3e8d52[_0x47ee('0x35')][_0x47ee('0x22')]);}_0x2e8560[_0x47ee('0x3e')]=qs[_0x47ee('0x3f')](_0x3e8d52[_0x47ee('0x35')][_0x47ee('0x3f')]);_0x2e8560['where']=qs['filters'](_[_0x47ee('0x40')](_0x3e8d52['query'],_0x2c71ed['filters']),_0x202180);if(_0x3e8d52[_0x47ee('0x35')]['filter']){_0x2e8560[_0x47ee('0x41')]=_[_0x47ee('0x42')](_0x2e8560['where'],{'$or':_[_0x47ee('0x30')](_0x202180,function(_0x3a0875){if(_0x3a0875[_0x47ee('0x32')]!==_0x47ee('0x43')){var _0x3a2a7b={};_0x3a2a7b[_0x3a0875[_0x47ee('0x2d')]]={'$like':'%'+_0x3e8d52[_0x47ee('0x35')][_0x47ee('0x44')]+'%'};return _0x3a2a7b;}})});}_0x2e8560=_[_0x47ee('0x42')]({},_0x2e8560,_0x3e8d52['options']);var _0x2e66c0={'where':_0x2e8560[_0x47ee('0x41')]};return db[_0x47ee('0x31')]['count'](_0x2e66c0)[_0x47ee('0x45')](function(_0x1d2ac8){_0x2eff69[_0x47ee('0x24')]=_0x1d2ac8;if(_0x3e8d52[_0x47ee('0x35')][_0x47ee('0x46')]){_0x2e8560[_0x47ee('0x47')]=[{'all':!![]}];}return db[_0x47ee('0x31')]['findAll'](_0x2e8560);})['then'](function(_0x8c4aae){_0x2eff69[_0x47ee('0x48')]=_0x8c4aae;return _0x2eff69;})[_0x47ee('0x45')](respondWithFilteredResult(_0x49e3af,_0x2e8560))[_0x47ee('0x49')](handleError(_0x49e3af,null));};exports['show']=function(_0x57be36,_0x50ec30){var _0x120cff={'raw':![],'where':{'id':_0x57be36['params']['id']}},_0x3bc71a={};_0x3bc71a[_0x47ee('0x34')]=_[_0x47ee('0x36')](db[_0x47ee('0x31')][_0x47ee('0x4a')]);_0x3bc71a[_0x47ee('0x35')]=_[_0x47ee('0x36')](_0x57be36[_0x47ee('0x35')]);_0x3bc71a[_0x47ee('0x37')]=_[_0x47ee('0x38')](_0x3bc71a[_0x47ee('0x34')],_0x3bc71a[_0x47ee('0x35')]);_0x120cff['attributes']=_[_0x47ee('0x38')](_0x3bc71a[_0x47ee('0x34')],qs[_0x47ee('0x3a')](_0x57be36[_0x47ee('0x35')][_0x47ee('0x3a')]));_0x120cff[_0x47ee('0x39')]=_0x120cff[_0x47ee('0x39')][_0x47ee('0x3b')]?_0x120cff[_0x47ee('0x39')]:_0x3bc71a[_0x47ee('0x34')];if(_0x57be36['query'][_0x47ee('0x46')]){_0x120cff[_0x47ee('0x47')]=[{'all':!![]}];}_0x120cff=_['merge']({},_0x120cff,_0x57be36[_0x47ee('0x4b')]);return db[_0x47ee('0x31')][_0x47ee('0x4c')](_0x120cff)[_0x47ee('0x45')](handleEntityNotFound(_0x50ec30,null))['then'](respondWithResult(_0x50ec30,null))[_0x47ee('0x49')](handleError(_0x50ec30,null));};exports[_0x47ee('0x4d')]=function(_0x30c708,_0x5e7064){return db[_0x47ee('0x31')][_0x47ee('0x4d')](_0x30c708[_0x47ee('0x4e')],{})['then'](respondWithResult(_0x5e7064,0xc9))[_0x47ee('0x49')](handleError(_0x5e7064,null));};exports['update']=function(_0x300847,_0x474110){if(_0x300847[_0x47ee('0x4e')]['id']){delete _0x300847[_0x47ee('0x4e')]['id'];}return db[_0x47ee('0x31')]['find']({'where':{'id':_0x300847[_0x47ee('0x4f')]['id']}})[_0x47ee('0x45')](handleEntityNotFound(_0x474110,null))[_0x47ee('0x45')](saveUpdates(_0x300847['body'],null))[_0x47ee('0x45')](respondWithResult(_0x474110,null))[_0x47ee('0x49')](handleError(_0x474110,null));};exports[_0x47ee('0x29')]=function(_0x29aa19,_0x1e0d8d){return db[_0x47ee('0x31')]['find']({'where':{'id':_0x29aa19[_0x47ee('0x4f')]['id']}})[_0x47ee('0x45')](handleEntityNotFound(_0x1e0d8d,null))[_0x47ee('0x45')](removeEntity(_0x1e0d8d,null))[_0x47ee('0x49')](handleError(_0x1e0d8d,null));};exports['describe']=function(_0x201706,_0x422127){return db[_0x47ee('0x31')][_0x47ee('0x50')]()[_0x47ee('0x45')](respondWithResult(_0x422127,null))[_0x47ee('0x49')](handleError(_0x422127,null));};exports[_0x47ee('0x51')]=function(_0x1ffb6e,_0x688cbb){var _0xb0df45={},_0xbab534={},_0x4cd8d3={'count':0x0,'rows':[]};_0xbab534[_0x47ee('0x34')]=_['keys'](db[_0x47ee('0x31')][_0x47ee('0x4a')]);_0xbab534[_0x47ee('0x35')]=_['keys'](_0x1ffb6e['query']);_0xbab534[_0x47ee('0x37')]=_[_0x47ee('0x38')](_0xbab534[_0x47ee('0x34')],_0xbab534[_0x47ee('0x35')]);_0xb0df45[_0x47ee('0x39')]=_[_0x47ee('0x38')](_0xbab534[_0x47ee('0x34')],qs['fields'](_0x1ffb6e[_0x47ee('0x35')]['fields']));_0xb0df45[_0x47ee('0x39')]=_0xb0df45[_0x47ee('0x39')]['length']?_0xb0df45['attributes']:_0xbab534[_0x47ee('0x34')];if(!_0x1ffb6e[_0x47ee('0x35')][_0x47ee('0x3c')](_0x47ee('0x3d'))){_0xb0df45[_0x47ee('0x23')]=qs[_0x47ee('0x23')](_0x1ffb6e['query'][_0x47ee('0x23')]);_0xb0df45[_0x47ee('0x22')]=qs['offset'](_0x1ffb6e[_0x47ee('0x35')]['offset']);}_0xb0df45['order']=qs[_0x47ee('0x3f')](_0x1ffb6e[_0x47ee('0x35')][_0x47ee('0x3f')]);_0xb0df45[_0x47ee('0x41')]=qs['filters'](_['pick'](_0x1ffb6e[_0x47ee('0x35')],_0xbab534[_0x47ee('0x37')]));if(_0x1ffb6e[_0x47ee('0x35')]['filter']){_0xb0df45[_0x47ee('0x41')]=_[_0x47ee('0x42')](_0xb0df45['where'],{'$or':_[_0x47ee('0x30')](_0xb0df45[_0x47ee('0x39')],function(_0x12fc50){var _0x505a30={};_0x505a30[_0x12fc50]={'$like':'%'+_0x1ffb6e[_0x47ee('0x35')][_0x47ee('0x44')]+'%'};return _0x505a30;})});}_0xb0df45=_[_0x47ee('0x42')]({},_0xb0df45,_0x1ffb6e[_0x47ee('0x4b')]);var _0x484de7={'where':_0xb0df45[_0x47ee('0x41')]};return db[_0x47ee('0x31')][_0x47ee('0x24')](_0x484de7)[_0x47ee('0x45')](function(_0xd08732){_0x4cd8d3['count']=_0xd08732;if(_0x1ffb6e[_0x47ee('0x35')][_0x47ee('0x46')]){_0xb0df45[_0x47ee('0x47')]=[{'all':!![]}];}return db[_0x47ee('0x31')][_0x47ee('0x52')](_0xb0df45);})[_0x47ee('0x45')](function(_0x9d17cb){_0x4cd8d3[_0x47ee('0x48')]=_0x9d17cb;return _0x4cd8d3;})[_0x47ee('0x45')](respondWithFilteredResult(_0x688cbb,_0xb0df45,_0x47ee('0x51')))['catch'](handleError(_0x688cbb,null,_0x47ee('0x51')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 812b10c..6bdf236 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 _0xf663=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','update','remove','emit'];(function(_0x11a53c,_0x486647){var _0x119348=function(_0x416318){while(--_0x416318){_0x11a53c['push'](_0x11a53c['shift']());}};_0x119348(++_0x486647);}(_0xf663,0x111));var _0x3f66=function(_0x55cbb6,_0x4387ec){_0x55cbb6=_0x55cbb6-0x0;var _0x28699c=_0xf663[_0x55cbb6];return _0x28699c;};'use strict';var EventEmitter=require(_0x3f66('0x0'));var VoiceQueueReport=require(_0x3f66('0x1'))['db'][_0x3f66('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x3f66('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3f66('0x4'),'afterDestroy':_0x3f66('0x5')};function emitEvent(_0x54b391){return function(_0x4f5281,_0x1d6a73,_0x26a990){VoiceQueueReportEvents[_0x3f66('0x6')](_0x54b391+':'+_0x4f5281['id'],_0x4f5281);VoiceQueueReportEvents['emit'](_0x54b391,_0x4f5281);_0x26a990(null);};}for(var e in events){if(events[_0x3f66('0x7')](e)){var event=events[e];VoiceQueueReport[_0x3f66('0x8')](e,emitEvent(event));}}module[_0x3f66('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xf65f=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x1c4e87,_0x77a3dd){var _0x36725e=function(_0x287db7){while(--_0x287db7){_0x1c4e87['push'](_0x1c4e87['shift']());}};_0x36725e(++_0x77a3dd);}(_0xf65f,0xd0));var _0xff65=function(_0x508849,_0x149f0b){_0x508849=_0x508849-0x0;var _0x3a77bb=_0xf65f[_0x508849];return _0x3a77bb;};'use strict';var EventEmitter=require(_0xff65('0x0'));var VoiceQueueReport=require(_0xff65('0x1'))['db'][_0xff65('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xff65('0x3')](0x0);var events={'afterCreate':_0xff65('0x4'),'afterUpdate':_0xff65('0x5'),'afterDestroy':_0xff65('0x6')};function emitEvent(_0x2001e5){return function(_0x182b15,_0xae87c2,_0x8bd399){VoiceQueueReportEvents[_0xff65('0x7')](_0x2001e5+':'+_0x182b15['id'],_0x182b15);VoiceQueueReportEvents['emit'](_0x2001e5,_0x182b15);_0x8bd399(null);};}for(var e in events){if(events[_0xff65('0x8')](e)){var event=events[e];VoiceQueueReport[_0xff65('0x9')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index ccea01d..e30a9da 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 _0x5f66=['request-promise','path','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','moment','bluebird'];(function(_0x94bbc6,_0x121f6a){var _0x55c6cd=function(_0xe73d7f){while(--_0xe73d7f){_0x94bbc6['push'](_0x94bbc6['shift']());}};_0x55c6cd(++_0x121f6a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[{'fields':[_0x65f6('0xa')]},{'fields':[_0x65f6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['define','report_queue','uniqueid','calleridnum','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x2f8805,_0x2f1d21){var _0xa16375=function(_0x1c5bcc){while(--_0x1c5bcc){_0x2f8805['push'](_0x2f8805['shift']());}};_0xa16375(++_0x2f1d21);}(_0xb10b,0x12a));var _0xbb10=function(_0x105c6a,_0x48c736){_0x105c6a=_0x105c6a-0x0;var _0x5b844d=_0xb10b[_0x105c6a];return _0x5b844d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('VoiceQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'fields':[_0xbb10('0xc')]},{'fields':[_0xbb10('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 7b20602..7c728bc 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 _0x2222=['client','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','limit','include','map','model','attributes','catch','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x21c81e,_0x5de28f){var _0x16a6d7=function(_0x91beeb){while(--_0x91beeb){_0x21c81e['push'](_0x21c81e['shift']());}};_0x16a6d7(++_0x5de28f);}(_0x2222,0xf4));var _0x2222=function(_0x1b671f,_0x38bfe6){_0x1b671f=_0x1b671f-0x0;var _0x3899a=_0x2222[_0x1b671f];return _0x3899a;};'use strict';var _=require(_0x2222('0x0'));var util=require(_0x2222('0x1'));var moment=require(_0x2222('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2222('0x3'))['db'];var utils=require(_0x2222('0x4'));var logger=require(_0x2222('0x5'))(_0x2222('0x6'));var config=require(_0x2222('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2222('0x8')][_0x2222('0x9')]({'port':0x232a});config[_0x2222('0xa')]=_['defaults'](config['redis'],{'host':_0x2222('0xb'),'port':0x18eb});var socket=require(_0x2222('0xc'))(new Redis(config['redis']));require(_0x2222('0xd'))['register'](socket);function respondWithRpcPromise(_0x5b66e4,_0x34e250,_0x285835){return new BPromise(function(_0x36cd38,_0x3abcef){return client[_0x2222('0xe')](_0x5b66e4,_0x285835)[_0x2222('0xf')](function(_0x539ae1){logger['info'](_0x2222('0x10'),_0x34e250,_0x2222('0x11'));logger[_0x2222('0x12')](_0x2222('0x13'),_0x34e250,_0x2222('0x11'),JSON[_0x2222('0x14')](_0x539ae1));if(_0x539ae1['error']){if(_0x539ae1[_0x2222('0x15')][_0x2222('0x16')]===0x1f4){logger[_0x2222('0x15')](_0x2222('0x10'),_0x34e250,_0x539ae1[_0x2222('0x15')][_0x2222('0x17')]);return _0x3abcef(_0x539ae1[_0x2222('0x15')][_0x2222('0x17')]);}logger[_0x2222('0x15')](_0x2222('0x10'),_0x34e250,_0x539ae1['error'][_0x2222('0x17')]);return _0x36cd38(_0x539ae1[_0x2222('0x15')][_0x2222('0x17')]);}else{logger[_0x2222('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x34e250,'request\x20sent');_0x36cd38(_0x539ae1['result'][_0x2222('0x17')]);}})['catch'](function(_0x650ce){logger[_0x2222('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x34e250,_0x650ce);_0x3abcef(_0x650ce);});});}exports[_0x2222('0x19')]=function(_0x113633){var _0x21e5c8=this;return new Promise(function(_0x114da,_0x3f7aae){return db[_0x2222('0x1a')][_0x2222('0x1b')]({'raw':_0x113633[_0x2222('0x1c')]?_0x113633['options'][_0x2222('0x1d')]===undefined?!![]:![]:!![],'where':_0x113633[_0x2222('0x1c')]?_0x113633[_0x2222('0x1c')][_0x2222('0x1e')]||null:null,'attributes':_0x113633['options']?_0x113633[_0x2222('0x1c')]['attributes']||null:null,'limit':_0x113633[_0x2222('0x1c')]?_0x113633[_0x2222('0x1c')][_0x2222('0x1f')]||null:null,'include':_0x113633[_0x2222('0x1c')]?_0x113633[_0x2222('0x1c')][_0x2222('0x20')]?_[_0x2222('0x21')](_0x113633['options']['include'],function(_0xfa8659){return{'model':db[_0xfa8659[_0x2222('0x22')]],'as':_0xfa8659['as'],'attributes':_0xfa8659[_0x2222('0x23')],'include':_0xfa8659[_0x2222('0x20')]?_[_0x2222('0x21')](_0xfa8659['include'],function(_0x56c762){return{'model':db[_0x56c762[_0x2222('0x22')]],'as':_0x56c762['as'],'attributes':_0x56c762['attributes'],'include':_0x56c762[_0x2222('0x20')]?_[_0x2222('0x21')](_0x56c762[_0x2222('0x20')],function(_0x50626f){return{'model':db[_0x50626f['model']],'as':_0x50626f['as'],'attributes':_0x50626f[_0x2222('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2222('0xf')](function(_0x5270e9){logger[_0x2222('0x18')](_0x2222('0x19'),_0x113633);logger['debug'](_0x2222('0x19'),_0x113633,JSON[_0x2222('0x14')](_0x5270e9));_0x114da(_0x5270e9);})[_0x2222('0x24')](function(_0x269a4c){logger[_0x2222('0x15')](_0x2222('0x19'),_0x269a4c[_0x2222('0x17')],_0x113633);_0x3f7aae(_0x21e5c8[_0x2222('0x15')](0x1f4,_0x269a4c[_0x2222('0x17')]));});});};exports[_0x2222('0x25')]=function(_0x328423){var _0x11c37c=this;return new Promise(function(_0x638ca1,_0x572cd3){return db[_0x2222('0x1a')][_0x2222('0x26')](_0x328423[_0x2222('0x27')],{'raw':_0x328423[_0x2222('0x1c')]?_0x328423[_0x2222('0x1c')][_0x2222('0x1d')]===undefined?!![]:![]:!![]})[_0x2222('0xf')](function(_0x29d02b){logger[_0x2222('0x18')](_0x2222('0x25'),_0x328423);logger[_0x2222('0x12')]('CreateVoiceQueueReport',_0x328423,JSON['stringify'](_0x29d02b));_0x638ca1(_0x29d02b);})[_0x2222('0x24')](function(_0x4db959){logger[_0x2222('0x15')](_0x2222('0x25'),_0x4db959[_0x2222('0x17')],_0x328423);_0x572cd3(_0x11c37c['error'](0x1f4,_0x4db959[_0x2222('0x17')]));});});};exports[_0x2222('0x28')]=function(_0x49d4a6){var _0x2ad213=this;return new Promise(function(_0x5b933a,_0x4d8a80){return db[_0x2222('0x1a')][_0x2222('0x29')](_0x49d4a6['body'],{'raw':_0x49d4a6[_0x2222('0x1c')]?_0x49d4a6[_0x2222('0x1c')][_0x2222('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49d4a6[_0x2222('0x1c')]?_0x49d4a6[_0x2222('0x1c')][_0x2222('0x1e')]||null:null,'attributes':_0x49d4a6[_0x2222('0x1c')]?_0x49d4a6[_0x2222('0x1c')][_0x2222('0x23')]||null:null,'limit':_0x49d4a6[_0x2222('0x1c')]?_0x49d4a6['options'][_0x2222('0x1f')]||null:null})[_0x2222('0xf')](function(_0x1ddab8){logger[_0x2222('0x18')]('UpdateVoiceQueueReport',_0x49d4a6);logger[_0x2222('0x12')](_0x2222('0x28'),_0x49d4a6,JSON[_0x2222('0x14')](_0x1ddab8));_0x5b933a(_0x1ddab8);})[_0x2222('0x24')](function(_0x3f1a73){logger[_0x2222('0x15')](_0x2222('0x28'),_0x3f1a73[_0x2222('0x17')],_0x49d4a6);_0x4d8a80(_0x2ad213[_0x2222('0x15')](0x1f4,_0x3f1a73[_0x2222('0x17')]));});});}; \ No newline at end of file +var _0x52f2=['result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','limit','map','include','model','attributes','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueueReport,\x20%s,\x20%s','info'];(function(_0x488f46,_0x54b996){var _0x23fbac=function(_0x19e8e1){while(--_0x19e8e1){_0x488f46['push'](_0x488f46['shift']());}};_0x23fbac(++_0x54b996);}(_0x52f2,0x98));var _0x252f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x52f2[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x252f('0x0'));var util=require(_0x252f('0x1'));var moment=require(_0x252f('0x2'));var BPromise=require(_0x252f('0x3'));var rs=require(_0x252f('0x4'));var fs=require('fs');var Redis=require(_0x252f('0x5'));var db=require(_0x252f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x252f('0x7'))(_0x252f('0x8'));var config=require(_0x252f('0x9'));var jayson=require(_0x252f('0xa'));var client=jayson[_0x252f('0xb')]['http']({'port':0x232a});config[_0x252f('0xc')]=_['defaults'](config[_0x252f('0xc')],{'host':_0x252f('0xd'),'port':0x18eb});var socket=require(_0x252f('0xe'))(new Redis(config[_0x252f('0xc')]));require(_0x252f('0xf'))[_0x252f('0x10')](socket);function respondWithRpcPromise(_0x42deed,_0x2d5ff1,_0x153671){return new BPromise(function(_0x242b82,_0x4a2820){return client[_0x252f('0x11')](_0x42deed,_0x153671)[_0x252f('0x12')](function(_0x1b6114){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x2d5ff1,_0x252f('0x13'));logger[_0x252f('0x14')](_0x252f('0x15'),_0x2d5ff1,_0x252f('0x13'),JSON[_0x252f('0x16')](_0x1b6114));if(_0x1b6114[_0x252f('0x17')]){if(_0x1b6114['error'][_0x252f('0x18')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x2d5ff1,_0x1b6114[_0x252f('0x17')][_0x252f('0x19')]);return _0x4a2820(_0x1b6114[_0x252f('0x17')]['message']);}logger[_0x252f('0x17')](_0x252f('0x1a'),_0x2d5ff1,_0x1b6114[_0x252f('0x17')]['message']);return _0x242b82(_0x1b6114[_0x252f('0x17')][_0x252f('0x19')]);}else{logger[_0x252f('0x1b')](_0x252f('0x1a'),_0x2d5ff1,_0x252f('0x13'));_0x242b82(_0x1b6114[_0x252f('0x1c')][_0x252f('0x19')]);}})[_0x252f('0x1d')](function(_0x1882c3){logger['error'](_0x252f('0x1a'),_0x2d5ff1,_0x1882c3);_0x4a2820(_0x1882c3);});});}exports[_0x252f('0x1e')]=function(_0x5331e4){var _0x4c2c69=this;return new Promise(function(_0x5b75fa,_0x11bc0a){return db[_0x252f('0x1f')][_0x252f('0x20')]({'raw':_0x5331e4['options']?_0x5331e4[_0x252f('0x21')][_0x252f('0x22')]===undefined?!![]:![]:!![],'where':_0x5331e4[_0x252f('0x21')]?_0x5331e4[_0x252f('0x21')]['where']||null:null,'attributes':_0x5331e4[_0x252f('0x21')]?_0x5331e4[_0x252f('0x21')]['attributes']||null:null,'limit':_0x5331e4[_0x252f('0x21')]?_0x5331e4[_0x252f('0x21')][_0x252f('0x23')]||null:null,'include':_0x5331e4['options']?_0x5331e4[_0x252f('0x21')]['include']?_[_0x252f('0x24')](_0x5331e4[_0x252f('0x21')]['include'],function(_0x5c8f63){return{'model':db[_0x5c8f63['model']],'as':_0x5c8f63['as'],'attributes':_0x5c8f63['attributes'],'include':_0x5c8f63[_0x252f('0x25')]?_[_0x252f('0x24')](_0x5c8f63[_0x252f('0x25')],function(_0xe2eb18){return{'model':db[_0xe2eb18['model']],'as':_0xe2eb18['as'],'attributes':_0xe2eb18['attributes'],'include':_0xe2eb18[_0x252f('0x25')]?_['map'](_0xe2eb18[_0x252f('0x25')],function(_0x25fdc9){return{'model':db[_0x25fdc9[_0x252f('0x26')]],'as':_0x25fdc9['as'],'attributes':_0x25fdc9[_0x252f('0x27')]};}):[]};}):[]};}):[]:[]})[_0x252f('0x12')](function(_0xc2e166){logger[_0x252f('0x1b')](_0x252f('0x1e'),_0x5331e4);logger['debug'](_0x252f('0x1e'),_0x5331e4,JSON[_0x252f('0x16')](_0xc2e166));_0x5b75fa(_0xc2e166);})[_0x252f('0x1d')](function(_0x413803){logger['error'](_0x252f('0x1e'),_0x413803[_0x252f('0x19')],_0x5331e4);_0x11bc0a(_0x4c2c69['error'](0x1f4,_0x413803[_0x252f('0x19')]));});});};exports[_0x252f('0x28')]=function(_0x350ce6){var _0x3efed0=this;return new Promise(function(_0x49cadf,_0x1e6dbe){return db[_0x252f('0x1f')][_0x252f('0x29')](_0x350ce6[_0x252f('0x2a')],{'raw':_0x350ce6[_0x252f('0x21')]?_0x350ce6['options'][_0x252f('0x22')]===undefined?!![]:![]:!![]})[_0x252f('0x12')](function(_0x495b31){logger[_0x252f('0x1b')]('CreateVoiceQueueReport',_0x350ce6);logger['debug']('CreateVoiceQueueReport',_0x350ce6,JSON[_0x252f('0x16')](_0x495b31));_0x49cadf(_0x495b31);})['catch'](function(_0x27ec0d){logger[_0x252f('0x17')]('CreateVoiceQueueReport',_0x27ec0d[_0x252f('0x19')],_0x350ce6);_0x1e6dbe(_0x3efed0[_0x252f('0x17')](0x1f4,_0x27ec0d['message']));});});};exports[_0x252f('0x2b')]=function(_0x117e62){var _0x314a66=this;return new Promise(function(_0x257008,_0x4e7c75){return db[_0x252f('0x1f')]['update'](_0x117e62[_0x252f('0x2a')],{'raw':_0x117e62[_0x252f('0x21')]?_0x117e62[_0x252f('0x21')][_0x252f('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x117e62['options']?_0x117e62[_0x252f('0x21')][_0x252f('0x2c')]||null:null,'attributes':_0x117e62[_0x252f('0x21')]?_0x117e62[_0x252f('0x21')]['attributes']||null:null,'limit':_0x117e62[_0x252f('0x21')]?_0x117e62[_0x252f('0x21')]['limit']||null:null})[_0x252f('0x12')](function(_0x42b3ce){logger[_0x252f('0x1b')](_0x252f('0x2b'),_0x117e62);logger[_0x252f('0x14')](_0x252f('0x2b'),_0x117e62,JSON[_0x252f('0x16')](_0x42b3ce));_0x257008(_0x42b3ce);})[_0x252f('0x1d')](function(_0x190e82){logger[_0x252f('0x17')](_0x252f('0x2b'),_0x190e82[_0x252f('0x19')],_0x117e62);_0x4e7c75(_0x314a66[_0x252f('0x17')](0x1f4,_0x190e82['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 065c703..d77a25d 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 _0x13ab=['emit','removeListener','register','./voiceQueueReport.events','save','update'];(function(_0x3d5662,_0x2fa086){var _0x4eb735=function(_0x34b555){while(--_0x34b555){_0x3d5662['push'](_0x3d5662['shift']());}};_0x4eb735(++_0x2fa086);}(_0x13ab,0x189));var _0xb13a=function(_0x42c364,_0x401bf0){_0x42c364=_0x42c364-0x0;var _0xb66d1e=_0x13ab[_0x42c364];return _0xb66d1e;};'use strict';var VoiceQueueReportEvents=require(_0xb13a('0x0'));var events=[_0xb13a('0x1'),'remove',_0xb13a('0x2')];function createListener(_0x2ea36e,_0x235fd2){return function(_0x1ef637){_0x235fd2[_0xb13a('0x3')](_0x2ea36e,_0x1ef637);};}function removeListener(_0x395efb,_0x490d12){return function(){VoiceQueueReportEvents[_0xb13a('0x4')](_0x395efb,_0x490d12);};}exports[_0xb13a('0x5')]=function(_0x2eb506){for(var _0x320984=0x0,_0x41270c=events['length'];_0x320984<_0x41270c;_0x320984++){var _0x31b0a3=events[_0x320984];var _0x38d3f5=createListener('voiceQueueReport:'+_0x31b0a3,_0x2eb506);VoiceQueueReportEvents['on'](_0x31b0a3,_0x38d3f5);}}; \ No newline at end of file +var _0xc8cc=['update','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x4fd7d8,_0x15ef62){var _0x4e31bf=function(_0x41984c){while(--_0x41984c){_0x4fd7d8['push'](_0x4fd7d8['shift']());}};_0x4e31bf(++_0x15ef62);}(_0xc8cc,0x1b6));var _0xcc8c=function(_0x1e33fd,_0x12d3a5){_0x1e33fd=_0x1e33fd-0x0;var _0x4f4ea7=_0xc8cc[_0x1e33fd];return _0x4f4ea7;};'use strict';var VoiceQueueReportEvents=require(_0xcc8c('0x0'));var events=[_0xcc8c('0x1'),_0xcc8c('0x2'),_0xcc8c('0x3')];function createListener(_0x36e4ae,_0x1bdbe9){return function(_0x2b272d){_0x1bdbe9[_0xcc8c('0x4')](_0x36e4ae,_0x2b272d);};}function removeListener(_0x1ca193,_0x1494c1){return function(){VoiceQueueReportEvents[_0xcc8c('0x5')](_0x1ca193,_0x1494c1);};}exports[_0xcc8c('0x6')]=function(_0x27885d){for(var _0x544cdf=0x0,_0x3b1362=events[_0xcc8c('0x7')];_0x544cdf<_0x3b1362;_0x544cdf++){var _0x1b0b39=events[_0x544cdf];var _0x401c6c=createListener(_0xcc8c('0x8')+_0x1b0b39,_0x27885d);VoiceQueueReportEvents['on'](_0x1b0b39,_0x401c6c);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index e257918..0ee782b 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 _0x4279=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','post','create','update','delete','destroy','exports','util','path','express'];(function(_0x50aec5,_0x12464c){var _0x3b86c4=function(_0x4d457b){while(--_0x4d457b){_0x50aec5['push'](_0x50aec5['shift']());}};_0x3b86c4(++_0x12464c);}(_0x4279,0x8d));var _0x9427=function(_0x45e323,_0x9d791f){_0x45e323=_0x45e323-0x0;var _0x8c3a58=_0x4279[_0x45e323];return _0x8c3a58;};'use strict';var multer=require('multer');var util=require(_0x9427('0x0'));var path=require(_0x9427('0x1'));var timeout=require('connect-timeout');var express=require(_0x9427('0x2'));var router=express[_0x9427('0x3')]();var fs_extra=require(_0x9427('0x4'));var auth=require(_0x9427('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9427('0x6'));var controller=require('./voiceQueuesLog.controller');router[_0x9427('0x7')]('/',auth[_0x9427('0x8')](),controller['index']);router[_0x9427('0x7')](_0x9427('0x9'),auth[_0x9427('0x8')](),controller['show']);router[_0x9427('0xa')]('/',auth['isAuthenticated'](),controller[_0x9427('0xb')]);router['put']('/:id',auth[_0x9427('0x8')](),controller[_0x9427('0xc')]);router[_0x9427('0xd')](_0x9427('0x9'),auth[_0x9427('0x8')](),controller[_0x9427('0xe')]);module[_0x9427('0xf')]=router; \ No newline at end of file +var _0x3024=['connect-timeout','express','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x39b271,_0x5be709){var _0x47b473=function(_0x3ef910){while(--_0x3ef910){_0x39b271['push'](_0x39b271['shift']());}};_0x47b473(++_0x5be709);}(_0x3024,0x64));var _0x4302=function(_0x5a8d27,_0x1aa051){_0x5a8d27=_0x5a8d27-0x0;var _0x227e66=_0x3024[_0x5a8d27];return _0x227e66;};'use strict';var multer=require(_0x4302('0x0'));var util=require(_0x4302('0x1'));var path=require('path');var timeout=require(_0x4302('0x2'));var express=require(_0x4302('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4302('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4302('0x5'));var controller=require(_0x4302('0x6'));router['get']('/',auth[_0x4302('0x7')](),controller[_0x4302('0x8')]);router['get'](_0x4302('0x9'),auth[_0x4302('0x7')](),controller[_0x4302('0xa')]);router[_0x4302('0xb')]('/',auth[_0x4302('0x7')](),controller[_0x4302('0xc')]);router[_0x4302('0xd')]('/:id',auth[_0x4302('0x7')](),controller[_0x4302('0xe')]);router[_0x4302('0xf')]('/:id',auth[_0x4302('0x7')](),controller[_0x4302('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 4f424b8..6b8dc8e 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 _0x5360=['exports','STRING','DATE','format','sequelize','moment'];(function(_0x5c1745,_0x53ab53){var _0x47f86a=function(_0x1bdc72){while(--_0x1bdc72){_0x5c1745['push'](_0x5c1745['shift']());}};_0x47f86a(++_0x53ab53);}(_0x5360,0x1d2));var _0x0536=function(_0x21a080,_0xf3f007){_0x21a080=_0x21a080-0x0;var _0x27c3cf=_0x5360[_0x21a080];return _0x27c3cf;};'use strict';var Sequelize=require(_0x0536('0x0'));var moment=require(_0x0536('0x1'));module[_0x0536('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x0536('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x0536('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x0536('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x0536('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x0536('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x0536('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x0536('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x0536('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x0536('0x4')],'allowNull':![],'defaultValue':moment()[_0x0536('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x2fa4=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2fa4,0xe1));var _0x42fa=function(_0x198212,_0x4bd29a){_0x198212=_0x198212-0x0;var _0x338328=_0x2fa4[_0x198212];return _0x338328;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x42fa('0x0'));module[_0x42fa('0x1')]={'time':{'type':Sequelize[_0x42fa('0x2')]},'callid':{'type':Sequelize[_0x42fa('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x42fa('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x42fa('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x42fa('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x42fa('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x42fa('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x42fa('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x42fa('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x42fa('0x3')],'allowNull':![],'defaultValue':moment()[_0x42fa('0x4')](_0x42fa('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index d2df9dd..15e50b2 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 _0x21dc=['index','map','VoiceQueuesLog','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','error','name'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x21dc,0x151));var _0xc21d=function(_0x31cb83,_0x87a35e){_0x31cb83=_0x31cb83-0x0;var _0x351a6d=_0x21dc[_0x31cb83];return _0x351a6d;};'use strict';var emlformat=require(_0xc21d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc21d('0x1'));var jsonpatch=require(_0xc21d('0x2'));var rp=require(_0xc21d('0x3'));var moment=require(_0xc21d('0x4'));var BPromise=require(_0xc21d('0x5'));var Mustache=require('mustache');var util=require(_0xc21d('0x6'));var path=require('path');var sox=require(_0xc21d('0x7'));var csv=require('to-csv');var ejs=require(_0xc21d('0x8'));var fs=require('fs');var fs_extra=require(_0xc21d('0x9'));var _=require(_0xc21d('0xa'));var squel=require(_0xc21d('0xb'));var crypto=require(_0xc21d('0xc'));var jsforce=require(_0xc21d('0xd'));var deskjs=require(_0xc21d('0xe'));var toCsv=require(_0xc21d('0xf'));var querystring=require(_0xc21d('0x10'));var Papa=require(_0xc21d('0x11'));var Redis=require('ioredis');var authService=require(_0xc21d('0x12'));var qs=require(_0xc21d('0x13'));var as=require(_0xc21d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc21d('0x15'))(_0xc21d('0x16'));var utils=require(_0xc21d('0x17'));var config=require(_0xc21d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc21d('0x19'))['db'];function respondWithStatusCode(_0x5d9b0f,_0x50b94f){_0x50b94f=_0x50b94f||0xcc;return function(_0x2ce1e4){if(_0x2ce1e4){return _0x5d9b0f[_0xc21d('0x1a')](_0x50b94f);}return _0x5d9b0f[_0xc21d('0x1b')](_0x50b94f)['end']();};}function respondWithResult(_0xe35a59,_0x10d4de){_0x10d4de=_0x10d4de||0xc8;return function(_0x2188e9){if(_0x2188e9){return _0xe35a59[_0xc21d('0x1b')](_0x10d4de)[_0xc21d('0x1c')](_0x2188e9);}};}function respondWithFilteredResult(_0x40baa6,_0x5d5e19){return function(_0x3dfd11){if(_0x3dfd11){var _0x32826b=typeof _0x5d5e19[_0xc21d('0x1d')]==='undefined'&&typeof _0x5d5e19[_0xc21d('0x1e')]===_0xc21d('0x1f');var _0x5a8680=_0x3dfd11[_0xc21d('0x20')];var _0x5f509f=_0x32826b?0x0:_0x5d5e19[_0xc21d('0x1d')];var _0x30bc86=_0x32826b?_0x3dfd11[_0xc21d('0x20')]:_0x5d5e19['offset']+_0x5d5e19[_0xc21d('0x1e')];var _0x3d2ca1;if(_0x30bc86>=_0x5a8680){_0x30bc86=_0x5a8680;_0x3d2ca1=0xc8;}else{_0x3d2ca1=0xce;}_0x40baa6[_0xc21d('0x1b')](_0x3d2ca1);return _0x40baa6[_0xc21d('0x21')](_0xc21d('0x22'),_0x5f509f+'-'+_0x30bc86+'/'+_0x5a8680)[_0xc21d('0x1c')](_0x3dfd11);}return null;};}function patchUpdates(_0x4c022a){return function(_0x4789a1){try{jsonpatch[_0xc21d('0x23')](_0x4789a1,_0x4c022a,!![]);}catch(_0x3ec73b){return BPromise[_0xc21d('0x24')](_0x3ec73b);}return _0x4789a1['save']();};}function saveUpdates(_0x2a33e7,_0x2948d5){return function(_0x5b7849){if(_0x5b7849){return _0x5b7849[_0xc21d('0x25')](_0x2a33e7)[_0xc21d('0x26')](function(_0xfe0340){return _0xfe0340;});}return null;};}function removeEntity(_0x3492e5,_0x4b14bf){return function(_0x2cf588){if(_0x2cf588){return _0x2cf588[_0xc21d('0x27')]()[_0xc21d('0x26')](function(){_0x3492e5[_0xc21d('0x1b')](0xcc)[_0xc21d('0x28')]();});}};}function handleEntityNotFound(_0x214169,_0x274811){return function(_0x1e40aa){if(!_0x1e40aa){_0x214169[_0xc21d('0x1a')](0x194);}return _0x1e40aa;};}function handleError(_0x1b6e7a,_0x1c898a){_0x1c898a=_0x1c898a||0x1f4;return function(_0x363a6a){logger[_0xc21d('0x29')](_0x363a6a['stack']);if(_0x363a6a['name']){delete _0x363a6a[_0xc21d('0x2a')];}_0x1b6e7a[_0xc21d('0x1b')](_0x1c898a)['send'](_0x363a6a);};}exports[_0xc21d('0x2b')]=function(_0x11e20b,_0x271647){var _0x2cc7fd={},_0x492456={},_0x503f54={'count':0x0,'rows':[]};var _0x21c235=_[_0xc21d('0x2c')](db[_0xc21d('0x2d')][_0xc21d('0x2e')],function(_0x443b1d){return{'name':_0x443b1d['fieldName'],'type':_0x443b1d[_0xc21d('0x2f')][_0xc21d('0x30')]};});_0x492456[_0xc21d('0x31')]=_[_0xc21d('0x2c')](_0x21c235,_0xc21d('0x2a'));_0x492456['query']=_[_0xc21d('0x32')](_0x11e20b[_0xc21d('0x33')]);_0x492456['filters']=_['intersection'](_0x492456[_0xc21d('0x31')],_0x492456[_0xc21d('0x33')]);_0x2cc7fd[_0xc21d('0x34')]=_[_0xc21d('0x35')](_0x492456[_0xc21d('0x31')],qs[_0xc21d('0x36')](_0x11e20b[_0xc21d('0x33')][_0xc21d('0x36')]));_0x2cc7fd[_0xc21d('0x34')]=_0x2cc7fd['attributes'][_0xc21d('0x37')]?_0x2cc7fd[_0xc21d('0x34')]:_0x492456['model'];if(!_0x11e20b[_0xc21d('0x33')]['hasOwnProperty'](_0xc21d('0x38'))){_0x2cc7fd[_0xc21d('0x1e')]=qs[_0xc21d('0x1e')](_0x11e20b[_0xc21d('0x33')]['limit']);_0x2cc7fd[_0xc21d('0x1d')]=qs[_0xc21d('0x1d')](_0x11e20b['query'][_0xc21d('0x1d')]);}_0x2cc7fd[_0xc21d('0x39')]=qs[_0xc21d('0x3a')](_0x11e20b['query'][_0xc21d('0x3a')]);_0x2cc7fd[_0xc21d('0x3b')]=qs[_0xc21d('0x3c')](_[_0xc21d('0x3d')](_0x11e20b[_0xc21d('0x33')],_0x492456[_0xc21d('0x3c')]),_0x21c235);if(_0x11e20b[_0xc21d('0x33')][_0xc21d('0x3e')]){_0x2cc7fd[_0xc21d('0x3b')]=_[_0xc21d('0x3f')](_0x2cc7fd[_0xc21d('0x3b')],{'$or':_[_0xc21d('0x2c')](_0x21c235,function(_0x249750){if(_0x249750['type']!==_0xc21d('0x40')){var _0x3c0769={};_0x3c0769[_0x249750[_0xc21d('0x2a')]]={'$like':'%'+_0x11e20b[_0xc21d('0x33')][_0xc21d('0x3e')]+'%'};return _0x3c0769;}})});}_0x2cc7fd=_[_0xc21d('0x3f')]({},_0x2cc7fd,_0x11e20b['options']);var _0x4079c5={'where':_0x2cc7fd[_0xc21d('0x3b')]};return db[_0xc21d('0x2d')][_0xc21d('0x20')](_0x4079c5)['then'](function(_0x229d0f){_0x503f54[_0xc21d('0x20')]=_0x229d0f;if(_0x11e20b['query'][_0xc21d('0x41')]){_0x2cc7fd[_0xc21d('0x42')]=[{'all':!![]}];}return db[_0xc21d('0x2d')][_0xc21d('0x43')](_0x2cc7fd);})['then'](function(_0x21eed7){_0x503f54[_0xc21d('0x44')]=_0x21eed7;return _0x503f54;})[_0xc21d('0x26')](respondWithFilteredResult(_0x271647,_0x2cc7fd))[_0xc21d('0x45')](handleError(_0x271647,null));};exports[_0xc21d('0x46')]=function(_0x18dc1f,_0x119d27){var _0xeddbf6={'raw':!![],'where':{'id':_0x18dc1f[_0xc21d('0x47')]['id']}},_0x1ac1f4={};_0x1ac1f4['model']=_[_0xc21d('0x32')](db[_0xc21d('0x2d')][_0xc21d('0x2e')]);_0x1ac1f4[_0xc21d('0x33')]=_['keys'](_0x18dc1f['query']);_0x1ac1f4[_0xc21d('0x3c')]=_['intersection'](_0x1ac1f4[_0xc21d('0x31')],_0x1ac1f4[_0xc21d('0x33')]);_0xeddbf6['attributes']=_[_0xc21d('0x35')](_0x1ac1f4['model'],qs[_0xc21d('0x36')](_0x18dc1f[_0xc21d('0x33')][_0xc21d('0x36')]));_0xeddbf6['attributes']=_0xeddbf6[_0xc21d('0x34')][_0xc21d('0x37')]?_0xeddbf6[_0xc21d('0x34')]:_0x1ac1f4['model'];if(_0x18dc1f[_0xc21d('0x33')]['includeAll']){_0xeddbf6[_0xc21d('0x42')]=[{'all':!![]}];}_0xeddbf6=_['merge']({},_0xeddbf6,_0x18dc1f[_0xc21d('0x48')]);return db['VoiceQueuesLog'][_0xc21d('0x49')](_0xeddbf6)[_0xc21d('0x26')](handleEntityNotFound(_0x119d27,null))['then'](respondWithResult(_0x119d27,null))[_0xc21d('0x45')](handleError(_0x119d27,null));};exports[_0xc21d('0x4a')]=function(_0x47627c,_0x4c6978){return db[_0xc21d('0x2d')][_0xc21d('0x4a')](_0x47627c[_0xc21d('0x4b')],{})[_0xc21d('0x26')](respondWithResult(_0x4c6978,0xc9))[_0xc21d('0x45')](handleError(_0x4c6978,null));};exports[_0xc21d('0x25')]=function(_0x401748,_0x275264){if(_0x401748[_0xc21d('0x4b')]['id']){delete _0x401748[_0xc21d('0x4b')]['id'];}return db[_0xc21d('0x2d')][_0xc21d('0x49')]({'where':{'id':_0x401748[_0xc21d('0x47')]['id']}})[_0xc21d('0x26')](handleEntityNotFound(_0x275264,null))[_0xc21d('0x26')](saveUpdates(_0x401748[_0xc21d('0x4b')],null))[_0xc21d('0x26')](respondWithResult(_0x275264,null))[_0xc21d('0x45')](handleError(_0x275264,null));};exports[_0xc21d('0x27')]=function(_0x3fdf18,_0x2a4ce1){return db[_0xc21d('0x2d')][_0xc21d('0x49')]({'where':{'id':_0x3fdf18[_0xc21d('0x47')]['id']}})[_0xc21d('0x26')](handleEntityNotFound(_0x2a4ce1,null))['then'](removeEntity(_0x2a4ce1,null))[_0xc21d('0x45')](handleError(_0x2a4ce1,null));}; \ No newline at end of file +var _0x81b8=['include','findAll','rows','catch','show','params','options','create','body','update','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','save','then','error','stack','name','send','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','nolimit','limit','sort','filters','pick','filter','merge','where','map','VIRTUAL','VoiceQueuesLog','includeAll'];(function(_0x5d93f0,_0x1a9059){var _0xa2a325=function(_0x598472){while(--_0x598472){_0x5d93f0['push'](_0x5d93f0['shift']());}};_0xa2a325(++_0x1a9059);}(_0x81b8,0x1ce));var _0x881b=function(_0x3db25a,_0x151fcd){_0x3db25a=_0x3db25a-0x0;var _0x458137=_0x81b8[_0x3db25a];return _0x458137;};'use strict';var emlformat=require(_0x881b('0x0'));var rimraf=require(_0x881b('0x1'));var zipdir=require(_0x881b('0x2'));var jsonpatch=require(_0x881b('0x3'));var rp=require(_0x881b('0x4'));var moment=require(_0x881b('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x881b('0x6'));var sox=require('sox');var csv=require(_0x881b('0x7'));var ejs=require(_0x881b('0x8'));var fs=require('fs');var fs_extra=require(_0x881b('0x9'));var _=require(_0x881b('0xa'));var squel=require(_0x881b('0xb'));var crypto=require('crypto');var jsforce=require(_0x881b('0xc'));var deskjs=require(_0x881b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x881b('0xe'));var Papa=require(_0x881b('0xf'));var Redis=require(_0x881b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x881b('0x11'));var as=require(_0x881b('0x12'));var hardwareService=require(_0x881b('0x13'));var logger=require(_0x881b('0x14'))('api');var utils=require(_0x881b('0x15'));var config=require(_0x881b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x881b('0x17'))['db'];function respondWithStatusCode(_0x50da36,_0x2fab7b){_0x2fab7b=_0x2fab7b||0xcc;return function(_0x11f1ed){if(_0x11f1ed){return _0x50da36[_0x881b('0x18')](_0x2fab7b);}return _0x50da36[_0x881b('0x19')](_0x2fab7b)[_0x881b('0x1a')]();};}function respondWithResult(_0xea52d8,_0x30b2d6){_0x30b2d6=_0x30b2d6||0xc8;return function(_0xd4ae24){if(_0xd4ae24){return _0xea52d8[_0x881b('0x19')](_0x30b2d6)[_0x881b('0x1b')](_0xd4ae24);}};}function respondWithFilteredResult(_0x2c9e62,_0x284e66){return function(_0x3d8b0c){if(_0x3d8b0c){var _0x513637=typeof _0x284e66['offset']===_0x881b('0x1c')&&typeof _0x284e66['limit']==='undefined';var _0x38b0de=_0x3d8b0c[_0x881b('0x1d')];var _0x2c3387=_0x513637?0x0:_0x284e66[_0x881b('0x1e')];var _0x1b12f6=_0x513637?_0x3d8b0c[_0x881b('0x1d')]:_0x284e66[_0x881b('0x1e')]+_0x284e66['limit'];var _0x1f3e3c;if(_0x1b12f6>=_0x38b0de){_0x1b12f6=_0x38b0de;_0x1f3e3c=0xc8;}else{_0x1f3e3c=0xce;}_0x2c9e62['status'](_0x1f3e3c);return _0x2c9e62[_0x881b('0x1f')](_0x881b('0x20'),_0x2c3387+'-'+_0x1b12f6+'/'+_0x38b0de)['json'](_0x3d8b0c);}return null;};}function patchUpdates(_0x3d86d8){return function(_0x2323b8){try{jsonpatch[_0x881b('0x21')](_0x2323b8,_0x3d86d8,!![]);}catch(_0xec7bb8){return BPromise['reject'](_0xec7bb8);}return _0x2323b8[_0x881b('0x22')]();};}function saveUpdates(_0x1bcb49,_0x4e2e5c){return function(_0x57ce47){if(_0x57ce47){return _0x57ce47['update'](_0x1bcb49)[_0x881b('0x23')](function(_0x279838){return _0x279838;});}return null;};}function removeEntity(_0x9f5ba1,_0x9381a2){return function(_0x381dad){if(_0x381dad){return _0x381dad['destroy']()[_0x881b('0x23')](function(){_0x9f5ba1[_0x881b('0x19')](0xcc)[_0x881b('0x1a')]();});}};}function handleEntityNotFound(_0x167c3e,_0x478dd6){return function(_0x324a71){if(!_0x324a71){_0x167c3e[_0x881b('0x18')](0x194);}return _0x324a71;};}function handleError(_0x448649,_0x49b4af){_0x49b4af=_0x49b4af||0x1f4;return function(_0x53dc6c){logger[_0x881b('0x24')](_0x53dc6c[_0x881b('0x25')]);if(_0x53dc6c['name']){delete _0x53dc6c[_0x881b('0x26')];}_0x448649[_0x881b('0x19')](_0x49b4af)[_0x881b('0x27')](_0x53dc6c);};}exports['index']=function(_0x272631,_0x2e0561){var _0x2e4c73={},_0x3554e1={},_0x1b00bd={'count':0x0,'rows':[]};var _0x39a46d=_['map'](db['VoiceQueuesLog'][_0x881b('0x28')],function(_0x50c248){return{'name':_0x50c248[_0x881b('0x29')],'type':_0x50c248[_0x881b('0x2a')][_0x881b('0x2b')]};});_0x3554e1[_0x881b('0x2c')]=_['map'](_0x39a46d,_0x881b('0x26'));_0x3554e1['query']=_[_0x881b('0x2d')](_0x272631[_0x881b('0x2e')]);_0x3554e1['filters']=_[_0x881b('0x2f')](_0x3554e1[_0x881b('0x2c')],_0x3554e1[_0x881b('0x2e')]);_0x2e4c73['attributes']=_['intersection'](_0x3554e1[_0x881b('0x2c')],qs[_0x881b('0x30')](_0x272631['query']['fields']));_0x2e4c73[_0x881b('0x31')]=_0x2e4c73[_0x881b('0x31')][_0x881b('0x32')]?_0x2e4c73[_0x881b('0x31')]:_0x3554e1['model'];if(!_0x272631['query']['hasOwnProperty'](_0x881b('0x33'))){_0x2e4c73[_0x881b('0x34')]=qs['limit'](_0x272631[_0x881b('0x2e')]['limit']);_0x2e4c73[_0x881b('0x1e')]=qs[_0x881b('0x1e')](_0x272631[_0x881b('0x2e')][_0x881b('0x1e')]);}_0x2e4c73['order']=qs['sort'](_0x272631[_0x881b('0x2e')][_0x881b('0x35')]);_0x2e4c73['where']=qs[_0x881b('0x36')](_[_0x881b('0x37')](_0x272631[_0x881b('0x2e')],_0x3554e1[_0x881b('0x36')]),_0x39a46d);if(_0x272631[_0x881b('0x2e')][_0x881b('0x38')]){_0x2e4c73['where']=_[_0x881b('0x39')](_0x2e4c73[_0x881b('0x3a')],{'$or':_[_0x881b('0x3b')](_0x39a46d,function(_0x48ca78){if(_0x48ca78[_0x881b('0x2a')]!==_0x881b('0x3c')){var _0x49d8b9={};_0x49d8b9[_0x48ca78['name']]={'$like':'%'+_0x272631[_0x881b('0x2e')][_0x881b('0x38')]+'%'};return _0x49d8b9;}})});}_0x2e4c73=_['merge']({},_0x2e4c73,_0x272631['options']);var _0x2fbefd={'where':_0x2e4c73['where']};return db[_0x881b('0x3d')][_0x881b('0x1d')](_0x2fbefd)[_0x881b('0x23')](function(_0xa542db){_0x1b00bd[_0x881b('0x1d')]=_0xa542db;if(_0x272631[_0x881b('0x2e')][_0x881b('0x3e')]){_0x2e4c73[_0x881b('0x3f')]=[{'all':!![]}];}return db[_0x881b('0x3d')][_0x881b('0x40')](_0x2e4c73);})[_0x881b('0x23')](function(_0x56be26){_0x1b00bd[_0x881b('0x41')]=_0x56be26;return _0x1b00bd;})['then'](respondWithFilteredResult(_0x2e0561,_0x2e4c73))[_0x881b('0x42')](handleError(_0x2e0561,null));};exports[_0x881b('0x43')]=function(_0x3d4654,_0x13e9e9){var _0x3364d2={'raw':!![],'where':{'id':_0x3d4654[_0x881b('0x44')]['id']}},_0x515f1c={};_0x515f1c[_0x881b('0x2c')]=_[_0x881b('0x2d')](db[_0x881b('0x3d')][_0x881b('0x28')]);_0x515f1c['query']=_[_0x881b('0x2d')](_0x3d4654[_0x881b('0x2e')]);_0x515f1c[_0x881b('0x36')]=_[_0x881b('0x2f')](_0x515f1c[_0x881b('0x2c')],_0x515f1c['query']);_0x3364d2[_0x881b('0x31')]=_[_0x881b('0x2f')](_0x515f1c[_0x881b('0x2c')],qs['fields'](_0x3d4654[_0x881b('0x2e')]['fields']));_0x3364d2['attributes']=_0x3364d2['attributes']['length']?_0x3364d2[_0x881b('0x31')]:_0x515f1c[_0x881b('0x2c')];if(_0x3d4654[_0x881b('0x2e')][_0x881b('0x3e')]){_0x3364d2[_0x881b('0x3f')]=[{'all':!![]}];}_0x3364d2=_[_0x881b('0x39')]({},_0x3364d2,_0x3d4654[_0x881b('0x45')]);return db[_0x881b('0x3d')]['find'](_0x3364d2)[_0x881b('0x23')](handleEntityNotFound(_0x13e9e9,null))[_0x881b('0x23')](respondWithResult(_0x13e9e9,null))[_0x881b('0x42')](handleError(_0x13e9e9,null));};exports['create']=function(_0x51a4ff,_0x22165d){return db[_0x881b('0x3d')][_0x881b('0x46')](_0x51a4ff[_0x881b('0x47')],{})['then'](respondWithResult(_0x22165d,0xc9))[_0x881b('0x42')](handleError(_0x22165d,null));};exports[_0x881b('0x48')]=function(_0x3aced9,_0x5d9c1e){if(_0x3aced9[_0x881b('0x47')]['id']){delete _0x3aced9[_0x881b('0x47')]['id'];}return db['VoiceQueuesLog'][_0x881b('0x49')]({'where':{'id':_0x3aced9[_0x881b('0x44')]['id']}})[_0x881b('0x23')](handleEntityNotFound(_0x5d9c1e,null))['then'](saveUpdates(_0x3aced9['body'],null))[_0x881b('0x23')](respondWithResult(_0x5d9c1e,null))[_0x881b('0x42')](handleError(_0x5d9c1e,null));};exports[_0x881b('0x4a')]=function(_0x22f0ff,_0x1bf103){return db['VoiceQueuesLog'][_0x881b('0x49')]({'where':{'id':_0x22f0ff[_0x881b('0x44')]['id']}})['then'](handleEntityNotFound(_0x1bf103,null))[_0x881b('0x23')](removeEntity(_0x1bf103,null))[_0x881b('0x42')](handleError(_0x1bf103,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index d8723f5..e789255 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 _0x1fd3=['moment','bluebird','request-promise','rimraf','./voiceQueuesLog.attributes','define','event','dtm','lodash','util','../../config/logger','api'];(function(_0x4fd01f,_0x407015){var _0x32ea3b=function(_0x3b1138){while(--_0x3b1138){_0x4fd01f['push'](_0x4fd01f['shift']());}};_0x32ea3b(++_0x407015);}(_0x1fd3,0x128));var _0x31fd=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x1fd3[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x31fd('0x0'));var util=require(_0x31fd('0x1'));var logger=require(_0x31fd('0x2'))(_0x31fd('0x3'));var moment=require(_0x31fd('0x4'));var BPromise=require(_0x31fd('0x5'));var rp=require(_0x31fd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31fd('0x7'));var config=require('../../config/environment');var attributes=require(_0x31fd('0x8'));module['exports']=function(_0x1cc1bf,_0x3afe2e){return _0x1cc1bf[_0x31fd('0x9')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x31fd('0xa'),_0x31fd('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x2c41=['dtm','lodash','../../config/logger','api','moment','bluebird','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event'];(function(_0x48c33d,_0x3f79b0){var _0x14f61b=function(_0x5d310d){while(--_0x5d310d){_0x48c33d['push'](_0x48c33d['shift']());}};_0x14f61b(++_0x3f79b0);}(_0x2c41,0xd3));var _0x12c4=function(_0x1bb47b,_0x54e02e){_0x1bb47b=_0x1bb47b-0x0;var _0x566418=_0x2c41[_0x1bb47b];return _0x566418;};'use strict';var _=require(_0x12c4('0x0'));var util=require('util');var logger=require(_0x12c4('0x1'))(_0x12c4('0x2'));var moment=require(_0x12c4('0x3'));var BPromise=require(_0x12c4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x12c4('0x5'));var config=require('../../config/environment');var attributes=require(_0x12c4('0x6'));module[_0x12c4('0x7')]=function(_0x278ded,_0x126825){return _0x278ded[_0x12c4('0x8')](_0x12c4('0x9'),attributes,{'tableName':_0x12c4('0xa'),'paranoid':![],'indexes':[{'name':_0x12c4('0xb'),'fields':[_0x12c4('0xc'),_0x12c4('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 0db0921..2e34215 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 _0x3495=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x284725,_0x5e78e6){var _0x5638a7=function(_0x1f58d0){while(--_0x1f58d0){_0x284725['push'](_0x284725['shift']());}};_0x5638a7(++_0x5e78e6);}(_0x3495,0x1de));var _0x5349=function(_0x490ecb,_0x5872a9){_0x490ecb=_0x490ecb-0x0;var _0x508de4=_0x3495[_0x490ecb];return _0x508de4;};'use strict';var _=require(_0x5349('0x0'));var util=require(_0x5349('0x1'));var moment=require(_0x5349('0x2'));var BPromise=require(_0x5349('0x3'));var rs=require(_0x5349('0x4'));var fs=require('fs');var Redis=require(_0x5349('0x5'));var db=require(_0x5349('0x6'))['db'];var utils=require(_0x5349('0x7'));var logger=require(_0x5349('0x8'))('rpc');var config=require(_0x5349('0x9'));var jayson=require(_0x5349('0xa'));var client=jayson['client'][_0x5349('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x538385,_0x6fb5dc,_0x529323){return new BPromise(function(_0x393873,_0x583cee){return client[_0x5349('0xc')](_0x538385,_0x529323)[_0x5349('0xd')](function(_0x22a3d3){logger[_0x5349('0xe')](_0x5349('0xf'),_0x6fb5dc,_0x5349('0x10'));logger[_0x5349('0x11')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x6fb5dc,_0x5349('0x10'),JSON['stringify'](_0x22a3d3));if(_0x22a3d3[_0x5349('0x12')]){if(_0x22a3d3[_0x5349('0x12')][_0x5349('0x13')]===0x1f4){logger[_0x5349('0x12')](_0x5349('0xf'),_0x6fb5dc,_0x22a3d3[_0x5349('0x12')][_0x5349('0x14')]);return _0x583cee(_0x22a3d3[_0x5349('0x12')][_0x5349('0x14')]);}logger[_0x5349('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x6fb5dc,_0x22a3d3[_0x5349('0x12')][_0x5349('0x14')]);return _0x393873(_0x22a3d3['error'][_0x5349('0x14')]);}else{logger[_0x5349('0xe')](_0x5349('0xf'),_0x6fb5dc,'request\x20sent');_0x393873(_0x22a3d3['result']['message']);}})[_0x5349('0x15')](function(_0x5c873d){logger[_0x5349('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x6fb5dc,_0x5c873d);_0x583cee(_0x5c873d);});});} \ No newline at end of file +var _0xfef3=['lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfef3,0x118));var _0x3fef=function(_0x152c94,_0x1b9c39){_0x152c94=_0x152c94-0x0;var _0x4c46e8=_0xfef3[_0x152c94];return _0x4c46e8;};'use strict';var _=require(_0x3fef('0x0'));var util=require('util');var moment=require(_0x3fef('0x1'));var BPromise=require('bluebird');var rs=require(_0x3fef('0x2'));var fs=require('fs');var Redis=require(_0x3fef('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fef('0x4'));var logger=require(_0x3fef('0x5'))('rpc');var config=require(_0x3fef('0x6'));var jayson=require(_0x3fef('0x7'));var client=jayson['client'][_0x3fef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f5b72,_0x800850,_0x33e00a){return new BPromise(function(_0x1fffc5,_0x41960c){return client[_0x3fef('0x9')](_0x5f5b72,_0x33e00a)[_0x3fef('0xa')](function(_0x31c30f){logger[_0x3fef('0xb')](_0x3fef('0xc'),_0x800850,_0x3fef('0xd'));logger[_0x3fef('0xe')](_0x3fef('0xf'),_0x800850,'request\x20sent',JSON[_0x3fef('0x10')](_0x31c30f));if(_0x31c30f[_0x3fef('0x11')]){if(_0x31c30f[_0x3fef('0x11')]['code']===0x1f4){logger[_0x3fef('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x800850,_0x31c30f[_0x3fef('0x11')][_0x3fef('0x12')]);return _0x41960c(_0x31c30f[_0x3fef('0x11')]['message']);}logger[_0x3fef('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x800850,_0x31c30f[_0x3fef('0x11')][_0x3fef('0x12')]);return _0x1fffc5(_0x31c30f['error'][_0x3fef('0x12')]);}else{logger[_0x3fef('0xb')](_0x3fef('0xc'),_0x800850,_0x3fef('0xd'));_0x1fffc5(_0x31c30f[_0x3fef('0x13')][_0x3fef('0x12')]);}})['catch'](function(_0x1cbdbb){logger[_0x3fef('0x11')](_0x3fef('0xc'),_0x800850,_0x1cbdbb);_0x41960c(_0x1cbdbb);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 7104534..cfa1286 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 _0x1b04=['/:id/transcribe','downloadTranscribe','create','post','runTranscribe','put','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','./voiceRecording.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','downloads'];(function(_0x1622a0,_0x2b55a9){var _0x2a2308=function(_0x38d05b){while(--_0x38d05b){_0x1622a0['push'](_0x1622a0['shift']());}};_0x2a2308(++_0x2b55a9);}(_0x1b04,0x1b9));var _0x41b0=function(_0x23e6bb,_0x5c2d69){_0x23e6bb=_0x23e6bb-0x0;var _0x1e3b4c=_0x1b04[_0x23e6bb];return _0x1e3b4c;};'use strict';var multer=require('multer');var util=require(_0x41b0('0x0'));var path=require(_0x41b0('0x1'));var timeout=require('connect-timeout');var express=require(_0x41b0('0x2'));var router=express['Router']();var fs_extra=require(_0x41b0('0x3'));var auth=require(_0x41b0('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x41b0('0x5'));router[_0x41b0('0x6')]('/',auth[_0x41b0('0x7')](),controller[_0x41b0('0x8')]);router[_0x41b0('0x6')]('/describe',auth[_0x41b0('0x7')](),controller[_0x41b0('0x9')]);router[_0x41b0('0x6')](_0x41b0('0xa'),auth[_0x41b0('0x7')](),controller[_0x41b0('0xb')]);router[_0x41b0('0x6')](_0x41b0('0xc'),auth['isAuthenticated'](),controller[_0x41b0('0xd')]);router[_0x41b0('0x6')]('/:id/downloads',controller[_0x41b0('0xe')]);router['get'](_0x41b0('0xf'),auth[_0x41b0('0x7')](),controller[_0x41b0('0x10')]);router['post']('/',auth[_0x41b0('0x7')](),controller[_0x41b0('0x11')]);router[_0x41b0('0x12')]('/:id/transcribe',auth[_0x41b0('0x7')](),controller[_0x41b0('0x13')]);router[_0x41b0('0x14')]('/:id',auth[_0x41b0('0x7')](),controller['update']);router[_0x41b0('0x15')](_0x41b0('0xa'),auth[_0x41b0('0x7')](),controller[_0x41b0('0x16')]);module[_0x41b0('0x17')]=router; \ No newline at end of file +var _0x674a=['show','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','get','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x674a,0x73));var _0xa674=function(_0x28bcf2,_0x198926){_0x28bcf2=_0x28bcf2-0x0;var _0x33b928=_0x674a[_0x28bcf2];return _0x33b928;};'use strict';var multer=require(_0xa674('0x0'));var util=require(_0xa674('0x1'));var path=require(_0xa674('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa674('0x3')]();var fs_extra=require(_0xa674('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa674('0x5'));var config=require(_0xa674('0x6'));var controller=require(_0xa674('0x7'));router['get']('/',auth[_0xa674('0x8')](),controller['index']);router['get']('/describe',auth[_0xa674('0x8')](),controller['describe']);router[_0xa674('0x9')](_0xa674('0xa'),auth[_0xa674('0x8')](),controller[_0xa674('0xb')]);router['get']('/:id/download',auth[_0xa674('0x8')](),controller['download']);router[_0xa674('0x9')](_0xa674('0xc'),controller[_0xa674('0xd')]);router['get'](_0xa674('0xe'),auth[_0xa674('0x8')](),controller[_0xa674('0xf')]);router[_0xa674('0x10')]('/',auth['isAuthenticated'](),controller[_0xa674('0x11')]);router[_0xa674('0x10')](_0xa674('0xe'),auth[_0xa674('0x8')](),controller['runTranscribe']);router['put'](_0xa674('0xa'),auth[_0xa674('0x8')](),controller['update']);router[_0xa674('0x12')]('/:id',auth[_0xa674('0x8')](),controller[_0xa674('0x13')]);module[_0xa674('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 9886190..09743d9 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 _0x66c5=['getDataValue','STRING','setDataValue','channel','membername','split','INTEGER','TEXT','NEW','FLOAT','DATE','toString','updatedAt','format','MM-DD-YYYY\x20HH:mm','sequelize','moment','VIRTUAL','value','extname'];(function(_0x55beea,_0x288979){var _0x535ba3=function(_0xbe694){while(--_0xbe694){_0x55beea['push'](_0x55beea['shift']());}};_0x535ba3(++_0x288979);}(_0x66c5,0xd7));var _0x566c=function(_0x59fc7f,_0x33a2ba){_0x59fc7f=_0x59fc7f-0x0;var _0x25535a=_0x66c5[_0x59fc7f];return _0x25535a;};'use strict';var Sequelize=require(_0x566c('0x0'));var moment=require(_0x566c('0x1'));var path=require('path');module['exports']={'format':{'type':Sequelize[_0x566c('0x2')],'get':function(){return this['getDataValue'](_0x566c('0x3'))?path[_0x566c('0x4')](this[_0x566c('0x5')](_0x566c('0x3'))):undefined;}},'uniqueid':{'type':Sequelize[_0x566c('0x6')]},'channel':{'type':Sequelize[_0x566c('0x6')],'set':function(_0x32e1fe){if(_0x32e1fe){this[_0x566c('0x7')](_0x566c('0x8'),_0x32e1fe);this['setDataValue'](_0x566c('0x9'),_0x32e1fe[_0x566c('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x566c('0x6')]},'calleridnum':{'type':Sequelize[_0x566c('0x6')]},'calleridname':{'type':Sequelize[_0x566c('0x6')]},'connectedlinenum':{'type':Sequelize[_0x566c('0x6')]},'connectedlinename':{'type':Sequelize[_0x566c('0x6')]},'accountcode':{'type':Sequelize[_0x566c('0x6')]},'context':{'type':Sequelize[_0x566c('0x6')]},'exten':{'type':Sequelize[_0x566c('0x6')]},'value':{'type':Sequelize[_0x566c('0x6')]},'type':{'type':Sequelize[_0x566c('0x6')]},'rating':{'type':Sequelize[_0x566c('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x566c('0x6')]},'userDisposition':{'type':Sequelize[_0x566c('0x6')]},'userSecondDisposition':{'type':Sequelize[_0x566c('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x566c('0x6')]},'location':{'type':Sequelize[_0x566c('0xc')]},'transcribeName':{'type':Sequelize[_0x566c('0x6')]},'transcribeStatus':{'type':Sequelize[_0x566c('0x6')],'defaultValue':_0x566c('0xd')},'fileUri':{'type':Sequelize[_0x566c('0xc')]},'fileText':{'type':Sequelize[_0x566c('0xc')]},'failureReason':{'type':Sequelize[_0x566c('0xc')]},'sentiment':{'type':Sequelize[_0x566c('0x6')]},'sPositive':{'type':Sequelize[_0x566c('0xe')]},'sNegative':{'type':Sequelize['FLOAT']},'sNeutral':{'type':Sequelize[_0x566c('0xe')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x566c('0xf')],'get':function(){return moment(this[_0x566c('0x5')]('createdAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0x566c('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x566c('0x5')](_0x566c('0x11')))[_0x566c('0x12')](_0x566c('0x13'))['toString']();}}}; \ No newline at end of file +var _0x06fb=['sequelize','moment','path','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','membername','split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','createdAt','format','MM-DD-YYYY\x20HH:mm','DATE','updatedAt','toString'];(function(_0x49c653,_0x390195){var _0x31e169=function(_0x3684ac){while(--_0x3684ac){_0x49c653['push'](_0x49c653['shift']());}};_0x31e169(++_0x390195);}(_0x06fb,0x1e4));var _0xb06f=function(_0x1e20c8,_0x48dc04){_0x1e20c8=_0x1e20c8-0x0;var _0x4e18b0=_0x06fb[_0x1e20c8];return _0x4e18b0;};'use strict';var Sequelize=require(_0xb06f('0x0'));var moment=require(_0xb06f('0x1'));var path=require(_0xb06f('0x2'));module['exports']={'format':{'type':Sequelize[_0xb06f('0x3')],'get':function(){return this[_0xb06f('0x4')](_0xb06f('0x5'))?path[_0xb06f('0x6')](this['getDataValue'](_0xb06f('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0xb06f('0x7')]},'channel':{'type':Sequelize[_0xb06f('0x7')],'set':function(_0x20f9dc){if(_0x20f9dc){this[_0xb06f('0x8')]('channel',_0x20f9dc);this[_0xb06f('0x8')](_0xb06f('0x9'),_0x20f9dc[_0xb06f('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xb06f('0x7')]},'calleridnum':{'type':Sequelize[_0xb06f('0x7')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xb06f('0x7')]},'connectedlinename':{'type':Sequelize[_0xb06f('0x7')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb06f('0x7')]},'exten':{'type':Sequelize[_0xb06f('0x7')]},'value':{'type':Sequelize[_0xb06f('0x7')]},'type':{'type':Sequelize[_0xb06f('0x7')]},'rating':{'type':Sequelize[_0xb06f('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xb06f('0x7')]},'userSecondDisposition':{'type':Sequelize[_0xb06f('0x7')]},'userThirdDisposition':{'type':Sequelize[_0xb06f('0x7')]},'location':{'type':Sequelize[_0xb06f('0xc')]},'transcribeName':{'type':Sequelize[_0xb06f('0x7')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0xb06f('0xd')},'fileUri':{'type':Sequelize[_0xb06f('0xc')]},'fileText':{'type':Sequelize[_0xb06f('0xc')]},'failureReason':{'type':Sequelize[_0xb06f('0xc')]},'sentiment':{'type':Sequelize['STRING']},'sPositive':{'type':Sequelize[_0xb06f('0xe')]},'sNegative':{'type':Sequelize[_0xb06f('0xe')]},'sNeutral':{'type':Sequelize[_0xb06f('0xe')]},'sMixed':{'type':Sequelize[_0xb06f('0xe')]},'tempSentiment':{'type':Sequelize[_0xb06f('0xf')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xb06f('0x4')](_0xb06f('0x10')))[_0xb06f('0x11')](_0xb06f('0x12'))['toString']();}},'updatedAt':{'type':Sequelize[_0xb06f('0x13')],'get':function(){return moment(this['getDataValue'](_0xb06f('0x14')))[_0xb06f('0x11')](_0xb06f('0x12'))[_0xb06f('0x15')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 241a847..989f611 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 _0x5ba9=['upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','runSentiment','sentimentRegion','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','fileText','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceRecording','fieldName','type','key','differenceBy','format','query','keys','filters','intersection','model','attributes','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','rawAttributes','fields','find','create','body','params','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','%s.cypher','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket'];(function(_0x10465b,_0x85cc56){var _0x3b5753=function(_0x2e80c2){while(--_0x2e80c2){_0x10465b['push'](_0x10465b['shift']());}};_0x3b5753(++_0x85cc56);}(_0x5ba9,0xbc));var _0x95ba=function(_0x2f7342,_0x3b695a){_0x2f7342=_0x2f7342-0x0;var _0x575230=_0x5ba9[_0x2f7342];return _0x575230;};'use strict';var emlformat=require(_0x95ba('0x0'));var rimraf=require(_0x95ba('0x1'));var zipdir=require(_0x95ba('0x2'));var jsonpatch=require(_0x95ba('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x95ba('0x4'));var Mustache=require(_0x95ba('0x5'));var util=require(_0x95ba('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x95ba('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x95ba('0x8'));var _=require(_0x95ba('0x9'));var squel=require(_0x95ba('0xa'));var crypto=require(_0x95ba('0xb'));var jsforce=require(_0x95ba('0xc'));var deskjs=require(_0x95ba('0xd'));var toCsv=require('to-csv');var querystring=require(_0x95ba('0xe'));var Papa=require('papaparse');var AWS=require(_0x95ba('0xf'));var uuidv4=require(_0x95ba('0x10'));var Redis=require('ioredis');var authService=require(_0x95ba('0x11'));var qs=require(_0x95ba('0x12'));var as=require(_0x95ba('0x13'));var hardwareService=require(_0x95ba('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x95ba('0x15'));var licenseUtil=require(_0x95ba('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a8b06,_0x4e9a93){_0x4e9a93=_0x4e9a93||0xcc;return function(_0x13674d){if(_0x13674d){return _0x4a8b06[_0x95ba('0x17')](_0x4e9a93);}return _0x4a8b06[_0x95ba('0x18')](_0x4e9a93)[_0x95ba('0x19')]();};}function respondWithResult(_0x30c1d9,_0x42f059){_0x42f059=_0x42f059||0xc8;return function(_0x570a40){if(_0x570a40){return _0x30c1d9[_0x95ba('0x18')](_0x42f059)[_0x95ba('0x1a')](_0x570a40);}};}function respondWithFilteredResult(_0x69dd3b,_0x55591a){return function(_0x5901d8){if(_0x5901d8){var _0x4ed0e2=typeof _0x55591a['offset']===_0x95ba('0x1b')&&typeof _0x55591a[_0x95ba('0x1c')]===_0x95ba('0x1b');var _0x3a97d8=_0x5901d8[_0x95ba('0x1d')];var _0x175b77=_0x4ed0e2?0x0:_0x55591a[_0x95ba('0x1e')];var _0x77e915=_0x4ed0e2?_0x5901d8[_0x95ba('0x1d')]:_0x55591a['offset']+_0x55591a['limit'];var _0x21e072;if(_0x77e915>=_0x3a97d8){_0x77e915=_0x3a97d8;_0x21e072=0xc8;}else{_0x21e072=0xce;}_0x69dd3b[_0x95ba('0x18')](_0x21e072);return _0x69dd3b[_0x95ba('0x1f')](_0x95ba('0x20'),_0x175b77+'-'+_0x77e915+'/'+_0x3a97d8)[_0x95ba('0x1a')](_0x5901d8);}return null;};}function patchUpdates(_0x453911){return function(_0x1e6651){try{jsonpatch[_0x95ba('0x21')](_0x1e6651,_0x453911,!![]);}catch(_0x55c24a){return BPromise[_0x95ba('0x22')](_0x55c24a);}return _0x1e6651[_0x95ba('0x23')]();};}function saveUpdates(_0x33161c,_0x25c90b){return function(_0x25c3f2){if(_0x25c3f2){return _0x25c3f2[_0x95ba('0x24')](_0x33161c)['then'](function(_0x1379a6){return _0x1379a6;});}return null;};}function removeEntity(_0x98b414,_0x5e595f){return function(_0x23e3e2){if(_0x23e3e2){return _0x23e3e2[_0x95ba('0x25')]()[_0x95ba('0x26')](function(){_0x98b414['status'](0xcc)[_0x95ba('0x19')]();});}};}function handleEntityNotFound(_0x41f290,_0x19f970){return function(_0x17dd53){if(!_0x17dd53){_0x41f290[_0x95ba('0x17')](0x194);}return _0x17dd53;};}function handleError(_0x21d197,_0x188163){_0x188163=_0x188163||0x1f4;return function(_0x3dd456){logger[_0x95ba('0x27')](_0x3dd456[_0x95ba('0x28')]);if(_0x3dd456['name']){delete _0x3dd456[_0x95ba('0x29')];}_0x21d197[_0x95ba('0x18')](_0x188163)[_0x95ba('0x2a')](_0x3dd456);};}exports[_0x95ba('0x2b')]=function(_0x331b8f,_0x29bb27){var _0x22fc5e={},_0x30e335={},_0x532eb5={'count':0x0,'rows':[]};var _0x28b6d5=_[_0x95ba('0x2c')](db[_0x95ba('0x2d')]['rawAttributes'],function(_0x243beb){return{'name':_0x243beb[_0x95ba('0x2e')],'type':_0x243beb[_0x95ba('0x2f')][_0x95ba('0x30')]};});_0x30e335['model']=_[_0x95ba('0x31')](_[_0x95ba('0x2c')](_0x28b6d5,_0x95ba('0x29')),[_0x95ba('0x32')]);_0x30e335[_0x95ba('0x33')]=_[_0x95ba('0x34')](_0x331b8f[_0x95ba('0x33')]);_0x30e335[_0x95ba('0x35')]=_[_0x95ba('0x36')](_0x30e335[_0x95ba('0x37')],_0x30e335[_0x95ba('0x33')]);_0x22fc5e[_0x95ba('0x38')]=_[_0x95ba('0x36')](_0x30e335[_0x95ba('0x37')],qs['fields'](_0x331b8f[_0x95ba('0x33')]['fields']));_0x22fc5e['attributes']=_0x22fc5e[_0x95ba('0x38')]['length']?_0x22fc5e[_0x95ba('0x38')]:_0x30e335['model'];if(!_0x331b8f[_0x95ba('0x33')][_0x95ba('0x39')]('nolimit')){_0x22fc5e[_0x95ba('0x1c')]=qs[_0x95ba('0x1c')](_0x331b8f[_0x95ba('0x33')][_0x95ba('0x1c')]);_0x22fc5e[_0x95ba('0x1e')]=qs[_0x95ba('0x1e')](_0x331b8f[_0x95ba('0x33')][_0x95ba('0x1e')]);}_0x22fc5e[_0x95ba('0x3a')]=qs[_0x95ba('0x3b')](_0x331b8f[_0x95ba('0x33')][_0x95ba('0x3b')]);_0x22fc5e[_0x95ba('0x3c')]=qs[_0x95ba('0x35')](_['pick'](_0x331b8f[_0x95ba('0x33')],_0x30e335[_0x95ba('0x35')]),_0x28b6d5);if(_0x331b8f[_0x95ba('0x33')]['filter']){_0x22fc5e[_0x95ba('0x3c')]=_['merge'](_0x22fc5e['where'],{'$or':_['map'](_0x28b6d5,function(_0x82b1ab){if(_0x82b1ab['type']!==_0x95ba('0x3d')){var _0x42f80b={};_0x42f80b[_0x82b1ab[_0x95ba('0x29')]]={'$like':'%'+_0x331b8f[_0x95ba('0x33')][_0x95ba('0x3e')]+'%'};return _0x42f80b;}})});}_0x22fc5e=_[_0x95ba('0x3f')]({},_0x22fc5e,_0x331b8f[_0x95ba('0x40')]);var _0x328b30={'where':_0x22fc5e[_0x95ba('0x3c')]};return db[_0x95ba('0x2d')]['count'](_0x328b30)[_0x95ba('0x26')](function(_0x472d1b){_0x532eb5[_0x95ba('0x1d')]=_0x472d1b;if(_0x331b8f[_0x95ba('0x33')][_0x95ba('0x41')]){_0x22fc5e[_0x95ba('0x42')]=[{'all':!![]}];}return db[_0x95ba('0x2d')][_0x95ba('0x43')](_0x22fc5e);})[_0x95ba('0x26')](function(_0x26d34c){_0x532eb5[_0x95ba('0x44')]=_0x26d34c;return _0x532eb5;})['then'](respondWithFilteredResult(_0x29bb27,_0x22fc5e))[_0x95ba('0x45')](handleError(_0x29bb27,null));};exports['show']=function(_0x5e43fd,_0x2eacc1){var _0x423e59={'raw':![],'where':{'id':_0x5e43fd['params']['id']}},_0x4d7f2f={};_0x4d7f2f['model']=_[_0x95ba('0x34')](db[_0x95ba('0x2d')][_0x95ba('0x46')]);_0x4d7f2f[_0x95ba('0x33')]=_[_0x95ba('0x34')](_0x5e43fd[_0x95ba('0x33')]);_0x4d7f2f[_0x95ba('0x35')]=_['intersection'](_0x4d7f2f['model'],_0x4d7f2f[_0x95ba('0x33')]);_0x423e59[_0x95ba('0x38')]=_[_0x95ba('0x36')](_0x4d7f2f[_0x95ba('0x37')],qs['fields'](_0x5e43fd[_0x95ba('0x33')][_0x95ba('0x47')]));_0x423e59['attributes']=_0x423e59['attributes']['length']?_0x423e59[_0x95ba('0x38')]:_0x4d7f2f[_0x95ba('0x37')];if(_0x5e43fd['query']['includeAll']){_0x423e59[_0x95ba('0x42')]=[{'all':!![]}];}_0x423e59=_[_0x95ba('0x3f')]({},_0x423e59,_0x5e43fd['options']);return db['VoiceRecording'][_0x95ba('0x48')](_0x423e59)[_0x95ba('0x26')](handleEntityNotFound(_0x2eacc1,null))[_0x95ba('0x26')](respondWithResult(_0x2eacc1,null))['catch'](handleError(_0x2eacc1,null));};exports['create']=function(_0x1f14bf,_0x435047){return db['VoiceRecording'][_0x95ba('0x49')](_0x1f14bf[_0x95ba('0x4a')],{})['then'](respondWithResult(_0x435047,0xc9))['catch'](handleError(_0x435047,null));};exports[_0x95ba('0x24')]=function(_0x472663,_0x17b2cb){if(_0x472663[_0x95ba('0x4a')]['id']){delete _0x472663[_0x95ba('0x4a')]['id'];}return db[_0x95ba('0x2d')][_0x95ba('0x48')]({'where':{'id':_0x472663[_0x95ba('0x4b')]['id']}})[_0x95ba('0x26')](handleEntityNotFound(_0x17b2cb,null))[_0x95ba('0x26')](saveUpdates(_0x472663['body'],null))['then'](respondWithResult(_0x17b2cb,null))[_0x95ba('0x45')](handleError(_0x17b2cb,null));};exports[_0x95ba('0x4c')]=function(_0x2695cf,_0x5c4db6){return db['VoiceRecording'][_0x95ba('0x4c')]()[_0x95ba('0x26')](respondWithResult(_0x5c4db6,null))['catch'](handleError(_0x5c4db6,null));};exports[_0x95ba('0x4d')]=function(_0x405f26,_0x13ef04,_0x2550f6){var _0x434d3=require(_0x95ba('0x4e'));var _0x3d86a2=![];var _0x48117c={};if(_0x405f26[_0x95ba('0x33')]['type']&&_0x405f26[_0x95ba('0x33')]['type']===_0x95ba('0x4f')){_0x48117c['uniqueid']=_0x405f26[_0x95ba('0x4b')]['id'];}else{_0x48117c['id']=_0x405f26['params']['id'];}return db[_0x95ba('0x2d')]['find']({'where':_0x48117c,'attributes':['id',_0x95ba('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x13ef04,null))[_0x95ba('0x26')](function(_0x3ea5f1){if(_0x3ea5f1){var _0x50a3f9=_0x3ea5f1[_0x95ba('0x50')];var _0x5c94ca=util[_0x95ba('0x32')]('%s.cypher',_0x50a3f9);if(fs[_0x95ba('0x51')](_0x5c94ca)){_0x3d86a2=!![];return _0x434d3[_0x95ba('0x52')](_0x5c94ca,_0x50a3f9,config[_0x95ba('0x53')][_0x95ba('0x54')])[_0x95ba('0x26')](function(){return _0x3ea5f1;});}return _0x3ea5f1;}})['then'](function(_0x36f29e){if(_0x36f29e){var _0x11216e=_0x36f29e['value'];if(!fs[_0x95ba('0x51')](_0x11216e)){throw new db[(_0x95ba('0x55'))][(_0x95ba('0x56'))]('VoiceRecording\x20not\x20found');}if(_0x36f29e[_0x95ba('0x57')]){return _0x13ef04[_0x95ba('0x4d')](_0x11216e,_0x36f29e[_0x95ba('0x57')]+path[_0x95ba('0x58')](_0x11216e),function(){if(_0x3d86a2){fs[_0x95ba('0x59')](_0x11216e);}});}else{return _0x13ef04[_0x95ba('0x4d')](_0x11216e,function(_0x48053d){if(_0x3d86a2){fs[_0x95ba('0x59')](_0x11216e);}});}}})['catch'](function(_0x220e88){if(_0x220e88[_0x95ba('0x5a')]===_0x95ba('0x5b')){_0x13ef04['status'](0x194)[_0x95ba('0x2a')](_0x95ba('0x5c'));}else{return handleError(_0x13ef04,null);}});};exports[_0x95ba('0x5d')]=function(_0x31d0f9,_0x5727f4,_0xd4bf31){var _0x1047f2=require(_0x95ba('0x4e'));var _0x4865cd=![];var _0xe9a7b7={'$and':[db[_0x95ba('0x5e')][_0x95ba('0x3c')](db[_0x95ba('0x5e')]['fn'](_0x95ba('0x5f'),db[_0x95ba('0x5e')][_0x95ba('0x60')]('uniqueid')),_0x31d0f9[_0x95ba('0x33')][_0x95ba('0x61')])]};if(_0x31d0f9[_0x95ba('0x33')]['type']&&_0x31d0f9[_0x95ba('0x33')][_0x95ba('0x2f')]===_0x95ba('0x4f')){_0xe9a7b7[_0x95ba('0x62')][_0x95ba('0x63')]({'uniqueid':_0x31d0f9[_0x95ba('0x4b')]['id']});}else{_0xe9a7b7[_0x95ba('0x62')]['push']({'id':_0x31d0f9[_0x95ba('0x4b')]['id']});}return db[_0x95ba('0x2d')][_0x95ba('0x48')]({'where':_0xe9a7b7,'attributes':['id',_0x95ba('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x5727f4,null))[_0x95ba('0x26')](function(_0x2842c6){if(_0x2842c6){var _0x40785a=util['format'](_0x95ba('0x64'),_0x2842c6[_0x95ba('0x50')]);if(fs[_0x95ba('0x51')](_0x40785a)){_0x4865cd=!![];return _0x1047f2['decryptFile'](_0x40785a,_0x2842c6[_0x95ba('0x50')],config[_0x95ba('0x53')][_0x95ba('0x54')])['then'](function(){return _0x2842c6;});}return _0x2842c6;}})['then'](function(_0x1c836a){if(_0x1c836a){if(!fs[_0x95ba('0x51')](_0x1c836a[_0x95ba('0x50')])){throw new db[(_0x95ba('0x55'))]['ValidationError'](_0x95ba('0x5b'));}if(_0x1c836a[_0x95ba('0x57')]){return _0x5727f4['download'](_0x1c836a[_0x95ba('0x50')],_0x1c836a[_0x95ba('0x57')]+path[_0x95ba('0x58')](_0x1c836a[_0x95ba('0x50')]),function(){if(_0x4865cd){fs[_0x95ba('0x59')](_0x1c836a[_0x95ba('0x50')]);}});}else{return _0x5727f4[_0x95ba('0x4d')](_0x1c836a[_0x95ba('0x50')],function(_0x1b3bee){if(_0x4865cd){fs['unlink'](_0x1c836a[_0x95ba('0x50')]);}});}}})[_0x95ba('0x45')](handleError(_0x5727f4,null));};exports['destroy']=function(_0x4d30a1,_0x25a659){return db[_0x95ba('0x2d')][_0x95ba('0x48')]({'where':{'id':_0x4d30a1[_0x95ba('0x4b')]['id']}})['then'](function(_0x1d893e){if(_[_0x95ba('0x65')](_0x1d893e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1d893e;})['then'](function(_0x50c162){var _0x1dca84=_0x50c162[_0x95ba('0x50')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x1dca84);if(!_[_0x95ba('0x65')](_0x50c162[_0x95ba('0x50')])&&fs[_0x95ba('0x51')](_0x1dca84)){logger[_0x95ba('0x66')](_0x95ba('0x67')+_0x1dca84+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x1dca84);}_0x1dca84=_0x1dca84+'.cypher';if(!_['isNil'](_0x50c162['value'])&&fs[_0x95ba('0x51')](_0x1dca84)){logger[_0x95ba('0x66')](_0x95ba('0x67')+_0x1dca84+_0x95ba('0x68'));fs[_0x95ba('0x69')](_0x1dca84);}return _0x50c162;})[_0x95ba('0x26')](function(_0x3fcb6d){if(!_0x3fcb6d)throw new InternalError();return _0x3fcb6d['destroy']();})['then'](function(){_0x25a659[_0x95ba('0x18')](0xcc)[_0x95ba('0x19')]();})[_0x95ba('0x45')](handleError(_0x25a659,null));};function getBucketslist(_0xd84a48,_0x2018da,_0x3d545b){return new Promise(function(_0x167263,_0x405328){var _0xda4bfc=new AWS['S3']({'accessKeyId':_0x2018da,'secretAccessKey':_0xd84a48,'region':_0x3d545b});_0xda4bfc[_0x95ba('0x6a')]({},function(_0x33d5a1,_0x4c2b48){if(_0x33d5a1){return _0x405328(_0x33d5a1);}else{return _0x167263(_0x4c2b48);}});});}function createBucket(_0x86bbc5,_0xf5ae44,_0x6b0925,_0x53c74c){return new Promise(function(_0x49b277,_0xc985a6){var _0x5f4209=new AWS['S3']({'accessKeyId':_0xf5ae44,'secretAccessKey':_0x86bbc5,'region':_0x6b0925});_0x5f4209[_0x95ba('0x6b')]({'Bucket':_0x53c74c},function(_0x1458d6,_0x3177d4){if(_0x1458d6){return _0xc985a6(_0x1458d6);}else{return _0x49b277(_0x3177d4);}});});}function uploadFile(_0x36f743,_0x1f2ac7,_0x190a45,_0xb7ffbe,_0x389c22,_0x1757ee){return new Promise(function(_0x28a5c0,_0x327baf){var _0x3ebe8a=new AWS['S3']({'accessKeyId':_0x1f2ac7,'secretAccessKey':_0x36f743,'region':_0x190a45});_0x3ebe8a[_0x95ba('0x6c')]({'Bucket':_0xb7ffbe,'Key':_0x389c22,'Body':_0x1757ee},function(_0x4956cd,_0x16eda4){if(_0x4956cd){return _0x327baf(_0x4956cd);}else{return _0x28a5c0(_0x16eda4);}});});}function startTranscribe(_0x4b03fc,_0x5e355c,_0x4f037c,_0x4b0bf0,_0x5b022b,_0x6b4805){return new Promise(function(_0xb015e0,_0x153e43){var _0x2c42ce=new AWS[(_0x95ba('0x6d'))]({'accessKeyId':_0x5e355c,'secretAccessKey':_0x4b03fc,'region':_0x4f037c});_0x2c42ce[_0x95ba('0x6e')]({'TranscriptionJobName':_0x4b0bf0,'LanguageCode':_0x5b022b,'Media':{'MediaFileUri':_0x6b4805}},function(_0x470003,_0x12e729){if(_0x470003){return _0x153e43(_0x470003);}else{return _0xb015e0(_0x12e729);}});});}function transcribe(_0x5cba7f,_0x936356,_0x35f72d,_0x4872d7,_0x3c655f,_0x16eb79,_0x570852){return new Promise(function(_0x41f259,_0xaf3fbf){var _0x3c43b7={};logger[_0x95ba('0x66')](util[_0x95ba('0x32')](_0x95ba('0x6f'),_0x5cba7f,_0x3c655f));return uploadFile(_0x936356,_0x35f72d,_0x4872d7,_0x3c655f,path['basename'](_0x16eb79),fs[_0x95ba('0x70')](_0x16eb79))['then'](function(_0x10da04){logger['info'](util[_0x95ba('0x32')](_0x95ba('0x71'),_0x5cba7f,_0x3c655f,_0x10da04['Location']));_0x3c43b7[_0x95ba('0x72')]=_0x10da04[_0x95ba('0x73')];_0x3c43b7[_0x95ba('0x74')]=_0x10da04[_0x95ba('0x75')];logger[_0x95ba('0x66')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x5cba7f));return startTranscribe(_0x936356,_0x35f72d,_0x4872d7,uuidv4(),_0x570852,_0x10da04[_0x95ba('0x75')]);})[_0x95ba('0x26')](function(_0x29b78d){logger[_0x95ba('0x66')](util[_0x95ba('0x32')](_0x95ba('0x76'),_0x5cba7f,_0x29b78d[_0x95ba('0x77')][_0x95ba('0x78')]));_0x3c43b7['transcribeName']=_0x29b78d[_0x95ba('0x77')][_0x95ba('0x78')];_0x3c43b7[_0x95ba('0x79')]=_0x29b78d[_0x95ba('0x77')][_0x95ba('0x7a')];return _0x41f259(_0x3c43b7);})['catch'](function(_0x2ca2b4){return _0xaf3fbf(_0x2ca2b4);});});}exports[_0x95ba('0x7b')]=function(_0x37259f,_0x503506,_0x3ed144){var _0x179aa0;var _0x138deb;var _0x584295;var _0x2bf919=require(_0x95ba('0x4e'));return db[_0x95ba('0x2d')][_0x95ba('0x7c')]({'where':{'id':_0x37259f[_0x95ba('0x4b')]['id']}})[_0x95ba('0x26')](function(_0x539650){if(_0x539650){var _0xcee4d4=util[_0x95ba('0x32')]('%s.cypher',_0x539650['value']);if(fs[_0x95ba('0x51')](_0xcee4d4)){cypher=!![];return _0x2bf919[_0x95ba('0x52')](_0xcee4d4,_0x539650[_0x95ba('0x50')],config[_0x95ba('0x53')][_0x95ba('0x54')])[_0x95ba('0x26')](function(){return _0x539650;});}return _0x539650;}})[_0x95ba('0x26')](function(_0x88d86a){if(!_0x88d86a){throw new db[(_0x95ba('0x55'))][(_0x95ba('0x56'))](_0x95ba('0x7d'));}_0x138deb=_0x88d86a;return db[_0x95ba('0x7e')][_0x95ba('0x7c')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x503506,null))['then'](function(_0x5bb57e){if(_0x5bb57e){_0x179aa0=_0x5bb57e;if(!_0x179aa0['transcribe']||!_0x179aa0[_0x95ba('0x7f')]||!_0x179aa0[_0x95ba('0x80')]||!_0x179aa0[_0x95ba('0x81')]||!_0x179aa0[_0x95ba('0x72')]){throw new db[(_0x95ba('0x55'))][(_0x95ba('0x56'))]('Transcribe\x20not\x20configured');}if(_0x37259f[_0x95ba('0x4a')][_0x95ba('0x82')]&&(!_0x179aa0['sentiment']||!_0x179aa0['sentimentAccountId']||!_0x179aa0[_0x95ba('0x83')]||!_0x179aa0[_0x95ba('0x81')]||!_0x179aa0['bucket'])){throw new db[(_0x95ba('0x55'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0x95ba('0x7c')]({'where':{'id':_0x179aa0[_0x95ba('0x7f')]}});}})['then'](function(_0x2a7dc5){if(!_0x2a7dc5){throw new db[(_0x95ba('0x55'))]['ValidationError'](_0x95ba('0x84'));}if(!_0x2a7dc5[_0x95ba('0x85')]||!_0x2a7dc5[_0x95ba('0x86')]){throw new db[(_0x95ba('0x55'))][(_0x95ba('0x56'))](_0x95ba('0x87'));}_0x584295=_0x2a7dc5;return getBucketslist(_0x584295['data1'],_0x584295['data2'],_0x179aa0[_0x95ba('0x80')]);})[_0x95ba('0x26')](function(_0x10c555){if(_0x10c555&&_0x10c555[_0x95ba('0x88')]){var _0x5ea6d3=_[_0x95ba('0x48')](_0x10c555[_0x95ba('0x88')],function(_0x34c3e5){return _0x34c3e5[_0x95ba('0x89')]===_0x179aa0[_0x95ba('0x72')];});if(!_0x5ea6d3){logger[_0x95ba('0x66')](util['format'](_0x95ba('0x8a'),_0x37259f['params']['id'],_0x179aa0[_0x95ba('0x72')]));return createBucket(_0x584295[_0x95ba('0x85')],_0x584295[_0x95ba('0x86')],_0x179aa0[_0x95ba('0x80')],_0x179aa0[_0x95ba('0x72')]);}logger['info'](util[_0x95ba('0x32')](_0x95ba('0x8b'),_0x37259f[_0x95ba('0x4b')]['id'],_0x179aa0[_0x95ba('0x72')]));return;}})['then'](function(_0x235d79){if(_0x138deb[_0x95ba('0x79')]===_0x95ba('0x8c')){return transcribe(_0x37259f['params']['id'],_0x584295[_0x95ba('0x85')],_0x584295[_0x95ba('0x86')],_0x179aa0[_0x95ba('0x80')],_0x179aa0[_0x95ba('0x72')],_0x138deb[_0x95ba('0x50')],_0x179aa0[_0x95ba('0x81')]);}else{logger[_0x95ba('0x66')](util[_0x95ba('0x32')](_0x95ba('0x8d'),_0x37259f['params']['id']));return{'transcribeStatus':_0x95ba('0x8e')};}})[_0x95ba('0x26')](function(_0x2cc730){if(_0x2cc730){_0x2cc730['tempSentiment']=_0x37259f[_0x95ba('0x4a')][_0x95ba('0x82')];return _0x138deb[_0x95ba('0x8f')](_0x2cc730);}})[_0x95ba('0x26')](respondWithResult(_0x503506,null))[_0x95ba('0x45')](handleError(_0x503506,null));};function writeFile(_0x45f330,_0x5c8ad0){return new Promise(function(_0x1375da,_0x4eeb90){fs[_0x95ba('0x90')](_0x5c8ad0,_0x45f330,function(_0x147450,_0x9574fa){if(_0x147450){return _0x4eeb90(_0x147450);}else{return _0x1375da(_0x9574fa);}});});}exports['downloadTranscribe']=function(_0x5ee564,_0x23d8e0,_0x12f628){return db['VoiceRecording'][_0x95ba('0x7c')]({'where':{'id':_0x5ee564[_0x95ba('0x4b')]['id']}})[_0x95ba('0x26')](handleEntityNotFound(_0x23d8e0))[_0x95ba('0x26')](function(_0x1d189e){if(_0x1d189e&&_0x1d189e[_0x95ba('0x91')]){var _0x17e954=_0x1d189e[_0x95ba('0x91')];var _0x290849=config['root']+'/server/files/transcribes/transcribe_'+_0x1d189e['id']+_0x95ba('0x92');if(fs[_0x95ba('0x51')](_0x290849)){return _0x290849;}return writeFile(_0x17e954,_0x290849)[_0x95ba('0x26')](function(){return _0x290849;});}else{throw new db['Sequelize'][(_0x95ba('0x56'))](_0x95ba('0x93'));}})['then'](function(_0x3b9815){return _0x23d8e0[_0x95ba('0x4d')](_0x3b9815);})[_0x95ba('0x45')](handleError(_0x23d8e0));}; \ No newline at end of file +var _0xd3b3=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','stack','name','send','map','rawAttributes','fieldName','key','model','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceRecording','then','include','findAll','rows','show','params','keys','includeAll','catch','create','body','describe','../../components/encryptor','uniqueid','find','value','%s.cypher','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','decryptFile','secrets','recording','destroy','Entity\x20not\x20found','info','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','data1','IN_PROGRESS','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash'];(function(_0xe08054,_0x22c584){var _0x5c3e9d=function(_0x3e461a){while(--_0x3e461a){_0xe08054['push'](_0xe08054['shift']());}};_0x5c3e9d(++_0x22c584);}(_0xd3b3,0x8a));var _0x3d3b=function(_0x2a960f,_0x5aab73){_0x2a960f=_0x2a960f-0x0;var _0x5027df=_0xd3b3[_0x2a960f];return _0x5027df;};'use strict';var emlformat=require(_0x3d3b('0x0'));var rimraf=require(_0x3d3b('0x1'));var zipdir=require(_0x3d3b('0x2'));var jsonpatch=require(_0x3d3b('0x3'));var rp=require(_0x3d3b('0x4'));var moment=require('moment');var BPromise=require(_0x3d3b('0x5'));var Mustache=require(_0x3d3b('0x6'));var util=require(_0x3d3b('0x7'));var path=require('path');var sox=require(_0x3d3b('0x8'));var csv=require(_0x3d3b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d3b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3d3b('0xb'));var toCsv=require(_0x3d3b('0x9'));var querystring=require(_0x3d3b('0xc'));var Papa=require(_0x3d3b('0xd'));var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require(_0x3d3b('0xe'));var authService=require(_0x3d3b('0xf'));var qs=require(_0x3d3b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d3b('0x11'));var logger=require('../../config/logger')(_0x3d3b('0x12'));var utils=require(_0x3d3b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3d3b('0x14'));var db=require(_0x3d3b('0x15'))['db'];function respondWithStatusCode(_0x3e7aaa,_0x520247){_0x520247=_0x520247||0xcc;return function(_0x3dd4ed){if(_0x3dd4ed){return _0x3e7aaa['sendStatus'](_0x520247);}return _0x3e7aaa[_0x3d3b('0x16')](_0x520247)[_0x3d3b('0x17')]();};}function respondWithResult(_0x400a41,_0x24591d){_0x24591d=_0x24591d||0xc8;return function(_0x11e85e){if(_0x11e85e){return _0x400a41[_0x3d3b('0x16')](_0x24591d)[_0x3d3b('0x18')](_0x11e85e);}};}function respondWithFilteredResult(_0x398a1f,_0x25ad5e){return function(_0x384cd9){if(_0x384cd9){var _0x16de43=typeof _0x25ad5e[_0x3d3b('0x19')]===_0x3d3b('0x1a')&&typeof _0x25ad5e[_0x3d3b('0x1b')]===_0x3d3b('0x1a');var _0xed47e7=_0x384cd9['count'];var _0x5054ab=_0x16de43?0x0:_0x25ad5e[_0x3d3b('0x19')];var _0x198f88=_0x16de43?_0x384cd9[_0x3d3b('0x1c')]:_0x25ad5e[_0x3d3b('0x19')]+_0x25ad5e[_0x3d3b('0x1b')];var _0x554145;if(_0x198f88>=_0xed47e7){_0x198f88=_0xed47e7;_0x554145=0xc8;}else{_0x554145=0xce;}_0x398a1f[_0x3d3b('0x16')](_0x554145);return _0x398a1f[_0x3d3b('0x1d')](_0x3d3b('0x1e'),_0x5054ab+'-'+_0x198f88+'/'+_0xed47e7)['json'](_0x384cd9);}return null;};}function patchUpdates(_0x31cb16){return function(_0x5d9537){try{jsonpatch[_0x3d3b('0x1f')](_0x5d9537,_0x31cb16,!![]);}catch(_0x51b28a){return BPromise[_0x3d3b('0x20')](_0x51b28a);}return _0x5d9537['save']();};}function saveUpdates(_0x4b82b7,_0x22445b){return function(_0x21b7ed){if(_0x21b7ed){return _0x21b7ed[_0x3d3b('0x21')](_0x4b82b7)['then'](function(_0x57acc6){return _0x57acc6;});}return null;};}function removeEntity(_0x8c7d1c,_0x4f5b95){return function(_0x1b4e6c){if(_0x1b4e6c){return _0x1b4e6c['destroy']()['then'](function(){_0x8c7d1c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1927d1,_0x14e3bb){return function(_0x30ad82){if(!_0x30ad82){_0x1927d1['sendStatus'](0x194);}return _0x30ad82;};}function handleError(_0x4a7f0b,_0x1e1789){_0x1e1789=_0x1e1789||0x1f4;return function(_0x579107){logger['error'](_0x579107[_0x3d3b('0x22')]);if(_0x579107[_0x3d3b('0x23')]){delete _0x579107[_0x3d3b('0x23')];}_0x4a7f0b['status'](_0x1e1789)[_0x3d3b('0x24')](_0x579107);};}exports['index']=function(_0x15ba3e,_0x499e88){var _0x3b60bf={},_0x448f2e={},_0x4b1f74={'count':0x0,'rows':[]};var _0x129612=_[_0x3d3b('0x25')](db['VoiceRecording'][_0x3d3b('0x26')],function(_0x238d33){return{'name':_0x238d33[_0x3d3b('0x27')],'type':_0x238d33['type'][_0x3d3b('0x28')]};});_0x448f2e[_0x3d3b('0x29')]=_['differenceBy'](_[_0x3d3b('0x25')](_0x129612,_0x3d3b('0x23')),[_0x3d3b('0x2a')]);_0x448f2e[_0x3d3b('0x2b')]=_['keys'](_0x15ba3e[_0x3d3b('0x2b')]);_0x448f2e[_0x3d3b('0x2c')]=_[_0x3d3b('0x2d')](_0x448f2e[_0x3d3b('0x29')],_0x448f2e['query']);_0x3b60bf[_0x3d3b('0x2e')]=_[_0x3d3b('0x2d')](_0x448f2e['model'],qs[_0x3d3b('0x2f')](_0x15ba3e[_0x3d3b('0x2b')]['fields']));_0x3b60bf[_0x3d3b('0x2e')]=_0x3b60bf[_0x3d3b('0x2e')][_0x3d3b('0x30')]?_0x3b60bf['attributes']:_0x448f2e[_0x3d3b('0x29')];if(!_0x15ba3e[_0x3d3b('0x2b')][_0x3d3b('0x31')](_0x3d3b('0x32'))){_0x3b60bf[_0x3d3b('0x1b')]=qs['limit'](_0x15ba3e['query']['limit']);_0x3b60bf[_0x3d3b('0x19')]=qs[_0x3d3b('0x19')](_0x15ba3e['query'][_0x3d3b('0x19')]);}_0x3b60bf[_0x3d3b('0x33')]=qs[_0x3d3b('0x34')](_0x15ba3e[_0x3d3b('0x2b')][_0x3d3b('0x34')]);_0x3b60bf[_0x3d3b('0x35')]=qs['filters'](_[_0x3d3b('0x36')](_0x15ba3e[_0x3d3b('0x2b')],_0x448f2e[_0x3d3b('0x2c')]),_0x129612);if(_0x15ba3e[_0x3d3b('0x2b')][_0x3d3b('0x37')]){_0x3b60bf[_0x3d3b('0x35')]=_[_0x3d3b('0x38')](_0x3b60bf['where'],{'$or':_[_0x3d3b('0x25')](_0x129612,function(_0x340707){if(_0x340707[_0x3d3b('0x39')]!==_0x3d3b('0x3a')){var _0xa1d94d={};_0xa1d94d[_0x340707[_0x3d3b('0x23')]]={'$like':'%'+_0x15ba3e[_0x3d3b('0x2b')][_0x3d3b('0x37')]+'%'};return _0xa1d94d;}})});}_0x3b60bf=_['merge']({},_0x3b60bf,_0x15ba3e['options']);var _0x1ce12b={'where':_0x3b60bf[_0x3d3b('0x35')]};return db[_0x3d3b('0x3b')][_0x3d3b('0x1c')](_0x1ce12b)[_0x3d3b('0x3c')](function(_0x1c00c2){_0x4b1f74[_0x3d3b('0x1c')]=_0x1c00c2;if(_0x15ba3e['query']['includeAll']){_0x3b60bf[_0x3d3b('0x3d')]=[{'all':!![]}];}return db['VoiceRecording'][_0x3d3b('0x3e')](_0x3b60bf);})['then'](function(_0x3781ad){_0x4b1f74[_0x3d3b('0x3f')]=_0x3781ad;return _0x4b1f74;})['then'](respondWithFilteredResult(_0x499e88,_0x3b60bf))['catch'](handleError(_0x499e88,null));};exports[_0x3d3b('0x40')]=function(_0x154a1d,_0x46bbe5){var _0x2925f8={'raw':![],'where':{'id':_0x154a1d[_0x3d3b('0x41')]['id']}},_0x30d2e5={};_0x30d2e5[_0x3d3b('0x29')]=_[_0x3d3b('0x42')](db['VoiceRecording'][_0x3d3b('0x26')]);_0x30d2e5[_0x3d3b('0x2b')]=_[_0x3d3b('0x42')](_0x154a1d[_0x3d3b('0x2b')]);_0x30d2e5[_0x3d3b('0x2c')]=_[_0x3d3b('0x2d')](_0x30d2e5[_0x3d3b('0x29')],_0x30d2e5[_0x3d3b('0x2b')]);_0x2925f8[_0x3d3b('0x2e')]=_['intersection'](_0x30d2e5[_0x3d3b('0x29')],qs[_0x3d3b('0x2f')](_0x154a1d[_0x3d3b('0x2b')][_0x3d3b('0x2f')]));_0x2925f8[_0x3d3b('0x2e')]=_0x2925f8[_0x3d3b('0x2e')][_0x3d3b('0x30')]?_0x2925f8[_0x3d3b('0x2e')]:_0x30d2e5[_0x3d3b('0x29')];if(_0x154a1d[_0x3d3b('0x2b')][_0x3d3b('0x43')]){_0x2925f8[_0x3d3b('0x3d')]=[{'all':!![]}];}_0x2925f8=_[_0x3d3b('0x38')]({},_0x2925f8,_0x154a1d['options']);return db['VoiceRecording']['find'](_0x2925f8)[_0x3d3b('0x3c')](handleEntityNotFound(_0x46bbe5,null))[_0x3d3b('0x3c')](respondWithResult(_0x46bbe5,null))[_0x3d3b('0x44')](handleError(_0x46bbe5,null));};exports['create']=function(_0x3d86eb,_0x43055b){return db[_0x3d3b('0x3b')][_0x3d3b('0x45')](_0x3d86eb['body'],{})[_0x3d3b('0x3c')](respondWithResult(_0x43055b,0xc9))['catch'](handleError(_0x43055b,null));};exports[_0x3d3b('0x21')]=function(_0x2badf3,_0x5ca85f){if(_0x2badf3[_0x3d3b('0x46')]['id']){delete _0x2badf3[_0x3d3b('0x46')]['id'];}return db[_0x3d3b('0x3b')]['find']({'where':{'id':_0x2badf3[_0x3d3b('0x41')]['id']}})['then'](handleEntityNotFound(_0x5ca85f,null))['then'](saveUpdates(_0x2badf3['body'],null))[_0x3d3b('0x3c')](respondWithResult(_0x5ca85f,null))['catch'](handleError(_0x5ca85f,null));};exports[_0x3d3b('0x47')]=function(_0x3acd35,_0x2cdc8f){return db['VoiceRecording']['describe']()[_0x3d3b('0x3c')](respondWithResult(_0x2cdc8f,null))[_0x3d3b('0x44')](handleError(_0x2cdc8f,null));};exports['download']=function(_0x393a31,_0x10fd1d,_0x2fcc45){var _0x55c242=require(_0x3d3b('0x48'));var _0x410def=![];var _0x4161db={};if(_0x393a31[_0x3d3b('0x2b')][_0x3d3b('0x39')]&&_0x393a31[_0x3d3b('0x2b')]['type']===_0x3d3b('0x49')){_0x4161db[_0x3d3b('0x49')]=_0x393a31[_0x3d3b('0x41')]['id'];}else{_0x4161db['id']=_0x393a31[_0x3d3b('0x41')]['id'];}return db[_0x3d3b('0x3b')][_0x3d3b('0x4a')]({'where':_0x4161db,'attributes':['id',_0x3d3b('0x4b')],'raw':!![]})[_0x3d3b('0x3c')](handleEntityNotFound(_0x10fd1d,null))[_0x3d3b('0x3c')](function(_0xc6a8ed){if(_0xc6a8ed){var _0x740316=_0xc6a8ed['value'];var _0x53d90b=util[_0x3d3b('0x2a')](_0x3d3b('0x4c'),_0x740316);if(fs['existsSync'](_0x53d90b)){_0x410def=!![];return _0x55c242['decryptFile'](_0x53d90b,_0x740316,config['secrets']['recording'])[_0x3d3b('0x3c')](function(){return _0xc6a8ed;});}return _0xc6a8ed;}})[_0x3d3b('0x3c')](function(_0x3399a4){if(_0x3399a4){var _0x477f1d=_0x3399a4[_0x3d3b('0x4b')];if(!fs[_0x3d3b('0x4d')](_0x477f1d)){throw new db[(_0x3d3b('0x4e'))][(_0x3d3b('0x4f'))](_0x3d3b('0x50'));}if(_0x3399a4[_0x3d3b('0x51')]){return _0x10fd1d[_0x3d3b('0x52')](_0x477f1d,_0x3399a4[_0x3d3b('0x51')]+path[_0x3d3b('0x53')](_0x477f1d),function(){if(_0x410def){fs[_0x3d3b('0x54')](_0x477f1d);}});}else{return _0x10fd1d[_0x3d3b('0x52')](_0x477f1d,function(_0x1bdf48){if(_0x410def){fs[_0x3d3b('0x54')](_0x477f1d);}});}}})['catch'](function(_0x4154af){if(_0x4154af[_0x3d3b('0x55')]===_0x3d3b('0x50')){_0x10fd1d[_0x3d3b('0x16')](0x194)[_0x3d3b('0x24')](_0x3d3b('0x56'));}else{return handleError(_0x10fd1d,null);}});};exports[_0x3d3b('0x57')]=function(_0x4b388c,_0x163040,_0x4c2c09){var _0x24473d=require('../../components/encryptor');var _0x86eb33=![];var _0x4eaa9e={'$and':[db[_0x3d3b('0x58')][_0x3d3b('0x35')](db[_0x3d3b('0x58')]['fn'](_0x3d3b('0x59'),db['sequelize'][_0x3d3b('0x5a')](_0x3d3b('0x49'))),_0x4b388c[_0x3d3b('0x2b')][_0x3d3b('0x5b')])]};if(_0x4b388c['query'][_0x3d3b('0x39')]&&_0x4b388c[_0x3d3b('0x2b')][_0x3d3b('0x39')]===_0x3d3b('0x49')){_0x4eaa9e[_0x3d3b('0x5c')][_0x3d3b('0x5d')]({'uniqueid':_0x4b388c[_0x3d3b('0x41')]['id']});}else{_0x4eaa9e[_0x3d3b('0x5c')][_0x3d3b('0x5d')]({'id':_0x4b388c[_0x3d3b('0x41')]['id']});}return db[_0x3d3b('0x3b')][_0x3d3b('0x4a')]({'where':_0x4eaa9e,'attributes':['id',_0x3d3b('0x4b')],'raw':!![]})[_0x3d3b('0x3c')](handleEntityNotFound(_0x163040,null))['then'](function(_0x3be9fa){if(_0x3be9fa){var _0x89832d=util['format'](_0x3d3b('0x4c'),_0x3be9fa['value']);if(fs[_0x3d3b('0x4d')](_0x89832d)){_0x86eb33=!![];return _0x24473d[_0x3d3b('0x5e')](_0x89832d,_0x3be9fa[_0x3d3b('0x4b')],config[_0x3d3b('0x5f')][_0x3d3b('0x60')])[_0x3d3b('0x3c')](function(){return _0x3be9fa;});}return _0x3be9fa;}})['then'](function(_0x50a384){if(_0x50a384){if(!fs['existsSync'](_0x50a384[_0x3d3b('0x4b')])){throw new db['Sequelize'][(_0x3d3b('0x4f'))](_0x3d3b('0x50'));}if(_0x50a384[_0x3d3b('0x51')]){return _0x163040[_0x3d3b('0x52')](_0x50a384[_0x3d3b('0x4b')],_0x50a384[_0x3d3b('0x51')]+path[_0x3d3b('0x53')](_0x50a384[_0x3d3b('0x4b')]),function(){if(_0x86eb33){fs[_0x3d3b('0x54')](_0x50a384['value']);}});}else{return _0x163040[_0x3d3b('0x52')](_0x50a384[_0x3d3b('0x4b')],function(_0x4aa92c){if(_0x86eb33){fs[_0x3d3b('0x54')](_0x50a384[_0x3d3b('0x4b')]);}});}}})[_0x3d3b('0x44')](handleError(_0x163040,null));};exports[_0x3d3b('0x61')]=function(_0xc0206c,_0x4b85ea){return db[_0x3d3b('0x3b')][_0x3d3b('0x4a')]({'where':{'id':_0xc0206c['params']['id']}})[_0x3d3b('0x3c')](function(_0x565cb3){if(_['isNil'](_0x565cb3)){throw new ReferenceError(_0x3d3b('0x62'));}return _0x565cb3;})[_0x3d3b('0x3c')](function(_0x32954a){var _0x504942=_0x32954a['value'];logger[_0x3d3b('0x63')]('cancellazione\x20fisica\x20documento\x20%s',_0x504942);if(!_['isNil'](_0x32954a[_0x3d3b('0x4b')])&&fs[_0x3d3b('0x4d')](_0x504942)){logger[_0x3d3b('0x63')](_0x3d3b('0x64')+_0x504942+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3d3b('0x65')](_0x504942);}_0x504942=_0x504942+'.cypher';if(!_['isNil'](_0x32954a[_0x3d3b('0x4b')])&&fs[_0x3d3b('0x4d')](_0x504942)){logger['info'](_0x3d3b('0x64')+_0x504942+_0x3d3b('0x66'));fs[_0x3d3b('0x65')](_0x504942);}return _0x32954a;})[_0x3d3b('0x3c')](function(_0x1f5994){if(!_0x1f5994)throw new InternalError();return _0x1f5994[_0x3d3b('0x61')]();})[_0x3d3b('0x3c')](function(){_0x4b85ea[_0x3d3b('0x16')](0xcc)['end']();})['catch'](handleError(_0x4b85ea,null));};function getBucketslist(_0x3233ad,_0x279fce,_0x256b30){return new Promise(function(_0x106359,_0x2802d3){var _0x2c2040=new AWS['S3']({'accessKeyId':_0x279fce,'secretAccessKey':_0x3233ad,'region':_0x256b30});_0x2c2040[_0x3d3b('0x67')]({},function(_0x29438b,_0x3875d2){if(_0x29438b){return _0x2802d3(_0x29438b);}else{return _0x106359(_0x3875d2);}});});}function createBucket(_0x4094ba,_0x72e990,_0x7eda2d,_0x4ed036){return new Promise(function(_0x137db5,_0x25ddd6){var _0x18b893=new AWS['S3']({'accessKeyId':_0x72e990,'secretAccessKey':_0x4094ba,'region':_0x7eda2d});_0x18b893['createBucket']({'Bucket':_0x4ed036},function(_0xb09570,_0x1bbcd0){if(_0xb09570){return _0x25ddd6(_0xb09570);}else{return _0x137db5(_0x1bbcd0);}});});}function uploadFile(_0x41075d,_0x32eaa9,_0x3d4539,_0x4c9007,_0x26085c,_0x2952e0){return new Promise(function(_0x5e8b27,_0x4c4a2b){var _0x232b1b=new AWS['S3']({'accessKeyId':_0x32eaa9,'secretAccessKey':_0x41075d,'region':_0x3d4539});_0x232b1b[_0x3d3b('0x68')]({'Bucket':_0x4c9007,'Key':_0x26085c,'Body':_0x2952e0},function(_0xa38814,_0x49fd81){if(_0xa38814){return _0x4c4a2b(_0xa38814);}else{return _0x5e8b27(_0x49fd81);}});});}function startTranscribe(_0x36f5d2,_0x5d8d65,_0x2339ef,_0x559850,_0x101d0c,_0x37ceb7){return new Promise(function(_0x2a0e2c,_0x2e62f7){var _0x2e707e=new AWS[(_0x3d3b('0x69'))]({'accessKeyId':_0x5d8d65,'secretAccessKey':_0x36f5d2,'region':_0x2339ef});_0x2e707e[_0x3d3b('0x6a')]({'TranscriptionJobName':_0x559850,'LanguageCode':_0x101d0c,'Media':{'MediaFileUri':_0x37ceb7}},function(_0x50f1ff,_0x2bc471){if(_0x50f1ff){return _0x2e62f7(_0x50f1ff);}else{return _0x2a0e2c(_0x2bc471);}});});}function transcribe(_0x503fa2,_0x10b2c6,_0x5538c3,_0x5e9a74,_0x4955b1,_0x1679f7,_0x3cf358){return new Promise(function(_0x3b1316,_0x59f4d4){var _0x513a68={};logger[_0x3d3b('0x63')](util['format'](_0x3d3b('0x6b'),_0x503fa2,_0x4955b1));return uploadFile(_0x10b2c6,_0x5538c3,_0x5e9a74,_0x4955b1,path[_0x3d3b('0x6c')](_0x1679f7),fs[_0x3d3b('0x6d')](_0x1679f7))['then'](function(_0x36ae26){logger[_0x3d3b('0x63')](util['format'](_0x3d3b('0x6e'),_0x503fa2,_0x4955b1,_0x36ae26[_0x3d3b('0x6f')]));_0x513a68['bucket']=_0x36ae26[_0x3d3b('0x70')];_0x513a68[_0x3d3b('0x71')]=_0x36ae26[_0x3d3b('0x6f')];logger[_0x3d3b('0x63')](util[_0x3d3b('0x2a')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x503fa2));return startTranscribe(_0x10b2c6,_0x5538c3,_0x5e9a74,uuidv4(),_0x3cf358,_0x36ae26[_0x3d3b('0x6f')]);})[_0x3d3b('0x3c')](function(_0x584ae4){logger[_0x3d3b('0x63')](util['format'](_0x3d3b('0x72'),_0x503fa2,_0x584ae4[_0x3d3b('0x73')][_0x3d3b('0x74')]));_0x513a68[_0x3d3b('0x75')]=_0x584ae4[_0x3d3b('0x73')]['TranscriptionJobName'];_0x513a68[_0x3d3b('0x76')]=_0x584ae4[_0x3d3b('0x73')]['TranscriptionJobStatus'];return _0x3b1316(_0x513a68);})[_0x3d3b('0x44')](function(_0x1fb25b){return _0x59f4d4(_0x1fb25b);});});}exports[_0x3d3b('0x77')]=function(_0x3b49bb,_0x27c327,_0x3d9b9d){var _0x34be62;var _0x48b190;var _0xd695c5;var _0x11c83c=require(_0x3d3b('0x48'));return db[_0x3d3b('0x3b')][_0x3d3b('0x78')]({'where':{'id':_0x3b49bb[_0x3d3b('0x41')]['id']}})['then'](function(_0x8c6fbc){if(_0x8c6fbc){var _0x128b9f=util[_0x3d3b('0x2a')](_0x3d3b('0x4c'),_0x8c6fbc[_0x3d3b('0x4b')]);if(fs[_0x3d3b('0x4d')](_0x128b9f)){cypher=!![];return _0x11c83c['decryptFile'](_0x128b9f,_0x8c6fbc['value'],config['secrets'][_0x3d3b('0x60')])[_0x3d3b('0x3c')](function(){return _0x8c6fbc;});}return _0x8c6fbc;}})['then'](function(_0x593558){if(!_0x593558){throw new db[(_0x3d3b('0x4e'))][(_0x3d3b('0x4f'))](_0x3d3b('0x79'));}_0x48b190=_0x593558;return db[_0x3d3b('0x7a')][_0x3d3b('0x78')]({'where':{'id':0x1}});})[_0x3d3b('0x3c')](handleEntityNotFound(_0x27c327,null))[_0x3d3b('0x3c')](function(_0x2bc823){if(_0x2bc823){_0x34be62=_0x2bc823;if(!_0x34be62['transcribe']||!_0x34be62[_0x3d3b('0x7b')]||!_0x34be62['transcribeRegion']||!_0x34be62[_0x3d3b('0x7c')]||!_0x34be62['bucket']){throw new db[(_0x3d3b('0x4e'))][(_0x3d3b('0x4f'))](_0x3d3b('0x7d'));}if(_0x3b49bb[_0x3d3b('0x46')][_0x3d3b('0x7e')]&&(!_0x34be62[_0x3d3b('0x7f')]||!_0x34be62['sentimentAccountId']||!_0x34be62[_0x3d3b('0x80')]||!_0x34be62[_0x3d3b('0x7c')]||!_0x34be62[_0x3d3b('0x81')])){throw new db[(_0x3d3b('0x4e'))][(_0x3d3b('0x4f'))](_0x3d3b('0x82'));}return db[_0x3d3b('0x83')]['findOne']({'where':{'id':_0x34be62[_0x3d3b('0x7b')]}});}})[_0x3d3b('0x3c')](function(_0x2b7609){if(!_0x2b7609){throw new db['Sequelize'][(_0x3d3b('0x4f'))](_0x3d3b('0x84'));}if(!_0x2b7609['data1']||!_0x2b7609['data2']){throw new db['Sequelize'][(_0x3d3b('0x4f'))]('Cloud\x20Provider\x20not\x20configured');}_0xd695c5=_0x2b7609;return getBucketslist(_0xd695c5['data1'],_0xd695c5[_0x3d3b('0x85')],_0x34be62[_0x3d3b('0x86')]);})[_0x3d3b('0x3c')](function(_0x3a1490){if(_0x3a1490&&_0x3a1490[_0x3d3b('0x87')]){var _0x598d79=_[_0x3d3b('0x4a')](_0x3a1490['Buckets'],function(_0x14a4bd){return _0x14a4bd[_0x3d3b('0x88')]===_0x34be62[_0x3d3b('0x81')];});if(!_0x598d79){logger[_0x3d3b('0x63')](util[_0x3d3b('0x2a')](_0x3d3b('0x89'),_0x3b49bb['params']['id'],_0x34be62[_0x3d3b('0x81')]));return createBucket(_0xd695c5['data1'],_0xd695c5[_0x3d3b('0x85')],_0x34be62[_0x3d3b('0x86')],_0x34be62[_0x3d3b('0x81')]);}logger[_0x3d3b('0x63')](util[_0x3d3b('0x2a')](_0x3d3b('0x8a'),_0x3b49bb[_0x3d3b('0x41')]['id'],_0x34be62['bucket']));return;}})[_0x3d3b('0x3c')](function(_0x12223a){if(_0x48b190[_0x3d3b('0x76')]===_0x3d3b('0x8b')){return transcribe(_0x3b49bb[_0x3d3b('0x41')]['id'],_0xd695c5[_0x3d3b('0x8c')],_0xd695c5['data2'],_0x34be62[_0x3d3b('0x86')],_0x34be62[_0x3d3b('0x81')],_0x48b190[_0x3d3b('0x4b')],_0x34be62[_0x3d3b('0x7c')]);}else{logger[_0x3d3b('0x63')](util[_0x3d3b('0x2a')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x3b49bb[_0x3d3b('0x41')]['id']));return{'transcribeStatus':_0x3d3b('0x8d')};}})['then'](function(_0x3fb96e){if(_0x3fb96e){_0x3fb96e['tempSentiment']=_0x3b49bb[_0x3d3b('0x46')][_0x3d3b('0x7e')];return _0x48b190[_0x3d3b('0x8e')](_0x3fb96e);}})[_0x3d3b('0x3c')](respondWithResult(_0x27c327,null))[_0x3d3b('0x44')](handleError(_0x27c327,null));};function writeFile(_0x24e3cc,_0x571217){return new Promise(function(_0x11b5c9,_0x4e0d74){fs[_0x3d3b('0x8f')](_0x571217,_0x24e3cc,function(_0x589804,_0x547a96){if(_0x589804){return _0x4e0d74(_0x589804);}else{return _0x11b5c9(_0x547a96);}});});}exports['downloadTranscribe']=function(_0x56ee7c,_0x25ff10,_0x2e9d30){return db[_0x3d3b('0x3b')][_0x3d3b('0x78')]({'where':{'id':_0x56ee7c[_0x3d3b('0x41')]['id']}})[_0x3d3b('0x3c')](handleEntityNotFound(_0x25ff10))[_0x3d3b('0x3c')](function(_0x24ee4e){if(_0x24ee4e&&_0x24ee4e['fileText']){var _0x28f2c6=_0x24ee4e[_0x3d3b('0x90')];var _0x1fd674=config[_0x3d3b('0x91')]+_0x3d3b('0x92')+_0x24ee4e['id']+_0x3d3b('0x93');if(fs[_0x3d3b('0x4d')](_0x1fd674)){return _0x1fd674;}return writeFile(_0x28f2c6,_0x1fd674)[_0x3d3b('0x3c')](function(){return _0x1fd674;});}else{throw new db[(_0x3d3b('0x4e'))][(_0x3d3b('0x4f'))](_0x3d3b('0x94'));}})['then'](function(_0x9ef943){return _0x25ff10[_0x3d3b('0x52')](_0x9ef943);})['catch'](handleError(_0x25ff10));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 86f6b83..db3245a 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 _0x1c5c=['VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x4ef5b7,_0x1fa483){var _0x47b2db=function(_0x20b7ab){while(--_0x20b7ab){_0x4ef5b7['push'](_0x4ef5b7['shift']());}};_0x47b2db(++_0x1fa483);}(_0x1c5c,0x148));var _0xc1c5=function(_0x27e998,_0x109116){_0x27e998=_0x27e998-0x0;var _0x1d039f=_0x1c5c[_0x27e998];return _0x1d039f;};'use strict';var _=require(_0xc1c5('0x0'));var util=require(_0xc1c5('0x1'));var logger=require(_0xc1c5('0x2'))(_0xc1c5('0x3'));var moment=require('moment');var BPromise=require(_0xc1c5('0x4'));var rp=require(_0xc1c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc1c5('0x6'));var config=require(_0xc1c5('0x7'));var attributes=require('./voiceRecording.attributes');module[_0xc1c5('0x8')]=function(_0x71e36a,_0x5256e4){return _0x71e36a[_0xc1c5('0x9')](_0xc1c5('0xa'),attributes,{'tableName':_0xc1c5('0xb'),'paranoid':![],'indexes':[{'name':_0xc1c5('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8850=['uniqueid','../../config/logger','moment','request-promise','../../config/environment','exports','define','VoiceRecording'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0x8850,0xe1));var _0x0885=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8850[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0885('0x0'))('api');var moment=require(_0x0885('0x1'));var BPromise=require('bluebird');var rp=require(_0x0885('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0885('0x3'));var attributes=require('./voiceRecording.attributes');module[_0x0885('0x4')]=function(_0x50ff94,_0x2f7bd2){return _0x50ff94[_0x0885('0x5')](_0x0885('0x6'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x0885('0x7'),'fields':[_0x0885('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index f7d2d85..684c271 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 _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x37eb5c,_0x477cc0){var _0x243e31=function(_0x2ebb5a){while(--_0x2ebb5a){_0x37eb5c['push'](_0x37eb5c['shift']());}};_0x243e31(++_0x477cc0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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['UpdateVoiceRecording']=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?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x16c467,_0x53d6fa){var _0x22db4f=function(_0x498d3f){while(--_0x498d3f){_0x16c467['push'](_0x16c467['shift']());}};_0x22db4f(++_0x53d6fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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['UpdateVoiceRecording']=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?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 31a67ab..2ad410a 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 _0x3d6e=['describe','put','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x5f202d,_0x49a8aa){var _0x2369ff=function(_0x1d3a95){while(--_0x1d3a95){_0x5f202d['push'](_0x5f202d['shift']());}};_0x2369ff(++_0x49a8aa);}(_0x3d6e,0x10f));var _0xe3d6=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x3d6e[_0x342700];return _0x53406f;};'use strict';var multer=require('multer');var util=require(_0xe3d6('0x0'));var path=require(_0xe3d6('0x1'));var timeout=require(_0xe3d6('0x2'));var express=require(_0xe3d6('0x3'));var router=express['Router']();var fs_extra=require(_0xe3d6('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe3d6('0x5'));var controller=require(_0xe3d6('0x6'));router[_0xe3d6('0x7')]('/',auth[_0xe3d6('0x8')](),controller['index']);router['get']('/describe',auth[_0xe3d6('0x8')](),controller[_0xe3d6('0x9')]);router['get']('/:id',auth[_0xe3d6('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe3d6('0xa')]('/:id',auth[_0xe3d6('0x8')](),controller[_0xe3d6('0xb')]);router[_0xe3d6('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xe3d6('0xd')]);module['exports']=router; \ No newline at end of file +var _0x7bbc=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','/describe','isAuthenticated','/:id','show','put','delete'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x7bbc,0x1f0));var _0xc7bb=function(_0x2b4eb1,_0x1d007a){_0x2b4eb1=_0x2b4eb1-0x0;var _0x2dd440=_0x7bbc[_0x2b4eb1];return _0x2dd440;};'use strict';var multer=require(_0xc7bb('0x0'));var util=require(_0xc7bb('0x1'));var path=require(_0xc7bb('0x2'));var timeout=require('connect-timeout');var express=require(_0xc7bb('0x3'));var router=express[_0xc7bb('0x4')]();var fs_extra=require(_0xc7bb('0x5'));var auth=require(_0xc7bb('0x6'));var interaction=require(_0xc7bb('0x7'));var config=require(_0xc7bb('0x8'));var controller=require(_0xc7bb('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc7bb('0xa')](_0xc7bb('0xb'),auth[_0xc7bb('0xc')](),controller['describe']);router[_0xc7bb('0xa')](_0xc7bb('0xd'),auth[_0xc7bb('0xc')](),controller[_0xc7bb('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc7bb('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xc7bb('0x10')]('/:id',auth[_0xc7bb('0xc')](),controller[_0xc7bb('0x11')]);module[_0xc7bb('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 97f6746..3c73c28 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 _0xc64b=['sequelize','moment','exports','ENUM','STRING'];(function(_0x4169d8,_0x3d7cd4){var _0x32084a=function(_0x5f59c6){while(--_0x5f59c6){_0x4169d8['push'](_0x4169d8['shift']());}};_0x32084a(++_0x3d7cd4);}(_0xc64b,0x14a));var _0xbc64=function(_0x3ccc9c,_0x51e027){_0x3ccc9c=_0x3ccc9c-0x0;var _0x45973f=_0xc64b[_0x3ccc9c];return _0x45973f;};'use strict';var Sequelize=require(_0xbc64('0x0'));var moment=require(_0xbc64('0x1'));module[_0xbc64('0x2')]={'type':{'type':Sequelize[_0xbc64('0x3')]('blind','attended')},'result':{'type':Sequelize[_0xbc64('0x4')]},'transfererchannel':{'type':Sequelize[_0xbc64('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xbc64('0x4')]},'transferercalleridname':{'type':Sequelize[_0xbc64('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xbc64('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xbc64('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xbc64('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xbc64('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xbc64('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xbc64('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xbc64('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xbc64('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xbc64('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xbc64('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xbc64('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xbc64('0x3')]('Yes','No')},'context':{'type':Sequelize[_0xbc64('0x4')]},'extension':{'type':Sequelize[_0xbc64('0x4')]}}; \ No newline at end of file +var _0x70af=['blind','STRING','sequelize','moment','exports','ENUM'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x70af,0xe6));var _0xf70a=function(_0x4f2dc0,_0xfc5b53){_0x4f2dc0=_0x4f2dc0-0x0;var _0x3aa369=_0x70af[_0x4f2dc0];return _0x3aa369;};'use strict';var Sequelize=require(_0xf70a('0x0'));var moment=require(_0xf70a('0x1'));module[_0xf70a('0x2')]={'type':{'type':Sequelize[_0xf70a('0x3')](_0xf70a('0x4'),'attended')},'result':{'type':Sequelize[_0xf70a('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xf70a('0x5')]},'transferercalleridname':{'type':Sequelize[_0xf70a('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xf70a('0x5')]},'transferercontext':{'type':Sequelize[_0xf70a('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xf70a('0x5')]},'transfereechannel':{'type':Sequelize[_0xf70a('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xf70a('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xf70a('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xf70a('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xf70a('0x5')]},'transfereecontext':{'type':Sequelize[_0xf70a('0x5')]},'transfereeexten':{'type':Sequelize[_0xf70a('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xf70a('0x5')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0xf70a('0x5')]},'extension':{'type':Sequelize[_0xf70a('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 5f52f5f..e75132e 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 _0x7a54=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','VoiceTransferReport','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x395b12,_0x3a396b){var _0x5cddfb=function(_0x19f1c5){while(--_0x19f1c5){_0x395b12['push'](_0x395b12['shift']());}};_0x5cddfb(++_0x3a396b);}(_0x7a54,0x106));var _0x47a5=function(_0x285fc7,_0x1d077a){_0x285fc7=_0x285fc7-0x0;var _0x3a08d3=_0x7a54[_0x285fc7];return _0x3a08d3;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['VoiceTransferReport'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['VoiceTransferReport']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['VoiceTransferReport']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x48')]=function(_0x1c9a62,_0x5f6a){return db['VoiceTransferReport'][_0x47a5('0x48')]()['then'](respondWithResult(_0x5f6a,null))[_0x47a5('0x46')](handleError(_0x5f6a,null));}; \ No newline at end of file +var _0x7a54=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','VoiceTransferReport','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0xee6366,_0xe36b0a){var _0xe4d7bc=function(_0x1ce306){while(--_0x1ce306){_0xee6366['push'](_0xee6366['shift']());}};_0xe4d7bc(++_0xe36b0a);}(_0x7a54,0x106));var _0x47a5=function(_0x5c78f8,_0x238bf4){_0x5c78f8=_0x5c78f8-0x0;var _0x5ec7a3=_0x7a54[_0x5c78f8];return _0x5ec7a3;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['VoiceTransferReport'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['VoiceTransferReport']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['VoiceTransferReport']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x48')]=function(_0x1c9a62,_0x5f6a){return db['VoiceTransferReport'][_0x47a5('0x48')]()['then'](respondWithResult(_0x5f6a,null))[_0x47a5('0x46')](handleError(_0x5f6a,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 8da6c22..b3180c1 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 _0x2743=['define','VoiceTransferReport','report_call_transfer','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports'];(function(_0x3c5c49,_0x70d174){var _0x397b13=function(_0x3f0b4d){while(--_0x3f0b4d){_0x3c5c49['push'](_0x3c5c49['shift']());}};_0x397b13(++_0x70d174);}(_0x2743,0x13b));var _0x3274=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2743[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3274('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3274('0x1'));var moment=require(_0x3274('0x2'));var BPromise=require(_0x3274('0x3'));var rp=require(_0x3274('0x4'));var fs=require('fs');var path=require(_0x3274('0x5'));var rimraf=require('rimraf');var config=require(_0x3274('0x6'));var attributes=require(_0x3274('0x7'));module[_0x3274('0x8')]=function(_0x476738,_0x41f0cb){return _0x476738[_0x3274('0x9')](_0x3274('0xa'),attributes,{'tableName':_0x3274('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe04a=['path','rimraf','../../config/environment','exports','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4a6164,_0x5685dc){var _0x14fc4e=function(_0x12d66b){while(--_0x12d66b){_0x4a6164['push'](_0x4a6164['shift']());}};_0x14fc4e(++_0x5685dc);}(_0xe04a,0x10f));var _0xae04=function(_0x1823e6,_0x322154){_0x1823e6=_0x1823e6-0x0;var _0x15fad9=_0xe04a[_0x1823e6];return _0x15fad9;};'use strict';var _=require(_0xae04('0x0'));var util=require('util');var logger=require(_0xae04('0x1'))(_0xae04('0x2'));var moment=require(_0xae04('0x3'));var BPromise=require(_0xae04('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xae04('0x5'));var rimraf=require(_0xae04('0x6'));var config=require(_0xae04('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0xae04('0x8')]=function(_0x29ea68,_0x4231a6){return _0x29ea68[_0xae04('0x9')](_0xae04('0xa'),attributes,{'tableName':_0xae04('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index dd0af3b..0540d57 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 _0xcff8=['../../config/utils','../../config/logger','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceTransferReport','create','options','raw','then','debug','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2d8dc7,_0x1165af){var _0x3980b5=function(_0xf426f3){while(--_0xf426f3){_0x2d8dc7['push'](_0x2d8dc7['shift']());}};_0x3980b5(++_0x1165af);}(_0xcff8,0x14b));var _0x8cff=function(_0x447d43,_0x67d9fc){_0x447d43=_0x447d43-0x0;var _0x4b032c=_0xcff8[_0x447d43];return _0x4b032c;};'use strict';var _=require(_0x8cff('0x0'));var util=require('util');var moment=require(_0x8cff('0x1'));var BPromise=require(_0x8cff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8cff('0x3'));var db=require(_0x8cff('0x4'))['db'];var utils=require(_0x8cff('0x5'));var logger=require(_0x8cff('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8cff('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1fb46a,_0x26d16f,_0x193f6e){return new BPromise(function(_0xc7d440,_0x3fc842){return client[_0x8cff('0x8')](_0x1fb46a,_0x193f6e)['then'](function(_0x2dc625){logger[_0x8cff('0x9')](_0x8cff('0xa'),_0x26d16f,_0x8cff('0xb'));logger['debug'](_0x8cff('0xc'),_0x26d16f,_0x8cff('0xb'),JSON[_0x8cff('0xd')](_0x2dc625));if(_0x2dc625[_0x8cff('0xe')]){if(_0x2dc625[_0x8cff('0xe')]['code']===0x1f4){logger[_0x8cff('0xe')](_0x8cff('0xa'),_0x26d16f,_0x2dc625[_0x8cff('0xe')][_0x8cff('0xf')]);return _0x3fc842(_0x2dc625[_0x8cff('0xe')]['message']);}logger[_0x8cff('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x26d16f,_0x2dc625[_0x8cff('0xe')][_0x8cff('0xf')]);return _0xc7d440(_0x2dc625[_0x8cff('0xe')][_0x8cff('0xf')]);}else{logger[_0x8cff('0x9')](_0x8cff('0xa'),_0x26d16f,_0x8cff('0xb'));_0xc7d440(_0x2dc625[_0x8cff('0x10')][_0x8cff('0xf')]);}})[_0x8cff('0x11')](function(_0x87eefb){logger[_0x8cff('0xe')](_0x8cff('0xa'),_0x26d16f,_0x87eefb);_0x3fc842(_0x87eefb);});});}exports[_0x8cff('0x12')]=function(_0x5d8d55){var _0x3d07a8=this;return new Promise(function(_0x4f12ab,_0x585d1d){return db['VoiceTransferReport'][_0x8cff('0x13')](_0x5d8d55['body'],{'raw':_0x5d8d55[_0x8cff('0x14')]?_0x5d8d55[_0x8cff('0x14')][_0x8cff('0x15')]===undefined?!![]:![]:!![]})[_0x8cff('0x16')](function(_0x594a1d){logger[_0x8cff('0x9')](_0x8cff('0x12'),_0x5d8d55);logger[_0x8cff('0x17')](_0x8cff('0x12'),_0x5d8d55,JSON[_0x8cff('0xd')](_0x594a1d));_0x4f12ab(_0x594a1d);})[_0x8cff('0x11')](function(_0x2d4770){logger['error'](_0x8cff('0x12'),_0x2d4770[_0x8cff('0xf')],_0x5d8d55);_0x585d1d(_0x3d07a8['error'](0x1f4,_0x2d4770['message']));});});}; \ No newline at end of file +var _0x032a=['result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','then','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x57d45b,_0x4651d5){var _0x4ceefb=function(_0x1cb65f){while(--_0x1cb65f){_0x57d45b['push'](_0x57d45b['shift']());}};_0x4ceefb(++_0x4651d5);}(_0x032a,0xf0));var _0xa032=function(_0x5093e9,_0x5154d0){_0x5093e9=_0x5093e9-0x0;var _0x4c9a22=_0x032a[_0x5093e9];return _0x4c9a22;};'use strict';var _=require('lodash');var util=require(_0xa032('0x0'));var moment=require('moment');var BPromise=require(_0xa032('0x1'));var rs=require(_0xa032('0x2'));var fs=require('fs');var Redis=require(_0xa032('0x3'));var db=require(_0xa032('0x4'))['db'];var utils=require(_0xa032('0x5'));var logger=require(_0xa032('0x6'))(_0xa032('0x7'));var config=require(_0xa032('0x8'));var jayson=require(_0xa032('0x9'));var client=jayson[_0xa032('0xa')][_0xa032('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40128a,_0x54275c,_0x616437){return new BPromise(function(_0x4a5d8e,_0x5d0744){return client[_0xa032('0xc')](_0x40128a,_0x616437)['then'](function(_0x18283a){logger[_0xa032('0xd')](_0xa032('0xe'),_0x54275c,_0xa032('0xf'));logger[_0xa032('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x54275c,_0xa032('0xf'),JSON[_0xa032('0x11')](_0x18283a));if(_0x18283a['error']){if(_0x18283a[_0xa032('0x12')][_0xa032('0x13')]===0x1f4){logger[_0xa032('0x12')](_0xa032('0xe'),_0x54275c,_0x18283a[_0xa032('0x12')]['message']);return _0x5d0744(_0x18283a[_0xa032('0x12')][_0xa032('0x14')]);}logger[_0xa032('0x12')](_0xa032('0xe'),_0x54275c,_0x18283a[_0xa032('0x12')][_0xa032('0x14')]);return _0x4a5d8e(_0x18283a[_0xa032('0x12')][_0xa032('0x14')]);}else{logger[_0xa032('0xd')](_0xa032('0xe'),_0x54275c,'request\x20sent');_0x4a5d8e(_0x18283a[_0xa032('0x15')][_0xa032('0x14')]);}})[_0xa032('0x16')](function(_0x2caacd){logger[_0xa032('0x12')](_0xa032('0xe'),_0x54275c,_0x2caacd);_0x5d0744(_0x2caacd);});});}exports[_0xa032('0x17')]=function(_0x577406){var _0xff6817=this;return new Promise(function(_0x54fba7,_0x1d8cf4){return db[_0xa032('0x18')][_0xa032('0x19')](_0x577406['body'],{'raw':_0x577406[_0xa032('0x1a')]?_0x577406['options'][_0xa032('0x1b')]===undefined?!![]:![]:!![]})[_0xa032('0x1c')](function(_0x471757){logger[_0xa032('0xd')](_0xa032('0x17'),_0x577406);logger[_0xa032('0x10')]('CreateVoiceTransferReport',_0x577406,JSON[_0xa032('0x11')](_0x471757));_0x54fba7(_0x471757);})[_0xa032('0x16')](function(_0x5a817b){logger[_0xa032('0x12')]('CreateVoiceTransferReport',_0x5a817b[_0xa032('0x14')],_0x577406);_0x1d8cf4(_0xff6817['error'](0x1f4,_0x5a817b[_0xa032('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 62ae9b0..d1400fc 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12fd=['answer','/hold','/transfer','transfer','express','Router','../../components/auth/service','./webbar.controller','post','isAuthenticated','canUpdate','originate','/hangup','hangup','/answer'];(function(_0x3d3491,_0x4f2642){var _0x43fb13=function(_0x54a321){while(--_0x54a321){_0x3d3491['push'](_0x3d3491['shift']());}};_0x43fb13(++_0x4f2642);}(_0x12fd,0x199));var _0xd12f=function(_0x128161,_0x4d569a){_0x128161=_0x128161-0x0;var _0x4dd56b=_0x12fd[_0x128161];return _0x4dd56b;};'use strict';var express=require(_0xd12f('0x0'));var router=express[_0xd12f('0x1')]();var auth=require(_0xd12f('0x2'));var controller=require(_0xd12f('0x3'));router[_0xd12f('0x4')]('/originate',auth[_0xd12f('0x5')](),auth[_0xd12f('0x6')](),controller[_0xd12f('0x7')]);router[_0xd12f('0x4')](_0xd12f('0x8'),auth[_0xd12f('0x5')](),auth['canUpdate'](),controller[_0xd12f('0x9')]);router['post'](_0xd12f('0xa'),auth[_0xd12f('0x5')](),auth[_0xd12f('0x6')](),controller[_0xd12f('0xb')]);router['post'](_0xd12f('0xc'),auth['isAuthenticated'](),auth[_0xd12f('0x6')](),controller['hold']);router['post']('/unhold',auth[_0xd12f('0x5')](),auth[_0xd12f('0x6')](),controller['unhold']);router['post']('/calls',auth['isAuthenticated'](),auth[_0xd12f('0x6')](),controller['calls']);router[_0xd12f('0x4')](_0xd12f('0xd'),auth['isAuthenticated'](),auth[_0xd12f('0x6')](),controller[_0xd12f('0xe')]);module['exports']=router; \ No newline at end of file +var _0x636f=['isAuthenticated','originate','/hangup','canUpdate','/answer','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','exports','../../components/auth/service','./webbar.controller','post','/originate'];(function(_0x51542a,_0x3bbd6a){var _0x5646f3=function(_0x2332c9){while(--_0x2332c9){_0x51542a['push'](_0x51542a['shift']());}};_0x5646f3(++_0x3bbd6a);}(_0x636f,0x188));var _0xf636=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x636f[_0x397e5f];return _0x5302b8;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xf636('0x0'));var controller=require(_0xf636('0x1'));router[_0xf636('0x2')](_0xf636('0x3'),auth[_0xf636('0x4')](),auth['canUpdate'](),controller[_0xf636('0x5')]);router[_0xf636('0x2')](_0xf636('0x6'),auth[_0xf636('0x4')](),auth[_0xf636('0x7')](),controller['hangup']);router[_0xf636('0x2')](_0xf636('0x8'),auth[_0xf636('0x4')](),auth[_0xf636('0x7')](),controller[_0xf636('0x9')]);router[_0xf636('0x2')](_0xf636('0xa'),auth[_0xf636('0x4')](),auth[_0xf636('0x7')](),controller[_0xf636('0xb')]);router['post'](_0xf636('0xc'),auth[_0xf636('0x4')](),auth['canUpdate'](),controller[_0xf636('0xd')]);router[_0xf636('0x2')](_0xf636('0xe'),auth[_0xf636('0x4')](),auth[_0xf636('0x7')](),controller[_0xf636('0xf')]);router['post'](_0xf636('0x10'),auth[_0xf636('0x4')](),auth[_0xf636('0x7')](),controller['transfer']);module[_0xf636('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index bc6f3b7..a5c9db2 100644 --- a/server/api/webbar/webbar.controller.js +++ b/server/api/webbar/webbar.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb3c=['originate\x20fired:','validate','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','filter','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','string','number','userId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','name','status','send','NotFound','then','error','message','catch','User','VoiceChannels','all','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!'];(function(_0x44ceee,_0x2a5e28){var _0x1a065c=function(_0x24ec16){while(--_0x24ec16){_0x44ceee['push'](_0x44ceee['shift']());}};_0x1a065c(++_0x2a5e28);}(_0xcb3c,0x150));var _0xccb3=function(_0x7fd596,_0x3a2875){_0x7fd596=_0x7fd596-0x0;var _0x595292=_0xcb3c[_0x7fd596];return _0x595292;};'use strict';var path=require(_0xccb3('0x0'));var fs=require('fs');var _=require(_0xccb3('0x1'));var db=require(_0xccb3('0x2'))['db'];var config=require(_0xccb3('0x3'));var util=require('util');var BPromise=require(_0xccb3('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xccb3('0x5')]['http']({'port':0x232a});var logger=require(_0xccb3('0x6'))(_0xccb3('0x7'));var Redis=require(_0xccb3('0x8'));config[_0xccb3('0x9')]=_[_0xccb3('0xa')](config[_0xccb3('0x9')],{'host':_0xccb3('0xb'),'port':0x18eb});var io=require(_0xccb3('0xc'))(new Redis(config[_0xccb3('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xccb3('0xd'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xccb3('0xd')},'callbackUrl':{'type':_0xccb3('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0xccb3('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xccb3('0xe'),'required':[!![],_0xccb3('0xf')]},'sessionId':{'type':_0xccb3('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xccb3('0xe'),'required':[!![],_0xccb3('0xf')]},'sessionId':{'type':_0xccb3('0xd'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xccb3('0xd'),'required':[!![],_0xccb3('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0xccb3('0xe'),'required':[!![],_0xccb3('0xf')]},'sessionId':{'type':_0xccb3('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xccb3('0xe'),'required':[!![],_0xccb3('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xccb3('0xe'),'required':[!![],_0xccb3('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xccb3('0xf')]}});function emit(_0x5a4037,_0x548a6f,_0x14ced5){logger[_0xccb3('0x11')](_0x5a4037,_0x548a6f,JSON[_0xccb3('0x12')](_0x14ced5));io['to'](_0x5a4037)[_0xccb3('0x13')](_0x548a6f,_0x14ced5);}function handleError(_0x44cc58){return function(_0xbb35ce){console[_0xccb3('0x14')](_0xccb3('0x15'),_0xbb35ce,_0xbb35ce instanceof RangeError);logger['error'](_0xbb35ce['stack']);if(_0xbb35ce instanceof RangeError){if(_0xbb35ce[_0xccb3('0x16')]){delete _0xbb35ce['name'];}_0x44cc58[_0xccb3('0x17')](0x194)[_0xccb3('0x18')](_0xbb35ce);}else{if(_0xbb35ce[_0xccb3('0x16')]){delete _0xbb35ce[_0xccb3('0x16')];}_0x44cc58[_0xccb3('0x17')](0x1f4)['send'](_0xbb35ce);}};}function checkError(){return function(_0x169839){if(!_0x169839){throw new RangeError(_0xccb3('0x19'));}return _0x169839;};}function respondWithRpcPromise(_0x26b8d5,_0x93f1b8){return new BPromise(function(_0x525fbd,_0x155cb6){var _0x3dab30=amiClient;return _0x3dab30['request'](_0x26b8d5,_0x93f1b8)[_0xccb3('0x1a')](function(_0xc6ec88){if(_0xc6ec88[_0xccb3('0x1b')]){if(_0xc6ec88[_0xccb3('0x1b')]['code']===0x1f4){return _0x155cb6(_0xc6ec88[_0xccb3('0x1b')]['message']);}return _0x525fbd(_0xc6ec88['error'][_0xccb3('0x1c')]);}else{_0x525fbd(_0xc6ec88['result']);}})[_0xccb3('0x1d')](function(_0x43b1fa){_0x155cb6(_0x43b1fa);});});}function getAgent(_0xa15d98){return db[_0xccb3('0x1e')]['findOne']({'where':{'id':_0xa15d98,'role':'agent'}})[_0xccb3('0x1a')](checkError());}function getAgentCheckSession(_0x4a34e5,_0x55f628){return new BPromise(function(_0x39edc8,_0x3c804e){var _0x37ecbb=respondWithRpcPromise(_0xccb3('0x1f'));var _0x2d1aab=getAgent(_0x4a34e5);Promise[_0xccb3('0x20')]([_0x37ecbb,_0x2d1aab])[_0xccb3('0x1a')](function(_0x2dbf7f){var _0x574d40=_0x2dbf7f[0x0];var _0x571bb7=_0x2dbf7f[0x1];var _0x5eba6f=_['filter'](_0x574d40[_0xccb3('0x21')],function(_0x400b1d){return _0x400b1d[_0xccb3('0x22')]==_0x571bb7['id']&&_0x400b1d[_0xccb3('0x23')]==_0x55f628;});if(_0x5eba6f[_0xccb3('0x24')]==0x1){_0x39edc8(_0x571bb7);}else{_0x3c804e(new RangeError(_0xccb3('0x25')+_0x55f628+_0xccb3('0x26')));}});});}exports['originate']=function(_0x57b695,_0x1ee87a){logger[_0xccb3('0x11')](_0xccb3('0x27'),_0x57b695['body']);var _0x4d715c=originateValidation[_0xccb3('0x28')](_0x57b695[_0xccb3('0x29')]);if(_0x4d715c[_0xccb3('0x24')]>0x0){return _0x1ee87a[_0xccb3('0x17')](0x190)[_0xccb3('0x2a')](_0x4d715c);}var _0x501e1d=_0x57b695[_0xccb3('0x29')][_0xccb3('0x2b')];var _0x241a41=_0x57b695['body'][_0xccb3('0x2c')];var _0x5620ce=_0x57b695['body'][_0xccb3('0x2d')];var _0x235100=_0x57b695[_0xccb3('0x29')][_0xccb3('0x2e')];return getAgent(_0x501e1d)[_0xccb3('0x1a')](function(_0x48a28d){logger[_0xccb3('0x11')](_0xccb3('0x2f'),_0x48a28d[_0xccb3('0x16')]);emit(util[_0xccb3('0x30')](_0xccb3('0x31'),_0x48a28d['name']),'webbar:originate',{'callNumber':_0x241a41,'callerId':_0x5620ce,'callbackUrl':_0x235100});return _0x1ee87a[_0xccb3('0x17')](0xc8)['json']({'error':![],'message':_0xccb3('0x32')});})['catch'](handleError(_0x1ee87a));};exports[_0xccb3('0x33')]=function(_0xeb53d,_0x1f9d9e){logger[_0xccb3('0x11')](_0xccb3('0x34'),_0xeb53d['body']);var _0xda6fb3=hangupValidation['validate'](_0xeb53d[_0xccb3('0x29')]);if(_0xda6fb3[_0xccb3('0x24')]>0x0){return _0x1f9d9e[_0xccb3('0x17')](0x190)[_0xccb3('0x2a')](_0xda6fb3);}var _0x1e30b6=_0xeb53d[_0xccb3('0x29')]['userId'];var _0x4a7934=_0xeb53d[_0xccb3('0x29')][_0xccb3('0x23')];return getAgent(_0x1e30b6)[_0xccb3('0x1a')](function(_0x217af4){logger[_0xccb3('0x11')]('entityFound:',_0x217af4['name']);emit(util[_0xccb3('0x30')](_0xccb3('0x31'),_0x217af4[_0xccb3('0x16')]),_0xccb3('0x35'),{'sessionId':_0x4a7934});return _0x1f9d9e[_0xccb3('0x17')](0xc8)[_0xccb3('0x2a')]({'error':![],'message':_0xccb3('0x36')});})[_0xccb3('0x1d')](handleError(_0x1f9d9e));};exports[_0xccb3('0x37')]=function(_0x111722,_0x1de2fb){logger[_0xccb3('0x11')]('answer\x20fired:',_0x111722[_0xccb3('0x29')]);var _0x5681e4=answerValidation[_0xccb3('0x28')](_0x111722[_0xccb3('0x29')]);if(_0x5681e4[_0xccb3('0x24')]>0x0){return _0x1de2fb[_0xccb3('0x17')](0x190)[_0xccb3('0x2a')](_0x5681e4);}var _0x5d5ea4=_0x111722[_0xccb3('0x29')]['userId'];var _0x5c6fb3=_0x111722[_0xccb3('0x29')][_0xccb3('0x23')];return getAgent(_0x5d5ea4)[_0xccb3('0x1a')](function(_0x3ba550){logger[_0xccb3('0x11')](_0xccb3('0x2f'),_0x3ba550[_0xccb3('0x16')]);emit(util[_0xccb3('0x30')]('user:%s',_0x3ba550[_0xccb3('0x16')]),_0xccb3('0x38'),{'sessionId':_0x5c6fb3});return _0x1de2fb[_0xccb3('0x17')](0xc8)[_0xccb3('0x2a')]({'error':![],'message':_0xccb3('0x39')});})[_0xccb3('0x1d')](handleError(_0x1de2fb));};exports[_0xccb3('0x3a')]=function(_0x28f656,_0x44ad45){logger[_0xccb3('0x11')](_0xccb3('0x3b'),_0x28f656[_0xccb3('0x29')]);var _0x1f1aea=holdValidation[_0xccb3('0x28')](_0x28f656[_0xccb3('0x29')]);if(_0x1f1aea[_0xccb3('0x24')]>0x0){return _0x44ad45[_0xccb3('0x17')](0x190)[_0xccb3('0x2a')](_0x1f1aea);}var _0x2ac2ce=_0x28f656['body'][_0xccb3('0x2b')];var _0xdddf5a=_0x28f656[_0xccb3('0x29')][_0xccb3('0x23')];return getAgent(_0x2ac2ce)['then'](function(_0x2bfadd){logger[_0xccb3('0x11')]('entityFound:',_0x2bfadd['name']);emit(util[_0xccb3('0x30')](_0xccb3('0x31'),_0x2bfadd[_0xccb3('0x16')]),'webbar:hold',{'sessionId':_0xdddf5a});return _0x44ad45['status'](0xc8)[_0xccb3('0x2a')]({'error':![],'message':_0xccb3('0x3c')});})['catch'](handleError(_0x44ad45));};exports[_0xccb3('0x3d')]=function(_0x7de72e,_0xb08f7b){logger['info']('unhold\x20fired:',_0x7de72e[_0xccb3('0x29')]);var _0x19645f=unholdValidation[_0xccb3('0x28')](_0x7de72e[_0xccb3('0x29')]);if(_0x19645f['length']>0x0){return _0xb08f7b[_0xccb3('0x17')](0x190)['json'](_0x19645f);}var _0x3e5c34=_0x7de72e[_0xccb3('0x29')][_0xccb3('0x2b')];var _0x3e3606=_0x7de72e['body'][_0xccb3('0x23')];return getAgent(_0x3e5c34)[_0xccb3('0x1a')](function(_0x21ec3b){logger['info'](_0xccb3('0x2f'),_0x21ec3b[_0xccb3('0x16')]);emit(util[_0xccb3('0x30')](_0xccb3('0x31'),_0x21ec3b['name']),_0xccb3('0x3e'),{'sessionId':_0x3e3606});return _0xb08f7b['status'](0xc8)[_0xccb3('0x2a')]({'error':![],'message':_0xccb3('0x3f')});})['catch'](handleError(_0xb08f7b));};exports[_0xccb3('0x40')]=function(_0x5a354f,_0x15d50c){logger[_0xccb3('0x11')](_0xccb3('0x41'),_0x15d50c[_0xccb3('0x29')]);var _0x19e97d=callsValidation['validate'](_0x5a354f[_0xccb3('0x29')]);if(_0x19e97d[_0xccb3('0x24')]>0x0){return _0x15d50c['status'](0x190)[_0xccb3('0x2a')](_0x19e97d);}var _0xdc8be7=_0x5a354f[_0xccb3('0x29')][_0xccb3('0x2b')];var _0x3b3b10=respondWithRpcPromise('VoiceChannels');var _0xacc6bd=getAgent(_0xdc8be7);return Promise[_0xccb3('0x20')]([_0x3b3b10,_0xacc6bd])[_0xccb3('0x1a')](function(_0x1d7470){var _0x141b01=_0x1d7470[0x0];var _0x5ef484=_0x1d7470[0x1];var _0x4e85fe=_[_0xccb3('0x42')](_0x141b01['rows'],function(_0x407239){return _0x407239['UserId']==_0x5ef484['id'];});return _0x15d50c['status'](0xc8)[_0xccb3('0x2a')]({'count':_0x4e85fe[_0xccb3('0x24')],'rows':_0x4e85fe});})['catch'](handleError(_0x15d50c));};exports[_0xccb3('0x43')]=function(_0x380a4c,_0x1cda59){logger[_0xccb3('0x11')]('conference\x20fired:',_0x380a4c['body']);var _0x3b7a6c=conferenceValidation[_0xccb3('0x28')](_0x380a4c[_0xccb3('0x29')]);if(_0x3b7a6c[_0xccb3('0x24')]>0x0){return _0x1cda59[_0xccb3('0x17')](0x190)['json'](_0x3b7a6c);}var _0x3d9f52=_0x380a4c[_0xccb3('0x29')][_0xccb3('0x2b')];return getAgent(_0x3d9f52)[_0xccb3('0x1a')](function(_0x50026d){logger['info'](_0xccb3('0x2f'),_0x50026d[_0xccb3('0x16')]);emit(util['format'](_0xccb3('0x31'),_0x50026d[_0xccb3('0x16')]),_0xccb3('0x44'));return _0x1cda59[_0xccb3('0x17')](0xc8)['json']({'error':![],'message':_0xccb3('0x45')});})[_0xccb3('0x1d')](handleError(_0x1cda59));};exports[_0xccb3('0x46')]=function(_0x5086da,_0x8d14ce){logger[_0xccb3('0x11')](_0xccb3('0x47'),_0x5086da['body']);var _0x298e1e=transferValidation[_0xccb3('0x28')](_0x5086da[_0xccb3('0x29')]);if(_0x298e1e[_0xccb3('0x24')]>0x0){return _0x8d14ce['status'](0x190)[_0xccb3('0x2a')](_0x298e1e);}var _0xe15b41=_0x5086da[_0xccb3('0x29')]['userId'];var _0xe0c1e1=_0x5086da['body'][_0xccb3('0x23')];var _0x277d23=_0x5086da[_0xccb3('0x29')][_0xccb3('0x48')];return getAgent(_0xe15b41)[_0xccb3('0x1a')](function(_0x338493){logger[_0xccb3('0x11')]('entityFound:',_0x338493['name']);emit(util[_0xccb3('0x30')](_0xccb3('0x31'),_0x338493[_0xccb3('0x16')]),_0xccb3('0x49'),{'sessionId':_0xe0c1e1,'transferNumber':_0x277d23});return _0x8d14ce[_0xccb3('0x17')](0xc8)[_0xccb3('0x2a')]({'error':![],'message':_0xccb3('0x4a')});})[_0xccb3('0x1d')](handleError(_0x8d14ce));}; \ No newline at end of file +var _0xef1c=['transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird','jayson/promise','client','http','webbarapi','ioredis','redis','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','info','stringify','emit','log','handleError:','error','name','status','send','NotFound','request','then','message','result','catch','User','all','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','format','user:%s','json','hangup','hangup\x20fired:','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','answer\x20executed!','hold\x20fired:','webbar:hold','unhold','webbar:unhold','unhold\x20executed!','calls\x20fired:','VoiceChannels','filter','UserId','conference\x20fired:','webbar:conference','conference\x20executed!'];(function(_0x292f93,_0x2c6e8e){var _0x5a94b1=function(_0x25735e){while(--_0x25735e){_0x292f93['push'](_0x292f93['shift']());}};_0x5a94b1(++_0x2c6e8e);}(_0xef1c,0x176));var _0xcef1=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xef1c[_0x160c73];return _0xd9302;};'use strict';var path=require(_0xcef1('0x0'));var fs=require('fs');var _=require(_0xcef1('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xcef1('0x2'));var util=require(_0xcef1('0x3'));var BPromise=require(_0xcef1('0x4'));var jayson=require(_0xcef1('0x5'));var amiClient=jayson[_0xcef1('0x6')][_0xcef1('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0xcef1('0x8'));var Redis=require(_0xcef1('0x9'));config[_0xcef1('0xa')]=_['defaults'](config[_0xcef1('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xcef1('0xb'))(new Redis(config[_0xcef1('0xa')]));var Schema=require(_0xcef1('0xc'));var originateValidation=new Schema({'userId':{'type':_0xcef1('0xd'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xcef1('0xe'),'required':[!![],_0xcef1('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xcef1('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0xcef1('0xd'),'required':[!![],_0xcef1('0x10')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xcef1('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xcef1('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xcef1('0xe'),'required':[!![],_0xcef1('0x11')]},'transferNumber':{'type':_0xcef1('0xe'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xcef1('0xd'),'required':[!![],_0xcef1('0x10')]},'sessionId':{'type':_0xcef1('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xcef1('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xcef1('0xd'),'required':[!![],_0xcef1('0x10')]}});function emit(_0x3d693b,_0x182d45,_0x5c3481){logger[_0xcef1('0x12')](_0x3d693b,_0x182d45,JSON[_0xcef1('0x13')](_0x5c3481));io['to'](_0x3d693b)[_0xcef1('0x14')](_0x182d45,_0x5c3481);}function handleError(_0x66f8e6){return function(_0x391cba){console[_0xcef1('0x15')](_0xcef1('0x16'),_0x391cba,_0x391cba instanceof RangeError);logger[_0xcef1('0x17')](_0x391cba['stack']);if(_0x391cba instanceof RangeError){if(_0x391cba[_0xcef1('0x18')]){delete _0x391cba[_0xcef1('0x18')];}_0x66f8e6[_0xcef1('0x19')](0x194)[_0xcef1('0x1a')](_0x391cba);}else{if(_0x391cba[_0xcef1('0x18')]){delete _0x391cba['name'];}_0x66f8e6[_0xcef1('0x19')](0x1f4)[_0xcef1('0x1a')](_0x391cba);}};}function checkError(){return function(_0x4004aa){if(!_0x4004aa){throw new RangeError(_0xcef1('0x1b'));}return _0x4004aa;};}function respondWithRpcPromise(_0x539b5b,_0x3c4976){return new BPromise(function(_0x17f34c,_0x1cff9f){var _0x23895e=amiClient;return _0x23895e[_0xcef1('0x1c')](_0x539b5b,_0x3c4976)[_0xcef1('0x1d')](function(_0xa2876f){if(_0xa2876f['error']){if(_0xa2876f[_0xcef1('0x17')]['code']===0x1f4){return _0x1cff9f(_0xa2876f[_0xcef1('0x17')][_0xcef1('0x1e')]);}return _0x17f34c(_0xa2876f[_0xcef1('0x17')][_0xcef1('0x1e')]);}else{_0x17f34c(_0xa2876f[_0xcef1('0x1f')]);}})[_0xcef1('0x20')](function(_0x1616fa){_0x1cff9f(_0x1616fa);});});}function getAgent(_0x144c55){return db[_0xcef1('0x21')]['findOne']({'where':{'id':_0x144c55,'role':'agent'}})[_0xcef1('0x1d')](checkError());}function getAgentCheckSession(_0x21cac5,_0x1f0fab){return new BPromise(function(_0x561dfc,_0x360317){var _0x5909bf=respondWithRpcPromise('VoiceChannels');var _0xbad376=getAgent(_0x21cac5);Promise[_0xcef1('0x22')]([_0x5909bf,_0xbad376])[_0xcef1('0x1d')](function(_0x4565d0){var _0x5987bc=_0x4565d0[0x0];var _0x8fd24a=_0x4565d0[0x1];var _0xe2ed16=_['filter'](_0x5987bc[_0xcef1('0x23')],function(_0x3939d7){return _0x3939d7['UserId']==_0x8fd24a['id']&&_0x3939d7[_0xcef1('0x24')]==_0x1f0fab;});if(_0xe2ed16[_0xcef1('0x25')]==0x1){_0x561dfc(_0x8fd24a);}else{_0x360317(new RangeError(_0xcef1('0x26')+_0x1f0fab+_0xcef1('0x27')));}});});}exports[_0xcef1('0x28')]=function(_0x264c54,_0x2e22a4){logger[_0xcef1('0x12')](_0xcef1('0x29'),_0x264c54['body']);var _0x100df3=originateValidation[_0xcef1('0xc')](_0x264c54[_0xcef1('0x2a')]);if(_0x100df3['length']>0x0){return _0x2e22a4[_0xcef1('0x19')](0x190)['json'](_0x100df3);}var _0x271f8a=_0x264c54[_0xcef1('0x2a')][_0xcef1('0x2b')];var _0x2464ee=_0x264c54['body'][_0xcef1('0x2c')];var _0x9655ec=_0x264c54[_0xcef1('0x2a')][_0xcef1('0x2d')];var _0x40004e=_0x264c54[_0xcef1('0x2a')][_0xcef1('0x2e')];return getAgent(_0x271f8a)['then'](function(_0x5f18a2){logger[_0xcef1('0x12')]('entityFound:',_0x5f18a2['name']);emit(util[_0xcef1('0x2f')](_0xcef1('0x30'),_0x5f18a2[_0xcef1('0x18')]),'webbar:originate',{'callNumber':_0x2464ee,'callerId':_0x9655ec,'callbackUrl':_0x40004e});return _0x2e22a4['status'](0xc8)[_0xcef1('0x31')]({'error':![],'message':'originate\x20executed!'});})[_0xcef1('0x20')](handleError(_0x2e22a4));};exports[_0xcef1('0x32')]=function(_0x47ec0c,_0x19ceaf){logger[_0xcef1('0x12')](_0xcef1('0x33'),_0x47ec0c[_0xcef1('0x2a')]);var _0x257437=hangupValidation[_0xcef1('0xc')](_0x47ec0c[_0xcef1('0x2a')]);if(_0x257437['length']>0x0){return _0x19ceaf[_0xcef1('0x19')](0x190)['json'](_0x257437);}var _0x1f1f71=_0x47ec0c[_0xcef1('0x2a')][_0xcef1('0x2b')];var _0x6a5ccf=_0x47ec0c[_0xcef1('0x2a')]['sessionId'];return getAgent(_0x1f1f71)[_0xcef1('0x1d')](function(_0x1eba15){logger[_0xcef1('0x12')](_0xcef1('0x34'),_0x1eba15['name']);emit(util[_0xcef1('0x2f')](_0xcef1('0x30'),_0x1eba15[_0xcef1('0x18')]),_0xcef1('0x35'),{'sessionId':_0x6a5ccf});return _0x19ceaf[_0xcef1('0x19')](0xc8)[_0xcef1('0x31')]({'error':![],'message':_0xcef1('0x36')});})[_0xcef1('0x20')](handleError(_0x19ceaf));};exports[_0xcef1('0x37')]=function(_0x3282fe,_0x44b047){logger[_0xcef1('0x12')](_0xcef1('0x38'),_0x3282fe[_0xcef1('0x2a')]);var _0x2ba79e=answerValidation['validate'](_0x3282fe[_0xcef1('0x2a')]);if(_0x2ba79e[_0xcef1('0x25')]>0x0){return _0x44b047[_0xcef1('0x19')](0x190)[_0xcef1('0x31')](_0x2ba79e);}var _0x3bf0e0=_0x3282fe['body']['userId'];var _0x565daf=_0x3282fe[_0xcef1('0x2a')][_0xcef1('0x24')];return getAgent(_0x3bf0e0)['then'](function(_0x1b16f9){logger[_0xcef1('0x12')](_0xcef1('0x34'),_0x1b16f9['name']);emit(util['format'](_0xcef1('0x30'),_0x1b16f9[_0xcef1('0x18')]),'webbar:answer',{'sessionId':_0x565daf});return _0x44b047['status'](0xc8)[_0xcef1('0x31')]({'error':![],'message':_0xcef1('0x39')});})[_0xcef1('0x20')](handleError(_0x44b047));};exports['hold']=function(_0x5e0e3d,_0x2f44fd){logger['info'](_0xcef1('0x3a'),_0x5e0e3d['body']);var _0x587c45=holdValidation['validate'](_0x5e0e3d[_0xcef1('0x2a')]);if(_0x587c45['length']>0x0){return _0x2f44fd['status'](0x190)[_0xcef1('0x31')](_0x587c45);}var _0x14e919=_0x5e0e3d[_0xcef1('0x2a')][_0xcef1('0x2b')];var _0x4e4c8a=_0x5e0e3d[_0xcef1('0x2a')][_0xcef1('0x24')];return getAgent(_0x14e919)[_0xcef1('0x1d')](function(_0x25ae31){logger[_0xcef1('0x12')](_0xcef1('0x34'),_0x25ae31[_0xcef1('0x18')]);emit(util['format'](_0xcef1('0x30'),_0x25ae31[_0xcef1('0x18')]),_0xcef1('0x3b'),{'sessionId':_0x4e4c8a});return _0x2f44fd[_0xcef1('0x19')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x2f44fd));};exports[_0xcef1('0x3c')]=function(_0x308a65,_0x44750a){logger[_0xcef1('0x12')]('unhold\x20fired:',_0x308a65[_0xcef1('0x2a')]);var _0x277696=unholdValidation[_0xcef1('0xc')](_0x308a65[_0xcef1('0x2a')]);if(_0x277696[_0xcef1('0x25')]>0x0){return _0x44750a[_0xcef1('0x19')](0x190)[_0xcef1('0x31')](_0x277696);}var _0x5d1cc8=_0x308a65[_0xcef1('0x2a')]['userId'];var _0x26c77a=_0x308a65['body'][_0xcef1('0x24')];return getAgent(_0x5d1cc8)[_0xcef1('0x1d')](function(_0x2a21fb){logger['info'](_0xcef1('0x34'),_0x2a21fb[_0xcef1('0x18')]);emit(util[_0xcef1('0x2f')](_0xcef1('0x30'),_0x2a21fb['name']),_0xcef1('0x3d'),{'sessionId':_0x26c77a});return _0x44750a[_0xcef1('0x19')](0xc8)[_0xcef1('0x31')]({'error':![],'message':_0xcef1('0x3e')});})[_0xcef1('0x20')](handleError(_0x44750a));};exports['calls']=function(_0x3cc8aa,_0x39e994){logger[_0xcef1('0x12')](_0xcef1('0x3f'),_0x39e994['body']);var _0x2c0b41=callsValidation['validate'](_0x3cc8aa[_0xcef1('0x2a')]);if(_0x2c0b41[_0xcef1('0x25')]>0x0){return _0x39e994[_0xcef1('0x19')](0x190)[_0xcef1('0x31')](_0x2c0b41);}var _0x3768e8=_0x3cc8aa[_0xcef1('0x2a')][_0xcef1('0x2b')];var _0x47cb2a=respondWithRpcPromise(_0xcef1('0x40'));var _0x4ce54b=getAgent(_0x3768e8);return Promise[_0xcef1('0x22')]([_0x47cb2a,_0x4ce54b])['then'](function(_0xe4bb7e){var _0x387faa=_0xe4bb7e[0x0];var _0x10ebff=_0xe4bb7e[0x1];var _0x373d8f=_[_0xcef1('0x41')](_0x387faa[_0xcef1('0x23')],function(_0x2544af){return _0x2544af[_0xcef1('0x42')]==_0x10ebff['id'];});return _0x39e994[_0xcef1('0x19')](0xc8)[_0xcef1('0x31')]({'count':_0x373d8f[_0xcef1('0x25')],'rows':_0x373d8f});})['catch'](handleError(_0x39e994));};exports['conference']=function(_0x1bbaa9,_0xe69870){logger[_0xcef1('0x12')](_0xcef1('0x43'),_0x1bbaa9[_0xcef1('0x2a')]);var _0x3befc0=conferenceValidation[_0xcef1('0xc')](_0x1bbaa9['body']);if(_0x3befc0[_0xcef1('0x25')]>0x0){return _0xe69870['status'](0x190)[_0xcef1('0x31')](_0x3befc0);}var _0x487000=_0x1bbaa9[_0xcef1('0x2a')][_0xcef1('0x2b')];return getAgent(_0x487000)[_0xcef1('0x1d')](function(_0x519b73){logger['info'](_0xcef1('0x34'),_0x519b73[_0xcef1('0x18')]);emit(util[_0xcef1('0x2f')](_0xcef1('0x30'),_0x519b73['name']),_0xcef1('0x44'));return _0xe69870[_0xcef1('0x19')](0xc8)[_0xcef1('0x31')]({'error':![],'message':_0xcef1('0x45')});})[_0xcef1('0x20')](handleError(_0xe69870));};exports['transfer']=function(_0x53d6ef,_0x2bab7f){logger[_0xcef1('0x12')](_0xcef1('0x46'),_0x53d6ef[_0xcef1('0x2a')]);var _0x48a7a0=transferValidation[_0xcef1('0xc')](_0x53d6ef[_0xcef1('0x2a')]);if(_0x48a7a0[_0xcef1('0x25')]>0x0){return _0x2bab7f[_0xcef1('0x19')](0x190)[_0xcef1('0x31')](_0x48a7a0);}var _0x2bf1ca=_0x53d6ef[_0xcef1('0x2a')][_0xcef1('0x2b')];var _0x2ddeb1=_0x53d6ef['body']['sessionId'];var _0x28ba08=_0x53d6ef['body'][_0xcef1('0x47')];return getAgent(_0x2bf1ca)[_0xcef1('0x1d')](function(_0x9162d7){logger[_0xcef1('0x12')]('entityFound:',_0x9162d7[_0xcef1('0x18')]);emit(util[_0xcef1('0x2f')](_0xcef1('0x30'),_0x9162d7[_0xcef1('0x18')]),_0xcef1('0x48'),{'sessionId':_0x2ddeb1,'transferNumber':_0x28ba08});return _0x2bab7f[_0xcef1('0x19')](0xc8)[_0xcef1('0x31')]({'error':![],'message':_0xcef1('0x49')});})[_0xcef1('0x20')](handleError(_0x2bab7f));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 8b721f0..4280ebe 100644 --- a/server/api/whatsappAccount/index.js +++ b/server/api/whatsappAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb3df=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/users','addApplications','notify','send','put','update','delete','removeAnswers','removeAgents','exports','util','connect-timeout','express'];(function(_0x185af2,_0x2d0be5){var _0x46d876=function(_0x489545){while(--_0x489545){_0x185af2['push'](_0x185af2['shift']());}};_0x46d876(++_0x2d0be5);}(_0xb3df,0x8d));var _0xfb3d=function(_0xb7bfaf,_0x4c9c7c){_0xb7bfaf=_0xb7bfaf-0x0;var _0x20731f=_0xb3df[_0xb7bfaf];return _0x20731f;};'use strict';var multer=require('multer');var util=require(_0xfb3d('0x0'));var path=require('path');var timeout=require(_0xfb3d('0x1'));var express=require(_0xfb3d('0x2'));var router=express[_0xfb3d('0x3')]();var fs_extra=require(_0xfb3d('0x4'));var auth=require(_0xfb3d('0x5'));var interaction=require(_0xfb3d('0x6'));var config=require(_0xfb3d('0x7'));var controller=require(_0xfb3d('0x8'));router[_0xfb3d('0x9')]('/',auth[_0xfb3d('0xa')](),controller[_0xfb3d('0xb')]);router[_0xfb3d('0x9')](_0xfb3d('0xc'),auth[_0xfb3d('0xa')](),controller[_0xfb3d('0xd')]);router[_0xfb3d('0x9')](_0xfb3d('0xe'),auth[_0xfb3d('0xa')](),controller[_0xfb3d('0xf')]);router[_0xfb3d('0x9')](_0xfb3d('0x10'),auth['isAuthenticated'](),controller[_0xfb3d('0x11')]);router[_0xfb3d('0x9')](_0xfb3d('0x12'),auth[_0xfb3d('0xa')](),controller[_0xfb3d('0x13')]);router[_0xfb3d('0x9')]('/:id/users',auth[_0xfb3d('0xa')](),controller[_0xfb3d('0x14')]);router['get'](_0xfb3d('0x15'),auth['isAuthenticated'](),controller[_0xfb3d('0x16')]);router[_0xfb3d('0x17')]('/',auth[_0xfb3d('0xa')](),controller[_0xfb3d('0x18')]);router['post'](_0xfb3d('0x10'),auth['isAuthenticated'](),controller[_0xfb3d('0x19')]);router['post'](_0xfb3d('0x12'),auth[_0xfb3d('0xa')](),controller['addAnswer']);router[_0xfb3d('0x17')](_0xfb3d('0x1a'),auth['isAuthenticated'](),controller['addAgents']);router['post'](_0xfb3d('0x15'),auth['isAuthenticated'](),controller[_0xfb3d('0x1b')]);router[_0xfb3d('0x17')]('/:id/notify',controller[_0xfb3d('0x1c')]);router['post']('/:id/send',auth[_0xfb3d('0xa')](),controller[_0xfb3d('0x1d')]);router[_0xfb3d('0x1e')](_0xfb3d('0xe'),auth[_0xfb3d('0xa')](),controller[_0xfb3d('0x1f')]);router['delete'](_0xfb3d('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xfb3d('0x20')](_0xfb3d('0x10'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0xfb3d('0x12'),auth[_0xfb3d('0xa')](),controller[_0xfb3d('0x21')]);router[_0xfb3d('0x20')](_0xfb3d('0x1a'),auth[_0xfb3d('0xa')](),controller[_0xfb3d('0x22')]);module[_0xfb3d('0x23')]=router; \ No newline at end of file +var _0xe3b4=['/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xe3b4,0xb0));var _0x4e3b=function(_0x48cc87,_0xf5bf00){_0x48cc87=_0x48cc87-0x0;var _0x5868bb=_0xe3b4[_0x48cc87];return _0x5868bb;};'use strict';var multer=require(_0x4e3b('0x0'));var util=require(_0x4e3b('0x1'));var path=require(_0x4e3b('0x2'));var timeout=require('connect-timeout');var express=require(_0x4e3b('0x3'));var router=express[_0x4e3b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4e3b('0x5'));var interaction=require(_0x4e3b('0x6'));var config=require(_0x4e3b('0x7'));var controller=require(_0x4e3b('0x8'));router['get']('/',auth[_0x4e3b('0x9')](),controller[_0x4e3b('0xa')]);router[_0x4e3b('0xb')](_0x4e3b('0xc'),auth[_0x4e3b('0x9')](),controller[_0x4e3b('0xd')]);router[_0x4e3b('0xb')](_0x4e3b('0xe'),auth['isAuthenticated'](),controller[_0x4e3b('0xf')]);router[_0x4e3b('0xb')](_0x4e3b('0x10'),auth[_0x4e3b('0x9')](),controller['getDispositions']);router['get'](_0x4e3b('0x11'),auth['isAuthenticated'](),controller[_0x4e3b('0x12')]);router[_0x4e3b('0xb')](_0x4e3b('0x13'),auth['isAuthenticated'](),controller[_0x4e3b('0x14')]);router[_0x4e3b('0xb')](_0x4e3b('0x15'),auth[_0x4e3b('0x9')](),controller[_0x4e3b('0x16')]);router[_0x4e3b('0x17')]('/',auth[_0x4e3b('0x9')](),controller[_0x4e3b('0x18')]);router[_0x4e3b('0x17')]('/:id/dispositions',auth[_0x4e3b('0x9')](),controller[_0x4e3b('0x19')]);router[_0x4e3b('0x17')](_0x4e3b('0x11'),auth[_0x4e3b('0x9')](),controller[_0x4e3b('0x1a')]);router[_0x4e3b('0x17')]('/:id/users',auth[_0x4e3b('0x9')](),controller[_0x4e3b('0x1b')]);router[_0x4e3b('0x17')](_0x4e3b('0x15'),auth['isAuthenticated'](),controller[_0x4e3b('0x1c')]);router[_0x4e3b('0x17')](_0x4e3b('0x1d'),controller[_0x4e3b('0x1e')]);router[_0x4e3b('0x17')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0x4e3b('0x1f')](_0x4e3b('0xe'),auth[_0x4e3b('0x9')](),controller[_0x4e3b('0x20')]);router[_0x4e3b('0x21')](_0x4e3b('0xe'),auth[_0x4e3b('0x9')](),controller[_0x4e3b('0x22')]);router[_0x4e3b('0x21')](_0x4e3b('0x10'),auth[_0x4e3b('0x9')](),controller[_0x4e3b('0x23')]);router[_0x4e3b('0x21')](_0x4e3b('0x11'),auth[_0x4e3b('0x9')](),controller[_0x4e3b('0x24')]);router[_0x4e3b('0x21')](_0x4e3b('0x13'),auth[_0x4e3b('0x9')](),controller[_0x4e3b('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 06cf985..d174257 100644 --- a/server/api/whatsappAccount/whatsappAccount.attributes.js +++ b/server/api/whatsappAccount/whatsappAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4248=['randomstring','exports','name','STRING','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize'];(function(_0x1eb822,_0x80c6a6){var _0x495499=function(_0xfb4653){while(--_0xfb4653){_0x1eb822['push'](_0x1eb822['shift']());}};_0x495499(++_0x80c6a6);}(_0x4248,0x1df));var _0x8424=function(_0x2c6047,_0x485481){_0x2c6047=_0x2c6047-0x0;var _0x5a9f17=_0x4248[_0x2c6047];return _0x5a9f17;};'use strict';var Sequelize=require(_0x8424('0x0'));var rs=require(_0x8424('0x1'));module[_0x8424('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x8424('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x8424('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x8424('0x4')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8424('0x5')]();}},'phone':{'type':Sequelize[_0x8424('0x4')]},'type':{'type':Sequelize[_0x8424('0x6')](_0x8424('0x7'))},'accountSid':{'type':Sequelize[_0x8424('0x4')]},'authToken':{'type':Sequelize[_0x8424('0x4')]},'notificationTemplate':{'type':Sequelize[_0x8424('0x8')],'defaultValue':function(){return _0x8424('0x9');}},'notificationSound':{'type':Sequelize[_0x8424('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x8424('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8424('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8424('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8424('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8424('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8424('0xb')],'comment':_0x8424('0xc')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8424('0xd'),'set':function(_0x391296){if(!_0x391296){this[_0x8424('0xe')]('mandatoryDispositionPauseId',null);}this[_0x8424('0xe')](_0x8424('0xf'),_0x391296);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdffd=['generate','twilio','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING'];(function(_0x1ef71d,_0x453e87){var _0x5bd739=function(_0x595a8a){while(--_0x595a8a){_0x1ef71d['push'](_0x1ef71d['shift']());}};_0x5bd739(++_0x453e87);}(_0xdffd,0x1dd));var _0xddff=function(_0x5e6023,_0x26ddf7){_0x5e6023=_0x5e6023-0x0;var _0x402ffd=_0xdffd[_0x5e6023];return _0x402ffd;};'use strict';var Sequelize=require(_0xddff('0x0'));var rs=require(_0xddff('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xddff('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xddff('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xddff('0x3')]();}},'phone':{'type':Sequelize[_0xddff('0x2')]},'type':{'type':Sequelize['ENUM'](_0xddff('0x4'))},'accountSid':{'type':Sequelize[_0xddff('0x2')]},'authToken':{'type':Sequelize[_0xddff('0x2')]},'notificationTemplate':{'type':Sequelize[_0xddff('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xddff('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xddff('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xddff('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xddff('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xddff('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xddff('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xddff('0x7')],'comment':_0xddff('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xddff('0x9'),'set':function(_0x51a5b4){if(!_0x51a5b4){this[_0xddff('0xa')]('mandatoryDispositionPauseId',null);}this['setDataValue'](_0xddff('0xb'),_0x51a5b4);}},'description':{'type':Sequelize[_0xddff('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index bca1e06..eacc415 100644 --- a/server/api/whatsappAccount/whatsappAccount.controller.js +++ b/server/api/whatsappAccount/whatsappAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d50=['debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','get','WhatsappAccounts','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','options','findAll','params','rawAttributes','keys','find','create','body','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','includeAll','include','rows','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','pick','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','whatsapp','applications','orderBy','Applications','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','list','omit','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','DESC','out','WhatsappMessage','dataValues','Messages','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x553977,_0x5ab2de){var _0x39856e=function(_0x334a66){while(--_0x334a66){_0x553977['push'](_0x553977['shift']());}};_0x39856e(++_0x5ab2de);}(_0x7d50,0x154));var _0x07d5=function(_0x5da808,_0x5abac2){_0x5da808=_0x5da808-0x0;var _0x249bc1=_0x7d50[_0x5da808];return _0x249bc1;};'use strict';var emlformat=require(_0x07d5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x07d5('0x1'));var jsonpatch=require(_0x07d5('0x2'));var rp=require(_0x07d5('0x3'));var moment=require(_0x07d5('0x4'));var BPromise=require(_0x07d5('0x5'));var Mustache=require('mustache');var util=require(_0x07d5('0x6'));var path=require(_0x07d5('0x7'));var sox=require(_0x07d5('0x8'));var csv=require(_0x07d5('0x9'));var ejs=require(_0x07d5('0xa'));var fs=require('fs');var fs_extra=require(_0x07d5('0xb'));var _=require(_0x07d5('0xc'));var squel=require(_0x07d5('0xd'));var crypto=require(_0x07d5('0xe'));var jsforce=require(_0x07d5('0xf'));var deskjs=require(_0x07d5('0x10'));var toCsv=require(_0x07d5('0x9'));var querystring=require('querystring');var Papa=require(_0x07d5('0x11'));var Redis=require(_0x07d5('0x12'));var authService=require(_0x07d5('0x13'));var qs=require(_0x07d5('0x14'));var as=require(_0x07d5('0x15'));var hardwareService=require(_0x07d5('0x16'));var logger=require('../../config/logger')(_0x07d5('0x17'));var utils=require(_0x07d5('0x18'));var config=require(_0x07d5('0x19'));var licenseUtil=require(_0x07d5('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x07d5('0x1b')](config['redis'],{'host':_0x07d5('0x1c'),'port':0x18eb});var socket=require(_0x07d5('0x1d'))(new Redis(config[_0x07d5('0x1e')]));require('./whatsappAccount.socket')[_0x07d5('0x1f')](socket);var jayson=require(_0x07d5('0x20'));var client=jayson[_0x07d5('0x21')][_0x07d5('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x1ee184,_0x3610ec,_0x23688d,_0xba788e){return new BPromise(function(_0x2c642b,_0x4b4694){var _0x16ed08=_0xba788e||client;return _0x16ed08[_0x07d5('0x23')](_0x1ee184,_0x23688d)[_0x07d5('0x24')](function(_0x44a3fd){logger[_0x07d5('0x25')](_0x07d5('0x26'),_0x3610ec,_0x07d5('0x27'));logger[_0x07d5('0x28')](_0x07d5('0x29'),_0x3610ec,'request\x20sent',JSON[_0x07d5('0x2a')](_0x44a3fd));if(_0x44a3fd['error']){if(_0x44a3fd['error'][_0x07d5('0x2b')]===0x1f4){logger[_0x07d5('0x2c')](_0x07d5('0x26'),_0x3610ec,_0x44a3fd[_0x07d5('0x2c')][_0x07d5('0x2d')]);return _0x4b4694(_0x44a3fd['error'][_0x07d5('0x2d')]);}logger[_0x07d5('0x2c')](_0x07d5('0x26'),_0x3610ec,_0x44a3fd[_0x07d5('0x2c')][_0x07d5('0x2d')]);return _0x2c642b(_0x44a3fd[_0x07d5('0x2c')][_0x07d5('0x2d')]);}else{logger[_0x07d5('0x25')](_0x07d5('0x26'),_0x3610ec,_0x07d5('0x27'));_0x2c642b(_0x44a3fd[_0x07d5('0x2e')][_0x07d5('0x2d')]);}})[_0x07d5('0x2f')](function(_0x388b89){logger[_0x07d5('0x2c')](_0x07d5('0x26'),_0x3610ec,_0x388b89);_0x4b4694(_0x388b89);});});}function respondWithStatusCode(_0xde8f92,_0xde6a42){_0xde6a42=_0xde6a42||0xcc;return function(_0x412cbd){if(_0x412cbd){return _0xde8f92[_0x07d5('0x30')](_0xde6a42);}return _0xde8f92[_0x07d5('0x31')](_0xde6a42)['end']();};}function respondWithResult(_0x35c8af,_0x5738cd){_0x5738cd=_0x5738cd||0xc8;return function(_0xe988b0){if(_0xe988b0){return _0x35c8af['status'](_0x5738cd)[_0x07d5('0x32')](_0xe988b0);}};}function respondWithFilteredResult(_0xf9cad5,_0x3eb04a){return function(_0x3efedd){if(_0x3efedd){var _0x22d680=typeof _0x3eb04a[_0x07d5('0x33')]===_0x07d5('0x34')&&typeof _0x3eb04a[_0x07d5('0x35')]===_0x07d5('0x34');var _0x4f95f5=_0x3efedd[_0x07d5('0x36')];var _0x45e40a=_0x22d680?0x0:_0x3eb04a[_0x07d5('0x33')];var _0x4b9929=_0x22d680?_0x3efedd[_0x07d5('0x36')]:_0x3eb04a[_0x07d5('0x33')]+_0x3eb04a[_0x07d5('0x35')];var _0x51afd4;if(_0x4b9929>=_0x4f95f5){_0x4b9929=_0x4f95f5;_0x51afd4=0xc8;}else{_0x51afd4=0xce;}_0xf9cad5[_0x07d5('0x31')](_0x51afd4);return _0xf9cad5['set'](_0x07d5('0x37'),_0x45e40a+'-'+_0x4b9929+'/'+_0x4f95f5)[_0x07d5('0x32')](_0x3efedd);}return null;};}function patchUpdates(_0x3a5a2e){return function(_0x47a781){try{jsonpatch[_0x07d5('0x38')](_0x47a781,_0x3a5a2e,!![]);}catch(_0x528a21){return BPromise[_0x07d5('0x39')](_0x528a21);}return _0x47a781['save']();};}function saveUpdates(_0x16da26,_0x566c60){return function(_0xf8f1b8){if(_0xf8f1b8){return _0xf8f1b8[_0x07d5('0x3a')](_0x16da26)[_0x07d5('0x24')](function(_0x442ed7){return _0x442ed7;});}return null;};}function removeEntity(_0x306280,_0x14aaf5){return function(_0x5621de){if(_0x5621de){return _0x5621de[_0x07d5('0x3b')]()['then'](function(){var _0x2ca8db=_0x5621de[_0x07d5('0x3c')]({'plain':!![]});var _0x2551c7=_0x07d5('0x3d');return db['UserProfileResource'][_0x07d5('0x3b')]({'where':{'type':_0x2551c7,'resourceId':_0x2ca8db['id']}})[_0x07d5('0x24')](function(){return _0x5621de;});})[_0x07d5('0x24')](function(){_0x306280[_0x07d5('0x31')](0xcc)[_0x07d5('0x3e')]();});}};}function handleEntityNotFound(_0x490018,_0x3640eb){return function(_0x5d58e7){if(!_0x5d58e7){_0x490018['sendStatus'](0x194);}return _0x5d58e7;};}function handleError(_0x1f14fc,_0x416513){_0x416513=_0x416513||0x1f4;return function(_0x46ba2c){logger['error'](_0x46ba2c[_0x07d5('0x3f')]);if(_0x46ba2c[_0x07d5('0x40')]){delete _0x46ba2c[_0x07d5('0x40')];}_0x1f14fc[_0x07d5('0x31')](_0x416513)[_0x07d5('0x41')](_0x46ba2c);};}exports[_0x07d5('0x42')]=function(_0x460280,_0x351590){var _0x1ce9f6={'include':[{'model':db[_0x07d5('0x43')],'as':_0x07d5('0x44')}]},_0x35ef31={},_0x189ce8={'count':0x0,'rows':[]};var _0x2a8a6b=_[_0x07d5('0x45')](db[_0x07d5('0x46')]['rawAttributes'],function(_0x5ea566){return{'name':_0x5ea566[_0x07d5('0x47')],'type':_0x5ea566[_0x07d5('0x48')][_0x07d5('0x49')]};});_0x35ef31[_0x07d5('0x4a')]=_[_0x07d5('0x45')](_0x2a8a6b,_0x07d5('0x40'));_0x35ef31[_0x07d5('0x4b')]=_['keys'](_0x460280[_0x07d5('0x4b')]);_0x35ef31['filters']=_[_0x07d5('0x4c')](_0x35ef31[_0x07d5('0x4a')],_0x35ef31[_0x07d5('0x4b')]);_0x1ce9f6['attributes']=_['intersection'](_0x35ef31[_0x07d5('0x4a')],qs[_0x07d5('0x4d')](_0x460280[_0x07d5('0x4b')][_0x07d5('0x4d')]));_0x1ce9f6[_0x07d5('0x4e')]=_0x1ce9f6[_0x07d5('0x4e')][_0x07d5('0x4f')]?_0x1ce9f6['attributes']:_0x35ef31[_0x07d5('0x4a')];if(!_0x460280[_0x07d5('0x4b')][_0x07d5('0x50')](_0x07d5('0x51'))){_0x1ce9f6[_0x07d5('0x35')]=qs[_0x07d5('0x35')](_0x460280['query'][_0x07d5('0x35')]);_0x1ce9f6['offset']=qs[_0x07d5('0x33')](_0x460280['query'][_0x07d5('0x33')]);}_0x1ce9f6[_0x07d5('0x52')]=qs[_0x07d5('0x53')](_0x460280[_0x07d5('0x4b')][_0x07d5('0x53')]);_0x1ce9f6['where']=qs['filters'](_['pick'](_0x460280[_0x07d5('0x4b')],_0x35ef31[_0x07d5('0x54')]),_0x2a8a6b);if(_0x460280['query'][_0x07d5('0x55')]){_0x1ce9f6[_0x07d5('0x56')]=_[_0x07d5('0x57')](_0x1ce9f6[_0x07d5('0x56')],{'$or':_['map'](_0x2a8a6b,function(_0x2d56c5){if(_0x2d56c5[_0x07d5('0x48')]!=='VIRTUAL'){var _0x174525={};_0x174525[_0x2d56c5[_0x07d5('0x40')]]={'$like':'%'+_0x460280[_0x07d5('0x4b')][_0x07d5('0x55')]+'%'};return _0x174525;}})});}_0x1ce9f6=_[_0x07d5('0x57')]({},_0x1ce9f6,_0x460280[_0x07d5('0x58')]);var _0x4c361a={'where':_0x1ce9f6[_0x07d5('0x56')]};return db['WhatsappAccount'][_0x07d5('0x36')](_0x4c361a)[_0x07d5('0x24')](function(_0x7f7ad1){_0x189ce8['count']=_0x7f7ad1;if(_0x460280['query']['includeAll']){_0x1ce9f6['include']=[{'all':!![]}];}return db[_0x07d5('0x46')][_0x07d5('0x59')](_0x1ce9f6);})['then'](function(_0x321f16){_0x189ce8['rows']=_0x321f16;return _0x189ce8;})[_0x07d5('0x24')](respondWithFilteredResult(_0x351590,_0x1ce9f6))['catch'](handleError(_0x351590,null));};exports['show']=function(_0x5d6ef7,_0x3a057a){var _0x525ebf={'raw':![],'where':{'id':_0x5d6ef7[_0x07d5('0x5a')]['id']},'include':[{'model':db[_0x07d5('0x43')],'as':'mandatoryDispositionPause'}]},_0x35193c={};_0x35193c[_0x07d5('0x4a')]=_['keys'](db['WhatsappAccount'][_0x07d5('0x5b')]);_0x35193c[_0x07d5('0x4b')]=_[_0x07d5('0x5c')](_0x5d6ef7[_0x07d5('0x4b')]);_0x35193c[_0x07d5('0x54')]=_['intersection'](_0x35193c[_0x07d5('0x4a')],_0x35193c[_0x07d5('0x4b')]);_0x525ebf[_0x07d5('0x4e')]=_[_0x07d5('0x4c')](_0x35193c[_0x07d5('0x4a')],qs[_0x07d5('0x4d')](_0x5d6ef7[_0x07d5('0x4b')][_0x07d5('0x4d')]));_0x525ebf[_0x07d5('0x4e')]=_0x525ebf['attributes'][_0x07d5('0x4f')]?_0x525ebf[_0x07d5('0x4e')]:_0x35193c[_0x07d5('0x4a')];if(_0x5d6ef7[_0x07d5('0x4b')]['includeAll']){_0x525ebf['include']=[{'all':!![]}];}_0x525ebf=_[_0x07d5('0x57')]({},_0x525ebf,_0x5d6ef7['options']);return db['WhatsappAccount'][_0x07d5('0x5d')](_0x525ebf)[_0x07d5('0x24')](handleEntityNotFound(_0x3a057a,null))[_0x07d5('0x24')](respondWithResult(_0x3a057a,null))[_0x07d5('0x2f')](handleError(_0x3a057a,null));};exports[_0x07d5('0x5e')]=function(_0x47ce8f,_0x46029e){return db[_0x07d5('0x46')][_0x07d5('0x5e')](_0x47ce8f[_0x07d5('0x5f')],{})['then'](function(_0x39e738){var _0x1e8f60=_0x47ce8f['user']['get']({'plain':!![]});if(!_0x1e8f60)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e8f60[_0x07d5('0x60')]===_0x07d5('0x61')){var _0x4b2d03=_0x39e738[_0x07d5('0x3c')]({'plain':!![]});var _0x149cdc=_0x07d5('0x3d');return db['UserProfileSection'][_0x07d5('0x5d')]({'where':{'name':_0x149cdc,'userProfileId':_0x1e8f60['userProfileId']},'raw':!![]})['then'](function(_0x5ed17c){if(_0x5ed17c&&_0x5ed17c[_0x07d5('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x4b2d03['name'],'resourceId':_0x4b2d03['id'],'type':_0x5ed17c[_0x07d5('0x40')],'sectionId':_0x5ed17c['id']},{})[_0x07d5('0x24')](function(){return _0x39e738;});}else{return _0x39e738;}})[_0x07d5('0x2f')](function(_0x4cef83){logger[_0x07d5('0x2c')](_0x07d5('0x63'),_0x4cef83);throw _0x4cef83;});}return _0x39e738;})['then'](respondWithResult(_0x46029e,0xc9))[_0x07d5('0x2f')](handleError(_0x46029e,null));};exports['update']=function(_0x279c20,_0x143b77){if(_0x279c20['body']['id']){delete _0x279c20[_0x07d5('0x5f')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x279c20[_0x07d5('0x5a')]['id']},'include':[{'model':db[_0x07d5('0x43')],'as':'mandatoryDispositionPause'}]})[_0x07d5('0x24')](handleEntityNotFound(_0x143b77,null))[_0x07d5('0x24')](saveUpdates(_0x279c20[_0x07d5('0x5f')],null))[_0x07d5('0x24')](respondWithResult(_0x143b77,null))[_0x07d5('0x2f')](handleError(_0x143b77,null));};exports[_0x07d5('0x3b')]=function(_0x4df104,_0xea7e21){return db[_0x07d5('0x46')][_0x07d5('0x5d')]({'where':{'id':_0x4df104['params']['id']}})[_0x07d5('0x24')](handleEntityNotFound(_0xea7e21,null))[_0x07d5('0x24')](removeEntity(_0xea7e21,null))[_0x07d5('0x2f')](handleError(_0xea7e21,null));};exports[_0x07d5('0x64')]=function(_0x1e2199,_0x438212){return db[_0x07d5('0x46')][_0x07d5('0x64')]()[_0x07d5('0x24')](respondWithResult(_0x438212,null))[_0x07d5('0x2f')](handleError(_0x438212,null));};exports[_0x07d5('0x65')]=function(_0x53d614,_0x4680ac,_0x5815ab){if(_0x53d614[_0x07d5('0x5f')]['id']){delete _0x53d614[_0x07d5('0x5f')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x53d614['params']['id']}})[_0x07d5('0x24')](handleEntityNotFound(_0x4680ac,null))[_0x07d5('0x24')](function(_0xe1e822){if(_0xe1e822){_0x53d614[_0x07d5('0x5f')][_0x07d5('0x66')]=_0xe1e822['id'];return db[_0x07d5('0x67')]['create'](_0x53d614[_0x07d5('0x5f')]);}})[_0x07d5('0x24')](respondWithResult(_0x4680ac,null))['catch'](handleError(_0x4680ac,null));};exports['getDispositions']=function(_0x546846,_0x114d48,_0x2b72e7){var _0x34544e={'raw':![],'where':{}};var _0x23a58b={};var _0x694f15={'count':0x0,'rows':[]};return db[_0x07d5('0x46')]['findOne']({'where':{'id':_0x546846['params']['id']}})[_0x07d5('0x24')](handleEntityNotFound(_0x114d48,null))[_0x07d5('0x24')](function(_0x28decc){if(_0x28decc){_0x23a58b[_0x07d5('0x4a')]=_[_0x07d5('0x5c')](db[_0x07d5('0x67')][_0x07d5('0x5b')]);_0x23a58b[_0x07d5('0x4b')]=_[_0x07d5('0x5c')](_0x546846[_0x07d5('0x4b')]);_0x23a58b[_0x07d5('0x54')]=_[_0x07d5('0x4c')](_0x23a58b[_0x07d5('0x4a')],_0x23a58b[_0x07d5('0x4b')]);_0x34544e['attributes']=_[_0x07d5('0x4c')](_0x23a58b[_0x07d5('0x4a')],qs[_0x07d5('0x4d')](_0x546846[_0x07d5('0x4b')]['fields']));_0x34544e[_0x07d5('0x4e')]=_0x34544e['attributes'][_0x07d5('0x4f')]?_0x34544e[_0x07d5('0x4e')]:_0x23a58b[_0x07d5('0x4a')];if(!_0x546846[_0x07d5('0x4b')]['hasOwnProperty'](_0x07d5('0x51'))){_0x34544e['limit']=qs[_0x07d5('0x35')](_0x546846[_0x07d5('0x4b')][_0x07d5('0x35')]);_0x34544e[_0x07d5('0x33')]=qs[_0x07d5('0x33')](_0x546846[_0x07d5('0x4b')]['offset']);}_0x34544e[_0x07d5('0x52')]=qs[_0x07d5('0x53')](_0x546846[_0x07d5('0x4b')][_0x07d5('0x53')]);_0x34544e[_0x07d5('0x56')]=qs[_0x07d5('0x54')](_['pick'](_0x546846['query'],_0x23a58b[_0x07d5('0x54')]));_0x34544e[_0x07d5('0x56')][_0x07d5('0x66')]=_0x28decc['id'];if(_0x546846[_0x07d5('0x4b')][_0x07d5('0x55')]){_0x34544e['where']=_[_0x07d5('0x57')](_0x34544e['where'],{'$or':_[_0x07d5('0x45')](_0x34544e[_0x07d5('0x4e')],function(_0x1d2be1){var _0x13a504={};_0x13a504[_0x1d2be1]={'$like':'%'+_0x546846[_0x07d5('0x4b')][_0x07d5('0x55')]+'%'};return _0x13a504;})});}_0x34544e=_['merge']({},_0x34544e,_0x546846[_0x07d5('0x58')]);return db[_0x07d5('0x67')]['count']({'where':_0x34544e[_0x07d5('0x56')]})[_0x07d5('0x24')](function(_0x2146de){_0x694f15['count']=_0x2146de;if(_0x546846['query'][_0x07d5('0x68')]){_0x34544e[_0x07d5('0x69')]=[{'all':!![]}];}return db['Disposition'][_0x07d5('0x59')](_0x34544e);})[_0x07d5('0x24')](function(_0x14da00){_0x694f15[_0x07d5('0x6a')]=_0x14da00;return _0x694f15;});}})[_0x07d5('0x24')](respondWithFilteredResult(_0x114d48,_0x34544e))[_0x07d5('0x2f')](handleError(_0x114d48,null));};exports[_0x07d5('0x6b')]=function(_0xf9a30f,_0x460747,_0x3a655f){return db[_0x07d5('0x46')][_0x07d5('0x5d')]({'where':{'id':_0xf9a30f[_0x07d5('0x5a')]['id']}})[_0x07d5('0x24')](handleEntityNotFound(_0x460747,null))[_0x07d5('0x24')](function(_0x5cd6d1){if(_0x5cd6d1){return _0x5cd6d1[_0x07d5('0x6b')](_0xf9a30f[_0x07d5('0x4b')][_0x07d5('0x6c')]);}})[_0x07d5('0x24')](respondWithStatusCode(_0x460747,null))['catch'](handleError(_0x460747,null));};exports[_0x07d5('0x6d')]=function(_0x59fa62,_0x5a67f5,_0x4874bb){if(_0x59fa62[_0x07d5('0x5f')]['id']){delete _0x59fa62['body']['id'];}return db[_0x07d5('0x46')][_0x07d5('0x5d')]({'where':{'id':_0x59fa62[_0x07d5('0x5a')]['id']}})[_0x07d5('0x24')](handleEntityNotFound(_0x5a67f5,null))['then'](function(_0xcbb2e){if(_0xcbb2e){_0x59fa62['body'][_0x07d5('0x66')]=_0xcbb2e['id'];return db['CannedAnswer'][_0x07d5('0x5e')](_0x59fa62['body']);}})[_0x07d5('0x24')](respondWithResult(_0x5a67f5,null))[_0x07d5('0x2f')](handleError(_0x5a67f5,null));};exports[_0x07d5('0x6e')]=function(_0x1a3e27,_0x505666,_0x1e9a76){var _0x34fb85={'raw':![],'where':{}};var _0x1ade8f={};var _0x4a00f3={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x07d5('0x6f')]({'where':{'id':_0x1a3e27['params']['id']}})[_0x07d5('0x24')](handleEntityNotFound(_0x505666,null))[_0x07d5('0x24')](function(_0xdec7c4){if(_0xdec7c4){_0x1ade8f['model']=_[_0x07d5('0x5c')](db[_0x07d5('0x70')][_0x07d5('0x5b')]);_0x1ade8f[_0x07d5('0x4b')]=_[_0x07d5('0x5c')](_0x1a3e27['query']);_0x1ade8f['filters']=_[_0x07d5('0x4c')](_0x1ade8f[_0x07d5('0x4a')],_0x1ade8f[_0x07d5('0x4b')]);_0x34fb85['attributes']=_[_0x07d5('0x4c')](_0x1ade8f[_0x07d5('0x4a')],qs['fields'](_0x1a3e27[_0x07d5('0x4b')][_0x07d5('0x4d')]));_0x34fb85['attributes']=_0x34fb85[_0x07d5('0x4e')]['length']?_0x34fb85['attributes']:_0x1ade8f[_0x07d5('0x4a')];if(!_0x1a3e27[_0x07d5('0x4b')][_0x07d5('0x50')]('nolimit')){_0x34fb85[_0x07d5('0x35')]=qs[_0x07d5('0x35')](_0x1a3e27[_0x07d5('0x4b')]['limit']);_0x34fb85[_0x07d5('0x33')]=qs[_0x07d5('0x33')](_0x1a3e27[_0x07d5('0x4b')][_0x07d5('0x33')]);}_0x34fb85['order']=qs[_0x07d5('0x53')](_0x1a3e27[_0x07d5('0x4b')][_0x07d5('0x53')]);_0x34fb85['where']=qs[_0x07d5('0x54')](_[_0x07d5('0x71')](_0x1a3e27[_0x07d5('0x4b')],_0x1ade8f[_0x07d5('0x54')]));_0x34fb85[_0x07d5('0x56')][_0x07d5('0x66')]=_0xdec7c4['id'];if(_0x1a3e27[_0x07d5('0x4b')]['filter']){_0x34fb85[_0x07d5('0x56')]=_[_0x07d5('0x57')](_0x34fb85['where'],{'$or':_[_0x07d5('0x45')](_0x34fb85[_0x07d5('0x4e')],function(_0x50cee4){var _0x48972b={};_0x48972b[_0x50cee4]={'$like':'%'+_0x1a3e27[_0x07d5('0x4b')][_0x07d5('0x55')]+'%'};return _0x48972b;})});}_0x34fb85=_[_0x07d5('0x57')]({},_0x34fb85,_0x1a3e27[_0x07d5('0x58')]);return db['CannedAnswer'][_0x07d5('0x36')]({'where':_0x34fb85[_0x07d5('0x56')]})[_0x07d5('0x24')](function(_0x125d66){_0x4a00f3[_0x07d5('0x36')]=_0x125d66;if(_0x1a3e27[_0x07d5('0x4b')]['includeAll']){_0x34fb85[_0x07d5('0x69')]=[{'all':!![]}];}return db[_0x07d5('0x70')][_0x07d5('0x59')](_0x34fb85);})[_0x07d5('0x24')](function(_0x4d05d9){_0x4a00f3['rows']=_0x4d05d9;return _0x4a00f3;});}})[_0x07d5('0x24')](respondWithFilteredResult(_0x505666,_0x34fb85))[_0x07d5('0x2f')](handleError(_0x505666,null));};exports[_0x07d5('0x72')]=function(_0x316f1a,_0xbeb63d,_0x1bac3d){return db['WhatsappAccount'][_0x07d5('0x5d')]({'where':{'id':_0x316f1a[_0x07d5('0x5a')]['id']}})['then'](handleEntityNotFound(_0xbeb63d,null))[_0x07d5('0x24')](function(_0x30f985){if(_0x30f985){return _0x30f985['removeAnswers'](_0x316f1a[_0x07d5('0x4b')][_0x07d5('0x6c')]);}})[_0x07d5('0x24')](respondWithStatusCode(_0xbeb63d,null))['catch'](handleError(_0xbeb63d,null));};exports[_0x07d5('0x73')]=function(_0x1fad67,_0x2e9992,_0x1b8ea9){return db[_0x07d5('0x46')][_0x07d5('0x5d')]({'where':{'id':_0x1fad67[_0x07d5('0x5a')]['id']}})[_0x07d5('0x24')](handleEntityNotFound(_0x2e9992,null))[_0x07d5('0x24')](function(_0x341aec){if(_0x341aec){return _0x341aec['addAgents'](_0x1fad67['body']['ids'],_['omit'](_0x1fad67[_0x07d5('0x5f')],[_0x07d5('0x6c'),'id'])||{})[_0x07d5('0x74')](function(_0x27f24e){for(var _0x4cee64=0x0;_0x4cee64<_0x1fad67[_0x07d5('0x5f')]['ids'][_0x07d5('0x4f')];_0x4cee64+=0x1){socket[_0x07d5('0x75')](_0x07d5('0x76'),{'UserId':_0x1fad67[_0x07d5('0x5f')][_0x07d5('0x6c')][_0x4cee64],'WhatsappAccountId':_0x1fad67[_0x07d5('0x5a')]['id']});}return _0x27f24e;});}})[_0x07d5('0x24')](respondWithResult(_0x2e9992,null))[_0x07d5('0x2f')](handleError(_0x2e9992,null));};exports['removeAgents']=function(_0x369f3a,_0x74acf1,_0x31d5ea){return db[_0x07d5('0x46')]['find']({'where':{'id':_0x369f3a[_0x07d5('0x5a')]['id']}})['then'](handleEntityNotFound(_0x74acf1,null))[_0x07d5('0x24')](function(_0x44f4e9){if(_0x44f4e9){return _0x44f4e9[_0x07d5('0x77')](_0x369f3a[_0x07d5('0x4b')][_0x07d5('0x6c')])['then'](function(){if(_[_0x07d5('0x78')](_0x369f3a[_0x07d5('0x4b')]['ids'])){for(var _0x479d55=0x0;_0x479d55<_0x369f3a[_0x07d5('0x4b')][_0x07d5('0x6c')][_0x07d5('0x4f')];_0x479d55+=0x1){socket[_0x07d5('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0x369f3a[_0x07d5('0x4b')][_0x07d5('0x6c')][_0x479d55]),'WhatsappAccountId':Number(_0x369f3a['params']['id'])});}}else{socket[_0x07d5('0x75')](_0x07d5('0x79'),{'UserId':Number(_0x369f3a['query'][_0x07d5('0x6c')]),'WhatsappAccountId':Number(_0x369f3a[_0x07d5('0x5a')]['id'])});}});}})[_0x07d5('0x24')](respondWithStatusCode(_0x74acf1,null))[_0x07d5('0x2f')](handleError(_0x74acf1,null));};exports[_0x07d5('0x7a')]=function(_0x4842d8,_0x4f1a58,_0xc049b){var _0x59a030={};var _0x48d65e={};var _0x2ae936;var _0x59a1f2;return db[_0x07d5('0x46')][_0x07d5('0x6f')]({'where':{'id':_0x4842d8['params']['id']}})['then'](handleEntityNotFound(_0x4f1a58,null))[_0x07d5('0x24')](function(_0x1a4b83){if(_0x1a4b83){_0x2ae936=_0x1a4b83;_0x48d65e[_0x07d5('0x4a')]=_[_0x07d5('0x5c')](db['User']['rawAttributes']);_0x48d65e['query']=_[_0x07d5('0x5c')](_0x4842d8[_0x07d5('0x4b')]);_0x48d65e['filters']=_[_0x07d5('0x4c')](_0x48d65e[_0x07d5('0x4a')],_0x48d65e[_0x07d5('0x4b')]);_0x59a030['attributes']=_[_0x07d5('0x4c')](_0x48d65e[_0x07d5('0x4a')],qs[_0x07d5('0x4d')](_0x4842d8[_0x07d5('0x4b')]['fields']));_0x59a030['attributes']=_0x59a030[_0x07d5('0x4e')]['length']?_0x59a030[_0x07d5('0x4e')]:_0x48d65e[_0x07d5('0x4a')];_0x59a030[_0x07d5('0x52')]=qs[_0x07d5('0x53')](_0x4842d8[_0x07d5('0x4b')][_0x07d5('0x53')]);_0x59a030[_0x07d5('0x56')]=qs[_0x07d5('0x54')](_[_0x07d5('0x71')](_0x4842d8[_0x07d5('0x4b')],_0x48d65e['filters']));if(_0x4842d8[_0x07d5('0x4b')][_0x07d5('0x55')]){_0x59a030[_0x07d5('0x56')]=_[_0x07d5('0x57')](_0x59a030[_0x07d5('0x56')],{'$or':_['map'](_0x59a030['attributes'],function(_0x28767e){var _0x5cc0df={};_0x5cc0df[_0x28767e]={'$like':'%'+_0x4842d8[_0x07d5('0x4b')]['filter']+'%'};return _0x5cc0df;})});}_0x59a030=_[_0x07d5('0x57')]({},_0x59a030,_0x4842d8[_0x07d5('0x58')]);return _0x2ae936[_0x07d5('0x7a')](_0x59a030);}})['then'](function(_0x406df7){if(_0x406df7){_0x59a1f2=_0x406df7['length'];if(!_0x4842d8['query'][_0x07d5('0x50')]('nolimit')){_0x59a030[_0x07d5('0x35')]=qs['limit'](_0x4842d8[_0x07d5('0x4b')]['limit']);_0x59a030[_0x07d5('0x33')]=qs['offset'](_0x4842d8[_0x07d5('0x4b')][_0x07d5('0x33')]);}return _0x2ae936[_0x07d5('0x7a')](_0x59a030);}})['then'](function(_0x1004ae){if(_0x1004ae){return _0x1004ae?{'count':_0x59a1f2,'rows':_0x1004ae}:null;}})['then'](respondWithResult(_0x4f1a58,null))[_0x07d5('0x2f')](handleError(_0x4f1a58,null));};exports[_0x07d5('0x7b')]=function(_0x2ac14f,_0x115f1b,_0x2dea57){return db[_0x07d5('0x46')]['findOne']({'where':{'id':_0x2ac14f[_0x07d5('0x5a')]['id']}})[_0x07d5('0x24')](handleEntityNotFound(_0x115f1b,null))['then'](function(_0x461bd8){if(_0x461bd8){return db[_0x07d5('0x7c')][_0x07d5('0x7d')](function(_0x4e478d){return db[_0x07d5('0x7e')][_0x07d5('0x3b')]({'where':{'WhatsappAccountId':_0x2ac14f['params']['id']},'transaction':_0x4e478d})[_0x07d5('0x24')](function(_0x28f487){var _0x5b109a=_[_0x07d5('0x45')](_0x2ac14f[_0x07d5('0x5f')],function(_0x4a907e){_0x4a907e[_0x07d5('0x66')]=_0x2ac14f['params']['id'];return _0x4a907e;});return db[_0x07d5('0x7e')]['bulkCreate'](_0x5b109a,{'transaction':_0x4e478d});});})[_0x07d5('0x24')](function(){return db[_0x07d5('0x7e')][_0x07d5('0x7f')]({'where':{'WhatsappAccountId':_0x2ac14f[_0x07d5('0x5a')]['id']},'order':_0x07d5('0x80')});});}})['then'](respondWithResult(_0x115f1b,null))['catch'](handleError(_0x115f1b,null));};exports[_0x07d5('0x81')]=function(_0x4eb85b,_0x42fbf5,_0x54a208){var _0x2740ec={};var _0x127c9b={};var _0x33808f;var _0x4f344d;return db['WhatsappAccount'][_0x07d5('0x6f')]({'where':{'id':_0x4eb85b['params']['id']}})[_0x07d5('0x24')](handleEntityNotFound(_0x42fbf5,null))['then'](function(_0xba50af){if(_0xba50af){_0x33808f=_0xba50af;_0x127c9b[_0x07d5('0x4a')]=_[_0x07d5('0x5c')](db[_0x07d5('0x7e')][_0x07d5('0x5b')]);_0x127c9b[_0x07d5('0x4b')]=_[_0x07d5('0x5c')](_0x4eb85b[_0x07d5('0x4b')]);_0x127c9b[_0x07d5('0x54')]=_[_0x07d5('0x4c')](_0x127c9b[_0x07d5('0x4a')],_0x127c9b[_0x07d5('0x4b')]);_0x2740ec[_0x07d5('0x4e')]=_[_0x07d5('0x4c')](_0x127c9b['model'],qs[_0x07d5('0x4d')](_0x4eb85b[_0x07d5('0x4b')][_0x07d5('0x4d')]));_0x2740ec[_0x07d5('0x4e')]=_0x2740ec[_0x07d5('0x4e')][_0x07d5('0x4f')]?_0x2740ec[_0x07d5('0x4e')]:_0x127c9b[_0x07d5('0x4a')];_0x2740ec[_0x07d5('0x52')]=qs['sort'](_0x4eb85b[_0x07d5('0x4b')][_0x07d5('0x53')]);_0x2740ec[_0x07d5('0x56')]=qs[_0x07d5('0x54')](_['pick'](_0x4eb85b[_0x07d5('0x4b')],_0x127c9b[_0x07d5('0x54')]));if(_0x4eb85b[_0x07d5('0x4b')]['filter']){_0x2740ec['where']=_[_0x07d5('0x57')](_0x2740ec[_0x07d5('0x56')],{'$or':_['map'](_0x2740ec[_0x07d5('0x4e')],function(_0x281c09){var _0xc2530f={};_0xc2530f[_0x281c09]={'$like':'%'+_0x4eb85b[_0x07d5('0x4b')][_0x07d5('0x55')]+'%'};return _0xc2530f;})});}_0x2740ec=_['merge']({},_0x2740ec,_0x4eb85b[_0x07d5('0x58')]);return _0x33808f[_0x07d5('0x81')](_0x2740ec);}})[_0x07d5('0x24')](function(_0x509b7b){if(_0x509b7b){_0x4f344d=_0x509b7b['length'];if(!_0x4eb85b['query'][_0x07d5('0x50')](_0x07d5('0x51'))){_0x2740ec[_0x07d5('0x35')]=qs[_0x07d5('0x35')](_0x4eb85b[_0x07d5('0x4b')][_0x07d5('0x35')]);_0x2740ec[_0x07d5('0x33')]=qs[_0x07d5('0x33')](_0x4eb85b[_0x07d5('0x4b')]['offset']);}return _0x33808f[_0x07d5('0x81')](_0x2740ec);}})['then'](function(_0x1b9ef4){if(_0x1b9ef4){return _0x1b9ef4?{'count':_0x4f344d,'rows':_0x1b9ef4}:null;}})[_0x07d5('0x24')](respondWithResult(_0x42fbf5,null))[_0x07d5('0x2f')](handleError(_0x42fbf5,null));};exports['notify']=function(_0x5d3910,_0x24843a,_0x4fe227){var _0x57b782={'channel':_0x07d5('0x82')};var _0x18e3f2=[];var _0x3a46c5=[];var _0x3ed29a={};return db[_0x07d5('0x46')]['find']({'where':{'id':_0x5d3910['params']['id']},'include':[{'model':db[_0x07d5('0x7e')],'as':'Applications'}]})[_0x07d5('0x24')](handleEntityNotFound(_0x24843a,null))[_0x07d5('0x24')](function(_0x3cf75d){_0x57b782['account']=_0x3cf75d;_0x57b782[_0x07d5('0x83')]=_[_0x07d5('0x84')](_0x3cf75d[_0x07d5('0x85')],[_0x07d5('0x80')],[_0x07d5('0x86')]);if(_0x57b782[_0x07d5('0x87')][_0x07d5('0x85')]){delete _0x57b782[_0x07d5('0x87')]['Applications'];}return db[_0x07d5('0x88')][_0x07d5('0x64')]();})[_0x07d5('0x24')](function(_0x1becd5){if(!_0x1becd5){throw new db[(_0x07d5('0x89'))][(_0x07d5('0x8a'))](_0x07d5('0x8b'));}_0x18e3f2=_[_0x07d5('0x8c')](_[_0x07d5('0x5c')](_0x1becd5),['createdAt',_0x07d5('0x8d')]);_0x3a46c5=_['difference'](_[_0x07d5('0x5c')](_0x1becd5),[_0x07d5('0x8e'),_0x07d5('0x8d'),_0x07d5('0x8f'),_0x07d5('0x90')]);_0x57b782[_0x07d5('0x5f')]={'mapKey':_0x07d5('0x91')};if(_0x57b782['account']['type']&&_0x57b782['account'][_0x07d5('0x48')]===_0x07d5('0x92')){_0x57b782['body'][_0x07d5('0x93')]=_0x5d3910['body']['From'][_0x07d5('0x94')](_0x07d5('0x95'),'');_0x57b782[_0x07d5('0x5f')]['body']=_0x5d3910['body'][_0x07d5('0x96')];_0x57b782[_0x07d5('0x5f')][_0x07d5('0x97')]=_0x5d3910[_0x07d5('0x5f')][_0x07d5('0x98')];}if(_0x57b782[_0x07d5('0x5f')]['id']){delete _0x57b782['body']['id'];}if(_['isNil'](_0x57b782['body'][_0x07d5('0x93')])){throw new db[(_0x07d5('0x89'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x57b782['body']['body'])||_0x57b782['body'][_0x07d5('0x5f')]===''){throw new db[(_0x07d5('0x89'))]['ValidationError'](_0x07d5('0x99'));}if(_[_0x07d5('0x9a')](_0x57b782[_0x07d5('0x5f')][_0x07d5('0x9b')])){throw new db['Sequelize'][(_0x07d5('0x8a'))](_0x07d5('0x9c')+_0x3a46c5);}if(!_[_0x07d5('0x9d')](_0x3a46c5,_0x57b782[_0x07d5('0x5f')][_0x07d5('0x9b')])){throw new db[(_0x07d5('0x89'))][(_0x07d5('0x8a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3a46c5);}_0x3ed29a[_0x57b782[_0x07d5('0x5f')]['mapKey']]=_0x57b782['body'][_0x07d5('0x93')];return db[_0x07d5('0x9e')][_0x07d5('0x5d')]({'where':{'id':_0x57b782['account'][_0x07d5('0x90')]},'include':[{'model':db[_0x07d5('0x88')],'as':_0x07d5('0x9f'),'where':_0x3ed29a,'limit':0x1,'order':[[_0x07d5('0x8d'),'DESC']]}]});})[_0x07d5('0x24')](handleEntityNotFound(_0x24843a,null))[_0x07d5('0x24')](function(_0x5a2cdd){if(_0x5a2cdd){_0x57b782[_0x07d5('0xa0')]=_[_0x07d5('0xa1')](_0x5a2cdd,[_0x07d5('0x9f')]);if(_0x5a2cdd[_0x07d5('0x9f')][_0x07d5('0x4f')]){return _0x5a2cdd[_0x07d5('0x9f')][0x0];}var _0x2b100b=_[_0x07d5('0x1b')](_0x57b782['body'],{'firstName':_0x57b782[_0x07d5('0x5f')][_0x07d5('0x93')],'ListId':_0x5a2cdd['id']});_0x2b100b[_0x57b782['body'][_0x07d5('0x9b')]]=_0x57b782['body'][_0x07d5('0x93')];return db[_0x07d5('0x88')][_0x07d5('0x5e')](_0x2b100b,{'fields':_0x18e3f2,'raw':!![]});}})[_0x07d5('0x24')](handleEntityNotFound(_0x24843a,null))['then'](function(_0x5a431a){if(_0x5a431a){_0x57b782[_0x07d5('0xa2')]=_0x5a431a;var _0x37b33f={'ContactId':_0x5a431a['id'],'phone':_0x57b782['body'][_0x07d5('0x93')],'WhatsappAccountId':_0x5d3910[_0x07d5('0x5a')]['id']};var _0x26f298={'ContactId':_0x5a431a['id'],'WhatsappAccountId':_0x5d3910[_0x07d5('0x5a')]['id'],'closed':![]};return db[_0x07d5('0xa3')][_0x07d5('0x5d')]({'where':_0x26f298})[_0x07d5('0x24')](function(_0x1eb401){if(_0x1eb401){return[_0x1eb401,![]];}return db[_0x07d5('0xa3')][_0x07d5('0x5e')](_0x37b33f)[_0x07d5('0x24')](function(_0x5578df){return[_0x5578df,!![]];});});}})[_0x07d5('0x74')](function(_0x27d217,_0x134947){_0x57b782[_0x07d5('0xa4')]=_0x27d217[_0x07d5('0x3c')]({'plain':!![]});_0x57b782[_0x07d5('0xa4')][_0x07d5('0xa5')]=![];if(_0x134947){if(_0x57b782[_0x07d5('0x87')][_0x07d5('0xa6')]){_0x57b782[_0x07d5('0x83')][_0x07d5('0xa7')]({'id':0x0,'priority':_0x57b782['applications']['length']+0x1,'app':_0x07d5('0xa8'),'appdata':_0x07d5('0xa9'),'interval':_0x07d5('0xaa')});}_0x57b782[_0x07d5('0xa4')]['created']=!![];}return db['WhatsappMessage'][_0x07d5('0x5e')]({'phone':_0x57b782[_0x07d5('0x5f')][_0x07d5('0x93')],'messageId':_0x57b782['body'][_0x07d5('0x97')],'body':_0x57b782[_0x07d5('0x5f')][_0x07d5('0x5f')],'WhatsappAccountId':_0x5d3910[_0x07d5('0x5a')]['id'],'WhatsappInteractionId':_0x27d217['id'],'direction':'in','ContactId':_0x27d217['ContactId'],'AttachmentId':_0x57b782[_0x07d5('0x5f')][_0x07d5('0xab')]});})[_0x07d5('0x24')](function(_0x55d1a4){_0x57b782[_0x07d5('0x2d')]=_0x55d1a4;if(_0x57b782[_0x07d5('0xa4')][_0x07d5('0xac')]){return db[_0x07d5('0xad')]['find']({'attributes':['id',_0x07d5('0x40')],'where':{'id':_0x57b782[_0x07d5('0xa4')][_0x07d5('0xac')]}})[_0x07d5('0x24')](function(_0x4349e4){if(_0x4349e4){_0x57b782[_0x07d5('0x83')][_0x07d5('0xae')]({'id':0x0,'priority':0x0,'app':_0x07d5('0xaf'),'appdata':_0x4349e4['name']+','+(_0x57b782[_0x07d5('0x87')]['waitForTheAssignedAgent']||0xa),'interval':_0x07d5('0xaa')});}return respondWithRpcPromise(_0x07d5('0xb0'),_0x07d5('0xb1'),_0x57b782);});}return respondWithRpcPromise(_0x07d5('0xb0'),'startRouting',_0x57b782);})[_0x07d5('0x24')](function(_0x1450a3){if(_0x1450a3){var _0x5be05e=0xc8;var _0x58d274=_0x07d5('0xb2');logger[_0x07d5('0x25')](_0x07d5('0x29'),_0x58d274,_0x5be05e,_0x07d5('0xb3'));logger[_0x07d5('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x58d274,_0x5be05e,_0x07d5('0xb3'),JSON[_0x07d5('0x2a')](_0x1450a3));if(_0x57b782[_0x07d5('0x87')]['type']===_0x07d5('0x92')){return _0x24843a['status'](_0x5be05e)['set'](_0x07d5('0xb4'),_0x07d5('0xb5'))['send'](_0x07d5('0xb6'));}else{return _0x24843a[_0x07d5('0x31')](_0x5be05e)[_0x07d5('0x32')](_0x1450a3);}}})[_0x07d5('0x2f')](handleError(_0x24843a,null));};exports[_0x07d5('0x41')]=function(_0x13d54e,_0x478a66,_0x3ee9f9){var _0x3d2ce7,_0x2e71a7,_0x5c64ea;if(_[_0x07d5('0x9a')](_0x13d54e['body']['body'])||_0x13d54e[_0x07d5('0x5f')][_0x07d5('0x5f')]===''){throw new db[(_0x07d5('0x89'))][(_0x07d5('0x8a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x07d5('0x9a')](_0x13d54e['body']['to'])){throw new db[(_0x07d5('0x89'))][(_0x07d5('0x8a'))](_0x07d5('0xb7'));}_0x3d2ce7=_0x13d54e['body']['to'];return db[_0x07d5('0x46')]['find']({'where':{'id':_0x13d54e[_0x07d5('0x5a')]['id']},'include':[{'model':db[_0x07d5('0x9e')],'as':_0x07d5('0xb8'),'include':[{'model':db['CmContact'],'as':_0x07d5('0x9f'),'where':{'mobile':_0x3d2ce7},'limit':0x1,'order':[[_0x07d5('0x8d'),_0x07d5('0xb9')]]}]}]})[_0x07d5('0x24')](handleEntityNotFound(_0x478a66,null))[_0x07d5('0x24')](function(_0x2e6e73){if(_0x2e6e73&&_0x2e6e73[_0x07d5('0xb8')]){_0x2e71a7=_0x2e6e73[_0x07d5('0x3c')]({'plain':!![]});if(_0x2e71a7[_0x07d5('0xb8')]&&_0x2e71a7[_0x07d5('0xb8')][_0x07d5('0x9f')][_0x07d5('0x4f')]){return _0x2e71a7[_0x07d5('0xb8')][_0x07d5('0x9f')][0x0];}return db[_0x07d5('0x88')]['create'](_[_0x07d5('0x1b')](_0x13d54e[_0x07d5('0x5f')],{'firstName':_0x3d2ce7,'mobile':_0x3d2ce7,'phone':_0x3d2ce7,'ListId':_0x2e71a7[_0x07d5('0x90')]}));}})[_0x07d5('0x24')](handleEntityNotFound(_0x478a66,null))[_0x07d5('0x24')](function(_0x1b3560){if(_0x1b3560){_0x5c64ea=_0x1b3560;return db[_0x07d5('0xa3')]['find']({'where':{'ContactId':_0x5c64ea['id'],'closed':![],'WhatsappAccountId':_0x2e71a7['id']}})[_0x07d5('0x24')](function(_0x56dabd){if(_0x56dabd){return[_0x56dabd,![]];}return db[_0x07d5('0xa3')][_0x07d5('0x5e')]({'UserId':_0x13d54e[_0x07d5('0x61')]['id'],'ContactId':_0x5c64ea['id'],'WhatsappAccountId':_0x2e71a7['id'],'phone':_0x3d2ce7,'firstMsgDirection':_0x07d5('0xba'),'Messages':[_[_0x07d5('0x57')](_0x13d54e[_0x07d5('0x5f')],{'read':![],'body':_0x13d54e[_0x07d5('0x5f')][_0x07d5('0x5f')],'phone':_0x3d2ce7,'WhatsappAccountId':_0x2e71a7['id'],'UserId':_0x13d54e[_0x07d5('0x61')]['id'],'ContactId':_0x5c64ea['id']})]},{'include':[{'model':db[_0x07d5('0xbb')],'as':'Messages'}]})[_0x07d5('0x24')](function(_0x4ba76a){return[_0x4ba76a,!![]];});});}})[_0x07d5('0x74')](function(_0x33fd8e,_0x38bc57){if(_0x38bc57){return _0x33fd8e;}return db[_0x07d5('0xbb')][_0x07d5('0x5e')](_['merge'](_0x13d54e[_0x07d5('0x5f')],{'read':![],'body':_0x13d54e[_0x07d5('0x5f')][_0x07d5('0x5f')],'phone':_0x3d2ce7,'WhatsappAccountId':_0x2e71a7['id'],'WhatsappInteractionId':_0x33fd8e['id'],'UserId':_0x13d54e[_0x07d5('0x61')]['id'],'ContactId':_0x5c64ea['id']}))[_0x07d5('0x24')](function(_0x48af49){_0x33fd8e[_0x07d5('0xbc')][_0x07d5('0xbd')]=[];_0x33fd8e[_0x07d5('0xbc')][_0x07d5('0xbd')]['push'](_0x48af49['dataValues']);return _0x33fd8e;});})[_0x07d5('0x24')](respondWithResult(_0x478a66,null))['catch'](handleError(_0x478a66,null));}; \ No newline at end of file +var _0xc499=['save','update','then','destroy','UserProfileResource','stack','name','send','mandatoryDispositionPause','WhatsappAccount','type','key','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','Pause','keys','rawAttributes','include','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','userProfileId','autoAssociation','body','describe','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','removeDispositions','WhatsappAccountId','CannedAnswer','getAnswers','pick','removeAnswers','ids','addAgents','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','whatsapp','Applications','applications','orderBy','asc','account','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','from','From','replace','whatsapp:','Body','MessageSid','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','defaults','contact','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','created','messageId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','entity\x20found','twilio','text/xml','\x0a','to\x20is\x20mandatory','List','out','WhatsappMessage','dataValues','Messages','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappAccount.socket','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject'];(function(_0x2d9f8f,_0x40bc79){var _0x240df4=function(_0x397d13){while(--_0x397d13){_0x2d9f8f['push'](_0x2d9f8f['shift']());}};_0x240df4(++_0x40bc79);}(_0xc499,0x85));var _0x9c49=function(_0x2a0bf0,_0x247ffd){_0x2a0bf0=_0x2a0bf0-0x0;var _0x104fd6=_0xc499[_0x2a0bf0];return _0x104fd6;};'use strict';var emlformat=require(_0x9c49('0x0'));var rimraf=require(_0x9c49('0x1'));var zipdir=require(_0x9c49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c49('0x3'));var moment=require(_0x9c49('0x4'));var BPromise=require(_0x9c49('0x5'));var Mustache=require(_0x9c49('0x6'));var util=require(_0x9c49('0x7'));var path=require(_0x9c49('0x8'));var sox=require(_0x9c49('0x9'));var csv=require(_0x9c49('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9c49('0xb'));var squel=require(_0x9c49('0xc'));var crypto=require(_0x9c49('0xd'));var jsforce=require(_0x9c49('0xe'));var deskjs=require(_0x9c49('0xf'));var toCsv=require(_0x9c49('0xa'));var querystring=require(_0x9c49('0x10'));var Papa=require(_0x9c49('0x11'));var Redis=require(_0x9c49('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9c49('0x13'));var as=require(_0x9c49('0x14'));var hardwareService=require(_0x9c49('0x15'));var logger=require(_0x9c49('0x16'))(_0x9c49('0x17'));var utils=require(_0x9c49('0x18'));var config=require(_0x9c49('0x19'));var licenseUtil=require(_0x9c49('0x1a'));var db=require(_0x9c49('0x1b'))['db'];config['redis']=_['defaults'](config[_0x9c49('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x9c49('0x1d'))(new Redis(config['redis']));require(_0x9c49('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x9c49('0x1f')][_0x9c49('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x2d679e,_0x237d5e,_0x1a4cf5,_0x445fb9){return new BPromise(function(_0x3af631,_0x47d1bd){var _0x4864ea=_0x445fb9||client;return _0x4864ea[_0x9c49('0x21')](_0x2d679e,_0x1a4cf5)['then'](function(_0x3138af){logger[_0x9c49('0x22')](_0x9c49('0x23'),_0x237d5e,_0x9c49('0x24'));logger[_0x9c49('0x25')](_0x9c49('0x26'),_0x237d5e,_0x9c49('0x24'),JSON[_0x9c49('0x27')](_0x3138af));if(_0x3138af[_0x9c49('0x28')]){if(_0x3138af[_0x9c49('0x28')][_0x9c49('0x29')]===0x1f4){logger[_0x9c49('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x237d5e,_0x3138af[_0x9c49('0x28')][_0x9c49('0x2a')]);return _0x47d1bd(_0x3138af[_0x9c49('0x28')][_0x9c49('0x2a')]);}logger['error'](_0x9c49('0x23'),_0x237d5e,_0x3138af[_0x9c49('0x28')][_0x9c49('0x2a')]);return _0x3af631(_0x3138af[_0x9c49('0x28')][_0x9c49('0x2a')]);}else{logger[_0x9c49('0x22')](_0x9c49('0x23'),_0x237d5e,'request\x20sent');_0x3af631(_0x3138af['result'][_0x9c49('0x2a')]);}})[_0x9c49('0x2b')](function(_0x9e31ae){logger[_0x9c49('0x28')](_0x9c49('0x23'),_0x237d5e,_0x9e31ae);_0x47d1bd(_0x9e31ae);});});}function respondWithStatusCode(_0x255eff,_0x48d830){_0x48d830=_0x48d830||0xcc;return function(_0x4efb36){if(_0x4efb36){return _0x255eff[_0x9c49('0x2c')](_0x48d830);}return _0x255eff['status'](_0x48d830)[_0x9c49('0x2d')]();};}function respondWithResult(_0x64d416,_0x99fe0e){_0x99fe0e=_0x99fe0e||0xc8;return function(_0x276ece){if(_0x276ece){return _0x64d416[_0x9c49('0x2e')](_0x99fe0e)['json'](_0x276ece);}};}function respondWithFilteredResult(_0x52d279,_0x47e5ec){return function(_0x2f3a6c){if(_0x2f3a6c){var _0x5dad79=typeof _0x47e5ec[_0x9c49('0x2f')]===_0x9c49('0x30')&&typeof _0x47e5ec[_0x9c49('0x31')]==='undefined';var _0x5e344a=_0x2f3a6c['count'];var _0x149c17=_0x5dad79?0x0:_0x47e5ec['offset'];var _0xf7a575=_0x5dad79?_0x2f3a6c[_0x9c49('0x32')]:_0x47e5ec[_0x9c49('0x2f')]+_0x47e5ec[_0x9c49('0x31')];var _0x4657e1;if(_0xf7a575>=_0x5e344a){_0xf7a575=_0x5e344a;_0x4657e1=0xc8;}else{_0x4657e1=0xce;}_0x52d279[_0x9c49('0x2e')](_0x4657e1);return _0x52d279[_0x9c49('0x33')](_0x9c49('0x34'),_0x149c17+'-'+_0xf7a575+'/'+_0x5e344a)[_0x9c49('0x35')](_0x2f3a6c);}return null;};}function patchUpdates(_0x7d3a23){return function(_0x41ef8a){try{jsonpatch['apply'](_0x41ef8a,_0x7d3a23,!![]);}catch(_0x61f3cc){return BPromise[_0x9c49('0x36')](_0x61f3cc);}return _0x41ef8a[_0x9c49('0x37')]();};}function saveUpdates(_0x2e25b2,_0x4acde1){return function(_0x17eb1e){if(_0x17eb1e){return _0x17eb1e[_0x9c49('0x38')](_0x2e25b2)[_0x9c49('0x39')](function(_0x178769){return _0x178769;});}return null;};}function removeEntity(_0x33fe35,_0x56b6e0){return function(_0x2d4d2f){if(_0x2d4d2f){return _0x2d4d2f[_0x9c49('0x3a')]()[_0x9c49('0x39')](function(){var _0x2e83b5=_0x2d4d2f['get']({'plain':!![]});var _0x3e2dc9='WhatsappAccounts';return db[_0x9c49('0x3b')]['destroy']({'where':{'type':_0x3e2dc9,'resourceId':_0x2e83b5['id']}})[_0x9c49('0x39')](function(){return _0x2d4d2f;});})[_0x9c49('0x39')](function(){_0x33fe35[_0x9c49('0x2e')](0xcc)[_0x9c49('0x2d')]();});}};}function handleEntityNotFound(_0x4b8446,_0x203b6d){return function(_0x26a075){if(!_0x26a075){_0x4b8446['sendStatus'](0x194);}return _0x26a075;};}function handleError(_0x4e9584,_0x128e2a){_0x128e2a=_0x128e2a||0x1f4;return function(_0x226258){logger[_0x9c49('0x28')](_0x226258[_0x9c49('0x3c')]);if(_0x226258[_0x9c49('0x3d')]){delete _0x226258[_0x9c49('0x3d')];}_0x4e9584[_0x9c49('0x2e')](_0x128e2a)[_0x9c49('0x3e')](_0x226258);};}exports['index']=function(_0x3aac77,_0xc37686){var _0x495cf5={'include':[{'model':db['Pause'],'as':_0x9c49('0x3f')}]},_0x38a857={},_0x44e007={'count':0x0,'rows':[]};var _0x2aa32e=_['map'](db[_0x9c49('0x40')]['rawAttributes'],function(_0x57263a){return{'name':_0x57263a['fieldName'],'type':_0x57263a[_0x9c49('0x41')][_0x9c49('0x42')]};});_0x38a857[_0x9c49('0x43')]=_[_0x9c49('0x44')](_0x2aa32e,_0x9c49('0x3d'));_0x38a857['query']=_['keys'](_0x3aac77[_0x9c49('0x45')]);_0x38a857[_0x9c49('0x46')]=_[_0x9c49('0x47')](_0x38a857[_0x9c49('0x43')],_0x38a857[_0x9c49('0x45')]);_0x495cf5[_0x9c49('0x48')]=_[_0x9c49('0x47')](_0x38a857[_0x9c49('0x43')],qs['fields'](_0x3aac77[_0x9c49('0x45')][_0x9c49('0x49')]));_0x495cf5[_0x9c49('0x48')]=_0x495cf5[_0x9c49('0x48')][_0x9c49('0x4a')]?_0x495cf5['attributes']:_0x38a857[_0x9c49('0x43')];if(!_0x3aac77[_0x9c49('0x45')]['hasOwnProperty']('nolimit')){_0x495cf5[_0x9c49('0x31')]=qs[_0x9c49('0x31')](_0x3aac77[_0x9c49('0x45')][_0x9c49('0x31')]);_0x495cf5['offset']=qs[_0x9c49('0x2f')](_0x3aac77[_0x9c49('0x45')][_0x9c49('0x2f')]);}_0x495cf5[_0x9c49('0x4b')]=qs[_0x9c49('0x4c')](_0x3aac77[_0x9c49('0x45')][_0x9c49('0x4c')]);_0x495cf5[_0x9c49('0x4d')]=qs[_0x9c49('0x46')](_['pick'](_0x3aac77[_0x9c49('0x45')],_0x38a857['filters']),_0x2aa32e);if(_0x3aac77['query'][_0x9c49('0x4e')]){_0x495cf5[_0x9c49('0x4d')]=_[_0x9c49('0x4f')](_0x495cf5[_0x9c49('0x4d')],{'$or':_[_0x9c49('0x44')](_0x2aa32e,function(_0x2f9bd7){if(_0x2f9bd7['type']!==_0x9c49('0x50')){var _0x177b87={};_0x177b87[_0x2f9bd7['name']]={'$like':'%'+_0x3aac77[_0x9c49('0x45')][_0x9c49('0x4e')]+'%'};return _0x177b87;}})});}_0x495cf5=_[_0x9c49('0x4f')]({},_0x495cf5,_0x3aac77['options']);var _0x2103ce={'where':_0x495cf5[_0x9c49('0x4d')]};return db[_0x9c49('0x40')][_0x9c49('0x32')](_0x2103ce)[_0x9c49('0x39')](function(_0x2104bf){_0x44e007['count']=_0x2104bf;if(_0x3aac77['query'][_0x9c49('0x51')]){_0x495cf5['include']=[{'all':!![]}];}return db[_0x9c49('0x40')][_0x9c49('0x52')](_0x495cf5);})[_0x9c49('0x39')](function(_0x39820f){_0x44e007[_0x9c49('0x53')]=_0x39820f;return _0x44e007;})[_0x9c49('0x39')](respondWithFilteredResult(_0xc37686,_0x495cf5))['catch'](handleError(_0xc37686,null));};exports[_0x9c49('0x54')]=function(_0x45ca5c,_0x21c13c){var _0x3e3550={'raw':![],'where':{'id':_0x45ca5c[_0x9c49('0x55')]['id']},'include':[{'model':db[_0x9c49('0x56')],'as':_0x9c49('0x3f')}]},_0x398198={};_0x398198[_0x9c49('0x43')]=_[_0x9c49('0x57')](db['WhatsappAccount'][_0x9c49('0x58')]);_0x398198[_0x9c49('0x45')]=_[_0x9c49('0x57')](_0x45ca5c[_0x9c49('0x45')]);_0x398198['filters']=_[_0x9c49('0x47')](_0x398198[_0x9c49('0x43')],_0x398198['query']);_0x3e3550[_0x9c49('0x48')]=_[_0x9c49('0x47')](_0x398198[_0x9c49('0x43')],qs[_0x9c49('0x49')](_0x45ca5c['query']['fields']));_0x3e3550[_0x9c49('0x48')]=_0x3e3550[_0x9c49('0x48')][_0x9c49('0x4a')]?_0x3e3550[_0x9c49('0x48')]:_0x398198['model'];if(_0x45ca5c['query'][_0x9c49('0x51')]){_0x3e3550[_0x9c49('0x59')]=[{'all':!![]}];}_0x3e3550=_[_0x9c49('0x4f')]({},_0x3e3550,_0x45ca5c[_0x9c49('0x5a')]);return db[_0x9c49('0x40')][_0x9c49('0x5b')](_0x3e3550)[_0x9c49('0x39')](handleEntityNotFound(_0x21c13c,null))['then'](respondWithResult(_0x21c13c,null))['catch'](handleError(_0x21c13c,null));};exports[_0x9c49('0x5c')]=function(_0x4ff765,_0x5951d8){return db['WhatsappAccount'][_0x9c49('0x5c')](_0x4ff765['body'],{})[_0x9c49('0x39')](function(_0x26afad){var _0x227d2d=_0x4ff765[_0x9c49('0x5d')][_0x9c49('0x5e')]({'plain':!![]});if(!_0x227d2d)throw new Error(_0x9c49('0x5f'));if(_0x227d2d[_0x9c49('0x60')]===_0x9c49('0x5d')){var _0x217860=_0x26afad[_0x9c49('0x5e')]({'plain':!![]});var _0x35c812=_0x9c49('0x61');return db['UserProfileSection'][_0x9c49('0x5b')]({'where':{'name':_0x35c812,'userProfileId':_0x227d2d[_0x9c49('0x62')]},'raw':!![]})['then'](function(_0x593f99){if(_0x593f99&&_0x593f99[_0x9c49('0x63')]===0x0){return db[_0x9c49('0x3b')]['create']({'name':_0x217860[_0x9c49('0x3d')],'resourceId':_0x217860['id'],'type':_0x593f99[_0x9c49('0x3d')],'sectionId':_0x593f99['id']},{})[_0x9c49('0x39')](function(){return _0x26afad;});}else{return _0x26afad;}})[_0x9c49('0x2b')](function(_0x2b5bb4){logger[_0x9c49('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b5bb4);throw _0x2b5bb4;});}return _0x26afad;})['then'](respondWithResult(_0x5951d8,0xc9))['catch'](handleError(_0x5951d8,null));};exports[_0x9c49('0x38')]=function(_0x30db05,_0x21f024){if(_0x30db05[_0x9c49('0x64')]['id']){delete _0x30db05[_0x9c49('0x64')]['id'];}return db[_0x9c49('0x40')][_0x9c49('0x5b')]({'where':{'id':_0x30db05[_0x9c49('0x55')]['id']},'include':[{'model':db[_0x9c49('0x56')],'as':_0x9c49('0x3f')}]})[_0x9c49('0x39')](handleEntityNotFound(_0x21f024,null))[_0x9c49('0x39')](saveUpdates(_0x30db05['body'],null))['then'](respondWithResult(_0x21f024,null))[_0x9c49('0x2b')](handleError(_0x21f024,null));};exports['destroy']=function(_0x46d093,_0xdb56ef){return db[_0x9c49('0x40')]['find']({'where':{'id':_0x46d093['params']['id']}})['then'](handleEntityNotFound(_0xdb56ef,null))[_0x9c49('0x39')](removeEntity(_0xdb56ef,null))['catch'](handleError(_0xdb56ef,null));};exports[_0x9c49('0x65')]=function(_0x2b4c8e,_0x55911d){return db[_0x9c49('0x40')]['describe']()[_0x9c49('0x39')](respondWithResult(_0x55911d,null))[_0x9c49('0x2b')](handleError(_0x55911d,null));};exports['addDisposition']=function(_0x110fba,_0x2a704b,_0x1993e2){if(_0x110fba[_0x9c49('0x64')]['id']){delete _0x110fba[_0x9c49('0x64')]['id'];}return db['WhatsappAccount'][_0x9c49('0x5b')]({'where':{'id':_0x110fba[_0x9c49('0x55')]['id']}})[_0x9c49('0x39')](handleEntityNotFound(_0x2a704b,null))['then'](function(_0x1e4def){if(_0x1e4def){_0x110fba[_0x9c49('0x64')]['WhatsappAccountId']=_0x1e4def['id'];return db[_0x9c49('0x66')][_0x9c49('0x5c')](_0x110fba[_0x9c49('0x64')]);}})[_0x9c49('0x39')](respondWithResult(_0x2a704b,null))[_0x9c49('0x2b')](handleError(_0x2a704b,null));};exports[_0x9c49('0x67')]=function(_0x1d58bd,_0x1d9207,_0x24d123){var _0x3d12f9={'raw':![],'where':{}};var _0x21e53d={};var _0x5b2fde={'count':0x0,'rows':[]};return db[_0x9c49('0x40')][_0x9c49('0x68')]({'where':{'id':_0x1d58bd[_0x9c49('0x55')]['id']}})[_0x9c49('0x39')](handleEntityNotFound(_0x1d9207,null))[_0x9c49('0x39')](function(_0x50652d){if(_0x50652d){_0x21e53d[_0x9c49('0x43')]=_[_0x9c49('0x57')](db[_0x9c49('0x66')][_0x9c49('0x58')]);_0x21e53d[_0x9c49('0x45')]=_[_0x9c49('0x57')](_0x1d58bd[_0x9c49('0x45')]);_0x21e53d[_0x9c49('0x46')]=_['intersection'](_0x21e53d[_0x9c49('0x43')],_0x21e53d[_0x9c49('0x45')]);_0x3d12f9[_0x9c49('0x48')]=_['intersection'](_0x21e53d['model'],qs[_0x9c49('0x49')](_0x1d58bd[_0x9c49('0x45')][_0x9c49('0x49')]));_0x3d12f9[_0x9c49('0x48')]=_0x3d12f9[_0x9c49('0x48')][_0x9c49('0x4a')]?_0x3d12f9[_0x9c49('0x48')]:_0x21e53d['model'];if(!_0x1d58bd[_0x9c49('0x45')][_0x9c49('0x69')](_0x9c49('0x6a'))){_0x3d12f9[_0x9c49('0x31')]=qs['limit'](_0x1d58bd[_0x9c49('0x45')][_0x9c49('0x31')]);_0x3d12f9[_0x9c49('0x2f')]=qs[_0x9c49('0x2f')](_0x1d58bd[_0x9c49('0x45')][_0x9c49('0x2f')]);}_0x3d12f9[_0x9c49('0x4b')]=qs['sort'](_0x1d58bd[_0x9c49('0x45')][_0x9c49('0x4c')]);_0x3d12f9[_0x9c49('0x4d')]=qs[_0x9c49('0x46')](_['pick'](_0x1d58bd['query'],_0x21e53d[_0x9c49('0x46')]));_0x3d12f9[_0x9c49('0x4d')]['WhatsappAccountId']=_0x50652d['id'];if(_0x1d58bd['query'][_0x9c49('0x4e')]){_0x3d12f9[_0x9c49('0x4d')]=_['merge'](_0x3d12f9[_0x9c49('0x4d')],{'$or':_[_0x9c49('0x44')](_0x3d12f9['attributes'],function(_0x1fdf11){var _0x540194={};_0x540194[_0x1fdf11]={'$like':'%'+_0x1d58bd[_0x9c49('0x45')][_0x9c49('0x4e')]+'%'};return _0x540194;})});}_0x3d12f9=_[_0x9c49('0x4f')]({},_0x3d12f9,_0x1d58bd[_0x9c49('0x5a')]);return db[_0x9c49('0x66')][_0x9c49('0x32')]({'where':_0x3d12f9[_0x9c49('0x4d')]})['then'](function(_0x4a1580){_0x5b2fde[_0x9c49('0x32')]=_0x4a1580;if(_0x1d58bd[_0x9c49('0x45')][_0x9c49('0x51')]){_0x3d12f9[_0x9c49('0x59')]=[{'all':!![]}];}return db[_0x9c49('0x66')]['findAll'](_0x3d12f9);})[_0x9c49('0x39')](function(_0x129e85){_0x5b2fde[_0x9c49('0x53')]=_0x129e85;return _0x5b2fde;});}})['then'](respondWithFilteredResult(_0x1d9207,_0x3d12f9))[_0x9c49('0x2b')](handleError(_0x1d9207,null));};exports[_0x9c49('0x6b')]=function(_0x2b52e2,_0x25cb64,_0x2e049a){return db[_0x9c49('0x40')][_0x9c49('0x5b')]({'where':{'id':_0x2b52e2['params']['id']}})[_0x9c49('0x39')](handleEntityNotFound(_0x25cb64,null))['then'](function(_0x59d987){if(_0x59d987){return _0x59d987[_0x9c49('0x6b')](_0x2b52e2[_0x9c49('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x25cb64,null))['catch'](handleError(_0x25cb64,null));};exports['addAnswer']=function(_0xe5e4bf,_0x3bd832,_0x5b9d3b){if(_0xe5e4bf[_0x9c49('0x64')]['id']){delete _0xe5e4bf[_0x9c49('0x64')]['id'];}return db['WhatsappAccount'][_0x9c49('0x5b')]({'where':{'id':_0xe5e4bf[_0x9c49('0x55')]['id']}})[_0x9c49('0x39')](handleEntityNotFound(_0x3bd832,null))[_0x9c49('0x39')](function(_0x3a0ea5){if(_0x3a0ea5){_0xe5e4bf[_0x9c49('0x64')][_0x9c49('0x6c')]=_0x3a0ea5['id'];return db[_0x9c49('0x6d')][_0x9c49('0x5c')](_0xe5e4bf[_0x9c49('0x64')]);}})[_0x9c49('0x39')](respondWithResult(_0x3bd832,null))[_0x9c49('0x2b')](handleError(_0x3bd832,null));};exports[_0x9c49('0x6e')]=function(_0x1b10a3,_0x59c45c,_0x48c1f1){var _0x87f5b={'raw':![],'where':{}};var _0x524a44={};var _0x38493d={'count':0x0,'rows':[]};return db[_0x9c49('0x40')][_0x9c49('0x68')]({'where':{'id':_0x1b10a3[_0x9c49('0x55')]['id']}})[_0x9c49('0x39')](handleEntityNotFound(_0x59c45c,null))[_0x9c49('0x39')](function(_0x2cd940){if(_0x2cd940){_0x524a44[_0x9c49('0x43')]=_[_0x9c49('0x57')](db['CannedAnswer']['rawAttributes']);_0x524a44[_0x9c49('0x45')]=_['keys'](_0x1b10a3[_0x9c49('0x45')]);_0x524a44[_0x9c49('0x46')]=_[_0x9c49('0x47')](_0x524a44[_0x9c49('0x43')],_0x524a44['query']);_0x87f5b[_0x9c49('0x48')]=_[_0x9c49('0x47')](_0x524a44[_0x9c49('0x43')],qs[_0x9c49('0x49')](_0x1b10a3[_0x9c49('0x45')][_0x9c49('0x49')]));_0x87f5b['attributes']=_0x87f5b[_0x9c49('0x48')][_0x9c49('0x4a')]?_0x87f5b['attributes']:_0x524a44[_0x9c49('0x43')];if(!_0x1b10a3[_0x9c49('0x45')][_0x9c49('0x69')](_0x9c49('0x6a'))){_0x87f5b['limit']=qs[_0x9c49('0x31')](_0x1b10a3[_0x9c49('0x45')][_0x9c49('0x31')]);_0x87f5b[_0x9c49('0x2f')]=qs[_0x9c49('0x2f')](_0x1b10a3[_0x9c49('0x45')]['offset']);}_0x87f5b[_0x9c49('0x4b')]=qs[_0x9c49('0x4c')](_0x1b10a3[_0x9c49('0x45')][_0x9c49('0x4c')]);_0x87f5b[_0x9c49('0x4d')]=qs[_0x9c49('0x46')](_[_0x9c49('0x6f')](_0x1b10a3[_0x9c49('0x45')],_0x524a44[_0x9c49('0x46')]));_0x87f5b[_0x9c49('0x4d')][_0x9c49('0x6c')]=_0x2cd940['id'];if(_0x1b10a3[_0x9c49('0x45')]['filter']){_0x87f5b[_0x9c49('0x4d')]=_[_0x9c49('0x4f')](_0x87f5b[_0x9c49('0x4d')],{'$or':_['map'](_0x87f5b[_0x9c49('0x48')],function(_0xc0ae8c){var _0x24d6ea={};_0x24d6ea[_0xc0ae8c]={'$like':'%'+_0x1b10a3[_0x9c49('0x45')][_0x9c49('0x4e')]+'%'};return _0x24d6ea;})});}_0x87f5b=_[_0x9c49('0x4f')]({},_0x87f5b,_0x1b10a3[_0x9c49('0x5a')]);return db[_0x9c49('0x6d')][_0x9c49('0x32')]({'where':_0x87f5b['where']})[_0x9c49('0x39')](function(_0x5c601c){_0x38493d[_0x9c49('0x32')]=_0x5c601c;if(_0x1b10a3[_0x9c49('0x45')][_0x9c49('0x51')]){_0x87f5b[_0x9c49('0x59')]=[{'all':!![]}];}return db[_0x9c49('0x6d')][_0x9c49('0x52')](_0x87f5b);})[_0x9c49('0x39')](function(_0x29dd1a){_0x38493d[_0x9c49('0x53')]=_0x29dd1a;return _0x38493d;});}})[_0x9c49('0x39')](respondWithFilteredResult(_0x59c45c,_0x87f5b))[_0x9c49('0x2b')](handleError(_0x59c45c,null));};exports[_0x9c49('0x70')]=function(_0x3c6ccb,_0x3cb954,_0x4d5111){return db[_0x9c49('0x40')][_0x9c49('0x5b')]({'where':{'id':_0x3c6ccb[_0x9c49('0x55')]['id']}})[_0x9c49('0x39')](handleEntityNotFound(_0x3cb954,null))[_0x9c49('0x39')](function(_0x172e4d){if(_0x172e4d){return _0x172e4d['removeAnswers'](_0x3c6ccb[_0x9c49('0x45')][_0x9c49('0x71')]);}})[_0x9c49('0x39')](respondWithStatusCode(_0x3cb954,null))[_0x9c49('0x2b')](handleError(_0x3cb954,null));};exports['addAgents']=function(_0x163f10,_0x3d0904,_0x39c244){return db[_0x9c49('0x40')][_0x9c49('0x5b')]({'where':{'id':_0x163f10[_0x9c49('0x55')]['id']}})[_0x9c49('0x39')](handleEntityNotFound(_0x3d0904,null))['then'](function(_0x2ad6d3){if(_0x2ad6d3){return _0x2ad6d3[_0x9c49('0x72')](_0x163f10[_0x9c49('0x64')]['ids'],_['omit'](_0x163f10[_0x9c49('0x64')],[_0x9c49('0x71'),'id'])||{})[_0x9c49('0x73')](function(_0xe7c7a5){for(var _0x27211f=0x0;_0x27211f<_0x163f10[_0x9c49('0x64')][_0x9c49('0x71')]['length'];_0x27211f+=0x1){socket[_0x9c49('0x74')]('userWhatsappAccount:save',{'UserId':_0x163f10[_0x9c49('0x64')][_0x9c49('0x71')][_0x27211f],'WhatsappAccountId':_0x163f10[_0x9c49('0x55')]['id']});}return _0xe7c7a5;});}})['then'](respondWithResult(_0x3d0904,null))[_0x9c49('0x2b')](handleError(_0x3d0904,null));};exports[_0x9c49('0x75')]=function(_0x35b19f,_0x4c39d6,_0x3c4afb){return db[_0x9c49('0x40')][_0x9c49('0x5b')]({'where':{'id':_0x35b19f[_0x9c49('0x55')]['id']}})[_0x9c49('0x39')](handleEntityNotFound(_0x4c39d6,null))[_0x9c49('0x39')](function(_0x23c7cc){if(_0x23c7cc){return _0x23c7cc[_0x9c49('0x75')](_0x35b19f[_0x9c49('0x45')][_0x9c49('0x71')])[_0x9c49('0x39')](function(){if(_[_0x9c49('0x76')](_0x35b19f[_0x9c49('0x45')]['ids'])){for(var _0xfde5f7=0x0;_0xfde5f7<_0x35b19f[_0x9c49('0x45')][_0x9c49('0x71')][_0x9c49('0x4a')];_0xfde5f7+=0x1){socket['emit'](_0x9c49('0x77'),{'UserId':Number(_0x35b19f[_0x9c49('0x45')][_0x9c49('0x71')][_0xfde5f7]),'WhatsappAccountId':Number(_0x35b19f[_0x9c49('0x55')]['id'])});}}else{socket[_0x9c49('0x74')](_0x9c49('0x77'),{'UserId':Number(_0x35b19f[_0x9c49('0x45')]['ids']),'WhatsappAccountId':Number(_0x35b19f[_0x9c49('0x55')]['id'])});}});}})[_0x9c49('0x39')](respondWithStatusCode(_0x4c39d6,null))[_0x9c49('0x2b')](handleError(_0x4c39d6,null));};exports[_0x9c49('0x78')]=function(_0x48521c,_0x19eb20,_0x54e0a4){var _0x3285d8={};var _0x3058ec={};var _0x377d12;var _0x5eb069;return db['WhatsappAccount'][_0x9c49('0x68')]({'where':{'id':_0x48521c[_0x9c49('0x55')]['id']}})['then'](handleEntityNotFound(_0x19eb20,null))[_0x9c49('0x39')](function(_0x35dd4d){if(_0x35dd4d){_0x377d12=_0x35dd4d;_0x3058ec[_0x9c49('0x43')]=_[_0x9c49('0x57')](db[_0x9c49('0x79')][_0x9c49('0x58')]);_0x3058ec['query']=_[_0x9c49('0x57')](_0x48521c['query']);_0x3058ec['filters']=_[_0x9c49('0x47')](_0x3058ec[_0x9c49('0x43')],_0x3058ec[_0x9c49('0x45')]);_0x3285d8[_0x9c49('0x48')]=_[_0x9c49('0x47')](_0x3058ec[_0x9c49('0x43')],qs[_0x9c49('0x49')](_0x48521c[_0x9c49('0x45')][_0x9c49('0x49')]));_0x3285d8[_0x9c49('0x48')]=_0x3285d8[_0x9c49('0x48')]['length']?_0x3285d8[_0x9c49('0x48')]:_0x3058ec[_0x9c49('0x43')];_0x3285d8['order']=qs['sort'](_0x48521c['query'][_0x9c49('0x4c')]);_0x3285d8[_0x9c49('0x4d')]=qs[_0x9c49('0x46')](_[_0x9c49('0x6f')](_0x48521c[_0x9c49('0x45')],_0x3058ec[_0x9c49('0x46')]));if(_0x48521c[_0x9c49('0x45')][_0x9c49('0x4e')]){_0x3285d8[_0x9c49('0x4d')]=_[_0x9c49('0x4f')](_0x3285d8['where'],{'$or':_[_0x9c49('0x44')](_0x3285d8[_0x9c49('0x48')],function(_0x293d97){var _0x1a6830={};_0x1a6830[_0x293d97]={'$like':'%'+_0x48521c['query'][_0x9c49('0x4e')]+'%'};return _0x1a6830;})});}_0x3285d8=_[_0x9c49('0x4f')]({},_0x3285d8,_0x48521c[_0x9c49('0x5a')]);return _0x377d12[_0x9c49('0x78')](_0x3285d8);}})['then'](function(_0x3e21d9){if(_0x3e21d9){_0x5eb069=_0x3e21d9[_0x9c49('0x4a')];if(!_0x48521c[_0x9c49('0x45')][_0x9c49('0x69')](_0x9c49('0x6a'))){_0x3285d8['limit']=qs[_0x9c49('0x31')](_0x48521c['query']['limit']);_0x3285d8[_0x9c49('0x2f')]=qs[_0x9c49('0x2f')](_0x48521c['query'][_0x9c49('0x2f')]);}return _0x377d12[_0x9c49('0x78')](_0x3285d8);}})[_0x9c49('0x39')](function(_0x1606fb){if(_0x1606fb){return _0x1606fb?{'count':_0x5eb069,'rows':_0x1606fb}:null;}})[_0x9c49('0x39')](respondWithResult(_0x19eb20,null))[_0x9c49('0x2b')](handleError(_0x19eb20,null));};exports[_0x9c49('0x7a')]=function(_0x120b7b,_0x4a57a7,_0x388432){return db[_0x9c49('0x40')][_0x9c49('0x68')]({'where':{'id':_0x120b7b['params']['id']}})[_0x9c49('0x39')](handleEntityNotFound(_0x4a57a7,null))[_0x9c49('0x39')](function(_0x3a226b){if(_0x3a226b){return db[_0x9c49('0x7b')]['transaction'](function(_0x510e17){return db[_0x9c49('0x7c')][_0x9c49('0x3a')]({'where':{'WhatsappAccountId':_0x120b7b[_0x9c49('0x55')]['id']},'transaction':_0x510e17})[_0x9c49('0x39')](function(_0x2fbe0b){var _0xfb0b84=_[_0x9c49('0x44')](_0x120b7b['body'],function(_0x2231d2){_0x2231d2['WhatsappAccountId']=_0x120b7b[_0x9c49('0x55')]['id'];return _0x2231d2;});return db['WhatsappApplication'][_0x9c49('0x7d')](_0xfb0b84,{'transaction':_0x510e17});});})[_0x9c49('0x39')](function(){return db[_0x9c49('0x7c')][_0x9c49('0x7e')]({'where':{'WhatsappAccountId':_0x120b7b[_0x9c49('0x55')]['id']},'order':_0x9c49('0x7f')});});}})[_0x9c49('0x39')](respondWithResult(_0x4a57a7,null))[_0x9c49('0x2b')](handleError(_0x4a57a7,null));};exports[_0x9c49('0x80')]=function(_0x39ede3,_0x4eec20,_0x279d93){var _0x237f1b={};var _0x1c2a60={};var _0x44226;var _0x265e38;return db['WhatsappAccount'][_0x9c49('0x68')]({'where':{'id':_0x39ede3[_0x9c49('0x55')]['id']}})[_0x9c49('0x39')](handleEntityNotFound(_0x4eec20,null))[_0x9c49('0x39')](function(_0x4fe803){if(_0x4fe803){_0x44226=_0x4fe803;_0x1c2a60['model']=_[_0x9c49('0x57')](db[_0x9c49('0x7c')][_0x9c49('0x58')]);_0x1c2a60[_0x9c49('0x45')]=_[_0x9c49('0x57')](_0x39ede3[_0x9c49('0x45')]);_0x1c2a60[_0x9c49('0x46')]=_[_0x9c49('0x47')](_0x1c2a60[_0x9c49('0x43')],_0x1c2a60[_0x9c49('0x45')]);_0x237f1b[_0x9c49('0x48')]=_[_0x9c49('0x47')](_0x1c2a60['model'],qs[_0x9c49('0x49')](_0x39ede3[_0x9c49('0x45')][_0x9c49('0x49')]));_0x237f1b['attributes']=_0x237f1b[_0x9c49('0x48')][_0x9c49('0x4a')]?_0x237f1b[_0x9c49('0x48')]:_0x1c2a60[_0x9c49('0x43')];_0x237f1b[_0x9c49('0x4b')]=qs['sort'](_0x39ede3['query']['sort']);_0x237f1b[_0x9c49('0x4d')]=qs[_0x9c49('0x46')](_[_0x9c49('0x6f')](_0x39ede3['query'],_0x1c2a60['filters']));if(_0x39ede3[_0x9c49('0x45')][_0x9c49('0x4e')]){_0x237f1b[_0x9c49('0x4d')]=_[_0x9c49('0x4f')](_0x237f1b['where'],{'$or':_['map'](_0x237f1b[_0x9c49('0x48')],function(_0x3de8be){var _0x1d9720={};_0x1d9720[_0x3de8be]={'$like':'%'+_0x39ede3[_0x9c49('0x45')][_0x9c49('0x4e')]+'%'};return _0x1d9720;})});}_0x237f1b=_[_0x9c49('0x4f')]({},_0x237f1b,_0x39ede3['options']);return _0x44226[_0x9c49('0x80')](_0x237f1b);}})[_0x9c49('0x39')](function(_0x3e0e94){if(_0x3e0e94){_0x265e38=_0x3e0e94[_0x9c49('0x4a')];if(!_0x39ede3[_0x9c49('0x45')]['hasOwnProperty'](_0x9c49('0x6a'))){_0x237f1b[_0x9c49('0x31')]=qs['limit'](_0x39ede3[_0x9c49('0x45')]['limit']);_0x237f1b[_0x9c49('0x2f')]=qs[_0x9c49('0x2f')](_0x39ede3[_0x9c49('0x45')][_0x9c49('0x2f')]);}return _0x44226[_0x9c49('0x80')](_0x237f1b);}})['then'](function(_0x1bd22b){if(_0x1bd22b){return _0x1bd22b?{'count':_0x265e38,'rows':_0x1bd22b}:null;}})[_0x9c49('0x39')](respondWithResult(_0x4eec20,null))[_0x9c49('0x2b')](handleError(_0x4eec20,null));};exports['notify']=function(_0x18dce9,_0x1682a7,_0x309e0c){var _0x4672fb={'channel':_0x9c49('0x81')};var _0x5f5c35=[];var _0x4b9c7a=[];var _0x3f8983={};return db[_0x9c49('0x40')][_0x9c49('0x5b')]({'where':{'id':_0x18dce9[_0x9c49('0x55')]['id']},'include':[{'model':db[_0x9c49('0x7c')],'as':_0x9c49('0x82')}]})[_0x9c49('0x39')](handleEntityNotFound(_0x1682a7,null))[_0x9c49('0x39')](function(_0x489262){_0x4672fb['account']=_0x489262;_0x4672fb[_0x9c49('0x83')]=_[_0x9c49('0x84')](_0x489262[_0x9c49('0x82')],[_0x9c49('0x7f')],[_0x9c49('0x85')]);if(_0x4672fb[_0x9c49('0x86')][_0x9c49('0x82')]){delete _0x4672fb[_0x9c49('0x86')][_0x9c49('0x82')];}return db[_0x9c49('0x87')][_0x9c49('0x65')]();})[_0x9c49('0x39')](function(_0x897638){if(!_0x897638){throw new db['Sequelize'][(_0x9c49('0x88'))](_0x9c49('0x89'));}_0x5f5c35=_['difference'](_[_0x9c49('0x57')](_0x897638),[_0x9c49('0x8a'),'updatedAt']);_0x4b9c7a=_['difference'](_[_0x9c49('0x57')](_0x897638),['createdAt',_0x9c49('0x8b'),_0x9c49('0x8c'),_0x9c49('0x8d')]);_0x4672fb['body']={'mapKey':'mobile'};if(_0x4672fb[_0x9c49('0x86')][_0x9c49('0x41')]&&_0x4672fb[_0x9c49('0x86')]['type']==='twilio'){_0x4672fb['body'][_0x9c49('0x8e')]=_0x18dce9[_0x9c49('0x64')][_0x9c49('0x8f')][_0x9c49('0x90')](_0x9c49('0x91'),'');_0x4672fb['body']['body']=_0x18dce9[_0x9c49('0x64')][_0x9c49('0x92')];_0x4672fb[_0x9c49('0x64')]['messageId']=_0x18dce9[_0x9c49('0x64')][_0x9c49('0x93')];}if(_0x4672fb[_0x9c49('0x64')]['id']){delete _0x4672fb[_0x9c49('0x64')]['id'];}if(_[_0x9c49('0x94')](_0x4672fb['body'][_0x9c49('0x8e')])){throw new db[(_0x9c49('0x95'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x4672fb['body'][_0x9c49('0x64')])||_0x4672fb[_0x9c49('0x64')]['body']===''){throw new db['Sequelize'][(_0x9c49('0x88'))](_0x9c49('0x96'));}if(_[_0x9c49('0x94')](_0x4672fb['body'][_0x9c49('0x97')])){throw new db['Sequelize'][(_0x9c49('0x88'))](_0x9c49('0x98')+_0x4b9c7a);}if(!_[_0x9c49('0x99')](_0x4b9c7a,_0x4672fb[_0x9c49('0x64')]['mapKey'])){throw new db[(_0x9c49('0x95'))]['ValidationError'](_0x9c49('0x9a')+_0x4b9c7a);}_0x3f8983[_0x4672fb[_0x9c49('0x64')][_0x9c49('0x97')]]=_0x4672fb[_0x9c49('0x64')][_0x9c49('0x8e')];return db[_0x9c49('0x9b')][_0x9c49('0x5b')]({'where':{'id':_0x4672fb[_0x9c49('0x86')][_0x9c49('0x8d')]},'include':[{'model':db[_0x9c49('0x87')],'as':'Contacts','where':_0x3f8983,'limit':0x1,'order':[['updatedAt',_0x9c49('0x9c')]]}]});})['then'](handleEntityNotFound(_0x1682a7,null))[_0x9c49('0x39')](function(_0x573aa6){if(_0x573aa6){_0x4672fb[_0x9c49('0x9d')]=_[_0x9c49('0x9e')](_0x573aa6,[_0x9c49('0x9f')]);if(_0x573aa6[_0x9c49('0x9f')][_0x9c49('0x4a')]){return _0x573aa6[_0x9c49('0x9f')][0x0];}var _0x31ba58=_[_0x9c49('0xa0')](_0x4672fb['body'],{'firstName':_0x4672fb[_0x9c49('0x64')][_0x9c49('0x8e')],'ListId':_0x573aa6['id']});_0x31ba58[_0x4672fb[_0x9c49('0x64')][_0x9c49('0x97')]]=_0x4672fb[_0x9c49('0x64')][_0x9c49('0x8e')];return db[_0x9c49('0x87')][_0x9c49('0x5c')](_0x31ba58,{'fields':_0x5f5c35,'raw':!![]});}})[_0x9c49('0x39')](handleEntityNotFound(_0x1682a7,null))[_0x9c49('0x39')](function(_0x4434e4){if(_0x4434e4){_0x4672fb[_0x9c49('0xa1')]=_0x4434e4;var _0x23dfa8={'ContactId':_0x4434e4['id'],'phone':_0x4672fb[_0x9c49('0x64')][_0x9c49('0x8e')],'WhatsappAccountId':_0x18dce9[_0x9c49('0x55')]['id']};var _0x584c09={'ContactId':_0x4434e4['id'],'WhatsappAccountId':_0x18dce9[_0x9c49('0x55')]['id'],'closed':![]};return db[_0x9c49('0xa2')][_0x9c49('0x5b')]({'where':_0x584c09})['then'](function(_0x4b31fa){if(_0x4b31fa){return[_0x4b31fa,![]];}return db[_0x9c49('0xa2')][_0x9c49('0x5c')](_0x23dfa8)[_0x9c49('0x39')](function(_0x35cc80){return[_0x35cc80,!![]];});});}})[_0x9c49('0x73')](function(_0x142744,_0x1b7b3a){_0x4672fb['interaction']=_0x142744[_0x9c49('0x5e')]({'plain':!![]});_0x4672fb[_0x9c49('0xa3')]['created']=![];if(_0x1b7b3a){if(_0x4672fb[_0x9c49('0x86')][_0x9c49('0xa4')]){_0x4672fb[_0x9c49('0x83')][_0x9c49('0xa5')]({'id':0x0,'priority':_0x4672fb[_0x9c49('0x83')][_0x9c49('0x4a')]+0x1,'app':_0x9c49('0xa6'),'appdata':_0x9c49('0xa7'),'interval':'*,*,*,*'});}_0x4672fb['interaction'][_0x9c49('0xa8')]=!![];}return db['WhatsappMessage'][_0x9c49('0x5c')]({'phone':_0x4672fb['body'][_0x9c49('0x8e')],'messageId':_0x4672fb[_0x9c49('0x64')][_0x9c49('0xa9')],'body':_0x4672fb[_0x9c49('0x64')][_0x9c49('0x64')],'WhatsappAccountId':_0x18dce9['params']['id'],'WhatsappInteractionId':_0x142744['id'],'direction':'in','ContactId':_0x142744['ContactId'],'AttachmentId':_0x4672fb[_0x9c49('0x64')][_0x9c49('0xaa')]});})[_0x9c49('0x39')](function(_0x1f6a34){_0x4672fb[_0x9c49('0x2a')]=_0x1f6a34;if(_0x4672fb[_0x9c49('0xa3')][_0x9c49('0xab')]){return db[_0x9c49('0x79')][_0x9c49('0x5b')]({'attributes':['id',_0x9c49('0x3d')],'where':{'id':_0x4672fb[_0x9c49('0xa3')][_0x9c49('0xab')]}})[_0x9c49('0x39')](function(_0x3ceedc){if(_0x3ceedc){_0x4672fb[_0x9c49('0x83')][_0x9c49('0xac')]({'id':0x0,'priority':0x0,'app':_0x9c49('0xad'),'appdata':_0x3ceedc['name']+','+(_0x4672fb[_0x9c49('0x86')][_0x9c49('0xae')]||0xa),'interval':_0x9c49('0xaf')});}return respondWithRpcPromise('Start',_0x9c49('0xb0'),_0x4672fb);});}return respondWithRpcPromise(_0x9c49('0xb1'),_0x9c49('0xb0'),_0x4672fb);})[_0x9c49('0x39')](function(_0x53252f){if(_0x53252f){var _0x3a7312=0xc8;var _0xccf366='receiveMessage';logger[_0x9c49('0x22')](_0x9c49('0x26'),_0xccf366,_0x3a7312,'entity\x20found');logger[_0x9c49('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xccf366,_0x3a7312,_0x9c49('0xb2'),JSON[_0x9c49('0x27')](_0x53252f));if(_0x4672fb[_0x9c49('0x86')]['type']===_0x9c49('0xb3')){return _0x1682a7[_0x9c49('0x2e')](_0x3a7312)['set']('Content-Type',_0x9c49('0xb4'))[_0x9c49('0x3e')](_0x9c49('0xb5'));}else{return _0x1682a7[_0x9c49('0x2e')](_0x3a7312)[_0x9c49('0x35')](_0x53252f);}}})['catch'](handleError(_0x1682a7,null));};exports[_0x9c49('0x3e')]=function(_0x5f14ac,_0x55a9ee,_0x319274){var _0x207839,_0x4035d2,_0x1a1722;if(_[_0x9c49('0x94')](_0x5f14ac['body']['body'])||_0x5f14ac[_0x9c49('0x64')][_0x9c49('0x64')]===''){throw new db[(_0x9c49('0x95'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9c49('0x94')](_0x5f14ac['body']['to'])){throw new db[(_0x9c49('0x95'))][(_0x9c49('0x88'))](_0x9c49('0xb6'));}_0x207839=_0x5f14ac[_0x9c49('0x64')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x5f14ac[_0x9c49('0x55')]['id']},'include':[{'model':db[_0x9c49('0x9b')],'as':_0x9c49('0xb7'),'include':[{'model':db[_0x9c49('0x87')],'as':_0x9c49('0x9f'),'where':{'mobile':_0x207839},'limit':0x1,'order':[[_0x9c49('0x8b'),_0x9c49('0x9c')]]}]}]})[_0x9c49('0x39')](handleEntityNotFound(_0x55a9ee,null))[_0x9c49('0x39')](function(_0xa78bcf){if(_0xa78bcf&&_0xa78bcf['List']){_0x4035d2=_0xa78bcf[_0x9c49('0x5e')]({'plain':!![]});if(_0x4035d2['List']&&_0x4035d2[_0x9c49('0xb7')][_0x9c49('0x9f')][_0x9c49('0x4a')]){return _0x4035d2[_0x9c49('0xb7')][_0x9c49('0x9f')][0x0];}return db['CmContact'][_0x9c49('0x5c')](_[_0x9c49('0xa0')](_0x5f14ac[_0x9c49('0x64')],{'firstName':_0x207839,'mobile':_0x207839,'phone':_0x207839,'ListId':_0x4035d2[_0x9c49('0x8d')]}));}})[_0x9c49('0x39')](handleEntityNotFound(_0x55a9ee,null))[_0x9c49('0x39')](function(_0x6a22ad){if(_0x6a22ad){_0x1a1722=_0x6a22ad;return db[_0x9c49('0xa2')][_0x9c49('0x5b')]({'where':{'ContactId':_0x1a1722['id'],'closed':![],'WhatsappAccountId':_0x4035d2['id']}})[_0x9c49('0x39')](function(_0x3ed17b){if(_0x3ed17b){return[_0x3ed17b,![]];}return db['WhatsappInteraction'][_0x9c49('0x5c')]({'UserId':_0x5f14ac[_0x9c49('0x5d')]['id'],'ContactId':_0x1a1722['id'],'WhatsappAccountId':_0x4035d2['id'],'phone':_0x207839,'firstMsgDirection':_0x9c49('0xb8'),'Messages':[_[_0x9c49('0x4f')](_0x5f14ac[_0x9c49('0x64')],{'read':![],'body':_0x5f14ac[_0x9c49('0x64')]['body'],'phone':_0x207839,'WhatsappAccountId':_0x4035d2['id'],'UserId':_0x5f14ac['user']['id'],'ContactId':_0x1a1722['id']})]},{'include':[{'model':db[_0x9c49('0xb9')],'as':'Messages'}]})['then'](function(_0x2058ce){return[_0x2058ce,!![]];});});}})[_0x9c49('0x73')](function(_0x519471,_0x1659a2){if(_0x1659a2){return _0x519471;}return db['WhatsappMessage'][_0x9c49('0x5c')](_[_0x9c49('0x4f')](_0x5f14ac[_0x9c49('0x64')],{'read':![],'body':_0x5f14ac[_0x9c49('0x64')][_0x9c49('0x64')],'phone':_0x207839,'WhatsappAccountId':_0x4035d2['id'],'WhatsappInteractionId':_0x519471['id'],'UserId':_0x5f14ac[_0x9c49('0x5d')]['id'],'ContactId':_0x1a1722['id']}))[_0x9c49('0x39')](function(_0x33b905){_0x519471[_0x9c49('0xba')]['Messages']=[];_0x519471[_0x9c49('0xba')][_0x9c49('0xbb')][_0x9c49('0xa5')](_0x33b905[_0x9c49('0xba')]);return _0x519471;});})[_0x9c49('0x39')](respondWithResult(_0x55a9ee,null))['catch'](handleError(_0x55a9ee,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index c0cea8f..90aff28 100644 --- a/server/api/whatsappAccount/whatsappAccount.events.js +++ b/server/api/whatsappAccount/whatsappAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53ec,0x192));var _0xc53e=function(_0x2c4260,_0x19882c){_0x2c4260=_0x2c4260-0x0;var _0x13972e=_0x53ec[_0x2c4260];return _0x13972e;};'use strict';var EventEmitter=require(_0xc53e('0x0'));var WhatsappAccount=require(_0xc53e('0x1'))['db'][_0xc53e('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xc53e('0x3')](0x0);var events={'afterCreate':_0xc53e('0x4'),'afterUpdate':_0xc53e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x266c42){return function(_0x4e954a,_0x2b90f6,_0x38033d){WhatsappAccountEvents['emit'](_0x266c42+':'+_0x4e954a['id'],_0x4e954a);WhatsappAccountEvents[_0xc53e('0x6')](_0x266c42,_0x4e954a);_0x38033d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xc53e('0x7')](e,emitEvent(event));}}module[_0xc53e('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x964b=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x16662e,_0x1d622f){var _0x2bca33=function(_0x11627d){while(--_0x11627d){_0x16662e['push'](_0x16662e['shift']());}};_0x2bca33(++_0x1d622f);}(_0x964b,0x112));var _0xb964=function(_0x49decb,_0x1b04ff){_0x49decb=_0x49decb-0x0;var _0x106ada=_0x964b[_0x49decb];return _0x106ada;};'use strict';var EventEmitter=require(_0xb964('0x0'));var WhatsappAccount=require(_0xb964('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xb964('0x2')](0x0);var events={'afterCreate':_0xb964('0x3'),'afterUpdate':_0xb964('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5c4f01){return function(_0x2c4686,_0x48b771,_0x4760b2){WhatsappAccountEvents[_0xb964('0x5')](_0x5c4f01+':'+_0x2c4686['id'],_0x2c4686);WhatsappAccountEvents[_0xb964('0x5')](_0x5c4f01,_0x2c4686);_0x4760b2(null);};}for(var e in events){if(events[_0xb964('0x6')](e)){var event=events[e];WhatsappAccount[_0xb964('0x7')](e,emitEvent(event));}}module[_0xb964('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index d9f470d..d4777c2 100644 --- a/server/api/whatsappAccount/whatsappAccount.model.js +++ b/server/api/whatsappAccount/whatsappAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x577a=['whatsapp_accounts','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','WhatsappAccount'];(function(_0x33c618,_0xa8cec4){var _0x2e97e3=function(_0x3ccb98){while(--_0x3ccb98){_0x33c618['push'](_0x33c618['shift']());}};_0x2e97e3(++_0xa8cec4);}(_0x577a,0x1e5));var _0xa577=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x577a[_0x36ed48];return _0x51c63a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa577('0x0'))(_0xa577('0x1'));var moment=require(_0xa577('0x2'));var BPromise=require(_0xa577('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa577('0x4'));var rimraf=require(_0xa577('0x5'));var config=require(_0xa577('0x6'));var attributes=require(_0xa577('0x7'));module[_0xa577('0x8')]=function(_0x5d6ffb,_0x58066c){return _0x5d6ffb['define'](_0xa577('0x9'),attributes,{'tableName':_0xa577('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d8f=['define','whatsapp_accounts','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes'];(function(_0x594c6d,_0x4d984f){var _0x522757=function(_0x4ec408){while(--_0x4ec408){_0x594c6d['push'](_0x594c6d['shift']());}};_0x522757(++_0x4d984f);}(_0x4d8f,0xd3));var _0xf4d8=function(_0x29a606,_0xbff75b){_0x29a606=_0x29a606-0x0;var _0xbb4c22=_0x4d8f[_0x29a606];return _0xbb4c22;};'use strict';var _=require(_0xf4d8('0x0'));var util=require(_0xf4d8('0x1'));var logger=require(_0xf4d8('0x2'))('api');var moment=require(_0xf4d8('0x3'));var BPromise=require('bluebird');var rp=require(_0xf4d8('0x4'));var fs=require('fs');var path=require(_0xf4d8('0x5'));var rimraf=require(_0xf4d8('0x6'));var config=require(_0xf4d8('0x7'));var attributes=require(_0xf4d8('0x8'));module['exports']=function(_0x4311e2,_0x2af756){return _0x4311e2[_0xf4d8('0x9')]('WhatsappAccount',attributes,{'tableName':_0xf4d8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 058e03f..fc2c452 100644 --- a/server/api/whatsappAccount/whatsappAccount.rpc.js +++ b/server/api/whatsappAccount/whatsappAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc593=['raw','where','include','map','model','attributes','then','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ShowWhatsappAccount','find','options'];(function(_0xa8d427,_0x5afb5b){var _0x5a0ef7=function(_0xb56427){while(--_0xb56427){_0xa8d427['push'](_0xa8d427['shift']());}};_0x5a0ef7(++_0x5afb5b);}(_0xc593,0xfd));var _0x3c59=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc593[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x3c59('0x0'));var util=require(_0x3c59('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3c59('0x2'));var fs=require('fs');var Redis=require(_0x3c59('0x3'));var db=require(_0x3c59('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3c59('0x5'))(_0x3c59('0x6'));var config=require(_0x3c59('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3c59('0x8')][_0x3c59('0x9')]({'port':0x232a});config[_0x3c59('0xa')]=_['defaults'](config[_0x3c59('0xa')],{'host':_0x3c59('0xb'),'port':0x18eb});var socket=require(_0x3c59('0xc'))(new Redis(config[_0x3c59('0xa')]));require(_0x3c59('0xd'))[_0x3c59('0xe')](socket);function respondWithRpcPromise(_0x4ae3fa,_0x157db9,_0x53ee3a){return new BPromise(function(_0x37c0a0,_0x2be437){return client[_0x3c59('0xf')](_0x4ae3fa,_0x53ee3a)['then'](function(_0x1d55f0){logger[_0x3c59('0x10')](_0x3c59('0x11'),_0x157db9,_0x3c59('0x12'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x157db9,_0x3c59('0x12'),JSON[_0x3c59('0x13')](_0x1d55f0));if(_0x1d55f0[_0x3c59('0x14')]){if(_0x1d55f0[_0x3c59('0x14')][_0x3c59('0x15')]===0x1f4){logger[_0x3c59('0x14')](_0x3c59('0x11'),_0x157db9,_0x1d55f0[_0x3c59('0x14')][_0x3c59('0x16')]);return _0x2be437(_0x1d55f0[_0x3c59('0x14')][_0x3c59('0x16')]);}logger[_0x3c59('0x14')](_0x3c59('0x11'),_0x157db9,_0x1d55f0['error']['message']);return _0x37c0a0(_0x1d55f0[_0x3c59('0x14')][_0x3c59('0x16')]);}else{logger['info'](_0x3c59('0x11'),_0x157db9,_0x3c59('0x12'));_0x37c0a0(_0x1d55f0['result'][_0x3c59('0x16')]);}})[_0x3c59('0x17')](function(_0x46bdc3){logger[_0x3c59('0x14')](_0x3c59('0x11'),_0x157db9,_0x46bdc3);_0x2be437(_0x46bdc3);});});}exports[_0x3c59('0x18')]=function(_0x312b79){var _0x5cbc57=this;return new Promise(function(_0x551b1d,_0x4a1b64){return db['WhatsappAccount'][_0x3c59('0x19')]({'raw':_0x312b79[_0x3c59('0x1a')]?_0x312b79['options'][_0x3c59('0x1b')]===undefined?!![]:![]:!![],'where':_0x312b79[_0x3c59('0x1a')]?_0x312b79[_0x3c59('0x1a')][_0x3c59('0x1c')]||null:null,'attributes':_0x312b79[_0x3c59('0x1a')]?_0x312b79['options']['attributes']||null:null,'include':_0x312b79['options']?_0x312b79[_0x3c59('0x1a')][_0x3c59('0x1d')]?_[_0x3c59('0x1e')](_0x312b79[_0x3c59('0x1a')][_0x3c59('0x1d')],function(_0x107ece){return{'model':db[_0x107ece[_0x3c59('0x1f')]],'as':_0x107ece['as'],'attributes':_0x107ece[_0x3c59('0x20')],'include':_0x107ece[_0x3c59('0x1d')]?_[_0x3c59('0x1e')](_0x107ece['include'],function(_0x219e3e){return{'model':db[_0x219e3e[_0x3c59('0x1f')]],'as':_0x219e3e['as'],'attributes':_0x219e3e['attributes'],'include':_0x219e3e[_0x3c59('0x1d')]?_[_0x3c59('0x1e')](_0x219e3e['include'],function(_0xeb632){return{'model':db[_0xeb632[_0x3c59('0x1f')]],'as':_0xeb632['as'],'attributes':_0xeb632[_0x3c59('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3c59('0x21')](function(_0x3c3687){logger[_0x3c59('0x10')](_0x3c59('0x18'),_0x312b79);logger[_0x3c59('0x22')](_0x3c59('0x18'),_0x312b79,JSON[_0x3c59('0x13')](_0x3c3687));_0x551b1d(_0x3c3687);})['catch'](function(_0x35cabd){logger[_0x3c59('0x14')](_0x3c59('0x18'),_0x35cabd['message'],_0x312b79);_0x4a1b64(_0x5cbc57[_0x3c59('0x14')](0x1f4,_0x35cabd[_0x3c59('0x16')]));});});}; \ No newline at end of file +var _0xc0c7=['result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','include','map','model','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','request','then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message'];(function(_0x27dfae,_0x50c65a){var _0x57992f=function(_0x3ab74a){while(--_0x3ab74a){_0x27dfae['push'](_0x27dfae['shift']());}};_0x57992f(++_0x50c65a);}(_0xc0c7,0x115));var _0x7c0c=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc0c7[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0x7c0c('0x0'));var util=require(_0x7c0c('0x1'));var moment=require(_0x7c0c('0x2'));var BPromise=require('bluebird');var rs=require(_0x7c0c('0x3'));var fs=require('fs');var Redis=require(_0x7c0c('0x4'));var db=require(_0x7c0c('0x5'))['db'];var utils=require(_0x7c0c('0x6'));var logger=require('../../config/logger')(_0x7c0c('0x7'));var config=require(_0x7c0c('0x8'));var jayson=require(_0x7c0c('0x9'));var client=jayson[_0x7c0c('0xa')][_0x7c0c('0xb')]({'port':0x232a});config['redis']=_[_0x7c0c('0xc')](config[_0x7c0c('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x7c0c('0xe'))(new Redis(config[_0x7c0c('0xd')]));require('./whatsappAccount.socket')[_0x7c0c('0xf')](socket);function respondWithRpcPromise(_0x22ec39,_0x3787eb,_0x49f355){return new BPromise(function(_0x413bcd,_0x4fa0ec){return client[_0x7c0c('0x10')](_0x22ec39,_0x49f355)[_0x7c0c('0x11')](function(_0x11c216){logger[_0x7c0c('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x3787eb,'request\x20sent');logger[_0x7c0c('0x13')](_0x7c0c('0x14'),_0x3787eb,_0x7c0c('0x15'),JSON[_0x7c0c('0x16')](_0x11c216));if(_0x11c216[_0x7c0c('0x17')]){if(_0x11c216[_0x7c0c('0x17')][_0x7c0c('0x18')]===0x1f4){logger[_0x7c0c('0x17')](_0x7c0c('0x19'),_0x3787eb,_0x11c216[_0x7c0c('0x17')]['message']);return _0x4fa0ec(_0x11c216[_0x7c0c('0x17')][_0x7c0c('0x1a')]);}logger[_0x7c0c('0x17')](_0x7c0c('0x19'),_0x3787eb,_0x11c216['error'][_0x7c0c('0x1a')]);return _0x413bcd(_0x11c216[_0x7c0c('0x17')]['message']);}else{logger[_0x7c0c('0x12')](_0x7c0c('0x19'),_0x3787eb,'request\x20sent');_0x413bcd(_0x11c216[_0x7c0c('0x1b')][_0x7c0c('0x1a')]);}})[_0x7c0c('0x1c')](function(_0x419007){logger[_0x7c0c('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x3787eb,_0x419007);_0x4fa0ec(_0x419007);});});}exports[_0x7c0c('0x1d')]=function(_0x1afe8b){var _0x5746b3=this;return new Promise(function(_0x3061eb,_0x3b95c8){return db[_0x7c0c('0x1e')]['find']({'raw':_0x1afe8b[_0x7c0c('0x1f')]?_0x1afe8b[_0x7c0c('0x1f')][_0x7c0c('0x20')]===undefined?!![]:![]:!![],'where':_0x1afe8b[_0x7c0c('0x1f')]?_0x1afe8b[_0x7c0c('0x1f')][_0x7c0c('0x21')]||null:null,'attributes':_0x1afe8b['options']?_0x1afe8b['options']['attributes']||null:null,'include':_0x1afe8b['options']?_0x1afe8b[_0x7c0c('0x1f')][_0x7c0c('0x22')]?_[_0x7c0c('0x23')](_0x1afe8b[_0x7c0c('0x1f')][_0x7c0c('0x22')],function(_0x14f854){return{'model':db[_0x14f854[_0x7c0c('0x24')]],'as':_0x14f854['as'],'attributes':_0x14f854['attributes'],'include':_0x14f854[_0x7c0c('0x22')]?_[_0x7c0c('0x23')](_0x14f854[_0x7c0c('0x22')],function(_0x452141){return{'model':db[_0x452141[_0x7c0c('0x24')]],'as':_0x452141['as'],'attributes':_0x452141[_0x7c0c('0x25')],'include':_0x452141[_0x7c0c('0x22')]?_[_0x7c0c('0x23')](_0x452141['include'],function(_0x30c55c){return{'model':db[_0x30c55c['model']],'as':_0x30c55c['as'],'attributes':_0x30c55c[_0x7c0c('0x25')]};}):[]};}):[]};}):[]:[]})[_0x7c0c('0x11')](function(_0x331fdb){logger['info']('ShowWhatsappAccount',_0x1afe8b);logger[_0x7c0c('0x13')](_0x7c0c('0x1d'),_0x1afe8b,JSON[_0x7c0c('0x16')](_0x331fdb));_0x3061eb(_0x331fdb);})[_0x7c0c('0x1c')](function(_0x568d6c){logger[_0x7c0c('0x17')]('ShowWhatsappAccount',_0x568d6c[_0x7c0c('0x1a')],_0x1afe8b);_0x3b95c8(_0x5746b3[_0x7c0c('0x17')](0x1f4,_0x568d6c['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 2ffcf09..6f462a6 100644 --- a/server/api/whatsappAccount/whatsappAccount.socket.js +++ b/server/api/whatsappAccount/whatsappAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x135b=['length','./whatsappAccount.events','save','update','emit','removeListener','register'];(function(_0x43b01f,_0xc784fd){var _0xbbd9f8=function(_0x342c6e){while(--_0x342c6e){_0x43b01f['push'](_0x43b01f['shift']());}};_0xbbd9f8(++_0xc784fd);}(_0x135b,0x1e4));var _0xb135=function(_0x345ac6,_0x43a5de){_0x345ac6=_0x345ac6-0x0;var _0x4c6fe6=_0x135b[_0x345ac6];return _0x4c6fe6;};'use strict';var WhatsappAccountEvents=require(_0xb135('0x0'));var events=[_0xb135('0x1'),'remove',_0xb135('0x2')];function createListener(_0x5dc969,_0x5d3bf2){return function(_0x52f299){_0x5d3bf2[_0xb135('0x3')](_0x5dc969,_0x52f299);};}function removeListener(_0x3abf88,_0x52fdbd){return function(){WhatsappAccountEvents[_0xb135('0x4')](_0x3abf88,_0x52fdbd);};}exports[_0xb135('0x5')]=function(_0x403ac7){for(var _0x2a6a8a=0x0,_0x4af704=events[_0xb135('0x6')];_0x2a6a8a<_0x4af704;_0x2a6a8a++){var _0xf8bb1f=events[_0x2a6a8a];var _0x2f4e3a=createListener('whatsappAccount:'+_0xf8bb1f,_0x403ac7);WhatsappAccountEvents['on'](_0xf8bb1f,_0x2f4e3a);}}; \ No newline at end of file +var _0xa587=['emit','length','whatsappAccount:','./whatsappAccount.events','save','remove','update'];(function(_0x1fd703,_0x31e4ef){var _0x112d62=function(_0x28054f){while(--_0x28054f){_0x1fd703['push'](_0x1fd703['shift']());}};_0x112d62(++_0x31e4ef);}(_0xa587,0x192));var _0x7a58=function(_0x271707,_0x447aaf){_0x271707=_0x271707-0x0;var _0x303537=_0xa587[_0x271707];return _0x303537;};'use strict';var WhatsappAccountEvents=require(_0x7a58('0x0'));var events=[_0x7a58('0x1'),_0x7a58('0x2'),_0x7a58('0x3')];function createListener(_0x15538e,_0x4756c4){return function(_0x3b70d9){_0x4756c4[_0x7a58('0x4')](_0x15538e,_0x3b70d9);};}function removeListener(_0x4ba257,_0x195a78){return function(){WhatsappAccountEvents['removeListener'](_0x4ba257,_0x195a78);};}exports['register']=function(_0x25d02a){for(var _0x3c3023=0x0,_0xb277e4=events[_0x7a58('0x5')];_0x3c3023<_0xb277e4;_0x3c3023++){var _0xd3abe2=events[_0x3c3023];var _0x34779e=createListener(_0x7a58('0x6')+_0xd3abe2,_0x25d02a);WhatsappAccountEvents['on'](_0xd3abe2,_0x34779e);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 7ac3f60..9ef0bd1 100644 --- a/server/api/whatsappApplication/index.js +++ b/server/api/whatsappApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x26b4=['post','create','put','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id','show'];(function(_0xf628a4,_0x60f49){var _0x80b787=function(_0x426941){while(--_0x426941){_0xf628a4['push'](_0xf628a4['shift']());}};_0x80b787(++_0x60f49);}(_0x26b4,0xa7));var _0x426b=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x26b4[_0x1203f];return _0x365f0a;};'use strict';var multer=require(_0x426b('0x0'));var util=require('util');var path=require(_0x426b('0x1'));var timeout=require(_0x426b('0x2'));var express=require('express');var router=express[_0x426b('0x3')]();var fs_extra=require(_0x426b('0x4'));var auth=require(_0x426b('0x5'));var interaction=require(_0x426b('0x6'));var config=require(_0x426b('0x7'));var controller=require(_0x426b('0x8'));router[_0x426b('0x9')]('/',auth[_0x426b('0xa')](),controller['index']);router['get'](_0x426b('0xb'),auth[_0x426b('0xa')](),controller[_0x426b('0xc')]);router[_0x426b('0xd')]('/',auth[_0x426b('0xa')](),controller[_0x426b('0xe')]);router[_0x426b('0xf')](_0x426b('0xb'),auth[_0x426b('0xa')](),controller['update']);router['delete'](_0x426b('0xb'),auth['isAuthenticated'](),controller[_0x426b('0x10')]);module[_0x426b('0x11')]=router; \ No newline at end of file +var _0x134f=['/:id','show','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','index'];(function(_0x28ad8b,_0x47975a){var _0x30d0b9=function(_0xa859a5){while(--_0xa859a5){_0x28ad8b['push'](_0x28ad8b['shift']());}};_0x30d0b9(++_0x47975a);}(_0x134f,0xa0));var _0xf134=function(_0x49efc3,_0x2de846){_0x49efc3=_0x49efc3-0x0;var _0xabe06=_0x134f[_0x49efc3];return _0xabe06;};'use strict';var multer=require(_0xf134('0x0'));var util=require(_0xf134('0x1'));var path=require('path');var timeout=require(_0xf134('0x2'));var express=require('express');var router=express[_0xf134('0x3')]();var fs_extra=require(_0xf134('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf134('0x5'));var config=require('../../config/environment');var controller=require(_0xf134('0x6'));router[_0xf134('0x7')]('/',auth[_0xf134('0x8')](),controller[_0xf134('0x9')]);router[_0xf134('0x7')](_0xf134('0xa'),auth['isAuthenticated'](),controller[_0xf134('0xb')]);router['post']('/',auth[_0xf134('0x8')](),controller[_0xf134('0xc')]);router[_0xf134('0xd')](_0xf134('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xf134('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xf134('0xf')]);module[_0xf134('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index f2b77cd..d01c27a 100644 --- a/server/api/whatsappApplication/whatsappApplication.attributes.js +++ b/server/api/whatsappApplication/whatsappApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee66=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xee66,0x1b3));var _0x6ee6=function(_0x4a04de,_0x2e342c){_0x4a04de=_0x4a04de-0x0;var _0xbbe018=_0xee66[_0x4a04de];return _0xbbe018;};'use strict';var Sequelize=require(_0x6ee6('0x0'));module[_0x6ee6('0x1')]={'priority':{'type':Sequelize[_0x6ee6('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6ee6('0x3')],'allowNull':![],'defaultValue':_0x6ee6('0x4')},'appdata':{'type':Sequelize[_0x6ee6('0x5')]()},'description':{'type':Sequelize[_0x6ee6('0x3')]},'interval':{'type':Sequelize[_0x6ee6('0x3')],'defaultValue':_0x6ee6('0x6')}}; \ No newline at end of file +var _0x5de5=['INTEGER','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x5ac1f0,_0x557b2c){var _0x3b98a6=function(_0x45873c){while(--_0x45873c){_0x5ac1f0['push'](_0x5ac1f0['shift']());}};_0x3b98a6(++_0x557b2c);}(_0x5de5,0x12a));var _0x55de=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5de5[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x55de('0x0'));module[_0x55de('0x1')]={'priority':{'type':Sequelize[_0x55de('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x55de('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x55de('0x4')],'defaultValue':_0x55de('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 74ec608..e77c5a3 100644 --- a/server/api/whatsappApplication/whatsappApplication.controller.js +++ b/server/api/whatsappApplication/whatsappApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e5e=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','WhatsappApplication','type','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','catch','show','params','include','options','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb'];(function(_0x2d625a,_0x5a6254){var _0x14fd4=function(_0x33e926){while(--_0x33e926){_0x2d625a['push'](_0x2d625a['shift']());}};_0x14fd4(++_0x5a6254);}(_0x9e5e,0x1e2));var _0xe9e5=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x9e5e[_0x476bf4];return _0x788ffe;};'use strict';var emlformat=require(_0xe9e5('0x0'));var rimraf=require(_0xe9e5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9e5('0x2'));var rp=require(_0xe9e5('0x3'));var moment=require(_0xe9e5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe9e5('0x5'));var util=require('util');var path=require(_0xe9e5('0x6'));var sox=require(_0xe9e5('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9e5('0x8'));var _=require(_0xe9e5('0x9'));var squel=require('squel');var crypto=require(_0xe9e5('0xa'));var jsforce=require(_0xe9e5('0xb'));var deskjs=require(_0xe9e5('0xc'));var toCsv=require(_0xe9e5('0xd'));var querystring=require(_0xe9e5('0xe'));var Papa=require(_0xe9e5('0xf'));var Redis=require(_0xe9e5('0x10'));var authService=require(_0xe9e5('0x11'));var qs=require(_0xe9e5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9e5('0x13'));var logger=require(_0xe9e5('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe9e5('0x15'))['db'];function respondWithStatusCode(_0x145c5f,_0x42dcba){_0x42dcba=_0x42dcba||0xcc;return function(_0x272b49){if(_0x272b49){return _0x145c5f[_0xe9e5('0x16')](_0x42dcba);}return _0x145c5f[_0xe9e5('0x17')](_0x42dcba)[_0xe9e5('0x18')]();};}function respondWithResult(_0x3bfbab,_0x3097da){_0x3097da=_0x3097da||0xc8;return function(_0xfe19e8){if(_0xfe19e8){return _0x3bfbab['status'](_0x3097da)[_0xe9e5('0x19')](_0xfe19e8);}};}function respondWithFilteredResult(_0xd07ceb,_0x35c830){return function(_0x3f0990){if(_0x3f0990){var _0x17990d=typeof _0x35c830[_0xe9e5('0x1a')]===_0xe9e5('0x1b')&&typeof _0x35c830[_0xe9e5('0x1c')]===_0xe9e5('0x1b');var _0x129228=_0x3f0990['count'];var _0x2df941=_0x17990d?0x0:_0x35c830[_0xe9e5('0x1a')];var _0x146c1f=_0x17990d?_0x3f0990[_0xe9e5('0x1d')]:_0x35c830[_0xe9e5('0x1a')]+_0x35c830[_0xe9e5('0x1c')];var _0x3855d9;if(_0x146c1f>=_0x129228){_0x146c1f=_0x129228;_0x3855d9=0xc8;}else{_0x3855d9=0xce;}_0xd07ceb[_0xe9e5('0x17')](_0x3855d9);return _0xd07ceb[_0xe9e5('0x1e')](_0xe9e5('0x1f'),_0x2df941+'-'+_0x146c1f+'/'+_0x129228)['json'](_0x3f0990);}return null;};}function patchUpdates(_0x55a056){return function(_0x559d10){try{jsonpatch[_0xe9e5('0x20')](_0x559d10,_0x55a056,!![]);}catch(_0x445a81){return BPromise[_0xe9e5('0x21')](_0x445a81);}return _0x559d10[_0xe9e5('0x22')]();};}function saveUpdates(_0x4143dc,_0xb2a983){return function(_0x22d394){if(_0x22d394){return _0x22d394[_0xe9e5('0x23')](_0x4143dc)[_0xe9e5('0x24')](function(_0x43c0e4){return _0x43c0e4;});}return null;};}function removeEntity(_0x1b9d2f,_0x4c0fb9){return function(_0x252fdc){if(_0x252fdc){return _0x252fdc['destroy']()[_0xe9e5('0x24')](function(){_0x1b9d2f['status'](0xcc)[_0xe9e5('0x18')]();});}};}function handleEntityNotFound(_0x5804da,_0x5ac8fc){return function(_0x5e84dc){if(!_0x5e84dc){_0x5804da[_0xe9e5('0x16')](0x194);}return _0x5e84dc;};}function handleError(_0x7e62c7,_0x338076){_0x338076=_0x338076||0x1f4;return function(_0x327cb2){logger[_0xe9e5('0x25')](_0x327cb2[_0xe9e5('0x26')]);if(_0x327cb2[_0xe9e5('0x27')]){delete _0x327cb2[_0xe9e5('0x27')];}_0x7e62c7[_0xe9e5('0x17')](_0x338076)[_0xe9e5('0x28')](_0x327cb2);};}exports['index']=function(_0x3814f4,_0x56f728){var _0xe7d11e={},_0x18969d={},_0x554bcb={'count':0x0,'rows':[]};var _0x4161e9=_[_0xe9e5('0x29')](db[_0xe9e5('0x2a')]['rawAttributes'],function(_0x2e98c5){return{'name':_0x2e98c5['fieldName'],'type':_0x2e98c5[_0xe9e5('0x2b')][_0xe9e5('0x2c')]};});_0x18969d['model']=_[_0xe9e5('0x29')](_0x4161e9,_0xe9e5('0x27'));_0x18969d['query']=_[_0xe9e5('0x2d')](_0x3814f4[_0xe9e5('0x2e')]);_0x18969d[_0xe9e5('0x2f')]=_[_0xe9e5('0x30')](_0x18969d[_0xe9e5('0x31')],_0x18969d[_0xe9e5('0x2e')]);_0xe7d11e['attributes']=_['intersection'](_0x18969d[_0xe9e5('0x31')],qs[_0xe9e5('0x32')](_0x3814f4['query'][_0xe9e5('0x32')]));_0xe7d11e[_0xe9e5('0x33')]=_0xe7d11e['attributes']['length']?_0xe7d11e[_0xe9e5('0x33')]:_0x18969d['model'];if(!_0x3814f4['query'][_0xe9e5('0x34')](_0xe9e5('0x35'))){_0xe7d11e[_0xe9e5('0x1c')]=qs[_0xe9e5('0x1c')](_0x3814f4[_0xe9e5('0x2e')][_0xe9e5('0x1c')]);_0xe7d11e[_0xe9e5('0x1a')]=qs[_0xe9e5('0x1a')](_0x3814f4[_0xe9e5('0x2e')][_0xe9e5('0x1a')]);}_0xe7d11e[_0xe9e5('0x36')]=qs[_0xe9e5('0x37')](_0x3814f4[_0xe9e5('0x2e')]['sort']);_0xe7d11e[_0xe9e5('0x38')]=qs[_0xe9e5('0x2f')](_[_0xe9e5('0x39')](_0x3814f4[_0xe9e5('0x2e')],_0x18969d[_0xe9e5('0x2f')]),_0x4161e9);if(_0x3814f4[_0xe9e5('0x2e')]['filter']){_0xe7d11e[_0xe9e5('0x38')]=_[_0xe9e5('0x3a')](_0xe7d11e[_0xe9e5('0x38')],{'$or':_['map'](_0x4161e9,function(_0x253f59){if(_0x253f59[_0xe9e5('0x2b')]!==_0xe9e5('0x3b')){var _0x4525a8={};_0x4525a8[_0x253f59[_0xe9e5('0x27')]]={'$like':'%'+_0x3814f4[_0xe9e5('0x2e')][_0xe9e5('0x3c')]+'%'};return _0x4525a8;}})});}_0xe7d11e=_['merge']({},_0xe7d11e,_0x3814f4['options']);var _0x18e8e1={'where':_0xe7d11e[_0xe9e5('0x38')]};return db[_0xe9e5('0x2a')][_0xe9e5('0x1d')](_0x18e8e1)[_0xe9e5('0x24')](function(_0x5804fa){_0x554bcb[_0xe9e5('0x1d')]=_0x5804fa;if(_0x3814f4['query'][_0xe9e5('0x3d')]){_0xe7d11e['include']=[{'all':!![]}];}return db[_0xe9e5('0x2a')][_0xe9e5('0x3e')](_0xe7d11e);})['then'](function(_0x1abb5d){_0x554bcb['rows']=_0x1abb5d;return _0x554bcb;})[_0xe9e5('0x24')](respondWithFilteredResult(_0x56f728,_0xe7d11e))[_0xe9e5('0x3f')](handleError(_0x56f728,null));};exports[_0xe9e5('0x40')]=function(_0x328886,_0x10572d){var _0x2bc934={'raw':!![],'where':{'id':_0x328886[_0xe9e5('0x41')]['id']}},_0x1601fd={};_0x1601fd[_0xe9e5('0x31')]=_[_0xe9e5('0x2d')](db[_0xe9e5('0x2a')]['rawAttributes']);_0x1601fd[_0xe9e5('0x2e')]=_[_0xe9e5('0x2d')](_0x328886[_0xe9e5('0x2e')]);_0x1601fd[_0xe9e5('0x2f')]=_['intersection'](_0x1601fd['model'],_0x1601fd[_0xe9e5('0x2e')]);_0x2bc934['attributes']=_[_0xe9e5('0x30')](_0x1601fd[_0xe9e5('0x31')],qs[_0xe9e5('0x32')](_0x328886[_0xe9e5('0x2e')][_0xe9e5('0x32')]));_0x2bc934['attributes']=_0x2bc934[_0xe9e5('0x33')]['length']?_0x2bc934['attributes']:_0x1601fd['model'];if(_0x328886[_0xe9e5('0x2e')][_0xe9e5('0x3d')]){_0x2bc934[_0xe9e5('0x42')]=[{'all':!![]}];}_0x2bc934=_[_0xe9e5('0x3a')]({},_0x2bc934,_0x328886[_0xe9e5('0x43')]);return db[_0xe9e5('0x2a')][_0xe9e5('0x44')](_0x2bc934)[_0xe9e5('0x24')](handleEntityNotFound(_0x10572d,null))['then'](respondWithResult(_0x10572d,null))[_0xe9e5('0x3f')](handleError(_0x10572d,null));};exports[_0xe9e5('0x45')]=function(_0x41251f,_0x441839){return db[_0xe9e5('0x2a')][_0xe9e5('0x45')](_0x41251f[_0xe9e5('0x46')],{})['then'](respondWithResult(_0x441839,0xc9))['catch'](handleError(_0x441839,null));};exports[_0xe9e5('0x23')]=function(_0x4e8b56,_0x1dc5cf){if(_0x4e8b56[_0xe9e5('0x46')]['id']){delete _0x4e8b56[_0xe9e5('0x46')]['id'];}return db['WhatsappApplication'][_0xe9e5('0x44')]({'where':{'id':_0x4e8b56[_0xe9e5('0x41')]['id']}})[_0xe9e5('0x24')](handleEntityNotFound(_0x1dc5cf,null))[_0xe9e5('0x24')](saveUpdates(_0x4e8b56['body'],null))[_0xe9e5('0x24')](respondWithResult(_0x1dc5cf,null))[_0xe9e5('0x3f')](handleError(_0x1dc5cf,null));};exports[_0xe9e5('0x47')]=function(_0xda435e,_0x3f532d){return db[_0xe9e5('0x2a')][_0xe9e5('0x44')]({'where':{'id':_0xda435e[_0xe9e5('0x41')]['id']}})[_0xe9e5('0x24')](handleEntityNotFound(_0x3f532d,null))['then'](removeEntity(_0x3f532d,null))['catch'](handleError(_0x3f532d,null));}; \ No newline at end of file +var _0x59ea=['limit','undefined','count','offset','status','set','apply','reject','save','update','destroy','end','sendStatus','name','send','index','map','WhatsappApplication','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','then','rows','catch','show','include','options','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','json'];(function(_0x4bc4c8,_0x3139d3){var _0x3bb121=function(_0x95ad12){while(--_0x95ad12){_0x4bc4c8['push'](_0x4bc4c8['shift']());}};_0x3bb121(++_0x3139d3);}(_0x59ea,0x19d));var _0xa59e=function(_0x2ed9e6,_0x1cbe8a){_0x2ed9e6=_0x2ed9e6-0x0;var _0x414867=_0x59ea[_0x2ed9e6];return _0x414867;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa59e('0x0'));var jsonpatch=require(_0xa59e('0x1'));var rp=require(_0xa59e('0x2'));var moment=require(_0xa59e('0x3'));var BPromise=require(_0xa59e('0x4'));var Mustache=require(_0xa59e('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa59e('0x6'));var csv=require('to-csv');var ejs=require(_0xa59e('0x7'));var fs=require('fs');var fs_extra=require(_0xa59e('0x8'));var _=require(_0xa59e('0x9'));var squel=require('squel');var crypto=require(_0xa59e('0xa'));var jsforce=require(_0xa59e('0xb'));var deskjs=require(_0xa59e('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa59e('0xd'));var Papa=require(_0xa59e('0xe'));var Redis=require(_0xa59e('0xf'));var authService=require(_0xa59e('0x10'));var qs=require(_0xa59e('0x11'));var as=require(_0xa59e('0x12'));var hardwareService=require(_0xa59e('0x13'));var logger=require(_0xa59e('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xa59e('0x15'));var licenseUtil=require(_0xa59e('0x16'));var db=require(_0xa59e('0x17'))['db'];function respondWithStatusCode(_0x31c9f0,_0x570575){_0x570575=_0x570575||0xcc;return function(_0x3e959c){if(_0x3e959c){return _0x31c9f0['sendStatus'](_0x570575);}return _0x31c9f0['status'](_0x570575)['end']();};}function respondWithResult(_0x5ea8cd,_0xd398e5){_0xd398e5=_0xd398e5||0xc8;return function(_0x141386){if(_0x141386){return _0x5ea8cd['status'](_0xd398e5)[_0xa59e('0x18')](_0x141386);}};}function respondWithFilteredResult(_0x27c4ed,_0x2eca0b){return function(_0xafa9db){if(_0xafa9db){var _0x520c26=typeof _0x2eca0b['offset']==='undefined'&&typeof _0x2eca0b[_0xa59e('0x19')]===_0xa59e('0x1a');var _0x500d8c=_0xafa9db[_0xa59e('0x1b')];var _0x277aee=_0x520c26?0x0:_0x2eca0b[_0xa59e('0x1c')];var _0x38104c=_0x520c26?_0xafa9db['count']:_0x2eca0b[_0xa59e('0x1c')]+_0x2eca0b[_0xa59e('0x19')];var _0xac51d9;if(_0x38104c>=_0x500d8c){_0x38104c=_0x500d8c;_0xac51d9=0xc8;}else{_0xac51d9=0xce;}_0x27c4ed[_0xa59e('0x1d')](_0xac51d9);return _0x27c4ed[_0xa59e('0x1e')]('Content-Range',_0x277aee+'-'+_0x38104c+'/'+_0x500d8c)[_0xa59e('0x18')](_0xafa9db);}return null;};}function patchUpdates(_0x2e1d5d){return function(_0x4ffb12){try{jsonpatch[_0xa59e('0x1f')](_0x4ffb12,_0x2e1d5d,!![]);}catch(_0x2bb8d9){return BPromise[_0xa59e('0x20')](_0x2bb8d9);}return _0x4ffb12[_0xa59e('0x21')]();};}function saveUpdates(_0x440dc5,_0x2a583a){return function(_0x541cb3){if(_0x541cb3){return _0x541cb3[_0xa59e('0x22')](_0x440dc5)['then'](function(_0x431dc5){return _0x431dc5;});}return null;};}function removeEntity(_0x4f34a1,_0x549ba){return function(_0x5ea0cb){if(_0x5ea0cb){return _0x5ea0cb[_0xa59e('0x23')]()['then'](function(){_0x4f34a1[_0xa59e('0x1d')](0xcc)[_0xa59e('0x24')]();});}};}function handleEntityNotFound(_0x3be835,_0x1bd232){return function(_0x48c396){if(!_0x48c396){_0x3be835[_0xa59e('0x25')](0x194);}return _0x48c396;};}function handleError(_0x3896e9,_0x4997ee){_0x4997ee=_0x4997ee||0x1f4;return function(_0x73b615){logger['error'](_0x73b615['stack']);if(_0x73b615[_0xa59e('0x26')]){delete _0x73b615[_0xa59e('0x26')];}_0x3896e9['status'](_0x4997ee)[_0xa59e('0x27')](_0x73b615);};}exports[_0xa59e('0x28')]=function(_0x52dc5a,_0x1175da){var _0x3b3ad6={},_0x539a31={},_0xed0965={'count':0x0,'rows':[]};var _0x3e5650=_[_0xa59e('0x29')](db[_0xa59e('0x2a')]['rawAttributes'],function(_0x253dff){return{'name':_0x253dff[_0xa59e('0x2b')],'type':_0x253dff[_0xa59e('0x2c')]['key']};});_0x539a31[_0xa59e('0x2d')]=_['map'](_0x3e5650,_0xa59e('0x26'));_0x539a31[_0xa59e('0x2e')]=_[_0xa59e('0x2f')](_0x52dc5a['query']);_0x539a31[_0xa59e('0x30')]=_[_0xa59e('0x31')](_0x539a31[_0xa59e('0x2d')],_0x539a31['query']);_0x3b3ad6[_0xa59e('0x32')]=_[_0xa59e('0x31')](_0x539a31[_0xa59e('0x2d')],qs[_0xa59e('0x33')](_0x52dc5a[_0xa59e('0x2e')][_0xa59e('0x33')]));_0x3b3ad6['attributes']=_0x3b3ad6['attributes'][_0xa59e('0x34')]?_0x3b3ad6[_0xa59e('0x32')]:_0x539a31[_0xa59e('0x2d')];if(!_0x52dc5a[_0xa59e('0x2e')][_0xa59e('0x35')](_0xa59e('0x36'))){_0x3b3ad6['limit']=qs[_0xa59e('0x19')](_0x52dc5a[_0xa59e('0x2e')][_0xa59e('0x19')]);_0x3b3ad6[_0xa59e('0x1c')]=qs[_0xa59e('0x1c')](_0x52dc5a[_0xa59e('0x2e')][_0xa59e('0x1c')]);}_0x3b3ad6['order']=qs[_0xa59e('0x37')](_0x52dc5a['query'][_0xa59e('0x37')]);_0x3b3ad6[_0xa59e('0x38')]=qs[_0xa59e('0x30')](_[_0xa59e('0x39')](_0x52dc5a[_0xa59e('0x2e')],_0x539a31['filters']),_0x3e5650);if(_0x52dc5a['query'][_0xa59e('0x3a')]){_0x3b3ad6[_0xa59e('0x38')]=_['merge'](_0x3b3ad6[_0xa59e('0x38')],{'$or':_[_0xa59e('0x29')](_0x3e5650,function(_0x3a4cca){if(_0x3a4cca[_0xa59e('0x2c')]!==_0xa59e('0x3b')){var _0x377a07={};_0x377a07[_0x3a4cca['name']]={'$like':'%'+_0x52dc5a[_0xa59e('0x2e')][_0xa59e('0x3a')]+'%'};return _0x377a07;}})});}_0x3b3ad6=_[_0xa59e('0x3c')]({},_0x3b3ad6,_0x52dc5a['options']);var _0x5b06b8={'where':_0x3b3ad6['where']};return db['WhatsappApplication'][_0xa59e('0x1b')](_0x5b06b8)['then'](function(_0x13d6a4){_0xed0965['count']=_0x13d6a4;if(_0x52dc5a[_0xa59e('0x2e')][_0xa59e('0x3d')]){_0x3b3ad6['include']=[{'all':!![]}];}return db[_0xa59e('0x2a')][_0xa59e('0x3e')](_0x3b3ad6);})[_0xa59e('0x3f')](function(_0x163473){_0xed0965[_0xa59e('0x40')]=_0x163473;return _0xed0965;})[_0xa59e('0x3f')](respondWithFilteredResult(_0x1175da,_0x3b3ad6))[_0xa59e('0x41')](handleError(_0x1175da,null));};exports[_0xa59e('0x42')]=function(_0x5ea90f,_0x1c90fb){var _0xeeca23={'raw':!![],'where':{'id':_0x5ea90f['params']['id']}},_0x17d67b={};_0x17d67b[_0xa59e('0x2d')]=_[_0xa59e('0x2f')](db[_0xa59e('0x2a')]['rawAttributes']);_0x17d67b['query']=_[_0xa59e('0x2f')](_0x5ea90f[_0xa59e('0x2e')]);_0x17d67b[_0xa59e('0x30')]=_[_0xa59e('0x31')](_0x17d67b[_0xa59e('0x2d')],_0x17d67b[_0xa59e('0x2e')]);_0xeeca23[_0xa59e('0x32')]=_[_0xa59e('0x31')](_0x17d67b[_0xa59e('0x2d')],qs[_0xa59e('0x33')](_0x5ea90f[_0xa59e('0x2e')][_0xa59e('0x33')]));_0xeeca23[_0xa59e('0x32')]=_0xeeca23['attributes'][_0xa59e('0x34')]?_0xeeca23['attributes']:_0x17d67b[_0xa59e('0x2d')];if(_0x5ea90f['query']['includeAll']){_0xeeca23[_0xa59e('0x43')]=[{'all':!![]}];}_0xeeca23=_['merge']({},_0xeeca23,_0x5ea90f[_0xa59e('0x44')]);return db[_0xa59e('0x2a')][_0xa59e('0x45')](_0xeeca23)[_0xa59e('0x3f')](handleEntityNotFound(_0x1c90fb,null))[_0xa59e('0x3f')](respondWithResult(_0x1c90fb,null))['catch'](handleError(_0x1c90fb,null));};exports['create']=function(_0x2d730a,_0x40c672){return db[_0xa59e('0x2a')][_0xa59e('0x46')](_0x2d730a[_0xa59e('0x47')],{})[_0xa59e('0x3f')](respondWithResult(_0x40c672,0xc9))['catch'](handleError(_0x40c672,null));};exports[_0xa59e('0x22')]=function(_0x492704,_0x2d22eb){if(_0x492704[_0xa59e('0x47')]['id']){delete _0x492704[_0xa59e('0x47')]['id'];}return db[_0xa59e('0x2a')]['find']({'where':{'id':_0x492704[_0xa59e('0x48')]['id']}})[_0xa59e('0x3f')](handleEntityNotFound(_0x2d22eb,null))[_0xa59e('0x3f')](saveUpdates(_0x492704['body'],null))[_0xa59e('0x3f')](respondWithResult(_0x2d22eb,null))[_0xa59e('0x41')](handleError(_0x2d22eb,null));};exports[_0xa59e('0x23')]=function(_0x388970,_0x12a6ca){return db[_0xa59e('0x2a')][_0xa59e('0x45')]({'where':{'id':_0x388970[_0xa59e('0x48')]['id']}})[_0xa59e('0x3f')](handleEntityNotFound(_0x12a6ca,null))[_0xa59e('0x3f')](removeEntity(_0x12a6ca,null))[_0xa59e('0x41')](handleError(_0x12a6ca,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index ef9c58e..cbd4af0 100644 --- a/server/api/whatsappApplication/whatsappApplication.model.js +++ b/server/api/whatsappApplication/whatsappApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x21f4=['request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x21f4,0x11a));var _0x421f=function(_0x198a4d,_0x3087cb){_0x198a4d=_0x198a4d-0x0;var _0x5816de=_0x21f4[_0x198a4d];return _0x5816de;};'use strict';var _=require(_0x421f('0x0'));var util=require(_0x421f('0x1'));var logger=require(_0x421f('0x2'))(_0x421f('0x3'));var moment=require(_0x421f('0x4'));var BPromise=require(_0x421f('0x5'));var rp=require(_0x421f('0x6'));var fs=require('fs');var path=require(_0x421f('0x7'));var rimraf=require(_0x421f('0x8'));var config=require(_0x421f('0x9'));var attributes=require(_0x421f('0xa'));module['exports']=function(_0x536fac,_0x267337){return _0x536fac[_0x421f('0xb')](_0x421f('0xc'),attributes,{'tableName':_0x421f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x421f('0xe'),'collate':_0x421f('0xf')});}; \ No newline at end of file +var _0xf1dc=['./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0xf1dc,0xca));var _0xcf1d=function(_0xf53fc8,_0x456beb){_0xf53fc8=_0xf53fc8-0x0;var _0x3bc434=_0xf1dc[_0xf53fc8];return _0x3bc434;};'use strict';var _=require(_0xcf1d('0x0'));var util=require(_0xcf1d('0x1'));var logger=require(_0xcf1d('0x2'))(_0xcf1d('0x3'));var moment=require(_0xcf1d('0x4'));var BPromise=require(_0xcf1d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcf1d('0x6'));var config=require(_0xcf1d('0x7'));var attributes=require(_0xcf1d('0x8'));module[_0xcf1d('0x9')]=function(_0x2a49de,_0x14c14f){return _0x2a49de[_0xcf1d('0xa')](_0xcf1d('0xb'),attributes,{'tableName':_0xcf1d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xcf1d('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index eec72d0..309a000 100644 --- a/server/api/whatsappApplication/whatsappApplication.rpc.js +++ b/server/api/whatsappApplication/whatsappApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd046=['ioredis','../../config/logger','../../config/environment','http','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xd046,0x129));var _0x6d04=function(_0x2fdb61,_0x207a70){_0x2fdb61=_0x2fdb61-0x0;var _0x44e968=_0xd046[_0x2fdb61];return _0x44e968;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var moment=require(_0x6d04('0x1'));var BPromise=require(_0x6d04('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d04('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d04('0x4'))('rpc');var config=require(_0x6d04('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6d04('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1968c4,_0x4f83bc,_0x569c7b){return new BPromise(function(_0x2e2c01,_0x42aa22){return client['request'](_0x1968c4,_0x569c7b)['then'](function(_0x27a3d6){logger['info'](_0x6d04('0x7'),_0x4f83bc,'request\x20sent');logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x4f83bc,_0x6d04('0x8'),JSON[_0x6d04('0x9')](_0x27a3d6));if(_0x27a3d6[_0x6d04('0xa')]){if(_0x27a3d6[_0x6d04('0xa')]['code']===0x1f4){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x42aa22(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x2e2c01(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}else{logger[_0x6d04('0xc')](_0x6d04('0x7'),_0x4f83bc,_0x6d04('0x8'));_0x2e2c01(_0x27a3d6[_0x6d04('0xd')][_0x6d04('0xb')]);}})[_0x6d04('0xe')](function(_0xed5538){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0xed5538);_0x42aa22(_0xed5538);});});} \ No newline at end of file +var _0xa0a1=['request\x20sent','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s'];(function(_0x571c1d,_0x3b0586){var _0x33c609=function(_0x226499){while(--_0x226499){_0x571c1d['push'](_0x571c1d['shift']());}};_0x33c609(++_0x3b0586);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x399f39,_0x403e9a){_0x399f39=_0x399f39-0x0;var _0x38b439=_0xa0a1[_0x399f39];return _0x38b439;};'use strict';var _=require(_0x1a0a('0x0'));var util=require('util');var moment=require(_0x1a0a('0x1'));var BPromise=require(_0x1a0a('0x2'));var rs=require(_0x1a0a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1a0a('0x4'));var logger=require(_0x1a0a('0x5'))('rpc');var config=require(_0x1a0a('0x6'));var jayson=require(_0x1a0a('0x7'));var client=jayson['client'][_0x1a0a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe59f97,_0x3fe29f,_0x245f3d){return new BPromise(function(_0x9da67c,_0x48d604){return client[_0x1a0a('0x9')](_0xe59f97,_0x245f3d)[_0x1a0a('0xa')](function(_0x8165a1){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x3fe29f,'request\x20sent');logger[_0x1a0a('0xb')](_0x1a0a('0xc'),_0x3fe29f,_0x1a0a('0xd'),JSON['stringify'](_0x8165a1));if(_0x8165a1[_0x1a0a('0xe')]){if(_0x8165a1['error'][_0x1a0a('0xf')]===0x1f4){logger[_0x1a0a('0xe')](_0x1a0a('0x10'),_0x3fe29f,_0x8165a1[_0x1a0a('0xe')][_0x1a0a('0x11')]);return _0x48d604(_0x8165a1[_0x1a0a('0xe')][_0x1a0a('0x11')]);}logger['error'](_0x1a0a('0x10'),_0x3fe29f,_0x8165a1[_0x1a0a('0xe')][_0x1a0a('0x11')]);return _0x9da67c(_0x8165a1[_0x1a0a('0xe')][_0x1a0a('0x11')]);}else{logger['info'](_0x1a0a('0x10'),_0x3fe29f,_0x1a0a('0xd'));_0x9da67c(_0x8165a1[_0x1a0a('0x12')]['message']);}})[_0x1a0a('0x13')](function(_0x57c942){logger[_0x1a0a('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x3fe29f,_0x57c942);_0x48d604(_0x57c942);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index f8832dd..7d428d5 100644 --- a/server/api/whatsappInteraction/index.js +++ b/server/api/whatsappInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2fe=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','update','delete','whatsappinteraction:destroy'];(function(_0x35a141,_0x37c9d9){var _0x156602=function(_0x4721f){while(--_0x4721f){_0x35a141['push'](_0x35a141['shift']());}};_0x156602(++_0x37c9d9);}(_0xd2fe,0x14c));var _0xed2f=function(_0x3f5d48,_0x1f64bd){_0x3f5d48=_0x3f5d48-0x0;var _0x4576e8=_0xd2fe[_0x3f5d48];return _0x4576e8;};'use strict';var multer=require(_0xed2f('0x0'));var util=require(_0xed2f('0x1'));var path=require(_0xed2f('0x2'));var timeout=require(_0xed2f('0x3'));var express=require(_0xed2f('0x4'));var router=express[_0xed2f('0x5')]();var fs_extra=require(_0xed2f('0x6'));var auth=require(_0xed2f('0x7'));var interaction=require(_0xed2f('0x8'));var config=require(_0xed2f('0x9'));var controller=require('./whatsappInteraction.controller');router[_0xed2f('0xa')]('/',auth[_0xed2f('0xb')](),controller[_0xed2f('0xc')]);router[_0xed2f('0xa')](_0xed2f('0xd'),auth[_0xed2f('0xb')](),controller[_0xed2f('0xe')]);router[_0xed2f('0xa')](_0xed2f('0xf'),auth[_0xed2f('0xb')](),controller[_0xed2f('0x10')]);router[_0xed2f('0xa')](_0xed2f('0x11'),auth[_0xed2f('0xb')](),controller[_0xed2f('0x12')]);router[_0xed2f('0xa')]('/:id/download',auth[_0xed2f('0xb')](),controller[_0xed2f('0x13')]);router[_0xed2f('0x14')]('/',auth[_0xed2f('0xb')](),controller['create']);router[_0xed2f('0x14')](_0xed2f('0x11'),auth[_0xed2f('0xb')](),controller[_0xed2f('0x15')]);router[_0xed2f('0x14')](_0xed2f('0x16'),auth[_0xed2f('0xb')](),interaction[_0xed2f('0x17')](_0xed2f('0x18'),_0xed2f('0x19')),controller[_0xed2f('0x1a')]);router[_0xed2f('0x1b')](_0xed2f('0xf'),auth[_0xed2f('0xb')](),interaction[_0xed2f('0x17')](_0xed2f('0x18'),'whatsappinteraction:update'),controller[_0xed2f('0x1c')]);router[_0xed2f('0x1d')](_0xed2f('0xf'),auth[_0xed2f('0xb')](),interaction['tracked'](_0xed2f('0x18'),_0xed2f('0x1e')),controller[_0xed2f('0x1f')]);router['delete'](_0xed2f('0x16'),auth[_0xed2f('0xb')](),controller['removeTags']);module[_0xed2f('0x20')]=router; \ No newline at end of file +var _0x76c4=['./whatsappInteraction.controller','isAuthenticated','get','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2cefd6,_0x320d0b){var _0x56d9ea=function(_0x47413b){while(--_0x47413b){_0x2cefd6['push'](_0x2cefd6['shift']());}};_0x56d9ea(++_0x320d0b);}(_0x76c4,0x141));var _0x476c=function(_0x6f3c80,_0x458801){_0x6f3c80=_0x6f3c80-0x0;var _0x4703b4=_0x76c4[_0x6f3c80];return _0x4703b4;};'use strict';var multer=require(_0x476c('0x0'));var util=require(_0x476c('0x1'));var path=require(_0x476c('0x2'));var timeout=require(_0x476c('0x3'));var express=require(_0x476c('0x4'));var router=express[_0x476c('0x5')]();var fs_extra=require(_0x476c('0x6'));var auth=require(_0x476c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x476c('0x8'));var controller=require(_0x476c('0x9'));router['get']('/',auth[_0x476c('0xa')](),controller['index']);router[_0x476c('0xb')](_0x476c('0xc'),auth[_0x476c('0xa')](),controller[_0x476c('0xd')]);router[_0x476c('0xb')](_0x476c('0xe'),auth[_0x476c('0xa')](),controller['show']);router[_0x476c('0xb')](_0x476c('0xf'),auth[_0x476c('0xa')](),controller[_0x476c('0x10')]);router[_0x476c('0xb')](_0x476c('0x11'),auth['isAuthenticated'](),controller[_0x476c('0x12')]);router[_0x476c('0x13')]('/',auth[_0x476c('0xa')](),controller[_0x476c('0x14')]);router[_0x476c('0x13')](_0x476c('0xf'),auth[_0x476c('0xa')](),controller[_0x476c('0x15')]);router[_0x476c('0x13')](_0x476c('0x16'),auth[_0x476c('0xa')](),interaction[_0x476c('0x17')](_0x476c('0x18'),_0x476c('0x19')),controller[_0x476c('0x1a')]);router[_0x476c('0x1b')]('/:id',auth[_0x476c('0xa')](),interaction[_0x476c('0x17')](_0x476c('0x18'),_0x476c('0x1c')),controller['update']);router[_0x476c('0x1d')](_0x476c('0xe'),auth[_0x476c('0xa')](),interaction[_0x476c('0x17')](_0x476c('0x18'),_0x476c('0x1e')),controller[_0x476c('0x1f')]);router['delete'](_0x476c('0x16'),auth[_0x476c('0xa')](),controller['removeTags']);module[_0x476c('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 506b41a..193d50a 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.attributes.js +++ b/server/api/whatsappInteraction/whatsappInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaeaa=['BOOLEAN','STRING','DATE','ENUM','out','sequelize','exports'];(function(_0x542a4b,_0x1422d2){var _0x39f49d=function(_0x27f03a){while(--_0x27f03a){_0x542a4b['push'](_0x542a4b['shift']());}};_0x39f49d(++_0x1422d2);}(_0xaeaa,0x11d));var _0xaaea=function(_0x149379,_0x22f956){_0x149379=_0x149379-0x0;var _0x30cece=_0xaeaa[_0x149379];return _0x30cece;};'use strict';var Sequelize=require(_0xaaea('0x0'));var moment=require('moment');module[_0xaaea('0x1')]={'closed':{'type':Sequelize[_0xaaea('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xaaea('0x3')]},'secondDisposition':{'type':Sequelize[_0xaaea('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xaaea('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xaaea('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xaaea('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xaaea('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x9153=['moment','exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x1a0eec,_0x393f49){var _0xc546dd=function(_0x4d647c){while(--_0x4d647c){_0x1a0eec['push'](_0x1a0eec['shift']());}};_0xc546dd(++_0x393f49);}(_0x9153,0x1a7));var _0x3915=function(_0xf0b775,_0x5b4f89){_0xf0b775=_0xf0b775-0x0;var _0x1c9165=_0x9153[_0xf0b775];return _0x1c9165;};'use strict';var Sequelize=require(_0x3915('0x0'));var moment=require(_0x3915('0x1'));module[_0x3915('0x2')]={'closed':{'type':Sequelize[_0x3915('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x3915('0x4')]},'secondDisposition':{'type':Sequelize[_0x3915('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x3915('0x4')]},'phone':{'type':Sequelize[_0x3915('0x4')]},'read1stAt':{'type':Sequelize[_0x3915('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x3915('0x6')]('in',_0x3915('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3915('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x3915('0x6')]('in',_0x3915('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index bb5f949..c7695d4 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.controller.js +++ b/server/api/whatsappInteraction/whatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8ff=['MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.WhatsappAccountId\x20IS\x20NULL','toString','keyBy','merge','WhatsappInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','sequelize','WhatsappInteractionId','all','rows','show','rawAttributes','includeAll','include','options','create','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','pick','findAll','setTags','emit','whatsappInteractionTags:save','removeTags','download','join','root','server','attachments','format','transcript-%d-%s.zip','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','N.A.','closedAt','disposition','basename','createReadStream','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.html','transcript-','log','eml-format','rimraf','request-promise','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','catch','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','field','color','from','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','value','having','`\x20=\x200','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','buildExpression','body','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?'];(function(_0x37e886,_0x17d0ad){var _0x57c5cd=function(_0x2692a3){while(--_0x2692a3){_0x37e886['push'](_0x37e886['shift']());}};_0x57c5cd(++_0x17d0ad);}(_0xc8ff,0x158));var _0xfc8f=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xc8ff[_0x50a0c2];return _0x5ebadd;};'use strict';var emlformat=require(_0xfc8f('0x0'));var rimraf=require(_0xfc8f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfc8f('0x2'));var moment=require('moment');var BPromise=require(_0xfc8f('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfc8f('0x4'));var sox=require('sox');var csv=require(_0xfc8f('0x5'));var ejs=require(_0xfc8f('0x6'));var fs=require('fs');var fs_extra=require(_0xfc8f('0x7'));var _=require(_0xfc8f('0x8'));var squel=require(_0xfc8f('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfc8f('0xa'));var toCsv=require(_0xfc8f('0x5'));var querystring=require(_0xfc8f('0xb'));var Papa=require(_0xfc8f('0xc'));var Redis=require(_0xfc8f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xfc8f('0xe'));var as=require(_0xfc8f('0xf'));var pdf=require(_0xfc8f('0x10'));var hardwareService=require(_0xfc8f('0x11'));var logger=require(_0xfc8f('0x12'))(_0xfc8f('0x13'));var utils=require(_0xfc8f('0x14'));var config=require(_0xfc8f('0x15'));var licenseUtil=require(_0xfc8f('0x16'));var db=require('../../mysqldb')['db'];config[_0xfc8f('0x17')]=_[_0xfc8f('0x18')](config[_0xfc8f('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xfc8f('0x19'))(new Redis(config[_0xfc8f('0x17')]));require('./whatsappInteraction.socket')[_0xfc8f('0x1a')](socket);function respondWithStatusCode(_0x3ae0b0,_0x357df8){_0x357df8=_0x357df8||0xcc;return function(_0x4e9d37){if(_0x4e9d37){return _0x3ae0b0[_0xfc8f('0x1b')](_0x357df8);}return _0x3ae0b0['status'](_0x357df8)[_0xfc8f('0x1c')]();};}function respondWithResult(_0x3ca459,_0x3cc583){_0x3cc583=_0x3cc583||0xc8;return function(_0x13a66d){if(_0x13a66d){return _0x3ca459[_0xfc8f('0x1d')](_0x3cc583)['json'](_0x13a66d);}};}function respondWithFilteredResult(_0x3d7dad,_0x5a9b6f){return function(_0x358551){if(_0x358551){var _0x35dcbe=typeof _0x5a9b6f[_0xfc8f('0x1e')]===_0xfc8f('0x1f')&&typeof _0x5a9b6f[_0xfc8f('0x20')]===_0xfc8f('0x1f');var _0x2b893c=_0x358551[_0xfc8f('0x21')];var _0x4daca2=_0x35dcbe?0x0:_0x5a9b6f[_0xfc8f('0x1e')];var _0x6c8eec=_0x35dcbe?_0x358551[_0xfc8f('0x21')]:_0x5a9b6f[_0xfc8f('0x1e')]+_0x5a9b6f[_0xfc8f('0x20')];var _0x2e85f4;if(_0x6c8eec>=_0x2b893c){_0x6c8eec=_0x2b893c;_0x2e85f4=0xc8;}else{_0x2e85f4=0xce;}_0x3d7dad[_0xfc8f('0x1d')](_0x2e85f4);return _0x3d7dad['set'](_0xfc8f('0x22'),_0x4daca2+'-'+_0x6c8eec+'/'+_0x2b893c)[_0xfc8f('0x23')](_0x358551);}return null;};}function patchUpdates(_0x57bef1){return function(_0x51b3aa){try{jsonpatch[_0xfc8f('0x24')](_0x51b3aa,_0x57bef1,!![]);}catch(_0xc79eb5){return BPromise[_0xfc8f('0x25')](_0xc79eb5);}return _0x51b3aa['save']();};}function saveUpdates(_0x226957,_0x1d5073){return function(_0x407217){if(_0x407217){return _0x407217[_0xfc8f('0x26')](_0x226957)[_0xfc8f('0x27')](function(_0x2b7145){return _0x2b7145;});}return null;};}function removeEntity(_0x1ae98c,_0x4b984c){return function(_0x1e53d9){if(_0x1e53d9){return _0x1e53d9[_0xfc8f('0x28')]()[_0xfc8f('0x27')](function(){_0x1ae98c[_0xfc8f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xae403a,_0x300cc7){return function(_0x1428a4){if(!_0x1428a4){_0xae403a[_0xfc8f('0x1b')](0x194);}return _0x1428a4;};}function handleError(_0x2d5548,_0x1d81af){_0x1d81af=_0x1d81af||0x1f4;return function(_0x2a2e18){logger[_0xfc8f('0x29')](_0x2a2e18[_0xfc8f('0x2a')]);if(_0x2a2e18[_0xfc8f('0x2b')]){delete _0x2a2e18[_0xfc8f('0x2b')];}_0x2d5548['status'](_0x1d81af)[_0xfc8f('0x2c')](_0x2a2e18);};}function getInteractionUsers(_0xd20af0,_0x513a77){return new BPromise(function(_0x120c0d,_0x35a7fc){try{if(_0x513a77[_0xd20af0['id']]){_0xd20af0['Users']=_['map'](_0x513a77[_0xd20af0['id']],function(_0x110292){return{'id':_0x110292['id'],'fullname':_0x110292[_0xfc8f('0x2d')]};});}}catch(_0x5dbd6c){_0x35a7fc(_0x5dbd6c);}_0x120c0d(_0xd20af0);});}function getInteractionTags(_0x4a2cf5,_0x25a6ca){return new BPromise(function(_0xd98cb5,_0x31247f){try{if(_0x4a2cf5[_0xfc8f('0x2e')]){_0x4a2cf5[_0xfc8f('0x2f')]=[];_0x4a2cf5[_0xfc8f('0x2e')][_0xfc8f('0x30')](',')[_0xfc8f('0x31')](function(_0x45af02){_0x4a2cf5[_0xfc8f('0x2f')][_0xfc8f('0x32')](_0x25a6ca[_0x45af02]);});}delete _0x4a2cf5[_0xfc8f('0x2e')];}catch(_0x3ffae0){_0x31247f(_0x3ffae0);}_0xd98cb5(_0x4a2cf5);});}function updateWhatsappInteraction(_0x232453,_0xaa9f3,_0x7c2a7e){return new BPromise(function(_0x4f549c,_0x1ed8ab){return getInteractionUsers(_0x232453,_0x7c2a7e)[_0xfc8f('0x27')](function(_0x1d8ba3){return getInteractionTags(_0x1d8ba3,_0xaa9f3);})[_0xfc8f('0x27')](function(_0x16265b){_0x4f549c(_0x16265b);})[_0xfc8f('0x33')](function(_0x2d4ff9){_0x1ed8ab(_0x2d4ff9);});});}exports[_0xfc8f('0x34')]=function(_0x37f307,_0x7544f5){var _0x35d3f5={},_0x3694b1={},_0x47ca28={'count':0x0,'rows':[]};var _0x38b8fa=_[_0xfc8f('0x35')](db['WhatsappInteraction']['rawAttributes'],function(_0x499e76){return{'name':_0x499e76[_0xfc8f('0x36')],'type':_0x499e76[_0xfc8f('0x37')][_0xfc8f('0x38')]};});_0x3694b1[_0xfc8f('0x39')]=_[_0xfc8f('0x35')](_0x38b8fa,_0xfc8f('0x2b'));_0x3694b1[_0xfc8f('0x3a')]=_[_0xfc8f('0x3b')](_0x37f307[_0xfc8f('0x3a')]);_0x3694b1[_0xfc8f('0x3c')]=_['intersection'](_0x3694b1[_0xfc8f('0x39')],_0x3694b1[_0xfc8f('0x3a')]);_0x35d3f5['attributes']=_[_0xfc8f('0x3d')](_0x3694b1[_0xfc8f('0x39')],qs[_0xfc8f('0x3e')](_0x37f307[_0xfc8f('0x3a')]['fields']));_0x35d3f5[_0xfc8f('0x3f')]=_0x35d3f5['attributes'][_0xfc8f('0x40')]?_0x35d3f5[_0xfc8f('0x3f')]:_0x3694b1['model'];if(!_0x37f307[_0xfc8f('0x3a')][_0xfc8f('0x41')](_0xfc8f('0x42'))){_0x35d3f5[_0xfc8f('0x20')]=qs['limit'](_0x37f307['query'][_0xfc8f('0x20')]);_0x35d3f5[_0xfc8f('0x1e')]=qs[_0xfc8f('0x1e')](_0x37f307['query']['offset']);}_0x35d3f5[_0xfc8f('0x43')]=qs['sort'](_0x37f307[_0xfc8f('0x3a')][_0xfc8f('0x44')]);_0x35d3f5[_0xfc8f('0x45')]=qs[_0xfc8f('0x3c')](_['pick'](_0x37f307[_0xfc8f('0x3a')],_0x3694b1['filters']),_0x38b8fa);var _0x5cf637=[];var _0x359b9c=squel['select']()[_0xfc8f('0x46')]('id')[_0xfc8f('0x46')]('name')[_0xfc8f('0x46')](_0xfc8f('0x47'))[_0xfc8f('0x48')](_0xfc8f('0x49'));var _0x1454bc=squel[_0xfc8f('0x4a')]()[_0xfc8f('0x46')](_0xfc8f('0x4b'))[_0xfc8f('0x46')](_0xfc8f('0x4c'))[_0xfc8f('0x46')](_0xfc8f('0x4d'))['from'](_0xfc8f('0x4e'),'ui')[_0xfc8f('0x4f')](_0xfc8f('0x50'),'u',_0xfc8f('0x51'));var _0x2a8fcb=squel[_0xfc8f('0x4a')]()[_0xfc8f('0x48')](_0xfc8f('0x52'),'i')[_0xfc8f('0x4f')](_0xfc8f('0x53'),'c',_0xfc8f('0x54'))[_0xfc8f('0x4f')](_0xfc8f('0x50'),'o',_0xfc8f('0x55'))['left_join'](_0xfc8f('0x56'),'a',_0xfc8f('0x57'))[_0xfc8f('0x4f')](_0xfc8f('0x58'),'me',_0xfc8f('0x59'))['left_join'](_0xfc8f('0x5a'),'it','it.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0xfc8f('0x49'),'t',_0xfc8f('0x5b'));var _0x8c88d7=squel[_0xfc8f('0x5c')]();var _0x41d0d8=[];var _0x4747a4=squel[_0xfc8f('0x5c')]();var _0x328fae;if(_0x37f307[_0xfc8f('0x3a')]['search']){_0x328fae=as[_0xfc8f('0x5d')](_0x37f307[_0xfc8f('0x3a')][_0xfc8f('0x5e')]);var _0x3ca653=_0x328fae['sqlOperator'];for(var _0x3af2c9=0x0;_0x3af2c9<_0x328fae[_0xfc8f('0x5f')][_0xfc8f('0x40')];_0x3af2c9++){var _0x207296=_0x328fae['conditions'][_0x3af2c9];var _0x5b0f2e='i';var _0x1b527c=_[_0xfc8f('0x60')](_0x38b8fa,[_0xfc8f('0x2b'),_0x207296[_0xfc8f('0x46')]]);if(!_0x1b527c){switch(_0x207296[_0xfc8f('0x46')]){case'unreadMessages':if(_0x207296[_0xfc8f('0x61')]==0x1){_0x2a8fcb[_0xfc8f('0x62')]('`'+_0x207296[_0xfc8f('0x46')]+_0xfc8f('0x63'));}else{_0x2a8fcb[_0xfc8f('0x62')]('`'+_0x207296['field']+_0xfc8f('0x64'));}break;case'Contact':if(_0x207296[_0xfc8f('0x65')]==='$substring'){if(_0x207296['value']['split']('\x20')[_0xfc8f('0x40')]>0x1){_0x8c88d7[_0x3ca653](_0xfc8f('0x66'),qs[_0xfc8f('0x67')](_0x207296[_0xfc8f('0x61')]),null);}else{var _0x1aa476='%'+_0x207296[_0xfc8f('0x61')]+'%';_0x8c88d7[_0x3ca653](_0xfc8f('0x68'),_0x1aa476,_0x1aa476,_0x1aa476);}}else{_0x1b527c=_['find'](_0x38b8fa,[_0xfc8f('0x2b'),_0xfc8f('0x69')]);_0x207296[_0xfc8f('0x46')]=_0xfc8f('0x69');_0x53ce6c=as['buildExpression'](_0x5b0f2e,_0x1b527c[_0xfc8f('0x37')],_0x207296);_0x8c88d7[_0x3ca653](_0x53ce6c[_0xfc8f('0x6a')],_0x53ce6c[_0xfc8f('0x61')][_0xfc8f('0x6b')],_0x53ce6c[_0xfc8f('0x61')][_0xfc8f('0x1c')]);}break;case _0xfc8f('0x6c'):var _0x2b4cb5=_0x207296[_0xfc8f('0x61')]['split'](',')[_0xfc8f('0x35')](function(_0x23f556){return Number(_0x23f556);});_0x2b4cb5['forEach'](function(_0x31f6c1){_0x4747a4['or'](_0xfc8f('0x6d'),'%,'+_0x31f6c1+',%');});_0x41d0d8=_[_0xfc8f('0x6e')](_0x41d0d8,_0x2b4cb5);break;case _0xfc8f('0x6f'):if(_0x207296[_0xfc8f('0x65')]===_0xfc8f('0x70')){_0x8c88d7[_0x3ca653]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x207296[_0xfc8f('0x61')]+'%',null);}else{_0x1b527c=_['find'](_0x38b8fa,[_0xfc8f('0x2b'),'UserId']);_0x207296['field']=_0xfc8f('0x71');_0x53ce6c=as[_0xfc8f('0x72')](_0x5b0f2e,_0x1b527c[_0xfc8f('0x37')],_0x207296);_0x8c88d7[_0x3ca653](_0x53ce6c[_0xfc8f('0x6a')],_0x53ce6c[_0xfc8f('0x61')][_0xfc8f('0x6b')],_0x53ce6c[_0xfc8f('0x61')][_0xfc8f('0x1c')]);}break;case _0xfc8f('0x73'):_0x53ce6c=as[_0xfc8f('0x72')]('me',null,_0x207296);_0x8c88d7[_0x3ca653](_0x53ce6c['text'],_0x53ce6c[_0xfc8f('0x61')]['start'],_0x53ce6c[_0xfc8f('0x61')][_0xfc8f('0x1c')]);break;}}else{var _0x53ce6c=as['buildExpression'](_0x5b0f2e,_0x1b527c[_0xfc8f('0x37')],_0x207296);_0x8c88d7[_0x3ca653](_0x53ce6c['text'],_0x53ce6c[_0xfc8f('0x61')][_0xfc8f('0x6b')],_0x53ce6c[_0xfc8f('0x61')][_0xfc8f('0x1c')]);}}}else{var _0x5a47ab=_(_0x37f307[_0xfc8f('0x3a')])[_0xfc8f('0x3b')]()['map'](function(_0x8daca2){return _['some'](_0x38b8fa,[_0xfc8f('0x2b'),_0x8daca2])?_0x8daca2:undefined;})[_0xfc8f('0x74')]()[_0xfc8f('0x61')]();if(!_[_0xfc8f('0x75')](_0x5a47ab)){_0x5a47ab[_0xfc8f('0x31')](function(_0x15e8b7){if(_0x15e8b7===_0xfc8f('0x76')){_0x2a8fcb['where'](_0xfc8f('0x77'),[]['concat'](_0x37f307[_0xfc8f('0x3a')][_0x15e8b7]));}else if(_0x15e8b7===_0xfc8f('0x78')){var _0x11b193=JSON[_0xfc8f('0x79')](_0x37f307[_0xfc8f('0x3a')][_0x15e8b7])[_0xfc8f('0x7a')];var _0x19a6e0=JSON[_0xfc8f('0x79')](_0x37f307['query'][_0x15e8b7])[_0xfc8f('0x7b')];_0x2a8fcb['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x11b193,_0x19a6e0);}else{if(_0x37f307[_0xfc8f('0x3a')][_0x15e8b7]===_0xfc8f('0x7c')){_0x2a8fcb[_0xfc8f('0x45')]('i.'+_0x15e8b7+_0xfc8f('0x7d'));}else{_0x2a8fcb['where']('i.'+_0x15e8b7+_0xfc8f('0x7e'),_0x37f307[_0xfc8f('0x3a')][_0x15e8b7]);}}});}if(_0x37f307['query']['read']){if(_0x37f307[_0xfc8f('0x3a')][_0xfc8f('0x7f')]==0x1){_0x2a8fcb[_0xfc8f('0x62')]('`unreadMessages`\x20=\x200');}else{_0x2a8fcb[_0xfc8f('0x62')](_0xfc8f('0x80'));}}if(_0x37f307[_0xfc8f('0x3a')]['tag']){_0x41d0d8=_[_0xfc8f('0x81')](_0x37f307[_0xfc8f('0x3a')]['tag'])?_0x37f307[_0xfc8f('0x3a')][_0xfc8f('0x82')]:new Array(_0x37f307['query'][_0xfc8f('0x82')]);_0x41d0d8[_0xfc8f('0x31')](function(_0xba8a53){_0x4747a4['or'](_0xfc8f('0x6d'),'%,'+_0xba8a53+',%');});}if(_0x37f307['query']['filter']){var _0x408f47=_0x37f307[_0xfc8f('0x3a')][_0xfc8f('0x83')]['replace']('\x5c','\x5c\x5c')[_0xfc8f('0x84')](/'/g,'\x27\x27');if(qs[_0xfc8f('0x85')](_0x408f47)){_0x8c88d7['or'](_0xfc8f('0x86'),_0x408f47+'%')['or'](_0xfc8f('0x87'),_0x408f47+'%');}else{_0x8c88d7['or'](_0xfc8f('0x88'),qs[_0xfc8f('0x67')](_0x408f47))['or'](_0xfc8f('0x89'),_0x408f47+'%');}}}_0x2a8fcb[_0xfc8f('0x45')](_0x8c88d7);_0x2a8fcb[_0xfc8f('0x8a')](_0xfc8f('0x8b'));var _0x38f64b={'type':db['Sequelize'][_0xfc8f('0x8c')][_0xfc8f('0x8d')],'raw':!![]};var _0x2681b3=_0x2a8fcb[_0xfc8f('0x8e')]();_0x2681b3[_0xfc8f('0x46')](_0xfc8f('0x8b'));_0x2681b3[_0xfc8f('0x46')](_0xfc8f('0x8f'),_0xfc8f('0x90'));if(_0x35d3f5[_0xfc8f('0x43')]){_0x35d3f5[_0xfc8f('0x43')]['forEach'](function(_0x4cc7fa){var _0x43633d=_0x4cc7fa[0x0]==='contactName'?_0x4cc7fa[0x0]:'i.'+_0x4cc7fa[0x0];_0x2a8fcb[_0xfc8f('0x43')](_0x43633d,_0x4cc7fa[0x1]===_0xfc8f('0x91')?![]:!![]);});}if(!_[_0xfc8f('0x75')](_0x41d0d8)){_0x2a8fcb[_0xfc8f('0x62')](_0x4747a4);_0x2681b3[_0xfc8f('0x45')](_0xfc8f('0x92'),_0x41d0d8);}BPromise[_0xfc8f('0x93')]()[_0xfc8f('0x27')](function(){if(!_0x328fae){if(_0x37f307['query']['WhatsappAccountId'])return;_0x2681b3[_0xfc8f('0x45')](_0xfc8f('0x94'));_0x2a8fcb[_0xfc8f('0x45')](_0xfc8f('0x94'));return;}if(_0x37f307[_0xfc8f('0x95')][_0xfc8f('0x96')]!==_0xfc8f('0x97'))return;return _0x37f307[_0xfc8f('0x95')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0xfc8f('0x27')](function(_0x29d810){if(_[_0xfc8f('0x75')](_0x29d810)){_0x2681b3['where'](_0xfc8f('0x98'));_0x2a8fcb['where']('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x2681b3[_0xfc8f('0x45')](_0xfc8f('0x77'),_['map'](_0x29d810,'id'));_0x2a8fcb['where'](_0xfc8f('0x77'),_[_0xfc8f('0x35')](_0x29d810,'id'));}});})['then'](function(){if(_0x37f307[_0xfc8f('0x95')][_0xfc8f('0x96')]===_0xfc8f('0x97')&&!_0x328fae&&!_0x37f307[_0xfc8f('0x3a')][_0xfc8f('0x76')])return[];return db['sequelize'][_0xfc8f('0x3a')](_0x2681b3['toString'](),_0x38f64b);})[_0xfc8f('0x27')](function(_0x2f45ab){_0x47ca28[_0xfc8f('0x21')]=_0x2f45ab[_0xfc8f('0x40')];if(_0x47ca28[_0xfc8f('0x21')]===0x0)return[];return db['sequelize'][_0xfc8f('0x3a')](_0x359b9c[_0xfc8f('0x99')](),_0x38f64b)[_0xfc8f('0x27')](function(_0x3e0a99){_0x5cf637=_[_0xfc8f('0x9a')](_0x3e0a99,'id');_0x38f64b=_[_0xfc8f('0x9b')](_0x38f64b,{'model':db[_0xfc8f('0x9c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x37f307[_0xfc8f('0x3a')][_0xfc8f('0x3e')]){_0x35d3f5[_0xfc8f('0x3f')][_0xfc8f('0x31')](function(_0x33a68e){_0x2a8fcb['field']('i.'+_0x33a68e);});}else{_0x2a8fcb[_0xfc8f('0x46')](_0xfc8f('0x8f'),'unreadMessages');_0x2a8fcb[_0xfc8f('0x46')](_0xfc8f('0x9d'),_0xfc8f('0x9e'));_0x2a8fcb[_0xfc8f('0x46')](_0xfc8f('0x9f'),_0xfc8f('0xa0'));_0x2a8fcb[_0xfc8f('0x46')](_0xfc8f('0xa1'),_0xfc8f('0xa2'));_0x2a8fcb[_0xfc8f('0x46')](_0xfc8f('0xa3'));_0x2a8fcb['field'](_0xfc8f('0xa4'),_0xfc8f('0xa5'));_0x2a8fcb[_0xfc8f('0x46')](_0xfc8f('0xa6'),_0xfc8f('0xa7'));_0x2a8fcb[_0xfc8f('0x46')](_0xfc8f('0xa8'),_0xfc8f('0xa9'));_0x2a8fcb[_0xfc8f('0x46')](_0xfc8f('0xaa'),_0xfc8f('0xab'));_0x2a8fcb['field'](_0xfc8f('0xac'),_0xfc8f('0xad'));_0x2a8fcb['field'](_0xfc8f('0xae'),_0xfc8f('0xaf'));_0x2a8fcb[_0xfc8f('0x46')](_0xfc8f('0xb0'),_0xfc8f('0xb1'));_0x2a8fcb[_0xfc8f('0x46')](_0xfc8f('0xb2'),_0xfc8f('0xb3'));_0x2a8fcb[_0xfc8f('0x46')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xfc8f('0x2e'));}if(_0x35d3f5[_0xfc8f('0x20')])_0x2a8fcb[_0xfc8f('0x20')](_0x35d3f5[_0xfc8f('0x20')]);if(_0x35d3f5['offset'])_0x2a8fcb[_0xfc8f('0x1e')](_0x35d3f5[_0xfc8f('0x1e')]);return db['sequelize'][_0xfc8f('0x3a')](_0x2a8fcb[_0xfc8f('0x99')](),_0x38f64b);})[_0xfc8f('0x27')](function(_0x3a3f79){if(_0x3a3f79[_0xfc8f('0x40')]>0x0)_0x1454bc[_0xfc8f('0x45')](_0xfc8f('0xb4'),_[_0xfc8f('0x35')](_0x3a3f79,'id'));return db[_0xfc8f('0xb5')][_0xfc8f('0x3a')](_0x1454bc[_0xfc8f('0x99')](),_0x38f64b)[_0xfc8f('0x27')](function(_0x183514){var _0x36b163=_['groupBy'](_0x183514,_0xfc8f('0xb6'));var _0x14c46c=[];_0x3a3f79[_0xfc8f('0x31')](function(_0x23243c){_0x14c46c[_0xfc8f('0x32')](updateWhatsappInteraction(_0x23243c,_0x5cf637,_0x36b163));});return BPromise[_0xfc8f('0xb7')](_0x14c46c);});});})[_0xfc8f('0x27')](function(_0x4e2780){_0x47ca28[_0xfc8f('0xb8')]=_0x4e2780;return _0x47ca28;})['then'](respondWithFilteredResult(_0x7544f5,_0x35d3f5))['catch'](handleError(_0x7544f5,null));};exports[_0xfc8f('0xb9')]=function(_0x5e5a09,_0x321f68){var _0x1c741d={'raw':![],'where':{'id':_0x5e5a09['params']['id']}},_0x1a9f6b={};_0x1a9f6b['model']=_[_0xfc8f('0x3b')](db[_0xfc8f('0x9c')][_0xfc8f('0xba')]);_0x1a9f6b['query']=_[_0xfc8f('0x3b')](_0x5e5a09[_0xfc8f('0x3a')]);_0x1a9f6b['filters']=_[_0xfc8f('0x3d')](_0x1a9f6b['model'],_0x1a9f6b[_0xfc8f('0x3a')]);_0x1c741d[_0xfc8f('0x3f')]=_['intersection'](_0x1a9f6b[_0xfc8f('0x39')],qs[_0xfc8f('0x3e')](_0x5e5a09['query'][_0xfc8f('0x3e')]));_0x1c741d[_0xfc8f('0x3f')]=_0x1c741d[_0xfc8f('0x3f')][_0xfc8f('0x40')]?_0x1c741d['attributes']:_0x1a9f6b[_0xfc8f('0x39')];if(_0x5e5a09['query'][_0xfc8f('0xbb')]){_0x1c741d[_0xfc8f('0xbc')]=[{'all':!![]}];}_0x1c741d=_['merge']({},_0x1c741d,_0x5e5a09[_0xfc8f('0xbd')]);return db[_0xfc8f('0x9c')][_0xfc8f('0x60')](_0x1c741d)[_0xfc8f('0x27')](handleEntityNotFound(_0x321f68,null))[_0xfc8f('0x27')](respondWithResult(_0x321f68,null))[_0xfc8f('0x33')](handleError(_0x321f68,null));};exports['create']=function(_0x43c1bd,_0x186486){return db['WhatsappInteraction'][_0xfc8f('0xbe')](_0x43c1bd[_0xfc8f('0x73')],{})[_0xfc8f('0x27')](respondWithResult(_0x186486,0xc9))[_0xfc8f('0x33')](handleError(_0x186486,null));};exports[_0xfc8f('0x26')]=function(_0x41b905,_0x2fcbee){if(_0x41b905[_0xfc8f('0x73')]['id']){delete _0x41b905[_0xfc8f('0x73')]['id'];}return db[_0xfc8f('0x9c')][_0xfc8f('0x60')]({'where':{'id':_0x41b905[_0xfc8f('0xbf')]['id']}})[_0xfc8f('0x27')](handleEntityNotFound(_0x2fcbee,null))[_0xfc8f('0x27')](saveUpdates(_0x41b905[_0xfc8f('0x73')],null))[_0xfc8f('0x27')](respondWithResult(_0x2fcbee,null))['catch'](handleError(_0x2fcbee,null));};exports[_0xfc8f('0x28')]=function(_0x44b566,_0x53e7d5){return db[_0xfc8f('0x9c')][_0xfc8f('0x60')]({'where':{'id':_0x44b566[_0xfc8f('0xbf')]['id']}})['then'](handleEntityNotFound(_0x53e7d5,null))['then'](removeEntity(_0x53e7d5,null))['catch'](handleError(_0x53e7d5,null));};exports[_0xfc8f('0xc0')]=function(_0x9d730c,_0x37c31f){return db[_0xfc8f('0x9c')][_0xfc8f('0xc0')]()[_0xfc8f('0x27')](respondWithResult(_0x37c31f,null))['catch'](handleError(_0x37c31f,null));};exports[_0xfc8f('0xc1')]=function(_0x5c1392,_0x5569f2,_0x36fe2b){return db[_0xfc8f('0xc2')][_0xfc8f('0x60')]({'where':{'id':_0x5c1392['params']['id']}})[_0xfc8f('0x27')](handleEntityNotFound(_0x5569f2,null))['then'](function(_0x40055f){if(_0x40055f){return _0x40055f[_0xfc8f('0xc1')](_0x5c1392[_0xfc8f('0x73')][_0xfc8f('0xc3')],_[_0xfc8f('0xc4')](_0x5c1392[_0xfc8f('0x73')],['ids','id'])||{});}})['then'](respondWithResult(_0x5569f2,null))[_0xfc8f('0x33')](handleError(_0x5569f2,null));};exports[_0xfc8f('0xc5')]=function(_0xb613ae,_0x5b30bf,_0x447989){var _0x1d78b6={'raw':![],'where':{}};var _0x162ea7={};var _0x334d69={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xfc8f('0xc6')]({'where':{'id':_0xb613ae[_0xfc8f('0xbf')]['id']}})['then'](handleEntityNotFound(_0x5b30bf,null))[_0xfc8f('0x27')](function(_0x57cf58){if(_0x57cf58){_0x162ea7[_0xfc8f('0x39')]=_['keys'](db[_0xfc8f('0xc2')][_0xfc8f('0xba')]);_0x162ea7['query']=_['keys'](_0xb613ae[_0xfc8f('0x3a')]);_0x162ea7['filters']=_[_0xfc8f('0x3d')](_0x162ea7['model'],_0x162ea7[_0xfc8f('0x3a')]);_0x1d78b6['attributes']=_['intersection'](_0x162ea7[_0xfc8f('0x39')],qs[_0xfc8f('0x3e')](_0xb613ae[_0xfc8f('0x3a')]['fields']));_0x1d78b6[_0xfc8f('0x3f')]=_0x1d78b6[_0xfc8f('0x3f')]['length']?_0x1d78b6[_0xfc8f('0x3f')]:_0x162ea7['model'];if(!_0xb613ae[_0xfc8f('0x3a')][_0xfc8f('0x41')](_0xfc8f('0x42'))){_0x1d78b6[_0xfc8f('0x20')]=qs[_0xfc8f('0x20')](_0xb613ae[_0xfc8f('0x3a')][_0xfc8f('0x20')]);_0x1d78b6['offset']=qs[_0xfc8f('0x1e')](_0xb613ae[_0xfc8f('0x3a')]['offset']);}_0x1d78b6[_0xfc8f('0x43')]=qs[_0xfc8f('0x44')](_0xb613ae[_0xfc8f('0x3a')][_0xfc8f('0x44')]);_0x1d78b6[_0xfc8f('0x45')]=qs[_0xfc8f('0x3c')](_[_0xfc8f('0xc7')](_0xb613ae['query'],_0x162ea7[_0xfc8f('0x3c')]));_0x1d78b6['where'][_0xfc8f('0xb6')]=_0x57cf58['id'];if(_0xb613ae['query'][_0xfc8f('0x83')]){_0x1d78b6['where']=_[_0xfc8f('0x9b')](_0x1d78b6[_0xfc8f('0x45')],{'$or':_['map'](_0x1d78b6['attributes'],function(_0x48ca47){var _0x4e9df8={};_0x4e9df8[_0x48ca47]={'$like':'%'+_0xb613ae['query'][_0xfc8f('0x83')]+'%'};return _0x4e9df8;})});}if(_0xb613ae[_0xfc8f('0x3a')][_0xfc8f('0x7a')]){var _0x45c80=_0xb613ae['query']['$gte'][_0xfc8f('0x30')](',');var _0x586fdb={};_0x586fdb[_0x45c80[0x0]]={'$gte':moment(_0x45c80[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x1d78b6['where']=_[_0xfc8f('0x9b')](_0x1d78b6['where'],_0x586fdb);}_0x1d78b6=_['merge']({},_0x1d78b6,_0xb613ae[_0xfc8f('0xbd')]);return db[_0xfc8f('0xc2')][_0xfc8f('0x21')]({'where':_0x1d78b6['where']})['then'](function(_0x5376e1){_0x334d69[_0xfc8f('0x21')]=_0x5376e1;if(_0xb613ae['query'][_0xfc8f('0xbb')]){_0x1d78b6[_0xfc8f('0xbc')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xfc8f('0xc8')](_0x1d78b6);})[_0xfc8f('0x27')](function(_0xb0e726){_0x334d69[_0xfc8f('0xb8')]=_0xb0e726;return _0x334d69;});}})[_0xfc8f('0x27')](respondWithFilteredResult(_0x5b30bf,_0x1d78b6))[_0xfc8f('0x33')](handleError(_0x5b30bf,null));};exports['addTags']=function(_0x207319,_0x2b1fe4,_0x333017){return db[_0xfc8f('0x9c')][_0xfc8f('0x60')]({'where':{'id':_0x207319['params']['id']}})[_0xfc8f('0x27')](handleEntityNotFound(_0x2b1fe4,null))['then'](function(_0x19fc22){if(_0x19fc22){return _0x19fc22[_0xfc8f('0xc9')](_0x207319[_0xfc8f('0x73')]['ids'],_[_0xfc8f('0xc4')](_0x207319[_0xfc8f('0x73')],[_0xfc8f('0xc3'),'id'])||{})['spread'](function(){return db[_0xfc8f('0x6c')][_0xfc8f('0xc8')]({'attributes':['id',_0xfc8f('0x2b'),_0xfc8f('0x47')],'where':{'id':_0x207319[_0xfc8f('0x73')][_0xfc8f('0xc3')]}});})[_0xfc8f('0x27')](function(_0x14159c){socket[_0xfc8f('0xca')](_0xfc8f('0xcb'),{'id':Number(_0x207319[_0xfc8f('0xbf')]['id']),'tags':_0x14159c||[]});return{'id':Number(_0x207319[_0xfc8f('0xbf')]['id']),'tags':_0x14159c||[]};});}})[_0xfc8f('0x27')](respondWithResult(_0x2b1fe4,null))[_0xfc8f('0x33')](handleError(_0x2b1fe4,null));};exports[_0xfc8f('0xcc')]=function(_0x3e9922,_0x3e055a,_0x961539){return db[_0xfc8f('0x9c')][_0xfc8f('0x60')]({'where':{'id':_0x3e9922['params']['id']}})['then'](handleEntityNotFound(_0x3e055a,null))[_0xfc8f('0x27')](function(_0x400a0f){if(_0x400a0f){return _0x400a0f[_0xfc8f('0xcc')](_0x3e9922[_0xfc8f('0x3a')][_0xfc8f('0xc3')]);}})[_0xfc8f('0x27')](respondWithStatusCode(_0x3e055a,null))[_0xfc8f('0x33')](handleError(_0x3e055a,null));};exports[_0xfc8f('0xcd')]=function(_0x2809c3,_0x262a52){var _0x4bffb2=moment()['unix']()[_0xfc8f('0x99')]();var _0x12c223=path[_0xfc8f('0xce')](config[_0xfc8f('0xcf')],'server','files','tmp');var _0x2ae072=path[_0xfc8f('0xce')](config[_0xfc8f('0xcf')],_0xfc8f('0xd0'),'files',_0xfc8f('0xd1'));var _0x22905b=path[_0xfc8f('0xce')](_0x12c223,_0x4bffb2);var _0x24716f=util[_0xfc8f('0xd2')](_0xfc8f('0xd3'),_0x2809c3[_0xfc8f('0xbf')]['id'],_0x4bffb2);var _0x1ef4a8=path[_0xfc8f('0xce')](_0x12c223,_0x24716f);var _0x1cdf36=[];_0x1cdf36[_0xfc8f('0x32')]({'model':db[_0xfc8f('0x6f')],'as':_0xfc8f('0x6f'),'attributes':['id',_0xfc8f('0x2d')],'raw':!![]});_0x1cdf36[_0xfc8f('0x32')]({'model':db[_0xfc8f('0xd4')],'as':_0xfc8f('0xd5'),'attributes':['id',_0xfc8f('0xd6'),_0xfc8f('0xd7')],'raw':!![]});if(_0x2809c3['query'][_0xfc8f('0xd1')]){_0x1cdf36['push']({'model':db[_0xfc8f('0xd8')],'as':_0xfc8f('0xd8'),'raw':!![]});}var _0x5f1a7e=[{'model':db['WhatsappMessage'],'as':_0xfc8f('0xd9'),'attributes':['id',_0xfc8f('0x73'),_0xfc8f('0x78'),_0xfc8f('0xda'),_0xfc8f('0xdb'),_0xfc8f('0x7f')],'include':_0x1cdf36}];_0x5f1a7e[_0xfc8f('0x32')]({'model':db[_0xfc8f('0xdc')],'as':_0xfc8f('0xdd'),'attributes':['id','name']});_0x5f1a7e[_0xfc8f('0x32')]({'model':db[_0xfc8f('0x6f')],'as':'Owner','attributes':['id',_0xfc8f('0x2d')]});return db[_0xfc8f('0x9c')]['find']({'where':{'id':_0x2809c3[_0xfc8f('0xbf')]['id']},'include':_0x5f1a7e})[_0xfc8f('0x27')](handleEntityNotFound(_0x262a52,null))['then'](function(_0x1cd76a){if(_0x1cd76a){var _0x21aa3f=_0x1cd76a[_0xfc8f('0xde')]({'plain':!![]});fs[_0xfc8f('0xdf')](_0x22905b);var _0xeb6f6f={'channel':_0xfc8f('0xe0'),'account':_0x21aa3f['Account']['name'],'agent':_0x21aa3f[_0xfc8f('0xe1')]?_0x21aa3f[_0xfc8f('0xe1')]['fullname']:_0xfc8f('0xe2'),'createdAt':moment(_0x21aa3f[_0xfc8f('0x78')])[_0xfc8f('0xd2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xfc8f('0x99')](),'closedAt':_0x21aa3f['closed']?moment(_0x21aa3f[_0xfc8f('0xe3')])[_0xfc8f('0xd2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xfc8f('0x99')]():'','disposition':_0x21aa3f[_0xfc8f('0xe4')],'messages':_(_0x21aa3f[_0xfc8f('0xd9')])[_0xfc8f('0x83')]({'secret':![]})[_0xfc8f('0x35')](function(_0x229702){if(_0x229702[_0xfc8f('0xd8')]){var _0x5caf69=path['join'](_0x2ae072,_0x229702[_0xfc8f('0xd8')][_0xfc8f('0xe5')]);if(fs['existsSync'](_0x5caf69)){fs[_0xfc8f('0xe6')](_0x5caf69)[_0xfc8f('0xe7')](fs[_0xfc8f('0xe8')](path['join'](_0x22905b,_0x229702[_0xfc8f('0xd8')][_0xfc8f('0xe5')])));}}return{'date':moment(_0x229702[_0xfc8f('0x78')])[_0xfc8f('0xd2')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x229702[_0xfc8f('0xda')]===_0xfc8f('0xe9')?_0x229702['User']?_0x229702['User'][_0xfc8f('0x2d')]:_0xfc8f('0xea'):_0x229702[_0xfc8f('0xd5')]['firstName']+(_0x229702['Contact']['lastName']?'\x20'+_0x229702[_0xfc8f('0xd5')][_0xfc8f('0xd7')]:''),'body':_0x229702['Attachment']?_0x229702['Attachment']['basename']:_0x229702[_0xfc8f('0x73')],'direction':_0x229702[_0xfc8f('0xda')]===_0xfc8f('0xe9')?'A':'C','secret':_0x229702['secret'],'read':_0x229702[_0xfc8f('0x7f')],'attachment':_0x229702['Attachment']};})[_0xfc8f('0x61')]()};return ejs[_0xfc8f('0xeb')](path[_0xfc8f('0xce')](config[_0xfc8f('0xcf')],_0xfc8f('0xd0'),_0xfc8f('0xec'),_0xfc8f('0xed')),{'interaction':_0xeb6f6f})[_0xfc8f('0x27')](function(_0xe81014){var _0x5f29d7=path[_0xfc8f('0xce')](_0x22905b,_0xfc8f('0xee')+_0x21aa3f['id']+'-'+_0x4bffb2+'.pdf');var _0x66b414={'path':_0x5f29d7,'channel':_0xfc8f('0xe0'),'interactionId':_0x21aa3f['id']};return pdf['createPdfFromHTML'](_0xe81014,_0x66b414);})['then'](function(){return new BPromise(function(_0x15260c,_0x369389){zipdir(_0x22905b,{'saveTo':_0x1ef4a8},function(_0xaa33e1,_0x2f408a){if(_0xaa33e1)return _0x369389(_0xaa33e1);return _0x15260c(_0x2f408a);});})[_0xfc8f('0x27')](function(){return new BPromise(function(_0x4ab8bb,_0x2bd652){rimraf(_0x22905b,function(_0x33d816){if(_0x33d816)_0x2bd652(_0x33d816);return _0x4ab8bb();});});})[_0xfc8f('0x27')](function(){return _0x262a52[_0xfc8f('0xcd')](_0x1ef4a8,_0x24716f,function(_0x6deab8){if(_0x6deab8){console[_0xfc8f('0xef')]('err',_0x6deab8);}else{fs['unlinkSync'](_0x1ef4a8);}});});});}else{return _0x262a52[_0xfc8f('0x1b')](0xc8);}})[_0xfc8f('0x33')](handleError(_0x262a52,null));}; \ No newline at end of file +var _0x1009=['u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','keys','compact','isEmpty','WhatsappAccountId','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','SELECT','clone','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','keyBy','WhatsappInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','groupBy','all','show','params','includeAll','include','merge','options','describe','addMessage','ids','getMessages','WhatsappMessage','WhatsappInteractionId','format','findAll','rows','addTags','setTags','spread','Tag','color','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','CmContact','firstName','lastName','Attachment','Messages','direction','secret','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closed','closedAt','disposition','basename','existsSync','pipe','System','Contact','out','renderFile','.pdf','log','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','then','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','left_join','users'];(function(_0x177eaa,_0x411e1e){var _0x180958=function(_0x22fd94){while(--_0x22fd94){_0x177eaa['push'](_0x177eaa['shift']());}};_0x180958(++_0x411e1e);}(_0x1009,0x185));var _0x9100=function(_0x12a962,_0x569097){_0x12a962=_0x12a962-0x0;var _0x5bb916=_0x1009[_0x12a962];return _0x5bb916;};'use strict';var emlformat=require(_0x9100('0x0'));var rimraf=require(_0x9100('0x1'));var zipdir=require(_0x9100('0x2'));var jsonpatch=require(_0x9100('0x3'));var rp=require(_0x9100('0x4'));var moment=require(_0x9100('0x5'));var BPromise=require(_0x9100('0x6'));var Mustache=require(_0x9100('0x7'));var util=require(_0x9100('0x8'));var path=require(_0x9100('0x9'));var sox=require(_0x9100('0xa'));var csv=require('to-csv');var ejs=require(_0x9100('0xb'));var fs=require('fs');var fs_extra=require(_0x9100('0xc'));var _=require('lodash');var squel=require(_0x9100('0xd'));var crypto=require(_0x9100('0xe'));var jsforce=require(_0x9100('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9100('0x10'));var Papa=require(_0x9100('0x11'));var Redis=require(_0x9100('0x12'));var authService=require(_0x9100('0x13'));var qs=require(_0x9100('0x14'));var as=require(_0x9100('0x15'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9100('0x16'))('api');var utils=require(_0x9100('0x17'));var config=require(_0x9100('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9100('0x19'))['db'];config[_0x9100('0x1a')]=_[_0x9100('0x1b')](config[_0x9100('0x1a')],{'host':_0x9100('0x1c'),'port':0x18eb});var socket=require(_0x9100('0x1d'))(new Redis(config[_0x9100('0x1a')]));require('./whatsappInteraction.socket')[_0x9100('0x1e')](socket);function respondWithStatusCode(_0x4d1a50,_0x2d7309){_0x2d7309=_0x2d7309||0xcc;return function(_0xdaedd2){if(_0xdaedd2){return _0x4d1a50[_0x9100('0x1f')](_0x2d7309);}return _0x4d1a50['status'](_0x2d7309)[_0x9100('0x20')]();};}function respondWithResult(_0x3f7164,_0x46498d){_0x46498d=_0x46498d||0xc8;return function(_0x20d334){if(_0x20d334){return _0x3f7164[_0x9100('0x21')](_0x46498d)[_0x9100('0x22')](_0x20d334);}};}function respondWithFilteredResult(_0x3dcafe,_0x472483){return function(_0x187cd7){if(_0x187cd7){var _0x14dbd2=typeof _0x472483['offset']==='undefined'&&typeof _0x472483[_0x9100('0x23')]===_0x9100('0x24');var _0x320cb3=_0x187cd7[_0x9100('0x25')];var _0x31f12f=_0x14dbd2?0x0:_0x472483[_0x9100('0x26')];var _0x5ef6fd=_0x14dbd2?_0x187cd7[_0x9100('0x25')]:_0x472483[_0x9100('0x26')]+_0x472483['limit'];var _0x5ce922;if(_0x5ef6fd>=_0x320cb3){_0x5ef6fd=_0x320cb3;_0x5ce922=0xc8;}else{_0x5ce922=0xce;}_0x3dcafe[_0x9100('0x21')](_0x5ce922);return _0x3dcafe[_0x9100('0x27')](_0x9100('0x28'),_0x31f12f+'-'+_0x5ef6fd+'/'+_0x320cb3)[_0x9100('0x22')](_0x187cd7);}return null;};}function patchUpdates(_0x320c1f){return function(_0x35e442){try{jsonpatch[_0x9100('0x29')](_0x35e442,_0x320c1f,!![]);}catch(_0x489711){return BPromise['reject'](_0x489711);}return _0x35e442[_0x9100('0x2a')]();};}function saveUpdates(_0xe5225e,_0x492130){return function(_0x21510a){if(_0x21510a){return _0x21510a['update'](_0xe5225e)['then'](function(_0x2292ae){return _0x2292ae;});}return null;};}function removeEntity(_0x584165,_0x14f456){return function(_0x2505e4){if(_0x2505e4){return _0x2505e4['destroy']()[_0x9100('0x2b')](function(){_0x584165[_0x9100('0x21')](0xcc)[_0x9100('0x20')]();});}};}function handleEntityNotFound(_0x3916c3,_0x4f011c){return function(_0x4755e5){if(!_0x4755e5){_0x3916c3[_0x9100('0x1f')](0x194);}return _0x4755e5;};}function handleError(_0x9bbeee,_0x1628dd){_0x1628dd=_0x1628dd||0x1f4;return function(_0x32bd5f){logger[_0x9100('0x2c')](_0x32bd5f[_0x9100('0x2d')]);if(_0x32bd5f[_0x9100('0x2e')]){delete _0x32bd5f[_0x9100('0x2e')];}_0x9bbeee['status'](_0x1628dd)[_0x9100('0x2f')](_0x32bd5f);};}function getInteractionUsers(_0x46d955,_0x11bb2a){return new BPromise(function(_0x18c17d,_0xe553dc){try{if(_0x11bb2a[_0x46d955['id']]){_0x46d955[_0x9100('0x30')]=_['map'](_0x11bb2a[_0x46d955['id']],function(_0x25fb08){return{'id':_0x25fb08['id'],'fullname':_0x25fb08[_0x9100('0x31')]};});}}catch(_0x242e74){_0xe553dc(_0x242e74);}_0x18c17d(_0x46d955);});}function getInteractionTags(_0x494822,_0x2b7b0f){return new BPromise(function(_0x299574,_0x322006){try{if(_0x494822[_0x9100('0x32')]){_0x494822[_0x9100('0x33')]=[];_0x494822[_0x9100('0x32')][_0x9100('0x34')](',')[_0x9100('0x35')](function(_0x59b4b2){_0x494822['Tags'][_0x9100('0x36')](_0x2b7b0f[_0x59b4b2]);});}delete _0x494822['TagIds'];}catch(_0x4e7d50){_0x322006(_0x4e7d50);}_0x299574(_0x494822);});}function updateWhatsappInteraction(_0xeb58d8,_0x2c8e6e,_0x2d82cf){return new BPromise(function(_0x5d5b44,_0x355b19){return getInteractionUsers(_0xeb58d8,_0x2d82cf)[_0x9100('0x2b')](function(_0x3c5a7d){return getInteractionTags(_0x3c5a7d,_0x2c8e6e);})[_0x9100('0x2b')](function(_0x59789c){_0x5d5b44(_0x59789c);})[_0x9100('0x37')](function(_0xa0cf08){_0x355b19(_0xa0cf08);});});}exports[_0x9100('0x38')]=function(_0x50c470,_0x57d8ea){var _0x4faff7={},_0x17c5bd={},_0x1fc311={'count':0x0,'rows':[]};var _0x1163ee=_['map'](db['WhatsappInteraction'][_0x9100('0x39')],function(_0x19b5b6){return{'name':_0x19b5b6[_0x9100('0x3a')],'type':_0x19b5b6[_0x9100('0x3b')][_0x9100('0x3c')]};});_0x17c5bd[_0x9100('0x3d')]=_[_0x9100('0x3e')](_0x1163ee,_0x9100('0x2e'));_0x17c5bd[_0x9100('0x3f')]=_['keys'](_0x50c470['query']);_0x17c5bd[_0x9100('0x40')]=_[_0x9100('0x41')](_0x17c5bd[_0x9100('0x3d')],_0x17c5bd['query']);_0x4faff7['attributes']=_[_0x9100('0x41')](_0x17c5bd[_0x9100('0x3d')],qs[_0x9100('0x42')](_0x50c470[_0x9100('0x3f')]['fields']));_0x4faff7[_0x9100('0x43')]=_0x4faff7[_0x9100('0x43')][_0x9100('0x44')]?_0x4faff7[_0x9100('0x43')]:_0x17c5bd[_0x9100('0x3d')];if(!_0x50c470['query'][_0x9100('0x45')](_0x9100('0x46'))){_0x4faff7[_0x9100('0x23')]=qs['limit'](_0x50c470['query']['limit']);_0x4faff7['offset']=qs[_0x9100('0x26')](_0x50c470[_0x9100('0x3f')][_0x9100('0x26')]);}_0x4faff7['order']=qs[_0x9100('0x47')](_0x50c470[_0x9100('0x3f')]['sort']);_0x4faff7[_0x9100('0x48')]=qs['filters'](_[_0x9100('0x49')](_0x50c470[_0x9100('0x3f')],_0x17c5bd['filters']),_0x1163ee);var _0x785d32=[];var _0x55bff2=squel[_0x9100('0x4a')]()[_0x9100('0x4b')]('id')[_0x9100('0x4b')]('name')['field']('color')[_0x9100('0x4c')](_0x9100('0x4d'));var _0x211235=squel[_0x9100('0x4a')]()['field'](_0x9100('0x4e'))[_0x9100('0x4b')](_0x9100('0x4f'))[_0x9100('0x4b')](_0x9100('0x50'))[_0x9100('0x4c')]('user_has_whatsapp_interactions','ui')[_0x9100('0x51')](_0x9100('0x52'),'u',_0x9100('0x53'));var _0x4017a1=squel[_0x9100('0x4a')]()[_0x9100('0x4c')](_0x9100('0x54'),'i')['left_join'](_0x9100('0x55'),'c',_0x9100('0x56'))[_0x9100('0x51')]('users','o','o.id\x20=\x20i.UserId')['left_join'](_0x9100('0x57'),'a',_0x9100('0x58'))[_0x9100('0x51')]('whatsapp_messages','me',_0x9100('0x59'))[_0x9100('0x51')](_0x9100('0x5a'),'it',_0x9100('0x5b'))[_0x9100('0x51')](_0x9100('0x4d'),'t',_0x9100('0x5c'));var _0x4c0822=squel['expr']();var _0x54f8de=[];var _0x36250b=squel[_0x9100('0x5d')]();var _0xee6850;if(_0x50c470[_0x9100('0x3f')][_0x9100('0x5e')]){_0xee6850=as[_0x9100('0x5f')](_0x50c470['query'][_0x9100('0x5e')]);var _0x2ec894=_0xee6850[_0x9100('0x60')];for(var _0x412256=0x0;_0x412256<_0xee6850[_0x9100('0x61')][_0x9100('0x44')];_0x412256++){var _0x2892a9=_0xee6850[_0x9100('0x61')][_0x412256];var _0x589727='i';var _0xc58fbd=_[_0x9100('0x62')](_0x1163ee,[_0x9100('0x2e'),_0x2892a9[_0x9100('0x4b')]]);if(!_0xc58fbd){switch(_0x2892a9[_0x9100('0x4b')]){case _0x9100('0x63'):if(_0x2892a9[_0x9100('0x64')]==0x1){_0x4017a1['having']('`'+_0x2892a9[_0x9100('0x4b')]+_0x9100('0x65'));}else{_0x4017a1[_0x9100('0x66')]('`'+_0x2892a9[_0x9100('0x4b')]+_0x9100('0x67'));}break;case'Contact':if(_0x2892a9[_0x9100('0x68')]===_0x9100('0x69')){if(_0x2892a9[_0x9100('0x64')][_0x9100('0x34')]('\x20')[_0x9100('0x44')]>0x1){_0x4c0822[_0x2ec894](_0x9100('0x6a'),qs[_0x9100('0x6b')](_0x2892a9[_0x9100('0x64')]),null);}else{var _0x7ff74='%'+_0x2892a9[_0x9100('0x64')]+'%';_0x4c0822[_0x2ec894]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x7ff74,_0x7ff74,_0x7ff74);}}else{_0xc58fbd=_['find'](_0x1163ee,[_0x9100('0x2e'),_0x9100('0x6c')]);_0x2892a9[_0x9100('0x4b')]=_0x9100('0x6c');_0x4a11e1=as['buildExpression'](_0x589727,_0xc58fbd['type'],_0x2892a9);_0x4c0822[_0x2ec894](_0x4a11e1[_0x9100('0x6d')],_0x4a11e1[_0x9100('0x64')][_0x9100('0x6e')],_0x4a11e1['value'][_0x9100('0x20')]);}break;case'Tag':var _0x423959=_0x2892a9[_0x9100('0x64')][_0x9100('0x34')](',')['map'](function(_0x113837){return Number(_0x113837);});_0x423959[_0x9100('0x35')](function(_0x455829){_0x36250b['or'](_0x9100('0x6f'),'%,'+_0x455829+',%');});_0x54f8de=_['union'](_0x54f8de,_0x423959);break;case _0x9100('0x70'):if(_0x2892a9['operator']===_0x9100('0x69')){_0x4c0822[_0x2ec894](_0x9100('0x71'),'%'+_0x2892a9[_0x9100('0x64')]+'%',null);}else{_0xc58fbd=_[_0x9100('0x62')](_0x1163ee,[_0x9100('0x2e'),_0x9100('0x72')]);_0x2892a9[_0x9100('0x4b')]=_0x9100('0x72');_0x4a11e1=as[_0x9100('0x73')](_0x589727,_0xc58fbd[_0x9100('0x3b')],_0x2892a9);_0x4c0822[_0x2ec894](_0x4a11e1[_0x9100('0x6d')],_0x4a11e1[_0x9100('0x64')][_0x9100('0x6e')],_0x4a11e1[_0x9100('0x64')][_0x9100('0x20')]);}break;case _0x9100('0x74'):_0x4a11e1=as[_0x9100('0x73')]('me',null,_0x2892a9);_0x4c0822[_0x2ec894](_0x4a11e1[_0x9100('0x6d')],_0x4a11e1[_0x9100('0x64')]['start'],_0x4a11e1[_0x9100('0x64')][_0x9100('0x20')]);break;}}else{var _0x4a11e1=as['buildExpression'](_0x589727,_0xc58fbd[_0x9100('0x3b')],_0x2892a9);_0x4c0822[_0x2ec894](_0x4a11e1[_0x9100('0x6d')],_0x4a11e1[_0x9100('0x64')]['start'],_0x4a11e1[_0x9100('0x64')][_0x9100('0x20')]);}}}else{var _0x512d3e=_(_0x50c470[_0x9100('0x3f')])[_0x9100('0x75')]()[_0x9100('0x3e')](function(_0x27398e){return _['some'](_0x1163ee,[_0x9100('0x2e'),_0x27398e])?_0x27398e:undefined;})[_0x9100('0x76')]()[_0x9100('0x64')]();if(!_[_0x9100('0x77')](_0x512d3e)){_0x512d3e['forEach'](function(_0x141063){if(_0x141063===_0x9100('0x78')){_0x4017a1[_0x9100('0x48')]('i.WhatsappAccountId\x20IN\x20?',[]['concat'](_0x50c470['query'][_0x141063]));}else if(_0x141063===_0x9100('0x79')){var _0x2a021b=JSON[_0x9100('0x7a')](_0x50c470['query'][_0x141063])[_0x9100('0x7b')];var _0x501aae=JSON[_0x9100('0x7a')](_0x50c470[_0x9100('0x3f')][_0x141063])[_0x9100('0x7c')];_0x4017a1[_0x9100('0x48')](_0x9100('0x7d'),_0x2a021b,_0x501aae);}else{if(_0x50c470[_0x9100('0x3f')][_0x141063]===_0x9100('0x7e')){_0x4017a1[_0x9100('0x48')]('i.'+_0x141063+_0x9100('0x7f'));}else{_0x4017a1[_0x9100('0x48')]('i.'+_0x141063+_0x9100('0x80'),_0x50c470['query'][_0x141063]);}}});}if(_0x50c470[_0x9100('0x3f')][_0x9100('0x81')]){if(_0x50c470[_0x9100('0x3f')][_0x9100('0x81')]==0x1){_0x4017a1[_0x9100('0x66')](_0x9100('0x82'));}else{_0x4017a1[_0x9100('0x66')](_0x9100('0x83'));}}if(_0x50c470[_0x9100('0x3f')][_0x9100('0x84')]){_0x54f8de=_[_0x9100('0x85')](_0x50c470[_0x9100('0x3f')][_0x9100('0x84')])?_0x50c470[_0x9100('0x3f')]['tag']:new Array(_0x50c470[_0x9100('0x3f')][_0x9100('0x84')]);_0x54f8de[_0x9100('0x35')](function(_0x36d06f){_0x36250b['or'](_0x9100('0x6f'),'%,'+_0x36d06f+',%');});}if(_0x50c470['query'][_0x9100('0x86')]){var _0x296376=_0x50c470[_0x9100('0x3f')]['filter'][_0x9100('0x87')]('\x5c','\x5c\x5c')[_0x9100('0x87')](/'/g,'\x27\x27');if(qs[_0x9100('0x88')](_0x296376)){_0x4c0822['or'](_0x9100('0x89'),_0x296376+'%')['or']('i.phone\x20LIKE\x20?',_0x296376+'%');}else{_0x4c0822['or'](_0x9100('0x8a'),qs[_0x9100('0x6b')](_0x296376))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x296376+'%');}}}_0x4017a1['where'](_0x4c0822);_0x4017a1[_0x9100('0x8b')](_0x9100('0x8c'));var _0x1ae02c={'type':db[_0x9100('0x8d')]['QueryTypes'][_0x9100('0x8e')],'raw':!![]};var _0x53b9ba=_0x4017a1[_0x9100('0x8f')]();_0x53b9ba[_0x9100('0x4b')](_0x9100('0x8c'));_0x53b9ba[_0x9100('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x4faff7[_0x9100('0x90')]){_0x4faff7[_0x9100('0x90')][_0x9100('0x35')](function(_0x1d1d8a){var _0x5079aa=_0x1d1d8a[0x0]===_0x9100('0x91')?_0x1d1d8a[0x0]:'i.'+_0x1d1d8a[0x0];_0x4017a1['order'](_0x5079aa,_0x1d1d8a[0x1]===_0x9100('0x92')?![]:!![]);});}if(!_[_0x9100('0x77')](_0x54f8de)){_0x4017a1[_0x9100('0x66')](_0x36250b);_0x53b9ba[_0x9100('0x48')](_0x9100('0x93'),_0x54f8de);}BPromise[_0x9100('0x94')]()['then'](function(){if(!_0xee6850){if(_0x50c470[_0x9100('0x3f')][_0x9100('0x78')])return;_0x53b9ba[_0x9100('0x48')](_0x9100('0x95'));_0x4017a1['where'](_0x9100('0x95'));return;}if(_0x50c470[_0x9100('0x96')][_0x9100('0x97')]!==_0x9100('0x98'))return;return _0x50c470['user'][_0x9100('0x99')]({'attributes':['id'],'raw':!![]})[_0x9100('0x2b')](function(_0x59af21){if(_[_0x9100('0x77')](_0x59af21)){_0x53b9ba[_0x9100('0x48')](_0x9100('0x9a'));_0x4017a1[_0x9100('0x48')](_0x9100('0x9a'));}else{_0x53b9ba[_0x9100('0x48')](_0x9100('0x9b'),_[_0x9100('0x3e')](_0x59af21,'id'));_0x4017a1['where'](_0x9100('0x9b'),_['map'](_0x59af21,'id'));}});})[_0x9100('0x2b')](function(){if(_0x50c470[_0x9100('0x96')][_0x9100('0x97')]==='agent'&&!_0xee6850&&!_0x50c470[_0x9100('0x3f')][_0x9100('0x78')])return[];return db[_0x9100('0x9c')][_0x9100('0x3f')](_0x53b9ba[_0x9100('0x9d')](),_0x1ae02c);})['then'](function(_0x460385){_0x1fc311[_0x9100('0x25')]=_0x460385['length'];if(_0x1fc311[_0x9100('0x25')]===0x0)return[];return db[_0x9100('0x9c')][_0x9100('0x3f')](_0x55bff2[_0x9100('0x9d')](),_0x1ae02c)[_0x9100('0x2b')](function(_0xa9dbcc){_0x785d32=_[_0x9100('0x9e')](_0xa9dbcc,'id');_0x1ae02c=_['merge'](_0x1ae02c,{'model':db[_0x9100('0x9f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x50c470[_0x9100('0x3f')][_0x9100('0x42')]){_0x4faff7[_0x9100('0x43')][_0x9100('0x35')](function(_0x1449c0){_0x4017a1['field']('i.'+_0x1449c0);});}else{_0x4017a1[_0x9100('0x4b')](_0x9100('0xa0'),_0x9100('0x63'));_0x4017a1[_0x9100('0x4b')](_0x9100('0xa1'),'Account.key');_0x4017a1[_0x9100('0x4b')](_0x9100('0xa2'),'Account.mandatoryDisposition');_0x4017a1[_0x9100('0x4b')](_0x9100('0xa3'),_0x9100('0x91'));_0x4017a1['field'](_0x9100('0xa4'));_0x4017a1[_0x9100('0x4b')](_0x9100('0xa5'),_0x9100('0xa6'));_0x4017a1[_0x9100('0x4b')](_0x9100('0xa7'),_0x9100('0xa8'));_0x4017a1[_0x9100('0x4b')](_0x9100('0xa9'),_0x9100('0xaa'));_0x4017a1[_0x9100('0x4b')](_0x9100('0xab'),'Contact.phone');_0x4017a1[_0x9100('0x4b')](_0x9100('0xac'),'Contact.mobile');_0x4017a1[_0x9100('0x4b')](_0x9100('0xad'),_0x9100('0xae'));_0x4017a1[_0x9100('0x4b')](_0x9100('0xaf'),_0x9100('0xb0'));_0x4017a1[_0x9100('0x4b')](_0x9100('0xb1'),_0x9100('0xb2'));_0x4017a1[_0x9100('0x4b')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x9100('0x32'));}if(_0x4faff7['limit'])_0x4017a1[_0x9100('0x23')](_0x4faff7[_0x9100('0x23')]);if(_0x4faff7['offset'])_0x4017a1[_0x9100('0x26')](_0x4faff7[_0x9100('0x26')]);return db[_0x9100('0x9c')][_0x9100('0x3f')](_0x4017a1[_0x9100('0x9d')](),_0x1ae02c);})[_0x9100('0x2b')](function(_0xad4f3e){if(_0xad4f3e[_0x9100('0x44')]>0x0)_0x211235[_0x9100('0x48')]('ui.WhatsappInteractionId\x20IN\x20?',_['map'](_0xad4f3e,'id'));return db[_0x9100('0x9c')][_0x9100('0x3f')](_0x211235[_0x9100('0x9d')](),_0x1ae02c)[_0x9100('0x2b')](function(_0x2e28cb){var _0x49754b=_[_0x9100('0xb3')](_0x2e28cb,'WhatsappInteractionId');var _0x3be406=[];_0xad4f3e[_0x9100('0x35')](function(_0x3c7c54){_0x3be406[_0x9100('0x36')](updateWhatsappInteraction(_0x3c7c54,_0x785d32,_0x49754b));});return BPromise[_0x9100('0xb4')](_0x3be406);});});})[_0x9100('0x2b')](function(_0x2bfc66){_0x1fc311['rows']=_0x2bfc66;return _0x1fc311;})[_0x9100('0x2b')](respondWithFilteredResult(_0x57d8ea,_0x4faff7))[_0x9100('0x37')](handleError(_0x57d8ea,null));};exports[_0x9100('0xb5')]=function(_0x123f72,_0x5257ba){var _0x1b8881={'raw':![],'where':{'id':_0x123f72[_0x9100('0xb6')]['id']}},_0x59d508={};_0x59d508[_0x9100('0x3d')]=_[_0x9100('0x75')](db[_0x9100('0x9f')][_0x9100('0x39')]);_0x59d508[_0x9100('0x3f')]=_[_0x9100('0x75')](_0x123f72[_0x9100('0x3f')]);_0x59d508['filters']=_['intersection'](_0x59d508[_0x9100('0x3d')],_0x59d508['query']);_0x1b8881[_0x9100('0x43')]=_[_0x9100('0x41')](_0x59d508[_0x9100('0x3d')],qs[_0x9100('0x42')](_0x123f72[_0x9100('0x3f')]['fields']));_0x1b8881[_0x9100('0x43')]=_0x1b8881[_0x9100('0x43')]['length']?_0x1b8881[_0x9100('0x43')]:_0x59d508[_0x9100('0x3d')];if(_0x123f72[_0x9100('0x3f')][_0x9100('0xb7')]){_0x1b8881[_0x9100('0xb8')]=[{'all':!![]}];}_0x1b8881=_[_0x9100('0xb9')]({},_0x1b8881,_0x123f72[_0x9100('0xba')]);return db[_0x9100('0x9f')][_0x9100('0x62')](_0x1b8881)['then'](handleEntityNotFound(_0x5257ba,null))['then'](respondWithResult(_0x5257ba,null))['catch'](handleError(_0x5257ba,null));};exports['create']=function(_0x1df1f5,_0x1a483c){return db[_0x9100('0x9f')]['create'](_0x1df1f5[_0x9100('0x74')],{})['then'](respondWithResult(_0x1a483c,0xc9))['catch'](handleError(_0x1a483c,null));};exports['update']=function(_0x3ac563,_0x1e71b){if(_0x3ac563[_0x9100('0x74')]['id']){delete _0x3ac563[_0x9100('0x74')]['id'];}return db[_0x9100('0x9f')]['find']({'where':{'id':_0x3ac563[_0x9100('0xb6')]['id']}})[_0x9100('0x2b')](handleEntityNotFound(_0x1e71b,null))[_0x9100('0x2b')](saveUpdates(_0x3ac563[_0x9100('0x74')],null))[_0x9100('0x2b')](respondWithResult(_0x1e71b,null))[_0x9100('0x37')](handleError(_0x1e71b,null));};exports['destroy']=function(_0x4f27be,_0x7b240){return db[_0x9100('0x9f')][_0x9100('0x62')]({'where':{'id':_0x4f27be[_0x9100('0xb6')]['id']}})['then'](handleEntityNotFound(_0x7b240,null))[_0x9100('0x2b')](removeEntity(_0x7b240,null))[_0x9100('0x37')](handleError(_0x7b240,null));};exports[_0x9100('0xbb')]=function(_0x1f09a9,_0x3e4f53){return db[_0x9100('0x9f')][_0x9100('0xbb')]()[_0x9100('0x2b')](respondWithResult(_0x3e4f53,null))[_0x9100('0x37')](handleError(_0x3e4f53,null));};exports[_0x9100('0xbc')]=function(_0x492886,_0x39afa4,_0x58b40c){return db['WhatsappMessage'][_0x9100('0x62')]({'where':{'id':_0x492886['params']['id']}})[_0x9100('0x2b')](handleEntityNotFound(_0x39afa4,null))[_0x9100('0x2b')](function(_0x2d8547){if(_0x2d8547){return _0x2d8547['addMessage'](_0x492886[_0x9100('0x74')][_0x9100('0xbd')],_['omit'](_0x492886[_0x9100('0x74')],[_0x9100('0xbd'),'id'])||{});}})[_0x9100('0x2b')](respondWithResult(_0x39afa4,null))['catch'](handleError(_0x39afa4,null));};exports[_0x9100('0xbe')]=function(_0x30fdca,_0x5e5138,_0x4f99c4){var _0x3f315b={'raw':![],'where':{}};var _0x5b234b={};var _0x303367={'count':0x0,'rows':[]};return db[_0x9100('0x9f')]['findOne']({'where':{'id':_0x30fdca[_0x9100('0xb6')]['id']}})[_0x9100('0x2b')](handleEntityNotFound(_0x5e5138,null))[_0x9100('0x2b')](function(_0x491fc7){if(_0x491fc7){_0x5b234b['model']=_[_0x9100('0x75')](db[_0x9100('0xbf')][_0x9100('0x39')]);_0x5b234b[_0x9100('0x3f')]=_['keys'](_0x30fdca[_0x9100('0x3f')]);_0x5b234b['filters']=_['intersection'](_0x5b234b['model'],_0x5b234b['query']);_0x3f315b[_0x9100('0x43')]=_['intersection'](_0x5b234b[_0x9100('0x3d')],qs[_0x9100('0x42')](_0x30fdca['query']['fields']));_0x3f315b[_0x9100('0x43')]=_0x3f315b[_0x9100('0x43')][_0x9100('0x44')]?_0x3f315b['attributes']:_0x5b234b['model'];if(!_0x30fdca[_0x9100('0x3f')][_0x9100('0x45')](_0x9100('0x46'))){_0x3f315b[_0x9100('0x23')]=qs[_0x9100('0x23')](_0x30fdca[_0x9100('0x3f')][_0x9100('0x23')]);_0x3f315b[_0x9100('0x26')]=qs[_0x9100('0x26')](_0x30fdca[_0x9100('0x3f')]['offset']);}_0x3f315b['order']=qs['sort'](_0x30fdca[_0x9100('0x3f')][_0x9100('0x47')]);_0x3f315b['where']=qs[_0x9100('0x40')](_['pick'](_0x30fdca[_0x9100('0x3f')],_0x5b234b[_0x9100('0x40')]));_0x3f315b[_0x9100('0x48')][_0x9100('0xc0')]=_0x491fc7['id'];if(_0x30fdca[_0x9100('0x3f')][_0x9100('0x86')]){_0x3f315b['where']=_['merge'](_0x3f315b[_0x9100('0x48')],{'$or':_[_0x9100('0x3e')](_0x3f315b[_0x9100('0x43')],function(_0x3ba560){var _0x5b93f0={};_0x5b93f0[_0x3ba560]={'$like':'%'+_0x30fdca[_0x9100('0x3f')][_0x9100('0x86')]+'%'};return _0x5b93f0;})});}if(_0x30fdca[_0x9100('0x3f')][_0x9100('0x7b')]){var _0x54a7df=_0x30fdca[_0x9100('0x3f')][_0x9100('0x7b')]['split'](',');var _0x32ac94={};_0x32ac94[_0x54a7df[0x0]]={'$gte':moment(_0x54a7df[0x1])[_0x9100('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3f315b['where']=_[_0x9100('0xb9')](_0x3f315b[_0x9100('0x48')],_0x32ac94);}_0x3f315b=_[_0x9100('0xb9')]({},_0x3f315b,_0x30fdca[_0x9100('0xba')]);return db['WhatsappMessage'][_0x9100('0x25')]({'where':_0x3f315b[_0x9100('0x48')]})[_0x9100('0x2b')](function(_0x4fc432){_0x303367[_0x9100('0x25')]=_0x4fc432;if(_0x30fdca[_0x9100('0x3f')][_0x9100('0xb7')]){_0x3f315b[_0x9100('0xb8')]=[{'all':!![]}];}return db[_0x9100('0xbf')][_0x9100('0xc2')](_0x3f315b);})['then'](function(_0x30aa37){_0x303367[_0x9100('0xc3')]=_0x30aa37;return _0x303367;});}})['then'](respondWithFilteredResult(_0x5e5138,_0x3f315b))[_0x9100('0x37')](handleError(_0x5e5138,null));};exports[_0x9100('0xc4')]=function(_0x9838cc,_0x4f8f66,_0x337e0f){return db[_0x9100('0x9f')][_0x9100('0x62')]({'where':{'id':_0x9838cc[_0x9100('0xb6')]['id']}})[_0x9100('0x2b')](handleEntityNotFound(_0x4f8f66,null))['then'](function(_0x1a8c5c){if(_0x1a8c5c){return _0x1a8c5c[_0x9100('0xc5')](_0x9838cc[_0x9100('0x74')][_0x9100('0xbd')],_['omit'](_0x9838cc[_0x9100('0x74')],[_0x9100('0xbd'),'id'])||{})[_0x9100('0xc6')](function(){return db[_0x9100('0xc7')][_0x9100('0xc2')]({'attributes':['id',_0x9100('0x2e'),_0x9100('0xc8')],'where':{'id':_0x9838cc['body']['ids']}});})[_0x9100('0x2b')](function(_0x147b5a){socket['emit'](_0x9100('0xc9'),{'id':Number(_0x9838cc[_0x9100('0xb6')]['id']),'tags':_0x147b5a||[]});return{'id':Number(_0x9838cc[_0x9100('0xb6')]['id']),'tags':_0x147b5a||[]};});}})[_0x9100('0x2b')](respondWithResult(_0x4f8f66,null))[_0x9100('0x37')](handleError(_0x4f8f66,null));};exports[_0x9100('0xca')]=function(_0x5a2462,_0x259b5f,_0x4c0683){return db['WhatsappInteraction']['find']({'where':{'id':_0x5a2462[_0x9100('0xb6')]['id']}})[_0x9100('0x2b')](handleEntityNotFound(_0x259b5f,null))[_0x9100('0x2b')](function(_0x151f28){if(_0x151f28){return _0x151f28[_0x9100('0xca')](_0x5a2462[_0x9100('0x3f')][_0x9100('0xbd')]);}})[_0x9100('0x2b')](respondWithStatusCode(_0x259b5f,null))[_0x9100('0x37')](handleError(_0x259b5f,null));};exports[_0x9100('0xcb')]=function(_0x409fd8,_0xdece45){var _0x117dec=moment()[_0x9100('0xcc')]()['toString']();var _0x3f3782=path[_0x9100('0xcd')](config[_0x9100('0xce')],_0x9100('0xcf'),_0x9100('0xd0'),_0x9100('0xd1'));var _0x536b72=path[_0x9100('0xcd')](config[_0x9100('0xce')],'server','files',_0x9100('0xd2'));var _0x5e0361=path[_0x9100('0xcd')](_0x3f3782,_0x117dec);var _0x22bea7=util[_0x9100('0xc1')]('transcript-%d-%s.zip',_0x409fd8[_0x9100('0xb6')]['id'],_0x117dec);var _0x4ff3be=path['join'](_0x3f3782,_0x22bea7);var _0x2b1302=[];_0x2b1302[_0x9100('0x36')]({'model':db['User'],'as':_0x9100('0x70'),'attributes':['id',_0x9100('0x31')],'raw':!![]});_0x2b1302['push']({'model':db[_0x9100('0xd3')],'as':'Contact','attributes':['id',_0x9100('0xd4'),_0x9100('0xd5')],'raw':!![]});if(_0x409fd8[_0x9100('0x3f')][_0x9100('0xd2')]){_0x2b1302[_0x9100('0x36')]({'model':db[_0x9100('0xd6')],'as':_0x9100('0xd6'),'raw':!![]});}var _0x3aeaba=[{'model':db[_0x9100('0xbf')],'as':_0x9100('0xd7'),'attributes':['id',_0x9100('0x74'),'createdAt',_0x9100('0xd8'),_0x9100('0xd9'),'read'],'include':_0x2b1302}];_0x3aeaba[_0x9100('0x36')]({'model':db['WhatsappAccount'],'as':_0x9100('0xda'),'attributes':['id',_0x9100('0x2e')]});_0x3aeaba[_0x9100('0x36')]({'model':db['User'],'as':_0x9100('0xdb'),'attributes':['id',_0x9100('0x31')]});return db['WhatsappInteraction'][_0x9100('0x62')]({'where':{'id':_0x409fd8[_0x9100('0xb6')]['id']},'include':_0x3aeaba})[_0x9100('0x2b')](handleEntityNotFound(_0xdece45,null))[_0x9100('0x2b')](function(_0x5b826a){if(_0x5b826a){var _0x2b464d=_0x5b826a[_0x9100('0xdc')]({'plain':!![]});fs[_0x9100('0xdd')](_0x5e0361);var _0x1b2733={'channel':_0x9100('0xde'),'account':_0x2b464d[_0x9100('0xda')][_0x9100('0x2e')],'agent':_0x2b464d['Owner']?_0x2b464d[_0x9100('0xdb')][_0x9100('0x31')]:_0x9100('0xdf'),'createdAt':moment(_0x2b464d['createdAt'])[_0x9100('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9100('0x9d')](),'closedAt':_0x2b464d[_0x9100('0xe0')]?moment(_0x2b464d[_0x9100('0xe1')])[_0x9100('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9100('0x9d')]():'','disposition':_0x2b464d[_0x9100('0xe2')],'messages':_(_0x2b464d[_0x9100('0xd7')])[_0x9100('0x86')]({'secret':![]})[_0x9100('0x3e')](function(_0x5f0077){if(_0x5f0077['Attachment']){var _0x4456a8=path['join'](_0x536b72,_0x5f0077[_0x9100('0xd6')][_0x9100('0xe3')]);if(fs[_0x9100('0xe4')](_0x4456a8)){fs['createReadStream'](_0x4456a8)[_0x9100('0xe5')](fs['createWriteStream'](path[_0x9100('0xcd')](_0x5e0361,_0x5f0077[_0x9100('0xd6')][_0x9100('0xe3')])));}}return{'date':moment(_0x5f0077[_0x9100('0x79')])[_0x9100('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9100('0x9d')](),'sender':_0x5f0077[_0x9100('0xd8')]==='out'?_0x5f0077['User']?_0x5f0077['User'][_0x9100('0x31')]:_0x9100('0xe6'):_0x5f0077[_0x9100('0xe7')]['firstName']+(_0x5f0077[_0x9100('0xe7')][_0x9100('0xd5')]?'\x20'+_0x5f0077[_0x9100('0xe7')][_0x9100('0xd5')]:''),'body':_0x5f0077['Attachment']?_0x5f0077[_0x9100('0xd6')]['basename']:_0x5f0077[_0x9100('0x74')],'direction':_0x5f0077[_0x9100('0xd8')]===_0x9100('0xe8')?'A':'C','secret':_0x5f0077[_0x9100('0xd9')],'read':_0x5f0077[_0x9100('0x81')],'attachment':_0x5f0077[_0x9100('0xd6')]};})[_0x9100('0x64')]()};return ejs[_0x9100('0xe9')](path['join'](config[_0x9100('0xce')],_0x9100('0xcf'),'views','downloadInteraction.html'),{'interaction':_0x1b2733})[_0x9100('0x2b')](function(_0x27df50){var _0x48b7d1=path[_0x9100('0xcd')](_0x5e0361,'transcript-'+_0x2b464d['id']+'-'+_0x117dec+_0x9100('0xea'));var _0x512a35={'path':_0x48b7d1,'channel':_0x9100('0xde'),'interactionId':_0x2b464d['id']};return pdf['createPdfFromHTML'](_0x27df50,_0x512a35);})['then'](function(){return new BPromise(function(_0x3c903b,_0x1c61c6){zipdir(_0x5e0361,{'saveTo':_0x4ff3be},function(_0x31e8dc,_0x309ee1){if(_0x31e8dc)return _0x1c61c6(_0x31e8dc);return _0x3c903b(_0x309ee1);});})[_0x9100('0x2b')](function(){return new BPromise(function(_0x194341,_0x3f699b){rimraf(_0x5e0361,function(_0x160b21){if(_0x160b21)_0x3f699b(_0x160b21);return _0x194341();});});})[_0x9100('0x2b')](function(){return _0xdece45['download'](_0x4ff3be,_0x22bea7,function(_0x355fb6){if(_0x355fb6){console[_0x9100('0xeb')]('err',_0x355fb6);}else{fs['unlinkSync'](_0x4ff3be);}});});});}else{return _0xdece45[_0x9100('0x1f')](0xc8);}})['catch'](handleError(_0xdece45,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index be1880d..d4a0966 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.events.js +++ b/server/api/whatsappInteraction/whatsappInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x10e9=['getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10e9,0x1ba));var _0x910e=function(_0x5d64f3,_0x374d1a){_0x5d64f3=_0x5d64f3-0x0;var _0x2e5c81=_0x10e9[_0x5d64f3];return _0x2e5c81;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0x910e('0x0')];var WhatsappMessage=require(_0x910e('0x1'))['db'][_0x910e('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x910e('0x3')](0x0);var events={'afterCreate':_0x910e('0x4'),'afterUpdate':_0x910e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x26bfbc){return function(_0x1a5fe6,_0x2fc927,_0x27afec){_0x1a5fe6[_0x910e('0x6')]({'attributes':['id'],'raw':!![]})[_0x910e('0x7')](function(_0x3ba42a){_0x1a5fe6[_0x910e('0x8')](_0x910e('0x9'),_0x3ba42a[_0x910e('0xa')](function(_0x418e36){return{'id':_0x418e36['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x1a5fe6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x910e('0x7')](function(_0x4009f1){_0x1a5fe6[_0x910e('0x8')](_0x910e('0xb'),_0x4009f1[_0x910e('0xc')]);WhatsappInteractionEvents[_0x910e('0xd')](_0x26bfbc+':'+_0x1a5fe6['id'],_0x1a5fe6);WhatsappInteractionEvents[_0x910e('0xd')](_0x26bfbc,_0x1a5fe6);_0x27afec(null);})[_0x910e('0xe')](_0x27afec(null));};}for(var e in events){if(events[_0x910e('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x2678=['then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','update','remove','getUsers'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x2678,0x13b));var _0x8267=function(_0xf1227,_0x40f6e6){_0xf1227=_0xf1227-0x0;var _0x1271d3=_0x2678[_0xf1227];return _0x1271d3;};'use strict';var EventEmitter=require(_0x8267('0x0'));var WhatsappInteraction=require(_0x8267('0x1'))['db'][_0x8267('0x2')];var WhatsappMessage=require(_0x8267('0x1'))['db'][_0x8267('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x8267('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8267('0x5'),'afterDestroy':_0x8267('0x6')};function emitEvent(_0x2f24e1){return function(_0x179d4d,_0x4674b2,_0x56f7cf){_0x179d4d[_0x8267('0x7')]({'attributes':['id'],'raw':!![]})[_0x8267('0x8')](function(_0x44bb76){_0x179d4d[_0x8267('0x9')](_0x8267('0xa'),_0x44bb76[_0x8267('0xb')](function(_0x6337){return{'id':_0x6337['id']};}));return WhatsappMessage[_0x8267('0xc')]({'where':{'WhatsappInteractionId':_0x179d4d['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3e3e91){_0x179d4d['setDataValue'](_0x8267('0xd'),_0x3e3e91[_0x8267('0xe')]);WhatsappInteractionEvents[_0x8267('0xf')](_0x2f24e1+':'+_0x179d4d['id'],_0x179d4d);WhatsappInteractionEvents[_0x8267('0xf')](_0x2f24e1,_0x179d4d);_0x56f7cf(null);})[_0x8267('0x10')](_0x56f7cf(null));};}for(var e in events){if(events[_0x8267('0x11')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x8267('0x12')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 43faa72..9217a90 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.model.js +++ b/server/api/whatsappInteraction/whatsappInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x98ad=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','changed','closed','format'];(function(_0x8bcb91,_0x593bd8){var _0x1c5bf8=function(_0x28decf){while(--_0x28decf){_0x8bcb91['push'](_0x8bcb91['shift']());}};_0x1c5bf8(++_0x593bd8);}(_0x98ad,0x15e));var _0xd98a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x98ad[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xd98a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd98a('0x1'));var moment=require(_0xd98a('0x2'));var BPromise=require(_0xd98a('0x3'));var rp=require(_0xd98a('0x4'));var fs=require('fs');var path=require(_0xd98a('0x5'));var rimraf=require('rimraf');var config=require(_0xd98a('0x6'));var attributes=require(_0xd98a('0x7'));module[_0xd98a('0x8')]=function(_0x2cf72c,_0x3d892){return _0x2cf72c[_0xd98a('0x9')](_0xd98a('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e7b1e,_0x1d6ca9,_0xfd2111){if(_0x4e7b1e[_0xd98a('0xb')](_0xd98a('0xc'))){_0x4e7b1e['closedAt']=moment()[_0xd98a('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0xfd2111(null,_0x4e7b1e);}}});}; \ No newline at end of file +var _0xf2cd=['rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise'];(function(_0x35b7d4,_0x5a5c43){var _0x4e8cee=function(_0x66859c){while(--_0x66859c){_0x35b7d4['push'](_0x35b7d4['shift']());}};_0x4e8cee(++_0x5a5c43);}(_0xf2cd,0x15b));var _0xdf2c=function(_0x118653,_0x50ef26){_0x118653=_0x118653-0x0;var _0xc11fa6=_0xf2cd[_0x118653];return _0xc11fa6;};'use strict';var _=require(_0xdf2c('0x0'));var util=require('util');var logger=require(_0xdf2c('0x1'))(_0xdf2c('0x2'));var moment=require(_0xdf2c('0x3'));var BPromise=require('bluebird');var rp=require(_0xdf2c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdf2c('0x5'));var config=require(_0xdf2c('0x6'));var attributes=require(_0xdf2c('0x7'));module[_0xdf2c('0x8')]=function(_0xb32c88,_0x28505a){return _0xb32c88[_0xdf2c('0x9')](_0xdf2c('0xa'),attributes,{'tableName':_0xdf2c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d9a97,_0x1a25c9,_0x35261c){if(_0x3d9a97[_0xdf2c('0xc')](_0xdf2c('0xd'))){_0x3d9a97['closedAt']=moment()[_0xdf2c('0xe')](_0xdf2c('0xf'));}_0x35261c(null,_0x3d9a97);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index e168fc5..8480820 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.rpc.js +++ b/server/api/whatsappInteraction/whatsappInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9aeb=['body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','addTags','omit','ids','AddTags','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9aeb,0x16a));var _0xb9ae=function(_0x2998e2,_0x2bd70e){_0x2998e2=_0x2998e2-0x0;var _0x4e5d19=_0x9aeb[_0x2998e2];return _0x4e5d19;};'use strict';var _=require(_0xb9ae('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb9ae('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9ae('0x2'))['db'];var utils=require(_0xb9ae('0x3'));var logger=require(_0xb9ae('0x4'))(_0xb9ae('0x5'));var config=require(_0xb9ae('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb9ae('0x7')]['http']({'port':0x232a});config[_0xb9ae('0x8')]=_[_0xb9ae('0x9')](config[_0xb9ae('0x8')],{'host':_0xb9ae('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb9ae('0x8')]));require(_0xb9ae('0xb'))[_0xb9ae('0xc')](socket);function respondWithRpcPromise(_0x1d0814,_0x57fe5f,_0x4c392d){return new BPromise(function(_0x1ac034,_0x206f86){return client[_0xb9ae('0xd')](_0x1d0814,_0x4c392d)[_0xb9ae('0xe')](function(_0xeaea4a){logger[_0xb9ae('0xf')](_0xb9ae('0x10'),_0x57fe5f,_0xb9ae('0x11'));logger[_0xb9ae('0x12')](_0xb9ae('0x13'),_0x57fe5f,_0xb9ae('0x11'),JSON[_0xb9ae('0x14')](_0xeaea4a));if(_0xeaea4a[_0xb9ae('0x15')]){if(_0xeaea4a[_0xb9ae('0x15')][_0xb9ae('0x16')]===0x1f4){logger[_0xb9ae('0x15')](_0xb9ae('0x10'),_0x57fe5f,_0xeaea4a[_0xb9ae('0x15')][_0xb9ae('0x17')]);return _0x206f86(_0xeaea4a[_0xb9ae('0x15')][_0xb9ae('0x17')]);}logger[_0xb9ae('0x15')](_0xb9ae('0x10'),_0x57fe5f,_0xeaea4a[_0xb9ae('0x15')][_0xb9ae('0x17')]);return _0x1ac034(_0xeaea4a[_0xb9ae('0x15')][_0xb9ae('0x17')]);}else{logger[_0xb9ae('0xf')](_0xb9ae('0x10'),_0x57fe5f,_0xb9ae('0x11'));_0x1ac034(_0xeaea4a['result']['message']);}})[_0xb9ae('0x18')](function(_0x4a8792){logger[_0xb9ae('0x15')](_0xb9ae('0x10'),_0x57fe5f,_0x4a8792);_0x206f86(_0x4a8792);});});}exports[_0xb9ae('0x19')]=function(_0x5d67ca){var _0x23711d=this;return new Promise(function(_0x4b8199,_0x5b21d8){return db[_0xb9ae('0x1a')][_0xb9ae('0x1b')](_0x5d67ca[_0xb9ae('0x1c')],{'raw':_0x5d67ca['options']?_0x5d67ca[_0xb9ae('0x1d')][_0xb9ae('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d67ca[_0xb9ae('0x1d')]?_0x5d67ca[_0xb9ae('0x1d')][_0xb9ae('0x1f')]||null:null,'attributes':_0x5d67ca[_0xb9ae('0x1d')]?_0x5d67ca[_0xb9ae('0x1d')][_0xb9ae('0x20')]||null:null,'limit':_0x5d67ca[_0xb9ae('0x1d')]?_0x5d67ca['options'][_0xb9ae('0x21')]||null:null})[_0xb9ae('0xe')](function(_0x31a291){logger[_0xb9ae('0xf')](_0xb9ae('0x19'),_0x5d67ca);logger[_0xb9ae('0x12')](_0xb9ae('0x19'),_0x5d67ca,JSON[_0xb9ae('0x14')](_0x31a291));_0x4b8199(_0x31a291);})[_0xb9ae('0x18')](function(_0x4ef9b7){logger[_0xb9ae('0x15')](_0xb9ae('0x19'),_0x4ef9b7[_0xb9ae('0x17')],_0x5d67ca);_0x5b21d8(_0x23711d[_0xb9ae('0x15')](0x1f4,_0x4ef9b7[_0xb9ae('0x17')]));});});};exports[_0xb9ae('0x22')]=function(_0x1dfc6e){return new Promise(function(_0x507fdb,_0x135a2f){return db[_0xb9ae('0x1a')]['find']({'where':_0x1dfc6e[_0xb9ae('0x1d')]?_0x1dfc6e['options'][_0xb9ae('0x1f')]||null:null})[_0xb9ae('0xe')](function(_0x3dc76d){if(_0x3dc76d){return _0x3dc76d[_0xb9ae('0x23')](_0x1dfc6e['body']['ids'],_[_0xb9ae('0x24')](_0x1dfc6e[_0xb9ae('0x1c')],[_0xb9ae('0x25'),'id'])||{});}})['spread'](function(_0x43d438){logger[_0xb9ae('0xf')]('AddTags',_0x1dfc6e);logger['debug'](_0xb9ae('0x26'),_0x1dfc6e,JSON[_0xb9ae('0x14')](_0x43d438));_0x507fdb(_0x43d438);})['catch'](function(_0x25e4b3){logger[_0xb9ae('0x15')]('AddTags',_0x25e4b3[_0xb9ae('0x17')],_0x1dfc6e);_0x135a2f(_this[_0xb9ae('0x15')](0x1f4,_0x25e4b3[_0xb9ae('0x17')]));});});}; \ No newline at end of file +var _0xc155=['error','code','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','attributes','limit','then','catch','AddTagsToWhatsappInteraction','find','addTags','body','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2eefa0,_0x5c8180){var _0x3b0ac8=function(_0x11269c){while(--_0x11269c){_0x2eefa0['push'](_0x2eefa0['shift']());}};_0x3b0ac8(++_0x5c8180);}(_0xc155,0x148));var _0x5c15=function(_0x11b612,_0x4c0daf){_0x11b612=_0x11b612-0x0;var _0x2422c7=_0xc155[_0x11b612];return _0x2422c7;};'use strict';var _=require(_0x5c15('0x0'));var util=require(_0x5c15('0x1'));var moment=require(_0x5c15('0x2'));var BPromise=require(_0x5c15('0x3'));var rs=require(_0x5c15('0x4'));var fs=require('fs');var Redis=require(_0x5c15('0x5'));var db=require(_0x5c15('0x6'))['db'];var utils=require(_0x5c15('0x7'));var logger=require(_0x5c15('0x8'))(_0x5c15('0x9'));var config=require('../../config/environment');var jayson=require(_0x5c15('0xa'));var client=jayson[_0x5c15('0xb')][_0x5c15('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5c15('0xd')],{'host':_0x5c15('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5c15('0xd')]));require(_0x5c15('0xf'))[_0x5c15('0x10')](socket);function respondWithRpcPromise(_0x16972f,_0x291cb2,_0x3e5a1b){return new BPromise(function(_0x34d5d2,_0x19fba2){return client[_0x5c15('0x11')](_0x16972f,_0x3e5a1b)['then'](function(_0x2f549e){logger[_0x5c15('0x12')](_0x5c15('0x13'),_0x291cb2,_0x5c15('0x14'));logger[_0x5c15('0x15')](_0x5c15('0x16'),_0x291cb2,_0x5c15('0x14'),JSON[_0x5c15('0x17')](_0x2f549e));if(_0x2f549e[_0x5c15('0x18')]){if(_0x2f549e[_0x5c15('0x18')][_0x5c15('0x19')]===0x1f4){logger[_0x5c15('0x18')](_0x5c15('0x13'),_0x291cb2,_0x2f549e[_0x5c15('0x18')][_0x5c15('0x1a')]);return _0x19fba2(_0x2f549e[_0x5c15('0x18')][_0x5c15('0x1a')]);}logger[_0x5c15('0x18')](_0x5c15('0x13'),_0x291cb2,_0x2f549e['error'][_0x5c15('0x1a')]);return _0x34d5d2(_0x2f549e[_0x5c15('0x18')][_0x5c15('0x1a')]);}else{logger[_0x5c15('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x291cb2,_0x5c15('0x14'));_0x34d5d2(_0x2f549e[_0x5c15('0x1b')]['message']);}})['catch'](function(_0x2c4f76){logger['error'](_0x5c15('0x13'),_0x291cb2,_0x2c4f76);_0x19fba2(_0x2c4f76);});});}exports[_0x5c15('0x1c')]=function(_0xdd0d9f){var _0x534c8c=this;return new Promise(function(_0xf69724,_0x2d2b49){return db[_0x5c15('0x1d')][_0x5c15('0x1e')](_0xdd0d9f['body'],{'raw':_0xdd0d9f[_0x5c15('0x1f')]?_0xdd0d9f[_0x5c15('0x1f')][_0x5c15('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdd0d9f[_0x5c15('0x1f')]?_0xdd0d9f[_0x5c15('0x1f')][_0x5c15('0x21')]||null:null,'attributes':_0xdd0d9f[_0x5c15('0x1f')]?_0xdd0d9f[_0x5c15('0x1f')][_0x5c15('0x22')]||null:null,'limit':_0xdd0d9f[_0x5c15('0x1f')]?_0xdd0d9f[_0x5c15('0x1f')][_0x5c15('0x23')]||null:null})[_0x5c15('0x24')](function(_0x2cc3d9){logger[_0x5c15('0x12')]('UpdateWhatsappInteraction',_0xdd0d9f);logger['debug'](_0x5c15('0x1c'),_0xdd0d9f,JSON[_0x5c15('0x17')](_0x2cc3d9));_0xf69724(_0x2cc3d9);})[_0x5c15('0x25')](function(_0x4e5805){logger['error'](_0x5c15('0x1c'),_0x4e5805[_0x5c15('0x1a')],_0xdd0d9f);_0x2d2b49(_0x534c8c['error'](0x1f4,_0x4e5805[_0x5c15('0x1a')]));});});};exports[_0x5c15('0x26')]=function(_0x2afc71){return new Promise(function(_0x34bba5,_0x3cc3fb){return db['WhatsappInteraction'][_0x5c15('0x27')]({'where':_0x2afc71['options']?_0x2afc71[_0x5c15('0x1f')]['where']||null:null})['then'](function(_0x16ad6f){if(_0x16ad6f){return _0x16ad6f[_0x5c15('0x28')](_0x2afc71[_0x5c15('0x29')][_0x5c15('0x2a')],_['omit'](_0x2afc71[_0x5c15('0x29')],['ids','id'])||{});}})['spread'](function(_0x11db42){logger[_0x5c15('0x12')](_0x5c15('0x2b'),_0x2afc71);logger[_0x5c15('0x15')](_0x5c15('0x2b'),_0x2afc71,JSON[_0x5c15('0x17')](_0x11db42));_0x34bba5(_0x11db42);})[_0x5c15('0x25')](function(_0x39ac3e){logger['error']('AddTags',_0x39ac3e[_0x5c15('0x1a')],_0x2afc71);_0x3cc3fb(_this[_0x5c15('0x18')](0x1f4,_0x39ac3e[_0x5c15('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index be300cb..28eae3c 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.socket.js +++ b/server/api/whatsappInteraction/whatsappInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x456f=['save','remove','update','removeListener','register','length','./whatsappInteraction.events'];(function(_0x29f014,_0x508522){var _0x316be5=function(_0x1753a5){while(--_0x1753a5){_0x29f014['push'](_0x29f014['shift']());}};_0x316be5(++_0x508522);}(_0x456f,0x6f));var _0xf456=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x456f[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappInteractionEvents=require(_0xf456('0x0'));var events=[_0xf456('0x1'),_0xf456('0x2'),_0xf456('0x3')];function createListener(_0x314970,_0x58e83a){return function(_0xbe558e){_0x58e83a['emit'](_0x314970,_0xbe558e);};}function removeListener(_0x2b9daf,_0x5f2ae4){return function(){WhatsappInteractionEvents[_0xf456('0x4')](_0x2b9daf,_0x5f2ae4);};}exports[_0xf456('0x5')]=function(_0x44d2e0){for(var _0x53ef2a=0x0,_0x43a7fc=events[_0xf456('0x6')];_0x53ef2a<_0x43a7fc;_0x53ef2a++){var _0x1abbc6=events[_0x53ef2a];var _0x29b9d0=createListener('whatsappInteraction:'+_0x1abbc6,_0x44d2e0);WhatsappInteractionEvents['on'](_0x1abbc6,_0x29b9d0);}}; \ No newline at end of file +var _0xb47a=['removeListener','register','length','remove','emit'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xb47a,0x76));var _0xab47=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xb47a[_0x16b9ed];return _0x66b1f8;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0xab47('0x0'),'update'];function createListener(_0x55ebf9,_0x61e353){return function(_0x3f37a1){_0x61e353[_0xab47('0x1')](_0x55ebf9,_0x3f37a1);};}function removeListener(_0x5bfb1a,_0x2a5e19){return function(){WhatsappInteractionEvents[_0xab47('0x2')](_0x5bfb1a,_0x2a5e19);};}exports[_0xab47('0x3')]=function(_0x333581){for(var _0x1f0afa=0x0,_0x19eec0=events[_0xab47('0x4')];_0x1f0afa<_0x19eec0;_0x1f0afa++){var _0x58b48e=events[_0x1f0afa];var _0x52f13c=createListener('whatsappInteraction:'+_0x58b48e,_0x333581);WhatsappInteractionEvents['on'](_0x58b48e,_0x52f13c);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 21661b2..6825483 100644 --- a/server/api/whatsappMessage/index.js +++ b/server/api/whatsappMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id/accept','accept','reject','destroy','exports','multer','path'];(function(_0x1ac462,_0x3a96a8){var _0x540567=function(_0x4e526c){while(--_0x4e526c){_0x1ac462['push'](_0x1ac462['shift']());}};_0x540567(++_0x3a96a8);}(_0x1cb9,0x14e));var _0x91cb=function(_0x20025c,_0x249995){_0x20025c=_0x20025c-0x0;var _0x4ccb28=_0x1cb9[_0x20025c];return _0x4ccb28;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),interaction[_0x91cb('0x10')](_0x91cb('0x11'),_0x91cb('0x12')),controller[_0x91cb('0x13')]);router[_0x91cb('0xf')](_0x91cb('0x14'),controller[_0x91cb('0x15')]);router['put'](_0x91cb('0xd'),auth[_0x91cb('0x9')](),controller['update']);router[_0x91cb('0x16')](_0x91cb('0x17'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x18')]);router['put']('/:id/reject',auth[_0x91cb('0x9')](),controller[_0x91cb('0x19')]);router['delete']('/:id',auth[_0x91cb('0x9')](),controller[_0x91cb('0x1a')]);module[_0x91cb('0x1b')]=router; \ No newline at end of file +var _0xf3cd=['/:id/reject','reject','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept'];(function(_0x21a95e,_0x4de45e){var _0x828e72=function(_0x5adae3){while(--_0x5adae3){_0x21a95e['push'](_0x21a95e['shift']());}};_0x828e72(++_0x4de45e);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x5f5497,_0x50803a){_0x5f5497=_0x5f5497-0x0;var _0x10e943=_0xf3cd[_0x5f5497];return _0x10e943;};'use strict';var multer=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var timeout=require(_0xdf3c('0x3'));var express=require(_0xdf3c('0x4'));var router=express[_0xdf3c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdf3c('0x6'));var interaction=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var controller=require('./whatsappMessage.controller');router[_0xdf3c('0x9')]('/',auth[_0xdf3c('0xa')](),controller[_0xdf3c('0xb')]);router[_0xdf3c('0x9')](_0xdf3c('0xc'),auth[_0xdf3c('0xa')](),controller['describe']);router[_0xdf3c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0xe')]('/',auth['isAuthenticated'](),interaction[_0xdf3c('0xf')](_0xdf3c('0x10'),_0xdf3c('0x11')),controller[_0xdf3c('0x12')]);router[_0xdf3c('0xe')](_0xdf3c('0x13'),controller[_0xdf3c('0x14')]);router[_0xdf3c('0x15')]('/:id',auth[_0xdf3c('0xa')](),controller[_0xdf3c('0x16')]);router[_0xdf3c('0x15')](_0xdf3c('0x17'),auth['isAuthenticated'](),controller[_0xdf3c('0x18')]);router[_0xdf3c('0x15')](_0xdf3c('0x19'),auth['isAuthenticated'](),controller[_0xdf3c('0x1a')]);router[_0xdf3c('0x1b')](_0xdf3c('0x1c'),auth[_0xdf3c('0xa')](),controller[_0xdf3c('0x1d')]);module[_0xdf3c('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 7f9ee98..815d0f8 100644 --- a/server/api/whatsappMessage/whatsappMessage.attributes.js +++ b/server/api/whatsappMessage/whatsappMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d5e=['sequelize','exports','medium','BOOLEAN','out','STRING','DATE'];(function(_0x507d6b,_0x20dccd){var _0xaddd41=function(_0x371417){while(--_0x371417){_0x507d6b['push'](_0x507d6b['shift']());}};_0xaddd41(++_0x20dccd);}(_0x1d5e,0xe7));var _0xe1d5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1d5e[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xe1d5('0x0'));module[_0xe1d5('0x1')]={'body':{'type':Sequelize['TEXT'](_0xe1d5('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xe1d5('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe1d5('0x4')),'defaultValue':_0xe1d5('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe1d5('0x5')](0xbe)},'phone':{'type':Sequelize[_0xe1d5('0x5')]},'readAt':{'type':Sequelize[_0xe1d5('0x6')]},'secret':{'type':Sequelize[_0xe1d5('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe1d5('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xfe82=['medium','BOOLEAN','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x262087,_0x3bd6ca){var _0x2867f=function(_0x208253){while(--_0x208253){_0x262087['push'](_0x262087['shift']());}};_0x2867f(++_0x3bd6ca);}(_0xfe82,0x9d));var _0x2fe8=function(_0x1a0946,_0x4f40c2){_0x1a0946=_0x1a0946-0x0;var _0x1c179f=_0xfe82[_0x1a0946];return _0x1c179f;};'use strict';var Sequelize=require(_0x2fe8('0x0'));module[_0x2fe8('0x1')]={'body':{'type':Sequelize[_0x2fe8('0x2')](_0x2fe8('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2fe8('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2fe8('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x2fe8('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x2fe8('0x7')]},'secret':{'type':Sequelize[_0x2fe8('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x2fe8('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 7945374..981bcc9 100644 --- a/server/api/whatsappMessage/whatsappMessage.controller.js +++ b/server/api/whatsappMessage/whatsappMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','jayson/promise','client','http','info','WhatsappMessage,\x20%s,\x20%s','debug','error','message','request\x20sent','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','includeAll','find','create','body','describe','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','WhatsappInteractionId','isNil','read1stAt','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','acceptMessage','startsWith','push','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','whatsapp-interactions','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','length','cf_','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x5a596f,_0x776d83){var _0x23a0e9=function(_0x335e32){while(--_0x335e32){_0x5a596f['push'](_0x5a596f['shift']());}};_0x23a0e9(++_0x776d83);}(_0x008c,0x188));var _0xc008=function(_0x3667c4,_0x4b64bd){_0x3667c4=_0x3667c4-0x0;var _0x12a5a2=_0x008c[_0x3667c4];return _0x12a5a2;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));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 Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];config[_0xc008('0x18')]=_[_0xc008('0x19')](config[_0xc008('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc008('0x18')]));require('./whatsappMessage.socket')[_0xc008('0x1a')](socket);var jayson=require(_0xc008('0x1b'));var client=jayson[_0xc008('0x1c')][_0xc008('0x1d')]({'port':0x232c});var client9002=jayson[_0xc008('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e894e,_0x4bd0f4,_0x11ef38,_0x15a6ad){return new BPromise(function(_0x3cafe3,_0x3eb12a){var _0x4fe771=_0x15a6ad||client;return _0x4fe771['request'](_0x5e894e,_0x11ef38)['then'](function(_0x5c2668){logger[_0xc008('0x1e')](_0xc008('0x1f'),_0x4bd0f4,'request\x20sent');logger[_0xc008('0x20')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4bd0f4,'request\x20sent',JSON['stringify'](_0x5c2668));if(_0x5c2668['error']){if(_0x5c2668[_0xc008('0x21')]['code']===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4bd0f4,_0x5c2668['error']['message']);return _0x3eb12a(_0x5c2668[_0xc008('0x21')][_0xc008('0x22')]);}logger[_0xc008('0x21')](_0xc008('0x1f'),_0x4bd0f4,_0x5c2668[_0xc008('0x21')][_0xc008('0x22')]);return _0x3cafe3(_0x5c2668['error'][_0xc008('0x22')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4bd0f4,_0xc008('0x23'));_0x3cafe3(_0x5c2668[_0xc008('0x24')][_0xc008('0x22')]);}})[_0xc008('0x25')](function(_0x5410f5){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4bd0f4,_0x5410f5);_0x3eb12a(_0x5410f5);});});}function respondWithStatusCode(_0x3f7b07,_0x15dade){_0x15dade=_0x15dade||0xcc;return function(_0x92c582){if(_0x92c582){return _0x3f7b07[_0xc008('0x26')](_0x15dade);}return _0x3f7b07['status'](_0x15dade)['end']();};}function respondWithResult(_0x4fce9c,_0x4adbab){_0x4adbab=_0x4adbab||0xc8;return function(_0x4caaf4){if(_0x4caaf4){return _0x4fce9c[_0xc008('0x27')](_0x4adbab)[_0xc008('0x28')](_0x4caaf4);}};}function respondWithFilteredResult(_0x25eae4,_0x529961){return function(_0x24c14c){if(_0x24c14c){var _0x32390d=typeof _0x529961[_0xc008('0x29')]===_0xc008('0x2a')&&typeof _0x529961['limit']===_0xc008('0x2a');var _0x2e0b4e=_0x24c14c['count'];var _0x58db82=_0x32390d?0x0:_0x529961['offset'];var _0x1032b2=_0x32390d?_0x24c14c[_0xc008('0x2b')]:_0x529961[_0xc008('0x29')]+_0x529961[_0xc008('0x2c')];var _0x1de04b;if(_0x1032b2>=_0x2e0b4e){_0x1032b2=_0x2e0b4e;_0x1de04b=0xc8;}else{_0x1de04b=0xce;}_0x25eae4[_0xc008('0x27')](_0x1de04b);return _0x25eae4[_0xc008('0x2d')](_0xc008('0x2e'),_0x58db82+'-'+_0x1032b2+'/'+_0x2e0b4e)[_0xc008('0x28')](_0x24c14c);}return null;};}function patchUpdates(_0x2b862d){return function(_0x2f4b6b){try{jsonpatch[_0xc008('0x2f')](_0x2f4b6b,_0x2b862d,!![]);}catch(_0x596ee8){return BPromise[_0xc008('0x30')](_0x596ee8);}return _0x2f4b6b[_0xc008('0x31')]();};}function saveUpdates(_0x499754,_0xaf4b84){return function(_0x165a7b){if(_0x165a7b){return _0x165a7b[_0xc008('0x32')](_0x499754)[_0xc008('0x33')](function(_0xd0e05a){return _0xd0e05a;});}return null;};}function removeEntity(_0x3cd878,_0x7cfbc5){return function(_0x470e79){if(_0x470e79){return _0x470e79[_0xc008('0x34')]()['then'](function(){_0x3cd878[_0xc008('0x27')](0xcc)[_0xc008('0x35')]();});}};}function handleEntityNotFound(_0x459df4,_0x344bad){return function(_0x40002f){if(!_0x40002f){_0x459df4[_0xc008('0x26')](0x194);}return _0x40002f;};}function handleError(_0x1667a0,_0x5d0e06){_0x5d0e06=_0x5d0e06||0x1f4;return function(_0x35f360){logger[_0xc008('0x21')](_0x35f360['stack']);if(_0x35f360[_0xc008('0x36')]){delete _0x35f360[_0xc008('0x36')];}_0x1667a0['status'](_0x5d0e06)[_0xc008('0x37')](_0x35f360);};}exports[_0xc008('0x38')]=function(_0x280e9b,_0x55ff48){var _0x53b353={},_0x478810={},_0x234f2a={'count':0x0,'rows':[]};var _0x518024=_[_0xc008('0x39')](db[_0xc008('0x3a')][_0xc008('0x3b')],function(_0x440459){return{'name':_0x440459[_0xc008('0x3c')],'type':_0x440459[_0xc008('0x3d')][_0xc008('0x3e')]};});_0x478810[_0xc008('0x3f')]=_[_0xc008('0x39')](_0x518024,_0xc008('0x36'));_0x478810[_0xc008('0x40')]=_[_0xc008('0x41')](_0x280e9b[_0xc008('0x40')]);_0x478810[_0xc008('0x42')]=_['intersection'](_0x478810[_0xc008('0x3f')],_0x478810[_0xc008('0x40')]);_0x53b353[_0xc008('0x43')]=_[_0xc008('0x44')](_0x478810['model'],qs[_0xc008('0x45')](_0x280e9b[_0xc008('0x40')][_0xc008('0x45')]));_0x53b353[_0xc008('0x43')]=_0x53b353[_0xc008('0x43')]['length']?_0x53b353[_0xc008('0x43')]:_0x478810[_0xc008('0x3f')];if(!_0x280e9b[_0xc008('0x40')][_0xc008('0x46')](_0xc008('0x47'))){_0x53b353['limit']=qs[_0xc008('0x2c')](_0x280e9b[_0xc008('0x40')][_0xc008('0x2c')]);_0x53b353[_0xc008('0x29')]=qs['offset'](_0x280e9b[_0xc008('0x40')][_0xc008('0x29')]);}_0x53b353[_0xc008('0x48')]=qs['sort'](_0x280e9b[_0xc008('0x40')]['sort']);_0x53b353[_0xc008('0x49')]=qs['filters'](_[_0xc008('0x4a')](_0x280e9b[_0xc008('0x40')],_0x478810['filters']),_0x518024);if(_0x280e9b[_0xc008('0x40')][_0xc008('0x4b')]){_0x53b353[_0xc008('0x49')]=_['merge'](_0x53b353[_0xc008('0x49')],{'$or':_[_0xc008('0x39')](_0x518024,function(_0x200469){if(_0x200469[_0xc008('0x3d')]!==_0xc008('0x4c')){var _0x372305={};_0x372305[_0x200469['name']]={'$like':'%'+_0x280e9b['query']['filter']+'%'};return _0x372305;}})});}_0x53b353=_[_0xc008('0x4d')]({},_0x53b353,_0x280e9b[_0xc008('0x4e')]);var _0x103a83={'where':_0x53b353[_0xc008('0x49')]};return db[_0xc008('0x3a')][_0xc008('0x2b')](_0x103a83)[_0xc008('0x33')](function(_0x33be4f){_0x234f2a['count']=_0x33be4f;if(_0x280e9b['query']['includeAll']){_0x53b353[_0xc008('0x4f')]=[{'all':!![]}];}return db[_0xc008('0x3a')][_0xc008('0x50')](_0x53b353);})['then'](function(_0x28bc33){_0x234f2a[_0xc008('0x51')]=_0x28bc33;return _0x234f2a;})[_0xc008('0x33')](respondWithFilteredResult(_0x55ff48,_0x53b353))[_0xc008('0x25')](handleError(_0x55ff48,null));};exports[_0xc008('0x52')]=function(_0x56e4ac,_0x17ec90){var _0x405e87={'raw':!![],'where':{'id':_0x56e4ac[_0xc008('0x53')]['id']}},_0x3fd7d9={};_0x3fd7d9['model']=_['keys'](db[_0xc008('0x3a')]['rawAttributes']);_0x3fd7d9[_0xc008('0x40')]=_[_0xc008('0x41')](_0x56e4ac[_0xc008('0x40')]);_0x3fd7d9['filters']=_[_0xc008('0x44')](_0x3fd7d9[_0xc008('0x3f')],_0x3fd7d9[_0xc008('0x40')]);_0x405e87[_0xc008('0x43')]=_[_0xc008('0x44')](_0x3fd7d9['model'],qs[_0xc008('0x45')](_0x56e4ac[_0xc008('0x40')]['fields']));_0x405e87[_0xc008('0x43')]=_0x405e87[_0xc008('0x43')]['length']?_0x405e87['attributes']:_0x3fd7d9[_0xc008('0x3f')];if(_0x56e4ac[_0xc008('0x40')][_0xc008('0x54')]){_0x405e87[_0xc008('0x4f')]=[{'all':!![]}];}_0x405e87=_[_0xc008('0x4d')]({},_0x405e87,_0x56e4ac['options']);return db['WhatsappMessage'][_0xc008('0x55')](_0x405e87)['then'](handleEntityNotFound(_0x17ec90,null))[_0xc008('0x33')](respondWithResult(_0x17ec90,null))[_0xc008('0x25')](handleError(_0x17ec90,null));};exports[_0xc008('0x56')]=function(_0x2f1105,_0x44f42d){return db[_0xc008('0x3a')]['create'](_0x2f1105[_0xc008('0x57')],{})[_0xc008('0x33')](respondWithResult(_0x44f42d,0xc9))[_0xc008('0x25')](handleError(_0x44f42d,null));};exports[_0xc008('0x32')]=function(_0x4424f5,_0x5aa385){if(_0x4424f5[_0xc008('0x57')]['id']){delete _0x4424f5['body']['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x4424f5[_0xc008('0x53')]['id']}})[_0xc008('0x33')](handleEntityNotFound(_0x5aa385,null))[_0xc008('0x33')](saveUpdates(_0x4424f5['body'],null))[_0xc008('0x33')](respondWithResult(_0x5aa385,null))[_0xc008('0x25')](handleError(_0x5aa385,null));};exports[_0xc008('0x34')]=function(_0x47a58b,_0x3587c3){return db[_0xc008('0x3a')][_0xc008('0x55')]({'where':{'id':_0x47a58b[_0xc008('0x53')]['id']}})['then'](handleEntityNotFound(_0x3587c3,null))[_0xc008('0x33')](removeEntity(_0x3587c3,null))['catch'](handleError(_0x3587c3,null));};exports[_0xc008('0x58')]=function(_0x422e1f,_0x2ae14e){return db[_0xc008('0x3a')][_0xc008('0x58')]()[_0xc008('0x33')](respondWithResult(_0x2ae14e,null))['catch'](handleError(_0x2ae14e,null));};var interaction_log=require(_0xc008('0x13'))('whatsapp-interactions');exports['accept']=function(_0x37ce5e,_0x30aa1e,_0x56e755){var _0xb1befa={'agent':{},'channel':_0xc008('0x59')};if(_0x37ce5e[_0xc008('0x57')]['id']){delete _0x37ce5e[_0xc008('0x57')]['id'];}_0x37ce5e[_0xc008('0x57')][_0xc008('0x5a')]=!![];_0x37ce5e[_0xc008('0x57')]['readAt']=moment()[_0xc008('0x5b')](_0xc008('0x5c'));_0x37ce5e[_0xc008('0x57')][_0xc008('0x5d')]=_0x37ce5e[_0xc008('0x57')][_0xc008('0x5d')]||_0x37ce5e[_0xc008('0x5e')]['id'];_0xb1befa[_0xc008('0x5f')]['id']=_0x37ce5e[_0xc008('0x57')][_0xc008('0x5d')];return db[_0xc008('0x3a')][_0xc008('0x55')]({'where':{'id':_0x37ce5e[_0xc008('0x53')]['id'],'UserId':null},'include':[{'model':db[_0xc008('0x60')],'as':'Contact'}]})[_0xc008('0x33')](handleEntityNotFound(_0x30aa1e,null))[_0xc008('0x33')](saveUpdates(_0x37ce5e[_0xc008('0x57')],null))['then'](function(_0xd7d020){if(_0xd7d020){_0xb1befa[_0xc008('0x22')]=_0xd7d020['get']({'plain':!![]});return db['WhatsappInteraction'][_0xc008('0x55')]({'where':{'id':_0xd7d020[_0xc008('0x61')]}});}return null;})[_0xc008('0x33')](handleEntityNotFound(_0x30aa1e,null))[_0xc008('0x33')](function(_0x1a2ce7){if(_0x1a2ce7){return _0x1a2ce7[_0xc008('0x32')]({'UserId':_0x37ce5e[_0xc008('0x57')][_0xc008('0x5d')],'read1stAt':_[_0xc008('0x62')](_0x1a2ce7[_0xc008('0x63')])?moment()[_0xc008('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xc008('0x33')](function(_0x25a52b){if(_0x25a52b){_0xb1befa[_0xc008('0x64')]=_0x25a52b[_0xc008('0x65')]({'plain':!![]});interaction_log['info'](_0xc008('0x66'),_0x37ce5e['user']['id'],_0x37ce5e[_0xc008('0x5e')][_0xc008('0x36')],_0x37ce5e[_0xc008('0x5e')]['role'],_0xb1befa[_0xc008('0x64')]['id'],_0x37ce5e[_0xc008('0x57')]?JSON[_0xc008('0x67')](_0x37ce5e['body']):_0xc008('0x68'));return respondWithRpcPromise('AcceptMessage',_0xc008('0x69'),_0xb1befa);}return null;})[_0xc008('0x33')](function(_0x23012c){return db[_0xc008('0x60')][_0xc008('0x58')]()['then'](function(_0x3c30db){var _0x3f2342=[];for(var _0x49493b=0x0;_0x49493b=_0x2b85a5){_0x17df44=_0x2b85a5;_0x4bdb17=0xc8;}else{_0x4bdb17=0xce;}_0xb1fc63[_0x43e7('0x28')](_0x4bdb17);return _0xb1fc63[_0x43e7('0x2e')](_0x43e7('0x2f'),_0x3bf475+'-'+_0x17df44+'/'+_0x2b85a5)[_0x43e7('0x29')](_0x33a1a5);}return null;};}function patchUpdates(_0x4251c8){return function(_0x4c8650){try{jsonpatch[_0x43e7('0x30')](_0x4c8650,_0x4251c8,!![]);}catch(_0x49b83d){return BPromise[_0x43e7('0x31')](_0x49b83d);}return _0x4c8650[_0x43e7('0x32')]();};}function saveUpdates(_0x4c61b9,_0x5a7342){return function(_0x5e203f){if(_0x5e203f){return _0x5e203f[_0x43e7('0x33')](_0x4c61b9)[_0x43e7('0x1b')](function(_0x117c07){return _0x117c07;});}return null;};}function removeEntity(_0x234fe6,_0x108313){return function(_0xde7ed){if(_0xde7ed){return _0xde7ed['destroy']()['then'](function(){_0x234fe6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e8e86,_0x564f0e){return function(_0x5cb753){if(!_0x5cb753){_0x4e8e86[_0x43e7('0x27')](0x194);}return _0x5cb753;};}function handleError(_0x49cda6,_0x2b4bfd){_0x2b4bfd=_0x2b4bfd||0x1f4;return function(_0x8e9f40){logger[_0x43e7('0x22')](_0x8e9f40[_0x43e7('0x34')]);if(_0x8e9f40[_0x43e7('0x35')]){delete _0x8e9f40[_0x43e7('0x35')];}_0x49cda6[_0x43e7('0x28')](_0x2b4bfd)['send'](_0x8e9f40);};}exports['index']=function(_0x5d84f4,_0xfa0474){var _0xfe70e9={},_0x199ff6={},_0x16cdba={'count':0x0,'rows':[]};var _0x1b1440=_[_0x43e7('0x36')](db[_0x43e7('0x37')][_0x43e7('0x38')],function(_0x55c798){return{'name':_0x55c798[_0x43e7('0x39')],'type':_0x55c798[_0x43e7('0x3a')]['key']};});_0x199ff6[_0x43e7('0x3b')]=_['map'](_0x1b1440,_0x43e7('0x35'));_0x199ff6[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](_0x5d84f4[_0x43e7('0x3c')]);_0x199ff6[_0x43e7('0x3e')]=_[_0x43e7('0x3f')](_0x199ff6['model'],_0x199ff6['query']);_0xfe70e9[_0x43e7('0x40')]=_[_0x43e7('0x3f')](_0x199ff6[_0x43e7('0x3b')],qs[_0x43e7('0x41')](_0x5d84f4[_0x43e7('0x3c')]['fields']));_0xfe70e9[_0x43e7('0x40')]=_0xfe70e9[_0x43e7('0x40')]['length']?_0xfe70e9[_0x43e7('0x40')]:_0x199ff6['model'];if(!_0x5d84f4[_0x43e7('0x3c')]['hasOwnProperty'](_0x43e7('0x42'))){_0xfe70e9[_0x43e7('0x2c')]=qs[_0x43e7('0x2c')](_0x5d84f4[_0x43e7('0x3c')]['limit']);_0xfe70e9['offset']=qs[_0x43e7('0x2a')](_0x5d84f4[_0x43e7('0x3c')][_0x43e7('0x2a')]);}_0xfe70e9[_0x43e7('0x43')]=qs['sort'](_0x5d84f4['query']['sort']);_0xfe70e9[_0x43e7('0x44')]=qs['filters'](_[_0x43e7('0x45')](_0x5d84f4['query'],_0x199ff6['filters']),_0x1b1440);if(_0x5d84f4[_0x43e7('0x3c')]['filter']){_0xfe70e9[_0x43e7('0x44')]=_[_0x43e7('0x46')](_0xfe70e9[_0x43e7('0x44')],{'$or':_[_0x43e7('0x36')](_0x1b1440,function(_0x4fc5e8){if(_0x4fc5e8[_0x43e7('0x3a')]!==_0x43e7('0x47')){var _0x23a611={};_0x23a611[_0x4fc5e8[_0x43e7('0x35')]]={'$like':'%'+_0x5d84f4[_0x43e7('0x3c')][_0x43e7('0x48')]+'%'};return _0x23a611;}})});}_0xfe70e9=_['merge']({},_0xfe70e9,_0x5d84f4['options']);var _0x3bc9de={'where':_0xfe70e9[_0x43e7('0x44')]};return db[_0x43e7('0x37')]['count'](_0x3bc9de)['then'](function(_0x56489b){_0x16cdba[_0x43e7('0x2d')]=_0x56489b;if(_0x5d84f4[_0x43e7('0x3c')]['includeAll']){_0xfe70e9[_0x43e7('0x49')]=[{'all':!![]}];}return db[_0x43e7('0x37')][_0x43e7('0x4a')](_0xfe70e9);})['then'](function(_0x593155){_0x16cdba['rows']=_0x593155;return _0x16cdba;})['then'](respondWithFilteredResult(_0xfa0474,_0xfe70e9))[_0x43e7('0x26')](handleError(_0xfa0474,null));};exports[_0x43e7('0x4b')]=function(_0x52fea5,_0x23e7cb){var _0x82d32f={'raw':!![],'where':{'id':_0x52fea5[_0x43e7('0x4c')]['id']}},_0x426bcb={};_0x426bcb['model']=_[_0x43e7('0x3d')](db['WhatsappMessage']['rawAttributes']);_0x426bcb[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](_0x52fea5[_0x43e7('0x3c')]);_0x426bcb[_0x43e7('0x3e')]=_[_0x43e7('0x3f')](_0x426bcb[_0x43e7('0x3b')],_0x426bcb[_0x43e7('0x3c')]);_0x82d32f[_0x43e7('0x40')]=_[_0x43e7('0x3f')](_0x426bcb[_0x43e7('0x3b')],qs['fields'](_0x52fea5[_0x43e7('0x3c')][_0x43e7('0x41')]));_0x82d32f['attributes']=_0x82d32f[_0x43e7('0x40')]['length']?_0x82d32f[_0x43e7('0x40')]:_0x426bcb[_0x43e7('0x3b')];if(_0x52fea5[_0x43e7('0x3c')][_0x43e7('0x4d')]){_0x82d32f[_0x43e7('0x49')]=[{'all':!![]}];}_0x82d32f=_['merge']({},_0x82d32f,_0x52fea5['options']);return db[_0x43e7('0x37')][_0x43e7('0x4e')](_0x82d32f)[_0x43e7('0x1b')](handleEntityNotFound(_0x23e7cb,null))[_0x43e7('0x1b')](respondWithResult(_0x23e7cb,null))[_0x43e7('0x26')](handleError(_0x23e7cb,null));};exports[_0x43e7('0x4f')]=function(_0xa47464,_0x44f8a0){return db[_0x43e7('0x37')][_0x43e7('0x4f')](_0xa47464[_0x43e7('0x50')],{})['then'](respondWithResult(_0x44f8a0,0xc9))[_0x43e7('0x26')](handleError(_0x44f8a0,null));};exports[_0x43e7('0x33')]=function(_0x50a3fa,_0x4314d8){if(_0x50a3fa[_0x43e7('0x50')]['id']){delete _0x50a3fa[_0x43e7('0x50')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x50a3fa[_0x43e7('0x4c')]['id']}})[_0x43e7('0x1b')](handleEntityNotFound(_0x4314d8,null))['then'](saveUpdates(_0x50a3fa[_0x43e7('0x50')],null))['then'](respondWithResult(_0x4314d8,null))['catch'](handleError(_0x4314d8,null));};exports[_0x43e7('0x51')]=function(_0x4b6b7f,_0x1f7c02){return db[_0x43e7('0x37')][_0x43e7('0x4e')]({'where':{'id':_0x4b6b7f['params']['id']}})[_0x43e7('0x1b')](handleEntityNotFound(_0x1f7c02,null))[_0x43e7('0x1b')](removeEntity(_0x1f7c02,null))['catch'](handleError(_0x1f7c02,null));};exports[_0x43e7('0x52')]=function(_0x1267c5,_0x296a0d){return db['WhatsappMessage']['describe']()['then'](respondWithResult(_0x296a0d,null))[_0x43e7('0x26')](handleError(_0x296a0d,null));};var interaction_log=require(_0x43e7('0x11'))(_0x43e7('0x53'));exports[_0x43e7('0x54')]=function(_0x52ea9c,_0x5a50fc,_0x1b27da){var _0x8b50bb={'agent':{},'channel':_0x43e7('0x55')};if(_0x52ea9c[_0x43e7('0x50')]['id']){delete _0x52ea9c['body']['id'];}_0x52ea9c[_0x43e7('0x50')][_0x43e7('0x56')]=!![];_0x52ea9c[_0x43e7('0x50')][_0x43e7('0x57')]=moment()[_0x43e7('0x58')](_0x43e7('0x59'));_0x52ea9c[_0x43e7('0x50')][_0x43e7('0x5a')]=_0x52ea9c[_0x43e7('0x50')][_0x43e7('0x5a')]||_0x52ea9c[_0x43e7('0x5b')]['id'];_0x8b50bb['agent']['id']=_0x52ea9c['body'][_0x43e7('0x5a')];return db['WhatsappMessage']['find']({'where':{'id':_0x52ea9c['params']['id'],'UserId':null},'include':[{'model':db[_0x43e7('0x5c')],'as':_0x43e7('0x5d')}]})['then'](handleEntityNotFound(_0x5a50fc,null))[_0x43e7('0x1b')](saveUpdates(_0x52ea9c[_0x43e7('0x50')],null))[_0x43e7('0x1b')](function(_0x537a53){if(_0x537a53){_0x8b50bb[_0x43e7('0x24')]=_0x537a53[_0x43e7('0x5e')]({'plain':!![]});return db[_0x43e7('0x5f')][_0x43e7('0x4e')]({'where':{'id':_0x537a53[_0x43e7('0x60')]}});}return null;})[_0x43e7('0x1b')](handleEntityNotFound(_0x5a50fc,null))[_0x43e7('0x1b')](function(_0x515f01){if(_0x515f01){return _0x515f01[_0x43e7('0x33')]({'UserId':_0x52ea9c[_0x43e7('0x50')][_0x43e7('0x5a')],'read1stAt':_['isNil'](_0x515f01['read1stAt'])?moment()[_0x43e7('0x58')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x1b793d){if(_0x1b793d){_0x8b50bb[_0x43e7('0x61')]=_0x1b793d['get']({'plain':!![]});interaction_log[_0x43e7('0x1c')](_0x43e7('0x62'),_0x52ea9c[_0x43e7('0x5b')]['id'],_0x52ea9c[_0x43e7('0x5b')][_0x43e7('0x35')],_0x52ea9c[_0x43e7('0x5b')][_0x43e7('0x63')],_0x8b50bb['interaction']['id'],_0x52ea9c[_0x43e7('0x50')]?JSON[_0x43e7('0x21')](_0x52ea9c['body']):_0x43e7('0x64'));return respondWithRpcPromise('AcceptMessage',_0x43e7('0x65'),_0x8b50bb);}return null;})[_0x43e7('0x1b')](function(_0x37301b){return db[_0x43e7('0x5c')]['describe']()[_0x43e7('0x1b')](function(_0x2646c2){var _0xf929a5=[];for(var _0x556001=0x0;_0x556001=_0x34c9b6){_0xca7a8c=_0x34c9b6;_0x1c431e=0xc8;}else{_0x1c431e=0xce;}_0x172784[_0x3c94('0x1d')](_0x1c431e);return _0x172784[_0x3c94('0x23')]('Content-Range',_0x1f49de+'-'+_0xca7a8c+'/'+_0x34c9b6)[_0x3c94('0x24')](_0x103a4c);}return null;};}function patchUpdates(_0x25eb21){return function(_0x2f4028){try{jsonpatch[_0x3c94('0x25')](_0x2f4028,_0x25eb21,!![]);}catch(_0x9e6fab){return BPromise['reject'](_0x9e6fab);}return _0x2f4028[_0x3c94('0x26')]();};}function saveUpdates(_0x2cf4ab,_0x3a73d2){return function(_0xa518d7){if(_0xa518d7){return _0xa518d7['update'](_0x2cf4ab)[_0x3c94('0x27')](function(_0x588ce3){return _0x588ce3;});}return null;};}function removeEntity(_0x577e0a,_0x4814fa){return function(_0x56a8fa){if(_0x56a8fa){return _0x56a8fa['destroy']()[_0x3c94('0x27')](function(){var _0x3b955d=_0x56a8fa[_0x3c94('0x28')]({'plain':!![]});var _0x3ab04a=_0x3c94('0x29');return db[_0x3c94('0x2a')]['destroy']({'where':{'type':_0x3ab04a,'resourceId':_0x3b955d['id']}})[_0x3c94('0x27')](function(){return _0x56a8fa;});})[_0x3c94('0x27')](function(){_0x577e0a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x66bbf1,_0x1aea3b){return function(_0x2b7d10){if(!_0x2b7d10){_0x66bbf1[_0x3c94('0x1c')](0x194);}return _0x2b7d10;};}function handleError(_0xebc61d,_0x3924bc){_0x3924bc=_0x3924bc||0x1f4;return function(_0x4876fa){logger[_0x3c94('0x2b')](_0x4876fa['stack']);if(_0x4876fa[_0x3c94('0x2c')]){delete _0x4876fa[_0x3c94('0x2c')];}_0xebc61d[_0x3c94('0x1d')](_0x3924bc)[_0x3c94('0x2d')](_0x4876fa);};}exports['index']=function(_0x1b5931,_0x284a93){var _0x2c6813={},_0x1d90fa={},_0x179070={'count':0x0,'rows':[]};var _0x37dcba=_['map'](db[_0x3c94('0x2e')]['rawAttributes'],function(_0x240afa){return{'name':_0x240afa['fieldName'],'type':_0x240afa[_0x3c94('0x2f')][_0x3c94('0x30')]};});_0x1d90fa['model']=_[_0x3c94('0x31')](_0x37dcba,_0x3c94('0x2c'));_0x1d90fa[_0x3c94('0x32')]=_['keys'](_0x1b5931[_0x3c94('0x32')]);_0x1d90fa[_0x3c94('0x33')]=_[_0x3c94('0x34')](_0x1d90fa['model'],_0x1d90fa[_0x3c94('0x32')]);_0x2c6813[_0x3c94('0x35')]=_[_0x3c94('0x34')](_0x1d90fa[_0x3c94('0x36')],qs[_0x3c94('0x37')](_0x1b5931[_0x3c94('0x32')][_0x3c94('0x37')]));_0x2c6813['attributes']=_0x2c6813[_0x3c94('0x35')][_0x3c94('0x38')]?_0x2c6813['attributes']:_0x1d90fa[_0x3c94('0x36')];if(!_0x1b5931['query'][_0x3c94('0x39')](_0x3c94('0x3a'))){_0x2c6813['limit']=qs['limit'](_0x1b5931[_0x3c94('0x32')][_0x3c94('0x21')]);_0x2c6813[_0x3c94('0x1f')]=qs[_0x3c94('0x1f')](_0x1b5931[_0x3c94('0x32')][_0x3c94('0x1f')]);}_0x2c6813[_0x3c94('0x3b')]=qs[_0x3c94('0x3c')](_0x1b5931[_0x3c94('0x32')]['sort']);_0x2c6813[_0x3c94('0x3d')]=qs[_0x3c94('0x33')](_[_0x3c94('0x3e')](_0x1b5931[_0x3c94('0x32')],_0x1d90fa[_0x3c94('0x33')]),_0x37dcba);if(_0x1b5931[_0x3c94('0x32')][_0x3c94('0x3f')]){_0x2c6813[_0x3c94('0x3d')]=_['merge'](_0x2c6813[_0x3c94('0x3d')],{'$or':_[_0x3c94('0x31')](_0x37dcba,function(_0x11b66e){if(_0x11b66e[_0x3c94('0x2f')]!==_0x3c94('0x40')){var _0x27845a={};_0x27845a[_0x11b66e[_0x3c94('0x2c')]]={'$like':'%'+_0x1b5931['query']['filter']+'%'};return _0x27845a;}})});}_0x2c6813=_[_0x3c94('0x41')]({},_0x2c6813,_0x1b5931[_0x3c94('0x42')]);var _0x28ce55={'where':_0x2c6813[_0x3c94('0x3d')]};return db[_0x3c94('0x2e')][_0x3c94('0x22')](_0x28ce55)[_0x3c94('0x27')](function(_0x2b74f4){_0x179070['count']=_0x2b74f4;if(_0x1b5931[_0x3c94('0x32')][_0x3c94('0x43')]){_0x2c6813[_0x3c94('0x44')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x3c94('0x45')](_0x2c6813);})['then'](function(_0x197f1e){_0x179070[_0x3c94('0x46')]=_0x197f1e;return _0x179070;})['then'](respondWithFilteredResult(_0x284a93,_0x2c6813))[_0x3c94('0x47')](handleError(_0x284a93,null));};exports[_0x3c94('0x48')]=function(_0x23d426,_0x5d2f83){var _0x5537de={'raw':!![],'where':{'id':_0x23d426[_0x3c94('0x49')]['id']}},_0x12c65c={};_0x12c65c['model']=_[_0x3c94('0x4a')](db[_0x3c94('0x2e')][_0x3c94('0x4b')]);_0x12c65c[_0x3c94('0x32')]=_[_0x3c94('0x4a')](_0x23d426['query']);_0x12c65c['filters']=_['intersection'](_0x12c65c[_0x3c94('0x36')],_0x12c65c[_0x3c94('0x32')]);_0x5537de['attributes']=_[_0x3c94('0x34')](_0x12c65c[_0x3c94('0x36')],qs['fields'](_0x23d426['query'][_0x3c94('0x37')]));_0x5537de[_0x3c94('0x35')]=_0x5537de[_0x3c94('0x35')][_0x3c94('0x38')]?_0x5537de[_0x3c94('0x35')]:_0x12c65c[_0x3c94('0x36')];if(_0x23d426[_0x3c94('0x32')]['includeAll']){_0x5537de['include']=[{'all':!![]}];}_0x5537de=_[_0x3c94('0x41')]({},_0x5537de,_0x23d426[_0x3c94('0x42')]);return db[_0x3c94('0x2e')][_0x3c94('0x4c')](_0x5537de)['then'](handleEntityNotFound(_0x5d2f83,null))['then'](respondWithResult(_0x5d2f83,null))[_0x3c94('0x47')](handleError(_0x5d2f83,null));};exports['create']=function(_0x586433,_0x3762eb){return db['WhatsappQueue']['create'](_0x586433['body'],{})[_0x3c94('0x27')](function(_0x405a57){var _0x52511d=_0x586433[_0x3c94('0x4d')][_0x3c94('0x28')]({'plain':!![]});if(!_0x52511d)throw new Error(_0x3c94('0x4e'));if(_0x52511d[_0x3c94('0x4f')]==='user'){var _0x330a88=_0x405a57['get']({'plain':!![]});var _0x1d3028=_0x3c94('0x29');return db[_0x3c94('0x50')][_0x3c94('0x4c')]({'where':{'name':_0x1d3028,'userProfileId':_0x52511d['userProfileId']},'raw':!![]})[_0x3c94('0x27')](function(_0x32f960){if(_0x32f960&&_0x32f960[_0x3c94('0x51')]===0x0){return db[_0x3c94('0x2a')]['create']({'name':_0x330a88[_0x3c94('0x2c')],'resourceId':_0x330a88['id'],'type':_0x32f960[_0x3c94('0x2c')],'sectionId':_0x32f960['id']},{})['then'](function(){return _0x405a57;});}else{return _0x405a57;}})[_0x3c94('0x47')](function(_0x5f0e53){logger['error'](_0x3c94('0x52'),_0x5f0e53);throw _0x5f0e53;});}return _0x405a57;})[_0x3c94('0x27')](respondWithResult(_0x3762eb,0xc9))['catch'](handleError(_0x3762eb,null));};exports[_0x3c94('0x53')]=function(_0x5b8220,_0xf520c6){if(_0x5b8220['body']['id']){delete _0x5b8220[_0x3c94('0x54')]['id'];}return db[_0x3c94('0x2e')][_0x3c94('0x4c')]({'where':{'id':_0x5b8220[_0x3c94('0x49')]['id']}})[_0x3c94('0x27')](handleEntityNotFound(_0xf520c6,null))[_0x3c94('0x27')](saveUpdates(_0x5b8220[_0x3c94('0x54')],null))[_0x3c94('0x27')](respondWithResult(_0xf520c6,null))['catch'](handleError(_0xf520c6,null));};exports[_0x3c94('0x55')]=function(_0x57d6ca,_0x14e4a9){return db[_0x3c94('0x2e')][_0x3c94('0x4c')]({'where':{'id':_0x57d6ca['params']['id']}})[_0x3c94('0x27')](handleEntityNotFound(_0x14e4a9,null))[_0x3c94('0x27')](removeEntity(_0x14e4a9,null))[_0x3c94('0x47')](handleError(_0x14e4a9,null));};exports[_0x3c94('0x56')]=function(_0x465d03,_0x305fd4){return db[_0x3c94('0x2e')][_0x3c94('0x56')]()['then'](respondWithResult(_0x305fd4,null))[_0x3c94('0x47')](handleError(_0x305fd4,null));};exports[_0x3c94('0x57')]=function(_0x3a6380,_0xc935ca,_0x40ac36){var _0x60b0e={'raw':!![],'where':{}},_0x416e91={},_0x4c7867;return db[_0x3c94('0x2e')][_0x3c94('0x58')]({'where':{'id':_0x3a6380[_0x3c94('0x49')]['id']}})[_0x3c94('0x27')](handleEntityNotFound(_0xc935ca,null))[_0x3c94('0x27')](function(_0x49cec7){if(_0x49cec7){_0x4c7867=_0x49cec7[_0x3c94('0x28')]({'plain':!![]});_0x416e91[_0x3c94('0x36')]=_['keys'](db['UserWhatsappQueue'][_0x3c94('0x4b')]);_0x416e91[_0x3c94('0x32')]=_[_0x3c94('0x4a')](_0x3a6380[_0x3c94('0x32')]);_0x416e91[_0x3c94('0x33')]=_[_0x3c94('0x34')](_0x416e91[_0x3c94('0x36')],_0x416e91['query']);_0x60b0e[_0x3c94('0x35')]=_['intersection'](_0x416e91[_0x3c94('0x36')],qs[_0x3c94('0x37')](_0x3a6380[_0x3c94('0x32')][_0x3c94('0x37')]));_0x60b0e['attributes']=_0x60b0e[_0x3c94('0x35')][_0x3c94('0x38')]?_0x60b0e[_0x3c94('0x35')]:_0x416e91[_0x3c94('0x36')];if(!_0x3a6380['query'][_0x3c94('0x39')](_0x3c94('0x3a'))){_0x60b0e[_0x3c94('0x21')]=qs[_0x3c94('0x21')](_0x3a6380[_0x3c94('0x32')][_0x3c94('0x21')]);_0x60b0e[_0x3c94('0x1f')]=qs[_0x3c94('0x1f')](_0x3a6380['query'][_0x3c94('0x1f')]);}_0x60b0e['order']=qs[_0x3c94('0x3c')](_0x3a6380[_0x3c94('0x32')][_0x3c94('0x3c')]);_0x60b0e[_0x3c94('0x3d')]=qs['filters'](_[_0x3c94('0x3e')](_0x3a6380[_0x3c94('0x32')],_0x416e91[_0x3c94('0x33')]));_0x60b0e[_0x3c94('0x3d')][_0x3c94('0x59')]=_0x49cec7['id'];if(_0x3a6380[_0x3c94('0x32')][_0x3c94('0x3f')]){_0x60b0e[_0x3c94('0x3d')]=_['merge'](_0x60b0e[_0x3c94('0x3d')],{'$or':_['map'](_0x60b0e[_0x3c94('0x35')],function(_0x30f498){var _0x3ccea9={};_0x3ccea9[_0x30f498]={'$like':'%'+_0x3a6380[_0x3c94('0x32')]['filter']+'%'};return _0x3ccea9;})});}_0x60b0e=_[_0x3c94('0x41')]({},_0x60b0e,_0x3a6380[_0x3c94('0x42')]);return db[_0x3c94('0x5a')][_0x3c94('0x45')](_0x60b0e);}})[_0x3c94('0x27')](function(_0x3aae74){if(_0x3aae74){return db[_0x3c94('0x5b')][_0x3c94('0x5c')]({'where':{'id':_[_0x3c94('0x31')](_0x3aae74,_0x3c94('0x5d')),'role':_0x3c94('0x5e')},'attributes':['id','name',_0x3c94('0x5f'),'updatedAt',_0x3c94('0x60')]});}})[_0x3c94('0x27')](function(_0x3e4605){if(_0x3e4605){return{'count':_0x3e4605[_0x3c94('0x22')],'rows':_[_0x3c94('0x31')](_0x3e4605[_0x3c94('0x46')],function(_0x4025ae){return{'membername':_0x4025ae['name'],'UserId':_0x4025ae['id'],'queue_name':_0x4c7867[_0x3c94('0x2c')],'WhatsappQueueId':_0x4c7867['id'],'interface':util['format'](_0x3c94('0x61'),_0x3c94('0x62'),_0x4025ae[_0x3c94('0x2c')]),'penalty':0x0,'paused':_0x4025ae[_0x3c94('0x5f')],'createdAt':_0x4025ae[_0x3c94('0x60')],'updatedAt':_0x4025ae[_0x3c94('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3c94('0x27')](respondWithFilteredResult(_0xc935ca,_0x60b0e))[_0x3c94('0x47')](handleError(_0xc935ca,null));};exports[_0x3c94('0x64')]=function(_0x161893,_0x163c7e,_0x11b42a){var _0x16f20f={};var _0x3c3f20={};var _0x5ec659;var _0x3bbc44;return db[_0x3c94('0x2e')][_0x3c94('0x58')]({'where':{'id':_0x161893[_0x3c94('0x49')]['id']}})[_0x3c94('0x27')](handleEntityNotFound(_0x163c7e,null))[_0x3c94('0x27')](function(_0x5d4f0a){if(_0x5d4f0a){_0x5ec659=_0x5d4f0a;_0x3c3f20[_0x3c94('0x36')]=_[_0x3c94('0x4a')](db[_0x3c94('0x65')][_0x3c94('0x4b')]);_0x3c3f20[_0x3c94('0x32')]=_[_0x3c94('0x4a')](_0x161893[_0x3c94('0x32')]);_0x3c3f20[_0x3c94('0x33')]=_[_0x3c94('0x34')](_0x3c3f20[_0x3c94('0x36')],_0x3c3f20['query']);_0x16f20f[_0x3c94('0x35')]=_[_0x3c94('0x34')](_0x3c3f20[_0x3c94('0x36')],qs[_0x3c94('0x37')](_0x161893['query'][_0x3c94('0x37')]));_0x16f20f['attributes']=_0x16f20f[_0x3c94('0x35')][_0x3c94('0x38')]?_0x16f20f['attributes']:_0x3c3f20['model'];_0x16f20f['order']=qs[_0x3c94('0x3c')](_0x161893[_0x3c94('0x32')][_0x3c94('0x3c')]);_0x16f20f[_0x3c94('0x3d')]=qs[_0x3c94('0x33')](_[_0x3c94('0x3e')](_0x161893[_0x3c94('0x32')],_0x3c3f20[_0x3c94('0x33')]));if(_0x161893['query']['filter']){_0x16f20f[_0x3c94('0x3d')]=_['merge'](_0x16f20f[_0x3c94('0x3d')],{'$or':_[_0x3c94('0x31')](_0x16f20f['attributes'],function(_0x53d72a){var _0x3d31b5={};_0x3d31b5[_0x53d72a]={'$like':'%'+_0x161893['query'][_0x3c94('0x3f')]+'%'};return _0x3d31b5;})});}_0x16f20f=_[_0x3c94('0x41')]({},_0x16f20f,_0x161893['options']);return _0x5ec659[_0x3c94('0x64')](_0x16f20f);}})[_0x3c94('0x27')](function(_0x5581bf){if(_0x5581bf){_0x3bbc44=_0x5581bf[_0x3c94('0x38')];if(!_0x161893['query'][_0x3c94('0x39')](_0x3c94('0x3a'))){_0x16f20f[_0x3c94('0x21')]=qs[_0x3c94('0x21')](_0x161893[_0x3c94('0x32')][_0x3c94('0x21')]);_0x16f20f['offset']=qs[_0x3c94('0x1f')](_0x161893[_0x3c94('0x32')][_0x3c94('0x1f')]);}return _0x5ec659[_0x3c94('0x64')](_0x16f20f);}})[_0x3c94('0x27')](function(_0xb29cd){if(_0xb29cd){return _0xb29cd?{'count':_0x3bbc44,'rows':_0xb29cd}:null;}})[_0x3c94('0x27')](respondWithResult(_0x163c7e,null))[_0x3c94('0x47')](handleError(_0x163c7e,null));};exports[_0x3c94('0x66')]=function(_0x58a99b,_0x7cdaa3,_0x687dd2){var _0x327a0d=_0x58a99b['body'][_0x3c94('0x67')];return db[_0x3c94('0x65')][_0x3c94('0x45')]({'where':{'id':_0x327a0d},'attributes':['id'],'include':[{'model':db[_0x3c94('0x5b')],'as':'Agents','attributes':['id',_0x3c94('0x2c'),'online','voicePause',_0x3c94('0x68')],'raw':!![]}]})[_0x3c94('0x27')](function(_0xb5887f){if(_0xb5887f){var _0x5759e4=_['flatMap'](_0xb5887f,function(_0x450bd7){var _0x5dc162=_0x450bd7[_0x3c94('0x28')]({'plain':!![]});return _0x5dc162[_0x3c94('0x69')];});return db[_0x3c94('0x2e')][_0x3c94('0x4c')]({'where':{'id':_0x58a99b['params']['id']}})[_0x3c94('0x27')](function(_0x23c3a2){return db[_0x3c94('0x6a')][_0x3c94('0x6b')](function(_0x55f955){return _0x23c3a2[_0x3c94('0x66')](_0x327a0d,{'transaction':_0x55f955})[_0x3c94('0x27')](function(){return BPromise['each'](_0x5759e4,function(_0x48e57e){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x48e57e['id'],'WhatsappQueueId':_0x58a99b[_0x3c94('0x49')]['id']},'transaction':_0x55f955});});})['then'](function(){_0x5759e4['forEach'](function(_0x57775e){socket[_0x3c94('0x6c')](_0x3c94('0x6d'),{'UserId':_0x57775e['id'],'WhatsappQueueId':_0x23c3a2['id']});});});});});}})[_0x3c94('0x27')](respondWithStatusCode(_0x7cdaa3,null))[_0x3c94('0x47')](handleError(_0x7cdaa3,null));};exports[_0x3c94('0x6e')]=function(_0x1450b7,_0x5dfb3a,_0x447d98){return db[_0x3c94('0x65')][_0x3c94('0x45')]({'where':{'id':_0x1450b7[_0x3c94('0x32')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3c94('0x69'),'attributes':['id'],'raw':!![]}]})[_0x3c94('0x27')](handleEntityNotFound(_0x5dfb3a,null))[_0x3c94('0x27')](function(_0x566215){var _0x25f962=_['map'](_0x566215,'id');var _0x1d9518=[];var _0x33f998=[];var _0x11e888=squel[_0x3c94('0x6f')]();_0x11e888['field'](_0x3c94('0x70'))[_0x3c94('0x71')](_0x3c94('0x72'),'tq')[_0x3c94('0x73')](_0x3c94('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('WhatsappQueueId\x20=\x20?',_0x1450b7[_0x3c94('0x49')]['id']);for(var _0x4cc4f0=0x0;_0x4cc4f0<_0x566215[_0x3c94('0x38')];_0x4cc4f0+=0x1){let _0x4b9284=_0x566215[_0x4cc4f0];for(var _0x237eee=0x0;_0x237eee<_0x4b9284[_0x3c94('0x69')]['length'];_0x237eee+=0x1){let _0x41484a=_0x4b9284[_0x3c94('0x69')][_0x237eee];var _0x139e0b=_0x11e888[_0x3c94('0x75')]();_0x139e0b[_0x3c94('0x3d')](_0x3c94('0x76'),_0x41484a['id']);_0x33f998[_0x3c94('0x77')](db['sequelize']['query'](_0x139e0b[_0x3c94('0x78')](),{'type':db[_0x3c94('0x6a')][_0x3c94('0x79')][_0x3c94('0x7a')]})[_0x3c94('0x27')](function(_0xcaf6dc){if(_0xcaf6dc[_0x3c94('0x38')]===0x1){return _0x41484a['id'];}else{var _0x77f63a=_['every'](_[_0x3c94('0x31')](_0xcaf6dc,_0x3c94('0x7b')),function(_0x3987ff){return _[_0x3c94('0x7c')](_0x25f962,_0x3987ff);});if(_0x77f63a){return _0x41484a['id'];}}}));}}return BPromise['all'](_0x33f998)[_0x3c94('0x27')](function(_0x193588){_0x1d9518=_(_0x1d9518)[_0x3c94('0x7d')](_0x193588)[_0x3c94('0x7e')]()[_0x3c94('0x7f')]();return db[_0x3c94('0x2e')][_0x3c94('0x4c')]({'where':{'id':_0x1450b7[_0x3c94('0x49')]['id']}})[_0x3c94('0x27')](function(_0x1f61c1){return db['sequelize'][_0x3c94('0x6b')](function(_0x8814e3){return _0x1f61c1[_0x3c94('0x6e')](_0x1450b7[_0x3c94('0x32')][_0x3c94('0x67')],{'transaction':_0x8814e3})[_0x3c94('0x27')](function(){if(!_['isEmpty'](_0x1d9518)){return _0x1f61c1['removeAgents'](_0x1d9518,{'transaction':_0x8814e3});}})['then'](function(){_0x1d9518[_0x3c94('0x80')](function(_0x31af60){socket['emit'](_0x3c94('0x81'),{'UserId':_0x31af60,'WhatsappQueueId':_0x1f61c1['id']});});});});});});})['then'](respondWithStatusCode(_0x5dfb3a,null))[_0x3c94('0x47')](handleError(_0x5dfb3a,null));};exports[_0x3c94('0x82')]=function(_0x2d9d32,_0x524274,_0x16eaef){return db[_0x3c94('0x2e')][_0x3c94('0x4c')]({'where':{'id':_0x2d9d32[_0x3c94('0x49')]['id']}})[_0x3c94('0x27')](handleEntityNotFound(_0x524274,null))['then'](function(_0x3cdbe){if(_0x3cdbe){return _0x3cdbe[_0x3c94('0x82')](_0x2d9d32[_0x3c94('0x54')][_0x3c94('0x67')],_[_0x3c94('0x83')](_0x2d9d32[_0x3c94('0x54')],[_0x3c94('0x67'),'id'])||{})[_0x3c94('0x84')](function(_0x9c561b){for(var _0x252dd5=0x0;_0x252dd5<_0x2d9d32[_0x3c94('0x54')][_0x3c94('0x67')][_0x3c94('0x38')];_0x252dd5+=0x1){socket[_0x3c94('0x6c')](_0x3c94('0x6d'),{'UserId':_0x2d9d32[_0x3c94('0x54')][_0x3c94('0x67')][_0x252dd5],'WhatsappQueueId':_0x2d9d32['params']['id']});}return _0x9c561b;});}})[_0x3c94('0x27')](respondWithResult(_0x524274,null))[_0x3c94('0x47')](handleError(_0x524274,null));};exports[_0x3c94('0x85')]=function(_0x462ee4,_0x1afc07,_0x5d3737){return db[_0x3c94('0x2e')]['find']({'where':{'id':_0x462ee4['params']['id']}})[_0x3c94('0x27')](handleEntityNotFound(_0x1afc07,null))[_0x3c94('0x27')](function(_0x2e034c){if(_0x2e034c){return _0x2e034c[_0x3c94('0x85')](_0x462ee4[_0x3c94('0x32')][_0x3c94('0x67')])[_0x3c94('0x27')](function(){if(_['isArray'](_0x462ee4['query'][_0x3c94('0x67')])){for(var _0x4b4db6=0x0;_0x4b4db6<_0x462ee4[_0x3c94('0x32')]['ids'][_0x3c94('0x38')];_0x4b4db6+=0x1){socket[_0x3c94('0x6c')](_0x3c94('0x81'),{'UserId':Number(_0x462ee4['query']['ids'][_0x4b4db6]),'WhatsappQueueId':Number(_0x462ee4[_0x3c94('0x49')]['id'])});}}else{socket[_0x3c94('0x6c')]('userWhatsappQueue:remove',{'UserId':Number(_0x462ee4[_0x3c94('0x32')]['ids']),'WhatsappQueueId':Number(_0x462ee4[_0x3c94('0x49')]['id'])});}});}})[_0x3c94('0x27')](respondWithStatusCode(_0x1afc07,null))[_0x3c94('0x47')](handleError(_0x1afc07,null));};exports['getAgents']=function(_0x28c2ea,_0x4a231d,_0x75e62d){var _0x4aee01={};var _0x8eb4ba={};var _0x59959b;var _0x159274;return db['WhatsappQueue']['findOne']({'where':{'id':_0x28c2ea[_0x3c94('0x49')]['id']}})[_0x3c94('0x27')](handleEntityNotFound(_0x4a231d,null))[_0x3c94('0x27')](function(_0x3addf2){if(_0x3addf2){_0x59959b=_0x3addf2;_0x8eb4ba[_0x3c94('0x36')]=_[_0x3c94('0x4a')](db['User'][_0x3c94('0x4b')]);_0x8eb4ba[_0x3c94('0x32')]=_[_0x3c94('0x4a')](_0x28c2ea['query']);_0x8eb4ba[_0x3c94('0x33')]=_[_0x3c94('0x34')](_0x8eb4ba[_0x3c94('0x36')],_0x8eb4ba[_0x3c94('0x32')]);_0x4aee01['attributes']=_[_0x3c94('0x34')](_0x8eb4ba[_0x3c94('0x36')],qs[_0x3c94('0x37')](_0x28c2ea[_0x3c94('0x32')][_0x3c94('0x37')]));_0x4aee01[_0x3c94('0x35')]=_0x4aee01[_0x3c94('0x35')][_0x3c94('0x38')]?_0x4aee01[_0x3c94('0x35')]:_0x8eb4ba['model'];_0x4aee01[_0x3c94('0x3b')]=qs[_0x3c94('0x3c')](_0x28c2ea['query'][_0x3c94('0x3c')]);_0x4aee01[_0x3c94('0x3d')]=qs['filters'](_['pick'](_0x28c2ea[_0x3c94('0x32')],_0x8eb4ba[_0x3c94('0x33')]));if(_0x28c2ea[_0x3c94('0x32')][_0x3c94('0x3f')]){_0x4aee01[_0x3c94('0x3d')]=_['merge'](_0x4aee01[_0x3c94('0x3d')],{'$or':_[_0x3c94('0x31')](_0x4aee01[_0x3c94('0x35')],function(_0x44e04e){var _0x2dd9dc={};_0x2dd9dc[_0x44e04e]={'$like':'%'+_0x28c2ea['query']['filter']+'%'};return _0x2dd9dc;})});}_0x4aee01=_[_0x3c94('0x41')]({},_0x4aee01,_0x28c2ea[_0x3c94('0x42')]);return _0x59959b[_0x3c94('0x86')](_0x4aee01);}})[_0x3c94('0x27')](function(_0x2c3874){if(_0x2c3874){_0x159274=_0x2c3874['length'];if(!_0x28c2ea['query'][_0x3c94('0x39')](_0x3c94('0x3a'))){_0x4aee01['limit']=qs[_0x3c94('0x21')](_0x28c2ea['query'][_0x3c94('0x21')]);_0x4aee01[_0x3c94('0x1f')]=qs[_0x3c94('0x1f')](_0x28c2ea['query']['offset']);}return _0x59959b[_0x3c94('0x86')](_0x4aee01);}})[_0x3c94('0x27')](function(_0x467d11){if(_0x467d11){return _0x467d11?{'count':_0x159274,'rows':_0x467d11}:null;}})['then'](respondWithResult(_0x4a231d,null))[_0x3c94('0x47')](handleError(_0x4a231d,null));}; \ No newline at end of file +var _0x2d0a=['key','model','map','name','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','intersection','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserWhatsappQueue','order','WhatsappQueueId','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','User','Agents','voicePause','flatMap','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','includes','union','compact','value','removeTeams','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','emit','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','get','WhatsappQueues','UserProfileResource','stack','send','index','WhatsappQueue','rawAttributes','type'];(function(_0x5db36f,_0x4d0d0b){var _0x134663=function(_0x32adc0){while(--_0x32adc0){_0x5db36f['push'](_0x5db36f['shift']());}};_0x134663(++_0x4d0d0b);}(_0x2d0a,0x17c));var _0xa2d0=function(_0x5ebf3e,_0x295df5){_0x5ebf3e=_0x5ebf3e-0x0;var _0x3489e0=_0x2d0a[_0x5ebf3e];return _0x3489e0;};'use strict';var emlformat=require(_0xa2d0('0x0'));var rimraf=require(_0xa2d0('0x1'));var zipdir=require(_0xa2d0('0x2'));var jsonpatch=require(_0xa2d0('0x3'));var rp=require(_0xa2d0('0x4'));var moment=require('moment');var BPromise=require(_0xa2d0('0x5'));var Mustache=require('mustache');var util=require(_0xa2d0('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa2d0('0x7'));var ejs=require(_0xa2d0('0x8'));var fs=require('fs');var fs_extra=require(_0xa2d0('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa2d0('0xa'));var jsforce=require(_0xa2d0('0xb'));var deskjs=require(_0xa2d0('0xc'));var toCsv=require(_0xa2d0('0x7'));var querystring=require(_0xa2d0('0xd'));var Papa=require(_0xa2d0('0xe'));var Redis=require(_0xa2d0('0xf'));var authService=require(_0xa2d0('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa2d0('0x11'));var logger=require('../../config/logger')(_0xa2d0('0x12'));var utils=require(_0xa2d0('0x13'));var config=require(_0xa2d0('0x14'));var licenseUtil=require(_0xa2d0('0x15'));var db=require(_0xa2d0('0x16'))['db'];config[_0xa2d0('0x17')]=_[_0xa2d0('0x18')](config[_0xa2d0('0x17')],{'host':_0xa2d0('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa2d0('0x17')]));require(_0xa2d0('0x1a'))[_0xa2d0('0x1b')](socket);function respondWithStatusCode(_0x450d88,_0x13c193){_0x13c193=_0x13c193||0xcc;return function(_0x38ba66){if(_0x38ba66){return _0x450d88[_0xa2d0('0x1c')](_0x13c193);}return _0x450d88[_0xa2d0('0x1d')](_0x13c193)[_0xa2d0('0x1e')]();};}function respondWithResult(_0x471441,_0x37630b){_0x37630b=_0x37630b||0xc8;return function(_0x47c69f){if(_0x47c69f){return _0x471441[_0xa2d0('0x1d')](_0x37630b)[_0xa2d0('0x1f')](_0x47c69f);}};}function respondWithFilteredResult(_0x35e952,_0xee69be){return function(_0x1ff16f){if(_0x1ff16f){var _0x2280a4=typeof _0xee69be[_0xa2d0('0x20')]===_0xa2d0('0x21')&&typeof _0xee69be['limit']==='undefined';var _0x503c18=_0x1ff16f[_0xa2d0('0x22')];var _0x37a670=_0x2280a4?0x0:_0xee69be[_0xa2d0('0x20')];var _0x4a9498=_0x2280a4?_0x1ff16f[_0xa2d0('0x22')]:_0xee69be['offset']+_0xee69be[_0xa2d0('0x23')];var _0x3d57c8;if(_0x4a9498>=_0x503c18){_0x4a9498=_0x503c18;_0x3d57c8=0xc8;}else{_0x3d57c8=0xce;}_0x35e952[_0xa2d0('0x1d')](_0x3d57c8);return _0x35e952[_0xa2d0('0x24')](_0xa2d0('0x25'),_0x37a670+'-'+_0x4a9498+'/'+_0x503c18)[_0xa2d0('0x1f')](_0x1ff16f);}return null;};}function patchUpdates(_0x389dfa){return function(_0x348c8f){try{jsonpatch[_0xa2d0('0x26')](_0x348c8f,_0x389dfa,!![]);}catch(_0x1451f1){return BPromise[_0xa2d0('0x27')](_0x1451f1);}return _0x348c8f['save']();};}function saveUpdates(_0x1f2dac,_0x699c84){return function(_0xf56cb7){if(_0xf56cb7){return _0xf56cb7[_0xa2d0('0x28')](_0x1f2dac)['then'](function(_0x5db399){return _0x5db399;});}return null;};}function removeEntity(_0x55b591,_0x43a6e3){return function(_0x33d094){if(_0x33d094){return _0x33d094[_0xa2d0('0x29')]()[_0xa2d0('0x2a')](function(){var _0x560ef3=_0x33d094[_0xa2d0('0x2b')]({'plain':!![]});var _0x478cd9=_0xa2d0('0x2c');return db[_0xa2d0('0x2d')][_0xa2d0('0x29')]({'where':{'type':_0x478cd9,'resourceId':_0x560ef3['id']}})[_0xa2d0('0x2a')](function(){return _0x33d094;});})[_0xa2d0('0x2a')](function(){_0x55b591['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31eff3,_0x2607eb){return function(_0x5900b4){if(!_0x5900b4){_0x31eff3[_0xa2d0('0x1c')](0x194);}return _0x5900b4;};}function handleError(_0x187859,_0x3d80de){_0x3d80de=_0x3d80de||0x1f4;return function(_0x1cd79c){logger['error'](_0x1cd79c[_0xa2d0('0x2e')]);if(_0x1cd79c['name']){delete _0x1cd79c['name'];}_0x187859[_0xa2d0('0x1d')](_0x3d80de)[_0xa2d0('0x2f')](_0x1cd79c);};}exports[_0xa2d0('0x30')]=function(_0x1645d2,_0xf70055){var _0xe3ba14={},_0xc737f7={},_0x406560={'count':0x0,'rows':[]};var _0x23ad12=_['map'](db[_0xa2d0('0x31')][_0xa2d0('0x32')],function(_0x45ccb1){return{'name':_0x45ccb1['fieldName'],'type':_0x45ccb1[_0xa2d0('0x33')][_0xa2d0('0x34')]};});_0xc737f7[_0xa2d0('0x35')]=_[_0xa2d0('0x36')](_0x23ad12,_0xa2d0('0x37'));_0xc737f7[_0xa2d0('0x38')]=_[_0xa2d0('0x39')](_0x1645d2[_0xa2d0('0x38')]);_0xc737f7[_0xa2d0('0x3a')]=_['intersection'](_0xc737f7[_0xa2d0('0x35')],_0xc737f7['query']);_0xe3ba14[_0xa2d0('0x3b')]=_['intersection'](_0xc737f7[_0xa2d0('0x35')],qs[_0xa2d0('0x3c')](_0x1645d2[_0xa2d0('0x38')][_0xa2d0('0x3c')]));_0xe3ba14[_0xa2d0('0x3b')]=_0xe3ba14[_0xa2d0('0x3b')][_0xa2d0('0x3d')]?_0xe3ba14[_0xa2d0('0x3b')]:_0xc737f7[_0xa2d0('0x35')];if(!_0x1645d2['query'][_0xa2d0('0x3e')](_0xa2d0('0x3f'))){_0xe3ba14['limit']=qs[_0xa2d0('0x23')](_0x1645d2[_0xa2d0('0x38')]['limit']);_0xe3ba14[_0xa2d0('0x20')]=qs[_0xa2d0('0x20')](_0x1645d2[_0xa2d0('0x38')]['offset']);}_0xe3ba14['order']=qs['sort'](_0x1645d2['query'][_0xa2d0('0x40')]);_0xe3ba14[_0xa2d0('0x41')]=qs[_0xa2d0('0x3a')](_[_0xa2d0('0x42')](_0x1645d2['query'],_0xc737f7['filters']),_0x23ad12);if(_0x1645d2[_0xa2d0('0x38')][_0xa2d0('0x43')]){_0xe3ba14['where']=_[_0xa2d0('0x44')](_0xe3ba14['where'],{'$or':_[_0xa2d0('0x36')](_0x23ad12,function(_0x2da866){if(_0x2da866[_0xa2d0('0x33')]!==_0xa2d0('0x45')){var _0xe874ea={};_0xe874ea[_0x2da866['name']]={'$like':'%'+_0x1645d2[_0xa2d0('0x38')][_0xa2d0('0x43')]+'%'};return _0xe874ea;}})});}_0xe3ba14=_['merge']({},_0xe3ba14,_0x1645d2['options']);var _0x12ff65={'where':_0xe3ba14['where']};return db['WhatsappQueue'][_0xa2d0('0x22')](_0x12ff65)[_0xa2d0('0x2a')](function(_0x3b2b55){_0x406560[_0xa2d0('0x22')]=_0x3b2b55;if(_0x1645d2[_0xa2d0('0x38')][_0xa2d0('0x46')]){_0xe3ba14[_0xa2d0('0x47')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xa2d0('0x48')](_0xe3ba14);})[_0xa2d0('0x2a')](function(_0x42d88d){_0x406560['rows']=_0x42d88d;return _0x406560;})[_0xa2d0('0x2a')](respondWithFilteredResult(_0xf70055,_0xe3ba14))[_0xa2d0('0x49')](handleError(_0xf70055,null));};exports[_0xa2d0('0x4a')]=function(_0x5cbc26,_0x41d45d){var _0x2d62e3={'raw':!![],'where':{'id':_0x5cbc26[_0xa2d0('0x4b')]['id']}},_0x3095cb={};_0x3095cb['model']=_['keys'](db[_0xa2d0('0x31')][_0xa2d0('0x32')]);_0x3095cb[_0xa2d0('0x38')]=_['keys'](_0x5cbc26['query']);_0x3095cb['filters']=_[_0xa2d0('0x4c')](_0x3095cb[_0xa2d0('0x35')],_0x3095cb['query']);_0x2d62e3[_0xa2d0('0x3b')]=_[_0xa2d0('0x4c')](_0x3095cb['model'],qs[_0xa2d0('0x3c')](_0x5cbc26[_0xa2d0('0x38')][_0xa2d0('0x3c')]));_0x2d62e3['attributes']=_0x2d62e3[_0xa2d0('0x3b')][_0xa2d0('0x3d')]?_0x2d62e3[_0xa2d0('0x3b')]:_0x3095cb[_0xa2d0('0x35')];if(_0x5cbc26['query'][_0xa2d0('0x46')]){_0x2d62e3[_0xa2d0('0x47')]=[{'all':!![]}];}_0x2d62e3=_[_0xa2d0('0x44')]({},_0x2d62e3,_0x5cbc26[_0xa2d0('0x4d')]);return db[_0xa2d0('0x31')][_0xa2d0('0x4e')](_0x2d62e3)[_0xa2d0('0x2a')](handleEntityNotFound(_0x41d45d,null))[_0xa2d0('0x2a')](respondWithResult(_0x41d45d,null))[_0xa2d0('0x49')](handleError(_0x41d45d,null));};exports[_0xa2d0('0x4f')]=function(_0x5219e1,_0x53d587){return db[_0xa2d0('0x31')][_0xa2d0('0x4f')](_0x5219e1[_0xa2d0('0x50')],{})[_0xa2d0('0x2a')](function(_0x38e5ce){var _0x480a22=_0x5219e1[_0xa2d0('0x51')][_0xa2d0('0x2b')]({'plain':!![]});if(!_0x480a22)throw new Error(_0xa2d0('0x52'));if(_0x480a22[_0xa2d0('0x53')]===_0xa2d0('0x51')){var _0x5820f3=_0x38e5ce['get']({'plain':!![]});var _0x1d0265='WhatsappQueues';return db[_0xa2d0('0x54')][_0xa2d0('0x4e')]({'where':{'name':_0x1d0265,'userProfileId':_0x480a22['userProfileId']},'raw':!![]})[_0xa2d0('0x2a')](function(_0x3bee6a){if(_0x3bee6a&&_0x3bee6a[_0xa2d0('0x55')]===0x0){return db[_0xa2d0('0x2d')][_0xa2d0('0x4f')]({'name':_0x5820f3['name'],'resourceId':_0x5820f3['id'],'type':_0x3bee6a['name'],'sectionId':_0x3bee6a['id']},{})['then'](function(){return _0x38e5ce;});}else{return _0x38e5ce;}})[_0xa2d0('0x49')](function(_0x2c2ec4){logger[_0xa2d0('0x56')](_0xa2d0('0x57'),_0x2c2ec4);throw _0x2c2ec4;});}return _0x38e5ce;})['then'](respondWithResult(_0x53d587,0xc9))[_0xa2d0('0x49')](handleError(_0x53d587,null));};exports[_0xa2d0('0x28')]=function(_0x487421,_0x525a6d){if(_0x487421[_0xa2d0('0x50')]['id']){delete _0x487421[_0xa2d0('0x50')]['id'];}return db[_0xa2d0('0x31')][_0xa2d0('0x4e')]({'where':{'id':_0x487421[_0xa2d0('0x4b')]['id']}})[_0xa2d0('0x2a')](handleEntityNotFound(_0x525a6d,null))[_0xa2d0('0x2a')](saveUpdates(_0x487421['body'],null))['then'](respondWithResult(_0x525a6d,null))[_0xa2d0('0x49')](handleError(_0x525a6d,null));};exports[_0xa2d0('0x29')]=function(_0x19b7c3,_0x5db8ce){return db[_0xa2d0('0x31')][_0xa2d0('0x4e')]({'where':{'id':_0x19b7c3[_0xa2d0('0x4b')]['id']}})[_0xa2d0('0x2a')](handleEntityNotFound(_0x5db8ce,null))[_0xa2d0('0x2a')](removeEntity(_0x5db8ce,null))[_0xa2d0('0x49')](handleError(_0x5db8ce,null));};exports[_0xa2d0('0x58')]=function(_0x98afdc,_0x2ad2d1){return db[_0xa2d0('0x31')][_0xa2d0('0x58')]()[_0xa2d0('0x2a')](respondWithResult(_0x2ad2d1,null))['catch'](handleError(_0x2ad2d1,null));};exports[_0xa2d0('0x59')]=function(_0xb3377f,_0x581a0f,_0x3a236b){var _0x30e01d={'raw':!![],'where':{}},_0x391967={},_0x1a9335;return db['WhatsappQueue']['findOne']({'where':{'id':_0xb3377f[_0xa2d0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x581a0f,null))[_0xa2d0('0x2a')](function(_0x8da0f9){if(_0x8da0f9){_0x1a9335=_0x8da0f9[_0xa2d0('0x2b')]({'plain':!![]});_0x391967[_0xa2d0('0x35')]=_[_0xa2d0('0x39')](db[_0xa2d0('0x5a')][_0xa2d0('0x32')]);_0x391967[_0xa2d0('0x38')]=_[_0xa2d0('0x39')](_0xb3377f['query']);_0x391967[_0xa2d0('0x3a')]=_[_0xa2d0('0x4c')](_0x391967[_0xa2d0('0x35')],_0x391967[_0xa2d0('0x38')]);_0x30e01d[_0xa2d0('0x3b')]=_[_0xa2d0('0x4c')](_0x391967[_0xa2d0('0x35')],qs[_0xa2d0('0x3c')](_0xb3377f[_0xa2d0('0x38')]['fields']));_0x30e01d[_0xa2d0('0x3b')]=_0x30e01d[_0xa2d0('0x3b')][_0xa2d0('0x3d')]?_0x30e01d['attributes']:_0x391967[_0xa2d0('0x35')];if(!_0xb3377f['query']['hasOwnProperty']('nolimit')){_0x30e01d[_0xa2d0('0x23')]=qs[_0xa2d0('0x23')](_0xb3377f['query'][_0xa2d0('0x23')]);_0x30e01d[_0xa2d0('0x20')]=qs[_0xa2d0('0x20')](_0xb3377f[_0xa2d0('0x38')][_0xa2d0('0x20')]);}_0x30e01d[_0xa2d0('0x5b')]=qs[_0xa2d0('0x40')](_0xb3377f[_0xa2d0('0x38')][_0xa2d0('0x40')]);_0x30e01d[_0xa2d0('0x41')]=qs[_0xa2d0('0x3a')](_[_0xa2d0('0x42')](_0xb3377f[_0xa2d0('0x38')],_0x391967['filters']));_0x30e01d[_0xa2d0('0x41')][_0xa2d0('0x5c')]=_0x8da0f9['id'];if(_0xb3377f[_0xa2d0('0x38')]['filter']){_0x30e01d[_0xa2d0('0x41')]=_[_0xa2d0('0x44')](_0x30e01d[_0xa2d0('0x41')],{'$or':_[_0xa2d0('0x36')](_0x30e01d[_0xa2d0('0x3b')],function(_0x50d23e){var _0x5b48d1={};_0x5b48d1[_0x50d23e]={'$like':'%'+_0xb3377f[_0xa2d0('0x38')][_0xa2d0('0x43')]+'%'};return _0x5b48d1;})});}_0x30e01d=_[_0xa2d0('0x44')]({},_0x30e01d,_0xb3377f[_0xa2d0('0x4d')]);return db[_0xa2d0('0x5a')][_0xa2d0('0x48')](_0x30e01d);}})['then'](function(_0x137325){if(_0x137325){return db['User'][_0xa2d0('0x5d')]({'where':{'id':_['map'](_0x137325,_0xa2d0('0x5e')),'role':_0xa2d0('0x5f')},'attributes':['id','name','whatsappPause',_0xa2d0('0x60'),_0xa2d0('0x61')]});}})[_0xa2d0('0x2a')](function(_0x14bf4e){if(_0x14bf4e){return{'count':_0x14bf4e[_0xa2d0('0x22')],'rows':_[_0xa2d0('0x36')](_0x14bf4e['rows'],function(_0x178fbd){return{'membername':_0x178fbd['name'],'UserId':_0x178fbd['id'],'queue_name':_0x1a9335[_0xa2d0('0x37')],'WhatsappQueueId':_0x1a9335['id'],'interface':util[_0xa2d0('0x62')](_0xa2d0('0x63'),_0xa2d0('0x64'),_0x178fbd['name']),'penalty':0x0,'paused':_0x178fbd['whatsappPause'],'createdAt':_0x178fbd['createdAt'],'updatedAt':_0x178fbd['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa2d0('0x2a')](respondWithFilteredResult(_0x581a0f,_0x30e01d))['catch'](handleError(_0x581a0f,null));};exports[_0xa2d0('0x65')]=function(_0x33648b,_0x285ab8,_0x3efb1f){var _0x55313a={};var _0x514068={};var _0xa419e7;var _0x35faaa;return db['WhatsappQueue'][_0xa2d0('0x66')]({'where':{'id':_0x33648b[_0xa2d0('0x4b')]['id']}})[_0xa2d0('0x2a')](handleEntityNotFound(_0x285ab8,null))[_0xa2d0('0x2a')](function(_0x5eb15c){if(_0x5eb15c){_0xa419e7=_0x5eb15c;_0x514068[_0xa2d0('0x35')]=_['keys'](db[_0xa2d0('0x67')][_0xa2d0('0x32')]);_0x514068['query']=_[_0xa2d0('0x39')](_0x33648b[_0xa2d0('0x38')]);_0x514068[_0xa2d0('0x3a')]=_[_0xa2d0('0x4c')](_0x514068[_0xa2d0('0x35')],_0x514068['query']);_0x55313a['attributes']=_['intersection'](_0x514068['model'],qs['fields'](_0x33648b[_0xa2d0('0x38')]['fields']));_0x55313a['attributes']=_0x55313a[_0xa2d0('0x3b')][_0xa2d0('0x3d')]?_0x55313a['attributes']:_0x514068[_0xa2d0('0x35')];_0x55313a[_0xa2d0('0x5b')]=qs['sort'](_0x33648b[_0xa2d0('0x38')][_0xa2d0('0x40')]);_0x55313a[_0xa2d0('0x41')]=qs[_0xa2d0('0x3a')](_['pick'](_0x33648b['query'],_0x514068[_0xa2d0('0x3a')]));if(_0x33648b[_0xa2d0('0x38')][_0xa2d0('0x43')]){_0x55313a['where']=_['merge'](_0x55313a[_0xa2d0('0x41')],{'$or':_[_0xa2d0('0x36')](_0x55313a[_0xa2d0('0x3b')],function(_0x1f75f0){var _0xe7f613={};_0xe7f613[_0x1f75f0]={'$like':'%'+_0x33648b[_0xa2d0('0x38')][_0xa2d0('0x43')]+'%'};return _0xe7f613;})});}_0x55313a=_[_0xa2d0('0x44')]({},_0x55313a,_0x33648b[_0xa2d0('0x4d')]);return _0xa419e7[_0xa2d0('0x65')](_0x55313a);}})[_0xa2d0('0x2a')](function(_0x49fda6){if(_0x49fda6){_0x35faaa=_0x49fda6[_0xa2d0('0x3d')];if(!_0x33648b[_0xa2d0('0x38')][_0xa2d0('0x3e')](_0xa2d0('0x3f'))){_0x55313a[_0xa2d0('0x23')]=qs['limit'](_0x33648b[_0xa2d0('0x38')]['limit']);_0x55313a['offset']=qs[_0xa2d0('0x20')](_0x33648b[_0xa2d0('0x38')][_0xa2d0('0x20')]);}return _0xa419e7['getTeams'](_0x55313a);}})[_0xa2d0('0x2a')](function(_0x34702b){if(_0x34702b){return _0x34702b?{'count':_0x35faaa,'rows':_0x34702b}:null;}})[_0xa2d0('0x2a')](respondWithResult(_0x285ab8,null))[_0xa2d0('0x49')](handleError(_0x285ab8,null));};exports[_0xa2d0('0x68')]=function(_0x46574a,_0x120d9a,_0x195a8b){var _0xb8ca4=_0x46574a[_0xa2d0('0x50')][_0xa2d0('0x69')];return db[_0xa2d0('0x67')][_0xa2d0('0x48')]({'where':{'id':_0xb8ca4},'attributes':['id'],'include':[{'model':db[_0xa2d0('0x6a')],'as':_0xa2d0('0x6b'),'attributes':['id','name','online',_0xa2d0('0x6c'),'interface'],'raw':!![]}]})[_0xa2d0('0x2a')](function(_0xc84b28){if(_0xc84b28){var _0x50a00e=_[_0xa2d0('0x6d')](_0xc84b28,function(_0x46ea27){var _0x51a51a=_0x46ea27[_0xa2d0('0x2b')]({'plain':!![]});return _0x51a51a[_0xa2d0('0x6b')];});return db[_0xa2d0('0x31')][_0xa2d0('0x4e')]({'where':{'id':_0x46574a[_0xa2d0('0x4b')]['id']}})['then'](function(_0x584504){return db['sequelize'][_0xa2d0('0x6e')](function(_0xa898d1){return _0x584504[_0xa2d0('0x68')](_0xb8ca4,{'transaction':_0xa898d1})[_0xa2d0('0x2a')](function(){return BPromise[_0xa2d0('0x6f')](_0x50a00e,function(_0x230405){return db[_0xa2d0('0x5a')][_0xa2d0('0x70')]({'where':{'UserId':_0x230405['id'],'WhatsappQueueId':_0x46574a['params']['id']},'transaction':_0xa898d1});});})[_0xa2d0('0x2a')](function(){_0x50a00e[_0xa2d0('0x71')](function(_0x5a9b8e){socket['emit'](_0xa2d0('0x72'),{'UserId':_0x5a9b8e['id'],'WhatsappQueueId':_0x584504['id']});});});});});}})[_0xa2d0('0x2a')](respondWithStatusCode(_0x120d9a,null))[_0xa2d0('0x49')](handleError(_0x120d9a,null));};exports['removeTeams']=function(_0x53a762,_0x351963,_0x16b192){return db[_0xa2d0('0x67')][_0xa2d0('0x48')]({'where':{'id':_0x53a762[_0xa2d0('0x38')][_0xa2d0('0x69')]},'attributes':['id'],'include':[{'model':db[_0xa2d0('0x6a')],'as':_0xa2d0('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xa2d0('0x2a')](handleEntityNotFound(_0x351963,null))[_0xa2d0('0x2a')](function(_0x44e871){var _0x18a419=_[_0xa2d0('0x36')](_0x44e871,'id');var _0x53bd1b=[];var _0x4bc141=[];var _0x464ca4=squel['select']();_0x464ca4[_0xa2d0('0x73')](_0xa2d0('0x74'))['from'](_0xa2d0('0x75'),'tq')[_0xa2d0('0x76')](_0xa2d0('0x77'),'ut',_0xa2d0('0x78'))[_0xa2d0('0x41')](_0xa2d0('0x79'),_0x53a762[_0xa2d0('0x4b')]['id']);for(var _0x582c4c=0x0;_0x582c4c<_0x44e871['length'];_0x582c4c+=0x1){let _0x5cc643=_0x44e871[_0x582c4c];for(var _0x20ecb8=0x0;_0x20ecb8<_0x5cc643[_0xa2d0('0x6b')][_0xa2d0('0x3d')];_0x20ecb8+=0x1){let _0x46c9cf=_0x5cc643[_0xa2d0('0x6b')][_0x20ecb8];var _0x44135c=_0x464ca4[_0xa2d0('0x7a')]();_0x44135c['where'](_0xa2d0('0x7b'),_0x46c9cf['id']);_0x4bc141[_0xa2d0('0x7c')](db[_0xa2d0('0x7d')][_0xa2d0('0x38')](_0x44135c[_0xa2d0('0x7e')](),{'type':db[_0xa2d0('0x7d')][_0xa2d0('0x7f')][_0xa2d0('0x80')]})['then'](function(_0x26f174){if(_0x26f174[_0xa2d0('0x3d')]===0x1){return _0x46c9cf['id'];}else{var _0x348c59=_[_0xa2d0('0x81')](_[_0xa2d0('0x36')](_0x26f174,'TeamId'),function(_0x277638){return _[_0xa2d0('0x82')](_0x18a419,_0x277638);});if(_0x348c59){return _0x46c9cf['id'];}}}));}}return BPromise['all'](_0x4bc141)[_0xa2d0('0x2a')](function(_0x20c566){_0x53bd1b=_(_0x53bd1b)[_0xa2d0('0x83')](_0x20c566)[_0xa2d0('0x84')]()[_0xa2d0('0x85')]();return db['WhatsappQueue'][_0xa2d0('0x4e')]({'where':{'id':_0x53a762[_0xa2d0('0x4b')]['id']}})[_0xa2d0('0x2a')](function(_0x31e8a9){return db[_0xa2d0('0x7d')][_0xa2d0('0x6e')](function(_0x402d89){return _0x31e8a9[_0xa2d0('0x86')](_0x53a762[_0xa2d0('0x38')][_0xa2d0('0x69')],{'transaction':_0x402d89})['then'](function(){if(!_[_0xa2d0('0x87')](_0x53bd1b)){return _0x31e8a9['removeAgents'](_0x53bd1b,{'transaction':_0x402d89});}})['then'](function(){_0x53bd1b[_0xa2d0('0x71')](function(_0x343a7d){socket['emit'](_0xa2d0('0x88'),{'UserId':_0x343a7d,'WhatsappQueueId':_0x31e8a9['id']});});});});});});})['then'](respondWithStatusCode(_0x351963,null))[_0xa2d0('0x49')](handleError(_0x351963,null));};exports['addAgents']=function(_0x1ae028,_0x53e69d,_0x48e856){return db[_0xa2d0('0x31')]['find']({'where':{'id':_0x1ae028[_0xa2d0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x53e69d,null))[_0xa2d0('0x2a')](function(_0x241826){if(_0x241826){return _0x241826[_0xa2d0('0x89')](_0x1ae028[_0xa2d0('0x50')][_0xa2d0('0x69')],_[_0xa2d0('0x8a')](_0x1ae028[_0xa2d0('0x50')],[_0xa2d0('0x69'),'id'])||{})[_0xa2d0('0x8b')](function(_0x35337a){for(var _0x23b2ab=0x0;_0x23b2ab<_0x1ae028[_0xa2d0('0x50')]['ids'][_0xa2d0('0x3d')];_0x23b2ab+=0x1){socket[_0xa2d0('0x8c')](_0xa2d0('0x72'),{'UserId':_0x1ae028[_0xa2d0('0x50')][_0xa2d0('0x69')][_0x23b2ab],'WhatsappQueueId':_0x1ae028[_0xa2d0('0x4b')]['id']});}return _0x35337a;});}})['then'](respondWithResult(_0x53e69d,null))[_0xa2d0('0x49')](handleError(_0x53e69d,null));};exports[_0xa2d0('0x8d')]=function(_0x2b615b,_0x437bd2,_0x18f39a){return db['WhatsappQueue'][_0xa2d0('0x4e')]({'where':{'id':_0x2b615b[_0xa2d0('0x4b')]['id']}})[_0xa2d0('0x2a')](handleEntityNotFound(_0x437bd2,null))[_0xa2d0('0x2a')](function(_0x380ea5){if(_0x380ea5){return _0x380ea5[_0xa2d0('0x8d')](_0x2b615b[_0xa2d0('0x38')][_0xa2d0('0x69')])[_0xa2d0('0x2a')](function(){if(_[_0xa2d0('0x8e')](_0x2b615b[_0xa2d0('0x38')][_0xa2d0('0x69')])){for(var _0x372b46=0x0;_0x372b46<_0x2b615b[_0xa2d0('0x38')][_0xa2d0('0x69')][_0xa2d0('0x3d')];_0x372b46+=0x1){socket[_0xa2d0('0x8c')](_0xa2d0('0x88'),{'UserId':Number(_0x2b615b[_0xa2d0('0x38')]['ids'][_0x372b46]),'WhatsappQueueId':Number(_0x2b615b['params']['id'])});}}else{socket['emit'](_0xa2d0('0x88'),{'UserId':Number(_0x2b615b['query'][_0xa2d0('0x69')]),'WhatsappQueueId':Number(_0x2b615b[_0xa2d0('0x4b')]['id'])});}});}})[_0xa2d0('0x2a')](respondWithStatusCode(_0x437bd2,null))[_0xa2d0('0x49')](handleError(_0x437bd2,null));};exports[_0xa2d0('0x8f')]=function(_0x538d99,_0x3b066b,_0x4ffe54){var _0x483821={};var _0x259a20={};var _0x574aaa;var _0x130c9c;return db[_0xa2d0('0x31')][_0xa2d0('0x66')]({'where':{'id':_0x538d99[_0xa2d0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3b066b,null))['then'](function(_0x2cb5c7){if(_0x2cb5c7){_0x574aaa=_0x2cb5c7;_0x259a20['model']=_[_0xa2d0('0x39')](db[_0xa2d0('0x6a')][_0xa2d0('0x32')]);_0x259a20[_0xa2d0('0x38')]=_['keys'](_0x538d99['query']);_0x259a20[_0xa2d0('0x3a')]=_['intersection'](_0x259a20[_0xa2d0('0x35')],_0x259a20[_0xa2d0('0x38')]);_0x483821[_0xa2d0('0x3b')]=_[_0xa2d0('0x4c')](_0x259a20['model'],qs[_0xa2d0('0x3c')](_0x538d99[_0xa2d0('0x38')][_0xa2d0('0x3c')]));_0x483821[_0xa2d0('0x3b')]=_0x483821[_0xa2d0('0x3b')][_0xa2d0('0x3d')]?_0x483821['attributes']:_0x259a20[_0xa2d0('0x35')];_0x483821[_0xa2d0('0x5b')]=qs[_0xa2d0('0x40')](_0x538d99[_0xa2d0('0x38')][_0xa2d0('0x40')]);_0x483821[_0xa2d0('0x41')]=qs[_0xa2d0('0x3a')](_['pick'](_0x538d99[_0xa2d0('0x38')],_0x259a20['filters']));if(_0x538d99['query']['filter']){_0x483821[_0xa2d0('0x41')]=_[_0xa2d0('0x44')](_0x483821['where'],{'$or':_[_0xa2d0('0x36')](_0x483821['attributes'],function(_0x176c59){var _0x3ba72a={};_0x3ba72a[_0x176c59]={'$like':'%'+_0x538d99[_0xa2d0('0x38')][_0xa2d0('0x43')]+'%'};return _0x3ba72a;})});}_0x483821=_[_0xa2d0('0x44')]({},_0x483821,_0x538d99[_0xa2d0('0x4d')]);return _0x574aaa[_0xa2d0('0x8f')](_0x483821);}})['then'](function(_0x1e1a11){if(_0x1e1a11){_0x130c9c=_0x1e1a11[_0xa2d0('0x3d')];if(!_0x538d99[_0xa2d0('0x38')][_0xa2d0('0x3e')]('nolimit')){_0x483821[_0xa2d0('0x23')]=qs[_0xa2d0('0x23')](_0x538d99[_0xa2d0('0x38')][_0xa2d0('0x23')]);_0x483821['offset']=qs['offset'](_0x538d99[_0xa2d0('0x38')]['offset']);}return _0x574aaa['getAgents'](_0x483821);}})[_0xa2d0('0x2a')](function(_0x2c34b4){if(_0x2c34b4){return _0x2c34b4?{'count':_0x130c9c,'rows':_0x2c34b4}:null;}})['then'](respondWithResult(_0x3b066b,null))['catch'](handleError(_0x3b066b,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index ed05dae..6fd6bb6 100644 --- a/server/api/whatsappQueue/whatsappQueue.events.js +++ b/server/api/whatsappQueue/whatsappQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa973=['hasOwnProperty','hook','../../mysqldb','setMaxListeners','update','emit'];(function(_0x927e60,_0x354a26){var _0x3bb094=function(_0x2f40cb){while(--_0x2f40cb){_0x927e60['push'](_0x927e60['shift']());}};_0x3bb094(++_0x354a26);}(_0xa973,0x128));var _0x3a97=function(_0x185f01,_0x3930e3){_0x185f01=_0x185f01-0x0;var _0x330844=_0xa973[_0x185f01];return _0x330844;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x3a97('0x0'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x3a97('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3a97('0x2'),'afterDestroy':'remove'};function emitEvent(_0x12544b){return function(_0x19cc8e,_0x343e62,_0x1c61ad){WhatsappQueueEvents[_0x3a97('0x3')](_0x12544b+':'+_0x19cc8e['id'],_0x19cc8e);WhatsappQueueEvents[_0x3a97('0x3')](_0x12544b,_0x19cc8e);_0x1c61ad(null);};}for(var e in events){if(events[_0x3a97('0x4')](e)){var event=events[e];WhatsappQueue[_0x3a97('0x5')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x14d0=['exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit','hook'];(function(_0x82c354,_0x1b4c7d){var _0x593a18=function(_0x252cf5){while(--_0x252cf5){_0x82c354['push'](_0x82c354['shift']());}};_0x593a18(++_0x1b4c7d);}(_0x14d0,0x8d));var _0x014d=function(_0xc40b9f,_0x17ec1f){_0xc40b9f=_0xc40b9f-0x0;var _0x535b9c=_0x14d0[_0xc40b9f];return _0x535b9c;};'use strict';var EventEmitter=require(_0x014d('0x0'));var WhatsappQueue=require(_0x014d('0x1'))['db'][_0x014d('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x014d('0x3')](0x0);var events={'afterCreate':_0x014d('0x4'),'afterUpdate':_0x014d('0x5'),'afterDestroy':_0x014d('0x6')};function emitEvent(_0x1f950a){return function(_0x93ab5a,_0x2bb130,_0x35afd2){WhatsappQueueEvents[_0x014d('0x7')](_0x1f950a+':'+_0x93ab5a['id'],_0x93ab5a);WhatsappQueueEvents[_0x014d('0x7')](_0x1f950a,_0x93ab5a);_0x35afd2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x014d('0x8')](e,emitEvent(event));}}module[_0x014d('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index a21185b..92e1f8d 100644 --- a/server/api/whatsappQueue/whatsappQueue.model.js +++ b/server/api/whatsappQueue/whatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99a0=['../../config/logger','bluebird','request-promise','exports','define','whatsapp_queues','lodash'];(function(_0x361a52,_0x1dc3fc){var _0x29891d=function(_0x172f38){while(--_0x172f38){_0x361a52['push'](_0x361a52['shift']());}};_0x29891d(++_0x1dc3fc);}(_0x99a0,0x16b));var _0x099a=function(_0x4eb347,_0x52520a){_0x4eb347=_0x4eb347-0x0;var _0x145754=_0x99a0[_0x4eb347];return _0x145754;};'use strict';var _=require(_0x099a('0x0'));var util=require('util');var logger=require(_0x099a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x099a('0x2'));var rp=require(_0x099a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0x099a('0x4')]=function(_0x284478,_0x2174b5){return _0x284478[_0x099a('0x5')]('WhatsappQueue',attributes,{'tableName':_0x099a('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab52=['define','whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xab52,0x18e));var _0x2ab5=function(_0x1aa4e8,_0x2ea4a6){_0x1aa4e8=_0x1aa4e8-0x0;var _0xe88a15=_0xab52[_0x1aa4e8];return _0xe88a15;};'use strict';var _=require(_0x2ab5('0x0'));var util=require(_0x2ab5('0x1'));var logger=require(_0x2ab5('0x2'))(_0x2ab5('0x3'));var moment=require(_0x2ab5('0x4'));var BPromise=require('bluebird');var rp=require(_0x2ab5('0x5'));var fs=require('fs');var path=require(_0x2ab5('0x6'));var rimraf=require('rimraf');var config=require(_0x2ab5('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0x2ab5('0x8')]=function(_0x863304,_0x5f33d2){return _0x863304[_0x2ab5('0x9')]('WhatsappQueue',attributes,{'tableName':_0x2ab5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index c190239..60dabdb 100644 --- a/server/api/whatsappQueue/whatsappQueue.rpc.js +++ b/server/api/whatsappQueue/whatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8921=['ShowWhatsappQueue','find','where','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','raw','options','attributes','include','map','model'];(function(_0x458eef,_0x551783){var _0x2fb384=function(_0x28465e){while(--_0x28465e){_0x458eef['push'](_0x458eef['shift']());}};_0x2fb384(++_0x551783);}(_0x8921,0x154));var _0x1892=function(_0x336985,_0x1185a7){_0x336985=_0x336985-0x0;var _0x1495b1=_0x8921[_0x336985];return _0x1495b1;};'use strict';var _=require(_0x1892('0x0'));var util=require(_0x1892('0x1'));var moment=require('moment');var BPromise=require(_0x1892('0x2'));var rs=require(_0x1892('0x3'));var fs=require('fs');var Redis=require(_0x1892('0x4'));var db=require(_0x1892('0x5'))['db'];var utils=require(_0x1892('0x6'));var logger=require(_0x1892('0x7'))(_0x1892('0x8'));var config=require(_0x1892('0x9'));var jayson=require(_0x1892('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x1892('0xb')](config[_0x1892('0xc')],{'host':_0x1892('0xd'),'port':0x18eb});var socket=require(_0x1892('0xe'))(new Redis(config[_0x1892('0xc')]));require(_0x1892('0xf'))[_0x1892('0x10')](socket);function respondWithRpcPromise(_0x23cb3c,_0x3620a8,_0xc96ff2){return new BPromise(function(_0xfa0cd6,_0x37dea2){return client[_0x1892('0x11')](_0x23cb3c,_0xc96ff2)['then'](function(_0x13a684){logger['info'](_0x1892('0x12'),_0x3620a8,_0x1892('0x13'));logger[_0x1892('0x14')](_0x1892('0x15'),_0x3620a8,'request\x20sent',JSON[_0x1892('0x16')](_0x13a684));if(_0x13a684[_0x1892('0x17')]){if(_0x13a684[_0x1892('0x17')][_0x1892('0x18')]===0x1f4){logger[_0x1892('0x17')](_0x1892('0x12'),_0x3620a8,_0x13a684[_0x1892('0x17')][_0x1892('0x19')]);return _0x37dea2(_0x13a684[_0x1892('0x17')][_0x1892('0x19')]);}logger[_0x1892('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x3620a8,_0x13a684[_0x1892('0x17')][_0x1892('0x19')]);return _0xfa0cd6(_0x13a684[_0x1892('0x17')]['message']);}else{logger[_0x1892('0x1a')](_0x1892('0x12'),_0x3620a8,'request\x20sent');_0xfa0cd6(_0x13a684[_0x1892('0x1b')][_0x1892('0x19')]);}})[_0x1892('0x1c')](function(_0x4ee08e){logger[_0x1892('0x17')](_0x1892('0x12'),_0x3620a8,_0x4ee08e);_0x37dea2(_0x4ee08e);});});}exports[_0x1892('0x1d')]=function(_0x513a18){var _0x16254a=this;return new Promise(function(_0x36eca9,_0x4ce111){return db[_0x1892('0x1e')][_0x1892('0x1f')]({'raw':_0x513a18['options']?_0x513a18['options'][_0x1892('0x20')]===undefined?!![]:![]:!![],'where':_0x513a18['options']?_0x513a18[_0x1892('0x21')]['where']||null:null,'attributes':_0x513a18[_0x1892('0x21')]?_0x513a18[_0x1892('0x21')][_0x1892('0x22')]||null:null,'limit':_0x513a18[_0x1892('0x21')]?_0x513a18[_0x1892('0x21')]['limit']||null:null,'include':_0x513a18[_0x1892('0x21')]?_0x513a18['options'][_0x1892('0x23')]?_[_0x1892('0x24')](_0x513a18[_0x1892('0x21')]['include'],function(_0x98b849){return{'model':db[_0x98b849[_0x1892('0x25')]],'as':_0x98b849['as'],'attributes':_0x98b849[_0x1892('0x22')],'include':_0x98b849[_0x1892('0x23')]?_[_0x1892('0x24')](_0x98b849[_0x1892('0x23')],function(_0x7cd124){return{'model':db[_0x7cd124[_0x1892('0x25')]],'as':_0x7cd124['as'],'attributes':_0x7cd124['attributes'],'include':_0x7cd124[_0x1892('0x23')]?_[_0x1892('0x24')](_0x7cd124[_0x1892('0x23')],function(_0x2dfb6f){return{'model':db[_0x2dfb6f[_0x1892('0x25')]],'as':_0x2dfb6f['as'],'attributes':_0x2dfb6f[_0x1892('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x90ead7){logger[_0x1892('0x1a')]('GetWhatsappQueue',_0x513a18);logger[_0x1892('0x14')]('GetWhatsappQueue',_0x513a18,JSON[_0x1892('0x16')](_0x90ead7));_0x36eca9(_0x90ead7);})[_0x1892('0x1c')](function(_0x2ba9ee){logger['error']('GetWhatsappQueue',_0x2ba9ee[_0x1892('0x19')],_0x513a18);_0x4ce111(_0x16254a[_0x1892('0x17')](0x1f4,_0x2ba9ee[_0x1892('0x19')]));});});};exports[_0x1892('0x26')]=function(_0x4b53df){var _0x414e71=this;return new Promise(function(_0x5afbd0,_0x15717b){return db[_0x1892('0x1e')][_0x1892('0x27')]({'raw':_0x4b53df[_0x1892('0x21')]?_0x4b53df[_0x1892('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x4b53df[_0x1892('0x21')]?_0x4b53df[_0x1892('0x21')][_0x1892('0x28')]||null:null,'attributes':_0x4b53df[_0x1892('0x21')]?_0x4b53df[_0x1892('0x21')]['attributes']||null:null,'include':_0x4b53df['options']?_0x4b53df[_0x1892('0x21')][_0x1892('0x23')]?_[_0x1892('0x24')](_0x4b53df[_0x1892('0x21')][_0x1892('0x23')],function(_0x589c74){return{'model':db[_0x589c74[_0x1892('0x25')]],'as':_0x589c74['as'],'attributes':_0x589c74['attributes'],'include':_0x589c74[_0x1892('0x23')]?_['map'](_0x589c74[_0x1892('0x23')],function(_0x5b8452){return{'model':db[_0x5b8452[_0x1892('0x25')]],'as':_0x5b8452['as'],'attributes':_0x5b8452['attributes'],'include':_0x5b8452['include']?_[_0x1892('0x24')](_0x5b8452['include'],function(_0x9120d0){return{'model':db[_0x9120d0[_0x1892('0x25')]],'as':_0x9120d0['as'],'attributes':_0x9120d0[_0x1892('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1892('0x29')](function(_0x71ded7){logger[_0x1892('0x1a')](_0x1892('0x26'),_0x4b53df);logger['debug'](_0x1892('0x26'),_0x4b53df,JSON[_0x1892('0x16')](_0x71ded7));_0x5afbd0(_0x71ded7);})[_0x1892('0x1c')](function(_0x12b725){logger[_0x1892('0x17')](_0x1892('0x26'),_0x12b725[_0x1892('0x19')],_0x4b53df);_0x15717b(_0x414e71[_0x1892('0x17')](0x1f4,_0x12b725['message']));});});}; \ No newline at end of file +var _0xe6e5=['debug','stringify','error','message','info','result','GetWhatsappQueue','findAll','options','raw','where','limit','map','include','attributes','model','catch','ShowWhatsappQueue','WhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','WhatsappQueue,\x20%s,\x20%s'];(function(_0x2e476a,_0x1c655d){var _0x188142=function(_0x4936ef){while(--_0x4936ef){_0x2e476a['push'](_0x2e476a['shift']());}};_0x188142(++_0x1c655d);}(_0xe6e5,0x1e7));var _0x5e6e=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xe6e5[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require(_0x5e6e('0x0'));var util=require(_0x5e6e('0x1'));var moment=require(_0x5e6e('0x2'));var BPromise=require(_0x5e6e('0x3'));var rs=require(_0x5e6e('0x4'));var fs=require('fs');var Redis=require(_0x5e6e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5e6e('0x6'));var logger=require(_0x5e6e('0x7'))(_0x5e6e('0x8'));var config=require(_0x5e6e('0x9'));var jayson=require(_0x5e6e('0xa'));var client=jayson['client'][_0x5e6e('0xb')]({'port':0x232a});config[_0x5e6e('0xc')]=_[_0x5e6e('0xd')](config[_0x5e6e('0xc')],{'host':_0x5e6e('0xe'),'port':0x18eb});var socket=require(_0x5e6e('0xf'))(new Redis(config[_0x5e6e('0xc')]));require('./whatsappQueue.socket')[_0x5e6e('0x10')](socket);function respondWithRpcPromise(_0x1e67bd,_0x26ea1b,_0x29f03c){return new BPromise(function(_0x5a843c,_0x6f7aac){return client[_0x5e6e('0x11')](_0x1e67bd,_0x29f03c)[_0x5e6e('0x12')](function(_0x4468f9){logger['info'](_0x5e6e('0x13'),_0x26ea1b,'request\x20sent');logger[_0x5e6e('0x14')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x26ea1b,'request\x20sent',JSON[_0x5e6e('0x15')](_0x4468f9));if(_0x4468f9[_0x5e6e('0x16')]){if(_0x4468f9[_0x5e6e('0x16')]['code']===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x26ea1b,_0x4468f9['error'][_0x5e6e('0x17')]);return _0x6f7aac(_0x4468f9[_0x5e6e('0x16')][_0x5e6e('0x17')]);}logger[_0x5e6e('0x16')](_0x5e6e('0x13'),_0x26ea1b,_0x4468f9[_0x5e6e('0x16')]['message']);return _0x5a843c(_0x4468f9[_0x5e6e('0x16')][_0x5e6e('0x17')]);}else{logger[_0x5e6e('0x18')](_0x5e6e('0x13'),_0x26ea1b,'request\x20sent');_0x5a843c(_0x4468f9[_0x5e6e('0x19')][_0x5e6e('0x17')]);}})['catch'](function(_0x1a8972){logger[_0x5e6e('0x16')](_0x5e6e('0x13'),_0x26ea1b,_0x1a8972);_0x6f7aac(_0x1a8972);});});}exports[_0x5e6e('0x1a')]=function(_0x218b20){var _0x2ebda7=this;return new Promise(function(_0x42810c,_0x284ca0){return db['WhatsappQueue'][_0x5e6e('0x1b')]({'raw':_0x218b20[_0x5e6e('0x1c')]?_0x218b20['options'][_0x5e6e('0x1d')]===undefined?!![]:![]:!![],'where':_0x218b20[_0x5e6e('0x1c')]?_0x218b20[_0x5e6e('0x1c')][_0x5e6e('0x1e')]||null:null,'attributes':_0x218b20[_0x5e6e('0x1c')]?_0x218b20[_0x5e6e('0x1c')]['attributes']||null:null,'limit':_0x218b20[_0x5e6e('0x1c')]?_0x218b20[_0x5e6e('0x1c')][_0x5e6e('0x1f')]||null:null,'include':_0x218b20[_0x5e6e('0x1c')]?_0x218b20[_0x5e6e('0x1c')]['include']?_[_0x5e6e('0x20')](_0x218b20[_0x5e6e('0x1c')][_0x5e6e('0x21')],function(_0x25ba8f){return{'model':db[_0x25ba8f['model']],'as':_0x25ba8f['as'],'attributes':_0x25ba8f[_0x5e6e('0x22')],'include':_0x25ba8f[_0x5e6e('0x21')]?_[_0x5e6e('0x20')](_0x25ba8f[_0x5e6e('0x21')],function(_0x5730a2){return{'model':db[_0x5730a2[_0x5e6e('0x23')]],'as':_0x5730a2['as'],'attributes':_0x5730a2['attributes'],'include':_0x5730a2[_0x5e6e('0x21')]?_[_0x5e6e('0x20')](_0x5730a2[_0x5e6e('0x21')],function(_0x193236){return{'model':db[_0x193236[_0x5e6e('0x23')]],'as':_0x193236['as'],'attributes':_0x193236[_0x5e6e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5e6e('0x12')](function(_0x54ed59){logger['info']('GetWhatsappQueue',_0x218b20);logger['debug'](_0x5e6e('0x1a'),_0x218b20,JSON['stringify'](_0x54ed59));_0x42810c(_0x54ed59);})[_0x5e6e('0x24')](function(_0x3efd24){logger[_0x5e6e('0x16')](_0x5e6e('0x1a'),_0x3efd24[_0x5e6e('0x17')],_0x218b20);_0x284ca0(_0x2ebda7['error'](0x1f4,_0x3efd24[_0x5e6e('0x17')]));});});};exports[_0x5e6e('0x25')]=function(_0x5dca9b){var _0x130f93=this;return new Promise(function(_0x41682b,_0xeab151){return db[_0x5e6e('0x26')]['find']({'raw':_0x5dca9b[_0x5e6e('0x1c')]?_0x5dca9b['options'][_0x5e6e('0x1d')]===undefined?!![]:![]:!![],'where':_0x5dca9b[_0x5e6e('0x1c')]?_0x5dca9b[_0x5e6e('0x1c')]['where']||null:null,'attributes':_0x5dca9b[_0x5e6e('0x1c')]?_0x5dca9b[_0x5e6e('0x1c')][_0x5e6e('0x22')]||null:null,'include':_0x5dca9b[_0x5e6e('0x1c')]?_0x5dca9b['options'][_0x5e6e('0x21')]?_[_0x5e6e('0x20')](_0x5dca9b[_0x5e6e('0x1c')][_0x5e6e('0x21')],function(_0x504912){return{'model':db[_0x504912[_0x5e6e('0x23')]],'as':_0x504912['as'],'attributes':_0x504912[_0x5e6e('0x22')],'include':_0x504912[_0x5e6e('0x21')]?_[_0x5e6e('0x20')](_0x504912[_0x5e6e('0x21')],function(_0x45e453){return{'model':db[_0x45e453[_0x5e6e('0x23')]],'as':_0x45e453['as'],'attributes':_0x45e453[_0x5e6e('0x22')],'include':_0x45e453[_0x5e6e('0x21')]?_[_0x5e6e('0x20')](_0x45e453[_0x5e6e('0x21')],function(_0x40b7b8){return{'model':db[_0x40b7b8[_0x5e6e('0x23')]],'as':_0x40b7b8['as'],'attributes':_0x40b7b8[_0x5e6e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5e6e('0x12')](function(_0x480d1b){logger[_0x5e6e('0x18')](_0x5e6e('0x25'),_0x5dca9b);logger['debug'](_0x5e6e('0x25'),_0x5dca9b,JSON['stringify'](_0x480d1b));_0x41682b(_0x480d1b);})[_0x5e6e('0x24')](function(_0x26d663){logger['error'](_0x5e6e('0x25'),_0x26d663[_0x5e6e('0x17')],_0x5dca9b);_0xeab151(_0x130f93[_0x5e6e('0x16')](0x1f4,_0x26d663[_0x5e6e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index d6b0928..5bf0359 100644 --- a/server/api/whatsappQueue/whatsappQueue.socket.js +++ b/server/api/whatsappQueue/whatsappQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9297=['removeListener','length','whatsappQueue:','./whatsappQueue.events','save','remove','update','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9297,0x9b));var _0x7929=function(_0x38cbf4,_0x55ffa8){_0x38cbf4=_0x38cbf4-0x0;var _0x3eeeab=_0x9297[_0x38cbf4];return _0x3eeeab;};'use strict';var WhatsappQueueEvents=require(_0x7929('0x0'));var events=[_0x7929('0x1'),_0x7929('0x2'),_0x7929('0x3')];function createListener(_0x205650,_0x25dded){return function(_0x3b991c){_0x25dded[_0x7929('0x4')](_0x205650,_0x3b991c);};}function removeListener(_0x1732b6,_0x256aa9){return function(){WhatsappQueueEvents[_0x7929('0x5')](_0x1732b6,_0x256aa9);};}exports['register']=function(_0xf7aebd){for(var _0x9ebf9c=0x0,_0xac663a=events[_0x7929('0x6')];_0x9ebf9c<_0xac663a;_0x9ebf9c++){var _0x19b9ab=events[_0x9ebf9c];var _0x140f52=createListener(_0x7929('0x7')+_0x19b9ab,_0xf7aebd);WhatsappQueueEvents['on'](_0x19b9ab,_0x140f52);}}; \ No newline at end of file +var _0x4c1f=['save','remove','update','emit','register','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x5c280d,_0xd67fa0){var _0x460137=function(_0x344a6c){while(--_0x344a6c){_0x5c280d['push'](_0x5c280d['shift']());}};_0x460137(++_0xd67fa0);}(_0x4c1f,0x14f));var _0xf4c1=function(_0x4d9f3c,_0x55b8dd){_0x4d9f3c=_0x4d9f3c-0x0;var _0xc935a3=_0x4c1f[_0x4d9f3c];return _0xc935a3;};'use strict';var WhatsappQueueEvents=require(_0xf4c1('0x0'));var events=[_0xf4c1('0x1'),_0xf4c1('0x2'),_0xf4c1('0x3')];function createListener(_0x96ade4,_0x3d02ce){return function(_0xc6c44a){_0x3d02ce[_0xf4c1('0x4')](_0x96ade4,_0xc6c44a);};}function removeListener(_0x384b66,_0x3e532e){return function(){WhatsappQueueEvents['removeListener'](_0x384b66,_0x3e532e);};}exports[_0xf4c1('0x5')]=function(_0x22c06d){for(var _0x235c7d=0x0,_0x3f2ae6=events[_0xf4c1('0x6')];_0x235c7d<_0x3f2ae6;_0x235c7d++){var _0x43cbfb=events[_0x235c7d];var _0x3dec35=createListener(_0xf4c1('0x7')+_0x43cbfb,_0x22c06d);WhatsappQueueEvents['on'](_0x43cbfb,_0x3dec35);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 8b48c9d..472c09c 100644 --- a/server/api/whatsappQueueReport/index.js +++ b/server/api/whatsappQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc7=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy'];(function(_0x2ccaad,_0x6e23ff){var _0x3f09c2=function(_0x59850c){while(--_0x59850c){_0x2ccaad['push'](_0x2ccaad['shift']());}};_0x3f09c2(++_0x6e23ff);}(_0x5fc7,0x1e1));var _0x75fc=function(_0x5ef55a,_0x2a03b1){_0x5ef55a=_0x5ef55a-0x0;var _0x20ae40=_0x5fc7[_0x5ef55a];return _0x20ae40;};'use strict';var multer=require(_0x75fc('0x0'));var util=require(_0x75fc('0x1'));var path=require(_0x75fc('0x2'));var timeout=require(_0x75fc('0x3'));var express=require(_0x75fc('0x4'));var router=express[_0x75fc('0x5')]();var fs_extra=require(_0x75fc('0x6'));var auth=require(_0x75fc('0x7'));var interaction=require(_0x75fc('0x8'));var config=require(_0x75fc('0x9'));var controller=require(_0x75fc('0xa'));router[_0x75fc('0xb')]('/',auth['isAuthenticated'](),controller[_0x75fc('0xc')]);router[_0x75fc('0xb')](_0x75fc('0xd'),auth[_0x75fc('0xe')](),controller[_0x75fc('0xf')]);router[_0x75fc('0xb')](_0x75fc('0x10'),auth[_0x75fc('0xe')](),controller[_0x75fc('0x11')]);router[_0x75fc('0x12')]('/',auth['isAuthenticated'](),controller[_0x75fc('0x13')]);router[_0x75fc('0x14')](_0x75fc('0x10'),auth[_0x75fc('0xe')](),controller['update']);router[_0x75fc('0x15')](_0x75fc('0x10'),auth[_0x75fc('0xe')](),controller[_0x75fc('0x16')]);module[_0x75fc('0x17')]=router; \ No newline at end of file +var _0x5ff3=['/:id','post','create','put','update','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index'];(function(_0x219007,_0x53298a){var _0x4b46db=function(_0x53b2b0){while(--_0x53b2b0){_0x219007['push'](_0x219007['shift']());}};_0x4b46db(++_0x53298a);}(_0x5ff3,0x17d));var _0x35ff=function(_0x2f8919,_0x128bc2){_0x2f8919=_0x2f8919-0x0;var _0x2e658d=_0x5ff3[_0x2f8919];return _0x2e658d;};'use strict';var multer=require('multer');var util=require(_0x35ff('0x0'));var path=require('path');var timeout=require(_0x35ff('0x1'));var express=require('express');var router=express[_0x35ff('0x2')]();var fs_extra=require(_0x35ff('0x3'));var auth=require(_0x35ff('0x4'));var interaction=require(_0x35ff('0x5'));var config=require('../../config/environment');var controller=require(_0x35ff('0x6'));router[_0x35ff('0x7')]('/',auth[_0x35ff('0x8')](),controller[_0x35ff('0x9')]);router[_0x35ff('0x7')]('/describe',auth[_0x35ff('0x8')](),controller['describe']);router[_0x35ff('0x7')](_0x35ff('0xa'),auth[_0x35ff('0x8')](),controller['show']);router[_0x35ff('0xb')]('/',auth['isAuthenticated'](),controller[_0x35ff('0xc')]);router[_0x35ff('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x35ff('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x35ff('0xf')]);module[_0x35ff('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 160a06b..4e9b109 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aa7=['DATE','sequelize','STRING'];(function(_0x43c5a8,_0x459a0a){var _0x16615d=function(_0x5e08bf){while(--_0x5e08bf){_0x43c5a8['push'](_0x43c5a8['shift']());}};_0x16615d(++_0x459a0a);}(_0x6aa7,0x178));var _0x76aa=function(_0x29670d,_0x5084f3){_0x29670d=_0x29670d-0x0;var _0xc19032=_0x6aa7[_0x29670d];return _0xc19032;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x76aa('0x1')]},'joinAt':{'type':Sequelize[_0x76aa('0x2')]},'leaveAt':{'type':Sequelize[_0x76aa('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x76aa('0x2')]},'reason':{'type':Sequelize[_0x76aa('0x1')]}}; \ No newline at end of file +var _0x8ef6=['STRING','DATE','sequelize','exports'];(function(_0x39ef79,_0x4cd3ab){var _0x529871=function(_0x253003){while(--_0x253003){_0x39ef79['push'](_0x39ef79['shift']());}};_0x529871(++_0x4cd3ab);}(_0x8ef6,0xf2));var _0x68ef=function(_0x269e27,_0x333704){_0x269e27=_0x269e27-0x0;var _0x3e08a9=_0x8ef6[_0x269e27];return _0x3e08a9;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'uniqueid':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x68ef('0x2')]},'joinAt':{'type':Sequelize[_0x68ef('0x3')]},'leaveAt':{'type':Sequelize[_0x68ef('0x3')]},'acceptAt':{'type':Sequelize[_0x68ef('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x68ef('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index a9f538a..4aca566 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01bd=['nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','WhatsappQueueReport','includeAll','findAll','catch','rawAttributes','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x2468f1,_0x5c2ae6){var _0x4937bd=function(_0x25b77f){while(--_0x25b77f){_0x2468f1['push'](_0x2468f1['shift']());}};_0x4937bd(++_0x5c2ae6);}(_0x01bd,0x141));var _0xd01b=function(_0x1ebf4f,_0x446ba0){_0x1ebf4f=_0x1ebf4f-0x0;var _0x4f9851=_0x01bd[_0x1ebf4f];return _0x4f9851;};'use strict';var emlformat=require(_0xd01b('0x0'));var rimraf=require(_0xd01b('0x1'));var zipdir=require(_0xd01b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd01b('0x3'));var moment=require('moment');var BPromise=require(_0xd01b('0x4'));var Mustache=require(_0xd01b('0x5'));var util=require(_0xd01b('0x6'));var path=require(_0xd01b('0x7'));var sox=require(_0xd01b('0x8'));var csv=require(_0xd01b('0x9'));var ejs=require(_0xd01b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd01b('0xb'));var crypto=require(_0xd01b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd01b('0xd'));var Papa=require('papaparse');var Redis=require(_0xd01b('0xe'));var authService=require(_0xd01b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd01b('0x10'));var hardwareService=require(_0xd01b('0x11'));var logger=require('../../config/logger')(_0xd01b('0x12'));var utils=require('../../config/utils');var config=require(_0xd01b('0x13'));var licenseUtil=require(_0xd01b('0x14'));var db=require(_0xd01b('0x15'))['db'];function respondWithStatusCode(_0xd25085,_0x390904){_0x390904=_0x390904||0xcc;return function(_0x5ef663){if(_0x5ef663){return _0xd25085[_0xd01b('0x16')](_0x390904);}return _0xd25085[_0xd01b('0x17')](_0x390904)[_0xd01b('0x18')]();};}function respondWithResult(_0x280851,_0x5ebcdb){_0x5ebcdb=_0x5ebcdb||0xc8;return function(_0x3edb26){if(_0x3edb26){return _0x280851[_0xd01b('0x17')](_0x5ebcdb)[_0xd01b('0x19')](_0x3edb26);}};}function respondWithFilteredResult(_0x46aa31,_0x3375e8){return function(_0xa062d2){if(_0xa062d2){var _0x537276=typeof _0x3375e8[_0xd01b('0x1a')]===_0xd01b('0x1b')&&typeof _0x3375e8[_0xd01b('0x1c')]===_0xd01b('0x1b');var _0x2487d8=_0xa062d2[_0xd01b('0x1d')];var _0x13aaa2=_0x537276?0x0:_0x3375e8['offset'];var _0x3ff61a=_0x537276?_0xa062d2['count']:_0x3375e8[_0xd01b('0x1a')]+_0x3375e8['limit'];var _0x5d19bd;if(_0x3ff61a>=_0x2487d8){_0x3ff61a=_0x2487d8;_0x5d19bd=0xc8;}else{_0x5d19bd=0xce;}_0x46aa31[_0xd01b('0x17')](_0x5d19bd);return _0x46aa31[_0xd01b('0x1e')](_0xd01b('0x1f'),_0x13aaa2+'-'+_0x3ff61a+'/'+_0x2487d8)[_0xd01b('0x19')](_0xa062d2);}return null;};}function patchUpdates(_0x3e57dd){return function(_0x1fefaf){try{jsonpatch[_0xd01b('0x20')](_0x1fefaf,_0x3e57dd,!![]);}catch(_0x339546){return BPromise[_0xd01b('0x21')](_0x339546);}return _0x1fefaf[_0xd01b('0x22')]();};}function saveUpdates(_0x1830a7,_0x6eca2f){return function(_0x468299){if(_0x468299){return _0x468299[_0xd01b('0x23')](_0x1830a7)['then'](function(_0x507cfd){return _0x507cfd;});}return null;};}function removeEntity(_0x4a4511,_0x2f9252){return function(_0x4d7bb7){if(_0x4d7bb7){return _0x4d7bb7[_0xd01b('0x24')]()[_0xd01b('0x25')](function(){_0x4a4511[_0xd01b('0x17')](0xcc)[_0xd01b('0x18')]();});}};}function handleEntityNotFound(_0x3d4b0b,_0x23a3f0){return function(_0x4612c3){if(!_0x4612c3){_0x3d4b0b[_0xd01b('0x16')](0x194);}return _0x4612c3;};}function handleError(_0x285624,_0x555238){_0x555238=_0x555238||0x1f4;return function(_0x2100d9){logger[_0xd01b('0x26')](_0x2100d9[_0xd01b('0x27')]);if(_0x2100d9[_0xd01b('0x28')]){delete _0x2100d9[_0xd01b('0x28')];}_0x285624[_0xd01b('0x17')](_0x555238)['send'](_0x2100d9);};}exports[_0xd01b('0x29')]=function(_0x37925e,_0x44c16a){var _0x30e0b2={},_0x373ad7={},_0x1b36b8={'count':0x0,'rows':[]};var _0x30b947=_[_0xd01b('0x2a')](db['WhatsappQueueReport']['rawAttributes'],function(_0xfa23af){return{'name':_0xfa23af[_0xd01b('0x2b')],'type':_0xfa23af[_0xd01b('0x2c')][_0xd01b('0x2d')]};});_0x373ad7['model']=_[_0xd01b('0x2a')](_0x30b947,_0xd01b('0x28'));_0x373ad7['query']=_[_0xd01b('0x2e')](_0x37925e[_0xd01b('0x2f')]);_0x373ad7['filters']=_[_0xd01b('0x30')](_0x373ad7[_0xd01b('0x31')],_0x373ad7[_0xd01b('0x2f')]);_0x30e0b2[_0xd01b('0x32')]=_[_0xd01b('0x30')](_0x373ad7[_0xd01b('0x31')],qs['fields'](_0x37925e[_0xd01b('0x2f')][_0xd01b('0x33')]));_0x30e0b2[_0xd01b('0x32')]=_0x30e0b2['attributes'][_0xd01b('0x34')]?_0x30e0b2['attributes']:_0x373ad7[_0xd01b('0x31')];if(!_0x37925e[_0xd01b('0x2f')][_0xd01b('0x35')](_0xd01b('0x36'))){_0x30e0b2[_0xd01b('0x1c')]=qs[_0xd01b('0x1c')](_0x37925e[_0xd01b('0x2f')][_0xd01b('0x1c')]);_0x30e0b2[_0xd01b('0x1a')]=qs[_0xd01b('0x1a')](_0x37925e[_0xd01b('0x2f')][_0xd01b('0x1a')]);}_0x30e0b2[_0xd01b('0x37')]=qs[_0xd01b('0x38')](_0x37925e[_0xd01b('0x2f')][_0xd01b('0x38')]);_0x30e0b2['where']=qs[_0xd01b('0x39')](_[_0xd01b('0x3a')](_0x37925e[_0xd01b('0x2f')],_0x373ad7[_0xd01b('0x39')]),_0x30b947);if(_0x37925e[_0xd01b('0x2f')][_0xd01b('0x3b')]){_0x30e0b2[_0xd01b('0x3c')]=_[_0xd01b('0x3d')](_0x30e0b2[_0xd01b('0x3c')],{'$or':_[_0xd01b('0x2a')](_0x30b947,function(_0x1cb30c){if(_0x1cb30c['type']!==_0xd01b('0x3e')){var _0x29848c={};_0x29848c[_0x1cb30c['name']]={'$like':'%'+_0x37925e[_0xd01b('0x2f')][_0xd01b('0x3b')]+'%'};return _0x29848c;}})});}_0x30e0b2=_[_0xd01b('0x3d')]({},_0x30e0b2,_0x37925e[_0xd01b('0x3f')]);var _0x167b0c={'where':_0x30e0b2['where']};return db[_0xd01b('0x40')]['count'](_0x167b0c)['then'](function(_0x273ea7){_0x1b36b8['count']=_0x273ea7;if(_0x37925e['query'][_0xd01b('0x41')]){_0x30e0b2['include']=[{'all':!![]}];}return db[_0xd01b('0x40')][_0xd01b('0x42')](_0x30e0b2);})[_0xd01b('0x25')](function(_0x1e3aee){_0x1b36b8['rows']=_0x1e3aee;return _0x1b36b8;})['then'](respondWithFilteredResult(_0x44c16a,_0x30e0b2))[_0xd01b('0x43')](handleError(_0x44c16a,null));};exports['show']=function(_0x3727c8,_0x42160f){var _0x1dbf5b={'raw':!![],'where':{'id':_0x3727c8['params']['id']}},_0x429171={};_0x429171[_0xd01b('0x31')]=_[_0xd01b('0x2e')](db[_0xd01b('0x40')][_0xd01b('0x44')]);_0x429171[_0xd01b('0x2f')]=_['keys'](_0x3727c8[_0xd01b('0x2f')]);_0x429171[_0xd01b('0x39')]=_[_0xd01b('0x30')](_0x429171[_0xd01b('0x31')],_0x429171['query']);_0x1dbf5b['attributes']=_[_0xd01b('0x30')](_0x429171[_0xd01b('0x31')],qs['fields'](_0x3727c8[_0xd01b('0x2f')][_0xd01b('0x33')]));_0x1dbf5b[_0xd01b('0x32')]=_0x1dbf5b[_0xd01b('0x32')]['length']?_0x1dbf5b[_0xd01b('0x32')]:_0x429171[_0xd01b('0x31')];if(_0x3727c8[_0xd01b('0x2f')]['includeAll']){_0x1dbf5b[_0xd01b('0x45')]=[{'all':!![]}];}_0x1dbf5b=_[_0xd01b('0x3d')]({},_0x1dbf5b,_0x3727c8[_0xd01b('0x3f')]);return db[_0xd01b('0x40')][_0xd01b('0x46')](_0x1dbf5b)[_0xd01b('0x25')](handleEntityNotFound(_0x42160f,null))[_0xd01b('0x25')](respondWithResult(_0x42160f,null))[_0xd01b('0x43')](handleError(_0x42160f,null));};exports[_0xd01b('0x47')]=function(_0x1a22d8,_0x56c300){return db[_0xd01b('0x40')]['create'](_0x1a22d8[_0xd01b('0x48')],{})[_0xd01b('0x25')](respondWithResult(_0x56c300,0xc9))['catch'](handleError(_0x56c300,null));};exports['update']=function(_0x38cbb6,_0x442285){if(_0x38cbb6[_0xd01b('0x48')]['id']){delete _0x38cbb6['body']['id'];}return db['WhatsappQueueReport'][_0xd01b('0x46')]({'where':{'id':_0x38cbb6[_0xd01b('0x49')]['id']}})['then'](handleEntityNotFound(_0x442285,null))[_0xd01b('0x25')](saveUpdates(_0x38cbb6[_0xd01b('0x48')],null))['then'](respondWithResult(_0x442285,null))['catch'](handleError(_0x442285,null));};exports[_0xd01b('0x24')]=function(_0x3f777c,_0x5937ce){return db[_0xd01b('0x40')][_0xd01b('0x46')]({'where':{'id':_0x3f777c[_0xd01b('0x49')]['id']}})[_0xd01b('0x25')](handleEntityNotFound(_0x5937ce,null))[_0xd01b('0x25')](removeEntity(_0x5937ce,null))[_0xd01b('0x43')](handleError(_0x5937ce,null));};exports[_0xd01b('0x4a')]=function(_0x3b62be,_0x367f26){return db[_0xd01b('0x40')][_0xd01b('0x4a')]()[_0xd01b('0x25')](respondWithResult(_0x367f26,null))[_0xd01b('0x43')](handleError(_0x367f26,null));}; \ No newline at end of file +var _0xf3b1=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel'];(function(_0x3e7b3b,_0x14d240){var _0x2aa720=function(_0x535885){while(--_0x535885){_0x3e7b3b['push'](_0x3e7b3b['shift']());}};_0x2aa720(++_0x14d240);}(_0xf3b1,0x16a));var _0x1f3b=function(_0x5bd7dd,_0x1019e6){_0x5bd7dd=_0x5bd7dd-0x0;var _0x4b5c1e=_0xf3b1[_0x5bd7dd];return _0x4b5c1e;};'use strict';var emlformat=require(_0x1f3b('0x0'));var rimraf=require(_0x1f3b('0x1'));var zipdir=require(_0x1f3b('0x2'));var jsonpatch=require(_0x1f3b('0x3'));var rp=require(_0x1f3b('0x4'));var moment=require(_0x1f3b('0x5'));var BPromise=require(_0x1f3b('0x6'));var Mustache=require(_0x1f3b('0x7'));var util=require(_0x1f3b('0x8'));var path=require('path');var sox=require(_0x1f3b('0x9'));var csv=require(_0x1f3b('0xa'));var ejs=require(_0x1f3b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1f3b('0xc'));var crypto=require(_0x1f3b('0xd'));var jsforce=require(_0x1f3b('0xe'));var deskjs=require(_0x1f3b('0xf'));var toCsv=require(_0x1f3b('0xa'));var querystring=require(_0x1f3b('0x10'));var Papa=require(_0x1f3b('0x11'));var Redis=require('ioredis');var authService=require(_0x1f3b('0x12'));var qs=require(_0x1f3b('0x13'));var as=require(_0x1f3b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f3b('0x15'))(_0x1f3b('0x16'));var utils=require(_0x1f3b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1f3b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ee464,_0x7d5295){_0x7d5295=_0x7d5295||0xcc;return function(_0x2c1071){if(_0x2c1071){return _0x4ee464[_0x1f3b('0x19')](_0x7d5295);}return _0x4ee464['status'](_0x7d5295)['end']();};}function respondWithResult(_0x3239cd,_0x31ee51){_0x31ee51=_0x31ee51||0xc8;return function(_0x3cbd9f){if(_0x3cbd9f){return _0x3239cd[_0x1f3b('0x1a')](_0x31ee51)[_0x1f3b('0x1b')](_0x3cbd9f);}};}function respondWithFilteredResult(_0x1c4e2b,_0x424a50){return function(_0x324a6b){if(_0x324a6b){var _0x2ac99a=typeof _0x424a50[_0x1f3b('0x1c')]===_0x1f3b('0x1d')&&typeof _0x424a50[_0x1f3b('0x1e')]===_0x1f3b('0x1d');var _0x244e6a=_0x324a6b[_0x1f3b('0x1f')];var _0x37382f=_0x2ac99a?0x0:_0x424a50[_0x1f3b('0x1c')];var _0x5f4fc3=_0x2ac99a?_0x324a6b['count']:_0x424a50[_0x1f3b('0x1c')]+_0x424a50[_0x1f3b('0x1e')];var _0x1f75a3;if(_0x5f4fc3>=_0x244e6a){_0x5f4fc3=_0x244e6a;_0x1f75a3=0xc8;}else{_0x1f75a3=0xce;}_0x1c4e2b['status'](_0x1f75a3);return _0x1c4e2b[_0x1f3b('0x20')](_0x1f3b('0x21'),_0x37382f+'-'+_0x5f4fc3+'/'+_0x244e6a)[_0x1f3b('0x1b')](_0x324a6b);}return null;};}function patchUpdates(_0x3b3536){return function(_0x25b683){try{jsonpatch[_0x1f3b('0x22')](_0x25b683,_0x3b3536,!![]);}catch(_0x9fa096){return BPromise[_0x1f3b('0x23')](_0x9fa096);}return _0x25b683[_0x1f3b('0x24')]();};}function saveUpdates(_0x3346b6,_0x3fd9aa){return function(_0x455886){if(_0x455886){return _0x455886[_0x1f3b('0x25')](_0x3346b6)[_0x1f3b('0x26')](function(_0x43408c){return _0x43408c;});}return null;};}function removeEntity(_0x443b6d,_0x35425c){return function(_0x2404e9){if(_0x2404e9){return _0x2404e9['destroy']()[_0x1f3b('0x26')](function(){_0x443b6d[_0x1f3b('0x1a')](0xcc)[_0x1f3b('0x27')]();});}};}function handleEntityNotFound(_0x1a9d77,_0x1b15bc){return function(_0x149c82){if(!_0x149c82){_0x1a9d77[_0x1f3b('0x19')](0x194);}return _0x149c82;};}function handleError(_0x4ae009,_0x4a36af){_0x4a36af=_0x4a36af||0x1f4;return function(_0x2ef14a){logger[_0x1f3b('0x28')](_0x2ef14a[_0x1f3b('0x29')]);if(_0x2ef14a[_0x1f3b('0x2a')]){delete _0x2ef14a[_0x1f3b('0x2a')];}_0x4ae009[_0x1f3b('0x1a')](_0x4a36af)[_0x1f3b('0x2b')](_0x2ef14a);};}exports[_0x1f3b('0x2c')]=function(_0x3658b9,_0x121133){var _0x3df24d={},_0x50ace4={},_0x1df638={'count':0x0,'rows':[]};var _0x427fe8=_['map'](db[_0x1f3b('0x2d')][_0x1f3b('0x2e')],function(_0x596762){return{'name':_0x596762[_0x1f3b('0x2f')],'type':_0x596762[_0x1f3b('0x30')][_0x1f3b('0x31')]};});_0x50ace4[_0x1f3b('0x32')]=_['map'](_0x427fe8,_0x1f3b('0x2a'));_0x50ace4[_0x1f3b('0x33')]=_[_0x1f3b('0x34')](_0x3658b9[_0x1f3b('0x33')]);_0x50ace4[_0x1f3b('0x35')]=_[_0x1f3b('0x36')](_0x50ace4[_0x1f3b('0x32')],_0x50ace4[_0x1f3b('0x33')]);_0x3df24d['attributes']=_[_0x1f3b('0x36')](_0x50ace4['model'],qs[_0x1f3b('0x37')](_0x3658b9[_0x1f3b('0x33')][_0x1f3b('0x37')]));_0x3df24d[_0x1f3b('0x38')]=_0x3df24d[_0x1f3b('0x38')][_0x1f3b('0x39')]?_0x3df24d[_0x1f3b('0x38')]:_0x50ace4[_0x1f3b('0x32')];if(!_0x3658b9[_0x1f3b('0x33')]['hasOwnProperty']('nolimit')){_0x3df24d[_0x1f3b('0x1e')]=qs[_0x1f3b('0x1e')](_0x3658b9[_0x1f3b('0x33')][_0x1f3b('0x1e')]);_0x3df24d[_0x1f3b('0x1c')]=qs[_0x1f3b('0x1c')](_0x3658b9['query'][_0x1f3b('0x1c')]);}_0x3df24d[_0x1f3b('0x3a')]=qs['sort'](_0x3658b9[_0x1f3b('0x33')][_0x1f3b('0x3b')]);_0x3df24d['where']=qs['filters'](_['pick'](_0x3658b9[_0x1f3b('0x33')],_0x50ace4[_0x1f3b('0x35')]),_0x427fe8);if(_0x3658b9[_0x1f3b('0x33')]['filter']){_0x3df24d[_0x1f3b('0x3c')]=_[_0x1f3b('0x3d')](_0x3df24d[_0x1f3b('0x3c')],{'$or':_['map'](_0x427fe8,function(_0x23676b){if(_0x23676b['type']!==_0x1f3b('0x3e')){var _0x5c26f8={};_0x5c26f8[_0x23676b['name']]={'$like':'%'+_0x3658b9[_0x1f3b('0x33')]['filter']+'%'};return _0x5c26f8;}})});}_0x3df24d=_['merge']({},_0x3df24d,_0x3658b9['options']);var _0x35f9ab={'where':_0x3df24d['where']};return db['WhatsappQueueReport']['count'](_0x35f9ab)[_0x1f3b('0x26')](function(_0x37cf8c){_0x1df638[_0x1f3b('0x1f')]=_0x37cf8c;if(_0x3658b9[_0x1f3b('0x33')][_0x1f3b('0x3f')]){_0x3df24d[_0x1f3b('0x40')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x1f3b('0x41')](_0x3df24d);})[_0x1f3b('0x26')](function(_0x5d218e){_0x1df638['rows']=_0x5d218e;return _0x1df638;})[_0x1f3b('0x26')](respondWithFilteredResult(_0x121133,_0x3df24d))[_0x1f3b('0x42')](handleError(_0x121133,null));};exports[_0x1f3b('0x43')]=function(_0x2b134c,_0x3c8c34){var _0x2c55d0={'raw':!![],'where':{'id':_0x2b134c[_0x1f3b('0x44')]['id']}},_0x2a1496={};_0x2a1496[_0x1f3b('0x32')]=_['keys'](db[_0x1f3b('0x2d')][_0x1f3b('0x2e')]);_0x2a1496['query']=_['keys'](_0x2b134c[_0x1f3b('0x33')]);_0x2a1496[_0x1f3b('0x35')]=_['intersection'](_0x2a1496[_0x1f3b('0x32')],_0x2a1496[_0x1f3b('0x33')]);_0x2c55d0[_0x1f3b('0x38')]=_['intersection'](_0x2a1496[_0x1f3b('0x32')],qs[_0x1f3b('0x37')](_0x2b134c[_0x1f3b('0x33')][_0x1f3b('0x37')]));_0x2c55d0[_0x1f3b('0x38')]=_0x2c55d0[_0x1f3b('0x38')]['length']?_0x2c55d0[_0x1f3b('0x38')]:_0x2a1496[_0x1f3b('0x32')];if(_0x2b134c['query'][_0x1f3b('0x3f')]){_0x2c55d0[_0x1f3b('0x40')]=[{'all':!![]}];}_0x2c55d0=_['merge']({},_0x2c55d0,_0x2b134c[_0x1f3b('0x45')]);return db['WhatsappQueueReport'][_0x1f3b('0x46')](_0x2c55d0)[_0x1f3b('0x26')](handleEntityNotFound(_0x3c8c34,null))['then'](respondWithResult(_0x3c8c34,null))[_0x1f3b('0x42')](handleError(_0x3c8c34,null));};exports[_0x1f3b('0x47')]=function(_0x1662dc,_0x4362e7){return db[_0x1f3b('0x2d')]['create'](_0x1662dc[_0x1f3b('0x48')],{})[_0x1f3b('0x26')](respondWithResult(_0x4362e7,0xc9))['catch'](handleError(_0x4362e7,null));};exports[_0x1f3b('0x25')]=function(_0x5e31c2,_0xb768e7){if(_0x5e31c2[_0x1f3b('0x48')]['id']){delete _0x5e31c2[_0x1f3b('0x48')]['id'];}return db[_0x1f3b('0x2d')][_0x1f3b('0x46')]({'where':{'id':_0x5e31c2[_0x1f3b('0x44')]['id']}})[_0x1f3b('0x26')](handleEntityNotFound(_0xb768e7,null))[_0x1f3b('0x26')](saveUpdates(_0x5e31c2[_0x1f3b('0x48')],null))['then'](respondWithResult(_0xb768e7,null))[_0x1f3b('0x42')](handleError(_0xb768e7,null));};exports[_0x1f3b('0x49')]=function(_0x35164a,_0x5aae90){return db[_0x1f3b('0x2d')]['find']({'where':{'id':_0x35164a['params']['id']}})[_0x1f3b('0x26')](handleEntityNotFound(_0x5aae90,null))[_0x1f3b('0x26')](removeEntity(_0x5aae90,null))[_0x1f3b('0x42')](handleError(_0x5aae90,null));};exports['describe']=function(_0x437207,_0x2798cc){return db['WhatsappQueueReport'][_0x1f3b('0x4a')]()[_0x1f3b('0x26')](respondWithResult(_0x2798cc,null))[_0x1f3b('0x42')](handleError(_0x2798cc,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index efcac42..11fa56d 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.model.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c6f=['rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','uniqueid','api','moment','bluebird','request-promise'];(function(_0x4a06de,_0x1cddf3){var _0x5d8eaf=function(_0x44c3f1){while(--_0x44c3f1){_0x4a06de['push'](_0x4a06de['shift']());}};_0x5d8eaf(++_0x1cddf3);}(_0x8c6f,0x149));var _0xf8c6=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x8c6f[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf8c6('0x0'));var moment=require(_0xf8c6('0x1'));var BPromise=require(_0xf8c6('0x2'));var rp=require(_0xf8c6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8c6('0x4'));var config=require(_0xf8c6('0x5'));var attributes=require(_0xf8c6('0x6'));module[_0xf8c6('0x7')]=function(_0x40cb51,_0x5963c4){return _0x40cb51['define']('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf8c6('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1f1f=['exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x146221,_0x49a97a){var _0x552ecb=function(_0x123caf){while(--_0x123caf){_0x146221['push'](_0x146221['shift']());}};_0x552ecb(++_0x49a97a);}(_0x1f1f,0xe5));var _0xf1f1=function(_0x2f6f50,_0x1d21a7){_0x2f6f50=_0x2f6f50-0x0;var _0x2cf365=_0x1f1f[_0x2f6f50];return _0x2cf365;};'use strict';var _=require(_0xf1f1('0x0'));var util=require(_0xf1f1('0x1'));var logger=require(_0xf1f1('0x2'))(_0xf1f1('0x3'));var moment=require(_0xf1f1('0x4'));var BPromise=require(_0xf1f1('0x5'));var rp=require(_0xf1f1('0x6'));var fs=require('fs');var path=require(_0xf1f1('0x7'));var rimraf=require(_0xf1f1('0x8'));var config=require(_0xf1f1('0x9'));var attributes=require(_0xf1f1('0xa'));module[_0xf1f1('0xb')]=function(_0x1dede4,_0x457bcb){return _0x1dede4[_0xf1f1('0xc')](_0xf1f1('0xd'),attributes,{'tableName':_0xf1f1('0xe'),'paranoid':![],'indexes':[{'name':_0xf1f1('0xf'),'fields':[_0xf1f1('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 14f0656..dde6838 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf780=['catch','create','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','WhatsappQueueReport','update','where','limit','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xf780,0x94));var _0x0f78=function(_0x336dfe,_0x1148a0){_0x336dfe=_0x336dfe-0x0;var _0x382349=_0xf780[_0x336dfe];return _0x382349;};'use strict';var _=require(_0x0f78('0x0'));var util=require(_0x0f78('0x1'));var moment=require(_0x0f78('0x2'));var BPromise=require(_0x0f78('0x3'));var rs=require(_0x0f78('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f78('0x5'))['db'];var utils=require(_0x0f78('0x6'));var logger=require(_0x0f78('0x7'))(_0x0f78('0x8'));var config=require(_0x0f78('0x9'));var jayson=require(_0x0f78('0xa'));var client=jayson[_0x0f78('0xb')][_0x0f78('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2cd3b3,_0x598265,_0x4f94e7){return new BPromise(function(_0x1180e3,_0x557a97){return client[_0x0f78('0xd')](_0x2cd3b3,_0x4f94e7)[_0x0f78('0xe')](function(_0xa6939c){logger[_0x0f78('0xf')](_0x0f78('0x10'),_0x598265,'request\x20sent');logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x598265,'request\x20sent',JSON[_0x0f78('0x11')](_0xa6939c));if(_0xa6939c['error']){if(_0xa6939c[_0x0f78('0x12')]['code']===0x1f4){logger[_0x0f78('0x12')](_0x0f78('0x10'),_0x598265,_0xa6939c[_0x0f78('0x12')]['message']);return _0x557a97(_0xa6939c[_0x0f78('0x12')][_0x0f78('0x13')]);}logger[_0x0f78('0x12')](_0x0f78('0x10'),_0x598265,_0xa6939c[_0x0f78('0x12')][_0x0f78('0x13')]);return _0x1180e3(_0xa6939c[_0x0f78('0x12')][_0x0f78('0x13')]);}else{logger[_0x0f78('0xf')](_0x0f78('0x10'),_0x598265,_0x0f78('0x14'));_0x1180e3(_0xa6939c[_0x0f78('0x15')][_0x0f78('0x13')]);}})[_0x0f78('0x16')](function(_0x4d5a33){logger[_0x0f78('0x12')](_0x0f78('0x10'),_0x598265,_0x4d5a33);_0x557a97(_0x4d5a33);});});}exports['CreateWhatsappQueueReport']=function(_0x380723){var _0x247846=this;return new Promise(function(_0x15d86c,_0x2f44f5){return db['WhatsappQueueReport'][_0x0f78('0x17')](_0x380723[_0x0f78('0x18')],{'raw':_0x380723[_0x0f78('0x19')]?_0x380723[_0x0f78('0x19')][_0x0f78('0x1a')]===undefined?!![]:![]:!![]})[_0x0f78('0xe')](function(_0x2a915d){logger[_0x0f78('0xf')](_0x0f78('0x1b'),_0x380723);logger['debug'](_0x0f78('0x1b'),_0x380723,JSON[_0x0f78('0x11')](_0x2a915d));_0x15d86c(_0x2a915d);})[_0x0f78('0x16')](function(_0x3508ff){logger[_0x0f78('0x12')](_0x0f78('0x1b'),_0x3508ff[_0x0f78('0x13')],_0x380723);_0x2f44f5(_0x247846[_0x0f78('0x12')](0x1f4,_0x3508ff[_0x0f78('0x13')]));});});};exports[_0x0f78('0x1c')]=function(_0x591a42){var _0x3446c6=this;return new Promise(function(_0x5a84b3,_0x259126){return db[_0x0f78('0x1d')][_0x0f78('0x1e')](_0x591a42[_0x0f78('0x18')],{'raw':_0x591a42[_0x0f78('0x19')]?_0x591a42[_0x0f78('0x19')][_0x0f78('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x591a42[_0x0f78('0x19')]?_0x591a42[_0x0f78('0x19')][_0x0f78('0x1f')]||null:null,'attributes':_0x591a42[_0x0f78('0x19')]?_0x591a42['options']['attributes']||null:null,'limit':_0x591a42[_0x0f78('0x19')]?_0x591a42[_0x0f78('0x19')][_0x0f78('0x20')]||null:null})[_0x0f78('0xe')](function(_0x91dbb8){logger[_0x0f78('0xf')](_0x0f78('0x1c'),_0x591a42);logger[_0x0f78('0x21')]('UpdateWhatsappQueueReport',_0x591a42,JSON['stringify'](_0x91dbb8));_0x5a84b3(_0x91dbb8);})['catch'](function(_0x276cc7){logger[_0x0f78('0x12')](_0x0f78('0x1c'),_0x276cc7[_0x0f78('0x13')],_0x591a42);_0x259126(_0x3446c6['error'](0x1f4,_0x276cc7[_0x0f78('0x13')]));});});}; \ No newline at end of file +var _0x4bf2=['where','attributes','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','CreateWhatsappQueueReport','create','body','options','stringify','UpdateWhatsappQueueReport','WhatsappQueueReport','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4bf2,0x136));var _0x24bf=function(_0x33ed60,_0x4a594a){_0x33ed60=_0x33ed60-0x0;var _0x47f94e=_0x4bf2[_0x33ed60];return _0x47f94e;};'use strict';var _=require(_0x24bf('0x0'));var util=require(_0x24bf('0x1'));var moment=require(_0x24bf('0x2'));var BPromise=require(_0x24bf('0x3'));var rs=require(_0x24bf('0x4'));var fs=require('fs');var Redis=require(_0x24bf('0x5'));var db=require(_0x24bf('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x24bf('0x7'))(_0x24bf('0x8'));var config=require(_0x24bf('0x9'));var jayson=require(_0x24bf('0xa'));var client=jayson[_0x24bf('0xb')][_0x24bf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x333fe9,_0x39619e,_0x461bd7){return new BPromise(function(_0x2fd94a,_0x13aae8){return client[_0x24bf('0xd')](_0x333fe9,_0x461bd7)['then'](function(_0x1ebaa2){logger['info'](_0x24bf('0xe'),_0x39619e,_0x24bf('0xf'));logger['debug'](_0x24bf('0x10'),_0x39619e,_0x24bf('0xf'),JSON['stringify'](_0x1ebaa2));if(_0x1ebaa2[_0x24bf('0x11')]){if(_0x1ebaa2[_0x24bf('0x11')][_0x24bf('0x12')]===0x1f4){logger[_0x24bf('0x11')](_0x24bf('0xe'),_0x39619e,_0x1ebaa2[_0x24bf('0x11')]['message']);return _0x13aae8(_0x1ebaa2[_0x24bf('0x11')][_0x24bf('0x13')]);}logger[_0x24bf('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x39619e,_0x1ebaa2[_0x24bf('0x11')]['message']);return _0x2fd94a(_0x1ebaa2[_0x24bf('0x11')][_0x24bf('0x13')]);}else{logger[_0x24bf('0x14')]('WhatsappQueueReport,\x20%s,\x20%s',_0x39619e,'request\x20sent');_0x2fd94a(_0x1ebaa2['result']['message']);}})[_0x24bf('0x15')](function(_0x16c63b){logger['error'](_0x24bf('0xe'),_0x39619e,_0x16c63b);_0x13aae8(_0x16c63b);});});}exports[_0x24bf('0x16')]=function(_0x4b9264){var _0x5ad8d6=this;return new Promise(function(_0x178a66,_0x4b12e4){return db['WhatsappQueueReport'][_0x24bf('0x17')](_0x4b9264[_0x24bf('0x18')],{'raw':_0x4b9264['options']?_0x4b9264[_0x24bf('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3ec33d){logger[_0x24bf('0x14')](_0x24bf('0x16'),_0x4b9264);logger['debug']('CreateWhatsappQueueReport',_0x4b9264,JSON[_0x24bf('0x1a')](_0x3ec33d));_0x178a66(_0x3ec33d);})[_0x24bf('0x15')](function(_0x1cb0f5){logger[_0x24bf('0x11')](_0x24bf('0x16'),_0x1cb0f5[_0x24bf('0x13')],_0x4b9264);_0x4b12e4(_0x5ad8d6[_0x24bf('0x11')](0x1f4,_0x1cb0f5[_0x24bf('0x13')]));});});};exports[_0x24bf('0x1b')]=function(_0x29b0fd){var _0x34b652=this;return new Promise(function(_0x55e23f,_0x3aa00e){return db[_0x24bf('0x1c')][_0x24bf('0x1d')](_0x29b0fd[_0x24bf('0x18')],{'raw':_0x29b0fd['options']?_0x29b0fd['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29b0fd[_0x24bf('0x19')]?_0x29b0fd[_0x24bf('0x19')][_0x24bf('0x1e')]||null:null,'attributes':_0x29b0fd[_0x24bf('0x19')]?_0x29b0fd[_0x24bf('0x19')][_0x24bf('0x1f')]||null:null,'limit':_0x29b0fd[_0x24bf('0x19')]?_0x29b0fd[_0x24bf('0x19')]['limit']||null:null})[_0x24bf('0x20')](function(_0x3d2065){logger['info'](_0x24bf('0x1b'),_0x29b0fd);logger[_0x24bf('0x21')](_0x24bf('0x1b'),_0x29b0fd,JSON[_0x24bf('0x1a')](_0x3d2065));_0x55e23f(_0x3d2065);})[_0x24bf('0x15')](function(_0x32c470){logger[_0x24bf('0x11')](_0x24bf('0x1b'),_0x32c470[_0x24bf('0x13')],_0x29b0fd);_0x3aa00e(_0x34b652[_0x24bf('0x11')](0x1f4,_0x32c470[_0x24bf('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 0d9ca38..0cdcd59 100644 --- a/server/api/whatsappTransferReport/index.js +++ b/server/api/whatsappTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b80=['get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1b3940,_0x35a818){var _0x2bf339=function(_0x57dfc){while(--_0x57dfc){_0x1b3940['push'](_0x1b3940['shift']());}};_0x2bf339(++_0x35a818);}(_0x6b80,0x1b1));var _0x06b8=function(_0x20d08e,_0x4cc575){_0x20d08e=_0x20d08e-0x0;var _0x2cbd12=_0x6b80[_0x20d08e];return _0x2cbd12;};'use strict';var multer=require(_0x06b8('0x0'));var util=require('util');var path=require(_0x06b8('0x1'));var timeout=require('connect-timeout');var express=require(_0x06b8('0x2'));var router=express[_0x06b8('0x3')]();var fs_extra=require(_0x06b8('0x4'));var auth=require(_0x06b8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x06b8('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0x06b8('0x7')]('/',auth[_0x06b8('0x8')](),controller[_0x06b8('0x9')]);router['get'](_0x06b8('0xa'),auth[_0x06b8('0x8')](),controller[_0x06b8('0xb')]);router[_0x06b8('0x7')](_0x06b8('0xc'),auth[_0x06b8('0x8')](),controller[_0x06b8('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x06b8('0xe')]);router[_0x06b8('0xf')](_0x06b8('0xc'),auth[_0x06b8('0x8')](),controller[_0x06b8('0x10')]);router[_0x06b8('0x11')](_0x06b8('0xc'),auth[_0x06b8('0x8')](),controller[_0x06b8('0x12')]);module[_0x06b8('0x13')]=router; \ No newline at end of file +var _0x9b5d=['delete','multer','path','connect-timeout','Router','fs-extra','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0x33cf10,_0x562577){var _0x244198=function(_0x1d99d4){while(--_0x1d99d4){_0x33cf10['push'](_0x33cf10['shift']());}};_0x244198(++_0x562577);}(_0x9b5d,0x188));var _0xd9b5=function(_0x16718e,_0x3e6083){_0x16718e=_0x16718e-0x0;var _0x43c2dc=_0x9b5d[_0x16718e];return _0x43c2dc;};'use strict';var multer=require(_0xd9b5('0x0'));var util=require('util');var path=require(_0xd9b5('0x1'));var timeout=require(_0xd9b5('0x2'));var express=require('express');var router=express[_0xd9b5('0x3')]();var fs_extra=require(_0xd9b5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd9b5('0x5'));var controller=require('./whatsappTransferReport.controller');router[_0xd9b5('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd9b5('0x6')](_0xd9b5('0x7'),auth[_0xd9b5('0x8')](),controller[_0xd9b5('0x9')]);router[_0xd9b5('0x6')](_0xd9b5('0xa'),auth['isAuthenticated'](),controller[_0xd9b5('0xb')]);router[_0xd9b5('0xc')]('/',auth[_0xd9b5('0x8')](),controller[_0xd9b5('0xd')]);router[_0xd9b5('0xe')]('/:id',auth[_0xd9b5('0x8')](),controller[_0xd9b5('0xf')]);router[_0xd9b5('0x10')](_0xd9b5('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 95f87bc..ab44965 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xb10b,0x12a));var _0xbb10=function(_0x180659,_0xa1b1c4){_0x180659=_0x180659-0x0;var _0x224761=_0xb10b[_0x180659];return _0x224761;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbb10('0x2')](_0xbb10('0x3'),'agent',_0xbb10('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbb10('0x5')]}}; \ No newline at end of file +var _0x0b0e=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x0b0e,0x187));var _0xe0b0=function(_0x513545,_0x158f2e){_0x513545=_0x513545-0x0;var _0x18b7c5=_0x0b0e[_0x513545];return _0x18b7c5;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe0b0('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index ed862fe..c5de960 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x537d=['count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','then','rows','catch','params','fields','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','limit','undefined'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x537d,0x72));var _0xd537=function(_0x5a16af,_0x2bcea9){_0x5a16af=_0x5a16af-0x0;var _0x59ae20=_0x537d[_0x5a16af];return _0x59ae20;};'use strict';var emlformat=require(_0xd537('0x0'));var rimraf=require(_0xd537('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd537('0x2'));var rp=require(_0xd537('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd537('0x4'));var path=require(_0xd537('0x5'));var sox=require('sox');var csv=require(_0xd537('0x6'));var ejs=require(_0xd537('0x7'));var fs=require('fs');var fs_extra=require(_0xd537('0x8'));var _=require(_0xd537('0x9'));var squel=require(_0xd537('0xa'));var crypto=require(_0xd537('0xb'));var jsforce=require(_0xd537('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd537('0x6'));var querystring=require('querystring');var Papa=require(_0xd537('0xd'));var Redis=require(_0xd537('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd537('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd537('0x10'))(_0xd537('0x11'));var utils=require(_0xd537('0x12'));var config=require(_0xd537('0x13'));var licenseUtil=require(_0xd537('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x501182,_0x5e6732){_0x5e6732=_0x5e6732||0xcc;return function(_0x2b0e9e){if(_0x2b0e9e){return _0x501182[_0xd537('0x15')](_0x5e6732);}return _0x501182['status'](_0x5e6732)[_0xd537('0x16')]();};}function respondWithResult(_0x5713db,_0x47a629){_0x47a629=_0x47a629||0xc8;return function(_0x2d4099){if(_0x2d4099){return _0x5713db[_0xd537('0x17')](_0x47a629)['json'](_0x2d4099);}};}function respondWithFilteredResult(_0x3c3760,_0x278e51){return function(_0x514091){if(_0x514091){var _0x3715fa=typeof _0x278e51['offset']==='undefined'&&typeof _0x278e51[_0xd537('0x18')]===_0xd537('0x19');var _0x3c50c4=_0x514091[_0xd537('0x1a')];var _0x23b4f4=_0x3715fa?0x0:_0x278e51[_0xd537('0x1b')];var _0x1c896f=_0x3715fa?_0x514091['count']:_0x278e51[_0xd537('0x1b')]+_0x278e51[_0xd537('0x18')];var _0x1d6cb8;if(_0x1c896f>=_0x3c50c4){_0x1c896f=_0x3c50c4;_0x1d6cb8=0xc8;}else{_0x1d6cb8=0xce;}_0x3c3760[_0xd537('0x17')](_0x1d6cb8);return _0x3c3760['set'](_0xd537('0x1c'),_0x23b4f4+'-'+_0x1c896f+'/'+_0x3c50c4)['json'](_0x514091);}return null;};}function patchUpdates(_0x191aab){return function(_0x426b1f){try{jsonpatch[_0xd537('0x1d')](_0x426b1f,_0x191aab,!![]);}catch(_0x3761c6){return BPromise[_0xd537('0x1e')](_0x3761c6);}return _0x426b1f[_0xd537('0x1f')]();};}function saveUpdates(_0x203640,_0x28069f){return function(_0x45a116){if(_0x45a116){return _0x45a116[_0xd537('0x20')](_0x203640)['then'](function(_0x472ebf){return _0x472ebf;});}return null;};}function removeEntity(_0x139d27,_0x3d6df2){return function(_0x2cb3c5){if(_0x2cb3c5){return _0x2cb3c5[_0xd537('0x21')]()['then'](function(){_0x139d27[_0xd537('0x17')](0xcc)[_0xd537('0x16')]();});}};}function handleEntityNotFound(_0x3e183a,_0x4bbc46){return function(_0x14e7fd){if(!_0x14e7fd){_0x3e183a['sendStatus'](0x194);}return _0x14e7fd;};}function handleError(_0x5e540a,_0x30f618){_0x30f618=_0x30f618||0x1f4;return function(_0x30b605){logger['error'](_0x30b605[_0xd537('0x22')]);if(_0x30b605[_0xd537('0x23')]){delete _0x30b605['name'];}_0x5e540a['status'](_0x30f618)[_0xd537('0x24')](_0x30b605);};}exports[_0xd537('0x25')]=function(_0x3e788d,_0x1ef3ee){var _0x4afed7={},_0x1627cc={},_0x59bd2d={'count':0x0,'rows':[]};var _0x405121=_[_0xd537('0x26')](db[_0xd537('0x27')][_0xd537('0x28')],function(_0x2c9a4d){return{'name':_0x2c9a4d[_0xd537('0x29')],'type':_0x2c9a4d[_0xd537('0x2a')][_0xd537('0x2b')]};});_0x1627cc[_0xd537('0x2c')]=_['map'](_0x405121,_0xd537('0x23'));_0x1627cc[_0xd537('0x2d')]=_[_0xd537('0x2e')](_0x3e788d[_0xd537('0x2d')]);_0x1627cc[_0xd537('0x2f')]=_[_0xd537('0x30')](_0x1627cc[_0xd537('0x2c')],_0x1627cc[_0xd537('0x2d')]);_0x4afed7[_0xd537('0x31')]=_[_0xd537('0x30')](_0x1627cc[_0xd537('0x2c')],qs['fields'](_0x3e788d[_0xd537('0x2d')]['fields']));_0x4afed7[_0xd537('0x31')]=_0x4afed7[_0xd537('0x31')][_0xd537('0x32')]?_0x4afed7[_0xd537('0x31')]:_0x1627cc[_0xd537('0x2c')];if(!_0x3e788d[_0xd537('0x2d')]['hasOwnProperty'](_0xd537('0x33'))){_0x4afed7[_0xd537('0x18')]=qs['limit'](_0x3e788d[_0xd537('0x2d')]['limit']);_0x4afed7[_0xd537('0x1b')]=qs[_0xd537('0x1b')](_0x3e788d[_0xd537('0x2d')][_0xd537('0x1b')]);}_0x4afed7[_0xd537('0x34')]=qs[_0xd537('0x35')](_0x3e788d[_0xd537('0x2d')][_0xd537('0x35')]);_0x4afed7['where']=qs[_0xd537('0x2f')](_['pick'](_0x3e788d[_0xd537('0x2d')],_0x1627cc[_0xd537('0x2f')]),_0x405121);if(_0x3e788d[_0xd537('0x2d')][_0xd537('0x36')]){_0x4afed7[_0xd537('0x37')]=_[_0xd537('0x38')](_0x4afed7[_0xd537('0x37')],{'$or':_[_0xd537('0x26')](_0x405121,function(_0x5195f8){if(_0x5195f8[_0xd537('0x2a')]!==_0xd537('0x39')){var _0x4468f8={};_0x4468f8[_0x5195f8[_0xd537('0x23')]]={'$like':'%'+_0x3e788d[_0xd537('0x2d')][_0xd537('0x36')]+'%'};return _0x4468f8;}})});}_0x4afed7=_[_0xd537('0x38')]({},_0x4afed7,_0x3e788d[_0xd537('0x3a')]);var _0x20db0e={'where':_0x4afed7[_0xd537('0x37')]};return db[_0xd537('0x27')][_0xd537('0x1a')](_0x20db0e)['then'](function(_0x3a00b7){_0x59bd2d[_0xd537('0x1a')]=_0x3a00b7;if(_0x3e788d['query'][_0xd537('0x3b')]){_0x4afed7[_0xd537('0x3c')]=[{'all':!![]}];}return db[_0xd537('0x27')]['findAll'](_0x4afed7);})[_0xd537('0x3d')](function(_0x4c31c7){_0x59bd2d[_0xd537('0x3e')]=_0x4c31c7;return _0x59bd2d;})['then'](respondWithFilteredResult(_0x1ef3ee,_0x4afed7))[_0xd537('0x3f')](handleError(_0x1ef3ee,null));};exports['show']=function(_0x18913d,_0xd409d8){var _0x197874={'raw':!![],'where':{'id':_0x18913d[_0xd537('0x40')]['id']}},_0x5121fd={};_0x5121fd[_0xd537('0x2c')]=_[_0xd537('0x2e')](db['WhatsappTransferReport'][_0xd537('0x28')]);_0x5121fd['query']=_[_0xd537('0x2e')](_0x18913d['query']);_0x5121fd['filters']=_[_0xd537('0x30')](_0x5121fd[_0xd537('0x2c')],_0x5121fd['query']);_0x197874['attributes']=_[_0xd537('0x30')](_0x5121fd[_0xd537('0x2c')],qs['fields'](_0x18913d[_0xd537('0x2d')][_0xd537('0x41')]));_0x197874['attributes']=_0x197874[_0xd537('0x31')][_0xd537('0x32')]?_0x197874[_0xd537('0x31')]:_0x5121fd[_0xd537('0x2c')];if(_0x18913d[_0xd537('0x2d')][_0xd537('0x3b')]){_0x197874[_0xd537('0x3c')]=[{'all':!![]}];}_0x197874=_[_0xd537('0x38')]({},_0x197874,_0x18913d[_0xd537('0x3a')]);return db['WhatsappTransferReport'][_0xd537('0x42')](_0x197874)[_0xd537('0x3d')](handleEntityNotFound(_0xd409d8,null))[_0xd537('0x3d')](respondWithResult(_0xd409d8,null))[_0xd537('0x3f')](handleError(_0xd409d8,null));};exports['create']=function(_0x5e8548,_0x381420){return db[_0xd537('0x27')][_0xd537('0x43')](_0x5e8548[_0xd537('0x44')],{})[_0xd537('0x3d')](respondWithResult(_0x381420,0xc9))[_0xd537('0x3f')](handleError(_0x381420,null));};exports[_0xd537('0x20')]=function(_0xb1172e,_0x5c86ee){if(_0xb1172e[_0xd537('0x44')]['id']){delete _0xb1172e[_0xd537('0x44')]['id'];}return db[_0xd537('0x27')]['find']({'where':{'id':_0xb1172e[_0xd537('0x40')]['id']}})[_0xd537('0x3d')](handleEntityNotFound(_0x5c86ee,null))[_0xd537('0x3d')](saveUpdates(_0xb1172e[_0xd537('0x44')],null))[_0xd537('0x3d')](respondWithResult(_0x5c86ee,null))[_0xd537('0x3f')](handleError(_0x5c86ee,null));};exports[_0xd537('0x21')]=function(_0x4ee4e9,_0x39e688){return db['WhatsappTransferReport'][_0xd537('0x42')]({'where':{'id':_0x4ee4e9['params']['id']}})['then'](handleEntityNotFound(_0x39e688,null))[_0xd537('0x3d')](removeEntity(_0x39e688,null))[_0xd537('0x3f')](handleError(_0x39e688,null));};exports[_0xd537('0x45')]=function(_0xb4871c,_0xffa285){return db[_0xd537('0x27')][_0xd537('0x45')]()[_0xd537('0x3d')](respondWithResult(_0xffa285,null))['catch'](handleError(_0xffa285,null));}; \ No newline at end of file +var _0x6a7c=['json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','keys','create','body','catch','find','describe','eml-format','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x27907f,_0x3a5482){var _0x176a9d=function(_0x2ec21f){while(--_0x2ec21f){_0x27907f['push'](_0x27907f['shift']());}};_0x176a9d(++_0x3a5482);}(_0x6a7c,0x79));var _0xc6a7=function(_0x125b2b,_0x2889e2){_0x125b2b=_0x125b2b-0x0;var _0x139f2b=_0x6a7c[_0x125b2b];return _0x139f2b;};'use strict';var emlformat=require(_0xc6a7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc6a7('0x1'));var moment=require(_0xc6a7('0x2'));var BPromise=require(_0xc6a7('0x3'));var Mustache=require(_0xc6a7('0x4'));var util=require(_0xc6a7('0x5'));var path=require('path');var sox=require(_0xc6a7('0x6'));var csv=require(_0xc6a7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc6a7('0x8'));var _=require(_0xc6a7('0x9'));var squel=require(_0xc6a7('0xa'));var crypto=require(_0xc6a7('0xb'));var jsforce=require(_0xc6a7('0xc'));var deskjs=require(_0xc6a7('0xd'));var toCsv=require(_0xc6a7('0x7'));var querystring=require(_0xc6a7('0xe'));var Papa=require(_0xc6a7('0xf'));var Redis=require(_0xc6a7('0x10'));var authService=require(_0xc6a7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc6a7('0x12'));var hardwareService=require(_0xc6a7('0x13'));var logger=require(_0xc6a7('0x14'))(_0xc6a7('0x15'));var utils=require('../../config/utils');var config=require(_0xc6a7('0x16'));var licenseUtil=require(_0xc6a7('0x17'));var db=require(_0xc6a7('0x18'))['db'];function respondWithStatusCode(_0x37f273,_0x4f47aa){_0x4f47aa=_0x4f47aa||0xcc;return function(_0x4d2b50){if(_0x4d2b50){return _0x37f273['sendStatus'](_0x4f47aa);}return _0x37f273[_0xc6a7('0x19')](_0x4f47aa)[_0xc6a7('0x1a')]();};}function respondWithResult(_0x105bcb,_0x27f9cf){_0x27f9cf=_0x27f9cf||0xc8;return function(_0x51a361){if(_0x51a361){return _0x105bcb[_0xc6a7('0x19')](_0x27f9cf)[_0xc6a7('0x1b')](_0x51a361);}};}function respondWithFilteredResult(_0x417e45,_0x2842b8){return function(_0xd03a9f){if(_0xd03a9f){var _0x1fad7d=typeof _0x2842b8[_0xc6a7('0x1c')]===_0xc6a7('0x1d')&&typeof _0x2842b8['limit']==='undefined';var _0x237592=_0xd03a9f[_0xc6a7('0x1e')];var _0x19292b=_0x1fad7d?0x0:_0x2842b8['offset'];var _0x3dd1c9=_0x1fad7d?_0xd03a9f[_0xc6a7('0x1e')]:_0x2842b8['offset']+_0x2842b8[_0xc6a7('0x1f')];var _0x188743;if(_0x3dd1c9>=_0x237592){_0x3dd1c9=_0x237592;_0x188743=0xc8;}else{_0x188743=0xce;}_0x417e45[_0xc6a7('0x19')](_0x188743);return _0x417e45['set'](_0xc6a7('0x20'),_0x19292b+'-'+_0x3dd1c9+'/'+_0x237592)[_0xc6a7('0x1b')](_0xd03a9f);}return null;};}function patchUpdates(_0x115c15){return function(_0x5c0778){try{jsonpatch['apply'](_0x5c0778,_0x115c15,!![]);}catch(_0x9ac82e){return BPromise[_0xc6a7('0x21')](_0x9ac82e);}return _0x5c0778[_0xc6a7('0x22')]();};}function saveUpdates(_0x1ff9fe,_0x3bcc64){return function(_0x2b943a){if(_0x2b943a){return _0x2b943a[_0xc6a7('0x23')](_0x1ff9fe)[_0xc6a7('0x24')](function(_0x335748){return _0x335748;});}return null;};}function removeEntity(_0x37d9af,_0x10310e){return function(_0x49dcbc){if(_0x49dcbc){return _0x49dcbc[_0xc6a7('0x25')]()['then'](function(){_0x37d9af[_0xc6a7('0x19')](0xcc)[_0xc6a7('0x1a')]();});}};}function handleEntityNotFound(_0x2d019c,_0x13d69d){return function(_0x5ed9ae){if(!_0x5ed9ae){_0x2d019c[_0xc6a7('0x26')](0x194);}return _0x5ed9ae;};}function handleError(_0x243115,_0x517fc4){_0x517fc4=_0x517fc4||0x1f4;return function(_0x4d68a6){logger['error'](_0x4d68a6[_0xc6a7('0x27')]);if(_0x4d68a6[_0xc6a7('0x28')]){delete _0x4d68a6[_0xc6a7('0x28')];}_0x243115[_0xc6a7('0x19')](_0x517fc4)[_0xc6a7('0x29')](_0x4d68a6);};}exports[_0xc6a7('0x2a')]=function(_0x428925,_0x225125){var _0x6773aa={},_0x5bad95={},_0x30a61e={'count':0x0,'rows':[]};var _0x19874f=_[_0xc6a7('0x2b')](db[_0xc6a7('0x2c')][_0xc6a7('0x2d')],function(_0x3b8f21){return{'name':_0x3b8f21[_0xc6a7('0x2e')],'type':_0x3b8f21[_0xc6a7('0x2f')][_0xc6a7('0x30')]};});_0x5bad95[_0xc6a7('0x31')]=_['map'](_0x19874f,_0xc6a7('0x28'));_0x5bad95[_0xc6a7('0x32')]=_['keys'](_0x428925[_0xc6a7('0x32')]);_0x5bad95[_0xc6a7('0x33')]=_[_0xc6a7('0x34')](_0x5bad95[_0xc6a7('0x31')],_0x5bad95[_0xc6a7('0x32')]);_0x6773aa[_0xc6a7('0x35')]=_[_0xc6a7('0x34')](_0x5bad95['model'],qs[_0xc6a7('0x36')](_0x428925[_0xc6a7('0x32')]['fields']));_0x6773aa[_0xc6a7('0x35')]=_0x6773aa[_0xc6a7('0x35')][_0xc6a7('0x37')]?_0x6773aa[_0xc6a7('0x35')]:_0x5bad95['model'];if(!_0x428925[_0xc6a7('0x32')]['hasOwnProperty']('nolimit')){_0x6773aa['limit']=qs['limit'](_0x428925[_0xc6a7('0x32')][_0xc6a7('0x1f')]);_0x6773aa['offset']=qs[_0xc6a7('0x1c')](_0x428925[_0xc6a7('0x32')][_0xc6a7('0x1c')]);}_0x6773aa[_0xc6a7('0x38')]=qs[_0xc6a7('0x39')](_0x428925['query']['sort']);_0x6773aa[_0xc6a7('0x3a')]=qs[_0xc6a7('0x33')](_[_0xc6a7('0x3b')](_0x428925[_0xc6a7('0x32')],_0x5bad95['filters']),_0x19874f);if(_0x428925[_0xc6a7('0x32')][_0xc6a7('0x3c')]){_0x6773aa[_0xc6a7('0x3a')]=_[_0xc6a7('0x3d')](_0x6773aa['where'],{'$or':_['map'](_0x19874f,function(_0x49c133){if(_0x49c133[_0xc6a7('0x2f')]!==_0xc6a7('0x3e')){var _0x5c9db2={};_0x5c9db2[_0x49c133['name']]={'$like':'%'+_0x428925['query'][_0xc6a7('0x3c')]+'%'};return _0x5c9db2;}})});}_0x6773aa=_[_0xc6a7('0x3d')]({},_0x6773aa,_0x428925['options']);var _0x3e5477={'where':_0x6773aa[_0xc6a7('0x3a')]};return db['WhatsappTransferReport'][_0xc6a7('0x1e')](_0x3e5477)[_0xc6a7('0x24')](function(_0x28a59a){_0x30a61e[_0xc6a7('0x1e')]=_0x28a59a;if(_0x428925[_0xc6a7('0x32')][_0xc6a7('0x3f')]){_0x6773aa[_0xc6a7('0x40')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xc6a7('0x41')](_0x6773aa);})['then'](function(_0x4b4f02){_0x30a61e['rows']=_0x4b4f02;return _0x30a61e;})[_0xc6a7('0x24')](respondWithFilteredResult(_0x225125,_0x6773aa))['catch'](handleError(_0x225125,null));};exports[_0xc6a7('0x42')]=function(_0x469830,_0x469b2c){var _0x16d422={'raw':!![],'where':{'id':_0x469830[_0xc6a7('0x43')]['id']}},_0x1b347e={};_0x1b347e[_0xc6a7('0x31')]=_[_0xc6a7('0x44')](db[_0xc6a7('0x2c')][_0xc6a7('0x2d')]);_0x1b347e[_0xc6a7('0x32')]=_['keys'](_0x469830[_0xc6a7('0x32')]);_0x1b347e[_0xc6a7('0x33')]=_[_0xc6a7('0x34')](_0x1b347e['model'],_0x1b347e[_0xc6a7('0x32')]);_0x16d422[_0xc6a7('0x35')]=_[_0xc6a7('0x34')](_0x1b347e['model'],qs[_0xc6a7('0x36')](_0x469830[_0xc6a7('0x32')][_0xc6a7('0x36')]));_0x16d422[_0xc6a7('0x35')]=_0x16d422[_0xc6a7('0x35')][_0xc6a7('0x37')]?_0x16d422[_0xc6a7('0x35')]:_0x1b347e['model'];if(_0x469830[_0xc6a7('0x32')][_0xc6a7('0x3f')]){_0x16d422[_0xc6a7('0x40')]=[{'all':!![]}];}_0x16d422=_['merge']({},_0x16d422,_0x469830['options']);return db[_0xc6a7('0x2c')]['find'](_0x16d422)[_0xc6a7('0x24')](handleEntityNotFound(_0x469b2c,null))[_0xc6a7('0x24')](respondWithResult(_0x469b2c,null))['catch'](handleError(_0x469b2c,null));};exports[_0xc6a7('0x45')]=function(_0x1ef1be,_0xad709a){return db[_0xc6a7('0x2c')][_0xc6a7('0x45')](_0x1ef1be[_0xc6a7('0x46')],{})['then'](respondWithResult(_0xad709a,0xc9))[_0xc6a7('0x47')](handleError(_0xad709a,null));};exports[_0xc6a7('0x23')]=function(_0x975143,_0x3f6c09){if(_0x975143[_0xc6a7('0x46')]['id']){delete _0x975143['body']['id'];}return db[_0xc6a7('0x2c')][_0xc6a7('0x48')]({'where':{'id':_0x975143[_0xc6a7('0x43')]['id']}})[_0xc6a7('0x24')](handleEntityNotFound(_0x3f6c09,null))[_0xc6a7('0x24')](saveUpdates(_0x975143[_0xc6a7('0x46')],null))[_0xc6a7('0x24')](respondWithResult(_0x3f6c09,null))['catch'](handleError(_0x3f6c09,null));};exports[_0xc6a7('0x25')]=function(_0x2ba893,_0x2d2a7b){return db[_0xc6a7('0x2c')][_0xc6a7('0x48')]({'where':{'id':_0x2ba893[_0xc6a7('0x43')]['id']}})[_0xc6a7('0x24')](handleEntityNotFound(_0x2d2a7b,null))[_0xc6a7('0x24')](removeEntity(_0x2d2a7b,null))[_0xc6a7('0x47')](handleError(_0x2d2a7b,null));};exports['describe']=function(_0x35863c,_0x25bb3f){return db['WhatsappTransferReport'][_0xc6a7('0x49')]()['then'](respondWithResult(_0x25bb3f,null))[_0xc6a7('0x47')](handleError(_0x25bb3f,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 045c02f..30ead72 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.model.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe1bd=['report_whatsapp_transfer','uniqueid','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport'];(function(_0x30dbde,_0xd5c1ee){var _0x415766=function(_0x419d86){while(--_0x419d86){_0x30dbde['push'](_0x30dbde['shift']());}};_0x415766(++_0xd5c1ee);}(_0xe1bd,0x1c9));var _0xde1b=function(_0x1cba52,_0x5ed19f){_0x1cba52=_0x1cba52-0x0;var _0x8be8b2=_0xe1bd[_0x1cba52];return _0x8be8b2;};'use strict';var _=require(_0xde1b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xde1b('0x1'));var moment=require(_0xde1b('0x2'));var BPromise=require(_0xde1b('0x3'));var rp=require(_0xde1b('0x4'));var fs=require('fs');var path=require(_0xde1b('0x5'));var rimraf=require('rimraf');var config=require(_0xde1b('0x6'));var attributes=require(_0xde1b('0x7'));module[_0xde1b('0x8')]=function(_0x57c5b1,_0x23fd4c){return _0x57c5b1[_0xde1b('0x9')](_0xde1b('0xa'),attributes,{'tableName':_0xde1b('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xde1b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb01a=['api','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb01a,0x18a));var _0xab01=function(_0x5a037a,_0x44a3fc){_0x5a037a=_0x5a037a-0x0;var _0x28ff57=_0xb01a[_0x5a037a];return _0x28ff57;};'use strict';var _=require(_0xab01('0x0'));var util=require(_0xab01('0x1'));var logger=require('../../config/logger')(_0xab01('0x2'));var moment=require('moment');var BPromise=require(_0xab01('0x3'));var rp=require(_0xab01('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xab01('0x5'));var config=require(_0xab01('0x6'));var attributes=require(_0xab01('0x7'));module['exports']=function(_0x2e4cb0,_0x315392){return _0x2e4cb0[_0xab01('0x8')](_0xab01('0x9'),attributes,{'tableName':_0xab01('0xa'),'paranoid':![],'indexes':[{'name':_0xab01('0xb'),'fields':[_0xab01('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 777a5d8..aba0dbf 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\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(_0x88ba18,_0x11a4db){var _0x43c8a5=function(_0x540077){while(--_0x540077){_0x88ba18['push'](_0x88ba18['shift']());}};_0x43c8a5(++_0x11a4db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\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(_0xd1ddee,_0x189ff6){var _0x5149a5=function(_0x4c31d4){while(--_0x4c31d4){_0xd1ddee['push'](_0xd1ddee['shift']());}};_0x5149a5(++_0x189ff6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 87de537..4de9fc9 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['name','join','Offline\x20apps:','filter','None','seedDB','./config/license','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sync','listen','then','info','start','Online\x20apps:','map','online'];(function(_0x502f26,_0x47a204){var _0x57c39a=function(_0x32bd60){while(--_0x32bd60){_0x502f26['push'](_0x502f26['shift']());}};_0x57c39a(++_0x47a204);}(_0x7a54,0x106));var _0x47a5=function(_0x198ad6,_0x4cf181){_0x198ad6=_0x198ad6-0x0;var _0x43d0eb=_0x7a54[_0x198ad6];return _0x43d0eb;};'use strict';var _=require(_0x47a5('0x0'));var mysqldb=require(_0x47a5('0x1'));var rpc=require(_0x47a5('0x2'));var config=require('./config/environment');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0x47a5('0x5'));var schedule=require(_0x47a5('0x6'));var chat=require(_0x47a5('0x7'));var whatsapp=require(_0x47a5('0x8'));var transcribe=require(_0x47a5('0x9'));function main(){return mysqldb['db']['sequelize'][_0x47a5('0xa')]()['then'](function(){return rpc[_0x47a5('0xb')]();})[_0x47a5('0xc')](function(_0x506eda){logger[_0x47a5('0xd')](_0x506eda);return chat['start']();})['then'](function(){return whatsapp['start']();})[_0x47a5('0xc')](function(){return schedule[_0x47a5('0xe')]();})['then'](function(){return transcribe[_0x47a5('0xe')]();})['then'](function(_0x5de6d7){logger[_0x47a5('0xd')](_0x5de6d7);return pm2[_0x47a5('0xe')](pm2Config);})[_0x47a5('0xc')](function(_0x250fad){logger[_0x47a5('0xd')](_0x47a5('0xf'),_[_0x47a5('0x10')](_['filter'](_0x250fad,{'status':_0x47a5('0x11')}),_0x47a5('0x12'))[_0x47a5('0x13')]());logger[_0x47a5('0xd')](_0x47a5('0x14'),_[_0x47a5('0x10')](_[_0x47a5('0x15')](_0x250fad,function(_0x190faa){return _0x190faa['status']!==_0x47a5('0x11');}),_0x47a5('0x12'))[_0x47a5('0x13')]()||_0x47a5('0x16'));config[_0x47a5('0x17')]&&require('./config/seedDB')['default']();require(_0x47a5('0x18'))['default']();})['catch'](function(_0x423a81){logger[_0x47a5('0x19')](_0x47a5('0x1a'),_0x423a81);process[_0x47a5('0x1b')](0x1);});}main(); \ No newline at end of file +var _0xed5c=['Offline\x20apps:','status','None','seedDB','./config/seedDB','default','./config/license','error','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','listen','then','info','start','map','filter','online','name','join'];(function(_0x291d80,_0x574ab4){var _0x35e2c6=function(_0x44e01f){while(--_0x44e01f){_0x291d80['push'](_0x291d80['shift']());}};_0x35e2c6(++_0x574ab4);}(_0xed5c,0x81));var _0xced5=function(_0x16d6d5,_0x42d7d6){_0x16d6d5=_0x16d6d5-0x0;var _0x5d86a2=_0xed5c[_0x16d6d5];return _0x5d86a2;};'use strict';var _=require(_0xced5('0x0'));var mysqldb=require(_0xced5('0x1'));var rpc=require(_0xced5('0x2'));var config=require(_0xced5('0x3'));var logger=require(_0xced5('0x4'))(_0xced5('0x5'));var pm2=require(_0xced5('0x6'));var pm2Config=require(_0xced5('0x7'));var schedule=require(_0xced5('0x8'));var chat=require(_0xced5('0x9'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xced5('0xa'));function main(){return mysqldb['db'][_0xced5('0xb')]['sync']()['then'](function(){return rpc[_0xced5('0xc')]();})[_0xced5('0xd')](function(_0x2857d8){logger[_0xced5('0xe')](_0x2857d8);return chat[_0xced5('0xf')]();})['then'](function(){return whatsapp['start']();})[_0xced5('0xd')](function(){return schedule[_0xced5('0xf')]();})[_0xced5('0xd')](function(){return transcribe[_0xced5('0xf')]();})['then'](function(_0x1f2185){logger['info'](_0x1f2185);return pm2[_0xced5('0xf')](pm2Config);})[_0xced5('0xd')](function(_0x4b8279){logger[_0xced5('0xe')]('Online\x20apps:',_[_0xced5('0x10')](_[_0xced5('0x11')](_0x4b8279,{'status':_0xced5('0x12')}),_0xced5('0x13'))[_0xced5('0x14')]());logger[_0xced5('0xe')](_0xced5('0x15'),_['map'](_['filter'](_0x4b8279,function(_0x23ca09){return _0x23ca09[_0xced5('0x16')]!==_0xced5('0x12');}),'name')['join']()||_0xced5('0x17'));config[_0xced5('0x18')]&&require(_0xced5('0x19'))[_0xced5('0x1a')]();require(_0xced5('0x1b'))[_0xced5('0x1a')]();})['catch'](function(_0x29a3ba){logger[_0xced5('0x1c')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x29a3ba);process[_0xced5('0x1d')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 56d444e..08093f4 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 _0xace6=['privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','closed','then','unmanaged','json','disposition','Unmanaged.','Forbidden.','authorization','startsWith','headers','Basic','User','find','authenticate','pass','Wrong\x20credentials.','user','catch','status','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','add','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','send','retrieveApiKey','apiKeyNonce','isNil','regenerateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','splice','unshift','encryptString','join','promisify','sign','session','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','secrets','fullname','name','internal','email','userpic','permissions','chatPause','mailPause','faxPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xace6,0xd5));var _0x6ace=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xace6[_0x20a584];return _0x4b41a8;};'use strict';var db=require(_0x6ace('0x0'))['db'];var config=require(_0x6ace('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require(_0x6ace('0x2'));var _=require(_0x6ace('0x3'));var jwt=require(_0x6ace('0x4'));var expressJwt=require(_0x6ace('0x5'));var compose=require(_0x6ace('0x6'));var basicAuth=require(_0x6ace('0x7'));var crypto=require(_0x6ace('0x8'));var BPromise=require(_0x6ace('0x9'));var util=require(_0x6ace('0xa'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x6ace('0xb')]['session']});var userAttributes=['id','role',_0x6ace('0xc'),_0x6ace('0xd'),_0x6ace('0xe'),_0x6ace('0xf'),_0x6ace('0x10'),_0x6ace('0x11'),'md5secret','voicePause',_0x6ace('0x12'),_0x6ace('0x13'),_0x6ace('0x14'),'smsPause','openchannelPause',_0x6ace('0x15'),_0x6ace('0x16'),_0x6ace('0x17'),_0x6ace('0x18'),'crudPermissions',_0x6ace('0x19'),'passwordResetAt',_0x6ace('0x1a'),_0x6ace('0x1b'),_0x6ace('0x1c'),_0x6ace('0x1d'),_0x6ace('0x1e'),_0x6ace('0x1f'),'phoneBarEnableSettings',_0x6ace('0x20'),_0x6ace('0x21'),_0x6ace('0x22'),_0x6ace('0x23'),_0x6ace('0x24'),_0x6ace('0x25'),_0x6ace('0x26'),_0x6ace('0x27'),'settingsEnabled',_0x6ace('0x28'),_0x6ace('0x29'),_0x6ace('0x2a'),'downloadAttachments'];exports[_0x6ace('0x2b')]=function(){return this[_0x6ace('0x2c')](!![])[_0x6ace('0x2d')](function(_0x468257,_0x166268,_0x28dd4b){if(_0x468257['user']){_0x28dd4b();}else{return db[_0x6ace('0x2e')][_0x6ace('0x2f')]({'where':{'id':_0x468257[_0x6ace('0x30')]['id']},'attributes':['id',_0x6ace('0x31'),'disposition'],'raw':!![]})[_0x6ace('0x32')](function(_0x22dd22){if(_0x22dd22&&_0x22dd22['closed']){return _0x166268['status'](_0x22dd22['disposition']===_0x6ace('0x33')?0x195:0x193)[_0x6ace('0x34')]({'message':_0x22dd22[_0x6ace('0x35')]===_0x6ace('0x33')?_0x6ace('0x36'):_0x6ace('0x37')});}else{_0x28dd4b();}})['catch'](function(_0x4cf34a){_0x28dd4b(_0x4cf34a);});}});};exports['isAuthenticated']=function isAuthenticated(_0x3407d4){return compose()[_0x6ace('0x2d')](function(_0x56e5ae,_0x45ca14,_0x329c96){var _0x435cfa;if(_0x56e5ae['headers'][_0x6ace('0x38')]){if(_[_0x6ace('0x39')](_0x56e5ae[_0x6ace('0x3a')][_0x6ace('0x38')],_0x6ace('0x3b'))){var _0x22feab=basicAuth(_0x56e5ae);db[_0x6ace('0x3c')][_0x6ace('0x3d')]({'where':{'name':_0x22feab[_0x6ace('0xd')]}})[_0x6ace('0x32')](function(_0x46e35d){if(!_0x46e35d||!_0x46e35d[_0x6ace('0x3e')](_0x22feab[_0x6ace('0x3f')])){return _0x45ca14['status'](0x191)[_0x6ace('0x34')]({'message':_0x6ace('0x40')});}_0x56e5ae[_0x6ace('0x41')]={'id':_0x46e35d['id']};_0x329c96();})[_0x6ace('0x42')](function(_0x423410){_0x329c96(_0x423410);});}else if(_[_0x6ace('0x39')](_0x56e5ae[_0x6ace('0x3a')][_0x6ace('0x38')],'Bearer')){validateJwt(_0x56e5ae,_0x45ca14,_0x329c96);}else{if(_0x3407d4){_0x329c96();}else{return _0x45ca14[_0x6ace('0x43')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x56e5ae[_0x6ace('0x44')][_0x6ace('0x45')]){try{var _0x7b9f82={'audience':hardwareConf[_0x6ace('0x46')](),'issuer':hardwareConf[_0x6ace('0x46')]()};verifyJwt(_0x56e5ae[_0x6ace('0x44')]['apikey'],_0x7b9f82)[_0x6ace('0x32')](function(_0xc42028){return db[_0x6ace('0x3c')][_0x6ace('0x3d')]({'where':{'id':_0xc42028[_0x6ace('0x47')]}})[_0x6ace('0x32')](function(_0x5979c4){_0x435cfa=_0x5979c4;return db[_0x6ace('0x48')][_0x6ace('0x2f')]({'where':{'id':0x1},'attributes':[_0x6ace('0x49'),_0x6ace('0x4a')],'raw':!![]});})['then'](function(_0x2cadc8){if(!_0x435cfa||!_[_0x6ace('0x4b')](_0x435cfa['apiKeyNonce'],_0xc42028[_0x6ace('0x4c')])){return _0x45ca14['status'](0x191)[_0x6ace('0x34')]({'message':_0x6ace('0x4d')});}if(_0x435cfa[_0x6ace('0x4e')]){return _0x45ca14[_0x6ace('0x43')](0x191)[_0x6ace('0x34')]({'message':_0x6ace('0x4f')});}if(_0x435cfa['blocked']){if(_0x2cadc8[_0x6ace('0x4a')]>0x0){if(moment(_0x435cfa[_0x6ace('0x50')])[_0x6ace('0x51')](_0x2cadc8['blockDuration'],'minutes')>moment()){return _0x45ca14[_0x6ace('0x43')](0x191)[_0x6ace('0x34')]({'message':_0x6ace('0x4f')});}}else{return _0x45ca14['status'](0x191)[_0x6ace('0x34')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x56e5ae[_0x6ace('0x41')]={'id':_0x435cfa['id']};_0x329c96();});})['catch'](function(){return _0x45ca14['status'](0x191)[_0x6ace('0x34')]({'message':_0x6ace('0x4f')});});}catch(_0xd83e85){_0x329c96(_0xd83e85);}}else if(_0x3407d4){_0x329c96();}else{return _0x45ca14[_0x6ace('0x43')](0x193)[_0x6ace('0x34')]({'message':_0x6ace('0x52')});}})[_0x6ace('0x2d')](function(_0x5411de,_0x105aa7,_0x2a7953){if(_0x5411de['user']){db[_0x6ace('0x3c')]['find']({'where':{'id':_0x5411de['user']['id']},'attributes':userAttributes})[_0x6ace('0x32')](function(_0x50896d){if(!_0x50896d){return _0x105aa7['status'](0x194)[_0x6ace('0x34')]({'message':_0x6ace('0x53')});}_0x5411de['user']=_0x50896d;_0x2a7953();})[_0x6ace('0x42')](function(_0x433961){_0x2a7953(_0x433961);});}else if(_0x3407d4){_0x2a7953();}else{return _0x105aa7[_0x6ace('0x43')](0x194)[_0x6ace('0x34')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x6ace('0x54')]=function canUpdate(){return compose()[_0x6ace('0x2d')](function(_0x10f5f9,_0x9adde,_0x3a60fc){return licenseUtil[_0x6ace('0x55')]()['then'](function(_0x357e1d){if(_0x357e1d[_0x6ace('0x56')]){_0x3a60fc();}else{return _0x9adde[_0x6ace('0x43')](0x193)[_0x6ace('0x34')]({'message':_0x6ace('0x57')});}})[_0x6ace('0x42')](function(_0x2dd43c){_0x3a60fc(_0x2dd43c);});});};exports[_0x6ace('0x58')]=function(_0x592994,_0x2fdee8,_0x503667){_0x592994[_0x6ace('0x58')]=!![];return _0x503667();};exports[_0x6ace('0x59')]=function signToken(_0x5637f8){return signJwt(_0x5637f8);};exports[_0x6ace('0x5a')]=function(_0x53240d,_0x17ca5f){if(!_0x53240d['user']){return _0x17ca5f['status'](0x194)[_0x6ace('0x34')]({'message':_0x6ace('0x5b')});}var _0x53e466={'payload':{'id':_0x53240d[_0x6ace('0x41')]['id'],'role':_0x53240d['user'][_0x6ace('0x5c')]},'options':{'expiresIn':0x15180}};return signJwt(_0x53e466)['then'](function(_0x41421d){_0x17ca5f['cookie']('motion.token',_0x41421d);_0x17ca5f['redirect']('/dashboards/general');})[_0x6ace('0x42')](function(_0x37f60b){return _0x17ca5f['status'](0x1f4)[_0x6ace('0x5d')](_0x37f60b);});};exports[_0x6ace('0x5e')]=function(_0x542637){if(_['isNil'](_0x542637[_0x6ace('0x5f')])||_[_0x6ace('0x60')](_0x542637['apiKeyIat'])){return null;}else{return createJwt(_0x542637);}};exports['generateApiKey']=function(_0x4cc3a7){_0x4cc3a7[_0x6ace('0x5f')]=generateNonce();_0x4cc3a7['apiKeyIat']=generateIssuedAt();return createJwt(_0x4cc3a7);};exports[_0x6ace('0x61')]=function(_0xb6f495,_0x42999c){var _0x5e476c=_0xb6f495['query'][_0x6ace('0x45')];if(_0x5e476c){var _0x3376aa={'nonce':_0x42999c[_0x6ace('0x5f')],'iat':_0x42999c[_0x6ace('0x62')],'audience':hardwareConf[_0x6ace('0x46')](),'issuer':hardwareConf[_0x6ace('0x46')]()};return verifyJwt(_0x5e476c,_0x3376aa)[_0x6ace('0x32')](function(){return generateApiKey(_0x42999c);});}else{throw{'message':_0x6ace('0x63')};}};exports[_0x6ace('0x64')]=function(_0x519d53){var _0x1a6d03=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1a6d03[_0x6ace('0x65')](_0x519d53))throw new db[(_0x6ace('0x66'))][(_0x6ace('0x67'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x6ace('0x68')]=function(_0x3c5f08,_0x27d6b4,_0x18df5b){var _0x4d2ee2=encryptor[_0x6ace('0x69')](_0x27d6b4)['split'](',');for(var _0x25d293=0x0;_0x25d293<_0x18df5b;_0x25d293++){if(!_0x4d2ee2[_0x25d293])break;if(_0x3c5f08[_0x6ace('0x6a')]()===_0x4d2ee2[_0x25d293][_0x6ace('0x6a')]()){var _0x48f929=util[_0x6ace('0x6b')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x18df5b);if(_0x18df5b===0x1){_0x48f929=_0x6ace('0x6c');}throw new db['Sequelize'][(_0x6ace('0x67'))](_0x48f929);}}return;};exports[_0x6ace('0x6d')]=function(_0xe412e3,_0x245e38){var _0x594c43=_0x245e38?encryptor['decryptString'](_0x245e38)['split'](','):[];if(_0x594c43['length']===0x5){_0x594c43[_0x6ace('0x6e')](-0x1,0x1);}_0x594c43[_0x6ace('0x6f')](_0xe412e3);return encryptor[_0x6ace('0x70')](_0x594c43[_0x6ace('0x71')](','));};function signJwt(_0x4fad70){var _0x49a40c=BPromise[_0x6ace('0x72')](jwt[_0x6ace('0x73')],{'context':jwt});var _0x42bb0e=_0x4fad70['secret']||config[_0x6ace('0xb')][_0x6ace('0x74')];return new BPromise(function(_0x320281,_0x4269e6){_0x49a40c(_0x4fad70[_0x6ace('0x75')],_0x42bb0e,_0x4fad70[_0x6ace('0x76')])['then'](function(_0x3d87ef){_0x320281(_0x3d87ef);})[_0x6ace('0x42')](function(_0x2daf5c){_0x4269e6(_0x2daf5c);});});}function verifyJwt(_0x52fd9c,_0x34522e,_0x19243e){var _0x62a330=BPromise[_0x6ace('0x72')](jwt[_0x6ace('0x77')],{'context':jwt});var _0x5471e5=_0x19243e||config[_0x6ace('0xb')][_0x6ace('0x74')];return new BPromise(function(_0x78766d,_0x396e29){_0x62a330(_0x52fd9c,_0x5471e5,_0x34522e)['then'](function(_0x4e3767){_0x78766d(_0x4e3767);})['catch'](function(_0x33b182){_0x396e29(_0x33b182);});});}function generateNonce(){return crypto[_0x6ace('0x78')](0x10)[_0x6ace('0x79')](_0x6ace('0x7a'));}function generateIssuedAt(){return Math[_0x6ace('0x7b')](Date[_0x6ace('0x7c')]()/0x3e8)[_0x6ace('0x79')]();}function createJwt(_0x57462c){var _0x3078d7={'payload':{'iat':_0x57462c[_0x6ace('0x62')],'nonce':_0x57462c['apiKeyNonce']},'options':{'algorithm':_0x6ace('0x7d'),'subject':_0x57462c['id'][_0x6ace('0x79')](),'issuer':hardwareConf[_0x6ace('0x46')](),'audience':hardwareConf[_0x6ace('0x46')]()}};return signJwt(_0x3078d7)['then'](function(_0x549a36){return{'iat':_0x57462c['apiKeyIat'],'nonce':_0x57462c[_0x6ace('0x5f')],'token':_0x549a36};});} \ No newline at end of file +var _0x1067=['startsWith','Bearer','Unknown\x20authorization\x20format','getUuid','query','apikey','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','apiKeyNonce','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','ValidationError','updatePasswordsHistory','decryptString','length','splice','unshift','join','promisify','sign','secret','payload','options','verify','toString','hex','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session','role','fullname','name','internal','email','permissions','md5secret','voicePause','chatPause','smsPause','openchannelPause','showWebBar','lastLoginAt','crudPermissions','alias','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','downloadVoiceRecordings','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','closed','disposition','then','json','unmanaged','Unmanaged.','Forbidden.','use','headers','authorization','Basic','User','find','authenticate','status','Wrong\x20credentials.','catch'];(function(_0x22a6ac,_0x3dda9e){var _0x2d62b2=function(_0x226c17){while(--_0x226c17){_0x22a6ac['push'](_0x22a6ac['shift']());}};_0x2d62b2(++_0x3dda9e);}(_0x1067,0x131));var _0x7106=function(_0x4e6a6d,_0x304e36){_0x4e6a6d=_0x4e6a6d-0x0;var _0x2fd87e=_0x1067[_0x4e6a6d];return _0x2fd87e;};'use strict';var db=require(_0x7106('0x0'))['db'];var config=require(_0x7106('0x1'));var hardwareConf=require(_0x7106('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x7106('0x3'));var _=require(_0x7106('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x7106('0x5'));var compose=require(_0x7106('0x6'));var basicAuth=require(_0x7106('0x7'));var crypto=require('crypto');var BPromise=require(_0x7106('0x8'));var util=require(_0x7106('0x9'));var moment=require(_0x7106('0xa'));var validateJwt=expressJwt({'secret':config[_0x7106('0xb')][_0x7106('0xc')]});var userAttributes=['id',_0x7106('0xd'),_0x7106('0xe'),_0x7106('0xf'),_0x7106('0x10'),_0x7106('0x11'),'userpic',_0x7106('0x12'),_0x7106('0x13'),_0x7106('0x14'),_0x7106('0x15'),'mailPause','faxPause',_0x7106('0x16'),_0x7106('0x17'),'pauseType',_0x7106('0x18'),_0x7106('0x19'),'lastPauseAt',_0x7106('0x1a'),'allowmessenger','passwordResetAt',_0x7106('0x1b'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording',_0x7106('0x1c'),_0x7106('0x1d'),_0x7106('0x1e'),_0x7106('0x1f'),_0x7106('0x20'),_0x7106('0x21'),_0x7106('0x22'),_0x7106('0x23'),'userProfileId','privacyEnabled','settingsEnabled','wssPort',_0x7106('0x24'),'downloadOmnichannelInteractions',_0x7106('0x25')];exports[_0x7106('0x26')]=function(){return this[_0x7106('0x27')](!![])['use'](function(_0xdd2f30,_0xf7369e,_0x4f314c){if(_0xdd2f30[_0x7106('0x28')]){_0x4f314c();}else{return db[_0x7106('0x29')][_0x7106('0x2a')]({'where':{'id':_0xdd2f30[_0x7106('0x2b')]['id']},'attributes':['id',_0x7106('0x2c'),_0x7106('0x2d')],'raw':!![]})[_0x7106('0x2e')](function(_0x5602fb){if(_0x5602fb&&_0x5602fb[_0x7106('0x2c')]){return _0xf7369e['status'](_0x5602fb['disposition']==='unmanaged'?0x195:0x193)[_0x7106('0x2f')]({'message':_0x5602fb['disposition']===_0x7106('0x30')?_0x7106('0x31'):_0x7106('0x32')});}else{_0x4f314c();}})['catch'](function(_0x19f32b){_0x4f314c(_0x19f32b);});}});};exports['isAuthenticated']=function isAuthenticated(_0x365f7d){return compose()[_0x7106('0x33')](function(_0x23531d,_0xd30bca,_0x188459){var _0x37f6ab;if(_0x23531d[_0x7106('0x34')][_0x7106('0x35')]){if(_['startsWith'](_0x23531d[_0x7106('0x34')][_0x7106('0x35')],_0x7106('0x36'))){var _0x7be5dc=basicAuth(_0x23531d);db[_0x7106('0x37')][_0x7106('0x38')]({'where':{'name':_0x7be5dc['name']}})[_0x7106('0x2e')](function(_0x200430){if(!_0x200430||!_0x200430[_0x7106('0x39')](_0x7be5dc['pass'])){return _0xd30bca[_0x7106('0x3a')](0x191)['json']({'message':_0x7106('0x3b')});}_0x23531d[_0x7106('0x28')]={'id':_0x200430['id']};_0x188459();})[_0x7106('0x3c')](function(_0xdb629a){_0x188459(_0xdb629a);});}else if(_[_0x7106('0x3d')](_0x23531d[_0x7106('0x34')][_0x7106('0x35')],_0x7106('0x3e'))){validateJwt(_0x23531d,_0xd30bca,_0x188459);}else{if(_0x365f7d){_0x188459();}else{return _0xd30bca[_0x7106('0x3a')](0x193)['json']({'message':_0x7106('0x3f')});}}}else if(_0x23531d['query']['apikey']){try{var _0x5158ca={'audience':hardwareConf[_0x7106('0x40')](),'issuer':hardwareConf[_0x7106('0x40')]()};verifyJwt(_0x23531d[_0x7106('0x41')][_0x7106('0x42')],_0x5158ca)[_0x7106('0x2e')](function(_0x364f05){return db[_0x7106('0x37')][_0x7106('0x38')]({'where':{'id':_0x364f05['sub']}})['then'](function(_0x512fc1){_0x37f6ab=_0x512fc1;return db[_0x7106('0x43')][_0x7106('0x2a')]({'where':{'id':0x1},'attributes':[_0x7106('0x44'),_0x7106('0x45')],'raw':!![]});})[_0x7106('0x2e')](function(_0x517286){if(!_0x37f6ab||!_[_0x7106('0x46')](_0x37f6ab['apiKeyNonce'],_0x364f05[_0x7106('0x47')])){return _0xd30bca[_0x7106('0x3a')](0x191)[_0x7106('0x2f')]({'message':_0x7106('0x48')});}if(_0x37f6ab[_0x7106('0x49')]){return _0xd30bca[_0x7106('0x3a')](0x191)[_0x7106('0x2f')]({'message':_0x7106('0x4a')});}if(_0x37f6ab[_0x7106('0x4b')]){if(_0x517286[_0x7106('0x45')]>0x0){if(moment(_0x37f6ab['blockedAt'])[_0x7106('0x4c')](_0x517286[_0x7106('0x45')],_0x7106('0x4d'))>moment()){return _0xd30bca['status'](0x191)[_0x7106('0x2f')]({'message':_0x7106('0x4a')});}}else{return _0xd30bca[_0x7106('0x3a')](0x191)[_0x7106('0x2f')]({'message':_0x7106('0x4a')});}}_0x23531d['user']={'id':_0x37f6ab['id']};_0x188459();});})[_0x7106('0x3c')](function(){return _0xd30bca[_0x7106('0x3a')](0x191)[_0x7106('0x2f')]({'message':_0x7106('0x4a')});});}catch(_0x411f47){_0x188459(_0x411f47);}}else if(_0x365f7d){_0x188459();}else{return _0xd30bca[_0x7106('0x3a')](0x193)[_0x7106('0x2f')]({'message':_0x7106('0x3f')});}})['use'](function(_0x4264de,_0x5b159f,_0x42554f){if(_0x4264de[_0x7106('0x28')]){db[_0x7106('0x37')][_0x7106('0x38')]({'where':{'id':_0x4264de[_0x7106('0x28')]['id']},'attributes':userAttributes})[_0x7106('0x2e')](function(_0x241c49){if(!_0x241c49){return _0x5b159f[_0x7106('0x3a')](0x194)[_0x7106('0x2f')]({'message':_0x7106('0x4e')});}_0x4264de[_0x7106('0x28')]=_0x241c49;_0x42554f();})['catch'](function(_0x1a3fb6){_0x42554f(_0x1a3fb6);});}else if(_0x365f7d){_0x42554f();}else{return _0x5b159f['status'](0x194)['json']({'message':_0x7106('0x4f')});}});};exports[_0x7106('0x50')]=function canUpdate(){return compose()[_0x7106('0x33')](function(_0x1d746b,_0x11d764,_0x1b46c9){return licenseUtil[_0x7106('0x51')]()[_0x7106('0x2e')](function(_0xda09bd){if(_0xda09bd[_0x7106('0x52')]){_0x1b46c9();}else{return _0x11d764['status'](0x193)[_0x7106('0x2f')]({'message':_0x7106('0x53')});}})['catch'](function(_0x486f52){_0x1b46c9(_0x486f52);});});};exports['isMiddleware']=function(_0x23eaca,_0x38cc04,_0x276f67){_0x23eaca[_0x7106('0x54')]=!![];return _0x276f67();};exports[_0x7106('0x55')]=function signToken(_0x170056){return signJwt(_0x170056);};exports['setTokenCookie']=function(_0x326907,_0x575d8b){if(!_0x326907[_0x7106('0x28')]){return _0x575d8b[_0x7106('0x3a')](0x194)['json']({'message':_0x7106('0x56')});}var _0x54170e={'payload':{'id':_0x326907[_0x7106('0x28')]['id'],'role':_0x326907[_0x7106('0x28')][_0x7106('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x54170e)[_0x7106('0x2e')](function(_0x6e2f67){_0x575d8b['cookie']('motion.token',_0x6e2f67);_0x575d8b['redirect'](_0x7106('0x57'));})[_0x7106('0x3c')](function(_0x24d92f){return _0x575d8b['status'](0x1f4)[_0x7106('0x58')](_0x24d92f);});};exports[_0x7106('0x59')]=function(_0x3fdc30){if(_[_0x7106('0x5a')](_0x3fdc30['apiKeyNonce'])||_[_0x7106('0x5a')](_0x3fdc30[_0x7106('0x5b')])){return null;}else{return createJwt(_0x3fdc30);}};exports[_0x7106('0x5c')]=function(_0x7e5cb5){_0x7e5cb5[_0x7106('0x5d')]=generateNonce();_0x7e5cb5[_0x7106('0x5b')]=generateIssuedAt();return createJwt(_0x7e5cb5);};exports[_0x7106('0x5e')]=function(_0xd5bd00,_0x38b448){var _0x5e7caa=_0xd5bd00[_0x7106('0x41')][_0x7106('0x42')];if(_0x5e7caa){var _0x427d61={'nonce':_0x38b448[_0x7106('0x5d')],'iat':_0x38b448['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x7106('0x40')]()};return verifyJwt(_0x5e7caa,_0x427d61)[_0x7106('0x2e')](function(){return generateApiKey(_0x38b448);});}else{throw{'message':_0x7106('0x5f')};}};exports[_0x7106('0x60')]=function(_0xaed1a1){var _0x56dc07=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x56dc07[_0x7106('0x61')](_0xaed1a1))throw new db['Sequelize']['ValidationError'](_0x7106('0x62'));return;};exports[_0x7106('0x63')]=function(_0x38cb99,_0x2fed77,_0x3fae79){var _0x274d54=encryptor['decryptString'](_0x2fed77)[_0x7106('0x64')](',');for(var _0x3d3239=0x0;_0x3d3239<_0x3fae79;_0x3d3239++){if(!_0x274d54[_0x3d3239])break;if(_0x38cb99[_0x7106('0x65')]()===_0x274d54[_0x3d3239][_0x7106('0x65')]()){var _0x3635e8=util[_0x7106('0x66')](_0x7106('0x67'),_0x3fae79);if(_0x3fae79===0x1){_0x3635e8=_0x7106('0x68');}throw new db[(_0x7106('0x69'))][(_0x7106('0x6a'))](_0x3635e8);}}return;};exports[_0x7106('0x6b')]=function(_0x1af9ae,_0x7a6120){var _0x9650af=_0x7a6120?encryptor[_0x7106('0x6c')](_0x7a6120)[_0x7106('0x64')](','):[];if(_0x9650af[_0x7106('0x6d')]===0x5){_0x9650af[_0x7106('0x6e')](-0x1,0x1);}_0x9650af[_0x7106('0x6f')](_0x1af9ae);return encryptor['encryptString'](_0x9650af[_0x7106('0x70')](','));};function signJwt(_0x48ee86){var _0x406910=BPromise[_0x7106('0x71')](jwt[_0x7106('0x72')],{'context':jwt});var _0x188bef=_0x48ee86[_0x7106('0x73')]||config[_0x7106('0xb')][_0x7106('0xc')];return new BPromise(function(_0x2d9fad,_0x28b592){_0x406910(_0x48ee86[_0x7106('0x74')],_0x188bef,_0x48ee86[_0x7106('0x75')])[_0x7106('0x2e')](function(_0x1ff0bd){_0x2d9fad(_0x1ff0bd);})['catch'](function(_0x2e4c60){_0x28b592(_0x2e4c60);});});}function verifyJwt(_0x2363fa,_0x534c00,_0xd270c7){var _0x4e0dbf=BPromise[_0x7106('0x71')](jwt[_0x7106('0x76')],{'context':jwt});var _0xc0f9ea=_0xd270c7||config[_0x7106('0xb')]['session'];return new BPromise(function(_0x4a15f1,_0x94d915){_0x4e0dbf(_0x2363fa,_0xc0f9ea,_0x534c00)[_0x7106('0x2e')](function(_0x20d170){_0x4a15f1(_0x20d170);})['catch'](function(_0x1c7bbb){_0x94d915(_0x1c7bbb);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x7106('0x77')](_0x7106('0x78'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)['toString']();}function createJwt(_0x2ee92e){var _0x452489={'payload':{'iat':_0x2ee92e[_0x7106('0x5b')],'nonce':_0x2ee92e['apiKeyNonce']},'options':{'algorithm':_0x7106('0x79'),'subject':_0x2ee92e['id']['toString'](),'issuer':hardwareConf[_0x7106('0x40')](),'audience':hardwareConf[_0x7106('0x40')]()}};return signJwt(_0x452489)[_0x7106('0x2e')](function(_0x5c0a62){return{'iat':_0x2ee92e['apiKeyIat'],'nonce':_0x2ee92e[_0x7106('0x5d')],'token':_0x5c0a62};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 4438212..9abc1b9 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 _0xbc65=['binary','write','end','final','close','unlink','decryptFile','createWriteStream','createDecipher','secret','createCipher','base64','decryptString','utf8','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes192','encrypt','algorithm','join','error','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','data','update'];(function(_0x38f85c,_0x4770db){var _0x5a985c=function(_0x350400){while(--_0x350400){_0x38f85c['push'](_0x38f85c['shift']());}};_0x5a985c(++_0x4770db);}(_0xbc65,0x16c));var _0x5bc6=function(_0x434911,_0x1489ac){_0x434911=_0x434911-0x0;var _0x548d7c=_0xbc65[_0x434911];return _0x548d7c;};'use strict';var crypto=require(_0x5bc6('0x0'));var fs=require('fs');var BPromise=require(_0x5bc6('0x1'));var _=require(_0x5bc6('0x2'));var config=require(_0x5bc6('0x3'));var logger=require(_0x5bc6('0x4'))(_0x5bc6('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x5bc6('0x6')][_0x5bc6('0x7')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x5bc6('0x8')};if(config[_0x5bc6('0x9')]&&config[_0x5bc6('0x9')][_0x5bc6('0xa')]){var isSupported=isAlgorithmSupported(config[_0x5bc6('0x9')][_0x5bc6('0xa')]);if(isSupported){fileOptions[_0x5bc6('0xa')]=config[_0x5bc6('0x9')][_0x5bc6('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x5bc6('0xb')](',\x20');logger[_0x5bc6('0xc')](config[_0x5bc6('0x9')][_0x5bc6('0xa')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x340bb0){return AES_SUPPORTED_RX[_0x5bc6('0xd')](_0x340bb0);}function getSupportedCiphers(){return crypto[_0x5bc6('0xe')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x39c830){return getSupportedCiphers()[_0x5bc6('0xf')](_0x39c830)>-0x1;}function combineOptions(_0x4ff507){var _0x20fa76={};for(var _0x3d2eca in fileOptions){if(fileOptions[_0x5bc6('0x10')](_0x3d2eca)){_0x20fa76[_0x3d2eca]=fileOptions[_0x3d2eca];}}if(_0x4ff507){for(var _0x54fa96 in _0x4ff507){if(_0x4ff507[_0x5bc6('0x10')](_0x54fa96)){_0x20fa76[_0x54fa96]=_0x4ff507[_0x54fa96];}}}return _0x20fa76;}exports[_0x5bc6('0x11')]=function(_0x255ac7,_0x357c74,_0x3001f4,_0x274826){return new BPromise(function(_0x30f74b,_0x34e081){_0x274826=combineOptions(_0x274826);var _0x5329da=new Buffer(_0x3001f4);var _0x1b5f76=fs[_0x5bc6('0x12')](_0x255ac7);var _0xd5617f=fs['createWriteStream'](_0x357c74);var _0x2a4ff4=crypto['createCipher'](_0x274826[_0x5bc6('0xa')],_0x5329da);_0x1b5f76['on'](_0x5bc6('0x13'),function(_0x41ea52){var _0x551e06=new Buffer(_0x2a4ff4[_0x5bc6('0x14')](_0x41ea52),_0x5bc6('0x15'));_0xd5617f[_0x5bc6('0x16')](_0x551e06);});_0x1b5f76['on'](_0x5bc6('0x17'),function(){try{var _0x3acaa1=new Buffer(_0x2a4ff4[_0x5bc6('0x18')]('binary'),_0x5bc6('0x15'));_0xd5617f[_0x5bc6('0x16')](_0x3acaa1);_0xd5617f['end']();_0xd5617f['on'](_0x5bc6('0x19'),function(){return _0x30f74b(_0x357c74);});}catch(_0x1453c7){fs[_0x5bc6('0x1a')](_0x357c74);return _0x34e081(_0x1453c7);}});});};exports[_0x5bc6('0x1b')]=function(_0x163f8a,_0x187493,_0x32fb09,_0xa1caae){return new BPromise(function(_0x5eea10,_0x3541f8){_0xa1caae=combineOptions(_0xa1caae);var _0x2c9aa8=new Buffer(_0x32fb09);var _0x3ad156=fs[_0x5bc6('0x12')](_0x163f8a);var _0xb58825=fs[_0x5bc6('0x1c')](_0x187493);var _0x5bf855=crypto[_0x5bc6('0x1d')](_0xa1caae[_0x5bc6('0xa')],_0x2c9aa8);_0x3ad156['on'](_0x5bc6('0x13'),function(_0x3448e4){var _0x593855=new Buffer(_0x5bf855[_0x5bc6('0x14')](_0x3448e4),_0x5bc6('0x15'));_0xb58825[_0x5bc6('0x16')](_0x593855);});_0x3ad156['on'](_0x5bc6('0x17'),function(){try{var _0x1c9fa3=new Buffer(_0x5bf855[_0x5bc6('0x18')]('binary'),_0x5bc6('0x15'));_0xb58825[_0x5bc6('0x16')](_0x1c9fa3);_0xb58825['end']();_0xb58825['on']('close',function(){return _0x5eea10(_0x187493);});}catch(_0x2dce5d){fs[_0x5bc6('0x1a')](_0x187493);return _0x3541f8(_0x2dce5d);}});});};exports['encryptString']=function(_0x1be603,_0xed8aac,_0x146fc2){var _0x216823=_0x146fc2||stringOptions['algorithm'];var _0x2f1828=_0xed8aac||stringOptions[_0x5bc6('0x1e')];var _0x263d26=crypto[_0x5bc6('0x1f')](_0x216823,_0x2f1828);var _0x218a28=_0x263d26[_0x5bc6('0x14')](_0x1be603,'utf8','base64');_0x218a28+=_0x263d26[_0x5bc6('0x18')](_0x5bc6('0x20'));return _0x218a28;};exports[_0x5bc6('0x21')]=function(_0x2fb9d0,_0x2024e1,_0x1ee4fe){var _0x35fc3d=_0x1ee4fe||stringOptions[_0x5bc6('0xa')];var _0x32b039=_0x2024e1||stringOptions['secret'];var _0x1d1141=crypto[_0x5bc6('0x1d')](_0x35fc3d,_0x32b039);var _0x2cf3db=_0x1d1141['update'](_0x2fb9d0,_0x5bc6('0x20'),'utf8');_0x2cf3db+=_0x1d1141[_0x5bc6('0x18')](_0x5bc6('0x22'));return _0x2cf3db;}; \ No newline at end of file +var _0x3a99=['encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','binary','unlink','decryptFile','createDecipher','data','update','write','end','encryptString','utf8','final','base64','decryptString','secret','crypto','bluebird','lodash','../../config/environment','app','secrets','aes-256-ctr','aes192'];(function(_0x34c063,_0x11d3d7){var _0x2c63a3=function(_0x5983d0){while(--_0x5983d0){_0x34c063['push'](_0x34c063['shift']());}};_0x2c63a3(++_0x11d3d7);}(_0x3a99,0x1bf));var _0x93a9=function(_0x3fd12f,_0x47e86b){_0x3fd12f=_0x3fd12f-0x0;var _0x4fc0f8=_0x3a99[_0x3fd12f];return _0x4fc0f8;};'use strict';var crypto=require(_0x93a9('0x0'));var fs=require('fs');var BPromise=require(_0x93a9('0x1'));var _=require(_0x93a9('0x2'));var config=require(_0x93a9('0x3'));var logger=require('../../config/logger')(_0x93a9('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x93a9('0x5')]['session'],'algorithm':_0x93a9('0x6')};const fileOptions={'algorithm':_0x93a9('0x7')};if(config['encrypt']&&config[_0x93a9('0x8')][_0x93a9('0x9')]){var isSupported=isAlgorithmSupported(config[_0x93a9('0x8')]['algorithm']);if(isSupported){fileOptions['algorithm']=config['encrypt'][_0x93a9('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x93a9('0xa')](',\x20');logger[_0x93a9('0xb')](config[_0x93a9('0x8')][_0x93a9('0x9')],_0x93a9('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x2378f0){return AES_SUPPORTED_RX[_0x93a9('0xd')](_0x2378f0);}function getSupportedCiphers(){return crypto[_0x93a9('0xe')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x13d891){return getSupportedCiphers()[_0x93a9('0xf')](_0x13d891)>-0x1;}function combineOptions(_0xdf52e4){var _0x43302d={};for(var _0x3c0ceb in fileOptions){if(fileOptions['hasOwnProperty'](_0x3c0ceb)){_0x43302d[_0x3c0ceb]=fileOptions[_0x3c0ceb];}}if(_0xdf52e4){for(var _0x15f1c6 in _0xdf52e4){if(_0xdf52e4[_0x93a9('0x10')](_0x15f1c6)){_0x43302d[_0x15f1c6]=_0xdf52e4[_0x15f1c6];}}}return _0x43302d;}exports[_0x93a9('0x11')]=function(_0x2aecad,_0x326923,_0x33b2f4,_0x5c1434){return new BPromise(function(_0x1d685e,_0x26e0f2){_0x5c1434=combineOptions(_0x5c1434);var _0x539cff=new Buffer(_0x33b2f4);var _0x1581ca=fs[_0x93a9('0x12')](_0x2aecad);var _0x39183c=fs[_0x93a9('0x13')](_0x326923);var _0x5de7e2=crypto[_0x93a9('0x14')](_0x5c1434[_0x93a9('0x9')],_0x539cff);_0x1581ca['on']('data',function(_0x53a770){var _0x204cfe=new Buffer(_0x5de7e2['update'](_0x53a770),_0x93a9('0x15'));_0x39183c['write'](_0x204cfe);});_0x1581ca['on']('end',function(){try{var _0x1b14f6=new Buffer(_0x5de7e2['final']('binary'),_0x93a9('0x15'));_0x39183c['write'](_0x1b14f6);_0x39183c['end']();_0x39183c['on']('close',function(){return _0x1d685e(_0x326923);});}catch(_0x4c1a03){fs[_0x93a9('0x16')](_0x326923);return _0x26e0f2(_0x4c1a03);}});});};exports[_0x93a9('0x17')]=function(_0x281cfe,_0x17c1ba,_0x446d47,_0x2713e4){return new BPromise(function(_0x5cb022,_0x3ae521){_0x2713e4=combineOptions(_0x2713e4);var _0x194c69=new Buffer(_0x446d47);var _0x2e6399=fs['createReadStream'](_0x281cfe);var _0x4e1b59=fs[_0x93a9('0x13')](_0x17c1ba);var _0x48d051=crypto[_0x93a9('0x18')](_0x2713e4[_0x93a9('0x9')],_0x194c69);_0x2e6399['on'](_0x93a9('0x19'),function(_0xeba91c){var _0x2d7d1f=new Buffer(_0x48d051[_0x93a9('0x1a')](_0xeba91c),_0x93a9('0x15'));_0x4e1b59[_0x93a9('0x1b')](_0x2d7d1f);});_0x2e6399['on'](_0x93a9('0x1c'),function(){try{var _0x95a1d8=new Buffer(_0x48d051['final']('binary'),_0x93a9('0x15'));_0x4e1b59[_0x93a9('0x1b')](_0x95a1d8);_0x4e1b59[_0x93a9('0x1c')]();_0x4e1b59['on']('close',function(){return _0x5cb022(_0x17c1ba);});}catch(_0x5b7256){fs[_0x93a9('0x16')](_0x17c1ba);return _0x3ae521(_0x5b7256);}});});};exports[_0x93a9('0x1d')]=function(_0x52a853,_0x320d44,_0x2d5cdd){var _0x486d6c=_0x2d5cdd||stringOptions[_0x93a9('0x9')];var _0x1caffb=_0x320d44||stringOptions['secret'];var _0x196dce=crypto[_0x93a9('0x14')](_0x486d6c,_0x1caffb);var _0x5a0392=_0x196dce[_0x93a9('0x1a')](_0x52a853,_0x93a9('0x1e'),'base64');_0x5a0392+=_0x196dce[_0x93a9('0x1f')](_0x93a9('0x20'));return _0x5a0392;};exports[_0x93a9('0x21')]=function(_0x5235ec,_0xba5fb1,_0x1a6f53){var _0x485b76=_0x1a6f53||stringOptions[_0x93a9('0x9')];var _0x5a7fe4=_0xba5fb1||stringOptions[_0x93a9('0x22')];var _0xaf8546=crypto[_0x93a9('0x18')](_0x485b76,_0x5a7fe4);var _0xfd4f05=_0xaf8546[_0x93a9('0x1a')](_0x5235ec,_0x93a9('0x20'),_0x93a9('0x1e'));_0xfd4f05+=_0xaf8546[_0x93a9('0x1f')](_0x93a9('0x1e'));return _0xfd4f05;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 2df560d..aa32dcd 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 _0x3089=['../../mysqldb','../../config/logger','argv','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','then','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','length','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','existsSync','join','mkdirSync','each','csv','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','path','lodash','bluebird','zip-dir','rimraf'];(function(_0x546f9f,_0xcce640){var _0x3513dd=function(_0x2e5c79){while(--_0x2e5c79){_0x546f9f['push'](_0x546f9f['shift']());}};_0x3513dd(++_0xcce640);}(_0x3089,0xcd));var _0x9308=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x3089[_0x6131cd];return _0x47e916;};'use strict';var util=require('util');var path=require(_0x9308('0x0'));var _=require(_0x9308('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x9308('0x2'));var zipdir=require(_0x9308('0x3'));var rimraf=require(_0x9308('0x4'));var db=require(_0x9308('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x9308('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x9308('0x7')][0x2]);var QUERY=process[_0x9308('0x7')][0x3];var PATH=process[_0x9308('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1ae5ff,_0x183638){var _0x597cd8={'status':_0x1ae5ff};var _0x2c4b57={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x183638){_0x597cd8['savename']=_0x183638;}return db['AnalyticExtractedReport']['update'](_0x597cd8,_0x2c4b57);}function main(){var _0x187499=0x1388;var _0x1f385f;logger['info'](util[_0x9308('0x8')](_0x9308('0x9'),EXTRACTED_REPORT_ID,_0x9308('0xa')));return db['Setting'][_0x9308('0xb')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9308('0xc'),'splitSizeCsv']})[_0x9308('0xd')](function(_0x4528e3){if(_0x4528e3){_0x1f385f=_0x4528e3;_0x187499=_0x1f385f[_0x9308('0xe')]||0x1388;}})[_0x9308('0xd')](function(){return dbH[_0x9308('0xf')][_0x9308('0x10')](util['format'](_0x9308('0x11'),QUERY),{'type':dbH[_0x9308('0xf')][_0x9308('0x12')]['SELECT']});})['then'](function(_0xf99c2c){if(!_0xf99c2c[0x0]['num']){return analyticExtractedReport('Empty');}var _0x869e44=[];var _0x37c2a1=0x0;var _0x576969=!![];if(_0xf99c2c&&_0xf99c2c[_0x9308('0x13')]){var _0x2b1972=_0xf99c2c[0x0][_0x9308('0x14')]%(_0x37c2a1+_0x187499);if(_0x1f385f[_0x9308('0xc')]){for(;_0x576969;_0x37c2a1+=_0x187499,_0x2b1972=_0xf99c2c[0x0][_0x9308('0x14')]%(_0x37c2a1+_0x187499)){if(_0x2b1972==0x0||_0x2b1972==_0xf99c2c[0x0]['num']){_0x576969=![];}_0x869e44[_0x9308('0x15')](dbH[_0x9308('0xf')]['query'](util[_0x9308('0x8')](_0x9308('0x16'),QUERY,_0x187499,_0x37c2a1),{'type':dbH[_0x9308('0xf')][_0x9308('0x12')][_0x9308('0x17')]}));}}else{_0x869e44['push'](dbH[_0x9308('0xf')]['query'](QUERY,{'type':dbH['sequelize'][_0x9308('0x12')][_0x9308('0x17')]}));}}var _0x16b536=path[_0x9308('0x18')](PATH);var _0xb56302=path[_0x9308('0x19')](PATH,_0x9308('0x1a'));var _0x2a06d0=_0x1f385f['split']&&_0x869e44[_0x9308('0x13')]>0x1;var _0x430dde=[];if(!fs[_0x9308('0x1b')](path[_0x9308('0x1c')](_0x16b536,_0xb56302))&&_0x2a06d0){fs[_0x9308('0x1d')](path[_0x9308('0x1c')](_0x16b536,_0xb56302));}return BPromise[_0x9308('0x1e')](_0x869e44,function(_0x1f0e69){_0x430dde[_0x9308('0x15')](_0x1f0e69);})[_0x9308('0xd')](function(){for(var _0x3b0252=0x0;_0x3b0252<_0x430dde['length'];_0x3b0252+=0x1){var _0x3dc5d0;var _0x898fed=_0x430dde[_0x3b0252];if(_0x2a06d0){_0x3dc5d0=path[_0x9308('0x1c')](_0x16b536,_0xb56302,util[_0x9308('0x8')]('%s%d.%s',_0xb56302,_0x3b0252,_0x9308('0x1f')));}else{_0x3dc5d0=path['join'](_0x16b536,util['format'](_0x9308('0x20'),_0xb56302,_0x9308('0x1f')));}fs[_0x9308('0x21')](_0x3dc5d0,csv(_0x898fed));}})['then'](function(){if(_0x2a06d0){zipdir(path[_0x9308('0x1c')](_0x16b536,_0xb56302),{'saveTo':path[_0x9308('0x1c')](_0x16b536,util['format']('%s.%s',_0xb56302,'zip'))},function(_0x3df4cb,_0x226464){});rimraf(path[_0x9308('0x1c')](_0x16b536,_0xb56302),function(){});}})['then'](function(){logger['info'](util['format'](_0x9308('0x22'),EXTRACTED_REPORT_ID,_0x9308('0xa')));return analyticExtractedReport('Completed',_0x2a06d0?util['format'](_0x9308('0x20'),_0xb56302,_0x2a06d0?_0x9308('0x23'):'csv'):null);});})[_0x9308('0x24')](function(_0x2f1ccd){logger[_0x9308('0x25')](util['format'](_0x9308('0x26'),EXTRACTED_REPORT_ID,_0x9308('0xa')),util[_0x9308('0x27')](_0x2f1ccd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9308('0x28'));})['finally'](function(){process[_0x9308('0x29')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xdd66=['catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.csv','length','existsSync','mkdirSync','join','%s%d.%s','csv','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xdd66,0x1b6));var _0x6dd6=function(_0x5205c8,_0x6095f3){_0x5205c8=_0x5205c8-0x0;var _0x1a2d13=_0xdd66[_0x5205c8];return _0x1a2d13;};'use strict';var util=require(_0x6dd6('0x0'));var path=require(_0x6dd6('0x1'));var _=require(_0x6dd6('0x2'));var csv=require(_0x6dd6('0x3'));var fs=require('fs');var BPromise=require(_0x6dd6('0x4'));var zipdir=require(_0x6dd6('0x5'));var rimraf=require(_0x6dd6('0x6'));var db=require(_0x6dd6('0x7'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x6dd6('0x8')][0x2]);var QUERY=process[_0x6dd6('0x8')][0x3];var PATH=process[_0x6dd6('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1a61aa,_0x349bac){var _0x42c49c={'status':_0x1a61aa};var _0x3953cf={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x349bac){_0x42c49c[_0x6dd6('0x9')]=_0x349bac;}return db[_0x6dd6('0xa')][_0x6dd6('0xb')](_0x42c49c,_0x3953cf);}function main(){var _0x3c0b64=0x1388;var _0x1217ac;logger[_0x6dd6('0xc')](util[_0x6dd6('0xd')](_0x6dd6('0xe'),EXTRACTED_REPORT_ID,_0x6dd6('0xf')));return db[_0x6dd6('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x6dd6('0x11')]})[_0x6dd6('0x12')](function(_0x4e3d9a){if(_0x4e3d9a){_0x1217ac=_0x4e3d9a;_0x3c0b64=_0x1217ac[_0x6dd6('0x11')]||0x1388;}})[_0x6dd6('0x12')](function(){return dbH[_0x6dd6('0x13')][_0x6dd6('0x14')](util[_0x6dd6('0xd')](_0x6dd6('0x15'),QUERY),{'type':dbH[_0x6dd6('0x13')][_0x6dd6('0x16')][_0x6dd6('0x17')]});})[_0x6dd6('0x12')](function(_0x27b364){if(!_0x27b364[0x0][_0x6dd6('0x18')]){return analyticExtractedReport(_0x6dd6('0x19'));}var _0xf9560c=[];var _0x4519ac=0x0;var _0x13b204=!![];if(_0x27b364&&_0x27b364['length']){var _0x534258=_0x27b364[0x0]['num']%(_0x4519ac+_0x3c0b64);if(_0x1217ac[_0x6dd6('0x1a')]){for(;_0x13b204;_0x4519ac+=_0x3c0b64,_0x534258=_0x27b364[0x0][_0x6dd6('0x18')]%(_0x4519ac+_0x3c0b64)){if(_0x534258==0x0||_0x534258==_0x27b364[0x0][_0x6dd6('0x18')]){_0x13b204=![];}_0xf9560c['push'](dbH[_0x6dd6('0x13')][_0x6dd6('0x14')](util[_0x6dd6('0xd')](_0x6dd6('0x1b'),QUERY,_0x3c0b64,_0x4519ac),{'type':dbH[_0x6dd6('0x13')][_0x6dd6('0x16')][_0x6dd6('0x17')]}));}}else{_0xf9560c[_0x6dd6('0x1c')](dbH[_0x6dd6('0x13')][_0x6dd6('0x14')](QUERY,{'type':dbH[_0x6dd6('0x13')][_0x6dd6('0x16')][_0x6dd6('0x17')]}));}}var _0x2776d1=path[_0x6dd6('0x1d')](PATH);var _0x20170b=path[_0x6dd6('0x1e')](PATH,_0x6dd6('0x1f'));var _0x1c2b7a=_0x1217ac[_0x6dd6('0x1a')]&&_0xf9560c[_0x6dd6('0x20')]>0x1;var _0x4f1268=[];if(!fs[_0x6dd6('0x21')](path['join'](_0x2776d1,_0x20170b))&&_0x1c2b7a){fs[_0x6dd6('0x22')](path[_0x6dd6('0x23')](_0x2776d1,_0x20170b));}return BPromise['each'](_0xf9560c,function(_0x192397){_0x4f1268['push'](_0x192397);})[_0x6dd6('0x12')](function(){for(var _0x3a915f=0x0;_0x3a915f<_0x4f1268['length'];_0x3a915f+=0x1){var _0x462d65;var _0x58a20e=_0x4f1268[_0x3a915f];if(_0x1c2b7a){_0x462d65=path[_0x6dd6('0x23')](_0x2776d1,_0x20170b,util[_0x6dd6('0xd')](_0x6dd6('0x24'),_0x20170b,_0x3a915f,_0x6dd6('0x25')));}else{_0x462d65=path['join'](_0x2776d1,util[_0x6dd6('0xd')](_0x6dd6('0x26'),_0x20170b,_0x6dd6('0x25')));}fs['writeFileSync'](_0x462d65,csv(_0x58a20e));}})[_0x6dd6('0x12')](function(){if(_0x1c2b7a){zipdir(path['join'](_0x2776d1,_0x20170b),{'saveTo':path[_0x6dd6('0x23')](_0x2776d1,util[_0x6dd6('0xd')](_0x6dd6('0x26'),_0x20170b,'zip'))},function(_0x45216a,_0x4b9757){});rimraf(path[_0x6dd6('0x23')](_0x2776d1,_0x20170b),function(){});}})[_0x6dd6('0x12')](function(){logger['info'](util[_0x6dd6('0xd')](_0x6dd6('0x27'),EXTRACTED_REPORT_ID,_0x6dd6('0xf')));return analyticExtractedReport(_0x6dd6('0x28'),_0x1c2b7a?util[_0x6dd6('0xd')]('%s.%s',_0x20170b,_0x1c2b7a?_0x6dd6('0x29'):_0x6dd6('0x25')):null);});})[_0x6dd6('0x2a')](function(_0x5d739a){logger[_0x6dd6('0xc')](util['format'](_0x6dd6('0x2b'),EXTRACTED_REPORT_ID,'CSV'),util[_0x6dd6('0x2c')](_0x5d739a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6dd6('0x2d'));})[_0x6dd6('0x2e')](function(){process[_0x6dd6('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 6931286..c2fa6eb 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 _0x3c63=['createPdfKitDocument','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML','util','path','moment','pdfmake/src/printer','jsdom','JSDOM','window','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','tableHeader','pick','toString','fill','length','auto','body','push','chunk','keys','startDate','format','endDate','landscape','\x20/\x20','Arial','right','num','Empty','dirname','basename','.pdf','join','%s.%s','pdf','Setting','find','split','splitSizePdf','then','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','flatten'];(function(_0x18aa83,_0x2b97de){var _0x248603=function(_0x184b33){while(--_0x184b33){_0x18aa83['push'](_0x18aa83['shift']());}};_0x248603(++_0x2b97de);}(_0x3c63,0x1bf));var _0x33c6=function(_0x4ed9ef,_0x381176){_0x4ed9ef=_0x4ed9ef-0x0;var _0x2bb85b=_0x3c63[_0x4ed9ef];return _0x2bb85b;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x33c6('0x0'));var path=require(_0x33c6('0x1'));var moment=require(_0x33c6('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x33c6('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0x33c6('0x4'))[_0x33c6('0x5')];var window=new JSDOM('')[_0x33c6('0x6')];var db=require('../../mysqldb')['db'];var dbH=require(_0x33c6('0x7'))['dbH'];var logger=require('../../config/logger')(_0x33c6('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x33c6('0x9')][0x2]);var QUERY=process[_0x33c6('0x9')][0x3];var PATH=process[_0x33c6('0x9')][0x4];var NAME=process[_0x33c6('0x9')][0x5];var FORMAT=_0x33c6('0xa');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x151308,_0x5b4604){var _0x5b373a={'status':_0x151308};var _0x1c8532={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5b4604){_0x5b373a['savename']=_0x5b4604;}return db[_0x33c6('0xb')][_0x33c6('0xc')](_0x5b373a,_0x1c8532);}function getHeaders(_0x5b5958){return _[_0x33c6('0xd')](_0x5b5958,function(_0xc894fa){return{'text':_0xc894fa,'style':_0x33c6('0xe')};});}function getRows(_0x39b117,_0x355060){return _[_0x33c6('0xd')](_0x355060,function(_0xe7092c){return _(_0xe7092c)[_0x33c6('0xf')](_0x39b117)[_0x33c6('0xd')](function(_0x50f82c){return _0x50f82c?_[_0x33c6('0x10')](_0x50f82c):'';})['value']();});}function createTable(_0x537e18,_0x4a4277){var _0x317634={'widths':_[_0x33c6('0x11')](Array(_0x537e18[_0x33c6('0x12')]),0x91),'heights':function(_0x549fc3){return _0x549fc3===0x0?_0x33c6('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x331fc2=getHeaders(_0x537e18);_0x317634[_0x33c6('0x14')][_0x33c6('0x15')](_0x331fc2);var _0x198f48=getRows(_0x537e18,_0x4a4277);_0x317634[_0x33c6('0x14')]=_0x317634[_0x33c6('0x14')]['concat'](_0x198f48);return _0x317634;}function createTables(_0xa6f180){var _0x9d67bb=[];var _0x2cf268=_[_0x33c6('0x16')](Object[_0x33c6('0x17')](_0xa6f180[0x0]),0x5);_0x2cf268['forEach'](function(_0x76949f){_0x9d67bb[_0x33c6('0x15')](createTable(_0x76949f,_0xa6f180));});return _0x9d67bb;}function getPDFDocDefinition(_0x4c80d3){var _0x4fce29=util['format']('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x33c6('0x18')])[_0x33c6('0x19')](FORMAT),moment(EXTRACTED_REPORT[_0x33c6('0x1a')])[_0x33c6('0x19')](FORMAT));var _0x5e43b1=[];for(var _0x237497=0x0;_0x237497<_0x4c80d3[_0x33c6('0x12')];_0x237497++){var _0x531e4d=[];if(_0x237497===0x0){_0x531e4d[_0x33c6('0x15')]({'text':_0x4fce29,'style':'header'});}var _0x5e0974={'table':_0x4c80d3[_0x237497]};if(_0x237497>0x0){_0x5e0974['pageBreak']='before';_0x5e0974['margin']=[0x0,0x46,0x0,0x0];}_0x531e4d[_0x33c6('0x15')](_0x5e0974);_0x5e43b1[_0x33c6('0x15')](_0x531e4d);}return{'pageSize':'A4','pageOrientation':_0x33c6('0x1b'),'content':_0x5e43b1,'footer':function(_0x49bcc9,_0x28e858){return{'text':_0x49bcc9[_0x33c6('0x10')]()+_0x33c6('0x1c')+_0x28e858,'style':'footer'};},'defaultStyle':{'font':_0x33c6('0x1d')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x33c6('0x1e'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xc0bfbd){var _0xc772df=0x1388;var _0x2839ac;if(!_0xc0bfbd[0x0][_0x33c6('0x1f')]){return analyticExtractedReport(_0x33c6('0x20'));}var _0x577cb6=[];var _0x28b393=0x0;var _0xcb448=!![];var _0x2bbcf8=path[_0x33c6('0x21')](PATH);var _0xf6501f=path[_0x33c6('0x22')](PATH,_0x33c6('0x23'));var _0x119f53=path[_0x33c6('0x24')](_0x2bbcf8,util['format'](_0x33c6('0x25'),_0xf6501f,_0x33c6('0x26')));var _0x14270a=![];return db[_0x33c6('0x27')][_0x33c6('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x33c6('0x29'),_0x33c6('0x2a')]})[_0x33c6('0x2b')](function(_0x1b459a){if(_0x1b459a){_0x2839ac=_0x1b459a;_0xc772df=_0x2839ac[_0x33c6('0x2a')]||0x3e8;}})[_0x33c6('0x2b')](function(){if(_0xc0bfbd&&_0xc0bfbd[_0x33c6('0x12')]){var _0x4858b2=_0xc0bfbd[0x0][_0x33c6('0x1f')]%(_0x28b393+_0xc772df);if(_0x2839ac[_0x33c6('0x29')]){for(;_0xcb448;_0x28b393+=_0xc772df,_0x4858b2=_0xc0bfbd[0x0]['num']%(_0x28b393+_0xc772df)){if(_0x4858b2==0x0||_0x4858b2==_0xc0bfbd[0x0]['num']){_0xcb448=![];}_0x577cb6[_0x33c6('0x15')](dbH[_0x33c6('0x2c')][_0x33c6('0x2d')](util[_0x33c6('0x19')](_0x33c6('0x2e'),QUERY,_0xc772df,_0x28b393),{'type':dbH[_0x33c6('0x2c')][_0x33c6('0x2f')][_0x33c6('0x30')]}));}}else{_0x577cb6[_0x33c6('0x15')](dbH[_0x33c6('0x2c')][_0x33c6('0x2d')](QUERY,{'type':dbH[_0x33c6('0x2c')][_0x33c6('0x2f')][_0x33c6('0x30')]}));}}_0x14270a=_0x2839ac[_0x33c6('0x29')]&&_0x577cb6[_0x33c6('0x12')]>0x1;if(!fs[_0x33c6('0x31')](path[_0x33c6('0x24')](_0x2bbcf8,_0xf6501f))&&_0x14270a){fs['mkdirSync'](path['join'](_0x2bbcf8,_0xf6501f));}return Promise['all'](_0x577cb6);})[_0x33c6('0x2b')](function(_0x51347d){return createTables(_[_0x33c6('0x32')](_0x51347d));})[_0x33c6('0x2b')](function(_0x340783){var _0x535c61=getPDFDocDefinition(_0x340783);var _0x3b2203=getPDFPrinter();var _0x2bafc7=_0x3b2203[_0x33c6('0x33')](_0x535c61);if(_0x14270a)_0x119f53=path[_0x33c6('0x24')](_0x2bbcf8,_0xf6501f,util['format']('%s%d.%s',_0xf6501f,index,'pdf'));return writePDFDocument(_0x2bafc7,_0x119f53);})['then'](function(){if(!_0x14270a)return;zipdir(path[_0x33c6('0x24')](_0x2bbcf8,_0xf6501f),{'saveTo':path[_0x33c6('0x24')](_0x2bbcf8,util['format'](_0x33c6('0x25'),_0xf6501f,'zip'))},function(_0x3a68b8){if(_0x3a68b8)throw _0x3a68b8;return;});})[_0x33c6('0x2b')](function(){if(!_0x14270a)return;rimraf(path[_0x33c6('0x24')](_0x2bbcf8,_0xf6501f),function(){});})[_0x33c6('0x2b')](function(){logger['info'](util[_0x33c6('0x19')](_0x33c6('0x34'),EXTRACTED_REPORT_ID,_0x33c6('0x35')));return analyticExtractedReport(_0x33c6('0x36'),_0x14270a?util[_0x33c6('0x19')](_0x33c6('0x25'),_0xf6501f,_0x14270a?'zip':_0x33c6('0x26')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x33c6('0x19')](_0x33c6('0x37'),EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport'][_0x33c6('0x38')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x33c6('0x2b')](function(_0x294461){EXTRACTED_REPORT=_0x294461;return dbH[_0x33c6('0x2c')][_0x33c6('0x2d')](util[_0x33c6('0x19')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x33c6('0x2c')][_0x33c6('0x2f')]['SELECT']});})[_0x33c6('0x2b')](extractReport)[_0x33c6('0x39')](function(_0x21fa8e){logger[_0x33c6('0x3a')](util['format'](_0x33c6('0x3b'),EXTRACTED_REPORT_ID,_0x33c6('0x3c')),util[_0x33c6('0x3d')](_0x21fa8e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x33c6('0x3e'));})[_0x33c6('0x3f')](function(){process[_0x33c6('0x40')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x31e487=new PdfPrinter({'Arial':{'normal':__dirname+_0x33c6('0x41'),'bold':__dirname+_0x33c6('0x42'),'italics':__dirname+_0x33c6('0x43'),'bolditalics':__dirname+_0x33c6('0x44')}});return _0x31e487;}function getPDFDocDefinitionFromHTML(_0x45961b,_0x507ba0){var _0x1f436b=util[_0x33c6('0x19')](_0x33c6('0x45'),_0x507ba0[_0x33c6('0x46')],_0x507ba0[_0x33c6('0x47')]);var _0x544cb8=moment()['format'](_0x33c6('0x48'))[_0x33c6('0x10')]();var _0x9a3ae6=htmlToPdfmake(_0x45961b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x9a3ae6],'defaultStyle':{'font':_0x33c6('0x1d')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x33c6('0x49'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x33c6('0x49'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x33c6('0x49')}},'header':function(){return[{'text':_0x33c6('0x4a'),'style':'header'}];},'footer':function(_0x5169f9,_0x1de124){return[{'text':util['format'](_0x33c6('0x4b'),_0x1f436b,_0x5169f9,_0x1de124,_0x544cb8),'style':_0x33c6('0x4c')}];}};}function writePDFDocument(_0x54c71d,_0x15aff6){return new Promise(function(_0x179e81,_0x132464){var _0x2c3ac4=_0x54c71d[_0x33c6('0x4d')](fs[_0x33c6('0x4e')](_0x15aff6));_0x2c3ac4['on']('finish',function(){_0x179e81(_0x33c6('0x4f'));});_0x2c3ac4['on'](_0x33c6('0x50'),function(_0x356119){_0x132464(_0x356119);});_0x54c71d[_0x33c6('0x51')]();});}exports[_0x33c6('0x52')]=function(_0x3ff334,_0x147886){var _0x117479=getPDFPrinter();var _0x36cf05=getPDFDocDefinitionFromHTML(_0x3ff334,_0x147886);var _0x188eba=_0x117479[_0x33c6('0x33')](_0x36cf05);return writePDFDocument(_0x188eba,_0x147886[_0x33c6('0x1')])['catch'](function(_0x2cd15e){throw _0x2cd15e;});}; \ No newline at end of file +var _0x96fa=['error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','tableHeader','map','pick','length','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','before','margin','landscape','toString','\x20/\x20','footer','Arial','num','Empty','dirname','basename','.pdf','join','%s.%s','pdf','split','splitSizePdf','then','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','query','existsSync','all','flatten','createPdfKitDocument','%s%d.%s','zip','info','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish'];(function(_0x483f00,_0x2d1abb){var _0x2fbe0a=function(_0x3c2f8f){while(--_0x3c2f8f){_0x483f00['push'](_0x483f00['shift']());}};_0x2fbe0a(++_0x2d1abb);}(_0x96fa,0xb9));var _0xa96f=function(_0x59fc18,_0x1ab634){_0x59fc18=_0x59fc18-0x0;var _0x4b9910=_0x96fa[_0x59fc18];return _0x4b9910;};'use strict';var _=require(_0xa96f('0x0'));var fs=require('fs');var util=require(_0xa96f('0x1'));var path=require(_0xa96f('0x2'));var moment=require(_0xa96f('0x3'));var htmlToPdfmake=require(_0xa96f('0x4'));var PdfPrinter=require(_0xa96f('0x5'));var zipdir=require(_0xa96f('0x6'));var rimraf=require(_0xa96f('0x7'));var JSDOM=require(_0xa96f('0x8'))[_0xa96f('0x9')];var window=new JSDOM('')[_0xa96f('0xa')];var db=require(_0xa96f('0xb'))['db'];var dbH=require(_0xa96f('0xb'))[_0xa96f('0xc')];var logger=require('../../config/logger')(_0xa96f('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0xa96f('0xe')][0x2]);var QUERY=process[_0xa96f('0xe')][0x3];var PATH=process[_0xa96f('0xe')][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5db010,_0x1e2dc6){var _0x4af77b={'status':_0x5db010};var _0x8614={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1e2dc6){_0x4af77b[_0xa96f('0xf')]=_0x1e2dc6;}return db[_0xa96f('0x10')][_0xa96f('0x11')](_0x4af77b,_0x8614);}function getHeaders(_0x393648){return _['map'](_0x393648,function(_0x5b36a5){return{'text':_0x5b36a5,'style':_0xa96f('0x12')};});}function getRows(_0x4a7da5,_0x52ef8e){return _[_0xa96f('0x13')](_0x52ef8e,function(_0x4f7da8){return _(_0x4f7da8)[_0xa96f('0x14')](_0x4a7da5)[_0xa96f('0x13')](function(_0x59c0f6){return _0x59c0f6?_['toString'](_0x59c0f6):'';})['value']();});}function createTable(_0x661d76,_0x2f6a1f){var _0x47e450={'widths':_['fill'](Array(_0x661d76[_0xa96f('0x15')]),0x91),'heights':function(_0x463c76){return _0x463c76===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3f8d44=getHeaders(_0x661d76);_0x47e450[_0xa96f('0x16')][_0xa96f('0x17')](_0x3f8d44);var _0x182f63=getRows(_0x661d76,_0x2f6a1f);_0x47e450[_0xa96f('0x16')]=_0x47e450['body'][_0xa96f('0x18')](_0x182f63);return _0x47e450;}function createTables(_0x205d29){var _0x205f4e=[];var _0x5b2f80=_[_0xa96f('0x19')](Object[_0xa96f('0x1a')](_0x205d29[0x0]),0x5);_0x5b2f80[_0xa96f('0x1b')](function(_0x33862b){_0x205f4e[_0xa96f('0x17')](createTable(_0x33862b,_0x205d29));});return _0x205f4e;}function getPDFDocDefinition(_0xe451a7){var _0x252d68=util[_0xa96f('0x1c')](_0xa96f('0x1d'),NAME,EXTRACTED_REPORT[_0xa96f('0x1e')],moment(EXTRACTED_REPORT[_0xa96f('0x1f')])[_0xa96f('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0xa96f('0x20')])[_0xa96f('0x1c')](FORMAT));var _0x57ab9c=[];for(var _0x3e6b9c=0x0;_0x3e6b9c<_0xe451a7[_0xa96f('0x15')];_0x3e6b9c++){var _0x4c5d0d=[];if(_0x3e6b9c===0x0){_0x4c5d0d['push']({'text':_0x252d68,'style':_0xa96f('0x21')});}var _0x3ef83e={'table':_0xe451a7[_0x3e6b9c]};if(_0x3e6b9c>0x0){_0x3ef83e[_0xa96f('0x22')]=_0xa96f('0x23');_0x3ef83e[_0xa96f('0x24')]=[0x0,0x46,0x0,0x0];}_0x4c5d0d['push'](_0x3ef83e);_0x57ab9c['push'](_0x4c5d0d);}return{'pageSize':'A4','pageOrientation':_0xa96f('0x25'),'content':_0x57ab9c,'footer':function(_0x31656e,_0x338efd){return{'text':_0x31656e[_0xa96f('0x26')]()+_0xa96f('0x27')+_0x338efd,'style':_0xa96f('0x28')};},'defaultStyle':{'font':_0xa96f('0x29')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x54dc66){var _0x4a0af9=0x1388;var _0x535d04;if(!_0x54dc66[0x0][_0xa96f('0x2a')]){return analyticExtractedReport(_0xa96f('0x2b'));}var _0x1743be=[];var _0x1e731f=0x0;var _0x890e47=!![];var _0x5dc745=path[_0xa96f('0x2c')](PATH);var _0x1b6c9f=path[_0xa96f('0x2d')](PATH,_0xa96f('0x2e'));var _0x4be4bd=path[_0xa96f('0x2f')](_0x5dc745,util[_0xa96f('0x1c')](_0xa96f('0x30'),_0x1b6c9f,_0xa96f('0x31')));var _0x338357=![];return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa96f('0x32'),_0xa96f('0x33')]})[_0xa96f('0x34')](function(_0x26c540){if(_0x26c540){_0x535d04=_0x26c540;_0x4a0af9=_0x535d04['splitSizePdf']||0x3e8;}})[_0xa96f('0x34')](function(){if(_0x54dc66&&_0x54dc66[_0xa96f('0x15')]){var _0x10613e=_0x54dc66[0x0][_0xa96f('0x2a')]%(_0x1e731f+_0x4a0af9);if(_0x535d04[_0xa96f('0x32')]){for(;_0x890e47;_0x1e731f+=_0x4a0af9,_0x10613e=_0x54dc66[0x0][_0xa96f('0x2a')]%(_0x1e731f+_0x4a0af9)){if(_0x10613e==0x0||_0x10613e==_0x54dc66[0x0][_0xa96f('0x2a')]){_0x890e47=![];}_0x1743be['push'](dbH['sequelize']['query'](util[_0xa96f('0x1c')](_0xa96f('0x35'),QUERY,_0x4a0af9,_0x1e731f),{'type':dbH[_0xa96f('0x36')][_0xa96f('0x37')][_0xa96f('0x38')]}));}}else{_0x1743be[_0xa96f('0x17')](dbH[_0xa96f('0x36')][_0xa96f('0x39')](QUERY,{'type':dbH[_0xa96f('0x36')][_0xa96f('0x37')][_0xa96f('0x38')]}));}}_0x338357=_0x535d04['split']&&_0x1743be[_0xa96f('0x15')]>0x1;if(!fs[_0xa96f('0x3a')](path[_0xa96f('0x2f')](_0x5dc745,_0x1b6c9f))&&_0x338357){fs['mkdirSync'](path[_0xa96f('0x2f')](_0x5dc745,_0x1b6c9f));}return Promise[_0xa96f('0x3b')](_0x1743be);})[_0xa96f('0x34')](function(_0x47c5d4){return createTables(_[_0xa96f('0x3c')](_0x47c5d4));})[_0xa96f('0x34')](function(_0x5c4686){var _0x55937a=getPDFDocDefinition(_0x5c4686);var _0x1a9cf4=getPDFPrinter();var _0x63bbea=_0x1a9cf4[_0xa96f('0x3d')](_0x55937a);if(_0x338357)_0x4be4bd=path[_0xa96f('0x2f')](_0x5dc745,_0x1b6c9f,util[_0xa96f('0x1c')](_0xa96f('0x3e'),_0x1b6c9f,index,_0xa96f('0x31')));return writePDFDocument(_0x63bbea,_0x4be4bd);})[_0xa96f('0x34')](function(){if(!_0x338357)return;zipdir(path[_0xa96f('0x2f')](_0x5dc745,_0x1b6c9f),{'saveTo':path[_0xa96f('0x2f')](_0x5dc745,util[_0xa96f('0x1c')](_0xa96f('0x30'),_0x1b6c9f,_0xa96f('0x3f')))},function(_0x1c2374){if(_0x1c2374)throw _0x1c2374;return;});})['then'](function(){if(!_0x338357)return;rimraf(path[_0xa96f('0x2f')](_0x5dc745,_0x1b6c9f),function(){});})[_0xa96f('0x34')](function(){logger[_0xa96f('0x40')](util[_0xa96f('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xa96f('0x41'),_0x338357?util[_0xa96f('0x1c')](_0xa96f('0x30'),_0x1b6c9f,_0x338357?_0xa96f('0x3f'):'pdf'):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xa96f('0x1c')](_0xa96f('0x42'),EXTRACTED_REPORT_ID,_0xa96f('0x43')));return db['AnalyticExtractedReport'][_0xa96f('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x4b998b){EXTRACTED_REPORT=_0x4b998b;return dbH[_0xa96f('0x36')]['query'](util[_0xa96f('0x1c')](_0xa96f('0x45'),QUERY),{'type':dbH[_0xa96f('0x36')]['QueryTypes'][_0xa96f('0x38')]});})[_0xa96f('0x34')](extractReport)[_0xa96f('0x46')](function(_0x207865){logger[_0xa96f('0x40')](util['format'](_0xa96f('0x47'),EXTRACTED_REPORT_ID,_0xa96f('0x43')),util[_0xa96f('0x48')](_0x207865,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa96f('0x49'));})['finally'](function(){process[_0xa96f('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x9023af=new PdfPrinter({'Arial':{'normal':__dirname+_0xa96f('0x4b'),'bold':__dirname+_0xa96f('0x4c'),'italics':__dirname+_0xa96f('0x4d'),'bolditalics':__dirname+_0xa96f('0x4e')}});return _0x9023af;}function getPDFDocDefinitionFromHTML(_0x175126,_0x554b7b){var _0x4ff3ed=util[_0xa96f('0x1c')]('%s\x20#%d',_0x554b7b[_0xa96f('0x4f')],_0x554b7b[_0xa96f('0x50')]);var _0x1f6c77=moment()[_0xa96f('0x1c')](_0xa96f('0x51'))[_0xa96f('0x26')]();var _0x91bdf2=htmlToPdfmake(_0x175126,{'window':window,'tableAutoSize':!![]});return{'content':[_0x91bdf2],'defaultStyle':{'font':_0xa96f('0x29')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xa96f('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xa96f('0x52')}},'header':function(){return[{'text':_0xa96f('0x53'),'style':_0xa96f('0x21')}];},'footer':function(_0x491016,_0x560e0a){return[{'text':util[_0xa96f('0x1c')](_0xa96f('0x54'),_0x4ff3ed,_0x491016,_0x560e0a,_0x1f6c77),'style':_0xa96f('0x28')}];}};}function writePDFDocument(_0x247af3,_0x1f9cdb){return new Promise(function(_0x455c48,_0x577234){var _0x3d10e=_0x247af3[_0xa96f('0x55')](fs[_0xa96f('0x56')](_0x1f9cdb));_0x3d10e['on'](_0xa96f('0x57'),function(){_0x455c48('finish');});_0x3d10e['on'](_0xa96f('0x58'),function(_0x1d45d3){_0x577234(_0x1d45d3);});_0x247af3[_0xa96f('0x59')]();});}exports[_0xa96f('0x5a')]=function(_0x120eed,_0x47d6a4){var _0x5939fc=getPDFPrinter();var _0x53589e=getPDFDocDefinitionFromHTML(_0x120eed,_0x47d6a4);var _0x49411a=_0x5939fc['createPdfKitDocument'](_0x53589e);return writePDFDocument(_0x49411a,_0x47d6a4[_0xa96f('0x2')])[_0xa96f('0x46')](function(_0x33546d){throw _0x33546d;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index ef5c3f6..064623b 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 _0xa9e0=['QueryTypes','SELECT','num','split','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','mkdirSync','each','length','xlsx','%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','inspect','finally','exit','util','path','lodash','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0xe30e17,_0xce02be){var _0x2342c9=function(_0x20b733){while(--_0x20b733){_0xe30e17['push'](_0xe30e17['shift']());}};_0x2342c9(++_0xce02be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var util=require(_0x0a9e('0x0'));var path=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0x0a9e('0x3'));var rimraf=require('rimraf');var db=require(_0x0a9e('0x4'))['db'];var dbH=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0a9e('0x8')][0x3];var PATH=process[_0x0a9e('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2cc193,_0x5f41ea){var _0x503809={'status':_0x2cc193};var _0xe42b77={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5f41ea){_0x503809['savename']=_0x5f41ea;}return db['AnalyticExtractedReport'][_0x0a9e('0x9')](_0x503809,_0xe42b77);}function main(){var _0xf81284=0x1388;var _0x307b3e;logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0a9e('0xd')]})[_0x0a9e('0xe')](function(_0xd5b662){if(_0xd5b662){_0x307b3e=_0xd5b662;_0xf81284=_0x307b3e[_0x0a9e('0xd')]||0x1388;}})[_0x0a9e('0xe')](function(){return dbH[_0x0a9e('0xf')]['query'](util[_0x0a9e('0xb')](_0x0a9e('0x10'),QUERY),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]});})[_0x0a9e('0xe')](function(_0x52a03d){if(!_0x52a03d[0x0][_0x0a9e('0x13')]){return analyticExtractedReport('Empty');}var _0x1985b6=[];var _0x519dfd=0x0;var _0x16033c=!![];if(_0x307b3e[_0x0a9e('0x14')]){if(_0x52a03d&&_0x52a03d['length']){var _0x225616=_0x52a03d[0x0]['num']%(_0x519dfd+_0xf81284);for(;_0x16033c;_0x519dfd+=_0xf81284,_0x225616=_0x52a03d[0x0][_0x0a9e('0x13')]%(_0x519dfd+_0xf81284)){if(_0x225616==0x0||_0x225616==_0x52a03d[0x0][_0x0a9e('0x13')]){_0x16033c=![];}_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')][_0x0a9e('0x16')](util[_0x0a9e('0xb')](_0x0a9e('0x17'),QUERY,_0xf81284,_0x519dfd),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]}));}}}else{_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')]['query'](QUERY,{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')]['SELECT']}));}var _0x20f109=path['dirname'](PATH);var _0x588269=path[_0x0a9e('0x18')](PATH,_0x0a9e('0x19'));var _0x38e7c4=_0x307b3e[_0x0a9e('0x14')]&&_0x1985b6['length']>0x1;var _0xfb6e48=[];if(!fs[_0x0a9e('0x1a')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269))&&_0x38e7c4){fs[_0x0a9e('0x1c')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269));}return BPromise[_0x0a9e('0x1d')](_0x1985b6,function(_0x16b1ca){_0xfb6e48['push'](_0x16b1ca);})['then'](function(){for(var _0x197ec0=0x0;_0x197ec0<_0xfb6e48[_0x0a9e('0x1e')];_0x197ec0+=0x1){var _0x40c424;var _0x33161b=_0xfb6e48[_0x197ec0];if(_0x38e7c4){_0x40c424=path['join'](_0x20f109,_0x588269,util[_0x0a9e('0xb')]('%s%d.%s',_0x588269,_0x197ec0,_0x0a9e('0x1f')));}else{_0x40c424=path['join'](_0x20f109,util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x1f')));}fs[_0x0a9e('0x21')](_0x40c424,json2xls(_0x33161b),_0x0a9e('0x22'));}})[_0x0a9e('0xe')](function(){if(_0x38e7c4){zipdir(path[_0x0a9e('0x1b')](_0x20f109,_0x588269),{'saveTo':path[_0x0a9e('0x1b')](_0x20f109,util['format'](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x23')))},function(_0x2b1f27,_0x2ec755){});rimraf(path['join'](_0x20f109,_0x588269),function(){});}})[_0x0a9e('0xe')](function(){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x24'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')));return analyticExtractedReport(_0x0a9e('0x26'),_0x38e7c4?util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x38e7c4?_0x0a9e('0x23'):'xlsx'):null);});})[_0x0a9e('0x27')](function(_0x5d1e0e){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x28'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')),util[_0x0a9e('0x29')](_0x5d1e0e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0a9e('0x2a')](function(){process[_0x0a9e('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xa9e0=['QueryTypes','SELECT','num','split','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','mkdirSync','each','length','xlsx','%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','inspect','finally','exit','util','path','lodash','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x419b6a,_0x265b43){var _0x229232=function(_0x514a3e){while(--_0x514a3e){_0x419b6a['push'](_0x419b6a['shift']());}};_0x229232(++_0x265b43);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var util=require(_0x0a9e('0x0'));var path=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0x0a9e('0x3'));var rimraf=require('rimraf');var db=require(_0x0a9e('0x4'))['db'];var dbH=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0a9e('0x8')][0x3];var PATH=process[_0x0a9e('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2cc193,_0x5f41ea){var _0x503809={'status':_0x2cc193};var _0xe42b77={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5f41ea){_0x503809['savename']=_0x5f41ea;}return db['AnalyticExtractedReport'][_0x0a9e('0x9')](_0x503809,_0xe42b77);}function main(){var _0xf81284=0x1388;var _0x307b3e;logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0a9e('0xd')]})[_0x0a9e('0xe')](function(_0xd5b662){if(_0xd5b662){_0x307b3e=_0xd5b662;_0xf81284=_0x307b3e[_0x0a9e('0xd')]||0x1388;}})[_0x0a9e('0xe')](function(){return dbH[_0x0a9e('0xf')]['query'](util[_0x0a9e('0xb')](_0x0a9e('0x10'),QUERY),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]});})[_0x0a9e('0xe')](function(_0x52a03d){if(!_0x52a03d[0x0][_0x0a9e('0x13')]){return analyticExtractedReport('Empty');}var _0x1985b6=[];var _0x519dfd=0x0;var _0x16033c=!![];if(_0x307b3e[_0x0a9e('0x14')]){if(_0x52a03d&&_0x52a03d['length']){var _0x225616=_0x52a03d[0x0]['num']%(_0x519dfd+_0xf81284);for(;_0x16033c;_0x519dfd+=_0xf81284,_0x225616=_0x52a03d[0x0][_0x0a9e('0x13')]%(_0x519dfd+_0xf81284)){if(_0x225616==0x0||_0x225616==_0x52a03d[0x0][_0x0a9e('0x13')]){_0x16033c=![];}_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')][_0x0a9e('0x16')](util[_0x0a9e('0xb')](_0x0a9e('0x17'),QUERY,_0xf81284,_0x519dfd),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]}));}}}else{_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')]['query'](QUERY,{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')]['SELECT']}));}var _0x20f109=path['dirname'](PATH);var _0x588269=path[_0x0a9e('0x18')](PATH,_0x0a9e('0x19'));var _0x38e7c4=_0x307b3e[_0x0a9e('0x14')]&&_0x1985b6['length']>0x1;var _0xfb6e48=[];if(!fs[_0x0a9e('0x1a')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269))&&_0x38e7c4){fs[_0x0a9e('0x1c')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269));}return BPromise[_0x0a9e('0x1d')](_0x1985b6,function(_0x16b1ca){_0xfb6e48['push'](_0x16b1ca);})['then'](function(){for(var _0x197ec0=0x0;_0x197ec0<_0xfb6e48[_0x0a9e('0x1e')];_0x197ec0+=0x1){var _0x40c424;var _0x33161b=_0xfb6e48[_0x197ec0];if(_0x38e7c4){_0x40c424=path['join'](_0x20f109,_0x588269,util[_0x0a9e('0xb')]('%s%d.%s',_0x588269,_0x197ec0,_0x0a9e('0x1f')));}else{_0x40c424=path['join'](_0x20f109,util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x1f')));}fs[_0x0a9e('0x21')](_0x40c424,json2xls(_0x33161b),_0x0a9e('0x22'));}})[_0x0a9e('0xe')](function(){if(_0x38e7c4){zipdir(path[_0x0a9e('0x1b')](_0x20f109,_0x588269),{'saveTo':path[_0x0a9e('0x1b')](_0x20f109,util['format'](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x23')))},function(_0x2b1f27,_0x2ec755){});rimraf(path['join'](_0x20f109,_0x588269),function(){});}})[_0x0a9e('0xe')](function(){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x24'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')));return analyticExtractedReport(_0x0a9e('0x26'),_0x38e7c4?util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x38e7c4?_0x0a9e('0x23'):'xlsx'):null);});})[_0x0a9e('0x27')](function(_0x5d1e0e){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x28'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')),util[_0x0a9e('0x29')](_0x5d1e0e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0a9e('0x2a')](function(){process[_0x0a9e('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index ddc2fa0..67484e4 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 _0xf32e=['IntervalId','map','tag','length','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','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1',',${EXTEN},','last','concat','bulkCreate','sortBy','catch','error','lodash','util','then','intervals','models','VoiceExtension','findAll','uniq','filter','groupBy','exten','queue','playback','hasOwnProperty','priority','extensions','find','push','type','format','CDR(type)=%s','context','extension','Set','cutdigits','${EXTEN:','${EXTEN}','VoiceExtensionId','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','toLowerCase','updatedAt','interval'];(function(_0x5a1a7f,_0x3f38ba){var _0x3a3bf5=function(_0x6701ff){while(--_0x6701ff){_0x5a1a7f['push'](_0x5a1a7f['shift']());}};_0x3a3bf5(++_0x3f38ba);}(_0xf32e,0x110));var _0xef32=function(_0x14cc78,_0x1d6d29){_0x14cc78=_0x14cc78-0x0;var _0x4e5112=_0xf32e[_0x14cc78];return _0x4e5112;};'use strict';var _=require(_0xef32('0x0'));var util=require(_0xef32('0x1'));function rewrite(_0x1fbf9d,_0x4fa1bb){var _0x4e9765=this;return _0x1fbf9d['models']['Interval']['findAll']({'raw':!![]})[_0xef32('0x2')](function(_0x1bfa66){_0x4e9765[_0xef32('0x3')]=_0x1bfa66;return _0x1fbf9d['models']['VoiceExtension']['findAll']({'where':{'IntervalId':_0x4fa1bb['IntervalId']},'raw':!![]});})[_0xef32('0x2')](function(_0x35ac44){return _0x1fbf9d[_0xef32('0x4')][_0xef32('0x5')][_0xef32('0x6')]({'where':{'exten':{'$in':_[_0xef32('0x7')](_['map'](_0x35ac44,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x4006a6){var _0x183f51=_['filter'](_0x4006a6,{'priority':'1'});var _0x283d79=_[_0xef32('0x8')](_0x4006a6,{'isApp':0x1});var _0x33a2b=_[_0xef32('0x9')](_0x283d79,_0xef32('0xa'));var _0xde786d=[_0xef32('0xb'),_0xef32('0xc')];var _0x22a3b1=[];var _0x174295=[];for(var _0x5757f5 in _0x33a2b){if(_0x33a2b[_0xef32('0xd')](_0x5757f5)){_0x4e9765[_0xef32('0xe')]=0x2;_0x4e9765[_0xef32('0xf')]=[];_0x4e9765['extension']=_[_0xef32('0x10')](_0x183f51,{'exten':_0x33a2b[_0x5757f5][0x0][_0xef32('0xa')]});_0x4e9765['extensions'][_0xef32('0x11')]({'type':_0x33a2b[_0x5757f5][0x0][_0xef32('0x12')],'app':'Set','appdata':util[_0xef32('0x13')](_0xef32('0x14'),_0x33a2b[_0x5757f5][0x0]['type']),'context':_0x33a2b[_0x5757f5][0x0][_0xef32('0x15')],'exten':_0x33a2b[_0x5757f5][0x0]['exten'],'priority':_0x4e9765[_0xef32('0xe')]++,'VoiceExtensionId':_0x33a2b[_0x5757f5][0x0]['VoiceExtensionId']});if(_0x33a2b[_0x5757f5][0x0][_0xef32('0x12')]==='outbound'){if(_0x4e9765[_0xef32('0x16')]){_0x4e9765[_0xef32('0xf')][_0xef32('0x11')]({'type':_0x33a2b[_0x5757f5][0x0][_0xef32('0x12')],'app':_0xef32('0x17'),'appdata':'CDR(destination)='+(_0x4e9765[_0xef32('0x16')][_0xef32('0x18')]?_0xef32('0x19')+_0x4e9765[_0xef32('0x16')]['cutdigits']+'}':_0xef32('0x1a')),'context':_0x33a2b[_0x5757f5][0x0][_0xef32('0x15')],'exten':_0x33a2b[_0x5757f5][0x0]['exten'],'priority':_0x4e9765[_0xef32('0xe')]++,'VoiceExtensionId':_0x33a2b[_0x5757f5][0x0][_0xef32('0x1b')]});}_0x4e9765[_0xef32('0xf')]['push']({'type':_0x33a2b[_0x5757f5][0x0][_0xef32('0x12')],'app':_0xef32('0x17'),'appdata':'CDR(routeid)='+_0x33a2b[_0x5757f5][0x0][_0xef32('0x1b')],'context':_0x33a2b[_0x5757f5][0x0][_0xef32('0x15')],'exten':_0x33a2b[_0x5757f5][0x0][_0xef32('0xa')],'priority':_0x4e9765[_0xef32('0xe')]++,'VoiceExtensionId':_0x33a2b[_0x5757f5][0x0][_0xef32('0x1b')]});var _0x1acb02=_0x4e9765[_0xef32('0xe')]++;_0x4e9765[_0xef32('0xf')][_0xef32('0x11')]({'type':_0x33a2b[_0x5757f5][0x0]['type'],'app':_0xef32('0x1c'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x1acb02+0x2)+_0xef32('0x1d')+(_0x1acb02+0x1)+')','context':_0x33a2b[_0x5757f5][0x0][_0xef32('0x15')],'exten':_0x33a2b[_0x5757f5][0x0]['exten'],'priority':_0x1acb02,'VoiceExtensionId':_0x33a2b[_0x5757f5][0x0][_0xef32('0x1b')]});if(_0x4e9765['extension']){_0x4e9765[_0xef32('0xf')][_0xef32('0x11')]({'type':_0x33a2b[_0x5757f5][0x0][_0xef32('0x12')],'app':_0xef32('0x17'),'appdata':_0x4e9765[_0xef32('0x16')]['cutdigits']?_0xef32('0x1e')+_0x4e9765[_0xef32('0x16')][_0xef32('0x18')]+'}':_0xef32('0x1f'),'context':_0x33a2b[_0x5757f5][0x0][_0xef32('0x15')],'exten':_0x33a2b[_0x5757f5][0x0]['exten'],'priority':_0x4e9765[_0xef32('0xe')]++,'VoiceExtensionId':_0x33a2b[_0x5757f5][0x0][_0xef32('0x1b')]});}_0x4e9765[_0xef32('0xf')][_0xef32('0x11')]({'type':_0x33a2b[_0x5757f5][0x0][_0xef32('0x12')],'app':_0xef32('0x17'),'appdata':_0xef32('0x20')+_0x33a2b[_0x5757f5][0x0]['VoiceExtensionId'],'context':_0x33a2b[_0x5757f5][0x0]['context'],'exten':_0x33a2b[_0x5757f5][0x0]['exten'],'priority':_0x4e9765[_0xef32('0xe')]++,'VoiceExtensionId':_0x33a2b[_0x5757f5][0x0]['VoiceExtensionId']});if(_0x4e9765[_0xef32('0x16')]&&_0x4e9765[_0xef32('0x16')][_0xef32('0xd')](_0xef32('0x21'))&&_0x4e9765['extension']['recordingFormat']!==_0xef32('0x22')){_0x4e9765[_0xef32('0xf')][_0xef32('0x11')]({'type':_0x33a2b[_0x5757f5][0x0]['type'],'app':_0xef32('0x17'),'appdata':_0xef32('0x23'),'context':_0x33a2b[_0x5757f5][0x0][_0xef32('0x15')],'exten':_0x33a2b[_0x5757f5][0x0]['exten'],'priority':_0x4e9765[_0xef32('0xe')]++,'VoiceExtensionId':_0x33a2b[_0x5757f5][0x0][_0xef32('0x1b')]});_0x4e9765[_0xef32('0xf')][_0xef32('0x11')]({'type':_0x33a2b[_0x5757f5][0x0][_0xef32('0x12')],'app':_0xef32('0x17'),'appdata':_0xef32('0x24')+_0x4e9765['extension'][_0xef32('0x21')]||_0xef32('0x25'),'context':_0x33a2b[_0x5757f5][0x0][_0xef32('0x15')],'exten':_0x33a2b[_0x5757f5][0x0][_0xef32('0xa')],'priority':_0x4e9765[_0xef32('0xe')]++,'VoiceExtensionId':_0x33a2b[_0x5757f5][0x0][_0xef32('0x1b')]});}}_0x4e9765[_0xef32('0xf')]['push']({'type':_0x33a2b[_0x5757f5][0x0][_0xef32('0x12')],'app':_0xef32('0x17'),'appdata':_0xef32('0x26'),'context':_0x33a2b[_0x5757f5][0x0][_0xef32('0x15')],'exten':_0x33a2b[_0x5757f5][0x0][_0xef32('0xa')],'priority':_0x4e9765[_0xef32('0xe')]++,'VoiceExtensionId':_0x33a2b[_0x5757f5][0x0]['VoiceExtensionId']});_0x4e9765[_0xef32('0xf')][_0xef32('0x11')]({'type':_0x33a2b[_0x5757f5][0x0][_0xef32('0x12')],'app':_0xef32('0x17'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x33a2b[_0x5757f5][0x0][_0xef32('0x15')],'exten':_0x33a2b[_0x5757f5][0x0][_0xef32('0xa')],'priority':_0x4e9765[_0xef32('0xe')]++,'VoiceExtensionId':_0x33a2b[_0x5757f5][0x0][_0xef32('0x1b')]});_0x4e9765[_0xef32('0xf')][_0xef32('0x11')]({'type':_0x33a2b[_0x5757f5][0x0]['type'],'app':_0xef32('0x17'),'appdata':_0xef32('0x27'),'context':_0x33a2b[_0x5757f5][0x0][_0xef32('0x15')],'exten':_0x33a2b[_0x5757f5][0x0][_0xef32('0xa')],'priority':_0x4e9765[_0xef32('0xe')]++,'VoiceExtensionId':_0x33a2b[_0x5757f5][0x0][_0xef32('0x1b')]});for(var _0x3dec5d=0x0,_0x230b17=0x0;_0x3dec5d<_0x33a2b[_0x5757f5]['length'];_0x3dec5d+=0x1,_0x230b17=0x0){var _0x51c7d3=_0x33a2b[_0x5757f5][_0x3dec5d];if(_0x51c7d3[_0xef32('0x12')]){_0x51c7d3[_0xef32('0x12')]=_0x51c7d3['type'][_0xef32('0x28')]();}var _0x22d9cc=[];var _0x4f6acf=[];delete _0x51c7d3['id'];delete _0x51c7d3['createdAt'];delete _0x51c7d3[_0xef32('0x29')];var _0x45e2e3=_0x51c7d3['interval']!=='*,*,*,*'?[_0x51c7d3[_0xef32('0x2a')]]:_0x51c7d3[_0xef32('0x2b')]?_[_0xef32('0x2c')](_[_0xef32('0x8')](_0x4e9765['intervals'],{'IntervalId':_0x51c7d3[_0xef32('0x2b')]}),_0xef32('0x2a')):[];if(_0x51c7d3['hasOwnProperty'](_0xef32('0x2d'))){if(_0x51c7d3[_0xef32('0x2d')]&&_0x51c7d3['tag']!=='--'){_0x22d9cc[_0xef32('0x11')]({'type':_0x51c7d3[_0xef32('0x12')],'app':'Set','appdata':'CDR(tag)='+_0x51c7d3['tag'],'context':_0x51c7d3['context'],'exten':_0x51c7d3[_0xef32('0xa')],'priority':_0x45e2e3[_0xef32('0x2e')]+_0x4e9765[_0xef32('0xe')]+_0x230b17++,'VoiceExtensionId':_0x51c7d3[_0xef32('0x1b')]});}}if(_0x51c7d3[_0xef32('0x12')]==='outbound'&&_0x51c7d3[_0xef32('0xd')](_0xef32('0x2f'))){if(_0x51c7d3[_0xef32('0x2f')]){_0x22d9cc[_0xef32('0x11')]({'type':_0x51c7d3[_0xef32('0x12')],'app':_0xef32('0x1c'),'appdata':_0xef32('0x30')+_0x51c7d3[_0xef32('0x2f')]+')','context':_0x51c7d3[_0xef32('0x15')],'exten':_0x51c7d3[_0xef32('0xa')],'priority':_0x45e2e3[_0xef32('0x2e')]+_0x4e9765[_0xef32('0xe')]+_0x230b17++,'VoiceExtensionId':_0x51c7d3[_0xef32('0x1b')]});}else{_0x22d9cc[_0xef32('0x11')]({'type':_0x51c7d3['type'],'app':_0xef32('0x1c'),'appdata':_0xef32('0x31'),'context':_0x51c7d3[_0xef32('0x15')],'exten':_0x51c7d3[_0xef32('0xa')],'priority':_0x45e2e3['length']+_0x4e9765['priority']+_0x230b17++,'VoiceExtensionId':_0x51c7d3[_0xef32('0x1b')]});}}if(_0x51c7d3[_0xef32('0xd')](_0xef32('0x32'))){if(_0xde786d[_0xef32('0x33')](_0x51c7d3[_0xef32('0x34')][_0xef32('0x28')]())>=0x0&&_0x51c7d3['appType']!==_0xef32('0x35')){if(_0x51c7d3[_0xef32('0x32')]){_0x22d9cc['push']({'type':_0x51c7d3[_0xef32('0x12')],'app':_0xef32('0x1c'),'appdata':_0xef32('0x36'),'context':_0x51c7d3['context'],'exten':_0x51c7d3[_0xef32('0xa')],'priority':_0x45e2e3['length']+_0x4e9765[_0xef32('0xe')]+_0x230b17++,'VoiceExtensionId':_0x51c7d3[_0xef32('0x1b')]});_0x22d9cc[_0xef32('0x11')]({'type':_0x51c7d3[_0xef32('0x12')],'app':'Set','appdata':_0xef32('0x37'),'context':_0x51c7d3['context'],'exten':_0x51c7d3['exten'],'priority':_0x45e2e3[_0xef32('0x2e')]+_0x4e9765['priority']+_0x230b17++,'VoiceExtensionId':_0x51c7d3[_0xef32('0x1b')]});}else{_0x22d9cc[_0xef32('0x11')]({'type':_0x51c7d3['type'],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x51c7d3[_0xef32('0x15')],'exten':_0x51c7d3[_0xef32('0xa')],'priority':_0x45e2e3[_0xef32('0x2e')]+_0x4e9765[_0xef32('0xe')]+_0x230b17++,'VoiceExtensionId':_0x51c7d3[_0xef32('0x1b')]});_0x22d9cc[_0xef32('0x11')]({'type':_0x51c7d3[_0xef32('0x12')],'app':_0xef32('0x17'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x51c7d3[_0xef32('0x15')],'exten':_0x51c7d3[_0xef32('0xa')],'priority':_0x45e2e3[_0xef32('0x2e')]+_0x4e9765['priority']+_0x230b17++,'VoiceExtensionId':_0x51c7d3['VoiceExtensionId']});}}}for(var _0x810918=0x0;_0x810918<_0x45e2e3[_0xef32('0x2e')];_0x810918+=0x1){var _0x538cda=_0x4e9765['priority']+_0x45e2e3['length'];var _0x51e95d=_0x810918===_0x45e2e3[_0xef32('0x2e')]-0x1?_0x4e9765['priority']+_0x22d9cc['length']+_0x4f6acf['length']+0x2:_0x4e9765['priority']+_0x810918+0x1;_0x22d9cc['splice'](_0x810918,0x0,{'type':_0x51c7d3['type'],'app':'GotoIfTime','appdata':_0x45e2e3[_0x810918]+'?'+_0x51c7d3[_0xef32('0x15')]+_0xef32('0x38')+_0x538cda+':'+_0x51c7d3[_0xef32('0x15')]+_0xef32('0x38')+_0x51e95d,'exten':_0x51c7d3['exten'],'context':_0x51c7d3[_0xef32('0x15')],'priority':_0x4e9765[_0xef32('0xe')]+_0x810918,'VoiceExtensionId':_0x33a2b[_0x5757f5][0x0]['VoiceExtensionId']});}_0x51c7d3[_0xef32('0xe')]=_0x22d9cc[_0xef32('0x2e')]?_[_0xef32('0x39')](_0x22d9cc)[_0xef32('0xe')]+0x1:_0x4e9765[_0xef32('0xe')];_0x4e9765[_0xef32('0xe')]=(_0x4f6acf[_0xef32('0x2e')]?_[_0xef32('0x39')](_0x4f6acf)[_0xef32('0xe')]:_0x51c7d3[_0xef32('0xe')])+0x1;_0x4e9765[_0xef32('0xf')]=_[_0xef32('0x3a')](_0x4e9765[_0xef32('0xf')],_0x22d9cc,[_0x51c7d3],_0x4f6acf);}_0x4e9765[_0xef32('0xf')][_0xef32('0x11')]({'type':_0x33a2b[_0x5757f5][0x0][_0xef32('0x12')],'app':'Hangup','exten':_0x33a2b[_0x5757f5][0x0]['exten'],'context':_0x33a2b[_0x5757f5][0x0][_0xef32('0x15')],'priority':_0x4e9765[_0xef32('0xe')],'VoiceExtensionId':_0x33a2b[_0x5757f5][0x0]['VoiceExtensionId']});_0x22a3b1[_0xef32('0x11')](_0x33a2b[_0x5757f5][0x0][_0xef32('0x1b')]);_0x174295=_[_0xef32('0x3a')](_0x174295,_0x4e9765[_0xef32('0xf')]);}}return _0x1fbf9d['transaction'](function(_0x3a25a9){return _0x1fbf9d[_0xef32('0x4')][_0xef32('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x22a3b1}},'transaction':_0x3a25a9})[_0xef32('0x2')](function(_0x387402){return _0x1fbf9d['models'][_0xef32('0x5')][_0xef32('0x3b')](_[_0xef32('0x3c')](_0x174295,'priority'),{'transaction':_0x3a25a9});});});})[_0xef32('0x3d')](function(_0x2a65bf){console[_0xef32('0x3e')](_0x2a65bf);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x7633=['${EXTEN:','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','length','createdAt','updatedAt','*,*,*,*','interval','map','tag','CDR(tag)=','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)','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','models','VoiceExtension','destroy','bulkCreate','catch','error','lodash','util','Interval','findAll','intervals','IntervalId','then','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','hasOwnProperty','priority','extensions','extension','find','push','type','Set','context','VoiceExtensionId','outbound','CDR(destination)='];(function(_0x3c208f,_0x371b0f){var _0x1aedcc=function(_0x185841){while(--_0x185841){_0x3c208f['push'](_0x3c208f['shift']());}};_0x1aedcc(++_0x371b0f);}(_0x7633,0x1c4));var _0x3763=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7633[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x3763('0x0'));var util=require(_0x3763('0x1'));function rewrite(_0x1a6321,_0x45e7db){var _0xd1b764=this;return _0x1a6321['models'][_0x3763('0x2')][_0x3763('0x3')]({'raw':!![]})['then'](function(_0x5f4eb8){_0xd1b764[_0x3763('0x4')]=_0x5f4eb8;return _0x1a6321['models']['VoiceExtension'][_0x3763('0x3')]({'where':{'IntervalId':_0x45e7db[_0x3763('0x5')]},'raw':!![]});})[_0x3763('0x6')](function(_0x335382){return _0x1a6321['models']['VoiceExtension'][_0x3763('0x3')]({'where':{'exten':{'$in':_[_0x3763('0x7')](_['map'](_0x335382,_0x3763('0x8')))}},'order':[{'raw':_0x3763('0x9')}],'raw':!![]});})[_0x3763('0x6')](function(_0x401909){var _0x29ec1c=_[_0x3763('0xa')](_0x401909,{'priority':'1'});var _0x7335b9=_[_0x3763('0xa')](_0x401909,{'isApp':0x1});var _0x4b3226=_[_0x3763('0xb')](_0x7335b9,_0x3763('0x8'));var _0x11d390=['queue','playback'];var _0x10602e=[];var _0x58e8c9=[];for(var _0x12f0ea in _0x4b3226){if(_0x4b3226[_0x3763('0xc')](_0x12f0ea)){_0xd1b764[_0x3763('0xd')]=0x2;_0xd1b764[_0x3763('0xe')]=[];_0xd1b764[_0x3763('0xf')]=_[_0x3763('0x10')](_0x29ec1c,{'exten':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x8')]});_0xd1b764['extensions'][_0x3763('0x11')]({'type':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x12')],'app':_0x3763('0x13'),'appdata':util['format']('CDR(type)=%s',_0x4b3226[_0x12f0ea][0x0]['type']),'context':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x14')],'exten':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x8')],'priority':_0xd1b764[_0x3763('0xd')]++,'VoiceExtensionId':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x15')]});if(_0x4b3226[_0x12f0ea][0x0][_0x3763('0x12')]===_0x3763('0x16')){if(_0xd1b764[_0x3763('0xf')]){_0xd1b764['extensions'][_0x3763('0x11')]({'type':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x12')],'app':_0x3763('0x13'),'appdata':_0x3763('0x17')+(_0xd1b764['extension']['cutdigits']?_0x3763('0x18')+_0xd1b764[_0x3763('0xf')][_0x3763('0x19')]+'}':_0x3763('0x1a')),'context':_0x4b3226[_0x12f0ea][0x0]['context'],'exten':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x8')],'priority':_0xd1b764['priority']++,'VoiceExtensionId':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x15')]});}_0xd1b764[_0x3763('0xe')]['push']({'type':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x12')],'app':_0x3763('0x13'),'appdata':_0x3763('0x1b')+_0x4b3226[_0x12f0ea][0x0][_0x3763('0x15')],'context':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x14')],'exten':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x8')],'priority':_0xd1b764[_0x3763('0xd')]++,'VoiceExtensionId':_0x4b3226[_0x12f0ea][0x0]['VoiceExtensionId']});var _0x57036c=_0xd1b764['priority']++;_0xd1b764[_0x3763('0xe')][_0x3763('0x11')]({'type':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x12')],'app':_0x3763('0x1c'),'appdata':_0x3763('0x1d')+(_0x57036c+0x2)+_0x3763('0x1e')+(_0x57036c+0x1)+')','context':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x14')],'exten':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x8')],'priority':_0x57036c,'VoiceExtensionId':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x15')]});if(_0xd1b764[_0x3763('0xf')]){_0xd1b764[_0x3763('0xe')][_0x3763('0x11')]({'type':_0x4b3226[_0x12f0ea][0x0]['type'],'app':_0x3763('0x13'),'appdata':_0xd1b764[_0x3763('0xf')][_0x3763('0x19')]?'CDR(prefix)=${EXTEN:0:'+_0xd1b764[_0x3763('0xf')][_0x3763('0x19')]+'}':_0x3763('0x1f'),'context':_0x4b3226[_0x12f0ea][0x0]['context'],'exten':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x8')],'priority':_0xd1b764[_0x3763('0xd')]++,'VoiceExtensionId':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x15')]});}_0xd1b764[_0x3763('0xe')][_0x3763('0x11')]({'type':_0x4b3226[_0x12f0ea][0x0]['type'],'app':'Set','appdata':_0x3763('0x20')+_0x4b3226[_0x12f0ea][0x0][_0x3763('0x15')],'context':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x14')],'exten':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x8')],'priority':_0xd1b764[_0x3763('0xd')]++,'VoiceExtensionId':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x15')]});if(_0xd1b764[_0x3763('0xf')]&&_0xd1b764[_0x3763('0xf')]['hasOwnProperty'](_0x3763('0x21'))&&_0xd1b764[_0x3763('0xf')][_0x3763('0x21')]!==_0x3763('0x22')){_0xd1b764['extensions']['push']({'type':_0x4b3226[_0x12f0ea][0x0]['type'],'app':'Set','appdata':_0x3763('0x23'),'context':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x14')],'exten':_0x4b3226[_0x12f0ea][0x0]['exten'],'priority':_0xd1b764[_0x3763('0xd')]++,'VoiceExtensionId':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x15')]});_0xd1b764['extensions'][_0x3763('0x11')]({'type':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x12')],'app':_0x3763('0x13'),'appdata':_0x3763('0x24')+_0xd1b764[_0x3763('0xf')][_0x3763('0x21')]||_0x3763('0x25'),'context':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x14')],'exten':_0x4b3226[_0x12f0ea][0x0]['exten'],'priority':_0xd1b764[_0x3763('0xd')]++,'VoiceExtensionId':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x15')]});}}_0xd1b764['extensions'][_0x3763('0x11')]({'type':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x12')],'app':_0x3763('0x13'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x14')],'exten':_0x4b3226[_0x12f0ea][0x0]['exten'],'priority':_0xd1b764[_0x3763('0xd')]++,'VoiceExtensionId':_0x4b3226[_0x12f0ea][0x0]['VoiceExtensionId']});_0xd1b764[_0x3763('0xe')][_0x3763('0x11')]({'type':_0x4b3226[_0x12f0ea][0x0]['type'],'app':_0x3763('0x13'),'appdata':_0x3763('0x26'),'context':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x14')],'exten':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x8')],'priority':_0xd1b764['priority']++,'VoiceExtensionId':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x15')]});_0xd1b764[_0x3763('0xe')]['push']({'type':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x12')],'app':_0x3763('0x13'),'appdata':'MONITOR_OPTIONS=ab','context':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x14')],'exten':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x8')],'priority':_0xd1b764[_0x3763('0xd')]++,'VoiceExtensionId':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x15')]});for(var _0x524b12=0x0,_0x271a64=0x0;_0x524b12<_0x4b3226[_0x12f0ea][_0x3763('0x27')];_0x524b12+=0x1,_0x271a64=0x0){var _0x11626e=_0x4b3226[_0x12f0ea][_0x524b12];if(_0x11626e[_0x3763('0x12')]){_0x11626e['type']=_0x11626e['type']['toLowerCase']();}var _0x58439b=[];var _0x5926b0=[];delete _0x11626e['id'];delete _0x11626e[_0x3763('0x28')];delete _0x11626e[_0x3763('0x29')];var _0xe64204=_0x11626e['interval']!==_0x3763('0x2a')?[_0x11626e[_0x3763('0x2b')]]:_0x11626e[_0x3763('0x5')]?_[_0x3763('0x2c')](_[_0x3763('0xa')](_0xd1b764[_0x3763('0x4')],{'IntervalId':_0x11626e[_0x3763('0x5')]}),_0x3763('0x2b')):[];if(_0x11626e[_0x3763('0xc')](_0x3763('0x2d'))){if(_0x11626e[_0x3763('0x2d')]&&_0x11626e['tag']!=='--'){_0x58439b['push']({'type':_0x11626e['type'],'app':_0x3763('0x13'),'appdata':_0x3763('0x2e')+_0x11626e[_0x3763('0x2d')],'context':_0x11626e[_0x3763('0x14')],'exten':_0x11626e['exten'],'priority':_0xe64204[_0x3763('0x27')]+_0xd1b764['priority']+_0x271a64++,'VoiceExtensionId':_0x11626e[_0x3763('0x15')]});}}if(_0x11626e[_0x3763('0x12')]===_0x3763('0x16')&&_0x11626e[_0x3763('0xc')](_0x3763('0x2f'))){if(_0x11626e[_0x3763('0x2f')]){_0x58439b[_0x3763('0x11')]({'type':_0x11626e['type'],'app':_0x3763('0x1c'),'appdata':_0x3763('0x30')+_0x11626e[_0x3763('0x2f')]+')','context':_0x11626e[_0x3763('0x14')],'exten':_0x11626e['exten'],'priority':_0xe64204['length']+_0xd1b764[_0x3763('0xd')]+_0x271a64++,'VoiceExtensionId':_0x11626e['VoiceExtensionId']});}else{_0x58439b[_0x3763('0x11')]({'type':_0x11626e['type'],'app':'ExecIf','appdata':_0x3763('0x31'),'context':_0x11626e[_0x3763('0x14')],'exten':_0x11626e[_0x3763('0x8')],'priority':_0xe64204[_0x3763('0x27')]+_0xd1b764[_0x3763('0xd')]+_0x271a64++,'VoiceExtensionId':_0x11626e[_0x3763('0x15')]});}}if(_0x11626e[_0x3763('0xc')]('answer')){if(_0x11d390[_0x3763('0x32')](_0x11626e[_0x3763('0x33')][_0x3763('0x34')]())>=0x0&&_0x11626e[_0x3763('0x35')]!==_0x3763('0x36')){if(_0x11626e['answer']){_0x58439b[_0x3763('0x11')]({'type':_0x11626e[_0x3763('0x12')],'app':_0x3763('0x1c'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x11626e[_0x3763('0x14')],'exten':_0x11626e[_0x3763('0x8')],'priority':_0xe64204['length']+_0xd1b764[_0x3763('0xd')]+_0x271a64++,'VoiceExtensionId':_0x11626e['VoiceExtensionId']});_0x58439b[_0x3763('0x11')]({'type':_0x11626e[_0x3763('0x12')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x11626e['context'],'exten':_0x11626e[_0x3763('0x8')],'priority':_0xe64204[_0x3763('0x27')]+_0xd1b764[_0x3763('0xd')]+_0x271a64++,'VoiceExtensionId':_0x11626e[_0x3763('0x15')]});}else{_0x58439b[_0x3763('0x11')]({'type':_0x11626e[_0x3763('0x12')],'app':_0x3763('0x1c'),'appdata':_0x3763('0x37'),'context':_0x11626e['context'],'exten':_0x11626e[_0x3763('0x8')],'priority':_0xe64204['length']+_0xd1b764[_0x3763('0xd')]+_0x271a64++,'VoiceExtensionId':_0x11626e[_0x3763('0x15')]});_0x58439b['push']({'type':_0x11626e[_0x3763('0x12')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x11626e[_0x3763('0x14')],'exten':_0x11626e[_0x3763('0x8')],'priority':_0xe64204[_0x3763('0x27')]+_0xd1b764['priority']+_0x271a64++,'VoiceExtensionId':_0x11626e[_0x3763('0x15')]});}}}for(var _0x52d80e=0x0;_0x52d80e<_0xe64204[_0x3763('0x27')];_0x52d80e+=0x1){var _0x4fdcbf=_0xd1b764[_0x3763('0xd')]+_0xe64204[_0x3763('0x27')];var _0x276074=_0x52d80e===_0xe64204[_0x3763('0x27')]-0x1?_0xd1b764[_0x3763('0xd')]+_0x58439b[_0x3763('0x27')]+_0x5926b0[_0x3763('0x27')]+0x2:_0xd1b764[_0x3763('0xd')]+_0x52d80e+0x1;_0x58439b[_0x3763('0x38')](_0x52d80e,0x0,{'type':_0x11626e['type'],'app':_0x3763('0x39'),'appdata':_0xe64204[_0x52d80e]+'?'+_0x11626e['context']+_0x3763('0x3a')+_0x4fdcbf+':'+_0x11626e['context']+_0x3763('0x3a')+_0x276074,'exten':_0x11626e[_0x3763('0x8')],'context':_0x11626e[_0x3763('0x14')],'priority':_0xd1b764[_0x3763('0xd')]+_0x52d80e,'VoiceExtensionId':_0x4b3226[_0x12f0ea][0x0]['VoiceExtensionId']});}_0x11626e[_0x3763('0xd')]=_0x58439b[_0x3763('0x27')]?_[_0x3763('0x3b')](_0x58439b)[_0x3763('0xd')]+0x1:_0xd1b764['priority'];_0xd1b764[_0x3763('0xd')]=(_0x5926b0[_0x3763('0x27')]?_['last'](_0x5926b0)[_0x3763('0xd')]:_0x11626e['priority'])+0x1;_0xd1b764['extensions']=_[_0x3763('0x3c')](_0xd1b764[_0x3763('0xe')],_0x58439b,[_0x11626e],_0x5926b0);}_0xd1b764[_0x3763('0xe')][_0x3763('0x11')]({'type':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x12')],'app':_0x3763('0x3d'),'exten':_0x4b3226[_0x12f0ea][0x0]['exten'],'context':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x14')],'priority':_0xd1b764['priority'],'VoiceExtensionId':_0x4b3226[_0x12f0ea][0x0][_0x3763('0x15')]});_0x10602e[_0x3763('0x11')](_0x4b3226[_0x12f0ea][0x0][_0x3763('0x15')]);_0x58e8c9=_[_0x3763('0x3c')](_0x58e8c9,_0xd1b764[_0x3763('0xe')]);}}return _0x1a6321['transaction'](function(_0x1ab664){return _0x1a6321[_0x3763('0x3e')][_0x3763('0x3f')][_0x3763('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x10602e}},'transaction':_0x1ab664})[_0x3763('0x6')](function(_0x47865a){return _0x1a6321[_0x3763('0x3e')][_0x3763('0x3f')][_0x3763('0x41')](_['sortBy'](_0x58e8c9,_0x3763('0xd')),{'transaction':_0x1ab664});});});})[_0x3763('0x42')](function(_0x43d751){console[_0x3763('0x43')](_0x43d751);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index fb9ed58..08b38e0 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 _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x42259b,_0x83e357){var _0x362e3b=function(_0x29901c){while(--_0x29901c){_0x42259b['push'](_0x42259b['shift']());}};_0x362e3b(++_0x83e357);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);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(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){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))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file +var _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate'];(function(_0x540af8,_0x491c2f){var _0x378002=function(_0x387aaf){while(--_0x387aaf){_0x540af8['push'](_0x540af8['shift']());}};_0x378002(++_0x491c2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);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(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){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'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index e36af4b..9445888 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 _0x16e4=['util','bluebird','moment','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','field','phone','from','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','findAll','AdditionalPhones','then','length','push','all','split','filter','CmContactHasItem','findOne','update','updated','PHONE','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','\x22always\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.createdAt','insert','ListId','updatedAt','cm_contacts.createdAt\x20=\x20?','cm_hopper_black','ListId\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contact_has_items','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','catch','main','send','start','binding','socket_timestamp','.csv','body','ContactItemType','name','header','writeFileSync','parse','createReadStream','data','rows','_description','isNil','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','agent\x20not\x20exists','email','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','find','itemTypeId','description','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','\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','contactTypeId','orderBy','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_blacklists','campaigns','CampaignId','each','affectedRows','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','SIGINT','path','lodash','papaparse'];(function(_0x310c2a,_0x107e39){var _0x12fb8f=function(_0xa79051){while(--_0xa79051){_0x310c2a['push'](_0x310c2a['shift']());}};_0x12fb8f(++_0x107e39);}(_0x16e4,0x97));var _0x416e=function(_0x34d15d,_0x2ff211){_0x34d15d=_0x34d15d-0x0;var _0x34f1fc=_0x16e4[_0x34d15d];return _0x34f1fc;};'use strict';var fs=require('fs');var path=require(_0x416e('0x0'));var _=require(_0x416e('0x1'));var Papa=require(_0x416e('0x2'));var util=require(_0x416e('0x3'));var BPromise=require(_0x416e('0x4'));var moment=require(_0x416e('0x5'));var squel=require('squel');var Redis=require(_0x416e('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0x416e('0x7'));var logger=require(_0x416e('0x8'))('import');config[_0x416e('0x9')]=_[_0x416e('0xa')](config[_0x416e('0x9')],{'host':_0x416e('0xb'),'port':0x18eb});var socket=require(_0x416e('0xc'))(new Redis(config[_0x416e('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x416e('0xd')](_0x416e('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x3b5877){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'](_0x3b5877);}function selectNotIn(_0x86c7f2,_0x541e74,_0x286d17,_0x14bbf6,_0x13bcd0){return squel['select']()[_0x416e('0xf')](_0x416e('0x10'))[_0x416e('0x11')](_0x14bbf6)['join'](_0x541e74,null,_0x541e74+_0x416e('0x12')+_0x14bbf6+'.'+_0x286d17)['where'](_0x14bbf6+'.'+_0x286d17+_0x416e('0x13')+_0x86c7f2+'.'+_0x286d17)[_0x416e('0x14')](_0x541e74+_0x416e('0x15')+_0x13bcd0[_0x416e('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x507d36,_0x2684d0){promisesAdditionalPhones=[];return db[_0x416e('0x17')][_0x416e('0x18')]({'raw':!![],'attributes':['id',_0x416e('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x416e('0x1a')](function(_0x253c30){if(_0x253c30!==null){var _0x30ead5=[];for(var _0x162420=0x0;_0x162420<_0x253c30[_0x416e('0x1b')];_0x162420++){var _0x5624ab=_0x253c30[_0x162420];_0x30ead5['push'](insertAdditionalPhones(_0x5624ab));}}Promise['all'](_0x30ead5)[_0x416e('0x1a')](function(){_0x507d36({'val':0x1});});});});}function insertAdditionalPhones(_0x3f8b53){return new Promise(function(_0x268ad1,_0x467e88){var _0x4ed9fc=_0x3f8b53[_0x416e('0x19')];var _0x27d249=_0x4ed9fc['split'](';');var _0x2ce23e=[];orderBy=0x0;for(var _0x41a9a8=0x0;_0x41a9a8<_0x27d249[_0x416e('0x1b')];_0x41a9a8++){_0x2ce23e[_0x416e('0x1c')](splitAdditionalPhone(_0x3f8b53['id'],_0x27d249[_0x41a9a8]));}Promise[_0x416e('0x1d')](_0x2ce23e)[_0x416e('0x1a')](function(){_0x268ad1({'val':_0x27d249[_0x416e('0x1b')]});});});}function splitAdditionalPhone(_0x1134ee,_0x3f6c1d){return new Promise(function(_0x1aea5e,_0x61de2b){var _0x5442bc=_0x3f6c1d[_0x416e('0x1e')](':');var _0x1f062f=_0x5442bc[0x0];var _0x3d197c=_0x5442bc[0x1];if(_0x3d197c!==''){var _0x41e5e8=_0x3d197c[_0x416e('0x1e')]('|');var _0x6392f3=[];for(var _0x4a2e9c=0x0;_0x4a2e9c<_0x41e5e8[_0x416e('0x1b')];_0x4a2e9c++){if(_0x41e5e8[_0x4a2e9c]!==''){var _0x3bbbad=_[_0x416e('0x1f')](promisesAdditionalPhones,{'contactId':_0x1134ee,'phone':_0x41e5e8[_0x4a2e9c]});if(_0x3bbbad['length']==0x0){orderBy++;promisesAdditionalPhones[_0x416e('0x1c')]({'contactId':_0x1134ee,'contactTypeId':_0x1f062f,'phone':_0x41e5e8[_0x4a2e9c],'orderBy':orderBy});}}}_0x1aea5e({'ok':0x1});}else _0x1aea5e({'res':0x0});});}function createAdditionalPhone(_0x11af15,_0x47679a,_0x6cb20a,_0x4ab2f2){var _0x17fe69='';var _0x3fa936='';var _0x3ab2fd=_0x6cb20a[_0x416e('0x1e')]('§');_0x17fe69=_0x3ab2fd[0x0];if(_0x3ab2fd[_0x416e('0x1b')]==0x2)_0x3fa936=_0x3ab2fd[0x1];return new Promise(function(_0x13a953,_0x117e11){return db[_0x416e('0x20')][_0x416e('0x21')]({'where':{'CmContactId':_0x11af15,'item':_0x17fe69}})['then'](function(_0x8b147f){if(_0x8b147f){return db[_0x416e('0x20')][_0x416e('0x22')]({'ItemTypeId':_0x47679a,'description':_0x3fa936,'OrderBy':_0x4ab2f2},{'where':{'CmContactId':_0x11af15,'item':_0x17fe69}})[_0x416e('0x1a')](function(_0x2ce7ea){_0x13a953({'res':_0x416e('0x23')});});}else{return db[_0x416e('0x20')]['create']({'CmContactId':_0x11af15,'item':_0x17fe69,'description':_0x3fa936,'ItemTypeId':_0x47679a,'OrderBy':_0x4ab2f2,'ItemClass':_0x416e('0x24')})[_0x416e('0x1a')](function(_0x415c25){_0x13a953({'res':'inserted'});});}});});}function insertCmHopper(_0x429f9a,_0x1c0888,_0x183213,_0x310702,_0x4206b6){var _0x3a0c55=[_0x416e('0x25'),_0x416e('0x26'),_0x416e('0x27'),_0x416e('0x28'),_0x1c0888+'.'+_0x310702,'cm_contacts.createdAt',_0x416e('0x29'),_0x416e('0x2a'),_0x416e('0x2b'),'\x22'+_0x4206b6+'\x22'];return squel['insert']()[_0x416e('0x2c')](_0x416e('0x2d'))[_0x416e('0x2e')](['phone',_0x416e('0x2f'),_0x416e('0x30'),'ListId',_0x310702,_0x416e('0x31'),'updatedAt','priority',_0x416e('0x32'),_0x416e('0x33')],squel[_0x416e('0x34')]()[_0x416e('0x35')](_0x3a0c55)[_0x416e('0x11')](_0x1c0888)[_0x416e('0x16')](_0x416e('0x36'),null,_0x416e('0x37')+_0x1c0888+_0x416e('0x38'))['join'](_0x183213,null,_0x183213+_0x416e('0x12')+_0x1c0888+'.'+_0x310702)['where'](_0x1c0888+_0x416e('0x39'),_0x429f9a)[_0x416e('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x416e('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1c0888,_0x183213,_0x310702,_0x416e('0x2d'),[_0x416e('0x3a'),'\x22onlyIfOpen\x22']))[_0x416e('0x14')](_0x416e('0x3b'),selectNotIn(_0x1c0888,_0x183213,_0x310702,_0x416e('0x2d'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x4e6f26,_0x41630f,_0x28e709,_0x379990){var _0x3805c6=[_0x416e('0x25'),_0x416e('0x27'),_0x416e('0x28'),_0x41630f+'.'+_0x379990,_0x416e('0x3c'),_0x416e('0x29')];return squel[_0x416e('0x3d')]()[_0x416e('0x2c')]('cm_hopper_black')[_0x416e('0x2e')](['phone','ContactId',_0x416e('0x3e'),_0x379990,_0x416e('0x31'),_0x416e('0x3f')],squel[_0x416e('0x34')]()[_0x416e('0x35')](_0x3805c6)[_0x416e('0x11')](_0x41630f)['join']('cm_contacts',null,_0x416e('0x37')+_0x41630f+_0x416e('0x38'))['join'](_0x28e709,null,_0x28e709+'.id\x20=\x20'+_0x41630f+'.'+_0x379990)[_0x416e('0x14')](_0x41630f+_0x416e('0x39'),_0x4e6f26)[_0x416e('0x14')](_0x416e('0x40'),NOW)[_0x416e('0x14')](_0x416e('0x3b'),squel[_0x416e('0x34')]()[_0x416e('0xf')](_0x416e('0x10'))[_0x416e('0x11')](_0x416e('0x41'))[_0x416e('0x14')](_0x416e('0x42'),_0x4e6f26)[_0x416e('0x14')](_0x379990+'\x20=\x20?',_0x41630f+'.'+_0x379990)))[_0x416e('0x43')]();}function insertCmHopperAdditionalPhones(_0x123b0d){var _0x5ed9bb=[_0x416e('0x44'),'cm_contact_has_items.item',_0x416e('0x45'),'cm_contact_has_items.createdAt',_0x416e('0x46')];return squel['insert']()['into']('cm_hopper_additional_phones')[_0x416e('0x2e')]([_0x416e('0x47'),_0x416e('0x10'),_0x416e('0x48'),_0x416e('0x31'),_0x416e('0x3f')],squel[_0x416e('0x34')]()['fields'](_0x5ed9bb)[_0x416e('0x11')](_0x416e('0x2d'))['join'](_0x416e('0x36'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x416e('0x16')](_0x416e('0x49'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x416e('0x14')]('cm_hopper.ListId\x20=\x20?',_0x123b0d)['where'](_0x416e('0x40'),NOW))[_0x416e('0x43')]();}function insertCmContact(_0x14d8c6,_0x40f42e,_0x138cce,_0x83a3ed){var _0x577bfd=_[_0x416e('0x4a')](_[_0x416e('0x4b')](_0x83a3ed),[_0x416e('0x3e'),'CompanyId',_0x416e('0x31'),_0x416e('0x3f')]);return squel['insert']()[_0x416e('0x2c')]('cm_contacts')['fromQuery'](_0x577bfd,squel['select']()[_0x416e('0x35')](_0x577bfd)['from'](_0x40f42e)[_0x416e('0x14')]('('+_0x138cce[_0x416e('0x16')](',')+_0x416e('0x4c'),squel[_0x416e('0x34')]()[_0x416e('0x35')](_0x138cce)['from'](_0x416e('0x36'))[_0x416e('0x14')](_0x416e('0x42'),_0x14d8c6)[_0x416e('0x14')](_0x416e('0x4d')))['where'](_0x416e('0x4e'),squel[_0x416e('0x34')]()[_0x416e('0xf')](_0x416e('0x4f'),_0x416e('0x50'))[_0x416e('0x11')](_0x40f42e)[_0x416e('0x51')](_0x138cce[_0x416e('0x16')](','))))[_0x416e('0x43')]();}function handleStop(){logger[_0x416e('0x52')](_0x416e('0x53'));stopped=!![];}function handleUncaughtException(_0x287a44){logger[_0x416e('0x54')](_0x287a44[_0x416e('0x55')]);process[_0x416e('0x56')](0x1);}function handleError(_0x3406e4,_0x4acf9c){stats[_0x416e('0x57')][_0x416e('0x1c')]({'name':_0x4acf9c[_0x416e('0x58')],'message':_0x4acf9c[_0x416e('0x55')],'row':_0x3406e4});}function handleQuery(_0x13c62b){logger[_0x416e('0x52')](_0x13c62b);return db[_0x416e('0x59')]['query'](_0x13c62b)['spread'](function(_0x2bd9b4){results['push'](_0x2bd9b4);})[_0x416e('0x5a')](function(_0x4dd6c5){logger['error'](_0x4dd6c5[_0x416e('0x55')]);});}function main(_0x331a97,_0x5518f5,_0x371527,_0x37c1e9){logger[_0x416e('0x52')](_0x416e('0x5b'),_0x331a97,JSON['stringify'](_0x5518f5));process[_0x416e('0x5c')](_0x416e('0x5d'));var _0x58efb0=_0x5518f5[_0x416e('0x5e')];var _0x5c7fef=_['clone'](_0x58efb0);var _0x81eb29=_0x5518f5[_0x416e('0x5f')];var _0x2b998e=path[_0x416e('0x16')](config['root'],'server/files/tmp',_0x81eb29+_0x416e('0x60'));logger['info'](_0x416e('0x61'),_0x5518f5);db[_0x416e('0x62')]['findAll']({'raw':!![],'attributes':['id',_0x416e('0x63')]})[_0x416e('0x1a')](function(_0x4bec6b){for(var _0x1d48f0=0x0;_0x1d48f0<_0x4bec6b[_0x416e('0x1b')];_0x1d48f0++){if(_0x4bec6b[_0x1d48f0][_0x416e('0x63')]in _0x58efb0){contactItemTypes[_0x416e('0x1c')](_0x4bec6b[_0x1d48f0]);delete _0x5c7fef[_0x4bec6b[_0x1d48f0][_0x416e('0x63')]];hasAdditionalPhones=!![];}for(var _0x323745 in _0x58efb0){if(_0x4bec6b[_0x1d48f0]['name']+'_description'===_0x323745){phoneDescriptions[_0x416e('0x1c')]({'itemTypeId':_0x4bec6b[_0x1d48f0]['id'],'description':_0x323745});delete _0x5c7fef[_0x323745];}}}if(hasAdditionalPhones)_0x5c7fef['AdditionalPhones']='';var _0x289272=_[_0x416e('0x4b')](_0x5c7fef)['join']();logger[_0x416e('0x52')](_0x416e('0x64'),_0x289272);fs[_0x416e('0x65')](_0x2b998e,_0x289272+'\x0a');Papa[_0x416e('0x66')](fs[_0x416e('0x67')](_0x331a97),{'header':!![],'skipEmptyLines':!![],'step':function(_0x41ddfa,_0x325570){try{for(var _0x11763b=0x0,_0x14e475=[];_0x11763b<_0x41ddfa[_0x416e('0x68')][_0x416e('0x1b')];_0x11763b++){stats[_0x416e('0x69')]+=0x1;if(_0x41ddfa[_0x416e('0x57')][_0x11763b]){handleError(_0x41ddfa[_0x416e('0x68')][_0x11763b],_0x41ddfa['errors'][_0x11763b]);}else{var _0x319268=[];var _0x10e17a=[];var _0x3e1692={};for(var _0x4b4e7a in _0x58efb0){let _0x599b73=contactItemTypes['find'](_0x4f9046=>_0x4f9046[_0x416e('0x63')]===_0x4b4e7a);let _0x50d516=contactItemTypes['find'](_0x27f3db=>_0x27f3db[_0x416e('0x63')]+_0x416e('0x6a')===_0x4b4e7a);if(_[_0x416e('0x6b')](_0x599b73)&&_['isNil'](_0x50d516)){if(_0x58efb0[_0x416e('0x6c')](_0x4b4e7a)){if(_0x41ddfa[_0x416e('0x68')][_0x11763b][_0x58efb0[_0x4b4e7a]]){var _0x143960=_[_0x416e('0x6d')](_0x41ddfa[_0x416e('0x68')][_0x11763b][_0x58efb0[_0x4b4e7a]][_0x416e('0x6e')](/"/g,'\x27'));switch(_0x4b4e7a){case _0x416e('0x2f'):var _0x2e5e0b=moment(_0x143960,_0x416e('0xe'),!![]);if(_0x2e5e0b[_0x416e('0x6f')]()){_0x14e475[_0x416e('0x1c')]('\x22'+_0x143960+'\x22');}else{_0x319268[_0x416e('0x1c')](_0x416e('0x70'));}break;case _0x416e('0x71'):var _0xb1f753=parseInt(_0x143960);_0x143960=_[_0x416e('0x72')](_0xb1f753)||_0xb1f753<0x0||_0xb1f753>0x4?_0x37c1e9?0x3:0x2:_0xb1f753;_0x14e475[_0x416e('0x1c')]('\x22'+_0x143960+'\x22');break;case _0x416e('0x32'):var _0x3e8552=parseInt(_0x143960);if(_[_0x416e('0x73')](_0x3e8552)&&_['includes'](_0x371527,_0x3e8552)){_0x14e475[_0x416e('0x1c')]('\x22'+_0x3e8552+'\x22');}else{_0x319268[_0x416e('0x1c')](_0x416e('0x74'));}break;case _0x416e('0x75'):if(isEmail(_0x143960)){_0x14e475[_0x416e('0x1c')]('\x22'+_0x143960+'\x22');}else{_0x319268[_0x416e('0x1c')]('email\x20wrong\x20format');}break;case _0x416e('0x76'):var _0x20491e=moment(_0x143960,'YYYY-MM-DD',!![]);if(_0x20491e[_0x416e('0x6f')]()){_0x14e475[_0x416e('0x1c')]('\x22'+_0x143960+'\x22');}else{_0x319268[_0x416e('0x1c')](_0x416e('0x77'));}break;default:_0x14e475[_0x416e('0x1c')]('\x22'+_0x143960+'\x22');}}else{switch(_0x4b4e7a){case'firstName':case _0x416e('0x10'):_0x319268[_0x416e('0x1c')](_0x4b4e7a+_0x416e('0x78'));break;default:_0x14e475[_0x416e('0x1c')]('\x22\x22');}}}}else{var _0x695fd0='';if(!_[_0x416e('0x6b')](_0x599b73)){if(!_0x3e1692[_0x416e('0x6c')](_0x599b73['id'])){for(var _0xe4c98f=0x0;_0xe4c98f<_0x58efb0[_0x4b4e7a]['length'];_0xe4c98f++){var _0x143960=_[_0x416e('0x6d')](_0x41ddfa[_0x416e('0x68')][_0x11763b][_0x58efb0[_0x4b4e7a][_0xe4c98f]][_0x416e('0x6e')](/"/g,'\x27'));var _0x52a099=phoneDescriptions[_0x416e('0x79')](_0x386cc2=>_0x386cc2[_0x416e('0x7a')]===_0x599b73['id']);if(!_[_0x416e('0x6b')](_0x52a099)){var _0x590456=_[_0x416e('0x6d')](_0x41ddfa[_0x416e('0x68')][_0x11763b][_0x58efb0[_0x52a099[_0x416e('0x7b')]][0x0]][_0x416e('0x6e')](/"/g,'\x27'));if(!_[_0x416e('0x6b')](_0x590456))_0x143960=_0x143960+'§'+_0x590456;}if(_0x695fd0=='')_0x695fd0=_0x143960;else _0x695fd0+='|'+_0x143960;}_0x10e17a[_0x416e('0x1c')](_0x599b73['id']+':'+_0x695fd0);_0x3e1692[_0x599b73['id']]=0x1;}}}}if(hasAdditionalPhones){_0x14e475['push']('\x22'+_0x10e17a[_0x416e('0x16')](';')+'\x22');}if(_0x319268[_0x416e('0x1b')]){handleError(_0x41ddfa[_0x416e('0x68')][_0x11763b],{'code':_0x416e('0x7c'),'message':_0x319268[_0x416e('0x16')]()});}else{fs['appendFileSync'](_0x2b998e,_0x14e475[_0x416e('0x16')]()+'\x0a');}_0x14e475=[];}if(!(stats[_0x416e('0x69')]%0xc8)){socket[_0x416e('0x7d')](_0x416e('0x7e')+_0x81eb29,stats);stats[_0x416e('0x57')]=[];}}if(stopped){logger['info'](_0x416e('0x7f'));_0x325570[_0x416e('0x80')]();}}catch(_0x5ada69){handleError(_0x41ddfa[_0x416e('0x68')][_0x11763b],{'code':_0x416e('0x81'),'message':_0x5ada69[_0x416e('0x55')]});logger[_0x416e('0x54')]('step',_0x5ada69['message']);}},'complete':function(){try{var _0x3d2f6e=[];var _0x3eda52=_0x416e('0x36');if(_0x5518f5[_0x416e('0x82')]&&_0x5518f5['duplicates'][_0x416e('0x1b')]){_0x3eda52=_0x416e('0x83')+_0x81eb29;_0x3d2f6e[_0x416e('0x1c')]('CREATE\x20TABLE\x20'+_0x3eda52+_0x416e('0x84'));}logger[_0x416e('0x52')]('CIS\x20len',contactItemTypes[_0x416e('0x1b')]);var _0x20a603=util[_0x416e('0xd')](_0x416e('0x85'),_0x2b998e,_0x3eda52,_0x289272,_0x5518f5['ListId'],_0x5518f5[_0x416e('0x86')]||null,NOW,NOW);if(_[_0x416e('0x6b')](_0x58efb0[_0x416e('0x2f')])){_0x20a603+=',\x20scheduledAt\x20=\x20NOW()';}_0x3d2f6e[_0x416e('0x1c')](_0x20a603);if(_0x5518f5[_0x416e('0x82')]&&_0x5518f5[_0x416e('0x82')][_0x416e('0x1b')]){_0x3d2f6e['push'](insertCmContact(_0x5518f5[_0x416e('0x3e')],_0x3eda52,_0x5518f5[_0x416e('0x82')],_0x58efb0));_0x3d2f6e[_0x416e('0x1c')]('DROP\x20TABLE\x20'+_0x3eda52+';');}BPromise['each'](_0x3d2f6e,handleQuery)[_0x416e('0x1a')](function(_0xde63b){BPromise[_0x416e('0x1d')]([handleAdditionalPhones()])[_0x416e('0x1a')](function(){_0x3d2f6e=[];for(var _0x30820c=0x0;_0x30820c\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','papaparse','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','defaults','redis','format','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','split','filter','findOne','update','updated','CmContactHasItem','create','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','createdAt','updatedAt','priority'];(function(_0x224dda,_0x16d0f9){var _0x2987ac=function(_0x3b1033){while(--_0x3b1033){_0x224dda['push'](_0x224dda['shift']());}};_0x2987ac(++_0x16d0f9);}(_0xe79a,0x70));var _0xae79=function(_0x17fd65,_0x556d01){_0x17fd65=_0x17fd65-0x0;var _0x27d033=_0xe79a[_0x17fd65];return _0x27d033;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0xae79('0x0'));var util=require('util');var BPromise=require(_0xae79('0x1'));var moment=require(_0xae79('0x2'));var squel=require(_0xae79('0x3'));var Redis=require(_0xae79('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xae79('0x5'));var logger=require(_0xae79('0x6'))(_0xae79('0x7'));config['redis']=_[_0xae79('0x8')](config[_0xae79('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xae79('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xae79('0xa')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4043ff){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'](_0x4043ff);}function selectNotIn(_0x29307a,_0x5dce36,_0x4f4678,_0x8c0bf9,_0x3ab34b){return squel[_0xae79('0xb')]()['field'](_0xae79('0xc'))[_0xae79('0xd')](_0x8c0bf9)[_0xae79('0xe')](_0x5dce36,null,_0x5dce36+_0xae79('0xf')+_0x8c0bf9+'.'+_0x4f4678)[_0xae79('0x10')](_0x8c0bf9+'.'+_0x4f4678+_0xae79('0x11')+_0x29307a+'.'+_0x4f4678)[_0xae79('0x10')](_0x5dce36+_0xae79('0x12')+_0x3ab34b[_0xae79('0xe')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x471fbf,_0x478937){promisesAdditionalPhones=[];return db[_0xae79('0x13')][_0xae79('0x14')]({'raw':!![],'attributes':['id',_0xae79('0x15')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xae79('0x16')](function(_0x4c8f9a){if(_0x4c8f9a!==null){var _0x4e4615=[];for(var _0x101327=0x0;_0x101327<_0x4c8f9a[_0xae79('0x17')];_0x101327++){var _0x4c8a59=_0x4c8f9a[_0x101327];_0x4e4615[_0xae79('0x18')](insertAdditionalPhones(_0x4c8a59));}}Promise['all'](_0x4e4615)[_0xae79('0x16')](function(){_0x471fbf({'val':0x1});});});});}function insertAdditionalPhones(_0x44f55e){return new Promise(function(_0x124745,_0x371944){var _0x3474a0=_0x44f55e['AdditionalPhones'];var _0x432f0d=_0x3474a0[_0xae79('0x19')](';');var _0x348044=[];orderBy=0x0;for(var _0x23fd7d=0x0;_0x23fd7d<_0x432f0d[_0xae79('0x17')];_0x23fd7d++){_0x348044[_0xae79('0x18')](splitAdditionalPhone(_0x44f55e['id'],_0x432f0d[_0x23fd7d]));}Promise['all'](_0x348044)[_0xae79('0x16')](function(){_0x124745({'val':_0x432f0d[_0xae79('0x17')]});});});}function splitAdditionalPhone(_0x27b5fe,_0x533e63){return new Promise(function(_0xb0d047,_0x158ea2){var _0x5b6a8d=_0x533e63[_0xae79('0x19')](':');var _0x2d006d=_0x5b6a8d[0x0];var _0x173ded=_0x5b6a8d[0x1];if(_0x173ded!==''){var _0x3f8409=_0x173ded['split']('|');var _0x42fbbc=[];for(var _0x33f0c5=0x0;_0x33f0c5<_0x3f8409['length'];_0x33f0c5++){if(_0x3f8409[_0x33f0c5]!==''){var _0x5d4a57=_[_0xae79('0x1a')](promisesAdditionalPhones,{'contactId':_0x27b5fe,'phone':_0x3f8409[_0x33f0c5]});if(_0x5d4a57[_0xae79('0x17')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x27b5fe,'contactTypeId':_0x2d006d,'phone':_0x3f8409[_0x33f0c5],'orderBy':orderBy});}}}_0xb0d047({'ok':0x1});}else _0xb0d047({'res':0x0});});}function createAdditionalPhone(_0x1e5101,_0x6a289b,_0x819255,_0x1621e0){var _0x5783e8='';var _0x1e8618='';var _0x504d65=_0x819255[_0xae79('0x19')]('§');_0x5783e8=_0x504d65[0x0];if(_0x504d65['length']==0x2)_0x1e8618=_0x504d65[0x1];return new Promise(function(_0x560e01,_0x43d306){return db['CmContactHasItem'][_0xae79('0x1b')]({'where':{'CmContactId':_0x1e5101,'item':_0x5783e8}})[_0xae79('0x16')](function(_0x480e7a){if(_0x480e7a){return db['CmContactHasItem'][_0xae79('0x1c')]({'ItemTypeId':_0x6a289b,'description':_0x1e8618,'OrderBy':_0x1621e0},{'where':{'CmContactId':_0x1e5101,'item':_0x5783e8}})[_0xae79('0x16')](function(_0x7281ce){_0x560e01({'res':_0xae79('0x1d')});});}else{return db[_0xae79('0x1e')][_0xae79('0x1f')]({'CmContactId':_0x1e5101,'item':_0x5783e8,'description':_0x1e8618,'ItemTypeId':_0x6a289b,'OrderBy':_0x1621e0,'ItemClass':'PHONE'})['then'](function(_0x36a0cf){_0x560e01({'res':'inserted'});});}});});}function insertCmHopper(_0x4693be,_0x34596b,_0x45e222,_0x271a78,_0x2b79ca){var _0x3eaca4=['cm_contacts.phone',_0xae79('0x20'),_0xae79('0x21'),_0xae79('0x22'),_0x34596b+'.'+_0x271a78,'cm_contacts.createdAt',_0xae79('0x23'),_0xae79('0x24'),_0xae79('0x25'),'\x22'+_0x2b79ca+'\x22'];return squel[_0xae79('0x26')]()[_0xae79('0x27')]('cm_hopper')[_0xae79('0x28')]([_0xae79('0xc'),_0xae79('0x29'),'ContactId','ListId',_0x271a78,_0xae79('0x2a'),_0xae79('0x2b'),_0xae79('0x2c'),'UserId',_0xae79('0x2d')],squel[_0xae79('0xb')]()['fields'](_0x3eaca4)[_0xae79('0xd')](_0x34596b)[_0xae79('0xe')](_0xae79('0x2e'),null,'cm_contacts.ListId\x20=\x20'+_0x34596b+_0xae79('0x2f'))[_0xae79('0xe')](_0x45e222,null,_0x45e222+_0xae79('0xf')+_0x34596b+'.'+_0x271a78)[_0xae79('0x10')](_0x34596b+_0xae79('0x30'),_0x4693be)['where'](_0xae79('0x31'),NOW)[_0xae79('0x10')](_0xae79('0x32'),selectNotIn(_0x34596b,_0x45e222,_0x271a78,_0xae79('0x33'),['\x22always\x22',_0xae79('0x34')]))[_0xae79('0x10')](_0xae79('0x32'),selectNotIn(_0x34596b,_0x45e222,_0x271a78,'cm_hopper',[_0xae79('0x35')])))[_0xae79('0x36')]();}function insertCmHopperBlack(_0x39fbce,_0x57658f,_0x19d6f1,_0xa6879){var _0x4d4de3=[_0xae79('0x37'),_0xae79('0x21'),_0xae79('0x22'),_0x57658f+'.'+_0xa6879,'cm_contacts.createdAt',_0xae79('0x23')];return squel[_0xae79('0x26')]()[_0xae79('0x27')](_0xae79('0x38'))[_0xae79('0x28')]([_0xae79('0xc'),_0xae79('0x39'),_0xae79('0x3a'),_0xa6879,'createdAt',_0xae79('0x2b')],squel['select']()[_0xae79('0x3b')](_0x4d4de3)[_0xae79('0xd')](_0x57658f)[_0xae79('0xe')](_0xae79('0x2e'),null,_0xae79('0x3c')+_0x57658f+_0xae79('0x2f'))['join'](_0x19d6f1,null,_0x19d6f1+_0xae79('0xf')+_0x57658f+'.'+_0xa6879)[_0xae79('0x10')](_0x57658f+_0xae79('0x30'),_0x39fbce)['where'](_0xae79('0x31'),NOW)['where'](_0xae79('0x32'),squel[_0xae79('0xb')]()[_0xae79('0x3d')](_0xae79('0xc'))[_0xae79('0xd')]('cm_hopper_black')[_0xae79('0x10')](_0xae79('0x3e'),_0x39fbce)[_0xae79('0x10')](_0xa6879+_0xae79('0x3f'),_0x57658f+'.'+_0xa6879)))[_0xae79('0x36')]();}function insertCmHopperAdditionalPhones(_0x205850){var _0x4edb81=[_0xae79('0x40'),'cm_contact_has_items.item',_0xae79('0x41'),_0xae79('0x42'),'cm_contact_has_items.updatedAt'];return squel[_0xae79('0x26')]()[_0xae79('0x27')]('cm_hopper_additional_phones')['fromQuery']([_0xae79('0x43'),_0xae79('0xc'),'OrderBy','createdAt',_0xae79('0x2b')],squel[_0xae79('0xb')]()[_0xae79('0x3b')](_0x4edb81)[_0xae79('0xd')]('cm_hopper')['join']('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xae79('0xe')](_0xae79('0x44'),null,_0xae79('0x45'))[_0xae79('0x10')](_0xae79('0x46'),_0x205850)[_0xae79('0x10')](_0xae79('0x31'),NOW))[_0xae79('0x36')]();}function insertCmContact(_0x4fb503,_0x232654,_0x18f618,_0x552b48){var _0x17c561=_[_0xae79('0x47')](_[_0xae79('0x48')](_0x552b48),['ListId',_0xae79('0x49'),_0xae79('0x2a'),_0xae79('0x2b')]);return squel[_0xae79('0x26')]()['into']('cm_contacts')[_0xae79('0x28')](_0x17c561,squel[_0xae79('0xb')]()['fields'](_0x17c561)[_0xae79('0xd')](_0x232654)['where']('('+_0x18f618[_0xae79('0xe')](',')+_0xae79('0x4a'),squel[_0xae79('0xb')]()[_0xae79('0x3b')](_0x18f618)['from'](_0xae79('0x2e'))[_0xae79('0x10')]('ListId\x20=\x20?',_0x4fb503)[_0xae79('0x10')](_0xae79('0x4b')))[_0xae79('0x10')](_0xae79('0x4c'),squel['select']()[_0xae79('0x3d')](_0xae79('0x4d'),_0xae79('0x4e'))['from'](_0x232654)[_0xae79('0x4f')](_0x18f618['join'](','))))[_0xae79('0x36')]();}function handleStop(){logger[_0xae79('0x50')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x5913c3){logger['error'](_0x5913c3[_0xae79('0x51')]);process['exit'](0x1);}function handleError(_0x22a1cf,_0xfa8720){stats[_0xae79('0x52')][_0xae79('0x18')]({'name':_0xfa8720['code'],'message':_0xfa8720[_0xae79('0x51')],'row':_0x22a1cf});}function handleQuery(_0x49b890){logger[_0xae79('0x50')](_0x49b890);return db['sequelize'][_0xae79('0x53')](_0x49b890)['spread'](function(_0x55ca9b){results[_0xae79('0x18')](_0x55ca9b);})['catch'](function(_0x36ff25){logger[_0xae79('0x54')](_0x36ff25['message']);});}function main(_0x5923a0,_0x3f86bf,_0x4cfb05,_0x29ce2e){logger[_0xae79('0x50')]('main',_0x5923a0,JSON['stringify'](_0x3f86bf));process[_0xae79('0x55')]('start');var _0x2d372c=_0x3f86bf[_0xae79('0x56')];var _0x3b49ed=_[_0xae79('0x57')](_0x2d372c);var _0x38403a=_0x3f86bf[_0xae79('0x58')];var _0x113144=path[_0xae79('0xe')](config[_0xae79('0x59')],_0xae79('0x5a'),_0x38403a+'.csv');logger['info']('body',_0x3f86bf);db[_0xae79('0x5b')][_0xae79('0x14')]({'raw':!![],'attributes':['id','name']})['then'](function(_0x10ad25){for(var _0x2e004c=0x0;_0x2e004c<_0x10ad25['length'];_0x2e004c++){if(_0x10ad25[_0x2e004c][_0xae79('0x5c')]in _0x2d372c){contactItemTypes[_0xae79('0x18')](_0x10ad25[_0x2e004c]);delete _0x3b49ed[_0x10ad25[_0x2e004c]['name']];hasAdditionalPhones=!![];}for(var _0x48ba34 in _0x2d372c){if(_0x10ad25[_0x2e004c]['name']+_0xae79('0x5d')===_0x48ba34){phoneDescriptions[_0xae79('0x18')]({'itemTypeId':_0x10ad25[_0x2e004c]['id'],'description':_0x48ba34});delete _0x3b49ed[_0x48ba34];}}}if(hasAdditionalPhones)_0x3b49ed[_0xae79('0x15')]='';var _0xdf0f68=_[_0xae79('0x48')](_0x3b49ed)[_0xae79('0xe')]();logger[_0xae79('0x50')]('header',_0xdf0f68);fs[_0xae79('0x5e')](_0x113144,_0xdf0f68+'\x0a');Papa[_0xae79('0x5f')](fs[_0xae79('0x60')](_0x5923a0),{'header':!![],'skipEmptyLines':!![],'step':function(_0x132f09,_0x47b289){try{for(var _0x10d34d=0x0,_0x53454a=[];_0x10d34d<_0x132f09[_0xae79('0x61')]['length'];_0x10d34d++){stats['rows']+=0x1;if(_0x132f09[_0xae79('0x52')][_0x10d34d]){handleError(_0x132f09[_0xae79('0x61')][_0x10d34d],_0x132f09[_0xae79('0x52')][_0x10d34d]);}else{var _0x486f37=[];var _0x39204d=[];var _0x43d3be={};for(var _0x3a4daa in _0x2d372c){let _0x4e271b=contactItemTypes[_0xae79('0x62')](_0x4259ac=>_0x4259ac[_0xae79('0x5c')]===_0x3a4daa);let _0xcfe968=contactItemTypes[_0xae79('0x62')](_0x1c28e6=>_0x1c28e6['name']+'_description'===_0x3a4daa);if(_[_0xae79('0x63')](_0x4e271b)&&_['isNil'](_0xcfe968)){if(_0x2d372c[_0xae79('0x64')](_0x3a4daa)){if(_0x132f09[_0xae79('0x61')][_0x10d34d][_0x2d372c[_0x3a4daa]]){var _0x2dc106=_[_0xae79('0x65')](_0x132f09['data'][_0x10d34d][_0x2d372c[_0x3a4daa]][_0xae79('0x66')](/"/g,'\x27'));switch(_0x3a4daa){case _0xae79('0x29'):var _0x544f8b=moment(_0x2dc106,_0xae79('0x67'),!![]);if(_0x544f8b[_0xae79('0x68')]()){_0x53454a['push']('\x22'+_0x2dc106+'\x22');}else{_0x486f37[_0xae79('0x18')](_0xae79('0x69'));}break;case _0xae79('0x2c'):var _0x47e754=parseInt(_0x2dc106);_0x2dc106=_['isNaN'](_0x47e754)||_0x47e754<0x0||_0x47e754>0x4?_0x29ce2e?0x3:0x2:_0x47e754;_0x53454a[_0xae79('0x18')]('\x22'+_0x2dc106+'\x22');break;case _0xae79('0x6a'):var _0x1f015e=parseInt(_0x2dc106);if(_[_0xae79('0x6b')](_0x1f015e)&&_['includes'](_0x4cfb05,_0x1f015e)){_0x53454a[_0xae79('0x18')]('\x22'+_0x1f015e+'\x22');}else{_0x486f37['push'](_0xae79('0x6c'));}break;case _0xae79('0x6d'):if(isEmail(_0x2dc106)){_0x53454a['push']('\x22'+_0x2dc106+'\x22');}else{_0x486f37[_0xae79('0x18')](_0xae79('0x6e'));}break;case'dateOfBirth':var _0x2b99a3=moment(_0x2dc106,_0xae79('0x6f'),!![]);if(_0x2b99a3[_0xae79('0x68')]()){_0x53454a[_0xae79('0x18')]('\x22'+_0x2dc106+'\x22');}else{_0x486f37[_0xae79('0x18')](_0xae79('0x70'));}break;default:_0x53454a[_0xae79('0x18')]('\x22'+_0x2dc106+'\x22');}}else{switch(_0x3a4daa){case _0xae79('0x71'):case _0xae79('0xc'):_0x486f37[_0xae79('0x18')](_0x3a4daa+_0xae79('0x72'));break;default:_0x53454a[_0xae79('0x18')]('\x22\x22');}}}}else{var _0x587ffd='';if(!_['isNil'](_0x4e271b)){if(!_0x43d3be[_0xae79('0x64')](_0x4e271b['id'])){for(var _0x3977ac=0x0;_0x3977ac<_0x2d372c[_0x3a4daa][_0xae79('0x17')];_0x3977ac++){var _0x2dc106=_[_0xae79('0x65')](_0x132f09[_0xae79('0x61')][_0x10d34d][_0x2d372c[_0x3a4daa][_0x3977ac]]['replace'](/"/g,'\x27'));var _0x4d1c87=phoneDescriptions[_0xae79('0x62')](_0xa4ca14=>_0xa4ca14[_0xae79('0x73')]===_0x4e271b['id']);if(!_[_0xae79('0x63')](_0x4d1c87)){var _0x272d84=_[_0xae79('0x65')](_0x132f09[_0xae79('0x61')][_0x10d34d][_0x2d372c[_0x4d1c87['description']][0x0]][_0xae79('0x66')](/"/g,'\x27'));if(!_[_0xae79('0x63')](_0x272d84))_0x2dc106=_0x2dc106+'§'+_0x272d84;}if(_0x587ffd=='')_0x587ffd=_0x2dc106;else _0x587ffd+='|'+_0x2dc106;}_0x39204d[_0xae79('0x18')](_0x4e271b['id']+':'+_0x587ffd);_0x43d3be[_0x4e271b['id']]=0x1;}}}}if(hasAdditionalPhones){_0x53454a[_0xae79('0x18')]('\x22'+_0x39204d[_0xae79('0xe')](';')+'\x22');}if(_0x486f37[_0xae79('0x17')]){handleError(_0x132f09[_0xae79('0x61')][_0x10d34d],{'code':'SystemRow','message':_0x486f37[_0xae79('0xe')]()});}else{fs['appendFileSync'](_0x113144,_0x53454a[_0xae79('0xe')]()+'\x0a');}_0x53454a=[];}if(!(stats[_0xae79('0x74')]%0xc8)){socket[_0xae79('0x75')](_0xae79('0x76')+_0x38403a,stats);stats[_0xae79('0x52')]=[];}}if(stopped){logger[_0xae79('0x50')](_0xae79('0x77'));_0x47b289[_0xae79('0x78')]();}}catch(_0x538569){handleError(_0x132f09[_0xae79('0x61')][_0x10d34d],{'code':'SystemError','message':_0x538569[_0xae79('0x51')]});logger[_0xae79('0x54')](_0xae79('0x79'),_0x538569[_0xae79('0x51')]);}},'complete':function(){try{var _0x4f2921=[];var _0x479b5f=_0xae79('0x2e');if(_0x3f86bf[_0xae79('0x7a')]&&_0x3f86bf[_0xae79('0x7a')]['length']){_0x479b5f=_0xae79('0x7b')+_0x38403a;_0x4f2921[_0xae79('0x18')](_0xae79('0x7c')+_0x479b5f+'\x20LIKE\x20cm_contacts;');}logger[_0xae79('0x50')](_0xae79('0x7d'),contactItemTypes[_0xae79('0x17')]);var _0x707284=util['format'](_0xae79('0x7e'),_0x113144,_0x479b5f,_0xdf0f68,_0x3f86bf[_0xae79('0x3a')],_0x3f86bf[_0xae79('0x49')]||null,NOW,NOW);if(_[_0xae79('0x63')](_0x2d372c[_0xae79('0x29')])){_0x707284+=_0xae79('0x7f');}_0x4f2921[_0xae79('0x18')](_0x707284);if(_0x3f86bf[_0xae79('0x7a')]&&_0x3f86bf[_0xae79('0x7a')][_0xae79('0x17')]){_0x4f2921['push'](insertCmContact(_0x3f86bf[_0xae79('0x3a')],_0x479b5f,_0x3f86bf['duplicates'],_0x2d372c));_0x4f2921['push'](_0xae79('0x80')+_0x479b5f+';');}BPromise['each'](_0x4f2921,handleQuery)['then'](function(_0x317b7d){BPromise[_0xae79('0x81')]([handleAdditionalPhones()])[_0xae79('0x16')](function(){_0x4f2921=[];for(var _0x1c03e8=0x0;_0x1c03e8\x20\x20','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available'];(function(_0x52b58b,_0x1e614c){var _0x764787=function(_0x561de9){while(--_0x561de9){_0x52b58b['push'](_0x52b58b['shift']());}};_0x764787(++_0x1e614c);}(_0xe706,0xa3));var _0x6e70=function(_0x2f16e5,_0x2e75e0){_0x2f16e5=_0x2f16e5-0x0;var _0x5d082a=_0xe706[_0x2f16e5];return _0x5d082a;};'use strict';var fs=require('fs');var path=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var Papa=require(_0x6e70('0x2'));var util=require('util');var BPromise=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var squel=require(_0x6e70('0x5'));var Redis=require(_0x6e70('0x6'));var db=require(_0x6e70('0x7'))['db'];var config=require(_0x6e70('0x8'));var logger=require(_0x6e70('0x9'))(_0x6e70('0xa'));config[_0x6e70('0xb')]=_[_0x6e70('0xc')](config[_0x6e70('0xb')],{'host':_0x6e70('0xd'),'port':0x18eb});var socket=require(_0x6e70('0xe'))(new Redis(config[_0x6e70('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x6e70('0xf')](_0x6e70('0x10'));var tempTableName=_0x6e70('0x11')+moment()[_0x6e70('0xf')](_0x6e70('0x12'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x463853){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))*$/[_0x6e70('0x13')](_0x463853);}function selectNotIn(_0x3f474a,_0x37b3e0,_0x4600f9,_0x5b3d07,_0x47f6b2){return squel[_0x6e70('0x14')]()[_0x6e70('0x15')](_0x6e70('0x16'))[_0x6e70('0x17')](_0x5b3d07)[_0x6e70('0x18')](_0x37b3e0,null,_0x37b3e0+_0x6e70('0x19')+_0x5b3d07+'.'+_0x4600f9)[_0x6e70('0x1a')](_0x5b3d07+'.'+_0x4600f9+_0x6e70('0x1b')+_0x3f474a+'.'+_0x4600f9)['where'](_0x37b3e0+'.dialCheckDuplicateType\x20IN\x20('+_0x47f6b2['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x257e81,_0x5a37a6){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x6e70('0x1c')](_0x6e70('0x1d')+tempTableName)['spread'](function(_0x24f3ac){if(_0x24f3ac!==null){var _0x5c3fe7=[];for(var _0x2efc0f=0x0;_0x2efc0f<_0x24f3ac[_0x6e70('0x1e')];_0x2efc0f++){var _0x4ca554=_0x24f3ac[_0x2efc0f];if(!_['isNil'](_0x4ca554[_0x6e70('0x16')])){if(!_['isNil'](_0x4ca554[_0x6e70('0x1f')]))_0x5c3fe7[_0x6e70('0x20')](insertAdditionalPhones(_0x4ca554));promisesContact['push']({'contact':_0x4ca554});}}}Promise['all'](_0x5c3fe7)[_0x6e70('0x21')](function(){_0x257e81({'val':0x1});});})[_0x6e70('0x22')](function(_0x2368eb){logger[_0x6e70('0x23')](_0x2368eb[_0x6e70('0x24')]);});});}function insertAdditionalPhones(_0xcdf9f2){return new Promise(function(_0x1b2453,_0x44a49f){var _0x29326f=_0xcdf9f2[_0x6e70('0x1f')];if(_['isNil'](_0x29326f))_0x44a49f({'val':0x0});else{var _0x228350=_0x29326f[_0x6e70('0x25')](';');var _0x27b294=[];orderBy=0x0;for(var _0x502b2d=0x0;_0x502b2d<_0x228350[_0x6e70('0x1e')];_0x502b2d++){_0x27b294[_0x6e70('0x20')](splitAdditionalPhone(_0xcdf9f2['id'],_0x228350[_0x502b2d]));}Promise[_0x6e70('0x26')](_0x27b294)['then'](function(){_0x1b2453({'val':_0x228350[_0x6e70('0x1e')]});});}});}function splitAdditionalPhone(_0x538b9c,_0x50aec2){return new Promise(function(_0x4e97c7,_0x41e352){var _0x19c5ae=_0x50aec2['split'](':');var _0x3ecdf1=_0x19c5ae[0x0];var _0x1196ed=_0x19c5ae[0x1];if(_0x1196ed!==''){var _0x5f268f=_0x1196ed[_0x6e70('0x25')]('|');var _0x67fb43=[];for(var _0x2bb231=0x0;_0x2bb231<_0x5f268f['length'];_0x2bb231++){if(_0x5f268f[_0x2bb231]!==''){var _0x54a5fe=_[_0x6e70('0x27')](promisesAdditionalPhones,{'contactId':_0x538b9c,'phone':_0x5f268f[_0x2bb231]});if(_0x54a5fe[_0x6e70('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0x6e70('0x20')]({'contactId':_0x538b9c,'contactTypeId':_0x3ecdf1,'phone':_0x5f268f[_0x2bb231],'orderBy':orderBy});}}}_0x4e97c7({'ok':0x1});}else _0x4e97c7({'res':0x0});});}function createAdditionalPhone(_0x114344,_0x43fee0,_0x5d772a,_0x1952ea){var _0x406f29='';var _0xecf336='';var _0x2864a0=_0x5d772a[_0x6e70('0x25')]('§');_0x406f29=_0x2864a0[0x0];if(_0x2864a0[_0x6e70('0x1e')]==0x2)_0xecf336=_0x2864a0[0x1];return new Promise(function(_0x3f78d2,_0x24114a){return db[_0x6e70('0x28')][_0x6e70('0x29')]({'where':{'CmContactId':_0x114344,'item':_0x406f29}})['then'](function(_0x1b27d8){if(_0x1b27d8){return db['CmContactHasItem'][_0x6e70('0x2a')]({'ItemTypeId':_0x43fee0,'description':_0xecf336,'OrderBy':_0x1952ea},{'where':{'CmContactId':_0x114344,'item':_0x406f29}})['then'](function(_0xdd7cc1){_0x3f78d2({'res':_0x6e70('0x2b')});});}else{return db[_0x6e70('0x28')]['create']({'CmContactId':_0x114344,'item':_0x406f29,'ItemTypeId':_0x43fee0,'description':_0xecf336,'OrderBy':_0x1952ea,'ItemClass':_0x6e70('0x2c')})[_0x6e70('0x21')](function(_0x5780a1){_0x3f78d2({'res':_0x6e70('0x2d')});});}});});}function updateContact(_0x154925){return new Promise(function(_0x52b457,_0x10d8f6){var _0x3665a1=_0x154925['id'];delete _0x154925['id'];return db[_0x6e70('0x2e')][_0x6e70('0x2a')](_0x154925,{'where':{'id':_0x3665a1}})[_0x6e70('0x21')](function(_0x1e3e76){updatedRows+=0x1;return db[_0x6e70('0x2f')][_0x6e70('0x2a')]({'phone':_0x154925[_0x6e70('0x16')]},{'where':{'ContactId':_0x3665a1}})[_0x6e70('0x21')](function(_0x4d32d8){_0x52b457({'ret':'OK'});});});});}function insertCmHopper(_0x3b9c06,_0x4795a0,_0x23cd1a,_0x3222a2,_0x98c683){var _0x32d12d=[_0x6e70('0x30'),_0x6e70('0x31'),_0x6e70('0x32'),_0x6e70('0x33'),_0x4795a0+'.'+_0x3222a2,_0x6e70('0x34'),_0x6e70('0x35'),_0x6e70('0x36'),_0x6e70('0x37'),'\x22'+_0x98c683+'\x22'];return squel[_0x6e70('0x38')]()['into']('cm_hopper')['fromQuery']([_0x6e70('0x16'),_0x6e70('0x39'),_0x6e70('0x3a'),_0x6e70('0x3b'),_0x3222a2,_0x6e70('0x3c'),_0x6e70('0x3d'),'priority',_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x14')]()[_0x6e70('0x40')](_0x32d12d)[_0x6e70('0x17')](_0x4795a0)[_0x6e70('0x18')](_0x6e70('0x41'),null,_0x6e70('0x42')+_0x4795a0+'.CmListId')[_0x6e70('0x18')](_0x23cd1a,null,_0x23cd1a+_0x6e70('0x19')+_0x4795a0+'.'+_0x3222a2)[_0x6e70('0x1a')](_0x4795a0+_0x6e70('0x43'),_0x3b9c06)[_0x6e70('0x1a')](_0x6e70('0x44'),NOW)[_0x6e70('0x1a')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4795a0,_0x23cd1a,_0x3222a2,'cm_hopper',['\x22always\x22',_0x6e70('0x45')]))[_0x6e70('0x1a')](_0x6e70('0x46'),selectNotIn(_0x4795a0,_0x23cd1a,_0x3222a2,_0x6e70('0x47'),[_0x6e70('0x48')])))['toString']();}function insertCmHopperBlack(_0x225d44,_0x2a58d7,_0x2a2aca,_0x52b197){var _0x544ad0=['cm_contacts.phone',_0x6e70('0x32'),'cm_contacts.ListId',_0x2a58d7+'.'+_0x52b197,_0x6e70('0x34'),_0x6e70('0x35')];return squel[_0x6e70('0x38')]()[_0x6e70('0x49')]('cm_hopper_black')[_0x6e70('0x4a')](['phone',_0x6e70('0x3a'),_0x6e70('0x3b'),_0x52b197,_0x6e70('0x3c'),_0x6e70('0x3d')],squel['select']()[_0x6e70('0x40')](_0x544ad0)[_0x6e70('0x17')](_0x2a58d7)[_0x6e70('0x18')](_0x6e70('0x41'),null,_0x6e70('0x42')+_0x2a58d7+_0x6e70('0x4b'))[_0x6e70('0x18')](_0x2a2aca,null,_0x2a2aca+'.id\x20=\x20'+_0x2a58d7+'.'+_0x52b197)[_0x6e70('0x1a')](_0x2a58d7+_0x6e70('0x43'),_0x225d44)[_0x6e70('0x1a')](_0x6e70('0x44'),NOW)[_0x6e70('0x1a')](_0x6e70('0x46'),squel[_0x6e70('0x14')]()['field'](_0x6e70('0x16'))['from'](_0x6e70('0x4c'))[_0x6e70('0x1a')]('ListId\x20=\x20?',_0x225d44)['where'](_0x52b197+_0x6e70('0x4d'),_0x2a58d7+'.'+_0x52b197)))[_0x6e70('0x4e')]();}function insertCmHopperAdditionalPhones(_0x18fa40){var _0x587f04=['cm_hopper.id',_0x6e70('0x4f'),_0x6e70('0x50'),_0x6e70('0x51'),_0x6e70('0x52')];return squel[_0x6e70('0x38')]()[_0x6e70('0x49')]('cm_hopper_additional_phones')[_0x6e70('0x4a')]([_0x6e70('0x53'),_0x6e70('0x16'),_0x6e70('0x54'),_0x6e70('0x3c'),'updatedAt'],squel['select']()[_0x6e70('0x40')](_0x587f04)[_0x6e70('0x17')](_0x6e70('0x47'))[_0x6e70('0x18')](_0x6e70('0x41'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x6e70('0x18')](_0x6e70('0x55'),null,_0x6e70('0x56'))[_0x6e70('0x1a')](_0x6e70('0x57'),_0x18fa40)['where'](_0x6e70('0x44'),NOW))[_0x6e70('0x4e')]();}function insertCmContact(_0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d){var _0x5d2e29=_[_0x6e70('0x58')](_[_0x6e70('0x59')](_0x3fd03d),['ListId',_0x6e70('0x5a'),_0x6e70('0x3c'),'updatedAt']);return squel[_0x6e70('0x38')]()[_0x6e70('0x49')](_0x6e70('0x41'))[_0x6e70('0x4a')](_0x5d2e29,squel[_0x6e70('0x14')]()['fields'](_0x5d2e29)[_0x6e70('0x17')](_0x3fb0d3)[_0x6e70('0x1a')]('('+_0x8ef4f7[_0x6e70('0x18')](',')+_0x6e70('0x5b'),squel[_0x6e70('0x14')]()[_0x6e70('0x40')](_0x8ef4f7)[_0x6e70('0x17')](_0x6e70('0x41'))[_0x6e70('0x1a')](_0x6e70('0x5c'),_0x2c20d3))[_0x6e70('0x1a')](_0x6e70('0x5d'),squel[_0x6e70('0x14')]()[_0x6e70('0x15')](_0x6e70('0x5e'),_0x6e70('0x5f'))[_0x6e70('0x17')](_0x3fb0d3)[_0x6e70('0x60')](_0x8ef4f7[_0x6e70('0x18')](','))))[_0x6e70('0x4e')]();}function handleStop(){logger['info'](_0x6e70('0x61'));stopped=!![];}function handleUncaughtException(_0x4434dd){logger[_0x6e70('0x23')](_0x4434dd[_0x6e70('0x24')]);process[_0x6e70('0x62')](0x1);}function handleError(_0x3880dd,_0x5b4d5d){stats[_0x6e70('0x63')][_0x6e70('0x20')]({'name':_0x5b4d5d['code'],'message':_0x5b4d5d[_0x6e70('0x24')],'row':_0x3880dd});}function handleQuery(_0x692205){logger[_0x6e70('0x64')](_0x692205);return db['sequelize']['query'](_0x692205)[_0x6e70('0x65')](function(_0xd6bccd){results[_0x6e70('0x20')](_0xd6bccd);})[_0x6e70('0x22')](function(_0x10d299){logger[_0x6e70('0x23')](_0x10d299[_0x6e70('0x24')]);});}function main(_0x57bfe5,_0x4d47e1,_0x2c8dc6,_0x1e23c5){logger[_0x6e70('0x64')](_0x6e70('0x66'),_0x57bfe5,JSON['stringify'](_0x4d47e1));process['send'](_0x6e70('0x67'));var _0x4e5545=_0x4d47e1['binding'];var _0x57eaa1=_[_0x6e70('0x68')](_0x4e5545);var _0x47fbed=_0x4d47e1[_0x6e70('0x69')];var _0x23900b=path[_0x6e70('0x18')](config[_0x6e70('0x6a')],_0x6e70('0x6b'),_0x47fbed+_0x6e70('0x6c'));logger[_0x6e70('0x64')](_0x6e70('0x6d'),_0x4d47e1);db['ContactItemType'][_0x6e70('0x6e')]({'raw':!![],'attributes':['id',_0x6e70('0x6f')]})[_0x6e70('0x21')](function(_0x346c79){for(var _0x7aa313=0x0;_0x7aa313<_0x346c79['length'];_0x7aa313++){if(_0x346c79[_0x7aa313]['name']in _0x4e5545){contactItemTypes['push'](_0x346c79[_0x7aa313]);delete _0x57eaa1[_0x346c79[_0x7aa313][_0x6e70('0x6f')]];hasAdditionalPhones=!![];}for(var _0xd91b9 in _0x4e5545){if(_0x346c79[_0x7aa313][_0x6e70('0x6f')]+'_description'===_0xd91b9){phoneDescriptions['push']({'itemTypeId':_0x346c79[_0x7aa313]['id'],'description':_0xd91b9});delete _0x57eaa1[_0xd91b9];}}}if(hasAdditionalPhones)_0x57eaa1[_0x6e70('0x1f')]='';var _0x3dae08=_[_0x6e70('0x59')](_0x57eaa1)[_0x6e70('0x18')]();logger[_0x6e70('0x64')](_0x6e70('0x70'),_0x3dae08);fs['writeFileSync'](_0x23900b,_0x3dae08+'\x0a');Papa[_0x6e70('0x71')](fs[_0x6e70('0x72')](_0x57bfe5),{'header':!![],'skipEmptyLines':!![],'step':function(_0x30d11b,_0x82a9a){try{for(var _0x515c0c=0x0,_0xce964b=[];_0x515c0c<_0x30d11b['data']['length'];_0x515c0c++){stats[_0x6e70('0x73')]+=0x1;if(_0x30d11b[_0x6e70('0x63')][_0x515c0c]){handleError(_0x30d11b[_0x6e70('0x74')][_0x515c0c],_0x30d11b[_0x6e70('0x63')][_0x515c0c]);}else{var _0x326584=[];var _0x2be0fc=[];var _0x4b5b19={};for(var _0x370eeb in _0x4e5545){let _0x152003=contactItemTypes[_0x6e70('0x75')](_0x18e64c=>_0x18e64c[_0x6e70('0x6f')]===_0x370eeb);let _0x13c092=contactItemTypes[_0x6e70('0x75')](_0xd9b4a9=>_0xd9b4a9[_0x6e70('0x6f')]+_0x6e70('0x76')===_0x370eeb);if(_['isNil'](_0x152003)&&_[_0x6e70('0x77')](_0x13c092)){if(_0x4e5545[_0x6e70('0x78')](_0x370eeb)){if(_0x30d11b[_0x6e70('0x74')][_0x515c0c][_0x4e5545[_0x370eeb]]){var _0x2e8ed3=_['trim'](_0x30d11b[_0x6e70('0x74')][_0x515c0c][_0x4e5545[_0x370eeb]][_0x6e70('0x79')](/"/g,'\x27'));switch(_0x370eeb){case _0x6e70('0x39'):var _0x14bb74=moment(_0x2e8ed3,_0x6e70('0x10'),!![]);if(_0x14bb74['isValid']()){_0xce964b['push']('\x22'+_0x2e8ed3+'\x22');}else{_0x326584[_0x6e70('0x20')](_0x6e70('0x7a'));}break;case'priority':var _0x58666a=parseInt(_0x2e8ed3);_0x2e8ed3=_[_0x6e70('0x7b')](_0x58666a)||_0x58666a<0x0||_0x58666a>0x4?_0x1e23c5?0x3:0x2:_0x58666a;_0xce964b[_0x6e70('0x20')]('\x22'+_0x2e8ed3+'\x22');break;case _0x6e70('0x3e'):var _0x3b01c9=parseInt(_0x2e8ed3);if(_[_0x6e70('0x7c')](_0x3b01c9)&&_[_0x6e70('0x7d')](_0x2c8dc6,_0x3b01c9)){_0xce964b[_0x6e70('0x20')]('\x22'+_0x3b01c9+'\x22');}else{_0x326584[_0x6e70('0x20')](_0x6e70('0x7e'));}break;case _0x6e70('0x7f'):if(isEmail(_0x2e8ed3)){_0xce964b[_0x6e70('0x20')]('\x22'+_0x2e8ed3+'\x22');}else{_0x326584[_0x6e70('0x20')](_0x6e70('0x80'));}break;case'dateOfBirth':var _0x5b3cb0=moment(_0x2e8ed3,_0x6e70('0x81'),!![]);if(_0x5b3cb0['isValid']()){_0xce964b[_0x6e70('0x20')]('\x22'+_0x2e8ed3+'\x22');}else{_0x326584['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0xce964b[_0x6e70('0x20')]('\x22'+_0x2e8ed3+'\x22');}}else{switch(_0x370eeb){case'firstName':case'phone':_0x326584[_0x6e70('0x20')](_0x370eeb+_0x6e70('0x82'));break;default:_0xce964b[_0x6e70('0x20')]('\x22\x22');}}}}else{var _0x4e9fda='';if(!_['isNil'](_0x152003)){if(!_0x4b5b19['hasOwnProperty'](_0x152003['id'])){for(var _0x3e7be7=0x0;_0x3e7be7<_0x4e5545[_0x370eeb]['length'];_0x3e7be7++){var _0x2e8ed3=_[_0x6e70('0x83')](_0x30d11b[_0x6e70('0x74')][_0x515c0c][_0x4e5545[_0x370eeb][_0x3e7be7]][_0x6e70('0x79')](/"/g,'\x27'));var _0x329068=phoneDescriptions[_0x6e70('0x75')](_0x214a8f=>_0x214a8f['itemTypeId']===_0x152003['id']);if(!_[_0x6e70('0x77')](_0x329068)){var _0x2493b0=_[_0x6e70('0x83')](_0x30d11b['data'][_0x515c0c][_0x4e5545[_0x329068[_0x6e70('0x84')]][0x0]][_0x6e70('0x79')](/"/g,'\x27'));if(!_[_0x6e70('0x77')](_0x2493b0))_0x2e8ed3=_0x2e8ed3+'§'+_0x2493b0;}if(_0x4e9fda=='')_0x4e9fda=_0x2e8ed3;else _0x4e9fda+='|'+_0x2e8ed3;}_0x2be0fc[_0x6e70('0x20')](_0x152003['id']+':'+_0x4e9fda);_0x4b5b19[_0x152003['id']]=0x1;}}}}if(hasAdditionalPhones){_0xce964b[_0x6e70('0x20')]('\x22'+_0x2be0fc[_0x6e70('0x18')](';')+'\x22');}if(_0x326584[_0x6e70('0x1e')]){handleError(_0x30d11b[_0x6e70('0x74')][_0x515c0c],{'code':_0x6e70('0x85'),'message':_0x326584['join']()});}else{fs[_0x6e70('0x86')](_0x23900b,_0xce964b[_0x6e70('0x18')]()+'\x0a');}_0xce964b=[];}if(!(stats['rows']%0xc8)){socket[_0x6e70('0x87')](_0x6e70('0x88')+_0x47fbed,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x6e70('0x89'));_0x82a9a['abort']();}}catch(_0x154c8a){handleError(_0x30d11b['data'][_0x515c0c],{'code':_0x6e70('0x8a'),'message':_0x154c8a[_0x6e70('0x24')]});logger[_0x6e70('0x23')](_0x6e70('0x8b'),_0x154c8a[_0x6e70('0x24')]);}},'complete':function(){try{var _0x3d44fd=[];var _0x3f985f=tempTableName;_0x3d44fd['push']('CREATE\x20TABLE\x20'+_0x3f985f+_0x6e70('0x8c'));logger['info'](_0x6e70('0x8d'),contactItemTypes[_0x6e70('0x1e')]);var _0x28e5b1=util[_0x6e70('0xf')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x23900b,_0x3f985f,_0x3dae08,_0x4d47e1[_0x6e70('0x3b')],_0x4d47e1['CompanyId']||null,NOW,NOW);if(_[_0x6e70('0x77')](_0x4e5545[_0x6e70('0x39')])){_0x28e5b1+=_0x6e70('0x8e');}_0x3d44fd[_0x6e70('0x20')](_0x28e5b1);BPromise[_0x6e70('0x8f')](_0x3d44fd,handleQuery)[_0x6e70('0x21')](function(_0x2c3bf6){BPromise['all']([handleAdditionalPhones()])[_0x6e70('0x21')](function(){_0x3d44fd=[];for(var _0x5b9a97=0x0;_0x5b9a97\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','path','lodash','papaparse','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','format','YYYYMMDDHHmmss','test','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','length','isNil','AdditionalPhones','push','all','then','catch'];(function(_0xe38fdf,_0x26995b){var _0x89e338=function(_0x1c6cac){while(--_0x1c6cac){_0xe38fdf['push'](_0xe38fdf['shift']());}};_0x89e338(++_0x26995b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var fs=require('fs');var path=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var Papa=require(_0x0a9e('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0x0a9e('0x3'));var squel=require('squel');var Redis=require(_0x0a9e('0x4'));var db=require(_0x0a9e('0x5'))['db'];var config=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));config['redis']=_[_0x0a9e('0x9')](config[_0x0a9e('0xa')],{'host':_0x0a9e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x0a9e('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName='cm_contacts_temp_'+moment()[_0x0a9e('0xc')](_0x0a9e('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x307b3e){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))*$/[_0x0a9e('0xe')](_0x307b3e);}function selectNotIn(_0xfeb75b,_0xbd1168,_0x4a4c56,_0x50dfb2,_0x527cdd){return squel['select']()[_0x0a9e('0xf')](_0x0a9e('0x10'))[_0x0a9e('0x11')](_0x50dfb2)[_0x0a9e('0x12')](_0xbd1168,null,_0xbd1168+_0x0a9e('0x13')+_0x50dfb2+'.'+_0x4a4c56)[_0x0a9e('0x14')](_0x50dfb2+'.'+_0x4a4c56+'\x20=\x20'+_0xfeb75b+'.'+_0x4a4c56)[_0x0a9e('0x14')](_0xbd1168+_0x0a9e('0x15')+_0x527cdd[_0x0a9e('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x281129,_0x44dcfd){promisesAdditionalPhones=[];promisesContact=[];return db[_0x0a9e('0x16')]['query'](_0x0a9e('0x17')+tempTableName)['spread'](function(_0x1985b6){if(_0x1985b6!==null){var _0x519dfd=[];for(var _0x16033c=0x0;_0x16033c<_0x1985b6[_0x0a9e('0x18')];_0x16033c++){var _0x48f32d=_0x1985b6[_0x16033c];if(!_[_0x0a9e('0x19')](_0x48f32d['phone'])){if(!_[_0x0a9e('0x19')](_0x48f32d[_0x0a9e('0x1a')]))_0x519dfd[_0x0a9e('0x1b')](insertAdditionalPhones(_0x48f32d));promisesContact[_0x0a9e('0x1b')]({'contact':_0x48f32d});}}}Promise[_0x0a9e('0x1c')](_0x519dfd)[_0x0a9e('0x1d')](function(){_0x281129({'val':0x1});});})[_0x0a9e('0x1e')](function(_0x20559e){logger[_0x0a9e('0x1f')](_0x20559e[_0x0a9e('0x20')]);});});}function insertAdditionalPhones(_0x1c696a){return new Promise(function(_0x105080,_0x4bb1e3){var _0x2c3407=_0x1c696a[_0x0a9e('0x1a')];if(_['isNil'](_0x2c3407))_0x4bb1e3({'val':0x0});else{var _0x20f109=_0x2c3407['split'](';');var _0x588269=[];orderBy=0x0;for(var _0x3a02e1=0x0;_0x3a02e1<_0x20f109[_0x0a9e('0x18')];_0x3a02e1++){_0x588269[_0x0a9e('0x1b')](splitAdditionalPhone(_0x1c696a['id'],_0x20f109[_0x3a02e1]));}Promise[_0x0a9e('0x1c')](_0x588269)['then'](function(){_0x105080({'val':_0x20f109[_0x0a9e('0x18')]});});}});}function splitAdditionalPhone(_0x2fb0e4,_0x3b45bc){return new Promise(function(_0x4d00e6,_0x370d86){var _0x42ac8f=_0x3b45bc[_0x0a9e('0x21')](':');var _0x5ea472=_0x42ac8f[0x0];var _0x59181e=_0x42ac8f[0x1];if(_0x59181e!==''){var _0x197ec0=_0x59181e[_0x0a9e('0x21')]('|');var _0x40c424=[];for(var _0x33161b=0x0;_0x33161b<_0x197ec0['length'];_0x33161b++){if(_0x197ec0[_0x33161b]!==''){var _0x384319=_['filter'](promisesAdditionalPhones,{'contactId':_0x2fb0e4,'phone':_0x197ec0[_0x33161b]});if(_0x384319[_0x0a9e('0x18')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x2fb0e4,'contactTypeId':_0x5ea472,'phone':_0x197ec0[_0x33161b],'orderBy':orderBy});}}}_0x4d00e6({'ok':0x1});}else _0x4d00e6({'res':0x0});});}function createAdditionalPhone(_0x1dc186,_0x34dc65,_0x25fba9,_0x14433c){var _0x140511='';var _0x1538a4='';var _0x11c3b6=_0x25fba9[_0x0a9e('0x21')]('§');_0x140511=_0x11c3b6[0x0];if(_0x11c3b6['length']==0x2)_0x1538a4=_0x11c3b6[0x1];return new Promise(function(_0x3652a7,_0x468813){return db[_0x0a9e('0x22')][_0x0a9e('0x23')]({'where':{'CmContactId':_0x1dc186,'item':_0x140511}})['then'](function(_0x15b200){if(_0x15b200){return db[_0x0a9e('0x22')][_0x0a9e('0x24')]({'ItemTypeId':_0x34dc65,'description':_0x1538a4,'OrderBy':_0x14433c},{'where':{'CmContactId':_0x1dc186,'item':_0x140511}})[_0x0a9e('0x1d')](function(_0x58b06f){_0x3652a7({'res':_0x0a9e('0x25')});});}else{return db[_0x0a9e('0x22')][_0x0a9e('0x26')]({'CmContactId':_0x1dc186,'item':_0x140511,'ItemTypeId':_0x34dc65,'description':_0x1538a4,'OrderBy':_0x14433c,'ItemClass':_0x0a9e('0x27')})['then'](function(_0x426950){_0x3652a7({'res':'inserted'});});}});});}function updateContact(_0x2407f9){return new Promise(function(_0x3ae878,_0x1122db){var _0x33bdb7=_0x2407f9['id'];delete _0x2407f9['id'];return db[_0x0a9e('0x28')]['update'](_0x2407f9,{'where':{'id':_0x33bdb7}})[_0x0a9e('0x1d')](function(_0x46f0a5){updatedRows+=0x1;return db[_0x0a9e('0x29')][_0x0a9e('0x24')]({'phone':_0x2407f9[_0x0a9e('0x10')]},{'where':{'ContactId':_0x33bdb7}})[_0x0a9e('0x1d')](function(_0x332d35){_0x3ae878({'ret':'OK'});});});});}function insertCmHopper(_0x39e565,_0x5583a4,_0x44295a,_0x5e7238,_0x2cc7a0){var _0x14b13f=[_0x0a9e('0x2a'),_0x0a9e('0x2b'),'cm_contacts.id',_0x0a9e('0x2c'),_0x5583a4+'.'+_0x5e7238,_0x0a9e('0x2d'),_0x0a9e('0x2e'),_0x0a9e('0x2f'),'cm_contacts.UserId','\x22'+_0x2cc7a0+'\x22'];return squel['insert']()[_0x0a9e('0x30')]('cm_hopper')[_0x0a9e('0x31')]([_0x0a9e('0x10'),_0x0a9e('0x32'),_0x0a9e('0x33'),'ListId',_0x5e7238,_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36'),'UserId',_0x0a9e('0x37')],squel[_0x0a9e('0x38')]()[_0x0a9e('0x39')](_0x14b13f)['from'](_0x5583a4)['join'](_0x0a9e('0x3a'),null,_0x0a9e('0x3b')+_0x5583a4+'.CmListId')[_0x0a9e('0x12')](_0x44295a,null,_0x44295a+_0x0a9e('0x13')+_0x5583a4+'.'+_0x5e7238)[_0x0a9e('0x14')](_0x5583a4+_0x0a9e('0x3c'),_0x39e565)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x0a9e('0x14')](_0x0a9e('0x3d'),selectNotIn(_0x5583a4,_0x44295a,_0x5e7238,'cm_hopper',[_0x0a9e('0x3e'),_0x0a9e('0x3f')]))[_0x0a9e('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5583a4,_0x44295a,_0x5e7238,_0x0a9e('0x40'),[_0x0a9e('0x3e')])))[_0x0a9e('0x41')]();}function insertCmHopperBlack(_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3){var _0x45a9b8=[_0x0a9e('0x2a'),_0x0a9e('0x42'),_0x0a9e('0x2c'),_0x13cb1f+'.'+_0x2881b3,_0x0a9e('0x2d'),_0x0a9e('0x2e')];return squel[_0x0a9e('0x43')]()[_0x0a9e('0x30')]('cm_hopper_black')['fromQuery']([_0x0a9e('0x10'),_0x0a9e('0x33'),_0x0a9e('0x44'),_0x2881b3,_0x0a9e('0x34'),_0x0a9e('0x35')],squel[_0x0a9e('0x38')]()[_0x0a9e('0x39')](_0x45a9b8)[_0x0a9e('0x11')](_0x13cb1f)[_0x0a9e('0x12')](_0x0a9e('0x3a'),null,_0x0a9e('0x3b')+_0x13cb1f+_0x0a9e('0x45'))['join'](_0xeaa5e5,null,_0xeaa5e5+_0x0a9e('0x13')+_0x13cb1f+'.'+_0x2881b3)[_0x0a9e('0x14')](_0x13cb1f+_0x0a9e('0x3c'),_0x43dd5b)[_0x0a9e('0x14')](_0x0a9e('0x46'),NOW)[_0x0a9e('0x14')](_0x0a9e('0x3d'),squel[_0x0a9e('0x38')]()['field'](_0x0a9e('0x10'))['from'](_0x0a9e('0x47'))[_0x0a9e('0x14')](_0x0a9e('0x48'),_0x43dd5b)['where'](_0x2881b3+_0x0a9e('0x49'),_0x13cb1f+'.'+_0x2881b3)))[_0x0a9e('0x41')]();}function insertCmHopperAdditionalPhones(_0x4774f4){var _0x34aa5a=[_0x0a9e('0x4a'),_0x0a9e('0x4b'),_0x0a9e('0x4c'),'cm_contact_has_items.createdAt',_0x0a9e('0x4d')];return squel[_0x0a9e('0x43')]()[_0x0a9e('0x30')](_0x0a9e('0x4e'))[_0x0a9e('0x31')]([_0x0a9e('0x4f'),_0x0a9e('0x10'),_0x0a9e('0x50'),_0x0a9e('0x34'),'updatedAt'],squel[_0x0a9e('0x38')]()[_0x0a9e('0x39')](_0x34aa5a)['from']('cm_hopper')['join'](_0x0a9e('0x3a'),null,_0x0a9e('0x51'))[_0x0a9e('0x12')](_0x0a9e('0x52'),null,_0x0a9e('0x53'))[_0x0a9e('0x14')](_0x0a9e('0x54'),_0x4774f4)[_0x0a9e('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x53975a,_0x39d77d,_0x204173,_0x14d602){var _0x5bb3ed=_[_0x0a9e('0x55')](_[_0x0a9e('0x56')](_0x14d602),['ListId','CompanyId',_0x0a9e('0x34'),'updatedAt']);return squel[_0x0a9e('0x43')]()['into'](_0x0a9e('0x3a'))[_0x0a9e('0x31')](_0x5bb3ed,squel[_0x0a9e('0x38')]()['fields'](_0x5bb3ed)[_0x0a9e('0x11')](_0x39d77d)[_0x0a9e('0x14')]('('+_0x204173['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x0a9e('0x38')]()[_0x0a9e('0x39')](_0x204173)['from'](_0x0a9e('0x3a'))['where'](_0x0a9e('0x48'),_0x53975a))['where'](_0x0a9e('0x57'),squel['select']()['field']('MIN(id)',_0x0a9e('0x58'))['from'](_0x39d77d)[_0x0a9e('0x59')](_0x204173[_0x0a9e('0x12')](','))))[_0x0a9e('0x41')]();}function handleStop(){logger[_0x0a9e('0x5a')](_0x0a9e('0x5b'));stopped=!![];}function handleUncaughtException(_0x272738){logger[_0x0a9e('0x1f')](_0x272738[_0x0a9e('0x20')]);process['exit'](0x1);}function handleError(_0x1c693e,_0x121cef){stats[_0x0a9e('0x5c')][_0x0a9e('0x1b')]({'name':_0x121cef[_0x0a9e('0x5d')],'message':_0x121cef[_0x0a9e('0x20')],'row':_0x1c693e});}function handleQuery(_0x5d86e9){logger[_0x0a9e('0x5a')](_0x5d86e9);return db[_0x0a9e('0x16')]['query'](_0x5d86e9)[_0x0a9e('0x5e')](function(_0x5cc8fb){results[_0x0a9e('0x1b')](_0x5cc8fb);})['catch'](function(_0x4b3c1a){logger['error'](_0x4b3c1a[_0x0a9e('0x20')]);});}function main(_0x49d231,_0x2244d6,_0x1fc70e,_0x261adb){logger[_0x0a9e('0x5a')](_0x0a9e('0x5f'),_0x49d231,JSON[_0x0a9e('0x60')](_0x2244d6));process['send'](_0x0a9e('0x61'));var _0x5854cc=_0x2244d6[_0x0a9e('0x62')];var _0x1f07cb=_[_0x0a9e('0x63')](_0x5854cc);var _0x5adf8f=_0x2244d6[_0x0a9e('0x64')];var _0x156f1c=path[_0x0a9e('0x12')](config[_0x0a9e('0x65')],'server/files/tmp',_0x5adf8f+_0x0a9e('0x66'));logger[_0x0a9e('0x5a')]('body',_0x2244d6);db[_0x0a9e('0x67')][_0x0a9e('0x68')]({'raw':!![],'attributes':['id',_0x0a9e('0x69')]})[_0x0a9e('0x1d')](function(_0x401837){for(var _0x4d4a35=0x0;_0x4d4a35<_0x401837[_0x0a9e('0x18')];_0x4d4a35++){if(_0x401837[_0x4d4a35][_0x0a9e('0x69')]in _0x5854cc){contactItemTypes[_0x0a9e('0x1b')](_0x401837[_0x4d4a35]);delete _0x1f07cb[_0x401837[_0x4d4a35]['name']];hasAdditionalPhones=!![];}for(var _0x3528b7 in _0x5854cc){if(_0x401837[_0x4d4a35]['name']+'_description'===_0x3528b7){phoneDescriptions[_0x0a9e('0x1b')]({'itemTypeId':_0x401837[_0x4d4a35]['id'],'description':_0x3528b7});delete _0x1f07cb[_0x3528b7];}}}if(hasAdditionalPhones)_0x1f07cb[_0x0a9e('0x1a')]='';var _0x9375fb=_[_0x0a9e('0x56')](_0x1f07cb)[_0x0a9e('0x12')]();logger[_0x0a9e('0x5a')](_0x0a9e('0x6a'),_0x9375fb);fs[_0x0a9e('0x6b')](_0x156f1c,_0x9375fb+'\x0a');Papa[_0x0a9e('0x6c')](fs[_0x0a9e('0x6d')](_0x49d231),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2e89b7,_0x19012b){try{for(var _0x2bbb86=0x0,_0x2b8192=[];_0x2bbb86<_0x2e89b7[_0x0a9e('0x6e')][_0x0a9e('0x18')];_0x2bbb86++){stats[_0x0a9e('0x6f')]+=0x1;if(_0x2e89b7[_0x0a9e('0x5c')][_0x2bbb86]){handleError(_0x2e89b7['data'][_0x2bbb86],_0x2e89b7[_0x0a9e('0x5c')][_0x2bbb86]);}else{var _0x295763=[];var _0x243d12=[];var _0x4edbb0={};for(var _0x1148a1 in _0x5854cc){let _0x30944e=contactItemTypes['find'](_0x83f0b2=>_0x83f0b2[_0x0a9e('0x69')]===_0x1148a1);let _0x3ef315=contactItemTypes[_0x0a9e('0x70')](_0x13b5c0=>_0x13b5c0['name']+'_description'===_0x1148a1);if(_['isNil'](_0x30944e)&&_[_0x0a9e('0x19')](_0x3ef315)){if(_0x5854cc[_0x0a9e('0x71')](_0x1148a1)){if(_0x2e89b7[_0x0a9e('0x6e')][_0x2bbb86][_0x5854cc[_0x1148a1]]){var _0x5b35db=_[_0x0a9e('0x72')](_0x2e89b7[_0x0a9e('0x6e')][_0x2bbb86][_0x5854cc[_0x1148a1]][_0x0a9e('0x73')](/"/g,'\x27'));switch(_0x1148a1){case _0x0a9e('0x32'):var _0x5512d1=moment(_0x5b35db,_0x0a9e('0x74'),!![]);if(_0x5512d1[_0x0a9e('0x75')]()){_0x2b8192[_0x0a9e('0x1b')]('\x22'+_0x5b35db+'\x22');}else{_0x295763['push'](_0x0a9e('0x76'));}break;case'priority':var _0x4437ff=parseInt(_0x5b35db);_0x5b35db=_[_0x0a9e('0x77')](_0x4437ff)||_0x4437ff<0x0||_0x4437ff>0x4?_0x261adb?0x3:0x2:_0x4437ff;_0x2b8192['push']('\x22'+_0x5b35db+'\x22');break;case _0x0a9e('0x78'):var _0x75912a=parseInt(_0x5b35db);if(_[_0x0a9e('0x79')](_0x75912a)&&_[_0x0a9e('0x7a')](_0x1fc70e,_0x75912a)){_0x2b8192['push']('\x22'+_0x75912a+'\x22');}else{_0x295763[_0x0a9e('0x1b')](_0x0a9e('0x7b'));}break;case _0x0a9e('0x7c'):if(isEmail(_0x5b35db)){_0x2b8192[_0x0a9e('0x1b')]('\x22'+_0x5b35db+'\x22');}else{_0x295763['push'](_0x0a9e('0x7d'));}break;case _0x0a9e('0x7e'):var _0x2d5506=moment(_0x5b35db,_0x0a9e('0x7f'),!![]);if(_0x2d5506['isValid']()){_0x2b8192[_0x0a9e('0x1b')]('\x22'+_0x5b35db+'\x22');}else{_0x295763[_0x0a9e('0x1b')](_0x0a9e('0x80'));}break;default:_0x2b8192[_0x0a9e('0x1b')]('\x22'+_0x5b35db+'\x22');}}else{switch(_0x1148a1){case _0x0a9e('0x81'):case _0x0a9e('0x10'):_0x295763[_0x0a9e('0x1b')](_0x1148a1+_0x0a9e('0x82'));break;default:_0x2b8192[_0x0a9e('0x1b')]('\x22\x22');}}}}else{var _0x336dc3='';if(!_[_0x0a9e('0x19')](_0x30944e)){if(!_0x4edbb0[_0x0a9e('0x71')](_0x30944e['id'])){for(var _0x25744a=0x0;_0x25744a<_0x5854cc[_0x1148a1][_0x0a9e('0x18')];_0x25744a++){var _0x5b35db=_[_0x0a9e('0x72')](_0x2e89b7[_0x0a9e('0x6e')][_0x2bbb86][_0x5854cc[_0x1148a1][_0x25744a]][_0x0a9e('0x73')](/"/g,'\x27'));var _0x563627=phoneDescriptions[_0x0a9e('0x70')](_0x33dda0=>_0x33dda0[_0x0a9e('0x83')]===_0x30944e['id']);if(!_[_0x0a9e('0x19')](_0x563627)){var _0x56d650=_['trim'](_0x2e89b7[_0x0a9e('0x6e')][_0x2bbb86][_0x5854cc[_0x563627[_0x0a9e('0x84')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x0a9e('0x19')](_0x56d650))_0x5b35db=_0x5b35db+'§'+_0x56d650;}if(_0x336dc3=='')_0x336dc3=_0x5b35db;else _0x336dc3+='|'+_0x5b35db;}_0x243d12['push'](_0x30944e['id']+':'+_0x336dc3);_0x4edbb0[_0x30944e['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2b8192[_0x0a9e('0x1b')]('\x22'+_0x243d12[_0x0a9e('0x12')](';')+'\x22');}if(_0x295763['length']){handleError(_0x2e89b7[_0x0a9e('0x6e')][_0x2bbb86],{'code':_0x0a9e('0x85'),'message':_0x295763[_0x0a9e('0x12')]()});}else{fs[_0x0a9e('0x86')](_0x156f1c,_0x2b8192[_0x0a9e('0x12')]()+'\x0a');}_0x2b8192=[];}if(!(stats[_0x0a9e('0x6f')]%0xc8)){socket[_0x0a9e('0x87')]('contact:import:'+_0x5adf8f,stats);stats[_0x0a9e('0x5c')]=[];}}if(stopped){logger[_0x0a9e('0x5a')](_0x0a9e('0x88'));_0x19012b[_0x0a9e('0x89')]();}}catch(_0x492543){handleError(_0x2e89b7[_0x0a9e('0x6e')][_0x2bbb86],{'code':_0x0a9e('0x8a'),'message':_0x492543['message']});logger[_0x0a9e('0x1f')]('step',_0x492543[_0x0a9e('0x20')]);}},'complete':function(){try{var _0x2bb25a=[];var _0x3003eb=tempTableName;_0x2bb25a[_0x0a9e('0x1b')]('CREATE\x20TABLE\x20'+_0x3003eb+'\x20LIKE\x20cm_contacts;');logger[_0x0a9e('0x5a')](_0x0a9e('0x8b'),contactItemTypes[_0x0a9e('0x18')]);var _0x5ac73d=util[_0x0a9e('0xc')](_0x0a9e('0x8c'),_0x156f1c,_0x3003eb,_0x9375fb,_0x2244d6['ListId'],_0x2244d6['CompanyId']||null,NOW,NOW);if(_[_0x0a9e('0x19')](_0x5854cc['scheduledat'])){_0x5ac73d+=',\x20scheduledAt\x20=\x20NOW()';}_0x2bb25a['push'](_0x5ac73d);BPromise[_0x0a9e('0x8d')](_0x2bb25a,handleQuery)[_0x0a9e('0x1d')](function(_0x9044fe){BPromise[_0x0a9e('0x1c')]([handleAdditionalPhones()])[_0x0a9e('0x1d')](function(){_0x2bb25a=[];for(var _0x2600de=0x0;_0x2600de=_0x4266f5){return _0x59c199[_0x4652('0x12')](0x193)[_0x4652('0x13')]({'message':util[_0x4652('0x9')](_0x4652('0x14'),_0x4340e8)});}_0x4d7ce6();})[_0x4652('0x15')](function(_0x291a56){_0x4d7ce6(_0x291a56);});});}function isUserLimit(){return isLimit(_0x4652('0x16'),0x1,db[_0x4652('0x17')],{'where':{'$or':[{'role':_0x4652('0x18')},{'role':_0x4652('0x19')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x7131=['user','isUserLimit','util','../../config/environment','data1','split','aes-256-ctr','format','update','base64','final','utf8','parse','use','findOne','then','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','User','admin'];(function(_0x5c8c71,_0x421f89){var _0x38eaef=function(_0x179b42){while(--_0x179b42){_0x5c8c71['push'](_0x5c8c71['shift']());}};_0x38eaef(++_0x421f89);}(_0x7131,0x1a6));var _0x1713=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x7131[_0x5627e1];return _0x2f013f;};'use strict';var crypto=require('crypto');var util=require(_0x1713('0x0'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0x1713('0x1'));function getValueFromLicense(_0x4dda34,_0x4edceb){if(_0x4dda34&&_0x4edceb){if(_0x4edceb[_0x1713('0x2')]&&_0x4edceb['license']){var _0xf89f84=_0x4edceb[_0x1713('0x2')];var _0x13bf89=_0x4edceb['license'];var _0xf5788b=_0xf89f84[_0x1713('0x3')]('-')[0x4];var _0x5c7fdf=_0xf89f84[_0x1713('0x3')]('-')[0x0];var _0x171d45=crypto['createDecipher'](_0x1713('0x4'),util[_0x1713('0x5')]('%s:%s:%s',_0xf5788b,_0xf89f84,_0x5c7fdf));var _0x26c309=_0x171d45[_0x1713('0x6')](_0x13bf89,_0x1713('0x7'),'utf8');_0x26c309+=_0x171d45[_0x1713('0x8')](_0x1713('0x9'));var _0x552e33=JSON[_0x1713('0xa')](_0x26c309);return _0x552e33['hasOwnProperty'](_0x4dda34)?_0x552e33[_0x4dda34]:null;}}return null;}function isLimit(_0x5ebdc0,_0x51285d,_0x390ce7,_0x36dbf8){var _0x20f37f=_0x51285d;return compose()[_0x1713('0xb')](function(_0x351989,_0x353ece,_0x45cfa1){return db['License'][_0x1713('0xc')]({'where':{'id':0x1},'raw':!![]})[_0x1713('0xd')](function(_0x4394de){var _0x3fd31e=getValueFromLicense(_0x5ebdc0,_0x4394de);return _0x3fd31e?_0x3fd31e:_0x20f37f;})[_0x1713('0xd')](function(_0x7c00dc){_0x20f37f=_0x7c00dc;return _0x390ce7['count'](_0x36dbf8);})[_0x1713('0xd')](function(_0x2dc8d2){if(_0x2dc8d2>=_0x20f37f){return _0x353ece['status'](0x193)[_0x1713('0xe')]({'message':util[_0x1713('0x5')](_0x1713('0xf'),_0x5ebdc0)});}_0x45cfa1();})['catch'](function(_0x4d4d58){_0x45cfa1(_0x4d4d58);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x1713('0x10')],{'where':{'$or':[{'role':_0x1713('0x11')},{'role':_0x1713('0x12')}]}});}exports[_0x1713('0x13')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 5eb6c7d..2fbd893 100644 --- a/server/components/parsers/advancedSearch.js +++ b/server/components/parsers/advancedSearch.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12e7=['and','[$and]','replace','length','split','shift','match','filter','indexOf','buildExpression','operator','value','includes','$gt','$lte','add','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','start','DATE','utcOffset','format','minutes','seconds','lodash','parseSearch','sqlOperator','startsWith','[$or]'];(function(_0x3477c4,_0x309176){var _0xb1b1b5=function(_0x497eeb){while(--_0x497eeb){_0x3477c4['push'](_0x3477c4['shift']());}};_0xb1b1b5(++_0x309176);}(_0x12e7,0x167));var _0x712e=function(_0x97ed8,_0x363693){_0x97ed8=_0x97ed8-0x0;var _0x185f90=_0x12e7[_0x97ed8];return _0x185f90;};'use strict';var _=require(_0x712e('0x0'));var moment=require('moment');exports[_0x712e('0x1')]=function(_0x5b4405){var _0x9ab77e={'conditions':[]};_0x9ab77e[_0x712e('0x2')]=_[_0x712e('0x3')](_0x5b4405,_0x712e('0x4'))?'or':_0x712e('0x5');var _0x4d1575=_0x5b4405['replace'](_0x712e('0x6'),'')[_0x712e('0x7')](_0x712e('0x4'),'')['split']('||');for(var _0x4712f0=0x0;_0x4712f0<_0x4d1575[_0x712e('0x8')];_0x4712f0++){var _0x2a6c7c=_0x4d1575[_0x4712f0][_0x712e('0x9')](':=');var _0x12bc68=_0x2a6c7c[0x0];var _0x127bab=_0x2a6c7c['slice'](0x1);_0x127bab['forEach'](function(_0x4fbbf1){var _0x340b1f=_0x4fbbf1[_0x712e('0x9')]('[')[_0x712e('0xa')]();var _0x3616a1=_0x4fbbf1[_0x712e('0xb')](/\[(.*?)\]/g);_0x3616a1['forEach'](function(_0x30b36a){var _0x5eed96=_0x30b36a['split']('[')[_0x712e('0xc')](function(_0x1f0c2a){return _0x1f0c2a[_0x712e('0xd')](']')>-0x1;})['map'](function(_0x16c0b8){return _0x16c0b8['split'](']')[0x0];})[0x0];_0x9ab77e['conditions']['push']({'field':_0x12bc68,'operator':_0x340b1f,'value':_0x5eed96});});});}return _0x9ab77e;};exports[_0x712e('0xe')]=function(_0x5d6ccf,_0x12ead0,_0x17dd44){var _0x1aeedf={};if(_0x12ead0==='DATE'){if(_0x17dd44['operator']==='$eq'){_0x17dd44[_0x712e('0xf')]='$between';_0x17dd44[_0x712e('0x10')]+=','+_0x17dd44['value'];}else if(_[_0x712e('0x11')]([_0x712e('0x12'),_0x712e('0x13')],_0x17dd44[_0x712e('0xf')])){_0x17dd44[_0x712e('0x10')]=moment(_0x17dd44['value'])[_0x712e('0x14')](0x1,'days')['format'](_0x712e('0x15'));}}if(_0x17dd44['castTo']){_0x12ead0=_0x17dd44[_0x712e('0x16')];_0x1aeedf[_0x712e('0x17')]=_0x712e('0x18')+_0x5d6ccf+'.'+_0x17dd44[_0x712e('0x19')]+_0x712e('0x1a')+_0x17dd44['castTo']+')\x20'+parseOperator(_0x17dd44['operator']);}else{_0x1aeedf[_0x712e('0x17')]=_0x5d6ccf+'.'+_0x17dd44['field']+'\x20'+parseOperator(_0x17dd44[_0x712e('0xf')]);}if(_[_0x712e('0x11')]([_0x712e('0x1b'),_0x712e('0x1c')],_0x17dd44[_0x712e('0xf')]))_0x1aeedf['text']='('+_0x1aeedf['text']+_0x712e('0x1d')+_0x5d6ccf+'.'+_0x17dd44[_0x712e('0x19')]+_0x712e('0x1e');_0x1aeedf[_0x712e('0x10')]=parseValue(_0x12ead0,_0x17dd44[_0x712e('0xf')],_0x17dd44[_0x712e('0x10')]);return _0x1aeedf;};function parseOperator(_0x2da861){var _0x261166;switch(_0x2da861){case _0x712e('0x1f'):_0x261166=_0x712e('0x20');break;case _0x712e('0x1c'):_0x261166=_0x712e('0x21');break;case'$eq':_0x261166='=\x20?';break;case _0x712e('0x1b'):_0x261166=_0x712e('0x22');break;case _0x712e('0x23'):case _0x712e('0x24'):case _0x712e('0x25'):_0x261166=_0x712e('0x26');break;case _0x712e('0x27'):_0x261166=_0x712e('0x28');break;case'$gt':_0x261166=_0x712e('0x29');break;case _0x712e('0x13'):_0x261166=_0x712e('0x2a');break;case _0x712e('0x2b'):_0x261166=_0x712e('0x2c');break;case _0x712e('0x2d'):_0x261166='BETWEEN\x20?\x20AND\x20?';break;}return _0x261166;}function parseValue(_0x56e2ce,_0x3d8b1e,_0x24b32d){var _0x6a4169={'start':undefined,'end':undefined};switch(_0x3d8b1e){case _0x712e('0x1f'):case _0x712e('0x1c'):_0x6a4169[_0x712e('0x2e')]=_0x24b32d[_0x712e('0x9')](',');break;case _0x712e('0x23'):_0x6a4169[_0x712e('0x2e')]='%'+_0x24b32d+'%';break;case _0x712e('0x24'):_0x6a4169[_0x712e('0x2e')]=_0x24b32d+'%';break;case'$endsWith':_0x6a4169['start']='%'+_0x24b32d;break;case _0x712e('0x2d'):var _0x2bcbec=_0x24b32d[_0x712e('0x9')](',');var _0x24b32d=_0x2bcbec['shift']();var _0x55058a=_0x2bcbec['pop']();if(_0x56e2ce===_0x712e('0x2f')){_0x24b32d=moment(_0x24b32d)[_0x712e('0x30')](0x0,!![])[_0x712e('0x31')]();_0x55058a=moment(_0x55058a)['utcOffset'](0x0,!![])[_0x712e('0x14')](0x17,'hours')[_0x712e('0x14')](0x3b,_0x712e('0x32'))[_0x712e('0x14')](0x3b,_0x712e('0x33'))[_0x712e('0x31')]();}_0x6a4169={'start':_0x24b32d,'end':_0x55058a};break;default:_0x6a4169['start']=_0x24b32d;break;}return _0x6a4169;} \ No newline at end of file +var _0xa43b=['CAST(','field','\x20AS\x20','castTo','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','[$and]','split','forEach','shift','match','indexOf','map','push','buildExpression','operator','$eq','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','text'];(function(_0x3316d6,_0x9e6ac1){var _0x7a30c=function(_0x5dedcb){while(--_0x5dedcb){_0x3316d6['push'](_0x3316d6['shift']());}};_0x7a30c(++_0x9e6ac1);}(_0xa43b,0x194));var _0xba43=function(_0x14f1bd,_0x2f27e2){_0x14f1bd=_0x14f1bd-0x0;var _0x238c4b=_0xa43b[_0x14f1bd];return _0x238c4b;};'use strict';var _=require(_0xba43('0x0'));var moment=require(_0xba43('0x1'));exports[_0xba43('0x2')]=function(_0xa4f776){var _0xcf0384={'conditions':[]};_0xcf0384[_0xba43('0x3')]=_[_0xba43('0x4')](_0xa4f776,_0xba43('0x5'))?'or':'and';var _0x906986=_0xa4f776[_0xba43('0x6')](_0xba43('0x7'),'')[_0xba43('0x6')](_0xba43('0x5'),'')[_0xba43('0x8')]('||');for(var _0xcc4afa=0x0;_0xcc4afa<_0x906986['length'];_0xcc4afa++){var _0x18d16e=_0x906986[_0xcc4afa][_0xba43('0x8')](':=');var _0x56143f=_0x18d16e[0x0];var _0x580c49=_0x18d16e['slice'](0x1);_0x580c49[_0xba43('0x9')](function(_0x486f36){var _0x24f939=_0x486f36['split']('[')[_0xba43('0xa')]();var _0x37dfc0=_0x486f36[_0xba43('0xb')](/\[(.*?)\]/g);_0x37dfc0[_0xba43('0x9')](function(_0x1c4ee7){var _0x20da13=_0x1c4ee7['split']('[')['filter'](function(_0x41bb82){return _0x41bb82[_0xba43('0xc')](']')>-0x1;})[_0xba43('0xd')](function(_0x1ae37a){return _0x1ae37a[_0xba43('0x8')](']')[0x0];})[0x0];_0xcf0384['conditions'][_0xba43('0xe')]({'field':_0x56143f,'operator':_0x24f939,'value':_0x20da13});});});}return _0xcf0384;};exports[_0xba43('0xf')]=function(_0x5e000d,_0x567c1d,_0x527c86){var _0xc2bddd={};if(_0x567c1d==='DATE'){if(_0x527c86[_0xba43('0x10')]===_0xba43('0x11')){_0x527c86[_0xba43('0x10')]=_0xba43('0x12');_0x527c86[_0xba43('0x13')]+=','+_0x527c86[_0xba43('0x13')];}else if(_[_0xba43('0x14')]([_0xba43('0x15'),_0xba43('0x16')],_0x527c86[_0xba43('0x10')])){_0x527c86[_0xba43('0x13')]=moment(_0x527c86['value'])[_0xba43('0x17')](0x1,_0xba43('0x18'))[_0xba43('0x19')](_0xba43('0x1a'));}}if(_0x527c86['castTo']){_0x567c1d=_0x527c86['castTo'];_0xc2bddd[_0xba43('0x1b')]=_0xba43('0x1c')+_0x5e000d+'.'+_0x527c86[_0xba43('0x1d')]+_0xba43('0x1e')+_0x527c86[_0xba43('0x1f')]+')\x20'+parseOperator(_0x527c86[_0xba43('0x10')]);}else{_0xc2bddd['text']=_0x5e000d+'.'+_0x527c86[_0xba43('0x1d')]+'\x20'+parseOperator(_0x527c86[_0xba43('0x10')]);}if(_['includes'](['$ne',_0xba43('0x20')],_0x527c86['operator']))_0xc2bddd[_0xba43('0x1b')]='('+_0xc2bddd[_0xba43('0x1b')]+_0xba43('0x21')+_0x5e000d+'.'+_0x527c86[_0xba43('0x1d')]+_0xba43('0x22');_0xc2bddd[_0xba43('0x13')]=parseValue(_0x567c1d,_0x527c86['operator'],_0x527c86[_0xba43('0x13')]);return _0xc2bddd;};function parseOperator(_0x504917){var _0x3d0d6c;switch(_0x504917){case _0xba43('0x23'):_0x3d0d6c=_0xba43('0x24');break;case _0xba43('0x20'):_0x3d0d6c='NOT\x20IN\x20?';break;case _0xba43('0x11'):_0x3d0d6c='=\x20?';break;case'$ne':_0x3d0d6c=_0xba43('0x25');break;case _0xba43('0x26'):case _0xba43('0x27'):case _0xba43('0x28'):_0x3d0d6c=_0xba43('0x29');break;case _0xba43('0x2a'):_0x3d0d6c=_0xba43('0x2b');break;case _0xba43('0x15'):_0x3d0d6c=_0xba43('0x2c');break;case _0xba43('0x16'):_0x3d0d6c=_0xba43('0x2d');break;case _0xba43('0x2e'):_0x3d0d6c=_0xba43('0x2f');break;case _0xba43('0x12'):_0x3d0d6c=_0xba43('0x30');break;}return _0x3d0d6c;}function parseValue(_0xcf9c4c,_0x201be1,_0x135881){var _0x428426={'start':undefined,'end':undefined};switch(_0x201be1){case _0xba43('0x23'):case _0xba43('0x20'):_0x428426[_0xba43('0x31')]=_0x135881['split'](',');break;case _0xba43('0x26'):_0x428426[_0xba43('0x31')]='%'+_0x135881+'%';break;case _0xba43('0x27'):_0x428426[_0xba43('0x31')]=_0x135881+'%';break;case _0xba43('0x28'):_0x428426[_0xba43('0x31')]='%'+_0x135881;break;case _0xba43('0x12'):var _0x22e2a6=_0x135881[_0xba43('0x8')](',');var _0x135881=_0x22e2a6[_0xba43('0xa')]();var _0x3ca5ae=_0x22e2a6[_0xba43('0x32')]();if(_0xcf9c4c==='DATE'){_0x135881=moment(_0x135881)[_0xba43('0x33')](0x0,!![])['format']();_0x3ca5ae=moment(_0x3ca5ae)['utcOffset'](0x0,!![])[_0xba43('0x17')](0x17,'hours')[_0xba43('0x17')](0x3b,_0xba43('0x34'))['add'](0x3b,_0xba43('0x35'))[_0xba43('0x19')]();}_0x428426={'start':_0x135881,'end':_0x3ca5ae};break;default:_0x428426[_0xba43('0x31')]=_0x135881;break;}return _0x428426;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index c881bb1..a3ed2d8 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 _0x50f8=['isPlainObject','parse','format','YYYY-MM-DD','utc','$lte','name','uniqueid','isArray','limit','offset','sort','priority','col','unsigned','DESC','cast','omit','length','isObject','isString','hasOwnProperty','isNumeric','^[+]?[0-9]*$','match','getFullTextValue','forEach','replace','push','join','lodash','sequelize','moment','fields','split','filters','isEmpty','forOwn','find','type','DATE'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x50f8,0xc2));var _0x850f=function(_0x55a72e,_0x54592e){_0x55a72e=_0x55a72e-0x0;var _0x102527=_0x50f8[_0x55a72e];return _0x102527;};'use strict';var _=require(_0x850f('0x0'));var sequelize=require(_0x850f('0x1'));var moment=require(_0x850f('0x2'));var LIMIT_VALUE=0xfa;exports[_0x850f('0x3')]=function(_0x52d287){var _0xed72dc=null;if(_0x52d287){_0xed72dc=_0x52d287[_0x850f('0x4')](',');}return _0xed72dc;};exports[_0x850f('0x5')]=function(_0x292174,_0x44da47){var _0x21cbf7={};if(!_[_0x850f('0x6')](_0x292174)){_[_0x850f('0x7')](_0x292174,function(_0x2df506,_0x2585c1){try{if(_0x44da47){var _0x1def06=_[_0x850f('0x8')](_0x44da47,{'name':_0x2585c1})||{};if(_0x1def06[_0x850f('0x9')]===_0x850f('0xa')&&_[_0x850f('0xb')](_0x2df506)){var _0xfd052d=JSON[_0x850f('0xc')](_0x2df506);var _0x2ab6f9={'$gte':moment(moment(_0xfd052d['$gte'])[_0x850f('0xd')](_0x850f('0xe')))[_0x850f('0xf')]()['format'](),'$lte':moment(moment(_0xfd052d[_0x850f('0x10')])['format'](_0x850f('0xe')))[_0x850f('0xf')]()['subtract'](0x1,'s')['format']()};_0x21cbf7[_0x2585c1]=_0x2ab6f9;}else if(_0x1def06[_0x850f('0x11')]===_0x850f('0x12')){_0x21cbf7[_0x2585c1]=_0x2df506;}else{_0x21cbf7[_0x2585c1]=_[_0x850f('0x13')](_0x2df506)?_0x2df506:JSON[_0x850f('0xc')](_0x2df506);}}else{_0x21cbf7[_0x2585c1]=_[_0x850f('0x13')](_0x2df506)?_0x2df506:JSON['parse'](_0x2df506);}}catch(_0x25e92d){_0x21cbf7[_0x2585c1]=_0x2df506[_0x850f('0x4')](',');}});}return _0x21cbf7;};exports[_0x850f('0x14')]=function(_0x11fa4f){_0x11fa4f=parseInt(_0x11fa4f,0xa);if(!_0x11fa4f||_0x11fa4f<0x0){_0x11fa4f=LIMIT_VALUE;}return _0x11fa4f;};exports[_0x850f('0x15')]=function(_0x3c6d5a){_0x3c6d5a=parseInt(_0x3c6d5a,0xa);if(!_0x3c6d5a||_0x3c6d5a<0x0){_0x3c6d5a=0x0;}return _0x3c6d5a;};exports[_0x850f('0x16')]=function(_0x29f4a7){var _0x442efb,_0x483dc2=null;if(_0x29f4a7){_0x442efb=_0x29f4a7['split'](',');_0x483dc2=_['map'](_0x442efb,function(_0x667c41){if(_0x667c41['indexOf']('-')===0x0){return[_0x667c41===_0x850f('0x17')?sequelize['cast'](sequelize[_0x850f('0x18')](_0x850f('0x17')),_0x850f('0x19')):_0x667c41['substr'](0x1),_0x850f('0x1a')];}else{return[_0x667c41==='priority'?sequelize[_0x850f('0x1b')](sequelize['col']('priority'),_0x850f('0x19')):_0x667c41,'ASC'];}});}return _0x483dc2;};exports[_0x850f('0x1c')]=function(_0x1c5505,_0x522b07){if(_['isEmpty'](_0x1c5505)){return _0x1c5505;}if(_[_0x850f('0x13')](_0x1c5505)){for(var _0x152c9d=0x0;_0x152c9d<_0x1c5505[_0x850f('0x1d')];_0x152c9d+=0x1){_0x1c5505[_0x152c9d]=this[_0x850f('0x1c')](_0x1c5505[_0x152c9d],_0x522b07);}return _0x1c5505;}if(!_[_0x850f('0x1e')](_0x1c5505)){return _0x1c5505;}if(_[_0x850f('0x1f')](_0x522b07)){_0x522b07=[_0x522b07];}if(!_['isArray'](_0x522b07)){return _0x1c5505;}for(var _0x1e4c5c=0x0;_0x1e4c5c<_0x522b07[_0x850f('0x1d')];_0x1e4c5c+=0x1){_['unset'](_0x1c5505,_0x522b07[_0x1e4c5c]);}for(var _0x1c770d in _0x1c5505){if(_0x1c5505[_0x850f('0x20')](_0x1c770d)){_0x1c5505[_0x1c770d]=this[_0x850f('0x1c')](_0x1c5505[_0x1c770d],_0x522b07);}}return _0x1c5505;};exports[_0x850f('0x21')]=function(_0x1bf2f3){return _0x1bf2f3['match'](RegExp(_0x850f('0x22')))?!![]:![];};exports['isEmail']=function(_0x3680b5){return _0x3680b5[_0x850f('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0x850f('0x24')]=function(_0xec3d53){var _0x42bb81=[];_0xec3d53[_0x850f('0x4')](/[ ,]+/)[_0x850f('0x25')](function(_0x5dc92c){_0x5dc92c=_0x5dc92c[_0x850f('0x26')](/([^:]")"+/g,'$1');_0x5dc92c='+'+_0x5dc92c+'*';if(_0x5dc92c['includes']('@'))_0x5dc92c='\x22'+_0x5dc92c+'\x22';_0x42bb81[_0x850f('0x27')](_0x5dc92c);});return _0x42bb81[_0x850f('0x28')]('\x20');}; \ No newline at end of file +var _0x8cc4=['isEmpty','forOwn','DATE','parse','format','$lte','YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','sort','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','includes','push','join','lodash','sequelize','moment','fields','split','filters'];(function(_0x4aba66,_0x1d803d){var _0x3d7ebe=function(_0x37e689){while(--_0x37e689){_0x4aba66['push'](_0x4aba66['shift']());}};_0x3d7ebe(++_0x1d803d);}(_0x8cc4,0xf6));var _0x48cc=function(_0x24697b,_0x2eb072){_0x24697b=_0x24697b-0x0;var _0x585b99=_0x8cc4[_0x24697b];return _0x585b99;};'use strict';var _=require(_0x48cc('0x0'));var sequelize=require(_0x48cc('0x1'));var moment=require(_0x48cc('0x2'));var LIMIT_VALUE=0xfa;exports[_0x48cc('0x3')]=function(_0x5416ea){var _0x57decc=null;if(_0x5416ea){_0x57decc=_0x5416ea[_0x48cc('0x4')](',');}return _0x57decc;};exports[_0x48cc('0x5')]=function(_0xfbfd63,_0xfbf41f){var _0xb64c85={};if(!_[_0x48cc('0x6')](_0xfbfd63)){_[_0x48cc('0x7')](_0xfbfd63,function(_0x36a3a2,_0x3a8dd9){try{if(_0xfbf41f){var _0x17f363=_['find'](_0xfbf41f,{'name':_0x3a8dd9})||{};if(_0x17f363['type']===_0x48cc('0x8')&&_['isPlainObject'](_0x36a3a2)){var _0x1401f0=JSON[_0x48cc('0x9')](_0x36a3a2);var _0x41dc7d={'$gte':moment(moment(_0x1401f0['$gte'])['format']('YYYY-MM-DD'))['utc']()[_0x48cc('0xa')](),'$lte':moment(moment(_0x1401f0[_0x48cc('0xb')])[_0x48cc('0xa')](_0x48cc('0xc')))[_0x48cc('0xd')]()[_0x48cc('0xe')](0x1,'s')[_0x48cc('0xa')]()};_0xb64c85[_0x3a8dd9]=_0x41dc7d;}else if(_0x17f363[_0x48cc('0xf')]===_0x48cc('0x10')){_0xb64c85[_0x3a8dd9]=_0x36a3a2;}else{_0xb64c85[_0x3a8dd9]=_['isArray'](_0x36a3a2)?_0x36a3a2:JSON[_0x48cc('0x9')](_0x36a3a2);}}else{_0xb64c85[_0x3a8dd9]=_[_0x48cc('0x11')](_0x36a3a2)?_0x36a3a2:JSON[_0x48cc('0x9')](_0x36a3a2);}}catch(_0x237f51){_0xb64c85[_0x3a8dd9]=_0x36a3a2[_0x48cc('0x4')](',');}});}return _0xb64c85;};exports['limit']=function(_0x312877){_0x312877=parseInt(_0x312877,0xa);if(!_0x312877||_0x312877<0x0){_0x312877=LIMIT_VALUE;}return _0x312877;};exports['offset']=function(_0x34fab3){_0x34fab3=parseInt(_0x34fab3,0xa);if(!_0x34fab3||_0x34fab3<0x0){_0x34fab3=0x0;}return _0x34fab3;};exports[_0x48cc('0x12')]=function(_0x1f97c7){var _0x3e7953,_0x3aac40=null;if(_0x1f97c7){_0x3e7953=_0x1f97c7[_0x48cc('0x4')](',');_0x3aac40=_['map'](_0x3e7953,function(_0x225319){if(_0x225319[_0x48cc('0x13')]('-')===0x0){return[_0x225319===_0x48cc('0x14')?sequelize[_0x48cc('0x15')](sequelize[_0x48cc('0x16')](_0x48cc('0x14')),_0x48cc('0x17')):_0x225319[_0x48cc('0x18')](0x1),_0x48cc('0x19')];}else{return[_0x225319===_0x48cc('0x14')?sequelize[_0x48cc('0x15')](sequelize['col']('priority'),'unsigned'):_0x225319,_0x48cc('0x1a')];}});}return _0x3aac40;};exports[_0x48cc('0x1b')]=function(_0x1bf126,_0xe5076){if(_[_0x48cc('0x6')](_0x1bf126)){return _0x1bf126;}if(_[_0x48cc('0x11')](_0x1bf126)){for(var _0xca642d=0x0;_0xca642d<_0x1bf126[_0x48cc('0x1c')];_0xca642d+=0x1){_0x1bf126[_0xca642d]=this[_0x48cc('0x1b')](_0x1bf126[_0xca642d],_0xe5076);}return _0x1bf126;}if(!_[_0x48cc('0x1d')](_0x1bf126)){return _0x1bf126;}if(_[_0x48cc('0x1e')](_0xe5076)){_0xe5076=[_0xe5076];}if(!_[_0x48cc('0x11')](_0xe5076)){return _0x1bf126;}for(var _0x340b83=0x0;_0x340b83<_0xe5076['length'];_0x340b83+=0x1){_[_0x48cc('0x1f')](_0x1bf126,_0xe5076[_0x340b83]);}for(var _0x2fc2a7 in _0x1bf126){if(_0x1bf126[_0x48cc('0x20')](_0x2fc2a7)){_0x1bf126[_0x2fc2a7]=this[_0x48cc('0x1b')](_0x1bf126[_0x2fc2a7],_0xe5076);}}return _0x1bf126;};exports[_0x48cc('0x21')]=function(_0x2eae72){return _0x2eae72[_0x48cc('0x22')](RegExp(_0x48cc('0x23')))?!![]:![];};exports[_0x48cc('0x24')]=function(_0x3b4b10){return _0x3b4b10[_0x48cc('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0x48cc('0x25')]=function(_0x4c8a25){var _0x151a7b=[];_0x4c8a25[_0x48cc('0x4')](/[ ,]+/)[_0x48cc('0x26')](function(_0x10bc8e){_0x10bc8e=_0x10bc8e['replace'](/([^:]")"+/g,'$1');_0x10bc8e='+'+_0x10bc8e+'*';if(_0x10bc8e[_0x48cc('0x27')]('@'))_0x10bc8e='\x22'+_0x10bc8e+'\x22';_0x151a7b[_0x48cc('0x28')](_0x10bc8e);});return _0x151a7b[_0x48cc('0x29')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 362417c..3042ca1 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6016=['root','public','development','test','appPath','client','use','set','json\x20replacer','static','get','/server/views','html','ejs','renderFile','view\x20engine','urlencoded','json','initialize','express','serve-favicon','method-override','cookie-parser','errorhandler','path','cors','moment','../mysqldb','default','env','production','join'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6016,0x73));var _0x6601=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0x6016[_0x30cd7e];return _0x462a02;};'use strict';var express=require(_0x6601('0x0'));var favicon=require(_0x6601('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0x6601('0x2'));var cookieParser=require(_0x6601('0x3'));var errorHandler=require(_0x6601('0x4'));var path=require(_0x6601('0x5'));var passport=require('passport');var cors=require(_0x6601('0x6'));var moment=require(_0x6601('0x7'));var config=require('./environment');var db=require(_0x6601('0x8'))['db'];exports[_0x6601('0x9')]=function(_0x5bf3dc){var _0x12a77d=_0x5bf3dc['get'](_0x6601('0xa'));if(_0x12a77d===_0x6601('0xb')){_0x5bf3dc['set']('appPath',path[_0x6601('0xc')](config[_0x6601('0xd')],_0x6601('0xe')));}if(_0x12a77d===_0x6601('0xf')||_0x12a77d===_0x6601('0x10')){_0x5bf3dc['set'](_0x6601('0x11'),path[_0x6601('0xc')](config[_0x6601('0xd')],_0x6601('0x12')));_0x5bf3dc[_0x6601('0x13')](errorHandler());}_0x5bf3dc[_0x6601('0x14')](_0x6601('0x15'),function(_0x35ea5a,_0x373b24){if(this[_0x35ea5a]instanceof Date){_0x373b24=this[_0x35ea5a]['toISOString']()['split']('.')[0x0]+'Z';}return _0x373b24;});_0x5bf3dc['use'](express[_0x6601('0x16')](_0x5bf3dc[_0x6601('0x17')](_0x6601('0x11'))));_0x5bf3dc['set']('views',config['root']+_0x6601('0x18'));_0x5bf3dc['engine'](_0x6601('0x19'),require(_0x6601('0x1a'))[_0x6601('0x1b')]);_0x5bf3dc[_0x6601('0x14')](_0x6601('0x1c'),_0x6601('0x19'));_0x5bf3dc[_0x6601('0x13')](bodyParser[_0x6601('0x1d')]({'limit':'50mb','extended':!![]}));_0x5bf3dc['use'](bodyParser[_0x6601('0x1e')]({'limit':'50mb'}));_0x5bf3dc[_0x6601('0x13')](cors());_0x5bf3dc['use'](methodOverride());_0x5bf3dc[_0x6601('0x13')](cookieParser());_0x5bf3dc[_0x6601('0x13')](passport[_0x6601('0x1f')]());}; \ No newline at end of file +var _0x41c5=['moment','../mysqldb','production','set','public','test','appPath','join','root','use','json\x20replacer','toISOString','static','get','views','/server/views','engine','html','ejs','renderFile','view\x20engine','50mb','express','serve-favicon','cookie-parser','errorhandler','passport','cors'];(function(_0x233950,_0x4f00d7){var _0x158833=function(_0x349027){while(--_0x349027){_0x233950['push'](_0x233950['shift']());}};_0x158833(++_0x4f00d7);}(_0x41c5,0xda));var _0x541c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x41c5[_0x19950b];return _0x3c6b41;};'use strict';var express=require(_0x541c('0x0'));var favicon=require(_0x541c('0x1'));var bodyParser=require('body-parser');var methodOverride=require('method-override');var cookieParser=require(_0x541c('0x2'));var errorHandler=require(_0x541c('0x3'));var path=require('path');var passport=require(_0x541c('0x4'));var cors=require(_0x541c('0x5'));var moment=require(_0x541c('0x6'));var config=require('./environment');var db=require(_0x541c('0x7'))['db'];exports['default']=function(_0x21d1d1){var _0x58a7b0=_0x21d1d1['get']('env');if(_0x58a7b0===_0x541c('0x8')){_0x21d1d1[_0x541c('0x9')]('appPath',path['join'](config['root'],_0x541c('0xa')));}if(_0x58a7b0==='development'||_0x58a7b0===_0x541c('0xb')){_0x21d1d1['set'](_0x541c('0xc'),path[_0x541c('0xd')](config[_0x541c('0xe')],'client'));_0x21d1d1[_0x541c('0xf')](errorHandler());}_0x21d1d1[_0x541c('0x9')](_0x541c('0x10'),function(_0xe39891,_0x42ddf8){if(this[_0xe39891]instanceof Date){_0x42ddf8=this[_0xe39891][_0x541c('0x11')]()['split']('.')[0x0]+'Z';}return _0x42ddf8;});_0x21d1d1[_0x541c('0xf')](express[_0x541c('0x12')](_0x21d1d1[_0x541c('0x13')](_0x541c('0xc'))));_0x21d1d1[_0x541c('0x9')](_0x541c('0x14'),config[_0x541c('0xe')]+_0x541c('0x15'));_0x21d1d1[_0x541c('0x16')](_0x541c('0x17'),require(_0x541c('0x18'))[_0x541c('0x19')]);_0x21d1d1[_0x541c('0x9')](_0x541c('0x1a'),_0x541c('0x17'));_0x21d1d1[_0x541c('0xf')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0x21d1d1[_0x541c('0xf')](bodyParser['json']({'limit':_0x541c('0x1b')}));_0x21d1d1['use'](cors());_0x21d1d1[_0x541c('0xf')](methodOverride());_0x21d1d1[_0x541c('0xf')](cookieParser());_0x21d1d1[_0x541c('0xf')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 9d86e25..57e3c16 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 _0x0298=['crypto','bimedia-machine-uuid','execSync','../environment','orderBy','keys','length','filter','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','update','digest','hex','getUuid','licenseToken','test','utf8','hostname','macAddress','substring','lodash'];(function(_0x22be9f,_0x2307cc){var _0xcea3c1=function(_0x18b52c){while(--_0x18b52c){_0x22be9f['push'](_0x22be9f['shift']());}};_0xcea3c1(++_0x2307cc);}(_0x0298,0x107));var _0x8029=function(_0x46d5ac,_0x4cc7df){_0x46d5ac=_0x46d5ac-0x0;var _0xb6f383=_0x0298[_0x46d5ac];return _0xb6f383;};'use strict';var _=require(_0x8029('0x0'));var os=require('os');var crypto=require(_0x8029('0x1'));var machine=require(_0x8029('0x2'));var exec=require('child_process')[_0x8029('0x3')];var config=require(_0x8029('0x4'));function getInterfaces(){var _0x1303d8=[];var _0x168da9=os['networkInterfaces']();var _0x49fb57=_[_0x8029('0x5')](_[_0x8029('0x6')](_0x168da9));for(var _0xdfd69d=0x0;_0xdfd69d<_0x49fb57[_0x8029('0x7')];_0xdfd69d++){var _0x23d5b7=_0x168da9[_0x49fb57[_0xdfd69d]][_0x8029('0x8')](function(_0x34f566){return _0x34f566[_0x8029('0x9')]===_0x8029('0xa')&&_0x34f566['internal']===![];});_0x1303d8=_0x1303d8[_0x8029('0xb')](_0x23d5b7);}return _0x1303d8;}function getFirstInterface(){var _0x171e11=_[_0x8029('0xc')](getInterfaces());return{'macAddress':_0x171e11&&_0x171e11[_0x8029('0xd')]?_0x171e11[_0x8029('0xd')]:_0x8029('0xe'),'ipAddress':_0x171e11&&_0x171e11['address']?_0x171e11[_0x8029('0xf')]:_0x8029('0x10')};}exports[_0x8029('0x11')]=getFirstInterface;function getCPUhash(){var _0x517129=_[_0x8029('0x5')](os[_0x8029('0x12')]()[_0x8029('0x13')](function(_0x32ea4){return _0x32ea4[_0x8029('0x14')];}))[_0x8029('0x15')](':');return crypto[_0x8029('0x16')]('md5')[_0x8029('0x17')](_0x517129)[_0x8029('0x18')](_0x8029('0x19'));}exports[_0x8029('0x1a')]=function(){var _0x3dccee=os['platform']();var _0x48e22b=/[0-9a-f-]{36}/;if(config[_0x8029('0x1b')]&&_0x48e22b[_0x8029('0x1c')](config[_0x8029('0x1b')])){return config[_0x8029('0x1b')];}else if(_0x3dccee==='win32'){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x8029('0x1d')})['replace']('\x0d\x0a','');}else{var _0x1d8335=getFirstInterface();var _0x4f79e1=getCPUhash();var _0x172c52=_0x4f79e1+'|'+os[_0x8029('0x1e')]()+'|'+_0x1d8335[_0x8029('0x1f')]+'|'+_0x1d8335['ipAddress'];var _0x3c0d0a=crypto[_0x8029('0x16')]('md5')[_0x8029('0x17')](_0x172c52)[_0x8029('0x18')](_0x8029('0x19'));return _0x3c0d0a[_0x8029('0x20')](0x0,0x8)+'-'+_0x3c0d0a[_0x8029('0x20')](0x8,0xc)+'-'+_0x3c0d0a[_0x8029('0x20')](0xc,0x10)+'-'+_0x3c0d0a[_0x8029('0x20')](0x10,0x14)+'-'+_0x3c0d0a[_0x8029('0x20')](0x14);}}; \ No newline at end of file +var _0x6b0b=['127.0.0.1','getFirstInterface','map','model','update','hex','getUuid','platform','licenseToken','test','win32','utf8','replace','hostname','macAddress','ipAddress','createHash','substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length','filter','family','IPv4','internal','concat','head','mac','address'];(function(_0x401ccd,_0x140815){var _0x5a57ad=function(_0x8ad698){while(--_0x8ad698){_0x401ccd['push'](_0x401ccd['shift']());}};_0x5a57ad(++_0x140815);}(_0x6b0b,0x144));var _0xb6b0=function(_0x20d81e,_0x4c4baf){_0x20d81e=_0x20d81e-0x0;var _0x273461=_0x6b0b[_0x20d81e];return _0x273461;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xb6b0('0x0'));var machine=require(_0xb6b0('0x1'));var exec=require(_0xb6b0('0x2'))[_0xb6b0('0x3')];var config=require(_0xb6b0('0x4'));function getInterfaces(){var _0x2545fb=[];var _0x12fd20=os[_0xb6b0('0x5')]();var _0x2f5ed3=_[_0xb6b0('0x6')](_['keys'](_0x12fd20));for(var _0x2bfe26=0x0;_0x2bfe26<_0x2f5ed3[_0xb6b0('0x7')];_0x2bfe26++){var _0x143de1=_0x12fd20[_0x2f5ed3[_0x2bfe26]][_0xb6b0('0x8')](function(_0x5bb394){return _0x5bb394[_0xb6b0('0x9')]===_0xb6b0('0xa')&&_0x5bb394[_0xb6b0('0xb')]===![];});_0x2545fb=_0x2545fb[_0xb6b0('0xc')](_0x143de1);}return _0x2545fb;}function getFirstInterface(){var _0x3dadcb=_[_0xb6b0('0xd')](getInterfaces());return{'macAddress':_0x3dadcb&&_0x3dadcb[_0xb6b0('0xe')]?_0x3dadcb[_0xb6b0('0xe')]:'00:00:00:00:00:00','ipAddress':_0x3dadcb&&_0x3dadcb[_0xb6b0('0xf')]?_0x3dadcb[_0xb6b0('0xf')]:_0xb6b0('0x10')};}exports[_0xb6b0('0x11')]=getFirstInterface;function getCPUhash(){var _0x5a4fcb=_[_0xb6b0('0x6')](os['cpus']()[_0xb6b0('0x12')](function(_0x49f08a){return _0x49f08a[_0xb6b0('0x13')];}))['join'](':');return crypto['createHash']('md5')[_0xb6b0('0x14')](_0x5a4fcb)['digest'](_0xb6b0('0x15'));}exports[_0xb6b0('0x16')]=function(){var _0x29de83=os[_0xb6b0('0x17')]();var _0x6d2402=/[0-9a-f-]{36}/;if(config[_0xb6b0('0x18')]&&_0x6d2402[_0xb6b0('0x19')](config['licenseToken'])){return config[_0xb6b0('0x18')];}else if(_0x29de83===_0xb6b0('0x1a')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xb6b0('0x1b')})[_0xb6b0('0x1c')]('\x0d\x0a','');}else{var _0xe810f8=getFirstInterface();var _0xddd6d=getCPUhash();var _0x2461cc=_0xddd6d+'|'+os[_0xb6b0('0x1d')]()+'|'+_0xe810f8[_0xb6b0('0x1e')]+'|'+_0xe810f8[_0xb6b0('0x1f')];var _0x53a25f=crypto[_0xb6b0('0x20')]('md5')[_0xb6b0('0x14')](_0x2461cc)['digest'](_0xb6b0('0x15'));return _0x53a25f[_0xb6b0('0x21')](0x0,0x8)+'-'+_0x53a25f['substring'](0x8,0xc)+'-'+_0x53a25f[_0xb6b0('0x21')](0xc,0x10)+'-'+_0x53a25f['substring'](0x10,0x14)+'-'+_0x53a25f[_0xb6b0('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index dff4970..65e0411 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 _0x0529=['data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','info','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','bluebird','pkginfo','version','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get'];(function(_0xe6164f,_0x47e826){var _0x557c61=function(_0x303455){while(--_0x303455){_0xe6164f['push'](_0xe6164f['shift']());}};_0x557c61(++_0x47e826);}(_0x0529,0xf0));var _0x9052=function(_0x14c1c0,_0x30988d){_0x14c1c0=_0x14c1c0-0x0;var _0x8e689b=_0x0529[_0x14c1c0];return _0x8e689b;};'use strict';var util=require(_0x9052('0x0'));var moment=require(_0x9052('0x1'));var rp=require('request-promise');var BPromise=require(_0x9052('0x2'));var pkginfo=require(_0x9052('0x3'))(module,_0x9052('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x9052('0x5'));var hardware=require(_0x9052('0x6'));var logger=require(_0x9052('0x7'))(_0x9052('0x8'));var HOST=_0x9052('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x8bf7a4){return new BPromise(function(_0x5c4e64,_0x102a6d){var _0x147ba9=util[_0x9052('0xa')](_0x9052('0xb'),HOST,_0x8bf7a4,module[_0x9052('0xc')][_0x9052('0x4')]);if(oldToken){_0x147ba9=util[_0x9052('0xa')](_0x9052('0xd'),HOST,_0x8bf7a4,module[_0x9052('0xc')]['version'],oldToken);}var _0x2a8334={'uri':_0x147ba9,'method':_0x9052('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x2a8334)[_0x9052('0xf')](function(_0x111cde){_0x5c4e64(_0x111cde);})[_0x9052('0x10')](function(_0x447c13){_0x102a6d(_0x447c13);});});}function manageLicense(_0x3f8159,_0x20f2a1){var _0x35bb8e=_0x20f2a1[_0x9052('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x35bb8e[_0x9052('0x12')]!==_0x3f8159&&!_0x35bb8e[_0x9052('0x13')]){oldToken=_0x35bb8e[_0x9052('0x12')];}httpRequest(_0x3f8159)[_0x9052('0xf')](function(_0x3589e2){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3589e2[_0x9052('0x14')]){isOldTokenSent=![];if(!_0x35bb8e[_0x9052('0x8')]&&_0x35bb8e[_0x9052('0x8')]!=_0x3589e2[_0x9052('0x8')]||_0x35bb8e[_0x9052('0x8')]&&_0x35bb8e[_0x9052('0x13')]){logger['info'](_0x9052('0x15'));}if(_0x35bb8e[_0x9052('0x8')]&&!_0x35bb8e[_0x9052('0x13')]&&_0x35bb8e[_0x9052('0x8')]!=_0x3589e2[_0x9052('0x8')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x35bb8e[_0x9052('0x8')]&&!_0x35bb8e[_0x9052('0x13')]&&_0x35bb8e[_0x9052('0x8')]==_0x3589e2[_0x9052('0x8')]){return _0x20f2a1;}return _0x20f2a1['update']({'data1':_0x3f8159,'data2':null,'license':_0x3589e2[_0x9052('0x8')]});}else{if(_0x3589e2[_0x9052('0x8')]||_0x35bb8e[_0x9052('0x8')]){if(!_0x35bb8e[_0x9052('0x13')]){if(_0x35bb8e[_0x9052('0x12')]==_0x3f8159){GRAY_PERIOD_REASON=_0x9052('0x16');logger['info'](_0x9052('0x17'));}else{GRAY_PERIOD_REASON=_0x9052('0x18');logger[_0x9052('0x19')](_0x9052('0x1a'),_0x35bb8e[_0x9052('0x12')],_0x3f8159);}logger['info'](_0x9052('0x1b'),GRAY_PERIOD_REASON[_0x9052('0x1c')](),moment()['format'](_0x9052('0x1d')));return _0x20f2a1[_0x9052('0x1e')]({'data2':encryptor[_0x9052('0x1f')](moment()[_0x9052('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x9052('0x20')](encryptor['decryptString'](_0x35bb8e[_0x9052('0x13')]),_0x9052('0x21'))>DAYS){logger[_0x9052('0x19')](_0x9052('0x22'),moment()[_0x9052('0xa')](_0x9052('0x1d')));isOldTokenSent=![];return _0x20f2a1[_0x9052('0x1e')]({'data1':_0x3f8159,'data2':null,'license':null});}}}else{if(_0x35bb8e[_0x9052('0x12')]!=_0x3f8159){logger[_0x9052('0x19')](_0x9052('0x1a'),_0x35bb8e[_0x9052('0x12')],_0x3f8159);return _0x20f2a1[_0x9052('0x1e')]({'data1':_0x3f8159,'data2':null,'license':null});}}}return _0x20f2a1;})[_0x9052('0xf')](function(_0x1529da){_0x20f2a1=_0x1529da;})[_0x9052('0x10')](function(_0x298b4c){logger[_0x9052('0x23')](_0x298b4c[_0x9052('0x24')]);})[_0x9052('0x25')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x20f2a1);},TIME);});}function defaultLicense(){var _0x2db76a=hardware[_0x9052('0x26')]();if(_0x2db76a){return db[_0x9052('0x27')][_0x9052('0x28')]({'where':{'id':0x1},'defaults':{'data1':_0x2db76a}})['spread'](function(_0x24e039,_0x2c695d){logger['info'](_0x9052('0x29'),_0x2db76a);manageLicense(_0x2db76a,_0x24e039);})['catch'](function(_0x2f5035){logger[_0x9052('0x23')](_0x2f5035['message']);});}}exports[_0x9052('0x2a')]=defaultLicense; \ No newline at end of file +var _0xaf16=['data2','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','decryptString','days','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','catch','get','data1','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED'];(function(_0x289a1f,_0x1b4dc6){var _0x5a44ec=function(_0x341c20){while(--_0x341c20){_0x289a1f['push'](_0x289a1f['shift']());}};_0x5a44ec(++_0x1b4dc6);}(_0xaf16,0x1e2));var _0x6af1=function(_0x19babd,_0x1d4ef7){_0x19babd=_0x19babd-0x0;var _0x314eaf=_0xaf16[_0x19babd];return _0x314eaf;};'use strict';var util=require('util');var moment=require(_0x6af1('0x0'));var rp=require(_0x6af1('0x1'));var BPromise=require(_0x6af1('0x2'));var pkginfo=require(_0x6af1('0x3'))(module,_0x6af1('0x4'));var db=require(_0x6af1('0x5'))['db'];var encryptor=require(_0x6af1('0x6'));var hardware=require('./hardware');var logger=require(_0x6af1('0x7'))(_0x6af1('0x8'));var HOST=_0x6af1('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x11a43d){return new BPromise(function(_0x233bb2,_0x12123c){var _0x4dafe3=util[_0x6af1('0xa')](_0x6af1('0xb'),HOST,_0x11a43d,module['exports']['version']);if(oldToken){_0x4dafe3=util[_0x6af1('0xa')](_0x6af1('0xc'),HOST,_0x11a43d,module[_0x6af1('0xd')][_0x6af1('0x4')],oldToken);}var _0x1dcecf={'uri':_0x4dafe3,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x1dcecf)['then'](function(_0x2af396){_0x233bb2(_0x2af396);})[_0x6af1('0xe')](function(_0x3ce554){_0x12123c(_0x3ce554);});});}function manageLicense(_0x42e2e6,_0x3acabd){var _0x41be9d=_0x3acabd[_0x6af1('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x41be9d['data1']!==_0x42e2e6&&!_0x41be9d['data2']){oldToken=_0x41be9d[_0x6af1('0x10')];}httpRequest(_0x42e2e6)[_0x6af1('0x11')](function(_0x37d2d2){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x37d2d2[_0x6af1('0x12')]){isOldTokenSent=![];if(!_0x41be9d[_0x6af1('0x8')]&&_0x41be9d[_0x6af1('0x8')]!=_0x37d2d2[_0x6af1('0x8')]||_0x41be9d[_0x6af1('0x8')]&&_0x41be9d['data2']){logger[_0x6af1('0x13')](_0x6af1('0x14'));}if(_0x41be9d[_0x6af1('0x8')]&&!_0x41be9d['data2']&&_0x41be9d[_0x6af1('0x8')]!=_0x37d2d2[_0x6af1('0x8')]){logger['info'](_0x6af1('0x15'));}if(_0x41be9d['license']&&!_0x41be9d[_0x6af1('0x16')]&&_0x41be9d[_0x6af1('0x8')]==_0x37d2d2[_0x6af1('0x8')]){return _0x3acabd;}return _0x3acabd['update']({'data1':_0x42e2e6,'data2':null,'license':_0x37d2d2[_0x6af1('0x8')]});}else{if(_0x37d2d2[_0x6af1('0x8')]||_0x41be9d['license']){if(!_0x41be9d[_0x6af1('0x16')]){if(_0x41be9d[_0x6af1('0x10')]==_0x42e2e6){GRAY_PERIOD_REASON=_0x6af1('0x17');logger[_0x6af1('0x13')](_0x6af1('0x18'));}else{GRAY_PERIOD_REASON=_0x6af1('0x19');logger[_0x6af1('0x13')](_0x6af1('0x1a'),_0x41be9d[_0x6af1('0x10')],_0x42e2e6);}logger[_0x6af1('0x13')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x6af1('0x1b')](),moment()[_0x6af1('0xa')](_0x6af1('0x1c')));return _0x3acabd[_0x6af1('0x1d')]({'data2':encryptor[_0x6af1('0x1e')](moment()[_0x6af1('0xa')](_0x6af1('0x1c')))});}else{if(moment()['diff'](encryptor[_0x6af1('0x1f')](_0x41be9d[_0x6af1('0x16')]),_0x6af1('0x20'))>DAYS){logger[_0x6af1('0x13')]('DEMO\x20START\x20AT\x20%s',moment()[_0x6af1('0xa')](_0x6af1('0x1c')));isOldTokenSent=![];return _0x3acabd[_0x6af1('0x1d')]({'data1':_0x42e2e6,'data2':null,'license':null});}}}else{if(_0x41be9d[_0x6af1('0x10')]!=_0x42e2e6){logger['info'](_0x6af1('0x1a'),_0x41be9d['data1'],_0x42e2e6);return _0x3acabd[_0x6af1('0x1d')]({'data1':_0x42e2e6,'data2':null,'license':null});}}}return _0x3acabd;})['then'](function(_0x55ace3){_0x3acabd=_0x55ace3;})['catch'](function(_0x27ffe5){logger[_0x6af1('0x21')](_0x27ffe5[_0x6af1('0x22')]);})[_0x6af1('0x23')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x3acabd);},TIME);});}function defaultLicense(){var _0x500b14=hardware[_0x6af1('0x24')]();if(_0x500b14){return db[_0x6af1('0x25')][_0x6af1('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x500b14}})[_0x6af1('0x27')](function(_0x200f4c,_0x16fbbc){logger[_0x6af1('0x13')](_0x6af1('0x28'),_0x500b14);manageLicense(_0x500b14,_0x200f4c);})[_0x6af1('0xe')](function(_0x16fe9d){logger['error'](_0x16fe9d[_0x6af1('0x22')]);});}}exports[_0x6af1('0x29')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 7f6be85..2213e0d 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 _0x38c9=['deadline','add','grayReason','machineUuid','disabled','data1','message','User','findAll','role','COUNT','sequelize','col','admin','user','users','telephones','forEach','count','countBy','License\x20limit\x20reached\x20for\x20users','telephone','License\x20limit\x20reached\x20for\x20telephones','exports','util','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','%s:%s:%s','gray'];(function(_0x308374,_0x550e85){var _0x1f71e0=function(_0x18377d){while(--_0x18377d){_0x308374['push'](_0x308374['shift']());}};_0x1f71e0(++_0x550e85);}(_0x38c9,0x1ad));var _0x938c=function(_0x5dee2a,_0x47d02a){_0x5dee2a=_0x5dee2a-0x0;var _0x31e98e=_0x38c9[_0x5dee2a];return _0x31e98e;};'use strict';var util=require(_0x938c('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require('bluebird');var hardware=require(_0x938c('0x1'));var encryptor=require(_0x938c('0x2'));var db=require(_0x938c('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x938c('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x938c('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x938c('0x6'),'machineUuid':hardware[_0x938c('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1adf49){return new BPromise(function(_0x306f56,_0x28e779){return db[_0x938c('0x7')][_0x938c('0x8')](_[_0x938c('0x9')](_0x1adf49,{'raw':!![],'where':{'id':0x1}}))[_0x938c('0xa')](function(_0x11f090){return checkLicense(_0x11f090,null);})['then'](function(_0x5b7dd5){_0x306f56(_0x5b7dd5);return;})[_0x938c('0xb')](function(_0x3b84a5){_0x28e779(_0x3b84a5);});});}function checkLicense(_0x278bac,_0x400c79){if(!_0x278bac){demoLicense[_0x938c('0xc')]=_0x278bac['data1'];return demoLicense;}try{var _0x39eb61=_0x400c79||_0x278bac[_0x938c('0xd')];if(_[_0x938c('0xe')](_0x39eb61)){throw new Error(_0x938c('0xf'));}var _0x5e2112=_0x278bac['data1'];var _0x1a7dad=_0x278bac[_0x938c('0x10')];var _0x2769a8=_0x5e2112[_0x938c('0x11')]('-')[0x4];var _0x3b2105=_0x5e2112['split']('-')[0x0];var _0x269c4d=encryptor['decryptString'](_0x39eb61,util[_0x938c('0x12')](_0x938c('0x13'),_0x2769a8,_0x5e2112,_0x3b2105));var _0x5edb7a=JSON['parse'](_0x269c4d);_0x5edb7a['demo']=![];_0x5edb7a[_0x938c('0xc')]=_0x5e2112;_0x5edb7a['machineUuid']=hardware['getUuid']();if(_0x1a7dad){var _0x4b152f=encryptor['decryptString'](_0x1a7dad);_0x5edb7a[_0x938c('0x14')]=_0x4b152f;_0x5edb7a[_0x938c('0x15')]=moment(_0x4b152f)[_0x938c('0x16')](0x7,'days')[_0x938c('0x12')]();_0x5edb7a[_0x938c('0x17')]=_0x5edb7a[_0x938c('0xc')]!=_0x5edb7a[_0x938c('0x18')]?'changed':_0x938c('0x19');}return _0x5edb7a;}catch(_0x29c4b5){breakingLicense[_0x938c('0xc')]=_0x278bac[_0x938c('0x1a')];breakingLicense[_0x938c('0x1b')]=_0x29c4b5['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3355c0,_0x51666c){getLicense()[_0x938c('0xa')](function(_0x2d05ff){return db[_0x938c('0x1c')][_0x938c('0x1d')]({'attributes':[_0x938c('0x1e'),[db['sequelize']['fn'](_0x938c('0x1f'),db[_0x938c('0x20')][_0x938c('0x21')](_0x938c('0x1e'))),'count']],'group':_0x938c('0x1e'),'where':{'role':{'$or':[_0x938c('0x22'),_0x938c('0x23'),'telephone']}},'raw':!![]})[_0x938c('0xa')](function(_0x273d6c){var _0x4eb643={'user':_0x2d05ff[_0x938c('0x24')]||0x0,'telephone':_0x2d05ff[_0x938c('0x25')]||0x0};_0x273d6c[_0x938c('0x26')](function(_0x5de0ea){var _0xe71a5e=_0x5de0ea['role']===_0x938c('0x22')?'user':_0x5de0ea['role'];_0x4eb643[_0xe71a5e]-=_0x5de0ea[_0x938c('0x27')];if(_0x4eb643[_0xe71a5e]<0x0)_0x4eb643[_0xe71a5e]=0x0;});_0x3355c0(_0x4eb643);return;});})[_0x938c('0xb')](function(_0x3cf92a){_0x51666c(_0x3cf92a);});});}function checkUserLimits(_0x50c2db){return new BPromise(function(_0x202207,_0x1121af){getLimits()[_0x938c('0xa')](function(_0x4dcedb){var _0x42b248=_['pick'](_[_0x938c('0x28')](_0x50c2db,_0x938c('0x1e')),[_0x938c('0x22'),_0x938c('0x23'),'telephone']);var _0x3f8388=(_0x42b248['admin']||0x0)+(_0x42b248['user']||0x0);var _0x531ce3=_0x42b248['telephone']||0x0;if(_0x3f8388>_0x4dcedb['user'])return _0x1121af(_0x938c('0x29'));if(_0x531ce3>_0x4dcedb[_0x938c('0x2a')])return _0x1121af(_0x938c('0x2b'));return _0x202207();})['catch'](function(_0x5ef36f){_0x1121af(_0x5ef36f);});});}module[_0x938c('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xe389=['user','telephone','users','telephones','forEach','count','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','bluebird','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','days','changed','disabled','message','User','findAll','role','sequelize','COUNT','admin'];(function(_0x42a571,_0x57321c){var _0x32afaf=function(_0x3318bb){while(--_0x3318bb){_0x42a571['push'](_0x42a571['shift']());}};_0x32afaf(++_0x57321c);}(_0xe389,0x1eb));var _0x9e38=function(_0x246d87,_0x4116fd){_0x246d87=_0x246d87-0x0;var _0x4ef605=_0xe389[_0x246d87];return _0x4ef605;};'use strict';var util=require(_0x9e38('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0x9e38('0x1'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9e38('0x2'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9e38('0x3'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x9e38('0x4'),'machineUuid':hardware[_0x9e38('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x50a49c){return new BPromise(function(_0x552051,_0xed0105){return db[_0x9e38('0x6')][_0x9e38('0x7')](_[_0x9e38('0x8')](_0x50a49c,{'raw':!![],'where':{'id':0x1}}))[_0x9e38('0x9')](function(_0x86bcdd){return checkLicense(_0x86bcdd,null);})[_0x9e38('0x9')](function(_0x2845ce){_0x552051(_0x2845ce);return;})[_0x9e38('0xa')](function(_0x5abd25){_0xed0105(_0x5abd25);});});}function checkLicense(_0x22fef4,_0x3d19a0){if(!_0x22fef4){demoLicense[_0x9e38('0xb')]=_0x22fef4[_0x9e38('0xc')];return demoLicense;}try{var _0xda0a10=_0x3d19a0||_0x22fef4[_0x9e38('0xd')];if(_[_0x9e38('0xe')](_0xda0a10)){throw new Error(_0x9e38('0xf'));}var _0x79881b=_0x22fef4['data1'];var _0x33e1c5=_0x22fef4[_0x9e38('0x10')];var _0x41fbfb=_0x79881b[_0x9e38('0x11')]('-')[0x4];var _0xaf3392=_0x79881b['split']('-')[0x0];var _0x91e19f=encryptor[_0x9e38('0x12')](_0xda0a10,util[_0x9e38('0x13')](_0x9e38('0x14'),_0x41fbfb,_0x79881b,_0xaf3392));var _0x4641e8=JSON[_0x9e38('0x15')](_0x91e19f);_0x4641e8[_0x9e38('0x16')]=![];_0x4641e8[_0x9e38('0xb')]=_0x79881b;_0x4641e8[_0x9e38('0x17')]=hardware[_0x9e38('0x5')]();if(_0x33e1c5){var _0x97bf79=encryptor[_0x9e38('0x12')](_0x33e1c5);_0x4641e8[_0x9e38('0x18')]=_0x97bf79;_0x4641e8[_0x9e38('0x19')]=moment(_0x97bf79)[_0x9e38('0x1a')](0x7,_0x9e38('0x1b'))[_0x9e38('0x13')]();_0x4641e8['grayReason']=_0x4641e8[_0x9e38('0xb')]!=_0x4641e8[_0x9e38('0x17')]?_0x9e38('0x1c'):_0x9e38('0x1d');}return _0x4641e8;}catch(_0x134153){breakingLicense[_0x9e38('0xb')]=_0x22fef4['data1'];breakingLicense[_0x9e38('0x1e')]=_0x134153['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x93dc64,_0x209845){getLicense()[_0x9e38('0x9')](function(_0x5f20ca){return db[_0x9e38('0x1f')][_0x9e38('0x20')]({'attributes':[_0x9e38('0x21'),[db[_0x9e38('0x22')]['fn'](_0x9e38('0x23'),db[_0x9e38('0x22')]['col'](_0x9e38('0x21'))),'count']],'group':_0x9e38('0x21'),'where':{'role':{'$or':[_0x9e38('0x24'),_0x9e38('0x25'),_0x9e38('0x26')]}},'raw':!![]})[_0x9e38('0x9')](function(_0x4192b1){var _0x3e8b9f={'user':_0x5f20ca[_0x9e38('0x27')]||0x0,'telephone':_0x5f20ca[_0x9e38('0x28')]||0x0};_0x4192b1[_0x9e38('0x29')](function(_0x54c8a9){var _0x5cacba=_0x54c8a9[_0x9e38('0x21')]==='admin'?_0x9e38('0x25'):_0x54c8a9['role'];_0x3e8b9f[_0x5cacba]-=_0x54c8a9[_0x9e38('0x2a')];if(_0x3e8b9f[_0x5cacba]<0x0)_0x3e8b9f[_0x5cacba]=0x0;});_0x93dc64(_0x3e8b9f);return;});})[_0x9e38('0xa')](function(_0x482a61){_0x209845(_0x482a61);});});}function checkUserLimits(_0x206dc7){return new BPromise(function(_0x23812f,_0x54fa2f){getLimits()['then'](function(_0x4545c2){var _0x12c987=_[_0x9e38('0x2b')](_[_0x9e38('0x2c')](_0x206dc7,_0x9e38('0x21')),[_0x9e38('0x24'),'user',_0x9e38('0x26')]);var _0x3365e7=(_0x12c987[_0x9e38('0x24')]||0x0)+(_0x12c987[_0x9e38('0x25')]||0x0);var _0x44ea32=_0x12c987[_0x9e38('0x26')]||0x0;if(_0x3365e7>_0x4545c2[_0x9e38('0x25')])return _0x54fa2f(_0x9e38('0x2d'));if(_0x44ea32>_0x4545c2[_0x9e38('0x26')])return _0x54fa2f(_0x9e38('0x2e'));return _0x23812f();})[_0x9e38('0xa')](function(_0x6ab3e1){_0x54fa2f(_0x6ab3e1);});});}module[_0x9e38('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index d22662f..7b7945c 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 _0x8b1a=['myappanuglar-secret','secret','exports','http://localhost:9000'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b1a,0x152));var _0xa8b1=function(_0x568488,_0x55c272){_0x568488=_0x568488-0x0;var _0xdb209a=_0x8b1a[_0x568488];return _0xdb209a;};'use strict';module[_0xa8b1('0x0')]={'DOMAIN':_0xa8b1('0x1'),'SESSION_SECRET':_0xa8b1('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xa8b1('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x05c2=['http://localhost:9000','app-id','secret','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x05c2,0x1ab));var _0x205c=function(_0x24a873,_0x50a107){_0x24a873=_0x24a873-0x0;var _0x5d10b7=_0x05c2[_0x24a873];return _0x5d10b7;};'use strict';module[_0x205c('0x0')]={'DOMAIN':_0x205c('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x205c('0x2'),'GOOGLE_SECRET':_0x205c('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 41e97ec..b82a9cd 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fe7=['join','/var','log','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','toUpperCase','exports','Logger','transports','File','%s-%s','error','info','env','debugLevel','moment','winston','path','INFO'];(function(_0x17eeaa,_0x28f304){var _0x2c53d9=function(_0x269ddf){while(--_0x269ddf){_0x17eeaa['push'](_0x17eeaa['shift']());}};_0x2c53d9(++_0x28f304);}(_0x7fe7,0x104));var _0x77fe=function(_0x349b00,_0x5b58c3){_0x349b00=_0x349b00-0x0;var _0x45744f=_0x7fe7[_0x349b00];return _0x45744f;};'use strict';var moment=require(_0x77fe('0x0'));var winston=require(_0x77fe('0x1'));var util=require('util');var path=require(_0x77fe('0x2'));var debugLevel=_0x77fe('0x3');function filename(_0x54d3ca,_0xbebed6){return path[_0x77fe('0x4')](_0x77fe('0x5'),_0x77fe('0x6'),'xcally',util[_0x77fe('0x7')](_0x77fe('0x8'),_0x54d3ca,_0xbebed6));}function formatter(_0x59988d,_0x21f2ab){_0x21f2ab[_0x77fe('0x9')]=_0x21f2ab['message'][_0x77fe('0xa')](/@@{/g,_0x77fe('0xb'))[_0x77fe('0xa')](/}@@/g,_0x77fe('0xc'))['replace'](/@{/g,'{{')[_0x77fe('0xa')](/}@/g,'}}');return util[_0x77fe('0x7')](_0x77fe('0xd'),moment()[_0x77fe('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),_0x21f2ab['level'][_0x77fe('0xe')](),_0x59988d,_0x21f2ab['message']);}module[_0x77fe('0xf')]=function(_0x11284d){return new winston[(_0x77fe('0x10'))]({'transports':[new winston[(_0x77fe('0x11'))][(_0x77fe('0x12'))]({'name':util[_0x77fe('0x7')](_0x77fe('0x13'),_0x11284d,_0x77fe('0x14')),'filename':filename(_0x11284d,'error'),'level':_0x77fe('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3b8a74){return formatter(_0x11284d,_0x3b8a74);}}),new winston['transports'][(_0x77fe('0x12'))]({'name':util[_0x77fe('0x7')](_0x77fe('0x13'),_0x11284d,'info'),'filename':filename(_0x11284d,'info'),'level':_0x77fe('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xa7a116){return formatter(_0x11284d,_0xa7a116);}}),new winston['transports']['Console']({'level':process[_0x77fe('0x16')][_0x77fe('0x17')]||debugLevel,'json':![],'formatter':function(_0x271dc3){return formatter(_0x11284d,_0x271dc3);}})]});}; \ No newline at end of file +var _0x0878=['toUpperCase','exports','Logger','transports','File','%s-%s','error','info','env','debugLevel','moment','winston','util','INFO','join','/var','format','%s-%s.log','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level'];(function(_0x5c1222,_0x5161bc){var _0x495e2c=function(_0x46c3e0){while(--_0x46c3e0){_0x5c1222['push'](_0x5c1222['shift']());}};_0x495e2c(++_0x5161bc);}(_0x0878,0x12a));var _0x8087=function(_0x3feea9,_0x1a938f){_0x3feea9=_0x3feea9-0x0;var _0x39c3bc=_0x0878[_0x3feea9];return _0x39c3bc;};'use strict';var moment=require(_0x8087('0x0'));var winston=require(_0x8087('0x1'));var util=require(_0x8087('0x2'));var path=require('path');var debugLevel=_0x8087('0x3');function filename(_0x17984e,_0x318004){return path[_0x8087('0x4')](_0x8087('0x5'),'log','xcally',util[_0x8087('0x6')](_0x8087('0x7'),_0x17984e,_0x318004));}function formatter(_0x4b5709,_0x2112c8){_0x2112c8['message']=_0x2112c8[_0x8087('0x8')]['replace'](/@@{/g,_0x8087('0x9'))[_0x8087('0xa')](/}@@/g,_0x8087('0xb'))[_0x8087('0xa')](/@{/g,'{{')[_0x8087('0xa')](/}@/g,'}}');return util[_0x8087('0x6')](_0x8087('0xc'),moment()[_0x8087('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),_0x2112c8[_0x8087('0xd')][_0x8087('0xe')](),_0x4b5709,_0x2112c8['message']);}module[_0x8087('0xf')]=function(_0x25f1b8){return new winston[(_0x8087('0x10'))]({'transports':[new winston[(_0x8087('0x11'))][(_0x8087('0x12'))]({'name':util[_0x8087('0x6')](_0x8087('0x13'),_0x25f1b8,_0x8087('0x14')),'filename':filename(_0x25f1b8,'error'),'level':_0x8087('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5ab8eb){return formatter(_0x25f1b8,_0x5ab8eb);}}),new winston[(_0x8087('0x11'))][(_0x8087('0x12'))]({'name':util['format']('%s-%s',_0x25f1b8,_0x8087('0x15')),'filename':filename(_0x25f1b8,'info'),'level':_0x8087('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x48e9f7){return formatter(_0x25f1b8,_0x48e9f7);}}),new winston[(_0x8087('0x11'))]['Console']({'level':process[_0x8087('0x16')][_0x8087('0x17')]||debugLevel,'json':![],'formatter':function(_0x29b40a){return formatter(_0x25f1b8,_0x29b40a);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 1c9a380..4090925 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 _0x6475=['express','join','ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/xdr/index.js','exports','path'];(function(_0x588666,_0xa70f53){var _0x588c67=function(_0x4ac6e7){while(--_0x4ac6e7){_0x588666['push'](_0x588666['shift']());}};_0x588c67(++_0xa70f53);}(_0x6475,0x133));var _0x5647=function(_0x569f9a,_0x58cc03){_0x569f9a=_0x569f9a-0x0;var _0x33cafb=_0x6475[_0x569f9a];return _0x33cafb;};'use strict';var path=require(_0x5647('0x0'));var os=require('os');var config={'apps':[{'name':_0x5647('0x1'),'script':path[_0x5647('0x2')](__dirname,'../../services/express/index.js')},{'name':_0x5647('0x3'),'script':path[_0x5647('0x2')](__dirname,_0x5647('0x4'))},{'name':'agi','script':path[_0x5647('0x2')](__dirname,_0x5647('0x5'))},{'name':_0x5647('0x6'),'script':path['join'](__dirname,_0x5647('0x7'))},{'name':_0x5647('0x8'),'script':path['join'](__dirname,'../../services/routing/index.js')},{'name':'xdr','script':path[_0x5647('0x2')](__dirname,_0x5647('0x9'))}]};module[_0x5647('0xa')]=config; \ No newline at end of file +var _0x2401=['../../services/routing/index.js','xdr','path','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','email','../../services/email/index.js','routing'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2401,0x1af));var _0x1240=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2401[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0x1240('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x1240('0x1')](__dirname,_0x1240('0x2'))},{'name':_0x1240('0x3'),'script':path[_0x1240('0x1')](__dirname,_0x1240('0x4'))},{'name':_0x1240('0x5'),'script':path[_0x1240('0x1')](__dirname,'../../services/agi/index.js')},{'name':_0x1240('0x6'),'script':path[_0x1240('0x1')](__dirname,_0x1240('0x7'))},{'name':_0x1240('0x8'),'script':path[_0x1240('0x1')](__dirname,_0x1240('0x9'))},{'name':_0x1240('0xa'),'script':path['join'](__dirname,'../../services/xdr/index.js')}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index d7813ec..1253d18 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 _0x29ae=['connect','connected','then','start','stop','restart','disconnect','list','describe','delete','dump','pm2'];(function(_0x111ee2,_0x392608){var _0x23c20f=function(_0x39c2ee){while(--_0x39c2ee){_0x111ee2['push'](_0x111ee2['shift']());}};_0x23c20f(++_0x392608);}(_0x29ae,0x167));var _0xe29a=function(_0x2f1d0f,_0x5e8872){_0x2f1d0f=_0x2f1d0f-0x0;var _0x4ad42f=_0x29ae[_0x2f1d0f];return _0x4ad42f;};'use strict';var pm2=require(_0xe29a('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x58cf98,_0x13c39c){return pm2[_0xe29a('0x1')](function(_0x597afa){if(_0x597afa){return _0x13c39c(_0x597afa);}return _0x58cf98(_0xe29a('0x2'));});});};exports['start']=function(_0x45d583){return connect()[_0xe29a('0x3')](function(){return new BPromise(function(_0x104a18,_0x58d852){return pm2[_0xe29a('0x4')](_0x45d583,function(_0xb003c,_0x5dbd0c){if(_0xb003c){return _0x58d852(_0xb003c);}pm2['disconnect']();return _0x104a18(_0x5dbd0c);});});});};exports[_0xe29a('0x5')]=function(_0x43a0ae){return connect()[_0xe29a('0x3')](function(){return new BPromise(function(_0x40f36d,_0x428c0){return pm2[_0xe29a('0x5')](_0x43a0ae,function(_0x4d066b,_0x45b177){if(_0x4d066b){return _0x428c0(_0x4d066b);}pm2['disconnect']();return _0x40f36d(_0x45b177);});});});};exports[_0xe29a('0x6')]=function(_0x341074){return connect()[_0xe29a('0x3')](function(){return new BPromise(function(_0xdffe5a,_0xc91503){return pm2[_0xe29a('0x6')](_0x341074,function(_0x293679,_0x210dcc){if(_0x293679){return _0xc91503(_0x293679);}pm2[_0xe29a('0x7')]();return _0xdffe5a(_0x210dcc);});});});};exports[_0xe29a('0x8')]=function(){return connect()[_0xe29a('0x3')](function(){return new BPromise(function(_0x3c9bc9,_0x5573bb){return pm2[_0xe29a('0x8')](function(_0x3282a5,_0x54817c){if(_0x3282a5){return _0x5573bb(_0x3282a5);}pm2[_0xe29a('0x7')]();return _0x3c9bc9(_0x54817c);});});});};exports[_0xe29a('0x9')]=function(_0x2904aa){return connect()[_0xe29a('0x3')](function(){return new BPromise(function(_0xdd0d3b,_0x84ba57){return pm2[_0xe29a('0x9')](_0x2904aa,function(_0x3c15ab,_0x38c2f9){if(_0x3c15ab){return _0x84ba57(_0x3c15ab);}pm2[_0xe29a('0x7')]();return _0xdd0d3b(_0x38c2f9);});});});};exports['delete']=function(_0x3e411a){return connect()[_0xe29a('0x3')](function(){return new BPromise(function(_0xae774a,_0x17268d){return pm2[_0xe29a('0xa')](_0x3e411a,function(_0x3a1913,_0x120e81){if(_0x3a1913){return _0x17268d(_0x3a1913);}pm2[_0xe29a('0x7')]();return _0xae774a(_0x120e81);});});});};exports[_0xe29a('0xb')]=function(){return connect()[_0xe29a('0x3')](function(){return new BPromise(function(_0x5f46f8,_0x384c81){return pm2['dump'](function(_0x2955ae){if(_0x2955ae){return _0x384c81(_0x2955ae);}return _0x5f46f8('saved');});});});}; \ No newline at end of file +var _0x53ec=['connected','then','stop','disconnect','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect'];(function(_0xcc0c27,_0x1f26ae){var _0x4cf1d4=function(_0x3c8862){while(--_0x3c8862){_0xcc0c27['push'](_0xcc0c27['shift']());}};_0x4cf1d4(++_0x1f26ae);}(_0x53ec,0x192));var _0xc53e=function(_0x25483f,_0x43852f){_0x25483f=_0x25483f-0x0;var _0x220d13=_0x53ec[_0x25483f];return _0x220d13;};'use strict';var pm2=require(_0xc53e('0x0'));var BPromise=require(_0xc53e('0x1'));var config=require(_0xc53e('0x2'));function connect(){return new BPromise(function(_0x476d3a,_0x1b04cc){return pm2[_0xc53e('0x3')](function(_0x51c435){if(_0x51c435){return _0x1b04cc(_0x51c435);}return _0x476d3a(_0xc53e('0x4'));});});};exports['start']=function(_0x2b90f6){return connect()[_0xc53e('0x5')](function(){return new BPromise(function(_0x4a9c59,_0x2f1414){return pm2['start'](_0x2b90f6,function(_0x41a9e8,_0x2de88b){if(_0x41a9e8){return _0x2f1414(_0x41a9e8);}pm2['disconnect']();return _0x4a9c59(_0x2de88b);});});});};exports[_0xc53e('0x6')]=function(_0x1ac6c0){return connect()[_0xc53e('0x5')](function(){return new BPromise(function(_0x2cb51d,_0xd9612){return pm2[_0xc53e('0x6')](_0x1ac6c0,function(_0xd82002,_0x361e9d){if(_0xd82002){return _0xd9612(_0xd82002);}pm2[_0xc53e('0x7')]();return _0x2cb51d(_0x361e9d);});});});};exports['restart']=function(_0x57e818){return connect()[_0xc53e('0x5')](function(){return new BPromise(function(_0x5a2da7,_0x54e3ba){return pm2[_0xc53e('0x8')](_0x57e818,function(_0x9ffbcb,_0x863fa){if(_0x9ffbcb){return _0x54e3ba(_0x9ffbcb);}pm2[_0xc53e('0x7')]();return _0x5a2da7(_0x863fa);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x1c06cd,_0x19a772){return pm2[_0xc53e('0x9')](function(_0x3d2e17,_0x358ef3){if(_0x3d2e17){return _0x19a772(_0x3d2e17);}pm2[_0xc53e('0x7')]();return _0x1c06cd(_0x358ef3);});});});};exports[_0xc53e('0xa')]=function(_0x19c0d1){return connect()[_0xc53e('0x5')](function(){return new BPromise(function(_0x2ad6eb,_0x5b0a88){return pm2[_0xc53e('0xa')](_0x19c0d1,function(_0x191567,_0x535cd4){if(_0x191567){return _0x5b0a88(_0x191567);}pm2[_0xc53e('0x7')]();return _0x2ad6eb(_0x535cd4);});});});};exports[_0xc53e('0xb')]=function(_0x270c78){return connect()[_0xc53e('0x5')](function(){return new BPromise(function(_0x2d4ebb,_0x3b550e){return pm2['delete'](_0x270c78,function(_0x546fab,_0x35b7b2){if(_0x546fab){return _0x3b550e(_0x546fab);}pm2[_0xc53e('0x7')]();return _0x2d4ebb(_0x35b7b2);});});});};exports[_0xc53e('0xc')]=function(){return connect()[_0xc53e('0x5')](function(){return new BPromise(function(_0x20066e,_0x2cfe2b){return pm2[_0xc53e('0xc')](function(_0x25702b){if(_0x25702b){return _0x2cfe2b(_0x25702b);}return _0x20066e(_0xc53e('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index fb742df..b109899 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 _0x7ccd=['then','ChatInteraction','findAll','lastMsgAt','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','socket.io-emitter','Setting','chatTimeout'];(function(_0xfd6f01,_0x30347c){var _0x38770a=function(_0x1230f0){while(--_0x1230f0){_0xfd6f01['push'](_0xfd6f01['shift']());}};_0x38770a(++_0x30347c);}(_0x7ccd,0x10b));var _0xd7cc=function(_0x3b55c7,_0x448d5b){_0x3b55c7=_0x3b55c7-0x0;var _0x56d2ed=_0x7ccd[_0x3b55c7];return _0x56d2ed;};'use strict';var _=require(_0xd7cc('0x0'));var moment=require(_0xd7cc('0x1'));var Redis=require(_0xd7cc('0x2'));var util=require(_0xd7cc('0x3'));var config=require(_0xd7cc('0x4'));var db=require(_0xd7cc('0x5'))['db'];var logger=require(_0xd7cc('0x6'))('schedule');config[_0xd7cc('0x7')]=_[_0xd7cc('0x8')](config[_0xd7cc('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xd7cc('0x9'))(new Redis(config[_0xd7cc('0x7')]));function closeInteractions(){var _0x47104b=0x0;var _0x3d52b7=[];return db[_0xd7cc('0xa')]['find']({'raw':!![],'attributes':['id',_0xd7cc('0xb')],'where':{'id':0x1}})[_0xd7cc('0xc')](function(_0x598d79){_0x47104b=_0x598d79[_0xd7cc('0xb')];if(_0x47104b){return db[_0xd7cc('0xd')][_0xd7cc('0xe')]({'raw':!![],'attributes':['id',_0xd7cc('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x598d79['chatTimeout'],'minutes')}}});}else{return[];}})[_0xd7cc('0xc')](function(_0x55815a){if(_0x55815a&&_0x55815a[_0xd7cc('0x10')]){_0x3d52b7=_[_0xd7cc('0x11')](_0x55815a||[],'id');logger[_0xd7cc('0x12')](_0xd7cc('0x13'),_0x3d52b7[_0xd7cc('0x14')]());return db[_0xd7cc('0xd')][_0xd7cc('0x15')]({'closeReason':'system','disposition':_0xd7cc('0x16'),'closed':!![],'closedAt':moment()[_0xd7cc('0x17')](_0xd7cc('0x18'))},{'where':{'id':_0x3d52b7}});}})[_0xd7cc('0xc')](function(){if(_0x3d52b7&&_0x3d52b7[_0xd7cc('0x10')]){logger[_0xd7cc('0x12')](_0xd7cc('0x19'),_0x3d52b7[_0xd7cc('0x14')]());for(var _0x11852f=0x0;_0x11852f<_0x3d52b7[_0xd7cc('0x10')];_0x11852f++){io['emit']('chatInteraction:update',{'id':_0x3d52b7[_0x11852f],'closed':!![]});}}})[_0xd7cc('0x1a')](function(_0x5aa919){logger[_0xd7cc('0x1b')](_0xd7cc('0x1c'),_0x5aa919?util[_0xd7cc('0x1d')](_0x5aa919,{'showHidden':![],'depth':null}):'');});}exports[_0xd7cc('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xcbfa=['../../config/environment','../../mysqldb','redis','localhost','find','then','ChatInteraction','findAll','subtract','minutes','map','info','update','system','timeout','format','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','util'];(function(_0x1aeade,_0x1d1933){var _0x50690c=function(_0xb931ba){while(--_0xb931ba){_0x1aeade['push'](_0x1aeade['shift']());}};_0x50690c(++_0x1d1933);}(_0xcbfa,0x15d));var _0xacbf=function(_0x52bbc9,_0xb342e0){_0x52bbc9=_0x52bbc9-0x0;var _0x5909d0=_0xcbfa[_0x52bbc9];return _0x5909d0;};'use strict';var _=require('lodash');var moment=require(_0xacbf('0x0'));var Redis=require('ioredis');var util=require(_0xacbf('0x1'));var config=require(_0xacbf('0x2'));var db=require(_0xacbf('0x3'))['db'];var logger=require('../logger')('schedule');config['redis']=_['defaults'](config[_0xacbf('0x4')],{'host':_0xacbf('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xacbf('0x4')]));function closeInteractions(){var _0x270349=0x0;var _0x407632=[];return db['Setting'][_0xacbf('0x6')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xacbf('0x7')](function(_0xc6c089){_0x270349=_0xc6c089['chatTimeout'];if(_0x270349){return db[_0xacbf('0x8')][_0xacbf('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xacbf('0xa')](_0xc6c089['chatTimeout'],_0xacbf('0xb'))}}});}else{return[];}})['then'](function(_0x57e0ba){if(_0x57e0ba&&_0x57e0ba['length']){_0x407632=_[_0xacbf('0xc')](_0x57e0ba||[],'id');logger[_0xacbf('0xd')]('[CHAT]\x20Interactions\x20to\x20close:',_0x407632['join']());return db[_0xacbf('0x8')][_0xacbf('0xe')]({'closeReason':_0xacbf('0xf'),'disposition':_0xacbf('0x10'),'closed':!![],'closedAt':moment()[_0xacbf('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x407632}});}})['then'](function(){if(_0x407632&&_0x407632[_0xacbf('0x12')]){logger[_0xacbf('0xd')](_0xacbf('0x13'),_0x407632[_0xacbf('0x14')]());for(var _0xc68cc1=0x0;_0xc68cc1<_0x407632['length'];_0xc68cc1++){io[_0xacbf('0x15')](_0xacbf('0x16'),{'id':_0x407632[_0xc68cc1],'closed':!![]});}}})[_0xacbf('0x17')](function(_0xb83359){logger['error'](_0xacbf('0x18'),_0xb83359?util[_0xacbf('0x19')](_0xb83359,{'showHidden':![],'depth':null}):'');});}exports[_0xacbf('0x1a')]=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 fdd20d4..b1fd1a9 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 _0x245f=['path','lodash','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','\x22%s\x22\x20<%s>','name','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','Sent','message','text','stringify','existsSync','status','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','MailServerOut','jobs','toString','keyBy','difference','intersection','length','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','endAt','start','stop','stop\x20cron','exists','update\x20cron','run'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x245f,0x114));var _0xf245=function(_0x1a9e0a,_0x43a0c1){_0x1a9e0a=_0x1a9e0a-0x0;var _0x2e7bcb=_0x245f[_0x1a9e0a];return _0x2e7bcb;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xf245('0x0'));var _=require(_0xf245('0x1'));var moment=require(_0xf245('0x2'));var CronJobManager=require(_0xf245('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0xf245('0x4'));var logger=require(_0xf245('0x5'))(_0xf245('0x6'));var db=require(_0xf245('0x7'))['db'];var analyticCustomReportController=require(_0xf245('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xf245('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x32e409,_0x5961f9){return function(){logger[_0xf245('0xa')](_0xf245('0xb'),_0x32e409[_0xf245('0xc')]);var _0x548875=!![];var _0x7e7108={'tls':{'rejectUnauthorized':![]}};if(_0x32e409[_0xf245('0xd')][_0xf245('0xe')][_0xf245('0xf')]){_0x7e7108[_0xf245('0xf')]=_0x32e409['MailAccount']['Smtp'][_0xf245('0xf')];}else{_0x7e7108['host']=_0x32e409[_0xf245('0xd')][_0xf245('0xe')][_0xf245('0x10')];_0x7e7108[_0xf245('0x11')]=_0x32e409[_0xf245('0xd')][_0xf245('0xe')][_0xf245('0x11')];_0x7e7108['secure']=_0x32e409[_0xf245('0xd')]['Smtp'][_0xf245('0x12')];}if(_0x32e409[_0xf245('0xd')][_0xf245('0xe')][_0xf245('0x13')]){_0x7e7108[_0xf245('0x14')]={'user':_0x32e409['MailAccount'][_0xf245('0xe')][_0xf245('0x15')],'pass':_0x32e409[_0xf245('0xd')][_0xf245('0xe')][_0xf245('0x16')]};}var _0x4053fc={'account':_0x7e7108,'message':{'from':util['format'](_0xf245('0x17'),_0x32e409['MailAccount'][_0xf245('0x18')],_0x32e409['MailAccount'][_0xf245('0xc')]||_0x32e409[_0xf245('0xd')]['Smtp'][_0xf245('0x15')]),'to':_0x32e409[_0xf245('0xc')],'cc':_0x32e409['cc'],'bcc':_0x32e409[_0xf245('0x19')],'subject':util[_0xf245('0x1a')](_0xf245('0x1b'),_0x5961f9[_0xf245('0x18')],_0x32e409['subtractNumber'],_0x32e409[_0xf245('0x1c')])}};var _0x24130d=path[_0xf245('0x1d')](__dirname,_0xf245('0x1e'));var _0x591a47=_0x5961f9[_0xf245('0x1f')];var _0x2009e0=util[_0xf245('0x1a')](_0xf245('0x20'),path[_0xf245('0x21')](_0x5961f9[_0xf245('0x1f')],path[_0xf245('0x22')](_0x5961f9[_0xf245('0x1f')])),_0xf245('0x23'));var _0xe40df1=path[_0xf245('0x1d')](_0x24130d,_0x591a47);var _0x12b48c=path[_0xf245('0x1d')](_0x24130d,_0x2009e0);if(fs['existsSync'](_0xe40df1)){_0x5961f9['status']=_0xf245('0x24');_0x4053fc['message']['attachments']=[{'filename':_0x591a47,'path':_0xe40df1}];_0x4053fc[_0xf245('0x25')][_0xf245('0x26')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xf245('0x27')](_0x5961f9,null,0x2));}else if(fs[_0xf245('0x28')](_0x12b48c)){_0x5961f9[_0xf245('0x29')]='Sent';_0x4053fc[_0xf245('0x25')][_0xf245('0x2a')]=[{'filename':_0x2009e0,'path':_0x12b48c}];}else{_0x4053fc['message'][_0xf245('0x26')]=_0xf245('0x2b');if(!_0x32e409[_0xf245('0x2c')]){_0x548875=![];logger[_0xf245('0xa')](_0xf245('0x2d'));}}if(_0x548875){return client[_0xf245('0x2e')](_0xf245('0x2f'),_0x4053fc)[_0xf245('0x30')](function(_0x480999){if(_0x480999[_0xf245('0x31')]){return logger['error'](_0xf245('0x32'),JSON[_0xf245('0x27')](_0x480999));}return logger['info'](_0xf245('0x33'));})[_0xf245('0x34')](function(_0x418a63){return logger['error'](_0xf245('0x32'),JSON[_0xf245('0x27')](_0x418a63));});}};}function handleError(){return function(_0x4031a4){return logger['error'](JSON[_0xf245('0x27')](_0x4031a4));};}function handleResult(_0x4685ed){return function(_0x435eaf){logger[_0xf245('0xa')](_0xf245('0x35'),JSON[_0xf245('0x27')](_0x435eaf));if(_0x4685ed[_0xf245('0xd')]&&_0x4685ed[_0xf245('0xd')][_0xf245('0xe')]&&!_[_0xf245('0x36')](_0x4685ed['email'])){setTimeout(handleSendEmail(_0x4685ed,_0x435eaf),0x3c*0x3e8);}};}function handleJob(_0x49ce15){return function(){try{if(_[_0xf245('0x36')](_0x49ce15[_0xf245('0x37')])){return logger[_0xf245('0xa')](_0xf245('0x38'));}if(_[_0xf245('0x36')](_0x49ce15[_0xf245('0x1c')])){return logger[_0xf245('0xa')](_0xf245('0x39'));}var _0x4ef5eb={'startDate':moment()['subtract'](_0x49ce15[_0xf245('0x37')],_0x49ce15[_0xf245('0x1c')])['format'](_0xf245('0x3a')),'endDate':moment()['format'](_0xf245('0x3a')),'type':_0xf245('0x3b'),'output':_0x49ce15[_0xf245('0x3c')],'name':_0x49ce15[_0xf245('0x18')]};if(!_['isNil'](_0x49ce15['DefaultReportId'])){logger[_0xf245('0xa')](_0xf245('0x3d'),_0x49ce15['DefaultReportId']);return analyticDefaultReportController[_0xf245('0x3e')]({'id':_0x49ce15[_0xf245('0x3f')]},_0x4ef5eb)[_0xf245('0x30')](handleResult(_0x49ce15))[_0xf245('0x34')](handleError());}if(!_[_0xf245('0x36')](_0x49ce15[_0xf245('0x40')])){logger[_0xf245('0xa')](_0xf245('0x41'),_0x49ce15['CustomReportId']);return analyticCustomReportController[_0xf245('0x3e')]({'id':_0x49ce15['CustomReportId']},_0x4ef5eb)[_0xf245('0x30')](handleResult(_0x49ce15))[_0xf245('0x34')](handleError());}}catch(_0x17a675){logger['error'](JSON[_0xf245('0x27')](_0x17a675));}return logger[_0xf245('0xa')](_0xf245('0x42'));};}function getJobs(_0xae083d){var _0x225292={};if(_0xae083d){_0x225292['id']=_0xae083d;}return db['Schedule'][_0xf245('0x43')]({'where':_0x225292,'include':[{'model':db['MailAccount'],'attributes':['id',_0xf245('0x18'),_0xf245('0xc')],'include':[{'model':db[_0xf245('0x44')],'as':_0xf245('0xe')}]}]})['then'](function(_0x45393e){var _0x555010=_['keys'](manager[_0xf245('0x45')]);var _0x56ba92=_['map'](_0x45393e,function(_0x2e2671){return _0x2e2671['id'][_0xf245('0x46')]();});var _0x19049a=_[_0xf245('0x47')](_0x45393e,function(_0x1fa7de){return _0x1fa7de['id']['toString']();});var _0x137522=_0xae083d?_0x56ba92:_[_0xf245('0x48')](_0x56ba92,_0x555010);var _0x3ce261=_[_0xf245('0x49')](_0x56ba92,_0x555010);var _0x3dee71=_[_0xf245('0x48')](_0x555010,_0x56ba92);var _0x5c0d3e;var _0x2c4ba1;for(_0x5c0d3e=0x0;_0x5c0d3e<_0x3dee71[_0xf245('0x4a')]&&!_0xae083d;_0x5c0d3e+=0x1){_0x2c4ba1=_0x3dee71[_0x5c0d3e][_0xf245('0x46')]();if(manager['exists'](_0x2c4ba1)){manager['stop'](_0x2c4ba1);manager[_0xf245('0x4b')](_0x2c4ba1);logger['info'](_0xf245('0x4c'),_0x2c4ba1);}}logger['info'](_0xf245('0x4d'),JSON['stringify'](_0x137522));for(_0x5c0d3e=0x0;_0x5c0d3e<_0x137522['length'];_0x5c0d3e+=0x1){_0x2c4ba1=_0x137522[_0x5c0d3e][_0xf245('0x46')]();logger[_0xf245('0xa')](_0xf245('0x4e'),_0x2c4ba1);if(_0xae083d){logger[_0xf245('0xa')](_0xf245('0x4f'),_0xae083d);logger[_0xf245('0xa')](JSON[_0xf245('0x27')](_0x19049a[_0x2c4ba1]));BPromise[_0xf245('0x50')]()[_0xf245('0x30')](handleJob(_0x19049a[_0x2c4ba1]));logger[_0xf245('0xa')](_0xf245('0x51'),_0x19049a[_0x2c4ba1][_0xf245('0x18')],_0x19049a[_0x2c4ba1][_0xf245('0x52')]);}else if(_0x19049a[_0x2c4ba1]['cron']&&_0x19049a[_0x2c4ba1][_0xf245('0x53')]&&moment()[_0xf245('0x54')](_0x19049a[_0x2c4ba1]['startAt'],_0x19049a[_0x2c4ba1][_0xf245('0x55')])){manager['add'](_0x2c4ba1,_0x19049a[_0x2c4ba1]['cron'],handleJob(_0x19049a[_0x2c4ba1]));manager[_0xf245('0x56')](_0x2c4ba1);logger['info']('add\x20cron',_0x19049a[_0x2c4ba1]['name'],_0x19049a[_0x2c4ba1]['cron']);}else if(manager['exists'](_0x2c4ba1)){manager[_0xf245('0x57')](_0x2c4ba1);manager['deleteJob'](_0x2c4ba1);logger[_0xf245('0xa')](_0xf245('0x58'),_0x19049a[_0x2c4ba1][_0xf245('0x18')],_0x19049a[_0x2c4ba1]['cron']);}}for(_0x5c0d3e=0x0,_0x2c4ba1;_0x5c0d3e<_0x3ce261[_0xf245('0x4a')]&&!_0xae083d;_0x5c0d3e+=0x1){_0x2c4ba1=_0x3ce261[_0x5c0d3e][_0xf245('0x46')]();if(manager[_0xf245('0x59')](_0x2c4ba1)){if(_0x19049a[_0x2c4ba1]['cron']&&_0x19049a[_0x2c4ba1]['active']&&moment()[_0xf245('0x54')](_0x19049a[_0x2c4ba1]['startAt'],_0x19049a[_0x2c4ba1]['endAt'])){manager['update'](_0x2c4ba1,_0x19049a[_0x2c4ba1][_0xf245('0x52')],handleJob(_0x19049a[_0x2c4ba1]));logger[_0xf245('0xa')](_0xf245('0x5a'),_0x19049a[_0x2c4ba1][_0xf245('0x18')],_0x19049a[_0x2c4ba1]['cron']);}else{manager[_0xf245('0x57')](_0x2c4ba1);manager[_0xf245('0x4b')](_0x2c4ba1);logger['info']('stop\x20cron',_0x19049a[_0x2c4ba1][_0xf245('0x18')],_0x19049a[_0x2c4ba1][_0xf245('0x52')]);}}}})['catch'](function(_0x38a727){logger[_0xf245('0x31')](JSON[_0xf245('0x27')](_0x38a727));});}exports[_0xf245('0x5b')]=function(_0x2887d2){return getJobs(_0x2887d2);};exports[_0xf245('0x56')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x2ca8=['Schedule','MailServerOut','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','my\x20id','cron','active','isBetween','endAt','add','start','add\x20cron','startAt','update\x20cron','stop\x20cron','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','http','Try\x20to\x20send\x20a\x20mail\x20to','email','service','MailAccount','Smtp','host','secure','auth','user','format','\x22%s\x22\x20<%s>','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','status','message','attachments','text','stringify','Sent','sendIfEmpty','info','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','runReport'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x2ca8,0x6d));var _0x82ca=function(_0x4c1a53,_0x1ff473){_0x4c1a53=_0x4c1a53-0x0;var _0x1b025b=_0x2ca8[_0x4c1a53];return _0x1b025b;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x82ca('0x0'));var _=require(_0x82ca('0x1'));var moment=require(_0x82ca('0x2'));var CronJobManager=require(_0x82ca('0x3'));var jayson=require(_0x82ca('0x4'));var BPromise=require(_0x82ca('0x5'));var logger=require(_0x82ca('0x6'))('schedule');var db=require(_0x82ca('0x7'))['db'];var analyticCustomReportController=require(_0x82ca('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0x82ca('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xd0c499,_0x1b0519){return function(){logger['info'](_0x82ca('0xa'),_0xd0c499[_0x82ca('0xb')]);var _0x12e444=!![];var _0x4ae986={'tls':{'rejectUnauthorized':![]}};if(_0xd0c499['MailAccount']['Smtp']['service']){_0x4ae986[_0x82ca('0xc')]=_0xd0c499[_0x82ca('0xd')][_0x82ca('0xe')][_0x82ca('0xc')];}else{_0x4ae986[_0x82ca('0xf')]=_0xd0c499[_0x82ca('0xd')][_0x82ca('0xe')][_0x82ca('0xf')];_0x4ae986['port']=_0xd0c499[_0x82ca('0xd')][_0x82ca('0xe')]['port'];_0x4ae986[_0x82ca('0x10')]=_0xd0c499[_0x82ca('0xd')]['Smtp'][_0x82ca('0x10')];}if(_0xd0c499[_0x82ca('0xd')][_0x82ca('0xe')]['authentication']){_0x4ae986[_0x82ca('0x11')]={'user':_0xd0c499[_0x82ca('0xd')]['Smtp'][_0x82ca('0x12')],'pass':_0xd0c499[_0x82ca('0xd')][_0x82ca('0xe')]['pass']};}var _0x5f31aa={'account':_0x4ae986,'message':{'from':util[_0x82ca('0x13')](_0x82ca('0x14'),_0xd0c499[_0x82ca('0xd')]['name'],_0xd0c499[_0x82ca('0xd')][_0x82ca('0xb')]||_0xd0c499['MailAccount'][_0x82ca('0xe')][_0x82ca('0x12')]),'to':_0xd0c499[_0x82ca('0xb')],'cc':_0xd0c499['cc'],'bcc':_0xd0c499[_0x82ca('0x15')],'subject':util[_0x82ca('0x13')](_0x82ca('0x16'),_0x1b0519[_0x82ca('0x17')],_0xd0c499[_0x82ca('0x18')],_0xd0c499[_0x82ca('0x19')])}};var _0xd2bbea=path[_0x82ca('0x1a')](__dirname,_0x82ca('0x1b'));var _0x4b5464=_0x1b0519[_0x82ca('0x1c')];var _0x46c8b6=util[_0x82ca('0x13')](_0x82ca('0x1d'),path[_0x82ca('0x1e')](_0x1b0519[_0x82ca('0x1c')],path[_0x82ca('0x1f')](_0x1b0519[_0x82ca('0x1c')])),_0x82ca('0x20'));var _0xede6ef=path[_0x82ca('0x1a')](_0xd2bbea,_0x4b5464);var _0xb8c25=path[_0x82ca('0x1a')](_0xd2bbea,_0x46c8b6);if(fs['existsSync'](_0xede6ef)){_0x1b0519[_0x82ca('0x21')]='Sent';_0x5f31aa[_0x82ca('0x22')][_0x82ca('0x23')]=[{'filename':_0x4b5464,'path':_0xede6ef}];_0x5f31aa[_0x82ca('0x22')][_0x82ca('0x24')]=util[_0x82ca('0x13')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x82ca('0x25')](_0x1b0519,null,0x2));}else if(fs['existsSync'](_0xb8c25)){_0x1b0519[_0x82ca('0x21')]=_0x82ca('0x26');_0x5f31aa[_0x82ca('0x22')][_0x82ca('0x23')]=[{'filename':_0x46c8b6,'path':_0xb8c25}];}else{_0x5f31aa[_0x82ca('0x22')][_0x82ca('0x24')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0xd0c499[_0x82ca('0x27')]){_0x12e444=![];logger[_0x82ca('0x28')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x12e444){return client[_0x82ca('0x29')](_0x82ca('0x2a'),_0x5f31aa)[_0x82ca('0x2b')](function(_0x23ab31){if(_0x23ab31['error']){return logger[_0x82ca('0x2c')](_0x82ca('0x2d'),JSON[_0x82ca('0x25')](_0x23ab31));}return logger[_0x82ca('0x28')](_0x82ca('0x2e'));})[_0x82ca('0x2f')](function(_0x283cc2){return logger[_0x82ca('0x2c')](_0x82ca('0x2d'),JSON[_0x82ca('0x25')](_0x283cc2));});}};}function handleError(){return function(_0x2689eb){return logger[_0x82ca('0x2c')](JSON['stringify'](_0x2689eb));};}function handleResult(_0x39e737){return function(_0x2c8127){logger['info'](_0x82ca('0x30'),JSON[_0x82ca('0x25')](_0x2c8127));if(_0x39e737[_0x82ca('0xd')]&&_0x39e737[_0x82ca('0xd')][_0x82ca('0xe')]&&!_[_0x82ca('0x31')](_0x39e737[_0x82ca('0xb')])){setTimeout(handleSendEmail(_0x39e737,_0x2c8127),0x3c*0x3e8);}};}function handleJob(_0x3d719a){return function(){try{if(_[_0x82ca('0x31')](_0x3d719a['subtractNumber'])){return logger[_0x82ca('0x28')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x82ca('0x31')](_0x3d719a[_0x82ca('0x19')])){return logger['info'](_0x82ca('0x32'));}var _0x410ab7={'startDate':moment()[_0x82ca('0x33')](_0x3d719a[_0x82ca('0x18')],_0x3d719a[_0x82ca('0x19')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x82ca('0x13')](_0x82ca('0x34')),'type':_0x82ca('0x35'),'output':_0x3d719a[_0x82ca('0x36')],'name':_0x3d719a['name']};if(!_[_0x82ca('0x31')](_0x3d719a[_0x82ca('0x37')])){logger['info'](_0x82ca('0x38'),_0x3d719a['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x3d719a[_0x82ca('0x37')]},_0x410ab7)[_0x82ca('0x2b')](handleResult(_0x3d719a))[_0x82ca('0x2f')](handleError());}if(!_[_0x82ca('0x31')](_0x3d719a['CustomReportId'])){logger[_0x82ca('0x28')]('exec\x20custom\x20report\x20id:%s',_0x3d719a[_0x82ca('0x39')]);return analyticCustomReportController[_0x82ca('0x3a')]({'id':_0x3d719a[_0x82ca('0x39')]},_0x410ab7)[_0x82ca('0x2b')](handleResult(_0x3d719a))[_0x82ca('0x2f')](handleError());}}catch(_0x13f676){logger[_0x82ca('0x2c')](JSON['stringify'](_0x13f676));}return logger[_0x82ca('0x28')]('no\x20report\x20id');};}function getJobs(_0x2e2c3b){var _0x4a4422={};if(_0x2e2c3b){_0x4a4422['id']=_0x2e2c3b;}return db[_0x82ca('0x3b')]['findAll']({'where':_0x4a4422,'include':[{'model':db[_0x82ca('0xd')],'attributes':['id','name','email'],'include':[{'model':db[_0x82ca('0x3c')],'as':'Smtp'}]}]})[_0x82ca('0x2b')](function(_0x18c22a){var _0x4d9b04=_['keys'](manager[_0x82ca('0x3d')]);var _0x360591=_[_0x82ca('0x3e')](_0x18c22a,function(_0x2ff403){return _0x2ff403['id'][_0x82ca('0x3f')]();});var _0x7c9710=_[_0x82ca('0x40')](_0x18c22a,function(_0x1b8289){return _0x1b8289['id'][_0x82ca('0x3f')]();});var _0x3019dd=_0x2e2c3b?_0x360591:_[_0x82ca('0x41')](_0x360591,_0x4d9b04);var _0x30aa19=_[_0x82ca('0x42')](_0x360591,_0x4d9b04);var _0x27551a=_[_0x82ca('0x41')](_0x4d9b04,_0x360591);var _0x4a0ea1;var _0x17d110;for(_0x4a0ea1=0x0;_0x4a0ea1<_0x27551a[_0x82ca('0x43')]&&!_0x2e2c3b;_0x4a0ea1+=0x1){_0x17d110=_0x27551a[_0x4a0ea1][_0x82ca('0x3f')]();if(manager[_0x82ca('0x44')](_0x17d110)){manager[_0x82ca('0x45')](_0x17d110);manager[_0x82ca('0x46')](_0x17d110);logger[_0x82ca('0x28')](_0x82ca('0x47'),_0x17d110);}}logger[_0x82ca('0x28')](_0x82ca('0x48'),JSON['stringify'](_0x3019dd));for(_0x4a0ea1=0x0;_0x4a0ea1<_0x3019dd[_0x82ca('0x43')];_0x4a0ea1+=0x1){_0x17d110=_0x3019dd[_0x4a0ea1][_0x82ca('0x3f')]();logger['info']('index',_0x17d110);if(_0x2e2c3b){logger[_0x82ca('0x28')](_0x82ca('0x49'),_0x2e2c3b);logger[_0x82ca('0x28')](JSON[_0x82ca('0x25')](_0x7c9710[_0x17d110]));BPromise['resolve']()['then'](handleJob(_0x7c9710[_0x17d110]));logger[_0x82ca('0x28')]('run\x20job',_0x7c9710[_0x17d110][_0x82ca('0x17')],_0x7c9710[_0x17d110]['cron']);}else if(_0x7c9710[_0x17d110][_0x82ca('0x4a')]&&_0x7c9710[_0x17d110][_0x82ca('0x4b')]&&moment()[_0x82ca('0x4c')](_0x7c9710[_0x17d110]['startAt'],_0x7c9710[_0x17d110][_0x82ca('0x4d')])){manager[_0x82ca('0x4e')](_0x17d110,_0x7c9710[_0x17d110][_0x82ca('0x4a')],handleJob(_0x7c9710[_0x17d110]));manager[_0x82ca('0x4f')](_0x17d110);logger[_0x82ca('0x28')](_0x82ca('0x50'),_0x7c9710[_0x17d110][_0x82ca('0x17')],_0x7c9710[_0x17d110][_0x82ca('0x4a')]);}else if(manager[_0x82ca('0x44')](_0x17d110)){manager[_0x82ca('0x45')](_0x17d110);manager['deleteJob'](_0x17d110);logger['info']('stop\x20cron',_0x7c9710[_0x17d110]['name'],_0x7c9710[_0x17d110]['cron']);}}for(_0x4a0ea1=0x0,_0x17d110;_0x4a0ea1<_0x30aa19['length']&&!_0x2e2c3b;_0x4a0ea1+=0x1){_0x17d110=_0x30aa19[_0x4a0ea1]['toString']();if(manager[_0x82ca('0x44')](_0x17d110)){if(_0x7c9710[_0x17d110][_0x82ca('0x4a')]&&_0x7c9710[_0x17d110][_0x82ca('0x4b')]&&moment()[_0x82ca('0x4c')](_0x7c9710[_0x17d110][_0x82ca('0x51')],_0x7c9710[_0x17d110][_0x82ca('0x4d')])){manager['update'](_0x17d110,_0x7c9710[_0x17d110][_0x82ca('0x4a')],handleJob(_0x7c9710[_0x17d110]));logger['info'](_0x82ca('0x52'),_0x7c9710[_0x17d110][_0x82ca('0x17')],_0x7c9710[_0x17d110][_0x82ca('0x4a')]);}else{manager[_0x82ca('0x45')](_0x17d110);manager[_0x82ca('0x46')](_0x17d110);logger[_0x82ca('0x28')](_0x82ca('0x53'),_0x7c9710[_0x17d110]['name'],_0x7c9710[_0x17d110]['cron']);}}}})['catch'](function(_0x1b7ce6){logger[_0x82ca('0x2c')](JSON[_0x82ca('0x25')](_0x1b7ce6));});}exports['run']=function(_0x318ad1){return getJobs(_0x318ad1);};exports[_0x82ca('0x4f')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 6740c8b..bf70d99 100644 --- a/server/config/schedule/transcribe.js +++ b/server/config/schedule/transcribe.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1356=['detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','then','tempSentiment','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','CloudProvider','Cloud\x20Provider\x20not\x20configured','Sentiment','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','findOne','transcribe','transcribeAccountId','forEach','all','start','aws-sdk','util','bluebird','../../mysqldb'];(function(_0x36ef66,_0x3a443f){var _0x20f64c=function(_0x25ee01){while(--_0x25ee01){_0x36ef66['push'](_0x36ef66['shift']());}};_0x20f64c(++_0x3a443f);}(_0x1356,0x19a));var _0x6135=function(_0x28061f,_0x58f2fe){_0x28061f=_0x28061f-0x0;var _0xaa2d48=_0x1356[_0x28061f];return _0xaa2d48;};var _=require('lodash');var AWS=require(_0x6135('0x0'));var rp=require('request-promise');var util=require(_0x6135('0x1'));var BPromise=require(_0x6135('0x2'));var db=require(_0x6135('0x3'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0xb447a4,_0x3ae40f,_0x3baed6,_0x60aae4){return new Promise(function(_0x4490bc,_0x169bf8){var _0x3e3cf8=new AWS['TranscribeService']({'accessKeyId':_0x3ae40f,'secretAccessKey':_0xb447a4,'region':_0x3baed6});_0x3e3cf8['getTranscriptionJob']({'TranscriptionJobName':_0x60aae4},function(_0x28e61f,_0x44fc8e){if(_0x28e61f){return _0x169bf8(_0x28e61f);}else{return _0x4490bc(_0x44fc8e);}});});}function sentiment(_0x5630cd,_0x542939,_0x3d168c,_0x3a5d05,_0x9d8054){return new Promise(function(_0x578ab2,_0x489257){var _0x12160a=new AWS['Comprehend']({'accessKeyId':_0x542939,'secretAccessKey':_0x5630cd,'region':_0x3d168c});_0x12160a[_0x6135('0x4')]({'Text':_0x3a5d05,'LanguageCode':_0x9d8054[_0x6135('0x5')](0x0,0x2)},function(_0x30fb9d,_0x196e64){if(_0x30fb9d){return _0x489257(_0x30fb9d);}else{return _0x578ab2(_0x196e64);}});});}function checkTranscribeJob(_0x261330,_0x36e651,_0x335c60){var _0x4d3b3b;return new BPromise(function(_0x22626f,_0x23a47c){logger['info'](util[_0x6135('0x6')](_0x6135('0x7'),_0x261330['id'],_0x261330[_0x6135('0x8')]));return getTranscriptionJob(_0x335c60['data1'],_0x335c60[_0x6135('0x9')],_0x36e651[_0x6135('0xa')],_0x261330[_0x6135('0x8')])['then'](function(_0x167057){logger[_0x6135('0xb')](util[_0x6135('0x6')](_0x6135('0xc'),_0x261330['id'],_0x261330[_0x6135('0x8')],_0x167057[_0x6135('0xd')]['TranscriptionJobStatus']));if(!_0x261330['fileText']){switch(_0x167057['TranscriptionJob'][_0x6135('0xe')]){case _0x6135('0xf'):var _0x4523b5={'transcribeStatus':_0x167057[_0x6135('0xd')]['TranscriptionJobStatus'],'fileUri':_0x167057[_0x6135('0xd')][_0x6135('0x10')][_0x6135('0x11')]};logger['info'](util[_0x6135('0x6')](_0x6135('0x12'),_0x261330['id']));return rp({'uri':_0x167057[_0x6135('0xd')]['Transcript'][_0x6135('0x11')],'json':!![]})['then'](function(_0x1d4ef6){logger[_0x6135('0xb')](util[_0x6135('0x6')](_0x6135('0x13'),_0x261330['id']));if(_0x1d4ef6&&_0x1d4ef6['results']&&_0x1d4ef6[_0x6135('0x14')][_0x6135('0x15')]&&_0x1d4ef6[_0x6135('0x14')][_0x6135('0x15')][_0x6135('0x16')]){_0x4523b5['fileText']='';for(var _0x1da71e=0x0;_0x1da71e<_0x1d4ef6[_0x6135('0x14')][_0x6135('0x15')][_0x6135('0x16')];_0x1da71e++){_0x4523b5[_0x6135('0x17')]+=_0x1d4ef6['results'][_0x6135('0x15')][_0x1da71e][_0x6135('0x18')]+'';}}return _0x261330[_0x6135('0x19')](_0x4523b5);})[_0x6135('0x1a')](function(){logger[_0x6135('0xb')](util[_0x6135('0x6')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x261330['id']));if(!_0x261330[_0x6135('0x1b')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x36e651[_0x6135('0x1c')]||!_0x36e651[_0x6135('0x1d')]||!_0x36e651[_0x6135('0x1e')]||!_0x36e651[_0x6135('0x1f')]||!_0x36e651[_0x6135('0x20')]){throw new db[(_0x6135('0x21'))][(_0x6135('0x22'))](_0x6135('0x23'));}if(!_0x4523b5['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x36e651[_0x6135('0x1d')]===_0x335c60['id']){return _0x335c60;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x6135('0x1d')]}});}})[_0x6135('0x1a')](function(_0x5ed457){if(!_0x5ed457){throw new db['Sequelize'][(_0x6135('0x22'))](_0x6135('0x24'));}if(!_0x5ed457[_0x6135('0x25')]||!_0x5ed457[_0x6135('0x9')]){throw new db['Sequelize'][(_0x6135('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x4d3b3b=_0x5ed457;logger['info'](util[_0x6135('0x6')](_0x6135('0x26'),_0x261330['id']));return sentiment(_0x4d3b3b['data1'],_0x4d3b3b[_0x6135('0x9')],_0x36e651['sentimentRegion'],_0x4523b5['fileText'],_0x36e651['language']);})[_0x6135('0x1a')](function(_0x3e7dac){logger[_0x6135('0xb')](util[_0x6135('0x6')](_0x6135('0x27'),_0x261330['id']));return _0x261330[_0x6135('0x19')]({'sentiment':_0x3e7dac['Sentiment'],'sPositive':_0x3e7dac[_0x6135('0x28')][_0x6135('0x29')],'sNegative':_0x3e7dac[_0x6135('0x28')][_0x6135('0x2a')],'sMixed':_0x3e7dac['SentimentScore'][_0x6135('0x2b')],'sNeutral':_0x3e7dac[_0x6135('0x28')][_0x6135('0x2c')]});})[_0x6135('0x1a')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x261330['id']));_0x22626f();});case _0x6135('0x2d'):return _0x261330['update']({'transcribeStatus':_0x6135('0x2d'),'failureReason':_0x167057[_0x6135('0xd')][_0x6135('0x2e')]})[_0x6135('0x1a')](function(){logger[_0x6135('0xb')](util[_0x6135('0x6')](_0x6135('0x2f'),_0x261330['id']));_0x22626f();});default:logger[_0x6135('0xb')](util[_0x6135('0x6')](_0x6135('0x30'),_0x261330['id']));break;}}else{return BPromise[_0x6135('0x31')]()['then'](function(){if(!_0x261330['tempSentiment']){throw new db['Sequelize'][(_0x6135('0x22'))](_0x6135('0x32'));}if(!_0x36e651[_0x6135('0x1c')]||!_0x36e651[_0x6135('0x1d')]||!_0x36e651[_0x6135('0x1e')]||!_0x36e651[_0x6135('0x1f')]||!_0x36e651[_0x6135('0x20')]){throw new db[(_0x6135('0x21'))][(_0x6135('0x22'))](_0x6135('0x23'));}if(!_0x261330[_0x6135('0x17')]){throw new Error('Transcript\x20not\x20available');}if(_0x36e651[_0x6135('0x1d')]===_0x335c60['id']){return _0x335c60;}else{return db[_0x6135('0x33')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x6135('0x1a')](function(_0x307fac){if(!_0x307fac){throw new db[(_0x6135('0x21'))]['ValidationError'](_0x6135('0x24'));}if(!_0x307fac['data1']||!_0x307fac[_0x6135('0x9')]){throw new db[(_0x6135('0x21'))][(_0x6135('0x22'))](_0x6135('0x34'));}_0x4d3b3b=_0x307fac;logger[_0x6135('0xb')](util[_0x6135('0x6')](_0x6135('0x26'),_0x261330['id']));return sentiment(_0x4d3b3b[_0x6135('0x25')],_0x4d3b3b['data2'],_0x36e651[_0x6135('0x1e')],_0x261330[_0x6135('0x17')],_0x36e651['language']);})['then'](function(_0x4a0dab){logger[_0x6135('0xb')](util[_0x6135('0x6')](_0x6135('0x27'),_0x261330['id']));return _0x261330[_0x6135('0x19')]({'sentiment':_0x4a0dab[_0x6135('0x35')],'sPositive':_0x4a0dab[_0x6135('0x28')][_0x6135('0x29')],'sNegative':_0x4a0dab[_0x6135('0x28')][_0x6135('0x2a')],'sMixed':_0x4a0dab[_0x6135('0x28')][_0x6135('0x2b')],'sNeutral':_0x4a0dab[_0x6135('0x28')][_0x6135('0x2c')],'transcribeStatus':_0x6135('0xf')});})[_0x6135('0x1a')](function(){logger['info'](util['format'](_0x6135('0x2f'),_0x261330['id']));_0x22626f();});}})[_0x6135('0x36')](function(_0x5df2bd){if(_0x5df2bd){if(!_0x5df2bd['name']||_0x5df2bd[_0x6135('0x37')]!==_0x6135('0x38')){logger[_0x6135('0x39')](util[_0x6135('0x6')](_0x6135('0x3a'),_0x261330['id']),util[_0x6135('0x3b')](_0x5df2bd,{'showHidden':![],'depth':null}));}}_0x22626f();});});}function checkTranscribe(){var _0x2a05ac;var _0x2c52eb;var _0x260dfe;return db[_0x6135('0x3c')][_0x6135('0x3d')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x6135('0x1a')](function(_0x192233){if(!_0x192233||!_0x192233[_0x6135('0x16')]){throw new db[(_0x6135('0x21'))][(_0x6135('0x22'))](_0x6135('0x3e'));}_0x2a05ac=_0x192233;return db['Setting'][_0x6135('0x3f')]({'where':{'id':0x1}});})[_0x6135('0x1a')](function(_0x586deb){if(!_0x586deb){throw new db['Sequelize'][(_0x6135('0x22'))]('Settings\x20not\x20available');}_0x2c52eb=_0x586deb;if(!_0x2c52eb[_0x6135('0x40')]||!_0x2c52eb[_0x6135('0x41')]||!_0x2c52eb['transcribeRegion']||!_0x2c52eb['language']||!_0x2c52eb[_0x6135('0x20')]){throw new db[(_0x6135('0x21'))][(_0x6135('0x22'))]('Transcribe\x20not\x20configured');}return db[_0x6135('0x33')][_0x6135('0x3f')]({'where':{'id':_0x2c52eb[_0x6135('0x41')]}});})[_0x6135('0x1a')](function(_0xd2dcda){if(!_0xd2dcda){throw new db[(_0x6135('0x21'))][(_0x6135('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xd2dcda[_0x6135('0x25')]||!_0xd2dcda[_0x6135('0x9')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x260dfe=_0xd2dcda;var _0x34a708=[];_0x2a05ac[_0x6135('0x42')](function(_0x509dd1){_0x34a708['push'](checkTranscribeJob(_0x509dd1,_0x2c52eb,_0x260dfe));});return BPromise[_0x6135('0x43')](_0x34a708);})[_0x6135('0x36')](function(_0x5ae8b6){if(_0x5ae8b6){if(!_0x5ae8b6['name']||_0x5ae8b6['name']!=='SequelizeValidationError'){logger[_0x6135('0x39')](util[_0x6135('0x3b')](_0x5ae8b6,{'showHidden':![],'depth':null}));}}});}exports[_0x6135('0x44')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x65bb=['name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','CloudProvider','transcribeAccountId','push','all','catch','inspect','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','transcribeName','then','info','format','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Transcript\x20not\x20available','ValidationError','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','Neutral','FAILED','resolve','language','findOne','Negative'];(function(_0x57cf0e,_0x2b61eb){var _0x5bb2bd=function(_0x54e1a3){while(--_0x54e1a3){_0x57cf0e['push'](_0x57cf0e['shift']());}};_0x5bb2bd(++_0x2b61eb);}(_0x65bb,0x9f));var _0xb65b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x65bb[_0x3dd15e];return _0x231fd0;};var _=require(_0xb65b('0x0'));var AWS=require(_0xb65b('0x1'));var rp=require(_0xb65b('0x2'));var util=require(_0xb65b('0x3'));var BPromise=require(_0xb65b('0x4'));var db=require(_0xb65b('0x5'))['db'];var logger=require(_0xb65b('0x6'))(_0xb65b('0x7'));function getTranscriptionJob(_0x21d2bf,_0x2ef95d,_0x5e0fe7,_0x26072e){return new Promise(function(_0x5625b1,_0x5a3124){var _0x5128aa=new AWS[(_0xb65b('0x8'))]({'accessKeyId':_0x2ef95d,'secretAccessKey':_0x21d2bf,'region':_0x5e0fe7});_0x5128aa[_0xb65b('0x9')]({'TranscriptionJobName':_0x26072e},function(_0x58ed16,_0x216d7a){if(_0x58ed16){return _0x5a3124(_0x58ed16);}else{return _0x5625b1(_0x216d7a);}});});}function sentiment(_0x26340a,_0x3bb50b,_0x40cbdb,_0x53c4aa,_0x50200){return new Promise(function(_0x1c83fb,_0x14c5b0){var _0x11b024=new AWS['Comprehend']({'accessKeyId':_0x3bb50b,'secretAccessKey':_0x26340a,'region':_0x40cbdb});_0x11b024[_0xb65b('0xa')]({'Text':_0x53c4aa,'LanguageCode':_0x50200[_0xb65b('0xb')](0x0,0x2)},function(_0x23be7b,_0x39254f){if(_0x23be7b){return _0x14c5b0(_0x23be7b);}else{return _0x1c83fb(_0x39254f);}});});}function checkTranscribeJob(_0x7fe89,_0x5319f3,_0x2a52d6){var _0x5bcfda;return new BPromise(function(_0x33a7c1,_0x962cae){logger['info'](util['format'](_0xb65b('0xc'),_0x7fe89['id'],_0x7fe89['transcribeName']));return getTranscriptionJob(_0x2a52d6[_0xb65b('0xd')],_0x2a52d6[_0xb65b('0xe')],_0x5319f3[_0xb65b('0xf')],_0x7fe89[_0xb65b('0x10')])[_0xb65b('0x11')](function(_0xdc2f6b){logger[_0xb65b('0x12')](util[_0xb65b('0x13')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x7fe89['id'],_0x7fe89['transcribeName'],_0xdc2f6b[_0xb65b('0x14')]['TranscriptionJobStatus']));if(!_0x7fe89[_0xb65b('0x15')]){switch(_0xdc2f6b[_0xb65b('0x14')][_0xb65b('0x16')]){case _0xb65b('0x17'):var _0x52fae9={'transcribeStatus':_0xdc2f6b[_0xb65b('0x14')][_0xb65b('0x16')],'fileUri':_0xdc2f6b[_0xb65b('0x14')]['Transcript'][_0xb65b('0x18')]};logger[_0xb65b('0x12')](util[_0xb65b('0x13')](_0xb65b('0x19'),_0x7fe89['id']));return rp({'uri':_0xdc2f6b[_0xb65b('0x14')][_0xb65b('0x1a')][_0xb65b('0x18')],'json':!![]})[_0xb65b('0x11')](function(_0x3df4e2){logger[_0xb65b('0x12')](util[_0xb65b('0x13')](_0xb65b('0x1b'),_0x7fe89['id']));if(_0x3df4e2&&_0x3df4e2[_0xb65b('0x1c')]&&_0x3df4e2[_0xb65b('0x1c')][_0xb65b('0x1d')]&&_0x3df4e2[_0xb65b('0x1c')][_0xb65b('0x1d')]['length']){_0x52fae9[_0xb65b('0x15')]='';for(var _0x592616=0x0;_0x592616<_0x3df4e2[_0xb65b('0x1c')][_0xb65b('0x1d')][_0xb65b('0x1e')];_0x592616++){_0x52fae9[_0xb65b('0x15')]+=_0x3df4e2[_0xb65b('0x1c')][_0xb65b('0x1d')][_0x592616][_0xb65b('0x1f')]+'';}}return _0x7fe89[_0xb65b('0x20')](_0x52fae9);})[_0xb65b('0x11')](function(){logger[_0xb65b('0x12')](util['format'](_0xb65b('0x21'),_0x7fe89['id']));if(!_0x7fe89[_0xb65b('0x22')]){throw new db[(_0xb65b('0x23'))]['ValidationError'](_0xb65b('0x24'));}if(!_0x5319f3[_0xb65b('0x25')]||!_0x5319f3[_0xb65b('0x26')]||!_0x5319f3[_0xb65b('0x27')]||!_0x5319f3['language']||!_0x5319f3[_0xb65b('0x28')]){throw new db[(_0xb65b('0x23'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x52fae9['fileText']){throw new Error(_0xb65b('0x29'));}if(_0x5319f3[_0xb65b('0x26')]===_0x2a52d6['id']){return _0x2a52d6;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0xb65b('0x26')]}});}})[_0xb65b('0x11')](function(_0x36309d){if(!_0x36309d){throw new db[(_0xb65b('0x23'))][(_0xb65b('0x2a'))](_0xb65b('0x2b'));}if(!_0x36309d['data1']||!_0x36309d[_0xb65b('0xe')]){throw new db[(_0xb65b('0x23'))][(_0xb65b('0x2a'))](_0xb65b('0x2c'));}_0x5bcfda=_0x36309d;logger[_0xb65b('0x12')](util['format'](_0xb65b('0x2d'),_0x7fe89['id']));return sentiment(_0x5bcfda[_0xb65b('0xd')],_0x5bcfda[_0xb65b('0xe')],_0x5319f3[_0xb65b('0x27')],_0x52fae9['fileText'],_0x5319f3['language']);})[_0xb65b('0x11')](function(_0x1990a9){logger[_0xb65b('0x12')](util[_0xb65b('0x13')](_0xb65b('0x2e'),_0x7fe89['id']));return _0x7fe89[_0xb65b('0x20')]({'sentiment':_0x1990a9[_0xb65b('0x2f')],'sPositive':_0x1990a9[_0xb65b('0x30')][_0xb65b('0x31')],'sNegative':_0x1990a9[_0xb65b('0x30')]['Negative'],'sMixed':_0x1990a9[_0xb65b('0x30')][_0xb65b('0x32')],'sNeutral':_0x1990a9[_0xb65b('0x30')][_0xb65b('0x33')]});})[_0xb65b('0x11')](function(){logger[_0xb65b('0x12')](util[_0xb65b('0x13')](_0xb65b('0x21'),_0x7fe89['id']));_0x33a7c1();});case'FAILED':return _0x7fe89[_0xb65b('0x20')]({'transcribeStatus':_0xb65b('0x34'),'failureReason':_0xdc2f6b[_0xb65b('0x14')]['FailureReason']})[_0xb65b('0x11')](function(){logger[_0xb65b('0x12')](util[_0xb65b('0x13')](_0xb65b('0x21'),_0x7fe89['id']));_0x33a7c1();});default:logger[_0xb65b('0x12')](util[_0xb65b('0x13')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x7fe89['id']));break;}}else{return BPromise[_0xb65b('0x35')]()[_0xb65b('0x11')](function(){if(!_0x7fe89[_0xb65b('0x22')]){throw new db[(_0xb65b('0x23'))]['ValidationError'](_0xb65b('0x24'));}if(!_0x5319f3[_0xb65b('0x25')]||!_0x5319f3[_0xb65b('0x26')]||!_0x5319f3[_0xb65b('0x27')]||!_0x5319f3[_0xb65b('0x36')]||!_0x5319f3[_0xb65b('0x28')]){throw new db[(_0xb65b('0x23'))][(_0xb65b('0x2a'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x7fe89['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x5319f3[_0xb65b('0x26')]===_0x2a52d6['id']){return _0x2a52d6;}else{return db['CloudProvider'][_0xb65b('0x37')]({'where':{'id':_settings[_0xb65b('0x26')]}});}})[_0xb65b('0x11')](function(_0x2745bd){if(!_0x2745bd){throw new db[(_0xb65b('0x23'))][(_0xb65b('0x2a'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2745bd[_0xb65b('0xd')]||!_0x2745bd[_0xb65b('0xe')]){throw new db[(_0xb65b('0x23'))][(_0xb65b('0x2a'))](_0xb65b('0x2c'));}_0x5bcfda=_0x2745bd;logger[_0xb65b('0x12')](util['format'](_0xb65b('0x2d'),_0x7fe89['id']));return sentiment(_0x5bcfda[_0xb65b('0xd')],_0x5bcfda[_0xb65b('0xe')],_0x5319f3[_0xb65b('0x27')],_0x7fe89[_0xb65b('0x15')],_0x5319f3[_0xb65b('0x36')]);})[_0xb65b('0x11')](function(_0x50b54e){logger[_0xb65b('0x12')](util[_0xb65b('0x13')](_0xb65b('0x2e'),_0x7fe89['id']));return _0x7fe89[_0xb65b('0x20')]({'sentiment':_0x50b54e[_0xb65b('0x2f')],'sPositive':_0x50b54e[_0xb65b('0x30')][_0xb65b('0x31')],'sNegative':_0x50b54e['SentimentScore'][_0xb65b('0x38')],'sMixed':_0x50b54e[_0xb65b('0x30')]['Mixed'],'sNeutral':_0x50b54e[_0xb65b('0x30')][_0xb65b('0x33')],'transcribeStatus':_0xb65b('0x17')});})['then'](function(){logger['info'](util['format'](_0xb65b('0x21'),_0x7fe89['id']));_0x33a7c1();});}})['catch'](function(_0x90ef7e){if(_0x90ef7e){if(!_0x90ef7e[_0xb65b('0x39')]||_0x90ef7e[_0xb65b('0x39')]!==_0xb65b('0x3a')){logger[_0xb65b('0x3b')](util[_0xb65b('0x13')](_0xb65b('0x3c'),_0x7fe89['id']),util['inspect'](_0x90ef7e,{'showHidden':![],'depth':null}));}}_0x33a7c1();});});}function checkTranscribe(){var _0x4e72e1;var _0x193ef1;var _0x13f699;return db[_0xb65b('0x3d')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xb65b('0x11')](function(_0x525a18){if(!_0x525a18||!_0x525a18[_0xb65b('0x1e')]){throw new db['Sequelize'][(_0xb65b('0x2a'))](_0xb65b('0x3e'));}_0x4e72e1=_0x525a18;return db[_0xb65b('0x3f')]['findOne']({'where':{'id':0x1}});})[_0xb65b('0x11')](function(_0x4f6312){if(!_0x4f6312){throw new db['Sequelize'][(_0xb65b('0x2a'))](_0xb65b('0x40'));}_0x193ef1=_0x4f6312;if(!_0x193ef1[_0xb65b('0x7')]||!_0x193ef1['transcribeAccountId']||!_0x193ef1[_0xb65b('0xf')]||!_0x193ef1['language']||!_0x193ef1['bucket']){throw new db[(_0xb65b('0x23'))][(_0xb65b('0x2a'))](_0xb65b('0x41'));}return db[_0xb65b('0x42')][_0xb65b('0x37')]({'where':{'id':_0x193ef1[_0xb65b('0x43')]}});})['then'](function(_0x90d88){if(!_0x90d88){throw new db[(_0xb65b('0x23'))][(_0xb65b('0x2a'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x90d88[_0xb65b('0xd')]||!_0x90d88[_0xb65b('0xe')]){throw new db['Sequelize'][(_0xb65b('0x2a'))](_0xb65b('0x2c'));}_0x13f699=_0x90d88;var _0x1644ba=[];_0x4e72e1['forEach'](function(_0x505965){_0x1644ba[_0xb65b('0x44')](checkTranscribeJob(_0x505965,_0x193ef1,_0x13f699));});return BPromise[_0xb65b('0x45')](_0x1644ba);})[_0xb65b('0x46')](function(_0xadff9c){if(_0xadff9c){if(!_0xadff9c[_0xb65b('0x39')]||_0xadff9c['name']!==_0xb65b('0x3a')){logger[_0xb65b('0x3b')](util[_0xb65b('0x47')](_0xadff9c,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index aa79e85..ec6e535 100644 --- a/server/config/schedule/whatsapp.js +++ b/server/config/schedule/whatsapp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc518=['../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis'];(function(_0x39b94f,_0x208088){var _0x5d6e14=function(_0x17a992){while(--_0x17a992){_0x39b94f['push'](_0x39b94f['shift']());}};_0x5d6e14(++_0x208088);}(_0xc518,0xf5));var _0x8c51=function(_0x21d6ff,_0xb9d12e){_0x21d6ff=_0x21d6ff-0x0;var _0x67f3c2=_0xc518[_0x21d6ff];return _0x67f3c2;};'use strict';var _=require(_0x8c51('0x0'));var moment=require(_0x8c51('0x1'));var Redis=require(_0x8c51('0x2'));var util=require('util');var config=require(_0x8c51('0x3'));var db=require(_0x8c51('0x4'))['db'];var logger=require(_0x8c51('0x5'))(_0x8c51('0x6'));config[_0x8c51('0x7')]=_[_0x8c51('0x8')](config[_0x8c51('0x7')],{'host':_0x8c51('0x9'),'port':0x18eb});var io=require(_0x8c51('0xa'))(new Redis(config[_0x8c51('0x7')]));function closeInteractions(){var _0x37ae60=[];return db[_0x8c51('0xb')][_0x8c51('0xc')]({'raw':!![],'attributes':['id',_0x8c51('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x8c51('0xe')](0x18,_0x8c51('0xf'))}}})[_0x8c51('0x10')](function(_0x294781){if(_0x294781&&_0x294781[_0x8c51('0x11')]){_0x37ae60=_[_0x8c51('0x12')](_0x294781||[],'id');logger['info'](_0x8c51('0x13'),_0x37ae60['join']());return db['WhatsappInteraction']['update']({'closeReason':'system','disposition':_0x8c51('0x14'),'closed':!![],'closedAt':moment()[_0x8c51('0x15')](_0x8c51('0x16'))},{'where':{'id':_0x37ae60}});}})['then'](function(){if(_0x37ae60&&_0x37ae60[_0x8c51('0x11')]){logger[_0x8c51('0x17')](_0x8c51('0x18'),_0x37ae60['join']());for(var _0x82dbf4=0x0;_0x82dbf4<_0x37ae60[_0x8c51('0x11')];_0x82dbf4++){io[_0x8c51('0x19')](_0x8c51('0x1a'),{'id':_0x37ae60[_0x82dbf4],'closed':!![]});}}})['catch'](function(_0x396896){logger[_0x8c51('0x1b')](_0x8c51('0x1c'),_0x396896?util[_0x8c51('0x1d')](_0x396896,{'showHidden':![],'depth':null}):'');});}exports[_0x8c51('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9821=['lastMsgAt','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','timeout','YYYY-MM-DD\x20HH:mm:ss','then','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','util','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll'];(function(_0xd3e3bd,_0x134be2){var _0x5951f5=function(_0x2d0428){while(--_0x2d0428){_0xd3e3bd['push'](_0xd3e3bd['shift']());}};_0x5951f5(++_0x134be2);}(_0x9821,0x72));var _0x1982=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9821[_0x3b0731];return _0x4204d7;};'use strict';var _=require('lodash');var moment=require(_0x1982('0x0'));var Redis=require('ioredis');var util=require(_0x1982('0x1'));var config=require('../../config/environment');var db=require(_0x1982('0x2'))['db'];var logger=require(_0x1982('0x3'))(_0x1982('0x4'));config[_0x1982('0x5')]=_[_0x1982('0x6')](config[_0x1982('0x5')],{'host':_0x1982('0x7'),'port':0x18eb});var io=require(_0x1982('0x8'))(new Redis(config[_0x1982('0x5')]));function closeInteractions(){var _0x187c0b=[];return db[_0x1982('0x9')][_0x1982('0xa')]({'raw':!![],'attributes':['id',_0x1982('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})['then'](function(_0x472acd){if(_0x472acd&&_0x472acd[_0x1982('0xc')]){_0x187c0b=_['map'](_0x472acd||[],'id');logger[_0x1982('0xd')](_0x1982('0xe'),_0x187c0b['join']());return db[_0x1982('0x9')]['update']({'closeReason':'system','disposition':_0x1982('0xf'),'closed':!![],'closedAt':moment()['format'](_0x1982('0x10'))},{'where':{'id':_0x187c0b}});}})[_0x1982('0x11')](function(){if(_0x187c0b&&_0x187c0b[_0x1982('0xc')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x187c0b['join']());for(var _0x2c90a1=0x0;_0x2c90a1<_0x187c0b['length'];_0x2c90a1++){io[_0x1982('0x12')](_0x1982('0x13'),{'id':_0x187c0b[_0x2c90a1],'closed':!![]});}}})[_0x1982('0x14')](function(_0x13b515){logger[_0x1982('0x15')](_0x1982('0x16'),_0x13b515?util[_0x1982('0x17')](_0x13b515,{'showHidden':![],'depth':null}):'');});}exports[_0x1982('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 4ec0b67..5dfad47 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcbb6=['log','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','finished\x20populating','contacts1','CmHopper','bulkCreate'];(function(_0x584197,_0x41c741){var _0x3f39e5=function(_0xf6e803){while(--_0xf6e803){_0x584197['push'](_0x584197['shift']());}};_0x3f39e5(++_0x41c741);}(_0xcbb6,0x148));var _0x6cbb=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xcbb6[_0x3947c9];return _0x2e7871;};'use strict';var util=require(_0x6cbb('0x0'));var db=require(_0x6cbb('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x6cbb('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x6cbb('0x3')+i,'phone':0xf879fb460+i,'email':_0x6cbb('0x4')+i+_0x6cbb('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x6cbb('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6cbb('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x6cbb('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x6cbb('0x4')+i+_0x6cbb('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x6cbb('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x6cbb('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6cbb('0x6')](),'updatedAt':Date['now']()});}db[_0x6cbb('0x7')][_0x6cbb('0x8')]({'where':{}})[_0x6cbb('0x9')](function(){return db['CmContact']['bulkCreate'](contacts);})['then'](function(){console['log'](_0x6cbb('0xa'),_0x6cbb('0xb'));return db[_0x6cbb('0xc')][_0x6cbb('0x8')]({'where':{}});})[_0x6cbb('0x9')](function(){return db[_0x6cbb('0xc')][_0x6cbb('0xd')](hopper);})['then'](function(){console[_0x6cbb('0xe')](_0x6cbb('0xa'),_0x6cbb('0xf'));return db[_0x6cbb('0x7')][_0x6cbb('0xd')](contacts2);})['then'](function(){console[_0x6cbb('0xe')]('finished\x20populating',_0x6cbb('0x10'));return db[_0x6cbb('0xc')][_0x6cbb('0xd')](hopper2);})[_0x6cbb('0x9')](function(){console[_0x6cbb('0xe')](_0x6cbb('0xa'),_0x6cbb('0x11'));})[_0x6cbb('0x12')](function(_0x572519){console['log'](_0x572519);}); \ No newline at end of file +var _0x5142=['finished\x20populating','contacts1','CmHopper','bulkCreate','hopper2','catch','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','log'];(function(_0x450073,_0x1735bc){var _0x3945b1=function(_0x3752d1){while(--_0x3752d1){_0x450073['push'](_0x450073['shift']());}};_0x3945b1(++_0x1735bc);}(_0x5142,0x1f3));var _0x2514=function(_0x1461d9,_0x10e3a3){_0x1461d9=_0x1461d9-0x0;var _0x306a70=_0x5142[_0x1461d9];return _0x306a70;};'use strict';var util=require('util');var db=require(_0x2514('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x2514('0x1')]({'id':i,'firstName':_0x2514('0x2')+i,'lastName':_0x2514('0x3')+i,'phone':0xf879fb460+i,'email':_0x2514('0x4')+i+_0x2514('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2514('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x2514('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2514('0x6')](),'updatedAt':Date[_0x2514('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2514('0x1')]({'id':i,'firstName':_0x2514('0x2')+i,'lastName':_0x2514('0x3')+i,'phone':0xf879fb460+i,'email':_0x2514('0x4')+i+_0x2514('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x2514('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2514('0x6')](),'updatedAt':Date['now']()});}db[_0x2514('0x7')][_0x2514('0x8')]({'where':{}})[_0x2514('0x9')](function(){return db[_0x2514('0x7')]['bulkCreate'](contacts);})[_0x2514('0x9')](function(){console[_0x2514('0xa')](_0x2514('0xb'),_0x2514('0xc'));return db[_0x2514('0xd')][_0x2514('0x8')]({'where':{}});})[_0x2514('0x9')](function(){return db[_0x2514('0xd')][_0x2514('0xe')](hopper);})[_0x2514('0x9')](function(){console[_0x2514('0xa')](_0x2514('0xb'),'hopper1');return db[_0x2514('0x7')]['bulkCreate'](contacts2);})[_0x2514('0x9')](function(){console[_0x2514('0xa')](_0x2514('0xb'),'contacts2');return db[_0x2514('0xd')]['bulkCreate'](hopper2);})[_0x2514('0x9')](function(){console['log'](_0x2514('0xb'),_0x2514('0xf'));})[_0x2514('0x10')](function(_0x313893){console[_0x2514('0xa')](_0x313893);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 2d404e2..55eb58b 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe252=['catch','util','../mysqldb','push','format','agent','%s%s','%s%s@xcally.com','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','User','then','log','add\x20user'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0xe252,0x12d));var _0x2e25=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xe252[_0xaa0309];return _0x5de7ce;};'use strict';var util=require(_0x2e25('0x0'));var db=require(_0x2e25('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x2e25('0x2')]({'name':util[_0x2e25('0x3')]('%s%s',_0x2e25('0x4'),i),'fullname':util[_0x2e25('0x3')](_0x2e25('0x5'),'agent',i),'email':util[_0x2e25('0x3')](_0x2e25('0x6'),'agent',i),'role':_0x2e25('0x4'),'password':'password','internal':0xfa0+i,'type':_0x2e25('0x7'),'transport':[_0x2e25('0x8'),'ws',_0x2e25('0x9')],'disallow':[_0x2e25('0xa')],'allow':[_0x2e25('0xb')],'defaultuser':util[_0x2e25('0x3')](_0x2e25('0x5'),_0x2e25('0x4'),i),'encryption':_0x2e25('0xc'),'avpf':_0x2e25('0xc'),'force_avp':_0x2e25('0xc'),'icesupport':_0x2e25('0xc'),'dtlsenable':_0x2e25('0xc'),'dtlsverify':'no','dtlscertfile':_0x2e25('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0x2e25('0x3')](_0x2e25('0xe'),util[_0x2e25('0x3')](_0x2e25('0x5'),_0x2e25('0x4'),i),0xfa0+i)});}db[_0x2e25('0xf')]['bulkCreate'](users)[_0x2e25('0x10')](function(){console[_0x2e25('0x11')](_0x2e25('0x12'));})[_0x2e25('0x13')](function(_0x562949){console[_0x2e25('0x11')](_0x562949);}); \ No newline at end of file +var _0x72dd=['/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','../mysqldb','push','agent','format','%s%s','password','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x72dd,0x148));var _0xd72d=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x72dd[_0x3947c9];return _0x2e7871;};'use strict';var util=require('util');var db=require(_0xd72d('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xd72d('0x1')]({'name':util['format']('%s%s',_0xd72d('0x2'),i),'fullname':util[_0xd72d('0x3')](_0xd72d('0x4'),_0xd72d('0x2'),i),'email':util['format']('%s%s@xcally.com',_0xd72d('0x2'),i),'role':_0xd72d('0x2'),'password':_0xd72d('0x5'),'internal':0xfa0+i,'type':'friend','transport':[_0xd72d('0x6'),'ws',_0xd72d('0x7')],'disallow':[_0xd72d('0x8')],'allow':[_0xd72d('0x9')],'defaultuser':util[_0xd72d('0x3')](_0xd72d('0x4'),'agent',i),'encryption':_0xd72d('0xa'),'avpf':_0xd72d('0xa'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0xd72d('0xa'),'dtlsverify':'no','dtlscertfile':_0xd72d('0xb'),'dtlsprivatekey':_0xd72d('0xc'),'dtlssetup':_0xd72d('0xd'),'callerid':util['format'](_0xd72d('0xe'),util[_0xd72d('0x3')](_0xd72d('0x4'),_0xd72d('0x2'),i),0xfa0+i)});}db[_0xd72d('0xf')]['bulkCreate'](users)[_0xd72d('0x10')](function(){console[_0xd72d('0x11')](_0xd72d('0x12'));})[_0xd72d('0x13')](function(_0x590e07){console[_0xd72d('0x11')](_0x590e07);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 8879ccb..c4c36fd 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0442=['leave','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','./environment','name','agent','telephone','type','UserProfileSection','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','UserProfileResource','resourceId','map','User','where','role','ivr','then','%s:queue:%s','Agents','length','format','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','OpenchannelInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','Campaign','ChatQueue','MailQueues','OpenchannelQueue','Trunks','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','mail','openchannel','trunk:%s'];(function(_0x3a44fb,_0x4a3894){var _0x467e61=function(_0x43d35d){while(--_0x43d35d){_0x3a44fb['push'](_0x3a44fb['shift']());}};_0x467e61(++_0x4a3894);}(_0x0442,0x1a0));var _0x2044=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0x0442[_0x59b439];return _0x521ea3;};'use strict';var _=require(_0x2044('0x0'));var util=require(_0x2044('0x1'));var BPromise=require('bluebird');var db=require(_0x2044('0x2'))['db'];var config=require(_0x2044('0x3'));var queryQueues={'attributes':['id',_0x2044('0x4')],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0x2044('0x4'),'role'],'raw':!![],'where':{'role':_0x2044('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x2044('0x6')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x2044('0x4')],'where':{'role':_0x2044('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x2044('0x4'),_0x2044('0x7')],'where':{'type':'ivr'}};function getAssociatedResources(_0x22ea27,_0x2bf784,_0x58b2df){return db[_0x2044('0x8')]['findOne']({'where':{'name':_0x22ea27,'userProfileId':_0x2bf784},'raw':!![]})['then'](function(_0x2a8c1e){if(_0x2a8c1e){if(_0x2a8c1e[_0x2044('0x9')]){switch(_0x22ea27){case _0x2044('0xa'):case _0x2044('0xb'):case _0x2044('0xc'):case _0x2044('0xd'):case'MailQueues':case _0x2044('0xe'):case _0x2044('0xf'):return db[_0x58b2df][_0x2044('0x10')](queryQueues);case _0x2044('0x11'):return db[_0x58b2df][_0x2044('0x10')](queryTelephones);case'Trunks':return db[_0x58b2df][_0x2044('0x10')](queryTrunks);case'IvrCampaigns':return db[_0x58b2df][_0x2044('0x10')](queryCampaigns);}}else{return db[_0x2044('0x12')]['findAll']({'attributes':[_0x2044('0x13')],'where':{'sectionId':_0x2a8c1e['id']},'raw':!![]})['then'](function(_0x47ea53){if(_0x47ea53){var _0x4fd277={'where':{'id':_[_0x2044('0x14')](_0x47ea53,_0x2044('0x13'))},'raw':!![]};switch(_0x58b2df){case _0x2044('0x15'):_0x4fd277[_0x2044('0x16')][_0x2044('0x17')]=_0x2044('0x6');break;case'Campaign':_0x4fd277[_0x2044('0x16')]['type']=_0x2044('0x18');break;}return db[_0x58b2df][_0x2044('0x10')](_0x4fd277);}else{return[];}});}}else{return[];}})[_0x2044('0x19')](function(_0x3cf1ce){return _0x3cf1ce;});}function joinOrLeaveQueues(_0x3cf3d6,_0x2dfb61,_0xf31e57,_0x337a3d){_0x3cf3d6[_0x2dfb61](util['format'](_0x2044('0x1a'),_0xf31e57,_0x337a3d[_0x2044('0x4')]));if(_0x337a3d['Agents']){for(var _0x35977e=0x0;_0x35977e<_0x337a3d[_0x2044('0x1b')][_0x2044('0x1c')];_0x35977e+=0x1){_0x3cf3d6[_0x2dfb61](util[_0x2044('0x1d')](_0x2044('0x1e'),_0x337a3d[_0x2044('0x1b')][_0x35977e][_0x2044('0x4')]));}}}function joinOrLeave(_0x559d01,_0x5f1472,_0x40ac9a){var _0x3e1d16;if(_0x559d01[_0x2044('0x1f')][_0x2044('0x20')]['id']){db['User']['find']({'attributes':['id',_0x2044('0x4'),_0x2044('0x17'),_0x2044('0x21')],'where':{'id':_0x559d01[_0x2044('0x1f')]['query']['id']},'include':[{'model':db[_0x2044('0x22')],'as':_0x2044('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x2044('0x24')],'as':_0x2044('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x2044('0x26')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2044('0x27')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x2044('0x28'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x1876d2){if(_0x1876d2){_0x3e1d16=_0x1876d2;_0x559d01[_0x5f1472](util[_0x2044('0x1d')](_0x2044('0x1e'),_0x1876d2[_0x2044('0x4')]));var _0x92ad35=[];switch(_0x1876d2[_0x2044('0x17')]){case _0x2044('0x29'):_0x559d01[_0x5f1472](_0x2044('0x2a'));_0x559d01[_0x5f1472](_0x2044('0x2b'));if(queryQueues['hasOwnProperty'](_0x2044('0x2c'))){delete queryQueues[_0x2044('0x2c')];}_0x92ad35[_0x2044('0x2d')](db[_0x2044('0x2e')][_0x2044('0x10')](queryQueues));_0x92ad35['push'](db['ChatQueue']['findAll'](queryQueues));_0x92ad35['push'](db[_0x2044('0x2f')][_0x2044('0x10')](queryQueues));_0x92ad35[_0x2044('0x2d')](db[_0x2044('0x30')]['findAll'](queryQueues));_0x92ad35['push'](db[_0x2044('0x31')][_0x2044('0x10')](queryQueues));_0x92ad35[_0x2044('0x2d')](db['OpenchannelQueue'][_0x2044('0x10')](queryQueues));_0x92ad35['push'](db[_0x2044('0x32')][_0x2044('0x10')](queryQueues));_0x92ad35[_0x2044('0x2d')](db['User'][_0x2044('0x10')](queryTelephones));_0x92ad35[_0x2044('0x2d')](db[_0x2044('0x33')][_0x2044('0x10')](queryTrunks));_0x92ad35[_0x2044('0x2d')](db[_0x2044('0x34')][_0x2044('0x10')](queryCampaigns));_0x92ad35[_0x2044('0x2d')](db[_0x2044('0x15')]['findAll'](queryAgents));break;case'user':_0x559d01[_0x5f1472](_0x2044('0x2a'));_0x559d01[_0x5f1472](_0x2044('0x2b'));_0x92ad35[_0x2044('0x2d')](getAssociatedResources(_0x2044('0xa'),_0x1876d2['userProfileId'],'VoiceQueue'));_0x92ad35[_0x2044('0x2d')](getAssociatedResources(_0x2044('0xb'),_0x1876d2[_0x2044('0x21')],_0x2044('0x35')));_0x92ad35['push'](getAssociatedResources(_0x2044('0xc'),_0x1876d2[_0x2044('0x21')],_0x2044('0x2f')));_0x92ad35['push'](getAssociatedResources(_0x2044('0xd'),_0x1876d2[_0x2044('0x21')],'SmsQueue'));_0x92ad35[_0x2044('0x2d')](getAssociatedResources(_0x2044('0x36'),_0x1876d2['userProfileId'],'MailQueue'));_0x92ad35[_0x2044('0x2d')](getAssociatedResources('OpenchannelQueues',_0x1876d2[_0x2044('0x21')],_0x2044('0x37')));_0x92ad35[_0x2044('0x2d')](getAssociatedResources(_0x2044('0xf'),_0x1876d2['userProfileId'],_0x2044('0x32')));_0x92ad35[_0x2044('0x2d')](getAssociatedResources('Telephones',_0x1876d2[_0x2044('0x21')],'User'));_0x92ad35[_0x2044('0x2d')](getAssociatedResources(_0x2044('0x38'),_0x1876d2[_0x2044('0x21')],_0x2044('0x33')));_0x92ad35[_0x2044('0x2d')](getAssociatedResources('IvrCampaigns',_0x1876d2[_0x2044('0x21')],'Campaign'));_0x92ad35['push'](db[_0x2044('0x15')][_0x2044('0x10')](queryAgents));break;case'agent':_0x559d01[_0x5f1472](_0x2044('0x2a'));_0x559d01[_0x5f1472](_0x2044('0x2b'));_0x92ad35[_0x2044('0x2d')](_0x1876d2['getVoiceQueues']({'attributes':['id',_0x2044('0x4')]}));_0x92ad35[_0x2044('0x2d')](_0x1876d2[_0x2044('0x39')]({'attributes':['id',_0x2044('0x4')]}));_0x92ad35[_0x2044('0x2d')](_0x1876d2[_0x2044('0x3a')]({'attributes':['id','name']}));_0x92ad35[_0x2044('0x2d')](_0x1876d2[_0x2044('0x3b')]({'attributes':['id',_0x2044('0x4')]}));_0x92ad35['push'](_0x1876d2['getMailQueues']({'attributes':['id',_0x2044('0x4')]}));_0x92ad35[_0x2044('0x2d')](_0x1876d2[_0x2044('0x3c')]({'attributes':['id',_0x2044('0x4')]}));_0x92ad35[_0x2044('0x2d')](_0x1876d2[_0x2044('0x3d')]({'attributes':['id','name']}));break;}return BPromise[_0x2044('0x3e')](_0x92ad35);}})[_0x2044('0x19')](function(_0xa6e70f){if(_0xa6e70f&&_0xa6e70f[_0x2044('0x1c')]){for(var _0x45371a=0x0;_0x45371a<_0xa6e70f[_0x2044('0x1c')];_0x45371a+=0x1){for(var _0x192751=0x0;_0x192751<_0xa6e70f[_0x45371a][_0x2044('0x1c')];_0x192751+=0x1){switch(_0x45371a){case 0x0:joinOrLeaveQueues(_0x559d01,_0x5f1472,_0x2044('0x3f'),_0xa6e70f[_0x45371a][_0x192751]);break;case 0x1:joinOrLeaveQueues(_0x559d01,_0x5f1472,_0x2044('0x40'),_0xa6e70f[_0x45371a][_0x192751]);break;case 0x2:joinOrLeaveQueues(_0x559d01,_0x5f1472,_0x2044('0x41'),_0xa6e70f[_0x45371a][_0x192751]);break;case 0x3:joinOrLeaveQueues(_0x559d01,_0x5f1472,'sms',_0xa6e70f[_0x45371a][_0x192751]);break;case 0x4:joinOrLeaveQueues(_0x559d01,_0x5f1472,_0x2044('0x42'),_0xa6e70f[_0x45371a][_0x192751]);break;case 0x5:joinOrLeaveQueues(_0x559d01,_0x5f1472,_0x2044('0x43'),_0xa6e70f[_0x45371a][_0x192751]);break;case 0x6:joinOrLeaveQueues(_0x559d01,_0x5f1472,'whatsapp',_0xa6e70f[_0x45371a][_0x192751]);break;case 0x7:if(_0x3e1d16[_0x2044('0x17')]!==_0x2044('0x5'))_0x559d01[_0x5f1472](util[_0x2044('0x1d')]('telephone:%s',_0xa6e70f[_0x45371a][_0x192751][_0x2044('0x4')]));break;case 0x8:if(_0x3e1d16[_0x2044('0x17')]!==_0x2044('0x5'))_0x559d01[_0x5f1472](util[_0x2044('0x1d')](_0x2044('0x44'),_0xa6e70f[_0x45371a][_0x192751]['name']));break;case 0x9:if(_0x3e1d16[_0x2044('0x17')]!==_0x2044('0x5'))_0x559d01[_0x5f1472](util['format']('campaign:%s:%s',_0xa6e70f[_0x45371a][_0x192751][_0x2044('0x7')],_0xa6e70f[_0x45371a][_0x192751][_0x2044('0x4')]));break;case 0xa:_0x559d01[_0x5f1472](util[_0x2044('0x1d')](_0x2044('0x1e'),_0xa6e70f[_0x45371a][_0x192751][_0x2044('0x4')]));break;}}}}})[_0x2044('0x19')](function(){if(_0x5f1472===_0x2044('0x45')){var _0x35fc5c=_[_0x2044('0x14')](_0x3e1d16[_0x2044('0x23')],'id');return _0x3e1d16[_0x2044('0x46')](_0x35fc5c)[_0x2044('0x19')](function(){for(var _0x5ee38c=0x0;_0x5ee38c<_0x35fc5c[_0x2044('0x1c')];_0x5ee38c+=0x1){_0x40ac9a[_0x2044('0x47')](_0x2044('0x48'),{'ChatInteractionId':Number(_0x35fc5c[_0x5ee38c]),'UserId':Number(_0x3e1d16['id'])});}});}})['then'](function(){if(_0x5f1472===_0x2044('0x45')){var _0x3df54f=_[_0x2044('0x14')](_0x3e1d16[_0x2044('0x25')],'id');return _0x3e1d16['removeMailInteractions'](_0x3df54f)[_0x2044('0x19')](function(){for(var _0x163ff3=0x0;_0x163ff3<_0x3df54f['length'];_0x163ff3+=0x1){_0x40ac9a[_0x2044('0x47')](_0x2044('0x49'),{'MailInteractionId':Number(_0x3df54f[_0x163ff3]),'UserId':Number(_0x3e1d16['id'])});}});}})[_0x2044('0x19')](function(){if(_0x5f1472===_0x2044('0x45')){var _0x1077d0=_[_0x2044('0x14')](_0x3e1d16[_0x2044('0x4a')],'id');return _0x3e1d16[_0x2044('0x4b')](_0x1077d0)['then'](function(){for(var _0x1a6436=0x0;_0x1a6436<_0x1077d0[_0x2044('0x1c')];_0x1a6436+=0x1){_0x40ac9a[_0x2044('0x47')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x1077d0[_0x1a6436]),'UserId':Number(_0x3e1d16['id'])});}});}})[_0x2044('0x19')](function(){if(_0x5f1472===_0x2044('0x45')){var _0x49f119=_[_0x2044('0x14')](_0x3e1d16[_0x2044('0x4c')],'id');return _0x3e1d16[_0x2044('0x4d')](_0x49f119)[_0x2044('0x19')](function(){for(var _0x48526f=0x0;_0x48526f<_0x49f119[_0x2044('0x1c')];_0x48526f+=0x1){_0x40ac9a[_0x2044('0x47')](_0x2044('0x4e'),{'SmsInteractionId':Number(_0x49f119[_0x48526f]),'UserId':Number(_0x3e1d16['id'])});}});}})[_0x2044('0x19')](function(){if(_0x5f1472===_0x2044('0x45')){var _0x132e69=_['map'](_0x3e1d16['OpenchannelInteractions'],'id');return _0x3e1d16[_0x2044('0x4f')](_0x132e69)[_0x2044('0x19')](function(){for(var _0xc48f1=0x0;_0xc48f1<_0x132e69['length'];_0xc48f1+=0x1){_0x40ac9a[_0x2044('0x47')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x132e69[_0xc48f1]),'UserId':Number(_0x3e1d16['id'])});}});}})['then'](function(){if(_0x5f1472==='leave'){var _0xdd3470=_[_0x2044('0x14')](_0x3e1d16['WhatsappInteractions'],'id');return _0x3e1d16[_0x2044('0x50')](_0xdd3470)[_0x2044('0x19')](function(){for(var _0x17842f=0x0;_0x17842f<_0xdd3470[_0x2044('0x1c')];_0x17842f+=0x1){_0x40ac9a['emit'](_0x2044('0x51'),{'WhatsappInteractionId':Number(_0xdd3470[_0x17842f]),'UserId':Number(_0x3e1d16['id'])});}});}})[_0x2044('0x52')](function(_0x4a1a09){_0x559d01['log'](_0x4a1a09);});}}function onDisconnect(_0x32b1b9,_0x57e769){joinOrLeave(_0x32b1b9,_0x2044('0x45'),_0x57e769);}function onConnect(_0x399633){joinOrLeave(_0x399633,_0x2044('0x53'));}exports[_0x2044('0x54')]=function(_0x1e0039){_0x1e0039['on'](_0x2044('0x55'),function(_0x46b33c){_0x46b33c[_0x2044('0x56')](0x0);_0x46b33c[_0x2044('0x57')]=_0x46b33c['request'][_0x2044('0x55')][_0x2044('0x58')]+':'+_0x46b33c['request'][_0x2044('0x55')][_0x2044('0x59')];_0x46b33c[_0x2044('0x5a')]=new Date();_0x46b33c[_0x2044('0x5b')]=function(_0xe3a213){console[_0x2044('0x5b')](_0x2044('0x5c')+_0x46b33c[_0x2044('0x5d')]['name']+'['+_0x46b33c[_0x2044('0x57')]+']',_0xe3a213);};_0x46b33c['on'](_0x2044('0x5e'),function(){onDisconnect(_0x46b33c,_0x1e0039);_0x46b33c[_0x2044('0x5b')](_0x2044('0x5f'));});onConnect(_0x46b33c);_0x46b33c[_0x2044('0x5b')](_0x2044('0x60'));});}; \ No newline at end of file +var _0xb8cb=['user_has_chat_interactions:remove','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','address','request','remoteAddress','remotePort','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','role','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','User','where','format','length','handshake','query','ChatInteractions','MailInteraction','MailInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Campaign','user','userProfileId','ChatQueues','WhatsappQueue','Trunk','agent','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','chat','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit'];(function(_0x39dfc6,_0x5387fc){var _0x577cad=function(_0x52e11b){while(--_0x52e11b){_0x39dfc6['push'](_0x39dfc6['shift']());}};_0x577cad(++_0x5387fc);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x335a25,_0x1b88ba){_0x335a25=_0x335a25-0x0;var _0x31ebbe=_0xb8cb[_0x335a25];return _0x31ebbe;};'use strict';var _=require(_0xbb8c('0x0'));var util=require(_0xbb8c('0x1'));var BPromise=require(_0xbb8c('0x2'));var db=require(_0xbb8c('0x3'))['db'];var config=require(_0xbb8c('0x4'));var queryQueues={'attributes':['id',_0xbb8c('0x5')],'include':[{'as':_0xbb8c('0x6'),'model':db['User'],'attributes':['id',_0xbb8c('0x5'),_0xbb8c('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xbb8c('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xbb8c('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0xbb8c('0x5')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xbb8c('0x5'),_0xbb8c('0x9')],'where':{'type':_0xbb8c('0xa')}};function getAssociatedResources(_0x823c83,_0x1d62d4,_0x2a9791){return db[_0xbb8c('0xb')][_0xbb8c('0xc')]({'where':{'name':_0x823c83,'userProfileId':_0x1d62d4},'raw':!![]})[_0xbb8c('0xd')](function(_0x3aea3d){if(_0x3aea3d){if(_0x3aea3d[_0xbb8c('0xe')]){switch(_0x823c83){case _0xbb8c('0xf'):case'ChatQueues':case _0xbb8c('0x10'):case _0xbb8c('0x11'):case _0xbb8c('0x12'):case _0xbb8c('0x13'):case _0xbb8c('0x14'):return db[_0x2a9791]['findAll'](queryQueues);case _0xbb8c('0x15'):return db[_0x2a9791][_0xbb8c('0x16')](queryTelephones);case _0xbb8c('0x17'):return db[_0x2a9791][_0xbb8c('0x16')](queryTrunks);case _0xbb8c('0x18'):return db[_0x2a9791][_0xbb8c('0x16')](queryCampaigns);}}else{return db[_0xbb8c('0x19')]['findAll']({'attributes':[_0xbb8c('0x1a')],'where':{'sectionId':_0x3aea3d['id']},'raw':!![]})[_0xbb8c('0xd')](function(_0x425891){if(_0x425891){var _0x403710={'where':{'id':_[_0xbb8c('0x1b')](_0x425891,_0xbb8c('0x1a'))},'raw':!![]};switch(_0x2a9791){case _0xbb8c('0x1c'):_0x403710[_0xbb8c('0x1d')][_0xbb8c('0x7')]=_0xbb8c('0x8');break;case'Campaign':_0x403710[_0xbb8c('0x1d')][_0xbb8c('0x9')]=_0xbb8c('0xa');break;}return db[_0x2a9791][_0xbb8c('0x16')](_0x403710);}else{return[];}});}}else{return[];}})[_0xbb8c('0xd')](function(_0x25e2c4){return _0x25e2c4;});}function joinOrLeaveQueues(_0x520ea9,_0x472156,_0x30e1b7,_0x55d9c4){_0x520ea9[_0x472156](util[_0xbb8c('0x1e')]('%s:queue:%s',_0x30e1b7,_0x55d9c4[_0xbb8c('0x5')]));if(_0x55d9c4['Agents']){for(var _0x32b961=0x0;_0x32b961<_0x55d9c4[_0xbb8c('0x6')][_0xbb8c('0x1f')];_0x32b961+=0x1){_0x520ea9[_0x472156](util['format']('user:%s',_0x55d9c4[_0xbb8c('0x6')][_0x32b961]['name']));}}}function joinOrLeave(_0x171530,_0x1b764d,_0x36163c){var _0xec7fb5;if(_0x171530[_0xbb8c('0x20')][_0xbb8c('0x21')]['id']){db[_0xbb8c('0x1c')]['find']({'attributes':['id',_0xbb8c('0x5'),'role','userProfileId'],'where':{'id':_0x171530[_0xbb8c('0x20')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0xbb8c('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xbb8c('0x23')],'as':_0xbb8c('0x24'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xbb8c('0x25')],'as':_0xbb8c('0x26'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xbb8c('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xbb8c('0x28')],'as':_0xbb8c('0x29'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x271ad7){if(_0x271ad7){_0xec7fb5=_0x271ad7;_0x171530[_0x1b764d](util[_0xbb8c('0x1e')](_0xbb8c('0x2a'),_0x271ad7[_0xbb8c('0x5')]));var _0x260d7b=[];switch(_0x271ad7[_0xbb8c('0x7')]){case _0xbb8c('0x2b'):_0x171530[_0x1b764d](_0xbb8c('0x2c'));_0x171530[_0x1b764d](_0xbb8c('0x2d'));if(queryQueues[_0xbb8c('0x2e')]('include')){delete queryQueues['include'];}_0x260d7b[_0xbb8c('0x2f')](db[_0xbb8c('0x30')][_0xbb8c('0x16')](queryQueues));_0x260d7b[_0xbb8c('0x2f')](db[_0xbb8c('0x31')]['findAll'](queryQueues));_0x260d7b[_0xbb8c('0x2f')](db[_0xbb8c('0x32')][_0xbb8c('0x16')](queryQueues));_0x260d7b[_0xbb8c('0x2f')](db[_0xbb8c('0x33')][_0xbb8c('0x16')](queryQueues));_0x260d7b[_0xbb8c('0x2f')](db[_0xbb8c('0x34')][_0xbb8c('0x16')](queryQueues));_0x260d7b['push'](db[_0xbb8c('0x35')][_0xbb8c('0x16')](queryQueues));_0x260d7b[_0xbb8c('0x2f')](db['WhatsappQueue']['findAll'](queryQueues));_0x260d7b[_0xbb8c('0x2f')](db[_0xbb8c('0x1c')][_0xbb8c('0x16')](queryTelephones));_0x260d7b[_0xbb8c('0x2f')](db['Trunk'][_0xbb8c('0x16')](queryTrunks));_0x260d7b[_0xbb8c('0x2f')](db[_0xbb8c('0x36')][_0xbb8c('0x16')](queryCampaigns));_0x260d7b[_0xbb8c('0x2f')](db['User'][_0xbb8c('0x16')](queryAgents));break;case _0xbb8c('0x37'):_0x171530[_0x1b764d](_0xbb8c('0x2c'));_0x171530[_0x1b764d](_0xbb8c('0x2d'));_0x260d7b['push'](getAssociatedResources(_0xbb8c('0xf'),_0x271ad7[_0xbb8c('0x38')],_0xbb8c('0x30')));_0x260d7b[_0xbb8c('0x2f')](getAssociatedResources(_0xbb8c('0x39'),_0x271ad7[_0xbb8c('0x38')],_0xbb8c('0x31')));_0x260d7b[_0xbb8c('0x2f')](getAssociatedResources(_0xbb8c('0x10'),_0x271ad7[_0xbb8c('0x38')],_0xbb8c('0x32')));_0x260d7b[_0xbb8c('0x2f')](getAssociatedResources('SmsQueues',_0x271ad7[_0xbb8c('0x38')],_0xbb8c('0x33')));_0x260d7b[_0xbb8c('0x2f')](getAssociatedResources(_0xbb8c('0x12'),_0x271ad7['userProfileId'],_0xbb8c('0x34')));_0x260d7b['push'](getAssociatedResources('OpenchannelQueues',_0x271ad7[_0xbb8c('0x38')],_0xbb8c('0x35')));_0x260d7b[_0xbb8c('0x2f')](getAssociatedResources('WhatsappQueues',_0x271ad7[_0xbb8c('0x38')],_0xbb8c('0x3a')));_0x260d7b['push'](getAssociatedResources(_0xbb8c('0x15'),_0x271ad7[_0xbb8c('0x38')],_0xbb8c('0x1c')));_0x260d7b[_0xbb8c('0x2f')](getAssociatedResources('Trunks',_0x271ad7[_0xbb8c('0x38')],_0xbb8c('0x3b')));_0x260d7b[_0xbb8c('0x2f')](getAssociatedResources('IvrCampaigns',_0x271ad7[_0xbb8c('0x38')],_0xbb8c('0x36')));_0x260d7b['push'](db['User'][_0xbb8c('0x16')](queryAgents));break;case _0xbb8c('0x3c'):_0x171530[_0x1b764d]('voice:inbound');_0x171530[_0x1b764d]('voice:outbound');_0x260d7b[_0xbb8c('0x2f')](_0x271ad7['getVoiceQueues']({'attributes':['id',_0xbb8c('0x5')]}));_0x260d7b['push'](_0x271ad7[_0xbb8c('0x3d')]({'attributes':['id','name']}));_0x260d7b[_0xbb8c('0x2f')](_0x271ad7[_0xbb8c('0x3e')]({'attributes':['id',_0xbb8c('0x5')]}));_0x260d7b[_0xbb8c('0x2f')](_0x271ad7[_0xbb8c('0x3f')]({'attributes':['id',_0xbb8c('0x5')]}));_0x260d7b['push'](_0x271ad7[_0xbb8c('0x40')]({'attributes':['id','name']}));_0x260d7b[_0xbb8c('0x2f')](_0x271ad7[_0xbb8c('0x41')]({'attributes':['id',_0xbb8c('0x5')]}));_0x260d7b[_0xbb8c('0x2f')](_0x271ad7[_0xbb8c('0x42')]({'attributes':['id',_0xbb8c('0x5')]}));break;}return BPromise['all'](_0x260d7b);}})['then'](function(_0x110760){if(_0x110760&&_0x110760[_0xbb8c('0x1f')]){for(var _0x53643d=0x0;_0x53643d<_0x110760[_0xbb8c('0x1f')];_0x53643d+=0x1){for(var _0x317b4f=0x0;_0x317b4f<_0x110760[_0x53643d][_0xbb8c('0x1f')];_0x317b4f+=0x1){switch(_0x53643d){case 0x0:joinOrLeaveQueues(_0x171530,_0x1b764d,'voice',_0x110760[_0x53643d][_0x317b4f]);break;case 0x1:joinOrLeaveQueues(_0x171530,_0x1b764d,_0xbb8c('0x43'),_0x110760[_0x53643d][_0x317b4f]);break;case 0x2:joinOrLeaveQueues(_0x171530,_0x1b764d,'fax',_0x110760[_0x53643d][_0x317b4f]);break;case 0x3:joinOrLeaveQueues(_0x171530,_0x1b764d,_0xbb8c('0x44'),_0x110760[_0x53643d][_0x317b4f]);break;case 0x4:joinOrLeaveQueues(_0x171530,_0x1b764d,_0xbb8c('0x45'),_0x110760[_0x53643d][_0x317b4f]);break;case 0x5:joinOrLeaveQueues(_0x171530,_0x1b764d,_0xbb8c('0x46'),_0x110760[_0x53643d][_0x317b4f]);break;case 0x6:joinOrLeaveQueues(_0x171530,_0x1b764d,'whatsapp',_0x110760[_0x53643d][_0x317b4f]);break;case 0x7:if(_0xec7fb5[_0xbb8c('0x7')]!==_0xbb8c('0x3c'))_0x171530[_0x1b764d](util[_0xbb8c('0x1e')](_0xbb8c('0x47'),_0x110760[_0x53643d][_0x317b4f][_0xbb8c('0x5')]));break;case 0x8:if(_0xec7fb5[_0xbb8c('0x7')]!==_0xbb8c('0x3c'))_0x171530[_0x1b764d](util[_0xbb8c('0x1e')](_0xbb8c('0x48'),_0x110760[_0x53643d][_0x317b4f][_0xbb8c('0x5')]));break;case 0x9:if(_0xec7fb5['role']!==_0xbb8c('0x3c'))_0x171530[_0x1b764d](util[_0xbb8c('0x1e')](_0xbb8c('0x49'),_0x110760[_0x53643d][_0x317b4f]['type'],_0x110760[_0x53643d][_0x317b4f][_0xbb8c('0x5')]));break;case 0xa:_0x171530[_0x1b764d](util[_0xbb8c('0x1e')](_0xbb8c('0x2a'),_0x110760[_0x53643d][_0x317b4f][_0xbb8c('0x5')]));break;}}}}})[_0xbb8c('0xd')](function(){if(_0x1b764d===_0xbb8c('0x4a')){var _0x4c5afd=_[_0xbb8c('0x1b')](_0xec7fb5[_0xbb8c('0x22')],'id');return _0xec7fb5[_0xbb8c('0x4b')](_0x4c5afd)['then'](function(){for(var _0x3973c3=0x0;_0x3973c3<_0x4c5afd['length'];_0x3973c3+=0x1){_0x36163c[_0xbb8c('0x4c')](_0xbb8c('0x4d'),{'ChatInteractionId':Number(_0x4c5afd[_0x3973c3]),'UserId':Number(_0xec7fb5['id'])});}});}})[_0xbb8c('0xd')](function(){if(_0x1b764d===_0xbb8c('0x4a')){var _0x16c9e3=_['map'](_0xec7fb5[_0xbb8c('0x24')],'id');return _0xec7fb5['removeMailInteractions'](_0x16c9e3)[_0xbb8c('0xd')](function(){for(var _0x1ff96f=0x0;_0x1ff96f<_0x16c9e3[_0xbb8c('0x1f')];_0x1ff96f+=0x1){_0x36163c['emit'](_0xbb8c('0x4e'),{'MailInteractionId':Number(_0x16c9e3[_0x1ff96f]),'UserId':Number(_0xec7fb5['id'])});}});}})[_0xbb8c('0xd')](function(){if(_0x1b764d===_0xbb8c('0x4a')){var _0x2bce32=_[_0xbb8c('0x1b')](_0xec7fb5[_0xbb8c('0x4f')],'id');return _0xec7fb5[_0xbb8c('0x50')](_0x2bce32)[_0xbb8c('0xd')](function(){for(var _0x22475d=0x0;_0x22475d<_0x2bce32[_0xbb8c('0x1f')];_0x22475d+=0x1){_0x36163c[_0xbb8c('0x4c')](_0xbb8c('0x51'),{'FaxInteractionId':Number(_0x2bce32[_0x22475d]),'UserId':Number(_0xec7fb5['id'])});}});}})[_0xbb8c('0xd')](function(){if(_0x1b764d==='leave'){var _0x582d95=_[_0xbb8c('0x1b')](_0xec7fb5[_0xbb8c('0x26')],'id');return _0xec7fb5['removeSmsInteractions'](_0x582d95)[_0xbb8c('0xd')](function(){for(var _0x4244cf=0x0;_0x4244cf<_0x582d95['length'];_0x4244cf+=0x1){_0x36163c[_0xbb8c('0x4c')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x582d95[_0x4244cf]),'UserId':Number(_0xec7fb5['id'])});}});}})[_0xbb8c('0xd')](function(){if(_0x1b764d===_0xbb8c('0x4a')){var _0x13a850=_[_0xbb8c('0x1b')](_0xec7fb5['OpenchannelInteractions'],'id');return _0xec7fb5[_0xbb8c('0x52')](_0x13a850)['then'](function(){for(var _0x3eccad=0x0;_0x3eccad<_0x13a850['length'];_0x3eccad+=0x1){_0x36163c['emit'](_0xbb8c('0x53'),{'OpenchannelInteractionId':Number(_0x13a850[_0x3eccad]),'UserId':Number(_0xec7fb5['id'])});}});}})['then'](function(){if(_0x1b764d===_0xbb8c('0x4a')){var _0x241bf0=_[_0xbb8c('0x1b')](_0xec7fb5[_0xbb8c('0x29')],'id');return _0xec7fb5[_0xbb8c('0x54')](_0x241bf0)[_0xbb8c('0xd')](function(){for(var _0x20d469=0x0;_0x20d469<_0x241bf0[_0xbb8c('0x1f')];_0x20d469+=0x1){_0x36163c[_0xbb8c('0x4c')](_0xbb8c('0x55'),{'WhatsappInteractionId':Number(_0x241bf0[_0x20d469]),'UserId':Number(_0xec7fb5['id'])});}});}})[_0xbb8c('0x56')](function(_0x24a5d5){_0x171530[_0xbb8c('0x57')](_0x24a5d5);});}}function onDisconnect(_0x18a425,_0x333c16){joinOrLeave(_0x18a425,_0xbb8c('0x4a'),_0x333c16);}function onConnect(_0x58d0db){joinOrLeave(_0x58d0db,_0xbb8c('0x58'));}exports['default']=function(_0xbb05f9){_0xbb05f9['on'](_0xbb8c('0x59'),function(_0x2eccea){_0x2eccea['setMaxListeners'](0x0);_0x2eccea[_0xbb8c('0x5a')]=_0x2eccea[_0xbb8c('0x5b')]['connection'][_0xbb8c('0x5c')]+':'+_0x2eccea['request']['connection'][_0xbb8c('0x5d')];_0x2eccea['connectedAt']=new Date();_0x2eccea[_0xbb8c('0x57')]=function(_0x528db9){console[_0xbb8c('0x57')]('SocketIO\x20'+_0x2eccea[_0xbb8c('0x5e')][_0xbb8c('0x5')]+'['+_0x2eccea['address']+']',_0x528db9);};_0x2eccea['on'](_0xbb8c('0x5f'),function(){onDisconnect(_0x2eccea,_0xbb05f9);_0x2eccea[_0xbb8c('0x57')](_0xbb8c('0x60'));});onConnect(_0x2eccea);_0x2eccea[_0xbb8c('0x57')](_0xbb8c('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index f9dd359..6df4b83 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 _0x0723=['ChatMessage','Sms','SmsInteraction','afterUpdate','SmsMessage','newmessage','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','then','info','Trigger,\x20%s','error','code','catch','get','channel','event','CmContact','keys','length','startsWith','cf_','ContactId','sequelize','Sequelize','SELECT','UserId','find','interface','format','SIP/%s','name','incomingmessage','opened','describe','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','QueryTypes','changed','closed','contact','User','default','hasOwnProperty','model','hook','toLowerCase','condition','../logger','triggers','lodash','client','http','Chat','ChatInteraction','afterCreate','newinteraction','closedinteraction'];(function(_0x1b9069,_0x3927e5){var _0x563b7c=function(_0x9ca634){while(--_0x9ca634){_0x1b9069['push'](_0x1b9069['shift']());}};_0x563b7c(++_0x3927e5);}(_0x0723,0x188));var _0x3072=function(_0x34b198,_0x271ea5){_0x34b198=_0x34b198-0x0;var _0x440daf=_0x0723[_0x34b198];return _0x440daf;};'use strict';var util=require('util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var logger=require(_0x3072('0x0'))(_0x3072('0x1'));var _=require(_0x3072('0x2'));var client=jayson[_0x3072('0x3')][_0x3072('0x4')]({'port':0x232a});var triggers=[{'channel':_0x3072('0x5'),'model':_0x3072('0x6'),'event':_0x3072('0x7'),'condition':_0x3072('0x8'),'callback':afterCreate},{'channel':_0x3072('0x5'),'model':_0x3072('0x6'),'event':'afterUpdate','condition':_0x3072('0x9'),'callback':afterUpdate},{'channel':_0x3072('0x5'),'model':_0x3072('0xa'),'event':_0x3072('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x3072('0xb'),'model':_0x3072('0xc'),'event':_0x3072('0x7'),'condition':_0x3072('0x8'),'callback':afterCreate},{'channel':'Sms','model':_0x3072('0xc'),'event':_0x3072('0xd'),'condition':_0x3072('0x9'),'callback':afterUpdate},{'channel':_0x3072('0xb'),'model':_0x3072('0xe'),'event':_0x3072('0x7'),'condition':_0x3072('0xf'),'callback':afterCreateMessage},{'channel':_0x3072('0x10'),'model':_0x3072('0x11'),'event':_0x3072('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x3072('0x10'),'model':'WhatsappInteraction','event':_0x3072('0xd'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x3072('0x10'),'model':'WhatsappMessage','event':_0x3072('0x7'),'condition':_0x3072('0xf'),'callback':afterCreateMessage},{'channel':_0x3072('0x12'),'model':_0x3072('0x13'),'event':_0x3072('0x7'),'condition':_0x3072('0x8'),'callback':afterCreate},{'channel':_0x3072('0x12'),'model':_0x3072('0x13'),'event':'afterUpdate','condition':_0x3072('0x9'),'callback':afterUpdate},{'channel':'Fax','model':_0x3072('0x14'),'event':_0x3072('0x7'),'condition':_0x3072('0xf'),'callback':afterCreateMessage},{'channel':_0x3072('0x15'),'model':_0x3072('0x16'),'event':_0x3072('0x7'),'condition':_0x3072('0x8'),'callback':afterCreate},{'channel':_0x3072('0x15'),'model':_0x3072('0x16'),'event':_0x3072('0xd'),'condition':_0x3072('0x9'),'callback':afterUpdate},{'channel':_0x3072('0x15'),'model':_0x3072('0x17'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x3072('0x18'),'model':_0x3072('0x19'),'event':_0x3072('0x7'),'condition':_0x3072('0x8'),'callback':afterCreate},{'channel':_0x3072('0x18'),'model':_0x3072('0x19'),'event':_0x3072('0xd'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Openchannel','model':_0x3072('0x1a'),'event':'afterCreate','condition':_0x3072('0xf'),'callback':afterCreateMessage}];function request(_0x5a7f98){return client['request']('EventManager',_0x5a7f98)[_0x3072('0x1b')](function(_0x1173b9){logger[_0x3072('0x1c')](_0x3072('0x1d'),'EventManager',_0x1173b9);if(_0x1173b9['error']){if(_0x1173b9[_0x3072('0x1e')][_0x3072('0x1f')]===0x1f4){logger[_0x3072('0x1e')](_0x3072('0x1d'),'EventManager',_0x1173b9['error']);}}})[_0x3072('0x20')](function(_0x42ff3b){logger[_0x3072('0x1e')](_0x3072('0x1d'),'EventManager',_0x42ff3b);});}function afterCreateMessage(_0x396630,_0x8d7dc4){return function(_0x1fd14a,_0x5d819f){_0x1fd14a=_0x1fd14a[_0x3072('0x21')]({'plain':!![]});_0x1fd14a[_0x3072('0x22')]=_0x396630;_0x1fd14a[_0x3072('0x23')]=_0x1fd14a['direction'];return db[_0x3072('0x24')]['describe']()['then'](function(_0x27eede){var _0x51d3f7=[];for(var _0x2f6a89=0x0;_0x2f6a89=_0x59292e[_0x4dc8('0x14')]){throw Error(_0x4dc8('0x15'));}_0x183ddf(_0x1bb285);})[_0x4dc8('0x16')](function(_0x1a618c){_0x112610(_0x1a618c);});});}; \ No newline at end of file +var _0x24db=['isUndefined','blockedAt','role','agent','User','count','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','includes','clearBlockUser'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x24db,0xec));var _0xb24d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb24d('0x0'));var BPromise=require(_0xb24d('0x1'));var db=require(_0xb24d('0x2'))['db'];var util=require(_0xb24d('0x3'));var channels=['voice',_0xb24d('0x4'),_0xb24d('0x5'),_0xb24d('0x6'),_0xb24d('0x7'),_0xb24d('0x8'),_0xb24d('0x9')];exports[_0xb24d('0xa')]=function(){return channels;};exports[_0xb24d('0xb')]=function(_0x400fd7){_0x400fd7=_0x400fd7['toLowerCase']();return _[_0xb24d('0xc')](channels,_0x400fd7);};exports[_0xb24d('0xd')]=function(_0xeabf25,_0xce63fe,_0x29fecc,_0x567a58){var _0x231c65={'loginAttempts':_0xce63fe,'blocked':_0x29fecc};if(!_[_0xb24d('0xe')](_0x567a58)){_0x231c65[_0xb24d('0xf')]=_0x567a58;}return _0xeabf25['updateAttributes'](_0x231c65);};exports['getLicense']=function(_0x44923e){return new BPromise(function(_0x36326b,_0x205afc){var _0xcce3f8=0x0;if(_0x44923e[_0xb24d('0x10')]!==_0xb24d('0x11')){_0x36326b(_0x44923e);}db[_0xb24d('0x12')][_0xb24d('0x13')]({'where':{'role':_0xb24d('0x11'),'online':!![],'id':{'$ne':_0x44923e['id']}}})[_0xb24d('0x14')](function(_0x1ee26f){_0xcce3f8=_0x1ee26f;return util[_0xb24d('0x15')]();})[_0xb24d('0x14')](function(_0x1ac34c){if(_0x1ac34c&&_0x1ac34c[_0xb24d('0x16')]&&_0xcce3f8>=_0x1ac34c[_0xb24d('0x16')]){throw Error(_0xb24d('0x17'));}_0x36326b(_0x44923e);})[_0xb24d('0x18')](function(_0x4bc7ea){_0x205afc(_0x4bc7ea);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 7860181..4ae3966 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x82f7=['send','exports','status','render','json'];(function(_0x393443,_0x42364f){var _0x20bfdb=function(_0x2749bc){while(--_0x2749bc){_0x393443['push'](_0x393443['shift']());}};_0x20bfdb(++_0x42364f);}(_0x82f7,0x88));var _0x782f=function(_0x4c3bff,_0x176cc5){_0x4c3bff=_0x4c3bff-0x0;var _0x56f185=_0x82f7[_0x4c3bff];return _0x56f185;};'use strict';module[_0x782f('0x0')][0x194]=function pageNotFound(_0xd0ab18,_0xeeb6f9){var _0x1ab3e6='404';var _0x1a1295=0x194;var _0x1aa790={'status':_0x1a1295};_0xeeb6f9['status'](_0x1aa790[_0x782f('0x1')]);_0xeeb6f9[_0x782f('0x2')](_0x1ab3e6,{},function(_0x28edc3,_0x2214e6){if(_0x28edc3){return _0xeeb6f9[_0x782f('0x1')](_0x1aa790['status'])[_0x782f('0x3')](_0x1aa790);}_0xeeb6f9[_0x782f('0x4')](_0x2214e6);});}; \ No newline at end of file +var _0x3492=['exports','404','status','json','send'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x3492,0x17c));var _0x2349=function(_0x811e11,_0x13c010){_0x811e11=_0x811e11-0x0;var _0x3f6eb2=_0x3492[_0x811e11];return _0x3f6eb2;};'use strict';module[_0x2349('0x0')][0x194]=function pageNotFound(_0x4e3772,_0x1d551f){var _0x487a02=_0x2349('0x1');var _0x22d179=0x194;var _0x5b3820={'status':_0x22d179};_0x1d551f['status'](_0x5b3820[_0x2349('0x2')]);_0x1d551f['render'](_0x487a02,{},function(_0x56c47b,_0xace430){if(_0x56c47b){return _0x1d551f[_0x2349('0x2')](_0x5b3820['status'])[_0x2349('0x3')](_0x5b3820);}_0x1d551f[_0x2349('0x4')](_0xace430);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index fa14074..38e1d2a 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x62bb=['../api/plugin/plugin.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','VoiceMail','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','ChatGroup','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','VoiceQueues','MailQueues','FaxQueue','FaxQueues','UserFaxQueue','SmsQueue','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','moh_has_sounds','VoiceQueue','VoiceQueueId','CmHopper','Hoppers','HopperHistories','HopperBlacks','JscriptySessionReport','JscriptySessions','Trunk','TrunkBackup','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','Contact','ContactId','MailServerIn','MailAccountId','Imap','Smtp','Answers','List','ListId','TemplateId','mandatoryDispositionPauseId','Owner','mail_interaction_has_tags','Tags','Users','MailInteractionId','Attachments','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','MailApplication','restrict','Tag','Items','Dispositions','FaxAccountId','Interactions','Exntensions','TagId','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','ThroughTags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','ChatGroupId','ChatProactiveAction','CompanyId','Phones','CmCompany','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Queue','OwnerId','All','OneAll','Any','OneAny','AutomationAnyId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','ItemType','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Action','TriggerId','Fields','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','DescriptionId','FieldId','Subject','Description','VariableId','SugarcrmConfiguration','Field','DeskAccount','Descriptions','int_desk_configuration_has_tags','ZohoField','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','FromId','ToId','SessionId','ProjectId','team_has_mail_queues','CampaignId','TrunkId','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToMailQueueId','ToQueue','ToMailAccountId','ChatTransferReport','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToUserId','ToFaxAccountId','ToAccount','FromOpenchannelAccountId','ToAgent','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','Queues','user_has_voice_prefixes','UserProfileSections','UserProfileSection','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','user_has_whatsapp_interactions','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','path','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','xcall','xC@LL1234','mysql','utf8mb4','name','utf8_general_ci','sequelizeHistory','127.0.0.1','utf8','options','database','username','User','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','import','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin'];(function(_0xbeceb,_0x3e71f3){var _0x170da3=function(_0x6d4e92){while(--_0x6d4e92){_0xbeceb['push'](_0xbeceb['shift']());}};_0x170da3(++_0x3e71f3);}(_0x62bb,0x110));var _0xb62b=function(_0x5117ab,_0x25cdf7){_0x5117ab=_0x5117ab-0x0;var _0x329f0d=_0x62bb[_0x5117ab];return _0x329f0d;};'use strict';var path=require(_0xb62b('0x0'));var config=require(_0xb62b('0x1'));var Sequelize=require(_0xb62b('0x2'));var _=require(_0xb62b('0x3'));var jstz=require(_0xb62b('0x4'));var timezone=jstz[_0xb62b('0x5')]();config[_0xb62b('0x2')]=_[_0xb62b('0x6')](config[_0xb62b('0x2')],{'database':'motion2','username':_0xb62b('0x7'),'password':_0xb62b('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xb62b('0x9'),'dialectOptions':{'charset':_0xb62b('0xa')},'logging':![],'timezone':timezone[_0xb62b('0xb')](),'define':{'charset':'utf8','collate':_0xb62b('0xc')}}});config[_0xb62b('0xd')]=_[_0xb62b('0x6')](config[_0xb62b('0xd')],{'database':'motion2','username':_0xb62b('0x7'),'password':_0xb62b('0x8'),'options':{'host':_0xb62b('0xe'),'port':0xcea,'dialect':_0xb62b('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xb62b('0xf'),'collate':_0xb62b('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0xb62b('0x2')]['username'],config['sequelize']['password'],config[_0xb62b('0x2')][_0xb62b('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xb62b('0xd')][_0xb62b('0x11')],config['sequelizeHistory'][_0xb62b('0x12')],config[_0xb62b('0xd')]['password'],config[_0xb62b('0xd')][_0xb62b('0x10')])};db[_0xb62b('0x13')]=db[_0xb62b('0x2')]['import'](_0xb62b('0x14'));db[_0xb62b('0x15')]=db[_0xb62b('0x2')]['import'](_0xb62b('0x16'));db[_0xb62b('0x17')]=db[_0xb62b('0x2')]['import'](_0xb62b('0x18'));db[_0xb62b('0x19')]=db['sequelize'][_0xb62b('0x1a')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0xb62b('0x2')]['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db[_0xb62b('0x2')]['import'](_0xb62b('0x1b'));db['VoiceRecording']=db[_0xb62b('0x2')]['import'](_0xb62b('0x1c'));db[_0xb62b('0x1d')]=db[_0xb62b('0x2')][_0xb62b('0x1a')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x1e'));db[_0xb62b('0x1f')]=db[_0xb62b('0x2')][_0xb62b('0x1a')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xb62b('0x20')]=db['sequelize']['import'](_0xb62b('0x21'));db['VoiceDialReport']=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0x22'));db[_0xb62b('0x23')]=db[_0xb62b('0x2')]['import']('../api/voiceAgentReport/voiceAgentReport.model');db[_0xb62b('0x24')]=db[_0xb62b('0x2')]['import'](_0xb62b('0x25'));db[_0xb62b('0x26')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x27'));db['Trunk']=db[_0xb62b('0x2')]['import']('../api/trunk/trunk.model');db[_0xb62b('0x28')]=db[_0xb62b('0x2')]['import'](_0xb62b('0x29'));db[_0xb62b('0x2a')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x2b'));db[_0xb62b('0x2c')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x2d'));db[_0xb62b('0x2e')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x2f'));db[_0xb62b('0x30')]=db[_0xb62b('0x2')]['import']('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x31'));db[_0xb62b('0x32')]=db['sequelize'][_0xb62b('0x1a')]('../api/userSmsQueue/userSmsQueue.model');db[_0xb62b('0x33')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x34'));db[_0xb62b('0x35')]=db[_0xb62b('0x2')][_0xb62b('0x1a')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0x36'));db[_0xb62b('0x37')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x38'));db[_0xb62b('0x39')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x3a'));db[_0xb62b('0x3b')]=db['sequelize']['import'](_0xb62b('0x3c'));db['MailSubstatus']=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0x3d'));db['MailInteraction']=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x3e'));db[_0xb62b('0x3f')]=db['sequelize'][_0xb62b('0x1a')]('../api/mailMessage/mailMessage.model');db['MailApplication']=db[_0xb62b('0x2')]['import'](_0xb62b('0x40'));db[_0xb62b('0x41')]=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0x42'));db[_0xb62b('0x43')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x44'));db[_0xb62b('0x45')]=db[_0xb62b('0x2')]['import'](_0xb62b('0x46'));db[_0xb62b('0x47')]=db[_0xb62b('0x2')]['import'](_0xb62b('0x48'));db[_0xb62b('0x49')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x4a'));db[_0xb62b('0x4b')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x4c'));db[_0xb62b('0x4d')]=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0x4e'));db['FaxQueue']=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0x4f'));db[_0xb62b('0x50')]=db[_0xb62b('0x2')][_0xb62b('0x1a')]('../api/faxQueueReport/faxQueueReport.model');db[_0xb62b('0x51')]=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0x52'));db[_0xb62b('0x53')]=db[_0xb62b('0x2')][_0xb62b('0x1a')]('../api/smsApplication/smsApplication.model');db[_0xb62b('0x54')]=db['sequelize'][_0xb62b('0x1a')]('../api/smsInteraction/smsInteraction.model');db[_0xb62b('0x55')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x56'));db['SmsQueue']=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x57'));db[_0xb62b('0x58')]=db[_0xb62b('0x2')]['import'](_0xb62b('0x59'));db[_0xb62b('0x5a')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x5b'));db[_0xb62b('0x5c')]=db[_0xb62b('0x2')]['import'](_0xb62b('0x5d'));db[_0xb62b('0x5e')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x5f'));db['OpenchannelQueue']=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x60'));db[_0xb62b('0x61')]=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0x62'));db[_0xb62b('0x63')]=db[_0xb62b('0x2')]['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xb62b('0x64')]=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0x65'));db[_0xb62b('0x66')]=db['sequelize']['import'](_0xb62b('0x67'));db[_0xb62b('0x68')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x69'));db[_0xb62b('0x6a')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x6b'));db[_0xb62b('0x6c')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x6d'));db['ChatGroup']=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x6e'));db['ChatProactiveAction']=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x6f'));db['CmCompany']=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x70'));db[_0xb62b('0x71')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x72'));db['CmHopper']=db[_0xb62b('0x2')]['import']('../api/cmHopper/cmHopper.model');db[_0xb62b('0x73')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x74'));db[_0xb62b('0x75')]=db['sequelize']['import'](_0xb62b('0x76'));db[_0xb62b('0x77')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x78'));db[_0xb62b('0x79')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x7a'));db[_0xb62b('0x7b')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x7c'));db['Action']=db[_0xb62b('0x2')]['import']('../api/action/action.model');db[_0xb62b('0x7d')]=db[_0xb62b('0x2')][_0xb62b('0x1a')]('../api/automation/automation.model');db[_0xb62b('0x7e')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x7f'));db[_0xb62b('0x80')]=db[_0xb62b('0x2')]['import'](_0xb62b('0x81'));db[_0xb62b('0x82')]=db[_0xb62b('0x2')]['import'](_0xb62b('0x83'));db[_0xb62b('0x84')]=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0x85'));db[_0xb62b('0x86')]=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0x87'));db[_0xb62b('0x88')]=db[_0xb62b('0x2')][_0xb62b('0x1a')]('../api/cdr/cdr.model');db[_0xb62b('0x89')]=db[_0xb62b('0x2')]['import'](_0xb62b('0x8a'));db[_0xb62b('0x8b')]=db[_0xb62b('0x2')]['import'](_0xb62b('0x8c'));db[_0xb62b('0x8d')]=db[_0xb62b('0x2')]['import'](_0xb62b('0x8e'));db['Tag']=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0x8f'));db[_0xb62b('0x90')]=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0x91'));db[_0xb62b('0x92')]=db[_0xb62b('0x2')]['import'](_0xb62b('0x93'));db[_0xb62b('0x94')]=db['sequelize'][_0xb62b('0x1a')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0xb62b('0x95')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x96'));db[_0xb62b('0x97')]=db['sequelize']['import'](_0xb62b('0x98'));db[_0xb62b('0x99')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x9a'));db[_0xb62b('0x9b')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x9c'));db[_0xb62b('0x9d')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x9e'));db[_0xb62b('0x9f')]=db[_0xb62b('0x2')][_0xb62b('0x1a')]('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db[_0xb62b('0x2')]['import'](_0xb62b('0xa0'));db[_0xb62b('0xa1')]=db[_0xb62b('0x2')]['import'](_0xb62b('0xa2'));db[_0xb62b('0xa3')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xa4'));db[_0xb62b('0xa5')]=db['sequelize']['import'](_0xb62b('0xa6'));db[_0xb62b('0xa7')]=db[_0xb62b('0x2')][_0xb62b('0x1a')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xb62b('0xa8')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xa9'));db[_0xb62b('0xaa')]=db[_0xb62b('0x2')][_0xb62b('0x1a')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xab'));db[_0xb62b('0xac')]=db[_0xb62b('0x2')][_0xb62b('0x1a')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db[_0xb62b('0x2')]['import'](_0xb62b('0xad'));db[_0xb62b('0xae')]=db['sequelize'][_0xb62b('0x1a')]('../api/intSugarcrmField/intSugarcrmField.model');db['DeskAccount']=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0xaf'));db[_0xb62b('0xb0')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xb1'));db[_0xb62b('0xb2')]=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0xb3'));db[_0xb62b('0xb4')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xb5'));db[_0xb62b('0xb6')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xb7'));db['ZohoField']=db[_0xb62b('0x2')]['import'](_0xb62b('0xb8'));db[_0xb62b('0xb9')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xba'));db['ZendeskConfiguration']=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0xbb'));db['ZendeskField']=db[_0xb62b('0x2')]['import'](_0xb62b('0xbc'));db[_0xb62b('0xbd')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xbe'));db[_0xb62b('0xbf')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xc0'));db[_0xb62b('0xc1')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xc2'));db[_0xb62b('0xc3')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xc4'));db[_0xb62b('0xc5')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xc6'));db[_0xb62b('0xc7')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xc8'));db[_0xb62b('0xc9')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xca'));db[_0xb62b('0xcb')]=db[_0xb62b('0x2')]['import'](_0xb62b('0xcc'));db[_0xb62b('0xcd')]=db[_0xb62b('0x2')]['import']('../api/intServicenowField/intServicenowField.model');db[_0xb62b('0xce')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xcf'));db[_0xb62b('0xd0')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xd1'));db[_0xb62b('0xd2')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xd3'));db[_0xb62b('0xd4')]=db[_0xb62b('0x2')][_0xb62b('0x1a')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xb62b('0xd5')]=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0xd6'));db[_0xb62b('0xd7')]=db[_0xb62b('0x2')][_0xb62b('0x1a')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0xb62b('0x2')]['import'](_0xb62b('0x9c'));db['Network']=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xd8'));db[_0xb62b('0xd9')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xda'));db[_0xb62b('0xdb')]=db[_0xb62b('0x2')][_0xb62b('0x1a')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xb62b('0xdc')]=db[_0xb62b('0x2')]['import'](_0xb62b('0xdd'));db[_0xb62b('0xde')]=db[_0xb62b('0x2')][_0xb62b('0x1a')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0xb62b('0x2')]['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xb62b('0xdf')]=db[_0xb62b('0x2')][_0xb62b('0x1a')]('../api/smsQueueReport/smsQueueReport.model');db[_0xb62b('0xe0')]=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0xe1'));db[_0xb62b('0xe2')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xe3'));db[_0xb62b('0xe4')]=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0xe5'));db[_0xb62b('0xe6')]=db['sequelize'][_0xb62b('0x1a')]('../api/setting/setting.model');db['SquareOdbc']=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0xe7'));db[_0xb62b('0xe8')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xe9'));db[_0xb62b('0xea')]=db[_0xb62b('0x2')]['import'](_0xb62b('0xeb'));db[_0xb62b('0xec')]=db['sequelize']['import'](_0xb62b('0xed'));db[_0xb62b('0xee')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xef'));db['License']=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xf0'));db[_0xb62b('0xf1')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xf2'));db['Migration']=db[_0xb62b('0x2')]['import'](_0xb62b('0xf3'));db[_0xb62b('0xf4')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xf5'));db[_0xb62b('0xf6')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xf7'));db['MailTransferReport']=db[_0xb62b('0x2')][_0xb62b('0x1a')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xf8'));db[_0xb62b('0xf9')]=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0xfa'));db[_0xb62b('0xfb')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0xfc'));db[_0xb62b('0xfd')]=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0xfe'));db[_0xb62b('0xff')]=db[_0xb62b('0x2')]['import'](_0xb62b('0x100'));db[_0xb62b('0x101')]=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0x102'));db[_0xb62b('0x103')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x104'));db['UserProfileSection']=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x105'));db[_0xb62b('0x106')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x107'));db[_0xb62b('0x108')]=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0x109'));db[_0xb62b('0x10a')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x10b'));db[_0xb62b('0x10c')]=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0x10d'));db[_0xb62b('0x10e')]=db[_0xb62b('0x2')]['import'](_0xb62b('0x10f'));db[_0xb62b('0x110')]=db[_0xb62b('0x2')][_0xb62b('0x1a')]('../api/whatsappMessage/whatsappMessage.model');db[_0xb62b('0x111')]=db['sequelize'][_0xb62b('0x1a')](_0xb62b('0x112'));db[_0xb62b('0x113')]=db['sequelize'][_0xb62b('0x1a')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0xb62b('0x114')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x115'));db[_0xb62b('0x116')]=db['sequelize']['import'](_0xb62b('0x117'));db[_0xb62b('0x118')]=db[_0xb62b('0x2')][_0xb62b('0x1a')](_0xb62b('0x119'));db[_0xb62b('0x13')][_0xb62b('0x11a')](db[_0xb62b('0x11b')],{'as':_0xb62b('0x11b'),'onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x11d')});db['User'][_0xb62b('0x11e')](db[_0xb62b('0x11f')],{'as':_0xb62b('0x120'),'foreignKey':'UserId'});db[_0xb62b('0x13')]['hasMany'](db[_0xb62b('0x2a')],{'as':_0xb62b('0x121'),'foreignKey':_0xb62b('0x11d')});db['User'][_0xb62b('0x11e')](db[_0xb62b('0x19')],{'as':_0xb62b('0x122'),'onDelete':'cascade','hooks':!![]});db[_0xb62b('0x13')]['hasMany'](db[_0xb62b('0x75')],{'as':_0xb62b('0x123'),'foreignKey':_0xb62b('0x11d')});db[_0xb62b('0x13')][_0xb62b('0x11e')](db[_0xb62b('0x77')],{'as':_0xb62b('0x124'),'foreignKey':_0xb62b('0x11d')});db['User'][_0xb62b('0x11e')](db[_0xb62b('0x79')],{'as':'ReportAgentPreview','foreignKey':'UserId'});db[_0xb62b('0x13')]['hasMany'](db[_0xb62b('0x5c')],{'as':_0xb62b('0x125'),'foreignKey':'UserId'});db[_0xb62b('0x13')]['hasMany'](db['ChatInteraction'],{'as':_0xb62b('0x126'),'foreignKey':_0xb62b('0x11d')});db[_0xb62b('0x13')][_0xb62b('0x11e')](db[_0xb62b('0x54')],{'as':_0xb62b('0x127'),'foreignKey':'UserId'});db[_0xb62b('0x13')][_0xb62b('0x11e')](db[_0xb62b('0x4b')],{'as':_0xb62b('0x128'),'foreignKey':_0xb62b('0x11d')});db[_0xb62b('0x13')][_0xb62b('0x11e')](db[_0xb62b('0x129')],{'as':_0xb62b('0x12a'),'foreignKey':'UserId'});db[_0xb62b('0x13')][_0xb62b('0x11e')](db[_0xb62b('0x10e')],{'as':_0xb62b('0x12b'),'foreignKey':_0xb62b('0x11d')});db[_0xb62b('0x13')][_0xb62b('0x11e')](db[_0xb62b('0x108')],{'as':_0xb62b('0x12c'),'foreignKey':_0xb62b('0x12d')});db[_0xb62b('0x13')][_0xb62b('0x12e')](db['UserProfile'],{'as':_0xb62b('0x103'),'foreignKey':_0xb62b('0x12f')});db['User'][_0xb62b('0x130')](db[_0xb62b('0x131')],{'as':_0xb62b('0x132'),'through':_0xb62b('0x133')});db[_0xb62b('0x13')][_0xb62b('0x130')](db[_0xb62b('0x71')],{'as':_0xb62b('0x134'),'through':_0xb62b('0x135')});db[_0xb62b('0x13')][_0xb62b('0x130')](db[_0xb62b('0xff')],{'as':_0xb62b('0x136'),'through':_0xb62b('0x137')});db[_0xb62b('0x13')][_0xb62b('0x130')](db['Team'],{'through':'user_has_teams'});db[_0xb62b('0x13')][_0xb62b('0x130')](db[_0xb62b('0x129')],{'as':_0xb62b('0x12a'),'through':_0xb62b('0x138')});db[_0xb62b('0x13')]['belongsToMany'](db[_0xb62b('0x66')],{'as':'ChatInteractions','through':_0xb62b('0x139')});db[_0xb62b('0x13')][_0xb62b('0x130')](db[_0xb62b('0x4b')],{'as':_0xb62b('0x128'),'through':_0xb62b('0x13a')});db[_0xb62b('0x13')]['belongsToMany'](db['SmsInteraction'],{'as':'SmsInteractions','through':_0xb62b('0x13b')});db['User'][_0xb62b('0x130')](db[_0xb62b('0x5c')],{'as':_0xb62b('0x125'),'through':'user_has_openchannel_interactions'});db[_0xb62b('0x13')][_0xb62b('0x130')](db['WhatsappInteraction'],{'as':_0xb62b('0x12b'),'through':'user_has_whatsapp_interactions'});db['User'][_0xb62b('0x130')](db['VoiceQueue'],{'as':_0xb62b('0x13c'),'through':'UserVoiceQueue','required':![]});db[_0xb62b('0x13')]['belongsToMany'](db[_0xb62b('0x3b')],{'as':_0xb62b('0x13d'),'through':'UserMailQueue','required':![]});db[_0xb62b('0x13')]['belongsToMany'](db[_0xb62b('0x6c')],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db[_0xb62b('0x13')][_0xb62b('0x130')](db[_0xb62b('0x13e')],{'as':_0xb62b('0x13f'),'through':_0xb62b('0x140'),'required':![]});db['User']['belongsToMany'](db[_0xb62b('0x141')],{'as':_0xb62b('0x142'),'through':_0xb62b('0x32'),'required':![]});db[_0xb62b('0x13')]['belongsToMany'](db[_0xb62b('0x143')],{'as':_0xb62b('0x144'),'through':'UserOpenchannelQueue','required':![]});db[_0xb62b('0x13')][_0xb62b('0x130')](db[_0xb62b('0x114')],{'as':_0xb62b('0x145'),'through':_0xb62b('0x35'),'required':![]});db[_0xb62b('0x13')][_0xb62b('0x130')](db[_0xb62b('0xff')],{'through':_0xb62b('0x137')});db[_0xb62b('0x13')][_0xb62b('0x130')](db[_0xb62b('0x101')],{'as':'VoicePrefixes','through':'user_has_voice_prefixes','required':![]});db[_0xb62b('0x13')][_0xb62b('0x130')](db[_0xb62b('0x61')],{'as':_0xb62b('0x146'),'through':_0xb62b('0x147')});db[_0xb62b('0x13')]['belongsToMany'](db['FaxAccount'],{'as':_0xb62b('0x148'),'through':_0xb62b('0x149')});db['User'][_0xb62b('0x130')](db[_0xb62b('0x39')],{'as':_0xb62b('0x14a'),'through':_0xb62b('0x14b')});db[_0xb62b('0x13')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0xb62b('0x14c'),'through':'user_has_openchannel_accounts'});db[_0xb62b('0x13')][_0xb62b('0x130')](db[_0xb62b('0x51')],{'as':'SmsAccounts','through':_0xb62b('0x14d')});db[_0xb62b('0x13')][_0xb62b('0x130')](db[_0xb62b('0x10a')],{'as':'WhatsappAccounts','through':_0xb62b('0x14e')});db[_0xb62b('0x13')][_0xb62b('0x130')](db[_0xb62b('0xe8')],{'as':_0xb62b('0x14f'),'through':_0xb62b('0x150')});db['VoiceChanSpy'][_0xb62b('0x11e')](db['VoiceExtension'],{'as':_0xb62b('0x151'),'onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x152')});db['VoiceContext'][_0xb62b('0x11e')](db['VoiceExtension'],{'onDelete':'cascade'});db[_0xb62b('0x19')][_0xb62b('0x11e')](db[_0xb62b('0x19')],{'as':_0xb62b('0x153'),'onDelete':_0xb62b('0x11c')});db[_0xb62b('0x154')]['belongsToMany'](db['Sound'],{'as':'Sounds','through':_0xb62b('0x155')});db[_0xb62b('0x156')][_0xb62b('0x11e')](db[_0xb62b('0x2a')],{'as':'Members','foreignKey':_0xb62b('0x157')});db[_0xb62b('0x156')][_0xb62b('0x11e')](db[_0xb62b('0x158')],{'as':_0xb62b('0x159'),'foreignKey':'VoiceQueueId'});db[_0xb62b('0x156')][_0xb62b('0x11e')](db[_0xb62b('0x75')],{'as':'HopperFinals','foreignKey':_0xb62b('0x157')});db['VoiceQueue']['hasMany'](db[_0xb62b('0x77')],{'as':_0xb62b('0x15a'),'foreignKey':'VoiceQueueId'});db[_0xb62b('0x156')][_0xb62b('0x11e')](db[_0xb62b('0x79')],{'as':_0xb62b('0x79'),'foreignKey':_0xb62b('0x157')});db[_0xb62b('0x156')][_0xb62b('0x11e')](db[_0xb62b('0x73')],{'as':_0xb62b('0x15b'),'foreignKey':_0xb62b('0x157')});db[_0xb62b('0x156')][_0xb62b('0x11e')](db[_0xb62b('0x15c')],{'as':_0xb62b('0x15d'),'foreignKey':_0xb62b('0x157')});db['VoiceQueue'][_0xb62b('0x12e')](db[_0xb62b('0x15e')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0xb62b('0x156')][_0xb62b('0x12e')](db[_0xb62b('0x15e')],{'as':_0xb62b('0x15f'),'foreignKey':'TrunkBackupId'});db[_0xb62b('0x156')][_0xb62b('0x12e')](db[_0xb62b('0x84')],{'as':'Interval','foreignKey':_0xb62b('0x160')});db[_0xb62b('0x156')]['belongsTo'](db[_0xb62b('0x86')],{'as':_0xb62b('0x161'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xb62b('0x156')][_0xb62b('0x130')](db[_0xb62b('0xff')],{'as':'Lists','through':_0xb62b('0x162')});db[_0xb62b('0x156')][_0xb62b('0x130')](db['User'],{'as':_0xb62b('0x163'),'through':_0xb62b('0x2c')});db[_0xb62b('0x156')][_0xb62b('0x130')](db['Team'],{'as':_0xb62b('0x164'),'through':'TeamVoiceQueue'});db['VoiceQueue'][_0xb62b('0x130')](db[_0xb62b('0xff')],{'as':_0xb62b('0x165'),'through':_0xb62b('0x166')});db[_0xb62b('0x11f')][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'as':_0xb62b('0x13'),'foreignKey':_0xb62b('0x11d')});db[_0xb62b('0x1d')][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'as':_0xb62b('0x13'),'foreignKey':_0xb62b('0x11d')});db[_0xb62b('0x11b')][_0xb62b('0x11e')](db['VoiceMailMessage'],{'as':_0xb62b('0x167'),'onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x168'),'sourceKey':'mailbox'});db['VoiceMailMessage'][_0xb62b('0x12e')](db[_0xb62b('0x11b')],{'foreignKey':_0xb62b('0x168'),'targetKey':_0xb62b('0x169')});db[_0xb62b('0x20')][_0xb62b('0x11e')](db['VoiceQueueReport'],{'as':_0xb62b('0x16a'),'foreignKey':_0xb62b('0x16b'),'constraints':![]});db[_0xb62b('0x20')][_0xb62b('0x11e')](db[_0xb62b('0x23')],{'as':'AgentReports','foreignKey':_0xb62b('0x16b'),'constraints':![]});db[_0xb62b('0x20')][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'as':'User','foreignKey':'UserId'});db[_0xb62b('0x20')][_0xb62b('0x12e')](db[_0xb62b('0x71')],{'as':_0xb62b('0x16c'),'foreignKey':_0xb62b('0x16d')});db[_0xb62b('0x16e')]['belongsTo'](db[_0xb62b('0x39')],{'as':_0xb62b('0x39'),'foreignKey':_0xb62b('0x16f')});db[_0xb62b('0x37')][_0xb62b('0x12e')](db[_0xb62b('0x39')],{'as':_0xb62b('0x39'),'foreignKey':_0xb62b('0x16f')});db[_0xb62b('0x39')][_0xb62b('0x11a')](db[_0xb62b('0x16e')],{'as':_0xb62b('0x170'),'onDelete':_0xb62b('0x11c')});db['MailAccount'][_0xb62b('0x11a')](db['MailServerOut'],{'as':_0xb62b('0x171'),'onDelete':_0xb62b('0x11c')});db['MailAccount']['hasMany'](db[_0xb62b('0x80')],{'as':'Dispositions','foreignKey':_0xb62b('0x16f')});db['MailAccount']['hasMany'](db[_0xb62b('0x7e')],{'as':_0xb62b('0x172'),'foreignKey':'MailAccountId'});db[_0xb62b('0x39')][_0xb62b('0x11e')](db[_0xb62b('0x3f')],{'as':_0xb62b('0x167'),'foreignKey':_0xb62b('0x16f')});db[_0xb62b('0x39')][_0xb62b('0x11e')](db[_0xb62b('0x129')],{'as':'Interactions'});db[_0xb62b('0x39')]['hasMany'](db['MailApplication'],{'as':_0xb62b('0x153')});db[_0xb62b('0x39')][_0xb62b('0x12e')](db[_0xb62b('0xff')],{'as':_0xb62b('0x173'),'foreignKey':_0xb62b('0x174')});db[_0xb62b('0x39')]['belongsTo'](db[_0xb62b('0x95')],{'as':'Template','foreignKey':_0xb62b('0x175')});db[_0xb62b('0x39')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xb62b('0x176')});db[_0xb62b('0x39')][_0xb62b('0x130')](db[_0xb62b('0x13')],{'as':'Agents','through':_0xb62b('0x14b')});db[_0xb62b('0x3b')][_0xb62b('0x130')](db[_0xb62b('0x13')],{'as':_0xb62b('0x163'),'through':_0xb62b('0x30')});db[_0xb62b('0x3b')][_0xb62b('0x130')](db[_0xb62b('0xee')],{'through':'team_has_mail_queues','as':_0xb62b('0x164')});db[_0xb62b('0x129')][_0xb62b('0x11e')](db['MailMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0xb62b('0x129')][_0xb62b('0x12e')](db[_0xb62b('0x39')],{'as':'Account','foreignKey':_0xb62b('0x16f')});db[_0xb62b('0x129')][_0xb62b('0x12e')](db[_0xb62b('0x71')],{'as':'Contact','foreignKey':_0xb62b('0x16d')});db[_0xb62b('0x129')][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'as':_0xb62b('0x177'),'foreignKey':_0xb62b('0x11d')});db[_0xb62b('0x129')]['belongsToMany'](db['Tag'],{'through':_0xb62b('0x178'),'as':_0xb62b('0x179')});db[_0xb62b('0x129')][_0xb62b('0x130')](db['Tag'],{'through':_0xb62b('0x178'),'as':'ThroughTags'});db['MailInteraction'][_0xb62b('0x130')](db['User'],{'as':_0xb62b('0x17a'),'through':_0xb62b('0x138'),'foreignKey':_0xb62b('0x17b')});db[_0xb62b('0x3f')][_0xb62b('0x11e')](db[_0xb62b('0xf4')],{'as':_0xb62b('0x17c'),'onDelete':_0xb62b('0x11c')});db[_0xb62b('0x3f')][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'as':'User'});db['MailMessage']['belongsTo'](db['CmContact'],{'onDelete':_0xb62b('0x11c'),'as':'Contact'});db[_0xb62b('0x3f')]['belongsTo'](db[_0xb62b('0x129')],{'as':_0xb62b('0x17d'),'foreignKey':'MailInteractionId'});db[_0xb62b('0x3f')][_0xb62b('0x12e')](db['MailAccount'],{'as':_0xb62b('0x17e'),'foreignKey':_0xb62b('0x16f')});db[_0xb62b('0x3f')][_0xb62b('0x12e')](db['ChatWebsite'],{'as':_0xb62b('0x61'),'foreignKey':_0xb62b('0x17f')});db['MailMessage'][_0xb62b('0x12e')](db[_0xb62b('0x6a')],{'as':_0xb62b('0x6a'),'foreignKey':_0xb62b('0x180')});db['MailApplication']['belongsTo'](db[_0xb62b('0x13')],{'onDelete':'restrict'});db[_0xb62b('0x181')][_0xb62b('0x12e')](db[_0xb62b('0x3b')],{'onDelete':_0xb62b('0x182')});db['MailApplication'][_0xb62b('0x12e')](db[_0xb62b('0x39')],{'onDelete':_0xb62b('0x182')});db['MailApplication'][_0xb62b('0x12e')](db[_0xb62b('0x84')],{'onDelete':_0xb62b('0x182'),'foreignKey':_0xb62b('0x160')});db['MailApplication'][_0xb62b('0x12e')](db[_0xb62b('0x183')],{'onDelete':_0xb62b('0x182'),'foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0xb62b('0x41')][_0xb62b('0x12e')](db[_0xb62b('0xff')],{'as':_0xb62b('0x173'),'foreignKey':_0xb62b('0x174')});db[_0xb62b('0x41')]['belongsTo'](db[_0xb62b('0x71')],{'as':_0xb62b('0x16c'),'foreignKey':'ContactId'});db['MailQueueReport']['belongsTo'](db[_0xb62b('0x129')],{});db[_0xb62b('0x41')]['belongsTo'](db[_0xb62b('0x3f')],{});db[_0xb62b('0x41')][_0xb62b('0x12e')](db[_0xb62b('0x13')],{});db[_0xb62b('0x41')][_0xb62b('0x12e')](db['MailQueue'],{});db[_0xb62b('0x43')][_0xb62b('0x11e')](db[_0xb62b('0x45')],{'as':_0xb62b('0x184'),'onDelete':_0xb62b('0x11c')});db[_0xb62b('0x47')][_0xb62b('0x11e')](db[_0xb62b('0x80')],{'as':_0xb62b('0x185'),'foreignKey':_0xb62b('0x186')});db[_0xb62b('0x47')][_0xb62b('0x11e')](db[_0xb62b('0x7e')],{'as':_0xb62b('0x172'),'foreignKey':_0xb62b('0x186')});db[_0xb62b('0x47')]['hasMany'](db['FaxInteraction'],{'as':_0xb62b('0x187')});db['FaxAccount'][_0xb62b('0x11e')](db['FaxApplication'],{'as':_0xb62b('0x153')});db[_0xb62b('0x47')][_0xb62b('0x11e')](db['VoiceExtension'],{'as':_0xb62b('0x188'),'onDelete':'cascade'});db[_0xb62b('0x47')]['hasMany'](db['FaxMessage'],{'as':_0xb62b('0x167')});db[_0xb62b('0x47')][_0xb62b('0x12e')](db[_0xb62b('0x15e')],{'as':_0xb62b('0x15e')});db[_0xb62b('0x47')][_0xb62b('0x12e')](db[_0xb62b('0xff')],{'as':_0xb62b('0x173'),'foreignKey':_0xb62b('0x174')});db['FaxAccount'][_0xb62b('0x12e')](db[_0xb62b('0x86')],{'as':_0xb62b('0x161'),'foreignKey':_0xb62b('0x176')});db[_0xb62b('0x47')][_0xb62b('0x130')](db[_0xb62b('0x13')],{'as':'Agents','through':_0xb62b('0x149')});db['FaxApplication'][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'onDelete':_0xb62b('0x182')});db['FaxApplication'][_0xb62b('0x12e')](db[_0xb62b('0x13e')],{'onDelete':_0xb62b('0x182')});db[_0xb62b('0x49')]['belongsTo'](db[_0xb62b('0x47')],{'onDelete':_0xb62b('0x182')});db[_0xb62b('0x49')][_0xb62b('0x12e')](db[_0xb62b('0x183')],{'onDelete':'restrict','foreignKey':_0xb62b('0x189')});db[_0xb62b('0x4b')][_0xb62b('0x11e')](db[_0xb62b('0x4d')],{'as':_0xb62b('0x167'),'onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x18a')});db[_0xb62b('0x4b')]['belongsTo'](db[_0xb62b('0x47')],{'as':_0xb62b('0x17e'),'foreignKey':_0xb62b('0x186')});db[_0xb62b('0x4b')][_0xb62b('0x12e')](db[_0xb62b('0x71')],{'as':_0xb62b('0x16c'),'foreignKey':_0xb62b('0x16d')});db[_0xb62b('0x4b')]['belongsTo'](db[_0xb62b('0x13')],{'as':_0xb62b('0x177'),'foreignKey':_0xb62b('0x11d')});db[_0xb62b('0x4b')][_0xb62b('0x130')](db['Tag'],{'through':_0xb62b('0x18b'),'as':'Tags'});db[_0xb62b('0x4b')][_0xb62b('0x130')](db[_0xb62b('0x183')],{'through':_0xb62b('0x18b'),'as':'ThroughTags'});db[_0xb62b('0x4b')]['belongsToMany'](db[_0xb62b('0x13')],{'as':'Users','through':_0xb62b('0x13a'),'foreignKey':_0xb62b('0x18a')});db[_0xb62b('0x4d')]['belongsTo'](db[_0xb62b('0x13')],{'onDelete':_0xb62b('0x11c'),'as':_0xb62b('0x13')});db[_0xb62b('0x4d')][_0xb62b('0x12e')](db[_0xb62b('0x4b')],{'as':_0xb62b('0x17d'),'foreignKey':_0xb62b('0x18a')});db['FaxMessage'][_0xb62b('0x12e')](db['CmContact'],{'onDelete':_0xb62b('0x11c'),'as':_0xb62b('0x16c')});db[_0xb62b('0x4d')][_0xb62b('0x12e')](db[_0xb62b('0xf4')],{'as':_0xb62b('0xf4'),'foreignKey':_0xb62b('0x18c')});db['FaxMessage'][_0xb62b('0x12e')](db['FaxAccount'],{'as':'Account','foreignKey':_0xb62b('0x186')});db['FaxQueue'][_0xb62b('0x130')](db[_0xb62b('0x13')],{'as':_0xb62b('0x163'),'through':_0xb62b('0x140')});db[_0xb62b('0x13e')][_0xb62b('0x130')](db['Team'],{'through':_0xb62b('0x18d'),'as':_0xb62b('0x164')});db[_0xb62b('0x50')]['belongsTo'](db[_0xb62b('0x47')],{});db[_0xb62b('0x50')][_0xb62b('0x12e')](db['CmList'],{'as':'List','foreignKey':_0xb62b('0x174')});db[_0xb62b('0x50')][_0xb62b('0x12e')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xb62b('0x50')][_0xb62b('0x12e')](db[_0xb62b('0x4b')],{});db[_0xb62b('0x50')][_0xb62b('0x12e')](db[_0xb62b('0x4d')],{});db['FaxQueueReport'][_0xb62b('0x12e')](db[_0xb62b('0x13')],{});db[_0xb62b('0x50')]['belongsTo'](db['FaxQueue'],{});db['SmsAccount'][_0xb62b('0x11e')](db[_0xb62b('0x80')],{'as':_0xb62b('0x185'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0xb62b('0x11e')](db['CannedAnswer'],{'as':_0xb62b('0x172'),'foreignKey':_0xb62b('0x18e')});db[_0xb62b('0x51')]['hasMany'](db['SmsMessage'],{'as':_0xb62b('0x167'),'foreignKey':_0xb62b('0x18e')});db[_0xb62b('0x51')][_0xb62b('0x11e')](db[_0xb62b('0x54')],{'as':_0xb62b('0x187')});db[_0xb62b('0x51')][_0xb62b('0x11e')](db[_0xb62b('0x53')],{'as':_0xb62b('0x153')});db[_0xb62b('0x51')]['belongsTo'](db[_0xb62b('0xff')],{'as':_0xb62b('0x173'),'foreignKey':_0xb62b('0x174')});db[_0xb62b('0x51')][_0xb62b('0x12e')](db[_0xb62b('0x86')],{'as':_0xb62b('0x161'),'foreignKey':_0xb62b('0x176')});db[_0xb62b('0x51')][_0xb62b('0x130')](db[_0xb62b('0x13')],{'as':_0xb62b('0x163'),'through':_0xb62b('0x14d')});db[_0xb62b('0x53')][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'onDelete':_0xb62b('0x182')});db[_0xb62b('0x53')]['belongsTo'](db[_0xb62b('0x141')],{'onDelete':_0xb62b('0x182')});db[_0xb62b('0x53')]['belongsTo'](db['SmsAccount'],{'onDelete':_0xb62b('0x182')});db[_0xb62b('0x53')]['belongsTo'](db[_0xb62b('0x84')],{'onDelete':_0xb62b('0x182'),'foreignKey':_0xb62b('0x160')});db[_0xb62b('0x53')][_0xb62b('0x12e')](db[_0xb62b('0x183')],{'onDelete':_0xb62b('0x182'),'foreignKey':_0xb62b('0x189')});db['SmsInteraction'][_0xb62b('0x11e')](db[_0xb62b('0x55')],{'as':_0xb62b('0x167'),'onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x18f')});db[_0xb62b('0x54')][_0xb62b('0x12e')](db['SmsAccount'],{'as':_0xb62b('0x17e'),'foreignKey':_0xb62b('0x18e')});db[_0xb62b('0x54')][_0xb62b('0x12e')](db[_0xb62b('0x71')],{'as':_0xb62b('0x16c'),'foreignKey':_0xb62b('0x16d')});db['SmsInteraction'][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'as':_0xb62b('0x177'),'foreignKey':_0xb62b('0x11d')});db[_0xb62b('0x54')]['belongsToMany'](db['Tag'],{'through':_0xb62b('0x190'),'as':_0xb62b('0x179')});db['SmsInteraction'][_0xb62b('0x130')](db[_0xb62b('0x183')],{'through':_0xb62b('0x190'),'as':_0xb62b('0x191')});db[_0xb62b('0x54')][_0xb62b('0x130')](db['User'],{'as':'Users','through':_0xb62b('0x13b'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'as':_0xb62b('0x13')});db[_0xb62b('0x55')]['belongsTo'](db[_0xb62b('0x71')],{'onDelete':'cascade','as':_0xb62b('0x16c')});db[_0xb62b('0x55')][_0xb62b('0x12e')](db[_0xb62b('0x54')],{'onDelete':_0xb62b('0x11c'),'as':_0xb62b('0x17d'),'foreignKey':'SmsInteractionId'});db[_0xb62b('0x55')][_0xb62b('0x12e')](db[_0xb62b('0x51')],{'as':_0xb62b('0x17e'),'foreignKey':_0xb62b('0x18e')});db[_0xb62b('0x141')][_0xb62b('0x130')](db[_0xb62b('0x13')],{'as':_0xb62b('0x163'),'through':_0xb62b('0x32'),'foreignKey':_0xb62b('0x192')});db['SmsQueue']['belongsToMany'](db[_0xb62b('0xee')],{'through':_0xb62b('0x193'),'as':'Teams'});db['OpenchannelAccount'][_0xb62b('0x11e')](db[_0xb62b('0x80')],{'as':_0xb62b('0x185'),'foreignKey':_0xb62b('0x194')});db[_0xb62b('0x58')][_0xb62b('0x11e')](db[_0xb62b('0x7e')],{'as':_0xb62b('0x172'),'foreignKey':'OpenchannelAccountId'});db[_0xb62b('0x58')][_0xb62b('0x11e')](db[_0xb62b('0x5c')],{'as':_0xb62b('0x187'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xb62b('0x11e')](db[_0xb62b('0x5e')],{'as':'Messages','foreignKey':_0xb62b('0x194')});db[_0xb62b('0x58')][_0xb62b('0x11e')](db[_0xb62b('0x5a')],{'as':_0xb62b('0x153'),'foreignKey':_0xb62b('0x194')});db[_0xb62b('0x58')][_0xb62b('0x12e')](db[_0xb62b('0xff')],{'as':_0xb62b('0x173'),'foreignKey':_0xb62b('0x174')});db[_0xb62b('0x58')]['belongsTo'](db[_0xb62b('0x86')],{'as':_0xb62b('0x161'),'foreignKey':_0xb62b('0x176')});db[_0xb62b('0x58')]['belongsToMany'](db[_0xb62b('0x13')],{'as':_0xb62b('0x163'),'through':_0xb62b('0x195')});db[_0xb62b('0x5a')][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'onDelete':_0xb62b('0x182')});db[_0xb62b('0x5a')][_0xb62b('0x12e')](db[_0xb62b('0x143')],{'onDelete':_0xb62b('0x182'),'foreignKey':_0xb62b('0x196')});db[_0xb62b('0x5a')][_0xb62b('0x12e')](db['OpenchannelAccount'],{'onDelete':_0xb62b('0x182'),'foreignKey':_0xb62b('0x194')});db['OpenchannelApplication']['belongsTo'](db[_0xb62b('0x84')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xb62b('0x5a')][_0xb62b('0x12e')](db[_0xb62b('0x183')],{'onDelete':'restrict','foreignKey':_0xb62b('0x189')});db[_0xb62b('0x5c')][_0xb62b('0x11e')](db[_0xb62b('0x5e')],{'as':'Messages','onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x197')});db[_0xb62b('0x5c')][_0xb62b('0x12e')](db[_0xb62b('0x58')],{'as':'Account','foreignKey':_0xb62b('0x194')});db[_0xb62b('0x5c')]['belongsTo'](db[_0xb62b('0x71')],{'as':_0xb62b('0x16c'),'foreignKey':_0xb62b('0x16d')});db['OpenchannelInteraction'][_0xb62b('0x12e')](db['User'],{'as':'Owner','foreignKey':_0xb62b('0x11d')});db[_0xb62b('0x5c')][_0xb62b('0x130')](db[_0xb62b('0x183')],{'through':'openchannel_interaction_has_tags','as':_0xb62b('0x179')});db[_0xb62b('0x5c')][_0xb62b('0x130')](db[_0xb62b('0x183')],{'through':_0xb62b('0x198'),'as':_0xb62b('0x191')});db['OpenchannelInteraction'][_0xb62b('0x130')](db[_0xb62b('0x13')],{'as':_0xb62b('0x17a'),'through':_0xb62b('0x199'),'foreignKey':_0xb62b('0x197')});db[_0xb62b('0x5e')][_0xb62b('0x12e')](db['User'],{'onDelete':_0xb62b('0x11c'),'as':_0xb62b('0x13')});db['OpenchannelMessage'][_0xb62b('0x12e')](db[_0xb62b('0x71')],{'onDelete':'cascade','as':_0xb62b('0x16c')});db[_0xb62b('0x5e')]['belongsTo'](db[_0xb62b('0x5c')],{'onDelete':_0xb62b('0x11c'),'as':'Interaction','foreignKey':_0xb62b('0x197')});db['OpenchannelMessage'][_0xb62b('0x12e')](db[_0xb62b('0xf4')],{'as':_0xb62b('0xf4'),'foreignKey':_0xb62b('0x18c')});db[_0xb62b('0x5e')][_0xb62b('0x12e')](db[_0xb62b('0x58')],{'as':_0xb62b('0x17e'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue'][_0xb62b('0x130')](db[_0xb62b('0x13')],{'as':_0xb62b('0x163'),'through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db[_0xb62b('0x143')]['belongsToMany'](db[_0xb62b('0xee')],{'through':_0xb62b('0x19a'),'as':_0xb62b('0x164')});db[_0xb62b('0x61')][_0xb62b('0x11e')](db[_0xb62b('0x80')],{'as':_0xb62b('0x185'),'foreignKey':_0xb62b('0x17f')});db[_0xb62b('0x61')][_0xb62b('0x11e')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xb62b('0x17f')});db['ChatWebsite']['hasMany'](db['ChatProactiveAction'],{'as':'ProactiveActions'});db[_0xb62b('0x61')][_0xb62b('0x11e')](db[_0xb62b('0x66')],{'as':_0xb62b('0x187')});db[_0xb62b('0x61')]['hasMany'](db[_0xb62b('0x64')],{'as':_0xb62b('0x153')});db['ChatWebsite'][_0xb62b('0x11e')](db[_0xb62b('0x68')],{'as':_0xb62b('0x167')});db[_0xb62b('0x61')][_0xb62b('0x12e')](db[_0xb62b('0xff')],{'as':_0xb62b('0x173'),'foreignKey':_0xb62b('0x174')});db[_0xb62b('0x61')]['belongsTo'](db['Interval'],{'as':_0xb62b('0x84'),'foreignKey':_0xb62b('0x160')});db[_0xb62b('0x61')][_0xb62b('0x12e')](db[_0xb62b('0x39')],{'as':_0xb62b('0x39'),'foreignKey':_0xb62b('0x16f')});db['ChatWebsite'][_0xb62b('0x12e')](db['Pause'],{'as':_0xb62b('0x161'),'foreignKey':_0xb62b('0x176')});db[_0xb62b('0x61')][_0xb62b('0x130')](db['User'],{'as':_0xb62b('0x163'),'through':_0xb62b('0x147')});db[_0xb62b('0x63')][_0xb62b('0x12e')](db[_0xb62b('0x58')],{});db[_0xb62b('0x63')][_0xb62b('0x12e')](db['CmList'],{'as':'List','foreignKey':_0xb62b('0x174')});db[_0xb62b('0x63')][_0xb62b('0x12e')](db[_0xb62b('0x71')],{'as':_0xb62b('0x16c'),'foreignKey':_0xb62b('0x16d')});db[_0xb62b('0x63')]['belongsTo'](db[_0xb62b('0x5c')],{});db[_0xb62b('0x63')][_0xb62b('0x12e')](db[_0xb62b('0x5e')],{});db[_0xb62b('0x63')][_0xb62b('0x12e')](db['User'],{});db[_0xb62b('0x63')][_0xb62b('0x12e')](db[_0xb62b('0x143')],{});db[_0xb62b('0x64')]['belongsTo'](db[_0xb62b('0x13')],{'as':'Agent','foreignKey':'UserId','onDelete':_0xb62b('0x182')});db['ChatApplication'][_0xb62b('0x12e')](db[_0xb62b('0x6c')],{'as':'Queue','foreignKey':_0xb62b('0x19b'),'onDelete':_0xb62b('0x182')});db[_0xb62b('0x64')][_0xb62b('0x12e')](db[_0xb62b('0x61')],{'as':_0xb62b('0x19c'),'foreignKey':'ChatWebsiteId','onDelete':_0xb62b('0x182')});db['ChatApplication']['belongsTo'](db[_0xb62b('0x183')],{'onDelete':_0xb62b('0x182'),'foreignKey':'TagId'});db[_0xb62b('0x66')][_0xb62b('0x11e')](db[_0xb62b('0x68')],{'as':'Messages','onDelete':_0xb62b('0x11c'),'foreignKey':'ChatInteractionId'});db[_0xb62b('0x66')][_0xb62b('0x12e')](db[_0xb62b('0x61')],{'as':_0xb62b('0x17e'),'foreignKey':_0xb62b('0x17f')});db[_0xb62b('0x66')][_0xb62b('0x12e')](db[_0xb62b('0x71')],{'as':_0xb62b('0x16c'),'foreignKey':_0xb62b('0x16d')});db[_0xb62b('0x66')]['belongsTo'](db[_0xb62b('0x13')],{'as':_0xb62b('0x177'),'foreignKey':'UserId'});db[_0xb62b('0x66')][_0xb62b('0x130')](db[_0xb62b('0x183')],{'through':_0xb62b('0x19d'),'as':'Tags'});db['ChatInteraction']['belongsToMany'](db[_0xb62b('0x183')],{'through':'chat_interaction_has_tags','as':_0xb62b('0x191')});db[_0xb62b('0x66')]['belongsToMany'](db[_0xb62b('0x13')],{'as':_0xb62b('0x17a'),'through':_0xb62b('0x139'),'foreignKey':_0xb62b('0x19e')});db[_0xb62b('0x68')][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'onDelete':_0xb62b('0x11c'),'as':'User'});db['ChatMessage'][_0xb62b('0x12e')](db['CmContact'],{'onDelete':_0xb62b('0x11c'),'as':'Contact','foreignKey':_0xb62b('0x16d')});db[_0xb62b('0x68')][_0xb62b('0x12e')](db['ChatInteraction'],{'onDelete':_0xb62b('0x11c'),'as':_0xb62b('0x17d'),'foreignKey':_0xb62b('0x19e')});db[_0xb62b('0x68')]['belongsTo'](db[_0xb62b('0xf4')],{'as':_0xb62b('0xf4'),'foreignKey':'AttachmentId'});db[_0xb62b('0x68')][_0xb62b('0x12e')](db[_0xb62b('0x61')],{'as':_0xb62b('0x17e'),'foreignKey':_0xb62b('0x17f')});db[_0xb62b('0x6a')][_0xb62b('0x11e')](db[_0xb62b('0xf4')],{'as':'Attachments','foreignKey':'ChatOfflineMessageId','onDelete':_0xb62b('0x11c'),'hooks':!![]});db['ChatOfflineMessage'][_0xb62b('0x12e')](db[_0xb62b('0x71')],{'onDelete':_0xb62b('0x11c'),'as':_0xb62b('0x16c'),'foreignKey':_0xb62b('0x16d')});db[_0xb62b('0x6a')][_0xb62b('0x12e')](db['ChatWebsite'],{'as':_0xb62b('0x17e'),'foreignKey':_0xb62b('0x17f')});db[_0xb62b('0x6c')][_0xb62b('0x130')](db[_0xb62b('0x13')],{'as':_0xb62b('0x163'),'through':'UserChatQueue','hooks':!![]});db[_0xb62b('0x6c')]['belongsToMany'](db['Team'],{'through':_0xb62b('0x19f'),'as':_0xb62b('0x164')});db['ChatGroup'][_0xb62b('0x11e')](db[_0xb62b('0xdb')],{'as':_0xb62b('0x167'),'foreignKey':_0xb62b('0x1a0'),'onDelete':_0xb62b('0x11c')});db['ChatGroup'][_0xb62b('0x130')](db[_0xb62b('0x13')],{'as':'Members','through':_0xb62b('0x133')});db[_0xb62b('0x1a1')][_0xb62b('0x12e')](db['ChatWebsite'],{'as':_0xb62b('0x19c'),'foreignKey':_0xb62b('0x17f')});db['CmCompany'][_0xb62b('0x11e')](db[_0xb62b('0x71')],{'as':_0xb62b('0x134'),'foreignKey':_0xb62b('0x1a2')});db[_0xb62b('0x71')][_0xb62b('0x11e')](db[_0xb62b('0x92')],{'as':_0xb62b('0x1a3'),'foreignKey':'CmContactId'});db['CmContact'][_0xb62b('0x11e')](db[_0xb62b('0x158')],{'as':_0xb62b('0x159'),'foreignKey':_0xb62b('0x16d')});db['CmContact'][_0xb62b('0x11e')](db[_0xb62b('0x75')],{'as':_0xb62b('0x123'),'foreignKey':'ContactId'});db[_0xb62b('0x71')][_0xb62b('0x11e')](db['CmHopperHistory'],{'as':_0xb62b('0x15a'),'foreignKey':_0xb62b('0x16d')});db['CmContact']['hasMany'](db['ReportAgentPreview'],{'as':_0xb62b('0x79'),'foreignKey':'ContactId'});db[_0xb62b('0x71')][_0xb62b('0x11e')](db[_0xb62b('0x15c')],{'as':_0xb62b('0x15d'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0xb62b('0x5c')],{'as':_0xb62b('0x125'),'foreignKey':'ContactId','onDelete':_0xb62b('0x182')});db[_0xb62b('0x71')][_0xb62b('0x11e')](db['ChatInteraction'],{'as':_0xb62b('0x126'),'foreignKey':_0xb62b('0x16d'),'onDelete':_0xb62b('0x182')});db[_0xb62b('0x71')][_0xb62b('0x11e')](db[_0xb62b('0x54')],{'as':_0xb62b('0x127'),'foreignKey':'ContactId','onDelete':_0xb62b('0x182')});db[_0xb62b('0x71')]['hasMany'](db[_0xb62b('0x4b')],{'as':_0xb62b('0x128'),'foreignKey':_0xb62b('0x16d'),'onDelete':_0xb62b('0x182')});db['CmContact'][_0xb62b('0x11e')](db[_0xb62b('0x129')],{'as':_0xb62b('0x12a'),'foreignKey':_0xb62b('0x16d'),'onDelete':_0xb62b('0x182')});db['CmContact']['belongsTo'](db[_0xb62b('0x1a4')],{'as':_0xb62b('0x1a5'),'foreignKey':_0xb62b('0x1a2')});db[_0xb62b('0x71')][_0xb62b('0x12e')](db[_0xb62b('0xff')],{'as':_0xb62b('0x173'),'foreignKey':'ListId','onDelete':_0xb62b('0x11c')});db[_0xb62b('0x71')]['belongsToMany'](db[_0xb62b('0x13')],{'as':'Users','through':_0xb62b('0x135')});db['CmContact'][_0xb62b('0x130')](db[_0xb62b('0x183')],{'as':_0xb62b('0x179'),'through':_0xb62b('0x1a6')});db['CmContact'][_0xb62b('0x130')](db[_0xb62b('0x183')],{'through':_0xb62b('0x1a6'),'as':_0xb62b('0x191')});db['CmHopper']['hasMany'](db[_0xb62b('0x94')],{'as':_0xb62b('0x1a7'),'foreignKey':_0xb62b('0x1a8')});db[_0xb62b('0x158')][_0xb62b('0x12e')](db[_0xb62b('0x71')],{'as':_0xb62b('0x16c'),'foreignKey':_0xb62b('0x16d'),'onDelete':_0xb62b('0x11c')});db[_0xb62b('0x158')][_0xb62b('0x12e')](db['CmList'],{'as':_0xb62b('0x173'),'foreignKey':_0xb62b('0x174'),'onDelete':'cascade'});db[_0xb62b('0x158')]['belongsTo'](db[_0xb62b('0x13')],{'as':'Agent','foreignKey':'UserId'});db['CmHopper'][_0xb62b('0x12e')](db[_0xb62b('0x156')],{'as':_0xb62b('0x1a9'),'foreignKey':_0xb62b('0x157'),'onDelete':'cascade'});db[_0xb62b('0x158')]['belongsTo'](db[_0xb62b('0xf1')],{'as':_0xb62b('0xf1'),'foreignKey':'CampaignId','onDelete':_0xb62b('0x11c')});db[_0xb62b('0x158')][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'as':_0xb62b('0x177'),'foreignKey':_0xb62b('0x1aa')});db[_0xb62b('0x73')]['belongsTo'](db['CmContact'],{'as':_0xb62b('0x16c'),'foreignKey':_0xb62b('0x16d'),'onDelete':'cascade'});db['CmHopperBlack']['belongsTo'](db['CmList'],{'as':_0xb62b('0x173'),'foreignKey':_0xb62b('0x174'),'onDelete':'cascade'});db[_0xb62b('0x73')][_0xb62b('0x12e')](db[_0xb62b('0x156')],{'as':_0xb62b('0x1a9'),'foreignKey':_0xb62b('0x157'),'onDelete':_0xb62b('0x11c')});db['CmHopperBlack'][_0xb62b('0x12e')](db[_0xb62b('0xf1')],{'as':_0xb62b('0xf1'),'foreignKey':'CampaignId','onDelete':_0xb62b('0x11c')});db[_0xb62b('0x7d')][_0xb62b('0x11e')](db[_0xb62b('0x82')],{'as':{'plural':_0xb62b('0x1ab'),'singular':_0xb62b('0x1ac')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0xb62b('0x7d')][_0xb62b('0x11e')](db[_0xb62b('0x82')],{'as':{'plural':_0xb62b('0x1ad'),'singular':_0xb62b('0x1ae')},'foreignKey':_0xb62b('0x1af'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xb62b('0x11e')](db['Action'],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0xb62b('0x11c'),'hooks':!![]});db[_0xb62b('0x80')]['hasMany'](db[_0xb62b('0x80')],{'as':'Dispositions','foreignKey':_0xb62b('0x1b0'),'onDelete':_0xb62b('0x11c')});db['Interval'][_0xb62b('0x11e')](db[_0xb62b('0x84')],{'as':_0xb62b('0x1b1'),'foreignKey':_0xb62b('0x160'),'onDelete':_0xb62b('0x11c'),'hooks':!![],'required':![]});db['Interval'][_0xb62b('0x11e')](db[_0xb62b('0x19')],{'as':_0xb62b('0x122'),'foreignKey':_0xb62b('0x160'),'onDelete':'restrict'});db[_0xb62b('0x84')][_0xb62b('0x11e')](db[_0xb62b('0x181')],{'as':_0xb62b('0x1b2'),'foreignKey':_0xb62b('0x160')});db[_0xb62b('0x84')]['hasMany'](db[_0xb62b('0x64')],{'as':_0xb62b('0x1b3'),'foreignKey':_0xb62b('0x160')});db[_0xb62b('0x84')][_0xb62b('0x11e')](db[_0xb62b('0x49')],{'as':_0xb62b('0x1b4'),'foreignKey':_0xb62b('0x160')});db['Interval']['hasMany'](db['SmsApplication'],{'as':_0xb62b('0x1b5'),'foreignKey':_0xb62b('0x160')});db[_0xb62b('0x8b')][_0xb62b('0x12e')](db['MailAccount'],{});db[_0xb62b('0x8b')][_0xb62b('0x12e')](db[_0xb62b('0x1b6')],{'foreignKey':_0xb62b('0x1b7')});db[_0xb62b('0x8b')][_0xb62b('0x12e')](db[_0xb62b('0x9f')],{'foreignKey':_0xb62b('0x1b8')});db['Sound'][_0xb62b('0x130')](db[_0xb62b('0x154')],{'as':_0xb62b('0x1b9'),'through':_0xb62b('0x155'),'onDelete':_0xb62b('0x182')});db[_0xb62b('0x183')][_0xb62b('0x130')](db[_0xb62b('0x71')],{'through':_0xb62b('0x1a6')});db[_0xb62b('0x183')][_0xb62b('0x130')](db[_0xb62b('0x66')],{'through':_0xb62b('0x19d')});db['Tag'][_0xb62b('0x130')](db[_0xb62b('0x129')],{'through':'mail_interaction_has_tags'});db[_0xb62b('0x183')][_0xb62b('0x130')](db['SmsInteraction'],{'through':_0xb62b('0x190')});db[_0xb62b('0x183')]['belongsToMany'](db[_0xb62b('0x4b')],{'through':_0xb62b('0x18b')});db[_0xb62b('0x183')][_0xb62b('0x130')](db[_0xb62b('0x5c')],{'through':_0xb62b('0x198')});db['Tag'][_0xb62b('0x130')](db[_0xb62b('0x10e')],{'through':'whatsapp_interaction_has_tags'});db[_0xb62b('0x92')]['belongsTo'](db[_0xb62b('0x90')],{'as':_0xb62b('0x1ba'),'foreignKey':'ItemTypeId'});db[_0xb62b('0x94')][_0xb62b('0x12e')](db[_0xb62b('0x158')],{'as':_0xb62b('0x1bb'),'foreignKey':_0xb62b('0x1a8')});db[_0xb62b('0x97')][_0xb62b('0x11e')](db[_0xb62b('0x82')],{'as':{'plural':_0xb62b('0x1bc'),'singular':_0xb62b('0x1bd')},'foreignKey':_0xb62b('0x1be'),'onDelete':_0xb62b('0x11c'),'hooks':!![]});db[_0xb62b('0x97')][_0xb62b('0x11e')](db[_0xb62b('0x82')],{'as':{'plural':_0xb62b('0x1bf'),'singular':_0xb62b('0x1c0')},'foreignKey':_0xb62b('0x1c1'),'onDelete':'cascade','hooks':!![]});db[_0xb62b('0x97')]['hasMany'](db[_0xb62b('0x1c2')],{'as':'Actions','foreignKey':_0xb62b('0x1c3'),'onDelete':_0xb62b('0x11c'),'hooks':!![]});db[_0xb62b('0x9f')][_0xb62b('0x11e')](db[_0xb62b('0xa5')],{'as':_0xb62b('0x1c4'),'onDelete':_0xb62b('0x11c'),'foreignKey':'CustomReportId','hooks':!![]});db[_0xb62b('0x1b6')][_0xb62b('0x11e')](db[_0xb62b('0xa5')],{'as':_0xb62b('0x1c4'),'onDelete':_0xb62b('0x11c'),'foreignKey':'DefaultReportId'});db[_0xb62b('0xa3')][_0xb62b('0x11e')](db['AnalyticFieldReport'],{'as':_0xb62b('0x1c4'),'onDelete':_0xb62b('0x11c'),'foreignKey':'MetricId'});db[_0xb62b('0xa5')][_0xb62b('0x12e')](db[_0xb62b('0xa3')],{'foreignKey':_0xb62b('0x1c5')});db[_0xb62b('0xa8')][_0xb62b('0x11e')](db[_0xb62b('0xaa')],{'as':_0xb62b('0x1c6'),'onDelete':'cascade','foreignKey':_0xb62b('0x1c7')});db['SalesforceConfiguration']['hasMany'](db[_0xb62b('0x1c8')],{'as':_0xb62b('0x1c9'),'onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x1ca')});db['SalesforceConfiguration']['hasMany'](db[_0xb62b('0x1c8')],{'as':'Descriptions','onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x1cb')});db[_0xb62b('0xaa')][_0xb62b('0x11e')](db[_0xb62b('0x1c8')],{'as':_0xb62b('0x1c4'),'onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x1cc')});db[_0xb62b('0xaa')][_0xb62b('0x12e')](db[_0xb62b('0xa8')],{'as':_0xb62b('0x17e'),'foreignKey':'AccountId'});db[_0xb62b('0x1c8')][_0xb62b('0x11e')](db[_0xb62b('0x1c8')],{'as':_0xb62b('0x1cd'),'foreignKey':_0xb62b('0x1ca')});db[_0xb62b('0x1c8')]['hasMany'](db['SalesforceField'],{'as':_0xb62b('0x1ce'),'foreignKey':'DescriptionId'});db[_0xb62b('0x1c8')][_0xb62b('0x11e')](db['SalesforceField'],{'as':'Field','foreignKey':_0xb62b('0x1cc')});db['SalesforceField'][_0xb62b('0x12e')](db[_0xb62b('0x99')],{'as':_0xb62b('0x99'),'foreignKey':_0xb62b('0x1cf')});db[_0xb62b('0xac')][_0xb62b('0x11e')](db['SugarcrmConfiguration'],{'as':_0xb62b('0x1c6'),'onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x1c7')});db['SugarcrmConfiguration']['hasMany'](db[_0xb62b('0xae')],{'as':_0xb62b('0x1c9'),'onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x1ca')});db[_0xb62b('0x1d0')][_0xb62b('0x11e')](db[_0xb62b('0xae')],{'as':'Descriptions','onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x1cb')});db['SugarcrmConfiguration']['hasMany'](db['SugarcrmField'],{'as':_0xb62b('0x1c4'),'onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x1cc')});db['SugarcrmConfiguration'][_0xb62b('0x12e')](db[_0xb62b('0xac')],{'as':_0xb62b('0x17e'),'foreignKey':_0xb62b('0x1c7')});db[_0xb62b('0xae')][_0xb62b('0x11e')](db[_0xb62b('0xae')],{'as':'Subject','foreignKey':_0xb62b('0x1ca')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':'Description','foreignKey':_0xb62b('0x1cb')});db[_0xb62b('0xae')][_0xb62b('0x11e')](db[_0xb62b('0xae')],{'as':_0xb62b('0x1d1'),'foreignKey':_0xb62b('0x1cc')});db[_0xb62b('0xae')][_0xb62b('0x12e')](db[_0xb62b('0x99')],{'as':_0xb62b('0x99'),'foreignKey':_0xb62b('0x1cf')});db[_0xb62b('0x1d2')][_0xb62b('0x11e')](db[_0xb62b('0xb0')],{'as':_0xb62b('0x1c6'),'onDelete':_0xb62b('0x11c'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0xb62b('0x11e')](db[_0xb62b('0xb2')],{'as':_0xb62b('0x1c9'),'onDelete':_0xb62b('0x11c'),'foreignKey':'SubjectId'});db['DeskConfiguration'][_0xb62b('0x11e')](db[_0xb62b('0xb2')],{'as':_0xb62b('0x1d3'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xb62b('0xb0')][_0xb62b('0x11e')](db[_0xb62b('0xb2')],{'as':_0xb62b('0x1c4'),'onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x1cc')});db['DeskConfiguration']['belongsTo'](db[_0xb62b('0x1d2')],{'as':_0xb62b('0x17e'),'foreignKey':'AccountId'});db[_0xb62b('0xb0')][_0xb62b('0x130')](db[_0xb62b('0x183')],{'through':_0xb62b('0x1d4')});db['DeskField'][_0xb62b('0x11e')](db[_0xb62b('0xb2')],{'as':_0xb62b('0x1cd'),'foreignKey':_0xb62b('0x1ca')});db[_0xb62b('0xb2')]['hasMany'](db[_0xb62b('0xb2')],{'as':'Description','foreignKey':'DescriptionId'});db['DeskField']['hasMany'](db['DeskField'],{'as':_0xb62b('0x1d1'),'foreignKey':_0xb62b('0x1cc')});db[_0xb62b('0xb2')][_0xb62b('0x12e')](db[_0xb62b('0x99')],{'as':_0xb62b('0x99'),'foreignKey':_0xb62b('0x1cf')});db[_0xb62b('0xb4')][_0xb62b('0x11e')](db['ZohoConfiguration'],{'as':_0xb62b('0x1c6'),'onDelete':_0xb62b('0x11c'),'foreignKey':'AccountId'});db[_0xb62b('0xb6')]['hasMany'](db['ZohoField'],{'as':_0xb62b('0x1c9'),'onDelete':_0xb62b('0x11c'),'foreignKey':'SubjectId'});db[_0xb62b('0xb6')][_0xb62b('0x11e')](db[_0xb62b('0x1d5')],{'as':_0xb62b('0x1d3'),'onDelete':'cascade','foreignKey':_0xb62b('0x1cb')});db[_0xb62b('0xb6')]['hasMany'](db['ZohoField'],{'as':'Fields','onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x1cc')});db[_0xb62b('0xb6')][_0xb62b('0x12e')](db[_0xb62b('0xb4')],{'as':_0xb62b('0x17e'),'foreignKey':_0xb62b('0x1c7')});db[_0xb62b('0x1d5')][_0xb62b('0x11e')](db[_0xb62b('0x1d5')],{'as':'Subject','foreignKey':_0xb62b('0x1ca')});db[_0xb62b('0x1d5')][_0xb62b('0x11e')](db[_0xb62b('0x1d5')],{'as':_0xb62b('0x1ce'),'foreignKey':'DescriptionId'});db['ZohoField'][_0xb62b('0x11e')](db['ZohoField'],{'as':_0xb62b('0x1d1'),'foreignKey':_0xb62b('0x1cc')});db[_0xb62b('0x1d5')][_0xb62b('0x12e')](db[_0xb62b('0x99')],{'as':_0xb62b('0x99'),'foreignKey':_0xb62b('0x1cf')});db[_0xb62b('0xb9')]['hasMany'](db['ZendeskConfiguration'],{'as':_0xb62b('0x1c6'),'onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x1c7')});db[_0xb62b('0x1d6')][_0xb62b('0x11e')](db['ZendeskField'],{'as':_0xb62b('0x1c9'),'foreignKey':'SubjectId'});db[_0xb62b('0x1d6')][_0xb62b('0x11e')](db[_0xb62b('0x1d7')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration']['hasMany'](db[_0xb62b('0x1d7')],{'as':_0xb62b('0x1c4'),'foreignKey':_0xb62b('0x1cc')});db['ZendeskConfiguration'][_0xb62b('0x12e')](db[_0xb62b('0xb9')],{'as':_0xb62b('0x17e'),'foreignKey':'AccountId'});db[_0xb62b('0x1d6')][_0xb62b('0x130')](db['Tag'],{'through':_0xb62b('0x1d8')});db[_0xb62b('0x1d7')][_0xb62b('0x11e')](db[_0xb62b('0x1d7')],{'as':_0xb62b('0x1cd'),'foreignKey':_0xb62b('0x1ca')});db[_0xb62b('0x1d7')][_0xb62b('0x11e')](db['ZendeskField'],{'as':_0xb62b('0x1ce'),'foreignKey':_0xb62b('0x1cb')});db['ZendeskField'][_0xb62b('0x11e')](db[_0xb62b('0x1d7')],{'as':_0xb62b('0x1d1'),'foreignKey':_0xb62b('0x1cc')});db['ZendeskField'][_0xb62b('0x12e')](db[_0xb62b('0x99')],{'as':'Variable','foreignKey':_0xb62b('0x1cf')});db[_0xb62b('0xbd')][_0xb62b('0x11e')](db[_0xb62b('0xbf')],{'as':_0xb62b('0x1c6'),'onDelete':_0xb62b('0x11c'),'foreignKey':'AccountId'});db[_0xb62b('0xbf')][_0xb62b('0x11e')](db['FreshdeskField'],{'as':_0xb62b('0x1c9'),'onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x1ca')});db[_0xb62b('0xbf')]['hasMany'](db['FreshdeskField'],{'as':_0xb62b('0x1d3'),'onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x1cb')});db[_0xb62b('0xbf')][_0xb62b('0x11e')](db[_0xb62b('0xc1')],{'as':_0xb62b('0x1c4'),'onDelete':_0xb62b('0x11c'),'foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0xb62b('0x12e')](db[_0xb62b('0xbd')],{'as':'Account','foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0xb62b('0x130')](db[_0xb62b('0x183')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xb62b('0xc1')][_0xb62b('0x11e')](db[_0xb62b('0xc1')],{'as':_0xb62b('0x1cd'),'foreignKey':'SubjectId'});db[_0xb62b('0xc1')][_0xb62b('0x11e')](db['FreshdeskField'],{'as':_0xb62b('0x1ce'),'foreignKey':_0xb62b('0x1cb')});db[_0xb62b('0xc1')][_0xb62b('0x11e')](db[_0xb62b('0xc1')],{'as':'Field','foreignKey':_0xb62b('0x1cc')});db[_0xb62b('0xc1')][_0xb62b('0x12e')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xb62b('0xc3')][_0xb62b('0x11e')](db[_0xb62b('0xc5')],{'as':'Configurations','onDelete':_0xb62b('0x11c'),'foreignKey':'AccountId'});db[_0xb62b('0xc5')][_0xb62b('0x11e')](db['VtigerField'],{'as':_0xb62b('0x1c9'),'foreignKey':_0xb62b('0x1ca')});db[_0xb62b('0xc5')][_0xb62b('0x11e')](db[_0xb62b('0xc7')],{'as':_0xb62b('0x1d3'),'foreignKey':_0xb62b('0x1cb')});db[_0xb62b('0xc5')][_0xb62b('0x11e')](db[_0xb62b('0xc7')],{'as':_0xb62b('0x1c4'),'foreignKey':'FieldId'});db[_0xb62b('0xc5')][_0xb62b('0x12e')](db[_0xb62b('0xc3')],{'as':_0xb62b('0x17e'),'foreignKey':_0xb62b('0x1c7')});db[_0xb62b('0xc7')][_0xb62b('0x11e')](db[_0xb62b('0xc7')],{'as':_0xb62b('0x1cd'),'foreignKey':_0xb62b('0x1ca')});db[_0xb62b('0xc7')][_0xb62b('0x11e')](db[_0xb62b('0xc7')],{'as':_0xb62b('0x1ce'),'foreignKey':_0xb62b('0x1cb')});db[_0xb62b('0xc7')][_0xb62b('0x11e')](db[_0xb62b('0xc7')],{'as':_0xb62b('0x1d1'),'foreignKey':'FieldId'});db[_0xb62b('0xc7')][_0xb62b('0x12e')](db[_0xb62b('0x99')],{'as':_0xb62b('0x99'),'foreignKey':_0xb62b('0x1cf')});db[_0xb62b('0xc9')]['hasMany'](db[_0xb62b('0xcb')],{'as':_0xb62b('0x1c6'),'onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x1c7')});db[_0xb62b('0xcb')]['hasMany'](db['ServicenowField'],{'as':_0xb62b('0x1c9'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0xb62b('0x11e')](db[_0xb62b('0xcd')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ServicenowConfiguration'][_0xb62b('0x11e')](db[_0xb62b('0xcd')],{'as':_0xb62b('0x1c4'),'foreignKey':'FieldId'});db[_0xb62b('0xcb')][_0xb62b('0x12e')](db[_0xb62b('0xc9')],{'as':_0xb62b('0x17e'),'foreignKey':_0xb62b('0x1c7')});db['ServicenowField']['hasMany'](db[_0xb62b('0xcd')],{'as':_0xb62b('0x1cd'),'foreignKey':'SubjectId'});db[_0xb62b('0xcd')][_0xb62b('0x11e')](db[_0xb62b('0xcd')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xb62b('0xcd')][_0xb62b('0x11e')](db['ServicenowField'],{'as':_0xb62b('0x1d1'),'foreignKey':_0xb62b('0x1cc')});db['ServicenowField'][_0xb62b('0x12e')](db['Variable'],{'as':_0xb62b('0x99'),'foreignKey':_0xb62b('0x1cf')});db[_0xb62b('0xce')]['hasMany'](db[_0xb62b('0xd0')],{'as':_0xb62b('0x1c6'),'onDelete':'cascade','foreignKey':_0xb62b('0x1c7')});db[_0xb62b('0xd0')][_0xb62b('0x11e')](db[_0xb62b('0xd2')],{'as':_0xb62b('0x1c9'),'onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x1ca')});db[_0xb62b('0xd0')]['hasMany'](db['Dynamics365Field'],{'as':'Descriptions','onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x1cb')});db[_0xb62b('0xd0')][_0xb62b('0x11e')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x1cc')});db['Dynamics365Configuration'][_0xb62b('0x12e')](db['Dynamics365Account'],{'as':'Account','foreignKey':_0xb62b('0x1c7')});db[_0xb62b('0xd2')][_0xb62b('0x11e')](db[_0xb62b('0xd2')],{'as':'Subject','foreignKey':_0xb62b('0x1ca')});db[_0xb62b('0xd2')][_0xb62b('0x11e')](db['Dynamics365Field'],{'as':_0xb62b('0x1ce'),'foreignKey':_0xb62b('0x1cb')});db[_0xb62b('0xd2')][_0xb62b('0x11e')](db['Dynamics365Field'],{'as':_0xb62b('0x1d1'),'foreignKey':_0xb62b('0x1cc')});db['Dynamics365Field'][_0xb62b('0x12e')](db['Variable'],{'as':_0xb62b('0x99'),'foreignKey':_0xb62b('0x1cf')});db['FreshsalesAccount'][_0xb62b('0x11e')](db[_0xb62b('0xd5')],{'as':_0xb62b('0x1c6'),'onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x1c7')});db[_0xb62b('0xd5')][_0xb62b('0x11e')](db[_0xb62b('0xd7')],{'as':_0xb62b('0x1c9'),'foreignKey':'SubjectId'});db[_0xb62b('0xd5')][_0xb62b('0x11e')](db['FreshsalesField'],{'as':_0xb62b('0x1d3'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0xb62b('0x11e')](db[_0xb62b('0xd7')],{'as':_0xb62b('0x1c4'),'foreignKey':_0xb62b('0x1cc')});db[_0xb62b('0xd5')][_0xb62b('0x12e')](db[_0xb62b('0xd4')],{'as':_0xb62b('0x17e'),'foreignKey':'AccountId'});db[_0xb62b('0xd7')][_0xb62b('0x11e')](db[_0xb62b('0xd7')],{'as':_0xb62b('0x1cd'),'foreignKey':_0xb62b('0x1ca')});db[_0xb62b('0xd7')][_0xb62b('0x11e')](db[_0xb62b('0xd7')],{'as':_0xb62b('0x1ce'),'foreignKey':_0xb62b('0x1cb')});db[_0xb62b('0xd7')][_0xb62b('0x11e')](db[_0xb62b('0xd7')],{'as':'Field','foreignKey':_0xb62b('0x1cc')});db[_0xb62b('0xd7')][_0xb62b('0x12e')](db[_0xb62b('0x99')],{'as':_0xb62b('0x99'),'foreignKey':_0xb62b('0x1cf')});db[_0xb62b('0xd9')][_0xb62b('0x12e')](db[_0xb62b('0x61')],{});db['ChatQueueReport'][_0xb62b('0x12e')](db[_0xb62b('0xff')],{'as':_0xb62b('0x173'),'foreignKey':'ListId'});db['ChatQueueReport'][_0xb62b('0x12e')](db[_0xb62b('0x71')],{'as':'Contact','foreignKey':_0xb62b('0x16d')});db[_0xb62b('0xd9')][_0xb62b('0x12e')](db[_0xb62b('0x66')],{});db['ChatQueueReport'][_0xb62b('0x12e')](db[_0xb62b('0x68')],{});db[_0xb62b('0xd9')][_0xb62b('0x12e')](db['User'],{});db[_0xb62b('0xd9')][_0xb62b('0x12e')](db[_0xb62b('0x6c')],{});db[_0xb62b('0xdb')][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x1d9')});db['ChatInternalMessage'][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'onDelete':'cascade','foreignKey':_0xb62b('0x1da')});db[_0xb62b('0x15c')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0xb62b('0x1db'),'onDelete':_0xb62b('0x11c')});db[_0xb62b('0x15c')]['hasMany'](db[_0xb62b('0xdc')],{'foreignKey':_0xb62b('0x1db'),'onDelete':_0xb62b('0x11c')});db['SmsQueueReport'][_0xb62b('0x12e')](db[_0xb62b('0x51')],{});db[_0xb62b('0xdf')][_0xb62b('0x12e')](db['CmList'],{'as':_0xb62b('0x173'),'foreignKey':_0xb62b('0x174')});db['SmsQueueReport'][_0xb62b('0x12e')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xb62b('0xdf')][_0xb62b('0x12e')](db[_0xb62b('0x54')],{});db[_0xb62b('0xdf')][_0xb62b('0x12e')](db[_0xb62b('0x55')],{});db[_0xb62b('0xdf')]['belongsTo'](db['User'],{});db[_0xb62b('0xdf')][_0xb62b('0x12e')](db['SmsQueue'],{});db[_0xb62b('0xe4')][_0xb62b('0x11e')](db['JscriptySessionReport'],{'foreignKey':_0xb62b('0x1dc')});db[_0xb62b('0xe4')][_0xb62b('0x11e')](db[_0xb62b('0xde')],{'foreignKey':_0xb62b('0x1dc')});db[_0xb62b('0xe4')][_0xb62b('0x11e')](db[_0xb62b('0xdc')],{'foreignKey':_0xb62b('0x1dc')});db[_0xb62b('0xe8')][_0xb62b('0x130')](db[_0xb62b('0x13')],{'as':'Users','through':_0xb62b('0x150')});db[_0xb62b('0xee')][_0xb62b('0x130')](db[_0xb62b('0x13')],{'as':_0xb62b('0x163'),'through':'user_has_teams'});db[_0xb62b('0xee')][_0xb62b('0x130')](db[_0xb62b('0x156')],{'through':_0xb62b('0x118'),'as':_0xb62b('0x13c')});db[_0xb62b('0xee')][_0xb62b('0x130')](db['MailQueue'],{'through':_0xb62b('0x1dd'),'as':'MailQueues'});db['Team']['belongsToMany'](db[_0xb62b('0x6c')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0xb62b('0xee')][_0xb62b('0x130')](db[_0xb62b('0x13e')],{'through':_0xb62b('0x18d'),'as':_0xb62b('0x13f')});db[_0xb62b('0xee')][_0xb62b('0x130')](db[_0xb62b('0x141')],{'through':_0xb62b('0x193'),'as':_0xb62b('0x142')});db[_0xb62b('0xee')]['belongsToMany'](db[_0xb62b('0x143')],{'through':_0xb62b('0x19a'),'as':_0xb62b('0x144')});db[_0xb62b('0xee')][_0xb62b('0x130')](db['WhatsappQueue'],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db['Campaign']['hasMany'](db[_0xb62b('0x158')],{'as':_0xb62b('0x159'),'foreignKey':_0xb62b('0x1de')});db[_0xb62b('0xf1')][_0xb62b('0x11e')](db['CmHopperFinal'],{'as':_0xb62b('0x123'),'foreignKey':_0xb62b('0x1de')});db[_0xb62b('0xf1')][_0xb62b('0x11e')](db[_0xb62b('0x77')],{'as':_0xb62b('0x15a'),'foreignKey':_0xb62b('0x1de')});db[_0xb62b('0xf1')][_0xb62b('0x11e')](db[_0xb62b('0x73')],{'as':_0xb62b('0x15b'),'foreignKey':_0xb62b('0x1de')});db['Campaign'][_0xb62b('0x12e')](db[_0xb62b('0x15e')],{'as':_0xb62b('0x15e'),'foreignKey':_0xb62b('0x1df')});db[_0xb62b('0xf1')]['belongsTo'](db[_0xb62b('0x15e')],{'as':_0xb62b('0x15f'),'foreignKey':_0xb62b('0x1e0')});db[_0xb62b('0xf1')][_0xb62b('0x12e')](db[_0xb62b('0x84')],{'as':_0xb62b('0x84'),'foreignKey':'IntervalId'});db[_0xb62b('0xf1')][_0xb62b('0x12e')](db[_0xb62b('0xe8')],{'as':'SquareProject','foreignKey':_0xb62b('0x1e1')});db[_0xb62b('0xf1')]['belongsToMany'](db[_0xb62b('0xff')],{'as':_0xb62b('0x136'),'through':_0xb62b('0x1e2')});db['Campaign'][_0xb62b('0x130')](db[_0xb62b('0xff')],{'as':_0xb62b('0x165'),'through':'campaigns_has_cm_blacklists'});db[_0xb62b('0xf4')][_0xb62b('0x12e')](db[_0xb62b('0x6a')],{'as':_0xb62b('0x6a'),'foreignKey':_0xb62b('0x180')});db[_0xb62b('0x1e3')][_0xb62b('0x12e')](db[_0xb62b('0x3f')],{});db[_0xb62b('0x1e3')]['belongsTo'](db[_0xb62b('0x129')],{});db[_0xb62b('0x1e3')]['belongsTo'](db['MailAccount'],{'foreignKey':_0xb62b('0x1e4'),'as':_0xb62b('0x1e5')});db[_0xb62b('0x1e3')][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'foreignKey':_0xb62b('0x1e6'),'as':_0xb62b('0x1e7')});db[_0xb62b('0x1e3')][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xb62b('0x1e3')][_0xb62b('0x12e')](db[_0xb62b('0x3b')],{'foreignKey':_0xb62b('0x1e8'),'as':_0xb62b('0x1e9')});db['MailTransferReport'][_0xb62b('0x12e')](db[_0xb62b('0x39')],{'foreignKey':_0xb62b('0x1ea'),'as':'ToAccount'});db[_0xb62b('0x1eb')][_0xb62b('0x12e')](db[_0xb62b('0x68')],{});db[_0xb62b('0x1eb')]['belongsTo'](db[_0xb62b('0x66')],{});db[_0xb62b('0x1eb')]['belongsTo'](db[_0xb62b('0x61')],{'foreignKey':_0xb62b('0x1ec'),'as':_0xb62b('0x1e5')});db[_0xb62b('0x1eb')]['belongsTo'](db[_0xb62b('0x13')],{'foreignKey':'FromUserId','as':_0xb62b('0x1e7')});db[_0xb62b('0x1eb')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xb62b('0x1eb')]['belongsTo'](db[_0xb62b('0x6c')],{'foreignKey':_0xb62b('0x1ed'),'as':_0xb62b('0x1e9')});db[_0xb62b('0x1eb')]['belongsTo'](db[_0xb62b('0x61')],{'foreignKey':_0xb62b('0x1ee'),'as':'ToAccount'});db[_0xb62b('0xf9')]['belongsTo'](db[_0xb62b('0x4d')],{});db[_0xb62b('0xf9')][_0xb62b('0x12e')](db[_0xb62b('0x4b')],{});db[_0xb62b('0xf9')][_0xb62b('0x12e')](db['FaxAccount'],{'foreignKey':_0xb62b('0x1ef'),'as':_0xb62b('0x1e5')});db[_0xb62b('0xf9')][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'foreignKey':_0xb62b('0x1e6'),'as':'FromAgent'});db[_0xb62b('0xf9')][_0xb62b('0x12e')](db['User'],{'foreignKey':_0xb62b('0x1f0'),'as':'ToAgent'});db[_0xb62b('0xf9')]['belongsTo'](db[_0xb62b('0x13e')],{'foreignKey':'ToFaxQueueId','as':_0xb62b('0x1e9')});db['FaxTransferReport'][_0xb62b('0x12e')](db[_0xb62b('0x47')],{'foreignKey':_0xb62b('0x1f1'),'as':_0xb62b('0x1f2')});db[_0xb62b('0xfb')][_0xb62b('0x12e')](db['OpenchannelMessage'],{});db[_0xb62b('0xfb')][_0xb62b('0x12e')](db['OpenchannelInteraction'],{});db[_0xb62b('0xfb')][_0xb62b('0x12e')](db[_0xb62b('0x58')],{'foreignKey':_0xb62b('0x1f3'),'as':'FromAccount'});db[_0xb62b('0xfb')][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'foreignKey':_0xb62b('0x1e6'),'as':'FromAgent'});db[_0xb62b('0xfb')][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'foreignKey':_0xb62b('0x1f0'),'as':_0xb62b('0x1f4')});db['OpenchannelTransferReport']['belongsTo'](db[_0xb62b('0x143')],{'foreignKey':_0xb62b('0x1f5'),'as':_0xb62b('0x1e9')});db['OpenchannelTransferReport'][_0xb62b('0x12e')](db[_0xb62b('0x58')],{'foreignKey':_0xb62b('0x1f6'),'as':_0xb62b('0x1f2')});db[_0xb62b('0xfd')][_0xb62b('0x12e')](db[_0xb62b('0x55')],{});db['SmsTransferReport'][_0xb62b('0x12e')](db[_0xb62b('0x54')],{});db[_0xb62b('0xfd')][_0xb62b('0x12e')](db[_0xb62b('0x51')],{'foreignKey':_0xb62b('0x1f7'),'as':_0xb62b('0x1e5')});db['SmsTransferReport'][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'foreignKey':_0xb62b('0x1e6'),'as':_0xb62b('0x1e7')});db[_0xb62b('0xfd')][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'foreignKey':_0xb62b('0x1f0'),'as':_0xb62b('0x1f4')});db[_0xb62b('0xfd')][_0xb62b('0x12e')](db[_0xb62b('0x141')],{'foreignKey':'ToSmsQueueId','as':_0xb62b('0x1e9')});db[_0xb62b('0xfd')][_0xb62b('0x12e')](db[_0xb62b('0x51')],{'foreignKey':_0xb62b('0x1f8'),'as':_0xb62b('0x1f2')});db['CmList'][_0xb62b('0x11e')](db[_0xb62b('0x80')],{'as':_0xb62b('0x185'),'foreignKey':_0xb62b('0x174')});db[_0xb62b('0xff')][_0xb62b('0x11e')](db[_0xb62b('0x7b')],{'as':'CustomFields','foreignKey':_0xb62b('0x174')});db['CmList']['hasMany'](db[_0xb62b('0x71')],{'as':_0xb62b('0x134'),'onDelete':'cascade','foreignKey':'ListId'});db[_0xb62b('0xff')][_0xb62b('0x11e')](db[_0xb62b('0x75')],{'as':_0xb62b('0x123'),'foreignKey':_0xb62b('0x174')});db['CmList'][_0xb62b('0x11e')](db[_0xb62b('0x77')],{'as':'HopperHistory','foreignKey':_0xb62b('0x174')});db[_0xb62b('0xff')]['hasMany'](db['ReportAgentPreview'],{'as':_0xb62b('0x79'),'foreignKey':_0xb62b('0x174')});db[_0xb62b('0xff')][_0xb62b('0x130')](db[_0xb62b('0x156')],{'as':_0xb62b('0x1f9'),'through':_0xb62b('0x162')});db['CmList'][_0xb62b('0x130')](db['User'],{'as':_0xb62b('0x163'),'through':_0xb62b('0x137')});db['VoicePrefix']['hasMany'](db[_0xb62b('0x19')],{'as':_0xb62b('0x122'),'onDelete':_0xb62b('0x11c')});db[_0xb62b('0x101')][_0xb62b('0x130')](db[_0xb62b('0x13')],{'as':_0xb62b('0x163'),'through':_0xb62b('0x1fa')});db[_0xb62b('0x103')][_0xb62b('0x11e')](db[_0xb62b('0x13')],{'as':_0xb62b('0x17a'),'foreignKey':_0xb62b('0x12f')});db['UserProfile']['hasMany'](db['UserProfileSection'],{'as':_0xb62b('0x1fb'),'foreignKey':_0xb62b('0x12f'),'onDelete':'cascade'});db[_0xb62b('0x1fc')][_0xb62b('0x11e')](db['UserProfileResource'],{'as':_0xb62b('0x1fd'),'foreignKey':_0xb62b('0x1fe'),'onDelete':_0xb62b('0x11c')});db[_0xb62b('0x10a')][_0xb62b('0x11e')](db[_0xb62b('0x80')],{'as':_0xb62b('0x185'),'foreignKey':_0xb62b('0x1ff')});db[_0xb62b('0x10a')][_0xb62b('0x11e')](db['CannedAnswer'],{'as':_0xb62b('0x172'),'foreignKey':_0xb62b('0x1ff')});db[_0xb62b('0x10a')][_0xb62b('0x11e')](db[_0xb62b('0x110')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xb62b('0x11e')](db[_0xb62b('0x10e')],{'as':_0xb62b('0x187')});db['WhatsappAccount'][_0xb62b('0x11e')](db[_0xb62b('0x10c')],{'as':_0xb62b('0x153')});db[_0xb62b('0x10a')][_0xb62b('0x12e')](db[_0xb62b('0xff')],{'as':'List','foreignKey':_0xb62b('0x174')});db[_0xb62b('0x10a')][_0xb62b('0x12e')](db[_0xb62b('0x86')],{'as':_0xb62b('0x161'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xb62b('0x10a')][_0xb62b('0x130')](db[_0xb62b('0x13')],{'as':_0xb62b('0x163'),'through':'user_has_whatsapp_accounts'});db[_0xb62b('0x10c')][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'onDelete':_0xb62b('0x182')});db[_0xb62b('0x10c')][_0xb62b('0x12e')](db[_0xb62b('0x114')],{'onDelete':_0xb62b('0x182')});db[_0xb62b('0x10c')][_0xb62b('0x12e')](db[_0xb62b('0x10a')],{'onDelete':_0xb62b('0x182')});db[_0xb62b('0x10c')][_0xb62b('0x12e')](db['Interval'],{'onDelete':_0xb62b('0x182'),'foreignKey':_0xb62b('0x160')});db[_0xb62b('0x10c')][_0xb62b('0x12e')](db[_0xb62b('0x183')],{'onDelete':'restrict','foreignKey':_0xb62b('0x189')});db[_0xb62b('0x10e')][_0xb62b('0x11e')](db[_0xb62b('0x110')],{'as':'Messages','onDelete':_0xb62b('0x11c'),'foreignKey':_0xb62b('0x200')});db[_0xb62b('0x10e')]['belongsTo'](db[_0xb62b('0x10a')],{'as':'Account','foreignKey':_0xb62b('0x1ff')});db[_0xb62b('0x10e')][_0xb62b('0x12e')](db['CmContact'],{'as':_0xb62b('0x16c'),'foreignKey':_0xb62b('0x16d')});db[_0xb62b('0x10e')][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'as':_0xb62b('0x177'),'foreignKey':_0xb62b('0x11d')});db[_0xb62b('0x10e')]['belongsToMany'](db[_0xb62b('0x183')],{'through':_0xb62b('0x201'),'as':_0xb62b('0x179')});db[_0xb62b('0x10e')][_0xb62b('0x130')](db[_0xb62b('0x183')],{'through':_0xb62b('0x201'),'as':_0xb62b('0x191')});db[_0xb62b('0x10e')][_0xb62b('0x130')](db[_0xb62b('0x13')],{'as':'Users','through':_0xb62b('0x202'),'foreignKey':_0xb62b('0x200')});db['WhatsappMessage'][_0xb62b('0x12e')](db['User'],{'as':_0xb62b('0x13')});db['WhatsappMessage'][_0xb62b('0x12e')](db[_0xb62b('0x71')],{'onDelete':_0xb62b('0x11c'),'as':_0xb62b('0x16c')});db[_0xb62b('0x110')][_0xb62b('0x12e')](db[_0xb62b('0x10e')],{'onDelete':_0xb62b('0x11c'),'as':_0xb62b('0x17d'),'foreignKey':_0xb62b('0x200')});db[_0xb62b('0x110')][_0xb62b('0x12e')](db['WhatsappAccount'],{'as':_0xb62b('0x17e'),'foreignKey':_0xb62b('0x1ff')});db[_0xb62b('0x111')][_0xb62b('0x12e')](db[_0xb62b('0x10a')],{});db[_0xb62b('0x111')][_0xb62b('0x12e')](db[_0xb62b('0xff')],{'as':_0xb62b('0x173'),'foreignKey':_0xb62b('0x174')});db[_0xb62b('0x111')]['belongsTo'](db['CmContact'],{'as':_0xb62b('0x16c'),'foreignKey':_0xb62b('0x16d')});db[_0xb62b('0x111')]['belongsTo'](db[_0xb62b('0x10e')],{});db[_0xb62b('0x111')][_0xb62b('0x12e')](db['WhatsappQueue'],{});db[_0xb62b('0x111')][_0xb62b('0x12e')](db['WhatsappMessage'],{});db['WhatsappQueueReport'][_0xb62b('0x12e')](db[_0xb62b('0x13')],{});db['WhatsappTransferReport'][_0xb62b('0x12e')](db[_0xb62b('0x110')],{});db[_0xb62b('0x113')][_0xb62b('0x12e')](db[_0xb62b('0x10e')],{});db['WhatsappTransferReport'][_0xb62b('0x12e')](db['WhatsappAccount'],{'foreignKey':_0xb62b('0x203'),'as':'FromAccount'});db['WhatsappTransferReport'][_0xb62b('0x12e')](db[_0xb62b('0x10a')],{'foreignKey':'ToWhatsappAccountId','as':_0xb62b('0x1f2')});db['WhatsappTransferReport'][_0xb62b('0x12e')](db[_0xb62b('0x114')],{'foreignKey':_0xb62b('0x204'),'as':'ToQueue'});db[_0xb62b('0x113')][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'foreignKey':_0xb62b('0x1e6'),'as':_0xb62b('0x1e7')});db['WhatsappTransferReport'][_0xb62b('0x12e')](db[_0xb62b('0x13')],{'foreignKey':_0xb62b('0x1f0'),'as':_0xb62b('0x1f4')});db[_0xb62b('0x114')][_0xb62b('0x130')](db[_0xb62b('0x13')],{'as':_0xb62b('0x163'),'through':_0xb62b('0x35'),'foreignKey':_0xb62b('0x205')});db['WhatsappQueue'][_0xb62b('0x130')](db[_0xb62b('0xee')],{'through':_0xb62b('0x206'),'as':_0xb62b('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xbca7=['../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Field','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','../api/migration/migration.model','Plugin','MailTransferReport','ChatTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','cascade','UserId','Recordings','hasMany','UserVoiceQueueRt','VoiceExtension','Extensions','HopperFinals','ReportAgentPreview','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','ChatQueues','UserChatQueue','FaxQueues','UserFaxQueue','OpenchannelQueues','WhatsappQueues','user_has_voice_prefixes','user_has_chat_websites','FaxAccount','FaxAccounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','VoiceChanSpy','SpiedAgents','ChanSpyId','VoiceContext','Applications','moh_has_sounds','Members','HopperHistories','VoiceQueueId','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','belongsTo','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceQueueReport','uniqueid','AgentReports','Contact','ContactId','MailAccountId','Imap','Smtp','Disposition','Dispositions','Answers','MailMessage','Interactions','MailApplication','Template','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','Tag','ThroughTags','user_has_mail_interactions','Attachment','Attachments','Interaction','ChatWebsite','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','MailQueueReport','List','ListId','Items','FaxAccountId','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','SmsApplication','SmsQueue','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ProactiveActions','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','CompanyId','Phones','CmContactId','Hoppers','FaxInteractions','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','Campaign','CampaignId','OwnerId','All','OneAll','AutomationAllId','Automation','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerId','Fields','AnalyticDefaultReport','MetricId','Configurations','AccountId','SubjectId','Descriptions','Description','DescriptionId','Field','FieldId','VariableId','Subjects','Subject','int_desk_configuration_has_tags','ZendeskAccount','int_freshdesk_configuration_has_tags','VtigerField','VtigerAccount','ServicenowConfiguration','Dynamics365Account','Dynamics365Configuration','ChatQueueReport','FromId','ToId','SessionId','SmsQueueReport','JscriptyProject','ProjectId','user_has_square_projects','MailQueues','SmsQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','voice_queues_has_cm_lists','userProfileId','Resources','sectionId','WhatsappAccount','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','User','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','import','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField'];(function(_0x50a7c4,_0x582aca){var _0x17d784=function(_0x3f13f9){while(--_0x3f13f9){_0x50a7c4['push'](_0x50a7c4['shift']());}};_0x17d784(++_0x582aca);}(_0xbca7,0x149));var _0x7bca=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xbca7[_0x3899d1];return _0xeb4a7d;};'use strict';var path=require(_0x7bca('0x0'));var config=require(_0x7bca('0x1'));var Sequelize=require(_0x7bca('0x2'));var _=require(_0x7bca('0x3'));var jstz=require(_0x7bca('0x4'));var timezone=jstz[_0x7bca('0x5')]();config[_0x7bca('0x2')]=_[_0x7bca('0x6')](config[_0x7bca('0x2')],{'database':_0x7bca('0x7'),'username':_0x7bca('0x8'),'password':_0x7bca('0x9'),'options':{'host':_0x7bca('0xa'),'port':0xcea,'dialect':_0x7bca('0xb'),'dialectOptions':{'charset':_0x7bca('0xc')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x7bca('0xd'),'collate':_0x7bca('0xe')}}});config[_0x7bca('0xf')]=_[_0x7bca('0x6')](config[_0x7bca('0xf')],{'database':'motion2','username':_0x7bca('0x8'),'password':'xC@LL1234','options':{'host':_0x7bca('0xa'),'port':0xcea,'dialect':_0x7bca('0xb'),'dialectOptions':{'charset':_0x7bca('0xc')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x7bca('0xd'),'collate':_0x7bca('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7bca('0x2')][_0x7bca('0x10')],config[_0x7bca('0x2')][_0x7bca('0x11')],config[_0x7bca('0x2')][_0x7bca('0x12')],config[_0x7bca('0x2')][_0x7bca('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7bca('0xf')]['database'],config[_0x7bca('0xf')][_0x7bca('0x11')],config['sequelizeHistory']['password'],config[_0x7bca('0xf')][_0x7bca('0x13')])};db[_0x7bca('0x14')]=db[_0x7bca('0x2')]['import'](_0x7bca('0x15'));db['VoiceChanSpy']=db[_0x7bca('0x2')]['import'](_0x7bca('0x16'));db['VoiceContext']=db['sequelize']['import'](_0x7bca('0x17'));db['VoiceExtension']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x19'));db[_0x7bca('0x1a')]=db['sequelize'][_0x7bca('0x18')](_0x7bca('0x1b'));db[_0x7bca('0x1c')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/voiceQueue/voiceQueue.model');db[_0x7bca('0x1d')]=db['sequelize'][_0x7bca('0x18')]('../api/voiceRecording/voiceRecording.model');db[_0x7bca('0x1e')]=db['sequelize']['import']('../api/screenRecording/screenRecording.model');db[_0x7bca('0x1f')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x20'));db[_0x7bca('0x21')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x22'));db[_0x7bca('0x23')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x24'));db['VoiceDialReport']=db[_0x7bca('0x2')]['import'](_0x7bca('0x25'));db['VoiceAgentReport']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x26'));db['VoiceQueueReport']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x27'));db[_0x7bca('0x28')]=db['sequelize'][_0x7bca('0x18')](_0x7bca('0x29'));db['Trunk']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x2a'));db['VoiceTransferReport']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x2b'));db['UserVoiceQueueRt']=db[_0x7bca('0x2')]['import']('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x7bca('0x2c')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x2d'));db['UserChatQueue']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x2e'));db[_0x7bca('0x2f')]=db['sequelize'][_0x7bca('0x18')](_0x7bca('0x30'));db['UserFaxQueue']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x31'));db[_0x7bca('0x32')]=db['sequelize']['import']('../api/userSmsQueue/userSmsQueue.model');db[_0x7bca('0x33')]=db[_0x7bca('0x2')]['import'](_0x7bca('0x34'));db[_0x7bca('0x35')]=db['sequelize'][_0x7bca('0x18')](_0x7bca('0x36'));db[_0x7bca('0x37')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/mailServerIn/mailServerIn.model');db[_0x7bca('0x38')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/mailServerOut/mailServerOut.model');db[_0x7bca('0x39')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/mailAccount/mailAccount.model');db[_0x7bca('0x3a')]=db[_0x7bca('0x2')]['import'](_0x7bca('0x3b'));db[_0x7bca('0x3c')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/mailSubstatus/mailSubstatus.model');db[_0x7bca('0x3d')]=db[_0x7bca('0x2')]['import']('../api/mailInteraction/mailInteraction.model');db['MailMessage']=db['sequelize'][_0x7bca('0x18')](_0x7bca('0x3e'));db['MailApplication']=db['sequelize'][_0x7bca('0x18')](_0x7bca('0x3f'));db['MailQueueReport']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x40'));db[_0x7bca('0x41')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/dashboard/dashboard.model');db[_0x7bca('0x42')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x43'));db[_0x7bca('0x44')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x45'));db[_0x7bca('0x46')]=db['sequelize'][_0x7bca('0x18')]('../api/faxInteraction/faxInteraction.model');db[_0x7bca('0x47')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x48'));db[_0x7bca('0x49')]=db[_0x7bca('0x2')]['import'](_0x7bca('0x4a'));db[_0x7bca('0x4b')]=db[_0x7bca('0x2')]['import'](_0x7bca('0x4c'));db[_0x7bca('0x4d')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x4e'));db[_0x7bca('0x4f')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x50'));db['SmsMessage']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x51'));db['SmsQueue']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x52'));db[_0x7bca('0x53')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/openchannelAccount/openchannelAccount.model');db[_0x7bca('0x54')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x55'));db['OpenchannelInteraction']=db[_0x7bca('0x2')]['import'](_0x7bca('0x56'));db[_0x7bca('0x57')]=db[_0x7bca('0x2')]['import'](_0x7bca('0x58'));db[_0x7bca('0x59')]=db['sequelize']['import'](_0x7bca('0x5a'));db['ChatWebsite']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x5b'));db[_0x7bca('0x5c')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x7bca('0x5d')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x5e'));db[_0x7bca('0x5f')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/chatInteraction/chatInteraction.model');db[_0x7bca('0x60')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/chatMessage/chatMessage.model');db[_0x7bca('0x61')]=db['sequelize']['import'](_0x7bca('0x62'));db[_0x7bca('0x63')]=db['sequelize'][_0x7bca('0x18')](_0x7bca('0x64'));db[_0x7bca('0x65')]=db['sequelize'][_0x7bca('0x18')]('../api/chatGroup/chatGroup.model');db[_0x7bca('0x66')]=db['sequelize'][_0x7bca('0x18')](_0x7bca('0x67'));db[_0x7bca('0x68')]=db['sequelize']['import'](_0x7bca('0x69'));db['CmContact']=db[_0x7bca('0x2')]['import']('../api/cmContact/cmContact.model');db[_0x7bca('0x6a')]=db['sequelize'][_0x7bca('0x18')](_0x7bca('0x6b'));db[_0x7bca('0x6c')]=db['sequelize'][_0x7bca('0x18')](_0x7bca('0x6d'));db[_0x7bca('0x6e')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x6f'));db[_0x7bca('0x70')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x71'));db['ReportAgentPreview']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x72'));db[_0x7bca('0x73')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/cmCustomField/cmCustomField.model');db[_0x7bca('0x74')]=db[_0x7bca('0x2')]['import'](_0x7bca('0x75'));db['Automation']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x76'));db[_0x7bca('0x77')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x78'));db['Disposition']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x79'));db[_0x7bca('0x7a')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x7b'));db[_0x7bca('0x7c')]=db['sequelize']['import'](_0x7bca('0x7d'));db[_0x7bca('0x7e')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x7f'));db['Cdr']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x80'));db[_0x7bca('0x81')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x82'));db[_0x7bca('0x83')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x84'));db[_0x7bca('0x85')]=db['sequelize']['import']('../api/sound/sound.model');db['Tag']=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/tag/tag.model');db['ContactItemType']=db[_0x7bca('0x2')]['import'](_0x7bca('0x86'));db[_0x7bca('0x87')]=db['sequelize'][_0x7bca('0x18')](_0x7bca('0x88'));db['CmHopperAdditionalPhone']=db['sequelize'][_0x7bca('0x18')](_0x7bca('0x89'));db['Template']=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/template/template.model');db[_0x7bca('0x8a')]=db['sequelize'][_0x7bca('0x18')](_0x7bca('0x8b'));db[_0x7bca('0x8c')]=db['sequelize'][_0x7bca('0x18')](_0x7bca('0x8d'));db[_0x7bca('0x8e')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x8f'));db[_0x7bca('0x90')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x91'));db[_0x7bca('0x92')]=db[_0x7bca('0x2')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db['sequelize']['import'](_0x7bca('0x93'));db['AnalyticExtractedReport']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x94'));db[_0x7bca('0x95')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x96'));db[_0x7bca('0x97')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x98'));db[_0x7bca('0x99')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x9a'));db[_0x7bca('0x9b')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x9c'));db[_0x7bca('0x9d')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x9e'));db[_0x7bca('0x9f')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xa0'));db[_0x7bca('0xa1')]=db[_0x7bca('0x2')]['import'](_0x7bca('0xa2'));db[_0x7bca('0xa3')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xa4'));db[_0x7bca('0xa5')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xa6'));db[_0x7bca('0xa7')]=db[_0x7bca('0x2')]['import']('../api/intDeskAccount/intDeskAccount.model');db[_0x7bca('0xa8')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xa9'));db[_0x7bca('0xaa')]=db['sequelize']['import'](_0x7bca('0xab'));db[_0x7bca('0xac')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/intZohoAccount/intZohoAccount.model');db[_0x7bca('0xad')]=db['sequelize'][_0x7bca('0x18')](_0x7bca('0xae'));db[_0x7bca('0xaf')]=db['sequelize'][_0x7bca('0x18')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xb0'));db[_0x7bca('0xb1')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xb2'));db[_0x7bca('0xb3')]=db['sequelize'][_0x7bca('0x18')]('../api/intZendeskField/intZendeskField.model');db[_0x7bca('0xb4')]=db['sequelize'][_0x7bca('0x18')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x7bca('0xb5')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xb6'));db[_0x7bca('0xb7')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xb8'));db['VtigerAccount']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xb9'));db[_0x7bca('0xba')]=db[_0x7bca('0x2')]['import'](_0x7bca('0xbb'));db['VtigerField']=db['sequelize']['import'](_0x7bca('0xbc'));db[_0x7bca('0xbd')]=db['sequelize'][_0x7bca('0x18')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0x7bca('0x2')]['import'](_0x7bca('0xbe'));db[_0x7bca('0xbf')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xc0'));db['Dynamics365Account']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xc1'));db['Dynamics365Configuration']=db['sequelize'][_0x7bca('0x18')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x7bca('0xc2')]=db['sequelize'][_0x7bca('0x18')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x7bca('0xc3')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x7bca('0xc4')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xc5'));db[_0x7bca('0xc6')]=db['sequelize']['import'](_0x7bca('0xc7'));db['Integration']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0x8f'));db['Network']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xc8'));db['ChatQueueReport']=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/chatQueueReport/chatQueueReport.model');db[_0x7bca('0xc9')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xca'));db[_0x7bca('0xcb')]=db[_0x7bca('0x2')]['import'](_0x7bca('0xcc'));db[_0x7bca('0xcd')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xce'));db[_0x7bca('0xcf')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xd0'));db['SquareReport']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xd1'));db[_0x7bca('0xd2')]=db[_0x7bca('0x2')]['import'](_0x7bca('0xd3'));db['JscriptyProject']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xd4'));db[_0x7bca('0xd5')]=db[_0x7bca('0x2')]['import']('../api/setting/setting.model');db['SquareOdbc']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xd6'));db[_0x7bca('0xd7')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/squareProject/squareProject.model');db[_0x7bca('0xd8')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xd9'));db[_0x7bca('0xda')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xdb'));db[_0x7bca('0xdc')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xdd'));db[_0x7bca('0xde')]=db[_0x7bca('0x2')]['import'](_0x7bca('0xdf'));db['Campaign']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xe0'));db['Migration']=db['sequelize'][_0x7bca('0x18')](_0x7bca('0xe1'));db['Attachment']=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/attachment/attachment.model');db[_0x7bca('0xe2')]=db[_0x7bca('0x2')]['import']('../api/plugin/plugin.model');db[_0x7bca('0xe3')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/mailTransferReport/mailTransferReport.model');db[_0x7bca('0xe4')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xe5'));db['OpenchannelTransferReport']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xe6'));db[_0x7bca('0xe7')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xe8'));db[_0x7bca('0xe9')]=db[_0x7bca('0x2')]['import']('../api/cmList/cmList.model');db[_0x7bca('0xea')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xeb'));db[_0x7bca('0xec')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/userProfile/userProfile.model');db[_0x7bca('0xed')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xee'));db[_0x7bca('0xef')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xf0'));db[_0x7bca('0xf1')]=db['sequelize'][_0x7bca('0x18')](_0x7bca('0xf2'));db['WhatsappAccount']=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xf3'));db[_0x7bca('0xf4')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/whatsappApplication/whatsappApplication.model');db[_0x7bca('0xf5')]=db[_0x7bca('0x2')][_0x7bca('0x18')](_0x7bca('0xf6'));db[_0x7bca('0xf7')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/whatsappMessage/whatsappMessage.model');db[_0x7bca('0xf8')]=db['sequelize'][_0x7bca('0x18')](_0x7bca('0xf9'));db[_0x7bca('0xfa')]=db[_0x7bca('0x2')][_0x7bca('0x18')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x7bca('0xfb')]=db['sequelize'][_0x7bca('0x18')]('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db[_0x7bca('0x2')]['import'](_0x7bca('0xfc'));db[_0x7bca('0xfd')]=db['sequelize'][_0x7bca('0x18')](_0x7bca('0xfe'));db[_0x7bca('0x14')][_0x7bca('0xff')](db[_0x7bca('0x1f')],{'as':_0x7bca('0x1f'),'onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x101')});db[_0x7bca('0x14')]['hasMany'](db[_0x7bca('0x1d')],{'as':_0x7bca('0x102'),'foreignKey':_0x7bca('0x101')});db['User'][_0x7bca('0x103')](db[_0x7bca('0x104')],{'as':'VoiceQueuesRt','foreignKey':_0x7bca('0x101')});db[_0x7bca('0x14')][_0x7bca('0x103')](db[_0x7bca('0x105')],{'as':_0x7bca('0x106'),'onDelete':'cascade','hooks':!![]});db['User'][_0x7bca('0x103')](db['CmHopperFinal'],{'as':_0x7bca('0x107'),'foreignKey':_0x7bca('0x101')});db['User'][_0x7bca('0x103')](db[_0x7bca('0x70')],{'as':'HopperHistory','foreignKey':_0x7bca('0x101')});db[_0x7bca('0x14')]['hasMany'](db[_0x7bca('0x108')],{'as':_0x7bca('0x108'),'foreignKey':_0x7bca('0x101')});db['User'][_0x7bca('0x103')](db[_0x7bca('0x109')],{'as':_0x7bca('0x10a'),'foreignKey':_0x7bca('0x101')});db[_0x7bca('0x14')][_0x7bca('0x103')](db['ChatInteraction'],{'as':_0x7bca('0x10b'),'foreignKey':_0x7bca('0x101')});db[_0x7bca('0x14')][_0x7bca('0x103')](db['SmsInteraction'],{'as':_0x7bca('0x10c'),'foreignKey':_0x7bca('0x101')});db[_0x7bca('0x14')][_0x7bca('0x103')](db[_0x7bca('0x46')],{'as':'FaxInteractions','foreignKey':'UserId'});db[_0x7bca('0x14')]['hasMany'](db['MailInteraction'],{'as':_0x7bca('0x10d'),'foreignKey':_0x7bca('0x101')});db[_0x7bca('0x14')][_0x7bca('0x103')](db[_0x7bca('0xf5')],{'as':_0x7bca('0x10e'),'foreignKey':_0x7bca('0x101')});db[_0x7bca('0x14')][_0x7bca('0x103')](db[_0x7bca('0xf1')],{'as':_0x7bca('0x10f'),'foreignKey':_0x7bca('0x110')});db[_0x7bca('0x14')]['belongsTo'](db[_0x7bca('0xec')],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0x7bca('0x14')][_0x7bca('0x111')](db[_0x7bca('0x65')],{'as':_0x7bca('0x112'),'through':_0x7bca('0x113')});db[_0x7bca('0x14')][_0x7bca('0x111')](db[_0x7bca('0x114')],{'as':_0x7bca('0x115'),'through':_0x7bca('0x116')});db[_0x7bca('0x14')][_0x7bca('0x111')](db[_0x7bca('0xe9')],{'as':_0x7bca('0x117'),'through':_0x7bca('0x118')});db[_0x7bca('0x14')][_0x7bca('0x111')](db[_0x7bca('0xdc')],{'through':_0x7bca('0x119')});db[_0x7bca('0x14')][_0x7bca('0x111')](db['MailInteraction'],{'as':_0x7bca('0x10d'),'through':'user_has_mail_interactions'});db[_0x7bca('0x14')][_0x7bca('0x111')](db[_0x7bca('0x5f')],{'as':_0x7bca('0x10b'),'through':_0x7bca('0x11a')});db['User'][_0x7bca('0x111')](db[_0x7bca('0x46')],{'as':'FaxInteractions','through':_0x7bca('0x11b')});db['User']['belongsToMany'](db[_0x7bca('0x4f')],{'as':'SmsInteractions','through':_0x7bca('0x11c')});db[_0x7bca('0x14')][_0x7bca('0x111')](db['OpenchannelInteraction'],{'as':_0x7bca('0x10a'),'through':'user_has_openchannel_interactions'});db[_0x7bca('0x14')][_0x7bca('0x111')](db[_0x7bca('0xf5')],{'as':_0x7bca('0x10e'),'through':_0x7bca('0x11d')});db[_0x7bca('0x14')][_0x7bca('0x111')](db[_0x7bca('0x1c')],{'as':_0x7bca('0x11e'),'through':_0x7bca('0x2c'),'required':![]});db['User'][_0x7bca('0x111')](db[_0x7bca('0x3a')],{'as':'MailQueues','through':_0x7bca('0x2f'),'required':![]});db[_0x7bca('0x14')]['belongsToMany'](db[_0x7bca('0x63')],{'as':_0x7bca('0x11f'),'through':_0x7bca('0x120'),'required':![],'hooks':!![]});db[_0x7bca('0x14')][_0x7bca('0x111')](db[_0x7bca('0x49')],{'as':_0x7bca('0x121'),'through':_0x7bca('0x122'),'required':![]});db['User'][_0x7bca('0x111')](db['SmsQueue'],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0x7bca('0x14')]['belongsToMany'](db[_0x7bca('0x59')],{'as':_0x7bca('0x123'),'through':_0x7bca('0x33'),'required':![]});db[_0x7bca('0x14')][_0x7bca('0x111')](db['WhatsappQueue'],{'as':_0x7bca('0x124'),'through':_0x7bca('0x35'),'required':![]});db[_0x7bca('0x14')]['belongsToMany'](db[_0x7bca('0xe9')],{'through':_0x7bca('0x118')});db['User'][_0x7bca('0x111')](db[_0x7bca('0xea')],{'as':'VoicePrefixes','through':_0x7bca('0x125'),'required':![]});db[_0x7bca('0x14')][_0x7bca('0x111')](db['ChatWebsite'],{'as':'ChatWebsites','through':_0x7bca('0x126')});db[_0x7bca('0x14')][_0x7bca('0x111')](db[_0x7bca('0x127')],{'as':_0x7bca('0x128'),'through':'user_has_fax_accounts'});db[_0x7bca('0x14')][_0x7bca('0x111')](db[_0x7bca('0x39')],{'as':_0x7bca('0x129'),'through':_0x7bca('0x12a')});db['User'][_0x7bca('0x111')](db[_0x7bca('0x53')],{'as':'OpenchannelAccounts','through':_0x7bca('0x12b')});db[_0x7bca('0x14')][_0x7bca('0x111')](db['SmsAccount'],{'as':_0x7bca('0x12c'),'through':_0x7bca('0x12d')});db[_0x7bca('0x14')][_0x7bca('0x111')](db['WhatsappAccount'],{'as':_0x7bca('0x12e'),'through':'user_has_whatsapp_accounts'});db[_0x7bca('0x14')]['belongsToMany'](db['SquareProject'],{'as':'SquareProjects','through':'user_has_square_projects'});db[_0x7bca('0x12f')]['hasMany'](db[_0x7bca('0x105')],{'as':_0x7bca('0x130'),'onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x131')});db[_0x7bca('0x132')][_0x7bca('0x103')](db[_0x7bca('0x105')],{'onDelete':'cascade'});db['VoiceExtension'][_0x7bca('0x103')](db[_0x7bca('0x105')],{'as':_0x7bca('0x133'),'onDelete':'cascade'});db[_0x7bca('0x1a')][_0x7bca('0x111')](db[_0x7bca('0x85')],{'as':'Sounds','through':_0x7bca('0x134')});db[_0x7bca('0x1c')][_0x7bca('0x103')](db[_0x7bca('0x104')],{'as':_0x7bca('0x135'),'foreignKey':'VoiceQueueId'});db[_0x7bca('0x1c')]['hasMany'](db[_0x7bca('0x6a')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db[_0x7bca('0x1c')][_0x7bca('0x103')](db[_0x7bca('0x6e')],{'as':_0x7bca('0x107'),'foreignKey':'VoiceQueueId'});db[_0x7bca('0x1c')][_0x7bca('0x103')](db[_0x7bca('0x70')],{'as':_0x7bca('0x136'),'foreignKey':_0x7bca('0x137')});db[_0x7bca('0x1c')][_0x7bca('0x103')](db[_0x7bca('0x108')],{'as':_0x7bca('0x108'),'foreignKey':'VoiceQueueId'});db[_0x7bca('0x1c')]['hasMany'](db[_0x7bca('0x6c')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0x7bca('0x1c')][_0x7bca('0x103')](db[_0x7bca('0xcf')],{'as':_0x7bca('0x138'),'foreignKey':_0x7bca('0x137')});db[_0x7bca('0x1c')]['belongsTo'](db['Trunk'],{'as':_0x7bca('0x139'),'foreignKey':_0x7bca('0x13a')});db[_0x7bca('0x1c')]['belongsTo'](db[_0x7bca('0x139')],{'as':_0x7bca('0x13b'),'foreignKey':_0x7bca('0x13c')});db[_0x7bca('0x1c')][_0x7bca('0x13d')](db[_0x7bca('0x7c')],{'as':_0x7bca('0x7c'),'foreignKey':_0x7bca('0x13e')});db['VoiceQueue'][_0x7bca('0x13d')](db[_0x7bca('0x7e')],{'as':_0x7bca('0x13f'),'foreignKey':_0x7bca('0x140')});db[_0x7bca('0x1c')]['belongsToMany'](db[_0x7bca('0xe9')],{'as':_0x7bca('0x117'),'through':'voice_queues_has_cm_lists'});db[_0x7bca('0x1c')]['belongsToMany'](db[_0x7bca('0x14')],{'as':_0x7bca('0x141'),'through':'UserVoiceQueue'});db['VoiceQueue']['belongsToMany'](db[_0x7bca('0xdc')],{'as':_0x7bca('0x142'),'through':_0x7bca('0xfd')});db[_0x7bca('0x1c')][_0x7bca('0x111')](db['CmList'],{'as':_0x7bca('0x143'),'through':_0x7bca('0x144')});db[_0x7bca('0x1d')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'as':_0x7bca('0x14'),'foreignKey':_0x7bca('0x101')});db[_0x7bca('0x1e')][_0x7bca('0x13d')](db['User'],{'as':_0x7bca('0x14'),'foreignKey':_0x7bca('0x101')});db['VoiceMail'][_0x7bca('0x103')](db[_0x7bca('0x21')],{'as':_0x7bca('0x145'),'onDelete':'cascade','foreignKey':_0x7bca('0x146'),'sourceKey':_0x7bca('0x147')});db[_0x7bca('0x21')][_0x7bca('0x13d')](db[_0x7bca('0x1f')],{'foreignKey':_0x7bca('0x146'),'targetKey':_0x7bca('0x147')});db[_0x7bca('0x23')][_0x7bca('0x103')](db[_0x7bca('0x148')],{'as':'QueueCalls','foreignKey':_0x7bca('0x149'),'constraints':![]});db[_0x7bca('0x23')][_0x7bca('0x103')](db['VoiceAgentReport'],{'as':_0x7bca('0x14a'),'foreignKey':_0x7bca('0x149'),'constraints':![]});db[_0x7bca('0x23')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'as':_0x7bca('0x14'),'foreignKey':_0x7bca('0x101')});db['VoiceCallReport']['belongsTo'](db[_0x7bca('0x114')],{'as':_0x7bca('0x14b'),'foreignKey':_0x7bca('0x14c')});db['MailServerIn'][_0x7bca('0x13d')](db['MailAccount'],{'as':_0x7bca('0x39'),'foreignKey':_0x7bca('0x14d')});db[_0x7bca('0x38')][_0x7bca('0x13d')](db[_0x7bca('0x39')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x7bca('0x39')][_0x7bca('0xff')](db[_0x7bca('0x37')],{'as':_0x7bca('0x14e'),'onDelete':_0x7bca('0x100')});db['MailAccount'][_0x7bca('0xff')](db[_0x7bca('0x38')],{'as':_0x7bca('0x14f'),'onDelete':_0x7bca('0x100')});db['MailAccount']['hasMany'](db[_0x7bca('0x150')],{'as':_0x7bca('0x151'),'foreignKey':_0x7bca('0x14d')});db[_0x7bca('0x39')][_0x7bca('0x103')](db['CannedAnswer'],{'as':_0x7bca('0x152'),'foreignKey':_0x7bca('0x14d')});db[_0x7bca('0x39')]['hasMany'](db[_0x7bca('0x153')],{'as':_0x7bca('0x145'),'foreignKey':'MailAccountId'});db[_0x7bca('0x39')][_0x7bca('0x103')](db[_0x7bca('0x3d')],{'as':_0x7bca('0x154')});db[_0x7bca('0x39')][_0x7bca('0x103')](db[_0x7bca('0x155')],{'as':_0x7bca('0x133')});db[_0x7bca('0x39')][_0x7bca('0x13d')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x7bca('0x39')]['belongsTo'](db[_0x7bca('0x156')],{'as':_0x7bca('0x156'),'foreignKey':'TemplateId'});db[_0x7bca('0x39')]['belongsTo'](db[_0x7bca('0x7e')],{'as':_0x7bca('0x13f'),'foreignKey':_0x7bca('0x140')});db[_0x7bca('0x39')][_0x7bca('0x111')](db[_0x7bca('0x14')],{'as':'Agents','through':_0x7bca('0x12a')});db[_0x7bca('0x3a')][_0x7bca('0x111')](db[_0x7bca('0x14')],{'as':_0x7bca('0x141'),'through':_0x7bca('0x2f')});db[_0x7bca('0x3a')]['belongsToMany'](db[_0x7bca('0xdc')],{'through':_0x7bca('0x157'),'as':'Teams'});db[_0x7bca('0x3d')][_0x7bca('0x103')](db['MailMessage'],{'as':_0x7bca('0x145'),'onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x158')});db[_0x7bca('0x3d')][_0x7bca('0x13d')](db[_0x7bca('0x39')],{'as':_0x7bca('0x159'),'foreignKey':'MailAccountId'});db[_0x7bca('0x3d')]['belongsTo'](db[_0x7bca('0x114')],{'as':'Contact','foreignKey':_0x7bca('0x14c')});db['MailInteraction'][_0x7bca('0x13d')](db['User'],{'as':_0x7bca('0x15a'),'foreignKey':_0x7bca('0x101')});db['MailInteraction'][_0x7bca('0x111')](db['Tag'],{'through':_0x7bca('0x15b'),'as':_0x7bca('0x15c')});db['MailInteraction'][_0x7bca('0x111')](db[_0x7bca('0x15d')],{'through':_0x7bca('0x15b'),'as':_0x7bca('0x15e')});db['MailInteraction'][_0x7bca('0x111')](db['User'],{'as':'Users','through':_0x7bca('0x15f'),'foreignKey':'MailInteractionId'});db['MailMessage']['hasMany'](db[_0x7bca('0x160')],{'as':_0x7bca('0x161'),'onDelete':'cascade'});db['MailMessage']['belongsTo'](db['User'],{'as':_0x7bca('0x14')});db[_0x7bca('0x153')][_0x7bca('0x13d')](db[_0x7bca('0x114')],{'onDelete':'cascade','as':_0x7bca('0x14b')});db['MailMessage'][_0x7bca('0x13d')](db['MailInteraction'],{'as':_0x7bca('0x162'),'foreignKey':_0x7bca('0x158')});db[_0x7bca('0x153')][_0x7bca('0x13d')](db[_0x7bca('0x39')],{'as':_0x7bca('0x159'),'foreignKey':_0x7bca('0x14d')});db[_0x7bca('0x153')][_0x7bca('0x13d')](db['ChatWebsite'],{'as':_0x7bca('0x163'),'foreignKey':_0x7bca('0x164')});db['MailMessage']['belongsTo'](db[_0x7bca('0x61')],{'as':_0x7bca('0x61'),'foreignKey':_0x7bca('0x165')});db[_0x7bca('0x155')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'onDelete':_0x7bca('0x166')});db[_0x7bca('0x155')][_0x7bca('0x13d')](db[_0x7bca('0x3a')],{'onDelete':_0x7bca('0x166')});db[_0x7bca('0x155')][_0x7bca('0x13d')](db[_0x7bca('0x39')],{'onDelete':_0x7bca('0x166')});db[_0x7bca('0x155')][_0x7bca('0x13d')](db['Interval'],{'onDelete':_0x7bca('0x166'),'foreignKey':_0x7bca('0x13e')});db['MailApplication']['belongsTo'](db[_0x7bca('0x15d')],{'onDelete':_0x7bca('0x166'),'foreignKey':_0x7bca('0x167')});db[_0x7bca('0x168')][_0x7bca('0x13d')](db[_0x7bca('0x39')],{});db[_0x7bca('0x168')][_0x7bca('0x13d')](db[_0x7bca('0xe9')],{'as':_0x7bca('0x169'),'foreignKey':_0x7bca('0x16a')});db[_0x7bca('0x168')]['belongsTo'](db[_0x7bca('0x114')],{'as':_0x7bca('0x14b'),'foreignKey':'ContactId'});db[_0x7bca('0x168')][_0x7bca('0x13d')](db['MailInteraction'],{});db[_0x7bca('0x168')]['belongsTo'](db[_0x7bca('0x153')],{});db[_0x7bca('0x168')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{});db[_0x7bca('0x168')][_0x7bca('0x13d')](db[_0x7bca('0x3a')],{});db['Dashboard'][_0x7bca('0x103')](db['DashboardItem'],{'as':_0x7bca('0x16b'),'onDelete':_0x7bca('0x100')});db[_0x7bca('0x127')][_0x7bca('0x103')](db['Disposition'],{'as':_0x7bca('0x151'),'foreignKey':_0x7bca('0x16c')});db[_0x7bca('0x127')][_0x7bca('0x103')](db[_0x7bca('0x77')],{'as':_0x7bca('0x152'),'foreignKey':_0x7bca('0x16c')});db[_0x7bca('0x127')][_0x7bca('0x103')](db[_0x7bca('0x46')],{'as':_0x7bca('0x154')});db[_0x7bca('0x127')][_0x7bca('0x103')](db[_0x7bca('0x44')],{'as':_0x7bca('0x133')});db['FaxAccount']['hasMany'](db[_0x7bca('0x105')],{'as':'Exntensions','onDelete':_0x7bca('0x100')});db[_0x7bca('0x127')][_0x7bca('0x103')](db[_0x7bca('0x47')],{'as':_0x7bca('0x145')});db[_0x7bca('0x127')][_0x7bca('0x13d')](db[_0x7bca('0x139')],{'as':'Trunk'});db[_0x7bca('0x127')][_0x7bca('0x13d')](db[_0x7bca('0xe9')],{'as':_0x7bca('0x169'),'foreignKey':_0x7bca('0x16a')});db[_0x7bca('0x127')][_0x7bca('0x13d')](db[_0x7bca('0x7e')],{'as':_0x7bca('0x13f'),'foreignKey':_0x7bca('0x140')});db[_0x7bca('0x127')][_0x7bca('0x111')](db[_0x7bca('0x14')],{'as':_0x7bca('0x141'),'through':'user_has_fax_accounts'});db[_0x7bca('0x44')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'onDelete':_0x7bca('0x166')});db['FaxApplication'][_0x7bca('0x13d')](db['FaxQueue'],{'onDelete':_0x7bca('0x166')});db[_0x7bca('0x44')][_0x7bca('0x13d')](db[_0x7bca('0x127')],{'onDelete':'restrict'});db[_0x7bca('0x44')][_0x7bca('0x13d')](db[_0x7bca('0x15d')],{'onDelete':_0x7bca('0x166'),'foreignKey':_0x7bca('0x167')});db[_0x7bca('0x46')]['hasMany'](db['FaxMessage'],{'as':_0x7bca('0x145'),'onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x16d')});db[_0x7bca('0x46')]['belongsTo'](db[_0x7bca('0x127')],{'as':_0x7bca('0x159'),'foreignKey':_0x7bca('0x16c')});db[_0x7bca('0x46')][_0x7bca('0x13d')](db[_0x7bca('0x114')],{'as':_0x7bca('0x14b'),'foreignKey':_0x7bca('0x14c')});db[_0x7bca('0x46')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'as':_0x7bca('0x15a'),'foreignKey':_0x7bca('0x101')});db[_0x7bca('0x46')]['belongsToMany'](db[_0x7bca('0x15d')],{'through':'fax_interaction_has_tags','as':'Tags'});db['FaxInteraction'][_0x7bca('0x111')](db[_0x7bca('0x15d')],{'through':_0x7bca('0x16e'),'as':_0x7bca('0x15e')});db[_0x7bca('0x46')][_0x7bca('0x111')](db[_0x7bca('0x14')],{'as':_0x7bca('0x16f'),'through':_0x7bca('0x11b'),'foreignKey':_0x7bca('0x16d')});db[_0x7bca('0x47')]['belongsTo'](db[_0x7bca('0x14')],{'onDelete':_0x7bca('0x100'),'as':_0x7bca('0x14')});db[_0x7bca('0x47')][_0x7bca('0x13d')](db[_0x7bca('0x46')],{'as':_0x7bca('0x162'),'foreignKey':_0x7bca('0x16d')});db[_0x7bca('0x47')][_0x7bca('0x13d')](db['CmContact'],{'onDelete':_0x7bca('0x100'),'as':_0x7bca('0x14b')});db[_0x7bca('0x47')][_0x7bca('0x13d')](db[_0x7bca('0x160')],{'as':_0x7bca('0x160'),'foreignKey':_0x7bca('0x170')});db['FaxMessage'][_0x7bca('0x13d')](db[_0x7bca('0x127')],{'as':_0x7bca('0x159'),'foreignKey':_0x7bca('0x16c')});db[_0x7bca('0x49')][_0x7bca('0x111')](db[_0x7bca('0x14')],{'as':_0x7bca('0x141'),'through':_0x7bca('0x122')});db[_0x7bca('0x49')][_0x7bca('0x111')](db[_0x7bca('0xdc')],{'through':_0x7bca('0x171'),'as':_0x7bca('0x142')});db[_0x7bca('0x4b')][_0x7bca('0x13d')](db[_0x7bca('0x127')],{});db[_0x7bca('0x4b')][_0x7bca('0x13d')](db[_0x7bca('0xe9')],{'as':_0x7bca('0x169'),'foreignKey':'ListId'});db['FaxQueueReport'][_0x7bca('0x13d')](db[_0x7bca('0x114')],{'as':_0x7bca('0x14b'),'foreignKey':_0x7bca('0x14c')});db[_0x7bca('0x4b')]['belongsTo'](db['FaxInteraction'],{});db[_0x7bca('0x4b')][_0x7bca('0x13d')](db[_0x7bca('0x47')],{});db['FaxQueueReport'][_0x7bca('0x13d')](db[_0x7bca('0x14')],{});db[_0x7bca('0x4b')][_0x7bca('0x13d')](db[_0x7bca('0x49')],{});db[_0x7bca('0x4d')][_0x7bca('0x103')](db[_0x7bca('0x150')],{'as':_0x7bca('0x151'),'foreignKey':_0x7bca('0x172')});db[_0x7bca('0x4d')]['hasMany'](db[_0x7bca('0x77')],{'as':_0x7bca('0x152'),'foreignKey':_0x7bca('0x172')});db['SmsAccount']['hasMany'](db[_0x7bca('0x173')],{'as':_0x7bca('0x145'),'foreignKey':_0x7bca('0x172')});db[_0x7bca('0x4d')][_0x7bca('0x103')](db[_0x7bca('0x4f')],{'as':_0x7bca('0x154')});db['SmsAccount'][_0x7bca('0x103')](db[_0x7bca('0x174')],{'as':_0x7bca('0x133')});db['SmsAccount']['belongsTo'](db[_0x7bca('0xe9')],{'as':_0x7bca('0x169'),'foreignKey':_0x7bca('0x16a')});db['SmsAccount']['belongsTo'](db[_0x7bca('0x7e')],{'as':_0x7bca('0x13f'),'foreignKey':_0x7bca('0x140')});db[_0x7bca('0x4d')][_0x7bca('0x111')](db[_0x7bca('0x14')],{'as':_0x7bca('0x141'),'through':_0x7bca('0x12d')});db[_0x7bca('0x174')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'onDelete':_0x7bca('0x166')});db['SmsApplication'][_0x7bca('0x13d')](db[_0x7bca('0x175')],{'onDelete':_0x7bca('0x166')});db[_0x7bca('0x174')][_0x7bca('0x13d')](db['SmsAccount'],{'onDelete':_0x7bca('0x166')});db[_0x7bca('0x174')]['belongsTo'](db[_0x7bca('0x7c')],{'onDelete':_0x7bca('0x166'),'foreignKey':_0x7bca('0x13e')});db[_0x7bca('0x174')][_0x7bca('0x13d')](db[_0x7bca('0x15d')],{'onDelete':'restrict','foreignKey':_0x7bca('0x167')});db[_0x7bca('0x4f')][_0x7bca('0x103')](db['SmsMessage'],{'as':'Messages','onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x176')});db[_0x7bca('0x4f')][_0x7bca('0x13d')](db[_0x7bca('0x4d')],{'as':_0x7bca('0x159'),'foreignKey':_0x7bca('0x172')});db[_0x7bca('0x4f')][_0x7bca('0x13d')](db[_0x7bca('0x114')],{'as':'Contact','foreignKey':_0x7bca('0x14c')});db[_0x7bca('0x4f')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'as':_0x7bca('0x15a'),'foreignKey':_0x7bca('0x101')});db[_0x7bca('0x4f')]['belongsToMany'](db['Tag'],{'through':'sms_interaction_has_tags','as':'Tags'});db[_0x7bca('0x4f')][_0x7bca('0x111')](db['Tag'],{'through':_0x7bca('0x177'),'as':_0x7bca('0x15e')});db['SmsInteraction'][_0x7bca('0x111')](db[_0x7bca('0x14')],{'as':_0x7bca('0x16f'),'through':_0x7bca('0x11c'),'foreignKey':_0x7bca('0x176')});db[_0x7bca('0x173')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'as':_0x7bca('0x14')});db[_0x7bca('0x173')][_0x7bca('0x13d')](db[_0x7bca('0x114')],{'onDelete':_0x7bca('0x100'),'as':_0x7bca('0x14b')});db[_0x7bca('0x173')]['belongsTo'](db['SmsInteraction'],{'onDelete':'cascade','as':_0x7bca('0x162'),'foreignKey':_0x7bca('0x176')});db[_0x7bca('0x173')][_0x7bca('0x13d')](db[_0x7bca('0x4d')],{'as':_0x7bca('0x159'),'foreignKey':'SmsAccountId'});db['SmsQueue'][_0x7bca('0x111')](db[_0x7bca('0x14')],{'as':_0x7bca('0x141'),'through':'UserSmsQueue','foreignKey':_0x7bca('0x178')});db['SmsQueue']['belongsToMany'](db[_0x7bca('0xdc')],{'through':_0x7bca('0x179'),'as':_0x7bca('0x142')});db[_0x7bca('0x53')][_0x7bca('0x103')](db[_0x7bca('0x150')],{'as':_0x7bca('0x151'),'foreignKey':_0x7bca('0x17a')});db['OpenchannelAccount']['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0x7bca('0x53')][_0x7bca('0x103')](db[_0x7bca('0x109')],{'as':_0x7bca('0x154'),'foreignKey':_0x7bca('0x17a')});db[_0x7bca('0x53')][_0x7bca('0x103')](db[_0x7bca('0x57')],{'as':'Messages','foreignKey':_0x7bca('0x17a')});db[_0x7bca('0x53')][_0x7bca('0x103')](db[_0x7bca('0x54')],{'as':_0x7bca('0x133'),'foreignKey':_0x7bca('0x17a')});db[_0x7bca('0x53')][_0x7bca('0x13d')](db[_0x7bca('0xe9')],{'as':'List','foreignKey':_0x7bca('0x16a')});db[_0x7bca('0x53')][_0x7bca('0x13d')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount'][_0x7bca('0x111')](db[_0x7bca('0x14')],{'as':_0x7bca('0x141'),'through':_0x7bca('0x12b')});db[_0x7bca('0x54')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'onDelete':'restrict'});db[_0x7bca('0x54')][_0x7bca('0x13d')](db['OpenchannelQueue'],{'onDelete':_0x7bca('0x166'),'foreignKey':_0x7bca('0x17b')});db[_0x7bca('0x54')][_0x7bca('0x13d')](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0x7bca('0x13d')](db[_0x7bca('0x7c')],{'onDelete':_0x7bca('0x166'),'foreignKey':_0x7bca('0x13e')});db['OpenchannelApplication']['belongsTo'](db[_0x7bca('0x15d')],{'onDelete':_0x7bca('0x166'),'foreignKey':_0x7bca('0x167')});db[_0x7bca('0x109')]['hasMany'](db[_0x7bca('0x57')],{'as':_0x7bca('0x145'),'onDelete':_0x7bca('0x100'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelInteraction']['belongsTo'](db[_0x7bca('0x53')],{'as':_0x7bca('0x159'),'foreignKey':_0x7bca('0x17a')});db[_0x7bca('0x109')][_0x7bca('0x13d')](db[_0x7bca('0x114')],{'as':_0x7bca('0x14b'),'foreignKey':_0x7bca('0x14c')});db[_0x7bca('0x109')][_0x7bca('0x13d')](db['User'],{'as':_0x7bca('0x15a'),'foreignKey':_0x7bca('0x101')});db[_0x7bca('0x109')][_0x7bca('0x111')](db['Tag'],{'through':_0x7bca('0x17c'),'as':_0x7bca('0x15c')});db['OpenchannelInteraction'][_0x7bca('0x111')](db[_0x7bca('0x15d')],{'through':'openchannel_interaction_has_tags','as':_0x7bca('0x15e')});db['OpenchannelInteraction'][_0x7bca('0x111')](db['User'],{'as':'Users','through':'user_has_openchannel_interactions','foreignKey':_0x7bca('0x17d')});db[_0x7bca('0x57')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'onDelete':_0x7bca('0x100'),'as':'User'});db[_0x7bca('0x57')][_0x7bca('0x13d')](db[_0x7bca('0x114')],{'onDelete':_0x7bca('0x100'),'as':_0x7bca('0x14b')});db[_0x7bca('0x57')][_0x7bca('0x13d')](db[_0x7bca('0x109')],{'onDelete':_0x7bca('0x100'),'as':_0x7bca('0x162'),'foreignKey':_0x7bca('0x17d')});db['OpenchannelMessage'][_0x7bca('0x13d')](db[_0x7bca('0x160')],{'as':'Attachment','foreignKey':_0x7bca('0x170')});db[_0x7bca('0x57')][_0x7bca('0x13d')](db['OpenchannelAccount'],{'as':_0x7bca('0x159'),'foreignKey':_0x7bca('0x17a')});db[_0x7bca('0x59')][_0x7bca('0x111')](db[_0x7bca('0x14')],{'as':_0x7bca('0x141'),'through':_0x7bca('0x33'),'foreignKey':'OpenchannelQueueId'});db[_0x7bca('0x59')][_0x7bca('0x111')](db[_0x7bca('0xdc')],{'through':_0x7bca('0x17e'),'as':_0x7bca('0x142')});db['ChatWebsite']['hasMany'](db['Disposition'],{'as':_0x7bca('0x151'),'foreignKey':_0x7bca('0x164')});db[_0x7bca('0x163')][_0x7bca('0x103')](db['CannedAnswer'],{'as':_0x7bca('0x152'),'foreignKey':'ChatWebsiteId'});db[_0x7bca('0x163')][_0x7bca('0x103')](db['ChatProactiveAction'],{'as':_0x7bca('0x17f')});db['ChatWebsite'][_0x7bca('0x103')](db['ChatInteraction'],{'as':_0x7bca('0x154')});db['ChatWebsite'][_0x7bca('0x103')](db[_0x7bca('0x5d')],{'as':'Applications'});db[_0x7bca('0x163')][_0x7bca('0x103')](db['ChatMessage'],{'as':_0x7bca('0x145')});db[_0x7bca('0x163')]['belongsTo'](db[_0x7bca('0xe9')],{'as':_0x7bca('0x169'),'foreignKey':'ListId'});db[_0x7bca('0x163')][_0x7bca('0x13d')](db[_0x7bca('0x7c')],{'as':_0x7bca('0x7c'),'foreignKey':'IntervalId'});db[_0x7bca('0x163')]['belongsTo'](db[_0x7bca('0x39')],{'as':_0x7bca('0x39'),'foreignKey':_0x7bca('0x14d')});db[_0x7bca('0x163')][_0x7bca('0x13d')](db[_0x7bca('0x7e')],{'as':_0x7bca('0x13f'),'foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite'][_0x7bca('0x111')](db[_0x7bca('0x14')],{'as':'Agents','through':_0x7bca('0x126')});db[_0x7bca('0x5c')]['belongsTo'](db[_0x7bca('0x53')],{});db[_0x7bca('0x5c')][_0x7bca('0x13d')](db[_0x7bca('0xe9')],{'as':_0x7bca('0x169'),'foreignKey':_0x7bca('0x16a')});db[_0x7bca('0x5c')]['belongsTo'](db[_0x7bca('0x114')],{'as':_0x7bca('0x14b'),'foreignKey':_0x7bca('0x14c')});db[_0x7bca('0x5c')][_0x7bca('0x13d')](db[_0x7bca('0x109')],{});db[_0x7bca('0x5c')][_0x7bca('0x13d')](db[_0x7bca('0x57')],{});db[_0x7bca('0x5c')][_0x7bca('0x13d')](db['User'],{});db[_0x7bca('0x5c')]['belongsTo'](db['OpenchannelQueue'],{});db[_0x7bca('0x5d')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'as':_0x7bca('0x180'),'foreignKey':_0x7bca('0x101'),'onDelete':_0x7bca('0x166')});db[_0x7bca('0x5d')][_0x7bca('0x13d')](db['ChatQueue'],{'as':_0x7bca('0x181'),'foreignKey':'ChatQueueId','onDelete':_0x7bca('0x166')});db['ChatApplication'][_0x7bca('0x13d')](db[_0x7bca('0x163')],{'as':_0x7bca('0x182'),'foreignKey':_0x7bca('0x164'),'onDelete':'restrict'});db[_0x7bca('0x5d')]['belongsTo'](db[_0x7bca('0x15d')],{'onDelete':_0x7bca('0x166'),'foreignKey':_0x7bca('0x167')});db[_0x7bca('0x5f')][_0x7bca('0x103')](db[_0x7bca('0x60')],{'as':_0x7bca('0x145'),'onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x183')});db[_0x7bca('0x5f')]['belongsTo'](db[_0x7bca('0x163')],{'as':_0x7bca('0x159'),'foreignKey':_0x7bca('0x164')});db[_0x7bca('0x5f')][_0x7bca('0x13d')](db['CmContact'],{'as':_0x7bca('0x14b'),'foreignKey':'ContactId'});db[_0x7bca('0x5f')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'as':_0x7bca('0x15a'),'foreignKey':_0x7bca('0x101')});db['ChatInteraction']['belongsToMany'](db[_0x7bca('0x15d')],{'through':_0x7bca('0x184'),'as':_0x7bca('0x15c')});db[_0x7bca('0x5f')]['belongsToMany'](db[_0x7bca('0x15d')],{'through':_0x7bca('0x184'),'as':_0x7bca('0x15e')});db['ChatInteraction'][_0x7bca('0x111')](db[_0x7bca('0x14')],{'as':_0x7bca('0x16f'),'through':_0x7bca('0x11a'),'foreignKey':_0x7bca('0x183')});db[_0x7bca('0x60')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'onDelete':_0x7bca('0x100'),'as':_0x7bca('0x14')});db['ChatMessage'][_0x7bca('0x13d')](db[_0x7bca('0x114')],{'onDelete':'cascade','as':_0x7bca('0x14b'),'foreignKey':_0x7bca('0x14c')});db['ChatMessage']['belongsTo'](db['ChatInteraction'],{'onDelete':_0x7bca('0x100'),'as':_0x7bca('0x162'),'foreignKey':_0x7bca('0x183')});db['ChatMessage'][_0x7bca('0x13d')](db[_0x7bca('0x160')],{'as':_0x7bca('0x160'),'foreignKey':'AttachmentId'});db[_0x7bca('0x60')][_0x7bca('0x13d')](db[_0x7bca('0x163')],{'as':'Account','foreignKey':_0x7bca('0x164')});db[_0x7bca('0x61')][_0x7bca('0x103')](db[_0x7bca('0x160')],{'as':_0x7bca('0x161'),'foreignKey':'ChatOfflineMessageId','onDelete':'cascade','hooks':!![]});db[_0x7bca('0x61')][_0x7bca('0x13d')](db[_0x7bca('0x114')],{'onDelete':_0x7bca('0x100'),'as':_0x7bca('0x14b'),'foreignKey':_0x7bca('0x14c')});db[_0x7bca('0x61')][_0x7bca('0x13d')](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db['ChatQueue'][_0x7bca('0x111')](db[_0x7bca('0x14')],{'as':_0x7bca('0x141'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue']['belongsToMany'](db['Team'],{'through':_0x7bca('0x185'),'as':'Teams'});db[_0x7bca('0x65')][_0x7bca('0x103')](db[_0x7bca('0xc9')],{'as':_0x7bca('0x145'),'foreignKey':'ChatGroupId','onDelete':_0x7bca('0x100')});db[_0x7bca('0x65')]['belongsToMany'](db[_0x7bca('0x14')],{'as':_0x7bca('0x135'),'through':_0x7bca('0x113')});db[_0x7bca('0x66')][_0x7bca('0x13d')](db[_0x7bca('0x163')],{'as':_0x7bca('0x182'),'foreignKey':_0x7bca('0x164')});db[_0x7bca('0x68')][_0x7bca('0x103')](db[_0x7bca('0x114')],{'as':'Contacts','foreignKey':_0x7bca('0x186')});db[_0x7bca('0x114')]['hasMany'](db['CmContactHasItem'],{'as':_0x7bca('0x187'),'foreignKey':_0x7bca('0x188')});db[_0x7bca('0x114')]['hasMany'](db['CmHopper'],{'as':_0x7bca('0x189'),'foreignKey':_0x7bca('0x14c')});db[_0x7bca('0x114')][_0x7bca('0x103')](db[_0x7bca('0x6e')],{'as':_0x7bca('0x107'),'foreignKey':_0x7bca('0x14c')});db['CmContact'][_0x7bca('0x103')](db[_0x7bca('0x70')],{'as':_0x7bca('0x136'),'foreignKey':_0x7bca('0x14c')});db['CmContact']['hasMany'](db[_0x7bca('0x108')],{'as':_0x7bca('0x108'),'foreignKey':_0x7bca('0x14c')});db[_0x7bca('0x114')][_0x7bca('0x103')](db[_0x7bca('0xcf')],{'as':_0x7bca('0x138'),'foreignKey':_0x7bca('0x14c')});db[_0x7bca('0x114')][_0x7bca('0x103')](db[_0x7bca('0x109')],{'as':_0x7bca('0x10a'),'foreignKey':_0x7bca('0x14c'),'onDelete':'restrict'});db[_0x7bca('0x114')]['hasMany'](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0x7bca('0x14c'),'onDelete':'restrict'});db[_0x7bca('0x114')][_0x7bca('0x103')](db[_0x7bca('0x4f')],{'as':_0x7bca('0x10c'),'foreignKey':_0x7bca('0x14c'),'onDelete':_0x7bca('0x166')});db[_0x7bca('0x114')][_0x7bca('0x103')](db[_0x7bca('0x46')],{'as':_0x7bca('0x18a'),'foreignKey':_0x7bca('0x14c'),'onDelete':_0x7bca('0x166')});db['CmContact'][_0x7bca('0x103')](db['MailInteraction'],{'as':_0x7bca('0x10d'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x7bca('0x114')][_0x7bca('0x13d')](db[_0x7bca('0x68')],{'as':_0x7bca('0x18b'),'foreignKey':_0x7bca('0x186')});db['CmContact'][_0x7bca('0x13d')](db['CmList'],{'as':_0x7bca('0x169'),'foreignKey':'ListId','onDelete':_0x7bca('0x100')});db[_0x7bca('0x114')][_0x7bca('0x111')](db[_0x7bca('0x14')],{'as':_0x7bca('0x16f'),'through':_0x7bca('0x116')});db['CmContact']['belongsToMany'](db['Tag'],{'as':_0x7bca('0x15c'),'through':_0x7bca('0x18c')});db['CmContact']['belongsToMany'](db[_0x7bca('0x15d')],{'through':'cm_contact_has_tags','as':_0x7bca('0x15e')});db[_0x7bca('0x6a')]['hasMany'](db[_0x7bca('0x18d')],{'as':_0x7bca('0x18e'),'foreignKey':'CmHopperId'});db['CmHopper'][_0x7bca('0x13d')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x7bca('0x100')});db[_0x7bca('0x6a')][_0x7bca('0x13d')](db[_0x7bca('0xe9')],{'as':'List','foreignKey':'ListId','onDelete':_0x7bca('0x100')});db[_0x7bca('0x6a')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'as':_0x7bca('0x180'),'foreignKey':_0x7bca('0x101')});db[_0x7bca('0x6a')][_0x7bca('0x13d')](db['VoiceQueue'],{'as':_0x7bca('0x181'),'foreignKey':_0x7bca('0x137'),'onDelete':_0x7bca('0x100')});db[_0x7bca('0x6a')]['belongsTo'](db[_0x7bca('0x18f')],{'as':_0x7bca('0x18f'),'foreignKey':_0x7bca('0x190'),'onDelete':_0x7bca('0x100')});db[_0x7bca('0x6a')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'as':_0x7bca('0x15a'),'foreignKey':_0x7bca('0x191')});db[_0x7bca('0x6c')][_0x7bca('0x13d')](db['CmContact'],{'as':_0x7bca('0x14b'),'foreignKey':_0x7bca('0x14c'),'onDelete':_0x7bca('0x100')});db['CmHopperBlack'][_0x7bca('0x13d')](db[_0x7bca('0xe9')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db[_0x7bca('0x6c')]['belongsTo'](db['VoiceQueue'],{'as':_0x7bca('0x181'),'foreignKey':'VoiceQueueId','onDelete':_0x7bca('0x100')});db[_0x7bca('0x6c')][_0x7bca('0x13d')](db[_0x7bca('0x18f')],{'as':_0x7bca('0x18f'),'foreignKey':_0x7bca('0x190'),'onDelete':'cascade'});db['Automation'][_0x7bca('0x103')](db['Condition'],{'as':{'plural':_0x7bca('0x192'),'singular':_0x7bca('0x193')},'foreignKey':_0x7bca('0x194'),'onDelete':'cascade','hooks':!![]});db[_0x7bca('0x195')]['hasMany'](db[_0x7bca('0x7a')],{'as':{'plural':_0x7bca('0x196'),'singular':_0x7bca('0x197')},'foreignKey':_0x7bca('0x198'),'onDelete':_0x7bca('0x100'),'hooks':!![]});db['Automation']['hasMany'](db[_0x7bca('0x74')],{'as':_0x7bca('0x199'),'foreignKey':_0x7bca('0x19a'),'onDelete':_0x7bca('0x100'),'hooks':!![]});db[_0x7bca('0x150')][_0x7bca('0x103')](db[_0x7bca('0x150')],{'as':'Dispositions','foreignKey':_0x7bca('0x19b'),'onDelete':_0x7bca('0x100')});db[_0x7bca('0x7c')][_0x7bca('0x103')](db[_0x7bca('0x7c')],{'as':_0x7bca('0x19c'),'foreignKey':_0x7bca('0x13e'),'onDelete':_0x7bca('0x100'),'hooks':!![],'required':![]});db[_0x7bca('0x7c')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0x7bca('0x13e'),'onDelete':_0x7bca('0x166')});db[_0x7bca('0x7c')]['hasMany'](db['MailApplication'],{'as':_0x7bca('0x19d'),'foreignKey':_0x7bca('0x13e')});db['Interval'][_0x7bca('0x103')](db['ChatApplication'],{'as':_0x7bca('0x19e'),'foreignKey':'IntervalId'});db['Interval']['hasMany'](db[_0x7bca('0x44')],{'as':_0x7bca('0x19f'),'foreignKey':_0x7bca('0x13e')});db[_0x7bca('0x7c')][_0x7bca('0x103')](db[_0x7bca('0x174')],{'as':_0x7bca('0x1a0'),'foreignKey':'IntervalId'});db[_0x7bca('0x83')]['belongsTo'](db['MailAccount'],{});db[_0x7bca('0x83')]['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':_0x7bca('0x1a1')});db[_0x7bca('0x83')][_0x7bca('0x13d')](db[_0x7bca('0x92')],{'foreignKey':_0x7bca('0x1a2')});db[_0x7bca('0x85')][_0x7bca('0x111')](db[_0x7bca('0x1a')],{'as':_0x7bca('0x1a3'),'through':'moh_has_sounds','onDelete':_0x7bca('0x166')});db['Tag']['belongsToMany'](db[_0x7bca('0x114')],{'through':_0x7bca('0x18c')});db[_0x7bca('0x15d')]['belongsToMany'](db['ChatInteraction'],{'through':_0x7bca('0x184')});db[_0x7bca('0x15d')][_0x7bca('0x111')](db[_0x7bca('0x3d')],{'through':_0x7bca('0x15b')});db[_0x7bca('0x15d')][_0x7bca('0x111')](db[_0x7bca('0x4f')],{'through':'sms_interaction_has_tags'});db['Tag'][_0x7bca('0x111')](db[_0x7bca('0x46')],{'through':_0x7bca('0x16e')});db['Tag']['belongsToMany'](db[_0x7bca('0x109')],{'through':_0x7bca('0x17c')});db['Tag'][_0x7bca('0x111')](db[_0x7bca('0xf5')],{'through':_0x7bca('0x1a4')});db[_0x7bca('0x87')]['belongsTo'](db['ContactItemType'],{'as':'ItemType','foreignKey':'ItemTypeId'});db[_0x7bca('0x18d')][_0x7bca('0x13d')](db[_0x7bca('0x6a')],{'as':_0x7bca('0x1a5'),'foreignKey':'CmHopperId'});db[_0x7bca('0x8a')][_0x7bca('0x103')](db[_0x7bca('0x7a')],{'as':{'plural':_0x7bca('0x1a6'),'singular':_0x7bca('0x1a7')},'foreignKey':_0x7bca('0x1a8'),'onDelete':'cascade','hooks':!![]});db[_0x7bca('0x8a')][_0x7bca('0x103')](db['Condition'],{'as':{'plural':_0x7bca('0x1a9'),'singular':'AnyCondition'},'foreignKey':'TriggerAnyId','onDelete':_0x7bca('0x100'),'hooks':!![]});db[_0x7bca('0x8a')][_0x7bca('0x103')](db[_0x7bca('0x74')],{'as':'Actions','foreignKey':_0x7bca('0x1aa'),'onDelete':_0x7bca('0x100'),'hooks':!![]});db['AnalyticCustomReport'][_0x7bca('0x103')](db[_0x7bca('0x97')],{'as':_0x7bca('0x1ab'),'onDelete':'cascade','foreignKey':_0x7bca('0x1a2'),'hooks':!![]});db[_0x7bca('0x1ac')][_0x7bca('0x103')](db[_0x7bca('0x97')],{'as':_0x7bca('0x1ab'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x7bca('0x95')][_0x7bca('0x103')](db[_0x7bca('0x97')],{'as':_0x7bca('0x1ab'),'onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x1ad')});db[_0x7bca('0x97')][_0x7bca('0x13d')](db[_0x7bca('0x95')],{'foreignKey':_0x7bca('0x1ad')});db['SalesforceAccount'][_0x7bca('0x103')](db[_0x7bca('0x9d')],{'as':_0x7bca('0x1ae'),'onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x1af')});db[_0x7bca('0x9d')]['hasMany'](db[_0x7bca('0x9f')],{'as':'Subjects','onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x1b0')});db['SalesforceConfiguration']['hasMany'](db[_0x7bca('0x9f')],{'as':_0x7bca('0x1b1'),'onDelete':_0x7bca('0x100'),'foreignKey':'DescriptionId'});db['SalesforceConfiguration']['hasMany'](db['SalesforceField'],{'as':_0x7bca('0x1ab'),'onDelete':_0x7bca('0x100'),'foreignKey':'FieldId'});db['SalesforceConfiguration'][_0x7bca('0x13d')](db[_0x7bca('0x9b')],{'as':'Account','foreignKey':_0x7bca('0x1af')});db[_0x7bca('0x9f')][_0x7bca('0x103')](db[_0x7bca('0x9f')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x7bca('0x9f')][_0x7bca('0x103')](db[_0x7bca('0x9f')],{'as':_0x7bca('0x1b2'),'foreignKey':_0x7bca('0x1b3')});db[_0x7bca('0x9f')][_0x7bca('0x103')](db[_0x7bca('0x9f')],{'as':_0x7bca('0x1b4'),'foreignKey':_0x7bca('0x1b5')});db[_0x7bca('0x9f')]['belongsTo'](db[_0x7bca('0x8c')],{'as':'Variable','foreignKey':_0x7bca('0x1b6')});db['SugarcrmAccount'][_0x7bca('0x103')](db[_0x7bca('0xa3')],{'as':_0x7bca('0x1ae'),'onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x1af')});db[_0x7bca('0xa3')][_0x7bca('0x103')](db[_0x7bca('0xa5')],{'as':_0x7bca('0x1b7'),'onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x1b0')});db[_0x7bca('0xa3')][_0x7bca('0x103')](db[_0x7bca('0xa5')],{'as':_0x7bca('0x1b1'),'onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x1b3')});db[_0x7bca('0xa3')]['hasMany'](db[_0x7bca('0xa5')],{'as':'Fields','onDelete':_0x7bca('0x100'),'foreignKey':'FieldId'});db[_0x7bca('0xa3')][_0x7bca('0x13d')](db[_0x7bca('0xa1')],{'as':_0x7bca('0x159'),'foreignKey':_0x7bca('0x1af')});db[_0x7bca('0xa5')][_0x7bca('0x103')](db[_0x7bca('0xa5')],{'as':_0x7bca('0x1b8'),'foreignKey':'SubjectId'});db['SugarcrmField'][_0x7bca('0x103')](db['SugarcrmField'],{'as':_0x7bca('0x1b2'),'foreignKey':_0x7bca('0x1b3')});db[_0x7bca('0xa5')][_0x7bca('0x103')](db[_0x7bca('0xa5')],{'as':_0x7bca('0x1b4'),'foreignKey':_0x7bca('0x1b5')});db[_0x7bca('0xa5')][_0x7bca('0x13d')](db[_0x7bca('0x8c')],{'as':_0x7bca('0x8c'),'foreignKey':'VariableId'});db[_0x7bca('0xa7')][_0x7bca('0x103')](db[_0x7bca('0xa8')],{'as':_0x7bca('0x1ae'),'onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x1af')});db['DeskConfiguration'][_0x7bca('0x103')](db['DeskField'],{'as':'Subjects','onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x1b0')});db[_0x7bca('0xa8')]['hasMany'](db[_0x7bca('0xaa')],{'as':'Descriptions','onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x1b3')});db[_0x7bca('0xa8')]['hasMany'](db[_0x7bca('0xaa')],{'as':_0x7bca('0x1ab'),'onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x1b5')});db['DeskConfiguration'][_0x7bca('0x13d')](db[_0x7bca('0xa7')],{'as':_0x7bca('0x159'),'foreignKey':_0x7bca('0x1af')});db[_0x7bca('0xa8')][_0x7bca('0x111')](db['Tag'],{'through':_0x7bca('0x1b9')});db[_0x7bca('0xaa')][_0x7bca('0x103')](db[_0x7bca('0xaa')],{'as':_0x7bca('0x1b8'),'foreignKey':_0x7bca('0x1b0')});db[_0x7bca('0xaa')]['hasMany'](db['DeskField'],{'as':_0x7bca('0x1b2'),'foreignKey':_0x7bca('0x1b3')});db[_0x7bca('0xaa')]['hasMany'](db[_0x7bca('0xaa')],{'as':_0x7bca('0x1b4'),'foreignKey':_0x7bca('0x1b5')});db[_0x7bca('0xaa')][_0x7bca('0x13d')](db[_0x7bca('0x8c')],{'as':'Variable','foreignKey':_0x7bca('0x1b6')});db[_0x7bca('0xac')][_0x7bca('0x103')](db[_0x7bca('0xad')],{'as':'Configurations','onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x1af')});db[_0x7bca('0xad')][_0x7bca('0x103')](db[_0x7bca('0xaf')],{'as':_0x7bca('0x1b7'),'onDelete':'cascade','foreignKey':_0x7bca('0x1b0')});db[_0x7bca('0xad')][_0x7bca('0x103')](db[_0x7bca('0xaf')],{'as':_0x7bca('0x1b1'),'onDelete':'cascade','foreignKey':_0x7bca('0x1b3')});db['ZohoConfiguration'][_0x7bca('0x103')](db[_0x7bca('0xaf')],{'as':_0x7bca('0x1ab'),'onDelete':_0x7bca('0x100'),'foreignKey':'FieldId'});db[_0x7bca('0xad')][_0x7bca('0x13d')](db[_0x7bca('0xac')],{'as':'Account','foreignKey':_0x7bca('0x1af')});db[_0x7bca('0xaf')][_0x7bca('0x103')](db[_0x7bca('0xaf')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x7bca('0xaf')][_0x7bca('0x103')](db['ZohoField'],{'as':_0x7bca('0x1b2'),'foreignKey':_0x7bca('0x1b3')});db[_0x7bca('0xaf')]['hasMany'](db['ZohoField'],{'as':_0x7bca('0x1b4'),'foreignKey':_0x7bca('0x1b5')});db[_0x7bca('0xaf')][_0x7bca('0x13d')](db[_0x7bca('0x8c')],{'as':_0x7bca('0x8c'),'foreignKey':'VariableId'});db['ZendeskAccount'][_0x7bca('0x103')](db['ZendeskConfiguration'],{'as':_0x7bca('0x1ae'),'onDelete':_0x7bca('0x100'),'foreignKey':'AccountId'});db[_0x7bca('0xb1')]['hasMany'](db[_0x7bca('0xb3')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x7bca('0xb1')][_0x7bca('0x103')](db[_0x7bca('0xb3')],{'as':_0x7bca('0x1b1'),'foreignKey':_0x7bca('0x1b3')});db[_0x7bca('0xb1')]['hasMany'](db[_0x7bca('0xb3')],{'as':_0x7bca('0x1ab'),'foreignKey':_0x7bca('0x1b5')});db[_0x7bca('0xb1')][_0x7bca('0x13d')](db[_0x7bca('0x1ba')],{'as':_0x7bca('0x159'),'foreignKey':_0x7bca('0x1af')});db[_0x7bca('0xb1')][_0x7bca('0x111')](db[_0x7bca('0x15d')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x7bca('0x103')](db[_0x7bca('0xb3')],{'as':_0x7bca('0x1b8'),'foreignKey':_0x7bca('0x1b0')});db[_0x7bca('0xb3')][_0x7bca('0x103')](db['ZendeskField'],{'as':_0x7bca('0x1b2'),'foreignKey':_0x7bca('0x1b3')});db[_0x7bca('0xb3')]['hasMany'](db[_0x7bca('0xb3')],{'as':_0x7bca('0x1b4'),'foreignKey':_0x7bca('0x1b5')});db[_0x7bca('0xb3')][_0x7bca('0x13d')](db[_0x7bca('0x8c')],{'as':_0x7bca('0x8c'),'foreignKey':'VariableId'});db[_0x7bca('0xb4')][_0x7bca('0x103')](db['FreshdeskConfiguration'],{'as':_0x7bca('0x1ae'),'onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x1af')});db[_0x7bca('0xb5')][_0x7bca('0x103')](db[_0x7bca('0xb7')],{'as':_0x7bca('0x1b7'),'onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x1b0')});db[_0x7bca('0xb5')][_0x7bca('0x103')](db['FreshdeskField'],{'as':_0x7bca('0x1b1'),'onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x1b3')});db[_0x7bca('0xb5')][_0x7bca('0x103')](db[_0x7bca('0xb7')],{'as':'Fields','onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x1b5')});db[_0x7bca('0xb5')][_0x7bca('0x13d')](db[_0x7bca('0xb4')],{'as':_0x7bca('0x159'),'foreignKey':'AccountId'});db[_0x7bca('0xb5')][_0x7bca('0x111')](db[_0x7bca('0x15d')],{'through':_0x7bca('0x1bb')});db[_0x7bca('0xb7')]['hasMany'](db[_0x7bca('0xb7')],{'as':_0x7bca('0x1b8'),'foreignKey':_0x7bca('0x1b0')});db['FreshdeskField'][_0x7bca('0x103')](db[_0x7bca('0xb7')],{'as':_0x7bca('0x1b2'),'foreignKey':_0x7bca('0x1b3')});db[_0x7bca('0xb7')][_0x7bca('0x103')](db[_0x7bca('0xb7')],{'as':_0x7bca('0x1b4'),'foreignKey':_0x7bca('0x1b5')});db[_0x7bca('0xb7')][_0x7bca('0x13d')](db[_0x7bca('0x8c')],{'as':'Variable','foreignKey':_0x7bca('0x1b6')});db['VtigerAccount'][_0x7bca('0x103')](db['VtigerConfiguration'],{'as':_0x7bca('0x1ae'),'onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x1af')});db[_0x7bca('0xba')]['hasMany'](db[_0x7bca('0x1bc')],{'as':'Subjects','foreignKey':_0x7bca('0x1b0')});db[_0x7bca('0xba')]['hasMany'](db[_0x7bca('0x1bc')],{'as':_0x7bca('0x1b1'),'foreignKey':_0x7bca('0x1b3')});db[_0x7bca('0xba')][_0x7bca('0x103')](db['VtigerField'],{'as':_0x7bca('0x1ab'),'foreignKey':_0x7bca('0x1b5')});db[_0x7bca('0xba')][_0x7bca('0x13d')](db[_0x7bca('0x1bd')],{'as':_0x7bca('0x159'),'foreignKey':_0x7bca('0x1af')});db[_0x7bca('0x1bc')]['hasMany'](db[_0x7bca('0x1bc')],{'as':'Subject','foreignKey':_0x7bca('0x1b0')});db[_0x7bca('0x1bc')]['hasMany'](db[_0x7bca('0x1bc')],{'as':_0x7bca('0x1b2'),'foreignKey':'DescriptionId'});db['VtigerField']['hasMany'](db['VtigerField'],{'as':'Field','foreignKey':_0x7bca('0x1b5')});db['VtigerField'][_0x7bca('0x13d')](db[_0x7bca('0x8c')],{'as':_0x7bca('0x8c'),'foreignKey':_0x7bca('0x1b6')});db[_0x7bca('0xbd')][_0x7bca('0x103')](db[_0x7bca('0x1be')],{'as':_0x7bca('0x1ae'),'onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x1af')});db[_0x7bca('0x1be')][_0x7bca('0x103')](db[_0x7bca('0xbf')],{'as':_0x7bca('0x1b7'),'foreignKey':_0x7bca('0x1b0')});db[_0x7bca('0x1be')][_0x7bca('0x103')](db['ServicenowField'],{'as':_0x7bca('0x1b1'),'foreignKey':_0x7bca('0x1b3')});db[_0x7bca('0x1be')][_0x7bca('0x103')](db['ServicenowField'],{'as':_0x7bca('0x1ab'),'foreignKey':'FieldId'});db['ServicenowConfiguration']['belongsTo'](db['ServicenowAccount'],{'as':_0x7bca('0x159'),'foreignKey':'AccountId'});db[_0x7bca('0xbf')]['hasMany'](db[_0x7bca('0xbf')],{'as':_0x7bca('0x1b8'),'foreignKey':_0x7bca('0x1b0')});db[_0x7bca('0xbf')]['hasMany'](db[_0x7bca('0xbf')],{'as':'Description','foreignKey':'DescriptionId'});db['ServicenowField'][_0x7bca('0x103')](db['ServicenowField'],{'as':_0x7bca('0x1b4'),'foreignKey':'FieldId'});db['ServicenowField']['belongsTo'](db[_0x7bca('0x8c')],{'as':'Variable','foreignKey':_0x7bca('0x1b6')});db[_0x7bca('0x1bf')][_0x7bca('0x103')](db['Dynamics365Configuration'],{'as':_0x7bca('0x1ae'),'onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x1af')});db['Dynamics365Configuration'][_0x7bca('0x103')](db[_0x7bca('0xc2')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x7bca('0x1b0')});db[_0x7bca('0x1c0')][_0x7bca('0x103')](db[_0x7bca('0xc2')],{'as':_0x7bca('0x1b1'),'onDelete':'cascade','foreignKey':_0x7bca('0x1b3')});db['Dynamics365Configuration']['hasMany'](db[_0x7bca('0xc2')],{'as':_0x7bca('0x1ab'),'onDelete':'cascade','foreignKey':_0x7bca('0x1b5')});db[_0x7bca('0x1c0')]['belongsTo'](db[_0x7bca('0x1bf')],{'as':_0x7bca('0x159'),'foreignKey':'AccountId'});db[_0x7bca('0xc2')][_0x7bca('0x103')](db[_0x7bca('0xc2')],{'as':_0x7bca('0x1b8'),'foreignKey':_0x7bca('0x1b0')});db[_0x7bca('0xc2')][_0x7bca('0x103')](db[_0x7bca('0xc2')],{'as':_0x7bca('0x1b2'),'foreignKey':_0x7bca('0x1b3')});db[_0x7bca('0xc2')][_0x7bca('0x103')](db['Dynamics365Field'],{'as':'Field','foreignKey':'FieldId'});db[_0x7bca('0xc2')]['belongsTo'](db[_0x7bca('0x8c')],{'as':_0x7bca('0x8c'),'foreignKey':'VariableId'});db['FreshsalesAccount']['hasMany'](db[_0x7bca('0xc4')],{'as':'Configurations','onDelete':_0x7bca('0x100'),'foreignKey':'AccountId'});db[_0x7bca('0xc4')][_0x7bca('0x103')](db[_0x7bca('0xc6')],{'as':'Subjects','foreignKey':_0x7bca('0x1b0')});db[_0x7bca('0xc4')][_0x7bca('0x103')](db[_0x7bca('0xc6')],{'as':'Descriptions','foreignKey':_0x7bca('0x1b3')});db[_0x7bca('0xc4')][_0x7bca('0x103')](db[_0x7bca('0xc6')],{'as':'Fields','foreignKey':_0x7bca('0x1b5')});db[_0x7bca('0xc4')][_0x7bca('0x13d')](db[_0x7bca('0xc3')],{'as':_0x7bca('0x159'),'foreignKey':_0x7bca('0x1af')});db[_0x7bca('0xc6')]['hasMany'](db['FreshsalesField'],{'as':_0x7bca('0x1b8'),'foreignKey':'SubjectId'});db[_0x7bca('0xc6')][_0x7bca('0x103')](db[_0x7bca('0xc6')],{'as':_0x7bca('0x1b2'),'foreignKey':'DescriptionId'});db[_0x7bca('0xc6')][_0x7bca('0x103')](db[_0x7bca('0xc6')],{'as':_0x7bca('0x1b4'),'foreignKey':_0x7bca('0x1b5')});db[_0x7bca('0xc6')][_0x7bca('0x13d')](db[_0x7bca('0x8c')],{'as':'Variable','foreignKey':'VariableId'});db[_0x7bca('0x1c1')][_0x7bca('0x13d')](db[_0x7bca('0x163')],{});db[_0x7bca('0x1c1')][_0x7bca('0x13d')](db[_0x7bca('0xe9')],{'as':'List','foreignKey':'ListId'});db[_0x7bca('0x1c1')][_0x7bca('0x13d')](db[_0x7bca('0x114')],{'as':'Contact','foreignKey':'ContactId'});db[_0x7bca('0x1c1')][_0x7bca('0x13d')](db[_0x7bca('0x5f')],{});db[_0x7bca('0x1c1')][_0x7bca('0x13d')](db[_0x7bca('0x60')],{});db[_0x7bca('0x1c1')]['belongsTo'](db[_0x7bca('0x14')],{});db['ChatQueueReport'][_0x7bca('0x13d')](db['ChatQueue'],{});db[_0x7bca('0xc9')]['belongsTo'](db[_0x7bca('0x14')],{'onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x1c2')});db['ChatInternalMessage'][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x1c3')});db[_0x7bca('0xcf')]['hasMany'](db[_0x7bca('0xcd')],{'foreignKey':_0x7bca('0x1c4'),'onDelete':_0x7bca('0x100')});db[_0x7bca('0xcf')][_0x7bca('0x103')](db[_0x7bca('0xcb')],{'foreignKey':_0x7bca('0x1c4'),'onDelete':_0x7bca('0x100')});db[_0x7bca('0x1c5')][_0x7bca('0x13d')](db[_0x7bca('0x4d')],{});db[_0x7bca('0x1c5')]['belongsTo'](db[_0x7bca('0xe9')],{'as':_0x7bca('0x169'),'foreignKey':_0x7bca('0x16a')});db[_0x7bca('0x1c5')][_0x7bca('0x13d')](db[_0x7bca('0x114')],{'as':_0x7bca('0x14b'),'foreignKey':'ContactId'});db[_0x7bca('0x1c5')]['belongsTo'](db[_0x7bca('0x4f')],{});db[_0x7bca('0x1c5')][_0x7bca('0x13d')](db[_0x7bca('0x173')],{});db[_0x7bca('0x1c5')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{});db[_0x7bca('0x1c5')][_0x7bca('0x13d')](db['SmsQueue'],{});db[_0x7bca('0x1c6')]['hasMany'](db[_0x7bca('0xcf')],{'foreignKey':'ProjectId'});db[_0x7bca('0x1c6')][_0x7bca('0x103')](db[_0x7bca('0xcd')],{'foreignKey':_0x7bca('0x1c7')});db['JscriptyProject'][_0x7bca('0x103')](db[_0x7bca('0xcb')],{'foreignKey':'ProjectId'});db[_0x7bca('0xd7')][_0x7bca('0x111')](db[_0x7bca('0x14')],{'as':_0x7bca('0x16f'),'through':_0x7bca('0x1c8')});db[_0x7bca('0xdc')]['belongsToMany'](db[_0x7bca('0x14')],{'as':_0x7bca('0x141'),'through':'user_has_teams'});db[_0x7bca('0xdc')][_0x7bca('0x111')](db['VoiceQueue'],{'through':_0x7bca('0xfd'),'as':_0x7bca('0x11e')});db[_0x7bca('0xdc')][_0x7bca('0x111')](db[_0x7bca('0x3a')],{'through':_0x7bca('0x157'),'as':_0x7bca('0x1c9')});db[_0x7bca('0xdc')][_0x7bca('0x111')](db[_0x7bca('0x63')],{'through':_0x7bca('0x185'),'as':_0x7bca('0x11f')});db[_0x7bca('0xdc')]['belongsToMany'](db[_0x7bca('0x49')],{'through':_0x7bca('0x171'),'as':_0x7bca('0x121')});db[_0x7bca('0xdc')][_0x7bca('0x111')](db['SmsQueue'],{'through':_0x7bca('0x179'),'as':_0x7bca('0x1ca')});db[_0x7bca('0xdc')]['belongsToMany'](db[_0x7bca('0x59')],{'through':_0x7bca('0x17e'),'as':_0x7bca('0x123')});db[_0x7bca('0xdc')][_0x7bca('0x111')](db['WhatsappQueue'],{'through':_0x7bca('0x1cb'),'as':_0x7bca('0x124')});db[_0x7bca('0x18f')][_0x7bca('0x103')](db[_0x7bca('0x6a')],{'as':_0x7bca('0x189'),'foreignKey':'CampaignId'});db[_0x7bca('0x18f')]['hasMany'](db[_0x7bca('0x6e')],{'as':_0x7bca('0x107'),'foreignKey':_0x7bca('0x190')});db['Campaign'][_0x7bca('0x103')](db['CmHopperHistory'],{'as':_0x7bca('0x136'),'foreignKey':_0x7bca('0x190')});db[_0x7bca('0x18f')][_0x7bca('0x103')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x7bca('0x190')});db[_0x7bca('0x18f')][_0x7bca('0x13d')](db['Trunk'],{'as':'Trunk','foreignKey':_0x7bca('0x13a')});db[_0x7bca('0x18f')][_0x7bca('0x13d')](db[_0x7bca('0x139')],{'as':_0x7bca('0x13b'),'foreignKey':_0x7bca('0x13c')});db[_0x7bca('0x18f')][_0x7bca('0x13d')](db[_0x7bca('0x7c')],{'as':_0x7bca('0x7c'),'foreignKey':_0x7bca('0x13e')});db['Campaign'][_0x7bca('0x13d')](db['SquareProject'],{'as':_0x7bca('0xd7'),'foreignKey':_0x7bca('0x1cc')});db['Campaign'][_0x7bca('0x111')](db[_0x7bca('0xe9')],{'as':'Lists','through':_0x7bca('0x1cd')});db['Campaign'][_0x7bca('0x111')](db[_0x7bca('0xe9')],{'as':_0x7bca('0x143'),'through':_0x7bca('0x1ce')});db[_0x7bca('0x160')][_0x7bca('0x13d')](db['ChatOfflineMessage'],{'as':_0x7bca('0x61'),'foreignKey':'ChatOfflineMessageId'});db[_0x7bca('0xe3')]['belongsTo'](db[_0x7bca('0x153')],{});db[_0x7bca('0xe3')][_0x7bca('0x13d')](db['MailInteraction'],{});db[_0x7bca('0xe3')]['belongsTo'](db[_0x7bca('0x39')],{'foreignKey':_0x7bca('0x1cf'),'as':_0x7bca('0x1d0')});db[_0x7bca('0xe3')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'foreignKey':_0x7bca('0x1d1'),'as':_0x7bca('0x1d2')});db['MailTransferReport'][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'foreignKey':_0x7bca('0x1d3'),'as':_0x7bca('0x1d4')});db[_0x7bca('0xe3')][_0x7bca('0x13d')](db[_0x7bca('0x3a')],{'foreignKey':_0x7bca('0x1d5'),'as':_0x7bca('0x1d6')});db[_0x7bca('0xe3')][_0x7bca('0x13d')](db[_0x7bca('0x39')],{'foreignKey':'ToMailAccountId','as':_0x7bca('0x1d7')});db[_0x7bca('0xe4')][_0x7bca('0x13d')](db[_0x7bca('0x60')],{});db['ChatTransferReport']['belongsTo'](db['ChatInteraction'],{});db[_0x7bca('0xe4')][_0x7bca('0x13d')](db[_0x7bca('0x163')],{'foreignKey':_0x7bca('0x1d8'),'as':_0x7bca('0x1d0')});db[_0x7bca('0xe4')]['belongsTo'](db[_0x7bca('0x14')],{'foreignKey':_0x7bca('0x1d1'),'as':_0x7bca('0x1d2')});db[_0x7bca('0xe4')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'foreignKey':'ToUserId','as':_0x7bca('0x1d4')});db['ChatTransferReport'][_0x7bca('0x13d')](db['ChatQueue'],{'foreignKey':_0x7bca('0x1d9'),'as':_0x7bca('0x1d6')});db[_0x7bca('0xe4')][_0x7bca('0x13d')](db[_0x7bca('0x163')],{'foreignKey':_0x7bca('0x1da'),'as':_0x7bca('0x1d7')});db[_0x7bca('0x1db')][_0x7bca('0x13d')](db[_0x7bca('0x47')],{});db['FaxTransferReport'][_0x7bca('0x13d')](db[_0x7bca('0x46')],{});db[_0x7bca('0x1db')][_0x7bca('0x13d')](db[_0x7bca('0x127')],{'foreignKey':_0x7bca('0x1dc'),'as':_0x7bca('0x1d0')});db[_0x7bca('0x1db')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'foreignKey':'FromUserId','as':_0x7bca('0x1d2')});db[_0x7bca('0x1db')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'foreignKey':_0x7bca('0x1d3'),'as':_0x7bca('0x1d4')});db['FaxTransferReport'][_0x7bca('0x13d')](db[_0x7bca('0x49')],{'foreignKey':'ToFaxQueueId','as':'ToQueue'});db[_0x7bca('0x1db')][_0x7bca('0x13d')](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':_0x7bca('0x1d7')});db[_0x7bca('0x1dd')][_0x7bca('0x13d')](db[_0x7bca('0x57')],{});db[_0x7bca('0x1dd')][_0x7bca('0x13d')](db[_0x7bca('0x109')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x7bca('0x53')],{'foreignKey':_0x7bca('0x1de'),'as':'FromAccount'});db[_0x7bca('0x1dd')][_0x7bca('0x13d')](db['User'],{'foreignKey':'FromUserId','as':_0x7bca('0x1d2')});db[_0x7bca('0x1dd')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'foreignKey':_0x7bca('0x1d3'),'as':_0x7bca('0x1d4')});db[_0x7bca('0x1dd')]['belongsTo'](db[_0x7bca('0x59')],{'foreignKey':_0x7bca('0x1df'),'as':_0x7bca('0x1d6')});db['OpenchannelTransferReport']['belongsTo'](db[_0x7bca('0x53')],{'foreignKey':_0x7bca('0x1e0'),'as':_0x7bca('0x1d7')});db[_0x7bca('0xe7')][_0x7bca('0x13d')](db['SmsMessage'],{});db['SmsTransferReport']['belongsTo'](db[_0x7bca('0x4f')],{});db['SmsTransferReport'][_0x7bca('0x13d')](db[_0x7bca('0x4d')],{'foreignKey':_0x7bca('0x1e1'),'as':_0x7bca('0x1d0')});db[_0x7bca('0xe7')][_0x7bca('0x13d')](db['User'],{'foreignKey':_0x7bca('0x1d1'),'as':'FromAgent'});db[_0x7bca('0xe7')]['belongsTo'](db[_0x7bca('0x14')],{'foreignKey':'ToUserId','as':_0x7bca('0x1d4')});db[_0x7bca('0xe7')]['belongsTo'](db[_0x7bca('0x175')],{'foreignKey':_0x7bca('0x1e2'),'as':_0x7bca('0x1d6')});db[_0x7bca('0xe7')][_0x7bca('0x13d')](db[_0x7bca('0x4d')],{'foreignKey':_0x7bca('0x1e3'),'as':_0x7bca('0x1d7')});db['CmList']['hasMany'](db['Disposition'],{'as':_0x7bca('0x151'),'foreignKey':_0x7bca('0x16a')});db[_0x7bca('0xe9')][_0x7bca('0x103')](db[_0x7bca('0x73')],{'as':_0x7bca('0x1e4'),'foreignKey':'ListId'});db['CmList'][_0x7bca('0x103')](db['CmContact'],{'as':'Contacts','onDelete':_0x7bca('0x100'),'foreignKey':_0x7bca('0x16a')});db['CmList'][_0x7bca('0x103')](db[_0x7bca('0x6e')],{'as':_0x7bca('0x107'),'foreignKey':_0x7bca('0x16a')});db[_0x7bca('0xe9')][_0x7bca('0x103')](db[_0x7bca('0x70')],{'as':_0x7bca('0x1e5'),'foreignKey':_0x7bca('0x16a')});db['CmList'][_0x7bca('0x103')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x7bca('0x16a')});db[_0x7bca('0xe9')][_0x7bca('0x111')](db[_0x7bca('0x1c')],{'as':_0x7bca('0x1e6'),'through':_0x7bca('0x1e7')});db[_0x7bca('0xe9')][_0x7bca('0x111')](db[_0x7bca('0x14')],{'as':_0x7bca('0x141'),'through':'cm_user_has_lists'});db[_0x7bca('0xea')][_0x7bca('0x103')](db['VoiceExtension'],{'as':_0x7bca('0x106'),'onDelete':_0x7bca('0x100')});db['VoicePrefix'][_0x7bca('0x111')](db['User'],{'as':_0x7bca('0x141'),'through':_0x7bca('0x125')});db[_0x7bca('0xec')][_0x7bca('0x103')](db[_0x7bca('0x14')],{'as':_0x7bca('0x16f'),'foreignKey':_0x7bca('0x1e8')});db[_0x7bca('0xec')][_0x7bca('0x103')](db[_0x7bca('0xed')],{'as':'UserProfileSections','foreignKey':_0x7bca('0x1e8'),'onDelete':_0x7bca('0x100')});db[_0x7bca('0xed')][_0x7bca('0x103')](db['UserProfileResource'],{'as':_0x7bca('0x1e9'),'foreignKey':_0x7bca('0x1ea'),'onDelete':_0x7bca('0x100')});db[_0x7bca('0x1eb')][_0x7bca('0x103')](db[_0x7bca('0x150')],{'as':_0x7bca('0x151'),'foreignKey':_0x7bca('0x1ec')});db['WhatsappAccount'][_0x7bca('0x103')](db[_0x7bca('0x77')],{'as':'Answers','foreignKey':_0x7bca('0x1ec')});db['WhatsappAccount'][_0x7bca('0x103')](db[_0x7bca('0xf7')],{'as':'Messages','foreignKey':_0x7bca('0x1ec')});db[_0x7bca('0x1eb')][_0x7bca('0x103')](db[_0x7bca('0xf5')],{'as':_0x7bca('0x154')});db[_0x7bca('0x1eb')][_0x7bca('0x103')](db[_0x7bca('0xf4')],{'as':_0x7bca('0x133')});db[_0x7bca('0x1eb')][_0x7bca('0x13d')](db[_0x7bca('0xe9')],{'as':'List','foreignKey':'ListId'});db[_0x7bca('0x1eb')][_0x7bca('0x13d')](db['Pause'],{'as':_0x7bca('0x13f'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount']['belongsToMany'](db[_0x7bca('0x14')],{'as':'Agents','through':_0x7bca('0x1ed')});db[_0x7bca('0xf4')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'onDelete':_0x7bca('0x166')});db[_0x7bca('0xf4')]['belongsTo'](db[_0x7bca('0xfb')],{'onDelete':_0x7bca('0x166')});db[_0x7bca('0xf4')][_0x7bca('0x13d')](db['WhatsappAccount'],{'onDelete':_0x7bca('0x166')});db[_0x7bca('0xf4')][_0x7bca('0x13d')](db[_0x7bca('0x7c')],{'onDelete':_0x7bca('0x166'),'foreignKey':_0x7bca('0x13e')});db[_0x7bca('0xf4')][_0x7bca('0x13d')](db[_0x7bca('0x15d')],{'onDelete':_0x7bca('0x166'),'foreignKey':_0x7bca('0x167')});db['WhatsappInteraction']['hasMany'](db[_0x7bca('0xf7')],{'as':_0x7bca('0x145'),'onDelete':'cascade','foreignKey':_0x7bca('0x1ee')});db['WhatsappInteraction'][_0x7bca('0x13d')](db[_0x7bca('0x1eb')],{'as':'Account','foreignKey':_0x7bca('0x1ec')});db[_0x7bca('0xf5')][_0x7bca('0x13d')](db[_0x7bca('0x114')],{'as':'Contact','foreignKey':_0x7bca('0x14c')});db[_0x7bca('0xf5')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'as':_0x7bca('0x15a'),'foreignKey':_0x7bca('0x101')});db['WhatsappInteraction'][_0x7bca('0x111')](db[_0x7bca('0x15d')],{'through':_0x7bca('0x1a4'),'as':'Tags'});db['WhatsappInteraction']['belongsToMany'](db[_0x7bca('0x15d')],{'through':_0x7bca('0x1a4'),'as':'ThroughTags'});db[_0x7bca('0xf5')][_0x7bca('0x111')](db[_0x7bca('0x14')],{'as':_0x7bca('0x16f'),'through':_0x7bca('0x11d'),'foreignKey':'WhatsappInteractionId'});db[_0x7bca('0xf7')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'as':'User'});db[_0x7bca('0xf7')]['belongsTo'](db[_0x7bca('0x114')],{'onDelete':_0x7bca('0x100'),'as':_0x7bca('0x14b')});db[_0x7bca('0xf7')][_0x7bca('0x13d')](db[_0x7bca('0xf5')],{'onDelete':'cascade','as':_0x7bca('0x162'),'foreignKey':_0x7bca('0x1ee')});db['WhatsappMessage']['belongsTo'](db[_0x7bca('0x1eb')],{'as':_0x7bca('0x159'),'foreignKey':_0x7bca('0x1ec')});db[_0x7bca('0xf8')][_0x7bca('0x13d')](db[_0x7bca('0x1eb')],{});db['WhatsappQueueReport'][_0x7bca('0x13d')](db[_0x7bca('0xe9')],{'as':'List','foreignKey':_0x7bca('0x16a')});db[_0x7bca('0xf8')][_0x7bca('0x13d')](db[_0x7bca('0x114')],{'as':_0x7bca('0x14b'),'foreignKey':_0x7bca('0x14c')});db[_0x7bca('0xf8')][_0x7bca('0x13d')](db[_0x7bca('0xf5')],{});db[_0x7bca('0xf8')][_0x7bca('0x13d')](db[_0x7bca('0xfb')],{});db['WhatsappQueueReport'][_0x7bca('0x13d')](db[_0x7bca('0xf7')],{});db[_0x7bca('0xf8')][_0x7bca('0x13d')](db['User'],{});db[_0x7bca('0xfa')]['belongsTo'](db[_0x7bca('0xf7')],{});db[_0x7bca('0xfa')]['belongsTo'](db['WhatsappInteraction'],{});db[_0x7bca('0xfa')][_0x7bca('0x13d')](db['WhatsappAccount'],{'foreignKey':_0x7bca('0x1ef'),'as':'FromAccount'});db['WhatsappTransferReport'][_0x7bca('0x13d')](db[_0x7bca('0x1eb')],{'foreignKey':_0x7bca('0x1f0'),'as':_0x7bca('0x1d7')});db[_0x7bca('0xfa')][_0x7bca('0x13d')](db[_0x7bca('0xfb')],{'foreignKey':_0x7bca('0x1f1'),'as':_0x7bca('0x1d6')});db[_0x7bca('0xfa')][_0x7bca('0x13d')](db[_0x7bca('0x14')],{'foreignKey':_0x7bca('0x1d1'),'as':'FromAgent'});db[_0x7bca('0xfa')][_0x7bca('0x13d')](db['User'],{'foreignKey':_0x7bca('0x1d3'),'as':_0x7bca('0x1d4')});db[_0x7bca('0xfb')][_0x7bca('0x111')](db[_0x7bca('0x14')],{'as':_0x7bca('0x141'),'through':_0x7bca('0x35'),'foreignKey':_0x7bca('0x1f2')});db[_0x7bca('0xfb')][_0x7bca('0x111')](db['Team'],{'through':_0x7bca('0x1cb'),'as':_0x7bca('0x142')});module[_0x7bca('0x1f3')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 2ab1a67..f02b821 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x041c=['./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/apidoc','static','root','/www','/demo','/plugins','join','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','username','password','firstName','lastName','street','mobile','email','clientSecret','securityToken','code','accessKey','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridnum','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','@@{','replace','includes','lodash','path','express','express-winston','util','./errors','./config/environment','api','./config/logger','auth','default','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','headers','x-forwarded-for','remoteAddress','url','responseTime','user','name','role','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','statusCode','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','/api/chat/queues','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_history','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/sounds','./api/sound','/api/tags','/api/contact_item_types','./api/cmContactHasItem','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x041c,0xa1));var _0xc041=function(_0x59eb82,_0x1c2dca){_0x59eb82=_0x59eb82-0x0;var _0x3d6af2=_0x041c[_0x59eb82];return _0x3d6af2;};'use strict';var _=require(_0xc041('0x0'));var path=require(_0xc041('0x1'));var express=require(_0xc041('0x2'));var ewinston=require(_0xc041('0x3'));var util=require(_0xc041('0x4'));var errors=require(_0xc041('0x5'));var config=require(_0xc041('0x6'));var logger=require('./config/logger')(_0xc041('0x7'));var authLogger=require(_0xc041('0x8'))(_0xc041('0x9'));exports[_0xc041('0xa')]=function(_0x3bcc57){_0x3bcc57[_0xc041('0xb')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x4e505f,_0x1fb61e){var _0x1df497=_0xc041('0xc');if(!_['isEmpty'](_0x4e505f[_0xc041('0xd')])){_0x1df497+=_0xc041('0xe');var _0x192fca=_0x4e505f[_0xc041('0xd')];maskSensitiveData(_0x192fca);}return util[_0xc041('0xf')](_0x1df497,_0x4e505f['method'],_0x4e505f[_0xc041('0x10')][_0xc041('0x11')]?_0x4e505f[_0xc041('0x10')][_0xc041('0x11')]:_0x4e505f['connection'][_0xc041('0x12')]||_0x4e505f['ip'],_0x4e505f[_0xc041('0x13')],_0x1fb61e['statusCode'],_0x1fb61e[_0xc041('0x14')],_0x4e505f[_0xc041('0x15')]?_0x4e505f['user']['id']:null,_0x4e505f[_0xc041('0x15')]?_0x4e505f[_0xc041('0x15')][_0xc041('0x16')]:null,_0x4e505f['user']?_0x4e505f[_0xc041('0x15')][_0xc041('0x17')]:null,_0x192fca?util['inspect'](_0x192fca,![],null):'');}}));_0x3bcc57[_0xc041('0xb')](ewinston[_0xc041('0x18')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4ded63,_0x1a914d){var _0x27707e=_0xc041('0x19');if(_0x4ded63['body']&&_0x4ded63[_0xc041('0xd')][_0xc041('0x1a')]&&_0x4ded63[_0xc041('0xd')][_0xc041('0x1b')]){_0x27707e=_0xc041('0x1c');}return util['format'](_0x27707e,_0x4ded63[_0xc041('0x1d')],_0x4ded63['headers'][_0xc041('0x11')]?_0x4ded63[_0xc041('0x10')]['x-forwarded-for']:_0x4ded63['connection']['remoteAddress']||_0x4ded63['ip'],_0x4ded63['url'],_0x1a914d[_0xc041('0x1e')],_0x1a914d[_0xc041('0x14')],_0x4ded63[_0xc041('0x15')]?_0x4ded63[_0xc041('0x15')]['id']:null,_0x4ded63['user']?_0x4ded63['user'][_0xc041('0x16')]:null,_0x4ded63[_0xc041('0x15')]?_0x4ded63[_0xc041('0x15')][_0xc041('0x17')]:null,_0x4ded63[_0xc041('0xd')]&&_0x4ded63[_0xc041('0xd')][_0xc041('0x1a')]?_0x4ded63[_0xc041('0xd')][_0xc041('0x1a')]:_0xc041('0x1f'),_0x4ded63[_0xc041('0xd')]&&_0x4ded63['body'][_0xc041('0x1b')]?_0x4ded63[_0xc041('0xd')]['agent_id']:'',_0x4ded63[_0xc041('0xd')]&&_0x4ded63[_0xc041('0xd')][_0xc041('0x20')]?_0x4ded63['body'][_0xc041('0x20')]:'');},'ignoreRoute':function(_0x5ec13d){var _0x23221c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x23221c[_0xc041('0x21')](_0x5ec13d[_0xc041('0x13')]);}}));_0x3bcc57[_0xc041('0xb')](_0xc041('0x22'),require(_0xc041('0x23')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x24'),require('./api/voiceChanSpy'));_0x3bcc57['use'](_0xc041('0x25'),require(_0xc041('0x26')));_0x3bcc57[_0xc041('0xb')]('/api/voice/extensions',require(_0xc041('0x27')));_0x3bcc57['use'](_0xc041('0x28'),require(_0xc041('0x29')));_0x3bcc57['use'](_0xc041('0x2a'),require(_0xc041('0x2b')));_0x3bcc57[_0xc041('0xb')]('/api/voice/recordings',require(_0xc041('0x2c')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x2d'),require('./api/screenRecording'));_0x3bcc57['use']('/api/voice/mails',require(_0xc041('0x2e')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x2f'),require(_0xc041('0x30')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x31'),require(_0xc041('0x32')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x33'),require('./api/voiceDialReport'));_0x3bcc57[_0xc041('0xb')]('/api/voice/agents/reports',require(_0xc041('0x34')));_0x3bcc57['use'](_0xc041('0x35'),require('./api/voiceQueueReport'));_0x3bcc57[_0xc041('0xb')]('/api/members/reports',require(_0xc041('0x36')));_0x3bcc57['use'](_0xc041('0x37'),require('./api/trunk'));_0x3bcc57['use'](_0xc041('0x38'),require(_0xc041('0x39')));_0x3bcc57['use'](_0xc041('0x3a'),require('./api/mailServerOut'));_0x3bcc57[_0xc041('0xb')](_0xc041('0x3b'),require('./api/mailAccount'));_0x3bcc57[_0xc041('0xb')]('/api/mail/queues',require(_0xc041('0x3c')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x3d'),require(_0xc041('0x3e')));_0x3bcc57['use']('/api/mail/interactions',require(_0xc041('0x3f')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x40'),require(_0xc041('0x41')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x42'),require(_0xc041('0x43')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x44'),require(_0xc041('0x45')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x46'),require(_0xc041('0x47')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x48'),require(_0xc041('0x49')));_0x3bcc57['use']('/api/fax/accounts',require(_0xc041('0x4a')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x4b'),require('./api/faxApplication'));_0x3bcc57[_0xc041('0xb')](_0xc041('0x4c'),require(_0xc041('0x4d')));_0x3bcc57[_0xc041('0xb')]('/api/fax/messages',require(_0xc041('0x4e')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x4f'),require(_0xc041('0x50')));_0x3bcc57[_0xc041('0xb')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x3bcc57[_0xc041('0xb')](_0xc041('0x51'),require(_0xc041('0x52')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x53'),require(_0xc041('0x54')));_0x3bcc57['use']('/api/sms/interactions',require(_0xc041('0x55')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x56'),require(_0xc041('0x57')));_0x3bcc57['use'](_0xc041('0x58'),require(_0xc041('0x59')));_0x3bcc57['use'](_0xc041('0x5a'),require(_0xc041('0x5b')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x5c'),require(_0xc041('0x5d')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x5e'),require(_0xc041('0x5f')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x60'),require(_0xc041('0x61')));_0x3bcc57['use'](_0xc041('0x62'),require(_0xc041('0x63')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x64'),require(_0xc041('0x65')));_0x3bcc57['use'](_0xc041('0x66'),require(_0xc041('0x67')));_0x3bcc57['use'](_0xc041('0x68'),require(_0xc041('0x69')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x6a'),require('./api/chatInteraction'));_0x3bcc57[_0xc041('0xb')](_0xc041('0x6b'),require('./api/chatMessage'));_0x3bcc57[_0xc041('0xb')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x3bcc57[_0xc041('0xb')](_0xc041('0x6c'),require('./api/chatQueue'));_0x3bcc57[_0xc041('0xb')](_0xc041('0x6d'),require(_0xc041('0x6e')));_0x3bcc57[_0xc041('0xb')]('/api/chat/proactive_actions',require(_0xc041('0x6f')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x70'),require(_0xc041('0x71')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x72'),require('./api/cmContact'));_0x3bcc57['use'](_0xc041('0x73'),require(_0xc041('0x74')));_0x3bcc57[_0xc041('0xb')]('/api/cm/hopper_black',require(_0xc041('0x75')));_0x3bcc57[_0xc041('0xb')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x3bcc57[_0xc041('0xb')](_0xc041('0x76'),require('./api/cmHopperHistory'));_0x3bcc57['use']('/api/cm/custom_fields',require(_0xc041('0x77')));_0x3bcc57['use'](_0xc041('0x78'),require(_0xc041('0x79')));_0x3bcc57['use']('/api/automations',require(_0xc041('0x7a')));_0x3bcc57['use'](_0xc041('0x7b'),require('./api/cannedAnswer'));_0x3bcc57[_0xc041('0xb')](_0xc041('0x7c'),require(_0xc041('0x7d')));_0x3bcc57[_0xc041('0xb')]('/api/conditions',require(_0xc041('0x7e')));_0x3bcc57['use'](_0xc041('0x7f'),require('./api/interval'));_0x3bcc57[_0xc041('0xb')](_0xc041('0x80'),require(_0xc041('0x81')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x82'),require('./api/cdr'));_0x3bcc57[_0xc041('0xb')](_0xc041('0x83'),require(_0xc041('0x84')));_0x3bcc57[_0xc041('0xb')]('/api/schedules',require('./api/schedule'));_0x3bcc57[_0xc041('0xb')](_0xc041('0x85'),require(_0xc041('0x86')));_0x3bcc57['use'](_0xc041('0x87'),require('./api/tag'));_0x3bcc57[_0xc041('0xb')](_0xc041('0x88'),require('./api/contactItemType'));_0x3bcc57[_0xc041('0xb')]('/api/cm_contact_has_items',require(_0xc041('0x89')));_0x3bcc57[_0xc041('0xb')]('/api/cm_hopper_additional_phones',require('./api/cmHopperAdditionalPhone'));_0x3bcc57[_0xc041('0xb')](_0xc041('0x8a'),require(_0xc041('0x8b')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x8c'),require(_0xc041('0x8d')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x8e'),require(_0xc041('0x8f')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x90'),require(_0xc041('0x91')));_0x3bcc57[_0xc041('0xb')]('/api/integrations/reports',require(_0xc041('0x92')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x93'),require(_0xc041('0x94')));_0x3bcc57['use'](_0xc041('0x95'),require('./api/analyticDefaultReport'));_0x3bcc57[_0xc041('0xb')]('/api/analytics/extracted_reports',require(_0xc041('0x96')));_0x3bcc57['use'](_0xc041('0x97'),require(_0xc041('0x98')));_0x3bcc57[_0xc041('0xb')]('/api/analytics/field_reports',require(_0xc041('0x99')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x9a'),require(_0xc041('0x9b')));_0x3bcc57['use'](_0xc041('0x9c'),require('./api/intSalesforceAccount'));_0x3bcc57[_0xc041('0xb')](_0xc041('0x9d'),require(_0xc041('0x9e')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x9f'),require(_0xc041('0xa0')));_0x3bcc57['use'](_0xc041('0xa1'),require(_0xc041('0xa2')));_0x3bcc57[_0xc041('0xb')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x3bcc57[_0xc041('0xb')]('/api/integrations/sugarcrm/fields',require(_0xc041('0xa3')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xa4'),require(_0xc041('0xa5')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xa6'),require(_0xc041('0xa7')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xa8'),require('./api/intDeskField'));_0x3bcc57[_0xc041('0xb')]('/api/integrations/zoho/accounts',require(_0xc041('0xa9')));_0x3bcc57['use'](_0xc041('0xaa'),require(_0xc041('0xab')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xac'),require(_0xc041('0xad')));_0x3bcc57['use'](_0xc041('0xae'),require(_0xc041('0xaf')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xb0'),require(_0xc041('0xb1')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xb2'),require(_0xc041('0xb3')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xb4'),require(_0xc041('0xb5')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xb6'),require('./api/intFreshdeskConfiguration'));_0x3bcc57[_0xc041('0xb')](_0xc041('0xb7'),require(_0xc041('0xb8')));_0x3bcc57[_0xc041('0xb')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x3bcc57[_0xc041('0xb')](_0xc041('0xb9'),require(_0xc041('0xba')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xbb'),require('./api/intVtigerField'));_0x3bcc57[_0xc041('0xb')](_0xc041('0xbc'),require('./api/intServicenowAccount'));_0x3bcc57[_0xc041('0xb')]('/api/integrations/servicenow/configurations',require(_0xc041('0xbd')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xbe'),require(_0xc041('0xbf')));_0x3bcc57[_0xc041('0xb')]('/api/integrations/dynamics365/accounts',require(_0xc041('0xc0')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xc1'),require('./api/intDynamics365Configuration'));_0x3bcc57['use'](_0xc041('0xc2'),require('./api/intDynamics365Field'));_0x3bcc57[_0xc041('0xb')]('/api/integrations/freshsales/accounts',require(_0xc041('0xc3')));_0x3bcc57[_0xc041('0xb')]('/api/integrations/freshsales/configurations',require(_0xc041('0xc4')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xc5'),require(_0xc041('0xc6')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xc7'),require(_0xc041('0xc8')));_0x3bcc57['use'](_0xc041('0xc9'),require(_0xc041('0xca')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xcb'),require(_0xc041('0xcc')));_0x3bcc57[_0xc041('0xb')]('/api/jscripty/answers/reports',require(_0xc041('0xcd')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xce'),require(_0xc041('0xcf')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xd0'),require('./api/jscriptySessionReport'));_0x3bcc57[_0xc041('0xb')]('/api/sms/reports/queue',require(_0xc041('0xd1')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xd2'),require(_0xc041('0xd3')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xd4'),require('./api/squareReportDetail'));_0x3bcc57['use']('/api/jscripty/projects',require(_0xc041('0xd5')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xd6'),require('./api/setting'));_0x3bcc57[_0xc041('0xb')](_0xc041('0xd7'),require(_0xc041('0xd8')));_0x3bcc57[_0xc041('0xb')]('/api/square/projects',require(_0xc041('0xd9')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xda'),require(_0xc041('0xdb')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xdc'),require(_0xc041('0xdd')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xde'),require(_0xc041('0xdf')));_0x3bcc57['use'](_0xc041('0xe0'),require(_0xc041('0xe1')));_0x3bcc57[_0xc041('0xb')]('/api/campaigns',require(_0xc041('0xe2')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xe3'),require(_0xc041('0xe4')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xe5'),require(_0xc041('0xe6')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xe7'),require(_0xc041('0xe8')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xe9'),require(_0xc041('0xea')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xeb'),require(_0xc041('0xec')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xed'),require(_0xc041('0xee')));_0x3bcc57['use'](_0xc041('0xef'),require(_0xc041('0xf0')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xf1'),require('./api/smsTransferReport'));_0x3bcc57[_0xc041('0xb')](_0xc041('0xf2'),require('./api/cmList'));_0x3bcc57[_0xc041('0xb')](_0xc041('0xf3'),require('./api/voicePrefix'));_0x3bcc57[_0xc041('0xb')](_0xc041('0xf4'),require(_0xc041('0xf5')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xf6'),require(_0xc041('0xf7')));_0x3bcc57[_0xc041('0xb')]('/api/userProfile/resources',require(_0xc041('0xf8')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xf9'),require(_0xc041('0xfa')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xfb'),require(_0xc041('0xfc')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xfd'),require(_0xc041('0xfe')));_0x3bcc57[_0xc041('0xb')](_0xc041('0xff'),require(_0xc041('0x100')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x101'),require(_0xc041('0x102')));_0x3bcc57['use'](_0xc041('0x103'),require(_0xc041('0x104')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x105'),require(_0xc041('0x106')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x107'),require(_0xc041('0x108')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x109'),require('./api/cloudProvider'));_0x3bcc57['use'](_0xc041('0x10a'),require(_0xc041('0x10b')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x10c'),require(_0xc041('0x10d')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x10e'),require(_0xc041('0x10f')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x110'),require(_0xc041('0x111')));_0x3bcc57[_0xc041('0xb')]('/api/version',require(_0xc041('0x112')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x113'),require(_0xc041('0x114')));_0x3bcc57['use'](_0xc041('0x115'),require(_0xc041('0x116')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x117'),require('./api/webbar'));_0x3bcc57['use'](_0xc041('0x118'),express[_0xc041('0x119')](path['join'](config[_0xc041('0x11a')],'/apidoc')));_0x3bcc57[_0xc041('0xb')](_0xc041('0x11b'),express[_0xc041('0x119')](path['join'](config['root'],_0xc041('0x11b'))));_0x3bcc57[_0xc041('0xb')](_0xc041('0x11c'),express['static'](path['join'](config['root'],_0xc041('0x11c'))));_0x3bcc57['use']('/snippet',express[_0xc041('0x119')](path['join'](config[_0xc041('0x11a')],'snippet','3.0.0')));_0x3bcc57['use'](_0xc041('0x11d'),express[_0xc041('0x119')](path[_0xc041('0x11e')](config[_0xc041('0x11a')],_0xc041('0x11f'))));_0x3bcc57[_0xc041('0x120')](_0xc041('0x121'))[_0xc041('0x122')](errors[0x194]);_0x3bcc57[_0xc041('0x120')]('/*')[_0xc041('0x122')](function(_0x1e8fda,_0x17f737){_0x17f737[_0xc041('0x123')](path[_0xc041('0x124')](_0x3bcc57['get'](_0xc041('0x125'))+_0xc041('0x126')));});};var sensitiveFields=[_0xc041('0x127'),_0xc041('0x128'),'newPassword','apiKey',_0xc041('0x129'),_0xc041('0x12a'),_0xc041('0x12b'),'phone',_0xc041('0x12c'),'fax',_0xc041('0x12d'),'clientId',_0xc041('0x12e'),_0xc041('0x12f'),_0xc041('0x130'),_0xc041('0x131'),'tenantId','token',_0xc041('0x132'),_0xc041('0x133'),_0xc041('0x134'),_0xc041('0x135'),_0xc041('0x136'),_0xc041('0x137'),_0xc041('0x138'),'calleridname',_0xc041('0x139'),'exten',_0xc041('0x13a'),_0xc041('0x13b'),_0xc041('0x13c'),_0xc041('0x13d'),_0xc041('0x13e'),_0xc041('0x13f'),_0xc041('0x15'),_0xc041('0x140'),_0xc041('0x141'),_0xc041('0x142'),_0xc041('0x143'),_0xc041('0x144'),_0xc041('0x145'),_0xc041('0x146')];function maskSensitiveData(_0x4ca252){var _0xa07995=/(?!^)[\s\S](?!$)/g;if(!_[_0xc041('0x147')](_0x4ca252))return;for(var _0x31b7a5 in _0x4ca252){if(_[_0xc041('0x148')](_0x4ca252[_0x31b7a5])){for(var _0x54bfda=0x0;_0x54bfda<_0x4ca252[_0x31b7a5][_0xc041('0x149')];_0x54bfda++){maskSensitiveData(_0x4ca252[_0x31b7a5][_0x54bfda]);}}else if(_['isPlainObject'](_0x4ca252[_0x31b7a5])){maskSensitiveData(_0x4ca252[_0x31b7a5]);}else if(_[_0xc041('0x14a')](_0x4ca252[_0x31b7a5])){_0x4ca252[_0x31b7a5]=_0x4ca252[_0x31b7a5]['replace'](/{{{/g,_0xc041('0x14b'))[_0xc041('0x14c')](/}}}/g,'}@@')[_0xc041('0x14c')](/{{/g,'@{')[_0xc041('0x14c')](/}}/g,'}@');if(_[_0xc041('0x14d')](sensitiveFields,_0x31b7a5)){_0x4ca252[_0x31b7a5]=_0x4ca252[_0x31b7a5][_0xc041('0x14c')](_0xa07995,'*');}}}} \ No newline at end of file +var _0x2354=['agent_name','/api/users','/api/voice/chanspy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxApplication','/api/fax/messages','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/condition','/api/intervals','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integrationReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/recordings','./api/squareRecording','/api/teams','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/cm/lists','./api/cmList','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileResource','./api/whatsappAccount','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','join','root','/www','static','/demo','/snippet','3.0.0','/plugins','/server/files/plugins','get','route','sendFile','resolve','appPath','username','password','newPassword','apiKey','lastName','street','phone','mobile','fax','email','securityToken','code','accessKey','tenantId','token','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridname','exten','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','pass','localstationid','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','path','express-winston','util','./errors','./config/environment','./config/logger','auth','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','x-forwarded-for','connection','statusCode','responseTime','user','name','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','headers','remoteAddress','url'];(function(_0x4409e7,_0x307f17){var _0x24c751=function(_0x3a7d33){while(--_0x3a7d33){_0x4409e7['push'](_0x4409e7['shift']());}};_0x24c751(++_0x307f17);}(_0x2354,0x125));var _0x4235=function(_0x5868b6,_0x4c6951){_0x5868b6=_0x5868b6-0x0;var _0x27e033=_0x2354[_0x5868b6];return _0x27e033;};'use strict';var _=require('lodash');var path=require(_0x4235('0x0'));var express=require('express');var ewinston=require(_0x4235('0x1'));var util=require(_0x4235('0x2'));var errors=require(_0x4235('0x3'));var config=require(_0x4235('0x4'));var logger=require(_0x4235('0x5'))('api');var authLogger=require(_0x4235('0x5'))(_0x4235('0x6'));exports['default']=function(_0x56c2ad){_0x56c2ad[_0x4235('0x7')](ewinston[_0x4235('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x2b21bb,_0x23f622){var _0x3380e5=_0x4235('0x9');if(!_[_0x4235('0xa')](_0x2b21bb[_0x4235('0xb')])){_0x3380e5+=_0x4235('0xc');var _0x2a5ee8=_0x2b21bb[_0x4235('0xb')];maskSensitiveData(_0x2a5ee8);}return util[_0x4235('0xd')](_0x3380e5,_0x2b21bb[_0x4235('0xe')],_0x2b21bb['headers']['x-forwarded-for']?_0x2b21bb['headers'][_0x4235('0xf')]:_0x2b21bb[_0x4235('0x10')]['remoteAddress']||_0x2b21bb['ip'],_0x2b21bb['url'],_0x23f622[_0x4235('0x11')],_0x23f622[_0x4235('0x12')],_0x2b21bb[_0x4235('0x13')]?_0x2b21bb[_0x4235('0x13')]['id']:null,_0x2b21bb[_0x4235('0x13')]?_0x2b21bb[_0x4235('0x13')][_0x4235('0x14')]:null,_0x2b21bb[_0x4235('0x13')]?_0x2b21bb[_0x4235('0x13')][_0x4235('0x15')]:null,_0x2a5ee8?util[_0x4235('0x16')](_0x2a5ee8,![],null):'');}}));_0x56c2ad['use'](ewinston[_0x4235('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0xf7e998,_0x27cc45){var _0x32da99=_0x4235('0x17');if(_0xf7e998[_0x4235('0xb')]&&_0xf7e998[_0x4235('0xb')][_0x4235('0x18')]&&_0xf7e998[_0x4235('0xb')][_0x4235('0x19')]){_0x32da99=_0x4235('0x1a');}return util[_0x4235('0xd')](_0x32da99,_0xf7e998[_0x4235('0xe')],_0xf7e998['headers']['x-forwarded-for']?_0xf7e998[_0x4235('0x1b')]['x-forwarded-for']:_0xf7e998[_0x4235('0x10')][_0x4235('0x1c')]||_0xf7e998['ip'],_0xf7e998[_0x4235('0x1d')],_0x27cc45['statusCode'],_0x27cc45[_0x4235('0x12')],_0xf7e998['user']?_0xf7e998[_0x4235('0x13')]['id']:null,_0xf7e998[_0x4235('0x13')]?_0xf7e998[_0x4235('0x13')]['name']:null,_0xf7e998[_0x4235('0x13')]?_0xf7e998[_0x4235('0x13')][_0x4235('0x15')]:null,_0xf7e998['body']&&_0xf7e998['body'][_0x4235('0x18')]?_0xf7e998[_0x4235('0xb')][_0x4235('0x18')]:'other',_0xf7e998['body']&&_0xf7e998[_0x4235('0xb')][_0x4235('0x19')]?_0xf7e998['body']['agent_id']:'',_0xf7e998[_0x4235('0xb')]&&_0xf7e998[_0x4235('0xb')]['agent_name']?_0xf7e998[_0x4235('0xb')][_0x4235('0x1e')]:'');},'ignoreRoute':function(_0x425a5e){var _0x5e5c59=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5e5c59['test'](_0x425a5e[_0x4235('0x1d')]);}}));_0x56c2ad['use'](_0x4235('0x1f'),require('./api/user'));_0x56c2ad[_0x4235('0x7')](_0x4235('0x20'),require('./api/voiceChanSpy'));_0x56c2ad['use'](_0x4235('0x21'),require('./api/voiceContext'));_0x56c2ad['use'](_0x4235('0x22'),require(_0x4235('0x23')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x24'),require(_0x4235('0x25')));_0x56c2ad['use'](_0x4235('0x26'),require(_0x4235('0x27')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x28'),require(_0x4235('0x29')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x2a'),require(_0x4235('0x2b')));_0x56c2ad[_0x4235('0x7')]('/api/voice/mails',require('./api/voiceMail'));_0x56c2ad[_0x4235('0x7')](_0x4235('0x2c'),require(_0x4235('0x2d')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x2e'),require(_0x4235('0x2f')));_0x56c2ad[_0x4235('0x7')]('/api/voice/dials/reports',require(_0x4235('0x30')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x31'),require(_0x4235('0x32')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x33'),require(_0x4235('0x34')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x35'),require(_0x4235('0x36')));_0x56c2ad[_0x4235('0x7')]('/api/trunks',require(_0x4235('0x37')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x38'),require(_0x4235('0x39')));_0x56c2ad[_0x4235('0x7')]('/api/mail/out_servers',require(_0x4235('0x3a')));_0x56c2ad['use']('/api/mail/accounts',require('./api/mailAccount'));_0x56c2ad[_0x4235('0x7')](_0x4235('0x3b'),require(_0x4235('0x3c')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x3d'),require(_0x4235('0x3e')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x3f'),require(_0x4235('0x40')));_0x56c2ad['use'](_0x4235('0x41'),require(_0x4235('0x42')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x43'),require('./api/mailApplication'));_0x56c2ad[_0x4235('0x7')](_0x4235('0x44'),require(_0x4235('0x45')));_0x56c2ad['use']('/api/dashboards',require(_0x4235('0x46')));_0x56c2ad['use'](_0x4235('0x47'),require(_0x4235('0x48')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x49'),require('./api/faxAccount'));_0x56c2ad[_0x4235('0x7')]('/api/fax/applications',require(_0x4235('0x4a')));_0x56c2ad[_0x4235('0x7')]('/api/fax/interactions',require('./api/faxInteraction'));_0x56c2ad[_0x4235('0x7')](_0x4235('0x4b'),require('./api/faxMessage'));_0x56c2ad[_0x4235('0x7')]('/api/fax/queues',require('./api/faxQueue'));_0x56c2ad[_0x4235('0x7')](_0x4235('0x4c'),require(_0x4235('0x4d')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x4e'),require(_0x4235('0x4f')));_0x56c2ad['use'](_0x4235('0x50'),require(_0x4235('0x51')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x52'),require('./api/smsInteraction'));_0x56c2ad[_0x4235('0x7')](_0x4235('0x53'),require('./api/smsMessage'));_0x56c2ad[_0x4235('0x7')]('/api/sms/queues',require('./api/smsQueue'));_0x56c2ad['use'](_0x4235('0x54'),require(_0x4235('0x55')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x56'),require(_0x4235('0x57')));_0x56c2ad['use'](_0x4235('0x58'),require(_0x4235('0x59')));_0x56c2ad['use'](_0x4235('0x5a'),require('./api/openchannelMessage'));_0x56c2ad['use'](_0x4235('0x5b'),require('./api/openchannelQueue'));_0x56c2ad[_0x4235('0x7')]('/api/chat/websites',require(_0x4235('0x5c')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x5d'),require(_0x4235('0x5e')));_0x56c2ad[_0x4235('0x7')]('/api/chat/applications',require(_0x4235('0x5f')));_0x56c2ad['use'](_0x4235('0x60'),require(_0x4235('0x61')));_0x56c2ad[_0x4235('0x7')]('/api/chat/messages',require(_0x4235('0x62')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x63'),require(_0x4235('0x64')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x65'),require(_0x4235('0x66')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x67'),require(_0x4235('0x68')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x69'),require(_0x4235('0x6a')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x6b'),require('./api/cmCompany'));_0x56c2ad[_0x4235('0x7')]('/api/cm/contacts',require(_0x4235('0x6c')));_0x56c2ad['use'](_0x4235('0x6d'),require(_0x4235('0x6e')));_0x56c2ad[_0x4235('0x7')]('/api/cm/hopper_black',require(_0x4235('0x6f')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x70'),require(_0x4235('0x71')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x72'),require(_0x4235('0x73')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x74'),require(_0x4235('0x75')));_0x56c2ad[_0x4235('0x7')]('/api/actions',require(_0x4235('0x76')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x77'),require('./api/automation'));_0x56c2ad[_0x4235('0x7')](_0x4235('0x78'),require(_0x4235('0x79')));_0x56c2ad['use'](_0x4235('0x7a'),require('./api/disposition'));_0x56c2ad['use']('/api/conditions',require(_0x4235('0x7b')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x7c'),require('./api/interval'));_0x56c2ad['use'](_0x4235('0x7d'),require('./api/pause'));_0x56c2ad[_0x4235('0x7')](_0x4235('0x7e'),require(_0x4235('0x7f')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x80'),require('./api/voiceQueuesLog'));_0x56c2ad[_0x4235('0x7')](_0x4235('0x81'),require(_0x4235('0x82')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x83'),require(_0x4235('0x84')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x85'),require(_0x4235('0x86')));_0x56c2ad['use'](_0x4235('0x87'),require(_0x4235('0x88')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x89'),require('./api/cmContactHasItem'));_0x56c2ad[_0x4235('0x7')](_0x4235('0x8a'),require('./api/cmHopperAdditionalPhone'));_0x56c2ad[_0x4235('0x7')](_0x4235('0x8b'),require(_0x4235('0x8c')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x8d'),require(_0x4235('0x8e')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x8f'),require('./api/variable'));_0x56c2ad['use'](_0x4235('0x90'),require('./api/integration'));_0x56c2ad[_0x4235('0x7')]('/api/integrations/reports',require(_0x4235('0x91')));_0x56c2ad[_0x4235('0x7')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x56c2ad['use'](_0x4235('0x92'),require(_0x4235('0x93')));_0x56c2ad['use'](_0x4235('0x94'),require(_0x4235('0x95')));_0x56c2ad[_0x4235('0x7')]('/api/analytics/metrics',require(_0x4235('0x96')));_0x56c2ad['use'](_0x4235('0x97'),require(_0x4235('0x98')));_0x56c2ad['use']('/api/analytics/tree_reports',require(_0x4235('0x99')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x9a'),require(_0x4235('0x9b')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x9c'),require(_0x4235('0x9d')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x9e'),require(_0x4235('0x9f')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xa0'),require(_0x4235('0xa1')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xa2'),require(_0x4235('0xa3')));_0x56c2ad['use'](_0x4235('0xa4'),require('./api/intSugarcrmField'));_0x56c2ad[_0x4235('0x7')](_0x4235('0xa5'),require(_0x4235('0xa6')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xa7'),require(_0x4235('0xa8')));_0x56c2ad[_0x4235('0x7')]('/api/integrations/desk/fields',require(_0x4235('0xa9')));_0x56c2ad['use']('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x56c2ad['use']('/api/integrations/zoho/configurations',require(_0x4235('0xaa')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xab'),require(_0x4235('0xac')));_0x56c2ad[_0x4235('0x7')]('/api/integrations/zendesk/accounts',require(_0x4235('0xad')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xae'),require(_0x4235('0xaf')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xb0'),require(_0x4235('0xb1')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xb2'),require(_0x4235('0xb3')));_0x56c2ad[_0x4235('0x7')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x56c2ad[_0x4235('0x7')](_0x4235('0xb4'),require(_0x4235('0xb5')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xb6'),require(_0x4235('0xb7')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xb8'),require(_0x4235('0xb9')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xba'),require(_0x4235('0xbb')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xbc'),require(_0x4235('0xbd')));_0x56c2ad['use'](_0x4235('0xbe'),require(_0x4235('0xbf')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xc0'),require('./api/intServicenowField'));_0x56c2ad[_0x4235('0x7')](_0x4235('0xc1'),require(_0x4235('0xc2')));_0x56c2ad['use'](_0x4235('0xc3'),require(_0x4235('0xc4')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xc5'),require('./api/intDynamics365Field'));_0x56c2ad[_0x4235('0x7')](_0x4235('0xc6'),require('./api/intFreshsalesAccount'));_0x56c2ad[_0x4235('0x7')](_0x4235('0xc7'),require('./api/intFreshsalesConfiguration'));_0x56c2ad[_0x4235('0x7')](_0x4235('0xc8'),require(_0x4235('0xc9')));_0x56c2ad[_0x4235('0x7')]('/api/networks',require(_0x4235('0xca')));_0x56c2ad['use']('/api/chat/reports/queue',require(_0x4235('0xcb')));_0x56c2ad['use']('/api/chat/internal/messages',require(_0x4235('0xcc')));_0x56c2ad['use'](_0x4235('0xcd'),require(_0x4235('0xce')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xcf'),require(_0x4235('0xd0')));_0x56c2ad[_0x4235('0x7')]('/api/jscripty/sessions/reports',require(_0x4235('0xd1')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xd2'),require(_0x4235('0xd3')));_0x56c2ad[_0x4235('0x7')]('/api/square/reports',require(_0x4235('0xd4')));_0x56c2ad['use'](_0x4235('0xd5'),require(_0x4235('0xd6')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xd7'),require(_0x4235('0xd8')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xd9'),require(_0x4235('0xda')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xdb'),require(_0x4235('0xdc')));_0x56c2ad[_0x4235('0x7')]('/api/square/projects',require('./api/squareProject'));_0x56c2ad[_0x4235('0x7')](_0x4235('0xdd'),require(_0x4235('0xde')));_0x56c2ad[_0x4235('0x7')]('/api/square/messages',require('./api/squareMessage'));_0x56c2ad[_0x4235('0x7')](_0x4235('0xdf'),require('./api/team'));_0x56c2ad[_0x4235('0x7')]('/api/license',require('./api/license'));_0x56c2ad[_0x4235('0x7')](_0x4235('0xe0'),require(_0x4235('0xe1')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xe2'),require(_0x4235('0xe3')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xe4'),require(_0x4235('0xe5')));_0x56c2ad['use'](_0x4235('0xe6'),require(_0x4235('0xe7')));_0x56c2ad['use']('/api/mail/reports/transfer',require(_0x4235('0xe8')));_0x56c2ad[_0x4235('0x7')]('/api/chat/reports/transfer',require(_0x4235('0xe9')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xea'),require(_0x4235('0xeb')));_0x56c2ad['use'](_0x4235('0xec'),require(_0x4235('0xed')));_0x56c2ad[_0x4235('0x7')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x56c2ad[_0x4235('0x7')](_0x4235('0xee'),require(_0x4235('0xef')));_0x56c2ad['use']('/api/voice/prefixes',require('./api/voicePrefix'));_0x56c2ad['use'](_0x4235('0xf0'),require(_0x4235('0xf1')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xf2'),require('./api/userProfileSection'));_0x56c2ad['use']('/api/userProfile/resources',require(_0x4235('0xf3')));_0x56c2ad[_0x4235('0x7')]('/api/userNotifications',require('./api/userNotification'));_0x56c2ad[_0x4235('0x7')]('/api/whatsapp/accounts',require(_0x4235('0xf4')));_0x56c2ad[_0x4235('0x7')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x56c2ad[_0x4235('0x7')](_0x4235('0xf5'),require(_0x4235('0xf6')));_0x56c2ad['use'](_0x4235('0xf7'),require(_0x4235('0xf8')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xf9'),require(_0x4235('0xfa')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xfb'),require('./api/whatsappTransferReport'));_0x56c2ad[_0x4235('0x7')](_0x4235('0xfc'),require(_0x4235('0xfd')));_0x56c2ad[_0x4235('0x7')](_0x4235('0xfe'),require(_0x4235('0xff')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x100'),require(_0x4235('0x101')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x102'),require(_0x4235('0x103')));_0x56c2ad['use'](_0x4235('0x104'),require(_0x4235('0x105')));_0x56c2ad['use'](_0x4235('0x106'),require(_0x4235('0x107')));_0x56c2ad[_0x4235('0x7')]('/api/version',require(_0x4235('0x108')));_0x56c2ad[_0x4235('0x7')]('/api/system',require(_0x4235('0x109')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x10a'),require(_0x4235('0x10b')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x10c'),require(_0x4235('0x10d')));_0x56c2ad[_0x4235('0x7')]('/apidoc',express['static'](path[_0x4235('0x10e')](config[_0x4235('0x10f')],'/apidoc')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x110'),express[_0x4235('0x111')](path[_0x4235('0x10e')](config['root'],'/www')));_0x56c2ad[_0x4235('0x7')](_0x4235('0x112'),express[_0x4235('0x111')](path['join'](config[_0x4235('0x10f')],_0x4235('0x112'))));_0x56c2ad[_0x4235('0x7')](_0x4235('0x113'),express['static'](path[_0x4235('0x10e')](config[_0x4235('0x10f')],'snippet',_0x4235('0x114'))));_0x56c2ad[_0x4235('0x7')](_0x4235('0x115'),express[_0x4235('0x111')](path[_0x4235('0x10e')](config['root'],_0x4235('0x116'))));_0x56c2ad['route']('/:url(api|auth|components|app|bower_components|assets)/*')[_0x4235('0x117')](errors[0x194]);_0x56c2ad[_0x4235('0x118')]('/*')['get'](function(_0x22e903,_0x30f26d){_0x30f26d[_0x4235('0x119')](path[_0x4235('0x11a')](_0x56c2ad[_0x4235('0x117')](_0x4235('0x11b'))+'/index.html'));});};var sensitiveFields=[_0x4235('0x11c'),_0x4235('0x11d'),_0x4235('0x11e'),_0x4235('0x11f'),'firstName',_0x4235('0x120'),_0x4235('0x121'),_0x4235('0x122'),_0x4235('0x123'),_0x4235('0x124'),_0x4235('0x125'),'clientId','clientSecret',_0x4235('0x126'),_0x4235('0x127'),_0x4235('0x128'),_0x4235('0x129'),_0x4235('0x12a'),'channelSecret',_0x4235('0x12b'),_0x4235('0x12c'),_0x4235('0x12d'),_0x4235('0x12e'),_0x4235('0x12f'),'membername',_0x4235('0x130'),'calleridnum',_0x4235('0x131'),_0x4235('0x132'),'clientEmail',_0x4235('0x133'),_0x4235('0x134'),_0x4235('0x135'),_0x4235('0x136'),_0x4235('0x13'),_0x4235('0x137'),'accountSid',_0x4235('0x138'),'dsn',_0x4235('0x139'),_0x4235('0x13a'),_0x4235('0x13b')];function maskSensitiveData(_0x56e826){var _0x520a9c=/(?!^)[\s\S](?!$)/g;if(!_[_0x4235('0x13c')](_0x56e826))return;for(var _0x38358f in _0x56e826){if(_[_0x4235('0x13d')](_0x56e826[_0x38358f])){for(var _0xd97160=0x0;_0xd97160<_0x56e826[_0x38358f][_0x4235('0x13e')];_0xd97160++){maskSensitiveData(_0x56e826[_0x38358f][_0xd97160]);}}else if(_[_0x4235('0x13c')](_0x56e826[_0x38358f])){maskSensitiveData(_0x56e826[_0x38358f]);}else if(_[_0x4235('0x13f')](_0x56e826[_0x38358f])){_0x56e826[_0x38358f]=_0x56e826[_0x38358f][_0x4235('0x140')](/{{{/g,_0x4235('0x141'))[_0x4235('0x140')](/}}}/g,_0x4235('0x142'))[_0x4235('0x140')](/{{/g,'@{')[_0x4235('0x140')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x38358f)){_0x56e826[_0x38358f]=_0x56e826[_0x38358f][_0x4235('0x140')](_0x520a9c,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 41cf8fa..ab79d7f 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a39=['../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc'];(function(_0x5e6a13,_0x37b4b5){var _0x3fcbe9=function(_0x53a176){while(--_0x53a176){_0x5e6a13['push'](_0x5e6a13['shift']());}};_0x3fcbe9(++_0x37b4b5);}(_0x3a39,0x6f));var _0x93a3=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x3a39[_0x1d1779];return _0x2377e9;};'use strict';var jayson=require(_0x93a3('0x0'));var BPromise=require(_0x93a3('0x1'));var _=require(_0x93a3('0x2'));var config=require(_0x93a3('0x3'));exports[_0x93a3('0x4')]=function(){return new BPromise(function(_0x37145e,_0x452065){var _0x1c128f={};_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require('../api/user/user.rpc'));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x6')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require('../api/voiceQueue/voiceQueue.rpc'));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x7')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x8')));_0x1c128f=_['merge'](_0x1c128f,require(_0x93a3('0x9')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0xa')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0xb')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require('../api/trunk/trunk.rpc'));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0xc')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0xd')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0xe')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0xf')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x10')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require('../api/mailMessage/mailMessage.rpc'));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x11')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x12')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require('../api/faxAccount/faxAccount.rpc'));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x13')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require('../api/faxInteraction/faxInteraction.rpc'));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x14')));_0x1c128f=_['merge'](_0x1c128f,require(_0x93a3('0x15')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x16')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x17')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x18')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x19')));_0x1c128f=_['merge'](_0x1c128f,require('../api/smsQueue/smsQueue.rpc'));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x1a')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x1b')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x1c')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x1d')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x1e')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require('../api/chatMessage/chatMessage.rpc'));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x1f')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x20')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x21')));_0x1c128f=_['merge'](_0x1c128f,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x22')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x23')));_0x1c128f=_['merge'](_0x1c128f,require(_0x93a3('0x24')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require('../api/pause/pause.rpc'));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x25')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require('../api/template/template.rpc'));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require('../api/trigger/trigger.rpc'));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x26')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x27')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x28')));_0x1c128f=_['merge'](_0x1c128f,require(_0x93a3('0x29')));_0x1c128f=_['merge'](_0x1c128f,require(_0x93a3('0x2a')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x2b')));_0x1c128f=_['merge'](_0x1c128f,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x2c')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x2d')));_0x1c128f=_['merge'](_0x1c128f,require(_0x93a3('0x2e')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x2f')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x30')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x31')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x32')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x33')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x34')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x35')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x36')));_0x1c128f=_['merge'](_0x1c128f,require(_0x93a3('0x37')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x38')));_0x1c128f=_['merge'](_0x1c128f,require(_0x93a3('0x39')));_0x1c128f=_['merge'](_0x1c128f,require(_0x93a3('0x3a')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x3b')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x3c')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x3d')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require(_0x93a3('0x3e')));_0x1c128f=_[_0x93a3('0x5')](_0x1c128f,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x2b9044=jayson['server'](_0x1c128f)[_0x93a3('0x3f')]();var _0x19cb9f=config[_0x93a3('0x40')][_0x93a3('0x41')]||config[_0x93a3('0x41')]+0x1;var _0x445e05=config['rpc']['ip']||_0x93a3('0x42');_0x2b9044['on'](_0x93a3('0x43'),function(_0x2c6f47){return _0x452065(_0x2c6f47);});_0x2b9044[_0x93a3('0x4')](_0x19cb9f,_0x445e05,function(){console[_0x93a3('0x44')](_0x93a3('0x45'),_0x445e05,_0x19cb9f);require('../config/triggers')[_0x93a3('0x46')]();return _0x37145e('RPC\x20listening\x20on\x20'+_0x445e05+':'+_0x19cb9f);});});}; \ No newline at end of file +var _0x89b5=['../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc'];(function(_0x26a74d,_0x37ecfc){var _0xcbb1a3=function(_0x24b978){while(--_0x24b978){_0x26a74d['push'](_0x26a74d['shift']());}};_0xcbb1a3(++_0x37ecfc);}(_0x89b5,0x112));var _0x589b=function(_0x12b82e,_0x1a955f){_0x12b82e=_0x12b82e-0x0;var _0x215209=_0x89b5[_0x12b82e];return _0x215209;};'use strict';var jayson=require(_0x589b('0x0'));var BPromise=require(_0x589b('0x1'));var _=require(_0x589b('0x2'));var config=require('../config/environment');exports[_0x589b('0x3')]=function(){return new BPromise(function(_0x177126,_0x413592){var _0x361828={};_0x361828=_['merge'](_0x361828,require(_0x589b('0x4')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x6')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x7')));_0x361828=_[_0x589b('0x5')](_0x361828,require('../api/voiceRecording/voiceRecording.rpc'));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x8')));_0x361828=_['merge'](_0x361828,require(_0x589b('0x9')));_0x361828=_['merge'](_0x361828,require(_0x589b('0xa')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0xb')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0xc')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0xd')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0xe')));_0x361828=_['merge'](_0x361828,require(_0x589b('0xf')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x10')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x11')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x12')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x13')));_0x361828=_[_0x589b('0x5')](_0x361828,require('../api/mailMessage/mailMessage.rpc'));_0x361828=_['merge'](_0x361828,require(_0x589b('0x14')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x15')));_0x361828=_['merge'](_0x361828,require('../api/faxAccount/faxAccount.rpc'));_0x361828=_[_0x589b('0x5')](_0x361828,require('../api/faxApplication/faxApplication.rpc'));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x16')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x17')));_0x361828=_['merge'](_0x361828,require(_0x589b('0x18')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x19')));_0x361828=_['merge'](_0x361828,require(_0x589b('0x1a')));_0x361828=_[_0x589b('0x5')](_0x361828,require('../api/smsInteraction/smsInteraction.rpc'));_0x361828=_['merge'](_0x361828,require(_0x589b('0x1b')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x1c')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x1d')));_0x361828=_[_0x589b('0x5')](_0x361828,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x361828=_['merge'](_0x361828,require(_0x589b('0x1e')));_0x361828=_[_0x589b('0x5')](_0x361828,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x361828=_['merge'](_0x361828,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x1f')));_0x361828=_['merge'](_0x361828,require(_0x589b('0x20')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x21')));_0x361828=_['merge'](_0x361828,require(_0x589b('0x22')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x23')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x24')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x25')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x26')));_0x361828=_['merge'](_0x361828,require(_0x589b('0x27')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x28')));_0x361828=_['merge'](_0x361828,require(_0x589b('0x29')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x2a')));_0x361828=_['merge'](_0x361828,require(_0x589b('0x2b')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x2c')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x2d')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x2e')));_0x361828=_['merge'](_0x361828,require(_0x589b('0x2f')));_0x361828=_[_0x589b('0x5')](_0x361828,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x361828=_['merge'](_0x361828,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x30')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x31')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x32')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x33')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x34')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x35')));_0x361828=_['merge'](_0x361828,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x361828=_['merge'](_0x361828,require(_0x589b('0x36')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x37')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x38')));_0x361828=_[_0x589b('0x5')](_0x361828,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x361828=_[_0x589b('0x5')](_0x361828,require('../api/setting/setting.rpc'));_0x361828=_['merge'](_0x361828,require(_0x589b('0x39')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x3a')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x3b')));_0x361828=_['merge'](_0x361828,require('../api/squareMessage/squareMessage.rpc'));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x3c')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x3d')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x3e')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x3f')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x40')));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x41')));_0x361828=_[_0x589b('0x5')](_0x361828,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x361828=_[_0x589b('0x5')](_0x361828,require(_0x589b('0x42')));var _0x1873b9=jayson[_0x589b('0x43')](_0x361828)[_0x589b('0x44')]();var _0x2e5614=config[_0x589b('0x45')][_0x589b('0x46')]||config[_0x589b('0x46')]+0x1;var _0x100ec7=config[_0x589b('0x45')]['ip']||'localhost';_0x1873b9['on'](_0x589b('0x47'),function(_0x30255c){return _0x413592(_0x30255c);});_0x1873b9[_0x589b('0x3')](_0x2e5614,_0x100ec7,function(){console[_0x589b('0x48')](_0x589b('0x49'),_0x100ec7,_0x2e5614);require(_0x589b('0x4a'))[_0x589b('0x4b')]();return _0x177126(_0x589b('0x4c')+_0x100ec7+':'+_0x2e5614);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 8ea060b..c2138d5 100644 --- a/server/services/agi/channel.js +++ b/server/services/agi/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['utf8','setTimeout','setEncoding','ready','line','toLowerCase','hangup','emit','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','write','inherits','prototype','sendRequest','command','sync','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','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','label','exports','util','lodash','events','./error','call'];(function(_0x818f67,_0x14bf86){var _0x3ad86a=function(_0xb3360a){while(--_0xb3360a){_0x818f67['push'](_0x818f67['shift']());}};_0x3ad86a(++_0x14bf86);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x0a9e('0x3'));function AGIChannel(_0x4ce2f1){var _0x333808=this,_0x432180=new AGIReply(),_0x2ab90b=![],_0x991246={};EventEmitter[_0x0a9e('0x4')](_0x333808);_0x4ce2f1['setEncoding'](_0x0a9e('0x5'));_0x4ce2f1[_0x0a9e('0x6')](0x8*0x3c*0x3c*0x3e8);_0x432180[_0x0a9e('0x7')]('utf8');_0x432180['on']('headers',function(_0xe42b77){for(var _0x56465b in _0xe42b77){_0x333808[_0x56465b]=_0xe42b77[_0x56465b];}_0x333808['emit'](_0x0a9e('0x8'));});_0x432180['on'](_0x0a9e('0x9'),function(_0x307b3e){if(_0x307b3e[_0x0a9e('0xa')]()==_0x0a9e('0xb')){_0x333808[_0x0a9e('0xc')]('hangup');return;}if(_0x307b3e['substring'](0x0,0xb)=='520-Invalid'){_0x2ab90b=!![];}if(_0x2ab90b){_0x991246['rx']+=_0x307b3e+'\x0a';if(_0x307b3e['search'](_0x0a9e('0xd'))!=-0x1){_0x2ab90b=![];}}else{_0x991246['rx']=_0x307b3e;}if(_0x2ab90b){return;}if(typeof _0x991246['cb']==_0x0a9e('0xe')){var _0xd5b662=_0x991246['rx'][_0x0a9e('0xf')](0x0,0x3),_0x26d672=null,_0x32d742=null;_0xd5b662=parseInt(_0xd5b662);if(isNaN(_0xd5b662)){_0x991246['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xd5b662!=0xc8){_0x991246['cb'](null,{'code':_0xd5b662,'result':-0x1,'extra':'KO'});return;}_0x26d672=_0x991246['rx'][_0x0a9e('0xf')](0x4)[_0x0a9e('0x10')](_0x0a9e('0x11'),'');if(_0x26d672[_0x0a9e('0x12')]('\x20')!=-0x1){_0x26d672=_0x26d672[_0x0a9e('0x13')](0x0,_0x26d672[_0x0a9e('0x12')]('\x20'));}if(_['startsWith'](_0x26d672,'-1')){_0x26d672=parseInt(_0x26d672);}_0x32d742=_0x991246['rx'][_0x0a9e('0x14')]('\x20');if(_0x32d742['length']==0x3){_0x32d742=_0x32d742[0x2][_0x0a9e('0xf')](0x1,_0x32d742[0x2]['length']-0x1);}else if(_0x32d742[_0x0a9e('0x15')]>0x3){var _0x12066b=/\((.+)\)/;var _0x48f32d=_0x991246['rx'][_0x0a9e('0x16')](_0x12066b);if(_0x48f32d){_0x32d742=_0x48f32d[0x1];}else{_0x32d742=null;}}else{_0x32d742=null;}_0x991246['cb'](null,{'code':_0xd5b662,'result':_0x26d672,'extra':_0x32d742});}});_0x4ce2f1['on']('error',function(_0x459eb1){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x17'),new AGIError(_0x0a9e('0x18'),_0x459eb1[_0x0a9e('0x19')]));});_0x4ce2f1['on'](_0x0a9e('0x1a'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1a'),new AGIError(_0x0a9e('0x1b')));});_0x4ce2f1['on'](_0x0a9e('0x1c'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4ce2f1[_0x0a9e('0x1d')]();});_0x4ce2f1[_0x0a9e('0x1e')](_0x432180);this['command']=function(_0x20f109,_0x5a09ef){var _0x20f109=_0x20f109||'',_0x5a09ef=typeof _0x5a09ef==_0x0a9e('0xe')?_0x5a09ef:new Function();_0x991246={'tx':_0x20f109,'rx':'','cb':_0x5a09ef};_0x4ce2f1[_0x0a9e('0x1f')](_0x20f109+'\x0a');},this[_0x0a9e('0x1a')]=function(){_0x4ce2f1['destroy']();};}util[_0x0a9e('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x22')]=function(_0x4d00e6){return this[_0x0a9e('0x23')][_0x0a9e('0x24')](this,_0x4d00e6);};AGIChannel[_0x0a9e('0x21')]['answer']=function(){return this['sendRequest'](_0x0a9e('0x25'));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x26')]=function(_0x33161b,_0x526cf3,_0x384319){_0x33161b=_0x33161b===undefined?'beep':_0x33161b;_0x526cf3=_0x526cf3===undefined?'5':_0x526cf3;_0x384319=_0x384319===undefined?'1':_0x384319;return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x27'),_0x33161b,_0x526cf3*0x3e8,_0x384319));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x28')]=function(_0x14433c){_0x14433c=_0x14433c||_0x0a9e('0x29');return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x14433c));};AGIChannel['prototype'][_0x0a9e('0x2c')]=function(_0x468813,_0x2b1f27){if(_[_0x0a9e('0x2d')](_0x2b1f27)){return this['sendRequest'](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27[_0x0a9e('0x2f')](',')));}return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x30')]=function(_0x1dbde2){return this['sendRequest'](util[_0x0a9e('0x2a')]('SET\x20CONTEXT\x20%s',_0x1dbde2));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x31')]=function(_0x1122db){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20EXTENSION\x20%s',_0x1122db));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x32')]=function(_0x40cb85){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x33'),_0x40cb85));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0xb')]=function(){return this['sendRequest'](_0x0a9e('0x34'));};AGIChannel['prototype'][_0x0a9e('0x35')]=function(_0x14b13f,_0x2b7e7f){var _0x3f3d41=_['isBoolean'](_0x2b7e7f)||_[_0x0a9e('0x36')](_0x2b7e7f)?_0x2b7e7f[_0x0a9e('0x37')]():_0x2b7e7f;return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x14b13f,_0x3f3d41?_0x3f3d41['toString']()[_0x0a9e('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x39'),_0x3d9717,_0x381c37));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3a')]=function(_0x533942,_0x1dbf74){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x533942,_0x1dbf74));};AGIChannel['prototype'][_0x0a9e('0x3b')]=function(_0x40d766,_0x5adda1){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3c'),_0x40d766,_0x5adda1));};AGIChannel[_0x0a9e('0x21')]['continueAt']=function(_0x5a594b,_0x15e37d,_0x45b3d0){_0x15e37d=_0x15e37d||this['extension'];_0x45b3d0=_0x45b3d0||0x1;this[_0x0a9e('0x30')](_0x5a594b);this[_0x0a9e('0x31')](_0x15e37d);this[_0x0a9e('0x32')](_0x45b3d0);return this['noop'](util[_0x0a9e('0x2a')](_0x0a9e('0x3d'),_0x5a594b,_0x15e37d,_0x45b3d0));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3e')]=function(_0x13cb1f){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3f'),_0x13cb1f));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x40')]=function(_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x37f6cc,_0x4d04c8){_0x148007=_0x148007||'wav';_0x1a7bce=_0x1a7bce||'';_0x11ca30=_0x11ca30===undefined?-0x1:_0x11ca30==='-1'?-0x1:_0x11ca30*0x3e8;_0x37f6cc=_0x37f6cc===undefined?'':'s='+_0x37f6cc;_0x4d04c8=_0x4d04c8?_0x0a9e('0x41'):'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x42'),_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x4d04c8,_0x37f6cc));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x43')]=function(_0x10b040,_0x445e25){_0x445e25=_0x445e25||'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x44'),_0x10b040,_0x445e25));};AGIChannel[_0x0a9e('0x21')]['agi']=function(_0x117c99){return this[_0x0a9e('0x2c')](_0x0a9e('0x45'),_0x117c99);};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x46')]=function(_0xbe9d19){return this[_0x0a9e('0x2c')](_0x0a9e('0x47'),_0xbe9d19);};AGIChannel['prototype'][_0x0a9e('0x17')]=function(_0x48fd45,_0x473dc8){this[_0x0a9e('0x28')](util[_0x0a9e('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x48fd45['id'],_0x48fd45[_0x0a9e('0x48')],_0x473dc8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0a9e('0x49')]=AGIChannel; \ No newline at end of file +var _0x0713=['noop','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','result=','substr','indexOf','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','inherits','prototype','sendRequest','sync','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s'];(function(_0x112e53,_0x1a24ca){var _0x139aa7=function(_0x2723c5){while(--_0x2723c5){_0x112e53['push'](_0x112e53['shift']());}};_0x139aa7(++_0x1a24ca);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x3071('0x0'))[_0x3071('0x1')];var AGIReply=require(_0x3071('0x2'));var AGIError=require(_0x3071('0x3'));function AGIChannel(_0x864539){var _0x52b5fb=this,_0x2c547f=new AGIReply(),_0x7b18a4=![],_0x33a70c={};EventEmitter[_0x3071('0x4')](_0x52b5fb);_0x864539[_0x3071('0x5')](_0x3071('0x6'));_0x864539[_0x3071('0x7')](0x8*0x3c*0x3c*0x3e8);_0x2c547f[_0x3071('0x5')](_0x3071('0x6'));_0x2c547f['on'](_0x3071('0x8'),function(_0x3e9a5e){for(var _0x2fce7a in _0x3e9a5e){_0x52b5fb[_0x2fce7a]=_0x3e9a5e[_0x2fce7a];}_0x52b5fb[_0x3071('0x9')]('ready');});_0x2c547f['on'](_0x3071('0xa'),function(_0x2610b4){if(_0x2610b4[_0x3071('0xb')]()==_0x3071('0xc')){_0x52b5fb[_0x3071('0x9')]('hangup');return;}if(_0x2610b4[_0x3071('0xd')](0x0,0xb)==_0x3071('0xe')){_0x7b18a4=!![];}if(_0x7b18a4){_0x33a70c['rx']+=_0x2610b4+'\x0a';if(_0x2610b4[_0x3071('0xf')](_0x3071('0x10'))!=-0x1){_0x7b18a4=![];}}else{_0x33a70c['rx']=_0x2610b4;}if(_0x7b18a4){return;}if(typeof _0x33a70c['cb']==_0x3071('0x11')){var _0x4a8cc7=_0x33a70c['rx']['substring'](0x0,0x3),_0x5330a8=null,_0x1826ca=null;_0x4a8cc7=parseInt(_0x4a8cc7);if(isNaN(_0x4a8cc7)){_0x33a70c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x3071('0x12')});return;}if(_0x4a8cc7!=0xc8){_0x33a70c['cb'](null,{'code':_0x4a8cc7,'result':-0x1,'extra':'KO'});return;}_0x5330a8=_0x33a70c['rx'][_0x3071('0xd')](0x4)['replace'](_0x3071('0x13'),'');if(_0x5330a8['indexOf']('\x20')!=-0x1){_0x5330a8=_0x5330a8[_0x3071('0x14')](0x0,_0x5330a8[_0x3071('0x15')]('\x20'));}if(_[_0x3071('0x16')](_0x5330a8,'-1')){_0x5330a8=parseInt(_0x5330a8);}_0x1826ca=_0x33a70c['rx'][_0x3071('0x17')]('\x20');if(_0x1826ca[_0x3071('0x18')]==0x3){_0x1826ca=_0x1826ca[0x2][_0x3071('0xd')](0x1,_0x1826ca[0x2][_0x3071('0x18')]-0x1);}else if(_0x1826ca[_0x3071('0x18')]>0x3){var _0x21aad3=/\((.+)\)/;var _0x344ea6=_0x33a70c['rx']['match'](_0x21aad3);if(_0x344ea6){_0x1826ca=_0x344ea6[0x1];}else{_0x1826ca=null;}}else{_0x1826ca=null;}_0x33a70c['cb'](null,{'code':_0x4a8cc7,'result':_0x5330a8,'extra':_0x1826ca});}});_0x864539['on'](_0x3071('0x19'),function(_0x17dbda){_0x52b5fb[_0x3071('0x9')](_0x3071('0x19'),new AGIError(_0x3071('0x1a'),_0x17dbda[_0x3071('0x1b')]));});_0x864539['on'](_0x3071('0x1c'),function(){_0x52b5fb[_0x3071('0x9')]('close',new AGIError(_0x3071('0x1d')));});_0x864539['on'](_0x3071('0x1e'),function(){_0x52b5fb[_0x3071('0x9')]('timeout',new AGIError(_0x3071('0x1f')));_0x864539['destroy']();});_0x864539[_0x3071('0x20')](_0x2c547f);this[_0x3071('0x21')]=function(_0x3762d8,_0x457b57){var _0x3762d8=_0x3762d8||'',_0x457b57=typeof _0x457b57==_0x3071('0x11')?_0x457b57:new Function();_0x33a70c={'tx':_0x3762d8,'rx':'','cb':_0x457b57};_0x864539[_0x3071('0x22')](_0x3762d8+'\x0a');},this['close']=function(){_0x864539['destroy']();};}util[_0x3071('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x3071('0x24')][_0x3071('0x25')]=function(_0x13df9f){return this[_0x3071('0x21')][_0x3071('0x26')](this,_0x13df9f);};AGIChannel[_0x3071('0x24')][_0x3071('0x27')]=function(){return this[_0x3071('0x25')]('ANSWER');};AGIChannel[_0x3071('0x24')][_0x3071('0x28')]=function(_0x177138,_0x4d5c4b,_0x4fb1ca){_0x177138=_0x177138===undefined?_0x3071('0x29'):_0x177138;_0x4d5c4b=_0x4d5c4b===undefined?'5':_0x4d5c4b;_0x4fb1ca=_0x4fb1ca===undefined?'1':_0x4fb1ca;return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x2b'),_0x177138,_0x4d5c4b*0x3e8,_0x4fb1ca));};AGIChannel[_0x3071('0x24')][_0x3071('0x2c')]=function(_0x3921a1){_0x3921a1=_0x3921a1||_0x3071('0x2d');return this[_0x3071('0x25')](util[_0x3071('0x2a')]('VERBOSE\x20\x22%s\x22',_0x3921a1));};AGIChannel['prototype'][_0x3071('0x2e')]=function(_0x149e0d,_0x6ddf96){if(_[_0x3071('0x2f')](_0x6ddf96)){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x30'),_0x149e0d,_0x6ddf96[_0x3071('0x31')](',')));}return this['sendRequest'](util['format']('EXEC\x20%s\x20%s',_0x149e0d,_0x6ddf96));};AGIChannel[_0x3071('0x24')][_0x3071('0x32')]=function(_0x5b5bf1){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x33'),_0x5b5bf1));};AGIChannel[_0x3071('0x24')]['setExtension']=function(_0x218a82){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x34'),_0x218a82));};AGIChannel[_0x3071('0x24')][_0x3071('0x35')]=function(_0x3c55c){return this[_0x3071('0x25')](util['format'](_0x3071('0x36'),_0x3c55c));};AGIChannel['prototype']['hangup']=function(){return this[_0x3071('0x25')](_0x3071('0x37'));};AGIChannel['prototype'][_0x3071('0x38')]=function(_0x46e94e,_0x265d76){var _0x14ac42=_[_0x3071('0x39')](_0x265d76)||_[_0x3071('0x3a')](_0x265d76)?_0x265d76['toString']():_0x265d76;return this[_0x3071('0x25')](util[_0x3071('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x46e94e,_0x14ac42?_0x14ac42[_0x3071('0x3b')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x3071('0x24')][_0x3071('0x3c')]=function(_0x5733e9,_0x593c99){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x3d'),_0x5733e9,_0x593c99));};AGIChannel['prototype'][_0x3071('0x3e')]=function(_0x534a77,_0x1ac90a){return this['sendRequest'](util[_0x3071('0x2a')](_0x3071('0x3f'),_0x534a77,_0x1ac90a));};AGIChannel[_0x3071('0x24')][_0x3071('0x40')]=function(_0x30ab68,_0x593c9c){return this['sendRequest'](util[_0x3071('0x2a')](_0x3071('0x41'),_0x30ab68,_0x593c9c));};AGIChannel[_0x3071('0x24')][_0x3071('0x42')]=function(_0x525389,_0x3cfc05,_0x60549a){_0x3cfc05=_0x3cfc05||this[_0x3071('0x43')];_0x60549a=_0x60549a||0x1;this[_0x3071('0x32')](_0x525389);this[_0x3071('0x44')](_0x3cfc05);this[_0x3071('0x35')](_0x60549a);return this['noop'](util[_0x3071('0x2a')]('GOTO\x20%s\x20%s\x20%s',_0x525389,_0x3cfc05,_0x60549a));};AGIChannel['prototype']['getVariable']=function(_0x47ceaf){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x45'),_0x47ceaf));};AGIChannel[_0x3071('0x24')][_0x3071('0x46')]=function(_0x3a81e9,_0xa711b5,_0x2e6c70,_0x56589e,_0x1e8222,_0x1641d9){_0xa711b5=_0xa711b5||_0x3071('0x47');_0x2e6c70=_0x2e6c70||'';_0x56589e=_0x56589e===undefined?-0x1:_0x56589e==='-1'?-0x1:_0x56589e*0x3e8;_0x1e8222=_0x1e8222===undefined?'':'s='+_0x1e8222;_0x1641d9=_0x1641d9?_0x3071('0x48'):'';return this[_0x3071('0x25')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3a81e9,_0xa711b5,_0x2e6c70,_0x56589e,_0x1641d9,_0x1e8222));};AGIChannel[_0x3071('0x24')][_0x3071('0x49')]=function(_0x1fe5e0,_0x5c5865){_0x5c5865=_0x5c5865||'';return this[_0x3071('0x25')](util['format'](_0x3071('0x4a'),_0x1fe5e0,_0x5c5865));};AGIChannel['prototype'][_0x3071('0x4b')]=function(_0x509178){return this['exec'](_0x3071('0x4c'),_0x509178);};AGIChannel['prototype'][_0x3071('0x4d')]=function(_0x5a0a69){return this[_0x3071('0x2e')](_0x3071('0x4e'),_0x5a0a69);};AGIChannel[_0x3071('0x24')][_0x3071('0x19')]=function(_0x554047,_0x2d70bf){this['noop'](util[_0x3071('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x554047['id'],_0x554047[_0x3071('0x4f')],_0x2d70bf));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3071('0x50')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 1935961..0df39f8 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 _0x6135=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','message','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.'];(function(_0x4b75c9,_0x1c5d66){var _0xc8d598=function(_0x1fc4a9){while(--_0x1fc4a9){_0x4b75c9['push'](_0x4b75c9['shift']());}};_0xc8d598(++_0x1c5d66);}(_0x6135,0x18b));var _0x5613=function(_0x320b8e,_0x1da3fe){_0x320b8e=_0x320b8e-0x0;var _0x55a10a=_0x6135[_0x320b8e];return _0x55a10a;};'use strict';var util=require(_0x5613('0x0'));var error={'E_AGI_UNDEFINED':_0x5613('0x1'),'E_AGI_ARGUMENT_PORT':_0x5613('0x2'),'E_AGI_SERVER_ERROR':_0x5613('0x3'),'E_AGI_SERVER_CLOSE':_0x5613('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x5613('0x5'),'E_AGI_SOCKET_ERROR':_0x5613('0x6'),'E_AGI_SOCKET_CLOSE':_0x5613('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x5613('0x8'),'E_AGI_COMMAND_EMPTY':_0x5613('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x5613('0xa')};function AGIError(_0x17604e){var _0x17604e=_0x17604e||null,_0x37dd16=_0x37dd16||[],_0x26f265=0x1,_0x5d927b='';if(!error[_0x17604e]){_0x17604e=_0x5613('0xb');}_0x37dd16[_0x5613('0xc')](error[_0x17604e]);while(arguments[_0x26f265]){_0x37dd16[_0x5613('0xc')](arguments[_0x26f265]);_0x26f265++;}_0x5d927b=util['format']['apply'](util,_0x37dd16);this[_0x5613('0xd')]=_0x5d927b;this['name']=_0x17604e;}module[_0x5613('0xe')]=AGIError; \ No newline at end of file +var _0x92f0=['message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x92f0,0x10d));var _0x092f=function(_0x2bc2a2,_0x51e95f){_0x2bc2a2=_0x2bc2a2-0x0;var _0x20de67=_0x92f0[_0x2bc2a2];return _0x20de67;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x092f('0x0'),'E_AGI_ARGUMENT_PORT':_0x092f('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x092f('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x092f('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x092f('0x4'),'E_AGI_SOCKET_TIMEOUT':_0x092f('0x5'),'E_AGI_COMMAND_EMPTY':_0x092f('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x092f('0x7'),'E_AGI_IVR_ENTRY':_0x092f('0x8')};function AGIError(_0x2b6dcb){var _0x2b6dcb=_0x2b6dcb||null,_0x434211=_0x434211||[],_0x542b99=0x1,_0x1825f7='';if(!error[_0x2b6dcb]){_0x2b6dcb='E_AGI_UNDEFINED';}_0x434211[_0x092f('0x9')](error[_0x2b6dcb]);while(arguments[_0x542b99]){_0x434211['push'](arguments[_0x542b99]);_0x542b99++;}_0x1825f7=util[_0x092f('0xa')]['apply'](util,_0x434211);this[_0x092f('0xb')]=_0x1825f7;this[_0x092f('0xc')]=_0x2b6dcb;}module[_0x092f('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 618c6a4..dfc5861 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 _0x19e1=['agicommand','target','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','lodash','../../../config/logger','agi','menu','vertices','edges','prototype','addVertex','addEdge','push','numberOfEdges','size','relations','getVertex','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x19e1,0x163));var _0x119e=function(_0x3f8282,_0x11b607){_0x3f8282=_0x3f8282-0x0;var _0x50f918=_0x19e1[_0x3f8282];return _0x50f918;};'use strict';var _=require(_0x119e('0x0'));var logger=require(_0x119e('0x1'))(_0x119e('0x2'));var verticesWithRetry=[_0x119e('0x3'),'getdigits','getsecretdigits'];var Graph=function(){this[_0x119e('0x4')]={};this[_0x119e('0x5')]={};this['numberOfEdges']=0x0;};Graph[_0x119e('0x6')][_0x119e('0x7')]=function(_0x4e2d98){this[_0x119e('0x4')][_0x4e2d98['id']]=_0x4e2d98;this['edges'][_0x4e2d98['id']]=[];};Graph[_0x119e('0x6')][_0x119e('0x8')]=function(_0x16a2ee,_0x1b3797,_0x53d5b7){this[_0x119e('0x5')][_0x16a2ee][_0x119e('0x9')]({'target':_0x1b3797,'condition':_0x53d5b7});this[_0x119e('0xa')]+=0x1;};Graph['prototype']['size']=function(){return _[_0x119e('0xb')](this[_0x119e('0x4')]);};Graph[_0x119e('0x6')][_0x119e('0xc')]=function(){return this[_0x119e('0xa')];};Graph[_0x119e('0x6')][_0x119e('0xd')]=function(_0x5aa516){return this[_0x119e('0x4')][_0x5aa516];};Graph[_0x119e('0x6')][_0x119e('0xe')]=function(_0x2fee8b,_0x24883e){if(!this[_0x119e('0x4')][_0x2fee8b]){return logger['info'](_0x119e('0xf'));}var _0x8a9fad=_0x24883e(this[_0x119e('0x4')][_0x2fee8b]);if(!_0x8a9fad){return logger[_0x119e('0x10')](_0x119e('0x11'));}if(this[_0x119e('0x5')][_0x2fee8b][_0x119e('0x12')]===0x0){return logger[_0x119e('0x10')](_0x119e('0x13'));}for(var _0x42acfd=0x0,_0x41f329=[],_0x54c326=![];_0x42acfd\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','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','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','lodash','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','nextTick','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','error','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','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','addVertex','omit','mxCell','isArray','length','source','target','getSquareProject','then','catch','indexOf','agi_','substring','inspect','debug'];(function(_0x497287,_0x11d321){var _0x6764a1=function(_0x1ccfa1){while(--_0x1ccfa1){_0x497287['push'](_0x497287['shift']());}};_0x6764a1(++_0x11d321);}(_0x23f4,0x1ee));var _0x423f=function(_0x542c19,_0xf59316){_0x542c19=_0x542c19-0x0;var _0x2ceeb2=_0x23f4[_0x542c19];return _0x2ceeb2;};'use strict';var parser=require('xml2json');var _=require(_0x423f('0x0'));var syncho=require('syncho');var util=require('util');var moment=require(_0x423f('0x1'));var config=require(_0x423f('0x2'));var logger=require(_0x423f('0x3'))(_0x423f('0x4'));var utilLicense=require(_0x423f('0x5'));var rpc=require(_0x423f('0x6'));var mailRpc=require(_0x423f('0x7'));var Graph=require(_0x423f('0x8'));var Vertices=require(_0x423f('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x423f('0xa')](config[_0x423f('0x4')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x727b4e){process[_0x423f('0xb')](function(){syncho(function(){try{setChannelVariables(_0x727b4e);agiHandler(_0x727b4e);}catch(_0xe4b068){logger['error'](_0xe4b068['stack']);}});});}function listeningHandler(){console['log'](_0x423f('0xc'),config['agi'][_0x423f('0xd')]);logger[_0x423f('0xe')](util[_0x423f('0xf')](_0x423f('0x10'),config['agi']['ip'],config[_0x423f('0x4')][_0x423f('0xd')]));}function errorHandler(_0x3b6a1c){if(_0x3b6a1c&&_0x3b6a1c[_0x423f('0x11')]&&_0x3b6a1c[_0x423f('0x12')]){logger['error'](util[_0x423f('0xf')](_0x423f('0x13'),_0x3b6a1c[_0x423f('0x11')],_0x3b6a1c[_0x423f('0x12')]));}else{logger[_0x423f('0x14')](util[_0x423f('0xf')](_0x423f('0x15'),_0x3b6a1c[_0x423f('0x16')]));}}function closeHandler(){logger[_0x423f('0xe')](util[_0x423f('0xf')](_0x423f('0x17'),this[_0x423f('0x18')],this[_0x423f('0x19')],this[_0x423f('0x1a')],this[_0x423f('0x1b')],this[_0x423f('0x1c')]));try{createSquareReport(this);}catch(_0x3fd56d){logger[_0x423f('0x14')](_0x3fd56d[_0x423f('0x16')]);}}function timeoutHandler(){logger['info'](util[_0x423f('0xf')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x423f('0x19')],this['callerid'],this[_0x423f('0x1b')],this[_0x423f('0x1c')]));}function hangupHandler(){logger['info'](util[_0x423f('0xf')](_0x423f('0x1d'),this['arg_1'],this[_0x423f('0x19')],this[_0x423f('0x1a')],this['dnid'],this[_0x423f('0x1c')]));this[_0x423f('0x1e')]=!![];}function getRoot(_0x568dcd){return parser[_0x423f('0x1f')](_0x568dcd,{'object':!![]})['mxGraphModel'][_0x423f('0x20')];}function addVertex(_0x3c942e,_0x4502ab,_0x3955a0){_0x4502ab[_0x423f('0x21')]=_0x3955a0;if(_0x4502ab[_0x423f('0x22')](_0x423f('0x23'))){_0x4502ab[_0x423f('0x24')]=parseInt(_0x4502ab[_0x423f('0x23')],0xa);}_0x3c942e[_0x423f('0x25')](_[_0x423f('0x26')](_0x4502ab,_0x423f('0x27')));}function initGraph(_0xb91ed8,_0x1f1747){var _0x4a98f2=new Graph();for(var _0x3308dd in _0xb91ed8){if(_0xb91ed8[_0x423f('0x22')](_0x3308dd)){if(_[_0x423f('0x28')](_0xb91ed8[_0x3308dd])){for(var _0x593f9d=0x0;_0x593f9d<_0xb91ed8[_0x3308dd]['length'];_0x593f9d+=0x1){addVertex(_0x4a98f2,_0xb91ed8[_0x3308dd][_0x593f9d],_0x3308dd);}}else{addVertex(_0x4a98f2,_0xb91ed8[_0x3308dd],_0x3308dd);}}}for(var _0x30a9bc=0x0;_0x30a9bc<_0x1f1747[_0x423f('0x29')];_0x30a9bc+=0x1){if(_0x1f1747[_0x30a9bc][_0x423f('0x2a')]&&_0x1f1747[_0x30a9bc]['target']){_0x4a98f2['addEdge'](_0x1f1747[_0x30a9bc][_0x423f('0x2a')],_0x1f1747[_0x30a9bc][_0x423f('0x2b')],_0x1f1747[_0x30a9bc]['value']);}}return _0x4a98f2;}function getSquareProject(_0x3cf4aa,_0x3cd80f){rpc[_0x423f('0x2c')](_0x3cf4aa)[_0x423f('0x2d')](function(_0x518c1e){_0x3cd80f(null,_0x518c1e);})[_0x423f('0x2e')](function(_0x332bbc){_0x3cd80f(null,_0x332bbc);});}function createSquareReport(_0x39c8ee,_0x15c0e8){rpc['createSquareReport'](_0x39c8ee)[_0x423f('0x2d')](function(_0x150846){if(_0x15c0e8){_0x15c0e8(null,_0x150846);}})[_0x423f('0x2e')](function(_0x8e7bcb){if(_0x15c0e8){_0x15c0e8(null,_0x8e7bcb);}});}function setChannelVariables(_0x341728){for(var _0x29fe71 in _0x341728){if(_0x341728[_0x423f('0x22')](_0x29fe71)){if(_0x29fe71[_0x423f('0x2f')](_0x423f('0x30'))===0x0){_0x341728[_0x29fe71[_0x423f('0x31')](0x4)]=_0x341728[_0x29fe71];delete _0x341728[_0x29fe71];}}}}function getLogFromObject(_0x525dbe){return util[_0x423f('0x32')](_0x525dbe,{'showHidden':![],'depth':null});}function agiHandler(_0x20377b){var _0xb4d704,_0x5d206d,_0x2017ae,_0x59fc7a,_0x228df0;logger[_0x423f('0x33')](_0x423f('0x34'),JSON[_0x423f('0x35')](_0x20377b,null,0x2));logger[_0x423f('0xe')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x20377b[_0x423f('0x18')],_0x20377b[_0x423f('0x19')],_0x20377b[_0x423f('0x1a')],_0x20377b[_0x423f('0x1b')],_0x20377b[_0x423f('0x1c')]));_0x20377b['on'](_0x423f('0x14'),errorHandler);_0x20377b['on'](_0x423f('0x36'),closeHandler);_0x20377b['on'](_0x423f('0x37'),timeoutHandler);_0x20377b[_0x423f('0x1e')]=![];_0x20377b['on'](_0x423f('0x38'),hangupHandler);var _0x3aeb17=getSquareProject[_0x423f('0x39')](null,_0x20377b[_0x423f('0x18')]);if(_0x3aeb17){if(_0x3aeb17['production']){_0xb4d704=getRoot(_0x3aeb17['production']);if(_0xb4d704&&_0xb4d704[_0x423f('0x3a')]){logger[_0x423f('0x33')](_0x423f('0x20'),JSON[_0x423f('0x35')](_0xb4d704,null,0x2));_0x20377b[_0x423f('0x3b')]=moment()['format'](_0x423f('0x3c'));_0x5d206d=initGraph(_[_0x423f('0x26')](_0xb4d704,_0x423f('0x27')),_0xb4d704[_0x423f('0x27')]);_0x2017ae=new Vertices(_0x20377b,rpc,mailRpc);logger[_0x423f('0xe')](util[_0x423f('0xf')](_0x423f('0x3d'),_0x20377b[_0x423f('0x18')],_0x20377b[_0x423f('0x19')],_0x20377b[_0x423f('0x1a')],_0x20377b['dnid'],_0x20377b['uniqueid']));_0x5d206d[_0x423f('0x3e')](_0xb4d704[_0x423f('0x3a')]['id'],function(_0x81bd62){try{_0x81bd62=_0x2017ae[_0x423f('0x3f')](_0x81bd62);logger[_0x423f('0x33')](_0x423f('0x40'),JSON['stringify'](_0x81bd62,null,0x2));if(_0x81bd62[_0x423f('0x21')]===_0x423f('0x41')){logger[_0x423f('0xe')](_0x423f('0x42'));_0x20377b[_0x423f('0x43')]=_0x81bd62[_0x423f('0x43')]||_0x20377b[_0x423f('0x43')];_0x20377b[_0x423f('0x44')]=_0x81bd62['extension'];_0x20377b[_0x423f('0x45')]=_0x81bd62[_0x423f('0x45')]?_0x81bd62[_0x423f('0x45')]-0x1:0x1;return null;}else if(_0x81bd62&&_0x2017ae[_0x81bd62[_0x423f('0x21')]]){_0x228df0=_0x2017ae[_0x81bd62[_0x423f('0x21')]](_0x81bd62);logger[_0x423f('0xe')](_0x423f('0x46'),JSON[_0x423f('0x35')](_0x228df0,null,0x2));if(_0x228df0&&_0x228df0[_0x423f('0x47')]===AGI_CODE_SUCCESS&&_0x228df0['result']!==AGI_RESULT_ERROR&&!_0x20377b[_0x423f('0x1e')]){logger['debug'](_0x423f('0x46'),getLogFromObject(_0x228df0));return _[_0x423f('0x48')](_0x228df0[_0x423f('0x49')])?null:_0x228df0[_0x423f('0x49')][_0x423f('0x4a')]();}else{logger[_0x423f('0x14')](_0x423f('0x46'),getLogFromObject(_0x228df0));return null;}}else{logger[_0x423f('0x14')](_0x423f('0x4b'));return null;}}catch(_0x39f9b7){logger[_0x423f('0x14')](_0x39f9b7[_0x423f('0x16')]);return null;}});if(_0xb4d704[_0x423f('0x4c')]){logger[_0x423f('0xe')](util[_0x423f('0xf')](_0x423f('0x4d'),_0x20377b[_0x423f('0x18')],_0x20377b[_0x423f('0x19')],_0x20377b[_0x423f('0x1a')],_0x20377b[_0x423f('0x1b')],_0x20377b['uniqueid']));_0x5d206d[_0x423f('0x3e')](_0xb4d704['finally']['id'],function(_0x12f216){try{_0x12f216=_0x2017ae[_0x423f('0x3f')](_0x12f216);logger[_0x423f('0x33')](_0x423f('0x40'),JSON[_0x423f('0x35')](_0x12f216,null,0x2));if(_0x12f216&&_0x2017ae[_0x12f216[_0x423f('0x21')]]){_0x228df0=_0x2017ae[_0x12f216[_0x423f('0x21')]](_0x12f216);if(_0x228df0){logger[_0x423f('0x33')](_0x423f('0x46'),getLogFromObject(_0x228df0));return _[_0x423f('0x48')](_0x228df0[_0x423f('0x49')])?null:_0x228df0[_0x423f('0x49')]['toString']();}else{logger[_0x423f('0x14')](_0x423f('0x46'),getLogFromObject(_0x228df0));return null;}}else{logger['error'](_0x423f('0x4b'));return null;}}catch(_0x4866ac){logger[_0x423f('0x14')](_0x4866ac['stack']);return null;}});}logger['info'](util[_0x423f('0xf')](_0x423f('0x4e'),_0x20377b[_0x423f('0x18')],_0x20377b[_0x423f('0x19')],_0x20377b['callerid'],_0x20377b[_0x423f('0x1b')],_0x20377b['uniqueid']));logger[_0x423f('0xe')](util[_0x423f('0xf')](_0x423f('0x4f'),_0x20377b[_0x423f('0x43')],_0x20377b[_0x423f('0x44')],parseInt(_0x20377b[_0x423f('0x45')],0xa)+0x1));_0x20377b[_0x423f('0x50')](_0x20377b[_0x423f('0x43')],_0x20377b[_0x423f('0x44')],parseInt(_0x20377b['priority'],0xa)+0x1);_0x20377b[_0x423f('0x36')]();}}else{logger[_0x423f('0x14')](util['format'](_0x423f('0x51'),_0x20377b['arg_1']));_0x20377b[_0x423f('0x50')](_0x20377b[_0x423f('0x43')],_0x20377b[_0x423f('0x44')],parseInt(_0x20377b[_0x423f('0x45')],0xa)+0x1);_0x20377b[_0x423f('0x36')]();}}else{logger[_0x423f('0x14')](util['format']('Project\x20%s\x20not\x20found',_0x20377b[_0x423f('0x18')]));_0x20377b[_0x423f('0x50')](_0x20377b[_0x423f('0x43')],_0x20377b[_0x423f('0x44')],parseInt(_0x20377b[_0x423f('0x45')],0xa)+0x1);_0x20377b[_0x423f('0x36')]();}}function main(){var _0x2e8374;return utilLicense[_0x423f('0x52')]()[_0x423f('0x2d')](function(_0x5cec20){if(_0x5cec20){if(_0x5cec20[_0x423f('0x53')]){if(_0x5cec20[_0x423f('0x54')]&&_0x5cec20['callysquare']>0x0){logger[_0x423f('0xe')](util['format'](_0x423f('0x55'),_0x5cec20[_0x423f('0x54')]));_0x2e8374=_0x5cec20[_0x423f('0x54')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x423f('0xe')](_0x423f('0x56'));_0x2e8374=-0x1;}}})[_0x423f('0x2e')](function(_0x48bd34){logger[_0x423f('0x14')](_0x423f('0x57'),_0x48bd34[_0x423f('0x16')]);})[_0x423f('0x4c')](function(){var _0xc5f895=require(_0x423f('0x58'))(config[_0x423f('0x4')]['port'],config[_0x423f('0x4')]['ip'],_0x2e8374);_0xc5f895['on']('error',errorHandler);_0xc5f895['on'](_0x423f('0x59'),listeningHandler);_0xc5f895['on'](_0x423f('0x5a'),connectionHandler);_0xc5f895['on'](_0x423f('0x36'),closeHandler);});}main(); \ No newline at end of file +var _0x4ab0=['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','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[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','[LICENSE]','./server','connection','lodash','syncho','util','moment','../../config/environment','../../config/license/util','./rpc','./graph','./vertices','defaults','agi','127.0.0.1','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','message','format','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','target','addEdge','source','value','getSquareProject','then','catch','createSquareReport','indexOf','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','sync','production','start','root'];(function(_0x3bec69,_0x46371f){var _0x5c7b82=function(_0x37b398){while(--_0x37b398){_0x3bec69['push'](_0x3bec69['shift']());}};_0x5c7b82(++_0x46371f);}(_0x4ab0,0xd5));var _0x04ab=function(_0x171135,_0x191e8d){_0x171135=_0x171135-0x0;var _0x40ca62=_0x4ab0[_0x171135];return _0x40ca62;};'use strict';var parser=require('xml2json');var _=require(_0x04ab('0x0'));var syncho=require(_0x04ab('0x1'));var util=require(_0x04ab('0x2'));var moment=require(_0x04ab('0x3'));var config=require(_0x04ab('0x4'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0x04ab('0x5'));var rpc=require(_0x04ab('0x6'));var mailRpc=require('./mailRpc');var Graph=require(_0x04ab('0x7'));var Vertices=require(_0x04ab('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x04ab('0x9')](config[_0x04ab('0xa')],{'ip':_0x04ab('0xb'),'port':0x11dd});function connectionHandler(_0x4bc05e){process[_0x04ab('0xc')](function(){syncho(function(){try{setChannelVariables(_0x4bc05e);agiHandler(_0x4bc05e);}catch(_0x2b3754){logger[_0x04ab('0xd')](_0x2b3754[_0x04ab('0xe')]);}});});}function listeningHandler(){console['log'](_0x04ab('0xf'),config[_0x04ab('0xa')][_0x04ab('0x10')]);logger[_0x04ab('0x11')](util['format'](_0x04ab('0x12'),config[_0x04ab('0xa')]['ip'],config[_0x04ab('0xa')][_0x04ab('0x10')]));}function errorHandler(_0x1c58f3){if(_0x1c58f3&&_0x1c58f3[_0x04ab('0x13')]&&_0x1c58f3['message']){logger[_0x04ab('0xd')](util['format'](_0x04ab('0x14'),_0x1c58f3[_0x04ab('0x13')],_0x1c58f3[_0x04ab('0x15')]));}else{logger[_0x04ab('0xd')](util['format']('[ERROR]\x20%s',_0x1c58f3['stack']));}}function closeHandler(){logger[_0x04ab('0x11')](util[_0x04ab('0x16')](_0x04ab('0x17'),this[_0x04ab('0x18')],this[_0x04ab('0x19')],this[_0x04ab('0x1a')],this[_0x04ab('0x1b')],this[_0x04ab('0x1c')]));try{createSquareReport(this);}catch(_0x1f3251){logger[_0x04ab('0xd')](_0x1f3251['stack']);}}function timeoutHandler(){logger[_0x04ab('0x11')](util[_0x04ab('0x16')](_0x04ab('0x1d'),this[_0x04ab('0x18')],this[_0x04ab('0x19')],this[_0x04ab('0x1a')],this[_0x04ab('0x1b')],this[_0x04ab('0x1c')]));}function hangupHandler(){logger[_0x04ab('0x11')](util['format'](_0x04ab('0x1e'),this['arg_1'],this[_0x04ab('0x19')],this[_0x04ab('0x1a')],this[_0x04ab('0x1b')],this['uniqueid']));this[_0x04ab('0x1f')]=!![];}function getRoot(_0x1c08f4){return parser[_0x04ab('0x20')](_0x1c08f4,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0xc8358e,_0x2f614a,_0x5885bd){_0x2f614a['agicommand']=_0x5885bd;if(_0x2f614a[_0x04ab('0x21')](_0x04ab('0x22'))){_0x2f614a[_0x04ab('0x23')]=parseInt(_0x2f614a[_0x04ab('0x22')],0xa);}_0xc8358e[_0x04ab('0x24')](_[_0x04ab('0x25')](_0x2f614a,_0x04ab('0x26')));}function initGraph(_0x46cec5,_0x222557){var _0x5cf1e5=new Graph();for(var _0x86bf80 in _0x46cec5){if(_0x46cec5[_0x04ab('0x21')](_0x86bf80)){if(_[_0x04ab('0x27')](_0x46cec5[_0x86bf80])){for(var _0x9ea90c=0x0;_0x9ea90c<_0x46cec5[_0x86bf80]['length'];_0x9ea90c+=0x1){addVertex(_0x5cf1e5,_0x46cec5[_0x86bf80][_0x9ea90c],_0x86bf80);}}else{addVertex(_0x5cf1e5,_0x46cec5[_0x86bf80],_0x86bf80);}}}for(var _0x530a1c=0x0;_0x530a1c<_0x222557[_0x04ab('0x28')];_0x530a1c+=0x1){if(_0x222557[_0x530a1c]['source']&&_0x222557[_0x530a1c][_0x04ab('0x29')]){_0x5cf1e5[_0x04ab('0x2a')](_0x222557[_0x530a1c][_0x04ab('0x2b')],_0x222557[_0x530a1c][_0x04ab('0x29')],_0x222557[_0x530a1c][_0x04ab('0x2c')]);}}return _0x5cf1e5;}function getSquareProject(_0x5596fc,_0x47f9be){rpc[_0x04ab('0x2d')](_0x5596fc)[_0x04ab('0x2e')](function(_0x28e77b){_0x47f9be(null,_0x28e77b);})[_0x04ab('0x2f')](function(_0x1ac676){_0x47f9be(null,_0x1ac676);});}function createSquareReport(_0x459e8c,_0x1c3dca){rpc[_0x04ab('0x30')](_0x459e8c)[_0x04ab('0x2e')](function(_0x766754){if(_0x1c3dca){_0x1c3dca(null,_0x766754);}})[_0x04ab('0x2f')](function(_0x28bfca){if(_0x1c3dca){_0x1c3dca(null,_0x28bfca);}});}function setChannelVariables(_0x2f978d){for(var _0x48b7a3 in _0x2f978d){if(_0x2f978d[_0x04ab('0x21')](_0x48b7a3)){if(_0x48b7a3[_0x04ab('0x31')]('agi_')===0x0){_0x2f978d[_0x48b7a3[_0x04ab('0x32')](0x4)]=_0x2f978d[_0x48b7a3];delete _0x2f978d[_0x48b7a3];}}}}function getLogFromObject(_0x148c76){return util['inspect'](_0x148c76,{'showHidden':![],'depth':null});}function agiHandler(_0x45ee8c){var _0x35aadf,_0x48a0b9,_0x69e081,_0x3e1750,_0x42202f;logger[_0x04ab('0x33')](_0x04ab('0x34'),JSON[_0x04ab('0x35')](_0x45ee8c,null,0x2));logger['info'](util[_0x04ab('0x16')](_0x04ab('0x36'),_0x45ee8c[_0x04ab('0x18')],_0x45ee8c['calleridname'],_0x45ee8c[_0x04ab('0x1a')],_0x45ee8c['dnid'],_0x45ee8c['uniqueid']));_0x45ee8c['on'](_0x04ab('0xd'),errorHandler);_0x45ee8c['on'](_0x04ab('0x37'),closeHandler);_0x45ee8c['on']('timeout',timeoutHandler);_0x45ee8c[_0x04ab('0x1f')]=![];_0x45ee8c['on']('hangup',hangupHandler);var _0x3c66a8=getSquareProject[_0x04ab('0x38')](null,_0x45ee8c[_0x04ab('0x18')]);if(_0x3c66a8){if(_0x3c66a8[_0x04ab('0x39')]){_0x35aadf=getRoot(_0x3c66a8[_0x04ab('0x39')]);if(_0x35aadf&&_0x35aadf[_0x04ab('0x3a')]){logger[_0x04ab('0x33')](_0x04ab('0x3b'),JSON[_0x04ab('0x35')](_0x35aadf,null,0x2));_0x45ee8c[_0x04ab('0x3c')]=moment()[_0x04ab('0x16')](_0x04ab('0x3d'));_0x48a0b9=initGraph(_['omit'](_0x35aadf,_0x04ab('0x26')),_0x35aadf[_0x04ab('0x26')]);_0x69e081=new Vertices(_0x45ee8c,rpc,mailRpc);logger['info'](util['format'](_0x04ab('0x3e'),_0x45ee8c[_0x04ab('0x18')],_0x45ee8c[_0x04ab('0x19')],_0x45ee8c[_0x04ab('0x1a')],_0x45ee8c['dnid'],_0x45ee8c[_0x04ab('0x1c')]));_0x48a0b9[_0x04ab('0x3f')](_0x35aadf[_0x04ab('0x3a')]['id'],function(_0x244acf){try{_0x244acf=_0x69e081['clear'](_0x244acf);logger[_0x04ab('0x33')](_0x04ab('0x40'),JSON[_0x04ab('0x35')](_0x244acf,null,0x2));if(_0x244acf[_0x04ab('0x41')]===_0x04ab('0x42')){logger[_0x04ab('0x11')](_0x04ab('0x43'));_0x45ee8c[_0x04ab('0x44')]=_0x244acf['context']||_0x45ee8c['context'];_0x45ee8c[_0x04ab('0x45')]=_0x244acf[_0x04ab('0x45')];_0x45ee8c[_0x04ab('0x46')]=_0x244acf[_0x04ab('0x46')]?_0x244acf[_0x04ab('0x46')]-0x1:0x1;return null;}else if(_0x244acf&&_0x69e081[_0x244acf['agicommand']]){_0x42202f=_0x69e081[_0x244acf[_0x04ab('0x41')]](_0x244acf);logger[_0x04ab('0x11')](_0x04ab('0x47'),JSON['stringify'](_0x42202f,null,0x2));if(_0x42202f&&_0x42202f[_0x04ab('0x48')]===AGI_CODE_SUCCESS&&_0x42202f[_0x04ab('0x49')]!==AGI_RESULT_ERROR&&!_0x45ee8c[_0x04ab('0x1f')]){logger[_0x04ab('0x33')](_0x04ab('0x47'),getLogFromObject(_0x42202f));return _[_0x04ab('0x4a')](_0x42202f[_0x04ab('0x49')])?null:_0x42202f[_0x04ab('0x49')][_0x04ab('0x4b')]();}else{logger[_0x04ab('0xd')]('response',getLogFromObject(_0x42202f));return null;}}else{logger[_0x04ab('0xd')](_0x04ab('0x4c'));return null;}}catch(_0x7da2b8){logger[_0x04ab('0xd')](_0x7da2b8[_0x04ab('0xe')]);return null;}});if(_0x35aadf[_0x04ab('0x4d')]){logger['info'](util[_0x04ab('0x16')](_0x04ab('0x4e'),_0x45ee8c[_0x04ab('0x18')],_0x45ee8c[_0x04ab('0x19')],_0x45ee8c['callerid'],_0x45ee8c[_0x04ab('0x1b')],_0x45ee8c[_0x04ab('0x1c')]));_0x48a0b9[_0x04ab('0x3f')](_0x35aadf[_0x04ab('0x4d')]['id'],function(_0x257123){try{_0x257123=_0x69e081['clear'](_0x257123);logger[_0x04ab('0x33')](_0x04ab('0x40'),JSON['stringify'](_0x257123,null,0x2));if(_0x257123&&_0x69e081[_0x257123['agicommand']]){_0x42202f=_0x69e081[_0x257123[_0x04ab('0x41')]](_0x257123);if(_0x42202f){logger[_0x04ab('0x33')](_0x04ab('0x47'),getLogFromObject(_0x42202f));return _[_0x04ab('0x4a')](_0x42202f[_0x04ab('0x49')])?null:_0x42202f[_0x04ab('0x49')][_0x04ab('0x4b')]();}else{logger['error'](_0x04ab('0x47'),getLogFromObject(_0x42202f));return null;}}else{logger[_0x04ab('0xd')](_0x04ab('0x4c'));return null;}}catch(_0x597673){logger[_0x04ab('0xd')](_0x597673[_0x04ab('0xe')]);return null;}});}logger['info'](util[_0x04ab('0x16')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x45ee8c[_0x04ab('0x18')],_0x45ee8c['calleridname'],_0x45ee8c[_0x04ab('0x1a')],_0x45ee8c['dnid'],_0x45ee8c['uniqueid']));logger[_0x04ab('0x11')](util[_0x04ab('0x16')](_0x04ab('0x4f'),_0x45ee8c['context'],_0x45ee8c['extension'],parseInt(_0x45ee8c[_0x04ab('0x46')],0xa)+0x1));_0x45ee8c[_0x04ab('0x50')](_0x45ee8c[_0x04ab('0x44')],_0x45ee8c['extension'],parseInt(_0x45ee8c[_0x04ab('0x46')],0xa)+0x1);_0x45ee8c['close']();}}else{logger[_0x04ab('0xd')](util[_0x04ab('0x16')](_0x04ab('0x51'),_0x45ee8c['arg_1']));_0x45ee8c[_0x04ab('0x50')](_0x45ee8c[_0x04ab('0x44')],_0x45ee8c[_0x04ab('0x45')],parseInt(_0x45ee8c[_0x04ab('0x46')],0xa)+0x1);_0x45ee8c[_0x04ab('0x37')]();}}else{logger[_0x04ab('0xd')](util[_0x04ab('0x16')](_0x04ab('0x52'),_0x45ee8c[_0x04ab('0x18')]));_0x45ee8c[_0x04ab('0x50')](_0x45ee8c[_0x04ab('0x44')],_0x45ee8c['extension'],parseInt(_0x45ee8c[_0x04ab('0x46')],0xa)+0x1);_0x45ee8c['close']();}}function main(){var _0x7b63ea;return utilLicense[_0x04ab('0x53')]()['then'](function(_0x53fa2b){if(_0x53fa2b){if(_0x53fa2b[_0x04ab('0x54')]){if(_0x53fa2b[_0x04ab('0x55')]&&_0x53fa2b[_0x04ab('0x55')]>0x0){logger[_0x04ab('0x11')](util[_0x04ab('0x16')](_0x04ab('0x56'),_0x53fa2b[_0x04ab('0x55')]));_0x7b63ea=_0x53fa2b[_0x04ab('0x55')];}else{logger[_0x04ab('0x11')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x04ab('0x11')](_0x04ab('0x57'));_0x7b63ea=-0x1;}}})[_0x04ab('0x2f')](function(_0x590cf8){logger[_0x04ab('0xd')](_0x04ab('0x58'),_0x590cf8[_0x04ab('0xe')]);})['finally'](function(){var _0x2d60c8=require(_0x04ab('0x59'))(config[_0x04ab('0xa')][_0x04ab('0x10')],config['agi']['ip'],_0x7b63ea);_0x2d60c8['on'](_0x04ab('0xd'),errorHandler);_0x2d60c8['on']('listening',listeningHandler);_0x2d60c8['on'](_0x04ab('0x5a'),connectionHandler);_0x2d60c8['on'](_0x04ab('0x37'),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 bf71bc2..eea5b3e 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x455689,_0x23f4f4){var _0x2e402e=function(_0x284538){while(--_0x284538){_0x455689['push'](_0x455689['shift']());}};_0x2e402e(++_0x23f4f4);}(_0x814b,0x1a2));var _0xb814=function(_0x5f46e7,_0x62f9f8){_0x5f46e7=_0x5f46e7-0x0;var _0x567e95=_0x814b[_0x5f46e7];return _0x567e95;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file +var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x3e1c75,_0x3123ac){var _0x5a5d41=function(_0x319214){while(--_0x319214){_0x3e1c75['push'](_0x3e1c75['shift']());}};_0x5a5d41(++_0x3123ac);}(_0x34e8,0x12c));var _0x834e=function(_0x151fa0,_0x2f0376){_0x151fa0=_0x151fa0-0x0;var _0x5eb0ca=_0x34e8[_0x151fa0];return _0x5eb0ca;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 70b0117..08c2203 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(_0x39f2f6,_0xf15c48){var _0x4b60d7=function(_0x2df545){while(--_0x2df545){_0x39f2f6['push'](_0x39f2f6['shift']());}};_0x4b60d7(++_0xf15c48);}(_0x7a54,0x106));var _0x47a5=function(_0x13f8d1,_0x36eada){_0x13f8d1=_0x13f8d1-0x0;var _0x537ee7=_0x7a54[_0x13f8d1];return _0x537ee7;};'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(_0xb6dab,_0x5bff55){var _0x1ec72d=function(_0x208140){while(--_0x208140){_0xb6dab['push'](_0xb6dab['shift']());}};_0x1ec72d(++_0x5bff55);}(_0x5f2f,0x73));var _0xf5f2=function(_0xf61170,_0x16f614){_0xf61170=_0xf61170-0x0;var _0x13198c=_0x5f2f[_0xf61170];return _0x13198c;};'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 dd6133b..b8cafb6 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 _0x7cd8=['jayson/promise','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','email','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util'];(function(_0x403f61,_0xe216f1){var _0x50eed7=function(_0x337483){while(--_0x337483){_0x403f61['push'](_0x403f61['shift']());}};_0x50eed7(++_0xe216f1);}(_0x7cd8,0x1f4));var _0x87cd=function(_0x4eeaac,_0x2a1bcf){_0x4eeaac=_0x4eeaac-0x0;var _0x133e35=_0x7cd8[_0x4eeaac];return _0x133e35;};'use strict';var BPromise=require(_0x87cd('0x0'));var moment=require(_0x87cd('0x1'));var _=require(_0x87cd('0x2'));var util=require(_0x87cd('0x3'));var jayson=require(_0x87cd('0x4'));var client=jayson['client'][_0x87cd('0x5')]({'port':0x2329});function request(_0x92873b,_0x50e37b){return new BPromise(function(_0x9d9d49,_0x86c8cc){return client[_0x87cd('0x6')](_0x92873b,_0x50e37b)[_0x87cd('0x7')](function(_0x106825){if(_0x106825[_0x87cd('0x8')]){return _0x86c8cc(_0x106825[_0x87cd('0x8')][_0x87cd('0x9')]);}else{return _0x9d9d49(_0x106825[_0x87cd('0xa')]);}})[_0x87cd('0xb')](function(_0x4ad524){return _0x86c8cc(_0x4ad524);});});}exports[_0x87cd('0xc')]=function(_0x95fd7e){return request(_0x87cd('0xd'),{'options':{'raw':![],'where':{'name':_0x95fd7e},'attributes':[_0x87cd('0xe')]}});};exports[_0x87cd('0xf')]=function(_0x5aab29){return request(_0x87cd('0x10'),{'options':{'raw':![],'where':{'id':_0x5aab29},'include':[{'model':_0x87cd('0x11'),'as':_0x87cd('0x12')}],'attributes':['id','name',_0x87cd('0x13')]}});};exports['getSquareProjectById']=function(_0x249bf1){return request(_0x87cd('0xd'),{'options':{'where':{'id':_0x249bf1},'attributes':[_0x87cd('0x14')]}});};exports[_0x87cd('0x15')]=function(_0x1fd1f1){return request(_0x87cd('0x16'),{'options':{'where':{'id':_0x1fd1f1},'attributes':['name']}});};exports[_0x87cd('0x17')]=function(_0x3c9d6b){return request('ShowVariable',{'options':{'where':{'id':_0x3c9d6b},'attributes':[_0x87cd('0x14')]}});};exports[_0x87cd('0x18')]=function(_0x438efa){return request(_0x87cd('0x19'),{'options':{'where':{'id':_0x438efa},'attributes':[_0x87cd('0x1a')]}});};exports[_0x87cd('0x1b')]=function(_0x2b8348){return request('ShowUser',{'options':{'where':{'id':_0x2b8348},'attributes':[_0x87cd('0x14')]}});};exports[_0x87cd('0x1c')]=function(_0x4ef441){return request(_0x87cd('0x1d'),{'options':{'where':{'id':_0x4ef441},'attributes':['name']}});};exports['getSoundById']=function(_0x13b769){return request(_0x87cd('0x1e'),{'options':{'where':{'id':_0x13b769},'attributes':[_0x87cd('0x1f')]}});};exports[_0x87cd('0x20')]=function(_0x2fe20e){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x2fe20e},'include':[{'model':_0x87cd('0x21'),'as':_0x87cd('0x22')}]}});};exports[_0x87cd('0x23')]=function(_0x36d528){return request(_0x87cd('0x24'),{'options':{'where':{'id':_0x36d528},'attributes':['id',_0x87cd('0x14')]}});};exports[_0x87cd('0x25')]=function(_0x1a3d55){return request(_0x87cd('0x26'),{'body':_0x1a3d55});};exports[_0x87cd('0x27')]=function(_0x4ce794){return request(_0x87cd('0x28'),{'body':_0x4ce794});};exports[_0x87cd('0x29')]=function(_0x1efa03){return request(_0x87cd('0x2a'),{'body':_['merge'](_0x1efa03,{'project_name':_0x1efa03[_0x87cd('0x2b')],'prev_project_name':_0x1efa03['arg_2']||'','is_subproject':_0x1efa03['arg_2']?!![]:![],'leaveAt':moment()[_0x87cd('0x2c')](_0x87cd('0x2d'))})});};exports[_0x87cd('0x2e')]=function(_0x2221cf){return request(_0x87cd('0x2f'),{'body':_0x2221cf});};exports[_0x87cd('0x30')]=function(_0x5dcec9){return request(_0x87cd('0x31'),{'body':_0x5dcec9});};exports['createCmContact']=function(_0x4c9233){return request(_0x87cd('0x32'),{'options':{'raw':![],'where':{'phone':_0x4c9233[_0x87cd('0x33')],'ListId':_0x4c9233[_0x87cd('0x34')]}}})[_0x87cd('0x7')](function(_0x39ce11){if(_0x39ce11){return _0x39ce11;}return request(_0x87cd('0x35'),{'body':_0x4c9233});});};exports[_0x87cd('0x36')]=function(_0x5832eb){return request('ShowPause',{'options':{'where':{'id':_0x5832eb},'attributes':['name']}});};exports[_0x87cd('0x37')]=function(_0x1b7601,_0x1346e2){return request(_0x87cd('0x38'),{'body':{'interface':_0x1346e2},'options':{'where':_0x1b7601}});};exports[_0x87cd('0x39')]=function(_0x5bbf09,_0x4f4108,_0x120d32){return request(_0x87cd('0x3a'),{'body':{'type':_0x4f4108,'uniqueid':_0x120d32},'options':{'where':_0x5bbf09}});};exports[_0x87cd('0x3b')]=function(_0x306a1c){return request(_0x87cd('0x3c'),{'body':{},'options':{'where':_0x306a1c}});};exports[_0x87cd('0x3d')]=function(_0x165429){return request(_0x87cd('0x3e'),{'body':{},'options':{'where':_0x165429}});}; \ No newline at end of file +var _0xc9d7=['ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareMessage','CreateSquareMessage','createCmContact','phone','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','request','then','error','message','result','catch','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','email','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById'];(function(_0x2a85e6,_0x19dca3){var _0x4e6d1a=function(_0x7c4d3e){while(--_0x7c4d3e){_0x2a85e6['push'](_0x2a85e6['shift']());}};_0x4e6d1a(++_0x19dca3);}(_0xc9d7,0x149));var _0x7c9d=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xc9d7[_0x1b6186];return _0x186121;};'use strict';var BPromise=require(_0x7c9d('0x0'));var moment=require(_0x7c9d('0x1'));var _=require(_0x7c9d('0x2'));var util=require(_0x7c9d('0x3'));var jayson=require(_0x7c9d('0x4'));var client=jayson[_0x7c9d('0x5')]['http']({'port':0x2329});function request(_0x1ac7b2,_0x36a6fd){return new BPromise(function(_0x1eacf2,_0x232db4){return client[_0x7c9d('0x6')](_0x1ac7b2,_0x36a6fd)[_0x7c9d('0x7')](function(_0x18b838){if(_0x18b838[_0x7c9d('0x8')]){return _0x232db4(_0x18b838['error'][_0x7c9d('0x9')]);}else{return _0x1eacf2(_0x18b838[_0x7c9d('0xa')]);}})[_0x7c9d('0xb')](function(_0x57f95c){return _0x232db4(_0x57f95c);});});}exports['getSquareProject']=function(_0x3d657d){return request(_0x7c9d('0xc'),{'options':{'raw':![],'where':{'name':_0x3d657d},'attributes':[_0x7c9d('0xd')]}});};exports[_0x7c9d('0xe')]=function(_0x280e47){return request(_0x7c9d('0xf'),{'options':{'raw':![],'where':{'id':_0x280e47},'include':[{'model':_0x7c9d('0x10'),'as':'Smtp'}],'attributes':['id','name',_0x7c9d('0x11')]}});};exports['getSquareProjectById']=function(_0x20bd7b){return request(_0x7c9d('0xc'),{'options':{'where':{'id':_0x20bd7b},'attributes':[_0x7c9d('0x12')]}});};exports[_0x7c9d('0x13')]=function(_0x29bd90){return request(_0x7c9d('0x14'),{'options':{'where':{'id':_0x29bd90},'attributes':[_0x7c9d('0x12')]}});};exports[_0x7c9d('0x15')]=function(_0x1650a0){return request(_0x7c9d('0x16'),{'options':{'where':{'id':_0x1650a0},'attributes':['name']}});};exports[_0x7c9d('0x17')]=function(_0x3a9d4f){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x3a9d4f},'attributes':[_0x7c9d('0x18')]}});};exports['getUserById']=function(_0x5adf17){return request(_0x7c9d('0x19'),{'options':{'where':{'id':_0x5adf17},'attributes':[_0x7c9d('0x12')]}});};exports[_0x7c9d('0x1a')]=function(_0x27b810){return request(_0x7c9d('0x1b'),{'options':{'where':{'id':_0x27b810},'attributes':[_0x7c9d('0x12')]}});};exports[_0x7c9d('0x1c')]=function(_0x5eedeb){return request(_0x7c9d('0x1d'),{'options':{'where':{'id':_0x5eedeb},'attributes':['save_name']}});};exports[_0x7c9d('0x1e')]=function(_0x3aecc4){return request(_0x7c9d('0x1f'),{'options':{'raw':![],'where':{'id':_0x3aecc4},'include':[{'model':_0x7c9d('0x20'),'as':_0x7c9d('0x21')}]}});};exports[_0x7c9d('0x22')]=function(_0x5033e9){return request('ShowSmsAccount',{'options':{'where':{'id':_0x5033e9},'attributes':['id',_0x7c9d('0x12')]}});};exports[_0x7c9d('0x23')]=function(_0x490c09){return request('CreateSmsMessage',{'body':_0x490c09});};exports[_0x7c9d('0x24')]=function(_0x2f67ad){return request(_0x7c9d('0x25'),{'body':_0x2f67ad});};exports[_0x7c9d('0x26')]=function(_0xc748f9){return request(_0x7c9d('0x27'),{'body':_[_0x7c9d('0x28')](_0xc748f9,{'project_name':_0xc748f9[_0x7c9d('0x29')],'prev_project_name':_0xc748f9[_0x7c9d('0x2a')]||'','is_subproject':_0xc748f9['arg_2']?!![]:![],'leaveAt':moment()[_0x7c9d('0x2b')](_0x7c9d('0x2c'))})});};exports['createSquareRecording']=function(_0x422436){return request('CreateSquareRecording',{'body':_0x422436});};exports[_0x7c9d('0x2d')]=function(_0x3ed9ea){return request(_0x7c9d('0x2e'),{'body':_0x3ed9ea});};exports[_0x7c9d('0x2f')]=function(_0x4bf9d4){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x4bf9d4[_0x7c9d('0x30')],'ListId':_0x4bf9d4[_0x7c9d('0x31')]}}})[_0x7c9d('0x7')](function(_0xd8315b){if(_0xd8315b){return _0xd8315b;}return request('CreateCmContact',{'body':_0x4bf9d4});});};exports[_0x7c9d('0x32')]=function(_0xd182fd){return request(_0x7c9d('0x33'),{'options':{'where':{'id':_0xd182fd},'attributes':[_0x7c9d('0x12')]}});};exports[_0x7c9d('0x34')]=function(_0x4dd61f,_0x271f94){return request(_0x7c9d('0x35'),{'body':{'interface':_0x271f94},'options':{'where':_0x4dd61f}});};exports[_0x7c9d('0x36')]=function(_0x21c7f0,_0x5c2342,_0x50a7ec){return request(_0x7c9d('0x37'),{'body':{'type':_0x5c2342,'uniqueid':_0x50a7ec},'options':{'where':_0x21c7f0}});};exports[_0x7c9d('0x38')]=function(_0x5a1dbf){return request(_0x7c9d('0x39'),{'body':{},'options':{'where':_0x5a1dbf}});};exports[_0x7c9d('0x3a')]=function(_0x248932){return request(_0x7c9d('0x3b'),{'body':{},'options':{'where':_0x248932}});}; \ 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 fa15dfd..2c51574 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 _0xbec5=['./lex','./polly'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xbec5,0xe5));var _0x5bec=function(_0x1f3aec,_0x24c18e){_0x1f3aec=_0x1f3aec-0x0;var _0x409f0d=_0xbec5[_0x1f3aec];return _0x409f0d;};var polly=require(_0x5bec('0x0'));var lex=require(_0x5bec('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x4bc3=['./polly','./lex'];(function(_0x559921,_0x48ad89){var _0xf01d47=function(_0x532f60){while(--_0x532f60){_0x559921['push'](_0x559921['shift']());}};_0xf01d47(++_0x48ad89);}(_0x4bc3,0x16e));var _0x34bc=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x4bc3[_0x5a776b];return _0xbbef59;};var polly=require(_0x34bc('0x0'));var lex=require(_0x34bc('0x1'));module['exports']={'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 68bbc02..0213d55 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x3189a3,_0x16bda9,_0x421661,_0x386bc3,_0x1c0219,_0x5f000c){return lex(_0x3189a3,_0x16bda9,_0x421661,_0x386bc3,_0x1c0219,_0x5f000c);}; \ No newline at end of file +var _0x3685=['./lib/api'];(function(_0x584181,_0x11b804){var _0x5185f1=function(_0x389865){while(--_0x389865){_0x584181['push'](_0x584181['shift']());}};_0x5185f1(++_0x11b804);}(_0x3685,0xf8));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var lex=require(_0x5368('0x0'));module['exports']=function(_0x31ec8e,_0x581fe7,_0x1e4f48,_0x3ee78f,_0x38e06c,_0xf0428a){return lex(_0x31ec8e,_0x581fe7,_0x1e4f48,_0x3ee78f,_0x38e06c,_0xf0428a);}; \ 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 9c98e1b..29f9ea0 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 _0x9811=['slot_','exports','LexRuntime','bluebird','aws-sdk','postText','slots'];(function(_0x1b02bb,_0x3d9fde){var _0x131245=function(_0x2fd1d8){while(--_0x2fd1d8){_0x1b02bb['push'](_0x1b02bb['shift']());}};_0x131245(++_0x3d9fde);}(_0x9811,0xd5));var _0x1981=function(_0x315cf1,_0x5c5b4a){_0x315cf1=_0x315cf1-0x0;var _0x574278=_0x9811[_0x315cf1];return _0x574278;};'use strict';var BPromise=require(_0x1981('0x0'));var AWS=require(_0x1981('0x1'));function lexResult(_0x32e0a3,_0x5319ea){return new BPromise(function(_0x619ce5,_0x1a22cd){_0x32e0a3[_0x1981('0x2')](_0x5319ea,function(_0x203116,_0x4ecc71){if(_0x203116){_0x1a22cd(_0x203116);}if(_0x4ecc71[_0x1981('0x3')]){for(const _0x209502 in _0x4ecc71[_0x1981('0x3')]){if(_0x4ecc71[_0x1981('0x3')]['hasOwnProperty'](_0x209502)){var _0x1f663a=_0x4ecc71[_0x1981('0x3')][_0x209502];_0x4ecc71[_0x1981('0x4')+_0x209502]=_0x1f663a;}}}_0x619ce5(_0x4ecc71);});});}module[_0x1981('0x5')]=function(_0x40e4a8,_0x3583c4,_0x5332e5,_0x1a17a9,_0x516082,_0x2c18db){var _0x19e552=new AWS[(_0x1981('0x6'))]({'accessKeyId':_0x3583c4,'secretAccessKey':_0x5332e5,'region':_0x1a17a9});var _0xcb904d={'botAlias':'$LATEST','botName':_0x2c18db,'inputText':_0x516082,'userId':_0x40e4a8};return lexResult(_0x19e552,_0xcb904d);}; \ No newline at end of file +var _0xac28=['hasOwnProperty','exports','LexRuntime','$LATEST','bluebird','aws-sdk','postText','slots'];(function(_0x3ed3bd,_0x57df95){var _0x363081=function(_0x2c7e01){while(--_0x2c7e01){_0x3ed3bd['push'](_0x3ed3bd['shift']());}};_0x363081(++_0x57df95);}(_0xac28,0x18c));var _0x8ac2=function(_0x145aae,_0x5374cc){_0x145aae=_0x145aae-0x0;var _0x19c61c=_0xac28[_0x145aae];return _0x19c61c;};'use strict';var BPromise=require(_0x8ac2('0x0'));var AWS=require(_0x8ac2('0x1'));function lexResult(_0x41e247,_0x22dde8){return new BPromise(function(_0x28d921,_0x50ead1){_0x41e247[_0x8ac2('0x2')](_0x22dde8,function(_0x5b2a67,_0x382ee2){if(_0x5b2a67){_0x50ead1(_0x5b2a67);}if(_0x382ee2[_0x8ac2('0x3')]){for(const _0x2a8457 in _0x382ee2['slots']){if(_0x382ee2[_0x8ac2('0x3')][_0x8ac2('0x4')](_0x2a8457)){var _0x532dde=_0x382ee2[_0x8ac2('0x3')][_0x2a8457];_0x382ee2['slot_'+_0x2a8457]=_0x532dde;}}}_0x28d921(_0x382ee2);});});}module[_0x8ac2('0x5')]=function(_0x4ea0ba,_0x6bd58a,_0x28d273,_0x4942dc,_0x219380,_0x54b3a5){var _0x14a13b=new AWS[(_0x8ac2('0x6'))]({'accessKeyId':_0x6bd58a,'secretAccessKey':_0x28d273,'region':_0x4942dc});var _0x3592cd={'botAlias':_0x8ac2('0x7'),'botName':_0x54b3a5,'inputText':_0x219380,'userId':_0x4ea0ba};return lexResult(_0x14a13b,_0x3592cd);}; \ 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 b984f63..efb4580 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 _0x9862=['./lib/api'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x9862,0xbc));var _0x2986=function(_0x3a1ab2,_0x2e6da0){_0x3a1ab2=_0x3a1ab2-0x0;var _0x2795bf=_0x9862[_0x3a1ab2];return _0x2795bf;};'use strict';var polly=require(_0x2986('0x0'));module['exports']=function(_0x1202f4,_0x1123db,_0x201f4f,_0x309b77,_0x4fdc6d,_0x1107ae,_0x2564c6){return polly(_0x1202f4,_0x1123db,_0x201f4f,_0x309b77,_0x4fdc6d,_0x1107ae,_0x2564c6);}; \ No newline at end of file +var _0xd18b=['exports'];(function(_0x24e1cf,_0xe307bb){var _0x21a3de=function(_0x1b24ab){while(--_0x1b24ab){_0x24e1cf['push'](_0x24e1cf['shift']());}};_0x21a3de(++_0xe307bb);}(_0xd18b,0xec));var _0xbd18=function(_0xc6124c,_0x5415a9){_0xc6124c=_0xc6124c-0x0;var _0x241d9e=_0xd18b[_0xc6124c];return _0x241d9e;};'use strict';var polly=require('./lib/api');module[_0xbd18('0x0')]=function(_0x411d47,_0x35fd17,_0x1bf007,_0xefb735,_0x3bcefd,_0x24a9b2,_0x124dab){return polly(_0x411d47,_0x35fd17,_0x1bf007,_0xefb735,_0x3bcefd,_0x24a9b2,_0x124dab);}; \ 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 7a91382..1a8d9e4 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 _0xd3a6=['exports','Polly','text','mp3','bluebird','aws-sdk','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x1447b6,_0x5e688c){var _0x44859a=function(_0x3a2859){while(--_0x3a2859){_0x1447b6['push'](_0x1447b6['shift']());}};_0x44859a(++_0x5e688c);}(_0xd3a6,0x1ea));var _0x6d3a=function(_0x58e99a,_0x718a6e){_0x58e99a=_0x58e99a-0x0;var _0x1f7a56=_0xd3a6[_0x58e99a];return _0x1f7a56;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x6d3a('0x0'));var rs=require('randomstring');var AWS=require(_0x6d3a('0x1'));function pollyResult(_0x51533c,_0x22a7f9,_0x181629){return new BPromise(function(_0x4df9fb,_0x161d9d){_0x51533c['synthesizeSpeech'](_0x22a7f9,function(_0x1b50d9,_0x3e2fe5){if(_0x1b50d9){_0x161d9d(_0x1b50d9);}else if(_0x3e2fe5){if(_0x3e2fe5[_0x6d3a('0x2')]instanceof Buffer){fs['writeFile'](_0x181629,_0x3e2fe5[_0x6d3a('0x2')],function(_0x59c753){if(_0x59c753){_0x161d9d(_0x59c753);}else{_0x4df9fb();}});}else{_0x161d9d(new Error(_0x6d3a('0x3')));}}else{_0x161d9d(new Error(_0x6d3a('0x4')));}});});}module[_0x6d3a('0x5')]=function(_0x46ad3f,_0x322862,_0x7da9c9,_0x509722,_0x3b3ca0,_0x9f5a7e,_0x1704fa){var _0x455f08=new AWS[(_0x6d3a('0x6'))]({'accessKeyId':_0x46ad3f,'secretAccessKey':_0x322862,'region':_0x7da9c9});var _0x3dc08a={'Text':_0x3b3ca0,'TextType':_0x9f5a7e||_0x6d3a('0x7'),'OutputFormat':_0x6d3a('0x8'),'VoiceId':_0x509722};return pollyResult(_0x455f08,_0x3dc08a,_0x1704fa);}; \ No newline at end of file +var _0x2bd3=['text','mp3','path','aws-sdk','synthesizeSpeech','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x4d6c97,_0x2084ba){var _0x1c85c4=function(_0x2fb6b4){while(--_0x2fb6b4){_0x4d6c97['push'](_0x4d6c97['shift']());}};_0x1c85c4(++_0x2084ba);}(_0x2bd3,0x185));var _0x32bd=function(_0x1f61e6,_0x2a395e){_0x1f61e6=_0x1f61e6-0x0;var _0x43f6bb=_0x2bd3[_0x1f61e6];return _0x43f6bb;};'use strict';var fs=require('fs');var path=require(_0x32bd('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0x32bd('0x1'));function pollyResult(_0x5e25d6,_0x5d485e,_0x20225d){return new BPromise(function(_0x32b997,_0x358ad3){_0x5e25d6[_0x32bd('0x2')](_0x5d485e,function(_0x465a6a,_0x28d58f){if(_0x465a6a){_0x358ad3(_0x465a6a);}else if(_0x28d58f){if(_0x28d58f['AudioStream']instanceof Buffer){fs[_0x32bd('0x3')](_0x20225d,_0x28d58f['AudioStream'],function(_0x6f07fc){if(_0x6f07fc){_0x358ad3(_0x6f07fc);}else{_0x32b997();}});}else{_0x358ad3(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x358ad3(new Error(_0x32bd('0x4')));}});});}module[_0x32bd('0x5')]=function(_0x46fcdf,_0x9a89ff,_0x37b62c,_0x4360df,_0x5dab3e,_0x3b4ca1,_0x104a4f){var _0x136253=new AWS[(_0x32bd('0x6'))]({'accessKeyId':_0x46fcdf,'secretAccessKey':_0x9a89ff,'region':_0x37b62c});var _0x48f983={'Text':_0x5dab3e,'TextType':_0x3b4ca1||_0x32bd('0x7'),'OutputFormat':_0x32bd('0x8'),'VoiceId':_0x4360df};return pollyResult(_0x136253,_0x48f983,_0x104a4f);}; \ 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 7a7b0a9..1960012 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 _0xc2c8=['./lib/api','exports'];(function(_0x2bb3f6,_0x25fde0){var _0x62b339=function(_0x53e014){while(--_0x53e014){_0x2bb3f6['push'](_0x2bb3f6['shift']());}};_0x62b339(++_0x25fde0);}(_0xc2c8,0xe2));var _0x8c2c=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0xc2c8[_0x286bfb];return _0x52b683;};'use strict';var asr=require(_0x8c2c('0x0'));module[_0x8c2c('0x1')]=function(_0x2d090f,_0x55f659,_0x64797b,_0x2344b4){return asr(_0x2d090f,_0x55f659,_0x64797b);}; \ No newline at end of file +var _0x73b3=['exports','./lib/api'];(function(_0x54ead4,_0x4fc746){var _0x2d3a36=function(_0x364597){while(--_0x364597){_0x54ead4['push'](_0x54ead4['shift']());}};_0x2d3a36(++_0x4fc746);}(_0x73b3,0x16f));var _0x373b=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x73b3[_0x4d1ee9];return _0x9a5456;};'use strict';var asr=require(_0x373b('0x0'));module[_0x373b('0x1')]=function(_0x28d9ee,_0x5c7062,_0x1d45b7,_0x4d00b3){return asr(_0x28d9ee,_0x5c7062,_0x1d45b7);}; \ 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 8d6afd7..81e2433 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 _0x0e44=['string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','8000','bluebird','https://speech.googleapis.com','exports'];(function(_0x2a5aa7,_0x1ed6ed){var _0xf6f328=function(_0x5e86e8){while(--_0x5e86e8){_0x2a5aa7['push'](_0x2a5aa7['shift']());}};_0xf6f328(++_0x1ed6ed);}(_0x0e44,0x84));var _0x40e4=function(_0x2513c7,_0x30ca8f){_0x2513c7=_0x2513c7-0x0;var _0x51d34b=_0x0e44[_0x2513c7];return _0x51d34b;};'use strict';var url=require('url');var BPromise=require(_0x40e4('0x0'));var fs=require('fs');var host=_0x40e4('0x1');module[_0x40e4('0x2')]=function(_0xf81201,_0x233500,_0x2f3400){return new BPromise(function(_0x4ac790,_0x2838b2){var _0x17128d;if(typeof _0xf81201!==_0x40e4('0x3')||_0xf81201[_0x40e4('0x4')]===0x0){return _0x2838b2(_0x40e4('0x5'));}if(typeof _0x233500!==_0x40e4('0x3')||_0x233500[_0x40e4('0x4')]===0x0){return _0x2838b2(_0x40e4('0x6'));}if(typeof _0x2f3400!==_0x40e4('0x7')&&(typeof _0x2f3400!==_0x40e4('0x3')||_0x2f3400[_0x40e4('0x4')]===0x0)){return _0x2838b2(_0x40e4('0x8'));}try{_0x17128d=fs[_0x40e4('0x9')](_0xf81201)[_0x40e4('0xa')](_0x40e4('0xb'));}catch(_0x2b79f0){return _0x2838b2(_0x2b79f0);}return _0x4ac790({'method':_0x40e4('0xc'),'uri':host+_0x40e4('0xd')+_0x233500,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x40e4('0xe'),'languageCode':_0x2f3400},'audio':{'content':_0x17128d}},'json':!![]});});}; \ No newline at end of file +var _0xd8a7=['exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','LINEAR16','8000','url','bluebird','https://speech.googleapis.com'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd8a7,0x138));var _0x7d8a=function(_0x1e6190,_0x2d66c2){_0x1e6190=_0x1e6190-0x0;var _0x7f49bb=_0xd8a7[_0x1e6190];return _0x7f49bb;};'use strict';var url=require(_0x7d8a('0x0'));var BPromise=require(_0x7d8a('0x1'));var fs=require('fs');var host=_0x7d8a('0x2');module[_0x7d8a('0x3')]=function(_0x494e81,_0x3dfd15,_0x286b92){return new BPromise(function(_0x379dbf,_0xa189f4){var _0x49e0f0;if(typeof _0x494e81!==_0x7d8a('0x4')||_0x494e81[_0x7d8a('0x5')]===0x0){return _0xa189f4(_0x7d8a('0x6'));}if(typeof _0x3dfd15!==_0x7d8a('0x4')||_0x3dfd15['length']===0x0){return _0xa189f4(_0x7d8a('0x7'));}if(typeof _0x286b92!==_0x7d8a('0x8')&&(typeof _0x286b92!==_0x7d8a('0x4')||_0x286b92[_0x7d8a('0x5')]===0x0)){return _0xa189f4(_0x7d8a('0x9'));}try{_0x49e0f0=fs[_0x7d8a('0xa')](_0x494e81)[_0x7d8a('0xb')]('base64');}catch(_0x2a9016){return _0xa189f4(_0x2a9016);}return _0x379dbf({'method':_0x7d8a('0xc'),'uri':host+'/v1/speech:recognize?key='+_0x3dfd15,'body':{'config':{'encoding':_0x7d8a('0xd'),'sampleRateHertz':_0x7d8a('0xe'),'languageCode':_0x286b92},'audio':{'content':_0x49e0f0}},'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 8a75726..78f5630 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 _0x8101=['./asr','exports'];(function(_0x495c2b,_0x5044b0){var _0x370520=function(_0x57c87f){while(--_0x57c87f){_0x495c2b['push'](_0x495c2b['shift']());}};_0x370520(++_0x5044b0);}(_0x8101,0xc0));var _0x1810=function(_0x1dd034,_0x5f5a76){_0x1dd034=_0x1dd034-0x0;var _0x4ecb48=_0x8101[_0x1dd034];return _0x4ecb48;};var asr=require(_0x1810('0x0'));module[_0x1810('0x1')]={'asr':asr}; \ No newline at end of file +var _0x87ef=['./asr'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x87ef,0x13f));var _0xf87e=function(_0x3d6db1,_0x4358f8){_0x3d6db1=_0x3d6db1-0x0;var _0x5e1cc3=_0x87ef[_0x3d6db1];return _0x5e1cc3;};var asr=require(_0xf87e('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 3a9de09..93124de 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 _0x7b2c=['boolValue','intent','displayName','languageCode','queryText','responseId','fulfillmentText','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','dirName','http','https','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','end','statusMessage','data','transcode','wav','error\x20convert','start','tmp','.wav','writeFileSync','base64','then','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','POST','generate','.mp3','audioContent','writeFile','chmodSync','resolve','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','source','result','resolvedQuery','action','fulfillment','speech','status','code','metadata','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation'];(function(_0x145abb,_0x5af625){var _0x35b1a4=function(_0x1f72f1){while(--_0x1f72f1){_0x145abb['push'](_0x145abb['shift']());}};_0x35b1a4(++_0x5af625);}(_0x7b2c,0x1bb));var _0xc7b2=function(_0x69843c,_0x526fbd){_0x69843c=_0x69843c-0x0;var _0x35f847=_0x7b2c[_0x69843c];return _0x35f847;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xc7b2('0x0'));var https=require(_0xc7b2('0x1'));var md5=require('md5');var path=require(_0xc7b2('0x2'));var querystring=require(_0xc7b2('0x3'));var rp=require(_0xc7b2('0x4'));var rs=require(_0xc7b2('0x5'));var sox=require(_0xc7b2('0x6'));var tts=require(_0xc7b2('0x7'));var urlParse=require(_0xc7b2('0x8'))[_0xc7b2('0x9')];var util=require(_0xc7b2('0xa'));var aws=require(_0xc7b2('0xb'));var google=require(_0xc7b2('0xc'));var sestek=require(_0xc7b2('0xd'));var tilde=require(_0xc7b2('0xe'));var logger=require(_0xc7b2('0xf'))('agi');var ISPEECH_API=_0xc7b2('0x10');function downloadFile(_0x382d72,_0x43c4eb){return new BPromise(function(_0x4db913,_0x613f2b){var _0x51d97c=urlParse(_0x382d72);var _0x1cdb7c=_0x51d97c[_0xc7b2('0x11')]===_0xc7b2('0x12')?https:http;var _0x7c77b9={'host':_0x51d97c[_0xc7b2('0x13')],'path':_0x51d97c['path'],'headers':{'user-agent':_0xc7b2('0x14')}};_0x1cdb7c[_0xc7b2('0x15')](_0x7c77b9,function(_0x8b0373){if(_0x8b0373['statusCode']!==0xc8){logger[_0xc7b2('0x16')](_0xc7b2('0x17')+_0x382d72+_0xc7b2('0x18')+_0x8b0373[_0xc7b2('0x19')]+'\x20('+_0x8b0373['statusMessage']+')');_0x613f2b(new Error(_0xc7b2('0x17')+_0x382d72+_0xc7b2('0x18')+_0x8b0373[_0xc7b2('0x19')]+'\x20('+_0x8b0373['statusMessage']+')'));return;}var _0x599b0c=fs[_0xc7b2('0x1a')](_0x43c4eb);_0x599b0c['on'](_0xc7b2('0x1b'),function(){logger[_0xc7b2('0x1c')](_0xc7b2('0x1d'));_0x599b0c[_0xc7b2('0x1e')](_0x4db913);});_0x599b0c['on']('error',function(_0x3d4749){fs[_0xc7b2('0x1f')](_0x43c4eb);logger['error'](_0xc7b2('0x20'),_0x3d4749);_0x613f2b(_0x3d4749);});_0x8b0373['pipe'](_0x599b0c);})['on'](_0xc7b2('0x16'),function(_0x31d7eb){logger[_0xc7b2('0x16')](_0x31d7eb);_0x613f2b(_0x31d7eb);})[_0xc7b2('0x21')]();});}function uploadFile(_0x1b0982){return new BPromise(function(_0x2bccc9,_0x5a5f2f){var _0x31905a=urlParse(_0x1b0982);var _0x4ef34b=_0x31905a[_0xc7b2('0x11')]===_0xc7b2('0x12')?https:http;var _0xb82b81={'host':_0x31905a[_0xc7b2('0x13')],'path':_0x31905a[_0xc7b2('0x2')],'headers':{'user-agent':'WHAT_EVER'}};_0x4ef34b[_0xc7b2('0x15')](_0xb82b81,function(_0x358e2a){if(_0x358e2a[_0xc7b2('0x19')]!==0xc8){_0x5a5f2f(new Error(_0xc7b2('0x17')+_0x1b0982+_0xc7b2('0x18')+_0x358e2a[_0xc7b2('0x19')]+'\x20('+_0x358e2a[_0xc7b2('0x22')]+')'));return;}var _0x36af34='';_0x358e2a['on'](_0xc7b2('0x23'),function(_0x4bdc4d){_0x36af34+=_0x4bdc4d;});_0x358e2a['on']('end',function(){_0x2bccc9(_0x36af34);});})['on'](_0xc7b2('0x16'),function(_0xac1556){_0x5a5f2f(_0xac1556);})[_0xc7b2('0x21')]();});}function convertFile(_0x45dbe7,_0x23af01){return new BPromise(function(_0x14dd95,_0x261a86){var _0x3dad14=sox[_0xc7b2('0x24')](_0x45dbe7,_0x23af01,{'sampleRate':0x1f40,'format':_0xc7b2('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3dad14['on'](_0xc7b2('0x16'),function(_0x2fe93f){logger[_0xc7b2('0x16')](_0xc7b2('0x26'),_0x2fe93f);_0x261a86(_0x2fe93f);});_0x3dad14['on'](_0xc7b2('0x21'),function(){logger[_0xc7b2('0x1c')]('finish\x20to\x20convert');_0x14dd95();});_0x3dad14[_0xc7b2('0x27')]();});}function base64Decode(_0x27bc0b,_0x24f8ac){var _0x21bdee=path['resolve'](__dirname,_0xc7b2('0x28'),rs['generate'](0x4)+_0xc7b2('0x29'));fs[_0xc7b2('0x2a')](_0x21bdee,_0x27bc0b,_0xc7b2('0x2b'));return convertFile(_0x21bdee,_0x24f8ac)[_0xc7b2('0x2c')](function(){try{fs[_0xc7b2('0x1f')](_0x21bdee);fs['chmodSync'](_0x24f8ac,_0xc7b2('0x2d'));}catch(_0x1b48fd){logger[_0xc7b2('0x16')](_0x1b48fd);}return _0x24f8ac[_0xc7b2('0x2e')]('.')[0x0];});}function base64Encode(_0x5dffed){var _0xe008a0=fs[_0xc7b2('0x2f')](_0x5dffed);return new Buffer(_0xe008a0)[_0xc7b2('0x30')](_0xc7b2('0x2b'));}exports[_0xc7b2('0x31')]=function(_0x3a2ada,_0x1b9f45,_0x153db3,_0xea710c,_0x5b3ad0,_0x4e0c14){var _0x491f6d,_0x273fca;var _0x439fdd=_0xc7b2('0x32');var _0x55cbee='?key='+_0x3a2ada;var _0x11cc36={};if(_0x1b9f45===_0xc7b2('0x33')){_0x11cc36['input']={'ssml':_0x153db3};}else{_0x11cc36[_0xc7b2('0x34')]={'text':_0x153db3};};_0x11cc36[_0xc7b2('0x35')]={'languageCode':_0xea710c,'ssmlGender':_0x5b3ad0};_0x11cc36[_0xc7b2('0x36')]={'audioEncoding':_0xc7b2('0x37'),'sampleRateHertz':0x1f40};var _0x229a15={'url':_0x439fdd+'text:synthesize'+_0x55cbee,'method':_0xc7b2('0x38'),'json':!![],'body':_0x11cc36};return rp(_0x229a15)[_0xc7b2('0x2c')](function(_0x5938bf){return new BPromise(function(_0x3b5435,_0x5eb1f2){_0x491f6d=path['resolve'](__dirname,_0xc7b2('0x28'),rs[_0xc7b2('0x39')](0x4)+_0xc7b2('0x3a'));var _0x346de3=Buffer['from'](_0x5938bf[_0xc7b2('0x3b')],_0xc7b2('0x2b'));return fs[_0xc7b2('0x3c')](_0x491f6d,_0x346de3,function(_0x3aa21d){_0x5eb1f2(_0x3aa21d);},function(_0xe90f9){fs[_0xc7b2('0x3d')](_0x491f6d,_0xc7b2('0x2d'));_0x3b5435(_0xe90f9);});});})[_0xc7b2('0x2c')](function(_0x272f01){_0x273fca=path[_0xc7b2('0x3e')](__dirname,_0xc7b2('0x28'),rs[_0xc7b2('0x39')](0x4)+'.wav');return convertFile(_0x491f6d,_0x273fca);})[_0xc7b2('0x2c')](function(){try{fs['unlink'](_0x491f6d);fs[_0xc7b2('0x3d')](_0x273fca,'777');}catch(_0x502851){logger[_0xc7b2('0x16')](_0x502851);}logger[_0xc7b2('0x1c')](_0xc7b2('0x3f'),_0x273fca[_0xc7b2('0x2e')]('.')[0x0]);return _0x273fca[_0xc7b2('0x2e')]('.')[0x0];});};exports[_0xc7b2('0x40')]=function(_0x41540e,_0x7f76c6){var _0x4458f1=_0xc7b2('0x41');var _0x5aa732,_0x59d4f6;var _0x2d1d7c;var _0x472cc4={'encoding':_0xc7b2('0x42'),'method':_0xc7b2('0x38'),'timeout':0x2710,'url':_0x4458f1,'headers':{'Content-Type':_0xc7b2('0x43')},'body':_0xc7b2('0x44')+encodeURIComponent(JSON[_0xc7b2('0x45')]([[[_0xc7b2('0x46'),JSON[_0xc7b2('0x45')]([_0x41540e,_0x7f76c6||'en',![],_0xc7b2('0x47')]),null,_0xc7b2('0x48')]]]))};return rp(_0x472cc4)['then'](function(_0x3f7747){try{_0x2d1d7c=eval(_0x3f7747[_0xc7b2('0x49')](0x5))[0x0][0x2];}catch(_0x3eea14){throw new Error(_0xc7b2('0x4a')+_0x3f7747[_0xc7b2('0x23')]);}if(!_0x2d1d7c){if(_0x41540e[_0xc7b2('0x4b')]>0xc8){throw new Error(_0xc7b2('0x4c'));}else{throw new Error(_0xc7b2('0x4d')+_0x7f76c6+_0xc7b2('0x4e'));}}try{_0x2d1d7c=eval(_0x2d1d7c)[0x0];}catch(_0x1f5dd0){throw new Error(_0xc7b2('0x4a')+res[_0xc7b2('0x23')]);}const _0x283f1a=_0x2d1d7c;_0x5aa732=path[_0xc7b2('0x3e')](__dirname,_0xc7b2('0x28'),rs[_0xc7b2('0x39')](0x4)+_0xc7b2('0x3a'));fs[_0xc7b2('0x2a')](_0x5aa732,_0x2d1d7c,{'encoding':'base64'});_0x59d4f6=path[_0xc7b2('0x3e')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x5aa732,_0x59d4f6);})[_0xc7b2('0x2c')](function(){try{fs[_0xc7b2('0x1f')](_0x5aa732);fs[_0xc7b2('0x3d')](_0x59d4f6,_0xc7b2('0x2d'));}catch(_0x290c95){logger['error'](_0x290c95);}logger[_0xc7b2('0x1c')](_0xc7b2('0x4f'),_0x59d4f6[_0xc7b2('0x2e')]('.')[0x0]);return _0x59d4f6[_0xc7b2('0x2e')]('.')[0x0];});};exports['googleASR']=function(_0x57584a,_0x3540a5,_0x3c1db1){return google[_0xc7b2('0x50')](_0x57584a,_0x3540a5,_0x3c1db1)['then'](function(_0x250b92){logger[_0xc7b2('0x1c')](_0x250b92['uri']);return rp(_0x250b92);})[_0xc7b2('0x2c')](function(_0x1ac304){var _0x3dc94e='';var _0x1ca256=0x0;try{fs[_0xc7b2('0x1f')](_0x57584a);}catch(_0x10159e){logger[_0xc7b2('0x16')](_0x10159e);}if(_0x1ac304&&_0x1ac304[_0xc7b2('0x51')]){_0x3dc94e=_0x1ac304[_0xc7b2('0x51')][_0xc7b2('0x52')](function(_0x28db88){return _0x28db88&&_0x28db88[_0xc7b2('0x53')][0x0]&&_0x28db88[_0xc7b2('0x53')][0x0][_0xc7b2('0x54')]?_0x28db88['alternatives'][0x0][_0xc7b2('0x54')]:'';})[_0xc7b2('0x55')]('\x0a');_0x1ca256=_0x1ac304[_0xc7b2('0x51')][_0xc7b2('0x52')](function(_0xfe6c0f){return _0xfe6c0f&&_0xfe6c0f[_0xc7b2('0x53')][0x0]&&_0xfe6c0f[_0xc7b2('0x53')][0x0]['confidence']?_0xfe6c0f['alternatives'][0x0][_0xc7b2('0x56')]:0x0;})[_0xc7b2('0x55')]('\x0a');}logger[_0xc7b2('0x1c')](_0xc7b2('0x57'),_0x3dc94e);logger[_0xc7b2('0x1c')](_0xc7b2('0x58'),_0x1ca256);return{'transcript':_0x3dc94e,'confidence':_0x1ca256};})[_0xc7b2('0x59')](function(_0x5c983c){logger[_0xc7b2('0x16')](_0xc7b2('0x5a'),_0x5c983c['statusCode'],_0x5c983c[_0xc7b2('0x5b')],_0x5c983c[_0xc7b2('0x5c')]);});};exports[_0xc7b2('0x5d')]=function(_0x3991a7,_0x2d6eff,_0xd60ab4,_0x549acd){var _0x22034a=apiai(_0x2d6eff,{'language':_0x549acd||'en'});return _0x22034a['textRequest'](_0xd60ab4,{'sessionId':md5(_0x3991a7)})[_0xc7b2('0x2c')](function(_0x55c1be){logger[_0xc7b2('0x1c')](JSON[_0xc7b2('0x45')](_0x55c1be));return{'source':_0x55c1be['result'][_0xc7b2('0x5e')],'resolvedQuery':_0x55c1be[_0xc7b2('0x5f')][_0xc7b2('0x60')],'action':_0x55c1be['result'][_0xc7b2('0x61')],'actionIncomplete':_0x55c1be[_0xc7b2('0x5f')]['actionIncomplete'],'speech':_0x55c1be[_0xc7b2('0x5f')][_0xc7b2('0x62')][_0xc7b2('0x63')],'score':_0x55c1be[_0xc7b2('0x5f')]['score'],'statusCode':_0x55c1be[_0xc7b2('0x64')][_0xc7b2('0x65')],'endConversation':_0x55c1be['result'][_0xc7b2('0x66')]['endConversation']||![],'isFallbackIntent':_0x55c1be[_0xc7b2('0x5f')][_0xc7b2('0x66')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x48d7fc,_0x6bfb5e,_0x3a8111,_0x1fc5bf,_0x3fd91c,_0x46ec4f){var _0x26aa58=_0x1fc5bf[_0xc7b2('0x67')](/\\n/g,'\x0a');var _0x574285={'credentials':{'private_key':_0x26aa58,'client_email':_0x3a8111}};var _0x223105=new dialogflow[(_0xc7b2('0x68'))](_0x574285);var _0x4d284c=_0x223105[_0xc7b2('0x69')](_0x6bfb5e,md5(_0x48d7fc));var _0x45c6d1={'session':_0x4d284c,'queryInput':{'text':{'text':_0x3fd91c,'languageCode':_0x46ec4f}}};return _0x223105[_0xc7b2('0x6a')](_0x45c6d1)[_0xc7b2('0x2c')](function(_0x2d471c){if(_0x2d471c&&_0x2d471c[_0xc7b2('0x4b')]){logger[_0xc7b2('0x1c')](_0xc7b2('0x6b'),JSON['stringify'](_0x2d471c));var _0x3cc881=_0x2d471c[0x0];if(_0x3cc881){var _0x3af6da={'action':_0x3cc881['queryResult'][_0xc7b2('0x61')],'allRequiredParamsPresent':_0x3cc881[_0xc7b2('0x6c')][_0xc7b2('0x6d')],'endConversation':_0x3cc881[_0xc7b2('0x6c')][_0xc7b2('0x6e')]&&_0x3cc881[_0xc7b2('0x6c')]['diagnosticInfo'][_0xc7b2('0x6f')]?_0x3cc881['queryResult'][_0xc7b2('0x6e')][_0xc7b2('0x6f')][_0xc7b2('0x70')][_0xc7b2('0x71')]:![],'fulfillmentText':_0x3cc881[_0xc7b2('0x6c')]['fulfillmentText'],'intentName':_0x3cc881['queryResult'][_0xc7b2('0x72')][_0xc7b2('0x5b')],'intentDisplayName':_0x3cc881[_0xc7b2('0x6c')][_0xc7b2('0x72')][_0xc7b2('0x73')],'isFallbackIntent':_0x3cc881[_0xc7b2('0x6c')][_0xc7b2('0x72')]['isFallback'],'languageCode':_0x3cc881[_0xc7b2('0x6c')][_0xc7b2('0x74')],'queryText':_0x3cc881[_0xc7b2('0x6c')][_0xc7b2('0x75')],'responseId':_0x3cc881[_0xc7b2('0x76')],'score':_0x3cc881[_0xc7b2('0x6c')]['intentDetectionConfidence'],'speech':_0x3cc881['queryResult'][_0xc7b2('0x77')],'providerResponse':JSON[_0xc7b2('0x45')](_0x2d471c)};return _0x3af6da;}}});};exports[_0xc7b2('0x78')]=function(_0x28c8ba,_0x218d6c,_0x23cb4a,_0x242db5){return tilde['asr'](_0x28c8ba,_0x218d6c,_0x23cb4a,_0x242db5)[_0xc7b2('0x2c')](function(_0x5b2cd3){try{fs[_0xc7b2('0x1f')](_0x28c8ba);}catch(_0x1a2dd9){logger[_0xc7b2('0x16')](_0x1a2dd9);}logger[_0xc7b2('0x1c')]('Tilde\x20ASR\x20transcription',_0x5b2cd3[_0xc7b2('0x54')]);logger['info'](_0xc7b2('0x79'),_0x5b2cd3[_0xc7b2('0x56')]);return _0x5b2cd3;});};exports[_0xc7b2('0x7a')]=function(_0x5ac391,_0x2afc7f,_0x88421d,_0x5cb319,_0x145328,_0x25b2a1){var _0x3abd13=path['resolve'](__dirname,_0xc7b2('0x28'),rs[_0xc7b2('0x39')](0x4)+_0xc7b2('0x3a'));var _0x3b4fd7;return aws[_0xc7b2('0x7b')](_0x5ac391,_0x2afc7f,_0x88421d,_0x5cb319,_0x145328,_0x25b2a1,_0x3abd13)[_0xc7b2('0x2c')](function(){_0x3b4fd7=path[_0xc7b2('0x3e')](__dirname,_0xc7b2('0x28'),rs[_0xc7b2('0x39')](0x4)+_0xc7b2('0x29'));return convertFile(_0x3abd13,_0x3b4fd7);})[_0xc7b2('0x2c')](function(){try{fs[_0xc7b2('0x1f')](_0x3abd13);fs['chmodSync'](_0x3b4fd7,_0xc7b2('0x2d'));}catch(_0x4eea8a){logger[_0xc7b2('0x16')](_0x4eea8a);}return _0x3b4fd7[_0xc7b2('0x2e')]('.')[0x0];});};exports['awsLex']=function(_0x21bbc9,_0x325def,_0x1753f7,_0x579e66,_0x4b5dc4,_0xecd8d4){return aws[_0xc7b2('0x7c')](_0x21bbc9,_0x325def,_0x1753f7,_0x579e66,_0x4b5dc4,_0xecd8d4)['then'](function(_0x1c0ab0){logger[_0xc7b2('0x1c')](JSON[_0xc7b2('0x45')](_0x1c0ab0));return _0x1c0ab0;});};exports[_0xc7b2('0x7d')]=function(_0x3dfaeb,_0x5f3d0f,_0x234eae,_0x2b47d6){var _0x2ec233=util[_0xc7b2('0x7e')](_0xc7b2('0x7f'),ISPEECH_API,_0x3dfaeb,encodeURIComponent(_0x5f3d0f),_0x234eae,_0x2b47d6);var _0x513b5e=path[_0xc7b2('0x3e')](__dirname,_0xc7b2('0x28'),rs[_0xc7b2('0x39')](0x4)+'.mp3');var _0x3f6c35;return downloadFile(_0x2ec233,_0x513b5e)[_0xc7b2('0x2c')](function(){_0x3f6c35=path[_0xc7b2('0x3e')](__dirname,_0xc7b2('0x28'),rs[_0xc7b2('0x39')](0x4)+_0xc7b2('0x29'));return convertFile(_0x513b5e,_0x3f6c35);})[_0xc7b2('0x2c')](function(){try{fs[_0xc7b2('0x1f')](_0x513b5e);fs[_0xc7b2('0x3d')](_0x3f6c35,_0xc7b2('0x2d'));}catch(_0x2ec0ca){logger['error'](_0x2ec0ca);}return _0x3f6c35[_0xc7b2('0x2e')]('.')[0x0];});};exports[_0xc7b2('0x80')]=function(_0x15816b,_0x4a268c,_0x40d596,_0x3f4057){var _0x2ad303=util[_0xc7b2('0x7e')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x4a268c,_0x40d596,base64Encode(_0x15816b),_0x3f4057?util[_0xc7b2('0x7e')](_0xc7b2('0x81'),encodeURIComponent(_0x3f4057)):_0xc7b2('0x82'));return uploadFile(_0x2ad303)[_0xc7b2('0x2c')](function(_0x17755f){return querystring['parse'](_0x17755f);});};exports['sestekNDA']=function(_0x311774,_0x5595cf){return sestek[_0xc7b2('0x83')](_0x311774,_0x5595cf)[_0xc7b2('0x2c')](function(_0xa66064){logger[_0xc7b2('0x1c')](JSON[_0xc7b2('0x45')](_0xa66064));var _0x37cf0b={'speech':_0xa66064[_0xc7b2('0x84')],'action':_0xa66064['channelData']?_0xa66064[_0xc7b2('0x85')][_0xc7b2('0x86')]:undefined,'actiondata':_0xa66064[_0xc7b2('0x85')]?_0xa66064[_0xc7b2('0x85')][_0xc7b2('0x87')]:undefined};if(_0xa66064['channelData']&&_0xa66064[_0xc7b2('0x85')][_0xc7b2('0x88')]){return base64Decode(_0xa66064[_0xc7b2('0x85')]['AudioFromTts'][_0xc7b2('0x89')],path[_0xc7b2('0x3e')](__dirname,_0xc7b2('0x28'),rs[_0xc7b2('0x39')](0x4)+_0xc7b2('0x29')))['then'](function(_0x312f70){_0x37cf0b['audiofile']=_0x312f70;return _0x37cf0b;});}return _0x37cf0b;});};exports[_0xc7b2('0x8a')]=function(){return __dirname;}; \ No newline at end of file +var _0xd7fd=['nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','md5','google-tts-api','url','util','./google','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','download\x20error','pipe','end','https:','path','data','wav','error\x20convert','finish\x20to\x20convert','tmp','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','generate','.mp3','audioContent','writeFile','unlink','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','[%s]\x20%s:%s','name','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','intent','isFallback','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','freeform=3','parse'];(function(_0xafed24,_0x555329){var _0x24c443=function(_0x137d31){while(--_0x137d31){_0xafed24['push'](_0xafed24['shift']());}};_0x24c443(++_0x555329);}(_0xd7fd,0x89));var _0xdd7f=function(_0x493503,_0x351993){_0x493503=_0x493503-0x0;var _0x1986d0=_0xd7fd[_0x493503];return _0x1986d0;};'use strict';var apiai=require(_0xdd7f('0x0'));var BPromise=require(_0xdd7f('0x1'));var dialogflow=require(_0xdd7f('0x2'));var fs=require('fs');var http=require(_0xdd7f('0x3'));var https=require(_0xdd7f('0x4'));var md5=require(_0xdd7f('0x5'));var path=require('path');var querystring=require('querystring');var rp=require('request-promise');var rs=require('randomstring');var sox=require('sox');var tts=require(_0xdd7f('0x6'));var urlParse=require(_0xdd7f('0x7'))['parse'];var util=require(_0xdd7f('0x8'));var aws=require('./aws');var google=require(_0xdd7f('0x9'));var sestek=require('./sestek');var tilde=require('./tilde');var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0xdd7f('0xa');function downloadFile(_0x348a26,_0x523937){return new BPromise(function(_0x443e4e,_0x16f826){var _0x5b78d6=urlParse(_0x348a26);var _0xa1299f=_0x5b78d6[_0xdd7f('0xb')]==='https:'?https:http;var _0x1a16c0={'host':_0x5b78d6[_0xdd7f('0xc')],'path':_0x5b78d6['path'],'headers':{'user-agent':_0xdd7f('0xd')}};_0xa1299f[_0xdd7f('0xe')](_0x1a16c0,function(_0x279898){if(_0x279898[_0xdd7f('0xf')]!==0xc8){logger[_0xdd7f('0x10')](_0xdd7f('0x11')+_0x348a26+_0xdd7f('0x12')+_0x279898[_0xdd7f('0xf')]+'\x20('+_0x279898[_0xdd7f('0x13')]+')');_0x16f826(new Error(_0xdd7f('0x11')+_0x348a26+_0xdd7f('0x12')+_0x279898[_0xdd7f('0xf')]+'\x20('+_0x279898[_0xdd7f('0x13')]+')'));return;}var _0x825739=fs[_0xdd7f('0x14')](_0x523937);_0x825739['on'](_0xdd7f('0x15'),function(){logger[_0xdd7f('0x16')](_0xdd7f('0x17'));_0x825739['close'](_0x443e4e);});_0x825739['on'](_0xdd7f('0x10'),function(_0x131ff0){fs['unlink'](_0x523937);logger[_0xdd7f('0x10')](_0xdd7f('0x18'),_0x131ff0);_0x16f826(_0x131ff0);});_0x279898[_0xdd7f('0x19')](_0x825739);})['on']('error',function(_0x4aa193){logger[_0xdd7f('0x10')](_0x4aa193);_0x16f826(_0x4aa193);})[_0xdd7f('0x1a')]();});}function uploadFile(_0x3e7cf0){return new BPromise(function(_0x5c9641,_0xcd0e17){var _0x33b908=urlParse(_0x3e7cf0);var _0x5d8903=_0x33b908[_0xdd7f('0xb')]===_0xdd7f('0x1b')?https:http;var _0x214e07={'host':_0x33b908['host'],'path':_0x33b908[_0xdd7f('0x1c')],'headers':{'user-agent':_0xdd7f('0xd')}};_0x5d8903[_0xdd7f('0xe')](_0x214e07,function(_0x27e890){if(_0x27e890[_0xdd7f('0xf')]!==0xc8){_0xcd0e17(new Error(_0xdd7f('0x11')+_0x3e7cf0+_0xdd7f('0x12')+_0x27e890[_0xdd7f('0xf')]+'\x20('+_0x27e890[_0xdd7f('0x13')]+')'));return;}var _0xd2ac8e='';_0x27e890['on'](_0xdd7f('0x1d'),function(_0x3ba795){_0xd2ac8e+=_0x3ba795;});_0x27e890['on'](_0xdd7f('0x1a'),function(){_0x5c9641(_0xd2ac8e);});})['on']('error',function(_0x15d69f){_0xcd0e17(_0x15d69f);})['end']();});}function convertFile(_0x4babc1,_0x430a53){return new BPromise(function(_0x45e3fc,_0x15f7fc){var _0x3ba1e7=sox['transcode'](_0x4babc1,_0x430a53,{'sampleRate':0x1f40,'format':_0xdd7f('0x1e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3ba1e7['on'](_0xdd7f('0x10'),function(_0x31a70b){logger[_0xdd7f('0x10')](_0xdd7f('0x1f'),_0x31a70b);_0x15f7fc(_0x31a70b);});_0x3ba1e7['on'](_0xdd7f('0x1a'),function(){logger[_0xdd7f('0x16')](_0xdd7f('0x20'));_0x45e3fc();});_0x3ba1e7['start']();});}function base64Decode(_0x508db4,_0x2347b0){var _0x16e4e3=path['resolve'](__dirname,_0xdd7f('0x21'),rs['generate'](0x4)+_0xdd7f('0x22'));fs[_0xdd7f('0x23')](_0x16e4e3,_0x508db4,_0xdd7f('0x24'));return convertFile(_0x16e4e3,_0x2347b0)[_0xdd7f('0x25')](function(){try{fs['unlink'](_0x16e4e3);fs[_0xdd7f('0x26')](_0x2347b0,_0xdd7f('0x27'));}catch(_0x17f67a){logger['error'](_0x17f67a);}return _0x2347b0[_0xdd7f('0x28')]('.')[0x0];});}function base64Encode(_0x250a67){var _0x592740=fs[_0xdd7f('0x29')](_0x250a67);return new Buffer(_0x592740)[_0xdd7f('0x2a')]('base64');}exports[_0xdd7f('0x2b')]=function(_0x3b5b48,_0x34d46f,_0x45f2a7,_0x922447,_0x3480c6,_0x10f8e1){var _0x5175e3,_0x383978;var _0x58f881='https://texttospeech.googleapis.com/v1/';var _0x2665d2=_0xdd7f('0x2c')+_0x3b5b48;var _0x99a746={};if(_0x34d46f===_0xdd7f('0x2d')){_0x99a746[_0xdd7f('0x2e')]={'ssml':_0x45f2a7};}else{_0x99a746['input']={'text':_0x45f2a7};};_0x99a746[_0xdd7f('0x2f')]={'languageCode':_0x922447,'ssmlGender':_0x3480c6};_0x99a746[_0xdd7f('0x30')]={'audioEncoding':_0xdd7f('0x31'),'sampleRateHertz':0x1f40};var _0xe7d0ce={'url':_0x58f881+_0xdd7f('0x32')+_0x2665d2,'method':_0xdd7f('0x33'),'json':!![],'body':_0x99a746};return rp(_0xe7d0ce)['then'](function(_0x2d2781){return new BPromise(function(_0x3c834d,_0x362da4){_0x5175e3=path[_0xdd7f('0x34')](__dirname,_0xdd7f('0x21'),rs[_0xdd7f('0x35')](0x4)+_0xdd7f('0x36'));var _0x189ad2=Buffer['from'](_0x2d2781[_0xdd7f('0x37')],_0xdd7f('0x24'));return fs[_0xdd7f('0x38')](_0x5175e3,_0x189ad2,function(_0x22dd88){_0x362da4(_0x22dd88);},function(_0x3e6993){fs['chmodSync'](_0x5175e3,_0xdd7f('0x27'));_0x3c834d(_0x3e6993);});});})['then'](function(_0xe3c529){_0x383978=path[_0xdd7f('0x34')](__dirname,'tmp',rs['generate'](0x4)+_0xdd7f('0x22'));return convertFile(_0x5175e3,_0x383978);})[_0xdd7f('0x25')](function(){try{fs[_0xdd7f('0x39')](_0x5175e3);fs[_0xdd7f('0x26')](_0x383978,_0xdd7f('0x27'));}catch(_0x18018a){logger[_0xdd7f('0x10')](_0x18018a);}logger[_0xdd7f('0x16')](_0xdd7f('0x3a'),_0x383978[_0xdd7f('0x28')]('.')[0x0]);return _0x383978[_0xdd7f('0x28')]('.')[0x0];});};exports[_0xdd7f('0x3b')]=function(_0x41e589,_0x116c03){var _0x30633b=_0xdd7f('0x3c');var _0x57dcf4,_0x3d2d1b;var _0x530e19;var _0x21f2f3={'encoding':'utf8','method':_0xdd7f('0x33'),'timeout':0x2710,'url':_0x30633b,'headers':{'Content-Type':_0xdd7f('0x3d')},'body':_0xdd7f('0x3e')+encodeURIComponent(JSON[_0xdd7f('0x3f')]([[[_0xdd7f('0x40'),JSON[_0xdd7f('0x3f')]([_0x41e589,_0x116c03||'en',![],'null']),null,'generic']]]))};return rp(_0x21f2f3)[_0xdd7f('0x25')](function(_0x57bae6){try{_0x530e19=eval(_0x57bae6['slice'](0x5))[0x0][0x2];}catch(_0x2aca06){throw new Error('parse\x20response\x20failed:\x0a'+_0x57bae6[_0xdd7f('0x1d')]);}if(!_0x530e19){if(_0x41e589[_0xdd7f('0x41')]>0xc8){throw new Error(_0xdd7f('0x42'));}else{throw new Error(_0xdd7f('0x43')+_0x116c03+_0xdd7f('0x44'));}}try{_0x530e19=eval(_0x530e19)[0x0];}catch(_0x5cf670){throw new Error(_0xdd7f('0x45')+res['data']);}const _0x43d2a0=_0x530e19;_0x57dcf4=path[_0xdd7f('0x34')](__dirname,_0xdd7f('0x21'),rs[_0xdd7f('0x35')](0x4)+_0xdd7f('0x36'));fs['writeFileSync'](_0x57dcf4,_0x530e19,{'encoding':_0xdd7f('0x24')});_0x3d2d1b=path['resolve'](__dirname,_0xdd7f('0x21'),rs[_0xdd7f('0x35')](0x4)+_0xdd7f('0x22'));return convertFile(_0x57dcf4,_0x3d2d1b);})[_0xdd7f('0x25')](function(){try{fs['unlink'](_0x57dcf4);fs[_0xdd7f('0x26')](_0x3d2d1b,_0xdd7f('0x27'));}catch(_0x28269b){logger[_0xdd7f('0x10')](_0x28269b);}logger['info'](_0xdd7f('0x46'),_0x3d2d1b['split']('.')[0x0]);return _0x3d2d1b['split']('.')[0x0];});};exports['googleASR']=function(_0x57186d,_0x3882d2,_0x5eae83){return google[_0xdd7f('0x47')](_0x57186d,_0x3882d2,_0x5eae83)['then'](function(_0x2dbdc7){logger[_0xdd7f('0x16')](_0x2dbdc7[_0xdd7f('0x48')]);return rp(_0x2dbdc7);})[_0xdd7f('0x25')](function(_0x3de0f6){var _0x163773='';var _0x7b86bc=0x0;try{fs[_0xdd7f('0x39')](_0x57186d);}catch(_0x42e23d){logger[_0xdd7f('0x10')](_0x42e23d);}if(_0x3de0f6&&_0x3de0f6[_0xdd7f('0x49')]){_0x163773=_0x3de0f6['results'][_0xdd7f('0x4a')](function(_0x434464){return _0x434464&&_0x434464[_0xdd7f('0x4b')][0x0]&&_0x434464[_0xdd7f('0x4b')][0x0][_0xdd7f('0x4c')]?_0x434464[_0xdd7f('0x4b')][0x0][_0xdd7f('0x4c')]:'';})[_0xdd7f('0x4d')]('\x0a');_0x7b86bc=_0x3de0f6[_0xdd7f('0x49')][_0xdd7f('0x4a')](function(_0x178c82){return _0x178c82&&_0x178c82['alternatives'][0x0]&&_0x178c82['alternatives'][0x0][_0xdd7f('0x4e')]?_0x178c82['alternatives'][0x0][_0xdd7f('0x4e')]:0x0;})[_0xdd7f('0x4d')]('\x0a');}logger[_0xdd7f('0x16')](_0xdd7f('0x4f'),_0x163773);logger[_0xdd7f('0x16')]('googleASR\x20confidence',_0x7b86bc);return{'transcript':_0x163773,'confidence':_0x7b86bc};})['catch'](function(_0x4d6b0f){logger[_0xdd7f('0x10')](_0xdd7f('0x50'),_0x4d6b0f[_0xdd7f('0xf')],_0x4d6b0f[_0xdd7f('0x51')],_0x4d6b0f['message']);});};exports['googleDialogflow']=function(_0x676c79,_0x28f8db,_0x326650,_0x4388a0){var _0x288b3d=apiai(_0x28f8db,{'language':_0x4388a0||'en'});return _0x288b3d[_0xdd7f('0x52')](_0x326650,{'sessionId':md5(_0x676c79)})[_0xdd7f('0x25')](function(_0x385c42){logger[_0xdd7f('0x16')](JSON[_0xdd7f('0x3f')](_0x385c42));return{'source':_0x385c42[_0xdd7f('0x53')][_0xdd7f('0x54')],'resolvedQuery':_0x385c42[_0xdd7f('0x53')][_0xdd7f('0x55')],'action':_0x385c42['result']['action'],'actionIncomplete':_0x385c42[_0xdd7f('0x53')][_0xdd7f('0x56')],'speech':_0x385c42['result'][_0xdd7f('0x57')][_0xdd7f('0x58')],'score':_0x385c42[_0xdd7f('0x53')]['score'],'statusCode':_0x385c42['status'][_0xdd7f('0x59')],'endConversation':_0x385c42[_0xdd7f('0x53')][_0xdd7f('0x5a')][_0xdd7f('0x5b')]||![],'isFallbackIntent':_0x385c42[_0xdd7f('0x53')][_0xdd7f('0x5a')][_0xdd7f('0x5c')]};});};exports[_0xdd7f('0x5d')]=function(_0x223098,_0x546a25,_0x11989c,_0x5a817f,_0x30c0ab,_0x3e7e27){var _0x25c33b=_0x5a817f[_0xdd7f('0x5e')](/\\n/g,'\x0a');var _0x10fdc9={'credentials':{'private_key':_0x25c33b,'client_email':_0x11989c}};var _0x20470e=new dialogflow[(_0xdd7f('0x5f'))](_0x10fdc9);var _0x872578=_0x20470e[_0xdd7f('0x60')](_0x546a25,md5(_0x223098));var _0x2f128e={'session':_0x872578,'queryInput':{'text':{'text':_0x30c0ab,'languageCode':_0x3e7e27}}};return _0x20470e[_0xdd7f('0x61')](_0x2f128e)[_0xdd7f('0x25')](function(_0x41a6dd){if(_0x41a6dd&&_0x41a6dd[_0xdd7f('0x41')]){logger[_0xdd7f('0x16')](_0xdd7f('0x62'),JSON[_0xdd7f('0x3f')](_0x41a6dd));var _0x152f94=_0x41a6dd[0x0];if(_0x152f94){var _0x103ba9={'action':_0x152f94[_0xdd7f('0x63')][_0xdd7f('0x64')],'allRequiredParamsPresent':_0x152f94[_0xdd7f('0x63')][_0xdd7f('0x65')],'endConversation':_0x152f94[_0xdd7f('0x63')][_0xdd7f('0x66')]&&_0x152f94[_0xdd7f('0x63')][_0xdd7f('0x66')][_0xdd7f('0x67')]?_0x152f94[_0xdd7f('0x63')]['diagnosticInfo'][_0xdd7f('0x67')][_0xdd7f('0x68')]['boolValue']:![],'fulfillmentText':_0x152f94[_0xdd7f('0x63')]['fulfillmentText'],'intentName':_0x152f94['queryResult'][_0xdd7f('0x69')]['name'],'intentDisplayName':_0x152f94[_0xdd7f('0x63')]['intent']['displayName'],'isFallbackIntent':_0x152f94[_0xdd7f('0x63')]['intent'][_0xdd7f('0x6a')],'languageCode':_0x152f94[_0xdd7f('0x63')]['languageCode'],'queryText':_0x152f94['queryResult'][_0xdd7f('0x6b')],'responseId':_0x152f94[_0xdd7f('0x6c')],'score':_0x152f94[_0xdd7f('0x63')][_0xdd7f('0x6d')],'speech':_0x152f94[_0xdd7f('0x63')][_0xdd7f('0x6e')],'providerResponse':JSON[_0xdd7f('0x3f')](_0x41a6dd)};return _0x103ba9;}}});};exports[_0xdd7f('0x6f')]=function(_0x53b482,_0x1b1fa7,_0x5b8a4d,_0x4ef2a8){return tilde[_0xdd7f('0x47')](_0x53b482,_0x1b1fa7,_0x5b8a4d,_0x4ef2a8)[_0xdd7f('0x25')](function(_0x3e0444){try{fs['unlink'](_0x53b482);}catch(_0x3fab0b){logger[_0xdd7f('0x10')](_0x3fab0b);}logger[_0xdd7f('0x16')](_0xdd7f('0x70'),_0x3e0444['transcript']);logger['info'](_0xdd7f('0x71'),_0x3e0444[_0xdd7f('0x4e')]);return _0x3e0444;});};exports['awsPolly']=function(_0x875341,_0x1783b7,_0x17c0e6,_0x11fa56,_0x53d1af,_0x4f9dc1){var _0x5a63ca=path[_0xdd7f('0x34')](__dirname,_0xdd7f('0x21'),rs['generate'](0x4)+_0xdd7f('0x36'));var _0x2f5ee1;return aws[_0xdd7f('0x72')](_0x875341,_0x1783b7,_0x17c0e6,_0x11fa56,_0x53d1af,_0x4f9dc1,_0x5a63ca)[_0xdd7f('0x25')](function(){_0x2f5ee1=path[_0xdd7f('0x34')](__dirname,_0xdd7f('0x21'),rs[_0xdd7f('0x35')](0x4)+_0xdd7f('0x22'));return convertFile(_0x5a63ca,_0x2f5ee1);})[_0xdd7f('0x25')](function(){try{fs[_0xdd7f('0x39')](_0x5a63ca);fs[_0xdd7f('0x26')](_0x2f5ee1,_0xdd7f('0x27'));}catch(_0x40f01a){logger[_0xdd7f('0x10')](_0x40f01a);}return _0x2f5ee1['split']('.')[0x0];});};exports['awsLex']=function(_0x132c2a,_0x1a9d67,_0x46b161,_0x500d2c,_0x286ae3,_0x5e3a66){return aws[_0xdd7f('0x73')](_0x132c2a,_0x1a9d67,_0x46b161,_0x500d2c,_0x286ae3,_0x5e3a66)[_0xdd7f('0x25')](function(_0x5058b0){logger[_0xdd7f('0x16')](JSON['stringify'](_0x5058b0));return _0x5058b0;});};exports['ispeechTTS']=function(_0x4464ec,_0x1eaaca,_0x354a2d,_0x3bed06){var _0x202c96=util[_0xdd7f('0x74')](_0xdd7f('0x75'),ISPEECH_API,_0x4464ec,encodeURIComponent(_0x1eaaca),_0x354a2d,_0x3bed06);var _0x228b52=path[_0xdd7f('0x34')](__dirname,'tmp',rs[_0xdd7f('0x35')](0x4)+'.mp3');var _0x59a429;return downloadFile(_0x202c96,_0x228b52)['then'](function(){_0x59a429=path[_0xdd7f('0x34')](__dirname,_0xdd7f('0x21'),rs[_0xdd7f('0x35')](0x4)+'.wav');return convertFile(_0x228b52,_0x59a429);})[_0xdd7f('0x25')](function(){try{fs[_0xdd7f('0x39')](_0x228b52);fs[_0xdd7f('0x26')](_0x59a429,_0xdd7f('0x27'));}catch(_0x56f2b6){logger['error'](_0x56f2b6);}return _0x59a429['split']('.')[0x0];});};exports['ispeechASR']=function(_0x4ff6df,_0x2b5b51,_0x351ebf,_0x281e15){var _0x2f10b6=util[_0xdd7f('0x74')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x2b5b51,_0x351ebf,base64Encode(_0x4ff6df),_0x281e15?util['format'](_0xdd7f('0x76'),encodeURIComponent(_0x281e15)):_0xdd7f('0x77'));return uploadFile(_0x2f10b6)[_0xdd7f('0x25')](function(_0x2c483c){return querystring[_0xdd7f('0x78')](_0x2c483c);});};exports['sestekNDA']=function(_0x57cef3,_0x5ca1f8){return sestek[_0xdd7f('0x79')](_0x57cef3,_0x5ca1f8)[_0xdd7f('0x25')](function(_0x84c9f1){logger[_0xdd7f('0x16')](JSON[_0xdd7f('0x3f')](_0x84c9f1));var _0x80a2d1={'speech':_0x84c9f1[_0xdd7f('0x7a')],'action':_0x84c9f1[_0xdd7f('0x7b')]?_0x84c9f1[_0xdd7f('0x7b')][_0xdd7f('0x7c')]:undefined,'actiondata':_0x84c9f1[_0xdd7f('0x7b')]?_0x84c9f1[_0xdd7f('0x7b')][_0xdd7f('0x7d')]:undefined};if(_0x84c9f1[_0xdd7f('0x7b')]&&_0x84c9f1[_0xdd7f('0x7b')]['AudioFromTts']){return base64Decode(_0x84c9f1[_0xdd7f('0x7b')][_0xdd7f('0x7e')][_0xdd7f('0x7f')],path[_0xdd7f('0x34')](__dirname,_0xdd7f('0x21'),rs[_0xdd7f('0x35')](0x4)+_0xdd7f('0x22')))[_0xdd7f('0x25')](function(_0x3cc969){_0x80a2d1[_0xdd7f('0x80')]=_0x3cc969;return _0x80a2d1;});}return _0x80a2d1;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index ec9f8aa..8ae4a4f 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 _0xa7e9=['./nda'];(function(_0x8943f7,_0x17b350){var _0x21c5d5=function(_0x227e2f){while(--_0x227e2f){_0x8943f7['push'](_0x8943f7['shift']());}};_0x21c5d5(++_0x17b350);}(_0xa7e9,0x1d2));var _0x9a7e=function(_0x168c49,_0x540aa3){_0x168c49=_0x168c49-0x0;var _0x49004b=_0xa7e9[_0x168c49];return _0x49004b;};var nda=require(_0x9a7e('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x6d42=['./nda','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x6d42,0x168));var _0x26d4=function(_0x334629,_0x3e0a25){_0x334629=_0x334629-0x0;var _0x6d4bc1=_0x6d42[_0x334629];return _0x6d4bc1;};var nda=require(_0x26d4('0x0'));module[_0x26d4('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 d797e53..72fad88 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 _0xb15f=['resolve','ndauth_url','/token','username','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','calleridname','dnid','extension','text','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','request-promise','url','agi','POST'];(function(_0x37caec,_0x4e9fdb){var _0x30c646=function(_0x4b2dba){while(--_0x4b2dba){_0x37caec['push'](_0x37caec['shift']());}};_0x30c646(++_0x4e9fdb);}(_0xb15f,0xa1));var _0xfb15=function(_0x2e1782,_0x4463ad){_0x2e1782=_0x2e1782-0x0;var _0x2d9725=_0xb15f[_0x2e1782];return _0x2d9725;};'use strict';var rp=require(_0xfb15('0x0'));var url=require(_0xfb15('0x1'));var logger=require('../../../../../config/logger')(_0xfb15('0x2'));module['exports']=function(_0x373362,_0x2188d3){var _0x131e78={'method':_0xfb15('0x3'),'uri':url[_0xfb15('0x4')](_0x2188d3[_0xfb15('0x5')],_0xfb15('0x6')),'form':{'grant_type':'password','username':_0x2188d3[_0xfb15('0x7')],'password':_0x2188d3[_0xfb15('0x8')]},'json':!![]};return rp(_0x131e78)[_0xfb15('0x9')](function(_0x11404f){var _0x4230f2={'method':_0xfb15('0x3'),'uri':url[_0xfb15('0x4')](_0x2188d3[_0xfb15('0xa')],_0xfb15('0xb')),'body':{'type':_0x2188d3[_0xfb15('0xc')]||'message','channelId':_0xfb15('0xd'),'conversation':{'id':_0x373362[_0xfb15('0xe')]},'from':{'id':_0x373362[_0xfb15('0xf')],'name':_0x373362[_0xfb15('0x10')]},'recipient':{'id':_0x373362[_0xfb15('0x11')],'name':_0x373362[_0xfb15('0x12')]},'text':_0x2188d3[_0xfb15('0x13')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x11404f[_0xfb15('0x14')]},'json':!![]};if(_0x2188d3[_0xfb15('0x15')]){_0x4230f2[_0xfb15('0x16')][_0xfb15('0x17')][_0xfb15('0x18')]=_0x2188d3['project'];}if(_0x2188d3[_0xfb15('0x19')]=='1'){_0x4230f2[_0xfb15('0x16')][_0xfb15('0x17')][_0xfb15('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xfb15('0x1b')};}if(_0x2188d3[_0xfb15('0x1c')]){_0x4230f2[_0xfb15('0x16')][_0xfb15('0x17')][_0xfb15('0x1d')]=_0x2188d3['custom_action'];if(_0x2188d3['custom_action_data']){_0x4230f2[_0xfb15('0x16')][_0xfb15('0x17')]['CustomActionData']=_0x2188d3[_0xfb15('0x1e')];}}logger[_0xfb15('0x1f')](JSON[_0xfb15('0x20')](_0x4230f2));return rp(_0x4230f2);});}; \ No newline at end of file +var _0x8844=['ndagenerate_audio','body','AudioOutputSettings','audio/wav','custom_action','CustomActionData','custom_action_data','info','stringify','request-promise','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','username','password','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','Bearer\x20','access_token','project','channelData','ProjectName'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x8844,0xf0));var _0x4884=function(_0x1a6bc2,_0x126f66){_0x1a6bc2=_0x1a6bc2-0x0;var _0x147952=_0x8844[_0x1a6bc2];return _0x147952;};'use strict';var rp=require(_0x4884('0x0'));var url=require('url');var logger=require(_0x4884('0x1'))(_0x4884('0x2'));module[_0x4884('0x3')]=function(_0x5763cb,_0x5008be){var _0x312d29={'method':_0x4884('0x4'),'uri':url[_0x4884('0x5')](_0x5008be[_0x4884('0x6')],_0x4884('0x7')),'form':{'grant_type':'password','username':_0x5008be[_0x4884('0x8')],'password':_0x5008be[_0x4884('0x9')]},'json':!![]};return rp(_0x312d29)['then'](function(_0x598bcd){var _0x165749={'method':_0x4884('0x4'),'uri':url[_0x4884('0x5')](_0x5008be[_0x4884('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x5008be[_0x4884('0xb')]||_0x4884('0xc'),'channelId':_0x4884('0xd'),'conversation':{'id':_0x5763cb[_0x4884('0xe')]},'from':{'id':_0x5763cb[_0x4884('0xf')],'name':_0x5763cb[_0x4884('0x10')]},'recipient':{'id':_0x5763cb[_0x4884('0x11')],'name':_0x5763cb[_0x4884('0x12')]},'text':_0x5008be['text'],'channelData':{}},'headers':{'Authorization':_0x4884('0x13')+_0x598bcd[_0x4884('0x14')]},'json':!![]};if(_0x5008be[_0x4884('0x15')]){_0x165749['body'][_0x4884('0x16')][_0x4884('0x17')]=_0x5008be[_0x4884('0x15')];}if(_0x5008be[_0x4884('0x18')]=='1'){_0x165749[_0x4884('0x19')][_0x4884('0x16')][_0x4884('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x4884('0x1b')};}if(_0x5008be[_0x4884('0x1c')]){_0x165749[_0x4884('0x19')]['channelData']['CustomAction']=_0x5008be[_0x4884('0x1c')];if(_0x5008be['custom_action_data']){_0x165749[_0x4884('0x19')][_0x4884('0x16')][_0x4884('0x1d')]=_0x5008be[_0x4884('0x1e')];}}logger[_0x4884('0x1f')](JSON[_0x4884('0x20')](_0x165749));return rp(_0x165749);});}; \ 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 90cd3a4..5dfeea3 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x45fd0d,_0x1d53cf,_0x36fd84,_0x352727){return asr(_0x45fd0d,_0x1d53cf,_0x36fd84,_0x352727);}; \ No newline at end of file +var _0x3e80=['./lib/api'];(function(_0x137bdb,_0x5a71ab){var _0x468bb7=function(_0x1efbaf){while(--_0x1efbaf){_0x137bdb['push'](_0x137bdb['shift']());}};_0x468bb7(++_0x5a71ab);}(_0x3e80,0x1b8));var _0x03e8=function(_0xce9195,_0x1963e1){_0xce9195=_0xce9195-0x0;var _0x530fe6=_0x3e80[_0xce9195];return _0x530fe6;};'use strict';var asr=require(_0x03e8('0x0'));module['exports']=function(_0x32a1c8,_0x6ec942,_0x1426b5,_0x52c605){return asr(_0x32a1c8,_0x6ec942,_0x1426b5,_0x52c605);}; \ 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 7633174..b272262 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 _0x8a28=['update','hex','unix','send','stringify','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','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','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1'];(function(_0x56746e,_0x9d8bf2){var _0x21f65d=function(_0x504898){while(--_0x504898){_0x56746e['push'](_0x56746e['shift']());}};_0x21f65d(++_0x9d8bf2);}(_0x8a28,0x6f));var _0x88a2=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x8a28[_0x411add];return _0x238242;};'use strict';var BPromise=require(_0x88a2('0x0'));var _=require(_0x88a2('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x88a2('0x2'));var crypto=require(_0x88a2('0x3'));var logger=require('../../../../../../config/logger')(_0x88a2('0x4'));module[_0x88a2('0x5')]=function(_0x2cbd0e,_0x24ac72,_0x5e18b7,_0x1067cb){return new BPromise(function(_0x1ffd22,_0x2f1a0b){logger[_0x88a2('0x6')](_0x88a2('0x7'),_0x1067cb||_0x88a2('0x8'));var _0x40ecb3=new WebSocket(_0x1067cb||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x2f84de='';var _0x2fcdca='0';var _0x17690b='1';var _0x3065ea=_0x88a2('0x9');function _0x3f5349(_0x2cdc7e){var _0x4cce3a=crypto[_0x88a2('0xa')](_0x88a2('0xb'));_0x4cce3a[_0x88a2('0xc')](_0x2cdc7e);return _0x4cce3a['digest'](_0x88a2('0xd'));}function _0x3b02dd(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x3bc2f8=moment()[_0x88a2('0xe')]();var _0x3d86cd=_0x3f5349(_0x3bc2f8+_0x24ac72+_0x5e18b7);_0x40ecb3[_0x88a2('0xf')](JSON[_0x88a2('0x10')]({'appID':_0x24ac72,'timestamp':_0x3bc2f8,'appKey':_0x3d86cd}));var _0x36d84a=fs[_0x88a2('0x11')](_0x2cbd0e);_0x36d84a['on']('data',function(_0x9cd228){_0x40ecb3['send'](_0x9cd228);});_0x36d84a['on'](_0x88a2('0x12'),function(){_0x40ecb3[_0x88a2('0xf')](_0x88a2('0x13'));});}catch(_0xaac4e9){logger[_0x88a2('0x14')](_0x88a2('0x15'),JSON[_0x88a2('0x10')](_0xaac4e9));_0x40ecb3[_0x88a2('0x16')]();}}function _0x151fa3(_0x2d955a){try{if(_0x2d955a){var _0x3fba48=JSON['parse'](_0x2d955a);switch(_0x3fba48[_0x88a2('0x17')]){case 0x0:if(_0x3fba48[_0x88a2('0x18')]){if(_0x3fba48['result'][_0x88a2('0x19')]){logger[_0x88a2('0x6')](_0x88a2('0x1a'),JSON[_0x88a2('0x10')](_0x3fba48['result'][_0x88a2('0x1b')]));_0x2f84de=_0x3fba48[_0x88a2('0x18')][_0x88a2('0x1b')][0x0][_0x88a2('0x1c')];_0x2fcdca=_0x3fba48[_0x88a2('0x18')]['hypotheses'][0x0]['likelihood'];_0x17690b='0';_0x3065ea=_0x88a2('0x1d');_0x40ecb3[_0x88a2('0x16')]();}}break;case 0x1:logger[_0x88a2('0x6')](_0x88a2('0x9'));_0x17690b='1';_0x3065ea=_0x88a2('0x9');break;case 0x2:logger[_0x88a2('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x17690b='2';_0x3065ea=_0x88a2('0x1e');break;case 0x9:logger[_0x88a2('0x6')](_0x88a2('0x1f'));_0x17690b='9';_0x3065ea=_0x88a2('0x1f');break;case 0xa:logger[_0x88a2('0x6')](_0x88a2('0x20'));_0x17690b='10';_0x3065ea=_0x88a2('0x20');break;case 0xb:logger[_0x88a2('0x6')](_0x88a2('0x21'));_0x17690b='11';_0x3065ea=_0x88a2('0x21');}}}catch(_0x1a5b43){logger[_0x88a2('0x14')](_0x88a2('0x22'),JSON['stringify'](_0x1a5b43));_0x40ecb3[_0x88a2('0x16')]();}}function _0x4e2e52(){logger['info'](_0x88a2('0x23'));_0x1ffd22({'transcript':_0x2f84de,'confidence':_0x2fcdca,'status':_0x17690b,'status_message':_0x3065ea});}function _0x3dcef2(_0xda9c48){logger['error'](_0x88a2('0x24'));if(!_[_0x88a2('0x25')](_0xda9c48)){logger[_0x88a2('0x14')](_[_0x88a2('0x26')](_0xda9c48)?JSON[_0x88a2('0x10')](_0xda9c48):_0xda9c48);}}_0x40ecb3['on'](_0x88a2('0x27'),_0x3b02dd);_0x40ecb3['on'](_0x88a2('0x28'),_0x151fa3);_0x40ecb3['on'](_0x88a2('0x12'),_0x4e2e52);_0x40ecb3['on']('error',_0x3dcef2);});}; \ No newline at end of file +var _0x581e=['isNil','open','message','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','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','Error\x20Tilde\x20ASR\x20socket'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x581e,0x162));var _0xe581=function(_0x434567,_0x1f127b){_0x434567=_0x434567-0x0;var _0x3257a1=_0x581e[_0x434567];return _0x3257a1;};'use strict';var BPromise=require(_0xe581('0x0'));var _=require(_0xe581('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xe581('0x2'));var logger=require(_0xe581('0x3'))(_0xe581('0x4'));module[_0xe581('0x5')]=function(_0x275156,_0x7cae51,_0x18d3ba,_0x25c9dc){return new BPromise(function(_0x464641,_0x44263f){logger[_0xe581('0x6')](_0xe581('0x7'),_0x25c9dc||_0xe581('0x8'));var _0x577b7d=new WebSocket(_0x25c9dc||_0xe581('0x8'),{'perMessageDeflate':![]});var _0x550dd3='';var _0xa300ef='0';var _0x10ee66='1';var _0x18621d=_0xe581('0x9');function _0x4b9735(_0x451e54){var _0x715573=crypto[_0xe581('0xa')](_0xe581('0xb'));_0x715573[_0xe581('0xc')](_0x451e54);return _0x715573[_0xe581('0xd')]('hex');}function _0x2c66c4(){try{logger[_0xe581('0x6')]('Open\x20Tilde\x20ASR\x20socket');var _0x2d6eb1=moment()[_0xe581('0xe')]();var _0xe6a5c9=_0x4b9735(_0x2d6eb1+_0x7cae51+_0x18d3ba);_0x577b7d[_0xe581('0xf')](JSON[_0xe581('0x10')]({'appID':_0x7cae51,'timestamp':_0x2d6eb1,'appKey':_0xe6a5c9}));var _0x4fbaab=fs[_0xe581('0x11')](_0x275156);_0x4fbaab['on'](_0xe581('0x12'),function(_0x380fe2){_0x577b7d[_0xe581('0xf')](_0x380fe2);});_0x4fbaab['on'](_0xe581('0x13'),function(){_0x577b7d[_0xe581('0xf')](_0xe581('0x14'));});}catch(_0x56bcd2){logger[_0xe581('0x15')](_0xe581('0x16'),JSON[_0xe581('0x10')](_0x56bcd2));_0x577b7d['terminate']();}}function _0x3e1c51(_0x2db945){try{if(_0x2db945){var _0x556118=JSON[_0xe581('0x17')](_0x2db945);switch(_0x556118[_0xe581('0x18')]){case 0x0:if(_0x556118[_0xe581('0x19')]){if(_0x556118[_0xe581('0x19')][_0xe581('0x1a')]){logger[_0xe581('0x6')](_0xe581('0x1b'),JSON['stringify'](_0x556118['result'][_0xe581('0x1c')]));_0x550dd3=_0x556118[_0xe581('0x19')]['hypotheses'][0x0]['transcript'];_0xa300ef=_0x556118['result'][_0xe581('0x1c')][0x0]['likelihood'];_0x10ee66='0';_0x18621d='Success.';_0x577b7d[_0xe581('0x1d')]();}}break;case 0x1:logger[_0xe581('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x10ee66='1';_0x18621d=_0xe581('0x9');break;case 0x2:logger['info'](_0xe581('0x1e'));_0x10ee66='2';_0x18621d=_0xe581('0x1e');break;case 0x9:logger['info'](_0xe581('0x1f'));_0x10ee66='9';_0x18621d=_0xe581('0x1f');break;case 0xa:logger[_0xe581('0x6')](_0xe581('0x20'));_0x10ee66='10';_0x18621d=_0xe581('0x20');break;case 0xb:logger[_0xe581('0x6')](_0xe581('0x21'));_0x10ee66='11';_0x18621d=_0xe581('0x21');}}}catch(_0x176907){logger[_0xe581('0x15')](_0xe581('0x22'),JSON[_0xe581('0x10')](_0x176907));_0x577b7d[_0xe581('0x1d')]();}}function _0x3c227f(){logger[_0xe581('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x464641({'transcript':_0x550dd3,'confidence':_0xa300ef,'status':_0x10ee66,'status_message':_0x18621d});}function _0x114fb6(_0x432fe8){logger[_0xe581('0x15')](_0xe581('0x23'));if(!_[_0xe581('0x24')](_0x432fe8)){logger[_0xe581('0x15')](_['isObject'](_0x432fe8)?JSON[_0xe581('0x10')](_0x432fe8):_0x432fe8);}}_0x577b7d['on'](_0xe581('0x25'),_0x2c66c4);_0x577b7d['on'](_0xe581('0x26'),_0x3e1c51);_0x577b7d['on'](_0xe581('0x13'),_0x3c227f);_0x577b7d['on'](_0xe581('0x15'),_0x114fb6);});}; \ 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 95cee5c..5d67694 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 _0x7309=['exports'];(function(_0x4b5049,_0x4d00ad){var _0x2f2e38=function(_0x5b0217){while(--_0x5b0217){_0x4b5049['push'](_0x4b5049['shift']());}};_0x2f2e38(++_0x4d00ad);}(_0x7309,0x18f));var _0x9730=function(_0xd66ad9,_0x2958a6){_0xd66ad9=_0xd66ad9-0x0;var _0x451e52=_0x7309[_0xd66ad9];return _0x451e52;};var asr=require('./asr');module[_0x9730('0x0')]={'asr':asr}; \ No newline at end of file +var _0xcedb=['./asr'];(function(_0x4ab74f,_0x177b0d){var _0x3405be=function(_0x3cd346){while(--_0x3cd346){_0x4ab74f['push'](_0x4ab74f['shift']());}};_0x3405be(++_0x177b0d);}(_0xcedb,0xdd));var _0xbced=function(_0x4ab67b,_0x244b1c){_0x4ab67b=_0x4ab67b-0x0;var _0x2dd50c=_0xcedb[_0x4ab67b];return _0x2dd50c;};var asr=require(_0xbced('0x0'));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 d34eae8..a2f6364 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 _0x899a=['./error','127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','ready','close','E_AGI_SERVER_CLOSE','nextTick','inherits','util','net','EventEmitter'];(function(_0x35dbfb,_0x9446aa){var _0x2c5a51=function(_0x4a3caf){while(--_0x4a3caf){_0x35dbfb['push'](_0x35dbfb['shift']());}};_0x2c5a51(++_0x9446aa);}(_0x899a,0x1b6));var _0xa899=function(_0x1a0f01,_0x12fdbd){_0x1a0f01=_0x1a0f01-0x0;var _0x5c9c15=_0x899a[_0x1a0f01];return _0x5c9c15;};'use strict';var util=require(_0xa899('0x0'));var net=require(_0xa899('0x1'));var EventEmitter=require('events')[_0xa899('0x2')];var AGIError=require(_0xa899('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x2742c1,_0x40ed2b,_0x1c5c93){var _0x223383=this,_0x2742c1=_0x2742c1||0x11dd,_0x40ed2b=_0x40ed2b||_0xa899('0x4'),_0xb1bd49=null,_0xad59d2=0x0;EventEmitter['call'](_0x223383);function _0x3d35fb(){if(!_0x2742c1){_0x223383[_0xa899('0x5')](_0xa899('0x6'),new AGIError(_0xa899('0x7')));return![];}_0xb1bd49=net[_0xa899('0x8')]();_0xb1bd49[_0xa899('0x9')](_0x2742c1,_0x40ed2b);_0xb1bd49['on'](_0xa899('0xa'),function(){_0x223383[_0xa899('0x5')](_0xa899('0xa'));});_0xb1bd49['on'](_0xa899('0xb'),function(_0x5a6582){_0xb1bd49[_0xa899('0xc')](function(_0x522e8b,_0x4eb704){if(_0x522e8b){_0x223383['emit']('error',new AGIError(_0xa899('0xd'),_0x522e8b));}else if(_0x1c5c93&&_0x1c5c93<0x0){_0x223383[_0xa899('0x5')](_0xa899('0x6'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x5a6582[_0xa899('0xe')]();}else if(_0x1c5c93&&_0x1c5c93>0x0&&_0x1c5c93<_0x4eb704){_0xad59d2+=0x1;_0x223383[_0xa899('0x5')]('error',new AGIError(_0xa899('0xf'),_0xad59d2));_0x5a6582[_0xa899('0xe')]();}else{var _0x104b42=new AGIChannel(_0x5a6582);_0x104b42['on'](_0xa899('0x10'),function(){_0x223383['emit'](_0xa899('0xb'),_0x104b42);});}});});_0xb1bd49['on'](_0xa899('0x6'),function(_0x4c08cc){_0x223383[_0xa899('0x5')](_0xa899('0x6'),new AGIError(_0xa899('0xd'),_0x4c08cc['code']));});_0xb1bd49['on']('close',function(){_0x223383[_0xa899('0x5')](_0xa899('0x11'),new AGIError(_0xa899('0x12')));});}process[_0xa899('0x13')](function(){_0x3d35fb();});};util[_0xa899('0x14')](AGIServer,EventEmitter);module['exports']=function(_0x332ced,_0x4fd924,_0x32882d){return new AGIServer(_0x332ced,_0x4fd924,_0x32882d);}; \ No newline at end of file +var _0x0fc8=['ready','close','E_AGI_SERVER_CLOSE','nextTick','exports','util','net','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION'];(function(_0x3fddf3,_0x36ce44){var _0x15650d=function(_0x315a11){while(--_0x315a11){_0x3fddf3['push'](_0x3fddf3['shift']());}};_0x15650d(++_0x36ce44);}(_0x0fc8,0x145));var _0x80fc=function(_0x2bbd70,_0x5ae140){_0x2bbd70=_0x2bbd70-0x0;var _0x3c9b34=_0x0fc8[_0x2bbd70];return _0x3c9b34;};'use strict';var util=require(_0x80fc('0x0'));var net=require(_0x80fc('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x80fc('0x2'));var AGIServer=function(_0x5c035b,_0x499326,_0x4a128e){var _0x862499=this,_0x5c035b=_0x5c035b||0x11dd,_0x499326=_0x499326||_0x80fc('0x3'),_0x42a9ff=null,_0x10b37c=0x0;EventEmitter[_0x80fc('0x4')](_0x862499);function _0x5cb645(){if(!_0x5c035b){_0x862499[_0x80fc('0x5')](_0x80fc('0x6'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x42a9ff=net[_0x80fc('0x7')]();_0x42a9ff[_0x80fc('0x8')](_0x5c035b,_0x499326);_0x42a9ff['on'](_0x80fc('0x9'),function(){_0x862499['emit'](_0x80fc('0x9'));});_0x42a9ff['on']('connection',function(_0x56dc2b){_0x42a9ff[_0x80fc('0xa')](function(_0x449953,_0x19d0a2){if(_0x449953){_0x862499[_0x80fc('0x5')](_0x80fc('0x6'),new AGIError(_0x80fc('0xb'),_0x449953));}else if(_0x4a128e&&_0x4a128e<0x0){_0x862499[_0x80fc('0x5')](_0x80fc('0x6'),new AGIError(_0x80fc('0xc')));_0x56dc2b[_0x80fc('0xd')]();}else if(_0x4a128e&&_0x4a128e>0x0&&_0x4a128e<_0x19d0a2){_0x10b37c+=0x1;_0x862499[_0x80fc('0x5')](_0x80fc('0x6'),new AGIError(_0x80fc('0xe'),_0x10b37c));_0x56dc2b[_0x80fc('0xd')]();}else{var _0x9f0417=new AGIChannel(_0x56dc2b);_0x9f0417['on'](_0x80fc('0xf'),function(){_0x862499[_0x80fc('0x5')]('connection',_0x9f0417);});}});});_0x42a9ff['on'](_0x80fc('0x6'),function(_0x534f29){_0x862499[_0x80fc('0x5')](_0x80fc('0x6'),new AGIError(_0x80fc('0xb'),_0x534f29['code']));});_0x42a9ff['on'](_0x80fc('0x10'),function(){_0x862499['emit'](_0x80fc('0x10'),new AGIError(_0x80fc('0x11')));});}process[_0x80fc('0x12')](function(){_0x5cb645();});};util['inherits'](AGIServer,EventEmitter);module[_0x80fc('0x13')]=function(_0x4878c2,_0x2b0de8,_0x1e46ec){return new AGIServer(_0x4878c2,_0x2b0de8,_0x1e46ec);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 2ea0a29..933e878 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 _0xc1db=['Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','getQueryOdbc','createSquareDetailsReport','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','getUser','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','getdigits','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','aws_bot_name','no\x20bot\x20name\x20configured','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','beep','tilde\x20%s\x20file\x20created','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','intKey','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','getData','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','service','host','port','secure','authentication','auth','pass','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','START\x20CALLY\x20SQUARE','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','replaceAll','exports','path','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','agi','/var/opt/motion2/server/files','menu','getsecretdigits','rpc','mailRpc','getVariable','then','name','catch','prototype','getVoiceQueue','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getSound','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','channel','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','uniqueid','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','googleCloudTTS','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','awsLex','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','length','isString','saveRestApiResult','isPlainObject','%s.%s','isArray','split','extra','toString','getAndSetVariable','result','setVariable','maxRetry','retry','no\x20text\x20configured','MRCPSynth','noop','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','exec','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s'];(function(_0xa4928c,_0x16b89c){var _0x27cc29=function(_0x14b819){while(--_0x14b819){_0xa4928c['push'](_0xa4928c['shift']());}};_0x27cc29(++_0x16b89c);}(_0xc1db,0x120));var _0xbc1d=function(_0x294c3e,_0xf1b6de){_0x294c3e=_0x294c3e-0x0;var _0x1af897=_0xc1db[_0x294c3e];return _0x1af897;};'use strict';var fs=require('fs');var path=require(_0xbc1d('0x0'));var util=require('util');var _=require(_0xbc1d('0x1'));var sh=require(_0xbc1d('0x2'));var odbc=require(_0xbc1d('0x3'))();var rs=require(_0xbc1d('0x4'));var moment=require(_0xbc1d('0x5'));var Mustache=require('mustache');var rp=require(_0xbc1d('0x6'));var logger=require(_0xbc1d('0x7'))(_0xbc1d('0x8'));var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH=_0xbc1d('0x9');var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=[_0xbc1d('0xa'),'getdigits',_0xbc1d('0xb')];var AGIVertices=function(_0x451e8d,_0x4c2d30,_0x45468e){this['channel']=_0x451e8d;this[_0xbc1d('0xc')]=_0x4c2d30;this[_0xbc1d('0xd')]=_0x45468e;};AGIVertices['prototype'][_0xbc1d('0xe')]=function(_0x260a4c,_0x2a19c6){this[_0xbc1d('0xc')]['getVariableById'](_0x260a4c)[_0xbc1d('0xf')](function(_0x4e9cee){_0x2a19c6(null,_0x4e9cee?_0x4e9cee[_0xbc1d('0x10')]:![]);})[_0xbc1d('0x11')](function(_0x50982e){_0x2a19c6(_0x50982e);});};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x13')]=function(_0x5667c3,_0x373f20){this[_0xbc1d('0xc')]['getVoiceQueueById'](_0x5667c3)[_0xbc1d('0xf')](function(_0x4cdd86){_0x373f20(null,_0x4cdd86?_0x4cdd86[_0xbc1d('0x10')]:![]);})[_0xbc1d('0x11')](function(_0xfe7015){_0x373f20(_0xfe7015);});};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x14')]=function(_0x351d56,_0x5bddda){this[_0xbc1d('0xc')]['getSquareProjectById'](_0x351d56)[_0xbc1d('0xf')](function(_0x225310){_0x5bddda(null,_0x225310?_0x225310['name']:![]);})['catch'](function(_0x51abd6){_0x5bddda(_0x51abd6);});};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x15')]=function(_0x44887e,_0x1bd6d7){this['rpc'][_0xbc1d('0x16')](_0x44887e)[_0xbc1d('0xf')](function(_0x59f362){_0x1bd6d7(null,_0x59f362?_0x59f362[_0xbc1d('0x17')]:![]);})['catch'](function(_0x5ab558){_0x1bd6d7(_0x5ab558);});};AGIVertices[_0xbc1d('0x12')]['getUser']=function(_0x25fa75,_0x52c7c9){this[_0xbc1d('0xc')][_0xbc1d('0x18')](_0x25fa75)['then'](function(_0x1951a1){_0x52c7c9(null,_0x1951a1?_0x1951a1[_0xbc1d('0x10')]:![]);})[_0xbc1d('0x11')](function(_0x4a0579){_0x52c7c9(_0x4a0579);});};AGIVertices['prototype'][_0xbc1d('0x19')]=function(_0x497df8,_0x1f6217){this[_0xbc1d('0xc')]['getTrunkById'](_0x497df8)['then'](function(_0x1e16b2){_0x1f6217(null,_0x1e16b2?_0x1e16b2[_0xbc1d('0x10')]:![]);})['catch'](function(_0x7b37c3){_0x1f6217(_0x7b37c3);});};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x1a')]=function(_0x35baab,_0x155c90){var _0x2b5c55=this;this[_0xbc1d('0xc')]['getSoundById'](_0x35baab)[_0xbc1d('0xf')](function(_0x5e97e3){_0x155c90(null,_0x5e97e3?_0x2b5c55['getSoundPath'](_0x5e97e3[_0xbc1d('0x1b')]):![]);})[_0xbc1d('0x11')](function(_0x238a4d){_0x155c90(_0x238a4d);});};AGIVertices[_0xbc1d('0x12')]['getMailAccount']=function(_0x2e4ee9,_0x292504){this[_0xbc1d('0xc')][_0xbc1d('0x1c')](_0x2e4ee9)[_0xbc1d('0xf')](function(_0x12a96c){_0x292504(null,_0x12a96c?_0x12a96c:![]);})[_0xbc1d('0x11')](function(_0x18ca96){_0x292504(_0x18ca96);});};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x1d')]=function(_0x403e0b,_0x4050cc,_0xd8c8f1){this['mailRpc'][_0xbc1d('0x1d')](_0x403e0b,_0x4050cc)[_0xbc1d('0xf')](function(){_0xd8c8f1(null);})[_0xbc1d('0x11')](function(_0x1aa715){_0xd8c8f1(_0x1aa715);});};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x1e')]=function(_0x5442ed,_0x104cb9){this[_0xbc1d('0xc')][_0xbc1d('0x1f')](_0x5442ed)['then'](function(_0x439b36){if(_0x439b36){if(_0x439b36[_0xbc1d('0x20')]){_0x104cb9(null,[_0x439b36[_0xbc1d('0x21')]]);}else{_0x104cb9(null,_['map'](_0x439b36[_0xbc1d('0x22')],_0xbc1d('0x21')));}}else{_0x104cb9(null,![]);}})[_0xbc1d('0x11')](function(_0x22a588){_0x104cb9(_0x22a588);});};AGIVertices['prototype']['getSoundPath']=function(_0x758066){return util[_0xbc1d('0x23')](_0xbc1d('0x24'),FILES_PATH,_0x758066);};AGIVertices['prototype']['getQueryOdbc']=function(_0x50aef8,_0x4e710f,_0x1cb7b5){odbc[_0xbc1d('0x25')](_0x50aef8,function(_0x435bfc){if(_0x435bfc){logger[_0xbc1d('0x26')](_0xbc1d('0x27'),_0x435bfc);_0x1cb7b5(_0x435bfc);}else{logger[_0xbc1d('0x28')]('ODBC\x20connection\x20successfully');odbc[_0xbc1d('0x29')](_0x4e710f,function(_0x4eeeb2,_0x2ac3f2){if(_0x4eeeb2){logger['info'](_0xbc1d('0x2a'),_0x4e710f);_0x1cb7b5(_0x4eeeb2);}else{logger[_0xbc1d('0x28')](_0xbc1d('0x2b'),_0x4e710f);odbc['close'](function(_0x381ac2){if(_0x381ac2){logger[_0xbc1d('0x26')](_0xbc1d('0x2c'),_0x381ac2);}_0x1cb7b5(null,_0x2ac3f2);});}});}});};AGIVertices[_0xbc1d('0x12')]['getSmsAccount']=function(_0x46b755,_0x110281){this[_0xbc1d('0xc')][_0xbc1d('0x2d')](_0x46b755)[_0xbc1d('0xf')](function(_0x387cab){_0x110281(null,_0x387cab?_0x387cab:![]);})[_0xbc1d('0x11')](function(_0x1ffb43){_0x110281(_0x1ffb43);});};AGIVertices['prototype'][_0xbc1d('0x2e')]=function(_0xf87633,_0x5309ba){this[_0xbc1d('0xc')][_0xbc1d('0x2e')](_0xf87633)['then'](function(_0x492832){_0x5309ba(null,_0x492832);})[_0xbc1d('0x11')](function(_0x371f25){_0x5309ba(_0x371f25);});};AGIVertices[_0xbc1d('0x12')]['createSquareDetailsReport']=function(_0x2475cb,_0x1493cb,_0x102df3){this[_0xbc1d('0xc')]['createSquareDetailsReport']({'uniqueid':this[_0xbc1d('0x2f')]['uniqueid'],'node':_0x2475cb[_0xbc1d('0x30')],'application':_0x2475cb[_0xbc1d('0x31')],'data':_0x1493cb||null,'project_name':this['channel'][_0xbc1d('0x32')],'callerid':this[_0xbc1d('0x2f')][_0xbc1d('0x33')]})[_0xbc1d('0xf')](function(_0x5a2d75){if(_0x102df3){_0x102df3(null,_0x5a2d75);}})[_0xbc1d('0x11')](function(_0x5f13f8){if(_0x102df3){_0x102df3(_0x5f13f8);}});};AGIVertices[_0xbc1d('0x12')]['createSquareRecording']=function(_0x1ef552,_0x59dfd6,_0x247653,_0x292857){this[_0xbc1d('0xc')][_0xbc1d('0x34')]({'uniqueid':this[_0xbc1d('0x2f')]['uniqueid'],'callerid':this[_0xbc1d('0x2f')]['callerid'],'calleridname':this['channel'][_0xbc1d('0x35')],'context':this[_0xbc1d('0x2f')][_0xbc1d('0x36')],'extension':this[_0xbc1d('0x2f')][_0xbc1d('0x37')],'priority':this['channel']['priority'],'accountcode':this[_0xbc1d('0x2f')][_0xbc1d('0x38')],'dnid':this['channel'][_0xbc1d('0x39')],'projectName':this[_0xbc1d('0x2f')][_0xbc1d('0x32')],'saveName':_0x59dfd6,'filename':_0x1ef552[_0xbc1d('0x3a')]||_0x59dfd6,'savePath':_0x247653})[_0xbc1d('0xf')](function(_0x8e07ff){_0x292857(null,_0x8e07ff);})[_0xbc1d('0x11')](function(_0x2ed5c3){_0x292857(_0x2ed5c3);});};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x3b')]=function(_0x1b34e9,_0x28a572,_0x1635d7,_0x4122e0,_0x399eae){this[_0xbc1d('0xc')][_0xbc1d('0x3b')]({'uniqueid':this[_0xbc1d('0x2f')]['uniqueid'],'body':_0x1b34e9,'direction':_0x28a572,'providerName':_0x1635d7,'providerResponse':_0x4122e0})[_0xbc1d('0xf')](function(_0x1e690){if(_0x399eae){_0x399eae(null,_0x1e690);}})[_0xbc1d('0x11')](function(_0x2b2f5c){if(_0x399eae){_0x399eae(_0x2b2f5c);}});};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x3c')]=function(_0x3114bb,_0x54448f){this['rpc'][_0xbc1d('0x3c')]({'firstName':_[_0xbc1d('0x3d')](_0x3114bb[_0xbc1d('0x10')])||_[_0xbc1d('0x3e')](_0x3114bb['name'])?_0xbc1d('0x3f')+Math[_0xbc1d('0x40')]():_0x3114bb[_0xbc1d('0x10')],'lastName':_[_0xbc1d('0x3d')](_0x3114bb[_0xbc1d('0x41')])||_[_0xbc1d('0x3e')](_0x3114bb['lastName'])?null:_0x3114bb[_0xbc1d('0x41')],'phone':_0x3114bb[_0xbc1d('0x42')],'ListId':_0x3114bb[_0xbc1d('0x43')],'scheduledat':_0x3114bb[_0xbc1d('0x44')],'callbackUniqueid':this[_0xbc1d('0x2f')][_0xbc1d('0x45')],'tags':_0xbc1d('0x46'),'description':_0xbc1d('0x47')+_0x3114bb[_0xbc1d('0x44')]['toString'](),'priority':_0x3114bb[_0xbc1d('0x48')]})[_0xbc1d('0xf')](function(_0x2409b3){_0x54448f(null,_0x2409b3);})[_0xbc1d('0x11')](function(_0x3f68c0){_0x54448f(_0x3f68c0);});};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x49')]=function(_0x12d0fe,_0x1fc6c2){this[_0xbc1d('0xc')][_0xbc1d('0x4a')](_0x12d0fe)[_0xbc1d('0xf')](function(_0xc8af7a){_0x1fc6c2(null,_0xc8af7a?_0xc8af7a[_0xbc1d('0x10')]:![]);})['catch'](function(_0x3a3671){_0x1fc6c2(_0x3a3671);});};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x4b')]=function(_0x3ef112,_0x5008cb,_0x541461){var _0x469d92={'role':_0xbc1d('0x4c')};_0x469d92[_0x3ef112]=this[_0xbc1d('0x2f')][_0xbc1d('0x33')];this[_0xbc1d('0xc')][_0xbc1d('0x4b')](_0x469d92,_0x5008cb,this[_0xbc1d('0x2f')][_0xbc1d('0x45')])['then'](function(_0x50ccdd){_0x541461(null,_[_0xbc1d('0x3e')](_0x50ccdd)?![]:!![]);})[_0xbc1d('0x11')](function(_0x21439e){logger['error'](_0x21439e);_0x541461(null,![]);});};AGIVertices[_0xbc1d('0x12')]['agentUnpause']=function(_0x3d4e92,_0x26fdc6){var _0x29d919={'role':_0xbc1d('0x4c')};_0x29d919[_0x3d4e92]=this['channel'][_0xbc1d('0x33')];this[_0xbc1d('0xc')][_0xbc1d('0x4d')](_0x29d919)[_0xbc1d('0xf')](function(_0x36722f){_0x26fdc6(null,_[_0xbc1d('0x3e')](_0x36722f)?![]:!![]);})[_0xbc1d('0x11')](function(_0x4a4c9e){logger[_0xbc1d('0x26')](_0x4a4c9e);_0x26fdc6(null,![]);});};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x4e')]=function(_0x13d518,_0x3f2fe7){var _0x4bb1d4={'role':_0xbc1d('0x4c')};_0x4bb1d4[_0x13d518]=this[_0xbc1d('0x2f')][_0xbc1d('0x33')];this[_0xbc1d('0xc')][_0xbc1d('0x4e')](_0x4bb1d4)[_0xbc1d('0xf')](function(_0x17e165){_0x3f2fe7(null,_[_0xbc1d('0x3e')](_0x17e165)?![]:!![]);})[_0xbc1d('0x11')](function(_0x33a109){logger['error'](_0x33a109);_0x3f2fe7(null,![]);});};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x4f')]=function(_0x57e8ac,_0x1157db){var _0x3a1433={'role':_0xbc1d('0x4c')};_0x3a1433[_0x57e8ac]=this[_0xbc1d('0x2f')][_0xbc1d('0x33')];var _0x192f3c=_0x57e8ac!=_0xbc1d('0x50')?util['format'](_0xbc1d('0x51'),_0xbc1d('0x52'),this['channel'][_0xbc1d('0x33')]):undefined;this['rpc'][_0xbc1d('0x4f')](_0x3a1433,_0x192f3c)[_0xbc1d('0xf')](function(_0x17f625){_0x1157db(null,_[_0xbc1d('0x3e')](_0x17f625)?![]:!![]);})[_0xbc1d('0x11')](function(_0x5a628d){logger[_0xbc1d('0x26')](_0x5a628d);_0x1157db(null,![]);});};AGIVertices['prototype'][_0xbc1d('0x53')]=function(_0x56b170,_0xa3a1c6){sh['exec'](_['trim'](_0x56b170),function(_0x23928a,_0x4eadf4){var _0x41446b=_0x4eadf4['replace'](/(\r\n|\n|\r)/gm,'');_0xa3a1c6(null,_0x41446b);});};AGIVertices['prototype'][_0xbc1d('0x54')]=function(_0x4855f3,_0x1341bc){scripts['googleCloudTTS'](_0x4855f3['apiKey'],_0x4855f3['google_cloud_tts_text_type']||_0xbc1d('0x55'),_0x4855f3['text'],_0x4855f3[_0xbc1d('0x56')]||_0xbc1d('0x57'),_0x4855f3[_0xbc1d('0x58')]||_0xbc1d('0x59'),_0x4855f3[_0xbc1d('0x5a')]||_0xbc1d('0x5b'))[_0xbc1d('0xf')](function(_0x27992a){_0x1341bc(null,_0x27992a);})[_0xbc1d('0x11')](function(_0x502792){_0x1341bc(_0x502792);});};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x5c')]=function(_0x12da29,_0x8e50da){scripts[_0xbc1d('0x5c')](_0x12da29[_0xbc1d('0x55')],_0x12da29[_0xbc1d('0x5d')]||'en',0x1)['then'](function(_0x3937f6){_0x8e50da(null,_0x3937f6);})[_0xbc1d('0x11')](function(_0x44c748){_0x8e50da(_0x44c748);});};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x5e')]=function(_0x2db400,_0x5a38e8){var _0x2f93b8={'uri':_0x2db400[_0xbc1d('0x5f')],'method':_0x2db400[_0xbc1d('0x60')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2db400[_0xbc1d('0x61')])===_0xbc1d('0x62')&&parseInt(_0x2db400['timeout'])>=0x1?parseInt(_0x2db400['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xbc1d('0x63')]([_0xbc1d('0x64'),_0xbc1d('0x65')],_0x2f93b8[_0xbc1d('0x60')]['toUpperCase']())){try{_0x2f93b8[_0xbc1d('0x66')]=_0x2db400[_0xbc1d('0x67')]?JSON[_0xbc1d('0x68')](_0x2db400['rawBody']):{};}catch(_0xc2446f){logger['error'](_0xbc1d('0x69'),_0xc2446f);}}try{_0x2f93b8[_0xbc1d('0x6a')]=_0x2db400[_0xbc1d('0x6b')]?JSON['parse'](_0x2db400[_0xbc1d('0x6b')]):{};}catch(_0x3d3fb9){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3d3fb9);}if(_0x2db400[_0xbc1d('0x6c')]){try{var _0x1b01a6=require(_0x2db400[_0xbc1d('0x6c')])[_0xbc1d('0x6d')](this,_0x2f93b8);_0x2f93b8[_0xbc1d('0x6e')]=Mustache['render'](_0x2db400[_0xbc1d('0x5f')],_0x1b01a6,{},['$$','$$']);if(_0x2f93b8[_0xbc1d('0x6a')]){_0x2f93b8[_0xbc1d('0x6a')]=JSON['parse'](Mustache[_0xbc1d('0x6f')](JSON[_0xbc1d('0x70')](_0x2f93b8[_0xbc1d('0x6a')]),_0x1b01a6,{},['$$','$$']));}if(_0x2f93b8[_0xbc1d('0x66')]){_0x2f93b8[_0xbc1d('0x66')]=JSON[_0xbc1d('0x68')](Mustache[_0xbc1d('0x6f')](JSON[_0xbc1d('0x70')](_0x2f93b8[_0xbc1d('0x66')]),_0x1b01a6,{},['$$','$$']));}}catch(_0x5da016){logger['error'](_0xbc1d('0x71'),_0x5da016);}}rp(_0x2f93b8)['then'](function(_0x47327a){var _0x3a8700={'statusCode':_0x47327a[_0xbc1d('0x72')]||0xc8,'statusMessage':_0x47327a['statusMessage']||'OK','headers':_0x47327a['headers']||{},'body':_0x47327a[_0xbc1d('0x66')]||{}};_0x5a38e8(null,_0x3a8700);})[_0xbc1d('0x11')](function(_0x7766d){var _0x4e4389={'statusCode':_0x7766d[_0xbc1d('0x72')]||0x1f4,'statusMessage':_0x7766d['message']||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x7766d[_0xbc1d('0x73')][_0xbc1d('0x6a')]||{},'body':_0x7766d[_0xbc1d('0x73')][_0xbc1d('0x66')]||{}};_0x5a38e8(null,_0x4e4389);});};AGIVertices[_0xbc1d('0x12')]['googleDialogflow']=function(_0x2d8fdc,_0x2adc98){scripts[_0xbc1d('0x74')](this[_0xbc1d('0x2f')]['uniqueid'],_0x2d8fdc[_0xbc1d('0x75')],_0x2d8fdc[_0xbc1d('0x55')],_0x2d8fdc[_0xbc1d('0x76')]||'en')['then'](function(_0x590367){_0x2adc98(null,_0x590367);})[_0xbc1d('0x11')](function(_0x4552ce){_0x2adc98(_0x4552ce);});};AGIVertices['prototype'][_0xbc1d('0x77')]=function(_0x20cabe,_0x366fa3){scripts['googleDialogflowV2'](this['channel'][_0xbc1d('0x45')],_0x20cabe[_0xbc1d('0x78')],_0x20cabe['client_email'],_0x20cabe[_0xbc1d('0x79')],_0x20cabe[_0xbc1d('0x55')],_0x20cabe['dialogflowV2_language']||'en')[_0xbc1d('0xf')](function(_0x328786){_0x366fa3(null,_0x328786);})[_0xbc1d('0x11')](function(_0x490811){_0x366fa3(_0x490811);});};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x7a')]=function(_0x27d0b9,_0x1ec3ad){scripts['sestekNDA'](this[_0xbc1d('0x2f')],_0x27d0b9)[_0xbc1d('0xf')](function(_0x39b56b){_0x1ec3ad(null,_0x39b56b);})['catch'](function(_0x4da72f){_0x1ec3ad(_0x4da72f);});};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x7b')]=function(_0x4bbac2,_0x350a82){scripts['ispeechTTS'](_0x4bbac2[_0xbc1d('0x75')],_0x4bbac2[_0xbc1d('0x55')],_0x4bbac2[_0xbc1d('0x7c')]||_0xbc1d('0x57'),_0x4bbac2[_0xbc1d('0x7d')])[_0xbc1d('0xf')](function(_0x5db83f){_0x350a82(null,_0x5db83f);})['catch'](function(_0x4f6ec4){_0x350a82(_0x4f6ec4);});};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x7e')]=function(_0x38ab7d,_0x4834c2,_0x164dcb){scripts[_0xbc1d('0x7e')](_0x4834c2,_0x38ab7d[_0xbc1d('0x75')],_0x38ab7d[_0xbc1d('0x7f')]||_0xbc1d('0x57'),this[_0xbc1d('0x80')](_0x38ab7d[_0xbc1d('0x81')])?_0x38ab7d[_0xbc1d('0x81')]:undefined)[_0xbc1d('0xf')](function(_0x524c4c){_0x164dcb(null,_0x524c4c);})[_0xbc1d('0x11')](function(_0x13b979){_0x164dcb(_0x13b979);});};AGIVertices[_0xbc1d('0x12')]['awsPolly']=function(_0xbc4163,_0x939c01){scripts[_0xbc1d('0x82')](_0xbc4163[_0xbc1d('0x83')],_0xbc4163[_0xbc1d('0x84')],_0xbc4163[_0xbc1d('0x85')],_0xbc4163[_0xbc1d('0x86')]||_0xbc1d('0x87'),_0xbc4163[_0xbc1d('0x55')],_0xbc4163['aws_text_type']||_0xbc1d('0x55'))[_0xbc1d('0xf')](function(_0x79fb23){_0x939c01(null,_0x79fb23);})[_0xbc1d('0x11')](function(_0x17a297){_0x939c01(_0x17a297);});};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x88')]=function(_0x2558cb,_0xdfd31){scripts[_0xbc1d('0x88')](this[_0xbc1d('0x2f')][_0xbc1d('0x45')],_0x2558cb[_0xbc1d('0x83')],_0x2558cb[_0xbc1d('0x84')],_0x2558cb['aws_lex_region'],_0x2558cb[_0xbc1d('0x55')],_0x2558cb['aws_bot_name'])[_0xbc1d('0xf')](function(_0x14f098){_0xdfd31(null,_0x14f098);})['catch'](function(_0x1e8910){_0xdfd31(_0x1e8910);});};AGIVertices[_0xbc1d('0x12')]['googleASR']=function(_0x4855be,_0x5001a3,_0x56998a){scripts[_0xbc1d('0x89')](_0x5001a3,_0x4855be['key'],_0x4855be[_0xbc1d('0x8a')]||_0xbc1d('0x57'))['then'](function(_0x36332e){_0x56998a(null,_0x36332e);})[_0xbc1d('0x11')](function(_0x56fdd7){_0x56998a(_0x56fdd7);});};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x8b')]=function(_0x3912d9,_0x431e5b,_0x52682a){scripts[_0xbc1d('0x8b')](_0x431e5b,_0x3912d9[_0xbc1d('0x8c')],_0x3912d9[_0xbc1d('0x8d')],_0x3912d9[_0xbc1d('0x6e')])[_0xbc1d('0xf')](function(_0xe55a5f){_0x52682a(null,_0xe55a5f);})[_0xbc1d('0x11')](function(_0x333ead){_0x52682a(_0x333ead);});};AGIVertices['prototype'][_0xbc1d('0x8e')]=function(_0x2c28e5){var _0xaac7b3=_[_0xbc1d('0x63')](verticesWithRetry,_0x2c28e5[_0xbc1d('0x31')])?_0x2c28e5:_[_0xbc1d('0x8f')](_0x2c28e5);for(var _0x49c733 in _0xaac7b3){if(_0xaac7b3[_0xbc1d('0x90')](_0x49c733)){if(_0xaac7b3[_0x49c733]&&_['isString'](_0xaac7b3[_0x49c733])){if(_[_0xbc1d('0x63')](recursiveMapAttributes,_0x49c733)){_0xaac7b3[_0x49c733]=this[_0xbc1d('0x91')](_0xaac7b3[_0x49c733]);}else{_0xaac7b3[_0x49c733]=this[_0xbc1d('0x92')](_0xaac7b3[_0x49c733]);}}}}return _0xaac7b3;};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x93')]=function(_0x4e5e9e){for(var _0x5396fb in _0x4e5e9e){if(_0x4e5e9e[_0xbc1d('0x90')](_0x5396fb)){if(_['isPlainObject'](_0x4e5e9e[_0x5396fb])){this[_0xbc1d('0x93')](_0x4e5e9e[_0x5396fb]);}else if(_['isArray'](_0x4e5e9e[_0x5396fb])){for(var _0x372bae=0x0;_0x372bae<_0x4e5e9e[_0x5396fb][_0xbc1d('0x94')];_0x372bae++){this[_0xbc1d('0x93')](_0x4e5e9e[_0x5396fb][_0x372bae]);}}else if(_[_0xbc1d('0x95')](_0x4e5e9e[_0x5396fb])){_0x4e5e9e[_0x5396fb]=this[_0xbc1d('0x92')](_0x4e5e9e[_0x5396fb]);}}}};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x96')]=function(_0x1b3eb6,_0x2e67fe){for(var _0x1f8417 in _0x1b3eb6){if(_0x1b3eb6[_0xbc1d('0x90')](_0x1f8417)){if(_[_0xbc1d('0x97')](_0x1b3eb6[_0x1f8417])){if(!_[_0xbc1d('0x3d')](_0x1b3eb6[_0x1f8417])){this['saveRestApiResult'](_0x1b3eb6[_0x1f8417],util[_0xbc1d('0x23')](_0xbc1d('0x98'),_0x2e67fe,_0x1f8417));}}else if(_[_0xbc1d('0x99')](_0x1b3eb6[_0x1f8417])){for(var _0x165dd7=0x0;_0x165dd7<_0x1b3eb6[_0x1f8417][_0xbc1d('0x94')];_0x165dd7++){this['saveRestApiResult'](_0x1b3eb6[_0x1f8417][_0x165dd7],util[_0xbc1d('0x23')](_0xbc1d('0x98'),_0x2e67fe,_0x1f8417+'['+_0x165dd7+']'));}}else{if(!_[_0xbc1d('0x3e')](_0x1b3eb6[_0x1f8417])){this[_0xbc1d('0x2f')]['setVariable'](util['format'](_0xbc1d('0x98'),_0x2e67fe,_0x1f8417),_0x1b3eb6[_0x1f8417]);}}}}};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x91')]=function(_0x4830e4){try{var _0x5355b3=JSON['parse'](_0x4830e4);this[_0xbc1d('0x93')](_0x5355b3);return JSON[_0xbc1d('0x70')](_0x5355b3);}catch(_0x8adf71){return this[_0xbc1d('0x92')](_0x4830e4);}};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x92')]=function(_0x159e01){var _0x422fde=_0x159e01[_0xbc1d('0x9a')]('{');for(var _0x4ff687=0x1;_0x4ff687<_0x422fde[_0xbc1d('0x94')];_0x4ff687+=0x1){var _0x5d97e1=_0x422fde[_0x4ff687][_0xbc1d('0x9a')]('}');if(_0x5d97e1[_0xbc1d('0x94')]>0x1){_0x159e01=_0x159e01['replaceAll']('{'+_0x5d97e1[0x0]+'}',this[_0xbc1d('0x2f')]['getVariable'](_0x5d97e1[0x0])[_0xbc1d('0x9b')]||_0x5d97e1[0x0]);}}if(_0x422fde['length']===0x1){return _0x159e01[_0xbc1d('0x9c')]();}return this[_0xbc1d('0x92')](_0x159e01);};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x9d')]=function(_0x34c761,_0x321cb7){var _0x3c880b=this[_0xbc1d('0x2f')][_0xbc1d('0xe')](_0x34c761);if(_0x3c880b[_0xbc1d('0x9e')]===-0x1){return _0x3c880b;}logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x321cb7,_0x3c880b[_0xbc1d('0x9b')]));return this[_0xbc1d('0x2f')][_0xbc1d('0x9f')](_0x321cb7,_0x3c880b[_0xbc1d('0x9b')]);};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x80')]=function(_0x45561f){return _0x45561f&&_0x45561f!=='0'&&_0x45561f!=='-1'&&_0x45561f!=='';};AGIVertices['prototype'][_0xbc1d('0xa0')]=function(_0x2f0eb8){this['createSquareDetailsReport'][_0xbc1d('0x6d')](this,_0x2f0eb8,'-');_0x2f0eb8[_0xbc1d('0xa1')]=_0x2f0eb8[_0xbc1d('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xbc1d('0x12')]['mrcpsynth']=function(_0x99da3f){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x99da3f[_0xbc1d('0x30')]));if(!this[_0xbc1d('0x80')](_0x99da3f[_0xbc1d('0x55')])){return this[_0xbc1d('0x2f')]['noop'](_0xbc1d('0xa2'));}var _0x165b59='\x22'+_0x99da3f[_0xbc1d('0x55')]+'\x22';if(this[_0xbc1d('0x80')](_0x99da3f[_0xbc1d('0x73')])){_0x165b59+=','+_0x99da3f[_0xbc1d('0x73')];}var _0x14b714=this[_0xbc1d('0x2f')]['exec'](_0xbc1d('0xa3'),_0x165b59);if(_0x14b714['result']===-0x1){return _0x14b714;}return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util[_0xbc1d('0x23')]('Executed\x20command\x20MRCPSynth\x20%s',_0x165b59));};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0xa5')]=function(_0x47b47d){logger['info'](util[_0xbc1d('0x23')](_0xbc1d('0xa6'),_0x47b47d['label']));if(!this[_0xbc1d('0x80')](_0x47b47d['grammar'])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0xbc1d('0xa7'));}var _0x242528=_0x47b47d[_0xbc1d('0xa8')];if(this[_0xbc1d('0x80')](_0x47b47d['options'])){_0x242528+=','+_0x47b47d[_0xbc1d('0x73')];}var _0x469fa7=this[_0xbc1d('0x2f')][_0xbc1d('0xa9')](_0xbc1d('0xaa'),_0x242528);if(_0x469fa7[_0xbc1d('0x9e')]===-0x1){return _0x469fa7;}var _0x2db8dc=this['getAndSetVariable'](_0xbc1d('0xab'),_0xbc1d('0xac'));if(_0x2db8dc[_0xbc1d('0x9e')]===-0x1){return _0x2db8dc;}var _0x54c7c5=this[_0xbc1d('0x9d')](_0xbc1d('0xad'),'MRCP_RECOG_TRANSCRIPT');if(_0x54c7c5[_0xbc1d('0x9e')]===-0x1){return _0x54c7c5;}var _0x285ec0=this['getAndSetVariable'](_0xbc1d('0xae'),_0xbc1d('0xaf'));if(_0x285ec0[_0xbc1d('0x9e')]===-0x1){return _0x285ec0;}return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util[_0xbc1d('0x23')](_0xbc1d('0xb0'),_0x242528));};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x8')]=function(_0x540c27){logger['info'](util[_0xbc1d('0x23')](_0xbc1d('0xb1'),_0x540c27[_0xbc1d('0x30')]));return this[_0xbc1d('0x2f')][_0xbc1d('0x8')]([_0x540c27[_0xbc1d('0xb2')],_0x540c27[_0xbc1d('0xb3')]]);};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0xb4')]=function(_0x513974){logger['info'](util[_0xbc1d('0x23')](_0xbc1d('0xb5'),_0x513974[_0xbc1d('0x30')]));if(this[_0xbc1d('0x80')](_0x513974[_0xbc1d('0x61')])){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0xb6'),_0x513974['timeout']));var _0x5287f5=this[_0xbc1d('0x2f')][_0xbc1d('0xb7')](_0x513974[_0xbc1d('0x61')]);if(_0x5287f5[_0xbc1d('0x9e')]===-0x1){return _0x5287f5;}}return this['channel'][_0xbc1d('0xb4')]();};AGIVertices['prototype'][_0xbc1d('0x46')]=function(_0x5917fa){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0xb8'),_0x5917fa[_0xbc1d('0x30')]));if(!this['isConfigured'](_0x5917fa[_0xbc1d('0x43')])){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0x5917fa,_0xbc1d('0xb9'));}_0x5917fa[_0xbc1d('0x44')]=moment();if(this['isConfigured'](_0x5917fa[_0xbc1d('0xba')])){_0x5917fa[_0xbc1d('0x44')]=moment()['add'](_0x5917fa[_0xbc1d('0xba')],_0xbc1d('0xbb'));}if(!this[_0xbc1d('0x80')](_0x5917fa[_0xbc1d('0x48')])){_0x5917fa[_0xbc1d('0x48')]=0x2;}this[_0xbc1d('0x3c')]['sync'](this,_0x5917fa);return this[_0xbc1d('0x2f')]['noop'](util[_0xbc1d('0x23')](_0xbc1d('0xbc'),_0x5917fa[_0xbc1d('0x42')],_0x5917fa[_0xbc1d('0x43')],_0x5917fa[_0xbc1d('0x44')]));};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0xbd')]=function(_0xd4018c){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0xbe'),_0xd4018c['label']));var _0x20b0f9=this[_0xbc1d('0x2f')][_0xbc1d('0xa9')](_0xd4018c[_0xbc1d('0xbf')],_0xd4018c[_0xbc1d('0x73')]);if(_0x20b0f9[_0xbc1d('0x9e')]===-0x1){return _0x20b0f9;}return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util['format'](_0xbc1d('0xc0'),_0xd4018c[_0xbc1d('0xbf')],_0xd4018c[_0xbc1d('0x73')]));};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0xc1')]=function(_0x1afb48){logger['info'](util[_0xbc1d('0x23')](_0xbc1d('0xc2'),_0x1afb48[_0xbc1d('0x30')]));if(!this[_0xbc1d('0x80')](_0x1afb48[_0xbc1d('0x55')])){return this[_0xbc1d('0x2f')]['noop'](_0xbc1d('0xa2'));}var _0x539e21='\x22'+_0x1afb48[_0xbc1d('0x55')]+'\x22';if(this[_0xbc1d('0x80')](_0x1afb48[_0xbc1d('0x73')])){_0x539e21+=','+_0x1afb48[_0xbc1d('0x73')];}var _0xfa49a1=this[_0xbc1d('0x2f')][_0xbc1d('0xa9')](_0xbc1d('0xa3'),_0x539e21);if(_0xfa49a1['result']===-0x1){return _0xfa49a1;}return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util['format'](_0xbc1d('0xc3'),_0x539e21));};AGIVertices[_0xbc1d('0x12')]['sestektts']=function(_0x5386e9){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x5386e9[_0xbc1d('0x30')]));if(!this['isConfigured'](_0x5386e9[_0xbc1d('0x55')])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0xbc1d('0xa2'));}var _0x338249='\x22'+_0x5386e9[_0xbc1d('0x55')]+'\x22';if(this[_0xbc1d('0x80')](_0x5386e9[_0xbc1d('0x73')])){_0x338249+=','+_0x5386e9[_0xbc1d('0x73')];}var _0x3195a2=this[_0xbc1d('0x2f')]['exec']('MRCPSynth',_0x338249);if(_0x3195a2[_0xbc1d('0x9e')]===-0x1){return _0x3195a2;}return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util[_0xbc1d('0x23')](_0xbc1d('0xc3'),_0x338249));};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0xc4')]=function(_0xf627bf){logger['info'](util[_0xbc1d('0x23')](_0xbc1d('0xc5'),_0xf627bf[_0xbc1d('0x30')]));if(!this[_0xbc1d('0x80')](_0xf627bf[_0xbc1d('0xa8')])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')]('no\x20grammar\x20configured');}var _0xa83ba2=_0xf627bf[_0xbc1d('0xa8')];if(this[_0xbc1d('0x80')](_0xf627bf['options'])){_0xa83ba2+=','+_0xf627bf[_0xbc1d('0x73')];}var _0x3ef41d=this['channel'][_0xbc1d('0xa9')](_0xbc1d('0xaa'),_0xa83ba2);if(_0x3ef41d['result']===-0x1){return _0x3ef41d;}var _0x571612=this['getAndSetVariable'](_0xbc1d('0xab'),_0xbc1d('0xc6'));if(_0x571612['result']===-0x1){return _0x571612;}var _0x4f259c=this[_0xbc1d('0x9d')](_0xbc1d('0xad'),_0xbc1d('0xc7'));if(_0x4f259c['result']===-0x1){return _0x4f259c;}var _0x302c98=this[_0xbc1d('0x9d')](_0xbc1d('0xae'),_0xbc1d('0xc8'));if(_0x302c98['result']===-0x1){return _0x302c98;}return this[_0xbc1d('0x2f')]['noop'](util[_0xbc1d('0x23')](_0xbc1d('0xb0'),_0xa83ba2));};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0xc9')]=function(_0x4460ed){logger['info'](util[_0xbc1d('0x23')](_0xbc1d('0xca'),_0x4460ed[_0xbc1d('0x30')]));if(!this[_0xbc1d('0x80')](_0x4460ed[_0xbc1d('0xa8')])){return this['channel'][_0xbc1d('0xa4')](_0xbc1d('0xa7'));}var _0x5e1ef3=_0x4460ed[_0xbc1d('0xa8')];if(this[_0xbc1d('0x80')](_0x4460ed[_0xbc1d('0x73')])){_0x5e1ef3+=','+_0x4460ed[_0xbc1d('0x73')];}var _0x41b657=this[_0xbc1d('0x2f')][_0xbc1d('0xa9')]('MRCPRecog',_0x5e1ef3);if(_0x41b657[_0xbc1d('0x9e')]===-0x1){return _0x41b657;}var _0x5b5593=this[_0xbc1d('0x9d')](_0xbc1d('0xab'),_0xbc1d('0xcb'));if(_0x5b5593[_0xbc1d('0x9e')]===-0x1){return _0x5b5593;}var _0x3d80a9=this[_0xbc1d('0x9d')](_0xbc1d('0xad'),_0xbc1d('0xcc'));if(_0x3d80a9[_0xbc1d('0x9e')]===-0x1){return _0x3d80a9;}var _0x5842bc=this[_0xbc1d('0x9d')](_0xbc1d('0xae'),_0xbc1d('0xcd'));if(_0x5842bc[_0xbc1d('0x9e')]===-0x1){return _0x5842bc;}return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util[_0xbc1d('0x23')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5e1ef3));};AGIVertices[_0xbc1d('0x12')]['database']=function(_0xc93543){logger[_0xbc1d('0x28')](util['format'](_0xbc1d('0xce'),_0xc93543[_0xbc1d('0x30')]));if(!this[_0xbc1d('0x80')](_0xc93543[_0xbc1d('0xcf')])){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0xc93543,_0xbc1d('0xd0'));}var _0x1757ca=this[_0xbc1d('0x15')][_0xbc1d('0x6d')](this,_0xc93543[_0xbc1d('0xcf')]);if(!_0x1757ca){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0xc93543,_0xbc1d('0xd1'));}if(!this[_0xbc1d('0x80')](_0xc93543['query'])){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0xc93543,_0xbc1d('0xd2'));}var _0x1e9f55=_0xc93543[_0xbc1d('0x29')][_0xbc1d('0xd3')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xbc1d('0xa4')](util['format'](_0xbc1d('0xd4'),_0x1e9f55));var _0x3850e5=this[_0xbc1d('0xd5')]['sync'](this,_0x1757ca,_0x1e9f55);this[_0xbc1d('0xd6')]['sync'](this,_0xc93543,_0x1e9f55);if(!this[_0xbc1d('0x80')](_0xc93543[_0xbc1d('0xd7')])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0xbc1d('0xd8'));}var _0x588bdf=this['getVariable'][_0xbc1d('0x6d')](this,_0xc93543[_0xbc1d('0xd7')]);if(!_0x588bdf){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0xc93543,_0xbc1d('0xd9'));}var _0xe6c157=this;_0x3850e5[_0xbc1d('0xda')](function(_0x21371e,_0x2d5fe5){Object[_0xbc1d('0xdb')](_0x21371e)[_0xbc1d('0xda')](function(_0x4a725d){_0xe6c157[_0xbc1d('0x2f')][_0xbc1d('0x9f')](util[_0xbc1d('0x23')](_0xbc1d('0xdc'),_0x588bdf,_0x2d5fe5,_0x4a725d),_0x21371e[_0x4a725d]);});});this[_0xbc1d('0x2f')][_0xbc1d('0x9f')](util[_0xbc1d('0x23')](_0xbc1d('0xdd'),_0x588bdf),_0x3850e5['length']);return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util['format']('variable\x20%s\x20set',_0x588bdf));};AGIVertices[_0xbc1d('0x12')]['dial']=function(_0x10ee69){logger[_0xbc1d('0xde')](util[_0xbc1d('0x23')](_0xbc1d('0xdf'),_0x10ee69['label']));if(!this[_0xbc1d('0x80')](_0x10ee69['sip_id'])){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0x10ee69,'no\x20user\x20selected');}var _0x15bb39=this[_0xbc1d('0xe0')][_0xbc1d('0x6d')](this,_0x10ee69['sip_id']);if(!_0x15bb39){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0x10ee69,'no\x20user\x20found');}var _0x46d37f=this[_0xbc1d('0x2f')][_0xbc1d('0xa9')]('DIAL',[util['format'](_0xbc1d('0xe1'),_0x15bb39),_0x10ee69[_0xbc1d('0x61')],_0x10ee69[_0xbc1d('0xe2')],_0x10ee69['url']]);if(_0x46d37f[_0xbc1d('0x9e')]===-0x1){return _0x46d37f;}return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util['format'](_0xbc1d('0xe3'),_0xbc1d('0xe4')));};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0xe5')]=function(_0x42ecc4){logger['info'](util['format'](_0xbc1d('0xe6'),_0x42ecc4[_0xbc1d('0x30')]));if(!this['isConfigured'](_0x42ecc4[_0xbc1d('0x75')])){return this['channel']['noop']('no\x20key\x20configured');}if(!this[_0xbc1d('0x80')](_0x42ecc4[_0xbc1d('0x55')])){return this[_0xbc1d('0x2f')]['noop'](_0xbc1d('0xa2'));}this['channel'][_0xbc1d('0xe7')]=!![];this[_0xbc1d('0xd6')](_0x42ecc4);this[_0xbc1d('0x3b')](_0x42ecc4[_0xbc1d('0x55')],'in','','');this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util['format'](_0xbc1d('0xe8'),_0x42ecc4[_0xbc1d('0x55')]));var _0x576b07=this['googleDialogflow']['sync'](this,_0x42ecc4);if(_0x576b07){for(var _0x5e7006 in _0x576b07){if(_0x576b07['hasOwnProperty'](_0x5e7006)){this[_0xbc1d('0x2f')][_0xbc1d('0x9f')](util['format'](_0xbc1d('0xe9'),_0x5e7006[_0xbc1d('0xea')]()),_0x576b07[_0x5e7006]);}}this[_0xbc1d('0x3b')](_0x576b07[_0xbc1d('0xeb')],_0xbc1d('0xec'),_0xbc1d('0xe5'),'');return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util['format'](_0xbc1d('0xed'),_0x576b07[_0xbc1d('0xeb')]));}return this['channel']['error'](_0x42ecc4,_0xbc1d('0xee'));};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0xef')]=function(_0x38dfef){logger['info'](util['format'](_0xbc1d('0xf0'),_0x38dfef['label']));if(!this['isConfigured'](_0x38dfef['dialogflowV2_project_id'])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0xbc1d('0xf1'));}if(!this[_0xbc1d('0x80')](_0x38dfef[_0xbc1d('0xf2')])){return this['channel'][_0xbc1d('0xa4')](_0xbc1d('0xf3'));}if(!this[_0xbc1d('0x80')](_0x38dfef[_0xbc1d('0x79')])){return this['channel'][_0xbc1d('0xa4')](_0xbc1d('0xf4'));}if(!this['isConfigured'](_0x38dfef[_0xbc1d('0xf5')])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x38dfef['text'])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0xbc1d('0xa2'));}this[_0xbc1d('0x2f')][_0xbc1d('0xe7')]=!![];this[_0xbc1d('0xd6')](_0x38dfef);this[_0xbc1d('0x3b')](_0x38dfef[_0xbc1d('0x55')],'in','','');this[_0xbc1d('0x2f')]['noop'](util['format'](_0xbc1d('0xf6'),_0x38dfef[_0xbc1d('0x55')]));var _0x542c20=this[_0xbc1d('0x77')]['sync'](this,_0x38dfef);if(_0x542c20){for(var _0x3fa793 in _0x542c20){if(_0x542c20[_0xbc1d('0x90')](_0x3fa793)){if(_0x3fa793!==_0xbc1d('0xf7')){this[_0xbc1d('0x2f')][_0xbc1d('0x9f')](util[_0xbc1d('0x23')](_0xbc1d('0xe9'),_0x3fa793['toUpperCase']()),_0x542c20[_0x3fa793]);}}}this[_0xbc1d('0x3b')](_0x542c20['speech'],'out',_0xbc1d('0xef'),_0x542c20['providerResponse']);return this['channel']['noop'](util[_0xbc1d('0x23')](_0xbc1d('0xf8'),_0x542c20[_0xbc1d('0xeb')]));}return this['channel']['error'](_0x38dfef,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0xf9')]=function(_0x1b1bcd){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x1b1bcd[_0xbc1d('0x30')]));if(!this[_0xbc1d('0x80')](_0x1b1bcd[_0xbc1d('0xfa')])){return this['channel'][_0xbc1d('0xa4')](_0xbc1d('0xfb'));}if(!this[_0xbc1d('0x80')](_0x1b1bcd[_0xbc1d('0xfc')])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0xbc1d('0xfd'));}if(!this['isConfigured'](_0x1b1bcd[_0xbc1d('0xfe')])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0xbc1d('0xff'));}if(!this[_0xbc1d('0x80')](_0x1b1bcd['ndassistant_url'])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')]('no\x20text\x20configured');}this[_0xbc1d('0x2f')][_0xbc1d('0xe7')]=!![];this[_0xbc1d('0xd6')](_0x1b1bcd);this[_0xbc1d('0x3b')](_0x1b1bcd[_0xbc1d('0x55')],'in','','');this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util[_0xbc1d('0x23')](_0xbc1d('0x100'),_0x1b1bcd[_0xbc1d('0x55')]));var _0xda4262=this[_0xbc1d('0x7a')][_0xbc1d('0x6d')](this,_0x1b1bcd);if(_0xda4262){for(var _0xa68de6 in _0xda4262){if(_0xda4262['hasOwnProperty'](_0xa68de6)){this['channel'][_0xbc1d('0x9f')](util[_0xbc1d('0x23')](_0xbc1d('0x101'),_0xa68de6['toUpperCase']()),_0xda4262[_0xa68de6]);}}this[_0xbc1d('0x3b')](_0xda4262['speech'],_0xbc1d('0xec'),_0xbc1d('0xf9'),'');if(_0xda4262['audiofile']){this['channel'][_0xbc1d('0xa4')](util[_0xbc1d('0x23')](_0xbc1d('0x102'),_0xda4262[_0xbc1d('0x103')]));var _0x40c3b3=this[_0xbc1d('0x2f')][_0xbc1d('0x104')](_0xda4262[_0xbc1d('0x103')]);try{fs[_0xbc1d('0x105')](_0xda4262[_0xbc1d('0x103')]+_0xbc1d('0x106'));}catch(_0x267567){logger[_0xbc1d('0x26')](_0x267567);}return _0x40c3b3;}else{return this[_0xbc1d('0x2f')]['noop'](util['format'](_0xbc1d('0x107'),_0xda4262['speech']));}}return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0x1b1bcd,_0xbc1d('0x108'));};AGIVertices[_0xbc1d('0x12')]['end']=function(_0x2c21f9){logger['info'](util[_0xbc1d('0x23')](_0xbc1d('0x109'),_0x2c21f9['label']));return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0xbc1d('0x10a'));};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x10b')]=function(_0x5b071c){logger[_0xbc1d('0x28')](util['format'](_0xbc1d('0x10c'),_0x5b071c[_0xbc1d('0x30')]));var _0x3ef967='';if(_0x5b071c[_0xbc1d('0x10d')]){if(!this[_0xbc1d('0x80')](_0x5b071c[_0xbc1d('0x10d')])){return this['channel'][_0xbc1d('0x26')](_0x5b071c,_0xbc1d('0x10e'));}else{var _0x45bb52=parseInt(_0x5b071c[_0xbc1d('0x10d')],0xa);if(isNaN(_0x45bb52)){_0x3ef967=_0x5b071c[_0xbc1d('0x10d')];}else{_0x3ef967=this[_0xbc1d('0x19')][_0xbc1d('0x6d')](this,_0x5b071c[_0xbc1d('0x10d')]);if(!_0x3ef967){return this[_0xbc1d('0x2f')]['error'](_0x5b071c,_0xbc1d('0x10f'));}}}}else if(_0x5b071c[_0xbc1d('0x110')]){_0x3ef967=_0x5b071c[_0xbc1d('0x110')];}else{return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0x5b071c,'no\x20trunk\x20selected');}var _0x264522=this[_0xbc1d('0x2f')][_0xbc1d('0xa9')](_0xbc1d('0xe4'),[util['format']('SIP/%s/%s',_0x3ef967,_0x5b071c['phone']),_0x5b071c[_0xbc1d('0x61')],_0x5b071c[_0xbc1d('0xe2')],_0x5b071c['url']]);if(_0x264522['result']===-0x1){return _0x264522;}return this[_0xbc1d('0x2f')]['noop'](util[_0xbc1d('0x23')](_0xbc1d('0xe3'),_0xbc1d('0xe4')));};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x111')]=function(_0x6e2036){logger[_0xbc1d('0x28')](util['format'](_0xbc1d('0x112'),_0x6e2036[_0xbc1d('0x30')]));return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0xbc1d('0x111'));};AGIVertices[_0xbc1d('0x12')]['getdigits']=function(_0x2d610f){logger[_0xbc1d('0x28')](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x2d610f['label']));if(_0x2d610f[_0xbc1d('0xa1')]===0x0){return this[_0xbc1d('0xa0')](_0x2d610f);}_0x2d610f['retry']-=0x1;if(!this[_0xbc1d('0x80')](_0x2d610f[_0xbc1d('0x113')])){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0x2d610f,_0xbc1d('0x114'));}var _0x5eb38c=this[_0xbc1d('0x1a')][_0xbc1d('0x6d')](this,_0x2d610f[_0xbc1d('0x113')]);if(!_0x5eb38c){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0x2d610f,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x2d610f[_0xbc1d('0xd7')])){return this[_0xbc1d('0x2f')]['error'](_0xbc1d('0xd8'));}var _0x470b70=this[_0xbc1d('0x2f')]['getData'](_0x5eb38c,_0x2d610f['response'],_0x2d610f[_0xbc1d('0x115')]);var _0x2d83c0=_0x470b70[_0xbc1d('0x9e')]?_0x470b70['result'][_0xbc1d('0x9c')]():'';logger[_0xbc1d('0x28')](_0xbc1d('0x116'),JSON[_0xbc1d('0x70')](_0x470b70));if(_0x470b70[_0xbc1d('0x9e')]===-0x1){this[_0xbc1d('0xd6')][_0xbc1d('0x6d')](this,_0x2d610f,_0x2d83c0);return _0x470b70;}else if(_0x470b70[_0xbc1d('0x9b')]===_0xbc1d('0x61')){_0x470b70[_0xbc1d('0x9e')]=_0x2d83c0['length']>=parseInt(_0x2d610f[_0xbc1d('0x117')])?'x':'i';}else{_0x470b70[_0xbc1d('0x9e')]=_0x2d83c0['length']>=parseInt(_0x2d610f[_0xbc1d('0x117')])&&_0x2d83c0[_0xbc1d('0x94')]<=parseInt(_0x2d610f[_0xbc1d('0x115')])?'x':'i';}var _0x3d9657=this[_0xbc1d('0xe')][_0xbc1d('0x6d')](this,_0x2d610f[_0xbc1d('0xd7')]);if(!_0x3d9657){return this[_0xbc1d('0x2f')]['error'](_0x2d610f,_0xbc1d('0xd9'));}this[_0xbc1d('0x2f')][_0xbc1d('0x9f')](_0x3d9657,_0x2d83c0);if(this[_0xbc1d('0x80')](_0x2d610f[_0xbc1d('0x118')])){var _0xb01928=parseInt(_0x2d610f[_0xbc1d('0x118')],0xa);var _0x4d033c=rs['generate']({'charset':'*','length':_0xb01928});var _0x24c484=_0x2d83c0[_0xbc1d('0x94')];if(_0x24c484>0x0){if(_0x24c484>_0xb01928){this[_0xbc1d('0xd6')][_0xbc1d('0x6d')](this,_0x2d610f,_0x2d610f[_0xbc1d('0x119')]===_0xbc1d('0x11a')?_0x4d033c+_0x2d83c0[_0xbc1d('0x11b')](_0xb01928):_0x2d83c0[_0xbc1d('0x11b')](0x0,_0x24c484-_0xb01928)+_0x4d033c);}else{this[_0xbc1d('0xd6')]['sync'](this,_0x2d610f,rs[_0xbc1d('0x11c')]({'charset':'*','length':_0x24c484}));}}else{this['createSquareDetailsReport'][_0xbc1d('0x6d')](this,_0x2d610f,'');}}else{this[_0xbc1d('0xd6')][_0xbc1d('0x6d')](this,_0x2d610f,_0x2d83c0);}return _0x470b70;};AGIVertices[_0xbc1d('0x12')]['getsecretdigits']=function(_0x26b0d6){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x26b0d6['label']));return this[_0xbc1d('0x11d')](_0x26b0d6);};AGIVertices[_0xbc1d('0x12')]['goal']=function(_0x5cbe79){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0x11e'),_0x5cbe79['label']));this['createSquareDetailsReport'][_0xbc1d('0x6d')](this,_0x5cbe79,_0x5cbe79[_0xbc1d('0x11f')]);return this['channel']['noop'](util[_0xbc1d('0x23')](_0xbc1d('0x120'),_0x5cbe79[_0xbc1d('0x11f')]));};AGIVertices['prototype'][_0xbc1d('0x121')]=function(_0x49d43f){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x49d43f[_0xbc1d('0x30')]));if(!this[_0xbc1d('0x80')](_0x49d43f[_0xbc1d('0x83')])||!this[_0xbc1d('0x80')](_0x49d43f[_0xbc1d('0x84')])){return this['channel']['noop'](_0xbc1d('0x122'));}if(!this[_0xbc1d('0x80')](_0x49d43f['text'])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0xbc1d('0xa2'));}this['channel'][_0xbc1d('0xa4')](util['format'](_0xbc1d('0x123'),_0x49d43f[_0xbc1d('0x55')]));var _0x19bb60=this['awsPolly'][_0xbc1d('0x6d')](this,_0x49d43f);if(_0x19bb60){this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util[_0xbc1d('0x23')](_0xbc1d('0x124'),_0x19bb60));var _0x4a43da=this[_0xbc1d('0x2f')][_0xbc1d('0x104')](_0x19bb60);try{fs[_0xbc1d('0x105')](_0x19bb60+_0xbc1d('0x106'));}catch(_0x2e9c7d){logger[_0xbc1d('0x26')](_0x2e9c7d);}return _0x4a43da;}return this['channel'][_0xbc1d('0x26')](_0x49d43f,_0xbc1d('0x125'));};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x126')]=function(_0x1607a4){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x1607a4[_0xbc1d('0x30')]));if(!this['isConfigured'](_0x1607a4['aws_access_key_id'])||!this['isConfigured'](_0x1607a4[_0xbc1d('0x84')])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0xbc1d('0x122'));}if(!this[_0xbc1d('0x80')](_0x1607a4[_0xbc1d('0x127')])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0xbc1d('0x128'));}if(!this[_0xbc1d('0x80')](_0x1607a4[_0xbc1d('0x55')])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0xbc1d('0xa2'));}this[_0xbc1d('0x2f')][_0xbc1d('0xe7')]=!![];this[_0xbc1d('0xd6')](_0x1607a4);this['createSquareMessage'](_0x1607a4['text'],'in','','');this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util[_0xbc1d('0x23')]('Trying\x20Amazon\x20Lex:\x20%s',_0x1607a4[_0xbc1d('0x55')]));var _0x5a7389=this['awsLex'][_0xbc1d('0x6d')](this,_0x1607a4);if(_0x5a7389){for(var _0x55a61c in _0x5a7389){if(_0x5a7389[_0xbc1d('0x90')](_0x55a61c)&&_['isString'](_0x5a7389[_0x55a61c])){this[_0xbc1d('0x2f')][_0xbc1d('0x9f')](util['format']('AWS_LEX_%s',_0x55a61c[_0xbc1d('0xea')]()),_0x5a7389[_0x55a61c]);}}if(_['isNil'](_0x5a7389[_0xbc1d('0x129')])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0xbc1d('0x12a'));}else{this[_0xbc1d('0x3b')](_0x5a7389['message'],_0xbc1d('0xec'),'amazonlex','');return this[_0xbc1d('0x2f')]['noop'](util['format'](_0xbc1d('0x12b'),_0x5a7389[_0xbc1d('0x129')]));}}return this['channel']['error'](_0x1607a4,_0xbc1d('0x12c'));};AGIVertices['prototype'][_0xbc1d('0x12d')]=function(_0x403fe9){logger['info'](util[_0xbc1d('0x23')](_0xbc1d('0x12e'),_0x403fe9[_0xbc1d('0x30')],_0x403fe9['timeout']));if(!this[_0xbc1d('0x80')](_0x403fe9[_0xbc1d('0x75')])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0xbc1d('0x12f'));}var _0x5b4ff0=_0xbc1d('0x130');var _0x959619=util[_0xbc1d('0x23')](_0xbc1d('0x131'),FILES_PATH,rs[_0xbc1d('0x11c')](0x4));var _0xc0ed0c=util['format'](_0xbc1d('0x98'),_0x959619,_0x5b4ff0);var _0x9c7c61=!![];if(_0x403fe9['beep']===_0xbc1d('0x132')){_0x9c7c61=![];}var _0x4e0534=this[_0xbc1d('0x2f')][_0xbc1d('0x133')](_0x959619,_0x5b4ff0,_0x403fe9['intKey'],_0x403fe9[_0xbc1d('0x61')],undefined,_0x9c7c61);if(_0x4e0534[_0xbc1d('0x9e')]!==-0x1){this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util[_0xbc1d('0x23')](_0xbc1d('0x134'),_0xc0ed0c));var _0x1d2bce=this[_0xbc1d('0x89')][_0xbc1d('0x6d')](this,_0x403fe9,_0xc0ed0c);if(_0x1d2bce){for(var _0x1c50d2 in _0x1d2bce){if(_0x1d2bce['hasOwnProperty'](_0x1c50d2)){this[_0xbc1d('0x2f')][_0xbc1d('0x9f')](util[_0xbc1d('0x23')](_0xbc1d('0x135'),_0x1c50d2[_0xbc1d('0xea')]()),_0x1d2bce[_0x1c50d2]);}}return this[_0xbc1d('0x2f')]['noop'](util[_0xbc1d('0x23')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x1d2bce)));}}return _0x4e0534;};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x136')]=function(_0x10ba1a){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0x137'),_0x10ba1a[_0xbc1d('0x30')]));if(!this[_0xbc1d('0x80')](_0x10ba1a[_0xbc1d('0x8c')])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x10ba1a[_0xbc1d('0x8d')])){return this['channel'][_0xbc1d('0xa4')]('no\x20appsecret\x20configured');}var _0x562c68=_0xbc1d('0x130');var _0xfa827d=util[_0xbc1d('0x23')](_0xbc1d('0x131'),FILES_PATH,rs[_0xbc1d('0x11c')](0x4));var _0x199732=util['format']('%s.%s',_0xfa827d,_0x562c68);var _0x3a72c3=!![];if(_0x10ba1a[_0xbc1d('0x138')]===_0xbc1d('0x132')){_0x3a72c3=![];}var _0x1c4c97=this[_0xbc1d('0x2f')][_0xbc1d('0x133')](_0xfa827d,_0x562c68,_0x10ba1a['intKey'],_0x10ba1a[_0xbc1d('0x61')],undefined,_0x3a72c3);if(_0x1c4c97[_0xbc1d('0x9e')]!==-0x1){this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util['format'](_0xbc1d('0x139'),_0x199732));var _0x1906df=this[_0xbc1d('0x8b')][_0xbc1d('0x6d')](this,_0x10ba1a,_0x199732);if(_0x1906df){for(var _0x4a6105 in _0x1906df){if(_0x1906df[_0xbc1d('0x90')](_0x4a6105)){this[_0xbc1d('0x2f')]['setVariable'](util[_0xbc1d('0x23')]('TILDE_ASR_%s',_0x4a6105['toUpperCase']()),_0x1906df[_0x4a6105]);}}return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util['format']('TildeASR\x20Result\x20%s',JSON[_0xbc1d('0x70')](_0x1906df)));}}return _0x1c4c97;};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x13a')]=function(_0x290039){logger['info'](util[_0xbc1d('0x23')](_0xbc1d('0x13b'),_0x290039[_0xbc1d('0x30')]));return this[_0xbc1d('0x2f')][_0xbc1d('0x13c')](_0x290039[_0xbc1d('0x36')],_0x290039[_0xbc1d('0x37')],_0x290039[_0xbc1d('0x13d')]);};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x13e')]=function(_0x403f14){logger['info'](util[_0xbc1d('0x23')](_0xbc1d('0x13f'),_0x403f14[_0xbc1d('0x30')]));if(!this[_0xbc1d('0x80')](_0x403f14[_0xbc1d('0x140')])){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0x403f14,_0xbc1d('0x141'));}try{var _0x331f90=eval(_0x403f14[_0xbc1d('0x140')])?_0xbc1d('0x142'):_0xbc1d('0x143');this['channel'][_0xbc1d('0xa4')](util['format'](_0xbc1d('0x144'),_0x403f14['condition'],_0x331f90));return{'code':0xc8,'result':_0x331f90};}catch(_0x465f85){return{'code':0xc8,'result':_0xbc1d('0x143')};}};AGIVertices[_0xbc1d('0x12')]['gotoiftime']=function(_0x18f5ab){logger['info'](util[_0xbc1d('0x23')](_0xbc1d('0x145'),_0x18f5ab['label']));if(!this[_0xbc1d('0x80')](_0x18f5ab[_0xbc1d('0x146')])){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0x18f5ab,'no\x20interval\x20configured');}var _0x2a15b4=this[_0xbc1d('0x1e')][_0xbc1d('0x6d')](this,_0x18f5ab[_0xbc1d('0x146')]);if(!_0x2a15b4){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0x18f5ab,_0xbc1d('0x147'));}for(var _0x18d48d=0x0;_0x18d48d<_0x2a15b4[_0xbc1d('0x94')];_0x18d48d+=0x1){var _0x51b654=this['channel'][_0xbc1d('0xe')](util[_0xbc1d('0x23')](_0xbc1d('0x148'),_0x2a15b4[_0x18d48d]));if(_0x51b654[_0xbc1d('0x9e')]===-0x1){return _0x51b654;}logger['info'](util[_0xbc1d('0x23')](_0xbc1d('0x149'),_0x2a15b4[_0x18d48d],_0x51b654[_0xbc1d('0x9b')]));if(_0x51b654[_0xbc1d('0x9b')]==='true'){logger['info'](util[_0xbc1d('0x23')](_0xbc1d('0x149'),_0x2a15b4[_0x18d48d],_0xbc1d('0x142')));this[_0xbc1d('0x2f')]['noop'](util[_0xbc1d('0x23')](_0xbc1d('0x149'),_0x2a15b4[_0x18d48d],_0xbc1d('0x142')));return{'code':0xc8,'result':'true'};}else{logger[_0xbc1d('0x28')](util['format'](_0xbc1d('0x149'),_0x2a15b4[_0x18d48d],_0xbc1d('0x143')));this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util['format'](_0xbc1d('0x149'),_0x2a15b4[_0x18d48d],'false'));}}return{'code':0xc8,'result':_0xbc1d('0x143')};};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x14a')]=function(_0x3e6310){logger[_0xbc1d('0x28')](util['format'](_0xbc1d('0x14b'),_0x3e6310['label']));return this[_0xbc1d('0x2f')]['hangup']();};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x14c')]=function(_0x471f35){logger['info'](util[_0xbc1d('0x23')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x471f35[_0xbc1d('0x30')]));if(!this['isConfigured'](_0x471f35[_0xbc1d('0x75')])){return this[_0xbc1d('0x2f')]['noop'](_0xbc1d('0x12f'));}var _0x3d63a0=_0xbc1d('0x130');var _0x3f946b=util[_0xbc1d('0x23')](_0xbc1d('0x131'),FILES_PATH,rs[_0xbc1d('0x11c')](0x4));var _0x48cc82=util['format'](_0xbc1d('0x98'),_0x3f946b,_0x3d63a0);var _0x1b346f=!![];if(_0x471f35[_0xbc1d('0x138')]===_0xbc1d('0x132')){_0x1b346f=![];}var _0x2a3b9c=this[_0xbc1d('0x2f')]['recordFile'](_0x3f946b,_0x3d63a0,_0x471f35[_0xbc1d('0x14d')],_0x471f35[_0xbc1d('0x61')],undefined,_0x1b346f);if(_0x2a3b9c['result']!==-0x1){this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util[_0xbc1d('0x23')](_0xbc1d('0x14e'),_0x48cc82));var _0x56963c=this[_0xbc1d('0x7e')][_0xbc1d('0x6d')](this,_0x471f35,_0x48cc82);if(_0x56963c){for(var _0x3f7b17 in _0x56963c){if(_0x56963c[_0xbc1d('0x90')](_0x3f7b17)){this[_0xbc1d('0x2f')]['setVariable'](util['format'](_0xbc1d('0x14f'),_0x3f7b17[_0xbc1d('0xea')]()),_0x56963c[_0x3f7b17]);}}return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util[_0xbc1d('0x23')](_0xbc1d('0x150'),JSON[_0xbc1d('0x70')](_0x56963c)));}}return _0x2a3b9c;};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x151')]=function(_0x384988){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x384988['label']));if(!this[_0xbc1d('0x80')](_0x384988[_0xbc1d('0x75')])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0xbc1d('0x12f'));}if(!this[_0xbc1d('0x80')](_0x384988[_0xbc1d('0x55')])){return this['channel'][_0xbc1d('0xa4')](_0xbc1d('0xa2'));}this['channel'][_0xbc1d('0xa4')](util['format'](_0xbc1d('0x152'),_0x384988[_0xbc1d('0x55')]));var _0x2c9e8b=this[_0xbc1d('0x7b')]['sync'](this,_0x384988);if(_0x2c9e8b){this['channel'][_0xbc1d('0xa4')](util[_0xbc1d('0x23')]('ispeech\x20%s\x20file\x20created',_0x2c9e8b));var _0x3f9b50=this['channel']['streamFile'](_0x2c9e8b,_0x384988[_0xbc1d('0x14d')]);try{fs[_0xbc1d('0x105')](_0x2c9e8b+_0xbc1d('0x106'));}catch(_0x55f193){logger['error'](_0x55f193);}return _0x3f9b50;}return this[_0xbc1d('0x2f')]['error'](_0x384988,_0xbc1d('0x153'));};AGIVertices['prototype'][_0xbc1d('0x154')]=function(_0x1e0f0a){logger[_0xbc1d('0x28')](util['format'](_0xbc1d('0x155'),_0x1e0f0a['label']));if(!this[_0xbc1d('0x80')](_0x1e0f0a[_0xbc1d('0x156')])){return this[_0xbc1d('0x2f')]['error'](_0x1e0f0a,_0xbc1d('0x157'));}logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0x158'),this[_0xbc1d('0x2f')]['callerid'],_0x1e0f0a['findBy']));var _0xbb5efe=this['agentLogin'][_0xbc1d('0x6d')](this,_0x1e0f0a[_0xbc1d('0x156')]);if(_0xbb5efe){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0x159'),this[_0xbc1d('0x2f')][_0xbc1d('0x33')],_0x1e0f0a[_0xbc1d('0x156')]));this['channel']['noop'](util[_0xbc1d('0x23')](_0xbc1d('0x159'),this[_0xbc1d('0x2f')][_0xbc1d('0x33')],_0x1e0f0a[_0xbc1d('0x156')]));return{'code':0xc8,'result':_0xbc1d('0x15a')};}else{logger[_0xbc1d('0x28')](util['format'](_0xbc1d('0x15b'),this['channel'][_0xbc1d('0x33')],_0x1e0f0a['findBy']));this[_0xbc1d('0x2f')]['noop'](util[_0xbc1d('0x23')](_0xbc1d('0x15b'),this[_0xbc1d('0x2f')][_0xbc1d('0x33')],_0x1e0f0a[_0xbc1d('0x156')]));return{'code':0xc8,'result':_0xbc1d('0x15c')};}};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x15d')]=function(_0x54fc5b){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x54fc5b[_0xbc1d('0x30')]));if(!this['isConfigured'](_0x54fc5b['findBy'])){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0x54fc5b,'no\x20find\x20by\x20configured');}logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0x158'),this[_0xbc1d('0x2f')]['callerid'],_0x54fc5b[_0xbc1d('0x156')]));var _0x3eefba=this[_0xbc1d('0x4e')][_0xbc1d('0x6d')](this,_0x54fc5b['findBy']);if(_0x3eefba){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0x159'),this[_0xbc1d('0x2f')]['callerid'],_0x54fc5b['findBy']));this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util[_0xbc1d('0x23')](_0xbc1d('0x159'),this[_0xbc1d('0x2f')][_0xbc1d('0x33')],_0x54fc5b[_0xbc1d('0x156')]));return{'code':0xc8,'result':_0xbc1d('0x15a')};}else{logger['info'](util[_0xbc1d('0x23')](_0xbc1d('0x15b'),this[_0xbc1d('0x2f')][_0xbc1d('0x33')],_0x54fc5b[_0xbc1d('0x156')]));this['channel']['noop'](util[_0xbc1d('0x23')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xbc1d('0x2f')][_0xbc1d('0x33')],_0x54fc5b[_0xbc1d('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['math']=function(_0x3845f2){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0x15e'),_0x3845f2['label']));if(!this[_0xbc1d('0x80')](_0x3845f2[_0xbc1d('0x15f')])){return this['channel'][_0xbc1d('0x26')](_0x3845f2,_0xbc1d('0x160'));}this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util[_0xbc1d('0x23')]('math\x20%s',_0x3845f2[_0xbc1d('0x15f')]));var _0x509aad=eval(_0x3845f2[_0xbc1d('0x15f')]);if(!this['isConfigured'](_0x3845f2['variable_id'])){return this['channel'][_0xbc1d('0xa4')](_0xbc1d('0xd8'));}var _0x3d8330=this[_0xbc1d('0xe')][_0xbc1d('0x6d')](this,_0x3845f2[_0xbc1d('0xd7')]);if(!_0x3d8330){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0x3845f2,_0xbc1d('0xd9'));}if(_[_0xbc1d('0x99')](_0x509aad)){var _0xc9e392=this;_0x509aad['forEach'](function(_0x455001,_0x484ffe){_0xc9e392[_0xbc1d('0x2f')]['setVariable'](util['format'](_0xbc1d('0x161'),_0x3d8330,_0x484ffe),_0x455001);});return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util[_0xbc1d('0x23')](_0xbc1d('0x162'),_0x3d8330));}else{return this[_0xbc1d('0x2f')][_0xbc1d('0x9f')](_0x3d8330,_0x509aad);}};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0xa')]=function(_0x339598){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0x163'),_0x339598[_0xbc1d('0x30')]));if(_0x339598[_0xbc1d('0xa1')]===0x0){return this[_0xbc1d('0xa0')](_0x339598);}_0x339598[_0xbc1d('0xa1')]-=0x1;if(!this['isConfigured'](_0x339598[_0xbc1d('0x113')])){return this['channel']['error'](_0x339598,_0xbc1d('0x114'));}var _0x3be805=this[_0xbc1d('0x1a')][_0xbc1d('0x6d')](this,_0x339598[_0xbc1d('0x113')]);if(!_0x3be805){return this['channel']['error'](_0x339598,_0xbc1d('0x164'));}var _0x1ff0b6=this[_0xbc1d('0x2f')][_0xbc1d('0x165')](_0x3be805,_0x339598[_0xbc1d('0x166')],_0x339598[_0xbc1d('0x167')]);var _0x8b6fe6=_0x1ff0b6['result'];if(_0x1ff0b6[_0xbc1d('0x9e')]===-0x1){this['createSquareDetailsReport'][_0xbc1d('0x6d')](this,_0x339598,'-1');return _0x1ff0b6;}else if(_0x1ff0b6[_0xbc1d('0x9b')]==='timeout'){_0x1ff0b6[_0xbc1d('0x9e')]=_0x1ff0b6[_0xbc1d('0x9e')][_0xbc1d('0x94')]>0x0?_0x1ff0b6['result']:'t';}else if(_['isEmpty'](_0x1ff0b6[_0xbc1d('0x9e')])){_0x1ff0b6[_0xbc1d('0x9e')]='#';_0x8b6fe6='#';}if(!this[_0xbc1d('0x80')](_0x339598[_0xbc1d('0xd7')])){this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0xbc1d('0xd8'));}else{var _0x28f15e=this[_0xbc1d('0xe')]['sync'](this,_0x339598[_0xbc1d('0xd7')]);if(!_0x28f15e){return this['channel'][_0xbc1d('0x26')](_0x339598,'no\x20variable\x20found');}this[_0xbc1d('0x2f')][_0xbc1d('0x9f')](_0x28f15e,_0x8b6fe6);}this['createSquareDetailsReport'][_0xbc1d('0x6d')](this,_0x339598,_0x8b6fe6);return _0x1ff0b6;};AGIVertices[_0xbc1d('0x12')]['noop']=function(_0x458351){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0x168'),_0x458351[_0xbc1d('0x30')]));return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0x458351[_0xbc1d('0x169')]||_0x458351[_0xbc1d('0x30')]);};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x16a')]=function(_0x305ac5){logger['info'](util[_0xbc1d('0x23')](_0xbc1d('0x16b'),_0x305ac5[_0xbc1d('0x30')]));if(!this['isConfigured'](_0x305ac5[_0xbc1d('0x156')])){return this['channel'][_0xbc1d('0x26')](_0x305ac5,_0xbc1d('0x157'));}logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0x158'),this['channel'][_0xbc1d('0x33')],_0x305ac5[_0xbc1d('0x156')]));var _0x546f39=this[_0xbc1d('0x49')][_0xbc1d('0x6d')](this,_0x305ac5[_0xbc1d('0x16c')]);var _0x53d9c5=this[_0xbc1d('0x4b')][_0xbc1d('0x6d')](this,_0x305ac5[_0xbc1d('0x156')],_0x546f39);if(_0x53d9c5){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0x159'),this[_0xbc1d('0x2f')][_0xbc1d('0x33')],_0x305ac5[_0xbc1d('0x156')]));this[_0xbc1d('0x2f')]['noop'](util[_0xbc1d('0x23')](_0xbc1d('0x159'),this['channel']['callerid'],_0x305ac5[_0xbc1d('0x156')]));return{'code':0xc8,'result':'success'};}else{logger[_0xbc1d('0x28')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xbc1d('0x2f')][_0xbc1d('0x33')],_0x305ac5['findBy']));this[_0xbc1d('0x2f')]['noop'](util[_0xbc1d('0x23')](_0xbc1d('0x159'),this['channel'][_0xbc1d('0x33')],_0x305ac5[_0xbc1d('0x156')]));return{'code':0xc8,'result':_0xbc1d('0x15c')};}};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x16d')]=function(_0x2c99b7){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0x16e'),_0x2c99b7[_0xbc1d('0x30')]));if(!this['isConfigured'](_0x2c99b7['file_id'])){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0x2c99b7,_0xbc1d('0x114'));}var _0x19d227=this[_0xbc1d('0x1a')][_0xbc1d('0x6d')](this,_0x2c99b7['file_id']);if(!_0x19d227){return this['channel'][_0xbc1d('0x26')](_0x2c99b7,_0xbc1d('0x164'));}var _0x2a5e46=this['channel'][_0xbc1d('0xa9')](_0xbc1d('0x16f'),[_0x19d227,_0x2c99b7[_0xbc1d('0xe2')]]);if(_0x2a5e46[_0xbc1d('0x9e')]===-0x1){return _0x2a5e46;}return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util[_0xbc1d('0x23')](_0xbc1d('0xc0'),_0xbc1d('0x16f'),_0x19d227));};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x170')]=function(_0x5a8052){logger[_0xbc1d('0x28')](util['format'](_0xbc1d('0x171'),_0x5a8052[_0xbc1d('0x30')]));if(!this[_0xbc1d('0x80')](_0x5a8052[_0xbc1d('0x172')])){return this[_0xbc1d('0x2f')]['error'](_0x5a8052,_0xbc1d('0x173'));}var _0x3eee0b='';var _0x5b9ac6=parseInt(_0x5a8052[_0xbc1d('0x172')],0xa);if(isNaN(_0x5b9ac6)){_0x3eee0b=_0x5a8052[_0xbc1d('0x172')];}else{_0x3eee0b=this[_0xbc1d('0x13')][_0xbc1d('0x6d')](this,_0x5a8052['queue_id']);if(!_0x3eee0b){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0x5a8052,_0xbc1d('0x174'));}}var _0x3481da='';if(this[_0xbc1d('0x80')](_0x5a8052[_0xbc1d('0x113')])){var _0x1653e2=this[_0xbc1d('0x1a')]['sync'](this,_0x5a8052['file_id']);if(_0x1653e2){_0x3481da=_0x1653e2;}}this[_0xbc1d('0xd6')][_0xbc1d('0x6d')](this,_0x5a8052,_0x3eee0b);if(_0x5a8052[_0xbc1d('0xe2')][_0xbc1d('0x175')]('x')<0x0){_0x5a8052['opts']+='x';}if(_0x5a8052[_0xbc1d('0xe2')][_0xbc1d('0x175')]('X')<0x0){_0x5a8052[_0xbc1d('0xe2')]+='X';}this[_0xbc1d('0x2f')][_0xbc1d('0x9f')](_0xbc1d('0x176'),_0x3eee0b?_0x3eee0b['toLowerCase']():'');var _0x45c731=this[_0xbc1d('0x2f')]['exec'](_0xbc1d('0x177'),[_0x3eee0b,_0x5a8052[_0xbc1d('0xe2')],_0x5a8052[_0xbc1d('0x5f')],_0x3481da,_0x5a8052[_0xbc1d('0x61')],_0x5a8052[_0xbc1d('0x8')],_0x5a8052['macro'],_0x5a8052[_0xbc1d('0x178')],'',_0x5a8052[_0xbc1d('0x179')]]);if(_0x45c731[_0xbc1d('0x9e')]===-0x1){return _0x45c731;}return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util['format'](_0xbc1d('0xc0'),_0xbc1d('0x177'),_0x3eee0b));};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x17a')]=function(_0x5ad28f){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0x17b'),_0x5ad28f['label']));var _0x3f6c3d=_0x5ad28f[_0xbc1d('0x17c')]||_0xbc1d('0x130');var _0x28710c=util[_0xbc1d('0x23')](_0xbc1d('0x17d'),this[_0xbc1d('0x2f')]['uniqueid'],rs[_0xbc1d('0x11c')](0x5));var _0x512399=util[_0xbc1d('0x23')](_0xbc1d('0x17e'),FILES_PATH,_0x28710c,_0x3f6c3d);var _0x2170c3=util[_0xbc1d('0x23')](_0xbc1d('0x131'),FILES_PATH,_0x28710c);this['createSquareRecording'][_0xbc1d('0x6d')](this,_0x5ad28f,_0x28710c,_0x512399);this['channel'][_0xbc1d('0x9f')]('RECORDING_SAVENAME',_0x28710c);logger['info'](_0xbc1d('0x17f'),_0x2170c3,_0x3f6c3d,_0x5ad28f[_0xbc1d('0x180')],_0x5ad28f[_0xbc1d('0x61')]);return this[_0xbc1d('0x2f')][_0xbc1d('0x133')](_0x2170c3,_0x3f6c3d,_0x5ad28f['escape_digits'],_0x5ad28f[_0xbc1d('0x61')],undefined,!![]);};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x181')]=function(_0xdb52ac){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0x182'),_0xdb52ac[_0xbc1d('0x30')]));if(!this['isConfigured'](_0xdb52ac[_0xbc1d('0x5f')])){return this['channel'][_0xbc1d('0xa4')](_0xbc1d('0x183'));}var _0x560f56=this[_0xbc1d('0x5e')][_0xbc1d('0x6d')](this,_0xdb52ac);logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')]('Response:',util['inspect'](_0x560f56,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0xdb52ac[_0xbc1d('0xd7')])){return this['channel'][_0xbc1d('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x181305=this[_0xbc1d('0xe')][_0xbc1d('0x6d')](this,_0xdb52ac[_0xbc1d('0xd7')]);if(!_0x181305){return this['channel'][_0xbc1d('0x26')](_0xdb52ac,_0xbc1d('0xd9'));}this['channel'][_0xbc1d('0x9f')](util['format']('%s_STATUS_CODE',_0x181305),_0x560f56[_0xbc1d('0x72')]?_0x560f56[_0xbc1d('0x72')]:_0xbc1d('0x184'));this['channel'][_0xbc1d('0x9f')](util[_0xbc1d('0x23')](_0xbc1d('0x185'),_0x181305),_0x560f56[_0xbc1d('0x186')]?_0x560f56[_0xbc1d('0x186')]:'OK');if(_0x560f56['body']){try{this[_0xbc1d('0x96')](_0x560f56[_0xbc1d('0x66')],_0x181305);}catch(_0x45f1f5){logger['error'](util[_0xbc1d('0x23')](_0xbc1d('0x187'),_0x181305));}}return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util['format']('variable\x20%s\x20set',_0x181305));};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x188')]=function(_0xc70702){logger[_0xbc1d('0x28')](util['format'](_0xbc1d('0x189'),_0xc70702['label']));return this[_0xbc1d('0x2f')][_0xbc1d('0x18a')](_0xc70702[_0xbc1d('0x18b')][_0xbc1d('0xd3')](/\s+/g,''),_0xc70702[_0xbc1d('0x180')]);};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x18c')]=function(_0x226c2e){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x226c2e['label']));return this[_0xbc1d('0x2f')][_0xbc1d('0x18d')](_0x226c2e[_0xbc1d('0x62')]['replace'](/\s+/g,''),_0x226c2e[_0xbc1d('0x180')]);};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x18e')]=function(_0x2ca66d){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0x18f'),_0x2ca66d[_0xbc1d('0x30')]));return this['channel'][_0xbc1d('0x190')](_0x2ca66d[_0xbc1d('0x55')],_0x2ca66d['escape_digits']);};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x191')]=function(_0x1dea31){logger[_0xbc1d('0x28')](util['format'](_0xbc1d('0x192'),_0x1dea31[_0xbc1d('0x30')]));if(!this[_0xbc1d('0x80')](_0x1dea31[_0xbc1d('0x193')])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0xbc1d('0x194'));}var _0x159376=this['getMailAccount'][_0xbc1d('0x6d')](this,_0x1dea31[_0xbc1d('0x193')]);if(!_0x159376||!_0x159376[_0xbc1d('0x195')]){return this[_0xbc1d('0x2f')]['error'](_0x1dea31,_0xbc1d('0x196'));}var _0x4c32be={'from':util[_0xbc1d('0x23')](_0xbc1d('0x197'),_0x159376['name'],_0x159376['email']||_0x159376[_0xbc1d('0x195')][_0xbc1d('0x198')]),'to':_0x1dea31['to']||'','cc':_0x1dea31['cc']||'','bcc':_0x1dea31['bcc']||'','subject':_0x1dea31['subject'],'html':_0x1dea31[_0xbc1d('0x55')],'text':_0x1dea31[_0xbc1d('0x55')]};var _0x2c87c6={'tls':{'rejectUnauthorized':![]}};if(_0x159376[_0xbc1d('0x195')]['service']){_0x2c87c6[_0xbc1d('0x199')]=_0x159376['Smtp'][_0xbc1d('0x199')];}else{_0x2c87c6[_0xbc1d('0x19a')]=_0x159376['Smtp']['host'];_0x2c87c6[_0xbc1d('0x19b')]=_0x159376['Smtp'][_0xbc1d('0x19b')];_0x2c87c6[_0xbc1d('0x19c')]=_0x159376[_0xbc1d('0x195')][_0xbc1d('0x19c')];}if(_0x159376[_0xbc1d('0x195')][_0xbc1d('0x19d')]){_0x2c87c6[_0xbc1d('0x19e')]={'user':_0x159376['Smtp'][_0xbc1d('0x198')],'pass':_0x159376[_0xbc1d('0x195')][_0xbc1d('0x19f')]};}if(this[_0xbc1d('0x80')](_0x1dea31['template_id'])){}logger[_0xbc1d('0xde')](_0xbc1d('0x1a0'),JSON[_0xbc1d('0x70')](_0x4c32be));this['createSquareDetailsReport'][_0xbc1d('0x6d')](this,_0x1dea31,_0x1dea31['account_id']);this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util[_0xbc1d('0x23')](_0xbc1d('0x1a1'),_0x159376[_0xbc1d('0x10')]));this[_0xbc1d('0x1d')][_0xbc1d('0x6d')](this,_0x2c87c6,_0x4c32be);return this[_0xbc1d('0x2f')]['noop'](_0xbc1d('0x1a2'));};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x1a3')]=function(_0x5ef4b8){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0x1a4'),_0x5ef4b8[_0xbc1d('0x30')]));return this[_0xbc1d('0x2f')]['noop'](_0xbc1d('0x1a5'));};AGIVertices[_0xbc1d('0x12')]['sendSMS']=function(_0x339234){logger['info'](util[_0xbc1d('0x23')](_0xbc1d('0x1a6'),_0x339234[_0xbc1d('0x30')]));if(!this['isConfigured'](_0x339234[_0xbc1d('0x1a7')])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0xbc1d('0x1a8'));}var _0x668176=this[_0xbc1d('0x1a9')][_0xbc1d('0x6d')](this,_0x339234[_0xbc1d('0x1a7')]);if(!_0x668176){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0x339234,_0xbc1d('0x1aa'));}var _0x1dcb3b={'body':_0x339234[_0xbc1d('0x1ab')],'phone':_0x339234['to']||'','SmsAccountId':_0x668176['id']};logger[_0xbc1d('0xde')](_0xbc1d('0x1ac'),JSON['stringify'](_0x1dcb3b));this[_0xbc1d('0xd6')][_0xbc1d('0x6d')](this,_0x339234,_0x339234['sms_account_id']);this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util[_0xbc1d('0x23')](_0xbc1d('0x1ad'),_0x668176[_0xbc1d('0x10')]));this[_0xbc1d('0x2e')][_0xbc1d('0x6d')](this,_0x1dcb3b);return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0xbc1d('0x1ae'));};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x1af')]=function(_0x4e371c){logger[_0xbc1d('0x28')](util['format'](_0xbc1d('0x1b0'),_0x4e371c[_0xbc1d('0x30')]));if(!this[_0xbc1d('0x80')](_0x4e371c[_0xbc1d('0xd7')])){return this[_0xbc1d('0x2f')]['error'](_0x4e371c,_0xbc1d('0x1b1'));}var _0xbbad8b=this[_0xbc1d('0xe')][_0xbc1d('0x6d')](this,_0x4e371c[_0xbc1d('0xd7')]);if(!_0xbbad8b){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0x4e371c,_0xbc1d('0xd9'));}return this[_0xbc1d('0x2f')]['setVariable'](_0xbbad8b,_0x4e371c[_0xbc1d('0x1b2')]);};AGIVertices[_0xbc1d('0x12')]['start']=function(_0xd542d3){logger['info'](util[_0xbc1d('0x23')]('Enter\x20in\x20START\x20(%s)\x20block',_0xd542d3[_0xbc1d('0x30')]));this['channel'][_0xbc1d('0xa4')](_0xbc1d('0x1b3'));if(_0xd542d3[_0xbc1d('0xb4')]===_0xbc1d('0x1b4')){this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](_0xbc1d('0x1b5'));return this[_0xbc1d('0x2f')][_0xbc1d('0xb4')]();}return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')]('Skipped\x20Answer');};AGIVertices['prototype'][_0xbc1d('0x1b6')]=function(_0x4f9628){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0x1b7'),_0x4f9628[_0xbc1d('0x30')]));if(!this[_0xbc1d('0x80')](_0x4f9628[_0xbc1d('0x1b8')])){return this['channel'][_0xbc1d('0x26')](_0x4f9628,_0xbc1d('0x1b9'));}var _0x30d7e0=this[_0xbc1d('0x14')][_0xbc1d('0x6d')](this,_0x4f9628[_0xbc1d('0x1b8')]);if(!this[_0xbc1d('0x80')](_0x30d7e0)){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0x4f9628,util['format'](_0xbc1d('0x1ba'),_0x4f9628[_0xbc1d('0x1b8')]));}if(_0x30d7e0===this['channel'][_0xbc1d('0x32')]){return this['channel'][_0xbc1d('0x26')](_0x4f9628,_0xbc1d('0x1bb'));}this[_0xbc1d('0xd6')]['sync'](this,_0x4f9628,_0x30d7e0);var _0x49d2d8=this[_0xbc1d('0x2f')]['exec']('AGI',util[_0xbc1d('0x23')](_0xbc1d('0x1bc'),config[_0xbc1d('0x8')]['host']||_0xbc1d('0x1bd'),_0x30d7e0,this[_0xbc1d('0x2f')][_0xbc1d('0x32')]));if(_0x49d2d8[_0xbc1d('0x9e')]===-0x1){return _0x49d2d8;}return this['channel'][_0xbc1d('0xa4')](util[_0xbc1d('0x23')]('Executed\x20command\x20%s\x20%s',_0xbc1d('0x1be'),_0x30d7e0));};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x1bf')]=function(_0x44f69){logger['info'](util[_0xbc1d('0x23')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x44f69['label']));var _0x78b6b0=this['shellCommand'][_0xbc1d('0x6d')](this,_0x44f69[_0xbc1d('0xb2')]);this['createSquareDetailsReport'][_0xbc1d('0x6d')](this,_0x44f69,_0x44f69[_0xbc1d('0xb2')]);if(this['isConfigured'](_0x44f69['variable_id'])){var _0x56777a=this[_0xbc1d('0xe')][_0xbc1d('0x6d')](this,_0x44f69[_0xbc1d('0xd7')]);if(_0x56777a){this[_0xbc1d('0x2f')][_0xbc1d('0x9f')](_0x56777a,_0x78b6b0);return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util[_0xbc1d('0x23')](_0xbc1d('0x1c0'),_0x44f69[_0xbc1d('0xb2')],_0x56777a));}}return this[_0xbc1d('0x2f')]['noop'](util[_0xbc1d('0x23')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x44f69['command']));};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x1c1')]=function(_0x36574b){logger['info'](util[_0xbc1d('0x23')](_0xbc1d('0x1c2'),_0x36574b[_0xbc1d('0x30')]));_0x36574b['text']=_0x36574b[_0xbc1d('0x55')][_0xbc1d('0xd3')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xbc1d('0x80')](_0x36574b[_0xbc1d('0x1c3')])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')]('no\x20apiKey\x20configured');}if(!this[_0xbc1d('0x80')](_0x36574b[_0xbc1d('0x55')])){return this['channel'][_0xbc1d('0xa4')](_0xbc1d('0xa2'));}this['channel']['noop'](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x36574b['text']));var _0x434060=this[_0xbc1d('0x54')][_0xbc1d('0x6d')](this,_0x36574b);if(_0x434060){this['channel']['noop'](util[_0xbc1d('0x23')](_0xbc1d('0x1c4'),_0x434060));var _0x5169ad=this[_0xbc1d('0x2f')][_0xbc1d('0x104')](_0x434060);try{fs[_0xbc1d('0x105')](_0x434060+_0xbc1d('0x106'));}catch(_0x56ebf8){logger[_0xbc1d('0x26')](_0x56ebf8);}return _0x5169ad;}return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0x36574b,_0xbc1d('0x1c5'));};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x1c6')]=function(_0x4e1e52){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x4e1e52[_0xbc1d('0x30')]));_0x4e1e52['text']=_0x4e1e52['text'][_0xbc1d('0xd3')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xbc1d('0x80')](_0x4e1e52[_0xbc1d('0x55')])){return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')]('no\x20text\x20configured');}this['channel']['noop'](util[_0xbc1d('0x23')](_0xbc1d('0x1c7'),_0x4e1e52['text']));var _0x5ed7ad=this[_0xbc1d('0x5c')][_0xbc1d('0x6d')](this,_0x4e1e52);if(_0x5ed7ad){this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util[_0xbc1d('0x23')](_0xbc1d('0x1c8'),_0x5ed7ad));var _0x5e7308=this[_0xbc1d('0x2f')][_0xbc1d('0x104')](_0x5ed7ad);try{fs[_0xbc1d('0x105')](_0x5ed7ad+_0xbc1d('0x106'));}catch(_0x3a6611){logger[_0xbc1d('0x26')](_0x3a6611);}return _0x5e7308;}return this['channel'][_0xbc1d('0x26')](_0x4e1e52,_0xbc1d('0x1c9'));};AGIVertices[_0xbc1d('0x12')][_0xbc1d('0x1ca')]=function(_0x200bed){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0x1cb'),_0x200bed[_0xbc1d('0x30')]));if(!this[_0xbc1d('0x80')](_0x200bed[_0xbc1d('0x156')])){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0x200bed,_0xbc1d('0x157'));}logger['info'](util[_0xbc1d('0x23')](_0xbc1d('0x158'),this[_0xbc1d('0x2f')][_0xbc1d('0x33')],_0x200bed[_0xbc1d('0x156')]));var _0x122a1e=this[_0xbc1d('0x4d')][_0xbc1d('0x6d')](this,_0x200bed[_0xbc1d('0x156')]);if(_0x122a1e){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0x159'),this[_0xbc1d('0x2f')][_0xbc1d('0x33')],_0x200bed[_0xbc1d('0x156')]));this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util[_0xbc1d('0x23')](_0xbc1d('0x159'),this[_0xbc1d('0x2f')][_0xbc1d('0x33')],_0x200bed[_0xbc1d('0x156')]));return{'code':0xc8,'result':_0xbc1d('0x15a')};}else{logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0x15b'),this['channel'][_0xbc1d('0x33')],_0x200bed[_0xbc1d('0x156')]));this[_0xbc1d('0x2f')]['noop'](util['format'](_0xbc1d('0x15b'),this[_0xbc1d('0x2f')][_0xbc1d('0x33')],_0x200bed[_0xbc1d('0x156')]));return{'code':0xc8,'result':_0xbc1d('0x15c')};}};AGIVertices[_0xbc1d('0x12')]['voicemail']=function(_0x3a4c25){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')](_0xbc1d('0x1cc'),_0x3a4c25[_0xbc1d('0x30')]));var _0x187913=this['channel'][_0xbc1d('0xa9')]('VOICEMAIL',[_0x3a4c25[_0xbc1d('0x1cd')],_0x3a4c25[_0xbc1d('0x73')]]);if(_0x187913[_0xbc1d('0x9e')]===-0x1){return _0x187913;}return this[_0xbc1d('0x2f')][_0xbc1d('0xa4')](util[_0xbc1d('0x23')](_0xbc1d('0xc0'),_0xbc1d('0x1ce'),_0x3a4c25['mailbox']));};AGIVertices[_0xbc1d('0x12')]['vswitch']=function(_0x5f0132){logger[_0xbc1d('0x28')](util[_0xbc1d('0x23')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x5f0132[_0xbc1d('0x30')]));if(!this[_0xbc1d('0x80')](_0x5f0132[_0xbc1d('0xd7')])){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0x5f0132,_0xbc1d('0x1b1'));}var _0x882830=this['getVariable'][_0xbc1d('0x6d')](this,_0x5f0132[_0xbc1d('0xd7')]);if(!_0x882830){return this[_0xbc1d('0x2f')][_0xbc1d('0x26')](_0x5f0132,_0xbc1d('0xd9'));}var _0x114bc8=this[_0xbc1d('0x2f')][_0xbc1d('0xe')](_0x882830);return{'code':0xc8,'result':_0x114bc8['extra']?_0x114bc8['extra']:'-'};};String['prototype'][_0xbc1d('0x1cf')]=function(_0x207ef1,_0x5c4575){return this[_0xbc1d('0x9a')](_0x207ef1)['join'](_0x5c4575);};module[_0xbc1d('0x1d0')]=AGIVertices; \ No newline at end of file +var _0xc1dc=['Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','streamFile','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','digit','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','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','port','secure','authentication','auth','user','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','system','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','path','util','lodash','odbc','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','open','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','error','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','includes','POST','PUT','toUpperCase','body','parse','rawBody','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','isString','saveRestApiResult','isPlainObject','%s.%s','setVariable','split','length','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','getAndSetVariable','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','unlink','aws\x20Polly\x20is\x20unreachable','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr'];(function(_0x4caade,_0x549ce1){var _0x2041ff=function(_0x402f3a){while(--_0x402f3a){_0x4caade['push'](_0x4caade['shift']());}};_0x2041ff(++_0x549ce1);}(_0xc1dc,0x84));var _0xcc1d=function(_0x1af26d,_0x535f9f){_0x1af26d=_0x1af26d-0x0;var _0x3a03be=_0xc1dc[_0x1af26d];return _0x3a03be;};'use strict';var fs=require('fs');var path=require(_0xcc1d('0x0'));var util=require(_0xcc1d('0x1'));var _=require(_0xcc1d('0x2'));var sh=require('shelljs');var odbc=require(_0xcc1d('0x3'))();var rs=require('randomstring');var moment=require(_0xcc1d('0x4'));var Mustache=require(_0xcc1d('0x5'));var rp=require('request-promise');var logger=require(_0xcc1d('0x6'))(_0xcc1d('0x7'));var config=require(_0xcc1d('0x8'));var scripts=require(_0xcc1d('0x9'));var FILES_PATH=_0xcc1d('0xa');var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=[_0xcc1d('0xb'),_0xcc1d('0xc'),_0xcc1d('0xd')];var AGIVertices=function(_0x3154cf,_0x16afac,_0x171592){this['channel']=_0x3154cf;this[_0xcc1d('0xe')]=_0x16afac;this[_0xcc1d('0xf')]=_0x171592;};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x11')]=function(_0x2eea62,_0x39a466){this['rpc'][_0xcc1d('0x12')](_0x2eea62)[_0xcc1d('0x13')](function(_0x49b75d){_0x39a466(null,_0x49b75d?_0x49b75d[_0xcc1d('0x14')]:![]);})[_0xcc1d('0x15')](function(_0x1440f6){_0x39a466(_0x1440f6);});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x16')]=function(_0x3b251e,_0x18b64a){this['rpc']['getVoiceQueueById'](_0x3b251e)[_0xcc1d('0x13')](function(_0x562648){_0x18b64a(null,_0x562648?_0x562648[_0xcc1d('0x14')]:![]);})[_0xcc1d('0x15')](function(_0x35f147){_0x18b64a(_0x35f147);});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x17')]=function(_0x2bf07a,_0x1f9737){this[_0xcc1d('0xe')][_0xcc1d('0x18')](_0x2bf07a)[_0xcc1d('0x13')](function(_0x483963){_0x1f9737(null,_0x483963?_0x483963['name']:![]);})[_0xcc1d('0x15')](function(_0x536641){_0x1f9737(_0x536641);});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x19')]=function(_0xf44327,_0x104c54){this[_0xcc1d('0xe')][_0xcc1d('0x1a')](_0xf44327)[_0xcc1d('0x13')](function(_0x1b88f4){_0x104c54(null,_0x1b88f4?_0x1b88f4[_0xcc1d('0x1b')]:![]);})['catch'](function(_0x23189c){_0x104c54(_0x23189c);});};AGIVertices['prototype'][_0xcc1d('0x1c')]=function(_0x1bcf7b,_0x167b9f){this['rpc'][_0xcc1d('0x1d')](_0x1bcf7b)[_0xcc1d('0x13')](function(_0x31a006){_0x167b9f(null,_0x31a006?_0x31a006[_0xcc1d('0x14')]:![]);})[_0xcc1d('0x15')](function(_0x5e2f74){_0x167b9f(_0x5e2f74);});};AGIVertices[_0xcc1d('0x10')]['getTrunk']=function(_0x220eae,_0x114b63){this[_0xcc1d('0xe')][_0xcc1d('0x1e')](_0x220eae)[_0xcc1d('0x13')](function(_0x4f6ec8){_0x114b63(null,_0x4f6ec8?_0x4f6ec8[_0xcc1d('0x14')]:![]);})[_0xcc1d('0x15')](function(_0xec0667){_0x114b63(_0xec0667);});};AGIVertices['prototype'][_0xcc1d('0x1f')]=function(_0x491edb,_0x2d2b0c){var _0x5c521e=this;this[_0xcc1d('0xe')][_0xcc1d('0x20')](_0x491edb)[_0xcc1d('0x13')](function(_0x50b769){_0x2d2b0c(null,_0x50b769?_0x5c521e[_0xcc1d('0x21')](_0x50b769[_0xcc1d('0x22')]):![]);})[_0xcc1d('0x15')](function(_0x4a406f){_0x2d2b0c(_0x4a406f);});};AGIVertices[_0xcc1d('0x10')]['getMailAccount']=function(_0x18cbc0,_0x2a68ef){this[_0xcc1d('0xe')][_0xcc1d('0x23')](_0x18cbc0)[_0xcc1d('0x13')](function(_0x5d9163){_0x2a68ef(null,_0x5d9163?_0x5d9163:![]);})[_0xcc1d('0x15')](function(_0x12aab7){_0x2a68ef(_0x12aab7);});};AGIVertices['prototype'][_0xcc1d('0x24')]=function(_0x5dfe28,_0x1f7dc7,_0x5ac7e9){this['mailRpc'][_0xcc1d('0x24')](_0x5dfe28,_0x1f7dc7)['then'](function(){_0x5ac7e9(null);})[_0xcc1d('0x15')](function(_0x3892a3){_0x5ac7e9(_0x3892a3);});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x25')]=function(_0x16ba8b,_0x237a34){this['rpc'][_0xcc1d('0x26')](_0x16ba8b)['then'](function(_0x25ad8e){if(_0x25ad8e){if(_0x25ad8e[_0xcc1d('0x27')]){_0x237a34(null,[_0x25ad8e[_0xcc1d('0x28')]]);}else{_0x237a34(null,_[_0xcc1d('0x29')](_0x25ad8e['Intervals'],_0xcc1d('0x28')));}}else{_0x237a34(null,![]);}})[_0xcc1d('0x15')](function(_0x1252fd){_0x237a34(_0x1252fd);});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x21')]=function(_0x26910c){return util[_0xcc1d('0x2a')](_0xcc1d('0x2b'),FILES_PATH,_0x26910c);};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x2c')]=function(_0x57fb8b,_0x5c3596,_0x45aaf6){odbc[_0xcc1d('0x2d')](_0x57fb8b,function(_0x49c5ac){if(_0x49c5ac){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x49c5ac);_0x45aaf6(_0x49c5ac);}else{logger[_0xcc1d('0x2e')](_0xcc1d('0x2f'));odbc[_0xcc1d('0x30')](_0x5c3596,function(_0x38b541,_0x21e60a){if(_0x38b541){logger[_0xcc1d('0x2e')](_0xcc1d('0x31'),_0x5c3596);_0x45aaf6(_0x38b541);}else{logger['info'](_0xcc1d('0x32'),_0x5c3596);odbc['close'](function(_0x51124f){if(_0x51124f){logger['error'](_0xcc1d('0x33'),_0x51124f);}_0x45aaf6(null,_0x21e60a);});}});}});};AGIVertices[_0xcc1d('0x10')]['getSmsAccount']=function(_0x4bb1f2,_0x43c7ae){this['rpc'][_0xcc1d('0x34')](_0x4bb1f2)[_0xcc1d('0x13')](function(_0x41f650){_0x43c7ae(null,_0x41f650?_0x41f650:![]);})['catch'](function(_0xe587a6){_0x43c7ae(_0xe587a6);});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x35')]=function(_0x1ea6b6,_0x3e568c){this[_0xcc1d('0xe')][_0xcc1d('0x35')](_0x1ea6b6)['then'](function(_0x11e467){_0x3e568c(null,_0x11e467);})['catch'](function(_0x809c64){_0x3e568c(_0x809c64);});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x36')]=function(_0x252361,_0x21e26c,_0x3f5561){this[_0xcc1d('0xe')][_0xcc1d('0x36')]({'uniqueid':this[_0xcc1d('0x37')][_0xcc1d('0x38')],'node':_0x252361[_0xcc1d('0x39')],'application':_0x252361[_0xcc1d('0x3a')],'data':_0x21e26c||null,'project_name':this['channel'][_0xcc1d('0x3b')],'callerid':this[_0xcc1d('0x37')][_0xcc1d('0x3c')]})[_0xcc1d('0x13')](function(_0xc80077){if(_0x3f5561){_0x3f5561(null,_0xc80077);}})[_0xcc1d('0x15')](function(_0x2f2312){if(_0x3f5561){_0x3f5561(_0x2f2312);}});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x3d')]=function(_0x3dde5e,_0x1413c8,_0x559ed0,_0x2cce97){this[_0xcc1d('0xe')][_0xcc1d('0x3d')]({'uniqueid':this[_0xcc1d('0x37')][_0xcc1d('0x38')],'callerid':this[_0xcc1d('0x37')][_0xcc1d('0x3c')],'calleridname':this[_0xcc1d('0x37')][_0xcc1d('0x3e')],'context':this[_0xcc1d('0x37')][_0xcc1d('0x3f')],'extension':this[_0xcc1d('0x37')][_0xcc1d('0x40')],'priority':this[_0xcc1d('0x37')][_0xcc1d('0x41')],'accountcode':this[_0xcc1d('0x37')][_0xcc1d('0x42')],'dnid':this[_0xcc1d('0x37')][_0xcc1d('0x43')],'projectName':this[_0xcc1d('0x37')]['arg_1'],'saveName':_0x1413c8,'filename':_0x3dde5e[_0xcc1d('0x44')]||_0x1413c8,'savePath':_0x559ed0})['then'](function(_0x467fa7){_0x2cce97(null,_0x467fa7);})[_0xcc1d('0x15')](function(_0x5671c2){_0x2cce97(_0x5671c2);});};AGIVertices['prototype'][_0xcc1d('0x45')]=function(_0x1af8d1,_0x264256,_0x12cd53,_0x78b49e,_0x2a5ee2){this['rpc'][_0xcc1d('0x45')]({'uniqueid':this[_0xcc1d('0x37')]['uniqueid'],'body':_0x1af8d1,'direction':_0x264256,'providerName':_0x12cd53,'providerResponse':_0x78b49e})[_0xcc1d('0x13')](function(_0x8fc62a){if(_0x2a5ee2){_0x2a5ee2(null,_0x8fc62a);}})[_0xcc1d('0x15')](function(_0x51ef0f){if(_0x2a5ee2){_0x2a5ee2(_0x51ef0f);}});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x46')]=function(_0x3b232f,_0x50d994){this[_0xcc1d('0xe')][_0xcc1d('0x46')]({'firstName':_[_0xcc1d('0x47')](_0x3b232f[_0xcc1d('0x14')])||_[_0xcc1d('0x48')](_0x3b232f[_0xcc1d('0x14')])?_0xcc1d('0x49')+Math[_0xcc1d('0x4a')]():_0x3b232f['name'],'lastName':_[_0xcc1d('0x47')](_0x3b232f[_0xcc1d('0x4b')])||_['isNil'](_0x3b232f[_0xcc1d('0x4b')])?null:_0x3b232f[_0xcc1d('0x4b')],'phone':_0x3b232f[_0xcc1d('0x4c')],'ListId':_0x3b232f[_0xcc1d('0x4d')],'scheduledat':_0x3b232f[_0xcc1d('0x4e')],'callbackUniqueid':this[_0xcc1d('0x37')][_0xcc1d('0x38')],'tags':_0xcc1d('0x4f'),'description':_0xcc1d('0x50')+_0x3b232f[_0xcc1d('0x4e')][_0xcc1d('0x51')](),'priority':_0x3b232f[_0xcc1d('0x52')]})[_0xcc1d('0x13')](function(_0x46663f){_0x50d994(null,_0x46663f);})[_0xcc1d('0x15')](function(_0x448d5d){_0x50d994(_0x448d5d);});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x53')]=function(_0x47ba98,_0x2ef9ad){this['rpc'][_0xcc1d('0x54')](_0x47ba98)[_0xcc1d('0x13')](function(_0x4f0316){_0x2ef9ad(null,_0x4f0316?_0x4f0316[_0xcc1d('0x14')]:![]);})[_0xcc1d('0x15')](function(_0x3dc10b){_0x2ef9ad(_0x3dc10b);});};AGIVertices['prototype'][_0xcc1d('0x55')]=function(_0x5e3550,_0x23ae2d,_0x584df1){var _0x1e3180={'role':_0xcc1d('0x56')};_0x1e3180[_0x5e3550]=this[_0xcc1d('0x37')][_0xcc1d('0x3c')];this[_0xcc1d('0xe')]['agentPause'](_0x1e3180,_0x23ae2d,this['channel'][_0xcc1d('0x38')])[_0xcc1d('0x13')](function(_0xad73ba){_0x584df1(null,_[_0xcc1d('0x48')](_0xad73ba)?![]:!![]);})[_0xcc1d('0x15')](function(_0x346c79){logger['error'](_0x346c79);_0x584df1(null,![]);});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x57')]=function(_0x1bd52a,_0x213995){var _0x3471f4={'role':_0xcc1d('0x56')};_0x3471f4[_0x1bd52a]=this[_0xcc1d('0x37')]['callerid'];this['rpc'][_0xcc1d('0x57')](_0x3471f4)[_0xcc1d('0x13')](function(_0xb77d78){_0x213995(null,_[_0xcc1d('0x48')](_0xb77d78)?![]:!![]);})[_0xcc1d('0x15')](function(_0x4fbd07){logger['error'](_0x4fbd07);_0x213995(null,![]);});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x58')]=function(_0x122128,_0x3e077b){var _0x1b1394={'role':_0xcc1d('0x56')};_0x1b1394[_0x122128]=this['channel'][_0xcc1d('0x3c')];this['rpc'][_0xcc1d('0x58')](_0x1b1394)[_0xcc1d('0x13')](function(_0x707145){_0x3e077b(null,_[_0xcc1d('0x48')](_0x707145)?![]:!![]);})[_0xcc1d('0x15')](function(_0x9a7a93){logger[_0xcc1d('0x59')](_0x9a7a93);_0x3e077b(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x5d09b0,_0x38c619){var _0x33a5fc={'role':_0xcc1d('0x56')};_0x33a5fc[_0x5d09b0]=this['channel'][_0xcc1d('0x3c')];var _0x175b5b=_0x5d09b0!=_0xcc1d('0x5a')?util['format'](_0xcc1d('0x5b'),_0xcc1d('0x5c'),this[_0xcc1d('0x37')][_0xcc1d('0x3c')]):undefined;this[_0xcc1d('0xe')]['agentLogin'](_0x33a5fc,_0x175b5b)[_0xcc1d('0x13')](function(_0x1ebb44){_0x38c619(null,_[_0xcc1d('0x48')](_0x1ebb44)?![]:!![]);})[_0xcc1d('0x15')](function(_0x35fc3a){logger[_0xcc1d('0x59')](_0x35fc3a);_0x38c619(null,![]);});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x5d')]=function(_0x139768,_0x1c7616){sh[_0xcc1d('0x5e')](_['trim'](_0x139768),function(_0x7da1b2,_0x38adb0){var _0x5a0f26=_0x38adb0[_0xcc1d('0x5f')](/(\r\n|\n|\r)/gm,'');_0x1c7616(null,_0x5a0f26);});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x60')]=function(_0x1aad75,_0x43846c){scripts['googleCloudTTS'](_0x1aad75[_0xcc1d('0x61')],_0x1aad75[_0xcc1d('0x62')]||_0xcc1d('0x63'),_0x1aad75[_0xcc1d('0x63')],_0x1aad75['languageCode']||_0xcc1d('0x64'),_0x1aad75[_0xcc1d('0x65')]||_0xcc1d('0x66'),_0x1aad75[_0xcc1d('0x67')]||_0xcc1d('0x68'))[_0xcc1d('0x13')](function(_0x4632ef){_0x43846c(null,_0x4632ef);})['catch'](function(_0x409b36){_0x43846c(_0x409b36);});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x69')]=function(_0x1d7d9c,_0x4388c3){scripts[_0xcc1d('0x69')](_0x1d7d9c['text'],_0x1d7d9c[_0xcc1d('0x6a')]||'en',0x1)[_0xcc1d('0x13')](function(_0x22647c){_0x4388c3(null,_0x22647c);})[_0xcc1d('0x15')](function(_0x178c45){_0x4388c3(_0x178c45);});};AGIVertices['prototype'][_0xcc1d('0x6b')]=function(_0x278d8f,_0x3cbcba){var _0x4e901e={'uri':_0x278d8f[_0xcc1d('0x6c')],'method':_0x278d8f[_0xcc1d('0x6d')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x278d8f['timeout'])===_0xcc1d('0x6e')&&parseInt(_0x278d8f[_0xcc1d('0x6f')])>=0x1?parseInt(_0x278d8f['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xcc1d('0x70')]([_0xcc1d('0x71'),_0xcc1d('0x72')],_0x4e901e[_0xcc1d('0x6d')][_0xcc1d('0x73')]())){try{_0x4e901e[_0xcc1d('0x74')]=_0x278d8f['rawBody']?JSON[_0xcc1d('0x75')](_0x278d8f[_0xcc1d('0x76')]):{};}catch(_0x3353cb){logger['error']('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3353cb);}}try{_0x4e901e[_0xcc1d('0x77')]=_0x278d8f[_0xcc1d('0x78')]?JSON[_0xcc1d('0x75')](_0x278d8f[_0xcc1d('0x78')]):{};}catch(_0x5ff77){logger['error'](_0xcc1d('0x79'),_0x5ff77);}if(_0x278d8f[_0xcc1d('0x7a')]){try{var _0x1d937e=require(_0x278d8f[_0xcc1d('0x7a')])[_0xcc1d('0x7b')](this,_0x4e901e);_0x4e901e[_0xcc1d('0x7c')]=Mustache[_0xcc1d('0x7d')](_0x278d8f[_0xcc1d('0x6c')],_0x1d937e,{},['$$','$$']);if(_0x4e901e[_0xcc1d('0x77')]){_0x4e901e[_0xcc1d('0x77')]=JSON[_0xcc1d('0x75')](Mustache[_0xcc1d('0x7d')](JSON[_0xcc1d('0x7e')](_0x4e901e[_0xcc1d('0x77')]),_0x1d937e,{},['$$','$$']));}if(_0x4e901e[_0xcc1d('0x74')]){_0x4e901e[_0xcc1d('0x74')]=JSON['parse'](Mustache[_0xcc1d('0x7d')](JSON[_0xcc1d('0x7e')](_0x4e901e[_0xcc1d('0x74')]),_0x1d937e,{},['$$','$$']));}}catch(_0x426858){logger[_0xcc1d('0x59')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x426858);}}rp(_0x4e901e)['then'](function(_0x5be0c4){var _0x350e6b={'statusCode':_0x5be0c4[_0xcc1d('0x7f')]||0xc8,'statusMessage':_0x5be0c4[_0xcc1d('0x80')]||'OK','headers':_0x5be0c4[_0xcc1d('0x77')]||{},'body':_0x5be0c4[_0xcc1d('0x74')]||{}};_0x3cbcba(null,_0x350e6b);})[_0xcc1d('0x15')](function(_0x2ee4e4){var _0x1a2dfe={'statusCode':_0x2ee4e4['statusCode']||0x1f4,'statusMessage':_0x2ee4e4[_0xcc1d('0x81')]||_0xcc1d('0x82'),'headers':_0x2ee4e4[_0xcc1d('0x83')][_0xcc1d('0x77')]||{},'body':_0x2ee4e4[_0xcc1d('0x83')][_0xcc1d('0x74')]||{}};_0x3cbcba(null,_0x1a2dfe);});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x84')]=function(_0x56caec,_0x4200db){scripts[_0xcc1d('0x84')](this[_0xcc1d('0x37')][_0xcc1d('0x38')],_0x56caec[_0xcc1d('0x85')],_0x56caec['text'],_0x56caec['dialogflow_language']||'en')[_0xcc1d('0x13')](function(_0x4a989f){_0x4200db(null,_0x4a989f);})[_0xcc1d('0x15')](function(_0x357eec){_0x4200db(_0x357eec);});};AGIVertices['prototype'][_0xcc1d('0x86')]=function(_0x1bad3d,_0x51e91c){scripts[_0xcc1d('0x86')](this[_0xcc1d('0x37')][_0xcc1d('0x38')],_0x1bad3d[_0xcc1d('0x87')],_0x1bad3d[_0xcc1d('0x88')],_0x1bad3d[_0xcc1d('0x89')],_0x1bad3d['text'],_0x1bad3d[_0xcc1d('0x8a')]||'en')[_0xcc1d('0x13')](function(_0x46604b){_0x51e91c(null,_0x46604b);})[_0xcc1d('0x15')](function(_0x5d0b25){_0x51e91c(_0x5d0b25);});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x8b')]=function(_0x3a1e38,_0x11bb0b){scripts[_0xcc1d('0x8b')](this[_0xcc1d('0x37')],_0x3a1e38)[_0xcc1d('0x13')](function(_0x410009){_0x11bb0b(null,_0x410009);})['catch'](function(_0x165e95){_0x11bb0b(_0x165e95);});};AGIVertices[_0xcc1d('0x10')]['ispeechTTS']=function(_0x465d77,_0x106e32){scripts[_0xcc1d('0x8c')](_0x465d77['key'],_0x465d77[_0xcc1d('0x63')],_0x465d77['ispeech_tts_language']||_0xcc1d('0x64'),_0x465d77[_0xcc1d('0x8d')])['then'](function(_0x5edc44){_0x106e32(null,_0x5edc44);})[_0xcc1d('0x15')](function(_0x4799ca){_0x106e32(_0x4799ca);});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x8e')]=function(_0x9962d9,_0x6b3de6,_0x3c3ae0){scripts[_0xcc1d('0x8e')](_0x6b3de6,_0x9962d9[_0xcc1d('0x85')],_0x9962d9[_0xcc1d('0x8f')]||_0xcc1d('0x64'),this[_0xcc1d('0x90')](_0x9962d9['model'])?_0x9962d9[_0xcc1d('0x91')]:undefined)[_0xcc1d('0x13')](function(_0x4f6826){_0x3c3ae0(null,_0x4f6826);})[_0xcc1d('0x15')](function(_0x18fe5e){_0x3c3ae0(_0x18fe5e);});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x92')]=function(_0x2d945e,_0x1d4cb3){scripts['awsPolly'](_0x2d945e['aws_access_key_id'],_0x2d945e[_0xcc1d('0x93')],_0x2d945e['aws_polly_region'],_0x2d945e['aws_polly_voice']||'Amy',_0x2d945e[_0xcc1d('0x63')],_0x2d945e[_0xcc1d('0x94')]||_0xcc1d('0x63'))[_0xcc1d('0x13')](function(_0xd779a3){_0x1d4cb3(null,_0xd779a3);})['catch'](function(_0x261db0){_0x1d4cb3(_0x261db0);});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x95')]=function(_0x45b19c,_0x31715d){scripts[_0xcc1d('0x95')](this['channel'][_0xcc1d('0x38')],_0x45b19c[_0xcc1d('0x96')],_0x45b19c['aws_secret_access_key'],_0x45b19c[_0xcc1d('0x97')],_0x45b19c[_0xcc1d('0x63')],_0x45b19c[_0xcc1d('0x98')])[_0xcc1d('0x13')](function(_0x51cd67){_0x31715d(null,_0x51cd67);})[_0xcc1d('0x15')](function(_0xb24a3b){_0x31715d(_0xb24a3b);});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x99')]=function(_0xddc7c7,_0x2167de,_0x4e1420){scripts[_0xcc1d('0x99')](_0x2167de,_0xddc7c7[_0xcc1d('0x85')],_0xddc7c7['google_asr_language']||_0xcc1d('0x64'))[_0xcc1d('0x13')](function(_0x11f9fb){_0x4e1420(null,_0x11f9fb);})[_0xcc1d('0x15')](function(_0x1f123f){_0x4e1420(_0x1f123f);});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x9a')]=function(_0x121939,_0x44ac74,_0x31d929){scripts[_0xcc1d('0x9a')](_0x44ac74,_0x121939[_0xcc1d('0x9b')],_0x121939['appsecret'],_0x121939['uri'])['then'](function(_0x47a685){_0x31d929(null,_0x47a685);})[_0xcc1d('0x15')](function(_0x14d154){_0x31d929(_0x14d154);});};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x9c')]=function(_0x4bf73){var _0x8e3ea0=_[_0xcc1d('0x70')](verticesWithRetry,_0x4bf73['agicommand'])?_0x4bf73:_[_0xcc1d('0x9d')](_0x4bf73);for(var _0x4d6fa7 in _0x8e3ea0){if(_0x8e3ea0[_0xcc1d('0x9e')](_0x4d6fa7)){if(_0x8e3ea0[_0x4d6fa7]&&_['isString'](_0x8e3ea0[_0x4d6fa7])){if(_['includes'](recursiveMapAttributes,_0x4d6fa7)){_0x8e3ea0[_0x4d6fa7]=this[_0xcc1d('0x9f')](_0x8e3ea0[_0x4d6fa7]);}else{_0x8e3ea0[_0x4d6fa7]=this[_0xcc1d('0xa0')](_0x8e3ea0[_0x4d6fa7]);}}}}return _0x8e3ea0;};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0xa1')]=function(_0x5dc43f){for(var _0x3a9c4e in _0x5dc43f){if(_0x5dc43f[_0xcc1d('0x9e')](_0x3a9c4e)){if(_['isPlainObject'](_0x5dc43f[_0x3a9c4e])){this[_0xcc1d('0xa1')](_0x5dc43f[_0x3a9c4e]);}else if(_[_0xcc1d('0xa2')](_0x5dc43f[_0x3a9c4e])){for(var _0x8dfcdf=0x0;_0x8dfcdf<_0x5dc43f[_0x3a9c4e]['length'];_0x8dfcdf++){this[_0xcc1d('0xa1')](_0x5dc43f[_0x3a9c4e][_0x8dfcdf]);}}else if(_[_0xcc1d('0xa3')](_0x5dc43f[_0x3a9c4e])){_0x5dc43f[_0x3a9c4e]=this[_0xcc1d('0xa0')](_0x5dc43f[_0x3a9c4e]);}}}};AGIVertices['prototype'][_0xcc1d('0xa4')]=function(_0xe432f0,_0x6e01fe){for(var _0x59aa28 in _0xe432f0){if(_0xe432f0[_0xcc1d('0x9e')](_0x59aa28)){if(_[_0xcc1d('0xa5')](_0xe432f0[_0x59aa28])){if(!_['isEmpty'](_0xe432f0[_0x59aa28])){this[_0xcc1d('0xa4')](_0xe432f0[_0x59aa28],util[_0xcc1d('0x2a')](_0xcc1d('0xa6'),_0x6e01fe,_0x59aa28));}}else if(_[_0xcc1d('0xa2')](_0xe432f0[_0x59aa28])){for(var _0x4f3acd=0x0;_0x4f3acd<_0xe432f0[_0x59aa28]['length'];_0x4f3acd++){this[_0xcc1d('0xa4')](_0xe432f0[_0x59aa28][_0x4f3acd],util[_0xcc1d('0x2a')]('%s.%s',_0x6e01fe,_0x59aa28+'['+_0x4f3acd+']'));}}else{if(!_[_0xcc1d('0x48')](_0xe432f0[_0x59aa28])){this[_0xcc1d('0x37')][_0xcc1d('0xa7')](util[_0xcc1d('0x2a')](_0xcc1d('0xa6'),_0x6e01fe,_0x59aa28),_0xe432f0[_0x59aa28]);}}}}};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x9f')]=function(_0x36e7e1){try{var _0x1d49ef=JSON['parse'](_0x36e7e1);this[_0xcc1d('0xa1')](_0x1d49ef);return JSON[_0xcc1d('0x7e')](_0x1d49ef);}catch(_0xe2d503){return this[_0xcc1d('0xa0')](_0x36e7e1);}};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0xa0')]=function(_0x21dc0b){var _0xda3bb9=_0x21dc0b[_0xcc1d('0xa8')]('{');for(var _0x5026bb=0x1;_0x5026bb<_0xda3bb9[_0xcc1d('0xa9')];_0x5026bb+=0x1){var _0x461765=_0xda3bb9[_0x5026bb]['split']('}');if(_0x461765[_0xcc1d('0xa9')]>0x1){_0x21dc0b=_0x21dc0b[_0xcc1d('0xaa')]('{'+_0x461765[0x0]+'}',this[_0xcc1d('0x37')]['getVariable'](_0x461765[0x0])[_0xcc1d('0xab')]||_0x461765[0x0]);}}if(_0xda3bb9[_0xcc1d('0xa9')]===0x1){return _0x21dc0b[_0xcc1d('0x51')]();}return this['replaceAllVariables'](_0x21dc0b);};AGIVertices[_0xcc1d('0x10')]['getAndSetVariable']=function(_0x25b919,_0x2f73c0){var _0x250afc=this['channel'][_0xcc1d('0x11')](_0x25b919);if(_0x250afc[_0xcc1d('0xac')]===-0x1){return _0x250afc;}logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0xad'),_0x2f73c0,_0x250afc[_0xcc1d('0xab')]));return this['channel'][_0xcc1d('0xa7')](_0x2f73c0,_0x250afc['extra']);};AGIVertices['prototype'][_0xcc1d('0x90')]=function(_0x107c33){return _0x107c33&&_0x107c33!=='0'&&_0x107c33!=='-1'&&_0x107c33!=='';};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0xae')]=function(_0x6e0b4e){this[_0xcc1d('0x36')][_0xcc1d('0x7b')](this,_0x6e0b4e,'-');_0x6e0b4e[_0xcc1d('0xaf')]=_0x6e0b4e[_0xcc1d('0xae')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xcc1d('0x10')]['mrcpsynth']=function(_0xbb8561){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0xbb8561[_0xcc1d('0x39')]));if(!this[_0xcc1d('0x90')](_0xbb8561['text'])){return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](_0xcc1d('0xb1'));}var _0x2aaff9='\x22'+_0xbb8561[_0xcc1d('0x63')]+'\x22';if(this[_0xcc1d('0x90')](_0xbb8561[_0xcc1d('0x83')])){_0x2aaff9+=','+_0xbb8561[_0xcc1d('0x83')];}var _0x3d4528=this['channel'][_0xcc1d('0x5e')](_0xcc1d('0xb2'),_0x2aaff9);if(_0x3d4528[_0xcc1d('0xac')]===-0x1){return _0x3d4528;}return this['channel'][_0xcc1d('0xb0')](util['format'](_0xcc1d('0xb3'),_0x2aaff9));};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0xb4')]=function(_0x4996b7){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0xb5'),_0x4996b7[_0xcc1d('0x39')]));if(!this[_0xcc1d('0x90')](_0x4996b7['grammar'])){return this['channel'][_0xcc1d('0xb0')](_0xcc1d('0xb6'));}var _0x2cf8f9=_0x4996b7['grammar'];if(this[_0xcc1d('0x90')](_0x4996b7[_0xcc1d('0x83')])){_0x2cf8f9+=','+_0x4996b7[_0xcc1d('0x83')];}var _0x27f744=this[_0xcc1d('0x37')][_0xcc1d('0x5e')]('MRCPRecog',_0x2cf8f9);if(_0x27f744[_0xcc1d('0xac')]===-0x1){return _0x27f744;}var _0x1cb222=this[_0xcc1d('0xb7')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x1cb222['result']===-0x1){return _0x1cb222;}var _0x2a07f5=this['getAndSetVariable'](_0xcc1d('0xb8'),'MRCP_RECOG_TRANSCRIPT');if(_0x2a07f5[_0xcc1d('0xac')]===-0x1){return _0x2a07f5;}var _0x58404a=this['getAndSetVariable'](_0xcc1d('0xb9'),_0xcc1d('0xba'));if(_0x58404a[_0xcc1d('0xac')]===-0x1){return _0x58404a;}return this['channel']['noop'](util['format'](_0xcc1d('0xbb'),_0x2cf8f9));};AGIVertices['prototype']['agi']=function(_0x4d2b46){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x4d2b46[_0xcc1d('0x39')]));return this[_0xcc1d('0x37')][_0xcc1d('0x7')]([_0x4d2b46['command'],_0x4d2b46[_0xcc1d('0xbc')]]);};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0xbd')]=function(_0x368e4a){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0xbe'),_0x368e4a['label']));if(this['isConfigured'](_0x368e4a[_0xcc1d('0x6f')])){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x368e4a[_0xcc1d('0x6f')]));var _0x4a705b=this[_0xcc1d('0x37')][_0xcc1d('0xbf')](_0x368e4a[_0xcc1d('0x6f')]);if(_0x4a705b[_0xcc1d('0xac')]===-0x1){return _0x4a705b;}}return this['channel'][_0xcc1d('0xbd')]();};AGIVertices[_0xcc1d('0x10')]['callback']=function(_0x5ea62f){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0xc0'),_0x5ea62f[_0xcc1d('0x39')]));if(!this['isConfigured'](_0x5ea62f[_0xcc1d('0x4d')])){return this['channel'][_0xcc1d('0x59')](_0x5ea62f,_0xcc1d('0xc1'));}_0x5ea62f[_0xcc1d('0x4e')]=moment();if(this['isConfigured'](_0x5ea62f[_0xcc1d('0xc2')])){_0x5ea62f['scheduledAt']=moment()[_0xcc1d('0xc3')](_0x5ea62f[_0xcc1d('0xc2')],'minutes');}if(!this[_0xcc1d('0x90')](_0x5ea62f['callback_priority'])){_0x5ea62f['callback_priority']=0x2;}this['createCmContact'][_0xcc1d('0x7b')](this,_0x5ea62f);return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0xc4'),_0x5ea62f['phone'],_0x5ea62f[_0xcc1d('0x4d')],_0x5ea62f[_0xcc1d('0x4e')]));};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0xc5')]=function(_0x123594){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0xc6'),_0x123594[_0xcc1d('0x39')]));var _0x357d13=this['channel'][_0xcc1d('0x5e')](_0x123594[_0xcc1d('0xc7')],_0x123594[_0xcc1d('0x83')]);if(_0x357d13['result']===-0x1){return _0x357d13;}return this['channel'][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')]('Executed\x20command\x20%s\x20%s',_0x123594[_0xcc1d('0xc7')],_0x123594[_0xcc1d('0x83')]));};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0xc8')]=function(_0x4328c4){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0xc9'),_0x4328c4['label']));if(!this[_0xcc1d('0x90')](_0x4328c4[_0xcc1d('0x63')])){return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](_0xcc1d('0xb1'));}var _0x3f5d0e='\x22'+_0x4328c4[_0xcc1d('0x63')]+'\x22';if(this[_0xcc1d('0x90')](_0x4328c4[_0xcc1d('0x83')])){_0x3f5d0e+=','+_0x4328c4[_0xcc1d('0x83')];}var _0x113015=this['channel'][_0xcc1d('0x5e')](_0xcc1d('0xb2'),_0x3f5d0e);if(_0x113015[_0xcc1d('0xac')]===-0x1){return _0x113015;}return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0xb3'),_0x3f5d0e));};AGIVertices['prototype']['sestektts']=function(_0x5342dc){logger['info'](util[_0xcc1d('0x2a')](_0xcc1d('0xca'),_0x5342dc['label']));if(!this[_0xcc1d('0x90')](_0x5342dc[_0xcc1d('0x63')])){return this[_0xcc1d('0x37')]['noop'](_0xcc1d('0xb1'));}var _0x5a408d='\x22'+_0x5342dc[_0xcc1d('0x63')]+'\x22';if(this[_0xcc1d('0x90')](_0x5342dc[_0xcc1d('0x83')])){_0x5a408d+=','+_0x5342dc['options'];}var _0x429050=this[_0xcc1d('0x37')][_0xcc1d('0x5e')](_0xcc1d('0xb2'),_0x5a408d);if(_0x429050[_0xcc1d('0xac')]===-0x1){return _0x429050;}return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x5a408d));};AGIVertices[_0xcc1d('0x10')]['lumenvoxasr']=function(_0xb3c0c9){logger['info'](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0xb3c0c9[_0xcc1d('0x39')]));if(!this['isConfigured'](_0xb3c0c9[_0xcc1d('0xcb')])){return this[_0xcc1d('0x37')]['noop'](_0xcc1d('0xb6'));}var _0x315d15=_0xb3c0c9[_0xcc1d('0xcb')];if(this[_0xcc1d('0x90')](_0xb3c0c9[_0xcc1d('0x83')])){_0x315d15+=','+_0xb3c0c9[_0xcc1d('0x83')];}var _0x4760e9=this[_0xcc1d('0x37')][_0xcc1d('0x5e')](_0xcc1d('0xcc'),_0x315d15);if(_0x4760e9[_0xcc1d('0xac')]===-0x1){return _0x4760e9;}var _0x2a1423=this['getAndSetVariable'](_0xcc1d('0xcd'),_0xcc1d('0xce'));if(_0x2a1423[_0xcc1d('0xac')]===-0x1){return _0x2a1423;}var _0x556cda=this[_0xcc1d('0xb7')](_0xcc1d('0xb8'),_0xcc1d('0xcf'));if(_0x556cda[_0xcc1d('0xac')]===-0x1){return _0x556cda;}var _0x463164=this[_0xcc1d('0xb7')](_0xcc1d('0xb9'),_0xcc1d('0xd0'));if(_0x463164[_0xcc1d('0xac')]===-0x1){return _0x463164;}return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0xbb'),_0x315d15));};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0xd1')]=function(_0x4c7cec){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0xd2'),_0x4c7cec[_0xcc1d('0x39')]));if(!this['isConfigured'](_0x4c7cec['grammar'])){return this['channel'][_0xcc1d('0xb0')](_0xcc1d('0xb6'));}var _0x22c28c=_0x4c7cec[_0xcc1d('0xcb')];if(this[_0xcc1d('0x90')](_0x4c7cec[_0xcc1d('0x83')])){_0x22c28c+=','+_0x4c7cec['options'];}var _0x516c31=this[_0xcc1d('0x37')][_0xcc1d('0x5e')]('MRCPRecog',_0x22c28c);if(_0x516c31[_0xcc1d('0xac')]===-0x1){return _0x516c31;}var _0x3017f0=this[_0xcc1d('0xb7')](_0xcc1d('0xcd'),_0xcc1d('0xd3'));if(_0x3017f0[_0xcc1d('0xac')]===-0x1){return _0x3017f0;}var _0x5b8cf6=this[_0xcc1d('0xb7')](_0xcc1d('0xb8'),_0xcc1d('0xd4'));if(_0x5b8cf6['result']===-0x1){return _0x5b8cf6;}var _0x556649=this[_0xcc1d('0xb7')](_0xcc1d('0xb9'),'SESTEK_ASR_INSTANCE');if(_0x556649[_0xcc1d('0xac')]===-0x1){return _0x556649;}return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0xbb'),_0x22c28c));};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0xd5')]=function(_0x2b3756){logger[_0xcc1d('0x2e')](util['format'](_0xcc1d('0xd6'),_0x2b3756[_0xcc1d('0x39')]));if(!this['isConfigured'](_0x2b3756[_0xcc1d('0xd7')])){return this['channel'][_0xcc1d('0x59')](_0x2b3756,_0xcc1d('0xd8'));}var _0x28aa82=this[_0xcc1d('0x19')][_0xcc1d('0x7b')](this,_0x2b3756['odbc_id']);if(!_0x28aa82){return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x2b3756,'no\x20odbc\x20database\x20found');}if(!this[_0xcc1d('0x90')](_0x2b3756[_0xcc1d('0x30')])){return this['channel'][_0xcc1d('0x59')](_0x2b3756,_0xcc1d('0xd9'));}var _0x21e3fe=_0x2b3756[_0xcc1d('0x30')][_0xcc1d('0x5f')](/(\r\n|\n|\r)/gm,'\x20');this[_0xcc1d('0x37')]['noop'](util[_0xcc1d('0x2a')](_0xcc1d('0xda'),_0x21e3fe));var _0x291472=this[_0xcc1d('0x2c')]['sync'](this,_0x28aa82,_0x21e3fe);this[_0xcc1d('0x36')]['sync'](this,_0x2b3756,_0x21e3fe);if(!this[_0xcc1d('0x90')](_0x2b3756[_0xcc1d('0xdb')])){return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](_0xcc1d('0xdc'));}var _0x2aa244=this[_0xcc1d('0x11')][_0xcc1d('0x7b')](this,_0x2b3756[_0xcc1d('0xdb')]);if(!_0x2aa244){return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x2b3756,_0xcc1d('0xdd'));}var _0x5bcbe4=this;_0x291472[_0xcc1d('0xde')](function(_0x12738a,_0x3732f0){Object[_0xcc1d('0xdf')](_0x12738a)[_0xcc1d('0xde')](function(_0x20c6ef){_0x5bcbe4['channel'][_0xcc1d('0xa7')](util['format'](_0xcc1d('0xe0'),_0x2aa244,_0x3732f0,_0x20c6ef),_0x12738a[_0x20c6ef]);});});this[_0xcc1d('0x37')][_0xcc1d('0xa7')](util[_0xcc1d('0x2a')](_0xcc1d('0xe1'),_0x2aa244),_0x291472[_0xcc1d('0xa9')]);return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0xe2'),_0x2aa244));};AGIVertices['prototype']['dial']=function(_0x3ea800){logger[_0xcc1d('0xe3')](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x3ea800['label']));if(!this[_0xcc1d('0x90')](_0x3ea800[_0xcc1d('0xe4')])){return this[_0xcc1d('0x37')]['error'](_0x3ea800,'no\x20user\x20selected');}var _0x3e1546=this[_0xcc1d('0x1c')][_0xcc1d('0x7b')](this,_0x3ea800['sip_id']);if(!_0x3e1546){return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x3ea800,_0xcc1d('0xe5'));}var _0x34156f=this[_0xcc1d('0x37')]['exec'](_0xcc1d('0xe6'),[util[_0xcc1d('0x2a')](_0xcc1d('0xe7'),_0x3e1546),_0x3ea800['timeout'],_0x3ea800[_0xcc1d('0xe8')],_0x3ea800[_0xcc1d('0x6c')]]);if(_0x34156f['result']===-0x1){return _0x34156f;}return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0xe9'),_0xcc1d('0xe6')));};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0xea')]=function(_0x28e1bc){logger['info'](util[_0xcc1d('0x2a')](_0xcc1d('0xeb'),_0x28e1bc[_0xcc1d('0x39')]));if(!this[_0xcc1d('0x90')](_0x28e1bc[_0xcc1d('0x85')])){return this['channel'][_0xcc1d('0xb0')](_0xcc1d('0xec'));}if(!this['isConfigured'](_0x28e1bc[_0xcc1d('0x63')])){return this[_0xcc1d('0x37')]['noop'](_0xcc1d('0xb1'));}this[_0xcc1d('0x37')][_0xcc1d('0xed')]=!![];this[_0xcc1d('0x36')](_0x28e1bc);this[_0xcc1d('0x45')](_0x28e1bc[_0xcc1d('0x63')],'in','','');this['channel'][_0xcc1d('0xb0')](util['format'](_0xcc1d('0xee'),_0x28e1bc[_0xcc1d('0x63')]));var _0x5af00f=this['googleDialogflow']['sync'](this,_0x28e1bc);if(_0x5af00f){for(var _0x5b2c11 in _0x5af00f){if(_0x5af00f['hasOwnProperty'](_0x5b2c11)){this['channel'][_0xcc1d('0xa7')](util[_0xcc1d('0x2a')](_0xcc1d('0xef'),_0x5b2c11[_0xcc1d('0x73')]()),_0x5af00f[_0x5b2c11]);}}this[_0xcc1d('0x45')](_0x5af00f[_0xcc1d('0xf0')],_0xcc1d('0xf1'),'dialogflow','');return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0xf2'),_0x5af00f[_0xcc1d('0xf0')]));}return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x28e1bc,_0xcc1d('0xf3'));};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0xf4')]=function(_0x551bfe){logger['info'](util[_0xcc1d('0x2a')](_0xcc1d('0xf5'),_0x551bfe['label']));if(!this[_0xcc1d('0x90')](_0x551bfe[_0xcc1d('0x87')])){return this[_0xcc1d('0x37')][_0xcc1d('0xb0')]('no\x20project_id\x20configured');}if(!this[_0xcc1d('0x90')](_0x551bfe[_0xcc1d('0x88')])){return this[_0xcc1d('0x37')][_0xcc1d('0xb0')]('no\x20client_email\x20configured');}if(!this[_0xcc1d('0x90')](_0x551bfe[_0xcc1d('0x89')])){return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](_0xcc1d('0xf6'));}if(!this[_0xcc1d('0x90')](_0x551bfe['dialogflowV2_language'])){return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](_0xcc1d('0xf7'));}if(!this['isConfigured'](_0x551bfe[_0xcc1d('0x63')])){return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](_0xcc1d('0xb1'));}this[_0xcc1d('0x37')][_0xcc1d('0xed')]=!![];this[_0xcc1d('0x36')](_0x551bfe);this[_0xcc1d('0x45')](_0x551bfe[_0xcc1d('0x63')],'in','','');this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util['format'](_0xcc1d('0xf8'),_0x551bfe[_0xcc1d('0x63')]));var _0x5735b1=this[_0xcc1d('0x86')][_0xcc1d('0x7b')](this,_0x551bfe);if(_0x5735b1){for(var _0x1de623 in _0x5735b1){if(_0x5735b1[_0xcc1d('0x9e')](_0x1de623)){if(_0x1de623!==_0xcc1d('0xf9')){this['channel'][_0xcc1d('0xa7')](util[_0xcc1d('0x2a')]('DIALOGFLOW_%s',_0x1de623[_0xcc1d('0x73')]()),_0x5735b1[_0x1de623]);}}}this['createSquareMessage'](_0x5735b1['speech'],_0xcc1d('0xf1'),_0xcc1d('0xf4'),_0x5735b1['providerResponse']);return this['channel'][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')]('DialogflowV2\x20Result\x20%s',_0x5735b1[_0xcc1d('0xf0')]));}return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x551bfe,_0xcc1d('0xfa'));};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0xfb')]=function(_0x49cf0a){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0xfc'),_0x49cf0a[_0xcc1d('0x39')]));if(!this[_0xcc1d('0x90')](_0x49cf0a[_0xcc1d('0xfd')])){return this['channel'][_0xcc1d('0xb0')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x49cf0a[_0xcc1d('0xfe')])){return this['channel'][_0xcc1d('0xb0')](_0xcc1d('0xff'));}if(!this[_0xcc1d('0x90')](_0x49cf0a[_0xcc1d('0x100')])){return this[_0xcc1d('0x37')][_0xcc1d('0xb0')]('no\x20password\x20configured');}if(!this[_0xcc1d('0x90')](_0x49cf0a[_0xcc1d('0x101')])){return this['channel'][_0xcc1d('0xb0')](_0xcc1d('0xb1'));}this[_0xcc1d('0x37')]['bot']=!![];this[_0xcc1d('0x36')](_0x49cf0a);this['createSquareMessage'](_0x49cf0a['text'],'in','','');this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util['format'](_0xcc1d('0x102'),_0x49cf0a[_0xcc1d('0x63')]));var _0x13382b=this['sestekNDA'][_0xcc1d('0x7b')](this,_0x49cf0a);if(_0x13382b){for(var _0x1ed56f in _0x13382b){if(_0x13382b[_0xcc1d('0x9e')](_0x1ed56f)){this[_0xcc1d('0x37')][_0xcc1d('0xa7')](util['format'](_0xcc1d('0x103'),_0x1ed56f[_0xcc1d('0x73')]()),_0x13382b[_0x1ed56f]);}}this[_0xcc1d('0x45')](_0x13382b[_0xcc1d('0xf0')],'out',_0xcc1d('0xfb'),'');if(_0x13382b[_0xcc1d('0x104')]){this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x13382b['audiofile']));var _0x22aeda=this[_0xcc1d('0x37')]['streamFile'](_0x13382b[_0xcc1d('0x104')]);try{fs['unlink'](_0x13382b['audiofile']+_0xcc1d('0x105'));}catch(_0x27e611){logger[_0xcc1d('0x59')](_0x27e611);}return _0x22aeda;}else{return this[_0xcc1d('0x37')]['noop'](util['format'](_0xcc1d('0x106'),_0x13382b[_0xcc1d('0xf0')]));}}return this[_0xcc1d('0x37')]['error'](_0x49cf0a,_0xcc1d('0x107'));};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x108')]=function(_0x2a4b19){logger[_0xcc1d('0x2e')](util['format'](_0xcc1d('0x109'),_0x2a4b19[_0xcc1d('0x39')]));return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](_0xcc1d('0x108'));};AGIVertices[_0xcc1d('0x10')]['ext_dial']=function(_0x1a202b){logger[_0xcc1d('0x2e')](util['format'](_0xcc1d('0x10a'),_0x1a202b[_0xcc1d('0x39')]));var _0xaa45b4='';if(_0x1a202b['trunk_id']){if(!this[_0xcc1d('0x90')](_0x1a202b[_0xcc1d('0x10b')])){return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x1a202b,'no\x20trunk\x20selected');}else{var _0x239081=parseInt(_0x1a202b['trunk_id'],0xa);if(isNaN(_0x239081)){_0xaa45b4=_0x1a202b[_0xcc1d('0x10b')];}else{_0xaa45b4=this[_0xcc1d('0x10c')][_0xcc1d('0x7b')](this,_0x1a202b[_0xcc1d('0x10b')]);if(!_0xaa45b4){return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x1a202b,_0xcc1d('0x10d'));}}}}else if(_0x1a202b['trunk_name']){_0xaa45b4=_0x1a202b[_0xcc1d('0x10e')];}else{return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x1a202b,_0xcc1d('0x10f'));}var _0x457274=this[_0xcc1d('0x37')][_0xcc1d('0x5e')](_0xcc1d('0xe6'),[util[_0xcc1d('0x2a')](_0xcc1d('0x110'),_0xaa45b4,_0x1a202b[_0xcc1d('0x4c')]),_0x1a202b[_0xcc1d('0x6f')],_0x1a202b[_0xcc1d('0xe8')],_0x1a202b['url']]);if(_0x457274[_0xcc1d('0xac')]===-0x1){return _0x457274;}return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0xe9'),'DIAL'));};AGIVertices[_0xcc1d('0x10')]['finally']=function(_0x395eb7){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0x111'),_0x395eb7['label']));return this['channel'][_0xcc1d('0xb0')](_0xcc1d('0x112'));};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0xc')]=function(_0x149d9c){logger[_0xcc1d('0x2e')](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x149d9c[_0xcc1d('0x39')]));if(_0x149d9c[_0xcc1d('0xaf')]===0x0){return this[_0xcc1d('0xae')](_0x149d9c);}_0x149d9c[_0xcc1d('0xaf')]-=0x1;if(!this[_0xcc1d('0x90')](_0x149d9c[_0xcc1d('0x113')])){return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x149d9c,_0xcc1d('0x114'));}var _0x6d8da5=this[_0xcc1d('0x1f')][_0xcc1d('0x7b')](this,_0x149d9c['file_id']);if(!_0x6d8da5){return this[_0xcc1d('0x37')]['error'](_0x149d9c,_0xcc1d('0x115'));}if(!this[_0xcc1d('0x90')](_0x149d9c['variable_id'])){return this['channel'][_0xcc1d('0x59')](_0xcc1d('0xdc'));}var _0x13a2ae=this['channel'][_0xcc1d('0x116')](_0x6d8da5,_0x149d9c[_0xcc1d('0x117')],_0x149d9c[_0xcc1d('0x118')]);var _0x1cd7f8=_0x13a2ae[_0xcc1d('0xac')]?_0x13a2ae[_0xcc1d('0xac')][_0xcc1d('0x51')]():'';logger['info']('test',JSON['stringify'](_0x13a2ae));if(_0x13a2ae[_0xcc1d('0xac')]===-0x1){this[_0xcc1d('0x36')]['sync'](this,_0x149d9c,_0x1cd7f8);return _0x13a2ae;}else if(_0x13a2ae['extra']==='timeout'){_0x13a2ae[_0xcc1d('0xac')]=_0x1cd7f8[_0xcc1d('0xa9')]>=parseInt(_0x149d9c[_0xcc1d('0x119')])?'x':'i';}else{_0x13a2ae[_0xcc1d('0xac')]=_0x1cd7f8['length']>=parseInt(_0x149d9c[_0xcc1d('0x119')])&&_0x1cd7f8['length']<=parseInt(_0x149d9c[_0xcc1d('0x118')])?'x':'i';}var _0x1159a7=this[_0xcc1d('0x11')][_0xcc1d('0x7b')](this,_0x149d9c[_0xcc1d('0xdb')]);if(!_0x1159a7){return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x149d9c,_0xcc1d('0xdd'));}this[_0xcc1d('0x37')][_0xcc1d('0xa7')](_0x1159a7,_0x1cd7f8);if(this[_0xcc1d('0x90')](_0x149d9c[_0xcc1d('0x11a')])){var _0x3a1dec=parseInt(_0x149d9c[_0xcc1d('0x11a')],0xa);var _0x5011f5=rs[_0xcc1d('0x11b')]({'charset':'*','length':_0x3a1dec});var _0x2ee6be=_0x1cd7f8[_0xcc1d('0xa9')];if(_0x2ee6be>0x0){if(_0x2ee6be>_0x3a1dec){this[_0xcc1d('0x36')][_0xcc1d('0x7b')](this,_0x149d9c,_0x149d9c[_0xcc1d('0x11c')]===_0xcc1d('0x11d')?_0x5011f5+_0x1cd7f8['substr'](_0x3a1dec):_0x1cd7f8[_0xcc1d('0x11e')](0x0,_0x2ee6be-_0x3a1dec)+_0x5011f5);}else{this[_0xcc1d('0x36')][_0xcc1d('0x7b')](this,_0x149d9c,rs[_0xcc1d('0x11b')]({'charset':'*','length':_0x2ee6be}));}}else{this[_0xcc1d('0x36')]['sync'](this,_0x149d9c,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x149d9c,_0x1cd7f8);}return _0x13a2ae;};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0xd')]=function(_0x4104c2){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x4104c2[_0xcc1d('0x39')]));return this[_0xcc1d('0xc')](_0x4104c2);};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x11f')]=function(_0x1236ea){logger[_0xcc1d('0x2e')](util['format'](_0xcc1d('0x120'),_0x1236ea[_0xcc1d('0x39')]));this[_0xcc1d('0x36')][_0xcc1d('0x7b')](this,_0x1236ea,_0x1236ea[_0xcc1d('0x121')]);return this['channel'][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0x122'),_0x1236ea[_0xcc1d('0x121')]));};AGIVertices[_0xcc1d('0x10')]['awspolly']=function(_0x22a85d){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0x123'),_0x22a85d[_0xcc1d('0x39')]));if(!this['isConfigured'](_0x22a85d[_0xcc1d('0x96')])||!this[_0xcc1d('0x90')](_0x22a85d[_0xcc1d('0x93')])){return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](_0xcc1d('0x124'));}if(!this[_0xcc1d('0x90')](_0x22a85d[_0xcc1d('0x63')])){return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](_0xcc1d('0xb1'));}this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util['format'](_0xcc1d('0x125'),_0x22a85d[_0xcc1d('0x63')]));var _0x45b565=this[_0xcc1d('0x92')][_0xcc1d('0x7b')](this,_0x22a85d);if(_0x45b565){this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')]('aws\x20Polly\x20%s\x20file\x20created',_0x45b565));var _0x207fa9=this[_0xcc1d('0x37')]['streamFile'](_0x45b565);try{fs[_0xcc1d('0x126')](_0x45b565+_0xcc1d('0x105'));}catch(_0x49eac0){logger['error'](_0x49eac0);}return _0x207fa9;}return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x22a85d,_0xcc1d('0x127'));};AGIVertices['prototype']['awslex']=function(_0x111bef){logger[_0xcc1d('0x2e')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x111bef[_0xcc1d('0x39')]));if(!this[_0xcc1d('0x90')](_0x111bef['aws_access_key_id'])||!this[_0xcc1d('0x90')](_0x111bef[_0xcc1d('0x93')])){return this[_0xcc1d('0x37')]['noop'](_0xcc1d('0x124'));}if(!this[_0xcc1d('0x90')](_0x111bef[_0xcc1d('0x98')])){return this['channel'][_0xcc1d('0xb0')]('no\x20bot\x20name\x20configured');}if(!this[_0xcc1d('0x90')](_0x111bef[_0xcc1d('0x63')])){return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](_0xcc1d('0xb1'));}this[_0xcc1d('0x37')][_0xcc1d('0xed')]=!![];this[_0xcc1d('0x36')](_0x111bef);this[_0xcc1d('0x45')](_0x111bef[_0xcc1d('0x63')],'in','','');this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0x128'),_0x111bef[_0xcc1d('0x63')]));var _0x3f34b5=this['awsLex'][_0xcc1d('0x7b')](this,_0x111bef);if(_0x3f34b5){for(var _0xf7173f in _0x3f34b5){if(_0x3f34b5['hasOwnProperty'](_0xf7173f)&&_[_0xcc1d('0xa3')](_0x3f34b5[_0xf7173f])){this[_0xcc1d('0x37')][_0xcc1d('0xa7')](util[_0xcc1d('0x2a')](_0xcc1d('0x129'),_0xf7173f[_0xcc1d('0x73')]()),_0x3f34b5[_0xf7173f]);}}if(_[_0xcc1d('0x48')](_0x3f34b5[_0xcc1d('0x81')])){return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](_0xcc1d('0x12a'));}else{this[_0xcc1d('0x45')](_0x3f34b5[_0xcc1d('0x81')],_0xcc1d('0xf1'),_0xcc1d('0x12b'),'');return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0x12c'),_0x3f34b5['message']));}}return this[_0xcc1d('0x37')]['error'](_0x111bef,_0xcc1d('0x12d'));};AGIVertices['prototype']['googleasr']=function(_0xf8a455){logger['info'](util[_0xcc1d('0x2a')](_0xcc1d('0x12e'),_0xf8a455[_0xcc1d('0x39')],_0xf8a455['timeout']));if(!this[_0xcc1d('0x90')](_0xf8a455[_0xcc1d('0x85')])){return this[_0xcc1d('0x37')][_0xcc1d('0xb0')]('no\x20key\x20configured');}var _0x53c8af='wav';var _0x1234b5=util[_0xcc1d('0x2a')]('%s/recordings/%s',FILES_PATH,rs[_0xcc1d('0x11b')](0x4));var _0x1aebff=util['format'](_0xcc1d('0xa6'),_0x1234b5,_0x53c8af);var _0x5e54ba=!![];if(_0xf8a455[_0xcc1d('0x12f')]===_0xcc1d('0x130')){_0x5e54ba=![];}var _0x59fcfa=this[_0xcc1d('0x37')][_0xcc1d('0x131')](_0x1234b5,_0x53c8af,_0xf8a455[_0xcc1d('0x132')],_0xf8a455[_0xcc1d('0x6f')],undefined,_0x5e54ba);if(_0x59fcfa[_0xcc1d('0xac')]!==-0x1){this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0x133'),_0x1aebff));var _0x4e9672=this[_0xcc1d('0x99')]['sync'](this,_0xf8a455,_0x1aebff);if(_0x4e9672){for(var _0x10d8a8 in _0x4e9672){if(_0x4e9672['hasOwnProperty'](_0x10d8a8)){this['channel'][_0xcc1d('0xa7')](util[_0xcc1d('0x2a')]('GOOGLE_ASR_%s',_0x10d8a8[_0xcc1d('0x73')]()),_0x4e9672[_0x10d8a8]);}}return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x4e9672)));}}return _0x59fcfa;};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x134')]=function(_0x22cf3a){logger['info'](util[_0xcc1d('0x2a')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x22cf3a[_0xcc1d('0x39')]));if(!this[_0xcc1d('0x90')](_0x22cf3a[_0xcc1d('0x9b')])){return this[_0xcc1d('0x37')]['noop'](_0xcc1d('0x135'));}if(!this[_0xcc1d('0x90')](_0x22cf3a['appsecret'])){return this['channel']['noop'](_0xcc1d('0x136'));}var _0x1ebd9c=_0xcc1d('0x137');var _0xe362=util[_0xcc1d('0x2a')](_0xcc1d('0x138'),FILES_PATH,rs[_0xcc1d('0x11b')](0x4));var _0x34808f=util[_0xcc1d('0x2a')](_0xcc1d('0xa6'),_0xe362,_0x1ebd9c);var _0x19bafe=!![];if(_0x22cf3a[_0xcc1d('0x12f')]==='NOBEEP'){_0x19bafe=![];}var _0x38375c=this['channel'][_0xcc1d('0x131')](_0xe362,_0x1ebd9c,_0x22cf3a[_0xcc1d('0x132')],_0x22cf3a[_0xcc1d('0x6f')],undefined,_0x19bafe);if(_0x38375c[_0xcc1d('0xac')]!==-0x1){this['channel'][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0x139'),_0x34808f));var _0x1efb21=this[_0xcc1d('0x9a')][_0xcc1d('0x7b')](this,_0x22cf3a,_0x34808f);if(_0x1efb21){for(var _0x3dcbe2 in _0x1efb21){if(_0x1efb21[_0xcc1d('0x9e')](_0x3dcbe2)){this[_0xcc1d('0x37')][_0xcc1d('0xa7')](util[_0xcc1d('0x2a')](_0xcc1d('0x13a'),_0x3dcbe2[_0xcc1d('0x73')]()),_0x1efb21[_0x3dcbe2]);}}return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0x13b'),JSON[_0xcc1d('0x7e')](_0x1efb21)));}}return _0x38375c;};AGIVertices['prototype'][_0xcc1d('0x13c')]=function(_0x3cd54e){logger['info'](util[_0xcc1d('0x2a')](_0xcc1d('0x13d'),_0x3cd54e[_0xcc1d('0x39')]));return this[_0xcc1d('0x37')][_0xcc1d('0x13e')](_0x3cd54e[_0xcc1d('0x3f')],_0x3cd54e[_0xcc1d('0x40')],_0x3cd54e[_0xcc1d('0x41')]);};AGIVertices[_0xcc1d('0x10')]['gotoif']=function(_0x5858e0){logger['info'](util[_0xcc1d('0x2a')](_0xcc1d('0x13f'),_0x5858e0['label']));if(!this[_0xcc1d('0x90')](_0x5858e0[_0xcc1d('0x140')])){return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x5858e0,_0xcc1d('0x141'));}try{var _0x69c588=eval(_0x5858e0[_0xcc1d('0x140')])?_0xcc1d('0x142'):_0xcc1d('0x143');this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x5858e0['condition'],_0x69c588));return{'code':0xc8,'result':_0x69c588};}catch(_0x454d06){return{'code':0xc8,'result':_0xcc1d('0x143')};}};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x144')]=function(_0x292847){logger['info'](util['format'](_0xcc1d('0x145'),_0x292847[_0xcc1d('0x39')]));if(!this[_0xcc1d('0x90')](_0x292847[_0xcc1d('0x146')])){return this[_0xcc1d('0x37')]['error'](_0x292847,'no\x20interval\x20configured');}var _0x3c0ee0=this[_0xcc1d('0x25')][_0xcc1d('0x7b')](this,_0x292847[_0xcc1d('0x146')]);if(!_0x3c0ee0){return this[_0xcc1d('0x37')]['error'](_0x292847,_0xcc1d('0x147'));}for(var _0x5fe044=0x0;_0x5fe044<_0x3c0ee0['length'];_0x5fe044+=0x1){var _0x1242ad=this[_0xcc1d('0x37')][_0xcc1d('0x11')](util[_0xcc1d('0x2a')](_0xcc1d('0x148'),_0x3c0ee0[_0x5fe044]));if(_0x1242ad[_0xcc1d('0xac')]===-0x1){return _0x1242ad;}logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0x149'),_0x3c0ee0[_0x5fe044],_0x1242ad[_0xcc1d('0xab')]));if(_0x1242ad[_0xcc1d('0xab')]==='true'){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')]('IFTIME\x20%s\x20%s',_0x3c0ee0[_0x5fe044],_0xcc1d('0x142')));this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')]('IFTIME\x20%s\x20%s',_0x3c0ee0[_0x5fe044],_0xcc1d('0x142')));return{'code':0xc8,'result':'true'};}else{logger['info'](util['format'](_0xcc1d('0x149'),_0x3c0ee0[_0x5fe044],_0xcc1d('0x143')));this['channel'][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0x149'),_0x3c0ee0[_0x5fe044],_0xcc1d('0x143')));}}return{'code':0xc8,'result':_0xcc1d('0x143')};};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x14a')]=function(_0x15187f){logger['info'](util[_0xcc1d('0x2a')](_0xcc1d('0x14b'),_0x15187f[_0xcc1d('0x39')]));return this[_0xcc1d('0x37')][_0xcc1d('0x14a')]();};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x14c')]=function(_0x2121ed){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0x14d'),_0x2121ed[_0xcc1d('0x39')]));if(!this[_0xcc1d('0x90')](_0x2121ed[_0xcc1d('0x85')])){return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](_0xcc1d('0xec'));}var _0x1de4e9=_0xcc1d('0x137');var _0x2fd828=util[_0xcc1d('0x2a')]('%s/recordings/%s',FILES_PATH,rs[_0xcc1d('0x11b')](0x4));var _0x33ef1f=util[_0xcc1d('0x2a')](_0xcc1d('0xa6'),_0x2fd828,_0x1de4e9);var _0x4c3c4e=!![];if(_0x2121ed[_0xcc1d('0x12f')]===_0xcc1d('0x130')){_0x4c3c4e=![];}var _0x4e1879=this[_0xcc1d('0x37')][_0xcc1d('0x131')](_0x2fd828,_0x1de4e9,_0x2121ed[_0xcc1d('0x132')],_0x2121ed[_0xcc1d('0x6f')],undefined,_0x4c3c4e);if(_0x4e1879['result']!==-0x1){this[_0xcc1d('0x37')]['noop'](util['format']('ispeech\x20%s\x20file\x20created',_0x33ef1f));var _0x3816f8=this['ispeechASR']['sync'](this,_0x2121ed,_0x33ef1f);if(_0x3816f8){for(var _0x52c369 in _0x3816f8){if(_0x3816f8[_0xcc1d('0x9e')](_0x52c369)){this['channel']['setVariable'](util[_0xcc1d('0x2a')]('ISPEECH_ASR_%s',_0x52c369['toUpperCase']()),_0x3816f8[_0x52c369]);}}return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util['format'](_0xcc1d('0x14e'),JSON[_0xcc1d('0x7e')](_0x3816f8)));}}return _0x4e1879;};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x14f')]=function(_0x22367c){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0x150'),_0x22367c['label']));if(!this[_0xcc1d('0x90')](_0x22367c[_0xcc1d('0x85')])){return this['channel']['noop'](_0xcc1d('0xec'));}if(!this[_0xcc1d('0x90')](_0x22367c[_0xcc1d('0x63')])){return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](_0xcc1d('0xb1'));}this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0x151'),_0x22367c[_0xcc1d('0x63')]));var _0x31a164=this[_0xcc1d('0x8c')][_0xcc1d('0x7b')](this,_0x22367c);if(_0x31a164){this[_0xcc1d('0x37')]['noop'](util[_0xcc1d('0x2a')](_0xcc1d('0x152'),_0x31a164));var _0x50ff97=this[_0xcc1d('0x37')][_0xcc1d('0x153')](_0x31a164,_0x22367c['intKey']);try{fs[_0xcc1d('0x126')](_0x31a164+_0xcc1d('0x105'));}catch(_0x31dfae){logger['error'](_0x31dfae);}return _0x50ff97;}return this[_0xcc1d('0x37')]['error'](_0x22367c,_0xcc1d('0x154'));};AGIVertices[_0xcc1d('0x10')]['login']=function(_0x484ed5){logger['info'](util[_0xcc1d('0x2a')](_0xcc1d('0x155'),_0x484ed5['label']));if(!this[_0xcc1d('0x90')](_0x484ed5[_0xcc1d('0x156')])){return this['channel'][_0xcc1d('0x59')](_0x484ed5,_0xcc1d('0x157'));}logger['info'](util[_0xcc1d('0x2a')](_0xcc1d('0x158'),this[_0xcc1d('0x37')][_0xcc1d('0x3c')],_0x484ed5[_0xcc1d('0x156')]));var _0x5e8481=this['agentLogin']['sync'](this,_0x484ed5[_0xcc1d('0x156')]);if(_0x5e8481){logger['info'](util['format'](_0xcc1d('0x159'),this['channel'][_0xcc1d('0x3c')],_0x484ed5[_0xcc1d('0x156')]));this['channel'][_0xcc1d('0xb0')](util['format'](_0xcc1d('0x159'),this['channel'][_0xcc1d('0x3c')],_0x484ed5[_0xcc1d('0x156')]));return{'code':0xc8,'result':_0xcc1d('0x15a')};}else{logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0x15b'),this[_0xcc1d('0x37')]['callerid'],_0x484ed5[_0xcc1d('0x156')]));this['channel']['noop'](util[_0xcc1d('0x2a')](_0xcc1d('0x15b'),this[_0xcc1d('0x37')][_0xcc1d('0x3c')],_0x484ed5[_0xcc1d('0x156')]));return{'code':0xc8,'result':_0xcc1d('0x15c')};}};AGIVertices['prototype']['logout']=function(_0xaf249d){logger['info'](util[_0xcc1d('0x2a')](_0xcc1d('0x15d'),_0xaf249d[_0xcc1d('0x39')]));if(!this[_0xcc1d('0x90')](_0xaf249d[_0xcc1d('0x156')])){return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0xaf249d,'no\x20find\x20by\x20configured');}logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0x158'),this[_0xcc1d('0x37')][_0xcc1d('0x3c')],_0xaf249d['findBy']));var _0x3314cc=this[_0xcc1d('0x58')][_0xcc1d('0x7b')](this,_0xaf249d[_0xcc1d('0x156')]);if(_0x3314cc){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0x159'),this['channel'][_0xcc1d('0x3c')],_0xaf249d['findBy']));this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0x159'),this[_0xcc1d('0x37')][_0xcc1d('0x3c')],_0xaf249d['findBy']));return{'code':0xc8,'result':_0xcc1d('0x15a')};}else{logger['info'](util[_0xcc1d('0x2a')](_0xcc1d('0x15b'),this[_0xcc1d('0x37')][_0xcc1d('0x3c')],_0xaf249d['findBy']));this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0x15b'),this[_0xcc1d('0x37')][_0xcc1d('0x3c')],_0xaf249d['findBy']));return{'code':0xc8,'result':_0xcc1d('0x15c')};}};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x15e')]=function(_0x1a0335){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0x15f'),_0x1a0335[_0xcc1d('0x39')]));if(!this[_0xcc1d('0x90')](_0x1a0335[_0xcc1d('0x160')])){return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x1a0335,_0xcc1d('0x161'));}this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0x162'),_0x1a0335[_0xcc1d('0x160')]));var _0x261daf=eval(_0x1a0335['operation']);if(!this[_0xcc1d('0x90')](_0x1a0335[_0xcc1d('0xdb')])){return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](_0xcc1d('0xdc'));}var _0x64d193=this[_0xcc1d('0x11')]['sync'](this,_0x1a0335[_0xcc1d('0xdb')]);if(!_0x64d193){return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x1a0335,'no\x20variable\x20found');}if(_[_0xcc1d('0xa2')](_0x261daf)){var _0x193247=this;_0x261daf[_0xcc1d('0xde')](function(_0x4f42ac,_0x11ea10){_0x193247[_0xcc1d('0x37')][_0xcc1d('0xa7')](util[_0xcc1d('0x2a')]('%s[%s]',_0x64d193,_0x11ea10),_0x4f42ac);});return this['channel'][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0x163'),_0x64d193));}else{return this[_0xcc1d('0x37')][_0xcc1d('0xa7')](_0x64d193,_0x261daf);}};AGIVertices['prototype'][_0xcc1d('0xb')]=function(_0xf2711f){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0xf2711f[_0xcc1d('0x39')]));if(_0xf2711f[_0xcc1d('0xaf')]===0x0){return this[_0xcc1d('0xae')](_0xf2711f);}_0xf2711f['retry']-=0x1;if(!this[_0xcc1d('0x90')](_0xf2711f[_0xcc1d('0x113')])){return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0xf2711f,'no\x20file\x20audio\x20selected');}var _0xe56ef4=this[_0xcc1d('0x1f')][_0xcc1d('0x7b')](this,_0xf2711f[_0xcc1d('0x113')]);if(!_0xe56ef4){return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0xf2711f,_0xcc1d('0x115'));}var _0x33c9fc=this[_0xcc1d('0x37')][_0xcc1d('0x116')](_0xe56ef4,_0xf2711f[_0xcc1d('0x117')],_0xf2711f[_0xcc1d('0x164')]);var _0x36a07d=_0x33c9fc[_0xcc1d('0xac')];if(_0x33c9fc['result']===-0x1){this[_0xcc1d('0x36')][_0xcc1d('0x7b')](this,_0xf2711f,'-1');return _0x33c9fc;}else if(_0x33c9fc[_0xcc1d('0xab')]===_0xcc1d('0x6f')){_0x33c9fc[_0xcc1d('0xac')]=_0x33c9fc['result']['length']>0x0?_0x33c9fc[_0xcc1d('0xac')]:'t';}else if(_['isEmpty'](_0x33c9fc[_0xcc1d('0xac')])){_0x33c9fc['result']='#';_0x36a07d='#';}if(!this[_0xcc1d('0x90')](_0xf2711f[_0xcc1d('0xdb')])){this['channel'][_0xcc1d('0xb0')](_0xcc1d('0xdc'));}else{var _0x21e915=this['getVariable'][_0xcc1d('0x7b')](this,_0xf2711f[_0xcc1d('0xdb')]);if(!_0x21e915){return this['channel'][_0xcc1d('0x59')](_0xf2711f,_0xcc1d('0xdd'));}this[_0xcc1d('0x37')][_0xcc1d('0xa7')](_0x21e915,_0x36a07d);}this[_0xcc1d('0x36')][_0xcc1d('0x7b')](this,_0xf2711f,_0x36a07d);return _0x33c9fc;};AGIVertices['prototype'][_0xcc1d('0xb0')]=function(_0xd62bc8){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0xd62bc8[_0xcc1d('0x39')]));return this['channel'][_0xcc1d('0xb0')](_0xd62bc8['output']||_0xd62bc8[_0xcc1d('0x39')]);};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x165')]=function(_0x3d83a4){logger[_0xcc1d('0x2e')](util['format'](_0xcc1d('0x166'),_0x3d83a4[_0xcc1d('0x39')]));if(!this[_0xcc1d('0x90')](_0x3d83a4[_0xcc1d('0x156')])){return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x3d83a4,_0xcc1d('0x157'));}logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xcc1d('0x37')][_0xcc1d('0x3c')],_0x3d83a4[_0xcc1d('0x156')]));var _0x3bf66e=this['getPause'][_0xcc1d('0x7b')](this,_0x3d83a4[_0xcc1d('0x167')]);var _0x1e9d1c=this[_0xcc1d('0x55')][_0xcc1d('0x7b')](this,_0x3d83a4[_0xcc1d('0x156')],_0x3bf66e);if(_0x1e9d1c){logger['info'](util['format'](_0xcc1d('0x159'),this[_0xcc1d('0x37')]['callerid'],_0x3d83a4[_0xcc1d('0x156')]));this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0x159'),this[_0xcc1d('0x37')][_0xcc1d('0x3c')],_0x3d83a4[_0xcc1d('0x156')]));return{'code':0xc8,'result':_0xcc1d('0x15a')};}else{logger[_0xcc1d('0x2e')](util['format'](_0xcc1d('0x15b'),this[_0xcc1d('0x37')][_0xcc1d('0x3c')],_0x3d83a4[_0xcc1d('0x156')]));this[_0xcc1d('0x37')]['noop'](util[_0xcc1d('0x2a')](_0xcc1d('0x159'),this['channel'][_0xcc1d('0x3c')],_0x3d83a4[_0xcc1d('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x168')]=function(_0x5d70b6){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0x169'),_0x5d70b6[_0xcc1d('0x39')]));if(!this[_0xcc1d('0x90')](_0x5d70b6[_0xcc1d('0x113')])){return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x5d70b6,_0xcc1d('0x114'));}var _0x5b4f49=this[_0xcc1d('0x1f')]['sync'](this,_0x5d70b6['file_id']);if(!_0x5b4f49){return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x5d70b6,_0xcc1d('0x115'));}var _0x9e1429=this['channel'][_0xcc1d('0x5e')](_0xcc1d('0x16a'),[_0x5b4f49,_0x5d70b6[_0xcc1d('0xe8')]]);if(_0x9e1429[_0xcc1d('0xac')]===-0x1){return _0x9e1429;}return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0x16b'),_0xcc1d('0x16a'),_0x5b4f49));};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x16c')]=function(_0x5afc77){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0x16d'),_0x5afc77[_0xcc1d('0x39')]));if(!this['isConfigured'](_0x5afc77['queue_id'])){return this[_0xcc1d('0x37')]['error'](_0x5afc77,_0xcc1d('0x16e'));}var _0x4beb0e='';var _0x31557a=parseInt(_0x5afc77[_0xcc1d('0x16f')],0xa);if(isNaN(_0x31557a)){_0x4beb0e=_0x5afc77[_0xcc1d('0x16f')];}else{_0x4beb0e=this[_0xcc1d('0x16')][_0xcc1d('0x7b')](this,_0x5afc77[_0xcc1d('0x16f')]);if(!_0x4beb0e){return this[_0xcc1d('0x37')]['error'](_0x5afc77,_0xcc1d('0x170'));}}var _0x31cd46='';if(this[_0xcc1d('0x90')](_0x5afc77[_0xcc1d('0x113')])){var _0x5df6ed=this[_0xcc1d('0x1f')][_0xcc1d('0x7b')](this,_0x5afc77[_0xcc1d('0x113')]);if(_0x5df6ed){_0x31cd46=_0x5df6ed;}}this['createSquareDetailsReport'][_0xcc1d('0x7b')](this,_0x5afc77,_0x4beb0e);if(_0x5afc77[_0xcc1d('0xe8')]['indexOf']('x')<0x0){_0x5afc77['opts']+='x';}if(_0x5afc77['opts'][_0xcc1d('0x171')]('X')<0x0){_0x5afc77[_0xcc1d('0xe8')]+='X';}this[_0xcc1d('0x37')][_0xcc1d('0xa7')](_0xcc1d('0x172'),_0x4beb0e?_0x4beb0e[_0xcc1d('0x173')]():'');var _0x32bbe7=this['channel'][_0xcc1d('0x5e')](_0xcc1d('0x174'),[_0x4beb0e,_0x5afc77[_0xcc1d('0xe8')],_0x5afc77['url'],_0x31cd46,_0x5afc77[_0xcc1d('0x6f')],_0x5afc77['agi'],_0x5afc77['macro'],_0x5afc77[_0xcc1d('0x175')],'',_0x5afc77[_0xcc1d('0x176')]]);if(_0x32bbe7[_0xcc1d('0xac')]===-0x1){return _0x32bbe7;}return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util['format'](_0xcc1d('0x16b'),_0xcc1d('0x174'),_0x4beb0e));};AGIVertices['prototype'][_0xcc1d('0x177')]=function(_0x222478){logger['info'](util[_0xcc1d('0x2a')](_0xcc1d('0x178'),_0x222478[_0xcc1d('0x39')]));var _0x2ab8fb=_0x222478['recordingFormat']||_0xcc1d('0x137');var _0x18dc45=util[_0xcc1d('0x2a')](_0xcc1d('0x179'),this[_0xcc1d('0x37')][_0xcc1d('0x38')],rs[_0xcc1d('0x11b')](0x5));var _0x14162f=util[_0xcc1d('0x2a')](_0xcc1d('0x17a'),FILES_PATH,_0x18dc45,_0x2ab8fb);var _0x2c49f3=util[_0xcc1d('0x2a')]('%s/recordings/%s',FILES_PATH,_0x18dc45);this[_0xcc1d('0x3d')][_0xcc1d('0x7b')](this,_0x222478,_0x18dc45,_0x14162f);this['channel']['setVariable'](_0xcc1d('0x17b'),_0x18dc45);logger[_0xcc1d('0x2e')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x2c49f3,_0x2ab8fb,_0x222478[_0xcc1d('0x17c')],_0x222478[_0xcc1d('0x6f')]);return this['channel'][_0xcc1d('0x131')](_0x2c49f3,_0x2ab8fb,_0x222478[_0xcc1d('0x17c')],_0x222478[_0xcc1d('0x6f')],undefined,!![]);};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x17d')]=function(_0x20f206){logger[_0xcc1d('0x2e')](util['format'](_0xcc1d('0x17e'),_0x20f206[_0xcc1d('0x39')]));if(!this[_0xcc1d('0x90')](_0x20f206[_0xcc1d('0x6c')])){return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](_0xcc1d('0x17f'));}var _0x47a01e=this[_0xcc1d('0x6b')]['sync'](this,_0x20f206);logger[_0xcc1d('0x2e')](util['format'](_0xcc1d('0x180'),util[_0xcc1d('0x181')](_0x47a01e,{'showHidden':![],'depth':null})));if(!this[_0xcc1d('0x90')](_0x20f206['variable_id'])){return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](_0xcc1d('0x182'));}var _0x43a44b=this[_0xcc1d('0x11')][_0xcc1d('0x7b')](this,_0x20f206[_0xcc1d('0xdb')]);if(!_0x43a44b){return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x20f206,_0xcc1d('0xdd'));}this[_0xcc1d('0x37')][_0xcc1d('0xa7')](util[_0xcc1d('0x2a')](_0xcc1d('0x183'),_0x43a44b),_0x47a01e[_0xcc1d('0x7f')]?_0x47a01e[_0xcc1d('0x7f')]:_0xcc1d('0x184'));this[_0xcc1d('0x37')][_0xcc1d('0xa7')](util[_0xcc1d('0x2a')](_0xcc1d('0x185'),_0x43a44b),_0x47a01e[_0xcc1d('0x80')]?_0x47a01e[_0xcc1d('0x80')]:'OK');if(_0x47a01e['body']){try{this[_0xcc1d('0xa4')](_0x47a01e[_0xcc1d('0x74')],_0x43a44b);}catch(_0x4bd851){logger['error'](util[_0xcc1d('0x2a')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x43a44b));}}return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0xe2'),_0x43a44b));};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x186')]=function(_0x25d012){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0x187'),_0x25d012[_0xcc1d('0x39')]));return this[_0xcc1d('0x37')][_0xcc1d('0x188')](_0x25d012['digits'][_0xcc1d('0x5f')](/\s+/g,''),_0x25d012[_0xcc1d('0x17c')]);};AGIVertices['prototype']['saynumber']=function(_0x2d736d){logger['info'](util[_0xcc1d('0x2a')](_0xcc1d('0x189'),_0x2d736d['label']));return this[_0xcc1d('0x37')][_0xcc1d('0x18a')](_0x2d736d[_0xcc1d('0x6e')][_0xcc1d('0x5f')](/\s+/g,''),_0x2d736d[_0xcc1d('0x17c')]);};AGIVertices['prototype'][_0xcc1d('0x18b')]=function(_0x49d91e){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0x18c'),_0x49d91e[_0xcc1d('0x39')]));return this[_0xcc1d('0x37')]['sayPhonetic'](_0x49d91e[_0xcc1d('0x63')],_0x49d91e[_0xcc1d('0x17c')]);};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x18d')]=function(_0x5a33dd){logger['info'](util[_0xcc1d('0x2a')](_0xcc1d('0x18e'),_0x5a33dd[_0xcc1d('0x39')]));if(!this['isConfigured'](_0x5a33dd[_0xcc1d('0x18f')])){return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](_0xcc1d('0x190'));}var _0x1fb289=this['getMailAccount'][_0xcc1d('0x7b')](this,_0x5a33dd[_0xcc1d('0x18f')]);if(!_0x1fb289||!_0x1fb289[_0xcc1d('0x191')]){return this[_0xcc1d('0x37')]['error'](_0x5a33dd,_0xcc1d('0x192'));}var _0x5ba9f2={'from':util[_0xcc1d('0x2a')](_0xcc1d('0x193'),_0x1fb289[_0xcc1d('0x14')],_0x1fb289[_0xcc1d('0x194')]||_0x1fb289['Smtp']['user']),'to':_0x5a33dd['to']||'','cc':_0x5a33dd['cc']||'','bcc':_0x5a33dd[_0xcc1d('0x195')]||'','subject':_0x5a33dd[_0xcc1d('0x196')],'html':_0x5a33dd['text'],'text':_0x5a33dd[_0xcc1d('0x63')]};var _0x3df975={'tls':{'rejectUnauthorized':![]}};if(_0x1fb289[_0xcc1d('0x191')][_0xcc1d('0x197')]){_0x3df975[_0xcc1d('0x197')]=_0x1fb289[_0xcc1d('0x191')][_0xcc1d('0x197')];}else{_0x3df975['host']=_0x1fb289[_0xcc1d('0x191')]['host'];_0x3df975[_0xcc1d('0x198')]=_0x1fb289[_0xcc1d('0x191')][_0xcc1d('0x198')];_0x3df975[_0xcc1d('0x199')]=_0x1fb289[_0xcc1d('0x191')][_0xcc1d('0x199')];}if(_0x1fb289['Smtp'][_0xcc1d('0x19a')]){_0x3df975[_0xcc1d('0x19b')]={'user':_0x1fb289['Smtp'][_0xcc1d('0x19c')],'pass':_0x1fb289[_0xcc1d('0x191')][_0xcc1d('0x19d')]};}if(this[_0xcc1d('0x90')](_0x5a33dd[_0xcc1d('0x19e')])){}logger[_0xcc1d('0xe3')](_0xcc1d('0x19f'),JSON[_0xcc1d('0x7e')](_0x5ba9f2));this[_0xcc1d('0x36')][_0xcc1d('0x7b')](this,_0x5a33dd,_0x5a33dd[_0xcc1d('0x18f')]);this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0x1a0'),_0x1fb289[_0xcc1d('0x14')]));this['sendMailMessage'][_0xcc1d('0x7b')](this,_0x3df975,_0x5ba9f2);return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](_0xcc1d('0x1a1'));};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x1a2')]=function(_0x27a497){logger['info'](util['format'](_0xcc1d('0x1a3'),_0x27a497[_0xcc1d('0x39')]));return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](_0xcc1d('0x1a4'));};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x1a5')]=function(_0x3669c7){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0x1a6'),_0x3669c7[_0xcc1d('0x39')]));if(!this[_0xcc1d('0x90')](_0x3669c7[_0xcc1d('0x1a7')])){return this['channel'][_0xcc1d('0xb0')]('no\x20sms\x20account\x20configured');}var _0x553063=this['getSmsAccount'][_0xcc1d('0x7b')](this,_0x3669c7[_0xcc1d('0x1a7')]);if(!_0x553063){return this[_0xcc1d('0x37')]['error'](_0x3669c7,'no\x20sms\x20account\x20found');}var _0x23dec8={'body':_0x3669c7[_0xcc1d('0x1a8')],'phone':_0x3669c7['to']||'','SmsAccountId':_0x553063['id']};logger[_0xcc1d('0xe3')]('sendSMS\x20message',JSON['stringify'](_0x23dec8));this[_0xcc1d('0x36')][_0xcc1d('0x7b')](this,_0x3669c7,_0x3669c7[_0xcc1d('0x1a7')]);this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util['format'](_0xcc1d('0x1a9'),_0x553063[_0xcc1d('0x14')]));this[_0xcc1d('0x35')]['sync'](this,_0x23dec8);return this[_0xcc1d('0x37')][_0xcc1d('0xb0')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x1aa')]=function(_0x43ba7c){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x43ba7c[_0xcc1d('0x39')]));if(!this[_0xcc1d('0x90')](_0x43ba7c[_0xcc1d('0xdb')])){return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x43ba7c,_0xcc1d('0x1ab'));}var _0x17615c=this[_0xcc1d('0x11')][_0xcc1d('0x7b')](this,_0x43ba7c['variable_id']);if(!_0x17615c){return this[_0xcc1d('0x37')]['error'](_0x43ba7c,'no\x20variable\x20found');}return this[_0xcc1d('0x37')][_0xcc1d('0xa7')](_0x17615c,_0x43ba7c[_0xcc1d('0x1ac')]);};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x1ad')]=function(_0x1a0fcd){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0x1ae'),_0x1a0fcd[_0xcc1d('0x39')]));this[_0xcc1d('0x37')]['noop'](_0xcc1d('0x1af'));if(_0x1a0fcd[_0xcc1d('0xbd')]==='yes'){this[_0xcc1d('0x37')]['noop'](_0xcc1d('0x1b0'));return this[_0xcc1d('0x37')]['answer']();}return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](_0xcc1d('0x1b1'));};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x1b2')]=function(_0x238b3a){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0x1b3'),_0x238b3a[_0xcc1d('0x39')]));if(!this[_0xcc1d('0x90')](_0x238b3a[_0xcc1d('0x1b4')])){return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x238b3a,_0xcc1d('0x1b5'));}var _0x2021f0=this[_0xcc1d('0x17')]['sync'](this,_0x238b3a['project_id']);if(!this[_0xcc1d('0x90')](_0x2021f0)){return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x238b3a,util['format'](_0xcc1d('0x1b6'),_0x238b3a[_0xcc1d('0x1b4')]));}if(_0x2021f0===this[_0xcc1d('0x37')][_0xcc1d('0x3b')]){return this['channel'][_0xcc1d('0x59')](_0x238b3a,_0xcc1d('0x1b7'));}this[_0xcc1d('0x36')][_0xcc1d('0x7b')](this,_0x238b3a,_0x2021f0);var _0x33cbce=this['channel'][_0xcc1d('0x5e')]('AGI',util[_0xcc1d('0x2a')](_0xcc1d('0x1b8'),config['agi'][_0xcc1d('0x1b9')]||_0xcc1d('0x1ba'),_0x2021f0,this[_0xcc1d('0x37')][_0xcc1d('0x3b')]));if(_0x33cbce['result']===-0x1){return _0x33cbce;}return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0x16b'),_0xcc1d('0x1bb'),_0x2021f0));};AGIVertices['prototype'][_0xcc1d('0x1bc')]=function(_0x35c972){logger['info'](util[_0xcc1d('0x2a')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x35c972[_0xcc1d('0x39')]));var _0x51ec64=this[_0xcc1d('0x5d')][_0xcc1d('0x7b')](this,_0x35c972[_0xcc1d('0x1bd')]);this[_0xcc1d('0x36')][_0xcc1d('0x7b')](this,_0x35c972,_0x35c972[_0xcc1d('0x1bd')]);if(this[_0xcc1d('0x90')](_0x35c972[_0xcc1d('0xdb')])){var _0x582dd9=this[_0xcc1d('0x11')][_0xcc1d('0x7b')](this,_0x35c972[_0xcc1d('0xdb')]);if(_0x582dd9){this[_0xcc1d('0x37')][_0xcc1d('0xa7')](_0x582dd9,_0x51ec64);return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0x1be'),_0x35c972[_0xcc1d('0x1bd')],_0x582dd9));}}return this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x35c972[_0xcc1d('0x1bd')]));};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x1bf')]=function(_0x198945){logger[_0xcc1d('0x2e')](util['format'](_0xcc1d('0x1c0'),_0x198945[_0xcc1d('0x39')]));_0x198945['text']=_0x198945[_0xcc1d('0x63')][_0xcc1d('0x5f')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xcc1d('0x90')](_0x198945[_0xcc1d('0x61')])){return this[_0xcc1d('0x37')]['noop'](_0xcc1d('0x1c1'));}if(!this[_0xcc1d('0x90')](_0x198945['text'])){return this['channel'][_0xcc1d('0xb0')]('no\x20text\x20configured');}this[_0xcc1d('0x37')]['noop'](util['format'](_0xcc1d('0x1c2'),_0x198945['text']));var _0x3c2327=this[_0xcc1d('0x60')][_0xcc1d('0x7b')](this,_0x198945);if(_0x3c2327){this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x3c2327));var _0x18f9c0=this['channel'][_0xcc1d('0x153')](_0x3c2327);try{fs['unlink'](_0x3c2327+_0xcc1d('0x105'));}catch(_0x4510ba){logger[_0xcc1d('0x59')](_0x4510ba);}return _0x18f9c0;}return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x198945,_0xcc1d('0x1c3'));};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x1c4')]=function(_0x3c2aff){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0x1c5'),_0x3c2aff[_0xcc1d('0x39')]));_0x3c2aff[_0xcc1d('0x63')]=_0x3c2aff[_0xcc1d('0x63')][_0xcc1d('0x5f')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xcc1d('0x90')](_0x3c2aff[_0xcc1d('0x63')])){return this['channel'][_0xcc1d('0xb0')]('no\x20text\x20configured');}this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0x1c6'),_0x3c2aff['text']));var _0x1d60f8=this[_0xcc1d('0x69')][_0xcc1d('0x7b')](this,_0x3c2aff);if(_0x1d60f8){this['channel']['noop'](util[_0xcc1d('0x2a')](_0xcc1d('0x1c7'),_0x1d60f8));var _0x1d810e=this['channel']['streamFile'](_0x1d60f8);try{fs[_0xcc1d('0x126')](_0x1d60f8+_0xcc1d('0x105'));}catch(_0x392212){logger[_0xcc1d('0x59')](_0x392212);}return _0x1d810e;}return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x3c2aff,_0xcc1d('0x1c8'));};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x1c9')]=function(_0x154f15){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0x1ca'),_0x154f15[_0xcc1d('0x39')]));if(!this[_0xcc1d('0x90')](_0x154f15[_0xcc1d('0x156')])){return this['channel']['error'](_0x154f15,_0xcc1d('0x157'));}logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0x158'),this[_0xcc1d('0x37')][_0xcc1d('0x3c')],_0x154f15[_0xcc1d('0x156')]));var _0x499f7b=this[_0xcc1d('0x57')][_0xcc1d('0x7b')](this,_0x154f15[_0xcc1d('0x156')]);if(_0x499f7b){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0x159'),this['channel'][_0xcc1d('0x3c')],_0x154f15[_0xcc1d('0x156')]));this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0x159'),this[_0xcc1d('0x37')][_0xcc1d('0x3c')],_0x154f15['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xcc1d('0x2e')](util['format'](_0xcc1d('0x15b'),this[_0xcc1d('0x37')][_0xcc1d('0x3c')],_0x154f15['findBy']));this[_0xcc1d('0x37')][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0x15b'),this[_0xcc1d('0x37')][_0xcc1d('0x3c')],_0x154f15[_0xcc1d('0x156')]));return{'code':0xc8,'result':_0xcc1d('0x15c')};}};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x1cb')]=function(_0x5b5ae7){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x5b5ae7[_0xcc1d('0x39')]));var _0x29c504=this[_0xcc1d('0x37')][_0xcc1d('0x5e')](_0xcc1d('0x1cc'),[_0x5b5ae7[_0xcc1d('0x1cd')],_0x5b5ae7[_0xcc1d('0x83')]]);if(_0x29c504[_0xcc1d('0xac')]===-0x1){return _0x29c504;}return this['channel'][_0xcc1d('0xb0')](util[_0xcc1d('0x2a')](_0xcc1d('0x16b'),_0xcc1d('0x1cc'),_0x5b5ae7[_0xcc1d('0x1cd')]));};AGIVertices[_0xcc1d('0x10')][_0xcc1d('0x1ce')]=function(_0x16adf8){logger[_0xcc1d('0x2e')](util[_0xcc1d('0x2a')](_0xcc1d('0x1cf'),_0x16adf8[_0xcc1d('0x39')]));if(!this['isConfigured'](_0x16adf8[_0xcc1d('0xdb')])){return this[_0xcc1d('0x37')][_0xcc1d('0x59')](_0x16adf8,_0xcc1d('0x1ab'));}var _0x1566d2=this[_0xcc1d('0x11')]['sync'](this,_0x16adf8[_0xcc1d('0xdb')]);if(!_0x1566d2){return this[_0xcc1d('0x37')]['error'](_0x16adf8,_0xcc1d('0xdd'));}var _0x25b720=this[_0xcc1d('0x37')]['getVariable'](_0x1566d2);return{'code':0xc8,'result':_0x25b720[_0xcc1d('0xab')]?_0x25b720[_0xcc1d('0xab')]:'-'};};String['prototype'][_0xcc1d('0xaa')]=function(_0x4b9c33,_0x5b372b){return this[_0xcc1d('0xa8')](_0x4b9c33)[_0xcc1d('0x1d0')](_0x5b372b);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index d6ae304..f6b678f 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 _0x9957=['then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','message','isUndefined','[%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]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','getAgent'];(function(_0xbef5fb,_0xcf666e){var _0x250e92=function(_0xb5fb4e){while(--_0xb5fb4e){_0xbef5fb['push'](_0xbef5fb['shift']());}};_0x250e92(++_0xcf666e);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var util=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var ami=require(_0x7995('0x3'));var logger=require('../../../config/logger')(_0x7995('0x4'));var RpcUser=require(_0x7995('0x5'));var RpcVoiceAgentReport=require(_0x7995('0x6'));function Acw(_0x462a03){this['voiceQueues']=_0x462a03[_0x7995('0x7')];this[_0x7995('0x8')]=_0x462a03[_0x7995('0x8')];this[_0x7995('0x9')]=_0x462a03[_0x7995('0x9')];this[_0x7995('0xa')]={};ami['on']('agentconnect',this[_0x7995('0xb')][_0x7995('0xc')](this));ami['on']('hanguprequest',this[_0x7995('0xd')][_0x7995('0xc')](this));ami['on'](_0x7995('0xe'),this[_0x7995('0xf')][_0x7995('0xc')](this));ami['on'](_0x7995('0x10'),this[_0x7995('0x11')]['bind'](this));ami['on'](_0x7995('0x12'),this[_0x7995('0x13')]['bind'](this));ami['on'](_0x7995('0x14'),this[_0x7995('0x15')][_0x7995('0xc')](this));ami['on'](_0x7995('0x16'),this[_0x7995('0x17')][_0x7995('0xc')](this));}function getDiff(_0x2bbe7a){var _0x4cc004=moment()['milliseconds'](0x0);var _0x2b4e94=moment(_0x2bbe7a)[_0x7995('0x18')](0x0);return _0x4cc004[_0x7995('0x19')](_0x2b4e94,_0x7995('0x1a'));}Acw[_0x7995('0x1b')][_0x7995('0x1c')]=function(_0x2202ce){try{var _0x41cbf0=this;var _0x5377e5=this[_0x7995('0xa')][_0x2202ce]['interface'];var _0x2f832e=this[_0x7995('0xa')][_0x2202ce][_0x7995('0x1d')];var _0x291317=this[_0x7995('0x7')][_0x2f832e];var _0x37a7d4=![];var _0x4faa60='ACW';if(_0x291317[_0x7995('0x1e')]){if(_0x291317['mandatoryDispositionPause']['name']){_0x37a7d4=!![];_0x4faa60=_0x291317[_0x7995('0x1f')][_0x7995('0x20')];}}ami['Action']({'action':_0x7995('0x21'),'interface':_0x5377e5,'paused':!![],'reason':_0x4faa60})['then'](function(_0x4b1a8e){if(_0x41cbf0[_0x7995('0x8')][_0x5377e5]){return RpcUser[_0x7995('0x22')](_0x41cbf0[_0x7995('0x8')][_0x5377e5]['id'])[_0x7995('0x23')](function(_0x460924){if(_0x460924&&!_0x460924[_0x7995('0x24')]){logger['info'](_0x7995('0x25'),_0x2202ce,_0x5377e5,_0x2f832e);var _0x46ee4b=_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x26')]&&_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x27')]?_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x27')]:_0x2202ce;return RpcUser['savePause'](_0x41cbf0[_0x7995('0x8')][_0x5377e5],_0x4faa60,_0x46ee4b)[_0x7995('0x23')](function(_0x401dc3){if(!_0x37a7d4){_0x41cbf0[_0x7995('0x9')][_0x5377e5]={};logger[_0x7995('0x28')](_0x7995('0x29'),_0x2202ce,_0x41cbf0['voiceQueues'][_0x2f832e][_0x7995('0x2a')],_0x5377e5,_0x2f832e);_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2b')]=setTimeout(_0x41cbf0[_0x7995('0x2c')][_0x7995('0xc')](_0x41cbf0,_0x5377e5),_0x41cbf0[_0x7995('0x7')][_0x2f832e][_0x7995('0x2a')]*0x3e8);_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2d')]=moment()['format'](_0x7995('0x2e'));_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2f')]=_0x2202ce;_0x41cbf0['timers'][_0x5377e5]['queue']=_0x2f832e;_0x41cbf0['timers'][_0x5377e5][_0x7995('0x30')]=function(){var _0xe6b0b3=getDiff(_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2d')]);clearTimeout(_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2b')]);_0x41cbf0['timers'][_0x5377e5]['timer']=![];RpcVoiceAgentReport[_0x7995('0x31')]({'acwtime':_0xe6b0b3},_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2f')],_0x5377e5)[_0x7995('0x23')](function(_0x29fac5){logger[_0x7995('0x28')](_0x7995('0x32'),_0x2202ce,_0xe6b0b3,_0x29fac5);})['catch'](function(_0x44309d){logger[_0x7995('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x2202ce,_0x44309d);});delete _0x41cbf0['timers'][_0x5377e5];};}});}else{logger['info'](_0x7995('0x34'),_0x2202ce,_0x5377e5,_0x2f832e);}});}})[_0x7995('0x35')](function(_0x4a176f){logger[_0x7995('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2202ce,_0x41cbf0[_0x7995('0x7')][_0x2f832e][_0x7995('0x2a')],_0x5377e5,_0x2f832e);})[_0x7995('0x36')](function(){delete _0x41cbf0['channels'][_0x2202ce];});}catch(_0x52d76d){logger[_0x7995('0x33')]('[ACW][START]\x20%s',_0x52d76d['message']);}};Acw[_0x7995('0x1b')][_0x7995('0x2c')]=function(_0x5212ff){try{var _0x1baa15=this;if(_0x1baa15[_0x7995('0x9')][_0x5212ff]){_0x1baa15[_0x7995('0x9')][_0x5212ff][_0x7995('0x2b')]=![];var _0x1e3dbf=_0x1baa15['timers'][_0x5212ff][_0x7995('0x2f')];var _0x242713=_0x1baa15[_0x7995('0x9')][_0x5212ff][_0x7995('0x1d')];var _0x4b1541=_0x1baa15[_0x7995('0x7')][_0x242713][_0x7995('0x2a')];logger[_0x7995('0x28')](_0x7995('0x37'),_0x1e3dbf,_0x5212ff);RpcUser[_0x7995('0x38')](this[_0x7995('0x8')][_0x5212ff]);RpcVoiceAgentReport['update']({'acwtime':_0x4b1541,'agentacw':!![]},_0x1e3dbf,_0x5212ff)[_0x7995('0x23')](function(_0x3be298){logger[_0x7995('0x28')](_0x7995('0x32'),_0x1e3dbf,_0x4b1541,_0x3be298);})[_0x7995('0x35')](function(_0x298fc2){logger[_0x7995('0x33')](_0x7995('0x39'),_0x1e3dbf,_0x298fc2);});}else{logger[_0x7995('0x33')](_0x7995('0x3a'),_0x5212ff);if(_0x1baa15[_0x7995('0x9')]){logger[_0x7995('0x28')](_0x7995('0x3b'),JSON['stringify'](_0x1baa15['timers']));}}}catch(_0x334dff){logger[_0x7995('0x33')]('[ACW][STOP]\x20%s',_0x334dff['message']);}};Acw[_0x7995('0x1b')]['syncAgentConnect']=function(_0x504a33){try{if(this[_0x7995('0x7')][_0x504a33[_0x7995('0x1d')]]&&(this[_0x7995('0x7')][_0x504a33['queue']][_0x7995('0x4')]||this['voiceQueues'][_0x504a33[_0x7995('0x1d')]]['mandatoryDisposition'])){if(this['agents'][_0x504a33[_0x7995('0x3c')]]){this[_0x7995('0xa')][_0x504a33[_0x7995('0x2f')]]={'queue':_0x504a33[_0x7995('0x1d')],'interface':_0x504a33['interface'],'destlinkedid':_0x504a33[_0x7995('0x27')]};}}}catch(_0x40fc68){logger[_0x7995('0x33')](_0x7995('0x3d'),_0x40fc68['message']);}};Acw['prototype'][_0x7995('0x17')]=function(_0x55791b){try{if(this[_0x7995('0x7')][_0x55791b['queue']]&&(this[_0x7995('0x7')][_0x55791b['queue']][_0x7995('0x4')]||this[_0x7995('0x7')][_0x55791b['queue']][_0x7995('0x1e')])){if(this[_0x7995('0x8')][_0x55791b[_0x7995('0x3c')]]){this[_0x7995('0xa')][_0x55791b['uniqueid']]={'queue':_0x55791b[_0x7995('0x1d')],'interface':_0x55791b[_0x7995('0x3c')]};}}}catch(_0x237270){logger['error'](_0x7995('0x3e'),_0x237270[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0xd')]=function(_0x255313){try{if(this['channels'][_0x255313[_0x7995('0x2f')]]&&_[_0x7995('0x40')](this['channels'][_0x255313[_0x7995('0x2f')]]['attended'])){logger[_0x7995('0x28')](_0x7995('0x41'),_0x255313[_0x7995('0x2f')]);this[_0x7995('0x1c')](_0x255313[_0x7995('0x2f')]);}else if(this[_0x7995('0xa')][_0x255313[_0x7995('0x42')]]&&_['isUndefined'](this[_0x7995('0xa')][_0x255313[_0x7995('0x42')]][_0x7995('0x26')])){logger['info'](_0x7995('0x43'),_0x255313[_0x7995('0x42')]);this[_0x7995('0x1c')](_0x255313['linkedid']);}}catch(_0x4ec548){logger['error'](_0x7995('0x44'),_0x4ec548[_0x7995('0x3f')]);}};Acw['prototype'][_0x7995('0xf')]=function(_0x29f300){try{if(this[_0x7995('0xa')][_0x29f300[_0x7995('0x2f')]]&&this[_0x7995('0xa')][_0x29f300['uniqueid']][_0x7995('0x26')]){logger['info'](_0x7995('0x45'),_0x29f300[_0x7995('0x2f')]);this[_0x7995('0x1c')](_0x29f300['uniqueid']);}else if(this['channels'][_0x29f300['linkedid']]&&this['channels'][_0x29f300[_0x7995('0x42')]][_0x7995('0x26')]){logger[_0x7995('0x28')](_0x7995('0x46'),_0x29f300[_0x7995('0x42')]);this[_0x7995('0x1c')](_0x29f300[_0x7995('0x42')]);}}catch(_0xda6ce8){logger[_0x7995('0x33')](_0x7995('0x47'),_0xda6ce8[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0x13')]=function(_0x35bea3){try{if(!_[_0x7995('0x48')](this[_0x7995('0xa')][_0x35bea3[_0x7995('0x49')]])){this[_0x7995('0x1c')](_0x35bea3[_0x7995('0x49')]);if(this['channels'][_0x35bea3[_0x7995('0x4a')]]){this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]][_0x7995('0x26')]=!![];this['channels'][_0x35bea3['transfertargetuniqueid']]=this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]];delete this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]];}}else if(!_['isNil'](this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4b')]])){this[_0x7995('0x1c')](_0x35bea3[_0x7995('0x4b')]);if(this['channels'][_0x35bea3['origtransfereruniqueid']]){this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]][_0x7995('0x26')]=!![];this[_0x7995('0xa')][_0x35bea3[_0x7995('0x49')]]=this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]];delete this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]];}}}catch(_0x50caf5){logger[_0x7995('0x33')](_0x7995('0x4d'),_0x50caf5[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')]['syncBlindTransfer']=function(_0x51bf6a){try{if(this[_0x7995('0xa')][_0x51bf6a[_0x7995('0x4e')]]){logger['info'](_0x7995('0x4f'),JSON[_0x7995('0x50')](_0x51bf6a[_0x7995('0x4e')]));this[_0x7995('0x1c')](_0x51bf6a[_0x7995('0x4e')]);}else if(this['channels'][_0x51bf6a[_0x7995('0x51')]]){logger['info'](_0x7995('0x52'),JSON[_0x7995('0x50')](_0x51bf6a[_0x7995('0x51')]));this[_0x7995('0x1c')](_0x51bf6a[_0x7995('0x51')]);}}catch(_0xeb8920){logger[_0x7995('0x33')](_0x7995('0x53'),_0xeb8920[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0x11')]=function(_0x234d8d){try{if(this['voiceQueues'][_0x234d8d[_0x7995('0x1d')]]&&this[_0x7995('0x7')][_0x234d8d[_0x7995('0x1d')]][_0x7995('0x54')]===_0x7995('0x55')){if(this['agents'][_0x234d8d['interface']]){logger[_0x7995('0x28')](_0x7995('0x56'),_0x234d8d[_0x7995('0x2f')],_0x234d8d[_0x7995('0x3c')],_0x234d8d['queue']);return RpcUser[_0x7995('0x57')](this['agents'][_0x234d8d['interface']],_0x7995('0x58'),_0x234d8d[_0x7995('0x2f')]);}}}catch(_0x3f0a71){logger[_0x7995('0x33')](_0x7995('0x59'),_0x3f0a71[_0x7995('0x3f')]);}};module[_0x7995('0x5a')]=Acw; \ No newline at end of file +var _0x9957=['then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','message','isUndefined','[%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]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','getAgent'];(function(_0x50691d,_0x2814b8){var _0x2ad821=function(_0x4fa9a8){while(--_0x4fa9a8){_0x50691d['push'](_0x50691d['shift']());}};_0x2ad821(++_0x2814b8);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var ami=require(_0x7995('0x3'));var logger=require('../../../config/logger')(_0x7995('0x4'));var RpcUser=require(_0x7995('0x5'));var RpcVoiceAgentReport=require(_0x7995('0x6'));function Acw(_0x462a03){this['voiceQueues']=_0x462a03[_0x7995('0x7')];this[_0x7995('0x8')]=_0x462a03[_0x7995('0x8')];this[_0x7995('0x9')]=_0x462a03[_0x7995('0x9')];this[_0x7995('0xa')]={};ami['on']('agentconnect',this[_0x7995('0xb')][_0x7995('0xc')](this));ami['on']('hanguprequest',this[_0x7995('0xd')][_0x7995('0xc')](this));ami['on'](_0x7995('0xe'),this[_0x7995('0xf')][_0x7995('0xc')](this));ami['on'](_0x7995('0x10'),this[_0x7995('0x11')]['bind'](this));ami['on'](_0x7995('0x12'),this[_0x7995('0x13')]['bind'](this));ami['on'](_0x7995('0x14'),this[_0x7995('0x15')][_0x7995('0xc')](this));ami['on'](_0x7995('0x16'),this[_0x7995('0x17')][_0x7995('0xc')](this));}function getDiff(_0x2bbe7a){var _0x4cc004=moment()['milliseconds'](0x0);var _0x2b4e94=moment(_0x2bbe7a)[_0x7995('0x18')](0x0);return _0x4cc004[_0x7995('0x19')](_0x2b4e94,_0x7995('0x1a'));}Acw[_0x7995('0x1b')][_0x7995('0x1c')]=function(_0x2202ce){try{var _0x41cbf0=this;var _0x5377e5=this[_0x7995('0xa')][_0x2202ce]['interface'];var _0x2f832e=this[_0x7995('0xa')][_0x2202ce][_0x7995('0x1d')];var _0x291317=this[_0x7995('0x7')][_0x2f832e];var _0x37a7d4=![];var _0x4faa60='ACW';if(_0x291317[_0x7995('0x1e')]){if(_0x291317['mandatoryDispositionPause']['name']){_0x37a7d4=!![];_0x4faa60=_0x291317[_0x7995('0x1f')][_0x7995('0x20')];}}ami['Action']({'action':_0x7995('0x21'),'interface':_0x5377e5,'paused':!![],'reason':_0x4faa60})['then'](function(_0x4b1a8e){if(_0x41cbf0[_0x7995('0x8')][_0x5377e5]){return RpcUser[_0x7995('0x22')](_0x41cbf0[_0x7995('0x8')][_0x5377e5]['id'])[_0x7995('0x23')](function(_0x460924){if(_0x460924&&!_0x460924[_0x7995('0x24')]){logger['info'](_0x7995('0x25'),_0x2202ce,_0x5377e5,_0x2f832e);var _0x46ee4b=_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x26')]&&_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x27')]?_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x27')]:_0x2202ce;return RpcUser['savePause'](_0x41cbf0[_0x7995('0x8')][_0x5377e5],_0x4faa60,_0x46ee4b)[_0x7995('0x23')](function(_0x401dc3){if(!_0x37a7d4){_0x41cbf0[_0x7995('0x9')][_0x5377e5]={};logger[_0x7995('0x28')](_0x7995('0x29'),_0x2202ce,_0x41cbf0['voiceQueues'][_0x2f832e][_0x7995('0x2a')],_0x5377e5,_0x2f832e);_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2b')]=setTimeout(_0x41cbf0[_0x7995('0x2c')][_0x7995('0xc')](_0x41cbf0,_0x5377e5),_0x41cbf0[_0x7995('0x7')][_0x2f832e][_0x7995('0x2a')]*0x3e8);_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2d')]=moment()['format'](_0x7995('0x2e'));_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2f')]=_0x2202ce;_0x41cbf0['timers'][_0x5377e5]['queue']=_0x2f832e;_0x41cbf0['timers'][_0x5377e5][_0x7995('0x30')]=function(){var _0xe6b0b3=getDiff(_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2d')]);clearTimeout(_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2b')]);_0x41cbf0['timers'][_0x5377e5]['timer']=![];RpcVoiceAgentReport[_0x7995('0x31')]({'acwtime':_0xe6b0b3},_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2f')],_0x5377e5)[_0x7995('0x23')](function(_0x29fac5){logger[_0x7995('0x28')](_0x7995('0x32'),_0x2202ce,_0xe6b0b3,_0x29fac5);})['catch'](function(_0x44309d){logger[_0x7995('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x2202ce,_0x44309d);});delete _0x41cbf0['timers'][_0x5377e5];};}});}else{logger['info'](_0x7995('0x34'),_0x2202ce,_0x5377e5,_0x2f832e);}});}})[_0x7995('0x35')](function(_0x4a176f){logger[_0x7995('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2202ce,_0x41cbf0[_0x7995('0x7')][_0x2f832e][_0x7995('0x2a')],_0x5377e5,_0x2f832e);})[_0x7995('0x36')](function(){delete _0x41cbf0['channels'][_0x2202ce];});}catch(_0x52d76d){logger[_0x7995('0x33')]('[ACW][START]\x20%s',_0x52d76d['message']);}};Acw[_0x7995('0x1b')][_0x7995('0x2c')]=function(_0x5212ff){try{var _0x1baa15=this;if(_0x1baa15[_0x7995('0x9')][_0x5212ff]){_0x1baa15[_0x7995('0x9')][_0x5212ff][_0x7995('0x2b')]=![];var _0x1e3dbf=_0x1baa15['timers'][_0x5212ff][_0x7995('0x2f')];var _0x242713=_0x1baa15[_0x7995('0x9')][_0x5212ff][_0x7995('0x1d')];var _0x4b1541=_0x1baa15[_0x7995('0x7')][_0x242713][_0x7995('0x2a')];logger[_0x7995('0x28')](_0x7995('0x37'),_0x1e3dbf,_0x5212ff);RpcUser[_0x7995('0x38')](this[_0x7995('0x8')][_0x5212ff]);RpcVoiceAgentReport['update']({'acwtime':_0x4b1541,'agentacw':!![]},_0x1e3dbf,_0x5212ff)[_0x7995('0x23')](function(_0x3be298){logger[_0x7995('0x28')](_0x7995('0x32'),_0x1e3dbf,_0x4b1541,_0x3be298);})[_0x7995('0x35')](function(_0x298fc2){logger[_0x7995('0x33')](_0x7995('0x39'),_0x1e3dbf,_0x298fc2);});}else{logger[_0x7995('0x33')](_0x7995('0x3a'),_0x5212ff);if(_0x1baa15[_0x7995('0x9')]){logger[_0x7995('0x28')](_0x7995('0x3b'),JSON['stringify'](_0x1baa15['timers']));}}}catch(_0x334dff){logger[_0x7995('0x33')]('[ACW][STOP]\x20%s',_0x334dff['message']);}};Acw[_0x7995('0x1b')]['syncAgentConnect']=function(_0x504a33){try{if(this[_0x7995('0x7')][_0x504a33[_0x7995('0x1d')]]&&(this[_0x7995('0x7')][_0x504a33['queue']][_0x7995('0x4')]||this['voiceQueues'][_0x504a33[_0x7995('0x1d')]]['mandatoryDisposition'])){if(this['agents'][_0x504a33[_0x7995('0x3c')]]){this[_0x7995('0xa')][_0x504a33[_0x7995('0x2f')]]={'queue':_0x504a33[_0x7995('0x1d')],'interface':_0x504a33['interface'],'destlinkedid':_0x504a33[_0x7995('0x27')]};}}}catch(_0x40fc68){logger[_0x7995('0x33')](_0x7995('0x3d'),_0x40fc68['message']);}};Acw['prototype'][_0x7995('0x17')]=function(_0x55791b){try{if(this[_0x7995('0x7')][_0x55791b['queue']]&&(this[_0x7995('0x7')][_0x55791b['queue']][_0x7995('0x4')]||this[_0x7995('0x7')][_0x55791b['queue']][_0x7995('0x1e')])){if(this[_0x7995('0x8')][_0x55791b[_0x7995('0x3c')]]){this[_0x7995('0xa')][_0x55791b['uniqueid']]={'queue':_0x55791b[_0x7995('0x1d')],'interface':_0x55791b[_0x7995('0x3c')]};}}}catch(_0x237270){logger['error'](_0x7995('0x3e'),_0x237270[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0xd')]=function(_0x255313){try{if(this['channels'][_0x255313[_0x7995('0x2f')]]&&_[_0x7995('0x40')](this['channels'][_0x255313[_0x7995('0x2f')]]['attended'])){logger[_0x7995('0x28')](_0x7995('0x41'),_0x255313[_0x7995('0x2f')]);this[_0x7995('0x1c')](_0x255313[_0x7995('0x2f')]);}else if(this[_0x7995('0xa')][_0x255313[_0x7995('0x42')]]&&_['isUndefined'](this[_0x7995('0xa')][_0x255313[_0x7995('0x42')]][_0x7995('0x26')])){logger['info'](_0x7995('0x43'),_0x255313[_0x7995('0x42')]);this[_0x7995('0x1c')](_0x255313['linkedid']);}}catch(_0x4ec548){logger['error'](_0x7995('0x44'),_0x4ec548[_0x7995('0x3f')]);}};Acw['prototype'][_0x7995('0xf')]=function(_0x29f300){try{if(this[_0x7995('0xa')][_0x29f300[_0x7995('0x2f')]]&&this[_0x7995('0xa')][_0x29f300['uniqueid']][_0x7995('0x26')]){logger['info'](_0x7995('0x45'),_0x29f300[_0x7995('0x2f')]);this[_0x7995('0x1c')](_0x29f300['uniqueid']);}else if(this['channels'][_0x29f300['linkedid']]&&this['channels'][_0x29f300[_0x7995('0x42')]][_0x7995('0x26')]){logger[_0x7995('0x28')](_0x7995('0x46'),_0x29f300[_0x7995('0x42')]);this[_0x7995('0x1c')](_0x29f300[_0x7995('0x42')]);}}catch(_0xda6ce8){logger[_0x7995('0x33')](_0x7995('0x47'),_0xda6ce8[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0x13')]=function(_0x35bea3){try{if(!_[_0x7995('0x48')](this[_0x7995('0xa')][_0x35bea3[_0x7995('0x49')]])){this[_0x7995('0x1c')](_0x35bea3[_0x7995('0x49')]);if(this['channels'][_0x35bea3[_0x7995('0x4a')]]){this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]][_0x7995('0x26')]=!![];this['channels'][_0x35bea3['transfertargetuniqueid']]=this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]];delete this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]];}}else if(!_['isNil'](this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4b')]])){this[_0x7995('0x1c')](_0x35bea3[_0x7995('0x4b')]);if(this['channels'][_0x35bea3['origtransfereruniqueid']]){this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]][_0x7995('0x26')]=!![];this[_0x7995('0xa')][_0x35bea3[_0x7995('0x49')]]=this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]];delete this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]];}}}catch(_0x50caf5){logger[_0x7995('0x33')](_0x7995('0x4d'),_0x50caf5[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')]['syncBlindTransfer']=function(_0x51bf6a){try{if(this[_0x7995('0xa')][_0x51bf6a[_0x7995('0x4e')]]){logger['info'](_0x7995('0x4f'),JSON[_0x7995('0x50')](_0x51bf6a[_0x7995('0x4e')]));this[_0x7995('0x1c')](_0x51bf6a[_0x7995('0x4e')]);}else if(this['channels'][_0x51bf6a[_0x7995('0x51')]]){logger['info'](_0x7995('0x52'),JSON[_0x7995('0x50')](_0x51bf6a[_0x7995('0x51')]));this[_0x7995('0x1c')](_0x51bf6a[_0x7995('0x51')]);}}catch(_0xeb8920){logger[_0x7995('0x33')](_0x7995('0x53'),_0xeb8920[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0x11')]=function(_0x234d8d){try{if(this['voiceQueues'][_0x234d8d[_0x7995('0x1d')]]&&this[_0x7995('0x7')][_0x234d8d[_0x7995('0x1d')]][_0x7995('0x54')]===_0x7995('0x55')){if(this['agents'][_0x234d8d['interface']]){logger[_0x7995('0x28')](_0x7995('0x56'),_0x234d8d[_0x7995('0x2f')],_0x234d8d[_0x7995('0x3c')],_0x234d8d['queue']);return RpcUser[_0x7995('0x57')](this['agents'][_0x234d8d['interface']],_0x7995('0x58'),_0x234d8d[_0x7995('0x2f')]);}}}catch(_0x3f0a71){logger[_0x7995('0x33')](_0x7995('0x59'),_0x3f0a71[_0x7995('0x3f')]);}};module[_0x7995('0x5a')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 1084acc..f8a3a22 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 _0x08e1=['catch','log','exports','bluebird','util','lodash','../../config/logger','../../config/environment','asterisk','port','username','password','Action','action','error','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','format','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','info','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionCoreShowChannels'];(function(_0x4d6ac0,_0x201628){var _0x5296c4=function(_0x3d0b3d){while(--_0x3d0b3d){_0x4d6ac0['push'](_0x4d6ac0['shift']());}};_0x5296c4(++_0x201628);}(_0x08e1,0x161));var _0x108e=function(_0x2136d5,_0x4b0479){_0x2136d5=_0x2136d5-0x0;var _0x3bee2e=_0x08e1[_0x2136d5];return _0x3bee2e;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x108e('0x0'));var moment=require('moment');var util=require(_0x108e('0x1'));var _=require(_0x108e('0x2'));var logger=require(_0x108e('0x3'))('ami');var config=require(_0x108e('0x4'));var ami=new Manager(config[_0x108e('0x5')][_0x108e('0x6')],config['asterisk']['ip'],config[_0x108e('0x5')][_0x108e('0x7')],config['asterisk'][_0x108e('0x8')],!![]);ami['keepConnected']();ami[_0x108e('0x9')]=BPromise['promisify'](ami[_0x108e('0xa')]);function error(_0x31c721){logger[_0x108e('0xb')](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x108e('0x7')],config[_0x108e('0x5')]['ip'],config['asterisk'][_0x108e('0x6')],util[_0x108e('0xc')](_0x31c721,![],null)));}function close(){logger[_0x108e('0xb')](util['format'](_0x108e('0xd'),config[_0x108e('0x5')][_0x108e('0x7')],config[_0x108e('0x5')]['ip'],config['asterisk'][_0x108e('0x6')]));}ami[_0x108e('0xe')]=function(){return function(){return ami['Action']({'action':_0x108e('0xf')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x108e('0x9')]({'action':'devicestatelist'});};};ami[_0x108e('0x10')]=function(){return function(){return ami[_0x108e('0x9')]({'action':_0x108e('0x11')});};};ami[_0x108e('0x12')]=function(){return function(){return ami['Action']({'action':_0x108e('0x13')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x108e('0x9')]({'action':_0x108e('0x14')});};};function connect(_0x43d1c5){logger['info'](util[_0x108e('0x15')](_0x108e('0x16'),config[_0x108e('0x5')][_0x108e('0x7')],config[_0x108e('0x5')]['ip'],config[_0x108e('0x5')]['port']));ami[_0x108e('0x17')](_0x108e('0xb'),error);ami['once'](_0x108e('0x18'),close);}ami['on'](_0x108e('0x19'),connect);ami['on'](_0x108e('0x1a'),function(_0x336ab0){logger['info'](util[_0x108e('0x15')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x108e('0x5')][_0x108e('0x7')],config[_0x108e('0x5')]['ip'],config[_0x108e('0x5')][_0x108e('0x6')],util['inspect'](_0x336ab0,![],null)));});ami['on'](_0x108e('0x1b'),function(_0x449991){logger[_0x108e('0x1c')](util['format'](_0x108e('0x1d'),config[_0x108e('0x5')]['username'],config[_0x108e('0x5')]['ip'],config[_0x108e('0x5')]['port']));return BPromise['resolve']()[_0x108e('0x1e')](ami[_0x108e('0xe')]())['then'](ami['actionDeviceStateList']())[_0x108e('0x1e')](ami[_0x108e('0x10')]())[_0x108e('0x1e')](ami['actionQueueSummary']())[_0x108e('0x1e')](ami[_0x108e('0x1f')]())[_0x108e('0x20')](function(_0x5ed4a5){console[_0x108e('0x21')](_0x5ed4a5);});});ami[_0x108e('0x17')]('error',error);ami[_0x108e('0x17')]('close',close);module[_0x108e('0x22')]=ami; \ No newline at end of file +var _0xbd4b=['log','exports','asterisk-manager','bluebird','moment','../../config/logger','ami','../../config/environment','asterisk','port','username','password','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','error','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch'];(function(_0x2017ed,_0x602e41){var _0x35e12f=function(_0x154365){while(--_0x154365){_0x2017ed['push'](_0x2017ed['shift']());}};_0x35e12f(++_0x602e41);}(_0xbd4b,0x113));var _0xbbd4=function(_0x132e03,_0x2bf39c){_0x132e03=_0x132e03-0x0;var _0x44f948=_0xbd4b[_0x132e03];return _0x44f948;};'use strict';var Manager=require(_0xbbd4('0x0'));var BPromise=require(_0xbbd4('0x1'));var moment=require(_0xbbd4('0x2'));var util=require('util');var _=require('lodash');var logger=require(_0xbbd4('0x3'))(_0xbbd4('0x4'));var config=require(_0xbbd4('0x5'));var ami=new Manager(config[_0xbbd4('0x6')][_0xbbd4('0x7')],config[_0xbbd4('0x6')]['ip'],config[_0xbbd4('0x6')][_0xbbd4('0x8')],config[_0xbbd4('0x6')][_0xbbd4('0x9')],!![]);ami['keepConnected']();ami[_0xbbd4('0xa')]=BPromise[_0xbbd4('0xb')](ami[_0xbbd4('0xc')]);function error(_0x415afa){logger['error'](util[_0xbbd4('0xd')](_0xbbd4('0xe'),config[_0xbbd4('0x6')][_0xbbd4('0x8')],config[_0xbbd4('0x6')]['ip'],config[_0xbbd4('0x6')][_0xbbd4('0x7')],util[_0xbbd4('0xf')](_0x415afa,![],null)));}function close(){logger['error'](util[_0xbbd4('0xd')](_0xbbd4('0x10'),config[_0xbbd4('0x6')][_0xbbd4('0x8')],config[_0xbbd4('0x6')]['ip'],config[_0xbbd4('0x6')][_0xbbd4('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xbbd4('0xa')]({'action':_0xbbd4('0x11')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xbbd4('0xa')]({'action':_0xbbd4('0x12')});};};ami[_0xbbd4('0x13')]=function(){return function(){return ami[_0xbbd4('0xa')]({'action':_0xbbd4('0x14')});};};ami[_0xbbd4('0x15')]=function(){return function(){return ami[_0xbbd4('0xa')]({'action':_0xbbd4('0x16')});};};ami[_0xbbd4('0x17')]=function(){return function(){return ami[_0xbbd4('0xa')]({'action':_0xbbd4('0x18')});};};function connect(_0x1bff64){logger[_0xbbd4('0x19')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xbbd4('0x6')][_0xbbd4('0x8')],config['asterisk']['ip'],config['asterisk'][_0xbbd4('0x7')]));ami[_0xbbd4('0x1a')](_0xbbd4('0x1b'),error);ami[_0xbbd4('0x1a')](_0xbbd4('0x1c'),close);}ami['on']('connect',connect);ami['on'](_0xbbd4('0x1d'),function(_0x374e92){logger[_0xbbd4('0x19')](util[_0xbbd4('0xd')](_0xbbd4('0x1e'),config['asterisk'][_0xbbd4('0x8')],config[_0xbbd4('0x6')]['ip'],config[_0xbbd4('0x6')]['port'],util['inspect'](_0x374e92,![],null)));});ami['on'](_0xbbd4('0x1f'),function(_0xa57e8f){logger['info'](util[_0xbbd4('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0xbbd4('0x8')],config[_0xbbd4('0x6')]['ip'],config[_0xbbd4('0x6')]['port']));return BPromise[_0xbbd4('0x20')]()[_0xbbd4('0x21')](ami[_0xbbd4('0x22')]())[_0xbbd4('0x21')](ami[_0xbbd4('0x23')]())[_0xbbd4('0x21')](ami[_0xbbd4('0x13')]())[_0xbbd4('0x21')](ami['actionQueueSummary']())[_0xbbd4('0x21')](ami[_0xbbd4('0x17')]())[_0xbbd4('0x24')](function(_0x3ddee0){console[_0xbbd4('0x25')](_0x3ddee0);});});ami[_0xbbd4('0x1a')](_0xbbd4('0x1b'),error);ami['once']('close',close);module[_0xbbd4('0x26')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 28dc735..5d1359c 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 _0x53e5=['catch','exports','jayson/promise','bluebird','../../config/logger','ami','client','Request','request','debug','rpc','memberReport','error','message','result'];(function(_0x7315bd,_0x400822){var _0x5bac95=function(_0x55b360){while(--_0x55b360){_0x7315bd['push'](_0x7315bd['shift']());}};_0x5bac95(++_0x400822);}(_0x53e5,0x101));var _0x553e=function(_0x4a2666,_0x1a5433){_0x4a2666=_0x4a2666-0x0;var _0x14f962=_0x53e5[_0x4a2666];return _0x14f962;};'use strict';var jayson=require(_0x553e('0x0'));var BPromise=require(_0x553e('0x1'));var logger=require(_0x553e('0x2'))(_0x553e('0x3'));var client=jayson[_0x553e('0x4')]['http']({'port':0x2329});client[_0x553e('0x5')]=function(_0x24f6ee,_0x1c0511){return new BPromise(function(_0x21ad34,_0x5657ad){return client[_0x553e('0x6')](_0x24f6ee,_0x1c0511)['then'](function(_0x3f8650){logger[_0x553e('0x7')](_0x553e('0x8'),_0x553e('0x9'),_0x24f6ee,_0x1c0511,_0x3f8650);if(_0x3f8650['error']){logger['error']('rpc',_0x553e('0x9'),_0x24f6ee,_0x3f8650[_0x553e('0xa')][_0x553e('0xb')],_0x1c0511);return _0x5657ad(_0x3f8650[_0x553e('0xa')][_0x553e('0xb')]);}else{return _0x21ad34(_0x3f8650[_0x553e('0xc')]);}})[_0x553e('0xd')](function(_0x4c0f5a){logger[_0x553e('0xa')](_0x553e('0x8'),_0x553e('0x9'),_0x24f6ee,_0x4c0f5a,_0x1c0511);return _0x5657ad(_0x4c0f5a);});});};module[_0x553e('0xe')]=client; \ No newline at end of file +var _0x6e05=['Request','debug','rpc','memberReport','error','message','result','catch','jayson/promise','../../config/logger','ami','client','http'];(function(_0x378bb8,_0x10a669){var _0x27fba5=function(_0x24bb6e){while(--_0x24bb6e){_0x378bb8['push'](_0x378bb8['shift']());}};_0x27fba5(++_0x10a669);}(_0x6e05,0xb1));var _0x56e0=function(_0x4dbdda,_0x11f07c){_0x4dbdda=_0x4dbdda-0x0;var _0x1acbf1=_0x6e05[_0x4dbdda];return _0x1acbf1;};'use strict';var jayson=require(_0x56e0('0x0'));var BPromise=require('bluebird');var logger=require(_0x56e0('0x1'))(_0x56e0('0x2'));var client=jayson[_0x56e0('0x3')][_0x56e0('0x4')]({'port':0x2329});client[_0x56e0('0x5')]=function(_0x3623c2,_0x3cb576){return new BPromise(function(_0x328bbd,_0x49ed3a){return client['request'](_0x3623c2,_0x3cb576)['then'](function(_0x1ed9bc){logger[_0x56e0('0x6')](_0x56e0('0x7'),_0x56e0('0x8'),_0x3623c2,_0x3cb576,_0x1ed9bc);if(_0x1ed9bc[_0x56e0('0x9')]){logger[_0x56e0('0x9')](_0x56e0('0x7'),_0x56e0('0x8'),_0x3623c2,_0x1ed9bc['error'][_0x56e0('0xa')],_0x3cb576);return _0x49ed3a(_0x1ed9bc[_0x56e0('0x9')][_0x56e0('0xa')]);}else{return _0x328bbd(_0x1ed9bc[_0x56e0('0xb')]);}})[_0x56e0('0xc')](function(_0x2d6f08){logger[_0x56e0('0x9')](_0x56e0('0x7'),_0x56e0('0x8'),_0x3623c2,_0x2d6f08,_0x3cb576);return _0x49ed3a(_0x2d6f08);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index edc84e2..8ce9292 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 _0xbc68=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','number','getQueue','queue','exports','string','voiceQueue','uniqueid','name','phone','Contact','firstName','lastName','active','type','dialQueueTimeout','scheduledat','countbusyretry'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xbc68,0x18d));var _0x8bc6=function(_0x4a964a,_0x2c7e8f){_0x4a964a=_0x4a964a-0x0;var _0x45b531=_0xbc68[_0x4a964a];return _0x45b531;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x262264,_0x1b7607,_0x424d3b){var _0x3a04df='';if(!_['isNil'](_0x1b7607)&&_0x8bc6('0x0')===typeof _0x1b7607){_0x3a04df+=_0x1b7607;}if(!_['isNil'](_0x424d3b)&&_0x8bc6('0x0')===typeof _0x424d3b){_0x3a04df+='\x20'+_0x424d3b;}if(_0x3a04df!==''){return _0x3a04df;}return _0x262264;}function Action(_0x2d2cba,_0x3cf49a,_0x5449ff){this[_0x8bc6('0x1')]=_0x2d2cba;this[_0x8bc6('0x2')]=_0x5449ff||undefined;this[_0x8bc6('0x3')]=checkNameSurname(_0x3cf49a['Contact'][_0x8bc6('0x4')],_0x3cf49a[_0x8bc6('0x5')][_0x8bc6('0x6')],_0x3cf49a['Contact'][_0x8bc6('0x7')]);this['number']=_0x3cf49a['phone'];this['queue']=_0x2d2cba['name'];this[_0x8bc6('0x8')]=_0x3cf49a['active']||![];this[_0x8bc6('0x9')]=_0x2d2cba['type'];this[_0x8bc6('0xa')]=_0x2d2cba[_0x8bc6('0xa')]||0x3;this[_0x8bc6('0xb')]=_0x3cf49a[_0x8bc6('0xb')];this[_0x8bc6('0xc')]=_0x3cf49a[_0x8bc6('0xc')];this[_0x8bc6('0xd')]=_0x3cf49a[_0x8bc6('0xd')];this[_0x8bc6('0xe')]=_0x3cf49a[_0x8bc6('0xe')];this[_0x8bc6('0xf')]=_0x3cf49a[_0x8bc6('0xf')];this[_0x8bc6('0x10')]=_0x3cf49a['countdropretry'];this[_0x8bc6('0x11')]=_0x3cf49a['countabandonedretry'];this[_0x8bc6('0x12')]=_0x3cf49a[_0x8bc6('0x12')];this[_0x8bc6('0x13')]=_0x3cf49a[_0x8bc6('0x13')];this[_0x8bc6('0x14')]=_0x3cf49a[_0x8bc6('0x14')];this['ListId']=_0x3cf49a['ListId'];this[_0x8bc6('0x15')]=_0x3cf49a[_0x8bc6('0x15')];this['VoiceQueueId']=_0x3cf49a[_0x8bc6('0x16')];this[_0x8bc6('0x17')]=_0x3cf49a['CampaignId'];this[_0x8bc6('0x18')]=_0x3cf49a['id'];this['ContactFirstName']=_0x3cf49a[_0x8bc6('0x5')][_0x8bc6('0x6')]||'';this[_0x8bc6('0x19')]=moment()[_0x8bc6('0x1a')](_0x8bc6('0x1b'));this['callback']=_0x3cf49a['callback'];this['callbackuniqueid']=_0x3cf49a[_0x8bc6('0x1c')];this[_0x8bc6('0x1d')]=_0x3cf49a['callbackat'];this['recallme']=_0x3cf49a[_0x8bc6('0x1e')];this[_0x8bc6('0x1f')]='';this[_0x8bc6('0x20')]='';}Action[_0x8bc6('0x21')][_0x8bc6('0x22')]=function(){return util[_0x8bc6('0x1a')](_0x8bc6('0x23'),this[_0x8bc6('0x3')],this['voiceQueue'][_0x8bc6('0x24')]>0x0?this[_0x8bc6('0x25')]['substring'](this[_0x8bc6('0x1')][_0x8bc6('0x24')]):this[_0x8bc6('0x25')]);};Action[_0x8bc6('0x21')][_0x8bc6('0x26')]=function(){return this[_0x8bc6('0x27')];};module[_0x8bc6('0x28')]=Action; \ No newline at end of file +var _0xbc2b=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','number','getQueue','exports','moment','isNil','string','voiceQueue','uniqueid','name','Contact','lastName','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x401381,_0x66b5d4){var _0x4a8fac=function(_0x5c45d8){while(--_0x5c45d8){_0x401381['push'](_0x401381['shift']());}};_0x4a8fac(++_0x66b5d4);}(_0xbc2b,0x1ba));var _0xbbc2=function(_0x525c42,_0x486cc5){_0x525c42=_0x525c42-0x0;var _0x2c2999=_0xbc2b[_0x525c42];return _0x2c2999;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xbbc2('0x0'));function checkNameSurname(_0x426de6,_0x5360cc,_0x5d48a6){var _0x160279='';if(!_[_0xbbc2('0x1')](_0x5360cc)&&_0xbbc2('0x2')===typeof _0x5360cc){_0x160279+=_0x5360cc;}if(!_[_0xbbc2('0x1')](_0x5d48a6)&&_0xbbc2('0x2')===typeof _0x5d48a6){_0x160279+='\x20'+_0x5d48a6;}if(_0x160279!==''){return _0x160279;}return _0x426de6;}function Action(_0x61b6e,_0x5f3a6c,_0x10dbec){this[_0xbbc2('0x3')]=_0x61b6e;this[_0xbbc2('0x4')]=_0x10dbec||undefined;this[_0xbbc2('0x5')]=checkNameSurname(_0x5f3a6c[_0xbbc2('0x6')]['phone'],_0x5f3a6c['Contact']['firstName'],_0x5f3a6c[_0xbbc2('0x6')][_0xbbc2('0x7')]);this['number']=_0x5f3a6c[_0xbbc2('0x8')];this[_0xbbc2('0x9')]=_0x61b6e[_0xbbc2('0x5')];this[_0xbbc2('0xa')]=_0x5f3a6c[_0xbbc2('0xa')]||![];this['type']=_0x61b6e[_0xbbc2('0xb')];this[_0xbbc2('0xc')]=_0x61b6e['dialQueueTimeout']||0x3;this[_0xbbc2('0xd')]=_0x5f3a6c[_0xbbc2('0xd')];this[_0xbbc2('0xe')]=_0x5f3a6c['countbusyretry'];this[_0xbbc2('0xf')]=_0x5f3a6c['countcongestionretry'];this['countnoanswerretry']=_0x5f3a6c[_0xbbc2('0x10')];this[_0xbbc2('0x11')]=_0x5f3a6c[_0xbbc2('0x11')];this[_0xbbc2('0x12')]=_0x5f3a6c[_0xbbc2('0x12')];this[_0xbbc2('0x13')]=_0x5f3a6c['countabandonedretry'];this[_0xbbc2('0x14')]=_0x5f3a6c['countmachineretry'];this[_0xbbc2('0x15')]=_0x5f3a6c[_0xbbc2('0x15')];this[_0xbbc2('0x16')]=_0x5f3a6c[_0xbbc2('0x16')];this[_0xbbc2('0x17')]=_0x5f3a6c[_0xbbc2('0x17')];this[_0xbbc2('0x18')]=_0x5f3a6c['UserId'];this[_0xbbc2('0x19')]=_0x5f3a6c[_0xbbc2('0x19')];this[_0xbbc2('0x1a')]=_0x5f3a6c[_0xbbc2('0x1a')];this[_0xbbc2('0x1b')]=_0x5f3a6c['id'];this['ContactFirstName']=_0x5f3a6c[_0xbbc2('0x6')][_0xbbc2('0x1c')]||'';this[_0xbbc2('0x1d')]=moment()[_0xbbc2('0x1e')](_0xbbc2('0x1f'));this[_0xbbc2('0x20')]=_0x5f3a6c[_0xbbc2('0x20')];this[_0xbbc2('0x21')]=_0x5f3a6c[_0xbbc2('0x21')];this[_0xbbc2('0x22')]=_0x5f3a6c[_0xbbc2('0x22')];this[_0xbbc2('0x23')]=_0x5f3a6c[_0xbbc2('0x23')];this[_0xbbc2('0x24')]='';this[_0xbbc2('0x25')]='';}Action[_0xbbc2('0x26')][_0xbbc2('0x27')]=function(){return util[_0xbbc2('0x1e')](_0xbbc2('0x28'),this[_0xbbc2('0x5')],this[_0xbbc2('0x3')][_0xbbc2('0x29')]>0x0?this['number'][_0xbbc2('0x2a')](this['voiceQueue']['dialCutDigit']):this[_0xbbc2('0x2b')]);};Action[_0xbbc2('0x26')][_0xbbc2('0x2c')]=function(){return this['queue'];};module[_0xbbc2('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 1fe55fe..6649353 100644 --- a/server/services/ami/dialer/additionalPhone.js +++ b/server/services/ami/dialer/additionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c60=['number','starttime','responsetime','endtime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','moment','milliseconds','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','name','calleridnum'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x9c60,0x164));var _0x09c6=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9c60[_0x1ac595];return _0x455fff;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x09c6('0x0'));function getSeconds(_0x582703,_0x451848){var _0x1d549c=moment(_0x582703)['milliseconds'](0x0);var _0xdaec6e=moment(_0x451848)[_0x09c6('0x1')](0x0);return _0x1d549c['diff'](_0xdaec6e,'seconds');}function AdditionalPhone(_0x317407){this['uniqueid']=_0x317407['uniqueid'];this[_0x09c6('0x2')]=_0x317407['scheduledat']||undefined;this[_0x09c6('0x3')]=_0x317407[_0x09c6('0x3')];this[_0x09c6('0x4')]=_0x317407[_0x09c6('0x3')]==='outbound'?'queue':_0x317407['type'];this[_0x09c6('0x5')]=_0x317407[_0x09c6('0x5')];this[_0x09c6('0x6')]=_0x317407[_0x09c6('0x6')];this[_0x09c6('0x7')]=_0x317407[_0x09c6('0x7')];this['countglobal']=_0x317407['countbusyretry']+_0x317407[_0x09c6('0x6')]+_0x317407[_0x09c6('0x7')]+_0x317407[_0x09c6('0x8')]+_0x317407['countdropretry']+_0x317407[_0x09c6('0x9')]+_0x317407[_0x09c6('0xa')]+_0x317407[_0x09c6('0xb')];this[_0x09c6('0x8')]=_0x317407['countnosuchnumberretry'];this[_0x09c6('0xc')]=_0x317407[_0x09c6('0xc')];this[_0x09c6('0x9')]=_0x317407[_0x09c6('0x9')];this[_0x09c6('0xa')]=_0x317407['countmachineretry'];this[_0x09c6('0xb')]=_0x317407[_0x09c6('0xb')];this[_0x09c6('0xd')]=_0x317407[_0x09c6('0xd')];this['calleridname']=_0x317407[_0x09c6('0xe')];this[_0x09c6('0xf')]=_0x317407[_0x09c6('0x10')];this[_0x09c6('0x11')]=_0x317407[_0x09c6('0x11')];this[_0x09c6('0x12')]=_0x317407[_0x09c6('0x12')];this[_0x09c6('0x13')]=_0x317407[_0x09c6('0x12')];this[_0x09c6('0x14')]=getSeconds(_0x317407[_0x09c6('0x12')],_0x317407[_0x09c6('0x11')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0x09c6('0x15')]=_0x317407['callback'];this[_0x09c6('0x16')]=_0x317407[_0x09c6('0x16')];this[_0x09c6('0x17')]=_0x317407[_0x09c6('0x17')];this[_0x09c6('0x18')]=_0x317407[_0x09c6('0x18')];this[_0x09c6('0x19')]=_0x317407[_0x09c6('0x19')];this['ListId']=_0x317407['ListId'];this[_0x09c6('0x1a')]=_0x317407['UserId'];this['VoiceQueueId']=_0x317407[_0x09c6('0x1b')];this[_0x09c6('0x1c')]=_0x317407[_0x09c6('0x1c')];this['originatecalleridnum']=_0x317407['originatecalleridnum']||'';this[_0x09c6('0x1d')]=_0x317407['originatecalleridname']||'';}module[_0x09c6('0x1e')]=History; \ No newline at end of file +var _0x11f1=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','number','starttime','responsetime','ringtime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x349915,_0x124261){var _0x8be4f3=function(_0x3a82a9){while(--_0x3a82a9){_0x349915['push'](_0x349915['shift']());}};_0x8be4f3(++_0x124261);}(_0x11f1,0x84));var _0x111f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x11f1[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x111f('0x0'));var _=require(_0x111f('0x1'));var moment=require(_0x111f('0x2'));function getSeconds(_0xf04fb5,_0x51b0b7){var _0x20b5d3=moment(_0xf04fb5)['milliseconds'](0x0);var _0x21a812=moment(_0x51b0b7)[_0x111f('0x3')](0x0);return _0x20b5d3[_0x111f('0x4')](_0x21a812,_0x111f('0x5'));}function AdditionalPhone(_0x5a553e){this[_0x111f('0x6')]=_0x5a553e[_0x111f('0x6')];this[_0x111f('0x7')]=_0x5a553e[_0x111f('0x7')]||undefined;this['type']=_0x5a553e[_0x111f('0x8')];this[_0x111f('0x9')]=_0x5a553e[_0x111f('0x8')]===_0x111f('0xa')?_0x111f('0xb'):_0x5a553e[_0x111f('0x8')];this['countbusyretry']=_0x5a553e[_0x111f('0xc')];this[_0x111f('0xd')]=_0x5a553e['countcongestionretry'];this[_0x111f('0xe')]=_0x5a553e[_0x111f('0xe')];this['countglobal']=_0x5a553e[_0x111f('0xc')]+_0x5a553e[_0x111f('0xd')]+_0x5a553e[_0x111f('0xe')]+_0x5a553e[_0x111f('0xf')]+_0x5a553e[_0x111f('0x10')]+_0x5a553e[_0x111f('0x11')]+_0x5a553e[_0x111f('0x12')]+_0x5a553e[_0x111f('0x13')];this[_0x111f('0xf')]=_0x5a553e[_0x111f('0xf')];this[_0x111f('0x10')]=_0x5a553e[_0x111f('0x10')];this[_0x111f('0x11')]=_0x5a553e['countabandonedretry'];this[_0x111f('0x12')]=_0x5a553e[_0x111f('0x12')];this[_0x111f('0x13')]=_0x5a553e['countagentrejectretry'];this[_0x111f('0xb')]=_0x5a553e['queue'];this['calleridname']=_0x5a553e[_0x111f('0x14')];this[_0x111f('0x15')]=_0x5a553e[_0x111f('0x16')];this['starttime']=_0x5a553e[_0x111f('0x17')];this[_0x111f('0x18')]=_0x5a553e[_0x111f('0x18')];this['endtime']=_0x5a553e['responsetime'];this[_0x111f('0x19')]=getSeconds(_0x5a553e[_0x111f('0x18')],_0x5a553e[_0x111f('0x17')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0x111f('0x1a')]=_0x5a553e[_0x111f('0x1a')];this[_0x111f('0x1b')]=_0x5a553e[_0x111f('0x1b')];this[_0x111f('0x1c')]=_0x5a553e[_0x111f('0x1c')];this['recallme']=_0x5a553e['recallme'];this[_0x111f('0x1d')]=_0x5a553e[_0x111f('0x1d')];this[_0x111f('0x1e')]=_0x5a553e['ListId'];this[_0x111f('0x1f')]=_0x5a553e[_0x111f('0x1f')];this[_0x111f('0x20')]=_0x5a553e['VoiceQueueId'];this['CampaignId']=_0x5a553e[_0x111f('0x21')];this[_0x111f('0x22')]=_0x5a553e[_0x111f('0x22')]||'';this[_0x111f('0x23')]=_0x5a553e[_0x111f('0x23')]||'';}module[_0x111f('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index b6a2adf..d7c1c53 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 _0x6dfc=['talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','format','ringtime','holdtime'];(function(_0x17a9a2,_0x1faea1){var _0xe98375=function(_0x46962e){while(--_0x46962e){_0x17a9a2['push'](_0x17a9a2['shift']());}};_0xe98375(++_0x1faea1);}(_0x6dfc,0x6d));var _0xc6df=function(_0x459b96,_0x2c6314){_0x459b96=_0x459b96-0x0;var _0x2393b6=_0x6dfc[_0x459b96];return _0x2393b6;};'use strict';var util=require(_0xc6df('0x0'));var _=require(_0xc6df('0x1'));var moment=require('moment');function getSeconds(_0x51b8a0,_0x29ce93){var _0x144aa5=moment(_0x51b8a0)[_0xc6df('0x2')](0x0);var _0x45aae1=moment(_0x29ce93)[_0xc6df('0x2')](0x0);return _0x144aa5[_0xc6df('0x3')](_0x45aae1,_0xc6df('0x4'));}function AgentComplete(_0x327356,_0x149050){this[_0xc6df('0x5')]=0x4;this[_0xc6df('0x6')]=_0xc6df('0x7');this[_0xc6df('0x8')]=_0x327356[_0xc6df('0x8')];this[_0xc6df('0x9')]=_0x327356[_0xc6df('0x9')];this['campaigntype']=_0x327356[_0xc6df('0x9')]===_0xc6df('0xa')?_0xc6df('0xb'):_0x327356['type'];this[_0xc6df('0xc')]=_0x327356[_0xc6df('0xc')];this[_0xc6df('0xd')]=_0x327356[_0xc6df('0xd')];this[_0xc6df('0xe')]=_0x327356[_0xc6df('0xe')];this[_0xc6df('0xf')]=_0x327356['countbusyretry']+_0x327356[_0xc6df('0xd')]+_0x327356['countnoanswerretry']+_0x327356['countnosuchnumberretry']+_0x327356[_0xc6df('0x10')]+_0x327356[_0xc6df('0x11')]+_0x327356[_0xc6df('0x12')]+_0x327356['countagentrejectretry'];this[_0xc6df('0x13')]=_0x327356[_0xc6df('0x13')];this[_0xc6df('0x10')]=_0x327356[_0xc6df('0x10')];this['countabandonedretry']=_0x327356[_0xc6df('0x11')];this[_0xc6df('0x12')]=_0x327356[_0xc6df('0x12')];this[_0xc6df('0x14')]=_0x327356[_0xc6df('0x14')];this[_0xc6df('0x15')]=_0x149050[_0xc6df('0x15')];this[_0xc6df('0x16')]=_0x327356[_0xc6df('0x17')];this[_0xc6df('0x18')]=_0x327356['number'];this['starttime']=_0x327356[_0xc6df('0x19')];this['responsetime']=_0x327356[_0xc6df('0x1a')];this[_0xc6df('0x1b')]=_0x327356[_0xc6df('0x1b')];this[_0xc6df('0x1c')]=moment()[_0xc6df('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc6df('0x1e')]=getSeconds(_0x327356[_0xc6df('0x1a')],_0x327356[_0xc6df('0x19')]);this[_0xc6df('0x1f')]=getSeconds(_0x327356['answertime'],_0x327356['responsetime']);this[_0xc6df('0x20')]=getSeconds(this[_0xc6df('0x1c')],_0x327356[_0xc6df('0x1b')]);this[_0xc6df('0xb')]=_0x149050['queue'];this[_0xc6df('0x21')]=_0x149050[_0xc6df('0x21')];this[_0xc6df('0x22')]=_0x149050[_0xc6df('0x22')];this['callback']=_0x327356[_0xc6df('0x23')];this[_0xc6df('0x24')]=_0x327356['callbackuniqueid'];this[_0xc6df('0x25')]=_0x327356[_0xc6df('0x25')];this[_0xc6df('0x26')]=_0x327356[_0xc6df('0x26')];this[_0xc6df('0x27')]=_0x327356[_0xc6df('0x27')];this['ListId']=_0x327356[_0xc6df('0x28')];this['UserId']=_0x327356[_0xc6df('0x29')];this[_0xc6df('0x2a')]=_0x327356[_0xc6df('0x2a')];this[_0xc6df('0x2b')]=_0x327356['CampaignId'];this[_0xc6df('0x2c')]=_0x327356[_0xc6df('0x2c')]||'';this[_0xc6df('0x2d')]=_0x327356[_0xc6df('0x2d')]||'';}module[_0xc6df('0x2e')]=AgentComplete; \ No newline at end of file +var _0xa5dd=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','state','statedesc','Answer','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId'];(function(_0x15b491,_0x312e92){var _0x22bb5f=function(_0x2e5124){while(--_0x2e5124){_0x15b491['push'](_0x15b491['shift']());}};_0x22bb5f(++_0x312e92);}(_0xa5dd,0x1d2));var _0xda5d=function(_0x2a1368,_0x97712c){_0x2a1368=_0x2a1368-0x0;var _0x4df067=_0xa5dd[_0x2a1368];return _0x4df067;};'use strict';var util=require(_0xda5d('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x4cd181,_0x540636){var _0x428063=moment(_0x4cd181)[_0xda5d('0x1')](0x0);var _0x2a7bf0=moment(_0x540636)[_0xda5d('0x1')](0x0);return _0x428063['diff'](_0x2a7bf0,'seconds');}function AgentComplete(_0xf204fc,_0x631802){this[_0xda5d('0x2')]=0x4;this[_0xda5d('0x3')]=_0xda5d('0x4');this['scheduledat']=_0xf204fc['scheduledat'];this['type']=_0xf204fc[_0xda5d('0x5')];this[_0xda5d('0x6')]=_0xf204fc[_0xda5d('0x5')]===_0xda5d('0x7')?_0xda5d('0x8'):_0xf204fc[_0xda5d('0x5')];this[_0xda5d('0x9')]=_0xf204fc[_0xda5d('0x9')];this['countcongestionretry']=_0xf204fc[_0xda5d('0xa')];this['countnoanswerretry']=_0xf204fc[_0xda5d('0xb')];this[_0xda5d('0xc')]=_0xf204fc['countbusyretry']+_0xf204fc[_0xda5d('0xa')]+_0xf204fc[_0xda5d('0xb')]+_0xf204fc[_0xda5d('0xd')]+_0xf204fc[_0xda5d('0xe')]+_0xf204fc[_0xda5d('0xf')]+_0xf204fc[_0xda5d('0x10')]+_0xf204fc[_0xda5d('0x11')];this[_0xda5d('0xd')]=_0xf204fc[_0xda5d('0xd')];this['countdropretry']=_0xf204fc[_0xda5d('0xe')];this[_0xda5d('0xf')]=_0xf204fc[_0xda5d('0xf')];this['countmachineretry']=_0xf204fc[_0xda5d('0x10')];this[_0xda5d('0x11')]=_0xf204fc['countagentrejectretry'];this[_0xda5d('0x12')]=_0x631802[_0xda5d('0x12')];this[_0xda5d('0x13')]=_0xf204fc[_0xda5d('0x14')];this[_0xda5d('0x15')]=_0xf204fc[_0xda5d('0x16')];this[_0xda5d('0x17')]=_0xf204fc['starttime'];this[_0xda5d('0x18')]=_0xf204fc[_0xda5d('0x18')];this[_0xda5d('0x19')]=_0xf204fc[_0xda5d('0x19')];this[_0xda5d('0x1a')]=moment()['format'](_0xda5d('0x1b'));this['ringtime']=getSeconds(_0xf204fc[_0xda5d('0x18')],_0xf204fc['starttime']);this[_0xda5d('0x1c')]=getSeconds(_0xf204fc[_0xda5d('0x19')],_0xf204fc[_0xda5d('0x18')]);this['talktime']=getSeconds(this[_0xda5d('0x1a')],_0xf204fc[_0xda5d('0x19')]);this[_0xda5d('0x8')]=_0x631802[_0xda5d('0x8')];this[_0xda5d('0x1d')]=_0x631802['membername'];this[_0xda5d('0x1e')]=_0x631802[_0xda5d('0x1e')];this[_0xda5d('0x1f')]=_0xf204fc[_0xda5d('0x1f')];this[_0xda5d('0x20')]=_0xf204fc['callbackuniqueid'];this['callbackat']=_0xf204fc[_0xda5d('0x21')];this[_0xda5d('0x22')]=_0xf204fc[_0xda5d('0x22')];this[_0xda5d('0x23')]=_0xf204fc['ContactId'];this[_0xda5d('0x24')]=_0xf204fc['ListId'];this['UserId']=_0xf204fc['UserId'];this['VoiceQueueId']=_0xf204fc[_0xda5d('0x25')];this[_0xda5d('0x26')]=_0xf204fc[_0xda5d('0x26')];this[_0xda5d('0x27')]=_0xf204fc['originatecalleridnum']||'';this['originatecalleridname']=_0xf204fc[_0xda5d('0x28')]||'';}module[_0xda5d('0x29')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index a2fec8b..8abe8f6 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 _0x5f07=['queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5f07,0x96));var _0x75f0=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x5f07[_0x1abb09];return _0xea1c07;};'use strict';var util=require(_0x75f0('0x0'));var _=require(_0x75f0('0x1'));var moment=require(_0x75f0('0x2'));function getSeconds(_0x38bdd9,_0x5ee2da){var _0x4e2ff5=moment(_0x38bdd9)[_0x75f0('0x3')](0x0);var _0x24487d=moment(_0x5ee2da)['milliseconds'](0x0);return _0x4e2ff5[_0x75f0('0x4')](_0x24487d,'seconds');}function Final(_0x4cc4af){this[_0x75f0('0x5')]=_0x4cc4af[_0x75f0('0x5')];this[_0x75f0('0x6')]=_0x4cc4af[_0x75f0('0x6')];this[_0x75f0('0x7')]=_0x4cc4af[_0x75f0('0x7')];this[_0x75f0('0x8')]=_0x4cc4af[_0x75f0('0x7')]===_0x75f0('0x9')?_0x75f0('0xa'):_0x4cc4af[_0x75f0('0x7')];this['countbusyretry']=_0x4cc4af[_0x75f0('0xb')];this[_0x75f0('0xc')]=_0x4cc4af[_0x75f0('0xc')];this['countnoanswerretry']=_0x4cc4af['countnoanswerretry'];this[_0x75f0('0xd')]=_0x4cc4af[_0x75f0('0xb')]+_0x4cc4af[_0x75f0('0xc')]+_0x4cc4af[_0x75f0('0xe')]+_0x4cc4af['countnosuchnumberretry']+_0x4cc4af[_0x75f0('0xf')]+_0x4cc4af['countabandonedretry']+_0x4cc4af[_0x75f0('0x10')]+_0x4cc4af[_0x75f0('0x11')];this['countnosuchnumberretry']=_0x4cc4af[_0x75f0('0x12')];this[_0x75f0('0xf')]=_0x4cc4af['countdropretry'];this[_0x75f0('0x13')]=_0x4cc4af[_0x75f0('0x13')];this[_0x75f0('0x10')]=_0x4cc4af[_0x75f0('0x10')];this['countagentrejectretry']=_0x4cc4af[_0x75f0('0x11')];this[_0x75f0('0xa')]=_0x4cc4af[_0x75f0('0xa')];this[_0x75f0('0x14')]=_0x4cc4af['calleridname'];this[_0x75f0('0x15')]=_0x4cc4af[_0x75f0('0x15')];this[_0x75f0('0x16')]=_0x4cc4af[_0x75f0('0x16')];this[_0x75f0('0x17')]=_0x4cc4af['responsetime'];this[_0x75f0('0x18')]=_0x4cc4af[_0x75f0('0x17')];this[_0x75f0('0x19')]=_0x4cc4af['ringtime']||0x0;this[_0x75f0('0x1a')]=_0x4cc4af[_0x75f0('0x1a')]||0x0;this[_0x75f0('0x1b')]=_0x4cc4af[_0x75f0('0x1b')]||0x0;this['callback']=_0x4cc4af[_0x75f0('0x1c')];this[_0x75f0('0x1d')]=_0x4cc4af['callbackuniqueid'];this[_0x75f0('0x1e')]=_0x4cc4af[_0x75f0('0x1e')];this[_0x75f0('0x1f')]=_0x4cc4af[_0x75f0('0x1f')];this['ContactId']=_0x4cc4af[_0x75f0('0x20')];this['ListId']=_0x4cc4af[_0x75f0('0x21')];this[_0x75f0('0x22')]=_0x4cc4af[_0x75f0('0x22')];this[_0x75f0('0x23')]=_0x4cc4af[_0x75f0('0x23')];this[_0x75f0('0x24')]=_0x4cc4af[_0x75f0('0x24')];this[_0x75f0('0x25')]=_0x4cc4af[_0x75f0('0x25')]||'';this[_0x75f0('0x26')]=_0x4cc4af[_0x75f0('0x26')]||'';}module[_0x75f0('0x27')]=Final; \ No newline at end of file +var _0x8019=['calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry'];(function(_0x4b6507,_0x5518b5){var _0x2001ec=function(_0x330ddf){while(--_0x330ddf){_0x4b6507['push'](_0x4b6507['shift']());}};_0x2001ec(++_0x5518b5);}(_0x8019,0x18e));var _0x9801=function(_0x202771,_0xcace9c){_0x202771=_0x202771-0x0;var _0x3612ef=_0x8019[_0x202771];return _0x3612ef;};'use strict';var util=require(_0x9801('0x0'));var _=require('lodash');var moment=require(_0x9801('0x1'));function getSeconds(_0x3d30c9,_0xbb50a3){var _0x2e1cec=moment(_0x3d30c9)[_0x9801('0x2')](0x0);var _0x3baaf8=moment(_0xbb50a3)[_0x9801('0x2')](0x0);return _0x2e1cec[_0x9801('0x3')](_0x3baaf8,_0x9801('0x4'));}function Final(_0x231a5b){this[_0x9801('0x5')]=_0x231a5b[_0x9801('0x5')];this[_0x9801('0x6')]=_0x231a5b['scheduledat'];this[_0x9801('0x7')]=_0x231a5b[_0x9801('0x7')];this[_0x9801('0x8')]=_0x231a5b[_0x9801('0x7')]===_0x9801('0x9')?_0x9801('0xa'):_0x231a5b[_0x9801('0x7')];this[_0x9801('0xb')]=_0x231a5b[_0x9801('0xb')];this[_0x9801('0xc')]=_0x231a5b[_0x9801('0xc')];this[_0x9801('0xd')]=_0x231a5b[_0x9801('0xd')];this[_0x9801('0xe')]=_0x231a5b[_0x9801('0xb')]+_0x231a5b[_0x9801('0xc')]+_0x231a5b[_0x9801('0xd')]+_0x231a5b[_0x9801('0xf')]+_0x231a5b[_0x9801('0x10')]+_0x231a5b['countabandonedretry']+_0x231a5b['countmachineretry']+_0x231a5b[_0x9801('0x11')];this[_0x9801('0xf')]=_0x231a5b['countnosuchnumberretry'];this[_0x9801('0x10')]=_0x231a5b['countdropretry'];this[_0x9801('0x12')]=_0x231a5b[_0x9801('0x12')];this[_0x9801('0x13')]=_0x231a5b['countmachineretry'];this[_0x9801('0x11')]=_0x231a5b['countagentrejectretry'];this['queue']=_0x231a5b['queue'];this[_0x9801('0x14')]=_0x231a5b[_0x9801('0x14')];this['calleridnum']=_0x231a5b[_0x9801('0x15')];this[_0x9801('0x16')]=_0x231a5b['starttime'];this['responsetime']=_0x231a5b[_0x9801('0x17')];this[_0x9801('0x18')]=_0x231a5b['responsetime'];this[_0x9801('0x19')]=_0x231a5b[_0x9801('0x19')]||0x0;this[_0x9801('0x1a')]=_0x231a5b[_0x9801('0x1a')]||0x0;this[_0x9801('0x1b')]=_0x231a5b['talktime']||0x0;this[_0x9801('0x1c')]=_0x231a5b[_0x9801('0x1c')];this[_0x9801('0x1d')]=_0x231a5b[_0x9801('0x1d')];this[_0x9801('0x1e')]=_0x231a5b[_0x9801('0x1e')];this['recallme']=_0x231a5b['recallme'];this[_0x9801('0x1f')]=_0x231a5b[_0x9801('0x1f')];this[_0x9801('0x20')]=_0x231a5b[_0x9801('0x20')];this[_0x9801('0x21')]=_0x231a5b['UserId'];this['VoiceQueueId']=_0x231a5b['VoiceQueueId'];this[_0x9801('0x22')]=_0x231a5b[_0x9801('0x22')];this[_0x9801('0x23')]=_0x231a5b[_0x9801('0x23')]||'';this[_0x9801('0x24')]=_0x231a5b[_0x9801('0x24')]||'';}module[_0x9801('0x25')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index cb0df9b..d05b472 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 _0x89dd=['exports','util','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countcongestionretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','name','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','endtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x89dd,0x7f));var _0xd89d=function(_0x4e9f15,_0x398009){_0x4e9f15=_0x4e9f15-0x0;var _0x12422d=_0x89dd[_0x4e9f15];return _0x12422d;};'use strict';var util=require(_0xd89d('0x0'));var _=require('lodash');var moment=require(_0xd89d('0x1'));function getSeconds(_0x5e88e6,_0x4ce701){var _0x4e02ea=moment(_0x5e88e6)[_0xd89d('0x2')](0x0);var _0xd7c807=moment(_0x4ce701)[_0xd89d('0x2')](0x0);return _0x4e02ea[_0xd89d('0x3')](_0xd7c807,_0xd89d('0x4'));}function Hangup(_0x351027,_0x576852){this[_0xd89d('0x5')]=0x4;this[_0xd89d('0x6')]=_0xd89d('0x7');this[_0xd89d('0x8')]=_0x351027[_0xd89d('0x8')];this[_0xd89d('0x9')]=_0x351027[_0xd89d('0x9')];this[_0xd89d('0xa')]=_0x351027[_0xd89d('0x9')]===_0xd89d('0xb')?_0xd89d('0xc'):_0x351027['type'];this[_0xd89d('0xd')]=_0x351027[_0xd89d('0xd')];this['countcongestionretry']=_0x351027['countcongestionretry'];this[_0xd89d('0xe')]=_0x351027[_0xd89d('0xe')];this['countglobal']=_0x351027[_0xd89d('0xd')]+_0x351027[_0xd89d('0xf')]+_0x351027['countnoanswerretry']+_0x351027[_0xd89d('0x10')]+_0x351027[_0xd89d('0x11')]+_0x351027['countabandonedretry']+_0x351027[_0xd89d('0x12')]+_0x351027[_0xd89d('0x13')];this[_0xd89d('0x10')]=_0x351027[_0xd89d('0x10')];this[_0xd89d('0x11')]=_0x351027[_0xd89d('0x11')];this[_0xd89d('0x14')]=_0x351027[_0xd89d('0x14')];this['countmachineretry']=_0x351027['countmachineretry'];this[_0xd89d('0x13')]=_0x351027[_0xd89d('0x13')];this[_0xd89d('0x15')]=_0x576852['uniqueid'];this['calleridname']=_0x351027[_0xd89d('0x16')];this['calleridnum']=_0x351027['number'];this[_0xd89d('0x17')]=_0x351027[_0xd89d('0x17')];this[_0xd89d('0x18')]=_0x351027['responsetime'];this['endtime']=moment()[_0xd89d('0x19')](_0xd89d('0x1a'));this['ringtime']=getSeconds(_0x351027[_0xd89d('0x18')],_0x351027[_0xd89d('0x17')]);this['holdtime']=0x0;this['talktime']=getSeconds(this[_0xd89d('0x1b')],_0x351027[_0xd89d('0x18')]);this['queue']=_0x351027[_0xd89d('0xc')];this[_0xd89d('0x1c')]=_0xd89d('0x1d');this[_0xd89d('0x1e')]=_0x576852[_0xd89d('0x1f')];this[_0xd89d('0x20')]=_0x351027[_0xd89d('0x20')];this['callbackuniqueid']=_0x351027[_0xd89d('0x21')];this[_0xd89d('0x22')]=_0x351027['callbackat'];this[_0xd89d('0x23')]=_0x351027[_0xd89d('0x23')];this[_0xd89d('0x24')]=_0x351027[_0xd89d('0x24')];this[_0xd89d('0x25')]=_0x351027[_0xd89d('0x25')];this[_0xd89d('0x26')]=_0x351027[_0xd89d('0x26')];this['VoiceQueueId']=_0x351027[_0xd89d('0x27')];this[_0xd89d('0x28')]=_0x351027[_0xd89d('0x28')];}module[_0xd89d('0x29')]=Hangup; \ No newline at end of file +var _0xdf53=['VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','state','statedesc','scheduledat','campaigntype','type','outbound','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','queue','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0xafcda6,_0x2817b9){var _0x2f00c5=function(_0x20c6ff){while(--_0x20c6ff){_0xafcda6['push'](_0xafcda6['shift']());}};_0x2f00c5(++_0x2817b9);}(_0xdf53,0xe4));var _0x3df5=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xdf53[_0x397e5f];return _0x5302b8;};'use strict';var util=require(_0x3df5('0x0'));var _=require(_0x3df5('0x1'));var moment=require(_0x3df5('0x2'));function getSeconds(_0x23f501,_0x3e2f88){var _0xa9cd23=moment(_0x23f501)['milliseconds'](0x0);var _0x368067=moment(_0x3e2f88)[_0x3df5('0x3')](0x0);return _0xa9cd23[_0x3df5('0x4')](_0x368067,'seconds');}function Hangup(_0x1130d0,_0x4807d0){this[_0x3df5('0x5')]=0x4;this[_0x3df5('0x6')]='Answer';this[_0x3df5('0x7')]=_0x1130d0[_0x3df5('0x7')];this['type']=_0x1130d0['type'];this[_0x3df5('0x8')]=_0x1130d0[_0x3df5('0x9')]===_0x3df5('0xa')?'queue':_0x1130d0[_0x3df5('0x9')];this['countbusyretry']=_0x1130d0['countbusyretry'];this[_0x3df5('0xb')]=_0x1130d0['countcongestionretry'];this[_0x3df5('0xc')]=_0x1130d0[_0x3df5('0xc')];this[_0x3df5('0xd')]=_0x1130d0[_0x3df5('0xe')]+_0x1130d0[_0x3df5('0xb')]+_0x1130d0['countnoanswerretry']+_0x1130d0[_0x3df5('0xf')]+_0x1130d0[_0x3df5('0x10')]+_0x1130d0[_0x3df5('0x11')]+_0x1130d0[_0x3df5('0x12')]+_0x1130d0[_0x3df5('0x13')];this[_0x3df5('0xf')]=_0x1130d0[_0x3df5('0xf')];this[_0x3df5('0x10')]=_0x1130d0[_0x3df5('0x10')];this[_0x3df5('0x11')]=_0x1130d0[_0x3df5('0x11')];this[_0x3df5('0x12')]=_0x1130d0[_0x3df5('0x12')];this[_0x3df5('0x13')]=_0x1130d0[_0x3df5('0x13')];this[_0x3df5('0x14')]=_0x4807d0[_0x3df5('0x14')];this['calleridname']=_0x1130d0[_0x3df5('0x15')];this[_0x3df5('0x16')]=_0x1130d0[_0x3df5('0x17')];this[_0x3df5('0x18')]=_0x1130d0['starttime'];this[_0x3df5('0x19')]=_0x1130d0['responsetime'];this['endtime']=moment()['format'](_0x3df5('0x1a'));this[_0x3df5('0x1b')]=getSeconds(_0x1130d0[_0x3df5('0x19')],_0x1130d0[_0x3df5('0x18')]);this[_0x3df5('0x1c')]=0x0;this[_0x3df5('0x1d')]=getSeconds(this[_0x3df5('0x1e')],_0x1130d0[_0x3df5('0x19')]);this[_0x3df5('0x1f')]=_0x1130d0[_0x3df5('0x1f')];this[_0x3df5('0x20')]=_0x3df5('0x21');this[_0x3df5('0x22')]=_0x4807d0['cause-txt'];this[_0x3df5('0x23')]=_0x1130d0[_0x3df5('0x23')];this[_0x3df5('0x24')]=_0x1130d0[_0x3df5('0x24')];this[_0x3df5('0x25')]=_0x1130d0['callbackat'];this[_0x3df5('0x26')]=_0x1130d0[_0x3df5('0x26')];this[_0x3df5('0x27')]=_0x1130d0[_0x3df5('0x27')];this[_0x3df5('0x28')]=_0x1130d0['ListId'];this[_0x3df5('0x29')]=_0x1130d0[_0x3df5('0x29')];this[_0x3df5('0x2a')]=_0x1130d0['VoiceQueueId'];this[_0x3df5('0x2b')]=_0x1130d0[_0x3df5('0x2b')];}module[_0x3df5('0x2c')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index e90cf04..2c97fb5 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 _0x357e=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x14b60f,_0x1359fc){var _0xe7b1de=function(_0x2b6b8d){while(--_0x2b6b8d){_0x14b60f['push'](_0x14b60f['shift']());}};_0xe7b1de(++_0x1359fc);}(_0x357e,0x1c2));var _0xe357=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x357e[_0x13b8f3];return _0x1a6d06;};'use strict';var util=require(_0xe357('0x0'));var _=require('lodash');var moment=require(_0xe357('0x1'));function getSeconds(_0x862bf5,_0x26ef69){var _0x4e3a48=moment(_0x862bf5)[_0xe357('0x2')](0x0);var _0x4e4ee6=moment(_0x26ef69)[_0xe357('0x2')](0x0);return _0x4e3a48[_0xe357('0x3')](_0x4e4ee6,'seconds');}function History(_0x4aa349){this[_0xe357('0x4')]=_0x4aa349[_0xe357('0x4')];this[_0xe357('0x5')]=_0x4aa349[_0xe357('0x5')]||undefined;this[_0xe357('0x6')]=_0x4aa349[_0xe357('0x6')];this[_0xe357('0x7')]=_0x4aa349[_0xe357('0x6')]==='outbound'?_0xe357('0x8'):_0x4aa349['type'];this['countbusyretry']=_0x4aa349[_0xe357('0x9')];this[_0xe357('0xa')]=_0x4aa349[_0xe357('0xa')];this['countnoanswerretry']=_0x4aa349[_0xe357('0xb')];this[_0xe357('0xc')]=_0x4aa349['countbusyretry']+_0x4aa349['countcongestionretry']+_0x4aa349[_0xe357('0xb')]+_0x4aa349[_0xe357('0xd')]+_0x4aa349[_0xe357('0xe')]+_0x4aa349[_0xe357('0xf')]+_0x4aa349[_0xe357('0x10')]+_0x4aa349[_0xe357('0x11')];this[_0xe357('0xd')]=_0x4aa349['countnosuchnumberretry'];this[_0xe357('0xe')]=_0x4aa349[_0xe357('0xe')];this[_0xe357('0xf')]=_0x4aa349[_0xe357('0xf')];this[_0xe357('0x10')]=_0x4aa349[_0xe357('0x10')];this[_0xe357('0x11')]=_0x4aa349[_0xe357('0x11')];this[_0xe357('0x8')]=_0x4aa349[_0xe357('0x8')];this[_0xe357('0x12')]=_0x4aa349[_0xe357('0x13')];this[_0xe357('0x14')]=_0x4aa349[_0xe357('0x15')];this[_0xe357('0x16')]=_0x4aa349['starttime'];this[_0xe357('0x17')]=_0x4aa349['responsetime'];this['endtime']=_0x4aa349[_0xe357('0x17')];this[_0xe357('0x18')]=getSeconds(_0x4aa349['responsetime'],_0x4aa349[_0xe357('0x16')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0xe357('0x19')]=_0x4aa349['callback'];this[_0xe357('0x1a')]=_0x4aa349[_0xe357('0x1a')];this[_0xe357('0x1b')]=_0x4aa349[_0xe357('0x1b')];this[_0xe357('0x1c')]=_0x4aa349[_0xe357('0x1c')];this['ContactId']=_0x4aa349[_0xe357('0x1d')];this['ListId']=_0x4aa349[_0xe357('0x1e')];this[_0xe357('0x1f')]=_0x4aa349[_0xe357('0x1f')];this[_0xe357('0x20')]=_0x4aa349[_0xe357('0x20')];this[_0xe357('0x21')]=_0x4aa349[_0xe357('0x21')];this[_0xe357('0x22')]=_0x4aa349[_0xe357('0x22')]||'';this['originatecalleridname']=_0x4aa349[_0xe357('0x23')]||'';}module[_0xe357('0x24')]=History; \ No newline at end of file +var _0x38e2=['ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x38e2,0xff));var _0x238e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x38e2[_0x4a9fb1];return _0x348672;};'use strict';var util=require('util');var _=require(_0x238e('0x0'));var moment=require(_0x238e('0x1'));function getSeconds(_0x5665b7,_0x52cb1a){var _0x16dbdd=moment(_0x5665b7)[_0x238e('0x2')](0x0);var _0x57cbf9=moment(_0x52cb1a)['milliseconds'](0x0);return _0x16dbdd[_0x238e('0x3')](_0x57cbf9,_0x238e('0x4'));}function History(_0x34006b){this[_0x238e('0x5')]=_0x34006b[_0x238e('0x5')];this['scheduledat']=_0x34006b[_0x238e('0x6')]||undefined;this[_0x238e('0x7')]=_0x34006b[_0x238e('0x7')];this['campaigntype']=_0x34006b[_0x238e('0x7')]==='outbound'?_0x238e('0x8'):_0x34006b['type'];this['countbusyretry']=_0x34006b[_0x238e('0x9')];this[_0x238e('0xa')]=_0x34006b[_0x238e('0xa')];this['countnoanswerretry']=_0x34006b[_0x238e('0xb')];this[_0x238e('0xc')]=_0x34006b[_0x238e('0x9')]+_0x34006b[_0x238e('0xa')]+_0x34006b[_0x238e('0xb')]+_0x34006b['countnosuchnumberretry']+_0x34006b[_0x238e('0xd')]+_0x34006b['countabandonedretry']+_0x34006b[_0x238e('0xe')]+_0x34006b[_0x238e('0xf')];this[_0x238e('0x10')]=_0x34006b[_0x238e('0x10')];this[_0x238e('0xd')]=_0x34006b['countdropretry'];this[_0x238e('0x11')]=_0x34006b[_0x238e('0x11')];this['countmachineretry']=_0x34006b['countmachineretry'];this[_0x238e('0xf')]=_0x34006b[_0x238e('0xf')];this['queue']=_0x34006b[_0x238e('0x8')];this[_0x238e('0x12')]=_0x34006b[_0x238e('0x13')];this[_0x238e('0x14')]=_0x34006b[_0x238e('0x15')];this[_0x238e('0x16')]=_0x34006b[_0x238e('0x16')];this[_0x238e('0x17')]=_0x34006b['responsetime'];this[_0x238e('0x18')]=_0x34006b[_0x238e('0x17')];this[_0x238e('0x19')]=getSeconds(_0x34006b[_0x238e('0x17')],_0x34006b[_0x238e('0x16')]);this[_0x238e('0x1a')]=0x0;this[_0x238e('0x1b')]=0x0;this[_0x238e('0x1c')]=_0x34006b['callback'];this['callbackuniqueid']=_0x34006b[_0x238e('0x1d')];this[_0x238e('0x1e')]=_0x34006b[_0x238e('0x1e')];this['recallme']=_0x34006b[_0x238e('0x1f')];this[_0x238e('0x20')]=_0x34006b[_0x238e('0x20')];this[_0x238e('0x21')]=_0x34006b[_0x238e('0x21')];this[_0x238e('0x22')]=_0x34006b[_0x238e('0x22')];this[_0x238e('0x23')]=_0x34006b[_0x238e('0x23')];this[_0x238e('0x24')]=_0x34006b['CampaignId'];this[_0x238e('0x25')]=_0x34006b[_0x238e('0x25')]||'';this[_0x238e('0x26')]=_0x34006b['originatecalleridname']||'';}module[_0x238e('0x27')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index bea981e..cc78ddc 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 _0x84a0=['[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','agentreject','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[callProgressDetecting]','Success','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','predictiveIntervalDroppedCallsTimeout','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','length','[actionOriginate]\x20','Contact.phone','checkContactBlack','[getContactCampaign2]','dialLimitQueue','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','md5','ioredis','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperFinal','../rpc/cmHopperAdditionalPhone','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','rrmemory','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','isEmpty','INTERVAL_IS_NULL','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangBusyFactor','startPredictive','Trunk','active','callerid','format','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','clearZombieChannels','[uniqueid]','isNil','Action','status','channel','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','catch','[checkIsBlackList]\x20','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','pick','ContactId','ListId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isTrunkReachable','SIP/%s','reachable','saveInDb','syncVarSet','uniqueid','variable','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','HangupInAMD','AMD','custom:amd','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','membername','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','buildObj','dialGlobalMaxRetry','VoiceQueueId','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','[syncHangupIvr]','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','dropreason','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','Drop','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[syncAgentComplete][createHistory][11]','syncNewExten','locked','stateinterface','actionid','push','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','indexOf','true','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','ACTIVE','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','createdAt','updatedAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','substring','dialCutDigit','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','entity\x20is\x20undefine','evt\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy'];(function(_0xf9c18,_0x1d3074){var _0x5f4364=function(_0x2c1d6d){while(--_0x2c1d6d){_0xf9c18['push'](_0xf9c18['shift']());}};_0x5f4364(++_0x1d3074);}(_0x84a0,0x66));var _0x084a=function(_0x43600e,_0x37ec91){_0x43600e=_0x43600e-0x0;var _0x31f1a3=_0x84a0[_0x43600e];return _0x31f1a3;};'use strict';var util=require(_0x084a('0x0'));var _=require(_0x084a('0x1'));var BPromise=require(_0x084a('0x2'));var uuid=require(_0x084a('0x3'));var moment=require('moment');var rr=require('rr');var md5=require(_0x084a('0x4'));var Redis=require(_0x084a('0x5'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0x084a('0x6'))(_0x084a('0x7'));var loggerBooked=require('../../../config/logger')(_0x084a('0x8'));var loggerPredictive=require(_0x084a('0x6'))(_0x084a('0x9'));var loggerPredictiveCalls=require(_0x084a('0x6'))(_0x084a('0xa'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x084a('0xb'));var ami=require(_0x084a('0xc'));config[_0x084a('0xd')]=_[_0x084a('0xe')](config[_0x084a('0xd')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x084a('0xd')]));var cmHopper=require(_0x084a('0xf'));var cmHopperHistory=require(_0x084a('0x10'));var cmHopperFinal=require(_0x084a('0x11'));var cmHopperAdditionalPhone=require(_0x084a('0x12'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0x084a('0x13'));var History=require(_0x084a('0x14'));var Final=require(_0x084a('0x15'));var AgentComplete=require(_0x084a('0x16'));var QueueCallerAbandon=require(_0x084a('0x17'));var Hangup=require(_0x084a('0x18'));var ipAgi=process[_0x084a('0x19')][_0x084a('0x1a')]||'127.0.0.1';var strategy={'rrmemory':_0x084a('0x1b'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x084a('0x1c')][_0x084a('0x1d')]=function(_0x366624){this[_0x084a('0x1e')]=this[_0x084a('0x1e')]?this['tail'][_0x084a('0x1f')](_0x366624):_0x366624();};function Dialer(_0x4abd81,_0x6799af){this[_0x084a('0x20')]=new Sequence();this['preview']=_0x6799af;this[_0x084a('0x21')]=_0x4abd81[_0x084a('0x21')];this[_0x084a('0x22')]=_0x4abd81[_0x084a('0x22')];this[_0x084a('0x23')]=_0x4abd81[_0x084a('0x23')];this[_0x084a('0x24')]=_0x4abd81[_0x084a('0x24')];this[_0x084a('0x25')]=config[_0x084a('0x25')]||0x2;this[_0x084a('0x26')]={};this[_0x084a('0x27')]={};this[_0x084a('0x28')]={};this[_0x084a('0x29')]={};this[_0x084a('0x2a')]={};this['startPredictive']={};this[_0x084a('0x2b')]={};this[_0x084a('0x2c')]={};this[_0x084a('0x2d')]={};this[_0x084a('0x2e')]={};ami['on'](_0x084a('0x2f'),this['syncAgentConnect'][_0x084a('0x30')](this));ami['on'](_0x084a('0x31'),this[_0x084a('0x32')][_0x084a('0x30')](this));ami['on'](_0x084a('0x33'),this[_0x084a('0x34')]['bind'](this));ami['on'](_0x084a('0x35'),this[_0x084a('0x36')][_0x084a('0x30')](this));ami['on']('custom:queuesummary',this[_0x084a('0xb')][_0x084a('0x30')](this));ami['on'](_0x084a('0x37'),this['syncHangup']['bind'](this));ami['on']('newexten',this['syncNewExten'][_0x084a('0x30')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x084a('0x38'),this[_0x084a('0x39')][_0x084a('0x30')](this));ami['on'](_0x084a('0x3a'),this[_0x084a('0x3b')][_0x084a('0x30')](this));this[_0x084a('0x3c')]();this[_0x084a('0x3d')]();}function isNotNull(_0x5e6ea8){return _0x5e6ea8!==null&&!_[_0x084a('0x3e')](_0x5e6ea8);}function checkIsLoggedIn(_0x3b2b38,_0x501a16){return function(){if(_0x501a16<=0x0){_0x3b2b38[_0x084a('0x3f')]=_0x084a('0x40');throw _0x3b2b38[_0x084a('0x41')]+_0x084a('0x42');}};}function isActive(_0x448ae9){return _0x448ae9;}function checkIsActive(_0x202602,_0x3a99fe){return function(){if(!isActive(_0x3a99fe)){_0x202602[_0x084a('0x3f')]=_0x084a('0x43');throw _0x202602[_0x084a('0x41')]+_0x084a('0x44');}};}function checkInterval(_0x31bb9e){return function(){if(!isNotNull(_0x31bb9e[_0x084a('0x45')])){_0x31bb9e['message']='INTERVAL_IS_NULL';throw _0x31bb9e[_0x084a('0x41')]+_0x084a('0x46');}if(!isNotNull(_0x31bb9e[_0x084a('0x45')][_0x084a('0x47')])){_0x31bb9e[_0x084a('0x3f')]='INTERVAL_IS_NULL';throw _0x31bb9e[_0x084a('0x41')]+_0x084a('0x46');}if(!isNotNull(_[_0x084a('0x48')](_0x31bb9e['Interval'][_0x084a('0x47')]))){_0x31bb9e[_0x084a('0x3f')]=_0x084a('0x49');throw _0x31bb9e['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x49af13,_0xf97d1b,_0x2e1806){return{'action':_0x49af13,'response':_0xf97d1b,'message':_0x2e1806,'stack':_0x2e1806};}function myreject(_0x1444ed){return function(_0x4e594f){return _0x1444ed(msgResponse(_0x084a('0x4a'),_0x084a('0x4b'),JSON[_0x084a('0x4c')](_0x4e594f)));};}function getSeconds(_0x28b199,_0x28a0a5){var _0x25f44e=moment(_0x28b199)[_0x084a('0x4d')](0x0);var _0x19354f=moment(_0x28a0a5)[_0x084a('0x4d')](0x0);return _0x25f44e[_0x084a('0x4e')](_0x19354f,_0x084a('0x4f'));}function emit(_0x1454a9,_0x284cdc,_0x1659d3){io['to'](_0x1454a9)[_0x084a('0x50')](_0x284cdc,_0x1659d3);}function emitVoiceQueueSummary(_0x597d87){if(_0x597d87[_0x084a('0x51')]===_0x084a('0x52')){var _0x1a0e56={'id':_0x597d87['id'],'name':_0x597d87[_0x084a('0x41')],'strategy':_0x597d87[_0x084a('0x53')],'answered':_0x597d87[_0x084a('0x54')],'available':_0x597d87[_0x084a('0x55')],'loggedIn':_0x597d87[_0x084a('0x56')],'pTalking':_0x597d87[_0x084a('0x57')],'sumBillable':_0x597d87['sumBillable'],'sumDuration':_0x597d87[_0x084a('0x58')],'sumHoldTime':_0x597d87[_0x084a('0x59')]||0x0,'talking':_0x597d87[_0x084a('0x5a')],'total':_0x597d87[_0x084a('0x5b')],'type':_0x597d87[_0x084a('0x51')],'unmanaged':_0x597d87[_0x084a('0x5c')],'abandoned':_0x597d87['abandoned'],'waiting':_0x597d87[_0x084a('0x5d')],'loggedInDb':_0x597d87[_0x084a('0x5e')],'dialActive':_0x597d87['dialActive'],'dialMethod':_0x597d87[_0x084a('0x5f')],'dialOriginateCallerIdName':_0x597d87[_0x084a('0x60')],'dialOriginateCallerIdNumber':_0x597d87[_0x084a('0x61')],'dialOriginateTimeout':_0x597d87['dialOriginateTimeout'],'dialPrefix':_0x597d87[_0x084a('0x62')],'outboundAnswerAgiCallsDay':_0x597d87[_0x084a('0x63')],'outboundAnswerCallsDay':_0x597d87['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x597d87[_0x084a('0x64')],'outboundBusyCallsDay':_0x597d87[_0x084a('0x65')],'outboundCongestionCallsDay':_0x597d87['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x597d87['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x597d87[_0x084a('0x66')],'outboundDropCallsDayTimeout':_0x597d87[_0x084a('0x67')],'outboundNoAnswerCallsDay':_0x597d87[_0x084a('0x68')],'outboundNoSuchCallsDay':_0x597d87[_0x084a('0x69')],'outboundOriginateFailureCallsDay':_0x597d87[_0x084a('0x6a')],'outboundReCallsDay':_0x597d87[_0x084a('0x6b')],'outboundRejectCallsDay':_0x597d87[_0x084a('0x6c')],'outboundUnknownCallsDay':_0x597d87[_0x084a('0x6d')],'predictiveIntervalAnsweredCalls':_0x597d87[_0x084a('0x6e')],'predictiveIntervalAvgHoldtime':_0x597d87[_0x084a('0x6f')],'predictiveIntervalAvgTalktime':_0x597d87[_0x084a('0x70')],'predictiveIntervalDroppedCallsCallersExit':_0x597d87['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x597d87['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x597d87[_0x084a('0x71')],'predictiveIntervalErlangCallsDroppedCalls':_0x597d87[_0x084a('0x72')],'predictiveIntervalHitRate':_0x597d87[_0x084a('0x73')],'predictiveIntervalMultiplicativeFactor':_0x597d87['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x597d87[_0x084a('0x74')],'predictiveIntervalAvailable':_0x597d87[_0x084a('0x75')],'predictiveIntervalTotalCalls':_0x597d87[_0x084a('0x76')],'message':_0x597d87[_0x084a('0x3f')],'originated':_0x597d87[_0x084a('0x77')],'erlangCalls':_0x597d87['erlangCalls'],'erlangCallToSecond':_0x597d87[_0x084a('0x78')],'erlangAbandonmentRate':_0x597d87['erlangAbandonmentRate'],'erlangBusyFactor':_0x597d87[_0x084a('0x79')],'startPredictive':_0x597d87[_0x084a('0x7a')],'startProgressive':_0x597d87[_0x084a('0x2b')]};if(_0x597d87['Trunk']){_0x1a0e56['Trunk']={'id':_0x597d87[_0x084a('0x7b')]['id'],'name':_0x597d87[_0x084a('0x7b')]['name'],'active':_0x597d87[_0x084a('0x7b')][_0x084a('0x7c')],'callerid':_0x597d87[_0x084a('0x7b')][_0x084a('0x7d')]};}if(_0x597d87['Interval']){_0x1a0e56[_0x084a('0x45')]={'id':_0x597d87[_0x084a('0x45')]['id'],'name':_0x597d87[_0x084a('0x45')][_0x084a('0x41')]};}var _0x5d6864=md5(JSON[_0x084a('0x4c')](_0x1a0e56));if(_0x597d87[_0x084a('0x4')]!==_0x5d6864){_0x597d87[_0x084a('0x4')]=_0x5d6864;emit(util[_0x084a('0x7e')]('voice:queue:%s',_0x1a0e56['name']),_0x084a('0x7f'),_0x1a0e56);}}}function emitCampaignSummary(_0x3a6905){if(_0x3a6905[_0x084a('0x51')]===_0x084a('0x80')){emit(util[_0x084a('0x7e')](_0x084a('0x81'),_0x3a6905[_0x084a('0x41')]),_0x084a('0x82'),_0x3a6905);}}function checkGetDataPredictive(_0xf6ce0d){if(isNotNull(_0xf6ce0d)&&!_[_0x084a('0x48')](_0xf6ce0d)){loggerPredictive[_0x084a('0x83')](_0x084a('0x84'));loggerPredictive['info'](_0x084a('0x85'),_0xf6ce0d[_0x084a('0x76')]);loggerPredictive[_0x084a('0x83')](_0x084a('0x86'),_0xf6ce0d[_0x084a('0x6e')]);loggerPredictive[_0x084a('0x83')](_0x084a('0x87'),_0xf6ce0d['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x084a('0x83')](_0x084a('0x88'),_0xf6ce0d[_0x084a('0x89')]);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf6ce0d[_0x084a('0x6f')]);loggerPredictive['info'](_0x084a('0x8a'),_0xf6ce0d[_0x084a('0x70')]);loggerPredictive['info'](_0x084a('0x8b'));if(_0xf6ce0d['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0xf6ce0d[_0x084a('0x70')])&&_0xf6ce0d[_0x084a('0x70')]>0x0){return!![];}loggerPredictive[_0x084a('0x83')](_0x084a('0x8c'));if(!_[_0x084a('0x3e')](_0xf6ce0d[_0x084a('0x6f')])&&_0xf6ce0d[_0x084a('0x6f')]>0x0){return!![];}loggerPredictive['info'](_0x084a('0x8d'));}else{loggerPredictive[_0x084a('0x83')](_0x084a('0x8e'));}}else{loggerPredictive['info'](_0x084a('0x8f'));}return![];}function mergeDataErlangB(_0x339088){return function(_0x12db87){loggerPredictive[_0x084a('0x83')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x084a('0x83')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x12db87[_0x084a('0x90')]);loggerPredictive[_0x084a('0x83')](_0x084a('0x91'),_0x12db87['erlangCallToSecond']);loggerPredictive['info'](_0x084a('0x92'),_0x12db87[_0x084a('0x93')]);loggerPredictive['info'](_0x084a('0x94'),_0x12db87['erlangBusyFactor']);loggerPredictive['info'](_0x084a('0x92'),_0x12db87[_0x084a('0x93')]);loggerPredictive[_0x084a('0x83')](_0x084a('0x8b'));_[_0x084a('0x95')](_0x339088,_0x12db87);};}function getDiff(_0x2c934f){var _0x3f2c41=moment()[_0x084a('0x4d')](0x0);var _0x114aa5=moment(_0x2c934f)['milliseconds'](0x0);return _0x3f2c41[_0x084a('0x4e')](_0x114aa5,_0x084a('0x4f'));}function ifInterval(_0x3668eb,_0x50a029){if(_[_0x084a('0x3e')](_0x50a029)){return![];}return getDiff(_0x50a029)<_0x3668eb*0x3c;}function freeVariablesPredictive(_0x3d8128){if(isNotNull(_0x3d8128)){if(!_['isUndefined'](_0x3d8128[_0x084a('0x2b')])){_0x3d8128['startProgressive']=undefined;loggerPredictive['info'](_0x3d8128[_0x084a('0x41')],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0x3d8128[_0x084a('0x7a')])){_0x3d8128[_0x084a('0x7a')]=undefined;loggerPredictive[_0x084a('0x83')](_0x3d8128['name'],_0x084a('0x96'));}if(!_[_0x084a('0x3e')](_0x3d8128[_0x084a('0x97')])){clearInterval(_0x3d8128[_0x084a('0x97')]);_0x3d8128[_0x084a('0x97')]=undefined;loggerPredictive[_0x084a('0x83')](_0x3d8128[_0x084a('0x41')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x51e090,_0x2ba35a){if(_0x2ba35a===0x0){return 0x0;}var _0x36ba24=0x1;for(var _0x5c77a3=0x1;_0x5c77a3<=_0x2ba35a;_0x5c77a3+=0x1){_0x36ba24=0x1+_0x36ba24*_0x5c77a3/_0x51e090;}return 0x1/_0x36ba24;}function isVoiceQueueOutbound(_0x3a8192){return _0x3a8192===_0x084a('0x52');}function isNotPreview(_0x31c37b){return _0x31c37b!==_0x084a('0x98');}function isCampaignIvr(_0x48e300){return _0x48e300===_0x084a('0x80');}function getCallerId(_0x3fa52e,_0xabf4c2,_0x5a9bfe){if(!_['isUndefined'](_0x5a9bfe)&&typeof _0x5a9bfe===_0x084a('0x99')&&!_[_0x084a('0x48')](_0x5a9bfe)){if(!_[_0x084a('0x3e')](_0xabf4c2)&&typeof _0xabf4c2===_0x084a('0x99')&&!_[_0x084a('0x48')](_0xabf4c2)){return util[_0x084a('0x7e')](_0x084a('0x9a'),_0xabf4c2,_0x5a9bfe);}return util['format'](_0x084a('0x9a'),_0x5a9bfe,_0x5a9bfe);}if(!_['isUndefined'](_0x3fa52e)&&typeof _0x3fa52e==='string'&&!_[_0x084a('0x48')](_0x3fa52e)){return _0x3fa52e;}return _0x084a('0x9b');}function loggerCatchQueueSummary(_0x2c35ce,_0x4a2745){return function(_0x163a5d){freeVariablesPredictive(_0x4a2745);emitVoiceQueueSummary(_0x4a2745);emitCampaignSummary(_0x4a2745);loggerSyncQueueSummary['error'](_0x2c35ce,util[_0x084a('0x9c')](_0x163a5d,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1054ea,_0x2417b4){return function(_0x12cef4){loggerPredictive[_0x084a('0x9d')](_0x2417b4[_0x084a('0x41')],_0x1054ea);loggerPredictive['error'](_0x12cef4['stack']);freeVariablesPredictive(_0x2417b4);};}function loggerCatch(_0x1bec42){return function(_0x1e1ea8){logger[_0x084a('0x9d')](_0x1bec42,util[_0x084a('0x9c')](_0x1e1ea8,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x22abf5){return _0x22abf5&&!_[_0x084a('0x3e')](_0x22abf5)&&_0x22abf5['length']>0x0;}function decremetOriginate(_0x3f58de){if(!_[_0x084a('0x3e')](_0x3f58de)&&_0x3f58de!==null){if(typeof _0x3f58de[_0x084a('0x77')]!==_0x084a('0x9e')){if(_0x3f58de[_0x084a('0x77')]>0x0){_0x3f58de[_0x084a('0x77')]-=0x1;}else{logger[_0x084a('0x9d')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x084a('0x9d')](_0x084a('0x9f'));}}function checkContactLowerLimitOriginate(_0x25a4d3,_0x33ba14,_0x19fabb){if(_0x33ba14>_0x19fabb){for(var _0xb287e7=0x0;_0xb287e7<_0x33ba14-_0x19fabb;_0xb287e7+=0x1){decremetOriginate(_0x25a4d3);}}}function loggerGetContactDialer(_0x3824db,_0x26cd70,_0x476fcc){return function(_0x1ada1d){checkContactLowerLimitOriginate(_0x26cd70,_0x476fcc,0x0);logger['error'](_0x3824db,util['inspect'](_0x1ada1d,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x586b6b){return function(_0x2216d4){if(isNotNull(_0x2216d4)&&isNotNull(_0x2216d4[0x0])){if(_0x2216d4[0x0][_0x084a('0xa0')]>0x0){_0x586b6b['message']=_0x084a('0xa1');logger[_0x084a('0x83')](_0x084a('0xa2')+_0x586b6b[_0x084a('0x41')],_0x2216d4[0x0]['contactsRescheduled'],'contacts');}else{_0x586b6b[_0x084a('0x3f')]=_0x084a('0xa3');logger[_0x084a('0x83')](_0x084a('0xa4')+_0x586b6b[_0x084a('0x41')]);}}};}function notSendMessagesQueue(_0x372563){if(_0x372563[_0x084a('0xa5')]){freeVariablesPredictive(_0x372563);if(_0x372563['originated']===0x0&&_0x372563[_0x084a('0x5a')]===0x0&&_0x372563[_0x084a('0x5d')]===0x0&&(_0x372563[_0x084a('0x57')]||0x0)===0x0){_0x372563[_0x084a('0xa5')]=![];_0x372563[_0x084a('0x55')]=0x0;_0x372563[_0x084a('0x3f')]=_0x084a('0x43');loggerSyncQueueSummary['error'](_0x084a('0xa6'),_0x372563[_0x084a('0x41')],_0x084a('0xa7'));}else{_0x372563[_0x084a('0x3f')]=_0x084a('0xa8');loggerSyncQueueSummary[_0x084a('0x9d')](_0x084a('0xa6'),_0x372563[_0x084a('0x41')],_0x084a('0xa9'));}emitVoiceQueueSummary(_0x372563);}}function notSendMessagesCampaign(_0xd75c49){if(_0xd75c49[_0x084a('0xa5')]){if(_0xd75c49['originated']===0x0){_0xd75c49[_0x084a('0xa5')]=![];_0xd75c49[_0x084a('0x3f')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x084a('0x9d')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xd75c49['name'],_0x084a('0xa7'));}else{_0xd75c49[_0x084a('0x3f')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x084a('0x9d')](_0x084a('0xaa'),_0xd75c49[_0x084a('0x41')],_0x084a('0xa9'));}emitCampaignSummary(_0xd75c49);}}function createObjHistory(_0x1b8359,_0x362d2e,_0x8e0634,_0x27bafc,_0x1916b1){_0x1b8359[_0x084a('0x3f')]=_0x8e0634;var _0xe03abd=new Action(_0x1b8359,_0x362d2e);var _0x7c85e3=new History(_0xe03abd);_0x7c85e3[_0x084a('0xab')]=_0x27bafc;_0x7c85e3[_0x084a('0xac')]=_0x1916b1;_0x7c85e3[_0x084a('0xad')]=_0xe03abd['starttime'];return _0x7c85e3;}Dialer[_0x084a('0x1c')][_0x084a('0x3d')]=function(){var _0x3fa618=this;setInterval(function(){_0x3fa618[_0x084a('0xae')](_0x3fa618[_0x084a('0x29')],_0x084a('0xaf'));_0x3fa618[_0x084a('0xae')](_0x3fa618[_0x084a('0x27')],'[actions]');},0x32c8);};Dialer['prototype'][_0x084a('0xae')]=function(_0x2602ac,_0x5d4217){var _0x5d99ca=this;for(var _0x3459be in _0x2602ac){if(typeof _0x2602ac[_0x3459be]!=='undefined'){this[_0x084a('0x20')]['enqueue'](function(){if(!_[_0x084a('0xb0')](_0x2602ac[_0x3459be])){return ami[_0x084a('0xb1')]({'action':_0x084a('0xb2'),'channel':_0x2602ac[_0x3459be][_0x084a('0xb3')]})['catch'](function(_0x5ebbe8){if(_0x5ebbe8['message']===_0x084a('0xb4')){setTimeout(function(){if(_0x2602ac[_0x3459be]&&_0x2602ac[_0x3459be][_0x084a('0x51')]!==_0x084a('0x80')){_0x5d99ca['updateOriginated'](_0x5d99ca[_0x084a('0x21')][_0x2602ac[_0x3459be][_0x084a('0xb5')]]);logger['error'](_0x084a('0xb6'),_0x5d4217,_0x3459be,_0x2602ac[_0x3459be][_0x084a('0xb5')]);delete _0x2602ac[_0x3459be];}if(_0x2602ac[_0x3459be]&&_0x2602ac[_0x3459be]['type']===_0x084a('0x80')){_0x5d99ca[_0x084a('0xb7')](_0x5d99ca[_0x084a('0x22')][_0x2602ac[_0x3459be]['queue']]);logger['error'](_0x084a('0xb8'),_0x5d4217,_0x3459be,_0x2602ac[_0x3459be]['queue']);delete _0x2602ac[_0x3459be];}},0x2328);}});}});}}};Dialer[_0x084a('0x1c')][_0x084a('0xb9')]=function(_0x11894e){return BPromise[_0x084a('0xba')]()[_0x084a('0xbb')](cmHopper[_0x084a('0xb9')](_0x11894e))['catch'](loggerCatch(_0x084a('0xbc')));};Dialer['prototype']['checkIsBlackList']=function(_0x248cab){return BPromise[_0x084a('0xba')]()[_0x084a('0xbb')](cmHopperBlack[_0x084a('0xbd')](_0x248cab))[_0x084a('0xbe')](loggerCatch(_0x084a('0xbf')));};Dialer['prototype']['verifyAdditionalPhones']=function(_0x152da1,_0x430302,_0x3ec654){return BPromise['resolve']()[_0x084a('0xbb')](cmHopperAdditionalPhone[_0x084a('0xc0')](_0x152da1,_0x430302,_0x3ec654))['catch'](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer[_0x084a('0x1c')]['swapAdditionalPhones']=function(_0x5c93b2,_0x135e46,_0x2d9c66){return BPromise['resolve']()[_0x084a('0xbb')](cmHopperAdditionalPhone[_0x084a('0xc1')](_0x5c93b2,_0x135e46,_0x2d9c66))['catch'](loggerCatch(_0x084a('0xc2')));};Dialer[_0x084a('0x1c')][_0x084a('0xc3')]=function(_0x2f645f){return BPromise[_0x084a('0xba')]()[_0x084a('0xbb')](cmHopperBlack['checkIsBlackListIvr'](_0x2f645f))['catch'](loggerCatch(_0x084a('0xc4')));};Dialer[_0x084a('0x1c')]['averageHandleTime']=function(_0x3696d9){return BPromise['resolve']()[_0x084a('0xbb')](cmHopperHistory[_0x084a('0xc5')](_0x3696d9))[_0x084a('0xbe')](loggerCatch(_0x084a('0xc6')));};Dialer[_0x084a('0x1c')][_0x084a('0xc7')]=function(_0x4f9c22){return BPromise['resolve']()[_0x084a('0xbb')](cmHopper[_0x084a('0xc7')](_0x4f9c22))[_0x084a('0xbe')](loggerCatch(_0x084a('0xc8')));};Dialer[_0x084a('0x1c')]['unlockContact']=function(_0x2011f1,_0x37c85e,_0x135c45){return BPromise[_0x084a('0xba')]()['then'](cmHopper[_0x084a('0xc9')](_0x2011f1,_0x37c85e,_0x135c45))[_0x084a('0xbe')](loggerCatch(_0x084a('0xca')));};Dialer[_0x084a('0x1c')][_0x084a('0xcb')]=function(_0x2f8c33,_0x2aaef5,_0x8b4013,_0x35d065,_0x3a2420){return BPromise[_0x084a('0xba')]()['then'](cmHopper['getContactDialer'](_0x2f8c33,_0x2aaef5,_0x8b4013,_0x35d065))[_0x084a('0xbe')](function(_0x5b76b0){_0x3a2420[_0x084a('0xcc')]-=_0x8b4013;_0x3a2420[_0x084a('0xcc')]=_0x3a2420[_0x084a('0xcc')]>0x0?_0x3a2420[_0x084a('0xcc')]:0x0;loggerCatch(_0x084a('0xcd'))(_0x5b76b0);});};Dialer['prototype'][_0x084a('0xce')]=function(_0x41908d,_0x5d8ee5,_0x439204,_0x3e150d){return BPromise[_0x084a('0xba')]()['then'](cmHopper[_0x084a('0xce')](_0x41908d,_0x5d8ee5,_0x439204))[_0x084a('0xbe')](function(_0x5f5c16){_0x3e150d[_0x084a('0xcc')]-=_0x5d8ee5;_0x3e150d[_0x084a('0xcc')]=_0x3e150d[_0x084a('0xcc')]>0x0?_0x3e150d[_0x084a('0xcc')]:0x0;loggerCatch(_0x084a('0xcf'))(_0x5f5c16);});};Dialer['prototype'][_0x084a('0xd0')]=function(_0x1a58c6){return BPromise[_0x084a('0xba')]()[_0x084a('0xbb')](voiceQueueRt['getVoiceQueueRtPauses'](_0x1a58c6))[_0x084a('0xbe')](loggerCatch(_0x084a('0xd1')));};Dialer[_0x084a('0x1c')][_0x084a('0xd2')]=function(_0x1957a0){return BPromise[_0x084a('0xba')]()[_0x084a('0xbb')](cmHopper['moveContactManagedDialer'](_0x1957a0))[_0x084a('0xbe')](loggerCatch(_0x084a('0xd3')));};Dialer[_0x084a('0x1c')][_0x084a('0xd4')]=function(_0x3e51c0){return BPromise[_0x084a('0xba')]()[_0x084a('0xbb')](cmHopperHistory[_0x084a('0xd4')](_0x3e51c0))[_0x084a('0xbe')](loggerCatch(_0x084a('0xd5')));};Dialer[_0x084a('0x1c')][_0x084a('0xb7')]=function(_0x3ff42e){if(!_[_0x084a('0x3e')](_0x3ff42e)&&_0x3ff42e!==null){if(typeof _0x3ff42e[_0x084a('0x77')]!==_0x084a('0x9e')){if(_0x3ff42e[_0x084a('0x77')]>0x0){_0x3ff42e['originated']-=0x1;}else{logger[_0x084a('0x9d')](_0x084a('0xd6'));}}}else{logger[_0x084a('0x9d')](_0x084a('0xd7'));}};Dialer['prototype'][_0x084a('0xd8')]=function(_0x142449,_0x4662f9){var _0x23df0c=this;return function(_0x17b8e6){_0x23df0c[_0x084a('0xb7')](_0x4662f9);logger['error'](_0x142449,util['inspect'](_0x17b8e6,{'showHidden':![],'depth':null}));};};Dialer[_0x084a('0x1c')][_0x084a('0xd9')]=function(_0x459907,_0x3b89f6,_0x3dd10e){var _0x3565f5={'state':0x19,'statedesc':_0x084a('0xda')};this[_0x084a('0xb7')](_0x3b89f6);this['saveInDb'](_[_0x084a('0x95')](_0x3565f5,_[_0x084a('0xdb')](_0x3dd10e,[_0x084a('0xdc'),_0x084a('0xdd'),'UserId','VoiceQueueId',_0x084a('0xde')])),_0x084a('0xdf'),_0x084a('0xe0'));logger[_0x084a('0x9d')](_0x459907);};Dialer[_0x084a('0x1c')]['isSuccess']=function(_0x57ed50){return _0x57ed50==='Success';};Dialer[_0x084a('0x1c')][_0x084a('0xe1')]=function(_0x5dab17){return!_[_0x084a('0x3e')](_0x5dab17)&&_0x5dab17&&!_[_0x084a('0x3e')](_0x5dab17['name'])&&!_[_0x084a('0x3e')](_0x5dab17[_0x084a('0x7c')])&&_0x5dab17[_0x084a('0x7c')]&&(this['trunks'][util[_0x084a('0x7e')](_0x084a('0xe2'),_0x5dab17[_0x084a('0x41')])][_0x084a('0xb2')]===_0x084a('0xe3')||this[_0x084a('0x24')][util['format'](_0x084a('0xe2'),_0x5dab17['name'])][_0x084a('0xb2')]==='unmonitored');};Dialer[_0x084a('0x1c')][_0x084a('0xe4')]=function(_0x43f940,_0x358e01,_0x19215b){this[_0x084a('0xd4')](_0x43f940)[_0x084a('0xbe')](loggerCatch(_0x358e01));this[_0x084a('0xd2')](_0x43f940)[_0x084a('0xbe')](loggerCatch(_0x19215b));};Dialer[_0x084a('0x1c')][_0x084a('0xe5')]=function(_0x193db9){var _0x557b25=this[_0x084a('0x29')][_0x193db9[_0x084a('0xe6')]];var _0x30f34d;if(!_[_0x084a('0xb0')](_0x193db9)&&!_[_0x084a('0xb0')](_0x193db9[_0x084a('0xe7')])&&!_[_0x084a('0xb0')](_0x193db9[_0x084a('0xe7')]['amdstatus'])&&_0x193db9['exten']==='xcally-motion-dialer'&&_0x557b25){if(_0x557b25[_0x084a('0x51')]!==_0x084a('0x80')&&this[_0x084a('0x21')][_0x557b25[_0x084a('0xb5')]][_0x084a('0xe8')]&&_0x193db9[_0x084a('0xe9')]===_0x084a('0xea')){delete this[_0x084a('0x29')][_0x193db9[_0x084a('0xe6')]];this[_0x084a('0xb7')](this[_0x084a('0x21')][_0x557b25[_0x084a('0xb5')]]);this[_0x084a('0x21')][_0x557b25[_0x084a('0xb5')]][_0x084a('0xeb')]+=0x1;this[_0x084a('0x21')][_0x557b25[_0x084a('0xb5')]][_0x084a('0x63')]+=0x1;_0x30f34d=new Hangup(_0x557b25,_0x193db9);_0x30f34d[_0x084a('0xab')]=0x12;_0x30f34d[_0x084a('0xac')]=_0x084a('0xec');_0x30f34d['membername']=_0x084a('0xed');ami[_0x084a('0x50')](_0x084a('0xee'),ut['buildObj'](_0x30f34d,_0x084a('0xef')));this[_0x084a('0xe4')](_0x30f34d,_0x084a('0xf0'),_0x084a('0xf1'));}if(_0x557b25['type']!==_0x084a('0x80')&&this[_0x084a('0x21')][_0x557b25['queue']][_0x084a('0xe8')]&&_0x193db9['value']==='MACHINE'){var _0x3c7310=this;return new BPromise(function(_0x163ee0,_0x270c3e){delete _0x3c7310[_0x084a('0x29')][_0x193db9[_0x084a('0xe6')]];_0x3c7310['updateOriginated'](_0x3c7310[_0x084a('0x21')][_0x557b25[_0x084a('0xb5')]]);_0x3c7310[_0x084a('0x21')][_0x557b25[_0x084a('0xb5')]][_0x084a('0xeb')]+=0x1;_0x3c7310[_0x084a('0x21')][_0x557b25['queue']][_0x084a('0x63')]+=0x1;var _0x5e988c=_0x3c7310[_0x084a('0x21')][_0x557b25[_0x084a('0xb5')]];var _0x409c4e=new Hangup(_0x557b25,_0x193db9);_0x409c4e[_0x084a('0xab')]=0x13;_0x409c4e['statedesc']='Machine';_0x409c4e[_0x084a('0xf2')]='AMD';_0x409c4e[_0x084a('0xf3')]+=0x1;_0x409c4e[_0x084a('0xf4')]+=0x1;_0x409c4e[_0x084a('0xef')]=!![];ami[_0x084a('0x50')]('custom:amd',ut['buildObj'](_0x409c4e,'amd'));_0x3c7310['createHistory'](_0x409c4e)['catch'](loggerCatch(_0x084a('0xf5')));if(_0x409c4e[_0x084a('0xf6')]+_0x409c4e[_0x084a('0xf7')]+_0x409c4e[_0x084a('0xf8')]+_0x409c4e[_0x084a('0xf9')]+_0x409c4e[_0x084a('0xfa')]+_0x409c4e[_0x084a('0xfb')]+_0x409c4e[_0x084a('0xf3')]+_0x409c4e[_0x084a('0xfc')]>=_0x5e988c['dialGlobalMaxRetry']){_0x3c7310[_0x084a('0xfd')](_0x409c4e,_0x163ee0,_0x270c3e,_0x084a('0xfe'));}else{if(_0x409c4e['countmachineretry']>=_0x5e988c[_0x084a('0xff')]){_0x3c7310[_0x084a('0x100')](_0x409c4e,_0x163ee0,_0x270c3e,_0x084a('0x101'));}else{_0x3c7310[_0x084a('0xc7')]({'active':![],'countmachineretry':_0x409c4e[_0x084a('0xf3')],'scheduledat':moment()[_0x084a('0x102')](_0x5e988c['dialMachineRetryFrequency'],_0x084a('0x103'))[_0x084a('0x7e')](_0x084a('0x104')),'ContactId':_0x409c4e[_0x084a('0xdc')],'ListId':_0x409c4e[_0x084a('0xdd')],'VoiceQueueId':_0x409c4e['VoiceQueueId']||undefined,'CampaignId':_0x409c4e[_0x084a('0xde')]||undefined})['catch'](loggerCatch(_0x084a('0x105')));_0x163ee0({'reschedule':0x1});}}});}if(_0x557b25[_0x084a('0x51')]===_0x084a('0x80')&&this['campaigns'][_0x557b25[_0x084a('0xb5')]][_0x084a('0xe8')]&&_0x193db9[_0x084a('0xe9')]===_0x084a('0xea')){delete this['uniqueId'][_0x193db9[_0x084a('0xe6')]];this[_0x084a('0xb7')](this[_0x084a('0x22')][_0x557b25[_0x084a('0xb5')]]);_0x30f34d=new Hangup(_0x557b25,_0x193db9);_0x30f34d[_0x084a('0xab')]=0x12;_0x30f34d[_0x084a('0xac')]='HangupInAMD';_0x30f34d[_0x084a('0xf2')]=_0x084a('0xed');ami[_0x084a('0x50')]('custom:amd',ut['buildObj'](_0x30f34d,_0x084a('0xef')));this[_0x084a('0xe4')](_0x30f34d,_0x084a('0x106'),_0x084a('0x107'));}if(_0x557b25[_0x084a('0x51')]===_0x084a('0x80')&&this[_0x084a('0x22')][_0x557b25[_0x084a('0xb5')]][_0x084a('0xe8')]&&_0x193db9['value']===_0x084a('0x108')){var _0x3c7310=this;return new BPromise(function(_0x22c26e,_0xd0b78c){delete _0x3c7310[_0x084a('0x29')][_0x193db9[_0x084a('0xe6')]];_0x3c7310[_0x084a('0xb7')](_0x3c7310['campaigns'][_0x557b25['queue']]);_0x3c7310[_0x084a('0x22')][_0x557b25['queue']]['outboundAnswerCallsDay']+=0x1;_0x3c7310[_0x084a('0x22')][_0x557b25[_0x084a('0xb5')]][_0x084a('0x63')]+=0x1;var _0x9c2089=_0x3c7310[_0x084a('0x22')][_0x557b25[_0x084a('0xb5')]];var _0x37ead4=new Hangup(_0x557b25,_0x193db9);_0x37ead4[_0x084a('0xab')]=0x13;_0x37ead4[_0x084a('0xac')]='Machine';_0x37ead4[_0x084a('0xf2')]=_0x084a('0xed');_0x37ead4['countmachineretry']+=0x1;_0x37ead4[_0x084a('0xf4')]+=0x1;_0x37ead4[_0x084a('0xef')]=!![];ami['emit'](_0x084a('0xee'),ut[_0x084a('0x109')](_0x37ead4,'amd'));_0x3c7310[_0x084a('0xd4')](_0x37ead4)[_0x084a('0xbe')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x37ead4['countbusyretry']+_0x37ead4[_0x084a('0xf7')]+_0x37ead4['countnoanswerretry']+_0x37ead4['countnosuchnumberretry']+_0x37ead4[_0x084a('0xfa')]+_0x37ead4['countabandonedretry']+_0x37ead4[_0x084a('0xf3')]+_0x37ead4[_0x084a('0xfc')]>=_0x9c2089[_0x084a('0x10a')]){_0x3c7310[_0x084a('0xfd')](_0x37ead4,_0x22c26e,_0xd0b78c,_0x084a('0xfe'));}else{if(_0x37ead4[_0x084a('0xf3')]>=_0x9c2089[_0x084a('0xff')]){_0x3c7310[_0x084a('0x100')](_0x37ead4,_0x22c26e,_0xd0b78c,'reason\x2019\x20machine....');}else{_0x3c7310[_0x084a('0xc7')]({'active':![],'countmachineretry':_0x37ead4[_0x084a('0xf3')],'scheduledat':moment()['add'](_0x9c2089['dialMachineRetryFrequency'],_0x084a('0x103'))['format'](_0x084a('0x104')),'ContactId':_0x37ead4['ContactId'],'ListId':_0x37ead4[_0x084a('0xdd')],'VoiceQueueId':_0x37ead4[_0x084a('0x10b')]||undefined,'CampaignId':_0x37ead4[_0x084a('0xde')]||undefined})['catch'](loggerCatch(_0x084a('0x105')));_0x22c26e({'reschedule':0x1});}}});}}};Dialer[_0x084a('0x1c')][_0x084a('0x10c')]=function(_0x3fc7cb){var _0x5bd87f=this['uniqueId'][_0x3fc7cb[_0x084a('0xe6')]];var _0x166b66=this;var _0x1b2826;if(_0x5bd87f&&_0x5bd87f[_0x084a('0x51')]===_0x084a('0x80')){delete this[_0x084a('0x29')][_0x3fc7cb['uniqueid']];this['updateOriginated'](this[_0x084a('0x22')][_0x5bd87f[_0x084a('0xb5')]]);this[_0x084a('0x22')][_0x5bd87f[_0x084a('0xb5')]][_0x084a('0x10d')]+=0x1;_0x1b2826=new Hangup(_0x5bd87f,_0x3fc7cb);this[_0x084a('0xd4')](_0x1b2826)[_0x084a('0xbe')](loggerCatch(_0x084a('0x10e')));this[_0x084a('0xd2')](_0x1b2826)[_0x084a('0xbe')](loggerCatch('[syncHangupIvr]'));}if(_0x5bd87f&&_0x5bd87f[_0x084a('0x51')]!==_0x084a('0x80')&&isNotNull(this['voiceQueues'][_0x5bd87f[_0x084a('0xb5')]][_0x084a('0x10f')])){delete this[_0x084a('0x29')][_0x3fc7cb[_0x084a('0xe6')]];this['updateOriginated'](this[_0x084a('0x21')][_0x5bd87f[_0x084a('0xb5')]]);this[_0x084a('0x21')][_0x5bd87f[_0x084a('0xb5')]]['outboundAnswerCallsDay']+=0x1;this[_0x084a('0x21')][_0x5bd87f[_0x084a('0xb5')]][_0x084a('0x63')]+=0x1;_0x1b2826=new Hangup(_0x5bd87f,_0x3fc7cb);_0x1b2826[_0x084a('0xab')]=0x10;_0x1b2826[_0x084a('0xac')]=_0x084a('0x110');_0x1b2826[_0x084a('0xf2')]='AGI';this['createHistory'](_0x1b2826)[_0x084a('0xbe')](loggerCatch(_0x084a('0x10e')));this[_0x084a('0xd2')](_0x1b2826)[_0x084a('0xbe')](loggerCatch(_0x084a('0x111')));}if(_0x5bd87f&&_0x5bd87f[_0x084a('0x51')]!=='ivr'&&!isNotNull(this[_0x084a('0x21')][_0x5bd87f[_0x084a('0xb5')]][_0x084a('0x10f')])){delete this[_0x084a('0x29')][_0x3fc7cb[_0x084a('0xe6')]];this['updateOriginated'](this[_0x084a('0x21')][_0x5bd87f[_0x084a('0xb5')]]);this['voiceQueues'][_0x5bd87f[_0x084a('0xb5')]]['outboundUnknownCallsDay']+=0x1;_0x1b2826=new Hangup(_0x5bd87f,_0x3fc7cb);_0x1b2826[_0x084a('0xab')]=0xc;_0x1b2826[_0x084a('0xac')]=_0x3fc7cb[_0x084a('0x112')];_0x1b2826[_0x084a('0xf2')]=_0x084a('0x113');this[_0x084a('0xd4')](_0x1b2826)['catch'](loggerCatch(_0x084a('0x10e')));this[_0x084a('0xd2')](_0x1b2826)[_0x084a('0xbe')](loggerCatch(_0x084a('0x111')));}};Dialer[_0x084a('0x1c')][_0x084a('0x36')]=function(_0x535a00){var _0x4f9c60=this[_0x084a('0x29')][_0x535a00[_0x084a('0xe6')]];var _0xdeb09f=this;if(this[_0x084a('0x21')][_0x535a00[_0x084a('0xb5')]]){if(_0x4f9c60&&_0x4f9c60[_0x084a('0x51')]!==_0x084a('0x80')){delete this['uniqueId'][_0x535a00['uniqueid']];this[_0x084a('0x21')][_0x535a00[_0x084a('0xb5')]]['outboundAnswerCallsDay']+=0x1;var _0x566772=new AgentComplete(_0x4f9c60,_0x535a00);if(_0x535a00[_0x084a('0x114')]===_0x084a('0x115')){_0x566772[_0x084a('0x116')]=this['voiceQueues'][_0x535a00['queue']][_0x084a('0x117')]&&this[_0x084a('0x21')][_0x535a00[_0x084a('0xb5')]][_0x084a('0x118')]?moment()[_0x084a('0x7e')](_0x084a('0x104')):undefined;}this[_0x084a('0xd4')](_0x566772)['catch'](loggerCatch(_0x084a('0x119')));this[_0x084a('0xd2')](_0x566772)['catch'](loggerCatch(_0x084a('0x11a')));}}};Dialer[_0x084a('0x1c')][_0x084a('0x11b')]=function(_0x5d17ff){if(this['voiceQueues'][_0x5d17ff[_0x084a('0xb5')]]){if(this[_0x084a('0x29')][_0x5d17ff[_0x084a('0xe6')]]&&this['uniqueId'][_0x5d17ff[_0x084a('0xe6')]][_0x084a('0x51')]!==_0x084a('0x80')){this['updateOriginated'](this[_0x084a('0x21')][_0x5d17ff[_0x084a('0xb5')]]);this[_0x084a('0x29')][_0x5d17ff[_0x084a('0xe6')]][_0x084a('0x11c')]=moment()[_0x084a('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x084a('0x1c')][_0x084a('0x11d')]=function(_0x1ba2e6,_0x9ad132){this['createHistory'](_0x1ba2e6)['catch'](loggerCatch(_0x084a('0x119')));if(_0x9ad132==0x0){this[_0x084a('0xd2')](_0x1ba2e6)['catch'](loggerCatch(_0x084a('0x11e')));}};Dialer[_0x084a('0x1c')][_0x084a('0x32')]=function(_0x44075c){var _0x5d545f=this[_0x084a('0x29')][_0x44075c['uniqueid']];var _0x311c40=this;var _0x3ca579=![];var _0x3a972d;var _0x4217f2;if(this[_0x084a('0x21')][_0x44075c[_0x084a('0xb5')]]){if(_0x5d545f&&_0x5d545f[_0x084a('0x51')]!=='ivr'){delete this[_0x084a('0x29')][_0x44075c[_0x084a('0xe6')]];this[_0x084a('0xb7')](this['voiceQueues'][_0x44075c[_0x084a('0xb5')]]);_0x5d545f['droptime']=moment()[_0x084a('0x7e')](_0x084a('0x104'));var _0x40e2d7=new QueueCallerAbandon(_0x5d545f,_0x44075c);if(getSeconds(_0x5d545f[_0x084a('0x11f')],_0x5d545f[_0x084a('0x120')])>=_0x5d545f[_0x084a('0x121')]){this[_0x084a('0x21')][_0x44075c[_0x084a('0xb5')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x084a('0x21')][_0x44075c['queue']][_0x084a('0x67')]+=0x1;this[_0x084a('0x21')][_0x44075c[_0x084a('0xb5')]][_0x084a('0x72')]+=0x1;_0x40e2d7[_0x084a('0xab')]=0xa;_0x40e2d7[_0x084a('0xac')]='Drop';_0x40e2d7[_0x084a('0x122')]=_0x084a('0x123');_0x40e2d7[_0x084a('0x116')]=this[_0x084a('0x21')][_0x44075c[_0x084a('0xb5')]][_0x084a('0x117')]?moment()[_0x084a('0x7e')](_0x084a('0x104')):undefined;_0x40e2d7[_0x084a('0xfa')]+=0x1;_0x40e2d7[_0x084a('0xf4')]+=0x1;_0x3a972d=this[_0x084a('0x21')][_0x44075c[_0x084a('0xb5')]][_0x084a('0x124')];_0x4217f2=this[_0x084a('0x21')][_0x44075c[_0x084a('0xb5')]][_0x084a('0x125')];_0x311c40[_0x084a('0xc0')](_0x40e2d7,_0x40e2d7[_0x084a('0xab')],_0x5d545f[_0x084a('0x126')])['then'](function(_0x3989bd){_0x3ca579=_0x3989bd[_0x084a('0x127')]==0x1;if(_0x40e2d7[_0x084a('0xfa')]>=_0x311c40[_0x084a('0x21')][_0x44075c[_0x084a('0xb5')]][_0x084a('0x128')]){_0x311c40['queueCallerAbandonCreateState'](_0x40e2d7,_0x3989bd[_0x084a('0x127')]);}else{_0x311c40[_0x084a('0xc7')]({'active':![],'countdropretry':_0x40e2d7[_0x084a('0xfa')],'scheduledat':moment()['add'](this[_0x084a('0x21')][_0x44075c[_0x084a('0xb5')]]['dialDropRetryFrequency'],_0x084a('0x103'))[_0x084a('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5d545f[_0x084a('0xdc')],'ListId':_0x5d545f[_0x084a('0xdd')],'VoiceQueueId':_0x5d545f[_0x084a('0x10b')]||undefined,'CampaignId':_0x5d545f[_0x084a('0xde')]||undefined})[_0x084a('0xbe')](loggerCatch(_0x084a('0x129')));var _0x3d49e6=new History(_0x40e2d7);_0x3d49e6['state']=0xa;_0x3d49e6['statedesc']=_0x084a('0x12a');_0x3d49e6['starttime']=moment()[_0x084a('0x7e')](_0x084a('0x104'));_0x3d49e6['endtime']=_0x3d49e6[_0x084a('0x12b')];_0x3d49e6[_0x084a('0x12c')]=_0x40e2d7[_0x084a('0x12c')];_0x3d49e6['calleridnum']=_0x40e2d7[_0x084a('0x12d')];_0x311c40[_0x084a('0xd4')](_0x3d49e6)[_0x084a('0xbe')](loggerCatch(_0x084a('0x12e')));}})[_0x084a('0xbb')](function(_0x20aee6){if(_0x3ca579)_0x311c40['swapAdditionalPhones'](_0x40e2d7,_0x3a972d,_0x4217f2)['then'](function(_0x56daf2){return 0x1;});});}else{this['voiceQueues'][_0x44075c[_0x084a('0xb5')]][_0x084a('0x89')]+=0x1;this[_0x084a('0x21')][_0x44075c['queue']][_0x084a('0x66')]+=0x1;_0x40e2d7[_0x084a('0xab')]=0xb;_0x40e2d7[_0x084a('0xac')]=_0x084a('0x12f');_0x40e2d7[_0x084a('0x122')]=_0x084a('0x130');_0x40e2d7[_0x084a('0xfb')]+=0x1;_0x40e2d7[_0x084a('0xf4')]+=0x1;_0x3a972d=this[_0x084a('0x21')][_0x44075c[_0x084a('0xb5')]][_0x084a('0x131')];_0x4217f2=this[_0x084a('0x21')][_0x44075c[_0x084a('0xb5')]][_0x084a('0x125')];_0x311c40[_0x084a('0xc0')](_0x40e2d7,_0x40e2d7[_0x084a('0xab')],_0x5d545f[_0x084a('0x126')])[_0x084a('0xbb')](function(_0x8e3b8f){if(_0x40e2d7[_0x084a('0xfb')]>=_0x311c40[_0x084a('0x21')][_0x44075c[_0x084a('0xb5')]][_0x084a('0x132')]){_0x311c40['queueCallerAbandonCreateState'](_0x40e2d7,_0x8e3b8f['additional']);}else{_0x311c40[_0x084a('0xc7')]({'active':![],'countabandonedretry':_0x40e2d7['countabandonedretry'],'scheduledat':moment()[_0x084a('0x102')](this[_0x084a('0x21')][_0x44075c['queue']][_0x084a('0x131')],_0x084a('0x103'))[_0x084a('0x7e')](_0x084a('0x104')),'ContactId':_0x5d545f['ContactId'],'ListId':_0x5d545f['ListId'],'VoiceQueueId':_0x5d545f[_0x084a('0x10b')]||undefined,'CampaignId':_0x5d545f[_0x084a('0xde')]||undefined})[_0x084a('0xbe')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x4e917b=new History(_0x40e2d7);_0x4e917b[_0x084a('0xab')]=0xb;_0x4e917b[_0x084a('0xac')]=_0x084a('0x12f');_0x4e917b['starttime']=moment()[_0x084a('0x7e')](_0x084a('0x104'));_0x4e917b['endtime']=_0x4e917b[_0x084a('0x12b')];_0x4e917b[_0x084a('0x12c')]=_0x40e2d7[_0x084a('0x12c')];_0x4e917b[_0x084a('0x12d')]=_0x40e2d7['calleridnum'];_0x311c40[_0x084a('0xd4')](_0x4e917b)[_0x084a('0xbe')](loggerCatch(_0x084a('0x133')));}})['then'](function(_0x55d986){if(_0x3ca579)_0x311c40[_0x084a('0xc1')](_0x40e2d7,_0x3a972d,_0x4217f2)[_0x084a('0xbb')](function(_0x41be24){return 0x1;});});}}}};Dialer[_0x084a('0x1c')][_0x084a('0x134')]=function(_0x4923f8){if(this['actions'][_0x4923f8[_0x084a('0xe6')]]){this[_0x084a('0x27')][_0x4923f8[_0x084a('0xe6')]][_0x084a('0xb3')]=_0x4923f8[_0x084a('0xb3')];}if(this[_0x084a('0x29')][_0x4923f8[_0x084a('0xe6')]]){this[_0x084a('0x29')][_0x4923f8[_0x084a('0xe6')]][_0x084a('0xb3')]=_0x4923f8[_0x084a('0xb3')];}};Dialer[_0x084a('0x1c')][_0x084a('0x39')]=function(_0x416b45){if(strategy[this['voiceQueues'][this[_0x084a('0x27')][_0x416b45['actionid']][_0x084a('0xb5')]][_0x084a('0x53')]]==='roundrobin'){if(this[_0x084a('0x27')][_0x416b45['actionid']]&&_[_0x084a('0xb0')](this[_0x084a('0x27')][_0x416b45['actionid']][_0x084a('0x135')])&&_0x416b45[_0x084a('0xb2')]==='1'&&_0x416b45['paused']==='0'){if(this[_0x084a('0x23')][_0x416b45[_0x084a('0x136')]]){if(!this[_0x084a('0x23')][_0x416b45[_0x084a('0x136')]][_0x084a('0x135')]){this[_0x084a('0x23')][_0x416b45['stateinterface']][_0x084a('0x135')]=!![];this[_0x084a('0x27')][_0x416b45['actionid']][_0x084a('0x135')]=!![];this['actions'][_0x416b45['actionid']][_0x084a('0x136')]=_0x416b45['stateinterface'];}}}}else if((strategy[this[_0x084a('0x21')][this[_0x084a('0x27')][_0x416b45['actionid']]['queue']][_0x084a('0x53')]]||_0x084a('0x1b'))===_0x084a('0x1b')){if(this[_0x084a('0x27')][_0x416b45[_0x084a('0x137')]]){if(this['agents'][_0x416b45['stateinterface']]){this[_0x084a('0x27')][_0x416b45[_0x084a('0x137')]][_0x084a('0x136')]=_0x416b45[_0x084a('0x136')];if(_[_0x084a('0xb0')](this[_0x084a('0x2d')][this[_0x084a('0x27')][_0x416b45[_0x084a('0x137')]][_0x084a('0xb5')]])){this[_0x084a('0x2d')][this[_0x084a('0x27')][_0x416b45['actionid']][_0x084a('0xb5')]]=[];}this[_0x084a('0x2d')][this[_0x084a('0x27')][_0x416b45['actionid']][_0x084a('0xb5')]][_0x084a('0x138')](_['merge'](_[_0x084a('0xdb')](this[_0x084a('0x27')][_0x416b45['actionid']],[_0x084a('0x139'),_0x084a('0x136')]),{'status':_0x416b45[_0x084a('0xb2')],'paused':_0x416b45[_0x084a('0x13a')]}));}}}};function unlockQueueStatus(_0x594fee,_0x1abe6b){setTimeout(function(){if(_[_0x084a('0x3e')](_0x594fee[_0x084a('0x13b')])){loggerBooked[_0x084a('0x9d')](_0x084a('0x13c'),_0x1abe6b);}_0x594fee[_0x084a('0x13b')]=!![];loggerBooked['info'](_0x084a('0x13d'),_0x1abe6b,JSON[_0x084a('0x4c')](_[_0x084a('0xdb')](_0x594fee,['name',_0x084a('0x13b')])));},0x1f3);}Dialer['prototype'][_0x084a('0x3b')]=function(_0x433118){var _0x587e31=this;var _0x5f3394=_0x587e31[_0x084a('0x21')][_0x587e31[_0x084a('0x27')][_0x433118[_0x084a('0x137')]][_0x084a('0xb5')]];if(strategy[this[_0x084a('0x21')][this[_0x084a('0x27')][_0x433118[_0x084a('0x137')]][_0x084a('0xb5')]][_0x084a('0x53')]]==='roundrobin'){if(this[_0x084a('0x27')][_0x433118[_0x084a('0x137')]]&&this[_0x084a('0x27')][_0x433118[_0x084a('0x137')]]['stateinterface']){this['preview'][_0x084a('0x13e')](this[_0x084a('0x27')][_0x433118[_0x084a('0x137')]]['idHopper'],this['actions'][_0x433118[_0x084a('0x137')]][_0x084a('0x136')])[_0x084a('0xbe')](function(_0x265dd6){logger[_0x084a('0x9d')](_0x084a('0x13f'),util['inspect'](_0x265dd6,{'showHidden':![],'depth':null}));})[_0x084a('0x1f')](function(){_0x587e31[_0x084a('0xb7')](_0x587e31[_0x084a('0x21')][_0x587e31[_0x084a('0x27')][_0x433118[_0x084a('0x137')]][_0x084a('0xb5')]]);_0x587e31['agents'][_0x587e31[_0x084a('0x27')][_0x433118[_0x084a('0x137')]][_0x084a('0x136')]][_0x084a('0x135')]=![];delete _0x587e31[_0x084a('0x27')][_0x433118['actionid']];unlockQueueStatus(_0x5f3394);});}else{this[_0x084a('0xb7')](this[_0x084a('0x21')][this[_0x084a('0x27')][_0x433118['actionid']]['queue']]);this[_0x084a('0xc7')]({'active':![],'ContactId':this[_0x084a('0x27')][_0x433118[_0x084a('0x137')]][_0x084a('0xdc')],'ListId':this['actions'][_0x433118[_0x084a('0x137')]][_0x084a('0xdd')],'VoiceQueueId':this[_0x084a('0x27')][_0x433118[_0x084a('0x137')]][_0x084a('0x10b')]||undefined,'CampaignId':this[_0x084a('0x27')][_0x433118[_0x084a('0x137')]][_0x084a('0xde')]||undefined})[_0x084a('0xbe')](loggerCatch(_0x084a('0x140')));delete this['actions'][_0x433118[_0x084a('0x137')]];unlockQueueStatus(_0x5f3394);}}else if((strategy[this[_0x084a('0x21')][this[_0x084a('0x27')][_0x433118[_0x084a('0x137')]]['queue']][_0x084a('0x53')]]||'rrmemory')==='rrmemory'){var _0x5ddd90;if(this[_0x084a('0x27')][_0x433118[_0x084a('0x137')]]&&!_[_0x084a('0x48')](this['queueBooked'][this[_0x084a('0x27')][_0x433118[_0x084a('0x137')]][_0x084a('0xb5')]])){if(this['queueBookedRR'][_0x587e31['actions'][_0x433118['actionid']][_0x084a('0xb5')]]){this[_0x084a('0x2e')][_0x587e31[_0x084a('0x27')][_0x433118[_0x084a('0x137')]][_0x084a('0xb5')]]=this['queueBookedRR'][this[_0x084a('0x27')][_0x433118[_0x084a('0x137')]][_0x084a('0xb5')]]?this[_0x084a('0x2e')][this[_0x084a('0x27')][_0x433118[_0x084a('0x137')]][_0x084a('0xb5')]]:this[_0x084a('0x2d')][this[_0x084a('0x27')][_0x433118['actionid']][_0x084a('0xb5')]]?this[_0x084a('0x2d')][this[_0x084a('0x27')][_0x433118[_0x084a('0x137')]]['queue']][_0x084a('0x141')]||0x0:0x0;}this['queueBooked'][this[_0x084a('0x27')][_0x433118[_0x084a('0x137')]]['queue']][_0x084a('0x141')]=this[_0x084a('0x2e')][this[_0x084a('0x27')][_0x433118[_0x084a('0x137')]]['queue']];for(var _0x32692f=0x0;_0x32692f=0x0;})[_0x084a('0xbe')](myreject(_0x45a4ff)));}}else{_0x507662[_0x084a('0x138')](ami[_0x084a('0xb1')]({'action':'command','command':util[_0x084a('0x7e')](_0x084a('0x15b'),_0x1a5edd,!_[_0x084a('0x3e')](config[_0x084a('0x156')][_0x4660bc])?_0x4660bc:'')})[_0x084a('0xbb')](function(_0x575e73){return _0x575e73['content'][_0x084a('0x15c')](_0x084a('0x15d'))>=0x0;})[_0x084a('0xbe')](myreject(_0x45a4ff)));}BPromise['all'](_0x507662)[_0x084a('0xbb')](function(_0x427e25){var _0x116a52=_[_0x084a('0x15e')](_0x427e25);if(_0x116a52){return _0x1c65b9(_0x116a52);}else{_0x247bd3[_0x084a('0x3f')]=_0x474000?_0x084a('0x15f'):_0x084a('0x160');return _0x45a4ff(msgResponse('[ifTime][promiseAll]',_0x084a('0x153'),_0x084a('0x161')+_0x474000+'\x20'+_0x270cfc+_0x084a('0x162')+util['inspect'](_0x1a5edd,{'showHidden':![],'depth':null})+_0x084a('0x163')+_0x4660bc));}})[_0x084a('0xbe')](function(_0x220e5a){return _0x45a4ff(msgResponse('ifTime','Failure',JSON['stringify'](_0x220e5a)));});});};Dialer['prototype'][_0x084a('0x164')]=function(_0x2baa78){var _0x4dedb2=this;return function(){switch(_0x2baa78[_0x084a('0x5f')]){case _0x084a('0x165'):freeVariablesPredictive(_0x2baa78);_0x4dedb2[_0x084a('0x166')](_0x2baa78,0x1);break;case _0x084a('0x167'):freeVariablesPredictive(_0x2baa78);_0x4dedb2['handlePower'](_0x2baa78,_0x2baa78['dialPowerLevel']);break;case'predictive':_0x4dedb2[_0x084a('0x9')](_0x2baa78);break;case'booked':freeVariablesPredictive(_0x2baa78);_0x4dedb2[_0x084a('0x166')](_0x2baa78,0x1);break;default:freeVariablesPredictive(_0x2baa78);logger[_0x084a('0x9d')](_0x084a('0x168'),_0x2baa78[_0x084a('0x41')],_0x084a('0x169'));}};};Dialer[_0x084a('0x1c')][_0x084a('0x16a')]=function(_0x5a4607){var _0x478655=this;return function(){_0x478655[_0x084a('0x16b')](_0x5a4607);};};Dialer[_0x084a('0x1c')][_0x084a('0xb')]=function(_0x4ec5e5){var _0x1e13ac=this;if(isNotPreview(_0x4ec5e5[_0x084a('0x5f')])){if(isVoiceQueueOutbound(_0x4ec5e5[_0x084a('0x51')])&&isActive(_0x4ec5e5[_0x084a('0x16c')])){_0x4ec5e5[_0x084a('0xa5')]=!![];BPromise[_0x084a('0xba')]()['then'](checkIsLoggedIn(_0x4ec5e5,_0x4ec5e5[_0x084a('0x56')]))[_0x084a('0xbb')](checkIsActive(_0x4ec5e5,_0x4ec5e5[_0x084a('0x16c')]))[_0x084a('0xbb')](checkInterval(_0x4ec5e5))[_0x084a('0xbb')](_0x1e13ac[_0x084a('0x14c')](_0x4ec5e5))[_0x084a('0xbb')](_0x1e13ac['checkIfTime'](_0x4ec5e5[_0x084a('0x16d')],_0x4ec5e5[_0x084a('0x16e')],_0x4ec5e5[_0x084a('0x41')],_0x4ec5e5))[_0x084a('0xbb')](_0x1e13ac[_0x084a('0x152')](_0x4ec5e5['Interval'],_0x4ec5e5[_0x084a('0x16e')],_0x4ec5e5[_0x084a('0x41')],_0x4ec5e5))[_0x084a('0xbb')](_0x1e13ac[_0x084a('0x164')](_0x4ec5e5))['catch'](loggerCatchQueueSummary(_0x084a('0x16f'),_0x4ec5e5));}else{notSendMessagesQueue(_0x4ec5e5);}}else{freeVariablesPredictive(_0x4ec5e5);}};Dialer[_0x084a('0x1c')]['syncCampaigns']=function(){var _0x44bb67=this;var _0x2f1a4c;for(var _0x89e888 in this['campaigns']){if(typeof this['campaigns'][_0x89e888]!==_0x084a('0x9e')){_0x2f1a4c=this[_0x084a('0x22')][_0x89e888];if(isCampaignIvr(_0x2f1a4c[_0x084a('0x51')])&&isActive(_0x2f1a4c['active'])){_0x2f1a4c[_0x084a('0xa5')]=!![];BPromise[_0x084a('0xba')]()[_0x084a('0xbb')](checkIsActive(_0x2f1a4c,_0x2f1a4c[_0x084a('0x7c')]))[_0x084a('0xbb')](checkInterval(_0x2f1a4c))[_0x084a('0xbb')](_0x44bb67['checkIsTrunkReachable'](_0x2f1a4c))[_0x084a('0xbb')](_0x44bb67[_0x084a('0x150')](_0x2f1a4c[_0x084a('0x16d')],_0x2f1a4c[_0x084a('0x16e')],_0x2f1a4c[_0x084a('0x41')],_0x2f1a4c))[_0x084a('0xbb')](_0x44bb67[_0x084a('0x152')](_0x2f1a4c['Interval'],_0x2f1a4c['dialTimezone'],_0x2f1a4c[_0x084a('0x41')],_0x2f1a4c))['then'](_0x44bb67['launchHandleIvr'](_0x2f1a4c))[_0x084a('0xbe')](loggerCatchQueueSummary(_0x084a('0x170'),_0x2f1a4c));}else{notSendMessagesCampaign(_0x2f1a4c);}}}};function getCallerIdRandom(_0x3b55cc,_0x41647f){var _0x187b26;var _0x12d022;var _0x2dc406;if(_0x41647f<=0x0){_0x41647f=0x1;}_0x187b26=new RegExp(_0x084a('0x171')+_0x41647f+'}$');_0x12d022=Math[_0x084a('0x172')](0xa,_0x41647f-0x1);_0x2dc406=Math[_0x084a('0x172')](0xa,_0x41647f)-0x1;return util['format']('%s',_[_0x084a('0x173')](_0x3b55cc,_0x187b26,_[_0x084a('0x174')](_0x12d022,_0x2dc406)));}function extractCalleridName(_0x31d7cf){var _0x48488b=_0x31d7cf[_0x084a('0x175')](/"(.*?)"/);return _0x48488b?_0x48488b[0x1]:_0x31d7cf;}function extractCalleridNumber(_0x39d056){var _0x4e2c89=_0x39d056[_0x084a('0x175')](/<(.*?)>/);return _0x4e2c89?_0x4e2c89[0x1]:_0x39d056;}Dialer[_0x084a('0x1c')][_0x084a('0x176')]=function(_0x3e212c,_0x407768){var _0x1fc993=this;var _0x4563f0=uuid['v4']();this[_0x084a('0x27')][_0x4563f0]=new Action(_0x3e212c,_0x407768,_0x4563f0);return new BPromise(function(_0x1d2385,_0x3bbd19){if(_['isUndefined'](_0x3e212c)&&typeof _0x3e212c!==_0x084a('0x177')){return _0x3bbd19(msgResponse(_0x084a('0x178'),'Failure',_0x084a('0x179')));}if(_[_0x084a('0x3e')](_0x407768[_0x084a('0x17a')])||_0x407768[_0x084a('0x17a')]===null){return _0x3bbd19(msgResponse(_0x084a('0x178'),_0x084a('0x153'),_0x084a('0x17b')));}var _0x2c6ab8={'XMD-CALLERID':_0x1fc993[_0x084a('0x27')][_0x4563f0]['getCaller'](),'XMD-AGI':_0x3e212c[_0x084a('0x10f')]?util[_0x084a('0x7e')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3e212c[_0x084a('0x10f')]):_0x084a('0x17c'),'XMD-AGIAFTER':_0x3e212c[_0x084a('0x117')]?util[_0x084a('0x7e')](_0x084a('0x17d'),ipAgi,_0x3e212c[_0x084a('0x117')]):'NONE','XMD-QUEUE':_0x3e212c[_0x084a('0x51')]==='outbound'?util[_0x084a('0x7e')](_0x084a('0x17e'),_0x3e212c[_0x084a('0x41')],_0x3e212c[_0x084a('0x17f')]||'',_0x3e212c['dialAgiAfterHangupAgent']?'c':'',_0x3e212c[_0x084a('0x121')]||0x3):_0x084a('0x17c'),'XMD-CONTACTID':_0x407768['ContactId'],'XMD-CDRTYPE':_0x084a('0x7'),'CALLERID(all)':_0x1fc993[_0x084a('0x27')][_0x4563f0][_0x084a('0x180')](),'XMD-AMD':_0x3e212c[_0x084a('0xe8')]?_0x084a('0x181'):'NONE','XMD-DESTINATION':_0x084a('0x182')};if(_0x3e212c[_0x084a('0xe8')]){_0x2c6ab8['XMD-AMDINITIALSILENCE']=_0x3e212c[_0x084a('0x183')]||0x9c4;_0x2c6ab8[_0x084a('0x184')]=_0x3e212c[_0x084a('0x185')]||0x5dc;_0x2c6ab8[_0x084a('0x186')]=_0x3e212c[_0x084a('0x187')]||0x320;_0x2c6ab8[_0x084a('0x188')]=_0x3e212c[_0x084a('0x189')]||0x1388;_0x2c6ab8[_0x084a('0x18a')]=_0x3e212c[_0x084a('0x18b')]||0x64;_0x2c6ab8[_0x084a('0x18c')]=_0x3e212c[_0x084a('0x18d')]||0x32;_0x2c6ab8[_0x084a('0x18e')]=_0x3e212c[_0x084a('0x18f')]||0x3;_0x2c6ab8[_0x084a('0x190')]=_0x3e212c[_0x084a('0x191')]||0x100;_0x2c6ab8[_0x084a('0x192')]=_0x3e212c['dialAMDMaximumWordLength']||0x1388;}if(_0x3e212c[_0x084a('0x51')]===_0x084a('0x52')){_0x2c6ab8[_0x084a('0x193')]=_0x407768[_0x084a('0x10b')];}else{_0x2c6ab8[_0x084a('0x194')]=_0x407768['CampaignId'];}for(var _0x3fc7ca in _0x407768['Contact']){if(typeof _0x407768[_0x084a('0x195')][_0x3fc7ca]!=='undefined'){if(isNotNull(_0x407768[_0x084a('0x195')][_0x3fc7ca])&&_0x3fc7ca!=='id'&&_0x3fc7ca!=='tags'&&_0x3fc7ca!==_0x084a('0x196')&&_0x3fc7ca!==_0x084a('0x197')){_0x2c6ab8[util[_0x084a('0x7e')](_0x084a('0x198'),'XMD-',_[_0x084a('0x199')](_0x3fc7ca))]=_0x407768[_0x084a('0x195')][_0x3fc7ca];}}}var _0x4c78dd=_0x1fc993[_0x084a('0xe1')](_0x3e212c[_0x084a('0x7b')])?getCallerId(_0x3e212c['Trunk'][_0x084a('0x7d')],_0x3e212c[_0x084a('0x60')],_0x3e212c[_0x084a('0x19a')]>0x0?getCallerIdRandom(_0x3e212c['dialOriginateCallerIdNumber'],_0x3e212c[_0x084a('0x19a')]):_0x3e212c['dialOriginateCallerIdNumber']):getCallerId(_['isNil'](_0x3e212c[_0x084a('0x14d')])?_0x3e212c[_0x084a('0x7b')][_0x084a('0x7d')]:_0x3e212c['TrunkBackup'][_0x084a('0x7d')],_0x3e212c[_0x084a('0x60')],_0x3e212c[_0x084a('0x19a')]>0x0?getCallerIdRandom(_0x3e212c['dialOriginateCallerIdNumber'],_0x3e212c[_0x084a('0x19a')]):_0x3e212c['dialOriginateCallerIdNumber']);if(_0x4c78dd){_0x2c6ab8['XMD-ORIGINATECALLERIDNAME']=_0x1fc993[_0x084a('0x27')][_0x4563f0]['originatecalleridname']=extractCalleridName(_0x4c78dd);_0x2c6ab8[_0x084a('0x19b')]=_0x407768[_0x084a('0x17a')];}return ami['Action']({'actionid':_0x4563f0,'action':_0x084a('0x178'),'channel':_0x1fc993[_0x084a('0xe1')](_0x3e212c[_0x084a('0x7b')])?util['format'](_0x084a('0x19c'),_0x3e212c[_0x084a('0x7b')]['name'],isNotNull(_0x3e212c[_0x084a('0x62')])?_0x3e212c[_0x084a('0x62')][_0x084a('0x19d')]()||'':'',_0x3e212c['dialCutDigit']>0x0?_0x407768[_0x084a('0x17a')][_0x084a('0x19e')](_0x3e212c['dialCutDigit']):_0x407768[_0x084a('0x17a')]):util[_0x084a('0x7e')](_0x084a('0x19c'),_['isNil'](_0x3e212c[_0x084a('0x14d')])?_0x3e212c[_0x084a('0x7b')][_0x084a('0x41')]:_0x3e212c['TrunkBackup'][_0x084a('0x41')],isNotNull(_0x3e212c['dialPrefix'])?_0x3e212c[_0x084a('0x62')]['trim']()||'':'',_0x3e212c[_0x084a('0x19f')]>0x0?_0x407768[_0x084a('0x17a')][_0x084a('0x19e')](_0x3e212c[_0x084a('0x19f')]):_0x407768[_0x084a('0x17a')]),'callerid':_0x4c78dd,'Exten':_0x084a('0x182'),'Context':_0x084a('0x1a0'),'Priority':'1','variable':_0x2c6ab8,'timeout':(_0x3e212c['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4563f0})[_0x084a('0xbb')](function(_0x4656af){return _0x1d2385(_0x4656af);})['catch'](function(_0x5b7057){_0x3e212c[_0x084a('0x6a')]+=0x1;var _0x53973d=new History(_0x1fc993[_0x084a('0x27')][_0x4563f0]);logger[_0x084a('0x9d')](util[_0x084a('0x7e')](_0x084a('0x1a1'),JSON['stringify'](_0x5b7057)));_0x53973d[_0x084a('0xab')]=0xe;_0x53973d[_0x084a('0xac')]=_0x084a('0x1a2');_0x53973d[_0x084a('0x12b')]=moment()[_0x084a('0x7e')](_0x084a('0x104'));_0x53973d[_0x084a('0xad')]=_0x53973d[_0x084a('0x12b')];_0x1fc993[_0x084a('0xd4')](_0x53973d)[_0x084a('0xbe')](loggerCatch('[originate][error]'));_0x1fc993[_0x084a('0xd2')](_0x53973d)[_0x084a('0xbe')](loggerCatch(_0x084a('0x1a3')))[_0x084a('0x1f')](function(){delete _0x1fc993[_0x084a('0x27')][_0x4563f0];return _0x3bbd19(msgResponse(_0x084a('0x178'),_0x084a('0x4b'),'originate\x20action\x20Error'));});});});};Dialer[_0x084a('0x1c')]['syncOriginateResponse']=function(_0x5a70f6){var _0x50ec2a=this['actions'][_0x5a70f6[_0x084a('0x137')]];if(_0x50ec2a){delete this[_0x084a('0x27')][_0x5a70f6[_0x084a('0x137')]];_0x50ec2a[_0x084a('0x120')]=moment()[_0x084a('0x7e')](_0x084a('0x104'));var _0x5a3ec0=_0x50ec2a[_0x084a('0x51')]===_0x084a('0x80')?this[_0x084a('0x22')][_0x50ec2a[_0x084a('0xb5')]]:this[_0x084a('0x21')][_0x50ec2a[_0x084a('0x1a4')]()];if(!this['isSuccess'](_0x5a70f6[_0x084a('0x1a5')])){this[_0x084a('0xb7')](_0x5a3ec0);return this[_0x084a('0x1a6')](_0x50ec2a,_0x5a3ec0,_0x5a70f6)[_0x084a('0xbe')](loggerCatch(_0x084a('0x1a7')));}this[_0x084a('0x29')][_0x5a70f6['uniqueid']]=_0x50ec2a;}};Dialer['prototype'][_0x084a('0x1a8')]=function(_0x2f8de9,_0x764550,_0x2a42cb){var _0x1ebcca=new History(_0x764550);if(_0x1ebcca[_0x084a('0xf6')]+_0x1ebcca[_0x084a('0xf7')]+_0x1ebcca[_0x084a('0xf8')]+_0x1ebcca[_0x084a('0xf9')]+_0x1ebcca[_0x084a('0xfa')]+_0x1ebcca[_0x084a('0xfb')]+_0x1ebcca[_0x084a('0xf3')]+_0x1ebcca[_0x084a('0xfc')]>=_0x2a42cb[_0x084a('0x10a')]-0x1){return!![];}switch(_0x2f8de9){case 0x3:if(_0x1ebcca[_0x084a('0xf8')]>=_0x2a42cb[_0x084a('0x1a9')]-0x1){return!![];}this[_0x084a('0xc7')]({'active':![],'countnoanswerretry':_0x1ebcca['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x084a('0x102')](_0x2a42cb[_0x084a('0x1aa')],_0x084a('0x103'))['format'](_0x084a('0x104')),'ContactId':_0x1ebcca['ContactId'],'ListId':_0x1ebcca['ListId'],'VoiceQueueId':_0x1ebcca['VoiceQueueId']||undefined,'CampaignId':_0x1ebcca[_0x084a('0xde')]||undefined})[_0x084a('0xbe')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x1ebcca[_0x084a('0xf6')]>=_0x2a42cb['dialBusyMaxRetry']-0x1){return!![];}this[_0x084a('0xc7')]({'active':![],'countbusyretry':_0x1ebcca[_0x084a('0xf6')]+=0x1,'scheduledat':moment()[_0x084a('0x102')](_0x2a42cb[_0x084a('0x1ab')],'minutes')[_0x084a('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ebcca[_0x084a('0xdc')],'ListId':_0x1ebcca[_0x084a('0xdd')],'VoiceQueueId':_0x1ebcca[_0x084a('0x10b')]||undefined,'CampaignId':_0x1ebcca[_0x084a('0xde')]||undefined})[_0x084a('0xbe')](loggerCatch(_0x084a('0x1ac')));break;case 0x8:if(_0x1ebcca[_0x084a('0xf7')]>=_0x2a42cb[_0x084a('0x1ad')]-0x1){return!![];}this[_0x084a('0xc7')]({'active':![],'countcongestionretry':_0x1ebcca[_0x084a('0xf7')]+=0x1,'scheduledat':moment()[_0x084a('0x102')](_0x2a42cb['dialCongestionRetryFrequency'],_0x084a('0x103'))[_0x084a('0x7e')](_0x084a('0x104')),'ContactId':_0x1ebcca[_0x084a('0xdc')],'ListId':_0x1ebcca[_0x084a('0xdd')],'VoiceQueueId':_0x1ebcca[_0x084a('0x10b')]||undefined,'CampaignId':_0x1ebcca[_0x084a('0xde')]||undefined})[_0x084a('0xbe')](loggerCatch(_0x084a('0x1ae')));break;case 0x0:if(_0x1ebcca[_0x084a('0xf9')]>=_0x2a42cb[_0x084a('0x1af')]-0x1){return!![];}else{this[_0x084a('0xc7')]({'active':![],'countnosuchnumberretry':_0x1ebcca[_0x084a('0xf9')]+=0x1,'scheduledat':moment()['add'](_0x2a42cb['dialNoSuchNumberRetryFrequency'],'minutes')['format'](_0x084a('0x104')),'ContactId':_0x1ebcca['ContactId'],'ListId':_0x1ebcca[_0x084a('0xdd')],'VoiceQueueId':_0x1ebcca[_0x084a('0x10b')]||undefined,'CampaignId':_0x1ebcca['CampaignId']||undefined})[_0x084a('0xbe')](loggerCatch(_0x084a('0x1b0')));}break;case 0xa:if(_0x1ebcca['countdropretry']>=_0x2a42cb[_0x084a('0x128')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x1ebcca[_0x084a('0xfa')]+=0x1,'scheduledat':moment()['add'](_0x2a42cb['dialDropRetryFrequency'],_0x084a('0x103'))[_0x084a('0x7e')](_0x084a('0x104')),'ContactId':_0x1ebcca[_0x084a('0xdc')],'ListId':_0x1ebcca['ListId'],'VoiceQueueId':_0x1ebcca[_0x084a('0x10b')]||undefined,'CampaignId':_0x1ebcca['CampaignId']||undefined})['catch'](loggerCatch(_0x084a('0x129')));break;case 0xb:if(_0x1ebcca[_0x084a('0xfb')]>=_0x2a42cb[_0x084a('0x132')]-0x1){return!![];}this[_0x084a('0xc7')]({'active':![],'countabandonedretry':_0x1ebcca['countabandonedretry']+=0x1,'scheduledat':moment()[_0x084a('0x102')](_0x2a42cb[_0x084a('0x131')],'minutes')[_0x084a('0x7e')](_0x084a('0x104')),'ContactId':_0x1ebcca[_0x084a('0xdc')],'ListId':_0x1ebcca[_0x084a('0xdd')],'VoiceQueueId':_0x1ebcca[_0x084a('0x10b')]||undefined,'CampaignId':_0x1ebcca[_0x084a('0xde')]||undefined})[_0x084a('0xbe')](loggerCatch(_0x084a('0x1b1')));break;case 0x13:if(_0x1ebcca[_0x084a('0xf3')]>=_0x2a42cb[_0x084a('0xff')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x1ebcca['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x2a42cb[_0x084a('0x1b2')],_0x084a('0x103'))[_0x084a('0x7e')](_0x084a('0x104')),'ContactId':_0x1ebcca[_0x084a('0xdc')],'ListId':_0x1ebcca[_0x084a('0xdd')],'VoiceQueueId':_0x1ebcca[_0x084a('0x10b')]||undefined,'CampaignId':_0x1ebcca['CampaignId']||undefined})[_0x084a('0xbe')](loggerCatch(_0x084a('0x105')));break;case 0x14:if(_0x1ebcca[_0x084a('0xfc')]>=_0x2a42cb['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x084a('0xc7')]({'active':![],'countagentrejectretry':_0x1ebcca[_0x084a('0xfc')]+=0x1,'scheduledat':moment()[_0x084a('0x102')](_0x2a42cb[_0x084a('0x1b3')],_0x084a('0x103'))[_0x084a('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ebcca['ContactId'],'ListId':_0x1ebcca['ListId'],'VoiceQueueId':_0x1ebcca[_0x084a('0x10b')]||undefined,'CampaignId':_0x1ebcca[_0x084a('0xde')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x084a('0x1c')]['callProgressDetecting']=function(_0x4ea122,_0x22f435,_0x1cc588){var _0x5c5057=this;var _0x4a0c0b=new History(_0x4ea122);var _0xbebbb8=![];var _0x558af1;var _0x4c45a5;return new BPromise(function(_0x4d1f35,_0x4588fc){if(_[_0x084a('0x3e')](_0x22f435)&&typeof _0x22f435!==_0x084a('0x177')){return _0x4588fc(msgResponse('[callProgressDetecting]',_0x084a('0x153'),_0x084a('0x1b4')));}if(_[_0x084a('0x3e')](_0x1cc588)&&typeof _0x1cc588!=='object'){return _0x4588fc(msgResponse('[callProgressDetecting]',_0x084a('0x153'),_0x084a('0x1b5')));}_0x5c5057[_0x084a('0xc0')](_0x4a0c0b,_0x1cc588[_0x084a('0x114')],_0x22f435)[_0x084a('0xbb')](function(_0x23d4a5){if(_0x23d4a5['additional']==0x1)_0xbebbb8=!![];switch(_0x1cc588[_0x084a('0x114')]){case'0':_0x22f435[_0x084a('0x69')]+=0x1;_0x4a0c0b[_0x084a('0xab')]=0x0;_0x4a0c0b[_0x084a('0xac')]='NoSuchNumber';_0x4a0c0b['countnosuchnumberretry']+=0x1;_0x4a0c0b['countglobal']+=0x1;ami[_0x084a('0x50')](_0x084a('0x1b6'),ut['buildObj'](_0x4ea122,_0x084a('0x1b7')));_0x558af1=_0x22f435['dialNoSuchNumberRetryFrequency'];_0x4c45a5=_0x22f435[_0x084a('0x125')];_0x5c5057[_0x084a('0xd4')](_0x4a0c0b)[_0x084a('0xbe')](loggerCatch(_0x084a('0xf5')));if(_0x5c5057[_0x084a('0x1a8')](0x0,_0x4ea122,_0x22f435)&&!_0xbebbb8){if(_0x4a0c0b['countnosuchnumberretry']>=_0x22f435[_0x084a('0x1af')]){_0x5c5057[_0x084a('0x100')](_0x4a0c0b,_0x4d1f35,_0x4588fc,_0x084a('0x1b8'));}else{_0x5c5057['stateGlobal'](_0x4a0c0b,_0x4d1f35,_0x4588fc,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x22f435[_0x084a('0x68')]+=0x1;_0x4a0c0b[_0x084a('0xab')]=0x3;_0x4a0c0b[_0x084a('0xac')]='NoAnswer';_0x4a0c0b[_0x084a('0xf8')]+=0x1;_0x4a0c0b[_0x084a('0xf4')]+=0x1;ami[_0x084a('0x50')](_0x084a('0x1b9'),ut[_0x084a('0x109')](_0x4ea122,_0x084a('0x1ba')));_0x558af1=_0x22f435['dialNoAnswerRetryFrequency'];_0x4c45a5=_0x22f435[_0x084a('0x125')];_0x5c5057['createHistory'](_0x4a0c0b)[_0x084a('0xbe')](loggerCatch(_0x084a('0x1bb')));if(_0x5c5057[_0x084a('0x1a8')](0x3,_0x4ea122,_0x22f435)&&!_0xbebbb8){if(_0x4a0c0b[_0x084a('0xf8')]>=_0x22f435[_0x084a('0x1a9')]){_0x5c5057[_0x084a('0x100')](_0x4a0c0b,_0x4d1f35,_0x4588fc,_0x084a('0x1bc'));}else{_0x5c5057[_0x084a('0xfd')](_0x4a0c0b,_0x4d1f35,_0x4588fc,_0x084a('0x1bc'));}}break;case'5':_0x22f435[_0x084a('0x65')]+=0x1;_0x4a0c0b[_0x084a('0xab')]=0x5;_0x4a0c0b[_0x084a('0xac')]=_0x084a('0x1bd');_0x4a0c0b[_0x084a('0xf6')]+=0x1;_0x4a0c0b[_0x084a('0xf4')]+=0x1;ami[_0x084a('0x50')](_0x084a('0x1be'),ut['buildObj'](_0x4ea122,_0x084a('0x1bf')));_0x558af1=_0x22f435[_0x084a('0x1ab')];_0x4c45a5=_0x22f435['callAdditionalPhoneAfterMin'];_0x5c5057[_0x084a('0xd4')](_0x4a0c0b)['catch'](loggerCatch(_0x084a('0x1c0')));if(_0x5c5057[_0x084a('0x1a8')](0x5,_0x4ea122,_0x22f435)&&!_0xbebbb8){if(_0x4a0c0b[_0x084a('0xf6')]>=_0x22f435[_0x084a('0x1c1')]){_0x5c5057['createStateFinal'](_0x4a0c0b,_0x4d1f35,_0x4588fc,_0x084a('0x1c2'));}else{_0x5c5057['stateGlobal'](_0x4a0c0b,_0x4d1f35,_0x4588fc,_0x084a('0x1c2'));}}break;case'8':_0x22f435[_0x084a('0x1c3')]+=0x1;_0x4a0c0b[_0x084a('0xab')]=0x8;_0x4a0c0b[_0x084a('0xac')]=_0x084a('0x1c4');_0x4a0c0b['countcongestionretry']+=0x1;_0x4a0c0b[_0x084a('0xf4')]+=0x1;_0x558af1=_0x22f435[_0x084a('0x1c5')];_0x4c45a5=_0x22f435[_0x084a('0x125')];ami[_0x084a('0x50')](_0x084a('0x1c6'),ut[_0x084a('0x109')](_0x4ea122,_0x084a('0x1c7')));_0x5c5057[_0x084a('0xd4')](_0x4a0c0b)[_0x084a('0xbe')](loggerCatch(_0x084a('0x1c8')));if(_0x5c5057['checkRetriveMax'](0x8,_0x4ea122,_0x22f435)&&!_0xbebbb8){if(_0x4a0c0b[_0x084a('0xf7')]>=_0x22f435[_0x084a('0x1ad')]){_0x5c5057[_0x084a('0x100')](_0x4a0c0b,_0x4d1f35,_0x4588fc,_0x084a('0x1c9'));}else{_0x5c5057[_0x084a('0xfd')](_0x4a0c0b,_0x4d1f35,_0x4588fc,_0x084a('0x1c9'));}}break;case'11':_0x22f435[_0x084a('0x1ca')]+=0x1;_0x4a0c0b['state']=0xb;_0x4a0c0b['statedesc']=_0x084a('0x12f');_0x4a0c0b[_0x084a('0xfb')]+=0x1;_0x4a0c0b[_0x084a('0xf4')]+=0x1;_0x558af1=_0x22f435['dialAbandonedRetryFrequency'];_0x4c45a5=_0x22f435[_0x084a('0x125')];_0x5c5057[_0x084a('0xd4')](_0x4a0c0b)[_0x084a('0xbe')](loggerCatch(_0x084a('0x133')));if(_0x5c5057[_0x084a('0x1a8')](0xb,_0x4ea122,_0x22f435)&&!_0xbebbb8){if(_0x4a0c0b[_0x084a('0xfb')]>=_0x22f435[_0x084a('0x132')]){_0x5c5057[_0x084a('0x100')](_0x4a0c0b,_0x4d1f35,_0x4588fc,_0x084a('0x1cb'));}else{_0x5c5057[_0x084a('0xfd')](_0x4a0c0b,_0x4d1f35,_0x4588fc,_0x084a('0x1cb'));}}break;case'20':_0x22f435['outboundRejectCallsDay']+=0x1;_0x4a0c0b['state']=0x14;_0x4a0c0b[_0x084a('0xac')]='AgentReject';_0x4a0c0b[_0x084a('0xfc')]+=0x1;_0x4a0c0b[_0x084a('0xf4')]+=0x1;_0x558af1=_0x22f435[_0x084a('0x1b3')];_0x4c45a5=_0x22f435[_0x084a('0x125')];ami[_0x084a('0x50')](_0x084a('0x1cc'),ut[_0x084a('0x109')](_0x4ea122,_0x084a('0x1cd')));_0x5c5057['createHistory'](_0x4a0c0b)[_0x084a('0xbe')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x5c5057['checkRetriveMax'](0x14,_0x4ea122,_0x22f435)&&!_0xbebbb8){if(_0x4a0c0b['countagentrejectretry']>=_0x22f435[_0x084a('0x1ce')]){_0x5c5057[_0x084a('0x100')](_0x4a0c0b,_0x4d1f35,_0x4588fc,'reason\x2020\x20agentreject');}else{_0x5c5057[_0x084a('0xfd')](_0x4a0c0b,_0x4d1f35,_0x4588fc,_0x084a('0x1cf'));}}break;default:_0x22f435[_0x084a('0x6d')]+=0x1;_0x4a0c0b['state']=0xc;_0x4a0c0b[_0x084a('0xac')]=_0x1cc588[_0x084a('0x114')];_0x558af1=_0x22f435['dialAgentRejectRetryFrequency'];_0x4c45a5=_0x22f435[_0x084a('0x125')];_0x5c5057[_0x084a('0xd4')](_0x4a0c0b)[_0x084a('0xbe')](loggerCatch(_0x084a('0x1d0')));if(_0x5c5057[_0x084a('0x1a8')](_0x1cc588['reason'],_0x4ea122,_0x22f435)&&!_0xbebbb8){if(_0x4a0c0b[_0x084a('0xf6')]+_0x4a0c0b['countcongestionretry']+_0x4a0c0b['countnoanswerretry']+_0x4a0c0b[_0x084a('0xf9')]+_0x4a0c0b[_0x084a('0xfa')]+_0x4a0c0b[_0x084a('0xfb')]+_0x4a0c0b[_0x084a('0xf3')]+_0x4a0c0b['countagentrejectretry']>=_0x22f435[_0x084a('0x10a')]){_0x5c5057[_0x084a('0xfd')](_0x4a0c0b,_0x4d1f35,_0x4588fc,_0x1cc588[_0x084a('0x114')]);}else{_0x5c5057[_0x084a('0x100')](_0x4a0c0b,_0x4d1f35,_0x4588fc,_0x1cc588['reason']);}}}})['then'](function(_0x58e750){if(_0xbebbb8){_0x5c5057[_0x084a('0xc1')](_0x4a0c0b,_0x558af1,_0x4c45a5)[_0x084a('0xbb')](function(_0x5b4f6b){return _0x4d1f35(0x1);});}});});};Dialer[_0x084a('0x1c')][_0x084a('0xfd')]=function(_0x512757,_0xf69885,_0x5dae3d,_0x2a50b8){var _0x37f530=new Final(_0x512757);_0x37f530['state']=0xf;_0x37f530[_0x084a('0xac')]=_0x084a('0x1d1');this[_0x084a('0x100')](_0x37f530,_0xf69885,_0x5dae3d,_0x2a50b8);};Dialer[_0x084a('0x1c')][_0x084a('0x100')]=function(_0x10e95a,_0x4ee618,_0x561818,_0x5df7ea){this[_0x084a('0xd2')](_0x10e95a)[_0x084a('0xbb')](function(){return _0x4ee618(msgResponse(_0x084a('0x1d2'),_0x084a('0x1d3'),_0x5df7ea));})[_0x084a('0xbe')](function(){return _0x561818(msgResponse('[moveContactManagedDialer][0]',_0x084a('0x153'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0x084a('0x9')]=function(_0x372331){var _0x9b1bad=_0x372331[_0x084a('0x1d4')]/0x64;var _0x418ee1=_0x372331['outboundDropCallsDayTimeout']/(_0x372331['outboundDropCallsDayTimeout']+_0x372331[_0x084a('0xeb')]);var _0x30aa72=Math[_0x084a('0x1d5')](_0x372331['predictiveIntervalAvailable']*(_0x372331[_0x084a('0x1d6')]/0x64));var _0x3cff50=Math[_0x084a('0x1d5')](_0x372331[_0x084a('0x75')]*(_0x372331['predictiveIntervalMinThreshold']/0x64));var _0x3d926d=_0x372331[_0x084a('0x55')]+_0x372331['talking'];var _0x302dc8=Math[_0x084a('0x1d7')](_0x372331[_0x084a('0x90')]*_0x372331[_0x084a('0x93')]*_0x372331[_0x084a('0x73')]*_0x372331['predictiveIntervalMultiplicativeFactor']);if(_[_0x084a('0x3e')](_0x372331[_0x084a('0x2b')])){if(!_[_0x084a('0x3e')](_0x372331[_0x084a('0x7a')])){_0x372331[_0x084a('0x7a')]=undefined;loggerPredictive[_0x084a('0x9d')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x372331['handlePredictive'])){loggerPredictive[_0x084a('0x9d')](_0x084a('0x1d8'),_0x084a('0x1d9'));clearInterval(_0x372331[_0x084a('0x97')]);_0x372331[_0x084a('0x97')]=undefined;}_0x372331[_0x084a('0x2b')]=moment()['format'](_0x084a('0x104'));loggerPredictive[_0x084a('0x83')](_0x372331['name'],_0x084a('0x1da'),_0x372331[_0x084a('0x2b')]);this['handlePower'](_0x372331,0x1);}else if(ifInterval(_0x372331[_0x084a('0x1db')],_0x372331[_0x084a('0x2b')])){this[_0x084a('0x166')](_0x372331,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x372331[_0x084a('0x2b')],_0x372331[_0x084a('0x41')]);_0x372331[_0x084a('0x90')]=0x0;_0x372331['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x9b1bad<_0x418ee1&&_0x372331['dialPredictiveOptimization']===_0x084a('0x1dc')){freeVariablesPredictive(_0x372331);loggerPredictive[_0x084a('0x83')](_0x084a('0x1dd'),_0x084a('0x1de'),_0x418ee1,'startProgressive',_0x372331[_0x084a('0x41')]);}else if(_0x302dc8<_0x372331['predictiveIntervalErlangCallsDroppedCalls']&&_0x372331[_0x084a('0x1df')]===_0x084a('0x1dc')){freeVariablesPredictive(_0x372331);loggerPredictive[_0x084a('0x83')](_0x084a('0x1e0'),'Max\x20Drop\x20',_0x302dc8,_0x084a('0x1e1'),_0x372331[_0x084a('0x72')],_0x084a('0x2b'),_0x372331[_0x084a('0x41')]);}else if(!ifInterval(_0x372331[_0x084a('0x1db')],_0x372331[_0x084a('0x2b')])&&_[_0x084a('0x3e')](_0x372331['startPredictive'])&&!_[_0x084a('0x3e')](_0x372331['startProgressive'])){_0x372331['startPredictive']=moment()[_0x084a('0x7e')](_0x084a('0x104'));loggerPredictive[_0x084a('0x83')](_0x372331['name'],'started\x20in\x20predictive\x20at',_0x372331[_0x084a('0x7a')]);this[_0x084a('0x1e2')](_0x372331[_0x084a('0x1db')])[_0x084a('0xbb')](this[_0x084a('0x1e3')](_0x372331))[_0x084a('0xbb')](mergeDataErlangB(_0x372331))['then'](this[_0x084a('0x1e4')](_0x372331))[_0x084a('0xbe')](loggerCatchPredictive(_0x084a('0x1e5'),_0x372331));}else if(!ifInterval(_0x372331['dialPredictiveInterval'],_0x372331[_0x084a('0x7a')])){_0x372331[_0x084a('0x72')]=0x0;_0x372331[_0x084a('0x7a')]=moment()['format'](_0x084a('0x104'));loggerPredictive[_0x084a('0x83')](_0x372331['name'],_0x084a('0x1e6'),_0x372331[_0x084a('0x7a')]);clearInterval(_0x372331['handlePredictive']);_0x372331[_0x084a('0x97')]=undefined;this[_0x084a('0x1e2')](_0x372331['dialPredictiveInterval'])[_0x084a('0xbb')](this['getDataPredictive'](_0x372331))['then'](mergeDataErlangB(_0x372331))[_0x084a('0xbb')](this[_0x084a('0x1e4')](_0x372331))[_0x084a('0xbe')](loggerCatchPredictive(_0x084a('0x1e7'),_0x372331));}else if(_0x372331[_0x084a('0x75')]&&_0x3d926d<_0x372331[_0x084a('0x75')]-_0x3cff50){freeVariablesPredictive(_0x372331);loggerPredictive[_0x084a('0x83')](_0x372331[_0x084a('0x41')],_0x084a('0x1e8'),_0x3d926d,')\x20are\x20less\x20than\x20threshold\x20(',_0x372331[_0x084a('0x75')],'-',_0x3cff50,'=',_0x372331[_0x084a('0x75')]-_0x3cff50,')');}else if(_0x372331[_0x084a('0x75')]&&_0x3d926d>_0x372331[_0x084a('0x75')]+_0x30aa72){freeVariablesPredictive(_0x372331);loggerPredictive[_0x084a('0x83')](_0x372331[_0x084a('0x41')],_0x084a('0x1e8'),_0x3d926d,')\x20are\x20more\x20than\x20threshold\x20(',_0x372331[_0x084a('0x75')],'+',_0x30aa72,'=',_0x372331['predictiveIntervalAvailable']+_0x30aa72,')');}};Dialer[_0x084a('0x1c')]['getDataPredictive']=function(_0x1f5ade){var _0x28d95d=this;return function(_0x34a8aa){return new BPromise(function(_0x4c3321,_0x8d14b4){_['merge'](_0x1f5ade,_0x34a8aa[0x0]);if(checkGetDataPredictive(_0x34a8aa[0x0])){var _0x5899c6=_0x1f5ade[_0x084a('0x75')]=_0x1f5ade[_0x084a('0x5a')]+_0x1f5ade[_0x084a('0x55')];var _0x431166=_0x1f5ade['dialPredictiveInterval']*0x3c;var _0x3ec5fc=_0x34a8aa[0x0][_0x084a('0x70')]+_0x34a8aa[0x0][_0x084a('0x6f')];var _0x581657=(_0x34a8aa[0x0][_0x084a('0x6e')]+_0x34a8aa[0x0][_0x084a('0x1e9')]+_0x34a8aa[0x0][_0x084a('0x89')])/_0x34a8aa[0x0][_0x084a('0x76')];_0x1f5ade['predictiveIntervalHitRate']=_0x581657>0x0?_0x581657:0x1;switch(_0x1f5ade[_0x084a('0x1df')]){case'dropRate':var _0x3d63ce=_0x1f5ade[_0x084a('0x1d4')]/0x64;return _0x28d95d['abandonmentRate'](_0x5899c6,_0x431166,_0x3ec5fc,_0x581657,_0x3d63ce)[_0x084a('0xbb')](function(_0x5f9f46){return _0x4c3321(_0x5f9f46);});case _0x084a('0x1ea'):var _0xe5054=_0x1f5ade['dialPredictiveOptimizationPercentage']/0x64;return _0x28d95d[_0x084a('0x1eb')](_0x5899c6,_0x431166,_0x3ec5fc,_0x581657,_0xe5054)['then'](function(_0x5ad594){return _0x4c3321(_0x5ad594);});default:return _0x8d14b4(msgResponse(_0x084a('0x1ec'),_0x084a('0x153'),_0x084a('0x1ed')));}}else{return _0x8d14b4(msgResponse(_0x084a('0x1ec'),_0x084a('0x153'),_0x084a('0x1ee')));}});};};Dialer[_0x084a('0x1c')][_0x084a('0x1ef')]=function(_0x5944e7){var _0x550f4a=this;return function(_0x2d3df7){return new BPromise(function(_0xbbfa5a,_0xfb1bc4){_['merge'](_0x5944e7,_0x2d3df7[0x0]);if(checkGetDataPredictive(_0x2d3df7[0x0])){loggerPredictive[_0x084a('0x83')](JSON[_0x084a('0x4c')](_0x2d3df7[0x0]));if(_0x5944e7[_0x084a('0x1df')]===_0x084a('0x1dc')){return _0x550f4a[_0x084a('0xd0')](_0x5944e7['id'])[_0x084a('0xbb')](function(_0x373861){var _0x46d51f=_0x5944e7[_0x084a('0x56')]-_0x373861[0x0][_0x084a('0x1f0')];var _0x29ff29=_0x5944e7[_0x084a('0x1db')]*0x3c;var _0x4eb972=_0x2d3df7[0x0]['predictiveIntervalAvgTalktime']+_0x2d3df7[0x0][_0x084a('0x6f')];var _0x540df3=(_0x2d3df7[0x0][_0x084a('0x6e')]+_0x2d3df7[0x0][_0x084a('0x1e9')]+_0x2d3df7[0x0][_0x084a('0x89')])/_0x2d3df7[0x0][_0x084a('0x76')];var _0x4f034=_0x5944e7[_0x084a('0x1d4')]/0x64;_0x5944e7[_0x084a('0x74')]=_0x373861[0x0][_0x084a('0x1f0')]||0x0;_0x5944e7[_0x084a('0x73')]=_0x540df3>0x0?_0x540df3:0x1;return _0x550f4a[_0x084a('0x1f1')](_0x46d51f,_0x29ff29,_0x4eb972,_0x540df3,_0x4f034);})[_0x084a('0xbb')](function(_0x52de64){return _0xbbfa5a(_0x52de64);})[_0x084a('0xbe')](function(_0x38b110){return _0xfb1bc4(msgResponse(_0x084a('0x1f2'),_0x084a('0x153'),JSON[_0x084a('0x4c')](_0x38b110)));});}if(_0x5944e7['dialPredictiveOptimization']===_0x084a('0x1ea')){return _0x550f4a['getVoiceQueueRtPauses'](_0x5944e7['id'])[_0x084a('0xbb')](function(_0x42140d){var _0x41b79e=_0x5944e7['loggedIn']-_0x42140d[0x0][_0x084a('0x1f0')];var _0x388a21=_0x5944e7[_0x084a('0x1db')]*0x3c;var _0x2fabb7=_0x2d3df7[0x0][_0x084a('0x70')]+_0x2d3df7[0x0][_0x084a('0x6f')];var _0xf115ae=(_0x2d3df7[0x0][_0x084a('0x6e')]+_0x2d3df7[0x0][_0x084a('0x1e9')]+_0x2d3df7[0x0][_0x084a('0x89')])/_0x2d3df7[0x0][_0x084a('0x76')];var _0x474c49=_0x5944e7[_0x084a('0x1d4')]/0x64;_0x5944e7['predictiveIntervalPauses']=_0x42140d[0x0][_0x084a('0x1f0')]||0x0;_0x5944e7[_0x084a('0x73')]=_0xf115ae>0x0?_0xf115ae:0x1;return _0x550f4a['busyFactor'](_0x41b79e,_0x388a21,_0x2fabb7,_0xf115ae,_0x474c49);})[_0x084a('0xbb')](function(_0x4ecd9e){return _0xbbfa5a(_0x4ecd9e);})['catch'](function(_0x2734c9){return _0xfb1bc4(msgResponse(_0x084a('0x1f2'),'Failure',JSON['stringify'](_0x2734c9)));});}}else{return _0xfb1bc4(msgResponse('[getDataPredictive]',_0x084a('0x153'),_0x084a('0x1ee')));}});};};Dialer['prototype'][_0x084a('0x1e4')]=function(_0x2abe78){var _0x5e25a3=this;return function(){var _0x1958a7=0x0;var _0x4ed50c=Math[_0x084a('0x1d7')](_0x2abe78['erlangCallToSecond']*0x3e8);if(_0x4ed50c>0x0){_0x4ed50c=_0x4ed50c<0x64?0x64:_0x4ed50c;loggerPredictive['info'](_0x2abe78[_0x084a('0x41')],_0x084a('0x1f3'),_0x4ed50c,_0x084a('0x4d'));_0x2abe78[_0x084a('0x97')]=setInterval(function(){_0x5e25a3[_0x084a('0x97')](_0x2abe78);loggerPredictiveCalls[_0x084a('0x83')](_0x084a('0x1f4'),_0x1958a7+=0x1);},_0x4ed50c);}else{loggerPredictive[_0x084a('0x83')](_0x2abe78['name'],_0x084a('0x1f5'));}};};Dialer[_0x084a('0x1c')]['checkContactBlack']=function(_0x3b0f94,_0x208a9a){var _0x2d1c9b=this;return function(_0x44b2d6){if(_[_0x084a('0x48')](_0x44b2d6)){if(_['isNil'](_0x208a9a[_0x084a('0x1f6')])||!_0x208a9a[_0x084a('0x1f7')]){if(_0x3b0f94['dialMethod']==='booked'){_0x3b0f94[_0x084a('0x13b')]=_[_0x084a('0x3e')](_0x3b0f94['queueStatusComplete'])?!![]:_0x3b0f94['queueStatusComplete'];var _0x20e797=uuid['v4']();_0x2d1c9b['actions'][_0x20e797]=new Action(_0x3b0f94,_0x208a9a,_0x20e797);loggerBooked['info'](_0x084a('0x1f8'),_0x20e797,_0x084a('0x1f9'),JSON[_0x084a('0x4c')](_0x3b0f94[_0x084a('0x13b')]),'Queue:\x20',_0x3b0f94[_0x084a('0x41')]);if(_0x3b0f94[_0x084a('0x13b')]){_0x3b0f94[_0x084a('0x13b')]=![];_0x2d1c9b['queueBooked'][_0x2d1c9b[_0x084a('0x27')][_0x20e797][_0x084a('0xb5')]]=[];ami[_0x084a('0xb1')]({'actionid':_0x20e797,'action':'queuestatus','queue':_0x3b0f94[_0x084a('0x41')]})[_0x084a('0xbe')](function(){_0x2d1c9b[_0x084a('0xb7')](_0x3b0f94);_0x2d1c9b[_0x084a('0xc7')]({'active':![],'ContactId':_0x2d1c9b[_0x084a('0x27')][_0x20e797][_0x084a('0xdc')],'ListId':_0x2d1c9b[_0x084a('0x27')][_0x20e797][_0x084a('0xdd')],'VoiceQueueId':_0x2d1c9b[_0x084a('0x27')][_0x20e797]['VoiceQueueId']||undefined,'CampaignId':_0x2d1c9b['actions'][_0x20e797]['CampaignId']||undefined})['catch'](loggerCatch(_0x084a('0x1fa')));delete _0x2d1c9b[_0x084a('0x27')][_0x20e797];});}else{loggerBooked[_0x084a('0x83')]('[booked][checkContactBlack][else]',JSON[_0x084a('0x4c')](_0x3b0f94[_0x084a('0x13b')]),'Queue:\x20',_0x3b0f94['name']);_0x2d1c9b[_0x084a('0xb7')](_0x3b0f94);_0x2d1c9b[_0x084a('0xc7')]({'active':![],'ContactId':_0x2d1c9b['actions'][_0x20e797]['ContactId'],'ListId':_0x2d1c9b[_0x084a('0x27')][_0x20e797]['ListId'],'VoiceQueueId':_0x2d1c9b['actions'][_0x20e797]['VoiceQueueId']||undefined,'CampaignId':_0x2d1c9b[_0x084a('0x27')][_0x20e797][_0x084a('0xde')]||undefined})[_0x084a('0xbe')](loggerCatch(_0x084a('0x1fa')));delete _0x2d1c9b[_0x084a('0x27')][_0x20e797];}}else{return _0x2d1c9b['actionOriginate'](_0x3b0f94,_0x208a9a);}}else{if(getDiff(_0x208a9a[_0x084a('0x1fb')])<_0x3b0f94[_0x084a('0x1fc')]*0x3c){if(_0x208a9a['Agent']&&!_0x208a9a[_0x084a('0x1fd')][_0x084a('0x1fe')]){_0x2d1c9b['preview'][_0x084a('0x13e')](_0x208a9a['id'])[_0x084a('0x1f')](function(){_0x2d1c9b[_0x084a('0xb7')](_0x3b0f94);});}else{_0x2d1c9b['unlockContact']({'active':![]},_0x208a9a['id'],0x1)[_0x084a('0x1f')](function(){_0x2d1c9b[_0x084a('0xb7')](_0x3b0f94);});}}else{_0x3b0f94[_0x084a('0x6b')]+=0x1;_0x2d1c9b[_0x084a('0xb7')](_0x3b0f94);if(_0x3b0f94[_0x084a('0x1ff')]){_0x2d1c9b[_0x084a('0xc7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x208a9a[_0x084a('0xdc')],'ListId':_0x208a9a[_0x084a('0xdd')],'VoiceQueueId':_0x208a9a[_0x084a('0x10b')]||undefined,'CampaignId':_0x208a9a[_0x084a('0xde')]||undefined})[_0x084a('0xbe')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x2d1c9b[_0x084a('0xd4')](createObjHistory(_0x3b0f94,_0x208a9a,'RECALLINQUEUE',0x17,_0x084a('0x200')))[_0x084a('0xbe')](loggerCatch(_0x084a('0x201')));}else{_0x2d1c9b['saveInDb'](createObjHistory(_0x3b0f94,_0x208a9a,_0x084a('0x202'),0x16,_0x084a('0x203')),_0x084a('0x204'),'[Originate][HistoryRecallClose]');}}}}else{_0x3b0f94[_0x084a('0x64')]+=0x1;_0x2d1c9b[_0x084a('0xe4')](createObjHistory(_0x3b0f94,_0x208a9a,'BLACKLIST',0xd,'Blacklist'),_0x084a('0x205'),_0x084a('0x206'));throw _0x084a('0x207');}};};Dialer[_0x084a('0x1c')]['handleIvr']=function(_0x37b971){var _0x2760b2=this;var _0x5b6966=_0x37b971[_0x084a('0x208')]-_0x37b971[_0x084a('0x77')]-_0x37b971[_0x084a('0xcc')];emitCampaignSummary(_0x37b971);if(_0x5b6966>0x0){if(_0x5b6966>this[_0x084a('0x25')]){_0x5b6966=this['maxNumberOriginate'];}_0x37b971[_0x084a('0xcc')]+=_0x5b6966;this[_0x084a('0xce')](_0x37b971['id'],_0x5b6966,_0x37b971[_0x084a('0x209')],_0x37b971)[_0x084a('0xbb')](function(_0xbb1e06){_0x37b971['temp']-=_0x5b6966;_0x37b971['temp']=_0x37b971['temp']>0x0?_0x37b971[_0x084a('0xcc')]:0x0;if(!checkContactEmpty(_0xbb1e06)){_0x37b971[_0x084a('0x3f')]=_0x084a('0xa3');logger[_0x084a('0x83')](_0x084a('0x20a')+_0x37b971[_0x084a('0x41')]);}else{_0x37b971['originated']+=_0xbb1e06['length'];_0x37b971[_0x084a('0x3f')]=_0x084a('0x20b');for(var _0x159165=0x0;_0x159165<_0xbb1e06[_0x084a('0x20c')];_0x159165+=0x1){_0x37b971['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0xbb1e06[_0x159165])||_[_0x084a('0xb0')](_0xbb1e06[_0x159165]['Contact'])||_['isNil'](_0xbb1e06[_0x159165][_0x084a('0x17a')])){_0x2760b2[_0x084a('0xd9')](_0x084a('0x20d'),_0x37b971,_0xbb1e06[_0x159165]);}else{_0x2760b2['checkIsBlackListIvr'](_[_0x084a('0xdb')](_0xbb1e06[_0x159165],[_0x084a('0xde'),_0x084a('0x20e')]))[_0x084a('0xbb')](_0x2760b2[_0x084a('0x20f')](_0x37b971,_0xbb1e06[_0x159165]))[_0x084a('0xbe')](_0x2760b2['loggerHandler']('[actionOriginateIvr]\x20',_0x37b971));}}}})[_0x084a('0xbe')](loggerGetContactDialer(_0x084a('0x210'),_0x37b971,_0x5b6966));}};Dialer[_0x084a('0x1c')][_0x084a('0x166')]=function(_0x46b263,_0x52b48c){var _0x53c908=this;var _0xdfee67=[];var _0x3bccc4=_0x52b48c>=0x1?_0x52b48c:0x1;if(_0x46b263[_0x084a('0x5f')]===_0x084a('0x8')){_0x3bccc4=0x1;}var _0x406565=Math[_0x084a('0x1d7')](_0x46b263[_0x084a('0x55')]*_0x3bccc4)-_0x46b263[_0x084a('0x77')]-_0x46b263[_0x084a('0xcc')];emitVoiceQueueSummary(_0x46b263);if(_0x46b263[_0x084a('0x211')]>0x0){var _0x359ca3=_0x46b263[_0x084a('0x211')]-_0x46b263[_0x084a('0x77')]-_0x46b263[_0x084a('0x5a')]-_0x46b263[_0x084a('0xcc')]-_0x46b263[_0x084a('0x57')];if(_0x406565>_0x359ca3){_0x406565=_0x359ca3;}}if(_0x406565>0x0){if(_0x46b263[_0x084a('0x5f')]===_0x084a('0x8')){_0x406565=0x1;}if(_0x406565>this[_0x084a('0x25')]){_0x406565=this[_0x084a('0x25')];}_0x46b263[_0x084a('0xcc')]+=_0x406565;for(var _0x41a08f in this['agents']){if(typeof this[_0x084a('0x23')][_0x41a08f]!=='undefined'){if(this[_0x084a('0x23')][_0x41a08f][_0x084a('0xab')]==='not_inuse'&&this[_0x084a('0x23')][_0x41a08f][_0x084a('0xb2')]===_0x084a('0xe3')){_0xdfee67[_0x084a('0x138')](this[_0x084a('0x23')][_0x41a08f]['id']);}}}this['getContactDialer'](_0x46b263['id'],_0xdfee67,_0x406565,_0x46b263[_0x084a('0x209')],_0x46b263)[_0x084a('0xbb')](function(_0x1aebb7){_0x46b263[_0x084a('0xcc')]-=_0x406565;_0x46b263['temp']=_0x46b263[_0x084a('0xcc')]>0x0?_0x46b263['temp']:0x0;if(!checkContactEmpty(_0x1aebb7)){_0x53c908['countReScheduled'](_0x46b263)[_0x084a('0xbb')](sendMessageReschedule(_0x46b263))[_0x084a('0xbe')](loggerCatch('[countReScheduled]\x20'));}else{_0x46b263[_0x084a('0x77')]+=_0x1aebb7['length'];_0x46b263[_0x084a('0x3f')]=_0x46b263['dialMethod']==='booked'?_0x084a('0x181'):'RUNNING';for(var _0x953f15=0x0;_0x953f15<_0x1aebb7[_0x084a('0x20c')];_0x953f15+=0x1){if(_['isNil'](_0x1aebb7[_0x953f15])||_[_0x084a('0xb0')](_0x1aebb7[_0x953f15][_0x084a('0x195')])||_[_0x084a('0xb0')](_0x1aebb7[_0x953f15]['phone'])){_0x53c908[_0x084a('0xd9')](_0x084a('0x20d'),_0x46b263,_0x1aebb7[_0x953f15]);}else{_0x53c908[_0x084a('0xbd')](_['pick'](_0x1aebb7[_0x953f15],[_0x084a('0x10b'),'Contact.phone']))[_0x084a('0xbb')](_0x53c908[_0x084a('0x20f')](_0x46b263,_0x1aebb7[_0x953f15]))[_0x084a('0xbe')](_0x53c908['loggerHandler'](_0x084a('0x20d'),_0x46b263));}}}})['catch'](loggerGetContactDialer(_0x084a('0x212'),_0x46b263,_0x406565));}};Dialer[_0x084a('0x1c')]['handlePredictive']=function(_0x36a19f){if(_0x36a19f[_0x084a('0x211')]>0x0){var _0x2c12b1=_0x36a19f[_0x084a('0x211')]-_0x36a19f[_0x084a('0x77')]-_0x36a19f[_0x084a('0x5a')];if(_0x2c12b1>0x0){this[_0x084a('0x213')](_0x36a19f);}else{loggerPredictiveCalls[_0x084a('0x83')](_0x084a('0x214'));}}else{this['tryOriginatePredictive'](_0x36a19f);}};Dialer[_0x084a('0x1c')][_0x084a('0x213')]=function(_0x2f04b9){var _0x28f7bf=this;var _0x37d7a8=[];_0x2f04b9[_0x084a('0x77')]+=0x1;for(var _0x449c9a in this[_0x084a('0x23')]){if(typeof this[_0x084a('0x23')][_0x449c9a]!==_0x084a('0x9e')){if(this[_0x084a('0x23')][_0x449c9a][_0x084a('0xab')]===_0x084a('0x215')&&this['agents'][_0x449c9a][_0x084a('0xb2')]===_0x084a('0xe3')){_0x37d7a8['push'](this['agents'][_0x449c9a]['id']);}}}this[_0x084a('0xcb')](_0x2f04b9['id'],_0x37d7a8,0x1,_0x2f04b9[_0x084a('0x209')],_0x2f04b9)[_0x084a('0xbb')](function(_0x69f674){if(!checkContactEmpty(_0x69f674)){checkContactLowerLimitOriginate(_0x2f04b9,0x1,0x0);_0x28f7bf[_0x084a('0xb9')](_0x2f04b9)[_0x084a('0xbb')](sendMessageReschedule(_0x2f04b9))[_0x084a('0xbe')](loggerCatch(_0x084a('0xbc')));}else{_0x2f04b9[_0x084a('0x3f')]='RUNNING';if(_['isNil'](_0x69f674[0x0])||_[_0x084a('0xb0')](_0x69f674[0x0][_0x084a('0x195')])||_['isNil'](_0x69f674[0x0][_0x084a('0x17a')])){_0x28f7bf[_0x084a('0xd9')](_0x084a('0x20d'),_0x2f04b9,_0x69f674[0x0]);}else{_0x28f7bf[_0x084a('0xbd')](_[_0x084a('0xdb')](_0x69f674[0x0],[_0x084a('0x10b'),'Contact.phone']))['then'](_0x28f7bf[_0x084a('0x20f')](_0x2f04b9,_0x69f674[0x0]))['catch'](_0x28f7bf[_0x084a('0xd8')](_0x084a('0x216'),_0x2f04b9));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x2f04b9,0x1));emitVoiceQueueSummary(_0x2f04b9);};Dialer[_0x084a('0x1c')]['abandonmentRate']=function(_0x25b79a,_0x7fb8a4,_0x29c041,_0x56d63e,_0x169cf5,_0x2b886f){loggerPredictive[_0x084a('0x83')](_0x084a('0x217'));loggerPredictive[_0x084a('0x83')](_0x084a('0x218'),_0x25b79a);loggerPredictive[_0x084a('0x83')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x7fb8a4);loggerPredictive[_0x084a('0x83')](_0x084a('0x219'),_0x29c041);loggerPredictive[_0x084a('0x83')](_0x084a('0x21a'),_0x56d63e);loggerPredictive[_0x084a('0x83')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x169cf5);loggerPredictive[_0x084a('0x83')]('---------------------------');return new BPromise(function(_0x15f573,_0x21c464){if(_0x25b79a<=0x0||isNaN(_0x25b79a)){return _0x21c464(msgResponse(_0x084a('0x21b'),_0x084a('0x4b'),_0x084a('0x21c')+_0x25b79a));}if(_0x29c041<=0x0||isNaN(_0x29c041)){return _0x21c464(msgResponse('[abandonmentRate]',_0x084a('0x4b'),_0x084a('0x21d')+_0x29c041));}if(_0x56d63e<=0x0||isNaN(_0x56d63e)){return _0x21c464(msgResponse(_0x084a('0x21b'),_0x084a('0x4b'),'p\x20=\x20'+_0x56d63e));}if(_0x7fb8a4<=0x0||isNaN(_0x7fb8a4)){return _0x21c464(msgResponse('[abandonmentRate]',_0x084a('0x4b'),'interval\x20=\x20'+_0x7fb8a4));}if(_0x169cf5<=0x0||isNaN(_0x169cf5)){return _0x21c464(msgResponse('[abandonmentRate]','Error','Amax\x20=\x20'+_0x169cf5));}_0x2b886f=_0x2b886f||0x0;var _0x4e4250=0x1/_0x29c041;var _0x95dff0=0x0;var _0x5a8ab6=0x0;var _0x869c02=0x0;var _0x468b32=0x0;for(var _0x316ffe=0x0;_0x869c02<_0x169cf5;_0x316ffe+=0x1){_0x5a8ab6=_0x316ffe/_0x7fb8a4;_0x95dff0=(_0x56d63e*_0x5a8ab6+_0x2b886f)/_0x4e4250;_0x869c02=erlangb(_0x95dff0,_0x25b79a);_0x468b32=_0x95dff0/_0x25b79a*(0x1-erlangb(_0x95dff0,_0x25b79a));}return _0x15f573({'erlangCalls':_0x316ffe,'erlangCallToSecond':_0x7fb8a4/_0x316ffe,'erlangAbandonmentRate':_0x869c02,'erlangBusyFactor':_0x468b32});});};Dialer['prototype'][_0x084a('0x1eb')]=function(_0x53311a,_0x25e8b2,_0x3ab95e,_0xe55bcc,_0x219392,_0x38e76f){loggerPredictive[_0x084a('0x83')](_0x084a('0x21e'));loggerPredictive[_0x084a('0x83')](_0x084a('0x218'),_0x53311a);loggerPredictive[_0x084a('0x83')](_0x084a('0x21f'),_0x25e8b2);loggerPredictive[_0x084a('0x83')](_0x084a('0x219'),_0x3ab95e);loggerPredictive[_0x084a('0x83')](_0x084a('0x21a'),_0xe55bcc);loggerPredictive['info'](_0x084a('0x220'),_0x219392);loggerPredictive[_0x084a('0x83')](_0x084a('0x8b'));return new BPromise(function(_0x33c1f9,_0xe04024){if(_0x53311a<=0x0||isNaN(_0x53311a)){return _0xe04024(msgResponse(_0x084a('0x221'),'Error',_0x084a('0x21c')+_0x53311a));}if(_0x3ab95e<=0x0||isNaN(_0x3ab95e)){return _0xe04024(msgResponse(_0x084a('0x221'),_0x084a('0x4b'),_0x084a('0x21d')+_0x3ab95e));}if(_0xe55bcc<=0x0||isNaN(_0xe55bcc)){return _0xe04024(msgResponse(_0x084a('0x221'),_0x084a('0x4b'),_0x084a('0x222')+_0xe55bcc));}if(_0x25e8b2<=0x0||isNaN(_0x25e8b2)){return _0xe04024(msgResponse(_0x084a('0x221'),'Error',_0x084a('0x223')+_0x25e8b2));}if(_0x219392<=0x0||isNaN(_0x219392)){return _0xe04024(msgResponse(_0x084a('0x221'),'Error',_0x084a('0x224')+_0x219392));}_0x38e76f=_0x38e76f||0x0;var _0x296770=0x1/_0x3ab95e;var _0x3e15a2=0x0;var _0x471d41=0x0;var _0x1f57dd=0x0;var _0x1c176d=0x0;for(var _0x3015d3=0x0;_0x1c176d<_0x219392;_0x3015d3+=0x1){_0x471d41=_0x3015d3/_0x25e8b2;_0x3e15a2=(_0xe55bcc*_0x471d41+_0x38e76f)/_0x296770;_0x1f57dd=erlangb(_0x3e15a2,_0x53311a);_0x1c176d=_0x3e15a2/_0x53311a*(0x1-erlangb(_0x3e15a2,_0x53311a));}return _0x33c1f9({'erlangCalls':_0x3015d3,'erlangCallToSecond':_0x25e8b2/_0x3015d3,'erlangAbandonmentRate':_0x1f57dd,'erlangBusyFactor':_0x1c176d});});};module[_0x084a('0x225')]=Dialer; \ No newline at end of file +var _0xa9fc=['isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','error','inspect','stack','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','loopClearZombieChannels','clearZombieChannels','uniqueId','[uniqueid]','[actions]','prototype','isNil','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','[countReScheduled]\x20','then','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','resolve','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','notFound','saveInDb','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','syncVarSet','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','uniqueid','HangupInAMD','AMD','emit','custom:amd','amd','[syncHangupInAMD]','value','MACHINE','Machine','membername','countglobal','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','reason\x2019\x20machine....','add','YYYY-MM-DD\x20HH:mm:ss','HANGUP','[syncHangupInAMDIvr][createHistory]','stateGlobal','dialMachineMaxRetry','createStateFinal','minutes','[rescheduleContact][Machine]','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','Unknow','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','Drop','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','CALLEREXIT','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','queueCallerAbandonCreateState','[syncAgentComplete][createHistory][11]','actionid','roundrobin','locked','paused','stateinterface','push','pick','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','length','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','Action','command','interval','iftime\x20%s,%s','content','indexOf','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','predictive','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialTimezone','checkDialMethod','[syncQueueSummary]','dialGlobalInterval','[syncCampaigns]','\x5cw{0,','pow','replace','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','dialer','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','substring','dialCutDigit','from-sip','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Abandoned]','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','checkRetriveMax','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','reason\x2020\x20agentreject','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','floor','predictiveIntervalHitRate','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','check\x20failure','one\x20call\x20every:','[handlePredictive]','booked','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','Agent','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','inBlackList','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkContactBlack','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','Contact.phone','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','ioredis','../../../config/environment/','../../../config/logger','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','enqueue','tail','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','custom:queuesummary','hangup','newexten','syncNewExten','varset','queuemember','queuestatuscomplete','syncQueueStatusComplete','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','stringify','milliseconds','diff','seconds','type','outbound','strategy','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','Trunk','active','callerid','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------'];(function(_0x219f6c,_0x5f1f22){var _0x2d0be7=function(_0x11f345){while(--_0x11f345){_0x219f6c['push'](_0x219f6c['shift']());}};_0x2d0be7(++_0x5f1f22);}(_0xa9fc,0x19f));var _0xca9f=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0xa9fc[_0x31a576];return _0x30b1d3;};'use strict';var util=require(_0xca9f('0x0'));var _=require(_0xca9f('0x1'));var BPromise=require(_0xca9f('0x2'));var uuid=require(_0xca9f('0x3'));var moment=require(_0xca9f('0x4'));var rr=require('rr');var md5=require('md5');var Redis=require(_0xca9f('0x5'));var ut=require('../preview/util/util');var config=require(_0xca9f('0x6'));var logger=require(_0xca9f('0x7'))('dialer');var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require(_0xca9f('0x7'))('predictive');var loggerPredictiveCalls=require(_0xca9f('0x7'))(_0xca9f('0x8'));var loggerSyncQueueSummary=require(_0xca9f('0x7'))(_0xca9f('0x9'));var ami=require(_0xca9f('0xa'));config[_0xca9f('0xb')]=_[_0xca9f('0xc')](config[_0xca9f('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xca9f('0xd'))(new Redis(config[_0xca9f('0xb')]));var cmHopper=require(_0xca9f('0xe'));var cmHopperHistory=require(_0xca9f('0xf'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperAdditionalPhone=require(_0xca9f('0x10'));var cmHopperBlack=require(_0xca9f('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0xca9f('0x12'));var History=require(_0xca9f('0x13'));var Final=require(_0xca9f('0x14'));var AgentComplete=require(_0xca9f('0x15'));var QueueCallerAbandon=require(_0xca9f('0x16'));var Hangup=require(_0xca9f('0x17'));var ipAgi=process[_0xca9f('0x18')][_0xca9f('0x19')]||_0xca9f('0x1a');var strategy={'rrmemory':_0xca9f('0x1b'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence['prototype'][_0xca9f('0x1c')]=function(_0x5ec217){this['tail']=this[_0xca9f('0x1d')]?this[_0xca9f('0x1d')]['finally'](_0x5ec217):_0x5ec217();};function Dialer(_0x4afedf,_0x49060d){this[_0xca9f('0x1e')]=new Sequence();this['preview']=_0x49060d;this[_0xca9f('0x1f')]=_0x4afedf[_0xca9f('0x1f')];this[_0xca9f('0x20')]=_0x4afedf[_0xca9f('0x20')];this[_0xca9f('0x21')]=_0x4afedf['agents'];this[_0xca9f('0x22')]=_0x4afedf['trunks'];this[_0xca9f('0x23')]=config[_0xca9f('0x23')]||0x2;this[_0xca9f('0x24')]={};this[_0xca9f('0x25')]={};this[_0xca9f('0x26')]={};this['uniqueId']={};this[_0xca9f('0x27')]={};this[_0xca9f('0x28')]={};this[_0xca9f('0x29')]={};this[_0xca9f('0x2a')]={};this[_0xca9f('0x2b')]={};this['queueBookedRR']={};ami['on']('agentconnect',this[_0xca9f('0x2c')][_0xca9f('0x2d')](this));ami['on'](_0xca9f('0x2e'),this[_0xca9f('0x2f')][_0xca9f('0x2d')](this));ami['on']('originateresponse',this[_0xca9f('0x30')][_0xca9f('0x2d')](this));ami['on'](_0xca9f('0x31'),this['syncAgentComplete'][_0xca9f('0x2d')](this));ami['on'](_0xca9f('0x32'),this[_0xca9f('0x9')][_0xca9f('0x2d')](this));ami['on'](_0xca9f('0x33'),this['syncHangup'][_0xca9f('0x2d')](this));ami['on'](_0xca9f('0x34'),this[_0xca9f('0x35')][_0xca9f('0x2d')](this));ami['on'](_0xca9f('0x36'),this['syncVarSet']['bind'](this));ami['on'](_0xca9f('0x37'),this['syncQueueMember'][_0xca9f('0x2d')](this));ami['on'](_0xca9f('0x38'),this[_0xca9f('0x39')][_0xca9f('0x2d')](this));this['loopCampaigns']();this['loopClearZombieChannels']();}function isNotNull(_0xf153c8){return _0xf153c8!==null&&!_['isUndefined'](_0xf153c8);}function checkIsLoggedIn(_0x26b33d,_0x54beae){return function(){if(_0x54beae<=0x0){_0x26b33d[_0xca9f('0x3a')]=_0xca9f('0x3b');throw _0x26b33d[_0xca9f('0x3c')]+_0xca9f('0x3d');}};}function isActive(_0x282dc4){return _0x282dc4;}function checkIsActive(_0x1c9138,_0x4f9368){return function(){if(!isActive(_0x4f9368)){_0x1c9138['message']=_0xca9f('0x3e');throw _0x1c9138['name']+_0xca9f('0x3f');}};}function checkInterval(_0x33a9d5){return function(){if(!isNotNull(_0x33a9d5[_0xca9f('0x40')])){_0x33a9d5['message']='INTERVAL_IS_NULL';throw _0x33a9d5[_0xca9f('0x3c')]+_0xca9f('0x41');}if(!isNotNull(_0x33a9d5[_0xca9f('0x40')]['Intervals'])){_0x33a9d5[_0xca9f('0x3a')]=_0xca9f('0x42');throw _0x33a9d5['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xca9f('0x43')](_0x33a9d5[_0xca9f('0x40')][_0xca9f('0x44')]))){_0x33a9d5[_0xca9f('0x3a')]=_0xca9f('0x42');throw _0x33a9d5[_0xca9f('0x3c')]+_0xca9f('0x41');}};}function msgResponse(_0x28b5f9,_0xaa5f8f,_0x3d3be3){return{'action':_0x28b5f9,'response':_0xaa5f8f,'message':_0x3d3be3,'stack':_0x3d3be3};}function myreject(_0x2e9d94){return function(_0x46339a){return _0x2e9d94(msgResponse(_0xca9f('0x45'),'Error',JSON[_0xca9f('0x46')](_0x46339a)));};}function getSeconds(_0x49f65e,_0xfda8b0){var _0x282b8e=moment(_0x49f65e)['milliseconds'](0x0);var _0x6ba7ba=moment(_0xfda8b0)[_0xca9f('0x47')](0x0);return _0x282b8e[_0xca9f('0x48')](_0x6ba7ba,_0xca9f('0x49'));}function emit(_0x2644bf,_0x57ae73,_0x4e8fda){io['to'](_0x2644bf)['emit'](_0x57ae73,_0x4e8fda);}function emitVoiceQueueSummary(_0x4643a2){if(_0x4643a2[_0xca9f('0x4a')]===_0xca9f('0x4b')){var _0x557dff={'id':_0x4643a2['id'],'name':_0x4643a2[_0xca9f('0x3c')],'strategy':_0x4643a2[_0xca9f('0x4c')],'answered':_0x4643a2['answered'],'available':_0x4643a2[_0xca9f('0x4d')],'loggedIn':_0x4643a2[_0xca9f('0x4e')],'pTalking':_0x4643a2['pTalking'],'sumBillable':_0x4643a2[_0xca9f('0x4f')],'sumDuration':_0x4643a2[_0xca9f('0x50')],'sumHoldTime':_0x4643a2[_0xca9f('0x51')]||0x0,'talking':_0x4643a2[_0xca9f('0x52')],'total':_0x4643a2[_0xca9f('0x53')],'type':_0x4643a2['type'],'unmanaged':_0x4643a2[_0xca9f('0x54')],'abandoned':_0x4643a2[_0xca9f('0x55')],'waiting':_0x4643a2['waiting'],'loggedInDb':_0x4643a2[_0xca9f('0x56')],'dialActive':_0x4643a2[_0xca9f('0x57')],'dialMethod':_0x4643a2[_0xca9f('0x58')],'dialOriginateCallerIdName':_0x4643a2[_0xca9f('0x59')],'dialOriginateCallerIdNumber':_0x4643a2[_0xca9f('0x5a')],'dialOriginateTimeout':_0x4643a2[_0xca9f('0x5b')],'dialPrefix':_0x4643a2[_0xca9f('0x5c')],'outboundAnswerAgiCallsDay':_0x4643a2[_0xca9f('0x5d')],'outboundAnswerCallsDay':_0x4643a2[_0xca9f('0x5e')],'outboundBlacklistCallsDay':_0x4643a2[_0xca9f('0x5f')],'outboundBusyCallsDay':_0x4643a2[_0xca9f('0x60')],'outboundCongestionCallsDay':_0x4643a2[_0xca9f('0x61')],'outboundDropCallsDayACS':_0x4643a2['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x4643a2[_0xca9f('0x62')],'outboundDropCallsDayTimeout':_0x4643a2[_0xca9f('0x63')],'outboundNoAnswerCallsDay':_0x4643a2[_0xca9f('0x64')],'outboundNoSuchCallsDay':_0x4643a2[_0xca9f('0x65')],'outboundOriginateFailureCallsDay':_0x4643a2[_0xca9f('0x66')],'outboundReCallsDay':_0x4643a2['outboundReCallsDay'],'outboundRejectCallsDay':_0x4643a2['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x4643a2[_0xca9f('0x67')],'predictiveIntervalAnsweredCalls':_0x4643a2['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x4643a2[_0xca9f('0x68')],'predictiveIntervalAvgTalktime':_0x4643a2[_0xca9f('0x69')],'predictiveIntervalDroppedCallsCallersExit':_0x4643a2[_0xca9f('0x6a')],'predictiveIntervalDroppedCallsTimeout':_0x4643a2[_0xca9f('0x6b')],'predictiveIntervalErlangCalls':_0x4643a2[_0xca9f('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x4643a2[_0xca9f('0x6d')],'predictiveIntervalHitRate':_0x4643a2['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x4643a2[_0xca9f('0x6e')],'predictiveIntervalPauses':_0x4643a2[_0xca9f('0x6f')],'predictiveIntervalAvailable':_0x4643a2['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x4643a2[_0xca9f('0x70')],'message':_0x4643a2[_0xca9f('0x3a')],'originated':_0x4643a2[_0xca9f('0x71')],'erlangCalls':_0x4643a2[_0xca9f('0x72')],'erlangCallToSecond':_0x4643a2['erlangCallToSecond'],'erlangAbandonmentRate':_0x4643a2[_0xca9f('0x73')],'erlangBusyFactor':_0x4643a2['erlangBusyFactor'],'startPredictive':_0x4643a2[_0xca9f('0x28')],'startProgressive':_0x4643a2[_0xca9f('0x29')]};if(_0x4643a2[_0xca9f('0x74')]){_0x557dff[_0xca9f('0x74')]={'id':_0x4643a2['Trunk']['id'],'name':_0x4643a2['Trunk']['name'],'active':_0x4643a2[_0xca9f('0x74')][_0xca9f('0x75')],'callerid':_0x4643a2[_0xca9f('0x74')][_0xca9f('0x76')]};}if(_0x4643a2[_0xca9f('0x40')]){_0x557dff[_0xca9f('0x40')]={'id':_0x4643a2[_0xca9f('0x40')]['id'],'name':_0x4643a2[_0xca9f('0x40')][_0xca9f('0x3c')]};}var _0x14bcb6=md5(JSON['stringify'](_0x557dff));if(_0x4643a2[_0xca9f('0x77')]!==_0x14bcb6){_0x4643a2['md5']=_0x14bcb6;emit(util[_0xca9f('0x78')](_0xca9f('0x79'),_0x557dff['name']),_0xca9f('0x7a'),_0x557dff);}}}function emitCampaignSummary(_0x34fcf1){if(_0x34fcf1[_0xca9f('0x4a')]===_0xca9f('0x7b')){emit(util[_0xca9f('0x78')](_0xca9f('0x7c'),_0x34fcf1[_0xca9f('0x3c')]),_0xca9f('0x7d'),_0x34fcf1);}}function checkGetDataPredictive(_0x599e2d){if(isNotNull(_0x599e2d)&&!_['isEmpty'](_0x599e2d)){loggerPredictive[_0xca9f('0x7e')](_0xca9f('0x7f'));loggerPredictive[_0xca9f('0x7e')](_0xca9f('0x80'),_0x599e2d[_0xca9f('0x70')]);loggerPredictive[_0xca9f('0x7e')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x599e2d[_0xca9f('0x81')]);loggerPredictive[_0xca9f('0x7e')](_0xca9f('0x82'),_0x599e2d['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xca9f('0x7e')](_0xca9f('0x83'),_0x599e2d['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0xca9f('0x84'),_0x599e2d[_0xca9f('0x68')]);loggerPredictive[_0xca9f('0x7e')](_0xca9f('0x85'),_0x599e2d[_0xca9f('0x69')]);loggerPredictive[_0xca9f('0x7e')](_0xca9f('0x86'));if(_0x599e2d[_0xca9f('0x70')]>0x0){if(!_[_0xca9f('0x87')](_0x599e2d[_0xca9f('0x69')])&&_0x599e2d[_0xca9f('0x69')]>0x0){return!![];}loggerPredictive[_0xca9f('0x7e')](_0xca9f('0x88'));if(!_[_0xca9f('0x87')](_0x599e2d[_0xca9f('0x68')])&&_0x599e2d[_0xca9f('0x68')]>0x0){return!![];}loggerPredictive[_0xca9f('0x7e')](_0xca9f('0x89'));}else{loggerPredictive['info'](_0xca9f('0x8a'));}}else{loggerPredictive[_0xca9f('0x7e')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5c8119){return function(_0x5ac9ed){loggerPredictive[_0xca9f('0x7e')](_0xca9f('0x8b'));loggerPredictive[_0xca9f('0x7e')](_0xca9f('0x8c'),_0x5ac9ed[_0xca9f('0x72')]);loggerPredictive[_0xca9f('0x7e')](_0xca9f('0x8d'),_0x5ac9ed[_0xca9f('0x8e')]);loggerPredictive[_0xca9f('0x7e')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5ac9ed[_0xca9f('0x73')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5ac9ed['erlangBusyFactor']);loggerPredictive[_0xca9f('0x7e')](_0xca9f('0x8f'),_0x5ac9ed[_0xca9f('0x73')]);loggerPredictive['info']('---------------------------');_[_0xca9f('0x90')](_0x5c8119,_0x5ac9ed);};}function getDiff(_0x386bd1){var _0x5d1638=moment()['milliseconds'](0x0);var _0x228c14=moment(_0x386bd1)[_0xca9f('0x47')](0x0);return _0x5d1638['diff'](_0x228c14,_0xca9f('0x49'));}function ifInterval(_0x159611,_0x5a9fb3){if(_['isUndefined'](_0x5a9fb3)){return![];}return getDiff(_0x5a9fb3)<_0x159611*0x3c;}function freeVariablesPredictive(_0x367a01){if(isNotNull(_0x367a01)){if(!_[_0xca9f('0x87')](_0x367a01['startProgressive'])){_0x367a01[_0xca9f('0x29')]=undefined;loggerPredictive['info'](_0x367a01['name'],_0xca9f('0x91'));}if(!_['isUndefined'](_0x367a01['startPredictive'])){_0x367a01[_0xca9f('0x28')]=undefined;loggerPredictive[_0xca9f('0x7e')](_0x367a01[_0xca9f('0x3c')],_0xca9f('0x92'));}if(!_['isUndefined'](_0x367a01[_0xca9f('0x93')])){clearInterval(_0x367a01[_0xca9f('0x93')]);_0x367a01['handlePredictive']=undefined;loggerPredictive[_0xca9f('0x7e')](_0x367a01[_0xca9f('0x3c')],_0xca9f('0x94'));}}}function erlangb(_0x50afd2,_0x2236fa){if(_0x2236fa===0x0){return 0x0;}var _0x2c6a70=0x1;for(var _0x158ae1=0x1;_0x158ae1<=_0x2236fa;_0x158ae1+=0x1){_0x2c6a70=0x1+_0x2c6a70*_0x158ae1/_0x50afd2;}return 0x1/_0x2c6a70;}function isVoiceQueueOutbound(_0x5080cd){return _0x5080cd===_0xca9f('0x4b');}function isNotPreview(_0xb3db81){return _0xb3db81!==_0xca9f('0x95');}function isCampaignIvr(_0x1c55bc){return _0x1c55bc===_0xca9f('0x7b');}function getCallerId(_0x465d3d,_0x2544d7,_0x5254b6){if(!_[_0xca9f('0x87')](_0x5254b6)&&typeof _0x5254b6==='string'&&!_['isEmpty'](_0x5254b6)){if(!_['isUndefined'](_0x2544d7)&&typeof _0x2544d7==='string'&&!_['isEmpty'](_0x2544d7)){return util[_0xca9f('0x78')]('\x22%s\x22\x20<%s>',_0x2544d7,_0x5254b6);}return util['format']('\x22%s\x22\x20<%s>',_0x5254b6,_0x5254b6);}if(!_[_0xca9f('0x87')](_0x465d3d)&&typeof _0x465d3d==='string'&&!_[_0xca9f('0x43')](_0x465d3d)){return _0x465d3d;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x4f4628,_0x435d20){return function(_0x52cf7c){freeVariablesPredictive(_0x435d20);emitVoiceQueueSummary(_0x435d20);emitCampaignSummary(_0x435d20);loggerSyncQueueSummary[_0xca9f('0x96')](_0x4f4628,util[_0xca9f('0x97')](_0x52cf7c,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x396eab,_0x2f5368){return function(_0x23881b){loggerPredictive[_0xca9f('0x96')](_0x2f5368[_0xca9f('0x3c')],_0x396eab);loggerPredictive[_0xca9f('0x96')](_0x23881b[_0xca9f('0x98')]);freeVariablesPredictive(_0x2f5368);};}function loggerCatch(_0xa0d5e1){return function(_0x1d83ca){logger[_0xca9f('0x96')](_0xa0d5e1,util[_0xca9f('0x97')](_0x1d83ca,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xb48c29){return _0xb48c29&&!_[_0xca9f('0x87')](_0xb48c29)&&_0xb48c29['length']>0x0;}function decremetOriginate(_0x17a592){if(!_['isUndefined'](_0x17a592)&&_0x17a592!==null){if(typeof _0x17a592[_0xca9f('0x71')]!==_0xca9f('0x99')){if(_0x17a592[_0xca9f('0x71')]>0x0){_0x17a592['originated']-=0x1;}else{logger[_0xca9f('0x96')](_0xca9f('0x9a'));}}}else{logger[_0xca9f('0x96')](_0xca9f('0x9b'));}}function checkContactLowerLimitOriginate(_0x352e72,_0x563595,_0x2b69b5){if(_0x563595>_0x2b69b5){for(var _0x394832=0x0;_0x394832<_0x563595-_0x2b69b5;_0x394832+=0x1){decremetOriginate(_0x352e72);}}}function loggerGetContactDialer(_0xc84c0b,_0x25db8c,_0x3158dc){return function(_0x55c421){checkContactLowerLimitOriginate(_0x25db8c,_0x3158dc,0x0);logger[_0xca9f('0x96')](_0xc84c0b,util[_0xca9f('0x97')](_0x55c421,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x241ae2){return function(_0x2121de){if(isNotNull(_0x2121de)&&isNotNull(_0x2121de[0x0])){if(_0x2121de[0x0][_0xca9f('0x9c')]>0x0){_0x241ae2[_0xca9f('0x3a')]=_0xca9f('0x9d');logger[_0xca9f('0x7e')](_0xca9f('0x9e')+_0x241ae2[_0xca9f('0x3c')],_0x2121de[0x0][_0xca9f('0x9c')],'contacts');}else{_0x241ae2[_0xca9f('0x3a')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xca9f('0x7e')](_0xca9f('0x9f')+_0x241ae2[_0xca9f('0x3c')]);}}};}function notSendMessagesQueue(_0x17dc92){if(_0x17dc92[_0xca9f('0xa0')]){freeVariablesPredictive(_0x17dc92);if(_0x17dc92[_0xca9f('0x71')]===0x0&&_0x17dc92[_0xca9f('0x52')]===0x0&&_0x17dc92[_0xca9f('0xa1')]===0x0&&(_0x17dc92[_0xca9f('0xa2')]||0x0)===0x0){_0x17dc92[_0xca9f('0xa0')]=![];_0x17dc92[_0xca9f('0x4d')]=0x0;_0x17dc92['message']=_0xca9f('0x3e');loggerSyncQueueSummary[_0xca9f('0x96')](_0xca9f('0xa3'),_0x17dc92[_0xca9f('0x3c')],_0xca9f('0xa4'));}else{_0x17dc92[_0xca9f('0x3a')]=_0xca9f('0xa5');loggerSyncQueueSummary['error'](_0xca9f('0xa3'),_0x17dc92[_0xca9f('0x3c')],_0xca9f('0xa6'));}emitVoiceQueueSummary(_0x17dc92);}}function notSendMessagesCampaign(_0x872534){if(_0x872534['sendMessageOneNotActive']){if(_0x872534[_0xca9f('0x71')]===0x0){_0x872534[_0xca9f('0xa0')]=![];_0x872534['message']=_0xca9f('0x3e');loggerSyncQueueSummary['error'](_0xca9f('0xa7'),_0x872534['name'],_0xca9f('0xa4'));}else{_0x872534[_0xca9f('0x3a')]='IS_DISACTIVED';loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x872534[_0xca9f('0x3c')],_0xca9f('0xa6'));}emitCampaignSummary(_0x872534);}}function createObjHistory(_0x21e802,_0x19908b,_0x1605ad,_0xe936f1,_0x566827){_0x21e802[_0xca9f('0x3a')]=_0x1605ad;var _0x4a5fa2=new Action(_0x21e802,_0x19908b);var _0x1d3441=new History(_0x4a5fa2);_0x1d3441[_0xca9f('0xa8')]=_0xe936f1;_0x1d3441[_0xca9f('0xa9')]=_0x566827;_0x1d3441[_0xca9f('0xaa')]=_0x4a5fa2[_0xca9f('0xab')];return _0x1d3441;}Dialer['prototype'][_0xca9f('0xac')]=function(){var _0x26e4c5=this;setInterval(function(){_0x26e4c5[_0xca9f('0xad')](_0x26e4c5[_0xca9f('0xae')],_0xca9f('0xaf'));_0x26e4c5[_0xca9f('0xad')](_0x26e4c5[_0xca9f('0x25')],_0xca9f('0xb0'));},0x32c8);};Dialer[_0xca9f('0xb1')][_0xca9f('0xad')]=function(_0x529853,_0x42dbaf){var _0x3c0d5a=this;for(var _0x59625b in _0x529853){if(typeof _0x529853[_0x59625b]!=='undefined'){this[_0xca9f('0x1e')][_0xca9f('0x1c')](function(){if(!_[_0xca9f('0xb2')](_0x529853[_0x59625b])){return ami['Action']({'action':_0xca9f('0xb3'),'channel':_0x529853[_0x59625b][_0xca9f('0xb4')]})[_0xca9f('0xb5')](function(_0x46db44){if(_0x46db44[_0xca9f('0x3a')]===_0xca9f('0xb6')){setTimeout(function(){if(_0x529853[_0x59625b]&&_0x529853[_0x59625b][_0xca9f('0x4a')]!==_0xca9f('0x7b')){_0x3c0d5a[_0xca9f('0xb7')](_0x3c0d5a[_0xca9f('0x1f')][_0x529853[_0x59625b][_0xca9f('0xb8')]]);logger[_0xca9f('0x96')]('[Dialer][checkChannel]',_0x42dbaf,_0x59625b,_0x529853[_0x59625b][_0xca9f('0xb8')]);delete _0x529853[_0x59625b];}if(_0x529853[_0x59625b]&&_0x529853[_0x59625b]['type']==='ivr'){_0x3c0d5a['updateOriginated'](_0x3c0d5a[_0xca9f('0x20')][_0x529853[_0x59625b]['queue']]);logger[_0xca9f('0x96')](_0xca9f('0xb9'),_0x42dbaf,_0x59625b,_0x529853[_0x59625b][_0xca9f('0xb8')]);delete _0x529853[_0x59625b];}},0x2328);}});}});}}};Dialer[_0xca9f('0xb1')]['countReScheduled']=function(_0x536fe0){return BPromise['resolve']()['then'](cmHopper[_0xca9f('0xba')](_0x536fe0))[_0xca9f('0xb5')](loggerCatch(_0xca9f('0xbb')));};Dialer['prototype']['checkIsBlackList']=function(_0xde4b27){return BPromise['resolve']()[_0xca9f('0xbc')](cmHopperBlack[_0xca9f('0xbd')](_0xde4b27))[_0xca9f('0xb5')](loggerCatch(_0xca9f('0xbe')));};Dialer[_0xca9f('0xb1')][_0xca9f('0xbf')]=function(_0x53e379,_0x3138a7,_0x128cab){return BPromise['resolve']()[_0xca9f('0xbc')](cmHopperAdditionalPhone[_0xca9f('0xbf')](_0x53e379,_0x3138a7,_0x128cab))[_0xca9f('0xb5')](loggerCatch(_0xca9f('0xc0')));};Dialer[_0xca9f('0xb1')][_0xca9f('0xc1')]=function(_0x1c616e,_0x30384d,_0xd101ae){return BPromise[_0xca9f('0xc2')]()[_0xca9f('0xbc')](cmHopperAdditionalPhone[_0xca9f('0xc1')](_0x1c616e,_0x30384d,_0xd101ae))[_0xca9f('0xb5')](loggerCatch(_0xca9f('0xc3')));};Dialer[_0xca9f('0xb1')][_0xca9f('0xc4')]=function(_0x570a1f){return BPromise[_0xca9f('0xc2')]()[_0xca9f('0xbc')](cmHopperBlack[_0xca9f('0xc4')](_0x570a1f))[_0xca9f('0xb5')](loggerCatch(_0xca9f('0xc5')));};Dialer['prototype'][_0xca9f('0xc6')]=function(_0x2b5ed8){return BPromise[_0xca9f('0xc2')]()['then'](cmHopperHistory['avgHandleTime'](_0x2b5ed8))['catch'](loggerCatch(_0xca9f('0xc7')));};Dialer['prototype'][_0xca9f('0xc8')]=function(_0x2ac70d){return BPromise[_0xca9f('0xc2')]()[_0xca9f('0xbc')](cmHopper[_0xca9f('0xc8')](_0x2ac70d))['catch'](loggerCatch(_0xca9f('0xc9')));};Dialer[_0xca9f('0xb1')][_0xca9f('0xca')]=function(_0x5260d7,_0x577356,_0x303468){return BPromise[_0xca9f('0xc2')]()[_0xca9f('0xbc')](cmHopper[_0xca9f('0xca')](_0x5260d7,_0x577356,_0x303468))[_0xca9f('0xb5')](loggerCatch(_0xca9f('0xcb')));};Dialer[_0xca9f('0xb1')][_0xca9f('0xcc')]=function(_0x3021e7,_0x340048,_0x44a171,_0x2b639a,_0x1289da){return BPromise[_0xca9f('0xc2')]()[_0xca9f('0xbc')](cmHopper[_0xca9f('0xcc')](_0x3021e7,_0x340048,_0x44a171,_0x2b639a))[_0xca9f('0xb5')](function(_0x5bd3f0){_0x1289da[_0xca9f('0xcd')]-=_0x44a171;_0x1289da[_0xca9f('0xcd')]=_0x1289da['temp']>0x0?_0x1289da[_0xca9f('0xcd')]:0x0;loggerCatch(_0xca9f('0xce'))(_0x5bd3f0);});};Dialer['prototype']['getContactDialerIvr']=function(_0x4e57f0,_0x375852,_0x4da2c3,_0x20dd4b){return BPromise[_0xca9f('0xc2')]()[_0xca9f('0xbc')](cmHopper[_0xca9f('0xcf')](_0x4e57f0,_0x375852,_0x4da2c3))['catch'](function(_0x558568){_0x20dd4b['temp']-=_0x375852;_0x20dd4b[_0xca9f('0xcd')]=_0x20dd4b[_0xca9f('0xcd')]>0x0?_0x20dd4b['temp']:0x0;loggerCatch(_0xca9f('0xd0'))(_0x558568);});};Dialer[_0xca9f('0xb1')][_0xca9f('0xd1')]=function(_0x270c63){return BPromise['resolve']()[_0xca9f('0xbc')](voiceQueueRt[_0xca9f('0xd1')](_0x270c63))[_0xca9f('0xb5')](loggerCatch(_0xca9f('0xd2')));};Dialer[_0xca9f('0xb1')][_0xca9f('0xd3')]=function(_0x1bc4f1){return BPromise[_0xca9f('0xc2')]()['then'](cmHopper[_0xca9f('0xd3')](_0x1bc4f1))[_0xca9f('0xb5')](loggerCatch(_0xca9f('0xd4')));};Dialer[_0xca9f('0xb1')][_0xca9f('0xd5')]=function(_0x4991b4){return BPromise[_0xca9f('0xc2')]()['then'](cmHopperHistory[_0xca9f('0xd5')](_0x4991b4))['catch'](loggerCatch(_0xca9f('0xd6')));};Dialer[_0xca9f('0xb1')][_0xca9f('0xb7')]=function(_0x4d10d0){if(!_['isUndefined'](_0x4d10d0)&&_0x4d10d0!==null){if(typeof _0x4d10d0[_0xca9f('0x71')]!=='undefined'){if(_0x4d10d0[_0xca9f('0x71')]>0x0){_0x4d10d0[_0xca9f('0x71')]-=0x1;}else{logger[_0xca9f('0x96')](_0xca9f('0xd7'));}}}else{logger[_0xca9f('0x96')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xca9f('0xb1')]['loggerHandler']=function(_0x703ed5,_0x2c103a){var _0x3c5de2=this;return function(_0x503eaf){_0x3c5de2[_0xca9f('0xb7')](_0x2c103a);logger[_0xca9f('0x96')](_0x703ed5,util[_0xca9f('0x97')](_0x503eaf,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x433ea3,_0x5ca580,_0x7a98f8){var _0x3ac901={'state':0x19,'statedesc':_0xca9f('0xd8')};this['updateOriginated'](_0x5ca580);this[_0xca9f('0xd9')](_[_0xca9f('0x90')](_0x3ac901,_['pick'](_0x7a98f8,[_0xca9f('0xda'),_0xca9f('0xdb'),_0xca9f('0xdc'),_0xca9f('0xdd'),_0xca9f('0xde')])),_0xca9f('0xdf'),_0xca9f('0xe0'));logger[_0xca9f('0x96')](_0x433ea3);};Dialer[_0xca9f('0xb1')][_0xca9f('0xe1')]=function(_0x218b2c){return _0x218b2c===_0xca9f('0xe2');};Dialer[_0xca9f('0xb1')][_0xca9f('0xe3')]=function(_0x5af2cd){return!_[_0xca9f('0x87')](_0x5af2cd)&&_0x5af2cd&&!_[_0xca9f('0x87')](_0x5af2cd[_0xca9f('0x3c')])&&!_[_0xca9f('0x87')](_0x5af2cd[_0xca9f('0x75')])&&_0x5af2cd[_0xca9f('0x75')]&&(this[_0xca9f('0x22')][util[_0xca9f('0x78')](_0xca9f('0xe4'),_0x5af2cd['name'])][_0xca9f('0xb3')]===_0xca9f('0xe5')||this[_0xca9f('0x22')][util[_0xca9f('0x78')](_0xca9f('0xe4'),_0x5af2cd[_0xca9f('0x3c')])]['status']==='unmonitored');};Dialer[_0xca9f('0xb1')][_0xca9f('0xd9')]=function(_0x5cf8fa,_0x480126,_0x31e9ed){this['createHistory'](_0x5cf8fa)['catch'](loggerCatch(_0x480126));this['moveContactManagedDialer'](_0x5cf8fa)['catch'](loggerCatch(_0x31e9ed));};Dialer[_0xca9f('0xb1')][_0xca9f('0xe6')]=function(_0x3bfae5){var _0x5f4cad=this[_0xca9f('0xae')][_0x3bfae5['uniqueid']];var _0x2d73a9;if(!_[_0xca9f('0xb2')](_0x3bfae5)&&!_[_0xca9f('0xb2')](_0x3bfae5[_0xca9f('0xe7')])&&!_[_0xca9f('0xb2')](_0x3bfae5['variable'][_0xca9f('0xe8')])&&_0x3bfae5[_0xca9f('0xe9')]===_0xca9f('0xea')&&_0x5f4cad){if(_0x5f4cad[_0xca9f('0x4a')]!==_0xca9f('0x7b')&&this[_0xca9f('0x1f')][_0x5f4cad['queue']][_0xca9f('0xeb')]&&_0x3bfae5['value']==='HANGUP'){delete this['uniqueId'][_0x3bfae5[_0xca9f('0xec')]];this[_0xca9f('0xb7')](this[_0xca9f('0x1f')][_0x5f4cad[_0xca9f('0xb8')]]);this[_0xca9f('0x1f')][_0x5f4cad[_0xca9f('0xb8')]][_0xca9f('0x5e')]+=0x1;this[_0xca9f('0x1f')][_0x5f4cad[_0xca9f('0xb8')]][_0xca9f('0x5d')]+=0x1;_0x2d73a9=new Hangup(_0x5f4cad,_0x3bfae5);_0x2d73a9[_0xca9f('0xa8')]=0x12;_0x2d73a9[_0xca9f('0xa9')]=_0xca9f('0xed');_0x2d73a9['membername']=_0xca9f('0xee');ami[_0xca9f('0xef')](_0xca9f('0xf0'),ut['buildObj'](_0x2d73a9,_0xca9f('0xf1')));this['saveInDb'](_0x2d73a9,'[syncHangupInAMD][createHistory]',_0xca9f('0xf2'));}if(_0x5f4cad[_0xca9f('0x4a')]!=='ivr'&&this['voiceQueues'][_0x5f4cad[_0xca9f('0xb8')]]['dialAMDActive']&&_0x3bfae5[_0xca9f('0xf3')]===_0xca9f('0xf4')){var _0xb4558a=this;return new BPromise(function(_0x582663,_0x125e3f){delete _0xb4558a[_0xca9f('0xae')][_0x3bfae5[_0xca9f('0xec')]];_0xb4558a[_0xca9f('0xb7')](_0xb4558a['voiceQueues'][_0x5f4cad[_0xca9f('0xb8')]]);_0xb4558a[_0xca9f('0x1f')][_0x5f4cad[_0xca9f('0xb8')]][_0xca9f('0x5e')]+=0x1;_0xb4558a[_0xca9f('0x1f')][_0x5f4cad['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0xaa338b=_0xb4558a['voiceQueues'][_0x5f4cad['queue']];var _0x284993=new Hangup(_0x5f4cad,_0x3bfae5);_0x284993[_0xca9f('0xa8')]=0x13;_0x284993[_0xca9f('0xa9')]=_0xca9f('0xf5');_0x284993[_0xca9f('0xf6')]=_0xca9f('0xee');_0x284993['countmachineretry']+=0x1;_0x284993[_0xca9f('0xf7')]+=0x1;_0x284993[_0xca9f('0xf1')]=!![];ami[_0xca9f('0xef')](_0xca9f('0xf0'),ut[_0xca9f('0xf8')](_0x284993,_0xca9f('0xf1')));_0xb4558a[_0xca9f('0xd5')](_0x284993)[_0xca9f('0xb5')](loggerCatch(_0xca9f('0xf9')));if(_0x284993[_0xca9f('0xfa')]+_0x284993[_0xca9f('0xfb')]+_0x284993[_0xca9f('0xfc')]+_0x284993[_0xca9f('0xfd')]+_0x284993[_0xca9f('0xfe')]+_0x284993[_0xca9f('0xff')]+_0x284993[_0xca9f('0x100')]+_0x284993[_0xca9f('0x101')]>=_0xaa338b[_0xca9f('0x102')]){_0xb4558a['stateGlobal'](_0x284993,_0x582663,_0x125e3f,_0xca9f('0x103'));}else{if(_0x284993[_0xca9f('0x100')]>=_0xaa338b['dialMachineMaxRetry']){_0xb4558a['createStateFinal'](_0x284993,_0x582663,_0x125e3f,_0xca9f('0x104'));}else{_0xb4558a[_0xca9f('0xc8')]({'active':![],'countmachineretry':_0x284993[_0xca9f('0x100')],'scheduledat':moment()[_0xca9f('0x105')](_0xaa338b['dialMachineRetryFrequency'],'minutes')[_0xca9f('0x78')](_0xca9f('0x106')),'ContactId':_0x284993[_0xca9f('0xda')],'ListId':_0x284993['ListId'],'VoiceQueueId':_0x284993['VoiceQueueId']||undefined,'CampaignId':_0x284993['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x582663({'reschedule':0x1});}}});}if(_0x5f4cad[_0xca9f('0x4a')]===_0xca9f('0x7b')&&this[_0xca9f('0x20')][_0x5f4cad['queue']][_0xca9f('0xeb')]&&_0x3bfae5['value']===_0xca9f('0x107')){delete this['uniqueId'][_0x3bfae5['uniqueid']];this['updateOriginated'](this[_0xca9f('0x20')][_0x5f4cad[_0xca9f('0xb8')]]);_0x2d73a9=new Hangup(_0x5f4cad,_0x3bfae5);_0x2d73a9['state']=0x12;_0x2d73a9[_0xca9f('0xa9')]=_0xca9f('0xed');_0x2d73a9[_0xca9f('0xf6')]=_0xca9f('0xee');ami[_0xca9f('0xef')](_0xca9f('0xf0'),ut['buildObj'](_0x2d73a9,_0xca9f('0xf1')));this[_0xca9f('0xd9')](_0x2d73a9,_0xca9f('0x108'),'[syncHangupInAMDIvr]');}if(_0x5f4cad[_0xca9f('0x4a')]==='ivr'&&this['campaigns'][_0x5f4cad[_0xca9f('0xb8')]]['dialAMDActive']&&_0x3bfae5['value']===_0xca9f('0xf4')){var _0xb4558a=this;return new BPromise(function(_0x12bf7f,_0x8dfeb4){delete _0xb4558a['uniqueId'][_0x3bfae5[_0xca9f('0xec')]];_0xb4558a[_0xca9f('0xb7')](_0xb4558a[_0xca9f('0x20')][_0x5f4cad[_0xca9f('0xb8')]]);_0xb4558a['campaigns'][_0x5f4cad[_0xca9f('0xb8')]][_0xca9f('0x5e')]+=0x1;_0xb4558a['campaigns'][_0x5f4cad['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x52026d=_0xb4558a['campaigns'][_0x5f4cad[_0xca9f('0xb8')]];var _0x4ba57d=new Hangup(_0x5f4cad,_0x3bfae5);_0x4ba57d[_0xca9f('0xa8')]=0x13;_0x4ba57d[_0xca9f('0xa9')]='Machine';_0x4ba57d[_0xca9f('0xf6')]='AMD';_0x4ba57d[_0xca9f('0x100')]+=0x1;_0x4ba57d[_0xca9f('0xf7')]+=0x1;_0x4ba57d[_0xca9f('0xf1')]=!![];ami[_0xca9f('0xef')](_0xca9f('0xf0'),ut[_0xca9f('0xf8')](_0x4ba57d,'amd'));_0xb4558a[_0xca9f('0xd5')](_0x4ba57d)[_0xca9f('0xb5')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4ba57d['countbusyretry']+_0x4ba57d['countcongestionretry']+_0x4ba57d[_0xca9f('0xfc')]+_0x4ba57d[_0xca9f('0xfd')]+_0x4ba57d[_0xca9f('0xfe')]+_0x4ba57d[_0xca9f('0xff')]+_0x4ba57d[_0xca9f('0x100')]+_0x4ba57d['countagentrejectretry']>=_0x52026d[_0xca9f('0x102')]){_0xb4558a[_0xca9f('0x109')](_0x4ba57d,_0x12bf7f,_0x8dfeb4,_0xca9f('0x103'));}else{if(_0x4ba57d[_0xca9f('0x100')]>=_0x52026d[_0xca9f('0x10a')]){_0xb4558a[_0xca9f('0x10b')](_0x4ba57d,_0x12bf7f,_0x8dfeb4,'reason\x2019\x20machine....');}else{_0xb4558a[_0xca9f('0xc8')]({'active':![],'countmachineretry':_0x4ba57d[_0xca9f('0x100')],'scheduledat':moment()[_0xca9f('0x105')](_0x52026d['dialMachineRetryFrequency'],_0xca9f('0x10c'))[_0xca9f('0x78')](_0xca9f('0x106')),'ContactId':_0x4ba57d[_0xca9f('0xda')],'ListId':_0x4ba57d[_0xca9f('0xdb')],'VoiceQueueId':_0x4ba57d['VoiceQueueId']||undefined,'CampaignId':_0x4ba57d[_0xca9f('0xde')]||undefined})[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x10d')));_0x12bf7f({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xca9f('0x10e')]=function(_0x3884bf){var _0x209906=this[_0xca9f('0xae')][_0x3884bf[_0xca9f('0xec')]];var _0x2d23bb=this;var _0x122907;if(_0x209906&&_0x209906['type']==='ivr'){delete this[_0xca9f('0xae')][_0x3884bf[_0xca9f('0xec')]];this[_0xca9f('0xb7')](this[_0xca9f('0x20')][_0x209906[_0xca9f('0xb8')]]);this[_0xca9f('0x20')][_0x209906[_0xca9f('0xb8')]][_0xca9f('0x10f')]+=0x1;_0x122907=new Hangup(_0x209906,_0x3884bf);this[_0xca9f('0xd5')](_0x122907)[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x110')));this[_0xca9f('0xd3')](_0x122907)[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x111')));}if(_0x209906&&_0x209906[_0xca9f('0x4a')]!=='ivr'&&isNotNull(this[_0xca9f('0x1f')][_0x209906['queue']]['dialQueueProject'])){delete this['uniqueId'][_0x3884bf[_0xca9f('0xec')]];this[_0xca9f('0xb7')](this[_0xca9f('0x1f')][_0x209906[_0xca9f('0xb8')]]);this[_0xca9f('0x1f')][_0x209906[_0xca9f('0xb8')]][_0xca9f('0x5e')]+=0x1;this[_0xca9f('0x1f')][_0x209906[_0xca9f('0xb8')]][_0xca9f('0x5d')]+=0x1;_0x122907=new Hangup(_0x209906,_0x3884bf);_0x122907[_0xca9f('0xa8')]=0x10;_0x122907[_0xca9f('0xa9')]=_0xca9f('0x112');_0x122907['membername']=_0xca9f('0x113');this[_0xca9f('0xd5')](_0x122907)[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x110')));this[_0xca9f('0xd3')](_0x122907)[_0xca9f('0xb5')](loggerCatch('[syncHangupIvr]'));}if(_0x209906&&_0x209906[_0xca9f('0x4a')]!==_0xca9f('0x7b')&&!isNotNull(this[_0xca9f('0x1f')][_0x209906[_0xca9f('0xb8')]][_0xca9f('0x114')])){delete this[_0xca9f('0xae')][_0x3884bf[_0xca9f('0xec')]];this[_0xca9f('0xb7')](this['voiceQueues'][_0x209906['queue']]);this[_0xca9f('0x1f')][_0x209906[_0xca9f('0xb8')]][_0xca9f('0x67')]+=0x1;_0x122907=new Hangup(_0x209906,_0x3884bf);_0x122907['state']=0xc;_0x122907[_0xca9f('0xa9')]=_0x3884bf['cause-txt'];_0x122907[_0xca9f('0xf6')]=_0xca9f('0x115');this[_0xca9f('0xd5')](_0x122907)['catch'](loggerCatch(_0xca9f('0x110')));this[_0xca9f('0xd3')](_0x122907)[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x111')));}};Dialer[_0xca9f('0xb1')]['syncAgentComplete']=function(_0x2452e2){var _0x3c7b66=this['uniqueId'][_0x2452e2['uniqueid']];var _0x2503bc=this;if(this[_0xca9f('0x1f')][_0x2452e2[_0xca9f('0xb8')]]){if(_0x3c7b66&&_0x3c7b66[_0xca9f('0x4a')]!==_0xca9f('0x7b')){delete this[_0xca9f('0xae')][_0x2452e2[_0xca9f('0xec')]];this[_0xca9f('0x1f')][_0x2452e2[_0xca9f('0xb8')]][_0xca9f('0x5e')]+=0x1;var _0x425d9a=new AgentComplete(_0x3c7b66,_0x2452e2);if(_0x2452e2[_0xca9f('0x116')]==='agent'){_0x425d9a[_0xca9f('0x117')]=this[_0xca9f('0x1f')][_0x2452e2['queue']][_0xca9f('0x118')]&&this['voiceQueues'][_0x2452e2[_0xca9f('0xb8')]][_0xca9f('0x119')]?moment()[_0xca9f('0x78')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xca9f('0xd5')](_0x425d9a)[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x11a')));this['moveContactManagedDialer'](_0x425d9a)[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x11b')));}}};Dialer['prototype']['syncAgentConnect']=function(_0x24901f){if(this[_0xca9f('0x1f')][_0x24901f[_0xca9f('0xb8')]]){if(this[_0xca9f('0xae')][_0x24901f['uniqueid']]&&this[_0xca9f('0xae')][_0x24901f['uniqueid']][_0xca9f('0x4a')]!=='ivr'){this[_0xca9f('0xb7')](this[_0xca9f('0x1f')][_0x24901f[_0xca9f('0xb8')]]);this[_0xca9f('0xae')][_0x24901f['uniqueid']][_0xca9f('0x11c')]=moment()[_0xca9f('0x78')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xca9f('0xb1')]['queueCallerAbandonCreateState']=function(_0x1254ea,_0x47ded4){this[_0xca9f('0xd5')](_0x1254ea)['catch'](loggerCatch(_0xca9f('0x11a')));if(_0x47ded4==0x0){this[_0xca9f('0xd3')](_0x1254ea)['catch'](loggerCatch(_0xca9f('0x11d')));}};Dialer[_0xca9f('0xb1')]['syncQueueCallerAbandon']=function(_0xd318d){var _0xffb2bf=this[_0xca9f('0xae')][_0xd318d[_0xca9f('0xec')]];var _0x4aa0be=this;var _0x3b0ad3=![];var _0x51e8dd;var _0x2ed13f;if(this['voiceQueues'][_0xd318d[_0xca9f('0xb8')]]){if(_0xffb2bf&&_0xffb2bf[_0xca9f('0x4a')]!==_0xca9f('0x7b')){delete this[_0xca9f('0xae')][_0xd318d[_0xca9f('0xec')]];this['updateOriginated'](this['voiceQueues'][_0xd318d[_0xca9f('0xb8')]]);_0xffb2bf[_0xca9f('0x11e')]=moment()[_0xca9f('0x78')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4b0311=new QueueCallerAbandon(_0xffb2bf,_0xd318d);if(getSeconds(_0xffb2bf[_0xca9f('0x11e')],_0xffb2bf['responsetime'])>=_0xffb2bf['dialQueueTimeout']){this[_0xca9f('0x1f')][_0xd318d[_0xca9f('0xb8')]][_0xca9f('0x6b')]+=0x1;this[_0xca9f('0x1f')][_0xd318d[_0xca9f('0xb8')]][_0xca9f('0x63')]+=0x1;this[_0xca9f('0x1f')][_0xd318d[_0xca9f('0xb8')]][_0xca9f('0x6d')]+=0x1;_0x4b0311['state']=0xa;_0x4b0311[_0xca9f('0xa9')]=_0xca9f('0x11f');_0x4b0311['dropreason']=_0xca9f('0x120');_0x4b0311[_0xca9f('0x117')]=this['voiceQueues'][_0xd318d['queue']][_0xca9f('0x118')]?moment()['format'](_0xca9f('0x106')):undefined;_0x4b0311[_0xca9f('0xfe')]+=0x1;_0x4b0311['countglobal']+=0x1;_0x51e8dd=this[_0xca9f('0x1f')][_0xd318d[_0xca9f('0xb8')]][_0xca9f('0x121')];_0x2ed13f=this[_0xca9f('0x1f')][_0xd318d['queue']][_0xca9f('0x122')];_0x4aa0be[_0xca9f('0xbf')](_0x4b0311,_0x4b0311['state'],_0xffb2bf[_0xca9f('0x123')])[_0xca9f('0xbc')](function(_0x39aad2){_0x3b0ad3=_0x39aad2[_0xca9f('0x124')]==0x1;if(_0x4b0311[_0xca9f('0xfe')]>=_0x4aa0be[_0xca9f('0x1f')][_0xd318d[_0xca9f('0xb8')]]['dialDropMaxRetry']){_0x4aa0be['queueCallerAbandonCreateState'](_0x4b0311,_0x39aad2[_0xca9f('0x124')]);}else{_0x4aa0be['rescheduleContact']({'active':![],'countdropretry':_0x4b0311[_0xca9f('0xfe')],'scheduledat':moment()['add'](this[_0xca9f('0x1f')][_0xd318d[_0xca9f('0xb8')]][_0xca9f('0x121')],'minutes')[_0xca9f('0x78')](_0xca9f('0x106')),'ContactId':_0xffb2bf[_0xca9f('0xda')],'ListId':_0xffb2bf[_0xca9f('0xdb')],'VoiceQueueId':_0xffb2bf[_0xca9f('0xdd')]||undefined,'CampaignId':_0xffb2bf[_0xca9f('0xde')]||undefined})[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x125')));var _0x3a6b61=new History(_0x4b0311);_0x3a6b61[_0xca9f('0xa8')]=0xa;_0x3a6b61[_0xca9f('0xa9')]=_0xca9f('0x11f');_0x3a6b61[_0xca9f('0xab')]=moment()[_0xca9f('0x78')](_0xca9f('0x106'));_0x3a6b61[_0xca9f('0xaa')]=_0x3a6b61[_0xca9f('0xab')];_0x3a6b61[_0xca9f('0x126')]=_0x4b0311[_0xca9f('0x126')];_0x3a6b61['calleridnum']=_0x4b0311[_0xca9f('0x127')];_0x4aa0be['createHistory'](_0x3a6b61)[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x128')));}})[_0xca9f('0xbc')](function(_0x5276ea){if(_0x3b0ad3)_0x4aa0be[_0xca9f('0xc1')](_0x4b0311,_0x51e8dd,_0x2ed13f)[_0xca9f('0xbc')](function(_0x3ae0e0){return 0x1;});});}else{this[_0xca9f('0x1f')][_0xd318d['queue']][_0xca9f('0x6a')]+=0x1;this['voiceQueues'][_0xd318d['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x4b0311[_0xca9f('0xa8')]=0xb;_0x4b0311['statedesc']=_0xca9f('0x129');_0x4b0311[_0xca9f('0x12a')]=_0xca9f('0x12b');_0x4b0311['countabandonedretry']+=0x1;_0x4b0311[_0xca9f('0xf7')]+=0x1;_0x51e8dd=this[_0xca9f('0x1f')][_0xd318d[_0xca9f('0xb8')]][_0xca9f('0x12c')];_0x2ed13f=this[_0xca9f('0x1f')][_0xd318d[_0xca9f('0xb8')]][_0xca9f('0x122')];_0x4aa0be[_0xca9f('0xbf')](_0x4b0311,_0x4b0311[_0xca9f('0xa8')],_0xffb2bf[_0xca9f('0x123')])[_0xca9f('0xbc')](function(_0x44c9a2){if(_0x4b0311[_0xca9f('0xff')]>=_0x4aa0be['voiceQueues'][_0xd318d[_0xca9f('0xb8')]][_0xca9f('0x12d')]){_0x4aa0be[_0xca9f('0x12e')](_0x4b0311,_0x44c9a2[_0xca9f('0x124')]);}else{_0x4aa0be['rescheduleContact']({'active':![],'countabandonedretry':_0x4b0311['countabandonedretry'],'scheduledat':moment()[_0xca9f('0x105')](this[_0xca9f('0x1f')][_0xd318d[_0xca9f('0xb8')]]['dialAbandonedRetryFrequency'],_0xca9f('0x10c'))['format'](_0xca9f('0x106')),'ContactId':_0xffb2bf[_0xca9f('0xda')],'ListId':_0xffb2bf[_0xca9f('0xdb')],'VoiceQueueId':_0xffb2bf['VoiceQueueId']||undefined,'CampaignId':_0xffb2bf[_0xca9f('0xde')]||undefined})[_0xca9f('0xb5')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x377ff4=new History(_0x4b0311);_0x377ff4[_0xca9f('0xa8')]=0xb;_0x377ff4[_0xca9f('0xa9')]=_0xca9f('0x129');_0x377ff4[_0xca9f('0xab')]=moment()[_0xca9f('0x78')](_0xca9f('0x106'));_0x377ff4['endtime']=_0x377ff4['starttime'];_0x377ff4[_0xca9f('0x126')]=_0x4b0311[_0xca9f('0x126')];_0x377ff4[_0xca9f('0x127')]=_0x4b0311[_0xca9f('0x127')];_0x4aa0be[_0xca9f('0xd5')](_0x377ff4)[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x12f')));}})[_0xca9f('0xbc')](function(_0x4d62cb){if(_0x3b0ad3)_0x4aa0be[_0xca9f('0xc1')](_0x4b0311,_0x51e8dd,_0x2ed13f)[_0xca9f('0xbc')](function(_0x1c401){return 0x1;});});}}}};Dialer[_0xca9f('0xb1')][_0xca9f('0x35')]=function(_0x4fdc62){if(this[_0xca9f('0x25')][_0x4fdc62[_0xca9f('0xec')]]){this[_0xca9f('0x25')][_0x4fdc62[_0xca9f('0xec')]][_0xca9f('0xb4')]=_0x4fdc62[_0xca9f('0xb4')];}if(this[_0xca9f('0xae')][_0x4fdc62[_0xca9f('0xec')]]){this[_0xca9f('0xae')][_0x4fdc62[_0xca9f('0xec')]][_0xca9f('0xb4')]=_0x4fdc62[_0xca9f('0xb4')];}};Dialer[_0xca9f('0xb1')]['syncQueueMember']=function(_0x3b2586){if(strategy[this[_0xca9f('0x1f')][this[_0xca9f('0x25')][_0x3b2586[_0xca9f('0x130')]][_0xca9f('0xb8')]][_0xca9f('0x4c')]]===_0xca9f('0x131')){if(this[_0xca9f('0x25')][_0x3b2586['actionid']]&&_[_0xca9f('0xb2')](this[_0xca9f('0x25')][_0x3b2586[_0xca9f('0x130')]][_0xca9f('0x132')])&&_0x3b2586[_0xca9f('0xb3')]==='1'&&_0x3b2586[_0xca9f('0x133')]==='0'){if(this['agents'][_0x3b2586[_0xca9f('0x134')]]){if(!this[_0xca9f('0x21')][_0x3b2586[_0xca9f('0x134')]][_0xca9f('0x132')]){this[_0xca9f('0x21')][_0x3b2586['stateinterface']][_0xca9f('0x132')]=!![];this['actions'][_0x3b2586[_0xca9f('0x130')]][_0xca9f('0x132')]=!![];this['actions'][_0x3b2586[_0xca9f('0x130')]][_0xca9f('0x134')]=_0x3b2586[_0xca9f('0x134')];}}}}else if((strategy[this['voiceQueues'][this['actions'][_0x3b2586[_0xca9f('0x130')]][_0xca9f('0xb8')]][_0xca9f('0x4c')]]||_0xca9f('0x1b'))===_0xca9f('0x1b')){if(this['actions'][_0x3b2586['actionid']]){if(this[_0xca9f('0x21')][_0x3b2586[_0xca9f('0x134')]]){this[_0xca9f('0x25')][_0x3b2586['actionid']][_0xca9f('0x134')]=_0x3b2586[_0xca9f('0x134')];if(_[_0xca9f('0xb2')](this[_0xca9f('0x2b')][this[_0xca9f('0x25')][_0x3b2586[_0xca9f('0x130')]][_0xca9f('0xb8')]])){this[_0xca9f('0x2b')][this[_0xca9f('0x25')][_0x3b2586[_0xca9f('0x130')]][_0xca9f('0xb8')]]=[];}this[_0xca9f('0x2b')][this[_0xca9f('0x25')][_0x3b2586[_0xca9f('0x130')]][_0xca9f('0xb8')]][_0xca9f('0x135')](_['merge'](_[_0xca9f('0x136')](this[_0xca9f('0x25')][_0x3b2586['actionid']],[_0xca9f('0x137'),_0xca9f('0x134')]),{'status':_0x3b2586['status'],'paused':_0x3b2586[_0xca9f('0x133')]}));}}}};function unlockQueueStatus(_0x328165,_0x36f413){setTimeout(function(){if(_[_0xca9f('0x87')](_0x328165['queueStatusComplete'])){loggerBooked[_0xca9f('0x96')](_0xca9f('0x138'),_0x36f413);}_0x328165[_0xca9f('0x139')]=!![];loggerBooked[_0xca9f('0x7e')](_0xca9f('0x13a'),_0x36f413,JSON[_0xca9f('0x46')](_['pick'](_0x328165,[_0xca9f('0x3c'),_0xca9f('0x139')])));},0x1f3);}Dialer[_0xca9f('0xb1')][_0xca9f('0x39')]=function(_0x4321ca){var _0x1e53a2=this;var _0x58ac05=_0x1e53a2[_0xca9f('0x1f')][_0x1e53a2[_0xca9f('0x25')][_0x4321ca[_0xca9f('0x130')]][_0xca9f('0xb8')]];if(strategy[this[_0xca9f('0x1f')][this[_0xca9f('0x25')][_0x4321ca[_0xca9f('0x130')]]['queue']]['strategy']]===_0xca9f('0x131')){if(this['actions'][_0x4321ca[_0xca9f('0x130')]]&&this[_0xca9f('0x25')][_0x4321ca[_0xca9f('0x130')]][_0xca9f('0x134')]){this[_0xca9f('0x95')][_0xca9f('0x13b')](this[_0xca9f('0x25')][_0x4321ca[_0xca9f('0x130')]][_0xca9f('0x137')],this[_0xca9f('0x25')][_0x4321ca[_0xca9f('0x130')]][_0xca9f('0x134')])[_0xca9f('0xb5')](function(_0x18767b){logger[_0xca9f('0x96')](_0xca9f('0x13c'),util['inspect'](_0x18767b,{'showHidden':![],'depth':null}));})[_0xca9f('0x13d')](function(){_0x1e53a2['updateOriginated'](_0x1e53a2[_0xca9f('0x1f')][_0x1e53a2[_0xca9f('0x25')][_0x4321ca[_0xca9f('0x130')]]['queue']]);_0x1e53a2['agents'][_0x1e53a2[_0xca9f('0x25')][_0x4321ca[_0xca9f('0x130')]][_0xca9f('0x134')]]['locked']=![];delete _0x1e53a2[_0xca9f('0x25')][_0x4321ca[_0xca9f('0x130')]];unlockQueueStatus(_0x58ac05);});}else{this[_0xca9f('0xb7')](this[_0xca9f('0x1f')][this[_0xca9f('0x25')][_0x4321ca[_0xca9f('0x130')]][_0xca9f('0xb8')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x4321ca[_0xca9f('0x130')]]['ContactId'],'ListId':this[_0xca9f('0x25')][_0x4321ca[_0xca9f('0x130')]][_0xca9f('0xdb')],'VoiceQueueId':this[_0xca9f('0x25')][_0x4321ca[_0xca9f('0x130')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xca9f('0x25')][_0x4321ca[_0xca9f('0x130')]][_0xca9f('0xde')]||undefined})[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x13e')));delete this[_0xca9f('0x25')][_0x4321ca[_0xca9f('0x130')]];unlockQueueStatus(_0x58ac05);}}else if((strategy[this[_0xca9f('0x1f')][this['actions'][_0x4321ca[_0xca9f('0x130')]][_0xca9f('0xb8')]][_0xca9f('0x4c')]]||_0xca9f('0x1b'))==='rrmemory'){var _0x25257a;if(this[_0xca9f('0x25')][_0x4321ca[_0xca9f('0x130')]]&&!_['isEmpty'](this['queueBooked'][this['actions'][_0x4321ca[_0xca9f('0x130')]]['queue']])){if(this['queueBookedRR'][_0x1e53a2['actions'][_0x4321ca[_0xca9f('0x130')]][_0xca9f('0xb8')]]){this[_0xca9f('0x13f')][_0x1e53a2['actions'][_0x4321ca['actionid']][_0xca9f('0xb8')]]=this[_0xca9f('0x13f')][this['actions'][_0x4321ca['actionid']][_0xca9f('0xb8')]]?this[_0xca9f('0x13f')][this[_0xca9f('0x25')][_0x4321ca['actionid']][_0xca9f('0xb8')]]:this[_0xca9f('0x2b')][this[_0xca9f('0x25')][_0x4321ca['actionid']][_0xca9f('0xb8')]]?this['queueBooked'][this['actions'][_0x4321ca[_0xca9f('0x130')]][_0xca9f('0xb8')]][_0xca9f('0x140')]||0x0:0x0;}this[_0xca9f('0x2b')][this[_0xca9f('0x25')][_0x4321ca[_0xca9f('0x130')]][_0xca9f('0xb8')]][_0xca9f('0x140')]=this['queueBookedRR'][this['actions'][_0x4321ca[_0xca9f('0x130')]][_0xca9f('0xb8')]];for(var _0x1a598a=0x0;_0x1a598a=0x0;})[_0xca9f('0xb5')](myreject(_0x1daf44)));}}else{_0x3b08cc[_0xca9f('0x135')](ami[_0xca9f('0x159')]({'action':_0xca9f('0x15a'),'command':util[_0xca9f('0x78')](_0xca9f('0x15c'),_0x37029b,!_[_0xca9f('0x87')](config['timezones'][_0x4cb9f2])?_0x4cb9f2:'')})['then'](function(_0x493f7e){return _0x493f7e[_0xca9f('0x15d')][_0xca9f('0x15e')]('true')>=0x0;})[_0xca9f('0xb5')](myreject(_0x1daf44)));}BPromise[_0xca9f('0x15f')](_0x3b08cc)['then'](function(_0x25d464){var _0x53ae18=_[_0xca9f('0x160')](_0x25d464);if(_0x53ae18){return _0x55e757(_0x53ae18);}else{_0x1b503a['message']=_0x36caf5?_0xca9f('0x161'):_0xca9f('0x162');return _0x1daf44(msgResponse(_0xca9f('0x163'),_0xca9f('0x152'),_0xca9f('0x164')+_0x36caf5+'\x20'+_0x5cfa03+_0xca9f('0x165')+util[_0xca9f('0x97')](_0x37029b,{'showHidden':![],'depth':null})+_0xca9f('0x166')+_0x4cb9f2));}})[_0xca9f('0xb5')](function(_0x1f188a){return _0x1daf44(msgResponse(_0xca9f('0x151'),_0xca9f('0x152'),JSON[_0xca9f('0x46')](_0x1f188a)));});});};Dialer[_0xca9f('0xb1')]['checkDialMethod']=function(_0x2f5c6e){var _0x262c2d=this;return function(){switch(_0x2f5c6e['dialMethod']){case _0xca9f('0x167'):freeVariablesPredictive(_0x2f5c6e);_0x262c2d[_0xca9f('0x168')](_0x2f5c6e,0x1);break;case _0xca9f('0x169'):freeVariablesPredictive(_0x2f5c6e);_0x262c2d[_0xca9f('0x168')](_0x2f5c6e,_0x2f5c6e['dialPowerLevel']);break;case'predictive':_0x262c2d[_0xca9f('0x16a')](_0x2f5c6e);break;case'booked':freeVariablesPredictive(_0x2f5c6e);_0x262c2d['handlePower'](_0x2f5c6e,0x1);break;default:freeVariablesPredictive(_0x2f5c6e);logger['error'](_0xca9f('0x16b'),_0x2f5c6e[_0xca9f('0x3c')],_0xca9f('0x16c'));}};};Dialer[_0xca9f('0xb1')][_0xca9f('0x16d')]=function(_0x5f3d8b){var _0x33971f=this;return function(){_0x33971f[_0xca9f('0x16e')](_0x5f3d8b);};};Dialer[_0xca9f('0xb1')]['syncQueueSummary']=function(_0x8dd507){var _0x16d890=this;if(isNotPreview(_0x8dd507[_0xca9f('0x58')])){if(isVoiceQueueOutbound(_0x8dd507[_0xca9f('0x4a')])&&isActive(_0x8dd507['dialActive'])){_0x8dd507['sendMessageOneNotActive']=!![];BPromise[_0xca9f('0xc2')]()[_0xca9f('0xbc')](checkIsLoggedIn(_0x8dd507,_0x8dd507[_0xca9f('0x4e')]))[_0xca9f('0xbc')](checkIsActive(_0x8dd507,_0x8dd507[_0xca9f('0x57')]))['then'](checkInterval(_0x8dd507))[_0xca9f('0xbc')](_0x16d890[_0xca9f('0x14b')](_0x8dd507))[_0xca9f('0xbc')](_0x16d890['checkIfTime'](_0x8dd507['dialGlobalInterval'],_0x8dd507[_0xca9f('0x16f')],_0x8dd507[_0xca9f('0x3c')],_0x8dd507))['then'](_0x16d890[_0xca9f('0x150')](_0x8dd507[_0xca9f('0x40')],_0x8dd507[_0xca9f('0x16f')],_0x8dd507['name'],_0x8dd507))[_0xca9f('0xbc')](_0x16d890[_0xca9f('0x170')](_0x8dd507))['catch'](loggerCatchQueueSummary(_0xca9f('0x171'),_0x8dd507));}else{notSendMessagesQueue(_0x8dd507);}}else{freeVariablesPredictive(_0x8dd507);}};Dialer[_0xca9f('0xb1')][_0xca9f('0x14a')]=function(){var _0x2db81c=this;var _0x1abab9;for(var _0x1defa0 in this['campaigns']){if(typeof this[_0xca9f('0x20')][_0x1defa0]!==_0xca9f('0x99')){_0x1abab9=this[_0xca9f('0x20')][_0x1defa0];if(isCampaignIvr(_0x1abab9[_0xca9f('0x4a')])&&isActive(_0x1abab9['active'])){_0x1abab9[_0xca9f('0xa0')]=!![];BPromise[_0xca9f('0xc2')]()['then'](checkIsActive(_0x1abab9,_0x1abab9[_0xca9f('0x75')]))[_0xca9f('0xbc')](checkInterval(_0x1abab9))[_0xca9f('0xbc')](_0x2db81c[_0xca9f('0x14b')](_0x1abab9))[_0xca9f('0xbc')](_0x2db81c[_0xca9f('0x14f')](_0x1abab9[_0xca9f('0x172')],_0x1abab9['dialTimezone'],_0x1abab9[_0xca9f('0x3c')],_0x1abab9))[_0xca9f('0xbc')](_0x2db81c[_0xca9f('0x150')](_0x1abab9[_0xca9f('0x40')],_0x1abab9[_0xca9f('0x16f')],_0x1abab9[_0xca9f('0x3c')],_0x1abab9))['then'](_0x2db81c['launchHandleIvr'](_0x1abab9))[_0xca9f('0xb5')](loggerCatchQueueSummary(_0xca9f('0x173'),_0x1abab9));}else{notSendMessagesCampaign(_0x1abab9);}}}};function getCallerIdRandom(_0x4f8273,_0x1058f8){var _0x2bdaed;var _0x5a1916;var _0x568ac9;if(_0x1058f8<=0x0){_0x1058f8=0x1;}_0x2bdaed=new RegExp(_0xca9f('0x174')+_0x1058f8+'}$');_0x5a1916=Math[_0xca9f('0x175')](0xa,_0x1058f8-0x1);_0x568ac9=Math['pow'](0xa,_0x1058f8)-0x1;return util[_0xca9f('0x78')]('%s',_[_0xca9f('0x176')](_0x4f8273,_0x2bdaed,_['random'](_0x5a1916,_0x568ac9)));}function extractCalleridName(_0x4ffdcf){var _0x18c06d=_0x4ffdcf['match'](/"(.*?)"/);return _0x18c06d?_0x18c06d[0x1]:_0x4ffdcf;}function extractCalleridNumber(_0x161b91){var _0x143d4a=_0x161b91['match'](/<(.*?)>/);return _0x143d4a?_0x143d4a[0x1]:_0x161b91;}Dialer[_0xca9f('0xb1')][_0xca9f('0x177')]=function(_0x50717b,_0x27a88c){var _0x52cc09=this;var _0x3e5460=uuid['v4']();this[_0xca9f('0x25')][_0x3e5460]=new Action(_0x50717b,_0x27a88c,_0x3e5460);return new BPromise(function(_0x231d12,_0x130176){if(_[_0xca9f('0x87')](_0x50717b)&&typeof _0x50717b!==_0xca9f('0x178')){return _0x130176(msgResponse(_0xca9f('0x179'),_0xca9f('0x152'),_0xca9f('0x17a')));}if(_[_0xca9f('0x87')](_0x27a88c[_0xca9f('0x17b')])||_0x27a88c[_0xca9f('0x17b')]===null){return _0x130176(msgResponse('originate',_0xca9f('0x152'),_0xca9f('0x17c')));}var _0x2d79ce={'XMD-CALLERID':_0x52cc09[_0xca9f('0x25')][_0x3e5460][_0xca9f('0x17d')](),'XMD-AGI':_0x50717b['dialQueueProject']?util['format'](_0xca9f('0x17e'),ipAgi,_0x50717b['dialQueueProject']):_0xca9f('0x17f'),'XMD-AGIAFTER':_0x50717b[_0xca9f('0x118')]?util[_0xca9f('0x78')](_0xca9f('0x17e'),ipAgi,_0x50717b[_0xca9f('0x118')]):_0xca9f('0x17f'),'XMD-QUEUE':_0x50717b[_0xca9f('0x4a')]===_0xca9f('0x4b')?util['format'](_0xca9f('0x180'),_0x50717b[_0xca9f('0x3c')],_0x50717b[_0xca9f('0x181')]||'',_0x50717b['dialAgiAfterHangupAgent']?'c':'',_0x50717b[_0xca9f('0x182')]||0x3):_0xca9f('0x17f'),'XMD-CONTACTID':_0x27a88c['ContactId'],'XMD-CDRTYPE':_0xca9f('0x183'),'CALLERID(all)':_0x52cc09['actions'][_0x3e5460]['getCaller'](),'XMD-AMD':_0x50717b['dialAMDActive']?_0xca9f('0x184'):_0xca9f('0x17f'),'XMD-DESTINATION':_0xca9f('0xea')};if(_0x50717b[_0xca9f('0xeb')]){_0x2d79ce[_0xca9f('0x185')]=_0x50717b['dialAMDInitialSilence']||0x9c4;_0x2d79ce[_0xca9f('0x186')]=_0x50717b[_0xca9f('0x187')]||0x5dc;_0x2d79ce['XMD-AMDAFTERGREETINGSILENCE']=_0x50717b[_0xca9f('0x188')]||0x320;_0x2d79ce[_0xca9f('0x189')]=_0x50717b['dialAMDTotalAnalysisTime']||0x1388;_0x2d79ce[_0xca9f('0x18a')]=_0x50717b[_0xca9f('0x18b')]||0x64;_0x2d79ce[_0xca9f('0x18c')]=_0x50717b[_0xca9f('0x18d')]||0x32;_0x2d79ce[_0xca9f('0x18e')]=_0x50717b[_0xca9f('0x18f')]||0x3;_0x2d79ce[_0xca9f('0x190')]=_0x50717b[_0xca9f('0x191')]||0x100;_0x2d79ce[_0xca9f('0x192')]=_0x50717b['dialAMDMaximumWordLength']||0x1388;}if(_0x50717b[_0xca9f('0x4a')]==='outbound'){_0x2d79ce[_0xca9f('0x193')]=_0x27a88c[_0xca9f('0xdd')];}else{_0x2d79ce[_0xca9f('0x194')]=_0x27a88c[_0xca9f('0xde')];}for(var _0x384c9b in _0x27a88c[_0xca9f('0x195')]){if(typeof _0x27a88c[_0xca9f('0x195')][_0x384c9b]!==_0xca9f('0x99')){if(isNotNull(_0x27a88c[_0xca9f('0x195')][_0x384c9b])&&_0x384c9b!=='id'&&_0x384c9b!==_0xca9f('0x196')&&_0x384c9b!==_0xca9f('0x197')&&_0x384c9b!==_0xca9f('0x198')){_0x2d79ce[util[_0xca9f('0x78')](_0xca9f('0x199'),'XMD-',_['toUpper'](_0x384c9b))]=_0x27a88c[_0xca9f('0x195')][_0x384c9b];}}}var _0x84a491=_0x52cc09[_0xca9f('0xe3')](_0x50717b['Trunk'])?getCallerId(_0x50717b['Trunk'][_0xca9f('0x76')],_0x50717b[_0xca9f('0x59')],_0x50717b[_0xca9f('0x19a')]>0x0?getCallerIdRandom(_0x50717b[_0xca9f('0x5a')],_0x50717b[_0xca9f('0x19a')]):_0x50717b[_0xca9f('0x5a')]):getCallerId(_['isNil'](_0x50717b[_0xca9f('0x14c')])?_0x50717b['Trunk']['callerid']:_0x50717b[_0xca9f('0x14c')]['callerid'],_0x50717b['dialOriginateCallerIdName'],_0x50717b[_0xca9f('0x19a')]>0x0?getCallerIdRandom(_0x50717b[_0xca9f('0x5a')],_0x50717b[_0xca9f('0x19a')]):_0x50717b['dialOriginateCallerIdNumber']);if(_0x84a491){_0x2d79ce[_0xca9f('0x19b')]=_0x52cc09[_0xca9f('0x25')][_0x3e5460]['originatecalleridname']=extractCalleridName(_0x84a491);_0x2d79ce[_0xca9f('0x19c')]=_0x27a88c[_0xca9f('0x17b')];}return ami[_0xca9f('0x159')]({'actionid':_0x3e5460,'action':_0xca9f('0x179'),'channel':_0x52cc09['isTrunkReachable'](_0x50717b['Trunk'])?util[_0xca9f('0x78')](_0xca9f('0x19d'),_0x50717b['Trunk']['name'],isNotNull(_0x50717b[_0xca9f('0x5c')])?_0x50717b[_0xca9f('0x5c')][_0xca9f('0x19e')]()||'':'',_0x50717b['dialCutDigit']>0x0?_0x27a88c[_0xca9f('0x17b')][_0xca9f('0x19f')](_0x50717b['dialCutDigit']):_0x27a88c[_0xca9f('0x17b')]):util[_0xca9f('0x78')](_0xca9f('0x19d'),_[_0xca9f('0xb2')](_0x50717b['TrunkBackup'])?_0x50717b['Trunk']['name']:_0x50717b['TrunkBackup'][_0xca9f('0x3c')],isNotNull(_0x50717b[_0xca9f('0x5c')])?_0x50717b['dialPrefix'][_0xca9f('0x19e')]()||'':'',_0x50717b[_0xca9f('0x1a0')]>0x0?_0x27a88c['phone']['substring'](_0x50717b['dialCutDigit']):_0x27a88c[_0xca9f('0x17b')]),'callerid':_0x84a491,'Exten':_0xca9f('0xea'),'Context':_0xca9f('0x1a1'),'Priority':'1','variable':_0x2d79ce,'timeout':(_0x50717b[_0xca9f('0x5b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3e5460})['then'](function(_0x2cb5a5){return _0x231d12(_0x2cb5a5);})[_0xca9f('0xb5')](function(_0x43af98){_0x50717b[_0xca9f('0x66')]+=0x1;var _0x55230e=new History(_0x52cc09[_0xca9f('0x25')][_0x3e5460]);logger['error'](util['format']('[originateError]:\x20%s',JSON[_0xca9f('0x46')](_0x43af98)));_0x55230e[_0xca9f('0xa8')]=0xe;_0x55230e[_0xca9f('0xa9')]=_0xca9f('0x1a2');_0x55230e['starttime']=moment()[_0xca9f('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0x55230e['endtime']=_0x55230e['starttime'];_0x52cc09[_0xca9f('0xd5')](_0x55230e)[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x1a3')));_0x52cc09[_0xca9f('0xd3')](_0x55230e)[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x1a3')))['finally'](function(){delete _0x52cc09[_0xca9f('0x25')][_0x3e5460];return _0x130176(msgResponse(_0xca9f('0x179'),_0xca9f('0x1a4'),_0xca9f('0x1a5')));});});});};Dialer['prototype'][_0xca9f('0x30')]=function(_0xf3bdec){var _0x1e1c2d=this[_0xca9f('0x25')][_0xf3bdec[_0xca9f('0x130')]];if(_0x1e1c2d){delete this[_0xca9f('0x25')][_0xf3bdec['actionid']];_0x1e1c2d['responsetime']=moment()['format'](_0xca9f('0x106'));var _0x1d0942=_0x1e1c2d[_0xca9f('0x4a')]==='ivr'?this[_0xca9f('0x20')][_0x1e1c2d['queue']]:this['voiceQueues'][_0x1e1c2d[_0xca9f('0x1a6')]()];if(!this[_0xca9f('0xe1')](_0xf3bdec[_0xca9f('0x1a7')])){this[_0xca9f('0xb7')](_0x1d0942);return this[_0xca9f('0x1a8')](_0x1e1c2d,_0x1d0942,_0xf3bdec)['catch'](loggerCatch(_0xca9f('0x1a9')));}this[_0xca9f('0xae')][_0xf3bdec[_0xca9f('0xec')]]=_0x1e1c2d;}};Dialer[_0xca9f('0xb1')]['checkRetriveMax']=function(_0x1e6edf,_0x1b8e4c,_0x1afd5c){var _0x957d7=new History(_0x1b8e4c);if(_0x957d7[_0xca9f('0xfa')]+_0x957d7[_0xca9f('0xfb')]+_0x957d7[_0xca9f('0xfc')]+_0x957d7[_0xca9f('0xfd')]+_0x957d7['countdropretry']+_0x957d7[_0xca9f('0xff')]+_0x957d7[_0xca9f('0x100')]+_0x957d7['countagentrejectretry']>=_0x1afd5c[_0xca9f('0x102')]-0x1){return!![];}switch(_0x1e6edf){case 0x3:if(_0x957d7['countnoanswerretry']>=_0x1afd5c['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0xca9f('0xc8')]({'active':![],'countnoanswerretry':_0x957d7['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x1afd5c[_0xca9f('0x1aa')],_0xca9f('0x10c'))[_0xca9f('0x78')](_0xca9f('0x106')),'ContactId':_0x957d7['ContactId'],'ListId':_0x957d7['ListId'],'VoiceQueueId':_0x957d7[_0xca9f('0xdd')]||undefined,'CampaignId':_0x957d7[_0xca9f('0xde')]||undefined})[_0xca9f('0xb5')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x957d7[_0xca9f('0xfa')]>=_0x1afd5c[_0xca9f('0x1ab')]-0x1){return!![];}this[_0xca9f('0xc8')]({'active':![],'countbusyretry':_0x957d7[_0xca9f('0xfa')]+=0x1,'scheduledat':moment()[_0xca9f('0x105')](_0x1afd5c[_0xca9f('0x1ac')],_0xca9f('0x10c'))[_0xca9f('0x78')](_0xca9f('0x106')),'ContactId':_0x957d7['ContactId'],'ListId':_0x957d7[_0xca9f('0xdb')],'VoiceQueueId':_0x957d7[_0xca9f('0xdd')]||undefined,'CampaignId':_0x957d7[_0xca9f('0xde')]||undefined})[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x1ad')));break;case 0x8:if(_0x957d7['countcongestionretry']>=_0x1afd5c[_0xca9f('0x1ae')]-0x1){return!![];}this[_0xca9f('0xc8')]({'active':![],'countcongestionretry':_0x957d7['countcongestionretry']+=0x1,'scheduledat':moment()[_0xca9f('0x105')](_0x1afd5c['dialCongestionRetryFrequency'],_0xca9f('0x10c'))[_0xca9f('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x957d7[_0xca9f('0xda')],'ListId':_0x957d7[_0xca9f('0xdb')],'VoiceQueueId':_0x957d7['VoiceQueueId']||undefined,'CampaignId':_0x957d7[_0xca9f('0xde')]||undefined})[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x1af')));break;case 0x0:if(_0x957d7[_0xca9f('0xfd')]>=_0x1afd5c[_0xca9f('0x1b0')]-0x1){return!![];}else{this[_0xca9f('0xc8')]({'active':![],'countnosuchnumberretry':_0x957d7[_0xca9f('0xfd')]+=0x1,'scheduledat':moment()[_0xca9f('0x105')](_0x1afd5c[_0xca9f('0x1b1')],_0xca9f('0x10c'))[_0xca9f('0x78')](_0xca9f('0x106')),'ContactId':_0x957d7['ContactId'],'ListId':_0x957d7[_0xca9f('0xdb')],'VoiceQueueId':_0x957d7['VoiceQueueId']||undefined,'CampaignId':_0x957d7[_0xca9f('0xde')]||undefined})[_0xca9f('0xb5')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x957d7[_0xca9f('0xfe')]>=_0x1afd5c['dialDropMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x957d7[_0xca9f('0xfe')]+=0x1,'scheduledat':moment()[_0xca9f('0x105')](_0x1afd5c['dialDropRetryFrequency'],'minutes')[_0xca9f('0x78')](_0xca9f('0x106')),'ContactId':_0x957d7[_0xca9f('0xda')],'ListId':_0x957d7[_0xca9f('0xdb')],'VoiceQueueId':_0x957d7['VoiceQueueId']||undefined,'CampaignId':_0x957d7[_0xca9f('0xde')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x957d7['countabandonedretry']>=_0x1afd5c[_0xca9f('0x12d')]-0x1){return!![];}this[_0xca9f('0xc8')]({'active':![],'countabandonedretry':_0x957d7['countabandonedretry']+=0x1,'scheduledat':moment()[_0xca9f('0x105')](_0x1afd5c['dialAbandonedRetryFrequency'],_0xca9f('0x10c'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x957d7[_0xca9f('0xda')],'ListId':_0x957d7[_0xca9f('0xdb')],'VoiceQueueId':_0x957d7[_0xca9f('0xdd')]||undefined,'CampaignId':_0x957d7[_0xca9f('0xde')]||undefined})['catch'](loggerCatch(_0xca9f('0x1b2')));break;case 0x13:if(_0x957d7['countmachineretry']>=_0x1afd5c[_0xca9f('0x10a')]-0x1){return!![];}this[_0xca9f('0xc8')]({'active':![],'countmachineretry':_0x957d7[_0xca9f('0x100')]+=0x1,'scheduledat':moment()['add'](_0x1afd5c[_0xca9f('0x1b3')],_0xca9f('0x10c'))[_0xca9f('0x78')](_0xca9f('0x106')),'ContactId':_0x957d7[_0xca9f('0xda')],'ListId':_0x957d7['ListId'],'VoiceQueueId':_0x957d7['VoiceQueueId']||undefined,'CampaignId':_0x957d7['CampaignId']||undefined})[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x10d')));break;case 0x14:if(_0x957d7['countagentrejectretry']>=_0x1afd5c[_0xca9f('0x1b4')]-0x1){return!![];}this[_0xca9f('0xc8')]({'active':![],'countagentrejectretry':_0x957d7['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x1afd5c[_0xca9f('0x1b5')],_0xca9f('0x10c'))[_0xca9f('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x957d7[_0xca9f('0xda')],'ListId':_0x957d7[_0xca9f('0xdb')],'VoiceQueueId':_0x957d7[_0xca9f('0xdd')]||undefined,'CampaignId':_0x957d7[_0xca9f('0xde')]||undefined})[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x1b6')));break;default:return!![];}};Dialer[_0xca9f('0xb1')][_0xca9f('0x1a8')]=function(_0x147462,_0x4c547b,_0x55e439){var _0x594bda=this;var _0x51b677=new History(_0x147462);var _0x1546e6=![];var _0x44bb11;var _0x3f1703;return new BPromise(function(_0x1ecfc2,_0x1fb8b7){if(_[_0xca9f('0x87')](_0x4c547b)&&typeof _0x4c547b!==_0xca9f('0x178')){return _0x1fb8b7(msgResponse(_0xca9f('0x1b7'),_0xca9f('0x152'),_0xca9f('0x1b8')));}if(_[_0xca9f('0x87')](_0x55e439)&&typeof _0x55e439!==_0xca9f('0x178')){return _0x1fb8b7(msgResponse(_0xca9f('0x1b7'),_0xca9f('0x152'),'evt\x20is\x20undefine'));}_0x594bda['verifyAdditionalPhones'](_0x51b677,_0x55e439[_0xca9f('0x116')],_0x4c547b)[_0xca9f('0xbc')](function(_0x1ff13d){if(_0x1ff13d['additional']==0x1)_0x1546e6=!![];switch(_0x55e439[_0xca9f('0x116')]){case'0':_0x4c547b[_0xca9f('0x65')]+=0x1;_0x51b677[_0xca9f('0xa8')]=0x0;_0x51b677[_0xca9f('0xa9')]=_0xca9f('0x1b9');_0x51b677['countnosuchnumberretry']+=0x1;_0x51b677[_0xca9f('0xf7')]+=0x1;ami[_0xca9f('0xef')]('custom:agentnosuchnumber',ut[_0xca9f('0xf8')](_0x147462,_0xca9f('0x1ba')));_0x44bb11=_0x4c547b[_0xca9f('0x1b1')];_0x3f1703=_0x4c547b[_0xca9f('0x122')];_0x594bda[_0xca9f('0xd5')](_0x51b677)[_0xca9f('0xb5')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x594bda['checkRetriveMax'](0x0,_0x147462,_0x4c547b)&&!_0x1546e6){if(_0x51b677[_0xca9f('0xfd')]>=_0x4c547b['dialNoSuchNumberMaxRetry']){_0x594bda[_0xca9f('0x10b')](_0x51b677,_0x1ecfc2,_0x1fb8b7,_0xca9f('0x1bb'));}else{_0x594bda['stateGlobal'](_0x51b677,_0x1ecfc2,_0x1fb8b7,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x4c547b[_0xca9f('0x64')]+=0x1;_0x51b677[_0xca9f('0xa8')]=0x3;_0x51b677[_0xca9f('0xa9')]=_0xca9f('0x1bc');_0x51b677['countnoanswerretry']+=0x1;_0x51b677[_0xca9f('0xf7')]+=0x1;ami[_0xca9f('0xef')](_0xca9f('0x1bd'),ut[_0xca9f('0xf8')](_0x147462,_0xca9f('0x1be')));_0x44bb11=_0x4c547b['dialNoAnswerRetryFrequency'];_0x3f1703=_0x4c547b[_0xca9f('0x122')];_0x594bda[_0xca9f('0xd5')](_0x51b677)[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x1bf')));if(_0x594bda[_0xca9f('0x1c0')](0x3,_0x147462,_0x4c547b)&&!_0x1546e6){if(_0x51b677[_0xca9f('0xfc')]>=_0x4c547b['dialNoAnswerMaxRetry']){_0x594bda['createStateFinal'](_0x51b677,_0x1ecfc2,_0x1fb8b7,'reason\x203\x20ringing\x20no\x20answer');}else{_0x594bda['stateGlobal'](_0x51b677,_0x1ecfc2,_0x1fb8b7,_0xca9f('0x1c1'));}}break;case'5':_0x4c547b[_0xca9f('0x60')]+=0x1;_0x51b677[_0xca9f('0xa8')]=0x5;_0x51b677[_0xca9f('0xa9')]='Busy';_0x51b677[_0xca9f('0xfa')]+=0x1;_0x51b677[_0xca9f('0xf7')]+=0x1;ami[_0xca9f('0xef')](_0xca9f('0x1c2'),ut[_0xca9f('0xf8')](_0x147462,_0xca9f('0x1c3')));_0x44bb11=_0x4c547b[_0xca9f('0x1ac')];_0x3f1703=_0x4c547b[_0xca9f('0x122')];_0x594bda[_0xca9f('0xd5')](_0x51b677)[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x1c4')));if(_0x594bda[_0xca9f('0x1c0')](0x5,_0x147462,_0x4c547b)&&!_0x1546e6){if(_0x51b677[_0xca9f('0xfa')]>=_0x4c547b['dialBusyMaxRetry']){_0x594bda[_0xca9f('0x10b')](_0x51b677,_0x1ecfc2,_0x1fb8b7,_0xca9f('0x1c5'));}else{_0x594bda[_0xca9f('0x109')](_0x51b677,_0x1ecfc2,_0x1fb8b7,'reason\x205\x20busy');}}break;case'8':_0x4c547b['outboundCongestionCallsDay']+=0x1;_0x51b677[_0xca9f('0xa8')]=0x8;_0x51b677[_0xca9f('0xa9')]='Congestion';_0x51b677[_0xca9f('0xfb')]+=0x1;_0x51b677[_0xca9f('0xf7')]+=0x1;_0x44bb11=_0x4c547b[_0xca9f('0x1c6')];_0x3f1703=_0x4c547b[_0xca9f('0x122')];ami['emit'](_0xca9f('0x1c7'),ut[_0xca9f('0xf8')](_0x147462,_0xca9f('0x1c8')));_0x594bda[_0xca9f('0xd5')](_0x51b677)[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x1c9')));if(_0x594bda[_0xca9f('0x1c0')](0x8,_0x147462,_0x4c547b)&&!_0x1546e6){if(_0x51b677[_0xca9f('0xfb')]>=_0x4c547b['dialCongestionMaxRetry']){_0x594bda[_0xca9f('0x10b')](_0x51b677,_0x1ecfc2,_0x1fb8b7,'reason\x208\x20congestion');}else{_0x594bda[_0xca9f('0x109')](_0x51b677,_0x1ecfc2,_0x1fb8b7,_0xca9f('0x1ca'));}}break;case'11':_0x4c547b['outboundAbandonedCallsDay']+=0x1;_0x51b677[_0xca9f('0xa8')]=0xb;_0x51b677[_0xca9f('0xa9')]=_0xca9f('0x129');_0x51b677[_0xca9f('0xff')]+=0x1;_0x51b677[_0xca9f('0xf7')]+=0x1;_0x44bb11=_0x4c547b['dialAbandonedRetryFrequency'];_0x3f1703=_0x4c547b['callAdditionalPhoneAfterMin'];_0x594bda[_0xca9f('0xd5')](_0x51b677)[_0xca9f('0xb5')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x594bda[_0xca9f('0x1c0')](0xb,_0x147462,_0x4c547b)&&!_0x1546e6){if(_0x51b677[_0xca9f('0xff')]>=_0x4c547b[_0xca9f('0x12d')]){_0x594bda[_0xca9f('0x10b')](_0x51b677,_0x1ecfc2,_0x1fb8b7,_0xca9f('0x1cb'));}else{_0x594bda[_0xca9f('0x109')](_0x51b677,_0x1ecfc2,_0x1fb8b7,_0xca9f('0x1cb'));}}break;case'20':_0x4c547b[_0xca9f('0x1cc')]+=0x1;_0x51b677['state']=0x14;_0x51b677[_0xca9f('0xa9')]='AgentReject';_0x51b677[_0xca9f('0x101')]+=0x1;_0x51b677[_0xca9f('0xf7')]+=0x1;_0x44bb11=_0x4c547b['dialAgentRejectRetryFrequency'];_0x3f1703=_0x4c547b[_0xca9f('0x122')];ami[_0xca9f('0xef')](_0xca9f('0x1cd'),ut['buildObj'](_0x147462,'agentreject'));_0x594bda[_0xca9f('0xd5')](_0x51b677)[_0xca9f('0xb5')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x594bda[_0xca9f('0x1c0')](0x14,_0x147462,_0x4c547b)&&!_0x1546e6){if(_0x51b677[_0xca9f('0x101')]>=_0x4c547b[_0xca9f('0x1b4')]){_0x594bda['createStateFinal'](_0x51b677,_0x1ecfc2,_0x1fb8b7,'reason\x2020\x20agentreject');}else{_0x594bda[_0xca9f('0x109')](_0x51b677,_0x1ecfc2,_0x1fb8b7,_0xca9f('0x1ce'));}}break;default:_0x4c547b['outboundUnknownCallsDay']+=0x1;_0x51b677[_0xca9f('0xa8')]=0xc;_0x51b677[_0xca9f('0xa9')]=_0x55e439[_0xca9f('0x116')];_0x44bb11=_0x4c547b['dialAgentRejectRetryFrequency'];_0x3f1703=_0x4c547b[_0xca9f('0x122')];_0x594bda[_0xca9f('0xd5')](_0x51b677)[_0xca9f('0xb5')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x594bda['checkRetriveMax'](_0x55e439['reason'],_0x147462,_0x4c547b)&&!_0x1546e6){if(_0x51b677['countbusyretry']+_0x51b677[_0xca9f('0xfb')]+_0x51b677['countnoanswerretry']+_0x51b677[_0xca9f('0xfd')]+_0x51b677['countdropretry']+_0x51b677[_0xca9f('0xff')]+_0x51b677[_0xca9f('0x100')]+_0x51b677[_0xca9f('0x101')]>=_0x4c547b[_0xca9f('0x102')]){_0x594bda[_0xca9f('0x109')](_0x51b677,_0x1ecfc2,_0x1fb8b7,_0x55e439[_0xca9f('0x116')]);}else{_0x594bda[_0xca9f('0x10b')](_0x51b677,_0x1ecfc2,_0x1fb8b7,_0x55e439[_0xca9f('0x116')]);}}}})[_0xca9f('0xbc')](function(_0x4563b8){if(_0x1546e6){_0x594bda['swapAdditionalPhones'](_0x51b677,_0x44bb11,_0x3f1703)['then'](function(_0x302f09){return _0x1ecfc2(0x1);});}});});};Dialer['prototype'][_0xca9f('0x109')]=function(_0x6d38e1,_0x34d9f0,_0x21feb3,_0xb45225){var _0x39eb24=new Final(_0x6d38e1);_0x39eb24[_0xca9f('0xa8')]=0xf;_0x39eb24[_0xca9f('0xa9')]='Global';this['createStateFinal'](_0x39eb24,_0x34d9f0,_0x21feb3,_0xb45225);};Dialer[_0xca9f('0xb1')][_0xca9f('0x10b')]=function(_0x56d6dd,_0x133307,_0x562fcc,_0x384918){this[_0xca9f('0xd3')](_0x56d6dd)['then'](function(){return _0x133307(msgResponse(_0xca9f('0x1b7'),_0xca9f('0xe2'),_0x384918));})[_0xca9f('0xb5')](function(){return _0x562fcc(msgResponse('[moveContactManagedDialer][0]',_0xca9f('0x152'),_0xca9f('0x1cf')));});};Dialer[_0xca9f('0xb1')][_0xca9f('0x16a')]=function(_0x1866cf){var _0x5abd3a=_0x1866cf[_0xca9f('0x1d0')]/0x64;var _0x42994=_0x1866cf[_0xca9f('0x63')]/(_0x1866cf['outboundDropCallsDayTimeout']+_0x1866cf[_0xca9f('0x5e')]);var _0x58c6e8=Math['round'](_0x1866cf[_0xca9f('0x1d1')]*(_0x1866cf[_0xca9f('0x1d2')]/0x64));var _0x362485=Math[_0xca9f('0x1d3')](_0x1866cf[_0xca9f('0x1d1')]*(_0x1866cf['predictiveIntervalMinThreshold']/0x64));var _0x5d905a=_0x1866cf['available']+_0x1866cf['talking'];var _0x55a333=Math[_0xca9f('0x1d4')](_0x1866cf[_0xca9f('0x72')]*_0x1866cf[_0xca9f('0x73')]*_0x1866cf[_0xca9f('0x1d5')]*_0x1866cf[_0xca9f('0x6e')]);if(_['isUndefined'](_0x1866cf[_0xca9f('0x29')])){if(!_[_0xca9f('0x87')](_0x1866cf[_0xca9f('0x28')])){_0x1866cf[_0xca9f('0x28')]=undefined;loggerPredictive[_0xca9f('0x96')]('[startMethodPredictive][StartProgressive]',_0xca9f('0x1d6'));}if(!_[_0xca9f('0x87')](_0x1866cf[_0xca9f('0x93')])){loggerPredictive[_0xca9f('0x96')]('[startMethodPredictive][StartProgressive]',_0xca9f('0x1d7'));clearInterval(_0x1866cf['handlePredictive']);_0x1866cf[_0xca9f('0x93')]=undefined;}_0x1866cf[_0xca9f('0x29')]=moment()['format'](_0xca9f('0x106'));loggerPredictive[_0xca9f('0x7e')](_0x1866cf[_0xca9f('0x3c')],_0xca9f('0x1d8'),_0x1866cf[_0xca9f('0x29')]);this[_0xca9f('0x168')](_0x1866cf,0x1);}else if(ifInterval(_0x1866cf[_0xca9f('0x1d9')],_0x1866cf[_0xca9f('0x29')])){this[_0xca9f('0x168')](_0x1866cf,0x1);loggerPredictiveCalls[_0xca9f('0x7e')](_0xca9f('0x1da'),_0x1866cf[_0xca9f('0x29')],_0x1866cf[_0xca9f('0x3c')]);_0x1866cf[_0xca9f('0x72')]=0x0;_0x1866cf[_0xca9f('0x6d')]=0x0;}else if(_0x5abd3a<_0x42994&&_0x1866cf[_0xca9f('0x1db')]===_0xca9f('0x1dc')){freeVariablesPredictive(_0x1866cf);loggerPredictive[_0xca9f('0x7e')](_0xca9f('0x1dd'),_0xca9f('0x1de'),_0x42994,_0xca9f('0x29'),_0x1866cf[_0xca9f('0x3c')]);}else if(_0x55a333<_0x1866cf[_0xca9f('0x6d')]&&_0x1866cf[_0xca9f('0x1db')]===_0xca9f('0x1dc')){freeVariablesPredictive(_0x1866cf);loggerPredictive[_0xca9f('0x7e')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xca9f('0x1df'),_0x55a333,_0xca9f('0x1e0'),_0x1866cf[_0xca9f('0x6d')],'startProgressive',_0x1866cf['name']);}else if(!ifInterval(_0x1866cf[_0xca9f('0x1d9')],_0x1866cf[_0xca9f('0x29')])&&_['isUndefined'](_0x1866cf[_0xca9f('0x28')])&&!_[_0xca9f('0x87')](_0x1866cf[_0xca9f('0x29')])){_0x1866cf['startPredictive']=moment()[_0xca9f('0x78')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xca9f('0x7e')](_0x1866cf['name'],'started\x20in\x20predictive\x20at',_0x1866cf[_0xca9f('0x28')]);this[_0xca9f('0xc6')](_0x1866cf[_0xca9f('0x1d9')])[_0xca9f('0xbc')](this[_0xca9f('0x1e1')](_0x1866cf))[_0xca9f('0xbc')](mergeDataErlangB(_0x1866cf))['then'](this[_0xca9f('0x1e2')](_0x1866cf))[_0xca9f('0xb5')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x1866cf));}else if(!ifInterval(_0x1866cf[_0xca9f('0x1d9')],_0x1866cf[_0xca9f('0x28')])){_0x1866cf['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x1866cf[_0xca9f('0x28')]=moment()[_0xca9f('0x78')](_0xca9f('0x106'));loggerPredictive[_0xca9f('0x7e')](_0x1866cf[_0xca9f('0x3c')],_0xca9f('0x1e3'),_0x1866cf[_0xca9f('0x28')]);clearInterval(_0x1866cf[_0xca9f('0x93')]);_0x1866cf[_0xca9f('0x93')]=undefined;this[_0xca9f('0xc6')](_0x1866cf[_0xca9f('0x1d9')])[_0xca9f('0xbc')](this[_0xca9f('0x1e1')](_0x1866cf))[_0xca9f('0xbc')](mergeDataErlangB(_0x1866cf))[_0xca9f('0xbc')](this[_0xca9f('0x1e2')](_0x1866cf))[_0xca9f('0xb5')](loggerCatchPredictive(_0xca9f('0x1e4'),_0x1866cf));}else if(_0x1866cf[_0xca9f('0x1d1')]&&_0x5d905a<_0x1866cf[_0xca9f('0x1d1')]-_0x362485){freeVariablesPredictive(_0x1866cf);loggerPredictive[_0xca9f('0x7e')](_0x1866cf['name'],_0xca9f('0x1e5'),_0x5d905a,_0xca9f('0x1e6'),_0x1866cf['predictiveIntervalAvailable'],'-',_0x362485,'=',_0x1866cf[_0xca9f('0x1d1')]-_0x362485,')');}else if(_0x1866cf[_0xca9f('0x1d1')]&&_0x5d905a>_0x1866cf[_0xca9f('0x1d1')]+_0x58c6e8){freeVariablesPredictive(_0x1866cf);loggerPredictive[_0xca9f('0x7e')](_0x1866cf[_0xca9f('0x3c')],_0xca9f('0x1e5'),_0x5d905a,')\x20are\x20more\x20than\x20threshold\x20(',_0x1866cf[_0xca9f('0x1d1')],'+',_0x58c6e8,'=',_0x1866cf[_0xca9f('0x1d1')]+_0x58c6e8,')');}};Dialer[_0xca9f('0xb1')]['getDataPredictive']=function(_0x522d35){var _0xf85bbd=this;return function(_0x5c78d1){return new BPromise(function(_0x4dedcb,_0x5a62fa){_[_0xca9f('0x90')](_0x522d35,_0x5c78d1[0x0]);if(checkGetDataPredictive(_0x5c78d1[0x0])){var _0x47f4d9=_0x522d35['predictiveIntervalAvailable']=_0x522d35['talking']+_0x522d35['available'];var _0x3c8454=_0x522d35[_0xca9f('0x1d9')]*0x3c;var _0x346c1e=_0x5c78d1[0x0][_0xca9f('0x69')]+_0x5c78d1[0x0]['predictiveIntervalAvgHoldtime'];var _0x5b4d84=(_0x5c78d1[0x0][_0xca9f('0x81')]+_0x5c78d1[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x5c78d1[0x0][_0xca9f('0x6a')])/_0x5c78d1[0x0][_0xca9f('0x70')];_0x522d35[_0xca9f('0x1d5')]=_0x5b4d84>0x0?_0x5b4d84:0x1;switch(_0x522d35[_0xca9f('0x1db')]){case _0xca9f('0x1dc'):var _0x56b2a2=_0x522d35[_0xca9f('0x1d0')]/0x64;return _0xf85bbd[_0xca9f('0x1e7')](_0x47f4d9,_0x3c8454,_0x346c1e,_0x5b4d84,_0x56b2a2)[_0xca9f('0xbc')](function(_0x375474){return _0x4dedcb(_0x375474);});case _0xca9f('0x1e8'):var _0x10c6d3=_0x522d35[_0xca9f('0x1d0')]/0x64;return _0xf85bbd['busyFactor'](_0x47f4d9,_0x3c8454,_0x346c1e,_0x5b4d84,_0x10c6d3)[_0xca9f('0xbc')](function(_0x3643b1){return _0x4dedcb(_0x3643b1);});default:return _0x5a62fa(msgResponse(_0xca9f('0x1e9'),_0xca9f('0x152'),'Unknown\x20Predictive'));}}else{return _0x5a62fa(msgResponse(_0xca9f('0x1e9'),'Failure','check\x20failure'));}});};};Dialer[_0xca9f('0xb1')][_0xca9f('0x1ea')]=function(_0xcdad94){var _0x547984=this;return function(_0x4cfa76){return new BPromise(function(_0x5c9b57,_0x59da72){_[_0xca9f('0x90')](_0xcdad94,_0x4cfa76[0x0]);if(checkGetDataPredictive(_0x4cfa76[0x0])){loggerPredictive[_0xca9f('0x7e')](JSON[_0xca9f('0x46')](_0x4cfa76[0x0]));if(_0xcdad94[_0xca9f('0x1db')]===_0xca9f('0x1dc')){return _0x547984['getVoiceQueueRtPauses'](_0xcdad94['id'])[_0xca9f('0xbc')](function(_0xc5b4c5){var _0x20f6a8=_0xcdad94[_0xca9f('0x4e')]-_0xc5b4c5[0x0]['outboundQueuePauses'];var _0xbb9d22=_0xcdad94['dialPredictiveInterval']*0x3c;var _0x3f3a75=_0x4cfa76[0x0][_0xca9f('0x69')]+_0x4cfa76[0x0][_0xca9f('0x68')];var _0x328b96=(_0x4cfa76[0x0][_0xca9f('0x81')]+_0x4cfa76[0x0][_0xca9f('0x6b')]+_0x4cfa76[0x0][_0xca9f('0x6a')])/_0x4cfa76[0x0][_0xca9f('0x70')];var _0xa223a8=_0xcdad94[_0xca9f('0x1d0')]/0x64;_0xcdad94['predictiveIntervalPauses']=_0xc5b4c5[0x0][_0xca9f('0x1eb')]||0x0;_0xcdad94[_0xca9f('0x1d5')]=_0x328b96>0x0?_0x328b96:0x1;return _0x547984[_0xca9f('0x1e7')](_0x20f6a8,_0xbb9d22,_0x3f3a75,_0x328b96,_0xa223a8);})['then'](function(_0x3bd368){return _0x5c9b57(_0x3bd368);})[_0xca9f('0xb5')](function(_0x40c329){return _0x59da72(msgResponse(_0xca9f('0x1ec'),'Failure',JSON[_0xca9f('0x46')](_0x40c329)));});}if(_0xcdad94[_0xca9f('0x1db')]==='agentBusyFactor'){return _0x547984['getVoiceQueueRtPauses'](_0xcdad94['id'])[_0xca9f('0xbc')](function(_0x5a095b){var _0xbf76e8=_0xcdad94[_0xca9f('0x4e')]-_0x5a095b[0x0][_0xca9f('0x1eb')];var _0x4e895e=_0xcdad94[_0xca9f('0x1d9')]*0x3c;var _0x40ab06=_0x4cfa76[0x0][_0xca9f('0x69')]+_0x4cfa76[0x0][_0xca9f('0x68')];var _0x3dec8a=(_0x4cfa76[0x0][_0xca9f('0x81')]+_0x4cfa76[0x0][_0xca9f('0x6b')]+_0x4cfa76[0x0][_0xca9f('0x6a')])/_0x4cfa76[0x0]['predictiveIntervalTotalCalls'];var _0x2dc4fb=_0xcdad94['dialPredictiveOptimizationPercentage']/0x64;_0xcdad94[_0xca9f('0x6f')]=_0x5a095b[0x0][_0xca9f('0x1eb')]||0x0;_0xcdad94[_0xca9f('0x1d5')]=_0x3dec8a>0x0?_0x3dec8a:0x1;return _0x547984['busyFactor'](_0xbf76e8,_0x4e895e,_0x40ab06,_0x3dec8a,_0x2dc4fb);})[_0xca9f('0xbc')](function(_0x56d121){return _0x5c9b57(_0x56d121);})[_0xca9f('0xb5')](function(_0x44826){return _0x59da72(msgResponse(_0xca9f('0x1ec'),'Failure',JSON[_0xca9f('0x46')](_0x44826)));});}}else{return _0x59da72(msgResponse('[getDataPredictive]',_0xca9f('0x152'),_0xca9f('0x1ed')));}});};};Dialer[_0xca9f('0xb1')][_0xca9f('0x1e2')]=function(_0x49f95c){var _0x318688=this;return function(){var _0x3157e6=0x0;var _0x4ccc4f=Math[_0xca9f('0x1d4')](_0x49f95c['erlangCallToSecond']*0x3e8);if(_0x4ccc4f>0x0){_0x4ccc4f=_0x4ccc4f<0x64?0x64:_0x4ccc4f;loggerPredictive[_0xca9f('0x7e')](_0x49f95c['name'],_0xca9f('0x1ee'),_0x4ccc4f,_0xca9f('0x47'));_0x49f95c['handlePredictive']=setInterval(function(){_0x318688[_0xca9f('0x93')](_0x49f95c);loggerPredictiveCalls['info'](_0xca9f('0x1ef'),_0x3157e6+=0x1);},_0x4ccc4f);}else{loggerPredictive[_0xca9f('0x7e')](_0x49f95c[_0xca9f('0x3c')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype']['checkContactBlack']=function(_0x1041e6,_0x223725){var _0x27ecc1=this;return function(_0x464ec5){if(_[_0xca9f('0x43')](_0x464ec5)){if(_[_0xca9f('0xb2')](_0x223725[_0xca9f('0xdc')])||!_0x223725['recallme']){if(_0x1041e6[_0xca9f('0x58')]===_0xca9f('0x1f0')){_0x1041e6[_0xca9f('0x139')]=_[_0xca9f('0x87')](_0x1041e6['queueStatusComplete'])?!![]:_0x1041e6[_0xca9f('0x139')];var _0x4e557b=uuid['v4']();_0x27ecc1[_0xca9f('0x25')][_0x4e557b]=new Action(_0x1041e6,_0x223725,_0x4e557b);loggerBooked['info']('[booked][checkContactBlack]',_0x4e557b,_0xca9f('0x1f1'),JSON[_0xca9f('0x46')](_0x1041e6[_0xca9f('0x139')]),_0xca9f('0x1f2'),_0x1041e6[_0xca9f('0x3c')]);if(_0x1041e6[_0xca9f('0x139')]){_0x1041e6[_0xca9f('0x139')]=![];_0x27ecc1[_0xca9f('0x2b')][_0x27ecc1[_0xca9f('0x25')][_0x4e557b]['queue']]=[];ami[_0xca9f('0x159')]({'actionid':_0x4e557b,'action':_0xca9f('0x1f3'),'queue':_0x1041e6[_0xca9f('0x3c')]})[_0xca9f('0xb5')](function(){_0x27ecc1[_0xca9f('0xb7')](_0x1041e6);_0x27ecc1[_0xca9f('0xc8')]({'active':![],'ContactId':_0x27ecc1[_0xca9f('0x25')][_0x4e557b][_0xca9f('0xda')],'ListId':_0x27ecc1[_0xca9f('0x25')][_0x4e557b][_0xca9f('0xdb')],'VoiceQueueId':_0x27ecc1[_0xca9f('0x25')][_0x4e557b][_0xca9f('0xdd')]||undefined,'CampaignId':_0x27ecc1[_0xca9f('0x25')][_0x4e557b][_0xca9f('0xde')]||undefined})[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x1f4')));delete _0x27ecc1[_0xca9f('0x25')][_0x4e557b];});}else{loggerBooked[_0xca9f('0x7e')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x1041e6['queueStatusComplete']),_0xca9f('0x1f2'),_0x1041e6[_0xca9f('0x3c')]);_0x27ecc1[_0xca9f('0xb7')](_0x1041e6);_0x27ecc1[_0xca9f('0xc8')]({'active':![],'ContactId':_0x27ecc1[_0xca9f('0x25')][_0x4e557b][_0xca9f('0xda')],'ListId':_0x27ecc1['actions'][_0x4e557b][_0xca9f('0xdb')],'VoiceQueueId':_0x27ecc1[_0xca9f('0x25')][_0x4e557b][_0xca9f('0xdd')]||undefined,'CampaignId':_0x27ecc1['actions'][_0x4e557b][_0xca9f('0xde')]||undefined})[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x1f4')));delete _0x27ecc1[_0xca9f('0x25')][_0x4e557b];}}else{return _0x27ecc1[_0xca9f('0x177')](_0x1041e6,_0x223725);}}else{if(getDiff(_0x223725['scheduledat'])<_0x1041e6[_0xca9f('0x1f5')]*0x3c){if(_0x223725[_0xca9f('0x1f6')]&&!_0x223725[_0xca9f('0x1f6')][_0xca9f('0x1f7')]){_0x27ecc1['preview'][_0xca9f('0x13b')](_0x223725['id'])[_0xca9f('0x13d')](function(){_0x27ecc1[_0xca9f('0xb7')](_0x1041e6);});}else{_0x27ecc1['unlockContact']({'active':![]},_0x223725['id'],0x1)[_0xca9f('0x13d')](function(){_0x27ecc1[_0xca9f('0xb7')](_0x1041e6);});}}else{_0x1041e6[_0xca9f('0x1f8')]+=0x1;_0x27ecc1[_0xca9f('0xb7')](_0x1041e6);if(_0x1041e6[_0xca9f('0x1f9')]){_0x27ecc1['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x223725[_0xca9f('0xda')],'ListId':_0x223725['ListId'],'VoiceQueueId':_0x223725[_0xca9f('0xdd')]||undefined,'CampaignId':_0x223725['CampaignId']||undefined})[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x1fa')));_0x27ecc1[_0xca9f('0xd5')](createObjHistory(_0x1041e6,_0x223725,_0xca9f('0x1fb'),0x17,_0xca9f('0x1fc')))[_0xca9f('0xb5')](loggerCatch(_0xca9f('0x1fd')));}else{_0x27ecc1['saveInDb'](createObjHistory(_0x1041e6,_0x223725,_0xca9f('0x1fe'),0x16,_0xca9f('0x1ff')),'[Originate][HistoryRecallClose][historyCatch]',_0xca9f('0x200'));}}}}else{_0x1041e6[_0xca9f('0x5f')]+=0x1;_0x27ecc1[_0xca9f('0xd9')](createObjHistory(_0x1041e6,_0x223725,_0xca9f('0x201'),0xd,_0xca9f('0x202')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw _0xca9f('0x203');}};};Dialer[_0xca9f('0xb1')][_0xca9f('0x16e')]=function(_0x22770c){var _0x500433=this;var _0x54bb7b=_0x22770c['limitCalls']-_0x22770c[_0xca9f('0x71')]-_0x22770c[_0xca9f('0xcd')];emitCampaignSummary(_0x22770c);if(_0x54bb7b>0x0){if(_0x54bb7b>this['maxNumberOriginate']){_0x54bb7b=this[_0xca9f('0x23')];}_0x22770c['temp']+=_0x54bb7b;this['getContactDialerIvr'](_0x22770c['id'],_0x54bb7b,_0x22770c[_0xca9f('0x204')],_0x22770c)[_0xca9f('0xbc')](function(_0x560a57){_0x22770c['temp']-=_0x54bb7b;_0x22770c[_0xca9f('0xcd')]=_0x22770c['temp']>0x0?_0x22770c[_0xca9f('0xcd')]:0x0;if(!checkContactEmpty(_0x560a57)){_0x22770c[_0xca9f('0x3a')]=_0xca9f('0x205');logger[_0xca9f('0x7e')](_0xca9f('0x206')+_0x22770c['name']);}else{_0x22770c['originated']+=_0x560a57['length'];_0x22770c['message']=_0xca9f('0x207');for(var _0xc1afb=0x0;_0xc1afb<_0x560a57[_0xca9f('0x141')];_0xc1afb+=0x1){_0x22770c[_0xca9f('0x208')]+=0x1;if(_[_0xca9f('0xb2')](_0x560a57[_0xc1afb])||_[_0xca9f('0xb2')](_0x560a57[_0xc1afb][_0xca9f('0x195')])||_[_0xca9f('0xb2')](_0x560a57[_0xc1afb][_0xca9f('0x17b')])){_0x500433[_0xca9f('0x209')](_0xca9f('0x20a'),_0x22770c,_0x560a57[_0xc1afb]);}else{_0x500433['checkIsBlackListIvr'](_[_0xca9f('0x136')](_0x560a57[_0xc1afb],[_0xca9f('0xde'),'Contact.phone']))[_0xca9f('0xbc')](_0x500433[_0xca9f('0x20b')](_0x22770c,_0x560a57[_0xc1afb]))[_0xca9f('0xb5')](_0x500433[_0xca9f('0x20c')](_0xca9f('0x20d'),_0x22770c));}}}})['catch'](loggerGetContactDialer(_0xca9f('0x20e'),_0x22770c,_0x54bb7b));}};Dialer[_0xca9f('0xb1')][_0xca9f('0x168')]=function(_0xc4dba9,_0x44df94){var _0x58232e=this;var _0xdbbd22=[];var _0x45e95d=_0x44df94>=0x1?_0x44df94:0x1;if(_0xc4dba9[_0xca9f('0x58')]==='booked'){_0x45e95d=0x1;}var _0x49b43a=Math[_0xca9f('0x1d4')](_0xc4dba9[_0xca9f('0x4d')]*_0x45e95d)-_0xc4dba9[_0xca9f('0x71')]-_0xc4dba9[_0xca9f('0xcd')];emitVoiceQueueSummary(_0xc4dba9);if(_0xc4dba9[_0xca9f('0x20f')]>0x0){var _0x38064f=_0xc4dba9[_0xca9f('0x20f')]-_0xc4dba9[_0xca9f('0x71')]-_0xc4dba9[_0xca9f('0x52')]-_0xc4dba9[_0xca9f('0xcd')]-_0xc4dba9['pTalking'];if(_0x49b43a>_0x38064f){_0x49b43a=_0x38064f;}}if(_0x49b43a>0x0){if(_0xc4dba9[_0xca9f('0x58')]===_0xca9f('0x1f0')){_0x49b43a=0x1;}if(_0x49b43a>this[_0xca9f('0x23')]){_0x49b43a=this['maxNumberOriginate'];}_0xc4dba9[_0xca9f('0xcd')]+=_0x49b43a;for(var _0x53613c in this[_0xca9f('0x21')]){if(typeof this['agents'][_0x53613c]!=='undefined'){if(this['agents'][_0x53613c][_0xca9f('0xa8')]==='not_inuse'&&this[_0xca9f('0x21')][_0x53613c]['status']===_0xca9f('0xe5')){_0xdbbd22['push'](this[_0xca9f('0x21')][_0x53613c]['id']);}}}this[_0xca9f('0xcc')](_0xc4dba9['id'],_0xdbbd22,_0x49b43a,_0xc4dba9[_0xca9f('0x204')],_0xc4dba9)[_0xca9f('0xbc')](function(_0x4cf1b9){_0xc4dba9[_0xca9f('0xcd')]-=_0x49b43a;_0xc4dba9['temp']=_0xc4dba9[_0xca9f('0xcd')]>0x0?_0xc4dba9[_0xca9f('0xcd')]:0x0;if(!checkContactEmpty(_0x4cf1b9)){_0x58232e[_0xca9f('0xba')](_0xc4dba9)[_0xca9f('0xbc')](sendMessageReschedule(_0xc4dba9))[_0xca9f('0xb5')](loggerCatch(_0xca9f('0xbb')));}else{_0xc4dba9[_0xca9f('0x71')]+=_0x4cf1b9['length'];_0xc4dba9['message']=_0xc4dba9[_0xca9f('0x58')]==='booked'?_0xca9f('0x184'):_0xca9f('0x207');for(var _0x3e24cc=0x0;_0x3e24cc<_0x4cf1b9[_0xca9f('0x141')];_0x3e24cc+=0x1){if(_['isNil'](_0x4cf1b9[_0x3e24cc])||_[_0xca9f('0xb2')](_0x4cf1b9[_0x3e24cc][_0xca9f('0x195')])||_[_0xca9f('0xb2')](_0x4cf1b9[_0x3e24cc]['phone'])){_0x58232e[_0xca9f('0x209')](_0xca9f('0x20a'),_0xc4dba9,_0x4cf1b9[_0x3e24cc]);}else{_0x58232e[_0xca9f('0xbd')](_[_0xca9f('0x136')](_0x4cf1b9[_0x3e24cc],[_0xca9f('0xdd'),_0xca9f('0x210')]))[_0xca9f('0xbc')](_0x58232e[_0xca9f('0x20b')](_0xc4dba9,_0x4cf1b9[_0x3e24cc]))['catch'](_0x58232e['loggerHandler'](_0xca9f('0x20a'),_0xc4dba9));}}}})[_0xca9f('0xb5')](loggerGetContactDialer('[getContactDialer2]',_0xc4dba9,_0x49b43a));}};Dialer['prototype']['handlePredictive']=function(_0x5e4efd){if(_0x5e4efd[_0xca9f('0x20f')]>0x0){var _0x50d9a8=_0x5e4efd[_0xca9f('0x20f')]-_0x5e4efd[_0xca9f('0x71')]-_0x5e4efd[_0xca9f('0x52')];if(_0x50d9a8>0x0){this[_0xca9f('0x211')](_0x5e4efd);}else{loggerPredictiveCalls[_0xca9f('0x7e')](_0xca9f('0x212'));}}else{this[_0xca9f('0x211')](_0x5e4efd);}};Dialer[_0xca9f('0xb1')][_0xca9f('0x211')]=function(_0x38b144){var _0x4052bb=this;var _0x1443ce=[];_0x38b144[_0xca9f('0x71')]+=0x1;for(var _0x2d0fc1 in this[_0xca9f('0x21')]){if(typeof this[_0xca9f('0x21')][_0x2d0fc1]!=='undefined'){if(this[_0xca9f('0x21')][_0x2d0fc1][_0xca9f('0xa8')]===_0xca9f('0x213')&&this['agents'][_0x2d0fc1][_0xca9f('0xb3')]==='reachable'){_0x1443ce[_0xca9f('0x135')](this[_0xca9f('0x21')][_0x2d0fc1]['id']);}}}this[_0xca9f('0xcc')](_0x38b144['id'],_0x1443ce,0x1,_0x38b144[_0xca9f('0x204')],_0x38b144)[_0xca9f('0xbc')](function(_0x5f46be){if(!checkContactEmpty(_0x5f46be)){checkContactLowerLimitOriginate(_0x38b144,0x1,0x0);_0x4052bb[_0xca9f('0xba')](_0x38b144)['then'](sendMessageReschedule(_0x38b144))['catch'](loggerCatch(_0xca9f('0xbb')));}else{_0x38b144[_0xca9f('0x3a')]=_0xca9f('0x207');if(_[_0xca9f('0xb2')](_0x5f46be[0x0])||_[_0xca9f('0xb2')](_0x5f46be[0x0][_0xca9f('0x195')])||_[_0xca9f('0xb2')](_0x5f46be[0x0][_0xca9f('0x17b')])){_0x4052bb['emptyContact'](_0xca9f('0x20a'),_0x38b144,_0x5f46be[0x0]);}else{_0x4052bb['checkIsBlackList'](_['pick'](_0x5f46be[0x0],[_0xca9f('0xdd'),'Contact.phone']))[_0xca9f('0xbc')](_0x4052bb[_0xca9f('0x20b')](_0x38b144,_0x5f46be[0x0]))[_0xca9f('0xb5')](_0x4052bb[_0xca9f('0x20c')](_0xca9f('0x214'),_0x38b144));}}})['catch'](loggerGetContactDialer(_0xca9f('0x215'),_0x38b144,0x1));emitVoiceQueueSummary(_0x38b144);};Dialer[_0xca9f('0xb1')][_0xca9f('0x1e7')]=function(_0x55a062,_0x20414f,_0xbd5a3e,_0x5a172c,_0x3747e2,_0x45cfa3){loggerPredictive['info'](_0xca9f('0x216'));loggerPredictive[_0xca9f('0x7e')](_0xca9f('0x217'),_0x55a062);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x20414f);loggerPredictive[_0xca9f('0x7e')](_0xca9f('0x218'),_0xbd5a3e);loggerPredictive['info'](_0xca9f('0x219'),_0x5a172c);loggerPredictive['info'](_0xca9f('0x21a'),_0x3747e2);loggerPredictive[_0xca9f('0x7e')]('---------------------------');return new BPromise(function(_0x13421a,_0x2a7fb7){if(_0x55a062<=0x0||isNaN(_0x55a062)){return _0x2a7fb7(msgResponse(_0xca9f('0x21b'),_0xca9f('0x1a4'),_0xca9f('0x21c')+_0x55a062));}if(_0xbd5a3e<=0x0||isNaN(_0xbd5a3e)){return _0x2a7fb7(msgResponse(_0xca9f('0x21b'),_0xca9f('0x1a4'),'Ts\x20=\x20'+_0xbd5a3e));}if(_0x5a172c<=0x0||isNaN(_0x5a172c)){return _0x2a7fb7(msgResponse(_0xca9f('0x21b'),_0xca9f('0x1a4'),_0xca9f('0x21d')+_0x5a172c));}if(_0x20414f<=0x0||isNaN(_0x20414f)){return _0x2a7fb7(msgResponse(_0xca9f('0x21b'),_0xca9f('0x1a4'),'interval\x20=\x20'+_0x20414f));}if(_0x3747e2<=0x0||isNaN(_0x3747e2)){return _0x2a7fb7(msgResponse(_0xca9f('0x21b'),_0xca9f('0x1a4'),_0xca9f('0x21e')+_0x3747e2));}_0x45cfa3=_0x45cfa3||0x0;var _0xefe5af=0x1/_0xbd5a3e;var _0x1c6fe1=0x0;var _0x56d3cd=0x0;var _0x424451=0x0;var _0x39226a=0x0;for(var _0x39e037=0x0;_0x424451<_0x3747e2;_0x39e037+=0x1){_0x56d3cd=_0x39e037/_0x20414f;_0x1c6fe1=(_0x5a172c*_0x56d3cd+_0x45cfa3)/_0xefe5af;_0x424451=erlangb(_0x1c6fe1,_0x55a062);_0x39226a=_0x1c6fe1/_0x55a062*(0x1-erlangb(_0x1c6fe1,_0x55a062));}return _0x13421a({'erlangCalls':_0x39e037,'erlangCallToSecond':_0x20414f/_0x39e037,'erlangAbandonmentRate':_0x424451,'erlangBusyFactor':_0x39226a});});};Dialer[_0xca9f('0xb1')]['busyFactor']=function(_0x55ec23,_0x26fe59,_0x4a5a6f,_0x419405,_0x3e49e2,_0x5275cf){loggerPredictive[_0xca9f('0x7e')](_0xca9f('0x21f'));loggerPredictive[_0xca9f('0x7e')](_0xca9f('0x217'),_0x55ec23);loggerPredictive[_0xca9f('0x7e')](_0xca9f('0x220'),_0x26fe59);loggerPredictive['info'](_0xca9f('0x218'),_0x4a5a6f);loggerPredictive['info'](_0xca9f('0x219'),_0x419405);loggerPredictive[_0xca9f('0x7e')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e49e2);loggerPredictive[_0xca9f('0x7e')](_0xca9f('0x86'));return new BPromise(function(_0x18c8f7,_0x43e56d){if(_0x55ec23<=0x0||isNaN(_0x55ec23)){return _0x43e56d(msgResponse('[busyFactor]',_0xca9f('0x1a4'),_0xca9f('0x21c')+_0x55ec23));}if(_0x4a5a6f<=0x0||isNaN(_0x4a5a6f)){return _0x43e56d(msgResponse(_0xca9f('0x221'),'Error',_0xca9f('0x222')+_0x4a5a6f));}if(_0x419405<=0x0||isNaN(_0x419405)){return _0x43e56d(msgResponse(_0xca9f('0x221'),_0xca9f('0x1a4'),_0xca9f('0x21d')+_0x419405));}if(_0x26fe59<=0x0||isNaN(_0x26fe59)){return _0x43e56d(msgResponse(_0xca9f('0x221'),_0xca9f('0x1a4'),_0xca9f('0x223')+_0x26fe59));}if(_0x3e49e2<=0x0||isNaN(_0x3e49e2)){return _0x43e56d(msgResponse(_0xca9f('0x221'),_0xca9f('0x1a4'),_0xca9f('0x224')+_0x3e49e2));}_0x5275cf=_0x5275cf||0x0;var _0x3e71fd=0x1/_0x4a5a6f;var _0xc7982d=0x0;var _0x5ba72f=0x0;var _0x4daefc=0x0;var _0x383fcb=0x0;for(var _0x141e53=0x0;_0x383fcb<_0x3e49e2;_0x141e53+=0x1){_0x5ba72f=_0x141e53/_0x26fe59;_0xc7982d=(_0x419405*_0x5ba72f+_0x5275cf)/_0x3e71fd;_0x4daefc=erlangb(_0xc7982d,_0x55ec23);_0x383fcb=_0xc7982d/_0x55ec23*(0x1-erlangb(_0xc7982d,_0x55ec23));}return _0x18c8f7({'erlangCalls':_0x141e53,'erlangCallToSecond':_0x26fe59/_0x141e53,'erlangAbandonmentRate':_0x4daefc,'erlangBusyFactor':_0x383fcb});});};module[_0xca9f('0x225')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 7e8cee3..14715c5 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 _0x8f40=['droptime','endtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x8f40,0x16f));var _0x08f4=function(_0x3aec85,_0x4ff6e2){_0x3aec85=_0x3aec85-0x0;var _0x564a8b=_0x8f40[_0x3aec85];return _0x564a8b;};'use strict';var util=require(_0x08f4('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x21789d,_0x1ff049){var _0x2ba350=moment(_0x21789d)[_0x08f4('0x1')](0x0);var _0x26c364=moment(_0x1ff049)[_0x08f4('0x1')](0x0);return _0x2ba350[_0x08f4('0x2')](_0x26c364,_0x08f4('0x3'));}function QueueCallerAbandon(_0x10a238,_0x57b5e7){this[_0x08f4('0x4')]=_0x10a238['scheduledat'];this[_0x08f4('0x5')]=_0x10a238[_0x08f4('0x5')];this[_0x08f4('0x6')]=_0x10a238[_0x08f4('0x5')]===_0x08f4('0x7')?'queue':_0x10a238[_0x08f4('0x5')];this[_0x08f4('0x8')]=_0x10a238['countbusyretry'];this[_0x08f4('0x9')]=_0x10a238[_0x08f4('0x9')];this['countnoanswerretry']=_0x10a238['countnoanswerretry'];this[_0x08f4('0xa')]=_0x10a238[_0x08f4('0x8')]+_0x10a238[_0x08f4('0x9')]+_0x10a238[_0x08f4('0xb')]+_0x10a238[_0x08f4('0xc')]+_0x10a238[_0x08f4('0xd')]+_0x10a238[_0x08f4('0xe')]+_0x10a238[_0x08f4('0xf')]+_0x10a238[_0x08f4('0x10')];this[_0x08f4('0xc')]=_0x10a238[_0x08f4('0xc')];this[_0x08f4('0xd')]=_0x10a238[_0x08f4('0xd')];this['countabandonedretry']=_0x10a238['countabandonedretry'];this[_0x08f4('0xf')]=_0x10a238['countmachineretry'];this[_0x08f4('0x10')]=_0x10a238[_0x08f4('0x10')];this[_0x08f4('0x11')]=_0x57b5e7[_0x08f4('0x11')];this['calleridname']=_0x10a238[_0x08f4('0x12')];this[_0x08f4('0x13')]=_0x10a238[_0x08f4('0x14')];this[_0x08f4('0x15')]=_0x10a238[_0x08f4('0x15')];this['responsetime']=_0x10a238[_0x08f4('0x16')];this[_0x08f4('0x17')]=_0x10a238[_0x08f4('0x17')];this[_0x08f4('0x18')]=this[_0x08f4('0x17')];this['ringtime']=getSeconds(_0x10a238[_0x08f4('0x16')],_0x10a238['starttime']);this['holdtime']=getSeconds(this[_0x08f4('0x17')],_0x10a238[_0x08f4('0x16')]);this['talktime']=0x0;this[_0x08f4('0x19')]=_0x57b5e7['queue'];this[_0x08f4('0x1a')]=_0x57b5e7['connectedlinename'];this[_0x08f4('0x1b')]=_0x57b5e7['reason'];this['callback']=_0x10a238[_0x08f4('0x1c')];this[_0x08f4('0x1d')]=_0x10a238[_0x08f4('0x1d')];this[_0x08f4('0x1e')]=_0x10a238[_0x08f4('0x1e')];this[_0x08f4('0x1f')]=_0x10a238[_0x08f4('0x1f')];this[_0x08f4('0x20')]=_0x10a238[_0x08f4('0x20')];this['ListId']=_0x10a238[_0x08f4('0x21')];this[_0x08f4('0x22')]=_0x10a238['UserId'];this[_0x08f4('0x23')]=_0x10a238[_0x08f4('0x23')];this[_0x08f4('0x24')]=_0x10a238['CampaignId'];this['originatecalleridnum']=_0x10a238['originatecalleridnum']||'';this[_0x08f4('0x25')]=_0x10a238[_0x08f4('0x25')]||'';}module[_0x08f4('0x26')]=QueueCallerAbandon; \ No newline at end of file +var _0xc466=['milliseconds','diff','seconds','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','talktime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment'];(function(_0x7d3f9a,_0x534e8b){var _0x14f5c2=function(_0x781350){while(--_0x781350){_0x7d3f9a['push'](_0x7d3f9a['shift']());}};_0x14f5c2(++_0x534e8b);}(_0xc466,0xca));var _0x6c46=function(_0xceb651,_0x19e6a1){_0xceb651=_0xceb651-0x0;var _0x4aab94=_0xc466[_0xceb651];return _0x4aab94;};'use strict';var util=require(_0x6c46('0x0'));var _=require(_0x6c46('0x1'));var moment=require(_0x6c46('0x2'));function getSeconds(_0x253a88,_0xa1e12b){var _0x2b626f=moment(_0x253a88)[_0x6c46('0x3')](0x0);var _0x18792f=moment(_0xa1e12b)[_0x6c46('0x3')](0x0);return _0x2b626f[_0x6c46('0x4')](_0x18792f,_0x6c46('0x5'));}function QueueCallerAbandon(_0x81ebd1,_0x560937){this[_0x6c46('0x6')]=_0x81ebd1[_0x6c46('0x6')];this['type']=_0x81ebd1[_0x6c46('0x7')];this[_0x6c46('0x8')]=_0x81ebd1['type']==='outbound'?'queue':_0x81ebd1[_0x6c46('0x7')];this[_0x6c46('0x9')]=_0x81ebd1[_0x6c46('0x9')];this['countcongestionretry']=_0x81ebd1[_0x6c46('0xa')];this[_0x6c46('0xb')]=_0x81ebd1[_0x6c46('0xb')];this['countglobal']=_0x81ebd1[_0x6c46('0x9')]+_0x81ebd1[_0x6c46('0xa')]+_0x81ebd1[_0x6c46('0xb')]+_0x81ebd1['countnosuchnumberretry']+_0x81ebd1[_0x6c46('0xc')]+_0x81ebd1[_0x6c46('0xd')]+_0x81ebd1[_0x6c46('0xe')]+_0x81ebd1['countagentrejectretry'];this[_0x6c46('0xf')]=_0x81ebd1[_0x6c46('0xf')];this[_0x6c46('0xc')]=_0x81ebd1[_0x6c46('0xc')];this['countabandonedretry']=_0x81ebd1[_0x6c46('0xd')];this[_0x6c46('0xe')]=_0x81ebd1[_0x6c46('0xe')];this[_0x6c46('0x10')]=_0x81ebd1['countagentrejectretry'];this[_0x6c46('0x11')]=_0x560937[_0x6c46('0x11')];this[_0x6c46('0x12')]=_0x81ebd1[_0x6c46('0x13')];this[_0x6c46('0x14')]=_0x81ebd1[_0x6c46('0x15')];this[_0x6c46('0x16')]=_0x81ebd1['starttime'];this[_0x6c46('0x17')]=_0x81ebd1[_0x6c46('0x17')];this['droptime']=_0x81ebd1[_0x6c46('0x18')];this['endtime']=this['droptime'];this['ringtime']=getSeconds(_0x81ebd1[_0x6c46('0x17')],_0x81ebd1[_0x6c46('0x16')]);this['holdtime']=getSeconds(this[_0x6c46('0x18')],_0x81ebd1['responsetime']);this[_0x6c46('0x19')]=0x0;this[_0x6c46('0x1a')]=_0x560937[_0x6c46('0x1a')];this['membername']=_0x560937[_0x6c46('0x1b')];this[_0x6c46('0x1c')]=_0x560937[_0x6c46('0x1c')];this[_0x6c46('0x1d')]=_0x81ebd1[_0x6c46('0x1d')];this[_0x6c46('0x1e')]=_0x81ebd1[_0x6c46('0x1e')];this[_0x6c46('0x1f')]=_0x81ebd1[_0x6c46('0x1f')];this[_0x6c46('0x20')]=_0x81ebd1[_0x6c46('0x20')];this[_0x6c46('0x21')]=_0x81ebd1['ContactId'];this[_0x6c46('0x22')]=_0x81ebd1[_0x6c46('0x22')];this[_0x6c46('0x23')]=_0x81ebd1[_0x6c46('0x23')];this[_0x6c46('0x24')]=_0x81ebd1[_0x6c46('0x24')];this[_0x6c46('0x25')]=_0x81ebd1['CampaignId'];this[_0x6c46('0x26')]=_0x81ebd1[_0x6c46('0x26')]||'';this['originatecalleridname']=_0x81ebd1[_0x6c46('0x27')]||'';}module[_0x6c46('0x28')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index a5b1aca..ff317e9 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 _0x356f=['tech','Trunk','name','fax','localstationid','headerinfo','path','exports','util','moment','uniqueid','channel','%s/%s/%s'];(function(_0x446b19,_0x5a71f3){var _0x4f6566=function(_0x55762d){while(--_0x55762d){_0x446b19['push'](_0x446b19['shift']());}};_0x4f6566(++_0x5a71f3);}(_0x356f,0x167));var _0xf356=function(_0x14e2d1,_0x3668f2){_0x14e2d1=_0x14e2d1-0x0;var _0x141257=_0x356f[_0x14e2d1];return _0x141257;};'use strict';var util=require(_0xf356('0x0'));var _=require('lodash');var moment=require(_0xf356('0x1'));function Action(_0x1611a2,_0x572d87,_0x523f1e){this[_0xf356('0x2')]=_0x1611a2||undefined;this[_0xf356('0x3')]=util['format'](_0xf356('0x4'),_0x572d87[_0xf356('0x5')],_0x572d87[_0xf356('0x6')][_0xf356('0x7')],_0x523f1e[_0xf356('0x8')]);this[_0xf356('0x9')]=_0x572d87[_0xf356('0x9')];this[_0xf356('0xa')]=_0x572d87['headerinfo'];this['path']=_0x523f1e[_0xf356('0xb')];this['AttachmentId']=_0x523f1e['AttachmentId'];}module[_0xf356('0xc')]=Action; \ No newline at end of file +var _0x95c2=['AttachmentId','util','moment','uniqueid','channel','%s/%s/%s','Trunk','localstationid','headerinfo','path'];(function(_0x4e094d,_0xeb173b){var _0x514558=function(_0x2d038d){while(--_0x2d038d){_0x4e094d['push'](_0x4e094d['shift']());}};_0x514558(++_0xeb173b);}(_0x95c2,0x137));var _0x295c=function(_0x4ff160,_0x3be7f5){_0x4ff160=_0x4ff160-0x0;var _0x31b238=_0x95c2[_0x4ff160];return _0x31b238;};'use strict';var util=require(_0x295c('0x0'));var _=require('lodash');var moment=require(_0x295c('0x1'));function Action(_0x42984b,_0x53361b,_0x11c57f){this[_0x295c('0x2')]=_0x42984b||undefined;this[_0x295c('0x3')]=util['format'](_0x295c('0x4'),_0x53361b['tech'],_0x53361b[_0x295c('0x5')]['name'],_0x11c57f['fax']);this[_0x295c('0x6')]=_0x53361b[_0x295c('0x6')];this[_0x295c('0x7')]=_0x53361b['headerinfo'];this[_0x295c('0x8')]=_0x11c57f[_0x295c('0x8')];this['AttachmentId']=_0x11c57f[_0x295c('0x9')];}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 cfe0db0..f99c4c3 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 _0x5ac3=['checkAfterSend','FaxAccountId','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','lodash','bluebird','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','parse','.pdf','notify','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','merge','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed'];(function(_0x1526e1,_0x5ed5a5){var _0x249a1e=function(_0x4a7c12){while(--_0x4a7c12){_0x1526e1['push'](_0x1526e1['shift']());}};_0x249a1e(++_0x5ed5a5);}(_0x5ac3,0x176));var _0x35ac=function(_0x58c601,_0x18c000){_0x58c601=_0x58c601-0x0;var _0x3c166b=_0x5ac3[_0x58c601];return _0x3c166b;};'use strict';var util=require('util');var _=require(_0x35ac('0x0'));var BPromise=require(_0x35ac('0x1'));var uuid=require('uuid');var moment=require('moment');var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0x35ac('0x2'));var logger=require(_0x35ac('0x3'))(_0x35ac('0x4'));var ami=require('../ami');var rpcDb=require(_0x35ac('0x5'));var Channel=require(_0x35ac('0x6'));var ut=require(_0x35ac('0x7'));var Action=require('./action');var faxAccount=require(_0x35ac('0x8'));var attachment=require(_0x35ac('0x9'));var faxMessage=require(_0x35ac('0xa'));function Fax(_0x18c0b3){this[_0x35ac('0xb')]={};this[_0x35ac('0xc')]=_0x18c0b3[_0x35ac('0xc')];this[_0x35ac('0xd')]=_0x18c0b3[_0x35ac('0xd')];this[_0x35ac('0xe')]={};ami['on'](_0x35ac('0xf'),this[_0x35ac('0x10')]['bind'](this));ami['on'](_0x35ac('0x11'),this[_0x35ac('0x12')][_0x35ac('0x13')](this));ami['on'](_0x35ac('0x14'),this[_0x35ac('0x15')][_0x35ac('0x13')](this));ami['on'](_0x35ac('0x16'),this[_0x35ac('0x17')][_0x35ac('0x13')](this));ami['on'](_0x35ac('0x18'),this[_0x35ac('0x19')]['bind'](this));ami['on'](_0x35ac('0x1a'),this[_0x35ac('0x1b')][_0x35ac('0x13')](this));ami['on'](_0x35ac('0x1c'),this[_0x35ac('0x1d')][_0x35ac('0x13')](this));ami['on'](_0x35ac('0x1e'),this[_0x35ac('0x1f')]['bind'](this));}Fax[_0x35ac('0x20')][_0x35ac('0x10')]=function(_0x4a168a){if(_0x4a168a[_0x35ac('0x21')]===_0x35ac('0x22')){for(var _0x27c603 in this[_0x35ac('0xc')]){if(this[_0x35ac('0xc')][_0x35ac('0x23')](_0x27c603)){if(_0x4a168a[_0x35ac('0x24')]===this[_0x35ac('0xc')][_0x27c603][_0x35ac('0x25')]){this[_0x35ac('0xb')][_0x4a168a[_0x35ac('0x26')]]={};this[_0x35ac('0xb')][_0x4a168a[_0x35ac('0x26')]][_0x35ac('0x27')]=_0x4a168a[_0x35ac('0x27')];this[_0x35ac('0xb')][_0x4a168a[_0x35ac('0x26')]]['id']=this[_0x35ac('0xc')][_0x27c603]['id'];this[_0x35ac('0xb')][_0x4a168a['uniqueid']]['name']=this[_0x35ac('0xc')][_0x27c603][_0x35ac('0x28')];logger['info'](_0x4a168a[_0x35ac('0x26')],_0x35ac('0x29'));}}}}if(this[_0x35ac('0xe')][_0x4a168a[_0x35ac('0x26')]]){this[_0x35ac('0xb')][_0x4a168a[_0x35ac('0x26')]]={};this['channels'][_0x4a168a[_0x35ac('0x26')]][_0x35ac('0x27')]=_0x4a168a['channel'];logger[_0x35ac('0x2a')](_0x4a168a['uniqueid'],_0x35ac('0x29'));}};Fax[_0x35ac('0x20')][_0x35ac('0x12')]=function(_0x4672b3){if(this[_0x35ac('0xb')][_0x4672b3[_0x35ac('0x26')]]){for(var _0x56abe9 in _0x4672b3[_0x35ac('0x2b')]){if(_0x4672b3[_0x35ac('0x2b')][_0x35ac('0x23')](_0x56abe9)){this[_0x35ac('0xb')][_0x4672b3[_0x35ac('0x26')]][_0x56abe9]=_0x4672b3['value'];}}}};Fax[_0x35ac('0x20')]['syncNewState']=function(_0x2fd807){if(this[_0x35ac('0xb')][_0x2fd807[_0x35ac('0x26')]]){this[_0x35ac('0xb')][_0x2fd807[_0x35ac('0x26')]][_0x35ac('0x2c')]=_0x2fd807[_0x35ac('0x2c')];this[_0x35ac('0xb')][_0x2fd807[_0x35ac('0x26')]][_0x35ac('0x2d')]=_0x2fd807['channelstatedesc'];}};Fax[_0x35ac('0x20')]['syncNewExten']=function(_0x17e838){if(this[_0x35ac('0xb')][_0x17e838[_0x35ac('0x26')]]){for(var _0x5e243e in _0x17e838[_0x35ac('0x2b')]){if(_0x17e838[_0x35ac('0x2b')][_0x35ac('0x23')](_0x5e243e)){this['channels'][_0x17e838[_0x35ac('0x26')]][_0x5e243e]=_0x17e838[_0x35ac('0x2e')];}}}};Fax[_0x35ac('0x20')][_0x35ac('0x19')]=function(_0x246715){if(this[_0x35ac('0xb')][_0x246715[_0x35ac('0x26')]]){this[_0x35ac('0xb')][_0x246715['uniqueid']][_0x35ac('0x2f')]=_0x246715['operation'];this[_0x35ac('0xb')][_0x246715[_0x35ac('0x26')]][_0x35ac('0x30')]=_0x246715[_0x35ac('0x30')];this[_0x35ac('0xb')][_0x246715[_0x35ac('0x26')]][_0x35ac('0x25')]=_0x246715[_0x35ac('0x25')];this[_0x35ac('0xb')][_0x246715[_0x35ac('0x26')]][_0x35ac('0x31')]=_0x246715['filename'];logger[_0x35ac('0x2a')](_0x246715['uniqueid'],_0x35ac('0x32'));}};Fax[_0x35ac('0x20')][_0x35ac('0x1b')]=function(_0x4b48fe){var _0x5ab556=this;if(this['channels'][_0x4b48fe[_0x35ac('0x26')]]){var _0x26e165=this[_0x35ac('0xb')][_0x4b48fe['uniqueid']]['id'];this[_0x35ac('0xb')][_0x4b48fe[_0x35ac('0x26')]]['remotestationid']=_0x4b48fe['remotestationid'];this[_0x35ac('0xb')][_0x4b48fe[_0x35ac('0x26')]][_0x35ac('0x33')]=_0x4b48fe[_0x35ac('0x33')];this[_0x35ac('0xb')][_0x4b48fe[_0x35ac('0x26')]][_0x35ac('0x25')]=_0x4b48fe[_0x35ac('0x25')];this[_0x35ac('0xb')][_0x4b48fe[_0x35ac('0x26')]][_0x35ac('0x34')]=_0x4b48fe[_0x35ac('0x34')];this[_0x35ac('0xb')][_0x4b48fe[_0x35ac('0x26')]]['transferrate']=_0x4b48fe[_0x35ac('0x35')];this['channels'][_0x4b48fe[_0x35ac('0x26')]]['filename']=_0x4b48fe[_0x35ac('0x31')];this[_0x35ac('0xb')][_0x4b48fe[_0x35ac('0x26')]][_0x35ac('0x36')]=_0x4b48fe[_0x35ac('0x36')];if(this[_0x35ac('0xb')][_0x4b48fe[_0x35ac('0x26')]][_0x35ac('0x33')]>0x0){tiff2pdf(_0x4b48fe[_0x35ac('0x31')],_0x35ac('0x37'),function(_0x586f15){logger[_0x35ac('0x2a')](_0x4b48fe[_0x35ac('0x26')],_0x35ac('0x38'),_0x586f15['message']);attachment['create']({'name':path[_0x35ac('0x39')](_0x4b48fe[_0x35ac('0x31')])[_0x35ac('0x28')],'basename':path[_0x35ac('0x39')](_0x4b48fe[_0x35ac('0x31')])['name']+_0x35ac('0x3a'),'type':'application/pdf'})['then'](function(_0x29231a){faxAccount[_0x35ac('0x3b')](_0x26e165,{'from':_0x4b48fe[_0x35ac('0x36')],'mapKey':_0x35ac('0x4'),'body':path['parse'](_0x4b48fe['filename'])['name']+'.pdf','AttachmentId':_0x29231a['id']})[_0x35ac('0x3c')](function(_0x503b65){logger['error'](_0x4b48fe[_0x35ac('0x26')],_0x35ac('0x3d'),JSON[_0x35ac('0x3e')](_0x503b65));});})['catch'](function(_0x3fa647){logger[_0x35ac('0x3f')](_0x4b48fe[_0x35ac('0x26')],_0x35ac('0x40'),JSON[_0x35ac('0x3e')](_0x3fa647));});});}logger['info'](_0x4b48fe[_0x35ac('0x26')],'\x20receiveFax\x20');}};Fax[_0x35ac('0x20')]['syncOriginateResponse']=function(_0x5b3c6e){if(this[_0x35ac('0xe')][_0x5b3c6e['uniqueid']]){_[_0x35ac('0x41')](this[_0x35ac('0xb')][_0x5b3c6e[_0x35ac('0x26')]],_['pick'](_0x5b3c6e,['response',_0x35ac('0x42')]));}};function updateStatus(_0x4a27c6){if(_0x4a27c6[_0x35ac('0x43')]){faxMessage[_0x35ac('0x44')](_0x4a27c6[_0x35ac('0x43')],{'failMessage':_0x35ac('0x45')})[_0x35ac('0x46')](function(_0x518e9d){ut['logger'](_0x35ac('0x47'),_0x518e9d);})[_0x35ac('0x3c')](function(_0x104bed){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x104bed);});}else{ut[_0x35ac('0x48')](_0x35ac('0x49'));}}Fax[_0x35ac('0x20')]['updateStatus']=function(_0x3da02f,_0x48ee1c,_0x51232e){var _0x15d773=this;var _0x32db86={};if(_0x48ee1c){_0x32db86={'read':_0x48ee1c};}else{_0x32db86={'failMessage':_0x51232e};}if(this[_0x35ac('0xe')][_0x3da02f][_0x35ac('0x43')]){faxMessage[_0x35ac('0x44')](this[_0x35ac('0xe')][_0x3da02f][_0x35ac('0x43')],_0x32db86)['then'](function(_0x136c54){ut[_0x35ac('0x48')](_0x35ac('0x4a'),_0x136c54);})[_0x35ac('0x3c')](function(_0x319611){ut[_0x35ac('0x48')]('[Fax][Message][NoUpdate1]',_0x319611);})[_0x35ac('0x4b')](function(){delete _0x15d773['channels'][_0x3da02f];delete _0x15d773[_0x35ac('0xe')][_0x3da02f];});}else{ut[_0x35ac('0x48')](_0x35ac('0x4c'));delete this[_0x35ac('0xb')][_0x3da02f];delete this['actions'][_0x3da02f];}};Fax[_0x35ac('0x20')][_0x35ac('0x1d')]=function(_0x11ee46){var _0x570742=this;if(this[_0x35ac('0xb')][_0x11ee46[_0x35ac('0x26')]]){if(this[_0x35ac('0xe')][_0x11ee46['uniqueid']]){this[_0x35ac('0xb')][_0x11ee46[_0x35ac('0x26')]]['id']=this[_0x35ac('0xe')][_0x11ee46[_0x35ac('0x26')]]['id'];this[_0x35ac('0xb')][_0x11ee46[_0x35ac('0x26')]][_0x35ac('0x28')]=this['actions'][_0x11ee46[_0x35ac('0x26')]][_0x35ac('0x28')];}logger[_0x35ac('0x2a')](_0x11ee46[_0x35ac('0x26')],this['actions'][_0x11ee46['uniqueid']]?_0x35ac('0x4d'):'\x20hangup\x20faxRiceive\x20',JSON[_0x35ac('0x3e')](this[_0x35ac('0xb')][_0x11ee46[_0x35ac('0x26')]]));if(this[_0x35ac('0xe')][_0x11ee46[_0x35ac('0x26')]]){if(this[_0x35ac('0xb')][_0x11ee46['uniqueid']][_0x35ac('0x4e')]>0x0&&this[_0x35ac('0xb')][_0x11ee46['uniqueid']]['faxstatus']===_0x35ac('0x4f')){this[_0x35ac('0x50')](_0x11ee46['uniqueid'],!![]);}else{this['updateStatus'](_0x11ee46[_0x35ac('0x26')],![],this[_0x35ac('0xb')][_0x11ee46[_0x35ac('0x26')]][_0x35ac('0x51')]?'SENDING\x20FAILED:\x20'+this[_0x35ac('0xb')][_0x11ee46[_0x35ac('0x26')]][_0x35ac('0x51')]:_0x35ac('0x52'));}}}};Fax[_0x35ac('0x20')][_0x35ac('0x53')]=function(_0x3b5b3c){var _0x52bc17=this;return new BPromise(function(_0x509c1c,_0x540eb0){_0x52bc17[_0x35ac('0x54')](_0x3b5b3c,_0x52bc17[_0x35ac('0xc')][_0x3b5b3c['FaxAccountId']])[_0x35ac('0x46')](function(_0x5e7538){ut['logger'](_0x35ac('0x55'),_0x5e7538);_0x509c1c(ut[_0x35ac('0x56')](_0x35ac('0x57')));})[_0x35ac('0x3c')](function(_0x5c6d4e){ut[_0x35ac('0x48')](_0x35ac('0x58'),_0x5c6d4e);updateStatus(_0x3b5b3c);_0x540eb0(ut[_0x35ac('0x56')](_0x35ac('0x59')));});});};Fax['prototype'][_0x35ac('0x5a')]=function(_0xd68bfb){var _0xb09a3=this;return new BPromise(function(_0x382be2,_0x56c637){var _0x4e00f2=_0xb09a3['checkTrunk'](_0xb09a3['faxAccounts'][_0xd68bfb[_0x35ac('0x5b')]][_0x35ac('0x5c')],_0xd68bfb);if(_0x4e00f2['isValid']){_0x382be2(ut['message'](_0x35ac('0x5d')));}else{_0x56c637(ut['message'](_0x4e00f2[_0x35ac('0x56')]));}});};function originate(_0xef8ff8,_0x2f5042,_0x127ef2){return new BPromise(function(_0x499205,_0x1950cc){if(_0x127ef2){var _0x58b492=util[_0x35ac('0x5e')](_0x35ac('0x5f'),path['parse'](_0xef8ff8['path'])[_0x35ac('0x28')],_0xef8ff8[_0x35ac('0x60')]);gs[_0x35ac('0x61')](_0x58b492)[_0x35ac('0x46')](function(){_0xef8ff8[_0x35ac('0x60')]=util[_0x35ac('0x5e')](_0x35ac('0x62'),path[_0x35ac('0x39')](_0xef8ff8[_0x35ac('0x60')])['dir'],path[_0x35ac('0x39')](_0xef8ff8[_0x35ac('0x60')])['name']);_0x2f5042[_0x35ac('0x63')]=_0xef8ff8[_0x35ac('0x60')];ut[_0x35ac('0x48')](_0x35ac('0x64'),'');ami[_0x35ac('0x65')](ut[_0x35ac('0x66')](_0xef8ff8,_0x2f5042))[_0x35ac('0x46')](function(_0x5a8cee){_0x499205(_0x5a8cee);})[_0x35ac('0x3c')](function(_0x5d6c6f){_0x1950cc(_0x5d6c6f);});})[_0x35ac('0x3c')](function(_0x18eb05){_0x1950cc(_0x18eb05);});}else{ami[_0x35ac('0x65')](ut['variablesAction'](_0xef8ff8,_0x2f5042))[_0x35ac('0x46')](function(_0x592522){_0x499205(_0x592522);})[_0x35ac('0x3c')](function(_0x4e221c){_0x1950cc(_0x4e221c);});}});}Fax[_0x35ac('0x20')][_0x35ac('0x54')]=function(_0x2dfc32,_0x32c7d3){var _0x30b471=this;return new BPromise(function(_0xd3b54f,_0x2c5e06){var _0x437cf0=uuid['v4']();var _0x14d040=ut[_0x35ac('0x67')](_0x2dfc32,_0x32c7d3);_0x30b471['actions'][_0x437cf0]=new Action(_0x437cf0,_0x32c7d3,_0x2dfc32);var _0x20584d=_0x30b471[_0x35ac('0xe')][_0x437cf0];if(path['parse'](_0x2dfc32[_0x35ac('0x60')])[_0x35ac('0x68')]===_0x35ac('0x3a')){originate(_0x20584d,_0x14d040,!![])[_0x35ac('0x46')](function(_0x1b2955){_0xd3b54f(_0x1b2955);})[_0x35ac('0x3c')](function(_0x55df0d){_0x2c5e06(_0x55df0d);});}else{originate(_0x20584d,_0x14d040,![])['then'](function(_0x1eb96b){_0xd3b54f(_0x1eb96b);})[_0x35ac('0x3c')](function(_0x216a46){_0x2c5e06(_0x216a46);});}});};Fax[_0x35ac('0x20')][_0x35ac('0x69')]=function(_0x5b2bb3){return!_[_0x35ac('0x6a')](_0x5b2bb3)&&!_['isNil'](_0x5b2bb3[_0x35ac('0x28')])&&!_['isNil'](_0x5b2bb3['active'])&&_0x5b2bb3[_0x35ac('0x6b')]&&!_[_0x35ac('0x6a')](this[_0x35ac('0xd')][util['format'](_0x35ac('0x6c'),_0x5b2bb3['name'])])&&!_[_0x35ac('0x6a')](this[_0x35ac('0xd')][util['format']('SIP/%s',_0x5b2bb3[_0x35ac('0x28')])][_0x35ac('0x30')])&&(this[_0x35ac('0xd')][util[_0x35ac('0x5e')](_0x35ac('0x6c'),_0x5b2bb3[_0x35ac('0x28')])][_0x35ac('0x30')]==='reachable'||this[_0x35ac('0xd')][util[_0x35ac('0x5e')](_0x35ac('0x6c'),_0x5b2bb3[_0x35ac('0x28')])][_0x35ac('0x30')]===_0x35ac('0x6d'));};Fax[_0x35ac('0x20')]['checkTrunk']=function(_0x22367e,_0x513755){if(!this[_0x35ac('0x69')](_0x22367e)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x35ac('0x6a')](_0x22367e)?'':_0x22367e[_0x35ac('0x28')]+_0x35ac('0x6e'));return{'isValid':![],'message':_0x35ac('0x6f')};}if(_['isNil'](_0x513755['fax'])){ut[_0x35ac('0x48')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x35ac('0x3e')](_0x513755));return{'isValid':![],'message':_0x35ac('0x70')};}if(_['isNil'](_0x513755[_0x35ac('0x60')])){ut[_0x35ac('0x48')](_0x35ac('0x71'),JSON[_0x35ac('0x3e')](_0x513755));return{'isValid':![],'message':_0x35ac('0x72')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x35ac('0x73')]=Fax; \ No newline at end of file +var _0x58a4=['pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','name','parse','application/pdf','then','notify','.pdf','catch','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatus','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','format','SIP/%s','reachable','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','newstate','syncNewState','bind','newexten','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','prototype','from-voip-provider','faxAccounts','hasOwnProperty','localstationid','uniqueid','channel','info','\x20syncNewchannel\x20','value','channelstate','channelstatedesc','variable','operation','status','filename','\x20syncFaxStatus\x20','remotestationid'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0x58a4,0xbf));var _0x458a=function(_0x1a3243,_0x201872){_0x1a3243=_0x1a3243-0x0;var _0x33f2ca=_0x58a4[_0x1a3243];return _0x33f2ca;};'use strict';var util=require(_0x458a('0x0'));var _=require(_0x458a('0x1'));var BPromise=require(_0x458a('0x2'));var uuid=require(_0x458a('0x3'));var moment=require(_0x458a('0x4'));var path=require(_0x458a('0x5'));var tiff2pdf=require(_0x458a('0x6'));var gs=require(_0x458a('0x7'));var logger=require(_0x458a('0x8'))(_0x458a('0x9'));var ami=require(_0x458a('0xa'));var rpcDb=require(_0x458a('0xb'));var Channel=require(_0x458a('0xc'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0x458a('0xd'));var attachment=require(_0x458a('0xe'));var faxMessage=require(_0x458a('0xf'));function Fax(_0x1e658e){this[_0x458a('0x10')]={};this['faxAccounts']=_0x1e658e['faxAccounts'];this[_0x458a('0x11')]=_0x1e658e[_0x458a('0x11')];this[_0x458a('0x12')]={};ami['on'](_0x458a('0x13'),this[_0x458a('0x14')]['bind'](this));ami['on'](_0x458a('0x15'),this[_0x458a('0x16')]['bind'](this));ami['on'](_0x458a('0x17'),this[_0x458a('0x18')][_0x458a('0x19')](this));ami['on'](_0x458a('0x1a'),this[_0x458a('0x1b')]['bind'](this));ami['on']('faxstatus',this[_0x458a('0x1c')]['bind'](this));ami['on'](_0x458a('0x1d'),this[_0x458a('0x1e')][_0x458a('0x19')](this));ami['on'](_0x458a('0x1f'),this[_0x458a('0x20')][_0x458a('0x19')](this));ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));}Fax[_0x458a('0x21')][_0x458a('0x14')]=function(_0x3558b9){if(_0x3558b9['context']===_0x458a('0x22')){for(var _0x260c87 in this[_0x458a('0x23')]){if(this[_0x458a('0x23')][_0x458a('0x24')](_0x260c87)){if(_0x3558b9['exten']===this['faxAccounts'][_0x260c87][_0x458a('0x25')]){this['channels'][_0x3558b9[_0x458a('0x26')]]={};this[_0x458a('0x10')][_0x3558b9['uniqueid']][_0x458a('0x27')]=_0x3558b9['channel'];this[_0x458a('0x10')][_0x3558b9[_0x458a('0x26')]]['id']=this['faxAccounts'][_0x260c87]['id'];this[_0x458a('0x10')][_0x3558b9[_0x458a('0x26')]]['name']=this[_0x458a('0x23')][_0x260c87]['name'];logger[_0x458a('0x28')](_0x3558b9['uniqueid'],_0x458a('0x29'));}}}}if(this['actions'][_0x3558b9[_0x458a('0x26')]]){this[_0x458a('0x10')][_0x3558b9[_0x458a('0x26')]]={};this[_0x458a('0x10')][_0x3558b9[_0x458a('0x26')]][_0x458a('0x27')]=_0x3558b9[_0x458a('0x27')];logger[_0x458a('0x28')](_0x3558b9[_0x458a('0x26')],_0x458a('0x29'));}};Fax[_0x458a('0x21')][_0x458a('0x16')]=function(_0x21ec38){if(this['channels'][_0x21ec38[_0x458a('0x26')]]){for(var _0x112fa6 in _0x21ec38['variable']){if(_0x21ec38['variable'][_0x458a('0x24')](_0x112fa6)){this['channels'][_0x21ec38[_0x458a('0x26')]][_0x112fa6]=_0x21ec38[_0x458a('0x2a')];}}}};Fax[_0x458a('0x21')]['syncNewState']=function(_0xa6fdf){if(this[_0x458a('0x10')][_0xa6fdf[_0x458a('0x26')]]){this['channels'][_0xa6fdf['uniqueid']][_0x458a('0x2b')]=_0xa6fdf['channelstate'];this[_0x458a('0x10')][_0xa6fdf['uniqueid']][_0x458a('0x2c')]=_0xa6fdf[_0x458a('0x2c')];}};Fax['prototype'][_0x458a('0x1b')]=function(_0x269f53){if(this[_0x458a('0x10')][_0x269f53['uniqueid']]){for(var _0x3371c3 in _0x269f53[_0x458a('0x2d')]){if(_0x269f53[_0x458a('0x2d')][_0x458a('0x24')](_0x3371c3)){this[_0x458a('0x10')][_0x269f53['uniqueid']][_0x3371c3]=_0x269f53[_0x458a('0x2a')];}}}};Fax[_0x458a('0x21')][_0x458a('0x1c')]=function(_0x22f02a){if(this[_0x458a('0x10')][_0x22f02a[_0x458a('0x26')]]){this['channels'][_0x22f02a[_0x458a('0x26')]][_0x458a('0x2e')]=_0x22f02a[_0x458a('0x2e')];this[_0x458a('0x10')][_0x22f02a[_0x458a('0x26')]][_0x458a('0x2f')]=_0x22f02a[_0x458a('0x2f')];this[_0x458a('0x10')][_0x22f02a[_0x458a('0x26')]]['localstationid']=_0x22f02a[_0x458a('0x25')];this[_0x458a('0x10')][_0x22f02a[_0x458a('0x26')]][_0x458a('0x30')]=_0x22f02a[_0x458a('0x30')];logger[_0x458a('0x28')](_0x22f02a[_0x458a('0x26')],_0x458a('0x31'));}};Fax[_0x458a('0x21')][_0x458a('0x1e')]=function(_0x1a4011){var _0x1aa28e=this;if(this[_0x458a('0x10')][_0x1a4011[_0x458a('0x26')]]){var _0x5d79cb=this['channels'][_0x1a4011[_0x458a('0x26')]]['id'];this[_0x458a('0x10')][_0x1a4011[_0x458a('0x26')]][_0x458a('0x32')]=_0x1a4011[_0x458a('0x32')];this[_0x458a('0x10')][_0x1a4011[_0x458a('0x26')]][_0x458a('0x33')]=_0x1a4011[_0x458a('0x33')];this[_0x458a('0x10')][_0x1a4011[_0x458a('0x26')]]['localstationid']=_0x1a4011[_0x458a('0x25')];this[_0x458a('0x10')][_0x1a4011['uniqueid']][_0x458a('0x34')]=_0x1a4011[_0x458a('0x34')];this[_0x458a('0x10')][_0x1a4011['uniqueid']][_0x458a('0x35')]=_0x1a4011[_0x458a('0x35')];this[_0x458a('0x10')][_0x1a4011[_0x458a('0x26')]][_0x458a('0x30')]=_0x1a4011[_0x458a('0x30')];this[_0x458a('0x10')][_0x1a4011[_0x458a('0x26')]]['calleridnum']=_0x1a4011[_0x458a('0x36')];if(this[_0x458a('0x10')][_0x1a4011[_0x458a('0x26')]]['pagestransferred']>0x0){tiff2pdf(_0x1a4011[_0x458a('0x30')],_0x458a('0x37'),function(_0x49d06e){logger[_0x458a('0x28')](_0x1a4011[_0x458a('0x26')],_0x458a('0x38'),_0x49d06e[_0x458a('0x39')]);attachment[_0x458a('0x3a')]({'name':path['parse'](_0x1a4011['filename'])[_0x458a('0x3b')],'basename':path[_0x458a('0x3c')](_0x1a4011[_0x458a('0x30')])[_0x458a('0x3b')]+'.pdf','type':_0x458a('0x3d')})[_0x458a('0x3e')](function(_0x5237b9){faxAccount[_0x458a('0x3f')](_0x5d79cb,{'from':_0x1a4011['calleridnum'],'mapKey':_0x458a('0x9'),'body':path[_0x458a('0x3c')](_0x1a4011[_0x458a('0x30')])['name']+_0x458a('0x40'),'AttachmentId':_0x5237b9['id']})[_0x458a('0x41')](function(_0x36ea19){logger['error'](_0x1a4011['uniqueid'],_0x458a('0x42'),JSON[_0x458a('0x43')](_0x36ea19));});})[_0x458a('0x41')](function(_0x4dea55){logger['error'](_0x1a4011[_0x458a('0x26')],_0x458a('0x44'),JSON[_0x458a('0x43')](_0x4dea55));});});}logger[_0x458a('0x28')](_0x1a4011[_0x458a('0x26')],_0x458a('0x44'));}};Fax[_0x458a('0x21')][_0x458a('0x45')]=function(_0xb22232){if(this[_0x458a('0x12')][_0xb22232[_0x458a('0x26')]]){_[_0x458a('0x46')](this[_0x458a('0x10')][_0xb22232[_0x458a('0x26')]],_[_0x458a('0x47')](_0xb22232,[_0x458a('0x48'),'reason']));}};function updateStatus(_0x1c270b){if(_0x1c270b[_0x458a('0x49')]){faxMessage[_0x458a('0x4a')](_0x1c270b[_0x458a('0x49')],{'failMessage':_0x458a('0x4b')})['then'](function(_0x4b5093){ut['logger'](_0x458a('0x4c'),_0x4b5093);})['catch'](function(_0x236d2f){ut[_0x458a('0x4d')](_0x458a('0x4e'),_0x236d2f);});}else{ut[_0x458a('0x4d')](_0x458a('0x4f'));}}Fax['prototype']['updateStatus']=function(_0x3d7616,_0x2d8b77,_0x2587a1){var _0x8ff0dd=this;var _0x2d67b1={};if(_0x2d8b77){_0x2d67b1={'read':_0x2d8b77};}else{_0x2d67b1={'failMessage':_0x2587a1};}if(this['actions'][_0x3d7616][_0x458a('0x49')]){faxMessage['update'](this[_0x458a('0x12')][_0x3d7616]['AttachmentId'],_0x2d67b1)[_0x458a('0x3e')](function(_0x59ae40){ut['logger']('[Fax][Message][Updated]',_0x59ae40);})[_0x458a('0x41')](function(_0x3eb267){ut['logger'](_0x458a('0x50'),_0x3eb267);})[_0x458a('0x51')](function(){delete _0x8ff0dd[_0x458a('0x10')][_0x3d7616];delete _0x8ff0dd['actions'][_0x3d7616];});}else{ut[_0x458a('0x4d')](_0x458a('0x52'));delete this[_0x458a('0x10')][_0x3d7616];delete this[_0x458a('0x12')][_0x3d7616];}};Fax[_0x458a('0x21')][_0x458a('0x20')]=function(_0x597e74){var _0x15200c=this;if(this[_0x458a('0x10')][_0x597e74[_0x458a('0x26')]]){if(this[_0x458a('0x12')][_0x597e74[_0x458a('0x26')]]){this[_0x458a('0x10')][_0x597e74[_0x458a('0x26')]]['id']=this[_0x458a('0x12')][_0x597e74['uniqueid']]['id'];this[_0x458a('0x10')][_0x597e74['uniqueid']][_0x458a('0x3b')]=this[_0x458a('0x12')][_0x597e74[_0x458a('0x26')]][_0x458a('0x3b')];}logger['info'](_0x597e74['uniqueid'],this[_0x458a('0x12')][_0x597e74[_0x458a('0x26')]]?_0x458a('0x53'):_0x458a('0x54'),JSON[_0x458a('0x43')](this[_0x458a('0x10')][_0x597e74['uniqueid']]));if(this[_0x458a('0x12')][_0x597e74[_0x458a('0x26')]]){if(this['channels'][_0x597e74[_0x458a('0x26')]]['faxpages']>0x0&&this[_0x458a('0x10')][_0x597e74[_0x458a('0x26')]][_0x458a('0x55')]===_0x458a('0x56')){this[_0x458a('0x57')](_0x597e74[_0x458a('0x26')],!![]);}else{this[_0x458a('0x57')](_0x597e74[_0x458a('0x26')],![],this['channels'][_0x597e74[_0x458a('0x26')]][_0x458a('0x58')]?'SENDING\x20FAILED:\x20'+this[_0x458a('0x10')][_0x597e74[_0x458a('0x26')]]['faxstatusstring']:_0x458a('0x59'));}}}};Fax[_0x458a('0x21')]['send']=function(_0x17b611){var _0x180df0=this;return new BPromise(function(_0x582ff7,_0x16f82f){_0x180df0[_0x458a('0x5a')](_0x17b611,_0x180df0[_0x458a('0x23')][_0x17b611[_0x458a('0x5b')]])[_0x458a('0x3e')](function(_0x27d1f2){ut[_0x458a('0x4d')](_0x458a('0x5c'),_0x27d1f2);_0x582ff7(ut['message'](_0x458a('0x5d')));})[_0x458a('0x41')](function(_0x29b11e){ut[_0x458a('0x4d')](_0x458a('0x5e'),_0x29b11e);updateStatus(_0x17b611);_0x16f82f(ut[_0x458a('0x39')](_0x458a('0x5f')));});});};Fax[_0x458a('0x21')][_0x458a('0x60')]=function(_0xfe46ae){var _0x546519=this;return new BPromise(function(_0x3837b7,_0x527c09){var _0x53fcf4=_0x546519[_0x458a('0x61')](_0x546519[_0x458a('0x23')][_0xfe46ae[_0x458a('0x5b')]][_0x458a('0x62')],_0xfe46ae);if(_0x53fcf4[_0x458a('0x63')]){_0x3837b7(ut[_0x458a('0x39')](_0x458a('0x64')));}else{_0x527c09(ut[_0x458a('0x39')](_0x53fcf4[_0x458a('0x39')]));}});};function originate(_0x31074e,_0x448cbc,_0x11bbba){return new BPromise(function(_0x435884,_0x3948aa){if(_0x11bbba){var _0x2c131b=util['format'](_0x458a('0x65'),path['parse'](_0x31074e[_0x458a('0x5')])[_0x458a('0x3b')],_0x31074e['path']);gs[_0x458a('0x66')](_0x2c131b)[_0x458a('0x3e')](function(){_0x31074e[_0x458a('0x5')]=util['format'](_0x458a('0x67'),path[_0x458a('0x3c')](_0x31074e[_0x458a('0x5')])[_0x458a('0x68')],path[_0x458a('0x3c')](_0x31074e[_0x458a('0x5')])['name']);_0x448cbc[_0x458a('0x69')]=_0x31074e['path'];ut['logger'](_0x458a('0x6a'),'');ami[_0x458a('0x6b')](ut[_0x458a('0x6c')](_0x31074e,_0x448cbc))[_0x458a('0x3e')](function(_0xaf6262){_0x435884(_0xaf6262);})[_0x458a('0x41')](function(_0x42eae7){_0x3948aa(_0x42eae7);});})[_0x458a('0x41')](function(_0x3d30e2){_0x3948aa(_0x3d30e2);});}else{ami[_0x458a('0x6b')](ut[_0x458a('0x6c')](_0x31074e,_0x448cbc))[_0x458a('0x3e')](function(_0x14231a){_0x435884(_0x14231a);})[_0x458a('0x41')](function(_0x486687){_0x3948aa(_0x486687);});}});}Fax['prototype']['execOriginate']=function(_0x2cdde0,_0x5c6a8d){var _0x4358d2=this;return new BPromise(function(_0x4db3ab,_0x46ef02){var _0x3d73d1=uuid['v4']();var _0x259e54=ut[_0x458a('0x6d')](_0x2cdde0,_0x5c6a8d);_0x4358d2[_0x458a('0x12')][_0x3d73d1]=new Action(_0x3d73d1,_0x5c6a8d,_0x2cdde0);var _0x49f3ee=_0x4358d2[_0x458a('0x12')][_0x3d73d1];if(path[_0x458a('0x3c')](_0x2cdde0['path'])[_0x458a('0x6e')]==='.pdf'){originate(_0x49f3ee,_0x259e54,!![])[_0x458a('0x3e')](function(_0x58d29d){_0x4db3ab(_0x58d29d);})[_0x458a('0x41')](function(_0x177457){_0x46ef02(_0x177457);});}else{originate(_0x49f3ee,_0x259e54,![])[_0x458a('0x3e')](function(_0x1fe8a1){_0x4db3ab(_0x1fe8a1);})['catch'](function(_0x191872){_0x46ef02(_0x191872);});}});};Fax[_0x458a('0x21')][_0x458a('0x6f')]=function(_0x239e2f){return!_[_0x458a('0x70')](_0x239e2f)&&!_[_0x458a('0x70')](_0x239e2f[_0x458a('0x3b')])&&!_[_0x458a('0x70')](_0x239e2f['active'])&&_0x239e2f[_0x458a('0x71')]&&!_[_0x458a('0x70')](this[_0x458a('0x11')][util[_0x458a('0x72')]('SIP/%s',_0x239e2f[_0x458a('0x3b')])])&&!_[_0x458a('0x70')](this['trunks'][util[_0x458a('0x72')](_0x458a('0x73'),_0x239e2f[_0x458a('0x3b')])][_0x458a('0x2f')])&&(this[_0x458a('0x11')][util['format'](_0x458a('0x73'),_0x239e2f[_0x458a('0x3b')])][_0x458a('0x2f')]===_0x458a('0x74')||this[_0x458a('0x11')][util[_0x458a('0x72')](_0x458a('0x73'),_0x239e2f['name'])][_0x458a('0x2f')]==='unmonitored');};Fax[_0x458a('0x21')][_0x458a('0x61')]=function(_0x1fa730,_0x4e2a65){if(!this[_0x458a('0x6f')](_0x1fa730)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x458a('0x70')](_0x1fa730)?'':_0x1fa730[_0x458a('0x3b')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x458a('0x70')](_0x4e2a65[_0x458a('0x9')])){ut[_0x458a('0x4d')](_0x458a('0x75'),JSON[_0x458a('0x43')](_0x4e2a65));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x458a('0x70')](_0x4e2a65['path'])){ut[_0x458a('0x4d')](_0x458a('0x76'),JSON[_0x458a('0x43')](_0x4e2a65));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x458a('0x77')};};module[_0x458a('0x78')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index fbdf2d3..70e0799 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 _0x6832=['[Notify]\x20','bluebird','../../../config/logger','../rpc/faxAccount','error','inspect','notify','resolve','catch'];(function(_0x1ccbcc,_0x5c948b){var _0x1e873f=function(_0x4f232e){while(--_0x4f232e){_0x1ccbcc['push'](_0x1ccbcc['shift']());}};_0x1e873f(++_0x5c948b);}(_0x6832,0x18d));var _0x2683=function(_0x5a7f01,_0x38b4c4){_0x5a7f01=_0x5a7f01-0x0;var _0x396db3=_0x6832[_0x5a7f01];return _0x396db3;};'use strict';var util=require('util');var BPromise=require(_0x2683('0x0'));var logger=require(_0x2683('0x1'))('preview');var _=require('lodash');var faxAccount=require(_0x2683('0x2'));function loggerCatch(_0x260518){return function(_0x2ac2c3){logger[_0x2683('0x3')](_0x260518,util[_0x2683('0x4')](_0x2ac2c3,{'showHidden':![],'depth':null}));};}exports[_0x2683('0x5')]=function(_0x23596c,_0x57836d){return BPromise[_0x2683('0x6')]()['then'](faxAccount[_0x2683('0x5')](_0x23596c,_0x57836d))[_0x2683('0x7')](loggerCatch(_0x2683('0x8')));}; \ No newline at end of file +var _0x063c=['lodash','error','inspect','notify','resolve','then','catch','[Notify]\x20','../../../config/logger'];(function(_0x2f47a7,_0x502c58){var _0x19f205=function(_0x4a08bf){while(--_0x4a08bf){_0x2f47a7['push'](_0x2f47a7['shift']());}};_0x19f205(++_0x502c58);}(_0x063c,0xbc));var _0xc063=function(_0x15961d,_0x5372e7){_0x15961d=_0x15961d-0x0;var _0x141f2e=_0x063c[_0x15961d];return _0x141f2e;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xc063('0x0'))('preview');var _=require(_0xc063('0x1'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x27d09d){return function(_0x57254a){logger[_0xc063('0x2')](_0x27d09d,util[_0xc063('0x3')](_0x57254a,{'showHidden':![],'depth':null}));};}exports[_0xc063('0x4')]=function(_0xdaba32,_0x30d5b0){return BPromise[_0xc063('0x5')]()[_0xc063('0x6')](faxAccount[_0xc063('0x4')](_0xdaba32,_0x30d5b0))[_0xc063('0x7')](loggerCatch(_0xc063('0x8')));}; \ 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 d92bfe0..e6afe0d 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 _0x3566=['info','Exec\x20gs','inspect','util','../../../../config/logger','child_process','exec','execute'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3566,0xc3));var _0x6356=function(_0x12fccf,_0xf53ef4){_0x12fccf=_0x12fccf-0x0;var _0x3827cf=_0x3566[_0x12fccf];return _0x3827cf;};'use strict';var util=require(_0x6356('0x0'));var logger=require(_0x6356('0x1'))('fax');var BPromise=require('bluebird');var exec=require(_0x6356('0x2'))[_0x6356('0x3')];exports[_0x6356('0x4')]=function(_0x140daa){return new BPromise(function(_0x17cffb,_0x203fdb){exec(_0x140daa,function(_0x398887,_0x29e117,_0xdd3468){logger[_0x6356('0x5')](_0x6356('0x6'),_0x29e117);if(_0x398887){logger[_0x6356('0x5')](_0x6356('0x6'),'\x20Error\x20:',util[_0x6356('0x7')](_0x398887,{'showHidden':![],'depth':null}),_0x29e117,_0xdd3468);_0x203fdb(_0x398887);}_0x17cffb(_0x29e117);});});}; \ No newline at end of file +var _0x2929=['bluebird','child_process','exec','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2929,0xb1));var _0x9292=function(_0x2c742d,_0x1ab441){_0x2c742d=_0x2c742d-0x0;var _0x92747b=_0x2929[_0x2c742d];return _0x92747b;};'use strict';var util=require(_0x9292('0x0'));var logger=require(_0x9292('0x1'))(_0x9292('0x2'));var BPromise=require(_0x9292('0x3'));var exec=require(_0x9292('0x4'))[_0x9292('0x5')];exports['execute']=function(_0x38223e){return new BPromise(function(_0x1d0cb6,_0x1ec9a7){exec(_0x38223e,function(_0x49a532,_0x5517c9,_0xa08b5f){logger[_0x9292('0x6')](_0x9292('0x7'),_0x5517c9);if(_0x49a532){logger[_0x9292('0x6')](_0x9292('0x7'),_0x9292('0x8'),util[_0x9292('0x9')](_0x49a532,{'showHidden':![],'depth':null}),_0x5517c9,_0xa08b5f);_0x1ec9a7(_0x49a532);}_0x1d0cb6(_0x5517c9);});});}; \ 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 5430155..8019fa0 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 _0x593e=['xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','format','\x22%s\x22','modem','t38timeout','localstationid','path','uniqueid','originate','channel'];(function(_0x3034ce,_0x1421b6){var _0x4bc0e3=function(_0x49a5ca){while(--_0x49a5ca){_0x3034ce['push'](_0x3034ce['shift']());}};_0x4bc0e3(++_0x1421b6);}(_0x593e,0xcb));var _0xe593=function(_0x4b04fd,_0xb86d67){_0x4b04fd=_0x4b04fd-0x0;var _0x30a064=_0x593e[_0x4b04fd];return _0x30a064;};'use strict';var util=require(_0xe593('0x0'));var _=require(_0xe593('0x1'));var moment=require(_0xe593('0x2'));var logger=require(_0xe593('0x3'))(_0xe593('0x4'));exports[_0xe593('0x5')]=function(_0x2c7c48){return{'message':_0x2c7c48};};exports[_0xe593('0x6')]=function(_0x550574,_0x8a87e8){logger[_0xe593('0x7')](_0x550574,util[_0xe593('0x8')](_0x8a87e8,{'showHidden':![],'depth':null}));};exports[_0xe593('0x9')]=function(_0x3b7082,_0x14cff3){var _0x1cda29={'XMF-ECM':_0x14cff3[_0xe593('0xa')],'XMF-HEADERINFO':_0x14cff3[_0xe593('0xb')],'XMF-MINRATE':_0x14cff3[_0xe593('0xc')],'XMF-MAXRATE':_0x14cff3['maxrate'],'XMF-MODEM':util[_0xe593('0xd')](_0xe593('0xe'),_0x14cff3[_0xe593('0xf')]),'XMF-GATEWAY':_0x14cff3['gateway'],'XMF-FAXDETECT':_0x14cff3['faxdetect'],'XMF-T38TIMEOUT':_0x14cff3[_0xe593('0x10')],'XMF-LOCALSTATIONID':_0x14cff3[_0xe593('0x11')],'XMF-PATH':_0x3b7082[_0xe593('0x12')]};return _0x1cda29;};exports['variablesAction']=function(_0x6a5d4f,_0x6bc1b8){return{'actionid':_0x6a5d4f[_0xe593('0x13')],'action':_0xe593('0x14'),'channel':_0x6a5d4f[_0xe593('0x15')],'Exten':_0xe593('0x16'),'Context':_0xe593('0x17'),'Priority':'1','callerid':util[_0xe593('0xd')](_0xe593('0x18'),_0x6a5d4f[_0xe593('0xb')]?_0x6a5d4f['headerinfo']:'',_0x6a5d4f[_0xe593('0x11')]),'variable':_0x6bc1b8,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x6a5d4f[_0xe593('0x13')]};}; \ No newline at end of file +var _0x2e54=['addVariables','headerinfo','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','uniqueid','util','../../../../config/logger','fax','message','logger','inspect'];(function(_0x41a6f7,_0x4bf0e2){var _0x5775fc=function(_0x4dd9ad){while(--_0x4dd9ad){_0x41a6f7['push'](_0x41a6f7['shift']());}};_0x5775fc(++_0x4bf0e2);}(_0x2e54,0x1dd));var _0x42e5=function(_0x20cc70,_0x644f35){_0x20cc70=_0x20cc70-0x0;var _0x4acb12=_0x2e54[_0x20cc70];return _0x4acb12;};'use strict';var util=require(_0x42e5('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x42e5('0x1'))(_0x42e5('0x2'));exports[_0x42e5('0x3')]=function(_0x1c62bb){return{'message':_0x1c62bb};};exports[_0x42e5('0x4')]=function(_0x153440,_0x42736b){logger['info'](_0x153440,util[_0x42e5('0x5')](_0x42736b,{'showHidden':![],'depth':null}));};exports[_0x42e5('0x6')]=function(_0x38cb1b,_0x4bed10){var _0x2af5bb={'XMF-ECM':_0x4bed10['ecm'],'XMF-HEADERINFO':_0x4bed10[_0x42e5('0x7')],'XMF-MINRATE':_0x4bed10['minrate'],'XMF-MAXRATE':_0x4bed10[_0x42e5('0x8')],'XMF-MODEM':util[_0x42e5('0x9')](_0x42e5('0xa'),_0x4bed10[_0x42e5('0xb')]),'XMF-GATEWAY':_0x4bed10[_0x42e5('0xc')],'XMF-FAXDETECT':_0x4bed10[_0x42e5('0xd')],'XMF-T38TIMEOUT':_0x4bed10[_0x42e5('0xe')],'XMF-LOCALSTATIONID':_0x4bed10[_0x42e5('0xf')],'XMF-PATH':_0x38cb1b[_0x42e5('0x10')]};return _0x2af5bb;};exports['variablesAction']=function(_0x456298,_0x28b3b3){return{'actionid':_0x456298['uniqueid'],'action':_0x42e5('0x11'),'channel':_0x456298[_0x42e5('0x12')],'Exten':_0x42e5('0x13'),'Context':_0x42e5('0x14'),'Priority':'1','callerid':util[_0x42e5('0x9')](_0x42e5('0x15'),_0x456298[_0x42e5('0x7')]?_0x456298[_0x42e5('0x7')]:'',_0x456298[_0x42e5('0xf')]),'variable':_0x28b3b3,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x456298[_0x42e5('0x16')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 8a2143b..2a8035a 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 _0xe706=['initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','sync','bluebird','util','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','initTelephones','getVoiceQueues','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts'];(function(_0x5a3468,_0x2b5c16){var _0x53ef64=function(_0x2cbe89){while(--_0x2cbe89){_0x5a3468['push'](_0x5a3468['shift']());}};_0x53ef64(++_0x2b5c16);}(_0xe706,0xa3));var _0x6e70=function(_0x2a3653,_0x2b5804){_0x2a3653=_0x2a3653-0x0;var _0x2d9e61=_0xe706[_0x2a3653];return _0x2d9e61;};'use strict';var BPromise=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var server=require('./server');var Realtime=require(_0x6e70('0x3'));var Report=require(_0x6e70('0x4'));var Acw=require(_0x6e70('0x5'));var Trigger=require(_0x6e70('0x6'));var Dialer=require(_0x6e70('0x7'));var Preview=require(_0x6e70('0x8'));var Fax=require(_0x6e70('0x9'));var user=require(_0x6e70('0xa'));var voiceQueue=require(_0x6e70('0xb'));var voiceQueueReport=require(_0x6e70('0xc'));var voiceCallReport=require(_0x6e70('0xd'));var trunk=require(_0x6e70('0xe'));var trigger=require(_0x6e70('0xf'));var template=require(_0x6e70('0x10'));var cmHopperHistory=require(_0x6e70('0x11'));var campaign=require(_0x6e70('0x12'));var voiceExtension=require(_0x6e70('0x13'));var faxAccount=require(_0x6e70('0x14'));var zendesk=require(_0x6e70('0x15'));var salesforce=require(_0x6e70('0x16'));var sugarcrm=require(_0x6e70('0x17'));var freshdesk=require(_0x6e70('0x18'));var desk=require(_0x6e70('0x19'));var zoho=require(_0x6e70('0x1a'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x6e70('0x1b'));var dynamics365=require(_0x6e70('0x1c'));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()[_0x6e70('0x1d')](_0x6e70('0x1e'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x6e70('0x1d')](_0x6e70('0x1e'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x6e70('0x1f')]()[_0x6e70('0x20')](user['getAgents']())['then'](realtime['initAgents']())[_0x6e70('0x20')](user['getTelephones']())['then'](realtime[_0x6e70('0x21')]())[_0x6e70('0x20')](trunk['getTrunks']())[_0x6e70('0x20')](realtime['initTrunks']())[_0x6e70('0x20')](voiceQueue[_0x6e70('0x22')]())['then'](realtime['initVoiceQueues']())[_0x6e70('0x20')](trigger['getTriggers']())[_0x6e70('0x20')](realtime[_0x6e70('0x23')]())['then'](template['getTemplates']())[_0x6e70('0x20')](realtime[_0x6e70('0x24')]())[_0x6e70('0x20')](zendesk[_0x6e70('0x25')]())[_0x6e70('0x20')](realtime[_0x6e70('0x26')]())[_0x6e70('0x20')](salesforce[_0x6e70('0x27')]())[_0x6e70('0x20')](realtime[_0x6e70('0x28')]())['then'](sugarcrm[_0x6e70('0x29')]())[_0x6e70('0x20')](realtime[_0x6e70('0x2a')]())['then'](freshdesk[_0x6e70('0x2b')]())[_0x6e70('0x20')](realtime[_0x6e70('0x2c')]())['then'](desk[_0x6e70('0x2d')]())['then'](realtime['initDeskAccounts']())['then'](zoho[_0x6e70('0x2e')]())[_0x6e70('0x20')](realtime['initZohoAccounts']())[_0x6e70('0x20')](vtiger[_0x6e70('0x2f')]())['then'](realtime[_0x6e70('0x30')]())[_0x6e70('0x20')](freshsales[_0x6e70('0x31')]())['then'](realtime['initFreshsalesAccounts']())[_0x6e70('0x20')](servicenow[_0x6e70('0x32')]())[_0x6e70('0x20')](realtime[_0x6e70('0x33')]())[_0x6e70('0x20')](dynamics365['getDynamics365Accounts']())[_0x6e70('0x20')](realtime[_0x6e70('0x34')]())[_0x6e70('0x20')](campaign[_0x6e70('0x35')]())[_0x6e70('0x20')](realtime[_0x6e70('0x36')]())[_0x6e70('0x20')](voiceExtension[_0x6e70('0x37')]())[_0x6e70('0x20')](realtime[_0x6e70('0x38')]())['then'](faxAccount[_0x6e70('0x39')]())['then'](realtime[_0x6e70('0x3a')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x6e70('0x1f')]()[_0x6e70('0x20')](voiceQueueReport[_0x6e70('0x3b')]())['then'](realtime[_0x6e70('0x3c')]())[_0x6e70('0x20')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x6e70('0x20')](realtime[_0x6e70('0x3d')]())['then'](cmHopperHistory[_0x6e70('0x3e')]())[_0x6e70('0x20')](realtime[_0x6e70('0x3f')]())[_0x6e70('0x20')](voiceCallReport[_0x6e70('0x40')]())[_0x6e70('0x20')](realtime[_0x6e70('0x41')]())[_0x6e70('0x20')](function(_0xf146fd){})[_0x6e70('0x42')](function(_0x4d32d8){console[_0x6e70('0x43')](_0x4d32d8);});}function main(){return server['listen'](realtime,preview,fax)[_0x6e70('0x20')](function(_0x3222a2){return initRealtime();})[_0x6e70('0x20')](function(){return initParams();})[_0x6e70('0x20')](function(){report[_0x6e70('0x44')]();setInterval(initRealtime,0x1388);})[_0x6e70('0x42')](function(_0x2440be){console[_0x6e70('0x43')](_0x2440be);});}main(); \ No newline at end of file +var _0xe706=['initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','sync','bluebird','util','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','initTelephones','getVoiceQueues','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts'];(function(_0x5ef62b,_0x4879e3){var _0x1c551a=function(_0x224b6a){while(--_0x224b6a){_0x5ef62b['push'](_0x5ef62b['shift']());}};_0x1c551a(++_0x4879e3);}(_0xe706,0xa3));var _0x6e70=function(_0x1b2d57,_0x4fccb7){_0x1b2d57=_0x1b2d57-0x0;var _0x5d46dd=_0xe706[_0x1b2d57];return _0x5d46dd;};'use strict';var BPromise=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var server=require('./server');var Realtime=require(_0x6e70('0x3'));var Report=require(_0x6e70('0x4'));var Acw=require(_0x6e70('0x5'));var Trigger=require(_0x6e70('0x6'));var Dialer=require(_0x6e70('0x7'));var Preview=require(_0x6e70('0x8'));var Fax=require(_0x6e70('0x9'));var user=require(_0x6e70('0xa'));var voiceQueue=require(_0x6e70('0xb'));var voiceQueueReport=require(_0x6e70('0xc'));var voiceCallReport=require(_0x6e70('0xd'));var trunk=require(_0x6e70('0xe'));var trigger=require(_0x6e70('0xf'));var template=require(_0x6e70('0x10'));var cmHopperHistory=require(_0x6e70('0x11'));var campaign=require(_0x6e70('0x12'));var voiceExtension=require(_0x6e70('0x13'));var faxAccount=require(_0x6e70('0x14'));var zendesk=require(_0x6e70('0x15'));var salesforce=require(_0x6e70('0x16'));var sugarcrm=require(_0x6e70('0x17'));var freshdesk=require(_0x6e70('0x18'));var desk=require(_0x6e70('0x19'));var zoho=require(_0x6e70('0x1a'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x6e70('0x1b'));var dynamics365=require(_0x6e70('0x1c'));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()[_0x6e70('0x1d')](_0x6e70('0x1e'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x6e70('0x1d')](_0x6e70('0x1e'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x6e70('0x1f')]()[_0x6e70('0x20')](user['getAgents']())['then'](realtime['initAgents']())[_0x6e70('0x20')](user['getTelephones']())['then'](realtime[_0x6e70('0x21')]())[_0x6e70('0x20')](trunk['getTrunks']())[_0x6e70('0x20')](realtime['initTrunks']())[_0x6e70('0x20')](voiceQueue[_0x6e70('0x22')]())['then'](realtime['initVoiceQueues']())[_0x6e70('0x20')](trigger['getTriggers']())[_0x6e70('0x20')](realtime[_0x6e70('0x23')]())['then'](template['getTemplates']())[_0x6e70('0x20')](realtime[_0x6e70('0x24')]())[_0x6e70('0x20')](zendesk[_0x6e70('0x25')]())[_0x6e70('0x20')](realtime[_0x6e70('0x26')]())[_0x6e70('0x20')](salesforce[_0x6e70('0x27')]())[_0x6e70('0x20')](realtime[_0x6e70('0x28')]())['then'](sugarcrm[_0x6e70('0x29')]())[_0x6e70('0x20')](realtime[_0x6e70('0x2a')]())['then'](freshdesk[_0x6e70('0x2b')]())[_0x6e70('0x20')](realtime[_0x6e70('0x2c')]())['then'](desk[_0x6e70('0x2d')]())['then'](realtime['initDeskAccounts']())['then'](zoho[_0x6e70('0x2e')]())[_0x6e70('0x20')](realtime['initZohoAccounts']())[_0x6e70('0x20')](vtiger[_0x6e70('0x2f')]())['then'](realtime[_0x6e70('0x30')]())[_0x6e70('0x20')](freshsales[_0x6e70('0x31')]())['then'](realtime['initFreshsalesAccounts']())[_0x6e70('0x20')](servicenow[_0x6e70('0x32')]())[_0x6e70('0x20')](realtime[_0x6e70('0x33')]())[_0x6e70('0x20')](dynamics365['getDynamics365Accounts']())[_0x6e70('0x20')](realtime[_0x6e70('0x34')]())[_0x6e70('0x20')](campaign[_0x6e70('0x35')]())[_0x6e70('0x20')](realtime[_0x6e70('0x36')]())[_0x6e70('0x20')](voiceExtension[_0x6e70('0x37')]())[_0x6e70('0x20')](realtime[_0x6e70('0x38')]())['then'](faxAccount[_0x6e70('0x39')]())['then'](realtime[_0x6e70('0x3a')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x6e70('0x1f')]()[_0x6e70('0x20')](voiceQueueReport[_0x6e70('0x3b')]())['then'](realtime[_0x6e70('0x3c')]())[_0x6e70('0x20')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x6e70('0x20')](realtime[_0x6e70('0x3d')]())['then'](cmHopperHistory[_0x6e70('0x3e')]())[_0x6e70('0x20')](realtime[_0x6e70('0x3f')]())[_0x6e70('0x20')](voiceCallReport[_0x6e70('0x40')]())[_0x6e70('0x20')](realtime[_0x6e70('0x41')]())[_0x6e70('0x20')](function(_0xf146fd){})[_0x6e70('0x42')](function(_0x4d32d8){console[_0x6e70('0x43')](_0x4d32d8);});}function main(){return server['listen'](realtime,preview,fax)[_0x6e70('0x20')](function(_0x3222a2){return initRealtime();})[_0x6e70('0x20')](function(){return initParams();})[_0x6e70('0x20')](function(){report[_0x6e70('0x44')]();setInterval(initRealtime,0x1388);})[_0x6e70('0x42')](function(_0x2440be){console[_0x6e70('0x43')](_0x2440be);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 4bd98fa..e55c6e5 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 _0x6773=['mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','md5','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','talking','statePause','stringify','user:%s','emit','user:save','exports','lodash','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','email','accountcode','fullname','state','status','unknown','address','phone'];(function(_0x38045f,_0x551f77){var _0xfd4f8c=function(_0x362607){while(--_0x362607){_0x38045f['push'](_0x38045f['shift']());}};_0xfd4f8c(++_0x551f77);}(_0x6773,0x1b8));var _0x3677=function(_0x22b6a3,_0x1c3f7b){_0x22b6a3=_0x22b6a3-0x0;var _0x2d4f3b=_0x6773[_0x22b6a3];return _0x2d4f3b;};'use strict';var _=require(_0x3677('0x0'));var util=require('util');var moment=require(_0x3677('0x1'));var md5=require('md5');var Redis=require(_0x3677('0x2'));var config=require(_0x3677('0x3'));config[_0x3677('0x4')]=_[_0x3677('0x5')](config[_0x3677('0x4')],{'host':_0x3677('0x6'),'port':0x18eb});var io=require(_0x3677('0x7'))(new Redis(config['redis']));function Agent(_0x322a77){this['id']=_0x322a77['id']||0x0;this['name']=_0x322a77['name']||'';this[_0x3677('0x8')]=_0x322a77['email']||'';this[_0x3677('0x9')]=_0x322a77[_0x3677('0x9')]||'';this[_0x3677('0xa')]=_0x322a77[_0x3677('0xa')]||'';this[_0x3677('0xb')]='unknown';this['stateTime']=0x0;this[_0x3677('0xc')]=_0x3677('0xd');this[_0x3677('0xe')]='';this[_0x3677('0xf')]='';this[_0x3677('0x10')]='';this[_0x3677('0x11')]='';this[_0x3677('0x12')]=_0x322a77[_0x3677('0x12')]||![];this[_0x3677('0x13')]=_0x3677('0xd');this[_0x3677('0x14')]=0x0;this[_0x3677('0x15')]='';this[_0x3677('0x16')]='';this[_0x3677('0x17')]=![];this[_0x3677('0x18')]=![];this[_0x3677('0x19')]='';}Agent[_0x3677('0x1a')][_0x3677('0x1b')]=function(_0x48e377){var _0x14da68;if(_0x48e377&&_0x48e377[_0x3677('0xb')]){_0x14da68=_0x48e377[_0x3677('0xb')][_0x3677('0x1c')]();switch(_0x14da68){case _0x3677('0x1d'):_0x14da68=_0x3677('0x1e');break;case'inuse':_0x14da68=_0x3677('0x1f');break;}}if(_0x14da68&&this[_0x3677('0x13')]!==_0x14da68||_0x48e377[_0x3677('0x20')]){this[_0x3677('0x14')]=_['toNumber'](moment()['format']('x'));}if(_0x14da68){this[_0x3677('0x13')]=_0x14da68;}var _0xdfd34c={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this[_0x3677('0x9')],'fullname':this[_0x3677('0xa')],'state':this[_0x3677('0xb')],'stateTime':this['stateTime'],'status':this[_0x3677('0xc')],'address':this[_0x3677('0xe')],'online':this[_0x3677('0x12')],'voiceStatus':this[_0x3677('0x13')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x3677('0x15')],'voiceStatusQueue':this[_0x3677('0x16')],'interface':this[_0x3677('0x11')],'onhold':this[_0x3677('0x17')]};var _0xea9122=md5(JSON[_0x3677('0x21')](_0xdfd34c));if(this[_0x3677('0x19')]!==_0xea9122){this[_0x3677('0x19')]=_0xea9122;io['to'](util['format'](_0x3677('0x22'),_0xdfd34c['name']))[_0x3677('0x23')](_0x3677('0x24'),_0xdfd34c);io[_0x3677('0x23')]('user:presence',_0xdfd34c);}};module[_0x3677('0x25')]=Agent; \ No newline at end of file +var _0xd716=['mobile','interface','online','unknown','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','voiceStatus','toNumber','format','email','address','stringify','emit','user:save','user:presence','util','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','accountcode','fullname','state','status','phone'];(function(_0x539678,_0x442225){var _0x768565=function(_0x3acf4b){while(--_0x3acf4b){_0x539678['push'](_0x539678['shift']());}};_0x768565(++_0x442225);}(_0xd716,0x137));var _0x6d71=function(_0x158dd7,_0x1f5f90){_0x158dd7=_0x158dd7-0x0;var _0x1772ba=_0xd716[_0x158dd7];return _0x1772ba;};'use strict';var _=require('lodash');var util=require(_0x6d71('0x0'));var moment=require('moment');var md5=require(_0x6d71('0x1'));var Redis=require(_0x6d71('0x2'));var config=require(_0x6d71('0x3'));config[_0x6d71('0x4')]=_[_0x6d71('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x6d71('0x6'))(new Redis(config[_0x6d71('0x4')]));function Agent(_0x39adaf){this['id']=_0x39adaf['id']||0x0;this[_0x6d71('0x7')]=_0x39adaf['name']||'';this['email']=_0x39adaf['email']||'';this[_0x6d71('0x8')]=_0x39adaf[_0x6d71('0x8')]||'';this['fullname']=_0x39adaf[_0x6d71('0x9')]||'';this[_0x6d71('0xa')]='unknown';this['stateTime']=0x0;this[_0x6d71('0xb')]='unknown';this['address']='';this[_0x6d71('0xc')]='';this[_0x6d71('0xd')]='';this[_0x6d71('0xe')]='';this['online']=_0x39adaf[_0x6d71('0xf')]||![];this['voiceStatus']=_0x6d71('0x10');this[_0x6d71('0x11')]=0x0;this[_0x6d71('0x12')]='';this[_0x6d71('0x13')]='';this[_0x6d71('0x14')]=![];this[_0x6d71('0x15')]=![];this[_0x6d71('0x1')]='';}Agent['prototype'][_0x6d71('0x16')]=function(_0x23c9b9){var _0x5c0737;if(_0x23c9b9&&_0x23c9b9[_0x6d71('0xa')]){_0x5c0737=_0x23c9b9[_0x6d71('0xa')][_0x6d71('0x17')]();switch(_0x5c0737){case _0x6d71('0x18'):_0x5c0737=_0x6d71('0x19');break;case _0x6d71('0x1a'):_0x5c0737='talking';break;}}if(_0x5c0737&&this[_0x6d71('0x1b')]!==_0x5c0737||_0x23c9b9['statePause']){this[_0x6d71('0x11')]=_[_0x6d71('0x1c')](moment()[_0x6d71('0x1d')]('x'));}if(_0x5c0737){this[_0x6d71('0x1b')]=_0x5c0737;}var _0x26d4ec={'id':this['id'],'name':this[_0x6d71('0x7')],'email':this[_0x6d71('0x1e')],'accountcode':this['accountcode'],'fullname':this[_0x6d71('0x9')],'state':this['state'],'stateTime':this['stateTime'],'status':this[_0x6d71('0xb')],'address':this[_0x6d71('0x1f')],'online':this[_0x6d71('0xf')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x6d71('0x11')],'voiceStatusCallerIdNumber':this[_0x6d71('0x12')],'voiceStatusQueue':this[_0x6d71('0x13')],'interface':this[_0x6d71('0xe')],'onhold':this['onhold']};var _0x4bea29=md5(JSON[_0x6d71('0x20')](_0x26d4ec));if(this['md5']!==_0x4bea29){this[_0x6d71('0x1')]=_0x4bea29;io['to'](util[_0x6d71('0x1d')]('user:%s',_0x26d4ec[_0x6d71('0x7')]))[_0x6d71('0x21')](_0x6d71('0x22'),_0x26d4ec);io[_0x6d71('0x21')](_0x6d71('0x23'),_0x26d4ec);}};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 7621c4d..9430bee 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 _0x7ba1=['campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type'];(function(_0x1f280f,_0x1e6df0){var _0x39b853=function(_0xe45902){while(--_0xe45902){_0x1f280f['push'](_0x1f280f['shift']());}};_0x39b853(++_0x1e6df0);}(_0x7ba1,0x1c9));var _0x17ba=function(_0x374ad1,_0x1ecad3){_0x374ad1=_0x374ad1-0x0;var _0x328673=_0x7ba1[_0x374ad1];return _0x328673;};'use strict';function Campaign(_0x59087e){this['id']=_0x59087e['id']||0x0;this[_0x17ba('0x0')]=_0x59087e[_0x17ba('0x0')]||'';this[_0x17ba('0x1')]=_0x59087e['type']||_0x17ba('0x2');this[_0x17ba('0x3')]=0x0;this[_0x17ba('0x4')]=0x0;this[_0x17ba('0x5')]=0x0;this[_0x17ba('0x6')]=0x0;this[_0x17ba('0x7')]='';this['sendMessageOneNotActive']=!![];this[_0x17ba('0x8')]=_0x59087e[_0x17ba('0x8')];this['limitCalls']=_0x59087e[_0x17ba('0x9')];this['dialTimezone']=_0x59087e[_0x17ba('0xa')]||null;this[_0x17ba('0xb')]=_0x59087e[_0x17ba('0xb')]?_0x59087e[_0x17ba('0xb')]:null;this['dialOriginateCallerIdName']=_0x59087e[_0x17ba('0xc')];this[_0x17ba('0xd')]=_0x59087e['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x59087e[_0x17ba('0xe')]||0x1e;this[_0x17ba('0xf')]=_0x59087e['dialCongestionMaxRetry'];this[_0x17ba('0x10')]=_0x59087e[_0x17ba('0x10')];this[_0x17ba('0x11')]=_0x59087e[_0x17ba('0x11')];this[_0x17ba('0x12')]=_0x59087e[_0x17ba('0x12')];this[_0x17ba('0x13')]=_0x59087e[_0x17ba('0x13')];this['dialNoAnswerRetryFrequency']=_0x59087e[_0x17ba('0x14')];this[_0x17ba('0x15')]=_0x59087e[_0x17ba('0x15')];this[_0x17ba('0x16')]=_0x59087e['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x59087e[_0x17ba('0x17')]||0x96;this[_0x17ba('0x18')]=_0x59087e[_0x17ba('0x18')]||0x3;this[_0x17ba('0x19')]=_0x59087e[_0x17ba('0x19')]||0x96;this['dialAbandonedMaxRetry']=_0x59087e[_0x17ba('0x1a')]||0x3;this[_0x17ba('0x1b')]=_0x59087e['dialAbandonedRetryFrequency']||0x96;this[_0x17ba('0x1c')]=_0x59087e['dialMachineMaxRetry']||0x3;this[_0x17ba('0x1d')]=_0x59087e[_0x17ba('0x1d')]||0x96;this[_0x17ba('0x1e')]=_0x59087e[_0x17ba('0x1e')]||0x3;this[_0x17ba('0x1f')]=_0x59087e['dialAgentRejectRetryFrequency']||0x96;this[_0x17ba('0x20')]=_0x59087e['dialOrderByScheduledAt']||_0x17ba('0x21');this['dialPrefix']=_0x59087e[_0x17ba('0x22')]||undefined;this[_0x17ba('0x23')]=_0x59087e[_0x17ba('0x23')]||undefined;this[_0x17ba('0x24')]=_0x59087e[_0x17ba('0x24')]||undefined;this[_0x17ba('0x25')]=_0x59087e[_0x17ba('0x25')]?_0x59087e[_0x17ba('0x25')]:undefined;this[_0x17ba('0x26')]=_0x59087e[_0x17ba('0x26')]?_0x59087e[_0x17ba('0x26')]:undefined;this[_0x17ba('0x27')]=_0x59087e[_0x17ba('0x27')]?_0x59087e[_0x17ba('0x27')]:undefined;this['SquareProject']=_0x59087e['SquareProject']?_0x59087e[_0x17ba('0x28')]:undefined;this[_0x17ba('0x29')]=_0x59087e[_0x17ba('0x28')]?_0x59087e['SquareProject'][_0x17ba('0x0')]:undefined;this['dialAMDActive']=_0x59087e[_0x17ba('0x2a')]||![];this['dialAMDInitialSilence']=_0x59087e[_0x17ba('0x2b')];this[_0x17ba('0x2c')]=_0x59087e[_0x17ba('0x2c')];this[_0x17ba('0x2d')]=_0x59087e['dialAMDAfterGreetingSilence'];this[_0x17ba('0x2e')]=_0x59087e[_0x17ba('0x2e')];this[_0x17ba('0x2f')]=_0x59087e[_0x17ba('0x2f')];this[_0x17ba('0x30')]=_0x59087e[_0x17ba('0x30')];this['dialAMDMaximumNumberOfWords']=_0x59087e['dialAMDMaximumNumberOfWords'];this[_0x17ba('0x31')]=_0x59087e[_0x17ba('0x31')];this['dialAMDMaximumWordLength']=_0x59087e[_0x17ba('0x32')];}module['exports']=Campaign; \ No newline at end of file +var _0xe88e=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0xe88e,0x167));var _0xee88=function(_0x2534a0,_0xda89db){_0x2534a0=_0x2534a0-0x0;var _0x3209c0=_0xe88e[_0x2534a0];return _0x3209c0;};'use strict';function Campaign(_0xee034b){this['id']=_0xee034b['id']||0x0;this[_0xee88('0x0')]=_0xee034b[_0xee88('0x0')]||'';this[_0xee88('0x1')]=_0xee034b[_0xee88('0x1')]||_0xee88('0x2');this[_0xee88('0x3')]=0x0;this[_0xee88('0x4')]=0x0;this[_0xee88('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0xee88('0x6')]=!![];this[_0xee88('0x7')]=_0xee034b[_0xee88('0x7')];this['limitCalls']=_0xee034b[_0xee88('0x8')];this[_0xee88('0x9')]=_0xee034b['dialTimezone']||null;this['dialGlobalInterval']=_0xee034b[_0xee88('0xa')]?_0xee034b[_0xee88('0xa')]:null;this[_0xee88('0xb')]=_0xee034b[_0xee88('0xb')];this[_0xee88('0xc')]=_0xee034b[_0xee88('0xc')];this[_0xee88('0xd')]=_0xee034b[_0xee88('0xd')]||0x1e;this[_0xee88('0xe')]=_0xee034b[_0xee88('0xe')];this[_0xee88('0xf')]=_0xee034b[_0xee88('0xf')];this[_0xee88('0x10')]=_0xee034b[_0xee88('0x10')];this[_0xee88('0x11')]=_0xee034b[_0xee88('0x11')];this[_0xee88('0x12')]=_0xee034b['dialNoAnswerMaxRetry'];this[_0xee88('0x13')]=_0xee034b[_0xee88('0x13')];this['dialGlobalMaxRetry']=_0xee034b[_0xee88('0x14')];this[_0xee88('0x15')]=_0xee034b[_0xee88('0x15')]||0x3;this[_0xee88('0x16')]=_0xee034b[_0xee88('0x16')]||0x96;this[_0xee88('0x17')]=_0xee034b[_0xee88('0x17')]||0x3;this[_0xee88('0x18')]=_0xee034b['dialDropRetryFrequency']||0x96;this[_0xee88('0x19')]=_0xee034b[_0xee88('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0xee034b['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0xee034b[_0xee88('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0xee034b[_0xee88('0x1b')]||0x96;this[_0xee88('0x1c')]=_0xee034b[_0xee88('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0xee034b['dialAgentRejectRetryFrequency']||0x96;this[_0xee88('0x1d')]=_0xee034b[_0xee88('0x1d')]||_0xee88('0x1e');this[_0xee88('0x1f')]=_0xee034b[_0xee88('0x1f')]||undefined;this[_0xee88('0x20')]=_0xee034b[_0xee88('0x20')]||undefined;this[_0xee88('0x21')]=_0xee034b[_0xee88('0x21')]||undefined;this['TrunkBackup']=_0xee034b['TrunkBackup']?_0xee034b[_0xee88('0x22')]:undefined;this[_0xee88('0x23')]=_0xee034b[_0xee88('0x23')]?_0xee034b[_0xee88('0x23')]:undefined;this[_0xee88('0x24')]=_0xee034b[_0xee88('0x24')]?_0xee034b[_0xee88('0x24')]:undefined;this['SquareProject']=_0xee034b[_0xee88('0x25')]?_0xee034b[_0xee88('0x25')]:undefined;this[_0xee88('0x26')]=_0xee034b[_0xee88('0x25')]?_0xee034b[_0xee88('0x25')][_0xee88('0x0')]:undefined;this[_0xee88('0x27')]=_0xee034b[_0xee88('0x27')]||![];this[_0xee88('0x28')]=_0xee034b[_0xee88('0x28')];this[_0xee88('0x29')]=_0xee034b[_0xee88('0x29')];this[_0xee88('0x2a')]=_0xee034b[_0xee88('0x2a')];this[_0xee88('0x2b')]=_0xee034b[_0xee88('0x2b')];this['dialAMDMinWordLength']=_0xee034b[_0xee88('0x2c')];this[_0xee88('0x2d')]=_0xee034b[_0xee88('0x2d')];this[_0xee88('0x2e')]=_0xee034b[_0xee88('0x2e')];this[_0xee88('0x2f')]=_0xee034b['dialAMDSilenceThreshold'];this[_0xee88('0x30')]=_0xee034b[_0xee88('0x30')];}module[_0xee88('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 5fa2ba1..470f9be 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 _0xc285=['answertime','endtime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferType','starttime','channel','calleridnum','connectedlinenum','accountcode','context','linkedid','exten','answered'];(function(_0x1b7393,_0x18fa10){var _0x57c693=function(_0x29b4a2){while(--_0x29b4a2){_0x1b7393['push'](_0x1b7393['shift']());}};_0x57c693(++_0x18fa10);}(_0xc285,0xd8));var _0x5c28=function(_0x510b08,_0x16cd04){_0x510b08=_0x510b08-0x0;var _0xbf9488=_0xc285[_0x510b08];return _0xbf9488;};'use strict';function Channel(){this[_0x5c28('0x0')]=null;this[_0x5c28('0x1')]='';this['destinationchannel']='';this[_0x5c28('0x2')]=0x0;this['calleridname']='';this[_0x5c28('0x3')]=undefined;this['connectedlinename']=undefined;this[_0x5c28('0x4')]=0x0;this[_0x5c28('0x5')]='';this['uniqueid']=0x0;this[_0x5c28('0x6')]=0x0;this[_0x5c28('0x7')]=0x0;this[_0x5c28('0x8')]=![];this[_0x5c28('0x9')]=null;this[_0x5c28('0xa')]=null;this[_0x5c28('0xb')]=![];this[_0x5c28('0xc')]=![];this['lastapplication']='';this[_0x5c28('0xd')]='';this[_0x5c28('0xe')]=0x0;this[_0x5c28('0xf')]=0x0;this[_0x5c28('0x10')]=0x0;this[_0x5c28('0x11')]=null;this['tag']=null;this[_0x5c28('0x12')]=null;this[_0x5c28('0x13')]=![];this[_0x5c28('0x14')]=null;this[_0x5c28('0x15')]=null;this[_0x5c28('0x16')]=[];this[_0x5c28('0x17')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x5c28('0x18')]=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x53d1=['unmanaged','lastapplication','duration','billableseconds','type','tag','disposition','monitorFilename','queue','monitors','transfercalleridnum','exports','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answertime','endtime'];(function(_0x1fe768,_0x12272f){var _0xba6b6d=function(_0x5bc185){while(--_0x5bc185){_0x1fe768['push'](_0x1fe768['shift']());}};_0xba6b6d(++_0x12272f);}(_0x53d1,0x174));var _0x153d=function(_0x248286,_0x5a8646){_0x248286=_0x248286-0x0;var _0x10f392=_0x53d1[_0x248286];return _0x10f392;};'use strict';function Channel(){this[_0x153d('0x0')]=null;this[_0x153d('0x1')]='';this['destinationchannel']='';this[_0x153d('0x2')]=0x0;this[_0x153d('0x3')]='';this[_0x153d('0x4')]=undefined;this[_0x153d('0x5')]=undefined;this[_0x153d('0x6')]=0x0;this['context']='';this[_0x153d('0x7')]=0x0;this[_0x153d('0x8')]=0x0;this[_0x153d('0x9')]=0x0;this['answered']=![];this[_0x153d('0xa')]=null;this[_0x153d('0xb')]=null;this[_0x153d('0xc')]=![];this['abandoned']=![];this[_0x153d('0xd')]='';this['lastdata']='';this[_0x153d('0xe')]=0x0;this[_0x153d('0xf')]=0x0;this['holdtime']=0x0;this[_0x153d('0x10')]=null;this[_0x153d('0x11')]=null;this[_0x153d('0x12')]=null;this['monitor']=![];this[_0x153d('0x13')]=null;this[_0x153d('0x14')]=null;this[_0x153d('0x15')]=[];this[_0x153d('0x16')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0x153d('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 04036c6..33f57c0 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 _0x2208=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x2d0e81,_0xdea883){var _0x106b68=function(_0x39586f){while(--_0x39586f){_0x2d0e81['push'](_0x2d0e81['shift']());}};_0x106b68(++_0xdea883);}(_0x2208,0x11e));var _0x8220=function(_0x456eae,_0x4290c3){_0x456eae=_0x456eae-0x0;var _0x49f4b1=_0x2208[_0x456eae];return _0x49f4b1;};'use strict';function DeskAccount(_0x363741){this['id']=_0x363741['id']||0x0;this[_0x8220('0x0')]=_0x363741['name']||'';this[_0x8220('0x1')]=_0x363741['username']||'';this[_0x8220('0x2')]=_0x363741[_0x8220('0x2')]||'';this[_0x8220('0x3')]=_0x363741[_0x8220('0x3')]||'';this[_0x8220('0x4')]=_0x363741[_0x8220('0x4')]||'';this['consumerKey']=_0x363741[_0x8220('0x5')]||'';this['consumerSecret']=_0x363741[_0x8220('0x6')]||'';this[_0x8220('0x7')]=_0x363741[_0x8220('0x7')]||'';this[_0x8220('0x8')]=_0x363741[_0x8220('0x8')]||'';this[_0x8220('0x9')]=_0x363741['type']||'';this[_0x8220('0xa')]=_0x363741[_0x8220('0xa')]||'';this['Configurations']=_0x363741[_0x8220('0xb')]||{};}module[_0x8220('0xc')]=DeskAccount; \ No newline at end of file +var _0x3eea=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','token','tokenSecret','type','serverUrl'];(function(_0x3f46b0,_0x7a813a){var _0x2873fe=function(_0x46194c){while(--_0x46194c){_0x3f46b0['push'](_0x3f46b0['shift']());}};_0x2873fe(++_0x7a813a);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x58e3aa,_0x3eec90){_0x58e3aa=_0x58e3aa-0x0;var _0x476147=_0x3eea[_0x58e3aa];return _0x476147;};'use strict';function DeskAccount(_0xd20a35){this['id']=_0xd20a35['id']||0x0;this['name']=_0xd20a35[_0xa3ee('0x0')]||'';this[_0xa3ee('0x1')]=_0xd20a35[_0xa3ee('0x1')]||'';this[_0xa3ee('0x2')]=_0xd20a35[_0xa3ee('0x2')]||'';this[_0xa3ee('0x3')]=_0xd20a35[_0xa3ee('0x3')]||'';this[_0xa3ee('0x4')]=_0xd20a35[_0xa3ee('0x4')]||'';this[_0xa3ee('0x5')]=_0xd20a35[_0xa3ee('0x5')]||'';this['consumerSecret']=_0xd20a35['consumerSecret']||'';this[_0xa3ee('0x6')]=_0xd20a35['token']||'';this[_0xa3ee('0x7')]=_0xd20a35['tokenSecret']||'';this[_0xa3ee('0x8')]=_0xd20a35['type']||'';this[_0xa3ee('0x9')]=_0xd20a35['serverUrl']||'';this[_0xa3ee('0xa')]=_0xd20a35[_0xa3ee('0xa')]||{};}module[_0xa3ee('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 57f3df6..b00a32a 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 _0xbc83=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0x2ff9a,_0x4d2e32){var _0xb3382f=function(_0x2913f0){while(--_0x2913f0){_0x2ff9a['push'](_0x2ff9a['shift']());}};_0xb3382f(++_0x4d2e32);}(_0xbc83,0x141));var _0x3bc8=function(_0x497c39,_0xd7ed5c){_0x497c39=_0x497c39-0x0;var _0x1ac5ba=_0xbc83[_0x497c39];return _0x1ac5ba;};'use strict';function Dynamics365Account(_0x3c5177){this['id']=_0x3c5177['id']||0x0;this[_0x3bc8('0x0')]=_0x3c5177[_0x3bc8('0x0')]||'';this[_0x3bc8('0x1')]=_0x3c5177[_0x3bc8('0x1')]||'';this[_0x3bc8('0x2')]=_0x3c5177[_0x3bc8('0x2')]||'';this[_0x3bc8('0x3')]=_0x3c5177[_0x3bc8('0x3')]||'';this['tenantId']=_0x3c5177[_0x3bc8('0x4')]||'';this[_0x3bc8('0x5')]=_0x3c5177[_0x3bc8('0x5')]||'';this[_0x3bc8('0x6')]=_0x3c5177[_0x3bc8('0x6')]||{};this[_0x3bc8('0x7')]=_0x3c5177['serverUrl']||'';this[_0x3bc8('0x8')]=_0x3c5177[_0x3bc8('0x8')]||{};}module[_0x3bc8('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xf3e5=['Configurations','name','username','password','remoteUri','tenantId','clientSecret','serverUrl'];(function(_0x2ec3a7,_0x1d5993){var _0x507f82=function(_0x5ce431){while(--_0x5ce431){_0x2ec3a7['push'](_0x2ec3a7['shift']());}};_0x507f82(++_0x1d5993);}(_0xf3e5,0x189));var _0x5f3e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xf3e5[_0x3054be];return _0x3df150;};'use strict';function Dynamics365Account(_0x37a143){this['id']=_0x37a143['id']||0x0;this[_0x5f3e('0x0')]=_0x37a143['name']||'';this['username']=_0x37a143[_0x5f3e('0x1')]||'';this['password']=_0x37a143[_0x5f3e('0x2')]||'';this[_0x5f3e('0x3')]=_0x37a143[_0x5f3e('0x3')]||'';this[_0x5f3e('0x4')]=_0x37a143['tenantId']||'';this['clientId']=_0x37a143['clientId']||'';this[_0x5f3e('0x5')]=_0x37a143[_0x5f3e('0x5')]||{};this[_0x5f3e('0x6')]=_0x37a143[_0x5f3e('0x6')]||'';this[_0x5f3e('0x7')]=_0x37a143[_0x5f3e('0x7')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 6cfd647..0754662 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 _0x15b6=['localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo'];(function(_0x3b0da2,_0x306d66){var _0x45a240=function(_0x557598){while(--_0x557598){_0x3b0da2['push'](_0x3b0da2['shift']());}};_0x45a240(++_0x306d66);}(_0x15b6,0x161));var _0x615b=function(_0x489f97,_0x2ab3df){_0x489f97=_0x489f97-0x0;var _0x5eed2d=_0x15b6[_0x489f97];return _0x5eed2d;};'use strict';function FaxAccount(_0x2224a4){this['id']=_0x2224a4['id']||0x0;this[_0x615b('0x0')]=_0x2224a4['name']||'';this[_0x615b('0x1')]=_0x2224a4[_0x615b('0x1')];this['ecm']=_0x2224a4[_0x615b('0x2')];this[_0x615b('0x3')]=_0x2224a4[_0x615b('0x3')];this['localstationid']=_0x2224a4[_0x615b('0x4')];this[_0x615b('0x5')]=_0x2224a4[_0x615b('0x5')]||0x960;this[_0x615b('0x6')]=_0x2224a4[_0x615b('0x6')]||0x3840;this['modem']=_0x2224a4[_0x615b('0x7')]||_0x615b('0x8');this[_0x615b('0x9')]=_0x2224a4[_0x615b('0x9')]||'no';this[_0x615b('0xa')]=_0x2224a4[_0x615b('0xa')]||'no';this['t38timeout']=_0x2224a4[_0x615b('0xb')]||0x1388;this[_0x615b('0xc')]=_0x2224a4[_0x615b('0xc')]||'SIP';this[_0x615b('0xd')]=_0x2224a4['Trunk']?_0x2224a4['Trunk']:undefined;this[_0x615b('0xe')]=_0x2224a4[_0x615b('0xe')];this['key']=_0x2224a4[_0x615b('0xf')];}module[_0x615b('0x10')]=FaxAccount; \ No newline at end of file +var _0xa6ce=['ecm','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description'];(function(_0x359b43,_0x5b108b){var _0x55cbb9=function(_0x38766b){while(--_0x38766b){_0x359b43['push'](_0x359b43['shift']());}};_0x55cbb9(++_0x5b108b);}(_0xa6ce,0x15e));var _0xea6c=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0xa6ce[_0x383356];return _0x32ee5a;};'use strict';function FaxAccount(_0x433da5){this['id']=_0x433da5['id']||0x0;this['name']=_0x433da5[_0xea6c('0x0')]||'';this[_0xea6c('0x1')]=_0x433da5['description'];this[_0xea6c('0x2')]=_0x433da5[_0xea6c('0x2')];this['headerinfo']=_0x433da5['headerinfo'];this[_0xea6c('0x3')]=_0x433da5[_0xea6c('0x3')];this[_0xea6c('0x4')]=_0x433da5[_0xea6c('0x4')]||0x960;this[_0xea6c('0x5')]=_0x433da5[_0xea6c('0x5')]||0x3840;this['modem']=_0x433da5[_0xea6c('0x6')]||_0xea6c('0x7');this[_0xea6c('0x8')]=_0x433da5[_0xea6c('0x8')]||'no';this[_0xea6c('0x9')]=_0x433da5[_0xea6c('0x9')]||'no';this[_0xea6c('0xa')]=_0x433da5[_0xea6c('0xa')]||0x1388;this[_0xea6c('0xb')]=_0x433da5[_0xea6c('0xb')]||_0xea6c('0xc');this[_0xea6c('0xd')]=_0x433da5[_0xea6c('0xd')]?_0x433da5[_0xea6c('0xd')]:undefined;this['ListId']=_0x433da5[_0xea6c('0xe')];this[_0xea6c('0xf')]=_0x433da5[_0xea6c('0xf')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 0f11345..6ef3fd0 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 _0x441c=['exports','name','username','apiKey','serverUrl','Configurations'];(function(_0x155307,_0x1d3556){var _0x4e4c43=function(_0x96cc44){while(--_0x96cc44){_0x155307['push'](_0x155307['shift']());}};_0x4e4c43(++_0x1d3556);}(_0x441c,0x9d));var _0xc441=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x441c[_0x3ab51d];return _0x29a04e;};'use strict';function FreshdeskAccount(_0x5dd257){this['id']=_0x5dd257['id']||0x0;this[_0xc441('0x0')]=_0x5dd257[_0xc441('0x0')]||'';this[_0xc441('0x1')]=_0x5dd257[_0xc441('0x1')]||'';this[_0xc441('0x2')]=_0x5dd257['token']||'';this['remoteUri']=_0x5dd257['remoteUri']||'';this[_0xc441('0x3')]=_0x5dd257[_0xc441('0x3')]||'';this[_0xc441('0x4')]=_0x5dd257['Configurations']||{};}module[_0xc441('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0xbfc8=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x2b4ab5,_0x5c8451){var _0x2acfe5=function(_0x27c52c){while(--_0x27c52c){_0x2b4ab5['push'](_0x2b4ab5['shift']());}};_0x2acfe5(++_0x5c8451);}(_0xbfc8,0x1b2));var _0x8bfc=function(_0x1d75fb,_0x6646e3){_0x1d75fb=_0x1d75fb-0x0;var _0x2332b8=_0xbfc8[_0x1d75fb];return _0x2332b8;};'use strict';function FreshdeskAccount(_0x35b67a){this['id']=_0x35b67a['id']||0x0;this[_0x8bfc('0x0')]=_0x35b67a[_0x8bfc('0x0')]||'';this[_0x8bfc('0x1')]=_0x35b67a[_0x8bfc('0x1')]||'';this[_0x8bfc('0x2')]=_0x35b67a[_0x8bfc('0x3')]||'';this['remoteUri']=_0x35b67a[_0x8bfc('0x4')]||'';this[_0x8bfc('0x5')]=_0x35b67a['serverUrl']||'';this['Configurations']=_0x35b67a[_0x8bfc('0x6')]||{};}module[_0x8bfc('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index cb485e8..c86dbee 100644 --- a/server/services/ami/model/freshsalesAccount.js +++ b/server/services/ami/model/freshsalesAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa849=['Configurations','exports','name','username','apiKey','remoteUri','serverUrl'];(function(_0x58b0d3,_0xc51caf){var _0x2dfe20=function(_0x26c04a){while(--_0x26c04a){_0x58b0d3['push'](_0x58b0d3['shift']());}};_0x2dfe20(++_0xc51caf);}(_0xa849,0x175));var _0x9a84=function(_0x46b15a,_0x737415){_0x46b15a=_0x46b15a-0x0;var _0x123b55=_0xa849[_0x46b15a];return _0x123b55;};'use strict';function FreshsalesAccount(_0xb6ac60){this['id']=_0xb6ac60['id']||0x0;this[_0x9a84('0x0')]=_0xb6ac60[_0x9a84('0x0')]||'';this['username']=_0xb6ac60[_0x9a84('0x1')]||'';this[_0x9a84('0x2')]=_0xb6ac60['token']||'';this[_0x9a84('0x3')]=_0xb6ac60[_0x9a84('0x3')]||'';this[_0x9a84('0x4')]=_0xb6ac60[_0x9a84('0x4')]||'';this[_0x9a84('0x5')]=_0xb6ac60[_0x9a84('0x5')]||{};}module[_0x9a84('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xb337=['serverUrl','Configurations','name','username','apiKey','token','remoteUri'];(function(_0x13ceed,_0xecda6a){var _0x545d11=function(_0x3f40a0){while(--_0x3f40a0){_0x13ceed['push'](_0x13ceed['shift']());}};_0x545d11(++_0xecda6a);}(_0xb337,0x175));var _0x7b33=function(_0x492cf8,_0x10f596){_0x492cf8=_0x492cf8-0x0;var _0x3ab058=_0xb337[_0x492cf8];return _0x3ab058;};'use strict';function FreshsalesAccount(_0x5a7320){this['id']=_0x5a7320['id']||0x0;this[_0x7b33('0x0')]=_0x5a7320['name']||'';this['username']=_0x5a7320[_0x7b33('0x1')]||'';this[_0x7b33('0x2')]=_0x5a7320[_0x7b33('0x3')]||'';this['remoteUri']=_0x5a7320[_0x7b33('0x4')]||'';this[_0x7b33('0x5')]=_0x5a7320['serverUrl']||'';this[_0x7b33('0x6')]=_0x5a7320[_0x7b33('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 5b144af..522e07c 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 _0x3d54=['lastAssignedTo','mohtime','exports','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','exten','priority','holdtime','assigned'];(function(_0x13558e,_0x367585){var _0x44d1a4=function(_0x31e3e3){while(--_0x31e3e3){_0x13558e['push'](_0x13558e['shift']());}};_0x44d1a4(++_0x367585);}(_0x3d54,0x1a3));var _0x43d5=function(_0x2ea384,_0x20e770){_0x2ea384=_0x2ea384-0x0;var _0x4d591e=_0x3d54[_0x2ea384];return _0x4d591e;};'use strict';function QueueReport(){this[_0x43d5('0x0')]='inbound';this[_0x43d5('0x1')]='';this[_0x43d5('0x2')]='';this[_0x43d5('0x3')]='';this[_0x43d5('0x4')]='';this[_0x43d5('0x5')]=null;this[_0x43d5('0x6')]=null;this[_0x43d5('0x7')]=0x1;this['count']=0x1;this[_0x43d5('0x8')]=![];this[_0x43d5('0x9')]=null;this[_0x43d5('0xa')]=![];this[_0x43d5('0xb')]=null;this[_0x43d5('0xc')]=![];this[_0x43d5('0xd')]=null;this[_0x43d5('0xe')]=0x1;this[_0x43d5('0xf')]='';this[_0x43d5('0x10')]='';this[_0x43d5('0x11')]='';this[_0x43d5('0x12')]='';this['context']='';this[_0x43d5('0x13')]='';this[_0x43d5('0x14')]='';this[_0x43d5('0x15')]=0x0;this[_0x43d5('0x16')]=![];this[_0x43d5('0x17')]='';this[_0x43d5('0x18')]=0x0;this['variables']={};}module[_0x43d5('0x19')]=QueueReport; \ No newline at end of file +var _0x9a11=['lastAssignedTo','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','priority','assigned'];(function(_0x37da19,_0x24b966){var _0x47f0cb=function(_0x5763eb){while(--_0x5763eb){_0x37da19['push'](_0x37da19['shift']());}};_0x47f0cb(++_0x24b966);}(_0x9a11,0x122));var _0x19a1=function(_0x1fefe8,_0x3422b8){_0x1fefe8=_0x1fefe8-0x0;var _0x2ab965=_0x9a11[_0x1fefe8];return _0x2ab965;};'use strict';function QueueReport(){this[_0x19a1('0x0')]=_0x19a1('0x1');this[_0x19a1('0x2')]='';this[_0x19a1('0x3')]='';this[_0x19a1('0x4')]='';this[_0x19a1('0x5')]='';this[_0x19a1('0x6')]=null;this['queuecallerleaveAt']=null;this[_0x19a1('0x7')]=0x1;this[_0x19a1('0x8')]=0x1;this[_0x19a1('0x9')]=![];this[_0x19a1('0xa')]=null;this['queuecallercomplete']=![];this[_0x19a1('0xb')]=null;this[_0x19a1('0xc')]=![];this[_0x19a1('0xd')]=null;this[_0x19a1('0xe')]=0x1;this[_0x19a1('0xf')]='';this[_0x19a1('0x10')]='';this[_0x19a1('0x11')]='';this[_0x19a1('0x12')]='';this[_0x19a1('0x13')]='';this['exten']='';this[_0x19a1('0x14')]='';this['holdtime']=0x0;this[_0x19a1('0x15')]=![];this[_0x19a1('0x16')]='';this['mohtime']=0x0;this['variables']={};}module[_0x19a1('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 25c2c31..8968e66 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 _0x6163=['clientSecret','securityToken','type','integrationTab','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x1696f3,_0x3c3eac){var _0x5a8bee=function(_0x5744ba){while(--_0x5744ba){_0x1696f3['push'](_0x1696f3['shift']());}};_0x5a8bee(++_0x3c3eac);}(_0x6163,0xed));var _0x3616=function(_0x4ea503,_0xde7a49){_0x4ea503=_0x4ea503-0x0;var _0x2d9b72=_0x6163[_0x4ea503];return _0x2d9b72;};'use strict';function SalesforceAccount(_0x36db90){this['id']=_0x36db90['id']||0x0;this[_0x3616('0x0')]=_0x36db90[_0x3616('0x0')]||'';this[_0x3616('0x1')]=_0x36db90['username']||'';this['remoteUri']=_0x36db90[_0x3616('0x2')]||'';this[_0x3616('0x3')]=_0x36db90['password']||'';this[_0x3616('0x4')]=_0x36db90[_0x3616('0x4')]||'';this[_0x3616('0x5')]=_0x36db90[_0x3616('0x5')]||'';this[_0x3616('0x6')]=_0x36db90['securityToken']||'';this[_0x3616('0x7')]=_0x36db90[_0x3616('0x7')]||_0x3616('0x8');this['serverUrl']=_0x36db90['serverUrl']||'';this[_0x3616('0x9')]=_0x36db90[_0x3616('0x9')]||{};}module[_0x3616('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x4add=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','username'];(function(_0x56a0fe,_0x117eba){var _0x1d46f1=function(_0x2a7dae){while(--_0x2a7dae){_0x56a0fe['push'](_0x56a0fe['shift']());}};_0x1d46f1(++_0x117eba);}(_0x4add,0x153));var _0xd4ad=function(_0x2276f4,_0x21912b){_0x2276f4=_0x2276f4-0x0;var _0x285e38=_0x4add[_0x2276f4];return _0x285e38;};'use strict';function SalesforceAccount(_0x576959){this['id']=_0x576959['id']||0x0;this['name']=_0x576959[_0xd4ad('0x0')]||'';this[_0xd4ad('0x1')]=_0x576959['username']||'';this[_0xd4ad('0x2')]=_0x576959[_0xd4ad('0x2')]||'';this[_0xd4ad('0x3')]=_0x576959[_0xd4ad('0x3')]||'';this[_0xd4ad('0x4')]=_0x576959[_0xd4ad('0x4')]||'';this[_0xd4ad('0x5')]=_0x576959[_0xd4ad('0x5')]||'';this[_0xd4ad('0x6')]=_0x576959[_0xd4ad('0x6')]||'';this[_0xd4ad('0x7')]=_0x576959[_0xd4ad('0x7')]||_0xd4ad('0x8');this[_0xd4ad('0x9')]=_0x576959[_0xd4ad('0x9')]||'';this['Configurations']=_0x576959[_0xd4ad('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index dbf8d61..e7f5c3c 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 _0xf896=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x5978e1,_0x29bc6c){var _0x58b08e=function(_0x130548){while(--_0x130548){_0x5978e1['push'](_0x5978e1['shift']());}};_0x58b08e(++_0x29bc6c);}(_0xf896,0x88));var _0x6f89=function(_0x27604f,_0x5ae336){_0x27604f=_0x27604f-0x0;var _0x40d189=_0xf896[_0x27604f];return _0x40d189;};'use strict';function ServicenowAccount(_0x1adb8b){this['id']=_0x1adb8b['id']||0x0;this[_0x6f89('0x0')]=_0x1adb8b[_0x6f89('0x0')]||'';this[_0x6f89('0x1')]=_0x1adb8b[_0x6f89('0x1')]||'';this['password']=_0x1adb8b[_0x6f89('0x2')]||'';this[_0x6f89('0x3')]=_0x1adb8b[_0x6f89('0x3')]||'';this[_0x6f89('0x4')]=_0x1adb8b[_0x6f89('0x4')]||'';this[_0x6f89('0x5')]=_0x1adb8b[_0x6f89('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xe3a9=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x241c04,_0x321135){var _0x1828ea=function(_0x803eba){while(--_0x803eba){_0x241c04['push'](_0x241c04['shift']());}};_0x1828ea(++_0x321135);}(_0xe3a9,0x128));var _0x9e3a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe3a9[_0x3dd15e];return _0x231fd0;};'use strict';function ServicenowAccount(_0x336376){this['id']=_0x336376['id']||0x0;this[_0x9e3a('0x0')]=_0x336376['name']||'';this[_0x9e3a('0x1')]=_0x336376['username']||'';this[_0x9e3a('0x2')]=_0x336376[_0x9e3a('0x2')]||'';this[_0x9e3a('0x3')]=_0x336376[_0x9e3a('0x3')]||'';this[_0x9e3a('0x4')]=_0x336376[_0x9e3a('0x4')]||'';this[_0x9e3a('0x5')]=_0x336376[_0x9e3a('0x5')]||{};}module[_0x9e3a('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 2acaff8..f872959 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 _0x5d5d=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x144277,_0x3fce09){var _0x3ea5c4=function(_0x2e9518){while(--_0x2e9518){_0x144277['push'](_0x144277['shift']());}};_0x3ea5c4(++_0x3fce09);}(_0x5d5d,0x147));var _0xd5d5=function(_0x211ea4,_0x46761b){_0x211ea4=_0x211ea4-0x0;var _0x5c9e2b=_0x5d5d[_0x211ea4];return _0x5c9e2b;};'use strict';function SugarcrmAccount(_0x46c430){this['id']=_0x46c430['id']||0x0;this[_0xd5d5('0x0')]=_0x46c430[_0xd5d5('0x0')]||'';this[_0xd5d5('0x1')]=_0x46c430[_0xd5d5('0x1')]||'';this[_0xd5d5('0x2')]=_0x46c430[_0xd5d5('0x2')]||'';this[_0xd5d5('0x3')]=_0x46c430[_0xd5d5('0x3')]||'';this['serverUrl']=_0x46c430[_0xd5d5('0x4')]||'';this['Configurations']=_0x46c430[_0xd5d5('0x5')]||{};}module[_0xd5d5('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x05cd=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0xf023c1,_0x2726eb){var _0x5dac5a=function(_0x1e89de){while(--_0x1e89de){_0xf023c1['push'](_0xf023c1['shift']());}};_0x5dac5a(++_0x2726eb);}(_0x05cd,0x1c8));var _0xd05c=function(_0x2175a3,_0x426e08){_0x2175a3=_0x2175a3-0x0;var _0x3d308b=_0x05cd[_0x2175a3];return _0x3d308b;};'use strict';function SugarcrmAccount(_0x4641bf){this['id']=_0x4641bf['id']||0x0;this[_0xd05c('0x0')]=_0x4641bf[_0xd05c('0x0')]||'';this['username']=_0x4641bf[_0xd05c('0x1')]||'';this[_0xd05c('0x2')]=_0x4641bf[_0xd05c('0x2')]||'';this[_0xd05c('0x3')]=_0x4641bf[_0xd05c('0x3')]||'';this[_0xd05c('0x4')]=_0x4641bf['serverUrl']||'';this['Configurations']=_0x4641bf[_0xd05c('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index be4a440..e10f959 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 _0x395e=['name','accountcode','state','unknown','stateTime','exports'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x395e,0x1da));var _0xe395=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x395e[_0x3947c9];return _0x2e7871;};'use strict';function Telephone(_0x577051){this['id']=_0x577051['id']||0x0;this[_0xe395('0x0')]=_0x577051[_0xe395('0x0')]||'';this['accountcode']=_0x577051[_0xe395('0x1')]||'';this[_0xe395('0x2')]=_0xe395('0x3');this[_0xe395('0x4')]=0x0;this['status']=_0xe395('0x3');this['address']='';}module[_0xe395('0x5')]=Telephone; \ No newline at end of file +var _0xd0d3=['status','address','name','accountcode','state','unknown','stateTime'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd0d3,0x175));var _0x3d0d=function(_0x548b35,_0x13e9ce){_0x548b35=_0x548b35-0x0;var _0x2089a6=_0xd0d3[_0x548b35];return _0x2089a6;};'use strict';function Telephone(_0x4c72cc){this['id']=_0x4c72cc['id']||0x0;this[_0x3d0d('0x0')]=_0x4c72cc[_0x3d0d('0x0')]||'';this[_0x3d0d('0x1')]=_0x4c72cc['accountcode']||'';this[_0x3d0d('0x2')]=_0x3d0d('0x3');this[_0x3d0d('0x4')]=0x0;this[_0x3d0d('0x5')]=_0x3d0d('0x3');this[_0x3d0d('0x6')]='';}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 2090d90..3fca31b 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 _0xb3ad=['name','exports'];(function(_0x2af504,_0x46a924){var _0x2abb2e=function(_0x53f705){while(--_0x53f705){_0x2af504['push'](_0x2af504['shift']());}};_0x2abb2e(++_0x46a924);}(_0xb3ad,0x110));var _0xdb3a=function(_0x429bca,_0x2e730f){_0x429bca=_0x429bca-0x0;var _0x24b9e4=_0xb3ad[_0x429bca];return _0x24b9e4;};'use strict';function template(_0x2c9c0f){this['id']=_0x2c9c0f['id']||0x0;this[_0xdb3a('0x0')]=_0x2c9c0f[_0xdb3a('0x0')]||'';this['html']=_0x2c9c0f['html']||'';}module[_0xdb3a('0x1')]=template; \ No newline at end of file +var _0x5455=['html','exports','name'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5455,0x197));var _0x5545=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x5455[_0x8c43de];return _0xa6591b;};'use strict';function template(_0x46c43f){this['id']=_0x46c43f['id']||0x0;this[_0x5545('0x0')]=_0x46c43f[_0x5545('0x0')]||'';this[_0x5545('0x1')]=_0x46c43f[_0x5545('0x1')]||'';}module[_0x5545('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 db6d98c..ad150f3 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 _0x54ef=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x5303c9,_0x4211a0){var _0x3eb748=function(_0x59dd95){while(--_0x59dd95){_0x5303c9['push'](_0x5303c9['shift']());}};_0x3eb748(++_0x4211a0);}(_0x54ef,0x112));var _0xf54e=function(_0x27c40f,_0x29543e){_0x27c40f=_0x27c40f-0x0;var _0x25895e=_0x54ef[_0x27c40f];return _0x25895e;};'use strict';function Trigger(_0x19d4d5){this['id']=_0x19d4d5['id']||0x0;this[_0xf54e('0x0')]=_0x19d4d5[_0xf54e('0x0')]||'';this['channel']=_0x19d4d5[_0xf54e('0x1')]||_0xf54e('0x2');this[_0xf54e('0x3')]=_0x19d4d5[_0xf54e('0x3')]||![];this[_0xf54e('0x4')]=_0x19d4d5[_0xf54e('0x4')]||[];this[_0xf54e('0x5')]=_0x19d4d5['AnyConditions']||[];this['Actions']=_0x19d4d5[_0xf54e('0x6')]||[];}module[_0xf54e('0x7')]=Trigger; \ No newline at end of file +var _0x55ca=['name','voice','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x55ca,0x126));var _0xa55c=function(_0x9cbfe0,_0x56aada){_0x9cbfe0=_0x9cbfe0-0x0;var _0x1f1534=_0x55ca[_0x9cbfe0];return _0x1f1534;};'use strict';function Trigger(_0x53d0d7){this['id']=_0x53d0d7['id']||0x0;this[_0xa55c('0x0')]=_0x53d0d7['name']||'';this['channel']=_0x53d0d7['channel']||_0xa55c('0x1');this[_0xa55c('0x2')]=_0x53d0d7['status']||![];this[_0xa55c('0x3')]=_0x53d0d7[_0xa55c('0x3')]||[];this[_0xa55c('0x4')]=_0x53d0d7[_0xa55c('0x4')]||[];this[_0xa55c('0x5')]=_0x53d0d7[_0xa55c('0x5')]||[];}module[_0xa55c('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 de29c09..1fe9896 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 _0x2d53=['state','unknown','stateTime','status','registry','indexOf','split','port','domain','domainport','refresh','stateRegistry','registrationtime','defaultuser','active','name'];(function(_0x57212e,_0x52218d){var _0x20f999=function(_0x2af1ac){while(--_0x2af1ac){_0x57212e['push'](_0x57212e['shift']());}};_0x20f999(++_0x52218d);}(_0x2d53,0xae));var _0x32d5=function(_0x4a8b72,_0xb54e90){_0x4a8b72=_0x4a8b72-0x0;var _0x217237=_0x2d53[_0x4a8b72];return _0x217237;};'use strict';function Trunk(_0x1a9992){this['id']=_0x1a9992['id']||0x0;this[_0x32d5('0x0')]=_0x1a9992[_0x32d5('0x0')]||![];this[_0x32d5('0x1')]=_0x1a9992[_0x32d5('0x1')]||'';this[_0x32d5('0x2')]=_0x32d5('0x3');this[_0x32d5('0x4')]=0x0;this[_0x32d5('0x5')]=_0x32d5('0x3');this[_0x32d5('0x6')]=_0x1a9992[_0x32d5('0x6')]&&_0x1a9992[_0x32d5('0x6')][_0x32d5('0x7')](':')?_0x1a9992[_0x32d5('0x6')][_0x32d5('0x8')](':')[0x0]:'';this['host']='';this[_0x32d5('0x9')]='';this[_0x32d5('0xa')]='';this[_0x32d5('0xb')]='';this[_0x32d5('0xc')]='';this[_0x32d5('0xd')]='unknown';this[_0x32d5('0xe')]='';this['address']='';this[_0x32d5('0xf')]=_0x1a9992[_0x32d5('0xf')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0xcba2=['host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','indexOf'];(function(_0xb5f126,_0x258eda){var _0x4a851a=function(_0x446f7f){while(--_0x446f7f){_0xb5f126['push'](_0xb5f126['shift']());}};_0x4a851a(++_0x258eda);}(_0xcba2,0x118));var _0x2cba=function(_0x5b4f0f,_0x419771){_0x5b4f0f=_0x5b4f0f-0x0;var _0x826688=_0xcba2[_0x5b4f0f];return _0x826688;};'use strict';function Trunk(_0x2b144a){this['id']=_0x2b144a['id']||0x0;this['active']=_0x2b144a[_0x2cba('0x0')]||![];this[_0x2cba('0x1')]=_0x2b144a['name']||'';this[_0x2cba('0x2')]=_0x2cba('0x3');this[_0x2cba('0x4')]=0x0;this[_0x2cba('0x5')]='unknown';this[_0x2cba('0x6')]=_0x2b144a['registry']&&_0x2b144a['registry'][_0x2cba('0x7')](':')?_0x2b144a[_0x2cba('0x6')]['split'](':')[0x0]:'';this[_0x2cba('0x8')]='';this[_0x2cba('0x9')]='';this[_0x2cba('0xa')]='';this[_0x2cba('0xb')]='';this[_0x2cba('0xc')]='';this[_0x2cba('0xd')]='unknown';this[_0x2cba('0xe')]='';this[_0x2cba('0xf')]='';this['defaultuser']=_0x2b144a[_0x2cba('0x10')]||'';}module[_0x2cba('0x11')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 349c787..64aefb8 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 _0x8c3e=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0xf22dce,_0x46f799){var _0x55c4ba=function(_0xc09efa){while(--_0xc09efa){_0xf22dce['push'](_0xf22dce['shift']());}};_0x55c4ba(++_0x46f799);}(_0x8c3e,0xdf));var _0xe8c3=function(_0x8290f1,_0x1ab791){_0x8290f1=_0x8290f1-0x0;var _0xd8bfcc=_0x8c3e[_0x8290f1];return _0xd8bfcc;};'use strict';function voiceExtension(_0x1629a5){this['id']=_0x1629a5['id']||0x0;this[_0xe8c3('0x0')]=_0x1629a5[_0xe8c3('0x0')]||'';this['recordingFormat']=_0x1629a5[_0xe8c3('0x1')]||'none';this[_0xe8c3('0x2')]=_0x1629a5['mandatoryDisposition']||![];}module[_0xe8c3('0x3')]=voiceExtension; \ No newline at end of file +'use strict';function voiceExtension(_0x941855){this['id']=_0x941855['id']||0x0;this['exten']=_0x941855['exten']||'';this['recordingFormat']=_0x941855['recordingFormat']||'none';this['mandatoryDisposition']=_0x941855['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index b40310c..7b8789c 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 _0x5f2f=['wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','answered','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse'];(function(_0x2976e2,_0x5197f1){var _0x2b1d46=function(_0x5bd539){while(--_0x5bd539){_0x2976e2['push'](_0x2976e2['shift']());}};_0x2b1d46(++_0x5197f1);}(_0x5f2f,0x73));var _0xf5f2=function(_0xe8ea96,_0x19030d){_0xe8ea96=_0xe8ea96-0x0;var _0x44e664=_0x5f2f[_0xe8ea96];return _0x44e664;};'use strict';var statusDesc=[_0xf5f2('0x0'),_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3'),_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),_0xf5f2('0x7'),'onhold'];var monitorFormat={'wav':'wav','wav49':_0xf5f2('0x8'),'gsm':_0xf5f2('0x9')};var strategy={'rrmemory':_0xf5f2('0xa'),'roundrobin':_0xf5f2('0xb')};function VoiceQueue(_0x3133bc){this['id']=_0x3133bc['id']||0x0;this[_0xf5f2('0xc')]=_0x3133bc['name']||'';this[_0xf5f2('0xd')]=_0x3133bc[_0xf5f2('0xd')]||'';this[_0xf5f2('0xe')]=_0x3133bc['type']||_0xf5f2('0xf');this[_0xf5f2('0x10')]=0x0;this[_0xf5f2('0x11')]=0x0;this['total']=0x0;this[_0xf5f2('0x12')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0xf5f2('0x13')]=0x0;this[_0xf5f2('0x14')]=0x0;this['abandoned']=0x0;this[_0xf5f2('0x15')]=0x0;this[_0xf5f2('0x16')]=0x0;this[_0xf5f2('0x17')]=_0x3133bc[_0xf5f2('0x17')]||![];this[_0xf5f2('0x18')]=_0x3133bc[_0xf5f2('0x18')]||0xa;this['autopause']=_0x3133bc[_0xf5f2('0x19')]||'no';this[_0xf5f2('0x1a')]=!![];this[_0xf5f2('0x1b')]='';this[_0xf5f2('0x1c')]=0x0;this[_0xf5f2('0x1d')]=0x0;this['dialTimezone']=_0x3133bc[_0xf5f2('0x1e')]||null;this[_0xf5f2('0x1f')]=_0x3133bc[_0xf5f2('0x1f')]?_0x3133bc[_0xf5f2('0x1f')]:null;this[_0xf5f2('0x20')]=_0x3133bc[_0xf5f2('0x20')];this[_0xf5f2('0x21')]=_0x3133bc[_0xf5f2('0x21')]||_0xf5f2('0x22');this[_0xf5f2('0x23')]=_0x3133bc[_0xf5f2('0x23')]||0x0;this[_0xf5f2('0x24')]=_0x3133bc[_0xf5f2('0x24')]||0x0;this[_0xf5f2('0x25')]=_0x3133bc[_0xf5f2('0x25')]||0x1;this[_0xf5f2('0x26')]=_0x3133bc[_0xf5f2('0x26')]||'dropRate';this[_0xf5f2('0x27')]=_0x3133bc[_0xf5f2('0x27')]||0.03;this['dialPredictiveInterval']=_0x3133bc['dialPredictiveInterval']||0x258;this[_0xf5f2('0x28')]=_0x3133bc[_0xf5f2('0x28')]||'anonymous';this[_0xf5f2('0x29')]=_0x3133bc[_0xf5f2('0x29')]||_0xf5f2('0x2a');this[_0xf5f2('0x2b')]=_0x3133bc[_0xf5f2('0x2b')]||0x1e;this['dialQueueOptions']=_0x3133bc[_0xf5f2('0x2c')]||_0xf5f2('0x2d');this[_0xf5f2('0x2e')]=_0x3133bc[_0xf5f2('0x2e')]||0x3;this[_0xf5f2('0x2f')]=_0x3133bc['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x3133bc[_0xf5f2('0x30')]||0x3;this[_0xf5f2('0x31')]=_0x3133bc[_0xf5f2('0x31')]||0x96;this[_0xf5f2('0x32')]=_0x3133bc[_0xf5f2('0x32')]||0x3;this[_0xf5f2('0x33')]=_0x3133bc[_0xf5f2('0x33')]||0x96;this[_0xf5f2('0x34')]=_0x3133bc[_0xf5f2('0x34')]||0x3;this['dialNoAnswerRetryFrequency']=_0x3133bc[_0xf5f2('0x35')]||0x96;this[_0xf5f2('0x36')]=_0x3133bc[_0xf5f2('0x36')]||0x3;this[_0xf5f2('0x37')]=_0x3133bc[_0xf5f2('0x37')]||0x96;this[_0xf5f2('0x38')]=_0x3133bc['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x3133bc[_0xf5f2('0x39')]||0x96;this[_0xf5f2('0x3a')]=_0x3133bc[_0xf5f2('0x3a')]||0x3;this['dialAbandonedRetryFrequency']=_0x3133bc['dialAbandonedRetryFrequency']||0x96;this[_0xf5f2('0x3b')]=_0x3133bc[_0xf5f2('0x3b')]||0x3;this[_0xf5f2('0x3c')]=_0x3133bc[_0xf5f2('0x3c')]||0x96;this[_0xf5f2('0x3d')]=_0x3133bc['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x3133bc[_0xf5f2('0x3e')]||0x96;this['callAdditionalPhoneAfterMin']=_0x3133bc[_0xf5f2('0x3f')]||0x3;this['dialGlobalMaxRetry']=_0x3133bc[_0xf5f2('0x40')]||0x4;this[_0xf5f2('0x41')]=_0x3133bc[_0xf5f2('0x41')]?_0x3133bc[_0xf5f2('0x41')]:undefined;this[_0xf5f2('0x42')]=_0x3133bc[_0xf5f2('0x42')]?_0x3133bc[_0xf5f2('0x42')]:undefined;this[_0xf5f2('0x43')]=_0x3133bc['dialPrefix']||undefined;this[_0xf5f2('0x44')]=_0x3133bc[_0xf5f2('0x44')]?_0x3133bc[_0xf5f2('0x44')]:undefined;this[_0xf5f2('0x45')]=_0x3133bc[_0xf5f2('0x45')]||_0xf5f2('0x46');this[_0xf5f2('0x47')]=_0x3133bc['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xf5f2('0x48')]=_0x3133bc[_0xf5f2('0x48')]||undefined;this['strategy']=strategy[_0x3133bc[_0xf5f2('0x49')]]||'rrmemory';this[_0xf5f2('0x4a')]=!![];this[_0xf5f2('0x4b')]=_0x3133bc[_0xf5f2('0x4b')]||![];this[_0xf5f2('0x4c')]=_0x3133bc['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x3133bc[_0xf5f2('0x4d')];this[_0xf5f2('0x4e')]=_0x3133bc[_0xf5f2('0x4e')];this['dialAMDTotalAnalysisTime']=_0x3133bc[_0xf5f2('0x4f')];this['dialAMDMinWordLength']=_0x3133bc[_0xf5f2('0x50')];this['dialAMDBetweenWordsSilence']=_0x3133bc[_0xf5f2('0x51')];this[_0xf5f2('0x52')]=_0x3133bc['dialAMDMaximumNumberOfWords'];this[_0xf5f2('0x53')]=_0x3133bc[_0xf5f2('0x53')];this[_0xf5f2('0x54')]=_0x3133bc[_0xf5f2('0x54')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0xf5f2('0x55')]=_0x3133bc[_0xf5f2('0x55')];this[_0xf5f2('0x56')]=0x0;this[_0xf5f2('0x57')]=0x0;this[_0xf5f2('0x58')]=0x0;this[_0xf5f2('0x59')]=0x0;this[_0xf5f2('0x5a')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xf5f2('0x5b')]=0x0;this[_0xf5f2('0x5c')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xf5f2('0x5d')]=0x0;this[_0xf5f2('0x5e')]=0x0;this[_0xf5f2('0x5f')]=0x0;this[_0xf5f2('0x60')]=0x0;this[_0xf5f2('0x61')]=0x0;this[_0xf5f2('0x62')]=undefined;this[_0xf5f2('0x63')]=undefined;this[_0xf5f2('0x64')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xf5f2('0x65')]=0x0;this[_0xf5f2('0x66')]=0x0;this[_0xf5f2('0x67')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xf5f2('0x68')]=0x0;this[_0xf5f2('0x69')]=0x0;this['predictiveIntervalMaxThreshold']=_0x3133bc[_0xf5f2('0x6a')]||0x14;this[_0xf5f2('0x6b')]=_0x3133bc[_0xf5f2('0x6a')]||0xa;this[_0xf5f2('0x6c')]=0x0;this[_0xf5f2('0x6d')]=0x0;this[_0xf5f2('0x6e')]=0x1;this[_0xf5f2('0x6f')]=0x0;this[_0xf5f2('0x70')]=0x0;this[_0xf5f2('0x71')]=0x0;this[_0xf5f2('0x72')]=0x0;this[_0xf5f2('0x73')]=_0x3133bc[_0xf5f2('0x73')]||0x1e;this[_0xf5f2('0x74')]=_0x3133bc[_0xf5f2('0x74')]||![];this['dialQueueProject2']=_0x3133bc[_0xf5f2('0x75')]||undefined;this['dialAgiAfterHangupClient']=_0x3133bc[_0xf5f2('0x76')]||![];this[_0xf5f2('0x77')]=_0x3133bc[_0xf5f2('0x77')]||![];this[_0xf5f2('0xd')]=monitorFormat[_0x3133bc[_0xf5f2('0xd')]]?monitorFormat[_0x3133bc[_0xf5f2('0xd')]]:undefined;this['mandatoryDisposition']=_0x3133bc[_0xf5f2('0x78')]||![];this[_0xf5f2('0x79')]=_0x3133bc[_0xf5f2('0x79')]?_0x3133bc[_0xf5f2('0x79')]:undefined;}module[_0xf5f2('0x7a')]=VoiceQueue; \ No newline at end of file +var _0x7a54=['dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','invalid','unavailable','ringinuse','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','waiting','talking','answered','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0x74958f,_0x31c9d8){var _0x485474=function(_0x3c868e){while(--_0x3c868e){_0x74958f['push'](_0x74958f['shift']());}};_0x485474(++_0x31c9d8);}(_0x7a54,0x106));var _0x47a5=function(_0x4756e6,_0x548b74){_0x4756e6=_0x4756e6-0x0;var _0x1621d9=_0x7a54[_0x4756e6];return _0x1621d9;};'use strict';var statusDesc=[_0x47a5('0x0'),_0x47a5('0x1'),_0x47a5('0x2'),'busy',_0x47a5('0x3'),_0x47a5('0x4'),'ringing',_0x47a5('0x5'),_0x47a5('0x6')];var monitorFormat={'wav':_0x47a5('0x7'),'wav49':_0x47a5('0x8'),'gsm':_0x47a5('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x47a5('0xa')};function VoiceQueue(_0x59199c){this['id']=_0x59199c['id']||0x0;this[_0x47a5('0xb')]=_0x59199c[_0x47a5('0xb')]||'';this['monitor_format']=_0x59199c[_0x47a5('0xc')]||'';this['type']=_0x59199c['type']||'inbound';this[_0x47a5('0xd')]=0x0;this[_0x47a5('0xe')]=0x0;this['total']=0x0;this[_0x47a5('0xf')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0x47a5('0x10')]=0x0;this[_0x47a5('0x11')]=0x0;this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;this[_0x47a5('0x14')]=0x0;this[_0x47a5('0x15')]=_0x59199c[_0x47a5('0x15')]||![];this['acwTimeout']=_0x59199c[_0x47a5('0x16')]||0xa;this[_0x47a5('0x17')]=_0x59199c[_0x47a5('0x17')]||'no';this[_0x47a5('0x18')]=!![];this[_0x47a5('0x19')]='';this[_0x47a5('0x1a')]=0x0;this[_0x47a5('0x1b')]=0x0;this[_0x47a5('0x1c')]=_0x59199c['dialTimezone']||null;this[_0x47a5('0x1d')]=_0x59199c[_0x47a5('0x1d')]?_0x59199c[_0x47a5('0x1d')]:null;this[_0x47a5('0x1e')]=_0x59199c[_0x47a5('0x1e')];this['dialMethod']=_0x59199c['dialMethod']||_0x47a5('0x1f');this['dialLimitChannel']=_0x59199c['dialLimitChannel']||0x0;this[_0x47a5('0x20')]=_0x59199c[_0x47a5('0x20')]||0x0;this[_0x47a5('0x21')]=_0x59199c[_0x47a5('0x21')]||0x1;this[_0x47a5('0x22')]=_0x59199c[_0x47a5('0x22')]||_0x47a5('0x23');this[_0x47a5('0x24')]=_0x59199c[_0x47a5('0x24')]||0.03;this['dialPredictiveInterval']=_0x59199c[_0x47a5('0x25')]||0x258;this[_0x47a5('0x26')]=_0x59199c['dialOriginateCallerIdName']||_0x47a5('0x27');this[_0x47a5('0x28')]=_0x59199c[_0x47a5('0x28')]||'anonymous';this[_0x47a5('0x29')]=_0x59199c[_0x47a5('0x29')]||0x1e;this[_0x47a5('0x2a')]=_0x59199c[_0x47a5('0x2a')]||'tTxX';this[_0x47a5('0x2b')]=_0x59199c[_0x47a5('0x2b')]||0x3;this['dialQueueProject']=_0x59199c[_0x47a5('0x2c')]||undefined;this[_0x47a5('0x2d')]=_0x59199c[_0x47a5('0x2d')]||0x3;this[_0x47a5('0x2e')]=_0x59199c[_0x47a5('0x2e')]||0x96;this['dialBusyMaxRetry']=_0x59199c['dialBusyMaxRetry']||0x3;this[_0x47a5('0x2f')]=_0x59199c['dialBusyRetryFrequency']||0x96;this[_0x47a5('0x30')]=_0x59199c['dialNoAnswerMaxRetry']||0x3;this[_0x47a5('0x31')]=_0x59199c[_0x47a5('0x31')]||0x96;this[_0x47a5('0x32')]=_0x59199c[_0x47a5('0x32')]||0x3;this[_0x47a5('0x33')]=_0x59199c[_0x47a5('0x33')]||0x96;this[_0x47a5('0x34')]=_0x59199c[_0x47a5('0x34')]||0x3;this[_0x47a5('0x35')]=_0x59199c[_0x47a5('0x35')]||0x96;this[_0x47a5('0x36')]=_0x59199c[_0x47a5('0x36')]||0x3;this[_0x47a5('0x37')]=_0x59199c['dialAbandonedRetryFrequency']||0x96;this[_0x47a5('0x38')]=_0x59199c['dialMachineMaxRetry']||0x3;this[_0x47a5('0x39')]=_0x59199c[_0x47a5('0x39')]||0x96;this[_0x47a5('0x3a')]=_0x59199c['dialAgentRejectMaxRetry']||0x3;this[_0x47a5('0x3b')]=_0x59199c[_0x47a5('0x3b')]||0x96;this[_0x47a5('0x3c')]=_0x59199c[_0x47a5('0x3c')]||0x3;this['dialGlobalMaxRetry']=_0x59199c['dialGlobalMaxRetry']||0x4;this[_0x47a5('0x3d')]=_0x59199c[_0x47a5('0x3d')]?_0x59199c['Trunk']:undefined;this['TrunkBackup']=_0x59199c[_0x47a5('0x3e')]?_0x59199c[_0x47a5('0x3e')]:undefined;this['dialPrefix']=_0x59199c[_0x47a5('0x3f')]||undefined;this['Interval']=_0x59199c[_0x47a5('0x40')]?_0x59199c[_0x47a5('0x40')]:undefined;this['dialOrderByScheduledAt']=_0x59199c['dialOrderByScheduledAt']||_0x47a5('0x41');this['dialRandomLastDigitCallerIdNumber']=_0x59199c[_0x47a5('0x42')]||undefined;this[_0x47a5('0x43')]=_0x59199c[_0x47a5('0x43')]||undefined;this['strategy']=strategy[_0x59199c[_0x47a5('0x44')]]||'rrmemory';this['queueStatusComplete']=!![];this[_0x47a5('0x45')]=_0x59199c['dialAMDActive']||![];this[_0x47a5('0x46')]=_0x59199c['dialAMDInitialSilence'];this[_0x47a5('0x47')]=_0x59199c[_0x47a5('0x47')];this[_0x47a5('0x48')]=_0x59199c[_0x47a5('0x48')];this[_0x47a5('0x49')]=_0x59199c[_0x47a5('0x49')];this[_0x47a5('0x4a')]=_0x59199c[_0x47a5('0x4a')];this[_0x47a5('0x4b')]=_0x59199c['dialAMDBetweenWordsSilence'];this[_0x47a5('0x4c')]=_0x59199c[_0x47a5('0x4c')];this['dialAMDSilenceThreshold']=_0x59199c[_0x47a5('0x4d')];this[_0x47a5('0x4e')]=_0x59199c[_0x47a5('0x4e')];this['outboundRejectCallsDay']=0x0;this[_0x47a5('0x4f')]=0x0;this[_0x47a5('0x50')]=_0x59199c['timeout'];this[_0x47a5('0x51')]=0x0;this[_0x47a5('0x52')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x47a5('0x53')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x47a5('0x54')]=0x0;this[_0x47a5('0x55')]=0x0;this[_0x47a5('0x56')]=0x0;this[_0x47a5('0x57')]=0x0;this[_0x47a5('0x58')]=0x0;this[_0x47a5('0x59')]=0x0;this[_0x47a5('0x5a')]=0x0;this[_0x47a5('0x5b')]=undefined;this[_0x47a5('0x5c')]=undefined;this[_0x47a5('0x5d')]=undefined;this[_0x47a5('0x5e')]=1.05;this[_0x47a5('0x5f')]=0x0;this[_0x47a5('0x60')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x47a5('0x61')]=0x0;this[_0x47a5('0x62')]=0x0;this[_0x47a5('0x63')]=0x0;this[_0x47a5('0x64')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x47a5('0x65')]=_0x59199c['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x59199c['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x47a5('0x66')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x47a5('0x67')]=0x0;this[_0x47a5('0x68')]=0x0;this[_0x47a5('0x69')]=0x0;this['erlangBusyFactor']=0x0;this[_0x47a5('0x6a')]=_0x59199c[_0x47a5('0x6a')]||0x1e;this['dialRecallInQueue']=_0x59199c['dialRecallInQueue']||![];this[_0x47a5('0x6b')]=_0x59199c['dialQueueProject2']||undefined;this[_0x47a5('0x6c')]=_0x59199c[_0x47a5('0x6c')]||![];this[_0x47a5('0x6d')]=_0x59199c[_0x47a5('0x6d')]||![];this[_0x47a5('0xc')]=monitorFormat[_0x59199c[_0x47a5('0xc')]]?monitorFormat[_0x59199c[_0x47a5('0xc')]]:undefined;this[_0x47a5('0x6e')]=_0x59199c[_0x47a5('0x6e')]||![];this[_0x47a5('0x6f')]=_0x59199c[_0x47a5('0x6f')]?_0x59199c[_0x47a5('0x6f')]:undefined;}module[_0x47a5('0x70')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 65df088..93d5773 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 _0x797c=['exports','username','accessKey','serverUrl','Configurations'];(function(_0x21b904,_0x530d5a){var _0x5394fd=function(_0x254422){while(--_0x254422){_0x21b904['push'](_0x21b904['shift']());}};_0x5394fd(++_0x530d5a);}(_0x797c,0x173));var _0xc797=function(_0x54eab6,_0x5e262f){_0x54eab6=_0x54eab6-0x0;var _0x1e7435=_0x797c[_0x54eab6];return _0x1e7435;};'use strict';function VtigerAccount(_0xfbe071){this['id']=_0xfbe071['id']||0x0;this['name']=_0xfbe071['name']||'';this[_0xc797('0x0')]=_0xfbe071['username']||'';this[_0xc797('0x1')]=_0xfbe071['accessKey']||'';this['remoteUri']=_0xfbe071['remoteUri']||'';this[_0xc797('0x2')]=_0xfbe071[_0xc797('0x2')]||'';this[_0xc797('0x3')]=_0xfbe071[_0xc797('0x3')]||{};}module[_0xc797('0x4')]=VtigerAccount; \ No newline at end of file +var _0x7a73=['exports','name','username','accessKey'];(function(_0x94b760,_0x1dbbfe){var _0x5dfb70=function(_0x23f6bd){while(--_0x23f6bd){_0x94b760['push'](_0x94b760['shift']());}};_0x5dfb70(++_0x1dbbfe);}(_0x7a73,0x65));var _0x37a7=function(_0x2a5407,_0x56cf97){_0x2a5407=_0x2a5407-0x0;var _0x45c79d=_0x7a73[_0x2a5407];return _0x45c79d;};'use strict';function VtigerAccount(_0x129464){this['id']=_0x129464['id']||0x0;this[_0x37a7('0x0')]=_0x129464[_0x37a7('0x0')]||'';this[_0x37a7('0x1')]=_0x129464[_0x37a7('0x1')]||'';this[_0x37a7('0x2')]=_0x129464[_0x37a7('0x2')]||'';this['remoteUri']=_0x129464['remoteUri']||'';this['serverUrl']=_0x129464['serverUrl']||'';this['Configurations']=_0x129464['Configurations']||{};}module[_0x37a7('0x3')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 9aa687b..0ad04cc 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 _0x0b0e=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3b0d98,_0x346f06){_0x3b0d98=_0x3b0d98-0x0;var _0x296885=_0x0b0e[_0x3b0d98];return _0x296885;};'use strict';function ZendeskAccount(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['username']=_0x29cd1e[_0xe0b0('0x1')]||'';this[_0xe0b0('0x2')]=_0x29cd1e[_0xe0b0('0x2')]||'';this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||'';this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||'';this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||'';this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||'integrationTab';this['serverUrl']=_0x29cd1e[_0xe0b0('0x7')]||'';this[_0xe0b0('0x8')]=_0x29cd1e[_0xe0b0('0x8')]||{};}module[_0xe0b0('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xadb5=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadb5,0xad));var _0x5adb=function(_0x457365,_0x5c5706){_0x457365=_0x457365-0x0;var _0x28f7fa=_0xadb5[_0x457365];return _0x28f7fa;};'use strict';function ZendeskAccount(_0x1f969c){this['id']=_0x1f969c['id']||0x0;this[_0x5adb('0x0')]=_0x1f969c['name']||'';this[_0x5adb('0x1')]=_0x1f969c[_0x5adb('0x1')]||'';this[_0x5adb('0x2')]=_0x1f969c['password']||'';this[_0x5adb('0x3')]=_0x1f969c[_0x5adb('0x3')]||'';this[_0x5adb('0x4')]=_0x1f969c['remoteUri']||'';this[_0x5adb('0x5')]=_0x1f969c[_0x5adb('0x5')]||'';this[_0x5adb('0x6')]=_0x1f969c[_0x5adb('0x6')]||_0x5adb('0x7');this[_0x5adb('0x8')]=_0x1f969c[_0x5adb('0x8')]||'';this[_0x5adb('0x9')]=_0x1f969c[_0x5adb('0x9')]||{};}module[_0x5adb('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 3aa6e85..2214023 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 _0xc35f=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x297c55,_0x34fa75){var _0x120389=function(_0x595108){while(--_0x595108){_0x297c55['push'](_0x297c55['shift']());}};_0x120389(++_0x34fa75);}(_0xc35f,0x1ca));var _0xfc35=function(_0x2f61bc,_0x43f37f){_0x2f61bc=_0x2f61bc-0x0;var _0x15b722=_0xc35f[_0x2f61bc];return _0x15b722;};'use strict';function ZohoAccount(_0x197006){this['id']=_0x197006['id']||0x0;this[_0xfc35('0x0')]=_0x197006[_0xfc35('0x0')]||'';this[_0xfc35('0x1')]=_0x197006['description']||'';this[_0xfc35('0x2')]=_0x197006[_0xfc35('0x2')]||'';this[_0xfc35('0x3')]=_0x197006['zone']||'';this[_0xfc35('0x4')]=_0x197006['clientId']||'';this['clientSecret']=_0x197006[_0xfc35('0x5')]||'';this[_0xfc35('0x6')]=_0x197006['serverUrl']||'';this['code']=_0x197006[_0xfc35('0x7')]||'';this[_0xfc35('0x8')]=_0x197006[_0xfc35('0x8')]||'';this['Configurations']=_0x197006[_0xfc35('0x9')]||{};}module[_0xfc35('0xa')]=ZohoAccount; \ No newline at end of file +var _0x96d9=['refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0xa38346,_0x1ed99f){var _0xeb8384=function(_0x4ca8bf){while(--_0x4ca8bf){_0xa38346['push'](_0xa38346['shift']());}};_0xeb8384(++_0x1ed99f);}(_0x96d9,0xea));var _0x996d=function(_0x1d48b9,_0x12ba3a){_0x1d48b9=_0x1d48b9-0x0;var _0x50e848=_0x96d9[_0x1d48b9];return _0x50e848;};'use strict';function ZohoAccount(_0x1cece5){this['id']=_0x1cece5['id']||0x0;this[_0x996d('0x0')]=_0x1cece5[_0x996d('0x0')]||'';this[_0x996d('0x1')]=_0x1cece5[_0x996d('0x1')]||'';this[_0x996d('0x2')]=_0x1cece5[_0x996d('0x2')]||'';this[_0x996d('0x3')]=_0x1cece5['zone']||'';this[_0x996d('0x4')]=_0x1cece5[_0x996d('0x4')]||'';this[_0x996d('0x5')]=_0x1cece5[_0x996d('0x5')]||'';this[_0x996d('0x6')]=_0x1cece5[_0x996d('0x6')]||'';this[_0x996d('0x7')]=_0x1cece5['code']||'';this[_0x996d('0x8')]=_0x1cece5[_0x996d('0x8')]||'';this[_0x996d('0x9')]=_0x1cece5[_0x996d('0x9')]||{};}module[_0x996d('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index c945d6a..9d3bd82 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 _0x6b87=['prototype','getCaller','format','\x22%s\x22\x20<%s>','number','lodash','moment','isNil','string','queue','name','type','campaigntype','Agent','channelAgent','membername','calleridname','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname'];(function(_0x501628,_0x1997f0){var _0x2bf0dc=function(_0x42d9e7){while(--_0x42d9e7){_0x501628['push'](_0x501628['shift']());}};_0x2bf0dc(++_0x1997f0);}(_0x6b87,0x1de));var _0x76b8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6b87[_0x2641f9];return _0x585741;};'use strict';var util=require('util');var _=require(_0x76b8('0x0'));var moment=require(_0x76b8('0x1'));function checkNameSurname(_0x2aa326,_0x41d9eb,_0x8cd6f8){var _0x1657b8='';if(!_[_0x76b8('0x2')](_0x41d9eb)&&_0x76b8('0x3')===typeof _0x41d9eb){_0x1657b8+=_0x41d9eb;}if(!_[_0x76b8('0x2')](_0x8cd6f8)&&'string'===typeof _0x8cd6f8){_0x1657b8+='\x20'+_0x8cd6f8;}if(_0x1657b8!==''){return _0x1657b8;}return _0x2aa326;}function Action(_0x5a835c,_0x12a1d2,_0x193208,_0x30ed4f,_0x1652b9){this['uniqueid']=_0x193208||undefined;this['idContact']=_0x5a835c['id'];this[_0x76b8('0x4')]=_0x12a1d2[_0x76b8('0x5')];this[_0x76b8('0x6')]=_0x12a1d2[_0x76b8('0x6')];this[_0x76b8('0x7')]=_0x76b8('0x4');this['dialAnswer']=![];this['membername']=_['isNil'](_0x5a835c[_0x76b8('0x8')])?undefined:_0x5a835c[_0x76b8('0x8')][_0x76b8('0x5')];this[_0x76b8('0x9')]=this[_0x76b8('0xa')]?util['format']('SIP/%s',this[_0x76b8('0xa')]):_0x30ed4f||undefined;this[_0x76b8('0xb')]=checkNameSurname(_0x5a835c[_0x76b8('0xc')]['phone'],_0x5a835c[_0x76b8('0xc')][_0x76b8('0xd')],_0x5a835c[_0x76b8('0xc')][_0x76b8('0xe')]);this[_0x76b8('0xf')]=_0x5a835c[_0x76b8('0xf')]||![];this[_0x76b8('0x10')]=_0x5a835c[_0x76b8('0x11')];this[_0x76b8('0x12')]=_0x5a835c['scheduledat'];this['countbusyretry']=_0x5a835c[_0x76b8('0x13')]||0x0;this['countcongestionretry']=_0x5a835c[_0x76b8('0x14')]||0x0;this[_0x76b8('0x15')]=_0x5a835c['countnoanswerretry']||0x0;this[_0x76b8('0x16')]=(_0x5a835c[_0x76b8('0x13')]||0x0)+(_0x5a835c[_0x76b8('0x14')]||0x0)+(_0x5a835c[_0x76b8('0x15')]||0x0)+(_0x5a835c[_0x76b8('0x17')]||0x0)+(_0x5a835c['countdropretry']||0x0)+(_0x5a835c[_0x76b8('0x18')]||0x0)+(_0x5a835c[_0x76b8('0x19')]||0x0)+(_0x5a835c[_0x76b8('0x1a')]||0x0);this[_0x76b8('0x17')]=_0x5a835c[_0x76b8('0x17')]||0x0;this['countdropretry']=_0x5a835c[_0x76b8('0x1b')]||0x0;this[_0x76b8('0x18')]=_0x5a835c[_0x76b8('0x18')]||0x0;this['countmachineretry']=_0x5a835c[_0x76b8('0x19')]||0x0;this['countagentrejectretry']=_0x5a835c['countagentrejectretry']||0x0;this[_0x76b8('0x1c')]=_0x5a835c[_0x76b8('0x1c')];this[_0x76b8('0x1d')]=_0x5a835c[_0x76b8('0x1d')];this['callbackat']=_0x5a835c[_0x76b8('0x1e')];this[_0x76b8('0x1f')]=_0x5a835c[_0x76b8('0x1f')];this[_0x76b8('0x20')]=_0x5a835c[_0x76b8('0x20')];this[_0x76b8('0x21')]=_0x5a835c[_0x76b8('0x21')];this[_0x76b8('0x22')]=_[_0x76b8('0x2')](_0x5a835c[_0x76b8('0x8')])?_0x5a835c[_0x76b8('0x22')]:_0x5a835c[_0x76b8('0x8')]['id'];this[_0x76b8('0x23')]=_0x5a835c[_0x76b8('0x23')];this[_0x76b8('0x24')]='';this[_0x76b8('0x25')]='';}Action[_0x76b8('0x26')][_0x76b8('0x27')]=function(){return util[_0x76b8('0x28')](_0x76b8('0x29'),this[_0x76b8('0xb')],this[_0x76b8('0x2a')]);};module['exports']=Action; \ No newline at end of file +var _0xeb25=['phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','util','lodash','isNil','uniqueid','idContact','queue','campaigntype','membername','Agent','name','channelAgent','format'];(function(_0x5cab28,_0x307622){var _0xa3554d=function(_0x330139){while(--_0x330139){_0x5cab28['push'](_0x5cab28['shift']());}};_0xa3554d(++_0x307622);}(_0xeb25,0xde));var _0x5eb2=function(_0x45b1b3,_0x224dce){_0x45b1b3=_0x45b1b3-0x0;var _0x8f20cc=_0xeb25[_0x45b1b3];return _0x8f20cc;};'use strict';var util=require(_0x5eb2('0x0'));var _=require(_0x5eb2('0x1'));var moment=require('moment');function checkNameSurname(_0x4b7d9c,_0x43322c,_0x46884){var _0x51e034='';if(!_[_0x5eb2('0x2')](_0x43322c)&&'string'===typeof _0x43322c){_0x51e034+=_0x43322c;}if(!_['isNil'](_0x46884)&&'string'===typeof _0x46884){_0x51e034+='\x20'+_0x46884;}if(_0x51e034!==''){return _0x51e034;}return _0x4b7d9c;}function Action(_0x4e3add,_0x541166,_0x29bfcc,_0x130d7e,_0x3c6bd1){this[_0x5eb2('0x3')]=_0x29bfcc||undefined;this[_0x5eb2('0x4')]=_0x4e3add['id'];this[_0x5eb2('0x5')]=_0x541166['name'];this['type']=_0x541166['type'];this[_0x5eb2('0x6')]='queue';this['dialAnswer']=![];this[_0x5eb2('0x7')]=_[_0x5eb2('0x2')](_0x4e3add[_0x5eb2('0x8')])?undefined:_0x4e3add[_0x5eb2('0x8')][_0x5eb2('0x9')];this[_0x5eb2('0xa')]=this[_0x5eb2('0x7')]?util[_0x5eb2('0xb')]('SIP/%s',this[_0x5eb2('0x7')]):_0x130d7e||undefined;this['calleridname']=checkNameSurname(_0x4e3add['Contact'][_0x5eb2('0xc')],_0x4e3add['Contact'][_0x5eb2('0xd')],_0x4e3add['Contact'][_0x5eb2('0xe')]);this['active']=_0x4e3add[_0x5eb2('0xf')]||![];this['calleridnum']=_0x4e3add[_0x5eb2('0xc')];this[_0x5eb2('0x10')]=_0x4e3add[_0x5eb2('0x10')];this[_0x5eb2('0x11')]=_0x4e3add[_0x5eb2('0x11')]||0x0;this[_0x5eb2('0x12')]=_0x4e3add[_0x5eb2('0x12')]||0x0;this[_0x5eb2('0x13')]=_0x4e3add[_0x5eb2('0x13')]||0x0;this[_0x5eb2('0x14')]=(_0x4e3add['countbusyretry']||0x0)+(_0x4e3add['countcongestionretry']||0x0)+(_0x4e3add[_0x5eb2('0x13')]||0x0)+(_0x4e3add[_0x5eb2('0x15')]||0x0)+(_0x4e3add['countdropretry']||0x0)+(_0x4e3add[_0x5eb2('0x16')]||0x0)+(_0x4e3add[_0x5eb2('0x17')]||0x0)+(_0x4e3add['countagentrejectretry']||0x0);this[_0x5eb2('0x15')]=_0x4e3add[_0x5eb2('0x15')]||0x0;this[_0x5eb2('0x18')]=_0x4e3add[_0x5eb2('0x18')]||0x0;this[_0x5eb2('0x16')]=_0x4e3add[_0x5eb2('0x16')]||0x0;this[_0x5eb2('0x17')]=_0x4e3add[_0x5eb2('0x17')]||0x0;this['countagentrejectretry']=_0x4e3add[_0x5eb2('0x19')]||0x0;this[_0x5eb2('0x1a')]=_0x4e3add[_0x5eb2('0x1a')];this[_0x5eb2('0x1b')]=_0x4e3add['callbackuniqueid'];this[_0x5eb2('0x1c')]=_0x4e3add[_0x5eb2('0x1c')];this[_0x5eb2('0x1d')]=_0x4e3add['recallme'];this[_0x5eb2('0x1e')]=_0x4e3add[_0x5eb2('0x1e')];this['ListId']=_0x4e3add[_0x5eb2('0x1f')];this[_0x5eb2('0x20')]=_[_0x5eb2('0x2')](_0x4e3add[_0x5eb2('0x8')])?_0x4e3add[_0x5eb2('0x20')]:_0x4e3add[_0x5eb2('0x8')]['id'];this[_0x5eb2('0x21')]=_0x4e3add['VoiceQueueId'];this[_0x5eb2('0x22')]='';this[_0x5eb2('0x23')]='';}Action[_0x5eb2('0x24')][_0x5eb2('0x25')]=function(){return util[_0x5eb2('0xb')](_0x5eb2('0x26'),this['calleridname'],this['number']);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 1c5c526..e8295e3 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 _0x86a6=['addVariable','variables','syncVarSet','filterKey','keys','variable','value','error','transfertargetlinkedid','transfer','transfererlinkedid','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','syncOriginateResponse','bind','syncHangup','hanguprequest','dialend','syncDialEnd','newexten','varset','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','outbound','name','strategy','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','type','abandoned','waiting','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','sendMessageOneNotActive','available','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','prototype','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','preview','booked','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','queue','originated:\x20','originated','pTalking:\x20','pTalking','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','status','channel','catch','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[action]','size','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','[RecallMe]','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','isActive','dialActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','totalGlobal','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','acw','buildAcw','custom:agentcomplete','complete','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','Global','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','incrementPreviewCounters','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','rescheduleContact','swapAdditionalPhones','CONGESTION','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','countcongestionretry','CANCEL','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','cause-txt','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','Contact','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','Calling','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','reachable','unlock','unlockContact','getContactPreview','recallme','isValid','checkIsBlackList','phone','checkInBlack','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','clone','responsetime','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','cause','statedesc','dialQueueProject','channelstate','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destlinkedid'];(function(_0x3fee5e,_0x3e1f7b){var _0xf2d070=function(_0x58e916){while(--_0x58e916){_0x3fee5e['push'](_0x3fee5e['shift']());}};_0xf2d070(++_0x3e1f7b);}(_0x86a6,0x165));var _0x686a=function(_0x151381,_0x97b314){_0x151381=_0x151381-0x0;var _0x2afab6=_0x86a6[_0x151381];return _0x2afab6;};'use strict';var util=require(_0x686a('0x0'));var _=require(_0x686a('0x1'));var BPromise=require(_0x686a('0x2'));var uuid=require(_0x686a('0x3'));var moment=require(_0x686a('0x4'));var md5=require(_0x686a('0x5'));var Redis=require(_0x686a('0x6'));var config=require(_0x686a('0x7'));var logger=require(_0x686a('0x8'))('preview');var loggerAction=require(_0x686a('0x8'))('actionPreview');var ami=require(_0x686a('0x9'));var rpcDb=require(_0x686a('0xa'));var cmHopperAdditionalPhone=require(_0x686a('0xb'));var Action=require(_0x686a('0xc'));var ut=require(_0x686a('0xd'));config[_0x686a('0xe')]=_[_0x686a('0xf')](config[_0x686a('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0x686a('0x10'))(new Redis(config[_0x686a('0xe')]));var Sequence=function(){};Sequence['prototype'][_0x686a('0x11')]=function(_0x58afa9){this[_0x686a('0x12')]=this[_0x686a('0x12')]?this[_0x686a('0x12')][_0x686a('0x13')](_0x58afa9):_0x58afa9();};function Preview(_0x512b68){this[_0x686a('0x14')]=new Sequence();this[_0x686a('0x15')]=_0x512b68[_0x686a('0x16')];this[_0x686a('0x17')]=_0x512b68[_0x686a('0x17')];this[_0x686a('0x18')]={};this['agents']=_0x512b68[_0x686a('0x19')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0x686a('0x1a')][_0x686a('0x1b')](this));ami['on']('hangup',this[_0x686a('0x1c')][_0x686a('0x1b')](this));ami['on'](_0x686a('0x1d'),this['syncHangupRequest'][_0x686a('0x1b')](this));ami['on'](_0x686a('0x1e'),this[_0x686a('0x1f')][_0x686a('0x1b')](this));ami['on'](_0x686a('0x20'),this['syncNewExten'][_0x686a('0x1b')](this));ami['on'](_0x686a('0x21'),this['syncVarSet']['bind'](this));ami['on'](_0x686a('0x22'),this[_0x686a('0x23')]['bind'](this));ami['on']('blindtransfer',this[_0x686a('0x24')][_0x686a('0x1b')](this));this[_0x686a('0x25')](this[_0x686a('0x15')]);}function emit(_0x15467c,_0x172ed1,_0xe2ade1){io['to'](_0x15467c)['emit'](_0x172ed1,_0xe2ade1);}function emitCampaignPreview(_0x5b696d){if(_0x5b696d['type']===_0x686a('0x26')){var _0x7e7b82={'id':_0x5b696d['id'],'name':_0x5b696d[_0x686a('0x27')],'strategy':_0x5b696d[_0x686a('0x28')],'answered':_0x5b696d[_0x686a('0x29')],'available':_0x5b696d['available'],'loggedIn':_0x5b696d[_0x686a('0x2a')],'pTalking':_0x5b696d['pTalking'],'sumBillable':_0x5b696d[_0x686a('0x2b')],'sumDuration':_0x5b696d[_0x686a('0x2c')],'sumHoldTime':_0x5b696d[_0x686a('0x2d')]||0x0,'talking':_0x5b696d[_0x686a('0x2e')],'total':_0x5b696d[_0x686a('0x2f')],'type':_0x5b696d[_0x686a('0x30')],'unmanaged':_0x5b696d['unmanaged'],'abandoned':_0x5b696d[_0x686a('0x31')],'waiting':_0x5b696d[_0x686a('0x32')],'loggedInDb':_0x5b696d['loggedInDb'],'dialActive':_0x5b696d['dialActive'],'dialMethod':_0x5b696d['dialMethod'],'dialOriginateCallerIdName':_0x5b696d[_0x686a('0x33')],'dialOriginateCallerIdNumber':_0x5b696d[_0x686a('0x34')],'dialOriginateTimeout':_0x5b696d['dialOriginateTimeout'],'dialPrefix':_0x5b696d[_0x686a('0x35')],'outboundAnswerAgiCallsDay':_0x5b696d[_0x686a('0x36')],'outboundAnswerCallsDay':_0x5b696d[_0x686a('0x37')],'outboundBlacklistCallsDay':_0x5b696d[_0x686a('0x38')],'outboundBusyCallsDay':_0x5b696d['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x5b696d[_0x686a('0x39')],'outboundDropCallsDayACS':_0x5b696d[_0x686a('0x3a')],'outboundDropCallsDayCallersExit':_0x5b696d[_0x686a('0x3b')],'outboundDropCallsDayTimeout':_0x5b696d['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x5b696d['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x5b696d['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x5b696d[_0x686a('0x3c')],'outboundReCallsDay':_0x5b696d[_0x686a('0x3d')],'outboundRejectCallsDay':_0x5b696d[_0x686a('0x3e')],'outboundUnknownCallsDay':_0x5b696d[_0x686a('0x3f')],'outboundAbandonedCallsDay':_0x5b696d[_0x686a('0x40')],'predictiveIntervalAnsweredCalls':_0x5b696d['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x5b696d['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x5b696d[_0x686a('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x5b696d['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x5b696d[_0x686a('0x42')],'predictiveIntervalErlangCalls':_0x5b696d['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x5b696d[_0x686a('0x43')],'predictiveIntervalHitRate':_0x5b696d[_0x686a('0x44')],'predictiveIntervalMultiplicativeFactor':_0x5b696d['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x5b696d[_0x686a('0x45')],'predictiveIntervalAvailable':_0x5b696d[_0x686a('0x46')],'predictiveIntervalTotalCalls':_0x5b696d[_0x686a('0x47')],'message':_0x5b696d[_0x686a('0x48')],'originated':_0x5b696d['originated'],'erlangCalls':_0x5b696d['erlangCalls'],'erlangCallToSecond':_0x5b696d['erlangCallToSecond'],'erlangAbandonmentRate':_0x5b696d['erlangAbandonmentRate'],'erlangBusyFactor':_0x5b696d[_0x686a('0x49')],'startPredictive':_0x5b696d[_0x686a('0x4a')],'startProgressive':_0x5b696d[_0x686a('0x4b')]};if(_0x5b696d[_0x686a('0x4c')]){_0x7e7b82[_0x686a('0x4c')]={'id':_0x5b696d[_0x686a('0x4c')]['id'],'name':_0x5b696d[_0x686a('0x4c')]['name'],'active':_0x5b696d[_0x686a('0x4c')][_0x686a('0x4d')],'callerid':_0x5b696d['Trunk'][_0x686a('0x4e')]};}if(_0x5b696d['Interval']){_0x7e7b82[_0x686a('0x4f')]={'id':_0x5b696d[_0x686a('0x4f')]['id'],'name':_0x5b696d[_0x686a('0x4f')][_0x686a('0x27')]};}var _0x328d65=md5(JSON[_0x686a('0x50')](_0x7e7b82));if(_0x5b696d['md5']!==_0x328d65){_0x5b696d[_0x686a('0x5')]=_0x328d65;emit(util[_0x686a('0x51')](_0x686a('0x52'),_0x7e7b82[_0x686a('0x27')]),'voice_queue:save',_0x7e7b82);}}}function emitVoiceQueueChannelRemove(_0x1cc727){logger[_0x686a('0x53')](_0x686a('0x54'),JSON['stringify'](_0x1cc727));emit(util[_0x686a('0x51')]('voice:queue:%s',_0x1cc727[_0x686a('0x27')]),'voice_queue_channel:remove',_0x1cc727);io['emit']('voice_queue_presence:remove',_0x1cc727);}function notSendMessagesQueue(_0x3e27ed){if(_0x3e27ed[_0x686a('0x55')]){if(_0x3e27ed['originated']===0x0&&_0x3e27ed['pTalking']===0x0){_0x3e27ed['sendMessageOneNotActive']=![];_0x3e27ed[_0x686a('0x56')]=0x0;_0x3e27ed[_0x686a('0x57')]=0x0;_0x3e27ed['message']=_0x686a('0x58');ut[_0x686a('0x59')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3e27ed[_0x686a('0x27')]+_0x686a('0x5a'));}else{_0x3e27ed[_0x686a('0x48')]=_0x686a('0x5b');ut[_0x686a('0x59')](_0x686a('0x5c'),_0x3e27ed[_0x686a('0x27')]+_0x686a('0x5d'));}emitCampaignPreview(_0x3e27ed);}}Preview[_0x686a('0x5e')]['loopCampaigns']=function(){var _0xcb248b=this;setInterval(function(){_0xcb248b['syncCampaigns']();},0x7cf);};Preview[_0x686a('0x5e')][_0x686a('0x5f')]=function(){var _0x2616a1=this[_0x686a('0x15')];this[_0x686a('0x60')]+=0x1;for(var _0x3a94b3 in _0x2616a1){if(_0x2616a1[_0x686a('0x61')](_0x3a94b3)&&(_0x2616a1[_0x3a94b3][_0x686a('0x62')]===_0x686a('0x63')||_0x2616a1[_0x3a94b3][_0x686a('0x62')]===_0x686a('0x64'))&&_0x2616a1[_0x3a94b3][_0x686a('0x30')]===_0x686a('0x26')){if(this[_0x686a('0x60')]>0x7){this[_0x686a('0x60')]=0x0;this['clearZombieChannels']();}}if(_0x2616a1[_0x686a('0x61')](_0x3a94b3)&&_0x2616a1[_0x3a94b3][_0x686a('0x62')]===_0x686a('0x63')&&_0x2616a1[_0x3a94b3][_0x686a('0x30')]===_0x686a('0x26')){if(_0x2616a1[_0x3a94b3]['dialActive']){this['setMessage'](_0x2616a1[_0x3a94b3]);this[_0x686a('0x65')](_0x2616a1[_0x3a94b3]);}else{notSendMessagesQueue(_0x2616a1[_0x3a94b3]);}}}};Preview[_0x686a('0x5e')][_0x686a('0x66')]=function(_0x1e5faf){var _0x4886dc=this;this[_0x686a('0x14')][_0x686a('0x11')](function(){if(!_[_0x686a('0x67')](_0x4886dc[_0x686a('0x18')][_0x1e5faf])){loggerAction[_0x686a('0x53')](_0x686a('0x68'),_0x1e5faf,'Queue',_0x4886dc['actions'][_0x1e5faf][_0x686a('0x69')],_0x686a('0x6a'),JSON[_0x686a('0x50')](_0x4886dc[_0x686a('0x15')][_0x4886dc[_0x686a('0x18')][_0x1e5faf][_0x686a('0x69')]][_0x686a('0x6b')]),_0x686a('0x6c'),JSON['stringify'](_0x4886dc[_0x686a('0x15')][_0x4886dc[_0x686a('0x18')][_0x1e5faf][_0x686a('0x69')]][_0x686a('0x6d')]),JSON[_0x686a('0x50')](_0x4886dc[_0x686a('0x18')][_0x1e5faf][_0x686a('0x6e')]),JSON['stringify'](_[_0x686a('0x6f')](_0x4886dc[_0x686a('0x18')][_0x1e5faf],['contactId',_0x686a('0x70'),_0x686a('0x71'),_0x686a('0x72')])));return ami[_0x686a('0x73')]({'action':_0x686a('0x74'),'channel':_0x4886dc[_0x686a('0x18')][_0x1e5faf][_0x686a('0x75')]})[_0x686a('0x76')](function(_0x14d870){if(_0x14d870[_0x686a('0x48')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x4886dc[_0x686a('0x18')][_0x1e5faf]){ut['updateOriginated'](_0x4886dc[_0x686a('0x15')][_0x4886dc[_0x686a('0x18')][_0x1e5faf][_0x686a('0x69')]],_0x686a('0x77'));if(_0x4886dc[_0x686a('0x18')][_0x1e5faf][_0x686a('0x6e')]===!![]){ut[_0x686a('0x78')](_0x4886dc[_0x686a('0x15')][_0x4886dc['actions'][_0x1e5faf][_0x686a('0x69')]],_0x686a('0x77'));ut['loggerError'](_0x686a('0x79')+_0x1e5faf,_0x4886dc[_0x686a('0x18')][_0x1e5faf][_0x686a('0x69')]);}ut[_0x686a('0x7a')]('[Dialer][checkChannel][Preview]'+_0x1e5faf,_0x4886dc[_0x686a('0x18')][_0x1e5faf][_0x686a('0x69')]);delete _0x4886dc[_0x686a('0x18')][_0x1e5faf];}},0x2328);}});}});};Preview[_0x686a('0x5e')]['clearZombieChannels']=function(){var _0x5e6d28=this;loggerAction[_0x686a('0x53')](_0x686a('0x7b'),_[_0x686a('0x7c')](this[_0x686a('0x18')]));for(var _0x3355f4 in this[_0x686a('0x18')]){if(_0x5e6d28[_0x686a('0x18')][_0x686a('0x61')](_0x3355f4)){_0x5e6d28[_0x686a('0x66')](_0x3355f4);}}};Preview[_0x686a('0x5e')][_0x686a('0x65')]=function(_0xabefad){var _0x1c6731=this;rpcDb[_0x686a('0x7d')](_0xabefad['id'],ut[_0x686a('0x7e')](this['agents']))[_0x686a('0x7f')](function(_0x1eac15){if(!_['isNil'](_0x1eac15)){for(var _0xef0f19=0x0;_0xef0f19<_0x1eac15['length'];_0xef0f19+=0x1){if(ut[_0x686a('0x80')](_0x1eac15[_0xef0f19][_0x686a('0x81')])<_0xabefad[_0x686a('0x82')]*0x3c){if(_0x1eac15[_0xef0f19][_0x686a('0x83')]&&!_0x1eac15[_0xef0f19][_0x686a('0x83')]['voicePause']){_0x1c6731[_0x686a('0x84')](_0x1eac15[_0xef0f19]['id'])[_0x686a('0x7f')](ut['logger2'](_0x686a('0x85')))[_0x686a('0x76')](ut[_0x686a('0x86')]('[RecallMe]'));}else{rpcDb[_0x686a('0x87')](_0x1eac15[_0xef0f19]['id']);}}else{var _0x58f901=new Action(_0x1eac15[_0xef0f19],_0xabefad);_0x58f901[_0x686a('0x88')]=moment()['format'](_0x686a('0x89'));_0xabefad['outboundReCallsDay']+=0x1;ut[_0x686a('0x8a')](_0x58f901,0x17,_0x686a('0x8b'));if(_0xabefad[_0x686a('0x8c')]){rpcDb[_0x686a('0x8d')](ut[_0x686a('0x8e')](_0x1eac15[_0xef0f19]));rpcDb[_0x686a('0x8f')](_0x58f901,_0x686a('0x90'));}else{ut[_0x686a('0x8a')](_0x58f901,0x16,_0x686a('0x91'));rpcDb[_0x686a('0x8f')](_0x58f901,_0x686a('0x92'));rpcDb[_0x686a('0x93')](_0x58f901,_0x686a('0x92'));}}}}})['catch'](ut[_0x686a('0x86')](_0x686a('0x94')));};Preview['prototype'][_0x686a('0x95')]=function(_0x27e877){_0x27e877[_0x686a('0x55')]=!![];if(ut[_0x686a('0x96')](_0x27e877['loggedIn'])){_0x27e877['message']='AGENTS_NOT_LOGGED';}else if(!ut[_0x686a('0x97')](_0x27e877[_0x686a('0x98')])){_0x27e877[_0x686a('0x48')]=_0x686a('0x58');}else if(!this[_0x686a('0x99')](_0x27e877[_0x686a('0x4c')])){if(!this[_0x686a('0x99')](_0x27e877[_0x686a('0x9a')])){_0x27e877[_0x686a('0x48')]='TRUNK_IS_NOT_REACHABLE';}else{_0x27e877[_0x686a('0x48')]='ACTIVE';}}else{_0x27e877[_0x686a('0x48')]=_0x686a('0x9b');}emitCampaignPreview(_0x27e877);};Preview[_0x686a('0x5e')][_0x686a('0x9c')]=function(_0x3914ad,_0x118aa8,_0x21d981){var _0x39eeef=this;var _0x3d78e0=this['actions'][_0x118aa8];var _0x16a366=this[_0x686a('0x15')][_0x3d78e0[_0x686a('0x69')]];var _0x388245;var _0x2e687b=![];var _0x30ed16=0x2;var _0x3fc8d8=0x3;if(_0x16a366){switch(_0x21d981){case'1':_0x16a366[_0x686a('0x9d')]+=0x1;_0x3d78e0[_0x686a('0x9e')]+=0x1;_0x3d78e0['countglobal']=ut[_0x686a('0x9f')](_0x3d78e0);ut['logCustomer'](_0x3d78e0,0x0,_0x686a('0xa0'));ami[_0x686a('0xa1')](_0x686a('0xa2'),ut[_0x686a('0xa3')](_0x3d78e0,_0x686a('0xa4')));rpcDb[_0x686a('0x8f')](_0x3d78e0,'[callProgressDetectingCustomer][logNoSuch]');_0x39eeef['verifyAdditionalPhones'](_0x3d78e0,'0',_0x16a366)[_0x686a('0x7f')](function(_0x20cd6a){_0x2e687b=_0x20cd6a[_0x686a('0xa5')]==0x1;_0x30ed16=_0x16a366[_0x686a('0xa6')];_0x3fc8d8=_0x16a366[_0x686a('0xa7')];if(!_0x2e687b){if(ut[_0x686a('0x9f')](_0x3d78e0)>=_0x16a366[_0x686a('0xa8')]){_0x388245=ut[_0x686a('0xa9')](_0x3d78e0,0xf,'Global');rpcDb['createCustomerFinal'](_0x388245,_0x686a('0xaa'));}else{if(_0x3d78e0[_0x686a('0x9e')]>=_0x16a366[_0x686a('0xab')]){rpcDb[_0x686a('0x93')](_0x3d78e0,_0x686a('0xaa'));}else{rpcDb['rescheduleContact'](ut[_0x686a('0xac')](_0x3d78e0,_0x686a('0x9e'),_0x16a366[_0x686a('0xa6')]),_0x3d78e0[_0x686a('0xad')],_0x3d78e0[_0x686a('0xae')]);}}delete this[_0x686a('0x18')][_0x3914ad[_0x686a('0xaf')]];}else{_0x3d78e0[_0x686a('0x9e')]++;logger[_0x686a('0x53')](_0x686a('0xb0'),_0x3d78e0[_0x686a('0x9e')]);logger[_0x686a('0x53')]('id',_0x3d78e0[_0x686a('0xb1')]);_0x39eeef['incrementPreviewCounters']({'id':_0x3d78e0[_0x686a('0xb1')],'field':{'countnosuchnumberretry':_0x3d78e0[_0x686a('0x9e')]}})[_0x686a('0x7f')](function(){_0x39eeef['swapAdditionalPhones'](_0x3d78e0,_0x30ed16,_0x3fc8d8)[_0x686a('0x7f')](function(){});});}});break;case _0x686a('0xb2'):var _0x31389d=moment()[_0x686a('0x51')](_0x686a('0x89'));_0x3d78e0['responsetime']=_0x31389d;_0x3d78e0[_0x686a('0xb3')]=_0x31389d;_0x3d78e0[_0x686a('0x6e')]=!![];_0x16a366[_0x686a('0x6d')]+=0x1;logger[_0x686a('0x53')](_0x686a('0xb4'),_0x3d78e0[_0x686a('0xb5')],_0x686a('0xb6'),_0x16a366[_0x686a('0x27')],_0x686a('0x6c'),_0x16a366[_0x686a('0x6d')]);ami[_0x686a('0xa1')]('custom:agentconnect',ut['buildObj'](_0x3d78e0,'connect',this[_0x686a('0x15')][_0x3d78e0[_0x686a('0x69')]]));if(_0x16a366[_0x686a('0xb7')]){ami[_0x686a('0xa1')]('custom:agentConnectPreview',ut[_0x686a('0xb8')](_0x3d78e0));}break;case'16':ami['emit'](_0x686a('0xb9'),ut[_0x686a('0xa3')](_0x3d78e0,_0x686a('0xba'),this['campaignsPreview'][_0x3d78e0['queue']]));emitVoiceQueueChannelRemove(ut[_0x686a('0xa3')](_0x3d78e0,_0x686a('0xba')));_0x16a366[_0x686a('0x37')]+=0x1;_0x16a366[_0x686a('0x2f')]+=0x1;_0x16a366['answered']+=0x1;ut[_0x686a('0x78')](_0x16a366,_0x686a('0xbb'));_0x3d78e0[_0x686a('0xbc')]=ut[_0x686a('0x9f')](_0x3d78e0);ut[_0x686a('0x8a')](_0x3d78e0,0x4,_0x686a('0xbd'));rpcDb[_0x686a('0x8f')](_0x3d78e0,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x686a('0x93')](_0x3d78e0,_0x686a('0xbe'));rpcDb[_0x686a('0xbf')](_0x3d78e0);_0x16a366[_0x686a('0x2c')]+=_0x3d78e0[_0x686a('0xc0')];_0x16a366[_0x686a('0x2b')]+=_0x3d78e0[_0x686a('0xc0')];logger[_0x686a('0x53')](_0x686a('0xc1'),_0x3d78e0['uniqueid'],_0x686a('0xb6'),_0x16a366['name'],'pTalking:\x20',_0x16a366[_0x686a('0x6d')]);delete this[_0x686a('0x18')][_0x3914ad[_0x686a('0xaf')]];break;case _0x686a('0xc2'):_0x16a366[_0x686a('0xc3')]+=0x1;_0x3d78e0['countbusyretry']+=0x1;_0x3d78e0[_0x686a('0xbc')]=ut[_0x686a('0x9f')](_0x3d78e0);ut['logCustomer'](_0x3d78e0,0x5,_0x686a('0xc4'));_0x30ed16=_0x16a366[_0x686a('0xc5')];_0x3fc8d8=_0x16a366[_0x686a('0xa7')];ami[_0x686a('0xa1')](_0x686a('0xc6'),ut[_0x686a('0xa3')](_0x3d78e0,_0x686a('0xc7')));rpcDb[_0x686a('0x8f')](_0x3d78e0,_0x686a('0xc8'));_0x39eeef[_0x686a('0xc9')](_0x3d78e0,'5',_0x16a366)['then'](function(_0x23c31f){_0x2e687b=_0x23c31f[_0x686a('0xa5')]==0x1;if(!_0x2e687b){if(ut[_0x686a('0x9f')](_0x3d78e0)>=_0x16a366[_0x686a('0xa8')]){_0x388245=ut[_0x686a('0xa9')](_0x3d78e0,0xf,_0x686a('0xca'));rpcDb[_0x686a('0x93')](_0x388245,_0x686a('0xcb'));}else{if(_0x3d78e0[_0x686a('0xcc')]>=_0x16a366[_0x686a('0xcd')]){rpcDb['createCustomerFinal'](_0x3d78e0,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0x686a('0xac')](_0x3d78e0,_0x686a('0xcc'),_0x16a366[_0x686a('0xc5')]),_0x3d78e0[_0x686a('0xad')],_0x3d78e0[_0x686a('0xae')]);}}}else{_0x3d78e0[_0x686a('0xcc')]++;_0x39eeef[_0x686a('0xce')]({'id':_0x3d78e0[_0x686a('0xb1')],'field':{'countbusyretry':_0x3d78e0['countbusyretry']}})['then'](function(){_0x39eeef['swapAdditionalPhones'](_0x3d78e0,_0x30ed16,_0x3fc8d8)[_0x686a('0x7f')](function(){});});}});break;case _0x686a('0xcf'):_0x16a366[_0x686a('0xd0')]+=0x1;_0x3d78e0[_0x686a('0xd1')]+=0x1;_0x3d78e0['countglobal']=ut[_0x686a('0x9f')](_0x3d78e0);ut[_0x686a('0x8a')](_0x3d78e0,0x3,_0x686a('0xd2'));_0x30ed16=_0x16a366[_0x686a('0xd3')];_0x3fc8d8=_0x16a366[_0x686a('0xa7')];ami[_0x686a('0xa1')]('custom:agentnoanswer',ut['buildObj'](_0x3d78e0,_0x686a('0xd4')));rpcDb['createCustomerHistory'](_0x3d78e0,_0x686a('0xd5'));_0x39eeef[_0x686a('0xc9')](_0x3d78e0,'3',_0x16a366)[_0x686a('0x7f')](function(_0x4a8224){_0x2e687b=_0x4a8224[_0x686a('0xa5')]==0x1;if(!_0x2e687b){if(ut[_0x686a('0x9f')](_0x3d78e0)>=_0x16a366[_0x686a('0xa8')]){_0x388245=ut[_0x686a('0xa9')](_0x3d78e0,0xf,_0x686a('0xca'));rpcDb[_0x686a('0x93')](_0x388245,_0x686a('0xd6'));}else{if(_0x3d78e0[_0x686a('0xd1')]>=_0x16a366[_0x686a('0xd7')]){rpcDb[_0x686a('0x93')](_0x3d78e0,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x686a('0xd8')](ut[_0x686a('0xac')](_0x3d78e0,'countnoanswerretry',_0x16a366[_0x686a('0xd3')]),_0x3d78e0[_0x686a('0xad')],_0x3d78e0[_0x686a('0xae')]);}}}else{_0x3d78e0[_0x686a('0xd1')]++;_0x39eeef['incrementPreviewCounters']({'id':_0x3d78e0[_0x686a('0xb1')],'field':{'countnoanswerretry':_0x3d78e0['countnoanswerretry']}})['then'](function(){_0x39eeef[_0x686a('0xd9')](_0x3d78e0,_0x30ed16,_0x3fc8d8)[_0x686a('0x7f')](function(){});});}});break;case _0x686a('0xda'):_0x16a366[_0x686a('0x39')]+=0x1;_0x3d78e0['countcongestionretry']+=0x1;_0x3d78e0[_0x686a('0xbc')]=ut[_0x686a('0x9f')](_0x3d78e0);ut[_0x686a('0x8a')](_0x3d78e0,0x8,_0x686a('0xdb'));_0x30ed16=_0x16a366[_0x686a('0xdc')];_0x3fc8d8=_0x16a366[_0x686a('0xa7')];ami[_0x686a('0xa1')](_0x686a('0xdd'),ut[_0x686a('0xa3')](_0x3d78e0,_0x686a('0xde')));rpcDb[_0x686a('0x8f')](_0x3d78e0,'[callProgressDetectingCustomer][logCongestion]');_0x39eeef[_0x686a('0xc9')](_0x3d78e0,'8',_0x16a366)[_0x686a('0x7f')](function(_0x5dcf41){_0x2e687b=_0x5dcf41[_0x686a('0xa5')]==0x1;if(!_0x2e687b){if(ut[_0x686a('0x9f')](_0x3d78e0)>=_0x16a366[_0x686a('0xa8')]){_0x388245=ut[_0x686a('0xa9')](_0x3d78e0,0xf,_0x686a('0xca'));rpcDb[_0x686a('0x93')](_0x388245,_0x686a('0xdf'));}else{if(_0x3d78e0['countcongestionretry']>=_0x16a366[_0x686a('0xe0')]){rpcDb['createCustomerFinal'](_0x3d78e0,_0x686a('0xe1'));}else{rpcDb[_0x686a('0xd8')](ut['scheduledAt'](_0x3d78e0,_0x686a('0xe2'),_0x16a366[_0x686a('0xc5')]),_0x3d78e0[_0x686a('0xad')],_0x3d78e0[_0x686a('0xae')]);}}}else{_0x3d78e0[_0x686a('0xe2')]++;_0x39eeef['incrementPreviewCounters']({'id':_0x3d78e0[_0x686a('0xb1')],'field':{'countcongestionretry':_0x3d78e0[_0x686a('0xe2')]}})[_0x686a('0x7f')](function(){_0x39eeef['swapAdditionalPhones'](_0x3d78e0,_0x30ed16,_0x3fc8d8)['then'](function(){});});}});break;case _0x686a('0xe3'):_0x16a366[_0x686a('0x3e')]+=0x1;_0x3d78e0['countagentrejectretry']+=0x1;_0x3d78e0[_0x686a('0xbc')]=ut[_0x686a('0x9f')](_0x3d78e0);ut[_0x686a('0x8a')](_0x3d78e0,0x14,_0x686a('0xe4'));_0x30ed16=_0x16a366[_0x686a('0xe5')];_0x3fc8d8=_0x16a366[_0x686a('0xa7')];ami['emit'](_0x686a('0xe6'),ut[_0x686a('0xa3')](_0x3d78e0,_0x686a('0xe7')));rpcDb['createCustomerHistory'](_0x3d78e0,_0x686a('0xe8'));_0x39eeef['verifyAdditionalPhones'](_0x3d78e0,'20',_0x16a366)[_0x686a('0x7f')](function(_0x5bff17){_0x2e687b=_0x5bff17[_0x686a('0xa5')]==0x1;if(!_0x2e687b){if(ut[_0x686a('0x9f')](_0x3d78e0)>=_0x16a366[_0x686a('0xa8')]){_0x388245=ut[_0x686a('0xa9')](_0x3d78e0,0x14,_0x686a('0xe4'));rpcDb[_0x686a('0x93')](_0x388245,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x3d78e0[_0x686a('0xe9')]>=_0x16a366[_0x686a('0xea')]){rpcDb['createCustomerFinal'](_0x3d78e0,_0x686a('0xeb'));}else{rpcDb[_0x686a('0xd8')](ut[_0x686a('0xac')](_0x3d78e0,'countagentrejectretry',_0x16a366[_0x686a('0xe5')]),_0x3d78e0[_0x686a('0xad')],_0x3d78e0[_0x686a('0xae')]);}}}else{_0x3d78e0[_0x686a('0xd1')]++;_0x39eeef[_0x686a('0xce')]({'id':_0x3d78e0[_0x686a('0xb1')],'field':{'countnoanswerretry':_0x3d78e0[_0x686a('0xd1')]}})[_0x686a('0x7f')](function(){_0x39eeef['swapAdditionalPhones'](_0x3d78e0,_0x30ed16,_0x3fc8d8)['then'](function(){});});}});break;case _0x686a('0xec'):_0x16a366[_0x686a('0x40')]+=0x1;_0x3d78e0[_0x686a('0xed')]+=0x1;_0x3d78e0[_0x686a('0xbc')]=ut[_0x686a('0x9f')](_0x3d78e0);ut['logCustomer'](_0x3d78e0,0xb,_0x686a('0xee'));rpcDb[_0x686a('0x8f')](_0x3d78e0,_0x686a('0xef'));if(ut[_0x686a('0x9f')](_0x3d78e0)>=_0x16a366['dialGlobalMaxRetry']){_0x388245=ut[_0x686a('0xa9')](_0x3d78e0,0xf,'Global');rpcDb[_0x686a('0x93')](_0x388245,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x3d78e0[_0x686a('0xf0')]>=_0x16a366['dialAbandonedMaxRety']){rpcDb[_0x686a('0x93')](_0x3d78e0,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x686a('0xd8')](ut[_0x686a('0xac')](_0x3d78e0,_0x686a('0xed'),_0x16a366[_0x686a('0xf1')]),_0x3d78e0[_0x686a('0xad')],_0x3d78e0[_0x686a('0xae')]);}}break;case'18':_0x16a366[_0x686a('0x3f')]+=0x1;_0x3d78e0['countmachineretry']+=0x1;_0x3d78e0[_0x686a('0xbc')]=ut[_0x686a('0x9f')](_0x3d78e0);ut[_0x686a('0x8a')](_0x3d78e0,0x12,_0x3914ad[_0x686a('0xf2')]||_0x3914ad['dialstatus']);ami['emit']('custom:amd',ut[_0x686a('0xa3')](_0x3d78e0,_0x686a('0xf3')));rpcDb[_0x686a('0x8f')](_0x3d78e0,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0x686a('0x9f')](_0x3d78e0)>=_0x16a366[_0x686a('0xa8')]){_0x388245=ut[_0x686a('0xa9')](_0x3d78e0,0xf,'Global');rpcDb['createCustomerFinal'](_0x388245,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x686a('0x93')](_0x3d78e0,_0x686a('0xf4'));}delete this[_0x686a('0x18')][_0x3914ad['linkedid']];break;case'19':_0x16a366[_0x686a('0x3f')]+=0x1;_0x3d78e0['countglobal']=ut[_0x686a('0x9f')](_0x3d78e0);ut[_0x686a('0x8a')](_0x3d78e0,0x13,_0x3914ad[_0x686a('0xf2')]||_0x3914ad[_0x686a('0xf5')]);ami[_0x686a('0xa1')](_0x686a('0xf6'),ut[_0x686a('0xa3')](_0x3d78e0,_0x686a('0xf3')));rpcDb['createCustomerHistory'](_0x3d78e0,_0x686a('0xf7'));if(ut[_0x686a('0x9f')](_0x3d78e0)>=_0x16a366['dialGlobalMaxRetry']){_0x388245=ut['cloneAction'](_0x3d78e0,0xf,_0x686a('0xca'));rpcDb['createCustomerFinal'](_0x388245,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x686a('0x93')](_0x3d78e0,_0x686a('0xf7'));}delete this[_0x686a('0x18')][_0x3914ad[_0x686a('0xaf')]];break;default:if(_0x3d78e0[_0x686a('0x6e')]){ut[_0x686a('0x78')](_0x16a366,_0x686a('0xf8'));ut[_0x686a('0x7a')](_0x686a('0xf9')+_0x16a366[_0x686a('0x27')],_0x3914ad);}_0x16a366[_0x686a('0x3f')]+=0x1;_0x3d78e0['countglobal']=ut[_0x686a('0x9f')](_0x3d78e0);ut['logCustomer'](_0x3d78e0,0xc,_0x3914ad[_0x686a('0xf2')]||_0x3914ad[_0x686a('0xf5')]);_0x30ed16=_0x16a366[_0x686a('0xe5')];_0x3fc8d8=_0x16a366[_0x686a('0xa7')];rpcDb[_0x686a('0x8f')](_0x3d78e0,_0x686a('0xfa'));_0x39eeef['verifyAdditionalPhones'](_0x3d78e0,'20',_0x16a366)['then'](function(_0x1790e4){_0x2e687b=_0x1790e4[_0x686a('0xa5')]==0x1;if(!_0x2e687b){if(ut['totalGlobal'](_0x3d78e0)>=_0x16a366[_0x686a('0xa8')]){_0x388245=ut[_0x686a('0xa9')](_0x3d78e0,0xf,'Global');rpcDb['createCustomerFinal'](_0x388245,_0x686a('0xfb'));}else{rpcDb[_0x686a('0x93')](_0x3d78e0,_0x686a('0xfb'));}delete this[_0x686a('0x18')][_0x3914ad['linkedid']];}else{_0x39eeef[_0x686a('0xd9')](_0x3d78e0,_0x30ed16,_0x3fc8d8)['then'](function(_0x438687){});}});}if(!(_0x3d78e0[_0x686a('0x6e')]&&_0x21d981==='16')){ut[_0x686a('0xfc')](_0x16a366,_0x686a('0xfd'));logger['info'](_0x686a('0xfe'),_0x3d78e0[_0x686a('0xb5')],_0x686a('0xb6'),_0x16a366['name'],'originated:\x20',_0x16a366[_0x686a('0x6b')]);}if(_0x21d981!==_0x686a('0xb2')){delete this[_0x686a('0x18')][_0x3914ad['linkedid']];delete this[_0x686a('0x18')][_0x3914ad['destlinkedid']];}}};Preview[_0x686a('0x5e')]['callProgressDetectingAgent']=function(_0x122081,_0x406251,_0x30b91b){if(_[_0x686a('0xff')](_0x406251)&&_0x686a('0x100')!==typeof _0x406251){return;}if(_[_0x686a('0xff')](_0x30b91b)&&_0x686a('0x100')!==typeof _0x30b91b){return;}switch(_0x30b91b[_0x686a('0x101')]){case'0':ut[_0x686a('0x102')](_0x122081,0x0,_0x686a('0xa0'));rpcDb[_0x686a('0x103')](_0x122081,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x686a('0x102')](_0x122081,0x3,_0x686a('0xd2'));rpcDb[_0x686a('0x103')](_0x122081,_0x686a('0x104'));break;case'5':ut[_0x686a('0x102')](_0x122081,0x5,'Busy');rpcDb[_0x686a('0x103')](_0x122081,_0x686a('0x105'));break;case'8':ut[_0x686a('0x102')](_0x122081,0x8,_0x686a('0xdb'));rpcDb[_0x686a('0x103')](_0x122081,_0x686a('0x106'));break;case'22':ut['logAgent'](_0x122081,0x16,'AnswerAGI');rpcDb[_0x686a('0x103')](_0x122081,_0x686a('0x107'));break;default:ut[_0x686a('0x102')](_0x122081,0xc,_0x30b91b[_0x686a('0x101')]);rpcDb[_0x686a('0x103')](_0x122081,_0x686a('0x106'));}ut[_0x686a('0xfc')](_0x406251,'[callProgressDetectingAgent]');logger['info'](_0x686a('0x108'),_0x122081[_0x686a('0xb5')],_0x686a('0xb6'),_0x406251['name'],_0x686a('0x6a'),_0x406251[_0x686a('0x6b')]);delete this[_0x686a('0x18')][_0x122081[_0x686a('0xb5')]];};Preview[_0x686a('0x5e')][_0x686a('0xc9')]=function(_0x12971a,_0x1daa3f,_0x4119d3){return BPromise[_0x686a('0x109')]()[_0x686a('0x7f')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x12971a,_0x1daa3f,_0x4119d3))[_0x686a('0x76')](logger[_0x686a('0x53')](_0x686a('0x10a')));};Preview['prototype'][_0x686a('0xd9')]=function(_0xbbe4f2,_0x1cdb7c,_0x4dcbd4){return BPromise[_0x686a('0x109')]()[_0x686a('0x7f')](cmHopperAdditionalPhone['swapAdditionalPhones'](_0xbbe4f2,_0x1cdb7c,_0x4dcbd4))[_0x686a('0x76')](logger[_0x686a('0x53')](_0x686a('0x10b')));};Preview['prototype'][_0x686a('0xce')]=function(_0x1d59e0){return BPromise['resolve']()[_0x686a('0x7f')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x1d59e0))['catch'](logger[_0x686a('0x53')](_0x686a('0x10c')));};Preview[_0x686a('0x5e')]['checkInBlack']=function(_0x742770,_0x2b8516,_0x273010,_0x42eee7,_0x27bba5){var _0x1745f7=this;return new BPromise(function(_0x112c07,_0x4dc115){if(_[_0x686a('0x67')](_0x2b8516)||_['isNil'](_0x2b8516[_0x686a('0x10d')])||_[_0x686a('0x67')](_0x2b8516['phone'])||_[_0x686a('0x67')](_0x2b8516[_0x686a('0x71')])){_0x4dc115(ut[_0x686a('0x48')](_0x686a('0x10e'),_0x42eee7,_0x27bba5));return;}var _0x4f6a31=uuid['v4']();var _0x4c1b5e=_0x1745f7[_0x686a('0x15')][_0x2b8516[_0x686a('0x10f')][_0x686a('0x27')]];var _0x3c7226=_0x273010?_0x1745f7[_0x686a('0x19')][_0x273010]['id']:undefined;_0x1745f7['actions'][_0x4f6a31]=new Action(_0x2b8516,_0x4c1b5e,_0x4f6a31,_0x273010,_0x3c7226);var _0x3a5cee=_0x1745f7[_0x686a('0x18')][_0x4f6a31];_0x3a5cee[_0x686a('0xad')]=_0x42eee7;_0x3a5cee['activeContact']=_0x27bba5;_0x3a5cee[_0x686a('0x110')]=_0x273010;if(_[_0x686a('0x111')](_0x742770)){_0x1745f7[_0x686a('0x112')](_0x3a5cee,_0x4c1b5e,_0x2b8516,_0x273010)[_0x686a('0x7f')](function(_0x19c3b6){logger[_0x686a('0x53')](_0x686a('0x113'),'Queue:\x20'+_0x3a5cee['queue']+_0x686a('0x114')+_0x3a5cee[_0x686a('0xb1')],JSON[_0x686a('0x50')](_0x19c3b6));ami['emit'](_0x686a('0x115'),ut[_0x686a('0xa3')](_0x3a5cee,_0x686a('0x116'),_0x1745f7['campaignsPreview'][_0x3a5cee[_0x686a('0x69')]]));_0x112c07(ut[_0x686a('0x48')](_0x686a('0x117')));})['catch'](function(_0x516f23){ut['logger']('[Preview][execCall][failure]',_0x516f23);_0x4dc115(ut['message'](_0x686a('0x118'),_0x42eee7,_0x27bba5));});}else{_0x4c1b5e[_0x686a('0x38')]+=0x1;ut[_0x686a('0x119')](_0x3a5cee);rpcDb[_0x686a('0x11a')](_0x3a5cee,'[Blacklist][error]');delete _0x1745f7[_0x686a('0x18')][_0x4f6a31];_0x4dc115(ut[_0x686a('0x48')](_0x686a('0x11b'),_0x42eee7,_0x27bba5));}});};Preview[_0x686a('0x5e')]['isTrunkReachable']=function(_0x37caa4){return!_[_0x686a('0x67')](_0x37caa4)&&!_[_0x686a('0x67')](_0x37caa4['name'])&&!_[_0x686a('0x67')](_0x37caa4[_0x686a('0x4d')])&&_0x37caa4[_0x686a('0x4d')]&&!_[_0x686a('0x67')](this['trunks'][util[_0x686a('0x51')](_0x686a('0x11c'),_0x37caa4[_0x686a('0x27')])])&&!_[_0x686a('0x67')](this[_0x686a('0x17')][util[_0x686a('0x51')]('SIP/%s',_0x37caa4[_0x686a('0x27')])][_0x686a('0x74')])&&(this['trunks'][util[_0x686a('0x51')]('SIP/%s',_0x37caa4['name'])]['status']===_0x686a('0x11d')||this[_0x686a('0x17')][util[_0x686a('0x51')](_0x686a('0x11c'),_0x37caa4[_0x686a('0x27')])][_0x686a('0x74')]==='unmonitored');};Preview[_0x686a('0x5e')][_0x686a('0x84')]=function(_0x19a9ae,_0x4d8d8b){var _0x3d1bee=this;return new BPromise(function(_0x38adf5,_0x3a9278){_0x3d1bee['execRun'](_0x19a9ae,_0x4d8d8b)['then'](function(_0x450ae1){_0x38adf5(_[_0x686a('0x6f')](_0x450ae1,[_0x686a('0x48')]));})[_0x686a('0x76')](function(_0x4e7820){if(_0x4e7820[_0x686a('0x11e')]){rpcDb[_0x686a('0x11f')](_0x19a9ae);}if(_0x4e7820[_0x686a('0x4d')]){rpcDb[_0x686a('0x87')](_0x19a9ae);}_0x3a9278(_['pick'](_0x4e7820,[_0x686a('0x48')]));});});};Preview['prototype']['execRun']=function(_0x12f9c5,_0x21da51){var _0x8923b9=this;return new BPromise(function(_0x5f10e0,_0x51b7d5){var _0x1731d1,_0x36a649;rpcDb[_0x686a('0x120')](_0x12f9c5)[_0x686a('0x7f')](function(_0x1574d9){if(!_[_0x686a('0x67')](_0x1574d9[0x0])){_0x36a649=_0x1574d9[0x0][_0x686a('0x121')]?![]:!![];_0x1731d1=_0x1574d9[0x0][_0x686a('0x121')]?!![]:![];_0x1731d1=_0x21da51?!![]:_0x1731d1;}var _0x35d923=_0x8923b9['validateContact'](_0x1574d9);if(_0x35d923[_0x686a('0x122')]){rpcDb[_0x686a('0x123')](_[_0x686a('0x6f')](_0x1574d9[0x0],[_0x686a('0x71'),_0x686a('0x124')]))['then'](function(_0x1802d9){_0x8923b9[_0x686a('0x125')](_0x1802d9,_0x1574d9[0x0],_0x21da51,_0x36a649,_0x1731d1)[_0x686a('0x7f')](function(_0x4720bd){_0x5f10e0(_0x4720bd);})[_0x686a('0x76')](function(_0x2496b9){_0x51b7d5(_0x2496b9);});})[_0x686a('0x76')](function(_0x3332ff){ut['logger']('[Preview][checkIsBlackList]',_0x3332ff);_0x51b7d5(ut['message'](_0x686a('0x126'),_0x36a649,_0x1731d1));});}else{_0x51b7d5(ut[_0x686a('0x48')](_0x35d923[_0x686a('0x48')],_0x36a649,_0x1731d1));}})[_0x686a('0x76')](function(_0x21fc50){ut[_0x686a('0x59')](_0x686a('0x127'),_0x21fc50);_0x51b7d5(ut['message'](_0x686a('0x126'),![],!![]));});});};Preview[_0x686a('0x5e')][_0x686a('0x128')]=function(_0x351e40){if(_['isNil'](_0x351e40)||_[_0x686a('0x111')](_0x351e40)||!_['isNil'](_0x351e40[0x0][_0x686a('0x83')])&&_[_0x686a('0x67')](_0x351e40[0x0][_0x686a('0x83')]['name'])){ut[_0x686a('0x59')]('[Preview][validateContact][Empty\x20Contact]',_0x351e40);return{'isValid':![],'message':_0x686a('0x129')};}var _0x5e7e1f=this[_0x686a('0x15')][_0x351e40[0x0][_0x686a('0x10f')][_0x686a('0x27')]];_0x5e7e1f['message']='ACTIVE';if(_[_0x686a('0x67')](_0x5e7e1f)){ut[_0x686a('0x59')](_0x686a('0x12a'),_0x5e7e1f);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x686a('0x99')](_0x5e7e1f[_0x686a('0x4c')])){ut['logger'](_0x686a('0x12b'),_0x686a('0x12c')+_0x5e7e1f[_0x686a('0x27')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x5e7e1f['TrunkBackup'])){ut['logger'](_0x686a('0x12b'),_0x5e7e1f[_0x686a('0x27')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0x686a('0x97')](_0x5e7e1f['dialActive'])){ut[_0x686a('0x59')](_0x686a('0x12d'),_0x5e7e1f[_0x686a('0x27')]+_0x686a('0x12e'));return{'isValid':![],'message':_0x686a('0x12c')+_0x5e7e1f[_0x686a('0x27')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x686a('0x5e')][_0x686a('0x112')]=function(_0x2c94eb,_0x19da45,_0x582fff,_0x52867a){var _0x49ef25=this;return new BPromise(function(_0x68e890,_0x3cf93f){var _0x2c3e53=_0x2c94eb['uniqueid'];var _0x123700=_0x49ef25[_0x686a('0x99')](_0x19da45['Trunk'])?util[_0x686a('0x51')](_0x686a('0x12f'),_0x19da45[_0x686a('0x4c')]['name'],_[_0x686a('0x67')](_0x19da45[_0x686a('0x35')])?'':_0x19da45['dialPrefix'][_0x686a('0x130')]()||'',_0x19da45[_0x686a('0x131')]>0x0?_0x582fff[_0x686a('0x124')][_0x686a('0x132')](_0x19da45['dialCutDigit']):_0x582fff[_0x686a('0x124')]):util[_0x686a('0x51')](_0x686a('0x12f'),_['isNil'](_0x19da45[_0x686a('0x9a')])?_0x19da45[_0x686a('0x4c')][_0x686a('0x27')]:_0x19da45[_0x686a('0x9a')]['name'],_[_0x686a('0x67')](_0x19da45['dialPrefix'])?'':_0x19da45[_0x686a('0x35')][_0x686a('0x130')]()||'',_0x19da45['dialCutDigit']>0x0?_0x582fff['phone'][_0x686a('0x132')](_0x19da45[_0x686a('0x131')]):_0x582fff[_0x686a('0x124')]);var _0x3df024=_0x49ef25[_0x686a('0x99')](_0x19da45[_0x686a('0x4c')])?ut[_0x686a('0x133')](_0x19da45[_0x686a('0x4c')][_0x686a('0x4e')],_0x19da45[_0x686a('0x33')],_0x19da45[_0x686a('0x134')]>0x0?ut[_0x686a('0x135')](_0x19da45[_0x686a('0x34')],_0x19da45[_0x686a('0x134')]):_0x19da45[_0x686a('0x34')]):ut[_0x686a('0x133')](_[_0x686a('0x67')](_0x19da45[_0x686a('0x9a')])?_0x19da45[_0x686a('0x4c')][_0x686a('0x4e')]:_0x19da45[_0x686a('0x9a')][_0x686a('0x4e')],_0x19da45[_0x686a('0x33')],_0x19da45[_0x686a('0x134')]>0x0?ut['getCallerIdRandom'](_0x19da45[_0x686a('0x34')],_0x19da45[_0x686a('0x134')]):_0x19da45[_0x686a('0x34')]);if(_0x3df024){_0x2c94eb[_0x686a('0x136')]=ut[_0x686a('0x137')](_0x3df024);_0x2c94eb[_0x686a('0x138')]=ut['extractCalleridNumber'](_0x3df024);}var _0x143fe1=ut[_0x686a('0x139')](_0x19da45,_0x582fff,_0x123700,_0x3df024,_0x2c3e53,_0x2c94eb);_[_0x686a('0x13a')](_0x2c94eb,ut[_0x686a('0x13b')](_0x143fe1));_0x2c94eb[_0x686a('0x88')]=moment()[_0x686a('0x51')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x686a('0x73')](ut[_0x686a('0x13c')](_0x2c94eb,_0x19da45,_0x143fe1,_0x2c94eb['activeContact'],_0x52867a))[_0x686a('0x7f')](function(_0x334cac){_0x19da45[_0x686a('0x6b')]+=0x1;logger['info'](_0x686a('0x13d'),_0x2c3e53,'\x20Queue',_0x19da45[_0x686a('0x27')],_0x686a('0x6a'),_0x19da45[_0x686a('0x6b')]);_0x68e890(_0x334cac);})[_0x686a('0x76')](function(_0x51fb3b){ut['logAgent'](_0x2c94eb,0xe,'OriginateError');rpcDb[_0x686a('0x103')](_0x2c94eb,_0x686a('0x13e'));_0x3cf93f(_0x51fb3b);});});};Preview[_0x686a('0x5e')]['syncNewExten']=function(_0x4e6866){if(this[_0x686a('0x18')][_0x4e6866[_0x686a('0xaf')]]){this[_0x686a('0x18')][_0x4e6866[_0x686a('0xaf')]][_0x686a('0x75')]=_0x4e6866['channel'];}};Preview[_0x686a('0x5e')][_0x686a('0x1a')]=function(_0x3ab753){var _0x27c1df=this;var _0x26901c=this[_0x686a('0x18')][_0x3ab753[_0x686a('0x13f')]];if(_0x26901c){if(_0x26901c['lookAgent']&&this[_0x686a('0x19')][_0x26901c[_0x686a('0x110')]]){ut['logLookAgent'](_0x26901c,this[_0x686a('0x19')][_0x26901c[_0x686a('0x110')]][_0x686a('0x27')],this['agents'][_0x26901c[_0x686a('0x110')]]['id']);}var _0x1ded0d=_[_0x686a('0x140')](_0x26901c);_0x1ded0d[_0x686a('0x141')]=moment()[_0x686a('0x51')](_0x686a('0x89'));var _0x318f35=_0x27c1df[_0x686a('0x15')][_0x26901c['queue']];if(ut[_0x686a('0x142')](_0x3ab753[_0x686a('0x143')])){if(_0x26901c['unlockAgent']){rpcDb[_0x686a('0x11f')](_0x26901c[_0x686a('0xb1')]);}if(_0x26901c['activeContact']){rpcDb[_0x686a('0x87')](_0x26901c[_0x686a('0xb1')]);}ami[_0x686a('0xa1')](_0x686a('0x144'),ut[_0x686a('0xa3')](_0x26901c,_0x686a('0x145'),this[_0x686a('0x15')][_0x26901c['queue']]));this[_0x686a('0x146')](_0x1ded0d,_0x318f35,_0x3ab753);}else{_0x26901c[_0x686a('0x88')]=moment()[_0x686a('0x51')](_0x686a('0x89'));ut[_0x686a('0x102')](_0x1ded0d,0x4,_0x686a('0xbd'));rpcDb[_0x686a('0x103')](_0x1ded0d,_0x686a('0x147'));}}};Preview['prototype'][_0x686a('0x1c')]=function(_0x36fe7b){var _0x23beaa=this;var _0x451595=this[_0x686a('0x18')][_0x36fe7b[_0x686a('0xaf')]];var _0x4623b5;if(_0x451595){_0x4623b5=this[_0x686a('0x15')][_0x451595['queue']];logger[_0x686a('0x53')]('[syncHangup][talking]',_0x36fe7b[_0x686a('0xaf')],_0x686a('0xb6'),_0x4623b5['name'],_0x686a('0x6c'),_0x4623b5[_0x686a('0x6d')]);}if(this[_0x686a('0x18')][_0x36fe7b[_0x686a('0xaf')]]&&_0x36fe7b[_0x686a('0xaf')]!==_0x36fe7b['uniqueid']){if(_0x36fe7b[_0x686a('0x148')]==='16'&&this[_0x686a('0x18')][_0x36fe7b[_0x686a('0xaf')]][_0x686a('0x6e')]){this['callProgressDetectingCustomer'](_0x36fe7b,_0x36fe7b[_0x686a('0xaf')],_0x36fe7b[_0x686a('0x148')]);}else if(this['actions'][_0x36fe7b[_0x686a('0xaf')]][_0x686a('0x6e')]){logger[_0x686a('0x53')]('[syncHangup][talking][cause]',_0x36fe7b[_0x686a('0xaf')],_0x36fe7b['cause'],_0x686a('0xb6'),_0x4623b5[_0x686a('0x27')],_0x686a('0x6c'),_0x4623b5[_0x686a('0x6d')]);this[_0x686a('0x9c')](_0x36fe7b,_0x36fe7b[_0x686a('0xaf')],_0x36fe7b[_0x686a('0x148')]);}}else if(_0x451595&&_[_0x686a('0x67')](_0x451595[_0x686a('0x149')])&&_0x4623b5[_0x686a('0x14a')]&&_0x36fe7b['linkedid']===_0x36fe7b[_0x686a('0xb5')]&&_[_0x686a('0x67')](_0x36fe7b['reason'])&&_0x36fe7b['cause']==='16'&&_0x36fe7b[_0x686a('0x14b')]==='6'&&_[_0x686a('0xff')](_0x451595['transfer'])){if(_0x451595[_0x686a('0xad')]){rpcDb[_0x686a('0x11f')](_0x451595[_0x686a('0xb1')]);}if(_0x451595[_0x686a('0xae')]){rpcDb[_0x686a('0x87')](_0x451595[_0x686a('0xb1')]);}_0x36fe7b[_0x686a('0x101')]='22';this['callProgressDetectingAgent'](_0x451595,_0x4623b5,_0x36fe7b);}else if(_0x451595&&_0x451595['transfer']){if(_0x36fe7b[_0x686a('0x148')]==='16'&&this[_0x686a('0x18')][_0x36fe7b['linkedid']][_0x686a('0x6e')]){logger['info'](_0x686a('0x14c'),_0x36fe7b[_0x686a('0xaf')],_0x36fe7b['cause'],_0x686a('0xb6'),_0x4623b5[_0x686a('0x27')],'pTalking:\x20',_0x4623b5[_0x686a('0x6d')]);this[_0x686a('0x9c')](_0x36fe7b,_0x36fe7b['linkedid'],_0x36fe7b['cause']);}else if(this[_0x686a('0x18')][_0x36fe7b[_0x686a('0xaf')]]['dialAnswer']){logger[_0x686a('0x53')](_0x686a('0x14d'),_0x36fe7b['linkedid'],_0x36fe7b[_0x686a('0x148')],_0x686a('0xb6'),_0x4623b5[_0x686a('0x27')],'pTalking:\x20',_0x4623b5[_0x686a('0x6d')]);this[_0x686a('0x9c')](_0x36fe7b,_0x36fe7b[_0x686a('0xaf')],_0x36fe7b['cause']);}}};Preview[_0x686a('0x5e')]['syncDialEnd']=function(_0x149589){if(this[_0x686a('0x18')][_0x149589[_0x686a('0x14e')]]&&_0x149589[_0x686a('0x14e')]!==_0x149589['destuniqueid']){this[_0x686a('0x9c')](_0x149589,_0x149589[_0x686a('0x14e')],_0x149589[_0x686a('0xf5')]);}};Preview[_0x686a('0x5e')]['syncHangupRequest']=function(_0x1cf7aa){if(this[_0x686a('0x18')][_0x1cf7aa['linkedid']]&&_0x1cf7aa[_0x686a('0xaf')]!==_0x1cf7aa[_0x686a('0xb5')]&&!this[_0x686a('0x18')][_0x1cf7aa[_0x686a('0xaf')]][_0x686a('0x6e')]){if(_0x1cf7aa[_0x686a('0x148')]==='1'){this[_0x686a('0x9c')](_0x1cf7aa,_0x1cf7aa['linkedid'],_0x1cf7aa['cause']);}}};Preview[_0x686a('0x5e')][_0x686a('0x14f')]=function(_0x28f4a7,_0x3c4ef6,_0xeabc90){if(this[_0x686a('0x18')][_0x28f4a7]){if(_[_0x686a('0x67')](this[_0x686a('0x18')][_0x28f4a7][_0x686a('0x150')])){this['actions'][_0x28f4a7][_0x686a('0x150')]={};}this[_0x686a('0x18')][_0x28f4a7][_0x686a('0x150')][_0x3c4ef6]=_0xeabc90;}};Preview[_0x686a('0x5e')][_0x686a('0x151')]=function(_0x2a3af1){try{if(!_['isNil'](_0x2a3af1)){if(ut[_0x686a('0x152')](_[_0x686a('0x153')](_0x2a3af1[_0x686a('0x154')])[0x0])){this['addVariable'](_0x2a3af1[_0x686a('0xb5')],_[_0x686a('0x153')](_0x2a3af1[_0x686a('0x154')])[0x0],_0x2a3af1[_0x686a('0x155')]);}}}catch(_0x4f98dc){logger[_0x686a('0x156')]('[syncVarSet][Preview]',util['inspect'](_0x4f98dc,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x9b0dce){if(_0x9b0dce){if(this['actions'][_0x9b0dce[_0x686a('0x157')]]){this[_0x686a('0x18')][_0x9b0dce['transfertargetlinkedid']][_0x686a('0x158')]=!![];}}};Preview[_0x686a('0x5e')][_0x686a('0x24')]=function(_0x5887b9){if(_0x5887b9){if(this['actions'][_0x5887b9[_0x686a('0x159')]]){this[_0x686a('0x18')][_0x5887b9[_0x686a('0x159')]]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0xdd37=['sumDuration','sumHoldTime','total','unmanaged','abandoned','loggedInDb','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','name','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','available','paused','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','clearZombieChannels','preview','dialActive','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pTalking','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','size','getContactRecallMe','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','totalGlobal','NoSuchNumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','responsetime','uniqueid','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','countglobal','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','\x20Queue','BUSY','buildObj','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','countbusyretry','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','cloneAction','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','outboundRejectCallsDay','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','countagentrejectretry','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[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]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','updateOriginated','[callProgressDetectingAgent]','resolve','[incrementPreviewCounters]\x20','Contact','phone','lookAgent','execCall','[Preview][execCall][success]','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','isEmpty','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridnum','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','callProgressDetectingCustomer','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','variable','keys','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/logger','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','answered','loggedIn','sumBillable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd37,0x12d));var _0x7dd3=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xdd37[_0x46aff0];return _0x9d78cf;};'use strict';var util=require('util');var _=require(_0x7dd3('0x0'));var BPromise=require(_0x7dd3('0x1'));var uuid=require(_0x7dd3('0x2'));var moment=require(_0x7dd3('0x3'));var md5=require(_0x7dd3('0x4'));var Redis=require(_0x7dd3('0x5'));var config=require('../../../config/environment');var logger=require(_0x7dd3('0x6'))('preview');var loggerAction=require(_0x7dd3('0x6'))(_0x7dd3('0x7'));var ami=require('../ami');var rpcDb=require(_0x7dd3('0x8'));var cmHopperAdditionalPhone=require(_0x7dd3('0x9'));var Action=require(_0x7dd3('0xa'));var ut=require(_0x7dd3('0xb'));config[_0x7dd3('0xc')]=_['defaults'](config[_0x7dd3('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x7dd3('0xd'))(new Redis(config[_0x7dd3('0xc')]));var Sequence=function(){};Sequence[_0x7dd3('0xe')][_0x7dd3('0xf')]=function(_0x4bee24){this['tail']=this[_0x7dd3('0x10')]?this[_0x7dd3('0x10')]['finally'](_0x4bee24):_0x4bee24();};function Preview(_0x25dd3c){this[_0x7dd3('0x11')]=new Sequence();this[_0x7dd3('0x12')]=_0x25dd3c[_0x7dd3('0x13')];this[_0x7dd3('0x14')]=_0x25dd3c['trunks'];this[_0x7dd3('0x15')]={};this[_0x7dd3('0x16')]=_0x25dd3c[_0x7dd3('0x16')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x7dd3('0x17')](this));ami['on']('hangup',this[_0x7dd3('0x18')][_0x7dd3('0x17')](this));ami['on'](_0x7dd3('0x19'),this[_0x7dd3('0x1a')][_0x7dd3('0x17')](this));ami['on'](_0x7dd3('0x1b'),this[_0x7dd3('0x1c')]['bind'](this));ami['on'](_0x7dd3('0x1d'),this[_0x7dd3('0x1e')][_0x7dd3('0x17')](this));ami['on']('varset',this[_0x7dd3('0x1f')][_0x7dd3('0x17')](this));ami['on'](_0x7dd3('0x20'),this[_0x7dd3('0x21')][_0x7dd3('0x17')](this));ami['on']('blindtransfer',this[_0x7dd3('0x22')][_0x7dd3('0x17')](this));this[_0x7dd3('0x23')](this[_0x7dd3('0x12')]);}function emit(_0xbbabe4,_0x2b8fdd,_0x3ff540){io['to'](_0xbbabe4)[_0x7dd3('0x24')](_0x2b8fdd,_0x3ff540);}function emitCampaignPreview(_0x25661d){if(_0x25661d[_0x7dd3('0x25')]===_0x7dd3('0x26')){var _0x3b794e={'id':_0x25661d['id'],'name':_0x25661d['name'],'strategy':_0x25661d['strategy'],'answered':_0x25661d[_0x7dd3('0x27')],'available':_0x25661d['available'],'loggedIn':_0x25661d[_0x7dd3('0x28')],'pTalking':_0x25661d['pTalking'],'sumBillable':_0x25661d[_0x7dd3('0x29')],'sumDuration':_0x25661d[_0x7dd3('0x2a')],'sumHoldTime':_0x25661d[_0x7dd3('0x2b')]||0x0,'talking':_0x25661d['talking'],'total':_0x25661d[_0x7dd3('0x2c')],'type':_0x25661d[_0x7dd3('0x25')],'unmanaged':_0x25661d[_0x7dd3('0x2d')],'abandoned':_0x25661d[_0x7dd3('0x2e')],'waiting':_0x25661d['waiting'],'loggedInDb':_0x25661d[_0x7dd3('0x2f')],'dialActive':_0x25661d['dialActive'],'dialMethod':_0x25661d['dialMethod'],'dialOriginateCallerIdName':_0x25661d['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x25661d[_0x7dd3('0x30')],'dialOriginateTimeout':_0x25661d[_0x7dd3('0x31')],'dialPrefix':_0x25661d['dialPrefix'],'outboundAnswerAgiCallsDay':_0x25661d[_0x7dd3('0x32')],'outboundAnswerCallsDay':_0x25661d[_0x7dd3('0x33')],'outboundBlacklistCallsDay':_0x25661d[_0x7dd3('0x34')],'outboundBusyCallsDay':_0x25661d['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x25661d[_0x7dd3('0x35')],'outboundDropCallsDayACS':_0x25661d[_0x7dd3('0x36')],'outboundDropCallsDayCallersExit':_0x25661d[_0x7dd3('0x37')],'outboundDropCallsDayTimeout':_0x25661d[_0x7dd3('0x38')],'outboundNoAnswerCallsDay':_0x25661d['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x25661d[_0x7dd3('0x39')],'outboundOriginateFailureCallsDay':_0x25661d[_0x7dd3('0x3a')],'outboundReCallsDay':_0x25661d[_0x7dd3('0x3b')],'outboundRejectCallsDay':_0x25661d['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x25661d[_0x7dd3('0x3c')],'outboundAbandonedCallsDay':_0x25661d['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x25661d[_0x7dd3('0x3d')],'predictiveIntervalAvgHoldtime':_0x25661d[_0x7dd3('0x3e')],'predictiveIntervalAvgTalktime':_0x25661d['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x25661d[_0x7dd3('0x3f')],'predictiveIntervalDroppedCallsTimeout':_0x25661d[_0x7dd3('0x40')],'predictiveIntervalErlangCalls':_0x25661d[_0x7dd3('0x41')],'predictiveIntervalErlangCallsDroppedCalls':_0x25661d['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x25661d[_0x7dd3('0x42')],'predictiveIntervalMultiplicativeFactor':_0x25661d[_0x7dd3('0x43')],'predictiveIntervalPauses':_0x25661d[_0x7dd3('0x44')],'predictiveIntervalAvailable':_0x25661d['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x25661d[_0x7dd3('0x45')],'message':_0x25661d['message'],'originated':_0x25661d[_0x7dd3('0x46')],'erlangCalls':_0x25661d[_0x7dd3('0x47')],'erlangCallToSecond':_0x25661d[_0x7dd3('0x48')],'erlangAbandonmentRate':_0x25661d[_0x7dd3('0x49')],'erlangBusyFactor':_0x25661d[_0x7dd3('0x4a')],'startPredictive':_0x25661d['startPredictive'],'startProgressive':_0x25661d[_0x7dd3('0x4b')]};if(_0x25661d[_0x7dd3('0x4c')]){_0x3b794e[_0x7dd3('0x4c')]={'id':_0x25661d[_0x7dd3('0x4c')]['id'],'name':_0x25661d[_0x7dd3('0x4c')][_0x7dd3('0x4d')],'active':_0x25661d[_0x7dd3('0x4c')][_0x7dd3('0x4e')],'callerid':_0x25661d[_0x7dd3('0x4c')][_0x7dd3('0x4f')]};}if(_0x25661d[_0x7dd3('0x50')]){_0x3b794e[_0x7dd3('0x50')]={'id':_0x25661d[_0x7dd3('0x50')]['id'],'name':_0x25661d['Interval'][_0x7dd3('0x4d')]};}var _0x30395f=md5(JSON[_0x7dd3('0x51')](_0x3b794e));if(_0x25661d[_0x7dd3('0x4')]!==_0x30395f){_0x25661d['md5']=_0x30395f;emit(util[_0x7dd3('0x52')](_0x7dd3('0x53'),_0x3b794e['name']),_0x7dd3('0x54'),_0x3b794e);}}}function emitVoiceQueueChannelRemove(_0x54901d){logger[_0x7dd3('0x55')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x54901d));emit(util[_0x7dd3('0x52')](_0x7dd3('0x53'),_0x54901d['name']),_0x7dd3('0x56'),_0x54901d);io[_0x7dd3('0x24')](_0x7dd3('0x57'),_0x54901d);}function notSendMessagesQueue(_0x444be7){if(_0x444be7[_0x7dd3('0x58')]){if(_0x444be7[_0x7dd3('0x46')]===0x0&&_0x444be7['pTalking']===0x0){_0x444be7[_0x7dd3('0x58')]=![];_0x444be7[_0x7dd3('0x59')]=0x0;_0x444be7[_0x7dd3('0x5a')]=0x0;_0x444be7[_0x7dd3('0x5b')]=_0x7dd3('0x5c');ut[_0x7dd3('0x5d')](_0x7dd3('0x5e'),_0x444be7[_0x7dd3('0x4d')]+_0x7dd3('0x5f'));}else{_0x444be7[_0x7dd3('0x5b')]='IS_DISACTIVED';ut[_0x7dd3('0x5d')](_0x7dd3('0x5e'),_0x444be7[_0x7dd3('0x4d')]+_0x7dd3('0x60'));}emitCampaignPreview(_0x444be7);}}Preview['prototype'][_0x7dd3('0x23')]=function(){var _0x315af9=this;setInterval(function(){_0x315af9[_0x7dd3('0x61')]();},0x7cf);};Preview[_0x7dd3('0xe')][_0x7dd3('0x61')]=function(){var _0x46dd1c=this[_0x7dd3('0x12')];this[_0x7dd3('0x62')]+=0x1;for(var _0x92075d in _0x46dd1c){if(_0x46dd1c[_0x7dd3('0x63')](_0x92075d)&&(_0x46dd1c[_0x92075d][_0x7dd3('0x64')]==='preview'||_0x46dd1c[_0x92075d][_0x7dd3('0x64')]==='booked')&&_0x46dd1c[_0x92075d]['type']===_0x7dd3('0x26')){if(this[_0x7dd3('0x62')]>0x7){this[_0x7dd3('0x62')]=0x0;this[_0x7dd3('0x65')]();}}if(_0x46dd1c[_0x7dd3('0x63')](_0x92075d)&&_0x46dd1c[_0x92075d]['dialMethod']===_0x7dd3('0x66')&&_0x46dd1c[_0x92075d]['type']==='outbound'){if(_0x46dd1c[_0x92075d][_0x7dd3('0x67')]){this[_0x7dd3('0x68')](_0x46dd1c[_0x92075d]);this[_0x7dd3('0x69')](_0x46dd1c[_0x92075d]);}else{notSendMessagesQueue(_0x46dd1c[_0x92075d]);}}}};Preview[_0x7dd3('0xe')][_0x7dd3('0x6a')]=function(_0x59e7e4){var _0xf3ff8f=this;this[_0x7dd3('0x11')][_0x7dd3('0xf')](function(){if(!_[_0x7dd3('0x6b')](_0xf3ff8f[_0x7dd3('0x15')][_0x59e7e4])){loggerAction['info'](_0x7dd3('0x6c'),_0x59e7e4,_0x7dd3('0x6d'),_0xf3ff8f['actions'][_0x59e7e4][_0x7dd3('0x6e')],_0x7dd3('0x6f'),JSON[_0x7dd3('0x51')](_0xf3ff8f[_0x7dd3('0x12')][_0xf3ff8f[_0x7dd3('0x15')][_0x59e7e4][_0x7dd3('0x6e')]][_0x7dd3('0x46')]),_0x7dd3('0x70'),JSON[_0x7dd3('0x51')](_0xf3ff8f[_0x7dd3('0x12')][_0xf3ff8f[_0x7dd3('0x15')][_0x59e7e4][_0x7dd3('0x6e')]][_0x7dd3('0x71')]),JSON[_0x7dd3('0x51')](_0xf3ff8f['actions'][_0x59e7e4][_0x7dd3('0x72')]),JSON[_0x7dd3('0x51')](_[_0x7dd3('0x73')](_0xf3ff8f[_0x7dd3('0x15')][_0x59e7e4],[_0x7dd3('0x74'),_0x7dd3('0x75'),_0x7dd3('0x76'),_0x7dd3('0x77')])));return ami[_0x7dd3('0x78')]({'action':_0x7dd3('0x79'),'channel':_0xf3ff8f['actions'][_0x59e7e4][_0x7dd3('0x7a')]})[_0x7dd3('0x7b')](function(_0x581c7c){if(_0x581c7c[_0x7dd3('0x5b')]===_0x7dd3('0x7c')){setTimeout(function(){if(_0xf3ff8f[_0x7dd3('0x15')][_0x59e7e4]){ut['updateOriginated'](_0xf3ff8f[_0x7dd3('0x12')][_0xf3ff8f[_0x7dd3('0x15')][_0x59e7e4][_0x7dd3('0x6e')]],_0x7dd3('0x7d'));if(_0xf3ff8f[_0x7dd3('0x15')][_0x59e7e4][_0x7dd3('0x72')]===!![]){ut[_0x7dd3('0x7e')](_0xf3ff8f[_0x7dd3('0x12')][_0xf3ff8f[_0x7dd3('0x15')][_0x59e7e4][_0x7dd3('0x6e')]],'[clearZombieChannel]');ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x59e7e4,_0xf3ff8f[_0x7dd3('0x15')][_0x59e7e4][_0x7dd3('0x6e')]);}ut[_0x7dd3('0x7f')](_0x7dd3('0x80')+_0x59e7e4,_0xf3ff8f[_0x7dd3('0x15')][_0x59e7e4][_0x7dd3('0x6e')]);delete _0xf3ff8f[_0x7dd3('0x15')][_0x59e7e4];}},0x2328);}});}});};Preview[_0x7dd3('0xe')][_0x7dd3('0x65')]=function(){var _0x56f8af=this;loggerAction['info']('[action]',_[_0x7dd3('0x81')](this[_0x7dd3('0x15')]));for(var _0x2d8c02 in this[_0x7dd3('0x15')]){if(_0x56f8af[_0x7dd3('0x15')][_0x7dd3('0x63')](_0x2d8c02)){_0x56f8af[_0x7dd3('0x6a')](_0x2d8c02);}}};Preview['prototype'][_0x7dd3('0x69')]=function(_0x33f34e){var _0x34f246=this;rpcDb[_0x7dd3('0x82')](_0x33f34e['id'],ut['agentReadyId'](this[_0x7dd3('0x16')]))[_0x7dd3('0x83')](function(_0x54f882){if(!_[_0x7dd3('0x6b')](_0x54f882)){for(var _0x45149f=0x0;_0x45149f<_0x54f882[_0x7dd3('0x84')];_0x45149f+=0x1){if(ut['getDiff'](_0x54f882[_0x45149f][_0x7dd3('0x85')])<_0x33f34e[_0x7dd3('0x86')]*0x3c){if(_0x54f882[_0x45149f][_0x7dd3('0x87')]&&!_0x54f882[_0x45149f][_0x7dd3('0x87')][_0x7dd3('0x88')]){_0x34f246[_0x7dd3('0x89')](_0x54f882[_0x45149f]['id'])['then'](ut[_0x7dd3('0x8a')](_0x7dd3('0x8b')))[_0x7dd3('0x7b')](ut['logger2'](_0x7dd3('0x8b')));}else{rpcDb[_0x7dd3('0x8c')](_0x54f882[_0x45149f]['id']);}}else{var _0x114d0b=new Action(_0x54f882[_0x45149f],_0x33f34e);_0x114d0b[_0x7dd3('0x8d')]=moment()[_0x7dd3('0x52')](_0x7dd3('0x8e'));_0x33f34e['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x114d0b,0x17,'RecallInQueue');if(_0x33f34e[_0x7dd3('0x8f')]){rpcDb[_0x7dd3('0x90')](ut[_0x7dd3('0x91')](_0x54f882[_0x45149f]));rpcDb['createCustomerHistory'](_0x114d0b,_0x7dd3('0x92'));}else{ut[_0x7dd3('0x93')](_0x114d0b,0x16,_0x7dd3('0x94'));rpcDb[_0x7dd3('0x95')](_0x114d0b,_0x7dd3('0x96'));rpcDb[_0x7dd3('0x97')](_0x114d0b,_0x7dd3('0x96'));}}}}})[_0x7dd3('0x7b')](ut[_0x7dd3('0x8a')](_0x7dd3('0x98')));};Preview[_0x7dd3('0xe')]['setMessage']=function(_0x4ceefc){_0x4ceefc[_0x7dd3('0x58')]=!![];if(ut[_0x7dd3('0x99')](_0x4ceefc[_0x7dd3('0x28')])){_0x4ceefc['message']=_0x7dd3('0x9a');}else if(!ut[_0x7dd3('0x9b')](_0x4ceefc[_0x7dd3('0x67')])){_0x4ceefc[_0x7dd3('0x5b')]=_0x7dd3('0x5c');}else if(!this[_0x7dd3('0x9c')](_0x4ceefc[_0x7dd3('0x4c')])){if(!this[_0x7dd3('0x9c')](_0x4ceefc[_0x7dd3('0x9d')])){_0x4ceefc[_0x7dd3('0x5b')]=_0x7dd3('0x9e');}else{_0x4ceefc[_0x7dd3('0x5b')]='ACTIVE';}}else{_0x4ceefc[_0x7dd3('0x5b')]=_0x7dd3('0x9f');}emitCampaignPreview(_0x4ceefc);};Preview[_0x7dd3('0xe')]['callProgressDetectingCustomer']=function(_0x125b10,_0x19fad2,_0x53c170){var _0x12de1c=this;var _0x2dc44d=this[_0x7dd3('0x15')][_0x19fad2];var _0x176259=this['campaignsPreview'][_0x2dc44d['queue']];var _0x202bac;var _0x28f467=![];var _0x494394=0x2;var _0x1b21fc=0x3;if(_0x176259){switch(_0x53c170){case'1':_0x176259[_0x7dd3('0x39')]+=0x1;_0x2dc44d[_0x7dd3('0xa0')]+=0x1;_0x2dc44d['countglobal']=ut[_0x7dd3('0xa1')](_0x2dc44d);ut[_0x7dd3('0x93')](_0x2dc44d,0x0,_0x7dd3('0xa2'));ami[_0x7dd3('0x24')]('custom:agentnosuchnumber',ut['buildObj'](_0x2dc44d,_0x7dd3('0xa3')));rpcDb[_0x7dd3('0x95')](_0x2dc44d,_0x7dd3('0xa4'));_0x12de1c[_0x7dd3('0xa5')](_0x2dc44d,'0',_0x176259)[_0x7dd3('0x83')](function(_0xd33e41){_0x28f467=_0xd33e41[_0x7dd3('0xa6')]==0x1;_0x494394=_0x176259[_0x7dd3('0xa7')];_0x1b21fc=_0x176259[_0x7dd3('0xa8')];if(!_0x28f467){if(ut[_0x7dd3('0xa1')](_0x2dc44d)>=_0x176259[_0x7dd3('0xa9')]){_0x202bac=ut['cloneAction'](_0x2dc44d,0xf,_0x7dd3('0xaa'));rpcDb[_0x7dd3('0x97')](_0x202bac,_0x7dd3('0xab'));}else{if(_0x2dc44d[_0x7dd3('0xa0')]>=_0x176259[_0x7dd3('0xac')]){rpcDb[_0x7dd3('0x97')](_0x2dc44d,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x7dd3('0xad')](ut[_0x7dd3('0xae')](_0x2dc44d,_0x7dd3('0xa0'),_0x176259['dialNoSuchNumberRetryFrequency']),_0x2dc44d[_0x7dd3('0xaf')],_0x2dc44d[_0x7dd3('0xb0')]);}}delete this[_0x7dd3('0x15')][_0x125b10[_0x7dd3('0xb1')]];}else{_0x2dc44d['countnosuchnumberretry']++;logger[_0x7dd3('0x55')](_0x7dd3('0xb2'),_0x2dc44d[_0x7dd3('0xa0')]);logger[_0x7dd3('0x55')]('id',_0x2dc44d[_0x7dd3('0xb3')]);_0x12de1c[_0x7dd3('0xb4')]({'id':_0x2dc44d[_0x7dd3('0xb3')],'field':{'countnosuchnumberretry':_0x2dc44d['countnosuchnumberretry']}})[_0x7dd3('0x83')](function(){_0x12de1c[_0x7dd3('0xb5')](_0x2dc44d,_0x494394,_0x1b21fc)[_0x7dd3('0x83')](function(){});});}});break;case'ANSWER':var _0x540094=moment()[_0x7dd3('0x52')](_0x7dd3('0x8e'));_0x2dc44d[_0x7dd3('0xb6')]=_0x540094;_0x2dc44d['answertime']=_0x540094;_0x2dc44d[_0x7dd3('0x72')]=!![];_0x176259[_0x7dd3('0x71')]+=0x1;logger[_0x7dd3('0x55')]('[syncHangup][talking][increment]',_0x2dc44d[_0x7dd3('0xb7')],'\x20Queue',_0x176259[_0x7dd3('0x4d')],_0x7dd3('0x70'),_0x176259[_0x7dd3('0x71')]);ami[_0x7dd3('0x24')](_0x7dd3('0xb8'),ut['buildObj'](_0x2dc44d,'connect',this[_0x7dd3('0x12')][_0x2dc44d[_0x7dd3('0x6e')]]));if(_0x176259[_0x7dd3('0xb9')]){ami[_0x7dd3('0x24')](_0x7dd3('0xba'),ut[_0x7dd3('0xbb')](_0x2dc44d));}break;case'16':ami[_0x7dd3('0x24')](_0x7dd3('0xbc'),ut['buildObj'](_0x2dc44d,_0x7dd3('0xbd'),this[_0x7dd3('0x12')][_0x2dc44d[_0x7dd3('0x6e')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2dc44d,_0x7dd3('0xbd')));_0x176259[_0x7dd3('0x33')]+=0x1;_0x176259[_0x7dd3('0x2c')]+=0x1;_0x176259[_0x7dd3('0x27')]+=0x1;ut['decrementTalkink'](_0x176259,_0x7dd3('0xbe'));_0x2dc44d[_0x7dd3('0xbf')]=ut['totalGlobal'](_0x2dc44d);ut[_0x7dd3('0x93')](_0x2dc44d,0x4,'Answer');rpcDb[_0x7dd3('0x95')](_0x2dc44d,_0x7dd3('0xc0'));rpcDb[_0x7dd3('0x97')](_0x2dc44d,_0x7dd3('0xc1'));rpcDb['crateCustomerReportQueue'](_0x2dc44d);_0x176259['sumDuration']+=_0x2dc44d['talktime'];_0x176259['sumBillable']+=_0x2dc44d[_0x7dd3('0xc2')];logger[_0x7dd3('0x55')]('[syncHangup][talking][decrement]',_0x2dc44d[_0x7dd3('0xb7')],_0x7dd3('0xc3'),_0x176259[_0x7dd3('0x4d')],'pTalking:\x20',_0x176259['pTalking']);delete this['actions'][_0x125b10['linkedid']];break;case _0x7dd3('0xc4'):_0x176259['outboundBusyCallsDay']+=0x1;_0x2dc44d['countbusyretry']+=0x1;_0x2dc44d['countglobal']=ut[_0x7dd3('0xa1')](_0x2dc44d);ut[_0x7dd3('0x93')](_0x2dc44d,0x5,'Busy');_0x494394=_0x176259['dialBusyRetryFrequency'];_0x1b21fc=_0x176259[_0x7dd3('0xa8')];ami['emit']('custom:agentbusy',ut[_0x7dd3('0xc5')](_0x2dc44d,_0x7dd3('0xc6')));rpcDb[_0x7dd3('0x95')](_0x2dc44d,_0x7dd3('0xc7'));_0x12de1c[_0x7dd3('0xa5')](_0x2dc44d,'5',_0x176259)[_0x7dd3('0x83')](function(_0x4d0f77){_0x28f467=_0x4d0f77[_0x7dd3('0xa6')]==0x1;if(!_0x28f467){if(ut[_0x7dd3('0xa1')](_0x2dc44d)>=_0x176259['dialGlobalMaxRetry']){_0x202bac=ut['cloneAction'](_0x2dc44d,0xf,_0x7dd3('0xaa'));rpcDb[_0x7dd3('0x97')](_0x202bac,_0x7dd3('0xc8'));}else{if(_0x2dc44d['countbusyretry']>=_0x176259[_0x7dd3('0xc9')]){rpcDb[_0x7dd3('0x97')](_0x2dc44d,_0x7dd3('0xc7'));}else{rpcDb[_0x7dd3('0xad')](ut['scheduledAt'](_0x2dc44d,_0x7dd3('0xca'),_0x176259[_0x7dd3('0xcb')]),_0x2dc44d[_0x7dd3('0xaf')],_0x2dc44d[_0x7dd3('0xb0')]);}}}else{_0x2dc44d['countbusyretry']++;_0x12de1c[_0x7dd3('0xb4')]({'id':_0x2dc44d[_0x7dd3('0xb3')],'field':{'countbusyretry':_0x2dc44d['countbusyretry']}})['then'](function(){_0x12de1c['swapAdditionalPhones'](_0x2dc44d,_0x494394,_0x1b21fc)['then'](function(){});});}});break;case _0x7dd3('0xcc'):_0x176259[_0x7dd3('0xcd')]+=0x1;_0x2dc44d[_0x7dd3('0xce')]+=0x1;_0x2dc44d[_0x7dd3('0xbf')]=ut[_0x7dd3('0xa1')](_0x2dc44d);ut[_0x7dd3('0x93')](_0x2dc44d,0x3,'NoAnswer');_0x494394=_0x176259[_0x7dd3('0xcf')];_0x1b21fc=_0x176259[_0x7dd3('0xa8')];ami['emit'](_0x7dd3('0xd0'),ut['buildObj'](_0x2dc44d,'noanswer'));rpcDb['createCustomerHistory'](_0x2dc44d,_0x7dd3('0xd1'));_0x12de1c[_0x7dd3('0xa5')](_0x2dc44d,'3',_0x176259)[_0x7dd3('0x83')](function(_0x6ff111){_0x28f467=_0x6ff111['additional']==0x1;if(!_0x28f467){if(ut[_0x7dd3('0xa1')](_0x2dc44d)>=_0x176259['dialGlobalMaxRetry']){_0x202bac=ut['cloneAction'](_0x2dc44d,0xf,_0x7dd3('0xaa'));rpcDb['createCustomerFinal'](_0x202bac,_0x7dd3('0xd2'));}else{if(_0x2dc44d[_0x7dd3('0xce')]>=_0x176259[_0x7dd3('0xd3')]){rpcDb[_0x7dd3('0x97')](_0x2dc44d,_0x7dd3('0xd1'));}else{rpcDb[_0x7dd3('0xad')](ut[_0x7dd3('0xae')](_0x2dc44d,_0x7dd3('0xce'),_0x176259[_0x7dd3('0xcf')]),_0x2dc44d[_0x7dd3('0xaf')],_0x2dc44d[_0x7dd3('0xb0')]);}}}else{_0x2dc44d[_0x7dd3('0xce')]++;_0x12de1c[_0x7dd3('0xb4')]({'id':_0x2dc44d[_0x7dd3('0xb3')],'field':{'countnoanswerretry':_0x2dc44d[_0x7dd3('0xce')]}})[_0x7dd3('0x83')](function(){_0x12de1c[_0x7dd3('0xb5')](_0x2dc44d,_0x494394,_0x1b21fc)[_0x7dd3('0x83')](function(){});});}});break;case'CONGESTION':_0x176259[_0x7dd3('0x35')]+=0x1;_0x2dc44d[_0x7dd3('0xd4')]+=0x1;_0x2dc44d[_0x7dd3('0xbf')]=ut[_0x7dd3('0xa1')](_0x2dc44d);ut[_0x7dd3('0x93')](_0x2dc44d,0x8,_0x7dd3('0xd5'));_0x494394=_0x176259[_0x7dd3('0xd6')];_0x1b21fc=_0x176259[_0x7dd3('0xa8')];ami[_0x7dd3('0x24')](_0x7dd3('0xd7'),ut['buildObj'](_0x2dc44d,'congestion'));rpcDb[_0x7dd3('0x95')](_0x2dc44d,_0x7dd3('0xd8'));_0x12de1c[_0x7dd3('0xa5')](_0x2dc44d,'8',_0x176259)[_0x7dd3('0x83')](function(_0x304cf6){_0x28f467=_0x304cf6[_0x7dd3('0xa6')]==0x1;if(!_0x28f467){if(ut[_0x7dd3('0xa1')](_0x2dc44d)>=_0x176259['dialGlobalMaxRetry']){_0x202bac=ut[_0x7dd3('0xd9')](_0x2dc44d,0xf,_0x7dd3('0xaa'));rpcDb[_0x7dd3('0x97')](_0x202bac,_0x7dd3('0xda'));}else{if(_0x2dc44d[_0x7dd3('0xd4')]>=_0x176259['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x2dc44d,_0x7dd3('0xd8'));}else{rpcDb[_0x7dd3('0xad')](ut[_0x7dd3('0xae')](_0x2dc44d,_0x7dd3('0xd4'),_0x176259[_0x7dd3('0xcb')]),_0x2dc44d[_0x7dd3('0xaf')],_0x2dc44d[_0x7dd3('0xb0')]);}}}else{_0x2dc44d['countcongestionretry']++;_0x12de1c[_0x7dd3('0xb4')]({'id':_0x2dc44d[_0x7dd3('0xb3')],'field':{'countcongestionretry':_0x2dc44d[_0x7dd3('0xd4')]}})['then'](function(){_0x12de1c[_0x7dd3('0xb5')](_0x2dc44d,_0x494394,_0x1b21fc)['then'](function(){});});}});break;case _0x7dd3('0xdb'):_0x176259[_0x7dd3('0xdc')]+=0x1;_0x2dc44d['countagentrejectretry']+=0x1;_0x2dc44d[_0x7dd3('0xbf')]=ut[_0x7dd3('0xa1')](_0x2dc44d);ut[_0x7dd3('0x93')](_0x2dc44d,0x14,'AgentReject');_0x494394=_0x176259[_0x7dd3('0xdd')];_0x1b21fc=_0x176259[_0x7dd3('0xa8')];ami['emit'](_0x7dd3('0xde'),ut['buildObj'](_0x2dc44d,_0x7dd3('0xdf')));rpcDb['createCustomerHistory'](_0x2dc44d,_0x7dd3('0xe0'));_0x12de1c[_0x7dd3('0xa5')](_0x2dc44d,'20',_0x176259)['then'](function(_0x1fc116){_0x28f467=_0x1fc116[_0x7dd3('0xa6')]==0x1;if(!_0x28f467){if(ut[_0x7dd3('0xa1')](_0x2dc44d)>=_0x176259[_0x7dd3('0xa9')]){_0x202bac=ut[_0x7dd3('0xd9')](_0x2dc44d,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x202bac,_0x7dd3('0xe1'));}else{if(_0x2dc44d['countagentrejectretry']>=_0x176259[_0x7dd3('0xe2')]){rpcDb['createCustomerFinal'](_0x2dc44d,_0x7dd3('0xe1'));}else{rpcDb[_0x7dd3('0xad')](ut['scheduledAt'](_0x2dc44d,_0x7dd3('0xe3'),_0x176259[_0x7dd3('0xdd')]),_0x2dc44d[_0x7dd3('0xaf')],_0x2dc44d[_0x7dd3('0xb0')]);}}}else{_0x2dc44d[_0x7dd3('0xce')]++;_0x12de1c['incrementPreviewCounters']({'id':_0x2dc44d[_0x7dd3('0xb3')],'field':{'countnoanswerretry':_0x2dc44d['countnoanswerretry']}})[_0x7dd3('0x83')](function(){_0x12de1c[_0x7dd3('0xb5')](_0x2dc44d,_0x494394,_0x1b21fc)[_0x7dd3('0x83')](function(){});});}});break;case'ABANDONED':_0x176259[_0x7dd3('0xe4')]+=0x1;_0x2dc44d[_0x7dd3('0xe5')]+=0x1;_0x2dc44d[_0x7dd3('0xbf')]=ut[_0x7dd3('0xa1')](_0x2dc44d);ut[_0x7dd3('0x93')](_0x2dc44d,0xb,_0x7dd3('0xe6'));rpcDb[_0x7dd3('0x95')](_0x2dc44d,_0x7dd3('0xe7'));if(ut[_0x7dd3('0xa1')](_0x2dc44d)>=_0x176259['dialGlobalMaxRetry']){_0x202bac=ut[_0x7dd3('0xd9')](_0x2dc44d,0xf,_0x7dd3('0xaa'));rpcDb['createCustomerFinal'](_0x202bac,_0x7dd3('0xe7'));}else{if(_0x2dc44d['countabandonedetry']>=_0x176259['dialAbandonedMaxRety']){rpcDb[_0x7dd3('0x97')](_0x2dc44d,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x7dd3('0xad')](ut[_0x7dd3('0xae')](_0x2dc44d,_0x7dd3('0xe5'),_0x176259[_0x7dd3('0xe8')]),_0x2dc44d[_0x7dd3('0xaf')],_0x2dc44d['activeContact']);}}break;case'18':_0x176259[_0x7dd3('0x3c')]+=0x1;_0x2dc44d['countmachineretry']+=0x1;_0x2dc44d[_0x7dd3('0xbf')]=ut[_0x7dd3('0xa1')](_0x2dc44d);ut['logCustomer'](_0x2dc44d,0x12,_0x125b10[_0x7dd3('0xe9')]||_0x125b10[_0x7dd3('0xea')]);ami[_0x7dd3('0x24')]('custom:amd',ut[_0x7dd3('0xc5')](_0x2dc44d,_0x7dd3('0xeb')));rpcDb[_0x7dd3('0x95')](_0x2dc44d,_0x7dd3('0xec'));if(ut[_0x7dd3('0xa1')](_0x2dc44d)>=_0x176259[_0x7dd3('0xa9')]){_0x202bac=ut[_0x7dd3('0xd9')](_0x2dc44d,0xf,_0x7dd3('0xaa'));rpcDb[_0x7dd3('0x97')](_0x202bac,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x7dd3('0x97')](_0x2dc44d,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0x7dd3('0x15')][_0x125b10[_0x7dd3('0xb1')]];break;case'19':_0x176259[_0x7dd3('0x3c')]+=0x1;_0x2dc44d['countglobal']=ut[_0x7dd3('0xa1')](_0x2dc44d);ut[_0x7dd3('0x93')](_0x2dc44d,0x13,_0x125b10[_0x7dd3('0xe9')]||_0x125b10[_0x7dd3('0xea')]);ami['emit'](_0x7dd3('0xed'),ut[_0x7dd3('0xc5')](_0x2dc44d,_0x7dd3('0xeb')));rpcDb['createCustomerHistory'](_0x2dc44d,'[callProgressDetectingCustomer][machine]');if(ut[_0x7dd3('0xa1')](_0x2dc44d)>=_0x176259[_0x7dd3('0xa9')]){_0x202bac=ut['cloneAction'](_0x2dc44d,0xf,_0x7dd3('0xaa'));rpcDb[_0x7dd3('0x97')](_0x202bac,_0x7dd3('0xee'));}else{rpcDb['createCustomerFinal'](_0x2dc44d,_0x7dd3('0xee'));}delete this['actions'][_0x125b10[_0x7dd3('0xb1')]];break;default:if(_0x2dc44d[_0x7dd3('0x72')]){ut[_0x7dd3('0x7e')](_0x176259,_0x7dd3('0xef'));ut[_0x7dd3('0x7f')](_0x7dd3('0xf0')+_0x176259[_0x7dd3('0x4d')],_0x125b10);}_0x176259[_0x7dd3('0x3c')]+=0x1;_0x2dc44d[_0x7dd3('0xbf')]=ut[_0x7dd3('0xa1')](_0x2dc44d);ut[_0x7dd3('0x93')](_0x2dc44d,0xc,_0x125b10['cause-txt']||_0x125b10[_0x7dd3('0xea')]);_0x494394=_0x176259[_0x7dd3('0xdd')];_0x1b21fc=_0x176259[_0x7dd3('0xa8')];rpcDb[_0x7dd3('0x95')](_0x2dc44d,_0x7dd3('0xf1'));_0x12de1c[_0x7dd3('0xa5')](_0x2dc44d,'20',_0x176259)[_0x7dd3('0x83')](function(_0x10eea4){_0x28f467=_0x10eea4['additional']==0x1;if(!_0x28f467){if(ut[_0x7dd3('0xa1')](_0x2dc44d)>=_0x176259[_0x7dd3('0xa9')]){_0x202bac=ut[_0x7dd3('0xd9')](_0x2dc44d,0xf,_0x7dd3('0xaa'));rpcDb[_0x7dd3('0x97')](_0x202bac,_0x7dd3('0xf2'));}else{rpcDb[_0x7dd3('0x97')](_0x2dc44d,_0x7dd3('0xf2'));}delete this[_0x7dd3('0x15')][_0x125b10[_0x7dd3('0xb1')]];}else{_0x12de1c[_0x7dd3('0xb5')](_0x2dc44d,_0x494394,_0x1b21fc)[_0x7dd3('0x83')](function(_0x1d38d2){});}});}if(!(_0x2dc44d['dialAnswer']&&_0x53c170==='16')){ut['updateOriginated'](_0x176259,_0x7dd3('0xf3'));logger[_0x7dd3('0x55')](_0x7dd3('0xf4'),_0x2dc44d[_0x7dd3('0xb7')],'\x20Queue',_0x176259[_0x7dd3('0x4d')],_0x7dd3('0x6f'),_0x176259[_0x7dd3('0x46')]);}if(_0x53c170!=='ANSWER'){delete this[_0x7dd3('0x15')][_0x125b10[_0x7dd3('0xb1')]];delete this[_0x7dd3('0x15')][_0x125b10[_0x7dd3('0xf5')]];}}};Preview[_0x7dd3('0xe')][_0x7dd3('0xf6')]=function(_0x40a62f,_0x13711e,_0x2d0e9c){if(_[_0x7dd3('0xf7')](_0x13711e)&&'object'!==typeof _0x13711e){return;}if(_[_0x7dd3('0xf7')](_0x2d0e9c)&&_0x7dd3('0xf8')!==typeof _0x2d0e9c){return;}switch(_0x2d0e9c[_0x7dd3('0xf9')]){case'0':ut[_0x7dd3('0xfa')](_0x40a62f,0x0,_0x7dd3('0xa2'));rpcDb[_0x7dd3('0xfb')](_0x40a62f,_0x7dd3('0xfc'));break;case'3':ut[_0x7dd3('0xfa')](_0x40a62f,0x3,'NoAnswer');rpcDb[_0x7dd3('0xfb')](_0x40a62f,_0x7dd3('0xfd'));break;case'5':ut[_0x7dd3('0xfa')](_0x40a62f,0x5,_0x7dd3('0xfe'));rpcDb['createAgentHistory'](_0x40a62f,_0x7dd3('0xff'));break;case'8':ut[_0x7dd3('0xfa')](_0x40a62f,0x8,_0x7dd3('0xd5'));rpcDb[_0x7dd3('0xfb')](_0x40a62f,_0x7dd3('0x100'));break;case'22':ut[_0x7dd3('0xfa')](_0x40a62f,0x16,_0x7dd3('0x101'));rpcDb[_0x7dd3('0xfb')](_0x40a62f,_0x7dd3('0x102'));break;default:ut['logAgent'](_0x40a62f,0xc,_0x2d0e9c['reason']);rpcDb['createAgentHistory'](_0x40a62f,_0x7dd3('0x100'));}ut[_0x7dd3('0x103')](_0x13711e,_0x7dd3('0x104'));logger[_0x7dd3('0x55')]('[originated][decrement][callProgressDetectingAgent]',_0x40a62f[_0x7dd3('0xb7')],'\x20Queue',_0x13711e[_0x7dd3('0x4d')],_0x7dd3('0x6f'),_0x13711e[_0x7dd3('0x46')]);delete this['actions'][_0x40a62f[_0x7dd3('0xb7')]];};Preview[_0x7dd3('0xe')][_0x7dd3('0xa5')]=function(_0x440ac9,_0x18cd93,_0x336250){return BPromise[_0x7dd3('0x105')]()[_0x7dd3('0x83')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x440ac9,_0x18cd93,_0x336250))[_0x7dd3('0x7b')](logger[_0x7dd3('0x55')]('[verifyAdditionalPhone]\x20'));};Preview[_0x7dd3('0xe')][_0x7dd3('0xb5')]=function(_0x352e65,_0x30ed36,_0x212d24){return BPromise[_0x7dd3('0x105')]()[_0x7dd3('0x83')](cmHopperAdditionalPhone[_0x7dd3('0xb5')](_0x352e65,_0x30ed36,_0x212d24))[_0x7dd3('0x7b')](logger['info']('[swapAdditionalPhone]\x20'));};Preview[_0x7dd3('0xe')][_0x7dd3('0xb4')]=function(_0x37492c){return BPromise['resolve']()['then'](cmHopperAdditionalPhone[_0x7dd3('0xb4')](_0x37492c))[_0x7dd3('0x7b')](logger[_0x7dd3('0x55')](_0x7dd3('0x106')));};Preview[_0x7dd3('0xe')]['checkInBlack']=function(_0xef114d,_0x5cf3ef,_0x5c4d2d,_0x323db6,_0x3d7882){var _0x15bc48=this;return new BPromise(function(_0x15c371,_0x16fabf){if(_[_0x7dd3('0x6b')](_0x5cf3ef)||_[_0x7dd3('0x6b')](_0x5cf3ef[_0x7dd3('0x107')])||_[_0x7dd3('0x6b')](_0x5cf3ef[_0x7dd3('0x108')])||_[_0x7dd3('0x6b')](_0x5cf3ef[_0x7dd3('0x76')])){_0x16fabf(ut[_0x7dd3('0x5b')]('Contact\x20is\x20undefined',_0x323db6,_0x3d7882));return;}var _0x3881de=uuid['v4']();var _0x22741a=_0x15bc48[_0x7dd3('0x12')][_0x5cf3ef['Queue'][_0x7dd3('0x4d')]];var _0x3df381=_0x5c4d2d?_0x15bc48[_0x7dd3('0x16')][_0x5c4d2d]['id']:undefined;_0x15bc48[_0x7dd3('0x15')][_0x3881de]=new Action(_0x5cf3ef,_0x22741a,_0x3881de,_0x5c4d2d,_0x3df381);var _0x5bae56=_0x15bc48[_0x7dd3('0x15')][_0x3881de];_0x5bae56[_0x7dd3('0xaf')]=_0x323db6;_0x5bae56[_0x7dd3('0xb0')]=_0x3d7882;_0x5bae56[_0x7dd3('0x109')]=_0x5c4d2d;if(_['isEmpty'](_0xef114d)){_0x15bc48[_0x7dd3('0x10a')](_0x5bae56,_0x22741a,_0x5cf3ef,_0x5c4d2d)[_0x7dd3('0x83')](function(_0x4ba0f1){logger['info'](_0x7dd3('0x10b'),'Queue:\x20'+_0x5bae56['queue']+'\x20IdHopper:\x20'+_0x5bae56[_0x7dd3('0xb3')],JSON['stringify'](_0x4ba0f1));ami[_0x7dd3('0x24')](_0x7dd3('0x10c'),ut[_0x7dd3('0xc5')](_0x5bae56,'called',_0x15bc48[_0x7dd3('0x12')][_0x5bae56[_0x7dd3('0x6e')]]));_0x15c371(ut[_0x7dd3('0x5b')](_0x7dd3('0x10d')));})[_0x7dd3('0x7b')](function(_0x1418c5){ut[_0x7dd3('0x5d')](_0x7dd3('0x10e'),_0x1418c5);_0x16fabf(ut[_0x7dd3('0x5b')](_0x7dd3('0x10f'),_0x323db6,_0x3d7882));});}else{_0x22741a[_0x7dd3('0x34')]+=0x1;ut[_0x7dd3('0x110')](_0x5bae56);rpcDb[_0x7dd3('0x111')](_0x5bae56,_0x7dd3('0x112'));delete _0x15bc48[_0x7dd3('0x15')][_0x3881de];_0x16fabf(ut[_0x7dd3('0x5b')](_0x7dd3('0x113'),_0x323db6,_0x3d7882));}});};Preview['prototype'][_0x7dd3('0x9c')]=function(_0x24cb29){return!_['isNil'](_0x24cb29)&&!_[_0x7dd3('0x6b')](_0x24cb29[_0x7dd3('0x4d')])&&!_[_0x7dd3('0x6b')](_0x24cb29['active'])&&_0x24cb29[_0x7dd3('0x4e')]&&!_[_0x7dd3('0x6b')](this[_0x7dd3('0x14')][util[_0x7dd3('0x52')](_0x7dd3('0x114'),_0x24cb29[_0x7dd3('0x4d')])])&&!_[_0x7dd3('0x6b')](this[_0x7dd3('0x14')][util[_0x7dd3('0x52')]('SIP/%s',_0x24cb29[_0x7dd3('0x4d')])][_0x7dd3('0x79')])&&(this['trunks'][util['format']('SIP/%s',_0x24cb29[_0x7dd3('0x4d')])]['status']==='reachable'||this[_0x7dd3('0x14')][util[_0x7dd3('0x52')]('SIP/%s',_0x24cb29['name'])][_0x7dd3('0x79')]==='unmonitored');};Preview['prototype']['run']=function(_0xc01aa2,_0x3d14d1){var _0x5449d9=this;return new BPromise(function(_0xf434f9,_0x2d9faa){_0x5449d9[_0x7dd3('0x115')](_0xc01aa2,_0x3d14d1)[_0x7dd3('0x83')](function(_0x2e61fa){_0xf434f9(_[_0x7dd3('0x73')](_0x2e61fa,['message']));})[_0x7dd3('0x7b')](function(_0x558175){if(_0x558175[_0x7dd3('0x116')]){rpcDb[_0x7dd3('0x117')](_0xc01aa2);}if(_0x558175[_0x7dd3('0x4e')]){rpcDb[_0x7dd3('0x8c')](_0xc01aa2);}_0x2d9faa(_[_0x7dd3('0x73')](_0x558175,[_0x7dd3('0x5b')]));});});};Preview['prototype'][_0x7dd3('0x115')]=function(_0x4c2fab,_0xa065b7){var _0x5f5264=this;return new BPromise(function(_0x310e53,_0x497828){var _0x378e04,_0x357700;rpcDb[_0x7dd3('0x118')](_0x4c2fab)['then'](function(_0x4cd13b){if(!_[_0x7dd3('0x6b')](_0x4cd13b[0x0])){_0x357700=_0x4cd13b[0x0][_0x7dd3('0x119')]?![]:!![];_0x378e04=_0x4cd13b[0x0][_0x7dd3('0x119')]?!![]:![];_0x378e04=_0xa065b7?!![]:_0x378e04;}var _0x516317=_0x5f5264[_0x7dd3('0x11a')](_0x4cd13b);if(_0x516317[_0x7dd3('0x11b')]){rpcDb[_0x7dd3('0x11c')](_[_0x7dd3('0x73')](_0x4cd13b[0x0],[_0x7dd3('0x76'),'phone']))[_0x7dd3('0x83')](function(_0x3b0f2){_0x5f5264[_0x7dd3('0x11d')](_0x3b0f2,_0x4cd13b[0x0],_0xa065b7,_0x357700,_0x378e04)[_0x7dd3('0x83')](function(_0x2f5136){_0x310e53(_0x2f5136);})[_0x7dd3('0x7b')](function(_0x38cee4){_0x497828(_0x38cee4);});})[_0x7dd3('0x7b')](function(_0x4901c7){ut[_0x7dd3('0x5d')](_0x7dd3('0x11e'),_0x4901c7);_0x497828(ut[_0x7dd3('0x5b')](_0x7dd3('0x11f'),_0x357700,_0x378e04));});}else{_0x497828(ut[_0x7dd3('0x5b')](_0x516317[_0x7dd3('0x5b')],_0x357700,_0x378e04));}})[_0x7dd3('0x7b')](function(_0x4e24d9){ut[_0x7dd3('0x5d')]('[Preview][getContactPreview]',_0x4e24d9);_0x497828(ut[_0x7dd3('0x5b')](_0x7dd3('0x11f'),![],!![]));});});};Preview['prototype'][_0x7dd3('0x11a')]=function(_0x3d7714){if(_['isNil'](_0x3d7714)||_[_0x7dd3('0x120')](_0x3d7714)||!_[_0x7dd3('0x6b')](_0x3d7714[0x0][_0x7dd3('0x87')])&&_[_0x7dd3('0x6b')](_0x3d7714[0x0][_0x7dd3('0x87')][_0x7dd3('0x4d')])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x3d7714);return{'isValid':![],'message':_0x7dd3('0x121')};}var _0x1b3bad=this[_0x7dd3('0x12')][_0x3d7714[0x0]['Queue']['name']];_0x1b3bad[_0x7dd3('0x5b')]='ACTIVE';if(_['isNil'](_0x1b3bad)){ut[_0x7dd3('0x5d')](_0x7dd3('0x122'),_0x1b3bad);return{'isValid':![],'message':_0x7dd3('0x123')};}if(!this[_0x7dd3('0x9c')](_0x1b3bad[_0x7dd3('0x4c')])){ut[_0x7dd3('0x5d')](_0x7dd3('0x124'),_0x7dd3('0x125')+_0x1b3bad['name']+_0x7dd3('0x126'));if(!this[_0x7dd3('0x9c')](_0x1b3bad[_0x7dd3('0x9d')])){ut[_0x7dd3('0x5d')](_0x7dd3('0x124'),_0x1b3bad[_0x7dd3('0x4d')]+_0x7dd3('0x127'));return{'isValid':![],'message':_0x7dd3('0x128')};}}if(!ut[_0x7dd3('0x9b')](_0x1b3bad[_0x7dd3('0x67')])){ut[_0x7dd3('0x5d')]('[Preview][validateContact][Campaign\x20Active]',_0x1b3bad[_0x7dd3('0x4d')]+_0x7dd3('0x129'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x1b3bad[_0x7dd3('0x4d')]+_0x7dd3('0x129')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype']['execCall']=function(_0xfb8a69,_0x1e804d,_0x517dd4,_0x4db75d){var _0xaa2aa3=this;return new BPromise(function(_0x5d0bf0,_0x35ee38){var _0x1192b9=_0xfb8a69[_0x7dd3('0xb7')];var _0x1f02dd=_0xaa2aa3[_0x7dd3('0x9c')](_0x1e804d[_0x7dd3('0x4c')])?util[_0x7dd3('0x52')](_0x7dd3('0x12a'),_0x1e804d['Trunk']['name'],_[_0x7dd3('0x6b')](_0x1e804d[_0x7dd3('0x12b')])?'':_0x1e804d[_0x7dd3('0x12b')][_0x7dd3('0x12c')]()||'',_0x1e804d[_0x7dd3('0x12d')]>0x0?_0x517dd4[_0x7dd3('0x108')][_0x7dd3('0x12e')](_0x1e804d[_0x7dd3('0x12d')]):_0x517dd4['phone']):util[_0x7dd3('0x52')](_0x7dd3('0x12a'),_[_0x7dd3('0x6b')](_0x1e804d['TrunkBackup'])?_0x1e804d[_0x7dd3('0x4c')][_0x7dd3('0x4d')]:_0x1e804d[_0x7dd3('0x9d')]['name'],_[_0x7dd3('0x6b')](_0x1e804d['dialPrefix'])?'':_0x1e804d[_0x7dd3('0x12b')][_0x7dd3('0x12c')]()||'',_0x1e804d[_0x7dd3('0x12d')]>0x0?_0x517dd4[_0x7dd3('0x108')]['substring'](_0x1e804d[_0x7dd3('0x12d')]):_0x517dd4[_0x7dd3('0x108')]);var _0x6227fb=_0xaa2aa3[_0x7dd3('0x9c')](_0x1e804d['Trunk'])?ut[_0x7dd3('0x12f')](_0x1e804d[_0x7dd3('0x4c')][_0x7dd3('0x4f')],_0x1e804d[_0x7dd3('0x130')],_0x1e804d[_0x7dd3('0x131')]>0x0?ut[_0x7dd3('0x132')](_0x1e804d['dialOriginateCallerIdNumber'],_0x1e804d['dialRandomLastDigitCallerIdNumber']):_0x1e804d[_0x7dd3('0x30')]):ut['getCallerId'](_[_0x7dd3('0x6b')](_0x1e804d[_0x7dd3('0x9d')])?_0x1e804d[_0x7dd3('0x4c')][_0x7dd3('0x4f')]:_0x1e804d[_0x7dd3('0x9d')]['callerid'],_0x1e804d[_0x7dd3('0x130')],_0x1e804d['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x7dd3('0x132')](_0x1e804d[_0x7dd3('0x30')],_0x1e804d[_0x7dd3('0x131')]):_0x1e804d['dialOriginateCallerIdNumber']);if(_0x6227fb){_0xfb8a69['originatecalleridname']=ut['extractCalleridName'](_0x6227fb);_0xfb8a69[_0x7dd3('0x133')]=ut['extractCalleridNumber'](_0x6227fb);}var _0x282b6d=ut['addVariables'](_0x1e804d,_0x517dd4,_0x1f02dd,_0x6227fb,_0x1192b9,_0xfb8a69);_[_0x7dd3('0x134')](_0xfb8a69,ut[_0x7dd3('0x135')](_0x282b6d));_0xfb8a69[_0x7dd3('0x8d')]=moment()['format'](_0x7dd3('0x8e'));ami['Action'](ut[_0x7dd3('0x136')](_0xfb8a69,_0x1e804d,_0x282b6d,_0xfb8a69[_0x7dd3('0xb0')],_0x4db75d))[_0x7dd3('0x83')](function(_0x3667b3){_0x1e804d[_0x7dd3('0x46')]+=0x1;logger['info'](_0x7dd3('0x137'),_0x1192b9,_0x7dd3('0xc3'),_0x1e804d[_0x7dd3('0x4d')],_0x7dd3('0x6f'),_0x1e804d['originated']);_0x5d0bf0(_0x3667b3);})['catch'](function(_0x5794dc){ut[_0x7dd3('0xfa')](_0xfb8a69,0xe,_0x7dd3('0x138'));rpcDb[_0x7dd3('0xfb')](_0xfb8a69,_0x7dd3('0x139'));_0x35ee38(_0x5794dc);});});};Preview[_0x7dd3('0xe')][_0x7dd3('0x1e')]=function(_0x9df683){if(this[_0x7dd3('0x15')][_0x9df683[_0x7dd3('0xb1')]]){this[_0x7dd3('0x15')][_0x9df683['linkedid']][_0x7dd3('0x7a')]=_0x9df683[_0x7dd3('0x7a')];}};Preview['prototype'][_0x7dd3('0x13a')]=function(_0x496b0e){var _0x39e752=this;var _0x46792c=this[_0x7dd3('0x15')][_0x496b0e[_0x7dd3('0x13b')]];if(_0x46792c){if(_0x46792c[_0x7dd3('0x109')]&&this[_0x7dd3('0x16')][_0x46792c[_0x7dd3('0x109')]]){ut[_0x7dd3('0x13c')](_0x46792c,this['agents'][_0x46792c[_0x7dd3('0x109')]][_0x7dd3('0x4d')],this['agents'][_0x46792c[_0x7dd3('0x109')]]['id']);}var _0x568a05=_[_0x7dd3('0x13d')](_0x46792c);_0x568a05['responsetime']=moment()[_0x7dd3('0x52')]('YYYY-MM-DD\x20HH:mm:ss');var _0x16a5e4=_0x39e752['campaignsPreview'][_0x46792c[_0x7dd3('0x6e')]];if(ut[_0x7dd3('0x13e')](_0x496b0e[_0x7dd3('0x13f')])){if(_0x46792c[_0x7dd3('0xaf')]){rpcDb[_0x7dd3('0x117')](_0x46792c[_0x7dd3('0xb3')]);}if(_0x46792c[_0x7dd3('0xb0')]){rpcDb['disableContact'](_0x46792c['idContact']);}ami[_0x7dd3('0x24')](_0x7dd3('0x140'),ut['buildObj'](_0x46792c,_0x7dd3('0x141'),this[_0x7dd3('0x12')][_0x46792c[_0x7dd3('0x6e')]]));this[_0x7dd3('0xf6')](_0x568a05,_0x16a5e4,_0x496b0e);}else{_0x46792c[_0x7dd3('0x8d')]=moment()[_0x7dd3('0x52')](_0x7dd3('0x8e'));ut[_0x7dd3('0xfa')](_0x568a05,0x4,'Answer');rpcDb[_0x7dd3('0xfb')](_0x568a05,_0x7dd3('0x142'));}}};Preview[_0x7dd3('0xe')][_0x7dd3('0x18')]=function(_0x4b9ea4){var _0x9d3c58=this;var _0x583761=this['actions'][_0x4b9ea4['linkedid']];var _0x16c1f5;if(_0x583761){_0x16c1f5=this[_0x7dd3('0x12')][_0x583761[_0x7dd3('0x6e')]];logger['info'](_0x7dd3('0x143'),_0x4b9ea4[_0x7dd3('0xb1')],_0x7dd3('0xc3'),_0x16c1f5[_0x7dd3('0x4d')],_0x7dd3('0x70'),_0x16c1f5[_0x7dd3('0x71')]);}if(this[_0x7dd3('0x15')][_0x4b9ea4[_0x7dd3('0xb1')]]&&_0x4b9ea4['linkedid']!==_0x4b9ea4['uniqueid']){if(_0x4b9ea4['cause']==='16'&&this[_0x7dd3('0x15')][_0x4b9ea4[_0x7dd3('0xb1')]]['dialAnswer']){this[_0x7dd3('0x144')](_0x4b9ea4,_0x4b9ea4[_0x7dd3('0xb1')],_0x4b9ea4[_0x7dd3('0x145')]);}else if(this[_0x7dd3('0x15')][_0x4b9ea4['linkedid']]['dialAnswer']){logger[_0x7dd3('0x55')](_0x7dd3('0x146'),_0x4b9ea4['linkedid'],_0x4b9ea4[_0x7dd3('0x145')],_0x7dd3('0xc3'),_0x16c1f5[_0x7dd3('0x4d')],_0x7dd3('0x70'),_0x16c1f5[_0x7dd3('0x71')]);this[_0x7dd3('0x144')](_0x4b9ea4,_0x4b9ea4[_0x7dd3('0xb1')],_0x4b9ea4[_0x7dd3('0x145')]);}}else if(_0x583761&&_[_0x7dd3('0x6b')](_0x583761['statedesc'])&&_0x16c1f5[_0x7dd3('0x147')]&&_0x4b9ea4['linkedid']===_0x4b9ea4[_0x7dd3('0xb7')]&&_[_0x7dd3('0x6b')](_0x4b9ea4['reason'])&&_0x4b9ea4['cause']==='16'&&_0x4b9ea4[_0x7dd3('0x148')]==='6'&&_[_0x7dd3('0xf7')](_0x583761[_0x7dd3('0x149')])){if(_0x583761[_0x7dd3('0xaf')]){rpcDb[_0x7dd3('0x117')](_0x583761[_0x7dd3('0xb3')]);}if(_0x583761[_0x7dd3('0xb0')]){rpcDb[_0x7dd3('0x8c')](_0x583761[_0x7dd3('0xb3')]);}_0x4b9ea4['reason']='22';this[_0x7dd3('0xf6')](_0x583761,_0x16c1f5,_0x4b9ea4);}else if(_0x583761&&_0x583761[_0x7dd3('0x149')]){if(_0x4b9ea4[_0x7dd3('0x145')]==='16'&&this[_0x7dd3('0x15')][_0x4b9ea4[_0x7dd3('0xb1')]][_0x7dd3('0x72')]){logger[_0x7dd3('0x55')](_0x7dd3('0x14a'),_0x4b9ea4['linkedid'],_0x4b9ea4['cause'],'\x20Queue',_0x16c1f5[_0x7dd3('0x4d')],_0x7dd3('0x70'),_0x16c1f5[_0x7dd3('0x71')]);this[_0x7dd3('0x144')](_0x4b9ea4,_0x4b9ea4[_0x7dd3('0xb1')],_0x4b9ea4[_0x7dd3('0x145')]);}else if(this[_0x7dd3('0x15')][_0x4b9ea4[_0x7dd3('0xb1')]][_0x7dd3('0x72')]){logger[_0x7dd3('0x55')](_0x7dd3('0x146'),_0x4b9ea4[_0x7dd3('0xb1')],_0x4b9ea4[_0x7dd3('0x145')],_0x7dd3('0xc3'),_0x16c1f5[_0x7dd3('0x4d')],_0x7dd3('0x70'),_0x16c1f5[_0x7dd3('0x71')]);this['callProgressDetectingCustomer'](_0x4b9ea4,_0x4b9ea4[_0x7dd3('0xb1')],_0x4b9ea4['cause']);}}};Preview[_0x7dd3('0xe')][_0x7dd3('0x1c')]=function(_0x3fa0ee){if(this['actions'][_0x3fa0ee['destlinkedid']]&&_0x3fa0ee[_0x7dd3('0xf5')]!==_0x3fa0ee[_0x7dd3('0x14b')]){this[_0x7dd3('0x144')](_0x3fa0ee,_0x3fa0ee[_0x7dd3('0xf5')],_0x3fa0ee['dialstatus']);}};Preview[_0x7dd3('0xe')][_0x7dd3('0x1a')]=function(_0x2967d6){if(this[_0x7dd3('0x15')][_0x2967d6[_0x7dd3('0xb1')]]&&_0x2967d6[_0x7dd3('0xb1')]!==_0x2967d6[_0x7dd3('0xb7')]&&!this[_0x7dd3('0x15')][_0x2967d6['linkedid']][_0x7dd3('0x72')]){if(_0x2967d6[_0x7dd3('0x145')]==='1'){this[_0x7dd3('0x144')](_0x2967d6,_0x2967d6[_0x7dd3('0xb1')],_0x2967d6[_0x7dd3('0x145')]);}}};Preview[_0x7dd3('0xe')][_0x7dd3('0x14c')]=function(_0x2e06f5,_0x2cd5b6,_0x3feeae){if(this[_0x7dd3('0x15')][_0x2e06f5]){if(_['isNil'](this[_0x7dd3('0x15')][_0x2e06f5][_0x7dd3('0x14d')])){this[_0x7dd3('0x15')][_0x2e06f5][_0x7dd3('0x14d')]={};}this['actions'][_0x2e06f5][_0x7dd3('0x14d')][_0x2cd5b6]=_0x3feeae;}};Preview[_0x7dd3('0xe')]['syncVarSet']=function(_0x54adcc){try{if(!_[_0x7dd3('0x6b')](_0x54adcc)){if(ut[_0x7dd3('0x14e')](_['keys'](_0x54adcc[_0x7dd3('0x14f')])[0x0])){this['addVariable'](_0x54adcc[_0x7dd3('0xb7')],_[_0x7dd3('0x150')](_0x54adcc[_0x7dd3('0x14f')])[0x0],_0x54adcc[_0x7dd3('0x151')]);}}}catch(_0x3541b1){logger[_0x7dd3('0x152')]('[syncVarSet][Preview]',util[_0x7dd3('0x153')](_0x3541b1,{'showHidden':![],'depth':null}));}};Preview[_0x7dd3('0xe')][_0x7dd3('0x21')]=function(_0x54eb0c){if(_0x54eb0c){if(this['actions'][_0x54eb0c[_0x7dd3('0x154')]]){this['actions'][_0x54eb0c[_0x7dd3('0x154')]][_0x7dd3('0x149')]=!![];}}};Preview['prototype'][_0x7dd3('0x22')]=function(_0x20e4f7){if(_0x20e4f7){if(this[_0x7dd3('0x15')][_0x20e4f7[_0x7dd3('0x155')]]){this['actions'][_0x20e4f7[_0x7dd3('0x155')]][_0x7dd3('0x149')]=!![];}}};module[_0x7dd3('0x156')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 2775589..624c3fd 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 _0x8958=['catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','then','createHistory'];(function(_0x16deae,_0x58546a){var _0x27d43b=function(_0x2df2ba){while(--_0x2df2ba){_0x16deae['push'](_0x16deae['shift']());}};_0x27d43b(++_0x58546a);}(_0x8958,0x93));var _0x8895=function(_0x14e8cb,_0x961ab0){_0x14e8cb=_0x14e8cb-0x0;var _0xa8d8e1=_0x8958[_0x14e8cb];return _0xa8d8e1;};'use strict';var util=require('util');var BPromise=require(_0x8895('0x0'));var logger=require('../../../config/logger')('preview');var _=require('lodash');var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x8895('0x1'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x8895('0x2'));var voiceQueueRt=require(_0x8895('0x3'));var agentReportPreview=require(_0x8895('0x4'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x22fa52){return function(_0x2f03ad){logger[_0x8895('0x5')](_0x22fa52,util[_0x8895('0x6')](_0x2f03ad,{'showHidden':![],'depth':null}));};}function create(_0x33013a){return BPromise['resolve']()[_0x8895('0x7')](cmHopperHistory[_0x8895('0x8')](_0x33013a))[_0x8895('0x9')](loggerCatch(_0x8895('0xa')));}function createAgent(_0x6eab1e){return BPromise[_0x8895('0xb')]()[_0x8895('0x7')](agentReportPreview[_0x8895('0x8')](_0x6eab1e))[_0x8895('0x9')](loggerCatch(_0x8895('0xa')));}function moveContact(_0x4d1358){return BPromise[_0x8895('0xb')]()[_0x8895('0x7')](cmHopper[_0x8895('0xc')](_0x4d1358,!![]))[_0x8895('0x9')](loggerCatch(_0x8895('0xd')));}exports[_0x8895('0xe')]=function(_0x5af0ef){return BPromise[_0x8895('0xb')]()[_0x8895('0x7')](cmHopperBlack[_0x8895('0xe')](_0x5af0ef))['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x8895('0xf')]=function(_0x4e8f53){return BPromise[_0x8895('0xb')]()[_0x8895('0x7')](cmHopper[_0x8895('0xf')](_0x4e8f53))[_0x8895('0x9')](loggerCatch(_0x8895('0x10')));};exports['createHistory']=function(_0x4128e2,_0x100fc8){create(_0x4128e2)[_0x8895('0x9')](loggerCatch(_0x100fc8));moveContact(_0x4128e2)[_0x8895('0x9')](loggerCatch(_0x100fc8));};exports[_0x8895('0x11')]=function(_0x1b5c82,_0x304be6){createAgent(_0x1b5c82)[_0x8895('0x9')](loggerCatch(_0x304be6));};exports[_0x8895('0x12')]=function(_0x2da618,_0x24fef0){create(_0x2da618)[_0x8895('0x9')](loggerCatch(_0x24fef0));};exports[_0x8895('0x13')]=function(_0x54e6d4,_0x522a4e){moveContact(_0x54e6d4)['catch'](loggerCatch(_0x522a4e));};exports[_0x8895('0x14')]=function(_0x456282,_0x2d189c,_0x29449a){if(_0x2d189c){_0x456282[_0x8895('0x15')]=null;}if(_0x29449a){_0x456282[_0x8895('0x16')]=![];}return BPromise[_0x8895('0xb')]()[_0x8895('0x7')](cmHopper['rescheduleContact'](_0x456282))[_0x8895('0x9')](loggerCatch(_0x8895('0x17')));};exports[_0x8895('0x18')]=function(_0x1f71f3){return BPromise[_0x8895('0xb')]()['then'](cmHopper['countReScheduled'](_0x1f71f3))[_0x8895('0x9')](loggerCatch(_0x8895('0x19')));};exports[_0x8895('0x1a')]=function(_0x24a376){return BPromise['resolve']()[_0x8895('0x7')](cmHopper[_0x8895('0x1a')]({'UserId':null},_0x24a376,0x1))[_0x8895('0x9')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x78b57){return BPromise['resolve']()[_0x8895('0x7')](cmHopper[_0x8895('0x1a')]({'active':![]},_0x78b57,0x1))[_0x8895('0x9')](loggerCatch(_0x8895('0x1b')));};exports[_0x8895('0x1c')]=function(_0x5c03ea){var _0x4d567a={};_0x4d567a[_0x8895('0x1d')]=_0x5c03ea[_0x8895('0x1d')];_0x4d567a[_0x8895('0x1e')]=_0x5c03ea[_0x8895('0x1e')];_0x4d567a[_0x8895('0x1f')]=_0x5c03ea['calleridnum'];_0x4d567a['calleridname']=_0x5c03ea[_0x8895('0x20')];_0x4d567a[_0x8895('0x21')]=_0x5c03ea[_0x8895('0x21')];_0x4d567a[_0x8895('0x22')]=_0x5c03ea[_0x8895('0x23')];_0x4d567a['queuecallerleaveAt']=_0x5c03ea[_0x8895('0x23')];_0x4d567a['queuecallercomplete']=0x1;_0x4d567a[_0x8895('0x24')]=_0x5c03ea['endtime'];_0x4d567a[_0x8895('0x25')]=_0x5c03ea[_0x8895('0x26')];_0x4d567a[_0x8895('0x27')]=_0x8895('0x28');_0x4d567a[_0x8895('0x29')]='xcally-motion-preview';_0x4d567a[_0x8895('0x2a')]=0x0;_0x4d567a[_0x8895('0x2b')]=0x1;_0x4d567a[_0x8895('0x2c')]=_0x5c03ea[_0x8895('0x26')];_0x4d567a[_0x8895('0x2d')]='COMPLETED';return BPromise[_0x8895('0xb')]()['then'](voiceQueueReport[_0x8895('0x2e')](_0x4d567a))['catch'](loggerCatch(_0x8895('0x2f')));};exports[_0x8895('0x30')]=function(_0x20907a,_0x418e53){return BPromise[_0x8895('0xb')]()['then'](cmHopper[_0x8895('0x30')](_0x20907a,_0x418e53))['catch'](loggerCatch(_0x8895('0x31')));};exports[_0x8895('0x32')]=function(_0x36e13b){return BPromise[_0x8895('0xb')]()[_0x8895('0x7')](cmHopper[_0x8895('0x14')](_0x36e13b,!![],!![]))['catch'](loggerCatch(_0x8895('0x33')));}; \ No newline at end of file +var _0x4b84=['xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','lodash','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','inspect','resolve','catch','[createHistory]\x20','then','createHistory','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','crateCustomerReportQueue','type','uniqueid','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4c73ac,_0x46b73c){_0x4c73ac=_0x4c73ac-0x0;var _0x9839ee=_0x4b84[_0x4c73ac];return _0x9839ee;};'use strict';var util=require(_0x44b8('0x0'));var BPromise=require(_0x44b8('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0x44b8('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x44b8('0x3'));var cmHopperBlack=require(_0x44b8('0x4'));var voiceQueueRt=require(_0x44b8('0x5'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x55f25d){return function(_0x996a8b){logger['error'](_0x55f25d,util[_0x44b8('0x6')](_0x996a8b,{'showHidden':![],'depth':null}));};}function create(_0x5947f7){return BPromise[_0x44b8('0x7')]()['then'](cmHopperHistory['createHistory'](_0x5947f7))[_0x44b8('0x8')](loggerCatch(_0x44b8('0x9')));}function createAgent(_0x30ebc3){return BPromise['resolve']()[_0x44b8('0xa')](agentReportPreview[_0x44b8('0xb')](_0x30ebc3))[_0x44b8('0x8')](loggerCatch(_0x44b8('0x9')));}function moveContact(_0x24dd10){return BPromise[_0x44b8('0x7')]()[_0x44b8('0xa')](cmHopper['moveContactManagedDialer'](_0x24dd10,!![]))[_0x44b8('0x8')](loggerCatch(_0x44b8('0xc')));}exports['checkIsBlackList']=function(_0x194230){return BPromise['resolve']()[_0x44b8('0xa')](cmHopperBlack[_0x44b8('0xd')](_0x194230))['catch'](loggerCatch(_0x44b8('0xe')));};exports['getContactPreview']=function(_0x54fa95){return BPromise[_0x44b8('0x7')]()[_0x44b8('0xa')](cmHopper[_0x44b8('0xf')](_0x54fa95))[_0x44b8('0x8')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x5d6349,_0x3fe9fb){create(_0x5d6349)['catch'](loggerCatch(_0x3fe9fb));moveContact(_0x5d6349)[_0x44b8('0x8')](loggerCatch(_0x3fe9fb));};exports[_0x44b8('0x10')]=function(_0x55e258,_0x36743e){createAgent(_0x55e258)[_0x44b8('0x8')](loggerCatch(_0x36743e));};exports['createCustomerHistory']=function(_0x89bc30,_0x3f4688){create(_0x89bc30)['catch'](loggerCatch(_0x3f4688));};exports[_0x44b8('0x11')]=function(_0x8b4301,_0xebfe79){moveContact(_0x8b4301)[_0x44b8('0x8')](loggerCatch(_0xebfe79));};exports[_0x44b8('0x12')]=function(_0x369c09,_0x452f2f,_0x9b0536){if(_0x452f2f){_0x369c09[_0x44b8('0x13')]=null;}if(_0x9b0536){_0x369c09[_0x44b8('0x14')]=![];}return BPromise[_0x44b8('0x7')]()[_0x44b8('0xa')](cmHopper['rescheduleContact'](_0x369c09))[_0x44b8('0x8')](loggerCatch(_0x44b8('0x15')));};exports[_0x44b8('0x16')]=function(_0x1418db){return BPromise[_0x44b8('0x7')]()['then'](cmHopper[_0x44b8('0x16')](_0x1418db))['catch'](loggerCatch(_0x44b8('0x17')));};exports[_0x44b8('0x18')]=function(_0x25a0c1){return BPromise[_0x44b8('0x7')]()[_0x44b8('0xa')](cmHopper['unlockContact']({'UserId':null},_0x25a0c1,0x1))[_0x44b8('0x8')](loggerCatch('[unlockContact]\x20'));};exports[_0x44b8('0x19')]=function(_0x350482){return BPromise['resolve']()[_0x44b8('0xa')](cmHopper[_0x44b8('0x18')]({'active':![]},_0x350482,0x1))[_0x44b8('0x8')](loggerCatch('[activeContact]\x20'));};exports[_0x44b8('0x1a')]=function(_0x242342){var _0x53d9c7={};_0x53d9c7[_0x44b8('0x1b')]=_0x242342['type'];_0x53d9c7[_0x44b8('0x1c')]=_0x242342['uniqueid'];_0x53d9c7['calleridnum']=_0x242342['calleridnum'];_0x53d9c7[_0x44b8('0x1d')]=_0x242342[_0x44b8('0x1d')];_0x53d9c7[_0x44b8('0x1e')]=_0x242342[_0x44b8('0x1e')];_0x53d9c7[_0x44b8('0x1f')]=_0x242342[_0x44b8('0x20')];_0x53d9c7[_0x44b8('0x21')]=_0x242342[_0x44b8('0x20')];_0x53d9c7[_0x44b8('0x22')]=0x1;_0x53d9c7[_0x44b8('0x23')]=_0x242342[_0x44b8('0x24')];_0x53d9c7[_0x44b8('0x25')]=_0x242342[_0x44b8('0x26')];_0x53d9c7['context']=_0x44b8('0x27');_0x53d9c7['exten']=_0x44b8('0x28');_0x53d9c7[_0x44b8('0x29')]=0x0;_0x53d9c7[_0x44b8('0x2a')]=0x1;_0x53d9c7[_0x44b8('0x2b')]=_0x242342[_0x44b8('0x26')];_0x53d9c7['queuecallerexitreason']=_0x44b8('0x2c');return BPromise[_0x44b8('0x7')]()[_0x44b8('0xa')](voiceQueueReport[_0x44b8('0x2d')](_0x53d9c7))[_0x44b8('0x8')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x44b8('0x2e')]=function(_0x400edc,_0x1a30fc){return BPromise[_0x44b8('0x7')]()[_0x44b8('0xa')](cmHopper[_0x44b8('0x2e')](_0x400edc,_0x1a30fc))[_0x44b8('0x8')](loggerCatch(_0x44b8('0x2f')));};exports[_0x44b8('0x30')]=function(_0x181761){return BPromise[_0x44b8('0x7')]()[_0x44b8('0xa')](cmHopper[_0x44b8('0x12')](_0x181761,!![],!![]))[_0x44b8('0x8')](loggerCatch(_0x44b8('0x31')));}; \ 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 4295c4b..1630f7d 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 _0xe92b=['match','util','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','error','logger','info','inspect','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','%s%s','toUpper','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','YYYY-MM-DD\x20HH:mm:ss','starttime','responsetime','endtime','logAgent','state','ringtime','logLookAgent','membername','UserId','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnosuchnumberretry','cloneAction','clone','statedesc','Global','scheduledAt','active','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','channelAgent','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','getDiff','seconds','filterKey','idContact','type','campaigntype','countnoanswerretry','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xe92b,0x89));var _0xbe92=function(_0x12ddb2,_0x5ad61e){_0x12ddb2=_0x12ddb2-0x0;var _0x10b6dd=_0xe92b[_0x12ddb2];return _0x10b6dd;};'use strict';var util=require(_0xbe92('0x0'));var _=require(_0xbe92('0x1'));var moment=require(_0xbe92('0x2'));var logger=require(_0xbe92('0x3'))(_0xbe92('0x4'));var ipAgi=process['env'][_0xbe92('0x5')]||_0xbe92('0x6');function getSeconds(_0x3b8ee4,_0x39efb7){var _0x103bf6=moment(_0x3b8ee4)[_0xbe92('0x7')](0x0);var _0x59e56f=moment(_0x39efb7)[_0xbe92('0x7')](0x0);return _0x103bf6[_0xbe92('0x8')](_0x59e56f,'seconds');}exports['loggerCatch']=function(_0x18d834){return function(_0x333ff2){logger[_0xbe92('0x9')](_0x18d834,util['inspect'](_0x333ff2,{'showHidden':![],'depth':null}));};};exports[_0xbe92('0xa')]=function(_0x1485e7,_0x1edbbb){logger[_0xbe92('0xb')](_0x1485e7,util[_0xbe92('0xc')](_0x1edbbb,{'showHidden':![],'depth':null}));};exports[_0xbe92('0xd')]=function(_0xf6585,_0x130238){logger['error'](_0xf6585,util['inspect'](_0x130238,{'showHidden':![],'depth':null}));};exports[_0xbe92('0xe')]=function(_0x5e81e8){return function(_0x552ecb){logger['info'](_0x5e81e8,util[_0xbe92('0xc')](_0x552ecb,{'showHidden':![],'depth':null}));};};exports[_0xbe92('0xf')]=function(_0xf1eb39,_0x2dbb9b,_0x52e852){return{'message':_0xf1eb39,'unlock':_0x2dbb9b,'active':_0x52e852};};exports[_0xbe92('0x10')]=function(_0x25f2dd,_0x430441,_0x4c7f70){if(!_[_0xbe92('0x11')](_0x4c7f70)&&_0xbe92('0x12')===typeof _0x4c7f70&&!_['isEmpty'](_0x4c7f70)){if(!_[_0xbe92('0x11')](_0x430441)&&_0xbe92('0x12')===typeof _0x430441&&!_[_0xbe92('0x13')](_0x430441)){return util[_0xbe92('0x14')]('\x22%s\x22\x20<%s>',_0x430441,_0x4c7f70);}return util[_0xbe92('0x14')](_0xbe92('0x15'),_0x4c7f70,_0x4c7f70);}if(!_[_0xbe92('0x11')](_0x25f2dd)&&_0xbe92('0x12')===typeof _0x25f2dd&&!_[_0xbe92('0x13')](_0x25f2dd)){return _0x25f2dd;}return _0xbe92('0x16');};exports['isActive']=function(_0xfbc47){if(_['isNil'](_0xfbc47)){return![];}return _0xfbc47;};exports[_0xbe92('0x17')]=function(_0x30038d,_0x11f8fc,_0x5630bf,_0x41cc9f,_0x1324c8,_0x30399a){var _0x204658={'XMD-QUEUE':_0x11f8fc[_0xbe92('0x18')]?_0x11f8fc[_0xbe92('0x18')][_0xbe92('0x19')]:'','XMD-CALLERID':_0x41cc9f,'XMD-CALLERID-PREVIEW':_0x30399a?util[_0xbe92('0x14')]('\x22%s\x22\x20<%s>',_0x30399a[_0xbe92('0x1a')],_0x30399a[_0xbe92('0x1b')]):_0x41cc9f,'XMD-DIALID':_0x1324c8,'XMD-CONTACTID':_0x11f8fc[_0xbe92('0x1c')],'XMD-CDRTYPE':_0xbe92('0x1d'),'CALLERID(all)':_0x41cc9f,'XMD-VOICEQUEUEID':_0x11f8fc['VoiceQueueId'],'XMD-DIALCHANNEL':_0x5630bf,'XMD-DIALTIMEOUT':_0x30038d[_0xbe92('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0xbe92('0x14')](_0xbe92('0x1f'),_0x30038d[_0xbe92('0x20')]?'g':'',_['isEmpty'](_0x30038d[_0xbe92('0x21')])?'':_0xbe92('0x22')),'XMD-DIALURL':_0x30038d[_0xbe92('0x23')]||'','XMD-AGI':_0x30038d['dialQueueProject']?util[_0xbe92('0x14')](_0xbe92('0x24'),ipAgi,_0x30038d[_0xbe92('0x25')]):_0xbe92('0x26'),'XMD-AGIAFTER':_0x30038d[_0xbe92('0x20')]?util[_0xbe92('0x14')](_0xbe92('0x24'),ipAgi,_0x30038d[_0xbe92('0x20')]):_0xbe92('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x30399a?_0x30399a[_0xbe92('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x30399a?_0x30399a[_0xbe92('0x28')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0xbe92('0x13')](_0x30038d[_0xbe92('0x21')])){_0x204658[util[_0xbe92('0x14')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x30038d['monitor_format'];_0x204658[util[_0xbe92('0x14')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x1324c8;}if(_0x11f8fc&&_0x11f8fc[_0xbe92('0x29')]){for(var _0x580697 in _0x11f8fc[_0xbe92('0x29')]){if(_0x11f8fc[_0xbe92('0x29')][_0xbe92('0x2a')](_0x580697)){if(!_[_0xbe92('0x2b')](_0x11f8fc[_0xbe92('0x29')][_0x580697])&&_0x580697!=='id'&&_0x580697!==_0xbe92('0x2c')&&_0x580697!==_0xbe92('0x2d')&&_0x580697!==_0xbe92('0x2e')){_0x204658[util[_0xbe92('0x14')](_0xbe92('0x2f'),'XMD-',_[_0xbe92('0x30')](_0x580697))]=_0x11f8fc[_0xbe92('0x29')][_0x580697];}}}}return _0x204658;};exports['toLowerVariables']=function(_0x17b918){var _0x4b3210={};for(var _0x4c7a61 in _0x17b918){if(_0x17b918[_0xbe92('0x2a')](_0x4c7a61)){_0x4b3210[util[_0xbe92('0x14')]('%s',_['toLower'](_0x4c7a61))]=_0x17b918[_0x4c7a61];}}return{'variables':_0x4b3210};};exports[_0xbe92('0x31')]=function(_0x284f1f,_0x38d404){if(!_[_0xbe92('0x2b')](_0x284f1f)){if(_0x284f1f[_0xbe92('0x2a')](_0xbe92('0x32'))){if(_0x284f1f[_0xbe92('0x32')]>0x0){_0x284f1f['originated']-=0x1;}else{logger['error'](_0xbe92('0x33'),_0x38d404);}}}else{logger[_0xbe92('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x38d404);}};exports['logBlacklist']=function(_0x161e2e){var _0x49a6bb=moment()[_0xbe92('0x14')](_0xbe92('0x34'));_0x161e2e['state']=0xd;_0x161e2e['statedesc']='Blacklist';_0x161e2e[_0xbe92('0x35')]=_0x49a6bb;_0x161e2e[_0xbe92('0x36')]=_0x49a6bb;_0x161e2e[_0xbe92('0x37')]=_0x49a6bb;};exports[_0xbe92('0x38')]=function(_0x134302,_0x17291b,_0xd5555f){var _0x2180a0=moment()['format'](_0xbe92('0x34'));_0x134302[_0xbe92('0x39')]=_0x17291b;_0x134302['statedesc']=_0xd5555f;_0x134302[_0xbe92('0x36')]=_0x2180a0;_0x134302[_0xbe92('0x3a')]=getSeconds(_0x134302[_0xbe92('0x36')],_0x134302[_0xbe92('0x35')]);};exports[_0xbe92('0x3b')]=function(_0xce8ef8,_0x488d32,_0x39eece){_0xce8ef8[_0xbe92('0x3c')]=_0x488d32;_0xce8ef8[_0xbe92('0x3d')]=_0x39eece;};exports['logCustomer']=function(_0x1e00c8,_0xf185db,_0x37948c){var _0x13a36c=moment()[_0xbe92('0x14')](_0xbe92('0x34'));_0x1e00c8[_0xbe92('0x39')]=_0xf185db;_0x1e00c8['statedesc']=_0x37948c;_0x1e00c8['responsetime']=_0x1e00c8[_0xbe92('0x36')]?_0x1e00c8[_0xbe92('0x36')]:_0x13a36c;_0x1e00c8[_0xbe92('0x37')]=_0x1e00c8['endtime']?_0x1e00c8[_0xbe92('0x37')]:_0x13a36c;_0x1e00c8[_0xbe92('0x3a')]=getSeconds(_0x1e00c8['responsetime']||0x0,_0x1e00c8['starttime']||0x0);_0x1e00c8['talktime']=_0x1e00c8[_0xbe92('0x3e')]?getSeconds(_0x1e00c8[_0xbe92('0x37')],_0x1e00c8[_0xbe92('0x3e')]):0x0;};exports[_0xbe92('0x3f')]=function(_0x53fdbc){return _0x53fdbc===_0xbe92('0x40');};exports[_0xbe92('0x41')]=function(_0x27c509,_0x13c1b4,_0x1b58b5,_0x14275d,_0x16dfa7){var _0x11f4b4=_0x14275d?_0xbe92('0x42'):_0x27c509[_0xbe92('0x1a')];_0x11f4b4=_0x16dfa7?'BOOKED':_0x11f4b4;return{'actionid':_0x27c509[_0xbe92('0x43')],'action':'originate','channel':_0x27c509['channelAgent'],'callerid':util[_0xbe92('0x14')](_0xbe92('0x15'),_0x11f4b4,_0x27c509[_0xbe92('0x1b')]),'Exten':'xcally-motion-preview','Context':_0xbe92('0x44'),'Priority':'1','variable':_0x1b58b5,'timeout':(_0x13c1b4[_0xbe92('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0x27c509['uniqueid']};};exports[_0xbe92('0x46')]=function(_0x3d8d71){return _0x3d8d71[_0xbe92('0x47')]+_0x3d8d71[_0xbe92('0x48')]+_0x3d8d71['countnoanswerretry']+_0x3d8d71['countagentrejectretry']+_0x3d8d71[_0xbe92('0x49')];};exports[_0xbe92('0x4a')]=function(_0x2e0cd7){var _0x59813e=_[_0xbe92('0x4b')](_0x2e0cd7);_0x59813e[_0xbe92('0x39')]=0xf;_0x59813e[_0xbe92('0x4c')]=_0xbe92('0x4d');return _0x59813e;};exports[_0xbe92('0x4e')]=function(_0x58c152,_0x1132fd,_0x556130){var _0x1d8b72={};_0x1d8b72[_0x1132fd]=_0x58c152[_0x1132fd];_0x1d8b72[_0xbe92('0x4f')]=![];_0x1d8b72[_0xbe92('0x50')]=moment()[_0xbe92('0x51')](_0x556130,_0xbe92('0x52'))[_0xbe92('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d8b72[_0xbe92('0x1c')]=_0x58c152[_0xbe92('0x1c')];_0x1d8b72[_0xbe92('0x53')]=_0x58c152['ListId'];_0x1d8b72[_0xbe92('0x54')]=_0x58c152[_0xbe92('0x54')]||undefined;return _0x1d8b72;};exports[_0xbe92('0x55')]=function(_0x24d66d,_0x50fe00){if(!_[_0xbe92('0x2b')](_0x24d66d)){if(_0x24d66d[_0xbe92('0x56')]>0x0){_0x24d66d[_0xbe92('0x56')]-=0x1;}else{logger[_0xbe92('0x9')](_0x50fe00,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x50fe00,_0xbe92('0x57'));}};exports[_0xbe92('0x58')]=function(_0x45e3dd){if(_0x45e3dd<=0x0){return!![];}return![];};exports[_0xbe92('0x59')]=function(_0x3199fb,_0x5c07ce,_0x230672){_0x3199fb[_0xbe92('0x5a')]=_0x5c07ce;_0x3199fb[_0xbe92('0x19')]=_0x3199fb[_0xbe92('0x5b')];_0x3199fb[_0xbe92('0x5c')]=_0x3199fb[_0xbe92('0x5d')];if(_0x230672){_0x3199fb[_0xbe92('0x5e')]=_0x230672['mandatoryDisposition'];}return _0x3199fb;};exports[_0xbe92('0x5f')]=function(_0x509581){var _0x761533={};_0x761533['queue']=_0x509581[_0xbe92('0x5b')];_0x761533[_0xbe92('0x5c')]=_0x509581[_0xbe92('0x5d')];_0x761533['uniqueid']=_0x509581[_0xbe92('0x43')];return _0x761533;};exports[_0xbe92('0x60')]=function(_0x1b1655){var _0x5e0dd4=[];for(var _0x3d3552 in _0x1b1655){if(_0x1b1655['hasOwnProperty'](_0x3d3552)){if(!_[_0xbe92('0x2b')](_0x1b1655[_0x3d3552])&&_0x1b1655[_0x3d3552][_0xbe92('0x39')]===_0xbe92('0x61')&&_0x1b1655[_0x3d3552][_0xbe92('0x62')]==='reachable'){_0x5e0dd4['push'](_0x1b1655[_0x3d3552]['id']);}}}return _0x5e0dd4;};exports[_0xbe92('0x63')]=function(_0x27081b){var _0x4ff7cc=moment()[_0xbe92('0x7')](0x0);var _0x55cb26=moment(_0x27081b)[_0xbe92('0x7')](0x0);return _0x4ff7cc[_0xbe92('0x8')](_0x55cb26,_0xbe92('0x64'));};exports['createBody']=function(_0xba4f93){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xba4f93['ContactId'],'ListId':_0xba4f93[_0xbe92('0x53')],'VoiceQueueId':_0xba4f93[_0xbe92('0x54')]||undefined,'CampaignId':_0xba4f93['CampaignId']||undefined};};exports[_0xbe92('0x65')]=function(_0x4667c7){if(_0x4667c7==='uniqueid'||_0x4667c7===_0xbe92('0x66')||_0x4667c7===_0xbe92('0x5b')||_0x4667c7===_0xbe92('0x67')||_0x4667c7===_0xbe92('0x68')||_0x4667c7==='dialAnswer'||_0x4667c7===_0xbe92('0x3c')||_0x4667c7===_0xbe92('0x5d')||_0x4667c7===_0xbe92('0x1a')||_0x4667c7===_0xbe92('0x4f')||_0x4667c7===_0xbe92('0x1b')||_0x4667c7===_0xbe92('0x50')||_0x4667c7===_0xbe92('0x47')||_0x4667c7===_0xbe92('0x48')||_0x4667c7===_0xbe92('0x69')||_0x4667c7==='countglobal'||_0x4667c7===_0xbe92('0x6a')||_0x4667c7==='callbackuniqueid'||_0x4667c7===_0xbe92('0x6b')||_0x4667c7===_0xbe92('0x6c')||_0x4667c7===_0xbe92('0x1c')||_0x4667c7===_0xbe92('0x53')||_0x4667c7==='UserId'||_0x4667c7===_0xbe92('0x54')||_0x4667c7===_0xbe92('0x6d')||_0x4667c7===_0xbe92('0x6e')||_0x4667c7===_0xbe92('0x6f')||_0x4667c7===_0xbe92('0x70')||_0x4667c7===_0xbe92('0x71')||_0x4667c7===_0xbe92('0x72')||_0x4667c7==='xmd-dialtimeout'||_0x4667c7===_0xbe92('0x73')||_0x4667c7==='xmd-dialid'||_0x4667c7===_0xbe92('0x74')||_0x4667c7==='xmd-contactid'||_0x4667c7===_0xbe92('0x75')||_0x4667c7===_0xbe92('0x76')||_0x4667c7===_0xbe92('0x77')||_0x4667c7==='xmd-agi'||_0x4667c7===_0xbe92('0x78')||_0x4667c7===_0xbe92('0x79')||_0x4667c7==='rtpaudioqosjitter'||_0x4667c7==='rtpaudioqosjitterbridged'||_0x4667c7===_0xbe92('0x7a')||_0x4667c7===_0xbe92('0x7b')||_0x4667c7===_0xbe92('0x7c')||_0x4667c7===_0xbe92('0x7d')||_0x4667c7==='rtpaudioqos'||_0x4667c7===_0xbe92('0x79')||_0x4667c7===_0xbe92('0x7e')||_0x4667c7==='rtpaudioqosjitterbridged'||_0x4667c7==='rtpaudioqosloss'||_0x4667c7===_0xbe92('0x7b')||_0x4667c7===_0xbe92('0x7c')||_0x4667c7==='rtpaudioqosrttbridged'||_0x4667c7===_0xbe92('0x7f')||_0x4667c7===_0xbe92('0x80')||_0x4667c7===_0xbe92('0x39')||_0x4667c7==='statedesc'){return![];}return!![];};exports[_0xbe92('0x81')]=function(_0x780832,_0x58737d){var _0xeb178a,_0x39dba9,_0x589142;if(_0x58737d<=0x0){_0x58737d=0x1;}_0xeb178a=new RegExp(_0xbe92('0x82')+_0x58737d+'}$');_0x39dba9=Math[_0xbe92('0x83')](0xa,_0x58737d-0x1);_0x589142=Math[_0xbe92('0x83')](0xa,_0x58737d)-0x1;return util[_0xbe92('0x14')]('%s',_[_0xbe92('0x84')](_0x780832,_0xeb178a,_[_0xbe92('0x85')](_0x39dba9,_0x589142)));};exports[_0xbe92('0x86')]=function(_0x27f491){var _0x1f4896=_0x27f491['match'](/"(.*?)"/);return _0x1f4896?_0x1f4896[0x1]:_0x27f491;};exports['extractCalleridNumber']=function(_0x9a37c7){var _0x446d42=_0x9a37c7[_0xbe92('0x87')](/<(.*?)>/);return _0x446d42?_0x446d42[0x1]:_0x9a37c7;}; \ No newline at end of file +var _0xcb58=['env','XCALLY_IP_AGI','milliseconds','seconds','loggerCatch','error','inspect','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','format','calleridname','calleridnum','ContactId','VoiceQueueId','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','endtime','logAgent','ringtime','responsetime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','interface','mandatoryDisposition','agentReadyId','not_inuse','status','reachable','push','diff','filterKey','idContact','type','dialAnswer','countbusyretry','countglobal','callbackuniqueid','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','pow','replace','extractCalleridName','extractCalleridNumber','util','lodash','../../../../config/logger','preview'];(function(_0x4e362a,_0x5060c5){var _0x50069f=function(_0xf9230d){while(--_0xf9230d){_0x4e362a['push'](_0x4e362a['shift']());}};_0x50069f(++_0x5060c5);}(_0xcb58,0x84));var _0x8cb5=function(_0x25a38b,_0x151f11){_0x25a38b=_0x25a38b-0x0;var _0x52e32f=_0xcb58[_0x25a38b];return _0x52e32f;};'use strict';var util=require(_0x8cb5('0x0'));var _=require(_0x8cb5('0x1'));var moment=require('moment');var logger=require(_0x8cb5('0x2'))(_0x8cb5('0x3'));var ipAgi=process[_0x8cb5('0x4')][_0x8cb5('0x5')]||'127.0.0.1';function getSeconds(_0x2304c2,_0xfca46f){var _0x1d89e3=moment(_0x2304c2)[_0x8cb5('0x6')](0x0);var _0x267483=moment(_0xfca46f)[_0x8cb5('0x6')](0x0);return _0x1d89e3['diff'](_0x267483,_0x8cb5('0x7'));}exports[_0x8cb5('0x8')]=function(_0x703e7f){return function(_0x52d4f1){logger[_0x8cb5('0x9')](_0x703e7f,util[_0x8cb5('0xa')](_0x52d4f1,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x206308,_0x21a41c){logger[_0x8cb5('0xb')](_0x206308,util[_0x8cb5('0xa')](_0x21a41c,{'showHidden':![],'depth':null}));};exports[_0x8cb5('0xc')]=function(_0x4d739b,_0x2f7b34){logger['error'](_0x4d739b,util['inspect'](_0x2f7b34,{'showHidden':![],'depth':null}));};exports[_0x8cb5('0xd')]=function(_0x38e7ed){return function(_0x216a5d){logger[_0x8cb5('0xb')](_0x38e7ed,util[_0x8cb5('0xa')](_0x216a5d,{'showHidden':![],'depth':null}));};};exports[_0x8cb5('0xe')]=function(_0x22ee1e,_0x4bf907,_0x1fb308){return{'message':_0x22ee1e,'unlock':_0x4bf907,'active':_0x1fb308};};exports[_0x8cb5('0xf')]=function(_0x259000,_0x59ffc6,_0x35a516){if(!_[_0x8cb5('0x10')](_0x35a516)&&_0x8cb5('0x11')===typeof _0x35a516&&!_[_0x8cb5('0x12')](_0x35a516)){if(!_[_0x8cb5('0x10')](_0x59ffc6)&&_0x8cb5('0x11')===typeof _0x59ffc6&&!_[_0x8cb5('0x12')](_0x59ffc6)){return util['format'](_0x8cb5('0x13'),_0x59ffc6,_0x35a516);}return util['format'](_0x8cb5('0x13'),_0x35a516,_0x35a516);}if(!_[_0x8cb5('0x10')](_0x259000)&&_0x8cb5('0x11')===typeof _0x259000&&!_[_0x8cb5('0x12')](_0x259000)){return _0x259000;}return _0x8cb5('0x14');};exports[_0x8cb5('0x15')]=function(_0x3a5e23){if(_[_0x8cb5('0x16')](_0x3a5e23)){return![];}return _0x3a5e23;};exports['addVariables']=function(_0x224831,_0x35c9ae,_0x4bf37c,_0x336f31,_0x25905d,_0x453ed1){var _0x1822c4={'XMD-QUEUE':_0x35c9ae[_0x8cb5('0x17')]?_0x35c9ae[_0x8cb5('0x17')]['name']:'','XMD-CALLERID':_0x336f31,'XMD-CALLERID-PREVIEW':_0x453ed1?util[_0x8cb5('0x18')]('\x22%s\x22\x20<%s>',_0x453ed1[_0x8cb5('0x19')],_0x453ed1[_0x8cb5('0x1a')]):_0x336f31,'XMD-DIALID':_0x25905d,'XMD-CONTACTID':_0x35c9ae[_0x8cb5('0x1b')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x336f31,'XMD-VOICEQUEUEID':_0x35c9ae[_0x8cb5('0x1c')],'XMD-DIALCHANNEL':_0x4bf37c,'XMD-DIALTIMEOUT':_0x224831['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x8cb5('0x18')](_0x8cb5('0x1d'),_0x224831['dialQueueProject2']?'g':'',_['isEmpty'](_0x224831[_0x8cb5('0x1e')])?'':_0x8cb5('0x1f')),'XMD-DIALURL':_0x224831[_0x8cb5('0x20')]||'','XMD-AGI':_0x224831[_0x8cb5('0x21')]?util[_0x8cb5('0x18')](_0x8cb5('0x22'),ipAgi,_0x224831[_0x8cb5('0x21')]):_0x8cb5('0x23'),'XMD-AGIAFTER':_0x224831[_0x8cb5('0x24')]?util[_0x8cb5('0x18')](_0x8cb5('0x22'),ipAgi,_0x224831[_0x8cb5('0x24')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x453ed1?_0x453ed1[_0x8cb5('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x453ed1?_0x453ed1['originatecalleridname']:'','XMD-DESTINATION':_0x8cb5('0x26')};if(!_[_0x8cb5('0x12')](_0x224831[_0x8cb5('0x1e')])){_0x1822c4[util[_0x8cb5('0x18')]('%s',_0x8cb5('0x27'))]=_0x224831[_0x8cb5('0x1e')];_0x1822c4[util[_0x8cb5('0x18')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x25905d;}if(_0x35c9ae&&_0x35c9ae[_0x8cb5('0x28')]){for(var _0x25a9d0 in _0x35c9ae[_0x8cb5('0x28')]){if(_0x35c9ae[_0x8cb5('0x28')][_0x8cb5('0x29')](_0x25a9d0)){if(!_[_0x8cb5('0x16')](_0x35c9ae[_0x8cb5('0x28')][_0x25a9d0])&&_0x25a9d0!=='id'&&_0x25a9d0!==_0x8cb5('0x2a')&&_0x25a9d0!==_0x8cb5('0x2b')&&_0x25a9d0!==_0x8cb5('0x2c')){_0x1822c4[util[_0x8cb5('0x18')]('%s%s',_0x8cb5('0x2d'),_[_0x8cb5('0x2e')](_0x25a9d0))]=_0x35c9ae[_0x8cb5('0x28')][_0x25a9d0];}}}}return _0x1822c4;};exports[_0x8cb5('0x2f')]=function(_0x38421b){var _0x1e9bb6={};for(var _0x2c9449 in _0x38421b){if(_0x38421b['hasOwnProperty'](_0x2c9449)){_0x1e9bb6[util[_0x8cb5('0x18')]('%s',_['toLower'](_0x2c9449))]=_0x38421b[_0x2c9449];}}return{'variables':_0x1e9bb6};};exports['updateOriginated']=function(_0x17eb1c,_0x35d4ae){if(!_[_0x8cb5('0x16')](_0x17eb1c)){if(_0x17eb1c[_0x8cb5('0x29')](_0x8cb5('0x30'))){if(_0x17eb1c[_0x8cb5('0x30')]>0x0){_0x17eb1c[_0x8cb5('0x30')]-=0x1;}else{logger[_0x8cb5('0x9')](_0x8cb5('0x31'),_0x35d4ae);}}}else{logger[_0x8cb5('0x9')](_0x8cb5('0x32'),_0x35d4ae);}};exports[_0x8cb5('0x33')]=function(_0x557179){var _0x2a1e17=moment()[_0x8cb5('0x18')](_0x8cb5('0x34'));_0x557179[_0x8cb5('0x35')]=0xd;_0x557179[_0x8cb5('0x36')]='Blacklist';_0x557179[_0x8cb5('0x37')]=_0x2a1e17;_0x557179['responsetime']=_0x2a1e17;_0x557179[_0x8cb5('0x38')]=_0x2a1e17;};exports[_0x8cb5('0x39')]=function(_0x2f7a16,_0x5bff0a,_0x3546e7){var _0x3b3298=moment()[_0x8cb5('0x18')]('YYYY-MM-DD\x20HH:mm:ss');_0x2f7a16[_0x8cb5('0x35')]=_0x5bff0a;_0x2f7a16[_0x8cb5('0x36')]=_0x3546e7;_0x2f7a16['responsetime']=_0x3b3298;_0x2f7a16[_0x8cb5('0x3a')]=getSeconds(_0x2f7a16[_0x8cb5('0x3b')],_0x2f7a16['starttime']);};exports[_0x8cb5('0x3c')]=function(_0x2caff7,_0x59c15a,_0xb6fdbf){_0x2caff7[_0x8cb5('0x3d')]=_0x59c15a;_0x2caff7[_0x8cb5('0x3e')]=_0xb6fdbf;};exports[_0x8cb5('0x3f')]=function(_0x5e2b7d,_0x46d265,_0x697833){var _0x1834d9=moment()[_0x8cb5('0x18')](_0x8cb5('0x34'));_0x5e2b7d['state']=_0x46d265;_0x5e2b7d['statedesc']=_0x697833;_0x5e2b7d[_0x8cb5('0x3b')]=_0x5e2b7d[_0x8cb5('0x3b')]?_0x5e2b7d['responsetime']:_0x1834d9;_0x5e2b7d[_0x8cb5('0x38')]=_0x5e2b7d['endtime']?_0x5e2b7d[_0x8cb5('0x38')]:_0x1834d9;_0x5e2b7d[_0x8cb5('0x3a')]=getSeconds(_0x5e2b7d[_0x8cb5('0x3b')]||0x0,_0x5e2b7d[_0x8cb5('0x37')]||0x0);_0x5e2b7d[_0x8cb5('0x40')]=_0x5e2b7d[_0x8cb5('0x41')]?getSeconds(_0x5e2b7d[_0x8cb5('0x38')],_0x5e2b7d[_0x8cb5('0x41')]):0x0;};exports['isFailure']=function(_0x2478f3){return _0x2478f3===_0x8cb5('0x42');};exports[_0x8cb5('0x43')]=function(_0x310511,_0xc7afec,_0x470f80,_0x3f894d,_0x35edb8){var _0x4bfdc0=_0x3f894d?_0x8cb5('0x44'):_0x310511[_0x8cb5('0x19')];_0x4bfdc0=_0x35edb8?_0x8cb5('0x45'):_0x4bfdc0;return{'actionid':_0x310511[_0x8cb5('0x46')],'action':_0x8cb5('0x47'),'channel':_0x310511[_0x8cb5('0x48')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x4bfdc0,_0x310511[_0x8cb5('0x1a')]),'Exten':_0x8cb5('0x26'),'Context':'from-sip','Priority':'1','variable':_0x470f80,'timeout':(_0xc7afec[_0x8cb5('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0x310511[_0x8cb5('0x46')]};};exports[_0x8cb5('0x4a')]=function(_0x54a67d){return _0x54a67d['countbusyretry']+_0x54a67d[_0x8cb5('0x4b')]+_0x54a67d[_0x8cb5('0x4c')]+_0x54a67d[_0x8cb5('0x4d')]+_0x54a67d['countnosuchnumberretry'];};exports[_0x8cb5('0x4e')]=function(_0x217353){var _0xc6851=_[_0x8cb5('0x4f')](_0x217353);_0xc6851[_0x8cb5('0x35')]=0xf;_0xc6851[_0x8cb5('0x36')]=_0x8cb5('0x50');return _0xc6851;};exports[_0x8cb5('0x51')]=function(_0x5093c5,_0x1307d0,_0x29b3a4){var _0x258be0={};_0x258be0[_0x1307d0]=_0x5093c5[_0x1307d0];_0x258be0[_0x8cb5('0x52')]=![];_0x258be0[_0x8cb5('0x53')]=moment()[_0x8cb5('0x54')](_0x29b3a4,_0x8cb5('0x55'))[_0x8cb5('0x18')](_0x8cb5('0x34'));_0x258be0[_0x8cb5('0x1b')]=_0x5093c5[_0x8cb5('0x1b')];_0x258be0[_0x8cb5('0x56')]=_0x5093c5[_0x8cb5('0x56')];_0x258be0[_0x8cb5('0x1c')]=_0x5093c5[_0x8cb5('0x1c')]||undefined;return _0x258be0;};exports['decrementTalkink']=function(_0x22b7d2,_0x1ccc84){if(!_[_0x8cb5('0x16')](_0x22b7d2)){if(_0x22b7d2[_0x8cb5('0x57')]>0x0){_0x22b7d2[_0x8cb5('0x57')]-=0x1;}else{logger[_0x8cb5('0x9')](_0x1ccc84,_0x8cb5('0x58'));}}else{logger[_0x8cb5('0x9')](_0x1ccc84,_0x8cb5('0x59'));}};exports[_0x8cb5('0x5a')]=function(_0x50d20e){if(_0x50d20e<=0x0){return!![];}return![];};exports['buildObj']=function(_0x24486e,_0x4d54ad,_0xe74840){_0x24486e[_0x8cb5('0x5b')]=_0x4d54ad;_0x24486e[_0x8cb5('0x5c')]=_0x24486e[_0x8cb5('0x5d')];_0x24486e[_0x8cb5('0x5e')]=_0x24486e['channelAgent'];if(_0xe74840){_0x24486e['mandatoryDisposition']=_0xe74840[_0x8cb5('0x5f')];}return _0x24486e;};exports['buildAcw']=function(_0x380774){var _0x2ba102={};_0x2ba102['queue']=_0x380774[_0x8cb5('0x5d')];_0x2ba102[_0x8cb5('0x5e')]=_0x380774[_0x8cb5('0x48')];_0x2ba102['uniqueid']=_0x380774[_0x8cb5('0x46')];return _0x2ba102;};exports[_0x8cb5('0x60')]=function(_0x207582){var _0x3fdb3a=[];for(var _0x4f6260 in _0x207582){if(_0x207582['hasOwnProperty'](_0x4f6260)){if(!_[_0x8cb5('0x16')](_0x207582[_0x4f6260])&&_0x207582[_0x4f6260][_0x8cb5('0x35')]===_0x8cb5('0x61')&&_0x207582[_0x4f6260][_0x8cb5('0x62')]===_0x8cb5('0x63')){_0x3fdb3a[_0x8cb5('0x64')](_0x207582[_0x4f6260]['id']);}}}return _0x3fdb3a;};exports['getDiff']=function(_0x585486){var _0xac6cf5=moment()['milliseconds'](0x0);var _0x2ba7ba=moment(_0x585486)[_0x8cb5('0x6')](0x0);return _0xac6cf5[_0x8cb5('0x65')](_0x2ba7ba,_0x8cb5('0x7'));};exports['createBody']=function(_0x4b351a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4b351a[_0x8cb5('0x1b')],'ListId':_0x4b351a[_0x8cb5('0x56')],'VoiceQueueId':_0x4b351a[_0x8cb5('0x1c')]||undefined,'CampaignId':_0x4b351a['CampaignId']||undefined};};exports[_0x8cb5('0x66')]=function(_0x297c5c){if(_0x297c5c===_0x8cb5('0x46')||_0x297c5c===_0x8cb5('0x67')||_0x297c5c===_0x8cb5('0x5d')||_0x297c5c===_0x8cb5('0x68')||_0x297c5c==='campaigntype'||_0x297c5c===_0x8cb5('0x69')||_0x297c5c===_0x8cb5('0x3d')||_0x297c5c===_0x8cb5('0x48')||_0x297c5c===_0x8cb5('0x19')||_0x297c5c==='active'||_0x297c5c==='calleridnum'||_0x297c5c===_0x8cb5('0x53')||_0x297c5c===_0x8cb5('0x6a')||_0x297c5c===_0x8cb5('0x4b')||_0x297c5c===_0x8cb5('0x4c')||_0x297c5c===_0x8cb5('0x6b')||_0x297c5c==='callback'||_0x297c5c===_0x8cb5('0x6c')||_0x297c5c===_0x8cb5('0x6d')||_0x297c5c===_0x8cb5('0x6e')||_0x297c5c===_0x8cb5('0x1b')||_0x297c5c===_0x8cb5('0x56')||_0x297c5c===_0x8cb5('0x3e')||_0x297c5c===_0x8cb5('0x1c')||_0x297c5c===_0x8cb5('0x6f')||_0x297c5c==='xmd-voicequeueid'||_0x297c5c===_0x8cb5('0x70')||_0x297c5c===_0x8cb5('0x71')||_0x297c5c===_0x8cb5('0x72')||_0x297c5c===_0x8cb5('0x73')||_0x297c5c===_0x8cb5('0x74')||_0x297c5c===_0x8cb5('0x75')||_0x297c5c==='xmd-dialid'||_0x297c5c===_0x8cb5('0x76')||_0x297c5c===_0x8cb5('0x77')||_0x297c5c===_0x8cb5('0x78')||_0x297c5c==='xmd-callerid'||_0x297c5c===_0x8cb5('0x79')||_0x297c5c===_0x8cb5('0x7a')||_0x297c5c===_0x8cb5('0x7b')||_0x297c5c===_0x8cb5('0x7c')||_0x297c5c===_0x8cb5('0x7d')||_0x297c5c===_0x8cb5('0x7e')||_0x297c5c===_0x8cb5('0x7f')||_0x297c5c===_0x8cb5('0x80')||_0x297c5c==='rtpaudioqosrtt'||_0x297c5c==='rtpaudioqosrttbridged'||_0x297c5c===_0x8cb5('0x7b')||_0x297c5c==='rtpaudioqosbridged'||_0x297c5c===_0x8cb5('0x7d')||_0x297c5c===_0x8cb5('0x7e')||_0x297c5c==='rtpaudioqosloss'||_0x297c5c===_0x8cb5('0x80')||_0x297c5c===_0x8cb5('0x81')||_0x297c5c===_0x8cb5('0x82')||_0x297c5c===_0x8cb5('0x83')||_0x297c5c==='bridgepvtcallid'||_0x297c5c===_0x8cb5('0x35')||_0x297c5c===_0x8cb5('0x36')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x5c3b31,_0x4d8a09){var _0x2dc7be,_0x6975ba,_0x3d23ec;if(_0x4d8a09<=0x0){_0x4d8a09=0x1;}_0x2dc7be=new RegExp('\x5cw{0,'+_0x4d8a09+'}$');_0x6975ba=Math[_0x8cb5('0x84')](0xa,_0x4d8a09-0x1);_0x3d23ec=Math[_0x8cb5('0x84')](0xa,_0x4d8a09)-0x1;return util[_0x8cb5('0x18')]('%s',_[_0x8cb5('0x85')](_0x5c3b31,_0x2dc7be,_['random'](_0x6975ba,_0x3d23ec)));};exports[_0x8cb5('0x86')]=function(_0x327a39){var _0x43359c=_0x327a39['match'](/"(.*?)"/);return _0x43359c?_0x43359c[0x1]:_0x327a39;};exports[_0x8cb5('0x87')]=function(_0x51583e){var _0x7c47c6=_0x51583e['match'](/<(.*?)>/);return _0x7c47c6?_0x7c47c6[0x1]:_0x51583e;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 1a664c0..6512539 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 _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x54c9f0,_0x3d621c){var _0x5e8b0b=function(_0x455af0){while(--_0x455af0){_0x54c9f0['push'](_0x54c9f0['shift']());}};_0x5e8b0b(++_0x3d621c);}(_0x7a54,0x106));var _0x47a5=function(_0x538ba1,_0xf59045){_0x538ba1=_0x538ba1-0x0;var _0x11bfae=_0x7a54[_0x538ba1];return _0x11bfae;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x37459d,_0x3e5191){var _0x2fac31=function(_0x162082){while(--_0x162082){_0x37459d['push'](_0x37459d['shift']());}};_0x2fac31(++_0x3e5191);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b5c23,_0x101faa){_0x4b5c23=_0x4b5c23-0x0;var _0x262cfd=_0xb10b[_0x4b5c23];return _0x262cfd;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index a088a8d..63e5117 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 _0xa41a=['initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','templates','outbound','queueChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','initTrunks','isUndefined','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','freshdeskAccounts','initZohoAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','sumBillable','initVoiceCallReports','duration','ANSWERED','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions'];(function(_0x1b027c,_0x2b3ce2){var _0x8a5e3d=function(_0x5be863){while(--_0x5be863){_0x1b027c['push'](_0x1b027c['shift']());}};_0x8a5e3d(++_0x2b3ce2);}(_0xa41a,0x6b));var _0xaa41=function(_0x50dd05,_0x2004b1){_0x50dd05=_0x50dd05-0x0;var _0x1126cc=_0xa41a[_0x50dd05];return _0x1126cc;};'use strict';var BPromise=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var _=require('lodash');var moment=require(_0xaa41('0x2'));var Agent=require(_0xaa41('0x3'));var Telephone=require(_0xaa41('0x4'));var Trunk=require(_0xaa41('0x5'));var VoiceQueue=require(_0xaa41('0x6'));var Trigger=require(_0xaa41('0x7'));var Template=require(_0xaa41('0x8'));var Campaign=require(_0xaa41('0x9'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xaa41('0xa'));var SalesforceAccount=require(_0xaa41('0xb'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xaa41('0xc'));var DeskAccount=require(_0xaa41('0xd'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xaa41('0xe'));var Dynamics365Account=require(_0xaa41('0xf'));var FreshsalesAccount=require(_0xaa41('0x10'));var FaxAccount=require(_0xaa41('0x11'));var Realtime=function(){this[_0xaa41('0x12')]={};this[_0xaa41('0x13')]={};this[_0xaa41('0x14')]={};this[_0xaa41('0x15')]={};this[_0xaa41('0x16')]={};this['campaigns']={};this[_0xaa41('0x17')]={};this[_0xaa41('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this[_0xaa41('0x19')]={};this['outboundChannels']={};this[_0xaa41('0x1a')]={};this[_0xaa41('0x1b')]={};this[_0xaa41('0x1c')]={};this[_0xaa41('0x1d')]={};this[_0xaa41('0x1e')]={};this['freshdeskAccounts']={};this[_0xaa41('0x1f')]={};this[_0xaa41('0x20')]={};this[_0xaa41('0x21')]={};this[_0xaa41('0x22')]={};this[_0xaa41('0x23')]={};this[_0xaa41('0x24')]={};this[_0xaa41('0x25')]={};};function freeIsNotKey(_0x550ad5,_0x2d868a,_0x16b930){var _0x4210fa=_[_0xaa41('0x26')](_0x550ad5,function(_0x230a6a,_0xd20ddf){return _0x230a6a[_0x16b930];});for(var _0x29efe5 in _0x2d868a){if(_0x2d868a[_0xaa41('0x27')](_0x29efe5)){if(!_0x4210fa[_0x29efe5]){delete _0x2d868a[_0x29efe5];}}}}function freeIsNotKeySip(_0x150ddf,_0x4fe1a4){var _0x5cd936=_[_0xaa41('0x26')](_0x150ddf,function(_0x22de55,_0x35c753){return util['format'](_0xaa41('0x28'),_0x22de55[_0xaa41('0x29')]);});for(var _0x4e768e in _0x4fe1a4){if(_0x4fe1a4['hasOwnProperty'](_0x4e768e)){if(!_0x5cd936[_0x4e768e]){delete _0x4fe1a4[_0x4e768e];}}}}function freeIsNotKeyAgent(_0x1b1910,_0x5d4374){var _0xafd672=_[_0xaa41('0x26')](_0x1b1910,function(_0x3e2175,_0x1f27f3){var _0x1d623c=_['isNil'](_0x3e2175[_0xaa41('0x2a')])?util[_0xaa41('0x2b')](_0xaa41('0x28'),_0x3e2175[_0xaa41('0x29')]):_0x3e2175[_0xaa41('0x2a')];return _0x1d623c;});for(var _0xa1f024 in _0x5d4374){if(_0x5d4374['hasOwnProperty'](_0xa1f024)){if(!_0xafd672[_0xa1f024]){delete _0x5d4374[_0xa1f024];}}}}function clearVoiceCallReports(_0x5795f4){_0x5795f4[_0xaa41('0x2c')]=0x0;_0x5795f4['answered']=0x0;_0x5795f4['sumHoldTime']=0x0;_0x5795f4[_0xaa41('0x2d')]=0x0;_0x5795f4['sumBillable']=0x0;}function clearCampaigns(_0x536bed){if(!_[_0xaa41('0x2e')](_0x536bed)){for(var _0x9c8c21 in _0x536bed){if(_0x536bed[_0xaa41('0x27')](_0x9c8c21)){_0x536bed[_0x9c8c21][_0xaa41('0x2f')]=0x0;_0x536bed[_0x9c8c21][_0xaa41('0x30')]=0x0;}}}}function clearVoiceQueues(_0xa7269f){if(!_['isEmpty'](_0xa7269f)){for(var _0x30a174 in _0xa7269f){if(_0xa7269f[_0xaa41('0x27')](_0x30a174)){_0xa7269f[_0x30a174][_0xaa41('0x2c')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x31')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x32')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x33')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x34')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x2d')]=0x0;_0xa7269f[_0x30a174]['sumBillable']=0x0;_0xa7269f[_0x30a174][_0xaa41('0x35')]=0x0;_0xa7269f[_0x30a174]['outboundNoAnswerCallsDay']=0x0;_0xa7269f[_0x30a174]['outboundBusyCallsDay']=0x0;_0xa7269f[_0x30a174][_0xaa41('0x36')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x37')]=0x0;_0xa7269f[_0x30a174]['outboundUnknownCallsDay']=0x0;_0xa7269f[_0x30a174][_0xaa41('0x38')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x39')]=0x0;_0xa7269f[_0x30a174]['outboundBlacklistCallsDay']=0x0;_0xa7269f[_0x30a174]['outboundOriginateFailureCallsDay']=0x0;_0xa7269f[_0x30a174]['outboundRejectCallsDay']=0x0;_0xa7269f[_0x30a174][_0xaa41('0x3a')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x35')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x3b')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x3c')]=!![];}}}}Realtime['prototype'][_0xaa41('0x3d')]=function(_0x45c8fe,_0x3e0204){for(var _0x4de770 in _0x3e0204){if(_0x45c8fe[_0xaa41('0x27')](_0x4de770)){_0x45c8fe[_0x4de770]=_0x3e0204[_0x4de770];}}};Realtime[_0xaa41('0x3e')][_0xaa41('0x3f')]=function(){var _0x57ab80=this;return function(_0x252c62){if(_0x252c62){freeIsNotKeyAgent(_0x252c62,_0x57ab80[_0xaa41('0x12')]);for(var _0x57fe1d=0x0,_0x23eb50={},_0x13b6d4={};_0x57fe1d<_0x252c62[_0xaa41('0x40')];_0x57fe1d+=0x1){_0x23eb50=_0x252c62[_0x57fe1d];var _0x5cec87=_[_0xaa41('0x41')](_0x23eb50['interface'])?util[_0xaa41('0x2b')](_0xaa41('0x28'),_0x23eb50[_0xaa41('0x29')]):_0x23eb50['interface'];if(_['isUndefined'](_0x57ab80['agents'][_0x5cec87])){_0x57ab80[_0xaa41('0x12')][_0x5cec87]=new Agent(_0x23eb50);}else{_0x57ab80[_0xaa41('0x3d')](_0x57ab80[_0xaa41('0x12')][_0x5cec87],_0x23eb50);}}}return _0x57ab80[_0xaa41('0x12')];};};Realtime['prototype']['initTelephones']=function(){var _0x267999=this;return function(_0x5673c){if(_0x5673c){freeIsNotKeySip(_0x5673c,_0x267999[_0xaa41('0x13')]);for(var _0x4e8d2e=0x0,_0xba115a={},_0x203d83={};_0x4e8d2e<_0x5673c[_0xaa41('0x40')];_0x4e8d2e+=0x1){_0xba115a=_0x5673c[_0x4e8d2e];if(_['isUndefined'](_0x267999[_0xaa41('0x13')][util[_0xaa41('0x2b')](_0xaa41('0x28'),_0xba115a[_0xaa41('0x29')])])){_0x267999['telephones'][util['format'](_0xaa41('0x28'),_0xba115a[_0xaa41('0x29')])]=new Telephone(_0xba115a);}else{_0x267999['mergeFromDatabase'](_0x267999[_0xaa41('0x13')][util['format'](_0xaa41('0x28'),_0xba115a[_0xaa41('0x29')])],_0xba115a);}}}return _0x267999[_0xaa41('0x13')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x42')]=function(){var _0x12ba1a=this;return function(_0x3ce95c){if(_0x3ce95c){freeIsNotKeySip(_0x3ce95c,_0x12ba1a[_0xaa41('0x14')]);for(var _0x5d9b22=0x0,_0x236ff4={},_0x2abf39={};_0x5d9b22<_0x3ce95c[_0xaa41('0x40')];_0x5d9b22+=0x1){_0x236ff4=_0x3ce95c[_0x5d9b22];if(_[_0xaa41('0x43')](_0x12ba1a[_0xaa41('0x14')][util[_0xaa41('0x2b')]('SIP/%s',_0x236ff4['name'])])){_0x12ba1a[_0xaa41('0x14')][util['format'](_0xaa41('0x28'),_0x236ff4[_0xaa41('0x29')])]=new Trunk(_0x236ff4);}else{_0x12ba1a[_0xaa41('0x3d')](_0x12ba1a[_0xaa41('0x14')][util[_0xaa41('0x2b')](_0xaa41('0x28'),_0x236ff4[_0xaa41('0x29')])],_0x236ff4);}}}return _0x12ba1a['trunks'];};};Realtime[_0xaa41('0x3e')]['initVoiceQueues']=function(){var _0x4dd842=this;return function(_0x361370){if(_0x361370){freeIsNotKey(_0x361370,_0x4dd842['voiceQueues'],'name');for(var _0x5274c9=0x0,_0x3bad48={},_0x525b09={};_0x5274c9<_0x361370[_0xaa41('0x40')];_0x5274c9+=0x1){_0x3bad48=_0x361370[_0x5274c9];if(_[_0xaa41('0x43')](_0x4dd842['voiceQueues'][_0x3bad48['name']])){_0x4dd842[_0xaa41('0x15')][_0x3bad48[_0xaa41('0x29')]]=new VoiceQueue(_0x3bad48);}else{_0x4dd842[_0xaa41('0x3d')](_0x4dd842[_0xaa41('0x15')][_0x3bad48[_0xaa41('0x29')]],_0x3bad48);}}}return _0x4dd842[_0xaa41('0x15')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x44')]=function(){var _0x2fa6ec=this;return function(_0x4e1ac4){if(_0x4e1ac4){freeIsNotKey(_0x4e1ac4,_0x2fa6ec[_0xaa41('0x16')],'id');for(var _0x22d512=0x0,_0x214ca4={},_0x429c1d={};_0x22d512<_0x4e1ac4[_0xaa41('0x40')];_0x22d512+=0x1){_0x214ca4=_0x4e1ac4[_0x22d512];if(_[_0xaa41('0x43')](_0x2fa6ec['triggers'][_0x214ca4['id']])){_0x2fa6ec[_0xaa41('0x16')][_0x214ca4['id']]=new Trigger(_0x214ca4);}else{_0x2fa6ec[_0xaa41('0x3d')](_0x2fa6ec[_0xaa41('0x16')][_0x214ca4['id']],_0x214ca4);}}}return _0x2fa6ec[_0xaa41('0x16')];};};Realtime['prototype'][_0xaa41('0x45')]=function(){var _0x5787f3=this;return function(_0x49fedd){if(_0x49fedd){freeIsNotKey(_0x49fedd,_0x5787f3[_0xaa41('0x17')],'id');for(var _0xe0eec0=0x0,_0x3e16ef={},_0x4ca114={};_0xe0eec0<_0x49fedd[_0xaa41('0x40')];_0xe0eec0+=0x1){_0x3e16ef=_0x49fedd[_0xe0eec0];if(_[_0xaa41('0x43')](_0x5787f3[_0xaa41('0x17')][_0x3e16ef['id']])){_0x5787f3['templates'][_0x3e16ef['id']]=new Template(_0x3e16ef);}else{_0x5787f3[_0xaa41('0x3d')](_0x5787f3[_0xaa41('0x17')][_0x3e16ef['id']],_0x3e16ef);}}}return _0x5787f3[_0xaa41('0x17')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x46')]=function(){var _0x237b8a=this;return function(_0x333a9f){if(_0x333a9f){freeIsNotKey(_0x333a9f,_0x237b8a[_0xaa41('0x1c')],'id');for(var _0x4eab60=0x0,_0x9f0a81={},_0x5bef5f={};_0x4eab60<_0x333a9f['length'];_0x4eab60+=0x1){_0x9f0a81=_0x333a9f[_0x4eab60];if(_[_0xaa41('0x43')](_0x237b8a[_0xaa41('0x1c')][_0x9f0a81['id']])){_0x237b8a[_0xaa41('0x1c')][_0x9f0a81['id']]=new ZendeskAccount(_0x9f0a81);}else{_0x237b8a[_0xaa41('0x3d')](_0x237b8a[_0xaa41('0x1c')][_0x9f0a81['id']],_0x9f0a81);}}}return _0x237b8a[_0xaa41('0x1c')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x47')]=function(){var _0x519e39=this;return function(_0xecb54){if(_0xecb54){freeIsNotKey(_0xecb54,_0x519e39[_0xaa41('0x1d')],'id');for(var _0x1d518f=0x0,_0x4f9e92={},_0x2e0f53={};_0x1d518f<_0xecb54[_0xaa41('0x40')];_0x1d518f+=0x1){_0x4f9e92=_0xecb54[_0x1d518f];if(_['isUndefined'](_0x519e39[_0xaa41('0x1d')][_0x4f9e92['id']])){_0x519e39[_0xaa41('0x1d')][_0x4f9e92['id']]=new SalesforceAccount(_0x4f9e92);}else{_0x519e39[_0xaa41('0x3d')](_0x519e39['salesforceAccounts'][_0x4f9e92['id']],_0x4f9e92);}}}return _0x519e39[_0xaa41('0x1d')];};};Realtime[_0xaa41('0x3e')]['initFreshdeskAccounts']=function(){var _0x49789a=this;return function(_0x3745ed){if(_0x3745ed){freeIsNotKey(_0x3745ed,_0x49789a[_0xaa41('0x48')],'id');for(var _0x3a29d2=0x0,_0x4d20c6={},_0x5a76b9={};_0x3a29d2<_0x3745ed[_0xaa41('0x40')];_0x3a29d2+=0x1){_0x4d20c6=_0x3745ed[_0x3a29d2];if(_[_0xaa41('0x43')](_0x49789a[_0xaa41('0x48')][_0x4d20c6['id']])){_0x49789a[_0xaa41('0x48')][_0x4d20c6['id']]=new FreshdeskAccount(_0x4d20c6);}else{_0x49789a['mergeFromDatabase'](_0x49789a[_0xaa41('0x48')][_0x4d20c6['id']],_0x4d20c6);}}}return _0x49789a['freshdeskAccounts'];};};Realtime['prototype'][_0xaa41('0x49')]=function(){var _0x52ae7f=this;return function(_0x3621c0){if(_0x3621c0){freeIsNotKey(_0x3621c0,_0x52ae7f[_0xaa41('0x1f')],'id');for(var _0x169ddf=0x0,_0x5e83e1={},_0x12ba1b={};_0x169ddf<_0x3621c0[_0xaa41('0x40')];_0x169ddf+=0x1){_0x5e83e1=_0x3621c0[_0x169ddf];if(_[_0xaa41('0x43')](_0x52ae7f[_0xaa41('0x1f')][_0x5e83e1['id']])){_0x52ae7f[_0xaa41('0x1f')][_0x5e83e1['id']]=new ZohoAccount(_0x5e83e1);}else{_0x52ae7f[_0xaa41('0x3d')](_0x52ae7f[_0xaa41('0x1f')][_0x5e83e1['id']],_0x5e83e1);}}}return _0x52ae7f[_0xaa41('0x1f')];};};Realtime[_0xaa41('0x3e')]['initDeskAccounts']=function(){var _0x35a09e=this;return function(_0x40cdfc){if(_0x40cdfc){freeIsNotKey(_0x40cdfc,_0x35a09e[_0xaa41('0x20')],'id');for(var _0x5a5a55=0x0,_0x3fe47a={},_0x2caf5c={};_0x5a5a55<_0x40cdfc[_0xaa41('0x40')];_0x5a5a55+=0x1){_0x3fe47a=_0x40cdfc[_0x5a5a55];if(_[_0xaa41('0x43')](_0x35a09e[_0xaa41('0x20')][_0x3fe47a['id']])){_0x35a09e[_0xaa41('0x20')][_0x3fe47a['id']]=new DeskAccount(_0x3fe47a);}else{_0x35a09e[_0xaa41('0x3d')](_0x35a09e['deskAccounts'][_0x3fe47a['id']],_0x3fe47a);}}}return _0x35a09e['deskAccounts'];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x4ec357=this;return function(_0x4a181a){if(_0x4a181a){freeIsNotKey(_0x4a181a,_0x4ec357[_0xaa41('0x1e')],'id');for(var _0x50b598=0x0,_0x576e6e={},_0x24c6f3={};_0x50b598<_0x4a181a[_0xaa41('0x40')];_0x50b598+=0x1){_0x576e6e=_0x4a181a[_0x50b598];if(_[_0xaa41('0x43')](_0x4ec357[_0xaa41('0x1e')][_0x576e6e['id']])){_0x4ec357['sugarcrmAccounts'][_0x576e6e['id']]=new SugarcrmAccount(_0x576e6e);}else{_0x4ec357[_0xaa41('0x3d')](_0x4ec357[_0xaa41('0x1e')][_0x576e6e['id']],_0x576e6e);}}}return _0x4ec357[_0xaa41('0x1e')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x4a')]=function(){var _0x41ca40=this;return function(_0x46ebcd){if(_0x46ebcd){freeIsNotKey(_0x46ebcd,_0x41ca40[_0xaa41('0x21')],'id');for(var _0x1795d1=0x0,_0x54344c={},_0x185600={};_0x1795d1<_0x46ebcd[_0xaa41('0x40')];_0x1795d1+=0x1){_0x54344c=_0x46ebcd[_0x1795d1];if(_['isUndefined'](_0x41ca40['vtigerAccounts'][_0x54344c['id']])){_0x41ca40['vtigerAccounts'][_0x54344c['id']]=new VtigerAccount(_0x54344c);}else{_0x41ca40[_0xaa41('0x3d')](_0x41ca40['vtigerAccounts'][_0x54344c['id']],_0x54344c);}}}return _0x41ca40[_0xaa41('0x21')];};};Realtime['prototype'][_0xaa41('0x4b')]=function(){var _0x18d18b=this;return function(_0x4b1ec4){if(_0x4b1ec4){freeIsNotKey(_0x4b1ec4,_0x18d18b[_0xaa41('0x22')],'id');for(var _0x33efc5=0x0,_0x3d150d={},_0x33f5c2={};_0x33efc5<_0x4b1ec4['length'];_0x33efc5+=0x1){_0x3d150d=_0x4b1ec4[_0x33efc5];if(_['isUndefined'](_0x18d18b[_0xaa41('0x22')][_0x3d150d['id']])){_0x18d18b[_0xaa41('0x22')][_0x3d150d['id']]=new ServicenowAccount(_0x3d150d);}else{_0x18d18b['mergeFromDatabase'](_0x18d18b['servicenowAccounts'][_0x3d150d['id']],_0x3d150d);}}}return _0x18d18b[_0xaa41('0x22')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x4c')]=function(){var _0xbeafb5=this;return function(_0x3dbe37){if(_0x3dbe37){freeIsNotKey(_0x3dbe37,_0xbeafb5['dynamics365Accounts'],'id');for(var _0x475ceb=0x0,_0x4c61d0={},_0x5062db={};_0x475ceb<_0x3dbe37['length'];_0x475ceb+=0x1){_0x4c61d0=_0x3dbe37[_0x475ceb];if(_[_0xaa41('0x43')](_0xbeafb5[_0xaa41('0x23')][_0x4c61d0['id']])){_0xbeafb5[_0xaa41('0x23')][_0x4c61d0['id']]=new Dynamics365Account(_0x4c61d0);}else{_0xbeafb5['mergeFromDatabase'](_0xbeafb5[_0xaa41('0x23')][_0x4c61d0['id']],_0x4c61d0);}}}return _0xbeafb5[_0xaa41('0x23')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x4d')]=function(){var _0x457515=this;return function(_0x3ffbf8){if(_0x3ffbf8){freeIsNotKey(_0x3ffbf8,_0x457515[_0xaa41('0x24')],'id');for(var _0x50a53b=0x0,_0x1d2978={},_0x3031e5={};_0x50a53b<_0x3ffbf8[_0xaa41('0x40')];_0x50a53b+=0x1){_0x1d2978=_0x3ffbf8[_0x50a53b];if(_[_0xaa41('0x43')](_0x457515['freshsalesAccounts'][_0x1d2978['id']])){_0x457515[_0xaa41('0x24')][_0x1d2978['id']]=new FreshsalesAccount(_0x1d2978);}else{_0x457515['mergeFromDatabase'](_0x457515[_0xaa41('0x24')][_0x1d2978['id']],_0x1d2978);}}}return _0x457515[_0xaa41('0x24')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x4e')]=function(){var _0x491cad=this;return function(_0xf456c1){for(var _0x1a4197=0x0;_0x1a4197<_0xf456c1[_0xaa41('0x40')];_0x1a4197+=0x1){_[_0xaa41('0x4f')](_0x491cad['voiceQueues'][_0xf456c1[_0x1a4197][_0xaa41('0x29')]],_0xf456c1[_0x1a4197]);}return _0x491cad['voiceQueues'];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x50')]=function(){var _0x574316=this;return function(_0x1ac05e){clearVoiceQueues(_0x574316[_0xaa41('0x15')]);if(_0x1ac05e){_0x1ac05e=_[_0xaa41('0x51')](_0x1ac05e,_0xaa41('0x52'));for(var _0x1c5df8 in _0x1ac05e){if(_0x1ac05e[_0xaa41('0x27')](_0x1c5df8)){var _0x384aba={};for(var _0x297ec6=0x0;_0x297ec6<_0x1ac05e[_0x1c5df8][_0xaa41('0x40')];_0x297ec6+=0x1){var _0x3d4f1e=_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x53')];if(_0x574316['voiceQueues'][_0x3d4f1e]){if(_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x54')]){_0x574316[_0xaa41('0x15')][_0x3d4f1e][_0xaa41('0x32')]+=0x1;}if(_0x1ac05e[_0x1c5df8][_0x297ec6]['queuecallerabandon']){_0x574316['voiceQueues'][_0x3d4f1e][_0xaa41('0x33')]+=0x1;}_0x574316[_0xaa41('0x15')][_0x3d4f1e]['sumHoldTime']+=moment(_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x55')])[_0xaa41('0x56')](moment(_0x1ac05e[_0x1c5df8][_0x297ec6]['queuecallerjoinAt']),_0xaa41('0x57'))||0x0;if(_0x297ec6===_0x1ac05e[_0x1c5df8][_0xaa41('0x40')]-0x1){_0x574316[_0xaa41('0x15')][_0x3d4f1e][_0xaa41('0x2d')]+=moment(_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x58')]||_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x59')]||_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x5a')])[_0xaa41('0x56')](moment(_0x1ac05e[_0x1c5df8][_0x297ec6]['queuecallerjoinAt']),'seconds')||0x0;_0x574316[_0xaa41('0x15')][_0x3d4f1e]['total']+=0x1;if(_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x5b')]){_0x574316[_0xaa41('0x15')][_0x3d4f1e][_0xaa41('0x31')]+=0x1;_0x574316['voiceQueues'][_0x3d4f1e][_0xaa41('0x5c')]+=moment(_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x58')])[_0xaa41('0x56')](moment(_0x1ac05e[_0x1c5df8][_0x297ec6]['queuecallerleaveAt']),_0xaa41('0x57'))||0x0;}}else{_0x574316[_0xaa41('0x15')][_0x3d4f1e]['sumDuration']+=_0x574316[_0xaa41('0x15')][_0x3d4f1e]['sumHoldTime']||0x0;}}}}}}return _0x574316['voiceQueues'];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x5d')]=function(){var _0x5eded3=this;return function(_0x5a8cb0){clearVoiceCallReports(_0x5eded3[_0xaa41('0x18')]);if(_0x5a8cb0){for(var _0x1726ec=0x0;_0x1726ec<_0x5a8cb0[_0xaa41('0x40')];_0x1726ec+=0x1){_0x5eded3[_0xaa41('0x18')]['total']+=0x1;_0x5eded3[_0xaa41('0x18')][_0xaa41('0x2d')]+=_0x5a8cb0[_0x1726ec][_0xaa41('0x5e')];if(_0x5a8cb0[_0x1726ec]['disposition']===_0xaa41('0x5f')){_0x5eded3[_0xaa41('0x18')][_0xaa41('0x31')]+=0x1;_0x5eded3['outbound'][_0xaa41('0x34')]+=_0x5a8cb0[_0x1726ec]['duration']-_0x5a8cb0[_0x1726ec]['billableseconds']||0x0;_0x5eded3[_0xaa41('0x18')][_0xaa41('0x5c')]+=_0x5a8cb0[_0x1726ec]['billableseconds'];}}}return _0x5eded3[_0xaa41('0x18')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x60')]=function(){var _0x531fd4=this;return function(_0x292384){if(_0x292384){freeIsNotKey(_0x292384,_0x531fd4[_0xaa41('0x61')],_0xaa41('0x29'));for(var _0x16dcac=0x0,_0x38f5d0={};_0x16dcac<_0x292384['length'];_0x16dcac+=0x1){_0x38f5d0=_0x292384[_0x16dcac];if(_[_0xaa41('0x43')](_0x531fd4['campaigns'][_0x38f5d0[_0xaa41('0x29')]])){_0x531fd4[_0xaa41('0x61')][_0x38f5d0[_0xaa41('0x29')]]=new Campaign(_0x38f5d0);}else{_0x531fd4[_0xaa41('0x3d')](_0x531fd4[_0xaa41('0x61')][_0x38f5d0[_0xaa41('0x29')]],_0x38f5d0);_0x531fd4[_0xaa41('0x61')][_0x38f5d0[_0xaa41('0x29')]][_0xaa41('0x62')]=_0x38f5d0[_0xaa41('0x63')]?_0x38f5d0[_0xaa41('0x63')]['name']:undefined;}}}return _0x531fd4[_0xaa41('0x61')];};};Realtime[_0xaa41('0x3e')]['initVoiceExtensions']=function(){var _0x2961bc=this;return function(_0x543ab4){if(_0x543ab4){freeIsNotKey(_0x543ab4,_0x2961bc[_0xaa41('0x64')],'id');for(var _0xb44b1f=0x0,_0x472eb3={};_0xb44b1f<_0x543ab4[_0xaa41('0x40')];_0xb44b1f+=0x1){_0x472eb3=_0x543ab4[_0xb44b1f];if(_[_0xaa41('0x43')](_0x2961bc[_0xaa41('0x64')][_0x472eb3['id']])){_0x2961bc[_0xaa41('0x64')][_0x472eb3['id']]=new VoiceExtension(_0x472eb3);}else{_0x2961bc['mergeFromDatabase'](_0x2961bc[_0xaa41('0x64')][_0x472eb3['id']],_0x472eb3);}}}return _0x2961bc[_0xaa41('0x64')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x65')]=function(){var _0x585ce7=this;return function(_0x2e4d3f){clearCampaigns(_0x585ce7['campaigns']);for(var _0x23d90e=0x0;_0x23d90e<_0x2e4d3f[_0xaa41('0x40')];_0x23d90e+=0x1){_[_0xaa41('0x4f')](_0x585ce7[_0xaa41('0x61')][_0x2e4d3f[_0x23d90e][_0xaa41('0x29')]],_0x2e4d3f[_0x23d90e]);}return _0x585ce7['campaigns'];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x66')]=function(){var _0x5819ac=this;return function(_0x44743b){if(_0x44743b){freeIsNotKey(_0x44743b,_0x5819ac[_0xaa41('0x25')],'id');for(var _0x455571=0x0,_0x20184e={},_0x298533={};_0x455571<_0x44743b[_0xaa41('0x40')];_0x455571+=0x1){_0x20184e=_0x44743b[_0x455571];if(_[_0xaa41('0x43')](_0x5819ac[_0xaa41('0x25')][_0x20184e['id']])){_0x5819ac['faxAccounts'][_0x20184e['id']]=new FaxAccount(_0x20184e);}else{_0x5819ac[_0xaa41('0x3d')](_0x5819ac[_0xaa41('0x25')][_0x20184e['id']],_0x20184e);}}}return _0x5819ac[_0xaa41('0x25')];};};module[_0xaa41('0x67')]=Realtime; \ No newline at end of file +var _0x9bde=['diff','queuecallercomplete','initVoiceCallReports','duration','billableseconds','initCampaigns','campaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','util','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','trunks','voiceQueues','triggers','templates','outbound','voiceExtensions','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','isUndefined','telephones','initTrunks','initVoiceQueues','initTriggers','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt'];(function(_0x4db9b5,_0x64570b){var _0x2a36c3=function(_0x4f9877){while(--_0x4f9877){_0x4db9b5['push'](_0x4db9b5['shift']());}};_0x2a36c3(++_0x64570b);}(_0x9bde,0xe1));var _0xe9bd=function(_0x238537,_0x368c54){_0x238537=_0x238537-0x0;var _0x48eaa7=_0x9bde[_0x238537];return _0x48eaa7;};'use strict';var BPromise=require('bluebird');var util=require(_0xe9bd('0x0'));var _=require('lodash');var moment=require(_0xe9bd('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe9bd('0x2'));var Trunk=require(_0xe9bd('0x3'));var VoiceQueue=require(_0xe9bd('0x4'));var Trigger=require(_0xe9bd('0x5'));var Template=require(_0xe9bd('0x6'));var Campaign=require(_0xe9bd('0x7'));var VoiceExtension=require(_0xe9bd('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xe9bd('0x9'));var FreshdeskAccount=require(_0xe9bd('0xa'));var SugarcrmAccount=require(_0xe9bd('0xb'));var ZohoAccount=require(_0xe9bd('0xc'));var DeskAccount=require(_0xe9bd('0xd'));var VtigerAccount=require(_0xe9bd('0xe'));var ServicenowAccount=require(_0xe9bd('0xf'));var Dynamics365Account=require(_0xe9bd('0x10'));var FreshsalesAccount=require(_0xe9bd('0x11'));var FaxAccount=require(_0xe9bd('0x12'));var Realtime=function(){this['agents']={};this['telephones']={};this[_0xe9bd('0x13')]={};this[_0xe9bd('0x14')]={};this[_0xe9bd('0x15')]={};this['campaigns']={};this[_0xe9bd('0x16')]={};this[_0xe9bd('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe9bd('0x18')]={};this[_0xe9bd('0x19')]={};this['queueChannels']={};this[_0xe9bd('0x1a')]={};this['timers']={};this[_0xe9bd('0x1b')]={};this[_0xe9bd('0x1c')]={};this[_0xe9bd('0x1d')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xe9bd('0x1e')]={};this[_0xe9bd('0x1f')]={};this[_0xe9bd('0x20')]={};this[_0xe9bd('0x21')]={};this[_0xe9bd('0x22')]={};this[_0xe9bd('0x23')]={};this[_0xe9bd('0x24')]={};};function freeIsNotKey(_0x573350,_0x1d11a0,_0x464a1b){var _0x160281=_['mapKeys'](_0x573350,function(_0x36f03d,_0x3bae08){return _0x36f03d[_0x464a1b];});for(var _0x34ba2b in _0x1d11a0){if(_0x1d11a0[_0xe9bd('0x25')](_0x34ba2b)){if(!_0x160281[_0x34ba2b]){delete _0x1d11a0[_0x34ba2b];}}}}function freeIsNotKeySip(_0x5cf674,_0x20ec32){var _0x50a5e8=_[_0xe9bd('0x26')](_0x5cf674,function(_0x55b869,_0x26aa4a){return util[_0xe9bd('0x27')](_0xe9bd('0x28'),_0x55b869[_0xe9bd('0x29')]);});for(var _0x1acb82 in _0x20ec32){if(_0x20ec32[_0xe9bd('0x25')](_0x1acb82)){if(!_0x50a5e8[_0x1acb82]){delete _0x20ec32[_0x1acb82];}}}}function freeIsNotKeyAgent(_0x6593ce,_0x49165b){var _0x133318=_[_0xe9bd('0x26')](_0x6593ce,function(_0x4ecaf5,_0x37aec1){var _0x505c23=_[_0xe9bd('0x2a')](_0x4ecaf5[_0xe9bd('0x2b')])?util[_0xe9bd('0x27')](_0xe9bd('0x28'),_0x4ecaf5['name']):_0x4ecaf5[_0xe9bd('0x2b')];return _0x505c23;});for(var _0x1e3cbb in _0x49165b){if(_0x49165b[_0xe9bd('0x25')](_0x1e3cbb)){if(!_0x133318[_0x1e3cbb]){delete _0x49165b[_0x1e3cbb];}}}}function clearVoiceCallReports(_0x39b206){_0x39b206[_0xe9bd('0x2c')]=0x0;_0x39b206[_0xe9bd('0x2d')]=0x0;_0x39b206[_0xe9bd('0x2e')]=0x0;_0x39b206[_0xe9bd('0x2f')]=0x0;_0x39b206[_0xe9bd('0x30')]=0x0;}function clearCampaigns(_0x5987af){if(!_[_0xe9bd('0x31')](_0x5987af)){for(var _0x38fdfa in _0x5987af){if(_0x5987af['hasOwnProperty'](_0x38fdfa)){_0x5987af[_0x38fdfa][_0xe9bd('0x32')]=0x0;_0x5987af[_0x38fdfa][_0xe9bd('0x33')]=0x0;}}}}function clearVoiceQueues(_0x119672){if(!_[_0xe9bd('0x31')](_0x119672)){for(var _0x141b95 in _0x119672){if(_0x119672[_0xe9bd('0x25')](_0x141b95)){_0x119672[_0x141b95]['total']=0x0;_0x119672[_0x141b95]['answered']=0x0;_0x119672[_0x141b95][_0xe9bd('0x34')]=0x0;_0x119672[_0x141b95]['abandoned']=0x0;_0x119672[_0x141b95][_0xe9bd('0x2e')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x2f')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x30')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x35')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x36')]=0x0;_0x119672[_0x141b95]['outboundBusyCallsDay']=0x0;_0x119672[_0x141b95]['outboundCongestionCallsDay']=0x0;_0x119672[_0x141b95][_0xe9bd('0x37')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x38')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x39')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x3a')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x3b')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x3c')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x3d')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x3e')]=0x0;_0x119672[_0x141b95][_0xe9bd('0x35')]=0x0;_0x119672[_0x141b95]['outboundAnswerCallsDay']=0x0;_0x119672[_0x141b95][_0xe9bd('0x3f')]=!![];}}}}Realtime[_0xe9bd('0x40')][_0xe9bd('0x41')]=function(_0x5117bc,_0x524e08){for(var _0x25eeab in _0x524e08){if(_0x5117bc[_0xe9bd('0x25')](_0x25eeab)){_0x5117bc[_0x25eeab]=_0x524e08[_0x25eeab];}}};Realtime[_0xe9bd('0x40')][_0xe9bd('0x42')]=function(){var _0x1dda43=this;return function(_0x2950e8){if(_0x2950e8){freeIsNotKeyAgent(_0x2950e8,_0x1dda43[_0xe9bd('0x43')]);for(var _0x1c6173=0x0,_0x1a1a29={},_0x32b3e3={};_0x1c6173<_0x2950e8[_0xe9bd('0x44')];_0x1c6173+=0x1){_0x1a1a29=_0x2950e8[_0x1c6173];var _0x549dd1=_[_0xe9bd('0x2a')](_0x1a1a29[_0xe9bd('0x2b')])?util[_0xe9bd('0x27')](_0xe9bd('0x28'),_0x1a1a29[_0xe9bd('0x29')]):_0x1a1a29[_0xe9bd('0x2b')];if(_['isUndefined'](_0x1dda43[_0xe9bd('0x43')][_0x549dd1])){_0x1dda43[_0xe9bd('0x43')][_0x549dd1]=new Agent(_0x1a1a29);}else{_0x1dda43['mergeFromDatabase'](_0x1dda43[_0xe9bd('0x43')][_0x549dd1],_0x1a1a29);}}}return _0x1dda43[_0xe9bd('0x43')];};};Realtime['prototype']['initTelephones']=function(){var _0x2785e6=this;return function(_0xdf43b9){if(_0xdf43b9){freeIsNotKeySip(_0xdf43b9,_0x2785e6['telephones']);for(var _0x2d1289=0x0,_0x3ea705={},_0x14927c={};_0x2d1289<_0xdf43b9['length'];_0x2d1289+=0x1){_0x3ea705=_0xdf43b9[_0x2d1289];if(_[_0xe9bd('0x45')](_0x2785e6['telephones'][util[_0xe9bd('0x27')](_0xe9bd('0x28'),_0x3ea705[_0xe9bd('0x29')])])){_0x2785e6[_0xe9bd('0x46')][util['format'](_0xe9bd('0x28'),_0x3ea705[_0xe9bd('0x29')])]=new Telephone(_0x3ea705);}else{_0x2785e6[_0xe9bd('0x41')](_0x2785e6[_0xe9bd('0x46')][util[_0xe9bd('0x27')](_0xe9bd('0x28'),_0x3ea705[_0xe9bd('0x29')])],_0x3ea705);}}}return _0x2785e6[_0xe9bd('0x46')];};};Realtime[_0xe9bd('0x40')][_0xe9bd('0x47')]=function(){var _0x4e8565=this;return function(_0x5e3604){if(_0x5e3604){freeIsNotKeySip(_0x5e3604,_0x4e8565[_0xe9bd('0x13')]);for(var _0x499e13=0x0,_0x4608a0={},_0x340819={};_0x499e13<_0x5e3604[_0xe9bd('0x44')];_0x499e13+=0x1){_0x4608a0=_0x5e3604[_0x499e13];if(_['isUndefined'](_0x4e8565[_0xe9bd('0x13')][util[_0xe9bd('0x27')](_0xe9bd('0x28'),_0x4608a0['name'])])){_0x4e8565[_0xe9bd('0x13')][util[_0xe9bd('0x27')](_0xe9bd('0x28'),_0x4608a0[_0xe9bd('0x29')])]=new Trunk(_0x4608a0);}else{_0x4e8565[_0xe9bd('0x41')](_0x4e8565[_0xe9bd('0x13')][util[_0xe9bd('0x27')](_0xe9bd('0x28'),_0x4608a0[_0xe9bd('0x29')])],_0x4608a0);}}}return _0x4e8565[_0xe9bd('0x13')];};};Realtime[_0xe9bd('0x40')][_0xe9bd('0x48')]=function(){var _0x2d4e62=this;return function(_0x2a9e09){if(_0x2a9e09){freeIsNotKey(_0x2a9e09,_0x2d4e62[_0xe9bd('0x14')],'name');for(var _0x5a86fd=0x0,_0x283e67={},_0x2ced7c={};_0x5a86fd<_0x2a9e09[_0xe9bd('0x44')];_0x5a86fd+=0x1){_0x283e67=_0x2a9e09[_0x5a86fd];if(_['isUndefined'](_0x2d4e62['voiceQueues'][_0x283e67[_0xe9bd('0x29')]])){_0x2d4e62[_0xe9bd('0x14')][_0x283e67[_0xe9bd('0x29')]]=new VoiceQueue(_0x283e67);}else{_0x2d4e62[_0xe9bd('0x41')](_0x2d4e62[_0xe9bd('0x14')][_0x283e67[_0xe9bd('0x29')]],_0x283e67);}}}return _0x2d4e62[_0xe9bd('0x14')];};};Realtime['prototype'][_0xe9bd('0x49')]=function(){var _0x4cc146=this;return function(_0x36726e){if(_0x36726e){freeIsNotKey(_0x36726e,_0x4cc146[_0xe9bd('0x15')],'id');for(var _0x33ba69=0x0,_0x17dbcd={},_0x74ea23={};_0x33ba69<_0x36726e['length'];_0x33ba69+=0x1){_0x17dbcd=_0x36726e[_0x33ba69];if(_[_0xe9bd('0x45')](_0x4cc146[_0xe9bd('0x15')][_0x17dbcd['id']])){_0x4cc146[_0xe9bd('0x15')][_0x17dbcd['id']]=new Trigger(_0x17dbcd);}else{_0x4cc146['mergeFromDatabase'](_0x4cc146[_0xe9bd('0x15')][_0x17dbcd['id']],_0x17dbcd);}}}return _0x4cc146[_0xe9bd('0x15')];};};Realtime[_0xe9bd('0x40')]['initTemplates']=function(){var _0x28d2ea=this;return function(_0x27e7b0){if(_0x27e7b0){freeIsNotKey(_0x27e7b0,_0x28d2ea[_0xe9bd('0x16')],'id');for(var _0x10ec29=0x0,_0x1ee09c={},_0x579d26={};_0x10ec29<_0x27e7b0[_0xe9bd('0x44')];_0x10ec29+=0x1){_0x1ee09c=_0x27e7b0[_0x10ec29];if(_['isUndefined'](_0x28d2ea[_0xe9bd('0x16')][_0x1ee09c['id']])){_0x28d2ea[_0xe9bd('0x16')][_0x1ee09c['id']]=new Template(_0x1ee09c);}else{_0x28d2ea[_0xe9bd('0x41')](_0x28d2ea[_0xe9bd('0x16')][_0x1ee09c['id']],_0x1ee09c);}}}return _0x28d2ea[_0xe9bd('0x16')];};};Realtime['prototype'][_0xe9bd('0x4a')]=function(){var _0x485e95=this;return function(_0x14eed2){if(_0x14eed2){freeIsNotKey(_0x14eed2,_0x485e95[_0xe9bd('0x1c')],'id');for(var _0x5e08ae=0x0,_0x59d5cb={},_0x1ce539={};_0x5e08ae<_0x14eed2['length'];_0x5e08ae+=0x1){_0x59d5cb=_0x14eed2[_0x5e08ae];if(_[_0xe9bd('0x45')](_0x485e95['zendeskAccounts'][_0x59d5cb['id']])){_0x485e95[_0xe9bd('0x1c')][_0x59d5cb['id']]=new ZendeskAccount(_0x59d5cb);}else{_0x485e95[_0xe9bd('0x41')](_0x485e95['zendeskAccounts'][_0x59d5cb['id']],_0x59d5cb);}}}return _0x485e95[_0xe9bd('0x1c')];};};Realtime['prototype'][_0xe9bd('0x4b')]=function(){var _0x2d9a94=this;return function(_0x321050){if(_0x321050){freeIsNotKey(_0x321050,_0x2d9a94['salesforceAccounts'],'id');for(var _0xa2ef49=0x0,_0x1d703f={},_0x45b69e={};_0xa2ef49<_0x321050[_0xe9bd('0x44')];_0xa2ef49+=0x1){_0x1d703f=_0x321050[_0xa2ef49];if(_['isUndefined'](_0x2d9a94['salesforceAccounts'][_0x1d703f['id']])){_0x2d9a94[_0xe9bd('0x1d')][_0x1d703f['id']]=new SalesforceAccount(_0x1d703f);}else{_0x2d9a94['mergeFromDatabase'](_0x2d9a94[_0xe9bd('0x1d')][_0x1d703f['id']],_0x1d703f);}}}return _0x2d9a94[_0xe9bd('0x1d')];};};Realtime[_0xe9bd('0x40')][_0xe9bd('0x4c')]=function(){var _0x159f68=this;return function(_0x145ea3){if(_0x145ea3){freeIsNotKey(_0x145ea3,_0x159f68[_0xe9bd('0x4d')],'id');for(var _0x3381ee=0x0,_0x46a099={},_0x3be526={};_0x3381ee<_0x145ea3[_0xe9bd('0x44')];_0x3381ee+=0x1){_0x46a099=_0x145ea3[_0x3381ee];if(_[_0xe9bd('0x45')](_0x159f68['freshdeskAccounts'][_0x46a099['id']])){_0x159f68['freshdeskAccounts'][_0x46a099['id']]=new FreshdeskAccount(_0x46a099);}else{_0x159f68['mergeFromDatabase'](_0x159f68[_0xe9bd('0x4d')][_0x46a099['id']],_0x46a099);}}}return _0x159f68['freshdeskAccounts'];};};Realtime[_0xe9bd('0x40')][_0xe9bd('0x4e')]=function(){var _0x90db01=this;return function(_0x6232e5){if(_0x6232e5){freeIsNotKey(_0x6232e5,_0x90db01[_0xe9bd('0x1e')],'id');for(var _0xaf6ffd=0x0,_0x3bb2ba={},_0x46797c={};_0xaf6ffd<_0x6232e5[_0xe9bd('0x44')];_0xaf6ffd+=0x1){_0x3bb2ba=_0x6232e5[_0xaf6ffd];if(_['isUndefined'](_0x90db01[_0xe9bd('0x1e')][_0x3bb2ba['id']])){_0x90db01[_0xe9bd('0x1e')][_0x3bb2ba['id']]=new ZohoAccount(_0x3bb2ba);}else{_0x90db01[_0xe9bd('0x41')](_0x90db01[_0xe9bd('0x1e')][_0x3bb2ba['id']],_0x3bb2ba);}}}return _0x90db01['zohoAccounts'];};};Realtime[_0xe9bd('0x40')][_0xe9bd('0x4f')]=function(){var _0x34bd38=this;return function(_0x4e05f0){if(_0x4e05f0){freeIsNotKey(_0x4e05f0,_0x34bd38[_0xe9bd('0x1f')],'id');for(var _0x204ea9=0x0,_0x2d724f={},_0xfe82f7={};_0x204ea9<_0x4e05f0['length'];_0x204ea9+=0x1){_0x2d724f=_0x4e05f0[_0x204ea9];if(_['isUndefined'](_0x34bd38[_0xe9bd('0x1f')][_0x2d724f['id']])){_0x34bd38[_0xe9bd('0x1f')][_0x2d724f['id']]=new DeskAccount(_0x2d724f);}else{_0x34bd38[_0xe9bd('0x41')](_0x34bd38[_0xe9bd('0x1f')][_0x2d724f['id']],_0x2d724f);}}}return _0x34bd38['deskAccounts'];};};Realtime['prototype'][_0xe9bd('0x50')]=function(){var _0x20855b=this;return function(_0x3ea0cc){if(_0x3ea0cc){freeIsNotKey(_0x3ea0cc,_0x20855b[_0xe9bd('0x51')],'id');for(var _0x1fd2b5=0x0,_0x23f476={},_0x4870f8={};_0x1fd2b5<_0x3ea0cc[_0xe9bd('0x44')];_0x1fd2b5+=0x1){_0x23f476=_0x3ea0cc[_0x1fd2b5];if(_['isUndefined'](_0x20855b[_0xe9bd('0x51')][_0x23f476['id']])){_0x20855b[_0xe9bd('0x51')][_0x23f476['id']]=new SugarcrmAccount(_0x23f476);}else{_0x20855b[_0xe9bd('0x41')](_0x20855b[_0xe9bd('0x51')][_0x23f476['id']],_0x23f476);}}}return _0x20855b['sugarcrmAccounts'];};};Realtime[_0xe9bd('0x40')][_0xe9bd('0x52')]=function(){var _0x3b0190=this;return function(_0x4f35c4){if(_0x4f35c4){freeIsNotKey(_0x4f35c4,_0x3b0190[_0xe9bd('0x20')],'id');for(var _0x1a9d0c=0x0,_0x396154={},_0x3e3e05={};_0x1a9d0c<_0x4f35c4[_0xe9bd('0x44')];_0x1a9d0c+=0x1){_0x396154=_0x4f35c4[_0x1a9d0c];if(_[_0xe9bd('0x45')](_0x3b0190[_0xe9bd('0x20')][_0x396154['id']])){_0x3b0190[_0xe9bd('0x20')][_0x396154['id']]=new VtigerAccount(_0x396154);}else{_0x3b0190[_0xe9bd('0x41')](_0x3b0190[_0xe9bd('0x20')][_0x396154['id']],_0x396154);}}}return _0x3b0190[_0xe9bd('0x20')];};};Realtime[_0xe9bd('0x40')]['initServicenowAccounts']=function(){var _0x3a12e9=this;return function(_0x9d0603){if(_0x9d0603){freeIsNotKey(_0x9d0603,_0x3a12e9['servicenowAccounts'],'id');for(var _0x2c2d78=0x0,_0xe82570={},_0x59b8be={};_0x2c2d78<_0x9d0603['length'];_0x2c2d78+=0x1){_0xe82570=_0x9d0603[_0x2c2d78];if(_[_0xe9bd('0x45')](_0x3a12e9[_0xe9bd('0x21')][_0xe82570['id']])){_0x3a12e9['servicenowAccounts'][_0xe82570['id']]=new ServicenowAccount(_0xe82570);}else{_0x3a12e9['mergeFromDatabase'](_0x3a12e9['servicenowAccounts'][_0xe82570['id']],_0xe82570);}}}return _0x3a12e9[_0xe9bd('0x21')];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x4b5bfb=this;return function(_0x4bcf2b){if(_0x4bcf2b){freeIsNotKey(_0x4bcf2b,_0x4b5bfb[_0xe9bd('0x22')],'id');for(var _0x46da33=0x0,_0x2ed5f2={},_0x4947b0={};_0x46da33<_0x4bcf2b[_0xe9bd('0x44')];_0x46da33+=0x1){_0x2ed5f2=_0x4bcf2b[_0x46da33];if(_[_0xe9bd('0x45')](_0x4b5bfb[_0xe9bd('0x22')][_0x2ed5f2['id']])){_0x4b5bfb[_0xe9bd('0x22')][_0x2ed5f2['id']]=new Dynamics365Account(_0x2ed5f2);}else{_0x4b5bfb['mergeFromDatabase'](_0x4b5bfb[_0xe9bd('0x22')][_0x2ed5f2['id']],_0x2ed5f2);}}}return _0x4b5bfb[_0xe9bd('0x22')];};};Realtime[_0xe9bd('0x40')]['initFreshsalesAccounts']=function(){var _0x5248fd=this;return function(_0x3e68fb){if(_0x3e68fb){freeIsNotKey(_0x3e68fb,_0x5248fd[_0xe9bd('0x23')],'id');for(var _0x1f41fc=0x0,_0x40d9e0={},_0x5bea46={};_0x1f41fc<_0x3e68fb[_0xe9bd('0x44')];_0x1f41fc+=0x1){_0x40d9e0=_0x3e68fb[_0x1f41fc];if(_[_0xe9bd('0x45')](_0x5248fd[_0xe9bd('0x23')][_0x40d9e0['id']])){_0x5248fd['freshsalesAccounts'][_0x40d9e0['id']]=new FreshsalesAccount(_0x40d9e0);}else{_0x5248fd[_0xe9bd('0x41')](_0x5248fd[_0xe9bd('0x23')][_0x40d9e0['id']],_0x40d9e0);}}}return _0x5248fd[_0xe9bd('0x23')];};};Realtime[_0xe9bd('0x40')][_0xe9bd('0x53')]=function(){var _0x5d7257=this;return function(_0xa13d16){for(var _0x52930c=0x0;_0x52930c<_0xa13d16['length'];_0x52930c+=0x1){_[_0xe9bd('0x54')](_0x5d7257[_0xe9bd('0x14')][_0xa13d16[_0x52930c]['name']],_0xa13d16[_0x52930c]);}return _0x5d7257[_0xe9bd('0x14')];};};Realtime[_0xe9bd('0x40')][_0xe9bd('0x55')]=function(){var _0x292faf=this;return function(_0x582cf3){clearVoiceQueues(_0x292faf[_0xe9bd('0x14')]);if(_0x582cf3){_0x582cf3=_[_0xe9bd('0x56')](_0x582cf3,'uniqueid');for(var _0x2a014e in _0x582cf3){if(_0x582cf3[_0xe9bd('0x25')](_0x2a014e)){var _0x3ec3e0={};for(var _0x22fd20=0x0;_0x22fd20<_0x582cf3[_0x2a014e][_0xe9bd('0x44')];_0x22fd20+=0x1){var _0x1a36aa=_0x582cf3[_0x2a014e][_0x22fd20][_0xe9bd('0x57')];if(_0x292faf['voiceQueues'][_0x1a36aa]){if(_0x582cf3[_0x2a014e][_0x22fd20][_0xe9bd('0x58')]){_0x292faf[_0xe9bd('0x14')][_0x1a36aa][_0xe9bd('0x34')]+=0x1;}if(_0x582cf3[_0x2a014e][_0x22fd20][_0xe9bd('0x59')]){_0x292faf[_0xe9bd('0x14')][_0x1a36aa][_0xe9bd('0x5a')]+=0x1;}_0x292faf[_0xe9bd('0x14')][_0x1a36aa][_0xe9bd('0x2e')]+=moment(_0x582cf3[_0x2a014e][_0x22fd20][_0xe9bd('0x5b')])['diff'](moment(_0x582cf3[_0x2a014e][_0x22fd20][_0xe9bd('0x5c')]),_0xe9bd('0x5d'))||0x0;if(_0x22fd20===_0x582cf3[_0x2a014e][_0xe9bd('0x44')]-0x1){_0x292faf[_0xe9bd('0x14')][_0x1a36aa][_0xe9bd('0x2f')]+=moment(_0x582cf3[_0x2a014e][_0x22fd20][_0xe9bd('0x5e')]||_0x582cf3[_0x2a014e][_0x22fd20][_0xe9bd('0x5f')]||_0x582cf3[_0x2a014e][_0x22fd20]['queuecallerexitAt'])[_0xe9bd('0x60')](moment(_0x582cf3[_0x2a014e][_0x22fd20][_0xe9bd('0x5c')]),'seconds')||0x0;_0x292faf[_0xe9bd('0x14')][_0x1a36aa][_0xe9bd('0x2c')]+=0x1;if(_0x582cf3[_0x2a014e][_0x22fd20][_0xe9bd('0x61')]){_0x292faf[_0xe9bd('0x14')][_0x1a36aa][_0xe9bd('0x2d')]+=0x1;_0x292faf[_0xe9bd('0x14')][_0x1a36aa][_0xe9bd('0x30')]+=moment(_0x582cf3[_0x2a014e][_0x22fd20]['queuecallercompleteAt'])['diff'](moment(_0x582cf3[_0x2a014e][_0x22fd20][_0xe9bd('0x5b')]),_0xe9bd('0x5d'))||0x0;}}else{_0x292faf[_0xe9bd('0x14')][_0x1a36aa][_0xe9bd('0x2f')]+=_0x292faf[_0xe9bd('0x14')][_0x1a36aa][_0xe9bd('0x2e')]||0x0;}}}}}}return _0x292faf[_0xe9bd('0x14')];};};Realtime['prototype'][_0xe9bd('0x62')]=function(){var _0x44f47e=this;return function(_0x29833b){clearVoiceCallReports(_0x44f47e[_0xe9bd('0x17')]);if(_0x29833b){for(var _0x14cdd5=0x0;_0x14cdd5<_0x29833b[_0xe9bd('0x44')];_0x14cdd5+=0x1){_0x44f47e[_0xe9bd('0x17')]['total']+=0x1;_0x44f47e['outbound']['sumDuration']+=_0x29833b[_0x14cdd5][_0xe9bd('0x63')];if(_0x29833b[_0x14cdd5]['disposition']==='ANSWERED'){_0x44f47e['outbound'][_0xe9bd('0x2d')]+=0x1;_0x44f47e[_0xe9bd('0x17')][_0xe9bd('0x2e')]+=_0x29833b[_0x14cdd5][_0xe9bd('0x63')]-_0x29833b[_0x14cdd5][_0xe9bd('0x64')]||0x0;_0x44f47e[_0xe9bd('0x17')][_0xe9bd('0x30')]+=_0x29833b[_0x14cdd5][_0xe9bd('0x64')];}}}return _0x44f47e[_0xe9bd('0x17')];};};Realtime['prototype'][_0xe9bd('0x65')]=function(){var _0x4b79f1=this;return function(_0x22cc79){if(_0x22cc79){freeIsNotKey(_0x22cc79,_0x4b79f1[_0xe9bd('0x66')],_0xe9bd('0x29'));for(var _0x6fff03=0x0,_0x416938={};_0x6fff03<_0x22cc79['length'];_0x6fff03+=0x1){_0x416938=_0x22cc79[_0x6fff03];if(_['isUndefined'](_0x4b79f1['campaigns'][_0x416938[_0xe9bd('0x29')]])){_0x4b79f1[_0xe9bd('0x66')][_0x416938['name']]=new Campaign(_0x416938);}else{_0x4b79f1[_0xe9bd('0x41')](_0x4b79f1[_0xe9bd('0x66')][_0x416938[_0xe9bd('0x29')]],_0x416938);_0x4b79f1[_0xe9bd('0x66')][_0x416938[_0xe9bd('0x29')]]['dialQueueProject']=_0x416938[_0xe9bd('0x67')]?_0x416938[_0xe9bd('0x67')][_0xe9bd('0x29')]:undefined;}}}return _0x4b79f1[_0xe9bd('0x66')];};};Realtime[_0xe9bd('0x40')][_0xe9bd('0x68')]=function(){var _0x4659f3=this;return function(_0x1ad344){if(_0x1ad344){freeIsNotKey(_0x1ad344,_0x4659f3[_0xe9bd('0x18')],'id');for(var _0x440b2d=0x0,_0x5f24c8={};_0x440b2d<_0x1ad344['length'];_0x440b2d+=0x1){_0x5f24c8=_0x1ad344[_0x440b2d];if(_['isUndefined'](_0x4659f3['voiceExtensions'][_0x5f24c8['id']])){_0x4659f3[_0xe9bd('0x18')][_0x5f24c8['id']]=new VoiceExtension(_0x5f24c8);}else{_0x4659f3[_0xe9bd('0x41')](_0x4659f3[_0xe9bd('0x18')][_0x5f24c8['id']],_0x5f24c8);}}}return _0x4659f3['voiceExtensions'];};};Realtime[_0xe9bd('0x40')][_0xe9bd('0x69')]=function(){var _0x5040a7=this;return function(_0x55b5a5){clearCampaigns(_0x5040a7[_0xe9bd('0x66')]);for(var _0x1250e4=0x0;_0x1250e4<_0x55b5a5[_0xe9bd('0x44')];_0x1250e4+=0x1){_[_0xe9bd('0x54')](_0x5040a7[_0xe9bd('0x66')][_0x55b5a5[_0x1250e4]['name']],_0x55b5a5[_0x1250e4]);}return _0x5040a7['campaigns'];};};Realtime['prototype'][_0xe9bd('0x6a')]=function(){var _0x2c7a14=this;return function(_0x448f82){if(_0x448f82){freeIsNotKey(_0x448f82,_0x2c7a14[_0xe9bd('0x24')],'id');for(var _0x1880e7=0x0,_0x351226={},_0x475cb9={};_0x1880e7<_0x448f82[_0xe9bd('0x44')];_0x1880e7+=0x1){_0x351226=_0x448f82[_0x1880e7];if(_[_0xe9bd('0x45')](_0x2c7a14[_0xe9bd('0x24')][_0x351226['id']])){_0x2c7a14['faxAccounts'][_0x351226['id']]=new FaxAccount(_0x351226);}else{_0x2c7a14[_0xe9bd('0x41')](_0x2c7a14['faxAccounts'][_0x351226['id']],_0x351226);}}}return _0x2c7a14[_0xe9bd('0x24')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index b2c75dd..debf48d 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 _0x3e07=['membername','originatecalleridnum','xcally-motion-dialer','isArray','startsWith','substring','indexOf','phone','lastIndexOf','findAgent','isNil','transfererlinkedid','exports','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./userReport','realtime','agents','telephones','prototype','xdr','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','attendedtransfer','attendedTransfer','find','accountcode','name','interface','SIP/%s','lastAssignedTo','queuecallercomplete','format','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','destination','exten','dialer','lastapplication','queue','context','from-sip','xcally-motion-preview','calleridpreview','calleridnum','destinationchannel','channel','callerid','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','monitor','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename'];(function(_0x27b423,_0x312583){var _0x5c11b8=function(_0x22a3b9){while(--_0x22a3b9){_0x27b423['push'](_0x27b423['shift']());}};_0x5c11b8(++_0x312583);}(_0x3e07,0x1e1));var _0x73e0=function(_0xf1decd,_0x5d502a){_0xf1decd=_0xf1decd-0x0;var _0x4eea57=_0x3e07[_0xf1decd];return _0x4eea57;};'use strict';var _=require('lodash');var moment=require(_0x73e0('0x0'));var util=require(_0x73e0('0x1'));var config=require(_0x73e0('0x2'));var ami=require(_0x73e0('0x3'));var RpcVoiceAgentReport=require(_0x73e0('0x4'));var RpcVoiceCallReport=require(_0x73e0('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x73e0('0x6'));var RpcVoiceRecording=require(_0x73e0('0x7'));var RpcVoiceTransferReport=require(_0x73e0('0x8'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x73e0('0x9'));function Report(_0x22bbb3){this[_0x73e0('0xa')]=_0x22bbb3;this[_0x73e0('0xb')]=_0x22bbb3[_0x73e0('0xb')];this[_0x73e0('0xc')]=_0x22bbb3[_0x73e0('0xc')];}Report[_0x73e0('0xd')]['sync']=function(_0x3e84d9){var _0x41142d=new VoiceQueueReport(this[_0x73e0('0xa')]);var _0x209c0c=new VoiceAgentReport(this[_0x73e0('0xa')]);var _0x776624=new VoiceDialReport(this[_0x73e0('0xa')]);var _0x2d6d7e=new VoiceCallReport(this[_0x73e0('0xa')]);var _0x177f85=new UserReport(this[_0x73e0('0xa')]);if(config[_0x73e0('0xe')]&&config[_0x73e0('0xe')]['disabled']){ami['on']('custom:voiceQueueReport',this[_0x73e0('0xf')][_0x73e0('0x10')](this));ami['on'](_0x73e0('0x11'),this['voiceCallReport']['bind'](this));ami['on'](_0x73e0('0x12'),this[_0x73e0('0x13')]['bind'](this));ami['on'](_0x73e0('0x14'),this[_0x73e0('0x15')][_0x73e0('0x10')](this));ami['on']('blindtransfer',this['blindTransfer'][_0x73e0('0x10')](this));ami['on'](_0x73e0('0x16'),this[_0x73e0('0x17')][_0x73e0('0x10')](this));}};Report[_0x73e0('0xd')]['findAgent']=function(_0x368022){var _0x2a5e57;_0x2a5e57=_[_0x73e0('0x18')](this[_0x73e0('0xb')],function(_0x4cb2e3){return _0x4cb2e3[_0x73e0('0x19')]==_0x368022||_0x4cb2e3['name']==_0x368022;});if(_['isNil'](_0x2a5e57)){var _0x370df8=_[_0x73e0('0x18')](this['telephones'],function(_0x242f88){return _0x242f88[_0x73e0('0x19')]==_0x368022||_0x242f88[_0x73e0('0x1a')]==_0x368022;});if(_0x370df8){_0x2a5e57=_[_0x73e0('0x18')](this['agents'],function(_0x378037){return _0x378037[_0x73e0('0x1b')]==util['format'](_0x73e0('0x1c'),_0x370df8[_0x73e0('0x1a')]);});}}return _0x2a5e57;};Report[_0x73e0('0xd')]['voiceQueueReport']=function(_0x2f066d){for(var _0x3e2ebb=0x0;_0x3e2ebb<_0x2f066d['length'];_0x3e2ebb+=0x1){var _0x254295=this['findAgent'](_0x2f066d[_0x3e2ebb]['connectedlinenum']);if(_0x254295){_0x2f066d[_0x3e2ebb][_0x73e0('0x19')]=_0x254295[_0x73e0('0x19')];_0x2f066d[_0x3e2ebb]['assigned']=!![];_0x2f066d[_0x3e2ebb][_0x73e0('0x1d')]=_0x254295[_0x73e0('0x1a')];_0x2f066d[_0x3e2ebb][_0x73e0('0x1b')]=_['isNil'](_0x254295['interface'])?util['format']('SIP/%s',_0x254295[_0x73e0('0x1a')]):_0x254295[_0x73e0('0x1b')];if(_0x2f066d[_0x3e2ebb][_0x73e0('0x1e')]){_0x2f066d[_0x3e2ebb]['queuecallercompleteAt']=moment()[_0x73e0('0x1f')](_0x73e0('0x20'));}if(_0x2f066d[_0x3e2ebb][_0x73e0('0x21')]){_0x2f066d[_0x3e2ebb]['queuecallerexitAt']=moment()['format'](_0x73e0('0x20'));}RpcMemberReport[_0x73e0('0xf')](_0x2f066d[_0x3e2ebb]);}RpcVoiceQueueReport[_0x73e0('0x22')](_0x2f066d[_0x3e2ebb]);}};function extractCalleridNumber(_0x51f135){var _0x1ea260=_0x51f135[_0x73e0('0x23')](/<(.*?)>/);return _0x1ea260?_0x1ea260[0x1]:_0x51f135;}Report[_0x73e0('0xd')]['voiceCallReport']=function(_0x11b793){_0x11b793[_0x73e0('0x24')]=_0x11b793['destination']||_0x11b793[_0x73e0('0x25')];if(_0x11b793['type']==_0x73e0('0x26')){_0x11b793[_0x73e0('0x27')]=_0x73e0('0x28');_0x11b793['lastdata']=_0x11b793[_0x73e0('0x28')];if(_0x11b793[_0x73e0('0x29')]=='from-voip-provider'){_0x11b793['accountcode']='';_0x11b793[_0x73e0('0x24')]=extractCalleridNumber(_0x11b793['callerid']);}else if(_0x11b793[_0x73e0('0x29')]==_0x73e0('0x2a')){if(_0x11b793[_0x73e0('0x24')]==_0x73e0('0x2b')){_0x11b793[_0x73e0('0x24')]=extractCalleridNumber(_0x11b793[_0x73e0('0x2c')]);_0x11b793[_0x73e0('0x2d')]=_0x11b793['originatecalleridnum'];_0x11b793[_0x73e0('0x2e')]=[_0x11b793[_0x73e0('0x2f')],_0x11b793[_0x73e0('0x2f')]=_0x11b793[_0x73e0('0x2e')]][0x0];_0x11b793[_0x73e0('0x30')]=_0x11b793[_0x73e0('0x2c')];}else{_0x11b793[_0x73e0('0x24')]=_0x11b793[_0x73e0('0x2d')];_0x11b793[_0x73e0('0x2d')]=_0x11b793['originatecalleridnum'];if(_0x11b793[_0x73e0('0x31')]==_0x73e0('0x32')){_0x11b793[_0x73e0('0x19')]=_0x11b793[_0x73e0('0x33')];}else{_0x11b793[_0x73e0('0x19')]='';}}}}else{_0x11b793['callerid']=util[_0x73e0('0x1f')](_0x73e0('0x34'),_0x11b793['calleridname'],_0x11b793['calleridnum']);}if(RpcVoiceTransferReport[_0x73e0('0x35')][_0x11b793[_0x73e0('0x36')]]){var _0x8e9237=RpcVoiceTransferReport[_0x73e0('0x35')][_0x11b793['linkedid']];_0x8e9237[_0x73e0('0x37')]=_0x11b793[_0x73e0('0x38')];RpcVoiceTransferReport[_0x73e0('0x39')](_0x8e9237);delete RpcVoiceTransferReport['transfers'][_0x11b793['linkedid']];}RpcVoiceCallReport[_0x73e0('0x22')](_0x11b793);if(_0x11b793[_0x73e0('0x3a')]){for(var _0x9a67a9=0x0;_0x9a67a9<_0x11b793[_0x73e0('0x3b')]['length'];_0x9a67a9+=0x1){_0x11b793[_0x73e0('0x3c')]=_0x11b793[_0x73e0('0x3b')][_0x9a67a9][_0x73e0('0x3d')];_0x11b793[_0x73e0('0x3e')]=_0x11b793['monitors'][_0x9a67a9]['createdAt'];if(_0x11b793[_0x73e0('0x25')]==_0x73e0('0x2b')){_0x11b793[_0x73e0('0x2d')]=_0x11b793['connectedlinenum'];_0x11b793[_0x73e0('0x3f')]=_0x11b793[_0x73e0('0x40')];_0x11b793[_0x73e0('0x33')]=_0x11b793[_0x73e0('0x19')];_0x11b793[_0x73e0('0x40')]=_0x11b793[_0x73e0('0x41')];_0x11b793[_0x73e0('0x25')]=_0x11b793[_0x73e0('0x42')];}else if(_0x11b793[_0x73e0('0x25')]==_0x73e0('0x43')){_0x11b793['calleridnum']=_0x11b793[_0x73e0('0x24')];_0x11b793[_0x73e0('0x25')]=_0x11b793['originatecalleridnum'];}RpcVoiceRecording[_0x73e0('0x22')](_0x11b793);}}};Report[_0x73e0('0xd')][_0x73e0('0x13')]=function(_0x4c93ec){if(_[_0x73e0('0x44')](_0x4c93ec)){_0x4c93ec['forEach'](function(_0x19b917){RpcVoiceAgentReport['create'](_0x19b917);});}else{RpcVoiceAgentReport['create'](_0x4c93ec);}};Report['prototype'][_0x73e0('0x15')]=function(_0x497c12){RpcVoiceDialReport[_0x73e0('0x22')](_0x497c12);var _0x1767dd;var _0x5dca1d;var _0x236eb6=_0x497c12['channel'];if(_[_0x73e0('0x45')](_0x236eb6,'Local')){_0x5dca1d=_0x236eb6[_0x73e0('0x46')](_0x236eb6['indexOf']('/')+0x1,_0x236eb6[_0x73e0('0x47')]('@'));_0x1767dd=_['find'](this[_0x73e0('0xb')],function(_0x159b22){return _0x159b22['mobile']==_0x5dca1d||_0x159b22[_0x73e0('0x48')]==_0x5dca1d||_0x159b22[_0x73e0('0x19')]==_0x5dca1d;});}else{_0x5dca1d=_0x236eb6[_0x73e0('0x46')](_0x236eb6[_0x73e0('0x47')]('/')+0x1,_0x236eb6[_0x73e0('0x49')]('-'));_0x1767dd=this[_0x73e0('0x4a')](_0x5dca1d);}if(_0x1767dd){_0x497c12[_0x73e0('0x1b')]=_[_0x73e0('0x4b')](_0x1767dd[_0x73e0('0x1b')])?util[_0x73e0('0x1f')](_0x73e0('0x1c'),_0x1767dd['name']):_0x1767dd[_0x73e0('0x1b')];_0x497c12['membername']=_0x1767dd[_0x73e0('0x1a')];_0x497c12[_0x73e0('0x19')]=_0x1767dd[_0x73e0('0x19')];RpcMemberReport[_0x73e0('0x15')](_0x497c12);}};Report[_0x73e0('0xd')]['blindTransfer']=function(_0x488992){RpcVoiceTransferReport['transfers'][_0x488992[_0x73e0('0x4c')]]=_0x488992;};Report[_0x73e0('0xd')][_0x73e0('0x17')]=function(_0x213854){RpcVoiceTransferReport[_0x73e0('0x17')](_0x213854);};module[_0x73e0('0x4d')]=Report; \ No newline at end of file +var _0xcb75=['lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','destination','exten','type','lastapplication','queue','lastdata','context','callerid','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','membername','xcally-motion-dialer','isArray','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','voiceDialReport','transfererlinkedid','attendedTransfer','exports','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','xdr','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','blindtransfer','blindTransfer','attendedtransfer','prototype','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum','assigned'];(function(_0x5cb4f0,_0xb16665){var _0x22208=function(_0xa6ac92){while(--_0xa6ac92){_0x5cb4f0['push'](_0x5cb4f0['shift']());}};_0x22208(++_0xb16665);}(_0xcb75,0x136));var _0x5cb7=function(_0x2359da,_0x413c44){_0x2359da=_0x2359da-0x0;var _0x5c3381=_0xcb75[_0x2359da];return _0x5c3381;};'use strict';var _=require('lodash');var moment=require(_0x5cb7('0x0'));var util=require(_0x5cb7('0x1'));var config=require(_0x5cb7('0x2'));var ami=require(_0x5cb7('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x5cb7('0x4'));var RpcVoiceDialReport=require(_0x5cb7('0x5'));var RpcMemberReport=require(_0x5cb7('0x6'));var RpcVoiceQueueReport=require(_0x5cb7('0x7'));var RpcVoiceRecording=require(_0x5cb7('0x8'));var RpcVoiceTransferReport=require(_0x5cb7('0x9'));var VoiceQueueReport=require(_0x5cb7('0xa'));var VoiceCallReport=require(_0x5cb7('0xb'));var VoiceAgentReport=require(_0x5cb7('0xc'));var VoiceDialReport=require(_0x5cb7('0xd'));var UserReport=require('./userReport');function Report(_0x2cca7d){this[_0x5cb7('0xe')]=_0x2cca7d;this[_0x5cb7('0xf')]=_0x2cca7d['agents'];this[_0x5cb7('0x10')]=_0x2cca7d[_0x5cb7('0x10')];}Report['prototype']['sync']=function(_0x1f2d24){var _0x39d8d3=new VoiceQueueReport(this['realtime']);var _0x42ad38=new VoiceAgentReport(this['realtime']);var _0x4959ca=new VoiceDialReport(this[_0x5cb7('0xe')]);var _0x3e5858=new VoiceCallReport(this[_0x5cb7('0xe')]);var _0x31098c=new UserReport(this[_0x5cb7('0xe')]);if(config[_0x5cb7('0x11')]&&config[_0x5cb7('0x11')]['disabled']){ami['on'](_0x5cb7('0x12'),this[_0x5cb7('0x13')][_0x5cb7('0x14')](this));ami['on']('custom:voiceCallReport',this[_0x5cb7('0x15')][_0x5cb7('0x14')](this));ami['on'](_0x5cb7('0x16'),this['voiceAgentReport'][_0x5cb7('0x14')](this));ami['on']('custom:voiceDialReport',this['voiceDialReport'][_0x5cb7('0x14')](this));ami['on'](_0x5cb7('0x17'),this[_0x5cb7('0x18')][_0x5cb7('0x14')](this));ami['on'](_0x5cb7('0x19'),this['attendedTransfer'][_0x5cb7('0x14')](this));}};Report[_0x5cb7('0x1a')][_0x5cb7('0x1b')]=function(_0x155fd7){var _0x464daf;_0x464daf=_[_0x5cb7('0x1c')](this[_0x5cb7('0xf')],function(_0x5c718a){return _0x5c718a[_0x5cb7('0x1d')]==_0x155fd7||_0x5c718a[_0x5cb7('0x1e')]==_0x155fd7;});if(_[_0x5cb7('0x1f')](_0x464daf)){var _0x5967a9=_[_0x5cb7('0x1c')](this[_0x5cb7('0x10')],function(_0x327542){return _0x327542['accountcode']==_0x155fd7||_0x327542['name']==_0x155fd7;});if(_0x5967a9){_0x464daf=_[_0x5cb7('0x1c')](this[_0x5cb7('0xf')],function(_0x3a5f9f){return _0x3a5f9f[_0x5cb7('0x20')]==util[_0x5cb7('0x21')](_0x5cb7('0x22'),_0x5967a9['name']);});}}return _0x464daf;};Report[_0x5cb7('0x1a')][_0x5cb7('0x13')]=function(_0x2434c7){for(var _0x1a10f3=0x0;_0x1a10f3<_0x2434c7[_0x5cb7('0x23')];_0x1a10f3+=0x1){var _0x235f39=this[_0x5cb7('0x1b')](_0x2434c7[_0x1a10f3][_0x5cb7('0x24')]);if(_0x235f39){_0x2434c7[_0x1a10f3][_0x5cb7('0x1d')]=_0x235f39[_0x5cb7('0x1d')];_0x2434c7[_0x1a10f3][_0x5cb7('0x25')]=!![];_0x2434c7[_0x1a10f3][_0x5cb7('0x26')]=_0x235f39[_0x5cb7('0x1e')];_0x2434c7[_0x1a10f3][_0x5cb7('0x20')]=_[_0x5cb7('0x1f')](_0x235f39[_0x5cb7('0x20')])?util[_0x5cb7('0x21')]('SIP/%s',_0x235f39[_0x5cb7('0x1e')]):_0x235f39[_0x5cb7('0x20')];if(_0x2434c7[_0x1a10f3][_0x5cb7('0x27')]){_0x2434c7[_0x1a10f3][_0x5cb7('0x28')]=moment()[_0x5cb7('0x21')](_0x5cb7('0x29'));}if(_0x2434c7[_0x1a10f3]['queuecallerexit']){_0x2434c7[_0x1a10f3][_0x5cb7('0x2a')]=moment()[_0x5cb7('0x21')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x5cb7('0x13')](_0x2434c7[_0x1a10f3]);}RpcVoiceQueueReport[_0x5cb7('0x2b')](_0x2434c7[_0x1a10f3]);}};function extractCalleridNumber(_0x5b1a55){var _0x48bc7c=_0x5b1a55[_0x5cb7('0x2c')](/<(.*?)>/);return _0x48bc7c?_0x48bc7c[0x1]:_0x5b1a55;}Report['prototype']['voiceCallReport']=function(_0x75234a){_0x75234a[_0x5cb7('0x2d')]=_0x75234a[_0x5cb7('0x2d')]||_0x75234a[_0x5cb7('0x2e')];if(_0x75234a[_0x5cb7('0x2f')]=='dialer'){_0x75234a[_0x5cb7('0x30')]=_0x5cb7('0x31');_0x75234a[_0x5cb7('0x32')]=_0x75234a[_0x5cb7('0x31')];if(_0x75234a[_0x5cb7('0x33')]=='from-voip-provider'){_0x75234a['accountcode']='';_0x75234a[_0x5cb7('0x2d')]=extractCalleridNumber(_0x75234a[_0x5cb7('0x34')]);}else if(_0x75234a[_0x5cb7('0x33')]=='from-sip'){if(_0x75234a[_0x5cb7('0x2d')]==_0x5cb7('0x35')){_0x75234a[_0x5cb7('0x2d')]=extractCalleridNumber(_0x75234a[_0x5cb7('0x36')]);_0x75234a[_0x5cb7('0x37')]=_0x75234a[_0x5cb7('0x38')];_0x75234a[_0x5cb7('0x39')]=[_0x75234a['channel'],_0x75234a[_0x5cb7('0x3a')]=_0x75234a[_0x5cb7('0x39')]][0x0];_0x75234a['callerid']=_0x75234a[_0x5cb7('0x36')];}else{_0x75234a[_0x5cb7('0x2d')]=_0x75234a[_0x5cb7('0x37')];_0x75234a['calleridnum']=_0x75234a[_0x5cb7('0x38')];if(_0x75234a[_0x5cb7('0x3b')]==_0x5cb7('0x3c')){_0x75234a[_0x5cb7('0x1d')]=_0x75234a['connectedlinenum'];}else{_0x75234a[_0x5cb7('0x1d')]='';}}}}else{_0x75234a['callerid']=util['format'](_0x5cb7('0x3d'),_0x75234a['calleridname'],_0x75234a[_0x5cb7('0x37')]);}if(RpcVoiceTransferReport[_0x5cb7('0x3e')][_0x75234a[_0x5cb7('0x3f')]]){var _0x44fe77=RpcVoiceTransferReport[_0x5cb7('0x3e')][_0x75234a[_0x5cb7('0x3f')]];_0x44fe77[_0x5cb7('0x40')]=_0x75234a[_0x5cb7('0x41')];RpcVoiceTransferReport[_0x5cb7('0x18')](_0x44fe77);delete RpcVoiceTransferReport[_0x5cb7('0x3e')][_0x75234a[_0x5cb7('0x3f')]];}RpcVoiceCallReport[_0x5cb7('0x2b')](_0x75234a);if(_0x75234a[_0x5cb7('0x42')]){for(var _0x4b765b=0x0;_0x4b765b<_0x75234a[_0x5cb7('0x43')][_0x5cb7('0x23')];_0x4b765b+=0x1){_0x75234a[_0x5cb7('0x44')]=_0x75234a[_0x5cb7('0x43')][_0x4b765b][_0x5cb7('0x45')];_0x75234a['createdAt']=_0x75234a[_0x5cb7('0x43')][_0x4b765b][_0x5cb7('0x46')];if(_0x75234a[_0x5cb7('0x2e')]=='xcally-motion-preview'){_0x75234a[_0x5cb7('0x37')]=_0x75234a[_0x5cb7('0x24')];_0x75234a[_0x5cb7('0x47')]=_0x75234a[_0x5cb7('0x48')];_0x75234a['connectedlinenum']=_0x75234a[_0x5cb7('0x1d')];_0x75234a['connectedlinename']=_0x75234a[_0x5cb7('0x49')];_0x75234a[_0x5cb7('0x2e')]=_0x75234a[_0x5cb7('0x38')];}else if(_0x75234a['exten']==_0x5cb7('0x4a')){_0x75234a[_0x5cb7('0x37')]=_0x75234a[_0x5cb7('0x2d')];_0x75234a[_0x5cb7('0x2e')]=_0x75234a[_0x5cb7('0x38')];}RpcVoiceRecording[_0x5cb7('0x2b')](_0x75234a);}}};Report['prototype']['voiceAgentReport']=function(_0x3ac9ac){if(_[_0x5cb7('0x4b')](_0x3ac9ac)){_0x3ac9ac['forEach'](function(_0x3b4a45){RpcVoiceAgentReport[_0x5cb7('0x2b')](_0x3b4a45);});}else{RpcVoiceAgentReport[_0x5cb7('0x2b')](_0x3ac9ac);}};Report[_0x5cb7('0x1a')]['voiceDialReport']=function(_0x2421eb){RpcVoiceDialReport[_0x5cb7('0x2b')](_0x2421eb);var _0x29775b;var _0x48e358;var _0x1677ce=_0x2421eb[_0x5cb7('0x3a')];if(_[_0x5cb7('0x4c')](_0x1677ce,_0x5cb7('0x4d'))){_0x48e358=_0x1677ce['substring'](_0x1677ce[_0x5cb7('0x4e')]('/')+0x1,_0x1677ce['indexOf']('@'));_0x29775b=_['find'](this['agents'],function(_0x13b110){return _0x13b110[_0x5cb7('0x4f')]==_0x48e358||_0x13b110[_0x5cb7('0x50')]==_0x48e358||_0x13b110[_0x5cb7('0x1d')]==_0x48e358;});}else{_0x48e358=_0x1677ce[_0x5cb7('0x51')](_0x1677ce[_0x5cb7('0x4e')]('/')+0x1,_0x1677ce[_0x5cb7('0x52')]('-'));_0x29775b=this[_0x5cb7('0x1b')](_0x48e358);}if(_0x29775b){_0x2421eb[_0x5cb7('0x20')]=_[_0x5cb7('0x1f')](_0x29775b[_0x5cb7('0x20')])?util[_0x5cb7('0x21')](_0x5cb7('0x22'),_0x29775b['name']):_0x29775b[_0x5cb7('0x20')];_0x2421eb[_0x5cb7('0x49')]=_0x29775b[_0x5cb7('0x1e')];_0x2421eb[_0x5cb7('0x1d')]=_0x29775b['accountcode'];RpcMemberReport[_0x5cb7('0x53')](_0x2421eb);}};Report['prototype'][_0x5cb7('0x18')]=function(_0x33fd42){RpcVoiceTransferReport['transfers'][_0x33fd42[_0x5cb7('0x54')]]=_0x33fd42;};Report[_0x5cb7('0x1a')][_0x5cb7('0x55')]=function(_0x563d9a){RpcVoiceTransferReport[_0x5cb7('0x55')](_0x563d9a);};module[_0x5cb7('0x56')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index abdf75a..ef3223b 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 _0xaf01=['defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','syncPeerStatus','syncRealtimeShow','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','resolve','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','find','state','merge','omit','actionid','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','toNumber','telephone:%s','name','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','substring','indexOf','mobile','phone','accountcode','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','updateStatusRealtime','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','exports','lodash','moment','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','redis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaf01,0x92));var _0x1af0=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xaf01[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x1af0('0x0'));var moment=require(_0x1af0('0x1'));var util=require('util');var Redis=require(_0x1af0('0x2'));var BPromise=require(_0x1af0('0x3'));var config=require(_0x1af0('0x4'));var logger=require(_0x1af0('0x5'))(_0x1af0('0x6'));var ami=require('../ami');config[_0x1af0('0x7')]=_[_0x1af0('0x8')](config[_0x1af0('0x7')],{'host':_0x1af0('0x9'),'port':0x18eb});var io=require(_0x1af0('0xa'))(new Redis(config[_0x1af0('0x7')]));function UserReport(_0x58c72f){this[_0x1af0('0xb')]=_0x58c72f[_0x1af0('0xb')];this[_0x1af0('0xc')]=_0x58c72f['agents'];this[_0x1af0('0xd')]=_0x58c72f[_0x1af0('0xd')];ami['on'](_0x1af0('0xe'),this[_0x1af0('0xf')][_0x1af0('0x10')](this));ami['on'](_0x1af0('0x11'),this['syncRegistry']['bind'](this));ami['on'](_0x1af0('0x12'),this[_0x1af0('0x13')][_0x1af0('0x10')](this));ami['on']('peerstatus',this[_0x1af0('0x14')]['bind'](this));return this[_0x1af0('0x15')]();}function showSipRegistrations(){Promise['resolve']()[_0x1af0('0x16')](ami[_0x1af0('0x17')]())[_0x1af0('0x18')](function(_0x298a4d){logger[_0x1af0('0x19')](_0x1af0('0x1a'),util[_0x1af0('0x1b')](_0x298a4d,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x1af0('0x1c')]()[_0x1af0('0x16')](ami[_0x1af0('0x1d')]())['catch'](function(_0x50422a){logger['error'](_0x1af0('0x1e'),util[_0x1af0('0x1b')](_0x50422a,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x1af0('0x1c')]()['then'](ami[_0x1af0('0x1f')]())[_0x1af0('0x18')](function(_0xcfe2f5){logger[_0x1af0('0x19')](_0x1af0('0x20'),util['inspect'](_0xcfe2f5,{'showHidden':![],'depth':null}));});}UserReport[_0x1af0('0x21')][_0x1af0('0x15')]=function(){setInterval(function(){BPromise[_0x1af0('0x1c')]()['then'](showSipRegistrations())['then'](listDeviceStates())[_0x1af0('0x16')](showPeersStatus());},0x32c8);};UserReport[_0x1af0('0x21')][_0x1af0('0x22')]=function(_0x4e0b9f){return _0x4e0b9f!==null&&!_[_0x1af0('0x23')](_0x4e0b9f);};UserReport[_0x1af0('0x21')][_0x1af0('0x24')]=function(_0x3493b9,_0xf43364,_0x1f79cf){io['to'](_0x3493b9)['emit'](_0xf43364,_0x1f79cf);};UserReport[_0x1af0('0x21')]['syncRegistry']=function(_0xd4062f){try{if(this[_0x1af0('0x22')](_0xd4062f)){logger[_0x1af0('0x25')](_0x1af0('0x26'),_0xd4062f[_0x1af0('0x27')],_0xd4062f['state']);logger['debug']('[userReport][registry]',util[_0x1af0('0x1b')](_0xd4062f,{'showHidden':![],'depth':null}));var _0x351d5d=_[_0x1af0('0x28')](this[_0x1af0('0xb')],{'defaultuser':_0xd4062f[_0x1af0('0x27')]});if(_0x351d5d){_0xd4062f['stateRegistry']=_0xd4062f[_0x1af0('0x29')];_[_0x1af0('0x2a')](_0x351d5d,_[_0x1af0('0x2b')](_0xd4062f,['event',_0x1af0('0x2c'),_0x1af0('0x27'),'state']));logger[_0x1af0('0x2d')](_0x1af0('0x2e'),util['inspect'](_0x351d5d,{'showHidden':![],'depth':null}));this['emit'](util[_0x1af0('0x2f')](_0x1af0('0x30'),_0x351d5d['name']),'trunk:save',_0x351d5d);}}}catch(_0x1746a6){logger['error']('[userReport][registry]',util[_0x1af0('0x1b')](_0x1746a6,{'showHidden':![],'depth':null}));}};UserReport[_0x1af0('0x21')]['syncDeviceState']=function(_0x2e6cf4){try{if(this[_0x1af0('0x22')](_0x2e6cf4)){logger[_0x1af0('0x25')](_0x1af0('0x31'),_0x2e6cf4[_0x1af0('0x32')],_0x2e6cf4[_0x1af0('0x29')]);logger[_0x1af0('0x2d')](_0x1af0('0x33'),util['inspect'](_0x2e6cf4,{'showHidden':![],'depth':null}));if(this[_0x1af0('0xc')][_0x2e6cf4[_0x1af0('0x32')]]){if(!this[_0x1af0('0xc')][_0x2e6cf4[_0x1af0('0x32')]][_0x1af0('0x34')]||_0x2e6cf4[_0x1af0('0x29')][_0x1af0('0x35')]()==_0x1af0('0x36')){this[_0x1af0('0xc')][_0x2e6cf4['device']][_0x1af0('0x34')]=![];if(this[_0x1af0('0xc')][_0x2e6cf4[_0x1af0('0x32')]][_0x1af0('0x29')]!==_0x2e6cf4['state'][_0x1af0('0x35')]()){this[_0x1af0('0xc')][_0x2e6cf4[_0x1af0('0x32')]][_0x1af0('0x37')]=_['toNumber'](moment()['format']('x'));}this[_0x1af0('0xc')][_0x2e6cf4[_0x1af0('0x32')]][_0x1af0('0x29')]=_0x2e6cf4['state'][_0x1af0('0x35')]();this['agents'][_0x2e6cf4[_0x1af0('0x32')]]['updateStatusRealtime'](_0x2e6cf4);}}else if(this['telephones'][_0x2e6cf4[_0x1af0('0x32')]]){if(this[_0x1af0('0xd')][_0x2e6cf4['device']][_0x1af0('0x29')]!==_0x2e6cf4[_0x1af0('0x29')][_0x1af0('0x35')]()){this[_0x1af0('0xd')][_0x2e6cf4[_0x1af0('0x32')]][_0x1af0('0x37')]=_[_0x1af0('0x38')](moment()['format']('x'));}this['telephones'][_0x2e6cf4[_0x1af0('0x32')]]['state']=_0x2e6cf4[_0x1af0('0x29')]['toLowerCase']();logger['debug']('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x1af0('0x1b')](this[_0x1af0('0xd')][_0x2e6cf4['device']],{'showHidden':![],'depth':null}));this[_0x1af0('0x24')](util[_0x1af0('0x2f')](_0x1af0('0x39'),this[_0x1af0('0xd')][_0x2e6cf4[_0x1af0('0x32')]][_0x1af0('0x3a')]),'telephone:save',this[_0x1af0('0xd')][_0x2e6cf4['device']]);}else if(this[_0x1af0('0xb')][_0x2e6cf4[_0x1af0('0x32')]]){if(this[_0x1af0('0xb')][_0x2e6cf4['device']][_0x1af0('0x29')]!==_0x2e6cf4[_0x1af0('0x29')]['toLowerCase']()){this[_0x1af0('0xb')][_0x2e6cf4[_0x1af0('0x32')]][_0x1af0('0x37')]=_['toNumber'](moment()[_0x1af0('0x2f')]('x'));}this['trunks'][_0x2e6cf4[_0x1af0('0x32')]]['state']=_0x2e6cf4['state']['toLowerCase']();logger['debug'](_0x1af0('0x3b'),util['inspect'](this[_0x1af0('0xb')][_0x2e6cf4[_0x1af0('0x32')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x1af0('0x30'),this[_0x1af0('0xb')][_0x2e6cf4['device']][_0x1af0('0x3a')]),_0x1af0('0x3c'),this[_0x1af0('0xb')][_0x2e6cf4[_0x1af0('0x32')]]);}else if(_['startsWith'](_0x2e6cf4[_0x1af0('0x32')],'Local')){var _0x5a9a98=_0x2e6cf4['device'];var _0x2a7cb7=_0x5a9a98[_0x1af0('0x3d')](_0x5a9a98[_0x1af0('0x3e')]('/')+0x1,_0x5a9a98[_0x1af0('0x3e')]('@'));var _0x5f3a76=_['find'](this[_0x1af0('0xc')],function(_0x4d7f68){return _0x4d7f68[_0x1af0('0x3f')]==_0x2a7cb7||_0x4d7f68[_0x1af0('0x40')]==_0x2a7cb7||_0x4d7f68[_0x1af0('0x41')]==_0x2a7cb7;});if(_0x5f3a76){if(_0x5f3a76['state']!==_0x2e6cf4[_0x1af0('0x29')][_0x1af0('0x35')]()){_0x5f3a76[_0x1af0('0x37')]=_['toNumber'](moment()[_0x1af0('0x2f')]('x'));}_0x5f3a76['state']=_0x2e6cf4[_0x1af0('0x29')][_0x1af0('0x35')]();_0x5f3a76[_0x1af0('0x34')]=!![];_0x5f3a76['updateStatusRealtime'](_0x2e6cf4);}}}}catch(_0xff5d9e){logger[_0x1af0('0x19')](_0x1af0('0x33'),util[_0x1af0('0x1b')](_0xff5d9e,{'showHidden':![],'depth':null}));}};UserReport[_0x1af0('0x21')][_0x1af0('0x14')]=function(_0x5054ed){try{if(this['isNotNull'](_0x5054ed)&&this[_0x1af0('0x22')](_0x5054ed[_0x1af0('0x42')])){logger['info'](_0x1af0('0x43'),_0x5054ed[_0x1af0('0x44')],_0x5054ed[_0x1af0('0x45')],_0x5054ed[_0x1af0('0x42')]);logger[_0x1af0('0x2d')](_0x1af0('0x46'),util[_0x1af0('0x1b')](_0x5054ed,{'showHidden':![],'depth':null}));if(this[_0x1af0('0xc')][_0x5054ed[_0x1af0('0x44')]]){if(!this[_0x1af0('0xc')][_0x5054ed[_0x1af0('0x44')]]['local']||_0x5054ed['peerstatus'][_0x1af0('0x35')]()==_0x1af0('0x47')){this['agents'][_0x5054ed[_0x1af0('0x44')]][_0x1af0('0x34')]=![];this[_0x1af0('0xc')][_0x5054ed[_0x1af0('0x44')]][_0x1af0('0x48')]=_0x5054ed[_0x1af0('0x42')]['toLowerCase']();this[_0x1af0('0xc')][_0x5054ed[_0x1af0('0x44')]]['address']=_0x5054ed[_0x1af0('0x45')];this[_0x1af0('0xc')][_0x5054ed[_0x1af0('0x44')]][_0x1af0('0x49')](_0x5054ed);}}else if(this[_0x1af0('0xd')][_0x5054ed['peer']]){this[_0x1af0('0xd')][_0x5054ed[_0x1af0('0x44')]][_0x1af0('0x48')]=_0x5054ed[_0x1af0('0x42')]['toLowerCase']();this[_0x1af0('0xd')][_0x5054ed[_0x1af0('0x44')]][_0x1af0('0x45')]=_0x5054ed[_0x1af0('0x45')];logger[_0x1af0('0x2d')](_0x1af0('0x4a'),util['inspect'](this[_0x1af0('0xd')][_0x5054ed[_0x1af0('0x44')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x1af0('0x2f')](_0x1af0('0x39'),this[_0x1af0('0xd')][_0x5054ed[_0x1af0('0x44')]]['name']),_0x1af0('0x4b'),this[_0x1af0('0xd')][_0x5054ed['peer']]);}else if(this[_0x1af0('0xb')][_0x5054ed['peer']]){this[_0x1af0('0xb')][_0x5054ed['peer']]['status']=_0x5054ed['peerstatus'][_0x1af0('0x35')]();this[_0x1af0('0xb')][_0x5054ed[_0x1af0('0x44')]][_0x1af0('0x45')]=_0x5054ed[_0x1af0('0x45')];logger[_0x1af0('0x2d')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x1af0('0x1b')](this[_0x1af0('0xb')][_0x5054ed[_0x1af0('0x44')]],{'showHidden':![],'depth':null}));this[_0x1af0('0x24')](util[_0x1af0('0x2f')](_0x1af0('0x30'),this[_0x1af0('0xb')][_0x5054ed[_0x1af0('0x44')]][_0x1af0('0x3a')]),_0x1af0('0x3c'),this[_0x1af0('0xb')][_0x5054ed[_0x1af0('0x44')]]);}}}catch(_0x1214b6){logger[_0x1af0('0x19')](_0x1af0('0x46'),util[_0x1af0('0x1b')](_0x1214b6,{'showHidden':![],'depth':null}));}};module[_0x1af0('0x4c')]=UserReport; \ No newline at end of file +var _0x597c=['telephone:%s','telephone:save','Local','indexOf','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','updateStatusRealtime','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','trunk:%s','exports','lodash','moment','bluebird','../../../config/environment','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','registry','syncRegistry','bind','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','then','catch','error','[userReport][sipshowregistry]','inspect','resolve','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','merge','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','toNumber','format'];(function(_0x23c011,_0x234d6b){var _0x85d3cb=function(_0x54160d){while(--_0x54160d){_0x23c011['push'](_0x23c011['shift']());}};_0x85d3cb(++_0x234d6b);}(_0x597c,0x95));var _0xc597=function(_0x393cfd,_0x33d7b2){_0x393cfd=_0x393cfd-0x0;var _0x26c8df=_0x597c[_0x393cfd];return _0x26c8df;};'use strict';var _=require(_0xc597('0x0'));var moment=require(_0xc597('0x1'));var util=require('util');var Redis=require('ioredis');var BPromise=require(_0xc597('0x2'));var config=require(_0xc597('0x3'));var logger=require('../../../config/logger')('ami');var ami=require(_0xc597('0x4'));config[_0xc597('0x5')]=_[_0xc597('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xc597('0x7'))(new Redis(config[_0xc597('0x5')]));function UserReport(_0x30699b){this[_0xc597('0x8')]=_0x30699b['trunks'];this[_0xc597('0x9')]=_0x30699b[_0xc597('0x9')];this[_0xc597('0xa')]=_0x30699b[_0xc597('0xa')];ami['on']('registryentry',this['syncRegistry']['bind'](this));ami['on'](_0xc597('0xb'),this[_0xc597('0xc')][_0xc597('0xd')](this));ami['on']('devicestatechange',this[_0xc597('0xe')]['bind'](this));ami['on'](_0xc597('0xf'),this[_0xc597('0x10')][_0xc597('0xd')](this));return this[_0xc597('0x11')]();}function showSipRegistrations(){Promise['resolve']()[_0xc597('0x12')](ami['actionSipShowRegistry']())[_0xc597('0x13')](function(_0x3c65ae){logger[_0xc597('0x14')](_0xc597('0x15'),util[_0xc597('0x16')](_0x3c65ae,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xc597('0x12')](ami['actionDeviceStateList']())[_0xc597('0x13')](function(_0x27784b){logger[_0xc597('0x14')]('[userReport][devicestatelist]',util[_0xc597('0x16')](_0x27784b,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xc597('0x17')]()[_0xc597('0x12')](ami[_0xc597('0x18')]())['catch'](function(_0x238838){logger[_0xc597('0x14')](_0xc597('0x19'),util[_0xc597('0x16')](_0x238838,{'showHidden':![],'depth':null}));});}UserReport[_0xc597('0x1a')][_0xc597('0x11')]=function(){setInterval(function(){BPromise[_0xc597('0x17')]()[_0xc597('0x12')](showSipRegistrations())[_0xc597('0x12')](listDeviceStates())[_0xc597('0x12')](showPeersStatus());},0x32c8);};UserReport[_0xc597('0x1a')][_0xc597('0x1b')]=function(_0x3c6947){return _0x3c6947!==null&&!_[_0xc597('0x1c')](_0x3c6947);};UserReport[_0xc597('0x1a')][_0xc597('0x1d')]=function(_0x346fba,_0x3fe689,_0x501c39){io['to'](_0x346fba)[_0xc597('0x1d')](_0x3fe689,_0x501c39);};UserReport[_0xc597('0x1a')]['syncRegistry']=function(_0x17593c){try{if(this[_0xc597('0x1b')](_0x17593c)){logger[_0xc597('0x1e')](_0xc597('0x1f'),_0x17593c[_0xc597('0x20')],_0x17593c[_0xc597('0x21')]);logger[_0xc597('0x22')](_0xc597('0x23'),util[_0xc597('0x16')](_0x17593c,{'showHidden':![],'depth':null}));var _0x8b09c2=_[_0xc597('0x24')](this[_0xc597('0x8')],{'defaultuser':_0x17593c[_0xc597('0x20')]});if(_0x8b09c2){_0x17593c['stateRegistry']=_0x17593c[_0xc597('0x21')];_[_0xc597('0x25')](_0x8b09c2,_['omit'](_0x17593c,[_0xc597('0x26'),_0xc597('0x27'),_0xc597('0x20'),_0xc597('0x21')]));logger[_0xc597('0x22')](_0xc597('0x28'),util['inspect'](_0x8b09c2,{'showHidden':![],'depth':null}));this[_0xc597('0x1d')](util['format']('trunk:%s',_0x8b09c2[_0xc597('0x29')]),_0xc597('0x2a'),_0x8b09c2);}}}catch(_0x22bd39){logger[_0xc597('0x14')](_0xc597('0x23'),util[_0xc597('0x16')](_0x22bd39,{'showHidden':![],'depth':null}));}};UserReport[_0xc597('0x1a')][_0xc597('0xe')]=function(_0x4c43f1){try{if(this['isNotNull'](_0x4c43f1)){logger[_0xc597('0x1e')](_0xc597('0x2b'),_0x4c43f1[_0xc597('0x2c')],_0x4c43f1[_0xc597('0x21')]);logger[_0xc597('0x22')](_0xc597('0x2d'),util[_0xc597('0x16')](_0x4c43f1,{'showHidden':![],'depth':null}));if(this[_0xc597('0x9')][_0x4c43f1[_0xc597('0x2c')]]){if(!this[_0xc597('0x9')][_0x4c43f1[_0xc597('0x2c')]][_0xc597('0x2e')]||_0x4c43f1[_0xc597('0x21')][_0xc597('0x2f')]()==_0xc597('0x30')){this[_0xc597('0x9')][_0x4c43f1[_0xc597('0x2c')]][_0xc597('0x2e')]=![];if(this[_0xc597('0x9')][_0x4c43f1['device']][_0xc597('0x21')]!==_0x4c43f1[_0xc597('0x21')][_0xc597('0x2f')]()){this[_0xc597('0x9')][_0x4c43f1['device']][_0xc597('0x31')]=_['toNumber'](moment()['format']('x'));}this[_0xc597('0x9')][_0x4c43f1['device']][_0xc597('0x21')]=_0x4c43f1[_0xc597('0x21')][_0xc597('0x2f')]();this[_0xc597('0x9')][_0x4c43f1[_0xc597('0x2c')]]['updateStatusRealtime'](_0x4c43f1);}}else if(this[_0xc597('0xa')][_0x4c43f1[_0xc597('0x2c')]]){if(this[_0xc597('0xa')][_0x4c43f1[_0xc597('0x2c')]][_0xc597('0x21')]!==_0x4c43f1[_0xc597('0x21')][_0xc597('0x2f')]()){this[_0xc597('0xa')][_0x4c43f1['device']][_0xc597('0x31')]=_[_0xc597('0x32')](moment()[_0xc597('0x33')]('x'));}this[_0xc597('0xa')][_0x4c43f1[_0xc597('0x2c')]]['state']=_0x4c43f1['state'][_0xc597('0x2f')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0xc597('0x16')](this[_0xc597('0xa')][_0x4c43f1[_0xc597('0x2c')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xc597('0x33')](_0xc597('0x34'),this[_0xc597('0xa')][_0x4c43f1[_0xc597('0x2c')]]['name']),_0xc597('0x35'),this[_0xc597('0xa')][_0x4c43f1['device']]);}else if(this[_0xc597('0x8')][_0x4c43f1[_0xc597('0x2c')]]){if(this['trunks'][_0x4c43f1['device']]['state']!==_0x4c43f1[_0xc597('0x21')]['toLowerCase']()){this[_0xc597('0x8')][_0x4c43f1['device']]['stateTime']=_['toNumber'](moment()['format']('x'));}this[_0xc597('0x8')][_0x4c43f1['device']][_0xc597('0x21')]=_0x4c43f1[_0xc597('0x21')][_0xc597('0x2f')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xc597('0x16')](this[_0xc597('0x8')][_0x4c43f1['device']],{'showHidden':![],'depth':null}));this[_0xc597('0x1d')](util[_0xc597('0x33')]('trunk:%s',this[_0xc597('0x8')][_0x4c43f1[_0xc597('0x2c')]][_0xc597('0x29')]),'trunk:save',this['trunks'][_0x4c43f1['device']]);}else if(_['startsWith'](_0x4c43f1['device'],_0xc597('0x36'))){var _0x3db9ff=_0x4c43f1['device'];var _0x4a80da=_0x3db9ff['substring'](_0x3db9ff[_0xc597('0x37')]('/')+0x1,_0x3db9ff[_0xc597('0x37')]('@'));var _0x2f02ae=_['find'](this[_0xc597('0x9')],function(_0x407125){return _0x407125['mobile']==_0x4a80da||_0x407125['phone']==_0x4a80da||_0x407125[_0xc597('0x38')]==_0x4a80da;});if(_0x2f02ae){if(_0x2f02ae[_0xc597('0x21')]!==_0x4c43f1[_0xc597('0x21')]['toLowerCase']()){_0x2f02ae[_0xc597('0x31')]=_[_0xc597('0x32')](moment()[_0xc597('0x33')]('x'));}_0x2f02ae[_0xc597('0x21')]=_0x4c43f1[_0xc597('0x21')]['toLowerCase']();_0x2f02ae[_0xc597('0x2e')]=!![];_0x2f02ae['updateStatusRealtime'](_0x4c43f1);}}}}catch(_0x5d6b09){logger[_0xc597('0x14')]('[userReport][devicestatechange]',util[_0xc597('0x16')](_0x5d6b09,{'showHidden':![],'depth':null}));}};UserReport[_0xc597('0x1a')]['syncPeerStatus']=function(_0x260869){try{if(this[_0xc597('0x1b')](_0x260869)&&this[_0xc597('0x1b')](_0x260869[_0xc597('0xf')])){logger[_0xc597('0x1e')](_0xc597('0x39'),_0x260869[_0xc597('0x3a')],_0x260869[_0xc597('0x3b')],_0x260869[_0xc597('0xf')]);logger[_0xc597('0x22')](_0xc597('0x3c'),util[_0xc597('0x16')](_0x260869,{'showHidden':![],'depth':null}));if(this['agents'][_0x260869[_0xc597('0x3a')]]){if(!this['agents'][_0x260869['peer']][_0xc597('0x2e')]||_0x260869['peerstatus']['toLowerCase']()==_0xc597('0x3d')){this[_0xc597('0x9')][_0x260869[_0xc597('0x3a')]]['local']=![];this[_0xc597('0x9')][_0x260869[_0xc597('0x3a')]][_0xc597('0x3e')]=_0x260869[_0xc597('0xf')][_0xc597('0x2f')]();this['agents'][_0x260869[_0xc597('0x3a')]][_0xc597('0x3b')]=_0x260869[_0xc597('0x3b')];this['agents'][_0x260869['peer']][_0xc597('0x3f')](_0x260869);}}else if(this[_0xc597('0xa')][_0x260869[_0xc597('0x3a')]]){this[_0xc597('0xa')][_0x260869[_0xc597('0x3a')]]['status']=_0x260869[_0xc597('0xf')][_0xc597('0x2f')]();this[_0xc597('0xa')][_0x260869[_0xc597('0x3a')]][_0xc597('0x3b')]=_0x260869[_0xc597('0x3b')];logger[_0xc597('0x22')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0xc597('0x16')](this[_0xc597('0xa')][_0x260869[_0xc597('0x3a')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xc597('0x33')](_0xc597('0x34'),this[_0xc597('0xa')][_0x260869[_0xc597('0x3a')]][_0xc597('0x29')]),_0xc597('0x35'),this[_0xc597('0xa')][_0x260869['peer']]);}else if(this[_0xc597('0x8')][_0x260869[_0xc597('0x3a')]]){this[_0xc597('0x8')][_0x260869[_0xc597('0x3a')]]['status']=_0x260869['peerstatus'][_0xc597('0x2f')]();this[_0xc597('0x8')][_0x260869[_0xc597('0x3a')]][_0xc597('0x3b')]=_0x260869[_0xc597('0x3b')];logger[_0xc597('0x22')](_0xc597('0x40'),util[_0xc597('0x16')](this[_0xc597('0x8')][_0x260869[_0xc597('0x3a')]],{'showHidden':![],'depth':null}));this[_0xc597('0x1d')](util['format'](_0xc597('0x41'),this['trunks'][_0x260869[_0xc597('0x3a')]][_0xc597('0x29')]),_0xc597('0x2a'),this[_0xc597('0x8')][_0x260869['peer']]);}}}catch(_0x57f82b){logger[_0xc597('0x14')]('[userReport][peerstatus]',util['inspect'](_0x57f82b,{'showHidden':![],'depth':null}));}};module[_0xc597('0x42')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 5cd947e..2f0de6e 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 _0x9256=['agentconnect','syncAgentConnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','emit','prototype','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','inspect','user:%s','user:called','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','lastevent','answered_elsewhere','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','agent','talktime','acw','acwtime','acwTimeout','interface','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','value','variable','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind'];(function(_0x51821c,_0x2e39c5){var _0x20bde8=function(_0x2d307a){while(--_0x2d307a){_0x51821c['push'](_0x51821c['shift']());}};_0x20bde8(++_0x2e39c5);}(_0x9256,0x8f));var _0x6925=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9256[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6925('0x0'));var moment=require(_0x6925('0x1'));var util=require(_0x6925('0x2'));var Redis=require(_0x6925('0x3'));var config=require(_0x6925('0x4'));var logger=require(_0x6925('0x5'))(_0x6925('0x6'));var ami=require(_0x6925('0x7'));config[_0x6925('0x8')]=_[_0x6925('0x9')](config[_0x6925('0x8')],{'host':_0x6925('0xa'),'port':0x18eb});var io=require(_0x6925('0xb'))(new Redis(config[_0x6925('0x8')]));function VoiceAgentReport(_0x5d2318){this[_0x6925('0xc')]={};this[_0x6925('0xd')]=_0x5d2318[_0x6925('0xd')];this[_0x6925('0xe')]=_0x5d2318[_0x6925('0xe')];this[_0x6925('0xf')]={};ami['on'](_0x6925('0x10'),this[_0x6925('0x11')][_0x6925('0x12')](this));ami['on'](_0x6925('0x13'),this[_0x6925('0x14')][_0x6925('0x12')](this));ami['on'](_0x6925('0x15'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x6925('0x16'),this[_0x6925('0x17')]['bind'](this));ami['on'](_0x6925('0x18'),this[_0x6925('0x19')]['bind'](this));ami['on'](_0x6925('0x1a'),this[_0x6925('0x1b')][_0x6925('0x12')](this));ami['on']('hangup',this[_0x6925('0x1c')][_0x6925('0x12')](this));ami['on'](_0x6925('0x1d'),this[_0x6925('0x1e')]['bind'](this));ami['on'](_0x6925('0x1f'),this['syncMusicOnHoldStop'][_0x6925('0x12')](this));ami['on'](_0x6925('0x20'),this[_0x6925('0x21')][_0x6925('0x12')](this));ami['on'](_0x6925('0x22'),this['syncBlindTransfer'][_0x6925('0x12')](this));}VoiceAgentReport['prototype'][_0x6925('0x23')]=function(_0x591ca8,_0x26c287,_0xde7284){io['to'](_0x591ca8)[_0x6925('0x23')](_0x26c287,_0xde7284);};VoiceAgentReport[_0x6925('0x24')][_0x6925('0x25')]=function(_0x1a0cac){return _0x1a0cac!==null&&!_[_0x6925('0x26')](_0x1a0cac);};VoiceAgentReport[_0x6925('0x24')][_0x6925('0x11')]=function(_0x1d0127){try{if(this[_0x6925('0x25')](_0x1d0127)){logger[_0x6925('0x27')](_0x6925('0x28'),_0x1d0127[_0x6925('0x29')],_0x1d0127[_0x6925('0x2a')],_0x1d0127[_0x6925('0x2b')]);logger[_0x6925('0x2c')](_0x6925('0x2d'),_0x1d0127[_0x6925('0x29')],util['inspect'](_0x1d0127,{'showHidden':![],'depth':null}));if(_[_0x6925('0x26')](this[_0x6925('0xc')][_0x1d0127[_0x6925('0x29')]])){this[_0x6925('0xc')][_0x1d0127['uniqueid']]={};}if(_['isUndefined'](this[_0x6925('0xc')][_0x1d0127['uniqueid']][_0x1d0127[_0x6925('0x2b')]])){this['channels'][_0x1d0127['uniqueid']][_0x1d0127[_0x6925('0x2b')]]={'agentcalledAt':moment()[_0x6925('0x2e')](_0x6925('0x2f')),'lastevent':_0x6925('0x30'),'mandatoryDisposition':this[_0x6925('0xd')][_0x1d0127[_0x6925('0x31')]]?this[_0x6925('0xd')][_0x1d0127[_0x6925('0x31')]]['mandatoryDisposition']||![]:![],'type':this[_0x6925('0xd')][_0x1d0127[_0x6925('0x31')]]?this[_0x6925('0xd')][_0x1d0127['queue']][_0x6925('0x32')]||_0x6925('0x33'):'inbound','variables':this[_0x6925('0xf')][_0x1d0127[_0x6925('0x29')]]};}_[_0x6925('0x34')](this[_0x6925('0xc')][_0x1d0127[_0x6925('0x29')]][_0x1d0127[_0x6925('0x2b')]],_[_0x6925('0x35')](_0x1d0127,[_0x6925('0x36'),_0x6925('0x37')]));logger['debug'](_0x6925('0x38'),_0x1d0127[_0x6925('0x29')],util['inspect'](this[_0x6925('0xc')][_0x1d0127['uniqueid']][_0x1d0127['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x6925('0x23')](_0x6925('0x39'),this[_0x6925('0xc')][_0x1d0127[_0x6925('0x29')]][_0x1d0127[_0x6925('0x2b')]]);logger['debug'](_0x6925('0x3a'),_0x1d0127[_0x6925('0x29')],util[_0x6925('0x3b')](this[_0x6925('0xc')][_0x1d0127[_0x6925('0x29')]][_0x1d0127[_0x6925('0x2b')]],{'showHidden':![],'depth':null}));this[_0x6925('0x23')](util[_0x6925('0x2e')](_0x6925('0x3c'),_0x1d0127[_0x6925('0x2a')]),_0x6925('0x3d'),this[_0x6925('0xc')][_0x1d0127[_0x6925('0x29')]][_0x1d0127['destuniqueid']]);}}catch(_0x14e908){logger['error'](_0x6925('0x3e'),_0x1d0127['uniqueid'],util['inspect'](_0x14e908,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6925('0x24')][_0x6925('0x14')]=function(_0x455e77){try{if(this[_0x6925('0x25')](_0x455e77)){if(this[_0x6925('0xc')][_0x455e77[_0x6925('0x29')]]){logger[_0x6925('0x2c')](_0x6925('0x3f'),_0x455e77['uniqueid'],util[_0x6925('0x3b')](_0x455e77,{'showHidden':![],'depth':null}));for(var _0x540cd4 in this[_0x6925('0xc')][_0x455e77[_0x6925('0x29')]]){if(this['channels'][_0x455e77[_0x6925('0x29')]][_0x6925('0x40')](_0x540cd4)){if(_0x455e77[_0x6925('0x2b')]===_0x540cd4){logger['info'](_0x6925('0x41'),_0x455e77[_0x6925('0x29')],_0x455e77[_0x6925('0x2a')],_0x455e77['destuniqueid']);this['channels'][_0x455e77[_0x6925('0x29')]][_0x540cd4][_0x6925('0x42')]=moment()[_0x6925('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6925('0xc')][_0x455e77[_0x6925('0x29')]][_0x540cd4][_0x6925('0x43')]=_0x455e77[_0x6925('0x43')];this[_0x6925('0xc')][_0x455e77[_0x6925('0x29')]][_0x540cd4][_0x6925('0x44')]=_0x455e77['connectedlinenum'];this[_0x6925('0xc')][_0x455e77[_0x6925('0x29')]][_0x540cd4][_0x6925('0x45')]=_0x455e77['destchannelstate'];this['channels'][_0x455e77[_0x6925('0x29')]][_0x540cd4]['destchannelstatedesc']=_0x455e77[_0x6925('0x46')];this[_0x6925('0xc')][_0x455e77[_0x6925('0x29')]][_0x540cd4][_0x6925('0x47')]=_0x455e77[_0x6925('0x47')];this['channels'][_0x455e77[_0x6925('0x29')]][_0x540cd4]['lastevent']=_0x6925('0x48');_[_0x6925('0x34')](this['agents'][_0x455e77['interface']],_[_0x6925('0x49')](_0x455e77,[_0x6925('0x31'),_0x6925('0x4a')]));logger[_0x6925('0x2c')](_0x6925('0x4b'),_0x455e77[_0x6925('0x29')],util[_0x6925('0x3b')](this['channels'][_0x455e77['uniqueid']][_0x455e77[_0x6925('0x2b')]],{'showHidden':![],'depth':null}));ami[_0x6925('0x23')](_0x6925('0x4c'),this[_0x6925('0xc')][_0x455e77['uniqueid']][_0x455e77[_0x6925('0x2b')]]);logger[_0x6925('0x2c')](_0x6925('0x4d'),_0x455e77[_0x6925('0x29')],util['inspect'](this[_0x6925('0xc')][_0x455e77['uniqueid']][_0x455e77[_0x6925('0x2b')]],{'showHidden':![],'depth':null}));this[_0x6925('0x23')](util[_0x6925('0x2e')](_0x6925('0x3c'),_0x455e77[_0x6925('0x2a')]),_0x6925('0x4e'),this[_0x6925('0xc')][_0x455e77[_0x6925('0x29')]][_0x455e77[_0x6925('0x2b')]]);}else if(!this[_0x6925('0xc')][_0x455e77[_0x6925('0x29')]][_0x540cd4][_0x6925('0x15')]&&!this['channels'][_0x455e77[_0x6925('0x29')]][_0x540cd4]['agentcomplete']){logger[_0x6925('0x27')](_0x6925('0x4f'),_0x455e77[_0x6925('0x29')],this[_0x6925('0xc')][_0x455e77[_0x6925('0x29')]][_0x540cd4]['membername'],_0x540cd4);this[_0x6925('0xc')][_0x455e77[_0x6925('0x29')]][_0x540cd4][_0x6925('0x15')]=!![];this[_0x6925('0xc')][_0x455e77[_0x6925('0x29')]][_0x540cd4][_0x6925('0x50')]=moment()[_0x6925('0x2e')](_0x6925('0x2f'));this['channels'][_0x455e77['uniqueid']][_0x540cd4][_0x6925('0x51')]=_0x455e77[_0x6925('0x2b')];this[_0x6925('0xc')][_0x455e77['uniqueid']][_0x540cd4][_0x6925('0x52')]=_0x455e77['membername'];this[_0x6925('0xc')][_0x455e77[_0x6925('0x29')]][_0x540cd4][_0x6925('0x53')]=_0x6925('0x54');this[_0x6925('0xc')][_0x455e77[_0x6925('0x29')]][_0x540cd4]['reason']=_0x6925('0x54');logger[_0x6925('0x2c')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x455e77['uniqueid'],util[_0x6925('0x3b')](this['channels'][_0x455e77[_0x6925('0x29')]][_0x540cd4],{'showHidden':![],'depth':null}));ami[_0x6925('0x23')](_0x6925('0x55'),this['channels'][_0x455e77[_0x6925('0x29')]][_0x540cd4]);}}}}}}catch(_0x385761){logger['error']('[%s][voiceAgentReport][agentconnect]',_0x455e77['uniqueid'],util[_0x6925('0x3b')](_0x385761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6925('0x24')][_0x6925('0x56')]=function(_0x234631){try{if(this[_0x6925('0x25')](_0x234631)){logger[_0x6925('0x2c')](_0x6925('0x57'),_0x234631[_0x6925('0x29')],util[_0x6925('0x3b')](_0x234631,{'showHidden':![],'depth':null}));if(this[_0x6925('0xc')][_0x234631[_0x6925('0x29')]]&&this[_0x6925('0xc')][_0x234631[_0x6925('0x29')]][_0x234631['destuniqueid']]){logger[_0x6925('0x27')](_0x6925('0x58'),_0x234631[_0x6925('0x29')],_0x234631[_0x6925('0x2a')],_0x234631[_0x6925('0x2b')]);this[_0x6925('0xc')][_0x234631['uniqueid']][_0x234631[_0x6925('0x2b')]]['agentringnoanswer']=!![];this['channels'][_0x234631[_0x6925('0x29')]][_0x234631['destuniqueid']]['agentringnoanswerAt']=moment()[_0x6925('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6925('0xc')][_0x234631[_0x6925('0x29')]][_0x234631[_0x6925('0x2b')]]['lastevent']=_0x6925('0x59');this['channels'][_0x234631[_0x6925('0x29')]][_0x234631[_0x6925('0x2b')]][_0x6925('0x5a')]=_0x6925('0x59');logger[_0x6925('0x2c')](_0x6925('0x5b'),_0x234631[_0x6925('0x29')],util[_0x6925('0x3b')](this[_0x6925('0xc')][_0x234631[_0x6925('0x29')]][_0x234631[_0x6925('0x2b')]],{'showHidden':![],'depth':null}));ami['emit'](_0x6925('0x5c'),this[_0x6925('0xc')][_0x234631[_0x6925('0x29')]][_0x234631[_0x6925('0x2b')]]);}}}catch(_0x3bbecb){logger[_0x6925('0x5d')](_0x6925('0x5e'),_0x234631[_0x6925('0x29')],util[_0x6925('0x3b')](_0x3bbecb,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6925('0x17')]=function(_0x3cc040){try{if(this[_0x6925('0x25')](_0x3cc040)){logger[_0x6925('0x2c')](_0x6925('0x5f'),_0x3cc040[_0x6925('0x29')],util[_0x6925('0x3b')](_0x3cc040,{'showHidden':![],'depth':null}));if(this['channels'][_0x3cc040[_0x6925('0x29')]]){for(var _0x1770b2 in this[_0x6925('0xc')][_0x3cc040['uniqueid']]){if(this[_0x6925('0xc')][_0x3cc040[_0x6925('0x29')]][_0x6925('0x40')](_0x1770b2)&&!this[_0x6925('0xc')][_0x3cc040['uniqueid']][_0x1770b2][_0x6925('0x15')]&&!this[_0x6925('0xc')][_0x3cc040[_0x6925('0x29')]][_0x1770b2][_0x6925('0x18')]){logger['info']('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x3cc040['uniqueid'],this[_0x6925('0xc')][_0x3cc040['uniqueid']][_0x1770b2]['membername'],_0x1770b2);this[_0x6925('0xc')][_0x3cc040[_0x6925('0x29')]][_0x1770b2][_0x6925('0x15')]=!![];this['channels'][_0x3cc040[_0x6925('0x29')]][_0x1770b2][_0x6925('0x50')]=moment()[_0x6925('0x2e')](_0x6925('0x2f'));this[_0x6925('0xc')][_0x3cc040[_0x6925('0x29')]][_0x1770b2]['lastevent']=_0x6925('0x60');this['channels'][_0x3cc040['uniqueid']][_0x1770b2]['reason']=_0x6925('0x60');logger[_0x6925('0x2c')](_0x6925('0x61'),_0x3cc040[_0x6925('0x29')],util[_0x6925('0x3b')](this['channels'][_0x3cc040[_0x6925('0x29')]][_0x1770b2],{'showHidden':![],'depth':null}));ami[_0x6925('0x23')]('custom:agentqueuecallerabandon',this['channels'][_0x3cc040[_0x6925('0x29')]][_0x1770b2]);}}}}}catch(_0xcbb33b){logger['error'](_0x6925('0x62'),_0x3cc040[_0x6925('0x29')],util[_0x6925('0x3b')](_0xcbb33b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6925('0x24')][_0x6925('0x19')]=function(_0x1efa76){try{if(this[_0x6925('0x25')](_0x1efa76)){logger[_0x6925('0x2c')](_0x6925('0x63'),_0x1efa76['uniqueid'],util[_0x6925('0x3b')](_0x1efa76,{'showHidden':![],'depth':null}));if(this[_0x6925('0xc')][_0x1efa76['uniqueid']]){for(var _0x3ee37c in this['channels'][_0x1efa76['uniqueid']]){if(this[_0x6925('0xc')][_0x1efa76[_0x6925('0x29')]][_0x6925('0x40')](_0x3ee37c)){if(this[_0x6925('0xc')][_0x1efa76['uniqueid']][_0x3ee37c][_0x6925('0x42')]&&!this[_0x6925('0xc')][_0x1efa76[_0x6925('0x29')]][_0x3ee37c][_0x6925('0x18')]){logger[_0x6925('0x27')](_0x6925('0x64'),_0x1efa76[_0x6925('0x29')],this[_0x6925('0xc')][_0x1efa76['uniqueid']][_0x3ee37c]['membername'],_0x3ee37c);this['channels'][_0x1efa76[_0x6925('0x29')]][_0x3ee37c]['agentcomplete']=!![];this[_0x6925('0xc')][_0x1efa76[_0x6925('0x29')]][_0x3ee37c][_0x6925('0x65')]=moment()['format'](_0x6925('0x2f'));this['channels'][_0x1efa76[_0x6925('0x29')]][_0x3ee37c][_0x6925('0x53')]='complete';this[_0x6925('0xc')][_0x1efa76[_0x6925('0x29')]][_0x3ee37c][_0x6925('0x5a')]=_0x1efa76[_0x6925('0x5a')]=='transfer'?_0x6925('0x66'):_0x1efa76['reason'];this[_0x6925('0xc')][_0x1efa76[_0x6925('0x29')]][_0x3ee37c][_0x6925('0x67')]=_0x1efa76['talktime'];if(this['voiceQueues'][_0x1efa76[_0x6925('0x31')]]&&this[_0x6925('0xd')][_0x1efa76[_0x6925('0x31')]][_0x6925('0x68')]){this[_0x6925('0xc')][_0x1efa76[_0x6925('0x29')]][_0x3ee37c][_0x6925('0x69')]=this[_0x6925('0xd')][_0x1efa76[_0x6925('0x31')]][_0x6925('0x6a')];this[_0x6925('0xc')][_0x1efa76[_0x6925('0x29')]][_0x3ee37c]['agentacw']=!![];}this[_0x6925('0xe')][_0x1efa76[_0x6925('0x6b')]]=_[_0x6925('0x35')](this[_0x6925('0xe')][_0x1efa76[_0x6925('0x6b')]],[_0x6925('0x31'),_0x6925('0x4a')]);logger[_0x6925('0x2c')](_0x6925('0x6c'),_0x1efa76[_0x6925('0x29')],util[_0x6925('0x3b')](this[_0x6925('0xc')][_0x1efa76[_0x6925('0x29')]][_0x3ee37c],{'showHidden':![],'depth':null}));ami[_0x6925('0x23')](_0x6925('0x6d'),this[_0x6925('0xc')][_0x1efa76['uniqueid']][_0x3ee37c]);logger[_0x6925('0x2c')](_0x6925('0x6e'),_0x1efa76['uniqueid'],util[_0x6925('0x3b')](this[_0x6925('0xc')][_0x1efa76[_0x6925('0x29')]][_0x3ee37c],{'showHidden':![],'depth':null}));this[_0x6925('0x23')](util['format']('user:%s',_0x1efa76[_0x6925('0x2a')]),_0x6925('0x6f'),this[_0x6925('0xc')][_0x1efa76[_0x6925('0x29')]][_0x3ee37c]);}}}}}}catch(_0xe28735){logger[_0x6925('0x5d')](_0x6925('0x70'),_0x1efa76['uniqueid'],util[_0x6925('0x3b')](_0xe28735,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6925('0x24')][_0x6925('0x1b')]=function(_0xcc418b){try{if(this[_0x6925('0x25')](_0xcc418b)){logger[_0x6925('0x2c')](_0x6925('0x71'),_0xcc418b['uniqueid'],util[_0x6925('0x3b')](_0xcc418b,{'showHidden':![],'depth':null}));this[_0x6925('0x72')](_0xcc418b['uniqueid'],_[_0x6925('0x73')](_0xcc418b['variable'])[0x0],_0xcc418b[_0x6925('0x74')]);if(this[_0x6925('0xc')][_0xcc418b[_0x6925('0x29')]]){for(var _0x1edb88 in this[_0x6925('0xc')][_0xcc418b[_0x6925('0x29')]]){if(this['channels'][_0xcc418b['uniqueid']]['hasOwnProperty'](_0x1edb88)){logger[_0x6925('0x27')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0xcc418b[_0x6925('0x29')],_0x1edb88,_[_0x6925('0x73')](_0xcc418b[_0x6925('0x75')])[0x0],_0xcc418b['value']);if(_[_0x6925('0x26')](this[_0x6925('0xc')][_0xcc418b[_0x6925('0x29')]][_0x1edb88][_0x6925('0xf')])){this[_0x6925('0xc')][_0xcc418b[_0x6925('0x29')]][_0x1edb88][_0x6925('0xf')]={};}this[_0x6925('0xc')][_0xcc418b[_0x6925('0x29')]][_0x1edb88]['variables']=this[_0x6925('0xf')][_0xcc418b[_0x6925('0x29')]];}}}}}catch(_0xcda101){logger[_0x6925('0x5d')]('[%s][voiceAgentReport][varset]',_0xcc418b[_0x6925('0x29')],util['inspect'](_0xcda101,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6925('0x24')]['addVariable']=function(_0x5af8b2,_0x3ba4ce,_0x22b958){var _0x3ec222=[_0x6925('0x76'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x6925('0x77'),_0x6925('0x78'),_0x6925('0x79'),_0x6925('0x7a'),_0x6925('0x7b'),_0x6925('0x7c'),_0x6925('0x7d'),'bridgepeer',_0x6925('0x7e'),_0x6925('0x7f'),_0x6925('0x80'),_0x6925('0x81'),_0x6925('0x82'),_0x6925('0x2a'),_0x6925('0x83'),_0x6925('0x84')];if(!_[_0x6925('0x85')](_0x3ba4ce)&&!_[_0x6925('0x86')](_0x3ec222,_0x3ba4ce)){if(_[_0x6925('0x26')](this[_0x6925('0xf')][_0x5af8b2])){this['variables'][_0x5af8b2]={};}this['variables'][_0x5af8b2][_0x3ba4ce]=_0x22b958;}};VoiceAgentReport['prototype'][_0x6925('0x1c')]=function(_0x5f2237){try{if(this[_0x6925('0x25')](_0x5f2237)){logger[_0x6925('0x2c')](_0x6925('0x87'),_0x5f2237[_0x6925('0x29')],util[_0x6925('0x3b')](_0x5f2237,{'showHidden':![],'depth':null}));if(this['channels'][_0x5f2237['uniqueid']]){for(var _0x5033f0 in this['channels'][_0x5f2237['uniqueid']]){if(this[_0x6925('0xc')][_0x5f2237[_0x6925('0x29')]]['hasOwnProperty'](_0x5033f0)){if(this[_0x6925('0xc')][_0x5f2237[_0x6925('0x29')]][_0x5033f0]['reason']==_0x6925('0x88')&&this[_0x6925('0xc')][_0x5f2237[_0x6925('0x29')]][_0x5033f0]['agentcomplete']){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x5f2237[_0x6925('0x29')],_0x5033f0);this[_0x6925('0xc')][_0x5f2237['uniqueid']][_0x5033f0]['agentcompleteAt']=moment()['format'](_0x6925('0x2f'));}}}logger['debug'](_0x6925('0x89'),_0x5f2237['uniqueid'],util[_0x6925('0x3b')](_[_0x6925('0x8a')](this[_0x6925('0xc')][_0x5f2237['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x6925('0x23')](_0x6925('0x8b'),_[_0x6925('0x8a')](this['channels'][_0x5f2237['uniqueid']]));delete this['channels'][_0x5f2237['uniqueid']];}if(this[_0x6925('0xf')][_0x5f2237[_0x6925('0x29')]]){delete this[_0x6925('0xf')][_0x5f2237['uniqueid']];}}}catch(_0x14dfdf){logger[_0x6925('0x5d')](_0x6925('0x8c'),_0x5f2237[_0x6925('0x29')],util[_0x6925('0x3b')](_0x14dfdf,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAttendedTransfer']=function(_0x363175){try{if(this[_0x6925('0x25')](_0x363175)){logger[_0x6925('0x2c')](_0x6925('0x8d'),_0x363175['uniqueid'],util[_0x6925('0x3b')](_0x363175,{'showHidden':![],'depth':null}));if(this[_0x6925('0xc')][_0x363175[_0x6925('0x8e')]]){for(var _0x9a58f3 in this[_0x6925('0xc')][_0x363175[_0x6925('0x8e')]]){if(this[_0x6925('0xc')][_0x363175[_0x6925('0x8e')]][_0x6925('0x40')](_0x9a58f3)){if(_0x363175['origtransfereruniqueid']===_0x9a58f3){logger[_0x6925('0x27')](_0x6925('0x8f'),_0x363175[_0x6925('0x29')],this[_0x6925('0xc')][_0x363175[_0x6925('0x8e')]][_0x9a58f3][_0x6925('0x2a')],_0x9a58f3);var _0x1cc474=moment();this[_0x6925('0xc')][_0x363175['transfereeuniqueid']][_0x9a58f3][_0x6925('0x18')]=!![];this[_0x6925('0xc')][_0x363175[_0x6925('0x8e')]][_0x9a58f3][_0x6925('0x65')]=moment()[_0x6925('0x2e')](_0x6925('0x2f'));this[_0x6925('0xc')][_0x363175['transfereeuniqueid']][_0x9a58f3]['lastevent']=_0x6925('0x90');this['channels'][_0x363175[_0x6925('0x8e')]][_0x9a58f3][_0x6925('0x5a')]=_0x6925('0x88');this[_0x6925('0xc')][_0x363175[_0x6925('0x8e')]][_0x9a58f3][_0x6925('0x67')]=_0x1cc474[_0x6925('0x91')](this[_0x6925('0xc')][_0x363175[_0x6925('0x8e')]][_0x9a58f3][_0x6925('0x42')],_0x6925('0x92'));}}}}if(this[_0x6925('0xc')][_0x363175[_0x6925('0x93')]]){var _0xf2cfe0=this[_0x6925('0xc')][_0x363175[_0x6925('0x93')]];this[_0x6925('0xc')][_0x363175[_0x6925('0x93')]]=this['channels'][_0x363175[_0x6925('0x8e')]];this[_0x6925('0xc')][_0x363175[_0x6925('0x8e')]]=_0xf2cfe0;}}}catch(_0x57eaaa){logger[_0x6925('0x5d')](_0x6925('0x94'),_0x363175['uniqueid'],util[_0x6925('0x3b')](_0x57eaaa,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6925('0x24')][_0x6925('0x95')]=function(_0x32d7c4){try{if(this[_0x6925('0x25')](_0x32d7c4)){logger[_0x6925('0x2c')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x32d7c4[_0x6925('0x29')],util['inspect'](_0x32d7c4,{'showHidden':![],'depth':null}));if(this[_0x6925('0xc')][_0x32d7c4[_0x6925('0x8e')]]){for(var _0x3b9317 in this['channels'][_0x32d7c4['transfereeuniqueid']]){if(this[_0x6925('0xc')][_0x32d7c4[_0x6925('0x8e')]][_0x6925('0x40')](_0x3b9317)){if(_0x32d7c4[_0x6925('0x96')]===_0x3b9317){logger[_0x6925('0x27')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x32d7c4[_0x6925('0x29')],this[_0x6925('0xc')][_0x32d7c4[_0x6925('0x8e')]][_0x3b9317]['membername'],_0x3b9317);var _0x268de4=moment();this['channels'][_0x32d7c4['transfereeuniqueid']][_0x3b9317][_0x6925('0x18')]=!![];this[_0x6925('0xc')][_0x32d7c4[_0x6925('0x8e')]][_0x3b9317][_0x6925('0x65')]=_0x268de4;this[_0x6925('0xc')][_0x32d7c4[_0x6925('0x8e')]][_0x3b9317][_0x6925('0x53')]=_0x6925('0x90');this[_0x6925('0xc')][_0x32d7c4['transfereeuniqueid']][_0x3b9317][_0x6925('0x5a')]=_0x6925('0x88');this[_0x6925('0xc')][_0x32d7c4[_0x6925('0x8e')]][_0x3b9317][_0x6925('0x67')]=_0x268de4[_0x6925('0x91')](this[_0x6925('0xc')][_0x32d7c4['transfereeuniqueid']][_0x3b9317][_0x6925('0x42')],_0x6925('0x92'));}}}}}}catch(_0x23a42c){logger[_0x6925('0x5d')](_0x6925('0x97'),_0x32d7c4[_0x6925('0x29')],util[_0x6925('0x3b')](_0x23a42c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6925('0x24')][_0x6925('0x1e')]=function(_0x2ad11e){var _0x21814f='';try{if(this[_0x6925('0x25')](_0x2ad11e)){logger['debug'](_0x6925('0x98'),_0x2ad11e['uniqueid'],util[_0x6925('0x3b')](_0x2ad11e,{'showHidden':![],'depth':null}));if(_0x2ad11e['channel']){_0x21814f=_0x2ad11e[_0x6925('0x99')][_0x6925('0x9a')](0x0,_0x2ad11e[_0x6925('0x99')]['lastIndexOf']('-'));if(this[_0x6925('0xe')][_0x21814f]){logger['info'](_0x6925('0x9b'),_0x2ad11e['uniqueid'],_0x21814f);this[_0x6925('0xe')][_0x21814f][_0x6925('0x9c')]=!![];}}}}catch(_0x43bb6c){logger[_0x6925('0x5d')](_0x6925('0x9d'),_0x2ad11e[_0x6925('0x29')],util['inspect'](_0x43bb6c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6925('0x24')][_0x6925('0x9e')]=function(_0xcbb7a2){var _0xaf0596='';try{if(this[_0x6925('0x25')](_0xcbb7a2)){logger[_0x6925('0x2c')](_0x6925('0x9f'),_0xcbb7a2[_0x6925('0x29')],util[_0x6925('0x3b')](_0xcbb7a2,{'showHidden':![],'depth':null}));if(_0xcbb7a2[_0x6925('0x99')]){_0xaf0596=_0xcbb7a2[_0x6925('0x99')][_0x6925('0x9a')](0x0,_0xcbb7a2[_0x6925('0x99')]['lastIndexOf']('-'));if(this[_0x6925('0xe')][_0xaf0596]){logger[_0x6925('0x27')](_0x6925('0xa0'),_0xcbb7a2['uniqueid'],_0xaf0596);this[_0x6925('0xe')][_0xaf0596][_0x6925('0x9c')]=![];}}}}catch(_0x505296){logger[_0x6925('0x5d')]('[%s][voiceAgentReport][musiconholdstop]',_0xcbb7a2['uniqueid'],util[_0x6925('0x3b')](_0x505296,{'showHidden':![],'depth':null}));}};module[_0x6925('0xa1')]=VoiceAgentReport; \ No newline at end of file +var _0xde05=['agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentringnoanswer]\x20event:','reason','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:%s','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','addVariable','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','value','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','varset','syncHangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','emit','prototype','isNotNull','isUndefined','info','uniqueid','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','membername','user:called','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','destchannelstate','destchannelstatedesc','lastevent','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xde05,0xe5));var _0x5de0=function(_0x4f5fd3,_0x284cff){_0x4f5fd3=_0x4f5fd3-0x0;var _0x4b377a=_0xde05[_0x4f5fd3];return _0x4b377a;};'use strict';var _=require(_0x5de0('0x0'));var moment=require(_0x5de0('0x1'));var util=require('util');var Redis=require(_0x5de0('0x2'));var config=require(_0x5de0('0x3'));var logger=require(_0x5de0('0x4'))(_0x5de0('0x5'));var ami=require(_0x5de0('0x6'));config[_0x5de0('0x7')]=_[_0x5de0('0x8')](config[_0x5de0('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x5de0('0x9'))(new Redis(config['redis']));function VoiceAgentReport(_0x481f62){this['channels']={};this[_0x5de0('0xa')]=_0x481f62[_0x5de0('0xa')];this[_0x5de0('0xb')]=_0x481f62['agents'];this[_0x5de0('0xc')]={};ami['on'](_0x5de0('0xd'),this[_0x5de0('0xe')]['bind'](this));ami['on']('agentconnect',this['syncAgentConnect'][_0x5de0('0xf')](this));ami['on']('agentringnoanswer',this[_0x5de0('0x10')][_0x5de0('0xf')](this));ami['on'](_0x5de0('0x11'),this[_0x5de0('0x12')]['bind'](this));ami['on'](_0x5de0('0x13'),this['syncAgentComplete'][_0x5de0('0xf')](this));ami['on'](_0x5de0('0x14'),this['syncVarSet'][_0x5de0('0xf')](this));ami['on']('hangup',this[_0x5de0('0x15')][_0x5de0('0xf')](this));ami['on'](_0x5de0('0x16'),this['syncMusicOnHoldStart'][_0x5de0('0xf')](this));ami['on'](_0x5de0('0x17'),this[_0x5de0('0x18')][_0x5de0('0xf')](this));ami['on'](_0x5de0('0x19'),this[_0x5de0('0x1a')]['bind'](this));ami['on'](_0x5de0('0x1b'),this['syncBlindTransfer'][_0x5de0('0xf')](this));}VoiceAgentReport['prototype'][_0x5de0('0x1c')]=function(_0xe4e425,_0x3e19ac,_0x46f93e){io['to'](_0xe4e425)[_0x5de0('0x1c')](_0x3e19ac,_0x46f93e);};VoiceAgentReport[_0x5de0('0x1d')][_0x5de0('0x1e')]=function(_0xbb4b36){return _0xbb4b36!==null&&!_[_0x5de0('0x1f')](_0xbb4b36);};VoiceAgentReport['prototype']['syncAgentCalled']=function(_0x145e8a){try{if(this[_0x5de0('0x1e')](_0x145e8a)){logger[_0x5de0('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x145e8a[_0x5de0('0x21')],_0x145e8a['membername'],_0x145e8a[_0x5de0('0x22')]);logger[_0x5de0('0x23')](_0x5de0('0x24'),_0x145e8a[_0x5de0('0x21')],util[_0x5de0('0x25')](_0x145e8a,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x5de0('0x26')][_0x145e8a[_0x5de0('0x21')]])){this[_0x5de0('0x26')][_0x145e8a[_0x5de0('0x21')]]={};}if(_['isUndefined'](this[_0x5de0('0x26')][_0x145e8a['uniqueid']][_0x145e8a[_0x5de0('0x22')]])){this[_0x5de0('0x26')][_0x145e8a[_0x5de0('0x21')]][_0x145e8a['destuniqueid']]={'agentcalledAt':moment()[_0x5de0('0x27')](_0x5de0('0x28')),'lastevent':_0x5de0('0x29'),'mandatoryDisposition':this[_0x5de0('0xa')][_0x145e8a['queue']]?this[_0x5de0('0xa')][_0x145e8a[_0x5de0('0x2a')]][_0x5de0('0x2b')]||![]:![],'type':this[_0x5de0('0xa')][_0x145e8a['queue']]?this[_0x5de0('0xa')][_0x145e8a[_0x5de0('0x2a')]][_0x5de0('0x2c')]||'inbound':_0x5de0('0x2d'),'variables':this['variables'][_0x145e8a[_0x5de0('0x21')]]};}_[_0x5de0('0x2e')](this[_0x5de0('0x26')][_0x145e8a[_0x5de0('0x21')]][_0x145e8a[_0x5de0('0x22')]],_[_0x5de0('0x2f')](_0x145e8a,[_0x5de0('0x30'),_0x5de0('0x31')]));logger[_0x5de0('0x23')](_0x5de0('0x32'),_0x145e8a[_0x5de0('0x21')],util[_0x5de0('0x25')](this[_0x5de0('0x26')][_0x145e8a['uniqueid']][_0x145e8a[_0x5de0('0x22')]],{'showHidden':![],'depth':null}));ami[_0x5de0('0x1c')](_0x5de0('0x33'),this[_0x5de0('0x26')][_0x145e8a['uniqueid']][_0x145e8a[_0x5de0('0x22')]]);logger[_0x5de0('0x23')](_0x5de0('0x34'),_0x145e8a[_0x5de0('0x21')],util[_0x5de0('0x25')](this[_0x5de0('0x26')][_0x145e8a[_0x5de0('0x21')]][_0x145e8a[_0x5de0('0x22')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x5de0('0x27')]('user:%s',_0x145e8a[_0x5de0('0x35')]),_0x5de0('0x36'),this['channels'][_0x145e8a[_0x5de0('0x21')]][_0x145e8a[_0x5de0('0x22')]]);}}catch(_0x4bfb04){logger[_0x5de0('0x37')](_0x5de0('0x38'),_0x145e8a[_0x5de0('0x21')],util[_0x5de0('0x25')](_0x4bfb04,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x5de0('0x39')]=function(_0x1f29d5){try{if(this[_0x5de0('0x1e')](_0x1f29d5)){if(this[_0x5de0('0x26')][_0x1f29d5[_0x5de0('0x21')]]){logger[_0x5de0('0x23')](_0x5de0('0x3a'),_0x1f29d5[_0x5de0('0x21')],util[_0x5de0('0x25')](_0x1f29d5,{'showHidden':![],'depth':null}));for(var _0x3f6288 in this['channels'][_0x1f29d5['uniqueid']]){if(this[_0x5de0('0x26')][_0x1f29d5[_0x5de0('0x21')]][_0x5de0('0x3b')](_0x3f6288)){if(_0x1f29d5[_0x5de0('0x22')]===_0x3f6288){logger[_0x5de0('0x20')](_0x5de0('0x3c'),_0x1f29d5[_0x5de0('0x21')],_0x1f29d5[_0x5de0('0x35')],_0x1f29d5[_0x5de0('0x22')]);this[_0x5de0('0x26')][_0x1f29d5['uniqueid']][_0x3f6288][_0x5de0('0x3d')]=moment()['format'](_0x5de0('0x28'));this[_0x5de0('0x26')][_0x1f29d5[_0x5de0('0x21')]][_0x3f6288][_0x5de0('0x3e')]=_0x1f29d5[_0x5de0('0x3e')];this[_0x5de0('0x26')][_0x1f29d5['uniqueid']][_0x3f6288]['connectedlinenum']=_0x1f29d5['connectedlinenum'];this[_0x5de0('0x26')][_0x1f29d5['uniqueid']][_0x3f6288][_0x5de0('0x3f')]=_0x1f29d5[_0x5de0('0x3f')];this[_0x5de0('0x26')][_0x1f29d5[_0x5de0('0x21')]][_0x3f6288][_0x5de0('0x40')]=_0x1f29d5['destchannelstatedesc'];this['channels'][_0x1f29d5[_0x5de0('0x21')]][_0x3f6288]['holdtime']=_0x1f29d5['holdtime'];this[_0x5de0('0x26')][_0x1f29d5[_0x5de0('0x21')]][_0x3f6288][_0x5de0('0x41')]='connect';_['merge'](this[_0x5de0('0xb')][_0x1f29d5[_0x5de0('0x42')]],_[_0x5de0('0x43')](_0x1f29d5,['queue',_0x5de0('0x44')]));logger['debug'](_0x5de0('0x45'),_0x1f29d5[_0x5de0('0x21')],util['inspect'](this['channels'][_0x1f29d5[_0x5de0('0x21')]][_0x1f29d5['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x5de0('0x1c')](_0x5de0('0x46'),this[_0x5de0('0x26')][_0x1f29d5['uniqueid']][_0x1f29d5[_0x5de0('0x22')]]);logger[_0x5de0('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x1f29d5[_0x5de0('0x21')],util['inspect'](this['channels'][_0x1f29d5[_0x5de0('0x21')]][_0x1f29d5[_0x5de0('0x22')]],{'showHidden':![],'depth':null}));this[_0x5de0('0x1c')](util['format']('user:%s',_0x1f29d5[_0x5de0('0x35')]),'user:agentconnect',this[_0x5de0('0x26')][_0x1f29d5[_0x5de0('0x21')]][_0x1f29d5[_0x5de0('0x22')]]);}else if(!this['channels'][_0x1f29d5[_0x5de0('0x21')]][_0x3f6288][_0x5de0('0x47')]&&!this[_0x5de0('0x26')][_0x1f29d5[_0x5de0('0x21')]][_0x3f6288][_0x5de0('0x13')]){logger['info'](_0x5de0('0x48'),_0x1f29d5[_0x5de0('0x21')],this[_0x5de0('0x26')][_0x1f29d5[_0x5de0('0x21')]][_0x3f6288]['membername'],_0x3f6288);this[_0x5de0('0x26')][_0x1f29d5[_0x5de0('0x21')]][_0x3f6288][_0x5de0('0x47')]=!![];this['channels'][_0x1f29d5[_0x5de0('0x21')]][_0x3f6288][_0x5de0('0x49')]=moment()[_0x5de0('0x27')](_0x5de0('0x28'));this[_0x5de0('0x26')][_0x1f29d5[_0x5de0('0x21')]][_0x3f6288][_0x5de0('0x4a')]=_0x1f29d5[_0x5de0('0x22')];this['channels'][_0x1f29d5[_0x5de0('0x21')]][_0x3f6288][_0x5de0('0x4b')]=_0x1f29d5['membername'];this[_0x5de0('0x26')][_0x1f29d5[_0x5de0('0x21')]][_0x3f6288][_0x5de0('0x41')]=_0x5de0('0x4c');this[_0x5de0('0x26')][_0x1f29d5[_0x5de0('0x21')]][_0x3f6288]['reason']=_0x5de0('0x4c');logger[_0x5de0('0x23')](_0x5de0('0x4d'),_0x1f29d5[_0x5de0('0x21')],util[_0x5de0('0x25')](this['channels'][_0x1f29d5['uniqueid']][_0x3f6288],{'showHidden':![],'depth':null}));ami[_0x5de0('0x1c')](_0x5de0('0x4e'),this[_0x5de0('0x26')][_0x1f29d5[_0x5de0('0x21')]][_0x3f6288]);}}}}}}catch(_0x127d8f){logger[_0x5de0('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x1f29d5[_0x5de0('0x21')],util[_0x5de0('0x25')](_0x127d8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5de0('0x1d')][_0x5de0('0x10')]=function(_0x41a78e){try{if(this[_0x5de0('0x1e')](_0x41a78e)){logger[_0x5de0('0x23')](_0x5de0('0x4f'),_0x41a78e[_0x5de0('0x21')],util['inspect'](_0x41a78e,{'showHidden':![],'depth':null}));if(this[_0x5de0('0x26')][_0x41a78e[_0x5de0('0x21')]]&&this[_0x5de0('0x26')][_0x41a78e[_0x5de0('0x21')]][_0x41a78e[_0x5de0('0x22')]]){logger['info']('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x41a78e['uniqueid'],_0x41a78e['membername'],_0x41a78e[_0x5de0('0x22')]);this['channels'][_0x41a78e[_0x5de0('0x21')]][_0x41a78e[_0x5de0('0x22')]][_0x5de0('0x47')]=!![];this[_0x5de0('0x26')][_0x41a78e[_0x5de0('0x21')]][_0x41a78e['destuniqueid']]['agentringnoanswerAt']=moment()[_0x5de0('0x27')](_0x5de0('0x28'));this[_0x5de0('0x26')][_0x41a78e[_0x5de0('0x21')]][_0x41a78e[_0x5de0('0x22')]][_0x5de0('0x41')]='rejected';this[_0x5de0('0x26')][_0x41a78e[_0x5de0('0x21')]][_0x41a78e[_0x5de0('0x22')]][_0x5de0('0x50')]=_0x5de0('0x51');logger[_0x5de0('0x23')](_0x5de0('0x52'),_0x41a78e['uniqueid'],util['inspect'](this[_0x5de0('0x26')][_0x41a78e[_0x5de0('0x21')]][_0x41a78e['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x5de0('0x53'),this[_0x5de0('0x26')][_0x41a78e[_0x5de0('0x21')]][_0x41a78e['destuniqueid']]);}}}catch(_0x5582c3){logger['error'](_0x5de0('0x54'),_0x41a78e['uniqueid'],util[_0x5de0('0x25')](_0x5582c3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5de0('0x1d')]['syncQueueCallerAbandon']=function(_0x217477){try{if(this[_0x5de0('0x1e')](_0x217477)){logger[_0x5de0('0x23')](_0x5de0('0x55'),_0x217477[_0x5de0('0x21')],util[_0x5de0('0x25')](_0x217477,{'showHidden':![],'depth':null}));if(this[_0x5de0('0x26')][_0x217477[_0x5de0('0x21')]]){for(var _0x2cb976 in this[_0x5de0('0x26')][_0x217477['uniqueid']]){if(this[_0x5de0('0x26')][_0x217477[_0x5de0('0x21')]][_0x5de0('0x3b')](_0x2cb976)&&!this[_0x5de0('0x26')][_0x217477[_0x5de0('0x21')]][_0x2cb976][_0x5de0('0x47')]&&!this[_0x5de0('0x26')][_0x217477[_0x5de0('0x21')]][_0x2cb976][_0x5de0('0x13')]){logger[_0x5de0('0x20')](_0x5de0('0x56'),_0x217477[_0x5de0('0x21')],this[_0x5de0('0x26')][_0x217477[_0x5de0('0x21')]][_0x2cb976][_0x5de0('0x35')],_0x2cb976);this[_0x5de0('0x26')][_0x217477[_0x5de0('0x21')]][_0x2cb976][_0x5de0('0x47')]=!![];this[_0x5de0('0x26')][_0x217477[_0x5de0('0x21')]][_0x2cb976][_0x5de0('0x49')]=moment()[_0x5de0('0x27')](_0x5de0('0x28'));this[_0x5de0('0x26')][_0x217477['uniqueid']][_0x2cb976][_0x5de0('0x41')]=_0x5de0('0x57');this[_0x5de0('0x26')][_0x217477[_0x5de0('0x21')]][_0x2cb976][_0x5de0('0x50')]=_0x5de0('0x57');logger['debug']('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x217477[_0x5de0('0x21')],util[_0x5de0('0x25')](this['channels'][_0x217477[_0x5de0('0x21')]][_0x2cb976],{'showHidden':![],'depth':null}));ami[_0x5de0('0x1c')]('custom:agentqueuecallerabandon',this[_0x5de0('0x26')][_0x217477[_0x5de0('0x21')]][_0x2cb976]);}}}}}catch(_0x40e641){logger[_0x5de0('0x37')](_0x5de0('0x58'),_0x217477[_0x5de0('0x21')],util['inspect'](_0x40e641,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x5de0('0x59')]=function(_0x17d987){try{if(this[_0x5de0('0x1e')](_0x17d987)){logger['debug'](_0x5de0('0x5a'),_0x17d987[_0x5de0('0x21')],util['inspect'](_0x17d987,{'showHidden':![],'depth':null}));if(this[_0x5de0('0x26')][_0x17d987[_0x5de0('0x21')]]){for(var _0x151b6b in this['channels'][_0x17d987[_0x5de0('0x21')]]){if(this['channels'][_0x17d987['uniqueid']][_0x5de0('0x3b')](_0x151b6b)){if(this['channels'][_0x17d987['uniqueid']][_0x151b6b][_0x5de0('0x3d')]&&!this[_0x5de0('0x26')][_0x17d987['uniqueid']][_0x151b6b]['agentcomplete']){logger[_0x5de0('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x17d987[_0x5de0('0x21')],this['channels'][_0x17d987['uniqueid']][_0x151b6b][_0x5de0('0x35')],_0x151b6b);this[_0x5de0('0x26')][_0x17d987[_0x5de0('0x21')]][_0x151b6b][_0x5de0('0x13')]=!![];this[_0x5de0('0x26')][_0x17d987[_0x5de0('0x21')]][_0x151b6b][_0x5de0('0x5b')]=moment()[_0x5de0('0x27')](_0x5de0('0x28'));this[_0x5de0('0x26')][_0x17d987[_0x5de0('0x21')]][_0x151b6b]['lastevent']=_0x5de0('0x5c');this['channels'][_0x17d987[_0x5de0('0x21')]][_0x151b6b][_0x5de0('0x50')]=_0x17d987['reason']==_0x5de0('0x5d')?_0x5de0('0x5e'):_0x17d987[_0x5de0('0x50')];this['channels'][_0x17d987[_0x5de0('0x21')]][_0x151b6b][_0x5de0('0x5f')]=_0x17d987['talktime'];if(this[_0x5de0('0xa')][_0x17d987[_0x5de0('0x2a')]]&&this['voiceQueues'][_0x17d987[_0x5de0('0x2a')]][_0x5de0('0x60')]){this[_0x5de0('0x26')][_0x17d987[_0x5de0('0x21')]][_0x151b6b][_0x5de0('0x61')]=this[_0x5de0('0xa')][_0x17d987[_0x5de0('0x2a')]][_0x5de0('0x62')];this[_0x5de0('0x26')][_0x17d987[_0x5de0('0x21')]][_0x151b6b][_0x5de0('0x63')]=!![];}this['agents'][_0x17d987[_0x5de0('0x42')]]=_[_0x5de0('0x2f')](this['agents'][_0x17d987[_0x5de0('0x42')]],[_0x5de0('0x2a'),_0x5de0('0x44')]);logger[_0x5de0('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x17d987[_0x5de0('0x21')],util[_0x5de0('0x25')](this[_0x5de0('0x26')][_0x17d987[_0x5de0('0x21')]][_0x151b6b],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x5de0('0x26')][_0x17d987[_0x5de0('0x21')]][_0x151b6b]);logger['debug'](_0x5de0('0x64'),_0x17d987[_0x5de0('0x21')],util[_0x5de0('0x25')](this[_0x5de0('0x26')][_0x17d987['uniqueid']][_0x151b6b],{'showHidden':![],'depth':null}));this['emit'](util[_0x5de0('0x27')](_0x5de0('0x65'),_0x17d987[_0x5de0('0x35')]),_0x5de0('0x66'),this[_0x5de0('0x26')][_0x17d987[_0x5de0('0x21')]][_0x151b6b]);}}}}}}catch(_0x3aa28e){logger[_0x5de0('0x37')](_0x5de0('0x67'),_0x17d987['uniqueid'],util['inspect'](_0x3aa28e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5de0('0x1d')][_0x5de0('0x68')]=function(_0x24cf3c){try{if(this[_0x5de0('0x1e')](_0x24cf3c)){logger[_0x5de0('0x23')](_0x5de0('0x69'),_0x24cf3c[_0x5de0('0x21')],util[_0x5de0('0x25')](_0x24cf3c,{'showHidden':![],'depth':null}));this[_0x5de0('0x6a')](_0x24cf3c['uniqueid'],_['keys'](_0x24cf3c[_0x5de0('0x6b')])[0x0],_0x24cf3c['value']);if(this[_0x5de0('0x26')][_0x24cf3c[_0x5de0('0x21')]]){for(var _0x44bbb8 in this[_0x5de0('0x26')][_0x24cf3c[_0x5de0('0x21')]]){if(this[_0x5de0('0x26')][_0x24cf3c['uniqueid']][_0x5de0('0x3b')](_0x44bbb8)){logger[_0x5de0('0x20')](_0x5de0('0x6c'),_0x24cf3c[_0x5de0('0x21')],_0x44bbb8,_[_0x5de0('0x6d')](_0x24cf3c[_0x5de0('0x6b')])[0x0],_0x24cf3c[_0x5de0('0x6e')]);if(_[_0x5de0('0x1f')](this[_0x5de0('0x26')][_0x24cf3c[_0x5de0('0x21')]][_0x44bbb8][_0x5de0('0xc')])){this[_0x5de0('0x26')][_0x24cf3c['uniqueid']][_0x44bbb8][_0x5de0('0xc')]={};}this['channels'][_0x24cf3c[_0x5de0('0x21')]][_0x44bbb8]['variables']=this[_0x5de0('0xc')][_0x24cf3c['uniqueid']];}}}}}catch(_0x30a9c6){logger['error'](_0x5de0('0x6f'),_0x24cf3c[_0x5de0('0x21')],util[_0x5de0('0x25')](_0x30a9c6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5de0('0x1d')][_0x5de0('0x6a')]=function(_0x94ef10,_0x17dd9b,_0x4d643c){var _0x22de92=['rtpaudioqos',_0x5de0('0x70'),_0x5de0('0x71'),_0x5de0('0x72'),_0x5de0('0x73'),'rtpaudioqoslossbridged',_0x5de0('0x74'),_0x5de0('0x75'),_0x5de0('0x76'),_0x5de0('0x77'),'bridgepeer','bridgepvtcallid',_0x5de0('0x78'),_0x5de0('0x79'),_0x5de0('0x7a'),_0x5de0('0x7b'),'membername','memberpenalty',_0x5de0('0x7c')];if(!_[_0x5de0('0x7d')](_0x17dd9b)&&!_[_0x5de0('0x7e')](_0x22de92,_0x17dd9b)){if(_[_0x5de0('0x1f')](this[_0x5de0('0xc')][_0x94ef10])){this[_0x5de0('0xc')][_0x94ef10]={};}this['variables'][_0x94ef10][_0x17dd9b]=_0x4d643c;}};VoiceAgentReport[_0x5de0('0x1d')][_0x5de0('0x15')]=function(_0xf528fe){try{if(this[_0x5de0('0x1e')](_0xf528fe)){logger[_0x5de0('0x23')](_0x5de0('0x7f'),_0xf528fe[_0x5de0('0x21')],util['inspect'](_0xf528fe,{'showHidden':![],'depth':null}));if(this['channels'][_0xf528fe['uniqueid']]){for(var _0x205958 in this[_0x5de0('0x26')][_0xf528fe[_0x5de0('0x21')]]){if(this[_0x5de0('0x26')][_0xf528fe[_0x5de0('0x21')]]['hasOwnProperty'](_0x205958)){if(this['channels'][_0xf528fe[_0x5de0('0x21')]][_0x205958][_0x5de0('0x50')]==_0x5de0('0x5d')&&this['channels'][_0xf528fe[_0x5de0('0x21')]][_0x205958]['agentcomplete']){logger[_0x5de0('0x20')](_0x5de0('0x80'),_0xf528fe[_0x5de0('0x21')],_0x205958);this[_0x5de0('0x26')][_0xf528fe[_0x5de0('0x21')]][_0x205958][_0x5de0('0x5b')]=moment()[_0x5de0('0x27')](_0x5de0('0x28'));}}}logger[_0x5de0('0x23')](_0x5de0('0x81'),_0xf528fe[_0x5de0('0x21')],util[_0x5de0('0x25')](_[_0x5de0('0x82')](this['channels'][_0xf528fe[_0x5de0('0x21')]]),{'showHidden':![],'depth':null}));ami['emit'](_0x5de0('0x83'),_[_0x5de0('0x82')](this['channels'][_0xf528fe['uniqueid']]));delete this[_0x5de0('0x26')][_0xf528fe[_0x5de0('0x21')]];}if(this[_0x5de0('0xc')][_0xf528fe[_0x5de0('0x21')]]){delete this[_0x5de0('0xc')][_0xf528fe['uniqueid']];}}}catch(_0x47a5a1){logger[_0x5de0('0x37')](_0x5de0('0x84'),_0xf528fe['uniqueid'],util['inspect'](_0x47a5a1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5de0('0x1d')][_0x5de0('0x1a')]=function(_0x1bb069){try{if(this[_0x5de0('0x1e')](_0x1bb069)){logger[_0x5de0('0x23')](_0x5de0('0x85'),_0x1bb069[_0x5de0('0x21')],util['inspect'](_0x1bb069,{'showHidden':![],'depth':null}));if(this[_0x5de0('0x26')][_0x1bb069[_0x5de0('0x86')]]){for(var _0x102d58 in this['channels'][_0x1bb069['transfereeuniqueid']]){if(this['channels'][_0x1bb069[_0x5de0('0x86')]]['hasOwnProperty'](_0x102d58)){if(_0x1bb069[_0x5de0('0x87')]===_0x102d58){logger[_0x5de0('0x20')](_0x5de0('0x88'),_0x1bb069[_0x5de0('0x21')],this[_0x5de0('0x26')][_0x1bb069[_0x5de0('0x86')]][_0x102d58]['membername'],_0x102d58);var _0xa14d55=moment();this[_0x5de0('0x26')][_0x1bb069[_0x5de0('0x86')]][_0x102d58][_0x5de0('0x13')]=!![];this[_0x5de0('0x26')][_0x1bb069[_0x5de0('0x86')]][_0x102d58][_0x5de0('0x5b')]=moment()[_0x5de0('0x27')](_0x5de0('0x28'));this[_0x5de0('0x26')][_0x1bb069[_0x5de0('0x86')]][_0x102d58][_0x5de0('0x41')]=_0x5de0('0x5c');this[_0x5de0('0x26')][_0x1bb069[_0x5de0('0x86')]][_0x102d58]['reason']=_0x5de0('0x5d');this['channels'][_0x1bb069['transfereeuniqueid']][_0x102d58][_0x5de0('0x5f')]=_0xa14d55['diff'](this[_0x5de0('0x26')][_0x1bb069[_0x5de0('0x86')]][_0x102d58][_0x5de0('0x3d')],_0x5de0('0x89'));}}}}if(this[_0x5de0('0x26')][_0x1bb069['secondtransfereruniqueid']]){var _0x32cfcd=this[_0x5de0('0x26')][_0x1bb069['secondtransfereruniqueid']];this['channels'][_0x1bb069[_0x5de0('0x8a')]]=this[_0x5de0('0x26')][_0x1bb069['transfereeuniqueid']];this['channels'][_0x1bb069[_0x5de0('0x86')]]=_0x32cfcd;}}}catch(_0x284b65){logger[_0x5de0('0x37')]('[%s][voiceAgentReport][attendedtransfer]',_0x1bb069[_0x5de0('0x21')],util[_0x5de0('0x25')](_0x284b65,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x5de0('0x8b')]=function(_0x6d3ec){try{if(this['isNotNull'](_0x6d3ec)){logger['debug'](_0x5de0('0x8c'),_0x6d3ec['uniqueid'],util['inspect'](_0x6d3ec,{'showHidden':![],'depth':null}));if(this[_0x5de0('0x26')][_0x6d3ec[_0x5de0('0x86')]]){for(var _0x51be48 in this[_0x5de0('0x26')][_0x6d3ec['transfereeuniqueid']]){if(this[_0x5de0('0x26')][_0x6d3ec[_0x5de0('0x86')]][_0x5de0('0x3b')](_0x51be48)){if(_0x6d3ec[_0x5de0('0x8d')]===_0x51be48){logger[_0x5de0('0x20')](_0x5de0('0x8e'),_0x6d3ec[_0x5de0('0x21')],this[_0x5de0('0x26')][_0x6d3ec[_0x5de0('0x86')]][_0x51be48][_0x5de0('0x35')],_0x51be48);var _0x2b732f=moment();this[_0x5de0('0x26')][_0x6d3ec[_0x5de0('0x86')]][_0x51be48][_0x5de0('0x13')]=!![];this[_0x5de0('0x26')][_0x6d3ec[_0x5de0('0x86')]][_0x51be48][_0x5de0('0x5b')]=_0x2b732f;this[_0x5de0('0x26')][_0x6d3ec[_0x5de0('0x86')]][_0x51be48][_0x5de0('0x41')]='complete';this[_0x5de0('0x26')][_0x6d3ec[_0x5de0('0x86')]][_0x51be48][_0x5de0('0x50')]=_0x5de0('0x5d');this['channels'][_0x6d3ec['transfereeuniqueid']][_0x51be48]['talktime']=_0x2b732f['diff'](this[_0x5de0('0x26')][_0x6d3ec['transfereeuniqueid']][_0x51be48][_0x5de0('0x3d')],_0x5de0('0x89'));}}}}}}catch(_0xe61578){logger[_0x5de0('0x37')]('[%s][voiceAgentReport][blindtransfer]',_0x6d3ec[_0x5de0('0x21')],util['inspect'](_0xe61578,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0x4eb37a){var _0x4f29dd='';try{if(this[_0x5de0('0x1e')](_0x4eb37a)){logger[_0x5de0('0x23')](_0x5de0('0x8f'),_0x4eb37a[_0x5de0('0x21')],util[_0x5de0('0x25')](_0x4eb37a,{'showHidden':![],'depth':null}));if(_0x4eb37a[_0x5de0('0x90')]){_0x4f29dd=_0x4eb37a[_0x5de0('0x90')]['substring'](0x0,_0x4eb37a[_0x5de0('0x90')][_0x5de0('0x91')]('-'));if(this[_0x5de0('0xb')][_0x4f29dd]){logger[_0x5de0('0x20')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x4eb37a['uniqueid'],_0x4f29dd);this[_0x5de0('0xb')][_0x4f29dd][_0x5de0('0x92')]=!![];}}}}catch(_0x3a77d0){logger[_0x5de0('0x37')]('[%s][voiceAgentReport][musiconholdstart]',_0x4eb37a[_0x5de0('0x21')],util[_0x5de0('0x25')](_0x3a77d0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5de0('0x1d')]['syncMusicOnHoldStop']=function(_0x1f2dcf){var _0x5d3d94='';try{if(this[_0x5de0('0x1e')](_0x1f2dcf)){logger['debug'](_0x5de0('0x93'),_0x1f2dcf[_0x5de0('0x21')],util[_0x5de0('0x25')](_0x1f2dcf,{'showHidden':![],'depth':null}));if(_0x1f2dcf['channel']){_0x5d3d94=_0x1f2dcf[_0x5de0('0x90')][_0x5de0('0x94')](0x0,_0x1f2dcf[_0x5de0('0x90')][_0x5de0('0x91')]('-'));if(this[_0x5de0('0xb')][_0x5d3d94]){logger[_0x5de0('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x1f2dcf['uniqueid'],_0x5d3d94);this[_0x5de0('0xb')][_0x5d3d94][_0x5de0('0x92')]=![];}}}}catch(_0x5e65b0){logger['error'](_0x5de0('0x95'),_0x1f2dcf[_0x5de0('0x21')],util['inspect'](_0x5e65b0,{'showHidden':![],'depth':null}));}};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 600925c..eedc4df 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 _0x28bc=['from-sip','channel','split','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','includes','lastapplication','lastdata','startsWith','cdr(','match','queue','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','holdtime','diff','connectedlinenum','destinationchannel','disposition','toNumber','UserId','membername','[%s][voiceCallReport][newstate]','monitor','endsWith','.wav49','replace','.WAV','find','isNil','push','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','syncMixMonitorFilename','xmd-phone','xmd-callerid','callerid','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','billableseconds','answertime','omit','destconnectedlinenum','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','transferType','undefined','getSettings','stopRecordingOnTransfer','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','blindTransfers','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','origtransfererlinkedid','some','outbound','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','transfereecalleridnum','BLIND','transfererchannel','[%s][voiceCallReport][blindtransfer]','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/logger','ami','../ami','unknown','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','localhost','redis','channels','agents','coreshowchannel','bind','newexten','syncNewExten','newchannel','syncNewChannel','newstate','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','uniqueid','linkedid','merge','pick','keys','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','format','YYYY-MM-DD\x20HH:mm:ss','channelstate'];(function(_0xe50e1,_0x30bf72){var _0x441f9a=function(_0x40ac92){while(--_0x40ac92){_0xe50e1['push'](_0xe50e1['shift']());}};_0x441f9a(++_0x30bf72);}(_0x28bc,0x79));var _0xc28b=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0x28bc[_0x3b96cf];return _0x2e315a;};'use strict';var BPromise=require(_0xc28b('0x0'));var _=require(_0xc28b('0x1'));var moment=require(_0xc28b('0x2'));var util=require(_0xc28b('0x3'));var path=require(_0xc28b('0x4'));var Redis=require(_0xc28b('0x5'));var config=require('../../../config/environment');var logger=require(_0xc28b('0x6'))(_0xc28b('0x7'));var ami=require(_0xc28b('0x8'));var Channel=require('../model/channel');var RpcSetting=require('../rpc/setting');var statusDesc=[_0xc28b('0x9'),'not_inuse',_0xc28b('0xa'),_0xc28b('0xb'),_0xc28b('0xc'),_0xc28b('0xd'),_0xc28b('0xe'),_0xc28b('0xf'),_0xc28b('0x10')];var applications=[_0xc28b('0x11'),'queue',_0xc28b('0x12'),_0xc28b('0x13'),_0xc28b('0x14'),_0xc28b('0x15')];var dispositions=[_0xc28b('0x16'),_0xc28b('0x17'),_0xc28b('0x17'),_0xc28b('0x16'),'NO\x20ANSWER',_0xc28b('0x16'),_0xc28b('0x18'),_0xc28b('0x19'),'FAILED',_0xc28b('0x17'),'FAILED'];var actions={};config['redis']=_[_0xc28b('0x1a')](config['redis'],{'host':_0xc28b('0x1b'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc28b('0x1c')]));function VoiceCallReport(_0x284f4e){this[_0xc28b('0x1d')]=_0x284f4e[_0xc28b('0x1d')];this['agents']=_0x284f4e[_0xc28b('0x1e')];this['blindTransfers']={};ami['on'](_0xc28b('0x1f'),this['syncNewExten'][_0xc28b('0x20')](this));ami['on'](_0xc28b('0x21'),this[_0xc28b('0x22')][_0xc28b('0x20')](this));ami['on'](_0xc28b('0x23'),this[_0xc28b('0x24')][_0xc28b('0x20')](this));ami['on'](_0xc28b('0x25'),this['syncNewState'][_0xc28b('0x20')](this));ami['on'](_0xc28b('0x26'),this[_0xc28b('0x27')]['bind'](this));ami['on'](_0xc28b('0x28'),this[_0xc28b('0x29')][_0xc28b('0x20')](this));ami['on'](_0xc28b('0x2a'),this[_0xc28b('0x2b')]['bind'](this));ami['on'](_0xc28b('0x2c'),this[_0xc28b('0x2d')]['bind'](this));ami['on'](_0xc28b('0x2e'),this[_0xc28b('0x2f')][_0xc28b('0x20')](this));ami['on'](_0xc28b('0x30'),this[_0xc28b('0x31')][_0xc28b('0x20')](this));ami['on'](_0xc28b('0x32'),this[_0xc28b('0x33')][_0xc28b('0x20')](this));try{logger[_0xc28b('0x34')](_0xc28b('0x35'));ami[_0xc28b('0x36')]();}catch(_0x1a1365){logger[_0xc28b('0x37')](_0xc28b('0x38'),util[_0xc28b('0x39')](_0x1a1365,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xc28b('0x3a')][_0xc28b('0x3b')]=function(_0x1bf1e1){return _0x1bf1e1!==null&&!_[_0xc28b('0x3c')](_0x1bf1e1);};VoiceCallReport[_0xc28b('0x3a')][_0xc28b('0x3d')]=function(_0x2ef6fb,_0xd8f547,_0x3ae598){io['to'](_0x2ef6fb)[_0xc28b('0x3d')](_0xd8f547,_0x3ae598);};VoiceCallReport[_0xc28b('0x3a')][_0xc28b('0x2b')]=function(_0x13ca00){try{if(this['isNotNull'](_0x13ca00)){logger[_0xc28b('0x34')](_0xc28b('0x3e'),_0x13ca00['uniqueid'],_0x13ca00[_0xc28b('0x3f')],_0x13ca00[_0xc28b('0x40')]);logger[_0xc28b('0x41')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x13ca00[_0xc28b('0x42')],util[_0xc28b('0x39')](_0x13ca00,{'showHidden':![],'depth':null}));if(_0x13ca00[_0xc28b('0x42')]===_0x13ca00[_0xc28b('0x43')]){if(!_[_0xc28b('0x3c')](this['channels'][_0x13ca00[_0xc28b('0x42')]])){_[_0xc28b('0x44')](this[_0xc28b('0x1d')][_0x13ca00[_0xc28b('0x42')]],_[_0xc28b('0x45')](_0x13ca00,_[_0xc28b('0x46')](this[_0xc28b('0x1d')][_0x13ca00[_0xc28b('0x42')]])));}}}}catch(_0x14a7ed){logger['error'](_0xc28b('0x47'),_0x13ca00['uniqueid'],util[_0xc28b('0x39')](_0x14a7ed,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc28b('0x3a')]['syncNewChannel']=function(_0x3b5396){try{if(this[_0xc28b('0x3b')](_0x3b5396)){logger['debug'](_0xc28b('0x48'),_0x3b5396[_0xc28b('0x42')],util[_0xc28b('0x39')](_0x3b5396,{'showHidden':![],'depth':null}));if(_0x3b5396[_0xc28b('0x42')]===_0x3b5396[_0xc28b('0x43')]&&_0x3b5396['channel']!=_0xc28b('0x49')){if(_[_0xc28b('0x3c')](this[_0xc28b('0x1d')][_0x3b5396[_0xc28b('0x42')]])){logger['info'](_0xc28b('0x4a'),_0x3b5396['uniqueid'],_0x3b5396[_0xc28b('0x4b')],_0x3b5396[_0xc28b('0x4c')]);this[_0xc28b('0x1d')][_0x3b5396[_0xc28b('0x42')]]=new Channel();this[_0xc28b('0x1d')][_0x3b5396[_0xc28b('0x42')]]['starttime']=moment()[_0xc28b('0x4d')](_0xc28b('0x4e'));this[_0xc28b('0x1d')][_0x3b5396[_0xc28b('0x42')]]['disposition']=dispositions[_['toNumber'](_0x3b5396[_0xc28b('0x4f')])];_[_0xc28b('0x44')](this[_0xc28b('0x1d')][_0x3b5396[_0xc28b('0x42')]],_['pick'](_0x3b5396,_[_0xc28b('0x46')](this[_0xc28b('0x1d')][_0x3b5396['uniqueid']])));if(_0x3b5396['context']===_0xc28b('0x50')){if(this[_0xc28b('0x1e')][_0x3b5396[_0xc28b('0x51')][_0xc28b('0x52')]('-')[0x0]]){this[_0xc28b('0x1e')][_0x3b5396['channel'][_0xc28b('0x52')]('-')[0x0]]['destconnectedlinenum']=_0x3b5396[_0xc28b('0x4c')];logger[_0xc28b('0x41')](_0xc28b('0x53'),_0x3b5396[_0xc28b('0x42')],util['inspect']({'destaccountcode':this[_0xc28b('0x1e')][_0x3b5396[_0xc28b('0x51')][_0xc28b('0x52')]('-')[0x0]][_0xc28b('0x54')],'destconnectedlinenum':_0x3b5396['exten']},{'showHidden':![],'depth':null}));this[_0xc28b('0x3d')](util[_0xc28b('0x4d')]('user:%s',this[_0xc28b('0x1e')][_0x3b5396[_0xc28b('0x51')]['split']('-')[0x0]][_0xc28b('0x55')]),_0xc28b('0x56'),{'destaccountcode':this[_0xc28b('0x1e')][_0x3b5396[_0xc28b('0x51')][_0xc28b('0x52')]('-')[0x0]][_0xc28b('0x54')],'destconnectedlinenum':_0x3b5396['exten']});}}}}}}catch(_0x441e58){logger[_0xc28b('0x37')](_0xc28b('0x57'),_0x3b5396[_0xc28b('0x42')],util[_0xc28b('0x39')](_0x441e58,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc28b('0x3a')][_0xc28b('0x22')]=function(_0x5e53c1){try{if(this[_0xc28b('0x3b')](_0x5e53c1)){logger[_0xc28b('0x41')](_0xc28b('0x58'),_0x5e53c1[_0xc28b('0x42')],util[_0xc28b('0x39')](_0x5e53c1,{'showHidden':![],'depth':null}));if(_0x5e53c1[_0xc28b('0x42')]===_0x5e53c1[_0xc28b('0x43')]&&_0x5e53c1[_0xc28b('0x4c')]!='h'&&_0x5e53c1[_0xc28b('0x51')]!='OutgoingSpoolFailed'){_0x5e53c1[_0xc28b('0x59')]=_0x5e53c1[_0xc28b('0x59')][_0xc28b('0x5a')]();_0x5e53c1[_0xc28b('0x5b')]=(_0x5e53c1[_0xc28b('0x5c')]||_0x5e53c1[_0xc28b('0x5b')])[_0xc28b('0x5a')]();logger[_0xc28b('0x34')](_0xc28b('0x5d'),_0x5e53c1[_0xc28b('0x42')],_0x5e53c1[_0xc28b('0x59')],_0x5e53c1[_0xc28b('0x5b')]);if(_[_0xc28b('0x3c')](this[_0xc28b('0x1d')][_0x5e53c1[_0xc28b('0x42')]])){this['channels'][_0x5e53c1['uniqueid']]=new Channel();this['channels'][_0x5e53c1[_0xc28b('0x42')]][_0xc28b('0x5e')]=_0x5e53c1[_0xc28b('0x5f')]?moment()[_0xc28b('0x60')](moment[_0xc28b('0x5f')](_0x5e53c1[_0xc28b('0x5f')])[_0xc28b('0x61')](),'seconds')[_0xc28b('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xc28b('0x1d')][_0x5e53c1[_0xc28b('0x42')]]['disposition']=_0xc28b('0x16');}_[_0xc28b('0x44')](this[_0xc28b('0x1d')][_0x5e53c1[_0xc28b('0x42')]],_[_0xc28b('0x45')](_0x5e53c1,_[_0xc28b('0x46')](this['channels'][_0x5e53c1['uniqueid']])));if(_[_0xc28b('0x62')](applications,_0x5e53c1[_0xc28b('0x59')])){this['channels'][_0x5e53c1[_0xc28b('0x42')]][_0xc28b('0x63')]=_0x5e53c1[_0xc28b('0x59')];this['channels'][_0x5e53c1[_0xc28b('0x42')]][_0xc28b('0x64')]=_0x5e53c1[_0xc28b('0x5b')];if(_0x5e53c1[_0xc28b('0x59')]===_0xc28b('0x11')&&_[_0xc28b('0x65')](_0x5e53c1['applicationdata'],_0xc28b('0x66'))){var _0x4b0e28=_0x5e53c1[_0xc28b('0x5b')][_0xc28b('0x52')]('=');var _0x1c06f7=_0x4b0e28[0x0][_0xc28b('0x67')](/cdr\((.*)\)/);if(_0x1c06f7){this[_0xc28b('0x1d')][_0x5e53c1['uniqueid']][_0x1c06f7[0x1]]=_0x4b0e28[0x1];}}else if(_0x5e53c1[_0xc28b('0x59')]===_0xc28b('0x68')){this[_0xc28b('0x1d')][_0x5e53c1['uniqueid']][_0xc28b('0x68')]=_0x5e53c1['applicationdata']['split'](',')[0x0];}}}}}catch(_0x434235){logger['error'](_0xc28b('0x69'),_0x5e53c1[_0xc28b('0x42')],util[_0xc28b('0x39')](_0x434235,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc28b('0x3a')][_0xc28b('0x6a')]=function(_0x2914a9){try{if(this[_0xc28b('0x3b')](_0x2914a9)){logger['info'](_0xc28b('0x6b'),_0x2914a9[_0xc28b('0x42')],_0x2914a9['linkedid'],_0x2914a9[_0xc28b('0x3f')],_0x2914a9['calleridnum']);logger[_0xc28b('0x41')]('[%s][voiceCallReport][newstate]\x20event:',_0x2914a9['uniqueid'],util[_0xc28b('0x39')](_0x2914a9,{'showHidden':![],'depth':null}));if(_0x2914a9[_0xc28b('0x42')]!==_0x2914a9['linkedid']){if(this['channels'][_0x2914a9[_0xc28b('0x43')]]){if(_0x2914a9[_0xc28b('0x4f')]==='6'){if(!this[_0xc28b('0x1d')][_0x2914a9[_0xc28b('0x43')]]['answered']){var _0x287d1e=moment();this[_0xc28b('0x1d')][_0x2914a9[_0xc28b('0x43')]][_0xc28b('0x6c')]=!![];this['channels'][_0x2914a9[_0xc28b('0x43')]]['answertime']=_0x287d1e[_0xc28b('0x4d')](_0xc28b('0x4e'));if(this[_0xc28b('0x1d')][_0x2914a9['linkedid']][_0xc28b('0x5e')]){this['channels'][_0x2914a9[_0xc28b('0x43')]][_0xc28b('0x6d')]=_0x287d1e[_0xc28b('0x6e')](this[_0xc28b('0x1d')][_0x2914a9[_0xc28b('0x43')]][_0xc28b('0x5e')],_0xc28b('0x61'));}}this[_0xc28b('0x1d')][_0x2914a9[_0xc28b('0x43')]][_0xc28b('0x43')]=_0x2914a9['uniqueid'];if(_0x2914a9[_0xc28b('0x40')]!=='xcally-motion-preview'){this[_0xc28b('0x1d')][_0x2914a9[_0xc28b('0x43')]][_0xc28b('0x6f')]=_0x2914a9[_0xc28b('0x40')];}this[_0xc28b('0x1d')][_0x2914a9[_0xc28b('0x43')]]['connectedlinename']=_0x2914a9[_0xc28b('0x3f')];this[_0xc28b('0x1d')][_0x2914a9[_0xc28b('0x43')]][_0xc28b('0x70')]=_0x2914a9[_0xc28b('0x51')];this['channels'][_0x2914a9[_0xc28b('0x43')]][_0xc28b('0x71')]=dispositions[_[_0xc28b('0x72')](_0x2914a9[_0xc28b('0x4f')])];if(this[_0xc28b('0x1e')][_0x2914a9[_0xc28b('0x51')][_0xc28b('0x52')]('-')[0x0]]){this[_0xc28b('0x1d')][_0x2914a9[_0xc28b('0x43')]][_0xc28b('0x73')]=this[_0xc28b('0x1e')][_0x2914a9[_0xc28b('0x51')]['split']('-')[0x0]]['id'];this[_0xc28b('0x1d')][_0x2914a9['linkedid']][_0xc28b('0x74')]=this[_0xc28b('0x1e')][_0x2914a9[_0xc28b('0x51')][_0xc28b('0x52')]('-')[0x0]][_0xc28b('0x55')];}}}}else{if(this[_0xc28b('0x1d')][_0x2914a9[_0xc28b('0x42')]]){if(_0x2914a9['channelstate']==='6'){if(this[_0xc28b('0x1e')][_0x2914a9[_0xc28b('0x51')][_0xc28b('0x52')]('-')[0x0]]){this['channels'][_0x2914a9[_0xc28b('0x42')]][_0xc28b('0x73')]=this[_0xc28b('0x1e')][_0x2914a9['channel']['split']('-')[0x0]]['id'];this[_0xc28b('0x1d')][_0x2914a9['uniqueid']][_0xc28b('0x74')]=this[_0xc28b('0x1e')][_0x2914a9[_0xc28b('0x51')][_0xc28b('0x52')]('-')[0x0]]['name'];}}}}}}catch(_0x5cdf0b){logger[_0xc28b('0x37')](_0xc28b('0x75'),_0x2914a9[_0xc28b('0x42')],util[_0xc28b('0x39')](_0x5cdf0b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc28b('0x3a')]['syncMixMonitorFilename']=function(_0x58b55d,_0x4f7fe8){try{if(this[_0xc28b('0x1d')][_0x58b55d]){logger[_0xc28b('0x34')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x58b55d,_0x4f7fe8);this[_0xc28b('0x1d')][_0x58b55d][_0xc28b('0x76')]=!![];if(_[_0xc28b('0x77')](_0x4f7fe8,_0xc28b('0x78'))){_0x4f7fe8=_0x4f7fe8[_0xc28b('0x79')](_0xc28b('0x78'),_0xc28b('0x7a'));}this[_0xc28b('0x1d')][_0x58b55d]['monitorFilename']=_0x4f7fe8;var _0x2a5a51=_[_0xc28b('0x7b')](this[_0xc28b('0x1d')][_0x58b55d]['monitors'],{'filename':_0x4f7fe8});if(_[_0xc28b('0x7c')](_0x2a5a51)){this[_0xc28b('0x1d')][_0x58b55d]['monitors'][_0xc28b('0x7d')]({'filename':_0x4f7fe8,'createdAt':moment()['format'](_0xc28b('0x4e')),'mixmonitorid':'','status':'rec'});}}}catch(_0x1d39f6){logger['error'](_0xc28b('0x7e'),_0x58b55d,util[_0xc28b('0x39')](_0x1d39f6,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xc28b('0x27')]=function(_0x150e1b){try{if(this[_0xc28b('0x3b')](_0x150e1b)){logger[_0xc28b('0x41')](_0xc28b('0x7f'),_0x150e1b['uniqueid'],util[_0xc28b('0x39')](_0x150e1b,{'showHidden':![],'depth':null}));if(this[_0xc28b('0x1d')][_0x150e1b[_0xc28b('0x42')]]&&_0x150e1b['channel']!=_0xc28b('0x49')){if(this['isNotNull'](_0x150e1b[_0xc28b('0x80')])){if(this[_0xc28b('0x3b')](_0x150e1b[_0xc28b('0x80')][_0xc28b('0x81')])){logger[_0xc28b('0x34')](_0xc28b('0x82'),_0x150e1b['uniqueid'],_0x150e1b[_0xc28b('0x83')]);this[_0xc28b('0x84')](_0x150e1b[_0xc28b('0x42')],_0x150e1b[_0xc28b('0x83')]);}else if(this[_0xc28b('0x3b')](_0x150e1b[_0xc28b('0x80')][_0xc28b('0x85')])){logger[_0xc28b('0x34')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x150e1b['uniqueid'],_0x150e1b[_0xc28b('0x83')]);this[_0xc28b('0x1d')][_0x150e1b[_0xc28b('0x42')]]['calleridnum']=_0x150e1b[_0xc28b('0x83')];}else if(this[_0xc28b('0x3b')](_0x150e1b[_0xc28b('0x80')][_0xc28b('0x86')])){logger[_0xc28b('0x34')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x150e1b['uniqueid'],_0x150e1b[_0xc28b('0x83')]);this[_0xc28b('0x1d')][_0x150e1b['uniqueid']][_0xc28b('0x87')]=_0x150e1b['value'];}else if(this[_0xc28b('0x3b')](_0x150e1b[_0xc28b('0x80')]['xmd-cdrtype'])){logger[_0xc28b('0x34')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x150e1b[_0xc28b('0x42')],_0x150e1b['value']);this[_0xc28b('0x1d')][_0x150e1b[_0xc28b('0x42')]][_0xc28b('0x88')]=_0x150e1b[_0xc28b('0x83')];}else if(this[_0xc28b('0x3b')](_0x150e1b[_0xc28b('0x80')][_0xc28b('0x89')])){logger['info'](_0xc28b('0x8a'),_0x150e1b[_0xc28b('0x42')],_0x150e1b['value']['split'](',')[0x0]);this[_0xc28b('0x1d')][_0x150e1b[_0xc28b('0x42')]][_0xc28b('0x68')]=_0x150e1b[_0xc28b('0x83')][_0xc28b('0x52')](',')[0x0];}else if(this[_0xc28b('0x3b')](_0x150e1b[_0xc28b('0x80')][_0xc28b('0x8b')])){logger[_0xc28b('0x34')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x150e1b[_0xc28b('0x42')],_0x150e1b[_0xc28b('0x83')]);this['channels'][_0x150e1b['uniqueid']][_0xc28b('0x8c')]=_0x150e1b[_0xc28b('0x83')];}else if(this[_0xc28b('0x3b')](_0x150e1b['variable']['xmd-destination'])){logger[_0xc28b('0x34')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x150e1b[_0xc28b('0x42')],_0x150e1b[_0xc28b('0x83')]);this[_0xc28b('0x1d')][_0x150e1b[_0xc28b('0x42')]][_0xc28b('0x8d')]=_0x150e1b[_0xc28b('0x83')];}else if(this[_0xc28b('0x3b')](_0x150e1b[_0xc28b('0x80')][_0xc28b('0x8e')])){logger[_0xc28b('0x34')](_0xc28b('0x8f'),_0x150e1b['uniqueid'],_0x150e1b[_0xc28b('0x83')]);this[_0xc28b('0x1d')][_0x150e1b[_0xc28b('0x42')]][_0xc28b('0x90')]=_0x150e1b[_0xc28b('0x83')];}else if(this[_0xc28b('0x3b')](_0x150e1b[_0xc28b('0x80')][_0xc28b('0x91')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x150e1b['uniqueid'],_0x150e1b[_0xc28b('0x83')]);this['channels'][_0x150e1b['uniqueid']]['queue']=_0x150e1b['value'];}else if(this['isNotNull'](_0x150e1b['variable']['sipcallid'])){logger[_0xc28b('0x34')](_0xc28b('0x92'),_0x150e1b[_0xc28b('0x42')],_0x150e1b['value']);this[_0xc28b('0x1d')][_0x150e1b[_0xc28b('0x42')]]['sipcalluniqueid']=_0x150e1b[_0xc28b('0x83')];}}}else if(this['isNotNull'](_0x150e1b[_0xc28b('0x80')]['mixmonitor_filename'])){if(_0x150e1b[_0xc28b('0x83')]){var _0x45dfcb=path['parse'](_0x150e1b[_0xc28b('0x83')])[_0xc28b('0x55')];logger['info'](_0xc28b('0x82'),_0x45dfcb,_0x150e1b['value']);this[_0xc28b('0x84')](_0x45dfcb,_0x150e1b[_0xc28b('0x83')]);}}else if(this[_0xc28b('0x1d')][_0x150e1b[_0xc28b('0x43')]]){if(this[_0xc28b('0x3b')](_0x150e1b[_0xc28b('0x80')])){if(this[_0xc28b('0x3b')](_0x150e1b['variable'][_0xc28b('0x93')])){logger['info'](_0xc28b('0x92'),_0x150e1b['linkedid'],_0x150e1b[_0xc28b('0x83')]);this[_0xc28b('0x1d')][_0x150e1b[_0xc28b('0x43')]][_0xc28b('0x94')]=_0x150e1b[_0xc28b('0x83')];}}}}}catch(_0x37e009){logger['error'](_0xc28b('0x95'),_0x150e1b[_0xc28b('0x42')],util[_0xc28b('0x39')](_0x37e009,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc28b('0x3a')][_0xc28b('0x29')]=function(_0xfa3f9a){try{if(this[_0xc28b('0x3b')](_0xfa3f9a)){logger[_0xc28b('0x41')](_0xc28b('0x96'),_0xfa3f9a['uniqueid'],util[_0xc28b('0x39')](_0xfa3f9a,{'showHidden':![],'depth':null}));if(this[_0xc28b('0x1d')][_0xfa3f9a[_0xc28b('0x42')]]){logger['info'](_0xc28b('0x97'),_0xfa3f9a[_0xc28b('0x42')],_0xfa3f9a[_0xc28b('0x98')]);var _0x2f4167=moment();this[_0xc28b('0x1d')][_0xfa3f9a['uniqueid']]['endtime']=_0x2f4167[_0xc28b('0x4d')](_0xc28b('0x4e'));this[_0xc28b('0x1d')][_0xfa3f9a[_0xc28b('0x42')]][_0xc28b('0x5f')]=_0x2f4167['diff'](this[_0xc28b('0x1d')][_0xfa3f9a['uniqueid']]['starttime'],'seconds');if(this[_0xc28b('0x1d')][_0xfa3f9a[_0xc28b('0x42')]][_0xc28b('0x6c')]){this[_0xc28b('0x1d')][_0xfa3f9a[_0xc28b('0x42')]][_0xc28b('0x99')]=_0x2f4167['diff'](this['channels'][_0xfa3f9a[_0xc28b('0x42')]][_0xc28b('0x9a')],_0xc28b('0x61'));this[_0xc28b('0x1d')][_0xfa3f9a[_0xc28b('0x42')]][_0xc28b('0x6d')]=this[_0xc28b('0x1d')][_0xfa3f9a['uniqueid']][_0xc28b('0x5f')]-this[_0xc28b('0x1d')][_0xfa3f9a[_0xc28b('0x42')]][_0xc28b('0x99')];}if(_0xfa3f9a[_0xc28b('0x4b')]===_0xc28b('0x50')){if(this['agents'][_0xfa3f9a[_0xc28b('0x51')]['split']('-')[0x0]]){this[_0xc28b('0x1e')][_0xfa3f9a[_0xc28b('0x51')]['split']('-')[0x0]]=_[_0xc28b('0x9b')](this['agents'][_0xfa3f9a[_0xc28b('0x51')][_0xc28b('0x52')]('-')[0x0]],[_0xc28b('0x9c')]);logger[_0xc28b('0x41')](_0xc28b('0x9d'),_0xfa3f9a[_0xc28b('0x42')],util['inspect']({'destaccountcode':this[_0xc28b('0x1e')][_0xfa3f9a['channel'][_0xc28b('0x52')]('-')[0x0]][_0xc28b('0x54')]},{'showHidden':![],'depth':null}));this[_0xc28b('0x3d')](util[_0xc28b('0x4d')]('user:%s',this[_0xc28b('0x1e')][_0xfa3f9a[_0xc28b('0x51')]['split']('-')[0x0]][_0xc28b('0x55')]),_0xc28b('0x9e'),{'destaccountcode':this['agents'][_0xfa3f9a[_0xc28b('0x51')][_0xc28b('0x52')]('-')[0x0]][_0xc28b('0x54')]});}}var _0x3b2639=this;Promise[_0xc28b('0x9f')]()[_0xc28b('0xa0')](function(){var _0x271b47=_0x3b2639[_0xc28b('0x1d')][_0xfa3f9a[_0xc28b('0x42')]];if(typeof _0x271b47[_0xc28b('0xa1')]===_0xc28b('0xa2'))return;if(_['isEmpty'](_0x271b47['monitors']))return;return RpcSetting[_0xc28b('0xa3')]()[_0xc28b('0xa0')](function(_0x2630d1){if(!_0x2630d1[_0xc28b('0xa4')])return;return Promise['resolve']()['then'](function(){return ami['Action']({'action':_0xc28b('0xa5'),'channel':_0x271b47['channel']})['catch'](function(){});})[_0xc28b('0xa0')](function(){return ami['Action']({'action':_0xc28b('0xa5'),'channel':_0x271b47[_0xc28b('0x70')]})[_0xc28b('0xa6')](function(){})[_0xc28b('0xa7')](function(){var _0x5e59d8=_0x3b2639[_0xc28b('0x1e')][_0x271b47[_0xc28b('0x70')][_0xc28b('0x52')]('-')[0x0]];if(!_0x5e59d8)return;io[_0xc28b('0x3d')](_0xc28b('0xa8'),{'agentId':_0x5e59d8['id'],'uniqueid':_0x271b47['uniqueid']});});});});})['then'](function(){if(_0xfa3f9a[_0xc28b('0xa9')]===_0xc28b('0xaa')){_0x3b2639[_0xc28b('0xab')][_0xfa3f9a['uniqueid']]=_0x3b2639['channels'][_0xfa3f9a[_0xc28b('0x42')]];}else{if(_0x3b2639[_0xc28b('0x1d')][_0xfa3f9a[_0xc28b('0x42')]][_0xc28b('0x88')]==='outbound'&&_0x3b2639[_0xc28b('0xab')][_0xfa3f9a[_0xc28b('0x42')]]){_0x3b2639[_0xc28b('0x1d')][_0xfa3f9a[_0xc28b('0x42')]]['uniqueid']=[_0x3b2639[_0xc28b('0x1d')][_0xfa3f9a['uniqueid']][_0xc28b('0x43')],_0x3b2639[_0xc28b('0x1d')][_0xfa3f9a[_0xc28b('0x42')]][_0xc28b('0x43')]=_0x3b2639[_0xc28b('0x1d')][_0xfa3f9a[_0xc28b('0x42')]][_0xc28b('0x42')]][0x0];delete _0x3b2639[_0xc28b('0xab')][_0xfa3f9a[_0xc28b('0x42')]];}}logger[_0xc28b('0x41')](_0xc28b('0xac'),_0xfa3f9a[_0xc28b('0x42')],util[_0xc28b('0x39')](_0x3b2639[_0xc28b('0x1d')][_0xfa3f9a[_0xc28b('0x42')]],{'showHidden':![],'depth':null}));ami[_0xc28b('0x3d')](_0xc28b('0xad'),_0x3b2639[_0xc28b('0x1d')][_0xfa3f9a[_0xc28b('0x42')]]);delete _0x3b2639[_0xc28b('0x1d')][_0xfa3f9a['uniqueid']];});}}}catch(_0x1917b6){logger[_0xc28b('0x37')]('[%s][voiceCallReport][hangup]',_0xfa3f9a[_0xc28b('0x42')],util['inspect'](_0x1917b6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc28b('0x3a')][_0xc28b('0x2d')]=function(_0x2e2244){try{if(this[_0xc28b('0x3b')](_0x2e2244)){logger[_0xc28b('0x34')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x2e2244['uniqueid'],_0x2e2244[_0xc28b('0xae')],_0x2e2244[_0xc28b('0xaf')]);logger[_0xc28b('0x41')](_0xc28b('0xb0'),_0x2e2244[_0xc28b('0x42')],util[_0xc28b('0x39')](_0x2e2244,{'showHidden':![],'depth':null}));if(this[_0xc28b('0x1d')][_0x2e2244[_0xc28b('0xb1')]]){this['channels'][_0x2e2244[_0xc28b('0xb1')]]['transfercalleridnum']=_0x2e2244['origtransferercalleridnum'];this[_0xc28b('0x1d')][_0x2e2244[_0xc28b('0xb1')]][_0xc28b('0xb2')]=_0x2e2244[_0xc28b('0xaf')];if(this[_0xc28b('0x1d')][_0x2e2244[_0xc28b('0xb3')]]){var _0x4f2ca4=this[_0xc28b('0x1d')][_0x2e2244[_0xc28b('0xb3')]];this['channels'][_0x2e2244[_0xc28b('0xb3')]]=this['channels'][_0x2e2244[_0xc28b('0xb1')]];this[_0xc28b('0x1d')][_0x2e2244['transfereeuniqueid']]=_0x4f2ca4;}}else if(this[_0xc28b('0x1d')][_0x2e2244[_0xc28b('0xb4')]]){this[_0xc28b('0x1d')][_0x2e2244[_0xc28b('0xb4')]][_0xc28b('0xb5')]=_0x2e2244[_0xc28b('0xae')];this[_0xc28b('0x1d')][_0x2e2244[_0xc28b('0xb4')]][_0xc28b('0xb2')]=_0x2e2244['transfertargetcalleridnum'];if(this[_0xc28b('0x1d')][_0x2e2244[_0xc28b('0xb6')]]){var _0x4f2ca4=this[_0xc28b('0x1d')][_0x2e2244[_0xc28b('0xb6')]];this[_0xc28b('0x1d')][_0x2e2244['origtransfereruniqueid']]=this['channels'][_0x2e2244[_0xc28b('0xb4')]];this[_0xc28b('0x1d')][_0x2e2244[_0xc28b('0xb4')]]=_0x4f2ca4;}}if((this[_0xc28b('0x1d')][_0x2e2244['origtransfereruniqueid']]||this['channels'][_0x2e2244[_0xc28b('0xb7')]])&&this[_0xc28b('0x1d')][_0x2e2244[_0xc28b('0xb3')]]){var _0x18d4a4=_[_0xc28b('0xb8')]([this[_0xc28b('0x1d')][_0x2e2244['origtransfereruniqueid']],this[_0xc28b('0x1d')][_0x2e2244[_0xc28b('0xb7')]],this[_0xc28b('0x1d')][_0x2e2244[_0xc28b('0xb3')]]],function(_0x2ae33a){return _0x2ae33a&&_0x2ae33a[_0xc28b('0x88')]===_0xc28b('0xb9')&&_0x2ae33a['routeid'];});if(_0x18d4a4){if(this[_0xc28b('0x1d')][_0x2e2244[_0xc28b('0xb6')]])this[_0xc28b('0x1d')][_0x2e2244['origtransfereruniqueid']]['transferType']='ATTENDED';if(this[_0xc28b('0x1d')][_0x2e2244[_0xc28b('0xb7')]])this[_0xc28b('0x1d')][_0x2e2244[_0xc28b('0xb7')]]['transferType']='ATTENDED';this[_0xc28b('0x1d')][_0x2e2244[_0xc28b('0xb3')]]['transferType']='ATTENDED';}}}}catch(_0x3af9ee){logger[_0xc28b('0x37')](_0xc28b('0xba'),_0x2e2244[_0xc28b('0x42')],util[_0xc28b('0x39')](_0x3af9ee,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc28b('0x3a')][_0xc28b('0x2f')]=function(_0x41179a){try{if(this['isNotNull'](_0x41179a)){logger[_0xc28b('0x34')](_0xc28b('0xbb'),_0x41179a['uniqueid'],_0x41179a['transfereecalleridnum'],_0x41179a[_0xc28b('0xbc')]);logger[_0xc28b('0x41')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x41179a[_0xc28b('0x42')],util[_0xc28b('0x39')](_0x41179a,{'showHidden':![],'depth':null}));if(this[_0xc28b('0x1d')][_0x41179a[_0xc28b('0xb1')]]){this[_0xc28b('0x1d')][_0x41179a[_0xc28b('0xb1')]][_0xc28b('0xb5')]=_0x41179a[_0xc28b('0xbd')];this[_0xc28b('0x1d')][_0x41179a[_0xc28b('0xb1')]][_0xc28b('0xb2')]=_0x41179a[_0xc28b('0xbc')];this[_0xc28b('0x1d')][_0x41179a[_0xc28b('0xb1')]][_0xc28b('0xa1')]=_0xc28b('0xbe');this[_0xc28b('0x29')]({'event':_0xc28b('0xaa'),'uniqueid':_0x41179a[_0xc28b('0xb1')],'context':_0x41179a[_0xc28b('0x4b')],'channel':_0x41179a[_0xc28b('0xbf')]});}else{this[_0xc28b('0x1d')][_0x41179a['transfereruniqueid']][_0xc28b('0xa1')]='BLIND';}}}catch(_0x2fc4c8){logger[_0xc28b('0x37')](_0xc28b('0xc0'),_0x41179a[_0xc28b('0x42')],util[_0xc28b('0x39')](_0x2fc4c8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc28b('0x3a')][_0xc28b('0x31')]=function(_0x160dec){try{if(this['isNotNull'](_0x160dec)){logger['debug']('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x160dec['uniqueid'],util['inspect'](_0x160dec,{'showHidden':![],'depth':null}));if(this[_0xc28b('0x1d')][_0x160dec[_0xc28b('0x42')]]){if(!_[_0xc28b('0x7c')](this[_0xc28b('0x1d')][_0x160dec[_0xc28b('0x42')]]['answertime'])){this[_0xc28b('0x1d')][_0x160dec[_0xc28b('0x42')]][_0xc28b('0xc1')]=moment()['format'](_0xc28b('0x4e'));logger[_0xc28b('0x34')](_0xc28b('0xc2'),_0x160dec[_0xc28b('0x42')],this['channels'][_0x160dec[_0xc28b('0x42')]][_0xc28b('0xc1')]);}}}}catch(_0x369f0d){logger['error'](_0xc28b('0xc3'),_0x160dec[_0xc28b('0x42')],util[_0xc28b('0x39')](_0x369f0d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xc28b('0x33')]=function(_0x49f997){try{if(this[_0xc28b('0x3b')](_0x49f997)){logger[_0xc28b('0x41')](_0xc28b('0xc4'),_0x49f997[_0xc28b('0x42')],util[_0xc28b('0x39')](_0x49f997,{'showHidden':![],'depth':null}));if(this[_0xc28b('0x1d')][_0x49f997[_0xc28b('0x42')]]){if(!_[_0xc28b('0x7c')](this[_0xc28b('0x1d')][_0x49f997[_0xc28b('0x42')]][_0xc28b('0xc1')])){this[_0xc28b('0x1d')][_0x49f997[_0xc28b('0x42')]][_0xc28b('0xc5')]+=moment()[_0xc28b('0xc6')](0x0)[_0xc28b('0x6e')](this[_0xc28b('0x1d')][_0x49f997[_0xc28b('0x42')]]['mohstarttime'],_0xc28b('0x61'));logger['info']('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x49f997[_0xc28b('0x42')],this['channels'][_0x49f997[_0xc28b('0x42')]]['mohtime']);delete this['channels'][_0x49f997[_0xc28b('0x42')]][_0xc28b('0xc1')];}}}}catch(_0x219c69){logger[_0xc28b('0x37')](_0xc28b('0xc7'),_0x49f997[_0xc28b('0x42')],util[_0xc28b('0x39')](_0x219c69,{'showHidden':![],'depth':null}));}};module[_0xc28b('0xc8')]=VoiceCallReport; \ No newline at end of file +var _0xf492=['dial','voicemail','NO\x20ANSWER','FAILED','ANSWERED','redis','defaults','localhost','socket.io-emitter','channels','agents','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','info','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','merge','pick','keys','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','from-sip','channel','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','application','toLowerCase','applicationdata','starttime','duration','subtract','seconds','disposition','includes','lastapplication','startsWith','cdr(','match','queue','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','linkedid','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','xcally-motion-preview','connectedlinenum','destinationchannel','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','replace','.wav49','.WAV','monitorFilename','find','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','mixmonitor_filename','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20reason:%s','diff','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','transferType','undefined','isEmpty','getSettings','then','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','blindTransfers','type','outbound','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','ATTENDED','syncBlindTransfer','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','bluebird','moment','util','../../../config/environment','../../../config/logger','ami','../ami','not_inuse','busy','invalid','ringing','onhold','set','agi'];(function(_0x4a2fde,_0x190c2f){var _0x52ab47=function(_0x28f4d5){while(--_0x28f4d5){_0x4a2fde['push'](_0x4a2fde['shift']());}};_0x52ab47(++_0x190c2f);}(_0xf492,0xb2));var _0x2f49=function(_0x4481e2,_0x378e2d){_0x4481e2=_0x4481e2-0x0;var _0x1fac47=_0xf492[_0x4481e2];return _0x1fac47;};'use strict';var BPromise=require(_0x2f49('0x0'));var _=require('lodash');var moment=require(_0x2f49('0x1'));var util=require(_0x2f49('0x2'));var path=require('path');var Redis=require('ioredis');var config=require(_0x2f49('0x3'));var logger=require(_0x2f49('0x4'))(_0x2f49('0x5'));var ami=require(_0x2f49('0x6'));var Channel=require('../model/channel');var RpcSetting=require('../rpc/setting');var statusDesc=['unknown',_0x2f49('0x7'),'inuse',_0x2f49('0x8'),_0x2f49('0x9'),'unavailable',_0x2f49('0xa'),'ringinuse',_0x2f49('0xb')];var applications=[_0x2f49('0xc'),'queue',_0x2f49('0xd'),_0x2f49('0xe'),'playback',_0x2f49('0xf')];var dispositions=[_0x2f49('0x10'),_0x2f49('0x11'),_0x2f49('0x11'),'NO\x20ANSWER',_0x2f49('0x10'),_0x2f49('0x10'),_0x2f49('0x12'),'BUSY','FAILED','FAILED',_0x2f49('0x11')];var actions={};config[_0x2f49('0x13')]=_[_0x2f49('0x14')](config[_0x2f49('0x13')],{'host':_0x2f49('0x15'),'port':0x18eb});var io=require(_0x2f49('0x16'))(new Redis(config[_0x2f49('0x13')]));function VoiceCallReport(_0x5195dd){this['channels']=_0x5195dd[_0x2f49('0x17')];this[_0x2f49('0x18')]=_0x5195dd[_0x2f49('0x18')];this['blindTransfers']={};ami['on']('coreshowchannel',this[_0x2f49('0x19')][_0x2f49('0x1a')](this));ami['on'](_0x2f49('0x1b'),this[_0x2f49('0x19')]['bind'](this));ami['on'](_0x2f49('0x1c'),this[_0x2f49('0x1d')][_0x2f49('0x1a')](this));ami['on'](_0x2f49('0x1e'),this[_0x2f49('0x1f')][_0x2f49('0x1a')](this));ami['on'](_0x2f49('0x20'),this[_0x2f49('0x21')][_0x2f49('0x1a')](this));ami['on'](_0x2f49('0x22'),this[_0x2f49('0x23')][_0x2f49('0x1a')](this));ami['on'](_0x2f49('0x24'),this['syncNewCallerId'][_0x2f49('0x1a')](this));ami['on'](_0x2f49('0x25'),this[_0x2f49('0x26')][_0x2f49('0x1a')](this));ami['on'](_0x2f49('0x27'),this['syncBlindTransfer'][_0x2f49('0x1a')](this));ami['on'](_0x2f49('0x28'),this[_0x2f49('0x29')][_0x2f49('0x1a')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0x2f49('0x1a')](this));try{logger[_0x2f49('0x2a')](_0x2f49('0x2b'));ami['actionCoreShowChannels']();}catch(_0x1d4c25){logger[_0x2f49('0x2c')](_0x2f49('0x2d'),util[_0x2f49('0x2e')](_0x1d4c25,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x2f49('0x2f')][_0x2f49('0x30')]=function(_0x21143a){return _0x21143a!==null&&!_[_0x2f49('0x31')](_0x21143a);};VoiceCallReport['prototype']['emit']=function(_0x3e5587,_0x2205ec,_0x518678){io['to'](_0x3e5587)[_0x2f49('0x32')](_0x2205ec,_0x518678);};VoiceCallReport[_0x2f49('0x2f')][_0x2f49('0x33')]=function(_0x1c4db1){try{if(this[_0x2f49('0x30')](_0x1c4db1)){logger[_0x2f49('0x2a')](_0x2f49('0x34'),_0x1c4db1[_0x2f49('0x35')],_0x1c4db1[_0x2f49('0x36')],_0x1c4db1['calleridnum']);logger[_0x2f49('0x37')](_0x2f49('0x38'),_0x1c4db1[_0x2f49('0x35')],util[_0x2f49('0x2e')](_0x1c4db1,{'showHidden':![],'depth':null}));if(_0x1c4db1[_0x2f49('0x35')]===_0x1c4db1['linkedid']){if(!_[_0x2f49('0x31')](this[_0x2f49('0x17')][_0x1c4db1['uniqueid']])){_[_0x2f49('0x39')](this[_0x2f49('0x17')][_0x1c4db1[_0x2f49('0x35')]],_[_0x2f49('0x3a')](_0x1c4db1,_[_0x2f49('0x3b')](this[_0x2f49('0x17')][_0x1c4db1[_0x2f49('0x35')]])));}}}}catch(_0x5d2226){logger[_0x2f49('0x2c')]('[%s][voiceCallReport][newcallerid]',_0x1c4db1[_0x2f49('0x35')],util['inspect'](_0x5d2226,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f49('0x2f')][_0x2f49('0x1d')]=function(_0x5232aa){try{if(this[_0x2f49('0x30')](_0x5232aa)){logger[_0x2f49('0x37')]('[%s][voiceCallReport][newchannel]\x20event:',_0x5232aa[_0x2f49('0x35')],util[_0x2f49('0x2e')](_0x5232aa,{'showHidden':![],'depth':null}));if(_0x5232aa[_0x2f49('0x35')]===_0x5232aa['linkedid']&&_0x5232aa['channel']!=_0x2f49('0x3c')){if(_[_0x2f49('0x31')](this['channels'][_0x5232aa[_0x2f49('0x35')]])){logger[_0x2f49('0x2a')](_0x2f49('0x3d'),_0x5232aa[_0x2f49('0x35')],_0x5232aa[_0x2f49('0x3e')],_0x5232aa[_0x2f49('0x3f')]);this['channels'][_0x5232aa['uniqueid']]=new Channel();this['channels'][_0x5232aa[_0x2f49('0x35')]]['starttime']=moment()[_0x2f49('0x40')](_0x2f49('0x41'));this[_0x2f49('0x17')][_0x5232aa[_0x2f49('0x35')]]['disposition']=dispositions[_[_0x2f49('0x42')](_0x5232aa[_0x2f49('0x43')])];_['merge'](this[_0x2f49('0x17')][_0x5232aa[_0x2f49('0x35')]],_[_0x2f49('0x3a')](_0x5232aa,_[_0x2f49('0x3b')](this['channels'][_0x5232aa[_0x2f49('0x35')]])));if(_0x5232aa[_0x2f49('0x3e')]===_0x2f49('0x44')){if(this['agents'][_0x5232aa[_0x2f49('0x45')][_0x2f49('0x46')]('-')[0x0]]){this[_0x2f49('0x18')][_0x5232aa[_0x2f49('0x45')][_0x2f49('0x46')]('-')[0x0]][_0x2f49('0x47')]=_0x5232aa[_0x2f49('0x3f')];logger[_0x2f49('0x37')](_0x2f49('0x48'),_0x5232aa[_0x2f49('0x35')],util[_0x2f49('0x2e')]({'destaccountcode':this[_0x2f49('0x18')][_0x5232aa[_0x2f49('0x45')][_0x2f49('0x46')]('-')[0x0]][_0x2f49('0x49')],'destconnectedlinenum':_0x5232aa[_0x2f49('0x3f')]},{'showHidden':![],'depth':null}));this[_0x2f49('0x32')](util['format'](_0x2f49('0x4a'),this[_0x2f49('0x18')][_0x5232aa[_0x2f49('0x45')][_0x2f49('0x46')]('-')[0x0]][_0x2f49('0x4b')]),_0x2f49('0x4c'),{'destaccountcode':this[_0x2f49('0x18')][_0x5232aa['channel'][_0x2f49('0x46')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x5232aa[_0x2f49('0x3f')]});}}}}}}catch(_0x449828){logger[_0x2f49('0x2c')](_0x2f49('0x4d'),_0x5232aa['uniqueid'],util[_0x2f49('0x2e')](_0x449828,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f49('0x2f')][_0x2f49('0x19')]=function(_0x2e7fb0){try{if(this[_0x2f49('0x30')](_0x2e7fb0)){logger['debug']('[%s][voiceCallReport][newexten]\x20event:',_0x2e7fb0['uniqueid'],util[_0x2f49('0x2e')](_0x2e7fb0,{'showHidden':![],'depth':null}));if(_0x2e7fb0[_0x2f49('0x35')]===_0x2e7fb0['linkedid']&&_0x2e7fb0[_0x2f49('0x3f')]!='h'&&_0x2e7fb0['channel']!=_0x2f49('0x3c')){_0x2e7fb0['application']=_0x2e7fb0[_0x2f49('0x4e')][_0x2f49('0x4f')]();_0x2e7fb0[_0x2f49('0x50')]=(_0x2e7fb0['appdata']||_0x2e7fb0['applicationdata'])[_0x2f49('0x4f')]();logger[_0x2f49('0x2a')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x2e7fb0[_0x2f49('0x35')],_0x2e7fb0[_0x2f49('0x4e')],_0x2e7fb0[_0x2f49('0x50')]);if(_[_0x2f49('0x31')](this['channels'][_0x2e7fb0[_0x2f49('0x35')]])){this[_0x2f49('0x17')][_0x2e7fb0[_0x2f49('0x35')]]=new Channel();this[_0x2f49('0x17')][_0x2e7fb0[_0x2f49('0x35')]][_0x2f49('0x51')]=_0x2e7fb0[_0x2f49('0x52')]?moment()[_0x2f49('0x53')](moment[_0x2f49('0x52')](_0x2e7fb0[_0x2f49('0x52')])[_0x2f49('0x54')](),_0x2f49('0x54'))[_0x2f49('0x40')](_0x2f49('0x41')):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x2f49('0x17')][_0x2e7fb0[_0x2f49('0x35')]][_0x2f49('0x55')]='NO\x20ANSWER';}_['merge'](this[_0x2f49('0x17')][_0x2e7fb0['uniqueid']],_[_0x2f49('0x3a')](_0x2e7fb0,_[_0x2f49('0x3b')](this['channels'][_0x2e7fb0['uniqueid']])));if(_[_0x2f49('0x56')](applications,_0x2e7fb0[_0x2f49('0x4e')])){this[_0x2f49('0x17')][_0x2e7fb0[_0x2f49('0x35')]][_0x2f49('0x57')]=_0x2e7fb0['application'];this['channels'][_0x2e7fb0['uniqueid']]['lastdata']=_0x2e7fb0[_0x2f49('0x50')];if(_0x2e7fb0[_0x2f49('0x4e')]===_0x2f49('0xc')&&_[_0x2f49('0x58')](_0x2e7fb0[_0x2f49('0x50')],_0x2f49('0x59'))){var _0x48b302=_0x2e7fb0[_0x2f49('0x50')][_0x2f49('0x46')]('=');var _0x112274=_0x48b302[0x0][_0x2f49('0x5a')](/cdr\((.*)\)/);if(_0x112274){this[_0x2f49('0x17')][_0x2e7fb0['uniqueid']][_0x112274[0x1]]=_0x48b302[0x1];}}else if(_0x2e7fb0[_0x2f49('0x4e')]===_0x2f49('0x5b')){this[_0x2f49('0x17')][_0x2e7fb0[_0x2f49('0x35')]][_0x2f49('0x5b')]=_0x2e7fb0[_0x2f49('0x50')][_0x2f49('0x46')](',')[0x0];}}}}}catch(_0x22f940){logger[_0x2f49('0x2c')]('[%s][voiceCallReport][newexten]',_0x2e7fb0[_0x2f49('0x35')],util[_0x2f49('0x2e')](_0x22f940,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f49('0x2f')]['syncNewState']=function(_0x20da92){try{if(this[_0x2f49('0x30')](_0x20da92)){logger['info'](_0x2f49('0x5c'),_0x20da92[_0x2f49('0x35')],_0x20da92[_0x2f49('0x5d')],_0x20da92[_0x2f49('0x36')],_0x20da92[_0x2f49('0x5e')]);logger[_0x2f49('0x37')](_0x2f49('0x5f'),_0x20da92['uniqueid'],util[_0x2f49('0x2e')](_0x20da92,{'showHidden':![],'depth':null}));if(_0x20da92[_0x2f49('0x35')]!==_0x20da92[_0x2f49('0x5d')]){if(this[_0x2f49('0x17')][_0x20da92[_0x2f49('0x5d')]]){if(_0x20da92[_0x2f49('0x43')]==='6'){if(!this[_0x2f49('0x17')][_0x20da92[_0x2f49('0x5d')]][_0x2f49('0x60')]){var _0x22eea8=moment();this[_0x2f49('0x17')][_0x20da92['linkedid']]['answered']=!![];this[_0x2f49('0x17')][_0x20da92[_0x2f49('0x5d')]][_0x2f49('0x61')]=_0x22eea8[_0x2f49('0x40')](_0x2f49('0x41'));if(this['channels'][_0x20da92['linkedid']]['starttime']){this[_0x2f49('0x17')][_0x20da92['linkedid']][_0x2f49('0x62')]=_0x22eea8['diff'](this[_0x2f49('0x17')][_0x20da92[_0x2f49('0x5d')]][_0x2f49('0x51')],_0x2f49('0x54'));}}this[_0x2f49('0x17')][_0x20da92[_0x2f49('0x5d')]][_0x2f49('0x5d')]=_0x20da92[_0x2f49('0x35')];if(_0x20da92[_0x2f49('0x5e')]!==_0x2f49('0x63')){this[_0x2f49('0x17')][_0x20da92[_0x2f49('0x5d')]][_0x2f49('0x64')]=_0x20da92[_0x2f49('0x5e')];}this[_0x2f49('0x17')][_0x20da92[_0x2f49('0x5d')]]['connectedlinename']=_0x20da92['calleridname'];this[_0x2f49('0x17')][_0x20da92['linkedid']][_0x2f49('0x65')]=_0x20da92[_0x2f49('0x45')];this[_0x2f49('0x17')][_0x20da92[_0x2f49('0x5d')]][_0x2f49('0x55')]=dispositions[_[_0x2f49('0x42')](_0x20da92[_0x2f49('0x43')])];if(this['agents'][_0x20da92['channel']['split']('-')[0x0]]){this[_0x2f49('0x17')][_0x20da92[_0x2f49('0x5d')]][_0x2f49('0x66')]=this['agents'][_0x20da92[_0x2f49('0x45')][_0x2f49('0x46')]('-')[0x0]]['id'];this[_0x2f49('0x17')][_0x20da92['linkedid']][_0x2f49('0x67')]=this[_0x2f49('0x18')][_0x20da92['channel']['split']('-')[0x0]]['name'];}}}}else{if(this[_0x2f49('0x17')][_0x20da92[_0x2f49('0x35')]]){if(_0x20da92[_0x2f49('0x43')]==='6'){if(this[_0x2f49('0x18')][_0x20da92[_0x2f49('0x45')][_0x2f49('0x46')]('-')[0x0]]){this['channels'][_0x20da92[_0x2f49('0x35')]][_0x2f49('0x66')]=this[_0x2f49('0x18')][_0x20da92[_0x2f49('0x45')][_0x2f49('0x46')]('-')[0x0]]['id'];this[_0x2f49('0x17')][_0x20da92[_0x2f49('0x35')]][_0x2f49('0x67')]=this[_0x2f49('0x18')][_0x20da92[_0x2f49('0x45')]['split']('-')[0x0]][_0x2f49('0x4b')];}}}}}}catch(_0x4bec52){logger['error'](_0x2f49('0x68'),_0x20da92['uniqueid'],util[_0x2f49('0x2e')](_0x4bec52,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2f49('0x69')]=function(_0x9863d5,_0x575262){try{if(this[_0x2f49('0x17')][_0x9863d5]){logger[_0x2f49('0x2a')](_0x2f49('0x6a'),_0x9863d5,_0x575262);this[_0x2f49('0x17')][_0x9863d5]['monitor']=!![];if(_[_0x2f49('0x6b')](_0x575262,'.wav49')){_0x575262=_0x575262[_0x2f49('0x6c')](_0x2f49('0x6d'),_0x2f49('0x6e'));}this['channels'][_0x9863d5][_0x2f49('0x6f')]=_0x575262;var _0x4fc817=_[_0x2f49('0x70')](this[_0x2f49('0x17')][_0x9863d5][_0x2f49('0x71')],{'filename':_0x575262});if(_['isNil'](_0x4fc817)){this[_0x2f49('0x17')][_0x9863d5][_0x2f49('0x71')]['push']({'filename':_0x575262,'createdAt':moment()[_0x2f49('0x40')](_0x2f49('0x41')),'mixmonitorid':'','status':_0x2f49('0x72')});}}}catch(_0x14b6b6){logger[_0x2f49('0x2c')](_0x2f49('0x73'),_0x9863d5,util[_0x2f49('0x2e')](_0x14b6b6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f49('0x2f')][_0x2f49('0x21')]=function(_0x185932){try{if(this[_0x2f49('0x30')](_0x185932)){logger[_0x2f49('0x37')](_0x2f49('0x74'),_0x185932[_0x2f49('0x35')],util[_0x2f49('0x2e')](_0x185932,{'showHidden':![],'depth':null}));if(this[_0x2f49('0x17')][_0x185932[_0x2f49('0x35')]]&&_0x185932[_0x2f49('0x45')]!='OutgoingSpoolFailed'){if(this['isNotNull'](_0x185932['variable'])){if(this[_0x2f49('0x30')](_0x185932[_0x2f49('0x75')]['mixmonitor_filename'])){logger[_0x2f49('0x2a')](_0x2f49('0x76'),_0x185932['uniqueid'],_0x185932[_0x2f49('0x77')]);this[_0x2f49('0x69')](_0x185932['uniqueid'],_0x185932[_0x2f49('0x77')]);}else if(this[_0x2f49('0x30')](_0x185932[_0x2f49('0x75')]['xmd-phone'])){logger[_0x2f49('0x2a')](_0x2f49('0x78'),_0x185932[_0x2f49('0x35')],_0x185932['value']);this['channels'][_0x185932[_0x2f49('0x35')]]['calleridnum']=_0x185932[_0x2f49('0x77')];}else if(this['isNotNull'](_0x185932[_0x2f49('0x75')][_0x2f49('0x79')])){logger[_0x2f49('0x2a')](_0x2f49('0x7a'),_0x185932[_0x2f49('0x35')],_0x185932[_0x2f49('0x77')]);this[_0x2f49('0x17')][_0x185932['uniqueid']][_0x2f49('0x7b')]=_0x185932[_0x2f49('0x77')];}else if(this[_0x2f49('0x30')](_0x185932['variable'][_0x2f49('0x7c')])){logger[_0x2f49('0x2a')](_0x2f49('0x7d'),_0x185932['uniqueid'],_0x185932[_0x2f49('0x77')]);this[_0x2f49('0x17')][_0x185932['uniqueid']]['type']=_0x185932[_0x2f49('0x77')];}else if(this[_0x2f49('0x30')](_0x185932[_0x2f49('0x75')][_0x2f49('0x7e')])){logger[_0x2f49('0x2a')](_0x2f49('0x7f'),_0x185932['uniqueid'],_0x185932[_0x2f49('0x77')]['split'](',')[0x0]);this[_0x2f49('0x17')][_0x185932[_0x2f49('0x35')]][_0x2f49('0x5b')]=_0x185932['value'][_0x2f49('0x46')](',')[0x0];}else if(this['isNotNull'](_0x185932['variable']['xmd-originatecalleridnum'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x185932[_0x2f49('0x35')],_0x185932[_0x2f49('0x77')]);this['channels'][_0x185932[_0x2f49('0x35')]][_0x2f49('0x80')]=_0x185932[_0x2f49('0x77')];}else if(this['isNotNull'](_0x185932[_0x2f49('0x75')][_0x2f49('0x81')])){logger['info'](_0x2f49('0x82'),_0x185932[_0x2f49('0x35')],_0x185932[_0x2f49('0x77')]);this[_0x2f49('0x17')][_0x185932[_0x2f49('0x35')]]['destination']=_0x185932[_0x2f49('0x77')];}else if(this[_0x2f49('0x30')](_0x185932[_0x2f49('0x75')][_0x2f49('0x83')])){logger[_0x2f49('0x2a')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x185932[_0x2f49('0x35')],_0x185932[_0x2f49('0x77')]);this['channels'][_0x185932[_0x2f49('0x35')]][_0x2f49('0x84')]=_0x185932[_0x2f49('0x77')];}else if(this['isNotNull'](_0x185932[_0x2f49('0x75')][_0x2f49('0x85')])){logger[_0x2f49('0x2a')](_0x2f49('0x86'),_0x185932['uniqueid'],_0x185932[_0x2f49('0x77')]);this['channels'][_0x185932[_0x2f49('0x35')]][_0x2f49('0x5b')]=_0x185932[_0x2f49('0x77')];}else if(this[_0x2f49('0x30')](_0x185932[_0x2f49('0x75')]['sipcallid'])){logger[_0x2f49('0x2a')](_0x2f49('0x87'),_0x185932[_0x2f49('0x35')],_0x185932[_0x2f49('0x77')]);this[_0x2f49('0x17')][_0x185932['uniqueid']]['sipcalluniqueid']=_0x185932['value'];}}}else if(this[_0x2f49('0x30')](_0x185932['variable'][_0x2f49('0x88')])){if(_0x185932['value']){var _0x5bff6b=path['parse'](_0x185932[_0x2f49('0x77')])[_0x2f49('0x4b')];logger[_0x2f49('0x2a')](_0x2f49('0x76'),_0x5bff6b,_0x185932[_0x2f49('0x77')]);this[_0x2f49('0x69')](_0x5bff6b,_0x185932[_0x2f49('0x77')]);}}else if(this[_0x2f49('0x17')][_0x185932[_0x2f49('0x5d')]]){if(this[_0x2f49('0x30')](_0x185932[_0x2f49('0x75')])){if(this[_0x2f49('0x30')](_0x185932[_0x2f49('0x75')][_0x2f49('0x89')])){logger[_0x2f49('0x2a')](_0x2f49('0x87'),_0x185932[_0x2f49('0x5d')],_0x185932[_0x2f49('0x77')]);this[_0x2f49('0x17')][_0x185932[_0x2f49('0x5d')]][_0x2f49('0x8a')]=_0x185932['value'];}}}}}catch(_0x138c2c){logger[_0x2f49('0x2c')](_0x2f49('0x8b'),_0x185932['uniqueid'],util[_0x2f49('0x2e')](_0x138c2c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f49('0x2f')]['syncHangup']=function(_0x5dd512){try{if(this[_0x2f49('0x30')](_0x5dd512)){logger[_0x2f49('0x37')]('[%s][voiceCallReport][hangup]\x20event:',_0x5dd512['uniqueid'],util[_0x2f49('0x2e')](_0x5dd512,{'showHidden':![],'depth':null}));if(this[_0x2f49('0x17')][_0x5dd512[_0x2f49('0x35')]]){logger['info'](_0x2f49('0x8c'),_0x5dd512[_0x2f49('0x35')],_0x5dd512['cause-txt']);var _0x47cf12=moment();this['channels'][_0x5dd512[_0x2f49('0x35')]]['endtime']=_0x47cf12[_0x2f49('0x40')](_0x2f49('0x41'));this[_0x2f49('0x17')][_0x5dd512['uniqueid']][_0x2f49('0x52')]=_0x47cf12[_0x2f49('0x8d')](this['channels'][_0x5dd512[_0x2f49('0x35')]]['starttime'],_0x2f49('0x54'));if(this[_0x2f49('0x17')][_0x5dd512[_0x2f49('0x35')]][_0x2f49('0x60')]){this[_0x2f49('0x17')][_0x5dd512['uniqueid']]['billableseconds']=_0x47cf12[_0x2f49('0x8d')](this['channels'][_0x5dd512[_0x2f49('0x35')]][_0x2f49('0x61')],_0x2f49('0x54'));this[_0x2f49('0x17')][_0x5dd512[_0x2f49('0x35')]][_0x2f49('0x62')]=this[_0x2f49('0x17')][_0x5dd512['uniqueid']]['duration']-this[_0x2f49('0x17')][_0x5dd512[_0x2f49('0x35')]][_0x2f49('0x8e')];}if(_0x5dd512[_0x2f49('0x3e')]==='from-sip'){if(this['agents'][_0x5dd512[_0x2f49('0x45')][_0x2f49('0x46')]('-')[0x0]]){this['agents'][_0x5dd512[_0x2f49('0x45')][_0x2f49('0x46')]('-')[0x0]]=_['omit'](this['agents'][_0x5dd512[_0x2f49('0x45')]['split']('-')[0x0]],[_0x2f49('0x47')]);logger['debug'](_0x2f49('0x8f'),_0x5dd512[_0x2f49('0x35')],util['inspect']({'destaccountcode':this[_0x2f49('0x18')][_0x5dd512[_0x2f49('0x45')][_0x2f49('0x46')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x2f49('0x32')](util[_0x2f49('0x40')](_0x2f49('0x4a'),this[_0x2f49('0x18')][_0x5dd512[_0x2f49('0x45')]['split']('-')[0x0]]['name']),'user:agentcomplete',{'destaccountcode':this[_0x2f49('0x18')][_0x5dd512['channel'][_0x2f49('0x46')]('-')[0x0]]['accountcode']});}}var _0x3864aa=this;Promise['resolve']()['then'](function(){var _0x4e141f=_0x3864aa['channels'][_0x5dd512['uniqueid']];if(typeof _0x4e141f[_0x2f49('0x90')]===_0x2f49('0x91'))return;if(_[_0x2f49('0x92')](_0x4e141f[_0x2f49('0x71')]))return;return RpcSetting[_0x2f49('0x93')]()[_0x2f49('0x94')](function(_0x2f2147){if(!_0x2f2147[_0x2f49('0x95')])return;return Promise['resolve']()[_0x2f49('0x94')](function(){return ami[_0x2f49('0x96')]({'action':_0x2f49('0x97'),'channel':_0x4e141f[_0x2f49('0x45')]})[_0x2f49('0x98')](function(){});})['then'](function(){return ami[_0x2f49('0x96')]({'action':_0x2f49('0x97'),'channel':_0x4e141f[_0x2f49('0x65')]})[_0x2f49('0x98')](function(){})[_0x2f49('0x99')](function(){var _0x462df4=_0x3864aa[_0x2f49('0x18')][_0x4e141f[_0x2f49('0x65')][_0x2f49('0x46')]('-')[0x0]];if(!_0x462df4)return;io[_0x2f49('0x32')](_0x2f49('0x9a'),{'agentId':_0x462df4['id'],'uniqueid':_0x4e141f[_0x2f49('0x35')]});});});});})[_0x2f49('0x94')](function(){if(_0x5dd512[_0x2f49('0x9b')]===_0x2f49('0x9c')){_0x3864aa[_0x2f49('0x9d')][_0x5dd512[_0x2f49('0x35')]]=_0x3864aa[_0x2f49('0x17')][_0x5dd512[_0x2f49('0x35')]];}else{if(_0x3864aa[_0x2f49('0x17')][_0x5dd512[_0x2f49('0x35')]][_0x2f49('0x9e')]===_0x2f49('0x9f')&&_0x3864aa[_0x2f49('0x9d')][_0x5dd512[_0x2f49('0x35')]]){_0x3864aa[_0x2f49('0x17')][_0x5dd512[_0x2f49('0x35')]][_0x2f49('0x35')]=[_0x3864aa[_0x2f49('0x17')][_0x5dd512[_0x2f49('0x35')]][_0x2f49('0x5d')],_0x3864aa['channels'][_0x5dd512['uniqueid']][_0x2f49('0x5d')]=_0x3864aa[_0x2f49('0x17')][_0x5dd512[_0x2f49('0x35')]][_0x2f49('0x35')]][0x0];delete _0x3864aa[_0x2f49('0x9d')][_0x5dd512[_0x2f49('0x35')]];}}logger['debug']('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x5dd512[_0x2f49('0x35')],util[_0x2f49('0x2e')](_0x3864aa[_0x2f49('0x17')][_0x5dd512[_0x2f49('0x35')]],{'showHidden':![],'depth':null}));ami[_0x2f49('0x32')](_0x2f49('0xa0'),_0x3864aa[_0x2f49('0x17')][_0x5dd512[_0x2f49('0x35')]]);delete _0x3864aa['channels'][_0x5dd512[_0x2f49('0x35')]];});}}}catch(_0x40c971){logger[_0x2f49('0x2c')](_0x2f49('0xa1'),_0x5dd512[_0x2f49('0x35')],util[_0x2f49('0x2e')](_0x40c971,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f49('0x2f')][_0x2f49('0x26')]=function(_0x5c419c){try{if(this['isNotNull'](_0x5c419c)){logger[_0x2f49('0x2a')](_0x2f49('0xa2'),_0x5c419c['uniqueid'],_0x5c419c[_0x2f49('0xa3')],_0x5c419c[_0x2f49('0xa4')]);logger['debug'](_0x2f49('0xa5'),_0x5c419c[_0x2f49('0x35')],util[_0x2f49('0x2e')](_0x5c419c,{'showHidden':![],'depth':null}));if(this[_0x2f49('0x17')][_0x5c419c[_0x2f49('0xa6')]]){this[_0x2f49('0x17')][_0x5c419c[_0x2f49('0xa6')]][_0x2f49('0xa7')]=_0x5c419c['origtransferercalleridnum'];this[_0x2f49('0x17')][_0x5c419c['transfereeuniqueid']][_0x2f49('0xa8')]=_0x5c419c[_0x2f49('0xa4')];if(this['channels'][_0x5c419c[_0x2f49('0xa9')]]){var _0x28e100=this['channels'][_0x5c419c[_0x2f49('0xa9')]];this[_0x2f49('0x17')][_0x5c419c['secondtransfereruniqueid']]=this[_0x2f49('0x17')][_0x5c419c['transfereeuniqueid']];this[_0x2f49('0x17')][_0x5c419c[_0x2f49('0xa6')]]=_0x28e100;}}else if(this[_0x2f49('0x17')][_0x5c419c[_0x2f49('0xaa')]]){this[_0x2f49('0x17')][_0x5c419c['transfertargetuniqueid']][_0x2f49('0xa7')]=_0x5c419c[_0x2f49('0xa3')];this[_0x2f49('0x17')][_0x5c419c['transfertargetuniqueid']][_0x2f49('0xa8')]=_0x5c419c[_0x2f49('0xa4')];if(this[_0x2f49('0x17')][_0x5c419c['origtransfereruniqueid']]){var _0x28e100=this[_0x2f49('0x17')][_0x5c419c[_0x2f49('0xab')]];this[_0x2f49('0x17')][_0x5c419c[_0x2f49('0xab')]]=this[_0x2f49('0x17')][_0x5c419c[_0x2f49('0xaa')]];this[_0x2f49('0x17')][_0x5c419c['transfertargetuniqueid']]=_0x28e100;}}if((this[_0x2f49('0x17')][_0x5c419c['origtransfereruniqueid']]||this[_0x2f49('0x17')][_0x5c419c[_0x2f49('0xac')]])&&this[_0x2f49('0x17')][_0x5c419c[_0x2f49('0xa9')]]){var _0x41dd62=_[_0x2f49('0xad')]([this[_0x2f49('0x17')][_0x5c419c['origtransfereruniqueid']],this['channels'][_0x5c419c[_0x2f49('0xac')]],this[_0x2f49('0x17')][_0x5c419c[_0x2f49('0xa9')]]],function(_0x29b607){return _0x29b607&&_0x29b607[_0x2f49('0x9e')]===_0x2f49('0x9f')&&_0x29b607[_0x2f49('0xae')];});if(_0x41dd62){if(this[_0x2f49('0x17')][_0x5c419c[_0x2f49('0xab')]])this[_0x2f49('0x17')][_0x5c419c[_0x2f49('0xab')]]['transferType']=_0x2f49('0xaf');if(this[_0x2f49('0x17')][_0x5c419c[_0x2f49('0xac')]])this[_0x2f49('0x17')][_0x5c419c[_0x2f49('0xac')]][_0x2f49('0x90')]='ATTENDED';this[_0x2f49('0x17')][_0x5c419c['secondtransfereruniqueid']]['transferType']=_0x2f49('0xaf');}}}}catch(_0x313d8b){logger[_0x2f49('0x2c')]('[%s][voiceCallReport][attendedtransfer]',_0x5c419c[_0x2f49('0x35')],util[_0x2f49('0x2e')](_0x313d8b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f49('0x2f')][_0x2f49('0xb0')]=function(_0x120596){try{if(this['isNotNull'](_0x120596)){logger[_0x2f49('0x2a')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x120596['uniqueid'],_0x120596[_0x2f49('0xb1')],_0x120596[_0x2f49('0xb2')]);logger[_0x2f49('0x37')](_0x2f49('0xb3'),_0x120596[_0x2f49('0x35')],util[_0x2f49('0x2e')](_0x120596,{'showHidden':![],'depth':null}));if(this[_0x2f49('0x17')][_0x120596[_0x2f49('0xa6')]]){this[_0x2f49('0x17')][_0x120596['transfereeuniqueid']][_0x2f49('0xa7')]=_0x120596[_0x2f49('0xb1')];this['channels'][_0x120596[_0x2f49('0xa6')]][_0x2f49('0xa8')]=_0x120596[_0x2f49('0xb2')];this[_0x2f49('0x17')][_0x120596['transfereeuniqueid']][_0x2f49('0x90')]=_0x2f49('0xb4');this[_0x2f49('0x23')]({'event':'BlindTransfer','uniqueid':_0x120596[_0x2f49('0xa6')],'context':_0x120596[_0x2f49('0x3e')],'channel':_0x120596[_0x2f49('0xb5')]});}else{this[_0x2f49('0x17')][_0x120596['transfereruniqueid']]['transferType']=_0x2f49('0xb4');}}}catch(_0x2fbb24){logger[_0x2f49('0x2c')](_0x2f49('0xb6'),_0x120596[_0x2f49('0x35')],util[_0x2f49('0x2e')](_0x2fbb24,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2f49('0x29')]=function(_0x2a165f){try{if(this['isNotNull'](_0x2a165f)){logger['debug'](_0x2f49('0xb7'),_0x2a165f[_0x2f49('0x35')],util['inspect'](_0x2a165f,{'showHidden':![],'depth':null}));if(this['channels'][_0x2a165f[_0x2f49('0x35')]]){if(!_[_0x2f49('0xb8')](this['channels'][_0x2a165f[_0x2f49('0x35')]]['answertime'])){this[_0x2f49('0x17')][_0x2a165f[_0x2f49('0x35')]][_0x2f49('0xb9')]=moment()[_0x2f49('0x40')](_0x2f49('0x41'));logger[_0x2f49('0x2a')](_0x2f49('0xba'),_0x2a165f['uniqueid'],this[_0x2f49('0x17')][_0x2a165f[_0x2f49('0x35')]][_0x2f49('0xb9')]);}}}}catch(_0x261a35){logger[_0x2f49('0x2c')](_0x2f49('0xbb'),_0x2a165f['uniqueid'],util[_0x2f49('0x2e')](_0x261a35,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f49('0x2f')]['syncMusicOnHoldStop']=function(_0x402d96){try{if(this[_0x2f49('0x30')](_0x402d96)){logger[_0x2f49('0x37')](_0x2f49('0xbc'),_0x402d96[_0x2f49('0x35')],util[_0x2f49('0x2e')](_0x402d96,{'showHidden':![],'depth':null}));if(this[_0x2f49('0x17')][_0x402d96['uniqueid']]){if(!_[_0x2f49('0xb8')](this['channels'][_0x402d96[_0x2f49('0x35')]][_0x2f49('0xb9')])){this['channels'][_0x402d96[_0x2f49('0x35')]][_0x2f49('0xbd')]+=moment()['milliseconds'](0x0)[_0x2f49('0x8d')](this[_0x2f49('0x17')][_0x402d96[_0x2f49('0x35')]]['mohstarttime'],_0x2f49('0x54'));logger['info'](_0x2f49('0xbe'),_0x402d96[_0x2f49('0x35')],this[_0x2f49('0x17')][_0x402d96[_0x2f49('0x35')]][_0x2f49('0xbd')]);delete this[_0x2f49('0x17')][_0x402d96[_0x2f49('0x35')]][_0x2f49('0xb9')];}}}}catch(_0x5d46f9){logger[_0x2f49('0x2c')](_0x2f49('0xbf'),_0x402d96[_0x2f49('0x35')],util[_0x2f49('0x2e')](_0x5d46f9,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index b984216..05844a1 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 _0x5a5e=['[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','linkedid','error','[%s][voiceDialReport][hangup]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','channels','outboundChannels','outbound','dialbegin','bind','syncDialEnd','syncVarSet','syncHangup','isNotNull','prototype','emit','syncDialBegin','debug','uniqueid','merge','format','channel','lastIndexOf','substring','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','outboundrouteid','isUndefined','value','variables','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberinterface','memberlastcall','membername','memberpenalty','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','duration','endtime','diff','starttime','seconds','complete','total','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save'];(function(_0x5e895e,_0x24e3b9){var _0x2c7211=function(_0x2e0165){while(--_0x2e0165){_0x5e895e['push'](_0x5e895e['shift']());}};_0x2c7211(++_0x24e3b9);}(_0x5a5e,0x1ae));var _0xe5a5=function(_0x363b81,_0x81e6ca){_0x363b81=_0x363b81-0x0;var _0x1d92fb=_0x5a5e[_0x363b81];return _0x1d92fb;};'use strict';var _=require(_0xe5a5('0x0'));var moment=require(_0xe5a5('0x1'));var util=require(_0xe5a5('0x2'));var Redis=require(_0xe5a5('0x3'));var config=require(_0xe5a5('0x4'));var logger=require(_0xe5a5('0x5'))(_0xe5a5('0x6'));var ami=require(_0xe5a5('0x7'));config['redis']=_[_0xe5a5('0x8')](config[_0xe5a5('0x9')],{'host':_0xe5a5('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe5a5('0x9')]));function VoiceDialReport(_0x3e3ea9){this[_0xe5a5('0xb')]=_0x3e3ea9[_0xe5a5('0xc')];this[_0xe5a5('0xd')]=_0x3e3ea9[_0xe5a5('0xd')];this['variables']={};ami['on'](_0xe5a5('0xe'),this['syncDialBegin'][_0xe5a5('0xf')](this));ami['on']('dialend',this[_0xe5a5('0x10')]['bind'](this));ami['on']('varset',this[_0xe5a5('0x11')]['bind'](this));ami['on']('hangup',this[_0xe5a5('0x12')]['bind'](this));}VoiceDialReport['prototype'][_0xe5a5('0x13')]=function(_0x2bbbab){return _0x2bbbab!==null&&!_['isUndefined'](_0x2bbbab);};VoiceDialReport[_0xe5a5('0x14')][_0xe5a5('0x15')]=function(_0x5558f3,_0x12ba3e,_0x420ec8){io['to'](_0x5558f3)[_0xe5a5('0x15')](_0x12ba3e,_0x420ec8);};VoiceDialReport['prototype'][_0xe5a5('0x16')]=function(_0x16a77e){try{if(this[_0xe5a5('0x13')](_0x16a77e)){logger[_0xe5a5('0x17')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x16a77e[_0xe5a5('0x18')],util['inspect'](_0x16a77e,{'showHidden':![],'depth':null}));if(this[_0xe5a5('0xb')][_0x16a77e[_0xe5a5('0x18')]]){_[_0xe5a5('0x19')](this[_0xe5a5('0xb')][_0x16a77e['uniqueid']],{'starttime':moment()[_0xe5a5('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','interface':_0x16a77e['channel']['substring'](0x0,_0x16a77e[_0xe5a5('0x1b')][_0xe5a5('0x1c')]('-')),'membername':_0x16a77e['channel'][_0xe5a5('0x1d')](_0x16a77e[_0xe5a5('0x1b')][_0xe5a5('0x1c')]('/')+0x1,_0x16a77e['channel'][_0xe5a5('0x1c')]('-'))},_[_0xe5a5('0x1e')](_0x16a77e,[_0xe5a5('0x1f'),_0xe5a5('0x20')]));logger['info'](_0xe5a5('0x21'),_0x16a77e[_0xe5a5('0x18')],this[_0xe5a5('0xb')][_0x16a77e[_0xe5a5('0x18')]]['membername'],this['channels'][_0x16a77e[_0xe5a5('0x18')]][_0xe5a5('0x22')]);logger[_0xe5a5('0x17')](_0xe5a5('0x23'),_0x16a77e[_0xe5a5('0x18')],util[_0xe5a5('0x24')](this[_0xe5a5('0xb')][_0x16a77e[_0xe5a5('0x18')]],{'showHidden':![],'depth':null}));this[_0xe5a5('0x15')](_0xe5a5('0x25'),_0xe5a5('0x26'),this[_0xe5a5('0xb')][_0x16a77e[_0xe5a5('0x18')]]);logger[_0xe5a5('0x17')](_0xe5a5('0x27'),_0x16a77e[_0xe5a5('0x18')],util[_0xe5a5('0x24')](this[_0xe5a5('0xb')][_0x16a77e[_0xe5a5('0x18')]],{'showHidden':![],'depth':null}));ami[_0xe5a5('0x15')]('custom:dialbegin',this['channels'][_0x16a77e[_0xe5a5('0x18')]]);}}}catch(_0x2c18e9){logger['error'](_0xe5a5('0x28'),_0x16a77e[_0xe5a5('0x18')],util[_0xe5a5('0x24')](_0x2c18e9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe5a5('0x14')][_0xe5a5('0x10')]=function(_0x28f00){try{if(this['isNotNull'](_0x28f00)){logger[_0xe5a5('0x17')](_0xe5a5('0x29'),_0x28f00[_0xe5a5('0x18')],util[_0xe5a5('0x24')](_0x28f00,{'showHidden':![],'depth':null}));if(this[_0xe5a5('0xb')][_0x28f00[_0xe5a5('0x18')]]){this[_0xe5a5('0xb')][_0x28f00[_0xe5a5('0x18')]][_0xe5a5('0x2a')]=_0x28f00['dialstatus'];if(_0x28f00[_0xe5a5('0x2a')]===_0xe5a5('0x2b')){this[_0xe5a5('0xb')][_0x28f00['uniqueid']][_0xe5a5('0x2c')]=_0x28f00['connectedlinenum'];this[_0xe5a5('0xb')][_0x28f00['uniqueid']][_0xe5a5('0x2d')]=_0x28f00[_0xe5a5('0x2d')];this['channels'][_0x28f00[_0xe5a5('0x18')]][_0xe5a5('0x2e')]=moment()[_0xe5a5('0x1a')](_0xe5a5('0x2f'));this['channels'][_0x28f00[_0xe5a5('0x18')]][_0xe5a5('0x30')]=_0xe5a5('0x31');logger[_0xe5a5('0x32')](_0xe5a5('0x33'),_0x28f00['uniqueid'],_0x28f00[_0xe5a5('0x1b')][_0xe5a5('0x1d')](_0x28f00['channel']['lastIndexOf']('/')+0x1,_0x28f00['channel'][_0xe5a5('0x1c')]('-')));logger['debug'](_0xe5a5('0x34'),_0x28f00[_0xe5a5('0x18')],util[_0xe5a5('0x24')](this['channels'][_0x28f00['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xe5a5('0x15')](_0xe5a5('0x35'),this[_0xe5a5('0xb')][_0x28f00['uniqueid']]);}logger[_0xe5a5('0x17')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x28f00[_0xe5a5('0x18')],util[_0xe5a5('0x24')](this[_0xe5a5('0xb')][_0x28f00['uniqueid']],{'showHidden':![],'depth':null}));this[_0xe5a5('0x15')](_0xe5a5('0x25'),'voice_outbound_channel:save',this[_0xe5a5('0xb')][_0x28f00[_0xe5a5('0x18')]]);}}}catch(_0x14f37e){logger['error'](_0xe5a5('0x36'),_0x28f00[_0xe5a5('0x18')],util[_0xe5a5('0x24')](_0x14f37e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe5a5('0x14')]['syncVarSet']=function(_0x21950e){try{if(this[_0xe5a5('0x13')](_0x21950e)){logger[_0xe5a5('0x17')](_0xe5a5('0x37'),_0x21950e[_0xe5a5('0x18')],util['inspect'](_0x21950e,{'showHidden':![],'depth':null}));this[_0xe5a5('0x38')](_0x21950e[_0xe5a5('0x18')],_[_0xe5a5('0x39')](_0x21950e['variable'])[0x0],_0x21950e['value']);if(this[_0xe5a5('0x13')](_0x21950e[_0xe5a5('0x3a')])&&this[_0xe5a5('0x13')](_0x21950e['variable'][_0xe5a5('0x3b')])){if(_[_0xe5a5('0x3c')](this[_0xe5a5('0xb')][_0x21950e[_0xe5a5('0x18')]])){this[_0xe5a5('0xb')][_0x21950e[_0xe5a5('0x18')]]={'routeId':_0x21950e[_0xe5a5('0x3d')],'variables':this[_0xe5a5('0x3e')][_0x21950e[_0xe5a5('0x18')]]};logger['info'](_0xe5a5('0x3f'),_0x21950e[_0xe5a5('0x18')],_0x21950e['variable'][_0xe5a5('0x3b')],_[_0xe5a5('0x39')](_0x21950e[_0xe5a5('0x3a')])[0x0],_0x21950e['value']);logger[_0xe5a5('0x17')](_0xe5a5('0x40'),_0x21950e[_0xe5a5('0x18')],util[_0xe5a5('0x24')](this[_0xe5a5('0xb')][_0x21950e[_0xe5a5('0x18')]],{'showHidden':![],'depth':null}));this[_0xe5a5('0x15')]('voice:outbound',_0xe5a5('0x26'),this[_0xe5a5('0xb')][_0x21950e[_0xe5a5('0x18')]]);}}}}catch(_0x52b1d3){logger['error'](_0xe5a5('0x41'),_0x21950e[_0xe5a5('0x18')],util[_0xe5a5('0x24')](_0x52b1d3,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe5a5('0x14')][_0xe5a5('0x38')]=function(_0x248e3b,_0x4a647c,_0x4eda10){var _0x217f9c=[_0xe5a5('0x42'),'rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged',_0xe5a5('0x43'),_0xe5a5('0x44'),_0xe5a5('0x45'),_0xe5a5('0x46'),_0xe5a5('0x47'),_0xe5a5('0x48'),_0xe5a5('0x49'),_0xe5a5('0x4a'),'membercalls','memberdynamic',_0xe5a5('0x4b'),_0xe5a5('0x4c'),_0xe5a5('0x4d'),_0xe5a5('0x4e'),'memberrealtime'];if(!_['isNil'](_0x4a647c)&&!_[_0xe5a5('0x4f')](_0x217f9c,_0x4a647c)){if(_['isUndefined'](this[_0xe5a5('0x3e')][_0x248e3b])){this[_0xe5a5('0x3e')][_0x248e3b]={};}this[_0xe5a5('0x3e')][_0x248e3b][_0x4a647c]=_0x4eda10;}};VoiceDialReport[_0xe5a5('0x14')][_0xe5a5('0x12')]=function(_0xd11953){try{if(this['isNotNull'](_0xd11953)){logger[_0xe5a5('0x17')](_0xe5a5('0x50'),_0xd11953[_0xe5a5('0x18')],util[_0xe5a5('0x24')](_0xd11953,{'showHidden':![],'depth':null}));if(this['channels'][_0xd11953['uniqueid']]){logger[_0xe5a5('0x32')](_0xe5a5('0x51'),_0xd11953[_0xe5a5('0x18')],_0xd11953[_0xe5a5('0x52')]);this[_0xe5a5('0xb')][_0xd11953['uniqueid']]['endtime']=moment()[_0xe5a5('0x1a')](_0xe5a5('0x2f'));this[_0xe5a5('0xb')][_0xd11953[_0xe5a5('0x18')]][_0xe5a5('0x53')]=moment(this[_0xe5a5('0xb')][_0xd11953['uniqueid']][_0xe5a5('0x54')])[_0xe5a5('0x55')](this[_0xe5a5('0xb')][_0xd11953['uniqueid']][_0xe5a5('0x56')],_0xe5a5('0x57'));this['channels'][_0xd11953[_0xe5a5('0x18')]][_0xe5a5('0x30')]=_0xe5a5('0x58');this[_0xe5a5('0xd')][_0xe5a5('0x59')]+=0x1;if(this['channels'][_0xd11953[_0xe5a5('0x18')]][_0xe5a5('0x2e')]){this[_0xe5a5('0xd')]['answered']+=0x1;this[_0xe5a5('0xb')][_0xd11953['uniqueid']][_0xe5a5('0x5a')]=moment(this[_0xe5a5('0xb')][_0xd11953[_0xe5a5('0x18')]][_0xe5a5('0x2e')])[_0xe5a5('0x55')](this[_0xe5a5('0xb')][_0xd11953[_0xe5a5('0x18')]][_0xe5a5('0x56')],'seconds');this[_0xe5a5('0xb')][_0xd11953[_0xe5a5('0x18')]][_0xe5a5('0x5b')]=moment(this[_0xe5a5('0xb')][_0xd11953[_0xe5a5('0x18')]]['endtime'])[_0xe5a5('0x55')](this[_0xe5a5('0xb')][_0xd11953[_0xe5a5('0x18')]][_0xe5a5('0x2e')],_0xe5a5('0x57'));this[_0xe5a5('0xd')][_0xe5a5('0x5c')]+=this[_0xe5a5('0xb')][_0xd11953[_0xe5a5('0x18')]]['holdtime']||0x0;this[_0xe5a5('0xd')][_0xe5a5('0x5d')]+=this[_0xe5a5('0xb')][_0xd11953[_0xe5a5('0x18')]]['billableseconds'];}this[_0xe5a5('0xd')][_0xe5a5('0x5e')]+=this[_0xe5a5('0xb')][_0xd11953[_0xe5a5('0x18')]][_0xe5a5('0x53')];logger[_0xe5a5('0x17')](_0xe5a5('0x5f'),_0xd11953[_0xe5a5('0x18')],util[_0xe5a5('0x24')](this[_0xe5a5('0xb')][_0xd11953[_0xe5a5('0x18')]],{'showHidden':![],'depth':null}));ami[_0xe5a5('0x15')]('custom:voiceDialReport',this[_0xe5a5('0xb')][_0xd11953[_0xe5a5('0x18')]]);logger['debug'](_0xe5a5('0x60'),_0xd11953[_0xe5a5('0x18')],util[_0xe5a5('0x24')](this['channels'][_0xd11953[_0xe5a5('0x18')]],{'showHidden':![],'depth':null}));ami[_0xe5a5('0x15')](_0xe5a5('0x61'),this[_0xe5a5('0xb')][_0xd11953[_0xe5a5('0x18')]]);logger[_0xe5a5('0x17')](_0xe5a5('0x62'),_0xd11953[_0xe5a5('0x18')],util['inspect'](this[_0xe5a5('0xb')][_0xd11953[_0xe5a5('0x18')]],{'showHidden':![],'depth':null}));this[_0xe5a5('0x15')](_0xe5a5('0x25'),_0xe5a5('0x63'),this[_0xe5a5('0xd')]);logger[_0xe5a5('0x32')](_0xe5a5('0x64'),JSON[_0xe5a5('0x65')](this[_0xe5a5('0xb')][_0xd11953[_0xe5a5('0x18')]]));logger[_0xe5a5('0x17')](_0xe5a5('0x66'),_0xd11953[_0xe5a5('0x18')],util['inspect'](this['channels'][_0xd11953[_0xe5a5('0x18')]],{'showHidden':![],'depth':null}));this[_0xe5a5('0x15')](_0xe5a5('0x25'),'voice_outbound_channel:remove',this[_0xe5a5('0xb')][_0xd11953[_0xe5a5('0x18')]]);delete this[_0xe5a5('0xb')][_0xd11953['uniqueid']];}else if(this[_0xe5a5('0xb')][_0xd11953[_0xe5a5('0x67')]]){this[_0xe5a5('0xb')][_0xd11953[_0xe5a5('0x67')]][_0xe5a5('0x18')]=this['channels'][_0xd11953['linkedid']]['destuniqueid'];}if(this[_0xe5a5('0x3e')][_0xd11953[_0xe5a5('0x18')]]){delete this[_0xe5a5('0x3e')][_0xd11953[_0xe5a5('0x18')]];}}}catch(_0x5957ae){logger[_0xe5a5('0x68')](_0xe5a5('0x69'),_0xd11953['uniqueid'],util[_0xe5a5('0x24')](_0x5957ae,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0x8e96=['info','membername','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','answertime','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','voice:outbound','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','duration','endtime','diff','total','answered','holdtime','starttime','seconds','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','bind','dialend','syncDialEnd','varset','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','substring','channel','lastIndexOf','omit','event','privilege'];(function(_0x3560bc,_0x5ae8d8){var _0x3a8087=function(_0x464ab4){while(--_0x464ab4){_0x3560bc['push'](_0x3560bc['shift']());}};_0x3a8087(++_0x5ae8d8);}(_0x8e96,0x182));var _0x68e9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8e96[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require(_0x68e9('0x0'));var util=require(_0x68e9('0x1'));var Redis=require(_0x68e9('0x2'));var config=require(_0x68e9('0x3'));var logger=require(_0x68e9('0x4'))(_0x68e9('0x5'));var ami=require(_0x68e9('0x6'));config[_0x68e9('0x7')]=_[_0x68e9('0x8')](config[_0x68e9('0x7')],{'host':_0x68e9('0x9'),'port':0x18eb});var io=require(_0x68e9('0xa'))(new Redis(config[_0x68e9('0x7')]));function VoiceDialReport(_0x3417eb){this[_0x68e9('0xb')]=_0x3417eb[_0x68e9('0xc')];this[_0x68e9('0xd')]=_0x3417eb[_0x68e9('0xd')];this[_0x68e9('0xe')]={};ami['on'](_0x68e9('0xf'),this['syncDialBegin'][_0x68e9('0x10')](this));ami['on'](_0x68e9('0x11'),this[_0x68e9('0x12')]['bind'](this));ami['on'](_0x68e9('0x13'),this['syncVarSet']['bind'](this));ami['on'](_0x68e9('0x14'),this[_0x68e9('0x15')][_0x68e9('0x10')](this));}VoiceDialReport[_0x68e9('0x16')][_0x68e9('0x17')]=function(_0x594571){return _0x594571!==null&&!_[_0x68e9('0x18')](_0x594571);};VoiceDialReport[_0x68e9('0x16')][_0x68e9('0x19')]=function(_0x32be83,_0x428ad8,_0xf33e19){io['to'](_0x32be83)['emit'](_0x428ad8,_0xf33e19);};VoiceDialReport[_0x68e9('0x16')]['syncDialBegin']=function(_0x475942){try{if(this[_0x68e9('0x17')](_0x475942)){logger['debug']('[%s][voiceDialReport][dialbegin]\x20event:',_0x475942[_0x68e9('0x1a')],util[_0x68e9('0x1b')](_0x475942,{'showHidden':![],'depth':null}));if(this['channels'][_0x475942[_0x68e9('0x1a')]]){_[_0x68e9('0x1c')](this[_0x68e9('0xb')][_0x475942[_0x68e9('0x1a')]],{'starttime':moment()[_0x68e9('0x1d')](_0x68e9('0x1e')),'lastevent':_0x68e9('0x1f'),'interface':_0x475942['channel'][_0x68e9('0x20')](0x0,_0x475942[_0x68e9('0x21')][_0x68e9('0x22')]('-')),'membername':_0x475942['channel']['substring'](_0x475942[_0x68e9('0x21')][_0x68e9('0x22')]('/')+0x1,_0x475942[_0x68e9('0x21')][_0x68e9('0x22')]('-'))},_[_0x68e9('0x23')](_0x475942,[_0x68e9('0x24'),_0x68e9('0x25')]));logger[_0x68e9('0x26')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x475942[_0x68e9('0x1a')],this[_0x68e9('0xb')][_0x475942[_0x68e9('0x1a')]][_0x68e9('0x27')],this[_0x68e9('0xb')][_0x475942[_0x68e9('0x1a')]][_0x68e9('0x28')]);logger[_0x68e9('0x29')](_0x68e9('0x2a'),_0x475942[_0x68e9('0x1a')],util['inspect'](this[_0x68e9('0xb')][_0x475942[_0x68e9('0x1a')]],{'showHidden':![],'depth':null}));this[_0x68e9('0x19')]('voice:outbound',_0x68e9('0x2b'),this[_0x68e9('0xb')][_0x475942['uniqueid']]);logger[_0x68e9('0x29')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x475942['uniqueid'],util[_0x68e9('0x1b')](this[_0x68e9('0xb')][_0x475942[_0x68e9('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x68e9('0x19')](_0x68e9('0x2c'),this[_0x68e9('0xb')][_0x475942[_0x68e9('0x1a')]]);}}}catch(_0x27d69b){logger[_0x68e9('0x2d')](_0x68e9('0x2e'),_0x475942[_0x68e9('0x1a')],util[_0x68e9('0x1b')](_0x27d69b,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x68e9('0x12')]=function(_0xbd55ba){try{if(this[_0x68e9('0x17')](_0xbd55ba)){logger[_0x68e9('0x29')](_0x68e9('0x2f'),_0xbd55ba[_0x68e9('0x1a')],util[_0x68e9('0x1b')](_0xbd55ba,{'showHidden':![],'depth':null}));if(this[_0x68e9('0xb')][_0xbd55ba[_0x68e9('0x1a')]]){this[_0x68e9('0xb')][_0xbd55ba[_0x68e9('0x1a')]][_0x68e9('0x30')]=_0xbd55ba[_0x68e9('0x30')];if(_0xbd55ba[_0x68e9('0x30')]==='ANSWER'){this[_0x68e9('0xb')][_0xbd55ba[_0x68e9('0x1a')]][_0x68e9('0x31')]=_0xbd55ba['connectedlinenum'];this[_0x68e9('0xb')][_0xbd55ba['uniqueid']][_0x68e9('0x32')]=_0xbd55ba['connectedlinename'];this[_0x68e9('0xb')][_0xbd55ba[_0x68e9('0x1a')]][_0x68e9('0x33')]=moment()[_0x68e9('0x1d')](_0x68e9('0x1e'));this[_0x68e9('0xb')][_0xbd55ba['uniqueid']]['lastevent']=_0x68e9('0x34');logger[_0x68e9('0x26')](_0x68e9('0x35'),_0xbd55ba[_0x68e9('0x1a')],_0xbd55ba[_0x68e9('0x21')][_0x68e9('0x20')](_0xbd55ba[_0x68e9('0x21')][_0x68e9('0x22')]('/')+0x1,_0xbd55ba[_0x68e9('0x21')]['lastIndexOf']('-')));logger[_0x68e9('0x29')](_0x68e9('0x36'),_0xbd55ba[_0x68e9('0x1a')],util['inspect'](this['channels'][_0xbd55ba[_0x68e9('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x68e9('0x19')]('custom:dialconnect',this[_0x68e9('0xb')][_0xbd55ba[_0x68e9('0x1a')]]);}logger[_0x68e9('0x29')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0xbd55ba['uniqueid'],util[_0x68e9('0x1b')](this[_0x68e9('0xb')][_0xbd55ba[_0x68e9('0x1a')]],{'showHidden':![],'depth':null}));this[_0x68e9('0x19')](_0x68e9('0x37'),_0x68e9('0x2b'),this[_0x68e9('0xb')][_0xbd55ba[_0x68e9('0x1a')]]);}}}catch(_0x468089){logger[_0x68e9('0x2d')](_0x68e9('0x38'),_0xbd55ba[_0x68e9('0x1a')],util[_0x68e9('0x1b')](_0x468089,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x68e9('0x16')]['syncVarSet']=function(_0x1c4ab4){try{if(this[_0x68e9('0x17')](_0x1c4ab4)){logger[_0x68e9('0x29')](_0x68e9('0x39'),_0x1c4ab4[_0x68e9('0x1a')],util[_0x68e9('0x1b')](_0x1c4ab4,{'showHidden':![],'depth':null}));this['addVariable'](_0x1c4ab4[_0x68e9('0x1a')],_[_0x68e9('0x3a')](_0x1c4ab4[_0x68e9('0x3b')])[0x0],_0x1c4ab4[_0x68e9('0x3c')]);if(this[_0x68e9('0x17')](_0x1c4ab4[_0x68e9('0x3b')])&&this[_0x68e9('0x17')](_0x1c4ab4[_0x68e9('0x3b')][_0x68e9('0x3d')])){if(_[_0x68e9('0x18')](this[_0x68e9('0xb')][_0x1c4ab4['uniqueid']])){this['channels'][_0x1c4ab4['uniqueid']]={'routeId':_0x1c4ab4['value'],'variables':this[_0x68e9('0xe')][_0x1c4ab4[_0x68e9('0x1a')]]};logger['info'](_0x68e9('0x3e'),_0x1c4ab4[_0x68e9('0x1a')],_0x1c4ab4[_0x68e9('0x3b')][_0x68e9('0x3d')],_['keys'](_0x1c4ab4[_0x68e9('0x3b')])[0x0],_0x1c4ab4['value']);logger['debug']('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x1c4ab4[_0x68e9('0x1a')],util['inspect'](this[_0x68e9('0xb')][_0x1c4ab4[_0x68e9('0x1a')]],{'showHidden':![],'depth':null}));this[_0x68e9('0x19')]('voice:outbound','voice_outbound_channel:save',this[_0x68e9('0xb')][_0x1c4ab4[_0x68e9('0x1a')]]);}}}}catch(_0x5a9731){logger[_0x68e9('0x2d')](_0x68e9('0x3f'),_0x1c4ab4[_0x68e9('0x1a')],util[_0x68e9('0x1b')](_0x5a9731,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x68e9('0x16')][_0x68e9('0x40')]=function(_0x5b651d,_0x4bc8ca,_0x58f3fd){var _0xd71d5a=[_0x68e9('0x41'),_0x68e9('0x42'),'rtpaudioqosjitter',_0x68e9('0x43'),_0x68e9('0x44'),_0x68e9('0x45'),_0x68e9('0x46'),'rtpaudioqosrttbridged',_0x68e9('0x47'),_0x68e9('0x48'),_0x68e9('0x49'),_0x68e9('0x4a'),_0x68e9('0x4b'),_0x68e9('0x4c'),_0x68e9('0x4d'),'memberlastcall','membername',_0x68e9('0x4e'),_0x68e9('0x4f')];if(!_['isNil'](_0x4bc8ca)&&!_[_0x68e9('0x50')](_0xd71d5a,_0x4bc8ca)){if(_[_0x68e9('0x18')](this['variables'][_0x5b651d])){this[_0x68e9('0xe')][_0x5b651d]={};}this[_0x68e9('0xe')][_0x5b651d][_0x4bc8ca]=_0x58f3fd;}};VoiceDialReport[_0x68e9('0x16')][_0x68e9('0x15')]=function(_0x2b6ae0){try{if(this[_0x68e9('0x17')](_0x2b6ae0)){logger[_0x68e9('0x29')](_0x68e9('0x51'),_0x2b6ae0[_0x68e9('0x1a')],util['inspect'](_0x2b6ae0,{'showHidden':![],'depth':null}));if(this['channels'][_0x2b6ae0[_0x68e9('0x1a')]]){logger[_0x68e9('0x26')](_0x68e9('0x52'),_0x2b6ae0['uniqueid'],_0x2b6ae0[_0x68e9('0x53')]);this['channels'][_0x2b6ae0['uniqueid']]['endtime']=moment()[_0x68e9('0x1d')](_0x68e9('0x1e'));this['channels'][_0x2b6ae0[_0x68e9('0x1a')]][_0x68e9('0x54')]=moment(this['channels'][_0x2b6ae0[_0x68e9('0x1a')]][_0x68e9('0x55')])[_0x68e9('0x56')](this[_0x68e9('0xb')][_0x2b6ae0[_0x68e9('0x1a')]]['starttime'],'seconds');this['channels'][_0x2b6ae0[_0x68e9('0x1a')]]['lastevent']='complete';this[_0x68e9('0xd')][_0x68e9('0x57')]+=0x1;if(this['channels'][_0x2b6ae0[_0x68e9('0x1a')]]['answertime']){this[_0x68e9('0xd')][_0x68e9('0x58')]+=0x1;this[_0x68e9('0xb')][_0x2b6ae0[_0x68e9('0x1a')]][_0x68e9('0x59')]=moment(this[_0x68e9('0xb')][_0x2b6ae0[_0x68e9('0x1a')]]['answertime'])[_0x68e9('0x56')](this['channels'][_0x2b6ae0[_0x68e9('0x1a')]][_0x68e9('0x5a')],_0x68e9('0x5b'));this['channels'][_0x2b6ae0[_0x68e9('0x1a')]][_0x68e9('0x5c')]=moment(this[_0x68e9('0xb')][_0x2b6ae0[_0x68e9('0x1a')]][_0x68e9('0x55')])[_0x68e9('0x56')](this[_0x68e9('0xb')][_0x2b6ae0[_0x68e9('0x1a')]][_0x68e9('0x33')],_0x68e9('0x5b'));this['outbound'][_0x68e9('0x5d')]+=this['channels'][_0x2b6ae0[_0x68e9('0x1a')]]['holdtime']||0x0;this[_0x68e9('0xd')][_0x68e9('0x5e')]+=this[_0x68e9('0xb')][_0x2b6ae0[_0x68e9('0x1a')]][_0x68e9('0x5c')];}this[_0x68e9('0xd')][_0x68e9('0x5f')]+=this[_0x68e9('0xb')][_0x2b6ae0[_0x68e9('0x1a')]][_0x68e9('0x54')];logger['debug'](_0x68e9('0x60'),_0x2b6ae0['uniqueid'],util[_0x68e9('0x1b')](this[_0x68e9('0xb')][_0x2b6ae0[_0x68e9('0x1a')]],{'showHidden':![],'depth':null}));ami['emit'](_0x68e9('0x61'),this[_0x68e9('0xb')][_0x2b6ae0[_0x68e9('0x1a')]]);logger[_0x68e9('0x29')](_0x68e9('0x62'),_0x2b6ae0['uniqueid'],util[_0x68e9('0x1b')](this[_0x68e9('0xb')][_0x2b6ae0['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x68e9('0x63'),this['channels'][_0x2b6ae0[_0x68e9('0x1a')]]);logger[_0x68e9('0x29')](_0x68e9('0x64'),_0x2b6ae0[_0x68e9('0x1a')],util[_0x68e9('0x1b')](this[_0x68e9('0xb')][_0x2b6ae0[_0x68e9('0x1a')]],{'showHidden':![],'depth':null}));this[_0x68e9('0x19')](_0x68e9('0x37'),'voice_outbound:save',this[_0x68e9('0xd')]);logger[_0x68e9('0x26')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x68e9('0x65')](this['channels'][_0x2b6ae0[_0x68e9('0x1a')]]));logger['debug'](_0x68e9('0x66'),_0x2b6ae0['uniqueid'],util[_0x68e9('0x1b')](this[_0x68e9('0xb')][_0x2b6ae0[_0x68e9('0x1a')]],{'showHidden':![],'depth':null}));this[_0x68e9('0x19')](_0x68e9('0x37'),_0x68e9('0x67'),this[_0x68e9('0xb')][_0x2b6ae0[_0x68e9('0x1a')]]);delete this[_0x68e9('0xb')][_0x2b6ae0[_0x68e9('0x1a')]];}else if(this[_0x68e9('0xb')][_0x2b6ae0[_0x68e9('0x68')]]){this[_0x68e9('0xb')][_0x2b6ae0[_0x68e9('0x68')]]['uniqueid']=this[_0x68e9('0xb')][_0x2b6ae0['linkedid']][_0x68e9('0x69')];}if(this[_0x68e9('0xe')][_0x2b6ae0[_0x68e9('0x1a')]]){delete this['variables'][_0x2b6ae0[_0x68e9('0x1a')]];}}}catch(_0x3d36e7){logger[_0x68e9('0x2d')]('[%s][voiceDialReport][hangup]',_0x2b6ae0[_0x68e9('0x1a')],util[_0x68e9('0x1b')](_0x3d36e7,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index a62c2ac..5fd43e9 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 _0xcd60=['[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','transfererchannel','mohstarttime','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','exports','lodash','moment','util','md5','ioredis','../../../config/environment','../../../config/logger','../ami','../model/queueReport','redis','defaults','socket.io-emitter','enqueue','tail','finally','queueReports','agents','channels','queueChannels','flagQueueSummary','campaigns','queuesummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','agentconnect','syncVarSet','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','loopQueueSummary','hasOwnProperty','isEmpty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','prototype','clearZombieChannels','switch','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error','inspect','[%s][voiceQueueReport][checkQueueReport]','variables','[%s][voiceQueueReport][checkVariables]','voiceQueues','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','uniqueid','format','voice:queue:%s','name','voice_queue_channel:save','voice_queue_presence:save','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:remove\x20event:','voice_queue_channel:remove','voice_queue_presence:remove','emitVoiceQueueSummary','type','strategy','available','sumBillable','sumDuration','sumHoldTime','total','abandoned','Trunk','active','callerid','Interval','stringify','[voiceQueueReport][','voice_queue:save','isNotNull','isUndefined','loopQueueShow','queues','then','queue','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedin','loggedIn','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','inbound','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','push','last','queuecallercomplete','holdtime','originalposition','queuecallerabandonAt','ABANDONED','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','syncAgentConnect','[%s][voiceQueueReport][agentconnect]','queuecallerexitreason','COMPLETEDBYAGENT','syncAgentComplete','[%s][voiceQueueReport][agentcomplete]','assigned','queuecallerexit','queuecallerexitAt','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','toLowerCase','local/','linkedid','add','FORWARDTRANSFER','transfertype','FORWARD','transferexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','addVariable','variable','value','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','membername','memberpenalty','memberrealtime','includes','diff','seconds','length','milliseconds','answered','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][hangup]','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','transferuniqueid','ATTENDEDTRANSFER','ATTENDED','secondtransfereruniqueid'];(function(_0x5b06c7,_0x1efdcf){var _0x7ec7b5=function(_0x3117a9){while(--_0x3117a9){_0x5b06c7['push'](_0x5b06c7['shift']());}};_0x7ec7b5(++_0x1efdcf);}(_0xcd60,0xf0));var _0x0cd6=function(_0x4736dc,_0x1799d6){_0x4736dc=_0x4736dc-0x0;var _0x59ae6b=_0xcd60[_0x4736dc];return _0x59ae6b;};'use strict';var _=require(_0x0cd6('0x0'));var moment=require(_0x0cd6('0x1'));var util=require(_0x0cd6('0x2'));var md5=require(_0x0cd6('0x3'));var Redis=require(_0x0cd6('0x4'));var config=require(_0x0cd6('0x5'));var logger=require(_0x0cd6('0x6'))('ami');var ami=require(_0x0cd6('0x7'));var QueueReport=require(_0x0cd6('0x8'));config[_0x0cd6('0x9')]=_[_0x0cd6('0xa')](config[_0x0cd6('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x0cd6('0xb'))(new Redis(config[_0x0cd6('0x9')]));var Sequence=function(){};Sequence['prototype'][_0x0cd6('0xc')]=function(_0x4fb298){this[_0x0cd6('0xd')]=this[_0x0cd6('0xd')]?this[_0x0cd6('0xd')][_0x0cd6('0xe')](_0x4fb298):_0x4fb298();};function VoiceQueueReport(_0x308ebe){this['sequence']=new Sequence();this[_0x0cd6('0xf')]={};this[_0x0cd6('0x10')]=_0x308ebe[_0x0cd6('0x10')];this[_0x0cd6('0x11')]=_0x308ebe[_0x0cd6('0x12')];this['voiceQueues']=_0x308ebe['voiceQueues'];this[_0x0cd6('0x13')]=!![];this[_0x0cd6('0x14')]=_0x308ebe[_0x0cd6('0x14')];this['variables']={};ami['on'](_0x0cd6('0x15'),this['syncQueueSummary'][_0x0cd6('0x16')](this));ami['on'](_0x0cd6('0x17'),this[_0x0cd6('0x18')][_0x0cd6('0x16')](this));ami['on'](_0x0cd6('0x19'),this[_0x0cd6('0x1a')][_0x0cd6('0x16')](this));ami['on'](_0x0cd6('0x1b'),this[_0x0cd6('0x1c')][_0x0cd6('0x16')](this));ami['on'](_0x0cd6('0x1d'),this[_0x0cd6('0x1e')][_0x0cd6('0x16')](this));ami['on'](_0x0cd6('0x1f'),this['syncAgentComplete'][_0x0cd6('0x16')](this));ami['on'](_0x0cd6('0x20'),this['syncAgentConnect']['bind'](this));ami['on']('varset',this[_0x0cd6('0x21')]['bind'](this));ami['on']('hangup',this[_0x0cd6('0x22')]['bind'](this));ami['on'](_0x0cd6('0x23'),this[_0x0cd6('0x24')][_0x0cd6('0x16')](this));ami['on'](_0x0cd6('0x25'),this[_0x0cd6('0x26')][_0x0cd6('0x16')](this));ami['on'](_0x0cd6('0x27'),this[_0x0cd6('0x28')]['bind'](this));ami['on'](_0x0cd6('0x29'),this[_0x0cd6('0x2a')][_0x0cd6('0x16')](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));this[_0x0cd6('0x2b')]();this['loopQueueShow']();}function clearChannels(_0x5ac9c0){if(!_['isEmpty'](_0x5ac9c0)){for(var _0x4beec7 in _0x5ac9c0){if(_0x5ac9c0[_0x0cd6('0x2c')](_0x4beec7)){delete _0x5ac9c0[_0x4beec7];}}}}function clearCampaigns(_0x37ff86){if(!_[_0x0cd6('0x2d')](_0x37ff86)){for(var _0x304a09 in _0x37ff86){if(_0x37ff86['hasOwnProperty'](_0x304a09)){_0x37ff86[_0x304a09]['originated']=0x0;}}}}function clearVoiceQueues(_0x147d7e){if(!_['isEmpty'](_0x147d7e)){for(var _0x1ccf34 in _0x147d7e){if(_0x147d7e[_0x0cd6('0x2c')](_0x1ccf34)){_0x147d7e[_0x1ccf34][_0x0cd6('0x2e')]=0x0;_0x147d7e[_0x1ccf34][_0x0cd6('0x2f')]=0x0;_0x147d7e[_0x1ccf34][_0x0cd6('0x30')]=0x0;_0x147d7e[_0x1ccf34][_0x0cd6('0x31')]=0x0;_0x147d7e[_0x1ccf34][_0x0cd6('0x32')]=!![];}}}}function clearAgentBooked(_0x341cee){if(!_[_0x0cd6('0x2d')](_0x341cee)){for(var _0x72c358 in _0x341cee){if(_0x341cee[_0x0cd6('0x2c')](_0x72c358)){_0x341cee[_0x72c358][_0x0cd6('0x33')]=!![];}}}}VoiceQueueReport[_0x0cd6('0x34')][_0x0cd6('0x35')]=function(){var _0x9226cd=this;for(var _0x26026d in this['channels']){if(this[_0x0cd6('0x11')][_0x0cd6('0x2c')](_0x26026d)&&!this[_0x0cd6('0x11')][_0x26026d][_0x0cd6('0x36')]){this['sequence'][_0x0cd6('0xc')](function(){if(!_[_0x0cd6('0x37')](_0x9226cd[_0x0cd6('0x11')][_0x26026d])){return ami[_0x0cd6('0x38')]({'action':_0x0cd6('0x39'),'channel':_0x9226cd['channels'][_0x26026d][_0x0cd6('0x3a')]})[_0x0cd6('0x3b')](function(_0xce8182){if(_0xce8182[_0x0cd6('0x3c')]===_0x0cd6('0x3d')){setTimeout(function(){if(_0x9226cd['channels'][_0x26026d]){delete _0x9226cd[_0x0cd6('0x11')][_0x26026d];logger[_0x0cd6('0x3e')]('[%s][voiceQueueReport][checkChannel]',_0x26026d,util[_0x0cd6('0x3f')](_0xce8182,{'showHidden':![],'depth':null}));}if(_0x9226cd[_0x0cd6('0xf')][_0x26026d]){delete _0x9226cd[_0x0cd6('0xf')][_0x26026d];logger['error'](_0x0cd6('0x40'),_0x26026d,util[_0x0cd6('0x3f')](_0xce8182,{'showHidden':![],'depth':null}));}if(_0x9226cd['variables'][_0x26026d]){delete _0x9226cd[_0x0cd6('0x41')][_0x26026d];logger[_0x0cd6('0x3e')](_0x0cd6('0x42'),_0x26026d,util['inspect'](_0xce8182,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x0cd6('0x34')][_0x0cd6('0x24')]=function(){logger[_0x0cd6('0x3e')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0x0cd6('0x11')]);this['clearQueueReport'](this[_0x0cd6('0xf')]);clearAgentBooked(this[_0x0cd6('0x10')]);clearVoiceQueues(this[_0x0cd6('0x43')]);clearCampaigns(this['campaigns']);};VoiceQueueReport[_0x0cd6('0x34')][_0x0cd6('0x44')]=function(_0x33d689){var _0x381281=this;if(!_[_0x0cd6('0x2d')](_0x33d689)){for(var _0x4ea027 in _0x33d689){if(_0x33d689['hasOwnProperty'](_0x4ea027)){_0x381281[_0x0cd6('0x45')](_0x33d689[_0x4ea027],_0x0cd6('0x46'));delete _0x33d689[_0x4ea027];}}}};VoiceQueueReport[_0x0cd6('0x34')][_0x0cd6('0x47')]=function(_0x550eb3,_0x8221ac,_0x23e510){io['to'](_0x550eb3)[_0x0cd6('0x47')](_0x8221ac,_0x23e510);};VoiceQueueReport[_0x0cd6('0x34')][_0x0cd6('0x48')]=function(_0x4393d0,_0x589d2c){logger[_0x0cd6('0x49')]('[%s][voiceQueueReport]['+_0x589d2c+']\x20sending\x20voice_queue_channel:save\x20event:',_0x4393d0[_0x0cd6('0x4a')],util[_0x0cd6('0x3f')](_0x4393d0,{'showHidden':![],'depth':null}));this['emit'](util[_0x0cd6('0x4b')](_0x0cd6('0x4c'),_0x4393d0[_0x0cd6('0x4d')]),_0x0cd6('0x4e'),_0x4393d0);io[_0x0cd6('0x47')](_0x0cd6('0x4f'),_0x4393d0);};VoiceQueueReport['prototype'][_0x0cd6('0x45')]=function(_0x8232fd,_0x25df64){logger[_0x0cd6('0x49')](_0x0cd6('0x50')+_0x25df64+_0x0cd6('0x51'),_0x8232fd[_0x0cd6('0x4a')],util[_0x0cd6('0x3f')](_0x8232fd,{'showHidden':![],'depth':null}));this['emit'](util[_0x0cd6('0x4b')](_0x0cd6('0x4c'),_0x8232fd['name']),_0x0cd6('0x52'),_0x8232fd);io[_0x0cd6('0x47')](_0x0cd6('0x53'),_0x8232fd);};VoiceQueueReport[_0x0cd6('0x34')][_0x0cd6('0x54')]=function(_0x417b40,_0x2c69af){if(_0x417b40[_0x0cd6('0x55')]==='inbound'){var _0x124cca={'id':_0x417b40['id'],'name':_0x417b40[_0x0cd6('0x4d')],'strategy':_0x417b40[_0x0cd6('0x56')],'answered':_0x417b40['answered'],'available':_0x417b40[_0x0cd6('0x57')],'loggedIn':_0x417b40['loggedIn'],'pTalking':_0x417b40[_0x0cd6('0x30')],'sumBillable':_0x417b40[_0x0cd6('0x58')],'sumDuration':_0x417b40[_0x0cd6('0x59')],'sumHoldTime':_0x417b40[_0x0cd6('0x5a')]||0x0,'talking':_0x417b40[_0x0cd6('0x2f')],'total':_0x417b40[_0x0cd6('0x5b')],'type':_0x417b40[_0x0cd6('0x55')],'unmanaged':_0x417b40['unmanaged'],'abandoned':_0x417b40[_0x0cd6('0x5c')],'waiting':_0x417b40[_0x0cd6('0x31')]};if(_0x417b40[_0x0cd6('0x5d')]){_0x124cca[_0x0cd6('0x5d')]={'id':_0x417b40[_0x0cd6('0x5d')]['id'],'name':_0x417b40['Trunk'][_0x0cd6('0x4d')],'active':_0x417b40[_0x0cd6('0x5d')][_0x0cd6('0x5e')],'callerid':_0x417b40[_0x0cd6('0x5d')][_0x0cd6('0x5f')]};}if(_0x417b40[_0x0cd6('0x60')]){_0x124cca[_0x0cd6('0x60')]={'id':_0x417b40['Interval']['id'],'name':_0x417b40['Interval'][_0x0cd6('0x4d')]};}var _0x3e4ce2=md5(JSON[_0x0cd6('0x61')](_0x124cca));if(_0x417b40[_0x0cd6('0x3')]!==_0x3e4ce2){_0x417b40['md5']=_0x3e4ce2;logger[_0x0cd6('0x49')](_0x0cd6('0x62')+_0x2c69af+']\x20sending\x20voice_queue:save\x20event:',util[_0x0cd6('0x3f')](_0x124cca,{'showHidden':![],'depth':null}));this[_0x0cd6('0x47')](util[_0x0cd6('0x4b')]('voice:queue:%s',_0x124cca[_0x0cd6('0x4d')]),_0x0cd6('0x63'),_0x124cca);}}};VoiceQueueReport['prototype'][_0x0cd6('0x64')]=function(_0x12aa65){return _0x12aa65!==null&&!_[_0x0cd6('0x65')](_0x12aa65);};VoiceQueueReport[_0x0cd6('0x34')][_0x0cd6('0x66')]=function(){var _0x307b4b=this;setInterval(function(){_0x307b4b[_0x0cd6('0x35')]();ami[_0x0cd6('0x38')]({'action':_0x0cd6('0x67')})[_0x0cd6('0x3b')](function(_0x4d2885){logger[_0x0cd6('0x3e')]('[voiceQueueReport][queues]',util[_0x0cd6('0x3f')](_0x4d2885,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x0cd6('0x34')][_0x0cd6('0x2b')]=function(){var _0xd2dc64=this;setInterval(function(){if(_0xd2dc64[_0x0cd6('0x13')]){return ami[_0x0cd6('0x38')]({'action':_0x0cd6('0x15')})[_0x0cd6('0x68')](function(_0x4bd5dd){_0xd2dc64[_0x0cd6('0x13')]=![];})[_0x0cd6('0x3b')](function(_0x1d9835){logger[_0x0cd6('0x3e')]('[voiceQueueReport][queuesummary]',util['inspect'](_0x1d9835,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x0cd6('0x34')]['syncQueueSummary']=function(_0x38e284){try{if(this[_0x0cd6('0x64')](_0x38e284)&&this[_0x0cd6('0x64')](_0x38e284[_0x0cd6('0x69')])){logger[_0x0cd6('0x49')](_0x0cd6('0x6a'),util[_0x0cd6('0x3f')](_0x38e284,{'showHidden':![],'depth':null}));if(this[_0x0cd6('0x43')][_0x38e284['queue']]){logger[_0x0cd6('0x6b')](_0x0cd6('0x6c'),_0x38e284[_0x0cd6('0x69')]);var _0x430f55=_[_0x0cd6('0x6d')](this[_0x0cd6('0x11')],_0x0cd6('0x69'))[_0x38e284[_0x0cd6('0x69')]]||0x0;var _0x292c85=_0x430f55-_0x38e284[_0x0cd6('0x6e')];if(this[_0x0cd6('0x43')][_0x38e284['queue']][_0x0cd6('0x31')]!==_[_0x0cd6('0x6f')](_0x38e284[_0x0cd6('0x6e')])||this[_0x0cd6('0x43')][_0x38e284[_0x0cd6('0x69')]]['loggedIn']!==_[_0x0cd6('0x6f')](_0x38e284[_0x0cd6('0x70')])||this[_0x0cd6('0x43')][_0x38e284['queue']][_0x0cd6('0x57')]!==_[_0x0cd6('0x6f')](_0x38e284[_0x0cd6('0x57')])||this[_0x0cd6('0x43')][_0x38e284[_0x0cd6('0x69')]]['talking']!==_0x292c85){this[_0x0cd6('0x43')][_0x38e284[_0x0cd6('0x69')]][_0x0cd6('0x31')]=_['toNumber'](_0x38e284[_0x0cd6('0x6e')]);this[_0x0cd6('0x43')][_0x38e284['queue']][_0x0cd6('0x71')]=_['toNumber'](_0x38e284['loggedin']);this[_0x0cd6('0x43')][_0x38e284['queue']][_0x0cd6('0x57')]=_[_0x0cd6('0x6f')](_0x38e284['available']);this[_0x0cd6('0x43')][_0x38e284[_0x0cd6('0x69')]][_0x0cd6('0x2f')]=_0x292c85>0x0?_0x292c85:0x0;this[_0x0cd6('0x43')][_0x38e284[_0x0cd6('0x69')]][_0x0cd6('0x2f')]=this[_0x0cd6('0x43')][_0x38e284['queue']][_0x0cd6('0x2f')]>_[_0x0cd6('0x6f')](_0x38e284[_0x0cd6('0x70')])?_[_0x0cd6('0x6f')](_0x38e284[_0x0cd6('0x70')]):this[_0x0cd6('0x43')][_0x38e284['queue']][_0x0cd6('0x2f')];this[_0x0cd6('0x54')](this['voiceQueues'][_0x38e284['queue']],_0x0cd6('0x15'));}logger['debug'](_0x0cd6('0x72'),util[_0x0cd6('0x3f')](this['voiceQueues'][_0x38e284[_0x0cd6('0x69')]],{'showHidden':![],'depth':null}));ami[_0x0cd6('0x47')](_0x0cd6('0x73'),this[_0x0cd6('0x43')][_0x38e284[_0x0cd6('0x69')]]);}}}catch(_0x2f21c7){logger[_0x0cd6('0x3e')]('[voiceQueueReport][queuesummary]',util[_0x0cd6('0x3f')](_0x2f21c7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0cd6('0x34')]['syncQueueSummaryComplete']=function(_0x42e955){logger['debug'](_0x0cd6('0x74'),util[_0x0cd6('0x3f')](_0x42e955,{'showHidden':![],'depth':null}));this[_0x0cd6('0x13')]=!![];};VoiceQueueReport[_0x0cd6('0x34')][_0x0cd6('0x1a')]=function(_0x5babcd){try{if(this[_0x0cd6('0x64')](_0x5babcd)){logger[_0x0cd6('0x49')](_0x0cd6('0x75'),_0x5babcd[_0x0cd6('0x4a')],util[_0x0cd6('0x3f')](_0x5babcd,{'showHidden':![],'depth':null}));if(_[_0x0cd6('0x65')](this[_0x0cd6('0xf')][_0x5babcd['uniqueid']])){this[_0x0cd6('0xf')][_0x5babcd[_0x0cd6('0x4a')]]=[];this[_0x0cd6('0x11')][_0x5babcd[_0x0cd6('0x4a')]]={};}var _0x529c89=new QueueReport();_0x529c89[_0x0cd6('0x4d')]=_0x5babcd['queue'];_0x529c89['type']=this[_0x0cd6('0x43')][_0x529c89[_0x0cd6('0x4d')]]&&this['voiceQueues'][_0x529c89[_0x0cd6('0x4d')]][_0x0cd6('0x55')]?this[_0x0cd6('0x43')][_0x529c89[_0x0cd6('0x4d')]][_0x0cd6('0x55')]||_0x0cd6('0x76'):_0x0cd6('0x76');_0x529c89[_0x0cd6('0x69')]=_0x5babcd[_0x0cd6('0x69')];_0x529c89[_0x0cd6('0x77')]=moment()['format'](_0x0cd6('0x78'));_0x529c89[_0x0cd6('0x79')]=_0x5babcd['position'];_0x529c89[_0x0cd6('0x7a')]=_0x5babcd[_0x0cd6('0x7a')];_0x529c89[_0x0cd6('0x4a')]=_0x5babcd[_0x0cd6('0x4a')];logger[_0x0cd6('0x6b')](_0x0cd6('0x7b'),_0x529c89['name'],_0x529c89[_0x0cd6('0x55')]);_[_0x0cd6('0x7c')](_0x529c89,_[_0x0cd6('0x7d')](_0x5babcd,_[_0x0cd6('0x7e')](_0x529c89)));this['queueReports'][_0x5babcd[_0x0cd6('0x4a')]][_0x0cd6('0x7f')](_0x529c89);this[_0x0cd6('0x11')][_0x5babcd[_0x0cd6('0x4a')]]=_0x529c89;this[_0x0cd6('0x48')](_0x529c89,_0x0cd6('0x19'));}}catch(_0x1fac1f){logger[_0x0cd6('0x3e')](_0x0cd6('0x75'),_0x5babcd[_0x0cd6('0x4a')],util[_0x0cd6('0x3f')](_0x1fac1f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0cd6('0x34')][_0x0cd6('0x1c')]=function(_0x25c822){try{if(this[_0x0cd6('0x64')](_0x25c822)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x25c822['uniqueid'],util[_0x0cd6('0x3f')](_0x25c822,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x25c822['uniqueid']]){var _0x2385f1=_[_0x0cd6('0x80')](this[_0x0cd6('0xf')][_0x25c822['uniqueid']]);_0x2385f1[_0x0cd6('0x81')]=![];_0x2385f1['queuecallercompleteAt']=null;_0x2385f1['holdtime']=_0x25c822[_0x0cd6('0x82')];_0x2385f1[_0x0cd6('0x83')]=_0x25c822[_0x0cd6('0x83')];_0x2385f1[_0x0cd6('0x1b')]=!![];_0x2385f1[_0x0cd6('0x84')]=moment()[_0x0cd6('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x2385f1['queuecallerexitreason']=_0x0cd6('0x85');_0x2385f1['lastAssignedTo']=null;logger['info'](_0x0cd6('0x86'),_0x2385f1[_0x0cd6('0x4d')],_0x2385f1['type']);this[_0x0cd6('0x11')][_0x25c822['uniqueid']]=_0x2385f1;this[_0x0cd6('0x45')](_0x2385f1,_0x0cd6('0x1b'));}}}catch(_0x14481f){logger[_0x0cd6('0x3e')]('[%s][voiceQueueReport][queuecallerabandon]',_0x25c822['uniqueid'],util[_0x0cd6('0x3f')](_0x14481f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0cd6('0x34')]['syncQueueCallerLeave']=function(_0x17d530){try{if(this['isNotNull'](_0x17d530)){logger['debug'](_0x0cd6('0x87'),_0x17d530['uniqueid'],util[_0x0cd6('0x3f')](_0x17d530,{'showHidden':![],'depth':null}));if(this[_0x0cd6('0xf')][_0x17d530[_0x0cd6('0x4a')]]){var _0x253d44=_[_0x0cd6('0x80')](this[_0x0cd6('0xf')][_0x17d530[_0x0cd6('0x4a')]]);_0x253d44[_0x0cd6('0x88')]=moment()[_0x0cd6('0x4b')](_0x0cd6('0x78'));_0x253d44[_0x0cd6('0x89')]=_0x17d530[_0x0cd6('0x89')];_0x253d44[_0x0cd6('0x8a')]=_0x17d530[_0x0cd6('0x8a')];logger[_0x0cd6('0x6b')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x253d44['name'],_0x253d44['type'],_0x17d530['connectedlinenum'],_0x17d530[_0x0cd6('0x8a')]);this[_0x0cd6('0x11')][_0x17d530['uniqueid']]=_0x253d44;this[_0x0cd6('0x48')](_0x253d44,'queuecallerleave');}}}catch(_0x5bd232){logger[_0x0cd6('0x3e')](_0x0cd6('0x87'),_0x17d530[_0x0cd6('0x4a')],util[_0x0cd6('0x3f')](_0x5bd232,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0cd6('0x8b')]=function(_0x554862){try{if(this['isNotNull'](_0x554862)){logger[_0x0cd6('0x49')](_0x0cd6('0x8c'),_0x554862[_0x0cd6('0x4a')],util['inspect'](_0x554862,{'showHidden':![],'depth':null}));if(this[_0x0cd6('0xf')][_0x554862[_0x0cd6('0x4a')]]){var _0x3d7e05=_['last'](this['queueReports'][_0x554862['uniqueid']]);_0x3d7e05['queuecallercomplete']=!![];_0x3d7e05[_0x0cd6('0x8d')]=_0x0cd6('0x8e');logger[_0x0cd6('0x6b')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x3d7e05[_0x0cd6('0x4d')],_0x3d7e05[_0x0cd6('0x55')]);}}}catch(_0x2ef02c){logger[_0x0cd6('0x3e')]('[%s][voiceQueueReport][agentconnect]',_0x554862[_0x0cd6('0x4a')],util[_0x0cd6('0x3f')](_0x2ef02c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0cd6('0x34')][_0x0cd6('0x8f')]=function(_0x4b6b7c){try{if(this[_0x0cd6('0x64')](_0x4b6b7c)){logger[_0x0cd6('0x49')](_0x0cd6('0x90'),_0x4b6b7c['uniqueid'],util[_0x0cd6('0x3f')](_0x4b6b7c,{'showHidden':![],'depth':null}));if(this[_0x0cd6('0xf')][_0x4b6b7c[_0x0cd6('0x4a')]]){var _0x2d43ba=_[_0x0cd6('0x80')](this[_0x0cd6('0xf')][_0x4b6b7c[_0x0cd6('0x4a')]]);_0x2d43ba[_0x0cd6('0x1b')]=![];_0x2d43ba[_0x0cd6('0x84')]=null;_0x2d43ba[_0x0cd6('0x91')]=!![];_0x2d43ba['lastAssignedTo']=_0x4b6b7c['membername'];_0x2d43ba[_0x0cd6('0x82')]=_0x4b6b7c[_0x0cd6('0x82')];_0x2d43ba[_0x0cd6('0x81')]=!![];_0x2d43ba[_0x0cd6('0x92')]=![];_0x2d43ba[_0x0cd6('0x93')]=null;if(!_0x2d43ba[_0x0cd6('0x94')]){if(_0x4b6b7c['reason']=='transfer'){_0x2d43ba['queuecallerexitreason']=_0x0cd6('0x95');logger[_0x0cd6('0x6b')](_0x0cd6('0x96'),_0x2d43ba[_0x0cd6('0x4d')],_0x2d43ba[_0x0cd6('0x55')]);}else{if(_['startsWith'](_0x4b6b7c[_0x0cd6('0x3a')][_0x0cd6('0x97')](),_0x0cd6('0x98'))){if(this[_0x0cd6('0xf')][_0x4b6b7c[_0x0cd6('0x99')]]){var _0x3e351b=_[_0x0cd6('0x80')](this['queueReports'][_0x4b6b7c[_0x0cd6('0x99')]]);_0x3e351b[_0x0cd6('0x81')]=![];_0x3e351b[_0x0cd6('0x92')]=!![];_0x3e351b[_0x0cd6('0x93')]=moment(_0x2d43ba[_0x0cd6('0x77')])[_0x0cd6('0x9a')](_0x4b6b7c[_0x0cd6('0x82')],'seconds')[_0x0cd6('0x4b')](_0x0cd6('0x78'));_0x3e351b[_0x0cd6('0x8d')]=_0x0cd6('0x9b');_0x3e351b['transfer']=!![];_0x3e351b[_0x0cd6('0x9c')]=_0x0cd6('0x9d');_0x3e351b[_0x0cd6('0x9e')]=_0x4b6b7c['destexten'];_0x3e351b['transferuniqueid']=_0x4b6b7c[_0x0cd6('0x4a')];logger['info'](_0x0cd6('0x9f'),_0x3e351b['name'],_0x3e351b[_0x0cd6('0x55')]);var _0x2d4051=this[_0x0cd6('0xf')][_0x4b6b7c[_0x0cd6('0x99')]];this[_0x0cd6('0xf')][_0x4b6b7c[_0x0cd6('0x99')]]=this[_0x0cd6('0xf')][_0x4b6b7c['uniqueid']];this['queueReports'][_0x4b6b7c['uniqueid']]=_0x2d4051;}}else{_0x2d43ba['queuecallerexitreason']='COMPLETEDBY'+_0x4b6b7c['reason'][_0x0cd6('0xa0')]();logger[_0x0cd6('0x6b')](_0x0cd6('0xa1'),_0x2d43ba['name'],_0x2d43ba[_0x0cd6('0x55')],_0x2d43ba[_0x0cd6('0x8d')]);}}}this[_0x0cd6('0x11')][_0x4b6b7c[_0x0cd6('0x4a')]]=_0x2d43ba;this[_0x0cd6('0x45')](_0x2d43ba,'agentcomplete');}}}catch(_0x553be8){logger[_0x0cd6('0x3e')](_0x0cd6('0x90'),_0x4b6b7c[_0x0cd6('0x4a')],util['inspect'](_0x553be8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0cd6('0x21')]=function(_0x118cb1){try{if(this[_0x0cd6('0x64')](_0x118cb1)){logger['debug']('[%s][voiceQueueReport][varset]',_0x118cb1[_0x0cd6('0x4a')],util[_0x0cd6('0x3f')](_0x118cb1,{'showHidden':![],'depth':null}));this[_0x0cd6('0xa2')](_0x118cb1[_0x0cd6('0x4a')],_['keys'](_0x118cb1[_0x0cd6('0xa3')])[0x0],_0x118cb1[_0x0cd6('0xa4')]);if(this[_0x0cd6('0xf')][_0x118cb1[_0x0cd6('0x4a')]]){var _0x8afeba=_[_0x0cd6('0x80')](this[_0x0cd6('0xf')][_0x118cb1[_0x0cd6('0x4a')]]);if(_0x8afeba){if(this['isNotNull'](_0x118cb1[_0x0cd6('0xa3')])&&this[_0x0cd6('0x64')](_0x118cb1[_0x0cd6('0xa3')]['queuestatus'])){switch(_0x118cb1[_0x0cd6('0xa4')]){case'CONTINUE':_0x8afeba[_0x0cd6('0x92')]=![];_0x8afeba[_0x0cd6('0x93')]=null;break;case _0x0cd6('0xa5'):_0x8afeba[_0x0cd6('0xa6')]=_0x0cd6('0xa7');_0x8afeba[_0x0cd6('0x92')]=!![];_0x8afeba[_0x0cd6('0x93')]=moment()[_0x0cd6('0x4b')](_0x0cd6('0x78'));_0x8afeba[_0x0cd6('0x88')]=moment()[_0x0cd6('0x4b')](_0x0cd6('0x78'));logger[_0x0cd6('0x49')](_0x0cd6('0xa8'),_0x118cb1[_0x0cd6('0x4a')],util[_0x0cd6('0x3f')](_0x8afeba,{'showHidden':![],'depth':null}));ami['emit'](_0x0cd6('0xa9'),_0x8afeba);break;default:_0x8afeba[_0x0cd6('0x92')]=!![];_0x8afeba['queuecallerexitAt']=moment()[_0x0cd6('0x4b')](_0x0cd6('0x78'));_0x8afeba['queuecallerleaveAt']=moment()[_0x0cd6('0x4b')](_0x0cd6('0x78'));}_0x8afeba[_0x0cd6('0x1b')]=![];_0x8afeba[_0x0cd6('0x84')]=null;_0x8afeba[_0x0cd6('0x8d')]=_0x118cb1[_0x0cd6('0xa4')];this[_0x0cd6('0x11')][_0x118cb1[_0x0cd6('0x4a')]]=_0x8afeba;this[_0x0cd6('0x45')](_0x8afeba,'varset');}else if(this[_0x0cd6('0x64')](_0x118cb1[_0x0cd6('0xa3')])&&this[_0x0cd6('0x64')](_0x118cb1[_0x0cd6('0xa3')][_0x0cd6('0xaa')])){if(!_0x8afeba[_0x0cd6('0x1b')]){_0x8afeba[_0x0cd6('0x92')]=!![];_0x8afeba[_0x0cd6('0x93')]=moment()[_0x0cd6('0x4b')](_0x0cd6('0x78'));_0x8afeba[_0x0cd6('0x8d')]='EXITWITHKEY';_0x8afeba[_0x0cd6('0x88')]=moment()[_0x0cd6('0x4b')](_0x0cd6('0x78'));this['channels'][_0x118cb1[_0x0cd6('0x4a')]]=_0x8afeba;}}logger[_0x0cd6('0x6b')](_0x0cd6('0xab'),_0x118cb1[_0x0cd6('0x4a')],_0x8afeba[_0x0cd6('0x4d')],_0x8afeba[_0x0cd6('0x55')],_[_0x0cd6('0x7e')](_0x118cb1['variable'])[0x0],_0x118cb1[_0x0cd6('0xa4')]);_0x8afeba[_0x0cd6('0x41')]=this['variables'][_0x118cb1[_0x0cd6('0x4a')]];}}}}catch(_0x38c333){logger[_0x0cd6('0x3e')]('[%s][voiceQueueReport][varset]',_0x118cb1['uniqueid'],util[_0x0cd6('0x3f')](_0x38c333,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0cd6('0x34')]['addVariable']=function(_0x2174e3,_0x40306a,_0x437aae){var _0x5d12b0=[_0x0cd6('0xac'),_0x0cd6('0xad'),'rtpaudioqosjitter',_0x0cd6('0xae'),_0x0cd6('0xaf'),'rtpaudioqoslossbridged',_0x0cd6('0xb0'),'rtpaudioqosrttbridged',_0x0cd6('0xb1'),_0x0cd6('0xb2'),_0x0cd6('0xb3'),_0x0cd6('0xb4'),_0x0cd6('0xb5'),'memberdynamic',_0x0cd6('0xb6'),'memberlastcall',_0x0cd6('0xb7'),_0x0cd6('0xb8'),_0x0cd6('0xb9')];if(!_[_0x0cd6('0x37')](_0x40306a)&&!_[_0x0cd6('0xba')](_0x5d12b0,_0x40306a)){if(_[_0x0cd6('0x65')](this[_0x0cd6('0x41')][_0x2174e3])){this[_0x0cd6('0x41')][_0x2174e3]={};}this[_0x0cd6('0x41')][_0x2174e3][_0x40306a]=_0x437aae;}};VoiceQueueReport[_0x0cd6('0x34')][_0x0cd6('0x22')]=function(_0x2b4d07){try{if(this['isNotNull'](_0x2b4d07)){logger[_0x0cd6('0x49')]('[%s][voiceQueueReport][hangup]',_0x2b4d07[_0x0cd6('0x4a')],util['inspect'](_0x2b4d07,{'showHidden':![],'depth':null}));if(this[_0x0cd6('0xf')][_0x2b4d07['uniqueid']]){for(var _0x381d11=0x0,_0x4fa713={};_0x381d110x0?_0x3a3058:0x0;this['voiceQueues'][_0x20238b[_0xbae2('0x63')]][_0xbae2('0x2e')]=this[_0xbae2('0x10')][_0x20238b[_0xbae2('0x63')]][_0xbae2('0x2e')]>_[_0xbae2('0x67')](_0x20238b[_0xbae2('0x68')])?_['toNumber'](_0x20238b['loggedin']):this[_0xbae2('0x10')][_0x20238b[_0xbae2('0x63')]][_0xbae2('0x2e')];this[_0xbae2('0x69')](this[_0xbae2('0x10')][_0x20238b[_0xbae2('0x63')]],'queuesummary');}logger[_0xbae2('0x5b')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util['inspect'](this[_0xbae2('0x10')][_0x20238b['queue']],{'showHidden':![],'depth':null}));ami[_0xbae2('0x44')](_0xbae2('0x6a'),this['voiceQueues'][_0x20238b[_0xbae2('0x63')]]);}}}catch(_0xfb4696){logger[_0xbae2('0x3b')]('[voiceQueueReport][queuesummary]',util[_0xbae2('0x3d')](_0xfb4696,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbae2('0x42')][_0xbae2('0x17')]=function(_0x298ab2){logger[_0xbae2('0x5b')](_0xbae2('0x6b'),util[_0xbae2('0x3d')](_0x298ab2,{'showHidden':![],'depth':null}));this[_0xbae2('0x11')]=!![];};VoiceQueueReport[_0xbae2('0x42')][_0xbae2('0x19')]=function(_0x32e212){try{if(this[_0xbae2('0x5d')](_0x32e212)){logger[_0xbae2('0x5b')](_0xbae2('0x6c'),_0x32e212[_0xbae2('0x47')],util[_0xbae2('0x3d')](_0x32e212,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x32e212[_0xbae2('0x47')]])){this['queueReports'][_0x32e212[_0xbae2('0x47')]]=[];this['channels'][_0x32e212['uniqueid']]={};}var _0x14405a=new QueueReport();_0x14405a[_0xbae2('0x4a')]=_0x32e212['queue'];_0x14405a['type']=this[_0xbae2('0x10')][_0x14405a[_0xbae2('0x4a')]]&&this[_0xbae2('0x10')][_0x14405a[_0xbae2('0x4a')]][_0xbae2('0x4f')]?this[_0xbae2('0x10')][_0x14405a[_0xbae2('0x4a')]][_0xbae2('0x4f')]||_0xbae2('0x50'):_0xbae2('0x50');_0x14405a['queue']=_0x32e212[_0xbae2('0x63')];_0x14405a[_0xbae2('0x6d')]=moment()[_0xbae2('0x48')](_0xbae2('0x6e'));_0x14405a[_0xbae2('0x6f')]=_0x32e212[_0xbae2('0x6f')];_0x14405a[_0xbae2('0x70')]=_0x32e212[_0xbae2('0x70')];_0x14405a['uniqueid']=_0x32e212[_0xbae2('0x47')];logger[_0xbae2('0x71')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x14405a[_0xbae2('0x4a')],_0x14405a[_0xbae2('0x4f')]);_[_0xbae2('0x72')](_0x14405a,_[_0xbae2('0x73')](_0x32e212,_['keys'](_0x14405a)));this[_0xbae2('0xe')][_0x32e212['uniqueid']][_0xbae2('0x74')](_0x14405a);this[_0xbae2('0x33')][_0x32e212[_0xbae2('0x47')]]=_0x14405a;this[_0xbae2('0x45')](_0x14405a,_0xbae2('0x18'));}}catch(_0x55a538){logger[_0xbae2('0x3b')](_0xbae2('0x6c'),_0x32e212[_0xbae2('0x47')],util[_0xbae2('0x3d')](_0x55a538,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xbae2('0x1a')]=function(_0x54115b){try{if(this['isNotNull'](_0x54115b)){logger[_0xbae2('0x5b')](_0xbae2('0x75'),_0x54115b[_0xbae2('0x47')],util['inspect'](_0x54115b,{'showHidden':![],'depth':null}));if(this[_0xbae2('0xe')][_0x54115b['uniqueid']]){var _0x1641cc=_['last'](this['queueReports'][_0x54115b[_0xbae2('0x47')]]);_0x1641cc[_0xbae2('0x76')]=![];_0x1641cc[_0xbae2('0x77')]=null;_0x1641cc[_0xbae2('0x78')]=_0x54115b['holdtime'];_0x1641cc[_0xbae2('0x79')]=_0x54115b['originalposition'];_0x1641cc[_0xbae2('0x7a')]=!![];_0x1641cc[_0xbae2('0x7b')]=moment()[_0xbae2('0x48')](_0xbae2('0x6e'));_0x1641cc[_0xbae2('0x7c')]=_0xbae2('0x7d');_0x1641cc[_0xbae2('0x7e')]=null;logger[_0xbae2('0x71')](_0xbae2('0x7f'),_0x1641cc[_0xbae2('0x4a')],_0x1641cc[_0xbae2('0x4f')]);this[_0xbae2('0x33')][_0x54115b['uniqueid']]=_0x1641cc;this[_0xbae2('0x43')](_0x1641cc,_0xbae2('0x7a'));}}}catch(_0x3f9568){logger[_0xbae2('0x3b')]('[%s][voiceQueueReport][queuecallerabandon]',_0x54115b[_0xbae2('0x47')],util[_0xbae2('0x3d')](_0x3f9568,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbae2('0x42')]['syncQueueCallerLeave']=function(_0x13f5c7){try{if(this[_0xbae2('0x5d')](_0x13f5c7)){logger[_0xbae2('0x5b')](_0xbae2('0x80'),_0x13f5c7[_0xbae2('0x47')],util[_0xbae2('0x3d')](_0x13f5c7,{'showHidden':![],'depth':null}));if(this[_0xbae2('0xe')][_0x13f5c7[_0xbae2('0x47')]]){var _0x31ccfd=_[_0xbae2('0x81')](this[_0xbae2('0xe')][_0x13f5c7[_0xbae2('0x47')]]);_0x31ccfd['queuecallerleaveAt']=moment()[_0xbae2('0x48')](_0xbae2('0x6e'));_0x31ccfd[_0xbae2('0x82')]=_0x13f5c7['connectedlinenum'];_0x31ccfd[_0xbae2('0x83')]=_0x13f5c7[_0xbae2('0x83')];logger[_0xbae2('0x71')](_0xbae2('0x84'),_0x31ccfd[_0xbae2('0x4a')],_0x31ccfd[_0xbae2('0x4f')],_0x13f5c7[_0xbae2('0x82')],_0x13f5c7[_0xbae2('0x83')]);this[_0xbae2('0x33')][_0x13f5c7[_0xbae2('0x47')]]=_0x31ccfd;this[_0xbae2('0x45')](_0x31ccfd,_0xbae2('0x1b'));}}}catch(_0x19c3f9){logger[_0xbae2('0x3b')]('[%s][voiceQueueReport][queuecallerleave]',_0x13f5c7['uniqueid'],util[_0xbae2('0x3d')](_0x19c3f9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbae2('0x42')][_0xbae2('0x20')]=function(_0x1aeb00){try{if(this['isNotNull'](_0x1aeb00)){logger[_0xbae2('0x5b')]('[%s][voiceQueueReport][agentconnect]',_0x1aeb00[_0xbae2('0x47')],util[_0xbae2('0x3d')](_0x1aeb00,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1aeb00[_0xbae2('0x47')]]){var _0xc5aa81=_[_0xbae2('0x81')](this[_0xbae2('0xe')][_0x1aeb00['uniqueid']]);_0xc5aa81[_0xbae2('0x76')]=!![];_0xc5aa81['queuecallerexitreason']=_0xbae2('0x85');logger['info'](_0xbae2('0x86'),_0xc5aa81[_0xbae2('0x4a')],_0xc5aa81[_0xbae2('0x4f')]);}}}catch(_0x32a3c3){logger[_0xbae2('0x3b')](_0xbae2('0x87'),_0x1aeb00[_0xbae2('0x47')],util[_0xbae2('0x3d')](_0x32a3c3,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xbae2('0x1e')]=function(_0x4023f2){try{if(this[_0xbae2('0x5d')](_0x4023f2)){logger[_0xbae2('0x5b')](_0xbae2('0x88'),_0x4023f2[_0xbae2('0x47')],util[_0xbae2('0x3d')](_0x4023f2,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4023f2['uniqueid']]){var _0x35518d=_['last'](this[_0xbae2('0xe')][_0x4023f2[_0xbae2('0x47')]]);_0x35518d['queuecallerabandon']=![];_0x35518d['queuecallerabandonAt']=null;_0x35518d['assigned']=!![];_0x35518d[_0xbae2('0x7e')]=_0x4023f2[_0xbae2('0x89')];_0x35518d[_0xbae2('0x78')]=_0x4023f2[_0xbae2('0x78')];_0x35518d[_0xbae2('0x76')]=!![];_0x35518d['queuecallerexit']=![];_0x35518d[_0xbae2('0x8a')]=null;if(!_0x35518d[_0xbae2('0x8b')]){if(_0x4023f2[_0xbae2('0x8c')]==_0xbae2('0x8b')){_0x35518d[_0xbae2('0x7c')]=_0xbae2('0x8d');logger[_0xbae2('0x71')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x35518d[_0xbae2('0x4a')],_0x35518d[_0xbae2('0x4f')]);}else{if(_['startsWith'](_0x4023f2['channel']['toLowerCase'](),'local/')){if(this[_0xbae2('0xe')][_0x4023f2['linkedid']]){var _0x444d18=_[_0xbae2('0x81')](this['queueReports'][_0x4023f2['linkedid']]);_0x444d18[_0xbae2('0x76')]=![];_0x444d18['queuecallerexit']=!![];_0x444d18[_0xbae2('0x8a')]=moment(_0x35518d[_0xbae2('0x6d')])['add'](_0x4023f2['holdtime'],_0xbae2('0x8e'))[_0xbae2('0x48')](_0xbae2('0x6e'));_0x444d18[_0xbae2('0x7c')]=_0xbae2('0x8f');_0x444d18['transfer']=!![];_0x444d18[_0xbae2('0x90')]='FORWARD';_0x444d18[_0xbae2('0x91')]=_0x4023f2[_0xbae2('0x92')];_0x444d18[_0xbae2('0x93')]=_0x4023f2[_0xbae2('0x47')];logger[_0xbae2('0x71')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x444d18['name'],_0x444d18['type']);var _0x25e385=this['queueReports'][_0x4023f2[_0xbae2('0x94')]];this['queueReports'][_0x4023f2[_0xbae2('0x94')]]=this[_0xbae2('0xe')][_0x4023f2['uniqueid']];this[_0xbae2('0xe')][_0x4023f2[_0xbae2('0x47')]]=_0x25e385;}}else{_0x35518d[_0xbae2('0x7c')]=_0xbae2('0x95')+_0x4023f2[_0xbae2('0x8c')]['toUpperCase']();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x35518d[_0xbae2('0x4a')],_0x35518d[_0xbae2('0x4f')],_0x35518d[_0xbae2('0x7c')]);}}}this[_0xbae2('0x33')][_0x4023f2[_0xbae2('0x47')]]=_0x35518d;this[_0xbae2('0x43')](_0x35518d,_0xbae2('0x1d'));}}}catch(_0x47eb7d){logger[_0xbae2('0x3b')](_0xbae2('0x88'),_0x4023f2[_0xbae2('0x47')],util[_0xbae2('0x3d')](_0x47eb7d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbae2('0x42')][_0xbae2('0x21')]=function(_0x561c50){try{if(this['isNotNull'](_0x561c50)){logger[_0xbae2('0x5b')]('[%s][voiceQueueReport][varset]',_0x561c50['uniqueid'],util['inspect'](_0x561c50,{'showHidden':![],'depth':null}));this[_0xbae2('0x96')](_0x561c50['uniqueid'],_[_0xbae2('0x97')](_0x561c50[_0xbae2('0x98')])[0x0],_0x561c50[_0xbae2('0x99')]);if(this['queueReports'][_0x561c50[_0xbae2('0x47')]]){var _0x2a5db8=_[_0xbae2('0x81')](this[_0xbae2('0xe')][_0x561c50[_0xbae2('0x47')]]);if(_0x2a5db8){if(this[_0xbae2('0x5d')](_0x561c50[_0xbae2('0x98')])&&this[_0xbae2('0x5d')](_0x561c50[_0xbae2('0x98')][_0xbae2('0x9a')])){switch(_0x561c50[_0xbae2('0x99')]){case _0xbae2('0x9b'):_0x2a5db8[_0xbae2('0x9c')]=![];_0x2a5db8[_0xbae2('0x8a')]=null;break;case _0xbae2('0x9d'):_0x2a5db8['lastevent']='timeout';_0x2a5db8[_0xbae2('0x9c')]=!![];_0x2a5db8['queuecallerexitAt']=moment()[_0xbae2('0x48')](_0xbae2('0x6e'));_0x2a5db8[_0xbae2('0x9e')]=moment()[_0xbae2('0x48')](_0xbae2('0x6e'));logger['debug'](_0xbae2('0x9f'),_0x561c50[_0xbae2('0x47')],util[_0xbae2('0x3d')](_0x2a5db8,{'showHidden':![],'depth':null}));ami['emit'](_0xbae2('0xa0'),_0x2a5db8);break;default:_0x2a5db8[_0xbae2('0x9c')]=!![];_0x2a5db8[_0xbae2('0x8a')]=moment()['format'](_0xbae2('0x6e'));_0x2a5db8[_0xbae2('0x9e')]=moment()[_0xbae2('0x48')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2a5db8['queuecallerabandon']=![];_0x2a5db8[_0xbae2('0x7b')]=null;_0x2a5db8[_0xbae2('0x7c')]=_0x561c50['value'];this[_0xbae2('0x33')][_0x561c50[_0xbae2('0x47')]]=_0x2a5db8;this[_0xbae2('0x43')](_0x2a5db8,_0xbae2('0xa1'));}else if(this['isNotNull'](_0x561c50[_0xbae2('0x98')])&&this['isNotNull'](_0x561c50['variable'][_0xbae2('0xa2')])){if(!_0x2a5db8['queuecallerabandon']){_0x2a5db8[_0xbae2('0x9c')]=!![];_0x2a5db8[_0xbae2('0x8a')]=moment()[_0xbae2('0x48')](_0xbae2('0x6e'));_0x2a5db8[_0xbae2('0x7c')]='EXITWITHKEY';_0x2a5db8[_0xbae2('0x9e')]=moment()[_0xbae2('0x48')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xbae2('0x33')][_0x561c50[_0xbae2('0x47')]]=_0x2a5db8;}}logger['info'](_0xbae2('0xa3'),_0x561c50[_0xbae2('0x47')],_0x2a5db8[_0xbae2('0x4a')],_0x2a5db8[_0xbae2('0x4f')],_[_0xbae2('0x97')](_0x561c50[_0xbae2('0x98')])[0x0],_0x561c50[_0xbae2('0x99')]);_0x2a5db8[_0xbae2('0x13')]=this[_0xbae2('0x13')][_0x561c50[_0xbae2('0x47')]];}}}}catch(_0x1d1615){logger['error']('[%s][voiceQueueReport][varset]',_0x561c50[_0xbae2('0x47')],util['inspect'](_0x1d1615,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbae2('0x42')][_0xbae2('0x96')]=function(_0x44176b,_0x48b186,_0x22415c){var _0x4202d7=[_0xbae2('0xa4'),_0xbae2('0xa5'),_0xbae2('0xa6'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0xbae2('0xa7'),'rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid',_0xbae2('0xa8'),_0xbae2('0xa9'),'bridgepvtcallid',_0xbae2('0xaa'),_0xbae2('0xab'),_0xbae2('0xac'),_0xbae2('0xad'),'membername','memberpenalty',_0xbae2('0xae')];if(!_['isNil'](_0x48b186)&&!_[_0xbae2('0xaf')](_0x4202d7,_0x48b186)){if(_[_0xbae2('0x5e')](this['variables'][_0x44176b])){this['variables'][_0x44176b]={};}this[_0xbae2('0x13')][_0x44176b][_0x48b186]=_0x22415c;}};VoiceQueueReport[_0xbae2('0x42')][_0xbae2('0x22')]=function(_0x5311dc){try{if(this[_0xbae2('0x5d')](_0x5311dc)){logger[_0xbae2('0x5b')](_0xbae2('0xb0'),_0x5311dc['uniqueid'],util[_0xbae2('0x3d')](_0x5311dc,{'showHidden':![],'depth':null}));if(this[_0xbae2('0xe')][_0x5311dc['uniqueid']]){for(var _0x55200f=0x0,_0x86aa8b={};_0x55200f=0x0?moment(_0x3c4966[_0x3739('0x1a')])[_0x3739('0xe')](_0x3c4966[_0x3739('0x19')],_0x3739('0xf')):null,'data1':'outbound','data2':_0x3c4966[_0x3739('0x15')],'data3':_0x3c4966['exten'],'data4':_0x3c4966[_0x3739('0x1b')]||null,'role':_0x3739('0x13'),'internal':_0x3c4966[_0x3739('0x15')]?_['toNumber'](_0x3c4966[_0x3739('0x15')]):undefined,'uniqueid':_0x3c4966[_0x3739('0x1c')]},'log':_0x3739('0x6')});}; \ No newline at end of file +var _0x37f9=['accountcode','toNumber','uniqueid','voiceDialReport','Request','membername','interface','TALKING','starttime','endtime','seconds','diff','outbound','dialstring','moment','../client','voiceQueueReport','CreateMemberReport','voice','lastAssignedTo','isNil','format','SIP/%s','queuecallerleaveAt','inbound','exten','queue','agent'];(function(_0x4bb33f,_0xb0a6e0){var _0x392172=function(_0x1d50be){while(--_0x1d50be){_0x4bb33f['push'](_0x4bb33f['shift']());}};_0x392172(++_0xb0a6e0);}(_0x37f9,0x1b2));var _0x937f=function(_0x5ba85a,_0x44829c){_0x5ba85a=_0x5ba85a-0x0;var _0x516f19=_0x37f9[_0x5ba85a];return _0x516f19;};'use strict';var moment=require(_0x937f('0x0'));var _=require('lodash');var util=require('util');var client=require(_0x937f('0x1'));exports[_0x937f('0x2')]=function(_0xb6dd56){var _0x225df6=_0xb6dd56['queuecallercompleteAt']||_0xb6dd56['queuecallerexitAt'];return client['Request'](_0x937f('0x3'),{'body':{'channel':_0x937f('0x4'),'membername':_0xb6dd56[_0x937f('0x5')],'interface':_[_0x937f('0x6')](_0xb6dd56['interface'])?util[_0x937f('0x7')](_0x937f('0x8'),_0xb6dd56[_0x937f('0x5')]):_0xb6dd56['interface'],'type':'TALKING','enterAt':_0xb6dd56[_0x937f('0x9')],'exitAt':_0x225df6,'duration':moment(_0x225df6)['diff'](_0xb6dd56[_0x937f('0x9')],'seconds'),'data1':_0x937f('0xa'),'data2':_0xb6dd56['calleridnum'],'data3':_0xb6dd56[_0x937f('0xb')],'data4':null,'data5':_0xb6dd56[_0x937f('0xc')],'role':_0x937f('0xd'),'internal':_0xb6dd56[_0x937f('0xe')]?_[_0x937f('0xf')](_0xb6dd56[_0x937f('0xe')]):undefined,'uniqueid':_0xb6dd56[_0x937f('0x10')]},'log':_0x937f('0x3')});};exports[_0x937f('0x11')]=function(_0xc280b7){return client[_0x937f('0x12')](_0x937f('0x3'),{'body':{'channel':_0x937f('0x4'),'membername':_0xc280b7[_0x937f('0x13')],'interface':_0xc280b7[_0x937f('0x14')],'type':_0x937f('0x15'),'enterAt':_0xc280b7[_0x937f('0x16')],'exitAt':_0xc280b7[_0x937f('0x17')],'duration':moment(_0xc280b7[_0x937f('0x17')])['diff'](_0xc280b7['starttime'],_0x937f('0x18'))>=0x0?moment(_0xc280b7['endtime'])[_0x937f('0x19')](_0xc280b7[_0x937f('0x16')],_0x937f('0x18')):null,'data1':_0x937f('0x1a'),'data2':_0xc280b7[_0x937f('0xe')],'data3':_0xc280b7[_0x937f('0xb')],'data4':_0xc280b7[_0x937f('0x1b')]||null,'role':_0x937f('0xd'),'internal':_0xc280b7[_0x937f('0xe')]?_[_0x937f('0xf')](_0xc280b7[_0x937f('0xe')]):undefined,'uniqueid':_0xc280b7['uniqueid']},'log':_0x937f('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 4488059..1aa90d5 100644 --- a/server/services/ami/rpc/setting.js +++ b/server/services/ami/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ce3=['../client','getSettings','ShowSetting','stopRecordingOnTransfer','GetSettings'];(function(_0x553f94,_0x2a0c7b){var _0x421c6c=function(_0x4c948a){while(--_0x4c948a){_0x553f94['push'](_0x553f94['shift']());}};_0x421c6c(++_0x2a0c7b);}(_0x8ce3,0xc3));var _0x38ce=function(_0x616fb8,_0x177e11){_0x616fb8=_0x616fb8-0x0;var _0x739e20=_0x8ce3[_0x616fb8];return _0x739e20;};'use strict';var client=require(_0x38ce('0x0'));exports[_0x38ce('0x1')]=function(){return client['Request'](_0x38ce('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x38ce('0x3')]},'log':_0x38ce('0x4')});}; \ No newline at end of file +var _0x13f6=['../client','getSettings','stopRecordingOnTransfer','GetSettings'];(function(_0xa25342,_0x24522b){var _0x52be43=function(_0x1ea0e9){while(--_0x1ea0e9){_0xa25342['push'](_0xa25342['shift']());}};_0x52be43(++_0x24522b);}(_0x13f6,0x124));var _0x613f=function(_0x586cfa,_0x4c84c9){_0x586cfa=_0x586cfa-0x0;var _0x460cd8=_0x13f6[_0x586cfa];return _0x460cd8;};'use strict';var client=require(_0x613f('0x0'));exports[_0x613f('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x613f('0x2')]},'log':_0x613f('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index ca84a58..8dbc7fb 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 _0x536f=['../client','GetTemplate','name','html'];(function(_0x16aced,_0x2dccfb){var _0x1fd76b=function(_0x10f564){while(--_0x10f564){_0x16aced['push'](_0x16aced['shift']());}};_0x1fd76b(++_0x2dccfb);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xf536('0x0'));exports['getTemplates']=function(_0x4e4212){return function(_0x4c2e7e){return client['Request'](_0xf536('0x1'),{'options':{'raw':!![],'attributes':['id',_0xf536('0x2'),_0xf536('0x3')]},'log':_0xf536('0x1')});};}; \ No newline at end of file +var _0x131e=['Request','GetTemplate','name','html'];(function(_0xe27195,_0x468443){var _0x5762c3=function(_0x522475){while(--_0x522475){_0xe27195['push'](_0xe27195['shift']());}};_0x5762c3(++_0x468443);}(_0x131e,0x1ec));var _0xe131=function(_0x2d1fe6,_0x280692){_0x2d1fe6=_0x2d1fe6-0x0;var _0x56d315=_0x131e[_0x2d1fe6];return _0x56d315;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x58ba04){return function(_0x10fd23){return client[_0xe131('0x0')](_0xe131('0x1'),{'options':{'raw':!![],'attributes':['id',_0xe131('0x2'),_0xe131('0x3')]},'log':_0xe131('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 6b51265..116f9b9 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 _0xfd0a=['data2','data4','data5','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','value','AnyConditions','action','data1'];(function(_0x9eaab8,_0x1bdf37){var _0x438c72=function(_0x4d90d6){while(--_0x4d90d6){_0x9eaab8['push'](_0x9eaab8['shift']());}};_0x438c72(++_0x1bdf37);}(_0xfd0a,0xc3));var _0xafd0=function(_0x4a1e75,_0x28ba73){_0x4a1e75=_0x4a1e75-0x0;var _0x3cf0f5=_0xfd0a[_0x4a1e75];return _0x3cf0f5;};'use strict';var client=require('../client');exports[_0xafd0('0x0')]=function(_0x3f500f){return function(_0x24a3b7){return client[_0xafd0('0x1')](_0xafd0('0x2'),{'options':{'raw':![],'attributes':['id',_0xafd0('0x3'),_0xafd0('0x4'),_0xafd0('0x5')],'include':[{'model':_0xafd0('0x6'),'as':_0xafd0('0x7'),'attributes':['id',_0xafd0('0x8'),'operator',_0xafd0('0x9')]},{'model':'Condition','as':_0xafd0('0xa'),'attributes':['id',_0xafd0('0x8'),'operator',_0xafd0('0x9')]},{'model':'Action','as':'Actions','attributes':['id',_0xafd0('0xb'),_0xafd0('0xc'),_0xafd0('0xd'),'data3',_0xafd0('0xe'),_0xafd0('0xf'),'data6','data7']}]},'log':_0xafd0('0x2')});};}; \ No newline at end of file +var _0xbf39=['operator','value','AnyConditions','Action','Actions','action','data3','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','field'];(function(_0x1d641b,_0x9b7063){var _0x22fb67=function(_0x1d19e8){while(--_0x1d19e8){_0x1d641b['push'](_0x1d641b['shift']());}};_0x22fb67(++_0x9b7063);}(_0xbf39,0xab));var _0x9bf3=function(_0x2b64f5,_0x423499){_0x2b64f5=_0x2b64f5-0x0;var _0x4b9f08=_0xbf39[_0x2b64f5];return _0x4b9f08;};'use strict';var client=require(_0x9bf3('0x0'));exports[_0x9bf3('0x1')]=function(_0x523c0b){return function(_0x20c0b5){return client[_0x9bf3('0x2')](_0x9bf3('0x3'),{'options':{'raw':![],'attributes':['id',_0x9bf3('0x4'),_0x9bf3('0x5'),_0x9bf3('0x6')],'include':[{'model':_0x9bf3('0x7'),'as':'AllConditions','attributes':['id',_0x9bf3('0x8'),_0x9bf3('0x9'),_0x9bf3('0xa')]},{'model':_0x9bf3('0x7'),'as':_0x9bf3('0xb'),'attributes':['id','field',_0x9bf3('0x9'),_0x9bf3('0xa')]},{'model':_0x9bf3('0xc'),'as':_0x9bf3('0xd'),'attributes':['id',_0x9bf3('0xe'),'data1','data2',_0x9bf3('0xf'),_0x9bf3('0x10'),_0x9bf3('0x11'),_0x9bf3('0x12'),_0x9bf3('0x13')]}]},'log':_0x9bf3('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 16d29b5..ad46882 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 _0x2ba9=['Request','GetTrunk','defaultuser','getTrunks'];(function(_0x24371e,_0x43c47b){var _0x581a8e=function(_0x488019){while(--_0x488019){_0x24371e['push'](_0x24371e['shift']());}};_0x581a8e(++_0x43c47b);}(_0x2ba9,0xdf));var _0x92ba=function(_0x4d54fe,_0x3e7ea5){_0x4d54fe=_0x4d54fe-0x0;var _0x994e1=_0x2ba9[_0x4d54fe];return _0x994e1;};'use strict';var client=require('../client');exports[_0x92ba('0x0')]=function(_0x1c1c42){return function(_0x3605a9){return client[_0x92ba('0x1')](_0x92ba('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0x92ba('0x3')]},'log':_0x92ba('0x2')});};}; \ No newline at end of file +var _0x9c85=['defaultuser','../client','getTrunks','Request','name'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x9c85,0x74));var _0x59c8=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x9c85[_0x500419];return _0x241c1a;};'use strict';var client=require(_0x59c8('0x0'));exports[_0x59c8('0x1')]=function(_0x2b8e53){return function(_0x20584a){return client[_0x59c8('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x59c8('0x3'),'registry',_0x59c8('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index bf4b485..71133a5 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 _0x668c=['getAgents','Request','agent','name','email','accountcode','fullname','pauseType','voicePause','getTelephones','GetUser','telephone','internal','savePause','UnpauseUser','getAgent','ShowUser','online','lastPauseAt','../client'];(function(_0x4c24dc,_0x1b5859){var _0x4c2293=function(_0x23b1a4){while(--_0x23b1a4){_0x4c24dc['push'](_0x4c24dc['shift']());}};_0x4c2293(++_0x1b5859);}(_0x668c,0x1df));var _0xc668=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0x668c[_0x25e109];return _0xc0f7d6;};'use strict';var client=require(_0xc668('0x0'));exports[_0xc668('0x1')]=function(){return function(){return client[_0xc668('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0xc668('0x3')},'attributes':['id',_0xc668('0x4'),_0xc668('0x5'),_0xc668('0x6'),_0xc668('0x7'),'online','lastLoginAt',_0xc668('0x8'),'lastPauseAt',_0xc668('0x9'),'phone','mobile','interface']},'log':_0xc668('0x1')});};};exports[_0xc668('0xa')]=function(){return function(){return client[_0xc668('0x2')](_0xc668('0xb'),{'options':{'raw':!![],'where':{'role':_0xc668('0xc')},'attributes':['id',_0xc668('0x4'),_0xc668('0x6'),_0xc668('0xd')]},'log':_0xc668('0xa')});};};exports[_0xc668('0xe')]=function(_0x1715ce,_0x104030,_0x26462b){return client[_0xc668('0x2')]('PauseUser',{'body':{'type':_0x104030,'uniqueid':_0x26462b},'options':{'where':{'id':_0x1715ce['id']}},'log':_0xc668('0xe')});};exports['saveUnpause']=function(_0x3f8c3e){return client['Request'](_0xc668('0xf'),{'body':{},'options':{'where':{'id':_0x3f8c3e['id']}},'log':_0xc668('0xe')});};exports[_0xc668('0x10')]=function(_0x399b9f){return client[_0xc668('0x2')](_0xc668('0x11'),{'options':{'raw':![],'where':{'role':_0xc668('0x3'),'id':_0x399b9f},'attributes':['id','name',_0xc668('0x5'),'accountcode',_0xc668('0x7'),_0xc668('0x12'),'lastLoginAt',_0xc668('0x8'),_0xc668('0x13'),_0xc668('0x9'),'interface']},'log':'getAgent'});}; \ No newline at end of file +var _0x0928=['savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','pauseType','getAgent','../client','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','online','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal'];(function(_0x2e95d0,_0x4e9c25){var _0x288b82=function(_0x4ca452){while(--_0x4ca452){_0x2e95d0['push'](_0x2e95d0['shift']());}};_0x288b82(++_0x4e9c25);}(_0x0928,0x125));var _0x8092=function(_0x5d4dc2,_0x4c4d6c){_0x5d4dc2=_0x5d4dc2-0x0;var _0x48b9bf=_0x0928[_0x5d4dc2];return _0x48b9bf;};'use strict';var client=require(_0x8092('0x0'));exports[_0x8092('0x1')]=function(){return function(){return client[_0x8092('0x2')](_0x8092('0x3'),{'options':{'raw':![],'where':{'role':_0x8092('0x4')},'attributes':['id',_0x8092('0x5'),_0x8092('0x6'),_0x8092('0x7'),_0x8092('0x8'),_0x8092('0x9'),_0x8092('0xa'),'pauseType',_0x8092('0xb'),_0x8092('0xc'),_0x8092('0xd'),_0x8092('0xe'),_0x8092('0xf')]},'log':_0x8092('0x1')});};};exports[_0x8092('0x10')]=function(){return function(){return client['Request'](_0x8092('0x3'),{'options':{'raw':!![],'where':{'role':_0x8092('0x11')},'attributes':['id',_0x8092('0x5'),_0x8092('0x7'),_0x8092('0x12')]},'log':_0x8092('0x10')});};};exports[_0x8092('0x13')]=function(_0x44b662,_0x3eed5c,_0x362d2a){return client[_0x8092('0x2')](_0x8092('0x14'),{'body':{'type':_0x3eed5c,'uniqueid':_0x362d2a},'options':{'where':{'id':_0x44b662['id']}},'log':_0x8092('0x13')});};exports[_0x8092('0x15')]=function(_0x3a46af){return client[_0x8092('0x2')](_0x8092('0x16'),{'body':{},'options':{'where':{'id':_0x3a46af['id']}},'log':_0x8092('0x13')});};exports['getAgent']=function(_0x494dc3){return client[_0x8092('0x2')](_0x8092('0x17'),{'options':{'raw':![],'where':{'role':_0x8092('0x4'),'id':_0x494dc3},'attributes':['id',_0x8092('0x5'),_0x8092('0x6'),'accountcode',_0x8092('0x8'),_0x8092('0x9'),_0x8092('0xa'),_0x8092('0x18'),_0x8092('0xb'),_0x8092('0xc'),'interface']},'log':_0x8092('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 90900dc..eb4ff4d 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 _0xe524=['create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xe524,0x1d8));var _0x4e52=function(_0x1d1783,_0xbd6366){_0x1d1783=_0x1d1783-0x0;var _0x48c325=_0xe524[_0x1d1783];return _0x48c325;};'use strict';var client=require('../client');exports[_0x4e52('0x0')]=function(_0x446397){return client[_0x4e52('0x1')](_0x4e52('0x2'),{'body':_0x446397,'log':_0x4e52('0x2')});};exports['update']=function(_0x23bee6,_0xfb6ebb,_0x8c5913){return client[_0x4e52('0x1')](_0x4e52('0x3'),{'body':_0x23bee6,'options':{'where':{'uniqueid':_0xfb6ebb,'interface':_0x8c5913,'agentcomplete':!![]}},'log':_0x4e52('0x3')});}; \ No newline at end of file +var _0xec08=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','create','Request'];(function(_0x3525b4,_0x2d5897){var _0x2bd50b=function(_0x234675){while(--_0x234675){_0x3525b4['push'](_0x3525b4['shift']());}};_0x2bd50b(++_0x2d5897);}(_0xec08,0xad));var _0x8ec0=function(_0x40033b,_0x3b3503){_0x40033b=_0x40033b-0x0;var _0x5c2de1=_0xec08[_0x40033b];return _0x5c2de1;};'use strict';var client=require('../client');exports[_0x8ec0('0x0')]=function(_0x5651ee){return client[_0x8ec0('0x1')](_0x8ec0('0x2'),{'body':_0x5651ee,'log':_0x8ec0('0x2')});};exports[_0x8ec0('0x3')]=function(_0x285442,_0x429e29,_0x28705b){return client[_0x8ec0('0x1')](_0x8ec0('0x4'),{'body':_0x285442,'options':{'where':{'uniqueid':_0x429e29,'interface':_0x28705b,'agentcomplete':!![]}},'log':_0x8ec0('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index f75e676..15f03b8 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 _0x3868=['merge','calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','disposition','billableseconds','moment','lodash','../client','create','Request','CreateVoiceCallReport'];(function(_0x185756,_0x34de48){var _0x227396=function(_0xfe842f){while(--_0xfe842f){_0x185756['push'](_0x185756['shift']());}};_0x227396(++_0x34de48);}(_0x3868,0x1ee));var _0x8386=function(_0x167665,_0x1d2f29){_0x167665=_0x167665-0x0;var _0x5564a1=_0x3868[_0x167665];return _0x5564a1;};'use strict';var moment=require(_0x8386('0x0'));var util=require('util');var _=require(_0x8386('0x1'));var client=require(_0x8386('0x2'));exports[_0x8386('0x3')]=function(_0x276bc6){return client[_0x8386('0x4')](_0x8386('0x5'),{'body':_[_0x8386('0x6')](_0x276bc6,{'source':_0x276bc6[_0x8386('0x7')],'destinationcontext':_0x276bc6[_0x8386('0x8')],'callerid':_0x276bc6[_0x8386('0x9')],'amaflags':'DOCUMENTATION'}),'log':_0x8386('0x5')});};exports[_0x8386('0xa')]=function(){return function(){return client[_0x8386('0x4')](_0x8386('0xb'),{'options':{'where':{'type':[_0x8386('0xc')],'createdAt':{'$between':[moment()[_0x8386('0xd')]('day')[_0x8386('0xe')](_0x8386('0xf')),moment()[_0x8386('0x10')](_0x8386('0x11'))[_0x8386('0xe')](_0x8386('0xf'))]}},'attributes':['type',_0x8386('0x12'),'duration',_0x8386('0x13')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x1f5a=['outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','billableseconds','GetVoiceCallReports','moment','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport'];(function(_0x30604b,_0x3405e8){var _0x500e76=function(_0x1b5578){while(--_0x1b5578){_0x30604b['push'](_0x30604b['shift']());}};_0x500e76(++_0x3405e8);}(_0x1f5a,0x1d6));var _0xa1f5=function(_0x4bdc1e,_0x140439){_0x4bdc1e=_0x4bdc1e-0x0;var _0x2d2db0=_0x1f5a[_0x4bdc1e];return _0x2d2db0;};'use strict';var moment=require(_0xa1f5('0x0'));var util=require('util');var _=require(_0xa1f5('0x1'));var client=require(_0xa1f5('0x2'));exports[_0xa1f5('0x3')]=function(_0x335882){return client[_0xa1f5('0x4')](_0xa1f5('0x5'),{'body':_[_0xa1f5('0x6')](_0x335882,{'source':_0x335882[_0xa1f5('0x7')],'destinationcontext':_0x335882[_0xa1f5('0x8')],'callerid':_0x335882[_0xa1f5('0x9')],'amaflags':_0xa1f5('0xa')}),'log':'CreateVoiceCallReport'});};exports[_0xa1f5('0xb')]=function(){return function(){return client[_0xa1f5('0x4')](_0xa1f5('0xc'),{'options':{'where':{'type':[_0xa1f5('0xd')],'createdAt':{'$between':[moment()[_0xa1f5('0xe')](_0xa1f5('0xf'))[_0xa1f5('0x10')](_0xa1f5('0x11')),moment()[_0xa1f5('0x12')](_0xa1f5('0xf'))[_0xa1f5('0x10')](_0xa1f5('0x11'))]}},'attributes':[_0xa1f5('0x13'),'disposition',_0xa1f5('0x14'),_0xa1f5('0x15')]},'log':_0xa1f5('0x16')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 6ccb22c..6306fb6 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 _0x02b2=['Request','CreateVoiceDialReport','create'];(function(_0x5b70a8,_0xb5daf0){var _0x4b68d2=function(_0x344eaf){while(--_0x344eaf){_0x5b70a8['push'](_0x5b70a8['shift']());}};_0x4b68d2(++_0xb5daf0);}(_0x02b2,0x1eb));var _0x202b=function(_0x17ec8c,_0x2da192){_0x17ec8c=_0x17ec8c-0x0;var _0x19a4ec=_0x02b2[_0x17ec8c];return _0x19a4ec;};'use strict';var client=require('../client');exports[_0x202b('0x0')]=function(_0x40512a){return client[_0x202b('0x1')](_0x202b('0x2'),{'body':_0x40512a,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x2ba8=['create','Request','CreateVoiceDialReport'];(function(_0x24cf7f,_0x31a459){var _0x522347=function(_0x28ebf6){while(--_0x28ebf6){_0x24cf7f['push'](_0x24cf7f['shift']());}};_0x522347(++_0x31a459);}(_0x2ba8,0x8a));var _0x82ba=function(_0x3c526f,_0x271d42){_0x3c526f=_0x3c526f-0x0;var _0x27cccd=_0x2ba8[_0x3c526f];return _0x27cccd;};'use strict';var client=require('../client');exports[_0x82ba('0x0')]=function(_0x510892){return client[_0x82ba('0x1')]('CreateVoiceDialReport',{'body':_0x510892,'log':_0x82ba('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index d1f0c65..4f85aa0 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 _0x0c99=['recordingFormat','../client','getVoiceExtensions','Request','exten'];(function(_0xbbe90b,_0x48c598){var _0x5944b1=function(_0x23460b){while(--_0x23460b){_0xbbe90b['push'](_0xbbe90b['shift']());}};_0x5944b1(++_0x48c598);}(_0x0c99,0x1af));var _0x90c9=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0x0c99[_0x4c6d6f];return _0x2d4478;};'use strict';var client=require(_0x90c9('0x0'));exports[_0x90c9('0x1')]=function(){return function(){return client[_0x90c9('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x90c9('0x3'),_0x90c9('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x90c9('0x1')});};}; \ No newline at end of file +var _0x1a95=['../client','Request','exten','recordingFormat'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x1a95,0x130));var _0x51a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1a95[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x51a9('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x51a9('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x51a9('0x2'),_0x51a9('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 6d9819c..2778ed6 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 _0x6808=['active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','name','acw','autopause','type','dialLimitChannel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6808,0x15d));var _0x8680=function(_0x6bca1d,_0x3c7250){_0x6bca1d=_0x6bca1d-0x0;var _0x34686c=_0x6808[_0x6bca1d];return _0x34686c;};'use strict';var client=require(_0x8680('0x0'));exports[_0x8680('0x1')]=function(){return function(){return client[_0x8680('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x8680('0x3'),_0x8680('0x4'),'acwTimeout',_0x8680('0x5'),'monitor_format',_0x8680('0x6'),'dialActive','dialMethod',_0x8680('0x7'),'dialLimitQueue','dialPowerLevel',_0x8680('0x8'),_0x8680('0x9'),_0x8680('0xa'),'dialOriginateCallerIdName',_0x8680('0xb'),_0x8680('0xc'),'dialQueueOptions',_0x8680('0xd'),'dialQueueProject',_0x8680('0xe'),_0x8680('0xf'),'dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0x8680('0x10'),_0x8680('0x11'),_0x8680('0x12'),_0x8680('0x13'),'dialPrefix',_0x8680('0x14'),_0x8680('0x15'),'dialAMDInitialSilence',_0x8680('0x16'),_0x8680('0x17'),_0x8680('0x18'),_0x8680('0x19'),_0x8680('0x1a'),_0x8680('0x1b'),_0x8680('0x1c'),'dialAMDMaximumWordLength',_0x8680('0x1d'),_0x8680('0x1e'),_0x8680('0x1f'),'dialOrderByScheduledAt',_0x8680('0x20'),'dialAgiAfterHangupClient',_0x8680('0x21'),_0x8680('0x22'),_0x8680('0x23'),_0x8680('0x24'),'dialCutDigit',_0x8680('0x25'),_0x8680('0x26'),'dialDropMaxRetry',_0x8680('0x27'),'dialAbandonedMaxRetry',_0x8680('0x28'),_0x8680('0x29'),_0x8680('0x2a'),_0x8680('0x2b'),_0x8680('0x2c'),_0x8680('0x2d'),_0x8680('0x2e'),_0x8680('0x2f'),'callAdditionalPhoneAfterMin'],'include':[{'model':_0x8680('0x30'),'as':_0x8680('0x30'),'attributes':['id',_0x8680('0x3'),_0x8680('0x31'),_0x8680('0x32')]},{'model':_0x8680('0x33'),'as':_0x8680('0x34'),'attributes':['id',_0x8680('0x3')]},{'model':_0x8680('0x30'),'as':_0x8680('0x35'),'attributes':['id',_0x8680('0x3'),_0x8680('0x31'),_0x8680('0x32')]},{'model':'Interval','as':'Interval','attributes':['id','name'],'include':[{'model':_0x8680('0x36'),'as':_0x8680('0x37'),'attributes':['id','name',_0x8680('0x38')]}]}]},'log':_0x8680('0x1')});};}; \ No newline at end of file +var _0xce25=['dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','monitor_format','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','callAdditionalPhoneAfterMin','Trunk','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval','Intervals','interval','getVoiceQueues','Request','name','autopause','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x5b13b6,_0x231bc5){var _0xfe953e=function(_0x24e7dd){while(--_0x24e7dd){_0x5b13b6['push'](_0x5b13b6['shift']());}};_0xfe953e(++_0x231bc5);}(_0xce25,0x67));var _0x5ce2=function(_0x3d4c90,_0x119f2b){_0x3d4c90=_0x3d4c90-0x0;var _0x4ddbfc=_0xce25[_0x3d4c90];return _0x4ddbfc;};'use strict';var client=require('../client');exports[_0x5ce2('0x0')]=function(){return function(){return client[_0x5ce2('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x5ce2('0x2'),'acw','acwTimeout',_0x5ce2('0x3'),'monitor_format','type','dialActive',_0x5ce2('0x4'),_0x5ce2('0x5'),_0x5ce2('0x6'),_0x5ce2('0x7'),_0x5ce2('0x8'),_0x5ce2('0x9'),_0x5ce2('0xa'),'dialOriginateCallerIdName',_0x5ce2('0xb'),_0x5ce2('0xc'),_0x5ce2('0xd'),_0x5ce2('0xe'),_0x5ce2('0xf'),_0x5ce2('0x10'),_0x5ce2('0x11'),_0x5ce2('0x12'),_0x5ce2('0x13'),_0x5ce2('0x14'),_0x5ce2('0x15'),_0x5ce2('0x16'),'dialTimezone','dialGlobalInterval',_0x5ce2('0x17'),_0x5ce2('0x18'),_0x5ce2('0x19'),_0x5ce2('0x1a'),_0x5ce2('0x1b'),'dialAMDAfterGreetingSilence',_0x5ce2('0x1c'),_0x5ce2('0x1d'),_0x5ce2('0x1e'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x5ce2('0x1f'),'timeout',_0x5ce2('0x20'),_0x5ce2('0x21'),_0x5ce2('0x22'),_0x5ce2('0x23'),'dialAgiAfterHangupClient','dialQueueProject2',_0x5ce2('0x24'),'strategy',_0x5ce2('0x25'),_0x5ce2('0x26'),_0x5ce2('0x27'),'dialNoSuchNumberRetryFrequency',_0x5ce2('0x28'),'dialDropRetryFrequency',_0x5ce2('0x29'),_0x5ce2('0x2a'),_0x5ce2('0x2b'),_0x5ce2('0x2c'),'dialAgentRejectMaxRetry',_0x5ce2('0x2d'),_0x5ce2('0x2e'),'dialPredictiveIntervalMaxThreshold',_0x5ce2('0x2f'),_0x5ce2('0x30')],'include':[{'model':_0x5ce2('0x31'),'as':_0x5ce2('0x31'),'attributes':['id',_0x5ce2('0x2'),_0x5ce2('0x32'),'active']},{'model':_0x5ce2('0x33'),'as':_0x5ce2('0x34'),'attributes':['id',_0x5ce2('0x2')]},{'model':_0x5ce2('0x31'),'as':_0x5ce2('0x35'),'attributes':['id',_0x5ce2('0x2'),'callerid',_0x5ce2('0x36')]},{'model':_0x5ce2('0x37'),'as':_0x5ce2('0x37'),'attributes':['id',_0x5ce2('0x2')],'include':[{'model':_0x5ce2('0x37'),'as':_0x5ce2('0x38'),'attributes':['id',_0x5ce2('0x2'),_0x5ce2('0x39')]}]}]},'log':_0x5ce2('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 7d0277c..b45d578 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 _0xf316=['getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','lodash','../client','create','Request','CreateVoiceQueueReport'];(function(_0x89a001,_0x3a9a8c){var _0x5f3ec2=function(_0x3e849b){while(--_0x3e849b){_0x89a001['push'](_0x89a001['shift']());}};_0x5f3ec2(++_0x3a9a8c);}(_0xf316,0xd7));var _0x6f31=function(_0x25bccb,_0xbdd588){_0x25bccb=_0x25bccb-0x0;var _0x5c9d38=_0xf316[_0x25bccb];return _0x5c9d38;};'use strict';var moment=require('moment');var _=require(_0x6f31('0x0'));var client=require(_0x6f31('0x1'));exports[_0x6f31('0x2')]=function(_0x25cfa1){return client[_0x6f31('0x3')]('CreateVoiceQueueReport',{'body':_0x25cfa1,'log':_0x6f31('0x4')});};exports[_0x6f31('0x5')]=function(){return function(){return client[_0x6f31('0x3')](_0x6f31('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x6f31('0x7')](_0x6f31('0x8'))[_0x6f31('0x9')](_0x6f31('0xa')),moment()['endOf']('day')[_0x6f31('0x9')](_0x6f31('0xa'))]}},'attributes':['uniqueid',_0x6f31('0xb'),_0x6f31('0xc'),_0x6f31('0xd'),'queuecallercomplete',_0x6f31('0xe'),_0x6f31('0xf'),_0x6f31('0x10'),_0x6f31('0x11'),_0x6f31('0x12')]},'log':_0x6f31('0x13')});};}; \ No newline at end of file +var _0x2232=['getVoiceQueueReports','GetVoiceQueueReport','day','format','YYYY-MM-DD\x20HH:mm:ss','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallerexit','queuecallerabandon','queuecallerabandonAt','moment','lodash','../client','create','Request','CreateVoiceQueueReport'];(function(_0x43f8d1,_0x5f1de2){var _0x31983c=function(_0x219c85){while(--_0x219c85){_0x43f8d1['push'](_0x43f8d1['shift']());}};_0x31983c(++_0x5f1de2);}(_0x2232,0xd2));var _0x2223=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2232[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x2223('0x0'));var _=require(_0x2223('0x1'));var client=require(_0x2223('0x2'));exports[_0x2223('0x3')]=function(_0x110475){return client[_0x2223('0x4')](_0x2223('0x5'),{'body':_0x110475,'log':_0x2223('0x5')});};exports[_0x2223('0x6')]=function(){return function(){return client[_0x2223('0x4')](_0x2223('0x7'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x2223('0x8'))[_0x2223('0x9')](_0x2223('0xa')),moment()['endOf']('day')[_0x2223('0x9')](_0x2223('0xa'))]}},'attributes':['uniqueid',_0x2223('0xb'),_0x2223('0xc'),_0x2223('0xd'),_0x2223('0xe'),'queuecallercompleteAt',_0x2223('0xf'),'queuecallerexitAt',_0x2223('0x10'),_0x2223('0x11')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 1a8c35a..cb4eb79 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 _0x743e=['getVoiceQueueRtPauses'];(function(_0x257c31,_0x72ac86){var _0x42f692=function(_0x4e5cd6){while(--_0x4e5cd6){_0x257c31['push'](_0x257c31['shift']());}};_0x42f692(++_0x72ac86);}(_0x743e,0x167));var _0xe743=function(_0x3a58aa,_0x583fcb){_0x3a58aa=_0x3a58aa-0x0;var _0x4d102b=_0x743e[_0x3a58aa];return _0x4d102b;};'use strict';var client=require('../client');exports[_0xe743('0x0')]=function(_0x5e71b3){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x5e71b3,'paused':!![]},'raw':!![]},'log':_0xe743('0x0')});};}; \ No newline at end of file +var _0xf673=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x271b3f,_0x1485de){var _0x44a7cc=function(_0x55a744){while(--_0x55a744){_0x271b3f['push'](_0x271b3f['shift']());}};_0x44a7cc(++_0x1485de);}(_0xf673,0x1be));var _0x3f67=function(_0x6c0123,_0x4c8d3b){_0x6c0123=_0x6c0123-0x0;var _0x5a87d2=_0xf673[_0x6c0123];return _0x5a87d2;};'use strict';var client=require(_0x3f67('0x0'));exports[_0x3f67('0x1')]=function(_0x29c08e){return function(){return client[_0x3f67('0x2')](_0x3f67('0x3'),{'options':{'where':{'VoiceQueueId':_0x29c08e,'paused':!![]},'raw':!![]},'log':_0x3f67('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 0999fd2..08645f4 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 _0xcd3b=['../client','create','merge','monitorFilename','CreateVoiceRecording'];(function(_0x2fbb8e,_0x39edeb){var _0x556d49=function(_0x34c8bb){while(--_0x34c8bb){_0x2fbb8e['push'](_0x2fbb8e['shift']());}};_0x556d49(++_0x39edeb);}(_0xcd3b,0x1a4));var _0xbcd3=function(_0x3e0e78,_0x2b8b3c){_0x3e0e78=_0x3e0e78-0x0;var _0xf6a02f=_0xcd3b[_0x3e0e78];return _0xf6a02f;};'use strict';var _=require('lodash');var client=require(_0xbcd3('0x0'));exports[_0xbcd3('0x1')]=function(_0x192a16){return client['Request']('CreateVoiceRecording',{'body':_[_0xbcd3('0x2')](_0x192a16,{'value':_0x192a16[_0xbcd3('0x3')]}),'log':_0xbcd3('0x4')});}; \ No newline at end of file +var _0x8317=['../client','Request','merge','monitorFilename','CreateVoiceRecording','lodash'];(function(_0x27ea0e,_0xe90746){var _0x4d4f97=function(_0x949f35){while(--_0x949f35){_0x27ea0e['push'](_0x27ea0e['shift']());}};_0x4d4f97(++_0xe90746);}(_0x8317,0x17f));var _0x7831=function(_0x9398f2,_0x5c0730){_0x9398f2=_0x9398f2-0x0;var _0x1c607f=_0x8317[_0x9398f2];return _0x1c607f;};'use strict';var _=require(_0x7831('0x0'));var client=require(_0x7831('0x1'));exports['create']=function(_0x2b4ef0){return client[_0x7831('0x2')]('CreateVoiceRecording',{'body':_[_0x7831('0x3')](_0x2b4ef0,{'value':_0x2b4ef0[_0x7831('0x4')]}),'log':_0x7831('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 87ce7cd..ee0b176 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 _0x0510=['transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','attended','../client','transfers','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereelinkedid','context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten'];(function(_0x2bddd2,_0x413a1c){var _0x4e143e=function(_0x199d97){while(--_0x199d97){_0x2bddd2['push'](_0x2bddd2['shift']());}};_0x4e143e(++_0x413a1c);}(_0x0510,0x121));var _0x0051=function(_0x1b536b,_0x22fcf8){_0x1b536b=_0x1b536b-0x0;var _0xc09696=_0x0510[_0x1b536b];return _0xc09696;};'use strict';var client=require(_0x0051('0x0'));exports[_0x0051('0x1')]={};exports['blindTransfer']=function(_0x1ae488){return client['Request'](_0x0051('0x2'),{'body':{'result':_0x1ae488[_0x0051('0x3')],'transfererchannel':_0x1ae488[_0x0051('0x4')],'transferercalleridnum':_0x1ae488[_0x0051('0x5')],'transferercalleridname':_0x1ae488[_0x0051('0x6')],'transfererconnectedlinenum':_0x1ae488['transfererconnectedlinenum'],'transfererconnectedlinename':_0x1ae488[_0x0051('0x7')],'transfereraccountcode':_0x1ae488[_0x0051('0x8')],'transferercontext':_0x1ae488[_0x0051('0x9')],'transfererexten':_0x1ae488[_0x0051('0xa')],'transfererlinkedid':_0x1ae488[_0x0051('0xb')],'transfereechannel':_0x1ae488[_0x0051('0xc')],'transfereecalleridnum':_0x1ae488[_0x0051('0xd')],'transfereecalleridname':_0x1ae488[_0x0051('0xe')],'transfereeconnectedlinenum':_0x1ae488[_0x0051('0xf')],'transfereeconnectedlinename':_0x1ae488['transfereeconnectedlinename'],'transfereeaccountcode':_0x1ae488[_0x0051('0x10')],'transfereecontext':_0x1ae488['transfereecontext'],'transfereeexten':_0x1ae488['transfereeexten'],'transfereelinkedid':_0x1ae488[_0x0051('0x11')],'isexternal':_0x1ae488['isexternal'],'context':_0x1ae488[_0x0051('0x12')],'extension':_0x1ae488['extension'],'type':_0x0051('0x13')},'log':_0x0051('0x2')});};exports[_0x0051('0x14')]=function(_0x2334fe){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x2334fe[_0x0051('0x3')],'transfererchannel':_0x2334fe[_0x0051('0x15')],'transferercalleridnum':_0x2334fe['origtransferercalleridnum'],'transferercalleridname':_0x2334fe[_0x0051('0x16')],'transfererconnectedlinenum':_0x2334fe['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2334fe[_0x0051('0x17')],'transfereraccountcode':_0x2334fe['origtransfereraccountcode'],'transferercontext':_0x2334fe[_0x0051('0x18')],'transfererexten':_0x2334fe[_0x0051('0x19')],'transfererlinkedid':_0x2334fe['origtransfererlinkedid'],'transfereechannel':_0x2334fe['transfertargetchannel'],'transfereecalleridnum':_0x2334fe['transfertargetcalleridnum'],'transfereecalleridname':_0x2334fe[_0x0051('0x1a')],'transfereeconnectedlinenum':_0x2334fe[_0x0051('0x1b')],'transfereeconnectedlinename':_0x2334fe[_0x0051('0x1c')],'transfereeaccountcode':_0x2334fe[_0x0051('0x1d')],'transfereecontext':_0x2334fe['transfertargetcontext'],'transfereeexten':_0x2334fe[_0x0051('0x1e')],'transfereelinkedid':_0x2334fe[_0x0051('0x1f')],'isexternal':_0x2334fe[_0x0051('0x20')],'context':_0x2334fe[_0x0051('0x21')],'extension':_0x2334fe['origtransfererexten'],'type':_0x0051('0x22')},'log':_0x0051('0x2')});}; \ No newline at end of file +var _0xcc06=['context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal'];(function(_0xa3c06b,_0x490f99){var _0x33aa1d=function(_0x23a88e){while(--_0x23a88e){_0xa3c06b['push'](_0xa3c06b['shift']());}};_0x33aa1d(++_0x490f99);}(_0xcc06,0x117));var _0x6cc0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xcc06[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0x6cc0('0x0'));exports['transfers']={};exports[_0x6cc0('0x1')]=function(_0x8fc2bd){return client[_0x6cc0('0x2')](_0x6cc0('0x3'),{'body':{'result':_0x8fc2bd[_0x6cc0('0x4')],'transfererchannel':_0x8fc2bd[_0x6cc0('0x5')],'transferercalleridnum':_0x8fc2bd[_0x6cc0('0x6')],'transferercalleridname':_0x8fc2bd[_0x6cc0('0x7')],'transfererconnectedlinenum':_0x8fc2bd[_0x6cc0('0x8')],'transfererconnectedlinename':_0x8fc2bd[_0x6cc0('0x9')],'transfereraccountcode':_0x8fc2bd[_0x6cc0('0xa')],'transferercontext':_0x8fc2bd[_0x6cc0('0xb')],'transfererexten':_0x8fc2bd[_0x6cc0('0xc')],'transfererlinkedid':_0x8fc2bd[_0x6cc0('0xd')],'transfereechannel':_0x8fc2bd[_0x6cc0('0xe')],'transfereecalleridnum':_0x8fc2bd['transfereecalleridnum'],'transfereecalleridname':_0x8fc2bd[_0x6cc0('0xf')],'transfereeconnectedlinenum':_0x8fc2bd[_0x6cc0('0x10')],'transfereeconnectedlinename':_0x8fc2bd[_0x6cc0('0x11')],'transfereeaccountcode':_0x8fc2bd[_0x6cc0('0x12')],'transfereecontext':_0x8fc2bd[_0x6cc0('0x13')],'transfereeexten':_0x8fc2bd['transfereeexten'],'transfereelinkedid':_0x8fc2bd[_0x6cc0('0x14')],'isexternal':_0x8fc2bd[_0x6cc0('0x15')],'context':_0x8fc2bd[_0x6cc0('0x16')],'extension':_0x8fc2bd[_0x6cc0('0x17')],'type':_0x6cc0('0x18')},'log':_0x6cc0('0x3')});};exports[_0x6cc0('0x19')]=function(_0x54af35){return client[_0x6cc0('0x2')](_0x6cc0('0x3'),{'body':{'result':_0x54af35[_0x6cc0('0x4')],'transfererchannel':_0x54af35[_0x6cc0('0x1a')],'transferercalleridnum':_0x54af35['origtransferercalleridnum'],'transferercalleridname':_0x54af35[_0x6cc0('0x1b')],'transfererconnectedlinenum':_0x54af35[_0x6cc0('0x1c')],'transfererconnectedlinename':_0x54af35['secondtransfererconnectedlinename'],'transfereraccountcode':_0x54af35[_0x6cc0('0x1d')],'transferercontext':_0x54af35['secondtransferercontext'],'transfererexten':_0x54af35[_0x6cc0('0x1e')],'transfererlinkedid':_0x54af35[_0x6cc0('0x1f')],'transfereechannel':_0x54af35[_0x6cc0('0x20')],'transfereecalleridnum':_0x54af35[_0x6cc0('0x21')],'transfereecalleridname':_0x54af35['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x54af35[_0x6cc0('0x22')],'transfereeconnectedlinename':_0x54af35[_0x6cc0('0x23')],'transfereeaccountcode':_0x54af35[_0x6cc0('0x24')],'transfereecontext':_0x54af35[_0x6cc0('0x25')],'transfereeexten':_0x54af35[_0x6cc0('0x26')],'transfereelinkedid':_0x54af35[_0x6cc0('0x27')],'isexternal':_0x54af35[_0x6cc0('0x15')],'context':_0x54af35[_0x6cc0('0x28')],'extension':_0x54af35[_0x6cc0('0x29')],'type':_0x6cc0('0x2a')},'log':_0x6cc0('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 72dcb97..bd5c75b 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 _0xbdc0=['queueChannels','voicequeuechannelhangup','Hangup','Channel\x20doesn\x27t\x20exist','voicequeuechannelredirect','exten','context','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','jayson/promise','bluebird','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','keys','module','action','Reload','Action','then','message','command','Command','content','catch','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','sumBillable','sumHoldTime','talking','total','type','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','length','omit','values','channels','voicechannel','find','channel','%s.%s','filename','uniqueid','wav','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','push','mixmonitorid','status','rec','validate','map','resolve','destinationchannel','StopMixMonitor','stop','voicequeuechannel'];(function(_0x437234,_0x1ca136){var _0x45675f=function(_0x126278){while(--_0x126278){_0x437234['push'](_0x437234['shift']());}};_0x45675f(++_0x1ca136);}(_0xbdc0,0x133));var _0x0bdc=function(_0x46bdfd,_0x37b7e5){_0x46bdfd=_0x46bdfd-0x0;var _0x3fed59=_0xbdc0[_0x46bdfd];return _0x3fed59;};'use strict';var _=require('lodash');var util=require(_0x0bdc('0x0'));var jayson=require(_0x0bdc('0x1'));var schema=require('validate');var BPromise=require(_0x0bdc('0x2'));var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0x0bdc('0x3'));var ami=require(_0x0bdc('0x4'));exports[_0x0bdc('0x5')]=function(_0x48c5c3,_0x418add,_0x6f2ef7){return new BPromise(function(_0x4bdad8,_0x565160){var _0xa29e9f={'QueuePause':function(_0xb8c234){return new Promise(function(_0xd19b13,_0x1e6d82){var _0x3fffbd=util[_0x0bdc('0x6')](_0x0bdc('0x7'),_0x0bdc('0x8'),_0xb8c234[_0x0bdc('0x9')]);if(_0x48c5c3[_0x0bdc('0xa')]&&_0x48c5c3[_0x0bdc('0xa')][_0x3fffbd]&&_0x48c5c3[_0x0bdc('0xa')][_0x3fffbd][_0x0bdc('0xb')]){_0x48c5c3[_0x0bdc('0xa')][_0x3fffbd][_0x0bdc('0xc')]();}if(_0x48c5c3[_0x0bdc('0xd')][_0x3fffbd]){_0x48c5c3[_0x0bdc('0xd')][_0x3fffbd][_0x0bdc('0xe')]({'statePause':_0xb8c234[_0x0bdc('0xf')]?!![]:![]});}_0xd19b13({'code':0xc8,'message':_0x0bdc('0x10')});});},'Reload':function(_0x34474f){var _0x4a6a25=this;return new Promise(function(_0xe45060,_0x29f414){if(ami[_0x0bdc('0x11')]()==![]){return _0x29f414(_0x4a6a25[_0x0bdc('0x12')](0x1f4,[config[_0x0bdc('0x13')]['ip'],config['asterisk'][_0x0bdc('0x14')],_0x0bdc('0x15')][_0x0bdc('0x16')]('\x20')));}_0x34474f=_['pick'](_0x34474f,_[_0x0bdc('0x17')](properties[_0x0bdc('0x18')]));_0x34474f[_0x0bdc('0x19')]=_0x0bdc('0x1a');return ami[_0x0bdc('0x1b')](_0x34474f)[_0x0bdc('0x1c')](function(_0x57c51f){_0xe45060({'code':0xc8,'message':_0x57c51f[_0x0bdc('0x1d')]});})['catch'](function(_0x3dfe8c){_0x29f414(_0x4a6a25[_0x0bdc('0x12')](0x1f5,_0x3dfe8c[_0x0bdc('0x1d')]));});});},'Command':function(_0x588104){var _0x5c3eee=this;return new Promise(function(_0x5dc03d,_0x1b01c0){if(ami[_0x0bdc('0x11')]()==![]){return _0x1b01c0(_0x5c3eee[_0x0bdc('0x12')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x0bdc('0x14')],_0x0bdc('0x15')][_0x0bdc('0x16')]('\x20')));}_0x588104=_['pick'](_0x588104,_0x0bdc('0x1e'));_0x588104['action']=_0x0bdc('0x1f');return ami['Action'](_0x588104)[_0x0bdc('0x1c')](function(_0x32bc03){_0x5dc03d({'code':0xc8,'message':_0x32bc03[_0x0bdc('0x20')]});})[_0x0bdc('0x21')](function(_0x4f75ae){_0x1b01c0(_0x5c3eee['error'](0x1f5,_0x4f75ae[_0x0bdc('0x1d')]));});});},'VoiceQueues':function(_0xb7cd6f){return new Promise(function(_0x268804,_0x3b9cd7){var _0x726d2=[];for(var _0x52c858 in _0x48c5c3[_0x0bdc('0x22')]){if(_0x48c5c3[_0x0bdc('0x22')][_0x0bdc('0x23')](_0x52c858)){var _0x211de4=_0x48c5c3[_0x0bdc('0x22')][_0x52c858];var _0x84dc52={'id':_0x211de4['id'],'name':_0x211de4[_0x0bdc('0x9')],'strategy':_0x211de4[_0x0bdc('0x24')],'answered':_0x211de4[_0x0bdc('0x25')],'available':_0x211de4[_0x0bdc('0x26')],'loggedIn':_0x211de4[_0x0bdc('0x27')],'pTalking':_0x211de4['pTalking'],'sumBillable':_0x211de4[_0x0bdc('0x28')],'sumDuration':_0x211de4['sumDuration'],'sumHoldTime':_0x211de4[_0x0bdc('0x29')]||0x0,'talking':_0x211de4[_0x0bdc('0x2a')],'total':_0x211de4[_0x0bdc('0x2b')],'type':_0x211de4[_0x0bdc('0x2c')],'unmanaged':_0x211de4['unmanaged'],'abandoned':_0x211de4[_0x0bdc('0x2d')],'waiting':_0x211de4['waiting'],'loggedInDb':_0x211de4[_0x0bdc('0x2e')]};if(_0x211de4[_0x0bdc('0x2c')]===_0x0bdc('0x2f')){_0x84dc52[_0x0bdc('0x30')]=_0x211de4[_0x0bdc('0x30')];_0x84dc52[_0x0bdc('0x31')]=_0x211de4[_0x0bdc('0x31')];_0x84dc52[_0x0bdc('0x32')]=_0x211de4[_0x0bdc('0x32')];_0x84dc52[_0x0bdc('0x33')]=_0x211de4[_0x0bdc('0x33')];_0x84dc52[_0x0bdc('0x34')]=_0x211de4[_0x0bdc('0x34')];_0x84dc52[_0x0bdc('0x35')]=_0x211de4[_0x0bdc('0x35')];_0x84dc52[_0x0bdc('0x36')]=_0x211de4[_0x0bdc('0x36')];_0x84dc52[_0x0bdc('0x37')]=_0x211de4[_0x0bdc('0x37')];_0x84dc52[_0x0bdc('0x38')]=_0x211de4[_0x0bdc('0x38')];_0x84dc52[_0x0bdc('0x39')]=_0x211de4[_0x0bdc('0x39')];_0x84dc52[_0x0bdc('0x3a')]=_0x211de4['outboundBusyCallsDay'];_0x84dc52[_0x0bdc('0x3b')]=_0x211de4[_0x0bdc('0x3b')];_0x84dc52[_0x0bdc('0x3c')]=_0x211de4[_0x0bdc('0x3c')];_0x84dc52[_0x0bdc('0x3d')]=_0x211de4[_0x0bdc('0x3d')];_0x84dc52[_0x0bdc('0x3e')]=_0x211de4[_0x0bdc('0x3e')];_0x84dc52[_0x0bdc('0x3f')]=_0x211de4['outboundNoAnswerCallsDay'];_0x84dc52[_0x0bdc('0x40')]=_0x211de4[_0x0bdc('0x40')];_0x84dc52[_0x0bdc('0x41')]=_0x211de4[_0x0bdc('0x41')];_0x84dc52[_0x0bdc('0x42')]=_0x211de4[_0x0bdc('0x42')];_0x84dc52[_0x0bdc('0x43')]=_0x211de4[_0x0bdc('0x43')];_0x84dc52[_0x0bdc('0x44')]=_0x211de4[_0x0bdc('0x44')];_0x84dc52[_0x0bdc('0x45')]=_0x211de4[_0x0bdc('0x45')];_0x84dc52[_0x0bdc('0x46')]=_0x211de4[_0x0bdc('0x46')];_0x84dc52[_0x0bdc('0x47')]=_0x211de4[_0x0bdc('0x47')];_0x84dc52[_0x0bdc('0x48')]=_0x211de4[_0x0bdc('0x48')];_0x84dc52[_0x0bdc('0x49')]=_0x211de4[_0x0bdc('0x49')];_0x84dc52[_0x0bdc('0x4a')]=_0x211de4['predictiveIntervalErlangCalls'];_0x84dc52[_0x0bdc('0x4b')]=_0x211de4[_0x0bdc('0x4b')];_0x84dc52[_0x0bdc('0x4c')]=_0x211de4[_0x0bdc('0x4c')];_0x84dc52[_0x0bdc('0x4d')]=_0x211de4[_0x0bdc('0x4d')];_0x84dc52[_0x0bdc('0x4e')]=_0x211de4[_0x0bdc('0x4e')];_0x84dc52[_0x0bdc('0x4f')]=_0x211de4[_0x0bdc('0x4f')];_0x84dc52[_0x0bdc('0x50')]=_0x211de4['predictiveIntervalTotalCalls'];_0x84dc52['message']=_0x211de4[_0x0bdc('0x1d')];_0x84dc52[_0x0bdc('0x51')]=_0x211de4[_0x0bdc('0x51')];_0x84dc52[_0x0bdc('0x52')]=_0x211de4[_0x0bdc('0x52')];_0x84dc52['erlangCallToSecond']=_0x211de4[_0x0bdc('0x53')];_0x84dc52['erlangAbandonmentRate']=_0x211de4[_0x0bdc('0x54')];_0x84dc52[_0x0bdc('0x55')]=_0x211de4[_0x0bdc('0x55')];_0x84dc52[_0x0bdc('0x56')]=_0x211de4['startPredictive'];_0x84dc52[_0x0bdc('0x57')]=_0x211de4['startProgressive'];}if(_0x211de4[_0x0bdc('0x58')]){_0x84dc52[_0x0bdc('0x58')]={'id':_0x211de4['Trunk']['id'],'name':_0x211de4[_0x0bdc('0x58')][_0x0bdc('0x9')],'active':_0x211de4[_0x0bdc('0x58')][_0x0bdc('0x59')],'callerid':_0x211de4[_0x0bdc('0x58')]['callerid']};}if(_0x211de4[_0x0bdc('0x5a')]){_0x84dc52['Interval']={'id':_0x211de4[_0x0bdc('0x5a')]['id'],'name':_0x211de4[_0x0bdc('0x5a')]['name']};}_0x726d2['push'](_0x84dc52);}}_0x268804({'count':_0x726d2[_0x0bdc('0x5b')],'rows':_0x726d2});});},'UpdateVoiceQueue':function(_0x2c92f7){return new Promise(function(_0x593a31,_0xa2f6ae){var _0xe281de=_['find'](_0x48c5c3[_0x0bdc('0x22')],{'id':parseInt(_0x2c92f7['id'])});var _0x5ade03=_[_0x0bdc('0x5c')](_0x2c92f7,['id']);if(_0xe281de){for(var _0xb16daf in _0x5ade03){if(typeof _0x5ade03[_0xb16daf]!=='undefined'&&typeof _0xe281de[_0xb16daf]!=='undefined'){_0xe281de[_0xb16daf]=_0x5ade03[_0xb16daf];}}_0x593a31(_0xe281de);}else{_0xa2f6ae();}});},'VoiceChannels':function(_0x537768){return new Promise(function(_0x3859e2,_0x198790){var _0xca8e44=_[_0x0bdc('0x5d')](_0x48c5c3[_0x0bdc('0x5e')]);_0x3859e2({'count':_0xca8e44[_0x0bdc('0x5b')],'rows':_0xca8e44});});},'VoiceChannelMixMonitor':function(_0x1f5156){var _0x598bde=this;return new Promise(function(_0x2be7aa,_0x1f948b){if(ami[_0x0bdc('0x11')]()==![]){return _0x1f948b(_0x598bde[_0x0bdc('0x12')](0x1f4,[config[_0x0bdc('0x13')]['ip'],config['asterisk'][_0x0bdc('0x14')],_0x0bdc('0x15')][_0x0bdc('0x16')]('\x20')));}var _0x286e8e=schema(properties[_0x0bdc('0x5f')])['validate'](_0x1f5156);if(_0x286e8e[_0x0bdc('0x5b')]>0x0){return _0x1f948b(_0x598bde[_0x0bdc('0x12')](0x1f4,_['map'](_0x286e8e,_0x0bdc('0x1d'))[_0x0bdc('0x16')](',\x20')));}var _0x7fd18b=_[_0x0bdc('0x60')](_0x48c5c3[_0x0bdc('0x5e')],{'uniqueid':_0x1f5156['uniqueid']});if(_0x7fd18b&&_0x7fd18b[_0x0bdc('0x61')]){var _0x3ec5c0=util[_0x0bdc('0x6')](_0x0bdc('0x62'),_0x1f5156[_0x0bdc('0x63')]||_0x1f5156[_0x0bdc('0x64')],_0x1f5156[_0x0bdc('0x6')]||_0x0bdc('0x65'));return ami[_0x0bdc('0x1b')]({'action':_0x0bdc('0x66'),'channel':_0x7fd18b[_0x0bdc('0x61')],'file':_0x3ec5c0,'options':_0x0bdc('0x67')})['then'](function(_0x2e3699){var _0x4ccb8a=_['find'](_0x7fd18b['monitors'],{'filename':_0x0bdc('0x68')+_0x3ec5c0[_0x0bdc('0x69')]()});if(_[_0x0bdc('0x6a')](_0x4ccb8a)){_0x7fd18b[_0x0bdc('0x6b')][_0x0bdc('0x6c')]({'filename':_0x0bdc('0x68')+_0x3ec5c0[_0x0bdc('0x69')](),'createdAt':moment()[_0x0bdc('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x2e3699[_0x0bdc('0x6d')],'status':'rec'});}else{_0x4ccb8a['mixmonitorid']=_0x2e3699[_0x0bdc('0x6d')];_0x4ccb8a[_0x0bdc('0x6e')]=_0x0bdc('0x6f');}_0x2be7aa({'code':0xc8,'message':[_0x1f5156[_0x0bdc('0x64')],'MixMonitor\x20Success',_0x2e3699[_0x0bdc('0x6d')]][_0x0bdc('0x16')]('\x20'),'mixmonitorid':_0x2e3699[_0x0bdc('0x6d')]});})[_0x0bdc('0x21')](function(_0x86fc2c){_0x1f948b(_0x598bde['error'](0x1f5,[_0x1f5156['uniqueid'],_0x86fc2c[_0x0bdc('0x1d')][_0x0bdc('0x69')]()][_0x0bdc('0x16')]('\x20')));});}else{return _0x1f948b(_0x598bde['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x55fa92){var _0x307f0d=this;return new Promise(function(_0x530d93,_0x10aa68){if(ami[_0x0bdc('0x11')]()==![]){return _0x10aa68(_0x307f0d['error'](0x1f4,[config[_0x0bdc('0x13')]['ip'],config[_0x0bdc('0x13')][_0x0bdc('0x14')],_0x0bdc('0x15')][_0x0bdc('0x16')]('\x20')));}var _0x2e52bb=schema(properties[_0x0bdc('0x5f')])[_0x0bdc('0x70')](_0x55fa92);if(_0x2e52bb[_0x0bdc('0x5b')]>0x0){return _0x10aa68(_0x307f0d['error'](0x1f4,_[_0x0bdc('0x71')](_0x2e52bb,'message')[_0x0bdc('0x16')](',\x20')));}var _0x3cc936=_[_0x0bdc('0x60')](_0x48c5c3[_0x0bdc('0x5e')],{'uniqueid':_0x55fa92['uniqueid']});if(_0x3cc936){return BPromise[_0x0bdc('0x72')]()[_0x0bdc('0x1c')](function(){if(_0x3cc936[_0x0bdc('0x61')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x3cc936[_0x0bdc('0x61')],'mixmonitorid':_0x55fa92[_0x0bdc('0x6d')]})[_0x0bdc('0x21')](function(_0x5415ae){});}})[_0x0bdc('0x1c')](function(){if(_0x3cc936[_0x0bdc('0x73')]){return ami['Action']({'action':_0x0bdc('0x74'),'channel':_0x3cc936['destinationchannel'],'mixmonitorid':_0x55fa92[_0x0bdc('0x6d')]})[_0x0bdc('0x21')](function(_0x1fd2cb){});}})[_0x0bdc('0x1c')](function(_0x3a1abd){var _0x1c9048=_['find'](_0x3cc936[_0x0bdc('0x6b')],{'mixmonitorid':_0x55fa92[_0x0bdc('0x6d')]});if(_0x1c9048){_0x1c9048[_0x0bdc('0x6e')]=_0x0bdc('0x75');}})[_0x0bdc('0x1c')](function(){var _0x36779e=util[_0x0bdc('0x6')](_0x0bdc('0x62'),_0x55fa92[_0x0bdc('0x63')]||_0x55fa92[_0x0bdc('0x64')],_0x55fa92[_0x0bdc('0x6')]||_0x0bdc('0x65'));var _0x3482ef=_[_0x0bdc('0x60')](_0x3cc936[_0x0bdc('0x6b')],{'filename':_0x0bdc('0x68')+_0x36779e[_0x0bdc('0x69')]()});if(_0x3482ef){_0x3482ef[_0x0bdc('0x6e')]=_0x0bdc('0x75');}})[_0x0bdc('0x1c')](function(){_0x530d93({'code':0xc8,'message':[_0x55fa92[_0x0bdc('0x64')],'StopMixMonitor\x20Success'][_0x0bdc('0x16')]('\x20')});})[_0x0bdc('0x21')](function(_0x5e9183){_0x10aa68(_0x307f0d[_0x0bdc('0x12')](0x1f5,[_0x55fa92['uniqueid'],_0x5e9183['message'][_0x0bdc('0x69')]()]['join']('\x20')));});}else{return _0x10aa68(_0x307f0d[_0x0bdc('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x5cc14b){return new Promise(function(_0x1cca71,_0xebe121){var _0x3fe438=_['values'](_0x48c5c3['queueChannels']);_0x1cca71({'count':_0x3fe438[_0x0bdc('0x5b')],'rows':_0x3fe438});});},'VoiceQueuesChannel':function(_0x106af4){var _0x1390be=this;return new Promise(function(_0x3d6bab,_0x316c1f){var _0x124df9=schema(properties[_0x0bdc('0x76')])[_0x0bdc('0x70')](_0x106af4);if(_0x124df9['length']>0x0){return _0x316c1f(_0x1390be[_0x0bdc('0x12')](0x1f4,_[_0x0bdc('0x71')](_0x124df9,_0x0bdc('0x1d'))[_0x0bdc('0x16')](',\x20')));}var _0x2d18e3=_[_0x0bdc('0x60')](_0x48c5c3[_0x0bdc('0x77')],{'uniqueid':_0x106af4['uniqueid']});if(_0x2d18e3){_0x3d6bab(_0x2d18e3);}else{return _0x316c1f(_0x1390be[_0x0bdc('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0xf9148e){var _0x5f228d=this;return new Promise(function(_0x30d02e,_0x1067fb){if(ami[_0x0bdc('0x11')]()==![]){return _0x1067fb(_0x5f228d[_0x0bdc('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x0bdc('0x13')][_0x0bdc('0x14')],_0x0bdc('0x15')][_0x0bdc('0x16')]('\x20')));}var _0xf318ac=schema(properties[_0x0bdc('0x78')])[_0x0bdc('0x70')](_0xf9148e);if(_0xf318ac[_0x0bdc('0x5b')]>0x0){return _0x1067fb(_0x5f228d[_0x0bdc('0x12')](0x1f4,_[_0x0bdc('0x71')](_0xf318ac,_0x0bdc('0x1d'))[_0x0bdc('0x16')](',\x20')));}var _0x38f256=_[_0x0bdc('0x60')](_0x48c5c3[_0x0bdc('0x77')],{'uniqueid':_0xf9148e[_0x0bdc('0x64')]});if(_0x38f256&&_0x38f256[_0x0bdc('0x61')]){return ami[_0x0bdc('0x1b')]({'action':_0x0bdc('0x79'),'channel':_0x38f256[_0x0bdc('0x61')]})['then'](function(_0x159403){_0x30d02e({'code':0xc8,'message':[_0xf9148e[_0x0bdc('0x64')],_0x159403[_0x0bdc('0x1d')][_0x0bdc('0x69')]()][_0x0bdc('0x16')]('\x20')});})[_0x0bdc('0x21')](function(_0x9daf82){_0x1067fb(_0x5f228d[_0x0bdc('0x12')](0x1f5,[_0xf9148e[_0x0bdc('0x64')],_0x9daf82['message']['toLowerCase']()][_0x0bdc('0x16')]('\x20')));});}else{return _0x1067fb(_0x5f228d[_0x0bdc('0x12')](0x1f5,_0x0bdc('0x7a')));}});},'VoiceQueuesChannelRedirect':function(_0x3506d9){var _0x4bd9f7=this;return new Promise(function(_0x31b6bf,_0x405203){if(ami[_0x0bdc('0x11')]()==![]){return _0x405203(_0x4bd9f7[_0x0bdc('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x0bdc('0x13')][_0x0bdc('0x14')],_0x0bdc('0x15')]['join']('\x20')));}var _0x568278=schema(properties[_0x0bdc('0x7b')])[_0x0bdc('0x70')](_0x3506d9);if(_0x568278[_0x0bdc('0x5b')]>0x0){return _0x405203(_0x4bd9f7['error'](0x1f4,_[_0x0bdc('0x71')](_0x568278,'message')[_0x0bdc('0x16')](',\x20')));}var _0x1452f3=_['find'](_0x48c5c3['queueChannels'],{'uniqueid':_0x3506d9[_0x0bdc('0x64')]});if(_0x1452f3&&_0x1452f3[_0x0bdc('0x61')]){return ami[_0x0bdc('0x1b')]({'action':'Redirect','channel':_0x1452f3[_0x0bdc('0x61')],'exten':_0x3506d9[_0x0bdc('0x7c')],'context':_0x3506d9[_0x0bdc('0x7d')]||_0x1452f3[_0x0bdc('0x7d')],'priority':0x1})[_0x0bdc('0x1c')](function(_0x1bc814){_0x31b6bf({'code':0xc8,'message':[_0x3506d9[_0x0bdc('0x64')],_0x1bc814['message'][_0x0bdc('0x69')]()][_0x0bdc('0x16')]('\x20')});})[_0x0bdc('0x21')](function(_0x13fb05){_0x405203(_0x4bd9f7[_0x0bdc('0x12')](0x1f5,[_0x3506d9[_0x0bdc('0x64')],_0x13fb05[_0x0bdc('0x1d')][_0x0bdc('0x69')]()][_0x0bdc('0x16')]('\x20')));});}else{return _0x405203(_0x4bd9f7['error'](0x1f5,_0x0bdc('0x7a')));}});},'Agents':function(_0x18cf8f){return new Promise(function(_0x5bd54d,_0x3c8eeb){var _0x4ee526=_[_0x0bdc('0x5d')](_0x48c5c3['agents']);_0x5bd54d({'count':_0x4ee526['length'],'rows':_0x4ee526});});},'Telephones':function(_0x487af4){return new Promise(function(_0x16cfaf,_0x5380b2){var _0x5da2fd=_['values'](_0x48c5c3[_0x0bdc('0x7e')]);_0x16cfaf({'count':_0x5da2fd[_0x0bdc('0x5b')],'rows':_0x5da2fd});});},'Trunks':function(_0x3e68f7){return new Promise(function(_0x1fe743,_0x4776fb){var _0xb29665=_[_0x0bdc('0x5d')](_0x48c5c3[_0x0bdc('0x7f')]);_0x1fe743({'count':_0xb29665[_0x0bdc('0x5b')],'rows':_0xb29665});});},'OutboundChannels':function(_0x1d78c0){return new Promise(function(_0x13e434,_0x3c6919){var _0x475a1c=_[_0x0bdc('0x5d')](_0x48c5c3[_0x0bdc('0x80')]);_0x13e434({'count':_0x475a1c[_0x0bdc('0x5b')],'rows':_0x475a1c});});},'Outbound':function(_0x4869bb){return new Promise(function(_0x5cb730,_0x139673){_0x5cb730(_0x48c5c3[_0x0bdc('0x2f')]);});},'Campaigns':function(_0x1e4ab3){return new Promise(function(_0x2823aa,_0x2669f9){var _0x20f47d=_[_0x0bdc('0x5d')](_0x48c5c3[_0x0bdc('0x81')]);_0x2823aa({'count':_0x20f47d[_0x0bdc('0x5b')],'rows':_0x20f47d});});},'VoiceQueuesPreview':function(_0x13a82f){var _0x99abac=this;return new Promise(function(_0x182186,_0x434b4b){_0x418add['run'](_0x13a82f['id'])[_0x0bdc('0x1c')](function(_0x445827){_0x182186({'code':0xc8,'message':_0x445827['message']});})['catch'](function(_0x54e59e){_0x434b4b(_0x99abac[_0x0bdc('0x12')](0x1f4,_0x54e59e[_0x0bdc('0x1d')]));});});},'EventManager':function(_0x438892){var _0x27e21b=this;return new Promise(function(_0xc85c0f,_0x2a946f){if(!_0x438892[_0x0bdc('0x82')]){return _0x2a946f(_0x27e21b['error'](0x1f4,_0x0bdc('0x83')));}ami[_0x0bdc('0x84')](_0x0bdc('0x85')+_0x438892[_0x0bdc('0x82')],_0x438892[_0x0bdc('0x1d')]);_0xc85c0f({'code':0xc8,'message':_0x438892});});},'FaxAccounts':function(_0x2649be){return new Promise(function(_0x401d7b,_0x487313){var _0x4533c7=_[_0x0bdc('0x5d')](_0x48c5c3[_0x0bdc('0x86')]);_0x401d7b({'count':_0x4533c7[_0x0bdc('0x5b')],'rows':_0x4533c7});});},'SendFax':function(_0x4637a9){var _0x4e37aa=this;return new Promise(function(_0x4d34c7,_0x73b4ad){_0x6f2ef7[_0x0bdc('0x87')](_0x4637a9)[_0x0bdc('0x1c')](function(_0x1edf64){_0x4d34c7({'code':0xc8,'message':_0x1edf64[_0x0bdc('0x1d')]});})[_0x0bdc('0x21')](function(_0x492199){_0x73b4ad(_0x4e37aa[_0x0bdc('0x12')](0x1f4,_0x492199['message']));});});},'CheckAfterSend':function(_0x2279db){var _0x2cef39=this;return new Promise(function(_0x280abc,_0x584473){_0x6f2ef7[_0x0bdc('0x88')](_0x2279db)[_0x0bdc('0x1c')](function(_0x6b8d17){_0x280abc({'code':0xc8,'message':_0x6b8d17[_0x0bdc('0x1d')]});})['catch'](function(_0x1bf0de){_0x584473(_0x2cef39['error'](0x1f4,_0x1bf0de[_0x0bdc('0x1d')]));});});}};var _0x5904cb=jayson[_0x0bdc('0x89')](_0xa29e9f)[_0x0bdc('0x8a')]();_0x5904cb['on'](_0x0bdc('0x12'),function(_0x4be0fd){return _0x565160(_0x4be0fd);});_0x5904cb[_0x0bdc('0x5')](0x232a,_0x0bdc('0x8b'),function(){console[_0x0bdc('0x8c')](_0x0bdc('0x8d'),0x232a);return _0x4bdad8('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x08fc=['server','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','moment','../../../config/environment','../properties','listen','format','SIP','name','timers','timer','updateAcw','agents','pause','QueuePause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','action','Reload','Action','then','message','username','command','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','type','unmanaged','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','find','undefined','values','channels','voicechannel','map','uniqueid','%s.%s','wav','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','rec','mixmonitorid','status','MixMonitor\x20Success','catch','validate','channel','StopMixMonitor','destinationchannel','stop','filename','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','campaigns','run','emit','event','faxAccounts','send'];(function(_0x2edfb3,_0x1267bd){var _0x3df862=function(_0x5f5bd7){while(--_0x5f5bd7){_0x2edfb3['push'](_0x2edfb3['shift']());}};_0x3df862(++_0x1267bd);}(_0x08fc,0x11a));var _0xc08f=function(_0x4a4922,_0x82cb8f){_0x4a4922=_0x4a4922-0x0;var _0x55a8c6=_0x08fc[_0x4a4922];return _0x55a8c6;};'use strict';var _=require(_0xc08f('0x0'));var util=require(_0xc08f('0x1'));var jayson=require(_0xc08f('0x2'));var schema=require('validate');var BPromise=require(_0xc08f('0x3'));var moment=require(_0xc08f('0x4'));var config=require(_0xc08f('0x5'));var properties=require(_0xc08f('0x6'));var ami=require('../ami');exports[_0xc08f('0x7')]=function(_0x357f00,_0x418e75,_0x43c887){return new BPromise(function(_0x2a43aa,_0x5473af){var _0x51f964={'QueuePause':function(_0x595ab5){return new Promise(function(_0x335492,_0x27f9c7){var _0x2f0830=util[_0xc08f('0x8')]('%s/%s',_0xc08f('0x9'),_0x595ab5[_0xc08f('0xa')]);if(_0x357f00[_0xc08f('0xb')]&&_0x357f00['timers'][_0x2f0830]&&_0x357f00[_0xc08f('0xb')][_0x2f0830][_0xc08f('0xc')]){_0x357f00[_0xc08f('0xb')][_0x2f0830][_0xc08f('0xd')]();}if(_0x357f00[_0xc08f('0xe')][_0x2f0830]){_0x357f00['agents'][_0x2f0830]['updateStatusRealtime']({'statePause':_0x595ab5[_0xc08f('0xf')]?!![]:![]});}_0x335492({'code':0xc8,'message':_0xc08f('0x10')});});},'Reload':function(_0x9675f8){var _0x43d08c=this;return new Promise(function(_0x33d4f9,_0x441719){if(ami[_0xc08f('0x11')]()==![]){return _0x441719(_0x43d08c[_0xc08f('0x12')](0x1f4,[config[_0xc08f('0x13')]['ip'],config[_0xc08f('0x13')]['username'],_0xc08f('0x14')][_0xc08f('0x15')]('\x20')));}_0x9675f8=_[_0xc08f('0x16')](_0x9675f8,_[_0xc08f('0x17')](properties['module']));_0x9675f8[_0xc08f('0x18')]=_0xc08f('0x19');return ami[_0xc08f('0x1a')](_0x9675f8)[_0xc08f('0x1b')](function(_0x3f2cee){_0x33d4f9({'code':0xc8,'message':_0x3f2cee['message']});})['catch'](function(_0x49ab0d){_0x441719(_0x43d08c['error'](0x1f5,_0x49ab0d[_0xc08f('0x1c')]));});});},'Command':function(_0x146c45){var _0x1890f2=this;return new Promise(function(_0x2fa84b,_0x5b3be9){if(ami[_0xc08f('0x11')]()==![]){return _0x5b3be9(_0x1890f2[_0xc08f('0x12')](0x1f4,[config[_0xc08f('0x13')]['ip'],config[_0xc08f('0x13')][_0xc08f('0x1d')],_0xc08f('0x14')][_0xc08f('0x15')]('\x20')));}_0x146c45=_[_0xc08f('0x16')](_0x146c45,_0xc08f('0x1e'));_0x146c45[_0xc08f('0x18')]='Command';return ami[_0xc08f('0x1a')](_0x146c45)[_0xc08f('0x1b')](function(_0x2f23cd){_0x2fa84b({'code':0xc8,'message':_0x2f23cd[_0xc08f('0x1f')]});})['catch'](function(_0xc39159){_0x5b3be9(_0x1890f2['error'](0x1f5,_0xc39159[_0xc08f('0x1c')]));});});},'VoiceQueues':function(_0x37679c){return new Promise(function(_0x230180,_0x351827){var _0x11d489=[];for(var _0xed0606 in _0x357f00['voiceQueues']){if(_0x357f00[_0xc08f('0x20')][_0xc08f('0x21')](_0xed0606)){var _0x3a5d8d=_0x357f00['voiceQueues'][_0xed0606];var _0x2ab99d={'id':_0x3a5d8d['id'],'name':_0x3a5d8d[_0xc08f('0xa')],'strategy':_0x3a5d8d[_0xc08f('0x22')],'answered':_0x3a5d8d[_0xc08f('0x23')],'available':_0x3a5d8d[_0xc08f('0x24')],'loggedIn':_0x3a5d8d[_0xc08f('0x25')],'pTalking':_0x3a5d8d[_0xc08f('0x26')],'sumBillable':_0x3a5d8d[_0xc08f('0x27')],'sumDuration':_0x3a5d8d['sumDuration'],'sumHoldTime':_0x3a5d8d[_0xc08f('0x28')]||0x0,'talking':_0x3a5d8d[_0xc08f('0x29')],'total':_0x3a5d8d[_0xc08f('0x2a')],'type':_0x3a5d8d[_0xc08f('0x2b')],'unmanaged':_0x3a5d8d[_0xc08f('0x2c')],'abandoned':_0x3a5d8d[_0xc08f('0x2d')],'waiting':_0x3a5d8d['waiting'],'loggedInDb':_0x3a5d8d[_0xc08f('0x2e')]};if(_0x3a5d8d[_0xc08f('0x2b')]===_0xc08f('0x2f')){_0x2ab99d['dialActive']=_0x3a5d8d[_0xc08f('0x30')];_0x2ab99d['dialMethod']=_0x3a5d8d[_0xc08f('0x31')];_0x2ab99d[_0xc08f('0x32')]=_0x3a5d8d[_0xc08f('0x32')];_0x2ab99d[_0xc08f('0x33')]=_0x3a5d8d[_0xc08f('0x33')];_0x2ab99d[_0xc08f('0x34')]=_0x3a5d8d[_0xc08f('0x34')];_0x2ab99d['dialPrefix']=_0x3a5d8d[_0xc08f('0x35')];_0x2ab99d[_0xc08f('0x36')]=_0x3a5d8d[_0xc08f('0x36')];_0x2ab99d[_0xc08f('0x37')]=_0x3a5d8d['outboundAnswerAgiCallsDay'];_0x2ab99d[_0xc08f('0x38')]=_0x3a5d8d[_0xc08f('0x38')];_0x2ab99d['outboundBlacklistCallsDay']=_0x3a5d8d[_0xc08f('0x39')];_0x2ab99d[_0xc08f('0x3a')]=_0x3a5d8d[_0xc08f('0x3a')];_0x2ab99d[_0xc08f('0x3b')]=_0x3a5d8d[_0xc08f('0x3b')];_0x2ab99d[_0xc08f('0x3c')]=_0x3a5d8d[_0xc08f('0x3c')];_0x2ab99d[_0xc08f('0x3d')]=_0x3a5d8d[_0xc08f('0x3d')];_0x2ab99d[_0xc08f('0x3e')]=_0x3a5d8d[_0xc08f('0x3e')];_0x2ab99d[_0xc08f('0x3f')]=_0x3a5d8d[_0xc08f('0x3f')];_0x2ab99d[_0xc08f('0x40')]=_0x3a5d8d[_0xc08f('0x40')];_0x2ab99d[_0xc08f('0x41')]=_0x3a5d8d[_0xc08f('0x41')];_0x2ab99d[_0xc08f('0x42')]=_0x3a5d8d['outboundReCallsDay'];_0x2ab99d[_0xc08f('0x43')]=_0x3a5d8d[_0xc08f('0x43')];_0x2ab99d[_0xc08f('0x44')]=_0x3a5d8d['outboundUnknownCallsDay'];_0x2ab99d[_0xc08f('0x45')]=_0x3a5d8d[_0xc08f('0x45')];_0x2ab99d[_0xc08f('0x46')]=_0x3a5d8d['predictiveIntervalAvgHoldtime'];_0x2ab99d['predictiveIntervalAvgTalktime']=_0x3a5d8d[_0xc08f('0x47')];_0x2ab99d[_0xc08f('0x48')]=_0x3a5d8d[_0xc08f('0x48')];_0x2ab99d[_0xc08f('0x49')]=_0x3a5d8d[_0xc08f('0x49')];_0x2ab99d[_0xc08f('0x4a')]=_0x3a5d8d[_0xc08f('0x4a')];_0x2ab99d['predictiveIntervalErlangCallsDroppedCalls']=_0x3a5d8d['predictiveIntervalErlangCallsDroppedCalls'];_0x2ab99d['predictiveIntervalHitRate']=_0x3a5d8d['predictiveIntervalHitRate'];_0x2ab99d[_0xc08f('0x4b')]=_0x3a5d8d[_0xc08f('0x4b')];_0x2ab99d['predictiveIntervalPauses']=_0x3a5d8d[_0xc08f('0x4c')];_0x2ab99d[_0xc08f('0x4d')]=_0x3a5d8d[_0xc08f('0x4d')];_0x2ab99d[_0xc08f('0x4e')]=_0x3a5d8d['predictiveIntervalTotalCalls'];_0x2ab99d['message']=_0x3a5d8d[_0xc08f('0x1c')];_0x2ab99d['originated']=_0x3a5d8d[_0xc08f('0x4f')];_0x2ab99d[_0xc08f('0x50')]=_0x3a5d8d[_0xc08f('0x50')];_0x2ab99d[_0xc08f('0x51')]=_0x3a5d8d[_0xc08f('0x51')];_0x2ab99d[_0xc08f('0x52')]=_0x3a5d8d[_0xc08f('0x52')];_0x2ab99d['erlangBusyFactor']=_0x3a5d8d[_0xc08f('0x53')];_0x2ab99d[_0xc08f('0x54')]=_0x3a5d8d[_0xc08f('0x54')];_0x2ab99d[_0xc08f('0x55')]=_0x3a5d8d[_0xc08f('0x55')];}if(_0x3a5d8d[_0xc08f('0x56')]){_0x2ab99d['Trunk']={'id':_0x3a5d8d[_0xc08f('0x56')]['id'],'name':_0x3a5d8d[_0xc08f('0x56')][_0xc08f('0xa')],'active':_0x3a5d8d[_0xc08f('0x56')]['active'],'callerid':_0x3a5d8d['Trunk'][_0xc08f('0x57')]};}if(_0x3a5d8d['Interval']){_0x2ab99d[_0xc08f('0x58')]={'id':_0x3a5d8d[_0xc08f('0x58')]['id'],'name':_0x3a5d8d[_0xc08f('0x58')][_0xc08f('0xa')]};}_0x11d489[_0xc08f('0x59')](_0x2ab99d);}}_0x230180({'count':_0x11d489[_0xc08f('0x5a')],'rows':_0x11d489});});},'UpdateVoiceQueue':function(_0x4f2971){return new Promise(function(_0x11af06,_0x1ec066){var _0x3b7ef6=_[_0xc08f('0x5b')](_0x357f00[_0xc08f('0x20')],{'id':parseInt(_0x4f2971['id'])});var _0x13d509=_['omit'](_0x4f2971,['id']);if(_0x3b7ef6){for(var _0x280e43 in _0x13d509){if(typeof _0x13d509[_0x280e43]!=='undefined'&&typeof _0x3b7ef6[_0x280e43]!==_0xc08f('0x5c')){_0x3b7ef6[_0x280e43]=_0x13d509[_0x280e43];}}_0x11af06(_0x3b7ef6);}else{_0x1ec066();}});},'VoiceChannels':function(_0x1928ca){return new Promise(function(_0xa1885e,_0x59b014){var _0x280aff=_[_0xc08f('0x5d')](_0x357f00[_0xc08f('0x5e')]);_0xa1885e({'count':_0x280aff[_0xc08f('0x5a')],'rows':_0x280aff});});},'VoiceChannelMixMonitor':function(_0x2f870f){var _0x5c3388=this;return new Promise(function(_0x44bec1,_0x70078c){if(ami[_0xc08f('0x11')]()==![]){return _0x70078c(_0x5c3388[_0xc08f('0x12')](0x1f4,[config[_0xc08f('0x13')]['ip'],config[_0xc08f('0x13')]['username'],'ami\x20disconnected'][_0xc08f('0x15')]('\x20')));}var _0x5c7ed5=schema(properties[_0xc08f('0x5f')])['validate'](_0x2f870f);if(_0x5c7ed5[_0xc08f('0x5a')]>0x0){return _0x70078c(_0x5c3388[_0xc08f('0x12')](0x1f4,_[_0xc08f('0x60')](_0x5c7ed5,_0xc08f('0x1c'))['join'](',\x20')));}var _0x4da2f6=_[_0xc08f('0x5b')](_0x357f00['channels'],{'uniqueid':_0x2f870f[_0xc08f('0x61')]});if(_0x4da2f6&&_0x4da2f6['channel']){var _0x4d9f77=util[_0xc08f('0x8')](_0xc08f('0x62'),_0x2f870f['filename']||_0x2f870f[_0xc08f('0x61')],_0x2f870f[_0xc08f('0x8')]||_0xc08f('0x63'));return ami['Action']({'action':_0xc08f('0x64'),'channel':_0x4da2f6['channel'],'file':_0x4d9f77,'options':_0xc08f('0x65')})['then'](function(_0x3a7de6){var _0x520cbe=_['find'](_0x4da2f6['monitors'],{'filename':_0xc08f('0x66')+_0x4d9f77[_0xc08f('0x67')]()});if(_[_0xc08f('0x68')](_0x520cbe)){_0x4da2f6[_0xc08f('0x69')][_0xc08f('0x59')]({'filename':_0xc08f('0x66')+_0x4d9f77['toLowerCase'](),'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x3a7de6['mixmonitorid'],'status':_0xc08f('0x6a')});}else{_0x520cbe[_0xc08f('0x6b')]=_0x3a7de6[_0xc08f('0x6b')];_0x520cbe[_0xc08f('0x6c')]=_0xc08f('0x6a');}_0x44bec1({'code':0xc8,'message':[_0x2f870f['uniqueid'],_0xc08f('0x6d'),_0x3a7de6['mixmonitorid']][_0xc08f('0x15')]('\x20'),'mixmonitorid':_0x3a7de6[_0xc08f('0x6b')]});})[_0xc08f('0x6e')](function(_0x2eea73){_0x70078c(_0x5c3388[_0xc08f('0x12')](0x1f5,[_0x2f870f['uniqueid'],_0x2eea73[_0xc08f('0x1c')]['toLowerCase']()]['join']('\x20')));});}else{return _0x70078c(_0x5c3388[_0xc08f('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x1e5b04){var _0x52d4d4=this;return new Promise(function(_0x29e505,_0x3fca54){if(ami[_0xc08f('0x11')]()==![]){return _0x3fca54(_0x52d4d4[_0xc08f('0x12')](0x1f4,[config[_0xc08f('0x13')]['ip'],config[_0xc08f('0x13')]['username'],_0xc08f('0x14')][_0xc08f('0x15')]('\x20')));}var _0x3e3500=schema(properties[_0xc08f('0x5f')])[_0xc08f('0x6f')](_0x1e5b04);if(_0x3e3500[_0xc08f('0x5a')]>0x0){return _0x3fca54(_0x52d4d4['error'](0x1f4,_[_0xc08f('0x60')](_0x3e3500,_0xc08f('0x1c'))[_0xc08f('0x15')](',\x20')));}var _0x59f41c=_[_0xc08f('0x5b')](_0x357f00['channels'],{'uniqueid':_0x1e5b04[_0xc08f('0x61')]});if(_0x59f41c){return BPromise['resolve']()[_0xc08f('0x1b')](function(){if(_0x59f41c[_0xc08f('0x70')]){return ami['Action']({'action':_0xc08f('0x71'),'channel':_0x59f41c[_0xc08f('0x70')],'mixmonitorid':_0x1e5b04[_0xc08f('0x6b')]})[_0xc08f('0x6e')](function(_0x4cc5f8){});}})[_0xc08f('0x1b')](function(){if(_0x59f41c[_0xc08f('0x72')]){return ami['Action']({'action':_0xc08f('0x71'),'channel':_0x59f41c[_0xc08f('0x72')],'mixmonitorid':_0x1e5b04[_0xc08f('0x6b')]})[_0xc08f('0x6e')](function(_0x3b6b29){});}})[_0xc08f('0x1b')](function(_0x442c54){var _0xcda4ad=_[_0xc08f('0x5b')](_0x59f41c[_0xc08f('0x69')],{'mixmonitorid':_0x1e5b04['mixmonitorid']});if(_0xcda4ad){_0xcda4ad[_0xc08f('0x6c')]=_0xc08f('0x73');}})[_0xc08f('0x1b')](function(){var _0x261b20=util[_0xc08f('0x8')]('%s.%s',_0x1e5b04[_0xc08f('0x74')]||_0x1e5b04[_0xc08f('0x61')],_0x1e5b04[_0xc08f('0x8')]||_0xc08f('0x63'));var _0x190a3f=_['find'](_0x59f41c['monitors'],{'filename':_0xc08f('0x66')+_0x261b20['toLowerCase']()});if(_0x190a3f){_0x190a3f[_0xc08f('0x6c')]=_0xc08f('0x73');}})['then'](function(){_0x29e505({'code':0xc8,'message':[_0x1e5b04[_0xc08f('0x61')],_0xc08f('0x75')][_0xc08f('0x15')]('\x20')});})['catch'](function(_0x56ab5a){_0x3fca54(_0x52d4d4[_0xc08f('0x12')](0x1f5,[_0x1e5b04[_0xc08f('0x61')],_0x56ab5a[_0xc08f('0x1c')][_0xc08f('0x67')]()][_0xc08f('0x15')]('\x20')));});}else{return _0x3fca54(_0x52d4d4['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x35f389){return new Promise(function(_0x35034c,_0x2212c3){var _0x45f47c=_[_0xc08f('0x5d')](_0x357f00[_0xc08f('0x76')]);_0x35034c({'count':_0x45f47c[_0xc08f('0x5a')],'rows':_0x45f47c});});},'VoiceQueuesChannel':function(_0x259a78){var _0x2574c2=this;return new Promise(function(_0x194506,_0x1d672e){var _0x3e5af8=schema(properties[_0xc08f('0x77')])[_0xc08f('0x6f')](_0x259a78);if(_0x3e5af8[_0xc08f('0x5a')]>0x0){return _0x1d672e(_0x2574c2[_0xc08f('0x12')](0x1f4,_[_0xc08f('0x60')](_0x3e5af8,'message')[_0xc08f('0x15')](',\x20')));}var _0x179956=_[_0xc08f('0x5b')](_0x357f00[_0xc08f('0x76')],{'uniqueid':_0x259a78[_0xc08f('0x61')]});if(_0x179956){_0x194506(_0x179956);}else{return _0x1d672e(_0x2574c2[_0xc08f('0x12')](0x1f5,_0xc08f('0x78')));}});},'VoiceQueuesChannelHangup':function(_0x1f69a9){var _0x1b9e8a=this;return new Promise(function(_0x5a4e2a,_0x4cf3a4){if(ami[_0xc08f('0x11')]()==![]){return _0x4cf3a4(_0x1b9e8a[_0xc08f('0x12')](0x1f4,[config[_0xc08f('0x13')]['ip'],config[_0xc08f('0x13')][_0xc08f('0x1d')],_0xc08f('0x14')]['join']('\x20')));}var _0x101069=schema(properties[_0xc08f('0x79')])[_0xc08f('0x6f')](_0x1f69a9);if(_0x101069[_0xc08f('0x5a')]>0x0){return _0x4cf3a4(_0x1b9e8a[_0xc08f('0x12')](0x1f4,_[_0xc08f('0x60')](_0x101069,'message')[_0xc08f('0x15')](',\x20')));}var _0x419dfc=_[_0xc08f('0x5b')](_0x357f00['queueChannels'],{'uniqueid':_0x1f69a9[_0xc08f('0x61')]});if(_0x419dfc&&_0x419dfc[_0xc08f('0x70')]){return ami[_0xc08f('0x1a')]({'action':_0xc08f('0x7a'),'channel':_0x419dfc[_0xc08f('0x70')]})[_0xc08f('0x1b')](function(_0x993484){_0x5a4e2a({'code':0xc8,'message':[_0x1f69a9[_0xc08f('0x61')],_0x993484[_0xc08f('0x1c')][_0xc08f('0x67')]()]['join']('\x20')});})['catch'](function(_0x1673fa){_0x4cf3a4(_0x1b9e8a['error'](0x1f5,[_0x1f69a9[_0xc08f('0x61')],_0x1673fa[_0xc08f('0x1c')][_0xc08f('0x67')]()][_0xc08f('0x15')]('\x20')));});}else{return _0x4cf3a4(_0x1b9e8a['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x4c5574){var _0x4d244d=this;return new Promise(function(_0xea98a6,_0x399acc){if(ami[_0xc08f('0x11')]()==![]){return _0x399acc(_0x4d244d['error'](0x1f4,[config[_0xc08f('0x13')]['ip'],config['asterisk']['username'],_0xc08f('0x14')][_0xc08f('0x15')]('\x20')));}var _0x415d87=schema(properties[_0xc08f('0x7b')])[_0xc08f('0x6f')](_0x4c5574);if(_0x415d87['length']>0x0){return _0x399acc(_0x4d244d[_0xc08f('0x12')](0x1f4,_[_0xc08f('0x60')](_0x415d87,_0xc08f('0x1c'))[_0xc08f('0x15')](',\x20')));}var _0x1c8099=_['find'](_0x357f00[_0xc08f('0x76')],{'uniqueid':_0x4c5574['uniqueid']});if(_0x1c8099&&_0x1c8099[_0xc08f('0x70')]){return ami['Action']({'action':_0xc08f('0x7c'),'channel':_0x1c8099[_0xc08f('0x70')],'exten':_0x4c5574[_0xc08f('0x7d')],'context':_0x4c5574['context']||_0x1c8099[_0xc08f('0x7e')],'priority':0x1})[_0xc08f('0x1b')](function(_0x2ba08b){_0xea98a6({'code':0xc8,'message':[_0x4c5574['uniqueid'],_0x2ba08b[_0xc08f('0x1c')][_0xc08f('0x67')]()][_0xc08f('0x15')]('\x20')});})[_0xc08f('0x6e')](function(_0xf5ae81){_0x399acc(_0x4d244d[_0xc08f('0x12')](0x1f5,[_0x4c5574[_0xc08f('0x61')],_0xf5ae81[_0xc08f('0x1c')][_0xc08f('0x67')]()][_0xc08f('0x15')]('\x20')));});}else{return _0x399acc(_0x4d244d['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0xb31b60){return new Promise(function(_0x50c00d,_0x3ceaad){var _0x1528a5=_['values'](_0x357f00[_0xc08f('0xe')]);_0x50c00d({'count':_0x1528a5[_0xc08f('0x5a')],'rows':_0x1528a5});});},'Telephones':function(_0x1721be){return new Promise(function(_0x43be47,_0x5a2a28){var _0x2d35b7=_[_0xc08f('0x5d')](_0x357f00[_0xc08f('0x7f')]);_0x43be47({'count':_0x2d35b7[_0xc08f('0x5a')],'rows':_0x2d35b7});});},'Trunks':function(_0x1cada2){return new Promise(function(_0x23b486,_0x5c0d45){var _0x27deea=_[_0xc08f('0x5d')](_0x357f00[_0xc08f('0x80')]);_0x23b486({'count':_0x27deea[_0xc08f('0x5a')],'rows':_0x27deea});});},'OutboundChannels':function(_0x3f538a){return new Promise(function(_0x1e7188,_0xe18b47){var _0x4bf701=_[_0xc08f('0x5d')](_0x357f00['outboundChannels']);_0x1e7188({'count':_0x4bf701[_0xc08f('0x5a')],'rows':_0x4bf701});});},'Outbound':function(_0x4d134c){return new Promise(function(_0x460ebd,_0x3b1b94){_0x460ebd(_0x357f00['outbound']);});},'Campaigns':function(_0x40b8ad){return new Promise(function(_0x1ec9d7,_0x2b20b0){var _0x2dc973=_[_0xc08f('0x5d')](_0x357f00[_0xc08f('0x81')]);_0x1ec9d7({'count':_0x2dc973[_0xc08f('0x5a')],'rows':_0x2dc973});});},'VoiceQueuesPreview':function(_0x4ee492){var _0x584bf2=this;return new Promise(function(_0x46c432,_0x2c498f){_0x418e75[_0xc08f('0x82')](_0x4ee492['id'])['then'](function(_0x5f57ad){_0x46c432({'code':0xc8,'message':_0x5f57ad['message']});})['catch'](function(_0x2afeef){_0x2c498f(_0x584bf2[_0xc08f('0x12')](0x1f4,_0x2afeef['message']));});});},'EventManager':function(_0x27da30){var _0x433b2a=this;return new Promise(function(_0x10f28f,_0x2525f2){if(!_0x27da30['event']){return _0x2525f2(_0x433b2a[_0xc08f('0x12')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xc08f('0x83')]('custom:'+_0x27da30[_0xc08f('0x84')],_0x27da30[_0xc08f('0x1c')]);_0x10f28f({'code':0xc8,'message':_0x27da30});});},'FaxAccounts':function(_0x151199){return new Promise(function(_0x55bdc5,_0x38d5f0){var _0x480d4a=_[_0xc08f('0x5d')](_0x357f00[_0xc08f('0x85')]);_0x55bdc5({'count':_0x480d4a[_0xc08f('0x5a')],'rows':_0x480d4a});});},'SendFax':function(_0x1dcc0a){var _0x219cee=this;return new Promise(function(_0x1159b6,_0x383a04){_0x43c887[_0xc08f('0x86')](_0x1dcc0a)['then'](function(_0xac2042){_0x1159b6({'code':0xc8,'message':_0xac2042[_0xc08f('0x1c')]});})[_0xc08f('0x6e')](function(_0xfb2fd5){_0x383a04(_0x219cee['error'](0x1f4,_0xfb2fd5[_0xc08f('0x1c')]));});});},'CheckAfterSend':function(_0x931018){var _0x4ef195=this;return new Promise(function(_0x336eb0,_0x3b87e7){_0x43c887['checkAfterSend'](_0x931018)['then'](function(_0x4d6d4e){_0x336eb0({'code':0xc8,'message':_0x4d6d4e[_0xc08f('0x1c')]});})[_0xc08f('0x6e')](function(_0x3b4a38){_0x3b87e7(_0x4ef195['error'](0x1f4,_0x3b4a38['message']));});});}};var _0x4816cc=jayson[_0xc08f('0x87')](_0x51f964)['http']();_0x4816cc['on'](_0xc08f('0x12'),function(_0x5d6ed9){return _0x5473af(_0x5d6ed9);});_0x4816cc[_0xc08f('0x7')](0x232a,_0xc08f('0x88'),function(){console[_0xc08f('0x89')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x2a43aa(_0xc08f('0x8a')+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 d7f53d6..0abd06b 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 _0xdb75=['phone','$or','map','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','length','info','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','routeId','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','isNil','push','user:%s','trigger:%s','action','toLowerCase','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','[CM][%s][%s]','stringify','emit','exec','data2','xmd-contactid','ListId','data3','split'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xdb75,0x98));var _0x5db7=function(_0x33d86c,_0x5a19e5){_0x33d86c=_0x33d86c-0x0;var _0x32bac2=_0xdb75[_0x33d86c];return _0x32bac2;};'use strict';var _=require(_0x5db7('0x0'));var BPromise=require(_0x5db7('0x1'));var Redis=require('ioredis');var util=require(_0x5db7('0x2'));var config=require(_0x5db7('0x3'));var logger=require(_0x5db7('0x4'))(_0x5db7('0x5'));var cmContactRpc=require(_0x5db7('0x6'));config[_0x5db7('0x7')]=_[_0x5db7('0x8')](config[_0x5db7('0x7')],{'host':_0x5db7('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x54c07f,_0x324f87,_0x5a3072,_0x37d6f6,_0x45fa74){logger['info'](_0x5db7('0xa'),_0x54c07f,_0x324f87['id'],_0x5a3072,_0x37d6f6,JSON[_0x5db7('0xb')](_0x45fa74));io['to'](_0x5a3072)[_0x5db7('0xc')](_0x37d6f6,_0x45fa74);}exports[_0x5db7('0xd')]=function(_0x58cfad,_0x31e11f,_0x124ef9,_0x399364){var _0x2aca0f,_0x48a761;var _0x9ce800={};var _0x52b3f6=Number(_0x124ef9['data1']);var _0x3102eb=_0x124ef9[_0x5db7('0xe')]?Boolean(Number(_0x124ef9['data2'])):![];var _0x5922;if(_0x399364[_0x5db7('0xf')]){_0x9ce800['id']=_0x399364[_0x5db7('0xf')];}if(!_0x9ce800['id']){_0x9ce800[_0x5db7('0x10')]=_0x52b3f6;_0x5922=_0x124ef9[_0x5db7('0x11')]&&_0x124ef9['data3']!=='0'?_0x124ef9[_0x5db7('0x11')][_0x5db7('0x12')](','):[_0x5db7('0x13')];_0x9ce800[_0x5db7('0x14')]=_[_0x5db7('0x15')](_0x5922,function(_0x2bdfc2){var _0x2fa2dc={};_0x2fa2dc[_0x2bdfc2]=_0x399364['routeId']?_0x399364[_0x5db7('0x16')]:_0x399364[_0x5db7('0x17')];return _0x2fa2dc;});}var _0x5198a5=['id',_0x5db7('0x18'),_0x5db7('0x19'),_0x5db7('0x13'),_0x5db7('0x1a'),_0x5db7('0x1b'),_0x5db7('0x10'),_0x5db7('0x1c'),_0x5db7('0x1d'),_0x5db7('0x1e')];var _0xa15711=_[_0x5db7('0x1f')](_0x5198a5,_0x5922);BPromise[_0x5db7('0x20')]()[_0x5db7('0x21')](cmContactRpc[_0x5db7('0x22')]({'attributes':_0xa15711,'where':_0x9ce800}))[_0x5db7('0x21')](function(_0x257d71){_0x48a761=_0x257d71;if(!_['isEmpty'](_0x48a761)){if(_0x48a761[_0x5db7('0x23')]===0x1){_0x2aca0f=_0x48a761[0x0];logger[_0x5db7('0x24')](_0x5db7('0x25'),_0x399364['uniqueid'],_0x31e11f['id'],_0x2aca0f['id']);}else{logger[_0x5db7('0x24')](_0x5db7('0x26'),_0x399364[_0x5db7('0x27')],_0x31e11f['id'],_['map'](_0x48a761,'id')[_0x5db7('0x28')](','));}return;}else{logger['info'](_0x5db7('0x29'),_0x399364[_0x5db7('0x27')],_0x31e11f['id']);var _0x5e634c={'ListId':_0x52b3f6};var _0x504ae0=_0x124ef9[_0x5db7('0x2a')]&&_0x124ef9[_0x5db7('0x2a')]!=='0'?_0x124ef9[_0x5db7('0x2a')]:_0x5db7('0x13');if(_0x3102eb){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x399364[_0x5db7('0x27')],_0x31e11f['id']);_0x5e634c[_0x504ae0]=_['isNil'](_0x399364['routeId'])?_0x399364[_0x5db7('0x17')]:_0x399364[_0x5db7('0x16')];if(_['isNil'](_0x399364[_0x5db7('0x2b')])){_0x5e634c[_0x5db7('0x18')]=_0x399364['calleridname']&&_0x399364[_0x5db7('0x2c')]!==_0x5db7('0x2d')?_0x399364['calleridname']:_0x5db7('0x2e');}else{_0x5e634c[_0x5db7('0x18')]=_0x399364[_0x5db7('0x2f')]&&_0x399364[_0x5db7('0x2f')]!==_0x5db7('0x2d')?_0x399364[_0x5db7('0x2f')]:_0x5db7('0x2e');}return BPromise[_0x5db7('0x20')]()[_0x5db7('0x21')](cmContactRpc[_0x5db7('0x30')](_0x5e634c))['then'](function(_0x7ba9d2){_0x2aca0f=_0x7ba9d2;_0x48a761['push'](_0x7ba9d2);if(_0x2aca0f){logger['info'](_0x5db7('0x31'),_0x399364[_0x5db7('0x27')],_0x31e11f['id'],_0x2aca0f['id']);}return;});}else{logger['info'](_0x5db7('0x32'),_0x399364['uniqueid'],_0x31e11f['id']);_0x5e634c[_0x504ae0]=_[_0x5db7('0x33')](_0x399364['routeId'])?_0x399364[_0x5db7('0x17')]:_0x399364['destcalleridnum'];if(_[_0x5db7('0x33')](_0x399364[_0x5db7('0x2b')])){_0x5e634c['firstName']=_0x399364[_0x5db7('0x2c')]&&_0x399364[_0x5db7('0x2c')]!==_0x5db7('0x2d')?_0x399364[_0x5db7('0x2c')]:_0x5db7('0x2e');}else{_0x5e634c[_0x5db7('0x18')]=_0x399364['destcalleridname']&&_0x399364[_0x5db7('0x2f')]!==_0x5db7('0x2d')?_0x399364[_0x5db7('0x2f')]:_0x5db7('0x2e');}_0x2aca0f=_0x5e634c;_0x48a761[_0x5db7('0x34')](_0x5e634c);return;}}})['then'](function(){if(_0x58cfad){emit(_0x399364[_0x5db7('0x27')],_0x31e11f,util['format'](_0x5db7('0x35'),_0x58cfad['name']),util['format'](_0x5db7('0x36'),_0x124ef9[_0x5db7('0x37')][_0x5db7('0x38')]()),{'evt':_['merge'](_0x399364,{'autoCreate':_0x3102eb}),'contact':_0x2aca0f===undefined?{}:_0x2aca0f,'contacts':_0x48a761[_0x5db7('0x23')]===0x0?undefined:_0x48a761});}});}; \ No newline at end of file +var _0xa23d=['ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','emit','exec','data1','data2','xmd-contactid','data3','split','phone','$or','map','routeId','destcalleridnum','firstName','lastName','mobile','fax','ListId','union','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridnum','calleridname','','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','action','merge','lodash','bluebird'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xa23d,0x6a));var _0xda23=function(_0x1c197e,_0x2dd3a7){_0x1c197e=_0x1c197e-0x0;var _0x5e31b7=_0xa23d[_0x1c197e];return _0x5e31b7;};'use strict';var _=require(_0xda23('0x0'));var BPromise=require(_0xda23('0x1'));var Redis=require(_0xda23('0x2'));var util=require(_0xda23('0x3'));var config=require('../../../../config/environment');var logger=require(_0xda23('0x4'))(_0xda23('0x5'));var cmContactRpc=require(_0xda23('0x6'));config[_0xda23('0x7')]=_['defaults'](config[_0xda23('0x7')],{'host':_0xda23('0x8'),'port':0x18eb});var io=require(_0xda23('0x9'))(new Redis(config[_0xda23('0x7')]));function emit(_0x91015e,_0xbfd4ce,_0x24bccb,_0x1d275a,_0x4075f4){logger[_0xda23('0xa')]('[CM][%s][%s]',_0x91015e,_0xbfd4ce['id'],_0x24bccb,_0x1d275a,JSON['stringify'](_0x4075f4));io['to'](_0x24bccb)[_0xda23('0xb')](_0x1d275a,_0x4075f4);}exports[_0xda23('0xc')]=function(_0x4a5570,_0x4ca7d6,_0x433e0e,_0x434e91){var _0x51037a,_0x1c2521;var _0x1aebc2={};var _0x3ff838=Number(_0x433e0e[_0xda23('0xd')]);var _0x3cd641=_0x433e0e[_0xda23('0xe')]?Boolean(Number(_0x433e0e[_0xda23('0xe')])):![];var _0x4ca40c;if(_0x434e91[_0xda23('0xf')]){_0x1aebc2['id']=_0x434e91[_0xda23('0xf')];}if(!_0x1aebc2['id']){_0x1aebc2['ListId']=_0x3ff838;_0x4ca40c=_0x433e0e['data3']&&_0x433e0e[_0xda23('0x10')]!=='0'?_0x433e0e[_0xda23('0x10')][_0xda23('0x11')](','):[_0xda23('0x12')];_0x1aebc2[_0xda23('0x13')]=_[_0xda23('0x14')](_0x4ca40c,function(_0x488739){var _0x3089b2={};_0x3089b2[_0x488739]=_0x434e91[_0xda23('0x15')]?_0x434e91[_0xda23('0x16')]:_0x434e91['calleridnum'];return _0x3089b2;});}var _0x37ab8f=['id',_0xda23('0x17'),_0xda23('0x18'),_0xda23('0x12'),_0xda23('0x19'),_0xda23('0x1a'),_0xda23('0x1b'),'createdAt','scheduledAt','updatedAt'];var _0x1a49f9=_[_0xda23('0x1c')](_0x37ab8f,_0x4ca40c);BPromise['resolve']()['then'](cmContactRpc[_0xda23('0x1d')]({'attributes':_0x1a49f9,'where':_0x1aebc2}))[_0xda23('0x1e')](function(_0x2e355f){_0x1c2521=_0x2e355f;if(!_[_0xda23('0x1f')](_0x1c2521)){if(_0x1c2521[_0xda23('0x20')]===0x1){_0x51037a=_0x1c2521[0x0];logger[_0xda23('0xa')](_0xda23('0x21'),_0x434e91[_0xda23('0x22')],_0x4ca7d6['id'],_0x51037a['id']);}else{logger[_0xda23('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x434e91[_0xda23('0x22')],_0x4ca7d6['id'],_[_0xda23('0x14')](_0x1c2521,'id')[_0xda23('0x23')](','));}return;}else{logger['info'](_0xda23('0x24'),_0x434e91[_0xda23('0x22')],_0x4ca7d6['id']);var _0x3e3378={'ListId':_0x3ff838};var _0x55294a=_0x433e0e[_0xda23('0x25')]&&_0x433e0e[_0xda23('0x25')]!=='0'?_0x433e0e[_0xda23('0x25')]:'phone';if(_0x3cd641){logger[_0xda23('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x434e91['uniqueid'],_0x4ca7d6['id']);_0x3e3378[_0x55294a]=_[_0xda23('0x26')](_0x434e91[_0xda23('0x15')])?_0x434e91[_0xda23('0x27')]:_0x434e91[_0xda23('0x16')];if(_['isNil'](_0x434e91[_0xda23('0x15')])){_0x3e3378['firstName']=_0x434e91[_0xda23('0x28')]&&_0x434e91['calleridname']!==_0xda23('0x29')?_0x434e91[_0xda23('0x28')]:_0xda23('0x2a');}else{_0x3e3378['firstName']=_0x434e91[_0xda23('0x2b')]&&_0x434e91[_0xda23('0x2b')]!==''?_0x434e91[_0xda23('0x2b')]:'Unknown';}return BPromise[_0xda23('0x2c')]()['then'](cmContactRpc[_0xda23('0x2d')](_0x3e3378))[_0xda23('0x1e')](function(_0x360a8d){_0x51037a=_0x360a8d;_0x1c2521[_0xda23('0x2e')](_0x360a8d);if(_0x51037a){logger['info'](_0xda23('0x2f'),_0x434e91[_0xda23('0x22')],_0x4ca7d6['id'],_0x51037a['id']);}return;});}else{logger[_0xda23('0xa')](_0xda23('0x30'),_0x434e91[_0xda23('0x22')],_0x4ca7d6['id']);_0x3e3378[_0x55294a]=_['isNil'](_0x434e91[_0xda23('0x15')])?_0x434e91[_0xda23('0x27')]:_0x434e91[_0xda23('0x16')];if(_[_0xda23('0x26')](_0x434e91[_0xda23('0x15')])){_0x3e3378[_0xda23('0x17')]=_0x434e91[_0xda23('0x28')]&&_0x434e91[_0xda23('0x28')]!==_0xda23('0x29')?_0x434e91['calleridname']:_0xda23('0x2a');}else{_0x3e3378['firstName']=_0x434e91[_0xda23('0x2b')]&&_0x434e91[_0xda23('0x2b')]!==''?_0x434e91[_0xda23('0x2b')]:_0xda23('0x2a');}_0x51037a=_0x3e3378;_0x1c2521[_0xda23('0x2e')](_0x3e3378);return;}}})[_0xda23('0x1e')](function(){if(_0x4a5570){emit(_0x434e91[_0xda23('0x22')],_0x4ca7d6,util[_0xda23('0x31')](_0xda23('0x32'),_0x4a5570[_0xda23('0x33')]),util[_0xda23('0x31')]('trigger:%s',_0x433e0e[_0xda23('0x34')]['toLowerCase']()),{'evt':_[_0xda23('0x35')](_0x434e91,{'autoCreate':_0x3cd641}),'contact':_0x51037a===undefined?{}:_0x51037a,'contacts':_0x1c2521[_0xda23('0x20')]===0x0?undefined:_0x1c2521});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 2370a32..7f9bd1c 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 _0xfb8d=['data1','popup','html','render','template\x20not\x20found','buildUri','isNil','data4','location','uriLocation','windowWidth','data5','data6','winApplication','data2','winArguments','data3','format','trigger:%s:%s','action','user:%s','name','trigger:%s','exec','integration','queue','urlforward','script','parse','query','replace','AllConditions','length','checkConditions','some','channel','field','account','chat','ChatWebsiteId','operator','value','AccountId','interaction','message','event','agent','membername','lastevent','routeId','exports','url','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','redis','defaults','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','emit','info','stringify','clone','checkTriggers','prototype','hasOwnProperty','status','checkTrigger','merge','variables','Actions','interface','toLowerCase','contactmanager','motionbar','browser'];(function(_0x4cf8ba,_0x53e39c){var _0x11216a=function(_0x585927){while(--_0x585927){_0x4cf8ba['push'](_0x4cf8ba['shift']());}};_0x11216a(++_0x53e39c);}(_0xfb8d,0x195));var _0xdfb8=function(_0x46ad7e,_0x101c11){_0x46ad7e=_0x46ad7e-0x0;var _0x39bffa=_0xfb8d[_0x46ad7e];return _0x39bffa;};'use strict';var util=require('util');var _=require('lodash');var url=require(_0xdfb8('0x0'));var Mustache=require('mustache');var Redis=require(_0xdfb8('0x1'));var urlforward=require(_0xdfb8('0x2'));var integration=require(_0xdfb8('0x3'));var cmContact=require(_0xdfb8('0x4'));var script=require(_0xdfb8('0x5'));var config=require(_0xdfb8('0x6'));var logger=require(_0xdfb8('0x7'))(_0xdfb8('0x8'));var ami=require('../ami');config[_0xdfb8('0x9')]=_[_0xdfb8('0xa')](config[_0xdfb8('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xdfb8('0xb'))(new Redis(config[_0xdfb8('0x9')]));var operators={'equals':function(_0x501ad0,_0x36a131){return _0x501ad0==_0x36a131;},'not_equals':function(_0x4a68ea,_0x22aa58){return _0x4a68ea!=_0x22aa58;}};var barAndWebActions=['popup',_0xdfb8('0x0'),_0xdfb8('0xc')];function Trigger(_0x47b4e2){this[_0xdfb8('0xd')]=_0x47b4e2[_0xdfb8('0xd')];this['agents']=_0x47b4e2[_0xdfb8('0xe')];this[_0xdfb8('0xf')]=_0x47b4e2[_0xdfb8('0xf')];this[_0xdfb8('0x10')]=_0x47b4e2[_0xdfb8('0x10')];this[_0xdfb8('0x11')]=_0x47b4e2[_0xdfb8('0x11')];this[_0xdfb8('0x12')]=_0x47b4e2[_0xdfb8('0x12')];this[_0xdfb8('0x13')]=_0x47b4e2[_0xdfb8('0x13')];this[_0xdfb8('0x14')]=_0x47b4e2[_0xdfb8('0x14')];this[_0xdfb8('0x15')]=_0x47b4e2[_0xdfb8('0x15')];this[_0xdfb8('0x16')]=_0x47b4e2['zohoAccounts'];this[_0xdfb8('0x17')]=_0x47b4e2[_0xdfb8('0x17')];this[_0xdfb8('0x18')]=_0x47b4e2[_0xdfb8('0x18')];this[_0xdfb8('0x19')]=_0x47b4e2[_0xdfb8('0x19')];this[_0xdfb8('0x1a')]=_0x47b4e2[_0xdfb8('0x1a')];this['freshsalesAccounts']=_0x47b4e2[_0xdfb8('0x1b')];this[_0xdfb8('0x1c')]={'zendesk':this[_0xdfb8('0x12')],'salesforce':this[_0xdfb8('0x14')],'freshdesk':this[_0xdfb8('0x13')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0xdfb8('0x16')],'desk':this[_0xdfb8('0x17')],'vtiger':this[_0xdfb8('0x18')],'dynamics365':this[_0xdfb8('0x1a')],'freshsales':this[_0xdfb8('0x1b')],'servicenow':this[_0xdfb8('0x19')]};ami['on'](_0xdfb8('0x1d'),this[_0xdfb8('0x1e')][_0xdfb8('0x1f')](this));ami['on'](_0xdfb8('0x20'),this[_0xdfb8('0x1e')][_0xdfb8('0x1f')](this));ami['on'](_0xdfb8('0x21'),this[_0xdfb8('0x1e')][_0xdfb8('0x1f')](this));ami['on'](_0xdfb8('0x22'),this[_0xdfb8('0x1e')]['bind'](this));ami['on'](_0xdfb8('0x23'),this[_0xdfb8('0x1e')]['bind'](this));ami['on']('custom:agentnoanswer',this[_0xdfb8('0x1e')][_0xdfb8('0x1f')](this));ami['on'](_0xdfb8('0x24'),this['syncCustomEvent'][_0xdfb8('0x1f')](this));ami['on'](_0xdfb8('0x25'),this[_0xdfb8('0x1e')][_0xdfb8('0x1f')](this));ami['on'](_0xdfb8('0x26'),this[_0xdfb8('0x1e')][_0xdfb8('0x1f')](this));ami['on'](_0xdfb8('0x27'),this[_0xdfb8('0x1e')][_0xdfb8('0x1f')](this));ami['on'](_0xdfb8('0x28'),this[_0xdfb8('0x1e')]['bind'](this));ami['on'](_0xdfb8('0x29'),this[_0xdfb8('0x1e')]['bind'](this));ami['on'](_0xdfb8('0x2a'),this['syncAgentDial'][_0xdfb8('0x1f')](this));ami['on'](_0xdfb8('0x2b'),this[_0xdfb8('0x2c')][_0xdfb8('0x1f')](this));ami['on'](_0xdfb8('0x2d'),this[_0xdfb8('0x2c')][_0xdfb8('0x1f')](this));ami['on']('custom:newinteraction',this[_0xdfb8('0x1e')][_0xdfb8('0x1f')](this));ami['on'](_0xdfb8('0x2e'),this[_0xdfb8('0x1e')][_0xdfb8('0x1f')](this));ami['on'](_0xdfb8('0x2f'),this['syncCustomEvent'][_0xdfb8('0x1f')](this));ami['on'](_0xdfb8('0x30'),this['syncCustomEvent'][_0xdfb8('0x1f')](this));ami['on']('custom:acceptmessage',this[_0xdfb8('0x1e')][_0xdfb8('0x1f')](this));ami['on'](_0xdfb8('0x31'),this[_0xdfb8('0x1e')][_0xdfb8('0x1f')](this));}Trigger['prototype'][_0xdfb8('0x32')]=function(_0x1373f2,_0x5b8214,_0x1e09cd){logger[_0xdfb8('0x33')](_0x1373f2,_0x5b8214,JSON[_0xdfb8('0x34')](_0x1e09cd));io['to'](_0x1373f2)[_0xdfb8('0x32')](_0x5b8214,_0x1e09cd);};Trigger['prototype'][_0xdfb8('0x1e')]=function(_0x28ff11){var _0x42774b=_[_0xdfb8('0x35')](_0x28ff11);this[_0xdfb8('0x36')](_0x42774b);};Trigger['prototype']['syncAgentDial']=function(_0x314952){if(this[_0xdfb8('0xe')][_0x314952['interface']]){this[_0xdfb8('0x1e')](_0x314952);}};Trigger[_0xdfb8('0x37')][_0xdfb8('0x36')]=function(_0x47ba29){var _0x8343e9;for(var _0x52c0d6 in this[_0xdfb8('0xd')]){if(this[_0xdfb8('0xd')][_0xdfb8('0x38')](_0x52c0d6)){if(this[_0xdfb8('0xd')][_0x52c0d6][_0xdfb8('0x39')]){_0x8343e9=this[_0xdfb8('0x3a')](this[_0xdfb8('0xd')][_0x52c0d6],_0x47ba29);if(_0x8343e9){_[_0xdfb8('0x3b')](_0x47ba29,_0x47ba29[_0xdfb8('0x3c')]);for(var _0x27adc5=0x0,_0x49535f,_0x115cf2,_0x25f53e;_0x27adc50x0){_0x48a932=_['map'](_0x26037,_0x1bc7b9);}return _0x48a932;}function getCustomFields(_0x218e59,_0x20815d){var _0x531d73=[];var _0x4a2a92={'custom_fields':{}};if(_0x218e59[_0x55cd('0x27')]>0x0){_['forEach'](_0x218e59,function(_0x588377){if(_[_0x55cd('0x28')](['string',_0x55cd('0x29')],_0x588377[_0x55cd('0x2a')])&&_0x588377[_0x55cd('0x2b')]&&!_0x588377[_0x55cd('0x2c')]){_0x4a2a92[_0x588377[_0x55cd('0x2b')][_0x55cd('0x2d')]()]=_0x588377[_0x55cd('0x2e')]['toString']();}else if(_['includes'](['string','picklist'],_0x588377[_0x55cd('0x2a')])&&_0x588377[_0x55cd('0x2f')]&&_0x588377[_0x55cd('0x2c')]){_0x4a2a92[_0x55cd('0x30')][_0x588377[_0x55cd('0x2f')]]=_0x588377[_0x55cd('0x2e')]['toString']();}else if(_0x588377['type']===_0x55cd('0x31')&&_0x588377['variableName']&&_0x588377[_0x55cd('0x2f')]&&_0x588377[_0x55cd('0x2c')]){_0x20815d[_0x588377[_0x55cd('0x32')]]&&(_0x4a2a92[_0x55cd('0x30')][_0x588377['idField']]=_0x20815d[_0x588377[_0x55cd('0x32')]][_0x55cd('0x20')]());}else if(_0x588377[_0x55cd('0x2a')]===_0x55cd('0x33')&&_0x588377[_0x55cd('0x34')]&&_0x588377[_0x55cd('0x34')][_0x55cd('0x35')]&&_0x588377[_0x55cd('0x2f')]&&_0x588377[_0x55cd('0x2c')]){_0x20815d[_0x588377[_0x55cd('0x34')][_0x55cd('0x35')][_0x55cd('0x2d')]()]&&(_0x4a2a92[_0x55cd('0x30')][_0x588377['idField']]=_0x20815d[_0x588377[_0x55cd('0x34')][_0x55cd('0x35')][_0x55cd('0x2d')]()][_0x55cd('0x20')]());}});}if(_0x4a2a92[_0x55cd('0x36')]){_0x4a2a92[_0x55cd('0x36')]=Number(_0x4a2a92[_0x55cd('0x36')]);}return _0x4a2a92;}function getTicket(_0x5661d7,_0xa0ecc7,_0x3c4c60,_0xfa85d,_0xce8b23){logger['info'](_0x55cd('0x37'));var _0x147951=_[_0x55cd('0x38')]({'subject':intUtil[_0x55cd('0x39')](_0xfa85d[_0x55cd('0x3a')],_0xce8b23,'\x20'),'type':_0x55cd('0x3b'),'status':_0x55cd('0x3c'),'labels':[_0x55cd('0x3d'),_0x55cd('0x3e'),_0x55cd('0x3f')][_0x55cd('0x40')](getTags(_0xfa85d[_0x55cd('0x41')],'name')),'description':intUtil['getString'](_0xfa85d[_0x55cd('0x42')],_0xce8b23,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x55cd('0x43'),_0xa0ecc7['id']),'class':_0x55cd('0x44')}},'message':{'direction':'in','body':intUtil[_0x55cd('0x39')](_0xfa85d[_0x55cd('0x42')],_0xce8b23,'\x0a')}},getCustomFields(_0xfa85d[_0x55cd('0x45')],_0xce8b23));return request({'uri':util[_0x55cd('0xd')](_0x55cd('0x46'),_0x5661d7[_0x55cd('0xe')],_0x3c4c60['id']),'method':'POST','body':_0x147951});}exports['queue']=function(_0x5e8334,_0x3f23ce,_0x10e6d4,_0x95d7db,_0x267b56,_0x215ad6){var _0x4ac45c,_0x2e9e4c;_0x215ad6[_0x55cd('0xe')]=intUtil['stripTrailingSlash'](_0x215ad6['remoteUri']);_0x215ad6[_0x55cd('0x47')]=intUtil['stripTrailingSlash'](_0x215ad6[_0x55cd('0x47')]);if(_0x267b56&&_0x267b56['monitor_format']){logger[_0x55cd('0xb')](_0x55cd('0x48'),'Recording\x20is\x20enabled!');_0x3f23ce[_0x55cd('0x49')]=util[_0x55cd('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x215ad6[_0x55cd('0x47')],_0x3f23ce['uniqueid'],md5(_0x3f23ce[_0x55cd('0x4a')]));}else{_0x3f23ce[_0x55cd('0x49')]='';}headers['Authorization']=getAuth(_0x215ad6);return getUser(_0x215ad6,_0x95d7db[_0x55cd('0x4b')])['then'](function(_0x4750b0){_0x4ac45c=_0x4750b0;logger[_0x55cd('0xb')](_0x55cd('0x4c'),_0x4ac45c['id']);return getEndUser(_0x215ad6,_0x3f23ce[_0x55cd('0x4d')],_0x3f23ce[_0x55cd('0x4e')]);})[_0x55cd('0xf')](function(_0x410805){_0x2e9e4c=_0x410805;logger['info'](_0x55cd('0x4f'),_0x2e9e4c['id']);return getTicket(_0x215ad6,_0x4ac45c,_0x2e9e4c,_0x10e6d4,_0x3f23ce);})[_0x55cd('0xf')](function(_0x25ab70){if(_0x25ab70){logger[_0x55cd('0xb')](_0x55cd('0x50'));logger[_0x55cd('0xb')](_0x55cd('0x51'),_0x25ab70['id']);switch(_0x215ad6['type']){case _0x55cd('0x52'):logger[_0x55cd('0xb')](_0x55cd('0x48'),_0x55cd('0x53'));emit(util['format'](_0x55cd('0x54'),_0x95d7db[_0x55cd('0x35')]),_0x55cd('0x55'),{'recordId':_0x25ab70['id']});break;case _0x55cd('0x56'):logger[_0x55cd('0xb')](_0x55cd('0x48'),_0x55cd('0x57'));emit(util['format'](_0x55cd('0x54'),_0x95d7db[_0x55cd('0x35')]),_0x55cd('0x58'),{'uri':util[_0x55cd('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x25ab70['id'])});break;default:logger[_0x55cd('0x59')](_0x55cd('0x48'),_0x55cd('0x5a'));}}})[_0x55cd('0x5b')](function(_0x8d53dd){console[_0x55cd('0x59')](_0x8d53dd);logger[_0x55cd('0x59')](_0x55cd('0x48'),JSON[_0x55cd('0x17')](_0x8d53dd));});};exports[_0x55cd('0x5c')]=function(_0x562b6f,_0x128fe7,_0x56fc80,_0x324dfb,_0x7dbc5c,_0x4b2cb9,_0xe07c3){var _0x387fea,_0x16c175;_0x4b2cb9['remoteUri']=intUtil[_0x55cd('0x5d')](_0x4b2cb9[_0x55cd('0xe')]);_0x4b2cb9[_0x55cd('0x47')]=intUtil[_0x55cd('0x5d')](_0x4b2cb9[_0x55cd('0x47')]);if(_0xe07c3&&_0xe07c3[_0x55cd('0x5e')]&&_0xe07c3[_0x55cd('0x5e')]!==_0x55cd('0x5f')){logger[_0x55cd('0xb')](_0x55cd('0x60'),_0x55cd('0x61'));_0x128fe7[_0x55cd('0x49')]=util['format'](_0x55cd('0x62'),_0x4b2cb9[_0x55cd('0x47')],_0x128fe7[_0x55cd('0x4a')],md5(_0x128fe7[_0x55cd('0x4a')]));}headers[_0x55cd('0x63')]=getAuth(_0x4b2cb9);return getUser(_0x4b2cb9,_0x324dfb[_0x55cd('0x4b')])['then'](function(_0x2d1d6e){_0x387fea=_0x2d1d6e;logger[_0x55cd('0xb')](_0x55cd('0x4c'),_0x387fea['id']);return getEndUser(_0x4b2cb9,_0x128fe7['destcalleridname'],_0x128fe7[_0x55cd('0x64')]);})[_0x55cd('0xf')](function(_0x18dae3){_0x16c175=_0x18dae3;logger['info'](_0x55cd('0x4f'),_0x16c175['id']);return getTicket(_0x4b2cb9,_0x387fea,_0x16c175,_0x56fc80,_0x128fe7);})[_0x55cd('0xf')](function(_0x3a1312){if(_0x3a1312){logger[_0x55cd('0xb')](_0x55cd('0x50'));logger[_0x55cd('0xb')]('The\x20Ticket\x20ID\x20is:',_0x3a1312['id']);switch(_0x4b2cb9[_0x55cd('0x2a')]){case _0x55cd('0x52'):logger[_0x55cd('0xb')]('[QUEUE]',_0x55cd('0x53'));emit(util[_0x55cd('0xd')]('user:%s',_0x324dfb['name']),'trigger:desk:display',{'recordId':_0x3a1312['id']});break;case _0x55cd('0x56'):logger[_0x55cd('0xb')](_0x55cd('0x48'),_0x55cd('0x57'));emit(util[_0x55cd('0xd')]('user:%s',_0x324dfb[_0x55cd('0x35')]),_0x55cd('0x58'),{'uri':util[_0x55cd('0xd')]('%s/agent/tickets/%s',_0x4b2cb9[_0x55cd('0xe')],_0x3a1312['id'])});break;default:logger['error']('[OUTBOUND]','Desk\x20account\x20type\x20not\x20recognized');}}})[_0x55cd('0x5b')](function(_0x52ebee){logger[_0x55cd('0x59')](_0x55cd('0x60'),JSON[_0x55cd('0x17')](_0x52ebee));});};exports[_0x55cd('0x65')]=function(_0x38aec5,_0x2f086d,_0x42d215,_0x4b2d7a,_0x2f473f,_0x34e5e8){var _0x4063dd,_0x1a4a59;_0x34e5e8[_0x55cd('0xe')]=intUtil[_0x55cd('0x5d')](_0x34e5e8['remoteUri']);_0x34e5e8['serverUrl']=intUtil[_0x55cd('0x5d')](_0x34e5e8[_0x55cd('0x47')]);if(_0x2f473f&&_0x2f473f[_0x55cd('0x66')]){logger[_0x55cd('0xb')]('['+_0x2f086d[_0x55cd('0x67')][_0x55cd('0x68')]()+']','Recording\x20is\x20enabled!');_0x2f086d[_0x55cd('0x49')]=util['format'](_0x55cd('0x62'),_0x34e5e8[_0x55cd('0x47')],_0x2f086d[_0x55cd('0x4a')],md5(_0x2f086d[_0x55cd('0x4a')]));}else{_0x2f086d['recordingURL']='';}headers[_0x55cd('0x63')]=getAuth(_0x34e5e8);return getUser(_0x34e5e8)['then'](function(_0xf98d92){_0x4063dd=_0xf98d92;logger['info']('The\x20User\x20ID\x20is:',_0x4063dd['id']);return getEndUser(_0x34e5e8,_0x2f086d[_0x55cd('0x4d')],_0x2f086d[_0x55cd('0x4e')]);})[_0x55cd('0xf')](function(_0xc605f6){_0x1a4a59=_0xc605f6;logger['info'](_0x55cd('0x4f'),_0x1a4a59['id']);return getTicket(_0x34e5e8,_0x4063dd,_0x1a4a59,_0x42d215,_0x2f086d);})[_0x55cd('0xf')](function(_0x116a61){if(_0x116a61){logger[_0x55cd('0xb')](_0x55cd('0x50'));logger[_0x55cd('0xb')]('The\x20Ticket\x20ID\x20is:',_0x116a61['id']);}})['catch'](function(_0x5bd027){logger['error']('['+_0x2f086d[_0x55cd('0x67')][_0x55cd('0x68')]()+']',JSON[_0x55cd('0x17')](_0x5bd027));});}; \ No newline at end of file +var _0x2689=['CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','user:%s','trigger:desk:display','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','Desk\x20account\x20type\x20not\x20recognized','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','monitor_format','lastevent','toUpperCase','Authorization','calleridname','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','total_entries','find','_embedded','then','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','%s/token:%s','token','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','forEach','includes','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','getString','Subjects','phone','new','xCALLY','Motion'];(function(_0x58bf20,_0x570e4b){var _0x1eb587=function(_0x2ba928){while(--_0x2ba928){_0x58bf20['push'](_0x58bf20['shift']());}};_0x1eb587(++_0x570e4b);}(_0x2689,0x9f));var _0x9268=function(_0xe586cc,_0x40cdfc){_0xe586cc=_0xe586cc-0x0;var _0x3654bc=_0x2689[_0xe586cc];return _0x3654bc;};'use strict';var _=require(_0x9268('0x0'));var rp=require(_0x9268('0x1'));var md5=require(_0x9268('0x2'));var util=require(_0x9268('0x3'));var Redis=require(_0x9268('0x4'));var intUtil=require(_0x9268('0x5'));var config=require('../../../../config/environment');var logger=require(_0x9268('0x6'))(_0x9268('0x7'));config[_0x9268('0x8')]=_[_0x9268('0x9')](config['redis'],{'host':_0x9268('0xa'),'port':0x18eb});var io=require(_0x9268('0xb'))(new Redis(config['redis']));function emit(_0x1dac90,_0x2e9f02,_0x3ba931){io['to'](_0x1dac90)['emit'](_0x2e9f02,_0x3ba931);}var headers={'Content-Type':_0x9268('0xc'),'Accept':_0x9268('0xc')};function getUser(_0x4e21fe,_0x3d6845){if(intUtil[_0x9268('0xd')](_0x3d6845)===!![]){logger[_0x9268('0xe')](_0x9268('0xf'),_0x3d6845);return request({'uri':util[_0x9268('0x10')](_0x9268('0x11'),_0x4e21fe[_0x9268('0x12')])})['then'](function(_0xaf8505){if(_0xaf8505[_0x9268('0x13')]){return _[_0x9268('0x14')](_0xaf8505[_0x9268('0x15')]['entries'],{'email':_0x3d6845});}})[_0x9268('0x16')](function(_0x4329ff){if(_0x4329ff){logger[_0x9268('0xe')]('Agent\x20found!');return _0x4329ff;}else{logger[_0x9268('0xe')](_0x9268('0x17'));return request({'uri':util['format'](_0x9268('0x18'),_0x4e21fe[_0x9268('0x12')])});}});}else{logger['info'](_0x9268('0x19'));return request({'uri':util[_0x9268('0x10')](_0x9268('0x18'),_0x4e21fe[_0x9268('0x12')])});}}function request(_0x430f89){logger[_0x9268('0x1a')](_0x9268('0x1b'),JSON[_0x9268('0x1c')](_0x430f89));return rp(_[_0x9268('0x9')](_0x430f89,{'method':_0x9268('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x4340eb){var _0x4d8e17;if(_0x4340eb[_0x9268('0x1e')]===_0x9268('0x1f')){_0x4d8e17=util[_0x9268('0x10')](_0x9268('0x20'),_0x4340eb[_0x9268('0x21')],_0x4340eb['password']);}else if(_0x4340eb[_0x9268('0x1e')]==='token'){_0x4d8e17=util[_0x9268('0x10')](_0x9268('0x22'),_0x4340eb[_0x9268('0x21')],_0x4340eb[_0x9268('0x23')]);}return util['format']('Basic\x20%s',new Buffer(_0x4d8e17)[_0x9268('0x24')](_0x9268('0x25')));}function getEndUser(_0x8afa7e,_0xe93525,_0x559eeb){logger[_0x9268('0xe')](_0x9268('0x26'),_0x559eeb);return request({'uri':util[_0x9268('0x10')](_0x9268('0x27'),_0x8afa7e[_0x9268('0x12')]),'qs':{'phone':_0x559eeb}})[_0x9268('0x16')](function(_0x41b6df){if(_0x41b6df[_0x9268('0x13')]){logger[_0x9268('0xe')]('Enduser\x20found!');return _0x41b6df['_embedded']['entries'][0x0];}else{logger[_0x9268('0xe')](_0x9268('0x28'));return request({'uri':util[_0x9268('0x10')](_0x9268('0x29'),_0x8afa7e['remoteUri']),'method':_0x9268('0x2a'),'body':{'first_name':_0xe93525,'title':_0xe93525,'phone_numbers':[{'type':_0x9268('0x2b'),'value':_0x559eeb}]}});}});}function getTags(_0x2c0b3c,_0x57d89d){var _0x2b4af9=[];if(_0x2c0b3c&&_0x2c0b3c['length']>0x0){_0x2b4af9=_[_0x9268('0x2c')](_0x2c0b3c,_0x57d89d);}return _0x2b4af9;}function getCustomFields(_0x1fbe48,_0x2f204e){var _0x78ec5a=[];var _0x481549={'custom_fields':{}};if(_0x1fbe48[_0x9268('0x2d')]>0x0){_[_0x9268('0x2e')](_0x1fbe48,function(_0x5923dd){if(_[_0x9268('0x2f')](['string',_0x9268('0x30')],_0x5923dd[_0x9268('0x31')])&&_0x5923dd[_0x9268('0x32')]&&!_0x5923dd[_0x9268('0x33')]){_0x481549[_0x5923dd[_0x9268('0x32')]['toLowerCase']()]=_0x5923dd[_0x9268('0x34')][_0x9268('0x24')]();}else if(_['includes'](['string','picklist'],_0x5923dd[_0x9268('0x31')])&&_0x5923dd[_0x9268('0x35')]&&_0x5923dd[_0x9268('0x33')]){_0x481549[_0x9268('0x36')][_0x5923dd[_0x9268('0x35')]]=_0x5923dd[_0x9268('0x34')][_0x9268('0x24')]();}else if(_0x5923dd[_0x9268('0x31')]===_0x9268('0x37')&&_0x5923dd[_0x9268('0x38')]&&_0x5923dd[_0x9268('0x35')]&&_0x5923dd[_0x9268('0x33')]){_0x2f204e[_0x5923dd[_0x9268('0x38')]]&&(_0x481549[_0x9268('0x36')][_0x5923dd['idField']]=_0x2f204e[_0x5923dd['variableName']][_0x9268('0x24')]());}else if(_0x5923dd[_0x9268('0x31')]===_0x9268('0x39')&&_0x5923dd[_0x9268('0x3a')]&&_0x5923dd[_0x9268('0x3a')][_0x9268('0x3b')]&&_0x5923dd['idField']&&_0x5923dd[_0x9268('0x33')]){_0x2f204e[_0x5923dd[_0x9268('0x3a')]['name'][_0x9268('0x3c')]()]&&(_0x481549[_0x9268('0x36')][_0x5923dd[_0x9268('0x35')]]=_0x2f204e[_0x5923dd[_0x9268('0x3a')][_0x9268('0x3b')][_0x9268('0x3c')]()][_0x9268('0x24')]());}});}if(_0x481549[_0x9268('0x3d')]){_0x481549[_0x9268('0x3d')]=Number(_0x481549[_0x9268('0x3d')]);}return _0x481549;}function getTicket(_0x180612,_0x2196f3,_0x155ae3,_0x2e9776,_0x4f03ed){logger[_0x9268('0xe')](_0x9268('0x3e'));var _0x400a75=_['merge']({'subject':intUtil[_0x9268('0x3f')](_0x2e9776[_0x9268('0x40')],_0x4f03ed,'\x20'),'type':_0x9268('0x41'),'status':_0x9268('0x42'),'labels':[_0x9268('0x43'),_0x9268('0x44'),_0x9268('0x45')][_0x9268('0x46')](getTags(_0x2e9776[_0x9268('0x47')],_0x9268('0x3b'))),'description':intUtil['getString'](_0x2e9776[_0x9268('0x48')],_0x4f03ed,'\x0a'),'_links':{'assigned_user':{'href':util[_0x9268('0x10')](_0x9268('0x49'),_0x2196f3['id']),'class':_0x9268('0x4a')}},'message':{'direction':'in','body':intUtil[_0x9268('0x3f')](_0x2e9776[_0x9268('0x48')],_0x4f03ed,'\x0a')}},getCustomFields(_0x2e9776[_0x9268('0x4b')],_0x4f03ed));return request({'uri':util['format'](_0x9268('0x4c'),_0x180612['remoteUri'],_0x155ae3['id']),'method':'POST','body':_0x400a75});}exports[_0x9268('0x4d')]=function(_0x421e83,_0x422f2f,_0x1c7ea1,_0x63df1e,_0x485ff0,_0x4b8e06){var _0x7ae435,_0x3b67bd;_0x4b8e06['remoteUri']=intUtil[_0x9268('0x4e')](_0x4b8e06['remoteUri']);_0x4b8e06[_0x9268('0x4f')]=intUtil[_0x9268('0x4e')](_0x4b8e06[_0x9268('0x4f')]);if(_0x485ff0&&_0x485ff0['monitor_format']){logger[_0x9268('0xe')](_0x9268('0x50'),_0x9268('0x51'));_0x422f2f[_0x9268('0x52')]=util[_0x9268('0x10')](_0x9268('0x53'),_0x4b8e06[_0x9268('0x4f')],_0x422f2f[_0x9268('0x54')],md5(_0x422f2f[_0x9268('0x54')]));}else{_0x422f2f[_0x9268('0x52')]='';}headers['Authorization']=getAuth(_0x4b8e06);return getUser(_0x4b8e06,_0x63df1e[_0x9268('0x55')])[_0x9268('0x16')](function(_0x583442){_0x7ae435=_0x583442;logger[_0x9268('0xe')](_0x9268('0x56'),_0x7ae435['id']);return getEndUser(_0x4b8e06,_0x422f2f['calleridname'],_0x422f2f[_0x9268('0x57')]);})[_0x9268('0x16')](function(_0x5795af){_0x3b67bd=_0x5795af;logger[_0x9268('0xe')](_0x9268('0x58'),_0x3b67bd['id']);return getTicket(_0x4b8e06,_0x7ae435,_0x3b67bd,_0x1c7ea1,_0x422f2f);})[_0x9268('0x16')](function(_0x433a60){if(_0x433a60){logger[_0x9268('0xe')](_0x9268('0x59'));logger[_0x9268('0xe')](_0x9268('0x5a'),_0x433a60['id']);switch(_0x4b8e06[_0x9268('0x31')]){case'integrationTab':logger[_0x9268('0xe')](_0x9268('0x50'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x9268('0x5b'),_0x63df1e[_0x9268('0x3b')]),_0x9268('0x5c'),{'recordId':_0x433a60['id']});break;case'newTab':logger[_0x9268('0xe')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9268('0x10')](_0x9268('0x5b'),_0x63df1e[_0x9268('0x3b')]),_0x9268('0x5d'),{'uri':util['format'](_0x9268('0x5e'),_0x433a60['id'])});break;default:logger['error']('[QUEUE]',_0x9268('0x5f'));}}})[_0x9268('0x60')](function(_0x5cc7c8){console[_0x9268('0x61')](_0x5cc7c8);logger[_0x9268('0x61')]('[QUEUE]',JSON[_0x9268('0x1c')](_0x5cc7c8));});};exports[_0x9268('0x62')]=function(_0xb10da3,_0x29d1fc,_0x1c63f0,_0xbd16c1,_0x46b46d,_0x2630a4,_0x2fdd24){var _0x9e0937,_0x4e5a47;_0x2630a4['remoteUri']=intUtil['stripTrailingSlash'](_0x2630a4['remoteUri']);_0x2630a4[_0x9268('0x4f')]=intUtil[_0x9268('0x4e')](_0x2630a4[_0x9268('0x4f')]);if(_0x2fdd24&&_0x2fdd24[_0x9268('0x63')]&&_0x2fdd24[_0x9268('0x63')]!==_0x9268('0x64')){logger['info'](_0x9268('0x65'),_0x9268('0x51'));_0x29d1fc[_0x9268('0x52')]=util[_0x9268('0x10')](_0x9268('0x53'),_0x2630a4['serverUrl'],_0x29d1fc[_0x9268('0x54')],md5(_0x29d1fc[_0x9268('0x54')]));}headers['Authorization']=getAuth(_0x2630a4);return getUser(_0x2630a4,_0xbd16c1[_0x9268('0x55')])[_0x9268('0x16')](function(_0x1f8688){_0x9e0937=_0x1f8688;logger[_0x9268('0xe')](_0x9268('0x56'),_0x9e0937['id']);return getEndUser(_0x2630a4,_0x29d1fc[_0x9268('0x66')],_0x29d1fc[_0x9268('0x67')]);})['then'](function(_0x53c72b){_0x4e5a47=_0x53c72b;logger[_0x9268('0xe')](_0x9268('0x58'),_0x4e5a47['id']);return getTicket(_0x2630a4,_0x9e0937,_0x4e5a47,_0x1c63f0,_0x29d1fc);})['then'](function(_0x3b347d){if(_0x3b347d){logger[_0x9268('0xe')](_0x9268('0x59'));logger[_0x9268('0xe')]('The\x20Ticket\x20ID\x20is:',_0x3b347d['id']);switch(_0x2630a4[_0x9268('0x31')]){case _0x9268('0x68'):logger[_0x9268('0xe')](_0x9268('0x50'),_0x9268('0x69'));emit(util[_0x9268('0x10')](_0x9268('0x5b'),_0xbd16c1[_0x9268('0x3b')]),_0x9268('0x5c'),{'recordId':_0x3b347d['id']});break;case _0x9268('0x6a'):logger[_0x9268('0xe')](_0x9268('0x50'),_0x9268('0x6b'));emit(util[_0x9268('0x10')](_0x9268('0x5b'),_0xbd16c1['name']),_0x9268('0x5d'),{'uri':util[_0x9268('0x10')](_0x9268('0x6c'),_0x2630a4[_0x9268('0x12')],_0x3b347d['id'])});break;default:logger[_0x9268('0x61')]('[OUTBOUND]',_0x9268('0x5f'));}}})[_0x9268('0x60')](function(_0x381b66){logger['error'](_0x9268('0x65'),JSON['stringify'](_0x381b66));});};exports['unmanaged']=function(_0x26d1bf,_0x199ca1,_0xd72e0c,_0x348376,_0x1197e5,_0x5ad64d){var _0x56ddf9,_0x461908;_0x5ad64d[_0x9268('0x12')]=intUtil['stripTrailingSlash'](_0x5ad64d[_0x9268('0x12')]);_0x5ad64d[_0x9268('0x4f')]=intUtil[_0x9268('0x4e')](_0x5ad64d[_0x9268('0x4f')]);if(_0x1197e5&&_0x1197e5[_0x9268('0x6d')]){logger[_0x9268('0xe')]('['+_0x199ca1[_0x9268('0x6e')][_0x9268('0x6f')]()+']',_0x9268('0x51'));_0x199ca1[_0x9268('0x52')]=util[_0x9268('0x10')](_0x9268('0x53'),_0x5ad64d[_0x9268('0x4f')],_0x199ca1['uniqueid'],md5(_0x199ca1[_0x9268('0x54')]));}else{_0x199ca1['recordingURL']='';}headers[_0x9268('0x70')]=getAuth(_0x5ad64d);return getUser(_0x5ad64d)[_0x9268('0x16')](function(_0xee5869){_0x56ddf9=_0xee5869;logger[_0x9268('0xe')](_0x9268('0x56'),_0x56ddf9['id']);return getEndUser(_0x5ad64d,_0x199ca1[_0x9268('0x71')],_0x199ca1[_0x9268('0x57')]);})[_0x9268('0x16')](function(_0x38d3b2){_0x461908=_0x38d3b2;logger[_0x9268('0xe')](_0x9268('0x58'),_0x461908['id']);return getTicket(_0x5ad64d,_0x56ddf9,_0x461908,_0xd72e0c,_0x199ca1);})['then'](function(_0x2b9442){if(_0x2b9442){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x2b9442['id']);}})[_0x9268('0x60')](function(_0x38e01d){logger[_0x9268('0x61')]('['+_0x199ca1[_0x9268('0x6e')][_0x9268('0x6f')]()+']',JSON[_0x9268('0x1c')](_0x38e01d));});}; \ 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 c48f641..debcfd0 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 _0x307e=[']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','ioredis','../../../../config/logger','../../../../config/environment','defaults','redis','localhost','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','outbound','contacts','odata-entityid','lastIndexOf','enduserId','contacts?$select=telephone1','toLowerCase','destcalleridnum','calleridnum',']\x20Enduser\x20created!','forEach','picklist','type','nameField','idField','indexOf','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','/systemusers(','Fields','phonecall','Subjects','callDirection','queue','headers','substring','format','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat',']\x20The\x20User\x20ID\x20is:'];(function(_0x2c164f,_0xe49177){var _0x3db449=function(_0x5bd58e){while(--_0x5bd58e){_0x2c164f['push'](_0x2c164f['shift']());}};_0x3db449(++_0xe49177);}(_0x307e,0xc9));var _0xe307=function(_0x36b466,_0x823631){_0x36b466=_0x36b466-0x0;var _0x17f490=_0x307e[_0x36b466];return _0x17f490;};'use strict';var _=require(_0xe307('0x0'));var BPromise=require(_0xe307('0x1'));var rp=require(_0xe307('0x2'));var util=require(_0xe307('0x3'));var intUtil=require(_0xe307('0x4'));var md5=require('md5');var Redis=require(_0xe307('0x5'));var logger=require(_0xe307('0x6'))('dynamics365');var config=require(_0xe307('0x7'));config['redis']=_[_0xe307('0x8')](config[_0xe307('0x9')],{'host':_0xe307('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe307('0x9')]));function getAuthToken(_0x3645ea,_0x40b840,_0x5598d4){var _0x304363={'method':_0xe307('0xb'),'uri':_0x40b840,'form':{'client_id':_0x3645ea[_0xe307('0xc')],'resource':_0x3645ea[_0xe307('0xd')],'username':_0x3645ea[_0xe307('0xe')],'password':_0x3645ea[_0xe307('0xf')],'grant_type':_0xe307('0xf'),'client_secret':_0x3645ea[_0xe307('0x10')]},'json':!![]};return rp(_0x304363)[_0xe307('0x11')](function(_0x3b67c5){return _0x3b67c5[_0xe307('0x12')];})[_0xe307('0x13')](function(_0x152cb9){logger[_0xe307('0x14')]('['+[_0x5598d4[_0xe307('0x15')]()]+_0xe307('0x16'));return _0x152cb9['message'];});}function getUser(_0x1f5cd4,_0x3fc983,_0x4e04a7,_0x3faac5,_0x2eeb8e,_0x2d3a73){return new BPromise(function(_0x1e38f2,_0x23b5b8){return getAuthToken(_0x3fc983,_0x3faac5,_0x2d3a73)[_0xe307('0x11')](function(_0x46b0d6){var _0x58f715={'method':_0xe307('0x17'),'uri':_0x2eeb8e+_0xe307('0x18'),'headers':{'Authorization':_0xe307('0x19')+_0x46b0d6,'OData-Version':_0xe307('0x1a')},'json':!![]};return rp(_0x58f715);})[_0xe307('0x11')](function(_0x52f83b){var _0x4e4dfe=_0x52f83b[_0xe307('0x1b')];var _0x52ef79=![];var _0x37a8c9=null;if(!_[_0xe307('0x1c')](_0x4e04a7)){if(intUtil[_0xe307('0x1d')](_0x4e04a7[_0xe307('0x1e')])){_0x1f5cd4[_0xe307('0x1f')]=_0x4e04a7[_0xe307('0x1e')];for(_0x37a8c9=0x0;_0x37a8c9<_0x4e4dfe[_0xe307('0x20')];_0x37a8c9++){if(_0x4e4dfe[_0x37a8c9][_0xe307('0x21')]===_0x4e04a7[_0xe307('0x1e')]&&!_0x4e4dfe[_0x37a8c9][_0xe307('0x22')]){_0x52ef79=!![];logger[_0xe307('0x23')]('['+[_0x2d3a73[_0xe307('0x15')]()]+_0xe307('0x24')+_0x4e4dfe[_0x37a8c9][_0xe307('0x25')]+'!');_0x1f5cd4[_0xe307('0x26')]=_0x4e4dfe[_0x37a8c9]['systemuserid'];}}}}if(!_0x52ef79){logger[_0xe307('0x23')]('['+[_0x2d3a73[_0xe307('0x15')]()]+_0xe307('0x27'));_0x1f5cd4[_0xe307('0x1f')]=_0x3fc983[_0xe307('0xe')];for(_0x37a8c9=0x0;_0x37a8c9<_0x4e4dfe[_0xe307('0x20')];_0x37a8c9++){if(_0x4e4dfe[_0x37a8c9][_0xe307('0x21')]===_0x3fc983[_0xe307('0xe')]){_0x1f5cd4[_0xe307('0x26')]=_0x4e4dfe[_0x37a8c9][_0xe307('0x25')];}}}_0x1e38f2(_0x1f5cd4);})['catch'](function(_0x47b2d4){_0x23b5b8(_0x47b2d4[_0xe307('0x28')]);});});}function createEndUser(_0x11fe69,_0x3b169f,_0x188f14,_0xe4e3ee,_0x22bb34,_0x2651ec){return new BPromise(function(_0x10ee3d,_0x1fc65c){return getAuthToken(_0x3b169f,_0x188f14,_0x2651ec)['then'](function(_0x6b9643){var _0x1590bd=_0x2651ec['toLowerCase']()===_0xe307('0x29')?_0x22bb34['destcalleridnum']:_0x22bb34['calleridnum'];var _0x2e36f2={'method':_0xe307('0xb'),'uri':_0xe4e3ee+_0xe307('0x2a'),'body':{'telephone1':_0x1590bd,'fullname':_0x1590bd,'firstname':_0x1590bd,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x11fe69[_0xe307('0x26')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x6b9643,'OData-Version':_0xe307('0x1a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x2e36f2);})['then'](function(_0x59e18b){var _0x4b3bd7=_0x59e18b['headers'][_0xe307('0x2b')];var _0x3463a8=_0x4b3bd7['substring'](_0x4b3bd7[_0xe307('0x2c')]('(')+0x1,_0x4b3bd7[_0xe307('0x2c')](')'));_0x11fe69[_0xe307('0x2d')]=_0x3463a8;_0x10ee3d(_0x11fe69);})[_0xe307('0x13')](function(_0x4b8490){_0x1fc65c(_0x4b8490[_0xe307('0x28')]);});});}function getEndUser(_0x552236,_0x5b90c0,_0xce93ed,_0x1649a4,_0x344fc5,_0xfdfc8c){return new BPromise(function(_0x504d0b,_0x17b834){return getAuthToken(_0x5b90c0,_0xce93ed,_0xfdfc8c)['then'](function(_0x2af3ec){var _0x21ddc9={'method':'GET','uri':_0x1649a4+_0xe307('0x2e'),'headers':{'Authorization':_0xe307('0x19')+_0x2af3ec,'If-None-Match':null,'OData-Version':_0xe307('0x1a')},'json':!![]};return rp(_0x21ddc9);})[_0xe307('0x11')](function(_0x47ab9f){var _0x4ccf57=null;if(_0x47ab9f){var _0xe0da0a=_0x47ab9f[_0xe307('0x1b')];var _0x558d00=![];for(_0x4ccf57=0x0;_0x4ccf57<_0xe0da0a[_0xe307('0x20')];_0x4ccf57++){var _0x143085=_0xfdfc8c[_0xe307('0x2f')]()==='outbound'?_0x344fc5[_0xe307('0x30')]:_0x344fc5[_0xe307('0x31')];if(_0xe0da0a[_0x4ccf57]['telephone1']===_0x143085){_0x558d00=!![];_0x552236['enduserId']=_0xe0da0a[_0x4ccf57]['contactid'];}}if(_0x558d00){_0x504d0b(_0x552236);}else{return createEndUser(_0x552236,_0x5b90c0,_0xce93ed,_0x1649a4,_0x344fc5,_0xfdfc8c)[_0xe307('0x11')](function(_0x4e3b33){logger[_0xe307('0x23')]('['+[_0xfdfc8c[_0xe307('0x15')]()]+_0xe307('0x32'),_0x4e3b33[_0xe307('0x2d')]);_0x504d0b(_0x4e3b33);});}}else{return createEndUser(_0x552236,_0x5b90c0,_0xce93ed,_0x1649a4,_0x344fc5,_0xfdfc8c)['then'](function(_0x600b40){logger[_0xe307('0x23')]('['+[_0xfdfc8c['toUpperCase']()]+']\x20Enduser\x20Created!',_0x600b40[_0xe307('0x2d')]);_0x504d0b(_0x600b40);});}});});}function getCustomFields(_0x582353,_0x59f9e7,_0x288f07){var _0x2748e1={};if(_0x582353[_0xe307('0x20')]>0x0){_[_0xe307('0x33')](_0x582353,function(_0x36c192){if(_['includes'](['string',_0xe307('0x34')],_0x36c192[_0xe307('0x35')])&&_0x36c192[_0xe307('0x36')]&&!_0x36c192['customField']){var _0x366e8c=_0x36c192[_0xe307('0x37')]['toLowerCase']();var _0x2c06c5=_0x366e8c['substring'](0x0,_0x366e8c[_0xe307('0x38')]('_'));var _0x590f17=_0x366e8c['substring'](_0x366e8c[_0xe307('0x38')]('_')+0x1);if(_0x2c06c5===_0x288f07){_0x2748e1[_0x590f17]=_0x36c192['content'];}}});}return _0x2748e1;}function getTicket(_0xc8468e,_0x137322,_0x24cad8,_0xc81c05,_0x2073bd,_0x187373,_0x39f31a){return new BPromise(function(_0x198627,_0x5a604e){var _0x1f38b4;return getAuthToken(_0x137322,_0x24cad8,_0x39f31a)[_0xe307('0x11')](function(_0x300049){if(_0x187373[_0xe307('0x39')]===_0xe307('0x3a')){_0x1f38b4={'method':_0xe307('0xb'),'uri':_0xc81c05+_0xe307('0x3b'),'body':Object[_0xe307('0x3c')]({},{'title':intUtil[_0xe307('0x3d')](_0x187373['Subjects'],_0x2073bd,'\x20'),'description':intUtil[_0xe307('0x3d')](_0x187373[_0xe307('0x3e')],_0x2073bd,'\x0a'),'customerid_contact@odata.bind':_0xe307('0x3f')+_0xc8468e[_0xe307('0x2d')]+')','ownerid@odata.bind':_0xe307('0x40')+_0xc8468e[_0xe307('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x187373[_0xe307('0x41')],_0x2073bd,_0x187373['ticketType'])),'headers':{'Authorization':_0xe307('0x19')+_0x300049,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x187373[_0xe307('0x39')]===_0xe307('0x42')){_0x1f38b4={'method':'POST','uri':_0xc81c05+'phonecalls','body':Object[_0xe307('0x3c')]({},{'subject':intUtil[_0xe307('0x3d')](_0x187373[_0xe307('0x43')],_0x2073bd,'\x20'),'phonenumber':String(_0x2073bd[_0xe307('0x31')]),'description':intUtil['getString'](_0x187373[_0xe307('0x3e')],_0x2073bd,'\x0a'),'regardingobjectid_contact@odata.bind':_0xe307('0x3f')+_0xc8468e[_0xe307('0x2d')]+')','ownerid@odata.bind':_0xe307('0x40')+_0xc8468e[_0xe307('0x26')]+')','directioncode':_0xc8468e[_0xe307('0x44')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xe307('0x40')+_0xc8468e[_0xe307('0x26')]+')','participationtypemask':_0xc8468e[_0xe307('0x44')]===_0xe307('0x45')?0x2:0x1},{'partyid_contact@odata.bind':_0xe307('0x3f')+_0xc8468e[_0xe307('0x2d')]+')','participationtypemask':_0xc8468e[_0xe307('0x44')]===_0xe307('0x45')?0x1:0x2}]},getCustomFields(_0x187373[_0xe307('0x41')],_0x2073bd,_0x187373[_0xe307('0x39')])),'headers':{'Authorization':'Bearer\x20'+_0x300049,'OData-Version':_0xe307('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1f38b4);})['then'](function(_0xcab77e){var _0x15581e=_0xcab77e[_0xe307('0x46')][_0xe307('0x2b')];var _0x336c27=_0x15581e[_0xe307('0x47')](_0x15581e['lastIndexOf']('(')+0x1,_0x15581e[_0xe307('0x2c')](')'));_0xc8468e['ticketId']=_0x336c27;_0x198627(_0xc8468e);})[_0xe307('0x13')](function(_0x43518f){_0x5a604e(_0x43518f[_0xe307('0x28')]);});});}function emit(_0x4d12a4,_0x56934b,_0x3d0271,_0xdd1567){var _0x36c3b0={'uri':util[_0xe307('0x48')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x4d12a4,_0x3d0271,_0xdd1567)};io['to'](util[_0xe307('0x48')]('user:%s',_0x56934b))[_0xe307('0x49')](_0xe307('0x4a'),_0x36c3b0);}exports['cs']=function(_0x36a590,_0x4b3780,_0x989c15,_0x36a4ac,_0x1e340d,_0x2be57b,_0x4ab9b8,_0x1c9a07){var _0x123fee={};_0x2be57b[_0xe307('0xd')]=intUtil[_0xe307('0x4b')](_0x2be57b['remoteUri']);_0x2be57b[_0xe307('0x4c')]=intUtil[_0xe307('0x4b')](_0x2be57b[_0xe307('0x4c')]);_0x123fee[_0xe307('0x44')]=_0x1c9a07==='queue'||_0x1c9a07===_0xe307('0x4d')?_0xe307('0x45'):_0xe307('0x29');var _0x38e81a=util[_0xe307('0x48')]('%s/api/data/v9.0/',_0x2be57b[_0xe307('0xd')]);var _0x5efe2a=util[_0xe307('0x48')](_0xe307('0x4e'),_0x2be57b['tenantId']);var _0x2de7a4=util[_0xe307('0x48')](_0xe307('0x4f'),_0x2be57b[_0xe307('0x4c')],_0x4b3780[_0xe307('0x50')],md5(_0x4b3780[_0xe307('0x50')]));if(_0x1e340d&&_0x1e340d[_0xe307('0x51')]){logger[_0xe307('0x23')](_0xe307('0x52'),_0xe307('0x53'));_0x4b3780[_0xe307('0x54')]=_0x2de7a4;}else if(_0x4ab9b8&&_0x4ab9b8['recordingFormat']&&_0x4ab9b8[_0xe307('0x55')]!=='none'){logger[_0xe307('0x23')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4b3780[_0xe307('0x54')]=_0x2de7a4;}else{_0x4b3780[_0xe307('0x54')]='';}return getUser(_0x123fee,_0x2be57b,_0x36a4ac,_0x5efe2a,_0x38e81a,_0x1c9a07)[_0xe307('0x11')](function(_0x565896){logger[_0xe307('0x23')]('['+_0x1c9a07[_0xe307('0x15')]()+_0xe307('0x56'),_0x565896[_0xe307('0x26')]);logger['info']('['+_0x1c9a07['toUpperCase']()+_0xe307('0x57'),_0x565896[_0xe307('0x1f')]);return getEndUser(_0x565896,_0x2be57b,_0x5efe2a,_0x38e81a,_0x4b3780,_0x1c9a07);})[_0xe307('0x11')](function(_0x42f6c6){logger[_0xe307('0x23')]('['+_0x1c9a07[_0xe307('0x15')]()+_0xe307('0x58'),_0x42f6c6[_0xe307('0x2d')]);logger[_0xe307('0x23')]('['+_0x1c9a07[_0xe307('0x15')]()+_0xe307('0x59'),_0x4b3780[_0xe307('0x31')]);return getTicket(_0x42f6c6,_0x2be57b,_0x5efe2a,_0x38e81a,_0x4b3780,_0x989c15,_0x1c9a07);})['then'](function(_0x87cec7){logger[_0xe307('0x23')](util['format']('['+_0x1c9a07[_0xe307('0x15')]()+_0xe307('0x5a'),_0x989c15[_0xe307('0x39')],_0x87cec7['ticketId']));logger[_0xe307('0x23')](util[_0xe307('0x48')]('['+_0x1c9a07[_0xe307('0x15')]()+']\x20Call\x20direction:\x20%s',_0x1c9a07));if(_0x1c9a07!=='unmanaged'){logger[_0xe307('0x23')]('['+_0x1c9a07[_0xe307('0x15')]()+']',_0xe307('0x5b'));emit(_0x2be57b[_0xe307('0xd')],_0x36a4ac[_0xe307('0x5c')],_0x989c15['ticketType'],_0x87cec7[_0xe307('0x5d')]);}})[_0xe307('0x13')](function(_0x290d00){logger[_0xe307('0x14')]('['+_0x1c9a07[_0xe307('0x15')]()+_0xe307('0x5e'),util[_0xe307('0x5f')](_0x290d00,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9ab0=['socket.io-emitter','POST','remoteUri','password','clientSecret','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','username','internalemailaddress','toLowerCase','outbound','calleridnum','contacts','/systemusers(','Bearer\x20','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','destcalleridnum',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Fields','phonecalls','Descriptions','queue','callDirection','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','redis','localhost'];(function(_0x598e63,_0x18d6a7){var _0x249ee2=function(_0xfd0dfc){while(--_0xfd0dfc){_0x598e63['push'](_0x598e63['shift']());}};_0x249ee2(++_0x18d6a7);}(_0x9ab0,0x195));var _0x09ab=function(_0x3667fc,_0x2241d0){_0x3667fc=_0x3667fc-0x0;var _0x4c2c81=_0x9ab0[_0x3667fc];return _0x4c2c81;};'use strict';var _=require(_0x09ab('0x0'));var BPromise=require(_0x09ab('0x1'));var rp=require(_0x09ab('0x2'));var util=require(_0x09ab('0x3'));var intUtil=require(_0x09ab('0x4'));var md5=require(_0x09ab('0x5'));var Redis=require(_0x09ab('0x6'));var logger=require(_0x09ab('0x7'))(_0x09ab('0x8'));var config=require('../../../../config/environment');config['redis']=_['defaults'](config[_0x09ab('0x9')],{'host':_0x09ab('0xa'),'port':0x18eb});var io=require(_0x09ab('0xb'))(new Redis(config[_0x09ab('0x9')]));function getAuthToken(_0x610663,_0x464d64,_0x174a54){var _0x27e45e={'method':_0x09ab('0xc'),'uri':_0x464d64,'form':{'client_id':_0x610663['clientId'],'resource':_0x610663[_0x09ab('0xd')],'username':_0x610663['username'],'password':_0x610663[_0x09ab('0xe')],'grant_type':_0x09ab('0xe'),'client_secret':_0x610663[_0x09ab('0xf')]},'json':!![]};return rp(_0x27e45e)['then'](function(_0x5f16c6){return _0x5f16c6[_0x09ab('0x10')];})[_0x09ab('0x11')](function(_0x553791){logger['error']('['+[_0x174a54[_0x09ab('0x12')]()]+_0x09ab('0x13'));return _0x553791[_0x09ab('0x14')];});}function getUser(_0x4705df,_0x116193,_0x34afbd,_0x18ecda,_0x25bb6b,_0x10971){return new BPromise(function(_0x1d4354,_0x2a16e4){return getAuthToken(_0x116193,_0x18ecda,_0x10971)[_0x09ab('0x15')](function(_0x5ac9da){var _0x24db01={'method':_0x09ab('0x16'),'uri':_0x25bb6b+_0x09ab('0x17'),'headers':{'Authorization':'Bearer\x20'+_0x5ac9da,'OData-Version':_0x09ab('0x18')},'json':!![]};return rp(_0x24db01);})[_0x09ab('0x15')](function(_0x2f75a8){var _0x574b0f=_0x2f75a8[_0x09ab('0x19')];var _0x3f86c4=![];var _0x88f781=null;if(!_[_0x09ab('0x1a')](_0x34afbd)){if(intUtil[_0x09ab('0x1b')](_0x34afbd[_0x09ab('0x1c')])){_0x4705df['userEmail']=_0x34afbd[_0x09ab('0x1c')];for(_0x88f781=0x0;_0x88f781<_0x574b0f[_0x09ab('0x1d')];_0x88f781++){if(_0x574b0f[_0x88f781]['internalemailaddress']===_0x34afbd[_0x09ab('0x1c')]&&!_0x574b0f[_0x88f781][_0x09ab('0x1e')]){_0x3f86c4=!![];logger[_0x09ab('0x1f')]('['+[_0x10971[_0x09ab('0x12')]()]+_0x09ab('0x20')+_0x574b0f[_0x88f781][_0x09ab('0x21')]+'!');_0x4705df[_0x09ab('0x22')]=_0x574b0f[_0x88f781][_0x09ab('0x21')];}}}}if(!_0x3f86c4){logger['info']('['+[_0x10971[_0x09ab('0x12')]()]+_0x09ab('0x23'));_0x4705df[_0x09ab('0x24')]=_0x116193[_0x09ab('0x25')];for(_0x88f781=0x0;_0x88f781<_0x574b0f[_0x09ab('0x1d')];_0x88f781++){if(_0x574b0f[_0x88f781][_0x09ab('0x26')]===_0x116193['username']){_0x4705df[_0x09ab('0x22')]=_0x574b0f[_0x88f781][_0x09ab('0x21')];}}}_0x1d4354(_0x4705df);})[_0x09ab('0x11')](function(_0x33cc49){_0x2a16e4(_0x33cc49[_0x09ab('0x14')]);});});}function createEndUser(_0x4c776b,_0x50a95b,_0x21ed17,_0x40932c,_0x5138d4,_0x429b1b){return new BPromise(function(_0x18e960,_0x22d3dd){return getAuthToken(_0x50a95b,_0x21ed17,_0x429b1b)[_0x09ab('0x15')](function(_0x381719){var _0x923b78=_0x429b1b[_0x09ab('0x27')]()===_0x09ab('0x28')?_0x5138d4['destcalleridnum']:_0x5138d4[_0x09ab('0x29')];var _0x2d4028={'method':_0x09ab('0xc'),'uri':_0x40932c+_0x09ab('0x2a'),'body':{'telephone1':_0x923b78,'fullname':_0x923b78,'firstname':_0x923b78,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x09ab('0x2b')+_0x4c776b[_0x09ab('0x22')]+')'},'headers':{'Authorization':_0x09ab('0x2c')+_0x381719,'OData-Version':_0x09ab('0x18')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x2d4028);})[_0x09ab('0x15')](function(_0x237f9b){var _0x12f4f2=_0x237f9b[_0x09ab('0x2d')][_0x09ab('0x2e')];var _0x4d1be6=_0x12f4f2[_0x09ab('0x2f')](_0x12f4f2[_0x09ab('0x30')]('(')+0x1,_0x12f4f2[_0x09ab('0x30')](')'));_0x4c776b[_0x09ab('0x31')]=_0x4d1be6;_0x18e960(_0x4c776b);})[_0x09ab('0x11')](function(_0x11bf0d){_0x22d3dd(_0x11bf0d[_0x09ab('0x14')]);});});}function getEndUser(_0x388454,_0x1497d2,_0x5a43bc,_0x488946,_0x3b7e4f,_0x2e24e8){return new BPromise(function(_0x4ab4c1,_0xc02be0){return getAuthToken(_0x1497d2,_0x5a43bc,_0x2e24e8)[_0x09ab('0x15')](function(_0x80d2fa){var _0x552537={'method':_0x09ab('0x16'),'uri':_0x488946+_0x09ab('0x32'),'headers':{'Authorization':_0x09ab('0x2c')+_0x80d2fa,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x552537);})['then'](function(_0x1a225c){var _0x2141a3=null;if(_0x1a225c){var _0x33af6c=_0x1a225c[_0x09ab('0x19')];var _0x156263=![];for(_0x2141a3=0x0;_0x2141a3<_0x33af6c['length'];_0x2141a3++){var _0x307aca=_0x2e24e8[_0x09ab('0x27')]()==='outbound'?_0x3b7e4f[_0x09ab('0x33')]:_0x3b7e4f[_0x09ab('0x29')];if(_0x33af6c[_0x2141a3]['telephone1']===_0x307aca){_0x156263=!![];_0x388454['enduserId']=_0x33af6c[_0x2141a3]['contactid'];}}if(_0x156263){_0x4ab4c1(_0x388454);}else{return createEndUser(_0x388454,_0x1497d2,_0x5a43bc,_0x488946,_0x3b7e4f,_0x2e24e8)['then'](function(_0x32ee86){logger[_0x09ab('0x1f')]('['+[_0x2e24e8['toUpperCase']()]+_0x09ab('0x34'),_0x32ee86[_0x09ab('0x31')]);_0x4ab4c1(_0x32ee86);});}}else{return createEndUser(_0x388454,_0x1497d2,_0x5a43bc,_0x488946,_0x3b7e4f,_0x2e24e8)[_0x09ab('0x15')](function(_0x175371){logger['info']('['+[_0x2e24e8[_0x09ab('0x12')]()]+_0x09ab('0x35'),_0x175371[_0x09ab('0x31')]);_0x4ab4c1(_0x175371);});}});});}function getCustomFields(_0x12c432,_0x36195c,_0x41f449){var _0xc78d79={};if(_0x12c432[_0x09ab('0x1d')]>0x0){_[_0x09ab('0x36')](_0x12c432,function(_0x2beb36){if(_[_0x09ab('0x37')]([_0x09ab('0x38'),'picklist'],_0x2beb36[_0x09ab('0x39')])&&_0x2beb36[_0x09ab('0x3a')]&&!_0x2beb36[_0x09ab('0x3b')]){var _0x162f69=_0x2beb36[_0x09ab('0x3c')]['toLowerCase']();var _0xa4a211=_0x162f69['substring'](0x0,_0x162f69[_0x09ab('0x3d')]('_'));var _0x317dcf=_0x162f69[_0x09ab('0x2f')](_0x162f69[_0x09ab('0x3d')]('_')+0x1);if(_0xa4a211===_0x41f449){_0xc78d79[_0x317dcf]=_0x2beb36[_0x09ab('0x3e')];}}});}return _0xc78d79;}function getTicket(_0x5ded5d,_0x171383,_0x277ea6,_0x4430f2,_0x187378,_0x2ab35c,_0x3572f2){return new BPromise(function(_0x14e82c,_0x75feeb){var _0x1e8189;return getAuthToken(_0x171383,_0x277ea6,_0x3572f2)[_0x09ab('0x15')](function(_0x44a820){if(_0x2ab35c[_0x09ab('0x3f')]===_0x09ab('0x40')){_0x1e8189={'method':_0x09ab('0xc'),'uri':_0x4430f2+_0x09ab('0x41'),'body':Object[_0x09ab('0x42')]({},{'title':intUtil[_0x09ab('0x43')](_0x2ab35c[_0x09ab('0x44')],_0x187378,'\x20'),'description':intUtil[_0x09ab('0x43')](_0x2ab35c['Descriptions'],_0x187378,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x5ded5d[_0x09ab('0x31')]+')','ownerid@odata.bind':_0x09ab('0x2b')+_0x5ded5d['userId']+')','caseorigincode':'1'},getCustomFields(_0x2ab35c[_0x09ab('0x45')],_0x187378,_0x2ab35c[_0x09ab('0x3f')])),'headers':{'Authorization':'Bearer\x20'+_0x44a820,'OData-Version':_0x09ab('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2ab35c[_0x09ab('0x3f')]==='phonecall'){_0x1e8189={'method':_0x09ab('0xc'),'uri':_0x4430f2+_0x09ab('0x46'),'body':Object[_0x09ab('0x42')]({},{'subject':intUtil[_0x09ab('0x43')](_0x2ab35c[_0x09ab('0x44')],_0x187378,'\x20'),'phonenumber':String(_0x187378[_0x09ab('0x29')]),'description':intUtil[_0x09ab('0x43')](_0x2ab35c[_0x09ab('0x47')],_0x187378,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x5ded5d[_0x09ab('0x31')]+')','ownerid@odata.bind':_0x09ab('0x2b')+_0x5ded5d[_0x09ab('0x22')]+')','directioncode':_0x5ded5d['callDirection']===_0x09ab('0x48')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x09ab('0x2b')+_0x5ded5d[_0x09ab('0x22')]+')','participationtypemask':_0x5ded5d[_0x09ab('0x49')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x5ded5d['enduserId']+')','participationtypemask':_0x5ded5d['callDirection']===_0x09ab('0x48')?0x1:0x2}]},getCustomFields(_0x2ab35c[_0x09ab('0x45')],_0x187378,_0x2ab35c[_0x09ab('0x3f')])),'headers':{'Authorization':'Bearer\x20'+_0x44a820,'OData-Version':_0x09ab('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1e8189);})[_0x09ab('0x15')](function(_0x5e3257){var _0x21b10c=_0x5e3257[_0x09ab('0x2d')][_0x09ab('0x2e')];var _0x3eb8ab=_0x21b10c['substring'](_0x21b10c[_0x09ab('0x30')]('(')+0x1,_0x21b10c[_0x09ab('0x30')](')'));_0x5ded5d[_0x09ab('0x4a')]=_0x3eb8ab;_0x14e82c(_0x5ded5d);})[_0x09ab('0x11')](function(_0x2002c2){_0x75feeb(_0x2002c2['message']);});});}function emit(_0x3a3ae3,_0x14f64d,_0x278b98,_0x1064ed){var _0x47139a={'uri':util[_0x09ab('0x4b')](_0x09ab('0x4c'),_0x3a3ae3,_0x278b98,_0x1064ed)};io['to'](util[_0x09ab('0x4b')](_0x09ab('0x4d'),_0x14f64d))[_0x09ab('0x4e')]('trigger:browser:url',_0x47139a);}exports['cs']=function(_0x10f318,_0x27df69,_0x1953b0,_0x42ec49,_0x5237b8,_0x307579,_0x66711a,_0x2540a2){var _0x2cec4c={};_0x307579['remoteUri']=intUtil[_0x09ab('0x4f')](_0x307579[_0x09ab('0xd')]);_0x307579['serverUrl']=intUtil[_0x09ab('0x4f')](_0x307579['serverUrl']);_0x2cec4c['callDirection']=_0x2540a2===_0x09ab('0x48')||_0x2540a2===_0x09ab('0x50')?_0x09ab('0x48'):'outbound';var _0x593ca2=util[_0x09ab('0x4b')](_0x09ab('0x51'),_0x307579['remoteUri']);var _0x149943=util[_0x09ab('0x4b')](_0x09ab('0x52'),_0x307579[_0x09ab('0x53')]);var _0x1e11ad=util[_0x09ab('0x4b')](_0x09ab('0x54'),_0x307579['serverUrl'],_0x27df69[_0x09ab('0x55')],md5(_0x27df69[_0x09ab('0x55')]));if(_0x5237b8&&_0x5237b8[_0x09ab('0x56')]){logger[_0x09ab('0x1f')](_0x09ab('0x57'),_0x09ab('0x58'));_0x27df69[_0x09ab('0x59')]=_0x1e11ad;}else if(_0x66711a&&_0x66711a[_0x09ab('0x5a')]&&_0x66711a[_0x09ab('0x5a')]!==_0x09ab('0x5b')){logger['info'](_0x09ab('0x5c'),_0x09ab('0x58'));_0x27df69[_0x09ab('0x59')]=_0x1e11ad;}else{_0x27df69['recordingURL']='';}return getUser(_0x2cec4c,_0x307579,_0x42ec49,_0x149943,_0x593ca2,_0x2540a2)['then'](function(_0x2506f7){logger[_0x09ab('0x1f')]('['+_0x2540a2[_0x09ab('0x12')]()+_0x09ab('0x5d'),_0x2506f7[_0x09ab('0x22')]);logger['info']('['+_0x2540a2[_0x09ab('0x12')]()+_0x09ab('0x5e'),_0x2506f7[_0x09ab('0x24')]);return getEndUser(_0x2506f7,_0x307579,_0x149943,_0x593ca2,_0x27df69,_0x2540a2);})[_0x09ab('0x15')](function(_0x12c72a){logger['info']('['+_0x2540a2['toUpperCase']()+_0x09ab('0x5f'),_0x12c72a[_0x09ab('0x31')]);logger[_0x09ab('0x1f')]('['+_0x2540a2[_0x09ab('0x12')]()+_0x09ab('0x60'),_0x27df69[_0x09ab('0x29')]);return getTicket(_0x12c72a,_0x307579,_0x149943,_0x593ca2,_0x27df69,_0x1953b0,_0x2540a2);})[_0x09ab('0x15')](function(_0x4cc417){logger[_0x09ab('0x1f')](util['format']('['+_0x2540a2[_0x09ab('0x12')]()+_0x09ab('0x61'),_0x1953b0['ticketType'],_0x4cc417[_0x09ab('0x4a')]));logger['info'](util[_0x09ab('0x4b')]('['+_0x2540a2[_0x09ab('0x12')]()+_0x09ab('0x62'),_0x2540a2));if(_0x2540a2!=='unmanaged'){logger[_0x09ab('0x1f')]('['+_0x2540a2['toUpperCase']()+']',_0x09ab('0x63'));emit(_0x307579['remoteUri'],_0x42ec49[_0x09ab('0x64')],_0x1953b0[_0x09ab('0x3f')],_0x4cc417[_0x09ab('0x4a')]);}})['catch'](function(_0x4c83d9){logger[_0x09ab('0x65')]('['+_0x2540a2[_0x09ab('0x12')]()+_0x09ab('0x66'),util[_0x09ab('0x67')](_0x4c83d9,{'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 4bf7f1a..3b4b17f 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 _0x2169=['Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','email','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','lastevent','toUpperCase','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','POST','then','validateEmail','%s/api/v2/agents','remoteUri','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts'];(function(_0x18d4d5,_0x52c11c){var _0x4b8b1f=function(_0x1d5d5a){while(--_0x1d5d5a){_0x18d4d5['push'](_0x18d4d5['shift']());}};_0x4b8b1f(++_0x52c11c);}(_0x2169,0x14f));var _0x9216=function(_0x12d5e9,_0x1decd6){_0x12d5e9=_0x12d5e9-0x0;var _0x343939=_0x2169[_0x12d5e9];return _0x343939;};'use strict';var _=require('lodash');var rp=require(_0x9216('0x0'));var md5=require('md5');var util=require(_0x9216('0x1'));var Redis=require(_0x9216('0x2'));var intUtil=require(_0x9216('0x3'));var config=require(_0x9216('0x4'));var logger=require(_0x9216('0x5'))(_0x9216('0x6'));config[_0x9216('0x7')]=_[_0x9216('0x8')](config[_0x9216('0x7')],{'host':_0x9216('0x9'),'port':0x18eb});var io=require(_0x9216('0xa'))(new Redis(config[_0x9216('0x7')]));var headers={'Content-Type':_0x9216('0xb'),'Accept':_0x9216('0xb')};function emit(_0x3e0ccd,_0x522e7e,_0x43f137){io['to'](_0x3e0ccd)['emit'](_0x522e7e,_0x43f137);}function getTicket(_0x948121,_0x33548e,_0x51327a,_0x32d1fd,_0x2e3aac){logger[_0x9216('0xc')](_0x9216('0xd'));var _0x3d4fd2=_[_0x9216('0xe')]({'responder_id':_0x33548e['id'],'requester_id':_0x51327a['id'],'name':util[_0x9216('0xf')](_0x9216('0x10'),_0x2e3aac[_0x9216('0x11')]),'phone':_0x2e3aac[_0x9216('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x9216('0x13')](_0x32d1fd[_0x9216('0x14')],_0x2e3aac,'\x20'),'description':intUtil[_0x9216('0x13')](_0x32d1fd[_0x9216('0x15')],_0x2e3aac,_0x9216('0x16')),'tags':getTags(_0x32d1fd[_0x9216('0x17')],'name')},getCustomFields(_0x32d1fd[_0x9216('0x18')],_0x2e3aac));_0x3d4fd2[_0x9216('0x19')]=_[_0x9216('0x1a')](_[_0x9216('0x1b')](_0x3d4fd2[_0x9216('0x19')],'id'),_0x9216('0x1c'));return request({'uri':util[_0x9216('0xf')](_0x9216('0x1d'),_0x948121['remoteUri']),'method':_0x9216('0x1e'),'body':_0x3d4fd2})[_0x9216('0x1f')](function(_0x4835e2){logger[_0x9216('0xc')]('Ticket\x20created!');return _0x4835e2;});}function getUser(_0x171cdf,_0x50f9f1){if(intUtil[_0x9216('0x20')](_0x50f9f1)){return request({'uri':util[_0x9216('0xf')](_0x9216('0x21'),_0x171cdf[_0x9216('0x22')]),'qs':{'email':_0x50f9f1}})['then'](function(_0x36f186){if(_0x36f186['length']){logger['info']('Agent\x20found!');return _[_0x9216('0x23')](_0x36f186,function(_0x53cf99){return _0x53cf99['contact']['email']===_0x50f9f1;});}else{logger[_0x9216('0xc')](_0x9216('0x24'));return request({'uri':util[_0x9216('0xf')]('%s/api/v2/agents/me',_0x171cdf['remoteUri'])})[_0x9216('0x1f')](function(_0x543915){logger['info'](_0x9216('0x25'));return _0x543915;});}});}else{logger[_0x9216('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x9216('0x26'),_0x171cdf[_0x9216('0x22')])})[_0x9216('0x1f')](function(_0x3a6150){logger[_0x9216('0xc')]('Admin\x20account\x20selected.');return _0x3a6150;});}}function getEndUser(_0x4f7e91,_0x542536,_0x5ad506){logger[_0x9216('0xc')](_0x9216('0x27'),_0x5ad506);return request({'uri':util[_0x9216('0xf')](_0x9216('0x28'),_0x4f7e91[_0x9216('0x22')]),'qs':{'phone':_0x5ad506}})[_0x9216('0x1f')](function(_0x7b57e1){if(_0x7b57e1['length']){logger[_0x9216('0xc')](_0x9216('0x29'));return _[_0x9216('0x23')](_0x7b57e1,{'phone':_0x5ad506});}else{logger[_0x9216('0xc')](_0x9216('0x2a'));return request({'uri':util[_0x9216('0xf')](_0x9216('0x28'),_0x4f7e91[_0x9216('0x22')]),'method':_0x9216('0x1e'),'body':{'name':_0x542536,'phone':_0x5ad506}})[_0x9216('0x1f')](function(_0x569a3b){logger['info'](_0x9216('0x2b'));return _0x569a3b;});}});}function getAuth(_0x1cb571){return util['format'](_0x9216('0x2c'),new Buffer(_0x1cb571['apiKey']+':X')[_0x9216('0x2d')](_0x9216('0x2e')));}function request(_0x4cc309){logger[_0x9216('0x2f')](_0x9216('0x30'),JSON[_0x9216('0x31')](_0x4cc309));return rp(_['defaults'](_0x4cc309,{'method':_0x9216('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x4afe16,_0x1714d8){var _0x42a0cc=[];if(_0x4afe16&&_0x4afe16[_0x9216('0x33')]>0x0){_0x42a0cc=_[_0x9216('0x34')](_0x4afe16,_0x1714d8);}return _0x42a0cc;}function getCustomFields(_0x555715,_0x42b7eb){var _0x6eff19=[];var _0x100216={'custom_fields':[]};if(_0x555715[_0x9216('0x33')]>0x0){_[_0x9216('0x35')](_0x555715,function(_0x4ddd4f){if(_[_0x9216('0x36')]([_0x9216('0x37'),_0x9216('0x38')],_0x4ddd4f[_0x9216('0x39')])&&_0x4ddd4f[_0x9216('0x3a')]&&!_0x4ddd4f[_0x9216('0x3b')]){_0x100216[_0x4ddd4f[_0x9216('0x3a')][_0x9216('0x3c')]()]=_0x4ddd4f[_0x9216('0x3d')][_0x9216('0x2d')]();}else if(_['includes']([_0x9216('0x37'),'picklist'],_0x4ddd4f[_0x9216('0x39')])&&_0x4ddd4f[_0x9216('0x3e')]&&_0x4ddd4f['customField']){_0x100216[_0x9216('0x19')][_0x9216('0x3f')]({'id':_0x4ddd4f['idField'],'value':_0x4ddd4f[_0x9216('0x3d')][_0x9216('0x2d')]()});}else if(_0x4ddd4f[_0x9216('0x39')]==='variable'&&_0x4ddd4f[_0x9216('0x40')]&&_0x4ddd4f[_0x9216('0x3e')]&&_0x4ddd4f[_0x9216('0x3b')]){_0x42b7eb[_0x4ddd4f['variableName']]&&_0x100216[_0x9216('0x19')][_0x9216('0x3f')]({'id':_0x4ddd4f[_0x9216('0x3e')],'value':_0x42b7eb[_0x4ddd4f[_0x9216('0x40')]][_0x9216('0x2d')]()});}else if(_0x4ddd4f[_0x9216('0x39')]===_0x9216('0x41')&&_0x4ddd4f[_0x9216('0x42')]&&_0x4ddd4f[_0x9216('0x42')][_0x9216('0x43')]&&_0x4ddd4f[_0x9216('0x3e')]&&_0x4ddd4f[_0x9216('0x3b')]){_0x42b7eb[_0x4ddd4f['Variable'][_0x9216('0x43')]['toLowerCase']()]&&_0x100216['custom_fields'][_0x9216('0x3f')]({'id':_0x4ddd4f[_0x9216('0x3e')],'value':_0x42b7eb[_0x4ddd4f[_0x9216('0x42')][_0x9216('0x43')][_0x9216('0x3c')]()][_0x9216('0x2d')]()});}});}return _0x100216;}exports[_0x9216('0x44')]=function(_0x7a2b7e,_0x40e453,_0x2e4165,_0x4c1d51,_0x54b3fc,_0x181f47){var _0x1d23bb,_0x9bb4f6;_0x181f47[_0x9216('0x22')]=intUtil[_0x9216('0x45')](_0x181f47[_0x9216('0x22')]);_0x181f47['serverUrl']=intUtil[_0x9216('0x45')](_0x181f47[_0x9216('0x46')]);if(_0x54b3fc&&_0x54b3fc[_0x9216('0x47')]){logger[_0x9216('0xc')](_0x9216('0x48'),'Recording\x20is\x20enabled!');_0x40e453[_0x9216('0x49')]=util['format'](_0x9216('0x4a'),_0x181f47['serverUrl'],_0x40e453[_0x9216('0x4b')],md5(_0x40e453[_0x9216('0x4b')]));}else{_0x40e453['recordingURL']='';}headers[_0x9216('0x4c')]=getAuth(_0x181f47);return getUser(_0x181f47,_0x4c1d51['email'])[_0x9216('0x1f')](function(_0x188345){_0x1d23bb=_0x188345;logger[_0x9216('0xc')](_0x9216('0x4d'),_0x1d23bb['id']);return getEndUser(_0x181f47,_0x40e453[_0x9216('0x11')],_0x40e453[_0x9216('0x12')]);})[_0x9216('0x1f')](function(_0x540ab1){_0x9bb4f6=_0x540ab1;logger['info'](_0x9216('0x4e'),_0x9bb4f6['id']);return getTicket(_0x181f47,_0x1d23bb,_0x9bb4f6,_0x2e4165,_0x40e453);})['then'](function(_0x92f86b){if(_0x92f86b&&_0x92f86b['id']){logger[_0x9216('0xc')](_0x9216('0x4f'));logger[_0x9216('0xc')](_0x9216('0x50'),_0x92f86b['id']);logger[_0x9216('0xc')](_0x9216('0x48'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9216('0xf')]('user:%s',_0x4c1d51[_0x9216('0x43')]),_0x9216('0x51'),{'uri':util[_0x9216('0xf')](_0x9216('0x52'),_0x181f47[_0x9216('0x22')],_0x92f86b['id'])});}})[_0x9216('0x53')](function(_0x432dc3){logger[_0x9216('0x54')](_0x9216('0x48'),JSON[_0x9216('0x31')](_0x432dc3));});};exports['outbound']=function(_0x406cd5,_0x1ed778,_0x55f316,_0x363d13,_0x457378,_0x3fb297,_0x4d61d0){var _0x357236,_0x56e4fe;_0x3fb297['remoteUri']=intUtil['stripTrailingSlash'](_0x3fb297['remoteUri']);_0x3fb297[_0x9216('0x46')]=intUtil['stripTrailingSlash'](_0x3fb297[_0x9216('0x46')]);if(_0x4d61d0&&_0x4d61d0['recordingFormat']&&_0x4d61d0[_0x9216('0x55')]!==_0x9216('0x56')){logger[_0x9216('0xc')](_0x9216('0x57'),_0x9216('0x58'));_0x1ed778[_0x9216('0x49')]=util['format'](_0x9216('0x4a'),_0x3fb297[_0x9216('0x46')],_0x1ed778[_0x9216('0x4b')],md5(_0x1ed778[_0x9216('0x4b')]));}headers['Authorization']=getAuth(_0x3fb297);return getUser(_0x3fb297,_0x363d13[_0x9216('0x59')])['then'](function(_0x29250a){_0x357236=_0x29250a;logger['info'](_0x9216('0x4d'),_0x357236['id']);return getEndUser(_0x3fb297,_0x1ed778['destcalleridname'],_0x1ed778['destcalleridnum']);})[_0x9216('0x1f')](function(_0x5b45e7){_0x56e4fe=_0x5b45e7;logger[_0x9216('0xc')](_0x9216('0x4e'),_0x56e4fe['id']);return getTicket(_0x3fb297,_0x357236,_0x56e4fe,_0x55f316,_0x1ed778);})[_0x9216('0x1f')](function(_0x2e61ee){if(_0x2e61ee&&_0x2e61ee['id']){logger[_0x9216('0xc')](_0x9216('0x4f'));logger[_0x9216('0xc')](_0x9216('0x50'),_0x2e61ee['id']);logger[_0x9216('0xc')](_0x9216('0x57'),_0x9216('0x5a'));emit(util[_0x9216('0xf')](_0x9216('0x5b'),_0x363d13[_0x9216('0x43')]),'trigger:browser:url',{'uri':util[_0x9216('0xf')](_0x9216('0x52'),_0x3fb297[_0x9216('0x22')],_0x2e61ee['id'])});}})[_0x9216('0x53')](function(_0x31df86){logger[_0x9216('0x54')](_0x9216('0x57'),JSON['stringify'](_0x31df86));});};exports['unmanaged']=function(_0x3455c6,_0x45c926,_0x402635,_0x22fa63,_0x19c9fb,_0x16cd2f){var _0x40fd63,_0x2888e9;_0x16cd2f[_0x9216('0x22')]=intUtil[_0x9216('0x45')](_0x16cd2f['remoteUri']);_0x16cd2f[_0x9216('0x46')]=intUtil[_0x9216('0x45')](_0x16cd2f[_0x9216('0x46')]);if(_0x19c9fb&&_0x19c9fb[_0x9216('0x47')]){logger[_0x9216('0xc')]('['+_0x45c926[_0x9216('0x5c')][_0x9216('0x5d')]()+']',_0x9216('0x58'));_0x45c926[_0x9216('0x49')]=util[_0x9216('0xf')](_0x9216('0x4a'),_0x16cd2f[_0x9216('0x46')],_0x45c926[_0x9216('0x4b')],md5(_0x45c926['uniqueid']));}else{_0x45c926['recordingURL']='';}headers['Authorization']=getAuth(_0x16cd2f);return getUser(_0x16cd2f,'')['then'](function(_0x2cd36e){_0x40fd63=_0x2cd36e;logger['info']('The\x20User\x20ID\x20is:',_0x40fd63['id']);return getEndUser(_0x16cd2f,_0x45c926['calleridname'],_0x45c926[_0x9216('0x12')]);})['then'](function(_0x4b8f7b){_0x2888e9=_0x4b8f7b;logger[_0x9216('0xc')]('The\x20Enduser\x20ID\x20is:',_0x2888e9['id']);return getTicket(_0x16cd2f,_0x40fd63,_0x2888e9,_0x402635,_0x45c926);})['then'](function(_0x3a52e9){if(_0x3a52e9){logger[_0x9216('0xc')](_0x9216('0x4f'));logger[_0x9216('0xc')]('The\x20Ticket\x20ID\x20is:',_0x3a52e9['id']);}})['catch'](function(_0x37d98b){logger['error']('['+_0x45c926[_0x9216('0x5c')]['toUpperCase']()+']',JSON['stringify'](_0x37d98b));});}; \ No newline at end of file +var _0x0b6f=['stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20Enduser\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Descriptions','
','Tags','name','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','%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','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20created.','Basic\x20%s','base64','debug','[HTTP]','GET','forEach','string','picklist','type','nameField','customField','content','toString','idField','push','variable','variableName','customVariable','Variable','queue'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x0b6f,0x134));var _0xf0b6=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x0b6f[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0xf0b6('0x0'));var rp=require(_0xf0b6('0x1'));var md5=require(_0xf0b6('0x2'));var util=require(_0xf0b6('0x3'));var Redis=require(_0xf0b6('0x4'));var intUtil=require(_0xf0b6('0x5'));var config=require(_0xf0b6('0x6'));var logger=require(_0xf0b6('0x7'))(_0xf0b6('0x8'));config[_0xf0b6('0x9')]=_[_0xf0b6('0xa')](config[_0xf0b6('0x9')],{'host':_0xf0b6('0xb'),'port':0x18eb});var io=require(_0xf0b6('0xc'))(new Redis(config['redis']));var headers={'Content-Type':_0xf0b6('0xd'),'Accept':_0xf0b6('0xd')};function emit(_0x107647,_0x3b9b22,_0x2ed100){io['to'](_0x107647)[_0xf0b6('0xe')](_0x3b9b22,_0x2ed100);}function getTicket(_0x5f1976,_0x4a0da4,_0x9e2e1c,_0x2c930f,_0x2f88df){logger[_0xf0b6('0xf')](_0xf0b6('0x10'));var _0xaf935c=_[_0xf0b6('0x11')]({'responder_id':_0x4a0da4['id'],'requester_id':_0x9e2e1c['id'],'name':util[_0xf0b6('0x12')]('Caller\x20-\x20%s',_0x2f88df[_0xf0b6('0x13')]),'phone':_0x2f88df[_0xf0b6('0x14')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xf0b6('0x15')](_0x2c930f['Subjects'],_0x2f88df,'\x20'),'description':intUtil[_0xf0b6('0x15')](_0x2c930f[_0xf0b6('0x16')],_0x2f88df,_0xf0b6('0x17')),'tags':getTags(_0x2c930f[_0xf0b6('0x18')],_0xf0b6('0x19'))},getCustomFields(_0x2c930f['Fields'],_0x2f88df));_0xaf935c[_0xf0b6('0x1a')]=_[_0xf0b6('0x1b')](_[_0xf0b6('0x1c')](_0xaf935c[_0xf0b6('0x1a')],'id'),_0xf0b6('0x1d'));return request({'uri':util[_0xf0b6('0x12')](_0xf0b6('0x1e'),_0x5f1976[_0xf0b6('0x1f')]),'method':_0xf0b6('0x20'),'body':_0xaf935c})[_0xf0b6('0x21')](function(_0x1a4c7c){logger[_0xf0b6('0xf')](_0xf0b6('0x22'));return _0x1a4c7c;});}function getUser(_0x3fd9f9,_0xe7b74d){if(intUtil['validateEmail'](_0xe7b74d)){return request({'uri':util[_0xf0b6('0x12')](_0xf0b6('0x23'),_0x3fd9f9[_0xf0b6('0x1f')]),'qs':{'email':_0xe7b74d}})['then'](function(_0x482620){if(_0x482620[_0xf0b6('0x24')]){logger[_0xf0b6('0xf')](_0xf0b6('0x25'));return _['find'](_0x482620,function(_0x2dde1b){return _0x2dde1b[_0xf0b6('0x26')]['email']===_0xe7b74d;});}else{logger[_0xf0b6('0xf')](_0xf0b6('0x27'));return request({'uri':util[_0xf0b6('0x12')](_0xf0b6('0x28'),_0x3fd9f9[_0xf0b6('0x1f')])})[_0xf0b6('0x21')](function(_0x2a3069){logger[_0xf0b6('0xf')](_0xf0b6('0x29'));return _0x2a3069;});}});}else{logger[_0xf0b6('0xf')](_0xf0b6('0x2a'));return request({'uri':util[_0xf0b6('0x12')](_0xf0b6('0x28'),_0x3fd9f9[_0xf0b6('0x1f')])})[_0xf0b6('0x21')](function(_0x487ab7){logger[_0xf0b6('0xf')]('Admin\x20account\x20selected.');return _0x487ab7;});}}function getEndUser(_0x58ccc6,_0x80a48b,_0x229916){logger[_0xf0b6('0xf')](_0xf0b6('0x2b'),_0x229916);return request({'uri':util[_0xf0b6('0x12')](_0xf0b6('0x2c'),_0x58ccc6[_0xf0b6('0x1f')]),'qs':{'phone':_0x229916}})[_0xf0b6('0x21')](function(_0xac0dc1){if(_0xac0dc1[_0xf0b6('0x24')]){logger[_0xf0b6('0xf')](_0xf0b6('0x2d'));return _[_0xf0b6('0x2e')](_0xac0dc1,{'phone':_0x229916});}else{logger[_0xf0b6('0xf')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xf0b6('0x12')](_0xf0b6('0x2c'),_0x58ccc6[_0xf0b6('0x1f')]),'method':_0xf0b6('0x20'),'body':{'name':_0x80a48b,'phone':_0x229916}})[_0xf0b6('0x21')](function(_0x40223f){logger[_0xf0b6('0xf')](_0xf0b6('0x2f'));return _0x40223f;});}});}function getAuth(_0x14ffd8){return util[_0xf0b6('0x12')](_0xf0b6('0x30'),new Buffer(_0x14ffd8['apiKey']+':X')['toString'](_0xf0b6('0x31')));}function request(_0x39e362){logger[_0xf0b6('0x32')](_0xf0b6('0x33'),JSON['stringify'](_0x39e362));return rp(_[_0xf0b6('0xa')](_0x39e362,{'method':_0xf0b6('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x500c2c,_0x447086){var _0x5f5bf8=[];if(_0x500c2c&&_0x500c2c[_0xf0b6('0x24')]>0x0){_0x5f5bf8=_['map'](_0x500c2c,_0x447086);}return _0x5f5bf8;}function getCustomFields(_0x39d76c,_0x46c374){var _0x130f02=[];var _0xee2e6f={'custom_fields':[]};if(_0x39d76c[_0xf0b6('0x24')]>0x0){_[_0xf0b6('0x35')](_0x39d76c,function(_0x5d84b6){if(_['includes']([_0xf0b6('0x36'),_0xf0b6('0x37')],_0x5d84b6[_0xf0b6('0x38')])&&_0x5d84b6[_0xf0b6('0x39')]&&!_0x5d84b6[_0xf0b6('0x3a')]){_0xee2e6f[_0x5d84b6[_0xf0b6('0x39')]['toLowerCase']()]=_0x5d84b6[_0xf0b6('0x3b')][_0xf0b6('0x3c')]();}else if(_['includes']([_0xf0b6('0x36'),_0xf0b6('0x37')],_0x5d84b6[_0xf0b6('0x38')])&&_0x5d84b6[_0xf0b6('0x3d')]&&_0x5d84b6[_0xf0b6('0x3a')]){_0xee2e6f[_0xf0b6('0x1a')][_0xf0b6('0x3e')]({'id':_0x5d84b6[_0xf0b6('0x3d')],'value':_0x5d84b6[_0xf0b6('0x3b')][_0xf0b6('0x3c')]()});}else if(_0x5d84b6['type']===_0xf0b6('0x3f')&&_0x5d84b6[_0xf0b6('0x40')]&&_0x5d84b6[_0xf0b6('0x3d')]&&_0x5d84b6[_0xf0b6('0x3a')]){_0x46c374[_0x5d84b6[_0xf0b6('0x40')]]&&_0xee2e6f['custom_fields']['push']({'id':_0x5d84b6[_0xf0b6('0x3d')],'value':_0x46c374[_0x5d84b6[_0xf0b6('0x40')]][_0xf0b6('0x3c')]()});}else if(_0x5d84b6['type']===_0xf0b6('0x41')&&_0x5d84b6[_0xf0b6('0x42')]&&_0x5d84b6[_0xf0b6('0x42')][_0xf0b6('0x19')]&&_0x5d84b6['idField']&&_0x5d84b6[_0xf0b6('0x3a')]){_0x46c374[_0x5d84b6[_0xf0b6('0x42')][_0xf0b6('0x19')]['toLowerCase']()]&&_0xee2e6f['custom_fields']['push']({'id':_0x5d84b6[_0xf0b6('0x3d')],'value':_0x46c374[_0x5d84b6[_0xf0b6('0x42')]['name']['toLowerCase']()][_0xf0b6('0x3c')]()});}});}return _0xee2e6f;}exports[_0xf0b6('0x43')]=function(_0x5746a2,_0x48824d,_0x4e2903,_0x2d01fa,_0xea25b9,_0x4d1ea4){var _0x5ba3fc,_0x6be13a;_0x4d1ea4[_0xf0b6('0x1f')]=intUtil[_0xf0b6('0x44')](_0x4d1ea4['remoteUri']);_0x4d1ea4[_0xf0b6('0x45')]=intUtil[_0xf0b6('0x44')](_0x4d1ea4[_0xf0b6('0x45')]);if(_0xea25b9&&_0xea25b9[_0xf0b6('0x46')]){logger[_0xf0b6('0xf')](_0xf0b6('0x47'),_0xf0b6('0x48'));_0x48824d[_0xf0b6('0x49')]=util[_0xf0b6('0x12')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4d1ea4['serverUrl'],_0x48824d[_0xf0b6('0x4a')],md5(_0x48824d['uniqueid']));}else{_0x48824d[_0xf0b6('0x49')]='';}headers['Authorization']=getAuth(_0x4d1ea4);return getUser(_0x4d1ea4,_0x2d01fa['email'])[_0xf0b6('0x21')](function(_0x193a38){_0x5ba3fc=_0x193a38;logger[_0xf0b6('0xf')]('The\x20User\x20ID\x20is:',_0x5ba3fc['id']);return getEndUser(_0x4d1ea4,_0x48824d['calleridname'],_0x48824d['calleridnum']);})[_0xf0b6('0x21')](function(_0x25a384){_0x6be13a=_0x25a384;logger[_0xf0b6('0xf')](_0xf0b6('0x4b'),_0x6be13a['id']);return getTicket(_0x4d1ea4,_0x5ba3fc,_0x6be13a,_0x4e2903,_0x48824d);})[_0xf0b6('0x21')](function(_0x5a0efa){if(_0x5a0efa&&_0x5a0efa['id']){logger[_0xf0b6('0xf')](_0xf0b6('0x22'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x5a0efa['id']);logger[_0xf0b6('0xf')](_0xf0b6('0x47'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf0b6('0x12')](_0xf0b6('0x4c'),_0x2d01fa['name']),_0xf0b6('0x4d'),{'uri':util['format'](_0xf0b6('0x4e'),_0x4d1ea4[_0xf0b6('0x1f')],_0x5a0efa['id'])});}})[_0xf0b6('0x4f')](function(_0x21bfdb){logger[_0xf0b6('0x50')](_0xf0b6('0x47'),JSON[_0xf0b6('0x51')](_0x21bfdb));});};exports[_0xf0b6('0x52')]=function(_0x4ea695,_0x55b764,_0xa34e3c,_0x5a8f4d,_0x29146a,_0x335e57,_0x37631b){var _0x4c5195,_0x55cb70;_0x335e57['remoteUri']=intUtil[_0xf0b6('0x44')](_0x335e57[_0xf0b6('0x1f')]);_0x335e57[_0xf0b6('0x45')]=intUtil['stripTrailingSlash'](_0x335e57[_0xf0b6('0x45')]);if(_0x37631b&&_0x37631b[_0xf0b6('0x53')]&&_0x37631b['recordingFormat']!==_0xf0b6('0x54')){logger[_0xf0b6('0xf')]('[OUTBOUND]',_0xf0b6('0x48'));_0x55b764[_0xf0b6('0x49')]=util['format'](_0xf0b6('0x55'),_0x335e57[_0xf0b6('0x45')],_0x55b764[_0xf0b6('0x4a')],md5(_0x55b764[_0xf0b6('0x4a')]));}headers[_0xf0b6('0x56')]=getAuth(_0x335e57);return getUser(_0x335e57,_0x5a8f4d['email'])[_0xf0b6('0x21')](function(_0x4f33ba){_0x4c5195=_0x4f33ba;logger[_0xf0b6('0xf')](_0xf0b6('0x57'),_0x4c5195['id']);return getEndUser(_0x335e57,_0x55b764['destcalleridname'],_0x55b764['destcalleridnum']);})['then'](function(_0x280caa){_0x55cb70=_0x280caa;logger[_0xf0b6('0xf')]('The\x20Enduser\x20ID\x20is:',_0x55cb70['id']);return getTicket(_0x335e57,_0x4c5195,_0x55cb70,_0xa34e3c,_0x55b764);})[_0xf0b6('0x21')](function(_0x1b3e38){if(_0x1b3e38&&_0x1b3e38['id']){logger[_0xf0b6('0xf')]('Ticket\x20created!');logger[_0xf0b6('0xf')](_0xf0b6('0x58'),_0x1b3e38['id']);logger[_0xf0b6('0xf')](_0xf0b6('0x59'),_0xf0b6('0x5a'));emit(util[_0xf0b6('0x12')](_0xf0b6('0x4c'),_0x5a8f4d[_0xf0b6('0x19')]),'trigger:browser:url',{'uri':util['format'](_0xf0b6('0x4e'),_0x335e57[_0xf0b6('0x1f')],_0x1b3e38['id'])});}})[_0xf0b6('0x4f')](function(_0xd1b785){logger[_0xf0b6('0x50')](_0xf0b6('0x59'),JSON[_0xf0b6('0x51')](_0xd1b785));});};exports[_0xf0b6('0x5b')]=function(_0x3703c4,_0x1c074f,_0x324393,_0x2e4d2d,_0x382976,_0x1708cd){var _0x2c62e9,_0x278e88;_0x1708cd['remoteUri']=intUtil['stripTrailingSlash'](_0x1708cd[_0xf0b6('0x1f')]);_0x1708cd[_0xf0b6('0x45')]=intUtil[_0xf0b6('0x44')](_0x1708cd['serverUrl']);if(_0x382976&&_0x382976['monitor_format']){logger['info']('['+_0x1c074f[_0xf0b6('0x5c')][_0xf0b6('0x5d')]()+']',_0xf0b6('0x48'));_0x1c074f[_0xf0b6('0x49')]=util[_0xf0b6('0x12')](_0xf0b6('0x55'),_0x1708cd[_0xf0b6('0x45')],_0x1c074f[_0xf0b6('0x4a')],md5(_0x1c074f[_0xf0b6('0x4a')]));}else{_0x1c074f[_0xf0b6('0x49')]='';}headers[_0xf0b6('0x56')]=getAuth(_0x1708cd);return getUser(_0x1708cd,'')['then'](function(_0x3e2d1a){_0x2c62e9=_0x3e2d1a;logger[_0xf0b6('0xf')]('The\x20User\x20ID\x20is:',_0x2c62e9['id']);return getEndUser(_0x1708cd,_0x1c074f[_0xf0b6('0x13')],_0x1c074f[_0xf0b6('0x14')]);})[_0xf0b6('0x21')](function(_0x4ffa47){_0x278e88=_0x4ffa47;logger[_0xf0b6('0xf')]('The\x20Enduser\x20ID\x20is:',_0x278e88['id']);return getTicket(_0x1708cd,_0x2c62e9,_0x278e88,_0x324393,_0x1c074f);})[_0xf0b6('0x21')](function(_0x1cf5e2){if(_0x1cf5e2){logger[_0xf0b6('0xf')](_0xf0b6('0x22'));logger[_0xf0b6('0xf')]('The\x20Ticket\x20ID\x20is:',_0x1cf5e2['id']);}})['catch'](function(_0xcd2a35){logger[_0xf0b6('0x50')]('['+_0x1c074f[_0xf0b6('0x5c')][_0xf0b6('0x5d')]()+']',JSON[_0xf0b6('0x51')](_0xcd2a35));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshsales.js b/server/services/ami/trigger/integration/freshsales.js index f39be9e..2d8fc10 100644 --- a/server/services/ami/trigger/integration/freshsales.js +++ b/server/services/ami/trigger/integration/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x872a=['queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','info','then','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','Getting\x20user\x20list','users','Getting\x20user\x20with\x20email','userEmail','agentEmail','userId','User\x20found:','error','/api/lookup?q=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','getString','Subjects','Descriptions','Contact','add','ticketId','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection'];(function(_0x52a9a8,_0x4c68b4){var _0xb139cc=function(_0x48b3ef){while(--_0x48b3ef){_0x52a9a8['push'](_0x52a9a8['shift']());}};_0xb139cc(++_0x4c68b4);}(_0x872a,0x100));var _0xa872=function(_0x281ccd,_0x4c4057){_0x281ccd=_0x281ccd-0x0;var _0xcf6f54=_0x872a[_0x281ccd];return _0xcf6f54;};'use strict';var _=require(_0xa872('0x0'));var rp=require(_0xa872('0x1'));var md5=require(_0xa872('0x2'));var util=require(_0xa872('0x3'));var moment=require('moment');var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0xa872('0x4'));var config=require(_0xa872('0x5'));var logger=require(_0xa872('0x6'))(_0xa872('0x7'));config[_0xa872('0x8')]=_[_0xa872('0x9')](config[_0xa872('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xa872('0xa'))(new Redis(config[_0xa872('0x8')]));function getAdminId(_0x1e0c05,_0x1cff1f,_0x1b6839,_0xf82e0b){return new Promise(function(_0x18bbb8,_0x18b69e){var _0x412157=![];var _0x216b4b={'method':_0xa872('0xb'),'uri':_0xf82e0b+_0xa872('0xc'),'json':!![]};_0x216b4b[_0xa872('0xd')]=_0x1b6839;logger[_0xa872('0xe')]('Getting\x20admin\x20information');return rp(_0x216b4b)[_0xa872('0xf')](function(_0x38bc56){if(_0x38bc56){var _0x26cf9a=_0x38bc56['users'];var _0x3df1ed=null;for(_0x3df1ed=0x0;_0x3df1ed<_0x26cf9a[_0xa872('0x10')];_0x3df1ed++){if(_0x26cf9a[_0x3df1ed][_0xa872('0x11')]===_0x1e0c05[_0xa872('0x12')]){_0x1e0c05[_0xa872('0x13')]=_0x26cf9a[_0x3df1ed]['id'];_0x412157=!![];}}if(_0x412157){logger['info'](_0xa872('0x14'),_0x1e0c05['adminId']);_0x18bbb8(_0x1e0c05);}else{_0x18b69e({'statusCode':0x194,'message':_0xa872('0x15')});}}else{_0x18b69e({'statusCode':0x194,'message':_0xa872('0x15')});}})[_0xa872('0x16')](function(_0x947d7){logger['error']('['+[_0x1cff1f[_0xa872('0x17')]()]+']',_0x947d7[_0xa872('0x18')]);_0x18b69e(_0x947d7);});});}function getUser(_0x54a74e,_0x28fe25,_0x18006b){return function(_0x3f5dc6){return new Promise(function(_0x5d68e4,_0xa61ab3){var _0x377107={'method':_0xa872('0xb'),'uri':_0x18006b+_0xa872('0xc'),'json':!![]};_0x377107[_0xa872('0xd')]=_0x28fe25;logger['info'](_0xa872('0x19'));return rp(_0x377107)['then'](function(_0x28adef){if(_0x28adef){var _0x5e1fd0=_0x28adef[_0xa872('0x1a')];var _0x58bd91=![];var _0x18e3a5=null;if(_0x3f5dc6['agentEmail']!==null){logger[_0xa872('0xe')](_0xa872('0x1b'),_0x3f5dc6['agentEmail']);_0x3f5dc6[_0xa872('0x1c')]=_0x3f5dc6[_0xa872('0x1d')];for(_0x18e3a5=0x0;_0x18e3a5<_0x5e1fd0['length'];_0x18e3a5++){if(_0x5e1fd0[_0x18e3a5][_0xa872('0x11')]===_0x3f5dc6[_0xa872('0x1d')]){_0x58bd91=!![];_0x3f5dc6[_0xa872('0x1e')]=_0x5e1fd0[_0x18e3a5]['id'];logger[_0xa872('0xe')](_0xa872('0x1f'),_0x3f5dc6[_0xa872('0x1e')]);}}}if(!_0x58bd91){logger[_0xa872('0xe')]('Admin\x20selected');_0x3f5dc6[_0xa872('0x1c')]=_0x3f5dc6[_0xa872('0x12')];_0x3f5dc6[_0xa872('0x1e')]=_0x3f5dc6[_0xa872('0x13')];_0x58bd91=!![];}if(_0x58bd91){_0x5d68e4(_0x3f5dc6);}else{_0xa61ab3({'statusCode':0x194,'message':_0xa872('0x15')});}}else{_0xa61ab3({'statusCode':0x194,'message':_0xa872('0x15')});}})[_0xa872('0x16')](function(_0x4f3009){logger[_0xa872('0x20')]('['+[_0x54a74e['toUpperCase']()]+']',_0x4f3009[_0xa872('0x18')]);_0xa61ab3(_0x4f3009);});});};}function searchContact(_0x4053c0,_0x1e24c7,_0x53a943,_0x149f8d){return new Promise(function(_0x7c7f13,_0x25322d){var _0x36628b={'method':'GET','headers':_0x1e24c7,'uri':_0x4053c0+_0xa872('0x21')+_0x149f8d+'&f='+_0x53a943+'&entities=contact','json':!![]};rp(_0x36628b)[_0xa872('0xf')](function(_0x4e7f4a){var _0x215a61=_[_0xa872('0x22')](_0x4e7f4a[_0xa872('0x23')][_0xa872('0x23')],[_0x53a943,_0x149f8d]);_0x7c7f13(_0x215a61);})[_0xa872('0x16')](function(_0x4a990d){_0x25322d(_0x4a990d);});});}function getEndUser(_0x23133f,_0x35a2d2,_0x180418){return function(_0x486565){return new Promise(function(_0x50ccb6,_0x427a3c){logger[_0xa872('0xe')](util[_0xa872('0x24')](_0xa872('0x25'),_0x486565[_0xa872('0x26')]));searchContact(_0x180418,_0x35a2d2,'mobile_number',_0x486565[_0xa872('0x26')])[_0xa872('0xf')](function(_0x2ec9f0){if(_0x2ec9f0){_0x486565[_0xa872('0x27')]=_0x2ec9f0['id'];logger['info'](_0xa872('0x28'),_0x486565[_0xa872('0x27')]);return _0x50ccb6(_0x486565);}searchContact(_0x180418,_0x35a2d2,_0xa872('0x29'),_0x486565[_0xa872('0x26')])[_0xa872('0xf')](function(_0x450807){if(_0x450807){_0x486565[_0xa872('0x27')]=_0x450807['id'];logger[_0xa872('0xe')](_0xa872('0x2a'),_0x486565[_0xa872('0x27')]);return _0x50ccb6(_0x486565);}createEndUser(_0x486565,_0x23133f,_0x35a2d2,_0x180418)[_0xa872('0xf')](function(_0x262856){logger[_0xa872('0xe')](_0xa872('0x2b'),_0x262856[_0xa872('0x27')]);return _0x50ccb6(_0x262856);});});})[_0xa872('0x16')](function(_0x2dfaff){_0x427a3c(_0x2dfaff);});});};}function createEndUser(_0x1e0d39,_0x1b76b5,_0x5e429d,_0x57bf49){return new Promise(function(_0x5e1945,_0x51662c){var _0x33f343=moment();var _0x113c70={'method':_0xa872('0x2c'),'uri':_0x57bf49+'/api/contacts','body':{'contact':{'last_name':_0x1e0d39[_0xa872('0x26')],'work_number':_0x1e0d39[_0xa872('0x26')],'mobile_number':_0x1e0d39['contactNumber'],'owner_id':_0x1e0d39[_0xa872('0x1e')],'created_at':_0x33f343[_0xa872('0x24')](_0xa872('0x2d'))}},'json':!![]};_0x113c70['headers']=_0x5e429d;logger[_0xa872('0xe')](_0xa872('0x2e'));return rp(_0x113c70)[_0xa872('0xf')](function(_0x5721f0){_0x1e0d39[_0xa872('0x27')]=_0x5721f0[_0xa872('0x2f')]['id'];_0x5e1945(_0x1e0d39);})[_0xa872('0x16')](function(_0xd61b59){logger[_0xa872('0x20')]('['+[_0x1b76b5[_0xa872('0x17')]()]+']',_0xd61b59[_0xa872('0x18')]);_0x51662c(_0xd61b59['message']);});});}function getTicket(_0x5873ae,_0x2b2d7f,_0x3b1625,_0x35a93f,_0x5a739d){return function(_0x218aeb){logger[_0xa872('0xe')]('Creating\x20new\x20task');return new Promise(function(_0x4e6551,_0x154f3a){var _0x719d4b=moment();var _0x1fc324={'method':_0xa872('0x2c'),'uri':_0x3b1625+'/api/tasks','body':{'title':intUtil[_0xa872('0x30')](_0x35a93f[_0xa872('0x31')],_0x5a739d,'\x20'),'description':intUtil['getString'](_0x35a93f[_0xa872('0x32')],_0x5a739d,'\x0a'),'owner_id':_0x218aeb['userId'],'creater_id':_0x218aeb[_0xa872('0x13')],'targetable_id':_0x218aeb[_0xa872('0x27')],'targetable_type':_0xa872('0x33'),'created_at':_0x719d4b[_0xa872('0x24')](_0xa872('0x2d')),'due_date':_0x719d4b[_0xa872('0x34')](0x1e,'m')[_0xa872('0x24')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x1fc324[_0xa872('0xd')]=_0x2b2d7f;return rp(_0x1fc324)[_0xa872('0xf')](function(_0x4bb271){_0x218aeb[_0xa872('0x35')]=_0x4bb271['task']['id'];logger[_0xa872('0xe')](_0xa872('0x36'),_0x218aeb['ticketId']);_0x4e6551(_0x218aeb);})[_0xa872('0x16')](function(_0x5b30b3){logger['error']('['+[_0x5873ae[_0xa872('0x17')]()]+']',_0x5b30b3[_0xa872('0x18')]);_0x154f3a(_0x5b30b3[_0xa872('0x18')]);});});};}function emit(_0x413420,_0x1a7008,_0x5ea257){var _0x131276={'uri':_0x413420+_0xa872('0x37')+_0x5ea257};io['to'](util[_0xa872('0x24')]('user:%s',_0x1a7008))[_0xa872('0x38')](_0xa872('0x39'),_0x131276);}exports['cs']=function(_0x52890c,_0x146f59,_0xa63778,_0x115c49,_0x512b8a,_0x4ed854,_0x2d81d2,_0x1fc7d1){var _0x125020={};var _0x5a1e0f={'Authorization':_0xa872('0x3a')+_0x4ed854[_0xa872('0x3b')]};_0x4ed854['remoteUri']=intUtil[_0xa872('0x3c')](_0x4ed854[_0xa872('0x3d')]);_0x4ed854['serverUrl']=intUtil[_0xa872('0x3c')](_0x4ed854['serverUrl']);var _0x3d93ef=_0x4ed854['remoteUri'];_0x125020[_0xa872('0x12')]=_0x4ed854[_0xa872('0x3e')];_0x125020[_0xa872('0x26')]=_0x1fc7d1[_0xa872('0x3f')]()===_0xa872('0x40')?_0x146f59[_0xa872('0x41')]:_0x146f59[_0xa872('0x42')];_0x125020[_0xa872('0x43')]=_0x1fc7d1===_0xa872('0x44')||_0x1fc7d1===_0xa872('0x45')?_0xa872('0x44'):_0xa872('0x40');if(_0x115c49){_0x125020[_0xa872('0x1d')]=_0x115c49[_0xa872('0x11')];}var _0x557755=util['format'](_0xa872('0x46'),_0x4ed854[_0xa872('0x47')],_0x146f59[_0xa872('0x48')],md5(_0x146f59['uniqueid']));if(_0x512b8a&&_0x512b8a['monitor_format']){logger[_0xa872('0xe')](_0xa872('0x49'),_0xa872('0x4a'));_0x146f59[_0xa872('0x4b')]=_0x557755;}else if(_0x2d81d2&&_0x2d81d2[_0xa872('0x4c')]&&_0x2d81d2[_0xa872('0x4c')]!==_0xa872('0x4d')){logger[_0xa872('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x146f59[_0xa872('0x4b')]=_0x557755;}else{_0x146f59[_0xa872('0x4b')]='';}return getAdminId(_0x125020,_0x1fc7d1,_0x5a1e0f,_0x3d93ef)[_0xa872('0xf')](getUser(_0x1fc7d1,_0x5a1e0f,_0x3d93ef))[_0xa872('0xf')](getEndUser(_0x1fc7d1,_0x5a1e0f,_0x3d93ef))[_0xa872('0xf')](getTicket(_0x1fc7d1,_0x5a1e0f,_0x3d93ef,_0xa63778,_0x146f59))[_0xa872('0xf')](function(_0xac4598){logger[_0xa872('0xe')](util[_0xa872('0x24')]('The\x20ticket\x20ID\x20is:\x20%s',_0xac4598[_0xa872('0x35')]));if(_0x1fc7d1!==_0xa872('0x45')){logger[_0xa872('0xe')]('['+[_0x1fc7d1[_0xa872('0x17')]()]+']',_0xa872('0x4e'));emit(_0x3d93ef,_0x115c49[_0xa872('0x4f')],_0xac4598['endUserId']);}})['catch'](function(_0x53477b){logger[_0xa872('0x20')]('['+[_0x1fc7d1['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xa872('0x50')](_0x53477b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xed5f=['error','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','User\x20found:','userId','userEmail','adminEmail','toUpperCase','/api/lookup?q=','&f=','&entities=contact','contacts','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Descriptions','ticketId','task','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','then','users','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xed5f,0x1e6));var _0xfed5=function(_0x595106,_0x1cc044){_0x595106=_0x595106-0x0;var _0x595691=_0xed5f[_0x595106];return _0x595691;};'use strict';var _=require('lodash');var rp=require(_0xfed5('0x0'));var md5=require(_0xfed5('0x1'));var util=require(_0xfed5('0x2'));var moment=require('moment');var Promise=require(_0xfed5('0x3'));var Redis=require(_0xfed5('0x4'));var intUtil=require(_0xfed5('0x5'));var config=require(_0xfed5('0x6'));var logger=require('../../../../config/logger')(_0xfed5('0x7'));config[_0xfed5('0x8')]=_[_0xfed5('0x9')](config['redis'],{'host':_0xfed5('0xa'),'port':0x18eb});var io=require(_0xfed5('0xb'))(new Redis(config['redis']));function getAdminId(_0x299fb6,_0x4422e5,_0x1ea3c7,_0x314fa2){return new Promise(function(_0x38b02a,_0x2578c8){var _0x4443d8=![];var _0x445dd3={'method':_0xfed5('0xc'),'uri':_0x314fa2+_0xfed5('0xd'),'json':!![]};_0x445dd3[_0xfed5('0xe')]=_0x1ea3c7;logger[_0xfed5('0xf')]('Getting\x20admin\x20information');return rp(_0x445dd3)[_0xfed5('0x10')](function(_0xc02c5b){if(_0xc02c5b){var _0x3f2818=_0xc02c5b[_0xfed5('0x11')];var _0x4c6029=null;for(_0x4c6029=0x0;_0x4c6029<_0x3f2818[_0xfed5('0x12')];_0x4c6029++){if(_0x3f2818[_0x4c6029][_0xfed5('0x13')]===_0x299fb6['adminEmail']){_0x299fb6[_0xfed5('0x14')]=_0x3f2818[_0x4c6029]['id'];_0x4443d8=!![];}}if(_0x4443d8){logger[_0xfed5('0xf')](_0xfed5('0x15'),_0x299fb6[_0xfed5('0x14')]);_0x38b02a(_0x299fb6);}else{_0x2578c8({'statusCode':0x194,'message':_0xfed5('0x16')});}}else{_0x2578c8({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xfed5('0x17')](function(_0x53a3ed){logger[_0xfed5('0x18')]('['+[_0x4422e5['toUpperCase']()]+']',_0x53a3ed[_0xfed5('0x19')]);_0x2578c8(_0x53a3ed);});});}function getUser(_0x1a7990,_0x2a269f,_0x7688e8){return function(_0x3a0656){return new Promise(function(_0x1264cb,_0x35004e){var _0x3791fd={'method':_0xfed5('0xc'),'uri':_0x7688e8+_0xfed5('0xd'),'json':!![]};_0x3791fd[_0xfed5('0xe')]=_0x2a269f;logger[_0xfed5('0xf')](_0xfed5('0x1a'));return rp(_0x3791fd)[_0xfed5('0x10')](function(_0x50b640){if(_0x50b640){var _0x770d=_0x50b640['users'];var _0x3eff4b=![];var _0x201f79=null;if(_0x3a0656[_0xfed5('0x1b')]!==null){logger[_0xfed5('0xf')](_0xfed5('0x1c'),_0x3a0656[_0xfed5('0x1b')]);_0x3a0656['userEmail']=_0x3a0656[_0xfed5('0x1b')];for(_0x201f79=0x0;_0x201f79<_0x770d['length'];_0x201f79++){if(_0x770d[_0x201f79]['email']===_0x3a0656[_0xfed5('0x1b')]){_0x3eff4b=!![];_0x3a0656['userId']=_0x770d[_0x201f79]['id'];logger['info'](_0xfed5('0x1d'),_0x3a0656[_0xfed5('0x1e')]);}}}if(!_0x3eff4b){logger[_0xfed5('0xf')]('Admin\x20selected');_0x3a0656[_0xfed5('0x1f')]=_0x3a0656[_0xfed5('0x20')];_0x3a0656[_0xfed5('0x1e')]=_0x3a0656['adminId'];_0x3eff4b=!![];}if(_0x3eff4b){_0x1264cb(_0x3a0656);}else{_0x35004e({'statusCode':0x194,'message':_0xfed5('0x16')});}}else{_0x35004e({'statusCode':0x194,'message':_0xfed5('0x16')});}})['catch'](function(_0x298d40){logger['error']('['+[_0x1a7990[_0xfed5('0x21')]()]+']',_0x298d40[_0xfed5('0x19')]);_0x35004e(_0x298d40);});});};}function searchContact(_0x2268ba,_0x46e107,_0x4ee045,_0x12d991){return new Promise(function(_0x3793b5,_0x50dae4){var _0x2cde84={'method':_0xfed5('0xc'),'headers':_0x46e107,'uri':_0x2268ba+_0xfed5('0x22')+_0x12d991+_0xfed5('0x23')+_0x4ee045+_0xfed5('0x24'),'json':!![]};rp(_0x2cde84)[_0xfed5('0x10')](function(_0x332baa){var _0x213dbd=_['find'](_0x332baa['contacts'][_0xfed5('0x25')],[_0x4ee045,_0x12d991]);_0x3793b5(_0x213dbd);})[_0xfed5('0x17')](function(_0x54af65){_0x50dae4(_0x54af65);});});}function getEndUser(_0x1959c6,_0xd64d8a,_0x44d767){return function(_0x32eca8){return new Promise(function(_0x532ad4,_0x3639a4){logger[_0xfed5('0xf')](util['format'](_0xfed5('0x26'),_0x32eca8['contactNumber']));searchContact(_0x44d767,_0xd64d8a,_0xfed5('0x27'),_0x32eca8[_0xfed5('0x28')])[_0xfed5('0x10')](function(_0x189f91){if(_0x189f91){_0x32eca8[_0xfed5('0x29')]=_0x189f91['id'];logger[_0xfed5('0xf')](_0xfed5('0x2a'),_0x32eca8[_0xfed5('0x29')]);return _0x532ad4(_0x32eca8);}searchContact(_0x44d767,_0xd64d8a,_0xfed5('0x2b'),_0x32eca8[_0xfed5('0x28')])['then'](function(_0x300055){if(_0x300055){_0x32eca8[_0xfed5('0x29')]=_0x300055['id'];logger[_0xfed5('0xf')](_0xfed5('0x2c'),_0x32eca8['endUserId']);return _0x532ad4(_0x32eca8);}createEndUser(_0x32eca8,_0x1959c6,_0xd64d8a,_0x44d767)[_0xfed5('0x10')](function(_0x23eb77){logger[_0xfed5('0xf')](_0xfed5('0x2d'),_0x23eb77[_0xfed5('0x29')]);return _0x532ad4(_0x23eb77);});});})[_0xfed5('0x17')](function(_0x1f870d){_0x3639a4(_0x1f870d);});});};}function createEndUser(_0x3a9418,_0xd8b9f0,_0x274af4,_0x2163fd){return new Promise(function(_0x2dfc00,_0x1f6dcb){var _0x41b478=moment();var _0x57a1d5={'method':_0xfed5('0x2e'),'uri':_0x2163fd+_0xfed5('0x2f'),'body':{'contact':{'last_name':_0x3a9418['contactNumber'],'work_number':_0x3a9418[_0xfed5('0x28')],'mobile_number':_0x3a9418[_0xfed5('0x28')],'owner_id':_0x3a9418[_0xfed5('0x1e')],'created_at':_0x41b478[_0xfed5('0x30')](_0xfed5('0x31'))}},'json':!![]};_0x57a1d5['headers']=_0x274af4;logger[_0xfed5('0xf')](_0xfed5('0x32'));return rp(_0x57a1d5)[_0xfed5('0x10')](function(_0x5d017b){_0x3a9418[_0xfed5('0x29')]=_0x5d017b[_0xfed5('0x33')]['id'];_0x2dfc00(_0x3a9418);})[_0xfed5('0x17')](function(_0x237eb0){logger[_0xfed5('0x18')]('['+[_0xd8b9f0[_0xfed5('0x21')]()]+']',_0x237eb0[_0xfed5('0x19')]);_0x1f6dcb(_0x237eb0['message']);});});}function getTicket(_0x171e9e,_0x25b3ee,_0x5be9e3,_0x21f0fe,_0x2e2e56){return function(_0x135984){logger[_0xfed5('0xf')]('Creating\x20new\x20task');return new Promise(function(_0x1a299c,_0x476801){var _0x2cd60f=moment();var _0xaa9c37={'method':_0xfed5('0x2e'),'uri':_0x5be9e3+_0xfed5('0x34'),'body':{'title':intUtil[_0xfed5('0x35')](_0x21f0fe[_0xfed5('0x36')],_0x2e2e56,'\x20'),'description':intUtil[_0xfed5('0x35')](_0x21f0fe[_0xfed5('0x37')],_0x2e2e56,'\x0a'),'owner_id':_0x135984['userId'],'creater_id':_0x135984['adminId'],'targetable_id':_0x135984['endUserId'],'targetable_type':'Contact','created_at':_0x2cd60f[_0xfed5('0x30')](_0xfed5('0x31')),'due_date':_0x2cd60f['add'](0x1e,'m')[_0xfed5('0x30')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0xaa9c37[_0xfed5('0xe')]=_0x25b3ee;return rp(_0xaa9c37)[_0xfed5('0x10')](function(_0x4046ce){_0x135984[_0xfed5('0x38')]=_0x4046ce[_0xfed5('0x39')]['id'];logger[_0xfed5('0xf')]('Task\x20created:',_0x135984[_0xfed5('0x38')]);_0x1a299c(_0x135984);})[_0xfed5('0x17')](function(_0xfaf9be){logger[_0xfed5('0x18')]('['+[_0x171e9e[_0xfed5('0x21')]()]+']',_0xfaf9be['message']);_0x476801(_0xfaf9be[_0xfed5('0x19')]);});});};}function emit(_0xd18bcb,_0x217b0d,_0x59100f){var _0x350baa={'uri':_0xd18bcb+'/contacts/'+_0x59100f};io['to'](util['format'](_0xfed5('0x3a'),_0x217b0d))[_0xfed5('0x3b')](_0xfed5('0x3c'),_0x350baa);}exports['cs']=function(_0x4e25c9,_0x11eb11,_0x13779e,_0x7609b1,_0x2ff7be,_0x37da9d,_0x4d9c47,_0x2f451d){var _0x5f31cf={};var _0x37d98c={'Authorization':_0xfed5('0x3d')+_0x37da9d[_0xfed5('0x3e')]};_0x37da9d[_0xfed5('0x3f')]=intUtil['stripTrailingSlash'](_0x37da9d['remoteUri']);_0x37da9d['serverUrl']=intUtil[_0xfed5('0x40')](_0x37da9d[_0xfed5('0x41')]);var _0x29964f=_0x37da9d[_0xfed5('0x3f')];_0x5f31cf[_0xfed5('0x20')]=_0x37da9d[_0xfed5('0x42')];_0x5f31cf[_0xfed5('0x28')]=_0x2f451d[_0xfed5('0x43')]()===_0xfed5('0x44')?_0x11eb11[_0xfed5('0x45')]:_0x11eb11[_0xfed5('0x46')];_0x5f31cf[_0xfed5('0x47')]=_0x2f451d===_0xfed5('0x48')||_0x2f451d===_0xfed5('0x49')?'queue':'outbound';if(_0x7609b1){_0x5f31cf[_0xfed5('0x1b')]=_0x7609b1[_0xfed5('0x13')];}var _0x33dbe7=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x37da9d[_0xfed5('0x41')],_0x11eb11[_0xfed5('0x4a')],md5(_0x11eb11[_0xfed5('0x4a')]));if(_0x2ff7be&&_0x2ff7be[_0xfed5('0x4b')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x11eb11[_0xfed5('0x4c')]=_0x33dbe7;}else if(_0x4d9c47&&_0x4d9c47[_0xfed5('0x4d')]&&_0x4d9c47[_0xfed5('0x4d')]!==_0xfed5('0x4e')){logger[_0xfed5('0xf')](_0xfed5('0x4f'),_0xfed5('0x50'));_0x11eb11[_0xfed5('0x4c')]=_0x33dbe7;}else{_0x11eb11[_0xfed5('0x4c')]='';}return getAdminId(_0x5f31cf,_0x2f451d,_0x37d98c,_0x29964f)[_0xfed5('0x10')](getUser(_0x2f451d,_0x37d98c,_0x29964f))[_0xfed5('0x10')](getEndUser(_0x2f451d,_0x37d98c,_0x29964f))[_0xfed5('0x10')](getTicket(_0x2f451d,_0x37d98c,_0x29964f,_0x13779e,_0x11eb11))[_0xfed5('0x10')](function(_0x115b20){logger[_0xfed5('0xf')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x115b20[_0xfed5('0x38')]));if(_0x2f451d!==_0xfed5('0x49')){logger[_0xfed5('0xf')]('['+[_0x2f451d[_0xfed5('0x21')]()]+']',_0xfed5('0x51'));emit(_0x29964f,_0x7609b1[_0xfed5('0x52')],_0x115b20[_0xfed5('0x29')]);}})[_0xfed5('0x17')](function(_0x2d3da1){logger[_0xfed5('0x18')]('['+[_0x2f451d[_0xfed5('0x21')]()]+_0xfed5('0x53'),util[_0xfed5('0x54')](_0x2d3da1,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index abad8b8..dad378b 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 _0xbaf0=['format','%s\x20configuration\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','vtiger','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','EVENT\x20UNKNOWN','unmanaged','desk','unknown\x20integration','../../../../config/logger','error','[EXEC]'];(function(_0x26612e,_0x11f725){var _0xad499a=function(_0x49a735){while(--_0x49a735){_0x26612e['push'](_0x26612e['shift']());}};_0xad499a(++_0x11f725);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var zendesk=require(_0x0baf('0x1'));var salesforce=require(_0x0baf('0x2'));var sugarcrm=require(_0x0baf('0x3'));var freshdesk=require(_0x0baf('0x4'));var zoho=require(_0x0baf('0x5'));var desk=require('./desk');var vtiger=require(_0x0baf('0x6'));var servicenow=require(_0x0baf('0x7'));var dynamics365=require(_0x0baf('0x8'));var freshsales=require(_0x0baf('0x9'));var integrations=[_0x0baf('0xa'),_0x0baf('0xb'),_0x0baf('0xc'),_0x0baf('0xd'),_0x0baf('0xe'),'desk',_0x0baf('0xf'),'dynamics365',_0x0baf('0x10'),_0x0baf('0x11')];exports[_0x0baf('0x12')]=function(_0x2f46e8,_0x7f54d4,_0xf4c8ac,_0x41cead,_0x245a6b,_0x1fc6b2){if(_0xf4c8ac){if(_[_0x0baf('0x13')](integrations,_0x2f46e8[_0x0baf('0x14')]['toLowerCase']())){try{var _0x5a53e2=null;var _0x465dd7='';var _0xe4378c=_0xf4c8ac[_0x2f46e8[_0x0baf('0x14')][_0x0baf('0x15')]()];if(_0xe4378c){var _0x5a0583=_0xe4378c[_0x2f46e8[_0x0baf('0x16')]];if(_0x5a0583){var _0x49e44b=_[_0x0baf('0x17')](_0x5a0583[_0x0baf('0x18')],{'id':parseInt(_0x2f46e8[_0x0baf('0x19')],0xa)});if(_0x49e44b){if(_0x41cead){if(_0x245a6b&&_0x7f54d4[_0x0baf('0x1a')]){_0x465dd7=_0x0baf('0x1a');}else if(_0x7f54d4[_0x0baf('0x1b')]){_0x465dd7='outbound';}else{console['log'](_0x0baf('0x1c'),_0x7f54d4);}}else{_0x465dd7=_0x0baf('0x1d');}switch(_0x2f46e8[_0x0baf('0x14')][_0x0baf('0x15')]()){case _0x0baf('0xa'):zendesk[_0x465dd7](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2);break;case _0x0baf('0xb'):salesforce[_0x465dd7](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2);break;case'sugarcrm':sugarcrm[_0x465dd7](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2);break;case _0x0baf('0xd'):freshdesk[_0x465dd7](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2);break;case _0x0baf('0xe'):zoho[_0x465dd7](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2);break;case _0x0baf('0x1e'):desk[_0x465dd7](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2);break;case _0x0baf('0xf'):vtiger[_0x465dd7](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2);break;case _0x0baf('0x10'):freshsales['cs'](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2,_0x465dd7);break;case _0x0baf('0x11'):servicenow['cs'](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2,_0x465dd7);break;case'dynamics365':dynamics365['cs'](_0x2f46e8,_0x7f54d4,_0x49e44b,_0x41cead,_0x245a6b,_0x5a0583,_0x1fc6b2,_0x465dd7);break;default:console['log'](_0x0baf('0x1f'));}}else{_0x5a53e2=require(_0x0baf('0x20'))(_0x2f46e8[_0x0baf('0x14')][_0x0baf('0x15')]());_0x5a53e2[_0x0baf('0x21')](_0x0baf('0x22'),util[_0x0baf('0x23')](_0x0baf('0x24'),_0x2f46e8[_0x0baf('0x14')][_0x0baf('0x15')](),_0x2f46e8['data3']));}}else{_0x5a53e2=require(_0x0baf('0x20'))(_0x2f46e8['data1'][_0x0baf('0x15')]());_0x5a53e2['error']('[EXEC]',util[_0x0baf('0x23')]('%s\x20account\x20#%s\x20not\x20found',_0x2f46e8['data1'][_0x0baf('0x15')](),_0x2f46e8[_0x0baf('0x16')]));}}else{}}catch(_0x34e264){console[_0x0baf('0x21')](_0x34e264);}}}}; \ No newline at end of file +var _0x4024=['zendesk','salesforce','sugarcrm','zoho','dynamics365','exec','includes','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','desk','vtiger','servicenow','unknown\x20integration','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./zoho','./vtiger','./servicenow'];(function(_0x57bb83,_0x97a539){var _0x20ee48=function(_0x229cfe){while(--_0x229cfe){_0x57bb83['push'](_0x57bb83['shift']());}};_0x20ee48(++_0x97a539);}(_0x4024,0x89));var _0x4402=function(_0x17b911,_0xbd3ad7){_0x17b911=_0x17b911-0x0;var _0x72c3fe=_0x4024[_0x17b911];return _0x72c3fe;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x4402('0x2'));var sugarcrm=require(_0x4402('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0x4402('0x4'));var desk=require('./desk');var vtiger=require(_0x4402('0x5'));var servicenow=require(_0x4402('0x6'));var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0x4402('0x7'),_0x4402('0x8'),_0x4402('0x9'),'freshdesk',_0x4402('0xa'),'desk','vtiger',_0x4402('0xb'),'freshsales','servicenow'];exports[_0x4402('0xc')]=function(_0x4f56aa,_0x1a4a47,_0x4e1a7e,_0x34b4a6,_0x525531,_0x3663e7){if(_0x4e1a7e){if(_[_0x4402('0xd')](integrations,_0x4f56aa['data1'][_0x4402('0xe')]())){try{var _0x302c4d=null;var _0xa819e9='';var _0x4c9032=_0x4e1a7e[_0x4f56aa[_0x4402('0xf')][_0x4402('0xe')]()];if(_0x4c9032){var _0x42f1b0=_0x4c9032[_0x4f56aa[_0x4402('0x10')]];if(_0x42f1b0){var _0x248ad9=_[_0x4402('0x11')](_0x42f1b0[_0x4402('0x12')],{'id':parseInt(_0x4f56aa[_0x4402('0x13')],0xa)});if(_0x248ad9){if(_0x34b4a6){if(_0x525531&&_0x1a4a47[_0x4402('0x14')]){_0xa819e9=_0x4402('0x14');}else if(_0x1a4a47[_0x4402('0x15')]){_0xa819e9=_0x4402('0x16');}else{console[_0x4402('0x17')](_0x4402('0x18'),_0x1a4a47);}}else{_0xa819e9=_0x4402('0x19');}switch(_0x4f56aa[_0x4402('0xf')][_0x4402('0xe')]()){case _0x4402('0x7'):zendesk[_0xa819e9](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7);break;case _0x4402('0x8'):salesforce[_0xa819e9](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7);break;case _0x4402('0x9'):sugarcrm[_0xa819e9](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7);break;case'freshdesk':freshdesk[_0xa819e9](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7);break;case'zoho':zoho[_0xa819e9](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7);break;case _0x4402('0x1a'):desk[_0xa819e9](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7);break;case _0x4402('0x1b'):vtiger[_0xa819e9](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7);break;case'freshsales':freshsales['cs'](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7,_0xa819e9);break;case _0x4402('0x1c'):servicenow['cs'](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7,_0xa819e9);break;case _0x4402('0xb'):dynamics365['cs'](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7,_0xa819e9);break;default:console['log'](_0x4402('0x1d'));}}else{_0x302c4d=require('../../../../config/logger')(_0x4f56aa['data1'][_0x4402('0xe')]());_0x302c4d[_0x4402('0x1e')](_0x4402('0x1f'),util['format'](_0x4402('0x20'),_0x4f56aa['data1']['toLowerCase'](),_0x4f56aa[_0x4402('0x13')]));}}else{_0x302c4d=require(_0x4402('0x21'))(_0x4f56aa[_0x4402('0xf')][_0x4402('0xe')]());_0x302c4d[_0x4402('0x1e')](_0x4402('0x1f'),util[_0x4402('0x22')](_0x4402('0x23'),_0x4f56aa[_0x4402('0xf')]['toLowerCase'](),_0x4f56aa[_0x4402('0x10')]));}}else{}}catch(_0x4e1c04){console[_0x4402('0x1e')](_0x4e1c04);}}}}; \ 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 d746468..5b231ab 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 _0xbd6b=['Account','first','Phone','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','includes','idField','content','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','username','queue','serverUrl','remoteUri','monitor_format','recordingURL','%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.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','%s/%s/e','catch','stripTrailingSlash','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','defaults','redis','socket.io-emitter','emit','assign','Subjects','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','contact','endUserType','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','sobject','find','execute','then','length','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','additionalSearchAccount','Lead'];(function(_0x27ecfb,_0x2b0f04){var _0x43cca5=function(_0xb27350){while(--_0xb27350){_0x27ecfb['push'](_0x27ecfb['shift']());}};_0x43cca5(++_0x2b0f04);}(_0xbd6b,0xbc));var _0xbbd6=function(_0x475645,_0x1f3e79){_0x475645=_0x475645-0x0;var _0x13e9e9=_0xbd6b[_0x475645];return _0x13e9e9;};'use strict';var _=require(_0xbbd6('0x0'));var rp=require(_0xbbd6('0x1'));var moment=require(_0xbbd6('0x2'));var BPromise=require('bluebird');var md5=require(_0xbbd6('0x3'));var jsforce=require(_0xbbd6('0x4'));var util=require(_0xbbd6('0x5'));var Redis=require(_0xbbd6('0x6'));var intUtil=require('./util');var config=require(_0xbbd6('0x7'));var logger=require(_0xbbd6('0x8'))('salesforce');config['redis']=_[_0xbbd6('0x9')](config[_0xbbd6('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xbbd6('0xb'))(new Redis(config[_0xbbd6('0xa')]));function emit(_0x23eef7,_0x5f2183,_0x51f85c){io['to'](_0x23eef7)[_0xbbd6('0xc')](_0x5f2183,_0x51f85c);}function getTicket(_0x25e6de,_0xcc0b9e,_0x45df07,_0x401ab4,_0x3eac32,_0x3a6f66,_0x5ca135,_0x3ebae6){var _0x442a5d=Object[_0xbbd6('0xd')]({},{'OwnerId':_0xcc0b9e['id'],'Subject':intUtil['getString'](_0x401ab4[_0xbbd6('0xe')],_0x3eac32,'\x20'),'Description':intUtil[_0xbbd6('0xf')](_0x401ab4[_0xbbd6('0x10')],_0x3eac32,'\x0a')},getCustomFields(_0x3a6f66,_0x3eac32));if(_0x45df07){if(_0x401ab4[_0xbbd6('0x11')]===_0xbbd6('0x12')){_0x442a5d[_0xbbd6('0x13')]=moment[_0xbbd6('0x14')]();_0x442a5d['IsReminderSet']=![];_0x442a5d[_0xbbd6('0x15')]=![];if(_0x45df07['endUserType']===_0xbbd6('0x16')||_0x45df07[_0xbbd6('0x17')]===_0xbbd6('0x18')){_0x442a5d[_0xbbd6('0x19')]=_0x45df07['id'];}else if(_0x45df07[_0xbbd6('0x17')]===_0xbbd6('0x1a')){_0x442a5d[_0xbbd6('0x1b')]=_0x45df07['id'];}}else if(_0x401ab4[_0xbbd6('0x11')]===_0xbbd6('0x1c')){if(_0x45df07['endUserType']===_0xbbd6('0x16')){_0x442a5d[_0xbbd6('0x1d')]=_0x45df07['id'];}else if(_0x45df07['endUserType']==='account'){_0x442a5d[_0xbbd6('0x1e')]=_0x45df07['id'];}else if(_0x45df07[_0xbbd6('0x17')]==='lead'&&_0x401ab4[_0xbbd6('0x1f')]){_0x442a5d[_0x401ab4[_0xbbd6('0x1f')]]=_0x45df07['id'];}else{logger['info'](_0xbbd6('0x20'));}}}return _0x5ca135['sobject'](_0x401ab4[_0xbbd6('0x11')])[_0xbbd6('0x21')](_0x442a5d);}function getUser(_0x429265,_0x53c2d0,_0x4dc81c){if(!_[_0xbbd6('0x22')](_0x53c2d0)&&intUtil[_0xbbd6('0x23')](_0x53c2d0)){var _0x5486c2={'Email':_0x53c2d0};var _0x27d243={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4dc81c[_0xbbd6('0x24')]('User')[_0xbbd6('0x25')](_0x5486c2,_0x27d243)[_0xbbd6('0x26')]()[_0xbbd6('0x27')](function(_0xe6b8ca){if(_0xe6b8ca[_0xbbd6('0x28')]){var _0x2511a8=_[_0xbbd6('0x25')](_0xe6b8ca,function(_0xc9218c){return _0xc9218c['Email']===_0x53c2d0;});if(_0x2511a8){logger[_0xbbd6('0x29')](_0xbbd6('0x2a'),_0x53c2d0);return BPromise[_0xbbd6('0x2b')]({'id':_0x2511a8['Id'],'name':_0x2511a8[_0xbbd6('0x2c')]});}}else{logger[_0xbbd6('0x29')](_0xbbd6('0x2d'),_0x53c2d0);return _0x4dc81c['identity']()[_0xbbd6('0x27')](function(_0x1751af){return BPromise[_0xbbd6('0x2b')]({'id':_0x1751af[_0xbbd6('0x2e')],'name':_0x1751af[_0xbbd6('0x2f')]});});}});}else{logger[_0xbbd6('0x29')](_0xbbd6('0x2d'),_0x53c2d0);return _0x4dc81c['identity']()[_0xbbd6('0x27')](function(_0x11c3b2){return BPromise[_0xbbd6('0x2b')]({'id':_0x11c3b2[_0xbbd6('0x2e')],'name':_0x11c3b2[_0xbbd6('0x2f')]});});}}function getEndUser(_0x332e70,_0x524440,_0x25d699,_0x5f831a,_0x238ddc){var _0x210e08={'$or':{'Phone':_0x5f831a}};var _0x53f951={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xbbd6('0x2b')]()[_0xbbd6('0x27')](function(){logger[_0xbbd6('0x29')](_0xbbd6('0x30'),_0x5f831a,_0x524440[_0xbbd6('0x31')]);switch(_0x524440[_0xbbd6('0x31')]){case'contact_lead':var _0x453cf3=_[_0xbbd6('0x32')](_0x210e08);if(_0x524440[_0xbbd6('0x33')]){var _0x1fedcf={};_0x1fedcf[_0x524440['additionalSearchContact']]=_0x5f831a;_[_0xbbd6('0x34')](_0x453cf3[_0xbbd6('0x35')],_0x1fedcf);}return _0x238ddc[_0xbbd6('0x24')](_0xbbd6('0x36'))['find'](_0x453cf3,_0x53f951)[_0xbbd6('0x26')]()[_0xbbd6('0x27')](function(_0x4e4d71){if(_0x4e4d71&&_0x4e4d71[_0xbbd6('0x28')]){return _0x4e4d71;}else{var _0x5b2349=_[_0xbbd6('0x32')](_0x210e08);if(_0x524440['additionalSearchLead']){var _0x271992={};_0x271992[_0x524440[_0xbbd6('0x37')]]=_0x5f831a;_[_0xbbd6('0x34')](_0x5b2349[_0xbbd6('0x35')],_0x271992);}return _0x238ddc[_0xbbd6('0x24')]('Lead')[_0xbbd6('0x25')](_0x5b2349,_0x53f951);}});case'account_contact_lead':var _0x572703=_[_0xbbd6('0x32')](_0x210e08);if(_0x524440[_0xbbd6('0x38')]){var _0x1fedcf={};_0x1fedcf[_0x524440['additionalSearchAccount']]=_0x5f831a;_['merge'](_0x572703[_0xbbd6('0x35')],_0x1fedcf);}return _0x238ddc[_0xbbd6('0x24')]('Account')[_0xbbd6('0x25')](_0x572703,_0x53f951)[_0xbbd6('0x26')]()[_0xbbd6('0x27')](function(_0x4b9de5){if(_0x4b9de5&&_0x4b9de5['length']){return _0x4b9de5;}else{var _0x2273b6=_[_0xbbd6('0x32')](_0x210e08);if(_0x524440[_0xbbd6('0x33')]){var _0x2ddc9e={};_0x2ddc9e[_0x524440[_0xbbd6('0x33')]]=_0x5f831a;_[_0xbbd6('0x34')](_0x2273b6['$or'],_0x2ddc9e);}return _0x238ddc[_0xbbd6('0x24')]('Contact')[_0xbbd6('0x25')](_0x2273b6,_0x53f951)[_0xbbd6('0x27')](function(_0x30d09c){if(_0x30d09c&&_0x30d09c['length']){return _0x30d09c;}else{var _0x231b24=_[_0xbbd6('0x32')](_0x210e08);if(_0x524440['additionalSearchLead']){var _0x4eede5={};_0x4eede5[_0x524440[_0xbbd6('0x37')]]=_0x5f831a;_[_0xbbd6('0x34')](_0x231b24[_0xbbd6('0x35')],_0x4eede5);}return _0x238ddc['sobject'](_0xbbd6('0x39'))[_0xbbd6('0x25')](_0x231b24,_0x53f951);}});}});case _0xbbd6('0x16'):var _0x453cf3=_[_0xbbd6('0x32')](_0x210e08);if(_0x524440[_0xbbd6('0x33')]){var _0x1fedcf={};_0x1fedcf[_0x524440[_0xbbd6('0x33')]]=_0x5f831a;_[_0xbbd6('0x34')](_0x453cf3[_0xbbd6('0x35')],_0x1fedcf);}return _0x238ddc['sobject'](_0xbbd6('0x36'))['find'](_0x453cf3,_0x53f951)['execute']();case _0xbbd6('0x18'):var _0x46f93c=_[_0xbbd6('0x32')](_0x210e08);if(_0x524440[_0xbbd6('0x37')]){var _0x1fedcf={};_0x1fedcf[_0x524440[_0xbbd6('0x37')]]=_0x5f831a;_[_0xbbd6('0x34')](_0x46f93c[_0xbbd6('0x35')],_0x1fedcf);}return _0x238ddc['sobject']('Lead')[_0xbbd6('0x25')](_0x46f93c,_0x53f951);case _0xbbd6('0x1a'):var _0x572703=_['cloneDeep'](_0x210e08);if(_0x524440[_0xbbd6('0x38')]){var _0x1fedcf={};_0x1fedcf[_0x524440[_0xbbd6('0x38')]]=_0x5f831a;_[_0xbbd6('0x34')](_0x572703[_0xbbd6('0x35')],_0x1fedcf);}return _0x238ddc[_0xbbd6('0x24')](_0xbbd6('0x3a'))[_0xbbd6('0x25')](_0x572703,_0x53f951);default:return null;}})[_0xbbd6('0x27')](function(_0x5803e4){if(_0x5803e4&&_0x5803e4[_0xbbd6('0x28')]){var _0x17a487=_[_0xbbd6('0x3b')](_0x5803e4);if(_0x17a487){return BPromise[_0xbbd6('0x2b')]({'id':_0x17a487['Id'],'name':_0x17a487[_0xbbd6('0x2c')],'phone':_0x17a487[_0xbbd6('0x3c')],'endUserType':_0x17a487[_0xbbd6('0x3d')][_0xbbd6('0x3e')][_0xbbd6('0x3f')]()});}}})[_0xbbd6('0x27')](function(_0x491124){if(_0x491124){logger[_0xbbd6('0x29')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x491124['endUserType'],_0x5f831a);return BPromise['resolve'](_0x491124);}else{logger['info'](_0xbbd6('0x40'),_0x5f831a);var _0x5f252b={'Phone':_0x5f831a};if(_0x524440['moduleCreate']){if(_0x524440[_0xbbd6('0x41')]===_0xbbd6('0x16')){logger[_0xbbd6('0x29')](_0xbbd6('0x42'),_0x5f831a,_0x524440[_0xbbd6('0x41')]);_0x5f252b[_0xbbd6('0x43')]=_0x25d699!==_0xbbd6('0x44')?_0x25d699:util[_0xbbd6('0x45')](_0xbbd6('0x46'),_0x5f831a);}else if(_0x524440[_0xbbd6('0x41')]==='lead'){logger[_0xbbd6('0x29')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5f831a,_0x524440['moduleCreate']);_0x5f252b[_0xbbd6('0x43')]=_0x25d699!==_0xbbd6('0x44')?_0x25d699:util[_0xbbd6('0x45')](_0xbbd6('0x46'),_0x5f831a);_0x5f252b[_0xbbd6('0x47')]=_0xbbd6('0x48');}else if(_0x524440[_0xbbd6('0x41')]===_0xbbd6('0x1a')){logger[_0xbbd6('0x29')](_0xbbd6('0x42'),_0x5f831a,_0x524440[_0xbbd6('0x41')]);_0x5f252b[_0xbbd6('0x2c')]=_0x25d699!==_0xbbd6('0x44')?_0x25d699:util[_0xbbd6('0x45')](_0xbbd6('0x46'),_0x5f831a);}else{return null;}}return _0x238ddc[_0xbbd6('0x24')](_['upperFirst'](_0x524440[_0xbbd6('0x41')]))[_0xbbd6('0x21')](_0x5f252b)['then'](function(_0x155924){return BPromise[_0xbbd6('0x2b')]({'id':_0x155924['id'],'endUserType':_0x524440[_0xbbd6('0x41')]});});}});}function getCustomFields(_0x64be46,_0x34d3ec){var _0x100901={};if(_0x64be46[_0xbbd6('0x28')]>0x0){_['forEach'](_0x64be46,function(_0x546c54){if(_[_0xbbd6('0x49')](['string','picklist'],_0x546c54['type'])&&_0x546c54[_0xbbd6('0x4a')]){_0x100901[_0x546c54[_0xbbd6('0x4a')]]=_0x546c54[_0xbbd6('0x4b')][_0xbbd6('0x4c')]();}else if(_0x546c54[_0xbbd6('0x3e')]===_0xbbd6('0x4d')&&_0x546c54['variableName']&&_0x546c54[_0xbbd6('0x4a')]){_0x34d3ec[_0x546c54[_0xbbd6('0x4e')]]&&(_0x100901[_0x546c54['idField']]=_0x34d3ec[_0x546c54[_0xbbd6('0x4e')]]['toString']());}else if(_0x546c54[_0xbbd6('0x3e')]===_0xbbd6('0x4f')&&_0x546c54['Variable']&&_0x546c54[_0xbbd6('0x50')][_0xbbd6('0x51')]&&_0x546c54[_0xbbd6('0x4a')]){_0x34d3ec[_0x546c54[_0xbbd6('0x50')][_0xbbd6('0x51')][_0xbbd6('0x3f')]()]&&(_0x100901[_0x546c54[_0xbbd6('0x4a')]]=_0x34d3ec[_0x546c54[_0xbbd6('0x50')][_0xbbd6('0x51')][_0xbbd6('0x3f')]()][_0xbbd6('0x4c')]());}});}return _0x100901;}function getConnection(_0x2c24e8){var _0x6f6d0c=_0x2c24e8['password'][_0xbbd6('0x52')](_0x2c24e8[_0xbbd6('0x53')]);var _0x252f51=new jsforce[(_0xbbd6('0x54'))]({'oauth2':{'loginUrl':_0x2c24e8['remoteUri']||_0xbbd6('0x55'),'clientId':_0x2c24e8[_0xbbd6('0x56')],'clientSecret':_0x2c24e8[_0xbbd6('0x57')]}});return _0x252f51['login'](_0x2c24e8[_0xbbd6('0x58')],_0x6f6d0c)['then'](function(){logger[_0xbbd6('0x29')]('Connection\x20established.');return _0x252f51;});}exports[_0xbbd6('0x59')]=function(_0x45c1f0,_0xf6c2cf,_0x4c78c1,_0x278134,_0x2f7d15,_0x268fe0){var _0x42a9ec,_0x30aef1,_0x4e3344,_0x36255c;_0x268fe0[_0xbbd6('0x5a')]=intUtil['stripTrailingSlash'](_0x268fe0[_0xbbd6('0x5a')]);_0x268fe0[_0xbbd6('0x5b')]=intUtil['stripTrailingSlash'](_0x268fe0['remoteUri']);if(_0x2f7d15&&_0x2f7d15[_0xbbd6('0x5c')]){logger[_0xbbd6('0x29')]('[QUEUE]','Recording\x20is\x20enabled!');_0xf6c2cf[_0xbbd6('0x5d')]=util[_0xbbd6('0x45')](_0xbbd6('0x5e'),_0x268fe0['serverUrl'],_0xf6c2cf['uniqueid'],md5(_0xf6c2cf[_0xbbd6('0x5f')]));}else{_0xf6c2cf[_0xbbd6('0x5d')]='';}return getConnection(_0x268fe0)[_0xbbd6('0x27')](function(_0x2527d1){_0x36255c=_0x2527d1;return getUser(_0x268fe0,_0x278134[_0xbbd6('0x60')],_0x36255c);})[_0xbbd6('0x27')](function(_0x388a1b){_0x42a9ec=_0x388a1b;return getEndUser(_0x268fe0,_0x4c78c1,_0xf6c2cf[_0xbbd6('0x61')],_0xf6c2cf[_0xbbd6('0x62')],_0x36255c);})['then'](function(_0x36ef42){_0x30aef1=_0x36ef42;return getTicket(_0x268fe0,_0x42a9ec,_0x30aef1,_0x4c78c1,_0xf6c2cf,_0x4c78c1[_0xbbd6('0x63')],_0x36255c,'queue');})[_0xbbd6('0x27')](function(_0xc2125f){_0x4e3344=_0xc2125f;logger[_0xbbd6('0x29')](_0xbbd6('0x64'),_0x4e3344['id']);logger['info'](_0xbbd6('0x65'),_0x4e3344['id'],_0x278134[_0xbbd6('0x51')],_0x268fe0['type']);switch(_0x268fe0[_0xbbd6('0x3e')]){case _0xbbd6('0x66'):emit(util[_0xbbd6('0x45')](_0xbbd6('0x67'),_0x278134[_0xbbd6('0x51')]),_0xbbd6('0x68'),{'recordId':_0x4e3344['id']});break;case'newTab':emit(util['format']('user:%s',_0x278134[_0xbbd6('0x51')]),_0xbbd6('0x69'),{'uri':util[_0xbbd6('0x45')]('%s/%s/e',_0x36255c[_0xbbd6('0x6a')],_0x4e3344['id'])});break;default:logger[_0xbbd6('0x6b')](_0xbbd6('0x6c'));}})['catch'](function(_0x538506){logger[_0xbbd6('0x6b')]('[QUEUE]',_0x538506);});};exports[_0xbbd6('0x6d')]=function(_0x1096bc,_0x13b921,_0x2d14ea,_0x31d309,_0x3ee718,_0x1e05ea,_0x5c49dc){var _0x4ed16d,_0xaa86a9,_0x5c7b0e,_0x509576;_0x1e05ea[_0xbbd6('0x5a')]=intUtil['stripTrailingSlash'](_0x1e05ea[_0xbbd6('0x5a')]);_0x1e05ea[_0xbbd6('0x5b')]=intUtil['stripTrailingSlash'](_0x1e05ea['remoteUri']);if(_0x5c49dc&&_0x5c49dc['recordingFormat']&&_0x5c49dc[_0xbbd6('0x6e')]!==_0xbbd6('0x6f')){logger[_0xbbd6('0x29')](_0xbbd6('0x70'),_0xbbd6('0x71'));_0x13b921[_0xbbd6('0x5d')]=util[_0xbbd6('0x45')](_0xbbd6('0x5e'),_0x1e05ea[_0xbbd6('0x5a')],_0x13b921[_0xbbd6('0x5f')],md5(_0x13b921[_0xbbd6('0x5f')]));}return getConnection(_0x1e05ea)['then'](function(_0x420b51){_0x509576=_0x420b51;return getUser(_0x1e05ea,_0x31d309[_0xbbd6('0x60')],_0x509576);})[_0xbbd6('0x27')](function(_0x2baafa){_0x4ed16d=_0x2baafa;return getEndUser(_0x1e05ea,_0x2d14ea,_0x13b921[_0xbbd6('0x72')],_0x13b921['destcalleridnum'],_0x509576);})[_0xbbd6('0x27')](function(_0x404765){_0xaa86a9=_0x404765;return getTicket(_0x1e05ea,_0x4ed16d,_0xaa86a9,_0x2d14ea,_0x13b921,_0x2d14ea[_0xbbd6('0x63')],_0x509576,_0xbbd6('0x6d'));})[_0xbbd6('0x27')](function(_0x2bbb29){_0x5c7b0e=_0x2bbb29;logger[_0xbbd6('0x29')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x5c7b0e['id']);logger[_0xbbd6('0x29')](_0xbbd6('0x73'),_0x5c7b0e['id'],_0x31d309[_0xbbd6('0x51')],_0x1e05ea['type']);switch(_0x1e05ea[_0xbbd6('0x3e')]){case'integrationTab':emit(util[_0xbbd6('0x45')](_0xbbd6('0x67'),_0x31d309[_0xbbd6('0x51')]),'trigger:salesforce:display',{'recordId':_0x5c7b0e['id']});break;case _0xbbd6('0x74'):emit(util[_0xbbd6('0x45')](_0xbbd6('0x67'),_0x31d309[_0xbbd6('0x51')]),_0xbbd6('0x69'),{'uri':util[_0xbbd6('0x45')](_0xbbd6('0x75'),_0x509576['instanceUrl'],_0x5c7b0e['id'])});break;default:logger[_0xbbd6('0x6b')](_0xbbd6('0x70'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xbbd6('0x76')](function(_0x4ab58c){logger[_0xbbd6('0x6b')]('[OUTBOUND]',_0x4ab58c);});};exports['unmanaged']=function(_0x1cad3c,_0x2fa247,_0x1d5cfd,_0x3f9505,_0x4c5a2d,_0x14b643){var _0x44caad,_0x506afd,_0x4254ec,_0x59b0f4;_0x14b643[_0xbbd6('0x5a')]=intUtil[_0xbbd6('0x77')](_0x14b643[_0xbbd6('0x5a')]);_0x14b643['remoteUri']=intUtil[_0xbbd6('0x77')](_0x14b643['remoteUri']);if(_0x4c5a2d&&_0x4c5a2d[_0xbbd6('0x5c')]){logger[_0xbbd6('0x29')]('['+_0x2fa247[_0xbbd6('0x78')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x2fa247[_0xbbd6('0x5d')]=util['format'](_0xbbd6('0x5e'),_0x14b643[_0xbbd6('0x5a')],_0x2fa247[_0xbbd6('0x5f')],md5(_0x2fa247[_0xbbd6('0x5f')]));}else{_0x2fa247[_0xbbd6('0x5d')]='';}return getConnection(_0x14b643)['then'](function(_0x24af81){_0x59b0f4=_0x24af81;if(!_['isNil'](_0x3f9505)){return getUser(_0x14b643,_0x3f9505['name'],_0x59b0f4);}else{return getUser(_0x14b643,null,_0x59b0f4);}})[_0xbbd6('0x27')](function(_0x117779){_0x44caad=_0x117779;return getEndUser(_0x14b643,_0x1d5cfd,_0x2fa247[_0xbbd6('0x61')],_0x2fa247['calleridnum'],_0x59b0f4);})[_0xbbd6('0x27')](function(_0x299e39){_0x506afd=_0x299e39;return getTicket(_0x14b643,_0x44caad,_0x506afd,_0x1d5cfd,_0x2fa247,_0x1d5cfd[_0xbbd6('0x63')],_0x59b0f4);})[_0xbbd6('0x27')](function(_0xc7c81a){_0x4254ec=_0xc7c81a;logger[_0xbbd6('0x29')]('['+_0x2fa247['lastevent']['toUpperCase']()+_0xbbd6('0x79'),_0x4254ec['id']);logger[_0xbbd6('0x29')]('['+_0x2fa247[_0xbbd6('0x78')]['toUpperCase']()+_0xbbd6('0x7a'),_0x14b643[_0xbbd6('0x3e')]);})[_0xbbd6('0x76')](function(_0x558454){logger[_0xbbd6('0x6b')]('['+_0x2fa247[_0xbbd6('0x78')]['toUpperCase']()+']',_0x558454);});}; \ No newline at end of file +var _0xacb3=['IsReminderSet','IsRecurrence','endUserType','contact','WhoId','account','Case','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','ticketType','validateEmail','sobject','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','merge','Lead','additionalSearchAccount','Account','first','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Caller\x20-\x20%s','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%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.','integrationTab','user:%s','trigger:salesforce:display','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','trigger:browser:url','%s/%s/e','[OUTBOUND]','catch','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','moment','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','Subjects','getString','Descriptions','ActivityDate','utc'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xacb3,0x1f1));var _0x3acb=function(_0x406d39,_0xd3c8f1){_0x406d39=_0x406d39-0x0;var _0x2eb792=_0xacb3[_0x406d39];return _0x2eb792;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0x3acb('0x0'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0x3acb('0x1'));var util=require(_0x3acb('0x2'));var Redis=require(_0x3acb('0x3'));var intUtil=require(_0x3acb('0x4'));var config=require(_0x3acb('0x5'));var logger=require(_0x3acb('0x6'))(_0x3acb('0x7'));config[_0x3acb('0x8')]=_[_0x3acb('0x9')](config[_0x3acb('0x8')],{'host':_0x3acb('0xa'),'port':0x18eb});var io=require(_0x3acb('0xb'))(new Redis(config[_0x3acb('0x8')]));function emit(_0x5b09a2,_0x491bc5,_0x5a69b9){io['to'](_0x5b09a2)[_0x3acb('0xc')](_0x491bc5,_0x5a69b9);}function getTicket(_0x464f49,_0x1c9b5d,_0x541c4f,_0x2bec82,_0x846e74,_0x102c87,_0x203d32,_0x17fbca){var _0x4394f4=Object[_0x3acb('0xd')]({},{'OwnerId':_0x1c9b5d['id'],'Subject':intUtil['getString'](_0x2bec82[_0x3acb('0xe')],_0x846e74,'\x20'),'Description':intUtil[_0x3acb('0xf')](_0x2bec82[_0x3acb('0x10')],_0x846e74,'\x0a')},getCustomFields(_0x102c87,_0x846e74));if(_0x541c4f){if(_0x2bec82['ticketType']==='Task'){_0x4394f4[_0x3acb('0x11')]=moment[_0x3acb('0x12')]();_0x4394f4[_0x3acb('0x13')]=![];_0x4394f4[_0x3acb('0x14')]=![];if(_0x541c4f[_0x3acb('0x15')]===_0x3acb('0x16')||_0x541c4f[_0x3acb('0x15')]==='lead'){_0x4394f4[_0x3acb('0x17')]=_0x541c4f['id'];}else if(_0x541c4f[_0x3acb('0x15')]===_0x3acb('0x18')){_0x4394f4['WhatId']=_0x541c4f['id'];}}else if(_0x2bec82['ticketType']===_0x3acb('0x19')){if(_0x541c4f[_0x3acb('0x15')]==='contact'){_0x4394f4[_0x3acb('0x1a')]=_0x541c4f['id'];}else if(_0x541c4f[_0x3acb('0x15')]===_0x3acb('0x18')){_0x4394f4[_0x3acb('0x1b')]=_0x541c4f['id'];}else if(_0x541c4f[_0x3acb('0x15')]===_0x3acb('0x1c')&&_0x2bec82[_0x3acb('0x1d')]){_0x4394f4[_0x2bec82[_0x3acb('0x1d')]]=_0x541c4f['id'];}else{logger[_0x3acb('0x1e')](_0x3acb('0x1f'));}}}return _0x203d32['sobject'](_0x2bec82[_0x3acb('0x20')])['create'](_0x4394f4);}function getUser(_0x13d980,_0x2e74da,_0x43ed3a){if(!_['isNil'](_0x2e74da)&&intUtil[_0x3acb('0x21')](_0x2e74da)){var _0xee0d4a={'Email':_0x2e74da};var _0x5c5330={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x43ed3a[_0x3acb('0x22')](_0x3acb('0x23'))[_0x3acb('0x24')](_0xee0d4a,_0x5c5330)[_0x3acb('0x25')]()[_0x3acb('0x26')](function(_0x4b140c){if(_0x4b140c[_0x3acb('0x27')]){var _0x684157=_[_0x3acb('0x24')](_0x4b140c,function(_0x53d23c){return _0x53d23c[_0x3acb('0x28')]===_0x2e74da;});if(_0x684157){logger[_0x3acb('0x1e')](_0x3acb('0x29'),_0x2e74da);return BPromise[_0x3acb('0x2a')]({'id':_0x684157['Id'],'name':_0x684157[_0x3acb('0x2b')]});}}else{logger['info'](_0x3acb('0x2c'),_0x2e74da);return _0x43ed3a[_0x3acb('0x2d')]()['then'](function(_0x598543){return BPromise[_0x3acb('0x2a')]({'id':_0x598543[_0x3acb('0x2e')],'name':_0x598543['display_name']});});}});}else{logger[_0x3acb('0x1e')](_0x3acb('0x2c'),_0x2e74da);return _0x43ed3a[_0x3acb('0x2d')]()['then'](function(_0x1d3568){return BPromise['resolve']({'id':_0x1d3568['user_id'],'name':_0x1d3568[_0x3acb('0x2f')]});});}}function getEndUser(_0x3f2b36,_0x279a6a,_0x3ce77d,_0x3f420d,_0x4adf19){var _0x1e0c89={'$or':{'Phone':_0x3f420d}};var _0x39840a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x3acb('0x26')](function(){logger[_0x3acb('0x1e')](_0x3acb('0x30'),_0x3f420d,_0x279a6a[_0x3acb('0x31')]);switch(_0x279a6a[_0x3acb('0x31')]){case _0x3acb('0x32'):var _0x451d62=_[_0x3acb('0x33')](_0x1e0c89);if(_0x279a6a[_0x3acb('0x34')]){var _0x3c6916={};_0x3c6916[_0x279a6a[_0x3acb('0x34')]]=_0x3f420d;_['merge'](_0x451d62[_0x3acb('0x35')],_0x3c6916);}return _0x4adf19['sobject'](_0x3acb('0x36'))[_0x3acb('0x24')](_0x451d62,_0x39840a)[_0x3acb('0x25')]()[_0x3acb('0x26')](function(_0x387706){if(_0x387706&&_0x387706[_0x3acb('0x27')]){return _0x387706;}else{var _0x4bf265=_['cloneDeep'](_0x1e0c89);if(_0x279a6a['additionalSearchLead']){var _0x54c6b4={};_0x54c6b4[_0x279a6a[_0x3acb('0x37')]]=_0x3f420d;_[_0x3acb('0x38')](_0x4bf265['$or'],_0x54c6b4);}return _0x4adf19[_0x3acb('0x22')](_0x3acb('0x39'))[_0x3acb('0x24')](_0x4bf265,_0x39840a);}});case'account_contact_lead':var _0x5c1f14=_[_0x3acb('0x33')](_0x1e0c89);if(_0x279a6a['additionalSearchAccount']){var _0x3c6916={};_0x3c6916[_0x279a6a[_0x3acb('0x3a')]]=_0x3f420d;_['merge'](_0x5c1f14[_0x3acb('0x35')],_0x3c6916);}return _0x4adf19['sobject'](_0x3acb('0x3b'))[_0x3acb('0x24')](_0x5c1f14,_0x39840a)[_0x3acb('0x25')]()[_0x3acb('0x26')](function(_0x2fa0ec){if(_0x2fa0ec&&_0x2fa0ec[_0x3acb('0x27')]){return _0x2fa0ec;}else{var _0x1c9881=_[_0x3acb('0x33')](_0x1e0c89);if(_0x279a6a[_0x3acb('0x34')]){var _0x43cfce={};_0x43cfce[_0x279a6a['additionalSearchContact']]=_0x3f420d;_[_0x3acb('0x38')](_0x1c9881['$or'],_0x43cfce);}return _0x4adf19[_0x3acb('0x22')](_0x3acb('0x36'))[_0x3acb('0x24')](_0x1c9881,_0x39840a)['then'](function(_0x2b80e7){if(_0x2b80e7&&_0x2b80e7[_0x3acb('0x27')]){return _0x2b80e7;}else{var _0x2ce320=_[_0x3acb('0x33')](_0x1e0c89);if(_0x279a6a[_0x3acb('0x37')]){var _0x1e54f7={};_0x1e54f7[_0x279a6a[_0x3acb('0x37')]]=_0x3f420d;_[_0x3acb('0x38')](_0x2ce320[_0x3acb('0x35')],_0x1e54f7);}return _0x4adf19[_0x3acb('0x22')](_0x3acb('0x39'))['find'](_0x2ce320,_0x39840a);}});}});case _0x3acb('0x16'):var _0x451d62=_[_0x3acb('0x33')](_0x1e0c89);if(_0x279a6a[_0x3acb('0x34')]){var _0x3c6916={};_0x3c6916[_0x279a6a[_0x3acb('0x34')]]=_0x3f420d;_['merge'](_0x451d62[_0x3acb('0x35')],_0x3c6916);}return _0x4adf19[_0x3acb('0x22')](_0x3acb('0x36'))['find'](_0x451d62,_0x39840a)[_0x3acb('0x25')]();case _0x3acb('0x1c'):var _0x28cda4=_[_0x3acb('0x33')](_0x1e0c89);if(_0x279a6a[_0x3acb('0x37')]){var _0x3c6916={};_0x3c6916[_0x279a6a[_0x3acb('0x37')]]=_0x3f420d;_['merge'](_0x28cda4[_0x3acb('0x35')],_0x3c6916);}return _0x4adf19['sobject'](_0x3acb('0x39'))[_0x3acb('0x24')](_0x28cda4,_0x39840a);case'account':var _0x5c1f14=_[_0x3acb('0x33')](_0x1e0c89);if(_0x279a6a[_0x3acb('0x3a')]){var _0x3c6916={};_0x3c6916[_0x279a6a['additionalSearchAccount']]=_0x3f420d;_['merge'](_0x5c1f14[_0x3acb('0x35')],_0x3c6916);}return _0x4adf19[_0x3acb('0x22')]('Account')[_0x3acb('0x24')](_0x5c1f14,_0x39840a);default:return null;}})[_0x3acb('0x26')](function(_0x21e52f){if(_0x21e52f&&_0x21e52f[_0x3acb('0x27')]){var _0x26062c=_[_0x3acb('0x3c')](_0x21e52f);if(_0x26062c){return BPromise['resolve']({'id':_0x26062c['Id'],'name':_0x26062c['Name'],'phone':_0x26062c['Phone'],'endUserType':_0x26062c[_0x3acb('0x3d')][_0x3acb('0x3e')][_0x3acb('0x3f')]()});}}})[_0x3acb('0x26')](function(_0x1a2bd6){if(_0x1a2bd6){logger['info']('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x1a2bd6[_0x3acb('0x15')],_0x3f420d);return BPromise[_0x3acb('0x2a')](_0x1a2bd6);}else{logger['info'](_0x3acb('0x40'),_0x3f420d);var _0x3c17e9={'Phone':_0x3f420d};if(_0x279a6a['moduleCreate']){if(_0x279a6a['moduleCreate']===_0x3acb('0x16')){logger[_0x3acb('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3f420d,_0x279a6a[_0x3acb('0x41')]);_0x3c17e9[_0x3acb('0x42')]=_0x3ce77d!==_0x3acb('0x43')?_0x3ce77d:util[_0x3acb('0x44')](_0x3acb('0x45'),_0x3f420d);}else if(_0x279a6a[_0x3acb('0x41')]===_0x3acb('0x1c')){logger[_0x3acb('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3f420d,_0x279a6a[_0x3acb('0x41')]);_0x3c17e9['LastName']=_0x3ce77d!==''?_0x3ce77d:util[_0x3acb('0x44')]('Caller\x20-\x20%s',_0x3f420d);_0x3c17e9['Company']=_0x3acb('0x46');}else if(_0x279a6a[_0x3acb('0x41')]==='account'){logger[_0x3acb('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3f420d,_0x279a6a[_0x3acb('0x41')]);_0x3c17e9[_0x3acb('0x2b')]=_0x3ce77d!==_0x3acb('0x43')?_0x3ce77d:util[_0x3acb('0x44')](_0x3acb('0x45'),_0x3f420d);}else{return null;}}return _0x4adf19[_0x3acb('0x22')](_[_0x3acb('0x47')](_0x279a6a[_0x3acb('0x41')]))['create'](_0x3c17e9)[_0x3acb('0x26')](function(_0x332c5b){return BPromise[_0x3acb('0x2a')]({'id':_0x332c5b['id'],'endUserType':_0x279a6a[_0x3acb('0x41')]});});}});}function getCustomFields(_0x21d8c4,_0xe66a9c){var _0x150c18={};if(_0x21d8c4[_0x3acb('0x27')]>0x0){_[_0x3acb('0x48')](_0x21d8c4,function(_0x5c163a){if(_[_0x3acb('0x49')]([_0x3acb('0x4a'),_0x3acb('0x4b')],_0x5c163a[_0x3acb('0x3e')])&&_0x5c163a[_0x3acb('0x4c')]){_0x150c18[_0x5c163a[_0x3acb('0x4c')]]=_0x5c163a[_0x3acb('0x4d')][_0x3acb('0x4e')]();}else if(_0x5c163a['type']===_0x3acb('0x4f')&&_0x5c163a['variableName']&&_0x5c163a[_0x3acb('0x4c')]){_0xe66a9c[_0x5c163a[_0x3acb('0x50')]]&&(_0x150c18[_0x5c163a[_0x3acb('0x4c')]]=_0xe66a9c[_0x5c163a[_0x3acb('0x50')]][_0x3acb('0x4e')]());}else if(_0x5c163a[_0x3acb('0x3e')]===_0x3acb('0x51')&&_0x5c163a[_0x3acb('0x52')]&&_0x5c163a[_0x3acb('0x52')][_0x3acb('0x53')]&&_0x5c163a[_0x3acb('0x4c')]){_0xe66a9c[_0x5c163a[_0x3acb('0x52')][_0x3acb('0x53')][_0x3acb('0x3f')]()]&&(_0x150c18[_0x5c163a[_0x3acb('0x4c')]]=_0xe66a9c[_0x5c163a[_0x3acb('0x52')][_0x3acb('0x53')][_0x3acb('0x3f')]()][_0x3acb('0x4e')]());}});}return _0x150c18;}function getConnection(_0x4b4941){var _0x4049c1=_0x4b4941[_0x3acb('0x54')][_0x3acb('0x55')](_0x4b4941[_0x3acb('0x56')]);var _0x1c6c75=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4b4941[_0x3acb('0x57')]||_0x3acb('0x58'),'clientId':_0x4b4941[_0x3acb('0x59')],'clientSecret':_0x4b4941[_0x3acb('0x5a')]}});return _0x1c6c75[_0x3acb('0x5b')](_0x4b4941[_0x3acb('0x5c')],_0x4049c1)[_0x3acb('0x26')](function(){logger[_0x3acb('0x1e')](_0x3acb('0x5d'));return _0x1c6c75;});}exports[_0x3acb('0x5e')]=function(_0x5358fe,_0x367567,_0x4924aa,_0xafe31,_0xbc2132,_0x412f8d){var _0x984e6e,_0x483d51,_0x4dc6c3,_0x514ece;_0x412f8d['serverUrl']=intUtil['stripTrailingSlash'](_0x412f8d[_0x3acb('0x5f')]);_0x412f8d[_0x3acb('0x57')]=intUtil[_0x3acb('0x60')](_0x412f8d['remoteUri']);if(_0xbc2132&&_0xbc2132['monitor_format']){logger['info'](_0x3acb('0x61'),_0x3acb('0x62'));_0x367567[_0x3acb('0x63')]=util['format'](_0x3acb('0x64'),_0x412f8d['serverUrl'],_0x367567[_0x3acb('0x65')],md5(_0x367567[_0x3acb('0x65')]));}else{_0x367567[_0x3acb('0x63')]='';}return getConnection(_0x412f8d)[_0x3acb('0x26')](function(_0x4a5c82){_0x514ece=_0x4a5c82;return getUser(_0x412f8d,_0xafe31[_0x3acb('0x66')],_0x514ece);})[_0x3acb('0x26')](function(_0x220afe){_0x984e6e=_0x220afe;return getEndUser(_0x412f8d,_0x4924aa,_0x367567[_0x3acb('0x67')],_0x367567[_0x3acb('0x68')],_0x514ece);})['then'](function(_0x2c6663){_0x483d51=_0x2c6663;return getTicket(_0x412f8d,_0x984e6e,_0x483d51,_0x4924aa,_0x367567,_0x4924aa[_0x3acb('0x69')],_0x514ece,_0x3acb('0x5e'));})[_0x3acb('0x26')](function(_0x2f6817){_0x4dc6c3=_0x2f6817;logger['info'](_0x3acb('0x6a'),_0x4dc6c3['id']);logger[_0x3acb('0x1e')](_0x3acb('0x6b'),_0x4dc6c3['id'],_0xafe31['name'],_0x412f8d['type']);switch(_0x412f8d[_0x3acb('0x3e')]){case _0x3acb('0x6c'):emit(util[_0x3acb('0x44')](_0x3acb('0x6d'),_0xafe31[_0x3acb('0x53')]),_0x3acb('0x6e'),{'recordId':_0x4dc6c3['id']});break;case'newTab':emit(util['format'](_0x3acb('0x6d'),_0xafe31[_0x3acb('0x53')]),'trigger:browser:url',{'uri':util[_0x3acb('0x44')]('%s/%s/e',_0x514ece['instanceUrl'],_0x4dc6c3['id'])});break;default:logger[_0x3acb('0x6f')](_0x3acb('0x70'));}})['catch'](function(_0x1a5189){logger[_0x3acb('0x6f')](_0x3acb('0x61'),_0x1a5189);});};exports[_0x3acb('0x71')]=function(_0x4743e3,_0x249666,_0x5baa68,_0x220158,_0x4c0ad9,_0x1b495d,_0x2bfe83){var _0x3f3480,_0xd07870,_0x25201d,_0x56af6a;_0x1b495d['serverUrl']=intUtil[_0x3acb('0x60')](_0x1b495d[_0x3acb('0x5f')]);_0x1b495d[_0x3acb('0x57')]=intUtil[_0x3acb('0x60')](_0x1b495d[_0x3acb('0x57')]);if(_0x2bfe83&&_0x2bfe83['recordingFormat']&&_0x2bfe83[_0x3acb('0x72')]!=='none'){logger['info']('[OUTBOUND]',_0x3acb('0x62'));_0x249666[_0x3acb('0x63')]=util[_0x3acb('0x44')](_0x3acb('0x64'),_0x1b495d[_0x3acb('0x5f')],_0x249666[_0x3acb('0x65')],md5(_0x249666['uniqueid']));}return getConnection(_0x1b495d)['then'](function(_0x28fb56){_0x56af6a=_0x28fb56;return getUser(_0x1b495d,_0x220158['email'],_0x56af6a);})[_0x3acb('0x26')](function(_0x5a31ad){_0x3f3480=_0x5a31ad;return getEndUser(_0x1b495d,_0x5baa68,_0x249666[_0x3acb('0x73')],_0x249666[_0x3acb('0x74')],_0x56af6a);})[_0x3acb('0x26')](function(_0x4df98d){_0xd07870=_0x4df98d;return getTicket(_0x1b495d,_0x3f3480,_0xd07870,_0x5baa68,_0x249666,_0x5baa68[_0x3acb('0x69')],_0x56af6a,_0x3acb('0x71'));})[_0x3acb('0x26')](function(_0x24698d){_0x25201d=_0x24698d;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x25201d['id']);logger[_0x3acb('0x1e')](_0x3acb('0x75'),_0x25201d['id'],_0x220158[_0x3acb('0x53')],_0x1b495d[_0x3acb('0x3e')]);switch(_0x1b495d[_0x3acb('0x3e')]){case _0x3acb('0x6c'):emit(util['format'](_0x3acb('0x6d'),_0x220158[_0x3acb('0x53')]),_0x3acb('0x6e'),{'recordId':_0x25201d['id']});break;case _0x3acb('0x76'):emit(util[_0x3acb('0x44')](_0x3acb('0x6d'),_0x220158[_0x3acb('0x53')]),_0x3acb('0x77'),{'uri':util[_0x3acb('0x44')](_0x3acb('0x78'),_0x56af6a['instanceUrl'],_0x25201d['id'])});break;default:logger[_0x3acb('0x6f')](_0x3acb('0x79'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x3acb('0x7a')](function(_0x27c051){logger[_0x3acb('0x6f')]('[OUTBOUND]',_0x27c051);});};exports[_0x3acb('0x7b')]=function(_0x5dc673,_0x3f9838,_0x406304,_0x172eb2,_0x2e8fab,_0xa5c07){var _0x1dc0c1,_0x52094f,_0x355a3c,_0x37527e;_0xa5c07[_0x3acb('0x5f')]=intUtil[_0x3acb('0x60')](_0xa5c07['serverUrl']);_0xa5c07['remoteUri']=intUtil[_0x3acb('0x60')](_0xa5c07[_0x3acb('0x57')]);if(_0x2e8fab&&_0x2e8fab[_0x3acb('0x7c')]){logger['info']('['+_0x3f9838[_0x3acb('0x7d')][_0x3acb('0x7e')]()+']',_0x3acb('0x62'));_0x3f9838['recordingURL']=util[_0x3acb('0x44')](_0x3acb('0x64'),_0xa5c07[_0x3acb('0x5f')],_0x3f9838['uniqueid'],md5(_0x3f9838['uniqueid']));}else{_0x3f9838[_0x3acb('0x63')]='';}return getConnection(_0xa5c07)[_0x3acb('0x26')](function(_0xfe391d){_0x37527e=_0xfe391d;if(!_['isNil'](_0x172eb2)){return getUser(_0xa5c07,_0x172eb2['name'],_0x37527e);}else{return getUser(_0xa5c07,null,_0x37527e);}})[_0x3acb('0x26')](function(_0x27f303){_0x1dc0c1=_0x27f303;return getEndUser(_0xa5c07,_0x406304,_0x3f9838[_0x3acb('0x67')],_0x3f9838[_0x3acb('0x68')],_0x37527e);})[_0x3acb('0x26')](function(_0x4e053b){_0x52094f=_0x4e053b;return getTicket(_0xa5c07,_0x1dc0c1,_0x52094f,_0x406304,_0x3f9838,_0x406304[_0x3acb('0x69')],_0x37527e);})[_0x3acb('0x26')](function(_0x316047){_0x355a3c=_0x316047;logger[_0x3acb('0x1e')]('['+_0x3f9838[_0x3acb('0x7d')][_0x3acb('0x7e')]()+_0x3acb('0x7f'),_0x355a3c['id']);logger[_0x3acb('0x1e')]('['+_0x3f9838[_0x3acb('0x7d')]['toUpperCase']()+_0x3acb('0x80'),_0xa5c07[_0x3acb('0x3e')]);})[_0x3acb('0x7a')](function(_0x4fd2ad){logger['error']('['+_0x3f9838[_0x3acb('0x7d')][_0x3acb('0x7e')]()+']',_0x4fd2ad);});}; \ 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 76d2701..2d65a8d 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 _0x2032=['[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','bluebird','request-promise','util','ioredis','./util','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','adminId','message','info','toUpperCase','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','sys_id','adminEmail','],\x20getUser\x20crm','catch','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20createEndUser\x20crm','length','includes','string','picklist','customField','toLowerCase','content','toString','type','idField','variable','variableName','customVariable','Variable','name','outbound','incident','assign','getString','Fields','ticketId','label','label_entry','Incident','Incident\x20-\x20','ticketNumber','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x370fb2,_0x25157b){var _0x423d58=function(_0x35d98d){while(--_0x35d98d){_0x370fb2['push'](_0x370fb2['shift']());}};_0x423d58(++_0x25157b);}(_0x2032,0xd9));var _0x2203=function(_0x1d1abe,_0x247721){_0x1d1abe=_0x1d1abe-0x0;var _0x46e700=_0x2032[_0x1d1abe];return _0x46e700;};'use strict';var _=require('lodash');var Promise=require(_0x2203('0x0'));var rp=require(_0x2203('0x1'));var util=require(_0x2203('0x2'));var md5=require('md5');var Redis=require(_0x2203('0x3'));var intUtil=require(_0x2203('0x4'));var config=require('../../../../config/environment');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));config[_0x2203('0x7')]=_[_0x2203('0x8')](config[_0x2203('0x7')],{'host':_0x2203('0x9'),'port':0x18eb});var io=require(_0x2203('0xa'))(new Redis(config[_0x2203('0x7')]));function getAdminUser(_0x18c4d6,_0x2049ff,_0x2999ed,_0x5ecf9e,_0x526ae0,_0x10f055){return new Promise(function(_0x549908,_0x27081c){var _0x2972f3={'method':_0x2203('0xb'),'uri':_0x5ecf9e+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x526ae0+'&'+_0x10f055,'auth':_0x2049ff,'json':!![]};return rp(_0x2972f3)[_0x2203('0xc')](function(_0x4a6832){if(_0x4a6832[_0x2203('0xd')]['length']>0x0){_0x2999ed[_0x2203('0xe')]=_0x4a6832[_0x2203('0xd')][0x0]['sys_id'];}logger['info']('['+[_0x18c4d6['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x2999ed);_0x549908(_0x2999ed);})['catch'](function(_0x238772){logger['error']('['+[_0x18c4d6['toUpperCase']()]+']',_0x238772[_0x2203('0xf')]);_0x27081c(_0x238772[_0x2203('0xf')]);});});}function getUser(_0x1c1ead,_0x41af85,_0x226209,_0x3fe0a8,_0x2c36e6){return function(_0x2c085c){logger[_0x2203('0x10')]('['+[_0x1c1ead[_0x2203('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x2c085c);return new Promise(function(_0x280eda,_0x2ee127){if(intUtil['validateEmail'](_0x2c085c[_0x2203('0x12')])){var _0x8906e1={'method':'GET','uri':_0x226209+_0x2203('0x13')+_0x2c085c['userEmail']+'&'+_0x3fe0a8+'&'+_0x2c36e6,'auth':_0x41af85,'json':!![]};logger[_0x2203('0x10')]('['+[_0x1c1ead[_0x2203('0x11')]()]+_0x2203('0x14'),_0x8906e1);return rp(_0x8906e1)[_0x2203('0xc')](function(_0x15cb1a){logger[_0x2203('0x10')]('['+[_0x1c1ead['toUpperCase']()]+_0x2203('0x15'),_0x15cb1a);if(_0x15cb1a['result']['length']>0x0&&String(_0x15cb1a[_0x2203('0xd')][0x0]['active'])===_0x2203('0x16')){_0x2c085c[_0x2203('0x17')]=_0x15cb1a['result'][0x0][_0x2203('0x18')];}else{_0x2c085c['userId']=_0x2c085c['adminId'];_0x2c085c[_0x2203('0x12')]=_0x2c085c[_0x2203('0x19')];}logger[_0x2203('0x10')]('['+[_0x1c1ead[_0x2203('0x11')]()]+_0x2203('0x1a'),_0x2c085c);_0x280eda(_0x2c085c);})[_0x2203('0x1b')](function(_0x49c12){logger[_0x2203('0x1c')]('['+[_0x1c1ead['toUpperCase']()]+']',_0x49c12[_0x2203('0xf')]);_0x2ee127(_0x49c12[_0x2203('0xf')]);});}else{logger[_0x2203('0x10')]('['+[_0x1c1ead['toUpperCase']()]+_0x2203('0x1d'));_0x2c085c[_0x2203('0x17')]=_0x2c085c['adminId'];_0x2c085c[_0x2203('0x12')]=_0x2c085c[_0x2203('0x19')];_0x280eda(_0x2c085c);}});};}function createEndUser(_0x1c6a77,_0x46b8b9,_0x28ae02,_0x1df508,_0x9c53f){logger['info']('['+[_0x1c6a77[_0x2203('0x11')]()]+_0x2203('0x1e'),_0x28ae02);return new Promise(function(_0x406ce9,_0x74f035){var _0x52a426={'method':_0x2203('0x1f'),'uri':_0x1df508+_0x2203('0x20')+_0x9c53f,'body':{'user_name':_0x28ae02[_0x2203('0x21')],'roles':_0x2203('0x22'),'first_name':_0x28ae02['endUserNumber'],'active':_0x2203('0x16'),'date_format':_0x2203('0x23'),'phone':_0x28ae02['endUserNumber']},'auth':_0x46b8b9,'json':!![]};return rp(_0x52a426)['then'](function(_0x1d5f74){logger['info']('['+[_0x1c6a77['toUpperCase']()]+_0x2203('0x24'),_0x1d5f74[_0x2203('0xd')]);_0x28ae02[_0x2203('0x25')]=_0x1d5f74[_0x2203('0xd')][_0x2203('0x18')];_0x406ce9(_0x28ae02);})['catch'](function(_0xb22e28){logger[_0x2203('0x1c')]('['+[_0x1c6a77['toUpperCase']()]+']',_0xb22e28[_0x2203('0xf')]);_0x74f035(_0xb22e28[_0x2203('0xf')]);});});}function getEndUser(_0x9a335d,_0x4187b4,_0x43fee1,_0x24d138,_0x29da55){return function(_0x44228e){logger[_0x2203('0x10')]('['+[_0x9a335d['toUpperCase']()]+_0x2203('0x26'),_0x44228e);return new Promise(function(_0x347d3e,_0x56f9b2){var _0x54b90b={'method':_0x2203('0xb'),'uri':_0x43fee1+'sys_user?sysparm_query=phone%3D'+_0x44228e[_0x2203('0x21')]+'&'+_0x24d138+'&'+_0x29da55,'auth':_0x4187b4,'json':!![]};return rp(_0x54b90b)[_0x2203('0xc')](function(_0x127ee3){if(_0x127ee3['result']['length']>0x0){_0x44228e[_0x2203('0x25')]=_0x127ee3['result'][0x0][_0x2203('0x18')];logger['info']('['+[_0x9a335d[_0x2203('0x11')]()]+'],\x20getEndUser\x20crm',_0x44228e);_0x347d3e(_0x44228e);}else{return createEndUser(_0x9a335d,_0x4187b4,_0x44228e,_0x43fee1,_0x24d138)[_0x2203('0xc')](function(_0x13ed9e){logger[_0x2203('0x10')]('['+[_0x9a335d[_0x2203('0x11')]()]+_0x2203('0x27'),_0x13ed9e);_0x347d3e(_0x13ed9e);});}})['catch'](function(_0x5f1561){logger['error']('['+[_0x9a335d[_0x2203('0x11')]()]+']',_0x5f1561[_0x2203('0xf')]);_0x56f9b2(_0x5f1561[_0x2203('0xf')]);});});};}function getCustomFields(_0x3b0c7a,_0x3283fb){var _0x3b250a={};if(_0x3b0c7a[_0x2203('0x28')]>0x0){_['forEach'](_0x3b0c7a,function(_0x175945){if(_[_0x2203('0x29')]([_0x2203('0x2a'),_0x2203('0x2b')],_0x175945['type'])&&_0x175945['nameField']&&!_0x175945[_0x2203('0x2c')]){_0x3b250a[_0x175945['nameField'][_0x2203('0x2d')]()]=_0x175945[_0x2203('0x2e')][_0x2203('0x2f')]();}else if(_['includes'](['string',_0x2203('0x2b')],_0x175945[_0x2203('0x30')])&&_0x175945[_0x2203('0x31')]&&_0x175945[_0x2203('0x2c')]){_0x3b250a[_0x175945[_0x2203('0x31')][_0x2203('0x2d')]()]=_0x175945['content'][_0x2203('0x2f')]();}else if(_0x175945[_0x2203('0x30')]===_0x2203('0x32')&&_0x175945[_0x2203('0x33')]&&_0x175945[_0x2203('0x31')]&&_0x175945[_0x2203('0x2c')]){_0x3b250a[_0x175945[_0x2203('0x31')][_0x2203('0x2d')]()]=_0x3283fb[_0x175945[_0x2203('0x33')]][_0x2203('0x2f')]();}else if(_0x175945['type']===_0x2203('0x34')&&_0x175945[_0x2203('0x35')]&&_0x175945[_0x2203('0x35')][_0x2203('0x36')]&&_0x175945['idField']&&_0x175945['customField']){_0x3b250a[_0x175945[_0x2203('0x31')]['toLowerCase']()]=_0x3283fb[_0x175945[_0x2203('0x35')][_0x2203('0x36')][_0x2203('0x2d')]()][_0x2203('0x2f')]();}});}return _0x3b250a;}function getTicket(_0x594148,_0x289146,_0x102803,_0x5cd8c6,_0x29bd91,_0x381b3e){return function(_0x35b2e9){logger[_0x2203('0x10')]('['+[_0x594148['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0x35b2e9);return new Promise(function(_0x21b8ab,_0x5707c8){var _0x543fde=_0x594148[_0x2203('0x2d')]()===_0x2203('0x37')?_0x35b2e9[_0x2203('0x17')]:_0x35b2e9['endUserId'];var _0x4c1496={'method':_0x2203('0x1f'),'uri':_0x102803+_0x2203('0x38')+'?'+_0x381b3e,'body':Object[_0x2203('0x39')]({},{'active':_0x2203('0x16'),'caller_id':_0x543fde,'assigned_to':_0x35b2e9[_0x2203('0x17')],'short_description':intUtil[_0x2203('0x3a')](_0x5cd8c6['Subjects'],_0x29bd91,'\x20'),'description':intUtil[_0x2203('0x3a')](_0x5cd8c6['Descriptions'],_0x29bd91,'\x0a')},getCustomFields(_0x5cd8c6[_0x2203('0x3b')],_0x29bd91)),'auth':_0x289146,'json':!![]};return rp(_0x4c1496)[_0x2203('0xc')](function(_0x246aff){logger[_0x2203('0x10')]('['+[_0x594148['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0x246aff[_0x2203('0xd')]);_0x35b2e9[_0x2203('0x3c')]=_0x246aff[_0x2203('0xd')][_0x2203('0x18')];_0x35b2e9['ticketNumber']=_0x246aff['result']['number'];logger[_0x2203('0x10')]('['+[_0x594148[_0x2203('0x11')]()]+']\x20getTicket\x20crm',_0x35b2e9);_0x21b8ab(_0x35b2e9);})[_0x2203('0x1b')](function(_0x267627){logger['error']('['+[_0x594148[_0x2203('0x11')]()]+']',_0x267627[_0x2203('0xf')]);_0x5707c8(_0x267627[_0x2203('0xf')]);});});};}function createRemoteTag(_0x6a1877,_0x4bb6f1,_0x120db1,_0x5268d6){return new Promise(function(_0x3858f0,_0x1de713){var _0x4ee8cf={'method':_0x2203('0x1f'),'uri':_0x120db1+_0x2203('0x3d')+'?'+_0x5268d6,'body':{'short_description':_0x6a1877,'global':!![],'active':!![],'name':_0x6a1877},'auth':_0x4bb6f1,'json':!![]};return rp(_0x4ee8cf)[_0x2203('0xc')](function(_0x378132){var _0x3f335a=_0x378132[_0x2203('0xd')]['sys_id'];_0x3858f0(_0x3f335a);});});}function getRemoteTag(_0x562a3d,_0x2f2537,_0x524356,_0x56e881,_0xfddc3b){return new Promise(function(_0x33e5eb,_0x14e5d9){var _0x542296={'method':_0x2203('0xb'),'uri':_0x524356+'label'+'?sysparm_query=name%3D'+_0x562a3d+'&'+_0x56e881,'auth':_0x2f2537,'json':!![]};return rp(_0x542296)[_0x2203('0xc')](function(_0x5be4b6){if(_0x5be4b6['result']['length']>0x0){var _0x13526f=_0x5be4b6[_0x2203('0xd')][0x0][_0x2203('0x18')];_0x33e5eb(_0x13526f);}else{return createRemoteTag(_0x562a3d,_0x2f2537,_0x524356,_0x56e881)[_0x2203('0xc')](function(_0x26d3d9){_0x33e5eb(_0x26d3d9);});}});});}function assignTagToIncident(_0x32f593,_0x2baea2,_0x91f70c,_0x36b5fb,_0x216641){return new Promise(function(_0x384a59,_0x10d88b){var _0x58ff57={'method':'POST','uri':_0x91f70c+_0x2203('0x3e')+'?'+_0x216641,'body':{'label':_0x32f593,'table':_0x2203('0x38'),'id_type':_0x2203('0x3f'),'table_key':_0x36b5fb[_0x2203('0x3c')],'title':_0x2203('0x40')+_0x36b5fb[_0x2203('0x41')],'id_display':_0x36b5fb['ticketNumber']},'auth':_0x2baea2,'json':!![]};return rp(_0x58ff57)['then'](function(_0xb49120){_0x384a59();})[_0x2203('0x1b')](function(){_0x384a59();});});}function manageTags(_0x21ee59,_0x1e6d21,_0xcab922,_0x7b0b9c,_0x133d22,_0x191b67,_0x2c6bcc){return new Promise(function(_0x135272,_0x134908){var _0x48bed1=[];_0x1e6d21[_0x2203('0x42')](function(_0x3ae12e){_0x48bed1[_0x2203('0x43')](getRemoteTag(_0x3ae12e,_0xcab922,_0x7b0b9c,_0x191b67,_0x2c6bcc));});return Promise[_0x2203('0x44')](_0x48bed1)[_0x2203('0xc')](function(_0x44e7ab){if(_0x44e7ab[_0x2203('0x28')]){logger[_0x2203('0x10')]('['+[_0x21ee59[_0x2203('0x11')]()]+_0x2203('0x45'),_0x44e7ab);var _0x49e795=[];_0x44e7ab[_0x2203('0x42')](function(_0x3795e6){_0x49e795[_0x2203('0x43')](assignTagToIncident(_0x3795e6,_0xcab922,_0x7b0b9c,_0x133d22,_0x191b67));});return Promise[_0x2203('0x44')](_0x49e795)[_0x2203('0xc')](function(){_0x135272();})[_0x2203('0x1b')](function(){_0x135272();});}else{_0x135272();}});});}function getTags(_0x1068bc,_0x8a9282,_0x2015b1,_0x519120,_0x468619,_0x3d0285){return function(_0x465898){return new Promise(function(_0x4e461e,_0x68855d){var _0x3f73e1=[];var _0x1b4f96=_0x519120[_0x2203('0x46')];if(_0x1b4f96&&_0x1b4f96[_0x2203('0x28')]>0x0){_0x3f73e1=_['map'](_0x1b4f96,_0x2203('0x36'));}if(_0x3f73e1[_0x2203('0x28')]>0x0){return manageTags(_0x1068bc,_0x3f73e1,_0x8a9282,_0x2015b1,_0x465898,_0x468619,_0x3d0285)[_0x2203('0xc')](function(){_0x4e461e(_0x465898);});}else{_0x4e461e(_0x465898);}});};}function emit(_0x4dde80,_0x5507b6,_0x5d9ae2){var _0x485e5b='%26sysparm_record_target%3Dincident'+_0x2203('0x47')+_0x2203('0x48')+_0x2203('0x49');var _0x145c59={'uri':_0x4dde80+_0x2203('0x4a')+_0x5d9ae2+_0x485e5b};io['to'](util[_0x2203('0x4b')](_0x2203('0x4c'),_0x5507b6))[_0x2203('0x4d')]('trigger:browser:url',_0x145c59);}exports['cs']=function(_0x500860,_0xb54e51,_0x8f8648,_0xafcc82,_0x93742d,_0x1bbd2d,_0x32a348,_0x45cc3a){var _0x3f06d2={};var _0x450f1d={'user':_0x1bbd2d[_0x2203('0x4e')],'pass':_0x1bbd2d[_0x2203('0x4f')]};var _0xf16e1d=_0x2203('0x50');var _0xae45a5=_0x2203('0x51');_0x1bbd2d[_0x2203('0x52')]=intUtil[_0x2203('0x53')](_0x1bbd2d[_0x2203('0x52')]);_0x1bbd2d[_0x2203('0x54')]=intUtil['stripTrailingSlash'](_0x1bbd2d[_0x2203('0x54')]);var _0x5f4b14=util[_0x2203('0x4b')]('%s/api/now/table/',_0x1bbd2d[_0x2203('0x52')]);_0x3f06d2[_0x2203('0x12')]=!_[_0x2203('0x55')](_0xafcc82)?_0xafcc82[_0x2203('0x56')]:null;_0x3f06d2[_0x2203('0x19')]=_0x1bbd2d[_0x2203('0x56')];_0x3f06d2[_0x2203('0x21')]=_0x45cc3a[_0x2203('0x2d')]()==='outbound'?_0xb54e51['destcalleridnum']:_0xb54e51[_0x2203('0x57')];_0x3f06d2[_0x2203('0x58')]=_0x45cc3a===_0x2203('0x59')||_0x45cc3a==='unmanaged'?'queue':'outbound';var _0xdff006=util[_0x2203('0x4b')](_0x2203('0x5a'),_0x1bbd2d[_0x2203('0x54')],_0xb54e51['uniqueid'],md5(_0xb54e51[_0x2203('0x5b')]));if(_0x93742d&&_0x93742d['monitor_format']){logger[_0x2203('0x10')](_0x2203('0x5c'),_0x2203('0x5d'));_0xb54e51[_0x2203('0x5e')]=_0xdff006;}else if(_0x32a348&&_0x32a348[_0x2203('0x5f')]&&_0x32a348['recordingFormat']!==_0x2203('0x60')){logger[_0x2203('0x10')](_0x2203('0x61'),'Recording\x20is\x20enabled!');_0xb54e51[_0x2203('0x5e')]=_0xdff006;}else{_0xb54e51[_0x2203('0x5e')]='';}return getAdminUser(_0x45cc3a,_0x450f1d,_0x3f06d2,_0x5f4b14,_0xae45a5,_0xf16e1d)[_0x2203('0xc')](getUser(_0x45cc3a,_0x450f1d,_0x5f4b14,_0xae45a5,_0xf16e1d))[_0x2203('0xc')](getEndUser(_0x45cc3a,_0x450f1d,_0x5f4b14,_0xae45a5,_0xf16e1d))[_0x2203('0xc')](getTicket(_0x45cc3a,_0x450f1d,_0x5f4b14,_0x8f8648,_0xb54e51,_0xae45a5))[_0x2203('0xc')](function(_0x1a2b7c){logger[_0x2203('0x10')](util[_0x2203('0x4b')](_0x2203('0x62'),_0x1a2b7c[_0x2203('0x3c')]));logger['info'](util[_0x2203('0x4b')](_0x2203('0x63'),_0x45cc3a));if(_0x45cc3a!==_0x2203('0x64')){logger[_0x2203('0x10')]('['+[_0x45cc3a[_0x2203('0x11')]()]+']',_0x2203('0x65'));emit(_0x1bbd2d[_0x2203('0x52')],_0xafcc82[_0x2203('0x36')],_0x1a2b7c[_0x2203('0x3c')]);}})[_0x2203('0x1b')](function(_0x1210c5){logger[_0x2203('0x1c')]('['+[_0x45cc3a['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x2203('0x66')](_0x1210c5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7708=['picklist','type','nameField','toString','customField','idField','content','variable','variableName','toLowerCase','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign','getString','Subjects','Fields','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','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','user:%s','trigger:browser:url','username','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','inspect','lodash','bluebird','util','../../../../config/logger','servicenow','defaults','localhost','socket.io-emitter','redis','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','sys_id','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','user','endUserNumber','System','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string'];(function(_0x384452,_0x5ebb37){var _0x1d8a9d=function(_0x167e3e){while(--_0x167e3e){_0x384452['push'](_0x384452['shift']());}};_0x1d8a9d(++_0x5ebb37);}(_0x7708,0x188));var _0x8770=function(_0x2ee790,_0x5a8661){_0x2ee790=_0x2ee790-0x0;var _0x5a54a5=_0x7708[_0x2ee790];return _0x5a54a5;};'use strict';var _=require(_0x8770('0x0'));var Promise=require(_0x8770('0x1'));var rp=require('request-promise');var util=require(_0x8770('0x2'));var md5=require('md5');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x8770('0x3'))(_0x8770('0x4'));config['redis']=_[_0x8770('0x5')](config['redis'],{'host':_0x8770('0x6'),'port':0x18eb});var io=require(_0x8770('0x7'))(new Redis(config[_0x8770('0x8')]));function getAdminUser(_0x20e293,_0x212b12,_0x3e1113,_0x2d4a1d,_0x4fc512,_0x396322){return new Promise(function(_0x2ca830,_0x3f357a){var _0x4e4551={'method':_0x8770('0x9'),'uri':_0x2d4a1d+_0x8770('0xa')+'&'+_0x4fc512+'&'+_0x396322,'auth':_0x212b12,'json':!![]};return rp(_0x4e4551)[_0x8770('0xb')](function(_0x3d81ab){if(_0x3d81ab['result'][_0x8770('0xc')]>0x0){_0x3e1113[_0x8770('0xd')]=_0x3d81ab[_0x8770('0xe')][0x0]['sys_id'];}logger[_0x8770('0xf')]('['+[_0x20e293[_0x8770('0x10')]()]+_0x8770('0x11'),_0x3e1113);_0x2ca830(_0x3e1113);})[_0x8770('0x12')](function(_0x2f2571){logger[_0x8770('0x13')]('['+[_0x20e293[_0x8770('0x10')]()]+']',_0x2f2571[_0x8770('0x14')]);_0x3f357a(_0x2f2571['message']);});});}function getUser(_0x1d15d6,_0x106a20,_0x5dd4e7,_0x2f7918,_0x52254f){return function(_0x1c8ab6){logger['info']('['+[_0x1d15d6['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x1c8ab6);return new Promise(function(_0x155e83,_0x3b459a){if(intUtil[_0x8770('0x15')](_0x1c8ab6[_0x8770('0x16')])){var _0x4b0691={'method':'GET','uri':_0x5dd4e7+_0x8770('0x17')+_0x1c8ab6[_0x8770('0x16')]+'&'+_0x2f7918+'&'+_0x52254f,'auth':_0x106a20,'json':!![]};logger[_0x8770('0xf')]('['+[_0x1d15d6[_0x8770('0x10')]()]+_0x8770('0x18'),_0x4b0691);return rp(_0x4b0691)['then'](function(_0x3e1fe7){logger[_0x8770('0xf')]('['+[_0x1d15d6[_0x8770('0x10')]()]+_0x8770('0x19'),_0x3e1fe7);if(_0x3e1fe7['result']['length']>0x0&&String(_0x3e1fe7[_0x8770('0xe')][0x0][_0x8770('0x1a')])===_0x8770('0x1b')){_0x1c8ab6[_0x8770('0x1c')]=_0x3e1fe7[_0x8770('0xe')][0x0][_0x8770('0x1d')];}else{_0x1c8ab6['userId']=_0x1c8ab6[_0x8770('0xd')];_0x1c8ab6[_0x8770('0x16')]=_0x1c8ab6[_0x8770('0x1e')];}logger[_0x8770('0xf')]('['+[_0x1d15d6['toUpperCase']()]+_0x8770('0x1f'),_0x1c8ab6);_0x155e83(_0x1c8ab6);})['catch'](function(_0x7b4755){logger[_0x8770('0x13')]('['+[_0x1d15d6[_0x8770('0x10')]()]+']',_0x7b4755[_0x8770('0x14')]);_0x3b459a(_0x7b4755[_0x8770('0x14')]);});}else{logger[_0x8770('0xf')]('['+[_0x1d15d6[_0x8770('0x10')]()]+_0x8770('0x20'));_0x1c8ab6[_0x8770('0x1c')]=_0x1c8ab6[_0x8770('0xd')];_0x1c8ab6['userEmail']=_0x1c8ab6[_0x8770('0x1e')];_0x155e83(_0x1c8ab6);}});};}function createEndUser(_0x199b96,_0x1df627,_0x5c7bd,_0x246128,_0x200a82){logger['info']('['+[_0x199b96['toUpperCase']()]+_0x8770('0x21'),_0x5c7bd);return new Promise(function(_0x11de6e,_0x22f0b0){var _0x365080={'method':_0x8770('0x22'),'uri':_0x246128+'sys_user?'+_0x200a82,'body':{'user_name':_0x5c7bd['endUserNumber'],'roles':_0x8770('0x23'),'first_name':_0x5c7bd[_0x8770('0x24')],'active':_0x8770('0x1b'),'date_format':_0x8770('0x25'),'phone':_0x5c7bd['endUserNumber']},'auth':_0x1df627,'json':!![]};return rp(_0x365080)[_0x8770('0xb')](function(_0x501741){logger['info']('['+[_0x199b96[_0x8770('0x10')]()]+'],\x20EndUser\x20schema',_0x501741[_0x8770('0xe')]);_0x5c7bd[_0x8770('0x26')]=_0x501741[_0x8770('0xe')][_0x8770('0x1d')];_0x11de6e(_0x5c7bd);})[_0x8770('0x12')](function(_0x3862ad){logger[_0x8770('0x13')]('['+[_0x199b96[_0x8770('0x10')]()]+']',_0x3862ad[_0x8770('0x14')]);_0x22f0b0(_0x3862ad['message']);});});}function getEndUser(_0x971edb,_0xd35997,_0x1cfbf4,_0x5c627c,_0x5224ce){return function(_0x1b4b8f){logger[_0x8770('0xf')]('['+[_0x971edb[_0x8770('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0x1b4b8f);return new Promise(function(_0x157898,_0x59cb90){var _0x255746={'method':_0x8770('0x9'),'uri':_0x1cfbf4+_0x8770('0x27')+_0x1b4b8f[_0x8770('0x24')]+'&'+_0x5c627c+'&'+_0x5224ce,'auth':_0xd35997,'json':!![]};return rp(_0x255746)[_0x8770('0xb')](function(_0x25324c){if(_0x25324c[_0x8770('0xe')][_0x8770('0xc')]>0x0){_0x1b4b8f[_0x8770('0x26')]=_0x25324c[_0x8770('0xe')][0x0]['sys_id'];logger[_0x8770('0xf')]('['+[_0x971edb[_0x8770('0x10')]()]+_0x8770('0x28'),_0x1b4b8f);_0x157898(_0x1b4b8f);}else{return createEndUser(_0x971edb,_0xd35997,_0x1b4b8f,_0x1cfbf4,_0x5c627c)['then'](function(_0x37279b){logger[_0x8770('0xf')]('['+[_0x971edb[_0x8770('0x10')]()]+_0x8770('0x29'),_0x37279b);_0x157898(_0x37279b);});}})[_0x8770('0x12')](function(_0x3a50db){logger['error']('['+[_0x971edb[_0x8770('0x10')]()]+']',_0x3a50db['message']);_0x59cb90(_0x3a50db[_0x8770('0x14')]);});});};}function getCustomFields(_0x57f52e,_0x41134a){var _0x411c54={};if(_0x57f52e[_0x8770('0xc')]>0x0){_['forEach'](_0x57f52e,function(_0x13a909){if(_[_0x8770('0x2a')]([_0x8770('0x2b'),_0x8770('0x2c')],_0x13a909[_0x8770('0x2d')])&&_0x13a909[_0x8770('0x2e')]&&!_0x13a909['customField']){_0x411c54[_0x13a909[_0x8770('0x2e')]['toLowerCase']()]=_0x13a909['content'][_0x8770('0x2f')]();}else if(_[_0x8770('0x2a')]([_0x8770('0x2b'),_0x8770('0x2c')],_0x13a909[_0x8770('0x2d')])&&_0x13a909['idField']&&_0x13a909[_0x8770('0x30')]){_0x411c54[_0x13a909[_0x8770('0x31')]['toLowerCase']()]=_0x13a909[_0x8770('0x32')]['toString']();}else if(_0x13a909[_0x8770('0x2d')]===_0x8770('0x33')&&_0x13a909[_0x8770('0x34')]&&_0x13a909[_0x8770('0x31')]&&_0x13a909[_0x8770('0x30')]){_0x411c54[_0x13a909[_0x8770('0x31')][_0x8770('0x35')]()]=_0x41134a[_0x13a909[_0x8770('0x34')]][_0x8770('0x2f')]();}else if(_0x13a909[_0x8770('0x2d')]===_0x8770('0x36')&&_0x13a909['Variable']&&_0x13a909[_0x8770('0x37')][_0x8770('0x38')]&&_0x13a909[_0x8770('0x31')]&&_0x13a909[_0x8770('0x30')]){_0x411c54[_0x13a909[_0x8770('0x31')][_0x8770('0x35')]()]=_0x41134a[_0x13a909['Variable'][_0x8770('0x38')][_0x8770('0x35')]()][_0x8770('0x2f')]();}});}return _0x411c54;}function getTicket(_0x1c44bf,_0x76c319,_0x281f94,_0x165974,_0xe31cfb,_0x5cc8de){return function(_0x27b703){logger[_0x8770('0xf')]('['+[_0x1c44bf[_0x8770('0x10')]()]+_0x8770('0x39'),_0x27b703);return new Promise(function(_0x454496,_0x5d6bbe){var _0x5e49dc=_0x1c44bf[_0x8770('0x35')]()==='outbound'?_0x27b703[_0x8770('0x1c')]:_0x27b703['endUserId'];var _0x4f9e0b={'method':_0x8770('0x22'),'uri':_0x281f94+_0x8770('0x3a')+'?'+_0x5cc8de,'body':Object[_0x8770('0x3b')]({},{'active':_0x8770('0x1b'),'caller_id':_0x5e49dc,'assigned_to':_0x27b703['userId'],'short_description':intUtil[_0x8770('0x3c')](_0x165974[_0x8770('0x3d')],_0xe31cfb,'\x20'),'description':intUtil['getString'](_0x165974['Descriptions'],_0xe31cfb,'\x0a')},getCustomFields(_0x165974[_0x8770('0x3e')],_0xe31cfb)),'auth':_0x76c319,'json':!![]};return rp(_0x4f9e0b)[_0x8770('0xb')](function(_0x10890f){logger['info']('['+[_0x1c44bf[_0x8770('0x10')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x10890f[_0x8770('0xe')]);_0x27b703[_0x8770('0x3f')]=_0x10890f[_0x8770('0xe')]['sys_id'];_0x27b703[_0x8770('0x40')]=_0x10890f['result']['number'];logger['info']('['+[_0x1c44bf[_0x8770('0x10')]()]+_0x8770('0x41'),_0x27b703);_0x454496(_0x27b703);})[_0x8770('0x12')](function(_0x26b27c){logger[_0x8770('0x13')]('['+[_0x1c44bf[_0x8770('0x10')]()]+']',_0x26b27c['message']);_0x5d6bbe(_0x26b27c[_0x8770('0x14')]);});});};}function createRemoteTag(_0x56bf7b,_0x314e20,_0x3bcccc,_0x475e9d){return new Promise(function(_0x3e4f77,_0x5b5cce){var _0x1d17b7={'method':_0x8770('0x22'),'uri':_0x3bcccc+'label'+'?'+_0x475e9d,'body':{'short_description':_0x56bf7b,'global':!![],'active':!![],'name':_0x56bf7b},'auth':_0x314e20,'json':!![]};return rp(_0x1d17b7)['then'](function(_0x552cab){var _0x48f12c=_0x552cab[_0x8770('0xe')][_0x8770('0x1d')];_0x3e4f77(_0x48f12c);});});}function getRemoteTag(_0x5c772e,_0x471409,_0x38b68f,_0x435c23,_0x35340d){return new Promise(function(_0x217c9f,_0x2227fd){var _0x9c33dd={'method':_0x8770('0x9'),'uri':_0x38b68f+_0x8770('0x42')+_0x8770('0x43')+_0x5c772e+'&'+_0x435c23,'auth':_0x471409,'json':!![]};return rp(_0x9c33dd)[_0x8770('0xb')](function(_0x528f67){if(_0x528f67[_0x8770('0xe')][_0x8770('0xc')]>0x0){var _0x25dc3d=_0x528f67['result'][0x0][_0x8770('0x1d')];_0x217c9f(_0x25dc3d);}else{return createRemoteTag(_0x5c772e,_0x471409,_0x38b68f,_0x435c23)[_0x8770('0xb')](function(_0x2af03b){_0x217c9f(_0x2af03b);});}});});}function assignTagToIncident(_0x47e431,_0x2aecc0,_0xbe9c4c,_0x5b1548,_0x3a2070){return new Promise(function(_0x5c4277,_0x4b42b1){var _0x4e9fe5={'method':'POST','uri':_0xbe9c4c+_0x8770('0x44')+'?'+_0x3a2070,'body':{'label':_0x47e431,'table':_0x8770('0x3a'),'id_type':_0x8770('0x45'),'table_key':_0x5b1548[_0x8770('0x3f')],'title':_0x8770('0x46')+_0x5b1548[_0x8770('0x40')],'id_display':_0x5b1548[_0x8770('0x40')]},'auth':_0x2aecc0,'json':!![]};return rp(_0x4e9fe5)[_0x8770('0xb')](function(_0x535041){_0x5c4277();})[_0x8770('0x12')](function(){_0x5c4277();});});}function manageTags(_0x18a31d,_0x5cd7a1,_0x49295d,_0xe34666,_0x51bd21,_0x8e5aad,_0x6d7baf){return new Promise(function(_0x529359,_0x32d0d1){var _0x339d70=[];_0x5cd7a1[_0x8770('0x47')](function(_0x3cab84){_0x339d70[_0x8770('0x48')](getRemoteTag(_0x3cab84,_0x49295d,_0xe34666,_0x8e5aad,_0x6d7baf));});return Promise[_0x8770('0x49')](_0x339d70)[_0x8770('0xb')](function(_0x179df6){if(_0x179df6[_0x8770('0xc')]){logger[_0x8770('0xf')]('['+[_0x18a31d[_0x8770('0x10')]()]+_0x8770('0x4a'),_0x179df6);var _0x1dcb75=[];_0x179df6['forEach'](function(_0x2f3ae5){_0x1dcb75[_0x8770('0x48')](assignTagToIncident(_0x2f3ae5,_0x49295d,_0xe34666,_0x51bd21,_0x8e5aad));});return Promise[_0x8770('0x49')](_0x1dcb75)[_0x8770('0xb')](function(){_0x529359();})[_0x8770('0x12')](function(){_0x529359();});}else{_0x529359();}});});}function getTags(_0x6c24f7,_0x282b70,_0x6f549d,_0x396d47,_0x54cd82,_0xa4f4ce){return function(_0xaf7c89){return new Promise(function(_0x187c94,_0x4cd70a){var _0x2fb8b2=[];var _0x93d72a=_0x396d47['Tags'];if(_0x93d72a&&_0x93d72a[_0x8770('0xc')]>0x0){_0x2fb8b2=_[_0x8770('0x4b')](_0x93d72a,_0x8770('0x38'));}if(_0x2fb8b2[_0x8770('0xc')]>0x0){return manageTags(_0x6c24f7,_0x2fb8b2,_0x282b70,_0x6f549d,_0xaf7c89,_0x54cd82,_0xa4f4ce)[_0x8770('0xb')](function(){_0x187c94(_0xaf7c89);});}else{_0x187c94(_0xaf7c89);}});};}function emit(_0x5c7b88,_0x2e54ca,_0x4af913){var _0x2a45c8=_0x8770('0x4c')+_0x8770('0x4d')+_0x8770('0x4e')+_0x8770('0x4f');var _0x30a7c9={'uri':_0x5c7b88+_0x8770('0x50')+_0x4af913+_0x2a45c8};io['to'](util[_0x8770('0x51')](_0x8770('0x52'),_0x2e54ca))['emit'](_0x8770('0x53'),_0x30a7c9);}exports['cs']=function(_0x3fca1c,_0x305fa0,_0xdfefac,_0x2615ad,_0xe2ae6e,_0x11edd0,_0x1075cb,_0x3ad340){var _0x5bc91c={};var _0x5caef5={'user':_0x11edd0[_0x8770('0x54')],'pass':_0x11edd0['password']};var _0x20e51='sysparm_limit=1';var _0x49dc67='sysparm_display_value=true';_0x11edd0[_0x8770('0x55')]=intUtil[_0x8770('0x56')](_0x11edd0[_0x8770('0x55')]);_0x11edd0[_0x8770('0x57')]=intUtil[_0x8770('0x56')](_0x11edd0[_0x8770('0x57')]);var _0x19b2ed=util[_0x8770('0x51')](_0x8770('0x58'),_0x11edd0[_0x8770('0x55')]);_0x5bc91c[_0x8770('0x16')]=!_[_0x8770('0x59')](_0x2615ad)?_0x2615ad[_0x8770('0x5a')]:null;_0x5bc91c[_0x8770('0x1e')]=_0x11edd0[_0x8770('0x5a')];_0x5bc91c[_0x8770('0x24')]=_0x3ad340['toLowerCase']()===_0x8770('0x5b')?_0x305fa0[_0x8770('0x5c')]:_0x305fa0[_0x8770('0x5d')];_0x5bc91c[_0x8770('0x5e')]=_0x3ad340===_0x8770('0x5f')||_0x3ad340===_0x8770('0x60')?_0x8770('0x5f'):_0x8770('0x5b');var _0x2ab10c=util[_0x8770('0x51')](_0x8770('0x61'),_0x11edd0[_0x8770('0x57')],_0x305fa0[_0x8770('0x62')],md5(_0x305fa0['uniqueid']));if(_0xe2ae6e&&_0xe2ae6e[_0x8770('0x63')]){logger['info'](_0x8770('0x64'),_0x8770('0x65'));_0x305fa0['recordingURL']=_0x2ab10c;}else if(_0x1075cb&&_0x1075cb[_0x8770('0x66')]&&_0x1075cb[_0x8770('0x66')]!==_0x8770('0x67')){logger[_0x8770('0xf')](_0x8770('0x68'),_0x8770('0x65'));_0x305fa0[_0x8770('0x69')]=_0x2ab10c;}else{_0x305fa0['recordingURL']='';}return getAdminUser(_0x3ad340,_0x5caef5,_0x5bc91c,_0x19b2ed,_0x49dc67,_0x20e51)[_0x8770('0xb')](getUser(_0x3ad340,_0x5caef5,_0x19b2ed,_0x49dc67,_0x20e51))[_0x8770('0xb')](getEndUser(_0x3ad340,_0x5caef5,_0x19b2ed,_0x49dc67,_0x20e51))[_0x8770('0xb')](getTicket(_0x3ad340,_0x5caef5,_0x19b2ed,_0xdfefac,_0x305fa0,_0x49dc67))['then'](function(_0x42a413){logger[_0x8770('0xf')](util[_0x8770('0x51')](_0x8770('0x6a'),_0x42a413[_0x8770('0x3f')]));logger[_0x8770('0xf')](util[_0x8770('0x51')](_0x8770('0x6b'),_0x3ad340));if(_0x3ad340!==_0x8770('0x60')){logger[_0x8770('0xf')]('['+[_0x3ad340['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x11edd0[_0x8770('0x55')],_0x2615ad[_0x8770('0x38')],_0x42a413[_0x8770('0x3f')]);}})[_0x8770('0x12')](function(_0x5b930f){logger['error']('['+[_0x3ad340[_0x8770('0x10')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x8770('0x6c')](_0x5b930f,{'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 78c1102..61627c5 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 _0xaac7=['customVariable','Variable','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','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','trigger:browser:url','catch','error','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','[OUTBOUND]','unmanaged','monitor_format','lastevent','toUpperCase','isNil','calleridname','The\x20Enduser\x20ID\x20is:','lodash','request-promise','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','push','idField','variableName','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','user_name','resolve','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','forEach','string','nameField','customField','toLowerCase','content','type','custom_fields','toString','variable'];(function(_0x2cb679,_0x4e8b50){var _0x46d22e=function(_0x34971b){while(--_0x34971b){_0x2cb679['push'](_0x2cb679['shift']());}};_0x46d22e(++_0x4e8b50);}(_0xaac7,0x122));var _0x7aac=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0xaac7[_0x1e3671];return _0x48d5f5;};'use strict';var _=require(_0x7aac('0x0'));var rp=require(_0x7aac('0x1'));var BPromise=require(_0x7aac('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x7aac('0x3'));var intUtil=require(_0x7aac('0x4'));var config=require(_0x7aac('0x5'));var logger=require(_0x7aac('0x6'))(_0x7aac('0x7'));config[_0x7aac('0x8')]=_[_0x7aac('0x9')](config[_0x7aac('0x8')],{'host':_0x7aac('0xa'),'port':0x18eb});var io=require(_0x7aac('0xb'))(new Redis(config[_0x7aac('0x8')]));var def={'method':_0x7aac('0xc'),'json':!![]};function emit(_0x27a7b5,_0x486ee9,_0x14b28c){io['to'](_0x27a7b5)[_0x7aac('0xd')](_0x486ee9,_0x14b28c);}function getTicket(_0x1c4938,_0x31dd48,_0x270853,_0x11e0bb,_0x29b376,_0x5c1f14,_0x293c04,_0x42ed52){logger[_0x7aac('0xe')](_0x7aac('0xf'));var _0x3ebf14=new Date();var _0x564917=[{'name':_0x7aac('0x10'),'value':intUtil[_0x7aac('0x11')](_0x11e0bb[_0x7aac('0x12')],_0x29b376,'\x20')},{'name':_0x7aac('0x13'),'value':_0x31dd48['id']},{'name':'created_by','value':_0x31dd48['id']},{'name':_0x7aac('0x14'),'value':intUtil[_0x7aac('0x11')](_0x11e0bb[_0x7aac('0x15')],_0x29b376,'\x0a')},{'name':_0x7aac('0x16'),'value':_0x3ebf14[_0x7aac('0x17')]()['slice'](0x0,0x13)[_0x7aac('0x18')]('T','\x20')},{'name':_0x7aac('0x19'),'value':'0'},{'name':_0x7aac('0x1a'),'value':'15'},{'name':_0x7aac('0x1b'),'value':_0x270853['id']},{'name':_0x7aac('0x1c'),'value':_0x7aac('0x1d')},{'name':_0x7aac('0x1e'),'value':_0x270853[_0x7aac('0x10')]},{'name':_0x7aac('0x1f'),'value':_0x42ed52}];if(_0x5c1f14[_0x7aac('0x20')]){_['forEach'](_0x5c1f14,function(_0x40e4f4){if(_0x29b376[_0x40e4f4['variableName']]){_0x564917[_0x7aac('0x21')]({'name':_0x40e4f4[_0x7aac('0x22')],'value':_0x29b376[_0x40e4f4[_0x7aac('0x23')]]});}});}return request({'form':{'method':_0x7aac('0x24'),'input_type':_0x7aac('0x25'),'response_type':'JSON','rest_data':JSON[_0x7aac('0x26')]({'session':_0x293c04['id'],'module_name':_0x7aac('0x27'),'name_value_list':_0x564917})}});}function getAuth(_0xcbc650){return util[_0x7aac('0x28')](_0x7aac('0x29'),new Buffer(_0xcbc650[_0x7aac('0x2a')]+':X')['toString'](_0x7aac('0x2b')));}function getServerInfo(_0x27c9f3){return request({'form':{'method':_0x7aac('0x2c'),'input_type':_0x7aac('0x25'),'response_type':_0x7aac('0x25'),'rest_data':JSON[_0x7aac('0x26')]({'session':_0x27c9f3['id']})}});}function getUser(_0x3aaace,_0x537788,_0x782d46){if(!_['isNil'](_0x537788)){logger['info']('Getting\x20agent\x20with\x20name',_0x537788);return request({'form':{'method':_0x7aac('0x2d'),'input_type':_0x7aac('0x25'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x782d46['id'],'module_name':_0x7aac('0x2e'),'query':util[_0x7aac('0x28')](_0x7aac('0x2f'),_0x537788),'order_by':'','offset':'0','select_fields':['id',_0x7aac('0x10'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7aac('0x30')](function(_0x4cef2f){if(_0x4cef2f[_0x7aac('0x31')][_0x7aac('0x20')]){var _0x56cbca=_[_0x7aac('0x32')](_0x4cef2f[_0x7aac('0x31')],function(_0x532584){return _0x532584[_0x7aac('0x33')]['user_name'][_0x7aac('0x34')]===_0x537788;});if(_0x56cbca){logger['info'](_0x7aac('0x35'));return BPromise['resolve']({'id':_0x56cbca[_0x7aac('0x33')]['id'][_0x7aac('0x34')],'name':_0x56cbca[_0x7aac('0x33')]['name'][_0x7aac('0x34')]});}}logger['info'](_0x7aac('0x36'));return BPromise['resolve']({'id':_0x782d46['name_value_list'][_0x7aac('0x37')][_0x7aac('0x34')],'name':_0x782d46[_0x7aac('0x33')][_0x7aac('0x38')][_0x7aac('0x34')]});});}else{logger[_0x7aac('0xe')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x7aac('0x39')]({'id':_0x782d46[_0x7aac('0x33')][_0x7aac('0x37')][_0x7aac('0x34')],'name':_0x782d46[_0x7aac('0x33')][_0x7aac('0x38')][_0x7aac('0x34')]});}}function getEndUser(_0x413368,_0x4be09c,_0x498dfb,_0x12dfa4){logger['info'](_0x7aac('0x3a'),_0x498dfb);return request({'form':{'method':'get_entry_list','input_type':_0x7aac('0x25'),'response_type':_0x7aac('0x25'),'rest_data':JSON[_0x7aac('0x26')]({'session':_0x12dfa4['id'],'module_name':_0x7aac('0x1d'),'query':util[_0x7aac('0x28')](_0x7aac('0x3b'),_0x498dfb),'order_by':'','offset':'0','select_fields':['id',_0x7aac('0x10'),_0x7aac('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x36efd8){if(_0x36efd8[_0x7aac('0x31')][_0x7aac('0x20')]){var _0x58ccfd=_[_0x7aac('0x32')](_0x36efd8['entry_list'],function(_0x1381be){return _0x1381be[_0x7aac('0x33')][_0x7aac('0x3c')][_0x7aac('0x34')]===_0x498dfb;});if(_0x58ccfd){logger[_0x7aac('0xe')](_0x7aac('0x3d'));return BPromise[_0x7aac('0x39')]({'id':_0x58ccfd[_0x7aac('0x33')]['id'][_0x7aac('0x34')],'name':_0x58ccfd[_0x7aac('0x33')][_0x7aac('0x10')][_0x7aac('0x34')],'phone':_0x58ccfd[_0x7aac('0x33')][_0x7aac('0x3c')][_0x7aac('0x34')]});}}else{logger[_0x7aac('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x7aac('0x25'),'response_type':_0x7aac('0x25'),'rest_data':JSON[_0x7aac('0x26')]({'session':_0x12dfa4['id'],'module_name':_0x7aac('0x1d'),'name_value_list':[{'name':_0x7aac('0x3e'),'value':_0x4be09c!==_0x7aac('0x3f')?_0x4be09c:util['format'](_0x7aac('0x40'),_0x498dfb)},{'name':_0x7aac('0x3c'),'value':_0x498dfb}]})}})[_0x7aac('0x30')](function(_0x1705a3){logger[_0x7aac('0xe')](_0x7aac('0x41'));return BPromise[_0x7aac('0x39')]({'id':_0x1705a3['id'],'name':_0x1705a3['entry_list'][_0x7aac('0x3e')][_0x7aac('0x34')],'phone':_0x1705a3[_0x7aac('0x31')][_0x7aac('0x3c')][_0x7aac('0x34')]});});}});}function request(_0x89ff50){logger[_0x7aac('0x42')]('[HTTP]',JSON['stringify'](_0x89ff50));return rp(_[_0x7aac('0x43')](def,_0x89ff50));}function getTags(_0xdf94da,_0x44f987){var _0x1299db=[];if(_0xdf94da&&_0xdf94da[_0x7aac('0x20')]>0x0){_0x1299db=_[_0x7aac('0x44')](_0xdf94da,_0x44f987);}return _0x1299db;}function getCustomFields(_0x45517f,_0x729c32){var _0x1baaa2=[];var _0x1e8b0e={'custom_fields':[]};if(_0x45517f[_0x7aac('0x20')]>0x0){_[_0x7aac('0x45')](_0x45517f,function(_0x47bb0a){if(_0x47bb0a['type']===_0x7aac('0x46')&&_0x47bb0a[_0x7aac('0x47')]&&!_0x47bb0a[_0x7aac('0x48')]){_0x1e8b0e[_0x47bb0a[_0x7aac('0x47')][_0x7aac('0x49')]()]=_0x47bb0a[_0x7aac('0x4a')]['toString']();}else if(_0x47bb0a[_0x7aac('0x4b')]===_0x7aac('0x46')&&_0x47bb0a[_0x7aac('0x22')]&&_0x47bb0a[_0x7aac('0x48')]){_0x1e8b0e[_0x7aac('0x4c')][_0x7aac('0x21')]({'id':_0x47bb0a[_0x7aac('0x22')],'value':_0x47bb0a[_0x7aac('0x4a')][_0x7aac('0x4d')]()});}else if(_0x47bb0a['type']===_0x7aac('0x4e')&&_0x47bb0a['variableName']&&_0x47bb0a[_0x7aac('0x22')]&&_0x47bb0a[_0x7aac('0x48')]){_0x729c32[_0x47bb0a[_0x7aac('0x23')]]&&_0x1e8b0e[_0x7aac('0x4c')]['push']({'id':_0x47bb0a['idField'],'value':_0x729c32[_0x47bb0a[_0x7aac('0x23')]]['toString']()});}else if(_0x47bb0a[_0x7aac('0x4b')]===_0x7aac('0x4f')&&_0x47bb0a['Variable']&&_0x47bb0a[_0x7aac('0x50')][_0x7aac('0x10')]&&_0x47bb0a[_0x7aac('0x22')]&&_0x47bb0a['customField']){_0x729c32[_0x47bb0a['Variable']['name'][_0x7aac('0x49')]()]&&_0x1e8b0e[_0x7aac('0x4c')][_0x7aac('0x21')]({'id':_0x47bb0a[_0x7aac('0x22')],'value':_0x729c32[_0x47bb0a[_0x7aac('0x50')][_0x7aac('0x10')]['toLowerCase']()][_0x7aac('0x4d')]()});}});}return _0x1e8b0e;}function getConnection(_0x44d839){return request({'method':_0x7aac('0xc'),'form':{'method':'login','input_type':_0x7aac('0x25'),'response_type':'JSON','rest_data':JSON[_0x7aac('0x26')]({'user_auth':{'user_name':_0x44d839['username'],'password':_0x44d839['password'],'encryption':'PLAIN'},'application':_0x7aac('0x51')})}})[_0x7aac('0x30')](function(_0x32542c){var _0x45729c=_0x32542c;if(_0x45729c['id']){def['sessionID']=_0x45729c['id'];return BPromise[_0x7aac('0x39')](_0x45729c);}else{throw new Error(util[_0x7aac('0x28')](_0x7aac('0x52'),_0x44d839['id']));}});}function setRelationship(_0x16a6f9,_0x92724c,_0x679b09,_0x2ff84f){return request({'form':{'method':_0x7aac('0x53'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x7aac('0x26')]({'session':_0x16a6f9['id'],'module_name':'Calls','module_id':_0x679b09['id'],'link_field_name':_0x2ff84f,'related_ids':[_0x92724c['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x3b52af,_0x483118,_0x4e1b98,_0x4353bd,_0x115e4a,_0x57bf2c){var _0x122fec,_0x510f6b,_0x6875c1,_0x16c7f5;_0x57bf2c[_0x7aac('0x54')]=intUtil[_0x7aac('0x55')](_0x57bf2c[_0x7aac('0x54')]);_0x57bf2c['serverUrl']=intUtil['stripTrailingSlash'](_0x57bf2c['serverUrl']);def[_0x7aac('0x56')]=util[_0x7aac('0x28')](_0x7aac('0x57'),_0x57bf2c[_0x7aac('0x54')]);if(_0x115e4a&&_0x115e4a['monitor_format']){logger[_0x7aac('0xe')](_0x7aac('0x58'),_0x7aac('0x59'));_0x483118[_0x7aac('0x5a')]=util['format'](_0x7aac('0x5b'),_0x57bf2c[_0x7aac('0x5c')],_0x483118[_0x7aac('0x5d')],md5(_0x483118[_0x7aac('0x5d')]));}else{_0x483118[_0x7aac('0x5a')]='';}return getConnection(_0x57bf2c)[_0x7aac('0x30')](function(_0x2d9d1d){_0x16c7f5=_0x2d9d1d;return getUser(_0x57bf2c,_0x4353bd['name'],_0x16c7f5);})['then'](function(_0xf760ea){_0x122fec=_0xf760ea;logger['info'](_0x7aac('0x5e'),_0x122fec['id']);return getEndUser(_0x57bf2c,_0x483118['calleridname'],_0x483118[_0x7aac('0x5f')],_0x16c7f5);})[_0x7aac('0x30')](function(_0x63cc42){_0x510f6b=_0x63cc42;logger[_0x7aac('0xe')]('The\x20Enduser\x20ID\x20is:',_0x510f6b['id']);return getTicket(_0x57bf2c,_0x122fec,_0x510f6b,_0x4e1b98,_0x483118,_0x4e1b98['Fields'],_0x16c7f5,_0x7aac('0x60'));})[_0x7aac('0x30')](function(_0x2fa9ad){_0x6875c1=_0x2fa9ad;logger['info'](_0x7aac('0x61'));logger['info'](_0x7aac('0x62'),_0x6875c1['id']);return setRelationship(_0x16c7f5,_0x122fec,_0x6875c1,_0x7aac('0x63'));})[_0x7aac('0x30')](function(){return setRelationship(_0x16c7f5,_0x510f6b,_0x6875c1,_0x7aac('0x64'));})[_0x7aac('0x30')](function(){return getServerInfo(_0x16c7f5);})[_0x7aac('0x30')](function(_0x22ab49){var _0x3d9f19=parseInt(_0x22ab49[_0x7aac('0x65')][_0x7aac('0x66')](0x0));var _0x6e8cd3=util['format'](_0x7aac('0x67'),_0x57bf2c['remoteUri'],_0x6875c1['id']);if(_0x3d9f19>0x6){_0x6e8cd3=util['format'](_0x7aac('0x68'),_0x57bf2c['remoteUri'],_0x6875c1['id']);}logger[_0x7aac('0xe')](_0x7aac('0x58'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x4353bd[_0x7aac('0x10')]),_0x7aac('0x69'),{'uri':_0x6e8cd3});})[_0x7aac('0x6a')](function(_0x4a2ecd){logger[_0x7aac('0x6b')]('[QUEUE]',JSON[_0x7aac('0x26')](_0x4a2ecd));});};exports['outbound']=function(_0x416ee7,_0x8ebd2d,_0x149097,_0x4a1140,_0x27932f,_0x54c98d,_0xbc388f){var _0xf2ba7e,_0x16abbd,_0x29d759,_0x216a4e;_0x54c98d[_0x7aac('0x54')]=intUtil[_0x7aac('0x55')](_0x54c98d['remoteUri']);_0x54c98d[_0x7aac('0x5c')]=intUtil[_0x7aac('0x55')](_0x54c98d[_0x7aac('0x5c')]);def['uri']=util['format'](_0x7aac('0x57'),_0x54c98d['remoteUri']);if(_0xbc388f&&_0xbc388f[_0x7aac('0x6c')]&&_0xbc388f['recordingFormat']!==_0x7aac('0x6d')){logger[_0x7aac('0xe')]('[OUTBOUND]',_0x7aac('0x59'));_0x8ebd2d[_0x7aac('0x5a')]=util['format'](_0x7aac('0x5b'),_0x54c98d['serverUrl'],_0x8ebd2d[_0x7aac('0x5d')],md5(_0x8ebd2d[_0x7aac('0x5d')]));}return getConnection(_0x54c98d)[_0x7aac('0x30')](function(_0x14eafe){_0x216a4e=_0x14eafe;return getUser(_0x54c98d,_0x4a1140[_0x7aac('0x10')],_0x216a4e);})[_0x7aac('0x30')](function(_0x4fb603){_0xf2ba7e=_0x4fb603;logger[_0x7aac('0xe')](_0x7aac('0x5e'),_0xf2ba7e['id']);return getEndUser(_0x54c98d,_0x8ebd2d[_0x7aac('0x6e')],_0x8ebd2d[_0x7aac('0x6f')],_0x216a4e);})[_0x7aac('0x30')](function(_0x538985){_0x16abbd=_0x538985;logger[_0x7aac('0xe')]('The\x20Enduser\x20ID\x20is:',_0x16abbd['id']);return getTicket(_0x54c98d,_0xf2ba7e,_0x16abbd,_0x149097,_0x8ebd2d,_0x149097['Fields'],_0x216a4e,_0x7aac('0x70'));})[_0x7aac('0x30')](function(_0x2fa659){_0x29d759=_0x2fa659;logger[_0x7aac('0xe')]('Ticket\x20created!');logger[_0x7aac('0xe')]('The\x20Ticket\x20ID\x20is:',_0x29d759['id']);return setRelationship(_0x216a4e,_0xf2ba7e,_0x29d759,_0x7aac('0x63'));})[_0x7aac('0x30')](function(){return setRelationship(_0x216a4e,_0x16abbd,_0x29d759,'contacts');})['then'](function(){return getServerInfo(_0x216a4e);})[_0x7aac('0x30')](function(_0x321699){var _0x522094=parseInt(_0x321699[_0x7aac('0x65')][_0x7aac('0x66')](0x0));var _0xaa7ff6=util[_0x7aac('0x28')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x54c98d['remoteUri'],_0x29d759['id']);if(_0x522094>0x6){_0xaa7ff6=util[_0x7aac('0x28')](_0x7aac('0x68'),_0x54c98d[_0x7aac('0x54')],_0x29d759['id']);}logger[_0x7aac('0xe')]('[OUTBOUND]',_0x7aac('0x71'));emit(util[_0x7aac('0x28')](_0x7aac('0x72'),_0x4a1140[_0x7aac('0x10')]),'trigger:browser:url',{'uri':_0xaa7ff6});})[_0x7aac('0x6a')](function(_0x28a1c2){logger[_0x7aac('0x6b')](_0x7aac('0x73'),JSON[_0x7aac('0x26')](_0x28a1c2));});};exports[_0x7aac('0x74')]=function(_0x3d7b86,_0x2cd518,_0xfc5aa0,_0x43b206,_0x1e37de,_0x3d87d8){var _0x4137c7,_0x5762a0,_0x4bd0e4,_0x558f7d;_0x3d87d8['remoteUri']=intUtil[_0x7aac('0x55')](_0x3d87d8[_0x7aac('0x54')]);_0x3d87d8[_0x7aac('0x5c')]=intUtil[_0x7aac('0x55')](_0x3d87d8[_0x7aac('0x5c')]);def['uri']=util['format'](_0x7aac('0x57'),_0x3d87d8[_0x7aac('0x54')]);if(_0x1e37de&&_0x1e37de[_0x7aac('0x75')]){logger[_0x7aac('0xe')]('['+_0x2cd518[_0x7aac('0x76')][_0x7aac('0x77')]()+']','Recording\x20is\x20enabled!');_0x2cd518[_0x7aac('0x5a')]=util[_0x7aac('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3d87d8[_0x7aac('0x5c')],_0x2cd518[_0x7aac('0x5d')],md5(_0x2cd518[_0x7aac('0x5d')]));}else{_0x2cd518[_0x7aac('0x5a')]='';}return getConnection(_0x3d87d8)[_0x7aac('0x30')](function(_0xdace35){_0x558f7d=_0xdace35;if(!_[_0x7aac('0x78')](_0x43b206)){return getUser(_0x3d87d8,_0x43b206[_0x7aac('0x10')],_0x558f7d);}else{return getUser(_0x3d87d8,null,_0x558f7d);}})['then'](function(_0x1d6efe){_0x4137c7=_0x1d6efe;logger['info'](_0x7aac('0x5e'),_0x4137c7['id']);return getEndUser(_0x3d87d8,_0x2cd518[_0x7aac('0x79')],_0x2cd518[_0x7aac('0x5f')],_0x558f7d);})[_0x7aac('0x30')](function(_0x341351){_0x5762a0=_0x341351;logger['info'](_0x7aac('0x7a'),_0x5762a0['id']);return getTicket(_0x3d87d8,_0x4137c7,_0x5762a0,_0xfc5aa0,_0x2cd518,_0xfc5aa0['Fields'],_0x558f7d,_0x7aac('0x60'));})[_0x7aac('0x30')](function(_0x1b69c3){_0x4bd0e4=_0x1b69c3;logger[_0x7aac('0xe')](_0x7aac('0x61'));logger['info'](_0x7aac('0x62'),_0x4bd0e4['id']);return setRelationship(_0x558f7d,_0x4137c7,_0x4bd0e4,_0x7aac('0x63'));})['then'](function(){return setRelationship(_0x558f7d,_0x5762a0,_0x4bd0e4,_0x7aac('0x64'));})['then'](function(){return getServerInfo(_0x558f7d);})[_0x7aac('0x6a')](function(_0x2a26c0){logger[_0x7aac('0x6b')]('['+_0x2cd518[_0x7aac('0x76')][_0x7aac('0x77')]()+']',JSON[_0x7aac('0x26')](_0x2a26c0));});}; \ No newline at end of file +var _0x54b5=['forEach','type','string','customField','nameField','toLowerCase','content','idField','custom_fields','variable','Variable','login','username','password','sessionID','set_relationship','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','recordingFormat','none','Outbound','[OUTBOUND]','unmanaged','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Fields','Inbound','contacts','lastevent','lodash','request-promise','bluebird','util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','length','variableName','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','Agent\x20found!','resolve','value','user_id','user_name','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','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.','[HTTP]','merge','map'];(function(_0x16b33e,_0x56420a){var _0x53b975=function(_0x505085){while(--_0x505085){_0x16b33e['push'](_0x16b33e['shift']());}};_0x53b975(++_0x56420a);}(_0x54b5,0xad));var _0x554b=function(_0x5edee5,_0x437968){_0x5edee5=_0x5edee5-0x0;var _0x12de55=_0x54b5[_0x5edee5];return _0x12de55;};'use strict';var _=require(_0x554b('0x0'));var rp=require(_0x554b('0x1'));var BPromise=require(_0x554b('0x2'));var md5=require('md5');var util=require(_0x554b('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x554b('0x4'));var logger=require(_0x554b('0x5'))(_0x554b('0x6'));config[_0x554b('0x7')]=_[_0x554b('0x8')](config[_0x554b('0x7')],{'host':_0x554b('0x9'),'port':0x18eb});var io=require(_0x554b('0xa'))(new Redis(config[_0x554b('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x5d6dd7,_0x55d785,_0x29f5cb){io['to'](_0x5d6dd7)[_0x554b('0xb')](_0x55d785,_0x29f5cb);}function getTicket(_0x51d274,_0x45b732,_0x350c7a,_0x586538,_0x754473,_0x3b206d,_0x52f5ab,_0x576af5){logger[_0x554b('0xc')](_0x554b('0xd'));var _0x593dc1=new Date();var _0x219934=[{'name':_0x554b('0xe'),'value':intUtil[_0x554b('0xf')](_0x586538[_0x554b('0x10')],_0x754473,'\x20')},{'name':'assigned_user_id','value':_0x45b732['id']},{'name':_0x554b('0x11'),'value':_0x45b732['id']},{'name':_0x554b('0x12'),'value':intUtil['getString'](_0x586538[_0x554b('0x13')],_0x754473,'\x0a')},{'name':_0x554b('0x14'),'value':_0x593dc1[_0x554b('0x15')]()[_0x554b('0x16')](0x0,0x13)[_0x554b('0x17')]('T','\x20')},{'name':_0x554b('0x18'),'value':'0'},{'name':_0x554b('0x19'),'value':'15'},{'name':_0x554b('0x1a'),'value':_0x350c7a['id']},{'name':_0x554b('0x1b'),'value':'Contacts'},{'name':_0x554b('0x1c'),'value':_0x350c7a[_0x554b('0xe')]},{'name':_0x554b('0x1d'),'value':_0x576af5}];if(_0x3b206d[_0x554b('0x1e')]){_['forEach'](_0x3b206d,function(_0x1bc7a2){if(_0x754473[_0x1bc7a2[_0x554b('0x1f')]]){_0x219934[_0x554b('0x20')]({'name':_0x1bc7a2['idField'],'value':_0x754473[_0x1bc7a2[_0x554b('0x1f')]]});}});}return request({'form':{'method':_0x554b('0x21'),'input_type':_0x554b('0x22'),'response_type':_0x554b('0x22'),'rest_data':JSON[_0x554b('0x23')]({'session':_0x52f5ab['id'],'module_name':_0x554b('0x24'),'name_value_list':_0x219934})}});}function getAuth(_0xaaf970){return util[_0x554b('0x25')](_0x554b('0x26'),new Buffer(_0xaaf970[_0x554b('0x27')]+':X')[_0x554b('0x28')](_0x554b('0x29')));}function getServerInfo(_0x3c0089){return request({'form':{'method':_0x554b('0x2a'),'input_type':_0x554b('0x22'),'response_type':_0x554b('0x22'),'rest_data':JSON['stringify']({'session':_0x3c0089['id']})}});}function getUser(_0x153a64,_0x60d68e,_0x54986d){if(!_[_0x554b('0x2b')](_0x60d68e)){logger[_0x554b('0xc')](_0x554b('0x2c'),_0x60d68e);return request({'form':{'method':_0x554b('0x2d'),'input_type':'JSON','response_type':_0x554b('0x22'),'rest_data':JSON[_0x554b('0x23')]({'session':_0x54986d['id'],'module_name':'Employees','query':util[_0x554b('0x25')](_0x554b('0x2e'),_0x60d68e),'order_by':'','offset':'0','select_fields':['id',_0x554b('0xe'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x554b('0x2f')](function(_0x6ca112){if(_0x6ca112[_0x554b('0x30')][_0x554b('0x1e')]){var _0x135ecc=_[_0x554b('0x31')](_0x6ca112['entry_list'],function(_0x2509d3){return _0x2509d3[_0x554b('0x32')]['user_name']['value']===_0x60d68e;});if(_0x135ecc){logger[_0x554b('0xc')](_0x554b('0x33'));return BPromise[_0x554b('0x34')]({'id':_0x135ecc[_0x554b('0x32')]['id'][_0x554b('0x35')],'name':_0x135ecc['name_value_list'][_0x554b('0xe')][_0x554b('0x35')]});}}logger[_0x554b('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x54986d['name_value_list'][_0x554b('0x36')][_0x554b('0x35')],'name':_0x54986d[_0x554b('0x32')][_0x554b('0x37')][_0x554b('0x35')]});});}else{logger['info'](_0x554b('0x38'));return BPromise['resolve']({'id':_0x54986d[_0x554b('0x32')]['user_id'][_0x554b('0x35')],'name':_0x54986d[_0x554b('0x32')][_0x554b('0x37')][_0x554b('0x35')]});}}function getEndUser(_0x5e8e52,_0x324060,_0x247b1a,_0x31221a){logger[_0x554b('0xc')](_0x554b('0x39'),_0x247b1a);return request({'form':{'method':_0x554b('0x2d'),'input_type':_0x554b('0x22'),'response_type':_0x554b('0x22'),'rest_data':JSON[_0x554b('0x23')]({'session':_0x31221a['id'],'module_name':_0x554b('0x3a'),'query':util[_0x554b('0x25')](_0x554b('0x3b'),_0x247b1a),'order_by':'','offset':'0','select_fields':['id',_0x554b('0xe'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2e2d40){if(_0x2e2d40[_0x554b('0x30')][_0x554b('0x1e')]){var _0x284911=_[_0x554b('0x31')](_0x2e2d40[_0x554b('0x30')],function(_0x5578df){return _0x5578df['name_value_list'][_0x554b('0x3c')][_0x554b('0x35')]===_0x247b1a;});if(_0x284911){logger[_0x554b('0xc')]('Enduser\x20found!');return BPromise[_0x554b('0x34')]({'id':_0x284911[_0x554b('0x32')]['id']['value'],'name':_0x284911[_0x554b('0x32')][_0x554b('0xe')]['value'],'phone':_0x284911[_0x554b('0x32')]['phone_home'][_0x554b('0x35')]});}}else{logger['info'](_0x554b('0x3d'));return request({'form':{'method':_0x554b('0x21'),'input_type':_0x554b('0x22'),'response_type':_0x554b('0x22'),'rest_data':JSON['stringify']({'session':_0x31221a['id'],'module_name':_0x554b('0x3a'),'name_value_list':[{'name':_0x554b('0x3e'),'value':_0x324060!==_0x554b('0x3f')?_0x324060:util[_0x554b('0x25')](_0x554b('0x40'),_0x247b1a)},{'name':_0x554b('0x3c'),'value':_0x247b1a}]})}})[_0x554b('0x2f')](function(_0x34e1ed){logger[_0x554b('0xc')](_0x554b('0x41'));return BPromise[_0x554b('0x34')]({'id':_0x34e1ed['id'],'name':_0x34e1ed['entry_list'][_0x554b('0x3e')][_0x554b('0x35')],'phone':_0x34e1ed['entry_list']['phone_home'][_0x554b('0x35')]});});}});}function request(_0x32f875){logger['debug'](_0x554b('0x42'),JSON['stringify'](_0x32f875));return rp(_[_0x554b('0x43')](def,_0x32f875));}function getTags(_0x17d206,_0xfaef70){var _0x1194b0=[];if(_0x17d206&&_0x17d206[_0x554b('0x1e')]>0x0){_0x1194b0=_[_0x554b('0x44')](_0x17d206,_0xfaef70);}return _0x1194b0;}function getCustomFields(_0x5d435c,_0x14d043){var _0x4200f2=[];var _0x577afc={'custom_fields':[]};if(_0x5d435c['length']>0x0){_[_0x554b('0x45')](_0x5d435c,function(_0xda4810){if(_0xda4810[_0x554b('0x46')]===_0x554b('0x47')&&_0xda4810['nameField']&&!_0xda4810[_0x554b('0x48')]){_0x577afc[_0xda4810[_0x554b('0x49')][_0x554b('0x4a')]()]=_0xda4810[_0x554b('0x4b')]['toString']();}else if(_0xda4810[_0x554b('0x46')]===_0x554b('0x47')&&_0xda4810[_0x554b('0x4c')]&&_0xda4810['customField']){_0x577afc[_0x554b('0x4d')]['push']({'id':_0xda4810['idField'],'value':_0xda4810[_0x554b('0x4b')][_0x554b('0x28')]()});}else if(_0xda4810[_0x554b('0x46')]===_0x554b('0x4e')&&_0xda4810[_0x554b('0x1f')]&&_0xda4810[_0x554b('0x4c')]&&_0xda4810[_0x554b('0x48')]){_0x14d043[_0xda4810[_0x554b('0x1f')]]&&_0x577afc[_0x554b('0x4d')][_0x554b('0x20')]({'id':_0xda4810['idField'],'value':_0x14d043[_0xda4810[_0x554b('0x1f')]][_0x554b('0x28')]()});}else if(_0xda4810['type']==='customVariable'&&_0xda4810[_0x554b('0x4f')]&&_0xda4810[_0x554b('0x4f')][_0x554b('0xe')]&&_0xda4810[_0x554b('0x4c')]&&_0xda4810[_0x554b('0x48')]){_0x14d043[_0xda4810[_0x554b('0x4f')]['name'][_0x554b('0x4a')]()]&&_0x577afc['custom_fields']['push']({'id':_0xda4810[_0x554b('0x4c')],'value':_0x14d043[_0xda4810[_0x554b('0x4f')][_0x554b('0xe')][_0x554b('0x4a')]()][_0x554b('0x28')]()});}});}return _0x577afc;}function getConnection(_0x1b52d1){return request({'method':'POST','form':{'method':_0x554b('0x50'),'input_type':_0x554b('0x22'),'response_type':_0x554b('0x22'),'rest_data':JSON[_0x554b('0x23')]({'user_auth':{'user_name':_0x1b52d1[_0x554b('0x51')],'password':_0x1b52d1[_0x554b('0x52')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0x554b('0x2f')](function(_0x3d1abd){var _0x17dacb=_0x3d1abd;if(_0x17dacb['id']){def[_0x554b('0x53')]=_0x17dacb['id'];return BPromise[_0x554b('0x34')](_0x17dacb);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x1b52d1['id']));}});}function setRelationship(_0x2ea845,_0x23b676,_0x430c88,_0x2bb99f){return request({'form':{'method':_0x554b('0x54'),'input_type':_0x554b('0x22'),'response_type':_0x554b('0x22'),'rest_data':JSON['stringify']({'session':_0x2ea845['id'],'module_name':'Calls','module_id':_0x430c88['id'],'link_field_name':_0x2bb99f,'related_ids':[_0x23b676['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x23886f,_0x34faf8,_0x2ed9ae,_0xee5ea6,_0x4d37c4,_0x550ba1){var _0x28ac0c,_0xbba34d,_0x16101a,_0x430dbd;_0x550ba1['remoteUri']=intUtil[_0x554b('0x55')](_0x550ba1['remoteUri']);_0x550ba1[_0x554b('0x56')]=intUtil[_0x554b('0x55')](_0x550ba1[_0x554b('0x56')]);def[_0x554b('0x57')]=util[_0x554b('0x25')](_0x554b('0x58'),_0x550ba1[_0x554b('0x59')]);if(_0x4d37c4&&_0x4d37c4[_0x554b('0x5a')]){logger[_0x554b('0xc')](_0x554b('0x5b'),_0x554b('0x5c'));_0x34faf8[_0x554b('0x5d')]=util[_0x554b('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x550ba1['serverUrl'],_0x34faf8[_0x554b('0x5e')],md5(_0x34faf8['uniqueid']));}else{_0x34faf8['recordingURL']='';}return getConnection(_0x550ba1)['then'](function(_0x3337c5){_0x430dbd=_0x3337c5;return getUser(_0x550ba1,_0xee5ea6[_0x554b('0xe')],_0x430dbd);})[_0x554b('0x2f')](function(_0x3eddb3){_0x28ac0c=_0x3eddb3;logger[_0x554b('0xc')](_0x554b('0x5f'),_0x28ac0c['id']);return getEndUser(_0x550ba1,_0x34faf8[_0x554b('0x60')],_0x34faf8['calleridnum'],_0x430dbd);})['then'](function(_0xfbaccb){_0xbba34d=_0xfbaccb;logger[_0x554b('0xc')](_0x554b('0x61'),_0xbba34d['id']);return getTicket(_0x550ba1,_0x28ac0c,_0xbba34d,_0x2ed9ae,_0x34faf8,_0x2ed9ae['Fields'],_0x430dbd,'Inbound');})[_0x554b('0x2f')](function(_0x30b4de){_0x16101a=_0x30b4de;logger[_0x554b('0xc')](_0x554b('0x62'));logger[_0x554b('0xc')](_0x554b('0x63'),_0x16101a['id']);return setRelationship(_0x430dbd,_0x28ac0c,_0x16101a,_0x554b('0x64'));})[_0x554b('0x2f')](function(){return setRelationship(_0x430dbd,_0xbba34d,_0x16101a,'contacts');})['then'](function(){return getServerInfo(_0x430dbd);})[_0x554b('0x2f')](function(_0x59238a){var _0x39f476=parseInt(_0x59238a[_0x554b('0x65')][_0x554b('0x66')](0x0));var _0x4eb53c=util[_0x554b('0x25')](_0x554b('0x67'),_0x550ba1[_0x554b('0x59')],_0x16101a['id']);if(_0x39f476>0x6){_0x4eb53c=util[_0x554b('0x25')](_0x554b('0x68'),_0x550ba1[_0x554b('0x59')],_0x16101a['id']);}logger['info']('[QUEUE]',_0x554b('0x69'));emit(util[_0x554b('0x25')](_0x554b('0x6a'),_0xee5ea6[_0x554b('0xe')]),_0x554b('0x6b'),{'uri':_0x4eb53c});})[_0x554b('0x6c')](function(_0x280a27){logger[_0x554b('0x6d')](_0x554b('0x5b'),JSON['stringify'](_0x280a27));});};exports['outbound']=function(_0x31218f,_0x5d3301,_0x3dc465,_0x129f79,_0xc7a35b,_0x10225c,_0x3a76a5){var _0x298116,_0x4a5731,_0xd22b42,_0x37f62d;_0x10225c['remoteUri']=intUtil['stripTrailingSlash'](_0x10225c[_0x554b('0x59')]);_0x10225c[_0x554b('0x56')]=intUtil[_0x554b('0x55')](_0x10225c['serverUrl']);def['uri']=util[_0x554b('0x25')]('%s/service/v4_1/rest.php',_0x10225c[_0x554b('0x59')]);if(_0x3a76a5&&_0x3a76a5[_0x554b('0x6e')]&&_0x3a76a5[_0x554b('0x6e')]!==_0x554b('0x6f')){logger[_0x554b('0xc')]('[OUTBOUND]',_0x554b('0x5c'));_0x5d3301[_0x554b('0x5d')]=util[_0x554b('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x10225c[_0x554b('0x56')],_0x5d3301[_0x554b('0x5e')],md5(_0x5d3301[_0x554b('0x5e')]));}return getConnection(_0x10225c)[_0x554b('0x2f')](function(_0x4a10c8){_0x37f62d=_0x4a10c8;return getUser(_0x10225c,_0x129f79['name'],_0x37f62d);})['then'](function(_0x38c9f3){_0x298116=_0x38c9f3;logger[_0x554b('0xc')](_0x554b('0x5f'),_0x298116['id']);return getEndUser(_0x10225c,_0x5d3301['destcalleridname'],_0x5d3301['destcalleridnum'],_0x37f62d);})[_0x554b('0x2f')](function(_0x3521bb){_0x4a5731=_0x3521bb;logger[_0x554b('0xc')](_0x554b('0x61'),_0x4a5731['id']);return getTicket(_0x10225c,_0x298116,_0x4a5731,_0x3dc465,_0x5d3301,_0x3dc465['Fields'],_0x37f62d,_0x554b('0x70'));})[_0x554b('0x2f')](function(_0x53841b){_0xd22b42=_0x53841b;logger[_0x554b('0xc')](_0x554b('0x62'));logger[_0x554b('0xc')](_0x554b('0x63'),_0xd22b42['id']);return setRelationship(_0x37f62d,_0x298116,_0xd22b42,_0x554b('0x64'));})[_0x554b('0x2f')](function(){return setRelationship(_0x37f62d,_0x4a5731,_0xd22b42,'contacts');})['then'](function(){return getServerInfo(_0x37f62d);})['then'](function(_0xd9b21a){var _0x3ea178=parseInt(_0xd9b21a['version'][_0x554b('0x66')](0x0));var _0xfd2e76=util[_0x554b('0x25')](_0x554b('0x67'),_0x10225c[_0x554b('0x59')],_0xd22b42['id']);if(_0x3ea178>0x6){_0xfd2e76=util[_0x554b('0x25')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x10225c[_0x554b('0x59')],_0xd22b42['id']);}logger[_0x554b('0xc')]('[OUTBOUND]',_0x554b('0x69'));emit(util[_0x554b('0x25')]('user:%s',_0x129f79['name']),_0x554b('0x6b'),{'uri':_0xfd2e76});})[_0x554b('0x6c')](function(_0x22c429){logger[_0x554b('0x6d')](_0x554b('0x71'),JSON[_0x554b('0x23')](_0x22c429));});};exports[_0x554b('0x72')]=function(_0x2eb9de,_0x1ed7fe,_0x5795d0,_0x1a522f,_0x542de0,_0x5abb80){var _0x3b338b,_0x482568,_0x320cab,_0x365377;_0x5abb80[_0x554b('0x59')]=intUtil['stripTrailingSlash'](_0x5abb80[_0x554b('0x59')]);_0x5abb80[_0x554b('0x56')]=intUtil[_0x554b('0x55')](_0x5abb80[_0x554b('0x56')]);def[_0x554b('0x57')]=util['format'](_0x554b('0x58'),_0x5abb80[_0x554b('0x59')]);if(_0x542de0&&_0x542de0[_0x554b('0x5a')]){logger['info']('['+_0x1ed7fe['lastevent'][_0x554b('0x73')]()+']','Recording\x20is\x20enabled!');_0x1ed7fe[_0x554b('0x5d')]=util[_0x554b('0x25')](_0x554b('0x74'),_0x5abb80['serverUrl'],_0x1ed7fe[_0x554b('0x5e')],md5(_0x1ed7fe['uniqueid']));}else{_0x1ed7fe[_0x554b('0x5d')]='';}return getConnection(_0x5abb80)[_0x554b('0x2f')](function(_0x37f398){_0x365377=_0x37f398;if(!_['isNil'](_0x1a522f)){return getUser(_0x5abb80,_0x1a522f[_0x554b('0xe')],_0x365377);}else{return getUser(_0x5abb80,null,_0x365377);}})['then'](function(_0x1a82c4){_0x3b338b=_0x1a82c4;logger[_0x554b('0xc')](_0x554b('0x5f'),_0x3b338b['id']);return getEndUser(_0x5abb80,_0x1ed7fe['calleridname'],_0x1ed7fe['calleridnum'],_0x365377);})[_0x554b('0x2f')](function(_0x4e41d3){_0x482568=_0x4e41d3;logger['info'](_0x554b('0x61'),_0x482568['id']);return getTicket(_0x5abb80,_0x3b338b,_0x482568,_0x5795d0,_0x1ed7fe,_0x5795d0[_0x554b('0x75')],_0x365377,_0x554b('0x76'));})['then'](function(_0x3cdb1c){_0x320cab=_0x3cdb1c;logger[_0x554b('0xc')](_0x554b('0x62'));logger['info'](_0x554b('0x63'),_0x320cab['id']);return setRelationship(_0x365377,_0x3b338b,_0x320cab,_0x554b('0x64'));})[_0x554b('0x2f')](function(){return setRelationship(_0x365377,_0x482568,_0x320cab,_0x554b('0x77'));})['then'](function(){return getServerInfo(_0x365377);})[_0x554b('0x6c')](function(_0x2d4766){logger[_0x554b('0x6d')]('['+_0x1ed7fe[_0x554b('0x78')][_0x554b('0x73')]()+']',JSON[_0x554b('0x23')](_0x2d4766));});}; \ 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 9ced21b..bc89f48 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 _0xc8f7=['content','variableName','toString','customVariable','Variable','name','toLowerCase','string','key','format','keyContent','variable','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','test','length','sortBy','type','push'];(function(_0x1300fa,_0x29204d){var _0x15ea35=function(_0x2d8f9c){while(--_0x2d8f9c){_0x1300fa['push'](_0x1300fa['shift']());}};_0x15ea35(++_0x29204d);}(_0xc8f7,0x172));var _0x7c8f=function(_0x4d209b,_0x1a05e8){_0x4d209b=_0x4d209b-0x0;var _0xc5e693=_0xc8f7[_0x4d209b];return _0xc5e693;};'use strict';var _=require('lodash');var util=require('util');exports['getString']=function(_0x28e2cf,_0x29cc75,_0x1980b1){var _0x5ae1b2=[];if(_0x28e2cf[_0x7c8f('0x0')]>0x0){var _0xea4e19=_[_0x7c8f('0x1')](_0x28e2cf,['id']);for(var _0x3dc9f1=0x0;_0x3dc9f1<_0xea4e19[_0x7c8f('0x0')];_0x3dc9f1++){var _0x2e8c73=_0xea4e19[_0x3dc9f1];if(_0x2e8c73[_0x7c8f('0x2')]==='string'){_0x5ae1b2[_0x7c8f('0x3')](_0x2e8c73[_0x7c8f('0x4')]);}else if(_0x2e8c73[_0x7c8f('0x2')]==='variable'&&_0x2e8c73[_0x7c8f('0x5')]){_0x29cc75[_0x2e8c73[_0x7c8f('0x5')]]&&_0x5ae1b2[_0x7c8f('0x3')](_0x29cc75[_0x2e8c73[_0x7c8f('0x5')]][_0x7c8f('0x6')]());}else if(_0x2e8c73[_0x7c8f('0x2')]===_0x7c8f('0x7')&&_0x2e8c73[_0x7c8f('0x8')]&&_0x2e8c73['Variable']['name']){_0x29cc75[_0x2e8c73['Variable'][_0x7c8f('0x9')][_0x7c8f('0xa')]()]&&_0x5ae1b2['push'](_0x29cc75[_0x2e8c73['Variable'][_0x7c8f('0x9')][_0x7c8f('0xa')]()][_0x7c8f('0x6')]());}else if(_0x2e8c73[_0x7c8f('0x2')]==='keyValue'){if(_0x2e8c73['keyType']===_0x7c8f('0xb')&&_0x2e8c73[_0x7c8f('0xc')]){_0x5ae1b2['push'](util[_0x7c8f('0xd')]('%s:\x20%s',_0x2e8c73[_0x7c8f('0xc')],_0x2e8c73[_0x7c8f('0xe')]));}else if(_0x2e8c73['keyType']===_0x7c8f('0xf')&&_0x2e8c73[_0x7c8f('0x5')]&&_0x2e8c73[_0x7c8f('0xc')]){_0x29cc75[_0x2e8c73['variableName']]&&_0x5ae1b2[_0x7c8f('0x3')](util[_0x7c8f('0xd')]('%s:\x20%s',_0x2e8c73[_0x7c8f('0xc')],_0x29cc75[_0x2e8c73['variableName']]));}else if(_0x2e8c73['keyType']==='customVariable'&&_0x2e8c73[_0x7c8f('0x8')]&&_0x2e8c73[_0x7c8f('0x8')]['name']&&_0x2e8c73[_0x7c8f('0xc')]){_0x29cc75[_0x2e8c73[_0x7c8f('0x8')][_0x7c8f('0x9')][_0x7c8f('0xa')]()]&&_0x5ae1b2['push'](util[_0x7c8f('0xd')]('%s:\x20%s',_0x2e8c73['key'],_0x29cc75[_0x2e8c73[_0x7c8f('0x8')]['name'][_0x7c8f('0xa')]()]));}}}}return _0x5ae1b2[_0x7c8f('0x10')](_0x1980b1);};exports[_0x7c8f('0x11')]=function(_0x29862a){var _0x3565f4=_0x29862a['slice'](-0x1);if(_0x3565f4==='/'){_0x29862a=_0x29862a[_0x7c8f('0x12')](0x0,_0x29862a[_0x7c8f('0x13')](_0x3565f4));}return _0x29862a;};exports[_0x7c8f('0x14')]=function(_0x42a292){if(!_['isNil'](_0x42a292)&&_0x42a292!==''){var _0x59fc89=/^(([^<>()\[\]\\.,;:\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 _0x59fc89[_0x7c8f('0x15')](String(_0x42a292)[_0x7c8f('0xa')]());}else{return![];}}; \ No newline at end of file +var _0x1d08=['format','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','test','lodash','util','sortBy','length','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','%s:\x20%s','keyContent','key'];(function(_0x37b36e,_0x348636){var _0x5b912a=function(_0x161d00){while(--_0x161d00){_0x37b36e['push'](_0x37b36e['shift']());}};_0x5b912a(++_0x348636);}(_0x1d08,0x174));var _0x81d0=function(_0x57eb9d,_0x30bfc2){_0x57eb9d=_0x57eb9d-0x0;var _0xee75c1=_0x1d08[_0x57eb9d];return _0xee75c1;};'use strict';var _=require(_0x81d0('0x0'));var util=require(_0x81d0('0x1'));exports['getString']=function(_0xb759a8,_0x168d60,_0x1c2c43){var _0x5e95d5=[];if(_0xb759a8['length']>0x0){var _0x3427fb=_[_0x81d0('0x2')](_0xb759a8,['id']);for(var _0x5a9b08=0x0;_0x5a9b08<_0x3427fb[_0x81d0('0x3')];_0x5a9b08++){var _0x21a1f4=_0x3427fb[_0x5a9b08];if(_0x21a1f4[_0x81d0('0x4')]===_0x81d0('0x5')){_0x5e95d5[_0x81d0('0x6')](_0x21a1f4[_0x81d0('0x7')]);}else if(_0x21a1f4[_0x81d0('0x4')]===_0x81d0('0x8')&&_0x21a1f4[_0x81d0('0x9')]){_0x168d60[_0x21a1f4[_0x81d0('0x9')]]&&_0x5e95d5[_0x81d0('0x6')](_0x168d60[_0x21a1f4['variableName']][_0x81d0('0xa')]());}else if(_0x21a1f4[_0x81d0('0x4')]===_0x81d0('0xb')&&_0x21a1f4[_0x81d0('0xc')]&&_0x21a1f4['Variable'][_0x81d0('0xd')]){_0x168d60[_0x21a1f4[_0x81d0('0xc')]['name'][_0x81d0('0xe')]()]&&_0x5e95d5[_0x81d0('0x6')](_0x168d60[_0x21a1f4[_0x81d0('0xc')][_0x81d0('0xd')][_0x81d0('0xe')]()][_0x81d0('0xa')]());}else if(_0x21a1f4['type']===_0x81d0('0xf')){if(_0x21a1f4[_0x81d0('0x10')]==='string'&&_0x21a1f4['key']){_0x5e95d5[_0x81d0('0x6')](util['format'](_0x81d0('0x11'),_0x21a1f4['key'],_0x21a1f4[_0x81d0('0x12')]));}else if(_0x21a1f4['keyType']===_0x81d0('0x8')&&_0x21a1f4[_0x81d0('0x9')]&&_0x21a1f4[_0x81d0('0x13')]){_0x168d60[_0x21a1f4[_0x81d0('0x9')]]&&_0x5e95d5[_0x81d0('0x6')](util[_0x81d0('0x14')](_0x81d0('0x11'),_0x21a1f4[_0x81d0('0x13')],_0x168d60[_0x21a1f4['variableName']]));}else if(_0x21a1f4[_0x81d0('0x10')]===_0x81d0('0xb')&&_0x21a1f4[_0x81d0('0xc')]&&_0x21a1f4[_0x81d0('0xc')][_0x81d0('0xd')]&&_0x21a1f4[_0x81d0('0x13')]){_0x168d60[_0x21a1f4[_0x81d0('0xc')][_0x81d0('0xd')][_0x81d0('0xe')]()]&&_0x5e95d5['push'](util[_0x81d0('0x14')](_0x81d0('0x11'),_0x21a1f4[_0x81d0('0x13')],_0x168d60[_0x21a1f4[_0x81d0('0xc')][_0x81d0('0xd')][_0x81d0('0xe')]()]));}}}}return _0x5e95d5[_0x81d0('0x15')](_0x1c2c43);};exports[_0x81d0('0x16')]=function(_0x2e2973){var _0x287e86=_0x2e2973[_0x81d0('0x17')](-0x1);if(_0x287e86==='/'){_0x2e2973=_0x2e2973[_0x81d0('0x18')](0x0,_0x2e2973[_0x81d0('0x19')](_0x287e86));}return _0x2e2973;};exports[_0x81d0('0x1a')]=function(_0x5d7048){if(!_['isNil'](_0x5d7048)&&_0x5d7048!==''){var _0x13c53c=/^(([^<>()\[\]\\.,;:\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 _0x13c53c[_0x81d0('0x1b')](String(_0x5d7048)[_0x81d0('0xe')]());}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 4a97adf..398f2c9 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 _0x946c=['validateEmail','info','Getting\x20agent\x20with\x20email','GET','remoteUri','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','resolve','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','username','getUser','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','create','Enduser\x20created.','phone','getEndUser','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','destcalleridname','destcalleridnum','Fields','[OUTBOUND]','unmanaged','toUpperCase','The\x20Ticket\x20ID\x20is:','lastevent','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','string','picklist','type','idField','content','variable','variableName','customVariable','Variable','name','toLowerCase','toString','Creating\x20new\x20ticket...','merge','Normal','Open','getString','POST','%s/webservice.php','sessionName','HelpDesk','then','success','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket'];(function(_0x3deb2d,_0x240a2f){var _0x3ec231=function(_0xec80ef){while(--_0xec80ef){_0x3deb2d['push'](_0x3deb2d['shift']());}};_0x3ec231(++_0x240a2f);}(_0x946c,0x17a));var _0xc946=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x946c[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0xc946('0x0'));var rp=require(_0xc946('0x1'));var BPromise=require(_0xc946('0x2'));var md5=require(_0xc946('0x3'));var util=require(_0xc946('0x4'));var Redis=require(_0xc946('0x5'));var intUtil=require(_0xc946('0x6'));var config=require('../../../../config/environment');var logger=require(_0xc946('0x7'))('vTiger');config[_0xc946('0x8')]=_['defaults'](config[_0xc946('0x8')],{'host':_0xc946('0x9'),'port':0x18eb});var io=require(_0xc946('0xa'))(new Redis(config[_0xc946('0x8')]));function emit(_0x5added,_0x7b149c,_0x1d7378){io['to'](_0x5added)[_0xc946('0xb')](_0x7b149c,_0x1d7378);}function getCustomFields(_0xe3541d,_0x22c9aa){var _0x16fb0a={};if(_0xe3541d[_0xc946('0xc')]>0x0){_[_0xc946('0xd')](_0xe3541d,function(_0x194c81){if(_[_0xc946('0xe')]([_0xc946('0xf'),_0xc946('0x10')],_0x194c81[_0xc946('0x11')])&&_0x194c81[_0xc946('0x12')]){_0x16fb0a[_0x194c81[_0xc946('0x12')]]=_0x194c81[_0xc946('0x13')]['toString']();}else if(_0x194c81[_0xc946('0x11')]===_0xc946('0x14')&&_0x194c81[_0xc946('0x15')]&&_0x194c81[_0xc946('0x12')]&&_0x22c9aa[_0x194c81[_0xc946('0x15')]]){_0x16fb0a[_0x194c81[_0xc946('0x12')]]=_0x22c9aa[_0x194c81['variableName']]['toString']();}else if(_0x194c81[_0xc946('0x11')]===_0xc946('0x16')&&_0x194c81[_0xc946('0x17')]&&_0x194c81[_0xc946('0x17')]['name']&&_0x194c81['idField']&&_0x22c9aa[_0x194c81['Variable'][_0xc946('0x18')][_0xc946('0x19')]()]){_0x16fb0a[_0x194c81[_0xc946('0x12')]]=_0x22c9aa[_0x194c81[_0xc946('0x17')][_0xc946('0x18')][_0xc946('0x19')]()][_0xc946('0x1a')]();}});}return _0x16fb0a;}function createTicket(_0x5356ae,_0x493e9c,_0x7df6a1,_0x355d6f,_0x5c15ef,_0x4c64f7,_0x4e51fb){logger['info'](_0xc946('0x1b'));var _0x392c60=_[_0xc946('0x1c')]({'parent_id':'','assigned_user_id':_0x493e9c['id'],'ticketpriorities':_0xc946('0x1d'),'ticketstatus':_0xc946('0x1e'),'ticket_title':intUtil[_0xc946('0x1f')](_0x355d6f['Subjects'],_0x5c15ef,'\x20'),'description':intUtil[_0xc946('0x1f')](_0x355d6f['Descriptions'],_0x5c15ef,'\x0a'),'contact_id':_0x7df6a1['id']},getCustomFields(_0x4c64f7,_0x5c15ef));var _0x588d11={'method':_0xc946('0x20'),'uri':util['format'](_0xc946('0x21'),_0x5356ae['remoteUri']),'form':{'operation':'create','username':_0x5356ae['username'],'sessionName':_0x4e51fb[_0xc946('0x22')],'elementType':_0xc946('0x23'),'element':JSON['stringify'](_0x392c60)},'json':!![]};return request(_0x588d11)[_0xc946('0x24')](function(_0x5cb75c){if(_0x5cb75c[_0xc946('0x25')]){return BPromise['resolve']({'id':_0x5cb75c['result']['id']});}else{throw new Error(util[_0xc946('0x26')](_0xc946('0x27'),JSON[_0xc946('0x28')](_0x5cb75c[_0xc946('0x29')])));}})[_0xc946('0x2a')](function(_0x1e8e00){var _0x3c7cb1=_0x1e8e00[_0xc946('0x2b')]||0x1f4;logger[_0xc946('0x29')](_0xc946('0x2c'),_0xc946('0x2d'),_0x3c7cb1,JSON[_0xc946('0x28')](_0x1e8e00));});}function getUser(_0x3f8f68,_0x215989,_0x2746bb){if(intUtil[_0xc946('0x2e')](_0x215989)){logger[_0xc946('0x2f')](_0xc946('0x30'),_0x215989);return request({'method':_0xc946('0x31'),'uri':util[_0xc946('0x26')]('%s/webservice.php',_0x3f8f68[_0xc946('0x32')]),'qs':{'operation':_0xc946('0x33'),'username':_0x3f8f68['username'],'sessionName':_0x2746bb[_0xc946('0x22')],'query':util[_0xc946('0x26')](_0xc946('0x34'),_0x215989)},'json':!![]})[_0xc946('0x24')](function(_0x564e31){if(_0x564e31[_0xc946('0x25')]&&_0x564e31[_0xc946('0x35')][_0xc946('0xc')]){logger[_0xc946('0x2f')]('Agent\x20found!');return BPromise[_0xc946('0x36')]({'id':_0x564e31[_0xc946('0x35')][0x0]['id'],'email':_0x564e31['result'][0x0]['email1'],'name':_0x564e31['result'][0x0][_0xc946('0x37')]+'\x20'+_0x564e31[_0xc946('0x35')][_0xc946('0x38')]});}else{logger[_0xc946('0x2f')](_0xc946('0x39'));return BPromise[_0xc946('0x36')]({'id':_0x2746bb[_0xc946('0x3a')],'email':_0x3f8f68[_0xc946('0x3b')],'name':'admin'});}})[_0xc946('0x2a')](function(_0x346813){var _0x295eb3=_0x346813[_0xc946('0x2b')]||0x1f4;logger[_0xc946('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xc946('0x3c'),_0x295eb3,JSON[_0xc946('0x28')](_0x346813));});}else{logger[_0xc946('0x2f')](_0xc946('0x39'));return BPromise[_0xc946('0x36')]({'id':_0x2746bb[_0xc946('0x3a')],'email':_0x3f8f68[_0xc946('0x3b')],'name':'admin'})['catch'](function(_0x311352){var _0x4ca770=_0x311352[_0xc946('0x2b')]||0x1f4;logger[_0xc946('0x29')](_0xc946('0x2c'),_0xc946('0x3c'),_0x4ca770,JSON[_0xc946('0x28')](_0x311352));});}}function getEndUser(_0x5784cb,_0x53161a,_0x556c34,_0x2ee325){logger[_0xc946('0x2f')](_0xc946('0x3d'),_0x556c34);return request({'method':_0xc946('0x31'),'uri':util[_0xc946('0x26')](_0xc946('0x21'),_0x5784cb[_0xc946('0x32')]),'qs':{'operation':_0xc946('0x33'),'username':_0x5784cb['username'],'sessionName':_0x2ee325[_0xc946('0x22')],'query':util['format'](_0xc946('0x3e'),_0x556c34,_0x556c34,_0x556c34,_0x556c34,_0x556c34)},'json':!![]})[_0xc946('0x24')](function(_0xc100c2){if(_0xc100c2[_0xc946('0x25')]&&_0xc100c2[_0xc946('0x35')]['length']){logger[_0xc946('0x2f')](_0xc946('0x3f'));return BPromise[_0xc946('0x36')]({'id':_0xc100c2['result'][0x0]['id'],'name':_0xc100c2[_0xc946('0x35')][0x0][_0xc946('0x40')]+'\x20'+_0xc100c2[_0xc946('0x35')][0x0][_0xc946('0x41')],'phone':_0x556c34});}else{logger[_0xc946('0x2f')](_0xc946('0x42'));return request({'method':_0xc946('0x20'),'uri':util[_0xc946('0x26')](_0xc946('0x21'),_0x5784cb['remoteUri']),'form':{'operation':_0xc946('0x43'),'sessionName':_0x2ee325[_0xc946('0x22')],'elementType':'Contacts','element':JSON[_0xc946('0x28')]({'lastname':_0x53161a,'phone':_0x556c34,'assigned_user_id':'\x20'})},'json':!![]})[_0xc946('0x24')](function(_0x5f47bc){logger['info'](_0xc946('0x44'));return BPromise[_0xc946('0x36')]({'id':_0x5f47bc[_0xc946('0x35')]['id'],'name':_0x5f47bc[_0xc946('0x35')]['lastname'],'phone':_0x5f47bc[_0xc946('0x35')][_0xc946('0x45')]});})['catch'](function(_0x408690){var _0x477744=_0x408690[_0xc946('0x2b')]||0x1f4;logger[_0xc946('0x29')](_0xc946('0x2c'),_0xc946('0x46'),_0x477744,JSON[_0xc946('0x28')](_0x408690));});}});}function getConnection(_0x23f72a){var _0x5143dc=_0x23f72a[_0xc946('0x3b')];var _0x236df4=_0x23f72a['accessKey'];return request({'method':_0xc946('0x31'),'uri':util[_0xc946('0x26')]('%s/webservice.php',_0x23f72a[_0xc946('0x32')]),'qs':{'operation':_0xc946('0x47'),'username':_0x5143dc},'json':!![]})[_0xc946('0x24')](function(_0x117aeb){if(_0x117aeb[_0xc946('0x25')]){return request({'method':_0xc946('0x20'),'uri':util['format'](_0xc946('0x21'),_0x23f72a[_0xc946('0x32')]),'form':{'operation':_0xc946('0x48'),'username':_0x5143dc,'accessKey':md5(_0x117aeb[_0xc946('0x35')][_0xc946('0x49')]+_0x236df4)},'json':!![]});}})[_0xc946('0x24')](function(_0x66b2b1){if(_0x66b2b1[_0xc946('0x25')]){return BPromise[_0xc946('0x36')](_0x66b2b1['result']);}else{throw new Error(util['format'](_0xc946('0x4a'),_0x23f72a['id']));}})[_0xc946('0x2a')](function(_0x10dadb){var _0x59ce52=_0x10dadb[_0xc946('0x2b')]||0x1f4;logger[_0xc946('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xc946('0x4b'),_0x59ce52,JSON['stringify'](_0x10dadb));});}function request(_0x494dc4){logger[_0xc946('0x2f')](_0xc946('0x4c'),JSON[_0xc946('0x28')](_0x494dc4));return rp(_0x494dc4);}exports['queue']=function(_0x3ec712,_0x12251f,_0x508e36,_0x450701,_0x981dbc,_0xbb8cbf){var _0x3ad92c,_0x2b3e84,_0xbcc876,_0x45ebc2;_0xbb8cbf[_0xc946('0x32')]=intUtil[_0xc946('0x4d')](_0xbb8cbf[_0xc946('0x32')]);if(_0x981dbc&&_0x981dbc[_0xc946('0x4e')]){logger[_0xc946('0x2f')](_0xc946('0x4f'),_0xc946('0x50'));_0x12251f[_0xc946('0x51')]=util[_0xc946('0x26')](_0xc946('0x52'),_0xbb8cbf[_0xc946('0x53')],_0x12251f[_0xc946('0x54')],md5(_0x12251f[_0xc946('0x54')]));}else{_0x12251f['recordingURL']='';}return getConnection(_0xbb8cbf)[_0xc946('0x24')](function(_0x3fbfd2){_0x45ebc2=_0x3fbfd2;return getUser(_0xbb8cbf,_0x450701[_0xc946('0x55')],_0x45ebc2);})[_0xc946('0x24')](function(_0x29e71e){_0x3ad92c=_0x29e71e;logger[_0xc946('0x2f')](_0xc946('0x56'),_0x3ad92c['id']);return getEndUser(_0xbb8cbf,_0x12251f[_0xc946('0x57')],_0x12251f[_0xc946('0x58')],_0x45ebc2);})[_0xc946('0x24')](function(_0x338a06){_0x2b3e84=_0x338a06;logger['info'](_0xc946('0x59'),_0x2b3e84['id']);return createTicket(_0xbb8cbf,_0x3ad92c,_0x2b3e84,_0x508e36,_0x12251f,_0x508e36['Fields'],_0x45ebc2);})[_0xc946('0x24')](function(_0x28ea90){_0xbcc876=_0x28ea90;logger[_0xc946('0x2f')](_0xc946('0x5a'));logger[_0xc946('0x2f')]('The\x20Ticket\x20ID\x20is:',_0xbcc876['id']);var _0x395478=util['format'](_0xc946('0x5b'),_0xbb8cbf['remoteUri'],_[_0xc946('0x5c')](_0xbcc876['id'],'x')[0x1]);logger['info'](_0xc946('0x4f'),_0xc946('0x5d'));emit(util[_0xc946('0x26')](_0xc946('0x5e'),_0x450701[_0xc946('0x18')]),_0xc946('0x5f'),{'uri':_0x395478});})[_0xc946('0x2a')](function(_0x51e59b){logger[_0xc946('0x29')](_0xc946('0x4f'),JSON['stringify'](_0x51e59b));});};exports[_0xc946('0x60')]=function(_0x209a6c,_0x77a285,_0xf0e318,_0xee6adf,_0x349240,_0x478f07,_0x50ef95){var _0xd659ac,_0x135b73,_0x5563d4,_0x10cfe0;_0x478f07[_0xc946('0x32')]=intUtil['stripTrailingSlash'](_0x478f07[_0xc946('0x32')]);_0x478f07['serverUrl']=intUtil[_0xc946('0x4d')](_0x478f07[_0xc946('0x53')]);if(_0x50ef95&&_0x50ef95[_0xc946('0x61')]&&_0x50ef95['recordingFormat']!=='none'){logger[_0xc946('0x2f')]('[OUTBOUND]',_0xc946('0x50'));_0x77a285['recordingURL']=util['format'](_0xc946('0x52'),_0x478f07['serverUrl'],_0x77a285[_0xc946('0x54')],md5(_0x77a285['uniqueid']));}return getConnection(_0x478f07)[_0xc946('0x24')](function(_0x5d8eb9){_0x10cfe0=_0x5d8eb9;return getUser(_0x478f07,_0xee6adf[_0xc946('0x55')],_0x10cfe0);})[_0xc946('0x24')](function(_0x98b088){_0xd659ac=_0x98b088;logger[_0xc946('0x2f')](_0xc946('0x56'),_0xd659ac['id']);return getEndUser(_0x478f07,_0x77a285[_0xc946('0x62')],_0x77a285[_0xc946('0x63')],_0x10cfe0);})['then'](function(_0x5a8d2c){_0x135b73=_0x5a8d2c;logger[_0xc946('0x2f')](_0xc946('0x59'),_0x135b73['id']);return createTicket(_0x478f07,_0xd659ac,_0x135b73,_0xf0e318,_0x77a285,_0xf0e318[_0xc946('0x64')],_0x10cfe0);})['then'](function(_0x3c1637){_0x5563d4=_0x3c1637;logger[_0xc946('0x2f')](_0xc946('0x5a'));logger[_0xc946('0x2f')]('The\x20Ticket\x20ID\x20is:',_0x5563d4['id']);var _0x2d6e88=util['format'](_0xc946('0x5b'),_0x478f07[_0xc946('0x32')],_[_0xc946('0x5c')](_0x5563d4['id'],'x')[0x1]);logger[_0xc946('0x2f')](_0xc946('0x65'),_0xc946('0x5d'));emit(util[_0xc946('0x26')]('user:%s',_0xee6adf['name']),_0xc946('0x5f'),{'uri':_0x2d6e88});})[_0xc946('0x2a')](function(_0x4413d1){logger[_0xc946('0x29')](_0xc946('0x65'),JSON[_0xc946('0x28')](_0x4413d1));});};exports[_0xc946('0x66')]=function(_0x483db8,_0x5db58e,_0x58f280,_0xcc3947,_0x1c4f58,_0x211048){var _0x16ab84,_0x5a6033,_0x15caa4,_0x568ca9;_0x211048[_0xc946('0x32')]=intUtil['stripTrailingSlash'](_0x211048[_0xc946('0x32')]);_0x211048[_0xc946('0x53')]=intUtil['stripTrailingSlash'](_0x211048[_0xc946('0x53')]);if(_0x1c4f58&&_0x1c4f58['monitor_format']){logger[_0xc946('0x2f')]('['+_0x5db58e['lastevent'][_0xc946('0x67')]()+']','Recording\x20is\x20enabled!');_0x5db58e[_0xc946('0x51')]=util[_0xc946('0x26')](_0xc946('0x52'),_0x211048[_0xc946('0x53')],_0x5db58e[_0xc946('0x54')],md5(_0x5db58e[_0xc946('0x54')]));}else{_0x5db58e[_0xc946('0x51')]='';}return getConnection(_0x211048)['then'](function(_0x3e97a9){_0x568ca9=_0x3e97a9;return getUser(_0x211048,'',_0x568ca9);})[_0xc946('0x24')](function(_0x58d8a3){_0x16ab84=_0x58d8a3;logger[_0xc946('0x2f')](_0xc946('0x56'),_0x16ab84['id']);return getEndUser(_0x211048,_0x5db58e['calleridname'],_0x5db58e[_0xc946('0x58')],_0x568ca9);})[_0xc946('0x24')](function(_0x4747f1){_0x5a6033=_0x4747f1;logger['info'](_0xc946('0x59'),_0x5a6033['id']);return createTicket(_0x211048,_0x16ab84,_0x5a6033,_0x58f280,_0x5db58e,_0x58f280[_0xc946('0x64')],_0x568ca9);})['then'](function(_0x2b2093){_0x15caa4=_0x2b2093;logger['info'](_0xc946('0x5a'));logger['info'](_0xc946('0x68'),_0x15caa4['id']);})[_0xc946('0x2a')](function(_0x5c7dd4){logger[_0xc946('0x29')]('['+_0x5db58e[_0xc946('0x69')][_0xc946('0x67')]()+']',JSON[_0xc946('0x28')](_0x5c7dd4));});}; \ No newline at end of file +var _0xcae2=['token','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','lastevent','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','string','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Subjects','getString','format','%s/webservice.php','username','sessionName','HelpDesk','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','last_name','admin','[vTiger],\x20%s,\x20%s,\x20%s','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','create','Contacts','getEndUser','POST','login'];(function(_0x16decf,_0x5efedd){var _0x4829f1=function(_0x561f48){while(--_0x561f48){_0x16decf['push'](_0x16decf['shift']());}};_0x4829f1(++_0x5efedd);}(_0xcae2,0x143));var _0x2cae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcae2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cae('0x0'));var rp=require(_0x2cae('0x1'));var BPromise=require(_0x2cae('0x2'));var md5=require(_0x2cae('0x3'));var util=require(_0x2cae('0x4'));var Redis=require(_0x2cae('0x5'));var intUtil=require(_0x2cae('0x6'));var config=require('../../../../config/environment');var logger=require(_0x2cae('0x7'))(_0x2cae('0x8'));config[_0x2cae('0x9')]=_[_0x2cae('0xa')](config['redis'],{'host':_0x2cae('0xb'),'port':0x18eb});var io=require(_0x2cae('0xc'))(new Redis(config[_0x2cae('0x9')]));function emit(_0x25b6a2,_0x2e7498,_0x49e1d1){io['to'](_0x25b6a2)['emit'](_0x2e7498,_0x49e1d1);}function getCustomFields(_0x4933f4,_0x49f0d3){var _0x460ed2={};if(_0x4933f4[_0x2cae('0xd')]>0x0){_[_0x2cae('0xe')](_0x4933f4,function(_0x3212ec){if(_[_0x2cae('0xf')]([_0x2cae('0x10'),'picklist'],_0x3212ec[_0x2cae('0x11')])&&_0x3212ec['idField']){_0x460ed2[_0x3212ec[_0x2cae('0x12')]]=_0x3212ec[_0x2cae('0x13')][_0x2cae('0x14')]();}else if(_0x3212ec[_0x2cae('0x11')]===_0x2cae('0x15')&&_0x3212ec[_0x2cae('0x16')]&&_0x3212ec['idField']&&_0x49f0d3[_0x3212ec[_0x2cae('0x16')]]){_0x460ed2[_0x3212ec['idField']]=_0x49f0d3[_0x3212ec[_0x2cae('0x16')]][_0x2cae('0x14')]();}else if(_0x3212ec['type']===_0x2cae('0x17')&&_0x3212ec[_0x2cae('0x18')]&&_0x3212ec[_0x2cae('0x18')][_0x2cae('0x19')]&&_0x3212ec['idField']&&_0x49f0d3[_0x3212ec[_0x2cae('0x18')][_0x2cae('0x19')]['toLowerCase']()]){_0x460ed2[_0x3212ec[_0x2cae('0x12')]]=_0x49f0d3[_0x3212ec[_0x2cae('0x18')][_0x2cae('0x19')][_0x2cae('0x1a')]()][_0x2cae('0x14')]();}});}return _0x460ed2;}function createTicket(_0x164aee,_0x398290,_0x3d5834,_0x57268d,_0x5cb971,_0x276ed4,_0x602f9b){logger[_0x2cae('0x1b')](_0x2cae('0x1c'));var _0x2f4f5c=_[_0x2cae('0x1d')]({'parent_id':'','assigned_user_id':_0x398290['id'],'ticketpriorities':_0x2cae('0x1e'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x57268d[_0x2cae('0x1f')],_0x5cb971,'\x20'),'description':intUtil[_0x2cae('0x20')](_0x57268d['Descriptions'],_0x5cb971,'\x0a'),'contact_id':_0x3d5834['id']},getCustomFields(_0x276ed4,_0x5cb971));var _0x4b2f85={'method':'POST','uri':util[_0x2cae('0x21')](_0x2cae('0x22'),_0x164aee['remoteUri']),'form':{'operation':'create','username':_0x164aee[_0x2cae('0x23')],'sessionName':_0x602f9b[_0x2cae('0x24')],'elementType':_0x2cae('0x25'),'element':JSON[_0x2cae('0x26')](_0x2f4f5c)},'json':!![]};return request(_0x4b2f85)[_0x2cae('0x27')](function(_0x447c72){if(_0x447c72[_0x2cae('0x28')]){return BPromise[_0x2cae('0x29')]({'id':_0x447c72[_0x2cae('0x2a')]['id']});}else{throw new Error(util[_0x2cae('0x21')](_0x2cae('0x2b'),JSON[_0x2cae('0x26')](_0x447c72[_0x2cae('0x2c')])));}})[_0x2cae('0x2d')](function(_0x3422bb){var _0x2d8e66=_0x3422bb['statusCode']||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x2d8e66,JSON[_0x2cae('0x26')](_0x3422bb));});}function getUser(_0x427ace,_0x3a16b6,_0x508069){if(intUtil['validateEmail'](_0x3a16b6)){logger[_0x2cae('0x1b')](_0x2cae('0x2e'),_0x3a16b6);return request({'method':_0x2cae('0x2f'),'uri':util['format'](_0x2cae('0x22'),_0x427ace['remoteUri']),'qs':{'operation':_0x2cae('0x30'),'username':_0x427ace['username'],'sessionName':_0x508069[_0x2cae('0x24')],'query':util[_0x2cae('0x21')](_0x2cae('0x31'),_0x3a16b6)},'json':!![]})['then'](function(_0x335345){if(_0x335345[_0x2cae('0x28')]&&_0x335345[_0x2cae('0x2a')][_0x2cae('0xd')]){logger[_0x2cae('0x1b')](_0x2cae('0x32'));return BPromise['resolve']({'id':_0x335345['result'][0x0]['id'],'email':_0x335345[_0x2cae('0x2a')][0x0][_0x2cae('0x33')],'name':_0x335345['result'][0x0]['first_name']+'\x20'+_0x335345['result'][_0x2cae('0x34')]});}else{logger[_0x2cae('0x1b')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x508069['userId'],'email':_0x427ace[_0x2cae('0x23')],'name':_0x2cae('0x35')});}})[_0x2cae('0x2d')](function(_0x34d3c1){var _0x150092=_0x34d3c1['statusCode']||0x1f4;logger[_0x2cae('0x2c')](_0x2cae('0x36'),'getUser',_0x150092,JSON[_0x2cae('0x26')](_0x34d3c1));});}else{logger[_0x2cae('0x1b')](_0x2cae('0x37'));return BPromise[_0x2cae('0x29')]({'id':_0x508069[_0x2cae('0x38')],'email':_0x427ace[_0x2cae('0x23')],'name':'admin'})[_0x2cae('0x2d')](function(_0x3d25c4){var _0x4c733f=_0x3d25c4[_0x2cae('0x39')]||0x1f4;logger[_0x2cae('0x2c')](_0x2cae('0x36'),_0x2cae('0x3a'),_0x4c733f,JSON[_0x2cae('0x26')](_0x3d25c4));});}}function getEndUser(_0x4d8037,_0x4c3d4e,_0x391892,_0x112003){logger['info'](_0x2cae('0x3b'),_0x391892);return request({'method':_0x2cae('0x2f'),'uri':util[_0x2cae('0x21')](_0x2cae('0x22'),_0x4d8037[_0x2cae('0x3c')]),'qs':{'operation':_0x2cae('0x30'),'username':_0x4d8037[_0x2cae('0x23')],'sessionName':_0x112003['sessionName'],'query':util[_0x2cae('0x21')](_0x2cae('0x3d'),_0x391892,_0x391892,_0x391892,_0x391892,_0x391892)},'json':!![]})[_0x2cae('0x27')](function(_0x2d6e01){if(_0x2d6e01[_0x2cae('0x28')]&&_0x2d6e01['result']['length']){logger[_0x2cae('0x1b')](_0x2cae('0x3e'));return BPromise[_0x2cae('0x29')]({'id':_0x2d6e01[_0x2cae('0x2a')][0x0]['id'],'name':_0x2d6e01['result'][0x0][_0x2cae('0x3f')]+'\x20'+_0x2d6e01['result'][0x0]['lastname'],'phone':_0x391892});}else{logger[_0x2cae('0x1b')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util[_0x2cae('0x21')](_0x2cae('0x22'),_0x4d8037[_0x2cae('0x3c')]),'form':{'operation':_0x2cae('0x40'),'sessionName':_0x112003[_0x2cae('0x24')],'elementType':_0x2cae('0x41'),'element':JSON[_0x2cae('0x26')]({'lastname':_0x4c3d4e,'phone':_0x391892,'assigned_user_id':'\x20'})},'json':!![]})[_0x2cae('0x27')](function(_0x4a21d4){logger['info']('Enduser\x20created.');return BPromise[_0x2cae('0x29')]({'id':_0x4a21d4['result']['id'],'name':_0x4a21d4[_0x2cae('0x2a')]['lastname'],'phone':_0x4a21d4[_0x2cae('0x2a')]['phone']});})[_0x2cae('0x2d')](function(_0x189de8){var _0xbdf67=_0x189de8[_0x2cae('0x39')]||0x1f4;logger[_0x2cae('0x2c')](_0x2cae('0x36'),_0x2cae('0x42'),_0xbdf67,JSON[_0x2cae('0x26')](_0x189de8));});}});}function getConnection(_0x241340){var _0x5a3400=_0x241340[_0x2cae('0x23')];var _0x5e38b2=_0x241340['accessKey'];return request({'method':_0x2cae('0x2f'),'uri':util[_0x2cae('0x21')](_0x2cae('0x22'),_0x241340['remoteUri']),'qs':{'operation':'getchallenge','username':_0x5a3400},'json':!![]})[_0x2cae('0x27')](function(_0x2ce455){if(_0x2ce455[_0x2cae('0x28')]){return request({'method':_0x2cae('0x43'),'uri':util[_0x2cae('0x21')](_0x2cae('0x22'),_0x241340[_0x2cae('0x3c')]),'form':{'operation':_0x2cae('0x44'),'username':_0x5a3400,'accessKey':md5(_0x2ce455[_0x2cae('0x2a')][_0x2cae('0x45')]+_0x5e38b2)},'json':!![]});}})['then'](function(_0x1a20d6){if(_0x1a20d6[_0x2cae('0x28')]){return BPromise['resolve'](_0x1a20d6[_0x2cae('0x2a')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x241340['id']));}})[_0x2cae('0x2d')](function(_0x37b03e){var _0x30054b=_0x37b03e[_0x2cae('0x39')]||0x1f4;logger['error'](_0x2cae('0x36'),_0x2cae('0x46'),_0x30054b,JSON[_0x2cae('0x26')](_0x37b03e));});}function request(_0x3cb9de){logger[_0x2cae('0x1b')](_0x2cae('0x47'),JSON[_0x2cae('0x26')](_0x3cb9de));return rp(_0x3cb9de);}exports[_0x2cae('0x48')]=function(_0x2eb66f,_0x1a77f9,_0x2b77cb,_0xc60da8,_0x5de245,_0x23a069){var _0x15cfdb,_0x2a607b,_0x5889dc,_0x5a57c2;_0x23a069[_0x2cae('0x3c')]=intUtil[_0x2cae('0x49')](_0x23a069['remoteUri']);if(_0x5de245&&_0x5de245['monitor_format']){logger[_0x2cae('0x1b')](_0x2cae('0x4a'),_0x2cae('0x4b'));_0x1a77f9[_0x2cae('0x4c')]=util[_0x2cae('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x23a069[_0x2cae('0x4d')],_0x1a77f9[_0x2cae('0x4e')],md5(_0x1a77f9[_0x2cae('0x4e')]));}else{_0x1a77f9[_0x2cae('0x4c')]='';}return getConnection(_0x23a069)[_0x2cae('0x27')](function(_0x235fc3){_0x5a57c2=_0x235fc3;return getUser(_0x23a069,_0xc60da8['email'],_0x5a57c2);})['then'](function(_0x272486){_0x15cfdb=_0x272486;logger[_0x2cae('0x1b')](_0x2cae('0x4f'),_0x15cfdb['id']);return getEndUser(_0x23a069,_0x1a77f9[_0x2cae('0x50')],_0x1a77f9[_0x2cae('0x51')],_0x5a57c2);})[_0x2cae('0x27')](function(_0x72ab57){_0x2a607b=_0x72ab57;logger[_0x2cae('0x1b')]('The\x20Enduser\x20ID\x20is:',_0x2a607b['id']);return createTicket(_0x23a069,_0x15cfdb,_0x2a607b,_0x2b77cb,_0x1a77f9,_0x2b77cb[_0x2cae('0x52')],_0x5a57c2);})[_0x2cae('0x27')](function(_0x38ffe5){_0x5889dc=_0x38ffe5;logger[_0x2cae('0x1b')](_0x2cae('0x53'));logger[_0x2cae('0x1b')](_0x2cae('0x54'),_0x5889dc['id']);var _0x57bef1=util['format'](_0x2cae('0x55'),_0x23a069[_0x2cae('0x3c')],_[_0x2cae('0x56')](_0x5889dc['id'],'x')[0x1]);logger['info'](_0x2cae('0x4a'),_0x2cae('0x57'));emit(util[_0x2cae('0x21')](_0x2cae('0x58'),_0xc60da8[_0x2cae('0x19')]),_0x2cae('0x59'),{'uri':_0x57bef1});})[_0x2cae('0x2d')](function(_0x10fe0a){logger[_0x2cae('0x2c')]('[QUEUE]',JSON[_0x2cae('0x26')](_0x10fe0a));});};exports['outbound']=function(_0x3a6192,_0x4f7c79,_0x259b54,_0x28487a,_0x18d2e8,_0x1f4c8d,_0x409eb8){var _0x27c1cc,_0x25fa09,_0x109f87,_0x26571b;_0x1f4c8d[_0x2cae('0x3c')]=intUtil[_0x2cae('0x49')](_0x1f4c8d['remoteUri']);_0x1f4c8d['serverUrl']=intUtil['stripTrailingSlash'](_0x1f4c8d['serverUrl']);if(_0x409eb8&&_0x409eb8[_0x2cae('0x5a')]&&_0x409eb8[_0x2cae('0x5a')]!=='none'){logger['info'](_0x2cae('0x5b'),_0x2cae('0x4b'));_0x4f7c79[_0x2cae('0x4c')]=util[_0x2cae('0x21')](_0x2cae('0x5c'),_0x1f4c8d[_0x2cae('0x4d')],_0x4f7c79[_0x2cae('0x4e')],md5(_0x4f7c79[_0x2cae('0x4e')]));}return getConnection(_0x1f4c8d)[_0x2cae('0x27')](function(_0x1dee17){_0x26571b=_0x1dee17;return getUser(_0x1f4c8d,_0x28487a[_0x2cae('0x5d')],_0x26571b);})[_0x2cae('0x27')](function(_0x589768){_0x27c1cc=_0x589768;logger[_0x2cae('0x1b')](_0x2cae('0x4f'),_0x27c1cc['id']);return getEndUser(_0x1f4c8d,_0x4f7c79[_0x2cae('0x5e')],_0x4f7c79[_0x2cae('0x5f')],_0x26571b);})[_0x2cae('0x27')](function(_0x36c7e6){_0x25fa09=_0x36c7e6;logger[_0x2cae('0x1b')](_0x2cae('0x60'),_0x25fa09['id']);return createTicket(_0x1f4c8d,_0x27c1cc,_0x25fa09,_0x259b54,_0x4f7c79,_0x259b54[_0x2cae('0x52')],_0x26571b);})[_0x2cae('0x27')](function(_0x4c1a2f){_0x109f87=_0x4c1a2f;logger[_0x2cae('0x1b')](_0x2cae('0x53'));logger[_0x2cae('0x1b')](_0x2cae('0x54'),_0x109f87['id']);var _0x2d984f=util[_0x2cae('0x21')](_0x2cae('0x55'),_0x1f4c8d[_0x2cae('0x3c')],_[_0x2cae('0x56')](_0x109f87['id'],'x')[0x1]);logger[_0x2cae('0x1b')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2cae('0x21')](_0x2cae('0x58'),_0x28487a[_0x2cae('0x19')]),_0x2cae('0x59'),{'uri':_0x2d984f});})[_0x2cae('0x2d')](function(_0x2a03df){logger[_0x2cae('0x2c')](_0x2cae('0x5b'),JSON[_0x2cae('0x26')](_0x2a03df));});};exports['unmanaged']=function(_0x237291,_0x12588b,_0x2be6a4,_0x3fedd7,_0x5b0a14,_0x52cf2c){var _0x28d917,_0x3b22d0,_0x2b7ba4,_0x77a27a;_0x52cf2c[_0x2cae('0x3c')]=intUtil['stripTrailingSlash'](_0x52cf2c[_0x2cae('0x3c')]);_0x52cf2c[_0x2cae('0x4d')]=intUtil['stripTrailingSlash'](_0x52cf2c[_0x2cae('0x4d')]);if(_0x5b0a14&&_0x5b0a14['monitor_format']){logger[_0x2cae('0x1b')]('['+_0x12588b[_0x2cae('0x61')]['toUpperCase']()+']',_0x2cae('0x4b'));_0x12588b[_0x2cae('0x4c')]=util['format'](_0x2cae('0x5c'),_0x52cf2c[_0x2cae('0x4d')],_0x12588b[_0x2cae('0x4e')],md5(_0x12588b[_0x2cae('0x4e')]));}else{_0x12588b['recordingURL']='';}return getConnection(_0x52cf2c)[_0x2cae('0x27')](function(_0x4a830f){_0x77a27a=_0x4a830f;return getUser(_0x52cf2c,'',_0x77a27a);})[_0x2cae('0x27')](function(_0x5cd227){_0x28d917=_0x5cd227;logger[_0x2cae('0x1b')](_0x2cae('0x4f'),_0x28d917['id']);return getEndUser(_0x52cf2c,_0x12588b[_0x2cae('0x50')],_0x12588b[_0x2cae('0x51')],_0x77a27a);})[_0x2cae('0x27')](function(_0x2bfc5a){_0x3b22d0=_0x2bfc5a;logger[_0x2cae('0x1b')](_0x2cae('0x60'),_0x3b22d0['id']);return createTicket(_0x52cf2c,_0x28d917,_0x3b22d0,_0x2be6a4,_0x12588b,_0x2be6a4['Fields'],_0x77a27a);})['then'](function(_0x44e389){_0x2b7ba4=_0x44e389;logger['info'](_0x2cae('0x53'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x2b7ba4['id']);})[_0x2cae('0x2d')](function(_0x24127b){logger[_0x2cae('0x2c')]('['+_0x12588b[_0x2cae('0x61')]['toUpperCase']()+']',JSON[_0x2cae('0x26')](_0x24127b));});}; \ 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 7f3da87..58cf6d1 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 _0x9005=['Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','base64','debug','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','uniqueid','recordingURL','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','catch','error','inspect','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','integrationTab','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','Zendesk\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','Subjects','getString','Descriptions','Fields','Ticket\x20created!','ticket','info','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','then','count','results','agent','%s/users/me.json','Admin\x20account\x20selected.','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','%s/users.json'];(function(_0xbd4eb7,_0x527b62){var _0x1bf52c=function(_0x599786){while(--_0x599786){_0xbd4eb7['push'](_0xbd4eb7['shift']());}};_0x1bf52c(++_0x527b62);}(_0x9005,0x127));var _0x5900=function(_0x703ed0,_0x471a07){_0x703ed0=_0x703ed0-0x0;var _0x2aed57=_0x9005[_0x703ed0];return _0x2aed57;};'use strict';var _=require(_0x5900('0x0'));var rp=require(_0x5900('0x1'));var md5=require('md5');var util=require(_0x5900('0x2'));var Redis=require(_0x5900('0x3'));var intUtil=require('./util');var config=require(_0x5900('0x4'));var logger=require(_0x5900('0x5'))(_0x5900('0x6'));config[_0x5900('0x7')]=_[_0x5900('0x8')](config[_0x5900('0x7')],{'host':_0x5900('0x9'),'port':0x18eb});var io=require(_0x5900('0xa'))(new Redis(config['redis']));function emit(_0xd1e95e,_0x4873f7,_0x5e3c72){io['to'](_0xd1e95e)[_0x5900('0xb')](_0x4873f7,_0x5e3c72);}var headers={'Content-Type':_0x5900('0xc'),'Accept':_0x5900('0xc')};function getTicket(_0x9cb77f,_0x5d27ef,_0x1a3dfa,_0x3e0ad9,_0x5685ce){logger['info'](_0x5900('0xd'));return request({'uri':util[_0x5900('0xe')](_0x5900('0xf'),_0x9cb77f[_0x5900('0x10')]),'method':_0x5900('0x11'),'body':{'ticket':_[_0x5900('0x12')]({'requester_id':_0x1a3dfa['id'],'submitter_id':_0x5d27ef?_0x5d27ef['id']:undefined,'assignee_id':_0x5d27ef?_0x5d27ef['id']:undefined,'tags':getTags(_0x3e0ad9[_0x5900('0x13')],_0x5900('0x14')),'subject':intUtil['getString'](_0x3e0ad9[_0x5900('0x15')],_0x5685ce,'\x20'),'description':intUtil[_0x5900('0x16')](_0x3e0ad9[_0x5900('0x17')],_0x5685ce,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x3e0ad9[_0x5900('0x17')],_0x5685ce,'\x0a')}},getCustomFields(_0x3e0ad9[_0x5900('0x18')],_0x5685ce))}})['then'](function(_0x194fbc){logger['info'](_0x5900('0x19'));return _0x194fbc[_0x5900('0x1a')];});}function getUser(_0x78b512,_0x5baf8a){if(intUtil['validateEmail'](_0x5baf8a)){logger[_0x5900('0x1b')](_0x5900('0x1c'),_0x5baf8a);return request({'uri':util[_0x5900('0xe')]('%s/search.json',_0x78b512['remoteUri']),'qs':{'query':util[_0x5900('0xe')](_0x5900('0x1d'),_0x5baf8a)}})[_0x5900('0x1e')](function(_0x3b07d9){if(_0x3b07d9[_0x5900('0x1f')]){logger['info']('Agent\x20found!');return _['find'](_0x3b07d9[_0x5900('0x20')],{'email':_0x5baf8a,'role':_0x5900('0x21')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5900('0xe')](_0x5900('0x22'),_0x78b512[_0x5900('0x10')])})[_0x5900('0x1e')](function(_0xd37df2){logger[_0x5900('0x1b')](_0x5900('0x23'));return _0xd37df2['user'];});}});}else{logger[_0x5900('0x1b')](_0x5900('0x24'));return request({'uri':util[_0x5900('0xe')](_0x5900('0x22'),_0x78b512[_0x5900('0x10')])})[_0x5900('0x1e')](function(_0x22eff3){logger[_0x5900('0x1b')]('Admin\x20account\x20selected.');return _0x22eff3[_0x5900('0x25')];});}}function getEndUser(_0x3b5db8,_0x4e4227,_0xc1123d){logger[_0x5900('0x1b')]('Searching\x20enduser\x20with\x20phone',_0xc1123d);return request({'uri':util[_0x5900('0xe')](_0x5900('0x26'),_0x3b5db8['remoteUri']),'qs':{'query':util[_0x5900('0xe')](_0x5900('0x27'),_0xc1123d)}})['then'](function(_0x3bd770){var _0x341291;if(_0x3bd770[_0x5900('0x20')][_0x5900('0x28')]){_0x3bd770[_0x5900('0x20')]=_[_0x5900('0x29')](_0x3bd770['results'],{'suspended':![],'role':_0x5900('0x2a')});if(_0x3bd770['results']['length']){_0x341291=_['first'](_0x3bd770[_0x5900('0x20')]);}}if(_0x341291){logger['info']('Enduser\x20found!');return _0x341291;}else{logger[_0x5900('0x1b')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x5900('0x2b'),_0x3b5db8[_0x5900('0x10')]),'method':_0x5900('0x11'),'body':{'user':{'role':_0x5900('0x2a'),'name':util[_0x5900('0xe')](_0x5900('0x2c'),_0x4e4227||_0xc1123d),'phone':_0xc1123d}}})[_0x5900('0x1e')](function(_0x2bca03){logger[_0x5900('0x1b')](_0x5900('0x2d'));return _0x2bca03[_0x5900('0x25')];});}});}function getAuth(_0x278b61){var _0x3d90c5;if(_0x278b61[_0x5900('0x2e')]===_0x5900('0x2f')){_0x3d90c5=util['format'](_0x5900('0x30'),_0x278b61[_0x5900('0x31')],_0x278b61['password']);}else if(_0x278b61[_0x5900('0x2e')]==='token'){_0x3d90c5=util[_0x5900('0xe')]('%s/token:%s',_0x278b61[_0x5900('0x31')],_0x278b61[_0x5900('0x32')]);}return util[_0x5900('0xe')](_0x5900('0x33'),new Buffer(_0x3d90c5)[_0x5900('0x34')](_0x5900('0x35')));}function request(_0x361c5f){logger[_0x5900('0x36')]('[HTTP]',JSON[_0x5900('0x37')](_0x361c5f));return rp(_['defaults'](_0x361c5f,{'method':_0x5900('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x377c2e,_0x42ccd2){var _0x431bbd=[];if(_0x377c2e&&_0x377c2e[_0x5900('0x28')]>0x0){_0x431bbd=_[_0x5900('0x39')](_0x377c2e,_0x42ccd2);}return _0x431bbd;}function getCustomFields(_0x45eabd,_0x527f3f){var _0x417fd6=[];var _0x20181c={'custom_fields':[]};if(_0x45eabd['length']>0x0){_[_0x5900('0x3a')](_0x45eabd,function(_0x1ecfc5){if(_[_0x5900('0x3b')]([_0x5900('0x3c'),_0x5900('0x3d')],_0x1ecfc5[_0x5900('0x3e')])&&_0x1ecfc5[_0x5900('0x3f')]&&!_0x1ecfc5[_0x5900('0x40')]){_0x20181c[_0x1ecfc5[_0x5900('0x3f')][_0x5900('0x41')]()]=_0x1ecfc5[_0x5900('0x42')][_0x5900('0x34')]();}else if(_[_0x5900('0x3b')]([_0x5900('0x3c'),_0x5900('0x3d')],_0x1ecfc5[_0x5900('0x3e')])&&_0x1ecfc5[_0x5900('0x43')]&&_0x1ecfc5['customField']){_0x20181c[_0x5900('0x44')][_0x5900('0x45')]({'id':_0x1ecfc5[_0x5900('0x43')],'value':_0x1ecfc5['content']['toString']()});}else if(_0x1ecfc5['type']===_0x5900('0x46')&&_0x1ecfc5['variableName']&&_0x1ecfc5[_0x5900('0x43')]&&_0x1ecfc5['customField']){_0x527f3f[_0x1ecfc5[_0x5900('0x47')]]&&_0x20181c['custom_fields']['push']({'id':_0x1ecfc5['idField'],'value':_0x527f3f[_0x1ecfc5['variableName']]['toString']()});}else if(_0x1ecfc5['type']===_0x5900('0x48')&&_0x1ecfc5['Variable']&&_0x1ecfc5[_0x5900('0x49')][_0x5900('0x14')]&&_0x1ecfc5[_0x5900('0x43')]&&_0x1ecfc5[_0x5900('0x40')]){_0x527f3f[_0x1ecfc5[_0x5900('0x49')]['name'][_0x5900('0x41')]()]&&_0x20181c['custom_fields']['push']({'id':_0x1ecfc5[_0x5900('0x43')],'value':_0x527f3f[_0x1ecfc5['Variable'][_0x5900('0x14')]['toLowerCase']()][_0x5900('0x34')]()});}});}return _0x20181c;}exports[_0x5900('0x4a')]=function(_0x425d21,_0x59d747,_0x3f490f,_0x4bab38,_0x3d3b92,_0x54f801){var _0x45b1d2,_0x2b2276;_0x54f801['remoteUri']=intUtil[_0x5900('0x4b')](_0x54f801[_0x5900('0x10')]);_0x54f801['serverUrl']=intUtil[_0x5900('0x4b')](_0x54f801[_0x5900('0x4c')]);if(_0x3d3b92&&_0x3d3b92[_0x5900('0x4d')]){logger[_0x5900('0x1b')]('[QUEUE]','Recording\x20is\x20enabled!');_0x59d747['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x54f801[_0x5900('0x4c')],_0x59d747[_0x5900('0x4e')],md5(_0x59d747[_0x5900('0x4e')]));}else{_0x59d747[_0x5900('0x4f')]='';}headers[_0x5900('0x50')]=getAuth(_0x54f801);return getUser(_0x54f801,_0x4bab38[_0x5900('0x51')])['then'](function(_0x11f3d8){_0x45b1d2=_0x11f3d8;logger[_0x5900('0x1b')]('The\x20User\x20ID\x20is:',_0x45b1d2['id']);return getEndUser(_0x54f801,_0x59d747[_0x5900('0x52')],_0x59d747[_0x5900('0x53')]);})[_0x5900('0x1e')](function(_0x5debd8){_0x2b2276=_0x5debd8;logger['info'](_0x5900('0x54'),_0x2b2276['id']);return getTicket(_0x54f801,_0x45b1d2,_0x2b2276,_0x3f490f,_0x59d747);})[_0x5900('0x1e')](function(_0x5e907b){if(_0x5e907b){logger[_0x5900('0x1b')](_0x5900('0x55'),_0x5e907b['id']);switch(_0x54f801[_0x5900('0x3e')]){case'integrationTab':logger[_0x5900('0x1b')](_0x5900('0x56'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x54f801['remoteUri'],_0x45b1d2['id'],_0x5e907b['id']),'method':'POST'});case'newTab':logger[_0x5900('0x1b')](_0x5900('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5900('0xe')](_0x5900('0x57'),_0x4bab38[_0x5900('0x14')]),_0x5900('0x58'),{'uri':util[_0x5900('0xe')](_0x5900('0x59'),_0x54f801[_0x5900('0x10')][_0x5900('0x5a')](_0x5900('0x5b'),''),_0x5e907b['id'])});break;default:logger['error']('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x5900('0x5c')](function(_0x41dc49){logger[_0x5900('0x5d')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x5900('0x5e')](_0x41dc49,{'showHidden':!![],'depth':null}));});};exports[_0x5900('0x5f')]=function(_0x1b61e8,_0x2e10ad,_0x43b2d4,_0x7ad18a,_0x5bae53,_0xecef1f,_0x2648ab){var _0x7e9449,_0x21f3a0;_0xecef1f[_0x5900('0x10')]=intUtil[_0x5900('0x4b')](_0xecef1f[_0x5900('0x10')]);_0xecef1f[_0x5900('0x4c')]=intUtil[_0x5900('0x4b')](_0xecef1f[_0x5900('0x4c')]);if(_0x2648ab&&_0x2648ab[_0x5900('0x60')]&&_0x2648ab[_0x5900('0x60')]!==_0x5900('0x61')){logger[_0x5900('0x1b')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2e10ad[_0x5900('0x4f')]=util[_0x5900('0xe')](_0x5900('0x62'),_0xecef1f[_0x5900('0x4c')],_0x2e10ad[_0x5900('0x4e')],md5(_0x2e10ad['uniqueid']));}headers[_0x5900('0x50')]=getAuth(_0xecef1f);return getUser(_0xecef1f,_0x7ad18a['email'])[_0x5900('0x1e')](function(_0x44ad48){_0x7e9449=_0x44ad48;logger[_0x5900('0x1b')](_0x5900('0x63'),_0x7e9449['id']);return getEndUser(_0xecef1f,_0x2e10ad[_0x5900('0x64')],_0x2e10ad[_0x5900('0x65')]);})['then'](function(_0xf27e8b){_0x21f3a0=_0xf27e8b;logger[_0x5900('0x1b')](_0x5900('0x54'),_0x21f3a0['id']);return getTicket(_0xecef1f,_0x7e9449,_0x21f3a0,_0x43b2d4,_0x2e10ad);})[_0x5900('0x1e')](function(_0x48d647){if(_0x48d647){logger[_0x5900('0x1b')](_0x5900('0x55'),_0x48d647['id']);switch(_0xecef1f[_0x5900('0x3e')]){case _0x5900('0x66'):logger[_0x5900('0x1b')](_0x5900('0x67'),_0x5900('0x68'));return request({'uri':util[_0x5900('0xe')](_0x5900('0x69'),_0xecef1f['remoteUri'],_0x7e9449['id'],_0x48d647['id']),'method':_0x5900('0x11')});case _0x5900('0x6a'):logger['info'](_0x5900('0x67'),_0x5900('0x6b'));emit(util[_0x5900('0xe')](_0x5900('0x57'),_0x7ad18a[_0x5900('0x14')]),'trigger:browser:url',{'uri':util['format'](_0x5900('0x59'),_0xecef1f['remoteUri'][_0x5900('0x5a')](_0x5900('0x5b'),''),_0x48d647['id'])});break;default:logger[_0x5900('0x5d')](_0x5900('0x67'),_0x5900('0x6c'));}}})['catch'](function(_0x22ddda){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x5900('0x5e')](_0x22ddda,{'showHidden':!![],'depth':null}));});};exports[_0x5900('0x6d')]=function(_0x49b7c8,_0x286ed6,_0x493c84,_0x5a3faa,_0xe96866,_0x43e915){var _0x57a96d,_0x4975a4;_0x43e915['remoteUri']=intUtil[_0x5900('0x4b')](_0x43e915['remoteUri']);_0x43e915['serverUrl']=intUtil[_0x5900('0x4b')](_0x43e915[_0x5900('0x4c')]);if(_0xe96866&&_0xe96866[_0x5900('0x4d')]){logger[_0x5900('0x1b')]('['+_0x286ed6[_0x5900('0x6e')][_0x5900('0x6f')]()+']',_0x5900('0x70'));_0x286ed6['recordingURL']=util[_0x5900('0xe')](_0x5900('0x62'),_0x43e915[_0x5900('0x4c')],_0x286ed6[_0x5900('0x4e')],md5(_0x286ed6['uniqueid']));}else{_0x286ed6[_0x5900('0x4f')]='';}headers['Authorization']=getAuth(_0x43e915);return getUser(_0x43e915)[_0x5900('0x1e')](function(_0x32d40c){_0x57a96d=_0x32d40c;logger[_0x5900('0x1b')](_0x5900('0x63'),_0x57a96d['id']);return getEndUser(_0x43e915,_0x286ed6['calleridname'],_0x286ed6[_0x5900('0x53')]);})[_0x5900('0x1e')](function(_0x185e40){_0x4975a4=_0x185e40;logger[_0x5900('0x1b')](_0x5900('0x54'),_0x4975a4['id']);return getTicket(_0x43e915,_0x57a96d,_0x4975a4,_0x493c84,_0x286ed6);})['then'](function(_0x25ea63){if(_0x25ea63){logger[_0x5900('0x1b')](_0x5900('0x55'),_0x25ea63['id']);}})[_0x5900('0x5c')](function(_0x8e5c62){logger[_0x5900('0x5d')]('['+_0x286ed6['lastevent'][_0x5900('0x6f')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x8e5c62,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf024=['forEach','string','picklist','type','nameField','customField','toLowerCase','content','includes','idField','custom_fields','push','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','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:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','[OUTBOUND]','%s/agent/tickets/%s','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','toUpperCase','calleridnum','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map'];(function(_0x31be28,_0x598de7){var _0x4d23f2=function(_0x53828e){while(--_0x53828e){_0x31be28['push'](_0x31be28['shift']());}};_0x4d23f2(++_0x598de7);}(_0xf024,0x18e));var _0x4f02=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xf024[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x4f02('0x0'));var rp=require(_0x4f02('0x1'));var md5=require('md5');var util=require(_0x4f02('0x2'));var Redis=require(_0x4f02('0x3'));var intUtil=require(_0x4f02('0x4'));var config=require(_0x4f02('0x5'));var logger=require(_0x4f02('0x6'))(_0x4f02('0x7'));config[_0x4f02('0x8')]=_[_0x4f02('0x9')](config[_0x4f02('0x8')],{'host':_0x4f02('0xa'),'port':0x18eb});var io=require(_0x4f02('0xb'))(new Redis(config[_0x4f02('0x8')]));function emit(_0x584b45,_0x1304e1,_0x45c542){io['to'](_0x584b45)[_0x4f02('0xc')](_0x1304e1,_0x45c542);}var headers={'Content-Type':_0x4f02('0xd'),'Accept':_0x4f02('0xd')};function getTicket(_0x2be7bb,_0x59ab9c,_0x33cb71,_0x9e7f43,_0x10e332){logger[_0x4f02('0xe')](_0x4f02('0xf'));return request({'uri':util[_0x4f02('0x10')](_0x4f02('0x11'),_0x2be7bb[_0x4f02('0x12')]),'method':_0x4f02('0x13'),'body':{'ticket':_['merge']({'requester_id':_0x33cb71['id'],'submitter_id':_0x59ab9c?_0x59ab9c['id']:undefined,'assignee_id':_0x59ab9c?_0x59ab9c['id']:undefined,'tags':getTags(_0x9e7f43[_0x4f02('0x14')],_0x4f02('0x15')),'subject':intUtil[_0x4f02('0x16')](_0x9e7f43['Subjects'],_0x10e332,'\x20'),'description':intUtil[_0x4f02('0x16')](_0x9e7f43[_0x4f02('0x17')],_0x10e332,'\x0a'),'comment':{'public':![],'body':intUtil[_0x4f02('0x16')](_0x9e7f43[_0x4f02('0x17')],_0x10e332,'\x0a')}},getCustomFields(_0x9e7f43[_0x4f02('0x18')],_0x10e332))}})[_0x4f02('0x19')](function(_0x5bf847){logger[_0x4f02('0xe')](_0x4f02('0x1a'));return _0x5bf847[_0x4f02('0x1b')];});}function getUser(_0x8070b,_0x3c9a79){if(intUtil[_0x4f02('0x1c')](_0x3c9a79)){logger[_0x4f02('0xe')](_0x4f02('0x1d'),_0x3c9a79);return request({'uri':util['format']('%s/search.json',_0x8070b[_0x4f02('0x12')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x3c9a79)}})['then'](function(_0x233f20){if(_0x233f20[_0x4f02('0x1e')]){logger['info'](_0x4f02('0x1f'));return _[_0x4f02('0x20')](_0x233f20[_0x4f02('0x21')],{'email':_0x3c9a79,'role':'agent'});}else{logger[_0x4f02('0xe')](_0x4f02('0x22'));return request({'uri':util[_0x4f02('0x10')](_0x4f02('0x23'),_0x8070b[_0x4f02('0x12')])})['then'](function(_0x252466){logger[_0x4f02('0xe')](_0x4f02('0x24'));return _0x252466[_0x4f02('0x25')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x4f02('0x23'),_0x8070b[_0x4f02('0x12')])})[_0x4f02('0x19')](function(_0x2b3fef){logger[_0x4f02('0xe')]('Admin\x20account\x20selected.');return _0x2b3fef['user'];});}}function getEndUser(_0x452299,_0x28a9a4,_0x5efeb0){logger['info'](_0x4f02('0x26'),_0x5efeb0);return request({'uri':util[_0x4f02('0x10')](_0x4f02('0x27'),_0x452299[_0x4f02('0x12')]),'qs':{'query':util[_0x4f02('0x10')](_0x4f02('0x28'),_0x5efeb0)}})['then'](function(_0x226c2c){var _0x52bb85;if(_0x226c2c[_0x4f02('0x21')][_0x4f02('0x29')]){_0x226c2c[_0x4f02('0x21')]=_[_0x4f02('0x2a')](_0x226c2c['results'],{'suspended':![],'role':_0x4f02('0x2b')});if(_0x226c2c[_0x4f02('0x21')][_0x4f02('0x29')]){_0x52bb85=_[_0x4f02('0x2c')](_0x226c2c[_0x4f02('0x21')]);}}if(_0x52bb85){logger[_0x4f02('0xe')](_0x4f02('0x2d'));return _0x52bb85;}else{logger[_0x4f02('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x4f02('0x10')]('%s/users.json',_0x452299['remoteUri']),'method':_0x4f02('0x13'),'body':{'user':{'role':_0x4f02('0x2b'),'name':util[_0x4f02('0x10')](_0x4f02('0x2e'),_0x28a9a4||_0x5efeb0),'phone':_0x5efeb0}}})['then'](function(_0x3fe2f0){logger[_0x4f02('0xe')](_0x4f02('0x2f'));return _0x3fe2f0['user'];});}});}function getAuth(_0x1187c2){var _0x380c39;if(_0x1187c2[_0x4f02('0x30')]==='password'){_0x380c39=util['format'](_0x4f02('0x31'),_0x1187c2[_0x4f02('0x32')],_0x1187c2[_0x4f02('0x33')]);}else if(_0x1187c2[_0x4f02('0x30')]===_0x4f02('0x34')){_0x380c39=util[_0x4f02('0x10')](_0x4f02('0x35'),_0x1187c2[_0x4f02('0x32')],_0x1187c2[_0x4f02('0x34')]);}return util['format'](_0x4f02('0x36'),new Buffer(_0x380c39)[_0x4f02('0x37')](_0x4f02('0x38')));}function request(_0x383373){logger[_0x4f02('0x39')](_0x4f02('0x3a'),JSON[_0x4f02('0x3b')](_0x383373));return rp(_['defaults'](_0x383373,{'method':_0x4f02('0x3c'),'headers':headers,'json':!![]}));}function getTags(_0x4079b8,_0x1aae7d){var _0x5f876d=[];if(_0x4079b8&&_0x4079b8[_0x4f02('0x29')]>0x0){_0x5f876d=_[_0x4f02('0x3d')](_0x4079b8,_0x1aae7d);}return _0x5f876d;}function getCustomFields(_0xbea01e,_0x40f9c9){var _0x3e48ba=[];var _0x1e3262={'custom_fields':[]};if(_0xbea01e[_0x4f02('0x29')]>0x0){_[_0x4f02('0x3e')](_0xbea01e,function(_0x95df2c){if(_['includes']([_0x4f02('0x3f'),_0x4f02('0x40')],_0x95df2c[_0x4f02('0x41')])&&_0x95df2c[_0x4f02('0x42')]&&!_0x95df2c[_0x4f02('0x43')]){_0x1e3262[_0x95df2c[_0x4f02('0x42')][_0x4f02('0x44')]()]=_0x95df2c[_0x4f02('0x45')][_0x4f02('0x37')]();}else if(_[_0x4f02('0x46')]([_0x4f02('0x3f'),_0x4f02('0x40')],_0x95df2c[_0x4f02('0x41')])&&_0x95df2c[_0x4f02('0x47')]&&_0x95df2c['customField']){_0x1e3262[_0x4f02('0x48')][_0x4f02('0x49')]({'id':_0x95df2c[_0x4f02('0x47')],'value':_0x95df2c[_0x4f02('0x45')]['toString']()});}else if(_0x95df2c['type']==='variable'&&_0x95df2c[_0x4f02('0x4a')]&&_0x95df2c[_0x4f02('0x47')]&&_0x95df2c[_0x4f02('0x43')]){_0x40f9c9[_0x95df2c[_0x4f02('0x4a')]]&&_0x1e3262[_0x4f02('0x48')][_0x4f02('0x49')]({'id':_0x95df2c[_0x4f02('0x47')],'value':_0x40f9c9[_0x95df2c[_0x4f02('0x4a')]][_0x4f02('0x37')]()});}else if(_0x95df2c[_0x4f02('0x41')]===_0x4f02('0x4b')&&_0x95df2c[_0x4f02('0x4c')]&&_0x95df2c[_0x4f02('0x4c')]['name']&&_0x95df2c[_0x4f02('0x47')]&&_0x95df2c[_0x4f02('0x43')]){_0x40f9c9[_0x95df2c[_0x4f02('0x4c')]['name'][_0x4f02('0x44')]()]&&_0x1e3262[_0x4f02('0x48')][_0x4f02('0x49')]({'id':_0x95df2c[_0x4f02('0x47')],'value':_0x40f9c9[_0x95df2c['Variable'][_0x4f02('0x15')][_0x4f02('0x44')]()][_0x4f02('0x37')]()});}});}return _0x1e3262;}exports['queue']=function(_0x1d678c,_0x4cb109,_0x379b3d,_0x252983,_0x271bd9,_0x436cf7){var _0x2bd497,_0xd96755;_0x436cf7['remoteUri']=intUtil[_0x4f02('0x4d')](_0x436cf7[_0x4f02('0x12')]);_0x436cf7[_0x4f02('0x4e')]=intUtil[_0x4f02('0x4d')](_0x436cf7[_0x4f02('0x4e')]);if(_0x271bd9&&_0x271bd9[_0x4f02('0x4f')]){logger[_0x4f02('0xe')]('[QUEUE]','Recording\x20is\x20enabled!');_0x4cb109[_0x4f02('0x50')]=util['format'](_0x4f02('0x51'),_0x436cf7['serverUrl'],_0x4cb109[_0x4f02('0x52')],md5(_0x4cb109[_0x4f02('0x52')]));}else{_0x4cb109[_0x4f02('0x50')]='';}headers[_0x4f02('0x53')]=getAuth(_0x436cf7);return getUser(_0x436cf7,_0x252983[_0x4f02('0x54')])[_0x4f02('0x19')](function(_0x2fce9d){_0x2bd497=_0x2fce9d;logger[_0x4f02('0xe')](_0x4f02('0x55'),_0x2bd497['id']);return getEndUser(_0x436cf7,_0x4cb109[_0x4f02('0x56')],_0x4cb109['calleridnum']);})[_0x4f02('0x19')](function(_0x1e9c86){_0xd96755=_0x1e9c86;logger[_0x4f02('0xe')](_0x4f02('0x57'),_0xd96755['id']);return getTicket(_0x436cf7,_0x2bd497,_0xd96755,_0x379b3d,_0x4cb109);})[_0x4f02('0x19')](function(_0x186494){if(_0x186494){logger[_0x4f02('0xe')](_0x4f02('0x58'),_0x186494['id']);switch(_0x436cf7[_0x4f02('0x41')]){case _0x4f02('0x59'):logger['info']('[QUEUE]',_0x4f02('0x5a'));return request({'uri':util[_0x4f02('0x10')](_0x4f02('0x5b'),_0x436cf7[_0x4f02('0x12')],_0x2bd497['id'],_0x186494['id']),'method':'POST'});case _0x4f02('0x5c'):logger[_0x4f02('0xe')](_0x4f02('0x5d'),_0x4f02('0x5e'));emit(util[_0x4f02('0x10')]('user:%s',_0x252983[_0x4f02('0x15')]),_0x4f02('0x5f'),{'uri':util['format']('%s/agent/tickets/%s',_0x436cf7['remoteUri'][_0x4f02('0x60')](_0x4f02('0x61'),''),_0x186494['id'])});break;default:logger[_0x4f02('0x62')](_0x4f02('0x5d'),_0x4f02('0x63'));}}})['catch'](function(_0x34164f){logger[_0x4f02('0x62')](_0x4f02('0x64'),util[_0x4f02('0x65')](_0x34164f,{'showHidden':!![],'depth':null}));});};exports[_0x4f02('0x66')]=function(_0x51ded8,_0x2da84c,_0x4dee96,_0x3b294e,_0x3e3f3f,_0x285233,_0x101512){var _0x57567f,_0x5614fc;_0x285233[_0x4f02('0x12')]=intUtil['stripTrailingSlash'](_0x285233[_0x4f02('0x12')]);_0x285233['serverUrl']=intUtil['stripTrailingSlash'](_0x285233['serverUrl']);if(_0x101512&&_0x101512[_0x4f02('0x67')]&&_0x101512[_0x4f02('0x67')]!==_0x4f02('0x68')){logger[_0x4f02('0xe')]('[OUTBOUND]',_0x4f02('0x69'));_0x2da84c['recordingURL']=util[_0x4f02('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x285233[_0x4f02('0x4e')],_0x2da84c['uniqueid'],md5(_0x2da84c[_0x4f02('0x52')]));}headers[_0x4f02('0x53')]=getAuth(_0x285233);return getUser(_0x285233,_0x3b294e[_0x4f02('0x54')])[_0x4f02('0x19')](function(_0x57a15e){_0x57567f=_0x57a15e;logger[_0x4f02('0xe')](_0x4f02('0x55'),_0x57567f['id']);return getEndUser(_0x285233,_0x2da84c[_0x4f02('0x6a')],_0x2da84c['destcalleridnum']);})[_0x4f02('0x19')](function(_0x40b11d){_0x5614fc=_0x40b11d;logger['info'](_0x4f02('0x57'),_0x5614fc['id']);return getTicket(_0x285233,_0x57567f,_0x5614fc,_0x4dee96,_0x2da84c);})['then'](function(_0x3393c9){if(_0x3393c9){logger[_0x4f02('0xe')](_0x4f02('0x58'),_0x3393c9['id']);switch(_0x285233[_0x4f02('0x41')]){case _0x4f02('0x59'):logger[_0x4f02('0xe')]('[OUTBOUND]',_0x4f02('0x5a'));return request({'uri':util[_0x4f02('0x10')](_0x4f02('0x5b'),_0x285233[_0x4f02('0x12')],_0x57567f['id'],_0x3393c9['id']),'method':_0x4f02('0x13')});case _0x4f02('0x5c'):logger[_0x4f02('0xe')](_0x4f02('0x6b'),_0x4f02('0x5e'));emit(util[_0x4f02('0x10')]('user:%s',_0x3b294e[_0x4f02('0x15')]),'trigger:browser:url',{'uri':util[_0x4f02('0x10')](_0x4f02('0x6c'),_0x285233['remoteUri'][_0x4f02('0x60')]('/api/v2',''),_0x3393c9['id'])});break;default:logger[_0x4f02('0x62')](_0x4f02('0x6b'),_0x4f02('0x63'));}}})[_0x4f02('0x6d')](function(_0x96afd9){logger[_0x4f02('0x62')](_0x4f02('0x6e'),util[_0x4f02('0x65')](_0x96afd9,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x55647f,_0x1d28f6,_0xedc7c0,_0x13928a,_0x9e7daa,_0x552a08){var _0x368296,_0x536c6b;_0x552a08['remoteUri']=intUtil['stripTrailingSlash'](_0x552a08[_0x4f02('0x12')]);_0x552a08[_0x4f02('0x4e')]=intUtil['stripTrailingSlash'](_0x552a08[_0x4f02('0x4e')]);if(_0x9e7daa&&_0x9e7daa['monitor_format']){logger[_0x4f02('0xe')]('['+_0x1d28f6['lastevent'][_0x4f02('0x6f')]()+']',_0x4f02('0x69'));_0x1d28f6[_0x4f02('0x50')]=util[_0x4f02('0x10')](_0x4f02('0x51'),_0x552a08[_0x4f02('0x4e')],_0x1d28f6[_0x4f02('0x52')],md5(_0x1d28f6[_0x4f02('0x52')]));}else{_0x1d28f6[_0x4f02('0x50')]='';}headers[_0x4f02('0x53')]=getAuth(_0x552a08);return getUser(_0x552a08)[_0x4f02('0x19')](function(_0xa59832){_0x368296=_0xa59832;logger[_0x4f02('0xe')](_0x4f02('0x55'),_0x368296['id']);return getEndUser(_0x552a08,_0x1d28f6[_0x4f02('0x56')],_0x1d28f6[_0x4f02('0x70')]);})[_0x4f02('0x19')](function(_0x5990af){_0x536c6b=_0x5990af;logger[_0x4f02('0xe')](_0x4f02('0x57'),_0x536c6b['id']);return getTicket(_0x552a08,_0x368296,_0x536c6b,_0xedc7c0,_0x1d28f6);})[_0x4f02('0x19')](function(_0x13ff04){if(_0x13ff04){logger[_0x4f02('0xe')]('The\x20Ticket\x20ID\x20is:',_0x13ff04['id']);}})['catch'](function(_0x180587){logger[_0x4f02('0x62')]('['+_0x1d28f6[_0x4f02('0x71')][_0x4f02('0x6f')]()+']'+_0x4f02('0x72'),util[_0x4f02('0x65')](_0x180587,{'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 4437a4c..205e90f 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 _0x57f8=['lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Called','connect','Call_Result','Answered','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','stack','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Call\x20ID\x20is:','https://crm.','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','/api/voice/recordings/','/downloads?type=uniqueid&token=','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','users','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','nothing'];(function(_0x3b2369,_0x4c68b9){var _0x5a1367=function(_0x58ddcf){while(--_0x58ddcf){_0x3b2369['push'](_0x3b2369['shift']());}};_0x5a1367(++_0x4c68b9);}(_0x57f8,0x198));var _0x857f=function(_0x3f8ca7,_0x1cfd75){_0x3f8ca7=_0x3f8ca7-0x0;var _0x2ef97e=_0x57f8[_0x3f8ca7];return _0x2ef97e;};'use strict';var _=require('lodash');var rp=require(_0x857f('0x0'));var md5=require(_0x857f('0x1'));var util=require(_0x857f('0x2'));var intUtil=require(_0x857f('0x3'));var moment=require(_0x857f('0x4'));var Redis=require(_0x857f('0x5'));var BPromise=require(_0x857f('0x6'));var config=require(_0x857f('0x7'));var logger=require(_0x857f('0x8'))(_0x857f('0x9'));config[_0x857f('0xa')]=_[_0x857f('0xb')](config['redis'],{'host':_0x857f('0xc'),'port':0x18eb});var io=require(_0x857f('0xd'))(new Redis(config[_0x857f('0xa')]));function emit(_0x577fc3,_0x5f6a66,_0x135855){io['to'](_0x577fc3)[_0x857f('0xe')](_0x5f6a66,_0x135855);}function request(_0x4f2b09){logger[_0x857f('0xf')](_0x857f('0x10'),JSON[_0x857f('0x11')](_0x4f2b09));return rp(_0x4f2b09);}function getCustomFields(_0x5cc993,_0xefee53){var _0x360827={};if(_0x5cc993[_0x857f('0x12')]>0x0){_[_0x857f('0x13')](_0x5cc993,function(_0x268f9d){if(_[_0x857f('0x14')]([_0x857f('0x15'),'picklist'],_0x268f9d[_0x857f('0x16')])&&_0x268f9d[_0x857f('0x17')]){_0x360827[_0x268f9d[_0x857f('0x17')]]=_0x268f9d[_0x857f('0x18')][_0x857f('0x19')]();}else if(_0x268f9d['type']==='variable'&&_0x268f9d[_0x857f('0x1a')]&&_0x268f9d['idField']&&_0xefee53[_0x268f9d[_0x857f('0x1a')]]){_0x360827[_0x268f9d['idField']]=_0xefee53[_0x268f9d[_0x857f('0x1a')]][_0x857f('0x19')]();}else if(_0x268f9d['type']===_0x857f('0x1b')&&_0x268f9d[_0x857f('0x1c')]&&_0x268f9d[_0x857f('0x1c')][_0x857f('0x1d')]&&_0x268f9d[_0x857f('0x17')]&&_0xefee53[_0x268f9d[_0x857f('0x1c')][_0x857f('0x1d')][_0x857f('0x1e')]()]){_0x360827[_0x268f9d[_0x857f('0x17')]]=_0xefee53[_0x268f9d[_0x857f('0x1c')][_0x857f('0x1d')]['toLowerCase']()][_0x857f('0x19')]();}});}return _0x360827;}function getName(_0x1e8fd4){if(_0x1e8fd4['indexOf']('\x20')>0x0){var _0x412b42=_0x1e8fd4[_0x857f('0x1f')](/ (.+)/);if(_0x412b42[0x1]){return _0x412b42;}}return[_0x1e8fd4,_0x1e8fd4];}var accountsTokens={};function getAccessToken(_0x377587){return new Promise(function(_0x484035,_0x57fa8b){if(!_[_0x857f('0x20')](accountsTokens[_0x377587['id']])&&!_[_0x857f('0x20')](accountsTokens[_0x377587['id']][_0x857f('0x21')])){if(moment()['isBefore'](accountsTokens[_0x377587['id']][_0x857f('0x22')])){_0x484035(accountsTokens[_0x377587['id']][_0x857f('0x21')]);}}var _0xdf8ac3;switch(_0x377587['zone']){case'US':_0xdf8ac3=_0x857f('0x23');break;case'AU':_0xdf8ac3=_0x857f('0x24');break;case'EU':_0xdf8ac3='https://accounts.zoho.eu';break;case'IN':_0xdf8ac3=_0x857f('0x25');break;case'CN':_0xdf8ac3=_0x857f('0x26');break;default:_0xdf8ac3=_0x857f('0x27');break;}var _0x44ff23={'method':_0x857f('0x28'),'uri':_0xdf8ac3+_0x857f('0x29'),'qs':{'refresh_token':_0x377587[_0x857f('0x2a')],'client_id':_0x377587[_0x857f('0x2b')],'client_secret':_0x377587[_0x857f('0x2c')],'grant_type':_0x857f('0x2d')},'json':!![]};return rp(_0x44ff23)[_0x857f('0x2e')](function(_0x4782ab){accountsTokens[_0x377587['id']]={'access_token':_0x4782ab[_0x857f('0x21')],'expires_in':moment()[_0x857f('0x2f')](_0x4782ab['expires_in'],_0x857f('0x30'))};_0x484035(_0x4782ab[_0x857f('0x21')]);})[_0x857f('0x31')](function(_0x2c5792){logger['error'](_0x857f('0x32'),_0x2c5792['stack']);_0x57fa8b(_0x2c5792);});});}function getUser(_0x1b405a,_0x234048,_0x45a37f,_0x2ab814){logger[_0x857f('0x33')](_0x857f('0x34'));return request({'method':_0x857f('0x35'),'uri':util[_0x857f('0x36')](_0x857f('0x37'),_0x234048),'qs':{'type':_0x857f('0x38')},'headers':{'Authorization':_0x857f('0x39')+_0x1b405a},'json':!![]})[_0x857f('0x2e')](function(_0x30f6cc){if(_0x30f6cc['users']){var _0x3078cf=-0x1;if(_[_0x857f('0x3a')](_0x30f6cc['users'])){if(!_[_0x857f('0x20')](_0x2ab814)){_0x3078cf=_[_0x857f('0x3b')](_0x30f6cc['users'],function(_0x2262c6){return _0x2262c6[_0x857f('0x3c')]===_0x2ab814;});}if(_0x3078cf>=0x0){logger['info'](_0x857f('0x3d'));}else{logger[_0x857f('0x33')](_0x857f('0x3e'));_0x3078cf=_[_0x857f('0x3b')](_0x30f6cc['users'],function(_0x596b2f){return _0x596b2f[_0x857f('0x3f')][_0x857f('0x1d')]==='Administrator';});}return _0x30f6cc[_0x857f('0x40')][_0x3078cf];}else{if(_0x30f6cc['user'][_0x857f('0x3f')][_0x857f('0x1d')]===_0x857f('0x41')){logger[_0x857f('0x33')](_0x857f('0x3e'));user=_0x30f6cc['user'];return user;}else{logger['error'](_0x857f('0x42'),JSON['stringify'](_0x30f6cc));throw new Error(_0x857f('0x43')+JSON[_0x857f('0x11')](_0x30f6cc));}}}else{logger[_0x857f('0x44')]('The\x20failing\x20result\x20is',JSON[_0x857f('0x11')](_0x30f6cc));throw new Error(_0x857f('0x43')+JSON[_0x857f('0x11')](_0x30f6cc));}})[_0x857f('0x31')](function(_0x36e6bd){console[_0x857f('0x44')](_0x36e6bd);});}function getZohoUser(_0x176e03,_0x5ad412){return new BPromise(function(_0x458c67,_0x3bfa79){request(_0x176e03)[_0x857f('0x2e')](function(_0x28ffe4){var _0x8b3058=null;if(_0x28ffe4){_0x8b3058=_0x28ffe4[_0x857f('0x45')][0x0];_0x8b3058[_0x857f('0x46')]=_0x5ad412;}_0x458c67(_0x8b3058);})['catch'](function(_0xc2a6a0){_0x3bfa79(_0xc2a6a0);});});}function createEndUser(_0x18ee30,_0xcd5959,_0xc2ac41,_0x196c95,_0x1c119f,_0x4c7025){var _0xc2ac41=getName(_0xc2ac41);return request({'method':_0x857f('0x28'),'uri':_0x857f('0x47')+_0xcd5959+_0x857f('0x48')+_[_0x857f('0x49')](_0x4c7025[_0x857f('0x4a')])+'s','body':{'data':[{'Last_Name':_0xc2ac41[0x1],'First_Name':_0xc2ac41[0x0],'Phone':_0x196c95,'Owner':{'name':!_[_0x857f('0x20')](_0x1c119f[_0x857f('0x4b')]['name'])?_0x1c119f[_0x857f('0x4b')][_0x857f('0x1d')]:!_[_0x857f('0x20')](_0x1c119f[_0x857f('0x4c')])?_0x1c119f[_0x857f('0x4c')]+'\x20'+_0x1c119f[_0x857f('0x4d')]:_0x1c119f[_0x857f('0x4d')],'id':_0x1c119f['id']}}]},'headers':{'Authorization':_0x857f('0x39')+_0x18ee30},'json':!![]})[_0x857f('0x2e')](function(_0x3e2079){if(_0x3e2079&&_0x3e2079[_0x857f('0x45')][0x0][_0x857f('0x4e')]===_0x857f('0x4f')){var _0x376f71=_0x3e2079['data'][0x0][_0x857f('0x50')];_0x376f71['enduserType']=_[_0x857f('0x49')](_0x4c7025[_0x857f('0x4a')])+'s';return _0x376f71;}logger[_0x857f('0x44')](_0x857f('0x42'),JSON[_0x857f('0x11')](data));throw new Error(_0x857f('0x51')+JSON[_0x857f('0x11')](data));})[_0x857f('0x31')](function(_0x436a4b){console[_0x857f('0x52')](_0x857f('0x53'),_0x436a4b);});}function getEndUser(_0x4b2e77,_0x5a0af1,_0x865fc2,_0x4bb77a,_0x2da9ff,_0x52f82c,_0x3a9a87){var _0x3cf4ed={'method':_0x857f('0x35'),'uri':'','headers':{'Authorization':_0x857f('0x39')+_0x4b2e77},'json':!![]};switch(_0x3a9a87[_0x857f('0x54')]){case _0x857f('0x55'):_0x3cf4ed[_0x857f('0x56')]=_0x857f('0x47')+_0x5a0af1+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2da9ff+'))';return getZohoUser(_0x3cf4ed,_0x857f('0x57'))[_0x857f('0x2e')](function(_0x3806d4){if(_0x3806d4)return _0x3806d4;_0x3cf4ed[_0x857f('0x56')]='https://www.zohoapis.'+_0x5a0af1+_0x857f('0x58')+_0x2da9ff+'))';return getZohoUser(_0x3cf4ed,_0x857f('0x59'))[_0x857f('0x2e')](function(_0x736ef6){if(_0x736ef6)return _0x736ef6;if(_0x3a9a87[_0x857f('0x4a')]!='nothing'){return createEndUser(_0x4b2e77,_0x5a0af1,_0x4bb77a,_0x2da9ff,_0x52f82c,_0x3a9a87);}else{return{};}});});break;case _0x857f('0x5a'):_0x3cf4ed[_0x857f('0x56')]='https://www.zohoapis.'+_0x5a0af1+_0x857f('0x5b')+_0x2da9ff+'))';return getZohoUser(_0x3cf4ed,_0x857f('0x57'))['then'](function(_0x370a30){if(_0x370a30)return _0x370a30;if(_0x3a9a87['moduleCreate']!=_0x857f('0x5c')){return createEndUser(_0x4b2e77,_0x5a0af1,_0x4bb77a,_0x2da9ff,_0x52f82c,_0x3a9a87);}else{return{};}});break;case _0x857f('0x5d'):_0x3cf4ed[_0x857f('0x56')]=_0x857f('0x47')+_0x5a0af1+_0x857f('0x58')+_0x2da9ff+'))';return getZohoUser(_0x3cf4ed,_0x857f('0x59'))[_0x857f('0x2e')](function(_0x2d9364){if(_0x2d9364)return _0x2d9364;if(_0x3a9a87[_0x857f('0x4a')]!=_0x857f('0x5c')){return createEndUser(_0x4b2e77,_0x5a0af1,_0x4bb77a,_0x2da9ff,_0x52f82c,_0x3a9a87);}else{return{};}});break;}}function getCall(_0x4f9d24,_0x5464f4,_0x13ef75,_0x9d8273,_0x2670e6,_0x3e24a5,_0x9edee5,_0x12712a){logger['info'](_0x857f('0x5e'));var _0x1036a8={};_0x1036a8[_0x857f('0x5f')]={'name':!_[_0x857f('0x20')](_0x9d8273[_0x857f('0x4b')][_0x857f('0x1d')])&&!_['isNil'](_0x9d8273[_0x857f('0x3f')][_0x857f('0x1d')])&&_0x9d8273[_0x857f('0x3f')][_0x857f('0x1d')]===_0x857f('0x60')?_0x9d8273[_0x857f('0x4b')][_0x857f('0x1d')]:!_[_0x857f('0x20')](_0x9d8273['first_name'])?_0x9d8273['first_name']+'\x20'+_0x9d8273[_0x857f('0x4d')]:_0x9d8273[_0x857f('0x4d')],'id':_0x9d8273['id']};_0x1036a8[_0x857f('0x61')]=intUtil[_0x857f('0x62')](_0x3e24a5[_0x857f('0x63')],_0x9edee5,'\x20');_0x1036a8[_0x857f('0x64')]=intUtil['getString'](_0x3e24a5[_0x857f('0x65')],_0x9edee5,'\x0a');if(_0x2670e6[_0x857f('0x46')]==='Contacts'){_0x1036a8[_0x857f('0x66')]={'name':!_['isNil'](_0x2670e6[_0x857f('0x67')])?_0x2670e6[_0x857f('0x67')]:!_['isNil'](_0x2670e6[_0x857f('0x68')])?_0x2670e6[_0x857f('0x68')]+'\x20'+_0x2670e6[_0x857f('0x69')]:_0x2670e6[_0x857f('0x69')],'id':_0x2670e6['id']};}if(_0x2670e6[_0x857f('0x46')]===_0x857f('0x59')){_0x1036a8[_0x857f('0x6a')]={'name':!_[_0x857f('0x20')](_0x2670e6['Full_Name'])?_0x2670e6[_0x857f('0x67')]:!_[_0x857f('0x20')](_0x2670e6[_0x857f('0x68')])?_0x2670e6[_0x857f('0x68')]+'\x20'+_0x2670e6[_0x857f('0x69')]:_0x2670e6[_0x857f('0x69')],'id':_0x2670e6['id']};_0x1036a8[_0x857f('0x6b')]=_[_0x857f('0x49')](_0x2670e6[_0x857f('0x46')]);}if(_0x9edee5[_0x857f('0x6c')]){_0x1036a8[_0x857f('0x6d')]=moment['utc'](parseInt(_0x9edee5[_0x857f('0x6c')])*0x3e8)[_0x857f('0x36')](_0x857f('0x6e'));}else if(_0x9edee5[_0x857f('0x6f')]&&_0x9edee5['endtime']){_0x1036a8[_0x857f('0x6d')]=moment['utc'](moment(_0x9edee5[_0x857f('0x70')],_0x857f('0x71'))[_0x857f('0x72')](moment(_0x9edee5[_0x857f('0x73')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0x857f('0x6e'));}switch(_0x9edee5[_0x857f('0x74')]){case _0x857f('0x75'):_0x1036a8['Call_Result']=_0x857f('0x76');break;case'complete':case _0x857f('0x77'):_0x1036a8[_0x857f('0x78')]=_0x857f('0x79');break;case'rejected':_0x1036a8['Call_Result']=_0x857f('0x7a');break;case _0x857f('0x7b'):_0x1036a8[_0x857f('0x78')]=_0x857f('0x7c');break;case _0x857f('0x7d'):_0x1036a8[_0x857f('0x78')]=_0x857f('0x7e');default:}_0x1036a8[_0x857f('0x7f')]=(_0x12712a==='outbound'?moment(_0x9edee5['starttime'])[_0x857f('0x36')](_0x857f('0x71')):moment(_0x9edee5[_0x857f('0x80')])[_0x857f('0x36')](_0x857f('0x71')))||moment()[_0x857f('0x36')]('YYYY-MM-DDTHH:mm:ss');_0x1036a8[_0x857f('0x81')]=_0x12712a||_0x857f('0x82');_0x1036a8=_[_0x857f('0x83')](_0x1036a8,getCustomFields(_0x3e24a5[_0x857f('0x84')],_0x9edee5));return request({'method':_0x857f('0x28'),'uri':_0x857f('0x47')+_0x5464f4+_0x857f('0x85'),'headers':{'Authorization':_0x857f('0x39')+_0x4f9d24},'body':{'data':[_0x1036a8]},'json':!![]})[_0x857f('0x2e')](function(_0x338670){if(_0x338670&&_0x338670['data'][0x0][_0x857f('0x4e')]==='SUCCESS'){logger['info'](_0x857f('0x86'));return{'id':_0x338670['data'][0x0]['details']['id']};}})[_0x857f('0x31')](function(_0x59d2b6){logger[_0x857f('0x33')]('err',_0x59d2b6[_0x857f('0x87')]);console[_0x857f('0x52')](_0x857f('0x88'),_0x59d2b6);});}exports[_0x857f('0x89')]=function(_0x49fb1d,_0x28a39a,_0xe79902,_0x3100aa,_0x37bc13,_0x387aaa){var _0x80feb,_0x195760,_0x5c50bd;_0x387aaa['host']=intUtil[_0x857f('0x8a')](_0x387aaa[_0x857f('0x8b')]);_0x387aaa[_0x857f('0x8c')]=intUtil[_0x857f('0x8a')](_0x387aaa[_0x857f('0x8c')]);if(_0x37bc13&&_0x37bc13[_0x857f('0x8d')]){logger['info'](_0x857f('0x8e'),_0x857f('0x8f'));_0x28a39a[_0x857f('0x90')]=_0x387aaa['serverUrl']+'/api/voice/recordings/'+_0x28a39a[_0x857f('0x91')]+'/downloads?type=uniqueid&token='+md5(_0x28a39a['uniqueid']);}else{_0x28a39a[_0x857f('0x90')]='';}var _0x112dc4=_0x387aaa['host']===_0x857f('0x92')?'eu':_0x857f('0x93');return getAccessToken(_0x387aaa)['then'](function(_0x4692eb){_0x5c50bd=_0x4692eb;return getUser(_0x5c50bd,_0x112dc4,_0x387aaa,_0x3100aa[_0x857f('0x3c')]);})[_0x857f('0x2e')](function(_0x2398df){_0x80feb=_0x2398df;logger[_0x857f('0x33')](_0x857f('0x94'),_0x80feb['id']);return getEndUser(_0x5c50bd,_0x112dc4,_0x387aaa,_0x28a39a[_0x857f('0x95')],_0x28a39a[_0x857f('0x96')],_0x80feb,_0xe79902);})[_0x857f('0x2e')](function(_0x465857){_0x195760=_0x465857;return getCall(_0x5c50bd,_0x112dc4,_0x387aaa,_0x80feb,_0x195760,_0xe79902,_0x28a39a,_0x857f('0x82'));})[_0x857f('0x2e')](function(_0x4e1094){if(_0x4e1094){logger['info']('The\x20Call\x20ID\x20is:',_0x4e1094['id']);logger[_0x857f('0x33')](_0x857f('0x8e'),_0x857f('0x97'));emit(util[_0x857f('0x36')](_0x857f('0x98'),_0x3100aa[_0x857f('0x1d')]),_0x857f('0x99'),{'uri':'https://crm.'+_0x387aaa[_0x857f('0x8b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x4e1094['id']});}})[_0x857f('0x31')](function(_0x4d7b27){logger['error'](_0x857f('0x8e'),JSON['stringify'](_0x4d7b27));});};exports[_0x857f('0x9a')]=function(_0x1445c4,_0x3d6561,_0x516cd0,_0x45be3d,_0x19456f,_0x25e148,_0x18e1cb){var _0x3c67bd,_0x8a1d41,_0x11b818;_0x25e148[_0x857f('0x8b')]=intUtil[_0x857f('0x8a')](_0x25e148['host']);_0x25e148[_0x857f('0x8c')]=intUtil[_0x857f('0x8a')](_0x25e148[_0x857f('0x8c')]);if(_0x18e1cb&&_0x18e1cb[_0x857f('0x9b')]&&_0x18e1cb['recordingFormat']!==_0x857f('0x9c')){logger['info'](_0x857f('0x9d'),_0x857f('0x8f'));_0x3d6561[_0x857f('0x90')]=_0x25e148[_0x857f('0x8c')]+'/api/voice/recordings/'+_0x3d6561[_0x857f('0x91')]+'/downloads?type=uniqueid&token='+md5(_0x3d6561['uniqueid']);}var _0x4050b3=_0x25e148[_0x857f('0x8b')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x25e148)[_0x857f('0x2e')](function(_0x3be826){_0x11b818=_0x3be826;return getUser(_0x11b818,_0x4050b3,_0x25e148,_0x45be3d[_0x857f('0x3c')]);})[_0x857f('0x2e')](function(_0x48157a){_0x3c67bd=_0x48157a;logger[_0x857f('0x33')](_0x857f('0x94'),_0x3c67bd['id']);return getEndUser(_0x11b818,_0x4050b3,_0x25e148,_0x3d6561[_0x857f('0x9e')],_0x3d6561[_0x857f('0x9f')],_0x3c67bd,_0x516cd0);})[_0x857f('0x2e')](function(_0x4df9c2){_0x8a1d41=_0x4df9c2;return getCall(_0x11b818,_0x4050b3,_0x25e148,_0x3c67bd,_0x8a1d41,_0x516cd0,_0x3d6561,'Outbound');})[_0x857f('0x2e')](function(_0x53d065){if(_0x53d065){logger['info'](_0x857f('0xa0'),_0x53d065['id']);logger[_0x857f('0x33')](_0x857f('0x9d'),_0x857f('0x97'));emit(util[_0x857f('0x36')](_0x857f('0x98'),_0x45be3d[_0x857f('0x1d')]),_0x857f('0x99'),{'uri':_0x857f('0xa1')+_0x25e148[_0x857f('0x8b')]+_0x857f('0xa2')+_0x53d065['id']});}})[_0x857f('0x31')](function(_0x1d5124){logger[_0x857f('0x44')](_0x857f('0x9d'),JSON[_0x857f('0x11')](_0x1d5124));});};exports[_0x857f('0xa3')]=function(_0x43ad24,_0x3821d3,_0x427be1,_0x1d80b8,_0x1bcb33,_0x5ed809){var _0x5775e0,_0x4cbe64,_0x2c4bf9;_0x5ed809[_0x857f('0x8b')]=intUtil['stripTrailingSlash'](_0x5ed809[_0x857f('0x8b')]);_0x5ed809[_0x857f('0x8c')]=intUtil['stripTrailingSlash'](_0x5ed809[_0x857f('0x8c')]);if(_0x1bcb33&&_0x1bcb33['monitor_format']){logger[_0x857f('0x33')]('['+_0x3821d3['lastevent'][_0x857f('0xa4')]()+']',_0x857f('0x8f'));_0x3821d3[_0x857f('0x90')]=_0x5ed809[_0x857f('0x8c')]+_0x857f('0xa5')+_0x3821d3[_0x857f('0x91')]+_0x857f('0xa6')+md5(_0x3821d3[_0x857f('0x91')]);}else{_0x3821d3[_0x857f('0x90')]='';}var _0x5594ac=_0x5ed809[_0x857f('0x8b')]==='zoho.eu'?'eu':_0x857f('0x93');return getAccessToken(_0x5ed809)[_0x857f('0x2e')](function(_0x4ca37f){_0x2c4bf9=_0x4ca37f;return getUser(_0x2c4bf9,_0x5594ac,_0x5ed809);})['then'](function(_0x4d9c25){_0x5775e0=_0x4d9c25;logger[_0x857f('0x33')](_0x857f('0x94'),_0x5775e0['id']);return getEndUser(_0x2c4bf9,_0x5594ac,_0x5ed809,_0x3821d3[_0x857f('0x95')],_0x3821d3['calleridnum'],_0x5775e0,_0x427be1);})[_0x857f('0x2e')](function(_0x4aa54f){_0x4cbe64=_0x4aa54f;return getCall(_0x2c4bf9,_0x5594ac,_0x5ed809,_0x5775e0,_0x4cbe64,_0x427be1,_0x3821d3,_0x857f('0x82'));})[_0x857f('0x2e')](function(_0x2f9767){if(_0x2f9767){logger[_0x857f('0x33')]('The\x20Call\x20ID\x20is:',_0x2f9767['id']);}})[_0x857f('0x31')](function(_0x473b29){logger['error']('['+_0x3821d3[_0x857f('0x74')]['toUpperCase']()+']',JSON[_0x857f('0x11')](_0x473b29));});}; \ No newline at end of file +var _0xf4eb=['code','SUCCESS','details','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Owner','Subject','Subjects','getString','Who_Id','Full_Name','Last_Name','What_Id','First_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','Called','complete','connect','Answered','rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Call\x20created!','err','log','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','com','destcalleridname','destcalleridnum','Outbound','unmanaged','monitor_format','toUpperCase','calleridname','lodash','moment','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','[HTTP]','stringify','length','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','refresh_token','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','isArrayLikeObject','findIndex','Using\x20the\x20admin\x20account!','profile','Administrator','users','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','data'];(function(_0xbc9fcf,_0x39b48e){var _0x2b4d87=function(_0x4fe924){while(--_0x4fe924){_0xbc9fcf['push'](_0xbc9fcf['shift']());}};_0x2b4d87(++_0x39b48e);}(_0xf4eb,0xec));var _0xbf4e=function(_0x827d80,_0x43b6ce){_0x827d80=_0x827d80-0x0;var _0x476f33=_0xf4eb[_0x827d80];return _0x476f33;};'use strict';var _=require(_0xbf4e('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require('util');var intUtil=require('./util');var moment=require(_0xbf4e('0x1'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0xbf4e('0x2'));var logger=require(_0xbf4e('0x3'))(_0xbf4e('0x4'));config[_0xbf4e('0x5')]=_[_0xbf4e('0x6')](config[_0xbf4e('0x5')],{'host':_0xbf4e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbf4e('0x5')]));function emit(_0x5013c2,_0x5e23d4,_0xa4280c){io['to'](_0x5013c2)[_0xbf4e('0x8')](_0x5e23d4,_0xa4280c);}function request(_0xcc4097){logger[_0xbf4e('0x9')](_0xbf4e('0xa'),JSON[_0xbf4e('0xb')](_0xcc4097));return rp(_0xcc4097);}function getCustomFields(_0x177342,_0x580a26){var _0x4d9a07={};if(_0x177342[_0xbf4e('0xc')]>0x0){_['forEach'](_0x177342,function(_0x448788){if(_[_0xbf4e('0xd')](['string',_0xbf4e('0xe')],_0x448788['type'])&&_0x448788['idField']){_0x4d9a07[_0x448788[_0xbf4e('0xf')]]=_0x448788[_0xbf4e('0x10')][_0xbf4e('0x11')]();}else if(_0x448788[_0xbf4e('0x12')]===_0xbf4e('0x13')&&_0x448788[_0xbf4e('0x14')]&&_0x448788['idField']&&_0x580a26[_0x448788['variableName']]){_0x4d9a07[_0x448788[_0xbf4e('0xf')]]=_0x580a26[_0x448788[_0xbf4e('0x14')]][_0xbf4e('0x11')]();}else if(_0x448788['type']===_0xbf4e('0x15')&&_0x448788[_0xbf4e('0x16')]&&_0x448788[_0xbf4e('0x16')][_0xbf4e('0x17')]&&_0x448788['idField']&&_0x580a26[_0x448788[_0xbf4e('0x16')]['name']['toLowerCase']()]){_0x4d9a07[_0x448788['idField']]=_0x580a26[_0x448788['Variable'][_0xbf4e('0x17')][_0xbf4e('0x18')]()][_0xbf4e('0x11')]();}});}return _0x4d9a07;}function getName(_0x4d9c2a){if(_0x4d9c2a['indexOf']('\x20')>0x0){var _0x3d1aa7=_0x4d9c2a[_0xbf4e('0x19')](/ (.+)/);if(_0x3d1aa7[0x1]){return _0x3d1aa7;}}return[_0x4d9c2a,_0x4d9c2a];}var accountsTokens={};function getAccessToken(_0x3be138){return new Promise(function(_0x3a875b,_0x344727){if(!_[_0xbf4e('0x1a')](accountsTokens[_0x3be138['id']])&&!_[_0xbf4e('0x1a')](accountsTokens[_0x3be138['id']][_0xbf4e('0x1b')])){if(moment()[_0xbf4e('0x1c')](accountsTokens[_0x3be138['id']][_0xbf4e('0x1d')])){_0x3a875b(accountsTokens[_0x3be138['id']][_0xbf4e('0x1b')]);}}var _0x59bd84;switch(_0x3be138[_0xbf4e('0x1e')]){case'US':_0x59bd84=_0xbf4e('0x1f');break;case'AU':_0x59bd84='https://accounts.zoho.com.au';break;case'EU':_0x59bd84=_0xbf4e('0x20');break;case'IN':_0x59bd84=_0xbf4e('0x21');break;case'CN':_0x59bd84=_0xbf4e('0x22');break;default:_0x59bd84=_0xbf4e('0x20');break;}var _0x3a5d72={'method':'POST','uri':_0x59bd84+_0xbf4e('0x23'),'qs':{'refresh_token':_0x3be138[_0xbf4e('0x24')],'client_id':_0x3be138[_0xbf4e('0x25')],'client_secret':_0x3be138['clientSecret'],'grant_type':_0xbf4e('0x26')},'json':!![]};return rp(_0x3a5d72)['then'](function(_0x5bcf71){accountsTokens[_0x3be138['id']]={'access_token':_0x5bcf71[_0xbf4e('0x1b')],'expires_in':moment()['add'](_0x5bcf71[_0xbf4e('0x1d')],_0xbf4e('0x27'))};_0x3a875b(_0x5bcf71[_0xbf4e('0x1b')]);})[_0xbf4e('0x28')](function(_0x5c912f){logger[_0xbf4e('0x29')](_0xbf4e('0x2a'),_0x5c912f[_0xbf4e('0x2b')]);_0x344727(_0x5c912f);});});}function getUser(_0x4cd4a1,_0x681c3b,_0x590c85,_0x1dfa81){logger[_0xbf4e('0x2c')](_0xbf4e('0x2d'));return request({'method':'GET','uri':util[_0xbf4e('0x2e')](_0xbf4e('0x2f'),_0x681c3b),'qs':{'type':_0xbf4e('0x30')},'headers':{'Authorization':_0xbf4e('0x31')+_0x4cd4a1},'json':!![]})[_0xbf4e('0x32')](function(_0x3b5776){if(_0x3b5776['users']){var _0x35c82d=-0x1;if(_[_0xbf4e('0x33')](_0x3b5776['users'])){if(!_[_0xbf4e('0x1a')](_0x1dfa81)){_0x35c82d=_[_0xbf4e('0x34')](_0x3b5776['users'],function(_0x23d769){return _0x23d769['email']===_0x1dfa81;});}if(_0x35c82d>=0x0){logger[_0xbf4e('0x2c')]('Agent\x20found!');}else{logger[_0xbf4e('0x2c')](_0xbf4e('0x35'));_0x35c82d=_[_0xbf4e('0x34')](_0x3b5776['users'],function(_0x2716b7){return _0x2716b7[_0xbf4e('0x36')][_0xbf4e('0x17')]===_0xbf4e('0x37');});}return _0x3b5776[_0xbf4e('0x38')][_0x35c82d];}else{if(_0x3b5776[_0xbf4e('0x39')]['profile'][_0xbf4e('0x17')]===_0xbf4e('0x37')){logger[_0xbf4e('0x2c')](_0xbf4e('0x35'));user=_0x3b5776[_0xbf4e('0x39')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x3b5776));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xbf4e('0xb')](_0x3b5776));}}}else{logger[_0xbf4e('0x29')](_0xbf4e('0x3a'),JSON[_0xbf4e('0xb')](_0x3b5776));throw new Error(_0xbf4e('0x3b')+JSON[_0xbf4e('0xb')](_0x3b5776));}})[_0xbf4e('0x28')](function(_0x467b74){console[_0xbf4e('0x29')](_0x467b74);});}function getZohoUser(_0x54527d,_0x4f6e93){return new BPromise(function(_0x303fd8,_0x2b25d2){request(_0x54527d)[_0xbf4e('0x32')](function(_0x4ae676){var _0x3f46f1=null;if(_0x4ae676){_0x3f46f1=_0x4ae676['data'][0x0];_0x3f46f1[_0xbf4e('0x3c')]=_0x4f6e93;}_0x303fd8(_0x3f46f1);})[_0xbf4e('0x28')](function(_0xd0bcf0){_0x2b25d2(_0xd0bcf0);});});}function createEndUser(_0xb30f90,_0x5ce339,_0x31d8dc,_0x78ab2d,_0x3aa308,_0x3d5123){var _0x31d8dc=getName(_0x31d8dc);return request({'method':_0xbf4e('0x3d'),'uri':_0xbf4e('0x3e')+_0x5ce339+_0xbf4e('0x3f')+_[_0xbf4e('0x40')](_0x3d5123[_0xbf4e('0x41')])+'s','body':{'data':[{'Last_Name':_0x31d8dc[0x1],'First_Name':_0x31d8dc[0x0],'Phone':_0x78ab2d,'Owner':{'name':!_[_0xbf4e('0x1a')](_0x3aa308[_0xbf4e('0x42')]['name'])?_0x3aa308[_0xbf4e('0x42')][_0xbf4e('0x17')]:!_['isNil'](_0x3aa308['first_name'])?_0x3aa308[_0xbf4e('0x43')]+'\x20'+_0x3aa308[_0xbf4e('0x44')]:_0x3aa308['last_name'],'id':_0x3aa308['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xb30f90},'json':!![]})[_0xbf4e('0x32')](function(_0x150224){if(_0x150224&&_0x150224[_0xbf4e('0x45')][0x0][_0xbf4e('0x46')]===_0xbf4e('0x47')){var _0x3ad0a4=_0x150224['data'][0x0][_0xbf4e('0x48')];_0x3ad0a4[_0xbf4e('0x3c')]=_['startCase'](_0x3d5123['moduleCreate'])+'s';return _0x3ad0a4;}logger['error']('The\x20failing\x20result\x20is',JSON[_0xbf4e('0xb')](data));throw new Error('Error:\x20'+JSON[_0xbf4e('0xb')](data));})[_0xbf4e('0x28')](function(_0x527bfb){console['log'](_0xbf4e('0x49'),_0x527bfb);});}function getEndUser(_0x2a3fe2,_0x46967c,_0x40c147,_0x8ab634,_0x52cf6a,_0x2b20d3,_0x3e8ade){var _0xd3a88a={'method':_0xbf4e('0x4a'),'uri':'','headers':{'Authorization':_0xbf4e('0x31')+_0x2a3fe2},'json':!![]};switch(_0x3e8ade[_0xbf4e('0x4b')]){case _0xbf4e('0x4c'):_0xd3a88a[_0xbf4e('0x4d')]='https://www.zohoapis.'+_0x46967c+_0xbf4e('0x4e')+_0x52cf6a+'))';return getZohoUser(_0xd3a88a,_0xbf4e('0x4f'))[_0xbf4e('0x32')](function(_0x32bed6){if(_0x32bed6)return _0x32bed6;_0xd3a88a[_0xbf4e('0x4d')]=_0xbf4e('0x3e')+_0x46967c+_0xbf4e('0x50')+_0x52cf6a+'))';return getZohoUser(_0xd3a88a,_0xbf4e('0x51'))[_0xbf4e('0x32')](function(_0x3447ab){if(_0x3447ab)return _0x3447ab;if(_0x3e8ade[_0xbf4e('0x41')]!=_0xbf4e('0x52')){return createEndUser(_0x2a3fe2,_0x46967c,_0x8ab634,_0x52cf6a,_0x2b20d3,_0x3e8ade);}else{return{};}});});break;case _0xbf4e('0x53'):_0xd3a88a[_0xbf4e('0x4d')]=_0xbf4e('0x3e')+_0x46967c+_0xbf4e('0x4e')+_0x52cf6a+'))';return getZohoUser(_0xd3a88a,_0xbf4e('0x4f'))['then'](function(_0x22d8ef){if(_0x22d8ef)return _0x22d8ef;if(_0x3e8ade[_0xbf4e('0x41')]!=_0xbf4e('0x52')){return createEndUser(_0x2a3fe2,_0x46967c,_0x8ab634,_0x52cf6a,_0x2b20d3,_0x3e8ade);}else{return{};}});break;case'lead':_0xd3a88a[_0xbf4e('0x4d')]='https://www.zohoapis.'+_0x46967c+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x52cf6a+'))';return getZohoUser(_0xd3a88a,_0xbf4e('0x51'))[_0xbf4e('0x32')](function(_0x4d32b3){if(_0x4d32b3)return _0x4d32b3;if(_0x3e8ade[_0xbf4e('0x41')]!=_0xbf4e('0x52')){return createEndUser(_0x2a3fe2,_0x46967c,_0x8ab634,_0x52cf6a,_0x2b20d3,_0x3e8ade);}else{return{};}});break;}}function getCall(_0x31d779,_0xa7af68,_0x42eef6,_0x2ac2c8,_0x419969,_0x1cdd8c,_0x3cd61b,_0xc058e1){logger[_0xbf4e('0x2c')]('Creating\x20new\x20call...');var _0x5d6324={};_0x5d6324[_0xbf4e('0x54')]={'name':!_[_0xbf4e('0x1a')](_0x2ac2c8[_0xbf4e('0x42')]['name'])&&!_[_0xbf4e('0x1a')](_0x2ac2c8[_0xbf4e('0x36')]['name'])&&_0x2ac2c8['profile'][_0xbf4e('0x17')]==='administrator'?_0x2ac2c8['role'][_0xbf4e('0x17')]:!_[_0xbf4e('0x1a')](_0x2ac2c8[_0xbf4e('0x43')])?_0x2ac2c8[_0xbf4e('0x43')]+'\x20'+_0x2ac2c8[_0xbf4e('0x44')]:_0x2ac2c8['last_name'],'id':_0x2ac2c8['id']};_0x5d6324[_0xbf4e('0x55')]=intUtil['getString'](_0x1cdd8c[_0xbf4e('0x56')],_0x3cd61b,'\x20');_0x5d6324['Description']=intUtil[_0xbf4e('0x57')](_0x1cdd8c['Descriptions'],_0x3cd61b,'\x0a');if(_0x419969[_0xbf4e('0x3c')]===_0xbf4e('0x4f')){_0x5d6324[_0xbf4e('0x58')]={'name':!_[_0xbf4e('0x1a')](_0x419969[_0xbf4e('0x59')])?_0x419969['Full_Name']:!_['isNil'](_0x419969['First_Name'])?_0x419969['First_Name']+'\x20'+_0x419969[_0xbf4e('0x5a')]:_0x419969[_0xbf4e('0x5a')],'id':_0x419969['id']};}if(_0x419969['enduserType']===_0xbf4e('0x51')){_0x5d6324[_0xbf4e('0x5b')]={'name':!_[_0xbf4e('0x1a')](_0x419969[_0xbf4e('0x59')])?_0x419969[_0xbf4e('0x59')]:!_[_0xbf4e('0x1a')](_0x419969[_0xbf4e('0x5c')])?_0x419969['First_Name']+'\x20'+_0x419969[_0xbf4e('0x5a')]:_0x419969[_0xbf4e('0x5a')],'id':_0x419969['id']};_0x5d6324[_0xbf4e('0x5d')]=_['startCase'](_0x419969['enduserType']);}if(_0x3cd61b[_0xbf4e('0x5e')]){_0x5d6324[_0xbf4e('0x5f')]=moment[_0xbf4e('0x60')](parseInt(_0x3cd61b['talktime'])*0x3e8)[_0xbf4e('0x2e')](_0xbf4e('0x61'));}else if(_0x3cd61b[_0xbf4e('0x62')]&&_0x3cd61b[_0xbf4e('0x63')]){_0x5d6324[_0xbf4e('0x5f')]=moment[_0xbf4e('0x60')](moment(_0x3cd61b[_0xbf4e('0x63')],_0xbf4e('0x64'))[_0xbf4e('0x65')](moment(_0x3cd61b[_0xbf4e('0x66')],_0xbf4e('0x64'))))[_0xbf4e('0x2e')]('mm:ss');}switch(_0x3cd61b[_0xbf4e('0x67')]){case'called':_0x5d6324[_0xbf4e('0x68')]=_0xbf4e('0x69');break;case _0xbf4e('0x6a'):case _0xbf4e('0x6b'):_0x5d6324[_0xbf4e('0x68')]=_0xbf4e('0x6c');break;case _0xbf4e('0x6d'):_0x5d6324[_0xbf4e('0x68')]='Rejected';break;case _0xbf4e('0x6e'):_0x5d6324[_0xbf4e('0x68')]=_0xbf4e('0x6f');break;case _0xbf4e('0x70'):_0x5d6324[_0xbf4e('0x68')]='Timeout';default:}_0x5d6324[_0xbf4e('0x71')]=(_0xc058e1===_0xbf4e('0x72')?moment(_0x3cd61b[_0xbf4e('0x66')])[_0xbf4e('0x2e')](_0xbf4e('0x64')):moment(_0x3cd61b[_0xbf4e('0x73')])['format'](_0xbf4e('0x64')))||moment()['format'](_0xbf4e('0x64'));_0x5d6324[_0xbf4e('0x74')]=_0xc058e1||_0xbf4e('0x75');_0x5d6324=_[_0xbf4e('0x76')](_0x5d6324,getCustomFields(_0x1cdd8c['Fields'],_0x3cd61b));return request({'method':_0xbf4e('0x3d'),'uri':'https://www.zohoapis.'+_0xa7af68+'/crm/v2/Calls','headers':{'Authorization':_0xbf4e('0x31')+_0x31d779},'body':{'data':[_0x5d6324]},'json':!![]})[_0xbf4e('0x32')](function(_0x3a00ca){if(_0x3a00ca&&_0x3a00ca['data'][0x0][_0xbf4e('0x46')]===_0xbf4e('0x47')){logger['info'](_0xbf4e('0x77'));return{'id':_0x3a00ca[_0xbf4e('0x45')][0x0][_0xbf4e('0x48')]['id']};}})[_0xbf4e('0x28')](function(_0x260e3a){logger[_0xbf4e('0x2c')](_0xbf4e('0x78'),_0x260e3a[_0xbf4e('0x2b')]);console[_0xbf4e('0x79')]('err',_0x260e3a);});}exports[_0xbf4e('0x7a')]=function(_0x1e77bf,_0x2b2545,_0x11008d,_0x54f450,_0x29a55f,_0x667836){var _0x40e566,_0x25ce0d,_0x3067fb;_0x667836[_0xbf4e('0x7b')]=intUtil[_0xbf4e('0x7c')](_0x667836[_0xbf4e('0x7b')]);_0x667836[_0xbf4e('0x7d')]=intUtil['stripTrailingSlash'](_0x667836[_0xbf4e('0x7d')]);if(_0x29a55f&&_0x29a55f['monitor_format']){logger[_0xbf4e('0x2c')](_0xbf4e('0x7e'),_0xbf4e('0x7f'));_0x2b2545[_0xbf4e('0x80')]=_0x667836[_0xbf4e('0x7d')]+'/api/voice/recordings/'+_0x2b2545[_0xbf4e('0x81')]+_0xbf4e('0x82')+md5(_0x2b2545[_0xbf4e('0x81')]);}else{_0x2b2545['recordingURL']='';}var _0x471028=_0x667836[_0xbf4e('0x7b')]===_0xbf4e('0x83')?'eu':'com';return getAccessToken(_0x667836)[_0xbf4e('0x32')](function(_0x468f43){_0x3067fb=_0x468f43;return getUser(_0x3067fb,_0x471028,_0x667836,_0x54f450[_0xbf4e('0x84')]);})[_0xbf4e('0x32')](function(_0x3defaf){_0x40e566=_0x3defaf;logger['info'](_0xbf4e('0x85'),_0x40e566['id']);return getEndUser(_0x3067fb,_0x471028,_0x667836,_0x2b2545['calleridname'],_0x2b2545[_0xbf4e('0x86')],_0x40e566,_0x11008d);})['then'](function(_0x19a7e9){_0x25ce0d=_0x19a7e9;return getCall(_0x3067fb,_0x471028,_0x667836,_0x40e566,_0x25ce0d,_0x11008d,_0x2b2545,'Inbound');})[_0xbf4e('0x32')](function(_0x52d706){if(_0x52d706){logger[_0xbf4e('0x2c')](_0xbf4e('0x87'),_0x52d706['id']);logger[_0xbf4e('0x2c')](_0xbf4e('0x7e'),_0xbf4e('0x88'));emit(util[_0xbf4e('0x2e')](_0xbf4e('0x89'),_0x54f450['name']),_0xbf4e('0x8a'),{'uri':_0xbf4e('0x8b')+_0x667836[_0xbf4e('0x7b')]+_0xbf4e('0x8c')+_0x52d706['id']});}})[_0xbf4e('0x28')](function(_0x3af0f4){logger['error'](_0xbf4e('0x7e'),JSON[_0xbf4e('0xb')](_0x3af0f4));});};exports['outbound']=function(_0x2e72cb,_0x64ac05,_0x2650d8,_0xb6d122,_0x19ec7e,_0x3c5d85,_0xbc56b7){var _0x1e7b1a,_0x33cb38,_0x5bdc1c;_0x3c5d85[_0xbf4e('0x7b')]=intUtil[_0xbf4e('0x7c')](_0x3c5d85[_0xbf4e('0x7b')]);_0x3c5d85['serverUrl']=intUtil[_0xbf4e('0x7c')](_0x3c5d85[_0xbf4e('0x7d')]);if(_0xbc56b7&&_0xbc56b7['recordingFormat']&&_0xbc56b7[_0xbf4e('0x8d')]!==_0xbf4e('0x8e')){logger[_0xbf4e('0x2c')](_0xbf4e('0x8f'),_0xbf4e('0x7f'));_0x64ac05[_0xbf4e('0x80')]=_0x3c5d85[_0xbf4e('0x7d')]+_0xbf4e('0x90')+_0x64ac05[_0xbf4e('0x81')]+_0xbf4e('0x82')+md5(_0x64ac05['uniqueid']);}var _0x57ca27=_0x3c5d85[_0xbf4e('0x7b')]===_0xbf4e('0x83')?'eu':_0xbf4e('0x91');return getAccessToken(_0x3c5d85)[_0xbf4e('0x32')](function(_0x49bd50){_0x5bdc1c=_0x49bd50;return getUser(_0x5bdc1c,_0x57ca27,_0x3c5d85,_0xb6d122[_0xbf4e('0x84')]);})[_0xbf4e('0x32')](function(_0x299af9){_0x1e7b1a=_0x299af9;logger[_0xbf4e('0x2c')](_0xbf4e('0x85'),_0x1e7b1a['id']);return getEndUser(_0x5bdc1c,_0x57ca27,_0x3c5d85,_0x64ac05[_0xbf4e('0x92')],_0x64ac05[_0xbf4e('0x93')],_0x1e7b1a,_0x2650d8);})['then'](function(_0x34b766){_0x33cb38=_0x34b766;return getCall(_0x5bdc1c,_0x57ca27,_0x3c5d85,_0x1e7b1a,_0x33cb38,_0x2650d8,_0x64ac05,_0xbf4e('0x94'));})[_0xbf4e('0x32')](function(_0x1fc4da){if(_0x1fc4da){logger[_0xbf4e('0x2c')](_0xbf4e('0x87'),_0x1fc4da['id']);logger['info'](_0xbf4e('0x8f'),_0xbf4e('0x88'));emit(util[_0xbf4e('0x2e')](_0xbf4e('0x89'),_0xb6d122[_0xbf4e('0x17')]),_0xbf4e('0x8a'),{'uri':_0xbf4e('0x8b')+_0x3c5d85['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x1fc4da['id']});}})[_0xbf4e('0x28')](function(_0x471235){logger[_0xbf4e('0x29')](_0xbf4e('0x8f'),JSON[_0xbf4e('0xb')](_0x471235));});};exports[_0xbf4e('0x95')]=function(_0x38e3ee,_0x49b1e8,_0xb4f4a3,_0x3ade16,_0x2c9be5,_0x54ee1a){var _0x4ed161,_0x10a4b6,_0x3dcef2;_0x54ee1a[_0xbf4e('0x7b')]=intUtil['stripTrailingSlash'](_0x54ee1a[_0xbf4e('0x7b')]);_0x54ee1a[_0xbf4e('0x7d')]=intUtil[_0xbf4e('0x7c')](_0x54ee1a['serverUrl']);if(_0x2c9be5&&_0x2c9be5[_0xbf4e('0x96')]){logger[_0xbf4e('0x2c')]('['+_0x49b1e8[_0xbf4e('0x67')][_0xbf4e('0x97')]()+']',_0xbf4e('0x7f'));_0x49b1e8[_0xbf4e('0x80')]=_0x54ee1a[_0xbf4e('0x7d')]+_0xbf4e('0x90')+_0x49b1e8[_0xbf4e('0x81')]+_0xbf4e('0x82')+md5(_0x49b1e8[_0xbf4e('0x81')]);}else{_0x49b1e8['recordingURL']='';}var _0x30fe07=_0x54ee1a['host']===_0xbf4e('0x83')?'eu':_0xbf4e('0x91');return getAccessToken(_0x54ee1a)[_0xbf4e('0x32')](function(_0x28bbd6){_0x3dcef2=_0x28bbd6;return getUser(_0x3dcef2,_0x30fe07,_0x54ee1a);})['then'](function(_0x84239d){_0x4ed161=_0x84239d;logger[_0xbf4e('0x2c')]('The\x20User\x20ID\x20is:',_0x4ed161['id']);return getEndUser(_0x3dcef2,_0x30fe07,_0x54ee1a,_0x49b1e8[_0xbf4e('0x98')],_0x49b1e8[_0xbf4e('0x86')],_0x4ed161,_0xb4f4a3);})[_0xbf4e('0x32')](function(_0x25b29c){_0x10a4b6=_0x25b29c;return getCall(_0x3dcef2,_0x30fe07,_0x54ee1a,_0x4ed161,_0x10a4b6,_0xb4f4a3,_0x49b1e8,_0xbf4e('0x75'));})[_0xbf4e('0x32')](function(_0x197fdf){if(_0x197fdf){logger[_0xbf4e('0x2c')](_0xbf4e('0x87'),_0x197fdf['id']);}})['catch'](function(_0x426445){logger[_0xbf4e('0x29')]('['+_0x49b1e8['lastevent'][_0xbf4e('0x97')]()+']',JSON[_0xbf4e('0xb')](_0x426445));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/script/index.js b/server/services/ami/trigger/script/index.js index f1bd6ab..3ba3cad 100644 --- a/server/services/ami/trigger/script/index.js +++ b/server/services/ami/trigger/script/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x556c46,_0x621a3){var _0x4efc71=function(_0x39f6c9){while(--_0x39f6c9){_0x556c46['push'](_0x556c46['shift']());}};_0x4efc71(++_0x621a3);}(_0x7a54,0x106));var _0x47a5=function(_0x4123a2,_0x22a036){_0x4123a2=_0x4123a2-0x0;var _0x5e43d4=_0x7a54[_0x4123a2];return _0x5e43d4;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file +var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x1913af,_0xc878e0){var _0x11bad8=function(_0x577f55){while(--_0x577f55){_0x1913af['push'](_0x1913af['shift']());}};_0x11bad8(++_0xc878e0);}(_0x7a54,0x106));var _0x47a5=function(_0x5461cf,_0x17482a){_0x5461cf=_0x5461cf-0x0;var _0x14323c=_0x7a54[_0x5461cf];return _0x14323c;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ 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 3778801..efc7ded 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 _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x312d0d,_0x4c6f81){var _0x4a23f2=function(_0x5e5b39){while(--_0x5e5b39){_0x312d0d['push'](_0x312d0d['shift']());}};_0x4a23f2(++_0x4c6f81);}(_0x7a54,0x106));var _0x47a5=function(_0x29380b,_0x38192d){_0x29380b=_0x29380b-0x0;var _0x53d26e=_0x7a54[_0x29380b];return _0x53d26e;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file +var _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x58d461,_0x1bf049){var _0x1b099c=function(_0x226f77){while(--_0x226f77){_0x58d461['push'](_0x58d461['shift']());}};_0x1b099c(++_0x1bf049);}(_0x7a54,0x106));var _0x47a5=function(_0x58d24d,_0x2f9936){_0x58d24d=_0x58d24d-0x0;var _0x1386c5=_0x7a54[_0x58d24d];return _0x1386c5;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 09574a1..8a6095b 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 _0xf021=['debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','Request','then'];(function(_0x56f7e2,_0x145392){var _0x36240b=function(_0x216ff7){while(--_0x216ff7){_0x56f7e2['push'](_0x56f7e2['shift']());}};_0x36240b(++_0x145392);}(_0xf021,0x18f));var _0x1f02=function(_0x27a9cc,_0x3bae61){_0x27a9cc=_0x27a9cc-0x0;var _0x37d740=_0xf021[_0x27a9cc];return _0x37d740;};'use strict';var jayson=require(_0x1f02('0x0'));var BPromise=require(_0x1f02('0x1'));var logger=require(_0x1f02('0x2'))(_0x1f02('0x3'));var client=jayson[_0x1f02('0x4')]['http']({'port':0x2329});client[_0x1f02('0x5')]=function(_0x54cd44,_0x2e8594){return new BPromise(function(_0x3164f0,_0x51eff6){return client['request'](_0x54cd44,_0x2e8594)[_0x1f02('0x6')](function(_0x56b275){logger[_0x1f02('0x7')](_0x1f02('0x8'),_0x1f02('0x3'),_0x54cd44,_0x2e8594,_0x56b275);if(_0x56b275[_0x1f02('0x9')]){logger[_0x1f02('0x9')]('rpc',_0x1f02('0x3'),_0x54cd44,_0x56b275['error']['message'],_0x2e8594);return _0x51eff6(_0x56b275['error'][_0x1f02('0xa')]);}else{return _0x3164f0(_0x56b275[_0x1f02('0xb')]);}})[_0x1f02('0xc')](function(_0x19ee35){logger[_0x1f02('0x9')]('rpc',_0x1f02('0x3'),_0x54cd44,_0x19ee35,_0x2e8594);return _0x51eff6(_0x19ee35);});});};module[_0x1f02('0xd')]=client; \ No newline at end of file +var _0xd0bb=['exports','jayson/promise','bluebird','../../config/logger','client','Request','request','then','debug','rpc','error','routing','message','result'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x50fb34,_0x56b847){_0x50fb34=_0x50fb34-0x0;var _0x478797=_0xd0bb[_0x50fb34];return _0x478797;};'use strict';var jayson=require(_0xbd0b('0x0'));var BPromise=require(_0xbd0b('0x1'));var logger=require(_0xbd0b('0x2'))('routing');var client=jayson[_0xbd0b('0x3')]['http']({'port':0x2329});client[_0xbd0b('0x4')]=function(_0x1f6ec3,_0x53e6ce){return new BPromise(function(_0x432acf,_0x508d53){return client[_0xbd0b('0x5')](_0x1f6ec3,_0x53e6ce)[_0xbd0b('0x6')](function(_0x158b5c){logger[_0xbd0b('0x7')](_0xbd0b('0x8'),'routing',_0x1f6ec3,_0x53e6ce,_0x158b5c);if(_0x158b5c[_0xbd0b('0x9')]){logger[_0xbd0b('0x9')](_0xbd0b('0x8'),_0xbd0b('0xa'),_0x1f6ec3,_0x158b5c[_0xbd0b('0x9')]['message'],_0x53e6ce);return _0x508d53(_0x158b5c['error'][_0xbd0b('0xb')]);}else{return _0x432acf(_0x158b5c[_0xbd0b('0xc')]);}})['catch'](function(_0x26b834){logger[_0xbd0b('0x9')]('rpc',_0xbd0b('0xa'),_0x1f6ec3,_0x26b834,_0x53e6ce);return _0x508d53(_0x26b834);});});};module[_0xbd0b('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 133c53b..b19b6c9 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 _0xf2ff=['log','./server','./realtime','./lib/email','./rpc/setting','resolve','then','getMailAccounts','initMailAccounts','refresh','getSettings','loginMailFrequency','catch'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xf2ff,0x187));var _0xff2f=function(_0x2e3dc2,_0x3c88a8){_0x2e3dc2=_0x2e3dc2-0x0;var _0x27739a=_0xf2ff[_0x2e3dc2];return _0x27739a;};'use strict';var BPromise=require('bluebird');var server=require(_0xff2f('0x0'));var Realtime=require(_0xff2f('0x1'));var EmailChannel=require(_0xff2f('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xff2f('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xff2f('0x4')]()[_0xff2f('0x5')](mailAccount[_0xff2f('0x6')]())[_0xff2f('0x5')](realtime[_0xff2f('0x7')]())['then'](function(){email[_0xff2f('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0xff2f('0x5')](function(){return setting[_0xff2f('0x9')]();})[_0xff2f('0x5')](function(_0x2bcc66){return setInterval(initRealtime,_0x2bcc66[_0xff2f('0xa')]*0x3e8);})[_0xff2f('0xb')](function(_0x344760){console[_0xff2f('0xc')](_0x344760);});}main(); \ No newline at end of file +var _0x4df8=['./rpc/setting','resolve','then','getMailAccounts','refresh','listen','getSettings','loginMailFrequency','log','bluebird','./realtime','./lib/email','./rpc/mailAccount'];(function(_0x3e2c1e,_0x1e8d40){var _0x1c6666=function(_0x190b73){while(--_0x190b73){_0x3e2c1e['push'](_0x3e2c1e['shift']());}};_0x1c6666(++_0x1e8d40);}(_0x4df8,0xcc));var _0x84df=function(_0x556231,_0x2cb901){_0x556231=_0x556231-0x0;var _0x22a24a=_0x4df8[_0x556231];return _0x22a24a;};'use strict';var BPromise=require(_0x84df('0x0'));var server=require('./server');var Realtime=require(_0x84df('0x1'));var EmailChannel=require(_0x84df('0x2'));var mailAccount=require(_0x84df('0x3'));var setting=require(_0x84df('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x84df('0x5')]()[_0x84df('0x6')](mailAccount[_0x84df('0x7')]())[_0x84df('0x6')](realtime['initMailAccounts']())[_0x84df('0x6')](function(){email[_0x84df('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x84df('0x9')](realtime,email)[_0x84df('0x6')](function(){return initRealtime();})[_0x84df('0x6')](function(){return setting[_0x84df('0xa')]();})[_0x84df('0x6')](function(_0x4df12b){return setInterval(initRealtime,_0x4df12b[_0x84df('0xb')]*0x3e8);})['catch'](function(_0x2c2141){console[_0x84df('0xc')](_0x2c2141);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index bddc447..513f888 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 _0xd60b=['catch','lastSync','sendMail','smtp','send','Smtp','then','verified','verify','exports','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','prototype','emit','name','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','handleImapBox','handleImapEmail','bind','handleImapEnd','error','handleImapError','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','notify','Mail\x20accepted\x20from\x20routing'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xd60b,0xd6));var _0xbd60=function(_0x28e1f6,_0x188339){_0x28e1f6=_0x28e1f6-0x0;var _0x2ec8b0=_0xd60b[_0x28e1f6];return _0x2ec8b0;};'use strict';var _=require('lodash');var moment=require(_0xbd60('0x0'));var BPromise=require(_0xbd60('0x1'));var md5=require(_0xbd60('0x2'));var Redis=require(_0xbd60('0x3'));var config=require(_0xbd60('0x4'));var logger=require(_0xbd60('0x5'))(_0xbd60('0x6'));config[_0xbd60('0x7')]=_[_0xbd60('0x8')](config['redis'],{'host':_0xbd60('0x9'),'port':0x18eb});var io=require(_0xbd60('0xa'))(new Redis(config[_0xbd60('0x7')]));var EmailImap=require(_0xbd60('0xb'));var EmailSmtp=require(_0xbd60('0xc'));var mailAccount=require(_0xbd60('0xd'));var md5Accounts={};function EmailChannel(_0x5507f4){logger[_0xbd60('0xe')]('start\x20email\x20channel');this[_0xbd60('0xf')]=_0x5507f4[_0xbd60('0xf')];this[_0xbd60('0x10')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0xbd60('0x11')][_0xbd60('0x12')]=function(_0x509009){var _0x515580=this[_0xbd60('0xf')][_0x509009];var _0x15dc90={'id':_0x515580['id'],'name':_0x515580[_0xbd60('0x13')],'key':_0x515580['key'],'active':_0x515580['active'],'Imap':{'status':_0x515580[_0xbd60('0x14')][_0xbd60('0x15')],'messageStatus':_0x515580[_0xbd60('0x14')][_0xbd60('0x16')],'total':_0x515580[_0xbd60('0x14')][_0xbd60('0x17')]}};if(_[_0xbd60('0x18')](md5Accounts[_0x509009])){md5Accounts[_0x509009]={};}var _0x56eb25=md5(JSON[_0xbd60('0x19')](_0x15dc90));if(md5Accounts[_0x509009][_0xbd60('0x2')]!==_0x56eb25){md5Accounts[_0x509009]['md5']=_0x56eb25;io[_0xbd60('0x12')](_0xbd60('0x1a'),_0x15dc90);}};EmailChannel[_0xbd60('0x11')][_0xbd60('0x1b')]=function(_0x16316a){for(var _0x6ade70 in _0x16316a){if(_0x16316a['hasOwnProperty'](_0x6ade70)){if(_0x16316a[_0x6ade70]['Imap']&&_0x16316a[_0x6ade70]['active']){var _0x26dc2d=_0x16316a[_0x6ade70][_0xbd60('0x14')];if(!this[_0xbd60('0x10')][_0xbd60('0x1c')](_0x26dc2d['id'])){this[_0xbd60('0x10')][_0x26dc2d['id']]=new EmailImap(_0x26dc2d,_0x16316a[_0x6ade70][_0xbd60('0x6')]);this['imapAccounts'][_0x26dc2d['id']]['on']('box',this[_0xbd60('0x1d')]['bind'](this,_0x6ade70));this[_0xbd60('0x10')][_0x26dc2d['id']]['on'](_0xbd60('0x6'),this[_0xbd60('0x1e')][_0xbd60('0x1f')](this,_0x6ade70));this[_0xbd60('0x10')][_0x26dc2d['id']]['on']('end',this[_0xbd60('0x20')]['bind'](this,_0x6ade70));this[_0xbd60('0x10')][_0x26dc2d['id']]['on'](_0xbd60('0x21'),this[_0xbd60('0x22')][_0xbd60('0x1f')](this,_0x6ade70));}}else{if(_['isNil'](this[_0xbd60('0xf')][_0x6ade70][_0xbd60('0x14')])){this['mailAccounts'][_0x6ade70][_0xbd60('0x14')]={};}this[_0xbd60('0xf')][_0x6ade70][_0xbd60('0x14')]['status']='disabled';this[_0xbd60('0xf')][_0x6ade70][_0xbd60('0x14')][_0xbd60('0x16')]='';this[_0xbd60('0x12')](_0x6ade70);}}}};EmailChannel[_0xbd60('0x11')]['handleImapBox']=function(_0x2e426f,_0x14a2a6){if(this[_0xbd60('0xf')][_0x2e426f]){this[_0xbd60('0xf')][_0x2e426f][_0xbd60('0x14')][_0xbd60('0x15')]=_0xbd60('0x23');this[_0xbd60('0xf')][_0x2e426f][_0xbd60('0x14')][_0xbd60('0x16')]=_0x14a2a6[_0xbd60('0x13')];if(_0x14a2a6['messages']){this[_0xbd60('0xf')][_0x2e426f][_0xbd60('0x14')]['total']=_0x14a2a6[_0xbd60('0x24')][_0xbd60('0x17')];}return this['emit'](_0x2e426f);}};EmailChannel[_0xbd60('0x11')]['handleImapEmail']=function(_0x4be452,_0xacfe5f){logger[_0xbd60('0xe')](_0xbd60('0x25'),_0xacfe5f[_0xbd60('0x26')],_0xacfe5f['lastName'],_0xacfe5f['from'],_0x4be452);if(this[_0xbd60('0xf')][_0x4be452]){return mailAccount[_0xbd60('0x27')](_0x4be452,_0xacfe5f)['then'](function(_0x898899){if(_0x898899){logger[_0xbd60('0xe')](_0xbd60('0x28'));}})[_0xbd60('0x29')](function(_0x13e285){logger[_0xbd60('0x21')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xbd60('0x19')](_0x13e285));});}};EmailChannel[_0xbd60('0x11')][_0xbd60('0x20')]=function(_0x4c45cc){if(this[_0xbd60('0xf')][_0x4c45cc]&&this[_0xbd60('0xf')][_0x4c45cc]['Imap']){if(this[_0xbd60('0x10')][this[_0xbd60('0xf')][_0x4c45cc][_0xbd60('0x14')]['id']]){delete this[_0xbd60('0x10')][this[_0xbd60('0xf')][_0x4c45cc][_0xbd60('0x14')]['id']];}this['mailAccounts'][_0x4c45cc]['Imap'][_0xbd60('0x2a')]=moment();this[_0xbd60('0x12')](_0x4c45cc);}};EmailChannel[_0xbd60('0x11')][_0xbd60('0x22')]=function(_0x689bc9,_0x1d7af0){if(this[_0xbd60('0xf')][_0x689bc9]){this[_0xbd60('0xf')][_0x689bc9][_0xbd60('0x14')]['status']='error';this[_0xbd60('0xf')][_0x689bc9][_0xbd60('0x14')][_0xbd60('0x16')]=_0x1d7af0;return this[_0xbd60('0x12')](_0x689bc9);}};EmailChannel[_0xbd60('0x11')][_0xbd60('0x2b')]=function(_0xd2bced,_0x4d3056){return this[_0xbd60('0x2c')][_0xbd60('0x2d')](_0xd2bced,_0x4d3056);};EmailChannel[_0xbd60('0x11')]['verifySmtp']=function(_0x5c4781){var _0x400077=this;if(this['mailAccounts'][_0x5c4781['id']]){if(_[_0xbd60('0x18')](this[_0xbd60('0xf')][_0x5c4781['id']]['Smtp'])){this[_0xbd60('0xf')][_0x5c4781['id']][_0xbd60('0x2e')]={};}this[_0xbd60('0xf')][_0x5c4781['id']][_0xbd60('0x2e')][_0xbd60('0x2a')]=moment();return new BPromise(function(_0x46070d,_0x802445){return _0x400077[_0xbd60('0x2c')]['verify'](_0x5c4781)[_0xbd60('0x2f')](function(_0x4b7ae6){_0x400077['mailAccounts'][_0x5c4781['id']][_0xbd60('0x2e')][_0xbd60('0x15')]=_0xbd60('0x30');_0x400077[_0xbd60('0xf')][_0x5c4781['id']][_0xbd60('0x2e')][_0xbd60('0x16')]='';_0x400077[_0xbd60('0x12')](_0x5c4781['id']);_0x46070d(_0x4b7ae6);})[_0xbd60('0x29')](function(_0x570699){_0x400077['mailAccounts'][_0x5c4781['id']][_0xbd60('0x2e')][_0xbd60('0x15')]='error';_0x400077[_0xbd60('0xf')][_0x5c4781['id']][_0xbd60('0x2e')][_0xbd60('0x16')]=_0x570699;_0x400077[_0xbd60('0x12')](_0x5c4781['id']);_0x802445(_0x570699);});});}return this[_0xbd60('0x2c')][_0xbd60('0x31')](_0x5c4781);};module[_0xbd60('0x32')]=EmailChannel; \ No newline at end of file +var _0x422c=['isNil','stringify','mailAccount:update','hasOwnProperty','box','bind','handleImapEmail','end','error','handleImapError','disabled','handleImapBox','status','connected','messages','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail','send','verifySmtp','Smtp','verified','lodash','bluebird','md5','ioredis','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus','total'];(function(_0x19cce8,_0x23a814){var _0x575f93=function(_0x515f8b){while(--_0x515f8b){_0x19cce8['push'](_0x19cce8['shift']());}};_0x575f93(++_0x23a814);}(_0x422c,0x15b));var _0xc422=function(_0x24a370,_0x155519){_0x24a370=_0x24a370-0x0;var _0x3deaa3=_0x422c[_0x24a370];return _0x3deaa3;};'use strict';var _=require(_0xc422('0x0'));var moment=require('moment');var BPromise=require(_0xc422('0x1'));var md5=require(_0xc422('0x2'));var Redis=require(_0xc422('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xc422('0x4'));config[_0xc422('0x5')]=_['defaults'](config[_0xc422('0x5')],{'host':_0xc422('0x6'),'port':0x18eb});var io=require(_0xc422('0x7'))(new Redis(config[_0xc422('0x5')]));var EmailImap=require(_0xc422('0x8'));var EmailSmtp=require(_0xc422('0x9'));var mailAccount=require(_0xc422('0xa'));var md5Accounts={};function EmailChannel(_0x298ddd){logger[_0xc422('0xb')](_0xc422('0xc'));this[_0xc422('0xd')]=_0x298ddd[_0xc422('0xd')];this[_0xc422('0xe')]={};this[_0xc422('0xf')]=new EmailSmtp();}EmailChannel[_0xc422('0x10')][_0xc422('0x11')]=function(_0x8c83c5){var _0x5735f2=this[_0xc422('0xd')][_0x8c83c5];var _0xb2a1a8={'id':_0x5735f2['id'],'name':_0x5735f2[_0xc422('0x12')],'key':_0x5735f2[_0xc422('0x13')],'active':_0x5735f2[_0xc422('0x14')],'Imap':{'status':_0x5735f2[_0xc422('0x15')]['status'],'messageStatus':_0x5735f2[_0xc422('0x15')][_0xc422('0x16')],'total':_0x5735f2[_0xc422('0x15')][_0xc422('0x17')]}};if(_[_0xc422('0x18')](md5Accounts[_0x8c83c5])){md5Accounts[_0x8c83c5]={};}var _0x30fe19=md5(JSON[_0xc422('0x19')](_0xb2a1a8));if(md5Accounts[_0x8c83c5][_0xc422('0x2')]!==_0x30fe19){md5Accounts[_0x8c83c5][_0xc422('0x2')]=_0x30fe19;io[_0xc422('0x11')](_0xc422('0x1a'),_0xb2a1a8);}};EmailChannel[_0xc422('0x10')]['refresh']=function(_0x32cff4){for(var _0x4c755f in _0x32cff4){if(_0x32cff4[_0xc422('0x1b')](_0x4c755f)){if(_0x32cff4[_0x4c755f][_0xc422('0x15')]&&_0x32cff4[_0x4c755f]['active']){var _0x187313=_0x32cff4[_0x4c755f][_0xc422('0x15')];if(!this[_0xc422('0xe')][_0xc422('0x1b')](_0x187313['id'])){this[_0xc422('0xe')][_0x187313['id']]=new EmailImap(_0x187313,_0x32cff4[_0x4c755f][_0xc422('0x4')]);this['imapAccounts'][_0x187313['id']]['on'](_0xc422('0x1c'),this['handleImapBox'][_0xc422('0x1d')](this,_0x4c755f));this['imapAccounts'][_0x187313['id']]['on'](_0xc422('0x4'),this[_0xc422('0x1e')][_0xc422('0x1d')](this,_0x4c755f));this['imapAccounts'][_0x187313['id']]['on'](_0xc422('0x1f'),this['handleImapEnd'][_0xc422('0x1d')](this,_0x4c755f));this[_0xc422('0xe')][_0x187313['id']]['on'](_0xc422('0x20'),this[_0xc422('0x21')][_0xc422('0x1d')](this,_0x4c755f));}}else{if(_[_0xc422('0x18')](this[_0xc422('0xd')][_0x4c755f][_0xc422('0x15')])){this[_0xc422('0xd')][_0x4c755f][_0xc422('0x15')]={};}this[_0xc422('0xd')][_0x4c755f]['Imap']['status']=_0xc422('0x22');this[_0xc422('0xd')][_0x4c755f]['Imap']['messageStatus']='';this[_0xc422('0x11')](_0x4c755f);}}}};EmailChannel['prototype'][_0xc422('0x23')]=function(_0x1f7a18,_0x44f464){if(this['mailAccounts'][_0x1f7a18]){this[_0xc422('0xd')][_0x1f7a18][_0xc422('0x15')][_0xc422('0x24')]=_0xc422('0x25');this[_0xc422('0xd')][_0x1f7a18]['Imap'][_0xc422('0x16')]=_0x44f464[_0xc422('0x12')];if(_0x44f464[_0xc422('0x26')]){this['mailAccounts'][_0x1f7a18][_0xc422('0x15')][_0xc422('0x17')]=_0x44f464['messages'][_0xc422('0x17')];}return this[_0xc422('0x11')](_0x1f7a18);}};EmailChannel[_0xc422('0x10')][_0xc422('0x1e')]=function(_0x241cf3,_0x3d2ca3){logger[_0xc422('0xb')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x3d2ca3[_0xc422('0x27')],_0x3d2ca3[_0xc422('0x28')],_0x3d2ca3[_0xc422('0x29')],_0x241cf3);if(this[_0xc422('0xd')][_0x241cf3]){return mailAccount['notify'](_0x241cf3,_0x3d2ca3)[_0xc422('0x2a')](function(_0x3da661){if(_0x3da661){logger[_0xc422('0xb')](_0xc422('0x2b'));}})[_0xc422('0x2c')](function(_0x57dfc2){logger[_0xc422('0x20')](_0xc422('0x2d'),JSON[_0xc422('0x19')](_0x57dfc2));});}};EmailChannel[_0xc422('0x10')][_0xc422('0x2e')]=function(_0x4f1046){if(this[_0xc422('0xd')][_0x4f1046]&&this[_0xc422('0xd')][_0x4f1046][_0xc422('0x15')]){if(this[_0xc422('0xe')][this[_0xc422('0xd')][_0x4f1046][_0xc422('0x15')]['id']]){delete this['imapAccounts'][this[_0xc422('0xd')][_0x4f1046][_0xc422('0x15')]['id']];}this['mailAccounts'][_0x4f1046][_0xc422('0x15')][_0xc422('0x2f')]=moment();this['emit'](_0x4f1046);}};EmailChannel[_0xc422('0x10')][_0xc422('0x21')]=function(_0x147a66,_0x4a6ef0){if(this[_0xc422('0xd')][_0x147a66]){this[_0xc422('0xd')][_0x147a66][_0xc422('0x15')]['status']='error';this[_0xc422('0xd')][_0x147a66][_0xc422('0x15')][_0xc422('0x16')]=_0x4a6ef0;return this['emit'](_0x147a66);}};EmailChannel[_0xc422('0x10')][_0xc422('0x30')]=function(_0x1e9d19,_0x2f94ac){return this[_0xc422('0xf')][_0xc422('0x31')](_0x1e9d19,_0x2f94ac);};EmailChannel['prototype'][_0xc422('0x32')]=function(_0x2494f0){var _0x1a5192=this;if(this[_0xc422('0xd')][_0x2494f0['id']]){if(_[_0xc422('0x18')](this[_0xc422('0xd')][_0x2494f0['id']][_0xc422('0x33')])){this[_0xc422('0xd')][_0x2494f0['id']][_0xc422('0x33')]={};}this[_0xc422('0xd')][_0x2494f0['id']][_0xc422('0x33')][_0xc422('0x2f')]=moment();return new BPromise(function(_0x23b89e,_0x5eaafc){return _0x1a5192['smtp']['verify'](_0x2494f0)[_0xc422('0x2a')](function(_0x5be76f){_0x1a5192[_0xc422('0xd')][_0x2494f0['id']]['Smtp']['status']=_0xc422('0x34');_0x1a5192[_0xc422('0xd')][_0x2494f0['id']][_0xc422('0x33')][_0xc422('0x16')]='';_0x1a5192[_0xc422('0x11')](_0x2494f0['id']);_0x23b89e(_0x5be76f);})['catch'](function(_0x1b18a6){_0x1a5192[_0xc422('0xd')][_0x2494f0['id']]['Smtp'][_0xc422('0x24')]='error';_0x1a5192[_0xc422('0xd')][_0x2494f0['id']][_0xc422('0x33')][_0xc422('0x16')]=_0x1b18a6;_0x1a5192[_0xc422('0x11')](_0x2494f0['id']);_0x5eaafc(_0x1b18a6);});});}return this[_0xc422('0xf')]['verify'](_0x2494f0);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index bbdfe8a..e4f25b1 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 _0x1a0b=['Iconv','events','EventEmitter','./utils','../../../config/logger','account','getAccount','once','ready','handleReady','bind','handleEnd','handleError','connect','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','getHost','tls','anonymous@xcally.com','openBox','handleOpenBox','emit','box','handleCloseBox','end','readUnseen','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchEnd','error','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','parser','email','textCode','exports','path','imap','lodash','randomstring','mailparser','simpleParser','iconv'];(function(_0x3493f6,_0x310aa4){var _0x474693=function(_0x3200ed){while(--_0x3200ed){_0x3493f6['push'](_0x3493f6['shift']());}};_0x474693(++_0x310aa4);}(_0x1a0b,0x18f));var _0xb1a0=function(_0x13d733,_0x3929c4){_0x13d733=_0x13d733-0x0;var _0x328eb2=_0x1a0b[_0x13d733];return _0x328eb2;};'use strict';var fs=require('fs');var path=require(_0xb1a0('0x0'));var util=require('util');var Imap=require(_0xb1a0('0x1'));var _=require(_0xb1a0('0x2'));var rs=require(_0xb1a0('0x3'));var simpleParser=require(_0xb1a0('0x4'))[_0xb1a0('0x5')];var Iconv=require(_0xb1a0('0x6'))[_0xb1a0('0x7')];var EventEmitter=require(_0xb1a0('0x8'))[_0xb1a0('0x9')];var utils=require(_0xb1a0('0xa'));var logger=require(_0xb1a0('0xb'))('email');function EmailImap(_0x4c10bf,_0x1cff60){this['mailbox']='INBOX';this[_0xb1a0('0xc')]=this[_0xb1a0('0xd')](_0x4c10bf,_0x1cff60);this[_0xb1a0('0x1')]=new Imap(this['account']);this['imap'][_0xb1a0('0xe')](_0xb1a0('0xf'),this[_0xb1a0('0x10')][_0xb1a0('0x11')](this));this[_0xb1a0('0x1')][_0xb1a0('0xe')]('end',this[_0xb1a0('0x12')][_0xb1a0('0x11')](this));this[_0xb1a0('0x1')]['on']('error',this[_0xb1a0('0x13')][_0xb1a0('0x11')](this));this[_0xb1a0('0x1')][_0xb1a0('0x14')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xb1a0('0x15')][_0xb1a0('0xd')]=function(_0x171d06,_0x209b89){var _0x11a472={'connTimeout':_0x171d06[_0xb1a0('0x16')]?_0x171d06[_0xb1a0('0x16')]*0x3e8:0x2710,'authTimeout':_0x171d06[_0xb1a0('0x17')]?_0x171d06[_0xb1a0('0x17')]*0x3e8:0x1388};if(_[_0xb1a0('0x18')](_0x171d06[_0xb1a0('0x19')])){if(_0x171d06[_0xb1a0('0x1a')]){_0x11a472[_0xb1a0('0x1b')]=_0x171d06[_0xb1a0('0x1b')];_0x11a472[_0xb1a0('0x1c')]=_0x171d06[_0xb1a0('0x1c')];}_0x11a472[_0xb1a0('0x1d')]=_0x171d06['host'];_0x11a472['port']=_0x171d06['port']||0x3e1;if(_0x171d06['tls']){_0x11a472['tls']=!![];}else{_0x11a472['tls']=![];_0x11a472['autotls']='required';}}else{_0x11a472[_0xb1a0('0x1b')]=_0x171d06[_0xb1a0('0x1b')];_0x11a472[_0xb1a0('0x1c')]=_0x171d06['password'];_0x11a472[_0xb1a0('0x1d')]=utils[_0xb1a0('0x1e')](_0x171d06[_0xb1a0('0x19')]);_0x11a472['port']=0x3e1;_0x11a472[_0xb1a0('0x1f')]=!![];}_0x11a472['email']=_0x209b89||_0x171d06[_0xb1a0('0x1b')]||_0xb1a0('0x20');return _0x11a472;};EmailImap[_0xb1a0('0x15')][_0xb1a0('0x10')]=function(){this['imap'][_0xb1a0('0x21')](this['mailbox'],![],this[_0xb1a0('0x22')][_0xb1a0('0x11')](this));};EmailImap[_0xb1a0('0x15')][_0xb1a0('0x22')]=function(_0x45a486,_0xadb652){if(_0x45a486){this[_0xb1a0('0x13')](_0x45a486,!![]);}else{this[_0xb1a0('0x23')](_0xb1a0('0x24'),_0xadb652);this['readUnseen']();}};EmailImap['prototype'][_0xb1a0('0x25')]=function(_0x1006dc){if(_0x1006dc){this[_0xb1a0('0x13')](_0x1006dc,!![]);}else{this['imap'][_0xb1a0('0x26')]();}};EmailImap['prototype'][_0xb1a0('0x27')]=function(){this['imap'][_0xb1a0('0x28')]([_0xb1a0('0x29')],this[_0xb1a0('0x2a')][_0xb1a0('0x11')](this));};EmailImap[_0xb1a0('0x15')][_0xb1a0('0x2a')]=function(_0x320e38,_0x2d997c){if(_0x320e38){this[_0xb1a0('0x13')](_0x320e38,!![]);}else{if(_0x2d997c['length']){try{var _0x19b4e4=this[_0xb1a0('0x1')][_0xb1a0('0x2b')](_0x2d997c,{'bodies':'','markSeen':!![]});_0x19b4e4['on'](_0xb1a0('0x2c'),this[_0xb1a0('0x2d')][_0xb1a0('0x11')](this));_0x19b4e4[_0xb1a0('0xe')]('error',this['handleFetchError'][_0xb1a0('0x11')](this));_0x19b4e4[_0xb1a0('0xe')]('end',this[_0xb1a0('0x2e')][_0xb1a0('0x11')](this));}catch(_0x3866df){logger[_0xb1a0('0x2f')](_0x3866df);}}else{this[_0xb1a0('0x1')][_0xb1a0('0x30')](!![],this[_0xb1a0('0x25')][_0xb1a0('0x11')](this));}}};EmailImap[_0xb1a0('0x15')][_0xb1a0('0x2d')]=function(_0x12ef87,_0x1a0e11){_0x12ef87['on'](_0xb1a0('0x31'),this[_0xb1a0('0x32')][_0xb1a0('0x11')](this));_0x12ef87['once'](_0xb1a0('0x33'),this[_0xb1a0('0x34')][_0xb1a0('0x11')](this));_0x12ef87[_0xb1a0('0xe')](_0xb1a0('0x26'),this['handleMessageEnd']['bind'](this));};EmailImap[_0xb1a0('0x15')][_0xb1a0('0x32')]=function(_0x2c2375,_0x3e8dd6){simpleParser(_0x2c2375,{'Iconv':Iconv},this[_0xb1a0('0x35')][_0xb1a0('0x11')](this));};EmailImap['prototype'][_0xb1a0('0x34')]=function(_0x466dda){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x2e25c2,_0x5ec8a9){if(_0x2e25c2){logger[_0xb1a0('0x2f')](_0x2e25c2);}else{var _0x33efbd=this;utils[_0xb1a0('0x36')](this[_0xb1a0('0xc')],_0x5ec8a9,function(_0x418815){_0x33efbd[_0xb1a0('0x23')](_0xb1a0('0x37'),_0x418815);});}};EmailImap[_0xb1a0('0x15')][_0xb1a0('0x2e')]=function(){this[_0xb1a0('0x1')][_0xb1a0('0x30')](!![],this[_0xb1a0('0x25')][_0xb1a0('0x11')](this));};EmailImap[_0xb1a0('0x15')]['handleFetchError']=function(_0x50b2d1){this[_0xb1a0('0x13')](_0x50b2d1);this[_0xb1a0('0x1')][_0xb1a0('0x30')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xb1a0('0x15')][_0xb1a0('0x12')]=function(){this[_0xb1a0('0x23')](_0xb1a0('0x26'));};EmailImap[_0xb1a0('0x15')][_0xb1a0('0x13')]=function(_0x7248be,_0x14bf89){logger['error'](_0xb1a0('0x13'),this['account'][_0xb1a0('0x37')],JSON['stringify'](_0x7248be));var _0x3ece26='';if(_0x7248be){if(_0x7248be[_0xb1a0('0x38')]){_0x3ece26=_0x7248be[_0xb1a0('0x38')];}else{for(var _0x382603 in _0x7248be){if(_0x7248be['hasOwnProperty'](_0x382603)){_0x3ece26+=_['upperFirst'](_0x382603)+':\x20'+_0x7248be[_0x382603]+'\x0a';}}}}if(_0x14bf89){this['imap']['end']();}else{this['emit'](_0xb1a0('0x2f'),_0x3ece26);this[_0xb1a0('0x23')](_0xb1a0('0x26'));}};module[_0xb1a0('0x39')]=EmailImap; \ No newline at end of file +var _0x32f4=['getAccount','connTimeout','authTimeout','isNil','service','user','password','host','port','tls','autotls','required','getHost','prototype','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','end','search','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','email','stringify','textCode','upperFirst','exports','path','util','imap','lodash','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','account','once','ready','bind','handleEnd','error','handleError','connect'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x32f4,0x154));var _0x432f=function(_0x14991d,_0x1e10e6){_0x14991d=_0x14991d-0x0;var _0x3b2047=_0x32f4[_0x14991d];return _0x3b2047;};'use strict';var fs=require('fs');var path=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var Imap=require(_0x432f('0x2'));var _=require(_0x432f('0x3'));var rs=require('randomstring');var simpleParser=require(_0x432f('0x4'))[_0x432f('0x5')];var Iconv=require('iconv')[_0x432f('0x6')];var EventEmitter=require(_0x432f('0x7'))[_0x432f('0x8')];var utils=require(_0x432f('0x9'));var logger=require(_0x432f('0xa'))('email');function EmailImap(_0x5b5f08,_0x2f66fd){this[_0x432f('0xb')]='INBOX';this[_0x432f('0xc')]=this['getAccount'](_0x5b5f08,_0x2f66fd);this[_0x432f('0x2')]=new Imap(this[_0x432f('0xc')]);this[_0x432f('0x2')][_0x432f('0xd')](_0x432f('0xe'),this['handleReady'][_0x432f('0xf')](this));this['imap'][_0x432f('0xd')]('end',this[_0x432f('0x10')][_0x432f('0xf')](this));this['imap']['on'](_0x432f('0x11'),this[_0x432f('0x12')]['bind'](this));this[_0x432f('0x2')][_0x432f('0x13')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0x432f('0x14')]=function(_0x44756d,_0x34add6){var _0x453725={'connTimeout':_0x44756d[_0x432f('0x15')]?_0x44756d['connTimeout']*0x3e8:0x2710,'authTimeout':_0x44756d[_0x432f('0x16')]?_0x44756d[_0x432f('0x16')]*0x3e8:0x1388};if(_[_0x432f('0x17')](_0x44756d[_0x432f('0x18')])){if(_0x44756d['authentication']){_0x453725[_0x432f('0x19')]=_0x44756d[_0x432f('0x19')];_0x453725[_0x432f('0x1a')]=_0x44756d[_0x432f('0x1a')];}_0x453725[_0x432f('0x1b')]=_0x44756d[_0x432f('0x1b')];_0x453725['port']=_0x44756d[_0x432f('0x1c')]||0x3e1;if(_0x44756d['tls']){_0x453725[_0x432f('0x1d')]=!![];}else{_0x453725[_0x432f('0x1d')]=![];_0x453725[_0x432f('0x1e')]=_0x432f('0x1f');}}else{_0x453725[_0x432f('0x19')]=_0x44756d[_0x432f('0x19')];_0x453725[_0x432f('0x1a')]=_0x44756d[_0x432f('0x1a')];_0x453725[_0x432f('0x1b')]=utils[_0x432f('0x20')](_0x44756d[_0x432f('0x18')]);_0x453725[_0x432f('0x1c')]=0x3e1;_0x453725['tls']=!![];}_0x453725['email']=_0x34add6||_0x44756d[_0x432f('0x19')]||'anonymous@xcally.com';return _0x453725;};EmailImap[_0x432f('0x21')]['handleReady']=function(){this[_0x432f('0x2')][_0x432f('0x22')](this[_0x432f('0xb')],![],this[_0x432f('0x23')][_0x432f('0xf')](this));};EmailImap[_0x432f('0x21')]['handleOpenBox']=function(_0x252b3b,_0x33edec){if(_0x252b3b){this['handleError'](_0x252b3b,!![]);}else{this[_0x432f('0x24')](_0x432f('0x25'),_0x33edec);this[_0x432f('0x26')]();}};EmailImap[_0x432f('0x21')][_0x432f('0x27')]=function(_0x781862){if(_0x781862){this[_0x432f('0x12')](_0x781862,!![]);}else{this['imap'][_0x432f('0x28')]();}};EmailImap['prototype'][_0x432f('0x26')]=function(){this['imap'][_0x432f('0x29')](['UNSEEN'],this[_0x432f('0x2a')]['bind'](this));};EmailImap[_0x432f('0x21')][_0x432f('0x2a')]=function(_0x263cd8,_0x59c1ab){if(_0x263cd8){this[_0x432f('0x12')](_0x263cd8,!![]);}else{if(_0x59c1ab[_0x432f('0x2b')]){try{var _0x48139b=this['imap'][_0x432f('0x2c')](_0x59c1ab,{'bodies':'','markSeen':!![]});_0x48139b['on'](_0x432f('0x2d'),this[_0x432f('0x2e')][_0x432f('0xf')](this));_0x48139b[_0x432f('0xd')](_0x432f('0x11'),this['handleFetchError']['bind'](this));_0x48139b[_0x432f('0xd')](_0x432f('0x28'),this[_0x432f('0x2f')]['bind'](this));}catch(_0xb7c1dd){logger[_0x432f('0x11')](_0xb7c1dd);}}else{this[_0x432f('0x2')][_0x432f('0x30')](!![],this[_0x432f('0x27')][_0x432f('0xf')](this));}}};EmailImap[_0x432f('0x21')][_0x432f('0x2e')]=function(_0x4c480a,_0x47a693){_0x4c480a['on'](_0x432f('0x31'),this[_0x432f('0x32')]['bind'](this));_0x4c480a['once']('attributes',this[_0x432f('0x33')][_0x432f('0xf')](this));_0x4c480a['once'](_0x432f('0x28'),this[_0x432f('0x34')][_0x432f('0xf')](this));};EmailImap['prototype'][_0x432f('0x32')]=function(_0x440420,_0x499e58){simpleParser(_0x440420,{'Iconv':Iconv},this[_0x432f('0x35')][_0x432f('0xf')](this));};EmailImap['prototype'][_0x432f('0x33')]=function(_0x41b292){};EmailImap[_0x432f('0x21')][_0x432f('0x34')]=function(){};EmailImap[_0x432f('0x21')][_0x432f('0x35')]=function(_0xbef36e,_0x2d0d80){if(_0xbef36e){logger[_0x432f('0x11')](_0xbef36e);}else{var _0x2545b7=this;utils[_0x432f('0x36')](this['account'],_0x2d0d80,function(_0x3d835e){_0x2545b7['emit'](_0x432f('0x37'),_0x3d835e);});}};EmailImap[_0x432f('0x21')]['handleFetchEnd']=function(){this[_0x432f('0x2')]['closeBox'](!![],this[_0x432f('0x27')][_0x432f('0xf')](this));};EmailImap['prototype']['handleFetchError']=function(_0xbd4240){this[_0x432f('0x12')](_0xbd4240);this[_0x432f('0x2')][_0x432f('0x30')](!![],this[_0x432f('0x27')]['bind'](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x432f('0x24')](_0x432f('0x28'));};EmailImap['prototype'][_0x432f('0x12')]=function(_0x841572,_0x41c90c){logger[_0x432f('0x11')](_0x432f('0x12'),this[_0x432f('0xc')][_0x432f('0x37')],JSON[_0x432f('0x38')](_0x841572));var _0x1c5f87='';if(_0x841572){if(_0x841572['textCode']){_0x1c5f87=_0x841572[_0x432f('0x39')];}else{for(var _0xd8264f in _0x841572){if(_0x841572['hasOwnProperty'](_0xd8264f)){_0x1c5f87+=_[_0x432f('0x3a')](_0xd8264f)+':\x20'+_0x841572[_0xd8264f]+'\x0a';}}}}if(_0x41c90c){this[_0x432f('0x2')][_0x432f('0x28')]();}else{this[_0x432f('0x24')](_0x432f('0x11'),_0x1c5f87);this[_0x432f('0x24')](_0x432f('0x28'));}};module[_0x432f('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 455d1e0..16846c8 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 _0xf2c7=['send','createTransport','use','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xf2c7,0x1ad));var _0x7f2c=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0xf2c7[_0x34bc6c];return _0x168820;};'use strict';var nodemailer=require(_0x7f2c('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0x7f2c('0x1'));function EmailSmtp(){}EmailSmtp[_0x7f2c('0x2')][_0x7f2c('0x3')]=function(_0x57795b,_0x1c18d8){return new BPromise(function(_0x3c4bad,_0x530ef6){var _0x1ed7ab=nodemailer[_0x7f2c('0x4')](_0x57795b);_0x1ed7ab[_0x7f2c('0x5')](_0x7f2c('0x6'),inlineBase64());_0x1ed7ab[_0x7f2c('0x7')](_0x1c18d8,function(_0x107b9c,_0x28d72b){if(_0x107b9c){_0x530ef6(_0x107b9c[_0x7f2c('0x8')]());}else{_0x3c4bad(_0x28d72b);}});});};EmailSmtp['prototype'][_0x7f2c('0x9')]=function(_0x2c401e){return new BPromise(function(_0x140215,_0x2e40b5){var _0x3786cd=nodemailer[_0x7f2c('0x4')](_0x2c401e);_0x3786cd[_0x7f2c('0x9')](function(_0x545ff2,_0x3899d7){if(_0x545ff2){_0x2e40b5(_0x545ff2['toString']());}else{if(_0x3899d7){_0x140215(_0x3899d7);}else{_0x2e40b5(_0x7f2c('0xa'));}}});});};module[_0x7f2c('0xb')]=EmailSmtp; \ No newline at end of file +var _0x8b29=['compile','sendMail','toString','verify','exports','nodemailer','bluebird','prototype','send','createTransport','use'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8b29,0xaa));var _0x98b2=function(_0x5adf30,_0x4c0436){_0x5adf30=_0x5adf30-0x0;var _0x1d7468=_0x8b29[_0x5adf30];return _0x1d7468;};'use strict';var nodemailer=require(_0x98b2('0x0'));var BPromise=require(_0x98b2('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x98b2('0x2')][_0x98b2('0x3')]=function(_0x509834,_0x21fecf){return new BPromise(function(_0x15cdf6,_0x177cb4){var _0x28e5b2=nodemailer[_0x98b2('0x4')](_0x509834);_0x28e5b2[_0x98b2('0x5')](_0x98b2('0x6'),inlineBase64());_0x28e5b2[_0x98b2('0x7')](_0x21fecf,function(_0x10413b,_0x3f5e7d){if(_0x10413b){_0x177cb4(_0x10413b[_0x98b2('0x8')]());}else{_0x15cdf6(_0x3f5e7d);}});});};EmailSmtp[_0x98b2('0x2')][_0x98b2('0x9')]=function(_0x29e317){return new BPromise(function(_0x471719,_0x1c195f){var _0x574c9a=nodemailer[_0x98b2('0x4')](_0x29e317);_0x574c9a[_0x98b2('0x9')](function(_0xe117b9,_0x35f1a3){if(_0xe117b9){_0x1c195f(_0xe117b9[_0x98b2('0x8')]());}else{if(_0x35f1a3){_0x471719(_0x35f1a3);}else{_0x1c195f('Not\x20verifired');}}});});};module[_0x98b2('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index e257a9c..5c5443a 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 _0xa73a=['length','join','Anonymous','split','pop','isEmpty','generate','@xcally.com','html','test','replace','attachments','forEach','push','_SRC','_IMG','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Data','getHost','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','127.0.0.1','moment','randomstring','path','util','node-tnef','head','value','address','anonymous','name'];(function(_0x3b110d,_0x369a48){var _0x57833f=function(_0x11cfb3){while(--_0x11cfb3){_0x3b110d['push'](_0x3b110d['shift']());}};_0x57833f(++_0x369a48);}(_0xa73a,0x82));var _0xaa73=function(_0x4be8ba,_0x5d10ba){_0x4be8ba=_0x4be8ba-0x0;var _0x1af822=_0xa73a[_0x4be8ba];return _0x1af822;};'use strict';var _=require('lodash');var moment=require(_0xaa73('0x0'));var random=require(_0xaa73('0x1'));var fs=require('fs');var path=require(_0xaa73('0x2'));var util=require(_0xaa73('0x3'));var tnef=require(_0xaa73('0x4'));var logger=require('../../../config/logger')('email');var config=require('../../../config/environment');function getAddress(_0x35025d){var _0x333e8d=_[_0xaa73('0x5')](_0x35025d[_0xaa73('0x6')]);return _0x333e8d&&_0x333e8d[_0xaa73('0x7')]?_0x333e8d[_0xaa73('0x7')]:_0xaa73('0x8')+random['generate'](0x6)+'@xcally.com';}function getFirstName(_0x3d0e03){var _0x34c29a=_[_0xaa73('0x5')](_0x3d0e03[_0xaa73('0x6')]);if(_0x34c29a&&_0x34c29a[_0xaa73('0x9')]){var _0x33a628=_0x34c29a['name']['split'](/\s+/);return _0x33a628[_0xaa73('0xa')]?_0x33a628['slice'](0x0,-0x1)[_0xaa73('0xb')]('\x20'):_0x34c29a['name'];}return _0xaa73('0xc');}function getLastName(_0x3f99ef){var _0x393b4c=_[_0xaa73('0x5')](_0x3f99ef[_0xaa73('0x6')]);if(_0x393b4c&&_0x393b4c[_0xaa73('0x9')]){var _0x5e3bba=_0x393b4c[_0xaa73('0x9')][_0xaa73('0xd')](/\s+/);return _0x5e3bba[_0xaa73('0xa')]>0x1?_0x5e3bba[_0xaa73('0xe')]():'';}return'';}function getMails(_0xc4a8e,_0x319e55){var _0x2139a4='';for(var _0x626226=0x0;_0x626226<_0x319e55[_0xaa73('0x6')]['length'];_0x626226+=0x1){if(_0x319e55[_0xaa73('0x6')][_0x626226]['address']!==_0xc4a8e){if(!_[_0xaa73('0xf')](_0x2139a4)){_0x2139a4+=',';}_0x2139a4+=_0x319e55[_0xaa73('0x6')][_0x626226][_0xaa73('0x9')]||_0x319e55['value'][_0x626226]['address']||'';_0x2139a4+='\x20<';_0x2139a4+=_0x319e55[_0xaa73('0x6')][_0x626226]['address']?_0x319e55[_0xaa73('0x6')][_0x626226][_0xaa73('0x7')]:'anonymous'+random[_0xaa73('0x10')](0x6)+_0xaa73('0x11');_0x2139a4+='>';}}return _0x2139a4;}function parseEmail(_0x2de907,_0x6efaf2,_0x213b12){if(_0x6efaf2[_0xaa73('0x12')]){var _0x4de045=/)<[^<]*)*<\/script>/gi;while(_0x4de045[_0xaa73('0x13')](_0x6efaf2['html'])){_0x6efaf2[_0xaa73('0x12')]=_0x6efaf2[_0xaa73('0x12')][_0xaa73('0x14')](_0x4de045,'');}if(_0x6efaf2[_0xaa73('0x12')]['includes']('{_0x5303eb[_0xaa73('0x17')](_0x2d7798['filename']);});var _0x233764=/]+>/g;var _0x2809fc=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x24f853=_0x6efaf2['html'][_0xaa73('0x14')](_0x2809fc,_0xaa73('0x18'));var _0x2e34a8=_0x24f853[_0xaa73('0x14')](_0x233764,_0xaa73('0x19'));for(let _0x1253aa=0x0;_0x1253aa<_0x5303eb[_0xaa73('0xa')];_0x1253aa++){var _0x3ab19f=_0x2e34a8['replace']('_IMG','\x20[Attachment:\x20'+_0x5303eb[_0x1253aa]+_0xaa73('0x1a'));_0x2e34a8=_0x3ab19f;}_0x6efaf2['html']=_0x2e34a8;}_0x213b12['body']=_0x6efaf2['html'];}else{_0x213b12[_0xaa73('0x1b')]=_0x6efaf2[_0xaa73('0x1c')];}if(_0x213b12['body']){_0x213b12['body']=_0x213b12['body'][_0xaa73('0x14')](/\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x30939b[_0xaa83('0x10')]():'';}return'';}function getMails(_0x59830c,_0x2995d3){var _0x44695c='';for(var _0x2545ba=0x0;_0x2545ba<_0x2995d3[_0xaa83('0x8')][_0xaa83('0xf')];_0x2545ba+=0x1){if(_0x2995d3[_0xaa83('0x8')][_0x2545ba][_0xaa83('0x9')]!==_0x59830c){if(!_[_0xaa83('0x11')](_0x44695c)){_0x44695c+=',';}_0x44695c+=_0x2995d3[_0xaa83('0x8')][_0x2545ba][_0xaa83('0xa')]||_0x2995d3[_0xaa83('0x8')][_0x2545ba][_0xaa83('0x9')]||'';_0x44695c+='\x20<';_0x44695c+=_0x2995d3['value'][_0x2545ba]['address']?_0x2995d3[_0xaa83('0x8')][_0x2545ba][_0xaa83('0x9')]:_0xaa83('0x12')+random[_0xaa83('0x13')](0x6)+_0xaa83('0x14');_0x44695c+='>';}}return _0x44695c;}function parseEmail(_0x5b2739,_0x3f4312,_0x27a7bb){if(_0x3f4312['html']){var _0x59c784=/)<[^<]*)*<\/script>/gi;while(_0x59c784[_0xaa83('0x15')](_0x3f4312[_0xaa83('0x16')])){_0x3f4312[_0xaa83('0x16')]=_0x3f4312['html'][_0xaa83('0x17')](_0x59c784,'');}if(_0x3f4312[_0xaa83('0x16')][_0xaa83('0x18')](_0xaa83('0x19'))){var _0x278160=[];_0x3f4312[_0xaa83('0x1a')][_0xaa83('0x1b')](_0x4003d1=>{_0x278160[_0xaa83('0x1c')](_0x4003d1[_0xaa83('0x1d')]);});var _0x46d1d6=/]+>/g;var _0x458428=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x53d4a9=_0x3f4312[_0xaa83('0x16')][_0xaa83('0x17')](_0x458428,'_SRC');var _0x328a11=_0x53d4a9[_0xaa83('0x17')](_0x46d1d6,_0xaa83('0x1e'));for(let _0x22cad2=0x0;_0x22cad2<_0x278160[_0xaa83('0xf')];_0x22cad2++){var _0x4b7fe5=_0x328a11[_0xaa83('0x17')]('_IMG',_0xaa83('0x1f')+_0x278160[_0x22cad2]+_0xaa83('0x20'));_0x328a11=_0x4b7fe5;}_0x3f4312['html']=_0x328a11;}_0x27a7bb[_0xaa83('0x21')]=_0x3f4312[_0xaa83('0x16')];}else{_0x27a7bb['body']=_0x3f4312[_0xaa83('0x22')];}if(_0x27a7bb[_0xaa83('0x21')]){_0x27a7bb[_0xaa83('0x21')]=_0x27a7bb['body'][_0xaa83('0x17')](/Empty\x20message

';if(_0x3dffe9[_0xaa83('0x3e')]){for(var _0x534286=0x0;_0x534286<_0x3dffe9[_0xaa83('0x3e')][_0xaa83('0xf')];_0x534286++){var _0x15ecc9=_0x3dffe9[_0xaa83('0x3e')][_0x534286];_0x2a3ec5[_0xaa83('0x24')][_0xaa83('0x1a')][_0xaa83('0x1c')]({'filename':_0x15ecc9['Title'],'content':new Buffer(_0x15ecc9[_0xaa83('0x3f')])});}}}_0x50da05(parseEmail(_0x1f56f9,_0x4844f1,_0x2a3ec5));});}else{_0x4844f1[_0xaa83('0x16')]='

Empty\x20message

';_0x50da05(parseEmail(_0x1f56f9,_0x4844f1,_0x2a3ec5));}}else{_0x50da05(parseEmail(_0x1f56f9,_0x4844f1,_0x2a3ec5));}};exports[_0xaa83('0x40')]=function(_0x1c3331){switch(_0x1c3331){case _0xaa83('0x41'):return _0xaa83('0x42');case _0xaa83('0x43'):return _0xaa83('0x44');case _0xaa83('0x45'):return _0xaa83('0x46');case _0xaa83('0x47'):return _0xaa83('0x48');}return _0xaa83('0x49');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 7a0ae2c..381c8bf 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff5a=['exports','lodash','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x3b215f,_0x1f68de){var _0xfe733c=function(_0x52f410){while(--_0x52f410){_0x3b215f['push'](_0x3b215f['shift']());}};_0xfe733c(++_0x1f68de);}(_0xff5a,0x88));var _0xaff5=function(_0x265613,_0x1dd748){_0x265613=_0x265613-0x0;var _0x35d74f=_0xff5a[_0x265613];return _0x35d74f;};'use strict';var _=require(_0xaff5('0x0'));function MailAccount(_0x43efd1){this['id']=_0x43efd1['id']||0x0;this[_0xaff5('0x1')]=_0x43efd1[_0xaff5('0x1')]||_0xaff5('0x2');this[_0xaff5('0x3')]=_0x43efd1[_0xaff5('0x3')]||_0xaff5('0x4');this['active']=_0x43efd1[_0xaff5('0x5')]||![];this[_0xaff5('0x6')]=_0x43efd1[_0xaff5('0x6')]||[];this[_0xaff5('0x7')]=_0x43efd1[_0xaff5('0x7')]||[];}module[_0xaff5('0x8')]=MailAccount; \ No newline at end of file +var _0xa586=['key','SERV','active','Imap','Smtp','exports','lodash','name'];(function(_0x53673d,_0x1bff0a){var _0x4ea690=function(_0x21c803){while(--_0x21c803){_0x53673d['push'](_0x53673d['shift']());}};_0x4ea690(++_0x1bff0a);}(_0xa586,0x136));var _0x6a58=function(_0x77d286,_0x1ddc6d){_0x77d286=_0x77d286-0x0;var _0x5446a5=_0xa586[_0x77d286];return _0x5446a5;};'use strict';var _=require(_0x6a58('0x0'));function MailAccount(_0x5358b4){this['id']=_0x5358b4['id']||0x0;this[_0x6a58('0x1')]=_0x5358b4[_0x6a58('0x1')]||'Service';this[_0x6a58('0x2')]=_0x5358b4[_0x6a58('0x2')]||_0x6a58('0x3');this[_0x6a58('0x4')]=_0x5358b4['active']||![];this[_0x6a58('0x5')]=_0x5358b4[_0x6a58('0x5')]||[];this[_0x6a58('0x6')]=_0x5358b4['Smtp']||[];}module[_0x6a58('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index fcd96db..f0b9858 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x65b3=['length','isUndefined','merge','exports','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts'];(function(_0x4b9b7b,_0x5083dd){var _0x16a8e4=function(_0x438fc7){while(--_0x438fc7){_0x4b9b7b['push'](_0x4b9b7b['shift']());}};_0x16a8e4(++_0x5083dd);}(_0x65b3,0x1a2));var _0x365b=function(_0x423097,_0x8a09f4){_0x423097=_0x423097-0x0;var _0x3a73f1=_0x65b3[_0x423097];return _0x3a73f1;};'use strict';var _=require('lodash');var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x365b('0x0')]={};};function freeIsNotKey(_0x2e7c85,_0x41020f,_0x2c2c25){var _0x27406d=_['mapKeys'](_0x2e7c85,function(_0x5cdcf4,_0x17b17a){return _0x5cdcf4[_0x2c2c25];});for(var _0x15d0d9 in _0x41020f){if(_0x41020f[_0x365b('0x1')](_0x15d0d9)){if(!_0x27406d[_0x15d0d9]){delete _0x41020f[_0x15d0d9];}}}}Realtime[_0x365b('0x2')][_0x365b('0x3')]=function(_0x233ef8,_0x381e81){for(var _0x357a62 in _0x381e81){if(_0x233ef8['hasOwnProperty'](_0x357a62)){_0x233ef8[_0x357a62]=_0x381e81[_0x357a62];}}};Realtime[_0x365b('0x2')][_0x365b('0x4')]=function(){var _0x2e8e6c=this;return function(_0x125e4d){if(_0x125e4d){freeIsNotKey(_0x125e4d,_0x2e8e6c[_0x365b('0x0')],'id');for(var _0x1791eb=0x0,_0x148978={},_0xe36889={};_0x1791eb<_0x125e4d[_0x365b('0x5')];_0x1791eb+=0x1){_0x148978=_0x125e4d[_0x1791eb];if(_[_0x365b('0x6')](_0x2e8e6c[_0x365b('0x0')][_0x148978['id']])){_0x2e8e6c[_0x365b('0x0')][_0x148978['id']]=new MailAccount(_0x148978);}else{_[_0x365b('0x7')](_0x2e8e6c[_0x365b('0x0')][_0x148978['id']],_0x148978);}}}return _0x2e8e6c[_0x365b('0x0')];};};module[_0x365b('0x8')]=Realtime; \ No newline at end of file +var _0xf180=['mergeFromDatabase','initMailAccounts','length','isUndefined','mailAccounts','merge','exports','lodash','mapKeys'];(function(_0x5b10b9,_0x364b33){var _0x4c7400=function(_0x2f8e53){while(--_0x2f8e53){_0x5b10b9['push'](_0x5b10b9['shift']());}};_0x4c7400(++_0x364b33);}(_0xf180,0xfa));var _0x0f18=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xf180[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x0f18('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x14df16,_0x414529,_0x12c710){var _0x466b8d=_[_0x0f18('0x1')](_0x14df16,function(_0x5257f5,_0x322b6f){return _0x5257f5[_0x12c710];});for(var _0x251769 in _0x414529){if(_0x414529['hasOwnProperty'](_0x251769)){if(!_0x466b8d[_0x251769]){delete _0x414529[_0x251769];}}}}Realtime['prototype'][_0x0f18('0x2')]=function(_0x482076,_0x5e61a9){for(var _0x48c5a1 in _0x5e61a9){if(_0x482076['hasOwnProperty'](_0x48c5a1)){_0x482076[_0x48c5a1]=_0x5e61a9[_0x48c5a1];}}};Realtime['prototype'][_0x0f18('0x3')]=function(){var _0x423992=this;return function(_0x53a153){if(_0x53a153){freeIsNotKey(_0x53a153,_0x423992['mailAccounts'],'id');for(var _0x1b9d04=0x0,_0x360ca8={},_0x233612={};_0x1b9d04<_0x53a153[_0x0f18('0x4')];_0x1b9d04+=0x1){_0x360ca8=_0x53a153[_0x1b9d04];if(_[_0x0f18('0x5')](_0x423992[_0x0f18('0x6')][_0x360ca8['id']])){_0x423992[_0x0f18('0x6')][_0x360ca8['id']]=new MailAccount(_0x360ca8);}else{_[_0x0f18('0x7')](_0x423992['mailAccounts'][_0x360ca8['id']],_0x360ca8);}}}return _0x423992['mailAccounts'];};};module[_0x0f18('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 36acdff..9c303fd 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a8b=['MailServerIn','Imap','Smtp','notify','Request','NotifyMailAccount','../client','GetMailAccount','name','email','key','TemplateId'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8a8b,0xae));var _0xb8a8=function(_0x31c8f5,_0x2f6952){_0x31c8f5=_0x31c8f5-0x0;var _0x39ecb5=_0x8a8b[_0x31c8f5];return _0x39ecb5;};'use strict';var client=require(_0xb8a8('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request'](_0xb8a8('0x1'),{'options':{'attributes':['id',_0xb8a8('0x2'),'service',_0xb8a8('0x3'),'active',_0xb8a8('0x4'),'ListId',_0xb8a8('0x5')],'raw':![],'include':[{'model':_0xb8a8('0x6'),'as':_0xb8a8('0x7')},{'model':'MailServerOut','as':_0xb8a8('0x8')}]},'log':'getMailAccount'});};};exports[_0xb8a8('0x9')]=function(_0x4c46e9,_0x79cb4a){return client[_0xb8a8('0xa')](_0xb8a8('0xb'),{'account':{'id':_0x4c46e9},'body':_0x79cb4a,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0xc73a=['TemplateId','MailServerIn','Imap','Smtp','getMailAccount','notify','getMailAccounts','Request','GetMailAccount','email','active','key'];(function(_0x4d66c2,_0x452dee){var _0x552b06=function(_0x51b28e){while(--_0x51b28e){_0x4d66c2['push'](_0x4d66c2['shift']());}};_0x552b06(++_0x452dee);}(_0xc73a,0x72));var _0xac73=function(_0x5effb8,_0xbdd29c){_0x5effb8=_0x5effb8-0x0;var _0x4f9883=_0xc73a[_0x5effb8];return _0x4f9883;};'use strict';var client=require('../client');exports[_0xac73('0x0')]=function(){return function(){return client[_0xac73('0x1')](_0xac73('0x2'),{'options':{'attributes':['id','name','service',_0xac73('0x3'),_0xac73('0x4'),_0xac73('0x5'),'ListId',_0xac73('0x6')],'raw':![],'include':[{'model':_0xac73('0x7'),'as':_0xac73('0x8')},{'model':'MailServerOut','as':_0xac73('0x9')}]},'log':_0xac73('0xa')});};};exports[_0xac73('0xb')]=function(_0x22638a,_0x4fe9a1){return client[_0xac73('0x1')]('NotifyMailAccount',{'account':{'id':_0x22638a},'body':_0x4fe9a1,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index da2d26e..96f695a 100644 --- a/server/services/email/rpc/setting.js +++ b/server/services/email/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x387a=['Request','ShowSetting','getSettings'];(function(_0x4b3fa1,_0x497557){var _0x3a9c0a=function(_0x1ae720){while(--_0x1ae720){_0x4b3fa1['push'](_0x4b3fa1['shift']());}};_0x3a9c0a(++_0x497557);}(_0x387a,0x6e));var _0xa387=function(_0x2e1e3e,_0x6e7b3f){_0x2e1e3e=_0x2e1e3e-0x0;var _0x423694=_0x387a[_0x2e1e3e];return _0x423694;};'use strict';var client=require('../client');exports[_0xa387('0x0')]=function(){return client[_0xa387('0x1')](_0xa387('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':'GetSettings'});}; \ No newline at end of file +var _0x78d7=['GetSettings','getSettings'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x78d7,0xbf));var _0x778d=function(_0x255154,_0x5edd0a){_0x255154=_0x255154-0x0;var _0x497d16=_0x78d7[_0x255154];return _0x497d16;};'use strict';var client=require('../client');exports[_0x778d('0x0')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x778d('0x1')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 9880437..b556ef4 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0311=['message','catch','error','verifySmtp','then','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','../../../config/logger','listen','sendMail','account'];(function(_0x33eb0a,_0x1afe17){var _0x28cd85=function(_0x278a28){while(--_0x278a28){_0x33eb0a['push'](_0x33eb0a['shift']());}};_0x28cd85(++_0x1afe17);}(_0x0311,0x1ed));var _0x1031=function(_0x5964ca,_0x2a7f19){_0x5964ca=_0x5964ca-0x0;var _0x212464=_0x0311[_0x5964ca];return _0x212464;};'use strict';var jayson=require(_0x1031('0x0'));var BPromise=require(_0x1031('0x1'));var _=require(_0x1031('0x2'));var logger=require(_0x1031('0x3'))('email');exports[_0x1031('0x4')]=function(_0x7e4adf,_0x429a67){return new BPromise(function(_0x5b45ed,_0x3f6cef){var _0x532d28={'SendMail':function(_0x3da786){var _0x10c2f3=this;return new Promise(function(_0x2a5359,_0x2f6849){_0x429a67[_0x1031('0x5')](_0x3da786[_0x1031('0x6')],_0x3da786[_0x1031('0x7')])['then'](function(_0x28da03){_0x2a5359({'code':0xc8,'message':_0x28da03});})[_0x1031('0x8')](function(_0x2aa79e){_0x2f6849(_0x10c2f3[_0x1031('0x9')](0x1f4,_0x2aa79e));});});},'VerifySmtp':function(_0x41d397){var _0x132a63=this;return new Promise(function(_0xad9840,_0x3146c3){_0x429a67[_0x1031('0xa')](_0x41d397['account'])[_0x1031('0xb')](function(_0x24f2f8){_0xad9840({'code':0xc8,'message':'Verified'});})[_0x1031('0x8')](function(_0x1e3874){_0x3146c3(_0x132a63[_0x1031('0x9')](0x1f4,_0x1e3874));});});},'MailAccounts':function(_0x587fd9){return new Promise(function(_0x4a037,_0x558de3){var _0x17067b=_[_0x1031('0xc')](_0x7e4adf[_0x1031('0xd')]);for(var _0x54860b=0x0;_0x54860b<_0x17067b[_0x1031('0xe')];_0x54860b+=0x1){if(_0x17067b[_0x54860b][_0x1031('0xf')]&&_0x17067b[_0x54860b][_0x1031('0xf')][_0x1031('0x10')]){delete _0x17067b[_0x54860b][_0x1031('0xf')][_0x1031('0x10')];}if(_0x17067b[_0x54860b]['Smtp']&&_0x17067b[_0x54860b][_0x1031('0x11')]['pass']){delete _0x17067b[_0x54860b][_0x1031('0x11')][_0x1031('0x12')];}}_0x4a037({'count':_0x17067b[_0x1031('0xe')],'rows':_0x17067b});});}};var _0xf207c1=jayson[_0x1031('0x13')](_0x532d28)[_0x1031('0x14')]();_0xf207c1['on']('error',function(_0xbb9518){logger[_0x1031('0x9')](JSON['stringify'](_0xbb9518));return _0x3f6cef(_0xbb9518);});_0xf207c1[_0x1031('0x4')](0x232b,_0x1031('0x15'),function(){console[_0x1031('0x16')](_0x1031('0x17'),0x232b);return _0x5b45ed(_0x1031('0x18')+0x232b);});});}; \ No newline at end of file +var _0x189f=['message','then','catch','error','verifySmtp','Verified','values','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','../../../config/logger','email','listen','account'];(function(_0x29d0e4,_0x214110){var _0x6cd8b0=function(_0x4f8a46){while(--_0x4f8a46){_0x29d0e4['push'](_0x29d0e4['shift']());}};_0x6cd8b0(++_0x214110);}(_0x189f,0x119));var _0xf189=function(_0x180fc6,_0x5f3c92){_0x180fc6=_0x180fc6-0x0;var _0x4dbf08=_0x189f[_0x180fc6];return _0x4dbf08;};'use strict';var jayson=require(_0xf189('0x0'));var BPromise=require(_0xf189('0x1'));var _=require(_0xf189('0x2'));var logger=require(_0xf189('0x3'))(_0xf189('0x4'));exports[_0xf189('0x5')]=function(_0x6ba4d7,_0x396e50){return new BPromise(function(_0x461688,_0x5a3fd3){var _0x4e954a={'SendMail':function(_0x5f04dd){var _0x1d05e4=this;return new Promise(function(_0x292740,_0x2b676f){_0x396e50['sendMail'](_0x5f04dd[_0xf189('0x6')],_0x5f04dd[_0xf189('0x7')])[_0xf189('0x8')](function(_0xd09294){_0x292740({'code':0xc8,'message':_0xd09294});})[_0xf189('0x9')](function(_0x3281bd){_0x2b676f(_0x1d05e4[_0xf189('0xa')](0x1f4,_0x3281bd));});});},'VerifySmtp':function(_0x4c17a5){var _0x65c476=this;return new Promise(function(_0xcf1094,_0x3eebcf){_0x396e50[_0xf189('0xb')](_0x4c17a5[_0xf189('0x6')])[_0xf189('0x8')](function(_0x1fee74){_0xcf1094({'code':0xc8,'message':_0xf189('0xc')});})[_0xf189('0x9')](function(_0x49e8d6){_0x3eebcf(_0x65c476[_0xf189('0xa')](0x1f4,_0x49e8d6));});});},'MailAccounts':function(_0xf8ffef){return new Promise(function(_0x4ba241,_0x4e00fa){var _0x428c07=_[_0xf189('0xd')](_0x6ba4d7['mailAccounts']);for(var _0x13682a=0x0;_0x13682a<_0x428c07[_0xf189('0xe')];_0x13682a+=0x1){if(_0x428c07[_0x13682a]['Imap']&&_0x428c07[_0x13682a][_0xf189('0xf')][_0xf189('0x10')]){delete _0x428c07[_0x13682a]['Imap'][_0xf189('0x10')];}if(_0x428c07[_0x13682a][_0xf189('0x11')]&&_0x428c07[_0x13682a]['Smtp'][_0xf189('0x12')]){delete _0x428c07[_0x13682a]['Smtp'][_0xf189('0x12')];}}_0x4ba241({'count':_0x428c07[_0xf189('0xe')],'rows':_0x428c07});});}};var _0x152a0d=jayson[_0xf189('0x13')](_0x4e954a)[_0xf189('0x14')]();_0x152a0d['on'](_0xf189('0xa'),function(_0x46b90a){logger[_0xf189('0xa')](JSON[_0xf189('0x15')](_0x46b90a));return _0x5a3fd3(_0x46b90a);});_0x152a0d[_0xf189('0x5')](0x232b,_0xf189('0x16'),function(){console['log']('Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232b);return _0x461688(_0xf189('0x17')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index f824912..be73126 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x50f3=['redis','socket.io-redis','../../config/triggers','../../config/socketio','default','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','express','ioredis','../../config/environment','createServer','timeout','listen','port','websocket','defaults'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x50f3,0xaa));var _0x350f=function(_0x8fa36f,_0x2b30ee){_0x8fa36f=_0x8fa36f-0x0;var _0x2c166a=_0x50f3[_0x8fa36f];return _0x2c166a;};'use strict';var _=require('lodash');var http=require(_0x350f('0x0'));var express=require(_0x350f('0x1'));var sticky=require('sticky-session');var Redis=require(_0x350f('0x2'));var config=require(_0x350f('0x3'));var app=express();var server=http[_0x350f('0x4')](app);server[_0x350f('0x5')]=0xdbba0;if(sticky[_0x350f('0x6')](server,config[_0x350f('0x7')])){var socketio=require('socket.io')(server,{'transports':[_0x350f('0x8'),'polling']});config['redis']=_[_0x350f('0x9')](config[_0x350f('0xa')],{'host':'localhost','port':0x18eb});socketio['adapter'](require(_0x350f('0xb'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x350f('0xa')])}));require(_0x350f('0xc'))['default']();require(_0x350f('0xd'))[_0x350f('0xe')](socketio);require('../../config/express')[_0x350f('0xe')](app);require('../../routes')[_0x350f('0xe')](app);}else{server[_0x350f('0xf')](_0x350f('0x10'),function(){console[_0x350f('0x11')](_0x350f('0x12'),config[_0x350f('0x7')]);});}exports=module[_0x350f('0x13')]=app; \ No newline at end of file +var _0x5b24=['log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','socket.io','websocket','redis','defaults','adapter','socket.io-redis','../../config/triggers','../../config/socketio','../../config/express','default','../../routes','once','listening'];(function(_0x3f7da3,_0x2ad30c){var _0x436717=function(_0x1c3f69){while(--_0x1c3f69){_0x3f7da3['push'](_0x3f7da3['shift']());}};_0x436717(++_0x2ad30c);}(_0x5b24,0x17a));var _0x45b2=function(_0x1d5cfa,_0x57efb0){_0x1d5cfa=_0x1d5cfa-0x0;var _0x19a273=_0x5b24[_0x1d5cfa];return _0x19a273;};'use strict';var _=require(_0x45b2('0x0'));var http=require(_0x45b2('0x1'));var express=require(_0x45b2('0x2'));var sticky=require(_0x45b2('0x3'));var Redis=require(_0x45b2('0x4'));var config=require(_0x45b2('0x5'));var app=express();var server=http[_0x45b2('0x6')](app);server[_0x45b2('0x7')]=0xdbba0;if(sticky[_0x45b2('0x8')](server,config['port'])){var socketio=require(_0x45b2('0x9'))(server,{'transports':[_0x45b2('0xa'),'polling']});config[_0x45b2('0xb')]=_[_0x45b2('0xc')](config['redis'],{'host':'localhost','port':0x18eb});socketio[_0x45b2('0xd')](require(_0x45b2('0xe'))({'pubClient':new Redis(config[_0x45b2('0xb')]),'subClient':new Redis(config[_0x45b2('0xb')])}));require(_0x45b2('0xf'))['default']();require(_0x45b2('0x10'))['default'](socketio);require(_0x45b2('0x11'))[_0x45b2('0x12')](app);require(_0x45b2('0x13'))[_0x45b2('0x12')](app);}else{server[_0x45b2('0x14')](_0x45b2('0x15'),function(){console[_0x45b2('0x16')](_0x45b2('0x17'),config[_0x45b2('0x18')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 55a4fd2..75470ff 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe06f=['catch','exports','jayson/promise','bluebird','routing','http','Request','debug','rpc','error','message'];(function(_0x2f1818,_0xd73e6){var _0x44ac16=function(_0x3015b7){while(--_0x3015b7){_0x2f1818['push'](_0x2f1818['shift']());}};_0x44ac16(++_0xd73e6);}(_0xe06f,0x65));var _0xfe06=function(_0x466b8b,_0x4aaeda){_0x466b8b=_0x466b8b-0x0;var _0x1b2871=_0xe06f[_0x466b8b];return _0x1b2871;};'use strict';var jayson=require(_0xfe06('0x0'));var BPromise=require(_0xfe06('0x1'));var logger=require('../../config/logger')(_0xfe06('0x2'));var client=jayson['client'][_0xfe06('0x3')]({'port':0x2329});client[_0xfe06('0x4')]=function(_0xf4185c,_0x1f0dec){return new BPromise(function(_0x3a07cc,_0x406081){return client['request'](_0xf4185c,_0x1f0dec)['then'](function(_0x530973){logger[_0xfe06('0x5')](_0xfe06('0x6'),_0xfe06('0x2'),_0xf4185c,_0x1f0dec,_0x530973);if(_0x530973[_0xfe06('0x7')]){logger[_0xfe06('0x7')](_0xfe06('0x6'),'routing',_0xf4185c,_0x530973[_0xfe06('0x7')][_0xfe06('0x8')],_0x1f0dec);return _0x406081(_0x530973[_0xfe06('0x7')][_0xfe06('0x8')]);}else{return _0x3a07cc(_0x530973['result']);}})[_0xfe06('0x9')](function(_0x141a8b){logger[_0xfe06('0x7')](_0xfe06('0x6'),_0xfe06('0x2'),_0xf4185c,_0x141a8b,_0x1f0dec);return _0x406081(_0x141a8b);});});};module[_0xfe06('0xa')]=client; \ No newline at end of file +var _0x4a9c=['client','http','then','debug','rpc','error','message','result','catch','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x147790,_0x1cec6c){var _0x4465e1=function(_0x182c23){while(--_0x182c23){_0x147790['push'](_0x147790['shift']());}};_0x4465e1(++_0x1cec6c);}(_0x4a9c,0xcc));var _0xc4a9=function(_0x31b05f,_0x570d3e){_0x31b05f=_0x31b05f-0x0;var _0x2c12b3=_0x4a9c[_0x31b05f];return _0x2c12b3;};'use strict';var jayson=require(_0xc4a9('0x0'));var BPromise=require(_0xc4a9('0x1'));var logger=require(_0xc4a9('0x2'))(_0xc4a9('0x3'));var client=jayson[_0xc4a9('0x4')][_0xc4a9('0x5')]({'port':0x2329});client['Request']=function(_0x282978,_0x935998){return new BPromise(function(_0x129b6f,_0x5e8057){return client['request'](_0x282978,_0x935998)[_0xc4a9('0x6')](function(_0x2f35e4){logger[_0xc4a9('0x7')](_0xc4a9('0x8'),'routing',_0x282978,_0x935998,_0x2f35e4);if(_0x2f35e4[_0xc4a9('0x9')]){logger['error']('rpc',_0xc4a9('0x3'),_0x282978,_0x2f35e4[_0xc4a9('0x9')][_0xc4a9('0xa')],_0x935998);return _0x5e8057(_0x2f35e4[_0xc4a9('0x9')][_0xc4a9('0xa')]);}else{return _0x129b6f(_0x2f35e4[_0xc4a9('0xb')]);}})[_0xc4a9('0xc')](function(_0x3ddfc4){logger[_0xc4a9('0x9')](_0xc4a9('0x8'),_0xc4a9('0x3'),_0x282978,_0x3ddfc4,_0x935998);return _0x5e8057(_0x3ddfc4);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 773355a..1ef6051 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa22e=['then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve'];(function(_0x3e9ef3,_0x21a7e4){var _0x333748=function(_0x3e7c45){while(--_0x3e7c45){_0x3e9ef3['push'](_0x3e9ef3['shift']());}};_0x333748(++_0x21a7e4);}(_0xa22e,0x66));var _0xea22=function(_0x3129ee,_0x6d0876){_0x3129ee=_0x3129ee-0x0;var _0x2fc0c2=_0xa22e[_0x3129ee];return _0x2fc0c2;};'use strict';var BPromise=require('bluebird');var server=require(_0xea22('0x0'));var Realtime=require(_0xea22('0x1'));var user=require(_0xea22('0x2'));var interval=require(_0xea22('0x3'));var openchannelQueue=require(_0xea22('0x4'));var chatQueue=require(_0xea22('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xea22('0x6'));var faxQueue=require(_0xea22('0x7'));var whatsappQueue=require(_0xea22('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xea22('0x9')]()[_0xea22('0xa')](user[_0xea22('0xb')]())[_0xea22('0xa')](realtime[_0xea22('0xc')]())[_0xea22('0xa')](interval[_0xea22('0xd')]())[_0xea22('0xa')](realtime[_0xea22('0xe')]())[_0xea22('0xa')](openchannelQueue[_0xea22('0xf')]())[_0xea22('0xa')](realtime[_0xea22('0x10')]())[_0xea22('0xa')](chatQueue[_0xea22('0x11')]())['then'](realtime[_0xea22('0x12')]())[_0xea22('0xa')](smsQueue['getSmsQueues']())['then'](realtime[_0xea22('0x13')]())[_0xea22('0xa')](mailQueue[_0xea22('0x14')]())[_0xea22('0xa')](realtime[_0xea22('0x15')]())['then'](faxQueue[_0xea22('0x16')]())['then'](realtime[_0xea22('0x17')]())[_0xea22('0xa')](whatsappQueue[_0xea22('0x18')]())[_0xea22('0xa')](realtime[_0xea22('0x19')]())[_0xea22('0xa')](function(){return realtime;});}function main(){return server[_0xea22('0x1a')](realtime)[_0xea22('0xa')](function(_0x477fbf){return initRealtime();})[_0xea22('0xa')](function(_0x22784e){return setInterval(initRealtime,0x1388);})['catch'](function(_0x9243eb){console[_0xea22('0x1b')](_0x9243eb);});}main(); \ No newline at end of file +var _0xc32f=['./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','getAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getFaxQueues','initWhatsappQueues','catch','log','./server','./realtime','./rpc/interval'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0xc32f,0xd9));var _0xfc32=function(_0x52905c,_0x49eb12){_0x52905c=_0x52905c-0x0;var _0x45b78f=_0xc32f[_0x52905c];return _0x45b78f;};'use strict';var BPromise=require('bluebird');var server=require(_0xfc32('0x0'));var Realtime=require(_0xfc32('0x1'));var user=require('./rpc/user');var interval=require(_0xfc32('0x2'));var openchannelQueue=require(_0xfc32('0x3'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xfc32('0x4'));var mailQueue=require(_0xfc32('0x5'));var faxQueue=require(_0xfc32('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xfc32('0x7')]()[_0xfc32('0x8')](user[_0xfc32('0x9')]())[_0xfc32('0x8')](realtime['initAgents']())[_0xfc32('0x8')](interval[_0xfc32('0xa')]())[_0xfc32('0x8')](realtime[_0xfc32('0xb')]())['then'](openchannelQueue['getOpenchannelQueues']())[_0xfc32('0x8')](realtime[_0xfc32('0xc')]())[_0xfc32('0x8')](chatQueue[_0xfc32('0xd')]())['then'](realtime['initChatQueues']())[_0xfc32('0x8')](smsQueue[_0xfc32('0xe')]())[_0xfc32('0x8')](realtime[_0xfc32('0xf')]())['then'](mailQueue['getMailQueues']())[_0xfc32('0x8')](realtime['initMailQueues']())['then'](faxQueue[_0xfc32('0x10')]())[_0xfc32('0x8')](realtime['initFaxQueues']())['then'](whatsappQueue['getWhatsappQueues']())['then'](realtime[_0xfc32('0x11')]())[_0xfc32('0x8')](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x21f8b8){return initRealtime();})['then'](function(_0x872b6){return setInterval(initRealtime,0x1388);})[_0xfc32('0x12')](function(_0x55d386){console[_0xfc32('0x13')](_0x55d386);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index e74b189..283f00a 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa70f=['clone','consequence','ruleRef','name','index_','call','nextTick','next','isEqual','length','condition','matchPath','noop','findRules','matches','turn','map','toString','fromJSON','parse','object','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','isArray','concat','isObject','push','sync','filter','orderBy','asc','execute','result'];(function(_0x11fc71,_0x393cfa){var _0x3bf92b=function(_0x452b5c){while(--_0x452b5c){_0x11fc71['push'](_0x11fc71['shift']());}};_0x3bf92b(++_0x393cfa);}(_0xa70f,0x1af));var _0xfa70=function(_0x43af21,_0x33095e){_0x43af21=_0x43af21-0x0;var _0x1f7a0c=_0xa70f[_0x43af21];return _0x1f7a0c;};'use strict';var _=require('lodash');var util=require(_0xfa70('0x0'));var EventEmitter=require(_0xfa70('0x1'))[_0xfa70('0x2')];function RuleEngine(_0x2626bc,_0x21ea6a){this['init']();if(!_[_0xfa70('0x3')](_0x2626bc)){this[_0xfa70('0x4')](_0x2626bc);}if(_0x21ea6a){this[_0xfa70('0x5')]=_0x21ea6a[_0xfa70('0x5')];}return this;}util[_0xfa70('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xfa70('0x7')]['init']=function(_0x46cce8){this[_0xfa70('0x8')]=[];this[_0xfa70('0x9')]=[];};RuleEngine['prototype'][_0xfa70('0x4')]=function(_0x3f9495){if(Array[_0xfa70('0xa')](_0x3f9495)){this[_0xfa70('0x8')]=this[_0xfa70('0x8')][_0xfa70('0xb')](_0x3f9495);}else if(_0x3f9495!==null&&_[_0xfa70('0xc')](_0x3f9495)){this[_0xfa70('0x8')][_0xfa70('0xd')](_0x3f9495);}this[_0xfa70('0xe')]();};RuleEngine['prototype'][_0xfa70('0xe')]=function(){this[_0xfa70('0x9')]=this['rules'][_0xfa70('0xf')](function(_0xc2228){if(_[_0xfa70('0x3')](_0xc2228['on'])){_0xc2228['on']=!![];}if(_0xc2228['on']===!![]){return _0xc2228;}});this[_0xfa70('0x9')]=_[_0xfa70('0x10')](this[_0xfa70('0x9')],['p'],[_0xfa70('0x11')]);};RuleEngine[_0xfa70('0x7')][_0xfa70('0x12')]=function(_0x2d52f8,_0xf413d3){var _0xcc5146=![];_0x2d52f8[_0xfa70('0x13')]=!![];var _0x35613b=_[_0xfa70('0x14')](_0x2d52f8);var _0x2797d8=_[_0xfa70('0x14')](_0x2d52f8);var _0x4d02b6=this[_0xfa70('0x9')];var _0x4c3d6d=[];var _0x27c2d2=this[_0xfa70('0x5')];(function FnRuleLoop(_0x5c8bd5){var _0x43e638={'rules':function(){return _0x4d02b6;},'rule':function(){return _0x4d02b6[_0x5c8bd5];},'when':function(_0x4face9){if(_0x4face9){var _0xafe158=_0x4d02b6[_0x5c8bd5][_0xfa70('0x15')];_0xafe158[_0xfa70('0x16')]=_0x4d02b6[_0x5c8bd5]['id']||_0x4d02b6[_0x5c8bd5][_0xfa70('0x17')]||_0xfa70('0x18')+_0x5c8bd5;process['nextTick'](function(){_0x4c3d6d['push'](_0xafe158[_0xfa70('0x16')]);_0xafe158[_0xfa70('0x19')](_0x35613b,_0x43e638);});}else{process[_0xfa70('0x1a')](function(){_0x43e638[_0xfa70('0x1b')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0xcc5146=!![];return FnRuleLoop(0x0);},'next':function(_0x35d7a2){if(!_0x27c2d2&&!_[_0xfa70('0x1c')](_0x2797d8,_0x35613b)){_0x2797d8=_['clone'](_0x35613b);process[_0xfa70('0x1a')](function(){_0x43e638['restart']();});}else{process[_0xfa70('0x1a')](function(){if(_[_0xfa70('0x3')](_0x35d7a2)){return FnRuleLoop(_0x5c8bd5+0x1);}else{return FnRuleLoop(_0x35d7a2);}});}}};if(_0x5c8bd5<_0x4d02b6[_0xfa70('0x1d')]&&_0xcc5146===![]){var _0x826ead=_0x4d02b6[_0x5c8bd5][_0xfa70('0x1e')];_0x826ead[_0xfa70('0x19')](_0x35613b,_0x43e638);}else{process[_0xfa70('0x1a')](function(){_0x35613b[_0xfa70('0x1f')]=_0x4c3d6d;return _0xf413d3?_0xf413d3(_0x35613b):_[_0xfa70('0x20')]();});}}(0x0));};RuleEngine[_0xfa70('0x7')][_0xfa70('0x21')]=function(_0x1c30f8){if(_[_0xfa70('0x3')](_0x1c30f8)){return this[_0xfa70('0x8')];}else{var _0x33c899=_[_0xfa70('0x22')](_0x1c30f8);return _[_0xfa70('0xf')](this['rules'],_0x33c899);}};RuleEngine[_0xfa70('0x7')][_0xfa70('0x23')]=function(_0x1e4c56,_0x45a5f8){var _0x4a7306=_0x1e4c56==='on'||_0x1e4c56==='ON'?!![]:![];var _0x1ccee4=this['findRules'](_0x45a5f8);for(var _0x30a789=0x0,_0x3429f0=_0x1ccee4[_0xfa70('0x1d')];_0x30a789<_0x3429f0;_0x30a789+=0x1){_0x1ccee4[_0x30a789]['on']=_0x4a7306;}this[_0xfa70('0xe')]();};RuleEngine[_0xfa70('0x7')]['prioritize']=function(_0x47e3f9,_0x2fd9b6){_0x47e3f9=parseInt(_0x47e3f9,0xa);var _0x4bd451=this['findRules'](_0x2fd9b6);for(var _0x497675=0x0,_0x1e970b=_0x4bd451[_0xfa70('0x1d')];_0x497675<_0x1e970b;_0x497675+=0x1){_0x4bd451[_0x497675]['priority']=_0x47e3f9;}this[_0xfa70('0xe')]();};RuleEngine[_0xfa70('0x7')]['toJSON']=function(){var _0x3ccf08=this[_0xfa70('0x8')];if(_0x3ccf08 instanceof Array){_0x3ccf08=_0x3ccf08[_0xfa70('0x24')](function(_0x4401cb){_0x4401cb[_0xfa70('0x1e')]=_0x4401cb[_0xfa70('0x1e')][_0xfa70('0x25')]();_0x4401cb[_0xfa70('0x15')]=_0x4401cb['consequence'][_0xfa70('0x25')]();return _0x4401cb;});}else if(!_[_0xfa70('0x3')](_0x3ccf08)){_0x3ccf08[_0xfa70('0x1e')]=_0x3ccf08[_0xfa70('0x1e')][_0xfa70('0x25')]();_0x3ccf08[_0xfa70('0x15')]=_0x3ccf08['consequence']['toString']();}return _0x3ccf08;};RuleEngine[_0xfa70('0x7')][_0xfa70('0x26')]=function(_0x572e31){this['init']();if(_['isString'](_0x572e31)){_0x572e31=JSON[_0xfa70('0x27')](_0x572e31);}if(_0x572e31 instanceof Array){_0x572e31=_0x572e31[_0xfa70('0x24')](function(_0x507290){_0x507290[_0xfa70('0x1e')]=eval('('+_0x507290['condition']+')');_0x507290['consequence']=eval('('+_0x507290[_0xfa70('0x15')]+')');return _0x507290;});}else if(_0x572e31!==null&&typeof _0x572e31==_0xfa70('0x28')){_0x572e31['condition']=eval('('+_0x572e31[_0xfa70('0x1e')]+')');_0x572e31['consequence']=eval('('+_0x572e31[_0xfa70('0x15')]+')');}this['register'](_0x572e31);};module['exports']=RuleEngine; \ No newline at end of file +var _0xf7ee=['findRules','turn','prioritize','toJSON','condition','toString','isString','parse','object','exports','lodash','util','events','init','ignoreFactChanges','inherits','rules','activeRules','prototype','register','isArray','isObject','push','sync','filter','isNil','orderBy','asc','execute','result','clone','consequence','nextTick','ruleRef','next','isEqual','restart','length','call'];(function(_0x193fa6,_0x3e4789){var _0x1d3265=function(_0x1f1884){while(--_0x1f1884){_0x193fa6['push'](_0x193fa6['shift']());}};_0x1d3265(++_0x3e4789);}(_0xf7ee,0x1de));var _0xef7e=function(_0x53d03d,_0x5f08d7){_0x53d03d=_0x53d03d-0x0;var _0x13b886=_0xf7ee[_0x53d03d];return _0x13b886;};'use strict';var _=require(_0xef7e('0x0'));var util=require(_0xef7e('0x1'));var EventEmitter=require(_0xef7e('0x2'))['EventEmitter'];function RuleEngine(_0x9ea138,_0x2dd81f){this[_0xef7e('0x3')]();if(!_['isNil'](_0x9ea138)){this['register'](_0x9ea138);}if(_0x2dd81f){this[_0xef7e('0x4')]=_0x2dd81f[_0xef7e('0x4')];}return this;}util[_0xef7e('0x5')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x5c29cc){this[_0xef7e('0x6')]=[];this[_0xef7e('0x7')]=[];};RuleEngine[_0xef7e('0x8')][_0xef7e('0x9')]=function(_0x2bc422){if(Array[_0xef7e('0xa')](_0x2bc422)){this[_0xef7e('0x6')]=this['rules']['concat'](_0x2bc422);}else if(_0x2bc422!==null&&_[_0xef7e('0xb')](_0x2bc422)){this[_0xef7e('0x6')][_0xef7e('0xc')](_0x2bc422);}this[_0xef7e('0xd')]();};RuleEngine[_0xef7e('0x8')][_0xef7e('0xd')]=function(){this[_0xef7e('0x7')]=this[_0xef7e('0x6')][_0xef7e('0xe')](function(_0x1bf5f8){if(_[_0xef7e('0xf')](_0x1bf5f8['on'])){_0x1bf5f8['on']=!![];}if(_0x1bf5f8['on']===!![]){return _0x1bf5f8;}});this['activeRules']=_[_0xef7e('0x10')](this[_0xef7e('0x7')],['p'],[_0xef7e('0x11')]);};RuleEngine['prototype'][_0xef7e('0x12')]=function(_0x18da32,_0x3001f2){var _0x563e53=![];_0x18da32[_0xef7e('0x13')]=!![];var _0x4c5d27=_[_0xef7e('0x14')](_0x18da32);var _0x5f3b31=_[_0xef7e('0x14')](_0x18da32);var _0x39f1de=this[_0xef7e('0x7')];var _0x3c1234=[];var _0x1f9160=this['ignoreFactChanges'];(function FnRuleLoop(_0x41e2fb){var _0x2591b3={'rules':function(){return _0x39f1de;},'rule':function(){return _0x39f1de[_0x41e2fb];},'when':function(_0x40f126){if(_0x40f126){var _0xf58b5d=_0x39f1de[_0x41e2fb][_0xef7e('0x15')];_0xf58b5d['ruleRef']=_0x39f1de[_0x41e2fb]['id']||_0x39f1de[_0x41e2fb]['name']||'index_'+_0x41e2fb;process[_0xef7e('0x16')](function(){_0x3c1234[_0xef7e('0xc')](_0xf58b5d[_0xef7e('0x17')]);_0xf58b5d['call'](_0x4c5d27,_0x2591b3);});}else{process[_0xef7e('0x16')](function(){_0x2591b3[_0xef7e('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x563e53=!![];return FnRuleLoop(0x0);},'next':function(_0x508835){if(!_0x1f9160&&!_[_0xef7e('0x19')](_0x5f3b31,_0x4c5d27)){_0x5f3b31=_[_0xef7e('0x14')](_0x4c5d27);process[_0xef7e('0x16')](function(){_0x2591b3[_0xef7e('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xef7e('0xf')](_0x508835)){return FnRuleLoop(_0x41e2fb+0x1);}else{return FnRuleLoop(_0x508835);}});}}};if(_0x41e2fb<_0x39f1de[_0xef7e('0x1b')]&&_0x563e53===![]){var _0x3bc064=_0x39f1de[_0x41e2fb]['condition'];_0x3bc064[_0xef7e('0x1c')](_0x4c5d27,_0x2591b3);}else{process[_0xef7e('0x16')](function(){_0x4c5d27['matchPath']=_0x3c1234;return _0x3001f2?_0x3001f2(_0x4c5d27):_['noop']();});}}(0x0));};RuleEngine['prototype'][_0xef7e('0x1d')]=function(_0x386f0b){if(_[_0xef7e('0xf')](_0x386f0b)){return this['rules'];}else{var _0x38313e=_['matches'](_0x386f0b);return _['filter'](this[_0xef7e('0x6')],_0x38313e);}};RuleEngine['prototype'][_0xef7e('0x1e')]=function(_0x122e40,_0x246da8){var _0x21dfcf=_0x122e40==='on'||_0x122e40==='ON'?!![]:![];var _0x5664f8=this[_0xef7e('0x1d')](_0x246da8);for(var _0x19d469=0x0,_0x5842e0=_0x5664f8[_0xef7e('0x1b')];_0x19d469<_0x5842e0;_0x19d469+=0x1){_0x5664f8[_0x19d469]['on']=_0x21dfcf;}this[_0xef7e('0xd')]();};RuleEngine['prototype'][_0xef7e('0x1f')]=function(_0x39edc2,_0x5f52e9){_0x39edc2=parseInt(_0x39edc2,0xa);var _0x4ecb13=this['findRules'](_0x5f52e9);for(var _0x396b7c=0x0,_0x2eda11=_0x4ecb13[_0xef7e('0x1b')];_0x396b7c<_0x2eda11;_0x396b7c+=0x1){_0x4ecb13[_0x396b7c]['priority']=_0x39edc2;}this[_0xef7e('0xd')]();};RuleEngine[_0xef7e('0x8')][_0xef7e('0x20')]=function(){var _0x57b932=this[_0xef7e('0x6')];if(_0x57b932 instanceof Array){_0x57b932=_0x57b932['map'](function(_0x2f8d4f){_0x2f8d4f[_0xef7e('0x21')]=_0x2f8d4f[_0xef7e('0x21')]['toString']();_0x2f8d4f['consequence']=_0x2f8d4f[_0xef7e('0x15')]['toString']();return _0x2f8d4f;});}else if(!_[_0xef7e('0xf')](_0x57b932)){_0x57b932[_0xef7e('0x21')]=_0x57b932['condition'][_0xef7e('0x22')]();_0x57b932[_0xef7e('0x15')]=_0x57b932[_0xef7e('0x15')][_0xef7e('0x22')]();}return _0x57b932;};RuleEngine['prototype']['fromJSON']=function(_0x2dfe6a){this[_0xef7e('0x3')]();if(_[_0xef7e('0x23')](_0x2dfe6a)){_0x2dfe6a=JSON[_0xef7e('0x24')](_0x2dfe6a);}if(_0x2dfe6a instanceof Array){_0x2dfe6a=_0x2dfe6a['map'](function(_0x1d603b){_0x1d603b[_0xef7e('0x21')]=eval('('+_0x1d603b[_0xef7e('0x21')]+')');_0x1d603b[_0xef7e('0x15')]=eval('('+_0x1d603b[_0xef7e('0x15')]+')');return _0x1d603b;});}else if(_0x2dfe6a!==null&&typeof _0x2dfe6a==_0xef7e('0x25')){_0x2dfe6a[_0xef7e('0x21')]=eval('('+_0x2dfe6a[_0xef7e('0x21')]+')');_0x2dfe6a[_0xef7e('0x15')]=eval('('+_0x2dfe6a[_0xef7e('0x15')]+')');}this[_0xef7e('0x9')](_0x2dfe6a);};module[_0xef7e('0x26')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 328c252..2dd9c5d 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x33aeda,_0x31061a){var _0x28adf0=function(_0x27d252){while(--_0x27d252){_0x33aeda['push'](_0x33aeda['shift']());}};_0x28adf0(++_0x31061a);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x2e0dc4,_0x374e4e){var _0x474f62=function(_0x4c8f2){while(--_0x4c8f2){_0x2e0dc4['push'](_0x2e0dc4['shift']());}};_0x474f62(++_0x374e4e);}(_0x814b,0x1a2));var _0xb814=function(_0x3d1996,_0x1f08f0){_0x3d1996=_0x3d1996-0x0;var _0x550afd=_0x814b[_0x3d1996];return _0x550afd;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 0da4b60..bf48f43 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7269=['openchannelStatus','stringify','emit','user:save','lodash','moment','md5','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','idle','mail','chat','openchannel','fax','sms','Status','StatusTime','toNumber','format','mailStatus'];(function(_0x36a06c,_0x5280d9){var _0x325d6a=function(_0x13b94a){while(--_0x13b94a){_0x36a06c['push'](_0x36a06c['shift']());}};_0x325d6a(++_0x5280d9);}(_0x7269,0x76));var _0x9726=function(_0x687c23,_0x512721){_0x687c23=_0x687c23-0x0;var _0xe5b997=_0x7269[_0x687c23];return _0xe5b997;};'use strict';var _=require(_0x9726('0x0'));var moment=require(_0x9726('0x1'));var md5=require(_0x9726('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x9726('0x3')]=_[_0x9726('0x4')](config['redis'],{'host':_0x9726('0x5'),'port':0x18eb});var io=require(_0x9726('0x6'))(new Redis(config[_0x9726('0x3')]));function Agent(_0x27b600){this['id']=_0x27b600['id']||0x0;this[_0x9726('0x7')]=_0x27b600[_0x9726('0x7')]||'';this[_0x9726('0x8')]=_0x27b600[_0x9726('0x8')]||!![];this[_0x9726('0x9')]=_0x27b600['voicePause']||![];this[_0x9726('0xa')]=_0x27b600['chatPause']||![];this[_0x9726('0xb')]=_0x27b600[_0x9726('0xb')]||![];this[_0x9726('0xc')]=_0x27b600['faxPause']||![];this[_0x9726('0xd')]=_0x27b600[_0x9726('0xd')]||![];this[_0x9726('0xe')]=_0x27b600['openchannelPause']||![];this[_0x9726('0xf')]=_0x9726('0x10');this[_0x9726('0x11')]=0x0;this[_0x9726('0x12')]=_0x27b600[_0x9726('0x12')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0x9726('0x10');this[_0x9726('0x13')]=0x0;this['mailCapacity']=_0x27b600[_0x9726('0x14')]||0x0;this[_0x9726('0x15')]=0x0;this[_0x9726('0x16')]=_0x9726('0x10');this['faxStatusTime']=0x0;this[_0x9726('0x17')]=_0x27b600[_0x9726('0x17')]||0x0;this[_0x9726('0x18')]=0x0;this[_0x9726('0x19')]=_0x9726('0x10');this[_0x9726('0x1a')]=0x0;this[_0x9726('0x1b')]=_0x27b600[_0x9726('0x1b')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x9726('0x1c')]='unknown';this[_0x9726('0x1d')]=0x0;this[_0x9726('0x1e')]=_0x27b600[_0x9726('0x1e')]||0x0;this[_0x9726('0x1f')]=0x0;this['openchannelStatus']=_0x9726('0x10');this[_0x9726('0x20')]=0x0;this[_0x9726('0x21')]=_0x27b600[_0x9726('0x21')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x9726('0x22')]=![];this[_0x9726('0x23')]=undefined;this['md5']='';this[_0x9726('0x24')]();}Agent[_0x9726('0x25')][_0x9726('0x26')]=function(_0x2db177){if(this[_0x2db177+'CurrentCapacity']>0x0){if(this[_0x2db177+_0x9726('0x27')]>0x0&&this[_0x2db177+_0x9726('0x28')]>=this[_0x2db177+_0x9726('0x27')]){return _0x9726('0x29');}else{return'working';}}else{return _0x9726('0x2a');}};Agent[_0x9726('0x25')][_0x9726('0x24')]=function(){var _0x39e8f6=[_0x9726('0x2b'),_0x9726('0x2c'),_0x9726('0x2d'),_0x9726('0x2e'),_0x9726('0x2f'),'whatsapp'];for(var _0x8e8ce0=0x0;_0x8e8ce0<_0x39e8f6['length'];_0x8e8ce0+=0x1){var _0xe74b18=this[_0x9726('0x26')](_0x39e8f6[_0x8e8ce0]);if(this[_0x39e8f6[_0x8e8ce0]+_0x9726('0x30')]!==_0xe74b18){this[_0x39e8f6[_0x8e8ce0]+_0x9726('0x31')]=_[_0x9726('0x32')](moment()[_0x9726('0x33')]('x'));}this[_0x39e8f6[_0x8e8ce0]+_0x9726('0x30')]=_0xe74b18;}var _0x173a1d={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0x9726('0xa')],'mailPause':this[_0x9726('0xb')],'smsPause':this[_0x9726('0xd')],'faxPause':this[_0x9726('0xc')],'openchannelPause':this[_0x9726('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x9726('0x11')],'chatCapacity':this[_0x9726('0x12')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x9726('0x34')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x9726('0x14')],'mailCurrentCapacity':this[_0x9726('0x15')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x9726('0x17')],'faxCurrentCapacity':this[_0x9726('0x18')],'smsStatus':this[_0x9726('0x19')],'smsStatusTime':this[_0x9726('0x1a')],'smsCapacity':this[_0x9726('0x1b')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x9726('0x1c')],'whatsappStatusTime':this[_0x9726('0x1d')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x9726('0x35')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x9726('0x21')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x9726('0x23')]};var _0x1155e6=md5(JSON[_0x9726('0x36')](_0x173a1d));if(this[_0x9726('0x2')]!==_0x1155e6){this[_0x9726('0x2')]=_0x1155e6;io[_0x9726('0x37')](_0x9726('0x38'),_0x173a1d);}};module['exports']=Agent; \ No newline at end of file +var _0x7229=['localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','mail','chat','openchannel','fax','sms','Status','StatusTime','toNumber','format','mailStatusTime','smsStatus','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis'];(function(_0x1aba0f,_0x242a5d){var _0xf6e33d=function(_0x508922){while(--_0x508922){_0x1aba0f['push'](_0x1aba0f['shift']());}};_0xf6e33d(++_0x242a5d);}(_0x7229,0x76));var _0x9722=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7229[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x9722('0x0'));var moment=require(_0x9722('0x1'));var md5=require(_0x9722('0x2'));var Redis=require(_0x9722('0x3'));var config=require(_0x9722('0x4'));config['redis']=_['defaults'](config[_0x9722('0x5')],{'host':_0x9722('0x6'),'port':0x18eb});var io=require(_0x9722('0x7'))(new Redis(config[_0x9722('0x5')]));function Agent(_0x7fae8c){this['id']=_0x7fae8c['id']||0x0;this[_0x9722('0x8')]=_0x7fae8c[_0x9722('0x8')]||'';this['online']=_0x7fae8c[_0x9722('0x9')]||!![];this['voicePause']=_0x7fae8c[_0x9722('0xa')]||![];this[_0x9722('0xb')]=_0x7fae8c[_0x9722('0xb')]||![];this[_0x9722('0xc')]=_0x7fae8c[_0x9722('0xc')]||![];this[_0x9722('0xd')]=_0x7fae8c[_0x9722('0xd')]||![];this[_0x9722('0xe')]=_0x7fae8c['smsPause']||![];this['openchannelPause']=_0x7fae8c[_0x9722('0xf')]||![];this[_0x9722('0x10')]=_0x9722('0x11');this[_0x9722('0x12')]=0x0;this['chatCapacity']=_0x7fae8c[_0x9722('0x13')]||0x0;this[_0x9722('0x14')]=0x0;this[_0x9722('0x15')]=_0x9722('0x11');this['mailStatusTime']=0x0;this[_0x9722('0x16')]=_0x7fae8c[_0x9722('0x16')]||0x0;this[_0x9722('0x17')]=0x0;this[_0x9722('0x18')]=_0x9722('0x11');this['faxStatusTime']=0x0;this[_0x9722('0x19')]=_0x7fae8c[_0x9722('0x19')]||0x0;this[_0x9722('0x1a')]=0x0;this['smsStatus']=_0x9722('0x11');this[_0x9722('0x1b')]=0x0;this['smsCapacity']=_0x7fae8c[_0x9722('0x1c')]||0x0;this[_0x9722('0x1d')]=0x0;this[_0x9722('0x1e')]='unknown';this[_0x9722('0x1f')]=0x0;this[_0x9722('0x20')]=_0x7fae8c[_0x9722('0x20')]||0x0;this[_0x9722('0x21')]=0x0;this[_0x9722('0x22')]=_0x9722('0x11');this[_0x9722('0x23')]=0x0;this[_0x9722('0x24')]=_0x7fae8c[_0x9722('0x24')]||0x0;this[_0x9722('0x25')]=0x0;this[_0x9722('0x26')]=![];this[_0x9722('0x27')]=undefined;this[_0x9722('0x2')]='';this[_0x9722('0x28')]();}Agent[_0x9722('0x29')][_0x9722('0x2a')]=function(_0x484be2){if(this[_0x484be2+_0x9722('0x2b')]>0x0){if(this[_0x484be2+_0x9722('0x2c')]>0x0&&this[_0x484be2+_0x9722('0x2b')]>=this[_0x484be2+_0x9722('0x2c')]){return _0x9722('0x2d');}else{return _0x9722('0x2e');}}else{return'idle';}};Agent[_0x9722('0x29')][_0x9722('0x28')]=function(){var _0xdc3330=[_0x9722('0x2f'),_0x9722('0x30'),_0x9722('0x31'),_0x9722('0x32'),_0x9722('0x33'),'whatsapp'];for(var _0x1ae537=0x0;_0x1ae537<_0xdc3330['length'];_0x1ae537+=0x1){var _0x141c7d=this[_0x9722('0x2a')](_0xdc3330[_0x1ae537]);if(this[_0xdc3330[_0x1ae537]+_0x9722('0x34')]!==_0x141c7d){this[_0xdc3330[_0x1ae537]+_0x9722('0x35')]=_[_0x9722('0x36')](moment()[_0x9722('0x37')]('x'));}this[_0xdc3330[_0x1ae537]+_0x9722('0x34')]=_0x141c7d;}var _0x390f79={'id':this['id'],'name':this['name'],'online':this[_0x9722('0x9')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0x9722('0xc')],'smsPause':this[_0x9722('0xe')],'faxPause':this['faxPause'],'openchannelPause':this[_0x9722('0xf')],'chatStatus':this[_0x9722('0x10')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x9722('0x14')],'mailStatus':this[_0x9722('0x15')],'mailStatusTime':this[_0x9722('0x38')],'mailCapacity':this[_0x9722('0x16')],'mailCurrentCapacity':this[_0x9722('0x17')],'faxStatus':this[_0x9722('0x18')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x9722('0x19')],'faxCurrentCapacity':this[_0x9722('0x1a')],'smsStatus':this[_0x9722('0x39')],'smsStatusTime':this[_0x9722('0x1b')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x9722('0x1d')],'whatsappStatus':this[_0x9722('0x1e')],'whatsappStatusTime':this[_0x9722('0x1f')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x9722('0x22')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x9722('0x24')],'openchannelCurrentCapacity':this[_0x9722('0x25')],'busy':this[_0x9722('0x26')],'busyQueue':this[_0x9722('0x27')]};var _0x1df56b=md5(JSON[_0x9722('0x3a')](_0x390f79));if(this[_0x9722('0x2')]!==_0x1df56b){this[_0x9722('0x2')]=_0x1df56b;io[_0x9722('0x3b')](_0x9722('0x3c'),_0x390f79);}};module[_0x9722('0x3d')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index de9776e..794b3ef 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 _0x2ca2=['lodash','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','loggedIn','length','chatPause','paused','available','stringify','emit'];(function(_0x2d2c51,_0xcefc73){var _0x410ec6=function(_0x16cb19){while(--_0x16cb19){_0x2d2c51['push'](_0x2d2c51['shift']());}};_0x410ec6(++_0xcefc73);}(_0x2ca2,0x87));var _0x22ca=function(_0x36c525,_0x51223c){_0x36c525=_0x36c525-0x0;var _0xd930fd=_0x2ca2[_0x36c525];return _0xd930fd;};'use strict';var _=require(_0x22ca('0x0'));var md5=require('md5');var util=require(_0x22ca('0x1'));var Redis=require(_0x22ca('0x2'));var config=require(_0x22ca('0x3'));config[_0x22ca('0x4')]=_['defaults'](config[_0x22ca('0x4')],{'host':_0x22ca('0x5'),'port':0x18eb});var io=require(_0x22ca('0x6'))(new Redis(config['redis']));function ChatQueue(_0x453a0e){this['id']=_0x453a0e['id']||0x0;this['name']=_0x453a0e[_0x22ca('0x7')]||'';this[_0x22ca('0x8')]=_0x453a0e['timeout']||0xa;this[_0x22ca('0x9')]=_0x453a0e[_0x22ca('0x9')]||_0x22ca('0xa');this[_0x22ca('0xb')]=_0x453a0e[_0x22ca('0xb')];this['mapAgentsId']={};this[_0x22ca('0xc')]=0x0;this[_0x22ca('0xd')]='';this['updateRouting']();this[_0x22ca('0xe')]();}ChatQueue[_0x22ca('0xf')][_0x22ca('0x10')]=function(){var _0x561606=this[_0x22ca('0x11')][_0x22ca('0x12')];this[_0x22ca('0x11')]=_[_0x22ca('0x13')](this[_0x22ca('0xb')],'id');this[_0x22ca('0x11')][_0x22ca('0x12')]=_0x561606;};ChatQueue[_0x22ca('0xf')]['updateRealtime']=function(){this[_0x22ca('0x14')]=0x0;this['paused']=0x0;for(var _0x4ccf72=0x0;_0x4ccf72=0x0?this[_0x22ca('0x18')]:0x0;var _0x463dbd={'id':this['id'],'available':this[_0x22ca('0x18')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x22ca('0x17')],'waiting':this[_0x22ca('0xc')]};var _0x167f44=md5(JSON[_0x22ca('0x19')](_0x463dbd));if(this[_0x22ca('0xd')]!==_0x167f44){this['md5']=_0x167f44;io['to'](util['format']('chat:queue:%s',_0x463dbd['name']))[_0x22ca('0x1a')]('chat_queue:save',_0x463dbd);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xa84a=['stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause','available'];(function(_0x3414d0,_0x4c5265){var _0x10ac00=function(_0x194380){while(--_0x194380){_0x3414d0['push'](_0x3414d0['shift']());}};_0x10ac00(++_0x4c5265);}(_0xa84a,0x15b));var _0xaa84=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xa84a[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0xaa84('0x0'));var md5=require(_0xaa84('0x1'));var util=require(_0xaa84('0x2'));var Redis=require(_0xaa84('0x3'));var config=require(_0xaa84('0x4'));config[_0xaa84('0x5')]=_['defaults'](config[_0xaa84('0x5')],{'host':_0xaa84('0x6'),'port':0x18eb});var io=require(_0xaa84('0x7'))(new Redis(config[_0xaa84('0x5')]));function ChatQueue(_0x730b3f){this['id']=_0x730b3f['id']||0x0;this['name']=_0x730b3f[_0xaa84('0x8')]||'';this[_0xaa84('0x9')]=_0x730b3f[_0xaa84('0x9')]||0xa;this[_0xaa84('0xa')]=_0x730b3f['strategy']||'beepall';this[_0xaa84('0xb')]=_0x730b3f[_0xaa84('0xb')];this[_0xaa84('0xc')]={};this[_0xaa84('0xd')]=0x0;this['md5']='';this[_0xaa84('0xe')]();this[_0xaa84('0xf')]();}ChatQueue[_0xaa84('0x10')][_0xaa84('0xe')]=function(){var _0x1a4d9e=this[_0xaa84('0xc')][_0xaa84('0x11')];this[_0xaa84('0xc')]=_[_0xaa84('0x12')](this[_0xaa84('0xb')],'id');this['mapAgentsId'][_0xaa84('0x11')]=_0x1a4d9e;};ChatQueue[_0xaa84('0x10')][_0xaa84('0xf')]=function(){this[_0xaa84('0x13')]=0x0;this[_0xaa84('0x14')]=0x0;for(var _0x225f97=0x0;_0x225f97=0x0?this[_0xaa84('0x18')]:0x0;var _0x2ed8a3={'id':this['id'],'available':this[_0xaa84('0x18')],'loggedIn':this[_0xaa84('0x13')],'name':this[_0xaa84('0x8')],'paused':this[_0xaa84('0x14')],'waiting':this['waiting']};var _0x527d9f=md5(JSON[_0xaa84('0x19')](_0x2ed8a3));if(this['md5']!==_0x527d9f){this[_0xaa84('0x1')]=_0x527d9f;io['to'](util[_0xaa84('0x1a')](_0xaa84('0x1b'),_0x2ed8a3[_0xaa84('0x8')]))[_0xaa84('0x1c')](_0xaa84('0x1d'),_0x2ed8a3);}};module[_0xaa84('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 efad941..7ee71e7 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 _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x2c4b74,_0x160df6){var _0x349c7=function(_0x58de9c){while(--_0x58de9c){_0x2c4b74['push'](_0x2c4b74['shift']());}};_0x349c7(++_0x160df6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file +var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x3d1adc,_0x397a0d){var _0x4d6eaa=function(_0x4ff818){while(--_0x4ff818){_0x3d1adc['push'](_0x3d1adc['shift']());}};_0x4d6eaa(++_0x397a0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 8a0a386..d60e54b 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 _0x0f43=['exports','name','Intervals'];(function(_0x1d2e88,_0x410d1d){var _0x42794b=function(_0x292a66){while(--_0x292a66){_0x1d2e88['push'](_0x1d2e88['shift']());}};_0x42794b(++_0x410d1d);}(_0x0f43,0xd3));var _0x30f4=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x0f43[_0x1203f];return _0x365f0a;};'use strict';function Interval(_0x404b5a){this['id']=_0x404b5a['id']||0x0;this[_0x30f4('0x0')]=_0x404b5a[_0x30f4('0x0')]||'';this[_0x30f4('0x1')]=_0x404b5a['Intervals']||{};}module[_0x30f4('0x2')]=Interval; \ No newline at end of file +var _0x1ebe=['name','Intervals','exports'];(function(_0x8c8176,_0x5360a1){var _0x4dc47b=function(_0x1a7f65){while(--_0x1a7f65){_0x8c8176['push'](_0x8c8176['shift']());}};_0x4dc47b(++_0x5360a1);}(_0x1ebe,0x1e6));var _0xe1eb=function(_0x2cf966,_0x5cb664){_0x2cf966=_0x2cf966-0x0;var _0x6c35b4=_0x1ebe[_0x2cf966];return _0x6c35b4;};'use strict';function Interval(_0x4cf89a){this['id']=_0x4cf89a['id']||0x0;this[_0xe1eb('0x0')]=_0x4cf89a[_0xe1eb('0x0')]||'';this[_0xe1eb('0x1')]=_0x4cf89a[_0xe1eb('0x1')]||{};}module[_0xe1eb('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 72fffb6..4dd6b13 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 _0xe533=['length','online','available','stringify','format','mail:queue:%s','emit','lodash','md5','ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn'];(function(_0x30b865,_0x19049f){var _0x5c0a2c=function(_0x18b1df){while(--_0x18b1df){_0x30b865['push'](_0x30b865['shift']());}};_0x5c0a2c(++_0x19049f);}(_0xe533,0x181));var _0x3e53=function(_0x2c190,_0x3c13f8){_0x2c190=_0x2c190-0x0;var _0x296050=_0xe533[_0x2c190];return _0x296050;};'use strict';var _=require(_0x3e53('0x0'));var md5=require(_0x3e53('0x1'));var util=require('util');var Redis=require(_0x3e53('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x3e53('0x3')](config[_0x3e53('0x4')],{'host':_0x3e53('0x5'),'port':0x18eb});var io=require(_0x3e53('0x6'))(new Redis(config['redis']));function MailQueue(_0x681e6a){this['id']=_0x681e6a['id']||0x0;this[_0x3e53('0x7')]=_0x681e6a['name']||'';this[_0x3e53('0x8')]=_0x681e6a[_0x3e53('0x8')]||0xa;this[_0x3e53('0x9')]=_0x681e6a[_0x3e53('0x9')]||_0x3e53('0xa');this[_0x3e53('0xb')]=_0x681e6a[_0x3e53('0xb')];this[_0x3e53('0xc')]={};this[_0x3e53('0xd')]=0x0;this['md5']='';this[_0x3e53('0xe')]();this['updateRealtime']();}MailQueue[_0x3e53('0xf')][_0x3e53('0xe')]=function(){var _0x4e0791=this[_0x3e53('0xc')][_0x3e53('0x10')];this[_0x3e53('0xc')]=_[_0x3e53('0x11')](this[_0x3e53('0xb')],'id');this[_0x3e53('0xc')][_0x3e53('0x10')]=_0x4e0791;};MailQueue[_0x3e53('0xf')][_0x3e53('0x12')]=function(){this[_0x3e53('0x13')]=0x0;this['paused']=0x0;for(var _0x524e31=0x0;_0x524e31=0x0?this['available']:0x0;var _0x3f4317={'id':this['id'],'available':this[_0x3e53('0x16')],'loggedIn':this[_0x3e53('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x3e53('0xd')]};var _0x45ce3b=md5(JSON[_0x3e53('0x17')](_0x3f4317));if(this['md5']!==_0x45ce3b){this[_0x3e53('0x1')]=_0x45ce3b;io['to'](util[_0x3e53('0x18')](_0x3e53('0x19'),_0x3f4317[_0x3e53('0x7')]))[_0x3e53('0x1a')]('mail_queue:save',_0x3f4317);}};module['exports']=MailQueue; \ No newline at end of file +var _0x6c79=['_rr','map','updateRealtime','loggedIn','paused','available','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting'];(function(_0x5d5011,_0x23f8f4){var _0x23c817=function(_0x15cb26){while(--_0x15cb26){_0x5d5011['push'](_0x5d5011['shift']());}};_0x23c817(++_0x23f8f4);}(_0x6c79,0x184));var _0x96c7=function(_0x112929,_0x7da466){_0x112929=_0x112929-0x0;var _0x333c16=_0x6c79[_0x112929];return _0x333c16;};'use strict';var _=require(_0x96c7('0x0'));var md5=require(_0x96c7('0x1'));var util=require(_0x96c7('0x2'));var Redis=require(_0x96c7('0x3'));var config=require(_0x96c7('0x4'));config['redis']=_[_0x96c7('0x5')](config['redis'],{'host':_0x96c7('0x6'),'port':0x18eb});var io=require(_0x96c7('0x7'))(new Redis(config[_0x96c7('0x8')]));function MailQueue(_0xc723cc){this['id']=_0xc723cc['id']||0x0;this[_0x96c7('0x9')]=_0xc723cc['name']||'';this[_0x96c7('0xa')]=_0xc723cc[_0x96c7('0xa')]||0xa;this[_0x96c7('0xb')]=_0xc723cc[_0x96c7('0xb')]||_0x96c7('0xc');this['Agents']=_0xc723cc[_0x96c7('0xd')];this[_0x96c7('0xe')]={};this[_0x96c7('0xf')]=0x0;this[_0x96c7('0x1')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0x96c7('0x10')][_0x96c7('0x11')]=function(){var _0x53231d=this[_0x96c7('0xe')][_0x96c7('0x12')];this['mapAgentsId']=_[_0x96c7('0x13')](this[_0x96c7('0xd')],'id');this['mapAgentsId'][_0x96c7('0x12')]=_0x53231d;};MailQueue['prototype'][_0x96c7('0x14')]=function(){this[_0x96c7('0x15')]=0x0;this[_0x96c7('0x16')]=0x0;for(var _0x29ebe3=0x0;_0x29ebe3=0x0?this[_0x96c7('0x17')]:0x0;var _0x99a337={'id':this['id'],'available':this[_0x96c7('0x17')],'loggedIn':this[_0x96c7('0x15')],'name':this[_0x96c7('0x9')],'paused':this[_0x96c7('0x16')],'waiting':this[_0x96c7('0xf')]};var _0x1cbe0c=md5(JSON['stringify'](_0x99a337));if(this[_0x96c7('0x1')]!==_0x1cbe0c){this[_0x96c7('0x1')]=_0x1cbe0c;io['to'](util[_0x96c7('0x18')](_0x96c7('0x19'),_0x99a337['name']))[_0x96c7('0x1a')](_0x96c7('0x1b'),_0x99a337);}};module[_0x96c7('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index b128e5d..2f3de1c 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 _0xef5d=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','available','loggedIn','stringify','format','openchannel:queue:%s','exports','lodash','md5','util','ioredis','redis','socket.io-emitter','name','timeout','strategy','Agents'];(function(_0x1ab0ce,_0xc5455f){var _0x3890e6=function(_0x115479){while(--_0x115479){_0x1ab0ce['push'](_0x1ab0ce['shift']());}};_0x3890e6(++_0xc5455f);}(_0xef5d,0x114));var _0xdef5=function(_0x5548c4,_0x52e5e2){_0x5548c4=_0x5548c4-0x0;var _0x3445c8=_0xef5d[_0x5548c4];return _0x3445c8;};'use strict';var _=require(_0xdef5('0x0'));var md5=require(_0xdef5('0x1'));var util=require(_0xdef5('0x2'));var Redis=require(_0xdef5('0x3'));var config=require('../../../config/environment');config[_0xdef5('0x4')]=_['defaults'](config[_0xdef5('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xdef5('0x5'))(new Redis(config[_0xdef5('0x4')]));function OpenchannelQueue(_0x33117b){this['id']=_0x33117b['id']||0x0;this[_0xdef5('0x6')]=_0x33117b['name']||'';this[_0xdef5('0x7')]=_0x33117b[_0xdef5('0x7')]||0xa;this['strategy']=_0x33117b[_0xdef5('0x8')]||'beepall';this[_0xdef5('0x9')]=_0x33117b[_0xdef5('0x9')];this[_0xdef5('0xa')]={};this[_0xdef5('0xb')]=0x0;this[_0xdef5('0x1')]='';this[_0xdef5('0xc')]();this[_0xdef5('0xd')]();}OpenchannelQueue[_0xdef5('0xe')][_0xdef5('0xc')]=function(){var _0x124045=this['mapAgentsId'][_0xdef5('0xf')];this[_0xdef5('0xa')]=_[_0xdef5('0x10')](this['Agents'],'id');this['mapAgentsId'][_0xdef5('0xf')]=_0x124045;};OpenchannelQueue[_0xdef5('0xe')][_0xdef5('0xd')]=function(){this['loggedIn']=0x0;this[_0xdef5('0x11')]=0x0;for(var _0x305940=0x0;_0x305940=0x0?this[_0xdef5('0x14')]:0x0;var _0x29ef64={'id':this['id'],'available':this['available'],'loggedIn':this[_0xdef5('0x15')],'name':this[_0xdef5('0x6')],'paused':this['paused'],'waiting':this[_0xdef5('0xb')]};var _0x5e19c0=md5(JSON[_0xdef5('0x16')](_0x29ef64));if(this[_0xdef5('0x1')]!==_0x5e19c0){this[_0xdef5('0x1')]=_0x5e19c0;io['to'](util[_0xdef5('0x17')](_0xdef5('0x18'),_0x29ef64[_0xdef5('0x6')]))['emit']('openchannel_queue:save',_0x29ef64);}};module[_0xdef5('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x7722=['emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','localhost','socket.io-emitter','redis','name','strategy','Agents','waiting','updateRouting','mapAgentsId','_rr','prototype','loggedIn','length','online','openchannelPause','paused','available','stringify'];(function(_0x251bdf,_0x29f5b3){var _0x1cf087=function(_0x5749e1){while(--_0x5749e1){_0x251bdf['push'](_0x251bdf['shift']());}};_0x1cf087(++_0x29f5b3);}(_0x7722,0x67));var _0x2772=function(_0x1a87cd,_0x2a244f){_0x1a87cd=_0x1a87cd-0x0;var _0x4af60e=_0x7722[_0x1a87cd];return _0x4af60e;};'use strict';var _=require(_0x2772('0x0'));var md5=require(_0x2772('0x1'));var util=require('util');var Redis=require(_0x2772('0x2'));var config=require(_0x2772('0x3'));config['redis']=_['defaults'](config['redis'],{'host':_0x2772('0x4'),'port':0x18eb});var io=require(_0x2772('0x5'))(new Redis(config[_0x2772('0x6')]));function OpenchannelQueue(_0x3e75e8){this['id']=_0x3e75e8['id']||0x0;this[_0x2772('0x7')]=_0x3e75e8[_0x2772('0x7')]||'';this['timeout']=_0x3e75e8['timeout']||0xa;this[_0x2772('0x8')]=_0x3e75e8['strategy']||'beepall';this[_0x2772('0x9')]=_0x3e75e8[_0x2772('0x9')];this['mapAgentsId']={};this[_0x2772('0xa')]=0x0;this[_0x2772('0x1')]='';this[_0x2772('0xb')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x2772('0xb')]=function(){var _0xc71915=this[_0x2772('0xc')][_0x2772('0xd')];this['mapAgentsId']=_['map'](this['Agents'],'id');this['mapAgentsId'][_0x2772('0xd')]=_0xc71915;};OpenchannelQueue[_0x2772('0xe')]['updateRealtime']=function(){this[_0x2772('0xf')]=0x0;this['paused']=0x0;for(var _0x56bc3b=0x0;_0x56bc3b=0x0?this[_0x2772('0x14')]:0x0;var _0x2dbd71={'id':this['id'],'available':this[_0x2772('0x14')],'loggedIn':this[_0x2772('0xf')],'name':this[_0x2772('0x7')],'paused':this[_0x2772('0x13')],'waiting':this[_0x2772('0xa')]};var _0x189d0d=md5(JSON[_0x2772('0x15')](_0x2dbd71));if(this['md5']!==_0x189d0d){this[_0x2772('0x1')]=_0x189d0d;io['to'](util['format']('openchannel:queue:%s',_0x2dbd71['name']))[_0x2772('0x16')](_0x2772('0x17'),_0x2dbd71);}};module[_0x2772('0x18')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 5cc2860..c03914a 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 _0x757a=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','length','online','loggedIn','smsPause','paused','available','format','sms:queue:%s','emit','md5','util','defaults'];(function(_0x3b3210,_0x25e8ed){var _0x5b5484=function(_0x417858){while(--_0x417858){_0x3b3210['push'](_0x3b3210['shift']());}};_0x5b5484(++_0x25e8ed);}(_0x757a,0xde));var _0xa757=function(_0x21d2e5,_0x4e4370){_0x21d2e5=_0x21d2e5-0x0;var _0x3720eb=_0x757a[_0x21d2e5];return _0x3720eb;};'use strict';var _=require('lodash');var md5=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xa757('0x2')](config[_0xa757('0x3')],{'host':_0xa757('0x4'),'port':0x18eb});var io=require(_0xa757('0x5'))(new Redis(config[_0xa757('0x3')]));function SmsQueue(_0x3caeb0){this['id']=_0x3caeb0['id']||0x0;this['name']=_0x3caeb0[_0xa757('0x6')]||'';this[_0xa757('0x7')]=_0x3caeb0['timeout']||0xa;this[_0xa757('0x8')]=_0x3caeb0[_0xa757('0x8')]||_0xa757('0x9');this[_0xa757('0xa')]=_0x3caeb0[_0xa757('0xa')];this['mapAgentsId']={};this[_0xa757('0xb')]=0x0;this[_0xa757('0x0')]='';this[_0xa757('0xc')]();this[_0xa757('0xd')]();}SmsQueue[_0xa757('0xe')][_0xa757('0xc')]=function(){var _0x17408b=this['mapAgentsId']['_rr'];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xa757('0xf')]['_rr']=_0x17408b;};SmsQueue['prototype'][_0xa757('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x32112b=0x0;_0x32112b=0x0?this['available']:0x0;var _0x54b305={'id':this['id'],'available':this[_0xa757('0x15')],'loggedIn':this[_0xa757('0x12')],'name':this[_0xa757('0x6')],'paused':this[_0xa757('0x14')],'waiting':this[_0xa757('0xb')]};var _0xe2d567=md5(JSON['stringify'](_0x54b305));if(this[_0xa757('0x0')]!==_0xe2d567){this['md5']=_0xe2d567;io['to'](util[_0xa757('0x16')](_0xa757('0x17'),_0x54b305[_0xa757('0x6')]))[_0xa757('0x18')]('sms_queue:save',_0x54b305);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xd8b0=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x3cdcaa,_0x2ae868){var _0x621ff7=function(_0x117124){while(--_0x117124){_0x3cdcaa['push'](_0x3cdcaa['shift']());}};_0x621ff7(++_0x2ae868);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var md5=require(_0x0d8b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0d8b('0x2')]=_[_0x0d8b('0x3')](config[_0x0d8b('0x2')],{'host':_0x0d8b('0x4'),'port':0x18eb});var io=require(_0x0d8b('0x5'))(new Redis(config['redis']));function SmsQueue(_0x5e15e6){this['id']=_0x5e15e6['id']||0x0;this[_0x0d8b('0x6')]=_0x5e15e6[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5e15e6['timeout']||0xa;this[_0x0d8b('0x8')]=_0x5e15e6[_0x0d8b('0x8')]||'beepall';this[_0x0d8b('0x9')]=_0x5e15e6[_0x0d8b('0x9')];this[_0x0d8b('0xa')]={};this[_0x0d8b('0xb')]=0x0;this[_0x0d8b('0x1')]='';this[_0x0d8b('0xc')]();this[_0x0d8b('0xd')]();}SmsQueue[_0x0d8b('0xe')]['updateRouting']=function(){var _0x3c4bfa=this['mapAgentsId'][_0x0d8b('0xf')];this[_0x0d8b('0xa')]=_[_0x0d8b('0x10')](this[_0x0d8b('0x9')],'id');this[_0x0d8b('0xa')][_0x0d8b('0xf')]=_0x3c4bfa;};SmsQueue[_0x0d8b('0xe')][_0x0d8b('0xd')]=function(){this[_0x0d8b('0x11')]=0x0;this[_0x0d8b('0x12')]=0x0;for(var _0x5ad086=0x0;_0x5ad086=0x0?this[_0x0d8b('0x15')]:0x0;var _0x333674={'id':this['id'],'available':this[_0x0d8b('0x15')],'loggedIn':this[_0x0d8b('0x11')],'name':this[_0x0d8b('0x6')],'paused':this['paused'],'waiting':this[_0x0d8b('0xb')]};var _0x23d58f=md5(JSON[_0x0d8b('0x16')](_0x333674));if(this[_0x0d8b('0x1')]!==_0x23d58f){this[_0x0d8b('0x1')]=_0x23d58f;io['to'](util[_0x0d8b('0x17')](_0x0d8b('0x18'),_0x333674[_0x0d8b('0x6')]))['emit']('sms_queue:save',_0x333674);}};module[_0x0d8b('0x19')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 6f6524f..aae6d5d 100644 --- a/server/services/routing/model/whatsappQueue.js +++ b/server/services/routing/model/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd73e=['loggedIn','whatsappPause','available','stringify','format','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','paused','length','online'];(function(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0xd73e,0xa9));var _0xed73=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd73e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xed73('0x0'));var md5=require(_0xed73('0x1'));var util=require(_0xed73('0x2'));var Redis=require(_0xed73('0x3'));var config=require(_0xed73('0x4'));config[_0xed73('0x5')]=_['defaults'](config[_0xed73('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xed73('0x6'))(new Redis(config[_0xed73('0x5')]));function WhatsappQueue(_0x428aab){this['id']=_0x428aab['id']||0x0;this['name']=_0x428aab[_0xed73('0x7')]||'';this['timeout']=_0x428aab[_0xed73('0x8')]||0xa;this['strategy']=_0x428aab['strategy']||_0xed73('0x9');this[_0xed73('0xa')]=_0x428aab['Agents'];this[_0xed73('0xb')]={};this[_0xed73('0xc')]=0x0;this[_0xed73('0x1')]='';this[_0xed73('0xd')]();this[_0xed73('0xe')]();}WhatsappQueue['prototype'][_0xed73('0xd')]=function(){var _0x6bd7e=this[_0xed73('0xb')][_0xed73('0xf')];this[_0xed73('0xb')]=_[_0xed73('0x10')](this[_0xed73('0xa')],'id');this[_0xed73('0xb')][_0xed73('0xf')]=_0x6bd7e;};WhatsappQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xed73('0x11')]=0x0;for(var _0x4e8f60=0x0;_0x4e8f60=0x0?this[_0xed73('0x16')]:0x0;var _0x24895a={'id':this['id'],'available':this[_0xed73('0x16')],'loggedIn':this[_0xed73('0x14')],'name':this[_0xed73('0x7')],'paused':this[_0xed73('0x11')],'waiting':this['waiting']};var _0xa84f7d=md5(JSON[_0xed73('0x17')](_0x24895a));if(this[_0xed73('0x1')]!==_0xa84f7d){this[_0xed73('0x1')]=_0xa84f7d;io['to'](util[_0xed73('0x18')]('whatsapp:queue:%s',_0x24895a[_0xed73('0x7')]))['emit'](_0xed73('0x19'),_0x24895a);}};module[_0xed73('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0xf03d=['beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','whatsappPause','available','waiting','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','ioredis','../../../config/environment','localhost','socket.io-emitter','redis','name','timeout','strategy'];(function(_0xc2a990,_0x2c3741){var _0x3f8b2f=function(_0x469910){while(--_0x469910){_0xc2a990['push'](_0xc2a990['shift']());}};_0x3f8b2f(++_0x2c3741);}(_0xf03d,0x1f4));var _0xdf03=function(_0x28eeb5,_0x5aca76){_0x28eeb5=_0x28eeb5-0x0;var _0x7fd68b=_0xf03d[_0x28eeb5];return _0x7fd68b;};'use strict';var _=require(_0xdf03('0x0'));var md5=require(_0xdf03('0x1'));var util=require('util');var Redis=require(_0xdf03('0x2'));var config=require(_0xdf03('0x3'));config['redis']=_['defaults'](config['redis'],{'host':_0xdf03('0x4'),'port':0x18eb});var io=require(_0xdf03('0x5'))(new Redis(config[_0xdf03('0x6')]));function WhatsappQueue(_0x5820de){this['id']=_0x5820de['id']||0x0;this['name']=_0x5820de[_0xdf03('0x7')]||'';this[_0xdf03('0x8')]=_0x5820de[_0xdf03('0x8')]||0xa;this[_0xdf03('0x9')]=_0x5820de['strategy']||_0xdf03('0xa');this[_0xdf03('0xb')]=_0x5820de['Agents'];this[_0xdf03('0xc')]={};this['waiting']=0x0;this[_0xdf03('0x1')]='';this[_0xdf03('0xd')]();this[_0xdf03('0xe')]();}WhatsappQueue[_0xdf03('0xf')][_0xdf03('0xd')]=function(){var _0x6f8564=this[_0xdf03('0xc')]['_rr'];this[_0xdf03('0xc')]=_[_0xdf03('0x10')](this['Agents'],'id');this[_0xdf03('0xc')][_0xdf03('0x11')]=_0x6f8564;};WhatsappQueue[_0xdf03('0xf')]['updateRealtime']=function(){this[_0xdf03('0x12')]=0x0;this[_0xdf03('0x13')]=0x0;for(var _0x515b9f=0x0;_0x515b9f=0x0?this[_0xdf03('0x17')]:0x0;var _0x2b68af={'id':this['id'],'available':this[_0xdf03('0x17')],'loggedIn':this[_0xdf03('0x12')],'name':this[_0xdf03('0x7')],'paused':this[_0xdf03('0x13')],'waiting':this[_0xdf03('0x18')]};var _0x3b61f5=md5(JSON['stringify'](_0x2b68af));if(this['md5']!==_0x3b61f5){this['md5']=_0x3b61f5;io['to'](util[_0xdf03('0x19')](_0xdf03('0x1a'),_0x2b68af['name']))[_0xdf03('0x1b')](_0xdf03('0x1c'),_0x2b68af);}};module[_0xdf03('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index b6f7d72..f6acfdd 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 _0x7fbe=['../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','lodash','moment'];(function(_0x32bf1e,_0x28658b){var _0x4b16be=function(_0x439385){while(--_0x439385){_0x32bf1e['push'](_0x32bf1e['shift']());}};_0x4b16be(++_0x28658b);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4557a4,_0x36f89c){_0x4557a4=_0x4557a4-0x0;var _0x4ceb15=_0x7fbe[_0x4557a4];return _0x4ceb15;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xe7fb('0x0'));var moment=require(_0xe7fb('0x1'));var Agent=require(_0xe7fb('0x2'));var Interval=require(_0xe7fb('0x3'));var OpenchannelQueue=require(_0xe7fb('0x4'));var ChatQueue=require(_0xe7fb('0x5'));var SmsQueue=require(_0xe7fb('0x6'));var MailQueue=require(_0xe7fb('0x7'));var FaxQueue=require(_0xe7fb('0x8'));var WhatsappQueue=require(_0xe7fb('0x9'));var Realtime=function(){this[_0xe7fb('0xa')]={};this[_0xe7fb('0xb')]={};this[_0xe7fb('0xc')]={};this[_0xe7fb('0xd')]={};this['smsQueues']={};this[_0xe7fb('0xe')]={};this[_0xe7fb('0xf')]={};this[_0xe7fb('0x10')]={};this[_0xe7fb('0x11')]={};this['mailQueuesWaitingInteractions']={};this['openchannelQueuesWaitingInteractions']={};this[_0xe7fb('0x12')]={};this[_0xe7fb('0x13')]={};this[_0xe7fb('0x14')]={};};function freeIsNotKey(_0x348a73,_0x2a2223,_0x42435c){var _0x3e934b=_[_0xe7fb('0x15')](_0x348a73,function(_0x325035,_0x2fe8ab){return _0x325035[_0x42435c];});for(var _0x2437d4 in _0x2a2223){if(_0x2a2223[_0xe7fb('0x16')](_0x2437d4)){if(!_0x3e934b[_0x2437d4]){delete _0x2a2223[_0x2437d4];}}}}Realtime[_0xe7fb('0x17')][_0xe7fb('0x18')]=function(_0x7fe4d3,_0x598729){for(var _0x278b75 in _0x598729){if(_0x7fe4d3[_0xe7fb('0x16')](_0x278b75)){_0x7fe4d3[_0x278b75]=_0x598729[_0x278b75];}}};Realtime['prototype'][_0xe7fb('0x19')]=function(){var _0x37eb9f=this;return function(_0x482f7d){if(_0x482f7d){freeIsNotKey(_0x482f7d,_0x37eb9f[_0xe7fb('0xa')],'id');for(var _0x559129=0x0,_0x12fff6={},_0x18d23c={};_0x559129<_0x482f7d[_0xe7fb('0x1a')];_0x559129+=0x1){_0x12fff6=_0x482f7d[_0x559129];if(_[_0xe7fb('0x1b')](_0x37eb9f['agents'][_0x12fff6['id']])){_0x37eb9f[_0xe7fb('0xa')][_0x12fff6['id']]=new Agent(_0x12fff6);}else{_0x37eb9f['mergeFromDatabase'](_0x37eb9f[_0xe7fb('0xa')][_0x12fff6['id']],_0x12fff6);}}}return _0x37eb9f['agents'];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x1c')]=function(){var _0x3f96a7=this;return function(_0x182269){if(_0x182269){freeIsNotKey(_0x182269,_0x3f96a7['intervals'],'id');for(var _0x44466e=0x0,_0x5d1c87={},_0x11cae0={};_0x44466e<_0x182269['length'];_0x44466e+=0x1){_0x5d1c87=_0x182269[_0x44466e];if(_[_0xe7fb('0x1b')](_0x3f96a7['intervals'][_0x5d1c87['id']])){_0x3f96a7[_0xe7fb('0xb')][_0x5d1c87['id']]=new Interval(_0x5d1c87);}else{_0x3f96a7[_0xe7fb('0x18')](_0x3f96a7['intervals'][_0x5d1c87['id']],_0x5d1c87);}}}return _0x3f96a7[_0xe7fb('0xb')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x1d')]=function(){var _0x4dcb4b=this;return function(_0x469d50){if(_0x469d50){freeIsNotKey(_0x469d50,_0x4dcb4b[_0xe7fb('0xc')],'id');for(var _0x5da3d9=0x0,_0x5bea27={},_0x52f08b={};_0x5da3d9<_0x469d50[_0xe7fb('0x1a')];_0x5da3d9+=0x1){_0x5bea27=_0x469d50[_0x5da3d9];if(_['isUndefined'](_0x4dcb4b['openchannelQueues'][_0x5bea27['id']])){_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']]=new OpenchannelQueue(_0x5bea27);}else{_0x4dcb4b[_0xe7fb('0x18')](_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']],_0x5bea27);}_0x4dcb4b['openchannelQueues'][_0x5bea27['id']][_0xe7fb('0x1e')]();_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']][_0xe7fb('0x1f')]();}}return _0x4dcb4b[_0xe7fb('0xc')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x20')]=function(){var _0x380130=this;return function(_0x59e015){if(_0x59e015){freeIsNotKey(_0x59e015,_0x380130['chatQueues'],'id');for(var _0x1086e6=0x0,_0x3bdee9={},_0xead63={};_0x1086e6<_0x59e015['length'];_0x1086e6+=0x1){_0x3bdee9=_0x59e015[_0x1086e6];if(_[_0xe7fb('0x1b')](_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']])){_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']]=new ChatQueue(_0x3bdee9);}else{_0x380130[_0xe7fb('0x18')](_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']],_0x3bdee9);}_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']][_0xe7fb('0x1e')]();_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']]['updateRealtime']();}}return _0x380130[_0xe7fb('0xd')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x21')]=function(){var _0x547a04=this;return function(_0x517d70){if(_0x517d70){freeIsNotKey(_0x517d70,_0x547a04[_0xe7fb('0x22')],'id');for(var _0x4a9fea=0x0,_0xac56b4={},_0x2f8774={};_0x4a9fea<_0x517d70[_0xe7fb('0x1a')];_0x4a9fea+=0x1){_0xac56b4=_0x517d70[_0x4a9fea];if(_[_0xe7fb('0x1b')](_0x547a04['smsQueues'][_0xac56b4['id']])){_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']]=new SmsQueue(_0xac56b4);}else{_0x547a04[_0xe7fb('0x18')](_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']],_0xac56b4);}_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']][_0xe7fb('0x1e')]();_0x547a04['smsQueues'][_0xac56b4['id']][_0xe7fb('0x1f')]();}}return _0x547a04[_0xe7fb('0x22')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x23')]=function(){var _0x46f430=this;return function(_0x25e925){if(_0x25e925){freeIsNotKey(_0x25e925,_0x46f430[_0xe7fb('0xe')],'id');for(var _0x147eb1=0x0,_0x389903={},_0x59f9df={};_0x147eb1<_0x25e925[_0xe7fb('0x1a')];_0x147eb1+=0x1){_0x389903=_0x25e925[_0x147eb1];if(_[_0xe7fb('0x1b')](_0x46f430[_0xe7fb('0xe')][_0x389903['id']])){_0x46f430['mailQueues'][_0x389903['id']]=new MailQueue(_0x389903);}else{_0x46f430[_0xe7fb('0x18')](_0x46f430[_0xe7fb('0xe')][_0x389903['id']],_0x389903);}_0x46f430[_0xe7fb('0xe')][_0x389903['id']][_0xe7fb('0x1e')]();_0x46f430[_0xe7fb('0xe')][_0x389903['id']][_0xe7fb('0x1f')]();}}return _0x46f430[_0xe7fb('0xe')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x24')]=function(){var _0xebfe1d=this;return function(_0x29c34a){if(_0x29c34a){freeIsNotKey(_0x29c34a,_0xebfe1d[_0xe7fb('0xf')],'id');for(var _0x1544f2=0x0,_0x1c81fe={},_0xeb7c29={};_0x1544f2<_0x29c34a[_0xe7fb('0x1a')];_0x1544f2+=0x1){_0x1c81fe=_0x29c34a[_0x1544f2];if(_[_0xe7fb('0x1b')](_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']])){_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']]=new FaxQueue(_0x1c81fe);}else{_0xebfe1d['mergeFromDatabase'](_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']],_0x1c81fe);}_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']][_0xe7fb('0x1e')]();_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']]['updateRealtime']();}}return _0xebfe1d[_0xe7fb('0xf')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x25')]=function(){var _0x413a13=this;return function(_0x49fe9d){if(_0x49fe9d){freeIsNotKey(_0x49fe9d,_0x413a13[_0xe7fb('0x10')],'id');for(var _0x451a6c=0x0,_0x34265f={},_0x62a8a1={};_0x451a6c<_0x49fe9d[_0xe7fb('0x1a')];_0x451a6c+=0x1){_0x34265f=_0x49fe9d[_0x451a6c];if(_[_0xe7fb('0x1b')](_0x413a13['whatsappQueues'][_0x34265f['id']])){_0x413a13[_0xe7fb('0x10')][_0x34265f['id']]=new WhatsappQueue(_0x34265f);}else{_0x413a13[_0xe7fb('0x18')](_0x413a13[_0xe7fb('0x10')][_0x34265f['id']],_0x34265f);}_0x413a13['whatsappQueues'][_0x34265f['id']][_0xe7fb('0x1e')]();_0x413a13[_0xe7fb('0x10')][_0x34265f['id']]['updateRealtime']();}}return _0x413a13['whatsappQueues'];};};module['exports']=Realtime; \ No newline at end of file +var _0x6aa7=['agents','openchannelQueues','chatQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','intervals','isUndefined','updateRealtime','initChatQueues','updateRouting','initMailQueues','mailQueues','initWhatsappQueues','bluebird','lodash','moment','../model/agent','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0x6aa7,0x178));var _0x76aa=function(_0xbff7a7,_0x27d768){_0xbff7a7=_0xbff7a7-0x0;var _0x3ab379=_0x6aa7[_0xbff7a7];return _0x3ab379;};'use strict';var BPromise=require(_0x76aa('0x0'));var util=require('util');var _=require(_0x76aa('0x1'));var moment=require(_0x76aa('0x2'));var Agent=require(_0x76aa('0x3'));var Interval=require(_0x76aa('0x4'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x76aa('0x5'));var SmsQueue=require(_0x76aa('0x6'));var MailQueue=require(_0x76aa('0x7'));var FaxQueue=require('../model/faxQueue');var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this[_0x76aa('0x8')]={};this['intervals']={};this[_0x76aa('0x9')]={};this[_0x76aa('0xa')]={};this[_0x76aa('0xb')]={};this['mailQueues']={};this[_0x76aa('0xc')]={};this[_0x76aa('0xd')]={};this[_0x76aa('0xe')]={};this['mailQueuesWaitingInteractions']={};this[_0x76aa('0xf')]={};this[_0x76aa('0x10')]={};this[_0x76aa('0x11')]={};this[_0x76aa('0x12')]={};};function freeIsNotKey(_0x37f1ab,_0x128435,_0x2c5075){var _0x8dc35c=_[_0x76aa('0x13')](_0x37f1ab,function(_0x17a417,_0x5e5f47){return _0x17a417[_0x2c5075];});for(var _0x112c39 in _0x128435){if(_0x128435['hasOwnProperty'](_0x112c39)){if(!_0x8dc35c[_0x112c39]){delete _0x128435[_0x112c39];}}}}Realtime[_0x76aa('0x14')][_0x76aa('0x15')]=function(_0x3f8f6b,_0x8e44ed){for(var _0x10432c in _0x8e44ed){if(_0x3f8f6b['hasOwnProperty'](_0x10432c)){_0x3f8f6b[_0x10432c]=_0x8e44ed[_0x10432c];}}};Realtime['prototype'][_0x76aa('0x16')]=function(){var _0x4cfc34=this;return function(_0x180d92){if(_0x180d92){freeIsNotKey(_0x180d92,_0x4cfc34[_0x76aa('0x8')],'id');for(var _0x5cf594=0x0,_0x2111c7={},_0x550d9a={};_0x5cf594<_0x180d92[_0x76aa('0x17')];_0x5cf594+=0x1){_0x2111c7=_0x180d92[_0x5cf594];if(_['isUndefined'](_0x4cfc34[_0x76aa('0x8')][_0x2111c7['id']])){_0x4cfc34[_0x76aa('0x8')][_0x2111c7['id']]=new Agent(_0x2111c7);}else{_0x4cfc34[_0x76aa('0x15')](_0x4cfc34[_0x76aa('0x8')][_0x2111c7['id']],_0x2111c7);}}}return _0x4cfc34[_0x76aa('0x8')];};};Realtime[_0x76aa('0x14')]['initIntervals']=function(){var _0x5d6202=this;return function(_0x256636){if(_0x256636){freeIsNotKey(_0x256636,_0x5d6202[_0x76aa('0x18')],'id');for(var _0xf0711=0x0,_0x15b931={},_0x15109b={};_0xf0711<_0x256636[_0x76aa('0x17')];_0xf0711+=0x1){_0x15b931=_0x256636[_0xf0711];if(_[_0x76aa('0x19')](_0x5d6202[_0x76aa('0x18')][_0x15b931['id']])){_0x5d6202[_0x76aa('0x18')][_0x15b931['id']]=new Interval(_0x15b931);}else{_0x5d6202['mergeFromDatabase'](_0x5d6202[_0x76aa('0x18')][_0x15b931['id']],_0x15b931);}}}return _0x5d6202[_0x76aa('0x18')];};};Realtime[_0x76aa('0x14')]['initOpenchannelQueues']=function(){var _0x41463a=this;return function(_0x189cb6){if(_0x189cb6){freeIsNotKey(_0x189cb6,_0x41463a[_0x76aa('0x9')],'id');for(var _0x2bd2c6=0x0,_0x29c50c={},_0xc1044c={};_0x2bd2c6<_0x189cb6[_0x76aa('0x17')];_0x2bd2c6+=0x1){_0x29c50c=_0x189cb6[_0x2bd2c6];if(_[_0x76aa('0x19')](_0x41463a[_0x76aa('0x9')][_0x29c50c['id']])){_0x41463a[_0x76aa('0x9')][_0x29c50c['id']]=new OpenchannelQueue(_0x29c50c);}else{_0x41463a[_0x76aa('0x15')](_0x41463a[_0x76aa('0x9')][_0x29c50c['id']],_0x29c50c);}_0x41463a[_0x76aa('0x9')][_0x29c50c['id']]['updateRouting']();_0x41463a[_0x76aa('0x9')][_0x29c50c['id']][_0x76aa('0x1a')]();}}return _0x41463a[_0x76aa('0x9')];};};Realtime[_0x76aa('0x14')][_0x76aa('0x1b')]=function(){var _0x2f9316=this;return function(_0x25a803){if(_0x25a803){freeIsNotKey(_0x25a803,_0x2f9316[_0x76aa('0xa')],'id');for(var _0xd12a99=0x0,_0x1bdc3d={},_0x545b06={};_0xd12a99<_0x25a803[_0x76aa('0x17')];_0xd12a99+=0x1){_0x1bdc3d=_0x25a803[_0xd12a99];if(_['isUndefined'](_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']])){_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']]=new ChatQueue(_0x1bdc3d);}else{_0x2f9316[_0x76aa('0x15')](_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']],_0x1bdc3d);}_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']][_0x76aa('0x1c')]();_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']][_0x76aa('0x1a')]();}}return _0x2f9316[_0x76aa('0xa')];};};Realtime[_0x76aa('0x14')]['initSmsQueues']=function(){var _0x430ad6=this;return function(_0x5532c7){if(_0x5532c7){freeIsNotKey(_0x5532c7,_0x430ad6[_0x76aa('0xb')],'id');for(var _0x928ccf=0x0,_0x458ac3={},_0x38ecd1={};_0x928ccf<_0x5532c7[_0x76aa('0x17')];_0x928ccf+=0x1){_0x458ac3=_0x5532c7[_0x928ccf];if(_['isUndefined'](_0x430ad6[_0x76aa('0xb')][_0x458ac3['id']])){_0x430ad6[_0x76aa('0xb')][_0x458ac3['id']]=new SmsQueue(_0x458ac3);}else{_0x430ad6['mergeFromDatabase'](_0x430ad6[_0x76aa('0xb')][_0x458ac3['id']],_0x458ac3);}_0x430ad6['smsQueues'][_0x458ac3['id']][_0x76aa('0x1c')]();_0x430ad6['smsQueues'][_0x458ac3['id']][_0x76aa('0x1a')]();}}return _0x430ad6['smsQueues'];};};Realtime['prototype'][_0x76aa('0x1d')]=function(){var _0x282c56=this;return function(_0x198fcb){if(_0x198fcb){freeIsNotKey(_0x198fcb,_0x282c56[_0x76aa('0x1e')],'id');for(var _0x595a0f=0x0,_0x592596={},_0xdb18d3={};_0x595a0f<_0x198fcb[_0x76aa('0x17')];_0x595a0f+=0x1){_0x592596=_0x198fcb[_0x595a0f];if(_[_0x76aa('0x19')](_0x282c56[_0x76aa('0x1e')][_0x592596['id']])){_0x282c56[_0x76aa('0x1e')][_0x592596['id']]=new MailQueue(_0x592596);}else{_0x282c56['mergeFromDatabase'](_0x282c56[_0x76aa('0x1e')][_0x592596['id']],_0x592596);}_0x282c56['mailQueues'][_0x592596['id']]['updateRouting']();_0x282c56[_0x76aa('0x1e')][_0x592596['id']][_0x76aa('0x1a')]();}}return _0x282c56[_0x76aa('0x1e')];};};Realtime[_0x76aa('0x14')]['initFaxQueues']=function(){var _0x401c07=this;return function(_0x1c22f7){if(_0x1c22f7){freeIsNotKey(_0x1c22f7,_0x401c07[_0x76aa('0xc')],'id');for(var _0x4e131a=0x0,_0x113770={},_0x1638db={};_0x4e131a<_0x1c22f7[_0x76aa('0x17')];_0x4e131a+=0x1){_0x113770=_0x1c22f7[_0x4e131a];if(_[_0x76aa('0x19')](_0x401c07[_0x76aa('0xc')][_0x113770['id']])){_0x401c07[_0x76aa('0xc')][_0x113770['id']]=new FaxQueue(_0x113770);}else{_0x401c07[_0x76aa('0x15')](_0x401c07[_0x76aa('0xc')][_0x113770['id']],_0x113770);}_0x401c07[_0x76aa('0xc')][_0x113770['id']]['updateRouting']();_0x401c07[_0x76aa('0xc')][_0x113770['id']][_0x76aa('0x1a')]();}}return _0x401c07[_0x76aa('0xc')];};};Realtime[_0x76aa('0x14')][_0x76aa('0x1f')]=function(){var _0x2957aa=this;return function(_0x572fdb){if(_0x572fdb){freeIsNotKey(_0x572fdb,_0x2957aa['whatsappQueues'],'id');for(var _0x153a47=0x0,_0x262906={},_0x426454={};_0x153a47<_0x572fdb[_0x76aa('0x17')];_0x153a47+=0x1){_0x262906=_0x572fdb[_0x153a47];if(_['isUndefined'](_0x2957aa[_0x76aa('0xd')][_0x262906['id']])){_0x2957aa[_0x76aa('0xd')][_0x262906['id']]=new WhatsappQueue(_0x262906);}else{_0x2957aa[_0x76aa('0x15')](_0x2957aa[_0x76aa('0xd')][_0x262906['id']],_0x262906);}_0x2957aa[_0x76aa('0xd')][_0x262906['id']]['updateRouting']();_0x2957aa[_0x76aa('0xd')][_0x262906['id']]['updateRealtime']();}}return _0x2957aa[_0x76aa('0xd')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 10c5937..913849f 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 _0x919a=['UpdateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request'];(function(_0x511f54,_0x1d891c){var _0x236bb=function(_0x58045f){while(--_0x58045f){_0x511f54['push'](_0x511f54['shift']());}};_0x236bb(++_0x1d891c);}(_0x919a,0x1c5));var _0xa919=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x919a[_0x50007c];return _0x5c1ec7;};'use strict';var client=require(_0xa919('0x0'));exports['update']=function(_0x2add42,_0x4a9f9c){return client[_0xa919('0x1')](_0xa919('0x2'),{'body':_0x4a9f9c,'options':{'where':{'id':_0x2add42}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x172361,_0x96e97c){return client['Request'](_0xa919('0x3'),{'body':_0x96e97c,'options':{'where':{'id':_0x172361}},'log':_0xa919('0x4')});}; \ No newline at end of file +var _0x3aa4=['Request','../client','update','updateChatInteraction','addTags'];(function(_0x4ca40b,_0x531ba9){var _0x81cf70=function(_0xe26faa){while(--_0xe26faa){_0x4ca40b['push'](_0x4ca40b['shift']());}};_0x81cf70(++_0x531ba9);}(_0x3aa4,0xe2));var _0x43aa=function(_0x4d4c17,_0xb27e10){_0x4d4c17=_0x4d4c17-0x0;var _0x27018c=_0x3aa4[_0x4d4c17];return _0x27018c;};'use strict';var client=require(_0x43aa('0x0'));exports[_0x43aa('0x1')]=function(_0x42476b,_0x43c64c){return client['Request']('UpdateChatInteraction',{'body':_0x43c64c,'options':{'where':{'id':_0x42476b}},'log':_0x43aa('0x2')});};exports[_0x43aa('0x3')]=function(_0x3915f1,_0x5570a3){return client[_0x43aa('0x4')]('AddTagsToChatInteraction',{'body':_0x5570a3,'options':{'where':{'id':_0x3915f1}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index b916736..9d62100 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 _0x8726=['createChatMessage','Request','CreateChatMessage'];(function(_0x1d8169,_0x36a9c2){var _0x4e88d7=function(_0x138ec9){while(--_0x138ec9){_0x1d8169['push'](_0x1d8169['shift']());}};_0x4e88d7(++_0x36a9c2);}(_0x8726,0x97));var _0x6872=function(_0x498e6f,_0x24ae53){_0x498e6f=_0x498e6f-0x0;var _0x2a09dd=_0x8726[_0x498e6f];return _0x2a09dd;};'use strict';var client=require('../client');exports['create']=function(_0x33417a){return client[_0x6872('0x0')](_0x6872('0x1'),{'body':_0x33417a,'log':_0x6872('0x2')});}; \ No newline at end of file +var _0x66bc=['create','Request','CreateChatMessage','../client'];(function(_0x431ff8,_0x4085dd){var _0x84ccd4=function(_0x1fd1b5){while(--_0x1fd1b5){_0x431ff8['push'](_0x431ff8['shift']());}};_0x84ccd4(++_0x4085dd);}(_0x66bc,0x16b));var _0xc66b=function(_0x4d0416,_0x4f2bb6){_0x4d0416=_0x4d0416-0x0;var _0x173e01=_0x66bc[_0x4d0416];return _0x173e01;};'use strict';var client=require(_0xc66b('0x0'));exports[_0xc66b('0x1')]=function(_0x131def){return client[_0xc66b('0x2')](_0xc66b('0x3'),{'body':_0x131def,'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 4d35e19..efe10d6 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 _0xd850=['../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy','User','Agents','chatPause'];(function(_0x105ed0,_0x20ad13){var _0x4167df=function(_0x2f8410){while(--_0x2f8410){_0x105ed0['push'](_0x105ed0['shift']());}};_0x4167df(++_0x20ad13);}(_0xd850,0x168));var _0x0d85=function(_0x418a98,_0x366125){_0x418a98=_0x418a98-0x0;var _0x730e70=_0xd850[_0x418a98];return _0x730e70;};'use strict';var client=require(_0x0d85('0x0'));exports[_0x0d85('0x1')]=function(){return function(){return client[_0x0d85('0x2')](_0x0d85('0x3'),{'options':{'raw':![],'attributes':['id',_0x0d85('0x4'),_0x0d85('0x5'),_0x0d85('0x6')],'include':[{'model':_0x0d85('0x7'),'as':_0x0d85('0x8'),'attributes':['id',_0x0d85('0x4'),'online',_0x0d85('0x9')]}]},'log':_0x0d85('0x1')});};}; \ No newline at end of file +var _0x7b2c=['../client','getChatQueues','name','User','Agents'];(function(_0x3c995a,_0xa5c1c9){var _0x19afad=function(_0xca220d){while(--_0xca220d){_0x3c995a['push'](_0x3c995a['shift']());}};_0x19afad(++_0xa5c1c9);}(_0x7b2c,0x1ef));var _0xc7b2=function(_0x3e64b6,_0x490eee){_0x3e64b6=_0x3e64b6-0x0;var _0xc1fe54=_0x7b2c[_0x3e64b6];return _0xc1fe54;};'use strict';var client=require(_0xc7b2('0x0'));exports[_0xc7b2('0x1')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xc7b2('0x2'),'timeout','strategy'],'include':[{'model':_0xc7b2('0x3'),'as':_0xc7b2('0x4'),'attributes':['id',_0xc7b2('0x2'),'online','chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 1b52fec..1384c9b 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 _0x0884=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x0884,0xb3));var _0x4088=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0884[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x4088('0x0'));exports[_0x4088('0x1')]=function(_0x1eb3d7){return client[_0x4088('0x2')](_0x4088('0x3'),{'body':_0x1eb3d7,'log':_0x4088('0x3')});};exports[_0x4088('0x4')]=function(_0x556d34,_0x3c15b9){return client[_0x4088('0x2')](_0x4088('0x5'),{'body':_0x3c15b9,'options':{'where':{'uniqueid':_0x556d34},'order':[['id',_0x4088('0x6')]],'limit':0x1},'log':_0x4088('0x5')});}; \ No newline at end of file +var _0x04d0=['UpdateChatQueueReport','Request','CreateChatQueueReport','update','DESC'];(function(_0x8f4c74,_0x3ff3d4){var _0x18d162=function(_0x583445){while(--_0x583445){_0x8f4c74['push'](_0x8f4c74['shift']());}};_0x18d162(++_0x3ff3d4);}(_0x04d0,0x10a));var _0x004d=function(_0x341797,_0x184ff3){_0x341797=_0x341797-0x0;var _0x322260=_0x04d0[_0x341797];return _0x322260;};'use strict';var client=require('../client');exports['create']=function(_0x3189a3){return client[_0x004d('0x0')](_0x004d('0x1'),{'body':_0x3189a3,'log':_0x004d('0x1')});};exports[_0x004d('0x2')]=function(_0x5f000c,_0x516d73){return client[_0x004d('0x0')]('UpdateChatQueueReport',{'body':_0x516d73,'options':{'where':{'uniqueid':_0x5f000c},'order':[['id',_0x004d('0x3')]],'limit':0x1},'log':_0x004d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index be602c9..3e1b229 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 _0xcce1=['updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction'];(function(_0x326f49,_0x12392f){var _0x5249af=function(_0x51e5a2){while(--_0x51e5a2){_0x326f49['push'](_0x326f49['shift']());}};_0x5249af(++_0x12392f);}(_0xcce1,0x138));var _0x1cce=function(_0x1d1963,_0x32cc0e){_0x1d1963=_0x1d1963-0x0;var _0x3f58bb=_0xcce1[_0x1d1963];return _0x3f58bb;};'use strict';var client=require(_0x1cce('0x0'));exports[_0x1cce('0x1')]=function(_0x1eca03,_0x29de19){return client['Request'](_0x1cce('0x2'),{'body':_0x29de19,'options':{'where':{'id':_0x1eca03}},'log':_0x1cce('0x3')});};exports[_0x1cce('0x4')]=function(_0x5917da,_0x4c3e98){return client['Request'](_0x1cce('0x5'),{'body':_0x4c3e98,'options':{'where':{'id':_0x5917da}},'log':_0x1cce('0x6')});}; \ No newline at end of file +var _0x8bb8=['addTagsToFaxInteraction','update','Request','AddTagsToFaxInteraction'];(function(_0x8c1f7c,_0x1e1ae3){var _0x483f44=function(_0x2b562a){while(--_0x2b562a){_0x8c1f7c['push'](_0x8c1f7c['shift']());}};_0x483f44(++_0x1e1ae3);}(_0x8bb8,0x115));var _0x88bb=function(_0x3251d0,_0x5279a8){_0x3251d0=_0x3251d0-0x0;var _0x47522b=_0x8bb8[_0x3251d0];return _0x47522b;};'use strict';var client=require('../client');exports[_0x88bb('0x0')]=function(_0x281b1d,_0x15af22){return client[_0x88bb('0x1')]('UpdateFaxInteraction',{'body':_0x15af22,'options':{'where':{'id':_0x281b1d}},'log':'updateFaxInteraction'});};exports['addTags']=function(_0x13b389,_0x40fe8b){return client[_0x88bb('0x1')](_0x88bb('0x2'),{'body':_0x40fe8b,'options':{'where':{'id':_0x13b389}},'log':_0x88bb('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 8349445..dc7c48f 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 _0x7134=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x405fe8,_0xa55e2f){var _0x50e490=function(_0x566869){while(--_0x566869){_0x405fe8['push'](_0x405fe8['shift']());}};_0x50e490(++_0xa55e2f);}(_0x7134,0x106));var _0x4713=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7134[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x4713('0x0'));exports[_0x4713('0x1')]=function(_0xfebc42){return client[_0x4713('0x2')](_0x4713('0x3'),{'body':_0xfebc42,'log':_0x4713('0x4')});}; \ No newline at end of file +var _0x716c=['../client','Request','CreateFaxMessage','createFaxMessage'];(function(_0x4dbf9e,_0x1cced2){var _0x44cf06=function(_0x25dcd2){while(--_0x25dcd2){_0x4dbf9e['push'](_0x4dbf9e['shift']());}};_0x44cf06(++_0x1cced2);}(_0x716c,0x144));var _0xc716=function(_0x239c17,_0x236b0f){_0x239c17=_0x239c17-0x0;var _0x13ae4d=_0x716c[_0x239c17];return _0x13ae4d;};'use strict';var client=require(_0xc716('0x0'));exports['create']=function(_0x1ce8ec){return client[_0xc716('0x1')](_0xc716('0x2'),{'body':_0x1ce8ec,'log':_0xc716('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 9c1e863..4b75c4b 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 _0x9242=['faxPause','getFaxQueues','Request','GetFaxQueue','timeout','strategy','User','Agents','name'];(function(_0x218bee,_0x39b858){var _0x4797b0=function(_0x5bc1df){while(--_0x5bc1df){_0x218bee['push'](_0x218bee['shift']());}};_0x4797b0(++_0x39b858);}(_0x9242,0x110));var _0x2924=function(_0x35fb56,_0x5dadff){_0x35fb56=_0x35fb56-0x0;var _0x2fd52c=_0x9242[_0x35fb56];return _0x2fd52c;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x2924('0x0')](_0x2924('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x2924('0x2'),_0x2924('0x3')],'include':[{'model':_0x2924('0x4'),'as':_0x2924('0x5'),'attributes':['id',_0x2924('0x6'),'online',_0x2924('0x7')]}]},'log':_0x2924('0x8')});};}; \ No newline at end of file +var _0x7741=['name','strategy','User','online','faxPause','getFaxQueues','Request','GetFaxQueue'];(function(_0x10db36,_0x1d0aca){var _0x24357c=function(_0x192b20){while(--_0x192b20){_0x10db36['push'](_0x10db36['shift']());}};_0x24357c(++_0x1d0aca);}(_0x7741,0x75));var _0x1774=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7741[_0xa464c9];return _0x3d73c4;};'use strict';var client=require('../client');exports[_0x1774('0x0')]=function(){return function(){return client[_0x1774('0x1')](_0x1774('0x2'),{'options':{'raw':![],'attributes':['id',_0x1774('0x3'),'timeout',_0x1774('0x4')],'include':[{'model':_0x1774('0x5'),'as':'Agents','attributes':['id',_0x1774('0x3'),_0x1774('0x6'),_0x1774('0x7')]}]},'log':_0x1774('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 2c05b55..568d542 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 _0xbf54=['Request','update','DESC','UpdateFaxQueueReport','../client'];(function(_0xedad78,_0x4ff14e){var _0x2ecba8=function(_0x2ef623){while(--_0x2ef623){_0xedad78['push'](_0xedad78['shift']());}};_0x2ecba8(++_0x4ff14e);}(_0xbf54,0x18f));var _0x4bf5=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xbf54[_0x363ef8];return _0x148822;};'use strict';var client=require(_0x4bf5('0x0'));exports['create']=function(_0x2ef922){return client[_0x4bf5('0x1')]('CreateFaxQueueReport',{'body':_0x2ef922,'log':'CreateFaxQueueReport'});};exports[_0x4bf5('0x2')]=function(_0x161175,_0x2aac11){return client[_0x4bf5('0x1')]('UpdateFaxQueueReport',{'body':_0x2aac11,'options':{'where':{'uniqueid':_0x161175},'order':[['id',_0x4bf5('0x3')]],'limit':0x1},'log':_0x4bf5('0x4')});}; \ No newline at end of file +var _0x0176=['CreateFaxQueueReport','UpdateFaxQueueReport','DESC','Request'];(function(_0x290c31,_0x534b8a){var _0x2eb0ac=function(_0x54bd7){while(--_0x54bd7){_0x290c31['push'](_0x290c31['shift']());}};_0x2eb0ac(++_0x534b8a);}(_0x0176,0x163));var _0x6017=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0176[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports['create']=function(_0x274cb1){return client[_0x6017('0x0')](_0x6017('0x1'),{'body':_0x274cb1,'log':_0x6017('0x1')});};exports['update']=function(_0x115a4d,_0x13bf0d){return client[_0x6017('0x0')](_0x6017('0x2'),{'body':_0x13bf0d,'options':{'where':{'uniqueid':_0x115a4d},'order':[['id',_0x6017('0x3')]],'limit':0x1},'log':_0x6017('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 3e05fad..13821af 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 _0xb78e=['Intervals','interval','../client','getIntervals','GetInterval','name','Interval'];(function(_0xde9059,_0x750aab){var _0x23197d=function(_0x457724){while(--_0x457724){_0xde9059['push'](_0xde9059['shift']());}};_0x23197d(++_0x750aab);}(_0xb78e,0x1c9));var _0xeb78=function(_0x1f9421,_0x15469e){_0x1f9421=_0x1f9421-0x0;var _0x595181=_0xb78e[_0x1f9421];return _0x595181;};'use strict';var client=require(_0xeb78('0x0'));exports[_0xeb78('0x1')]=function(){return function(){return client['Request'](_0xeb78('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xeb78('0x3')],'include':[{'model':_0xeb78('0x4'),'as':_0xeb78('0x5'),'attributes':['id',_0xeb78('0x3'),_0xeb78('0x6')]}]},'log':_0xeb78('0x1')});};}; \ No newline at end of file +var _0xccde=['getIntervals','../client','Request','name','Interval','interval'];(function(_0x1e3c02,_0x5c07a2){var _0x4d26d7=function(_0x367ed9){while(--_0x367ed9){_0x1e3c02['push'](_0x1e3c02['shift']());}};_0x4d26d7(++_0x5c07a2);}(_0xccde,0x1e1));var _0xeccd=function(_0x1a89ca,_0x27394b){_0x1a89ca=_0x1a89ca-0x0;var _0x29cbb2=_0xccde[_0x1a89ca];return _0x29cbb2;};'use strict';var client=require(_0xeccd('0x0'));exports['getIntervals']=function(){return function(){return client[_0xeccd('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xeccd('0x2')],'include':[{'model':_0xeccd('0x3'),'as':'Intervals','attributes':['id','name',_0xeccd('0x4')]}]},'log':_0xeccd('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 92d8df5..0c8f45f 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 _0x4cf1=['Request','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update'];(function(_0x3da69d,_0x48109f){var _0x53dae0=function(_0x2bbd14){while(--_0x2bbd14){_0x3da69d['push'](_0x3da69d['shift']());}};_0x53dae0(++_0x48109f);}(_0x4cf1,0x1a2));var _0x14cf=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0x4cf1[_0x3e6729];return _0x535bcd;};'use strict';var client=require(_0x14cf('0x0'));exports[_0x14cf('0x1')]=function(_0x40e271,_0x836c3f){return client[_0x14cf('0x2')]('UpdateMailInteraction',{'body':_0x836c3f,'options':{'where':{'id':_0x40e271}},'log':_0x14cf('0x3')});};exports[_0x14cf('0x4')]=function(_0x228bca,_0x181a23){return client[_0x14cf('0x2')](_0x14cf('0x5'),{'body':_0x181a23,'options':{'where':{'id':_0x228bca}},'log':_0x14cf('0x6')});}; \ No newline at end of file +var _0x5d7d=['addTags','AddTagsToMailInteraction','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x431dc5,_0x297727){var _0x426629=function(_0x3098eb){while(--_0x3098eb){_0x431dc5['push'](_0x431dc5['shift']());}};_0x426629(++_0x297727);}(_0x5d7d,0xa7));var _0xd5d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d7d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['update']=function(_0x21241a,_0xc2d8cd){return client[_0xd5d7('0x0')](_0xd5d7('0x1'),{'body':_0xc2d8cd,'options':{'where':{'id':_0x21241a}},'log':_0xd5d7('0x2')});};exports[_0xd5d7('0x3')]=function(_0x5389a2,_0x35963c){return client[_0xd5d7('0x0')](_0xd5d7('0x4'),{'body':_0x35963c,'options':{'where':{'id':_0x5389a2}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index fb337c2..35bc640 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 _0xdc93=['../client','CreateMailMessage'];(function(_0x103d88,_0x3e6f66){var _0x2e190a=function(_0x1bf8ae){while(--_0x1bf8ae){_0x103d88['push'](_0x103d88['shift']());}};_0x2e190a(++_0x3e6f66);}(_0xdc93,0x13c));var _0x3dc9=function(_0x16a637,_0x5eb627){_0x16a637=_0x16a637-0x0;var _0x25126d=_0xdc93[_0x16a637];return _0x25126d;};'use strict';var client=require(_0x3dc9('0x0'));exports['create']=function(_0x2c05b4){return client['Request'](_0x3dc9('0x1'),{'body':_0x2c05b4,'log':'createMailMessage'});}; \ No newline at end of file +var _0xf75d=['CreateMailMessage','../client','Request'];(function(_0xa1c9aa,_0xd8f1df){var _0x2deb01=function(_0x4eb25b){while(--_0x4eb25b){_0xa1c9aa['push'](_0xa1c9aa['shift']());}};_0x2deb01(++_0xd8f1df);}(_0xf75d,0x199));var _0xdf75=function(_0xe455e7,_0x29fb65){_0xe455e7=_0xe455e7-0x0;var _0xfc683e=_0xf75d[_0xe455e7];return _0xfc683e;};'use strict';var client=require(_0xdf75('0x0'));exports['create']=function(_0x2af174){return client[_0xdf75('0x1')](_0xdf75('0x2'),{'body':_0x2af174,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 6068fb7..0cb5dcd 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 _0xba96=['Agents','../client','getMailQueues','name','timeout','strategy'];(function(_0x39f1fc,_0x5ef2c9){var _0x1d4634=function(_0x3c6517){while(--_0x3c6517){_0x39f1fc['push'](_0x39f1fc['shift']());}};_0x1d4634(++_0x5ef2c9);}(_0xba96,0x1d5));var _0x6ba9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xba96[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x6ba9('0x0'));exports[_0x6ba9('0x1')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x6ba9('0x2'),_0x6ba9('0x3'),_0x6ba9('0x4')],'include':[{'model':'User','as':_0x6ba9('0x5'),'attributes':['id',_0x6ba9('0x2'),'online','mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0xae83=['name','timeout','User','Agents','mailPause','getMailQueues'];(function(_0x102b48,_0x1ffa36){var _0x1819c4=function(_0xc1c6dc){while(--_0xc1c6dc){_0x102b48['push'](_0x102b48['shift']());}};_0x1819c4(++_0x1ffa36);}(_0xae83,0x1f1));var _0x3ae8=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xae83[_0x19950b];return _0x3c6b41;};'use strict';var client=require('../client');exports[_0x3ae8('0x0')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x3ae8('0x1'),_0x3ae8('0x2'),'strategy'],'include':[{'model':_0x3ae8('0x3'),'as':_0x3ae8('0x4'),'attributes':['id',_0x3ae8('0x1'),'online',_0x3ae8('0x5')]}]},'log':_0x3ae8('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index a66d679..4a72839 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 _0x0620=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create'];(function(_0x1c6947,_0x5bcb10){var _0x2df2fe=function(_0x8b1418){while(--_0x8b1418){_0x1c6947['push'](_0x1c6947['shift']());}};_0x2df2fe(++_0x5bcb10);}(_0x0620,0x1e8));var _0x0062=function(_0x34c1e1,_0x305ac9){_0x34c1e1=_0x34c1e1-0x0;var _0x248e03=_0x0620[_0x34c1e1];return _0x248e03;};'use strict';var client=require(_0x0062('0x0'));exports[_0x0062('0x1')]=function(_0x101960){return client[_0x0062('0x2')](_0x0062('0x3'),{'body':_0x101960,'log':'CreateMailQueueReport'});};exports[_0x0062('0x4')]=function(_0x2999e4,_0x475a5c){return client['Request'](_0x0062('0x5'),{'body':_0x475a5c,'options':{'where':{'uniqueid':_0x2999e4},'order':[['id',_0x0062('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x1f0e=['DESC','../client','create','CreateMailQueueReport','update','Request','UpdateMailQueueReport'];(function(_0x57c26c,_0x5d067e){var _0x31df90=function(_0x1216bc){while(--_0x1216bc){_0x57c26c['push'](_0x57c26c['shift']());}};_0x31df90(++_0x5d067e);}(_0x1f0e,0xb7));var _0xe1f0=function(_0x2b1f79,_0x8cfab1){_0x2b1f79=_0x2b1f79-0x0;var _0x40079e=_0x1f0e[_0x2b1f79];return _0x40079e;};'use strict';var client=require(_0xe1f0('0x0'));exports[_0xe1f0('0x1')]=function(_0x460c1b){return client['Request'](_0xe1f0('0x2'),{'body':_0x460c1b,'log':_0xe1f0('0x2')});};exports[_0xe1f0('0x3')]=function(_0x5064f2,_0x4441c6){return client[_0xe1f0('0x4')](_0xe1f0('0x5'),{'body':_0x4441c6,'options':{'where':{'uniqueid':_0x5064f2},'order':[['id',_0xe1f0('0x6')]],'limit':0x1},'log':_0xe1f0('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 8cc8c18..467c25c 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 _0xe385=['update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','../client'];(function(_0x3c6125,_0x3b2a9c){var _0x2f47b8=function(_0x214650){while(--_0x214650){_0x3c6125['push'](_0x3c6125['shift']());}};_0x2f47b8(++_0x3b2a9c);}(_0xe385,0x179));var _0x5e38=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xe385[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0x5e38('0x0'));exports[_0x5e38('0x1')]=function(_0x2e0153,_0x2862e4){return client[_0x5e38('0x2')](_0x5e38('0x3'),{'body':_0x2862e4,'options':{'where':{'id':_0x2e0153}},'log':_0x5e38('0x4')});};exports[_0x5e38('0x5')]=function(_0x4356c1,_0x52ef32){return client[_0x5e38('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x52ef32,'options':{'where':{'id':_0x4356c1}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xe785=['addTagsToChatInteraction','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xe785,0x197));var _0x5e78=function(_0x1c471b,_0xa2d18c){_0x1c471b=_0x1c471b-0x0;var _0x48656f=_0xe785[_0x1c471b];return _0x48656f;};'use strict';var client=require('../client');exports[_0x5e78('0x0')]=function(_0x4535d1,_0x590d10){return client['Request'](_0x5e78('0x1'),{'body':_0x590d10,'options':{'where':{'id':_0x4535d1}},'log':_0x5e78('0x2')});};exports[_0x5e78('0x3')]=function(_0x2e3af0,_0x4f3895){return client[_0x5e78('0x4')](_0x5e78('0x5'),{'body':_0x4f3895,'options':{'where':{'id':_0x2e3af0}},'log':_0x5e78('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index ca15478..9490fc7 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 _0x9a19=['../client','create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x1b87a5,_0x5875ef){var _0x212666=function(_0x49f640){while(--_0x49f640){_0x1b87a5['push'](_0x1b87a5['shift']());}};_0x212666(++_0x5875ef);}(_0x9a19,0x114));var _0x99a1=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x9a19[_0x1b2ff7];return _0x31656a;};'use strict';var client=require(_0x99a1('0x0'));exports[_0x99a1('0x1')]=function(_0x3d860b){return client['Request'](_0x99a1('0x2'),{'body':_0x3d860b,'log':_0x99a1('0x3')});}; \ No newline at end of file +var _0xcb91=['CreateOpenchannelMessage','createOpenchannelMessage','Request'];(function(_0x4f6eb1,_0x144e49){var _0x1ea245=function(_0x199e64){while(--_0x199e64){_0x4f6eb1['push'](_0x4f6eb1['shift']());}};_0x1ea245(++_0x144e49);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0xcb91[_0x609988];return _0x159984;};'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 diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 12ff229..091ea75 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 _0x7549=['../client','GetOpenchannelQueue','timeout','openchannelPause','getOpenchannelQueues'];(function(_0x169790,_0x48aa33){var _0x4d0f36=function(_0x2a848d){while(--_0x2a848d){_0x169790['push'](_0x169790['shift']());}};_0x4d0f36(++_0x48aa33);}(_0x7549,0x186));var _0x9754=function(_0x86cfb7,_0xc211ae){_0x86cfb7=_0x86cfb7-0x0;var _0x2c7eb7=_0x7549[_0x86cfb7];return _0x2c7eb7;};'use strict';var client=require(_0x9754('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0x9754('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x9754('0x2'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id','name','online',_0x9754('0x3')]}]},'log':_0x9754('0x4')});};}; \ No newline at end of file +var _0x77e3=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','openchannelPause','../client'];(function(_0x193701,_0x271245){var _0x439b28=function(_0x4bd529){while(--_0x4bd529){_0x193701['push'](_0x193701['shift']());}};_0x439b28(++_0x271245);}(_0x77e3,0x1e9));var _0x377e=function(_0x51951b,_0x5d1a16){_0x51951b=_0x51951b-0x0;var _0x17dc1a=_0x77e3[_0x51951b];return _0x17dc1a;};'use strict';var client=require(_0x377e('0x0'));exports[_0x377e('0x1')]=function(){return function(){return client[_0x377e('0x2')](_0x377e('0x3'),{'options':{'raw':![],'attributes':['id',_0x377e('0x4'),_0x377e('0x5'),_0x377e('0x6')],'include':[{'model':_0x377e('0x7'),'as':_0x377e('0x8'),'attributes':['id',_0x377e('0x4'),'online',_0x377e('0x9')]}]},'log':_0x377e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index d5d2987..6ac1c72 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 _0xe22c=['DESC','../client','Request','update','UpdateOpenchannelQueueReport'];(function(_0x2be7b2,_0x1cb66a){var _0x47d848=function(_0x13b76e){while(--_0x13b76e){_0x2be7b2['push'](_0x2be7b2['shift']());}};_0x47d848(++_0x1cb66a);}(_0xe22c,0xe2));var _0xce22=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe22c[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xce22('0x0'));exports['create']=function(_0x5117d7){return client[_0xce22('0x1')]('CreateOpenchannelQueueReport',{'body':_0x5117d7,'log':'CreateOpenchannelQueueReport'});};exports[_0xce22('0x2')]=function(_0x2df24c,_0x37434d){return client[_0xce22('0x1')](_0xce22('0x3'),{'body':_0x37434d,'options':{'where':{'uniqueid':_0x2df24c},'order':[['id',_0xce22('0x4')]],'limit':0x1},'log':_0xce22('0x3')});}; \ No newline at end of file +var _0x6143=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','Request'];(function(_0x4cd2b2,_0x1217b6){var _0x3179ea=function(_0x28bfc4){while(--_0x28bfc4){_0x4cd2b2['push'](_0x4cd2b2['shift']());}};_0x3179ea(++_0x1217b6);}(_0x6143,0x1c6));var _0x3614=function(_0x23e7ad,_0x38d922){_0x23e7ad=_0x23e7ad-0x0;var _0x5c492f=_0x6143[_0x23e7ad];return _0x5c492f;};'use strict';var client=require(_0x3614('0x0'));exports['create']=function(_0x1d0e4d){return client[_0x3614('0x1')]('CreateOpenchannelQueueReport',{'body':_0x1d0e4d,'log':_0x3614('0x2')});};exports[_0x3614('0x3')]=function(_0x1e7777,_0x2ed94d){return client[_0x3614('0x1')](_0x3614('0x4'),{'body':_0x2ed94d,'options':{'where':{'uniqueid':_0x1e7777},'order':[['id',_0x3614('0x5')]],'limit':0x1},'log':_0x3614('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 201e1f5..9ecedd7 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 _0xfb73=['UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','update'];(function(_0x9276d7,_0x281d1a){var _0x1cca81=function(_0x59e7dc){while(--_0x59e7dc){_0x9276d7['push'](_0x9276d7['shift']());}};_0x1cca81(++_0x281d1a);}(_0xfb73,0xbd));var _0x3fb7=function(_0xe69d2,_0x45939a){_0xe69d2=_0xe69d2-0x0;var _0x1e4540=_0xfb73[_0xe69d2];return _0x1e4540;};'use strict';var client=require('../client');exports[_0x3fb7('0x0')]=function(_0x32128d,_0x356932){return client['Request'](_0x3fb7('0x1'),{'body':_0x356932,'options':{'where':{'id':_0x32128d}},'log':_0x3fb7('0x2')});};exports[_0x3fb7('0x3')]=function(_0x4b5723,_0x2da0c7){return client['Request'](_0x3fb7('0x4'),{'body':_0x2da0c7,'options':{'where':{'id':_0x4b5723}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x6b52=['update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6b52,0xdf));var _0x26b5=function(_0x1e04e3,_0x55c35b){_0x1e04e3=_0x1e04e3-0x0;var _0x50899b=_0x6b52[_0x1e04e3];return _0x50899b;};'use strict';var client=require(_0x26b5('0x0'));exports[_0x26b5('0x1')]=function(_0x4d0332,_0x228ad1){return client[_0x26b5('0x2')](_0x26b5('0x3'),{'body':_0x228ad1,'options':{'where':{'id':_0x4d0332}},'log':_0x26b5('0x4')});};exports[_0x26b5('0x5')]=function(_0x42e8e1,_0x1a284c){return client['Request'](_0x26b5('0x6'),{'body':_0x1a284c,'options':{'where':{'id':_0x42e8e1}},'log':_0x26b5('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 2b5fe50..9b2f758 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 _0x64e1=['Request','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x64e1,0x9a));var _0x164e=function(_0xe236ae,_0x16039b){_0xe236ae=_0xe236ae-0x0;var _0x4e039d=_0x64e1[_0xe236ae];return _0x4e039d;};'use strict';var client=require(_0x164e('0x0'));exports[_0x164e('0x1')]=function(_0x1c3895){return client[_0x164e('0x2')]('CreateSmsMessage',{'body':_0x1c3895,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x34b3=['create','Request','CreateSmsMessage','createSmsMessage','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34b3,0x1b2));var _0x334b=function(_0x4b14cb,_0x32bf27){_0x4b14cb=_0x4b14cb-0x0;var _0x337a01=_0x34b3[_0x4b14cb];return _0x337a01;};'use strict';var client=require(_0x334b('0x0'));exports[_0x334b('0x1')]=function(_0x1cc33f){return client[_0x334b('0x2')](_0x334b('0x3'),{'body':_0x1cc33f,'log':_0x334b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 467d2de..0df4a1c 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 _0x4f41=['name','timeout','User','Agents','smsPause','getSmsQueues','Request','GetSmsQueue'];(function(_0x289a67,_0x1e5a3c){var _0x572b49=function(_0x22e036){while(--_0x22e036){_0x289a67['push'](_0x289a67['shift']());}};_0x572b49(++_0x1e5a3c);}(_0x4f41,0xdd));var _0x14f4=function(_0x1e6cf6,_0x6743d7){_0x1e6cf6=_0x1e6cf6-0x0;var _0x4a9593=_0x4f41[_0x1e6cf6];return _0x4a9593;};'use strict';var client=require('../client');exports[_0x14f4('0x0')]=function(){return function(){return client[_0x14f4('0x1')](_0x14f4('0x2'),{'options':{'raw':![],'attributes':['id',_0x14f4('0x3'),_0x14f4('0x4'),'strategy'],'include':[{'model':_0x14f4('0x5'),'as':_0x14f4('0x6'),'attributes':['id',_0x14f4('0x3'),'online',_0x14f4('0x7')]}]},'log':_0x14f4('0x0')});};}; \ No newline at end of file +var _0xd868=['User','name','online','getSmsQueues','../client','Request','timeout','strategy'];(function(_0x3e5deb,_0x27793d){var _0x4c5c6b=function(_0x1986ea){while(--_0x1986ea){_0x3e5deb['push'](_0x3e5deb['shift']());}};_0x4c5c6b(++_0x27793d);}(_0xd868,0x1ec));var _0x8d86=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xd868[_0x4c7fb5];return _0x2e10ac;};'use strict';var client=require(_0x8d86('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x8d86('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x8d86('0x2'),_0x8d86('0x3')],'include':[{'model':_0x8d86('0x4'),'as':'Agents','attributes':['id',_0x8d86('0x5'),_0x8d86('0x6'),'smsPause']}]},'log':_0x8d86('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 9d03cd0..5f52024 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 _0xbd89=['update','DESC','UpdateSmsQueueReport','Request','CreateSmsQueueReport'];(function(_0x388679,_0x502313){var _0x3392fa=function(_0x39dfda){while(--_0x39dfda){_0x388679['push'](_0x388679['shift']());}};_0x3392fa(++_0x502313);}(_0xbd89,0x9e));var _0x9bd8=function(_0x1c8eeb,_0x50aeea){_0x1c8eeb=_0x1c8eeb-0x0;var _0x2d8318=_0xbd89[_0x1c8eeb];return _0x2d8318;};'use strict';var client=require('../client');exports['create']=function(_0x4acd3b){return client[_0x9bd8('0x0')]('CreateSmsQueueReport',{'body':_0x4acd3b,'log':_0x9bd8('0x1')});};exports[_0x9bd8('0x2')]=function(_0x21a172,_0x3f8ee3){return client[_0x9bd8('0x0')]('UpdateSmsQueueReport',{'body':_0x3f8ee3,'options':{'where':{'uniqueid':_0x21a172},'order':[['id',_0x9bd8('0x3')]],'limit':0x1},'log':_0x9bd8('0x4')});}; \ No newline at end of file +var _0xf482=['UpdateSmsQueueReport','DESC','../client','create','Request','CreateSmsQueueReport','update'];(function(_0x547278,_0x45fe5b){var _0xdb7e9=function(_0x4f557d){while(--_0x4f557d){_0x547278['push'](_0x547278['shift']());}};_0xdb7e9(++_0x45fe5b);}(_0xf482,0xf0));var _0x2f48=function(_0x2003cb,_0x54e34){_0x2003cb=_0x2003cb-0x0;var _0x5c004d=_0xf482[_0x2003cb];return _0x5c004d;};'use strict';var client=require(_0x2f48('0x0'));exports[_0x2f48('0x1')]=function(_0x199c62){return client[_0x2f48('0x2')](_0x2f48('0x3'),{'body':_0x199c62,'log':_0x2f48('0x3')});};exports[_0x2f48('0x4')]=function(_0x5c022c,_0x296174){return client[_0x2f48('0x2')](_0x2f48('0x5'),{'body':_0x296174,'options':{'where':{'uniqueid':_0x5c022c},'order':[['id',_0x2f48('0x6')]],'limit':0x1},'log':_0x2f48('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 365d7a6..d0c12a6 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 _0x4636=['chatPause','mailPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents','GetUser','agent','name','online','pauseType','lastPauseAt'];(function(_0x402282,_0x615de3){var _0x4f65af=function(_0x4a20f7){while(--_0x4a20f7){_0x402282['push'](_0x402282['shift']());}};_0x4f65af(++_0x615de3);}(_0x4636,0x7d));var _0x6463=function(_0x5278e0,_0x151ff9){_0x5278e0=_0x5278e0-0x0;var _0x3bb0af=_0x4636[_0x5278e0];return _0x3bb0af;};'use strict';var client=require(_0x6463('0x0'));exports[_0x6463('0x1')]=function(){return function(){return client['Request'](_0x6463('0x2'),{'options':{'raw':!![],'where':{'role':_0x6463('0x3')},'attributes':['id',_0x6463('0x4'),_0x6463('0x5'),_0x6463('0x6'),_0x6463('0x7'),'voicePause',_0x6463('0x8'),_0x6463('0x9'),'faxPause',_0x6463('0xa'),_0x6463('0xb'),_0x6463('0xc'),_0x6463('0xd'),_0x6463('0xe'),_0x6463('0xf'),_0x6463('0x10'),_0x6463('0x11'),_0x6463('0x12')]},'log':_0x6463('0x1')});};}; \ No newline at end of file +var _0x383d=['GetUser','agent','name','pauseType','lastPauseAt','mailPause','faxPause','whatsappPause','chatCapacity','openchannelCapacity','../client','getAgents'];(function(_0x4810d3,_0x241220){var _0x2c823f=function(_0x3f77a9){while(--_0x3f77a9){_0x4810d3['push'](_0x4810d3['shift']());}};_0x2c823f(++_0x241220);}(_0x383d,0xa6));var _0xd383=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x383d[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xd383('0x0'));exports[_0xd383('0x1')]=function(){return function(){return client['Request'](_0xd383('0x2'),{'options':{'raw':!![],'where':{'role':_0xd383('0x3')},'attributes':['id',_0xd383('0x4'),'online',_0xd383('0x5'),_0xd383('0x6'),'voicePause','chatPause',_0xd383('0x7'),_0xd383('0x8'),'smsPause',_0xd383('0x9'),'openchannelPause',_0xd383('0xa'),'mailCapacity','faxCapacity','smsCapacity','whatsappCapacity',_0xd383('0xb')]},'log':_0xd383('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 206ba34..b115342 100644 --- a/server/services/routing/rpc/whatsappInteraction.js +++ b/server/services/routing/rpc/whatsappInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbbfa=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0xe0c2d9,_0x5ce491){var _0x19730e=function(_0x339fc4){while(--_0x339fc4){_0xe0c2d9['push'](_0xe0c2d9['shift']());}};_0x19730e(++_0x5ce491);}(_0xbbfa,0x1e9));var _0xabbf=function(_0x5d6600,_0x9a9e9b){_0x5d6600=_0x5d6600-0x0;var _0x3c85cc=_0xbbfa[_0x5d6600];return _0x3c85cc;};'use strict';var client=require(_0xabbf('0x0'));exports['update']=function(_0x358e7b,_0x59c76b){return client[_0xabbf('0x1')](_0xabbf('0x2'),{'body':_0x59c76b,'options':{'where':{'id':_0x358e7b}},'log':_0xabbf('0x3')});};exports[_0xabbf('0x4')]=function(_0x30da1f,_0xfd2359){return client[_0xabbf('0x1')](_0xabbf('0x5'),{'body':_0xfd2359,'options':{'where':{'id':_0x30da1f}},'log':_0xabbf('0x6')});}; \ No newline at end of file +var _0x1d5b=['Request','updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','../client','update'];(function(_0x1e9857,_0x537143){var _0x3ec8b1=function(_0x169726){while(--_0x169726){_0x1e9857['push'](_0x1e9857['shift']());}};_0x3ec8b1(++_0x537143);}(_0x1d5b,0x13c));var _0xb1d5=function(_0x280cc8,_0x10b396){_0x280cc8=_0x280cc8-0x0;var _0x46b1a0=_0x1d5b[_0x280cc8];return _0x46b1a0;};'use strict';var client=require(_0xb1d5('0x0'));exports[_0xb1d5('0x1')]=function(_0x1a1089,_0x4a5a6c){return client[_0xb1d5('0x2')]('UpdateWhatsappInteraction',{'body':_0x4a5a6c,'options':{'where':{'id':_0x1a1089}},'log':_0xb1d5('0x3')});};exports[_0xb1d5('0x4')]=function(_0xa12a1e,_0x3ee65c){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x3ee65c,'options':{'where':{'id':_0xa12a1e}},'log':_0xb1d5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index e97aae8..06767f4 100644 --- a/server/services/routing/rpc/whatsappMessage.js +++ b/server/services/routing/rpc/whatsappMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8163=['Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x40ef20,_0x294d44){var _0x415188=function(_0x213549){while(--_0x213549){_0x40ef20['push'](_0x40ef20['shift']());}};_0x415188(++_0x294d44);}(_0x8163,0x15c));var _0x3816=function(_0x29f473,_0xc81f01){_0x29f473=_0x29f473-0x0;var _0x1625cf=_0x8163[_0x29f473];return _0x1625cf;};'use strict';var client=require('../client');exports['create']=function(_0x22e402){return client[_0x3816('0x0')](_0x3816('0x1'),{'body':_0x22e402,'log':_0x3816('0x2')});}; \ No newline at end of file +var _0x98be=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x15f77f,_0x599788){var _0x1f35cc=function(_0x1004b0){while(--_0x1004b0){_0x15f77f['push'](_0x15f77f['shift']());}};_0x1f35cc(++_0x599788);}(_0x98be,0xe2));var _0xe98b=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x98be[_0x40bffc];return _0x3007e9;};'use strict';var client=require(_0xe98b('0x0'));exports[_0xe98b('0x1')]=function(_0x2b3d8a){return client[_0xe98b('0x2')](_0xe98b('0x3'),{'body':_0x2b3d8a,'log':_0xe98b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 6b88cb1..8f4eb54 100644 --- a/server/services/routing/rpc/whatsappQueue.js +++ b/server/services/routing/rpc/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1eba=['Agents','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','User'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0x1eba[_0x541ea6];return _0x3c3e84;};'use strict';var client=require(_0xa1eb('0x0'));exports[_0xa1eb('0x1')]=function(){return function(){return client[_0xa1eb('0x2')](_0xa1eb('0x3'),{'options':{'raw':![],'attributes':['id',_0xa1eb('0x4'),'timeout','strategy'],'include':[{'model':_0xa1eb('0x5'),'as':_0xa1eb('0x6'),'attributes':['id',_0xa1eb('0x4'),_0xa1eb('0x7'),_0xa1eb('0x8')]}]},'log':_0xa1eb('0x1')});};}; \ No newline at end of file +var _0x26f9=['getWhatsappQueues','GetWhatsappQueue','strategy','User','name','online','whatsappPause','../client'];(function(_0x13b7fd,_0x4eaf7f){var _0x32a74a=function(_0x2c5d80){while(--_0x2c5d80){_0x13b7fd['push'](_0x13b7fd['shift']());}};_0x32a74a(++_0x4eaf7f);}(_0x26f9,0x16f));var _0x926f=function(_0x26a810,_0x247776){_0x26a810=_0x26a810-0x0;var _0x4758a3=_0x26f9[_0x26a810];return _0x4758a3;};'use strict';var client=require(_0x926f('0x0'));exports[_0x926f('0x1')]=function(){return function(){return client['Request'](_0x926f('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x926f('0x3')],'include':[{'model':_0x926f('0x4'),'as':'Agents','attributes':['id',_0x926f('0x5'),_0x926f('0x6'),_0x926f('0x7')]}]},'log':_0x926f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index fdaf23a..4182469 100644 --- a/server/services/routing/rpc/whatsappQueueReport.js +++ b/server/services/routing/rpc/whatsappQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0eaf=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x0eaf,0x1ef));var _0xf0ea=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0eaf[_0x2641f9];return _0x585741;};'use strict';var client=require(_0xf0ea('0x0'));exports[_0xf0ea('0x1')]=function(_0x5de708){return client[_0xf0ea('0x2')](_0xf0ea('0x3'),{'body':_0x5de708,'log':_0xf0ea('0x3')});};exports[_0xf0ea('0x4')]=function(_0x10d9e0,_0x4953c2){return client[_0xf0ea('0x2')](_0xf0ea('0x5'),{'body':_0x4953c2,'options':{'where':{'uniqueid':_0x10d9e0},'order':[['id',_0xf0ea('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x1cb8=['UpdateWhatsappQueueReport','DESC','create','CreateWhatsappQueueReport','update','Request'];(function(_0xa3c024,_0x275fc3){var _0x3c1b58=function(_0x3cdde7){while(--_0x3cdde7){_0xa3c024['push'](_0xa3c024['shift']());}};_0x3c1b58(++_0x275fc3);}(_0x1cb8,0x14c));var _0x81cb=function(_0x1b6fe1,_0x21bb65){_0x1b6fe1=_0x1b6fe1-0x0;var _0x307e9b=_0x1cb8[_0x1b6fe1];return _0x307e9b;};'use strict';var client=require('../client');exports[_0x81cb('0x0')]=function(_0x135d26){return client['Request'](_0x81cb('0x1'),{'body':_0x135d26,'log':_0x81cb('0x1')});};exports[_0x81cb('0x2')]=function(_0x4bd9a3,_0x4bdbde){return client[_0x81cb('0x3')](_0x81cb('0x4'),{'body':_0x4bdbde,'options':{'where':{'uniqueid':_0x4bd9a3},'order':[['id',_0x81cb('0x5')]],'limit':0x1},'log':_0x81cb('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 292577c..c3eea2d 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 _0x399d=['START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','[%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','number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','message','join','stop','find','agents','timeout','createQueue','atimeout','channel'];(function(_0x1e47a9,_0x29346d){var _0x1001ef=function(_0x457dda){while(--_0x457dda){_0x1e47a9['push'](_0x1e47a9['shift']());}};_0x1001ef(++_0x29346d);}(_0x399d,0x1d6));var _0xd399=function(_0x31d997,_0x290fc9){_0x31d997=_0x31d997-0x0;var _0x2a948e=_0x399d[_0x31d997];return _0x2a948e;};'use strict';var schema=require(_0xd399('0x0'));var _=require(_0xd399('0x1'));var util=require('util');var seqqueue=require(_0xd399('0x2'));var logger=require(_0xd399('0x3'))(_0xd399('0x4'));var strategy=require(_0xd399('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xd399('0x6')},'timeout':{'type':_0xd399('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x3b6798,_0x331846,_0x11c0f6){return logger[_0xd399('0x8')](util['format'](_0xd399('0x9'),_0x3b6798,_0x331846[_0xd399('0xa')],_0x11c0f6));}function handleFindAgent(_0x5eab01){return function(_0xf25019){return _0xf25019[_0xd399('0xa')][_0xd399('0xb')]()===_0x5eab01[_0xd399('0xb')]();};}exports[_0xd399('0xc')]=function(_0x40abcb,_0x53f466,_0x386acd,_0x3f2d8c){return function(_0x5c8d56){try{var _0x227ecd={'name':_0x53f466[0x0],'timeout':_0x53f466[0x1]};var _0x284628=queue[_0xd399('0x0')](_0x227ecd,{'typecast':!![]});if(_0x284628[_0xd399('0xd')]){logger['error'](_0xd399('0xe'),_0x40abcb,_['map'](_0x284628,_0xd399('0xf'))[_0xd399('0x10')](',\x20'));_0x5c8d56[_0xd399('0x11')]();}else{var _0x1c7ded=_[_0xd399('0x12')](_0x386acd[_0xd399('0x13')],handleFindAgent(_0x227ecd[_0xd399('0xa')]));if(_0x1c7ded){var _0xc91f83=(_0x227ecd[_0xd399('0x14')]||0xa)*0x3e8;var _0x171aa8,_0x32dcc3;var _0x4727e1=seqqueue[_0xd399('0x15')](_0xc91f83);_0x4727e1['id']=_0x40abcb;_0x4727e1[_0xd399('0x16')]=_0xc91f83;_0x4727e1[_0xd399('0x17')]=_0x3f2d8c[_0xd399('0x17')];writeLog(_0x40abcb,_0x1c7ded,util['format'](_0xd399('0x18'),_0xc91f83));_0x386acd[_0xd399('0x19')][_0x40abcb]['on'](_0xd399('0x1a'),function(){logger[_0xd399('0x8')](_0xd399('0x1b'),_0x40abcb);clearTimeout(_0x32dcc3);_0x32dcc3=undefined;_0x4727e1[_0xd399('0x1c')]();if(_0x386acd['rules'][_0x40abcb]){delete _0x386acd[_0xd399('0x19')][_0x40abcb];}_0x5c8d56[_0xd399('0x11')]();});_0x386acd[_0xd399('0x19')][_0x40abcb]['on'](_0xd399('0x1d'),function(){if(_0x386acd[_0xd399('0x19')][_0x40abcb]){delete _0x386acd['rules'][_0x40abcb];}});_0x32dcc3=setTimeout(function(){logger[_0xd399('0x8')](_0xd399('0x1e'),_0x40abcb);clearTimeout(_0x32dcc3);_0x4727e1[_0xd399('0x1c')]();_0x5c8d56[_0xd399('0x1f')]();},_0xc91f83);strategy[_0xd399('0x20')](_0x4727e1,_0x1c7ded,_0x386acd,_0x3f2d8c);}else{logger[_0xd399('0x21')](_0xd399('0x22'),_0x40abcb,_0x227ecd['name']);_0x5c8d56['stop']();}}}catch(_0x3ffe81){console[_0xd399('0x23')](_0x3ffe81);logger[_0xd399('0x21')](_0xd399('0x24'),_0x40abcb,_0x3ffe81[_0xd399('0x25')]);_0x5c8d56[_0xd399('0x11')]();}};}; \ No newline at end of file +var _0x9d36=['string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','message','join','stop','find','agents','timeout','channel','end','close','rules','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','./strategy'];(function(_0x183256,_0x1a596d){var _0x5394a2=function(_0x192025){while(--_0x192025){_0x183256['push'](_0x183256['shift']());}};_0x5394a2(++_0x1a596d);}(_0x9d36,0x1b5));var _0x69d3=function(_0x1aab89,_0x1c9d54){_0x1aab89=_0x1aab89-0x0;var _0x168bc0=_0x9d36[_0x1aab89];return _0x168bc0;};'use strict';var schema=require('validate');var _=require(_0x69d3('0x0'));var util=require(_0x69d3('0x1'));var seqqueue=require(_0x69d3('0x2'));var logger=require(_0x69d3('0x3'))('routing');var strategy=require(_0x69d3('0x4'));var queue=schema({'name':{'type':_0x69d3('0x5'),'required':!![],'message':_0x69d3('0x6')},'timeout':{'type':_0x69d3('0x7'),'message':_0x69d3('0x8')}});function writeLog(_0x20cbd1,_0x449fd6,_0x51abef){return logger[_0x69d3('0x9')](util[_0x69d3('0xa')](_0x69d3('0xb'),_0x20cbd1,_0x449fd6[_0x69d3('0xc')],_0x51abef));}function handleFindAgent(_0x1e885e){return function(_0xa0dde1){return _0xa0dde1[_0x69d3('0xc')][_0x69d3('0xd')]()===_0x1e885e[_0x69d3('0xd')]();};}exports[_0x69d3('0xe')]=function(_0x4ca6bb,_0x57af44,_0x4d642b,_0xf4f80e){return function(_0x20325b){try{var _0x433c15={'name':_0x57af44[0x0],'timeout':_0x57af44[0x1]};var _0x37ab30=queue['validate'](_0x433c15,{'typecast':!![]});if(_0x37ab30[_0x69d3('0xf')]){logger['error'](_0x69d3('0x10'),_0x4ca6bb,_['map'](_0x37ab30,_0x69d3('0x11'))[_0x69d3('0x12')](',\x20'));_0x20325b[_0x69d3('0x13')]();}else{var _0x1c3b7d=_[_0x69d3('0x14')](_0x4d642b[_0x69d3('0x15')],handleFindAgent(_0x433c15[_0x69d3('0xc')]));if(_0x1c3b7d){var _0xbbc693=(_0x433c15[_0x69d3('0x16')]||0xa)*0x3e8;var _0x3093fd,_0x1d44e3;var _0x3fc0d1=seqqueue['createQueue'](_0xbbc693);_0x3fc0d1['id']=_0x4ca6bb;_0x3fc0d1['atimeout']=_0xbbc693;_0x3fc0d1[_0x69d3('0x17')]=_0xf4f80e[_0x69d3('0x17')];writeLog(_0x4ca6bb,_0x1c3b7d,util[_0x69d3('0xa')]('START:%s',_0xbbc693));_0x4d642b['rules'][_0x4ca6bb]['on'](_0x69d3('0x18'),function(){logger[_0x69d3('0x9')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x4ca6bb);clearTimeout(_0x1d44e3);_0x1d44e3=undefined;_0x3fc0d1[_0x69d3('0x19')]();if(_0x4d642b[_0x69d3('0x1a')][_0x4ca6bb]){delete _0x4d642b[_0x69d3('0x1a')][_0x4ca6bb];}_0x20325b[_0x69d3('0x13')]();});_0x4d642b[_0x69d3('0x1a')][_0x4ca6bb]['on']('complete',function(){if(_0x4d642b[_0x69d3('0x1a')][_0x4ca6bb]){delete _0x4d642b[_0x69d3('0x1a')][_0x4ca6bb];}});_0x1d44e3=setTimeout(function(){logger[_0x69d3('0x9')](_0x69d3('0x1b'),_0x4ca6bb);clearTimeout(_0x1d44e3);_0x3fc0d1[_0x69d3('0x19')]();_0x20325b[_0x69d3('0x1c')]();},_0xbbc693);strategy[_0x69d3('0x1d')](_0x3fc0d1,_0x1c3b7d,_0x4d642b,_0xf4f80e);}else{logger[_0x69d3('0x1e')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x4ca6bb,_0x433c15['name']);_0x20325b[_0x69d3('0x13')]();}}}catch(_0x1d0b4b){console[_0x69d3('0x1f')](_0x1d0b4b);logger[_0x69d3('0x1e')](_0x69d3('0x20'),_0x4ca6bb,_0x1d0b4b[_0x69d3('0x21')]);_0x20325b[_0x69d3('0x13')]();}};}; \ 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 c31511f..f819b12 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 _0xa159=['InteractionId','created','isEmpty','getMustacheRender','Message','create','then','body','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','amazonlex','providerName','providerResponse','Failed','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId'];(function(_0x31b2d3,_0x2a787){var _0x583cfc=function(_0x12a86d){while(--_0x12a86d){_0x31b2d3['push'](_0x31b2d3['shift']());}};_0x583cfc(++_0x2a787);}(_0xa159,0xa9));var _0x9a15=function(_0x372344,_0x20fbc6){_0x372344=_0x372344-0x0;var _0x39ffef=_0xa159[_0x372344];return _0x39ffef;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require(_0x9a15('0x0'));var utils=require(_0x9a15('0x1'));var logger=require(_0x9a15('0x2'))('routing');var rpc={'chatMessage':require(_0x9a15('0x3')),'openchannelMessage':require(_0x9a15('0x4')),'mailMessage':require(_0x9a15('0x5')),'smsMessage':require(_0x9a15('0x6')),'faxMessage':require(_0x9a15('0x7')),'whatsappMessage':require(_0x9a15('0x8'))};exports[_0x9a15('0x9')]=function(_0x4d6765,_0x1e1488){return function(_0x48d435){try{if(!_[_0x9a15('0xa')](this[_0x9a15('0xb')]['UserId'])){logger[_0x9a15('0xc')](_0x9a15('0xd'),_0x4d6765,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x48d435[_0x9a15('0xe')]();}var _0x597c10={'ContactId':this[_0x9a15('0xf')]['id'],'sentAt':moment()[_0x9a15('0x10')](_0x9a15('0x11')),'direction':_0x9a15('0x12')};if(this[_0x9a15('0x13')]===_0x9a15('0x14')||this[_0x9a15('0x13')]===_0x9a15('0x15')){_0x597c10[_0x9a15('0x16')]=this[_0x9a15('0xb')][_0x9a15('0x16')];}var _0x125a72=this[_0x9a15('0x13')];if(_0x125a72==='chat'){_0x597c10[_0x9a15('0x17')]=this[_0x9a15('0x18')]['id'];}else{_0x597c10[_[_0x9a15('0x19')](_0x125a72)+_0x9a15('0x1a')]=this[_0x9a15('0x18')]['id'];}_0x597c10[_[_0x9a15('0x19')](_0x125a72)+_0x9a15('0x1b')]=this[_0x9a15('0xb')]['id'];if(this[_0x9a15('0xb')][_0x9a15('0x1c')]){var _0xbfe823=_0x1e1488[0x4];if(!_[_0x9a15('0x1d')](_0xbfe823)){_0x597c10['body']=utils[_0x9a15('0x1e')](_0xbfe823,this);return rpc[_0x125a72+_0x9a15('0x1f')][_0x9a15('0x20')](_0x597c10)[_0x9a15('0x21')](function(_0x1e95ef){logger[_0x9a15('0xc')](_0x9a15('0xd'),_0x4d6765,_0x597c10[_0x9a15('0x22')]);})[_0x9a15('0x23')](function(_0x50b6dd){logger[_0x9a15('0x24')](_0x9a15('0xd'),_0x4d6765,JSON[_0x9a15('0x25')](_0x50b6dd));})[_0x9a15('0x26')](function(){logger['info'](_0x9a15('0x27'),_0x4d6765);_0x48d435[_0x9a15('0x28')]();});}else{logger[_0x9a15('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x4d6765);_0x48d435[_0x9a15('0x28')]();}}else{var _0x498746=this;var _0x2b1ea2=new AWS[(_0x9a15('0x29'))]({'accessKeyId':_0x1e1488[0x0],'secretAccessKey':_0x1e1488[0x1],'region':_0x1e1488[0x2]});var _0x52a6e5={'botAlias':_0x9a15('0x2a'),'botName':_0x1e1488[0x3],'inputText':this[_0x9a15('0x2b')][_0x9a15('0x22')],'userId':this[_0x9a15('0x13')]+':'+this['interaction']['id'][_0x9a15('0x2c')]()};_0x2b1ea2['postText'](_0x52a6e5,function(_0x3216b0,_0x2ed484){if(_0x3216b0){logger[_0x9a15('0x24')](_0x9a15('0xd'),_0x4d6765,_0x3216b0[_0x9a15('0x2b')]);_0x48d435[_0x9a15('0xe')]();}else if(_0x2ed484&&_0x2ed484['message']){_0x498746[_0x9a15('0x22')][_0x9a15('0x2d')]=_0x2ed484;_0x597c10['body']=_0x2ed484[_0x9a15('0x2b')];_0x597c10[_0x9a15('0x2e')]='amazonlex';_0x597c10[_0x9a15('0x2f')]=JSON[_0x9a15('0x25')](_0x2ed484);return rpc[_0x125a72+'Message']['create'](_0x597c10)[_0x9a15('0x21')](function(_0x2dc356){logger[_0x9a15('0xc')](_0x9a15('0xd'),_0x4d6765,_0x597c10[_0x9a15('0x22')]);if(_0x2ed484['dialogState']==_0x9a15('0x30')){_0x48d435[_0x9a15('0xe')]();}else{_0x48d435[_0x9a15('0x28')]();}})[_0x9a15('0x23')](function(_0x2be247){logger['error'](_0x9a15('0xd'),_0x4d6765,JSON[_0x9a15('0x25')](_0x2be247));_0x48d435[_0x9a15('0xe')]();});}else{_0x48d435['next']();}});}}catch(_0x28d172){logger[_0x9a15('0x24')](_0x9a15('0xd'),_0x4d6765,JSON[_0x9a15('0x25')](_0x28d172));_0x48d435[_0x9a15('0x28')]();}};}; \ No newline at end of file +var _0xdb03=['amazonlex','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','interaction','chat','ChatWebsiteId','account','upperFirst','created','isEmpty','body','Message','[%s][AMAZONLEX]\x20%s','catch','error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','toString','postText','message','providerName'];(function(_0x4acf6f,_0x5072e5){var _0x3c6d3a=function(_0x4c72a6){while(--_0x4c72a6){_0x4acf6f['push'](_0x4acf6f['shift']());}};_0x3c6d3a(++_0x5072e5);}(_0xdb03,0x10a));var _0x3db0=function(_0x26cba5,_0x1a63b0){_0x26cba5=_0x26cba5-0x0;var _0x21dff3=_0xdb03[_0x26cba5];return _0x21dff3;};'use strict';var _=require(_0x3db0('0x0'));var moment=require(_0x3db0('0x1'));var AWS=require(_0x3db0('0x2'));var utils=require(_0x3db0('0x3'));var logger=require(_0x3db0('0x4'))(_0x3db0('0x5'));var rpc={'chatMessage':require(_0x3db0('0x6')),'openchannelMessage':require(_0x3db0('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x3db0('0x8')),'faxMessage':require(_0x3db0('0x9')),'whatsappMessage':require(_0x3db0('0xa'))};exports[_0x3db0('0xb')]=function(_0x39bcb9,_0x4d822d){return function(_0x677c7d){try{if(!_[_0x3db0('0xc')](this['interaction'][_0x3db0('0xd')])){logger[_0x3db0('0xe')]('[%s][AMAZONLEX]\x20%s',_0x39bcb9,_0x3db0('0xf'));return _0x677c7d[_0x3db0('0x10')]();}var _0x23c4e1={'ContactId':this['contact']['id'],'sentAt':moment()[_0x3db0('0x11')](_0x3db0('0x12')),'direction':'out'};if(this[_0x3db0('0x13')]===_0x3db0('0x14')||this[_0x3db0('0x13')]==='whatsapp'){_0x23c4e1['phone']=this[_0x3db0('0x15')]['phone'];}var _0xa3e889=this[_0x3db0('0x13')];if(_0xa3e889===_0x3db0('0x16')){_0x23c4e1[_0x3db0('0x17')]=this[_0x3db0('0x18')]['id'];}else{_0x23c4e1[_[_0x3db0('0x19')](_0xa3e889)+'AccountId']=this[_0x3db0('0x18')]['id'];}_0x23c4e1[_['upperFirst'](_0xa3e889)+'InteractionId']=this[_0x3db0('0x15')]['id'];if(this['interaction'][_0x3db0('0x1a')]){var _0x1f908b=_0x4d822d[0x4];if(!_[_0x3db0('0x1b')](_0x1f908b)){_0x23c4e1[_0x3db0('0x1c')]=utils['getMustacheRender'](_0x1f908b,this);return rpc[_0xa3e889+_0x3db0('0x1d')]['create'](_0x23c4e1)['then'](function(_0xd7eef9){logger[_0x3db0('0xe')](_0x3db0('0x1e'),_0x39bcb9,_0x23c4e1[_0x3db0('0x1c')]);})[_0x3db0('0x1f')](function(_0x1a3bc0){logger[_0x3db0('0x20')]('[%s][AMAZONLEX]\x20%s',_0x39bcb9,JSON[_0x3db0('0x21')](_0x1a3bc0));})[_0x3db0('0x22')](function(){logger[_0x3db0('0xe')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x39bcb9);_0x677c7d[_0x3db0('0x23')]();});}else{logger[_0x3db0('0xe')](_0x3db0('0x24'),_0x39bcb9);_0x677c7d['stop']();}}else{var _0x3848bd=this;var _0x2b4100=new AWS['LexRuntime']({'accessKeyId':_0x4d822d[0x0],'secretAccessKey':_0x4d822d[0x1],'region':_0x4d822d[0x2]});var _0x2010fe={'botAlias':_0x3db0('0x25'),'botName':_0x4d822d[0x3],'inputText':this['message']['body'],'userId':this[_0x3db0('0x13')]+':'+this[_0x3db0('0x15')]['id'][_0x3db0('0x26')]()};_0x2b4100[_0x3db0('0x27')](_0x2010fe,function(_0xbdf588,_0x57923d){if(_0xbdf588){logger['error']('[%s][AMAZONLEX]\x20%s',_0x39bcb9,_0xbdf588['message']);_0x677c7d[_0x3db0('0x10')]();}else if(_0x57923d&&_0x57923d[_0x3db0('0x28')]){_0x3848bd[_0x3db0('0x1c')]['amazonlex']=_0x57923d;_0x23c4e1[_0x3db0('0x1c')]=_0x57923d['message'];_0x23c4e1[_0x3db0('0x29')]=_0x3db0('0x2a');_0x23c4e1['providerResponse']=JSON[_0x3db0('0x21')](_0x57923d);return rpc[_0xa3e889+_0x3db0('0x1d')]['create'](_0x23c4e1)['then'](function(_0x495a75){logger['info'](_0x3db0('0x1e'),_0x39bcb9,_0x23c4e1[_0x3db0('0x1c')]);if(_0x57923d['dialogState']==_0x3db0('0x2b')){_0x677c7d[_0x3db0('0x10')]();}else{_0x677c7d[_0x3db0('0x23')]();}})[_0x3db0('0x1f')](function(_0x359a42){logger[_0x3db0('0x20')]('[%s][AMAZONLEX]\x20%s',_0x39bcb9,JSON[_0x3db0('0x21')](_0x359a42));_0x677c7d[_0x3db0('0x10')]();});}else{_0x677c7d[_0x3db0('0x10')]();}});}}catch(_0x175903){logger[_0x3db0('0x20')](_0x3db0('0x1e'),_0x39bcb9,JSON[_0x3db0('0x21')](_0x175903));_0x677c7d[_0x3db0('0x23')]();}};}; \ 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 3e524dc..7136e3d 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 _0x1751=['isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','mail','body','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','Smtp','service','host','port','authentication','auth','user','messageId','','replace','','auto-replied','All','auto_reply','sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','then','finally','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence'];(function(_0x5bc075,_0x8785d9){var _0x4e2c63=function(_0x3790c8){while(--_0x3790c8){_0x5bc075['push'](_0x5bc075['shift']());}};_0x4e2c63(++_0x8785d9);}(_0x1751,0x76));var _0x1175=function(_0x44c086,_0x14d0db){_0x44c086=_0x44c086-0x0;var _0x16d669=_0x1751[_0x44c086];return _0x16d669;};'use strict';var _=require(_0x1175('0x0'));var moment=require(_0x1175('0x1'));var utils=require(_0x1175('0x2'));var logger=require(_0x1175('0x3'))('routing');var rpc={'chatMessage':require(_0x1175('0x4')),'openchannelMessage':require(_0x1175('0x5')),'mailMessage':require(_0x1175('0x6')),'smsMessage':require(_0x1175('0x7')),'faxMessage':require(_0x1175('0x8')),'whatsappMessage':require(_0x1175('0x9'))};var mailRpc=require(_0x1175('0xa'));exports[_0x1175('0xb')]=function(_0x3f99ca,_0x3300e9){return function(_0x403f1a){try{if(_0x3300e9[0x0]==='1'&&(_[_0x1175('0xc')](this[_0x1175('0xd')][_0x1175('0xe')])||!this[_0x1175('0xd')][_0x1175('0xe')])){logger[_0x1175('0xf')](_0x1175('0x10'),_0x3f99ca,_0x1175('0x11'));return _0x403f1a[_0x1175('0x12')]();}var _0x18f221=this[_0x1175('0x13')];var _0x1b146f={'ContactId':this[_0x1175('0x14')]['id'],'sentAt':moment()[_0x1175('0x15')](_0x1175('0x16')),'direction':'out'};if(this['channel']===_0x1175('0x17')){_0x1b146f[_0x1175('0x18')]=utils['getMustacheRender'](_0x3300e9[0x2],this);}else{_0x1b146f[_0x1175('0x18')]=utils[_0x1175('0x19')](_0x3300e9[0x1],this);}if(this[_0x1175('0x1a')]){_0x1b146f['to']=this['message'][_0x1175('0x1b')]||'';if(this[_0x1175('0x13')]===_0x1175('0x17')&&_0x3300e9[0x1]==='1'){_0x1b146f['cc']=this['message']['cc']||'';}_0x1b146f[_0x1175('0x1b')]=this['message']['to']||'';_0x1b146f[_0x1175('0x1c')]=this[_0x1175('0x1a')][_0x1175('0x1c')]||'';_0x1b146f[_0x1175('0x1d')]=!![];if(this['message'][_0x1175('0x1e')]){_0x1b146f[_0x1175('0x1e')]='';_0x1b146f['subject']+=_['startsWith'](this[_0x1175('0x1a')][_0x1175('0x1e')],_0x1175('0x1f'))?'':_0x1175('0x20');_0x1b146f[_0x1175('0x1e')]+=this['message'][_0x1175('0x1e')];}}if(this[_0x1175('0x13')]===_0x1175('0x21')){_0x1b146f[_0x1175('0x22')]=this[_0x1175('0x23')]['id'];}else{_0x1b146f[_[_0x1175('0x24')](this['channel'])+'AccountId']=this[_0x1175('0x23')]['id'];}_0x1b146f[_[_0x1175('0x24')](this[_0x1175('0x13')])+_0x1175('0x25')]=this[_0x1175('0xd')]['id'];if(rpc[this[_0x1175('0x13')]+_0x1175('0x26')]){if(this['channel']===_0x1175('0x17')){var _0xd73499={'tls':{'rejectUnauthorized':![]}};if(this[_0x1175('0x23')][_0x1175('0x27')][_0x1175('0x28')]){_0xd73499[_0x1175('0x28')]=this[_0x1175('0x23')][_0x1175('0x27')][_0x1175('0x28')];}else{_0xd73499[_0x1175('0x29')]=this[_0x1175('0x23')]['Smtp']['host'];_0xd73499['port']=this[_0x1175('0x23')][_0x1175('0x27')][_0x1175('0x2a')];_0xd73499['secure']=this['account']['Smtp']['secure'];}if(this[_0x1175('0x23')][_0x1175('0x27')][_0x1175('0x2b')]){_0xd73499[_0x1175('0x2c')]={'user':this['account']['Smtp'][_0x1175('0x2d')],'pass':this[_0x1175('0x23')]['Smtp']['pass']};}_0x1b146f['inReplyTo']=this[_0x1175('0x1a')][_0x1175('0x2e')];_0x1b146f['html']=_0x1175('0x2f')+_[_0x1175('0x30')](_0x1b146f[_0x1175('0x18')],_0x1175('0x31'),_0x1175('0x32'))+_0x1175('0x33');_0x1b146f['headers']={'Auto-Submitted':_0x1175('0x34'),'X-Auto-Response-Suppress':_0x1175('0x35'),'Precedence':_0x1175('0x36')};return mailRpc[_0x1175('0x37')](_0xd73499,_0x1b146f)['then'](function(_0x12f70d){logger['info'](_0x1175('0x38'),_0x3f99ca);_0x1b146f[_0x1175('0x2e')]=_0x12f70d[_0x1175('0x1a')][_0x1175('0x2e')];return rpc[_0x18f221+_0x1175('0x26')][_0x1175('0x39')](_0x1b146f);})['then'](function(_0x49ed96){logger['info'](_0x1175('0x10'),_0x3f99ca,JSON[_0x1175('0x3a')](_0x49ed96));})[_0x1175('0x3b')](function(_0x40d809){logger[_0x1175('0x3c')](_0x1175('0x3d'),_0x3f99ca,JSON['stringify'](_0x40d809));})['finally'](function(){_0x403f1a[_0x1175('0x12')]();});}else{return rpc[this[_0x1175('0x13')]+_0x1175('0x26')]['create'](_0x1b146f)[_0x1175('0x3e')](function(_0x3c4351){logger[_0x1175('0xf')]('[%s][AUTOREPLY]\x20%s',_0x3f99ca,_0x1b146f['body']);})[_0x1175('0x3b')](function(_0x177715){logger['error'](_0x1175('0x10'),_0x3f99ca,JSON[_0x1175('0x3a')](_0x177715));})[_0x1175('0x3f')](function(){_0x403f1a[_0x1175('0x12')]();});}}}catch(_0x1e7b4a){logger[_0x1175('0x3c')](_0x1175('0x10'),_0x3f99ca,JSON[_0x1175('0x3a')](_0x1e7b4a));_0x403f1a[_0x1175('0x40')]();}};}; \ No newline at end of file +var _0x85e6=['','headers','auto-replied','All','auto_reply','then','info','Message','create','stringify','[RPC][%s][AUTOREPLY]\x20%s','finally','error','stop','lodash','moment','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','next','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','body','getMustacheRender','message','from','phone','read','subject','startsWith','chat','account','upperFirst','service','Smtp','host','port','secure','authentication','auth','pass','inReplyTo','messageId','html','replace'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x85e6,0x1a5));var _0x685e=function(_0x450500,_0x422687){_0x450500=_0x450500-0x0;var _0x710ab7=_0x85e6[_0x450500];return _0x710ab7;};'use strict';var _=require(_0x685e('0x0'));var moment=require(_0x685e('0x1'));var utils=require('./utils');var logger=require(_0x685e('0x2'))(_0x685e('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x685e('0x4')),'mailMessage':require(_0x685e('0x5')),'smsMessage':require(_0x685e('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x685e('0x7'))};var mailRpc=require('../../mailRpc');exports[_0x685e('0x8')]=function(_0x41f13f,_0x3cde2c){return function(_0x55e0de){try{if(_0x3cde2c[0x0]==='1'&&(_[_0x685e('0x9')](this[_0x685e('0xa')][_0x685e('0xb')])||!this[_0x685e('0xa')][_0x685e('0xb')])){logger['info'](_0x685e('0xc'),_0x41f13f,'Autoreply\x20already\x20sent');return _0x55e0de[_0x685e('0xd')]();}var _0x4c0df1=this[_0x685e('0xe')];var _0xfc5a40={'ContactId':this[_0x685e('0xf')]['id'],'sentAt':moment()[_0x685e('0x10')](_0x685e('0x11')),'direction':_0x685e('0x12')};if(this[_0x685e('0xe')]===_0x685e('0x13')){_0xfc5a40[_0x685e('0x14')]=utils[_0x685e('0x15')](_0x3cde2c[0x2],this);}else{_0xfc5a40[_0x685e('0x14')]=utils[_0x685e('0x15')](_0x3cde2c[0x1],this);}if(this[_0x685e('0x16')]){_0xfc5a40['to']=this[_0x685e('0x16')][_0x685e('0x17')]||'';if(this[_0x685e('0xe')]==='mail'&&_0x3cde2c[0x1]==='1'){_0xfc5a40['cc']=this[_0x685e('0x16')]['cc']||'';}_0xfc5a40[_0x685e('0x17')]=this[_0x685e('0x16')]['to']||'';_0xfc5a40[_0x685e('0x18')]=this[_0x685e('0x16')]['phone']||'';_0xfc5a40[_0x685e('0x19')]=!![];if(this[_0x685e('0x16')][_0x685e('0x1a')]){_0xfc5a40[_0x685e('0x1a')]='';_0xfc5a40[_0x685e('0x1a')]+=_[_0x685e('0x1b')](this['message'][_0x685e('0x1a')],'Re:')?'':'Re:\x20';_0xfc5a40[_0x685e('0x1a')]+=this[_0x685e('0x16')][_0x685e('0x1a')];}}if(this[_0x685e('0xe')]===_0x685e('0x1c')){_0xfc5a40['ChatWebsiteId']=this[_0x685e('0x1d')]['id'];}else{_0xfc5a40[_[_0x685e('0x1e')](this[_0x685e('0xe')])+'AccountId']=this[_0x685e('0x1d')]['id'];}_0xfc5a40[_['upperFirst'](this[_0x685e('0xe')])+'InteractionId']=this[_0x685e('0xa')]['id'];if(rpc[this[_0x685e('0xe')]+'Message']){if(this[_0x685e('0xe')]===_0x685e('0x13')){var _0x3f55a6={'tls':{'rejectUnauthorized':![]}};if(this[_0x685e('0x1d')]['Smtp'][_0x685e('0x1f')]){_0x3f55a6[_0x685e('0x1f')]=this[_0x685e('0x1d')][_0x685e('0x20')][_0x685e('0x1f')];}else{_0x3f55a6[_0x685e('0x21')]=this[_0x685e('0x1d')][_0x685e('0x20')]['host'];_0x3f55a6['port']=this[_0x685e('0x1d')][_0x685e('0x20')][_0x685e('0x22')];_0x3f55a6[_0x685e('0x23')]=this['account'][_0x685e('0x20')][_0x685e('0x23')];}if(this[_0x685e('0x1d')]['Smtp'][_0x685e('0x24')]){_0x3f55a6[_0x685e('0x25')]={'user':this[_0x685e('0x1d')][_0x685e('0x20')]['user'],'pass':this[_0x685e('0x1d')][_0x685e('0x20')][_0x685e('0x26')]};}_0xfc5a40[_0x685e('0x27')]=this['message'][_0x685e('0x28')];_0xfc5a40[_0x685e('0x29')]=''+_[_0x685e('0x2a')](_0xfc5a40[_0x685e('0x14')],_0x685e('0x2b'),']+(>|$)/g,''),'priorityTrue':_0x1d938d[0x1],'priorityFalse':_0x1d938d[0x2]};var _0x152a30=gotoif[_0x7061('0xd')](_0x1564cb,{'typecast':!![]});if(_0x152a30['length']){logger[_0x7061('0xe')]('[%s][GOTOIF]\x20%s',_0x83bdb7,_[_0x7061('0xf')](_0x152a30,_0x7061('0x10'))['join'](',\x20'));_0x53b658[_0x7061('0x11')]();}else{try{var _0x128b9f=eval('('+_0x1564cb[_0x7061('0x12')]+')');var _0x199e5a=_0x128b9f?_0x1564cb['priorityTrue']:_0x1564cb[_0x7061('0x13')];logger[_0x7061('0x14')](_0x7061('0x15'),_0x83bdb7,_0x1564cb[_0x7061('0x12')],_0x128b9f,_0x199e5a||'next');if(_0x199e5a){var _0x49ac11=_[_0x7061('0x16')](_0x53b658[_0x7061('0x17')](),{'p':_0x199e5a});if(_0x49ac11>=0x0){logger['info'](_0x7061('0x18'),_0x83bdb7,_0x199e5a||_0x7061('0x19'),_0x49ac11);_0x53b658[_0x7061('0x19')](_0x49ac11);}else{logger[_0x7061('0x14')](_0x7061('0x1a'),_0x83bdb7,_0x199e5a||_0x7061('0x19'));_0x53b658[_0x7061('0x11')]();}}else{_0x53b658[_0x7061('0x19')]();}}catch(_0x519b04){logger[_0x7061('0xe')](_0x7061('0x1b'),_0x83bdb7,_0x519b04['message']);_0x53b658[_0x7061('0x11')]();}}}catch(_0x403b3a){logger[_0x7061('0xe')](_0x7061('0x1c'),_0x83bdb7,JSON['stringify'](_0x403b3a));_0x53b658['stop']();}};}; \ No newline at end of file +var _0x7b97=['condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','length','error','[%s][GOTOIF]\x20%s','map','message','stop'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7b97,0x67));var _0x77b9=function(_0x242566,_0x4ec88d){_0x242566=_0x242566-0x0;var _0x1bc410=_0x7b97[_0x242566];return _0x1bc410;};'use strict';var schema=require('validate');var _=require(_0x77b9('0x0'));var htmlToText=require(_0x77b9('0x1'));var utils=require(_0x77b9('0x2'));var logger=require(_0x77b9('0x3'))(_0x77b9('0x4'));var gotoif=schema({'condition':{'type':_0x77b9('0x5'),'required':!![],'message':_0x77b9('0x6')},'priorityTrue':{'type':_0x77b9('0x7'),'message':_0x77b9('0x8')},'priorityFalse':{'type':'number','message':_0x77b9('0x9')}});exports[_0x77b9('0xa')]=function(_0x3c92df,_0x3d0ca8){return function(_0x4fd0e4){try{var _0x483236={'condition':htmlToText[_0x77b9('0xb')](utils[_0x77b9('0xc')](_0x3d0ca8[0x0],this),{'wordwrap':![]})[_0x77b9('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3d0ca8[0x1],'priorityFalse':_0x3d0ca8[0x2]};var _0x53fca9=gotoif[_0x77b9('0xe')](_0x483236,{'typecast':!![]});if(_0x53fca9[_0x77b9('0xf')]){logger[_0x77b9('0x10')](_0x77b9('0x11'),_0x3c92df,_[_0x77b9('0x12')](_0x53fca9,_0x77b9('0x13'))['join'](',\x20'));_0x4fd0e4[_0x77b9('0x14')]();}else{try{var _0x56cb33=eval('('+_0x483236[_0x77b9('0x15')]+')');var _0x39fe25=_0x56cb33?_0x483236['priorityTrue']:_0x483236[_0x77b9('0x16')];logger[_0x77b9('0x17')](_0x77b9('0x18'),_0x3c92df,_0x483236[_0x77b9('0x15')],_0x56cb33,_0x39fe25||_0x77b9('0x19'));if(_0x39fe25){var _0x19c177=_[_0x77b9('0x1a')](_0x4fd0e4[_0x77b9('0x1b')](),{'p':_0x39fe25});if(_0x19c177>=0x0){logger[_0x77b9('0x17')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3c92df,_0x39fe25||_0x77b9('0x19'),_0x19c177);_0x4fd0e4[_0x77b9('0x19')](_0x19c177);}else{logger[_0x77b9('0x17')](_0x77b9('0x1c'),_0x3c92df,_0x39fe25||_0x77b9('0x19'));_0x4fd0e4[_0x77b9('0x14')]();}}else{_0x4fd0e4[_0x77b9('0x19')]();}}catch(_0x5a443a){logger[_0x77b9('0x10')](_0x77b9('0x1d'),_0x3c92df,_0x5a443a[_0x77b9('0x13')]);_0x4fd0e4[_0x77b9('0x14')]();}}}catch(_0x550f24){logger[_0x77b9('0x10')]('[%s][GOTOIF]\x20%s',_0x3c92df,JSON[_0x77b9('0x1e')](_0x550f24));_0x4fd0e4[_0x77b9('0x14')]();}};}; \ 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 845fc01..95af27e 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 _0x39c6=['length','error','[%s][GOTOP]\x20%s','message','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','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'];(function(_0x2ed99c,_0x9c9010){var _0x40fd72=function(_0x5f36df){while(--_0x5f36df){_0x2ed99c['push'](_0x2ed99c['shift']());}};_0x40fd72(++_0x9c9010);}(_0x39c6,0xae));var _0x639c=function(_0x32ba0e,_0x1fa112){_0x32ba0e=_0x32ba0e-0x0;var _0x14dac8=_0x39c6[_0x32ba0e];return _0x14dac8;};'use strict';var schema=require(_0x639c('0x0'));var _=require(_0x639c('0x1'));var logger=require(_0x639c('0x2'))(_0x639c('0x3'));var gotop=schema({'priority':{'type':_0x639c('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x639c('0x5')]=function(_0x5c2f63,_0x1e648c){return function(_0x1b8929){try{var _0x2f8f74={'priority':_0x1e648c[0x0]};var _0x3dd51c=gotop[_0x639c('0x0')](_0x2f8f74,{'typecast':!![]});if(_0x3dd51c[_0x639c('0x6')]){logger[_0x639c('0x7')](_0x639c('0x8'),_0x5c2f63,_['map'](_0x3dd51c,_0x639c('0x9'))['join'](',\x20'));_0x1b8929[_0x639c('0xa')]();}else{logger['info'](_0x639c('0xb'),_0x5c2f63,_0x2f8f74[_0x639c('0xc')]);if(_0x2f8f74['priority']){var _0x3c0be1=_[_0x639c('0xd')](_0x1b8929[_0x639c('0xe')](),{'p':_0x2f8f74[_0x639c('0xc')]});if(_0x3c0be1>=0x0){logger[_0x639c('0xf')](_0x639c('0x10'),_0x5c2f63,_0x2f8f74[_0x639c('0xc')]||_0x639c('0x11'),_0x3c0be1);_0x1b8929[_0x639c('0x11')](_0x3c0be1);}else{logger[_0x639c('0xf')](_0x639c('0x12'),_0x5c2f63,_0x2f8f74['priority']||_0x639c('0x11'));_0x1b8929[_0x639c('0xa')]();}}else{_0x1b8929['next']();}}}catch(_0x284483){logger['error'](_0x639c('0x8'),_0x5c2f63,JSON[_0x639c('0x13')](_0x284483));_0x1b8929[_0x639c('0xa')]();}};}; \ No newline at end of file +var _0xad8e=['consequence','length','error','[%s][GOTOP]\x20%s','map','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x218d7d,_0x4bad5b){var _0x6817c1=function(_0x46776a){while(--_0x46776a){_0x218d7d['push'](_0x218d7d['shift']());}};_0x6817c1(++_0x4bad5b);}(_0xad8e,0x73));var _0xead8=function(_0x182d39,_0x5739a5){_0x182d39=_0x182d39-0x0;var _0x3b75eb=_0xad8e[_0x182d39];return _0x3b75eb;};'use strict';var schema=require(_0xead8('0x0'));var _=require(_0xead8('0x1'));var logger=require(_0xead8('0x2'))('routing');var gotop=schema({'priority':{'type':_0xead8('0x3'),'required':!![],'message':_0xead8('0x4')}});exports[_0xead8('0x5')]=function(_0x39eb1a,_0x19f66b){return function(_0x3e8988){try{var _0x53d836={'priority':_0x19f66b[0x0]};var _0x1f5d7f=gotop['validate'](_0x53d836,{'typecast':!![]});if(_0x1f5d7f[_0xead8('0x6')]){logger[_0xead8('0x7')](_0xead8('0x8'),_0x39eb1a,_[_0xead8('0x9')](_0x1f5d7f,'message')['join'](',\x20'));_0x3e8988[_0xead8('0xa')]();}else{logger[_0xead8('0xb')](_0xead8('0xc'),_0x39eb1a,_0x53d836[_0xead8('0xd')]);if(_0x53d836[_0xead8('0xd')]){var _0x27086a=_[_0xead8('0xe')](_0x3e8988[_0xead8('0xf')](),{'p':_0x53d836[_0xead8('0xd')]});if(_0x27086a>=0x0){logger['info'](_0xead8('0x10'),_0x39eb1a,_0x53d836['priority']||_0xead8('0x11'),_0x27086a);_0x3e8988['next'](_0x27086a);}else{logger[_0xead8('0xb')](_0xead8('0x12'),_0x39eb1a,_0x53d836[_0xead8('0xd')]||_0xead8('0x11'));_0x3e8988['stop']();}}else{_0x3e8988[_0xead8('0x11')]();}}}catch(_0x25909e){logger[_0xead8('0x7')](_0xead8('0x8'),_0x39eb1a,JSON[_0xead8('0x13')](_0x25909e));_0x3e8988[_0xead8('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index bd1c743..b8cd7ba 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 _0x2148=['consequence','getMustacheRender','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','body','next','catch','error','[%s][MESSAGE]\x20%s','stop','stringify','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x2af759,_0x34397a){var _0x26de43=function(_0x530e36){while(--_0x530e36){_0x2af759['push'](_0x2af759['shift']());}};_0x26de43(++_0x34397a);}(_0x2148,0x1d5));var _0x8214=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0x2148[_0x1b3564];return _0x504069;};'use strict';var _=require('lodash');var utils=require(_0x8214('0x0'));var logger=require(_0x8214('0x1'))('routing');var rpc={'chatMessage':require(_0x8214('0x2')),'openchannelMessage':require(_0x8214('0x3')),'mailMessage':require(_0x8214('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x8214('0x5')),'whatsappMessage':require(_0x8214('0x6'))};exports[_0x8214('0x7')]=function(_0x62797e,_0xfff3a1){return function(_0x28b823){try{var _0x4e6448={'body':utils[_0x8214('0x8')](_0xfff3a1[0x0],this),'ContactId':this['contact']['id']};if(this[_0x8214('0x9')]===_0x8214('0xa')){_0x4e6448[_0x8214('0xb')]=this[_0x8214('0xc')]['id'];}else{_0x4e6448[_[_0x8214('0xd')](this['channel'])+_0x8214('0xe')]=this[_0x8214('0xc')]['id'];}_0x4e6448[_['upperFirst'](this[_0x8214('0x9')])+_0x8214('0xf')]=this[_0x8214('0x10')]['id'];if(rpc[this['channel']+_0x8214('0x11')]){return rpc[this[_0x8214('0x9')]+_0x8214('0x11')][_0x8214('0x12')](_0x4e6448)[_0x8214('0x13')](function(_0x2daea3){logger[_0x8214('0x14')]('[%s][MESSAGE]\x20%s',_0x62797e,_0x4e6448[_0x8214('0x15')]);_0x28b823[_0x8214('0x16')]();})[_0x8214('0x17')](function(_0x2abf26){logger[_0x8214('0x18')](_0x8214('0x19'),_0x62797e,JSON['stringify'](_0x2abf26));_0x28b823[_0x8214('0x1a')]();});}}catch(_0x27faaf){logger[_0x8214('0x18')]('[%s][MESSAGE]\x20%s',_0x62797e,JSON[_0x8214('0x1b')](_0x27faaf));_0x28b823[_0x8214('0x1a')]();}};}; \ No newline at end of file +var _0xe1bf=['create','then','info','body','next','catch','[%s][MESSAGE]\x20%s','stringify','stop','error','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message'];(function(_0x5c92f7,_0x17381f){var _0x452cc1=function(_0x374c83){while(--_0x374c83){_0x5c92f7['push'](_0x5c92f7['shift']());}};_0x452cc1(++_0x17381f);}(_0xe1bf,0x1e6));var _0xfe1b=function(_0x338f4e,_0x4e9802){_0x338f4e=_0x338f4e-0x0;var _0x28bf05=_0xe1bf[_0x338f4e];return _0x28bf05;};'use strict';var _=require(_0xfe1b('0x0'));var utils=require('./utils');var logger=require(_0xfe1b('0x1'))(_0xfe1b('0x2'));var rpc={'chatMessage':require(_0xfe1b('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xfe1b('0x4')),'smsMessage':require(_0xfe1b('0x5')),'faxMessage':require(_0xfe1b('0x6')),'whatsappMessage':require(_0xfe1b('0x7'))};exports['consequence']=function(_0x1ea1d3,_0x135d5e){return function(_0x169261){try{var _0x1aafd4={'body':utils[_0xfe1b('0x8')](_0x135d5e[0x0],this),'ContactId':this['contact']['id']};if(this[_0xfe1b('0x9')]===_0xfe1b('0xa')){_0x1aafd4[_0xfe1b('0xb')]=this[_0xfe1b('0xc')]['id'];}else{_0x1aafd4[_[_0xfe1b('0xd')](this[_0xfe1b('0x9')])+_0xfe1b('0xe')]=this[_0xfe1b('0xc')]['id'];}_0x1aafd4[_[_0xfe1b('0xd')](this[_0xfe1b('0x9')])+_0xfe1b('0xf')]=this[_0xfe1b('0x10')]['id'];if(rpc[this[_0xfe1b('0x9')]+_0xfe1b('0x11')]){return rpc[this['channel']+_0xfe1b('0x11')][_0xfe1b('0x12')](_0x1aafd4)[_0xfe1b('0x13')](function(_0x8aa44f){logger[_0xfe1b('0x14')]('[%s][MESSAGE]\x20%s',_0x1ea1d3,_0x1aafd4[_0xfe1b('0x15')]);_0x169261[_0xfe1b('0x16')]();})[_0xfe1b('0x17')](function(_0x359f5b){logger['error'](_0xfe1b('0x18'),_0x1ea1d3,JSON[_0xfe1b('0x19')](_0x359f5b));_0x169261[_0xfe1b('0x1a')]();});}}catch(_0x570855){logger[_0xfe1b('0x1b')](_0xfe1b('0x18'),_0x1ea1d3,JSON[_0xfe1b('0x19')](_0x570855));_0x169261[_0xfe1b('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 06d59be..682f945 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 _0x61d7=['./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','next','error','stringify'];(function(_0x5b090a,_0x85ff1e){var _0x1d5d46=function(_0x573106){while(--_0x573106){_0x5b090a['push'](_0x5b090a['shift']());}};_0x1d5d46(++_0x85ff1e);}(_0x61d7,0x156));var _0x761d=function(_0xc270af,_0x12b247){_0xc270af=_0xc270af-0x0;var _0x29eee7=_0x61d7[_0xc270af];return _0x29eee7;};'use strict';var utils=require(_0x761d('0x0'));var logger=require(_0x761d('0x1'))(_0x761d('0x2'));exports[_0x761d('0x3')]=function(_0x243d57,_0x25ca0e){return function(_0x48faad){try{logger[_0x761d('0x4')](_0x761d('0x5'),_0x243d57,utils['getMustacheRender'](_0x25ca0e[0x0],this));_0x48faad[_0x761d('0x6')]();}catch(_0x4d5478){logger[_0x761d('0x7')](_0x761d('0x5'),_0x243d57,JSON[_0x761d('0x8')](_0x4d5478));_0x48faad['stop']();}};}; \ No newline at end of file +var _0x934a=['error','stringify','stop','consequence','info','next'];(function(_0x2134b7,_0x1eb5e2){var _0x6c5914=function(_0x1da201){while(--_0x1da201){_0x2134b7['push'](_0x2134b7['shift']());}};_0x6c5914(++_0x1eb5e2);}(_0x934a,0x69));var _0xa934=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x934a[_0x2aa0e7];return _0x1472c0;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')('routing');exports[_0xa934('0x0')]=function(_0x2442f3,_0x13c992){return function(_0x3fdf73){try{logger[_0xa934('0x1')]('[%s][NOOP]\x20%s',_0x2442f3,utils['getMustacheRender'](_0x13c992[0x0],this));_0x3fdf73[_0xa934('0x2')]();}catch(_0x5afbd9){logger[_0xa934('0x3')]('[%s][NOOP]\x20%s',_0x2442f3,JSON[_0xa934('0x4')](_0x5afbd9));_0x3fdf73[_0xa934('0x5')]();}};}; \ 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 12a71d4..d0b61c1 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 _0x34e8=['../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','channel','MessageId','chat','AccountId','WebsiteId','name','message','QueueReport','create','catch','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport'];(function(_0x3e2d55,_0x4f3c00){var _0x4c8a09=function(_0x593b64){while(--_0x593b64){_0x3e2d55['push'](_0x3e2d55['shift']());}};_0x4c8a09(++_0x4f3c00);}(_0x34e8,0x12c));var _0x834e=function(_0x5940ba,_0x10434a){_0x5940ba=_0x5940ba-0x0;var _0x5e577d=_0x34e8[_0x5940ba];return _0x5e577d;};'use strict';var schema=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var seqqueue=require(_0x834e('0x3'));var moment=require('moment');var Redis=require(_0x834e('0x4'));var config=require(_0x834e('0x5'));var logger=require(_0x834e('0x6'))(_0x834e('0x7'));var strategy=require(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));var attributes=['id',_0x834e('0xc'),_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10')];function emit(_0x363786,_0x1af45a,_0x3bdda9){io['to'](_0x363786)[_0x834e('0x11')](_0x1af45a,_0x3bdda9);}function emitChannelQueueInteraction(_0x1e41fe,_0x36e124,_0x14038b,_0x2e1a37,_0x293514,_0x1e00de,_0x2fd95c,_0x538bb3){var _0x5e5b6d=_[_0x834e('0x12')](_0x14038b);_0x5e5b6d['queue_id']=_0x538bb3;_0x5e5b6d[_0x834e('0xe')]=_0x36e124;_0x5e5b6d[_0x834e('0xd')]=_0x2e1a37;_0x5e5b6d['id']=_0x293514;if(_0x1e00de){_0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514]=_['pick'](_0x5e5b6d,attributes);}else{delete _0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514];}emit(util['format'](_0x834e('0x15'),_0x1e41fe,_0x36e124),util['format'](_0x834e('0x16'),_0x1e41fe,_0x1e00de?_0x834e('0x17'):'remove'),_[_0x834e('0x18')](_0x5e5b6d,attributes));}var rpc={'openchannelQueueReport':require(_0x834e('0x19')),'mailQueueReport':require(_0x834e('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x834e('0x1b')),'faxQueueReport':require(_0x834e('0x1c')),'whatsappQueueReport':require(_0x834e('0x1d'))};var queue=schema({'name':{'type':_0x834e('0x1e'),'required':!![],'message':_0x834e('0x1f')},'timeout':{'type':_0x834e('0x20'),'message':_0x834e('0x21')}});function startRouting(_0x595515,_0x2545b4,_0x1fd2c6,_0x113ff4){if(_0x595515&&_0x2545b4&&_0x1fd2c6){_0x2545b4[_0x834e('0x22')]+=0x1;var _0x4ab05d={'uniqueid':_0x595515,'from':_0x1fd2c6[_0x834e('0x23')]?_0x1fd2c6[_0x834e('0x23')]['from']:'','joinAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'ContactId':_0x1fd2c6[_0x834e('0x25')]?_0x1fd2c6['contact']['id']:null,'ListId':_0x1fd2c6['list']?_0x1fd2c6[_0x834e('0x26')]['id']:null};_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x28')]=_0x2545b4['id']||null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x29')]=_0x1fd2c6[_0x834e('0x2a')]?_0x1fd2c6[_0x834e('0x2a')]['id']:null;_0x4ab05d[_['upperFirst'](_0x1fd2c6[_0x834e('0x2b')])+_0x834e('0x2c')]=_0x1fd2c6['message']?_0x1fd2c6['message']['id']:null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+(_0x1fd2c6[_0x834e('0x2b')]!==_0x834e('0x2d')?_0x834e('0x2e'):_0x834e('0x2f'))]=_0x1fd2c6[_0x834e('0xd')]?_0x1fd2c6[_0x834e('0xd')]['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x595515,_0x2545b4['name']));emitChannelQueueInteraction(_0x1fd2c6[_0x834e('0x2b')],_0x2545b4[_0x834e('0x30')],_0x4ab05d,_0x1fd2c6[_0x834e('0xd')]['name'],_0x1fd2c6[_0x834e('0x31')]['id'],!![],_0x113ff4,_0x2545b4['id']);if(rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x33')](_0x4ab05d)[_0x834e('0x34')](function(_0xfaf716){logger[_0x834e('0x35')]('create\x20queue\x20report');});}}}function stopRouting(_0xef9ec2,_0x5cad11,_0x2c75c2,_0x3787b0){if(_0xef9ec2&&_0x5cad11){_0x5cad11[_0x834e('0x22')]-=0x1;var _0x2b3418={'leaveAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'acceptAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'reason':_0x834e('0x36')};logger[_0x834e('0x37')](util['format'](_0x834e('0x38'),_0xef9ec2,_0x5cad11[_0x834e('0x30')]));emitChannelQueueInteraction(_0x2c75c2[_0x834e('0x2b')],_0x5cad11[_0x834e('0x30')],_0x2c75c2['body'],_0x2c75c2[_0x834e('0xd')][_0x834e('0x30')],_0x2c75c2['message']['id'],![],_0x3787b0,_0x5cad11['id']);if(rpc[_0x2c75c2['channel']+'QueueReport']){return rpc[_0x2c75c2[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x39')](_0xef9ec2,_0x2b3418)[_0x834e('0x34')](function(_0x339e28){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function endRouting(_0x2c2d94,_0x513f36,_0xe103fe,_0x6a3ac){if(_0x2c2d94&&_0x513f36){_0x513f36['waiting']-=0x1;var _0x18ac3b={'leaveAt':moment()[_0x834e('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x834e('0x24')),'reason':_0x834e('0x3a')};logger[_0x834e('0x37')](util[_0x834e('0x13')](_0x834e('0x3b'),_0x2c2d94,_0x513f36['name']));emitChannelQueueInteraction(_0xe103fe[_0x834e('0x2b')],_0x513f36['name'],_0xe103fe['body'],_0xe103fe[_0x834e('0xd')]['name'],_0xe103fe[_0x834e('0x31')]['id'],![],_0x6a3ac);if(rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]['update'](_0x2c2d94,_0x18ac3b)[_0x834e('0x34')](function(_0x26b847){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x35380e){return function(_0x16ac45){return _0x16ac45['name'][_0x834e('0x3c')]()===_0x35380e['toLowerCase']();};}exports[_0x834e('0x3d')]=function(_0x585335,_0x4a18bb,_0x4a6942,_0x22ea21){return function(_0x16969b){try{var _0x3bcbf4={'name':_0x4a18bb[0x0],'timeout':_0x4a18bb[0x1]};var _0xbc1571=queue[_0x834e('0x0')](_0x3bcbf4,{'typecast':!![]});if(_0xbc1571[_0x834e('0x3e')]){logger[_0x834e('0x35')]('[%s][QUEUE]\x20%s',_0x585335,_[_0x834e('0x3f')](_0xbc1571,'message')[_0x834e('0x40')](',\x20'));_0x16969b['stop']();}else{var _0x1df5b0=_['find'](_0x4a6942[_0x22ea21[_0x834e('0x2b')]+_0x834e('0x41')],handleFindQueue(_0x3bcbf4['name']));if(_0x1df5b0){startRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);var _0x39e7b9=(_0x1df5b0[_0x834e('0x3a')]||0xa)*0x3e8;var _0xa880cb=(_0x3bcbf4[_0x834e('0x3a')]||0x14)*0x3e8;var _0x252ea0,_0x1a7149;if(_0x39e7b9>_0xa880cb){_0xa880cb=_0x39e7b9;}var _0xfa28da=seqqueue[_0x834e('0x42')](_0x39e7b9);_0xfa28da['id']=_0x585335;_0xfa28da[_0x834e('0x43')]=_0x39e7b9;_0xfa28da[_0x834e('0x44')]=_0xa880cb;_0xfa28da['channel']=_0x22ea21[_0x834e('0x2b')];_0x4a6942[_0x834e('0x45')][_0x585335]['on']('end',function(){logger[_0x834e('0x37')](_0x834e('0x46'),_0x585335);stopRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0x252ea0=undefined;_0xfa28da[_0x834e('0x47')](!![]);if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}_0x16969b[_0x834e('0x48')]();});_0x4a6942['rules'][_0x585335]['on']('complete',function(){if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}});_0x252ea0=setTimeout(function(){logger[_0x834e('0x37')](_0x834e('0x49'),_0x585335);endRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0xfa28da[_0x834e('0x47')](!![]);_0x16969b[_0x834e('0x4a')]();},_0xa880cb);switch(_0x1df5b0[_0x834e('0x4b')]){case _0x834e('0x4c'):strategy[_0x834e('0x4c')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);break;default:strategy[_0x834e('0x4d')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);}}else{logger[_0x834e('0x35')](_0x834e('0x4e'),_0x585335,_0x3bcbf4[_0x834e('0x30')]);_0x16969b[_0x834e('0x48')]();}}}catch(_0x2aa072){console[_0x834e('0x4f')](_0x2aa072);logger[_0x834e('0x35')](_0x834e('0x50'),_0x585335,_0x2aa072[_0x834e('0x51')]);_0x16969b[_0x834e('0x48')]();}};}; \ No newline at end of file +var _0x9c44=['[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','atimeout','rules','end','close','complete','next','strategy','rrmemory','beepall','log','stack','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone','account','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','list','QueueId','upperFirst','channel','InteractionId','message','AccountId','info','name','QueueReport','create','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update','catch','error','update\x20queue\x20report','timeout'];(function(_0x134d5e,_0x2a47d8){var _0x1e166a=function(_0x53f10d){while(--_0x53f10d){_0x134d5e['push'](_0x134d5e['shift']());}};_0x1e166a(++_0x2a47d8);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x49c4('0x0'));var seqqueue=require(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var config=require(_0x49c4('0x4'));var logger=require(_0x49c4('0x5'))('routing');var strategy=require('./strategy');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));var attributes=['id',_0x49c4('0x9'),'account',_0x49c4('0xa'),_0x49c4('0xb'),_0x49c4('0xc')];function emit(_0x4487ca,_0x4c7d3a,_0x5ab4a3){io['to'](_0x4487ca)[_0x49c4('0xd')](_0x4c7d3a,_0x5ab4a3);}function emitChannelQueueInteraction(_0x313e73,_0x58cad7,_0xb611a1,_0x459d09,_0x4adb3c,_0x536d42,_0x1d19bf,_0x6d1b08){var _0x5487cd=_[_0x49c4('0xe')](_0xb611a1);_0x5487cd[_0x49c4('0x9')]=_0x6d1b08;_0x5487cd['queue']=_0x58cad7;_0x5487cd[_0x49c4('0xf')]=_0x459d09;_0x5487cd['id']=_0x4adb3c;if(_0x536d42){_0x1d19bf[util[_0x49c4('0x10')](_0x49c4('0x11'),_0x313e73)][_0x4adb3c]=_[_0x49c4('0x12')](_0x5487cd,attributes);}else{delete _0x1d19bf[util[_0x49c4('0x10')](_0x49c4('0x11'),_0x313e73)][_0x4adb3c];}emit(util[_0x49c4('0x10')](_0x49c4('0x13'),_0x313e73,_0x58cad7),util['format'](_0x49c4('0x14'),_0x313e73,_0x536d42?_0x49c4('0x15'):_0x49c4('0x16')),_[_0x49c4('0x12')](_0x5487cd,attributes));}var rpc={'openchannelQueueReport':require(_0x49c4('0x17')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x49c4('0x18')),'smsQueueReport':require(_0x49c4('0x19')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x49c4('0x1a'),'required':!![],'message':_0x49c4('0x1b')},'timeout':{'type':_0x49c4('0x1c'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x24856d,_0x50b151,_0x2cbd50,_0x1806c2){if(_0x24856d&&_0x50b151&&_0x2cbd50){_0x50b151[_0x49c4('0x1d')]+=0x1;var _0x291526={'uniqueid':_0x24856d,'from':_0x2cbd50[_0x49c4('0x1e')]?_0x2cbd50[_0x49c4('0x1e')][_0x49c4('0xb')]:'','joinAt':moment()[_0x49c4('0x10')](_0x49c4('0x1f')),'ContactId':_0x2cbd50['contact']?_0x2cbd50['contact']['id']:null,'ListId':_0x2cbd50['list']?_0x2cbd50[_0x49c4('0x20')]['id']:null};_0x291526[_['upperFirst'](_0x2cbd50['channel'])+_0x49c4('0x21')]=_0x50b151['id']||null;_0x291526[_[_0x49c4('0x22')](_0x2cbd50[_0x49c4('0x23')])+_0x49c4('0x24')]=_0x2cbd50['interaction']?_0x2cbd50['interaction']['id']:null;_0x291526[_[_0x49c4('0x22')](_0x2cbd50[_0x49c4('0x23')])+'MessageId']=_0x2cbd50[_0x49c4('0x25')]?_0x2cbd50[_0x49c4('0x25')]['id']:null;_0x291526[_[_0x49c4('0x22')](_0x2cbd50[_0x49c4('0x23')])+(_0x2cbd50['channel']!=='chat'?_0x49c4('0x26'):'WebsiteId')]=_0x2cbd50[_0x49c4('0xf')]?_0x2cbd50[_0x49c4('0xf')]['id']:null;logger[_0x49c4('0x27')](util[_0x49c4('0x10')]('[%s][START:QUEUE][NAME:%s]',_0x24856d,_0x50b151[_0x49c4('0x28')]));emitChannelQueueInteraction(_0x2cbd50[_0x49c4('0x23')],_0x50b151[_0x49c4('0x28')],_0x291526,_0x2cbd50[_0x49c4('0xf')][_0x49c4('0x28')],_0x2cbd50[_0x49c4('0x25')]['id'],!![],_0x1806c2,_0x50b151['id']);if(rpc[_0x2cbd50[_0x49c4('0x23')]+_0x49c4('0x29')]){return rpc[_0x2cbd50[_0x49c4('0x23')]+_0x49c4('0x29')][_0x49c4('0x2a')](_0x291526)['catch'](function(_0x4f4495){logger['error'](_0x49c4('0x2b'));});}}}function stopRouting(_0x7ee704,_0x1eb035,_0x27e467,_0x28eb47){if(_0x7ee704&&_0x1eb035){_0x1eb035['waiting']-=0x1;var _0x38ad77={'leaveAt':moment()[_0x49c4('0x10')](_0x49c4('0x1f')),'acceptAt':moment()[_0x49c4('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0x49c4('0x27')](util[_0x49c4('0x10')](_0x49c4('0x2c'),_0x7ee704,_0x1eb035[_0x49c4('0x28')]));emitChannelQueueInteraction(_0x27e467[_0x49c4('0x23')],_0x1eb035['name'],_0x27e467[_0x49c4('0x1e')],_0x27e467[_0x49c4('0xf')][_0x49c4('0x28')],_0x27e467['message']['id'],![],_0x28eb47,_0x1eb035['id']);if(rpc[_0x27e467['channel']+_0x49c4('0x29')]){return rpc[_0x27e467[_0x49c4('0x23')]+_0x49c4('0x29')][_0x49c4('0x2d')](_0x7ee704,_0x38ad77)[_0x49c4('0x2e')](function(_0x2cf897){logger[_0x49c4('0x2f')](_0x49c4('0x30'));});}}}function endRouting(_0x3209cd,_0x4e0209,_0x2d34ca,_0x5b96df){if(_0x3209cd&&_0x4e0209){_0x4e0209[_0x49c4('0x1d')]-=0x1;var _0x349791={'leaveAt':moment()[_0x49c4('0x10')](_0x49c4('0x1f')),'exitAt':moment()['format'](_0x49c4('0x1f')),'reason':_0x49c4('0x31')};logger[_0x49c4('0x27')](util['format'](_0x49c4('0x32'),_0x3209cd,_0x4e0209[_0x49c4('0x28')]));emitChannelQueueInteraction(_0x2d34ca[_0x49c4('0x23')],_0x4e0209[_0x49c4('0x28')],_0x2d34ca[_0x49c4('0x1e')],_0x2d34ca[_0x49c4('0xf')][_0x49c4('0x28')],_0x2d34ca[_0x49c4('0x25')]['id'],![],_0x5b96df);if(rpc[_0x2d34ca[_0x49c4('0x23')]+_0x49c4('0x29')]){return rpc[_0x2d34ca[_0x49c4('0x23')]+'QueueReport'][_0x49c4('0x2d')](_0x3209cd,_0x349791)[_0x49c4('0x2e')](function(_0x32b172){logger[_0x49c4('0x2f')](_0x49c4('0x30'));});}}}function handleFindQueue(_0x29dd5d){return function(_0x1be62d){return _0x1be62d[_0x49c4('0x28')][_0x49c4('0x33')]()===_0x29dd5d[_0x49c4('0x33')]();};}exports[_0x49c4('0x34')]=function(_0xa3d59e,_0x326142,_0x4e38bc,_0x212366){return function(_0x49829e){try{var _0x104efb={'name':_0x326142[0x0],'timeout':_0x326142[0x1]};var _0x4915bc=queue[_0x49c4('0x35')](_0x104efb,{'typecast':!![]});if(_0x4915bc[_0x49c4('0x36')]){logger[_0x49c4('0x2f')](_0x49c4('0x37'),_0xa3d59e,_['map'](_0x4915bc,'message')[_0x49c4('0x38')](',\x20'));_0x49829e[_0x49c4('0x39')]();}else{var _0x38349b=_[_0x49c4('0x3a')](_0x4e38bc[_0x212366['channel']+_0x49c4('0x3b')],handleFindQueue(_0x104efb[_0x49c4('0x28')]));if(_0x38349b){startRouting(_0xa3d59e,_0x38349b,_0x212366,_0x4e38bc);var _0x2ccd47=(_0x38349b[_0x49c4('0x31')]||0xa)*0x3e8;var _0x81a674=(_0x104efb[_0x49c4('0x31')]||0x14)*0x3e8;var _0x1a9593,_0x3351c1;if(_0x2ccd47>_0x81a674){_0x81a674=_0x2ccd47;}var _0x3c4a1d=seqqueue['createQueue'](_0x2ccd47);_0x3c4a1d['id']=_0xa3d59e;_0x3c4a1d[_0x49c4('0x3c')]=_0x2ccd47;_0x3c4a1d['qtimeout']=_0x81a674;_0x3c4a1d[_0x49c4('0x23')]=_0x212366[_0x49c4('0x23')];_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]['on'](_0x49c4('0x3e'),function(){logger[_0x49c4('0x27')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0xa3d59e);stopRouting(_0xa3d59e,_0x38349b,_0x212366,_0x4e38bc);clearTimeout(_0x1a9593);_0x1a9593=undefined;_0x3c4a1d[_0x49c4('0x3f')](!![]);if(_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]){delete _0x4e38bc[_0x49c4('0x3d')][_0xa3d59e];}_0x49829e[_0x49c4('0x39')]();});_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]['on'](_0x49c4('0x40'),function(){if(_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]){delete _0x4e38bc['rules'][_0xa3d59e];}});_0x1a9593=setTimeout(function(){logger[_0x49c4('0x27')]('[%s][QUEUE]\x20APPLICATION\x20END',_0xa3d59e);endRouting(_0xa3d59e,_0x38349b,_0x212366,_0x4e38bc);clearTimeout(_0x1a9593);_0x3c4a1d[_0x49c4('0x3f')](!![]);_0x49829e[_0x49c4('0x41')]();},_0x81a674);switch(_0x38349b[_0x49c4('0x42')]){case _0x49c4('0x43'):strategy[_0x49c4('0x43')](_0x3c4a1d,_0x38349b,_0x4e38bc,_0x212366);break;default:strategy[_0x49c4('0x44')](_0x3c4a1d,_0x38349b,_0x4e38bc,_0x212366);}}else{logger[_0x49c4('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xa3d59e,_0x104efb[_0x49c4('0x28')]);_0x49829e[_0x49c4('0x39')]();}}}catch(_0x4a5c34){console[_0x49c4('0x45')](_0x4a5c34);logger[_0x49c4('0x2f')](_0x49c4('0x37'),_0xa3d59e,_0x4a5c34[_0x49c4('0x46')]);_0x49829e['stop']();}};}; \ 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 a48cd6e..7765543 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 _0xed59=['agent','realtime','push','handleRun','bind','timeout','drained','handleTimeout','prototype','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','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','routing','notificationId','squeue'];(function(_0x4dc0bc,_0x490bf0){var _0x470317=function(_0x324033){while(--_0x324033){_0x4dc0bc['push'](_0x4dc0bc['shift']());}};_0x470317(++_0x490bf0);}(_0xed59,0x112));var _0x9ed5=function(_0x5ec7e6,_0x25b7e2){_0x5ec7e6=_0x5ec7e6-0x0;var _0x3ac91d=_0xed59[_0x5ec7e6];return _0x3ac91d;};'use strict';var _=require(_0x9ed5('0x0'));var uuid=require(_0x9ed5('0x1'));var util=require(_0x9ed5('0x2'));var logger=require('../../../../../config/logger')(_0x9ed5('0x3'));var Agent=function(_0x16575d,_0x2bda96,_0xef3b91,_0x38a13d){this[_0x9ed5('0x4')]=uuid['v4']();this[_0x9ed5('0x5')]=_0x16575d;this[_0x9ed5('0x6')]=_0x2bda96;this[_0x9ed5('0x7')]=_0xef3b91;this[_0x9ed5('0x3')]=_0x38a13d;this[_0x9ed5('0x5')][_0x9ed5('0x8')](this[_0x9ed5('0x9')][_0x9ed5('0xa')](this),this['handleTimeout'][_0x9ed5('0xa')](this));this['squeue']['on'](_0x9ed5('0xb'),this['handleTimeout'][_0x9ed5('0xa')](this));this[_0x9ed5('0x5')]['on'](_0x9ed5('0xc'),this['handleDrained'][_0x9ed5('0xa')](this));};Agent['prototype'][_0x9ed5('0x8')]=function(){this[_0x9ed5('0x5')][_0x9ed5('0x8')](this['handleRun'][_0x9ed5('0xa')](this),this[_0x9ed5('0xd')][_0x9ed5('0xa')](this));};Agent[_0x9ed5('0xe')][_0x9ed5('0xf')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x9ed5('0x9')]=function(_0x5765d8){logger[_0x9ed5('0x10')](_0x9ed5('0x11'),this[_0x9ed5('0x5')]['id'],this[_0x9ed5('0x6')]['id']);if(_[_0x9ed5('0x12')](this[_0x9ed5('0x7')][_0x9ed5('0x13')][this[_0x9ed5('0x6')]['id']])){logger['info'](_0x9ed5('0x14'),this['squeue']['id'],this[_0x9ed5('0x6')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this[_0x9ed5('0x3')]['forcedOwnership']||util[_0x9ed5('0x15')](this[_0x9ed5('0x5')]['id'],this[_0x9ed5('0x7')][_0x9ed5('0x13')][this[_0x9ed5('0x6')]['id']],this[_0x9ed5('0x5')][_0x9ed5('0x16')],![])){this[_0x9ed5('0x7')]['agents'][this[_0x9ed5('0x6')]['id']][_0x9ed5('0x17')]=!![];this[_0x9ed5('0x7')][_0x9ed5('0x13')][this['agent']['id']][_0x9ed5('0x18')]=undefined;util[_0x9ed5('0x19')](this[_0x9ed5('0x4')],this[_0x9ed5('0x5')]['id'],this[_0x9ed5('0x7')][_0x9ed5('0x13')][this[_0x9ed5('0x6')]['id']],null,this[_0x9ed5('0x3')]);util[_0x9ed5('0x1a')](this[_0x9ed5('0x5')]['id'],this[_0x9ed5('0x7')][_0x9ed5('0x13')][this[_0x9ed5('0x6')]['id']],_0x9ed5('0x1b')+(this['routing'][_0x9ed5('0x1c')]?_0x9ed5('0x1d'):''));}else{logger[_0x9ed5('0x10')](_0x9ed5('0x1e'),this[_0x9ed5('0x5')]['id'],this[_0x9ed5('0x6')]['id']);setTimeout(this[_0x9ed5('0x8')]['bind'](this),0x3e8);}}};Agent[_0x9ed5('0xe')]['handleTimeout']=function(_0x595787){if(_[_0x9ed5('0x12')](this[_0x9ed5('0x7')]['agents'][this['agent']['id']])){return logger[_0x9ed5('0x10')](_0x9ed5('0x14'),this[_0x9ed5('0x5')]['id'],this[_0x9ed5('0x6')]['id']);}else{logger['info'](_0x9ed5('0x1f'),this[_0x9ed5('0x5')]['id'],this[_0x9ed5('0x6')]['id']);util[_0x9ed5('0x20')](this['notificationId'],this[_0x9ed5('0x5')]['id'],this['realtime'][_0x9ed5('0x13')][this[_0x9ed5('0x6')]['id']],null,this[_0x9ed5('0x3')]);this[_0x9ed5('0x7')]['agents'][this[_0x9ed5('0x6')]['id']][_0x9ed5('0x17')]=![];this[_0x9ed5('0x7')][_0x9ed5('0x13')][this['agent']['id']][_0x9ed5('0x18')]=undefined;util[_0x9ed5('0x1a')](this['squeue']['id'],this[_0x9ed5('0x7')][_0x9ed5('0x13')][this['agent']['id']],_0x595787?'STOP':_0x9ed5('0x21'));}if(!_0x595787){setTimeout(this[_0x9ed5('0x8')]['bind'](this),0x3e8);}};function agent(_0x55fa98,_0x4a70b8,_0x4f4c40,_0x45b624){return new Agent(_0x55fa98,_0x4a70b8,_0x4f4c40,_0x45b624);}module[_0x9ed5('0x22')]=agent; \ No newline at end of file +var _0xa29e=[':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','STOP','TIMEOUT','exports','./util','../../../../../config/logger','routing','notificationId','agent','squeue','push','bind','handleTimeout','timeout','handleDrained','prototype','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busyQueue','showNotification','writeLog'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xa29e,0x168));var _0xea29=function(_0x37222f,_0x25a5ab){_0x37222f=_0x37222f-0x0;var _0x5c5a6d=_0xa29e[_0x37222f];return _0x5c5a6d;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0xea29('0x0'));var logger=require(_0xea29('0x1'))(_0xea29('0x2'));var Agent=function(_0xb46426,_0x4ef587,_0x2c564b,_0x5882d7){this[_0xea29('0x3')]=uuid['v4']();this['squeue']=_0xb46426;this[_0xea29('0x4')]=_0x4ef587;this['realtime']=_0x2c564b;this[_0xea29('0x2')]=_0x5882d7;this[_0xea29('0x5')][_0xea29('0x6')](this['handleRun'][_0xea29('0x7')](this),this[_0xea29('0x8')][_0xea29('0x7')](this));this[_0xea29('0x5')]['on'](_0xea29('0x9'),this[_0xea29('0x8')][_0xea29('0x7')](this));this['squeue']['on']('drained',this[_0xea29('0xa')]['bind'](this));};Agent[_0xea29('0xb')][_0xea29('0x6')]=function(){this[_0xea29('0x5')]['push'](this[_0xea29('0xc')][_0xea29('0x7')](this),this['handleTimeout'][_0xea29('0x7')](this));};Agent[_0xea29('0xb')][_0xea29('0xa')]=function(){this[_0xea29('0x8')](!![]);};Agent['prototype'][_0xea29('0xc')]=function(_0x4acb57){logger[_0xea29('0xd')](_0xea29('0xe'),this['squeue']['id'],this[_0xea29('0x4')]['id']);if(_[_0xea29('0xf')](this[_0xea29('0x10')][_0xea29('0x11')][this[_0xea29('0x4')]['id']])){logger[_0xea29('0xd')](_0xea29('0x12'),this['squeue']['id'],this[_0xea29('0x4')]['id']);setTimeout(this['push'][_0xea29('0x7')](this),0x3e8);}else{if(this[_0xea29('0x2')][_0xea29('0x13')]||util['isAgentAvailable'](this[_0xea29('0x5')]['id'],this[_0xea29('0x10')]['agents'][this[_0xea29('0x4')]['id']],this[_0xea29('0x5')][_0xea29('0x14')],![])){this[_0xea29('0x10')]['agents'][this[_0xea29('0x4')]['id']]['busy']=!![];this[_0xea29('0x10')][_0xea29('0x11')][this[_0xea29('0x4')]['id']][_0xea29('0x15')]=undefined;util[_0xea29('0x16')](this[_0xea29('0x3')],this[_0xea29('0x5')]['id'],this[_0xea29('0x10')]['agents'][this[_0xea29('0x4')]['id']],null,this[_0xea29('0x2')]);util[_0xea29('0x17')](this[_0xea29('0x5')]['id'],this[_0xea29('0x10')]['agents'][this[_0xea29('0x4')]['id']],'RINGING'+(this[_0xea29('0x2')]['forcedOwnership']?_0xea29('0x18'):''));}else{logger[_0xea29('0xd')](_0xea29('0x19'),this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0xea29('0x7')](this),0x3e8);}}};Agent[_0xea29('0xb')][_0xea29('0x8')]=function(_0x337085){if(_['isNil'](this[_0xea29('0x10')]['agents'][this[_0xea29('0x4')]['id']])){return logger[_0xea29('0xd')](_0xea29('0x12'),this[_0xea29('0x5')]['id'],this['agent']['id']);}else{logger[_0xea29('0xd')](_0xea29('0x1a'),this['squeue']['id'],this[_0xea29('0x4')]['id']);util[_0xea29('0x1b')](this[_0xea29('0x3')],this['squeue']['id'],this[_0xea29('0x10')][_0xea29('0x11')][this[_0xea29('0x4')]['id']],null,this[_0xea29('0x2')]);this[_0xea29('0x10')][_0xea29('0x11')][this[_0xea29('0x4')]['id']][_0xea29('0x1c')]=![];this[_0xea29('0x10')]['agents'][this[_0xea29('0x4')]['id']][_0xea29('0x15')]=undefined;util['writeLog'](this[_0xea29('0x5')]['id'],this[_0xea29('0x10')][_0xea29('0x11')][this[_0xea29('0x4')]['id']],_0x337085?_0xea29('0x1d'):_0xea29('0x1e'));}if(!_0x337085){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x4f4f7f,_0x15ca75,_0x460377,_0x39f1ea){return new Agent(_0x4f4f7f,_0x15ca75,_0x460377,_0x39f1ea);}module[_0xea29('0x1f')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 2d3c468..d0bc352 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 _0x7122=['handleDrained','prototype','isNil','queue','Agents','length','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','RINGING','busy','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','writeLog','STOP','busyQueue','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','realtime','squeue','push','handleRun','bind','handleTimeout','drained'];(function(_0x1aac46,_0x5af899){var _0x3b65be=function(_0x1f9fde){while(--_0x1f9fde){_0x1aac46['push'](_0x1aac46['shift']());}};_0x3b65be(++_0x5af899);}(_0x7122,0x1a5));var _0x2712=function(_0x466fa0,_0x9027ab){_0x466fa0=_0x466fa0-0x0;var _0x2bf8ce=_0x7122[_0x466fa0];return _0x2bf8ce;};'use strict';var _=require(_0x2712('0x0'));var uuid=require(_0x2712('0x1'));var util=require(_0x2712('0x2'));var logger=require(_0x2712('0x3'))(_0x2712('0x4'));var Beepall=function(_0x109dfd,_0x4849de,_0x1c02f2,_0x46736c){this[_0x2712('0x5')]=uuid['v4']();this['squeue']=_0x109dfd;this['queue']=_0x4849de;this[_0x2712('0x6')]=_0x1c02f2;this[_0x2712('0x4')]=_0x46736c;this[_0x2712('0x7')][_0x2712('0x8')](this[_0x2712('0x9')][_0x2712('0xa')](this),this['handleTimeout'][_0x2712('0xa')](this));this[_0x2712('0x7')]['on']('timeout',this[_0x2712('0xb')][_0x2712('0xa')](this));this[_0x2712('0x7')]['on'](_0x2712('0xc'),this[_0x2712('0xd')][_0x2712('0xa')](this));};Beepall[_0x2712('0xe')][_0x2712('0x8')]=function(){this[_0x2712('0x7')]['push'](this[_0x2712('0x9')][_0x2712('0xa')](this),this['handleTimeout'][_0x2712('0xa')](this));};Beepall['prototype']['handleDrained']=function(_0x29eaf9){this[_0x2712('0xb')](!![]);};Beepall['prototype'][_0x2712('0x9')]=function(_0x3ca2dd){var _0x2abbcf=!![];if(!_[_0x2712('0xf')](this[_0x2712('0x10')])&&!_[_0x2712('0xf')](this[_0x2712('0x10')][_0x2712('0x11')])&&this[_0x2712('0x10')][_0x2712('0x11')][_0x2712('0x12')]>0x0){for(var _0x40358c=0x0,_0x5c7566;_0x40358c0x0){for(var _0x3e0269=0x0,_0x1a6664;_0x3e02690x0&&_0x4d39a3[_0x923475+'CurrentCapacity']>=_0x4d39a3[_0x923475+_0xc52f('0x23')]){writeLog(_0x2a3009,_0x4d39a3,_0x923475[_0xc52f('0x25')]()+_0xc52f('0x26'));return![];}}return!![];};exports['showNotification']=function(_0x414025,_0x482fe1,_0x1f2b8e,_0xd4e6a9,_0x3382de){return sendNotification(!![],_0x414025,_0x482fe1,_0x1f2b8e,_0xd4e6a9,_0x3382de);};exports[_0xc52f('0x27')]=function(_0x1a972f,_0x4e4626,_0x32a81a,_0x2d8553,_0x15e67e){return sendNotification(![],_0x1a972f,_0x4e4626,_0x32a81a,_0x2d8553,_0x15e67e);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x7a4f=['msg','error','[%s][QUEUE]\x20%s','message','notification:%s','save','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','online','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','showNotification','writeLog','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','localhost','socket.io-emitter','emit','format','user:%s','user:save','split','\x20interaction','name','account','notificationSound','notificationShake','body','queue','getMustacheRender'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x7a4f,0x17a));var _0xf7a4=function(_0x3861f7,_0x995b22){_0x3861f7=_0x3861f7-0x0;var _0x50879f=_0x7a4f[_0x3861f7];return _0x50879f;};'use strict';var _=require('lodash');var util=require(_0xf7a4('0x0'));var utils=require(_0xf7a4('0x1'));var Mustache=require('mustache');var Redis=require(_0xf7a4('0x2'));var config=require(_0xf7a4('0x3'));var logger=require(_0xf7a4('0x4'))(_0xf7a4('0x5'));config['redis']=_[_0xf7a4('0x6')](config['redis'],{'host':_0xf7a4('0x7'),'port':0x18eb});var io=require(_0xf7a4('0x8'))(new Redis(config['redis']));function emit(_0x28e789,_0x281e16,_0x1b919c){io['to'](_0x28e789)[_0xf7a4('0x9')](_0x281e16,_0x1b919c);}function sendNotification(_0x166bdd,_0x228dae,_0x1df639,_0x42dfb3,_0x2f6f53,_0x180eb9){io['to'](util[_0xf7a4('0xa')](_0xf7a4('0xb'),_0x42dfb3['name']))[_0xf7a4('0x9')](_0xf7a4('0xc'),_0x42dfb3);var _0x55d31d=_0x180eb9||{};var _0x28294b=_0x1df639[_0xf7a4('0xd')]('.');var _0x5f4dbf={'uniqueid':_0x228dae,'channel':_0x28294b[0x0],'id':_0x28294b[0x1],'title':_0x28294b[0x0]+_0xf7a4('0xe'),'interactionId':_0x28294b[0x2],'queue':_0x2f6f53?_0x2f6f53[_0xf7a4('0xf')]:null,'sound':_0x55d31d[_0xf7a4('0x10')][_0xf7a4('0x11')],'shake':_0x55d31d[_0xf7a4('0x10')][_0xf7a4('0x12')]};try{if(!_0x55d31d[_0xf7a4('0x13')]){_0x55d31d[_0xf7a4('0x13')]={};}if(_0x2f6f53){_0x55d31d[_0xf7a4('0x13')]['queue']=_0x2f6f53;}else if(_0x55d31d[_0xf7a4('0x13')][_0xf7a4('0x14')]){delete _0x55d31d['body'][_0xf7a4('0x14')];}_0x5f4dbf['msg']=utils[_0xf7a4('0x15')](_0x55d31d[_0xf7a4('0x10')]['notificationTemplate'],_0x55d31d);}catch(_0x51a6fd){_0x5f4dbf[_0xf7a4('0x16')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0xf7a4('0x17')](util['format'](_0xf7a4('0x18'),_0x228dae,_0x51a6fd[_0xf7a4('0x19')]));}io['to'](util[_0xf7a4('0xa')](_0xf7a4('0xb'),_0x42dfb3[_0xf7a4('0xf')]))[_0xf7a4('0x9')](util['format'](_0xf7a4('0x1a'),_0x166bdd?_0xf7a4('0x1b'):'remove'),_0x5f4dbf);}function writeLog(_0x42e04f,_0x1a1e41,_0x4621b0){return logger[_0xf7a4('0x1c')](util['format'](_0xf7a4('0x1d'),_0x42e04f,_0x1a1e41['name'],_0x4621b0));}exports[_0xf7a4('0x1e')]=function(_0x2a59ae,_0xfdbd60,_0x299eb7,_0x2a36c6){if(_0xfdbd60[_0xf7a4('0x1f')]){writeLog(_0x2a59ae,_0xfdbd60,'BUSY');return![];}if(!_0xfdbd60[_0xf7a4('0x20')]){writeLog(_0x2a59ae,_0xfdbd60,'OFFLINE');return![];}if(_0xfdbd60[_0x299eb7+_0xf7a4('0x21')]){writeLog(_0x2a59ae,_0xfdbd60,_0xf7a4('0x22'));return![];}if(_0x2a36c6&&_0xfdbd60['hasOwnProperty'](_0x299eb7+_0xf7a4('0x23'))&&_0xfdbd60[_0xf7a4('0x24')](_0x299eb7+_0xf7a4('0x25'))){if(_0xfdbd60[_0x299eb7+_0xf7a4('0x23')]>0x0&&_0xfdbd60[_0x299eb7+_0xf7a4('0x25')]>=_0xfdbd60[_0x299eb7+_0xf7a4('0x23')]){writeLog(_0x2a59ae,_0xfdbd60,_0x299eb7['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xf7a4('0x26')]=function(_0x4984f5,_0x4df6d9,_0x1e242c,_0x5e8409,_0xeef2d5){return sendNotification(!![],_0x4984f5,_0x4df6d9,_0x1e242c,_0x5e8409,_0xeef2d5);};exports['hideNotification']=function(_0x20f533,_0x3b5615,_0x5f1eb3,_0x2dadb0,_0x142835){return sendNotification(![],_0x20f533,_0x3b5615,_0x5f1eb3,_0x2dadb0,_0x142835);};exports[_0xf7a4('0x27')]=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 6596a0d..40e8204 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 _0x5168=['isObject','stringify','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][SYSTEM]\x20%s','map','message','join','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','error'];(function(_0x60f0fe,_0x2df545){var _0x8b4762=function(_0xe95ae5){while(--_0xe95ae5){_0x60f0fe['push'](_0x60f0fe['shift']());}};_0x8b4762(++_0x2df545);}(_0x5168,0x98));var _0x8516=function(_0x2c548e,_0x21f1b1){_0x2c548e=_0x2c548e-0x0;var _0xf5899f=_0x5168[_0x2c548e];return _0xf5899f;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0x8516('0x0'));var utils=require(_0x8516('0x1'));var logger=require(_0x8516('0x2'))(_0x8516('0x3'));var system=schema({'command':{'type':_0x8516('0x4'),'required':!![],'message':_0x8516('0x5')}});exports[_0x8516('0x6')]=function(_0x154cf8,_0x534155){return function(_0x312d8f){try{var _0x43390a={'command':_0x534155[0x0]};var _0x1bc47b=system['validate'](_0x43390a,{'typecast':!![]});if(_0x1bc47b['length']){logger['error'](_0x8516('0x7'),_0x154cf8,_[_0x8516('0x8')](_0x1bc47b,_0x8516('0x9'))[_0x8516('0xa')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x154cf8);_0x312d8f[_0x8516('0xb')]();}else{var _0x9d973f=this;var _0x12ea55=utils[_0x8516('0xc')](_0x534155[0x0],this);logger[_0x8516('0xd')](_0x8516('0xe'),_0x154cf8,_0x12ea55);sh['exec'](_[_0x8516('0xf')](_0x12ea55),function(_0x328122,_0x215eff){logger[_0x8516('0xd')](_0x8516('0x10'),_0x154cf8,_0x328122);if(_0x328122==0x0){var _0xd6eeba=_0x215eff[_0x8516('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x534155[0x1])||_[_0x8516('0x12')](_0x534155[0x1])){logger[_0x8516('0xd')](_0x8516('0x13'),_0x154cf8);_0x9d973f['body'][_0x534155[0x1]]=_0xd6eeba;}else{logger['info'](_0x8516('0x14'),_0x154cf8,_0x534155[0x1],_0xd6eeba);_0x9d973f[_0x8516('0x15')][_0x534155[0x1]]=_0xd6eeba;}}_0x312d8f['next']();});}}catch(_0x2a5bdc){logger[_0x8516('0x16')]('[%s][SYSTEM]\x20%s',_0x154cf8,_[_0x8516('0x17')](_0x2a5bdc)?JSON[_0x8516('0x18')](_0x2a5bdc):_0x2a5bdc);logger[_0x8516('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x154cf8);_0x312d8f['next']();}};}; \ No newline at end of file +var _0xa159=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','next','isObject','stringify','lodash','./utils','../../../../config/logger','routing','string'];(function(_0x3af138,_0x369701){var _0xacb8b3=function(_0x5e69d9){while(--_0x5e69d9){_0x3af138['push'](_0x3af138['shift']());}};_0xacb8b3(++_0x369701);}(_0xa159,0x190));var _0x9a15=function(_0x157ff3,_0x338da9){_0x157ff3=_0x157ff3-0x0;var _0x1b6d23=_0xa159[_0x157ff3];return _0x1b6d23;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0x9a15('0x0'));var utils=require(_0x9a15('0x1'));var logger=require(_0x9a15('0x2'))(_0x9a15('0x3'));var system=schema({'command':{'type':_0x9a15('0x4'),'required':!![],'message':_0x9a15('0x5')}});exports[_0x9a15('0x6')]=function(_0x1953d3,_0x239c2b){return function(_0x2ae184){try{var _0x2927aa={'command':_0x239c2b[0x0]};var _0x29dbf9=system[_0x9a15('0x7')](_0x2927aa,{'typecast':!![]});if(_0x29dbf9['length']){logger[_0x9a15('0x8')](_0x9a15('0x9'),_0x1953d3,_[_0x9a15('0xa')](_0x29dbf9,_0x9a15('0xb'))[_0x9a15('0xc')](',\x20'));logger[_0x9a15('0xd')](_0x9a15('0xe'),_0x1953d3);_0x2ae184['next']();}else{var _0x5674ef=this;var _0x539e3f=utils[_0x9a15('0xf')](_0x239c2b[0x0],this);logger[_0x9a15('0xd')](_0x9a15('0x10'),_0x1953d3,_0x539e3f);sh[_0x9a15('0x11')](_[_0x9a15('0x12')](_0x539e3f),function(_0xca439f,_0x4b4f02){logger[_0x9a15('0xd')](_0x9a15('0x13'),_0x1953d3,_0xca439f);if(_0xca439f==0x0){var _0x4db4c2=_0x4b4f02[_0x9a15('0x14')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x239c2b[0x1])||_[_0x9a15('0x15')](_0x239c2b[0x1])){logger[_0x9a15('0xd')](_0x9a15('0x16'),_0x1953d3);_0x5674ef['body'][_0x239c2b[0x1]]=_0x4db4c2;}else{logger[_0x9a15('0xd')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x1953d3,_0x239c2b[0x1],_0x4db4c2);_0x5674ef[_0x9a15('0x17')][_0x239c2b[0x1]]=_0x4db4c2;}}_0x2ae184[_0x9a15('0x18')]();});}}catch(_0x1fb5fa){logger[_0x9a15('0x8')]('[%s][SYSTEM]\x20%s',_0x1953d3,_[_0x9a15('0x19')](_0x1fb5fa)?JSON[_0x9a15('0x1a')](_0x1fb5fa):_0x1fb5fa);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1953d3);_0x2ae184['next']();}};}; \ 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 5139332..f06f4a0 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 _0x2e4c=['stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch'];(function(_0x5aef13,_0x15d806){var _0x55be70=function(_0x464b38){while(--_0x464b38){_0x5aef13['push'](_0x5aef13['shift']());}};_0x55be70(++_0x15d806);}(_0x2e4c,0x16f));var _0xc2e4=function(_0x431ff8,_0x4085dd){_0x431ff8=_0x431ff8-0x0;var _0x84ccd4=_0x2e4c[_0x431ff8];return _0x84ccd4;};'use strict';var schema=require(_0xc2e4('0x0'));var _=require(_0xc2e4('0x1'));var rpc={'chatInteraction':require(_0xc2e4('0x2')),'openchannelInteraction':require(_0xc2e4('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xc2e4('0x4')),'faxInteraction':require(_0xc2e4('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xc2e4('0x6'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0xc2e4('0x7')}});exports[_0xc2e4('0x8')]=function(_0x3b074d,_0x3aa43d,_0x28f78b,_0xfd74e){return function(_0x3b4aef){try{var _0x969746={'tag':_0x3aa43d[0x0]};var _0x52fbe4=tag[_0xc2e4('0x0')](_0x969746,{'typecast':!![]});if(_0x52fbe4[_0xc2e4('0x9')]){logger[_0xc2e4('0xa')](_0xc2e4('0xb'),_0x3b074d,_[_0xc2e4('0xc')](_0x52fbe4,'message')[_0xc2e4('0xd')](',\x20'));logger[_0xc2e4('0xe')](_0xc2e4('0xf'),_0x3b074d);_0x3b4aef[_0xc2e4('0x10')]();}else{var _0x597484={'ids':[_0x3aa43d[0x0]]};if(rpc[_0xfd74e[_0xc2e4('0x11')]+_0xc2e4('0x12')]){rpc[_0xfd74e[_0xc2e4('0x11')]+_0xc2e4('0x12')]['addTags'](_0xfd74e[_0xc2e4('0x13')]['id'],_0x597484)[_0xc2e4('0x14')](function(_0x3fee6d){logger['info'](_0xc2e4('0x15'),_0x3b074d,_0x3aa43d[0x1],_0xfd74e[_0xc2e4('0x11')],_0xfd74e[_0xc2e4('0x13')]['id']);})[_0xc2e4('0x16')](function(_0x5ad605){logger[_0xc2e4('0xa')](_0xc2e4('0xb'),_0x3b074d,JSON[_0xc2e4('0x17')](_0x5ad605));logger[_0xc2e4('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3b074d);})[_0xc2e4('0x18')](function(){_0x3b4aef[_0xc2e4('0x10')]();});}}}catch(_0x4a604f){logger[_0xc2e4('0xa')](_0xc2e4('0xb'),_0x3b074d,_[_0xc2e4('0x19')](_0x4a604f)?JSON[_0xc2e4('0x17')](_0x4a604f):_0x4a604f);logger[_0xc2e4('0xe')](_0xc2e4('0xf'),_0x3b074d);_0x3b4aef[_0xc2e4('0x10')]();}};}; \ No newline at end of file +var _0xe55f=['join','next','channel','Interaction','addTags','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','finally','isObject','validate','lodash','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message'];(function(_0x3e8fbd,_0x4c963e){var _0x336f26=function(_0x22b361){while(--_0x22b361){_0x3e8fbd['push'](_0x3e8fbd['shift']());}};_0x336f26(++_0x4c963e);}(_0xe55f,0xc9));var _0xfe55=function(_0x309df4,_0x3391db){_0x309df4=_0x309df4-0x0;var _0x4be8fc=_0xe55f[_0x309df4];return _0x4be8fc;};'use strict';var schema=require(_0xfe55('0x0'));var _=require(_0xfe55('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xfe55('0x2')),'faxInteraction':require(_0xfe55('0x3')),'whatsappInteraction':require(_0xfe55('0x4'))};var logger=require(_0xfe55('0x5'))(_0xfe55('0x6'));var tag=schema({'tag':{'type':_0xfe55('0x7'),'required':!![],'message':_0xfe55('0x8')}});exports[_0xfe55('0x9')]=function(_0xceabed,_0x581946,_0x545f1b,_0x2c58d3){return function(_0x332277){try{var _0x44fff7={'tag':_0x581946[0x0]};var _0x47e40d=tag[_0xfe55('0x0')](_0x44fff7,{'typecast':!![]});if(_0x47e40d[_0xfe55('0xa')]){logger[_0xfe55('0xb')](_0xfe55('0xc'),_0xceabed,_[_0xfe55('0xd')](_0x47e40d,_0xfe55('0xe'))[_0xfe55('0xf')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xceabed);_0x332277[_0xfe55('0x10')]();}else{var _0x10e157={'ids':[_0x581946[0x0]]};if(rpc[_0x2c58d3[_0xfe55('0x11')]+_0xfe55('0x12')]){rpc[_0x2c58d3[_0xfe55('0x11')]+'Interaction'][_0xfe55('0x13')](_0x2c58d3[_0xfe55('0x14')]['id'],_0x10e157)[_0xfe55('0x15')](function(_0x5df822){logger[_0xfe55('0x16')](_0xfe55('0x17'),_0xceabed,_0x581946[0x1],_0x2c58d3[_0xfe55('0x11')],_0x2c58d3[_0xfe55('0x14')]['id']);})[_0xfe55('0x18')](function(_0x5eb8a0){logger[_0xfe55('0xb')](_0xfe55('0xc'),_0xceabed,JSON['stringify'](_0x5eb8a0));logger[_0xfe55('0x16')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xceabed);})[_0xfe55('0x19')](function(){_0x332277['next']();});}}}catch(_0x473743){logger[_0xfe55('0xb')](_0xfe55('0xc'),_0xceabed,_[_0xfe55('0x1a')](_0x473743)?JSON['stringify'](_0x473743):_0x473743);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xceabed);_0x332277[_0xfe55('0x10')]();}};}; \ 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 7c134bb..d539025 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 _0x9099=['render','merge','body','contact','message','account','interaction','list','mustache','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9099,0x1ac));var _0x9909=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x9099[_0x3054be];return _0x3df150;};'use strict';var Mustache=require(_0x9909('0x0'));var _=require('lodash');module[_0x9909('0x1')]={'getMustacheRender':function(_0x308397,_0x38e636){return Mustache[_0x9909('0x2')](_0x308397,_[_0x9909('0x3')](_0x38e636[_0x9909('0x4')],{'contact':_0x38e636[_0x9909('0x5')],'message':_0x38e636[_0x9909('0x6')],'account':_0x38e636[_0x9909('0x7')],'interaction':_0x38e636[_0x9909('0x8')],'list':_0x38e636[_0x9909('0x9')]}))||'';}}; \ No newline at end of file +var _0x35aa=['list','lodash','exports','merge','body','contact','message','account','interaction'];(function(_0x2fc1f6,_0x51543e){var _0x7a3346=function(_0x589b08){while(--_0x589b08){_0x2fc1f6['push'](_0x2fc1f6['shift']());}};_0x7a3346(++_0x51543e);}(_0x35aa,0xbe));var _0xa35a=function(_0x106c88,_0x1de8f1){_0x106c88=_0x106c88-0x0;var _0x264319=_0x35aa[_0x106c88];return _0x264319;};'use strict';var Mustache=require('mustache');var _=require(_0xa35a('0x0'));module[_0xa35a('0x1')]={'getMustacheRender':function(_0x9a3c63,_0x3518ac){return Mustache['render'](_0x9a3c63,_[_0xa35a('0x2')](_0x3518ac[_0xa35a('0x3')],{'contact':_0x3518ac[_0xa35a('0x4')],'message':_0x3518ac[_0xa35a('0x5')],'account':_0x3518ac[_0xa35a('0x6')],'interaction':_0x3518ac[_0xa35a('0x7')],'list':_0x3518ac[_0xa35a('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index eab9554..d15dfbf 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 _0x0faf=['CurrentCapacity','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','map','Intervals','interval','rules','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','channel','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','./interval','condition','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','execute','matchPath','emit','complete','stack','routing\x20is\x20empty','agent','busy','busyQueue','end','QueueReport','update','UserId','message\x20is\x20empty','agents','hasOwnProperty','capacity'];(function(_0x12165d,_0x474ca0){var _0x5bb8ee=function(_0x390f53){while(--_0x390f53){_0x12165d['push'](_0x12165d['shift']());}};_0x5bb8ee(++_0x474ca0);}(_0x0faf,0x132));var _0xf0fa=function(_0x187d80,_0x5b793f){_0x187d80=_0x187d80-0x0;var _0x498a77=_0x0faf[_0x187d80];return _0x498a77;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var path=require(_0xf0fa('0x1'));var fs=require('fs');var jayson=require(_0xf0fa('0x2'));var BPromise=require(_0xf0fa('0x3'));var uuid=require(_0xf0fa('0x4'));var config=require(_0xf0fa('0x5'));var logger=require(_0xf0fa('0x6'))(_0xf0fa('0x7'));var rpc={'openchannelQueueReport':require(_0xf0fa('0x8')),'mailQueueReport':require(_0xf0fa('0x9')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xf0fa('0xa')),'faxQueueReport':require(_0xf0fa('0xb')),'whatsappQueueReport':require(_0xf0fa('0xc'))};var RuleEngine=require(_0xf0fa('0xd'));function getId(_0x2db1d9,_0x587865,_0x42f7fd){return util[_0xf0fa('0xe')]('%s.%s.%s',_0x2db1d9,_0x587865||0x0,_0x42f7fd||0x0);}function getIntervals(_0x4df4d1,_0x3bda51){var _0x1e8cc0=[];if(!_[_0xf0fa('0xf')](_0x3bda51[_0xf0fa('0x10')])&&!_[_0xf0fa('0xf')](_0x4df4d1[_0x3bda51[_0xf0fa('0x10')]])&&!_[_0xf0fa('0xf')](_0x4df4d1[_0x3bda51[_0xf0fa('0x10')]]['Intervals'])){_0x1e8cc0=_[_0xf0fa('0x11')](_0x4df4d1[_0x3bda51['IntervalId']][_0xf0fa('0x12')],'interval');}else if(!_[_0xf0fa('0xf')](_0x3bda51[_0xf0fa('0x13')])){_0x1e8cc0=[_0x3bda51[_0xf0fa('0x13')]];}return _0x1e8cc0;}exports['listen']=function(_0x5821ae){_0x5821ae[_0xf0fa('0x14')]={};return new BPromise(function(_0x540a04,_0x1f7159){var _0x81fc49={'Start':function(_0x10ce43){var _0x3203ce=this;return new Promise(function(_0x467d5f,_0x33df80){if(_0x10ce43){try{var _0x28bab8=[];var _0x3f3bb7=getId(_0x10ce43['channel'],_0x10ce43[_0xf0fa('0x15')]?_0x10ce43[_0xf0fa('0x15')]['id']:0x0,_0x10ce43[_0xf0fa('0x16')]?_0x10ce43[_0xf0fa('0x16')]['id']:0x0);if(_0x10ce43[_0xf0fa('0x17')]&&_[_0xf0fa('0x18')](_0x10ce43['applications'])&&_0x10ce43['applications'][_0xf0fa('0x19')]){for(var _0x2751cc=0x0;_0x2751cc<_0x10ce43[_0xf0fa('0x17')][_0xf0fa('0x19')];_0x2751cc+=0x1){var _0x1a3620=_0x10ce43[_0xf0fa('0x17')][_0x2751cc];if(fs[_0xf0fa('0x1a')](path[_0xf0fa('0x1b')](__dirname,_0xf0fa('0x17'),_0x1a3620[_0xf0fa('0x1c')]+_0xf0fa('0x1d')))){var _0x5bead8=[];switch(_0x1a3620[_0xf0fa('0x1c')][_0xf0fa('0x1e')]()){case _0xf0fa('0x1f'):var _0x3300d2=_0x1a3620[_0xf0fa('0x20')][_0xf0fa('0x21')](',');if(_0x10ce43[_0xf0fa('0x22')]===_0xf0fa('0x23')){_0x5bead8[_0xf0fa('0x24')](_0x3300d2[0x0]);_0x5bead8['push'](_0x3300d2[0x1]);_0x5bead8[_0xf0fa('0x24')](_0x3300d2[_0xf0fa('0x25')](0x2,_0x3300d2['length'])[_0xf0fa('0x1b')](','));}else{_0x5bead8[_0xf0fa('0x24')](_0x3300d2[0x0]);_0x5bead8[_0xf0fa('0x24')](_0x3300d2['slice'](0x1,_0x3300d2[_0xf0fa('0x19')])[_0xf0fa('0x1b')](','));}break;case _0xf0fa('0x26'):var _0xf631f6=_0x1a3620['appdata']['split'](',');_0x5bead8[_0xf0fa('0x24')](_0xf631f6[0x0]);_0x5bead8[_0xf0fa('0x24')](_0xf631f6[0x1]);_0x5bead8[_0xf0fa('0x24')](_0xf631f6[_0xf0fa('0x25')](0x2,_0xf631f6['length'])[_0xf0fa('0x1b')](','));break;case _0xf0fa('0x27'):var _0x1279cf=_0x1a3620['appdata'][_0xf0fa('0x21')](',');_0x5bead8['push'](_0x1279cf[0x0]);_0x5bead8[_0xf0fa('0x24')](_0x1279cf[0x1]);_0x5bead8[_0xf0fa('0x24')](_0x1279cf[0x2]);_0x5bead8[_0xf0fa('0x24')](_0x1279cf[0x3]);_0x5bead8['push'](_0x1279cf[_0xf0fa('0x25')](0x4,_0x1279cf[_0xf0fa('0x19')])[_0xf0fa('0x1b')](','));break;case _0xf0fa('0x28'):var _0x2cb17d=_0x1a3620[_0xf0fa('0x20')]['split'](',');_0x5bead8['push'](_0x2cb17d[0x0]);_0x5bead8[_0xf0fa('0x24')](_0x2cb17d[0x1]);_0x5bead8[_0xf0fa('0x24')](_0x2cb17d[0x2]);_0x5bead8['push'](_0x2cb17d[0x3]);_0x5bead8[_0xf0fa('0x24')](_0x2cb17d['slice'](0x4,_0x2cb17d['length'])['join'](','));break;case _0xf0fa('0x15'):_0x5bead8['push'](_0x1a3620[_0xf0fa('0x20')]);break;case _0xf0fa('0x29'):_0x5bead8[_0xf0fa('0x24')](_0x1a3620[_0xf0fa('0x2a')]);_0x5bead8[_0xf0fa('0x24')](_0x1a3620[_0xf0fa('0x20')]);break;default:_0x5bead8=_[_0xf0fa('0xf')](_0x1a3620[_0xf0fa('0x20')])?[]:_0x1a3620['appdata'][_0xf0fa('0x21')](',');}var _0x307aa8={'id':util[_0xf0fa('0xe')]('%s:%s:%s',_0x3f3bb7,_0x1a3620['id'],_0x1a3620[_0xf0fa('0x1c')]),'condition':require(_0xf0fa('0x2b'))[_0xf0fa('0x2c')](_0x3f3bb7,getIntervals(_0x5821ae[_0xf0fa('0x2d')],_0x1a3620),_0x5821ae),'consequence':require('./applications/'+_0x1a3620['app'])[_0xf0fa('0x2e')](_0x3f3bb7,_0x5bead8,_0x5821ae,_0x10ce43),'p':_0x1a3620[_0xf0fa('0x2f')]||0x0};logger[_0xf0fa('0x30')](_0xf0fa('0x31'),_0x307aa8['id'],_0xf0fa('0x32'),getIntervals(_0x5821ae['intervals'],_0x1a3620)['join']('\x20|\x20'));_0x28bab8['push'](_0x307aa8);}else{logger[_0xf0fa('0x33')](_0xf0fa('0x34'),path['join'](__dirname,'applications',_0x1a3620[_0xf0fa('0x1c')]+_0xf0fa('0x1d')));}}_0x5821ae[_0xf0fa('0x14')][_0x3f3bb7]=new RuleEngine(_0x28bab8);_0x5821ae[_0xf0fa('0x14')][_0x3f3bb7][_0xf0fa('0x35')](_0x10ce43,function(_0x12bd8c){logger[_0xf0fa('0x30')]('Applications\x20executed',JSON['stringify'](_0x12bd8c[_0xf0fa('0x36')]));if(_0x5821ae[_0xf0fa('0x14')][_0x3f3bb7]){_0x5821ae[_0xf0fa('0x14')][_0x3f3bb7][_0xf0fa('0x37')](_0xf0fa('0x38'));}});return _0x467d5f({'code':0xc8,'message':_0x10ce43});}else{logger[_0xf0fa('0x30')]('No\x20applications\x20to\x20execute');return _0x467d5f({'code':0xc8,'message':_0x10ce43});}}catch(_0x17d3a5){logger['error'](_0x17d3a5[_0xf0fa('0x39')]);return _0x33df80(_0x3203ce[_0xf0fa('0x33')](0x1f4,_0x17d3a5));}}return _0x33df80(_0xf0fa('0x3a'));});},'AcceptMessage':function(_0x4107ba){var _0x14bee8=this;return new Promise(function(_0x8cce53,_0x14c962){if(_0x4107ba[_0xf0fa('0x3b')]&&_0x4107ba[_0xf0fa('0x3b')]['id']){if(_0x5821ae['agents'][_0x4107ba['agent']['id']]){_0x5821ae['agents'][_0x4107ba[_0xf0fa('0x3b')]['id']][_0xf0fa('0x3c')]=![];_0x5821ae['agents'][_0x4107ba[_0xf0fa('0x3b')]['id']][_0xf0fa('0x3d')]=undefined;}}if(_0x4107ba[_0xf0fa('0x15')]&&_0x4107ba[_0xf0fa('0x15')]['id']){try{var _0x49e029=getId(_0x4107ba[_0xf0fa('0x22')],_0x4107ba[_0xf0fa('0x15')]?_0x4107ba[_0xf0fa('0x15')]['id']:0x0,_0x4107ba[_0xf0fa('0x16')]?_0x4107ba[_0xf0fa('0x16')]['id']:0x0);if(_0x5821ae[_0xf0fa('0x14')][_0x49e029]){_0x5821ae[_0xf0fa('0x14')][_0x49e029][_0xf0fa('0x37')](_0xf0fa('0x3e'));if(rpc[_0x4107ba['channel']+_0xf0fa('0x3f')]){rpc[_0x4107ba[_0xf0fa('0x22')]+_0xf0fa('0x3f')][_0xf0fa('0x40')](_0x49e029,{'UserId':_0x4107ba[_0xf0fa('0x15')][_0xf0fa('0x41')]})['catch'](function(_0xd86643){logger[_0xf0fa('0x33')]('error\x20update\x20queue\x20report');});}}return _0x8cce53({'code':0xc8,'message':_0x4107ba});}catch(_0x1e13f6){logger[_0xf0fa('0x33')](_0x1e13f6[_0xf0fa('0x39')]);return _0x14c962(_0x14bee8[_0xf0fa('0x33')](0x1f4,_0x1e13f6));}}logger[_0xf0fa('0x33')](_0xf0fa('0x42'));return _0x14c962(_0x14bee8[_0xf0fa('0x33')](0x1f4,_0xf0fa('0x42')));});},'RejectMessage':function(_0x35272e){var _0x4cd85e=this;return new Promise(function(_0x32ac29,_0x4b1f41){if(_0x35272e[_0xf0fa('0x3b')]&&_0x35272e[_0xf0fa('0x3b')]['id']){try{if(_0x5821ae[_0xf0fa('0x43')][_0x35272e['agent']['id']]){_0x5821ae[_0xf0fa('0x43')][_0x35272e[_0xf0fa('0x3b')]['id']][_0xf0fa('0x3c')]=![];_0x5821ae[_0xf0fa('0x43')][_0x35272e[_0xf0fa('0x3b')]['id']]['busyQueue']=undefined;}return _0x32ac29({'code':0xc8,'message':_0x35272e});}catch(_0xbfcbff){logger['error'](_0xbfcbff[_0xf0fa('0x39')]);return _0x4b1f41(_0x4cd85e[_0xf0fa('0x33')](0x1f4,_0xbfcbff));}}logger[_0xf0fa('0x33')](_0xf0fa('0x42'));return _0x4b1f41(_0x4cd85e[_0xf0fa('0x33')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x368f0c){var _0x1ea31d=this;return new Promise(function(_0x26b1dc,_0x401995){if(_0x368f0c[_0xf0fa('0x22')]&&_0x368f0c[_0xf0fa('0x16')]&&_0x368f0c['interaction']['id']){try{var _0x44a3bf=getId(_0x368f0c['channel'],_0x368f0c['message']?_0x368f0c['message']['id']:0x0,_0x368f0c[_0xf0fa('0x16')]?_0x368f0c[_0xf0fa('0x16')]['id']:0x0);if(_0x5821ae[_0xf0fa('0x14')][_0x44a3bf]){_0x5821ae[_0xf0fa('0x14')][_0x44a3bf][_0xf0fa('0x37')](_0xf0fa('0x3e'));}return _0x26b1dc({'code':0xc8,'message':_0x368f0c});}catch(_0x3c269c){logger[_0xf0fa('0x33')](_0x3c269c[_0xf0fa('0x39')]);return _0x401995(_0x1ea31d['error'](0x1f4,_0x3c269c));}}logger[_0xf0fa('0x33')]('message\x20is\x20empty');return _0x401995(_0x1ea31d[_0xf0fa('0x33')](0x1f4,_0xf0fa('0x42')));});},'AgentCapacity':function(_0x1f95dc){var _0x2d0242=this;return new Promise(function(_0x482cfb,_0x36e343){if(_0x5821ae['agents'][_0xf0fa('0x44')](_0x1f95dc['id'])){for(var _0x398ea0 in _0x1f95dc[_0xf0fa('0x45')]){if(_0x1f95dc[_0xf0fa('0x45')][_0xf0fa('0x44')](_0x398ea0)){if(_0x5821ae[_0xf0fa('0x43')][_0x1f95dc['id']]['hasOwnProperty'](_0x398ea0+_0xf0fa('0x46'))){_0x5821ae[_0xf0fa('0x43')][_0x1f95dc['id']][_0x398ea0+'CurrentCapacity']=parseInt(_0x1f95dc[_0xf0fa('0x45')][_0x398ea0],0xa);}}}_0x5821ae[_0xf0fa('0x43')][_0x1f95dc['id']]['updateRealtime']();return _0x482cfb({'code':0xc8,'message':_0x5821ae[_0xf0fa('0x43')][_0x1f95dc['id']]});}else{return _0x36e343(_0x2d0242[_0xf0fa('0x33')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0xd01a7a){return new Promise(function(_0x3c5014,_0xd7cd1a){var _0x4db972=_[_0xf0fa('0x47')](_0x5821ae[_0xf0fa('0x43')]);_0x3c5014({'count':_0x4db972['length'],'rows':_0x4db972});});},'ChatQueues':function(_0x22ed85){return new Promise(function(_0x34147c,_0x3369e1){var _0x588843=[];for(var _0x3ac82c in _0x5821ae[_0xf0fa('0x48')]){if(_0x5821ae['chatQueues'][_0xf0fa('0x44')](_0x3ac82c)){var _0x76b183=_0x5821ae[_0xf0fa('0x48')][_0x3ac82c];var _0x2b04a8={'id':_0x76b183['id'],'available':_0x76b183[_0xf0fa('0x49')],'loggedIn':_0x76b183[_0xf0fa('0x4a')],'name':_0x76b183[_0xf0fa('0x4b')],'paused':_0x76b183[_0xf0fa('0x4c')],'waiting':_0x76b183[_0xf0fa('0x4d')]};_0x588843[_0xf0fa('0x24')](_0x2b04a8);}}_0x34147c({'count':_0x588843['length'],'rows':_0x588843});});},'MailQueues':function(_0x427499){return new Promise(function(_0x27801d,_0x298f47){var _0x664a0d=[];for(var _0x2e9d58 in _0x5821ae[_0xf0fa('0x4e')]){if(_0x5821ae[_0xf0fa('0x4e')]['hasOwnProperty'](_0x2e9d58)){var _0x39fd4e=_0x5821ae[_0xf0fa('0x4e')][_0x2e9d58];var _0x29e3e1={'id':_0x39fd4e['id'],'available':_0x39fd4e[_0xf0fa('0x49')],'loggedIn':_0x39fd4e[_0xf0fa('0x4a')],'name':_0x39fd4e[_0xf0fa('0x4b')],'paused':_0x39fd4e[_0xf0fa('0x4c')],'waiting':_0x39fd4e['waiting']};_0x664a0d[_0xf0fa('0x24')](_0x29e3e1);}}_0x27801d({'count':_0x664a0d[_0xf0fa('0x19')],'rows':_0x664a0d});});},'OpenchannelQueues':function(_0x2e21ba){return new Promise(function(_0x1f608e,_0x473e3d){var _0x5bf7f2=[];for(var _0x5f023b in _0x5821ae['openchannelQueues']){if(_0x5821ae[_0xf0fa('0x4f')][_0xf0fa('0x44')](_0x5f023b)){var _0x405012=_0x5821ae[_0xf0fa('0x4f')][_0x5f023b];var _0x508df9={'id':_0x405012['id'],'available':_0x405012['available'],'loggedIn':_0x405012[_0xf0fa('0x4a')],'name':_0x405012['name'],'paused':_0x405012[_0xf0fa('0x4c')],'waiting':_0x405012[_0xf0fa('0x4d')]};_0x5bf7f2[_0xf0fa('0x24')](_0x508df9);}}_0x1f608e({'count':_0x5bf7f2[_0xf0fa('0x19')],'rows':_0x5bf7f2});});},'SmsQueues':function(_0x1b4c03){return new Promise(function(_0x57ea2c,_0x130e56){var _0xdc09c7=[];for(var _0x98d4e7 in _0x5821ae[_0xf0fa('0x50')]){if(_0x5821ae[_0xf0fa('0x50')][_0xf0fa('0x44')](_0x98d4e7)){var _0x30f0fe=_0x5821ae[_0xf0fa('0x50')][_0x98d4e7];var _0x10ddfb={'id':_0x30f0fe['id'],'available':_0x30f0fe['available'],'loggedIn':_0x30f0fe['loggedIn'],'name':_0x30f0fe[_0xf0fa('0x4b')],'paused':_0x30f0fe['paused'],'waiting':_0x30f0fe[_0xf0fa('0x4d')]};_0xdc09c7['push'](_0x10ddfb);}}_0x57ea2c({'count':_0xdc09c7['length'],'rows':_0xdc09c7});});},'FaxQueues':function(_0x4a851b){return new Promise(function(_0x3d1354,_0x415a1b){var _0x735e07=[];for(var _0xb31dcf in _0x5821ae[_0xf0fa('0x51')]){if(_0x5821ae[_0xf0fa('0x51')][_0xf0fa('0x44')](_0xb31dcf)){var _0x2b7965=_0x5821ae[_0xf0fa('0x51')][_0xb31dcf];var _0x1cd67c={'id':_0x2b7965['id'],'available':_0x2b7965['available'],'loggedIn':_0x2b7965[_0xf0fa('0x4a')],'name':_0x2b7965['name'],'paused':_0x2b7965[_0xf0fa('0x4c')],'waiting':_0x2b7965['waiting']};_0x735e07[_0xf0fa('0x24')](_0x1cd67c);}}_0x3d1354({'count':_0x735e07['length'],'rows':_0x735e07});});},'WhatsappQueues':function(_0xfc616e){return new Promise(function(_0x50ddd6,_0x15f4d5){var _0x1e0566=[];for(var _0x274ae3 in _0x5821ae[_0xf0fa('0x52')]){if(_0x5821ae[_0xf0fa('0x52')]['hasOwnProperty'](_0x274ae3)){var _0x47be30=_0x5821ae[_0xf0fa('0x52')][_0x274ae3];var _0x157772={'id':_0x47be30['id'],'available':_0x47be30['available'],'loggedIn':_0x47be30['loggedIn'],'name':_0x47be30[_0xf0fa('0x4b')],'paused':_0x47be30[_0xf0fa('0x4c')],'waiting':_0x47be30[_0xf0fa('0x4d')]};_0x1e0566[_0xf0fa('0x24')](_0x157772);}}_0x50ddd6({'count':_0x1e0566[_0xf0fa('0x19')],'rows':_0x1e0566});});},'ChatQueuesWaitingInteractions':function(_0x56838f){return new Promise(function(_0x1a661d,_0x3bdb88){var _0x16492b=_['values'](_0x5821ae['chatQueuesWaitingInteractions']);_0x1a661d({'count':_0x16492b[_0xf0fa('0x19')],'rows':_0x16492b});});},'MailQueuesWaitingInteractions':function(_0x1d0183){return new Promise(function(_0x552e93,_0x4c1032){var _0x3ca20b=_[_0xf0fa('0x47')](_0x5821ae[_0xf0fa('0x53')]);_0x552e93({'count':_0x3ca20b['length'],'rows':_0x3ca20b});});},'OpenchannelQueuesWaitingInteractions':function(_0x5cdd16){return new Promise(function(_0x516eec,_0x39711c){var _0x4df165=_['values'](_0x5821ae[_0xf0fa('0x54')]);_0x516eec({'count':_0x4df165[_0xf0fa('0x19')],'rows':_0x4df165});});},'SmsQueuesWaitingInteractions':function(_0x2ef783){return new Promise(function(_0x323464,_0x364a88){var _0x4f51d7=_['values'](_0x5821ae[_0xf0fa('0x55')]);_0x323464({'count':_0x4f51d7[_0xf0fa('0x19')],'rows':_0x4f51d7});});},'FaxQueuesWaitingInteractions':function(_0x15dda8){return new Promise(function(_0x5f02c4,_0x913364){var _0x4b803f=_['values'](_0x5821ae[_0xf0fa('0x56')]);_0x5f02c4({'count':_0x4b803f['length'],'rows':_0x4b803f});});},'WhatsappQueuesWaitingInteractions':function(_0x58811b){return new Promise(function(_0x1f8977,_0x418ee8){var _0x83ea6d=_['values'](_0x5821ae[_0xf0fa('0x57')]);_0x1f8977({'count':_0x83ea6d[_0xf0fa('0x19')],'rows':_0x83ea6d});});}};var _0x552b9e=jayson[_0xf0fa('0x58')](_0x81fc49)[_0xf0fa('0x59')]();_0x552b9e['on'](_0xf0fa('0x33'),function(_0xe232f8){logger[_0xf0fa('0x33')](JSON[_0xf0fa('0x5a')](_0xe232f8));return _0x1f7159(_0xe232f8);});_0x552b9e['listen'](0x232c,_0xf0fa('0x5b'),function(){console['log'](_0xf0fa('0x5c'),0x232c);return _0x540a04(_0xf0fa('0x5d')+0x232c);});});}; \ No newline at end of file +var _0x0f9f=['applications','length','app','.js','autoreply','appdata','split','push','join','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','busy','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction'];(function(_0x5dd32f,_0x2f7c80){var _0x3764f8=function(_0xa4b0f8){while(--_0xa4b0f8){_0x5dd32f['push'](_0x5dd32f['shift']());}};_0x3764f8(++_0x2f7c80);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x288602,_0x56f26f){_0x288602=_0x288602-0x0;var _0x46420c=_0x0f9f[_0x288602];return _0x46420c;};'use strict';var _=require('lodash');var util=require(_0xf0f9('0x0'));var path=require(_0xf0f9('0x1'));var fs=require('fs');var jayson=require(_0xf0f9('0x2'));var BPromise=require('bluebird');var uuid=require(_0xf0f9('0x3'));var config=require(_0xf0f9('0x4'));var logger=require(_0xf0f9('0x5'))(_0xf0f9('0x6'));var rpc={'openchannelQueueReport':require(_0xf0f9('0x7')),'mailQueueReport':require(_0xf0f9('0x8')),'chatQueueReport':require(_0xf0f9('0x9')),'smsQueueReport':require(_0xf0f9('0xa')),'faxQueueReport':require(_0xf0f9('0xb')),'whatsappQueueReport':require(_0xf0f9('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x448cf5,_0x294b42,_0x5d1753){return util[_0xf0f9('0xd')](_0xf0f9('0xe'),_0x448cf5,_0x294b42||0x0,_0x5d1753||0x0);}function getIntervals(_0x2d72c9,_0x5ab12e){var _0x196f21=[];if(!_[_0xf0f9('0xf')](_0x5ab12e[_0xf0f9('0x10')])&&!_['isNil'](_0x2d72c9[_0x5ab12e['IntervalId']])&&!_[_0xf0f9('0xf')](_0x2d72c9[_0x5ab12e[_0xf0f9('0x10')]][_0xf0f9('0x11')])){_0x196f21=_[_0xf0f9('0x12')](_0x2d72c9[_0x5ab12e[_0xf0f9('0x10')]][_0xf0f9('0x11')],_0xf0f9('0x13'));}else if(!_['isNil'](_0x5ab12e[_0xf0f9('0x13')])){_0x196f21=[_0x5ab12e[_0xf0f9('0x13')]];}return _0x196f21;}exports[_0xf0f9('0x14')]=function(_0x200514){_0x200514[_0xf0f9('0x15')]={};return new BPromise(function(_0x51d78a,_0x459c76){var _0x35aa5d={'Start':function(_0xa7d48c){var _0x2e2955=this;return new Promise(function(_0x2b05e3,_0x2f5bec){if(_0xa7d48c){try{var _0x2f75da=[];var _0x16a928=getId(_0xa7d48c[_0xf0f9('0x16')],_0xa7d48c[_0xf0f9('0x17')]?_0xa7d48c['message']['id']:0x0,_0xa7d48c['interaction']?_0xa7d48c[_0xf0f9('0x18')]['id']:0x0);if(_0xa7d48c[_0xf0f9('0x19')]&&_['isArray'](_0xa7d48c[_0xf0f9('0x19')])&&_0xa7d48c['applications']['length']){for(var _0x42c157=0x0;_0x42c157<_0xa7d48c[_0xf0f9('0x19')][_0xf0f9('0x1a')];_0x42c157+=0x1){var _0x1432f7=_0xa7d48c[_0xf0f9('0x19')][_0x42c157];if(fs['existsSync'](path['join'](__dirname,'applications',_0x1432f7[_0xf0f9('0x1b')]+_0xf0f9('0x1c')))){var _0x126ba7=[];switch(_0x1432f7['app']['toLowerCase']()){case _0xf0f9('0x1d'):var _0x550728=_0x1432f7[_0xf0f9('0x1e')][_0xf0f9('0x1f')](',');if(_0xa7d48c[_0xf0f9('0x16')]==='mail'){_0x126ba7[_0xf0f9('0x20')](_0x550728[0x0]);_0x126ba7[_0xf0f9('0x20')](_0x550728[0x1]);_0x126ba7[_0xf0f9('0x20')](_0x550728['slice'](0x2,_0x550728[_0xf0f9('0x1a')])[_0xf0f9('0x21')](','));}else{_0x126ba7[_0xf0f9('0x20')](_0x550728[0x0]);_0x126ba7[_0xf0f9('0x20')](_0x550728[_0xf0f9('0x22')](0x1,_0x550728[_0xf0f9('0x1a')])['join'](','));}break;case _0xf0f9('0x23'):var _0x56663e=_0x1432f7[_0xf0f9('0x1e')][_0xf0f9('0x1f')](',');_0x126ba7['push'](_0x56663e[0x0]);_0x126ba7['push'](_0x56663e[0x1]);_0x126ba7[_0xf0f9('0x20')](_0x56663e['slice'](0x2,_0x56663e[_0xf0f9('0x1a')])[_0xf0f9('0x21')](','));break;case _0xf0f9('0x24'):var _0x353502=_0x1432f7[_0xf0f9('0x1e')][_0xf0f9('0x1f')](',');_0x126ba7[_0xf0f9('0x20')](_0x353502[0x0]);_0x126ba7[_0xf0f9('0x20')](_0x353502[0x1]);_0x126ba7[_0xf0f9('0x20')](_0x353502[0x2]);_0x126ba7['push'](_0x353502[0x3]);_0x126ba7[_0xf0f9('0x20')](_0x353502[_0xf0f9('0x22')](0x4,_0x353502['length'])['join'](','));break;case _0xf0f9('0x25'):var _0x49d3bc=_0x1432f7['appdata'][_0xf0f9('0x1f')](',');_0x126ba7['push'](_0x49d3bc[0x0]);_0x126ba7[_0xf0f9('0x20')](_0x49d3bc[0x1]);_0x126ba7[_0xf0f9('0x20')](_0x49d3bc[0x2]);_0x126ba7['push'](_0x49d3bc[0x3]);_0x126ba7['push'](_0x49d3bc[_0xf0f9('0x22')](0x4,_0x49d3bc[_0xf0f9('0x1a')])[_0xf0f9('0x21')](','));break;case _0xf0f9('0x17'):_0x126ba7[_0xf0f9('0x20')](_0x1432f7[_0xf0f9('0x1e')]);break;case _0xf0f9('0x26'):_0x126ba7[_0xf0f9('0x20')](_0x1432f7[_0xf0f9('0x27')]);_0x126ba7[_0xf0f9('0x20')](_0x1432f7[_0xf0f9('0x1e')]);break;default:_0x126ba7=_[_0xf0f9('0xf')](_0x1432f7[_0xf0f9('0x1e')])?[]:_0x1432f7['appdata'][_0xf0f9('0x1f')](',');}var _0x5c7028={'id':util[_0xf0f9('0xd')](_0xf0f9('0x28'),_0x16a928,_0x1432f7['id'],_0x1432f7[_0xf0f9('0x1b')]),'condition':require(_0xf0f9('0x29'))[_0xf0f9('0x2a')](_0x16a928,getIntervals(_0x200514[_0xf0f9('0x2b')],_0x1432f7),_0x200514),'consequence':require(_0xf0f9('0x2c')+_0x1432f7['app'])['consequence'](_0x16a928,_0x126ba7,_0x200514,_0xa7d48c),'p':_0x1432f7[_0xf0f9('0x2d')]||0x0};logger[_0xf0f9('0x2e')](_0xf0f9('0x2f'),_0x5c7028['id'],_0xf0f9('0x30'),getIntervals(_0x200514[_0xf0f9('0x2b')],_0x1432f7)['join'](_0xf0f9('0x31')));_0x2f75da[_0xf0f9('0x20')](_0x5c7028);}else{logger[_0xf0f9('0x32')](_0xf0f9('0x33'),path[_0xf0f9('0x21')](__dirname,'applications',_0x1432f7[_0xf0f9('0x1b')]+_0xf0f9('0x1c')));}}_0x200514[_0xf0f9('0x15')][_0x16a928]=new RuleEngine(_0x2f75da);_0x200514[_0xf0f9('0x15')][_0x16a928][_0xf0f9('0x34')](_0xa7d48c,function(_0x3054d6){logger['info'](_0xf0f9('0x35'),JSON[_0xf0f9('0x36')](_0x3054d6[_0xf0f9('0x37')]));if(_0x200514['rules'][_0x16a928]){_0x200514[_0xf0f9('0x15')][_0x16a928][_0xf0f9('0x38')](_0xf0f9('0x39'));}});return _0x2b05e3({'code':0xc8,'message':_0xa7d48c});}else{logger[_0xf0f9('0x2e')](_0xf0f9('0x3a'));return _0x2b05e3({'code':0xc8,'message':_0xa7d48c});}}catch(_0xcf7fb1){logger[_0xf0f9('0x32')](_0xcf7fb1[_0xf0f9('0x3b')]);return _0x2f5bec(_0x2e2955[_0xf0f9('0x32')](0x1f4,_0xcf7fb1));}}return _0x2f5bec(_0xf0f9('0x3c'));});},'AcceptMessage':function(_0x26694a){var _0x149870=this;return new Promise(function(_0x21672e,_0x5153b5){if(_0x26694a['agent']&&_0x26694a[_0xf0f9('0x3d')]['id']){if(_0x200514['agents'][_0x26694a['agent']['id']]){_0x200514['agents'][_0x26694a[_0xf0f9('0x3d')]['id']][_0xf0f9('0x3e')]=![];_0x200514[_0xf0f9('0x3f')][_0x26694a[_0xf0f9('0x3d')]['id']][_0xf0f9('0x40')]=undefined;}}if(_0x26694a[_0xf0f9('0x17')]&&_0x26694a[_0xf0f9('0x17')]['id']){try{var _0x2e1556=getId(_0x26694a[_0xf0f9('0x16')],_0x26694a['message']?_0x26694a[_0xf0f9('0x17')]['id']:0x0,_0x26694a[_0xf0f9('0x18')]?_0x26694a[_0xf0f9('0x18')]['id']:0x0);if(_0x200514['rules'][_0x2e1556]){_0x200514[_0xf0f9('0x15')][_0x2e1556][_0xf0f9('0x38')](_0xf0f9('0x41'));if(rpc[_0x26694a['channel']+_0xf0f9('0x42')]){rpc[_0x26694a[_0xf0f9('0x16')]+'QueueReport'][_0xf0f9('0x43')](_0x2e1556,{'UserId':_0x26694a[_0xf0f9('0x17')][_0xf0f9('0x44')]})[_0xf0f9('0x45')](function(_0x4be16e){logger[_0xf0f9('0x32')](_0xf0f9('0x46'));});}}return _0x21672e({'code':0xc8,'message':_0x26694a});}catch(_0xc29196){logger[_0xf0f9('0x32')](_0xc29196[_0xf0f9('0x3b')]);return _0x5153b5(_0x149870[_0xf0f9('0x32')](0x1f4,_0xc29196));}}logger['error'](_0xf0f9('0x47'));return _0x5153b5(_0x149870['error'](0x1f4,_0xf0f9('0x47')));});},'RejectMessage':function(_0x38956b){var _0x130fc8=this;return new Promise(function(_0x314e0c,_0x44b00d){if(_0x38956b[_0xf0f9('0x3d')]&&_0x38956b[_0xf0f9('0x3d')]['id']){try{if(_0x200514[_0xf0f9('0x3f')][_0x38956b[_0xf0f9('0x3d')]['id']]){_0x200514[_0xf0f9('0x3f')][_0x38956b[_0xf0f9('0x3d')]['id']][_0xf0f9('0x3e')]=![];_0x200514[_0xf0f9('0x3f')][_0x38956b[_0xf0f9('0x3d')]['id']][_0xf0f9('0x40')]=undefined;}return _0x314e0c({'code':0xc8,'message':_0x38956b});}catch(_0x3cb91a){logger[_0xf0f9('0x32')](_0x3cb91a[_0xf0f9('0x3b')]);return _0x44b00d(_0x130fc8[_0xf0f9('0x32')](0x1f4,_0x3cb91a));}}logger[_0xf0f9('0x32')](_0xf0f9('0x47'));return _0x44b00d(_0x130fc8[_0xf0f9('0x32')](0x1f4,_0xf0f9('0x47')));});},'AbandonInteraction':function(_0x37a928){var _0x53aedf=this;return new Promise(function(_0x5b4a52,_0x2eb8b4){if(_0x37a928['channel']&&_0x37a928[_0xf0f9('0x18')]&&_0x37a928[_0xf0f9('0x18')]['id']){try{var _0x1821bc=getId(_0x37a928['channel'],_0x37a928[_0xf0f9('0x17')]?_0x37a928['message']['id']:0x0,_0x37a928[_0xf0f9('0x18')]?_0x37a928[_0xf0f9('0x18')]['id']:0x0);if(_0x200514[_0xf0f9('0x15')][_0x1821bc]){_0x200514[_0xf0f9('0x15')][_0x1821bc][_0xf0f9('0x38')]('end');}return _0x5b4a52({'code':0xc8,'message':_0x37a928});}catch(_0x422e72){logger['error'](_0x422e72[_0xf0f9('0x3b')]);return _0x2eb8b4(_0x53aedf[_0xf0f9('0x32')](0x1f4,_0x422e72));}}logger[_0xf0f9('0x32')](_0xf0f9('0x47'));return _0x2eb8b4(_0x53aedf[_0xf0f9('0x32')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x4d1ab6){var _0x3b78aa=this;return new Promise(function(_0x1d30fb,_0x391ad0){if(_0x200514[_0xf0f9('0x3f')][_0xf0f9('0x48')](_0x4d1ab6['id'])){for(var _0x243626 in _0x4d1ab6[_0xf0f9('0x49')]){if(_0x4d1ab6[_0xf0f9('0x49')][_0xf0f9('0x48')](_0x243626)){if(_0x200514[_0xf0f9('0x3f')][_0x4d1ab6['id']][_0xf0f9('0x48')](_0x243626+_0xf0f9('0x4a'))){_0x200514[_0xf0f9('0x3f')][_0x4d1ab6['id']][_0x243626+'CurrentCapacity']=parseInt(_0x4d1ab6[_0xf0f9('0x49')][_0x243626],0xa);}}}_0x200514[_0xf0f9('0x3f')][_0x4d1ab6['id']][_0xf0f9('0x4b')]();return _0x1d30fb({'code':0xc8,'message':_0x200514['agents'][_0x4d1ab6['id']]});}else{return _0x391ad0(_0x3b78aa[_0xf0f9('0x32')](0x1f4,_0xf0f9('0x4c')));}});},'Agents':function(_0x22fe30){return new Promise(function(_0x115d02,_0x6979f){var _0x586022=_[_0xf0f9('0x4d')](_0x200514[_0xf0f9('0x3f')]);_0x115d02({'count':_0x586022[_0xf0f9('0x1a')],'rows':_0x586022});});},'ChatQueues':function(_0x2f3cfb){return new Promise(function(_0x2807f9,_0x445c85){var _0x1f263a=[];for(var _0x411e09 in _0x200514[_0xf0f9('0x4e')]){if(_0x200514[_0xf0f9('0x4e')]['hasOwnProperty'](_0x411e09)){var _0x3777ae=_0x200514[_0xf0f9('0x4e')][_0x411e09];var _0x51f80a={'id':_0x3777ae['id'],'available':_0x3777ae[_0xf0f9('0x4f')],'loggedIn':_0x3777ae['loggedIn'],'name':_0x3777ae[_0xf0f9('0x50')],'paused':_0x3777ae[_0xf0f9('0x51')],'waiting':_0x3777ae[_0xf0f9('0x52')]};_0x1f263a['push'](_0x51f80a);}}_0x2807f9({'count':_0x1f263a[_0xf0f9('0x1a')],'rows':_0x1f263a});});},'MailQueues':function(_0x41e895){return new Promise(function(_0x28879c,_0x142984){var _0x60dcbc=[];for(var _0xbca4b3 in _0x200514[_0xf0f9('0x53')]){if(_0x200514[_0xf0f9('0x53')][_0xf0f9('0x48')](_0xbca4b3)){var _0x12bf05=_0x200514[_0xf0f9('0x53')][_0xbca4b3];var _0x162305={'id':_0x12bf05['id'],'available':_0x12bf05['available'],'loggedIn':_0x12bf05[_0xf0f9('0x54')],'name':_0x12bf05[_0xf0f9('0x50')],'paused':_0x12bf05[_0xf0f9('0x51')],'waiting':_0x12bf05[_0xf0f9('0x52')]};_0x60dcbc['push'](_0x162305);}}_0x28879c({'count':_0x60dcbc[_0xf0f9('0x1a')],'rows':_0x60dcbc});});},'OpenchannelQueues':function(_0xb29b92){return new Promise(function(_0xb47567,_0x4ca78c){var _0x344a2b=[];for(var _0x359838 in _0x200514['openchannelQueues']){if(_0x200514[_0xf0f9('0x55')][_0xf0f9('0x48')](_0x359838)){var _0x5b3b40=_0x200514[_0xf0f9('0x55')][_0x359838];var _0x205480={'id':_0x5b3b40['id'],'available':_0x5b3b40[_0xf0f9('0x4f')],'loggedIn':_0x5b3b40[_0xf0f9('0x54')],'name':_0x5b3b40[_0xf0f9('0x50')],'paused':_0x5b3b40[_0xf0f9('0x51')],'waiting':_0x5b3b40[_0xf0f9('0x52')]};_0x344a2b['push'](_0x205480);}}_0xb47567({'count':_0x344a2b[_0xf0f9('0x1a')],'rows':_0x344a2b});});},'SmsQueues':function(_0x33f71c){return new Promise(function(_0x5cd450,_0x1ac791){var _0x539ac6=[];for(var _0x5bb76b in _0x200514[_0xf0f9('0x56')]){if(_0x200514[_0xf0f9('0x56')]['hasOwnProperty'](_0x5bb76b)){var _0x180c37=_0x200514['smsQueues'][_0x5bb76b];var _0x45606a={'id':_0x180c37['id'],'available':_0x180c37[_0xf0f9('0x4f')],'loggedIn':_0x180c37[_0xf0f9('0x54')],'name':_0x180c37['name'],'paused':_0x180c37[_0xf0f9('0x51')],'waiting':_0x180c37[_0xf0f9('0x52')]};_0x539ac6[_0xf0f9('0x20')](_0x45606a);}}_0x5cd450({'count':_0x539ac6[_0xf0f9('0x1a')],'rows':_0x539ac6});});},'FaxQueues':function(_0x4fb990){return new Promise(function(_0x1e64a5,_0x1e5018){var _0xc45b52=[];for(var _0x1541c8 in _0x200514[_0xf0f9('0x57')]){if(_0x200514[_0xf0f9('0x57')]['hasOwnProperty'](_0x1541c8)){var _0x451346=_0x200514[_0xf0f9('0x57')][_0x1541c8];var _0x12bfb0={'id':_0x451346['id'],'available':_0x451346[_0xf0f9('0x4f')],'loggedIn':_0x451346['loggedIn'],'name':_0x451346[_0xf0f9('0x50')],'paused':_0x451346['paused'],'waiting':_0x451346[_0xf0f9('0x52')]};_0xc45b52[_0xf0f9('0x20')](_0x12bfb0);}}_0x1e64a5({'count':_0xc45b52[_0xf0f9('0x1a')],'rows':_0xc45b52});});},'WhatsappQueues':function(_0x434ea0){return new Promise(function(_0x149f47,_0x166d02){var _0x3b8233=[];for(var _0x44eea9 in _0x200514[_0xf0f9('0x58')]){if(_0x200514[_0xf0f9('0x58')][_0xf0f9('0x48')](_0x44eea9)){var _0x12a3b0=_0x200514['whatsappQueues'][_0x44eea9];var _0x27c566={'id':_0x12a3b0['id'],'available':_0x12a3b0[_0xf0f9('0x4f')],'loggedIn':_0x12a3b0['loggedIn'],'name':_0x12a3b0[_0xf0f9('0x50')],'paused':_0x12a3b0[_0xf0f9('0x51')],'waiting':_0x12a3b0['waiting']};_0x3b8233['push'](_0x27c566);}}_0x149f47({'count':_0x3b8233[_0xf0f9('0x1a')],'rows':_0x3b8233});});},'ChatQueuesWaitingInteractions':function(_0xb1f145){return new Promise(function(_0x299c58,_0x1cba61){var _0x287b01=_[_0xf0f9('0x4d')](_0x200514['chatQueuesWaitingInteractions']);_0x299c58({'count':_0x287b01[_0xf0f9('0x1a')],'rows':_0x287b01});});},'MailQueuesWaitingInteractions':function(_0x3aa811){return new Promise(function(_0x126954,_0x3862a2){var _0x4826e4=_[_0xf0f9('0x4d')](_0x200514[_0xf0f9('0x59')]);_0x126954({'count':_0x4826e4[_0xf0f9('0x1a')],'rows':_0x4826e4});});},'OpenchannelQueuesWaitingInteractions':function(_0x5cee0d){return new Promise(function(_0x471e7d,_0x2c4171){var _0x5fcf00=_[_0xf0f9('0x4d')](_0x200514['openchannelQueuesWaitingInteractions']);_0x471e7d({'count':_0x5fcf00['length'],'rows':_0x5fcf00});});},'SmsQueuesWaitingInteractions':function(_0x3c1426){return new Promise(function(_0x104b27,_0x5bd5d0){var _0x475eac=_[_0xf0f9('0x4d')](_0x200514[_0xf0f9('0x5a')]);_0x104b27({'count':_0x475eac['length'],'rows':_0x475eac});});},'FaxQueuesWaitingInteractions':function(_0x65efa9){return new Promise(function(_0x370bf6,_0x53828b){var _0x34b032=_[_0xf0f9('0x4d')](_0x200514['faxQueuesWaitingInteractions']);_0x370bf6({'count':_0x34b032[_0xf0f9('0x1a')],'rows':_0x34b032});});},'WhatsappQueuesWaitingInteractions':function(_0xb3ab9b){return new Promise(function(_0x338e66,_0x18dff0){var _0x5047e2=_[_0xf0f9('0x4d')](_0x200514[_0xf0f9('0x5b')]);_0x338e66({'count':_0x5047e2[_0xf0f9('0x1a')],'rows':_0x5047e2});});}};var _0x4ce4e9=jayson['server'](_0x35aa5d)[_0xf0f9('0x5c')]();_0x4ce4e9['on']('error',function(_0x18e56b){logger[_0xf0f9('0x32')](JSON[_0xf0f9('0x36')](_0x18e56b));return _0x459c76(_0x18e56b);});_0x4ce4e9[_0xf0f9('0x14')](0x232c,_0xf0f9('0x5d'),function(){console[_0xf0f9('0x5e')](_0xf0f9('0x5f'),0x232c);return _0x51d78a(_0xf0f9('0x60')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 8dfc658..827541e 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 _0xbb39=['result','catch','condition','length','Command','format','iftime\x20%s','true','[%s][INTERVAL]\x20%s','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stop','util','bluebird','jayson/promise','../../../config/logger','routing','then','error','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb39,0x160));var _0x9bb3=function(_0x6cf5ec,_0x194d2e){_0x6cf5ec=_0x6cf5ec-0x0;var _0x271c4f=_0xbb39[_0x6cf5ec];return _0x271c4f;};'use strict';var util=require(_0x9bb3('0x0'));var BPromise=require(_0x9bb3('0x1'));var jayson=require(_0x9bb3('0x2'));var _=require('lodash');var logger=require(_0x9bb3('0x3'))(_0x9bb3('0x4'));var client=jayson['client']['http']({'port':0x232a});function request(_0x4eabfb,_0x536dcd){return new BPromise(function(_0x1a0d99,_0x43f086){return client['request'](_0x4eabfb,_0x536dcd)[_0x9bb3('0x5')](function(_0x38508f){if(_0x38508f[_0x9bb3('0x6')]){return _0x43f086(_0x38508f[_0x9bb3('0x6')][_0x9bb3('0x7')]);}else{return _0x1a0d99(_0x38508f[_0x9bb3('0x8')]);}})[_0x9bb3('0x9')](function(_0x37cbb5){return _0x43f086(_0x37cbb5);});});}exports[_0x9bb3('0xa')]=function(_0x596163,_0x5d4f89,_0x2f7703){return function(_0xec2efe){if(_0x2f7703['rules']&&!_0x2f7703['rules'][_0x596163]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x596163);return _0xec2efe['stop']();}var _0xcef939=[];for(var _0xfeea0f=0x0;_0xfeea0f<_0x5d4f89[_0x9bb3('0xb')];_0xfeea0f+=0x1){_0xcef939['push'](request(_0x9bb3('0xc'),{'command':util[_0x9bb3('0xd')](_0x9bb3('0xe'),_0x5d4f89[_0xfeea0f])})[_0x9bb3('0x5')](function(_0xf9ffca){return _0xf9ffca&&_0xf9ffca[_0x9bb3('0x7')]&&_0xf9ffca['message']['indexOf'](_0x9bb3('0xf'))>=0x0?!![]:![];})[_0x9bb3('0x9')](function(_0x486296){logger[_0x9bb3('0x6')](_0x9bb3('0x10'),_0x596163,_0x5d4f89[_0xfeea0f]);}));}BPromise['all'](_0xcef939)['then'](function(_0x5544c4){var _0x14c9e6=_[_0x9bb3('0x11')](_0x5544c4);logger[_0x9bb3('0x12')](_0x9bb3('0x13'),_0x596163,_0x5d4f89[_0x9bb3('0x14')](_0x9bb3('0x15')),_0x14c9e6);_0xec2efe[_0x9bb3('0x16')](_0x14c9e6);})['catch'](function(_0x27c68d){console['log'](_0x27c68d);logger[_0x9bb3('0x6')](_0x9bb3('0x13'),_0x596163,_0x5d4f89[_0x9bb3('0x14')](_0x9bb3('0x15')),_0x27c68d['stack']);_0xec2efe[_0x9bb3('0x17')]();});};}; \ No newline at end of file +var _0x3daf=['[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','when','catch','\x20|\x20','stop','util','bluebird','lodash','../../../config/logger','routing','client','request','then','error','message','result','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','iftime\x20%s','indexOf'];(function(_0x239cb5,_0x57f91f){var _0x109195=function(_0x5a0b25){while(--_0x5a0b25){_0x239cb5['push'](_0x239cb5['shift']());}};_0x109195(++_0x57f91f);}(_0x3daf,0x95));var _0xf3da=function(_0x1ab324,_0x2f57f0){_0x1ab324=_0x1ab324-0x0;var _0x201c68=_0x3daf[_0x1ab324];return _0x201c68;};'use strict';var util=require(_0xf3da('0x0'));var BPromise=require(_0xf3da('0x1'));var jayson=require('jayson/promise');var _=require(_0xf3da('0x2'));var logger=require(_0xf3da('0x3'))(_0xf3da('0x4'));var client=jayson[_0xf3da('0x5')]['http']({'port':0x232a});function request(_0x575da6,_0x389879){return new BPromise(function(_0x4a49dd,_0x31333a){return client[_0xf3da('0x6')](_0x575da6,_0x389879)[_0xf3da('0x7')](function(_0x1b5b86){if(_0x1b5b86['error']){return _0x31333a(_0x1b5b86[_0xf3da('0x8')][_0xf3da('0x9')]);}else{return _0x4a49dd(_0x1b5b86[_0xf3da('0xa')]);}})['catch'](function(_0x14850c){return _0x31333a(_0x14850c);});});}exports['condition']=function(_0x434e9d,_0x3379d6,_0xbbe163){return function(_0x4bd176){if(_0xbbe163['rules']&&!_0xbbe163[_0xf3da('0xb')][_0x434e9d]){logger['info'](_0xf3da('0xc'),_0x434e9d);return _0x4bd176['stop']();}var _0x54af83=[];for(var _0x3a6fb1=0x0;_0x3a6fb1<_0x3379d6[_0xf3da('0xd')];_0x3a6fb1+=0x1){_0x54af83[_0xf3da('0xe')](request(_0xf3da('0xf'),{'command':util[_0xf3da('0x10')](_0xf3da('0x11'),_0x3379d6[_0x3a6fb1])})[_0xf3da('0x7')](function(_0x40a741){return _0x40a741&&_0x40a741[_0xf3da('0x9')]&&_0x40a741['message'][_0xf3da('0x12')]('true')>=0x0?!![]:![];})['catch'](function(_0x41a734){logger[_0xf3da('0x8')](_0xf3da('0x13'),_0x434e9d,_0x3379d6[_0x3a6fb1]);}));}BPromise[_0xf3da('0x14')](_0x54af83)[_0xf3da('0x7')](function(_0x558cbf){var _0x52a92f=_[_0xf3da('0x15')](_0x558cbf);logger[_0xf3da('0x16')](_0xf3da('0x17'),_0x434e9d,_0x3379d6['join']('\x20|\x20'),_0x52a92f);_0x4bd176[_0xf3da('0x18')](_0x52a92f);})[_0xf3da('0x19')](function(_0x135c13){console['log'](_0x135c13);logger[_0xf3da('0x8')](_0xf3da('0x17'),_0x434e9d,_0x3379d6['join'](_0xf3da('0x1a')),_0x135c13['stack']);_0x4bd176[_0xf3da('0x1b')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 4145322..ecab7b0 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 _0xcef8=['origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','transferexten','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','calleridnum','connectedlinenum','then','type','agentacw','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','connectedlinename','error','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','reason','ringtime','talktime','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswer','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','extension','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]'];(function(_0x476b00,_0x250877){var _0x44ec8e=function(_0xec6b23){while(--_0xec6b23){_0x476b00['push'](_0x476b00['shift']());}};_0x44ec8e(++_0x250877);}(_0xcef8,0x114));var _0x8cef=function(_0x37c9b4,_0x5d743d){_0x37c9b4=_0x37c9b4-0x0;var _0x1b28db=_0xcef8[_0x37c9b4];return _0x1b28db;};'use strict';var _=require(_0x8cef('0x0'));var util=require('util');var utils=require(_0x8cef('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2c85f2,_0x223350){utils[_0x8cef('0x2')](util[_0x8cef('0x3')](_0x8cef('0x4'),_0x2c85f2[_0x8cef('0x5')],_0x2c85f2['channel'],_0x2c85f2[_0x8cef('0x6')],_0x2c85f2[_0x8cef('0x7')],_0x2c85f2['interface'],_0x2c85f2[_0x8cef('0x8')],_0x2c85f2[_0x8cef('0x9')],_0x2c85f2['lastevent']));if(_0x2c85f2[_0x8cef('0x6')]){utils['getVoiceQueueByName'](_0x2c85f2[_0x8cef('0x6')])[_0x8cef('0xa')](function(_0x416ef3){if(_0x416ef3){_0x2c85f2[_0x8cef('0xb')]=_0x416ef3[_0x8cef('0xb')];_0x2c85f2[_0x8cef('0xc')]=_0x2c85f2['agentcomplete']?_0x416ef3[_0x8cef('0xd')]:![];_0x2c85f2[_0x8cef('0xe')]=_0x2c85f2[_0x8cef('0xc')]?_0x416ef3['acwTimeout']:0x0;}utils[_0x8cef('0xf')](_0x8cef('0x10'),_0x2c85f2);});}else{utils[_0x8cef('0xf')]('CreateVoiceAgentReport',_0x2c85f2);}if(_0x223350){delete transfers[_0x2c85f2[_0x8cef('0x5')]];}else{delete agents[_0x2c85f2[_0x8cef('0x11')]];}}exports['agentcalled']=function(_0x38dcfb){try{utils[_0x8cef('0x12')](util[_0x8cef('0x3')](_0x8cef('0x13'),_0x38dcfb[_0x8cef('0x5')]),_0x38dcfb);agents[_0x38dcfb['destuniqueid']]=_0x38dcfb;agents[_0x38dcfb['destuniqueid']][_0x8cef('0x14')]=utils[_0x8cef('0x15')]();agents[_0x38dcfb[_0x8cef('0x11')]][_0x8cef('0x16')]=_0x8cef('0x17');agents[_0x38dcfb['destuniqueid']][_0x8cef('0x9')]=null;agents[_0x38dcfb[_0x8cef('0x11')]][_0x8cef('0x18')]=null;utils[_0x8cef('0x2')](util[_0x8cef('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x38dcfb['uniqueid'],agents[_0x38dcfb[_0x8cef('0x11')]][_0x8cef('0x7')],_0x38dcfb['destuniqueid']));}catch(_0x32efff){utils[_0x8cef('0x19')](util[_0x8cef('0x3')](_0x8cef('0x13'),_0x38dcfb[_0x8cef('0x5')]),_0x32efff);}};exports['agentringnoanswer']=function(_0x5bff8b){try{if(!_[_0x8cef('0x1a')](agents[_0x5bff8b[_0x8cef('0x11')]])){utils[_0x8cef('0x12')](util[_0x8cef('0x3')](_0x8cef('0x1b'),_0x5bff8b[_0x8cef('0x5')]),_0x5bff8b);utils[_0x8cef('0x2')](util['format']('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x5bff8b[_0x8cef('0x5')],agents[_0x5bff8b[_0x8cef('0x11')]]['membername'],_0x5bff8b['destuniqueid']));agents[_0x5bff8b['destuniqueid']]['agentringnoanswer']=!![];agents[_0x5bff8b[_0x8cef('0x11')]][_0x8cef('0x1c')]=utils[_0x8cef('0x15')]();agents[_0x5bff8b[_0x8cef('0x11')]][_0x8cef('0x16')]=_0x8cef('0x1d');agents[_0x5bff8b[_0x8cef('0x11')]][_0x8cef('0x1e')]='timeout';agents[_0x5bff8b['destuniqueid']]['holdtime']=_0x5bff8b['ringtime']?parseInt(_0x5bff8b[_0x8cef('0x1f')])/0x3e8:0x0;agents[_0x5bff8b[_0x8cef('0x11')]][_0x8cef('0x20')]=0x0;unanswered['push'](_0x5bff8b[_0x8cef('0x11')]);}}catch(_0x286349){utils[_0x8cef('0x19')](util[_0x8cef('0x3')](_0x8cef('0x1b'),_0x5bff8b[_0x8cef('0x5')]),_0x286349);}};exports['queuecallerabandon']=function(_0x15f109){try{_[_0x8cef('0x21')](agents,function(_0x52e4b9,_0x269a8e){if(_0x52e4b9[_0x8cef('0x5')]==_0x15f109['uniqueid']&&!_[_0x8cef('0x22')](unanswered,_0x52e4b9[_0x8cef('0x11')])){utils['debug'](util[_0x8cef('0x3')](_0x8cef('0x23'),_0x15f109['uniqueid']),_0x15f109);utils['info'](util[_0x8cef('0x3')](_0x8cef('0x24'),_0x15f109['uniqueid'],_0x52e4b9[_0x8cef('0x7')],_0x52e4b9[_0x8cef('0x11')]));_0x52e4b9[_0x8cef('0x25')]=!![];_0x52e4b9[_0x8cef('0x1c')]=utils['now']();_0x52e4b9[_0x8cef('0x16')]='abandoned';_0x52e4b9[_0x8cef('0x1e')]=_0x8cef('0x26');_0x52e4b9[_0x8cef('0x27')]=_0x15f109[_0x8cef('0x27')];_0x52e4b9[_0x8cef('0x20')]=0x0;writeDB(_0x52e4b9);}});}catch(_0x365025){utils[_0x8cef('0x19')](util[_0x8cef('0x3')]('[%s][agents][queuecallerabandon]',_0x15f109[_0x8cef('0x5')]),_0x365025);}};exports[_0x8cef('0x28')]=function(_0x2fc925){try{if(agents[_0x2fc925[_0x8cef('0x11')]]){utils['debug'](util[_0x8cef('0x3')](_0x8cef('0x29'),_0x2fc925[_0x8cef('0x5')]),_0x2fc925);utils[_0x8cef('0x2')](util['format'](_0x8cef('0x2a'),_0x2fc925[_0x8cef('0x5')],agents[_0x2fc925[_0x8cef('0x11')]]['membername'],_0x2fc925['destuniqueid']));agents[_0x2fc925[_0x8cef('0x11')]][_0x8cef('0x2b')]=utils[_0x8cef('0x15')]();agents[_0x2fc925[_0x8cef('0x11')]][_0x8cef('0x9')]=_0x2fc925[_0x8cef('0x9')];agents[_0x2fc925['destuniqueid']][_0x8cef('0x18')]=_0x2fc925[_0x8cef('0x18')];agents[_0x2fc925[_0x8cef('0x11')]][_0x8cef('0x27')]=_0x2fc925['ringtime'];agents[_0x2fc925['destuniqueid']][_0x8cef('0x16')]=_0x8cef('0x2c');_['forIn'](agents,function(_0x4ba757,_0xdaa736){if(_0x4ba757[_0x8cef('0x11')]!=_0x2fc925[_0x8cef('0x11')]&&_0x4ba757[_0x8cef('0x5')]==_0x2fc925[_0x8cef('0x5')]){_0x4ba757[_0x8cef('0x20')]=0x0;_0x4ba757[_0x8cef('0x27')]=_0x2fc925['ringtime'];_0x4ba757[_0x8cef('0x25')]=!![];_0x4ba757['agentringnoanswerAt']=utils[_0x8cef('0x15')]();_0x4ba757[_0x8cef('0x16')]=_0x8cef('0x2d');_0x4ba757[_0x8cef('0x1e')]='answered_elsewhere';_0x4ba757[_0x8cef('0x2e')]=_0x2fc925['destuniqueid'];_0x4ba757[_0x8cef('0x2f')]=_0x2fc925[_0x8cef('0x7')];writeDB(_0x4ba757);}});}}catch(_0x3dcef4){utils[_0x8cef('0x19')](util[_0x8cef('0x3')](_0x8cef('0x29'),_0x2fc925[_0x8cef('0x5')]),_0x3dcef4);}};exports[_0x8cef('0x30')]=function(_0x3edfc4){try{if(!_[_0x8cef('0x1a')](agents[_0x3edfc4[_0x8cef('0x11')]])){utils['debug'](util['format'](_0x8cef('0x31'),_0x3edfc4[_0x8cef('0x5')]),_0x3edfc4);utils['info'](util[_0x8cef('0x3')](_0x8cef('0x32'),_0x3edfc4[_0x8cef('0x5')],agents[_0x3edfc4[_0x8cef('0x11')]]['membername'],_0x3edfc4['destuniqueid']));agents[_0x3edfc4[_0x8cef('0x11')]][_0x8cef('0x30')]=!![];agents[_0x3edfc4[_0x8cef('0x11')]][_0x8cef('0x33')]=utils[_0x8cef('0x15')]();agents[_0x3edfc4['destuniqueid']]['talktime']=utils[_0x8cef('0x34')](agents[_0x3edfc4['destuniqueid']]['agentcompleteAt'],agents[_0x3edfc4[_0x8cef('0x11')]][_0x8cef('0x2b')]);agents[_0x3edfc4[_0x8cef('0x11')]]['reason']=_0x3edfc4[_0x8cef('0x1e')];agents[_0x3edfc4[_0x8cef('0x11')]][_0x8cef('0x16')]=_0x8cef('0x35');writeDB(agents[_0x3edfc4[_0x8cef('0x11')]]);}}catch(_0x3248a1){utils[_0x8cef('0x19')](util[_0x8cef('0x3')]('[%s][agents][agentcomplete]',_0x3edfc4[_0x8cef('0x5')]),_0x3248a1);}};exports[_0x8cef('0x36')]=function(_0x8e6fe){try{if(!_[_0x8cef('0x1a')](agents[_0x8e6fe['transfereruniqueid']])){utils[_0x8cef('0x12')](util[_0x8cef('0x3')]('[%s][agents][blindtransfer]',_0x8e6fe[_0x8cef('0x5')]),_0x8e6fe);utils[_0x8cef('0x2')](util['format'](_0x8cef('0x37'),_0x8e6fe[_0x8cef('0x5')],agents[_0x8e6fe['transfereruniqueid']][_0x8cef('0x7')],agents[_0x8e6fe['transfereruniqueid']]['uniqueid']));agents[_0x8e6fe[_0x8cef('0x38')]][_0x8cef('0x39')]=!![];agents[_0x8e6fe[_0x8cef('0x38')]][_0x8cef('0x3a')]=_0x8cef('0x3b');agents[_0x8e6fe['transfereruniqueid']]['transferexten']=_0x8e6fe[_0x8cef('0x3c')];agents[_0x8e6fe['transfereruniqueid']]['transferuniqueid']=agents[_0x8e6fe['transfereruniqueid']][_0x8cef('0x5')];}}catch(_0x38696f){utils[_0x8cef('0x19')](util['format'](_0x8cef('0x3d'),_0x8e6fe['uniqueid']),_0x38696f);}};exports[_0x8cef('0x3e')]=function(_0xb5b3b2){try{utils['debug'](util[_0x8cef('0x3')](_0x8cef('0x3f'),_0xb5b3b2[_0x8cef('0x40')]),_0xb5b3b2);if(_0xb5b3b2['origtransfereruniqueid']==_0xb5b3b2[_0x8cef('0x41')]){if(!_[_0x8cef('0x1a')](agents[_0xb5b3b2['secondtransfereruniqueid']])){utils['info'](util[_0x8cef('0x3')](_0x8cef('0x42'),_0xb5b3b2[_0x8cef('0x40')],agents[_0xb5b3b2[_0x8cef('0x43')]][_0x8cef('0x7')]));agents[_0xb5b3b2['secondtransfereruniqueid']][_0x8cef('0x39')]=!![];agents[_0xb5b3b2[_0x8cef('0x43')]]['transfertype']=_0x8cef('0x44');agents[_0xb5b3b2['secondtransfereruniqueid']][_0x8cef('0x45')]=_0xb5b3b2[_0x8cef('0x46')];agents[_0xb5b3b2[_0x8cef('0x43')]][_0x8cef('0x47')]=_0xb5b3b2['origtransfereruniqueid'];}if(_0xb5b3b2[_0x8cef('0x48')]&&agents[_0xb5b3b2['transfereeuniqueid']]){agents[_0xb5b3b2[_0x8cef('0x48')]][_0x8cef('0x49')]=0x1;transfers[_0xb5b3b2[_0x8cef('0x48')]]=_['clone'](agents[_0xb5b3b2['transfereeuniqueid']]);transfers[_0xb5b3b2[_0x8cef('0x48')]][_0x8cef('0x8')]=agents[_0xb5b3b2['secondtransfereruniqueid']]['calleridnum'];transfers[_0xb5b3b2[_0x8cef('0x48')]][_0x8cef('0x4a')]=agents[_0xb5b3b2[_0x8cef('0x43')]][_0x8cef('0x4a')];transfers[_0xb5b3b2[_0x8cef('0x48')]][_0x8cef('0x14')]=utils[_0x8cef('0x15')]();transfers[_0xb5b3b2[_0x8cef('0x48')]][_0x8cef('0x2b')]=utils[_0x8cef('0x15')]();transfers[_0xb5b3b2[_0x8cef('0x48')]][_0x8cef('0x27')]=0x0;transfers[_0xb5b3b2[_0x8cef('0x48')]][_0x8cef('0x49')]=0x2;}}else if(_0xb5b3b2[_0x8cef('0x43')]==_0xb5b3b2[_0x8cef('0x4b')]){if(!_[_0x8cef('0x1a')](agents[_0xb5b3b2[_0x8cef('0x40')]])){utils[_0x8cef('0x2')](util[_0x8cef('0x3')](_0x8cef('0x42'),_0xb5b3b2[_0x8cef('0x40')],agents[_0xb5b3b2['origtransfereruniqueid']][_0x8cef('0x7')]));agents[_0xb5b3b2[_0x8cef('0x40')]]['transfer']=!![];agents[_0xb5b3b2[_0x8cef('0x40')]][_0x8cef('0x3a')]=_0x8cef('0x44');agents[_0xb5b3b2['origtransfereruniqueid']][_0x8cef('0x45')]=_0xb5b3b2[_0x8cef('0x4c')];agents[_0xb5b3b2[_0x8cef('0x40')]]['transferuniqueid']=_0xb5b3b2['secondtransfereruniqueid'];}if(_0xb5b3b2[_0x8cef('0x4d')]&&agents[_0xb5b3b2[_0x8cef('0x4d')]]){agents[_0xb5b3b2['transfertargetuniqueid']][_0x8cef('0x49')]=0x1;transfers[_0xb5b3b2['transfertargetuniqueid']]=_[_0x8cef('0x4e')](agents[_0xb5b3b2[_0x8cef('0x4d')]]);transfers[_0xb5b3b2[_0x8cef('0x4d')]][_0x8cef('0x8')]=agents[_0xb5b3b2['origtransfereruniqueid']]['calleridnum'];transfers[_0xb5b3b2[_0x8cef('0x4d')]][_0x8cef('0x4a')]=agents[_0xb5b3b2[_0x8cef('0x40')]][_0x8cef('0x4a')];transfers[_0xb5b3b2['transfertargetuniqueid']]['agentcalledAt']=utils[_0x8cef('0x15')]();transfers[_0xb5b3b2['transfertargetuniqueid']]['agentconnectAt']=utils[_0x8cef('0x15')]();transfers[_0xb5b3b2[_0x8cef('0x4d')]][_0x8cef('0x27')]=0x0;transfers[_0xb5b3b2['transfertargetuniqueid']][_0x8cef('0x49')]=0x2;}}}catch(_0x1677fb){utils[_0x8cef('0x19')](util['format'](_0x8cef('0x3f'),_0xb5b3b2['origtransfereruniqueid']),_0x1677fb);}};exports['hangup']=function(_0x438ec6){try{utils[_0x8cef('0x12')](util[_0x8cef('0x3')](_0x8cef('0x4f'),_0x438ec6[_0x8cef('0x5')]),_0x438ec6);if(agents[_0x438ec6[_0x8cef('0x5')]]&&agents[_0x438ec6[_0x8cef('0x5')]]['reason']===_0x8cef('0x1d')){if(_0x438ec6[_0x8cef('0x50')]==='21'){agents[_0x438ec6[_0x8cef('0x5')]]['reason']='rejected';agents[_0x438ec6[_0x8cef('0x5')]]['lastevent']=_0x8cef('0x51');}utils[_0x8cef('0x2')](util[_0x8cef('0x3')](_0x8cef('0x52'),_0x438ec6[_0x8cef('0x5')],agents[_0x438ec6[_0x8cef('0x5')]][_0x8cef('0x7')],agents[_0x438ec6[_0x8cef('0x5')]][_0x8cef('0x1e')],agents[_0x438ec6[_0x8cef('0x5')]]['lastevent']));writeDB(agents[_0x438ec6[_0x8cef('0x5')]]);var _0x30cd79=unanswered[_0x8cef('0x53')](_0x438ec6[_0x8cef('0x5')]);if(_0x30cd79>-0x1){unanswered['splice'](_0x30cd79,0x1);}}if(transfers[_0x438ec6['uniqueid']]){transfers[_0x438ec6['uniqueid']][_0x8cef('0x30')]=!![];transfers[_0x438ec6['uniqueid']]['agentcompleteAt']=utils[_0x8cef('0x15')]();transfers[_0x438ec6['uniqueid']]['talktime']=utils['diffTime'](transfers[_0x438ec6['uniqueid']][_0x8cef('0x33')],transfers[_0x438ec6[_0x8cef('0x5')]]['agentconnectAt']);transfers[_0x438ec6['uniqueid']][_0x8cef('0x1e')]=_0x8cef('0x54');transfers[_0x438ec6[_0x8cef('0x5')]][_0x8cef('0x16')]='complete';utils[_0x8cef('0x2')](util[_0x8cef('0x3')](_0x8cef('0x52'),_0x438ec6[_0x8cef('0x5')],transfers[_0x438ec6[_0x8cef('0x5')]]['membername'],transfers[_0x438ec6[_0x8cef('0x5')]]['reason'],transfers[_0x438ec6[_0x8cef('0x5')]]['lastevent']));writeDB(transfers[_0x438ec6['uniqueid']],!![]);}if(agents[_0x438ec6[_0x8cef('0x5')]]&&agents[_0x438ec6[_0x8cef('0x5')]][_0x8cef('0x2b')]){agents[_0x438ec6[_0x8cef('0x5')]][_0x8cef('0x30')]=!![];agents[_0x438ec6['uniqueid']][_0x8cef('0x33')]=utils[_0x8cef('0x15')]();agents[_0x438ec6[_0x8cef('0x5')]][_0x8cef('0x20')]=utils[_0x8cef('0x34')](agents[_0x438ec6[_0x8cef('0x5')]]['agentcompleteAt'],agents[_0x438ec6[_0x8cef('0x5')]]['agentconnectAt']);agents[_0x438ec6['uniqueid']]['reason']=agents[_0x438ec6[_0x8cef('0x5')]][_0x8cef('0x39')]?'transfer':_0x8cef('0x54');agents[_0x438ec6[_0x8cef('0x5')]][_0x8cef('0x16')]=_0x8cef('0x35');utils[_0x8cef('0x2')](util[_0x8cef('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x438ec6[_0x8cef('0x5')],agents[_0x438ec6[_0x8cef('0x5')]]['membername'],agents[_0x438ec6[_0x8cef('0x5')]][_0x8cef('0x1e')],agents[_0x438ec6[_0x8cef('0x5')]][_0x8cef('0x16')]));writeDB(agents[_0x438ec6[_0x8cef('0x5')]]);}}catch(_0x31d700){utils['error'](util['format'](_0x8cef('0x4f'),_0x438ec6[_0x8cef('0x5')]),_0x31d700);}}; \ No newline at end of file +var _0xb9e1=['type','agentacw','acw','acwtime','request','CreateVoiceAgentReport','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','queuecallerabandon','forIn','includes','debug','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','reason','abandoned','[%s][agents][queuecallerabandon]','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','diffTime','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','[%s][agents][blindtransfer]','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName'];(function(_0x19dac3,_0x179387){var _0x3be408=function(_0x10a398){while(--_0x10a398){_0x19dac3['push'](_0x19dac3['shift']());}};_0x3be408(++_0x179387);}(_0xb9e1,0x1eb));var _0x1b9e=function(_0x25601e,_0x3bd0f4){_0x25601e=_0x25601e-0x0;var _0x54d208=_0xb9e1[_0x25601e];return _0x54d208;};'use strict';var _=require(_0x1b9e('0x0'));var util=require('util');var utils=require(_0x1b9e('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x24c854,_0xd88176){utils[_0x1b9e('0x2')](util[_0x1b9e('0x3')](_0x1b9e('0x4'),_0x24c854[_0x1b9e('0x5')],_0x24c854[_0x1b9e('0x6')],_0x24c854[_0x1b9e('0x7')],_0x24c854[_0x1b9e('0x8')],_0x24c854['interface'],_0x24c854[_0x1b9e('0x9')],_0x24c854[_0x1b9e('0xa')],_0x24c854[_0x1b9e('0xb')]));if(_0x24c854[_0x1b9e('0x7')]){utils[_0x1b9e('0xc')](_0x24c854[_0x1b9e('0x7')])['then'](function(_0x2ef5d0){if(_0x2ef5d0){_0x24c854[_0x1b9e('0xd')]=_0x2ef5d0['type'];_0x24c854[_0x1b9e('0xe')]=_0x24c854['agentcomplete']?_0x2ef5d0[_0x1b9e('0xf')]:![];_0x24c854[_0x1b9e('0x10')]=_0x24c854[_0x1b9e('0xe')]?_0x2ef5d0['acwTimeout']:0x0;}utils[_0x1b9e('0x11')](_0x1b9e('0x12'),_0x24c854);});}else{utils[_0x1b9e('0x11')](_0x1b9e('0x12'),_0x24c854);}if(_0xd88176){delete transfers[_0x24c854[_0x1b9e('0x5')]];}else{delete agents[_0x24c854['destuniqueid']];}}exports['agentcalled']=function(_0x3b75d1){try{utils['debug'](util['format'](_0x1b9e('0x13'),_0x3b75d1[_0x1b9e('0x5')]),_0x3b75d1);agents[_0x3b75d1[_0x1b9e('0x14')]]=_0x3b75d1;agents[_0x3b75d1[_0x1b9e('0x14')]][_0x1b9e('0x15')]=utils[_0x1b9e('0x16')]();agents[_0x3b75d1['destuniqueid']][_0x1b9e('0xb')]=_0x1b9e('0x17');agents[_0x3b75d1[_0x1b9e('0x14')]]['connectedlinenum']=null;agents[_0x3b75d1['destuniqueid']]['connectedlinename']=null;utils[_0x1b9e('0x2')](util['format'](_0x1b9e('0x18'),_0x3b75d1[_0x1b9e('0x5')],agents[_0x3b75d1[_0x1b9e('0x14')]][_0x1b9e('0x8')],_0x3b75d1[_0x1b9e('0x14')]));}catch(_0x3617c1){utils[_0x1b9e('0x19')](util[_0x1b9e('0x3')](_0x1b9e('0x13'),_0x3b75d1[_0x1b9e('0x5')]),_0x3617c1);}};exports['agentringnoanswer']=function(_0x554a28){try{if(!_[_0x1b9e('0x1a')](agents[_0x554a28['destuniqueid']])){utils['debug'](util[_0x1b9e('0x3')](_0x1b9e('0x1b'),_0x554a28['uniqueid']),_0x554a28);utils['info'](util[_0x1b9e('0x3')](_0x1b9e('0x1c'),_0x554a28[_0x1b9e('0x5')],agents[_0x554a28[_0x1b9e('0x14')]][_0x1b9e('0x8')],_0x554a28['destuniqueid']));agents[_0x554a28[_0x1b9e('0x14')]][_0x1b9e('0x1d')]=!![];agents[_0x554a28[_0x1b9e('0x14')]][_0x1b9e('0x1e')]=utils[_0x1b9e('0x16')]();agents[_0x554a28[_0x1b9e('0x14')]][_0x1b9e('0xb')]=_0x1b9e('0x1f');agents[_0x554a28[_0x1b9e('0x14')]]['reason']=_0x1b9e('0x1f');agents[_0x554a28['destuniqueid']][_0x1b9e('0x20')]=_0x554a28[_0x1b9e('0x21')]?parseInt(_0x554a28['ringtime'])/0x3e8:0x0;agents[_0x554a28['destuniqueid']][_0x1b9e('0x22')]=0x0;unanswered['push'](_0x554a28[_0x1b9e('0x14')]);}}catch(_0x389382){utils[_0x1b9e('0x19')](util[_0x1b9e('0x3')](_0x1b9e('0x1b'),_0x554a28[_0x1b9e('0x5')]),_0x389382);}};exports[_0x1b9e('0x23')]=function(_0x5b250c){try{_[_0x1b9e('0x24')](agents,function(_0x10e71b,_0x33fda3){if(_0x10e71b[_0x1b9e('0x5')]==_0x5b250c['uniqueid']&&!_[_0x1b9e('0x25')](unanswered,_0x10e71b[_0x1b9e('0x14')])){utils[_0x1b9e('0x26')](util[_0x1b9e('0x3')]('[%s][agents][queuecallerabandon]',_0x5b250c[_0x1b9e('0x5')]),_0x5b250c);utils[_0x1b9e('0x2')](util[_0x1b9e('0x3')](_0x1b9e('0x27'),_0x5b250c[_0x1b9e('0x5')],_0x10e71b[_0x1b9e('0x8')],_0x10e71b[_0x1b9e('0x14')]));_0x10e71b[_0x1b9e('0x1d')]=!![];_0x10e71b[_0x1b9e('0x1e')]=utils[_0x1b9e('0x16')]();_0x10e71b[_0x1b9e('0xb')]='abandoned';_0x10e71b[_0x1b9e('0x28')]=_0x1b9e('0x29');_0x10e71b['holdtime']=_0x5b250c['holdtime'];_0x10e71b[_0x1b9e('0x22')]=0x0;writeDB(_0x10e71b);}});}catch(_0x10cd48){utils[_0x1b9e('0x19')](util[_0x1b9e('0x3')](_0x1b9e('0x2a'),_0x5b250c[_0x1b9e('0x5')]),_0x10cd48);}};exports['agentconnect']=function(_0x349059){try{if(agents[_0x349059[_0x1b9e('0x14')]]){utils['debug'](util[_0x1b9e('0x3')](_0x1b9e('0x2b'),_0x349059[_0x1b9e('0x5')]),_0x349059);utils[_0x1b9e('0x2')](util[_0x1b9e('0x3')](_0x1b9e('0x2c'),_0x349059[_0x1b9e('0x5')],agents[_0x349059[_0x1b9e('0x14')]][_0x1b9e('0x8')],_0x349059[_0x1b9e('0x14')]));agents[_0x349059[_0x1b9e('0x14')]][_0x1b9e('0x2d')]=utils[_0x1b9e('0x16')]();agents[_0x349059['destuniqueid']][_0x1b9e('0xa')]=_0x349059[_0x1b9e('0xa')];agents[_0x349059[_0x1b9e('0x14')]]['connectedlinename']=_0x349059[_0x1b9e('0x2e')];agents[_0x349059[_0x1b9e('0x14')]][_0x1b9e('0x20')]=_0x349059[_0x1b9e('0x21')];agents[_0x349059['destuniqueid']]['lastevent']='connect';_[_0x1b9e('0x24')](agents,function(_0x56842f,_0x53a117){if(_0x56842f[_0x1b9e('0x14')]!=_0x349059[_0x1b9e('0x14')]&&_0x56842f[_0x1b9e('0x5')]==_0x349059[_0x1b9e('0x5')]){_0x56842f['talktime']=0x0;_0x56842f[_0x1b9e('0x20')]=_0x349059[_0x1b9e('0x21')];_0x56842f[_0x1b9e('0x1d')]=!![];_0x56842f[_0x1b9e('0x1e')]=utils[_0x1b9e('0x16')]();_0x56842f['lastevent']='answered_elsewhere';_0x56842f[_0x1b9e('0x28')]=_0x1b9e('0x2f');_0x56842f[_0x1b9e('0x30')]=_0x349059[_0x1b9e('0x14')];_0x56842f[_0x1b9e('0x31')]=_0x349059[_0x1b9e('0x8')];writeDB(_0x56842f);}});}}catch(_0x43f633){utils[_0x1b9e('0x19')](util[_0x1b9e('0x3')](_0x1b9e('0x2b'),_0x349059[_0x1b9e('0x5')]),_0x43f633);}};exports[_0x1b9e('0x32')]=function(_0x550344){try{if(!_[_0x1b9e('0x1a')](agents[_0x550344[_0x1b9e('0x14')]])){utils['debug'](util['format']('[%s][agents][agentcomplete]',_0x550344[_0x1b9e('0x5')]),_0x550344);utils[_0x1b9e('0x2')](util[_0x1b9e('0x3')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x550344[_0x1b9e('0x5')],agents[_0x550344['destuniqueid']][_0x1b9e('0x8')],_0x550344[_0x1b9e('0x14')]));agents[_0x550344[_0x1b9e('0x14')]][_0x1b9e('0x32')]=!![];agents[_0x550344['destuniqueid']]['agentcompleteAt']=utils[_0x1b9e('0x16')]();agents[_0x550344['destuniqueid']]['talktime']=utils[_0x1b9e('0x33')](agents[_0x550344[_0x1b9e('0x14')]][_0x1b9e('0x34')],agents[_0x550344[_0x1b9e('0x14')]][_0x1b9e('0x2d')]);agents[_0x550344[_0x1b9e('0x14')]]['reason']=_0x550344[_0x1b9e('0x28')];agents[_0x550344[_0x1b9e('0x14')]][_0x1b9e('0xb')]=_0x1b9e('0x35');writeDB(agents[_0x550344[_0x1b9e('0x14')]]);}}catch(_0x4fdfe5){utils[_0x1b9e('0x19')](util[_0x1b9e('0x3')](_0x1b9e('0x36'),_0x550344[_0x1b9e('0x5')]),_0x4fdfe5);}};exports[_0x1b9e('0x37')]=function(_0x3fb3a2){try{if(!_[_0x1b9e('0x1a')](agents[_0x3fb3a2['transfereruniqueid']])){utils['debug'](util[_0x1b9e('0x3')](_0x1b9e('0x38'),_0x3fb3a2[_0x1b9e('0x5')]),_0x3fb3a2);utils[_0x1b9e('0x2')](util[_0x1b9e('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x3fb3a2[_0x1b9e('0x5')],agents[_0x3fb3a2[_0x1b9e('0x39')]][_0x1b9e('0x8')],agents[_0x3fb3a2[_0x1b9e('0x39')]][_0x1b9e('0x5')]));agents[_0x3fb3a2[_0x1b9e('0x39')]][_0x1b9e('0x3a')]=!![];agents[_0x3fb3a2['transfereruniqueid']][_0x1b9e('0x3b')]=_0x1b9e('0x3c');agents[_0x3fb3a2[_0x1b9e('0x39')]][_0x1b9e('0x3d')]=_0x3fb3a2[_0x1b9e('0x3e')];agents[_0x3fb3a2['transfereruniqueid']][_0x1b9e('0x3f')]=agents[_0x3fb3a2['transfereruniqueid']][_0x1b9e('0x5')];}}catch(_0x1a5837){utils[_0x1b9e('0x19')](util[_0x1b9e('0x3')](_0x1b9e('0x38'),_0x3fb3a2['uniqueid']),_0x1a5837);}};exports[_0x1b9e('0x40')]=function(_0x28c727){try{utils['debug'](util['format'](_0x1b9e('0x41'),_0x28c727[_0x1b9e('0x42')]),_0x28c727);if(_0x28c727[_0x1b9e('0x42')]==_0x28c727['origtransfererlinkedid']){if(!_['isNil'](agents[_0x28c727['secondtransfereruniqueid']])){utils[_0x1b9e('0x2')](util[_0x1b9e('0x3')](_0x1b9e('0x43'),_0x28c727[_0x1b9e('0x42')],agents[_0x28c727[_0x1b9e('0x44')]][_0x1b9e('0x8')]));agents[_0x28c727[_0x1b9e('0x44')]][_0x1b9e('0x3a')]=!![];agents[_0x28c727[_0x1b9e('0x44')]]['transfertype']=_0x1b9e('0x45');agents[_0x28c727[_0x1b9e('0x44')]][_0x1b9e('0x3d')]=_0x28c727['origtransfererexten'];agents[_0x28c727[_0x1b9e('0x44')]][_0x1b9e('0x3f')]=_0x28c727[_0x1b9e('0x42')];}if(_0x28c727['transfereeuniqueid']&&agents[_0x28c727[_0x1b9e('0x46')]]){agents[_0x28c727[_0x1b9e('0x46')]][_0x1b9e('0x47')]=0x1;transfers[_0x28c727['transfereeuniqueid']]=_['clone'](agents[_0x28c727[_0x1b9e('0x46')]]);transfers[_0x28c727[_0x1b9e('0x46')]][_0x1b9e('0x9')]=agents[_0x28c727[_0x1b9e('0x44')]][_0x1b9e('0x9')];transfers[_0x28c727['transfereeuniqueid']][_0x1b9e('0x48')]=agents[_0x28c727[_0x1b9e('0x44')]][_0x1b9e('0x48')];transfers[_0x28c727['transfereeuniqueid']][_0x1b9e('0x15')]=utils[_0x1b9e('0x16')]();transfers[_0x28c727['transfereeuniqueid']][_0x1b9e('0x2d')]=utils[_0x1b9e('0x16')]();transfers[_0x28c727[_0x1b9e('0x46')]][_0x1b9e('0x20')]=0x0;transfers[_0x28c727['transfereeuniqueid']][_0x1b9e('0x47')]=0x2;}}else if(_0x28c727[_0x1b9e('0x44')]==_0x28c727[_0x1b9e('0x49')]){if(!_['isNil'](agents[_0x28c727['origtransfereruniqueid']])){utils['info'](util[_0x1b9e('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x28c727[_0x1b9e('0x42')],agents[_0x28c727[_0x1b9e('0x42')]][_0x1b9e('0x8')]));agents[_0x28c727[_0x1b9e('0x42')]][_0x1b9e('0x3a')]=!![];agents[_0x28c727['origtransfereruniqueid']][_0x1b9e('0x3b')]='ATTENDED';agents[_0x28c727[_0x1b9e('0x42')]][_0x1b9e('0x3d')]=_0x28c727[_0x1b9e('0x4a')];agents[_0x28c727[_0x1b9e('0x42')]][_0x1b9e('0x3f')]=_0x28c727[_0x1b9e('0x44')];}if(_0x28c727[_0x1b9e('0x4b')]&&agents[_0x28c727[_0x1b9e('0x4b')]]){agents[_0x28c727[_0x1b9e('0x4b')]][_0x1b9e('0x47')]=0x1;transfers[_0x28c727[_0x1b9e('0x4b')]]=_[_0x1b9e('0x4c')](agents[_0x28c727['transfertargetuniqueid']]);transfers[_0x28c727[_0x1b9e('0x4b')]][_0x1b9e('0x9')]=agents[_0x28c727[_0x1b9e('0x42')]][_0x1b9e('0x9')];transfers[_0x28c727[_0x1b9e('0x4b')]][_0x1b9e('0x48')]=agents[_0x28c727[_0x1b9e('0x42')]][_0x1b9e('0x48')];transfers[_0x28c727[_0x1b9e('0x4b')]]['agentcalledAt']=utils['now']();transfers[_0x28c727[_0x1b9e('0x4b')]]['agentconnectAt']=utils[_0x1b9e('0x16')]();transfers[_0x28c727[_0x1b9e('0x4b')]]['holdtime']=0x0;transfers[_0x28c727[_0x1b9e('0x4b')]][_0x1b9e('0x47')]=0x2;}}}catch(_0x456f0f){utils['error'](util[_0x1b9e('0x3')](_0x1b9e('0x41'),_0x28c727[_0x1b9e('0x42')]),_0x456f0f);}};exports[_0x1b9e('0x4d')]=function(_0x5a62cd){try{utils[_0x1b9e('0x26')](util[_0x1b9e('0x3')](_0x1b9e('0x4e'),_0x5a62cd[_0x1b9e('0x5')]),_0x5a62cd);if(agents[_0x5a62cd[_0x1b9e('0x5')]]&&agents[_0x5a62cd['uniqueid']][_0x1b9e('0x28')]==='timeout'){if(_0x5a62cd[_0x1b9e('0x4f')]==='21'){agents[_0x5a62cd[_0x1b9e('0x5')]]['reason']=_0x1b9e('0x50');agents[_0x5a62cd[_0x1b9e('0x5')]][_0x1b9e('0xb')]='rejected';}utils[_0x1b9e('0x2')](util[_0x1b9e('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5a62cd[_0x1b9e('0x5')],agents[_0x5a62cd[_0x1b9e('0x5')]][_0x1b9e('0x8')],agents[_0x5a62cd[_0x1b9e('0x5')]][_0x1b9e('0x28')],agents[_0x5a62cd[_0x1b9e('0x5')]]['lastevent']));writeDB(agents[_0x5a62cd[_0x1b9e('0x5')]]);var _0x2a8a55=unanswered[_0x1b9e('0x51')](_0x5a62cd[_0x1b9e('0x5')]);if(_0x2a8a55>-0x1){unanswered[_0x1b9e('0x52')](_0x2a8a55,0x1);}}if(transfers[_0x5a62cd[_0x1b9e('0x5')]]){transfers[_0x5a62cd[_0x1b9e('0x5')]][_0x1b9e('0x32')]=!![];transfers[_0x5a62cd[_0x1b9e('0x5')]][_0x1b9e('0x34')]=utils['now']();transfers[_0x5a62cd[_0x1b9e('0x5')]][_0x1b9e('0x22')]=utils[_0x1b9e('0x33')](transfers[_0x5a62cd[_0x1b9e('0x5')]]['agentcompleteAt'],transfers[_0x5a62cd['uniqueid']][_0x1b9e('0x2d')]);transfers[_0x5a62cd['uniqueid']]['reason']='agent';transfers[_0x5a62cd['uniqueid']][_0x1b9e('0xb')]='complete';utils['info'](util[_0x1b9e('0x3')](_0x1b9e('0x53'),_0x5a62cd[_0x1b9e('0x5')],transfers[_0x5a62cd[_0x1b9e('0x5')]][_0x1b9e('0x8')],transfers[_0x5a62cd['uniqueid']]['reason'],transfers[_0x5a62cd[_0x1b9e('0x5')]][_0x1b9e('0xb')]));writeDB(transfers[_0x5a62cd[_0x1b9e('0x5')]],!![]);}if(agents[_0x5a62cd[_0x1b9e('0x5')]]&&agents[_0x5a62cd[_0x1b9e('0x5')]][_0x1b9e('0x2d')]){agents[_0x5a62cd[_0x1b9e('0x5')]]['agentcomplete']=!![];agents[_0x5a62cd['uniqueid']][_0x1b9e('0x34')]=utils[_0x1b9e('0x16')]();agents[_0x5a62cd[_0x1b9e('0x5')]][_0x1b9e('0x22')]=utils[_0x1b9e('0x33')](agents[_0x5a62cd['uniqueid']][_0x1b9e('0x34')],agents[_0x5a62cd[_0x1b9e('0x5')]][_0x1b9e('0x2d')]);agents[_0x5a62cd['uniqueid']][_0x1b9e('0x28')]=agents[_0x5a62cd[_0x1b9e('0x5')]][_0x1b9e('0x3a')]?_0x1b9e('0x3a'):'agent';agents[_0x5a62cd[_0x1b9e('0x5')]]['lastevent']=_0x1b9e('0x35');utils[_0x1b9e('0x2')](util['format'](_0x1b9e('0x53'),_0x5a62cd[_0x1b9e('0x5')],agents[_0x5a62cd[_0x1b9e('0x5')]]['membername'],agents[_0x5a62cd[_0x1b9e('0x5')]]['reason'],agents[_0x5a62cd[_0x1b9e('0x5')]][_0x1b9e('0xb')]));writeDB(agents[_0x5a62cd['uniqueid']]);}}catch(_0x3c9105){utils[_0x1b9e('0x19')](util[_0x1b9e('0x3')](_0x1b9e('0x4e'),_0x5a62cd[_0x1b9e('0x5')]),_0x3c9105);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 15f032c..3480283 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 _0x11b9=['[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','gotoif','lodash','util','FAILED','NO\x20ANSWER','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','channel','queue','membername','calleridnum','connectedlinenum','lastevent','getUserByInternal','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','accountcode','DOCUMENTATION','error','newstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','now','channelstate','destinationchannel','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','duration','diffTime','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','variable','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid'];(function(_0x2acf2b,_0x266acd){var _0x273fa6=function(_0x360cab){while(--_0x360cab){_0x2acf2b['push'](_0x2acf2b['shift']());}};_0x273fa6(++_0x266acd);}(_0x11b9,0x76));var _0x911b=function(_0xbb20ec,_0x19cec5){_0xbb20ec=_0xbb20ec-0x0;var _0x5b33fa=_0x11b9[_0xbb20ec];return _0x5b33fa;};'use strict';var _=require(_0x911b('0x0'));var util=require(_0x911b('0x1'));var utils=require('./utils');var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER',_0x911b('0x2'),_0x911b('0x2'),_0x911b('0x3'),'NO\x20ANSWER',_0x911b('0x3'),'ANSWERED',_0x911b('0x4'),'FAILED','FAILED',_0x911b('0x2')];var channels={};function writeDB(_0x7fe34f){var _0x25f2a9;if(transfers[_0x911b('0x5')][_0x7fe34f[_0x911b('0x6')]]){_0x25f2a9=_0x7fe34f['uniqueid'];_0x7fe34f[_0x911b('0x6')]=transfers[_0x911b('0x5')][_0x7fe34f[_0x911b('0x6')]][_0x911b('0x7')];}utils[_0x911b('0x8')](util[_0x911b('0x9')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x7fe34f[_0x911b('0x6')],_0x7fe34f[_0x911b('0xa')],_0x7fe34f[_0x911b('0xb')],_0x7fe34f[_0x911b('0xc')],_0x7fe34f['interface'],_0x7fe34f[_0x911b('0xd')],_0x7fe34f[_0x911b('0xe')],_0x7fe34f[_0x911b('0xf')]));if(_0x7fe34f['accountcode']){utils[_0x911b('0x10')](_0x7fe34f['accountcode'])['then'](function(_0x3e4a87){if(_0x3e4a87){_0x7fe34f[_0x911b('0x11')]=_0x3e4a87['id'];}utils[_0x911b('0x12')](_0x911b('0x13'),_0x7fe34f);});}else{utils[_0x911b('0x12')](_0x911b('0x13'),_0x7fe34f);}if(channels[_0x7fe34f[_0x911b('0x6')]]){delete channels[_0x7fe34f[_0x911b('0x6')]];}else if(_0x25f2a9&&channels[_0x25f2a9]){delete transfers[_0x911b('0x5')][_0x25f2a9];delete channels[_0x25f2a9];}}exports[_0x911b('0x14')]=function(_0x3bc314){try{utils[_0x911b('0x15')](util[_0x911b('0x9')](_0x911b('0x16'),_0x3bc314['uniqueid']),_0x3bc314);if(_0x3bc314[_0x911b('0x6')]==_0x3bc314[_0x911b('0x17')]&&_0x3bc314[_0x911b('0xa')]!='OutgoingSpoolFailed'){utils[_0x911b('0x8')](util['format'](_0x911b('0x18'),_0x3bc314[_0x911b('0x6')],_0x3bc314[_0x911b('0x19')],_0x3bc314[_0x911b('0x1a')]));channels[_0x3bc314['uniqueid']]={'uniqueid':_0x3bc314[_0x911b('0x6')],'accountcode':_0x3bc314[_0x911b('0x1b')],'source':_0x3bc314[_0x911b('0xd')],'destination':_0x3bc314[_0x911b('0x1a')],'destinationcontext':_0x3bc314['context'],'channel':_0x3bc314[_0x911b('0xa')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x911b('0x3'),'amaflags':_0x911b('0x1c')};}}catch(_0x2aaac9){utils[_0x911b('0x1d')](util[_0x911b('0x9')]('[%s][calls][newchannel]',_0x3bc314[_0x911b('0x6')]),_0x2aaac9);}};exports[_0x911b('0x1e')]=function(_0x1544ff){try{utils[_0x911b('0x15')](util['format']('[%s][calls][newstate]',_0x1544ff[_0x911b('0x6')]),_0x1544ff);if(!_['isNil'](channels[_0x1544ff[_0x911b('0x6')]])&&_0x1544ff['channelstate']==0x6){utils[_0x911b('0x8')](util[_0x911b('0x9')](_0x911b('0x1f'),_0x1544ff[_0x911b('0x6')],_0x1544ff['context'],_0x1544ff[_0x911b('0xa')]));if(_[_0x911b('0x20')](channels[_0x1544ff[_0x911b('0x6')]][_0x911b('0x21')])){channels[_0x1544ff[_0x911b('0x6')]][_0x911b('0x21')]=utils[_0x911b('0x22')]();}}else if(!_[_0x911b('0x20')](channels[_0x1544ff[_0x911b('0x17')]])&&_0x1544ff[_0x911b('0x23')]==0x6&&_0x1544ff['context']!='transfer'){utils['info'](util[_0x911b('0x9')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1544ff['uniqueid'],_0x1544ff[_0x911b('0x17')],_0x1544ff[_0x911b('0x19')],_0x1544ff[_0x911b('0xa')]));channels[_0x1544ff[_0x911b('0x17')]][_0x911b('0x1b')]=_0x1544ff[_0x911b('0x1b')];channels[_0x1544ff[_0x911b('0x17')]][_0x911b('0x24')]=_0x1544ff[_0x911b('0xa')];if(_['isNil'](channels[_0x1544ff['linkedid']][_0x911b('0x25')])){channels[_0x1544ff['linkedid']][_0x911b('0x25')]=utils[_0x911b('0x22')]();}channels[_0x1544ff[_0x911b('0x17')]][_0x911b('0x26')]=dispositions[_[_0x911b('0x27')](_0x1544ff[_0x911b('0x23')])]||'ANSWERED';}}catch(_0xe462a){utils['error'](util[_0x911b('0x9')](_0x911b('0x28'),_0x1544ff['uniqueid']),_0xe462a);}};exports[_0x911b('0x29')]=function(_0x1943b3){try{if(!_[_0x911b('0x20')](channels[_0x1943b3[_0x911b('0x6')]])){utils[_0x911b('0x15')](util['format'](_0x911b('0x2a'),_0x1943b3['uniqueid']),_0x1943b3);if(_[_0x911b('0x20')](channels[_0x1943b3[_0x911b('0x6')]][_0x911b('0x2b')])){channels[_0x1943b3[_0x911b('0x6')]][_0x911b('0x2b')]=_0x1943b3[_0x911b('0x2c')]+'\x20<'+_0x1943b3[_0x911b('0xd')]+'>';}utils[_0x911b('0x8')](util[_0x911b('0x9')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x1943b3['uniqueid'],channels[_0x1943b3[_0x911b('0x6')]]['callerid'],_0x1943b3['cause-txt']));channels[_0x1943b3[_0x911b('0x6')]]['endtime']=utils['now']();channels[_0x1943b3[_0x911b('0x6')]][_0x911b('0x2d')]=utils[_0x911b('0x2e')](channels[_0x1943b3['uniqueid']][_0x911b('0x2f')],channels[_0x1943b3['uniqueid']][_0x911b('0x30')]);channels[_0x1943b3[_0x911b('0x6')]][_0x911b('0x31')]=channels[_0x1943b3[_0x911b('0x6')]]['answertime']?utils['diffTime'](channels[_0x1943b3[_0x911b('0x6')]][_0x911b('0x2f')],channels[_0x1943b3[_0x911b('0x6')]][_0x911b('0x25')]):0x0;writeDB(channels[_0x1943b3[_0x911b('0x6')]]);}}catch(_0x1e5cb8){utils[_0x911b('0x1d')](util[_0x911b('0x9')](_0x911b('0x2a'),_0x1943b3[_0x911b('0x6')]),_0x1e5cb8);}};exports[_0x911b('0x32')]=function(_0x3ee302){try{if(!_[_0x911b('0x20')](channels[_0x3ee302[_0x911b('0x33')]])){utils[_0x911b('0x15')](util[_0x911b('0x9')](_0x911b('0x34'),_0x3ee302[_0x911b('0x35')]),_0x3ee302);if(channels[_0x3ee302[_0x911b('0x33')]][_0x911b('0xa')]==_0x3ee302[_0x911b('0x36')]){utils[_0x911b('0x8')](util['format'](_0x911b('0x37'),_0x3ee302[_0x911b('0x35')],_0x3ee302[_0x911b('0x33')],_0x3ee302[_0x911b('0x38')]));channels[_0x3ee302['localtwolinkedid']]['destinationchannel']=_0x3ee302['secondtransfererchannel'];channels[_0x3ee302['localtwolinkedid']][_0x911b('0x39')]=_0x911b('0x3a');}else if(channels[_0x3ee302[_0x911b('0x33')]]['channel']=_0x3ee302[_0x911b('0x3b')]){utils[_0x911b('0x8')](util['format'](_0x911b('0x37'),_0x3ee302['origtransfereruniqueid'],_0x3ee302[_0x911b('0x33')],_0x3ee302[_0x911b('0x3c')]));channels[_0x3ee302['localtwolinkedid']][_0x911b('0x24')]=_0x3ee302[_0x911b('0x3c')];channels[_0x3ee302[_0x911b('0x33')]][_0x911b('0x39')]=_0x911b('0x3a');}}}catch(_0x4f861a){utils[_0x911b('0x1d')](util['format'](_0x911b('0x34'),_0x3ee302['origtransfereruniqueid']),_0x4f861a);}};exports['musiconholdstart']=function(_0x1ae285){try{if(!_[_0x911b('0x20')](channels[_0x1ae285[_0x911b('0x6')]])){utils[_0x911b('0x15')](util[_0x911b('0x9')](_0x911b('0x3d'),_0x1ae285['uniqueid']),_0x1ae285);channels[_0x1ae285[_0x911b('0x6')]]['musiconholdstartAt']=utils[_0x911b('0x22')]();utils[_0x911b('0x8')](util['format'](_0x911b('0x3e'),_0x1ae285['uniqueid'],channels[_0x1ae285[_0x911b('0x6')]][_0x911b('0x3f')]));}}catch(_0x4d85ec){utils['error'](util['format'](_0x911b('0x3d'),_0x1ae285[_0x911b('0x6')]),_0x4d85ec);}};exports['musiconholdstop']=function(_0x242dce){try{if(!_['isNil'](channels[_0x242dce['uniqueid']])){utils[_0x911b('0x15')](util['format'](_0x911b('0x40'),_0x242dce[_0x911b('0x6')]),_0x242dce);if(!_['isNil'](channels[_0x242dce['uniqueid']][_0x911b('0x3f')])){channels[_0x242dce[_0x911b('0x6')]][_0x911b('0x41')]+=utils[_0x911b('0x2e')](utils[_0x911b('0x22')](),channels[_0x242dce[_0x911b('0x6')]][_0x911b('0x3f')]);utils['info'](util[_0x911b('0x9')](_0x911b('0x42'),_0x242dce[_0x911b('0x6')],channels[_0x242dce[_0x911b('0x6')]][_0x911b('0x41')]));delete channels[_0x242dce[_0x911b('0x6')]][_0x911b('0x3f')];}}}catch(_0x4ce83d){utils['error'](util[_0x911b('0x9')](_0x911b('0x40'),_0x242dce[_0x911b('0x6')]),_0x4ce83d);}};exports[_0x911b('0x43')]=function(_0x5ca530){try{if(!_[_0x911b('0x20')](channels[_0x5ca530[_0x911b('0x6')]])){utils['debug'](util[_0x911b('0x9')](_0x911b('0x44'),_0x5ca530[_0x911b('0x6')]),_0x5ca530);if(!_[_0x911b('0x20')](_0x5ca530['variable'][_0x911b('0x45')])){utils['info'](util[_0x911b('0x9')](_0x911b('0x46'),_0x5ca530[_0x911b('0x6')],_0x5ca530[_0x911b('0x47')]));channels[_0x5ca530['uniqueid']][_0x911b('0x48')]=_0x5ca530[_0x911b('0x47')];}if(!_[_0x911b('0x20')](_0x5ca530['variable']['xmd-phone'])){utils['info'](util[_0x911b('0x9')](_0x911b('0x49'),_0x5ca530['uniqueid'],_0x5ca530['value']));channels[_0x5ca530[_0x911b('0x6')]][_0x911b('0x4a')]=_0x5ca530[_0x911b('0x47')];channels[_0x5ca530['uniqueid']][_0x911b('0x2b')]='\x22'+_0x5ca530['value']+_0x911b('0x4b')+_0x5ca530[_0x911b('0x47')]+'>';}if(!_[_0x911b('0x20')](_0x5ca530[_0x911b('0x4c')][_0x911b('0x4d')])||!_[_0x911b('0x20')](_0x5ca530['variable'][_0x911b('0x4e')])){utils[_0x911b('0x8')](util['format'](_0x911b('0x4f'),_0x5ca530[_0x911b('0x6')],!_['isNil'](_0x5ca530['variable']['xmd-callerid-preview'])?_0x911b('0x4d'):_0x911b('0x4e'),_0x5ca530[_0x911b('0x47')]));channels[_0x5ca530[_0x911b('0x6')]][_0x911b('0x2b')]=_0x5ca530[_0x911b('0x47')];}if(!_[_0x911b('0x20')](_0x5ca530['variable'][_0x911b('0x50')])||!_['isNil'](_0x5ca530[_0x911b('0x4c')][_0x911b('0x51')])){utils[_0x911b('0x8')](util[_0x911b('0x9')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5ca530[_0x911b('0x6')],!_[_0x911b('0x20')](_0x5ca530[_0x911b('0x4c')]['xmd-queue'])?_0x911b('0x50'):'xmcs-queue',_0x5ca530[_0x911b('0x47')]));channels[_0x5ca530['uniqueid']][_0x911b('0x52')]='Queue';channels[_0x5ca530[_0x911b('0x6')]][_0x911b('0x53')]=_0x5ca530[_0x911b('0x47')];channels[_0x5ca530[_0x911b('0x6')]][_0x911b('0xb')]=!![];}if(!_[_0x911b('0x20')](_0x5ca530['variable'][_0x911b('0x54')])){utils['info'](util[_0x911b('0x9')](_0x911b('0x55'),_0x5ca530[_0x911b('0x6')],_0x5ca530['value']));channels[_0x5ca530[_0x911b('0x6')]]['ContactId']=_0x5ca530[_0x911b('0x47')];}if(!_['isNil'](_0x5ca530[_0x911b('0x4c')]['xmd-cdrtype'])){utils['info'](util[_0x911b('0x9')](_0x911b('0x56'),_0x5ca530['uniqueid'],_0x5ca530[_0x911b('0x47')]));channels[_0x5ca530[_0x911b('0x6')]][_0x911b('0x57')]=_0x5ca530[_0x911b('0x47')];}if(!_[_0x911b('0x20')](_0x5ca530[_0x911b('0x4c')][_0x911b('0x58')])){utils[_0x911b('0x8')](util['format'](_0x911b('0x59'),_0x5ca530['uniqueid'],_0x5ca530[_0x911b('0x47')]));channels[_0x5ca530[_0x911b('0x6')]][_0x911b('0x5a')]=_0x5ca530['value'];}if(!_[_0x911b('0x20')](_0x5ca530[_0x911b('0x4c')][_0x911b('0x5b')])){utils['info'](util['format'](_0x911b('0x5c'),_0x5ca530[_0x911b('0x6')],_0x5ca530[_0x911b('0x47')]));channels[_0x5ca530['uniqueid']]['sipcallid']=_0x5ca530[_0x911b('0x47')];}}}catch(_0x468acc){utils['error'](util['format']('[%s][calls][varset]',_0x5ca530[_0x911b('0x6')]),_0x468acc);}};exports[_0x911b('0x5d')]=function(_0x24aa2e){try{if(!_[_0x911b('0x20')](channels[_0x24aa2e[_0x911b('0x6')]])){utils[_0x911b('0x15')](util['format'](_0x911b('0x5e'),_0x24aa2e[_0x911b('0x6')]),_0x24aa2e);utils[_0x911b('0x8')](util[_0x911b('0x9')](_0x911b('0x5f'),_0x24aa2e[_0x911b('0x6')],_0x24aa2e[_0x911b('0x60')],_0x24aa2e[_0x911b('0x61')]));if(_0x24aa2e[_0x911b('0x60')][_0x911b('0x62')]()==_0x911b('0x63')&&_['startsWith'](_0x24aa2e['appdata'][_0x911b('0x62')](),_0x911b('0x64'))){var _0x17608b=_0x24aa2e[_0x911b('0x61')][_0x911b('0x65')]('=');var _0x417a23=_0x17608b[0x0][_0x911b('0x66')](_0x17608b[0x0]['lastIndexOf']('(')+0x1,_0x17608b[0x0][_0x911b('0x67')](')'));var _0x4b5b73=_0x17608b[0x1];channels[_0x24aa2e['uniqueid']][_0x417a23]=_0x4b5b73;}if(!_['includes']([_0x911b('0x29'),'noop','execif',_0x911b('0x63'),_0x911b('0x68')],_0x24aa2e['application']['toLowerCase']())){channels[_0x24aa2e[_0x911b('0x6')]][_0x911b('0x52')]=_0x24aa2e[_0x911b('0x60')];channels[_0x24aa2e[_0x911b('0x6')]][_0x911b('0x53')]=_0x24aa2e['appdata'];}}}catch(_0x57dbb2){utils[_0x911b('0x1d')](util[_0x911b('0x9')](_0x911b('0x5e'),_0x24aa2e[_0x911b('0x6')]),_0x57dbb2);}}; \ No newline at end of file +var _0x8d26=['xmcs-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','outboundrouteid','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','split','lastIndexOf','includes','noop','execif','gotoif','lastdata','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','CreateVoiceCallReport','request','debug','[%s][calls][newchannel]','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','answertime','toNumber','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','endtime','starttime','billableseconds','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','localtwolinkedid','secondtransfererchannel','_attended','origtransfererchannel','destinationchannel','userfield','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','mohtime','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview','xmd-callerid','xmd-queue'];(function(_0x3315ff,_0x321860){var _0xec5af2=function(_0x5b1a6d){while(--_0x5b1a6d){_0x3315ff['push'](_0x3315ff['shift']());}};_0xec5af2(++_0x321860);}(_0x8d26,0x147));var _0x68d2=function(_0x2703cf,_0x526b31){_0x2703cf=_0x2703cf-0x0;var _0x28f18a=_0x8d26[_0x2703cf];return _0x28f18a;};'use strict';var _=require(_0x68d2('0x0'));var util=require(_0x68d2('0x1'));var utils=require(_0x68d2('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0x68d2('0x3'),_0x68d2('0x4'),_0x68d2('0x4'),_0x68d2('0x3'),_0x68d2('0x3'),'NO\x20ANSWER',_0x68d2('0x5'),_0x68d2('0x6'),_0x68d2('0x4'),_0x68d2('0x4'),'FAILED'];var channels={};function writeDB(_0x23573e){var _0x731c8b;if(transfers[_0x68d2('0x7')][_0x23573e[_0x68d2('0x8')]]){_0x731c8b=_0x23573e['uniqueid'];_0x23573e[_0x68d2('0x8')]=transfers[_0x68d2('0x7')][_0x23573e[_0x68d2('0x8')]][_0x68d2('0x9')];}utils[_0x68d2('0xa')](util[_0x68d2('0xb')](_0x68d2('0xc'),_0x23573e[_0x68d2('0x8')],_0x23573e[_0x68d2('0xd')],_0x23573e[_0x68d2('0xe')],_0x23573e[_0x68d2('0xf')],_0x23573e[_0x68d2('0x10')],_0x23573e[_0x68d2('0x11')],_0x23573e[_0x68d2('0x12')],_0x23573e[_0x68d2('0x13')]));if(_0x23573e[_0x68d2('0x14')]){utils[_0x68d2('0x15')](_0x23573e[_0x68d2('0x14')])[_0x68d2('0x16')](function(_0x4ecdfd){if(_0x4ecdfd){_0x23573e['UserId']=_0x4ecdfd['id'];}utils['request'](_0x68d2('0x17'),_0x23573e);});}else{utils[_0x68d2('0x18')](_0x68d2('0x17'),_0x23573e);}if(channels[_0x23573e[_0x68d2('0x8')]]){delete channels[_0x23573e[_0x68d2('0x8')]];}else if(_0x731c8b&&channels[_0x731c8b]){delete transfers[_0x68d2('0x7')][_0x731c8b];delete channels[_0x731c8b];}}exports['newchannel']=function(_0x5cb255){try{utils[_0x68d2('0x19')](util['format'](_0x68d2('0x1a'),_0x5cb255[_0x68d2('0x8')]),_0x5cb255);if(_0x5cb255[_0x68d2('0x8')]==_0x5cb255['linkedid']&&_0x5cb255[_0x68d2('0xd')]!='OutgoingSpoolFailed'){utils[_0x68d2('0xa')](util[_0x68d2('0xb')](_0x68d2('0x1b'),_0x5cb255['uniqueid'],_0x5cb255[_0x68d2('0x1c')],_0x5cb255[_0x68d2('0x1d')]));channels[_0x5cb255['uniqueid']]={'uniqueid':_0x5cb255[_0x68d2('0x8')],'accountcode':_0x5cb255[_0x68d2('0x14')],'source':_0x5cb255[_0x68d2('0x11')],'destination':_0x5cb255[_0x68d2('0x1d')],'destinationcontext':_0x5cb255[_0x68d2('0x1c')],'channel':_0x5cb255[_0x68d2('0xd')],'starttime':utils[_0x68d2('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x68d2('0x3'),'amaflags':_0x68d2('0x1f')};}}catch(_0x4148bc){utils['error'](util[_0x68d2('0xb')](_0x68d2('0x1a'),_0x5cb255[_0x68d2('0x8')]),_0x4148bc);}};exports[_0x68d2('0x20')]=function(_0x2ab09f){try{utils[_0x68d2('0x19')](util[_0x68d2('0xb')]('[%s][calls][newstate]',_0x2ab09f['uniqueid']),_0x2ab09f);if(!_[_0x68d2('0x21')](channels[_0x2ab09f[_0x68d2('0x8')]])&&_0x2ab09f[_0x68d2('0x22')]==0x6){utils[_0x68d2('0xa')](util['format'](_0x68d2('0x23'),_0x2ab09f[_0x68d2('0x8')],_0x2ab09f[_0x68d2('0x1c')],_0x2ab09f[_0x68d2('0xd')]));if(_[_0x68d2('0x21')](channels[_0x2ab09f[_0x68d2('0x8')]][_0x68d2('0x24')])){channels[_0x2ab09f[_0x68d2('0x8')]][_0x68d2('0x24')]=utils['now']();}}else if(!_[_0x68d2('0x21')](channels[_0x2ab09f[_0x68d2('0x25')]])&&_0x2ab09f[_0x68d2('0x22')]==0x6&&_0x2ab09f[_0x68d2('0x1c')]!='transfer'){utils[_0x68d2('0xa')](util[_0x68d2('0xb')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2ab09f[_0x68d2('0x8')],_0x2ab09f[_0x68d2('0x25')],_0x2ab09f[_0x68d2('0x1c')],_0x2ab09f['channel']));channels[_0x2ab09f['linkedid']][_0x68d2('0x14')]=_0x2ab09f[_0x68d2('0x14')];channels[_0x2ab09f[_0x68d2('0x25')]]['destinationchannel']=_0x2ab09f['channel'];if(_['isNil'](channels[_0x2ab09f['linkedid']][_0x68d2('0x26')])){channels[_0x2ab09f[_0x68d2('0x25')]]['answertime']=utils['now']();}channels[_0x2ab09f[_0x68d2('0x25')]]['disposition']=dispositions[_[_0x68d2('0x27')](_0x2ab09f[_0x68d2('0x22')])]||_0x68d2('0x5');}}catch(_0x298473){utils[_0x68d2('0x28')](util[_0x68d2('0xb')]('[%s][calls][newstate]',_0x2ab09f['uniqueid']),_0x298473);}};exports[_0x68d2('0x29')]=function(_0x2e67f5){try{if(!_[_0x68d2('0x21')](channels[_0x2e67f5[_0x68d2('0x8')]])){utils[_0x68d2('0x19')](util['format'](_0x68d2('0x2a'),_0x2e67f5[_0x68d2('0x8')]),_0x2e67f5);if(_[_0x68d2('0x21')](channels[_0x2e67f5[_0x68d2('0x8')]][_0x68d2('0x2b')])){channels[_0x2e67f5[_0x68d2('0x8')]]['callerid']=_0x2e67f5[_0x68d2('0x2c')]+'\x20<'+_0x2e67f5[_0x68d2('0x11')]+'>';}utils['info'](util[_0x68d2('0xb')](_0x68d2('0x2d'),_0x2e67f5[_0x68d2('0x8')],channels[_0x2e67f5[_0x68d2('0x8')]][_0x68d2('0x2b')],_0x2e67f5[_0x68d2('0x2e')]));channels[_0x2e67f5[_0x68d2('0x8')]]['endtime']=utils['now']();channels[_0x2e67f5['uniqueid']][_0x68d2('0x2f')]=utils[_0x68d2('0x30')](channels[_0x2e67f5[_0x68d2('0x8')]][_0x68d2('0x31')],channels[_0x2e67f5[_0x68d2('0x8')]][_0x68d2('0x32')]);channels[_0x2e67f5['uniqueid']][_0x68d2('0x33')]=channels[_0x2e67f5[_0x68d2('0x8')]][_0x68d2('0x26')]?utils[_0x68d2('0x30')](channels[_0x2e67f5[_0x68d2('0x8')]][_0x68d2('0x31')],channels[_0x2e67f5[_0x68d2('0x8')]][_0x68d2('0x26')]):0x0;writeDB(channels[_0x2e67f5[_0x68d2('0x8')]]);}}catch(_0x491e16){utils[_0x68d2('0x28')](util['format']('[%s][calls][hangup]',_0x2e67f5[_0x68d2('0x8')]),_0x491e16);}};exports[_0x68d2('0x34')]=function(_0x3341a7){try{if(!_[_0x68d2('0x21')](channels[_0x3341a7['localtwolinkedid']])){utils[_0x68d2('0x19')](util['format'](_0x68d2('0x35'),_0x3341a7[_0x68d2('0x36')]),_0x3341a7);if(channels[_0x3341a7['localtwolinkedid']][_0x68d2('0xd')]==_0x3341a7[_0x68d2('0x37')]){utils[_0x68d2('0xa')](util[_0x68d2('0xb')](_0x68d2('0x38'),_0x3341a7['origtransfereruniqueid'],_0x3341a7[_0x68d2('0x39')],_0x3341a7[_0x68d2('0x3a')]));channels[_0x3341a7['localtwolinkedid']]['destinationchannel']=_0x3341a7['secondtransfererchannel'];channels[_0x3341a7['localtwolinkedid']]['userfield']=_0x68d2('0x3b');}else if(channels[_0x3341a7[_0x68d2('0x39')]][_0x68d2('0xd')]=_0x3341a7['transfertargetchannel']){utils['info'](util[_0x68d2('0xb')](_0x68d2('0x38'),_0x3341a7['origtransfereruniqueid'],_0x3341a7['localtwolinkedid'],_0x3341a7[_0x68d2('0x3c')]));channels[_0x3341a7[_0x68d2('0x39')]][_0x68d2('0x3d')]=_0x3341a7[_0x68d2('0x3c')];channels[_0x3341a7[_0x68d2('0x39')]][_0x68d2('0x3e')]=_0x68d2('0x3b');}}}catch(_0xe20375){utils[_0x68d2('0x28')](util[_0x68d2('0xb')]('[%s][calls][attendedtransfer]',_0x3341a7[_0x68d2('0x36')]),_0xe20375);}};exports[_0x68d2('0x3f')]=function(_0x3fd5fd){try{if(!_[_0x68d2('0x21')](channels[_0x3fd5fd[_0x68d2('0x8')]])){utils[_0x68d2('0x19')](util[_0x68d2('0xb')]('[%s][calls][musiconholdstart]',_0x3fd5fd[_0x68d2('0x8')]),_0x3fd5fd);channels[_0x3fd5fd['uniqueid']][_0x68d2('0x40')]=utils['now']();utils[_0x68d2('0xa')](util[_0x68d2('0xb')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x3fd5fd[_0x68d2('0x8')],channels[_0x3fd5fd[_0x68d2('0x8')]][_0x68d2('0x40')]));}}catch(_0x3bad03){utils[_0x68d2('0x28')](util['format'](_0x68d2('0x41'),_0x3fd5fd['uniqueid']),_0x3bad03);}};exports['musiconholdstop']=function(_0x4dca54){try{if(!_[_0x68d2('0x21')](channels[_0x4dca54[_0x68d2('0x8')]])){utils[_0x68d2('0x19')](util[_0x68d2('0xb')](_0x68d2('0x42'),_0x4dca54['uniqueid']),_0x4dca54);if(!_[_0x68d2('0x21')](channels[_0x4dca54['uniqueid']][_0x68d2('0x40')])){channels[_0x4dca54[_0x68d2('0x8')]][_0x68d2('0x43')]+=utils['diffTime'](utils[_0x68d2('0x1e')](),channels[_0x4dca54['uniqueid']][_0x68d2('0x40')]);utils[_0x68d2('0xa')](util[_0x68d2('0xb')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x4dca54[_0x68d2('0x8')],channels[_0x4dca54[_0x68d2('0x8')]][_0x68d2('0x43')]));delete channels[_0x4dca54['uniqueid']][_0x68d2('0x40')];}}}catch(_0x409359){utils[_0x68d2('0x28')](util['format'](_0x68d2('0x42'),_0x4dca54[_0x68d2('0x8')]),_0x409359);}};exports['varset']=function(_0x5e532d){try{if(!_[_0x68d2('0x21')](channels[_0x5e532d[_0x68d2('0x8')]])){utils[_0x68d2('0x19')](util['format']('[%s][calls][varset]',_0x5e532d['uniqueid']),_0x5e532d);if(!_[_0x68d2('0x21')](_0x5e532d[_0x68d2('0x44')][_0x68d2('0x45')])){utils[_0x68d2('0xa')](util[_0x68d2('0xb')](_0x68d2('0x46'),_0x5e532d[_0x68d2('0x8')],_0x5e532d[_0x68d2('0x47')]));channels[_0x5e532d[_0x68d2('0x8')]][_0x68d2('0x48')]=_0x5e532d[_0x68d2('0x47')];}if(!_[_0x68d2('0x21')](_0x5e532d[_0x68d2('0x44')]['xmd-phone'])){utils[_0x68d2('0xa')](util[_0x68d2('0xb')](_0x68d2('0x49'),_0x5e532d[_0x68d2('0x8')],_0x5e532d[_0x68d2('0x47')]));channels[_0x5e532d[_0x68d2('0x8')]]['destination']=_0x5e532d[_0x68d2('0x47')];channels[_0x5e532d['uniqueid']][_0x68d2('0x2b')]='\x22'+_0x5e532d[_0x68d2('0x47')]+'\x22\x20<'+_0x5e532d['value']+'>';}if(!_[_0x68d2('0x21')](_0x5e532d['variable'][_0x68d2('0x4a')])||!_['isNil'](_0x5e532d['variable'][_0x68d2('0x4b')])){utils[_0x68d2('0xa')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5e532d[_0x68d2('0x8')],!_['isNil'](_0x5e532d[_0x68d2('0x44')][_0x68d2('0x4a')])?_0x68d2('0x4a'):_0x68d2('0x4b'),_0x5e532d['value']));channels[_0x5e532d[_0x68d2('0x8')]]['callerid']=_0x5e532d['value'];}if(!_[_0x68d2('0x21')](_0x5e532d[_0x68d2('0x44')][_0x68d2('0x4c')])||!_['isNil'](_0x5e532d[_0x68d2('0x44')]['xmcs-queue'])){utils[_0x68d2('0xa')](util[_0x68d2('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5e532d[_0x68d2('0x8')],!_[_0x68d2('0x21')](_0x5e532d['variable'][_0x68d2('0x4c')])?_0x68d2('0x4c'):_0x68d2('0x4d'),_0x5e532d[_0x68d2('0x47')]));channels[_0x5e532d['uniqueid']][_0x68d2('0x4e')]=_0x68d2('0x4f');channels[_0x5e532d[_0x68d2('0x8')]]['lastdata']=_0x5e532d[_0x68d2('0x47')];channels[_0x5e532d[_0x68d2('0x8')]]['queue']=!![];}if(!_[_0x68d2('0x21')](_0x5e532d[_0x68d2('0x44')][_0x68d2('0x50')])){utils[_0x68d2('0xa')](util['format'](_0x68d2('0x51'),_0x5e532d[_0x68d2('0x8')],_0x5e532d[_0x68d2('0x47')]));channels[_0x5e532d[_0x68d2('0x8')]][_0x68d2('0x52')]=_0x5e532d['value'];}if(!_[_0x68d2('0x21')](_0x5e532d['variable'][_0x68d2('0x53')])){utils[_0x68d2('0xa')](util[_0x68d2('0xb')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5e532d['uniqueid'],_0x5e532d[_0x68d2('0x47')]));channels[_0x5e532d[_0x68d2('0x8')]]['type']=_0x5e532d[_0x68d2('0x47')];}if(!_['isNil'](_0x5e532d[_0x68d2('0x44')][_0x68d2('0x54')])){utils[_0x68d2('0xa')](util['format']('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x5e532d[_0x68d2('0x8')],_0x5e532d[_0x68d2('0x47')]));channels[_0x5e532d[_0x68d2('0x8')]]['routeid']=_0x5e532d[_0x68d2('0x47')];}if(!_['isNil'](_0x5e532d[_0x68d2('0x44')]['sipcallid'])){utils['info'](util[_0x68d2('0xb')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x5e532d[_0x68d2('0x8')],_0x5e532d[_0x68d2('0x47')]));channels[_0x5e532d['uniqueid']][_0x68d2('0x55')]=_0x5e532d[_0x68d2('0x47')];}}}catch(_0x35947e){utils[_0x68d2('0x28')](util[_0x68d2('0xb')](_0x68d2('0x56'),_0x5e532d['uniqueid']),_0x35947e);}};exports[_0x68d2('0x57')]=function(_0x103137){try{if(!_[_0x68d2('0x21')](channels[_0x103137[_0x68d2('0x8')]])){utils['debug'](util[_0x68d2('0xb')](_0x68d2('0x58'),_0x103137[_0x68d2('0x8')]),_0x103137);utils[_0x68d2('0xa')](util[_0x68d2('0xb')](_0x68d2('0x59'),_0x103137['uniqueid'],_0x103137[_0x68d2('0x5a')],_0x103137[_0x68d2('0x5b')]));if(_0x103137[_0x68d2('0x5a')][_0x68d2('0x5c')]()==_0x68d2('0x5d')&&_['startsWith'](_0x103137['appdata'][_0x68d2('0x5c')](),'cdr')){var _0x48cf5e=_0x103137[_0x68d2('0x5b')][_0x68d2('0x5e')]('=');var _0x276dce=_0x48cf5e[0x0]['substring'](_0x48cf5e[0x0][_0x68d2('0x5f')]('(')+0x1,_0x48cf5e[0x0][_0x68d2('0x5f')](')'));var _0x1964cf=_0x48cf5e[0x1];channels[_0x103137[_0x68d2('0x8')]][_0x276dce]=_0x1964cf;}if(!_[_0x68d2('0x60')]([_0x68d2('0x29'),_0x68d2('0x61'),_0x68d2('0x62'),'set',_0x68d2('0x63')],_0x103137[_0x68d2('0x5a')][_0x68d2('0x5c')]())){channels[_0x103137['uniqueid']][_0x68d2('0x4e')]=_0x103137['application'];channels[_0x103137[_0x68d2('0x8')]][_0x68d2('0x64')]=_0x103137[_0x68d2('0x5b')];}}}catch(_0x2b9c4b){utils[_0x68d2('0x28')](util[_0x68d2('0xb')](_0x68d2('0x58'),_0x103137[_0x68d2('0x8')]),_0x2b9c4b);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index c38acfb..aa2728b 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 _0x8c1d=['./utils','connect','info','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','managerevent'];(function(_0x258762,_0x39be9e){var _0x4bdbe7=function(_0x40253e){while(--_0x40253e){_0x258762['push'](_0x258762['shift']());}};_0x4bdbe7(++_0x39be9e);}(_0x8c1d,0xe7));var _0xd8c1=function(_0x12c3aa,_0x9d52a7){_0x12c3aa=_0x12c3aa-0x0;var _0x178c7e=_0x8c1d[_0x12c3aa];return _0x178c7e;};'use strict';var utils=require(_0xd8c1('0x0'));exports[_0xd8c1('0x1')]=function(){utils[_0xd8c1('0x2')]('[core]\x20connected');};exports[_0xd8c1('0x3')]=function(){utils['info'](_0xd8c1('0x4'));};exports[_0xd8c1('0x5')]=function(){utils[_0xd8c1('0x2')](_0xd8c1('0x6'));};exports[_0xd8c1('0x7')]=function(_0x5059c8){utils[_0xd8c1('0x7')]('[core]\x20error',_0x5059c8);};exports[_0xd8c1('0x8')]=function(){utils[_0xd8c1('0x2')](_0xd8c1('0x9'));};exports[_0xd8c1('0xa')]=function(_0x4f7e93){}; \ No newline at end of file +var _0xee5e=['connect','info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils'];(function(_0x4fde38,_0x219ff9){var _0x46bd89=function(_0x293cf7){while(--_0x293cf7){_0x4fde38['push'](_0x4fde38['shift']());}};_0x46bd89(++_0x219ff9);}(_0xee5e,0x83));var _0xeee5=function(_0x2187d4,_0x57aabe){_0x2187d4=_0x2187d4-0x0;var _0x13e1bb=_0xee5e[_0x2187d4];return _0x13e1bb;};'use strict';var utils=require(_0xeee5('0x0'));exports[_0xeee5('0x1')]=function(){utils[_0xeee5('0x2')](_0xeee5('0x3'));};exports[_0xeee5('0x4')]=function(){utils[_0xeee5('0x2')]('[core]\x20shutdown');};exports[_0xeee5('0x5')]=function(){utils['info'](_0xeee5('0x6'));};exports[_0xeee5('0x7')]=function(_0xed765a){utils['error'](_0xeee5('0x8'),_0xed765a);};exports[_0xeee5('0x9')]=function(){utils[_0xeee5('0x2')](_0xeee5('0xa'));};exports[_0xeee5('0xb')]=function(_0xfeea00){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 988486d..b16958f 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 _0xf024=['[%s][dials][dialbegin]','assign','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','error','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration','diffTime','endtime','billableseconds','[%s][dials][hangup]','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','dialstatus','CreateVoiceDialReport','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf024,0x10c));var _0x4f02=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xf024[_0xc4001c];return _0x49f7bc;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x4f02('0x0'));var dials={};function writeDB(_0x4133c0){utils[_0x4f02('0x1')](util['format'](_0x4f02('0x2'),_0x4133c0[_0x4f02('0x3')],_0x4133c0[_0x4f02('0x4')],_0x4133c0[_0x4f02('0x5')],_0x4133c0[_0x4f02('0x6')],_0x4133c0['connectedlinenum'],_0x4133c0[_0x4f02('0x7')]));utils['request'](_0x4f02('0x8'),_0x4133c0);delete dials[_0x4133c0[_0x4f02('0x3')]];}exports['newexten']=function(_0x310b90){try{utils[_0x4f02('0x9')](util[_0x4f02('0xa')](_0x4f02('0xb'),_0x310b90[_0x4f02('0x3')]),_0x310b90);utils['info'](util[_0x4f02('0xa')](_0x4f02('0xc'),_0x310b90[_0x4f02('0x3')],_0x310b90['application'],_0x310b90['appdata']));if(_0x310b90[_0x4f02('0xd')][_0x4f02('0xe')]()==_0x4f02('0xf')&&_[_0x4f02('0x10')](_0x310b90[_0x4f02('0x11')]['toLowerCase'](),_0x4f02('0x12'))){var _0xf6c30d=_0x310b90[_0x4f02('0x11')][_0x4f02('0x13')]('=');dials[_0x310b90[_0x4f02('0x3')]]={'routeId':_0xf6c30d[0x1]};}}catch(_0x261a80){utils['error'](util[_0x4f02('0xa')](_0x4f02('0xb'),_0x310b90[_0x4f02('0x3')]),_0x261a80);}};exports['varset']=function(_0xfe1279){try{utils['debug'](util[_0x4f02('0xa')](_0x4f02('0x14'),_0xfe1279[_0x4f02('0x3')]),_0xfe1279);if(!_[_0x4f02('0x15')](_0xfe1279[_0x4f02('0x16')][_0x4f02('0x17')])){utils['info'](util['format'](_0x4f02('0x18'),_0xfe1279[_0x4f02('0x3')],_0xfe1279[_0x4f02('0x19')]));dials[_0xfe1279[_0x4f02('0x3')]]={'routeId':_0xfe1279[_0x4f02('0x19')]};}}catch(_0x440716){utils['error'](util['format'](_0x4f02('0x14'),_0xfe1279[_0x4f02('0x3')]),_0x440716);}};exports['dialbegin']=function(_0x44cfd3){try{if(!_[_0x4f02('0x15')](dials[_0x44cfd3[_0x4f02('0x3')]])){utils['debug'](util[_0x4f02('0xa')](_0x4f02('0x1a'),_0x44cfd3[_0x4f02('0x3')]),_0x44cfd3);dials[_0x44cfd3[_0x4f02('0x3')]]=_[_0x4f02('0x1b')](dials[_0x44cfd3[_0x4f02('0x3')]],_0x44cfd3);dials[_0x44cfd3[_0x4f02('0x3')]]['starttime']=utils[_0x4f02('0x1c')]();dials[_0x44cfd3[_0x4f02('0x3')]][_0x4f02('0x1d')]=_0x4f02('0x1e');utils['info'](util['format'](_0x4f02('0x1f'),_0x44cfd3[_0x4f02('0x3')],dials[_0x44cfd3[_0x4f02('0x3')]][_0x4f02('0x20')]));}}catch(_0x29a481){utils[_0x4f02('0x21')](util['format']('[%s][dials][dialbegin]',_0x44cfd3[_0x4f02('0x3')]),_0x29a481);}};exports[_0x4f02('0x22')]=function(_0x3a88fe){try{if(!_[_0x4f02('0x15')](dials[_0x3a88fe['uniqueid']])){utils[_0x4f02('0x9')](util[_0x4f02('0xa')](_0x4f02('0x23'),_0x3a88fe['uniqueid']),_0x3a88fe);dials[_0x3a88fe['uniqueid']]['dialstatus']=_0x3a88fe['dialstatus'];if(_0x3a88fe[_0x4f02('0x7')]==_0x4f02('0x24')){dials[_0x3a88fe[_0x4f02('0x3')]]=_[_0x4f02('0x1b')](dials[_0x3a88fe[_0x4f02('0x3')]],_0x3a88fe);dials[_0x3a88fe['uniqueid']][_0x4f02('0x25')]=utils[_0x4f02('0x1c')]();dials[_0x3a88fe['uniqueid']][_0x4f02('0x1d')]=_0x4f02('0x26');utils[_0x4f02('0x1')](util[_0x4f02('0xa')](_0x4f02('0x27'),_0x3a88fe['uniqueid'],_0x3a88fe['dialstatus'],dials[_0x3a88fe[_0x4f02('0x3')]]['answertime']));}else{utils['info'](util[_0x4f02('0xa')](_0x4f02('0x28'),_0x3a88fe[_0x4f02('0x3')],_0x3a88fe[_0x4f02('0x7')]));}}}catch(_0x178de0){utils[_0x4f02('0x21')](util[_0x4f02('0xa')](_0x4f02('0x23'),_0x3a88fe[_0x4f02('0x3')]),_0x178de0);}};exports['hangup']=function(_0x3a3636){try{if(!_[_0x4f02('0x15')](dials[_0x3a3636[_0x4f02('0x3')]])){utils[_0x4f02('0x9')](util[_0x4f02('0xa')]('[%s][dials][hangup]',_0x3a3636[_0x4f02('0x3')]),_0x3a3636);utils[_0x4f02('0x1')](util[_0x4f02('0xa')](_0x4f02('0x29'),_0x3a3636[_0x4f02('0x3')],_0x3a3636[_0x4f02('0x6')],_0x3a3636['calleridname'],_0x3a3636[_0x4f02('0x2a')]));dials[_0x3a3636[_0x4f02('0x3')]]=_[_0x4f02('0x1b')](dials[_0x3a3636[_0x4f02('0x3')]],{'endtime':utils[_0x4f02('0x1c')](),'lastevent':_0x4f02('0x2b')});dials[_0x3a3636[_0x4f02('0x3')]][_0x4f02('0x2c')]=utils[_0x4f02('0x2d')](dials[_0x3a3636[_0x4f02('0x3')]][_0x4f02('0x2e')],dials[_0x3a3636[_0x4f02('0x3')]][_0x4f02('0x20')]);dials[_0x3a3636['uniqueid']]['holdtime']=utils[_0x4f02('0x2d')](dials[_0x3a3636[_0x4f02('0x3')]]['answertime']||dials[_0x3a3636[_0x4f02('0x3')]][_0x4f02('0x2e')],dials[_0x3a3636['uniqueid']]['starttime']);dials[_0x3a3636['uniqueid']][_0x4f02('0x2f')]=dials[_0x3a3636['uniqueid']][_0x4f02('0x25')]?utils[_0x4f02('0x2d')](dials[_0x3a3636['uniqueid']][_0x4f02('0x2e')],dials[_0x3a3636[_0x4f02('0x3')]][_0x4f02('0x25')]):0x0;writeDB(dials[_0x3a3636[_0x4f02('0x3')]]);}}catch(_0x26f243){utils[_0x4f02('0x21')](util[_0x4f02('0xa')](_0x4f02('0x30'),_0x3a3636[_0x4f02('0x3')]),_0x26f243);}}; \ No newline at end of file +var _0x634b=['[%s][dials][varset]','assign','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','[%s][dials][dialend]','ANSWER','connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','calleridname','cause-txt','now','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','dialstring','calleridnum','connectedlinenum','dialstatus','request','uniqueid','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr(routeid)','error','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0x634b,0x130));var _0xb634=function(_0x78cf63,_0x34de9e){_0x78cf63=_0x78cf63-0x0;var _0x361e27=_0x634b[_0x78cf63];return _0x361e27;};'use strict';var _=require(_0xb634('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0xd7b501){utils[_0xb634('0x1')](util[_0xb634('0x2')](_0xb634('0x3'),_0xd7b501['uniqueid'],_0xd7b501['channel'],_0xd7b501[_0xb634('0x4')],_0xd7b501[_0xb634('0x5')],_0xd7b501[_0xb634('0x6')],_0xd7b501[_0xb634('0x7')]));utils[_0xb634('0x8')]('CreateVoiceDialReport',_0xd7b501);delete dials[_0xd7b501[_0xb634('0x9')]];}exports[_0xb634('0xa')]=function(_0x2c1868){try{utils[_0xb634('0xb')](util[_0xb634('0x2')](_0xb634('0xc'),_0x2c1868[_0xb634('0x9')]),_0x2c1868);utils[_0xb634('0x1')](util[_0xb634('0x2')](_0xb634('0xd'),_0x2c1868[_0xb634('0x9')],_0x2c1868[_0xb634('0xe')],_0x2c1868[_0xb634('0xf')]));if(_0x2c1868[_0xb634('0xe')][_0xb634('0x10')]()==_0xb634('0x11')&&_['startsWith'](_0x2c1868[_0xb634('0xf')][_0xb634('0x10')](),_0xb634('0x12'))){var _0x5e46f1=_0x2c1868[_0xb634('0xf')]['split']('=');dials[_0x2c1868['uniqueid']]={'routeId':_0x5e46f1[0x1]};}}catch(_0x4712cd){utils[_0xb634('0x13')](util[_0xb634('0x2')](_0xb634('0xc'),_0x2c1868[_0xb634('0x9')]),_0x4712cd);}};exports['varset']=function(_0x3ada30){try{utils['debug'](util[_0xb634('0x2')]('[%s][dials][varset]',_0x3ada30[_0xb634('0x9')]),_0x3ada30);if(!_[_0xb634('0x14')](_0x3ada30[_0xb634('0x15')][_0xb634('0x16')])){utils['info'](util['format'](_0xb634('0x17'),_0x3ada30[_0xb634('0x9')],_0x3ada30['value']));dials[_0x3ada30[_0xb634('0x9')]]={'routeId':_0x3ada30[_0xb634('0x18')]};}}catch(_0x3385b1){utils[_0xb634('0x13')](util['format'](_0xb634('0x19'),_0x3ada30[_0xb634('0x9')]),_0x3385b1);}};exports['dialbegin']=function(_0x114615){try{if(!_[_0xb634('0x14')](dials[_0x114615['uniqueid']])){utils[_0xb634('0xb')](util['format']('[%s][dials][dialbegin]',_0x114615[_0xb634('0x9')]),_0x114615);dials[_0x114615['uniqueid']]=_[_0xb634('0x1a')](dials[_0x114615[_0xb634('0x9')]],_0x114615);dials[_0x114615['uniqueid']][_0xb634('0x1b')]=utils['now']();dials[_0x114615[_0xb634('0x9')]][_0xb634('0x1c')]=_0xb634('0x1d');utils[_0xb634('0x1')](util[_0xb634('0x2')](_0xb634('0x1e'),_0x114615[_0xb634('0x9')],dials[_0x114615[_0xb634('0x9')]][_0xb634('0x1b')]));}}catch(_0x772ee5){utils[_0xb634('0x13')](util[_0xb634('0x2')](_0xb634('0x1f'),_0x114615[_0xb634('0x9')]),_0x772ee5);}};exports['dialend']=function(_0x3ac81f){try{if(!_[_0xb634('0x14')](dials[_0x3ac81f[_0xb634('0x9')]])){utils[_0xb634('0xb')](util[_0xb634('0x2')](_0xb634('0x20'),_0x3ac81f[_0xb634('0x9')]),_0x3ac81f);dials[_0x3ac81f[_0xb634('0x9')]]['dialstatus']=_0x3ac81f[_0xb634('0x7')];if(_0x3ac81f[_0xb634('0x7')]==_0xb634('0x21')){dials[_0x3ac81f[_0xb634('0x9')]]=_['assign'](dials[_0x3ac81f[_0xb634('0x9')]],_0x3ac81f);dials[_0x3ac81f[_0xb634('0x9')]]['answertime']=utils['now']();dials[_0x3ac81f[_0xb634('0x9')]][_0xb634('0x1c')]=_0xb634('0x22');utils[_0xb634('0x1')](util[_0xb634('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x3ac81f[_0xb634('0x9')],_0x3ac81f[_0xb634('0x7')],dials[_0x3ac81f[_0xb634('0x9')]][_0xb634('0x23')]));}else{utils[_0xb634('0x1')](util[_0xb634('0x2')](_0xb634('0x24'),_0x3ac81f[_0xb634('0x9')],_0x3ac81f[_0xb634('0x7')]));}}}catch(_0x201d78){utils[_0xb634('0x13')](util['format']('[%s][dials][dialend]',_0x3ac81f[_0xb634('0x9')]),_0x201d78);}};exports['hangup']=function(_0x34fcdc){try{if(!_[_0xb634('0x14')](dials[_0x34fcdc[_0xb634('0x9')]])){utils[_0xb634('0xb')](util[_0xb634('0x2')](_0xb634('0x25'),_0x34fcdc[_0xb634('0x9')]),_0x34fcdc);utils['info'](util[_0xb634('0x2')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x34fcdc[_0xb634('0x9')],_0x34fcdc[_0xb634('0x5')],_0x34fcdc[_0xb634('0x26')],_0x34fcdc[_0xb634('0x27')]));dials[_0x34fcdc[_0xb634('0x9')]]=_[_0xb634('0x1a')](dials[_0x34fcdc[_0xb634('0x9')]],{'endtime':utils[_0xb634('0x28')](),'lastevent':_0xb634('0x29')});dials[_0x34fcdc[_0xb634('0x9')]][_0xb634('0x2a')]=utils[_0xb634('0x2b')](dials[_0x34fcdc[_0xb634('0x9')]][_0xb634('0x2c')],dials[_0x34fcdc[_0xb634('0x9')]][_0xb634('0x1b')]);dials[_0x34fcdc[_0xb634('0x9')]][_0xb634('0x2d')]=utils[_0xb634('0x2b')](dials[_0x34fcdc[_0xb634('0x9')]]['answertime']||dials[_0x34fcdc[_0xb634('0x9')]][_0xb634('0x2c')],dials[_0x34fcdc[_0xb634('0x9')]][_0xb634('0x1b')]);dials[_0x34fcdc[_0xb634('0x9')]][_0xb634('0x2e')]=dials[_0x34fcdc['uniqueid']][_0xb634('0x23')]?utils['diffTime'](dials[_0x34fcdc['uniqueid']][_0xb634('0x2c')],dials[_0x34fcdc[_0xb634('0x9')]][_0xb634('0x23')]):0x0;writeDB(dials[_0x34fcdc['uniqueid']]);}}catch(_0xabc95b){utils[_0xb634('0x13')](util['format'](_0xb634('0x25'),_0x34fcdc[_0xb634('0x9')]),_0xabc95b);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index fdb3f73..846d6db 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 _0xdb1b=['newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk','username','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','uniqueid','[%s][index][agentcalled]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]'];(function(_0x33e9ab,_0x1687d8){var _0xc5250b=function(_0x54abce){while(--_0x54abce){_0x33e9ab['push'](_0x33e9ab['shift']());}};_0xc5250b(++_0x1687d8);}(_0xdb1b,0x1db));var _0xbdb1=function(_0x41f752,_0x45c2a5){_0x41f752=_0x41f752-0x0;var _0xfc28cb=_0xdb1b[_0x41f752];return _0xfc28cb;};var AsteriskManager=require(_0xbdb1('0x0'));var config=require(_0xbdb1('0x1'));var utils=require(_0xbdb1('0x2'));var util=require(_0xbdb1('0x3'));var ami=new AsteriskManager(config[_0xbdb1('0x4')]['port'],config[_0xbdb1('0x4')]['ip'],config[_0xbdb1('0x4')][_0xbdb1('0x5')],config[_0xbdb1('0x4')]['password'],!![]);ami[_0xbdb1('0x6')]();if(config[_0xbdb1('0x7')]&&config['xdr'][_0xbdb1('0x8')]){utils[_0xbdb1('0x9')](_0xbdb1('0xa'));}else{var agents=require(_0xbdb1('0xb'));var calls=require(_0xbdb1('0xc'));var queues=require(_0xbdb1('0xd'));var recordings=require('./recordings.controller');var members=require(_0xbdb1('0xe'));var dials=require(_0xbdb1('0xf'));var transfers=require(_0xbdb1('0x10'));var core=require(_0xbdb1('0x11'));ami['on']('connect',core[_0xbdb1('0x12')]);ami['on'](_0xbdb1('0x13'),core['shutdown']);ami['on'](_0xbdb1('0x14'),core[_0xbdb1('0x14')]);ami['on'](_0xbdb1('0x15'),core['error']);ami['on']('close',core[_0xbdb1('0x16')]);ami['on'](_0xbdb1('0x17'),core[_0xbdb1('0x17')]);ami['on'](_0xbdb1('0x18'),function(_0x2a7ecc){try{utils[_0xbdb1('0x19')](util[_0xbdb1('0x1a')](_0xbdb1('0x1b'),_0x2a7ecc[_0xbdb1('0x1c')]),_0x2a7ecc);members[_0xbdb1('0x18')](_0x2a7ecc);}catch(_0x355050){utils[_0xbdb1('0x15')](util[_0xbdb1('0x1a')](_0xbdb1('0x1b'),_0x2a7ecc[_0xbdb1('0x1c')]),_0x355050);}});ami['on']('agentcalled',function(_0x2524c1){try{utils[_0xbdb1('0x19')](util[_0xbdb1('0x1a')]('[%s][index][agentcalled]',_0x2524c1[_0xbdb1('0x1d')]),_0x2524c1);agents['agentcalled'](_0x2524c1);}catch(_0x1b0af2){utils[_0xbdb1('0x15')](util[_0xbdb1('0x1a')](_0xbdb1('0x1e'),_0x2524c1[_0xbdb1('0x1d')]),_0x1b0af2);}});ami['on'](_0xbdb1('0x1f'),function(_0x28436b){try{utils[_0xbdb1('0x19')](util[_0xbdb1('0x1a')]('[%s][index][agentringnoanswer]',_0x28436b[_0xbdb1('0x1d')]),_0x28436b);agents[_0xbdb1('0x1f')](_0x28436b);}catch(_0x30d04f){utils[_0xbdb1('0x15')](util[_0xbdb1('0x1a')]('[%s][index][agentringnoanswer]',_0x28436b[_0xbdb1('0x1d')]),_0x30d04f);}});ami['on'](_0xbdb1('0x20'),function(_0x5811fc){try{utils[_0xbdb1('0x19')](util['format'](_0xbdb1('0x21'),_0x5811fc[_0xbdb1('0x1d')]),_0x5811fc);agents[_0xbdb1('0x20')](_0x5811fc);queues[_0xbdb1('0x20')](_0x5811fc);}catch(_0x2caf8c){utils[_0xbdb1('0x15')](util[_0xbdb1('0x1a')](_0xbdb1('0x21'),_0x5811fc[_0xbdb1('0x1d')]),_0x2caf8c);}});ami['on'](_0xbdb1('0x22'),function(_0xbd93c7){try{utils[_0xbdb1('0x19')](util[_0xbdb1('0x1a')](_0xbdb1('0x23'),_0xbd93c7['uniqueid']),_0xbd93c7);agents[_0xbdb1('0x22')](_0xbd93c7);queues[_0xbdb1('0x22')](_0xbd93c7);members[_0xbdb1('0x22')](_0xbd93c7);}catch(_0x335a48){utils[_0xbdb1('0x15')](util[_0xbdb1('0x1a')](_0xbdb1('0x23'),_0xbd93c7[_0xbdb1('0x1d')]),_0x335a48);}});ami['on']('queuecallerabandon',function(_0x56e264){try{utils[_0xbdb1('0x19')](util[_0xbdb1('0x1a')](_0xbdb1('0x24'),_0x56e264[_0xbdb1('0x1d')]),_0x56e264);agents['queuecallerabandon'](_0x56e264);queues[_0xbdb1('0x25')](_0x56e264);}catch(_0x2263dc){utils[_0xbdb1('0x15')](util[_0xbdb1('0x1a')](_0xbdb1('0x24'),_0x56e264[_0xbdb1('0x1d')]),_0x2263dc);}});ami['on'](_0xbdb1('0x26'),function(_0x5c6829){try{utils[_0xbdb1('0x19')](util[_0xbdb1('0x1a')]('[%s][index][queuecallerjoin]',_0x5c6829[_0xbdb1('0x1d')]),_0x5c6829);queues[_0xbdb1('0x26')](_0x5c6829);recordings[_0xbdb1('0x26')](_0x5c6829);}catch(_0xfcf184){utils[_0xbdb1('0x15')](util['format'](_0xbdb1('0x27'),_0x5c6829[_0xbdb1('0x1d')]),_0xfcf184);}});ami['on']('queuecallerleave',function(_0x5755d4){try{utils[_0xbdb1('0x19')](util['format'](_0xbdb1('0x28'),_0x5755d4['uniqueid']),_0x5755d4);queues[_0xbdb1('0x29')](_0x5755d4);}catch(_0x2bb1c2){utils[_0xbdb1('0x15')](util[_0xbdb1('0x1a')](_0xbdb1('0x28'),_0x5755d4[_0xbdb1('0x1d')]),_0x2bb1c2);}});ami['on'](_0xbdb1('0x2a'),function(_0x3f77ee){try{utils[_0xbdb1('0x19')](util[_0xbdb1('0x1a')](_0xbdb1('0x2b'),_0x3f77ee[_0xbdb1('0x1d')]),_0x3f77ee);queues['musiconholdstart'](_0x3f77ee);calls[_0xbdb1('0x2a')](_0x3f77ee);}catch(_0xd3d7cf){utils[_0xbdb1('0x15')](util['format'](_0xbdb1('0x2b'),_0x3f77ee[_0xbdb1('0x1d')]),_0xd3d7cf);}});ami['on'](_0xbdb1('0x2c'),function(_0x22feb6){try{utils[_0xbdb1('0x19')](util[_0xbdb1('0x1a')](_0xbdb1('0x2d'),_0x22feb6[_0xbdb1('0x1d')]),_0x22feb6);queues[_0xbdb1('0x2c')](_0x22feb6);calls[_0xbdb1('0x2c')](_0x22feb6);}catch(_0x6ae7b1){utils['error'](util[_0xbdb1('0x1a')]('[%s][index][musiconholdstop]',_0x22feb6[_0xbdb1('0x1d')]),_0x6ae7b1);}});ami['on']('newstate',function(_0x1b6739){try{utils['debug'](util[_0xbdb1('0x1a')](_0xbdb1('0x2e'),_0x1b6739[_0xbdb1('0x1d')]),_0x1b6739);calls['newstate'](_0x1b6739);recordings[_0xbdb1('0x2f')](_0x1b6739);}catch(_0x102f65){utils[_0xbdb1('0x15')](util[_0xbdb1('0x1a')]('[%s][index][newstate]',_0x1b6739['uniqueid']),_0x102f65);}});ami['on'](_0xbdb1('0x30'),function(_0x25ce01){try{utils[_0xbdb1('0x19')](util[_0xbdb1('0x1a')](_0xbdb1('0x31'),_0x25ce01[_0xbdb1('0x1d')]),_0x25ce01);calls[_0xbdb1('0x30')](_0x25ce01);recordings[_0xbdb1('0x30')](_0x25ce01);dials[_0xbdb1('0x30')](_0x25ce01);agents['hangup'](_0x25ce01);queues[_0xbdb1('0x30')](_0x25ce01);}catch(_0x2d1a7c){utils[_0xbdb1('0x15')](util['format'](_0xbdb1('0x31'),_0x25ce01[_0xbdb1('0x1d')]),_0x2d1a7c);}});ami['on'](_0xbdb1('0x32'),function(_0x2ac24e){try{utils[_0xbdb1('0x19')](util['format'](_0xbdb1('0x33'),_0x2ac24e[_0xbdb1('0x1d')]),_0x2ac24e);members[_0xbdb1('0x32')](_0x2ac24e);}catch(_0x54f7d7){utils[_0xbdb1('0x15')](util[_0xbdb1('0x1a')]('[%s][index][cdr]',_0x2ac24e[_0xbdb1('0x1d')]),_0x54f7d7);}});ami['on'](_0xbdb1('0x34'),function(_0xfe476a){try{utils[_0xbdb1('0x19')](util[_0xbdb1('0x1a')]('[%s][index][blindtransfer]',_0xfe476a[_0xbdb1('0x1d')]),_0xfe476a);queues[_0xbdb1('0x34')](_0xfe476a);agents['blindtransfer'](_0xfe476a);transfers[_0xbdb1('0x34')](_0xfe476a);}catch(_0x132927){utils[_0xbdb1('0x15')](util[_0xbdb1('0x1a')](_0xbdb1('0x35'),_0xfe476a[_0xbdb1('0x1d')]),_0x132927);}});ami['on'](_0xbdb1('0x36'),function(_0x175302){try{utils['debug'](util[_0xbdb1('0x1a')](_0xbdb1('0x37'),_0x175302[_0xbdb1('0x38')]),_0x175302);queues[_0xbdb1('0x36')](_0x175302);transfers[_0xbdb1('0x36')](_0x175302);agents[_0xbdb1('0x36')](_0x175302);calls[_0xbdb1('0x36')](_0x175302);}catch(_0x5c1bc8){utils['error'](util[_0xbdb1('0x1a')](_0xbdb1('0x37'),_0x175302['origtransfereruniqueid']),_0x5c1bc8);}});ami['on']('varset',function(_0x345b75){try{utils[_0xbdb1('0x19')](util[_0xbdb1('0x1a')](_0xbdb1('0x39'),_0x345b75[_0xbdb1('0x1d')]),_0x345b75);queues[_0xbdb1('0x3a')](_0x345b75);recordings[_0xbdb1('0x3a')](_0x345b75);calls[_0xbdb1('0x3a')](_0x345b75);dials[_0xbdb1('0x3a')](_0x345b75);}catch(_0x2d97a4){utils[_0xbdb1('0x15')](util['format'](_0xbdb1('0x39'),_0x345b75[_0xbdb1('0x1d')]),_0x2d97a4);}});ami['on'](_0xbdb1('0x3b'),function(_0x3b0a81){try{utils['debug'](util[_0xbdb1('0x1a')](_0xbdb1('0x3c'),_0x3b0a81[_0xbdb1('0x1d')]),_0x3b0a81);calls[_0xbdb1('0x3b')](_0x3b0a81);recordings[_0xbdb1('0x3b')](_0x3b0a81);dials[_0xbdb1('0x3b')](_0x3b0a81);}catch(_0x34856e){utils[_0xbdb1('0x15')](util[_0xbdb1('0x1a')](_0xbdb1('0x3c'),_0x3b0a81[_0xbdb1('0x1d')]),_0x34856e);}});ami['on'](_0xbdb1('0x3d'),function(_0x2cff37){try{utils['debug'](util[_0xbdb1('0x1a')](_0xbdb1('0x3e'),_0x2cff37[_0xbdb1('0x1d')]),_0x2cff37);calls['newchannel'](_0x2cff37);recordings[_0xbdb1('0x3d')](_0x2cff37);}catch(_0x94e614){utils[_0xbdb1('0x15')](util[_0xbdb1('0x1a')](_0xbdb1('0x3e'),_0x2cff37[_0xbdb1('0x1d')]),_0x94e614);}});ami['on'](_0xbdb1('0x3f'),function(_0x13badf){try{utils['debug'](util['format'](_0xbdb1('0x40'),_0x13badf[_0xbdb1('0x1d')]),_0x13badf);dials[_0xbdb1('0x3f')](_0x13badf);}catch(_0x5a7974){utils[_0xbdb1('0x15')](util[_0xbdb1('0x1a')]('[%s]dialbegin',_0x13badf[_0xbdb1('0x1d')]),_0x5a7974);}});ami['on'](_0xbdb1('0x41'),function(_0x28b718){try{utils[_0xbdb1('0x19')](util['format'](_0xbdb1('0x42'),_0x28b718[_0xbdb1('0x1d')]),_0x28b718);dials[_0xbdb1('0x41')](_0x28b718);}catch(_0x24af04){utils[_0xbdb1('0x15')](util[_0xbdb1('0x1a')](_0xbdb1('0x42'),_0x28b718['uniqueid']),_0x24af04);}});} \ No newline at end of file +var _0x2d7e=['[%s][index][dialend]','../../config/environment','./utils','util','asterisk','port','password','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2d7e,0x10d));var _0xe2d7=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0x2d7e[_0x484c03];return _0x294127;};var AsteriskManager=require('asterisk-manager');var config=require(_0xe2d7('0x0'));var utils=require(_0xe2d7('0x1'));var util=require(_0xe2d7('0x2'));var ami=new AsteriskManager(config[_0xe2d7('0x3')][_0xe2d7('0x4')],config[_0xe2d7('0x3')]['ip'],config[_0xe2d7('0x3')]['username'],config[_0xe2d7('0x3')][_0xe2d7('0x5')],!![]);ami['keepConnected']();if(config[_0xe2d7('0x6')]&&config[_0xe2d7('0x6')][_0xe2d7('0x7')]){utils[_0xe2d7('0x8')](_0xe2d7('0x9'));}else{var agents=require(_0xe2d7('0xa'));var calls=require(_0xe2d7('0xb'));var queues=require(_0xe2d7('0xc'));var recordings=require(_0xe2d7('0xd'));var members=require(_0xe2d7('0xe'));var dials=require(_0xe2d7('0xf'));var transfers=require(_0xe2d7('0x10'));var core=require('./core.controller');ami['on'](_0xe2d7('0x11'),core['connect']);ami['on'](_0xe2d7('0x12'),core[_0xe2d7('0x12')]);ami['on'](_0xe2d7('0x13'),core['fullybooted']);ami['on'](_0xe2d7('0x14'),core[_0xe2d7('0x14')]);ami['on']('close',core[_0xe2d7('0x15')]);ami['on'](_0xe2d7('0x16'),core[_0xe2d7('0x16')]);ami['on'](_0xe2d7('0x17'),function(_0x7766f){try{utils[_0xe2d7('0x18')](util[_0xe2d7('0x19')](_0xe2d7('0x1a'),_0x7766f[_0xe2d7('0x1b')]),_0x7766f);members[_0xe2d7('0x17')](_0x7766f);}catch(_0x2aedba){utils[_0xe2d7('0x14')](util['format'](_0xe2d7('0x1a'),_0x7766f['device']),_0x2aedba);}});ami['on']('agentcalled',function(_0x5abd76){try{utils[_0xe2d7('0x18')](util[_0xe2d7('0x19')](_0xe2d7('0x1c'),_0x5abd76[_0xe2d7('0x1d')]),_0x5abd76);agents[_0xe2d7('0x1e')](_0x5abd76);}catch(_0x4d2ec0){utils[_0xe2d7('0x14')](util[_0xe2d7('0x19')]('[%s][index][agentcalled]',_0x5abd76[_0xe2d7('0x1d')]),_0x4d2ec0);}});ami['on'](_0xe2d7('0x1f'),function(_0x4b3fe7){try{utils[_0xe2d7('0x18')](util[_0xe2d7('0x19')](_0xe2d7('0x20'),_0x4b3fe7[_0xe2d7('0x1d')]),_0x4b3fe7);agents[_0xe2d7('0x1f')](_0x4b3fe7);}catch(_0x82c36a){utils[_0xe2d7('0x14')](util[_0xe2d7('0x19')](_0xe2d7('0x20'),_0x4b3fe7[_0xe2d7('0x1d')]),_0x82c36a);}});ami['on'](_0xe2d7('0x21'),function(_0x361fd0){try{utils[_0xe2d7('0x18')](util[_0xe2d7('0x19')](_0xe2d7('0x22'),_0x361fd0[_0xe2d7('0x1d')]),_0x361fd0);agents['agentconnect'](_0x361fd0);queues[_0xe2d7('0x21')](_0x361fd0);}catch(_0x2b72ee){utils['error'](util['format'](_0xe2d7('0x22'),_0x361fd0[_0xe2d7('0x1d')]),_0x2b72ee);}});ami['on']('agentcomplete',function(_0x407148){try{utils['debug'](util[_0xe2d7('0x19')](_0xe2d7('0x23'),_0x407148[_0xe2d7('0x1d')]),_0x407148);agents['agentcomplete'](_0x407148);queues[_0xe2d7('0x24')](_0x407148);members['agentcomplete'](_0x407148);}catch(_0x3d5396){utils[_0xe2d7('0x14')](util['format'](_0xe2d7('0x23'),_0x407148[_0xe2d7('0x1d')]),_0x3d5396);}});ami['on'](_0xe2d7('0x25'),function(_0x444108){try{utils[_0xe2d7('0x18')](util[_0xe2d7('0x19')](_0xe2d7('0x26'),_0x444108[_0xe2d7('0x1d')]),_0x444108);agents[_0xe2d7('0x25')](_0x444108);queues[_0xe2d7('0x25')](_0x444108);}catch(_0x43e8b1){utils[_0xe2d7('0x14')](util['format']('[%s][index][queuecallerabandon]',_0x444108[_0xe2d7('0x1d')]),_0x43e8b1);}});ami['on'](_0xe2d7('0x27'),function(_0x24d13e){try{utils[_0xe2d7('0x18')](util[_0xe2d7('0x19')](_0xe2d7('0x28'),_0x24d13e[_0xe2d7('0x1d')]),_0x24d13e);queues[_0xe2d7('0x27')](_0x24d13e);recordings['queuecallerjoin'](_0x24d13e);}catch(_0xd3ab17){utils[_0xe2d7('0x14')](util[_0xe2d7('0x19')](_0xe2d7('0x28'),_0x24d13e[_0xe2d7('0x1d')]),_0xd3ab17);}});ami['on'](_0xe2d7('0x29'),function(_0x8ebc99){try{utils[_0xe2d7('0x18')](util['format'](_0xe2d7('0x2a'),_0x8ebc99[_0xe2d7('0x1d')]),_0x8ebc99);queues[_0xe2d7('0x29')](_0x8ebc99);}catch(_0x4bb303){utils[_0xe2d7('0x14')](util[_0xe2d7('0x19')](_0xe2d7('0x2a'),_0x8ebc99[_0xe2d7('0x1d')]),_0x4bb303);}});ami['on']('musiconholdstart',function(_0x28cc34){try{utils['debug'](util[_0xe2d7('0x19')]('[%s][index][musiconholdstart]',_0x28cc34[_0xe2d7('0x1d')]),_0x28cc34);queues['musiconholdstart'](_0x28cc34);calls['musiconholdstart'](_0x28cc34);}catch(_0x1c5f42){utils[_0xe2d7('0x14')](util[_0xe2d7('0x19')](_0xe2d7('0x2b'),_0x28cc34[_0xe2d7('0x1d')]),_0x1c5f42);}});ami['on'](_0xe2d7('0x2c'),function(_0xaaa8a9){try{utils[_0xe2d7('0x18')](util['format']('[%s][index][musiconholdstop]',_0xaaa8a9[_0xe2d7('0x1d')]),_0xaaa8a9);queues['musiconholdstop'](_0xaaa8a9);calls[_0xe2d7('0x2c')](_0xaaa8a9);}catch(_0xe3a7c){utils[_0xe2d7('0x14')](util['format']('[%s][index][musiconholdstop]',_0xaaa8a9[_0xe2d7('0x1d')]),_0xe3a7c);}});ami['on'](_0xe2d7('0x2d'),function(_0x490145){try{utils[_0xe2d7('0x18')](util[_0xe2d7('0x19')](_0xe2d7('0x2e'),_0x490145['uniqueid']),_0x490145);calls[_0xe2d7('0x2d')](_0x490145);recordings[_0xe2d7('0x2d')](_0x490145);}catch(_0x3a1921){utils[_0xe2d7('0x14')](util['format'](_0xe2d7('0x2e'),_0x490145[_0xe2d7('0x1d')]),_0x3a1921);}});ami['on'](_0xe2d7('0x2f'),function(_0x15960a){try{utils[_0xe2d7('0x18')](util[_0xe2d7('0x19')](_0xe2d7('0x30'),_0x15960a[_0xe2d7('0x1d')]),_0x15960a);calls['hangup'](_0x15960a);recordings[_0xe2d7('0x2f')](_0x15960a);dials[_0xe2d7('0x2f')](_0x15960a);agents[_0xe2d7('0x2f')](_0x15960a);queues[_0xe2d7('0x2f')](_0x15960a);}catch(_0x496ab9){utils[_0xe2d7('0x14')](util[_0xe2d7('0x19')]('[%s][index][hangup]',_0x15960a['uniqueid']),_0x496ab9);}});ami['on'](_0xe2d7('0x31'),function(_0x4156ce){try{utils[_0xe2d7('0x18')](util['format']('[%s][index][cdr]',_0x4156ce[_0xe2d7('0x1d')]),_0x4156ce);members[_0xe2d7('0x31')](_0x4156ce);}catch(_0x38f66d){utils[_0xe2d7('0x14')](util[_0xe2d7('0x19')](_0xe2d7('0x32'),_0x4156ce[_0xe2d7('0x1d')]),_0x38f66d);}});ami['on'](_0xe2d7('0x33'),function(_0x352598){try{utils[_0xe2d7('0x18')](util[_0xe2d7('0x19')](_0xe2d7('0x34'),_0x352598['uniqueid']),_0x352598);queues[_0xe2d7('0x33')](_0x352598);agents[_0xe2d7('0x33')](_0x352598);transfers[_0xe2d7('0x33')](_0x352598);}catch(_0x151c11){utils[_0xe2d7('0x14')](util[_0xe2d7('0x19')](_0xe2d7('0x34'),_0x352598[_0xe2d7('0x1d')]),_0x151c11);}});ami['on'](_0xe2d7('0x35'),function(_0x19e1d5){try{utils['debug'](util[_0xe2d7('0x19')]('[%s][index][attendedtransfer]',_0x19e1d5[_0xe2d7('0x36')]),_0x19e1d5);queues[_0xe2d7('0x35')](_0x19e1d5);transfers[_0xe2d7('0x35')](_0x19e1d5);agents[_0xe2d7('0x35')](_0x19e1d5);calls[_0xe2d7('0x35')](_0x19e1d5);}catch(_0x17d7a1){utils['error'](util[_0xe2d7('0x19')](_0xe2d7('0x37'),_0x19e1d5[_0xe2d7('0x36')]),_0x17d7a1);}});ami['on'](_0xe2d7('0x38'),function(_0x6d4cb2){try{utils[_0xe2d7('0x18')](util[_0xe2d7('0x19')](_0xe2d7('0x39'),_0x6d4cb2[_0xe2d7('0x1d')]),_0x6d4cb2);queues['varset'](_0x6d4cb2);recordings[_0xe2d7('0x38')](_0x6d4cb2);calls['varset'](_0x6d4cb2);dials[_0xe2d7('0x38')](_0x6d4cb2);}catch(_0x1a4a86){utils[_0xe2d7('0x14')](util[_0xe2d7('0x19')](_0xe2d7('0x39'),_0x6d4cb2[_0xe2d7('0x1d')]),_0x1a4a86);}});ami['on'](_0xe2d7('0x3a'),function(_0x53748f){try{utils[_0xe2d7('0x18')](util[_0xe2d7('0x19')]('[%s][index][newexten]',_0x53748f['uniqueid']),_0x53748f);calls[_0xe2d7('0x3a')](_0x53748f);recordings[_0xe2d7('0x3a')](_0x53748f);dials['newexten'](_0x53748f);}catch(_0x5f4da8){utils['error'](util['format'](_0xe2d7('0x3b'),_0x53748f['uniqueid']),_0x5f4da8);}});ami['on'](_0xe2d7('0x3c'),function(_0x14255a){try{utils[_0xe2d7('0x18')](util['format'](_0xe2d7('0x3d'),_0x14255a['uniqueid']),_0x14255a);calls[_0xe2d7('0x3c')](_0x14255a);recordings[_0xe2d7('0x3c')](_0x14255a);}catch(_0x1e3ae7){utils[_0xe2d7('0x14')](util[_0xe2d7('0x19')](_0xe2d7('0x3d'),_0x14255a[_0xe2d7('0x1d')]),_0x1e3ae7);}});ami['on']('dialbegin',function(_0x4f5849){try{utils[_0xe2d7('0x18')](util['format'](_0xe2d7('0x3e'),_0x4f5849[_0xe2d7('0x1d')]),_0x4f5849);dials[_0xe2d7('0x3f')](_0x4f5849);}catch(_0x39a22c){utils['error'](util[_0xe2d7('0x19')](_0xe2d7('0x40'),_0x4f5849[_0xe2d7('0x1d')]),_0x39a22c);}});ami['on'](_0xe2d7('0x41'),function(_0x5c4100){try{utils[_0xe2d7('0x18')](util[_0xe2d7('0x19')](_0xe2d7('0x42'),_0x5c4100[_0xe2d7('0x1d')]),_0x5c4100);dials['dialend'](_0x5c4100);}catch(_0x27dc90){utils['error'](util[_0xe2d7('0x19')](_0xe2d7('0x42'),_0x5c4100[_0xe2d7('0x1d')]),_0x27dc90);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index f72e8ed..f443180 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 _0xdfd7=['data1','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','name','internal','CreateMemberReport','getUserByName','split','then','error','[%s][members][writeDB]','some','startsWith','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','voice','agent','exitAt','duration','diffTime','enterAt','agentcomplete','isNil','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]'];(function(_0x51bbe8,_0x538079){var _0x15d8f9=function(_0x258444){while(--_0x258444){_0x51bbe8['push'](_0x51bbe8['shift']());}};_0x15d8f9(++_0x538079);}(_0xdfd7,0x95));var _0x7dfd=function(_0x19c7f6,_0x58b59a){_0x19c7f6=_0x19c7f6-0x0;var _0x509752=_0xdfd7[_0x19c7f6];return _0x509752;};'use strict';var _=require(_0x7dfd('0x0'));var util=require('util');var utils=require(_0x7dfd('0x1'));var members={};var exclude=[_0x7dfd('0x2'),_0x7dfd('0x3')];function writeDB(_0xf80fa2){utils[_0x7dfd('0x4')](util[_0x7dfd('0x5')](_0x7dfd('0x6'),_0xf80fa2[_0x7dfd('0x7')],_0xf80fa2[_0x7dfd('0x8')],_0xf80fa2[_0x7dfd('0x9')],_0xf80fa2[_0x7dfd('0xa')],_0xf80fa2[_0x7dfd('0xb')],_0xf80fa2[_0x7dfd('0xc')]));if(_0xf80fa2['interface']){utils[_0x7dfd('0xd')](_0xf80fa2[_0x7dfd('0x8')])['then'](function(_0x3d7198){if(_0x3d7198){_0xf80fa2[_0x7dfd('0xb')]=_0x3d7198[_0x7dfd('0xe')];_0xf80fa2[_0x7dfd('0xf')]=_0x3d7198[_0x7dfd('0xf')];utils['request'](_0x7dfd('0x10'),_0xf80fa2);}else{utils[_0x7dfd('0x11')](_0xf80fa2[_0x7dfd('0x8')][_0x7dfd('0x12')]('/')[0x1])[_0x7dfd('0x13')](function(_0x19607e){if(_0x19607e){_0xf80fa2[_0x7dfd('0xb')]=_0x19607e[_0x7dfd('0xe')];_0xf80fa2[_0x7dfd('0xf')]=_0x19607e[_0x7dfd('0xf')];utils['request'](_0x7dfd('0x10'),_0xf80fa2);}});}})['catch'](function(_0x4e3067){utils[_0x7dfd('0x14')](util[_0x7dfd('0x5')](_0x7dfd('0x15'),_0xf80fa2['uniqueid']),_0x4e3067);});}delete members[_0xf80fa2[_0x7dfd('0x8')]];}function startsWith(_0x34a1ff,_0x5a4a70){return _[_0x7dfd('0x16')](_0x34a1ff,function(_0x4b46c3){return _[_0x7dfd('0x17')](_0x5a4a70,_0x4b46c3);});}exports['devicestatechange']=function(_0x3b6bf2){try{utils['debug'](util['format'](_0x7dfd('0x18'),members[_0x3b6bf2[_0x7dfd('0x19')]]?members[_0x3b6bf2[_0x7dfd('0x19')]][_0x7dfd('0x7')]:_0x3b6bf2['device']),_0x3b6bf2);utils[_0x7dfd('0x4')](util[_0x7dfd('0x5')](_0x7dfd('0x1a'),members[_0x3b6bf2[_0x7dfd('0x19')]]?members[_0x3b6bf2[_0x7dfd('0x19')]][_0x7dfd('0x7')]:_0x3b6bf2[_0x7dfd('0x19')],_0x3b6bf2[_0x7dfd('0x1b')],_0x3b6bf2['device']));switch(_0x3b6bf2['state']){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x3b6bf2[_0x7dfd('0x19')])){members[_0x3b6bf2[_0x7dfd('0x19')]]={'channel':_0x7dfd('0x1c'),'interface':_0x3b6bf2[_0x7dfd('0x19')],'type':'TALKING','enterAt':utils['now'](),'role':_0x7dfd('0x1d')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x3b6bf2['device']])){members[_0x3b6bf2[_0x7dfd('0x19')]][_0x7dfd('0x1e')]=utils['now']();members[_0x3b6bf2[_0x7dfd('0x19')]][_0x7dfd('0x1f')]=utils[_0x7dfd('0x20')](members[_0x3b6bf2['device']][_0x7dfd('0x1e')],members[_0x3b6bf2[_0x7dfd('0x19')]][_0x7dfd('0x21')]);if(members[_0x3b6bf2[_0x7dfd('0x19')]][_0x7dfd('0x7')]){writeDB(members[_0x3b6bf2[_0x7dfd('0x19')]]);}}break;default:break;}}catch(_0x578797){utils[_0x7dfd('0x14')](util[_0x7dfd('0x5')](_0x7dfd('0x18'),members[_0x3b6bf2[_0x7dfd('0x19')]]?members[_0x3b6bf2[_0x7dfd('0x19')]]['uniqueid']:_0x3b6bf2[_0x7dfd('0x19')]),_0x578797);}};exports[_0x7dfd('0x22')]=function(_0x25b102){try{if(!_[_0x7dfd('0x23')](members[_0x25b102[_0x7dfd('0x8')]])){utils[_0x7dfd('0x24')](util[_0x7dfd('0x5')](_0x7dfd('0x25'),_0x25b102[_0x7dfd('0x7')]),_0x25b102);utils['info'](util[_0x7dfd('0x5')](_0x7dfd('0x26'),_0x25b102[_0x7dfd('0x7')],_0x25b102[_0x7dfd('0x8')],_0x25b102['queue']));members[_0x25b102[_0x7dfd('0x8')]]=_[_0x7dfd('0x27')](members[_0x25b102[_0x7dfd('0x8')]],{'data4':_0x25b102[_0x7dfd('0x28')],'uniqueid':_0x25b102[_0x7dfd('0x7')]});}}catch(_0x153ec3){utils[_0x7dfd('0x14')](util['format']('[%s][members][agentcomplete]',_0x25b102[_0x7dfd('0x7')]),_0x153ec3);}};exports[_0x7dfd('0x29')]=function(_0x20f6bf){try{utils['debug'](util[_0x7dfd('0x5')](_0x7dfd('0x2a'),_0x20f6bf[_0x7dfd('0x7')]),_0x20f6bf);if(_0x20f6bf[_0x7dfd('0x9')]){var _0x37a484=_0x20f6bf[_0x7dfd('0x9')][_0x7dfd('0x12')]('-')[0x0];if(!_[_0x7dfd('0x23')](members[_0x37a484])){members[_0x37a484]=_[_0x7dfd('0x27')](members[_0x37a484],{'data1':members[_0x37a484][_0x7dfd('0x2b')]||_0x20f6bf[_0x7dfd('0xc')],'data2':members[_0x37a484][_0x7dfd('0xa')]||_0x20f6bf[_0x7dfd('0x2c')],'data3':members[_0x37a484][_0x7dfd('0x2d')]||_0x20f6bf['destination'],'uniqueid':members[_0x37a484][_0x7dfd('0x7')]||_0x20f6bf['uniqueid']});utils[_0x7dfd('0x4')](util[_0x7dfd('0x5')](_0x7dfd('0x2e'),_0x20f6bf[_0x7dfd('0x7')],members[_0x37a484]['data1'],members[_0x37a484][_0x7dfd('0xa')],members[_0x37a484][_0x7dfd('0x2d')]));if(members[_0x37a484][_0x7dfd('0x1e')]){writeDB(members[_0x37a484]);}}}if(_0x20f6bf['destinationchannel']){var _0x3e0ac2=_0x20f6bf[_0x7dfd('0x2f')][_0x7dfd('0x12')]('-')[0x0];if(!_['isNil'](members[_0x3e0ac2])){members[_0x3e0ac2]=_['assign'](members[_0x3e0ac2],{'data1':members[_0x3e0ac2]['data1']||_0x20f6bf['type'],'data2':members[_0x3e0ac2]['data2']||_0x20f6bf[_0x7dfd('0x2c')],'data3':members[_0x3e0ac2][_0x7dfd('0x2d')]||_0x20f6bf['destination'],'uniqueid':members[_0x3e0ac2][_0x7dfd('0x7')]||_0x20f6bf[_0x7dfd('0x7')]});utils['info'](util[_0x7dfd('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x20f6bf[_0x7dfd('0x7')],members[_0x3e0ac2]['data1'],members[_0x3e0ac2]['data2'],members[_0x3e0ac2][_0x7dfd('0x2d')]));if(members[_0x3e0ac2][_0x7dfd('0x1e')]){writeDB(members[_0x3e0ac2]);}}}}catch(_0x402cd9){utils[_0x7dfd('0x14')](util['format'](_0x7dfd('0x2a'),_0x20f6bf[_0x7dfd('0x7')]),_0x402cd9);}}; \ No newline at end of file +var _0x6ba5=['some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','diffTime','enterAt','agentcomplete','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','source','data3','destination','destinationchannel','data1','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Local/_attended@transfer','Queue:','info','interface','channel','data2','type','then','membername','name','internal','request','CreateMemberReport','split','catch','error','format','uniqueid'];(function(_0x592960,_0x57bcc6){var _0x2c7ea2=function(_0x3dc96a){while(--_0x3dc96a){_0x592960['push'](_0x592960['shift']());}};_0x2c7ea2(++_0x57bcc6);}(_0x6ba5,0x1bf));var _0x56ba=function(_0x132d12,_0x2c9799){_0x132d12=_0x132d12-0x0;var _0x1c3163=_0x6ba5[_0x132d12];return _0x1c3163;};'use strict';var _=require(_0x56ba('0x0'));var util=require(_0x56ba('0x1'));var utils=require(_0x56ba('0x2'));var members={};var exclude=[_0x56ba('0x3'),_0x56ba('0x4')];function writeDB(_0x516c21){utils[_0x56ba('0x5')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x516c21['uniqueid'],_0x516c21[_0x56ba('0x6')],_0x516c21[_0x56ba('0x7')],_0x516c21[_0x56ba('0x8')],_0x516c21['membername'],_0x516c21[_0x56ba('0x9')]));if(_0x516c21['interface']){utils['getUserByInterface'](_0x516c21[_0x56ba('0x6')])[_0x56ba('0xa')](function(_0x5d506c){if(_0x5d506c){_0x516c21[_0x56ba('0xb')]=_0x5d506c[_0x56ba('0xc')];_0x516c21[_0x56ba('0xd')]=_0x5d506c['internal'];utils[_0x56ba('0xe')](_0x56ba('0xf'),_0x516c21);}else{utils['getUserByName'](_0x516c21[_0x56ba('0x6')][_0x56ba('0x10')]('/')[0x1])[_0x56ba('0xa')](function(_0x53cb53){if(_0x53cb53){_0x516c21['membername']=_0x53cb53[_0x56ba('0xc')];_0x516c21['internal']=_0x53cb53[_0x56ba('0xd')];utils[_0x56ba('0xe')](_0x56ba('0xf'),_0x516c21);}});}})[_0x56ba('0x11')](function(_0x15ac99){utils[_0x56ba('0x12')](util[_0x56ba('0x13')]('[%s][members][writeDB]',_0x516c21[_0x56ba('0x14')]),_0x15ac99);});}delete members[_0x516c21[_0x56ba('0x6')]];}function startsWith(_0x5c9d7b,_0xa36f00){return _[_0x56ba('0x15')](_0x5c9d7b,function(_0x5216a9){return _[_0x56ba('0x16')](_0xa36f00,_0x5216a9);});}exports[_0x56ba('0x17')]=function(_0x4e3ab2){try{utils[_0x56ba('0x18')](util[_0x56ba('0x13')](_0x56ba('0x19'),members[_0x4e3ab2['device']]?members[_0x4e3ab2[_0x56ba('0x1a')]][_0x56ba('0x14')]:_0x4e3ab2[_0x56ba('0x1a')]),_0x4e3ab2);utils[_0x56ba('0x5')](util[_0x56ba('0x13')](_0x56ba('0x1b'),members[_0x4e3ab2['device']]?members[_0x4e3ab2[_0x56ba('0x1a')]][_0x56ba('0x14')]:_0x4e3ab2['device'],_0x4e3ab2[_0x56ba('0x1c')],_0x4e3ab2[_0x56ba('0x1a')]));switch(_0x4e3ab2[_0x56ba('0x1c')]){case _0x56ba('0x1d'):case _0x56ba('0x1e'):if(!startsWith(exclude,_0x4e3ab2[_0x56ba('0x1a')])){members[_0x4e3ab2[_0x56ba('0x1a')]]={'channel':_0x56ba('0x1f'),'interface':_0x4e3ab2['device'],'type':_0x56ba('0x20'),'enterAt':utils[_0x56ba('0x21')](),'role':_0x56ba('0x22')};}break;case _0x56ba('0x23'):if(!_[_0x56ba('0x24')](members[_0x4e3ab2[_0x56ba('0x1a')]])){members[_0x4e3ab2['device']][_0x56ba('0x25')]=utils['now']();members[_0x4e3ab2[_0x56ba('0x1a')]]['duration']=utils[_0x56ba('0x26')](members[_0x4e3ab2[_0x56ba('0x1a')]][_0x56ba('0x25')],members[_0x4e3ab2['device']][_0x56ba('0x27')]);if(members[_0x4e3ab2['device']]['uniqueid']){writeDB(members[_0x4e3ab2['device']]);}}break;default:break;}}catch(_0x7a49ee){utils['error'](util[_0x56ba('0x13')](_0x56ba('0x19'),members[_0x4e3ab2[_0x56ba('0x1a')]]?members[_0x4e3ab2[_0x56ba('0x1a')]][_0x56ba('0x14')]:_0x4e3ab2['device']),_0x7a49ee);}};exports[_0x56ba('0x28')]=function(_0x11a34e){try{if(!_[_0x56ba('0x24')](members[_0x11a34e['interface']])){utils[_0x56ba('0x18')](util[_0x56ba('0x13')]('[%s][members][agentcomplete]',_0x11a34e[_0x56ba('0x14')]),_0x11a34e);utils[_0x56ba('0x5')](util[_0x56ba('0x13')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x11a34e[_0x56ba('0x14')],_0x11a34e[_0x56ba('0x6')],_0x11a34e[_0x56ba('0x29')]));members[_0x11a34e[_0x56ba('0x6')]]=_[_0x56ba('0x2a')](members[_0x11a34e[_0x56ba('0x6')]],{'data4':_0x11a34e[_0x56ba('0x29')],'uniqueid':_0x11a34e['uniqueid']});}}catch(_0x20802e){utils[_0x56ba('0x12')](util[_0x56ba('0x13')](_0x56ba('0x2b'),_0x11a34e['uniqueid']),_0x20802e);}};exports[_0x56ba('0x2c')]=function(_0x30579f){try{utils[_0x56ba('0x18')](util['format'](_0x56ba('0x2d'),_0x30579f[_0x56ba('0x14')]),_0x30579f);if(_0x30579f['channel']){var _0x2d52dc=_0x30579f[_0x56ba('0x7')]['split']('-')[0x0];if(!_[_0x56ba('0x24')](members[_0x2d52dc])){members[_0x2d52dc]=_['assign'](members[_0x2d52dc],{'data1':members[_0x2d52dc]['data1']||_0x30579f[_0x56ba('0x9')],'data2':members[_0x2d52dc][_0x56ba('0x8')]||_0x30579f[_0x56ba('0x2e')],'data3':members[_0x2d52dc][_0x56ba('0x2f')]||_0x30579f[_0x56ba('0x30')],'uniqueid':members[_0x2d52dc]['uniqueid']||_0x30579f[_0x56ba('0x14')]});utils[_0x56ba('0x5')](util[_0x56ba('0x13')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x30579f[_0x56ba('0x14')],members[_0x2d52dc]['data1'],members[_0x2d52dc][_0x56ba('0x8')],members[_0x2d52dc][_0x56ba('0x2f')]));if(members[_0x2d52dc][_0x56ba('0x25')]){writeDB(members[_0x2d52dc]);}}}if(_0x30579f[_0x56ba('0x31')]){var _0x417fa3=_0x30579f[_0x56ba('0x31')][_0x56ba('0x10')]('-')[0x0];if(!_['isNil'](members[_0x417fa3])){members[_0x417fa3]=_[_0x56ba('0x2a')](members[_0x417fa3],{'data1':members[_0x417fa3][_0x56ba('0x32')]||_0x30579f['type'],'data2':members[_0x417fa3][_0x56ba('0x8')]||_0x30579f[_0x56ba('0x2e')],'data3':members[_0x417fa3]['data3']||_0x30579f['destination'],'uniqueid':members[_0x417fa3]['uniqueid']||_0x30579f[_0x56ba('0x14')]});utils[_0x56ba('0x5')](util[_0x56ba('0x13')](_0x56ba('0x33'),_0x30579f[_0x56ba('0x14')],members[_0x417fa3][_0x56ba('0x32')],members[_0x417fa3][_0x56ba('0x8')],members[_0x417fa3][_0x56ba('0x2f')]));if(members[_0x417fa3]['exitAt']){writeDB(members[_0x417fa3]);}}}}catch(_0x473abd){utils[_0x56ba('0x12')](util[_0x56ba('0x13')](_0x56ba('0x2d'),_0x30579f[_0x56ba('0x14')]),_0x473abd);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 45cc832..723d1c0 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 _0x8969=['CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][queuecallerjoin]','hangup','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','variable','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','isNil','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','[%s][queues][agentconnect]','destaccountcode','assigned','accountcode','membername','[%s][queues][agentcomplete]','transfer','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfereruniqueid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request'];(function(_0x33a289,_0x180f5e){var _0x3b5366=function(_0xca63d8){while(--_0xca63d8){_0x33a289['push'](_0x33a289['shift']());}};_0x3b5366(++_0x180f5e);}(_0x8969,0x130));var _0x9896=function(_0x43dd40,_0x431145){_0x43dd40=_0x43dd40-0x0;var _0x200de4=_0x8969[_0x43dd40];return _0x200de4;};'use strict';var _=require(_0x9896('0x0'));var util=require('util');var utils=require(_0x9896('0x1'));var queues={};function writeDB(_0x434b93){utils[_0x9896('0x2')](util[_0x9896('0x3')](_0x9896('0x4'),_0x434b93[_0x9896('0x5')],_0x434b93[_0x9896('0x6')],_0x434b93['queue'],_0x434b93[_0x9896('0x7')],_0x434b93['calleridnum'],_0x434b93['accountcode'],_0x434b93[_0x9896('0x8')]));if(_0x434b93[_0x9896('0x9')]){utils[_0x9896('0xa')](_0x434b93['queue'])[_0x9896('0xb')](function(_0x281745){if(_0x281745){_0x434b93[_0x9896('0xc')]=_0x281745['type'];}utils[_0x9896('0xd')](_0x9896('0xe'),_0x434b93);});}else{utils['request'](_0x9896('0xe'),_0x434b93);}if(_0x434b93[_0x9896('0xf')]){delete queues[_0x434b93['transfereduniqueid']];}else{delete queues[_0x434b93[_0x9896('0x5')]];}}exports[_0x9896('0x10')]=function(_0x2b5c25){try{utils[_0x9896('0x11')](util['format']('[%s][queues][queuecallerjoin]',_0x2b5c25['uniqueid']),_0x2b5c25);utils[_0x9896('0x2')](util[_0x9896('0x3')](_0x9896('0x12'),_0x2b5c25[_0x9896('0x5')],_0x2b5c25[_0x9896('0x9')],_0x2b5c25[_0x9896('0x13')]));queues[_0x2b5c25[_0x9896('0x5')]]=_[_0x9896('0x14')](_0x2b5c25,{'originalposition':_0x2b5c25[_0x9896('0x13')],'queuecallerjoinAt':utils[_0x9896('0x15')](),'mohtime':0x0});}catch(_0x51dce3){utils[_0x9896('0x16')](util['format'](_0x9896('0x17'),_0x2b5c25[_0x9896('0x5')]),_0x51dce3);}};exports[_0x9896('0x18')]=function(_0x42ccee){try{if(!_['isNil'](queues[_0x42ccee[_0x9896('0x5')]])){utils[_0x9896('0x11')](util[_0x9896('0x3')](_0x9896('0x19'),_0x42ccee['uniqueid']),_0x42ccee);if(queues[_0x42ccee[_0x9896('0x5')]]['queuecallerleaveAt']){if(!queues[_0x42ccee[_0x9896('0x5')]][_0x9896('0x1a')]&&!queues[_0x42ccee['uniqueid']][_0x9896('0x1b')]){queues[_0x42ccee[_0x9896('0x5')]][_0x9896('0x1c')]=!![];queues[_0x42ccee[_0x9896('0x5')]][_0x9896('0x1d')]=utils[_0x9896('0x15')]();queues[_0x42ccee['uniqueid']][_0x9896('0x8')]=_0x9896('0x1e');}utils[_0x9896('0x2')](util[_0x9896('0x3')](_0x9896('0x1f'),_0x42ccee['uniqueid'],queues[_0x42ccee[_0x9896('0x5')]][_0x9896('0x20')],queues[_0x42ccee[_0x9896('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x42ccee['uniqueid']]);}else if(queues[_0x42ccee[_0x9896('0x5')]][_0x9896('0xf')]){utils[_0x9896('0x2')](util[_0x9896('0x3')](_0x9896('0x21'),_0x42ccee[_0x9896('0x5')],queues[_0x42ccee['uniqueid']]['name'],queues[_0x42ccee[_0x9896('0x5')]]['transfereduniqueid']));queues[queues[_0x42ccee[_0x9896('0x5')]][_0x9896('0xf')]]=queues[_0x42ccee[_0x9896('0x5')]];queues[queues[_0x42ccee[_0x9896('0x5')]][_0x9896('0xf')]][_0x9896('0x22')]=0x2;delete queues[_0x42ccee[_0x9896('0x5')]];}}}catch(_0x8a2f76){utils[_0x9896('0x16')](util[_0x9896('0x3')](_0x9896('0x19'),_0x42ccee[_0x9896('0x5')]),_0x8a2f76);}};exports[_0x9896('0x23')]=function(_0x3d3364){try{utils[_0x9896('0x11')](util[_0x9896('0x3')]('[%s][queues][varset]',_0x3d3364[_0x9896('0x5')]),_0x3d3364);if(!_['isNil'](_0x3d3364[_0x9896('0x24')]['queuestatus'])&&_0x3d3364['value'][_0x9896('0x25')]()!==_0x9896('0x26')){if(!_['isNil'](queues[_0x3d3364[_0x9896('0x5')]])){queues[_0x3d3364[_0x9896('0x5')]][_0x9896('0x1a')]=![];queues[_0x3d3364['uniqueid']][_0x9896('0x27')]=null;queues[_0x3d3364[_0x9896('0x5')]]['queuecallerexit']=!![];queues[_0x3d3364[_0x9896('0x5')]][_0x9896('0x28')]=utils[_0x9896('0x15')]();queues[_0x3d3364[_0x9896('0x5')]][_0x9896('0x8')]=_0x3d3364[_0x9896('0x29')][_0x9896('0x25')]();utils[_0x9896('0x2')](util[_0x9896('0x3')](_0x9896('0x2a'),_0x3d3364[_0x9896('0x5')],queues[_0x3d3364[_0x9896('0x5')]]['name'],_0x3d3364[_0x9896('0x29')],queues[_0x3d3364[_0x9896('0x5')]][_0x9896('0x8')]));writeDB(queues[_0x3d3364[_0x9896('0x5')]]);}}else if(!_[_0x9896('0x2b')](_0x3d3364['variable'][_0x9896('0x2c')])){if(!_[_0x9896('0x2b')](queues[_0x3d3364[_0x9896('0x5')]])&&!queues[_0x3d3364[_0x9896('0x5')]][_0x9896('0x1a')]){queues[_0x3d3364[_0x9896('0x5')]][_0x9896('0x1a')]=![];queues[_0x3d3364[_0x9896('0x5')]][_0x9896('0x27')]=null;queues[_0x3d3364[_0x9896('0x5')]][_0x9896('0x1b')]=!![];queues[_0x3d3364[_0x9896('0x5')]][_0x9896('0x28')]=utils['now']();queues[_0x3d3364[_0x9896('0x5')]]['queuecallerexitreason']='EXITWITHKEY';utils['info'](util[_0x9896('0x3')](_0x9896('0x2d'),_0x3d3364[_0x9896('0x5')],queues[_0x3d3364[_0x9896('0x5')]][_0x9896('0x20')],_0x3d3364[_0x9896('0x29')],queues[_0x3d3364[_0x9896('0x5')]][_0x9896('0x8')]));}}}catch(_0x271c13){utils['error'](util[_0x9896('0x3')](_0x9896('0x2e'),_0x3d3364[_0x9896('0x5')]),_0x271c13);}};exports[_0x9896('0x1a')]=function(_0x3df2a9){try{if(!_[_0x9896('0x2b')](queues[_0x3df2a9[_0x9896('0x5')]])){utils[_0x9896('0x11')](util[_0x9896('0x3')](_0x9896('0x2f'),_0x3df2a9[_0x9896('0x5')]),_0x3df2a9);queues[_0x3df2a9['uniqueid']]['queuecallerexit']=![];queues[_0x3df2a9[_0x9896('0x5')]][_0x9896('0x28')]=null;queues[_0x3df2a9[_0x9896('0x5')]]['queuecallerabandon']=!![];queues[_0x3df2a9[_0x9896('0x5')]][_0x9896('0x27')]=utils['now']();queues[_0x3df2a9[_0x9896('0x5')]][_0x9896('0x8')]='ABANDONED';utils[_0x9896('0x2')](util[_0x9896('0x3')](_0x9896('0x30'),_0x3df2a9['uniqueid'],queues[_0x3df2a9[_0x9896('0x5')]][_0x9896('0x20')],queues[_0x3df2a9[_0x9896('0x5')]]['queuecallerexitreason']));}}catch(_0xbe90ec){utils[_0x9896('0x16')](util['format']('[%s][queues][queuecallerabandon]',_0x3df2a9[_0x9896('0x5')]),_0xbe90ec);}};exports[_0x9896('0x31')]=function(_0x1bcc97){try{if(!_[_0x9896('0x2b')](queues[_0x1bcc97[_0x9896('0x5')]])){utils[_0x9896('0x11')](util[_0x9896('0x3')](_0x9896('0x32'),_0x1bcc97[_0x9896('0x5')]),_0x1bcc97);utils[_0x9896('0x2')](util[_0x9896('0x3')](_0x9896('0x33'),_0x1bcc97['uniqueid'],queues[_0x1bcc97['uniqueid']][_0x9896('0x20')],_0x1bcc97[_0x9896('0x34')],_0x1bcc97[_0x9896('0x35')]));queues[_0x1bcc97[_0x9896('0x5')]][_0x9896('0x31')]=!![];queues[_0x1bcc97[_0x9896('0x5')]][_0x9896('0x36')]=utils[_0x9896('0x15')]();queues[_0x1bcc97[_0x9896('0x5')]][_0x9896('0x37')]=utils[_0x9896('0x38')](queues[_0x1bcc97[_0x9896('0x5')]][_0x9896('0x36')],queues[_0x1bcc97['uniqueid']][_0x9896('0x39')]);queues[_0x1bcc97[_0x9896('0x5')]][_0x9896('0x13')]=_0x1bcc97[_0x9896('0x13')];queues[_0x1bcc97[_0x9896('0x5')]]['count']=_0x1bcc97['count'];queues[_0x1bcc97['uniqueid']][_0x9896('0x34')]=_0x1bcc97[_0x9896('0x34')];queues[_0x1bcc97[_0x9896('0x5')]]['connectedlinename']=_0x1bcc97[_0x9896('0x35')];}}catch(_0x3d0bea){utils[_0x9896('0x16')](util[_0x9896('0x3')](_0x9896('0x32'),_0x1bcc97[_0x9896('0x5')]),_0x3d0bea);}};exports['agentconnect']=function(_0x50dd55){try{if(!_[_0x9896('0x2b')](queues[_0x50dd55['uniqueid']])){utils[_0x9896('0x11')](util[_0x9896('0x3')](_0x9896('0x3a'),_0x50dd55['uniqueid']),_0x50dd55);utils[_0x9896('0x2')](util[_0x9896('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x50dd55[_0x9896('0x5')],queues[_0x50dd55[_0x9896('0x5')]][_0x9896('0x20')],_0x50dd55['membername'],_0x50dd55[_0x9896('0x3b')]));queues[_0x50dd55['uniqueid']][_0x9896('0x1a')]=![];queues[_0x50dd55[_0x9896('0x5')]][_0x9896('0x1a')]=![];queues[_0x50dd55['uniqueid']][_0x9896('0x27')]=null;queues[_0x50dd55[_0x9896('0x5')]][_0x9896('0x1b')]=![];queues[_0x50dd55['uniqueid']][_0x9896('0x8')]=null;queues[_0x50dd55[_0x9896('0x5')]][_0x9896('0x28')]=null;queues[_0x50dd55['uniqueid']][_0x9896('0x3c')]=!![];queues[_0x50dd55[_0x9896('0x5')]][_0x9896('0x3d')]=_0x50dd55[_0x9896('0x3b')];queues[_0x50dd55['uniqueid']][_0x9896('0x7')]=_0x50dd55[_0x9896('0x3e')];}}catch(_0x50bf88){utils[_0x9896('0x16')](util['format'](_0x9896('0x3a'),_0x50dd55[_0x9896('0x5')]),_0x50bf88);}};exports['agentcomplete']=function(_0x408927){try{if(!_[_0x9896('0x2b')](queues[_0x408927['uniqueid']])){if(queues[_0x408927[_0x9896('0x5')]][_0x9896('0x36')]){utils['debug'](util[_0x9896('0x3')](_0x9896('0x3f'),_0x408927[_0x9896('0x5')]),_0x408927);queues[_0x408927['uniqueid']]['queuecallerabandon']=![];queues[_0x408927[_0x9896('0x5')]][_0x9896('0x1a')]=![];queues[_0x408927[_0x9896('0x5')]]['queuecallerabandonAt']=null;queues[_0x408927[_0x9896('0x5')]][_0x9896('0x1b')]=![];queues[_0x408927[_0x9896('0x5')]][_0x9896('0x28')]=null;queues[_0x408927[_0x9896('0x5')]][_0x9896('0x3c')]=!![];queues[_0x408927[_0x9896('0x5')]][_0x9896('0x7')]=_0x408927[_0x9896('0x3e')];queues[_0x408927[_0x9896('0x5')]][_0x9896('0x1c')]=!![];queues[_0x408927['uniqueid']][_0x9896('0x1d')]=utils[_0x9896('0x15')]();if(_0x408927['reason']==_0x9896('0x40')){if(!queues[_0x408927[_0x9896('0x5')]][_0x9896('0x40')]){queues[_0x408927['uniqueid']][_0x9896('0x8')]='TRANSFER';}}else{queues[_0x408927[_0x9896('0x5')]]['queuecallerexitreason']=_0x9896('0x41')+_0x408927[_0x9896('0x42')][_0x9896('0x25')]();}utils[_0x9896('0x2')](util[_0x9896('0x3')](_0x9896('0x43'),_0x408927['uniqueid'],queues[_0x408927[_0x9896('0x5')]][_0x9896('0x20')],_0x408927[_0x9896('0x3e')],queues[_0x408927[_0x9896('0x5')]][_0x9896('0x8')]));writeDB(queues[_0x408927[_0x9896('0x5')]]);}}}catch(_0x522f32){utils['error'](util[_0x9896('0x3')](_0x9896('0x3f'),_0x408927[_0x9896('0x5')]),_0x522f32);}};exports[_0x9896('0x44')]=function(_0x45e814){try{if(!_[_0x9896('0x2b')](queues[_0x45e814[_0x9896('0x45')]])){utils[_0x9896('0x11')](util[_0x9896('0x3')](_0x9896('0x46'),_0x45e814[_0x9896('0x5')]),_0x45e814);queues[_0x45e814[_0x9896('0x45')]][_0x9896('0x40')]=!![];queues[_0x45e814[_0x9896('0x45')]][_0x9896('0x47')]=_0x9896('0x48');queues[_0x45e814[_0x9896('0x45')]][_0x9896('0x49')]=_0x45e814[_0x9896('0x4a')];queues[_0x45e814['transfereeuniqueid']][_0x9896('0x4b')]=_0x45e814[_0x9896('0x45')];queues[_0x45e814['transfereeuniqueid']][_0x9896('0x8')]=_0x9896('0x4c');utils[_0x9896('0x2')](util['format'](_0x9896('0x4d'),_0x45e814[_0x9896('0x5')],queues[_0x45e814['transfereeuniqueid']]['name'],_0x45e814[_0x9896('0x45')],_0x45e814[_0x9896('0x4a')]));}}catch(_0x24f891){utils['error'](util['format'](_0x9896('0x46'),_0x45e814[_0x9896('0x5')]),_0x24f891);}};exports[_0x9896('0x4e')]=function(_0x58d8a8){try{utils[_0x9896('0x11')](util[_0x9896('0x3')]('[%s][queues][attendedtransfer]',_0x58d8a8['origtransfereruniqueid']),_0x58d8a8);if(_0x58d8a8['origtransfereruniqueid']==_0x58d8a8[_0x9896('0x4f')]){if(!_[_0x9896('0x2b')](queues[_0x58d8a8[_0x9896('0x50')]])){utils[_0x9896('0x2')](util[_0x9896('0x3')](_0x9896('0x51'),_0x58d8a8[_0x9896('0x52')],queues[_0x58d8a8[_0x9896('0x50')]][_0x9896('0x20')],_0x58d8a8[_0x9896('0x53')]));queues[_0x58d8a8['secondtransfererlinkedid']][_0x9896('0x40')]=!![];queues[_0x58d8a8[_0x9896('0x50')]][_0x9896('0x47')]=_0x9896('0x54');queues[_0x58d8a8[_0x9896('0x50')]][_0x9896('0x49')]=_0x58d8a8['origtransfererexten'];queues[_0x58d8a8[_0x9896('0x50')]][_0x9896('0x4b')]=_0x58d8a8['origtransfereruniqueid'];queues[_0x58d8a8['secondtransfererlinkedid']]['queuecallerexitreason']=_0x9896('0x55');}if(!_[_0x9896('0x2b')](queues[_0x58d8a8['origtransfererlinkedid']])){if(_0x58d8a8[_0x9896('0x56')]&&queues[_0x58d8a8[_0x9896('0x56')]]){queues[_0x58d8a8[_0x9896('0x56')]][_0x9896('0x22')]=0x1;queues[_0x58d8a8[_0x9896('0x45')]]=_[_0x9896('0x57')](queues[_0x58d8a8[_0x9896('0x56')]]);queues[_0x58d8a8[_0x9896('0x45')]][_0x9896('0xf')]=_0x58d8a8['transfertargetuniqueid'];queues[_0x58d8a8['transfereeuniqueid']][_0x9896('0x22')]=0x2;queues[_0x58d8a8['transfereeuniqueid']]['calleridnum']=queues[_0x58d8a8[_0x9896('0x50')]][_0x9896('0x58')];queues[_0x58d8a8[_0x9896('0x45')]][_0x9896('0x59')]=queues[_0x58d8a8[_0x9896('0x50')]]['calleridname'];queues[_0x58d8a8['transfereeuniqueid']][_0x9896('0x39')]=utils[_0x9896('0x15')]();queues[_0x58d8a8[_0x9896('0x45')]][_0x9896('0x36')]=utils[_0x9896('0x15')]();queues[_0x58d8a8[_0x9896('0x45')]][_0x9896('0x37')]=0x0;queues[_0x58d8a8[_0x9896('0x45')]][_0x9896('0x5a')]=0x0;utils[_0x9896('0x2')](util[_0x9896('0x3')](_0x9896('0x5b'),_0x58d8a8[_0x9896('0x52')],queues[_0x58d8a8[_0x9896('0x45')]][_0x9896('0x20')],queues[_0x58d8a8['transfereeuniqueid']][_0x9896('0x58')],queues[_0x58d8a8['transfereeuniqueid']]['calleridname']));}else{utils[_0x9896('0x2')](util[_0x9896('0x3')](_0x9896('0x5c'),_0x58d8a8['origtransfereruniqueid'],queues[_0x58d8a8[_0x9896('0x4f')]]['name'],_0x58d8a8[_0x9896('0x50')]));queues[_0x58d8a8[_0x9896('0x4f')]][_0x9896('0xf')]=_0x58d8a8['secondtransfererlinkedid'];}}}else if(_0x58d8a8[_0x9896('0x5d')]==_0x58d8a8['secondtransfererlinkedid']){if(!_[_0x9896('0x2b')](queues[_0x58d8a8[_0x9896('0x4f')]])){utils[_0x9896('0x2')](util[_0x9896('0x3')](_0x9896('0x5e'),_0x58d8a8[_0x9896('0x52')],queues[_0x58d8a8['origtransfererlinkedid']]['name'],_0x58d8a8[_0x9896('0x5d')],_0x58d8a8[_0x9896('0x5f')]));queues[_0x58d8a8[_0x9896('0x4f')]]['transfer']=!![];queues[_0x58d8a8['origtransfererlinkedid']][_0x9896('0x47')]=_0x9896('0x54');queues[_0x58d8a8[_0x9896('0x4f')]][_0x9896('0x49')]=_0x58d8a8[_0x9896('0x5f')];queues[_0x58d8a8[_0x9896('0x4f')]]['transferuniqueid']=_0x58d8a8['secondtransfereruniqueid'];queues[_0x58d8a8[_0x9896('0x4f')]][_0x9896('0x8')]=_0x9896('0x55');}if(!_[_0x9896('0x2b')](queues[_0x58d8a8[_0x9896('0x50')]])){if(_0x58d8a8[_0x9896('0x60')]&&queues[_0x58d8a8[_0x9896('0x60')]]){queues[_0x58d8a8['transfertargetlinkedid']][_0x9896('0x22')]=0x1;queues[_0x58d8a8[_0x9896('0x61')]]=_[_0x9896('0x57')](queues[_0x58d8a8[_0x9896('0x60')]]);queues[_0x58d8a8[_0x9896('0x61')]]['transfereduniqueid']=_0x58d8a8['transfertargetuniqueid'];queues[_0x58d8a8[_0x9896('0x61')]][_0x9896('0x22')]=0x2;queues[_0x58d8a8[_0x9896('0x61')]]['calleridnum']=queues[_0x58d8a8['origtransfererlinkedid']][_0x9896('0x58')];queues[_0x58d8a8[_0x9896('0x61')]][_0x9896('0x59')]=queues[_0x58d8a8['origtransfererlinkedid']][_0x9896('0x59')];queues[_0x58d8a8['transfertargetuniqueid']][_0x9896('0x39')]=utils['now']();queues[_0x58d8a8['transfertargetuniqueid']][_0x9896('0x36')]=utils['now']();queues[_0x58d8a8[_0x9896('0x61')]][_0x9896('0x37')]=0x0;queues[_0x58d8a8[_0x9896('0x61')]]['mohtime']=0x0;utils[_0x9896('0x2')](util[_0x9896('0x3')](_0x9896('0x62'),_0x58d8a8['origtransfereruniqueid'],queues[_0x58d8a8[_0x9896('0x61')]][_0x9896('0x20')],queues[_0x58d8a8[_0x9896('0x61')]][_0x9896('0xf')],queues[_0x58d8a8[_0x9896('0x61')]]['calleridnum'],queues[_0x58d8a8['transfertargetuniqueid']][_0x9896('0x59')]));}else{utils[_0x9896('0x2')](util[_0x9896('0x3')](_0x9896('0x5c'),_0x58d8a8[_0x9896('0x52')],queues[_0x58d8a8[_0x9896('0x50')]]['name'],_0x58d8a8[_0x9896('0x4f')]));queues[_0x58d8a8[_0x9896('0x50')]]['transfereduniqueid']=_0x58d8a8[_0x9896('0x4f')];}}}}catch(_0x48551d){utils['error'](util[_0x9896('0x3')](_0x9896('0x63'),_0x58d8a8[_0x9896('0x52')]),_0x48551d);}};exports[_0x9896('0x64')]=function(_0x49867d){try{if(!_[_0x9896('0x2b')](queues[_0x49867d[_0x9896('0x5')]])){utils['debug'](util[_0x9896('0x3')](_0x9896('0x65'),_0x49867d[_0x9896('0x5')]),_0x49867d);queues[_0x49867d['uniqueid']][_0x9896('0x66')]=utils[_0x9896('0x15')]();utils[_0x9896('0x2')](util[_0x9896('0x3')](_0x9896('0x67'),_0x49867d['uniqueid'],queues[_0x49867d['uniqueid']][_0x9896('0x20')],queues[_0x49867d['uniqueid']]['musiconholdstartAt']));}}catch(_0x47ec60){utils['error'](util[_0x9896('0x3')]('[%s][queues][musiconholdstart]',_0x49867d[_0x9896('0x5')]),_0x47ec60);}};exports[_0x9896('0x68')]=function(_0x16e9f4){try{if(!_[_0x9896('0x2b')](queues[_0x16e9f4['uniqueid']])){if(!_[_0x9896('0x2b')](queues[_0x16e9f4[_0x9896('0x5')]][_0x9896('0x66')])){utils['debug'](util['format'](_0x9896('0x69'),_0x16e9f4[_0x9896('0x5')]),_0x16e9f4);queues[_0x16e9f4[_0x9896('0x5')]][_0x9896('0x5a')]+=utils[_0x9896('0x38')](utils['now'](),queues[_0x16e9f4[_0x9896('0x5')]][_0x9896('0x66')]);utils['info'](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x16e9f4[_0x9896('0x5')],queues[_0x16e9f4['uniqueid']]['name'],queues[_0x16e9f4['uniqueid']][_0x9896('0x5a')]));delete queues[_0x16e9f4[_0x9896('0x5')]][_0x9896('0x66')];}}}catch(_0x146d78){utils[_0x9896('0x16')](util[_0x9896('0x3')](_0x9896('0x69'),_0x16e9f4[_0x9896('0x5')]),_0x146d78);}}; \ No newline at end of file +var _0x8325=['[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','isNil','[%s][queues][hangup]','queuecallerleaveAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','queuecallerenterreason','error','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexit','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','variable','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','holdtime','queuecallerjoinAt','count','connectedlinename','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','secondtransfereruniqueid','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','format','[%s][queues][queuecallerjoin]'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8325,0x1f1));var _0x5832=function(_0x5c5d43,_0xc79d25){_0x5c5d43=_0x5c5d43-0x0;var _0x11b27d=_0x8325[_0x5c5d43];return _0x11b27d;};'use strict';var _=require(_0x5832('0x0'));var util=require('util');var utils=require(_0x5832('0x1'));var queues={};function writeDB(_0x51c901){utils[_0x5832('0x2')](util['format'](_0x5832('0x3'),_0x51c901[_0x5832('0x4')],_0x51c901[_0x5832('0x5')],_0x51c901[_0x5832('0x6')],_0x51c901['lastAssignedTo'],_0x51c901['calleridnum'],_0x51c901[_0x5832('0x7')],_0x51c901[_0x5832('0x8')]));if(_0x51c901[_0x5832('0x6')]){utils[_0x5832('0x9')](_0x51c901[_0x5832('0x6')])[_0x5832('0xa')](function(_0x495531){if(_0x495531){_0x51c901[_0x5832('0xb')]=_0x495531[_0x5832('0xb')];}utils[_0x5832('0xc')](_0x5832('0xd'),_0x51c901);});}else{utils[_0x5832('0xc')](_0x5832('0xd'),_0x51c901);}if(_0x51c901[_0x5832('0xe')]){delete queues[_0x51c901[_0x5832('0xe')]];}else{delete queues[_0x51c901[_0x5832('0x4')]];}}exports['queuecallerjoin']=function(_0x5b8ed3){try{utils[_0x5832('0xf')](util[_0x5832('0x10')](_0x5832('0x11'),_0x5b8ed3[_0x5832('0x4')]),_0x5b8ed3);utils['info'](util['format'](_0x5832('0x12'),_0x5b8ed3[_0x5832('0x4')],_0x5b8ed3[_0x5832('0x6')],_0x5b8ed3[_0x5832('0x13')]));queues[_0x5b8ed3['uniqueid']]=_[_0x5832('0x14')](_0x5b8ed3,{'originalposition':_0x5b8ed3[_0x5832('0x13')],'queuecallerjoinAt':utils[_0x5832('0x15')](),'mohtime':0x0});}catch(_0x15ef7f){utils['error'](util[_0x5832('0x10')](_0x5832('0x11'),_0x5b8ed3[_0x5832('0x4')]),_0x15ef7f);}};exports['hangup']=function(_0x32d360){try{if(!_[_0x5832('0x16')](queues[_0x32d360[_0x5832('0x4')]])){utils[_0x5832('0xf')](util[_0x5832('0x10')](_0x5832('0x17'),_0x32d360[_0x5832('0x4')]),_0x32d360);if(queues[_0x32d360[_0x5832('0x4')]][_0x5832('0x18')]){if(!queues[_0x32d360[_0x5832('0x4')]]['queuecallerabandon']&&!queues[_0x32d360[_0x5832('0x4')]]['queuecallerexit']){queues[_0x32d360['uniqueid']]['queuecallercomplete']=!![];queues[_0x32d360[_0x5832('0x4')]]['queuecallercompleteAt']=utils['now']();queues[_0x32d360['uniqueid']]['queuecallerexitreason']=_0x5832('0x19');}utils['info'](util['format'](_0x5832('0x1a'),_0x32d360['uniqueid'],queues[_0x32d360[_0x5832('0x4')]]['name'],queues[_0x32d360['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x32d360[_0x5832('0x4')]]);}else if(queues[_0x32d360[_0x5832('0x4')]][_0x5832('0xe')]){utils[_0x5832('0x2')](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x32d360[_0x5832('0x4')],queues[_0x32d360[_0x5832('0x4')]]['name'],queues[_0x32d360[_0x5832('0x4')]][_0x5832('0xe')]));queues[queues[_0x32d360['uniqueid']][_0x5832('0xe')]]=queues[_0x32d360[_0x5832('0x4')]];queues[queues[_0x32d360[_0x5832('0x4')]][_0x5832('0xe')]][_0x5832('0x1b')]=0x2;delete queues[_0x32d360[_0x5832('0x4')]];}}}catch(_0x301444){utils[_0x5832('0x1c')](util[_0x5832('0x10')](_0x5832('0x17'),_0x32d360[_0x5832('0x4')]),_0x301444);}};exports['varset']=function(_0x1bfef0){try{utils[_0x5832('0xf')](util[_0x5832('0x10')]('[%s][queues][varset]',_0x1bfef0[_0x5832('0x4')]),_0x1bfef0);if(!_['isNil'](_0x1bfef0['variable'][_0x5832('0x1d')])&&_0x1bfef0[_0x5832('0x1e')][_0x5832('0x1f')]()!==_0x5832('0x20')){if(!_['isNil'](queues[_0x1bfef0[_0x5832('0x4')]])){queues[_0x1bfef0['uniqueid']][_0x5832('0x21')]=![];queues[_0x1bfef0[_0x5832('0x4')]][_0x5832('0x22')]=null;queues[_0x1bfef0[_0x5832('0x4')]][_0x5832('0x23')]=!![];queues[_0x1bfef0[_0x5832('0x4')]]['queuecallerexitAt']=utils[_0x5832('0x15')]();queues[_0x1bfef0['uniqueid']]['queuecallerexitreason']=_0x1bfef0[_0x5832('0x1e')][_0x5832('0x1f')]();utils[_0x5832('0x2')](util[_0x5832('0x10')](_0x5832('0x24'),_0x1bfef0[_0x5832('0x4')],queues[_0x1bfef0[_0x5832('0x4')]][_0x5832('0x25')],_0x1bfef0['value'],queues[_0x1bfef0[_0x5832('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x1bfef0[_0x5832('0x4')]]);}}else if(!_[_0x5832('0x16')](_0x1bfef0[_0x5832('0x26')][_0x5832('0x27')])){if(!_['isNil'](queues[_0x1bfef0[_0x5832('0x4')]])&&!queues[_0x1bfef0[_0x5832('0x4')]][_0x5832('0x21')]){queues[_0x1bfef0[_0x5832('0x4')]][_0x5832('0x21')]=![];queues[_0x1bfef0[_0x5832('0x4')]][_0x5832('0x22')]=null;queues[_0x1bfef0[_0x5832('0x4')]]['queuecallerexit']=!![];queues[_0x1bfef0['uniqueid']][_0x5832('0x28')]=utils['now']();queues[_0x1bfef0[_0x5832('0x4')]][_0x5832('0x8')]=_0x5832('0x29');utils[_0x5832('0x2')](util[_0x5832('0x10')](_0x5832('0x2a'),_0x1bfef0['uniqueid'],queues[_0x1bfef0[_0x5832('0x4')]]['name'],_0x1bfef0['value'],queues[_0x1bfef0['uniqueid']][_0x5832('0x8')]));}}}catch(_0x188632){utils['error'](util[_0x5832('0x10')](_0x5832('0x2b'),_0x1bfef0[_0x5832('0x4')]),_0x188632);}};exports['queuecallerabandon']=function(_0x182841){try{if(!_['isNil'](queues[_0x182841[_0x5832('0x4')]])){utils[_0x5832('0xf')](util[_0x5832('0x10')](_0x5832('0x2c'),_0x182841['uniqueid']),_0x182841);queues[_0x182841[_0x5832('0x4')]]['queuecallerexit']=![];queues[_0x182841[_0x5832('0x4')]][_0x5832('0x28')]=null;queues[_0x182841['uniqueid']][_0x5832('0x21')]=!![];queues[_0x182841['uniqueid']][_0x5832('0x22')]=utils['now']();queues[_0x182841[_0x5832('0x4')]][_0x5832('0x8')]=_0x5832('0x2d');utils['info'](util[_0x5832('0x10')](_0x5832('0x2e'),_0x182841[_0x5832('0x4')],queues[_0x182841[_0x5832('0x4')]][_0x5832('0x25')],queues[_0x182841['uniqueid']][_0x5832('0x8')]));}}catch(_0x1e5900){utils[_0x5832('0x1c')](util['format'](_0x5832('0x2c'),_0x182841[_0x5832('0x4')]),_0x1e5900);}};exports[_0x5832('0x2f')]=function(_0x5c6df6){try{if(!_['isNil'](queues[_0x5c6df6[_0x5832('0x4')]])){utils[_0x5832('0xf')](util[_0x5832('0x10')](_0x5832('0x30'),_0x5c6df6[_0x5832('0x4')]),_0x5c6df6);utils['info'](util['format'](_0x5832('0x31'),_0x5c6df6['uniqueid'],queues[_0x5c6df6['uniqueid']][_0x5832('0x25')],_0x5c6df6['connectedlinenum'],_0x5c6df6['connectedlinename']));queues[_0x5c6df6[_0x5832('0x4')]]['queuecallerleave']=!![];queues[_0x5c6df6[_0x5832('0x4')]][_0x5832('0x18')]=utils[_0x5832('0x15')]();queues[_0x5c6df6[_0x5832('0x4')]][_0x5832('0x32')]=utils['diffTime'](queues[_0x5c6df6[_0x5832('0x4')]]['queuecallerleaveAt'],queues[_0x5c6df6[_0x5832('0x4')]][_0x5832('0x33')]);queues[_0x5c6df6['uniqueid']][_0x5832('0x13')]=_0x5c6df6[_0x5832('0x13')];queues[_0x5c6df6[_0x5832('0x4')]][_0x5832('0x34')]=_0x5c6df6[_0x5832('0x34')];queues[_0x5c6df6[_0x5832('0x4')]]['connectedlinenum']=_0x5c6df6['connectedlinenum'];queues[_0x5c6df6[_0x5832('0x4')]][_0x5832('0x35')]=_0x5c6df6[_0x5832('0x35')];}}catch(_0x43300b){utils[_0x5832('0x1c')](util[_0x5832('0x10')]('[%s][queues][queuecallerleave]',_0x5c6df6['uniqueid']),_0x43300b);}};exports['agentconnect']=function(_0x595b09){try{if(!_[_0x5832('0x16')](queues[_0x595b09[_0x5832('0x4')]])){utils[_0x5832('0xf')](util[_0x5832('0x10')](_0x5832('0x36'),_0x595b09['uniqueid']),_0x595b09);utils['info'](util[_0x5832('0x10')](_0x5832('0x37'),_0x595b09['uniqueid'],queues[_0x595b09[_0x5832('0x4')]][_0x5832('0x25')],_0x595b09[_0x5832('0x38')],_0x595b09[_0x5832('0x39')]));queues[_0x595b09[_0x5832('0x4')]][_0x5832('0x21')]=![];queues[_0x595b09[_0x5832('0x4')]][_0x5832('0x21')]=![];queues[_0x595b09[_0x5832('0x4')]][_0x5832('0x22')]=null;queues[_0x595b09[_0x5832('0x4')]][_0x5832('0x23')]=![];queues[_0x595b09['uniqueid']]['queuecallerexitreason']=null;queues[_0x595b09[_0x5832('0x4')]][_0x5832('0x28')]=null;queues[_0x595b09[_0x5832('0x4')]][_0x5832('0x3a')]=!![];queues[_0x595b09['uniqueid']][_0x5832('0x7')]=_0x595b09[_0x5832('0x39')];queues[_0x595b09[_0x5832('0x4')]][_0x5832('0x3b')]=_0x595b09[_0x5832('0x38')];}}catch(_0x3a85c9){utils['error'](util[_0x5832('0x10')](_0x5832('0x36'),_0x595b09['uniqueid']),_0x3a85c9);}};exports[_0x5832('0x3c')]=function(_0x3a1d49){try{if(!_['isNil'](queues[_0x3a1d49[_0x5832('0x4')]])){if(queues[_0x3a1d49[_0x5832('0x4')]][_0x5832('0x18')]){utils[_0x5832('0xf')](util[_0x5832('0x10')](_0x5832('0x3d'),_0x3a1d49[_0x5832('0x4')]),_0x3a1d49);queues[_0x3a1d49[_0x5832('0x4')]][_0x5832('0x21')]=![];queues[_0x3a1d49[_0x5832('0x4')]][_0x5832('0x21')]=![];queues[_0x3a1d49['uniqueid']][_0x5832('0x22')]=null;queues[_0x3a1d49[_0x5832('0x4')]][_0x5832('0x23')]=![];queues[_0x3a1d49[_0x5832('0x4')]][_0x5832('0x28')]=null;queues[_0x3a1d49[_0x5832('0x4')]][_0x5832('0x3a')]=!![];queues[_0x3a1d49[_0x5832('0x4')]]['lastAssignedTo']=_0x3a1d49[_0x5832('0x38')];queues[_0x3a1d49['uniqueid']][_0x5832('0x3e')]=!![];queues[_0x3a1d49['uniqueid']]['queuecallercompleteAt']=utils['now']();if(_0x3a1d49[_0x5832('0x3f')]==_0x5832('0x40')){if(!queues[_0x3a1d49[_0x5832('0x4')]][_0x5832('0x40')]){queues[_0x3a1d49[_0x5832('0x4')]]['queuecallerexitreason']=_0x5832('0x41');}}else{queues[_0x3a1d49['uniqueid']]['queuecallerexitreason']='COMPLETEDBY'+_0x3a1d49[_0x5832('0x3f')][_0x5832('0x1f')]();}utils[_0x5832('0x2')](util[_0x5832('0x10')](_0x5832('0x42'),_0x3a1d49[_0x5832('0x4')],queues[_0x3a1d49[_0x5832('0x4')]]['name'],_0x3a1d49[_0x5832('0x38')],queues[_0x3a1d49[_0x5832('0x4')]][_0x5832('0x8')]));writeDB(queues[_0x3a1d49[_0x5832('0x4')]]);}}}catch(_0x4dff6b){utils[_0x5832('0x1c')](util[_0x5832('0x10')](_0x5832('0x3d'),_0x3a1d49[_0x5832('0x4')]),_0x4dff6b);}};exports[_0x5832('0x43')]=function(_0x39f9b3){try{if(!_[_0x5832('0x16')](queues[_0x39f9b3[_0x5832('0x44')]])){utils[_0x5832('0xf')](util[_0x5832('0x10')]('[%s][queues][blindtransfer]',_0x39f9b3[_0x5832('0x4')]),_0x39f9b3);queues[_0x39f9b3[_0x5832('0x44')]]['transfer']=!![];queues[_0x39f9b3[_0x5832('0x44')]][_0x5832('0x45')]='BLIND';queues[_0x39f9b3[_0x5832('0x44')]][_0x5832('0x46')]=_0x39f9b3[_0x5832('0x47')];queues[_0x39f9b3[_0x5832('0x44')]][_0x5832('0x48')]=_0x39f9b3['transfereeuniqueid'];queues[_0x39f9b3['transfereeuniqueid']][_0x5832('0x8')]='BLINDTRANSFER';utils['info'](util[_0x5832('0x10')](_0x5832('0x49'),_0x39f9b3[_0x5832('0x4')],queues[_0x39f9b3[_0x5832('0x44')]]['name'],_0x39f9b3[_0x5832('0x44')],_0x39f9b3['extension']));}}catch(_0x25d2ea){utils[_0x5832('0x1c')](util['format'](_0x5832('0x4a'),_0x39f9b3[_0x5832('0x4')]),_0x25d2ea);}};exports[_0x5832('0x4b')]=function(_0x4d32ef){try{utils[_0x5832('0xf')](util[_0x5832('0x10')](_0x5832('0x4c'),_0x4d32ef['origtransfereruniqueid']),_0x4d32ef);if(_0x4d32ef[_0x5832('0x4d')]==_0x4d32ef[_0x5832('0x4e')]){if(!_[_0x5832('0x16')](queues[_0x4d32ef[_0x5832('0x4f')]])){utils[_0x5832('0x2')](util[_0x5832('0x10')](_0x5832('0x50'),_0x4d32ef[_0x5832('0x4d')],queues[_0x4d32ef['secondtransfererlinkedid']]['name'],_0x4d32ef[_0x5832('0x51')]));queues[_0x4d32ef[_0x5832('0x4f')]][_0x5832('0x40')]=!![];queues[_0x4d32ef['secondtransfererlinkedid']][_0x5832('0x45')]=_0x5832('0x52');queues[_0x4d32ef[_0x5832('0x4f')]][_0x5832('0x46')]=_0x4d32ef['origtransfererexten'];queues[_0x4d32ef[_0x5832('0x4f')]]['transferuniqueid']=_0x4d32ef[_0x5832('0x4d')];queues[_0x4d32ef[_0x5832('0x4f')]]['queuecallerexitreason']=_0x5832('0x53');}if(!_[_0x5832('0x16')](queues[_0x4d32ef['origtransfererlinkedid']])){if(_0x4d32ef[_0x5832('0x54')]&&queues[_0x4d32ef[_0x5832('0x54')]]){queues[_0x4d32ef[_0x5832('0x54')]]['queuecallerenterreason']=0x1;queues[_0x4d32ef[_0x5832('0x44')]]=_[_0x5832('0x55')](queues[_0x4d32ef[_0x5832('0x54')]]);queues[_0x4d32ef[_0x5832('0x44')]][_0x5832('0xe')]=_0x4d32ef[_0x5832('0x56')];queues[_0x4d32ef[_0x5832('0x44')]]['queuecallerenterreason']=0x2;queues[_0x4d32ef['transfereeuniqueid']][_0x5832('0x57')]=queues[_0x4d32ef[_0x5832('0x4f')]]['calleridnum'];queues[_0x4d32ef['transfereeuniqueid']]['calleridname']=queues[_0x4d32ef[_0x5832('0x4f')]][_0x5832('0x58')];queues[_0x4d32ef[_0x5832('0x44')]][_0x5832('0x33')]=utils['now']();queues[_0x4d32ef[_0x5832('0x44')]]['queuecallerleaveAt']=utils['now']();queues[_0x4d32ef[_0x5832('0x44')]][_0x5832('0x32')]=0x0;queues[_0x4d32ef[_0x5832('0x44')]][_0x5832('0x59')]=0x0;utils[_0x5832('0x2')](util['format'](_0x5832('0x5a'),_0x4d32ef['origtransfereruniqueid'],queues[_0x4d32ef[_0x5832('0x44')]][_0x5832('0x25')],queues[_0x4d32ef[_0x5832('0x44')]][_0x5832('0x57')],queues[_0x4d32ef[_0x5832('0x44')]]['calleridname']));}else{utils[_0x5832('0x2')](util[_0x5832('0x10')](_0x5832('0x5b'),_0x4d32ef[_0x5832('0x4d')],queues[_0x4d32ef[_0x5832('0x4e')]]['name'],_0x4d32ef[_0x5832('0x4f')]));queues[_0x4d32ef[_0x5832('0x4e')]][_0x5832('0xe')]=_0x4d32ef[_0x5832('0x4f')];}}}else if(_0x4d32ef['secondtransfereruniqueid']==_0x4d32ef[_0x5832('0x4f')]){if(!_['isNil'](queues[_0x4d32ef[_0x5832('0x4e')]])){utils[_0x5832('0x2')](util[_0x5832('0x10')](_0x5832('0x5c'),_0x4d32ef[_0x5832('0x4d')],queues[_0x4d32ef['origtransfererlinkedid']][_0x5832('0x25')],_0x4d32ef['secondtransfereruniqueid'],_0x4d32ef[_0x5832('0x5d')]));queues[_0x4d32ef[_0x5832('0x4e')]][_0x5832('0x40')]=!![];queues[_0x4d32ef[_0x5832('0x4e')]][_0x5832('0x45')]=_0x5832('0x52');queues[_0x4d32ef[_0x5832('0x4e')]][_0x5832('0x46')]=_0x4d32ef[_0x5832('0x5d')];queues[_0x4d32ef[_0x5832('0x4e')]][_0x5832('0x48')]=_0x4d32ef[_0x5832('0x5e')];queues[_0x4d32ef[_0x5832('0x4e')]][_0x5832('0x8')]=_0x5832('0x53');}if(!_[_0x5832('0x16')](queues[_0x4d32ef[_0x5832('0x4f')]])){if(_0x4d32ef[_0x5832('0x5f')]&&queues[_0x4d32ef[_0x5832('0x5f')]]){queues[_0x4d32ef[_0x5832('0x5f')]][_0x5832('0x1b')]=0x1;queues[_0x4d32ef[_0x5832('0x56')]]=_['clone'](queues[_0x4d32ef['transfertargetlinkedid']]);queues[_0x4d32ef['transfertargetuniqueid']][_0x5832('0xe')]=_0x4d32ef[_0x5832('0x56')];queues[_0x4d32ef[_0x5832('0x56')]]['queuecallerenterreason']=0x2;queues[_0x4d32ef[_0x5832('0x56')]][_0x5832('0x57')]=queues[_0x4d32ef[_0x5832('0x4e')]][_0x5832('0x57')];queues[_0x4d32ef['transfertargetuniqueid']]['calleridname']=queues[_0x4d32ef[_0x5832('0x4e')]][_0x5832('0x58')];queues[_0x4d32ef['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x5832('0x15')]();queues[_0x4d32ef[_0x5832('0x56')]][_0x5832('0x18')]=utils[_0x5832('0x15')]();queues[_0x4d32ef[_0x5832('0x56')]][_0x5832('0x32')]=0x0;queues[_0x4d32ef[_0x5832('0x56')]][_0x5832('0x59')]=0x0;utils['info'](util[_0x5832('0x10')](_0x5832('0x60'),_0x4d32ef[_0x5832('0x4d')],queues[_0x4d32ef[_0x5832('0x56')]][_0x5832('0x25')],queues[_0x4d32ef[_0x5832('0x56')]][_0x5832('0xe')],queues[_0x4d32ef[_0x5832('0x56')]][_0x5832('0x57')],queues[_0x4d32ef[_0x5832('0x56')]][_0x5832('0x58')]));}else{utils[_0x5832('0x2')](util[_0x5832('0x10')](_0x5832('0x5b'),_0x4d32ef['origtransfereruniqueid'],queues[_0x4d32ef[_0x5832('0x4f')]][_0x5832('0x25')],_0x4d32ef[_0x5832('0x4e')]));queues[_0x4d32ef[_0x5832('0x4f')]][_0x5832('0xe')]=_0x4d32ef[_0x5832('0x4e')];}}}}catch(_0x1106e2){utils[_0x5832('0x1c')](util['format'](_0x5832('0x4c'),_0x4d32ef[_0x5832('0x4d')]),_0x1106e2);}};exports['musiconholdstart']=function(_0x5b2baa){try{if(!_[_0x5832('0x16')](queues[_0x5b2baa['uniqueid']])){utils['debug'](util[_0x5832('0x10')]('[%s][queues][musiconholdstart]',_0x5b2baa[_0x5832('0x4')]),_0x5b2baa);queues[_0x5b2baa[_0x5832('0x4')]][_0x5832('0x61')]=utils['now']();utils['info'](util[_0x5832('0x10')](_0x5832('0x62'),_0x5b2baa[_0x5832('0x4')],queues[_0x5b2baa['uniqueid']][_0x5832('0x25')],queues[_0x5b2baa[_0x5832('0x4')]][_0x5832('0x61')]));}}catch(_0x27a1e9){utils[_0x5832('0x1c')](util[_0x5832('0x10')](_0x5832('0x63'),_0x5b2baa[_0x5832('0x4')]),_0x27a1e9);}};exports[_0x5832('0x64')]=function(_0x30ec8a){try{if(!_[_0x5832('0x16')](queues[_0x30ec8a[_0x5832('0x4')]])){if(!_[_0x5832('0x16')](queues[_0x30ec8a[_0x5832('0x4')]]['musiconholdstartAt'])){utils[_0x5832('0xf')](util['format'](_0x5832('0x65'),_0x30ec8a['uniqueid']),_0x30ec8a);queues[_0x30ec8a[_0x5832('0x4')]]['mohtime']+=utils['diffTime'](utils[_0x5832('0x15')](),queues[_0x30ec8a['uniqueid']][_0x5832('0x61')]);utils[_0x5832('0x2')](util['format'](_0x5832('0x66'),_0x30ec8a[_0x5832('0x4')],queues[_0x30ec8a[_0x5832('0x4')]][_0x5832('0x25')],queues[_0x30ec8a['uniqueid']]['mohtime']));delete queues[_0x30ec8a[_0x5832('0x4')]]['musiconholdstartAt'];}}}catch(_0x563224){utils[_0x5832('0x1c')](util[_0x5832('0x10')](_0x5832('0x65'),_0x30ec8a[_0x5832('0x4')]),_0x563224);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 547ac1f..100b0d9 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 _0x2edc=['type','outbound','clone','[%s][recordings][newexten]','appdata','application','toLowerCase','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','./utils','info','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','uniqueid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','format','[%s][recordings][newchannel]','newstate','debug','isNil','channelstate','linkedid','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','.WAV','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename'];(function(_0x3ed155,_0x31372f){var _0x347e7c=function(_0x5c4364){while(--_0x5c4364){_0x3ed155['push'](_0x3ed155['shift']());}};_0x347e7c(++_0x31372f);}(_0x2edc,0x1d5));var _0xc2ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2edc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc2ed('0x0'));var util=require('util');var utils=require(_0xc2ed('0x1'));var recordings={};function writeDB(_0x1075f4){utils[_0xc2ed('0x2')](util['format'](_0xc2ed('0x3'),_0x1075f4['uniqueid']));if(_0x1075f4[_0xc2ed('0x4')]){utils[_0xc2ed('0x5')](_0x1075f4[_0xc2ed('0x4')])[_0xc2ed('0x6')](function(_0x182b28){if(_0x182b28){_0x1075f4[_0xc2ed('0x7')]=_0x182b28[_0xc2ed('0x8')];_0x1075f4[_0xc2ed('0x9')]=_0x182b28['id'];}utils[_0xc2ed('0xa')](_0xc2ed('0xb'),_0x1075f4);});}else{utils['request']('CreateVoiceRecording',_0x1075f4);}}exports['newchannel']=function(_0x386013){try{utils['debug'](util['format']('[%s][recordings][newchannel]',_0x386013['uniqueid']),_0x386013);if(_0x386013[_0xc2ed('0xc')]==_0x386013['linkedid']){utils[_0xc2ed('0x2')](util['format'](_0xc2ed('0xd'),_0x386013[_0xc2ed('0xc')],_0x386013['context'],_0x386013[_0xc2ed('0xe')]));recordings[_0x386013[_0xc2ed('0xc')]]={'uniqueid':_0x386013['uniqueid'],'accountcode':_0x386013['accountcode'],'exten':_0x386013[_0xc2ed('0xe')],'context':_0x386013[_0xc2ed('0xf')],'channel':_0x386013[_0xc2ed('0x10')],'monitors':[]};}}catch(_0x59925b){utils[_0xc2ed('0x11')](util[_0xc2ed('0x12')](_0xc2ed('0x13'),_0x386013[_0xc2ed('0xc')]),_0x59925b);}};exports[_0xc2ed('0x14')]=function(_0x5e51c4){try{utils[_0xc2ed('0x15')](util[_0xc2ed('0x12')]('[%s][recordings][newstate]',_0x5e51c4[_0xc2ed('0xc')]),_0x5e51c4);if(!_[_0xc2ed('0x16')](recordings[_0x5e51c4['uniqueid']])&&_0x5e51c4[_0xc2ed('0x17')]==0x6){utils[_0xc2ed('0x2')](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x5e51c4[_0xc2ed('0xc')],_0x5e51c4[_0xc2ed('0xf')],_0x5e51c4[_0xc2ed('0x10')]));}else if(!_[_0xc2ed('0x16')](recordings[_0x5e51c4[_0xc2ed('0x18')]])&&_0x5e51c4[_0xc2ed('0x17')]==0x6&&_0x5e51c4['context']!='transfer'){utils[_0xc2ed('0x2')](util['format'](_0xc2ed('0x19'),_0x5e51c4[_0xc2ed('0xc')],_0x5e51c4[_0xc2ed('0x18')],_0x5e51c4['context'],_0x5e51c4[_0xc2ed('0x10')]));recordings[_0x5e51c4[_0xc2ed('0x18')]]['accountcode']=_0x5e51c4[_0xc2ed('0x4')];}}catch(_0x583a82){utils[_0xc2ed('0x11')](util[_0xc2ed('0x12')]('[%s][recordings][newstate]',_0x5e51c4[_0xc2ed('0xc')]),_0x583a82);}};exports[_0xc2ed('0x1a')]=function(_0x23d6e7){try{if(!_[_0xc2ed('0x16')](_0x23d6e7[_0xc2ed('0x1b')])&&!_['isNil'](_0x23d6e7[_0xc2ed('0x1b')][_0xc2ed('0x1c')])){utils['debug'](util['format'](_0xc2ed('0x1d'),_0x23d6e7['uniqueid']),_0x23d6e7);utils[_0xc2ed('0x2')](util[_0xc2ed('0x12')](_0xc2ed('0x1e'),_0x23d6e7[_0xc2ed('0xc')],_0x23d6e7[_0xc2ed('0x1b')],_0x23d6e7['value']));if(_['endsWith'](_0x23d6e7[_0xc2ed('0x1f')],_0xc2ed('0x20'))){_0x23d6e7[_0xc2ed('0x1f')]=_0x23d6e7[_0xc2ed('0x1f')]['replace']('.wav49',_0xc2ed('0x21'));}if(recordings[_0x23d6e7[_0xc2ed('0x18')]]){var _0x593ebf=_['find'](recordings[_0x23d6e7[_0xc2ed('0x18')]][_0xc2ed('0x22')],{'value':_0x23d6e7['value']});if(_['isNil'](_0x593ebf)){recordings[_0x23d6e7['linkedid']][_0xc2ed('0x22')][_0xc2ed('0x23')]({'value':_0x23d6e7[_0xc2ed('0x1f')]});}}}}catch(_0x50661d){utils[_0xc2ed('0x11')](util[_0xc2ed('0x12')]('[%s][recordings][varset]',_0x23d6e7['uniqueid']),_0x50661d);}};exports[_0xc2ed('0x24')]=function(_0x133059){try{if(!_['isNil'](recordings[_0x133059[_0xc2ed('0xc')]])){utils[_0xc2ed('0x15')](util['format'](_0xc2ed('0x25'),_0x133059[_0xc2ed('0xc')]),_0x133059);utils[_0xc2ed('0x2')](util[_0xc2ed('0x12')](_0xc2ed('0x26'),_0x133059[_0xc2ed('0xc')],_0x133059[_0xc2ed('0x27')],_0x133059[_0xc2ed('0x28')],_0x133059[_0xc2ed('0x29')]));recordings[_0x133059['uniqueid']][_0xc2ed('0x27')]=_0x133059[_0xc2ed('0x27')];recordings[_0x133059['uniqueid']]['calleridname']=_0x133059[_0xc2ed('0x28')];recordings[_0x133059[_0xc2ed('0xc')]][_0xc2ed('0x2a')]=_0x133059[_0xc2ed('0x2a')];recordings[_0x133059[_0xc2ed('0xc')]][_0xc2ed('0x2b')]=_0x133059[_0xc2ed('0x2b')];if(recordings[_0x133059[_0xc2ed('0xc')]][_0xc2ed('0x2c')]==_0xc2ed('0x2d')&&recordings[_0x133059[_0xc2ed('0xc')]][_0xc2ed('0x4')]){recordings[_0x133059[_0xc2ed('0xc')]][_0xc2ed('0x2a')]=recordings[_0x133059[_0xc2ed('0xc')]]['accountcode'];recordings[_0x133059[_0xc2ed('0xc')]]['connectedlinename']='';}recordings[_0x133059['uniqueid']][_0xc2ed('0x22')]['forEach'](function(_0x34b758){var _0x197d5a=_[_0xc2ed('0x2e')](recordings[_0x133059[_0xc2ed('0xc')]]);_0x197d5a['value']=_0x34b758[_0xc2ed('0x1f')];writeDB(_0x197d5a);});delete recordings[_0x133059[_0xc2ed('0xc')]];}}catch(_0x2729cd){utils[_0xc2ed('0x11')](util[_0xc2ed('0x12')](_0xc2ed('0x25'),_0x133059[_0xc2ed('0xc')]),_0x2729cd);}};exports['newexten']=function(_0x3c18ee){try{if(!_[_0xc2ed('0x16')](recordings[_0x3c18ee[_0xc2ed('0xc')]])){utils['debug'](util[_0xc2ed('0x12')](_0xc2ed('0x2f'),_0x3c18ee[_0xc2ed('0xc')]),_0x3c18ee);utils['info'](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x3c18ee[_0xc2ed('0xc')],_0x3c18ee['application'],_0x3c18ee[_0xc2ed('0x30')]));if(_0x3c18ee[_0xc2ed('0x31')][_0xc2ed('0x32')]()=='set'&&_['startsWith'](_0x3c18ee[_0xc2ed('0x30')]['toLowerCase'](),'cdr')){var _0x2aeb82=_0x3c18ee[_0xc2ed('0x30')][_0xc2ed('0x33')]('=');var _0x5e73a1=_0x2aeb82[0x0][_0xc2ed('0x34')](_0x2aeb82[0x0][_0xc2ed('0x35')]('(')+0x1,_0x2aeb82[0x0][_0xc2ed('0x35')](')'));var _0x55f183=_0x2aeb82[0x1];recordings[_0x3c18ee[_0xc2ed('0xc')]][_0x5e73a1]=_0x55f183;}}}catch(_0x1a73e2){utils[_0xc2ed('0x11')](util[_0xc2ed('0x12')](_0xc2ed('0x2f'),_0x3c18ee[_0xc2ed('0xc')]),_0x1a73e2);}};exports[_0xc2ed('0x36')]=function(_0x5b05a0){try{if(!_['isNil'](recordings[_0x5b05a0[_0xc2ed('0xc')]])){utils[_0xc2ed('0x15')](util['format']('[%s][recordings][queuecallerjoin]',_0x5b05a0[_0xc2ed('0xc')]),_0x5b05a0);utils['info'](util[_0xc2ed('0x12')](_0xc2ed('0x37'),_0x5b05a0[_0xc2ed('0xc')],_0x5b05a0['queue']));recordings[_0x5b05a0[_0xc2ed('0xc')]][_0xc2ed('0x38')]=_0x5b05a0['queue'];}}catch(_0xbdfa77){utils['error'](util[_0xc2ed('0x12')]('[%s][recordings][queuecallerjoin]',_0x5b05a0['uniqueid']),_0xbdfa77);}}; \ No newline at end of file +var _0x3e35=['appdata','toLowerCase','set','startsWith','split','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','uniqueid','accountcode','getUserByInternal','then','membername','UserId','request','CreateVoiceRecording','newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','replace','.wav49','.WAV','find','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','clone','newexten','[%s][recordings][newexten]','application'];(function(_0x407e53,_0x28c7bb){var _0x4b7088=function(_0x465143){while(--_0x465143){_0x407e53['push'](_0x407e53['shift']());}};_0x4b7088(++_0x28c7bb);}(_0x3e35,0x1ad));var _0x53e3=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0x3e35[_0x503950];return _0x1657a9;};'use strict';var _=require(_0x53e3('0x0'));var util=require(_0x53e3('0x1'));var utils=require(_0x53e3('0x2'));var recordings={};function writeDB(_0x402cc7){utils[_0x53e3('0x3')](util[_0x53e3('0x4')]('[%s][recordings][writeDB]',_0x402cc7[_0x53e3('0x5')]));if(_0x402cc7[_0x53e3('0x6')]){utils[_0x53e3('0x7')](_0x402cc7['accountcode'])[_0x53e3('0x8')](function(_0x402881){if(_0x402881){_0x402cc7[_0x53e3('0x9')]=_0x402881['name'];_0x402cc7[_0x53e3('0xa')]=_0x402881['id'];}utils[_0x53e3('0xb')](_0x53e3('0xc'),_0x402cc7);});}else{utils[_0x53e3('0xb')](_0x53e3('0xc'),_0x402cc7);}}exports[_0x53e3('0xd')]=function(_0x2379ac){try{utils[_0x53e3('0xe')](util[_0x53e3('0x4')]('[%s][recordings][newchannel]',_0x2379ac[_0x53e3('0x5')]),_0x2379ac);if(_0x2379ac[_0x53e3('0x5')]==_0x2379ac[_0x53e3('0xf')]){utils[_0x53e3('0x3')](util[_0x53e3('0x4')](_0x53e3('0x10'),_0x2379ac[_0x53e3('0x5')],_0x2379ac['context'],_0x2379ac['exten']));recordings[_0x2379ac[_0x53e3('0x5')]]={'uniqueid':_0x2379ac['uniqueid'],'accountcode':_0x2379ac['accountcode'],'exten':_0x2379ac[_0x53e3('0x11')],'context':_0x2379ac[_0x53e3('0x12')],'channel':_0x2379ac[_0x53e3('0x13')],'monitors':[]};}}catch(_0x9ce769){utils[_0x53e3('0x14')](util['format'](_0x53e3('0x15'),_0x2379ac[_0x53e3('0x5')]),_0x9ce769);}};exports[_0x53e3('0x16')]=function(_0x13ab67){try{utils[_0x53e3('0xe')](util[_0x53e3('0x4')](_0x53e3('0x17'),_0x13ab67[_0x53e3('0x5')]),_0x13ab67);if(!_[_0x53e3('0x18')](recordings[_0x13ab67['uniqueid']])&&_0x13ab67[_0x53e3('0x19')]==0x6){utils[_0x53e3('0x3')](util[_0x53e3('0x4')](_0x53e3('0x1a'),_0x13ab67[_0x53e3('0x5')],_0x13ab67['context'],_0x13ab67[_0x53e3('0x13')]));}else if(!_[_0x53e3('0x18')](recordings[_0x13ab67['linkedid']])&&_0x13ab67[_0x53e3('0x19')]==0x6&&_0x13ab67[_0x53e3('0x12')]!=_0x53e3('0x1b')){utils['info'](util['format'](_0x53e3('0x1c'),_0x13ab67[_0x53e3('0x5')],_0x13ab67[_0x53e3('0xf')],_0x13ab67[_0x53e3('0x12')],_0x13ab67['channel']));recordings[_0x13ab67[_0x53e3('0xf')]][_0x53e3('0x6')]=_0x13ab67['accountcode'];}}catch(_0x15666b){utils[_0x53e3('0x14')](util[_0x53e3('0x4')](_0x53e3('0x17'),_0x13ab67[_0x53e3('0x5')]),_0x15666b);}};exports[_0x53e3('0x1d')]=function(_0x365e96){try{if(!_[_0x53e3('0x18')](_0x365e96[_0x53e3('0x1e')])&&!_[_0x53e3('0x18')](_0x365e96[_0x53e3('0x1e')][_0x53e3('0x1f')])){utils[_0x53e3('0xe')](util[_0x53e3('0x4')](_0x53e3('0x20'),_0x365e96[_0x53e3('0x5')]),_0x365e96);utils[_0x53e3('0x3')](util[_0x53e3('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x365e96[_0x53e3('0x5')],_0x365e96['variable'],_0x365e96[_0x53e3('0x21')]));if(_['endsWith'](_0x365e96[_0x53e3('0x21')],'.wav49')){_0x365e96[_0x53e3('0x21')]=_0x365e96[_0x53e3('0x21')][_0x53e3('0x22')](_0x53e3('0x23'),_0x53e3('0x24'));}if(recordings[_0x365e96[_0x53e3('0xf')]]){var _0x3ac135=_[_0x53e3('0x25')](recordings[_0x365e96[_0x53e3('0xf')]][_0x53e3('0x26')],{'value':_0x365e96[_0x53e3('0x21')]});if(_[_0x53e3('0x18')](_0x3ac135)){recordings[_0x365e96[_0x53e3('0xf')]][_0x53e3('0x26')]['push']({'value':_0x365e96[_0x53e3('0x21')]});}}}}catch(_0x22b152){utils['error'](util['format'](_0x53e3('0x20'),_0x365e96[_0x53e3('0x5')]),_0x22b152);}};exports[_0x53e3('0x27')]=function(_0x15e1e9){try{if(!_[_0x53e3('0x18')](recordings[_0x15e1e9[_0x53e3('0x5')]])){utils[_0x53e3('0xe')](util['format'](_0x53e3('0x28'),_0x15e1e9[_0x53e3('0x5')]),_0x15e1e9);utils[_0x53e3('0x3')](util[_0x53e3('0x4')](_0x53e3('0x29'),_0x15e1e9[_0x53e3('0x5')],_0x15e1e9[_0x53e3('0x2a')],_0x15e1e9[_0x53e3('0x2b')],_0x15e1e9['cause-txt']));recordings[_0x15e1e9['uniqueid']][_0x53e3('0x2a')]=_0x15e1e9[_0x53e3('0x2a')];recordings[_0x15e1e9[_0x53e3('0x5')]]['calleridname']=_0x15e1e9[_0x53e3('0x2b')];recordings[_0x15e1e9[_0x53e3('0x5')]][_0x53e3('0x2c')]=_0x15e1e9[_0x53e3('0x2c')];recordings[_0x15e1e9[_0x53e3('0x5')]][_0x53e3('0x2d')]=_0x15e1e9[_0x53e3('0x2d')];if(recordings[_0x15e1e9[_0x53e3('0x5')]][_0x53e3('0x2e')]=='outbound'&&recordings[_0x15e1e9[_0x53e3('0x5')]]['accountcode']){recordings[_0x15e1e9[_0x53e3('0x5')]]['connectedlinenum']=recordings[_0x15e1e9['uniqueid']][_0x53e3('0x6')];recordings[_0x15e1e9[_0x53e3('0x5')]][_0x53e3('0x2d')]='';}recordings[_0x15e1e9['uniqueid']]['monitors']['forEach'](function(_0x45f333){var _0x41e84f=_[_0x53e3('0x2f')](recordings[_0x15e1e9[_0x53e3('0x5')]]);_0x41e84f[_0x53e3('0x21')]=_0x45f333[_0x53e3('0x21')];writeDB(_0x41e84f);});delete recordings[_0x15e1e9[_0x53e3('0x5')]];}}catch(_0xfb41da){utils['error'](util[_0x53e3('0x4')](_0x53e3('0x28'),_0x15e1e9[_0x53e3('0x5')]),_0xfb41da);}};exports[_0x53e3('0x30')]=function(_0x1e0fc4){try{if(!_['isNil'](recordings[_0x1e0fc4['uniqueid']])){utils[_0x53e3('0xe')](util['format'](_0x53e3('0x31'),_0x1e0fc4[_0x53e3('0x5')]),_0x1e0fc4);utils[_0x53e3('0x3')](util[_0x53e3('0x4')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x1e0fc4[_0x53e3('0x5')],_0x1e0fc4[_0x53e3('0x32')],_0x1e0fc4[_0x53e3('0x33')]));if(_0x1e0fc4[_0x53e3('0x32')][_0x53e3('0x34')]()==_0x53e3('0x35')&&_[_0x53e3('0x36')](_0x1e0fc4[_0x53e3('0x33')][_0x53e3('0x34')](),'cdr')){var _0x59a600=_0x1e0fc4['appdata'][_0x53e3('0x37')]('=');var _0x48235c=_0x59a600[0x0]['substring'](_0x59a600[0x0]['lastIndexOf']('(')+0x1,_0x59a600[0x0]['lastIndexOf'](')'));var _0x2967fb=_0x59a600[0x1];recordings[_0x1e0fc4[_0x53e3('0x5')]][_0x48235c]=_0x2967fb;}}}catch(_0x5e8612){utils[_0x53e3('0x14')](util[_0x53e3('0x4')](_0x53e3('0x31'),_0x1e0fc4['uniqueid']),_0x5e8612);}};exports[_0x53e3('0x38')]=function(_0x153244){try{if(!_[_0x53e3('0x18')](recordings[_0x153244[_0x53e3('0x5')]])){utils[_0x53e3('0xe')](util[_0x53e3('0x4')](_0x53e3('0x39'),_0x153244[_0x53e3('0x5')]),_0x153244);utils[_0x53e3('0x3')](util[_0x53e3('0x4')](_0x53e3('0x3a'),_0x153244['uniqueid'],_0x153244[_0x53e3('0x3b')]));recordings[_0x153244[_0x53e3('0x5')]][_0x53e3('0x3b')]=_0x153244[_0x53e3('0x3b')];}}catch(_0x4d98c3){utils[_0x53e3('0x14')](util[_0x53e3('0x4')]('[%s][recordings][queuecallerjoin]',_0x153244['uniqueid']),_0x4d98c3);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index d22cd94..5122277 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 _0x8c0f=['origtransfereruniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','uniqueid','transferercalleridnum','transferercalleridname','transfereecalleridname','type','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','[%s][transfers][attendedtransfer]','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s'];(function(_0x24d24e,_0x4e17a4){var _0x20e068=function(_0x48d5e5){while(--_0x48d5e5){_0x24d24e['push'](_0x24d24e['shift']());}};_0x20e068(++_0x4e17a4);}(_0x8c0f,0x1be));var _0xf8c0=function(_0x49281d,_0x3dc286){_0x49281d=_0x49281d-0x0;var _0x3c594f=_0x8c0f[_0x49281d];return _0x3c594f;};'use strict';var _=require('lodash');var util=require(_0xf8c0('0x0'));var utils=require(_0xf8c0('0x1'));function writeDB(_0x8195ac){utils[_0xf8c0('0x2')](util[_0xf8c0('0x3')](_0xf8c0('0x4'),_0x8195ac['type']==='attended'?_0x8195ac[_0xf8c0('0x5')]:_0x8195ac['uniqueid'],_0x8195ac['type']));utils[_0xf8c0('0x6')](_0xf8c0('0x7'),_0x8195ac);}exports[_0xf8c0('0x8')]={};exports[_0xf8c0('0x9')]=function(_0x250cfd){try{utils[_0xf8c0('0xa')](util[_0xf8c0('0x3')]('[%s][transfers][blindtransfer]',_0x250cfd[_0xf8c0('0xb')]),_0x250cfd);utils[_0xf8c0('0x2')](util[_0xf8c0('0x3')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x250cfd[_0xf8c0('0xb')],_0x250cfd[_0xf8c0('0xc')],_0x250cfd[_0xf8c0('0xd')],_0x250cfd['transfereecalleridnum'],_0x250cfd[_0xf8c0('0xe')]));_0x250cfd[_0xf8c0('0xf')]=_0xf8c0('0x10');exports[_0xf8c0('0x8')][_0x250cfd[_0xf8c0('0x11')]]=_0x250cfd;writeDB(_0x250cfd);}catch(_0x3374d3){utils[_0xf8c0('0x12')](util[_0xf8c0('0x3')]('[%s][transfers][blindtransfer]',_0x250cfd[_0xf8c0('0xb')]),_0x3374d3);}};exports[_0xf8c0('0x13')]=function(_0x22ce86){try{utils[_0xf8c0('0xa')](util[_0xf8c0('0x3')]('[%s][transfers][attendedtransfer]',_0x22ce86[_0xf8c0('0x5')]),_0x22ce86);utils[_0xf8c0('0x2')](util[_0xf8c0('0x3')](_0xf8c0('0x14'),_0x22ce86[_0xf8c0('0x5')],_0x22ce86[_0xf8c0('0x15')],_0x22ce86[_0xf8c0('0x16')],_0x22ce86[_0xf8c0('0x17')],_0x22ce86[_0xf8c0('0x18')]));_0x22ce86=_[_0xf8c0('0x19')](_0x22ce86,{'transfererchannel':_0x22ce86['origtransfererchannel'],'transferercalleridnum':_0x22ce86[_0xf8c0('0x15')],'transferercalleridname':_0x22ce86[_0xf8c0('0x16')],'transfererconnectedlinenum':_0x22ce86['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x22ce86[_0xf8c0('0x1a')],'transfereraccountcode':_0x22ce86[_0xf8c0('0x1b')],'transferercontext':_0x22ce86[_0xf8c0('0x1c')],'transfererexten':_0x22ce86[_0xf8c0('0x1d')],'transfererlinkedid':_0x22ce86['origtransfererlinkedid'],'context':_0x22ce86[_0xf8c0('0x1e')],'extension':_0x22ce86[_0xf8c0('0x1f')],'type':_0xf8c0('0x20')});if(_[_0xf8c0('0x21')](_0x22ce86[_0xf8c0('0x22')])){_0x22ce86=_[_0xf8c0('0x19')](_0x22ce86,{'transfereechannel':_0x22ce86[_0xf8c0('0x23')],'transfereecalleridnum':_0x22ce86['transfertargetcalleridnum'],'transfereecalleridname':_0x22ce86[_0xf8c0('0x18')],'transfereeconnectedlinenum':_0x22ce86[_0xf8c0('0x24')],'transfereeconnectedlinename':_0x22ce86['transfertargetconnectedlinename'],'transfereeaccountcode':_0x22ce86[_0xf8c0('0x25')],'transfereecontext':_0x22ce86[_0xf8c0('0x26')],'transfereeexten':_0x22ce86[_0xf8c0('0x27')],'transfereelinkedid':_0x22ce86['transfertargetlinkedid']});}writeDB(_0x22ce86);}catch(_0x3518a7){utils['error'](util[_0xf8c0('0x3')](_0xf8c0('0x28'),_0x22ce86[_0xf8c0('0x5')]),_0x3518a7);}}; \ No newline at end of file +var _0x07b6=['transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname'];(function(_0x11b062,_0x2366ac){var _0xbc771d=function(_0x3d33ba){while(--_0x3d33ba){_0x11b062['push'](_0x11b062['shift']());}};_0xbc771d(++_0x2366ac);}(_0x07b6,0xa6));var _0x607b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x07b6[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x607b('0x0'));var utils=require(_0x607b('0x1'));function writeDB(_0x5a5537){utils[_0x607b('0x2')](util[_0x607b('0x3')](_0x607b('0x4'),_0x5a5537[_0x607b('0x5')]===_0x607b('0x6')?_0x5a5537[_0x607b('0x7')]:_0x5a5537[_0x607b('0x8')],_0x5a5537[_0x607b('0x5')]));utils[_0x607b('0x9')](_0x607b('0xa'),_0x5a5537);}exports[_0x607b('0xb')]={};exports[_0x607b('0xc')]=function(_0x4b2a5a){try{utils[_0x607b('0xd')](util['format'](_0x607b('0xe'),_0x4b2a5a[_0x607b('0x8')]),_0x4b2a5a);utils[_0x607b('0x2')](util[_0x607b('0x3')](_0x607b('0xf'),_0x4b2a5a[_0x607b('0x8')],_0x4b2a5a[_0x607b('0x10')],_0x4b2a5a[_0x607b('0x11')],_0x4b2a5a[_0x607b('0x12')],_0x4b2a5a[_0x607b('0x13')]));_0x4b2a5a['type']=_0x607b('0x14');exports[_0x607b('0xb')][_0x4b2a5a['transfereruniqueid']]=_0x4b2a5a;writeDB(_0x4b2a5a);}catch(_0x1319c4){utils[_0x607b('0x15')](util[_0x607b('0x3')](_0x607b('0xe'),_0x4b2a5a[_0x607b('0x8')]),_0x1319c4);}};exports[_0x607b('0x16')]=function(_0x219335){try{utils[_0x607b('0xd')](util[_0x607b('0x3')](_0x607b('0x17'),_0x219335[_0x607b('0x7')]),_0x219335);utils[_0x607b('0x2')](util[_0x607b('0x3')](_0x607b('0x18'),_0x219335['origtransfereruniqueid'],_0x219335[_0x607b('0x19')],_0x219335[_0x607b('0x1a')],_0x219335[_0x607b('0x1b')],_0x219335[_0x607b('0x1c')]));_0x219335=_[_0x607b('0x1d')](_0x219335,{'transfererchannel':_0x219335[_0x607b('0x1e')],'transferercalleridnum':_0x219335[_0x607b('0x19')],'transferercalleridname':_0x219335[_0x607b('0x1a')],'transfererconnectedlinenum':_0x219335[_0x607b('0x1f')],'transfererconnectedlinename':_0x219335[_0x607b('0x20')],'transfereraccountcode':_0x219335[_0x607b('0x21')],'transferercontext':_0x219335[_0x607b('0x22')],'transfererexten':_0x219335[_0x607b('0x23')],'transfererlinkedid':_0x219335[_0x607b('0x24')],'context':_0x219335[_0x607b('0x25')],'extension':_0x219335[_0x607b('0x26')],'type':'attended'});if(_[_0x607b('0x27')](_0x219335[_0x607b('0x28')])){_0x219335=_[_0x607b('0x1d')](_0x219335,{'transfereechannel':_0x219335['transfertargetchannel'],'transfereecalleridnum':_0x219335['transfertargetcalleridnum'],'transfereecalleridname':_0x219335['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x219335['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x219335[_0x607b('0x29')],'transfereeaccountcode':_0x219335[_0x607b('0x2a')],'transfereecontext':_0x219335[_0x607b('0x2b')],'transfereeexten':_0x219335[_0x607b('0x2c')],'transfereelinkedid':_0x219335[_0x607b('0x2d')]});}writeDB(_0x219335);}catch(_0x3944c3){utils[_0x607b('0x15')](util[_0x607b('0x3')](_0x607b('0x17'),_0x219335[_0x607b('0x7')]),_0x3944c3);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 2f4867a..8433f84 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 _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xb10b,0x12a));var _0xbb10=function(_0x329ba0,_0x2e889b){_0x329ba0=_0x329ba0-0x0;var _0x526123=_0xb10b[_0x329ba0];return _0x526123;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file +var _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b5c23,_0x101faa){_0x4b5c23=_0x4b5c23-0x0;var _0x262cfd=_0xb10b[_0x4b5c23];return _0x262cfd;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file -- 1.7.1